diff --git a/soong_workflow/.DS_Store b/soong_workflow/.DS_Store index 9001a4875..669319083 100644 Binary files a/soong_workflow/.DS_Store and b/soong_workflow/.DS_Store differ diff --git a/yuthon_property_approval/data/property_contract_time.xml b/yuthon_property_approval/data/property_contract_time.xml index fbbc10d3e..4f996a0ed 100644 --- a/yuthon_property_approval/data/property_contract_time.xml +++ b/yuthon_property_approval/data/property_contract_time.xml @@ -18,13 +18,13 @@ 定时任务:更新物业状态 - code + codew model.get_yuthon_property_time() 1 days - + -1 diff --git a/yuthon_property_approval/report/contract_accounts_receivable_templates.xml b/yuthon_property_approval/report/contract_accounts_receivable_templates.xml index b61bcff29..cc5e69474 100644 --- a/yuthon_property_approval/report/contract_accounts_receivable_templates.xml +++ b/yuthon_property_approval/report/contract_accounts_receivable_templates.xml @@ -53,8 +53,24 @@
diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml index e531a36c4..8e3204f78 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml @@ -88,6 +88,7 @@ 物业对账单 property.reconciliation.wizard form + new \ No newline at end of file diff --git a/yuthon_report/__manifest__.py b/yuthon_report/__manifest__.py index 1ecce67cc..8bd54ebfb 100644 --- a/yuthon_report/__manifest__.py +++ b/yuthon_report/__manifest__.py @@ -19,7 +19,7 @@ 'web.assets_backend': [ # 样式 'yuthon_report/static/src/lib/ag-local/zh.js', - 'yuthon_report/static/src/lib/ag-grid-c/styles/ag-grid.css', + # 'yuthon_report/static/src/lib/ag-grid-c/styles/ag-grid.css', # 'yuthon_report/static/src/lib/ag-grid-c/styles/ag-theme-alpine.css', # 'yuthon_report/static/src/lib/ag-grid-c/styles/ag-theme-balham.min.css', 'yuthon_report/static/src/lib/ag-grid-c/styles/ag-theme-quartz.min.css', @@ -28,6 +28,7 @@ 'yuthon_report/static/src/lib/ag-grid-c/dist/ag-grid-community.js', # 再引入 enterprise 'yuthon_report/static/src/lib/ag-grid-e/dist/ag-grid-enterprise.js', + 'yuthon_report/static/src/lib/ag-chart/dist/umd/ag-charts-enterprise.min.js', 'yuthon_report/static/src/components/yuthon_report/yuthon_report.js', 'yuthon_report/static/src/components/yuthon_report/yuthon_report.xml', diff --git a/yuthon_report/static/src/components/yuthon_report/receivable_report.js b/yuthon_report/static/src/components/yuthon_report/receivable_report.js index 63cc149af..ad45b2c3b 100644 --- a/yuthon_report/static/src/components/yuthon_report/receivable_report.js +++ b/yuthon_report/static/src/components/yuthon_report/receivable_report.js @@ -1,37 +1,42 @@ /** @odoo-module1 **/ -import { registry } from "@web/core/registry"; -import { Component, onMounted, useRef, useState } from "@odoo/owl"; -import { useBus, useService } from "@web/core/utils/hooks"; -import { standardActionServiceProps } from "@web/webclient/actions/action_service"; -import { DateTimeInput } from "@web/core/datetime/datetime_input"; -import { CheckBox } from "@web/core/checkbox/checkbox"; -import { Many2XAutocomplete } from "@web/views/fields/relational_utils"; +import {registry} from "@web/core/registry"; +import {Component, onMounted, useRef, useState} from "@odoo/owl"; +import {useBus, useService} from "@web/core/utils/hooks"; +import { + standardActionServiceProps +} from "@web/webclient/actions/action_service"; +import {DateTimeInput} from "@web/core/datetime/datetime_input"; +import {CheckBox} from "@web/core/checkbox/checkbox"; +import {Many2XAutocomplete} from "@web/views/fields/relational_utils"; import {formatDate} from "@web/core/l10n/dates" +const {DateTime} = luxon; + class ReceivableReport extends Component { setup() { this.gridRef = useRef("grid"); - console.log('131231') console.log(this.props.action.context.report_config) this.serviceOrm = useService("orm") + // 计算 本月的开始,结束 + this.state = useState({ - startDate: null, - endDate: null, + startDate: DateTime.now().startOf("month"), + endDate: DateTime.now().endOf("month"), keyword: "", - booleanValue:true, - selectPartner:{}, - selectCompany:{}, - condition:false, - conditions:[{ - 'name':'自有', - 'value':'self' - },{ - 'name':'代管', - 'value':'agency' + booleanValue: true, + selectPartner: {}, + selectCompany: {}, + condition: false, + conditions: [{ + 'name': '自有', + 'value': 'self' + }, { + 'name': '代管', + 'value': 'agency' }] }); @@ -42,11 +47,25 @@ class ReceivableReport extends Component { //await loadJS("https://cdn.jsdelivr.net/npm/ag-grid-community/dist/ag-grid-community.min.js"); this.gridOptions = { localeText: AG_GRID_LOCALE_CN, - theme:agGrid.themeMaterial, + theme: agGrid.themeMaterial, columnDefs: this.config.columns || [], rowData: [], sideBar: true, - defaultColDef: { sortable: true, filter: true, width: 200,minWidth: 150,flex: false, resizable: false }, + enableCharts: true, + cellSelection: true, + defaultColDef: { + sortable: true, + filter: true, + width: 200, + minWidth: 150, + flex: false, + resizable: false + }, + getContextMenuItems(params) { + const items = params.defaultItems.slice(); + items.push("chartRange"); + return items; + }, }; this.grid = new agGrid.createGrid(this.gridRef.el, this.gridOptions); @@ -58,38 +77,40 @@ class ReceivableReport extends Component { * 改变布尔值 * @param e */ - async onChangeBoolean(v){ + async onChangeBoolean(v) { this.state.booleanValue = v } - getDomainCompany(){ + + getDomainCompany() { return [] } - getDomain(){ + getDomain() { // 过滤条件 - return [['id', 'in', [107,106, 215,112,110,214,218,173,219]]] + return [['id', 'in', [107, 106, 215, 112, 110, 214, 218, 173, 219]]] } - async onUpdatePartner(v){ + + async onUpdatePartner(v) { console.log(v) this.state.selectPartner = v[0] } - async onUpdateCompany(v){ + async onUpdateCompany(v) { this.state.selectCompany = v[0] } async onSearch() { - console.log(this.state) - let startDate = formatDate(this.state.startDate,{ format: "yyyy-MM-dd"}) - let endDate = formatDate(this.state.endDate,{ format: "yyyy-MM-dd"}) + console.log(this.state) + let startDate = formatDate(this.state.startDate, {format: "yyyy-MM-dd"}) + let endDate = formatDate(this.state.endDate, {format: "yyyy-MM-dd"}) const params = { date_start: `${startDate} 00:00:00`, date_end: `${endDate} 23:59:59`, keyword: this.state.keyword || false, - condition:this.state.condition || false, - partner_id:this.state.selectPartner?.id, - company_id:this.state.selectCompany?.id, + condition: this.state.condition || false, + partner_id: this.state.selectPartner?.id, + company_id: this.state.selectCompany?.id, }; const result = await this.serviceOrm.call( this.config.model, @@ -97,17 +118,17 @@ class ReceivableReport extends Component { [params] ); console.log(result) - this.grid.setGridOption('rowData',result); + this.grid.setGridOption('rowData', result); } onExportExcel() { this.grid.exportDataAsExcel({ - fileName: 'my-data.xlsx', - sheetName: 'Sheet1' - }); -} + fileName: 'my-data.xlsx', + sheetName: 'Sheet1' + }); + } - async onChangeStartDate(date){ + async onChangeStartDate(date) { console.log(date) // 判断 date 是数组 if (Array.isArray(date)) { @@ -115,14 +136,16 @@ class ReceivableReport extends Component { this.state.endDate = date[1] } } - async onChangeEndDate(date){ + + async onChangeEndDate(date) { if (Array.isArray(date)) { this.state.startDate = date[0]; this.state.endDate = date[1] } } } -ReceivableReport.props = {...standardActionServiceProps }; + +ReceivableReport.props = {...standardActionServiceProps}; ReceivableReport.template = "youthon_report.ReceivableReport"; ReceivableReport.components = { DateTimeInput, diff --git a/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.cjs.js b/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.cjs.js new file mode 100644 index 000000000..ee319052f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.cjs.js @@ -0,0 +1,26371 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var __decorateClass = (decorators, target, key, kind) => { + var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; + for (var i = decorators.length - 1, decorator; i >= 0; i--) + if (decorator = decorators[i]) + result = (kind ? decorator(target, key, result) : decorator(result)) || result; + if (kind && result) + __defProp(target, key, result); + return result; +}; + +// packages/ag-charts-enterprise/src/main-modules.ts +var main_modules_exports = {}; +__export(main_modules_exports, { + AllCartesianEnterpriseModules: () => AllCartesianEnterpriseModules, + AllEnterpriseModules: () => AllEnterpriseModules, + AllPolarEnterpriseModules: () => AllPolarEnterpriseModules, + AllStandaloneEnterpriseModules: () => AllStandaloneEnterpriseModules, + AllTopologyEnterpriseModules: () => AllTopologyEnterpriseModules, + AngleCategoryAxisModule: () => AngleCategoryAxisModule, + AngleNumberAxisModule: () => AngleNumberAxisModule, + BoxPlotSeriesModule: () => BoxPlotSeriesModule, + CandlestickSeriesModule: () => CandlestickSeriesModule, + ChordSeriesModule: () => ChordSeriesModule, + ConeFunnelSeriesModule: () => ConeFunnelSeriesModule, + FunnelSeriesModule: () => FunnelSeriesModule, + HeatmapSeriesModule: () => HeatmapSeriesModule, + LinearGaugeSeriesModule: () => LinearGaugeSeriesModule, + MapLineBackgroundSeriesModule: () => MapLineBackgroundSeriesModule, + MapLineSeriesModule: () => MapLineSeriesModule, + MapMarkerSeriesModule: () => MapMarkerSeriesModule, + MapShapeBackgroundSeriesModule: () => MapShapeBackgroundSeriesModule, + MapShapeSeriesModule: () => MapShapeSeriesModule, + ModuleRegistry: () => ModuleRegistry, + NightingaleSeriesModule: () => NightingaleSeriesModule, + OhlcSeriesModule: () => OhlcSeriesModule, + OrdinalTimeAxisModule: () => OrdinalTimeAxisModule, + PyramidSeriesModule: () => PyramidSeriesModule, + RadarAreaSeriesModule: () => RadarAreaSeriesModule, + RadarLineSeriesModule: () => RadarLineSeriesModule, + RadialBarSeriesModule: () => RadialBarSeriesModule, + RadialColumnSeriesModule: () => RadialColumnSeriesModule, + RadialGaugeSeriesModule: () => RadialGaugeSeriesModule, + RadiusCategoryAxisModule: () => RadiusCategoryAxisModule, + RadiusNumberAxisModule: () => RadiusNumberAxisModule, + RangeAreaSeriesModule: () => RangeAreaSeriesModule, + RangeBarSeriesModule: () => RangeBarSeriesModule, + SankeySeriesModule: () => SankeySeriesModule, + StandaloneChartModule: () => StandaloneChartModule, + SunburstSeriesModule: () => SunburstSeriesModule, + TopologyChartModule: () => TopologyChartModule, + TreemapSeriesModule: () => TreemapSeriesModule, + WaterfallSeriesModule: () => WaterfallSeriesModule +}); +module.exports = __toCommonJS(main_modules_exports); +var import_ag_charts_community165 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/axes/axisModules.ts +var import_ag_charts_community13 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxis.ts +var import_ag_charts_community5 = require("ag-charts-community"); +var import_ag_charts_core4 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/utils/polar.ts +function loopSymmetrically(items, step, iterator) { + const loop = (start, end, loopStep, loopIterator) => { + let prev = items[0]; + for (let i = start; loopStep > 0 ? i <= end : i > end; i += loopStep) { + const curr = items[i]; + if (loopIterator(prev, curr)) + return true; + prev = curr; + } + return false; + }; + const midIndex = Math.floor(items.length / 2); + if (loop(step, midIndex, step, iterator)) + return true; + return loop(items.length - step, midIndex, -step, iterator); +} + +// packages/ag-charts-enterprise/src/axes/angle-number/angleAxisInterval.ts +var import_ag_charts_community = require("ag-charts-community"); +var { AxisInterval, Property } = import_ag_charts_community._ModuleSupport; +var AngleAxisInterval = class extends AxisInterval { +}; +__decorateClass([ + Property +], AngleAxisInterval.prototype, "minSpacing", 2); + +// packages/ag-charts-enterprise/src/axes/angle/angleAxis.ts +var import_ag_charts_community4 = require("ag-charts-community"); +var import_ag_charts_core3 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/angleCrossLine.ts +var import_ag_charts_community3 = require("ag-charts-community"); +var import_ag_charts_core2 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/polarCrossLine.ts +var import_ag_charts_community2 = require("ag-charts-community"); +var import_ag_charts_core = require("ag-charts-core"); +var { BaseProperties, ChartAxisDirection, Property: Property2, Group, FONT_SIZE } = import_ag_charts_community2._ModuleSupport; +var PolarCrossLineLabel = class extends BaseProperties { + constructor() { + super(...arguments); + this.fontSize = FONT_SIZE.LARGE; + this.fontFamily = "Verdana, sans-serif"; + this.padding = 5; + this.color = "rgba(87, 87, 87, 1)"; + } +}; +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "enabled", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "text", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontStyle", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontWeight", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontSize", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontFamily", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "padding", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "color", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "parallel", 2); +var PolarCrossLine = class extends BaseProperties { + constructor() { + super(...arguments); + this.id = (0, import_ag_charts_core.createId)(this); + this.defaultColorRange = []; + this.shape = "polygon"; + this.label = new PolarCrossLineLabel(); + this.scale = void 0; + this.clippedRange = [-Infinity, Infinity]; + this.gridLength = 0; + this.sideFlag = -1; + this.parallelFlipRotation = 0; + this.regularFlipRotation = 0; + this.direction = ChartAxisDirection.Angle; + this.axisInnerRadius = 0; + this.axisOuterRadius = 0; + this.lineGroup = new Group({ name: this.id }); + this.rangeGroup = new Group({ name: this.id }); + this.labelGroup = new Group({ name: this.id }); + this._isRange = void 0; + } + assignCrossLineGroup(isRange, crossLineRange) { + if (isRange !== this._isRange) { + if (isRange) { + this.rangeGroup.appendChild(crossLineRange); + } else { + this.lineGroup.appendChild(crossLineRange); + } + } + this._isRange = isRange; + } + setSectorNodeProps(node) { + node.fill = this.fill; + node.fillOpacity = this.fillOpacity ?? 1; + node.stroke = this.stroke; + node.strokeOpacity = this.strokeOpacity ?? 1; + node.strokeWidth = this.strokeWidth ?? 1; + node.lineDash = this.lineDash; + } + setLabelNodeProps(node, x, y, baseline, rotation) { + const { label } = this; + node.x = x; + node.y = y; + node.text = label.text; + node.textAlign = "center"; + node.textBaseline = baseline; + node.rotation = rotation; + node.rotationCenterX = x; + node.rotationCenterY = y; + node.fill = label.color; + node.fontFamily = label.fontFamily; + node.fontSize = label.fontSize; + node.fontStyle = label.fontStyle; + node.visible = true; + } +}; +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "enabled", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "type", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "range", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "value", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "defaultColorRange", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "fill", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "fillOpacity", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "stroke", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "strokeWidth", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "strokeOpacity", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "lineDash", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "shape", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "label", 2); + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/angleCrossLine.ts +var { + ChartAxisDirection: ChartAxisDirection2, + getCrossLineValue, + validateCrossLineValue, + normalizeAngle360, + Group: Group2, + Path, + Sector, + RotatableText, + ContinuousScale +} = import_ag_charts_community3._ModuleSupport; +var AngleCrossLine = class extends PolarCrossLine { + constructor() { + super(); + this.direction = ChartAxisDirection2.Angle; + this.polygonNode = new Path(); + this.sectorNode = new Sector(); + this.lineNode = new Path(); + this.crossLineRange = new Group2(); + this.labelNode = new RotatableText(); + this.ticks = []; + this.crossLineRange.append(this.polygonNode); + this.crossLineRange.append(this.sectorNode); + this.crossLineRange.append(this.lineNode); + this.labelGroup.append(this.labelNode); + } + visibilityCheck() { + if (!ContinuousScale.is(this.scale)) { + return true; + } + const [d0, d1] = this.scale.domain; + const value = getCrossLineValue(this); + if (this.type === "range") { + const [start, end] = value; + return start >= d0 && start <= d1 && end >= start && end <= d1; + } else { + return value >= d0 && value <= d1; + } + } + update(visible) { + const { scale } = this; + if (!scale || !validateCrossLineValue(this, scale) || !this.visibilityCheck()) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updateLineNode(visible); + this.updatePolygonNode(visible); + this.updateSectorNode(visible); + this.updateLabelNode(visible); + } + updateLineNode(visible) { + const { scale, type, value, lineNode: line } = this; + if (!visible || type !== "line" || !scale) { + line.visible = false; + return; + } + const angle = scale.convert(value); + if (Number.isNaN(angle)) { + line.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + line.visible = true; + line.stroke = this.stroke; + line.strokeOpacity = this.strokeOpacity ?? 1; + line.strokeWidth = this.strokeWidth ?? 1; + line.fill = void 0; + line.lineDash = this.lineDash; + const x = axisOuterRadius * Math.cos(angle); + const y = axisOuterRadius * Math.sin(angle); + const x0 = axisInnerRadius * Math.cos(angle); + const y0 = axisInnerRadius * Math.sin(angle); + line.path.clear(true); + line.path.moveTo(x0, y0); + line.path.lineTo(x, y); + this.assignCrossLineGroup(false, this.crossLineRange); + } + updatePolygonNode(visible) { + const { polygonNode: polygon, range: range2, scale, shape, type, ticks } = this; + if (!visible || type !== "range" || shape !== "polygon" || !scale || !range2) { + polygon.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + const startIndex = ticks.indexOf(range2[0]); + const endIndex = ticks.indexOf(range2[1]); + const stops = startIndex <= endIndex ? ticks.slice(startIndex, endIndex + 1) : ticks.slice(startIndex).concat(ticks.slice(0, endIndex + 1)); + const angles = stops.map((value) => scale.convert(value)); + polygon.visible = true; + this.setSectorNodeProps(polygon); + const { path } = polygon; + path.clear(true); + for (const [index, angle] of angles.entries()) { + const x = axisOuterRadius * Math.cos(angle); + const y = axisOuterRadius * Math.sin(angle); + if (index === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + if (axisInnerRadius === 0) { + path.lineTo(0, 0); + } else { + const reversedAngles = angles.slice().reverse(); + for (const angle of reversedAngles) { + const x = axisInnerRadius * Math.cos(angle); + const y = axisInnerRadius * Math.sin(angle); + path.lineTo(x, y); + } + } + polygon.path.closePath(); + this.assignCrossLineGroup(true, this.crossLineRange); + } + updateSectorNode(visible) { + const { sectorNode: sector, range: range2, scale, shape, type } = this; + if (!visible || type !== "range" || shape !== "circle" || !scale || !range2) { + sector.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + const angles = range2.map((value) => scale.convert(value)); + const step = scale.step ?? 0; + const padding = scale instanceof import_ag_charts_community3._ModuleSupport.BandScale ? step / 2 : 0; + sector.visible = true; + this.setSectorNodeProps(sector); + sector.centerX = 0; + sector.centerY = 0; + sector.innerRadius = axisInnerRadius; + sector.outerRadius = axisOuterRadius; + sector.startAngle = angles[0] - padding; + sector.endAngle = angles[1] + padding; + this.assignCrossLineGroup(true, this.crossLineRange); + } + updateLabelNode(visible) { + const { label, labelNode: node, range: range2, scale, type, ticks } = this; + if (!visible || label.enabled === false || !label.text || !scale || type === "range" && !range2) { + node.visible = false; + return; + } + node.visible = true; + const { axisInnerRadius, axisOuterRadius } = this; + let labelX; + let labelY; + let rotation; + let textBaseline; + if (type === "line") { + const angle = normalizeAngle360(scale.convert(this.value)); + const angle270 = 1.5 * Math.PI; + const isRightSide = (0, import_ag_charts_core2.isNumberEqual)(angle, angle270) || angle > angle270 || angle < Math.PI / 2; + const midX = (axisInnerRadius + axisOuterRadius) / 2 * Math.cos(angle); + const midY = (axisInnerRadius + axisOuterRadius) / 2 * Math.sin(angle); + labelX = midX + label.padding * Math.cos(angle + Math.PI / 2); + labelY = midY + label.padding * Math.sin(angle + Math.PI / 2); + textBaseline = isRightSide ? "top" : "bottom"; + rotation = isRightSide ? angle : angle - Math.PI; + } else { + const [startAngle, endAngle] = range2.map((value) => normalizeAngle360(scale.convert(value))); + let angle = (startAngle + endAngle) / 2; + if (startAngle > endAngle) { + angle -= Math.PI; + } + angle = normalizeAngle360(angle); + const isBottomSide = ((0, import_ag_charts_core2.isNumberEqual)(angle, 0) || angle > 0) && angle < Math.PI; + let distance; + if (this.shape === "circle" || ticks.length < 3) { + distance = axisOuterRadius - label.padding; + } else { + distance = axisOuterRadius * Math.cos(Math.PI / ticks.length) - label.padding; + } + labelX = distance * Math.cos(angle); + labelY = distance * Math.sin(angle); + textBaseline = isBottomSide ? "bottom" : "top"; + rotation = isBottomSide ? angle - Math.PI / 2 : angle + Math.PI / 2; + } + this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation); + } +}; +AngleCrossLine.className = "AngleCrossLine"; + +// packages/ag-charts-enterprise/src/axes/angle/angleAxis.ts +var { + ChartAxisDirection: ChartAxisDirection3, + Property: Property3, + toRadians, + normalizeAngle360: normalizeAngle3602, + normalizeAngle360Inclusive, + Path: Path2, + RotatableText: RotatableText2, + Transformable, + BBox, + Selection, + Line +} = import_ag_charts_community4._ModuleSupport; +var AngleAxisLabel = class extends import_ag_charts_community4._ModuleSupport.AxisLabel { + constructor() { + super(...arguments); + this.orientation = "fixed"; + } +}; +__decorateClass([ + Property3 +], AngleAxisLabel.prototype, "orientation", 2); +var AngleAxis = class extends import_ag_charts_community4._ModuleSupport.PolarAxis { + constructor(moduleCtx, scale) { + super(moduleCtx, scale); + this.startAngle = 0; + this.endAngle = void 0; + this.tickLineGroupSelection = Selection.select( + this.tickLineGroup, + Line, + false + ); + this.gridLineGroupSelection = Selection.select( + this.gridLineGroup, + Line, + false + ); + this.labelData = []; + this.tickData = []; + this.radiusLineGroup = this.axisGroup.appendChild(new import_ag_charts_community4._ModuleSupport.TransformableGroup()); + this.radiusLine = this.radiusLineGroup.appendChild(new Path2()); + this.includeInvisibleDomains = true; + } + get direction() { + return ChartAxisDirection3.Angle; + } + createLabel() { + return new AngleAxisLabel(); + } + calculateRotations() { + const rotation = toRadians(this.startAngle); + const parallelFlipRotation = normalizeAngle3602(rotation); + const regularFlipRotation = normalizeAngle3602(rotation - Math.PI / 2); + return { rotation, parallelFlipRotation, regularFlipRotation }; + } + calculateTickLayout(domain) { + const { nice, scale } = this; + const ticksParams = { + nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + const niceDomain = nice ? scale.niceDomain(ticksParams, domain) : domain; + const tickData = this.generateAngleTicks(niceDomain); + this.tickData = tickData; + const ticks = tickData.map((t) => t.value); + const fractionDigits = ticks.reduce( + (f, t) => Math.max(typeof t === "number" ? (0, import_ag_charts_core3.countFractionDigits)(t) : 0, f), + 0 + ); + return { + niceDomain, + tickDomain: niceDomain, + ticks, + rawTickCount: void 0, + fractionDigits, + timeInterval: void 0, + bbox: this.getBBox() + }; + } + update() { + super.update(); + this.updateRadiusLine(); + this.updateGridLines(); + this.updateTickLines(); + } + normalizedAngles() { + const startAngle = normalizeAngle3602(-Math.PI / 2 + toRadians(this.startAngle)); + const sweep = this.endAngle == null ? 2 * Math.PI : normalizeAngle360Inclusive(toRadians(this.endAngle) - toRadians(this.startAngle)); + const endAngle = startAngle + sweep; + return [startAngle, endAngle]; + } + computeRange() { + this.range = this.normalizedAngles(); + } + updateSelections() { + const data = this.tickData; + this.gridLineGroupSelection.update(this.gridLength && this.gridLine.enabled ? data : []); + this.tickLineGroupSelection.update(this.tick.enabled ? data : []); + this.tickLabelGroupSelection.update(this.label.enabled ? data : []); + this.gridLineGroupSelection.cleanup(); + this.tickLineGroupSelection.cleanup(); + this.tickLabelGroupSelection.cleanup(); + } + updatePosition() { + super.updatePosition(); + const { translation, radiusLineGroup } = this; + const translationX = Math.floor(translation.x); + const translationY = Math.floor(translation.y); + radiusLineGroup.translationX = translationX; + radiusLineGroup.translationY = translationY; + } + updateRadiusLine() { + const node = this.radiusLine; + const { path } = node; + path.clear(true); + const { points, closePath } = this.getAxisLinePoints(); + for (const { x, y, moveTo: moveTo2, arc, radius = 0, startAngle = 0, endAngle = 0 } of points) { + if (arc) { + path.arc(x, y, radius, startAngle, endAngle); + } else if (moveTo2) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + if (closePath) { + path.closePath(); + } + node.visible = this.line.enabled; + node.stroke = this.line.stroke; + node.strokeWidth = this.line.width; + node.fill = void 0; + } + getAxisLinePoints() { + const { scale, shape, gridLength: radius } = this; + const [startAngle, endAngle] = this.range; + const isFullCircle = (0, import_ag_charts_core3.isNumberEqual)(endAngle - startAngle, 2 * Math.PI); + const points = []; + if (shape === "circle") { + if (isFullCircle) { + points.push( + { x: radius, y: 0, moveTo: true }, + { + x: 0, + y: 0, + radius, + startAngle: 0, + endAngle: 2 * Math.PI, + arc: true, + moveTo: false + } + ); + } else { + points.push( + { + x: radius * Math.cos(startAngle), + y: radius * Math.sin(startAngle), + moveTo: true + }, + { + x: 0, + y: 0, + radius, + startAngle: normalizeAngle3602(startAngle), + endAngle: normalizeAngle3602(endAngle), + arc: true, + moveTo: false + } + ); + } + } else if (shape === "polygon") { + const angles = scale.ticks({ + nice: this.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.map((value) => scale.convert(value)); + if (angles && angles.length > 2) { + for (const [i, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + const moveTo2 = i === 0; + points.push({ x, y, moveTo: moveTo2 }); + } + } + } + return { points, closePath: isFullCircle }; + } + updateGridLines() { + const { + scale, + gridLength: radius, + gridLine: { style, width }, + innerRadiusRatio + } = this; + if (!(style && radius > 0)) { + return; + } + const innerRadius = radius * innerRadiusRatio; + const styleCount = style.length; + this.gridLineGroupSelection.each((line, datum, index) => { + const { value } = datum; + const { stroke, lineDash } = style[index % styleCount]; + const angle = scale.convert(value); + line.x1 = innerRadius * Math.cos(angle); + line.y1 = innerRadius * Math.sin(angle); + line.x2 = radius * Math.cos(angle); + line.y2 = radius * Math.sin(angle); + line.stroke = stroke; + line.strokeWidth = width; + line.lineDash = lineDash; + line.fill = void 0; + }); + this.gridLineGroupSelection.cleanup(); + } + updateLabels() { + const { label, tickLabelGroupSelection } = this; + tickLabelGroupSelection.each((node, _, index) => { + const labelDatum = this.labelData[index]; + if (!labelDatum || labelDatum.hidden) { + node.visible = false; + return; + } + node.text = labelDatum.text; + node.setFont(label); + node.fill = label.color; + node.x = labelDatum.x; + node.y = labelDatum.y; + node.setAlign(labelDatum); + node.setBoxing(label); + node.visible = true; + if (labelDatum.rotation) { + node.rotation = labelDatum.rotation; + node.rotationCenterX = labelDatum.x; + node.rotationCenterY = labelDatum.y; + } else { + node.rotation = 0; + } + }); + } + updateTickLines() { + const { scale, gridLength: radius, tick, tickLineGroupSelection } = this; + tickLineGroupSelection.each((line, datum) => { + const { value } = datum; + const angle = scale.convert(value); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + line.x1 = radius * cos; + line.y1 = radius * sin; + line.x2 = (radius + tick.size) * cos; + line.y2 = (radius + tick.size) * sin; + line.stroke = tick.stroke; + line.strokeWidth = tick.width; + }); + } + createLabelNodeData(ticks, options, seriesRect) { + const { label, gridLength: radius, scale, tick } = this; + if (!label.enabled) { + return []; + } + const tempText = new RotatableText2(); + const seriesLeft = seriesRect.x - this.translation.x; + const seriesRight = seriesRect.x + seriesRect.width - this.translation.x; + const { fractionDigits } = this.layout.label; + const axisTickFormatter = this.tickFormatter(this.scale.domain, this.tickData, false, fractionDigits); + const labelData = ticks.map((datum, index) => { + const { value } = datum; + const distance = radius + label.spacing + tick.size; + const angle = scale.convert(value); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + const x = distance * cos; + const y = distance * sin; + const { textAlign, textBaseline } = this.getLabelAlign(angle); + const isLastTickOverFirst = index === ticks.length - 1 && value !== ticks[0] && (0, import_ag_charts_core3.isNumberEqual)(normalizeAngle3602(angle), normalizeAngle3602(scale.convert(ticks[0]))); + const rotation = this.getLabelRotation(angle); + let text = axisTickFormatter(value, index); + tempText.text = text; + tempText.x = x; + tempText.y = y; + tempText.setFont(label); + tempText.textAlign = textAlign; + tempText.textBaseline = textBaseline; + tempText.rotation = rotation; + if (rotation) { + tempText.rotationCenterX = x; + tempText.rotationCenterY = y; + } + let box = rotation ? Transformable.toCanvas(tempText) : tempText.getBBox(); + if (box && options.hideWhenNecessary && !rotation) { + const overflowLeft = seriesLeft - box.x; + const overflowRight = box.x + box.width - seriesRight; + const pixelError = 1; + if (overflowLeft > pixelError || overflowRight > pixelError) { + const availWidth = box.width - Math.max(overflowLeft, overflowRight); + const wrapOptions = { maxWidth: availWidth, font: label, textWrap: "never" }; + text = (0, import_ag_charts_core3.wrapTextOrSegments)(text, wrapOptions); + tempText.text = text; + box = tempText.getBBox(); + } + } + return { + text, + x, + y, + textAlign, + textBaseline, + hidden: text === "" || (datum.hidden ?? isLastTickOverFirst), + rotation, + box + }; + }); + if (label.avoidCollisions) { + this.avoidLabelCollisions(labelData); + } + return labelData; + } + computeLabelsBBox(options, seriesRect) { + this.labelData = this.createLabelNodeData(this.tickData, options, seriesRect); + const textBoxes = this.labelData.map(({ box }) => box).filter((box) => box != null); + if (!this.label.enabled || textBoxes.length === 0) { + return null; + } + return BBox.merge(textBoxes); + } + getLabelOrientation() { + const { label } = this; + return label instanceof AngleAxisLabel ? label.orientation : "fixed"; + } + getLabelRotation(tickAngle) { + let rotation = toRadians(this.label.rotation ?? 0); + tickAngle = normalizeAngle3602(tickAngle); + const orientation = this.getLabelOrientation(); + if (orientation === "parallel") { + rotation += tickAngle; + if (tickAngle >= 0 && tickAngle < Math.PI) { + rotation -= Math.PI / 2; + } else { + rotation += Math.PI / 2; + } + } else if (orientation === "perpendicular") { + rotation += tickAngle; + if (tickAngle >= Math.PI / 2 && tickAngle < 1.5 * Math.PI) { + rotation += Math.PI; + } + } + return rotation; + } + getLabelAlign(tickAngle) { + const cos = Math.cos(tickAngle); + const sin = Math.sin(tickAngle); + let textAlign; + let textBaseline; + const orientation = this.getLabelOrientation(); + const isCos0 = (0, import_ag_charts_core3.isNumberEqual)(cos, 0); + const isSin0 = (0, import_ag_charts_core3.isNumberEqual)(sin, 0); + const isCos1 = (0, import_ag_charts_core3.isNumberEqual)(cos, 1); + const isSinMinus1 = (0, import_ag_charts_core3.isNumberEqual)(sin, -1); + const isCosPositive = cos > 0 && !isCos0; + const isSinPositive = sin > 0 && !isSin0; + if (orientation === "parallel") { + textAlign = "center"; + textBaseline = isCos1 && isSin0 || isSinPositive ? "top" : "bottom"; + } else if (orientation === "perpendicular") { + textAlign = isSinMinus1 || isCosPositive ? "left" : "right"; + textBaseline = "middle"; + } else { + textAlign = "right"; + if (isCos0) { + textAlign = "center"; + } else if (isCosPositive) { + textAlign = "left"; + } + textBaseline = "bottom"; + if (isSin0) { + textBaseline = "middle"; + } else if (isSinPositive) { + textBaseline = "top"; + } + } + return { textAlign, textBaseline }; + } + updateCrossLines() { + const { shape, gridLength: radius, innerRadiusRatio } = this; + for (const crossLine of this.crossLines) { + if (crossLine instanceof AngleCrossLine) { + crossLine.ticks = this.tickData.map((t) => t.value); + crossLine.shape = shape; + crossLine.axisOuterRadius = radius; + crossLine.axisInnerRadius = radius * innerRadiusRatio; + } + } + super.updateCrossLines(); + } +}; +AngleAxis.CrossLineConstructor = AngleCrossLine; +__decorateClass([ + Property3 +], AngleAxis.prototype, "startAngle", 2); +__decorateClass([ + Property3 +], AngleAxis.prototype, "endAngle", 2); + +// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxis.ts +var { Property: Property4, CategoryScale } = import_ag_charts_community5._ModuleSupport; +var AngleCategoryAxis = class extends AngleAxis { + constructor(moduleCtx) { + super(moduleCtx, new CategoryScale()); + this.groupPaddingInner = 0; + this.paddingInner = 0; + this.interval = new AngleAxisInterval(); + } + hasDefinedDomain() { + return false; + } + generateAngleTicks(domain) { + const { scale, gridLength: radius } = this; + const { values, minSpacing } = this.interval; + const tickParams = { + nice: this.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + const ticks = values ?? scale.ticks(tickParams, domain)?.ticks ?? []; + if (ticks.length < 2 || minSpacing == null) { + return ticks.map((value) => { + return { value, visible: true }; + }); + } + const startTick = ticks[0]; + const startAngle = scale.convert(startTick); + const startX = radius * Math.cos(startAngle); + const startY = radius * Math.sin(startAngle); + for (let step = 1; step < ticks.length - 1; step++) { + const nextTick = ticks[step]; + const nextAngle = scale.convert(nextTick); + if (nextAngle - startAngle > Math.PI) { + break; + } + const nextX = radius * Math.cos(nextAngle); + const nextY = radius * Math.sin(nextAngle); + const spacing = Math.hypot(nextX - startX, nextY - startY); + if (spacing > minSpacing) { + const visibleTicks = /* @__PURE__ */ new Set([startTick]); + loopSymmetrically(ticks, step, (_, next) => { + visibleTicks.add(next); + }); + return ticks.map((value) => { + const visible = visibleTicks.has(value); + return { value, visible }; + }); + } + } + return [{ value: startTick, visible: true }]; + } + avoidLabelCollisions(labelData) { + const { minSpacing } = this.label; + if (labelData.length < 3) + return; + const labelsCollide = (prev, next) => { + if (prev.hidden || next.hidden) { + return false; + } else if (minSpacing == null) { + return prev.box.collidesBBox(next.box); + } + const prevBox = prev.box.clone().grow(minSpacing / 2); + const nextBox = next.box.clone().grow(minSpacing / 2); + return prevBox.collidesBBox(nextBox); + }; + const firstLabel = labelData[0]; + const lastLabel = labelData.at(-1); + const visibleLabels = /* @__PURE__ */ new Set([firstLabel]); + const lastLabelIsOverFirst = (0, import_ag_charts_core4.isNumberEqual)(firstLabel.x, lastLabel.x) && (0, import_ag_charts_core4.isNumberEqual)(firstLabel.y, lastLabel.y); + const maxStep = Math.floor(labelData.length / 2); + for (let step = 1; step <= maxStep; step++) { + const labels = lastLabelIsOverFirst ? labelData.slice(0, -1) : labelData; + const collisionDetected = loopSymmetrically(labels, step, labelsCollide); + if (!collisionDetected) { + loopSymmetrically(labels, step, (_, next) => { + visibleLabels.add(next); + }); + break; + } + } + for (const datum of labelData) { + if (!visibleLabels.has(datum)) { + datum.hidden = true; + datum.box = void 0; + } + } + } + tickFormatParams() { + return { type: "category" }; + } + datumFormatParams(value, params) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +AngleCategoryAxis.className = "AngleCategoryAxis"; +AngleCategoryAxis.type = "angle-category"; +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "paddingInner", 2); +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "interval", 2); + +// packages/ag-charts-enterprise/src/axes/angle-number/angleNumberAxis.ts +var import_ag_charts_community7 = require("ag-charts-community"); +var import_ag_charts_core6 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/axes/angle-number/linearAngleScale.ts +var import_ag_charts_community6 = require("ag-charts-community"); +var import_ag_charts_core5 = require("ag-charts-core"); +var { range, isDenseInterval, LinearScale } = import_ag_charts_community6._ModuleSupport; +var LinearAngleScale = class _LinearAngleScale extends LinearScale { + constructor() { + super(...arguments); + this.arcLength = 0; + } + static getNiceStepAndTickCount(ticks, domain) { + const [start, stop] = domain; + let step = LinearScale.getTickStep(start, stop, ticks); + const maxTickCount = Number.isNaN(ticks.maxTickCount) ? Infinity : ticks.maxTickCount; + const expectedTickCount = Math.abs(stop - start) / step; + let niceTickCount = Math.pow(2, Math.ceil(Math.log(expectedTickCount) / Math.log(2))); + if (niceTickCount > maxTickCount) { + niceTickCount /= 2; + step *= 2; + } + return { count: niceTickCount, step }; + } + ticks(ticks, domain = this.domain) { + const { arcLength } = this; + if (!domain || domain.length < 2 || domain.some((d) => !Number.isFinite(d)) || arcLength <= 0) { + return { ticks: [], count: 0 }; + } + const { nice, interval } = ticks; + const [d0, d1] = domain; + if (interval) { + const step2 = Math.abs(interval); + const availableRange = this.getPixelRange(); + if (!isDenseInterval((d1 - d0) / step2, availableRange)) { + return range(d0, d1, step2); + } + } + let step; + if (nice && this.hasNiceRange()) { + const linearNiceDomain = super.niceDomain(ticks, domain); + step = _LinearAngleScale.getNiceStepAndTickCount(ticks, linearNiceDomain).step; + } else { + step = LinearScale.getTickStep(d0, d1, ticks); + } + return range(d0, d1, step); + } + hasNiceRange() { + const sortedRange = this.range.slice().sort((a, b) => a - b); + const niceRanges = [Math.PI, 2 * Math.PI]; + return niceRanges.some((r) => (0, import_ag_charts_core5.isNumberEqual)(r, sortedRange[1] - sortedRange[0])); + } + niceDomain(ticks, domain = this.domain) { + const linearNiceDomain = super.niceDomain(ticks, domain); + if (!this.hasNiceRange()) + return linearNiceDomain; + const reversed = linearNiceDomain[0] > linearNiceDomain[1]; + const start = reversed ? linearNiceDomain[1] : linearNiceDomain[0]; + const { step, count } = _LinearAngleScale.getNiceStepAndTickCount(ticks, linearNiceDomain); + const s = 1 / step; + const stop = step >= 1 ? Math.ceil(start / step + count) * step : Math.ceil((start + count * step) * s) / s; + return reversed ? [stop, start] : [start, stop]; + } + getPixelRange() { + return this.arcLength; + } +}; + +// packages/ag-charts-enterprise/src/axes/angle-number/angleNumberAxis.ts +var { Property: Property5, angleBetween, normalisedExtentWithMetadata, findMinMax } = import_ag_charts_community7._ModuleSupport; +var AngleNumberAxis = class extends AngleAxis { + constructor(moduleCtx) { + super(moduleCtx, new LinearAngleScale()); + this.shape = "circle"; + this.interval = new AngleAxisInterval(); + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata(d, min, max); + return { domain: extent3, clipped }; + } + updateScale() { + super.updateScale(); + this.scale.arcLength = this.getRangeArcLength(); + } + getRangeArcLength() { + const { range: requestedRange } = this; + const min = Math.min(...requestedRange); + const max = Math.max(...requestedRange); + const rotation = angleBetween(min, max) || 2 * Math.PI; + const radius = this.gridLength; + return rotation * radius; + } + generateAngleTicks(domain) { + const { scale, range: requestedRange, nice } = this; + const { values, step, minSpacing, maxSpacing } = this.interval; + let rawTicks; + if (values == null) { + const { arcLength } = scale; + const minTickCount = maxSpacing ? Math.floor(arcLength / maxSpacing) : 1; + const maxTickCount = minSpacing ? Math.floor(arcLength / minSpacing) : Infinity; + const preferredTickCount = Math.floor(4 / Math.PI * Math.abs(requestedRange[0] - requestedRange[1])); + const tickCount = Math.max(minTickCount, Math.min(maxTickCount, preferredTickCount)); + const tickParams = { + nice, + interval: step, + tickCount, + minTickCount, + maxTickCount + }; + rawTicks = scale.ticks(tickParams, domain)?.ticks ?? []; + } else { + const [d0, d1] = findMinMax(domain.map(Number)); + rawTicks = values.filter((value) => value >= d0 && value <= d1).sort((a, b) => a - b); + } + return rawTicks.map((value) => ({ value, visible: true })); + } + avoidLabelCollisions(labelData) { + const { minSpacing } = this.label; + const labelsCollide = (prev, next) => { + if (prev.hidden || next.hidden) { + return false; + } else if (minSpacing == null) { + return prev.box.collidesBBox(next.box); + } + const prevBox = prev.box.clone().grow(minSpacing / 2); + const nextBox = next.box.clone().grow(minSpacing / 2); + return prevBox.collidesBBox(nextBox); + }; + const firstLabel = labelData[0]; + const lastLabel = labelData.at(-1); + if (firstLabel !== lastLabel && (0, import_ag_charts_core6.isNumberEqual)(firstLabel.x, lastLabel.x) && (0, import_ag_charts_core6.isNumberEqual)(firstLabel.y, lastLabel.y)) { + lastLabel.hidden = true; + } + for (let step = 1; step < labelData.length; step *= 2) { + let collisionDetected = false; + for (let i = step; i < labelData.length; i += step) { + const next = labelData[i]; + const prev = labelData[i - step]; + if (labelsCollide(prev, next)) { + collisionDetected = true; + break; + } + } + if (!collisionDetected) { + for (const [i, datum] of labelData.entries()) { + if (i % step > 0) { + datum.hidden = true; + datum.box = void 0; + } + } + return; + } + } + for (const [i, datum] of labelData.entries()) { + if (i > 0) { + datum.hidden = true; + datum.box = void 0; + } + } + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +AngleNumberAxis.className = "AngleNumberAxis"; +AngleNumberAxis.type = "angle-number"; +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "min", 2); +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "max", 2); +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "interval", 2); + +// packages/ag-charts-enterprise/src/axes/ordinal/ordinalTimeAxis.ts +var import_ag_charts_community8 = require("ag-charts-community"); +var { + OrdinalTimeScale, + Property: Property6, + TimeAxisParentLevel, + lowestGranularityUnitForTicks, + lowestGranularityUnitForValue, + minimumTimeAxisDatumGranularity, + dateTruncationForDomain, + intervalUnit, + intervalStep, + intervalEpoch, + intervalMilliseconds +} = import_ag_charts_community8._ModuleSupport; +var OrdinalTimeAxis = class extends import_ag_charts_community8._ModuleSupport.DiscreteTimeAxis { + constructor(moduleCtx) { + super(moduleCtx, new OrdinalTimeScale()); + this.parentLevel = new TimeAxisParentLevel(); + } + get primaryLabel() { + return this.parentLevel.enabled ? this.parentLevel.label : void 0; + } + get primaryTick() { + return this.parentLevel.enabled ? this.parentLevel.tick : void 0; + } + processData() { + super.processData(); + const { boundSeries, direction } = this; + this.minimumTimeGranularity = minimumTimeAxisDatumGranularity(boundSeries, direction, void 0, void 0); + } + tickFormatParams(domain, ticks, _fractionDigits, timeInterval) { + timeInterval ?? (timeInterval = lowestGranularityUnitForTicks(ticks)); + const truncateDate = dateTruncationForDomain(domain); + const unit = intervalUnit(timeInterval); + const step = intervalStep(timeInterval); + const epoch = intervalEpoch(timeInterval); + return { type: "date", unit, step, epoch, truncateDate }; + } + datumFormatParams(value, params, _fractionDigits, timeInterval, style) { + if (typeof value === "number") + value = new Date(value); + if (timeInterval == null) { + const { minimumTimeGranularity } = this; + const datumGranularity = lowestGranularityUnitForValue(value); + if (minimumTimeGranularity != null && intervalMilliseconds(minimumTimeGranularity) < intervalMilliseconds(datumGranularity)) { + timeInterval = minimumTimeGranularity; + } else { + timeInterval = datumGranularity; + } + } + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + const unit = intervalUnit(timeInterval); + const step = intervalStep(timeInterval); + const epoch = intervalEpoch(timeInterval); + return { + type: "date", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + unit, + step, + epoch, + style + }; + } +}; +OrdinalTimeAxis.className = "OrdinalTimeAxis"; +OrdinalTimeAxis.type = "ordinal-time"; +__decorateClass([ + Property6 +], OrdinalTimeAxis.prototype, "parentLevel", 2); + +// packages/ag-charts-enterprise/src/axes/radius-category/radiusCategoryAxis.ts +var import_ag_charts_community11 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/axes/radius/radiusAxis.ts +var import_ag_charts_community10 = require("ag-charts-community"); +var import_ag_charts_core8 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/radiusCrossLine.ts +var import_ag_charts_community9 = require("ag-charts-community"); +var import_ag_charts_core7 = require("ag-charts-core"); +var { + ChartAxisDirection: ChartAxisDirection4, + Property: Property7, + validateCrossLineValue: validateCrossLineValue2, + normalizeAngle360FromDegrees, + Group: Group3, + Path: Path3, + Sector: Sector2, + RotatableText: RotatableText3 +} = import_ag_charts_community9._ModuleSupport; +var RadiusCrossLineLabel = class extends PolarCrossLineLabel { + constructor() { + super(...arguments); + this.positionAngle = void 0; + } +}; +__decorateClass([ + Property7 +], RadiusCrossLineLabel.prototype, "positionAngle", 2); +var RadiusCrossLine = class extends PolarCrossLine { + constructor() { + super(); + this.direction = ChartAxisDirection4.Radius; + this.label = new RadiusCrossLineLabel(); + this.polygonNode = new Path3(); + this.sectorNode = new Sector2(); + this.crossLineRange = new Group3(); + this.labelNode = new RotatableText3(); + this.outerRadius = 0; + this.innerRadius = 0; + this.crossLineRange.append(this.polygonNode); + this.crossLineRange.append(this.sectorNode); + this.labelGroup.append(this.labelNode); + } + update(visible) { + const { scale } = this; + if (!scale || !validateCrossLineValue2(this, scale)) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.updateRadii(); + const { innerRadius, outerRadius } = this; + visible && (visible = innerRadius >= this.axisInnerRadius && outerRadius <= this.axisOuterRadius); + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updatePolygonNode(visible); + this.updateSectorNode(visible); + this.updateLabelNode(visible); + this.assignCrossLineGroup(this.type === "range", this.crossLineRange); + } + updateRadii() { + const { range: range2, scale, type, axisInnerRadius, axisOuterRadius } = this; + if (!scale) + return { innerRadius: 0, outerRadius: 0 }; + const getRadius = (value) => axisOuterRadius + axisInnerRadius - value; + let outerRadius, innerRadius; + if (type === "line") { + outerRadius = getRadius(scale.convert(this.value)); + innerRadius = outerRadius; + } else { + const bandwidth = Math.abs(scale?.bandwidth ?? 0); + const convertedRange = range2.map((r) => scale.convert(r)); + outerRadius = getRadius(Math.max(...convertedRange)); + innerRadius = getRadius(Math.min(...convertedRange)) + bandwidth; + } + this.outerRadius = outerRadius; + this.innerRadius = innerRadius; + } + drawPolygon(radius, angles, polygon) { + for (const [index, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + if (index === 0) { + polygon.path.moveTo(x, y); + } else { + polygon.path.lineTo(x, y); + } + } + polygon.path.closePath(); + } + updatePolygonNode(visible) { + const { gridAngles, polygonNode: polygon, scale, shape, type, innerRadius, outerRadius } = this; + if (!visible || shape !== "polygon" || !scale || !gridAngles) { + polygon.visible = false; + return; + } + polygon.visible = true; + const padding = this.getPadding(); + polygon.path.clear(true); + this.drawPolygon(outerRadius - padding, gridAngles, polygon); + const reversedAngles = gridAngles.slice().reverse(); + const innerPolygonRadius = type === "line" ? outerRadius - padding : innerRadius + padding; + this.drawPolygon(innerPolygonRadius, reversedAngles, polygon); + this.setSectorNodeProps(polygon); + } + updateSectorNode(visible) { + const { axisInnerRadius, axisOuterRadius, scale, sectorNode: sector, shape, innerRadius, outerRadius } = this; + if (!visible || shape !== "circle" || !scale) { + sector.visible = false; + return; + } + sector.visible = true; + sector.startAngle = 0; + sector.endAngle = 2 * Math.PI; + const padding = this.getPadding(); + const r0 = (0, import_ag_charts_core7.clamp)(axisInnerRadius, innerRadius + padding, axisOuterRadius); + const r1 = (0, import_ag_charts_core7.clamp)(axisInnerRadius, outerRadius - padding, axisOuterRadius); + sector.innerRadius = Math.min(r0, r1); + sector.outerRadius = Math.max(r0, r1); + this.setSectorNodeProps(sector); + } + updateLabelNode(visible) { + const { innerRadius, label, labelNode: node, scale, shape, type } = this; + if (!visible || label.enabled === false || !label.text || !scale) { + node.visible = false; + return; + } + const angle = normalizeAngle360FromDegrees((label.positionAngle ?? 0) - 90); + const isBottomSide = ((0, import_ag_charts_core7.isNumberEqual)(angle, 0) || angle > 0) && angle < Math.PI; + const rotation = isBottomSide ? angle - Math.PI / 2 : angle + Math.PI / 2; + let distance; + const angles = this.gridAngles ?? []; + if (type === "line") { + distance = innerRadius + label.padding; + } else if (shape === "circle" || angles.length < 3) { + distance = innerRadius - label.padding; + } else { + distance = innerRadius * Math.cos(Math.PI / angles.length) - label.padding; + } + const labelX = distance * Math.cos(angle); + const labelY = distance * Math.sin(angle); + let textBaseline; + if (type === "line") { + textBaseline = isBottomSide ? "top" : "bottom"; + } else { + textBaseline = isBottomSide ? "bottom" : "top"; + } + this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation); + } + getPadding() { + const { scale } = this; + if (!scale) + return 0; + const bandwidth = Math.abs(scale.bandwidth ?? 0); + const step = Math.abs(scale.step ?? 0); + return scale instanceof import_ag_charts_community9._ModuleSupport.BandScale ? (step - bandwidth) / 2 : 0; + } +}; +RadiusCrossLine.className = "RadiusCrossLine"; + +// packages/ag-charts-enterprise/src/axes/radius/radiusAxis.ts +var { + ChartAxisDirection: ChartAxisDirection5, + ZIndexMap, + Property: Property8, + normalizeAngle360: normalizeAngle3603, + toRadians: toRadians2, + Caption, + Group: Group4, + TransformableGroup, + Path: Path4, + Line: Line2, + Selection: Selection2, + generateTicks, + AxisGroupZIndexMap +} = import_ag_charts_community10._ModuleSupport; +var RadiusAxisLabel = class extends import_ag_charts_community10._ModuleSupport.AxisLabel { + constructor() { + super(...arguments); + this.autoRotateAngle = 335; + } +}; +__decorateClass([ + Property8 +], RadiusAxisLabel.prototype, "autoRotate", 2); +__decorateClass([ + Property8 +], RadiusAxisLabel.prototype, "autoRotateAngle", 2); +var RadiusAxis = class extends import_ag_charts_community10._ModuleSupport.PolarAxis { + constructor(moduleCtx, scale) { + super(moduleCtx, scale); + this.positionAngle = 0; + this.gridLineGroupSelection = Selection2.select( + this.gridLineGroup, + Line2, + false + ); + this.generatedTicks = void 0; + this.headingLabelGroup = this.axisGroup.appendChild( + new TransformableGroup({ name: `${this.id}-Axis-heading` }) + ); + this.lineNodeGroup = this.axisGroup.appendChild( + new TransformableGroup({ name: `${this.id}-Axis-line` }) + ); + this.lineNode = this.lineNodeGroup.appendChild( + new Line2({ + name: `${this.id}-Axis-line`, + zIndex: AxisGroupZIndexMap.AxisLine + }) + ); + this.gridPathGroup = this.gridGroup.appendChild( + new Group4({ + name: `${this.id}-gridPaths`, + zIndex: ZIndexMap.AXIS_GRID + }) + ); + this.gridPathSelection = Selection2.select(this.gridPathGroup, Path4); + this.headingLabelGroup.appendChild(this.title.caption.node); + this.cleanup.register(this.title.caption.registerInteraction(this.moduleCtx, "afterend")); + } + get direction() { + return ChartAxisDirection5.Radius; + } + getAxisTransform() { + const maxRadius = this.scale.range[0]; + const { translation, positionAngle, innerRadiusRatio } = this; + const innerRadius = maxRadius * innerRadiusRatio; + const rotation = toRadians2(positionAngle); + return { + translationX: translation.x, + translationY: translation.y - maxRadius - innerRadius, + rotation, + rotationCenterX: 0, + rotationCenterY: maxRadius + innerRadius + }; + } + update() { + super.update(); + this.updateTitle(); + this.updateGridLines(); + const { enabled, stroke, width } = this.line; + this.lineNode.setProperties({ + stroke, + strokeWidth: enabled ? width : 0, + x1: 0, + y1: this.range[0], + x2: 0, + y2: this.range[1] + }); + } + updatePosition() { + super.updatePosition(); + const axisTransform = this.getAxisTransform(); + this.tickLineGroup.setProperties(axisTransform); + this.tickLabelGroup.setProperties(axisTransform); + this.lineNodeGroup.setProperties(axisTransform); + this.headingLabelGroup.setProperties(axisTransform); + } + calculateRotations() { + const rotation = 0; + const parallelFlipRotation = 0; + const regularFlipRotation = -Math.PI / 2; + return { rotation, parallelFlipRotation, regularFlipRotation }; + } + calculateTickLayout(domain, niceMode, _visibleRange) { + const visibleRange = [0, 1]; + const sideFlag = this.label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + this.label.spacing + this.seriesAreaPadding); + const { range: range2, reverse, defaultTickMinSpacing } = this; + const tickGenerationResult = generateTicks({ + scale: this.scale, + label: this.label, + interval: this.interval, + tickFormatter: (...args) => this.tickFormatter(...args), + domain, + range: range2, + reverse, + niceMode, + visibleRange, + defaultTickMinSpacing, + labelOffset: labelX, + sideFlag, + axisRotation: 0, + sizeLimit: void 0, + primaryTickCount: void 0 + }); + const { tickData } = tickGenerationResult; + const { ticks, rawTicks, rawTickCount, tickDomain, fractionDigits, niceDomain = domain } = tickData; + const labels = ticks.map((d) => this.getTickLabelProps(d, tickGenerationResult)); + this.generatedTicks = { ticks, labels }; + return { ticks: rawTicks, tickDomain, niceDomain, rawTickCount, fractionDigits, timeInterval: void 0 }; + } + updateSelections() { + const { generatedTicks } = this; + if (!generatedTicks) + return; + const { ticks, labels } = generatedTicks; + this.gridLineGroupSelection.update(this.gridLength ? ticks : []); + this.tickLabelGroupSelection.update(labels); + this.gridPathSelection.update(this.gridLine.enabled ? this.prepareGridPathTickData(ticks) : []); + this.gridLineGroupSelection.cleanup(); + this.tickLabelGroupSelection.cleanup(); + this.gridPathSelection.cleanup(); + } + // TODO - abstract out + updateLabels() { + if (!this.label.enabled) + return; + const axisLabelPositionFn = import_ag_charts_community10._ModuleSupport.resetAxisLabelSelectionFn(); + this.tickLabelGroupSelection.each((node, datum) => { + node.fill = datum.color; + node.text = datum.text; + node.textBaseline = datum.textBaseline; + node.textAlign = datum.textAlign ?? "center"; + node.setFont(datum); + node.setBoxing(datum); + node.setProperties(axisLabelPositionFn(node, datum)); + }); + } + updateGridLines() { + const { + gridLine: { style, width }, + shape, + generatedTicks + } = this; + if (!style || !generatedTicks) { + return; + } + const styleCount = style.length; + const setStyle = (node, index) => { + const { stroke, lineDash } = style[index % styleCount]; + node.stroke = stroke; + node.strokeWidth = width; + node.lineDash = lineDash; + node.fill = void 0; + }; + const [startAngle, endAngle] = this.gridRange ?? [0, 2 * Math.PI]; + const isFullCircle = (0, import_ag_charts_core8.isNumberEqual)(endAngle - startAngle, 2 * Math.PI); + const drawCircleShape = (node, value) => { + const { path } = node; + path.clear(true); + const radius = this.getTickRadius(value); + if (isFullCircle) { + path.moveTo(radius, 0); + path.arc(0, 0, radius, 0, 2 * Math.PI); + } else { + path.moveTo(radius * Math.cos(startAngle), radius * Math.sin(startAngle)); + path.arc(0, 0, radius, normalizeAngle3603(startAngle), normalizeAngle3603(endAngle)); + } + if (isFullCircle) { + path.closePath(); + } + }; + const drawPolygonShape = (node, value) => { + const { path } = node; + const angles = this.gridAngles; + path.clear(true); + if (!angles || angles.length < 3) { + return; + } + const radius = this.getTickRadius(value); + for (const [idx, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + if (idx === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + for (const [innerIdx, innerAngle] of angles.entries()) { + const x2 = radius * Math.cos(innerAngle); + const y2 = radius * Math.sin(innerAngle); + if (innerIdx === 0) { + path.moveTo(x2, y2); + } else { + path.lineTo(x2, y2); + } + } + path.closePath(); + } + path.closePath(); + }; + const drawFn = shape === "circle" ? drawCircleShape : drawPolygonShape; + this.gridPathSelection.each((node, value, index) => { + setStyle(node, index); + drawFn(node, value); + }); + } + updateTitle() { + const identityFormatter = (params) => params.defaultValue; + const { title, range: requestedRange } = this; + const { formatter = identityFormatter } = this.title; + title.caption.enabled = title.enabled; + title.caption.fontFamily = title.fontFamily; + title.caption.fontSize = title.fontSize; + title.caption.fontStyle = title.fontStyle; + title.caption.fontWeight = title.fontWeight; + title.caption.color = title.color; + title.caption.wrapping = title.wrapping; + let titleVisible = false; + const titleNode = title.caption.node; + if (title.enabled) { + titleVisible = true; + titleNode.rotation = Math.PI / 2; + titleNode.x = Math.floor((requestedRange[0] + requestedRange[1]) / 2); + titleNode.y = -Caption.SMALL_PADDING; + titleNode.textAlign = "center"; + titleNode.textBaseline = "bottom"; + titleNode.text = this.cachedCallWithContext(formatter, this.getTitleFormatterParams(this.scale.domain)); + } + titleNode.visible = titleVisible; + } + updateCrossLines() { + for (const crossLine of this.crossLines) { + if (crossLine instanceof RadiusCrossLine) { + const { shape, gridAngles, range: range2, innerRadiusRatio } = this; + const radius = range2[0]; + crossLine.shape = shape; + crossLine.gridAngles = gridAngles; + crossLine.axisOuterRadius = radius; + crossLine.axisInnerRadius = radius * innerRadiusRatio; + } + } + super.updateCrossLines(); + } + createLabel() { + return new RadiusAxisLabel(); + } + // TODO - abstract out (shared with cartesian axis) + getTickLabelProps(datum, tickGenerationResult) { + const { label } = this; + const { rotation, textBaseline, textAlign } = tickGenerationResult; + const range2 = this.scale.range; + const text = datum.tickLabel ?? ""; + const sideFlag = label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + label.spacing + this.seriesAreaPadding); + const visible = text !== "" && text != null; + const combinedRotation = rotation; + return { + ...this.getLabelStyles({ value: datum.tick, formattedValue: datum.tickLabel }), + tickId: datum.tickId, + rotation: combinedRotation, + text, + textAlign, + textBaseline, + visible, + x: labelX, + y: datum.translation, + rotationCenterX: labelX, + rotationCenterY: datum.translation, + range: range2 + }; + } +}; +RadiusAxis.CrossLineConstructor = RadiusCrossLine; +__decorateClass([ + Property8 +], RadiusAxis.prototype, "positionAngle", 2); + +// packages/ag-charts-enterprise/src/axes/radius-category/radiusCategoryAxis.ts +var { ProxyPropertyOnWrite, Property: Property9, CategoryScale: CategoryScale2 } = import_ag_charts_community11._ModuleSupport; +var RadiusCategoryAxis = class extends RadiusAxis { + constructor(moduleCtx) { + super(moduleCtx, new CategoryScale2()); + this.shape = "circle"; + this.groupPaddingInner = 0; + this.paddingInner = 0; + this.paddingOuter = 0; + } + hasDefinedDomain() { + return false; + } + normaliseDataDomain(domain) { + return { domain, clipped: false }; + } + prepareGridPathTickData(data) { + return data.slice().reverse(); + } + getTickRadius(tickDatum) { + const { scale, innerRadiusRatio } = this; + const maxRadius = scale.range[0]; + const minRadius = maxRadius * innerRadiusRatio; + if (CategoryScale2.is(scale)) { + const ticks = scale.domain; + const index = ticks.length - 1 - ticks.indexOf(tickDatum.tick); + return index === 0 ? minRadius : scale.inset + scale.step * (index - 0.5) + scale.bandwidth / 2; + } else { + const tickRange = (maxRadius - minRadius) / scale.domain.length; + return maxRadius - tickDatum.translation + minRadius - tickRange / 2; + } + } + tickFormatParams() { + return { type: "category" }; + } + datumFormatParams(value, params) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +RadiusCategoryAxis.className = "RadiusCategoryAxis"; +RadiusCategoryAxis.type = "radius-category"; +__decorateClass([ + Property9 +], RadiusCategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass([ + ProxyPropertyOnWrite("scale", "paddingInner"), + Property9 +], RadiusCategoryAxis.prototype, "paddingInner", 2); +__decorateClass([ + ProxyPropertyOnWrite("scale", "paddingOuter"), + Property9 +], RadiusCategoryAxis.prototype, "paddingOuter", 2); + +// packages/ag-charts-enterprise/src/axes/radius-number/radiusNumberAxis.ts +var import_ag_charts_community12 = require("ag-charts-community"); +var { Property: Property10, normalisedExtentWithMetadata: normalisedExtentWithMetadata2, LinearScale: LinearScale2 } = import_ag_charts_community12._ModuleSupport; +var RadiusNumberAxis = class extends RadiusAxis { + constructor(moduleCtx) { + super(moduleCtx, new LinearScale2()); + this.shape = "polygon"; + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + prepareGridPathTickData(data) { + const { scale } = this; + const domainTop = scale.domain[1]; + return data.filter(({ tick }) => tick !== domainTop).sort((a, b) => b.tick - a.tick); + } + getTickRadius(tickDatum) { + const { scale } = this; + const maxRadius = scale.range[0]; + const minRadius = maxRadius * this.innerRadiusRatio; + return maxRadius - tickDatum.translation + minRadius; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata2(d, min, max); + return { domain: extent3, clipped }; + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +RadiusNumberAxis.className = "RadiusNumberAxis"; +RadiusNumberAxis.type = "radius-number"; +__decorateClass([ + Property10 +], RadiusNumberAxis.prototype, "min", 2); +__decorateClass([ + Property10 +], RadiusNumberAxis.prototype, "max", 2); + +// packages/ag-charts-enterprise/src/axes/axisModules.ts +var { + ordinalTimeAxisOptionsDefs, + angleNumberAxisOptionsDefs, + angleCategoryAxisOptionsDefs, + radiusNumberAxisOptionsDefs, + radiusCategoryAxisOptionsDefs +} = import_ag_charts_community13._ModuleSupport; +var OrdinalTimeAxisModule = { + type: "axis", + name: "ordinal-time", + chartType: "cartesian", + enterprise: true, + options: ordinalTimeAxisOptionsDefs, + create: (ctx) => new OrdinalTimeAxis(ctx) +}; +var AngleNumberAxisModule = { + type: "axis", + name: "angle-number", + chartType: "polar", + enterprise: true, + options: angleNumberAxisOptionsDefs, + create: (ctx) => new AngleNumberAxis(ctx) +}; +var AngleCategoryAxisModule = { + type: "axis", + name: "angle-category", + chartType: "polar", + enterprise: true, + options: angleCategoryAxisOptionsDefs, + create: (ctx) => new AngleCategoryAxis(ctx) +}; +var RadiusNumberAxisModule = { + type: "axis", + name: "radius-number", + chartType: "polar", + enterprise: true, + options: radiusNumberAxisOptionsDefs, + create: (ctx) => new RadiusNumberAxis(ctx) +}; +var RadiusCategoryAxisModule = { + type: "axis", + name: "radius-category", + chartType: "polar", + enterprise: true, + options: radiusCategoryAxisOptionsDefs, + create: (ctx) => new RadiusCategoryAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/charts/standaloneChartModule.ts +var import_ag_charts_community15 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/charts/standaloneChart.ts +var import_ag_charts_community14 = require("ag-charts-community"); +var { Chart } = import_ag_charts_community14._ModuleSupport; +var StandaloneChart = class extends Chart { + getChartType() { + return "standalone"; + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(seriesRect.x); + group.translationY = Math.floor(seriesRect.y); + } + seriesRoot.visible = this.series[0].visible; + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: true, rect: seriesRect, paddedRect: layoutBox } + }); + } + getAriaLabel() { + const seriesType = this.series[0]?.type; + if (seriesType == null) + return ""; + const caption = this.getCaptionText(); + switch (seriesType) { + case "radial-gauge": + case "linear-gauge": { + const captions = []; + if (caption.length !== 0) { + captions.push(caption); + } + for (const series of this.series) { + captions.push(series.getCaptionText()); + } + return this.ctx.localeManager.t("ariaAnnounceGaugeChart", { caption: captions.join(". ") }); + } + case "treemap": + case "sunburst": + return this.ctx.localeManager.t("ariaAnnounceHierarchyChart", { caption }); + default: { + return this.ctx.localeManager.t("ariaAnnounceStandaloneChart", { caption }); + } + } + } +}; +StandaloneChart.className = "StandaloneChart"; +StandaloneChart.type = "standalone"; + +// packages/ag-charts-enterprise/src/charts/standaloneChartModule.ts +var { isAgStandaloneChartOptions, standaloneChartOptionsDefs } = import_ag_charts_community15._ModuleSupport; +var StandaloneChartModule = { + type: "chart", + name: "standalone", + enterprise: true, + options: standaloneChartOptionsDefs, + detect: isAgStandaloneChartOptions, + create(options, resources) { + return new StandaloneChart(options, resources); + } +}; + +// packages/ag-charts-enterprise/src/charts/topologyChartModule.ts +var import_ag_charts_community17 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/charts/topologyChart.ts +var import_ag_charts_community16 = require("ag-charts-community"); +var { Chart: Chart2, MercatorScale, ChartAxisDirection: ChartAxisDirection6, Property: Property11 } = import_ag_charts_community16._ModuleSupport; +function isTopologySeries(series) { + return series.type === "map-shape" || series.type === "map-line" || series.type === "map-marker" || series.type === "map-shape-background" || series.type === "map-line-background"; +} +var TopologyChart = class extends Chart2 { + constructor(options, resources) { + super(options, resources); + this.ctx.zoomManager.updateAxes([ChartAxisDirection6.X, ChartAxisDirection6.Y]); + } + getChartType() { + return "topology"; + } + async updateData() { + await super.updateData(); + const options = this.getOptions(); + if (this.topology !== options.topology) { + this.topology = options.topology; + } + const { topology } = this; + for (const series of this.series) { + if (isTopologySeries(series)) { + series.setChartTopology(topology); + } + } + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + const mapSeries = this.series.filter(isTopologySeries); + const combinedBbox = mapSeries.reduce((combined, series) => { + if (!series.visible) + return combined; + const bbox = series.topologyBounds; + if (bbox == null) + return combined; + if (combined == null) + return bbox; + return combined.merge(bbox); + }, void 0); + let scale; + if (combinedBbox != null) { + const { lon0, lat0, lon1, lat1 } = combinedBbox; + const domain = [ + [lon0, lat0], + [lon1, lat1] + ]; + const bounds = MercatorScale.bounds(domain); + const { width, height } = seriesRect; + const viewBoxScale = Math.min(width / bounds.width, height / bounds.height); + const viewBoxWidth = bounds.width * viewBoxScale; + const viewBoxHeight = bounds.height * viewBoxScale; + const viewBoxOriginX = (width - viewBoxWidth) / 2; + const viewBoxOriginY = (height - viewBoxHeight) / 2; + const x0 = viewBoxOriginX; + const y0 = viewBoxOriginY; + const x1 = viewBoxOriginX + viewBoxWidth; + const y1 = viewBoxOriginY + viewBoxHeight; + const xZoom = this.ctx.zoomManager.getAxisZoom(ChartAxisDirection6.X); + const yZoom = this.ctx.zoomManager.getAxisZoom(ChartAxisDirection6.Y); + const xSpan = (x1 - x0) / (xZoom.max - xZoom.min); + const xStart = x0 - xSpan * xZoom.min; + const ySpan = (y1 - y0) / (1 - yZoom.min - (1 - yZoom.max)); + const yStart = y0 - ySpan * (1 - yZoom.max); + scale = new MercatorScale(domain, [ + [xStart, yStart], + [xStart + xSpan, yStart + ySpan] + ]); + } + for (const series of mapSeries) { + series.scale = scale; + } + const seriesVisible = this.series.some((s) => s.visible); + seriesRoot.visible = seriesVisible; + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(seriesRect.x); + group.translationY = Math.floor(seriesRect.y); + group.setClipRect(seriesRect.clone()); + } + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: seriesVisible, rect: seriesRect, paddedRect: layoutBox } + }); + } +}; +TopologyChart.className = "TopologyChart"; +TopologyChart.type = "topology"; +__decorateClass([ + Property11 +], TopologyChart.prototype, "topology", 2); + +// packages/ag-charts-enterprise/src/charts/topologyChartModule.ts +var { isAgTopologyChartOptions, topologyChartOptionsDefs } = import_ag_charts_community17._ModuleSupport; +var TopologyChartModule = { + type: "chart", + name: "topology", + enterprise: true, + options: topologyChartOptionsDefs, + detect: isAgTopologyChartOptions, + create(options, resources) { + return new TopologyChart(options, resources); + } +}; + +// packages/ag-charts-enterprise/src/features/sync/pluginModules.ts +var import_ag_charts_community64 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/annotationOptionsDef.ts +var import_ag_charts_community18 = require("ag-charts-community"); +var import_ag_charts_core9 = require("ag-charts-core"); +var { + annotationCalloutStylesDefs, + annotationNoteStylesDefs, + annotationTextStylesDef, + annotationCommentStylesDefs, + annotationMeasurerStylesDefs, + annotationQuickMeasurerStylesDefs, + annotationShapeStylesDefs, + annotationChannelTextDefs, + annotationCrossLineStyleDefs, + annotationFibonacciStylesDefs, + annotationLineStyleDefs, + annotationLineTextDefs, + annotationDisjointChannelStyleDefs, + annotationParallelChannelStyleDefs +} = import_ag_charts_community18._ModuleSupport; +var serializableDate = (0, import_ag_charts_core9.optionsDefs)( + { + __type: (0, import_ag_charts_core9.required)((0, import_ag_charts_core9.constant)("date")), + value: (0, import_ag_charts_core9.or)(import_ag_charts_core9.string, import_ag_charts_core9.number) + }, + "a serializable date object" +); +var xValue = (0, import_ag_charts_core9.or)(import_ag_charts_core9.string, import_ag_charts_core9.number, serializableDate); +var annotationValue = (0, import_ag_charts_core9.or)( + xValue, + (0, import_ag_charts_core9.optionsDefs)({ + value: xValue, + groupPercentage: (0, import_ag_charts_core9.numberRange)(-1, 2) + }) +); +var channelAnnotationTextOptionsDef = { + ...annotationChannelTextDefs, + label: import_ag_charts_core9.string +}; +var lineAnnotationTextOptionsDef = { + ...annotationLineTextDefs, + label: import_ag_charts_core9.string +}; +var annotationPointOptionsDef = { + x: annotationValue, + y: import_ag_charts_core9.number +}; +var annotationInitialStateOptionsDef = (0, import_ag_charts_core9.typeUnion)( + { + line: { + ...annotationLineStyleDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef + }, + "horizontal-line": { + ...annotationCrossLineStyleDefs, + value: annotationValue, + text: lineAnnotationTextOptionsDef + }, + "vertical-line": { + ...annotationCrossLineStyleDefs, + value: annotationValue, + text: lineAnnotationTextOptionsDef + }, + "disjoint-channel": { + ...annotationDisjointChannelStyleDefs, + startHeight: import_ag_charts_core9.number, + endHeight: import_ag_charts_core9.number, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: channelAnnotationTextOptionsDef + }, + "parallel-channel": { + ...annotationParallelChannelStyleDefs, + height: import_ag_charts_core9.number, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: channelAnnotationTextOptionsDef + }, + "fibonacci-retracement": { + ...annotationFibonacciStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef, + reverse: import_ag_charts_core9.boolean + }, + "fibonacci-retracement-trend-based": { + ...annotationFibonacciStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + endRetracement: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef, + reverse: import_ag_charts_core9.boolean + }, + callout: { + ...annotationCalloutStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: import_ag_charts_core9.string + }, + comment: { + ...annotationCommentStylesDefs, + ...annotationPointOptionsDef, + text: import_ag_charts_core9.string + }, + note: { + ...annotationNoteStylesDefs, + ...annotationPointOptionsDef, + text: import_ag_charts_core9.string + }, + text: { + ...annotationTextStylesDef, + ...annotationPointOptionsDef, + text: import_ag_charts_core9.string + }, + arrow: { + ...annotationLineStyleDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "arrow-up": { + ...annotationShapeStylesDefs, + ...annotationPointOptionsDef + }, + "arrow-down": { + ...annotationShapeStylesDefs, + ...annotationPointOptionsDef + }, + "date-range": { + ...annotationMeasurerStylesDefs, + extendAbove: import_ag_charts_core9.boolean, + extendBelow: import_ag_charts_core9.boolean, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "price-range": { + ...annotationMeasurerStylesDefs, + extendLeft: import_ag_charts_core9.boolean, + extendRight: import_ag_charts_core9.boolean, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "date-price-range": { + ...annotationMeasurerStylesDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "quick-date-price-range": { + ...annotationMeasurerStylesDefs, + ...annotationQuickMeasurerStylesDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + } + }, + "an annotation initial state object" +); +var initialStateOptionsDef = { + chartType: (0, import_ag_charts_core9.union)("candlestick", "hollow-candlestick", "ohlc", "line", "step-line", "hlc", "high-low"), + annotations: (0, import_ag_charts_core9.arrayOfDefs)(annotationInitialStateOptionsDef), + legend: (0, import_ag_charts_core9.arrayOfDefs)( + { + visible: import_ag_charts_core9.boolean, + seriesId: import_ag_charts_core9.string, + itemId: import_ag_charts_core9.string, + legendItemName: import_ag_charts_core9.string + }, + "legend state array" + ), + zoom: { + rangeX: { + start: (0, import_ag_charts_core9.or)(import_ag_charts_core9.number, serializableDate), + end: (0, import_ag_charts_core9.or)(import_ag_charts_core9.number, serializableDate) + }, + rangeY: { + start: (0, import_ag_charts_core9.or)(import_ag_charts_core9.number, serializableDate), + end: (0, import_ag_charts_core9.or)(import_ag_charts_core9.number, serializableDate) + }, + ratioX: { + start: (0, import_ag_charts_core9.and)(import_ag_charts_core9.ratio, (0, import_ag_charts_core9.lessThan)("end")), + end: (0, import_ag_charts_core9.and)(import_ag_charts_core9.ratio, (0, import_ag_charts_core9.greaterThan)("start")) + }, + ratioY: { + start: (0, import_ag_charts_core9.and)(import_ag_charts_core9.ratio, (0, import_ag_charts_core9.lessThan)("end")), + end: (0, import_ag_charts_core9.and)(import_ag_charts_core9.ratio, (0, import_ag_charts_core9.greaterThan)("start")) + }, + autoScaledAxes: (0, import_ag_charts_core9.arrayOf)((0, import_ag_charts_core9.constant)("y")) + } +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorOptionsDefs.ts +var import_ag_charts_community63 = require("ag-charts-community"); +var import_ag_charts_core20 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotModule.ts +var import_ag_charts_community24 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeries.ts +var import_ag_charts_community21 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/box-plot/blotPlotUtil.ts +function prepareBoxPlotFromTo(isVertical) { + const from = isVertical ? { scalingX: 1, scalingY: 0 } : { scalingX: 0, scalingY: 1 }; + const to = { scalingX: 1, scalingY: 1 }; + return { from, to }; +} +function resetBoxPlotSelectionsScalingCenterFn(isVertical) { + return (_node, datum) => { + if (isVertical) { + return { scalingCenterY: datum.scaledValues.medianValue }; + } + return { scalingCenterX: datum.scaledValues.medianValue }; + }; +} + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotNode.ts +var import_ag_charts_community19 = require("ag-charts-community"); +var { + Path: Path5, + Scalable, + ExtendedPath2D, + SceneChangeDetection, + SceneArrayChangeDetection, + BBox: BBox2, + clippedRoundRect: baseClippedRoundRect +} = import_ag_charts_community19._ModuleSupport; +var BoxPlotNode = class extends Scalable(Path5) { + constructor() { + super(...arguments); + this.wickPath = new ExtendedPath2D(); + this.horizontal = false; + this.center = 0; + this.thickness = 0; + this.min = 0; + this.q1 = 0; + this.median = 0; + this.q3 = 0; + this.max = 0; + this.cornerRadius = 0; + this.crisp = false; + this.strokeAlignment = 0; + this.wickStroke = void 0; + this.wickStrokeWidth = void 0; + this.wickStrokeOpacity = void 0; + this.capLengthRatio = 1; + this.wickStrokeAlignment = 0; + } + computeBBox() { + const { horizontal, center, thickness, min, max } = this; + return horizontal ? new BBox2(Math.min(min, max), center - thickness / 2, Math.abs(max - min), thickness) : new BBox2(center - thickness / 2, Math.min(min, max), thickness, Math.abs(max - min)); + } + computeDefaultGradientFillBBox() { + const { horizontal, center, thickness, q1, q3 } = this; + return horizontal ? new BBox2(Math.min(q1, q3), center - thickness / 2, Math.abs(q3 - q1), thickness) : new BBox2(center - thickness / 2, Math.min(q1, q3), thickness, Math.abs(q3 - q1)); + } + isPointInPath(x, y) { + return this.getBBox().containsPoint(x, y); + } + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } + get midPoint() { + return this.horizontal ? { x: (this.min + this.max) / 2, y: this.center } : { x: this.center, y: (this.min + this.max) / 2 }; + } + alignedCoordinates() { + const { thickness, crisp } = this; + let { center, min, q1, median, q3, max } = this; + let x0 = center - thickness / 2; + let x1 = center + thickness / 2; + if (crisp && thickness > 1) { + min = this.align(min); + q1 = this.align(q1); + median = this.align(median); + q3 = this.align(q3); + max = min + this.align(min, max - min); + const halfWidth = this.align(thickness / 2); + center = this.align(center); + x0 = center - halfWidth; + x1 = center + halfWidth; + } + return { center, x0, x1, min, max, q1, median, q3 }; + } + updatePath() { + const { + path, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke, + wickStrokeWidth, + wickStrokeOpacity, + wickLineDash, + wickLineDashOffset, + strokeAlignment, + cornerRadius, + capLengthRatio, + horizontal + } = this; + const { center, x0, x1, min, max, q1, median, q3 } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const wickStrokeAlignment = this.wickStrokeAlignment > 0 ? pixelRatio / this.wickStrokeAlignment / 2 % 1 : 0; + this.path.clear(); + this.wickPath.clear(); + const needsWickPath = wickStroke != null && wickStroke !== stroke || wickStrokeWidth != null && wickStrokeWidth !== strokeWidth || wickStrokeOpacity != null && wickStrokeOpacity !== strokeOpacity || wickLineDash != null && wickLineDash !== lineDash || wickLineDashOffset != null && wickLineDashOffset !== lineDashOffset; + const wickPath = needsWickPath ? this.wickPath : path; + if (Math.abs(x1 - x0) <= 3) { + moveTo(wickPath, horizontal, center, min); + lineTo(wickPath, horizontal, center, max); + return; + } + const wickTop = Math.min(min, max); + const wickBottom = Math.max(min, max); + const boxTop = Math.min(q1, q3); + const boxBottom = Math.max(q1, q3); + const capX0 = center - Math.abs((x1 - x0) * capLengthRatio) / 2; + const capX1 = center + Math.abs((x1 - x0) * capLengthRatio) / 2; + moveTo(wickPath, horizontal, capX0, wickTop - wickStrokeAlignment); + lineTo(wickPath, horizontal, capX1, wickTop - wickStrokeAlignment); + moveTo(wickPath, horizontal, center - wickStrokeAlignment, wickTop - wickStrokeAlignment); + lineTo(wickPath, horizontal, center - wickStrokeAlignment, boxTop + strokeWidth / 2); + moveTo(wickPath, horizontal, center - wickStrokeAlignment, wickBottom + wickStrokeAlignment); + lineTo(wickPath, horizontal, center - wickStrokeAlignment, boxBottom - strokeWidth / 2); + moveTo(wickPath, horizontal, capX0, wickBottom + wickStrokeAlignment); + lineTo(wickPath, horizontal, capX1, wickBottom + wickStrokeAlignment); + const horizontalBoxStrokeAdjustment = strokeWidth / 2 + strokeAlignment; + const verticalBoxStrokeAdjustment = strokeWidth / 2 - strokeAlignment; + const rectHeight = boxBottom - boxTop - 2 * verticalBoxStrokeAdjustment; + if (rectHeight > 0) { + const rectX = x0 + horizontalBoxStrokeAdjustment; + const rectY = boxTop + verticalBoxStrokeAdjustment; + const rectWidth = x1 - x0 - 2 * horizontalBoxStrokeAdjustment; + const cornerRadii = { + topLeft: cornerRadius, + topRight: cornerRadius, + bottomRight: cornerRadius, + bottomLeft: cornerRadius + }; + clippedRoundRect( + path, + horizontal, + rectX, + rectY, + rectWidth, + rectHeight, + cornerRadii, + new BBox2(rectX, rectY, rectWidth, median - rectY) + ); + clippedRoundRect( + path, + horizontal, + rectX, + rectY, + rectWidth, + rectHeight, + cornerRadii, + new BBox2(rectX, median, rectWidth, rectY + rectHeight - median) + ); + } else { + const boxMid = (boxTop + boxBottom) / 2; + moveTo(path, horizontal, x0, boxMid); + lineTo(path, horizontal, x1, boxMid); + } + } + drawPath(ctx) { + super.drawPath(ctx); + const { wickPath } = this; + if (wickPath.isEmpty()) + return; + const { + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke = stroke, + wickStrokeWidth = strokeWidth, + wickStrokeOpacity = strokeOpacity, + wickLineDash = lineDash, + wickLineDashOffset = lineDashOffset + } = this; + if (wickStrokeWidth === 0) + return; + ctx.globalAlpha *= wickStrokeOpacity; + if (typeof wickStroke === "string") { + ctx.strokeStyle = wickStroke; + } + ctx.lineWidth = wickStrokeWidth; + if (wickLineDash != null) { + ctx.setLineDash([...wickLineDash]); + } + ctx.lineDashOffset = wickLineDashOffset; + ctx.stroke(wickPath.getPath2D()); + } +}; +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "horizontal", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "center", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "thickness", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "min", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "q1", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "median", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "q3", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "max", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "cornerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "crisp", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "strokeAlignment", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "wickStroke", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "wickStrokeWidth", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "wickStrokeOpacity", 2); +__decorateClass([ + SceneArrayChangeDetection() +], BoxPlotNode.prototype, "wickLineDash", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "wickLineDashOffset", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "capLengthRatio", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "wickStrokeAlignment", 2); +function moveTo(path, horizontal, x, y) { + if (horizontal) { + path.moveTo(y, x); + } else { + path.moveTo(x, y); + } +} +function lineTo(path, horizontal, x, y) { + if (horizontal) { + path.lineTo(y, x); + } else { + path.lineTo(x, y); + } +} +function clippedRoundRect(path, horizontal, x, y, width, height, cornerRadii, clipBBox) { + if (horizontal) { + baseClippedRoundRect( + // eslint-disable-next-line sonarjs/arguments-order + path, + y, + x, + height, + width, + cornerRadii, + clipBBox == null ? void 0 : new BBox2(clipBBox.y, clipBBox.x, clipBBox.height, clipBBox.width) + ); + } else { + baseClippedRoundRect(path, x, y, width, height, cornerRadii, clipBBox); + } +} + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeriesProperties.ts +var import_ag_charts_community20 = require("ag-charts-community"); +var { BaseProperties: BaseProperties2, AbstractBarSeriesProperties, makeSeriesTooltip, Property: Property12, mergeDefaults } = import_ag_charts_community20._ModuleSupport; +var BoxPlotSeriesCap = class extends BaseProperties2 { + constructor() { + super(...arguments); + this.lengthRatio = 0.5; + } +}; +__decorateClass([ + Property12 +], BoxPlotSeriesCap.prototype, "lengthRatio", 2); +var BoxPlotSeriesWhisker = class extends BaseProperties2 { +}; +__decorateClass([ + Property12 +], BoxPlotSeriesWhisker.prototype, "stroke", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesWhisker.prototype, "strokeWidth", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesWhisker.prototype, "strokeOpacity", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesWhisker.prototype, "lineDash", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesWhisker.prototype, "lineDashOffset", 2); +var BoxPlotSeriesProperties = class extends AbstractBarSeriesProperties { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.cap = new BoxPlotSeriesCap(); + this.whisker = new BoxPlotSeriesWhisker(); + this.tooltip = makeSeriesTooltip(); + } + toJson() { + const { stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const properties = super.toJson(); + properties.whisker = mergeDefaults(properties.whisker, { + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + return properties; + } +}; +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "minKey", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "q1Key", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "medianKey", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "q3Key", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "maxKey", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "minName", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "q1Name", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "medianName", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "q3Name", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "maxName", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "cap", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "whisker", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeries.ts +var { + fixNumericExtent, + keyProperty, + mergeDefaults: mergeDefaults2, + SeriesNodePickMode, + SMALLEST_KEY_INTERVAL, + valueProperty, + diff, + animationValidation, + computeBarFocusBounds, + createDatumId, + HighlightState, + ContinuousScale: ContinuousScale2, + ChartAxisDirection: ChartAxisDirection7, + motion, + getItemStyles, + applyShapeFillBBox, + calculateSegments, + toHighlightString +} = import_ag_charts_community21._ModuleSupport; +var BoxPlotSeriesNodeEvent = class extends import_ag_charts_community21._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.minKey = series.properties.minKey; + this.q1Key = series.properties.q1Key; + this.medianKey = series.properties.medianKey; + this.q3Key = series.properties.q3Key; + this.maxKey = series.properties.maxKey; + } +}; +var BoxPlotSeries = class extends import_ag_charts_community21._ModuleSupport.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode.NEAREST_NODE, SeriesNodePickMode.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["medianKey", "q1Key", "q3Key", "minKey", "maxKey"] + }, + propertyNames: { + x: ["xName"], + y: ["medianName", "q1Name", "q3Name", "minName", "maxName"] + }, + categoryKey: "xValue", + pathsPerSeries: [] + }); + this.properties = new BoxPlotSeriesProperties(); + this.NodeEvent = BoxPlotSeriesNodeEvent; + } + async processData(dataController) { + if (!this.visible) + return; + const { xKey, minKey, q1Key, medianKey, q3Key, maxKey } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (animationEnabled && this.processedData) { + extraProps.push(diff(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation()); + } + const { processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty(xKey, xScaleType, { id: `xValue` }), + valueProperty(minKey, yScaleType, { id: `minValue` }), + valueProperty(q1Key, yScaleType, { id: `q1Value` }), + valueProperty(medianKey, yScaleType, { id: `medianValue` }), + valueProperty(q3Key, yScaleType, { id: `q3Value` }), + valueProperty(maxKey, yScaleType, { id: `maxValue` }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL] : [], + ...extraProps + ] + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + if (direction !== this.getBarDirection()) { + const { index, def } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = processedData.domain.keys[index]; + if (def.type === "key" && def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yExtent = this.domainForClippedRange(direction, ["minValue", "maxValue"], "xValue"); + return fixNumericExtent(yExtent); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection7.Y, ["maxValue", "minValue"], "xValue", visibleRange); + } + createNodeData() { + const { visible, dataModel, processedData } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const { xKey } = this.properties; + const nodeData = []; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const minValues = dataModel.resolveColumnById(this, "minValue", processedData); + const q1Values = dataModel.resolveColumnById(this, "q1Value", processedData); + const medianValues = dataModel.resolveColumnById(this, "medianValue", processedData); + const q3Values = dataModel.resolveColumnById(this, "q3Value", processedData); + const maxValues = dataModel.resolveColumnById(this, "maxValue", processedData); + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale2.is(xAxis.scale) ? barWidth * -0.5 : 0; + const { groupScale } = this; + const isVertical = this.isVertical(); + const segments = calculateSegments( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + const context = { + itemId: xKey, + nodeData, + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStyles(this.getItemStyle.bind(this)), + segments + }; + if (!visible) + return context; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const minValue = minValues[datumIndex]; + const q1Value = q1Values[datumIndex]; + const medianValue = medianValues[datumIndex]; + const q3Value = q3Values[datumIndex]; + const maxValue = maxValues[datumIndex]; + if ([minValue, q1Value, medianValue, q3Value, maxValue].some((value) => typeof value !== "number") || minValue > q1Value || q1Value > medianValue || medianValue > q3Value || q3Value > maxValue) { + continue; + } + const scaledValues = { + xValue: xAxis.scale.convert(xValue2), + minValue: yAxis.scale.convert(minValue), + q1Value: yAxis.scale.convert(q1Value), + medianValue: yAxis.scale.convert(medianValue), + q3Value: yAxis.scale.convert(q3Value), + maxValue: yAxis.scale.convert(maxValue) + }; + const bandwidth = barWidth; + scaledValues.xValue += groupScale.convert(String(groupIndex)) + barOffset + bandwidth / 2; + const height = Math.abs(scaledValues.q3Value - scaledValues.q1Value); + const midX = scaledValues.xValue; + const midY = Math.min(scaledValues.q3Value, scaledValues.q1Value) + height / 2; + const midPoint = { + x: isVertical ? midX : midY, + y: isVertical ? midY : midX + }; + let focusRect; + if (isVertical) { + focusRect = { + x: midPoint.x - bandwidth / 2, + y: scaledValues.minValue, + width: bandwidth, + height: scaledValues.maxValue - scaledValues.minValue + }; + } else { + focusRect = { + x: scaledValues.minValue, + y: midPoint.y - bandwidth / 2, + width: scaledValues.maxValue - scaledValues.minValue, + height: bandwidth + }; + } + nodeData.push({ + series: this, + itemId: xValue2, + datum, + datumIndex, + xKey, + bandwidth, + scaledValues, + midPoint, + focusRect + }); + } + return context; + } + legendItemSymbol() { + const { fill, stroke, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + HighlightState.None + ); + return { + marker: { + fill: import_ag_charts_community21._ModuleSupport.deepClone(fill), + fillOpacity, + stroke, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { xKey, yName, showInLegend, legendItemName } = this.properties; + if (!xKey || legendType !== "category") { + return []; + } + return [ + { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: seriesId }), + label: { + text: legendItemName ?? yName ?? seriesId + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { + xKey, + xName, + yName, + medianKey, + medianName, + q1Key, + q1Name, + q3Key, + q3Name, + minKey, + minName, + maxKey, + maxName, + legendItemName, + tooltip + } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const minValue = dataModel.resolveColumnById(this, `minValue`, processedData)[datumIndex]; + const q1Value = dataModel.resolveColumnById(this, `q1Value`, processedData)[datumIndex]; + const medianValue = dataModel.resolveColumnById(this, `medianValue`, processedData)[datumIndex]; + const q3Value = dataModel.resolveColumnById(this, `q3Value`, processedData)[datumIndex]; + const maxValue = dataModel.resolveColumnById(this, `maxValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + const data = [ + { + label: minName, + fallbackLabel: minKey, + value: this.getAxisValueText(yAxis, "tooltip", minValue, datum, minKey, legendItemName) + }, + { + label: q1Name, + fallbackLabel: q1Key, + value: this.getAxisValueText(yAxis, "tooltip", q1Value, datum, q1Key, legendItemName) + }, + { + label: medianName, + fallbackLabel: medianKey, + value: this.getAxisValueText(yAxis, "tooltip", medianValue, datum, medianKey, legendItemName) + }, + { + label: q3Name, + fallbackLabel: q3Key, + value: this.getAxisValueText(yAxis, "tooltip", q3Value, datum, q3Key, legendItemName) + }, + { + label: maxName, + fallbackLabel: maxKey, + value: this.getAxisValueText(yAxis, "tooltip", maxValue, datum, maxKey, legendItemName) + } + ]; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + title: legendItemName ?? yName, + symbol: this.legendItemSymbol(), + data + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yName, + medianKey, + medianName, + q1Key, + q1Name, + q3Key, + q3Name, + minKey, + minName, + maxKey, + maxName, + ...format + } + ); + } + animateEmptyUpdateReady({ + datumSelection + }) { + const isVertical = this.isVertical(); + const { from, to } = prepareBoxPlotFromTo(isVertical); + motion.resetMotion([datumSelection], resetBoxPlotSelectionsScalingCenterFn(isVertical)); + motion.staticFromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], from, to, { + phase: "initial" + }); + } + isLabelEnabled() { + return false; + } + updateDatumSelection(opts) { + const data = opts.nodeData ?? []; + return opts.datumSelection.update(data); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + cap: { lengthRatio }, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke, + strokeOpacity, + strokeWidth, + maxKey, + maxName, + medianKey, + medianName, + minKey, + minName, + q1Key, + q1Name, + q3Key, + q3Name, + whisker: { + lineDash: whiskerLineDash, + lineDashOffset: whiskerLineDashOffset, + stroke: whiskerStroke, + strokeOpacity: whiskerStrokeOpacity, + strokeWidth: whiskerStrokeWidth + }, + xKey, + xName, + yName + } = this.properties; + const highlightState = toHighlightString(highlightStateEnum ?? HighlightState.None); + return { + cap: { lengthRatio }, + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + maxKey, + maxName: maxName ?? maxKey, + medianKey, + medianName: medianName ?? medianKey, + minKey, + minName: minName ?? minKey, + q1Key, + q1Name: q1Name ?? q1Key, + q3Key, + q3Name: q3Name ?? q3Key, + seriesId, + stroke, + strokeOpacity, + strokeWidth, + whisker: { + lineDash: whiskerLineDash ?? lineDash, + lineDashOffset: whiskerLineDashOffset ?? lineDashOffset, + stroke: whiskerStroke ?? stroke, + strokeOpacity: whiskerStrokeOpacity ?? strokeOpacity, + strokeWidth: whiskerStrokeWidth ?? strokeWidth + }, + xKey, + xName: xName ?? xKey, + yName + }; + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cap, + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke, + strokeOpacity, + strokeWidth, + styler, + whisker + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + cap: { lengthRatio: stylerResult.cap?.lengthRatio ?? cap.lengthRatio }, + whisker: { + lineDash: stylerResult.whisker?.lineDash ?? whisker.lineDash, + lineDashOffset: stylerResult.whisker?.lineDashOffset ?? whisker.lineDashOffset, + stroke: stylerResult.whisker?.stroke ?? whisker.stroke, + strokeOpacity: stylerResult.whisker?.strokeOpacity ?? whisker.strokeOpacity, + strokeWidth: stylerResult.whisker?.strokeWidth ?? whisker.strokeWidth + } + }; + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style = mergeDefaults2(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults2(overrides, style); + } + } + const { stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = style; + style.whisker = mergeDefaults2(style.whisker, { + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + return style; + } + makeItemStylerParams(datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const { xKey, minKey, q1Key, medianKey, q3Key, maxKey } = this.properties; + const datum = this.processedData?.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + minKey, + q1Key, + medianKey, + q3Key, + maxKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((_, nodeDatum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = this.getItemStyle(nodeDatum.datumIndex, isHighlight, highlightState); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const isVertical = this.isVertical(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const fillBBox = this.getShapeFillBBox(); + const strokeAlignment = this.getStyle(false, false, HighlightState.None).strokeWidth / 2; + const wickStrokeAlignment = properties.whisker.strokeWidth ?? properties.strokeWidth; + datumSelection.each((boxPlotNode, nodeDatum) => { + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + applyShapeFillBBox(boxPlotNode, style.fill, fillBBox); + boxPlotNode.fill = style.fill; + boxPlotNode.fillOpacity = style.fillOpacity; + boxPlotNode.stroke = style.stroke; + boxPlotNode.strokeWidth = style.strokeWidth; + boxPlotNode.strokeOpacity = style.strokeOpacity; + boxPlotNode.lineDash = style.lineDash; + boxPlotNode.lineDashOffset = style.lineDashOffset; + boxPlotNode.wickStroke = style.whisker.stroke; + boxPlotNode.wickStrokeWidth = style.whisker.strokeWidth; + boxPlotNode.wickStrokeOpacity = style.whisker.strokeOpacity; + boxPlotNode.wickLineDash = style.whisker.lineDash; + boxPlotNode.wickLineDashOffset = style.whisker.lineDashOffset; + boxPlotNode.cornerRadius = style.cornerRadius; + boxPlotNode.crisp = true; + boxPlotNode.horizontal = !isVertical; + boxPlotNode.center = nodeDatum.scaledValues.xValue; + boxPlotNode.thickness = nodeDatum.bandwidth; + boxPlotNode.min = nodeDatum.scaledValues.minValue; + boxPlotNode.q1 = nodeDatum.scaledValues.q1Value; + boxPlotNode.median = nodeDatum.scaledValues.medianValue; + boxPlotNode.q3 = nodeDatum.scaledValues.q3Value; + boxPlotNode.max = nodeDatum.scaledValues.maxValue; + boxPlotNode.capLengthRatio = style.cap.lengthRatio; + boxPlotNode.strokeAlignment = strokeAlignment; + boxPlotNode.wickStrokeAlignment = wickStrokeAlignment; + }); + } + updateLabelNodes() { + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData); + } + nodeFactory() { + return new BoxPlotNode(); + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds(this, this.contextNodeData?.nodeData[datumIndex].focusRect); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null; + } +}; +BoxPlotSeries.className = "BoxPlotSeries"; +BoxPlotSeries.type = "box-plot"; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeriesOptionsDef.ts +var import_ag_charts_community22 = require("ag-charts-community"); +var import_ag_charts_core10 = require("ag-charts-core"); +var { boxPlotSeriesThemeableOptionsDef, commonSeriesOptionsDefs } = import_ag_charts_community22._ModuleSupport; +var boxPlotSeriesOptionsDef = { + ...commonSeriesOptionsDefs, + ...boxPlotSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core10.required)((0, import_ag_charts_core10.constant)("box-plot")), + xKey: (0, import_ag_charts_core10.required)(import_ag_charts_core10.string), + minKey: (0, import_ag_charts_core10.required)(import_ag_charts_core10.string), + q1Key: (0, import_ag_charts_core10.required)(import_ag_charts_core10.string), + medianKey: (0, import_ag_charts_core10.required)(import_ag_charts_core10.string), + q3Key: (0, import_ag_charts_core10.required)(import_ag_charts_core10.string), + maxKey: (0, import_ag_charts_core10.required)(import_ag_charts_core10.string), + xName: import_ag_charts_core10.string, + yName: import_ag_charts_core10.string, + minName: import_ag_charts_core10.string, + q1Name: import_ag_charts_core10.string, + medianName: import_ag_charts_core10.string, + q3Name: import_ag_charts_core10.string, + maxName: import_ag_charts_core10.string, + grouped: import_ag_charts_core10.boolean, + legendItemName: import_ag_charts_core10.string, + segmentation: import_ag_charts_core10.shapeSegmentation +}; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotThemes.ts +var import_ag_charts_community23 = require("ag-charts-community"); +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE }, + multiSeriesHighlightStyle, + FILL_GRADIENT_LINEAR_DEFAULTS, + FILL_IMAGE_DEFAULTS, + FILL_PATTERN_DEFAULTS, + SAFE_FILL_OPERATION, + SEGMENTATION_DEFAULTS +} = import_ag_charts_community23._ModuleSupport; +var BOX_PLOT_SERIES_THEME = { + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { + $or: [ + { $isGradient: { $palette: "fill" } }, + { $isPattern: { $palette: "fill" } }, + { $isImage: { $palette: "fill" } } + ] + }, + { $palette: "fill" }, + { $mix: [SAFE_FILL_OPERATION, { $ref: "chartBackgroundColor" }, 0.7] } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: 2, + fillOpacity: 1, + strokeOpacity: 1, + lineDash: void 0, + lineDashOffset: 0, + highlight: multiSeriesHighlightStyle(), + segmentation: SEGMENTATION_DEFAULTS + }, + axes: { + [CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE.CATEGORY]: { + groupPaddingInner: 0.2, + crosshair: { + enabled: false, + snap: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotModule.ts +var BoxPlotModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "box-plot", + moduleFactory: (ctx) => new BoxPlotSeries(ctx), + predictAxis: import_ag_charts_community24._ModuleSupport.predictCartesianTimeAxis, + defaultAxes: import_ag_charts_community24._ModuleSupport.DIRECTION_SWAP_AXES, + themeTemplate: BOX_PLOT_SERIES_THEME, + groupable: true +}; +var BoxPlotSeriesModule = { + type: "series", + name: "box-plot", + chartType: "cartesian", + enterprise: true, + options: boxPlotSeriesOptionsDef, + create: (ctx) => new BoxPlotSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickModule.ts +var import_ag_charts_community34 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeries.ts +var import_ag_charts_community31 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesBase.ts +var import_ag_charts_community26 = require("ag-charts-community"); +var import_ag_charts_core11 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcAggregation.ts +var import_ag_charts_community25 = require("ag-charts-community"); +var { + AGGREGATION_SPAN, + AGGREGATION_INDEX_X_MAX, + AGGREGATION_INDEX_X_MIN, + AGGREGATION_INDEX_Y_MAX, + AGGREGATION_INDEX_Y_MIN, + aggregationDomain, + aggregationRangeFittingPoints, + compactAggregationIndices, + createAggregationIndices +} = import_ag_charts_community25._ModuleSupport; +var AGGREGATION_THRESHOLD = 1e3; +var OPEN = AGGREGATION_INDEX_X_MIN; +var HIGH = AGGREGATION_INDEX_Y_MAX; +var LOW = AGGREGATION_INDEX_Y_MIN; +var CLOSE = AGGREGATION_INDEX_X_MAX; +function aggregateOhlcData(scale, xValues, highValues, lowValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD) + return; + const [d0, d1] = aggregationDomain(scale, domain); + let maxRange = aggregationRangeFittingPoints(xValues, d0, d1, { smallestKeyInterval }); + let { indexData, valueData } = createAggregationIndices(xValues, highValues, lowValues, d0, d1, maxRange); + const filters = [{ maxRange, indexData }]; + while (maxRange > 64) { + ({ indexData, valueData, maxRange } = compactAggregationIndices(indexData, valueData, maxRange)); + filters.push({ maxRange, indexData }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesBase.ts +var { + fixNumericExtent: fixNumericExtent2, + keyProperty: keyProperty2, + createDatumId: createDatumId2, + SeriesNodePickMode: SeriesNodePickMode2, + ChartAxisDirection: ChartAxisDirection8, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL2, + valueProperty: valueProperty2, + diff: diff2, + animationValidation: animationValidation2, + computeBarFocusBounds: computeBarFocusBounds2, + visibleRangeIndices, + BandScale, + processedDataIsAnimatable, + mergeDefaults: mergeDefaults3, + simpleMemorize2, + getItemStylesPerItemId +} = import_ag_charts_community26._ModuleSupport; +var memoizedAggregateOhlcData = simpleMemorize2(aggregateOhlcData); +var OhlcSeriesNodeEvent = class extends import_ag_charts_community26._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.openKey = series.properties.openKey; + this.closeKey = series.properties.closeKey; + this.highKey = series.properties.highKey; + this.lowKey = series.properties.lowKey; + } +}; +var OhlcSeriesBase = class extends import_ag_charts_community26._ModuleSupport.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode2.AXIS_ALIGNED, SeriesNodePickMode2.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["lowKey", "highKey", "openKey", "closeKey"] + }, + propertyNames: { + x: ["xName"], + y: ["lowName", "highName", "openName", "closeName"] + }, + categoryKey: "xValue", + pathsPerSeries: [] + }); + this.NodeEvent = OhlcSeriesNodeEvent; + this.dataAggregationFilters = void 0; + } + async processData(dataController) { + if (!this.visible) + return; + const { xKey, openKey, closeKey, highKey, lowKey } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (animationEnabled) { + if (this.processedData) { + extraProps.push(diff2(this.id, this.processedData)); + } + extraProps.push(animationValidation2()); + } + if (openKey) { + extraProps.push( + valueProperty2(openKey, yScaleType, { + id: `openValue`, + invalidValue: void 0, + missingValue: void 0 + }) + ); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty2(xKey, xScaleType, { id: `xValue` }), + valueProperty2(closeKey, yScaleType, { id: `closeValue` }), + valueProperty2(highKey, yScaleType, { id: `highValue` }), + valueProperty2(lowKey, yScaleType, { id: `lowValue` }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL2] : [], + ...extraProps + ] + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.dataAggregationFilters = this.aggregateData( + dataModel, + processedData + ); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection8.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const highValues = dataModel.resolveColumnById(this, `highValue`, processedData); + const lowValues = dataModel.resolveColumnById(this, `lowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateOhlcData( + xAxis.scale.type, + xValues, + highValues, + lowValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + if (direction !== this.getBarDirection()) { + const { index, def } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = processedData.domain.keys[index]; + if (def.type === "key" && def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yExtent = this.domainForClippedRange(direction, ["highValue", "lowValue"], "xValue"); + return fixNumericExtent2(yExtent); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection8.Y, ["highValue", "lowValue"], "xValue", visibleRange); + } + getZoomRangeFittingItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.zoomFittingVisibleItems( + "xValue", + ["highValue", "lowValue"], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + getVisibleItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.countVisibleItems( + "xValue", + ["highValue", "lowValue"], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + createNodeData() { + const { visible, dataModel, processedData } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const nodeData = []; + const { xKey, highKey, lowKey } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const openValues = dataModel.resolveColumnById(this, "openValue", processedData); + const closeValues = dataModel.resolveColumnById(this, "closeValue", processedData); + const highValues = dataModel.resolveColumnById(this, "highValue", processedData); + const lowValues = dataModel.resolveColumnById(this, "lowValue", processedData); + const { groupScale } = this; + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const groupOffset = groupScale.convert(String(groupIndex)); + const effectiveBarWidth = barWidth >= 1 ? barWidth : groupScale.rawBandwidth; + const applyWidthOffset = BandScale.is(xAxis.scale); + const context = { + itemId: xKey, + nodeData, + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStylesPerItemId(this.getItemStyle.bind(this), "up", "down") + }; + if (!visible) + return context; + const handleDatum = (datumIndex, xValue2, openValue, closeValue, highValue, lowValue, width, crisp) => { + const datum = rawData[datumIndex]; + const xOffset = applyWidthOffset ? width / 2 : 0; + const centerX = xAxis.scale.convert(xValue2) + groupOffset + xOffset; + const yOpen = yAxis.scale.convert(openValue); + const yClose = yAxis.scale.convert(closeValue); + const yHigh = yAxis.scale.convert(highValue); + const yLow = yAxis.scale.convert(lowValue); + const isRising = closeValue > openValue; + const itemId = isRising ? "up" : "down"; + const y = Math.min(yHigh, yLow); + const height = Math.max(yHigh, yLow) - y; + const midPoint = { + x: centerX, + y: y + height / 2 + }; + nodeData.push({ + series: this, + itemId, + datum, + datumIndex, + xKey, + xValue: xValue2, + openValue, + closeValue, + highValue, + lowValue, + midPoint, + aggregatedValue: closeValue, + isRising, + centerX, + width, + y, + height, + yOpen, + yClose, + crisp + }); + }; + const { dataAggregationFilters } = this; + const xScale = xAxis.scale; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const xPosition = (index) => xScale.convert(xValues[index]) + groupOffset; + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + if (dataAggregationFilter == null) { + const invalidData = processedData.invalidData?.get(this.id); + let [start, end] = visibleRangeIndices(1, rawData.length, xAxis.range, (index) => { + const xOffset = applyWidthOffset ? 0 : -effectiveBarWidth / 2; + const x = xPosition(index) + xOffset; + return [x, x + effectiveBarWidth]; + }); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let datumIndex = start; datumIndex < end; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const openValue = openValues[datumIndex]; + const closeValue = closeValues[datumIndex]; + const highValue = highValues[datumIndex]; + const lowValue = lowValues[datumIndex]; + const validLowValue = lowValue != null && lowValue <= openValue && lowValue <= closeValue; + const validHighValue = highValue != null && highValue >= openValue && highValue >= closeValue; + if (!validLowValue) { + import_ag_charts_core11.Logger.warnOnce( + `invalid low value for key [${lowKey}] in data element, low value cannot be higher than datum open or close values` + ); + continue; + } + if (!validHighValue) { + import_ag_charts_core11.Logger.warnOnce( + `invalid high value for key [${highKey}] in data element, high value cannot be lower than datum open or close values.` + ); + continue; + } + handleDatum(datumIndex, xValue2, openValue, closeValue, highValue, lowValue, effectiveBarWidth, true); + } + } else { + const { maxRange, indexData } = dataAggregationFilter; + const [start, end] = visibleRangeIndices(1, maxRange, xAxis.range, (index) => { + const aggIndex = index * AGGREGATION_SPAN; + const openIndex = indexData[aggIndex + OPEN]; + const closeIndex = indexData[aggIndex + CLOSE]; + if (openIndex === -1) + return; + const xOffset = applyWidthOffset ? 0 : -effectiveBarWidth / 2; + return [xPosition(openIndex) + xOffset, xPosition(closeIndex) + xOffset + effectiveBarWidth]; + }); + for (let i = start; i < end; i += 1) { + const aggIndex = i * AGGREGATION_SPAN; + const openIndex = indexData[aggIndex + OPEN]; + const closeIndex = indexData[aggIndex + CLOSE]; + const highIndex = indexData[aggIndex + HIGH]; + const lowIndex = indexData[aggIndex + LOW]; + if (openIndex === -1) + continue; + const midDatumIndex = Math.trunc((openIndex + closeIndex) / 2); + const xValue2 = xValues[midDatumIndex]; + if (xValue2 == null) + continue; + const openValue = openValues[openIndex]; + const closeValue = closeValues[closeIndex]; + const highValue = highValues[highIndex]; + const lowValue = lowValues[lowIndex]; + const width = Math.abs(xPosition(closeIndex) - xPosition(openIndex)) + effectiveBarWidth; + handleDatum(midDatumIndex, xValue2, openValue, closeValue, highValue, lowValue, width, false); + } + } + return context; + } + isVertical() { + return true; + } + isLabelEnabled() { + return false; + } + updateDatumSelection(opts) { + const data = opts.nodeData ?? []; + return opts.datumSelection.update(data); + } + updateLabelNodes(_opts) { + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData); + } + getItemStyle(datumIndex, isHighlight, highlightState, itemId = "up") { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + const baseStyle = mergeDefaults3(highlightStyle, properties.getStyle(itemId)); + let style = baseStyle; + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId2(createDatumId2(xValue2), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(itemId, datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`, "item", itemId], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults3(overrides, style); + } + } + return style; + } + makeItemStylerParams(itemId, datumIndex, isHighlight, style) { + const { id: seriesId, properties, processedData } = this; + const { xKey, openKey, closeKey, highKey, lowKey } = properties; + const datum = processedData.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const params = { + seriesId, + datum, + itemId, + xKey, + openKey, + closeKey, + highKey, + lowKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style + }; + if ("fill" in params && "fill" in style) { + params.fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + } + return params; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { + xKey, + xName, + yName, + openKey, + openName, + highKey, + highName, + lowKey, + lowName, + closeKey, + closeName, + legendItemName, + tooltip + } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const openValue = dataModel.resolveColumnById(this, `openValue`, processedData)[datumIndex]; + const highValue = dataModel.resolveColumnById(this, `highValue`, processedData)[datumIndex]; + const lowValue = dataModel.resolveColumnById(this, `lowValue`, processedData)[datumIndex]; + const closeValue = dataModel.resolveColumnById(this, `closeValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const itemId = closeValue >= openValue ? "up" : "down"; + const item = this.properties.item[itemId]; + const format = this.getItemStyle(datumIndex, false); + const marker = { + fill: item.fill ?? item.stroke, + fillOpacity: item.fillOpacity ?? item.strokeOpacity ?? 1, + stroke: item.stroke, + strokeWidth: item.strokeWidth ?? 1, + strokeOpacity: item.strokeOpacity ?? 1, + lineDash: item.lineDash ?? [0], + lineDashOffset: item.lineDashOffset ?? 0 + }; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + title: legendItemName, + symbol: { + marker + }, + data: [ + { + label: openName, + fallbackLabel: openKey, + value: this.getAxisValueText(yAxis, "tooltip", openValue, datum, openKey, legendItemName) + }, + { + label: highName, + fallbackLabel: highKey, + value: this.getAxisValueText(yAxis, "tooltip", highValue, datum, highKey, legendItemName) + }, + { + label: lowName, + fallbackLabel: lowKey, + value: this.getAxisValueText(yAxis, "tooltip", lowValue, datum, lowKey, legendItemName) + }, + { + label: closeName, + fallbackLabel: closeKey, + value: this.getAxisValueText(yAxis, "tooltip", closeValue, datum, closeKey, legendItemName) + } + ] + }, + { + seriesId, + datum, + title: yName, + itemId, + xKey, + xName, + yName, + openKey, + openName, + highKey, + highName, + lowKey, + lowName, + closeKey, + closeName, + ...format + } + ); + } + computeFocusBounds(opts) { + const nodeDatum = this.getNodeData()?.at(opts.datumIndex); + if (nodeDatum == null) + return; + const { centerX, y, width, height } = nodeDatum; + const datum = { + x: centerX - width / 2, + y, + width, + height + }; + return computeBarFocusBounds2(this, datum); + } +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickNode.ts +var import_ag_charts_community28 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcNode.ts +var import_ag_charts_community27 = require("ag-charts-community"); +var { Path: Path6, SceneChangeDetection: SceneChangeDetection2, BBox: BBox3 } = import_ag_charts_community27._ModuleSupport; +var OhlcBaseNode = class extends Path6 { + constructor() { + super(...arguments); + this.centerX = 0; + this.y = 0; + this.width = 0; + this.height = 0; + this.yOpen = 0; + this.yClose = 0; + this.crisp = false; + } + computeBBox() { + const { centerX, y, width, height } = this; + return new BBox3(centerX - width / 2, y, width, height); + } + isPointInPath(x, y) { + return this.getBBox().containsPoint(x, y); + } + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } + get midPoint() { + return { x: this.centerX, y: this.y + this.height / 2 }; + } + alignedCoordinates() { + const { y, width, height, crisp } = this; + let { centerX, yOpen, yClose } = this; + let x0 = centerX - width / 2; + let x1 = centerX + width / 2; + let y0 = y; + let y1 = y + height; + if (crisp && width > 1) { + centerX = this.align(centerX); + if (yOpen <= yClose) { + const h = this.align(yOpen, yClose - yOpen); + yOpen = this.align(yOpen); + yClose = yOpen + h; + } else { + const h = this.align(yClose, yOpen - yClose); + yClose = this.align(yClose); + yOpen = yClose + h; + } + const halfWidth = this.align(width / 2); + x0 = centerX - halfWidth; + x1 = centerX + halfWidth; + y0 = this.align(y); + y1 = y0 + this.align(y0, height); + } + return { centerX, x0, x1, y0, y1, yOpen, yClose }; + } + executeStroke(ctx, path) { + const { width, strokeWidth } = this; + if (width < strokeWidth) { + ctx.lineWidth = width; + } + super.executeStroke(ctx, path); + } +}; +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "centerX", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "y", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "width", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "height", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "yOpen", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "yClose", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "crisp", 2); +var OhlcNode = class extends OhlcBaseNode { + constructor() { + super(...arguments); + this.strokeAlignment = 0; + } + updatePath() { + const { path } = this; + const { centerX, x0, x1, y0, y1, yOpen, yClose } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const strokeAlignment = this.strokeAlignment > 0 ? pixelRatio / this.strokeAlignment / 2 % 1 : 0; + path.clear(); + path.moveTo(centerX - strokeAlignment, y0); + path.lineTo(centerX - strokeAlignment, y1); + if (Math.abs(x1 - x0) > 1) { + path.moveTo(x0, yOpen - strokeAlignment); + path.lineTo(centerX - strokeAlignment, yOpen - strokeAlignment); + path.moveTo(centerX - strokeAlignment, yClose - strokeAlignment); + path.lineTo(x1, yClose - strokeAlignment); + } + } +}; +__decorateClass([ + SceneChangeDetection2() +], OhlcNode.prototype, "strokeAlignment", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickNode.ts +var { SceneArrayChangeDetection: SceneArrayChangeDetection2, SceneChangeDetection: SceneChangeDetection3, ExtendedPath2D: ExtendedPath2D2, BBox: BBox4 } = import_ag_charts_community28._ModuleSupport; +var CandlestickNode = class extends OhlcBaseNode { + constructor() { + super(...arguments); + this.wickPath = new ExtendedPath2D2(); + this.wickStroke = void 0; + this.wickStrokeWidth = void 0; + this.wickStrokeOpacity = void 0; + this.wickStrokeAlignment = 0; + } + computeDefaultGradientFillBBox() { + const { width, centerX, yOpen, yClose } = this; + const boxTop = Math.min(yOpen, yClose); + const boxBottom = Math.max(yOpen, yClose); + const rectHeight = boxBottom - boxTop; + const x0 = centerX - width / 2; + const x1 = centerX + width / 2; + return new BBox4(x0, boxTop, x1 - x0, rectHeight); + } + updatePath() { + const { + path, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke, + wickStrokeWidth, + wickStrokeOpacity, + wickLineDash, + wickLineDashOffset + } = this; + const { centerX, x0, x1, y0, y1, yOpen, yClose } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const wickStrokeAlignment = this.wickStrokeAlignment > 0 ? pixelRatio / this.wickStrokeAlignment / 2 % 1 : 0; + this.path.clear(); + this.wickPath.clear(); + const needsWickPath = wickStroke != null && wickStroke !== stroke || wickStrokeWidth != null && wickStrokeWidth !== strokeWidth || wickStrokeOpacity != null && wickStrokeOpacity !== strokeOpacity || wickLineDash != null && wickLineDash !== lineDash || wickLineDashOffset != null && wickLineDashOffset !== lineDashOffset; + const wickPath = needsWickPath ? this.wickPath : path; + if (Math.abs(x1 - x0) <= 3) { + wickPath.moveTo(centerX - wickStrokeAlignment, y0); + wickPath.lineTo(centerX - wickStrokeAlignment, y1); + return; + } + const boxTop = Math.min(yOpen, yClose); + const boxBottom = Math.max(yOpen, yClose); + const boxStrokeAdjustment = strokeWidth / 2; + wickPath.moveTo(centerX - wickStrokeAlignment, y0); + wickPath.lineTo(centerX - wickStrokeAlignment, boxTop + boxStrokeAdjustment); + wickPath.moveTo(centerX - wickStrokeAlignment, y1); + wickPath.lineTo(centerX - wickStrokeAlignment, boxBottom - boxStrokeAdjustment); + const rectHeight = boxBottom - boxTop - 2 * boxStrokeAdjustment; + if (rectHeight > 0) { + path.rect( + x0 + boxStrokeAdjustment, + boxTop + boxStrokeAdjustment, + x1 - x0 - 2 * boxStrokeAdjustment, + rectHeight + ); + } else { + const boxMid = (boxTop + boxBottom) / 2; + path.moveTo(x0, boxMid); + path.lineTo(x1, boxMid); + } + } + drawPath(ctx) { + super.drawPath(ctx); + const { wickPath } = this; + if (wickPath.isEmpty()) + return; + const { + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke = stroke, + wickStrokeWidth = strokeWidth, + wickStrokeOpacity = strokeOpacity, + wickLineDash = lineDash, + wickLineDashOffset = lineDashOffset + } = this; + if (wickStrokeWidth === 0) + return; + ctx.globalAlpha *= wickStrokeOpacity; + if (typeof wickStroke === "string") { + ctx.strokeStyle = wickStroke; + } + ctx.lineWidth = wickStrokeWidth; + if (wickLineDash != null) { + ctx.setLineDash([...wickLineDash]); + } + ctx.lineDashOffset = wickLineDashOffset; + ctx.stroke(wickPath.getPath2D()); + } +}; +__decorateClass([ + SceneChangeDetection3() +], CandlestickNode.prototype, "wickStroke", 2); +__decorateClass([ + SceneChangeDetection3() +], CandlestickNode.prototype, "wickStrokeWidth", 2); +__decorateClass([ + SceneChangeDetection3() +], CandlestickNode.prototype, "wickStrokeOpacity", 2); +__decorateClass([ + SceneArrayChangeDetection2() +], CandlestickNode.prototype, "wickLineDash", 2); +__decorateClass([ + SceneChangeDetection3() +], CandlestickNode.prototype, "wickLineDashOffset", 2); +__decorateClass([ + SceneChangeDetection3() +], CandlestickNode.prototype, "wickStrokeAlignment", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesProperties.ts +var import_ag_charts_community30 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesProperties.ts +var import_ag_charts_community29 = require("ag-charts-community"); +var { BaseProperties: BaseProperties3, Property: Property13, AbstractBarSeriesProperties: AbstractBarSeriesProperties2, makeSeriesTooltip: makeSeriesTooltip2 } = import_ag_charts_community29._ModuleSupport; +var OhlcSeriesItem = class extends BaseProperties3 { + constructor() { + super(...arguments); + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property13 +], OhlcSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property13 +], OhlcSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property13 +], OhlcSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property13 +], OhlcSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property13 +], OhlcSeriesItem.prototype, "lineDashOffset", 2); +var OhlcSeriesItems = class extends BaseProperties3 { + constructor() { + super(...arguments); + this.up = new OhlcSeriesItem(); + this.down = new OhlcSeriesItem(); + } +}; +__decorateClass([ + Property13 +], OhlcSeriesItems.prototype, "up", 2); +__decorateClass([ + Property13 +], OhlcSeriesItems.prototype, "down", 2); +var OhlcSeriesBaseProperties = class extends AbstractBarSeriesProperties2 { +}; +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "xKey", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "openKey", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "closeKey", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "highKey", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "lowKey", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "xName", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "yName", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "openName", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "closeName", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "highName", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "lowName", 2); +var OhlcSeriesProperties = class extends OhlcSeriesBaseProperties { + constructor() { + super(...arguments); + this.tooltip = makeSeriesTooltip2(); + this.item = new OhlcSeriesItems(); + } + getStyle(itemId) { + const { strokeWidth, strokeOpacity, stroke, lineDash, lineDashOffset } = this.item[itemId]; + return { + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property13 +], OhlcSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property13 +], OhlcSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property13 +], OhlcSeriesProperties.prototype, "itemStyler", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesProperties.ts +var { BaseProperties: BaseProperties4, makeSeriesTooltip: makeSeriesTooltip3, Property: Property14 } = import_ag_charts_community30._ModuleSupport; +var CandlestickSeriesWick = class extends BaseProperties4 { +}; +__decorateClass([ + Property14 +], CandlestickSeriesWick.prototype, "stroke", 2); +__decorateClass([ + Property14 +], CandlestickSeriesWick.prototype, "strokeWidth", 2); +__decorateClass([ + Property14 +], CandlestickSeriesWick.prototype, "strokeOpacity", 2); +__decorateClass([ + Property14 +], CandlestickSeriesWick.prototype, "lineDash", 2); +__decorateClass([ + Property14 +], CandlestickSeriesWick.prototype, "lineDashOffset", 2); +var CandlestickSeriesItem = class extends BaseProperties4 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.wick = new CandlestickSeriesWick(); + } +}; +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "fill", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "fillOpacity", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "lineDashOffset", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "cornerRadius", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "wick", 2); +var CandlestickSeriesItems = class extends BaseProperties4 { + constructor() { + super(...arguments); + this.up = new CandlestickSeriesItem(); + this.down = new CandlestickSeriesItem(); + } +}; +__decorateClass([ + Property14 +], CandlestickSeriesItems.prototype, "up", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItems.prototype, "down", 2); +var CandlestickSeriesProperties = class extends OhlcSeriesBaseProperties { + constructor() { + super(); + this.item = new CandlestickSeriesItems(); + this.tooltip = makeSeriesTooltip3(); + this.highlightStyle.deprecated = false; + } + getStyle(itemId) { + const { fill, fillOpacity, strokeWidth, strokeOpacity, stroke, lineDash, lineDashOffset, cornerRadius, wick } = this.item[itemId]; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1, + wick + }; + } +}; +__decorateClass([ + Property14 +], CandlestickSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property14 +], CandlestickSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property14 +], CandlestickSeriesProperties.prototype, "itemStyler", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeries.ts +var { isGradientFill, isPatternFill, isImageFill, applyShapeStyle } = import_ag_charts_community31._ModuleSupport; +var CandlestickSeries = class extends OhlcSeriesBase { + constructor() { + super(...arguments); + this.properties = new CandlestickSeriesProperties(); + } + nodeFactory() { + const node = new CandlestickNode(); + node.lineCap = "butt"; + return node; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { up, down } = properties.item; + datumSelection.each((node, datum) => { + const { centerX, width, y, height, yOpen, yClose, crisp } = datum; + const baseStyle = datum.isRising ? up : down; + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + node.centerX = centerX; + node.width = width; + node.y = y; + node.height = height; + node.yOpen = yOpen; + node.yClose = yClose; + node.crisp = crisp; + applyShapeStyle(node, style, this.getShapeFillBBox()); + const styleWick = style?.wick; + node.wickStroke = styleWick?.stroke; + node.wickStrokeWidth = styleWick?.strokeWidth; + node.wickStrokeOpacity = styleWick?.strokeOpacity; + node.wickLineDash = styleWick?.lineDash; + node.wickLineDashOffset = styleWick?.lineDashOffset; + node.wickStrokeAlignment = baseStyle.wick.strokeWidth ?? baseStyle.strokeWidth; + }); + } + legendItemSymbol() { + const { up, down } = this.properties.item; + const upColorStops = isGradientFill(up.fill) ? up.fill.colorStops.map( + (c) => typeof c === "string" ? c : { color: c.color, stop: c.stop == null ? void 0 : c.stop * 0.5 } + ) : [ + { color: isPatternFill(up.fill) || isImageFill(up.fill) ? up.stroke : up.fill, stop: 0 }, + { color: isPatternFill(up.fill) || isImageFill(up.fill) ? up.stroke : up.fill, stop: 0.5 } + ]; + const downColorStops = isGradientFill(down.fill) ? down.fill.colorStops.map( + (c) => typeof c === "string" ? c : { color: c.color, stop: c.stop == null ? void 0 : c.stop * 0.5 } + ) : [{ color: isPatternFill(down.fill) || isImageFill(down.fill) ? down.stroke : down.fill, stop: 0.5 }]; + const fill = { + type: "gradient", + gradient: "linear", + rotation: 90, + colorStops: [...upColorStops, ...downColorStops], + reverse: false + }; + const stroke = { + type: "gradient", + gradient: "linear", + rotation: 90, + colorStops: [ + { color: up.stroke, stop: 0 }, + { color: up.stroke, stop: 0.5 }, + { color: down.stroke, stop: 0.5 } + ], + reverse: false + }; + return { + marker: { + fill, + fillOpacity: up.fillOpacity, + stroke, + strokeWidth: up.strokeWidth ?? 1, + strokeOpacity: up.strokeOpacity ?? 1, + lineDash: up.lineDash, + lineDashOffset: up.lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id, + data, + visible, + ctx: { legendManager } + } = this; + const { xKey, yName, showInLegend, legendItemName } = this.properties; + if (!data?.data.length || !xKey || legendType !== "category") { + return []; + } + return [ + { + legendType: "category", + id, + itemId: id, + seriesId: id, + enabled: visible && legendManager.getItemEnabled({ seriesId: id, itemId: id }), + label: { + text: legendItemName ?? yName ?? id + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + hasItemStylers() { + return this.properties.itemStyler != null; + } +}; +CandlestickSeries.className = "CandleStickSeries"; +CandlestickSeries.type = "candlestick"; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesOptionsDef.ts +var import_ag_charts_community32 = require("ag-charts-community"); +var import_ag_charts_core12 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs2, candlestickSeriesThemeableOptionsDef } = import_ag_charts_community32._ModuleSupport; +var candlestickSeriesOptionsDef = { + ...commonSeriesOptionsDefs2, + ...candlestickSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core12.required)((0, import_ag_charts_core12.constant)("candlestick")), + xKey: (0, import_ag_charts_core12.required)(import_ag_charts_core12.string), + openKey: (0, import_ag_charts_core12.required)(import_ag_charts_core12.string), + highKey: (0, import_ag_charts_core12.required)(import_ag_charts_core12.string), + lowKey: (0, import_ag_charts_core12.required)(import_ag_charts_core12.string), + closeKey: (0, import_ag_charts_core12.required)(import_ag_charts_core12.string), + xName: import_ag_charts_core12.string, + yName: import_ag_charts_core12.string, + openName: import_ag_charts_core12.string, + highName: import_ag_charts_core12.string, + lowName: import_ag_charts_core12.string, + closeName: import_ag_charts_core12.string +}; +candlestickSeriesOptionsDef.pickOutsideVisibleMinorAxis = (0, import_ag_charts_core12.undocumented)(import_ag_charts_core12.boolean); +candlestickSeriesOptionsDef.focusPriority = (0, import_ag_charts_core12.undocumented)(import_ag_charts_core12.number); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickThemes.ts +var import_ag_charts_community33 = require("ag-charts-community"); +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE2 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle2, + FILL_GRADIENT_LINEAR_KEYED_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS2, + FILL_PATTERN_KEYED_DEFAULTS +} = import_ag_charts_community33._ModuleSupport; +function itemTheme(key) { + return { + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + key === "up" ? "transparent" : { $palette: "fill" }, + { $palette: `${key}.fill` } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_KEYED_DEFAULTS(key)], + ["image", FILL_IMAGE_DEFAULTS2], + ["pattern", FILL_PATTERN_KEYED_DEFAULTS(key)] + ] + }, + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: `${key}.stroke` } + ] + } + }; +} +var CANDLESTICK_SERIES_THEME = { + series: { + item: { + up: itemTheme("up"), + down: itemTheme("down") + }, + highlightStyle: { + item: { strokeWidth: 3 } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: multiSeriesHighlightStyle2() + }, + animation: { enabled: false }, + axes: { + [CARTESIAN_AXIS_TYPE2.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE2.ORDINAL_TIME]: { + groupPaddingInner: 0, + crosshair: { + enabled: true + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickModule.ts +var { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE3, CARTESIAN_POSITION } = import_ag_charts_community34._ModuleSupport.ThemeConstants; +var CandlestickModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "candlestick", + moduleFactory: (ctx) => new CandlestickSeries(ctx), + defaultAxes: [ + { + type: CARTESIAN_AXIS_TYPE3.NUMBER, + position: CARTESIAN_POSITION.LEFT + }, + { + type: CARTESIAN_AXIS_TYPE3.ORDINAL_TIME, + position: CARTESIAN_POSITION.BOTTOM + } + ], + themeTemplate: CANDLESTICK_SERIES_THEME, + groupable: false +}; +var CandlestickSeriesModule = { + type: "series", + name: "candlestick", + chartType: "cartesian", + enterprise: true, + options: candlestickSeriesOptionsDef, + create: (ctx) => new CandlestickSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapModule.ts +var import_ag_charts_community40 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeries.ts +var import_ag_charts_community37 = require("ag-charts-community"); +var import_ag_charts_core14 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/util/labelFormatter.ts +var import_ag_charts_core13 = require("ag-charts-core"); +function generateLabelSecondaryLabelFontSizeCandidates(label, secondaryLabel) { + const { fontSize: labelFontSize, minimumFontSize: labelMinimumFontSize = labelFontSize } = label; + const { + fontSize: secondaryLabelFontSize, + minimumFontSize: secondaryLabelMinimumFontSize = secondaryLabelFontSize + } = secondaryLabel; + const labelTracks = labelFontSize - labelMinimumFontSize; + const secondaryLabelTracks = secondaryLabelFontSize - secondaryLabelMinimumFontSize; + let currentLabelFontSize = label.fontSize; + let currentSecondaryLabelFontSize = secondaryLabel.fontSize; + const out = [{ labelFontSize, secondaryLabelFontSize }]; + while (currentLabelFontSize > labelMinimumFontSize || currentSecondaryLabelFontSize > secondaryLabelMinimumFontSize) { + const labelProgress = labelTracks > 0 ? (currentLabelFontSize - labelMinimumFontSize) / labelTracks : -1; + const secondaryLabelProgress = secondaryLabelTracks > 0 ? (currentSecondaryLabelFontSize - secondaryLabelMinimumFontSize) / secondaryLabelTracks : -1; + if (labelProgress > secondaryLabelProgress) { + currentLabelFontSize--; + } else { + currentSecondaryLabelFontSize--; + } + out.push({ + labelFontSize: currentLabelFontSize, + secondaryLabelFontSize: currentSecondaryLabelFontSize + }); + } + out.reverse(); + return out; +} +function formatStackedLabels(labelValue, labelProps, secondaryLabelValue, secondaryLabelProps, { padding }, sizeFittingHeight) { + const { spacing = 0 } = labelProps; + const widthAdjust = 2 * padding; + const heightAdjust = 2 * padding + spacing; + const minimumHeight = (labelProps.minimumFontSize ?? labelProps.fontSize) + (secondaryLabelProps.minimumFontSize ?? secondaryLabelProps.fontSize); + if (minimumHeight > sizeFittingHeight(minimumHeight + heightAdjust, false).height - heightAdjust) + return; + const fontSizeCandidates = generateLabelSecondaryLabelFontSizeCandidates(labelProps, secondaryLabelProps); + const labelTextSizeProps = { + fontFamily: labelProps.fontFamily, + fontStyle: labelProps.fontStyle, + fontWeight: labelProps.fontWeight + }; + const secondaryLabelTextSizeProps = { + fontFamily: secondaryLabelProps.fontFamily, + fontStyle: secondaryLabelProps.fontStyle, + fontWeight: secondaryLabelProps.fontWeight + }; + let label; + let secondaryLabel; + return (0, import_ag_charts_core13.findMaxValue)(0, fontSizeCandidates.length - 1, (index) => { + const { labelFontSize, secondaryLabelFontSize } = fontSizeCandidates[index]; + const allowTruncation = index === 0; + const labelFont = { ...labelTextSizeProps, fontSize: labelFontSize }; + const secondaryLabelFont = { ...secondaryLabelTextSizeProps, fontSize: secondaryLabelFontSize }; + const labelLineHeight = (0, import_ag_charts_core13.cachedTextMeasurer)(labelFont).lineHeight(); + const secondaryLabelLineHeight = (0, import_ag_charts_core13.cachedTextMeasurer)(secondaryLabelFont).lineHeight(); + const sizeFitting = sizeFittingHeight( + labelLineHeight + secondaryLabelLineHeight + heightAdjust, + allowTruncation + ); + const availableWidth = sizeFitting.width - widthAdjust; + const availableHeight = sizeFitting.height - heightAdjust; + if (labelLineHeight + secondaryLabelLineHeight > availableHeight) + return; + if (label == null || label.fontSize !== labelFontSize) { + label = wrapLabel( + labelProps, + labelValue, + availableWidth, + availableHeight, + labelFont, + labelProps.wrapping, + allowTruncation ? labelProps.overflowStrategy : "hide" + ); + } + if (label == null || label.width > availableWidth || label.height > availableHeight) + return; + if (secondaryLabel == null || secondaryLabel.fontSize !== secondaryLabelFontSize) { + secondaryLabel = wrapLabel( + secondaryLabelProps, + secondaryLabelValue, + availableWidth, + availableHeight, + secondaryLabelFont, + secondaryLabelProps.wrapping, + allowTruncation ? secondaryLabelProps.overflowStrategy : "hide" + ); + } + if (secondaryLabel == null) + return; + const totalLabelHeight = label.height + secondaryLabel.height; + if (secondaryLabel.width > availableWidth || totalLabelHeight > availableHeight) + return; + return { + width: Math.max(label.width, secondaryLabel.width), + height: totalLabelHeight + spacing, + meta: sizeFitting.meta, + label, + secondaryLabel + }; + }); +} +function formatSingleLabel(value, props, { padding }, sizeFittingHeight) { + const sizeAdjust = 2 * padding; + const minimumFontSize = Math.min(props.minimumFontSize ?? props.fontSize, props.fontSize); + const textSizeProps = { + fontFamily: props.fontFamily, + fontStyle: props.fontStyle, + fontWeight: props.fontWeight + }; + return (0, import_ag_charts_core13.findMaxValue)(minimumFontSize, props.fontSize, (fontSize) => { + const currentFont = { ...textSizeProps, fontSize }; + const measurer = (0, import_ag_charts_core13.cachedTextMeasurer)(currentFont); + const allowTruncation = fontSize === minimumFontSize; + const lineHeight = props.lineHeight ?? measurer.lineHeight(); + const sizeFitting = sizeFittingHeight(lineHeight + sizeAdjust, allowTruncation); + const availableWidth = sizeFitting.width - sizeAdjust; + const availableHeight = sizeFitting.height - sizeAdjust; + if (lineHeight > availableHeight || availableWidth < 0) + return; + const lines = (0, import_ag_charts_core13.wrapLines)(value, { + maxWidth: availableWidth, + maxHeight: availableHeight, + font: currentFont, + textWrap: props.wrapping, + overflow: (allowTruncation ? props.overflowStrategy : null) ?? "hide" + }); + if (!lines.length) + return; + const { width, height } = measurer.measureLines(lines); + const text = lines.join("\n"); + return [{ width, height, text, fontSize, lineHeight }, sizeFitting.meta]; + }); +} +function hasInvalidFontSize(label) { + return label?.minimumFontSize != null && label?.fontSize != null && label?.minimumFontSize > label?.fontSize; +} +function formatLabels(baseLabelValue, labelProps, baseSecondaryLabelValue, secondaryLabelProps, layoutParams, sizeFittingHeight) { + const labelValue = labelProps.enabled ? baseLabelValue : void 0; + const secondaryLabelValue = secondaryLabelProps.enabled ? baseSecondaryLabelValue : void 0; + if (hasInvalidFontSize(labelProps) || hasInvalidFontSize(secondaryLabelProps)) { + import_ag_charts_core13.Logger.warnOnce(`minimumFontSize should be set to a value less than or equal to the font size`); + } + let value; + if (labelValue != null && secondaryLabelValue != null) { + value = formatStackedLabels( + labelValue, + labelProps, + secondaryLabelValue, + secondaryLabelProps, + layoutParams, + sizeFittingHeight + ); + } + let labelMeta; + if (value == null && labelValue != null) { + labelMeta = formatSingleLabel(labelValue, labelProps, layoutParams, sizeFittingHeight); + } + if (labelMeta != null) { + const [label, meta] = labelMeta; + value = { + width: label.width, + height: label.height, + meta, + label, + secondaryLabel: void 0 + }; + } + let secondaryLabelMeta; + if (value == null && labelValue == null && secondaryLabelValue != null) { + secondaryLabelMeta = formatSingleLabel( + secondaryLabelValue, + secondaryLabelProps, + layoutParams, + sizeFittingHeight + ); + } + if (secondaryLabelMeta != null) { + const [secondaryLabel, meta] = secondaryLabelMeta; + value = { + width: secondaryLabel.width, + height: secondaryLabel.height, + meta, + label: void 0, + secondaryLabel + }; + } + return value; +} +function wrapLabel(props, text, maxWidth, maxHeight, font, textWrap, overflow) { + const lines = (0, import_ag_charts_core13.wrapLines)(text, { maxWidth, maxHeight, font, textWrap, overflow }); + if (!lines.length) + return; + const measurer = (0, import_ag_charts_core13.cachedTextMeasurer)(font); + const lineHeight = props.lineHeight ?? measurer.lineHeight(); + const { width } = measurer.measureLines(lines); + return { + width, + lineHeight, + text: lines.join("\n"), + height: lines.length * lineHeight, + fontSize: font.fontSize + }; +} + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesProperties.ts +var import_ag_charts_community36 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/util/autoSizedLabel.ts +var import_ag_charts_community35 = require("ag-charts-community"); +var { Property: Property15 } = import_ag_charts_community35._ModuleSupport; +var BaseAutoSizedLabel = class extends import_ag_charts_community35._ModuleSupport.Label { + constructor() { + super(...arguments); + this.wrapping = "on-space"; + this.overflowStrategy = "ellipsis"; + } +}; +__decorateClass([ + Property15 +], BaseAutoSizedLabel.prototype, "wrapping", 2); +__decorateClass([ + Property15 +], BaseAutoSizedLabel.prototype, "overflowStrategy", 2); +__decorateClass([ + Property15 +], BaseAutoSizedLabel.prototype, "lineHeight", 2); +__decorateClass([ + Property15 +], BaseAutoSizedLabel.prototype, "minimumFontSize", 2); +var AutoSizedLabel = class extends BaseAutoSizedLabel { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property15 +], AutoSizedLabel.prototype, "spacing", 2); +var AutoSizedSecondaryLabel = class extends BaseAutoSizedLabel { +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesProperties.ts +var { CartesianSeriesProperties, makeSeriesTooltip: makeSeriesTooltip4, Property: Property16 } = import_ag_charts_community36._ModuleSupport; +var HeatmapSeriesProperties = class extends CartesianSeriesProperties { + constructor() { + super(...arguments); + this.colorRange = ["black", "black"]; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.itemPadding = 0; + this.label = new AutoSizedLabel(); + this.tooltip = makeSeriesTooltip4(); + } +}; +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "textAlign", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "verticalAlign", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "itemPadding", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode3, + computeBarFocusBounds: computeBarFocusBounds3, + getMissCount, + valueProperty: valueProperty3, + ChartAxisDirection: ChartAxisDirection9, + DEFAULT_CARTESIAN_DIRECTION_KEYS, + DEFAULT_CARTESIAN_DIRECTION_NAMES, + createDatumId: createDatumId3, + ColorScale, + Rect, + PointerEvents, + applyShapeStyle: applyShapeStyle2, + mergeDefaults: mergeDefaults4, + formatValue, + addHitTestersToQuadtree, + findQuadtreeMatch, + updateLabelNode +} = import_ag_charts_community37._ModuleSupport; +var HeatmapSeriesNodeEvent = class extends import_ag_charts_community37._ModuleSupport.CartesianSeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.colorKey = series.properties.colorKey; + } +}; +var textAlignFactors = { + left: -0.5, + center: 0, + right: -0.5 +}; +var verticalAlignFactors = { + top: -0.5, + middle: 0, + bottom: -0.5 +}; +var HeatmapSeries = class extends import_ag_charts_community37._ModuleSupport.CartesianSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: { + ...DEFAULT_CARTESIAN_DIRECTION_KEYS, + color: ["colorKey"] + }, + propertyNames: { + ...DEFAULT_CARTESIAN_DIRECTION_NAMES, + color: ["colorName"] + }, + categoryKey: void 0, + pickModes: [SeriesNodePickMode3.NEAREST_NODE, SeriesNodePickMode3.EXACT_SHAPE_MATCH], + pathsPerSeries: [] + }); + this.properties = new HeatmapSeriesProperties(); + this.NodeEvent = HeatmapSeriesNodeEvent; + this.colorScale = new ColorScale(); + } + async processData(dataController) { + const xAxis = this.axes[ChartAxisDirection9.X]; + const yAxis = this.axes[ChartAxisDirection9.Y]; + if (!xAxis || !yAxis || !this.data?.data.length) { + return; + } + const { xKey, yKey, colorRange, colorKey } = this.properties; + const xScale = this.axes[ChartAxisDirection9.X]?.scale; + const yScale = this.axes[ChartAxisDirection9.Y]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const colorScaleType = this.colorScale.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty3(xKey, xScaleType, { id: "xValue" }), + valueProperty3(yKey, yScaleType, { id: "yValue" }), + ...colorKey ? [valueProperty3(colorKey, colorScaleType, { id: "colorValue", invalidValue: void 0 })] : [] + ] + }); + if (this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const rawDomain = processedData.domain.values[colorKeyIdx].filter((v) => v != null); + const domain = import_ag_charts_community37._ModuleSupport.extent(rawDomain); + this.colorScale.domain = domain ?? []; + if (domain?.length && domain[0] === domain[1]) { + const midIndex = Math.floor(colorRange.length / 2); + this.colorScale.range = [colorRange[midIndex], colorRange[midIndex]]; + } else { + this.colorScale.range = colorRange; + } + this.colorScale.update(); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorDataIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount(this, processedData.defs.values[colorDataIdx].missing); + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const actualCount = processedData.domain.values[colorKeyIdx].filter((v) => v != null).length; + const colorDataMissing = dataCount === 0 || dataCount === missCount || actualCount === 0; + return !colorDataMissing; + } + xCoordinateRange(xValue2, pixelSize) { + const xScale = this.axes[ChartAxisDirection9.X].scale; + const xOffset = pixelSize * (xScale.bandwidth ?? 0) / 2; + const x = xScale.convert(xValue2) + xOffset; + const width = pixelSize * (xScale.bandwidth ?? 10); + return [x, x + width]; + } + yCoordinateRange(yValues, pixelSize) { + const yScale = this.axes[ChartAxisDirection9.Y].scale; + const yOffset = pixelSize * (yScale.bandwidth ?? 0) / 2; + const y = yScale.convert(yValues[0]) + yOffset; + const height = pixelSize * (yScale.bandwidth ?? 10); + return [y, y + height]; + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) + return []; + if (direction === ChartAxisDirection9.X) { + return dataModel.getDomain(this, `xValue`, "value", processedData); + } else { + return dataModel.getDomain(this, `yValue`, "value", processedData); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { data, visible, axes, dataModel, processedData } = this; + const xAxis = axes[ChartAxisDirection9.X]; + const yAxis = axes[ChartAxisDirection9.Y]; + if (!(data && dataModel && processedData && visible && xAxis && yAxis)) + return; + if (xAxis.type !== "category" || yAxis.type !== "category") { + import_ag_charts_core14.Logger.warnOnce( + `Heatmap series expected axes to have "category" type, but received "${xAxis.type}" and "${yAxis.type}" instead.` + ); + return; + } + const { xKey, xName, yKey, yName, colorKey, colorName, textAlign, verticalAlign, itemPadding, label } = this.properties; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const colorValues = colorKey ? dataModel.resolveColumnById(this, `colorValue`, processedData) : void 0; + const colorDomain = colorKey ? dataModel.getDomain(this, "colorValue", "value", processedData) : []; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const yOffset = (yScale.bandwidth ?? 0) / 2; + const nodeData = []; + const labelData = []; + const width = xScale.bandwidth ?? 10; + const height = yScale.bandwidth ?? 10; + const textAlignFactor = (width - 2 * itemPadding) * textAlignFactors[textAlign]; + const verticalAlignFactor = (height - 2 * itemPadding) * verticalAlignFactors[verticalAlign]; + const sizeFittingHeight = () => ({ width, height, meta: null }); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xDatum = xValues[datumIndex]; + const yDatum = yValues[datumIndex]; + const x = xScale.convert(xDatum) + xOffset; + const y = yScale.convert(yDatum) + yOffset; + const colorValue = colorValues?.[datumIndex]; + const labelText = label.enabled && colorValue != null ? this.getLabelText( + colorValue, + datum, + colorKey, + "color", + colorDomain, + label, + { value: colorValue, datum, colorKey, colorName, xKey, yKey, xName, yName } + ) : void 0; + const labels = formatLabels( + (0, import_ag_charts_core14.toPlainText)(labelText), + this.properties.label, + void 0, + this.properties.label, + { padding: itemPadding }, + sizeFittingHeight + ); + const point = { x, y, size: 0 }; + const style = this.getItemStyle({ datumIndex, datum, colorValue }, false); + nodeData.push({ + series: this, + itemId: yKey, + datumIndex, + yKey, + xKey, + xValue: xDatum, + yValue: yDatum, + colorValue, + datum, + point, + width, + height, + midPoint: { x, y }, + missing: colorValues != null && colorValue == null, + style + }); + if (labels?.label != null) { + const { text, fontSize, lineHeight, height: labelHeight } = labels.label; + const { fontStyle, fontFamily, fontWeight, color: color6 } = this.properties.label; + const lx = point.x + textAlignFactor * (width - 2 * itemPadding); + const ly = point.y + verticalAlignFactor * (height - 2 * itemPadding) - (labels.height - labelHeight) * 0.5; + labelData.push({ + series: this, + itemId: yKey, + datum, + datumIndex, + text, + fontSize, + lineHeight, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + textBaseline: verticalAlign, + x: lx, + y: ly, + style + }); + } + } + return { + itemId: this.properties.yKey ?? this.id, + nodeData, + labelData, + scales: this.calculateScaling(), + visible: this.visible + }; + } + nodeFactory() { + return new Rect(); + } + update(params) { + this.ctx.animationManager.skipCurrentBatch(); + return super.update(params); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data); + } + getItemStyle({ datumIndex, datum, colorValue }, isHighlight) { + const { properties } = this; + const { itemStyler, stroke, strokeWidth, strokeOpacity } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const style = mergeDefaults4(highlightStyle, { + fill: this.isColorScaleValid() && colorValue != null ? this.colorScale.convert(colorValue) : "transparent", + fillOpacity: 1, + stroke, + strokeWidth, + strokeOpacity, + opacity: 1 + }); + let overrides; + if (itemStyler != null && datumIndex != null) { + overrides = this.cachedDatumCallback(createDatumId3(datumIndex, isHighlight ? "highlight" : "node"), () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + }); + } + return overrides ? mergeDefaults4(overrides, style) : style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId, properties } = this; + const { xKey, yKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + yKey, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const xAxis = this.axes[ChartAxisDirection9.X]; + const [visibleMin, visibleMax] = xAxis?.visibleRange ?? []; + const isZoomed = visibleMin !== 0 || visibleMax !== 1; + const crisp = !isZoomed; + datumSelection.each((rect, nodeDatum) => { + const { point, width, height, style } = nodeDatum; + applyShapeStyle2(rect, style); + rect.crisp = crisp; + rect.x = Math.floor(point.x - width / 2); + rect.y = Math.floor(point.y - height / 2); + rect.width = Math.ceil(width); + rect.height = Math.ceil(height); + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + const { enabled } = this.properties.label; + const data = enabled ? labelData : []; + return labelSelection.update(data); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((text, datum) => { + text.pointerEvents = PointerEvents.None; + text.text = datum.text; + text.fillOpacity = this.getHighlightStyle(false, datum.datumIndex)?.opacity ?? 1; + updateLabelNode(this, text, this.properties, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties, colorScale, ctx } = this; + const { formatManager } = ctx; + const { xKey, xName, yKey, yName, colorKey, colorName, colorRange, title, legendItemName, tooltip } = properties; + const xAxis = axes[ChartAxisDirection9.X]; + const yAxis = axes[ChartAxisDirection9.Y]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + const colorValue = colorKey != null && this.isColorScaleValid() ? dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex] : void 0; + if (xValue2 == null) + return; + const data = []; + let fill; + if (colorValue == null) { + fill = colorRange[0]; + } else { + fill = colorScale.convert(colorValue); + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue(colorValue) }); + } + data.push( + { + label: xName, + fallbackLabel: xKey, + value: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName) + }, + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, yKey, legendItemName) + } + ); + const format = this.getItemStyle({ datumIndex, datum, colorValue }, false); + if (format.fill != null) { + fill = format.fill; + } + const symbol = fill == null ? void 0 : { + marker: { + shape: "square", + fill, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + } + }; + return this.formatTooltipWithContext( + tooltip, + { title: title ?? legendItemName, symbol, data }, + { + seriesId, + datum, + title, + xKey, + xName, + yKey, + yName, + colorKey, + colorName, + ...format + } + ); + } + getLegendData(legendType) { + if (legendType !== "gradient" || !this.isColorScaleValid() || !this.dataModel) { + return []; + } + return [ + { + legendType: "gradient", + enabled: this.visible, + seriesId: this.id, + series: this.getFormatterContext("color"), + colorDomain: this.colorScale.domain, + colorRange: this.colorScale.range + } + ]; + } + isLabelEnabled() { + return this.properties.label.enabled && Boolean(this.properties.colorKey); + } + getBandScalePadding() { + return { inner: 0, outer: 0 }; + } + computeFocusBounds({ datumIndex }) { + const datum = this.contextNodeData?.nodeData[datumIndex]; + if (datum === void 0) + return void 0; + const { width, height, midPoint } = datum; + const focusRect = { x: midPoint.x - width / 2, y: midPoint.y - height / 2, width, height }; + return computeBarFocusBounds3(this, focusRect); + } + initQuadTree(quadtree) { + addHitTestersToQuadtree(quadtree, this.datumNodesIter()); + } + pickNodesExactShape(point) { + const item = findQuadtreeMatch(this, point); + return item != null && item.distance <= 0 ? [item.datum] : []; + } + pickNodeClosestDatum(point) { + return findQuadtreeMatch(this, point); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +HeatmapSeries.className = "HeatmapSeries"; +HeatmapSeries.type = "heatmap"; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesOptionsDef.ts +var import_ag_charts_community38 = require("ag-charts-community"); +var import_ag_charts_core15 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs3, heatmapSeriesThemeableOptionsDef, without } = import_ag_charts_community38._ModuleSupport; +var heatmapSeriesOptionsDef = { + ...without(heatmapSeriesThemeableOptionsDef, ["showInLegend"]), + ...without(commonSeriesOptionsDefs3, ["showInLegend"]), + type: (0, import_ag_charts_core15.required)((0, import_ag_charts_core15.constant)("heatmap")), + xKey: (0, import_ag_charts_core15.required)(import_ag_charts_core15.string), + yKey: (0, import_ag_charts_core15.required)(import_ag_charts_core15.string), + colorKey: import_ag_charts_core15.string, + xName: import_ag_charts_core15.string, + yName: import_ag_charts_core15.string, + colorName: import_ag_charts_core15.string, + colorRange: (0, import_ag_charts_core15.arrayOf)(import_ag_charts_core15.color) +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapThemes.ts +var import_ag_charts_community39 = require("ag-charts-community"); +var HEATMAP_SERIES_THEME = { + series: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $ref: "chartBackgroundColor" }, + { $path: ["/0", { $palette: "stroke" }, { $palette: "strokes" }] } + ] + }, + strokeWidth: { $isUserOption: ["./stroke", 2, void 0] }, + // @ts-expect-error undocumented option + colorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "divergingColors" }, + import_ag_charts_community39._ModuleSupport.SAFE_RANGE2_OPERATION + ] + }, + label: { + ...import_ag_charts_community39._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + color: { $ref: "textColor" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + wrapping: "on-space", + overflowStrategy: "ellipsis" + }, + itemPadding: 3, + highlight: import_ag_charts_community39._ModuleSupport.singleSeriesHighlightStyle() + }, + gradientLegend: { + enabled: true, + ...import_ag_charts_community39._ModuleSupport.LEGEND_CONTAINER_THEME + } +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE4, CARTESIAN_POSITION: CARTESIAN_POSITION2 } +} = import_ag_charts_community40._ModuleSupport; +var HeatmapModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "heatmap", + moduleFactory: (ctx) => new HeatmapSeries(ctx), + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE4.CATEGORY, position: CARTESIAN_POSITION2.LEFT }, + { type: CARTESIAN_AXIS_TYPE4.CATEGORY, position: CARTESIAN_POSITION2.BOTTOM } + ], + themeTemplate: HEATMAP_SERIES_THEME +}; +var HeatmapSeriesModule = { + type: "series", + name: "heatmap", + chartType: "cartesian", + enterprise: true, + options: heatmapSeriesOptionsDef, + create: (ctx) => new HeatmapSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcModule.ts +var import_ag_charts_community43 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeries.ts +var import_ag_charts_community41 = require("ag-charts-community"); +var { applyShapeStyle: applyShapeStyle3 } = import_ag_charts_community41._ModuleSupport; +var OhlcSeries = class extends OhlcSeriesBase { + constructor() { + super(...arguments); + this.properties = new OhlcSeriesProperties(); + } + nodeFactory() { + const node = new OhlcNode(); + node.lineCap = "square"; + return node; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { up, down } = properties.item; + datumSelection.each((node, datum) => { + const { centerX, width, y, height, yOpen, yClose, crisp } = datum; + const baseStyle = datum.isRising ? up : down; + node.centerX = centerX; + node.width = width; + node.y = y; + node.height = height; + node.yOpen = yOpen; + node.yClose = yClose; + node.crisp = crisp; + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle3(node, style); + node.strokeAlignment = baseStyle.strokeWidth; + }); + } + getLegendData(legendType) { + const { + id, + data, + ctx: { legendManager }, + visible + } = this; + const { + xKey, + yName, + item: { up, down }, + showInLegend, + legendItemName + } = this.properties; + if (!data?.data.length || !xKey || legendType !== "category") { + return []; + } + const fill = { + type: "gradient", + gradient: "linear", + colorSpace: "rgb", + colorStops: [ + { color: up.stroke, stop: 0 }, + { color: up.stroke, stop: 0.5 }, + { color: down.stroke, stop: 0.5 } + ], + rotation: 90 + }; + return [ + { + legendType: "category", + id, + itemId: id, + seriesId: id, + enabled: visible && legendManager.getItemEnabled({ seriesId: id, itemId: id }), + label: { + text: legendItemName ?? yName ?? id + }, + symbol: { + marker: { + fill, + fillOpacity: up.strokeOpacity, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + } + }, + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + hasItemStylers() { + return this.properties.itemStyler != null; + } +}; +OhlcSeries.className = "ohlc"; +OhlcSeries.type = "ohlc"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesOptionsDef.ts +var import_ag_charts_community42 = require("ag-charts-community"); +var import_ag_charts_core16 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs4, ohlcSeriesThemeableOptionsDef } = import_ag_charts_community42._ModuleSupport; +var ohlcSeriesOptionsDef = { + ...commonSeriesOptionsDefs4, + ...ohlcSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core16.required)((0, import_ag_charts_core16.constant)("ohlc")), + xKey: (0, import_ag_charts_core16.required)(import_ag_charts_core16.string), + openKey: (0, import_ag_charts_core16.required)(import_ag_charts_core16.string), + highKey: (0, import_ag_charts_core16.required)(import_ag_charts_core16.string), + lowKey: (0, import_ag_charts_core16.required)(import_ag_charts_core16.string), + closeKey: (0, import_ag_charts_core16.required)(import_ag_charts_core16.string), + xName: import_ag_charts_core16.string, + yName: import_ag_charts_core16.string, + openName: import_ag_charts_core16.string, + highName: import_ag_charts_core16.string, + lowName: import_ag_charts_core16.string, + closeName: import_ag_charts_core16.string +}; +ohlcSeriesOptionsDef.pickOutsideVisibleMinorAxis = (0, import_ag_charts_core16.undocumented)(import_ag_charts_core16.boolean); +ohlcSeriesOptionsDef.focusPriority = (0, import_ag_charts_core16.undocumented)(import_ag_charts_core16.number); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE5, CARTESIAN_POSITION: CARTESIAN_POSITION3 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle3 +} = import_ag_charts_community43._ModuleSupport; +var OhlcModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "ohlc", + moduleFactory: (ctx) => new OhlcSeries(ctx), + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE5.NUMBER, position: CARTESIAN_POSITION3.LEFT }, + { type: CARTESIAN_AXIS_TYPE5.ORDINAL_TIME, position: CARTESIAN_POSITION3.BOTTOM } + ], + themeTemplate: { + animation: { enabled: false }, + series: { + item: { + up: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: "up.stroke" } + ] + } + }, + down: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: "down.stroke" } + ] + } + } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: multiSeriesHighlightStyle3(false) + }, + axes: { + [CARTESIAN_AXIS_TYPE5.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE5.ORDINAL_TIME]: { + groupPaddingInner: 0, + crosshair: { + enabled: true + } + } + } + }, + groupable: false +}; +var OhlcSeriesModule = { + type: "series", + name: "ohlc", + chartType: "cartesian", + enterprise: true, + options: ohlcSeriesOptionsDef, + create: (ctx) => new OhlcSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaModule.ts +var import_ag_charts_community51 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/range-area/rangeArea.ts +var import_ag_charts_community48 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaAggregation.ts +var import_ag_charts_community44 = require("ag-charts-community"); +var { + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX2, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN2, + aggregationDomain: aggregationDomain2, + aggregationIndexForXRatio, + aggregationRangeFittingPoints: aggregationRangeFittingPoints2, + aggregationXRatioForXValue, + compactAggregationIndices: compactAggregationIndices2, + createAggregationIndices: createAggregationIndices2 +} = import_ag_charts_community44._ModuleSupport; +var AGGREGATION_THRESHOLD2 = 1e3; +function aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf); + const aggIndex = aggregationIndexForXRatio(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MAX2]; +} +function aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf); + const aggIndex = aggregationIndexForXRatio(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MIN2]; +} +function aggregateRangeAreaData(scale, xValues, highValues, lowValues, domain, xNeedsValueOf, yNeedsValueOf) { + if (xValues.length < AGGREGATION_THRESHOLD2) + return; + const [d0, d1] = aggregationDomain2(scale, domain); + let maxRange = aggregationRangeFittingPoints2(xValues, d0, d1, { xNeedsValueOf }); + const { indexData, valueData } = createAggregationIndices2(xValues, highValues, lowValues, d0, d1, maxRange, { + xNeedsValueOf, + yNeedsValueOf + }); + let topIndices = []; + let bottomIndices = []; + for (let datumIndex = 0; datumIndex < xValues.length; datumIndex += 1) { + if (aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf)) { + topIndices.push(datumIndex); + } + if (aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf)) { + bottomIndices.push(datumIndex); + } + } + const filters = [{ maxRange, topIndices, bottomIndices }]; + while (maxRange > 64) { + ({ maxRange } = compactAggregationIndices2(indexData, valueData, maxRange, { inPlace: true })); + topIndices = topIndices.filter( + (datumIndex) => aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) + ); + bottomIndices = bottomIndices.filter( + (datumIndex) => aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) + ); + filters.push({ maxRange, topIndices, bottomIndices }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaIntersection.ts +var import_ag_charts_community45 = require("ag-charts-community"); +function getYValueAtX({ span }, x) { + switch (span.type) { + case "linear": + case "step": + case "multi-line": { + const t = (x - span.x0) / (span.x1 - span.x0); + return span.y0 + t * (span.y1 - span.y0); + } + case "cubic": { + const { cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y } = span; + let t = 0.5; + const tolerance = 1e-6; + for (let i = 0; i < 10; i++) { + const mt2 = 1 - t; + const xt = mt2 * mt2 * mt2 * cp0x + 3 * mt2 * mt2 * t * cp1x + 3 * mt2 * t * t * cp2x + t * t * t * cp3x; + const fx = xt - x; + if (Math.abs(fx) < tolerance) + break; + const dxdt = 3 * mt2 * mt2 * (cp1x - cp0x) + 6 * mt2 * t * (cp2x - cp1x) + 3 * t * t * (cp3x - cp2x); + if (Math.abs(dxdt) < 1e-12) + break; + t = t - fx / dxdt; + t = Math.max(0, Math.min(1, t)); + } + const mt = 1 - t; + return mt * mt * mt * cp0y + 3 * mt * mt * t * cp1y + 3 * mt * t * t * cp2y + t * t * t * cp3y; + } + } +} +function findSpanForX(spans, x, startIndex = 0) { + for (let i = startIndex; i < spans.length; i++) { + const span = spans[i]; + const [start, end] = import_ag_charts_community45._ModuleSupport.spanRange(span.span); + if (x >= start.x && x <= end.x) { + return { span, index: i }; + } + if (x < start.x) { + break; + } + } + return { span: null, index: startIndex }; +} +function checkForIntersection(highSpans, lowSpans, x, wasInverted, spanIndex) { + const high = findSpanForX(highSpans, x, spanIndex); + const low = findSpanForX(lowSpans, x, spanIndex); + if (!high.span || !low.span) { + return { intersection: null, spanIndex: high.index, isInverted: wasInverted }; + } + const highY = getYValueAtX(high.span, x); + const lowY = getYValueAtX(low.span, x); + const isInverted = highY > lowY; + const intersection = wasInverted === isInverted ? null : { x, y: highY }; + return { intersection, spanIndex: high.index, isInverted }; +} +function findRangeAreaIntersections(highSpans, lowSpans, minX, maxX, initiallyInverted = false) { + if (highSpans.length === 0 || lowSpans.length === 0) + return []; + const intersections = []; + let wasInverted = initiallyInverted; + let spanIndex = 0; + for (let x = minX; x <= maxX; x += 0.5) { + const result = checkForIntersection(highSpans, lowSpans, x, wasInverted, spanIndex); + if (result.intersection) { + intersections.push(result.intersection.x); + } + spanIndex = result.spanIndex; + wasInverted = result.isInverted; + } + return intersections; +} +function calculateIntersectionSegments(intersections, seriesRect, chartSize, startsInverted, style = {}) { + const horizontalMargin = Math.max(seriesRect.x, chartSize.width - (seriesRect.x + seriesRect.width)); + const verticalMargin = Math.max(seriesRect.y, chartSize.height - (seriesRect.y + seriesRect.height)); + const result = []; + const createClipRect = (x0, x1) => ({ + x0, + y0: -verticalMargin, + x1, + y1: seriesRect.height + verticalMargin + }); + if (startsInverted) { + result.push({ + clipRect: createClipRect(-horizontalMargin, intersections[0] ?? seriesRect.width + horizontalMargin), + ...style + }); + } + const startIndex = startsInverted ? 1 : 0; + for (let i = startIndex; i < intersections.length; i += 2) { + result.push({ + clipRect: createClipRect(intersections[i], intersections[i + 1] ?? seriesRect.width + horizontalMargin), + ...style + }); + } + return result; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaProperties.ts +var import_ag_charts_community46 = require("ag-charts-community"); +var { + BaseProperties: BaseProperties5, + CartesianSeriesProperties: CartesianSeriesProperties2, + InterpolationProperties, + SeriesMarker, + makeSeriesTooltip: makeSeriesTooltip5, + Property: Property17, + DropShadow, + Label +} = import_ag_charts_community46._ModuleSupport; +var RangeAreaSeriesLabel = class extends Label { + constructor() { + super(...arguments); + this.placement = "outside"; + this.spacing = 0; + } +}; +__decorateClass([ + Property17 +], RangeAreaSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property17 +], RangeAreaSeriesLabel.prototype, "spacing", 2); +var RangeAreaInvertedStyle = class { + constructor() { + this.enabled = false; + this.fillOpacity = 1; + } +}; +__decorateClass([ + Property17 +], RangeAreaInvertedStyle.prototype, "enabled", 2); +__decorateClass([ + Property17 +], RangeAreaInvertedStyle.prototype, "fill", 2); +__decorateClass([ + Property17 +], RangeAreaInvertedStyle.prototype, "fillOpacity", 2); +var RangeAreaLineStyle = class extends BaseProperties5 { + constructor() { + super(...arguments); + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.marker = new SeriesMarker(); + } +}; +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "stroke", 2); +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "lineDash", 2); +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "lineDashOffset", 2); +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "marker", 2); +var RangeAreaItemProperties = class extends BaseProperties5 { + constructor() { + super(...arguments); + this.low = new RangeAreaLineStyle(); + this.high = new RangeAreaLineStyle(); + } +}; +__decorateClass([ + Property17 +], RangeAreaItemProperties.prototype, "low", 2); +__decorateClass([ + Property17 +], RangeAreaItemProperties.prototype, "high", 2); +var SharedRangeAreaMarker = class extends BaseProperties5 { +}; +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "enabled", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "shape", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "size", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "fill", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "fillOpacity", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "stroke", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "strokeWidth", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "strokeOpacity", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "lineDash", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "lineDashOffset", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "itemStyler", 2); +var RangeAreaProperties = class extends CartesianSeriesProperties2 { + constructor() { + super(...arguments); + this.fill = "#99CCFF"; + this.fillOpacity = 1; + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.interpolation = new InterpolationProperties(); + this.item = new RangeAreaItemProperties(); + this.invertedStyle = new RangeAreaInvertedStyle(); + this.shadow = new DropShadow().set({ enabled: false }); + this.marker = new SharedRangeAreaMarker(); + this.label = new RangeAreaSeriesLabel(); + this.tooltip = makeSeriesTooltip5(); + this.connectMissingData = false; + } +}; +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "xKey", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "yLowKey", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "yHighKey", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "xName", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "yName", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "yLowName", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "yHighName", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "fill", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "stroke", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "lineDash", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "interpolation", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "styler", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "item", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "invertedStyle", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "shadow", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "marker", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "label", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "tooltip", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "connectMissingData", 2); + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaUtil.ts +var import_ag_charts_community47 = require("ag-charts-community"); +var { + CollapseMode, + isScaleValid, + pairUpSpans, + prepareAreaFillAnimationFns, + plotInterpolatedLinePathStroke, + prepareLinePathPropertyAnimation, + areScalingEqual +} = import_ag_charts_community47._ModuleSupport; +function prepareRangeAreaPathStrokeAnimationFns(status, highSpans, lowSpans, visibleToggleMode) { + const removePhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.removed); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.removed); + }; + const updatePhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.moved); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.moved); + }; + const addPhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.added); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.added); + }; + const pathProperties = prepareLinePathPropertyAnimation(status, visibleToggleMode); + return { status, path: { addPhaseFn, updatePhaseFn, removePhaseFn }, pathProperties }; +} +function prepareRangeAreaPathAnimation(newData, oldData, diff8) { + const isCategoryBased = newData.scales.x?.type === "category"; + const wasCategoryBased = oldData.scales.x?.type === "category"; + if (isCategoryBased !== wasCategoryBased || !isScaleValid(newData.scales.x) || !isScaleValid(oldData.scales.x)) { + return; + } + let status = "updated"; + if (oldData.visible && !newData.visible) { + status = "removed"; + } else if (!oldData.visible && newData.visible) { + status = "added"; + } + const fillSpans = pairUpSpans( + { scales: newData.scales, data: newData.fillData.spans }, + { scales: oldData.scales, data: oldData.fillData.spans }, + CollapseMode.Split + ); + if (fillSpans == null) + return; + const fillPhantomSpans = pairUpSpans( + { scales: newData.scales, data: newData.fillData.phantomSpans }, + { scales: oldData.scales, data: oldData.fillData.phantomSpans }, + CollapseMode.Split + ); + if (fillPhantomSpans == null) + return; + const highStrokeSpans = pairUpSpans( + { scales: newData.scales, data: newData.highStrokeData.spans }, + { scales: oldData.scales, data: oldData.highStrokeData.spans }, + CollapseMode.Split + ); + if (highStrokeSpans == null) + return; + const lowStrokeSpans = pairUpSpans( + { scales: newData.scales, data: newData.lowStrokeData.spans }, + { scales: oldData.scales, data: oldData.lowStrokeData.spans }, + CollapseMode.Split + ); + if (lowStrokeSpans == null) + return; + const fadeMode = "fade"; + const fill = prepareAreaFillAnimationFns(status, fillSpans, fillPhantomSpans, fadeMode); + const stroke = prepareRangeAreaPathStrokeAnimationFns(status, highStrokeSpans, lowStrokeSpans, fadeMode); + const hasMotion = (diff8?.changed ?? true) || !areScalingEqual(newData.scales.x, oldData.scales.x) || !areScalingEqual(newData.scales.y, oldData.scales.y) || status !== "updated"; + return { status, fill, stroke, hasMotion }; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeArea.ts +var { + valueProperty: valueProperty4, + keyProperty: keyProperty3, + ChartAxisDirection: ChartAxisDirection10, + mergeDefaults: mergeDefaults5, + updateLabelNode: updateLabelNode2, + fixNumericExtent: fixNumericExtent3, + buildResetPathFn, + resetLabelFn, + resetMarkerFn, + resetMarkerPositionFn, + pathSwipeInAnimation, + resetMotion, + markerSwipeScaleInAnimation, + seriesLabelFadeInAnimation, + animationValidation: animationValidation3, + diff: diff3, + updateClipPath, + computeMarkerFocusBounds, + plotAreaPathFill, + plotLinePathStroke, + interpolatePoints, + pathFadeInAnimation, + markerFadeInAnimation, + fromToMotion, + pathMotion, + extent, + applyShapeFillBBox: applyShapeFillBBox2, + PointerEvents: PointerEvents2, + Marker, + BBox: BBox5, + findMinMax: findMinMax2, + applyShapeStyle: applyShapeStyle4, + processedDataIsAnimatable: processedDataIsAnimatable2, + simpleMemorize2: simpleMemorize22, + markerEnabled, + getMarkerStyles, + calculateSegments: calculateSegments2, + toHighlightString: toHighlightString2, + HighlightState: HighlightState2 +} = import_ag_charts_community48._ModuleSupport; +var memoizedAggregateRangeAreaData = simpleMemorize22(aggregateRangeAreaData); +var RangeAreaSeriesNodeEvent = class extends import_ag_charts_community48._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yLowKey = series.properties.yLowKey; + this.yHighKey = series.properties.yHighKey; + } +}; +var BaseSeries = import_ag_charts_community48._ModuleSupport.CartesianSeries; +var RangeAreaSeries = class extends BaseSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pathsPerSeries: ["fill", "lowStroke", "highStroke"], + pickModes: [import_ag_charts_community48._ModuleSupport.SeriesNodePickMode.AXIS_ALIGNED], + propertyKeys: { + [ChartAxisDirection10.X]: ["xKey"], + [ChartAxisDirection10.Y]: ["yLowKey", "yHighKey"] + }, + propertyNames: { + [ChartAxisDirection10.X]: ["xName"], + [ChartAxisDirection10.Y]: ["yLowName", "yHighName", "yName"] + }, + categoryKey: "xValue", + animationResetFns: { + path: buildResetPathFn({ getVisible: () => this.visible, getOpacity: () => this.getOpacity() }), + label: resetLabelFn, + datum: (node, datum) => ({ ...resetMarkerFn(node), ...resetMarkerPositionFn(node, datum) }) + }, + clipFocusBox: false + }); + this.properties = new RangeAreaProperties(); + this.NodeEvent = RangeAreaSeriesNodeEvent; + this.dataAggregationFilters = void 0; + } + async processData(dataController) { + const { xKey, yLowKey, yHighKey } = this.properties; + const xScale = this.axes[ChartAxisDirection10.X]?.scale; + const yScale = this.axes[ChartAxisDirection10.Y]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + if (!this.ctx.animationManager.isSkipped() && this.processedData) { + extraProps.push(diff3(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation3()); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty3(xKey, xScaleType, { id: `xValue` }), + valueProperty4(yLowKey, yScaleType, { id: `yLowValue` }), + valueProperty4(yHighKey, yScaleType, { id: `yHighValue` }), + ...extraProps + ] + }); + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable2(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection10.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + const xNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `xValue`, processedData); + const yNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `yHighValue`, processedData); + return memoizedAggregateRangeAreaData( + xAxis.scale.type, + xValues, + yHighValues, + yLowValues, + domain, + xNeedsValueOf, + yNeedsValueOf + ); + } + xCoordinateRange(xValue2) { + const x = this.axes[ChartAxisDirection10.X].scale.convert(xValue2); + return [x, x]; + } + yCoordinateRange(yValues) { + const y = this.axes[ChartAxisDirection10.Y].scale.convert(yValues[0]); + return [y, y]; + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + const { + domain: { + keys: [keys] + } + } = processedData; + if (direction === ChartAxisDirection10.X) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef.def.valueType === "category") { + return keys; + } + return fixNumericExtent3(extent(keys)); + } else { + const yExtent = this.domainForClippedRange(ChartAxisDirection10.Y, ["yHighValue", "yLowValue"], "xValue"); + const fixedYExtent = findMinMax2(yExtent); + return fixNumericExtent3(fixedYExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection10.Y, ["yHighValue", "yLowValue"], "xValue", visibleRange); + } + createNodeData() { + const { data, dataModel, processedData, axes } = this; + const xAxis = axes[ChartAxisDirection10.X]; + const yAxis = axes[ChartAxisDirection10.Y]; + if (!(data && xAxis && yAxis && dataModel && processedData && this.chart?.seriesRect)) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const { xKey, yLowKey, yHighKey, connectMissingData, interpolation, fill, fillOpacity, item } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yHighValues = dataModel.resolveColumnById(this, "yHighValue", processedData); + const yLowValues = dataModel.resolveColumnById(this, "yLowValue", processedData); + const xPosition = (index) => xScale.convert(xValues[index]) + xOffset; + const labelData = []; + const markerData = []; + const spanPoints = []; + const handleDatumPoint = (datumIndex, yHighValue, yLowValue) => { + const datum = rawData[datumIndex]; + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return; + const currentSpanPoints = spanPoints.at(-1); + if (Number.isFinite(yHighValue) && Number.isFinite(yLowValue)) { + const appendMarker = (id, yValue, y) => { + const { size } = item[id].marker; + markerData.push({ + index: datumIndex, + series: this, + itemId: id, + datum, + datumIndex, + midPoint: { x, y }, + yHighValue, + yLowValue, + xValue: xValue2, + xKey, + yLowKey, + yHighKey, + point: { x, y, size }, + enabled: true + }); + const highLabelDatum = this.createLabelData({ + datumIndex, + point: { x, y }, + value: yValue, + yLowValue, + yHighValue, + itemId: id, + inverted, + datum, + series: this + }); + labelData.push(highLabelDatum); + }; + const inverted = yLowValue > yHighValue; + const x = xPosition(datumIndex); + const yHighCoordinate = yScale.convert(yHighValue); + const yLowCoordinate = yScale.convert(yLowValue); + appendMarker("high", yHighValue, yHighCoordinate); + appendMarker("low", yLowValue, yLowCoordinate); + const spanPoint = { + high: { + point: { x, y: yHighCoordinate }, + xDatum: xValue2, + yDatum: yHighValue + }, + low: { + point: { x, y: yLowCoordinate }, + xDatum: xValue2, + yDatum: yLowValue + } + }; + if (Array.isArray(currentSpanPoints)) { + currentSpanPoints.push(spanPoint); + } else if (currentSpanPoints == null) { + spanPoints.push([spanPoint]); + } else { + currentSpanPoints.skip += 1; + spanPoints.push([spanPoint]); + } + } else if (!connectMissingData) { + if (Array.isArray(currentSpanPoints) || currentSpanPoints == null) { + spanPoints.push({ skip: 0 }); + } else { + currentSpanPoints.skip += 1; + } + } + }; + const { dataAggregationFilters } = this; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + const topIndices = dataAggregationFilter?.topIndices; + const bottomIndices = dataAggregationFilter?.bottomIndices; + let [start, end] = this.visibleRangeIndices("xValue", xAxis.range, topIndices); + start = Math.max(start - 1, 0); + end = Math.min(end + 1, topIndices?.length ?? xValues.length); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let i = start; i < end; i += 1) { + const topDatumIndex = topIndices?.[i] ?? i; + const bottomDatumIndex = bottomIndices?.[i] ?? i; + handleDatumPoint(topDatumIndex, yHighValues[topDatumIndex], yLowValues[bottomDatumIndex]); + } + const highSpans = spanPoints.flatMap((p) => { + if (!Array.isArray(p)) + return []; + const highPoints = p.map((d) => d.high); + return interpolatePoints(highPoints, interpolation); + }); + const lowSpans = spanPoints.flatMap((p) => { + if (!Array.isArray(p)) + return []; + const lowPoints = p.map((d) => d.low); + return interpolatePoints(lowPoints, interpolation); + }); + const segments = calculateSegments2( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene, + false + ); + let intersectionSegments = void 0; + if (this.properties.invertedStyle.enabled) { + const startsInverted = yHighValues[0] < yLowValues[0]; + const intersectionXValues = findRangeAreaIntersections( + highSpans, + lowSpans, + xScale.range[0], + xScale.range[1], + startsInverted + ); + intersectionSegments = calculateIntersectionSegments( + intersectionXValues, + this.chart.seriesRect, + this.ctx.scene, + startsInverted, + this.properties.invertedStyle + ); + } + const getLowOrHighMarkerStyles = (lowOrHigh) => { + const line = item[lowOrHigh]; + const { stroke, strokeWidth, strokeOpacity } = line; + const inheritedStyles = { fill, fillOpacity, stroke, strokeWidth, strokeOpacity }; + return getMarkerStyles(this, line, line.marker, inheritedStyles); + }; + const context = { + itemId: `${yLowKey}-${yHighKey}`, + labelData, + nodeData: markerData, + fillData: { itemId: "high", spans: highSpans, phantomSpans: lowSpans }, + highStrokeData: { itemId: "high", spans: highSpans }, + lowStrokeData: { itemId: "low", spans: lowSpans }, + scales: this.calculateScaling(), + visible: this.visible, + styles: { + low: getLowOrHighMarkerStyles("low"), + high: getLowOrHighMarkerStyles("high") + }, + segments, + intersectionSegments + }; + return context; + } + createLabelData({ + datumIndex, + point, + value, + itemId, + inverted, + datum, + series + }) { + const { xKey, yLowKey, yHighKey, xName, yName, yLowName, yHighName, legendItemName, label } = this.properties; + const { placement } = label; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + let actualItemId = itemId; + if (inverted) { + actualItemId = itemId === "low" ? "high" : "low"; + } + const direction = placement === "outside" && actualItemId === "high" || placement === "inside" && actualItemId === "low" ? -1 : 1; + const yDomain = this.getSeriesDomain(ChartAxisDirection10.Y); + return { + x: point.x, + y: point.y + spacing * direction, + series, + itemId, + datum, + datumIndex, + text: this.getLabelText( + value, + datum, + itemId === "high" ? yHighKey : yLowKey, + "y", + yDomain, + label, + { value, datum, itemId, xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName } + ), + textAlign: "center", + textBaseline: direction === -1 ? "bottom" : "top" + }; + } + isPathOrSelectionDirty() { + const { low, high } = this.properties.item; + return low.marker.isDirty() || high.marker.isDirty(); + } + strokewidthChange() { + const itemStrokeWidthChange = (lowOrHigh) => { + const unhighlightedStrokeWidth = this.properties.item[lowOrHigh].strokeWidth ?? 0; + const highlightedSeriesStrokeWidth = this.properties.highlight.highlightedSeries.item?.[lowOrHigh]?.strokeWidth ?? unhighlightedStrokeWidth; + const highlightedItemStrokeWidth = this.properties.highlight.highlightedItem.item?.[lowOrHigh]?.strokeWidth ?? unhighlightedStrokeWidth; + return unhighlightedStrokeWidth > highlightedItemStrokeWidth || highlightedSeriesStrokeWidth > highlightedItemStrokeWidth; + }; + return itemStrokeWidthChange("low") || itemStrokeWidthChange("high"); + } + updatePathNodes(opts) { + const { visible } = opts; + const [fillPath, lowStrokePath, highStrokePath] = opts.paths; + const segments = this.contextNodeData?.segments; + const highlightDatum = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightState(highlightDatum, false); + const highlightStyle = this.getHighlightStyle(); + const { item, fill, fillOpacity, opacity } = mergeDefaults5( + highlightStyle, + this.getStyle(false, highlightState) + ); + lowStrokePath.setProperties({ + datum: segments, + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: PointerEvents2.None, + stroke: item.low.stroke, + strokeWidth: item.low.strokeWidth, + strokeOpacity: item.low.strokeOpacity, + lineDash: item.low.lineDash, + lineDashOffset: item.low.lineDashOffset, + opacity, + visible + }); + highStrokePath.setProperties({ + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: PointerEvents2.None, + stroke: item.high.stroke, + strokeWidth: item.high.strokeWidth, + strokeOpacity: item.high.strokeOpacity, + lineDash: item.high.lineDash, + lineDashOffset: item.high.lineDashOffset, + opacity, + visible + }); + const fillBBox = this.getShapeFillBBox(); + applyShapeFillBBox2(fillPath, fill, fillBBox); + applyShapeStyle4(fillPath, { stroke: void 0, fill, fillOpacity, opacity }, fillBBox); + const fillSegments = this.contextNodeData?.intersectionSegments ?? segments; + fillPath.setProperties({ + segments: fillSegments, + pointerEvents: PointerEvents2.None, + lineJoin: "round", + fillShadow: this.properties.shadow, + opacity, + visible + }); + fillPath.datum = fillSegments; + updateClipPath(this, fillPath); + updateClipPath(this, lowStrokePath); + updateClipPath(this, highStrokePath); + } + updatePaths(opts) { + this.updateAreaPaths(opts.paths, opts.contextData); + } + updateAreaPaths(paths, contextData) { + for (const path of paths) { + path.visible = contextData.visible; + } + if (contextData.visible) { + this.updateFillPath(paths, contextData); + this.updateStrokePath(paths, contextData); + } else { + for (const path of paths) { + path.path.clear(); + path.markDirty("RangeArea"); + } + } + } + updateFillPath(paths, contextData) { + const [fill] = paths; + fill.path.clear(); + plotAreaPathFill(fill, contextData.fillData); + fill.markDirty("RangeArea"); + } + updateStrokePath(paths, contextData) { + const [, lowStroke, highStroke] = paths; + lowStroke.path.clear(); + highStroke.path.clear(); + plotLinePathStroke(lowStroke, contextData.lowStrokeData.spans); + plotLinePathStroke(highStroke, contextData.highStrokeData.spans); + lowStroke.markDirty("RangeArea"); + highStroke.markDirty("RangeArea"); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const { processedData, axes, properties } = this; + const rules = properties.styler ? this.getStylerMarkerOptions().item : properties.item; + const { low, high } = rules; + const markersEnabled = markerEnabled(processedData.input.count, axes[ChartAxisDirection10.X].scale, { + enabled: low.marker.enabled || high.marker.enabled + }); + if (properties.item.low.marker.isDirty() || properties.item.high.marker.isDirty()) { + datumSelection.clear(); + datumSelection.cleanup(); + } + let resolvedNodeData; + if (markersEnabled) { + if (low.marker.enabled && high.marker.enabled) { + resolvedNodeData = nodeData; + } else { + resolvedNodeData = []; + for (const datum of nodeData) { + if (rules[datum.itemId].marker.enabled) { + resolvedNodeData.push(datum); + } + } + } + } else { + resolvedNodeData = []; + } + return datumSelection.update(resolvedNodeData); + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((_, datum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { fill, fillOpacity, item } = stylerStyle; + const { stroke, strokeWidth, strokeOpacity } = item[datum.itemId]; + const { marker } = this.properties.item[datum.itemId]; + const params = this.makeItemStylerParams(datum.itemId); + datum.style = this.getMarkerStyle( + marker, + datum, + params, + { isHighlight, highlightState, resolveMarkerSubPath: ["item", datum.itemId, "marker"] }, + stylerStyle.item[datum.itemId].marker, + { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity + } + ); + }); + } + updateDatumNodes(opts) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum) => { + const { itemId } = datum; + const style = datum.style ?? contextNodeData.styles[itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style, node, datum.point, fillBBox); + }); + if (!isHighlight) { + this.properties.item.low.marker.markClean(); + this.properties.item.high.marker.markClean(); + } + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData, (text) => { + text.pointerEvents = PointerEvents2.None; + }); + } + updateLabelNodes(opts) { + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yName: this.properties.yName, + yLowKey: this.properties.yLowKey, + yLowName: this.properties.yLowName ?? this.properties.yLowKey, + yHighKey: this.properties.yHighKey, + yHighName: this.properties.yHighName ?? this.properties.yHighKey, + legendItemName: this.properties.legendItemName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + updateLabelNode2(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getHighlightData(nodeData, highlightedItem) { + const highlightItems = nodeData.filter((nodeDatum) => nodeDatum.datum === highlightedItem.datum); + return highlightItems.length > 0 ? highlightItems : void 0; + } + getStyle(highlighted, highlightState) { + return this.getStylerCouple(highlighted, highlightState)[0]; + } + getStylerMarkerOptions() { + return this.getStylerCouple(false)[1]; + } + getStylerCouple(highlighted, highlightState) { + const { fill, fillOpacity, item, styler } = this.properties; + let stylerResult = {}; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + const markerOpts = { + item: { low: { marker: { enabled: false } }, high: { marker: { enabled: false } } } + }; + const makeItemResult = (lowOrHigh) => { + const stylerItem = stylerResult.item?.[lowOrHigh]; + const { lineDash, lineDashOffset, marker, stroke, strokeOpacity, strokeWidth } = item[lowOrHigh]; + markerOpts.item[lowOrHigh].marker.enabled = stylerItem?.marker?.enabled ?? marker.enabled; + return { + marker: { + fill: stylerItem?.marker?.fill ?? marker.fill ?? fill, + fillOpacity: stylerItem?.marker?.fillOpacity ?? marker.fillOpacity, + shape: stylerItem?.marker?.shape ?? marker.shape, + size: stylerItem?.marker?.size ?? marker.size, + lineDash: stylerItem?.marker?.lineDash ?? marker.lineDash, + lineDashOffset: stylerItem?.marker?.lineDashOffset ?? marker.lineDashOffset, + stroke: stylerItem?.marker?.stroke ?? marker.stroke ?? stroke, + strokeOpacity: stylerItem?.marker?.strokeOpacity ?? marker.strokeOpacity, + strokeWidth: stylerItem?.marker?.strokeWidth ?? marker.strokeWidth + }, + lineDash: stylerItem?.lineDash ?? lineDash, + lineDashOffset: stylerItem?.lineDashOffset ?? lineDashOffset, + stroke: stylerItem?.stroke ?? stroke, + strokeOpacity: stylerItem?.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerItem?.strokeWidth ?? strokeWidth + }; + }; + const style = { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + opacity: 1, + topLevel: { + lineDash: this.properties.lineDash, + lineDashOffset: this.properties.lineDashOffset, + marker: this.properties.marker, + stroke: this.properties.stroke, + strokeOpacity: this.properties.strokeOpacity, + strokeWidth: this.properties.strokeWidth + }, + item: { + low: makeItemResult("low"), + high: makeItemResult("high") + } + }; + return [style, markerOpts]; + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { fill, fillOpacity, item, xKey, yHighKey, yLowKey } = this.properties; + const highlightState = toHighlightString2(highlightStateEnum ?? HighlightState2.None); + const makeItemParam = (lowOrHigh) => { + const { lineDash, lineDashOffset, marker, stroke, strokeOpacity, strokeWidth } = item[lowOrHigh]; + return { + marker: { + fill: marker.fill ?? fill, + fillOpacity: marker.fillOpacity, + size: marker.size, + shape: marker.shape, + stroke: marker.stroke ?? stroke, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }, + lineDash, + lineDashOffset, + stroke, + strokeOpacity, + strokeWidth + }; + }; + return { + item: { + low: makeItemParam("low"), + high: makeItemParam("high") + }, + fill, + fillOpacity, + highlightState, + highlighted, + seriesId, + xKey, + yLowKey, + yHighKey + }; + } + makeItemStylerParams(itemId) { + const { xKey, yLowKey, yHighKey } = this.properties; + return { xKey, yLowKey, yHighKey, itemId }; + } + getTooltipContent(datumIndex, removeThisDatum) { + const itemId = removeThisDatum?.itemId ?? "high"; + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { xName, yName, yLowKey, yLowName, xKey, yHighKey, yHighName, tooltip, legendItemName } = properties; + const xAxis = axes[ChartAxisDirection10.X]; + const yAxis = axes[ChartAxisDirection10.Y]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yHighValue = dataModel.resolveColumnById(this, `yHighValue`, processedData)[datumIndex]; + const yLowValue = dataModel.resolveColumnById(this, `yLowValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(itemId); + const format = this.getMarkerStyle( + this.properties.item[itemId].marker, + { datumIndex, datum }, + params, + { isHighlight: false, resolveMarkerSubPath: ["item", itemId, "marker"] }, + stylerStyle.item[itemId].marker + ); + const value = `${this.getAxisValueText(yAxis, "tooltip", yLowValue, datum, yLowKey, legendItemName)} - ${this.getAxisValueText(yAxis, "tooltip", yHighValue, datum, yHighKey, legendItemName)}`; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [{ label: yName, fallbackLabel: `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`, value }] + }, + { + seriesId, + datum, + title: yName, + itemId, + xName, + yName, + yLowKey, + yLowName, + xKey, + yHighKey, + yHighName, + legendItemName, + ...format + } + ); + } + legendItemSymbol() { + const { fill, topLevel } = this.getStyle(false); + const { stroke, strokeWidth, strokeOpacity, lineDash, marker } = topLevel; + const markerStyle = { + shape: marker.shape, + fill: marker.fill ?? fill, + stroke: marker.stroke ?? stroke, + fillOpacity: marker.fillOpacity, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }; + return { + marker: markerStyle, + line: { + stroke, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { yLowKey, yHighKey, yName, yLowName, yHighName, legendItemName, showInLegend } = this.properties; + const legendItemText = legendItemName ?? yName ?? `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`; + const itemId = `${yLowKey}-${yHighKey}`; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible, + label: { text: `${legendItemText}` }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + isLabelEnabled() { + return this.properties.label.enabled; + } + onDataChange() { + } + nodeFactory() { + return new Marker(); + } + animateEmptyUpdateReady(animationData) { + const { datumSelection, labelSelection, contextData, paths } = animationData; + const { animationManager } = this.ctx; + this.updateAreaPaths(paths, contextData); + pathSwipeInAnimation(this, animationManager, ...paths); + resetMotion([datumSelection], resetMarkerPositionFn); + markerSwipeScaleInAnimation(this, animationManager, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + } + animateReadyResize(animationData) { + const { contextData, paths } = animationData; + this.updateAreaPaths(paths, contextData); + super.animateReadyResize(animationData); + } + animateWaitingUpdateReady(animationData) { + const { animationManager } = this.ctx; + const { datumSelection, labelSelection, contextData, paths, previousContextData } = animationData; + const [fill, lowStroke, highStroke] = paths; + if (fill == null && lowStroke == null && highStroke == null) + return; + this.resetDatumAnimation(animationData); + this.resetLabelAnimation(animationData); + const update = () => { + this.resetPathAnimation(animationData); + this.updateAreaPaths(paths, contextData); + }; + const skip = () => { + animationManager.skipCurrentBatch(); + update(); + }; + if (contextData == null || previousContextData == null) { + update(); + markerFadeInAnimation(this, animationManager, "added", datumSelection); + pathFadeInAnimation(this, "fill_path_properties", animationManager, "add", fill); + pathFadeInAnimation(this, "low_stroke_path_properties", animationManager, "add", lowStroke); + pathFadeInAnimation(this, "high_stroke_path_properties", animationManager, "add", highStroke); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + return; + } + const fns = prepareRangeAreaPathAnimation( + contextData, + previousContextData, + this.processedData?.reduced?.diff?.[this.id] + ); + if (fns === void 0) { + skip(); + return; + } else if (fns.status === "no-op") { + return; + } + fromToMotion(this.id, "fill_path_properties", animationManager, [fill], fns.fill.pathProperties); + fromToMotion(this.id, "low_stroke_path_properties", animationManager, [lowStroke], fns.stroke.pathProperties); + fromToMotion(this.id, "high_stroke_path_properties", animationManager, [highStroke], fns.stroke.pathProperties); + if (fns.status === "added") { + this.updateAreaPaths(paths, contextData); + } else if (fns.status === "removed") { + this.updateAreaPaths(paths, previousContextData); + } else { + pathMotion(this.id, "fill_path_update", animationManager, [fill], fns.fill.path); + pathMotion(this.id, "low_stroke_path_update", animationManager, [lowStroke], fns.stroke.path); + pathMotion(this.id, "high_stroke_path_update", animationManager, [highStroke], fns.stroke.path); + } + if (fns.hasMotion) { + markerFadeInAnimation(this, animationManager, void 0, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + } + this.ctx.animationManager.animate({ + id: this.id, + groupId: "reset_after_animation", + phase: "trailing", + from: {}, + to: {}, + onComplete: () => this.updateAreaPaths(paths, contextData) + }); + } + getFormattedMarkerStyle(datum) { + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(datum.itemId); + return this.getMarkerStyle( + this.properties.item[datum.itemId].marker, + datum, + params, + { isHighlight: true, resolveMarkerSubPath: ["item", datum.itemId, "marker"] }, + void 0, + stylerStyle + ); + } + getMarkerStyle(marker, datum, params, opts, defaultOverrideStyle, inheritedStyle) { + true; + marker.itemStyler = this.properties.marker.itemStyler; + return super.getMarkerStyle(marker, datum, params, opts, defaultOverrideStyle, inheritedStyle); + } + computeFocusBounds(opts) { + const hiBox = computeMarkerFocusBounds(this, opts); + const loBox = computeMarkerFocusBounds(this, { ...opts, datumIndex: opts.datumIndex + 1 }); + if (hiBox && loBox) { + return BBox5.merge([hiBox, loBox]); + } + return void 0; + } + isDatumEnabled(nodeData, datumIndex) { + return datumIndex % 2 === 0 && super.isDatumEnabled(nodeData, datumIndex); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RangeAreaSeries.className = "RangeAreaSeries"; +RangeAreaSeries.type = "range-area"; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaSeriesOptionsDef.ts +var import_ag_charts_community49 = require("ag-charts-community"); +var import_ag_charts_core17 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs5, rangeAreaSeriesThemeableOptionsDef } = import_ag_charts_community49._ModuleSupport; +var rangeAreaSeriesOptionsDef = { + ...commonSeriesOptionsDefs5, + ...rangeAreaSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core17.required)((0, import_ag_charts_core17.constant)("range-area")), + xKey: (0, import_ag_charts_core17.required)(import_ag_charts_core17.string), + yLowKey: (0, import_ag_charts_core17.required)(import_ag_charts_core17.string), + yHighKey: (0, import_ag_charts_core17.required)(import_ag_charts_core17.string), + xName: import_ag_charts_core17.string, + yName: import_ag_charts_core17.string, + yLowName: import_ag_charts_core17.string, + yHighName: import_ag_charts_core17.string, + legendItemName: import_ag_charts_core17.string, + segmentation: import_ag_charts_core17.shapeSegmentation, + invertedStyle: { + enabled: import_ag_charts_core17.boolean, + ...import_ag_charts_core17.fillOptionsDef + } +}; +rangeAreaSeriesOptionsDef.pickOutsideVisibleMinorAxis = (0, import_ag_charts_core17.undocumented)(import_ag_charts_core17.boolean); +rangeAreaSeriesOptionsDef.focusPriority = (0, import_ag_charts_core17.undocumented)(import_ag_charts_core17.number); + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaThemes.ts +var import_ag_charts_community50 = require("ag-charts-community"); +var RANGE_AREA_ITEM = { + lineDash: { + $path: "/series/$index/lineDash" + }, + lineDashOffset: { + $path: "/series/$index/lineDashOffset" + }, + stroke: { + $path: ["/series/$index/stroke", { $palette: "stroke" }] + }, + strokeOpacity: { + $path: "/series/$index/strokeOpacity" + }, + strokeWidth: { + $path: ["/series/$index/strokeWidth", 1] + }, + marker: { + enabled: { + $path: "/series/$index/marker/enabled" + }, + fill: { + $isUserOption: [ + "/series/$index/marker/fill", + { + $if: [ + { + $or: [ + { $isGradient: { $path: "/series/$index/marker/fill" } }, + { $isImage: { $path: "/series/$index/marker/fill" } }, + { $isPattern: { $path: "/series/$index/marker/fill" } } + ] + }, + { + $merge: [ + { $path: "/series/$index/marker/fill" }, + { + $applySwitch: [ + { $path: "type" }, + void 0, + // default case shouldn't be hit because of $if + ["gradient", import_ag_charts_community50._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", import_ag_charts_community50._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community50._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + } + ] + }, + { + $isUserOption: [ + "/series/$index/marker/fill", + { $path: "/series/$index/marker/fill" }, + { $palette: "fill" } + ] + } + ] + }, + { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community50._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", import_ag_charts_community50._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community50._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + } + ] + }, + fillOpacity: { + $path: "/series/$index/marker/fillOpacity" + }, + lineDash: { + $path: "/series/$index/marker/lineDash" + }, + lineDashOffset: { + $path: "/series/$index/marker/lineDashOffset" + }, + shape: { + $path: "/series/$index/marker/shape" + }, + size: { + $path: ["/series/$index/marker/size", 6] + }, + stroke: { + $path: ["/series/$index/marker/stroke", { $palette: "stroke" }] + }, + strokeOpacity: { + $path: "/series/$index/marker/strokeOpacity" + }, + strokeWidth: { + $path: ["/series/$index/marker/strokeWidth", 2] + } + } +}; +var RANGE_AREA_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community50._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", import_ag_charts_community50._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: 0.7, + stroke: { $palette: "stroke" }, + strokeWidth: 1, + marker: { + enabled: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community50._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", import_ag_charts_community50._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community50._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + shape: "circle", + stroke: { $palette: "stroke" }, + size: 6, + strokeWidth: 2 + }, + nodeClickRange: "nearest", + item: { + low: RANGE_AREA_ITEM, + high: RANGE_AREA_ITEM + }, + label: { + ...import_ag_charts_community50._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + placement: "outside", + padding: { $isUserOption: ["./spacing", 0, 10] }, + // compatibility with old `padding` property (now named `spacing`). + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + interpolation: { + type: "linear" + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: import_ag_charts_community50._ModuleSupport.multiSeriesHighlightStyle(), + segmentation: import_ag_charts_community50._ModuleSupport.SEGMENTATION_DEFAULTS, + invertedStyle: { + enabled: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + // @todo(AG-14792) should be { $path: '../fill' } to inherit from series.fill + ["gradient", import_ag_charts_community50._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", import_ag_charts_community50._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community50._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: { $path: "../fillOpacity" } + } + }, + axes: { + [import_ag_charts_community50._ModuleSupport.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { enabled: true } + } + } +}; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE6, CARTESIAN_POSITION: CARTESIAN_POSITION4 } +} = import_ag_charts_community51._ModuleSupport; +var RangeAreaModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "range-area", + moduleFactory: (ctx) => new RangeAreaSeries(ctx), + predictAxis: import_ag_charts_community51._ModuleSupport.predictCartesianTimeAxis, + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE6.NUMBER, position: CARTESIAN_POSITION4.LEFT }, + { type: CARTESIAN_AXIS_TYPE6.CATEGORY, position: CARTESIAN_POSITION4.BOTTOM } + ], + themeTemplate: RANGE_AREA_SERIES_THEME +}; +var RangeAreaSeriesModule = { + type: "series", + name: "range-area", + chartType: "cartesian", + enterprise: true, + options: rangeAreaSeriesOptionsDef, + create: (ctx) => new RangeAreaSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarModule.ts +var import_ag_charts_community57 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeries.ts +var import_ag_charts_community54 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarAggregation.ts +var import_ag_charts_community52 = require("ag-charts-community"); +var { aggregationDomain: aggregationDomain3, aggregationRangeFittingPoints: aggregationRangeFittingPoints3, compactAggregationIndices: compactAggregationIndices3, createAggregationIndices: createAggregationIndices3 } = import_ag_charts_community52._ModuleSupport; +var AGGREGATION_THRESHOLD3 = 1e3; +function aggregateRangeBarData(scale, xValues, highValues, lowValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD3) + return; + const [d0, d1] = aggregationDomain3(scale, domain); + let maxRange = aggregationRangeFittingPoints3(xValues, d0, d1, { smallestKeyInterval }); + let { indexData, valueData } = createAggregationIndices3(xValues, highValues, lowValues, d0, d1, maxRange); + const filters = [{ maxRange, indexData }]; + while (maxRange > 64) { + ({ indexData, valueData, maxRange } = compactAggregationIndices3(indexData, valueData, maxRange)); + filters.push({ maxRange, indexData }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarProperties.ts +var import_ag_charts_community53 = require("ag-charts-community"); +var { AbstractBarSeriesProperties: AbstractBarSeriesProperties3, makeSeriesTooltip: makeSeriesTooltip6, Property: Property18, DropShadow: DropShadow2, Label: Label2 } = import_ag_charts_community53._ModuleSupport; +var RangeBarSeriesLabel = class extends Label2 { + constructor() { + super(...arguments); + this.placement = "inside"; + this.spacing = 0; + } +}; +__decorateClass([ + Property18 +], RangeBarSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property18 +], RangeBarSeriesLabel.prototype, "spacing", 2); +var RangeBarProperties = class extends AbstractBarSeriesProperties3 { + constructor() { + super(...arguments); + this.fill = "#99CCFF"; + this.fillOpacity = 1; + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.shadow = new DropShadow2().set({ enabled: false }); + this.label = new RangeBarSeriesLabel(); + this.tooltip = makeSeriesTooltip6(); + } +}; +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "xKey", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "yLowKey", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "yHighKey", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "xName", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "yName", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "yLowName", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "yHighName", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "styler", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "shadow", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "label", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode4, + valueProperty: valueProperty5, + keyProperty: keyProperty4, + ChartAxisDirection: ChartAxisDirection11, + checkCrisp, + updateLabelNode: updateLabelNode3, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL3, + LARGEST_KEY_INTERVAL, + diff: diff4, + prepareBarAnimationFunctions, + midpointStartingBarPosition, + resetBarSelectionsFn, + fixNumericExtent: fixNumericExtent4, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation2, + resetLabelFn: resetLabelFn2, + animationValidation: animationValidation4, + computeBarFocusBounds: computeBarFocusBounds4, + visibleRangeIndices: visibleRangeIndices2, + createDatumId: createDatumId4, + ContinuousScale: ContinuousScale3, + Rect: Rect2, + PointerEvents: PointerEvents3, + motion: motion2, + applyShapeStyle: applyShapeStyle5, + findMinMax: findMinMax3, + areScalingEqual: areScalingEqual2, + processedDataIsAnimatable: processedDataIsAnimatable3, + AGGREGATION_SPAN: AGGREGATION_SPAN2, + AGGREGATION_INDEX_X_MAX: AGGREGATION_INDEX_X_MAX2, + AGGREGATION_INDEX_X_MIN: AGGREGATION_INDEX_X_MIN2, + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX3, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN3, + mergeDefaults: mergeDefaults6, + simpleMemorize2: simpleMemorize23, + getItemStyles: getItemStyles2, + calculateSegments: calculateSegments3, + toHighlightString: toHighlightString3, + HighlightState: HighlightState3 +} = import_ag_charts_community54._ModuleSupport; +var memoizedAggregateRangeBarData = simpleMemorize23(aggregateRangeBarData); +var RangeBarSeriesNodeEvent = class extends import_ag_charts_community54._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yLowKey = series.properties.yLowKey; + this.yHighKey = series.properties.yHighKey; + } +}; +var RangeBarSeries = class extends import_ag_charts_community54._ModuleSupport.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode4.AXIS_ALIGNED, SeriesNodePickMode4.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["yLowKey", "yHighKey"] + }, + propertyNames: { + x: ["xName"], + y: ["yLowName", "yHighName", "yName"] + }, + categoryKey: "xValue", + datumSelectionGarbageCollection: false, + animationResetFns: { + datum: resetBarSelectionsFn, + label: resetLabelFn2 + } + }); + this.properties = new RangeBarProperties(); + this.dataAggregationFilters = void 0; + this.NodeEvent = RangeBarSeriesNodeEvent; + } + async processData(dataController) { + const { xKey, yLowKey, yHighKey } = this.properties; + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + if (this.processedData) { + extraProps.push(diff4(this.id, this.processedData)); + } + extraProps.push(animationValidation4()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty4(xKey, xScaleType, { id: "xValue" }), + valueProperty5(yLowKey, yScaleType, { id: `yLowValue`, invalidValue: null, ...visibleProps }), + valueProperty5(yHighKey, yScaleType, { id: `yHighValue`, invalidValue: null, ...visibleProps }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL3, LARGEST_KEY_INTERVAL] : [], + ...extraProps + ], + groupByKeys: false + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable3(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection11.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateRangeBarData( + xAxis.scale.type, + xValues, + yHighValues, + yLowValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys] + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } else { + const yExtent = this.domainForClippedRange(direction, ["yHighValue", "yLowValue"], "xValue"); + const fixedYExtent = findMinMax3(yExtent); + return fixNumericExtent4(fixedYExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection11.Y, ["yHighValue", "yLowValue"], "xValue", visibleRange); + } + createNodeData() { + const { data, dataModel, groupScale, processedData, visible } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(data && xAxis && yAxis && dataModel && processedData?.dataSources && this.chart?.seriesRect)) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection11.X; + const { xKey, yLowKey, yHighKey, strokeWidth } = this.properties; + const itemId = `${yLowKey}-${yHighKey}`; + const segments = calculateSegments3( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + const context = { + itemId, + nodeData: [], + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStyles2(this.getItemStyle.bind(this)), + segments + }; + if (!visible) + return context; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const { barWidth: effectiveBarWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale3.is(xScale) ? effectiveBarWidth * -0.5 : 0; + const groupOffset = groupScale.convert(String(groupIndex)); + const defaultCrisp = checkCrisp( + xAxis?.scale, + xAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + const xPosition = (datumIndex) => Math.round(xScale.convert(xValues[datumIndex])) + groupOffset + barOffset; + const handleDatum = (datumIndex, groupedDataIndex, x, width, yLow, yHigh, crisp) => { + const datum = rawData[datumIndex]; + const xDatum = xValues[datumIndex]; + if (xDatum == null) + return; + const rawLowValue = yLowValues[datumIndex]; + const rawHighValue = yHighValues[datumIndex]; + if (!Number.isFinite(rawLowValue?.valueOf()) || !Number.isFinite(rawHighValue?.valueOf())) + return; + const [yLowValue, yHighValue] = rawLowValue < rawHighValue ? [rawLowValue, rawHighValue] : [rawHighValue, rawLowValue]; + const y = Math.round(yScale.convert(yHigh)); + const bottomY = Math.round(yScale.convert(yLow)); + const height = Math.max(strokeWidth, Math.abs(bottomY - y)); + const rect = { + x: barAlongX ? Math.min(y, bottomY) : x, + y: barAlongX ? x : Math.min(y, bottomY), + width: barAlongX ? height : width, + height: barAlongX ? width : height + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const labelData = this.createLabelData({ + datumIndex, + rect, + barAlongX, + yLowValue, + yHighValue, + datum, + series: this + }); + const nodeDatum = { + index: groupedDataIndex, + series: this, + itemId, + datum, + datumIndex, + xValue: xDatum, + yLowValue: rawLowValue, + yHighValue: rawHighValue, + yLowKey, + yHighKey, + xKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + labels: labelData + }; + context.nodeData.push(nodeDatum); + context.labelData.push(...labelData); + }; + const { dataAggregationFilters } = this; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + if (dataAggregationFilter != null) { + const { maxRange, indexData } = dataAggregationFilter; + const [start, end] = visibleRangeIndices2(1, maxRange, xAxis.range, (index) => { + const aggIndex = index * AGGREGATION_SPAN2; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN2]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX2]; + if (xMinIndex === -1) + return; + const midDatumIndex = Math.trunc((xMinIndex + xMaxIndex) / 2); + return [xPosition(midDatumIndex), xPosition(xMaxIndex) + effectiveBarWidth]; + }); + for (let i = start; i < end; i += 1) { + const aggIndex = i * AGGREGATION_SPAN2; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN2]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX2]; + const yMinIndex = indexData[aggIndex + AGGREGATION_INDEX_Y_MIN3]; + const yMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_Y_MAX3]; + if (xMinIndex === -1) + continue; + const midDatumIndex = Math.trunc((xMinIndex + xMaxIndex) / 2); + const xValue2 = xValues[midDatumIndex]; + if (xValue2 == null) + continue; + const x = xPosition(midDatumIndex); + const width = Math.abs(xPosition(xMinIndex) - xPosition(xMaxIndex)) + effectiveBarWidth; + const yLow = yLowValues[yMinIndex]; + const yHigh = yHighValues[yMaxIndex]; + handleDatum(midDatumIndex, 0, x, width, yLow, yHigh, false); + } + } else if (processedData.type === "ungrouped") { + const invalidData = processedData.invalidData?.get(this.id); + let [start, end] = this.visibleRangeIndices("xValue", xAxis.range); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let datumIndex = start; datumIndex < end; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const x = xPosition(datumIndex); + const width = effectiveBarWidth; + const yLow = yLowValues[datumIndex]; + const yHigh = yHighValues[datumIndex]; + handleDatum(datumIndex, 0, x, width, yLow, yHigh, defaultCrisp); + } + } else { + for (const { datumIndex, groupIndex: groupDataIndex } of dataModel.forEachGroupDatum(this, processedData)) { + const x = xPosition(datumIndex); + const width = effectiveBarWidth; + const yLow = yLowValues[datumIndex]; + const yHigh = yHighValues[datumIndex]; + handleDatum(datumIndex, groupDataIndex, x, width, yLow, yHigh, defaultCrisp); + } + } + return context; + } + createLabelData({ + datumIndex, + rect, + barAlongX, + yLowValue, + yHighValue, + datum, + series + }) { + const { xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName, label } = this.properties; + const labelParams = { datum, xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName }; + const { placement } = label; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + const paddingDirection = placement === "outside" ? 1 : -1; + const labelPadding = spacing * paddingDirection; + const yDomain = this.getSeriesDomain(ChartAxisDirection11.Y); + const yLowLabel = { + datumIndex, + x: rect.x + (barAlongX ? -labelPadding : rect.width / 2), + y: rect.y + (barAlongX ? rect.height / 2 : rect.height + labelPadding), + textAlign: barAlongX ? "left" : "center", + textBaseline: barAlongX ? "middle" : "bottom", + text: this.getLabelText( + yLowValue, + datum, + yLowKey, + "y", + yDomain, + label, + { itemId: "low", value: yLowValue, ...labelParams } + ), + itemId: "low", + datum, + series + }; + const yHighLabel = { + datumIndex, + x: rect.x + (barAlongX ? rect.width + labelPadding : rect.width / 2), + y: rect.y + (barAlongX ? rect.height / 2 : -labelPadding), + textAlign: barAlongX ? "right" : "center", + textBaseline: barAlongX ? "middle" : "top", + text: this.getLabelText( + yHighValue, + datum, + yHighKey, + "y", + yDomain, + label, + { itemId: "high", value: yHighValue, ...labelParams } + ), + itemId: "high", + datum, + series + }; + if (placement === "outside") { + yLowLabel.textAlign = barAlongX ? "right" : "center"; + yLowLabel.textBaseline = barAlongX ? "middle" : "top"; + yHighLabel.textAlign = barAlongX ? "left" : "center"; + yHighLabel.textBaseline = barAlongX ? "middle" : "bottom"; + } + return [yLowLabel, yHighLabel]; + } + nodeFactory() { + return new Rect2(); + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke, + strokeOpacity, + strokeWidth, + styler + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth + }; + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke, + strokeOpacity, + strokeWidth, + xKey, + yLowKey, + yHighKey + } = this.properties; + const highlightState = toHighlightString3(highlightStateEnum ?? HighlightState3.None); + return { + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + seriesId, + stroke, + strokeOpacity, + strokeWidth, + xKey, + yLowKey, + yHighKey + }; + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data, void 0, (datum) => this.getDatumId(datum)); + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style = mergeDefaults6(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId4(this.getDatumId({ xValue: xValue2 }), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults6(overrides, style); + } + } + return style; + } + makeItemStylerParams(datumIndex, isHighlight, style) { + const { id: seriesId, properties, processedData } = this; + const { xKey, yHighKey, yLowKey } = properties; + const datum = processedData.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + yHighKey, + yLowKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles(opts) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + opts.datumSelection.each((node, datum) => { + if (!opts.datumSelection.isGarbage(node)) { + const highlightState = this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex); + datum.style = this.getItemStyle(datum.datumIndex, opts.isHighlight, highlightState); + } + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection11.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle5(rect, style, fillBBox); + rect.cornerRadius = style.cornerRadius ?? 0; + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + }); + } + updateLabelSelection(opts) { + const labelData = this.properties.label.enabled ? opts.labelData : []; + return opts.labelSelection.update(labelData, (text) => { + text.pointerEvents = PointerEvents3.None; + }); + } + updateLabelNodes(opts) { + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yName: this.properties.yName, + yLowKey: this.properties.yLowKey, + yLowName: this.properties.yLowName ?? this.properties.yLowKey, + yHighKey: this.properties.yHighKey, + yHighName: this.properties.yHighName ?? this.properties.yHighKey, + legendItemName: this.properties.legendItemName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum?.datumIndex).opacity ?? 1; + updateLabelNode3(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yName, yLowKey, yHighKey, yLowName, yHighName, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yHighValue = dataModel.resolveColumnById(this, `yHighValue`, processedData)[datumIndex]; + const yLowValue = dataModel.resolveColumnById(this, `yLowValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + const value = `${this.getAxisValueText(yAxis, "tooltip", yLowValue, datum, yLowKey, legendItemName)} - ${this.getAxisValueText(yAxis, "tooltip", yHighValue, datum, yHighKey, legendItemName)}`; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [{ label: yName, fallbackLabel: `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`, value }] + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yName, + yLowKey, + yHighKey, + yLowName, + yHighName, + legendItemName, + ...format + } + ); + } + legendItemSymbol() { + const { fill, stroke, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + HighlightState3.None + ); + return { + marker: { + fill, + stroke, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { yName, yLowName, yHighName, yLowKey, yHighKey, legendItemName, showInLegend } = this.properties; + const legendItemText = legendItemName ?? yName ?? `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`; + const itemId = `${yLowKey}-${yHighKey}`; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible, + label: { text: `${legendItemText}` }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + animateEmptyUpdateReady({ datumSelection, labelSelection }) { + const fns = prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(), "normal"), "unknown"); + motion2.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation2(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const { datumSelection: datumSelections, labelSelection, contextData, previousContextData } = data; + const dataDiff = import_ag_charts_community54._ModuleSupport.calculateDataDiff( + this.id, + datumSelections, + this.getDatumId.bind(this), + contextData, + previousContextData, + this.processedData, + this.processedDataUpdated + ); + this.ctx.animationManager.stopByAnimationGroupId(this.id); + const mode = previousContextData == null ? "fade" : "normal"; + const fns = prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(), mode), "added"); + motion2.fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [datumSelections], + fns, + (_, datum) => this.getDatumId(datum), + dataDiff + ); + if (dataDiff?.changed || !areScalingEqual2(contextData.groupScale, previousContextData?.groupScale)) { + seriesLabelFadeInAnimation2(this, "labels", this.ctx.animationManager, labelSelection); + } + } + getDatumId(datum) { + return `${datum.xValue}`; + } + isLabelEnabled() { + return this.properties.label.enabled; + } + onDataChange() { + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds4(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RangeBarSeries.className = "RangeBarSeries"; +RangeBarSeries.type = "range-bar"; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeriesOptionsDef.ts +var import_ag_charts_community55 = require("ag-charts-community"); +var import_ag_charts_core18 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs6, rangeBarSeriesThemeableOptionsDef } = import_ag_charts_community55._ModuleSupport; +var rangeBarSeriesOptionsDef = { + ...commonSeriesOptionsDefs6, + ...rangeBarSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core18.required)((0, import_ag_charts_core18.constant)("range-bar")), + xKey: (0, import_ag_charts_core18.required)(import_ag_charts_core18.string), + yLowKey: (0, import_ag_charts_core18.required)(import_ag_charts_core18.string), + yHighKey: (0, import_ag_charts_core18.required)(import_ag_charts_core18.string), + xName: import_ag_charts_core18.string, + yName: import_ag_charts_core18.string, + yLowName: import_ag_charts_core18.string, + yHighName: import_ag_charts_core18.string, + legendItemName: import_ag_charts_core18.string, + segmentation: import_ag_charts_core18.shapeSegmentation +}; +rangeBarSeriesOptionsDef.pickOutsideVisibleMinorAxis = (0, import_ag_charts_core18.undocumented)(import_ag_charts_core18.boolean); +rangeBarSeriesOptionsDef.focusPriority = (0, import_ag_charts_core18.undocumented)(import_ag_charts_core18.number); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarThemes.ts +var import_ag_charts_community56 = require("ag-charts-community"); +var RANGE_BAR_SERIES_THEME = { + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community56._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", import_ag_charts_community56._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community56._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + ...import_ag_charts_community56._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + placement: "inside", + padding: { $isUserOption: ["./spacing", 0, 6] } + // compatibility with old `padding` property (now named `spacing`). + }, + highlight: import_ag_charts_community56._ModuleSupport.multiSeriesHighlightStyle(), + segmentation: import_ag_charts_community56._ModuleSupport.SEGMENTATION_DEFAULTS + }, + axes: { + [import_ag_charts_community56._ModuleSupport.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { enabled: true } + } + } +}; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarModule.ts +var RangeBarModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "range-bar", + moduleFactory: (ctx) => new RangeBarSeries(ctx), + predictAxis: import_ag_charts_community57._ModuleSupport.predictCartesianTimeAxis, + defaultAxes: import_ag_charts_community57._ModuleSupport.DIRECTION_SWAP_AXES, + themeTemplate: RANGE_BAR_SERIES_THEME, + groupable: true +}; +var RangeBarSeriesModule = { + type: "series", + name: "range-bar", + chartType: "cartesian", + enterprise: true, + options: rangeBarSeriesOptionsDef, + create: (ctx) => new RangeBarSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallModule.ts +var import_ag_charts_community62 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeries.ts +var import_ag_charts_community59 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeriesProperties.ts +var import_ag_charts_community58 = require("ag-charts-community"); +var { AbstractBarSeriesProperties: AbstractBarSeriesProperties4, BaseProperties: BaseProperties6, PropertiesArray, makeSeriesTooltip: makeSeriesTooltip7, Property: Property19, DropShadow: DropShadow3, Label: Label3 } = import_ag_charts_community58._ModuleSupport; +var WaterfallSeriesTotal = class extends BaseProperties6 { +}; +__decorateClass([ + Property19 +], WaterfallSeriesTotal.prototype, "totalType", 2); +__decorateClass([ + Property19 +], WaterfallSeriesTotal.prototype, "index", 2); +__decorateClass([ + Property19 +], WaterfallSeriesTotal.prototype, "axisLabel", 2); +var WaterfallSeriesItemTooltip = class extends BaseProperties6 { +}; +__decorateClass([ + Property19 +], WaterfallSeriesItemTooltip.prototype, "renderer", 2); +var WaterfallSeriesLabel = class extends Label3 { + constructor() { + super(...arguments); + this.placement = "outside-end"; + this.spacing = 0; + } +}; +__decorateClass([ + Property19 +], WaterfallSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property19 +], WaterfallSeriesLabel.prototype, "spacing", 2); +var WaterfallSeriesItem = class extends BaseProperties6 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.stroke = "#c16068"; + this.fillOpacity = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.cornerRadius = 0; + this.shadow = new DropShadow3().set({ enabled: false }); + this.label = new WaterfallSeriesLabel(); + this.tooltip = new WaterfallSeriesItemTooltip(); + } +}; +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "name", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "fill", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "fillOpacity", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "lineDashOffset", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "cornerRadius", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "itemStyler", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "shadow", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "label", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "tooltip", 2); +var WaterfallSeriesConnectorLine = class extends BaseProperties6 { + constructor() { + super(...arguments); + this.enabled = true; + this.stroke = "black"; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.strokeWidth = 2; + } +}; +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "enabled", 2); +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "stroke", 2); +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "strokeOpacity", 2); +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "lineDash", 2); +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "lineDashOffset", 2); +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "strokeWidth", 2); +var WaterfallSeriesItems = class extends BaseProperties6 { + constructor() { + super(...arguments); + this.positive = new WaterfallSeriesItem(); + this.negative = new WaterfallSeriesItem(); + this.total = new WaterfallSeriesItem(); + } +}; +__decorateClass([ + Property19 +], WaterfallSeriesItems.prototype, "positive", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItems.prototype, "negative", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItems.prototype, "total", 2); +var WaterfallSeriesProperties = class extends AbstractBarSeriesProperties4 { + constructor() { + super(...arguments); + this.item = new WaterfallSeriesItems(); + this.totals = new PropertiesArray(WaterfallSeriesTotal); + this.line = new WaterfallSeriesConnectorLine(); + this.tooltip = makeSeriesTooltip7(); + } + getStyle(itemId) { + const { fillOpacity, strokeWidth, strokeOpacity, fill, stroke, lineDash, lineDashOffset, cornerRadius } = this.item[itemId === "subtotal" ? "total" : itemId]; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "totals", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "line", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeries.ts +var { + adjustLabelPlacement, + SeriesNodePickMode: SeriesNodePickMode5, + fixNumericExtent: fixNumericExtent5, + valueProperty: valueProperty6, + keyProperty: keyProperty5, + accumulativeValueProperty, + trailingAccumulatedValueProperty, + ChartAxisDirection: ChartAxisDirection12, + createDatumId: createDatumId5, + checkCrisp: checkCrisp2, + updateLabelNode: updateLabelNode4, + prepareBarAnimationFunctions: prepareBarAnimationFunctions2, + collapsedStartingBarPosition, + resetBarSelectionsFn: resetBarSelectionsFn2, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation3, + resetLabelFn: resetLabelFn3, + animationValidation: animationValidation5, + DEFAULT_CARTESIAN_DIRECTION_KEYS: DEFAULT_CARTESIAN_DIRECTION_KEYS2, + DEFAULT_CARTESIAN_DIRECTION_NAMES: DEFAULT_CARTESIAN_DIRECTION_NAMES2, + computeBarFocusBounds: computeBarFocusBounds5, + isContinuous, + Rect: Rect3, + motion: motion3, + applyShapeStyle: applyShapeStyle6, + mergeDefaults: mergeDefaults7, + getItemStylesPerItemId: getItemStylesPerItemId2, + DataSet +} = import_ag_charts_community59._ModuleSupport; +var WaterfallSeries = class extends import_ag_charts_community59._ModuleSupport.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: DEFAULT_CARTESIAN_DIRECTION_KEYS2, + propertyNames: DEFAULT_CARTESIAN_DIRECTION_NAMES2, + categoryKey: void 0, + pickModes: [SeriesNodePickMode5.NEAREST_NODE, SeriesNodePickMode5.EXACT_SHAPE_MATCH], + pathsPerSeries: ["connector"], + pathsZIndexSubOrderOffset: [-1, -1], + animationResetFns: { + datum: resetBarSelectionsFn2, + label: resetLabelFn3 + } + }); + this.properties = new WaterfallSeriesProperties(); + this.seriesItemTypes = /* @__PURE__ */ new Set(["positive", "negative", "total"]); + } + async processData(dataController) { + const { xKey, yKey, totals } = this.properties; + const { data } = this; + if (!this.visible) + return; + const positiveNumber3 = (v) => isContinuous(v) && Number(v) >= 0; + const negativeNumber = (v) => isContinuous(v) && Number(v) >= 0; + const totalTypeValue = (v) => v === "total" || v === "subtotal"; + const propertyDefinition = { missingValue: void 0, invalidValue: void 0 }; + const dataWithTotals = []; + const totalsMap = totals.reduce((result, total) => { + const totalsAtIndex = result.get(total.index); + if (totalsAtIndex) { + totalsAtIndex.push(total); + } else { + result.set(total.index, [total]); + } + return result; + }, /* @__PURE__ */ new Map()); + for (const [i, datum] of data?.data.entries() ?? []) { + dataWithTotals.push(datum); + const totalsAtIndex = totalsMap.get(i); + if (totalsAtIndex) { + for (const total of totalsAtIndex) { + dataWithTotals.push({ ...total.toJson(), [xKey]: total.axisLabel }); + } + } + } + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + extraProps.push(animationValidation5()); + } + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const { processedData } = await this.requestDataModel( + dataController, + DataSet.wrap(dataWithTotals), + { + props: [ + keyProperty5(xKey, xScaleType, { id: `xValue` }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrent` + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + missingValue: 0, + id: `yCurrentTotal` + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrentPositive`, + validation: positiveNumber3 + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrentNegative`, + validation: negativeNumber + }), + trailingAccumulatedValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yPrevious` + }), + valueProperty6(yKey, yScaleType, { id: `yRaw` }), + // Raw value pass-through. + valueProperty6("totalType", "category", { + id: `totalTypeValue`, + missingValue: void 0, + validation: totalTypeValue + }), + ...isContinuousX ? [import_ag_charts_community59._ModuleSupport.SMALLEST_KEY_INTERVAL, import_ag_charts_community59._ModuleSupport.LARGEST_KEY_INTERVAL] : [], + ...extraProps + ] + } + ); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.updateSeriesItemTypes(); + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys], + values + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + return keys; + } + const isDirectionY = direction === ChartAxisDirection12.Y; + const isReversed = this.getCategoryAxis().isReversed(); + return this.padBandExtent(keys, isReversed !== isDirectionY); + } else { + const yCurrIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrent"); + const yExtent = values[yCurrIndex]; + const fixedYExtent = [Math.min(0, yExtent[0]), Math.max(0, yExtent[1])]; + return fixNumericExtent5(fixedYExtent); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { data, dataModel, processedData } = this; + const categoryAxis = this.getCategoryAxis(); + const valueAxis = this.getValueAxis(); + if (!data || !categoryAxis || !valueAxis || !dataModel || !processedData) { + return; + } + const { line } = this.properties; + const xScale = categoryAxis.scale; + const yScale = valueAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection12.X; + const barWidth = this.getBandwidth(categoryAxis) ?? 10; + const categoryAxisReversed = categoryAxis.isReversed(); + const valueAxisReversed = valueAxis.isReversed(); + if (processedData.type !== "ungrouped") + return; + const context = { + itemId: this.properties.yKey, + nodeData: [], + labelData: [], + pointData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStylesPerItemId2(this.getItemStyle.bind(this), "total", "subtotal", "positive", "negative") + }; + if (!this.visible) + return context; + const pointData = []; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yRawValues = dataModel.resolveColumnById(this, `yRaw`, processedData); + const totalTypeValues = dataModel.resolveColumnById( + this, + `totalTypeValue`, + processedData + ); + const yCurrValues = dataModel.resolveColumnById(this, "yCurrent", processedData); + const yPrevValues = dataModel.resolveColumnById(this, "yPrevious", processedData); + const yCurrTotalValues = dataModel.resolveColumnById(this, "yCurrentTotal", processedData); + const yDomain = this.getSeriesDomain(ChartAxisDirection12.Y); + const crisp = checkCrisp2( + categoryAxis?.scale, + categoryAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + function getValues(isTotal, isSubtotal, datumIndex) { + if (isTotal || isSubtotal) { + return { + cumulativeValue: yCurrTotalValues[datumIndex], + trailingValue: isSubtotal ? trailingSubtotal : 0 + }; + } + return { + cumulativeValue: yCurrValues[datumIndex], + trailingValue: yPrevValues[datumIndex] + }; + } + function getValue(isTotal, isSubtotal, rawValue, cumulativeValue, trailingValue) { + if (isTotal) { + return cumulativeValue; + } + if (isSubtotal) { + return (cumulativeValue ?? 0) - (trailingValue ?? 0); + } + return rawValue; + } + let trailingSubtotal = 0; + const { xKey, yKey, xName, yName } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const datumType = totalTypeValues[datumIndex]; + const isSubtotal = this.isSubtotal(datumType); + const isTotal = this.isTotal(datumType); + const isTotalOrSubtotal = isTotal || isSubtotal; + const xDatum = xValues[datumIndex]; + if (xDatum == null) + continue; + const x = Math.round(xScale.convert(xDatum)); + const rawValue = yRawValues[datumIndex]; + const { cumulativeValue, trailingValue } = getValues(isTotal, isSubtotal, datumIndex); + if (isTotalOrSubtotal) { + trailingSubtotal = cumulativeValue ?? 0; + } + const currY = Math.round(yScale.convert(cumulativeValue)); + const trailY = Math.round(yScale.convert(trailingValue)); + const value = getValue(isTotal, isSubtotal, rawValue, cumulativeValue, trailingValue); + const isPositive = (value ?? 0) >= 0; + const seriesItemType = this.getSeriesItemType(isPositive, datumType); + const { strokeWidth, label } = this.getItemConfig(seriesItemType); + const y = isPositive ? currY : trailY; + const bottomY = isPositive ? trailY : currY; + const barHeight = Math.max(strokeWidth, Math.abs(bottomY - y)); + const rect = { + x: barAlongX ? Math.min(y, bottomY) : x, + y: barAlongX ? x : Math.min(y, bottomY), + width: barAlongX ? barHeight : barWidth, + height: barAlongX ? barWidth : barHeight + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const pointY = isTotalOrSubtotal ? currY : trailY; + const pixelAlignmentOffset = Math.floor(line.strokeWidth) % 2 / 2; + const startY = categoryAxisReversed ? currY : pointY; + const stopY = categoryAxisReversed ? pointY : currY; + let startCoordinates; + let stopCoordinates; + if (barAlongX) { + startCoordinates = { + x: startY + pixelAlignmentOffset, + y: rect.y + }; + stopCoordinates = { + x: stopY + pixelAlignmentOffset, + y: rect.y + rect.height + }; + } else { + startCoordinates = { + x: rect.x, + y: startY + pixelAlignmentOffset + }; + stopCoordinates = { + x: rect.x + rect.width, + y: stopY + pixelAlignmentOffset + }; + } + const pathPoint = { + // lineTo + x: categoryAxisReversed ? stopCoordinates.x : startCoordinates.x, + y: categoryAxisReversed ? stopCoordinates.y : startCoordinates.y, + // moveTo + x2: categoryAxisReversed ? startCoordinates.x : stopCoordinates.x, + y2: categoryAxisReversed ? startCoordinates.y : stopCoordinates.y, + size: 0 + }; + pointData.push(pathPoint); + const itemId = seriesItemType === "subtotal" ? "total" : seriesItemType; + const labelText = this.getLabelText( + value, + datum, + yKey, + "y", + yDomain, + label, + { + itemId, + value, + datum, + xKey, + yKey, + xName, + yName + } + ); + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + const nodeDatum = { + index: datumIndex, + series: this, + itemId: seriesItemType, + datum, + datumIndex, + cumulativeValue: cumulativeValue ?? 0, + xValue: xDatum, + yValue: value, + yKey, + xKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + label: { + text: labelText, + ...adjustLabelPlacement({ + isUpward: (value ?? -1) >= 0 !== valueAxisReversed, + isVertical: !barAlongX, + placement: label.placement, + spacing, + rect + }) + } + }; + context.nodeData.push(nodeDatum); + context.labelData.push(nodeDatum); + } + const connectorLinesEnabled = this.properties.line.enabled; + if (yCurrValues != null && connectorLinesEnabled) { + context.pointData = pointData; + } + return context; + } + updateSeriesItemTypes() { + const { dataModel, seriesItemTypes, processedData } = this; + if (!dataModel || !processedData) { + return; + } + seriesItemTypes.clear(); + const yPositiveIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrentPositive"); + const yNegativeIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrentNegative"); + const totalTypeIndex = dataModel.resolveProcessedDataIndexById(this, `totalTypeValue`); + const positiveDomain = processedData.domain.values[yPositiveIndex] ?? []; + const negativeDomain = processedData.domain.values[yNegativeIndex] ?? []; + if (positiveDomain.length > 0) { + seriesItemTypes.add("positive"); + } + if (negativeDomain.length > 0) { + seriesItemTypes.add("negative"); + } + const itemTypes = processedData?.domain.values[totalTypeIndex]; + if (!itemTypes) { + return; + } + for (const type of itemTypes) { + if (type === "total" || type === "subtotal") { + seriesItemTypes.add("total"); + } + } + } + isSubtotal(datumType) { + return datumType === "subtotal"; + } + isTotal(datumType) { + return datumType === "total"; + } + nodeFactory() { + return new Rect3(); + } + getSeriesItemType(isPositive, datumType) { + return datumType ?? (isPositive ? "positive" : "negative"); + } + getItemConfig(seriesItemType) { + switch (seriesItemType) { + case "positive": { + return this.properties.item.positive; + } + case "negative": { + return this.properties.item.negative; + } + case "subtotal": + case "total": { + return this.properties.item.total; + } + } + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data); + } + getItemStyle(nodeDatum, isHighlight, highlightState, itemId = "total") { + const { properties } = this; + const { datumIndex = 0, datum } = nodeDatum ?? {}; + const propertyItemId = itemId === "subtotal" ? "total" : itemId; + const item = properties.item[propertyItemId]; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + const baseStyle = mergeDefaults7(highlightStyle, properties.getStyle(itemId)); + const { itemStyler } = item; + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId5(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(itemId, datumIndex, datum, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`, "item", propertyItemId], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults7(overrides, style); + } + } + return style; + } + makeItemStylerParams(itemId, datumIndex, datum, isHighlight, style) { + const { id: seriesId, properties } = this; + const { xKey, yKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + itemId, + datum, + xKey, + yKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection12.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle6(rect, style, fillBBox); + rect.cornerRadius = style.cornerRadius ?? 0; + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + if (labelData.length === 0) { + return labelSelection.update([]); + } + const data = labelData.filter((labelDatum) => { + const { label } = this.getItemConfig(labelDatum.itemId); + return label.enabled; + }); + return labelSelection.update(data); + } + updateLabelNodes(opts) { + const params = { + itemId: "positive", + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xName, + yKey: this.properties.yKey, + yName: this.properties.yName ?? this.properties.yName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + params.itemId = datum.itemId; + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex)?.opacity ?? 1; + const label = this.getItemConfig(datum.itemId).label; + updateLabelNode4(this, textNode, params, label, datum.label, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yKey, yName, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yRaw`, processedData)[datumIndex]; + const yCurrTotalValues = dataModel.resolveColumnById(this, "yCurrentTotal", processedData); + const totalTypeValues = dataModel.resolveColumnById( + this, + `totalTypeValue`, + processedData + ); + if (xValue2 == null) + return; + const datumType = totalTypeValues[datumIndex]; + const isPositive = (yValue ?? 0) >= 0; + const seriesItemType = this.getSeriesItemType(isPositive, datumType); + let total; + if (this.isTotal(datumType)) { + total = yCurrTotalValues[datumIndex]; + } else if (this.isSubtotal(datumType)) { + total = yCurrTotalValues[datumIndex]; + for (let previousIndex = datumIndex - 1; previousIndex >= 0; previousIndex -= 1) { + if (this.isSubtotal(totalTypeValues[previousIndex])) { + total = total - yCurrTotalValues[previousIndex]; + break; + } + } + } else { + total = yValue; + } + const nodeDatum = this.contextNodeData?.nodeData?.[datumIndex]; + const format = this.getItemStyle(nodeDatum, false, void 0, nodeDatum?.itemId); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(seriesItemType), + data: [ + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", total, datum, yKey, legendItemName) + } + ] + }, + { seriesId, datum, title: yName, itemId: seriesItemType, xKey, xName, yKey, yName, ...format } + ); + } + legendItemSymbol(item) { + const { fill, stroke, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.getItemConfig(item); + return { + marker: { + fill, + stroke, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id, seriesItemTypes } = this; + const legendData = []; + const capitalise = (text) => text.charAt(0).toUpperCase() + text.substring(1); + const { showInLegend } = this.properties; + for (const item of seriesItemTypes) { + const { name } = this.getItemConfig(item); + legendData.push({ + legendType: "category", + id, + itemId: item, + seriesId: id, + enabled: true, + label: { text: name ?? capitalise(item) }, + symbol: this.legendItemSymbol(item), + hideInLegend: !showInLegend, + isFixed: true + }); + } + return legendData; + } + toggleSeriesItem() { + } + animateEmptyUpdateReady(opts) { + const { datumSelection, labelSelection, contextData } = opts; + const fns = prepareBarAnimationFunctions2( + collapsedStartingBarPosition(this.isVertical(), this.axes, "normal"), + "unknown" + ); + motion3.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation3(this, "labels", this.ctx.animationManager, labelSelection); + const { pointData } = contextData; + if (!pointData) + return; + if (this.isVertical()) { + this.animateConnectorLinesVertical(opts); + } else { + this.animateConnectorLinesHorizontal(opts); + } + } + animateConnectorLinesHorizontal(opts) { + const { pointData = [] } = opts.contextData; + const [lineNode] = opts.paths; + const { path: linePath } = lineNode; + this.updateLineNode(lineNode); + const valueAxis = this.getValueAxis(); + const valueAxisReversed = valueAxis?.isReversed(); + const compare = valueAxisReversed ? (v, v2) => v < v2 : (v, v2) => v > v2; + const startX = valueAxis?.scale.convert(0); + const endX = pointData.reduce( + (end, point) => { + if (compare(point.x, end)) { + end = point.x; + } + return end; + }, + valueAxisReversed ? Infinity : 0 + ); + const scale = (value, start1, end1, start2, end2) => { + return (value - start1) / (end1 - start1) * (end2 - start2) + start2; + }; + this.ctx.animationManager.animate({ + id: `${this.id}_connectors`, + groupId: this.id, + phase: "initial", + from: startX, + to: endX, + ease: import_ag_charts_community59._ModuleSupport.Motion.easeOut, + collapsable: false, + onUpdate(pointX) { + linePath.clear(true); + for (const [index, point] of pointData.entries()) { + const x = scale(pointX, startX, endX, startX, point.x); + const x2 = scale(pointX, startX, endX, startX, point.x2); + if (index !== 0) { + linePath.lineTo(x, point.y); + } + linePath.moveTo(x2, point.y2); + } + lineNode.checkPathDirty(); + }, + onStop: () => this.resetConnectorLinesPath(opts) + }); + } + animateConnectorLinesVertical(opts) { + const { pointData = [] } = opts.contextData; + const [lineNode] = opts.paths; + const { path: linePath } = lineNode; + this.updateLineNode(lineNode); + const valueAxis = this.getValueAxis(); + const valueAxisReversed = valueAxis?.isReversed(); + const compare = valueAxisReversed ? (v, v2) => v > v2 : (v, v2) => v < v2; + const startY = valueAxis?.scale.convert(0); + const endY = pointData.reduce( + (end, point) => { + if (compare(point.y, end)) { + end = point.y; + } + return end; + }, + valueAxisReversed ? 0 : Infinity + ); + const scale = (value, start1, end1, start2, end2) => { + return (value - start1) / (end1 - start1) * (end2 - start2) + start2; + }; + this.ctx.animationManager.animate({ + id: `${this.id}_connectors`, + groupId: this.id, + phase: "initial", + from: startY, + to: endY, + ease: import_ag_charts_community59._ModuleSupport.Motion.easeOut, + collapsable: false, + onUpdate(pointY) { + linePath.clear(true); + for (const [index, point] of pointData.entries()) { + const y = scale(pointY, startY, endY, startY, point.y); + const y2 = scale(pointY, startY, endY, startY, point.y2); + if (index !== 0) { + linePath.lineTo(point.x, y); + } + linePath.moveTo(point.x2, y2); + } + lineNode.checkPathDirty(); + }, + onStop: () => this.resetConnectorLinesPath(opts) + }); + } + animateReadyResize(data) { + super.animateReadyResize(data); + this.resetConnectorLinesPath(data); + } + updatePaths(opts) { + this.resetConnectorLinesPath({ contextData: opts.contextData, paths: opts.paths }); + } + resetConnectorLinesPath({ + contextData, + paths + }) { + if (paths.length === 0) { + return; + } + const [lineNode] = paths; + this.updateLineNode(lineNode); + const { path: linePath } = lineNode; + linePath.clear(true); + const { pointData } = contextData; + if (!pointData) { + return; + } + for (const [index, point] of pointData.entries()) { + if (index !== 0) { + linePath.lineTo(point.x, point.y); + } + linePath.moveTo(point.x2, point.y2); + } + lineNode.checkPathDirty(); + } + updateLineNode(lineNode) { + const { stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this.properties.line; + lineNode.setProperties({ + fill: void 0, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + lineJoin: "round", + pointerEvents: import_ag_charts_community59._ModuleSupport.PointerEvents.None + }); + } + isLabelEnabled() { + const { positive, negative, total } = this.properties.item; + return positive.label.enabled || negative.label.enabled || total.label.enabled; + } + onDataChange() { + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds5(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + const { positive, negative, total } = this.properties.item; + return positive.itemStyler != null || positive.label.itemStyler != null || negative.itemStyler != null || negative.label.itemStyler != null || total.itemStyler != null || total.label.itemStyler != null; + } +}; +WaterfallSeries.className = "WaterfallSeries"; +WaterfallSeries.type = "waterfall"; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeriesOptionsDef.ts +var import_ag_charts_community60 = require("ag-charts-community"); +var import_ag_charts_core19 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs7, waterfallSeriesThemeableOptionsDef } = import_ag_charts_community60._ModuleSupport; +var waterfallSeriesOptionsDef = { + ...waterfallSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs7, + type: (0, import_ag_charts_core19.required)((0, import_ag_charts_core19.constant)("waterfall")), + xKey: (0, import_ag_charts_core19.required)(import_ag_charts_core19.string), + yKey: (0, import_ag_charts_core19.required)(import_ag_charts_core19.string), + xName: import_ag_charts_core19.string, + yName: import_ag_charts_core19.string, + totals: (0, import_ag_charts_core19.arrayOfDefs)( + { + totalType: (0, import_ag_charts_core19.required)((0, import_ag_charts_core19.union)("total", "subtotal")), + index: (0, import_ag_charts_core19.required)(import_ag_charts_core19.positiveNumber), + axisLabel: (0, import_ag_charts_core19.required)(import_ag_charts_core19.string) + }, + "a total definition options array" + ) +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallThemes.ts +var import_ag_charts_community61 = require("ag-charts-community"); +var { FILL_GRADIENT_LINEAR_KEYED_DEFAULTS: FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2, FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS3, FILL_PATTERN_KEYED_DEFAULTS: FILL_PATTERN_KEYED_DEFAULTS2 } = import_ag_charts_community61._ModuleSupport; +function itemTheme2(key, index) { + return { + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $path: [`/${index}`, { $palette: "fill" }, { $palette: "fills" }] }, + { $palette: `${key}.fill` } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2(key)], + ["image", FILL_IMAGE_DEFAULTS3], + ["pattern", FILL_PATTERN_KEYED_DEFAULTS2(key)] + ] + }, + stroke: { $palette: `${key}.stroke` }, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + ...import_ag_charts_community61._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + formatter: void 0, + placement: "outside-end", + padding: { $isUserOption: ["./spacing", 0, 6] } + // compatibility with old `padding` property (now named `spacing`). + } + }; +} +var WATERFALL_SERIES_THEME = { + series: { + item: { + positive: itemTheme2("altUp", 0), + negative: itemTheme2("altDown", 1), + total: itemTheme2("neutral", 2) + }, + line: { + stroke: { $palette: "neutral.stroke" }, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0, + strokeWidth: 2 + }, + highlight: import_ag_charts_community61._ModuleSupport.singleSeriesHighlightStyle() + }, + legend: { + enabled: true, + toggleSeries: false + } +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallModule.ts +var WaterfallModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "waterfall", + solo: true, + moduleFactory: (ctx) => new WaterfallSeries(ctx), + defaultAxes: import_ag_charts_community62._ModuleSupport.DIRECTION_SWAP_AXES, + themeTemplate: WATERFALL_SERIES_THEME +}; +var WaterfallSeriesModule = { + type: "series", + name: "waterfall", + chartType: "cartesian", + enterprise: true, + options: waterfallSeriesOptionsDef, + create: (ctx) => new WaterfallSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorOptionsDefs.ts +var { + NewAreaSeriesModule, + NewBarSeriesModule, + NewBubbleSeriesModule, + NewHistogramSeriesModule, + NewLineSeriesModule, + NewScatterSeriesModule, + numberFormatValidator, + textOrSegments, + without: without2 +} = import_ag_charts_community63._ModuleSupport; +var navigatorHandleOptionsDef = { + width: import_ag_charts_core20.positiveNumber, + height: import_ag_charts_core20.positiveNumber, + grip: import_ag_charts_core20.boolean, + fill: import_ag_charts_core20.color, + stroke: import_ag_charts_core20.color, + strokeWidth: import_ag_charts_core20.positiveNumber, + cornerRadius: import_ag_charts_core20.positiveNumber +}; +var commonIgnoredMiniChartProperties = [ + "cursor", + "highlightStyle", + "listeners", + "nodeClickRange", + "showInLegend", + "showInMiniChart", + "tooltip", + "visible", + "xName", + "yName" +]; +var barIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "label", + "legendItemName", + "direction" +]; +var boxPlotIngnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction", + "legendItemName", + "minName", + "q1Name", + "medianName", + "q3Name", + "maxName" +]; +var bubbleIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "title", + "label", + "labelKey", + "labelName", + "sizeName" +]; +var heatmapIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "title", + "label", + "colorName", + "textAlign", + "verticalAlign", + "itemPadding", + "colorRange" +]; +var histogramIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "label" +]; +var lineIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "title", + "label" +]; +var rangeAreaIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "label", + "yLowName", + "yHighName" +]; +var rangeBarIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction", + "label", + "yLowName", + "yHighName" +]; +var scatterIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "title", + "label", + "labelKey", + "labelName" +]; +var waterfallIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction" +]; +var navigatorOptionsDef = { + enabled: import_ag_charts_core20.boolean, + height: import_ag_charts_core20.positiveNumber, + spacing: import_ag_charts_core20.positiveNumber, + cornerRadius: import_ag_charts_core20.number, + mask: { + fill: import_ag_charts_core20.color, + fillOpacity: import_ag_charts_core20.ratio, + stroke: import_ag_charts_core20.color, + strokeWidth: import_ag_charts_core20.positiveNumber + }, + minHandle: navigatorHandleOptionsDef, + maxHandle: navigatorHandleOptionsDef, + miniChart: { + enabled: import_ag_charts_core20.boolean, + padding: { + top: import_ag_charts_core20.positiveNumber, + bottom: import_ag_charts_core20.positiveNumber + }, + label: { + enabled: import_ag_charts_core20.boolean, + avoidCollisions: import_ag_charts_core20.boolean, + spacing: import_ag_charts_core20.positiveNumber, + format: numberFormatValidator, + formatter: (0, import_ag_charts_core20.callbackOf)(textOrSegments), + interval: { + minSpacing: import_ag_charts_core20.positiveNumber, + maxSpacing: import_ag_charts_core20.positiveNumber, + values: import_ag_charts_core20.array, + step: import_ag_charts_core20.number + }, + ...import_ag_charts_core20.fontOptionsDef + }, + series: (0, import_ag_charts_core20.arrayOfDefs)( + (0, import_ag_charts_core20.typeUnion)( + { + area: without2(NewAreaSeriesModule.options, [...commonIgnoredMiniChartProperties, "type"]), + bar: without2(NewBarSeriesModule.options, [...barIgnoredMiniChartProperties, "type"]), + "box-plot": without2(BoxPlotSeriesModule.options, [...boxPlotIngnoredMiniChartProperties, "type"]), + bubble: without2(NewBubbleSeriesModule.options, [...bubbleIgnoredMiniChartProperties, "type"]), + candlestick: without2(CandlestickSeriesModule.options, [ + ...commonIgnoredMiniChartProperties, + "type" + ]), + heatmap: without2(HeatmapSeriesModule.options, [...heatmapIgnoredMiniChartProperties, "type"]), + histogram: without2(NewHistogramSeriesModule.options, [ + ...histogramIgnoredMiniChartProperties, + "type" + ]), + line: without2(NewLineSeriesModule.options, [...lineIgnoredMiniChartProperties, "type"]), + ohlc: without2(OhlcSeriesModule.options, [...commonIgnoredMiniChartProperties, "type"]), + "range-area": without2(RangeAreaSeriesModule.options, [ + ...rangeAreaIgnoredMiniChartProperties, + "type" + ]), + "range-bar": without2(RangeBarSeriesModule.options, [...rangeBarIgnoredMiniChartProperties, "type"]), + scatter: without2(NewScatterSeriesModule.options, [...scatterIgnoredMiniChartProperties, "type"]), + waterfall: without2(WaterfallSeriesModule.options, [...waterfallIgnoredMiniChartProperties, "type"]) + }, + "miniChart series options" + ) + ) + } +}; + +// packages/ag-charts-enterprise/src/features/sync/pluginModules.ts +var { annotationOptionsDef } = import_ag_charts_community64._ModuleSupport; +var AnnotationsModule = { + type: "plugin", + name: "annotations", + chartType: "cartesian", + options: annotationOptionsDef, + create() { + return null; + } +}; +var NavigatorModule = { + type: "plugin", + name: "navigator", + chartType: "cartesian", + options: navigatorOptionsDef, + create() { + return null; + } +}; +var InitialStateModule = { + type: "plugin", + name: "initialState", + options: initialStateOptionsDef, + create() { + return null; + } +}; + +// packages/ag-charts-enterprise/src/series/chord/chordModule.ts +var import_ag_charts_community70 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/chord/chordSeries.ts +var import_ag_charts_community68 = require("ag-charts-community"); +var import_ag_charts_core22 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionSeries.ts +var import_ag_charts_community65 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionUtil.ts +var import_ag_charts_core21 = require("ag-charts-core"); +function computeNodeGraph(nodes, links, includeCircularReferences) { + if (!includeCircularReferences) { + links = removeCircularLinks(links); + } + const nodeGraph = /* @__PURE__ */ new Map(); + for (const datum of nodes) { + nodeGraph.set(datum.id, { + datum, + linksBefore: [], + linksAfter: [], + maxPathLengthBefore: -1, + maxPathLengthAfter: -1 + }); + } + let maxPathLength = 0; + for (const [id, node] of nodeGraph.entries()) { + maxPathLength = Math.max( + maxPathLength, + computePathLength(nodeGraph, links, node, id, -1, []) + computePathLength(nodeGraph, links, node, id, 1, []) + 1 + ); + } + return { links, nodeGraph, maxPathLength }; +} +function findCircularLinks(links, link, into, stack) { + const stackIndex = stack.indexOf(link); + if (stackIndex !== -1) { + for (let i = stackIndex; i < stack.length; i += 1) { + into.add(stack[i]); + } + return; + } + stack.push(link); + const { toNode } = link; + for (const next of links) { + if (next.fromNode === toNode) { + findCircularLinks(links, next, into, stack); + } + } + stack.pop(); +} +function removeCircularLinks(links) { + const circularLinks = /* @__PURE__ */ new Set(); + for (const link of links) { + findCircularLinks(links, link, circularLinks, []); + } + if (circularLinks.size !== 0) { + import_ag_charts_core21.Logger.warnOnce("Some links formed circular references. These will be removed from the output."); + } + return circularLinks.size === 0 ? links : links.filter((link) => !circularLinks.has(link)); +} +function computePathLength(nodeGraph, links, node, id, direction, stack) { + if (stack.includes(id)) { + return Infinity; + } + let maxPathLength = direction === -1 ? node.maxPathLengthBefore : node.maxPathLengthAfter; + if (maxPathLength === -1) { + maxPathLength = 0; + const connectedLinks = direction === -1 ? node.linksBefore : node.linksAfter; + for (const link of links) { + const { fromNode, toNode } = link; + const linkId = direction === -1 ? toNode.id : fromNode.id; + const nextNodeId = direction === -1 ? fromNode.id : toNode.id; + const nextNode = id === linkId ? nodeGraph.get(nextNodeId) : void 0; + if (nextNode == null) + continue; + connectedLinks.push({ node: nextNode, link }); + stack?.push(id); + maxPathLength = Math.max( + maxPathLength, + computePathLength(nodeGraph, links, nextNode, nextNodeId, direction, stack) + 1 + ); + stack?.pop(); + } + if (direction === -1) { + node.maxPathLengthBefore = maxPathLength; + } else { + node.maxPathLengthAfter = maxPathLength; + } + } + return maxPathLength; +} + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionSeries.ts +var { Series, DataController, keyProperty: keyProperty6, valueProperty: valueProperty7, Selection: Selection3, Group: Group5, TransformableText } = import_ag_charts_community65._ModuleSupport; +var FlowProportionSeriesNodeEvent = class extends import_ag_charts_community65._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + const { datumIndex } = datum; + const nodeDatum = series.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + this.size = nodeDatum?.size; + this.label = nodeDatum?.type === 1 /* Node */ ? nodeDatum?.label : void 0; + } +}; +var FlowProportionSeries = class extends Series { + constructor() { + super(...arguments); + this.NodeEvent = FlowProportionSeriesNodeEvent; + this.nodeCount = 0; + this.linkCount = 0; + this.linksDataModel = void 0; + this.linksProcessedData = void 0; + this.nodesDataModel = void 0; + this.nodesProcessedData = void 0; + this.processedNodes = /* @__PURE__ */ new Map(); + this.linkGroup = this.contentGroup.appendChild(new Group5({ name: "linkGroup" })); + this.nodeGroup = this.contentGroup.appendChild(new Group5({ name: "nodeGroup" })); + this.focusLinkGroup = this.highlightGroup.appendChild(new Group5({ name: "linkGroup" })); + this.focusNodeGroup = this.highlightGroup.appendChild(new Group5({ name: "nodeGroup" })); + this.highlightLinkGroup = this.highlightGroup.appendChild(new Group5({ name: "linkGroup" })); + this.highlightNodeGroup = this.highlightGroup.appendChild(new Group5({ name: "nodeGroup" })); + this.labelSelection = Selection3.select( + this.labelGroup, + TransformableText + ); + this.linkSelection = Selection3.select( + this.linkGroup, + () => this.linkFactory() + ); + this.nodeSelection = Selection3.select( + this.nodeGroup, + () => this.nodeFactory() + ); + this.focusLinkSelection = Selection3.select( + this.focusLinkGroup, + () => this.linkFactory() + ); + this.focusNodeSelection = Selection3.select( + this.focusNodeGroup, + () => this.nodeFactory() + ); + this.highlightLinkSelection = Selection3.select( + this.highlightLinkGroup, + () => this.linkFactory() + ); + this.highlightNodeSelection = Selection3.select( + this.highlightNodeGroup, + () => this.nodeFactory() + ); + } + get nodes() { + return this.properties.nodes; + } + async processData(dataController) { + const { data, nodes } = this; + if (data == null) + return; + const { fromKey, toKey, sizeKey, idKey, labelKey } = this.properties; + const nodesDataController = new DataController("standalone", dataController.suppressFieldDotNotation); + const nodesDataModelPromise = nodes == null ? null : nodesDataController.request( + this.id, + import_ag_charts_community65._ModuleSupport.DataSet.wrap(nodes) ?? import_ag_charts_community65._ModuleSupport.DataSet.empty(), + { + props: [ + keyProperty6(idKey, void 0, { id: "idValue", includeProperty: false }), + ...labelKey == null ? [] : [valueProperty7(labelKey, void 0, { id: "labelValue", includeProperty: false })] + ], + groupByKeys: true + } + ); + const linksDataModelPromise = dataController.request(this.id, data, { + props: [ + valueProperty7(fromKey, void 0, { id: "fromValue", includeProperty: false }), + valueProperty7(toKey, void 0, { id: "toValue", includeProperty: false }), + ...sizeKey == null ? [] : [ + valueProperty7(sizeKey, void 0, { + id: "sizeValue", + includeProperty: false, + missingValue: 0 + }) + ] + ], + groupByKeys: false + }); + if (nodes != null) { + nodesDataController.execute(); + } + const [nodesDataModel, linksDataModel] = await Promise.all([ + nodesDataModelPromise ?? Promise.resolve(null), + linksDataModelPromise + ]); + this.nodesDataModel = nodesDataModel?.dataModel; + this.nodesProcessedData = nodesDataModel?.processedData; + this.linksDataModel = linksDataModel?.dataModel; + this.linksProcessedData = linksDataModel?.processedData; + const processedNodes = /* @__PURE__ */ new Map(); + if (nodesDataModel == null) { + const fromIdValues = linksDataModel.dataModel.resolveColumnById( + this, + "fromValue", + linksDataModel.processedData + ); + const toIdValues = linksDataModel.dataModel.resolveColumnById( + this, + "toValue", + linksDataModel.processedData + ); + const createImplicitNode = (id) => { + const datumIndex = processedNodes.size; + const label = id; + return { + series: this, + itemId: void 0, + datum: {}, + // Must be a referential object for tooltips + datumIndex: { type: 1 /* Node */, index: datumIndex }, + type: 1 /* Node */, + index: datumIndex, + linksBefore: [], + linksAfter: [], + id, + size: 0, + label, + style: this.getNodeStyle( + { + datumIndex: { type: 1 /* Node */, index: datumIndex }, + datum: {}, + size: 0, + label + }, + datumIndex, + false + ) + }; + }; + const linkData = linksDataModel.processedData.dataSources.get(this.id)?.data; + if (linkData) { + for (const [datumIndex] of linkData.entries()) { + const fromId = fromIdValues[datumIndex]; + const toId = toIdValues[datumIndex]; + if (fromId == null || toId == null) + continue; + if (!processedNodes.has(fromId)) { + processedNodes.set(fromId, createImplicitNode(fromId)); + } + if (!processedNodes.has(toId)) { + processedNodes.set(toId, createImplicitNode(toId)); + } + } + } + } else { + const nodeIdValues = nodesDataModel.dataModel.resolveColumnById( + this, + "idValue", + nodesDataModel.processedData + ); + const labelValues = labelKey == null ? void 0 : nodesDataModel.dataModel.resolveColumnById( + this, + "labelValue", + nodesDataModel.processedData + ); + const nodeData = nodesDataModel.processedData.dataSources.get(this.id)?.data; + if (nodeData) { + for (const [datumIndex, datum] of nodeData.entries()) { + const id = nodeIdValues[datumIndex]; + const label = labelValues?.[datumIndex]; + const nodeDatumIndex = { type: 1 /* Node */, index: datumIndex }; + processedNodes.set(id, { + series: this, + itemId: void 0, + datum, + datumIndex: nodeDatumIndex, + type: 1 /* Node */, + index: datumIndex, + linksBefore: [], + linksAfter: [], + id, + size: 0, + label, + style: this.getNodeStyle( + { datumIndex: nodeDatumIndex, datum, size: 0, label }, + datumIndex, + false + ) + }); + } + } + } + this.processedNodes = processedNodes; + } + getNodeGraph(createNode, createLink, { includeCircularReferences }) { + const { linksDataModel, linksProcessedData } = this; + if (linksDataModel == null || linksProcessedData == null) { + const { links: links2, nodeGraph: nodeGraph2, maxPathLength: maxPathLength2 } = computeNodeGraph( + (/* @__PURE__ */ new Map()).values(), + [], + includeCircularReferences + ); + this.nodeCount = 0; + this.linkCount = 0; + return { nodeGraph: nodeGraph2, links: links2, maxPathLength: maxPathLength2 }; + } + const { sizeKey } = this.properties; + const fromIdValues = linksDataModel.resolveColumnById(this, "fromValue", linksProcessedData); + const toIdValues = linksDataModel.resolveColumnById(this, "toValue", linksProcessedData); + const sizeValues = sizeKey == null ? void 0 : linksDataModel.resolveColumnById(this, "sizeValue", linksProcessedData); + const nodesById = /* @__PURE__ */ new Map(); + for (const datum of this.processedNodes.values()) { + const node = createNode(datum); + nodesById.set(datum.id, node); + } + const baseLinks = []; + const linkData = linksProcessedData.dataSources.get(this.id)?.data; + if (linkData) { + for (const [datumIndex, datum] of linkData.entries()) { + const fromId = fromIdValues[datumIndex]; + const toId = toIdValues[datumIndex]; + const size = sizeValues == null ? 1 : sizeValues[datumIndex]; + const fromNode = nodesById.get(fromId); + const toNode = nodesById.get(toId); + if (size <= 0 || fromNode == null || toNode == null) + continue; + const linkNodeDatumIndex = { type: 0 /* Link */, index: datumIndex }; + const link = createLink({ + series: this, + itemId: void 0, + datum, + datumIndex: linkNodeDatumIndex, + type: 0 /* Link */, + index: datumIndex, + fromNode, + toNode, + size, + style: this.getLinkStyle( + { datum, datumIndex: linkNodeDatumIndex }, + fromNode.datumIndex, + false + ) + }); + baseLinks.push(link); + } + } + const { links, nodeGraph, maxPathLength } = computeNodeGraph( + nodesById.values(), + baseLinks, + includeCircularReferences + ); + for (const node of nodeGraph.values()) { + node.datum.linksBefore = node.linksBefore.map((linkedNode) => linkedNode.link); + node.datum.linksAfter = node.linksAfter.map((linkedNode) => linkedNode.link); + } + this.nodeCount = nodeGraph.size; + this.linkCount = links.length; + return { nodeGraph, links, maxPathLength }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update(opts) { + const { seriesRect } = opts; + const newNodeDataDependencies = { + seriesRectWidth: seriesRect?.width ?? 0, + seriesRectHeight: seriesRect?.height ?? 0 + }; + if (this._nodeDataDependencies == null || this._nodeDataDependencies.seriesRectWidth !== newNodeDataDependencies.seriesRectWidth || this._nodeDataDependencies.seriesRectHeight !== newNodeDataDependencies.seriesRectHeight) { + this._nodeDataDependencies = newNodeDataDependencies; + } + this.updateSelections(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedDatum?.series === this && highlightedDatum.type == null) { + const { itemId } = highlightedDatum; + highlightedDatum = itemId == null ? void 0 : nodeData.find((node) => node.type === 1 /* Node */ && node.id === itemId); + } else if (highlightedDatum?.series !== this) { + highlightedDatum = void 0; + } + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = highlightedDatum == null ? 1 : this.properties.highlight.unhighlightedItem.opacity ?? 1; + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection: this.labelSelection }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + this.linkSelection = this.updateLinkSelection({ + nodeData: nodeData.filter((d) => d.type === 0 /* Link */), + datumSelection: this.linkSelection + }); + this.updateLinkNodes({ datumSelection: this.linkSelection, isHighlight: false }); + this.nodeSelection = this.updateNodeSelection({ + nodeData: nodeData.filter((d) => d.type === 1 /* Node */), + datumSelection: this.nodeSelection + }); + this.updateNodeNodes({ datumSelection: this.nodeSelection, isHighlight: false }); + let focusLinkSelection; + let focusNodeSelection; + let highlightLinkSelection; + let highlightNodeSelection; + if (highlightedDatum?.type === 1 /* Node */) { + focusLinkSelection = nodeData.filter((node) => { + return node.type === 0 /* Link */ && (node.toNode === highlightedDatum || node.fromNode === highlightedDatum); + }); + focusNodeSelection = focusLinkSelection.map((link) => { + return link.fromNode === highlightedDatum ? link.toNode : link.fromNode; + }); + focusNodeSelection.push(highlightedDatum); + highlightLinkSelection = []; + highlightNodeSelection = [highlightedDatum]; + } else if (highlightedDatum?.type === 0 /* Link */) { + focusLinkSelection = [highlightedDatum]; + focusNodeSelection = [highlightedDatum.fromNode, highlightedDatum.toNode]; + highlightLinkSelection = [highlightedDatum]; + highlightNodeSelection = []; + } else { + focusLinkSelection = []; + focusNodeSelection = []; + highlightLinkSelection = []; + highlightNodeSelection = []; + } + this.focusLinkSelection = this.updateLinkSelection({ + nodeData: focusLinkSelection, + datumSelection: this.focusLinkSelection + }); + this.updateLinkNodes({ datumSelection: this.focusLinkSelection, isHighlight: false }); + this.focusNodeSelection = this.updateNodeSelection({ + nodeData: focusNodeSelection, + datumSelection: this.focusNodeSelection + }); + this.updateNodeNodes({ datumSelection: this.focusNodeSelection, isHighlight: false }); + this.highlightLinkSelection = this.updateLinkSelection({ + nodeData: highlightLinkSelection, + datumSelection: this.highlightLinkSelection + }); + this.updateLinkNodes({ datumSelection: this.highlightLinkSelection, isHighlight: true }); + this.highlightNodeSelection = this.updateNodeSelection({ + nodeData: highlightNodeSelection, + datumSelection: this.highlightNodeSelection + }); + this.updateNodeNodes({ datumSelection: this.highlightNodeSelection, isHighlight: true }); + } + resetAnimation(_chartAnimationPhase) { + } + dataCount() { + return Number.NaN; + } + getSeriesDomain(_direction) { + return []; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + legendItemSymbol(_type, nodeIndex, format = {}) { + const { fills, strokes } = this.properties; + const { + fill = fills[nodeIndex % fills.length], + fillOpacity = 1, + stroke = strokes[nodeIndex % strokes.length], + strokeWidth = 0, + strokeOpacity = 1, + lineDash = [0], + lineDashOffset = 0 + } = format; + return { + marker: { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") + return []; + const { showInLegend } = this.properties; + return Array.from( + this.processedNodes.values(), + ({ id, label }, nodeIndex) => ({ + legendType: "category", + id: this.id, + itemId: id, + seriesId: this.id, + enabled: true, + label: { text: label ?? id }, + symbol: this.legendItemSymbol(1 /* Node */, nodeIndex), + hideInLegend: !showInLegend, + isFixed: true + }) + ); + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.linkSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + this.nodeSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + getDatumAriaText(datum, description) { + if (datum.type === 0 /* Link */) { + return this.ctx.localeManager.t("ariaAnnounceFlowProportionLink", { + index: datum.index + 1, + count: this.linkCount, + from: datum.fromNode.id, + to: datum.toNode.id, + size: datum.size, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }); + } else if (datum.type === 1 /* Node */) { + return this.ctx.localeManager.t("ariaAnnounceFlowProportionNode", { + index: datum.index + 1, + count: this.nodeCount, + description + }); + } + } + pickFocus(opts) { + const { datumIndexDelta: childDelta, otherIndexDelta: depthDelta } = opts; + const currentNodeDatum = this.contextNodeData?.nodeData[opts.datumIndex - opts.datumIndexDelta]; + let nextNodeDatum = currentNodeDatum; + if (depthDelta !== 0 || childDelta === 0) + return; + if (currentNodeDatum?.type === 0 /* Link */) { + const allLinks = Array.from(this.linkSelection, (link) => link.datum); + const selfIndex = allLinks.indexOf(currentNodeDatum); + const nextIndex = selfIndex + childDelta; + if (nextIndex >= 0 && nextIndex < allLinks.length) { + nextNodeDatum = allLinks[nextIndex]; + } else if (nextIndex > 0) { + nextNodeDatum = allLinks.at(-1); + } else { + const allNodes = Array.from(this.nodeSelection, (node) => node.datum); + nextNodeDatum = allNodes.at(-1); + } + } else if (currentNodeDatum?.type === 1 /* Node */) { + const allNodes = Array.from(this.nodeSelection, (node) => node.datum); + const selfIndex = allNodes.indexOf(currentNodeDatum); + const nextIndex = selfIndex + childDelta; + if (nextIndex >= 0 && nextIndex < allNodes.length) { + nextNodeDatum = allNodes[nextIndex]; + } else if (nextIndex < 0) { + nextNodeDatum = allNodes[0]; + } else { + const allLinks = Array.from(this.linkSelection, (link) => link.datum); + nextNodeDatum = allLinks[0]; + } + } + if (nextNodeDatum == null) + return; + const nodeDatum = nextNodeDatum.type === 1 /* Node */ ? Array.from(this.nodeSelection).find((n) => n.datum === nextNodeDatum) : Array.from(this.linkSelection).find((n) => n.datum === nextNodeDatum); + if (nodeDatum == null) + return; + const bounds = this.computeFocusBounds(nodeDatum.node); + if (bounds == null) + return; + return { + datum: nodeDatum.datum, + datumIndex: this.contextNodeData?.nodeData.indexOf(nodeDatum.datum) ?? 0, + otherIndex: 0, + bounds, + clipFocusBox: true + }; + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } +}; + +// packages/ag-charts-enterprise/src/series/chord/chordLink.ts +var import_ag_charts_community66 = require("ag-charts-community"); +var { Path: Path7, SceneChangeDetection: SceneChangeDetection4 } = import_ag_charts_community66._ModuleSupport; +function bezierControlPoints({ + radius, + startAngle, + endAngle, + tension +}) { + const cp0x = radius * Math.cos(startAngle); + const cp0y = radius * Math.sin(startAngle); + const cp3x = radius * Math.cos(endAngle); + const cp3y = radius * Math.sin(endAngle); + const cp1x = cp0x * tension; + const cp1y = cp0y * tension; + const cp2x = cp3x * tension; + const cp2y = cp3y * tension; + return { + x: [cp0x, cp1x, cp2x, cp3x], + y: [cp0y, cp1y, cp2y, cp3y] + }; +} +var ChordLink = class extends Path7 { + constructor() { + super(...arguments); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.startAngle1 = 0; + this.endAngle1 = 0; + this.startAngle2 = 0; + this.endAngle2 = 0; + this.tension = 1; + } + tensionedCurveTo(cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y) { + const { path, tension } = this; + const scale = 1 - tension; + path.cubicCurveTo( + (cp1x - cp0x) * scale + cp0x, + (cp1y - cp0y) * scale + cp0y, + (cp2x - cp3x) * scale + cp3x, + (cp2y - cp3y) * scale + cp3y, + cp3x, + cp3y + ); + } + updatePath() { + const { path, centerX, centerY, radius } = this; + let { startAngle1, endAngle1, startAngle2, endAngle2 } = this; + if (startAngle1 > startAngle2) { + [startAngle1, startAngle2] = [startAngle2, startAngle1]; + [endAngle1, endAngle2] = [endAngle2, endAngle1]; + } + path.clear(); + const startX = centerX + radius * Math.cos(startAngle1); + const startY = centerY + radius * Math.sin(startAngle1); + path.moveTo(startX, startY); + this.tensionedCurveTo( + startX, + startY, + centerX, + centerY, + centerX, + centerY, + centerX + radius * Math.cos(endAngle2), + centerY + radius * Math.sin(endAngle2) + ); + path.arc(centerX, centerY, radius, endAngle2, startAngle2, true); + this.tensionedCurveTo( + centerX + radius * Math.cos(startAngle2), + centerY + radius * Math.sin(startAngle2), + centerX, + centerY, + centerX, + centerY, + centerX + radius * Math.cos(endAngle1), + centerY + radius * Math.sin(endAngle1) + ); + path.arc(centerX, centerY, radius, endAngle1, startAngle1, true); + path.closePath(); + } +}; +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "centerX", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "centerY", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "radius", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "startAngle1", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "endAngle1", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "startAngle2", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "endAngle2", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "tension", 2); + +// packages/ag-charts-enterprise/src/series/chord/chordSeriesProperties.ts +var import_ag_charts_community67 = require("ag-charts-community"); +var { + FillGradientDefaults, + FillPatternDefaults, + FillImageDefaults, + BaseProperties: BaseProperties7, + makeSeriesTooltip: makeSeriesTooltip8, + SeriesProperties, + Property: Property20, + Label: Label4 +} = import_ag_charts_community67._ModuleSupport; +var ChordSeriesLabelProperties = class extends Label4 { + constructor() { + super(...arguments); + this.spacing = 1; + this.maxWidth = 1; + } +}; +__decorateClass([ + Property20 +], ChordSeriesLabelProperties.prototype, "spacing", 2); +__decorateClass([ + Property20 +], ChordSeriesLabelProperties.prototype, "maxWidth", 2); +var ChordSeriesLinkProperties = class extends BaseProperties7 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tension = 0; + } + getStyle(fills, strokes, index) { + const { fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset, tension } = this; + const fill = this.fill ?? fills[index % fills.length]; + const stroke = this.stroke ?? strokes[index % fills.length]; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + tension + }; + } +}; +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "fill", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "stroke", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "lineDash", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "tension", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "itemStyler", 2); +var ChordSeriesNodeProperties = class extends BaseProperties7 { + constructor() { + super(...arguments); + this.spacing = 1; + this.width = 1; + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(fills, strokes, index) { + const { fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const fill = this.fill ?? fills[index % fills.length]; + const stroke = this.stroke ?? strokes[index % fills.length]; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "spacing", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "width", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "fill", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "stroke", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "lineDash", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "itemStyler", 2); +var ChordSeriesProperties = class extends SeriesProperties { + constructor() { + super(); + this.idKey = ""; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.sizeKey = void 0; + this.sizeName = void 0; + this.nodes = void 0; + this.fillGradientDefaults = new FillGradientDefaults(); + this.fillPatternDefaults = new FillPatternDefaults(); + this.fillImageDefaults = new FillImageDefaults(); + this.fills = []; + this.strokes = []; + this.label = new ChordSeriesLabelProperties(); + this.link = new ChordSeriesLinkProperties(); + this.node = new ChordSeriesNodeProperties(); + this.tooltip = makeSeriesTooltip8(); + this.highlightStyle.deprecated = false; + } +}; +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "fromKey", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "toKey", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "nodes", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "fillGradientDefaults", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "fillPatternDefaults", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "fillImageDefaults", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "fills", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "strokes", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "link", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "node", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/chord/chordSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode6, + createDatumId: createDatumId6, + angleBetween: angleBetween2, + normalizeAngle360: normalizeAngle3604, + isBetweenAngles, + Sector: Sector3, + evaluateBezier, + applyShapeStyle: applyShapeStyle7, + getShapeStyle, + getLabelStyles, + BBox: BBox6, + mergeDefaults: mergeDefaults8 +} = import_ag_charts_community68._ModuleSupport; +var nodeMidAngle = (node) => node.startAngle + angleBetween2(node.startAngle, node.endAngle) / 2; +var ChordSeries = class extends FlowProportionSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode6.NEAREST_NODE, SeriesNodePickMode6.EXACT_SHAPE_MATCH] + }); + this.properties = new ChordSeriesProperties(); + } + isLabelEnabled() { + return (this.properties.labelKey != null || this.nodes == null) && this.properties.label.enabled; + } + linkFactory() { + return new ChordLink(); + } + nodeFactory() { + return new Sector3(); + } + createNodeData() { + const { + id: seriesId, + _nodeDataDependencies: { seriesRectWidth, seriesRectHeight } = { seriesRectWidth: 0, seriesRectHeight: 0 }, + properties + } = this; + const { + fromKey, + toKey, + sizeKey, + labelKey, + label: { spacing: labelSpacing, maxWidth: labelMaxWidth, fontSize }, + node: { width: nodeWidth, spacing: nodeSpacing } + } = properties; + const centerX = seriesRectWidth / 2; + const centerY = seriesRectHeight / 2; + let labelData = []; + const { nodeGraph, links } = this.getNodeGraph( + (node) => ({ + ...node, + centerX, + centerY, + innerRadius: Number.NaN, + outerRadius: Number.NaN, + startAngle: Number.NaN, + endAngle: Number.NaN + }), + (link) => ({ + ...link, + centerX, + centerY, + radius: Number.NaN, + startAngle1: Number.NaN, + endAngle1: Number.NaN, + startAngle2: Number.NaN, + endAngle2: Number.NaN + }), + { includeCircularReferences: true } + ); + let totalSize = 0; + for (const [id, { datum: node, linksBefore, linksAfter }] of nodeGraph.entries()) { + const size = linksBefore.reduce((acc, { link }) => acc + link.size, 0) + linksAfter.reduce((acc, { link }) => acc + link.size, 0); + if (size === 0) { + nodeGraph.delete(id); + } else { + const { label } = properties; + node.size = size; + totalSize += node.size; + const labelText = label.enabled ? this.getLabelText( + node.label, + node.datum, + labelKey, + "label", + [], + label, + { datum: node.datum, value: node.label, fromKey, toKey, sizeKey, size: node.size } + ) : void 0; + node.label = (0, import_ag_charts_core22.toPlainText)(labelText); + } + } + let labelInset = 0; + if (this.isLabelEnabled()) { + const measurer = (0, import_ag_charts_core22.cachedTextMeasurer)(this.properties.label); + let maxMeasuredLabelWidth = 0; + for (const { datum: node } of nodeGraph.values()) { + const { id, label } = node; + if (label == null) + continue; + const text = (0, import_ag_charts_core22.wrapText)(label, { + maxWidth: labelMaxWidth, + font: this.properties.label, + textWrap: "never" + }); + const { width } = measurer.measureLines(text); + maxMeasuredLabelWidth = Math.max(width, maxMeasuredLabelWidth); + labelData.push({ + id, + text, + centerX, + centerY, + angle: Number.NaN, + radius: Number.NaN, + size: node.size + }); + } + labelInset = maxMeasuredLabelWidth + labelSpacing; + } + const nodeCount = nodeGraph.size; + let radius = Math.min(seriesRectWidth, seriesRectHeight) / 2 - nodeWidth - labelInset; + let spacingSweep = nodeSpacing / radius; + if (labelInset !== 0 && (nodeCount * spacingSweep >= 1.5 * Math.PI || radius <= 0)) { + labelData = []; + radius = Math.min(seriesRectWidth, seriesRectHeight) / 2 - nodeWidth; + spacingSweep = nodeSpacing / radius; + } + if (nodeCount * spacingSweep >= 2 * Math.PI || radius <= 0) { + import_ag_charts_core22.Logger.warnOnce("There was insufficient space to display the Chord Series."); + return; + } + const innerRadius = radius; + const outerRadius = radius + nodeWidth; + const sizeScale = Math.max((2 * Math.PI - nodeCount * spacingSweep) / totalSize, 0); + let nodeAngle = 0; + for (const { datum: node } of nodeGraph.values()) { + node.innerRadius = innerRadius; + node.outerRadius = outerRadius; + node.startAngle = nodeAngle; + node.endAngle = nodeAngle + node.size * sizeScale; + nodeAngle = node.endAngle + spacingSweep; + const midR = (node.innerRadius + node.outerRadius) / 2; + const midAngle = nodeMidAngle(node); + node.midPoint = { + x: node.centerX + midR * Math.cos(midAngle), + y: node.centerY + midR * Math.sin(midAngle) + }; + } + const nodeData = []; + for (const { datum: node, linksBefore, linksAfter } of nodeGraph.values()) { + const midAngle = nodeMidAngle(node); + const combinedLinks = [ + ...linksBefore.map((l) => ({ + link: l.link, + distance: angleBetween2(nodeMidAngle(l.node.datum), midAngle), + after: false + })), + ...linksAfter.map((l) => ({ + link: l.link, + distance: angleBetween2(nodeMidAngle(l.node.datum), midAngle), + after: true + })) + ]; + let linkAngle = node.startAngle; + for (const { link, after } of combinedLinks.toSorted((a, b) => a.distance - b.distance)) { + const linkSweep = link.size * sizeScale; + if (after) { + link.startAngle1 = linkAngle; + link.endAngle1 = linkAngle + linkSweep; + } else { + link.startAngle2 = linkAngle; + link.endAngle2 = linkAngle + linkSweep; + } + linkAngle += link.size * sizeScale; + } + nodeData.push(node); + } + const { tension } = this.properties.link; + for (const link of links) { + link.radius = radius; + const outer = bezierControlPoints({ + radius, + startAngle: link.startAngle1, + endAngle: link.endAngle2, + tension + }); + const inner = bezierControlPoints({ + radius, + startAngle: link.startAngle2, + endAngle: link.endAngle1, + tension + }); + const outerX = evaluateBezier(...outer.x, 0.5); + const outerY = evaluateBezier(...outer.y, 0.5); + const innerX = evaluateBezier(...inner.x, 0.5); + const innerY = evaluateBezier(...inner.y, 0.5); + link.midPoint = { + x: link.centerX + (outerX + innerX) / 2, + y: link.centerY + (outerY + innerY) / 2 + }; + nodeData.push(link); + } + for (const label of labelData) { + const node = nodeGraph.get(label.id)?.datum; + if (node == null) + continue; + label.radius = outerRadius + labelSpacing; + label.angle = normalizeAngle3604(node.startAngle + angleBetween2(node.startAngle, node.endAngle) / 2); + } + labelData.sort((a, b) => a.angle - b.angle); + let minAngle = Infinity; + let maxAngle = -Infinity; + labelData = labelData.filter((label) => { + const labelHeight = (0, import_ag_charts_core22.calcLineHeight)(fontSize); + const da = Math.atan2(labelHeight / 2, label.radius); + const a0 = label.angle - da; + const a1 = label.angle + da; + if (isBetweenAngles(minAngle, a0, a1)) + return false; + if (isBetweenAngles(maxAngle, a0, a1)) + return false; + minAngle = Math.min(a0, minAngle); + maxAngle = Math.max(a1, maxAngle); + return true; + }); + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const params = { + toKey: this.properties.toKey, + fromKey: this.properties.fromKey, + sizeKey: this.properties.sizeKey, + size: Number.NaN + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { size, text, centerX, centerY, radius, angle }) => { + params.size = size; + const style = getLabelStyles(this, void 0, params, this.properties.label, false, activeHighlight); + const { fontStyle, fontWeight, fontSize, fontFamily, color: fill } = style; + label.visible = true; + label.translationX = centerX + radius * Math.cos(angle); + label.translationY = centerY + radius * Math.sin(angle); + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textBaseline = "middle"; + if (Math.cos(angle) >= 0) { + label.textAlign = "left"; + label.rotation = angle; + } else { + label.textAlign = "right"; + label.rotation = angle - Math.PI; + } + label.setBoxing(style); + }); + } + updateNodeSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId6(datum.type, datum.id)); + } + getNodeStyle(nodeDatum, fromNodeDatumIndex, isHighlight) { + const { properties } = this; + const { fills, strokes, fillGradientDefaults: fillGradientDefaults3, fillPatternDefaults: fillPatternDefaults3, fillImageDefaults: fillImageDefaults3 } = properties; + const { itemStyler } = properties.node; + const highlightStyle = this.getHighlightStyle(isHighlight, nodeDatum.datumIndex); + const baseStyle = mergeDefaults8(highlightStyle, properties.node.getStyle(fills, strokes, fromNodeDatumIndex)); + let style = getShapeStyle(baseStyle, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + if (itemStyler != null && nodeDatum.datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId6(nodeDatum.datumIndex.index, "node", isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = getShapeStyle( + mergeDefaults8(overrides, style), + fillGradientDefaults3, + fillPatternDefaults3, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + makeItemStylerParams({ datum, datumIndex, size = 0, label }, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + size, + label, + fill + }; + } + updateNodeNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((sector, datum) => { + const { datumIndex } = datum; + const style = this.getNodeStyle(datum, datumIndex.index, isHighlight); + applyShapeStyle7(sector, style, fillBBox); + sector.centerX = datum.centerX; + sector.centerY = datum.centerY; + sector.innerRadius = datum.innerRadius; + sector.outerRadius = datum.outerRadius; + sector.startAngle = datum.startAngle; + sector.endAngle = datum.endAngle; + sector.inset = sector.strokeWidth / 2; + }); + } + updateLinkSelection(opts) { + return opts.datumSelection.update( + opts.nodeData, + void 0, + (datum) => createDatumId6(datum.type, datum.index, datum.fromNode.id, datum.toNode.id) + ); + } + getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, isHighlight) { + const { id: seriesId, properties } = this; + const { fills, strokes, fillGradientDefaults: fillGradientDefaults3, fillPatternDefaults: fillPatternDefaults3, fillImageDefaults: fillImageDefaults3 } = properties; + const { itemStyler } = properties.link; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults8( + highlightStyle, + properties.link.getStyle(fills, strokes, fromNodeDatumIndex.index) + ); + let style = getShapeStyle(baseStyle, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + if (itemStyler != null && datumIndex != null) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const overrides = this.cachedDatumCallback( + createDatumId6(datumIndex.index, "link", isHighlight ? "highlight" : "node"), + () => { + const highlightState = this.getHighlightStateString( + activeHighlight, + isHighlight, + fromNodeDatumIndex + ); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }); + } + ); + if (overrides) { + style = getShapeStyle( + mergeDefaults8(overrides, style), + fillGradientDefaults3, + fillPatternDefaults3, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + updateLinkNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((link, datum) => { + const fromNodeDatumIndex = datum.fromNode.datumIndex; + const style = this.getLinkStyle(datum, fromNodeDatumIndex, isHighlight); + link.centerX = datum.centerX; + link.centerY = datum.centerY; + link.radius = datum.radius; + link.startAngle1 = datum.startAngle1; + link.endAngle1 = datum.endAngle1; + link.startAngle2 = datum.startAngle2; + link.endAngle2 = datum.endAngle2; + link.tension = style.tension; + applyShapeStyle7(link, style, fillBBox); + }); + } + getShapeFillBBox() { + const width = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const height = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const size = Math.min(width, height); + const x = (width - size) / 2; + const y = (height - size) / 2; + const bbox = new BBox6(x, y, width, height); + return { series: bbox, axis: bbox }; + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + linksProcessedData, + nodesProcessedData, + properties, + ctx: { formatManager } + } = this; + const { fromKey, toKey, sizeKey, sizeName, tooltip } = properties; + const seriesDatum = this.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + if (seriesDatum == null) + return; + const nodeIndex = seriesDatum.type === 0 /* Link */ ? seriesDatum.fromNode.index : seriesDatum.index; + const title = seriesDatum.type === 0 /* Link */ ? `${seriesDatum.fromNode.label} - ${seriesDatum.toNode.label}` : seriesDatum.label; + const datum = datumIndex.type === 0 /* Link */ ? linksProcessedData?.dataSources.get(this.id)?.data[datumIndex.index] : nodesProcessedData?.dataSources.get(this.id)?.data[datumIndex.index]; + const size = seriesDatum.size; + let format; + if (seriesDatum.type === 0 /* Link */) { + const fromNodeDatumIndex = seriesDatum.fromNode.datumIndex; + format = this.getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, false); + } else { + const label = seriesDatum.label; + format = this.getNodeStyle({ datumIndex, datum, size, label }, datumIndex.index, false); + } + const data = []; + if (sizeKey != null) { + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: size, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + domain: [], + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(size) }); + } + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(seriesDatum.type, nodeIndex, format), + data + }, + { + seriesId, + datum, + title, + fromKey, + toKey, + sizeKey, + sizeName, + size, + ...format + } + ); + } + computeFocusBounds(node) { + return node; + } + hasItemStylers() { + return this.properties.node.itemStyler != null || this.properties.link.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +ChordSeries.className = "ChordSeries"; +ChordSeries.type = "chord"; + +// packages/ag-charts-enterprise/src/series/chord/chordSeriesOptionsDef.ts +var import_ag_charts_community69 = require("ag-charts-community"); +var import_ag_charts_core23 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs8, chordSeriesThemeableOptionsDef } = import_ag_charts_community69._ModuleSupport; +var chordSeriesOptionsDef = { + ...chordSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs8, + type: (0, import_ag_charts_core23.required)((0, import_ag_charts_core23.constant)("chord")), + fromKey: (0, import_ag_charts_core23.required)(import_ag_charts_core23.string), + toKey: (0, import_ag_charts_core23.required)(import_ag_charts_core23.string), + sizeKey: import_ag_charts_core23.string, + sizeName: import_ag_charts_core23.string +}; +chordSeriesOptionsDef.fillGradientDefaults = (0, import_ag_charts_core23.undocumented)(import_ag_charts_core23.fillGradientDefaults); +chordSeriesOptionsDef.fillPatternDefaults = (0, import_ag_charts_core23.undocumented)(import_ag_charts_core23.fillPatternDefaults); +chordSeriesOptionsDef.fillImageDefaults = (0, import_ag_charts_core23.undocumented)(import_ag_charts_core23.fillImageDefaults); + +// packages/ag-charts-enterprise/src/series/chord/chordModule.ts +var ChordModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + solo: true, + identifier: "chord", + moduleFactory: (ctx) => new ChordSeries(ctx), + themeTemplate: { + series: { + fills: { $palette: "fills" }, + strokes: { $palette: "strokes" }, + // @ts-expect-error undocumented option + fillGradientDefaults: import_ag_charts_community70._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS, + fillPatternDefaults: import_ag_charts_community70._ModuleSupport.FILL_PATTERN_DEFAULTS, + fillImageDefaults: import_ag_charts_community70._ModuleSupport.FILL_IMAGE_DEFAULTS, + highlightStyle: { + series: { + dimOpacity: 0.2 + } + }, + highlight: import_ag_charts_community70._ModuleSupport.singleSeriesHighlightStyle(), + label: { + ...import_ag_charts_community70._ModuleSupport.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 5, + maxWidth: 100 + }, + node: { + spacing: 8, + width: 10, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + link: { + fillOpacity: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + tension: 0.4 + } + }, + legend: { + enabled: false, + toggleSeries: false + } + } +}; +var ChordSeriesModule = { + type: "series", + name: "chord", + chartType: "standalone", + enterprise: true, + options: chordSeriesOptionsDef, + create: (ctx) => new ChordSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelThemes.ts +var import_ag_charts_community71 = require("ag-charts-community"); +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE7, CARTESIAN_POSITION: CARTESIAN_POSITION5 }, + ThemeSymbols: { DEFAULT_SHADOW_COLOUR } +} = import_ag_charts_community71._ModuleSupport; +var isHorizontal = { $eq: [{ $path: ["/series/0/direction", void 0] }, "horizontal"] }; +var labelOptions = { + autoRotate: { $path: "/series/0/stageLabel/autoRotate" }, + autoRotateAngle: { $path: "/series/0/stageLabel/autoRotateAngle" }, + avoidCollisions: { $path: ["/series/0/stageLabel/avoidCollisions", true] }, + border: { $path: ["/series/0/stageLabel/border"] }, + color: { $path: ["/series/0/stageLabel/color", { $ref: "textColor" }] }, + cornerRadius: { $path: ["/series/0/stageLabel/cornerRadius"] }, + enabled: { + $if: [ + { $eq: [{ $path: "/series/0/stageLabel/enabled" }, void 0] }, + true, + { $path: "/series/0/stageLabel/enabled" } + ] + }, + fill: { $path: ["/series/0/stageLabel/fill"] }, + fillOpacity: { $path: ["/series/0/stageLabel/fillOpacity"] }, + fontSize: { $path: ["/series/0/stageLabel/fontSize", { $ref: "fontSize" }] }, + fontStyle: { $path: ["/series/0/stageLabel/fontStyle", { $ref: "fontStyle" }] }, + fontWeight: { $path: ["/series/0/stageLabel/fontWeight", { $ref: "fontWeight" }] }, + format: { $path: "/series/0/stageLabel/format" }, + formatter: { $path: "/series/0/stageLabel/formatter" }, + itemStyler: { $path: "/series/0/stageLabel/itemStyler" }, + minSpacing: { $path: "/series/0/stageLabel/minSpacing" }, + padding: { $path: ["/series/0/stageLabel/padding"] }, + rotation: { $path: ["/series/0/stageLabel/rotation", 0] } +}; +var FUNNEL_SERIES_AXES = [ + { + type: { + $if: [isHorizontal, CARTESIAN_AXIS_TYPE7.NUMBER, CARTESIAN_AXIS_TYPE7.CATEGORY] + }, + position: { + $if: [ + isHorizontal, + CARTESIAN_POSITION5.LEFT, + { + $if: [ + { $eq: [{ $path: ["/series/0/stageLabel/placement", void 0] }, "after"] }, + CARTESIAN_POSITION5.RIGHT, + CARTESIAN_POSITION5.LEFT + ] + } + ] + }, + label: { + $if: [isHorizontal, void 0, labelOptions] + } + }, + { + type: { + $if: [isHorizontal, CARTESIAN_AXIS_TYPE7.CATEGORY, CARTESIAN_AXIS_TYPE7.NUMBER] + }, + position: { + $if: [ + isHorizontal, + { + $if: [ + { $eq: [{ $path: ["/series/0/stageLabel/placement", void 0] }, "before"] }, + CARTESIAN_POSITION5.TOP, + CARTESIAN_POSITION5.BOTTOM + ] + }, + CARTESIAN_POSITION5.BOTTOM + ] + }, + label: { + $if: [isHorizontal, labelOptions, void 0] + } + } +]; +var FUNNEL_SERIES_THEME = { + series: { + direction: "vertical", + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + spacingRatio: 0.25, + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + [{ $path: ["/0", void 0, { $palette: "fills" }] }], + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", import_ag_charts_community71._ModuleSupport.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS], + ["pattern", import_ag_charts_community71._ModuleSupport.FILL_PATTERN_SINGLE_DEFAULTS], + ["image", import_ag_charts_community71._ModuleSupport.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + [{ $path: ["/0", void 0, { $palette: "strokes" }] }] + ] + }, + label: { + ...import_ag_charts_community71._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + dropOff: { + enabled: true, + fillOpacity: 0.2, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + highlight: import_ag_charts_community71._ModuleSupport.singleSeriesHighlightStyle() + }, + axes: { + [CARTESIAN_AXIS_TYPE7.NUMBER]: { + nice: false, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false + }, + label: { + enabled: false + } + }, + [CARTESIAN_AXIS_TYPE7.CATEGORY]: { + line: { + enabled: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeries.ts +var import_ag_charts_community76 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/funnel/baseFunnelSeries.ts +var import_ag_charts_community74 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/funnel/funnelConnector.ts +var import_ag_charts_community72 = require("ag-charts-community"); +var { lineDistanceSquared, BBox: BBox7, Path: Path8, SceneChangeDetection: SceneChangeDetection5 } = import_ag_charts_community72._ModuleSupport; +var delta = 1e-6; +function pointsEq([ax, ay], [bx, by]) { + return Math.abs(ax - bx) <= delta && Math.abs(ay - by) <= delta; +} +var FunnelConnector = class extends Path8 { + constructor() { + super(...arguments); + this.x0 = 0; + this.y0 = 0; + this.x1 = 0; + this.y1 = 0; + this.x2 = 0; + this.y2 = 0; + this.x3 = 0; + this.y3 = 0; + } + get midPoint() { + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + return { + x: (x0 + x1 + x2 + x3) / 4, + y: (y0 + y1 + y2 + y3) / 4 + }; + } + distanceSquared(x, y) { + if (this.containsPoint(x, y)) + return 0; + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + return Math.min( + lineDistanceSquared(x, y, x0, y0, x1, y1, Infinity), + lineDistanceSquared(x, y, x1, y1, x2, y2, Infinity), + lineDistanceSquared(x, y, x2, y2, x3, y3, Infinity), + lineDistanceSquared(x, y, x3, y3, x0, y0, Infinity) + ); + } + computeBBox() { + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + const x = Math.min(x0, x1, x2, x3); + const width = Math.max(x0, x1, x2, x3) - x; + const y = Math.min(y0, y1, y2, y3); + const height = Math.max(y0, y1, y2, y3) - y; + return new BBox7(x, y, width, height); + } + updatePath() { + const { path, x0, y0, x1, y1, x2, y2, x3, y3 } = this; + const points = [ + [x0, y0], + [x1, y1], + [x2, y2], + [x3, y3] + ]; + path.clear(); + let start; + let current; + for (const p of points) { + if (start != null && pointsEq(start, p) || current != null && pointsEq(current, p)) { + continue; + } + const [x, y] = p; + if (start == null) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + start ?? (start = p); + current = p; + } + path.closePath(); + } +}; +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "x0", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "y0", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "x1", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "y1", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "x2", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "y2", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "x3", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "y3", 2); + +// packages/ag-charts-enterprise/src/series/funnel/funnelUtil.ts +var import_ag_charts_community73 = require("ag-charts-community"); +var { NODE_UPDATE_STATE_TO_PHASE_MAPPING } = import_ag_charts_community73._ModuleSupport; +function connectorStartingPosition(datum, _prevDatum, isVertical, _mode) { + const { x0, y0, x1, y1, x2, y2, x3, y3, opacity } = datum; + if (isVertical) { + return { + x0: (x0 + x3) / 2, + y0: (y0 + y3) / 2, + x1: (x1 + x2) / 2, + y1: (y1 + y2) / 2, + x2: (x1 + x2) / 2, + y2: (y1 + y2) / 2, + x3: (x0 + x3) / 2, + y3: (y0 + y3) / 2, + opacity + }; + } else { + return { + x0: (x0 + x1) / 2, + y0: (y0 + y1) / 2, + x1: (x0 + x1) / 2, + y1: (y0 + y1) / 2, + x2: (x2 + x3) / 2, + y2: (y2 + y3) / 2, + x3: (x2 + x3) / 2, + y3: (y2 + y3) / 2, + opacity + }; + } +} +function prepareConnectorAnimationFunctions(isVertical, mode) { + const isRemoved = (datum) => datum == null; + const fromFn = (connector, datum, status) => { + if (status === "updated" && isRemoved(datum)) { + status = "removed"; + } else if (status === "updated" && isRemoved(connector.previousDatum)) { + status = "added"; + } + let source; + if (status === "added" && connector.previousDatum == null && mode === "fade") { + source = { ...resetConnectorSelectionsFn(connector, datum), opacity: 0 }; + } else if (status === "unknown" || status === "added") { + source = connectorStartingPosition(datum, connector.previousDatum, isVertical, mode); + } else { + source = { + x0: connector.x0, + y0: connector.y0, + x1: connector.x1, + y1: connector.y1, + x2: connector.x2, + y2: connector.y2, + x3: connector.x3, + y3: connector.y3, + opacity: connector.opacity + }; + } + const phase = NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { ...source, phase }; + }; + const toFn = (connector, datum, status) => { + let source; + if (status === "removed" && connector.datum == null && mode === "fade") { + source = { ...resetConnectorSelectionsFn(connector, datum), opacity: 0 }; + } else if (status === "removed" || isRemoved(datum)) { + source = connectorStartingPosition(datum, connector.previousDatum, isVertical, mode); + } else { + source = resetConnectorSelectionsFn(connector, datum); + } + return source; + }; + return { fromFn, toFn }; +} +function resetConnectorSelectionsFn(_node, datum) { + const { x0, y0, x1, y1, x2, y2, x3, y3, opacity } = datum; + return { x0, y0, x1, y1, x2, y2, x3, y3, opacity }; +} + +// packages/ag-charts-enterprise/src/series/funnel/baseFunnelSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode7, + SeriesZIndexMap, + valueProperty: valueProperty8, + keyProperty: keyProperty7, + ChartAxisDirection: ChartAxisDirection13, + updateLabelNode: updateLabelNode5, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL4, + LARGEST_KEY_INTERVAL: LARGEST_KEY_INTERVAL2, + diff: diff5, + fixNumericExtent: fixNumericExtent6, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation4, + resetMotion: resetMotion2, + resetLabelFn: resetLabelFn4, + animationValidation: animationValidation6, + computeBarFocusBounds: computeBarFocusBounds6, + ContinuousScale: ContinuousScale4, + Group: Group6, + Selection: Selection4, + PointerEvents: PointerEvents4, + motion: motion4, + checkCrisp: checkCrisp3, + createDatumId: createDatumId7, + applyShapeStyle: applyShapeStyle8 +} = import_ag_charts_community74._ModuleSupport; +var FunnelSeriesNodeEvent = class extends import_ag_charts_community74._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.stageKey; + this.yKey = series.properties.valueKey; + } +}; +var BaseFunnelSeries = class extends import_ag_charts_community74._ModuleSupport.AbstractBarSeries { + constructor({ + moduleCtx, + animationResetFns + }) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode7.AXIS_ALIGNED, SeriesNodePickMode7.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["stageKey"], + y: ["valueKey"] + }, + propertyNames: { + x: [], + y: [] + }, + categoryKey: "xValue", + datumSelectionGarbageCollection: false, + animationResetFns: { + datum: animationResetFns.datum, + label: resetLabelFn4 + } + }); + // @ts-expect-error xKey/yKey renamed + this.NodeEvent = FunnelSeriesNodeEvent; + this.connectorNodeGroup = this.contentGroup.appendChild( + new Group6({ + name: `${this.id}-series-connectorNodes`, + zIndex: SeriesZIndexMap.BACKGROUND + }) + ); + this.connectorSelection = Selection4.select( + this.connectorNodeGroup, + () => this.connectionFactory() + ); + this.connectorNodeGroup.pointerEvents = PointerEvents4.None; + } + get pickModeAxis() { + return "main-category"; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.connectorNodeGroup.zIndex = [SeriesZIndexMap.BACKGROUND, zIndex]; + return true; + } + isVertical() { + return !super.isVertical(); + } + connectionFactory() { + return new FunnelConnector(); + } + async processData(dataController) { + const { stageKey, valueKey } = this.properties; + const { visible, id: seriesId } = this; + const validation = (_value, _datum, index) => visible && this.ctx.legendManager.getItemEnabled({ seriesId, itemId: index }); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + if (this.processedData) { + extraProps.push(diff5(this.id, this.processedData)); + } + extraProps.push(animationValidation6()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const { processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty7(stageKey, xScaleType, { id: "xValue" }), + valueProperty8(valueKey, yScaleType, { id: `yValue`, ...visibleProps, validation, invalidValue: 0 }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL4, LARGEST_KEY_INTERVAL2] : [], + ...extraProps + ], + groupByKeys: false + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { + processedData, + dataModel, + id: seriesId, + ctx: { legendManager } + } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys] + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + if (!this.hasData) + return []; + return keys.filter((_key, index) => legendManager.getItemEnabled({ seriesId, itemId: index })); + } + return this.padBandExtent(keys); + } else { + const yExtent = this.domainForClippedRange(direction, ["yValue"], "xValue"); + const maxExtent = Math.max(...yExtent); + const fixedYExtent = [-maxExtent, maxExtent]; + return fixNumericExtent6(fixedYExtent); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { + hasData, + data, + dataModel, + groupScale, + processedData, + id: seriesId, + ctx: { legendManager } + } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(hasData && data && xAxis && yAxis && dataModel && processedData?.type === "ungrouped")) { + return; + } + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection13.X; + const { stageKey, valueKey } = this.properties; + const itemId = `${valueKey}`; + const context = { + itemId, + nodeData: [], + labelData: [], + connectorData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible + }; + const isVisible = this.visible; + if (!isVisible) + return context; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale4.is(xScale) ? barWidth * -0.5 : 0; + const crisp = checkCrisp3( + xAxis?.scale, + xAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + let previousConnection; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const visible = isVisible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + const xDatum = xValues[datumIndex]; + if (xDatum == null) + continue; + const x = Math.round(xScale.convert(xDatum)) + groupScale.convert(String(groupIndex)) + barOffset; + const yDatum = yValues[datumIndex]; + const yNegative = Math.round(yScale.convert(-yDatum)); + const yPositive = Math.round(yScale.convert(yDatum)); + const style = this.getItemStyle({ datum, datumIndex }, false); + const barHeight = Math.max(style.strokeWidth ?? 0, Math.abs(yPositive - yNegative)); + const rect = { + x: barAlongX ? Math.min(yPositive, yNegative) : x, + y: barAlongX ? x : Math.min(yPositive, yNegative), + width: barAlongX ? barHeight : barWidth, + height: barAlongX ? barWidth : barHeight + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const labelData = this.createLabelData({ + datumIndex, + rect, + barAlongX, + yDatum, + datum, + visible + }); + const nodeDatum = { + index: datumIndex, + series: this, + itemId, + datum, + datumIndex, + xValue: xDatum, + yValue: yDatum, + xKey: stageKey, + yKey: valueKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + label: labelData, + visible + }; + context.nodeData.push(nodeDatum); + if (labelData != null) { + context.labelData.push(labelData); + } + if (previousConnection != null) { + const prevRect = previousConnection.rect; + const startNodeDatum = previousConnection.nodeDatum; + const startDatumIndex = previousConnection.datumIndex; + if (barAlongX) { + context.connectorData.push({ + datum: startNodeDatum, + datumIndex: startDatumIndex, + x0: prevRect.x, + y0: prevRect.y + prevRect.height, + x1: prevRect.x + prevRect.width, + y1: prevRect.y + prevRect.height, + x2: rect.x + rect.width, + y2: rect.y, + x3: rect.x, + y3: rect.y, + opacity: 1 + }); + } else { + context.connectorData.push({ + datum: startNodeDatum, + datumIndex: startDatumIndex, + x0: prevRect.x + prevRect.width, + y0: prevRect.y, + x1: rect.x, + y1: rect.y, + x2: rect.x, + y2: rect.y + rect.height, + x3: prevRect.x + prevRect.width, + y3: prevRect.y + prevRect.height, + opacity: 1 + }); + } + } + if (visible) { + previousConnection = { + itemId, + rect, + nodeDatum, + datumIndex + }; + } + } + return context; + } + updateNodes(seriesHighlighted, nodeRefresh) { + super.updateNodes(seriesHighlighted, nodeRefresh); + const { connectorSelection } = this; + const connectorData = this.contextNodeData?.connectorData ?? []; + this.connectorSelection = this.updateConnectorSelection({ connectorSelection, connectorData }); + this.updateConnectorNodes({ connectorSelection }); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data, void 0, (datum) => this.getDatumId(datum)); + } + updateConnectorSelection(opts) { + const { connectorData, connectorSelection } = opts; + return connectorSelection.update( + this.connectorEnabled() ? connectorData : [], + void 0, + (connector) => this.getDatumId(connector.datum) + ); + } + updateConnectorNodes(opts) { + const fillBBox = this.getShapeFillBBox(); + opts.connectorSelection.each((connector, datum) => { + const { fill, fillOpacity, stroke, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.connectorStyle(datum.datumIndex); + connector.setProperties(resetConnectorSelectionsFn(connector, datum)); + applyShapeStyle8( + connector, + { + fill, + stroke, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }, + fillBBox + ); + }); + } + updateLabelSelection(opts) { + const labelData = this.properties.label.enabled ? opts.labelData : []; + return opts.labelSelection.update(labelData, (text) => { + text.pointerEvents = PointerEvents4.None; + }); + } + updateLabelNodes(opts) { + const params = { + stageKey: this.properties.stageKey, + valueKey: this.properties.valueKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + updateLabelNode5(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { stageKey, valueKey, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, "xValue", processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(datumIndex), + data: [ + { + label: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, stageKey, legendItemName), + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, valueKey, legendItemName) + } + ] + }, + { seriesId, datum, title: stageKey, stageKey, valueKey, ...this.tooltipStyle(datum, datumIndex) } + ); + } + resetAllAnimation(data) { + super.resetAllAnimation(data); + resetMotion2([this.connectorSelection], resetConnectorSelectionsFn); + } + animateEmptyUpdateReady({ labelSelection }) { + const { connectorSelection } = this; + const isVertical = this.isVertical(); + const mode = "normal"; + const connectorFns = prepareConnectorAnimationFunctions(isVertical, mode); + motion4.fromToMotion(this.id, "connectors", this.ctx.animationManager, [connectorSelection], connectorFns); + seriesLabelFadeInAnimation4(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const { labelSelection: labelSelections } = data; + this.ctx.animationManager.stopByAnimationGroupId(this.id); + seriesLabelFadeInAnimation4(this, "labels", this.ctx.animationManager, labelSelections); + } + getDatumId(datum) { + return createDatumId7(datum.xValue); + } + isLabelEnabled() { + return this.properties.label.enabled; + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds6(this, this.contextNodeData?.nodeData[datumIndex]); + } + legendItemSymbol(datumIndex) { + const { strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset, fill, stroke } = this.properties.getStyle(datumIndex); + return { + marker: { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id: seriesId, + processedData, + dataModel, + ctx: { legendManager }, + visible + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { showInLegend } = this.properties; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + return (processedData.dataSources.get(this.id)?.data ?? []).map((datum, datumIndex) => { + const stageValue = xValues[datumIndex]; + if (stageValue == null) + return; + return { + legendType: "category", + id: seriesId, + datum, + itemId: datumIndex, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { text: String(stageValue) }, + symbol: this.legendItemSymbol(datumIndex), + skipAnimations: true, + hideInLegend: !showInLegend + }; + }).filter((datum) => datum != null); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelProperties.ts +var import_ag_charts_community75 = require("ag-charts-community"); +var { Label: Label5, AbstractBarSeriesProperties: AbstractBarSeriesProperties5, makeSeriesTooltip: makeSeriesTooltip9, AxisLabel, Property: Property21 } = import_ag_charts_community75._ModuleSupport; +var ConeFunnelSeriesLabel = class extends Label5 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property21 +], ConeFunnelSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property21 +], ConeFunnelSeriesLabel.prototype, "spacing", 2); +var ConeFunnelSeriesStageLabel = class extends AxisLabel { +}; +__decorateClass([ + Property21 +], ConeFunnelSeriesStageLabel.prototype, "placement", 2); +var ConeFunnelProperties = class extends AbstractBarSeriesProperties5 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new ConeFunnelSeriesLabel(); + this.stageLabel = new ConeFunnelSeriesStageLabel(); + this.tooltip = makeSeriesTooltip9(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index], + fillOpacity, + stroke: strokes[index], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "stageKey", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "valueKey", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "fills", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "strokes", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "lineDash", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "label", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelUtil.ts +function resetLineSelectionsFn(_node, { x, y, width, height, opacity }) { + return { x1: x, y1: y, x2: x + width, y2: y + height, opacity: opacity ?? 1 }; +} + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeries.ts +var { Line: Line3, ChartAxisDirection: ChartAxisDirection14 } = import_ag_charts_community76._ModuleSupport; +var ConeFunnelSeries = class extends BaseFunnelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + animationResetFns: { + datum: resetLineSelectionsFn + } + }); + this.properties = new ConeFunnelProperties(); + } + get hasData() { + const { + id: seriesId, + ctx: { legendManager } + } = this; + const visibleItems = this.data?.data.reduce( + (accum, _, datumIndex) => accum + (legendManager.getItemEnabled({ seriesId, itemId: datumIndex }) ? 1 : 0), + 0 + ); + return visibleItems != null && visibleItems > 1; + } + getBandScalePadding() { + return { inner: 1, outer: 0 }; + } + connectorEnabled() { + return true; + } + getItemStyle({ datumIndex }, _isHighlight) { + return this.properties.getStyle(datumIndex); + } + connectorStyle(index) { + return this.properties.getStyle(index); + } + nodeFactory() { + return new Line3(); + } + createLabelData({ + datumIndex, + rect, + barAlongX, + yDatum, + datum, + visible + }) { + const { stageKey, valueKey, label } = this.properties; + const { spacing, placement } = label; + if (!label.enabled) + return; + let x; + let y; + let textAlign; + let textBaseline; + if (barAlongX) { + x = rect.x + rect.width / 2; + textAlign = "center"; + switch (placement) { + case "before": + y = rect.y - spacing; + textBaseline = "bottom"; + break; + case "after": + y = rect.y + rect.height + spacing; + textBaseline = "top"; + break; + default: + y = rect.y + rect.height / 2; + textBaseline = "middle"; + } + } else { + y = rect.y + rect.height / 2; + textBaseline = "middle"; + switch (placement) { + case "before": + x = rect.x - spacing; + textAlign = "right"; + break; + case "after": + x = rect.x + rect.width + spacing; + textAlign = "left"; + break; + default: + x = rect.x + rect.width / 2; + textAlign = "center"; + } + } + const yDomain = this.getSeriesDomain(ChartAxisDirection14.Y); + const text = this.getLabelText( + yDatum, + datum, + valueKey, + "y", + yDomain, + label, + { itemId: valueKey, value: yDatum, datum, stageKey, valueKey } + ); + return { + x, + y, + textAlign, + textBaseline, + text, + itemId: valueKey, + datum, + datumIndex, + series: this, + visible + }; + } + updateDatumNodes(opts) { + const highlightStyle = this.getHighlightStyle(opts.isHighlight); + opts.datumSelection.each((line, datum) => { + line.setProperties(resetLineSelectionsFn(line, datum)); + line.stroke = highlightStyle?.stroke; + line.strokeWidth = highlightStyle?.strokeWidth ?? 0; + line.strokeOpacity = highlightStyle?.strokeOpacity ?? 1; + line.lineDash = highlightStyle?.lineDash; + line.lineDashOffset = highlightStyle?.lineDashOffset ?? 0; + line.opacity = highlightStyle?.opacity ?? 1; + }); + } + tooltipStyle(_datum, datumIndex) { + const { fill, stroke, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties.getStyle(datumIndex); + return { + fill, + fillOpacity, + stroke, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +ConeFunnelSeries.className = "ConeFunnelSeries"; +ConeFunnelSeries.type = "cone-funnel"; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeriesOptionsDef.ts +var import_ag_charts_community77 = require("ag-charts-community"); +var import_ag_charts_core24 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs9, coneFunnelSeriesThemeableOptionsDef, without: without3 } = import_ag_charts_community77._ModuleSupport; +var coneFunnelSeriesOptionsDef = { + ...without3(commonSeriesOptionsDefs9, ["showInLegend"]), + ...coneFunnelSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core24.required)((0, import_ag_charts_core24.constant)("cone-funnel")), + stageKey: (0, import_ag_charts_core24.required)(import_ag_charts_core24.string), + valueKey: (0, import_ag_charts_core24.required)(import_ag_charts_core24.string) +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelThemes.ts +var import_ag_charts_community78 = require("ag-charts-community"); +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE8 } +} = import_ag_charts_community78._ModuleSupport; +var CONE_FUNNEL_SERIES_THEME = { + series: { + direction: "vertical", + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "secondSequentialColors" }, + import_ag_charts_community78._ModuleSupport.SAFE_RANGE2_OPERATION + ] + }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", import_ag_charts_community78._ModuleSupport.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS], + ["pattern", import_ag_charts_community78._ModuleSupport.FILL_PATTERN_SINGLE_DEFAULTS], + ["image", import_ag_charts_community78._ModuleSupport.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "secondSequentialColors" }, + import_ag_charts_community78._ModuleSupport.SAFE_RANGE2_OPERATION + ] + } + ] + }, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + label: { + ...import_ag_charts_community78._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + placement: "before", + spacing: 4 + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: import_ag_charts_community78._ModuleSupport.singleSeriesHighlightStyle(false) + }, + seriesArea: { + padding: { + top: 20, + bottom: 20 + } + }, + axes: { + [CARTESIAN_AXIS_TYPE8.NUMBER]: { + nice: false, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false + }, + label: { + enabled: false + } + }, + [CARTESIAN_AXIS_TYPE8.CATEGORY]: { + line: { + enabled: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelModule.ts +var ConeFunnelSeriesModule = { + type: "series", + name: "cone-funnel", + chartType: "cartesian", + enterprise: true, + options: coneFunnelSeriesOptionsDef, + create: (ctx) => new ConeFunnelSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeries.ts +var import_ag_charts_community80 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/funnel/funnelProperties.ts +var import_ag_charts_community79 = require("ag-charts-community"); +var { Label: Label6, DropShadow: DropShadow4, AbstractBarSeriesProperties: AbstractBarSeriesProperties6, BaseProperties: BaseProperties8, makeSeriesTooltip: makeSeriesTooltip10, AxisLabel: AxisLabel2, Property: Property22 } = import_ag_charts_community79._ModuleSupport; +var FunnelSeriesLabel = class extends Label6 { +}; +var FunnelSeriesStageLabel = class extends AxisLabel2 { +}; +__decorateClass([ + Property22 +], FunnelSeriesStageLabel.prototype, "placement", 2); +var FunnelDropOff = class extends BaseProperties8 { + constructor() { + super(...arguments); + this.enabled = true; + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle() { + const { fill, stroke, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "enabled", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "fill", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "fillOpacity", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "stroke", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "strokeWidth", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "strokeOpacity", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "lineDash", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "lineDashOffset", 2); +var FunnelProperties = class extends AbstractBarSeriesProperties6 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.spacingRatio = 0; + this.dropOff = new FunnelDropOff(); + this.shadow = new DropShadow4().set({ enabled: false }); + this.label = new FunnelSeriesLabel(); + this.stageLabel = new FunnelSeriesStageLabel(); + this.tooltip = makeSeriesTooltip10(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index], + fillOpacity, + stroke: strokes[index], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property22 +], FunnelProperties.prototype, "stageKey", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "valueKey", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "fills", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "strokes", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "lineDash", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "spacingRatio", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "dropOff", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "shadow", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "label", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeries.ts +var { + ChartAxisDirection: ChartAxisDirection15, + resetBarSelectionsFn: resetBarSelectionsFn3, + prepareBarAnimationFunctions: prepareBarAnimationFunctions3, + midpointStartingBarPosition: midpointStartingBarPosition2, + createDatumId: createDatumId8, + Rect: Rect4, + motion: motion5, + applyShapeStyle: applyShapeStyle9, + mergeDefaults: mergeDefaults9 +} = import_ag_charts_community80._ModuleSupport; +var FunnelSeries = class extends BaseFunnelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + animationResetFns: { + datum: resetBarSelectionsFn3 + } + }); + this.properties = new FunnelProperties(); + } + getBandScalePadding() { + return { inner: this.properties.spacingRatio, outer: 0 }; + } + connectorEnabled() { + return this.properties.dropOff.enabled; + } + connectorStyle(index) { + return mergeDefaults9(this.properties.dropOff.getStyle(), this.properties.getStyle(index)); + } + nodeFactory() { + return new Rect4(); + } + createLabelData({ + datumIndex, + rect, + yDatum, + datum, + visible + }) { + const { valueKey, stageKey, label } = this.properties; + if (!label.enabled) + return; + const yDomain = this.getSeriesDomain(ChartAxisDirection15.Y); + const text = this.getLabelText( + yDatum, + datum, + valueKey, + "y", + yDomain, + label, + { itemId: valueKey, value: yDatum, datum, stageKey, valueKey } + ); + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2, + textAlign: "center", + textBaseline: "middle", + text, + itemId: stageKey, + datum, + datumIndex, + series: this, + visible + }; + } + getItemStyle({ datum, datumIndex }, isHighlight) { + const { id: seriesId, properties } = this; + const { stageKey, valueKey, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults9(highlightStyle, properties.getStyle(datumIndex)); + let style = baseStyle; + if (itemStyler != null) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const overrides = this.cachedDatumCallback( + createDatumId8(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState: highlightStateString, + stageKey, + valueKey, + ...style + }); + } + ); + if (overrides) { + style = mergeDefaults9(overrides, style); + } + } + return style; + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { shadow } = this.properties; + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection15.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = this.getItemStyle(datum, isHighlight); + applyShapeStyle9(rect, style, fillBBox); + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + rect.fillShadow = shadow; + }); + } + tooltipStyle(datum, datumIndex) { + return this.getItemStyle({ datum, datumIndex }, false); + } + animateEmptyUpdateReady(params) { + super.animateEmptyUpdateReady(params); + const { datumSelection } = params; + const isVertical = this.isVertical(); + const mode = "normal"; + const barFns = prepareBarAnimationFunctions3(midpointStartingBarPosition2(isVertical, mode), "unknown"); + motion5.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], barFns); + } + animateWaitingUpdateReady(data) { + super.animateWaitingUpdateReady(data); + const { datumSelection: datumSelections } = data; + const { processedData } = this; + const dataDiff = processedData?.reduced?.diff?.[this.id]; + const fns = prepareBarAnimationFunctions3(midpointStartingBarPosition2(this.isVertical(), "fade"), "added"); + motion5.fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [datumSelections], + fns, + (_, datum) => datum.xValue, + dataDiff + ); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +FunnelSeries.className = "FunnelSeries"; +FunnelSeries.type = "funnel"; + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeriesOptionsDef.ts +var import_ag_charts_community81 = require("ag-charts-community"); +var import_ag_charts_core25 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs10, funnelSeriesThemeableOptionsDef, without: without4 } = import_ag_charts_community81._ModuleSupport; +var funnelSeriesOptionsDef = { + ...funnelSeriesThemeableOptionsDef, + ...without4(commonSeriesOptionsDefs10, ["showInLegend"]), + type: (0, import_ag_charts_core25.required)((0, import_ag_charts_core25.constant)("funnel")), + stageKey: (0, import_ag_charts_core25.required)(import_ag_charts_core25.string), + valueKey: (0, import_ag_charts_core25.required)(import_ag_charts_core25.string) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelModule.ts +var FunnelSeriesModule = { + type: "series", + name: "funnel", + chartType: "cartesian", + enterprise: true, + options: funnelSeriesOptionsDef, + create: (ctx) => new FunnelSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeModule.ts +var import_ag_charts_community87 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeries.ts +var import_ag_charts_community86 = require("ag-charts-community"); +var import_ag_charts_core30 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/utils/formatter.ts +var import_ag_charts_community82 = require("ag-charts-community"); +function formatWithContext(ctx, formatter, params) { + return import_ag_charts_community82._ModuleSupport.callWithContext(ctx.chartService, formatter, params); +} + +// packages/ag-charts-enterprise/src/series/gauge-util/datumUnion.ts +var DatumUnion = class { + *[Symbol.iterator]() { + const { node, datum } = this; + if (node && datum) + yield { node, datum }; + } + nodes() { + return this.node ? [this.node] : []; + } + update(datumSelection, group, ctor, nodeUpdater) { + const nodes = datumSelection.nodes(); + if (nodes.length === 0) { + this.node?.remove(); + this.node = void 0; + } else { + if (this.node === void 0) { + this.node = new ctor(); + this.node.fillOpacity = 0; + this.node.strokeOpacity = 0; + group.appendChild(this.node); + } + const first = nodes[0]; + const last = nodes.toReversed().find((n) => n.datum.datum.value > n.datum.datum.segmentStart) ?? nodes.at(-1); + this.node.datum = this.datum = first.datum; + nodeUpdater(this.node, first, last); + } + } +}; + +// packages/ag-charts-enterprise/src/series/gauge-util/label.ts +var import_ag_charts_core26 = require("ag-charts-core"); +var fadeInFns = { + fromFn: () => ({ opacity: 0, phase: "initial" }), + toFn: () => ({ opacity: 1 }) +}; +function formatLabel(value, scale) { + if (value == null) + return ""; + const { min, max } = scale; + const minLog10 = min === 0 ? 0 : Math.ceil(Math.log10(Math.abs(min))); + const maxLog10 = max === 0 ? 0 : Math.ceil(Math.log10(Math.abs(max))); + const dp = Math.max(2 - Math.max(minLog10, maxLog10), 0); + return value.toFixed(dp); +} +function getLabelText(seriesId, ctx, datum, valueOverride) { + if (datum.text != null) + return datum.text; + const value = valueOverride ?? datum.value; + let labelFormat; + if (datum?.formatter != null) { + labelFormat = formatWithContext(ctx, datum.formatter, { seriesId, datum: void 0, value }); + } + return labelFormat == null || (0, import_ag_charts_core26.isArray)(labelFormat) ? labelFormat : String(labelFormat); +} + +// packages/ag-charts-enterprise/src/series/gauge-util/lineMarker.ts +function lineMarker({ path, x, y, size }) { + path.moveTo(x, y - size / 2); + path.lineTo(x, y + size / 2); +} + +// packages/ag-charts-enterprise/src/series/gauge-util/pick.ts +var import_ag_charts_core27 = require("ag-charts-core"); +function pickGaugeNearestDatum(self, point) { + const it = (0, import_ag_charts_core27.iterate)(self.datumUnion.nodes(), self.targetSelection.nodes()); + return self.pickNodeNearestDistantObject(point, it); +} +function pickGaugeFocus(self, opts) { + const others = [ + { data: self.contextNodeData?.nodeData, selection: self.datumUnion }, + { data: self.contextNodeData?.targetData, selection: self.targetSelection } + ].filter((v) => v.data && v.data.length > 0); + const otherIndex = (0, import_ag_charts_core27.clamp)(0, opts.otherIndex + opts.otherIndexDelta, others.length - 1); + if (others.length === 0) + return; + const { data, selection } = others[otherIndex]; + if (data == null || data.length === 0) + return; + const datumIndex = (0, import_ag_charts_core27.clamp)(0, opts.datumIndex, data.length - 1); + const datum = data[datumIndex]; + for (const node of selection) { + if (node.datum === datum) { + const bounds = node.node; + return { bounds, clipFocusBox: true, datum, datumIndex, otherIndex }; + } + } +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeriesProperties.ts +var import_ag_charts_community84 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/gauge-util/segmentation.ts +var import_ag_charts_community83 = require("ag-charts-community"); +var import_ag_charts_core28 = require("ag-charts-core"); +var { BaseProperties: BaseProperties9, Property: Property23 } = import_ag_charts_community83._ModuleSupport; +var GaugeSegmentationIntervalProperties = class extends BaseProperties9 { + getSegments(scale, maxTicks) { + const { values, step, count } = this; + const d0 = Math.min(...scale.domain); + const d1 = Math.max(...scale.domain); + let ticks; + if (values != null) { + const segments = values.filter((v) => v > d0 && v < d1).sort((a, b) => a - b); + ticks = [d0, ...segments, d1]; + } else if (step != null) { + const segments = []; + for (let i = d0; i < d1; i += step) { + segments.push(i); + } + segments.push(d1); + ticks = segments; + } else if (count == null) { + const segments = scale.ticks({ + nice: true, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.filter((v) => v > d0 && v < d1); + ticks = segments == null ? void 0 : [d0, ...segments, d1]; + } else { + const segments = count + 1; + ticks = Array.from({ length: segments + 1 }, (_, i) => i / segments * (d1 - d0) + d0); + } + if (ticks != null && ticks.length > maxTicks) { + import_ag_charts_core28.Logger.warnOnce( + `the configured segmentation results in more than 1 item per pixel, ignoring. Supply a segmentation configuration that results in larger segments or omit this configuration` + ); + ticks = void 0; + } + ticks ?? (ticks = [d0, d1]); + return ticks; + } +}; +__decorateClass([ + Property23 +], GaugeSegmentationIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property23 +], GaugeSegmentationIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property23 +], GaugeSegmentationIntervalProperties.prototype, "count", 2); +var GaugeSegmentationProperties = class extends BaseProperties9 { + constructor() { + super(...arguments); + this.enabled = false; + this.interval = new GaugeSegmentationIntervalProperties(); + this.spacing = 0; + } +}; +__decorateClass([ + Property23 +], GaugeSegmentationProperties.prototype, "enabled", 2); +__decorateClass([ + Property23 +], GaugeSegmentationProperties.prototype, "interval", 2); +__decorateClass([ + Property23 +], GaugeSegmentationProperties.prototype, "spacing", 2); + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeriesProperties.ts +var { + BaseProperties: BaseProperties10, + makeSeriesTooltip: makeSeriesTooltip11, + SeriesProperties: SeriesProperties2, + PropertiesArray: PropertiesArray2, + Property: Property24, + Label: Label7, + AxisLabel: AxisLabel3, + getColorStops +} = import_ag_charts_community84._ModuleSupport; +var LinearGaugeDefaultTargetLabelProperties = class extends Label7 { +}; +__decorateClass([ + Property24 +], LinearGaugeDefaultTargetLabelProperties.prototype, "spacing", 2); +var LinearGaugeTargetProperties = class extends BaseProperties10 { + constructor() { + super(...arguments); + this.value = 0; + this.label = new LinearGaugeDefaultTargetLabelProperties(); + } + getStyle(defaultTarget) { + const { + fill = defaultTarget.fill ?? "black", + fillOpacity = defaultTarget.fillOpacity ?? 1, + stroke = defaultTarget.stroke ?? "black", + strokeWidth = defaultTarget.strokeWidth ?? 0, + strokeOpacity = defaultTarget.strokeOpacity ?? 1, + lineDash = defaultTarget.lineDash ?? [0], + lineDashOffset = defaultTarget.lineDashOffset ?? 0 + } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "text", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "value", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "shape", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "placement", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "spacing", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "size", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "rotation", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "fill", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "stroke", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "lineDash", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "label", 2); +var LinearGaugeBarProperties = class extends BaseProperties10 { + constructor() { + super(...arguments); + this.enabled = true; + this.thicknessRatio = 1; + this.fills = new PropertiesArray2(import_ag_charts_community84._ModuleSupport.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(defaultColorRange, horizontal, scale) { + const { fill, fills, fillMode, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const barFill = fill ?? createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal); + return { + fill: barFill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "enabled", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "thickness", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "thicknessRatio", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "fills", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "fillMode", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "lineDashOffset", 2); +var LinearGaugeScaleIntervalProperties = class extends BaseProperties10 { + constructor() { + super(...arguments); + this.values = void 0; + this.step = void 0; + this.minSpacing = 0; + this.maxSpacing = 1e3; + } +}; +__decorateClass([ + Property24 +], LinearGaugeScaleIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleIntervalProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleIntervalProperties.prototype, "maxSpacing", 2); +var LinearGaugeScaleLabelProperties = class extends AxisLabel3 { + constructor() { + super(...arguments); + this.placement = void 0; + } +}; +__decorateClass([ + Property24 +], LinearGaugeScaleLabelProperties.prototype, "placement", 2); +var LinearGaugeScaleProperties = class extends BaseProperties10 { + constructor() { + super(...arguments); + this.min = 0; + this.max = 1; + this.fills = new PropertiesArray2(import_ag_charts_community84._ModuleSupport.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.defaultFill = "black"; + this.interval = new LinearGaugeScaleIntervalProperties(); + this.label = new LinearGaugeScaleLabelProperties(); + } + getStyle(barEnabled, defaultColorRange, horizontal, scale) { + const { + fill, + fills, + defaultFill, + fillMode, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const scaleFill = fill ?? (barEnabled && fills.length === 0 ? defaultFill : void 0) ?? createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal); + return { + fill: scaleFill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "min", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "max", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "fills", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "fillMode", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "fill", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "stroke", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "defaultFill", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "interval", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "label", 2); +var LinearGaugeLabelProperties = class extends AutoSizedLabel { + constructor() { + super(...arguments); + this.placement = "inside-center"; + this.avoidCollisions = true; + } +}; +__decorateClass([ + Property24 +], LinearGaugeLabelProperties.prototype, "text", 2); +__decorateClass([ + Property24 +], LinearGaugeLabelProperties.prototype, "placement", 2); +__decorateClass([ + Property24 +], LinearGaugeLabelProperties.prototype, "avoidCollisions", 2); +var LinearGaugeSeriesProperties = class extends SeriesProperties2 { + constructor() { + super(...arguments); + this.value = 0; + this.segmentation = new GaugeSegmentationProperties(); + this.defaultColorRange = []; + this.targets = new PropertiesArray2(LinearGaugeTargetProperties); + this.defaultTarget = new LinearGaugeTargetProperties(); + this.defaultScale = new LinearGaugeScaleProperties(); + this.direction = "vertical"; + this.thickness = 1; + this.cornerRadius = 0; + this.cornerMode = "container"; + this.margin = 0; + this.scale = new LinearGaugeScaleProperties(); + this.bar = new LinearGaugeBarProperties(); + this.label = new LinearGaugeLabelProperties(); + this.tooltip = makeSeriesTooltip11(); + } +}; +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "value", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "segmentation", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "targets", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "defaultTarget", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "defaultScale", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "direction", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "thickness", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "cornerMode", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "margin", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "scale", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "bar", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "tooltip", 2); +function createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal) { + const colorStops = getColorStops(fills, defaultColorRange, scale.domain, fillMode); + return { + type: "gradient", + gradient: "linear", + colorSpace: "oklch", + colorStops, + rotation: horizontal ? 90 : 0, + bounds: "series" + }; +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeUtil.ts +var import_ag_charts_community85 = require("ag-charts-community"); +var import_ag_charts_core29 = require("ag-charts-core"); +var { BBox: BBox8 } = import_ag_charts_community85._ModuleSupport; +function datumRect(datum) { + const { x0, y0, x1, y1, horizontalInset, verticalInset } = datum; + const x = Math.min(x0, x1) + horizontalInset; + const y = Math.min(y0, y1) + verticalInset; + const width = Math.max(Math.abs(x1 - x0) - 2 * horizontalInset, 0); + const height = Math.max(Math.abs(y1 - y0) - 2 * verticalInset, 0); + return { x, y, width, height }; +} +function clipBBoxVisibility(datum, clipBBox) { + if (clipBBox == null) + return true; + const rect = datumRect(datum); + const delta3 = 1e-6; + const x0 = rect.x + delta3; + const y0 = rect.y + delta3; + const x1 = rect.x + rect.width - delta3; + const y1 = rect.y + rect.height - delta3; + const clipX0 = clipBBox.x; + const clipX1 = clipBBox.x + clipBBox.width; + const clipY0 = clipBBox.y; + const clipY1 = clipBBox.y + clipBBox.height; + return Math.max(x0, clipX0) <= Math.min(x1, clipX1) && Math.max(y0, clipY0) <= Math.min(y1, clipY1); +} +function hasClipBBox(datum) { + const { clipX0, clipX1, clipY0, clipY1 } = datum; + return clipX0 != null && clipX1 != null || clipY0 != null && clipY1 != null; +} +function computeClipBBox(datum) { + if (!hasClipBBox(datum)) + return; + const { x0, y0, x1, y1 } = datum; + const { x, y, width, height } = datumRect(datum); + let { clipX0, clipX1, clipY0, clipY1 } = datum; + if (clipX0 == null || clipX1 == null) { + clipX0 = x0; + clipX1 = x1; + } + if (clipY0 == null || clipY1 == null) { + clipY0 = y0; + clipY1 = y1; + } + const clipX = Math.min(clipX0, clipX1); + const clipY = Math.min(clipY0, clipY1); + const clipWidth = Math.abs(clipX1 - clipX0); + const clipHeight = Math.abs(clipY1 - clipY0); + clipX0 = Math.max(x, clipX); + clipY0 = Math.max(y, clipY); + clipX1 = Math.min(x + width, clipX + clipWidth); + clipY1 = Math.min(y + height, clipY + clipHeight); + return new BBox8( + Math.min(clipX0, clipX1), + Math.min(clipY0, clipY1), + Math.abs(clipX1 - clipX0), + Math.abs(clipY1 - clipY0) + ); +} +function prepareLinearGaugeSeriesAnimationFunctions(initialLoad, horizontal) { + const phase = initialLoad ? "initial" : "update"; + const node = { + fromFn(sect, datum) { + const previousDatum = sect.previousDatum; + let { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1 } = previousDatum ?? datum; + const { horizontalInset, verticalInset } = datum; + const previousHadClipBBox = previousDatum != null && hasClipBBox(previousDatum); + const nextHasClipBBox = hasClipBBox(datum); + if (previousHadClipBBox && nextHasClipBBox) { + } else if (!previousHadClipBBox && nextHasClipBBox) { + ({ x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1 } = datum); + if (initialLoad) { + if (horizontal) { + clipX1 = datum.clipX0; + } else { + clipY1 = datum.clipY0; + } + } + } else if (previousHadClipBBox && !nextHasClipBBox) { + ({ x0, y0, x1, y1 } = datum); + clipX0 = void 0; + clipY0 = void 0; + clipX1 = void 0; + clipY1 = void 0; + } else if (initialLoad) { + if (horizontal) { + x1 = x0; + } else { + y1 = y0; + } + } + return { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset, phase }; + }, + toFn(_sect, datum) { + const { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset } = datum; + return { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset }; + }, + applyFn(rect, params) { + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, params)); + } + }; + return { node }; +} +function resetLinearGaugeSeriesResetRectFunction(_node, datum) { + const { x, y, width, height } = datumRect(datum); + const clipBBox = computeClipBBox(datum); + const visible = clipBBoxVisibility(datum, clipBBox); + return { x, y, width, height, clipBBox, visible }; +} +var horizontalTextAligns = { + ["Before" /* Before */]: "right", + ["Center" /* Center */]: "center", + ["After" /* After */]: "left" +}; +var verticalTextBaselines = { + ["Before" /* Before */]: "top", + ["Center" /* Center */]: "middle", + ["After" /* After */]: "bottom" +}; +var horizontalAlignFactors = { + ["Before" /* Before */]: -1, + ["Center" /* Center */]: -0.5, + ["After" /* After */]: 0 +}; +var verticalAlignFactors2 = { + ["Before" /* Before */]: 0, + ["Center" /* Center */]: -0.5, + ["After" /* After */]: -1 +}; +function formatLinearGaugeLabels(series, ctx, selection, opts, bboxes, datumOverrides) { + const { seriesRect, gaugeRect, barRect } = bboxes; + const { padding, horizontal } = opts; + selection.each((label, labelDatum) => { + const labelText = getLabelText(series.id, ctx, labelDatum, datumOverrides?.label); + let boundingWidth; + let boundingHeight; + if (labelDatum.placement === "outside-start") { + if (horizontal) { + boundingWidth = gaugeRect.x; + boundingHeight = seriesRect.height; + } else { + boundingWidth = seriesRect.width; + boundingHeight = seriesRect.height - (gaugeRect.y + gaugeRect.height); + } + } else if (labelDatum.placement === "outside-end") { + if (horizontal) { + boundingWidth = seriesRect.width - (gaugeRect.x + gaugeRect.width); + boundingHeight = seriesRect.height; + } else { + boundingWidth = seriesRect.width; + boundingHeight = gaugeRect.y; + } + } else if (labelDatum.avoidCollisions) { + boundingWidth = gaugeRect.width; + boundingHeight = gaugeRect.height; + } + let layout; + if (labelText == null) { + return; + } else if (boundingWidth != null && boundingHeight != null) { + const sizeFittingHeight = () => ({ + width: boundingWidth, + height: boundingHeight, + meta: null + }); + const labelMeta = formatSingleLabel((0, import_ag_charts_core29.toPlainText)(labelText), labelDatum, { padding }, sizeFittingHeight); + layout = labelMeta?.[0]; + } else { + const measurer = (0, import_ag_charts_core29.cachedTextMeasurer)(labelDatum); + const { width, height } = (0, import_ag_charts_core29.isArray)(labelText) ? (0, import_ag_charts_core29.measureTextSegments)(labelText, labelDatum) : measurer.measureLines(labelText); + layout = { + text: labelText, + fontSize: labelDatum.fontSize, + lineHeight: labelDatum.lineHeight ?? measurer.lineHeight(), + width, + height + }; + } + if (layout == null) { + label.visible = false; + return; + } + const scale0 = horizontal ? gaugeRect.x : gaugeRect.y + gaugeRect.height; + const scale1 = horizontal ? gaugeRect.x + gaugeRect.width : gaugeRect.y; + const bar0 = horizontal ? barRect.x : barRect.y + barRect.height; + const bar1 = horizontal ? barRect.x + barRect.width : barRect.y; + const offset = labelDatum.spacing * (horizontal ? 1 : -1); + let bounds0; + let bounds1; + let s; + let align; + switch (labelDatum.placement) { + case "outside-start": + bounds0 = -Infinity; + bounds1 = Infinity; + s = scale0 - offset; + align = "Before" /* Before */; + break; + case "outside-end": + bounds0 = -Infinity; + bounds1 = Infinity; + s = scale1 + offset; + align = "After" /* After */; + break; + case "inside-start": + bounds0 = scale0; + bounds1 = bar1; + s = scale0 + offset; + align = "After" /* After */; + break; + case "inside-end": + bounds0 = bar1; + bounds1 = scale1; + s = scale1 - offset; + align = "Before" /* Before */; + break; + case "inside-center": + bounds0 = scale0; + bounds1 = scale1; + s = (scale0 + scale1) / 2; + align = "Center" /* Center */; + break; + case "bar-inside": + bounds0 = bar0; + bounds1 = bar1; + s = (bar0 + bar1) / 2; + align = "Center" /* Center */; + break; + case "bar-inside-end": + bounds0 = bar0; + bounds1 = bar1; + s = bar1 - offset; + align = "Before" /* Before */; + break; + case "bar-outside-end": + bounds0 = bar1; + bounds1 = scale1; + s = bar1 + offset; + align = "After" /* After */; + break; + case "bar-end": + bounds0 = -Infinity; + bounds1 = Infinity; + s = bar1; + align = "Center" /* Center */; + break; + } + const x = horizontal ? s : gaugeRect.x + gaugeRect.width / 2; + const y = horizontal ? gaugeRect.y + gaugeRect.height / 2 : s; + let s0; + let s1; + if (horizontal) { + s0 = x + horizontalAlignFactors[align] * layout.width; + s1 = s0 + layout.width; + } else { + s0 = y + verticalAlignFactors2[align] * layout.height; + s1 = s0 + layout.height; + } + const inside = Math.min(s0, s1) >= Math.min(bounds0, bounds1) && Math.max(s0, s1) <= Math.max(bounds0, bounds1); + if (labelDatum.avoidCollisions && !inside) { + label.visible = false; + return; + } + label.visible = true; + label.text = layout.text; + label.fontSize = layout.fontSize; + label.lineHeight = layout.lineHeight; + label.textAlign = horizontal ? horizontalTextAligns[align] : "center"; + label.textBaseline = horizontal ? "middle" : verticalTextBaselines[align]; + label.x = x; + label.y = y; + }); +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeries.ts +var { + fromToMotion: fromToMotion2, + resetMotion: resetMotion3, + SeriesNodePickMode: SeriesNodePickMode8, + StateMachine, + createDatumId: createDatumId9, + toRadians: toRadians3, + BBox: BBox9, + Group: Group7, + PointerEvents: PointerEvents5, + Selection: Selection5, + Rect: Rect5, + Text, + TransformableText: TransformableText2, + Marker: Marker2, + LinearScale: LinearScale3, + generateTicks: generateTicks2, + NiceMode, + easing, + findRangeExtent, + tickFormat, + mergeDefaults: mergeDefaults10, + applyShapeStyle: applyShapeStyle10 +} = import_ag_charts_community86._ModuleSupport; +var horizontalTargetPlacementRotation = { + before: 180, + middle: 0, + after: 0 +}; +var verticalTargetPlacementRotation = { + before: 90, + middle: 0, + after: -90 +}; +var LinearGaugeSeries = class extends import_ag_charts_community86._ModuleSupport.Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode8.EXACT_SHAPE_MATCH, SeriesNodePickMode8.NEAREST_NODE] + }); + this.properties = new LinearGaugeSeriesProperties(); + this.seriesRect = BBox9.NaN; + this.gaugeRect = BBox9.NaN; + this.scale = new LinearScale3(); + this.originX = 0; + this.originY = 0; + this.scaleGroup = this.contentGroup.appendChild(new Group7({ name: "scaleGroup" })); + this.itemGroup = this.contentGroup.appendChild(new Group7({ name: "itemGroup" })); + this.itemTargetGroup = this.contentGroup.appendChild(new Group7({ name: "itemTargetGroup" })); + this.itemTargetLabelGroup = this.contentGroup.appendChild(new Group7({ name: "itemTargetLabelGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group7({ name: "itemLabelGroup" })); + this.highlightTargetGroup = this.highlightGroup.appendChild( + new Group7({ name: "itemTargetLabelGroup" }) + ); + this.tickGroup = this.contentGroup.appendChild(new Group7({ name: "tickGroup" })); + this.scaleSelection = Selection5.select( + this.scaleGroup, + () => this.nodeFactory() + ); + this.datumSelection = Selection5.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.targetSelection = Selection5.select( + this.itemTargetGroup, + () => this.markerFactory() + ); + this.targetLabelSelection = Selection5.select(this.itemTargetLabelGroup, Text); + this.labelSelection = Selection5.select( + this.itemLabelGroup, + Text + ); + this.highlightTargetSelection = Selection5.select(this.highlightTargetGroup, () => this.markerFactory()); + this.tickSelection = Selection5.select(this.tickGroup, TransformableText2); + this.datumUnion = new DatumUnion(); + this.animationState = new StateMachine("empty", { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.animateReadyResize(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateWaitingUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty" + }, + reset: "empty", + skip: "ready" + } + }); + this.scaleGroup.pointerEvents = PointerEvents5.None; + this.tickGroup.pointerEvents = PointerEvents5.None; + } + get range() { + return this.horizontal ? [0, this.gaugeRect.width] : [0, this.gaugeRect.height]; + } + get horizontal() { + return this.properties.direction === "horizontal"; + } + get hasData() { + return true; + } + nodeFactory() { + const rect = new Rect5(); + rect.crisp = true; + return rect; + } + markerFactory() { + return new Marker2(); + } + processData() { + this.nodeDataRefresh = true; + this.animationState.transition("updateData"); + } + formatLabel(value) { + return formatLabel(value, this.properties.scale); + } + getShapeFillBBox() { + const { properties, originX, originY, horizontal, scale } = this; + const { thickness } = properties; + const length = findRangeExtent(scale.range); + const bbox = new BBox9(originX, originY, horizontal ? length : thickness, horizontal ? thickness : length); + return { + axis: bbox, + series: bbox + }; + } + getTargets() { + const { properties } = this; + const defaultTarget = properties.defaultTarget; + return Array.from(properties.targets).map((target) => { + const { + text = defaultTarget.text, + value = defaultTarget.value ?? 0, + shape = defaultTarget.shape ?? "triangle", + rotation = defaultTarget.rotation ?? 0, + placement = defaultTarget.placement ?? "middle", + spacing = defaultTarget.spacing ?? 0, + size = defaultTarget.size ?? 0 + } = target; + const { + enabled: labelEnabled = defaultTarget.label.enabled, + color: labelColor = defaultTarget.label.color ?? "black", + fontStyle: labelFontStyle = defaultTarget.label.fontStyle ?? "normal", + fontWeight: labelFontWeight = defaultTarget.label.fontWeight ?? "normal", + fontSize: labelFontSize = defaultTarget.label.fontSize, + fontFamily: labelFontFamily = defaultTarget.label.fontFamily, + spacing: labelSpacing = defaultTarget.label.spacing ?? 0 + } = target.label; + return { + text, + value, + shape, + placement, + spacing, + size, + rotation, + label: { + enabled: labelEnabled, + color: labelColor, + fontStyle: labelFontStyle, + fontWeight: labelFontWeight, + fontSize: labelFontSize, + fontFamily: labelFontFamily, + spacing: labelSpacing + }, + style: target.getStyle(defaultTarget) + }; + }); + } + getTargetPoint(target) { + const { properties, originX, originY, horizontal, scale, gaugeRect } = this; + const { thickness } = properties; + const { value, placement, spacing, size } = target; + const mainOffset = scale.convert(value); + let crossOffset; + switch (placement) { + case "before": + crossOffset = -(spacing + size / 2); + break; + case "after": + crossOffset = thickness + spacing + size / 2; + break; + default: + crossOffset = thickness / 2; + break; + } + return { + x: originX + gaugeRect.x + (horizontal ? mainOffset : crossOffset), + y: originY + gaugeRect.y + (horizontal ? crossOffset : mainOffset) + }; + } + getTargetLabel(target) { + const { size, placement, label } = target; + const { spacing, color: fill, fontStyle, fontWeight, fontSize, fontFamily } = label; + const lineHeight = void 0; + const offset = size / 2 + spacing; + let textAlign; + let textBaseline; + let offsetX = 0; + let offsetY = 0; + if (this.horizontal) { + textAlign = "center"; + if (placement === "after") { + textBaseline = "top"; + offsetY = offset; + } else { + textBaseline = "bottom"; + offsetY = -offset; + } + } else { + textBaseline = "middle"; + if (placement === "before") { + textAlign = "right"; + offsetX = -offset; + } else { + textAlign = "left"; + offsetX = offset; + } + } + return { + offsetX, + offsetY, + fill, + textAlign, + textBaseline, + fontStyle, + fontWeight, + fontSize, + fontFamily, + lineHeight + }; + } + labelDatum(label, value) { + const { + placement, + avoidCollisions, + spacing, + text, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + wrapping, + overflowStrategy, + formatter = (params) => this.formatLabel(params.value) + } = label; + return { + placement, + avoidCollisions, + spacing, + text, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + wrapping, + overflowStrategy, + formatter + }; + } + verticalLabelInset() { + const { label } = this.properties; + const measurer = (0, import_ag_charts_core30.cachedTextMeasurer)(label); + const lines = label.text?.split("\n"); + const labelSize = (label.lineHeight ?? measurer.lineHeight()) * (lines?.length ?? 1); + return label.spacing + labelSize; + } + horizontalLabelInset() { + const { scale, properties } = this; + const { scale: scaleProps, label } = properties; + const lines = label.text?.split("\n"); + const measurer = (0, import_ag_charts_core30.cachedTextMeasurer)(label); + const ticks = scaleProps.interval.values ?? scale.ticks({ + nice: false, + interval: scaleProps.interval.step, + minTickCount: 0, + maxTickCount: 6, + tickCount: 5 + })?.ticks ?? []; + const linesOrTicks = lines ?? ticks?.map((tick) => getLabelText(this.id, this.ctx, this.labelDatum(label, tick)) ?? ""); + const labelSize = linesOrTicks.reduce((accum, text) => { + const { width } = (0, import_ag_charts_core30.isArray)(text) ? (0, import_ag_charts_core30.measureTextSegments)(text, label) : measurer.measureLines(text); + return Math.max(accum, width); + }, 0); + return label.spacing + labelSize; + } + tickFormatter(domain, ticks) { + const { format, formatter } = this.properties.scale.label; + let tickFormatter; + if (format != null) { + tickFormatter = tickFormat(ticks, typeof format === "string" ? format : void 0); + } + return (value, index) => { + let r = void 0; + if (formatter) { + r ?? (r = formatWithContext(this.ctx, formatter, { value, index, domain, boundSeries: void 0 })); + } + r ?? (r = tickFormatter?.(value)); + return r ?? this.formatLabel(value); + }; + } + createNodeData() { + const { id: seriesId, properties, horizontal, scale, seriesRect } = this; + const { + value, + segmentation, + thickness, + cornerRadius, + cornerMode, + bar, + scale: scaleProps, + label, + defaultColorRange + } = properties; + scale.domain = [scaleProps.min, scaleProps.max]; + scale.range = horizontal ? [0, seriesRect.width] : [seriesRect.height, 0]; + let axisRotation; + let sideFlag; + if (horizontal) { + sideFlag = 1; + axisRotation = Math.PI / 2; + } else if (scaleProps.label.placement === "before") { + sideFlag = 1; + axisRotation = 0; + } else { + sideFlag = -1; + axisRotation = 0; + } + let x0; + let x1; + let y0; + let y1; + if (horizontal) { + x0 = 0; + x1 = seriesRect.width; + y0 = (seriesRect.height - thickness) / 2; + y1 = y0 + thickness; + if (label.placement === "outside-start") { + x0 += this.horizontalLabelInset(); + } else if (label.placement === "outside-end") { + x1 -= this.horizontalLabelInset(); + } + } else { + x0 = (seriesRect.width - thickness) / 2; + x1 = x0 + thickness; + y1 = 0; + y0 = seriesRect.height; + if (label.placement === "outside-start") { + y0 -= this.verticalLabelInset(); + } else if (label.placement === "outside-end") { + y1 += this.verticalLabelInset(); + } + } + this.gaugeRect = new BBox9(Math.min(x0, x1), Math.min(y0, y1), Math.abs(x1 - x0), Math.abs(y1 - y0)); + const originX = 0; + const originY = 0; + scale.domain = [scaleProps.min, scaleProps.max]; + scale.range = horizontal ? [x0, x1] : [y0, y1]; + const { + tickData: { ticks: tickData } + } = generateTicks2({ + scale, + label: this.properties.scale.label, + interval: this.properties.scale.interval, + tickFormatter: (domain, ticks) => this.tickFormatter(domain, ticks), + domain: scale.domain, + range: this.range, + reverse: false, + primaryTickCount: void 0, + defaultTickMinSpacing: 0, + visibleRange: [0, 1], + niceMode: NiceMode.Off, + labelOffset: 0, + axisRotation, + sideFlag + }); + const isReversed = false; + const targets = this.getTargets(); + const nodeData = []; + const targetData = []; + const labelData = []; + const scaleData = []; + const [m0, m1] = scale.range; + const mainAxisSize = Math.abs(m1 - m0); + const containerX = horizontal ? scale.convert(value) : x1; + const containerY = horizontal ? y1 : scale.convert(value); + const inset = segmentation.enabled ? segmentation.spacing / 2 : 0; + const horizontalInset = horizontal ? inset : 0; + const verticalInset = horizontal ? 0 : inset; + const barThickness = Math.min(bar.thickness ?? Math.round(bar.thicknessRatio * thickness), thickness); + const barInset = -(thickness - barThickness) / 2; + const barXInset = horizontal ? 0 : barInset; + const barYInset = horizontal ? barInset : 0; + const cornersOnAllItems = cornerMode === "item"; + const maxTicks = Math.ceil(mainAxisSize); + let segments = segmentation.enabled ? segmentation.interval.getSegments(scale, maxTicks) : void 0; + const barStyle = bar.getStyle(defaultColorRange, horizontal, scale); + const scaleStyle = scaleProps.getStyle(bar.enabled, defaultColorRange, horizontal, scale); + if (segments == null && cornersOnAllItems) { + const segmentStart = Math.min(...scale.domain); + const segmentEnd = Math.max(...scale.domain); + const datum = { value, segmentStart, segmentEnd }; + if (bar.enabled) { + const barAppliedCornerRadius = Math.min(cornerRadius, barThickness / 2, mainAxisSize / 2); + const barCornerInset = barAppliedCornerRadius * (isReversed ? -1 : 1); + const barCornerXInset = horizontal ? barCornerInset : 0; + const barCornerYInset = horizontal ? 0 : barCornerInset; + nodeData.push({ + series: this, + itemId: `value`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + x0 - barCornerXInset - barXInset, + y0: originY + y0 - barCornerYInset - barYInset, + x1: originX + containerX + barCornerXInset + barXInset, + y1: originY + containerY + barCornerYInset + barYInset, + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius: cornerRadius, + topRightCornerRadius: cornerRadius, + bottomRightCornerRadius: cornerRadius, + bottomLeftCornerRadius: cornerRadius, + horizontalInset, + verticalInset, + style: barStyle + }); + } + const scaleAppliedCornerRadius = Math.min(cornerRadius, thickness / 2, mainAxisSize / 2); + const scaleCornerInset = scaleAppliedCornerRadius * (isReversed ? -1 : 1); + const scaleCornerXInset = horizontal ? scaleCornerInset : 0; + const scaleCornerYInset = horizontal ? 0 : scaleCornerInset; + scaleData.push({ + series: this, + itemId: `scale`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + x0 - scaleCornerXInset, + y0: originY + y0 - scaleCornerYInset, + x1: originX + x1 + scaleCornerXInset, + y1: originY + y1 + scaleCornerYInset, + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius: cornerRadius, + topRightCornerRadius: cornerRadius, + bottomRightCornerRadius: cornerRadius, + bottomLeftCornerRadius: cornerRadius, + horizontalInset, + verticalInset, + style: scaleStyle + }); + } else { + segments ?? (segments = scale.domain); + const clipX0 = originX + x0 - barXInset; + const clipY0 = originY + y0 - barYInset; + const clipX1 = originX + containerX + barXInset; + const clipY1 = originY + containerY + barYInset; + for (let i = 0; i < segments.length - 1; i += 1) { + const segmentStart = segments[i + 0]; + const segmentEnd = segments[i + 1]; + const datum = { value, segmentStart, segmentEnd }; + const isStart = i === 0; + const isEnd = i === segments.length - 2; + const itemStart = scale.convert(segmentStart); + const itemEnd = scale.convert(segmentEnd); + const startCornerRadius = cornersOnAllItems || isStart ? cornerRadius : 0; + const endCornerRadius = cornersOnAllItems || isEnd ? cornerRadius : 0; + const topLeftCornerRadius = horizontal ? startCornerRadius : endCornerRadius; + const topRightCornerRadius = endCornerRadius; + const bottomRightCornerRadius = horizontal ? endCornerRadius : startCornerRadius; + const bottomLeftCornerRadius = startCornerRadius; + if (bar.enabled) { + nodeData.push({ + series: this, + itemId: `value-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + (horizontal ? itemStart : x0), + y0: originY + (horizontal ? y0 : itemStart), + x1: originX + (horizontal ? itemEnd : x1), + y1: originY + (horizontal ? y1 : itemEnd), + clipX0, + clipY0, + clipX1, + clipY1, + topLeftCornerRadius, + topRightCornerRadius, + bottomRightCornerRadius, + bottomLeftCornerRadius, + horizontalInset, + verticalInset, + style: barStyle + }); + } + scaleData.push({ + series: this, + itemId: `scale-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + (horizontal ? itemStart : x0), + y0: originY + (horizontal ? y0 : itemStart), + x1: originX + (horizontal ? itemEnd : x1), + y1: originY + (horizontal ? y1 : itemEnd), + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius, + topRightCornerRadius, + bottomRightCornerRadius, + bottomLeftCornerRadius, + horizontalInset, + verticalInset, + style: scaleStyle + }); + } + } + if (label.enabled) { + labelData.push(this.labelDatum(label, value)); + } + const targetPlacementRotation2 = horizontal ? horizontalTargetPlacementRotation : verticalTargetPlacementRotation; + for (let i = 0; i < targets.length; i += 1) { + const target = targets[i]; + const { value: targetValue, text, shape, size, style } = target; + const targetPoint = this.getTargetPoint(target); + const targetRotation = toRadians3(target.rotation + targetPlacementRotation2[target.placement]); + targetData.push({ + series: this, + itemId: `target-${i}`, + midPoint: targetPoint, + datum: { value: targetValue }, + datumIndex: { type: 1 /* Target */, index: i }, + type: 1 /* Target */, + value: targetValue, + text, + x: targetPoint.x, + y: targetPoint.y, + shape, + size, + rotation: targetRotation, + label: this.getTargetLabel(target), + style + }); + } + return { + itemId: seriesId, + nodeData, + tickData, + targetData, + labelData, + scaleData + }; + } + updateSelections(resize) { + if (this.nodeDataRefresh || resize) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + highlightDatum(node) { + if (node != null && node.series === this && node.type === 1 /* Target */) { + return node; + } + } + update({ seriesRect }) { + const { + datumSelection, + labelSelection, + targetSelection, + targetLabelSelection, + scaleSelection, + highlightTargetSelection, + tickSelection + } = this; + this.seriesRect = seriesRect ?? BBox9.NaN; + const resize = this.checkResize(seriesRect); + this.updateSelections(resize); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const targetData = this.contextNodeData?.targetData ?? []; + const scaleData = this.contextNodeData?.scaleData ?? []; + const tickData = this.contextNodeData?.tickData ?? []; + const highlightTargetDatum = this.highlightDatum(this.ctx.highlightManager.getActiveHighlight()); + this.scaleSelection = this.updateScaleSelection({ scaleData, scaleSelection }); + this.updateScaleNodes({ scaleSelection }); + this.targetSelection = this.updateTargetSelection({ targetData, targetSelection }); + this.updateTargetNodes({ targetSelection, isHighlight: false }); + this.targetLabelSelection = this.updateTargetLabelSelection({ targetData, targetLabelSelection }); + this.updateTargetLabelNodes({ targetLabelSelection }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightTargetSelection = this.updateTargetSelection({ + targetData: highlightTargetDatum == null ? [] : [highlightTargetDatum], + targetSelection: highlightTargetSelection + }); + this.updateTargetNodes({ targetSelection: highlightTargetSelection, isHighlight: true }); + this.tickSelection = this.updateTickSelection({ tickData, tickSelection }); + this.updateTickNodes({ tickSelection }); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => { + return createDatumId9(opts.nodeData.length, datum.itemId); + }); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + const { ctx } = this; + const animationDisabled = ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle10(rect, datum.style, fillBBox); + rect.topLeftCornerRadius = topLeftCornerRadius; + rect.topRightCornerRadius = topRightCornerRadius; + rect.bottomRightCornerRadius = bottomRightCornerRadius; + rect.bottomLeftCornerRadius = bottomLeftCornerRadius; + rect.pointerEvents = this.properties.bar.enabled ? import_ag_charts_community86._ModuleSupport.PointerEvents.All : import_ag_charts_community86._ModuleSupport.PointerEvents.None; + if (animationDisabled || rect.previousDatum == null) { + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + } + }); + const { horizontal } = this; + this.datumUnion.update(datumSelection, this.itemGroup, import_ag_charts_community86._ModuleSupport.Rect, (node, first, last) => { + const left = Math.min(first.x, last.x); + const right = Math.max(first.x + first.width, last.x + last.width); + const top = Math.min(first.y, last.y); + const bottom = Math.max(first.y + first.height, last.y + last.height); + const width = right - left; + const height = bottom - top; + node.pointerEvents = import_ag_charts_community86._ModuleSupport.PointerEvents.None; + node.x = left; + node.y = top; + node.width = width; + node.height = height; + node.topLeftCornerRadius = horizontal ? first.topLeftCornerRadius : last.topLeftCornerRadius; + node.topRightCornerRadius = last.topRightCornerRadius; + node.bottomRightCornerRadius = horizontal ? last.bottomRightCornerRadius : first.bottomRightCornerRadius; + node.bottomLeftCornerRadius = first.bottomLeftCornerRadius; + const firstClipBBox = first.clipBBox; + const lastClipBBox = last.clipBBox ?? firstClipBBox; + if (firstClipBBox && lastClipBBox) { + node.clipBBox = BBox9.merge([firstClipBBox, lastClipBBox]).intersection( + horizontal ? new BBox9(left, -Infinity, width, Infinity) : new BBox9(-Infinity, top, Infinity, height) + ); + } else { + node.clipBBox = void 0; + } + }); + } + updateScaleSelection(opts) { + return opts.scaleSelection.update(opts.scaleData, void 0, (datum) => { + return createDatumId9(opts.scaleData.length, datum.itemId); + }); + } + updateScaleNodes(opts) { + const { scaleSelection } = opts; + const fillBBox = this.getShapeFillBBox(); + scaleSelection.each((rect, datum) => { + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle10(rect, datum.style, fillBBox); + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + rect.topLeftCornerRadius = topLeftCornerRadius; + rect.topRightCornerRadius = topRightCornerRadius; + rect.bottomRightCornerRadius = bottomRightCornerRadius; + rect.bottomLeftCornerRadius = bottomLeftCornerRadius; + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + }); + } + updateTargetSelection(opts) { + return opts.targetSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetNodes(opts) { + const { targetSelection, isHighlight } = opts; + targetSelection.each((target, datum) => { + const { x, y, shape, size, rotation } = datum; + const style = this.getTargetStyle(isHighlight, datum); + applyShapeStyle10(target, style); + target.size = size; + target.shape = shape === "line" ? lineMarker : shape; + target.translationX = x; + target.translationY = y; + target.rotation = rotation; + }); + } + getTargetStyle(isHighlight, { datumIndex, style }) { + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + return mergeDefaults10(highlightStyle, { + ...style, + opacity: 1 + }); + } + updateTargetLabelSelection(opts) { + return opts.targetLabelSelection.update(opts.targetData); + } + updateTargetLabelNodes(opts) { + const { targetLabelSelection } = opts; + targetLabelSelection.each((label, target) => { + const { x, y, text } = target; + const { offsetX, offsetY, fill, fontStyle, fontWeight, fontSize, fontFamily, textAlign, textBaseline } = target.label; + label.visible = true; + label.x = x + offsetX; + label.y = y + offsetY; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + }); + } + updateTickSelection(opts) { + return opts.tickSelection.update(opts.tickData, void 0, (datum) => datum.tickId); + } + updateTickNodes(opts) { + const { gaugeRect, properties } = this; + const defaultScale = properties.defaultScale; + const { + enabled, + color: color6, + fontFamily = defaultScale.label.fontFamily, + fontSize = defaultScale.label.fontSize, + fontStyle, + fontWeight = defaultScale.label.fontWeight, + spacing + } = properties.scale.label; + let { placement } = properties.scale.label; + const rotation = toRadians3(properties.scale.label.rotation ?? 0); + let textAlign; + let textBaseline; + let textX; + let textY; + if (this.horizontal) { + placement ?? (placement = "after"); + textAlign = "center"; + textBaseline = placement === "before" ? "bottom" : "top"; + textY = this.originY + gaugeRect.y + (placement === "before" ? -spacing : gaugeRect.height + spacing); + } else { + placement ?? (placement = "before"); + textAlign = placement === "before" ? "end" : "start"; + textBaseline = "middle"; + textX = this.originX + gaugeRect.x + (placement === "before" ? -spacing : gaugeRect.width + spacing); + } + opts.tickSelection.each((label, datum) => { + if (!enabled) { + label.visible = false; + return; + } + const x = textX ?? datum.translation; + const y = textY ?? datum.translation; + label.visible = true; + label.text = datum.tickLabel; + label.fill = color6; + label.fontFamily = fontFamily; + label.fontSize = fontSize; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.textBaseline = textBaseline; + label.textAlign = textAlign; + label.x = x; + label.y = y; + label.rotationCenterX = x; + label.rotationCenterY = y; + label.rotation = rotation; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(opts.labelData, void 0, (_datum) => "primary"); + } + updateLabelNodes(opts) { + const { labelSelection } = opts; + const animationDisabled = this.ctx.animationManager.isSkipped(); + labelSelection.each((label, datum) => { + label.fill = datum.fill; + label.fontStyle = datum.fontStyle; + label.fontWeight = datum.fontWeight; + label.fontFamily = datum.fontFamily; + }); + if (animationDisabled || this.labelsHaveExplicitText()) { + this.formatLabelText(); + } + } + labelsHaveExplicitText() { + for (const { datum } of this.labelSelection) { + if (datum.text == null) { + return false; + } + } + return true; + } + formatLabelText(datum) { + const { labelSelection, horizontal, scale, seriesRect, gaugeRect } = this; + const { x, y, width, height } = gaugeRect; + const value = datum?.label ?? this.properties.value; + let barRect; + if (horizontal) { + const xValue2 = scale.convert(value); + barRect = new BBox9(x, y, xValue2 - x, height); + } else { + const yValue = scale.convert(value); + barRect = new BBox9(x, yValue, width, height - yValue); + } + const bboxes = { seriesRect, gaugeRect, barRect }; + const { margin: padding } = this.properties; + formatLinearGaugeLabels(this, this.ctx, labelSelection, { padding, horizontal }, bboxes, datum); + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + resetMotion3([this.datumSelection], resetLinearGaugeSeriesResetRectFunction); + this.formatLabelText(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + animateLabelText(params = {}) { + const { animationManager } = this.ctx; + let labelFrom = 0; + let labelTo = 0; + this.labelSelection.each((label, datum) => { + label.opacity = 1; + labelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + labelTo = datum.value; + }); + if (this.labelsHaveExplicitText()) { + } else if (labelFrom === labelTo) { + this.formatLabelText({ label: labelTo }); + } else { + const animationId = `${this.id}_labels`; + animationManager.animate({ + id: animationId, + groupId: "label", + from: { label: labelFrom }, + to: { label: labelTo }, + phase: params.phase ?? "update", + ease: easing.easeOut, + onUpdate: (datum) => this.formatLabelText(datum), + onStop: () => this.formatLabelText({ label: labelTo }) + }); + } + } + animateEmptyUpdateReady() { + const { animationManager } = this.ctx; + const { node } = prepareLinearGaugeSeriesAnimationFunctions(true, this.horizontal); + fromToMotion2(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion2(this.id, "label", animationManager, [this.labelSelection], fadeInFns, () => "primary"); + this.animateLabelText({ from: 0, phase: "initial" }); + } + animateWaitingUpdateReady() { + const { animationManager } = this.ctx; + const { node } = prepareLinearGaugeSeriesAnimationFunctions(false, this.horizontal); + fromToMotion2(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + this.animateLabelText(); + } + animateReadyResize() { + this.resetAllAnimation(); + } + getSeriesDomain() { + return [0, 1]; + } + dataCount() { + return Number.NaN; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData() { + return []; + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties } = this; + const { tooltip } = properties; + if (datumIndex == null) + return; + let value; + let text; + let fallbackLabel; + if (datumIndex.type === 0 /* Node */) { + value = properties.value; + text = properties.label.text; + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeValue"); + } else { + ({ value, text } = properties.targets[datumIndex.index]); + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeTarget"); + } + if (value == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + data: [{ label: text, fallbackLabel, value: this.formatLabel(value) }] + }, + { seriesId, title: void 0, datum: void 0, value } + ); + } + pickNodeClosestDatum(point) { + return pickGaugeNearestDatum(this, point); + } + pickFocus(opts) { + return pickGaugeFocus(this, opts); + } + getCaptionText() { + return this.formatLabel(this.properties.value); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +LinearGaugeSeries.className = "LinearGaugeSeries"; +LinearGaugeSeries.type = "linear-gauge"; + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeModule.ts +var LinearGaugeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "linear-gauge", + moduleFactory: (ctx) => new LinearGaugeSeries(ctx), + themeTemplate: { + minWidth: 200, + minHeight: 200, + tooltip: { + enabled: false + }, + series: { + thickness: 50, + defaultColorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $interpolate: [{ $palette: "secondDivergingColors" }, 5] }, + import_ag_charts_community87._ModuleSupport.SAFE_RANGE2_OPERATION + ] + }, + scale: { + // @ts-expect-error undocumented option + defaultFill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + stroke: { $path: ["/2", import_ag_charts_community87._ModuleSupport.SAFE_STROKE_FILL_OPERATION, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + spacing: 11 + } + }, + bar: { + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + segmentation: { + enabled: false, + interval: {}, + spacing: 1 + }, + defaultTarget: { + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + size: 10, + shape: "triangle", + placement: "after", + spacing: 5, + label: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 5 + } + }, + defaultScale: { + label: { + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + } + }, + label: { + ...import_ag_charts_community87._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + placement: "inside-start", + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: 2 }, + minimumFontSize: import_ag_charts_community87._ModuleSupport.FONT_SIZE.SMALL, + spacing: 18, + color: { $ref: "chartBackgroundColor" } + }, + margin: 4, + tooltip: { + range: { $path: ["/tooltip/range", 10] } + } + } + } +}; +var LinearGaugeSeriesModule = { + type: "series", + name: "linear-gauge", + chartType: "standalone", + enterprise: true, + options: import_ag_charts_community87._ModuleSupport.linearGaugeSeriesOptionsDef, + create: (ctx) => new LinearGaugeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineModule.ts +var import_ag_charts_community96 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/map-util/mapThemeDefaults.ts +var import_ag_charts_community88 = require("ag-charts-community"); +var MAP_THEME_DEFAULTS = { + zoom: { + axes: "xy", + anchorPointX: "pointer", + anchorPointY: "pointer", + buttons: { + // @ts-expect-error undocumented options + anchorPointX: "middle", + anchorPointY: "middle" + } + }, + legend: { + enabled: false + }, + gradientLegend: { + enabled: false, + ...import_ag_charts_community88._ModuleSupport.LEGEND_CONTAINER_THEME + } +}; +function applyMapPalette(object) { + const clone = import_ag_charts_community88._ModuleSupport.deepClone(object); + import_ag_charts_community88._ModuleSupport.jsonWalk(clone, (value) => { + if (typeof value === "object" && "$palette" in value) { + value["$mapPalette"] = value["$palette"]; + delete value["$palette"]; + } + }); + return clone; +} + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeries.ts +var import_ag_charts_community94 = require("ag-charts-community"); +var import_ag_charts_core31 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/map-util/geoGeometry.ts +var import_ag_charts_community90 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/map-util/lineStringUtil.ts +var delta2 = 1e-9; +function lineSegmentDistanceToPointSquared(a, b, x, y) { + const [ax, ay] = a; + const [bx, by] = b; + const abx = bx - ax; + const aby = by - ay; + const l = abx * abx + aby * aby; + let x0; + let y0; + if (Math.abs(l) < delta2) { + x0 = ax; + y0 = ay; + } else { + let t = ((x - ax) * abx + (y - ay) * aby) / l; + t = Math.max(0, Math.min(1, t)); + x0 = ax + t * (bx - ax); + y0 = ay + t * (by - ay); + } + const dx = x - x0; + const dy = y - y0; + return dx * dx + dy * dy; +} +function lineStringDistance(lineString, x, y) { + let minDistanceSquared = Infinity; + let p0 = lineString.at(-1); + for (const p1 of lineString) { + minDistanceSquared = Math.min(minDistanceSquared, lineSegmentDistanceToPointSquared(p0, p1, x, y)); + p0 = p1; + } + return Math.sqrt(minDistanceSquared); +} +function lineStringLength(lineSegment) { + let [x0, y0] = lineSegment[0]; + let totalDistance = 0; + for (let i = 1; i < lineSegment.length; i += 1) { + const [x1, y1] = lineSegment[i]; + const distance = Math.hypot(x1 - x0, y1 - y0); + totalDistance += distance; + x0 = x1; + y0 = y1; + } + return totalDistance; +} +function lineStringCenter(lineSegment) { + if (lineSegment.length === 0) + return; + const targetDistance = lineStringLength(lineSegment) / 2; + let [x0, y0] = lineSegment[0]; + let totalDistance = 0; + for (let i = 1; i < lineSegment.length; i += 1) { + const [x1, y1] = lineSegment[i]; + const segmentDistance = Math.hypot(x1 - x0, y1 - y0); + const nextDistance = totalDistance + segmentDistance; + if (nextDistance > targetDistance) { + const ratio3 = (targetDistance - totalDistance) / segmentDistance; + const point = [x0 + (x1 - x0) * ratio3, y0 + (y1 - y0) * ratio3]; + const angle = Math.atan2(y1 - y0, x1 - x0); + return { point, angle }; + } + totalDistance = nextDistance; + x0 = x1; + y0 = y1; + } +} + +// packages/ag-charts-enterprise/src/series/map-util/polygonUtil.ts +var import_ag_charts_community89 = require("ag-charts-community"); +var { LonLatBBox } = import_ag_charts_community89._ModuleSupport; +function polygonBbox(polygon, into) { + for (const coordinates of polygon) { + const [lon, lat] = coordinates; + into = LonLatBBox.extend(into, lon, lat, lon, lat); + } + return into; +} +function polygonCentroid(polygon) { + if (polygon.length === 0) + return; + let x = 0; + let y = 0; + let k = 0; + let [x0, y0] = polygon.at(-1); + for (const [x1, y1] of polygon) { + const c = x0 * y1 - x1 * y0; + k += c; + x += (x0 + x1) * c; + y += (y0 + y1) * c; + x0 = x1; + y0 = y1; + } + k *= 3; + return [x / k, y / k]; +} +function polygonDistance(polygons, x, y) { + let inside = false; + let minDistanceSquared = Infinity; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + let [x0, y0] = p0; + for (const p1 of polygon) { + const [x1, y1] = p1; + if (y1 > y !== y0 > y && x < (x0 - x1) * (y - y1) / (y0 - y1) + x1) { + inside = !inside; + } + minDistanceSquared = Math.min(minDistanceSquared, lineSegmentDistanceToPointSquared(p0, p1, x, y)); + p0 = p1; + x0 = x1; + y0 = y1; + } + } + return (inside ? -1 : 1) * Math.sqrt(minDistanceSquared); +} + +// packages/ag-charts-enterprise/src/series/map-util/geoGeometry.ts +var { Path: Path9, ExtendedPath2D: ExtendedPath2D3, BBox: BBox10, SceneChangeDetection: SceneChangeDetection6, SceneObjectChangeDetection, objectsEqual } = import_ag_charts_community90._ModuleSupport; +var GeoGeometry = class extends Path9 { + constructor() { + super(...arguments); + this.projectedGeometry = void 0; + this.renderMode = 3 /* All */; + // Keep non-filled shapes separate so we don't fill them + this.strokePath = new ExtendedPath2D3(); + } + computeBBox() { + if (this.dirtyPath || this.isDirtyPath()) { + this.updatePath(); + this.dirtyPath = false; + } + return this.bbox?.clone(); + } + updatePath() { + const { projectedGeometry } = this; + this.strokePath.clear(); + this.path.clear(); + this.bbox = projectedGeometry == null ? void 0 : this.drawGeometry(projectedGeometry, void 0); + } + drawPath(ctx) { + super.drawPath(ctx); + this.renderStroke(ctx, this.strokePath.getPath2D()); + } + containsPoint(x, y) { + const { projectedGeometry } = this; + if (projectedGeometry == null) + return false; + if (!this.getBBox().containsPoint(x, y)) + return false; + return this.geometryDistance(projectedGeometry, x, y) <= 0; + } + distanceSquared(x, y) { + const { projectedGeometry } = this; + if (projectedGeometry == null) + return Infinity; + const distance = this.geometryDistance(projectedGeometry, x, y); + return distance > 0 ? distance * distance : 0; + } + geometryDistance(geometry, x, y) { + const { renderMode, strokeWidth } = this; + const drawPolygons = (renderMode & 1 /* Polygons */) !== 0; + const drawLines = (renderMode & 2 /* Lines */) !== 0; + const minStrokeDistance = Math.max(strokeWidth / 2, 1) + 1; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.reduce( + (minDistance, g) => Math.min(minDistance, this.geometryDistance(g, x, y)), + Infinity + ); + case "MultiPolygon": + return drawPolygons ? geometry.coordinates.reduce( + (minDistance, polygon) => Math.min(minDistance, Math.max(polygonDistance(polygon, x, y), 0)), + Infinity + ) : Infinity; + case "Polygon": + return drawPolygons ? Math.max(polygonDistance(geometry.coordinates, x, y), 0) : Infinity; + case "MultiLineString": + return drawLines ? geometry.coordinates.reduce((minDistance, lineString) => { + return Math.min( + minDistance, + Math.max(lineStringDistance(lineString, x, y) - minStrokeDistance, 0) + ); + }, Infinity) : Infinity; + case "LineString": + return drawLines ? Math.max(lineStringDistance(geometry.coordinates, x, y) - minStrokeDistance, 0) : Infinity; + case "MultiPoint": + case "Point": + default: + return Infinity; + } + } + drawGeometry(geometry, bbox) { + const { renderMode, path, strokePath } = this; + const drawPolygons = (renderMode & 1 /* Polygons */) !== 0; + const drawLines = (renderMode & 2 /* Lines */) !== 0; + switch (geometry.type) { + case "GeometryCollection": + for (const g of geometry.geometries) { + bbox = this.drawGeometry(g, bbox); + } + break; + case "MultiPolygon": + if (drawPolygons) { + for (const coordinates of geometry.coordinates) { + bbox = this.drawPolygon(path, coordinates, bbox); + } + } + break; + case "Polygon": + if (drawPolygons) { + bbox = this.drawPolygon(path, geometry.coordinates, bbox); + } + break; + case "LineString": + if (drawLines) { + bbox = this.drawLineString(strokePath, geometry.coordinates, bbox, false); + } + break; + case "MultiLineString": + if (drawLines) { + for (const coordinates of geometry.coordinates) { + bbox = this.drawLineString(strokePath, coordinates, bbox, false); + } + } + break; + case "Point": + case "MultiPoint": + break; + } + return bbox; + } + drawPolygon(path, polygons, bbox) { + if (polygons.length < 1) + return bbox; + bbox = this.drawLineString(path, polygons[0], bbox, true); + for (let i = 1; i < polygons.length; i += 1) { + const enclave = polygons[i]; + this.drawLineString(path, enclave, void 0, true); + } + return bbox; + } + drawLineString(path, coordinates, bbox, isClosed) { + if (coordinates.length < 2) + return bbox; + const end = isClosed ? coordinates.length - 1 : coordinates.length; + for (let i = 0; i < end; i += 1) { + const [x, y] = coordinates[i]; + if (i === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + if (bbox == null) { + bbox = new BBox10(x, y, 0, 0); + } else { + const { x: x0, y: y0 } = bbox; + const x1 = x0 + bbox.width; + const y1 = y0 + bbox.height; + bbox.x = Math.min(x0, x); + bbox.y = Math.min(y0, y); + bbox.width = Math.max(x1, x) - bbox.x; + bbox.height = Math.max(y1, y) - bbox.y; + } + } + if (isClosed) { + path.closePath(); + } + return bbox; + } +}; +__decorateClass([ + SceneObjectChangeDetection({ equals: objectsEqual }) +], GeoGeometry.prototype, "projectedGeometry", 2); +__decorateClass([ + SceneChangeDetection6() +], GeoGeometry.prototype, "renderMode", 2); + +// packages/ag-charts-enterprise/src/series/map-util/geometryUtil.ts +var import_ag_charts_community91 = require("ag-charts-community"); +var { LonLatBBox: LonLatBBox2 } = import_ag_charts_community91._ModuleSupport; +function geometryBbox(geometry, into) { + if (geometry.bbox != null) { + const [lon0, lat0, lon1, lat1] = geometry.bbox; + into = LonLatBBox2.extend(into, lon0, lat0, lon1, lat1); + return into; + } + switch (geometry.type) { + case "GeometryCollection": + for (const g of geometry.geometries) { + into = geometryBbox(g, into); + } + break; + case "MultiPolygon": + for (const c of geometry.coordinates) { + if (c.length > 0) { + into = polygonBbox(c[0], into); + } + } + break; + case "Polygon": + if (geometry.coordinates.length > 0) { + into = polygonBbox(geometry.coordinates[0], into); + } + break; + case "MultiLineString": + for (const c of geometry.coordinates) { + into = polygonBbox(c, into); + } + break; + case "LineString": + into = polygonBbox(geometry.coordinates, into); + break; + case "MultiPoint": + for (const p of geometry.coordinates) { + const [lon, lat] = p; + into = LonLatBBox2.extend(into, lon, lat, lon, lat); + } + break; + case "Point": { + const [lon, lat] = geometry.coordinates; + into = LonLatBBox2.extend(into, lon, lat, lon, lat); + break; + } + } + return into; +} +function largestPolygon(geometry) { + switch (geometry.type) { + case "GeometryCollection": { + let maxArea; + let maxPolygon; + for (const g of geometry.geometries) { + const polygon = largestPolygon(g); + if (polygon == null) + continue; + const bbox = polygonBbox(polygon[0], void 0); + if (bbox == null) + continue; + const area = Math.abs(bbox.lat1 - bbox.lat0) * Math.abs(bbox.lon1 - bbox.lon0); + if (maxArea == null || area > maxArea) { + maxArea = area; + maxPolygon = polygon; + } + } + return maxPolygon; + } + case "MultiPolygon": { + let maxArea; + let maxPolygon; + for (const polygon of geometry.coordinates) { + const bbox = polygonBbox(polygon[0], void 0); + if (bbox == null) + continue; + const area = Math.abs(bbox.lat1 - bbox.lat0) * Math.abs(bbox.lon1 - bbox.lon0); + if (maxArea == null || area > maxArea) { + maxArea = area; + maxPolygon = polygon; + } + } + return maxPolygon; + } + case "Polygon": + return geometry.coordinates; + case "MultiLineString": + case "LineString": + case "MultiPoint": + case "Point": + return; + } +} +function largestLineString(geometry) { + switch (geometry.type) { + case "GeometryCollection": { + let maxLength; + let maxLineString; + for (const g of geometry.geometries) { + const lineString = largestLineString(g); + if (lineString == null) + continue; + const length = lineStringLength(lineString); + if (length == null) + continue; + if (maxLength == null || length > maxLength) { + maxLength = length; + maxLineString = lineString; + } + } + return maxLineString; + } + case "MultiLineString": { + let maxLength = 0; + let maxLineString; + for (const lineString of geometry.coordinates) { + const length = lineStringLength(lineString); + if (length > maxLength) { + maxLength = length; + maxLineString = lineString; + } + } + return maxLineString; + } + case "LineString": + return geometry.coordinates; + case "MultiPolygon": + case "Polygon": + case "MultiPoint": + case "Point": + return; + } +} +function containsType(geometry, type) { + if (geometry == null) + return false; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.some((g) => containsType(g, type)); + case "MultiPolygon": + case "Polygon": + return (type & 1 /* Polygon */) !== 0; + case "MultiLineString": + case "LineString": + return (type & 2 /* LineString */) !== 0; + case "MultiPoint": + case "Point": + return (type & 4 /* Point */) !== 0; + } +} +function projectGeometry(geometry, scale) { + switch (geometry.type) { + case "GeometryCollection": + return { + type: "GeometryCollection", + geometries: geometry.geometries.map((g) => projectGeometry(g, scale)) + }; + case "Polygon": + return { + type: "Polygon", + coordinates: projectPolygon(geometry.coordinates, scale) + }; + case "MultiPolygon": + return { + type: "MultiPolygon", + coordinates: projectMultiPolygon(geometry.coordinates, scale) + }; + case "MultiLineString": + return { + type: "MultiLineString", + coordinates: projectPolygon(geometry.coordinates, scale) + }; + case "LineString": + return { + type: "LineString", + coordinates: projectLineString(geometry.coordinates, scale) + }; + case "MultiPoint": + return { + type: "MultiPoint", + coordinates: projectLineString(geometry.coordinates, scale) + }; + case "Point": + return { + type: "Point", + coordinates: scale.convert(geometry.coordinates) + }; + } +} +function projectMultiPolygon(multiPolygon, scale) { + return multiPolygon.map((polygon) => projectPolygon(polygon, scale)); +} +function projectPolygon(polygon, scale) { + return polygon.map((lineString) => projectLineString(lineString, scale)); +} +function projectLineString(lineString, scale) { + return lineString.map((lonLat) => scale.convert(lonLat)); +} + +// packages/ag-charts-enterprise/src/series/map-util/mapUtil.ts +function prepareMapMarkerAnimationFunctions() { + const fromFn = (marker, _datum, status) => { + if (status === "removed") { + return { scalingX: 1, scalingY: 1 }; + } else if (marker.previousDatum == null) { + return { scalingX: 0, scalingY: 0 }; + } + return { scalingX: marker.scalingX, scalingY: marker.scalingY }; + }; + const toFn = (_marker, _datum, status) => { + if (status === "removed") { + return { scalingX: 0, scalingY: 0 }; + } + return { scalingX: 1, scalingY: 1 }; + }; + return { fromFn, toFn }; +} +function findFocusedGeoGeometry(series, opts) { + const datum = series.contextNodeData?.nodeData[opts.datumIndex]; + if (datum === void 0) + return void 0; + for (const node of series.datumSelection.nodes()) { + if (node.datum === datum) { + return node; + } + } + return void 0; +} + +// packages/ag-charts-enterprise/src/series/map-util/topologySeries.ts +var import_ag_charts_community92 = require("ag-charts-community"); +var TopologySeriesProperties = class extends import_ag_charts_community92._ModuleSupport.SeriesProperties { +}; +var TopologySeries = class extends import_ag_charts_community92._ModuleSupport.DataModelSeries { + addChartEventListeners() { + this.cleanup.register( + this.ctx.eventsHub.on("legend:item-click", (event) => { + this.onLegendItemClick(event); + }), + this.ctx.eventsHub.on("legend:item-double-click", (event) => { + this.onLegendItemDoubleClick(event); + }) + ); + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } +}; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeriesProperties.ts +var import_ag_charts_community93 = require("ag-charts-community"); +var { Property: Property25, SeriesProperties: SeriesProperties3, makeSeriesTooltip: makeSeriesTooltip12, Label: Label8 } = import_ag_charts_community93._ModuleSupport; +var MapLineSeriesProperties = class extends SeriesProperties3 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = ""; + this.topologyIdKey = "name"; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.maxStrokeWidth = void 0; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new Label8(); + this.tooltip = makeSeriesTooltip12(); + } + getStyle() { + const { stroke, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this; + return { + stroke, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "sizeDomain", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "maxStrokeWidth", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeries.ts +var { + getMissCount: getMissCount2, + getLabelStyles: getLabelStyles2, + createDatumId: createDatumId10, + SeriesNodePickMode: SeriesNodePickMode9, + valueProperty: valueProperty9, + ColorScale: ColorScale2, + LinearScale: LinearScale4, + Selection: Selection6, + Text: Text2, + Transformable: Transformable2, + mergeDefaults: mergeDefaults11 +} = import_ag_charts_community94._ModuleSupport; +var MapLineSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + size: ["colorKey"], + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + size: ["sizeName"], + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode9.EXACT_SHAPE_MATCH, SeriesNodePickMode9.NEAREST_NODE], + usesPlacedLabels: true + }); + this.properties = new MapLineSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale2(); + this.sizeScale = new LinearScale4(); + this.datumSelection = Selection6.select( + this.contentGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection6.select(this.labelGroup, Text2); + this.highlightDatumSelection = Selection6.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this._previousDatumMidPoint = void 0; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + return super.hasData && this.topology != null; + } + renderToOffscreenCanvas() { + return true; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [1 /* ShapeLine */, zIndex]; + this.highlightGroup.zIndex = [2 /* ShapeLineHighlight */, zIndex]; + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 2 /* Lines */; + geoGeometry.lineJoin = "round"; + geoGeometry.lineCap = "round"; + return geoGeometry; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, sizeScale, colorScale } = this; + const { topologyIdKey, idKey, sizeKey, colorKey, labelKey, sizeDomain, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null || !containsType(feature.geometry, 2 /* LineString */)) + continue; + featureById.set(property, feature); + } + const sizeScaleType = this.sizeScale.type; + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + valueProperty9(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty9(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }), + ...labelKey == null ? [] : [valueProperty9(labelKey, "category", { id: "labelValue" })], + ...sizeKey == null ? [] : [valueProperty9(sizeKey, sizeScaleType, { id: "sizeValue" })], + ...colorKey == null ? [] : [valueProperty9(colorKey, colorScaleType, { id: "colorValue" })] + ] + }); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + this.topologyBounds = featureValues.reduce((current, feature) => { + const geometry = feature?.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (sizeKey != null) { + const sizeIdx = dataModel.resolveProcessedDataIndexById(this, `sizeValue`); + const processedSize = processedData.domain.values[sizeIdx] ?? []; + sizeScale.domain = sizeDomain ?? processedSize; + } + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + if (topology == null) { + import_ag_charts_core31.Logger.warnOnce(`no topology was provided for [MapLineSeries]; nothing will be rendered.`); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount2(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelDatum(datum, labelValue, projectedGeometry, measurer) { + if (labelValue == null || projectedGeometry == null) + return; + const lineString = largestLineString(projectedGeometry); + if (lineString == null) + return; + const { idKey, idName, sizeKey, sizeName, colorKey, colorName, labelKey, labelName, label } = this.properties; + if (labelKey == null || !label.enabled) + return; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const labelSize = measurer.measureLines(String(labelText)); + const labelCenter = lineStringCenter(lineString); + if (labelCenter == null) + return; + const [x, y] = labelCenter.point; + const { width, height } = labelSize; + return { + point: { x, y, size: 0 }, + label: { width, height, text: labelText }, + anchor: void 0, + placement: void 0 + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, sizeScale, properties, scale } = this; + const { idKey, sizeKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null) + return; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const sizeValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const maxStrokeWidth = properties.maxStrokeWidth ?? properties.strokeWidth; + sizeScale.range = [Math.min(properties.strokeWidth, maxStrokeWidth), maxStrokeWidth]; + const measurer = (0, import_ag_charts_core31.cachedTextMeasurer)(label); + const projectedGeometries = /* @__PURE__ */ new Map(); + for (const [datumIndex] of processedData.dataSources.get(this.id)?.data.entries() ?? []) { + const id = idValues[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (id != null && projectedGeometry != null) { + projectedGeometries.set(id, projectedGeometry); + } + } + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const sizeValue = sizeValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const projectedGeometry = projectedGeometries.get(idValue); + if (projectedGeometry == null) { + missingGeometries.push(idValue); + } + const labelDatum = this.getLabelDatum(datum, labelValue, projectedGeometry, measurer); + if (labelDatum != null) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: idKey, + datum, + datumIndex, + idValue, + labelValue, + colorValue, + sizeValue, + projectedGeometry, + legendItemName, + style: this.getItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + import_ag_charts_core31.Logger.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection, isHighlight: false }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection, isHighlight: true }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId10(datum.idValue)); + } + getItemStyle({ datumIndex = 0, datum, colorValue, sizeValue }, isHighlight) { + const { properties, colorScale, sizeScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const style = mergeDefaults11(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + style.stroke = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? properties.stroke; + } + if (sizeValue != null) { + style.strokeWidth = sizeScale.convert(sizeValue, { clamp: true }); + } + let overrides; + if (itemStyler != null) { + overrides = this.cachedDatumCallback(createDatumId10(datumIndex, isHighlight ? "highlight" : "node"), () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + }); + } + return overrides ? mergeDefaults11(style, overrides) : style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + datumSelection.each((geoGeometry, nodeDatum) => { + const { projectedGeometry, style } = nodeDatum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(style); + }); + } + updatePlacedLabelData(labelData) { + this.labelSelection = this.labelSelection.update(labelData, (text) => { + text.pointerEvents = import_ag_charts_community94._ModuleSupport.PointerEvents.None; + }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, width, height, text }, datumIndex) => { + const style = getLabelStyles2(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x + width / 2; + label.y = y + height / 2; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + resetAnimation() { + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + datumMidPoint(datum) { + const { _previousDatumMidPoint } = this; + if (_previousDatumMidPoint?.datum === datum) { + return _previousDatumMidPoint.point; + } + const projectedGeometry = datum.projectedGeometry; + const lineString = projectedGeometry == null ? void 0 : largestLineString(projectedGeometry); + const center = lineString == null ? void 0 : lineStringCenter(lineString)?.point; + const point = center == null ? void 0 : { x: center[0], y: center[1] }; + this._previousDatumMidPoint = { datum, point }; + return point; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { strokeWidth, strokeOpacity, lineDash } = properties; + let { stroke } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + stroke = this.colorScale.convert(colorValue); + } + return { + marker: { + fill: void 0, + fillOpacity: 0, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 0, + lineDash: [0], + lineDashOffset: 0, + enabled: false + }, + line: { + stroke, + strokeWidth, + strokeOpacity, + lineDash + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idKey, idName, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + idKey, + idName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + legendItemName, + tooltip + } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const sizeValue = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (sizeValue != null && sizeKey != null) { + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: sizeValue, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + domain, + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(sizeValue) }); + } + if (colorValue != null && colorKey != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + const format = this.getItemStyle({ datumIndex, datum, colorValue, sizeValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: idValues[datumIndex], + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { + seriesId, + datum, + title, + idKey, + idName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + ...format + } + ); + } + computeFocusBounds(opts) { + const geometry = findFocusedGeoGeometry(this, opts); + return geometry ? Transformable2.toCanvas(this.contentGroup, geometry.getBBox()) : void 0; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapLineSeries.className = "MapLineSeries"; +MapLineSeries.type = "map-line"; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeriesOptionsDef.ts +var import_ag_charts_community95 = require("ag-charts-community"); +var import_ag_charts_core32 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs11, mapLineSeriesThemeableOptionsDef, without: without5 } = import_ag_charts_community95._ModuleSupport; +var mapLineSeriesOptionsDef = { + ...without5(commonSeriesOptionsDefs11, ["highlightStyle", "highlight"]), + ...mapLineSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core32.required)((0, import_ag_charts_core32.constant)("map-line")), + idKey: (0, import_ag_charts_core32.required)(import_ag_charts_core32.string), + sizeKey: import_ag_charts_core32.string, + colorKey: import_ag_charts_core32.string, + labelKey: import_ag_charts_core32.string, + idName: import_ag_charts_core32.string, + sizeName: import_ag_charts_core32.string, + colorName: import_ag_charts_core32.string, + labelName: import_ag_charts_core32.string, + topology: import_ag_charts_core32.geoJson, + topologyIdKey: import_ag_charts_core32.string, + legendItemName: import_ag_charts_core32.string, + title: import_ag_charts_core32.string +}; +mapLineSeriesOptionsDef.colorRange = (0, import_ag_charts_core32.undocumented)((0, import_ag_charts_core32.and)((0, import_ag_charts_core32.arrayOf)(import_ag_charts_core32.color), (0, import_ag_charts_core32.arrayLength)(1))); + +// packages/ag-charts-enterprise/src/series/map-line/mapLineModule.ts +var MapLineModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-line", + moduleFactory: (ctx) => new MapLineSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + stroke: applyMapPalette(import_ag_charts_community96._ModuleSupport.SAFE_STROKE_FILL_OPERATION), + // @ts-expect-error undocumented option + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(import_ag_charts_community96._ModuleSupport.SAFE_RANGE2_OPERATION) + ] + }, + strokeWidth: 1, + maxStrokeWidth: 3, + lineDash: [0], + lineDashOffset: 0, + label: { + ...import_ag_charts_community96._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: applyMapPalette(import_ag_charts_community96._ModuleSupport.multiSeriesHighlightStyle(false)) + }, + tooltip: { + range: "exact" + } + } +}; +var MapLineSeriesModule = { + type: "series", + name: "map-line", + chartType: "topology", + enterprise: true, + options: mapLineSeriesOptionsDef, + create: (ctx) => new MapLineSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeries.ts +var import_ag_charts_community98 = require("ag-charts-community"); +var import_ag_charts_core33 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeriesProperties.ts +var import_ag_charts_community97 = require("ag-charts-community"); +var { Property: Property26, SeriesProperties: SeriesProperties4, makeSeriesTooltip: makeSeriesTooltip13 } = import_ag_charts_community97._ModuleSupport; +var MapLineBackgroundSeriesProperties = class extends SeriesProperties4 { + constructor() { + super(...arguments); + this.topology = void 0; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tooltip = makeSeriesTooltip13(); + } +}; +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeries.ts +var { createDatumId: createDatumId11, Group: Group8, Selection: Selection7, PointerEvents: PointerEvents6 } = import_ag_charts_community98._ModuleSupport; +var MapLineBackgroundSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [] + }); + this.properties = new MapLineBackgroundSeriesProperties(); + this._chartTopology = void 0; + this.itemGroup = this.contentGroup.appendChild(new Group8({ name: "itemGroup" })); + this.datumSelection = Selection7.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.itemGroup.pointerEvents = PointerEvents6.None; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get focusable() { + return false; + } + setOptionsData() { + } + setChartData() { + } + get hasData() { + return false; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 0]; + this.highlightGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 1]; + return true; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 2 /* Lines */; + geoGeometry.lineJoin = "round"; + geoGeometry.lineCap = "round"; + geoGeometry.pointerEvents = PointerEvents6.None; + return geoGeometry; + } + processData() { + const { topology } = this; + this.topologyBounds = topology?.features.reduce((current, feature) => { + const geometry = feature.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (topology == null) { + import_ag_charts_core33.Logger.warnOnce(`no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.`); + } + } + createNodeData() { + const { id: seriesId, topology, scale, properties } = this; + if (topology == null) + return; + const { stroke, strokeOpacity, lineDash, lineDashOffset, strokeWidth } = properties; + const nodeData = []; + const labelData = []; + for (const [index, feature] of topology.features.entries()) { + const { geometry } = feature; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (projectedGeometry == null) + continue; + nodeData.push({ + series: this, + itemId: index, + datum: feature, + datumIndex: 0, + index, + projectedGeometry, + style: { stroke, strokeOpacity, lineDash, lineDashOffset, strokeWidth } + }); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + const { nodeData = [] } = this.contextNodeData ?? {}; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId11(datum.index)); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + datumSelection.each((geoGeometry, datum) => { + const { projectedGeometry } = datum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(datum.style); + }); + } + resetAnimation() { + } + getLegendData() { + return []; + } + getTooltipContent(_seriesDatum) { + return; + } + computeFocusBounds(_opts) { + return void 0; + } + hasItemStylers() { + return false; + } +}; +MapLineBackgroundSeries.className = "MapLineBackgroundSeries"; +MapLineBackgroundSeries.type = "map-line-background"; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeriesOptionsDef.ts +var import_ag_charts_community99 = require("ag-charts-community"); +var import_ag_charts_core34 = require("ag-charts-core"); +var { mapLineBackgroundSeriesThemeableOptionsDef } = import_ag_charts_community99._ModuleSupport; +var mapLineBackgroundSeriesOptionsDef = { + ...mapLineBackgroundSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core34.required)((0, import_ag_charts_core34.constant)("map-line-background")), + topology: import_ag_charts_core34.geoJson +}; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundModule.ts +var MapLineBackgroundModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-line-background", + moduleFactory: (ctx) => new MapLineBackgroundSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + stroke: { $path: ["/1", { $mapPalette: "stroke" }, { $mapPalette: "secondHierarchyColors" }] }, + strokeWidth: 1, + lineDash: [0], + lineDashOffset: 0 + } + } +}; +var MapLineBackgroundSeriesModule = { + type: "series", + name: "map-line-background", + chartType: "topology", + enterprise: true, + options: mapLineBackgroundSeriesOptionsDef, + create: (ctx) => new MapLineBackgroundSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerModule.ts +var import_ag_charts_community104 = require("ag-charts-community"); +var import_ag_charts_core38 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeries.ts +var import_ag_charts_community102 = require("ag-charts-community"); +var import_ag_charts_core36 = require("ag-charts-core"); + +// packages/ag-charts-types/src/chart/navigatorOptions.ts +var __MINI_CHART_SERIES_OPTIONS = void 0; +var __VERIFY_MINI_CHART_SERIES_OPTIONS = void 0; +__VERIFY_MINI_CHART_SERIES_OPTIONS = __MINI_CHART_SERIES_OPTIONS; + +// packages/ag-charts-types/src/chart/themeOptions.ts +var __THEME_OVERRIDES = void 0; +var __VERIFY_THEME_OVERRIDES = void 0; +__VERIFY_THEME_OVERRIDES = __THEME_OVERRIDES; + +// packages/ag-charts-types/src/presets/gauge/commonOptions.ts +var __THEMEABLE_OPTIONS = void 0; +var __VERIFY_THEMEABLE_OPTIONS = void 0; +__VERIFY_THEMEABLE_OPTIONS = __THEMEABLE_OPTIONS; +var __AXIS_LABEL_OPTIONS = void 0; +var __VERIFY_AXIS_LABEL_OPTIONS = void 0; +__VERIFY_AXIS_LABEL_OPTIONS = __AXIS_LABEL_OPTIONS; + +// packages/ag-charts-enterprise/src/series/map-util/polygonPointSearch.ts +var import_ag_charts_core35 = require("ag-charts-core"); +function polygonPointSearch(polygons, precision, valueFn) { + const bbox = polygonBbox(polygons[0], void 0); + if (bbox == null) + return; + const boundingXCenter = (bbox.lon0 + bbox.lon1) / 2; + const boundingYCenter = (bbox.lat0 + bbox.lat1) / 2; + const boundingWidth = Math.abs(bbox.lon1 - bbox.lon0); + const boundingHeight = Math.abs(bbox.lat1 - bbox.lat0); + const centroid = polygonCentroid(polygons[0]); + const [cx, cy] = centroid; + const centroidDistanceToPolygon = -polygonDistance(polygons, cx, cy); + let bestResult; + const cellValue = (distanceToPolygon, distanceToCentroid) => { + const centroidDriftFactor = 0.5; + const centroidDrift = Math.max(distanceToCentroid - centroidDistanceToPolygon, 0); + return distanceToPolygon - centroidDriftFactor * centroidDrift; + }; + const createLabelPlacement = (x2, y2, stride) => { + const { distance: distance2, maxDistance } = valueFn(polygons, x2, y2, stride); + const distanceToCentroid = Math.hypot(cx - x2, cy - y2); + const maxXTowardsCentroid = Math.min(Math.max(cx, x2 - stride / 2), x2 + stride / 2); + const maxYTowardsCentroid = Math.min(Math.max(cy, y2 - stride / 2), y2 + stride / 2); + const minDistanceToCentroid = Math.hypot(cx - maxXTowardsCentroid, cy - maxYTowardsCentroid); + const value = cellValue(distance2, distanceToCentroid); + const maxValue = cellValue(maxDistance, minDistanceToCentroid); + return { distance: distance2, maxDistance, value, maxValue, x: x2, y: y2, stride }; + }; + const appendLabelPlacement = (into, x2, y2, stride) => { + const labelPlacement = createLabelPlacement(x2, y2, stride); + if (labelPlacement.maxDistance >= 0) { + into.push(labelPlacement); + } + }; + const initialStride = Math.min(boundingWidth, boundingHeight) / 2; + let queue = { + value: createLabelPlacement(boundingXCenter, boundingYCenter, initialStride), + next: null + }; + while (queue != null) { + const item = queue.value; + const { distance: distance2, value, maxValue, x: x2, y: y2, stride } = item; + queue = queue.next; + if (distance2 > 0 && (bestResult == null || value > bestResult.value)) { + bestResult = item; + } + if (bestResult != null && maxValue - bestResult.value <= precision) { + continue; + } + const nextStride = stride / 2; + const newLabelPlacements = []; + appendLabelPlacement(newLabelPlacements, x2 - nextStride, y2 - nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 + nextStride, y2 - nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 - nextStride, y2 + nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 + nextStride, y2 + nextStride, nextStride); + newLabelPlacements.sort(labelPlacementCmp); + queue = (0, import_ag_charts_core35.insertListItemsSorted)(queue, newLabelPlacements, labelPlacementCmp); + } + if (bestResult == null) + return; + const { distance, x, y } = bestResult; + return { x, y, distance }; +} +var labelPlacementCmp = (a, b) => b.maxValue - a.maxValue; + +// packages/ag-charts-enterprise/src/series/map-util/markerUtil.ts +function polygonMarkerCenter(polygons, precision) { + const result = polygonPointSearch(polygons, precision, (p, x2, y2, stride) => { + const distance = -polygonDistance(p, x2, y2); + const maxDistance = distance + stride * Math.SQRT2; + return { distance, maxDistance }; + }); + if (result == null) + return; + const { x, y } = result; + return [x, y]; +} +function markerPositions(geometry, precision) { + let center; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.flatMap((g) => markerPositions(g, precision)); + case "MultiPoint": + return geometry.coordinates; + case "Point": + return [geometry.coordinates]; + case "MultiPolygon": { + const polygon = largestPolygon(geometry); + center = polygon == null ? void 0 : polygonMarkerCenter(polygon, precision); + break; + } + case "Polygon": { + const polygon = geometry.coordinates; + center = polygon == null ? void 0 : polygonMarkerCenter(polygon, precision); + break; + } + case "MultiLineString": { + const lineString = largestLineString(geometry); + center = lineString == null ? void 0 : lineStringCenter(lineString)?.point; + break; + } + case "LineString": { + const lineString = geometry.coordinates; + center = lineStringCenter(lineString)?.point; + break; + } + } + return center == null ? [] : [center]; +} + +// packages/ag-charts-enterprise/src/series/map-util/shapeFillBBox.ts +var import_ag_charts_community100 = require("ag-charts-community"); +var { BBox: BBox11 } = import_ag_charts_community100._ModuleSupport; +function getTopologyShapeFillBBox(scale) { + if (!scale) + return; + const { range: range2 } = scale; + const x = range2[0][0]; + const y = range2[0][1]; + const width = range2[1][0] - x; + const height = range2[1][1] - y; + const bbox = new BBox11(x, y, width, height); + return { + series: bbox, + axis: bbox + }; +} + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeriesProperties.ts +var import_ag_charts_community101 = require("ag-charts-community"); +var { Property: Property27, SeriesProperties: SeriesProperties5, makeSeriesTooltip: makeSeriesTooltip14, Label: Label9 } = import_ag_charts_community101._ModuleSupport; +var MapMarkerSeriesLabel = class extends Label9 { + constructor() { + super(...arguments); + this.placement = "bottom"; + } +}; +__decorateClass([ + Property27 +], MapMarkerSeriesLabel.prototype, "placement", 2); +var MapMarkerSeriesProperties = class extends SeriesProperties5 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = void 0; + this.topologyIdKey = "name"; + this.idName = void 0; + this.latitudeKey = void 0; + this.latitudeName = void 0; + this.longitudeKey = void 0; + this.longitudeName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.shape = "circle"; + this.size = 6; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new MapMarkerSeriesLabel(); + this.tooltip = makeSeriesTooltip14(); + } + getStyle() { + const { size, shape, fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + size, + shape, + fill, + fillOpacity, + opacity: 1, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "latitudeKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "latitudeName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "longitudeKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "longitudeName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "shape", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "size", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "maxSize", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "sizeDomain", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeries.ts +var { + fromToMotion: fromToMotion3, + StateMachine: StateMachine2, + getMissCount: getMissCount3, + createDatumId: createDatumId12, + SeriesNodePickMode: SeriesNodePickMode10, + valueProperty: valueProperty10, + computeMarkerFocusBounds: computeMarkerFocusBounds2, + ColorScale: ColorScale3, + LinearScale: LinearScale5, + Group: Group9, + Selection: Selection8, + Text: Text3, + Marker: Marker3, + applyShapeStyle: applyShapeStyle11, + getLabelStyles: getLabelStyles3, + LonLatBBox: LonLatBBox3, + mergeDefaults: mergeDefaults12 +} = import_ag_charts_community102._ModuleSupport; +var MapMarkerSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + size: ["colorKey"], + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + size: ["sizeName"], + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode10.EXACT_SHAPE_MATCH, SeriesNodePickMode10.NEAREST_NODE], + usesPlacedLabels: true + }); + this.properties = new MapMarkerSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale3(); + this.sizeScale = new LinearScale5(); + this.markerGroup = this.contentGroup.appendChild(new Group9({ name: "markerGroup" })); + this.labelSelection = Selection8.select(this.labelGroup, Text3, false); + this.markerSelection = Selection8.select( + this.markerGroup, + Marker3, + false + ); + this.highlightMarkerSelection = Selection8.select(this.highlightGroup, Marker3); + this.animationState = new StateMachine2( + "empty", + { + empty: { + update: { + target: "ready", + action: () => this.animateMarkers() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.resetAllAnimation(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateMarkers() + }, + // chart.ts transitions to updateData on zoom change + resize: { + target: "ready", + action: () => this.resetAllAnimation() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty", + action: () => this.resetAllAnimation() + }, + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + const hasLatLon = this.properties.latitudeKey != null && this.properties.longitudeKey != null; + return super.hasData && (this.topology != null || hasLatLon); + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [3 /* Marker */, zIndex]; + this.highlightGroup.zIndex = [4 /* MarkerHighlight */, zIndex]; + return true; + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, sizeScale, colorScale } = this; + const { topologyIdKey, idKey, latitudeKey, longitudeKey, sizeKey, colorKey, labelKey, sizeDomain, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null) + continue; + featureById.set(property, feature); + } + const sizeScaleType = this.sizeScale.type; + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const hasLatLon = latitudeKey != null && longitudeKey != null; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + ...idKey == null ? [] : [ + valueProperty10(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty10(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }) + ], + ...hasLatLon ? [ + valueProperty10(latitudeKey, mercatorScaleType, { id: "latValue" }), + valueProperty10(longitudeKey, mercatorScaleType, { id: "lonValue" }) + ] : [], + ...labelKey ? [valueProperty10(labelKey, "category", { id: "labelValue" })] : [], + ...sizeKey ? [valueProperty10(sizeKey, sizeScaleType, { id: "sizeValue" })] : [], + ...colorKey ? [valueProperty10(colorKey, colorScaleType, { id: "colorValue" })] : [] + ] + }); + const featureValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `featureValue`, processedData); + const latValues = hasLatLon ? dataModel.resolveColumnById(this, `latValue`, processedData) : void 0; + const lonValues = hasLatLon ? dataModel.resolveColumnById(this, `lonValue`, processedData) : void 0; + this.topologyBounds = processedData.dataSources.get(this.id)?.data.reduce((current, _datum, datumIndex) => { + const feature = featureValues?.[datumIndex]; + const geometry = feature?.geometry; + if (geometry != null) { + current = geometryBbox(geometry, current); + } + if (latValues != null && lonValues != null) { + const lon = lonValues[datumIndex]; + const lat = latValues[datumIndex]; + current = LonLatBBox3.extend(current, lon, lat, lon, lat); + } + return current; + }, void 0); + if (sizeKey != null) { + const sizeIdx = dataModel.resolveProcessedDataIndexById(this, `sizeValue`); + const processedSize = processedData.domain.values[sizeIdx] ?? []; + sizeScale.domain = sizeDomain ?? processedSize; + } + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + this.animationState.transition("updateData"); + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount3(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelDatum(datum, labelValue, x, y, size, measurer) { + if (labelValue == null) + return; + const { + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName, + label, + shape + } = this.properties; + if (labelKey == null || !label.enabled) + return; + const { placement } = label; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const { width, height } = measurer.measureLines(String(labelText)); + const anchor = Marker3.anchor(shape); + return { + point: { x, y, size }, + label: { width, height, text: labelText }, + anchor, + placement + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, sizeScale, properties, scale } = this; + const { idKey, latitudeKey, longitudeKey, sizeKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null || scale == null) + return; + const hasLatLon = latitudeKey != null && longitudeKey != null; + const idValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `featureValue`, processedData); + const latValues = hasLatLon ? dataModel.resolveColumnById(this, `latValue`, processedData) : void 0; + const lonValues = hasLatLon ? dataModel.resolveColumnById(this, `lonValue`, processedData) : void 0; + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const sizeValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const markerMaxSize = properties.maxSize ?? properties.size; + sizeScale.range = [Math.min(properties.size, markerMaxSize), markerMaxSize]; + const measurer = (0, import_ag_charts_core36.cachedTextMeasurer)(label); + let projectedGeometries; + if (idValues != null && featureValues != null) { + projectedGeometries = /* @__PURE__ */ new Map(); + for (const [datumIndex] of processedData.dataSources.get(this.id)?.data.entries() ?? []) { + const id = idValues[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (id != null && projectedGeometry != null) { + projectedGeometries.set(id, projectedGeometry); + } + } + } + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues?.[datumIndex]; + const lonValue = lonValues?.[datumIndex]; + const latValue = latValues?.[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const sizeValue = sizeValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const size = sizeValue == null ? properties.size : sizeScale.convert(sizeValue, { clamp: true }); + const projectedGeometry = idValue == null ? void 0 : projectedGeometries?.get(idValue); + if (idValue != null && projectGeometry == null) { + missingGeometries.push(idValue); + } + if (lonValue != null && latValue != null) { + const [x, y] = scale.convert([lonValue, latValue]); + const labelDatum = this.getLabelDatum(datum, labelValue, x, y, size, measurer); + if (labelDatum) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: latitudeKey, + datum, + datumIndex, + index: -1, + idValue, + lonValue, + latValue, + labelValue, + sizeValue, + colorValue, + point: { x, y, size }, + midPoint: { x, y }, + legendItemName, + style: this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } else if (projectedGeometry != null) { + for (const [index, [x, y]] of markerPositions(projectedGeometry, 1).entries()) { + const labelDatum = this.getLabelDatum(datum, labelValue, x, y, size, measurer); + if (labelDatum) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: latitudeKey, + datum, + datumIndex, + index, + idValue, + lonValue, + latValue, + labelValue, + sizeValue, + colorValue, + point: { x, y, size }, + midPoint: { x, y }, + legendItemName, + style: this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } + } + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + import_ag_charts_core36.Logger.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + checkScaleChange() { + if (this.previousScale === this.scale) + return false; + this.previousScale = this.scale; + return true; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + const scaleChange = this.checkScaleChange(); + const { markerSelection, highlightMarkerSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + this.markerSelection = this.updateMarkerSelection({ markerData: nodeData, markerSelection }); + this.updateMarkerNodes({ markerSelection, isHighlight: false, highlightedDatum }); + this.highlightMarkerSelection = this.updateMarkerSelection({ + markerData: highlightedDatum == null ? [] : [highlightedDatum], + markerSelection: highlightMarkerSelection + }); + this.updateMarkerNodes({ + markerSelection: highlightMarkerSelection, + isHighlight: true, + highlightedDatum + }); + if (scaleChange || resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updatePlacedLabelData(labelData) { + this.labelSelection = this.labelSelection.update(labelData, (text) => { + text.pointerEvents = import_ag_charts_community102._ModuleSupport.PointerEvents.None; + }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, width, height, text }, datumIndex) => { + const style = getLabelStyles3(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x + width / 2; + label.y = y + height / 2; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + updateMarkerSelection(opts) { + const { markerData, markerSelection } = opts; + return markerSelection.update( + markerData, + void 0, + (datum) => createDatumId12(datum.index, datum.idValue, datum.lonValue, datum.latValue) + ); + } + getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, isHighlight) { + const { properties, colorScale, sizeScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults12(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + baseStyle.fill = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? baseStyle.fill; + } + if (sizeValue != null) { + baseStyle.size = sizeScale.convert(sizeValue, { clamp: true }); + } + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId12(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults12(overrides, baseStyle); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateMarkerNodes(opts) { + const { markerSelection, isHighlight, highlightedDatum } = opts; + const fillBBox = getTopologyShapeFillBBox(this.scale); + markerSelection.each((marker, markerDatum) => { + const { datum, point } = markerDatum; + const style = this.getMarkerItemStyle(markerDatum, isHighlight); + marker.shape = style.shape; + marker.size = style.size; + applyShapeStyle11(marker, style, fillBBox); + marker.x = point.x; + marker.y = point.y; + marker.scalingCenterX = point.x; + marker.scalingCenterY = point.y; + marker.zIndex = !isHighlight && highlightedDatum != null && datum === highlightedDatum.datum ? 1 : 0; + }); + } + isProcessedDataAnimatable() { + return true; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + this.ctx.animationManager.skipCurrentBatch(); + this.labelSelection.cleanup(); + this.markerSelection.cleanup(); + this.highlightMarkerSelection.cleanup(); + } + animateMarkers() { + const { animationManager } = this.ctx; + const fns = prepareMapMarkerAnimationFunctions(); + fromToMotion3(this.id, "markers", animationManager, [this.markerSelection, this.highlightMarkerSelection], fns); + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + pickNodeClosestDatum(p) { + const { x: x0, y: y0 } = p; + let minDistanceSquared = Infinity; + let minDatum; + for (const datum of this.contextNodeData?.nodeData ?? []) { + const { x, y, size } = datum.point; + const dx = Math.max(Math.abs(x - x0) - size, 0); + const dy = Math.max(Math.abs(y - y0) - size, 0); + const distanceSquared = dx * dx + dy * dy; + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + } + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { shape, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + let { fill } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + fill = this.colorScale.convert(colorValue); + } + return { + marker: { + shape, + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idName, idKey, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey ?? seriesId }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + legendItemName, + tooltip + } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const sizeValue = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (sizeKey != null && sizeValue != null) { + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: sizeValue, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + domain, + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(sizeValue) }); + } + if (colorKey != null && colorValue != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + let heading; + if (idKey != null) { + heading = dataModel.resolveColumnById(this, `idValue`, processedData)[datumIndex]; + } else if (latitudeKey != null && longitudeKey != null) { + const latValue = dataModel.resolveColumnById(this, `latValue`, processedData)[datumIndex]; + const lonValue = dataModel.resolveColumnById(this, `lonValue`, processedData)[datumIndex]; + heading = `${Math.abs(latValue).toFixed(4)}\xB0 ${latValue >= 0 ? "N" : "S"}, ${Math.abs(lonValue).toFixed(4)}\xB0 ${lonValue >= 0 ? "W" : "E"}`; + } + const format = this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading, + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { + seriesId, + datum, + title, + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + ...format + } + ); + } + getFormattedMarkerStyle(markerDatum) { + const format = this.getMarkerItemStyle(markerDatum, false); + return { size: format.size, shape: format.shape }; + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds2(this, opts); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapMarkerSeries.className = "MapMarkerSeries"; +MapMarkerSeries.type = "map-marker"; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeriesOptionsDef.ts +var import_ag_charts_community103 = require("ag-charts-community"); +var import_ag_charts_core37 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs12, mapMarkerSeriesThemeableOptionsDef, without: without6 } = import_ag_charts_community103._ModuleSupport; +var mapMarkerSeriesOptionsDef = { + ...without6(commonSeriesOptionsDefs12, ["highlightStyle", "highlight"]), + ...mapMarkerSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core37.required)((0, import_ag_charts_core37.constant)("map-marker")), + idKey: import_ag_charts_core37.string, + latitudeKey: import_ag_charts_core37.string, + longitudeKey: import_ag_charts_core37.string, + sizeKey: import_ag_charts_core37.string, + colorKey: import_ag_charts_core37.string, + labelKey: import_ag_charts_core37.string, + idName: import_ag_charts_core37.string, + latitudeName: import_ag_charts_core37.string, + longitudeName: import_ag_charts_core37.string, + sizeName: import_ag_charts_core37.string, + colorName: import_ag_charts_core37.string, + labelName: import_ag_charts_core37.string, + topology: import_ag_charts_core37.geoJson, + topologyIdKey: import_ag_charts_core37.string, + legendItemName: import_ag_charts_core37.string, + title: import_ag_charts_core37.string +}; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerModule.ts +var MapMarkerModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-marker", + moduleFactory: (ctx) => new MapMarkerSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + shape: "circle", + maxSize: 30, + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $mapPalette: "fill" }, + ["gradient", import_ag_charts_community104._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", import_ag_charts_community104._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community104._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }), + stroke: { $mapPalette: "stroke" }, + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(import_ag_charts_community104._ModuleSupport.SAFE_RANGE2_OPERATION) + ] + }, + fillOpacity: 0.5, + label: { + ...import_ag_charts_community104._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: applyMapPalette(import_ag_charts_community104._ModuleSupport.multiSeriesHighlightStyle()) + }, + tooltip: { + range: "exact" + } + } +}; +var MapMarkerSeriesModule = { + type: "series", + name: "map-marker", + chartType: "topology", + enterprise: true, + options: mapMarkerSeriesOptionsDef, + create: (ctx) => new MapMarkerSeries(ctx), + validate(options, optionsDefs2, path) { + const result = (0, import_ag_charts_core38.validate)(options, optionsDefs2, path); + const { cleared, invalid } = result; + if (cleared?.idKey == null && (cleared?.latitudeKey == null || cleared?.longitudeKey == null)) { + const extendPath = (key) => path ? `${path}.${key}` : key; + const message = `Either \`${extendPath("idKey")}\` or both \`${extendPath("latitudeKey")}\` and \`${extendPath("longitudeKey")}\` are required.`; + invalid.push(new import_ag_charts_core38.ValidationError("required", message, null, path)); + } + return result; + } +}; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeModule.ts +var import_ag_charts_community108 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeries.ts +var import_ag_charts_community106 = require("ag-charts-community"); +var import_ag_charts_core39 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/map-util/polygonLabelUtil.ts +function preferredLabelCenter(polygons, { aspectRatio, precision }) { + const result = polygonPointSearch(polygons, precision, (p, cx, cy, stride) => { + const width = maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(p, cx, cy, aspectRatio); + const maxWidth2 = width + 2 * stride * aspectRatio; + const distance2 = width * Math.SQRT2; + const maxDistance = maxWidth2 * Math.SQRT2; + return { distance: distance2, maxDistance }; + }); + if (result == null) + return; + const { x, y, distance } = result; + const maxWidth = distance / Math.SQRT2; + return { x, y, maxWidth }; +} +function maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(a, b, cx, cy, aspectRatio) { + const [ax, ay] = a; + const [bx, by] = b; + const positiveM = 1 / aspectRatio; + const abx = bx - ax; + const aby = by - ay; + const [topPointX, topPointY] = ay <= by ? a : b; + const [leftPointX, leftPointY] = ax <= bx ? a : b; + const [bottomPointX, bottomPointY] = ay <= by ? b : a; + const [rightPointX, rightPointY] = ax <= bx ? b : a; + let maxWidth = Infinity; + if (abx === 0) { + for (let i = 0; i <= 1; i += 1) { + const m = i === 0 ? positiveM : -positiveM; + const y = m * (ax - cx) + cy; + if (y >= topPointY && y <= bottomPointY) { + const height = Math.abs(cy - y) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } + } + } else { + const abm = aby / abx; + for (let i = 0; i <= 1; i += 1) { + const m = i === 0 ? positiveM : -positiveM; + const x = (abm * ax - ay - m * cx + cy) / (abm - m); + if (x >= leftPointX && x <= rightPointX) { + const width = Math.abs(cx - x) * 2; + maxWidth = Math.min(maxWidth, width); + } + } + } + const positiveMRecip = aspectRatio; + const centerToTopMRecip = Math.abs((topPointX - cx) / (topPointY - cy)); + const centerToBottomMRecip = Math.abs((bottomPointX - cx) / (bottomPointY - cy)); + if (bottomPointY < cy && centerToBottomMRecip < positiveMRecip) { + const height = Math.abs(cy - bottomPointY) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } else if (topPointY > cy && centerToTopMRecip < positiveMRecip) { + const height = Math.abs(cy - topPointY) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } + const centerToLeftM = Math.abs((leftPointY - cy) / (leftPointX - cx)); + const centerToRightM = Math.abs((rightPointY - cy) / (rightPointX - cx)); + if (rightPointX < cx && centerToRightM < positiveM) { + const width = Math.abs(cx - rightPointX) * 2; + maxWidth = Math.min(maxWidth, width); + } else if (leftPointX > cx && centerToLeftM < positiveM) { + const width = Math.abs(cx - leftPointX) * 2; + maxWidth = Math.min(maxWidth, width); + } + return maxWidth; +} +function maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(polygons, cx, cy, aspectRatio) { + let inside = false; + let minWidth = Infinity; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + let [x0, y0] = p0; + for (const p1 of polygon) { + const [x1, y1] = p1; + if (y1 > cy !== y0 > cy && cx < (x0 - x1) * (cy - y1) / (y0 - y1) + x1) { + inside = !inside; + } + const width = maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(p0, p1, cx, cy, aspectRatio); + minWidth = Math.min(minWidth, width); + p0 = p1; + x0 = x1; + y0 = y1; + } + } + return (inside ? 1 : -1) * minWidth; +} +function applyX(into, cx, x) { + if (x >= cx) { + into.maxX = Math.min(into.maxX, x - cx); + } + if (x <= cx) { + into.minX = Math.max(into.minX, x - cx); + } +} +function xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(into, a, b, cx, cy, height) { + const ry0 = cy - height / 2; + const ry1 = cy + height / 2; + const [ax, ay] = a; + const [bx, by] = b; + const abx = bx - ax; + const aby = by - ay; + const [leftPointX, leftPointY] = ax <= bx ? a : b; + const [rightPointX, rightPointY] = ax <= bx ? b : a; + if (abx !== 0) { + const abm = aby / abx; + for (let i = 0; i <= 1; i += 1) { + const y = i === 0 ? ry0 : ry1; + const x = (y - ay) / abm + ax; + if (x >= leftPointX && x <= rightPointX) { + applyX(into, cx, x); + } + } + } else if (Math.max(ry0, Math.min(ay, by)) <= Math.min(ry1, Math.max(ay, by))) { + applyX(into, cx, ax); + } + if (rightPointX < cx && rightPointY >= ry0 && rightPointY <= ry1) { + applyX(into, cx, rightPointX); + } else if (leftPointX > cx && leftPointY >= ry0 && leftPointY <= ry1) { + applyX(into, cx, leftPointX); + } + return into; +} +function maxWidthInPolygonForRectOfHeight(polygons, cx, cy, height) { + const result = { + minX: -Infinity, + maxX: Infinity + }; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + for (const p1 of polygon) { + xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(result, p0, p1, cx, cy, height); + p0 = p1; + } + } + const { minX, maxX } = result; + if (Number.isFinite(minX) && Number.isFinite(maxX)) { + return { x: cx + (minX + maxX) / 2, width: maxX - minX }; + } else { + return { x: cx, width: 0 }; + } +} + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeriesProperties.ts +var import_ag_charts_community105 = require("ag-charts-community"); +var { Property: Property28, SeriesProperties: SeriesProperties6, makeSeriesTooltip: makeSeriesTooltip15 } = import_ag_charts_community105._ModuleSupport; +var MapShapeSeriesProperties = class extends SeriesProperties6 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = ""; + this.idName = void 0; + this.topologyIdKey = "name"; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.padding = 0; + this.label = new AutoSizedSecondaryLabel(); + this.tooltip = makeSeriesTooltip15(); + } + getStyle() { + const { fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "padding", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeries.ts +var { + getMissCount: getMissCount4, + createDatumId: createDatumId13, + SeriesNodePickMode: SeriesNodePickMode11, + valueProperty: valueProperty11, + ColorScale: ColorScale4, + Group: Group10, + Selection: Selection9, + Text: Text4, + PointerEvents: PointerEvents7, + applyShapeStyle: applyShapeStyle12, + getLabelStyles: getLabelStyles4, + mergeDefaults: mergeDefaults13 +} = import_ag_charts_community106._ModuleSupport; +var fixedScale = import_ag_charts_community106._ModuleSupport.MercatorScale.fixedScale(); +var MapShapeSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode11.EXACT_SHAPE_MATCH, SeriesNodePickMode11.NEAREST_NODE] + }); + this.properties = new MapShapeSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale4(); + this.itemGroup = this.contentGroup.appendChild(new Group10({ name: "itemGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group10({ name: "itemLabelGroup" })); + this.datumSelection = Selection9.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection9.select( + this.itemLabelGroup, + Text4 + ); + this.highlightDatumSelection = Selection9.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this.previousLabelLayouts = void 0; + this._previousDatumMidPoint = void 0; + this.itemLabelGroup.pointerEvents = PointerEvents7.None; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + return super.hasData && this.topology != null; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [1 /* ShapeLine */, zIndex]; + this.highlightGroup.zIndex = [2 /* ShapeLineHighlight */, zIndex]; + return true; + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 1 /* Polygons */; + geoGeometry.lineJoin = "round"; + return geoGeometry; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, colorScale } = this; + const { topologyIdKey, idKey, colorKey, labelKey, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null || !containsType(feature.geometry, 1 /* Polygon */)) + continue; + featureById.set(property, feature); + } + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + valueProperty11(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty11(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }), + ...labelKey ? [valueProperty11(labelKey, "category", { id: "labelValue" })] : [], + ...colorKey ? [valueProperty11(colorKey, colorScaleType, { id: "colorValue" })] : [] + ] + }); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + this.topologyBounds = featureValues.reduce((current, feature) => { + const geometry = feature?.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + if (topology == null) { + import_ag_charts_core39.Logger.warnOnce(`no topology was provided for [MapShapeSeries]; nothing will be rendered.`); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount4(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelLayout(datum, labelValue, measurer, geometry, previousLabelLayout) { + if (labelValue == null || geometry == null) + return; + const { idKey, idName, colorKey, colorName, labelKey, labelName, padding, label } = this.properties; + if (labelKey == null || !label.enabled) + return; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const baseSize = (0, import_ag_charts_core39.isArray)(labelText) ? (0, import_ag_charts_core39.measureTextSegments)(labelText, label) : measurer.measureLines(String(labelText)); + const aspectRatio = (baseSize.width + 2 * padding) / (baseSize.height + 2 * padding); + if (previousLabelLayout?.geometry === geometry && previousLabelLayout?.labelText === labelText && previousLabelLayout?.aspectRatio === aspectRatio) { + return previousLabelLayout; + } + const fixedGeometry = projectGeometry(geometry, fixedScale); + const fixedPolygon = largestPolygon(fixedGeometry); + if (fixedPolygon == null) + return; + const labelPlacement = preferredLabelCenter(fixedPolygon, { + aspectRatio, + precision: 1e-3 + }); + if (labelPlacement == null) + return; + const { x, y, maxWidth } = labelPlacement; + return { geometry, labelText, aspectRatio, x, y, maxWidth, fixedPolygon }; + } + getLabelDatum(labelLayout, scaling) { + const { scale } = this; + if (scale == null) + return; + const { padding, label } = this.properties; + const { labelText, aspectRatio, x: untruncatedX, y, maxWidth, fixedPolygon } = labelLayout; + const maxSizeWithoutTruncation = { + width: Math.ceil(maxWidth * scaling), + height: Math.ceil(maxWidth * scaling / aspectRatio), + meta: untruncatedX + }; + const labelFormatting = formatSingleLabel( + (0, import_ag_charts_core39.toPlainText)(labelText), + label, + { padding }, + (height, allowTruncation) => { + if (!allowTruncation) { + return maxSizeWithoutTruncation; + } + const result = maxWidthInPolygonForRectOfHeight(fixedPolygon, untruncatedX, y, height / scaling); + return { + width: result.width * scaling, + height, + meta: result.x + }; + } + ); + if (labelFormatting == null) + return; + const [{ text, fontSize, lineHeight, width }, formattingX] = labelFormatting; + const x = width < maxSizeWithoutTruncation.width ? untruncatedX : formattingX; + const position = this.scale.convert(fixedScale.invert([x, y])); + return { + x: position[0], + y: position[1], + text, + fontSize, + lineHeight + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, properties, scale, previousLabelLayouts } = this; + const { idKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null) + return; + const scaling = scale == null ? Number.NaN : (scale.range[1][0] - scale.range[0][0]) / scale.bounds.width; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const measurer = (0, import_ag_charts_core39.cachedTextMeasurer)(label); + const labelLayouts = /* @__PURE__ */ new Map(); + this.previousLabelLayouts = labelLayouts; + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + if (geometry == null) { + missingGeometries.push(idValue); + } + const labelLayout = this.getLabelLayout( + datum, + labelValue, + measurer, + geometry, + previousLabelLayouts?.get(idValue) + ); + if (labelLayout != null) { + labelLayouts.set(idValue, labelLayout); + } + const labelDatum = labelLayout != null && scale != null ? this.getLabelDatum(labelLayout, scaling) : void 0; + if (labelDatum != null) { + labelData.push(labelDatum); + } + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + nodeData.push({ + series: this, + itemId: idKey, + datum, + datumIndex, + idValue, + colorValue, + labelValue, + projectedGeometry, + legendItemName, + style: this.getItemStyle({ datum, datumIndex, colorValue }, false) + }); + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + import_ag_charts_core39.Logger.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection, labelSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId13(datum.idValue)); + } + getItemStyle({ datumIndex, datum, colorValue }, isHighlight) { + const { properties, colorScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults13(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + baseStyle.fill = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? baseStyle.fill; + } + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId13(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults13(overrides, style); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const fillBBox = getTopologyShapeFillBBox(this.scale); + datumSelection.each((geoGeometry, nodeDatum) => { + const { projectedGeometry } = nodeDatum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + applyShapeStyle12(geoGeometry, nodeDatum.style, fillBBox); + }); + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, text, fontSize, lineHeight }, datumIndex) => { + const style = getLabelStyles4(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontFamily } = style; + label.visible = true; + label.x = x; + label.y = y; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.lineHeight = lineHeight; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + resetAnimation() { + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + datumMidPoint(datum) { + const { _previousDatumMidPoint } = this; + if (_previousDatumMidPoint?.datum === datum) { + return _previousDatumMidPoint.point; + } + const projectedGeometry = datum.projectedGeometry; + const polygon = projectedGeometry == null ? void 0 : largestPolygon(projectedGeometry); + const center = polygon == null ? void 0 : polygonMarkerCenter(polygon, 2); + const point = center == null ? void 0 : { x: center[0], y: center[1] }; + this._previousDatumMidPoint = { datum, point }; + return point; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + let { fill } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + fill = this.colorScale.convert(colorValue); + } + return { + marker: { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idKey, idName, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { idKey, idName, colorKey, colorName, labelKey, labelName, legendItemName, title, tooltip } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const idValue = dataModel.resolveColumnById(this, `idValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (colorValue != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + const format = this.getItemStyle({ datum, datumIndex, colorValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: idValue, + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { seriesId, datum, title, idKey, idName, colorKey, colorName, labelKey, labelName, ...format } + ); + } + computeFocusBounds(opts) { + return findFocusedGeoGeometry(this, opts); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapShapeSeries.className = "MapShapeSeries"; +MapShapeSeries.type = "map-shape"; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeriesOptionsDef.ts +var import_ag_charts_community107 = require("ag-charts-community"); +var import_ag_charts_core40 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs13, mapShapeSeriesThemeableOptionsDef, without: without7 } = import_ag_charts_community107._ModuleSupport; +var mapShapeSeriesOptionsDef = { + ...without7(commonSeriesOptionsDefs13, ["highlightStyle", "highlight"]), + ...mapShapeSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core40.required)((0, import_ag_charts_core40.constant)("map-shape")), + idKey: (0, import_ag_charts_core40.required)(import_ag_charts_core40.string), + colorKey: import_ag_charts_core40.string, + labelKey: import_ag_charts_core40.string, + idName: import_ag_charts_core40.string, + colorName: import_ag_charts_core40.string, + labelName: import_ag_charts_core40.string, + topology: import_ag_charts_core40.geoJson, + topologyIdKey: import_ag_charts_core40.string, + legendItemName: import_ag_charts_core40.string, + title: import_ag_charts_core40.string +}; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeModule.ts +var MapShapeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-shape", + moduleFactory: (ctx) => new MapShapeSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $mapPalette: "fill" }, + ["gradient", import_ag_charts_community108._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", import_ag_charts_community108._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community108._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }), + stroke: { $ref: "chartBackgroundColor" }, + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(import_ag_charts_community108._ModuleSupport.SAFE_RANGE2_OPERATION) + ] + }, + fillOpacity: 1, + strokeWidth: 1, + lineDash: [0], + lineDashOffset: 0, + padding: 2, + label: { + ...import_ag_charts_community108._ModuleSupport.LABEL_BOXING_DEFAULTS, + color: { $ref: "chartBackgroundColor" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: "bold", + overflowStrategy: "hide" + }, + highlight: applyMapPalette(import_ag_charts_community108._ModuleSupport.multiSeriesHighlightStyle(true)) + }, + tooltip: { + range: "exact" + } + } +}; +var MapShapeSeriesModule = { + type: "series", + name: "map-shape", + chartType: "topology", + enterprise: true, + options: mapShapeSeriesOptionsDef, + create: (ctx) => new MapShapeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundModule.ts +var import_ag_charts_community112 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeries.ts +var import_ag_charts_community110 = require("ag-charts-community"); +var import_ag_charts_core41 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeriesProperties.ts +var import_ag_charts_community109 = require("ag-charts-community"); +var { Property: Property29, SeriesProperties: SeriesProperties7, makeSeriesTooltip: makeSeriesTooltip16 } = import_ag_charts_community109._ModuleSupport; +var MapShapeBackgroundSeriesProperties = class extends SeriesProperties7 { + constructor() { + super(...arguments); + this.topology = void 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tooltip = makeSeriesTooltip16(); + } +}; +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeries.ts +var { createDatumId: createDatumId14, Selection: Selection10, Group: Group11, PointerEvents: PointerEvents8 } = import_ag_charts_community110._ModuleSupport; +var MapShapeBackgroundSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [] + }); + this.properties = new MapShapeBackgroundSeriesProperties(); + this._chartTopology = void 0; + this.itemGroup = this.contentGroup.appendChild(new Group11({ name: "itemGroup" })); + this.datumSelection = Selection10.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.itemGroup.pointerEvents = PointerEvents8.None; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get focusable() { + return false; + } + setOptionsData() { + } + setChartData() { + } + getNodeData() { + return; + } + get hasData() { + return false; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 0]; + this.highlightGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 1]; + return true; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 1 /* Polygons */; + geoGeometry.lineJoin = "round"; + geoGeometry.pointerEvents = PointerEvents8.None; + return geoGeometry; + } + processData() { + const { topology } = this; + this.topologyBounds = topology?.features.reduce((current, feature) => { + const geometry = feature.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (topology == null) { + import_ag_charts_core41.Logger.warnOnce(`no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.`); + } + } + createNodeData() { + const { id: seriesId, topology, scale, properties } = this; + if (topology == null) + return; + const { fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + const nodeData = []; + const labelData = []; + for (const [index, feature] of topology.features.entries()) { + const { geometry } = feature; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (projectedGeometry == null) + continue; + nodeData.push({ + series: this, + itemId: index, + datum: feature, + datumIndex: 0, + index, + projectedGeometry, + style: { fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } + }); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + const { nodeData = [] } = this.contextNodeData ?? {}; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId14(datum.index)); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + datumSelection.each((geoGeometry, datum) => { + const { projectedGeometry } = datum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(datum.style); + }); + } + resetAnimation() { + } + getLegendData() { + return []; + } + getTooltipContent(_seriesDatum) { + return; + } + pickFocus() { + return void 0; + } + computeFocusBounds(_opts) { + return void 0; + } + hasItemStylers() { + return false; + } +}; +MapShapeBackgroundSeries.className = "MapShapeBackgroundSeries"; +MapShapeBackgroundSeries.type = "map-shape-background"; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeriesOptionsDef.ts +var import_ag_charts_community111 = require("ag-charts-community"); +var import_ag_charts_core42 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs14, mapShapeBackgroundSeriesThemeableOptionsDef } = import_ag_charts_community111._ModuleSupport; +var mapShapeBackgroundSeriesOptionsDef = { + ...mapShapeBackgroundSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs14, + type: (0, import_ag_charts_core42.required)((0, import_ag_charts_core42.constant)("map-shape-background")), + topology: import_ag_charts_core42.geoJson +}; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundModule.ts +var MapShapeBackgroundModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-shape-background", + moduleFactory: (ctx) => new MapShapeBackgroundSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $path: ["/1", { $mapPalette: "fill" }, { $mapPalette: "hierarchyColors" }] }, + ["gradient", import_ag_charts_community112._ModuleSupport.FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS], + ["image", import_ag_charts_community112._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community112._ModuleSupport.FILL_PATTERN_HIERARCHY_DEFAULTS] + ] + }), + stroke: { $ref: "chartBackgroundColor" }, + strokeWidth: 1 + } + } +}; +var MapShapeBackgroundSeriesModule = { + type: "series", + name: "map-shape-background", + chartType: "topology", + enterprise: true, + options: mapShapeBackgroundSeriesOptionsDef, + create: (ctx) => new MapShapeBackgroundSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleModule.ts +var import_ag_charts_community121 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeries.ts +var import_ag_charts_community118 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBase.ts +var import_ag_charts_community114 = require("ag-charts-community"); +var import_ag_charts_core43 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/util/radialUtil.ts +var import_ag_charts_community113 = require("ag-charts-community"); +var { createDatumId: createDatumId15, mergeDefaults: mergeDefaults14, toHighlightString: toHighlightString4 } = import_ag_charts_community113._ModuleSupport; +function makeStylerParams(series, highlighted, highlightStateEnum) { + const { id: seriesId } = series; + const { + angleKey, + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + radiusKey, + stackGroup, + stroke, + strokeOpacity, + strokeWidth + } = series.properties; + const highlightState = toHighlightString4(highlightStateEnum ?? import_ag_charts_community113._ModuleSupport.HighlightState.None); + return { + angleKey, + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + radiusKey, + seriesId, + stackGroup, + stroke, + strokeOpacity, + strokeWidth + }; +} +function getStyle(series, ignoreStylerCallback, highlighted, highlightState) { + const { styler } = series.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = makeStylerParams(series, highlighted, highlightState); + stylerResult = series.ctx.optionsGraphService.resolvePartial( + ["series", `${series.declarationOrder}`], + series.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? series.properties.cornerRadius, + fill: stylerResult.fill ?? series.properties.fill, + fillOpacity: stylerResult.fillOpacity ?? series.properties.fillOpacity, + lineDash: stylerResult.lineDash ?? series.properties.lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? series.properties.lineDashOffset, + stroke: stylerResult.stroke ?? series.properties.stroke, + strokeOpacity: stylerResult.strokeOpacity ?? series.properties.strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? series.properties.strokeWidth, + opacity: 1 + }; +} +function makeItemStylerParams(series, nodeDatum, isHighlight, style) { + const { id: seriesId, properties } = series; + const { angleKey, radiusKey } = properties; + const activeHighlight = series.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = series.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = series.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + highlighted: isHighlight, + highlightState: highlightStateString, + angleKey, + radiusKey, + ...style, + fill + }; +} +function getItemStyle(series, nodeDatum, isHighlight, highlightState) { + const { properties } = series; + const { itemStyler } = properties; + const highlightStyle = series.getHighlightStyle(isHighlight, nodeDatum?.datumIndex, highlightState); + const baseStyle = mergeDefaults14( + highlightStyle, + getStyle(series, nodeDatum === void 0, isHighlight, highlightState) + ); + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = series.cachedDatumCallback( + createDatumId15(series.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = makeItemStylerParams(series, nodeDatum, isHighlight, style); + return series.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults14(overrides, style); + } + } + return style; +} + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBase.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS, + DEFAULT_POLAR_DIRECTION_NAMES, + ChartAxisDirection: ChartAxisDirection16, + PolarAxis, + diff: diff6, + fixNumericExtent: fixNumericExtent7, + groupAccumulativeValueProperty, + keyProperty: keyProperty8, + normaliseGroupTo, + resetLabelFn: resetLabelFn5, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation5, + seriesLabelFadeOutAnimation, + valueProperty: valueProperty12, + animationValidation: animationValidation7, + createDatumId: createDatumId16, + SeriesNodePickMode: SeriesNodePickMode12, + normalizeAngle360: normalizeAngle3605, + CategoryScale: CategoryScale3, + motion: motion6, + applyShapeStyle: applyShapeStyle13, + isGradientFill: isGradientFill2, + updateLabelNode: updateLabelNode6, + getItemStyles: getItemStyles3 +} = import_ag_charts_community114._ModuleSupport; +var RadialColumnSeriesNodeEvent = class extends import_ag_charts_community114._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadialColumnSeriesBase = class extends import_ag_charts_community114._ModuleSupport.PolarSeries { + constructor(moduleCtx, { + animationResetFns + }) { + super({ + moduleCtx, + categoryKey: "angleValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES, + canHaveAxes: true, + pickModes: [SeriesNodePickMode12.NEAREST_NODE, SeriesNodePickMode12.EXACT_SHAPE_MATCH], + animationResetFns: { + ...animationResetFns, + label: resetLabelFn5 + } + }); + this.NodeEvent = RadialColumnSeriesNodeEvent; + this.groupScale = new CategoryScale3(); + this.circleCache = { r: 0, cx: 0, cy: 0 }; + } + get hasData() { + return this.getHasData("radiusValue-raw"); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection16.Angle) { + return dataModel.getDomain(this, "angleValue", "key", processedData); + } else { + const yExtent = dataModel.getDomain(this, "radiusValue-end", "value", processedData); + const fixedYExtent = Number.isFinite(yExtent[1] - yExtent[0]) ? [Math.min(yExtent[0], 0), Math.max(yExtent[1], 0)] : []; + return fixNumericExtent7(fixedYExtent); + } + } + async processData(dataController) { + const { angleKey, radiusKey, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const stackGroupId = this.getStackId(); + const stackGroupTrailingId = `${stackGroupId}-trailing`; + const extraProps = []; + if ((0, import_ag_charts_core43.isDefined)(normalizedTo)) { + extraProps.push(normaliseGroupTo([stackGroupId, stackGroupTrailingId], Math.abs(normalizedTo))); + } + if (animationEnabled && this.processedData) { + extraProps.push(diff6(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation7()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const radiusScaleType = this.axes[ChartAxisDirection16.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection16.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty8(angleKey, angleScaleType, { id: "angleValue" }), + valueProperty12(radiusKey, radiusScaleType, { + id: "radiusValue-raw", + invalidValue: null, + ...visibleProps + }), + ...groupAccumulativeValueProperty( + radiusKey, + "normal", + { + id: `radiusValue-end`, + rangeId: `radiusValue-range`, + invalidValue: null, + groupId: stackGroupId, + separateNegative: true, + ...visibleProps + }, + radiusScaleType + ), + ...groupAccumulativeValueProperty( + radiusKey, + "trailing", + { + id: `radiusValue-start`, + invalidValue: null, + groupId: stackGroupTrailingId, + separateNegative: true, + ...visibleProps + }, + radiusScaleType + ), + ...extraProps + ], + groupByKeys: true, + groupByData: false + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (r !== cache.r || cx !== cache.cx || cy !== cache.cy) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + isRadiusAxisReversed() { + return this.axes[ChartAxisDirection16.Radius]?.isReversed(); + } + maybeRefreshNodeData() { + const circleChanged = this.didCircleChange(); + if (!circleChanged && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection16.Radius]; + return radiusAxis instanceof PolarAxis ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + createNodeData() { + const { processedData, dataModel, groupScale } = this; + if (!dataModel || !processedData || processedData.type !== "grouped") + return; + const angleAxis = this.axes[ChartAxisDirection16.Angle]; + const radiusAxis = this.axes[ChartAxisDirection16.Radius]; + const angleScale = angleAxis?.scale; + const radiusScale = radiusAxis?.scale; + if (!angleScale || !radiusScale) { + return; + } + const angleValues = dataModel.resolveKeysById(this, `angleValue`, processedData); + const radiusStartValues = dataModel.resolveColumnById(this, `radiusValue-start`, processedData); + const radiusEndValues = dataModel.resolveColumnById(this, `radiusValue-end`, processedData); + const radiusRawValues = dataModel.resolveColumnById(this, `radiusValue-raw`, processedData); + const radiusRangeIndex = dataModel.resolveProcessedDataIndexById(this, `radiusValue-range`); + let groupPaddingInner = 0; + let groupPaddingOuter = 0; + if (angleAxis instanceof AngleCategoryAxis) { + groupPaddingInner = angleAxis.groupPaddingInner; + groupPaddingOuter = angleAxis.paddingInner; + } + const groupAngleStep = angleScale.bandwidth ?? 0; + const paddedGroupAngleStep = groupAngleStep * (1 - groupPaddingOuter); + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + groupScale.domain = Array.from({ length: visibleGroupCount }).map((_, i) => String(i)); + groupScale.range = [-paddedGroupAngleStep / 2, paddedGroupAngleStep / 2]; + groupScale.paddingInner = visibleGroupCount > 1 ? groupPaddingInner : 0; + const radiusAxisReversed = this.isRadiusAxisReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const axisTotalRadius = axisOuterRadius + axisInnerRadius; + const { angleKey, radiusKey, angleName, radiusName, legendItemName, label } = this.properties; + const radiusDomain = this.getSeriesDomain(ChartAxisDirection16.Radius); + const getLabelNodeDatum = (datum, radiusDatum, x, y) => { + const labelText = this.getLabelText( + radiusDatum, + datum, + radiusKey, + "radius", + radiusDomain, + label, + { value: radiusDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + return { x, y, text: labelText, textAlign: "center", textBaseline: "middle" }; + } + }; + const nodeData = []; + const styles = getItemStyles3( + (nodeDatum, isHighlight, highlightState) => getItemStyle(this, nodeDatum, isHighlight, highlightState) + ); + const context = { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + if (!this.visible) + return context; + const { dataSources } = processedData; + const rawData = dataSources.get(this.id)?.data ?? []; + for (const { datumIndex, group } of dataModel.forEachGroupDatum(this, processedData)) { + const datum = rawData[datumIndex]; + const angleDatum = angleValues[datumIndex]; + if (angleDatum == null) + return; + const radiusDatum = radiusRawValues[datumIndex]; + const isPositive = radiusDatum >= 0 && !Object.is(radiusDatum, -0); + const innerRadiusDatum = radiusStartValues[datumIndex]; + const outerRadiusDatum = radiusEndValues[datumIndex]; + const radiusRange = group.aggregation[radiusRangeIndex][isPositive ? 1 : 0] ?? 0; + const negative = isPositive === radiusAxisReversed; + if (innerRadiusDatum === void 0 || outerRadiusDatum === void 0) + return; + let startAngle; + let endAngle; + if (rawData.length === 1) { + startAngle = -0.5 * Math.PI; + endAngle = 1.5 * Math.PI; + } else { + const groupAngle = angleScale.convert(angleDatum); + startAngle = normalizeAngle3605(groupAngle + groupScale.convert(String(groupIndex))); + endAngle = normalizeAngle3605(startAngle + groupScale.bandwidth); + } + const angle = startAngle + groupScale.bandwidth / 2; + const innerRadius = axisTotalRadius - radiusScale.convert(innerRadiusDatum); + const outerRadius = axisTotalRadius - radiusScale.convert(outerRadiusDatum); + const midRadius = (innerRadius + outerRadius) / 2; + const stackInnerRadius = axisTotalRadius - radiusScale.convert(0); + const stackOuterRadius = axisTotalRadius - radiusScale.convert(radiusRange); + const x = Math.cos(angle) * midRadius; + const y = Math.sin(angle) * midRadius; + const labelNodeDatum = this.properties.label.enabled ? getLabelNodeDatum(datum, radiusDatum, x, y) : void 0; + const columnWidth = this.getColumnWidth(startAngle, endAngle); + nodeData.push({ + series: this, + datum, + datumIndex, + point: { x, y, size: 0 }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + negative, + innerRadius, + outerRadius, + stackInnerRadius, + stackOuterRadius, + startAngle, + endAngle, + midAngle: angle, + axisInnerRadius, + axisOuterRadius, + columnWidth, + index: datumIndex + }); + } + return { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + } + getColumnWidth(_startAngle, _endAngle) { + return Number.NaN; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updateSectorSelection(this.itemSelection, false); + this.updateSectorSelection(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateSectorSelection(selection, isHighlight) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + let selectionData = []; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + if (isHighlight) { + if (activeHighlight?.datum && activeHighlight.series === this) { + selectionData.push(activeHighlight); + } + } else { + selectionData = this.nodeData; + } + const radiusAxisReversed = this.isRadiusAxisReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const fillBBox = this.getShapeFillBBox(); + const hasItemStylers = this.hasItemStylers(); + selection.update(selectionData, void 0, (datum) => this.getDatumId(datum)).each((node, nodeDatum) => { + const { midPoint } = nodeDatum; + if (hasItemStylers) { + const highlightState = this.getHighlightState(activeHighlight, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = getItemStyle(this, nodeDatum, isHighlight, highlightState); + } + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + const fill = style.fill; + const itemBounds = isGradientFill2(fill) && fill.bounds === "item"; + const fillParams = itemBounds ? { centerX: midPoint?.x ?? 0, centerY: midPoint?.y ?? 0 } : { centerX: 0, centerY: 0, innerRadius: axisInnerRadius, outerRadius: axisOuterRadius }; + this.updateItemPath(node, nodeDatum, isHighlight); + applyShapeStyle13(node, style, fillBBox, fillParams); + node.cornerRadius = style.cornerRadius ?? 0; + node.lineJoin = "round"; + }); + } + updateLabels() { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + updateLabelNode6(this, node, this.properties, this.properties.label, datum.label, false, activeHighlight); + node.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + }); + } + animateEmptyUpdateReady() { + const { labelSelection } = this; + const fns = this.getColumnTransitionFunctions(); + motion6.fromToMotion(this.id, "datums", this.ctx.animationManager, [this.itemSelection], fns); + seriesLabelFadeInAnimation5(this, "labels", this.ctx.animationManager, labelSelection); + } + animateClearingUpdateEmpty() { + const { itemSelection } = this; + const { animationManager } = this.ctx; + const fns = this.getColumnTransitionFunctions(); + motion6.fromToMotion(this.id, "datums", animationManager, [itemSelection], fns); + seriesLabelFadeOutAnimation(this, "labels", animationManager, this.labelSelection); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip } = properties; + const angleAxis = axes[ChartAxisDirection16.Angle]; + const radiusAxis = axes[ChartAxisDirection16.Radius]; + const nodeDatum = this.nodeData?.[datumIndex]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis || !nodeDatum) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const angleValue = dataModel.resolveKeysById(this, `angleValue`, processedData)[datumIndex]; + const radiusValue = dataModel.resolveColumnById(this, `radiusValue-raw`, processedData)[datumIndex]; + if (angleValue == null) + return; + const format = getItemStyle(this, nodeDatum, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: radiusName, + fallbackLabel: radiusKey, + value: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + angleName, + radiusKey, + radiusName, + legendItemName, + ...format + } + ); + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.itemSelection.nodes()); + } + legendItemSymbol() { + const { fill, stroke, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = getStyle( + this, + false, + false, + import_ag_charts_community114._ModuleSupport.HighlightState.None + ); + const markerStyle = { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + if (import_ag_charts_community114._ModuleSupport.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: markerStyle + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { radiusKey, radiusName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: radiusKey, + seriesId, + enabled: visible, + label: { + text: legendItemName ?? radiusName ?? radiusKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getDatumId(datum) { + return createDatumId16(datum.angleValue); + } + computeLabelsBBox() { + return null; + } +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBaseProperties.ts +var import_ag_charts_community115 = require("ag-charts-community"); +var { SeriesProperties: SeriesProperties8, makeSeriesTooltip: makeSeriesTooltip17, Property: Property30, Label: Label10 } = import_ag_charts_community115._ModuleSupport; +var RadialColumnSeriesBaseProperties = class extends SeriesProperties8 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.label = new Label10(); + this.tooltip = makeSeriesTooltip17(); + } + getStyle() { + const { fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "angleKey", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "angleName", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "radiusName", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "fill", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "stroke", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "lineDash", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "styler", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "rotation", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "stackGroup", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "normalizedTo", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "label", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleUtil.ts +var import_ag_charts_community117 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnUtil.ts +var import_ag_charts_community116 = require("ag-charts-community"); +var { motion: motion7 } = import_ag_charts_community116._ModuleSupport; +function createAngleMotionCalculator() { + const angles = { + startAngle: /* @__PURE__ */ new Map(), + endAngle: /* @__PURE__ */ new Map() + }; + const angleKeys = ["startAngle", "endAngle"]; + const calculate = (node, datum, status) => { + for (const key of angleKeys) { + const map = angles[key]; + let from2 = (status === "removed" || status === "updated" ? node : datum)[key]; + let to2 = (status === "removed" ? node : datum)[key]; + if (Number.isNaN(to2)) { + to2 = node.previousDatum?.[key] ?? Number.NaN; + } + const diff8 = from2 - to2; + if (Math.abs(diff8) > Math.PI) { + from2 -= Math.sign(diff8) * 2 * Math.PI; + } + map.set(datum, { from: from2, to: to2 }); + } + }; + const getAngles = (datum, fromToKey) => { + return { + startAngle: angles.startAngle.get(datum)[fromToKey], + endAngle: angles.endAngle.get(datum)[fromToKey] + }; + }; + const from = (datum) => getAngles(datum, "from"); + const to = (datum) => getAngles(datum, "to"); + return { calculate, from, to }; +} +function fixRadialColumnAnimationStatus(node, datum, status) { + if (status === "updated") { + if (node.previousDatum == null || Number.isNaN(node.previousDatum.startAngle) || Number.isNaN(node.previousDatum.endAngle)) { + return "added"; + } + if (Number.isNaN(datum.startAngle) || Number.isNaN(datum.endAngle)) { + return "removed"; + } + } + if (status === "added" && node.previousDatum != null) { + return "updated"; + } + return status; +} +function prepareRadialColumnAnimationFunctions(axisZeroRadius) { + const angles = createAngleMotionCalculator(); + const fromFn = (node, datum, status) => { + status = fixRadialColumnAnimationStatus(node, datum, status); + angles.calculate(node, datum, status); + const { startAngle, endAngle } = angles.from(datum); + let innerRadius; + let outerRadius; + let columnWidth; + let axisInnerRadius; + let axisOuterRadius; + if (status === "removed" || status === "updated") { + innerRadius = node.innerRadius; + outerRadius = node.outerRadius; + columnWidth = node.columnWidth; + axisInnerRadius = node.axisInnerRadius; + axisOuterRadius = node.axisOuterRadius; + } else { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + columnWidth = datum.columnWidth; + axisInnerRadius = datum.axisInnerRadius; + axisOuterRadius = datum.axisOuterRadius; + } + const phase = motion7.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { + innerRadius, + outerRadius, + columnWidth, + axisInnerRadius, + axisOuterRadius, + startAngle, + endAngle, + phase + }; + }; + const toFn = (node, datum, status) => { + const { startAngle, endAngle } = angles.to(datum); + let innerRadius; + let outerRadius; + let columnWidth; + let axisInnerRadius; + let axisOuterRadius; + if (status === "removed") { + innerRadius = node.innerRadius; + outerRadius = node.innerRadius; + columnWidth = node.columnWidth; + axisInnerRadius = node.axisInnerRadius; + axisOuterRadius = node.axisOuterRadius; + } else { + innerRadius = Number.isNaN(datum.innerRadius) ? axisZeroRadius : datum.innerRadius; + outerRadius = Number.isNaN(datum.outerRadius) ? axisZeroRadius : datum.outerRadius; + columnWidth = Number.isNaN(datum.columnWidth) ? node.columnWidth : datum.columnWidth; + axisInnerRadius = datum.axisInnerRadius; + axisOuterRadius = datum.axisOuterRadius; + } + return { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle }; + }; + return { toFn, fromFn }; +} +function resetRadialColumnSelectionFn(_node, { + innerRadius, + outerRadius, + columnWidth, + axisInnerRadius, + axisOuterRadius, + startAngle, + endAngle +}) { + return { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle }; +} + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleUtil.ts +var { SectorBox, motion: motion8 } = import_ag_charts_community117._ModuleSupport; +function getRadii(datum) { + const { negative, innerRadius, outerRadius, stackInnerRadius, stackOuterRadius } = datum; + return { + innerRadius: negative ? stackOuterRadius : stackInnerRadius, + outerRadius: negative ? stackInnerRadius : stackOuterRadius, + clipInnerRadius: negative ? outerRadius : innerRadius, + clipOuterRadius: negative ? innerRadius : outerRadius + }; +} +function prepareNightingaleAnimationFunctions(axisZeroRadius) { + const angles = createAngleMotionCalculator(); + const fromFn = (sect, datum, status) => { + status = fixRadialColumnAnimationStatus(sect, datum, status); + angles.calculate(sect, datum, status); + const { startAngle, endAngle } = angles.from(datum); + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed" || status === "updated") { + innerRadius = sect.innerRadius; + outerRadius = sect.outerRadius; + clipSector = sect.clipSector; + } else { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + } + clipSector ?? (clipSector = new SectorBox(startAngle, endAngle, innerRadius, outerRadius)); + const phase = motion8.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { innerRadius, outerRadius, startAngle, endAngle, clipSector, phase }; + }; + const toFn = (_sect, datum, status) => { + const { startAngle, endAngle } = angles.to(datum); + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed") { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + clipSector = new SectorBox(startAngle, endAngle, innerRadius, outerRadius); + } else { + let clipInnerRadius, clipOuterRadius; + ({ innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum)); + if (Number.isNaN(innerRadius)) + innerRadius = axisZeroRadius; + if (Number.isNaN(outerRadius)) + outerRadius = axisZeroRadius; + if (Number.isNaN(clipInnerRadius)) + clipInnerRadius = axisZeroRadius; + if (Number.isNaN(clipOuterRadius)) + clipOuterRadius = axisZeroRadius; + clipSector = new SectorBox(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + } + return { innerRadius, outerRadius, startAngle, endAngle, clipSector }; + }; + return { toFn, fromFn }; +} +function resetNightingaleSelectionFn(_sect, datum) { + const { startAngle, endAngle } = datum; + const { innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum); + const clipSector = new SectorBox(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + return { innerRadius, outerRadius, startAngle, endAngle, clipSector }; +} + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeries.ts +var { Sector: Sector4, SectorBox: SectorBox2, PolarZIndexMap } = import_ag_charts_community118._ModuleSupport; +var NightingaleSeries = class extends RadialColumnSeriesBase { + // TODO: Enable once the options contract has been revisited + // @TempValidate + // sectorSpacing = 1; + constructor(moduleCtx) { + super(moduleCtx, { animationResetFns: { item: resetNightingaleSelectionFn } }); + this.properties = new RadialColumnSeriesBaseProperties(); + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0, PolarZIndexMap.FOREGROUND, zIndex]; + this.highlightGroup.zIndex = [0, PolarZIndexMap.HIGHLIGHT, zIndex]; + this.labelGroup.zIndex = [0, PolarZIndexMap.LABEL, zIndex]; + return true; + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `nightingale-stack-${groupIndex}-yValues`; + } + nodeFactory() { + return new Sector4(); + } + updateItemPath(node, datum, highlight) { + const { negative } = datum; + node.centerX = 0; + node.centerY = 0; + node.startOuterCornerRadius = negative ? 0 : this.properties.cornerRadius; + node.endOuterCornerRadius = negative ? 0 : this.properties.cornerRadius; + node.startInnerCornerRadius = negative ? this.properties.cornerRadius : 0; + node.endInnerCornerRadius = negative ? this.properties.cornerRadius : 0; + if (highlight) { + const { startAngle, endAngle } = datum; + const { innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum); + node.innerRadius = innerRadius; + node.outerRadius = outerRadius; + node.startAngle = startAngle; + node.endAngle = endAngle; + node.clipSector = new SectorBox2(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + } + } + getColumnTransitionFunctions() { + const axisZeroRadius = this.isRadiusAxisReversed() ? this.radius : this.getAxisInnerRadius(); + return prepareNightingaleAnimationFunctions(axisZeroRadius); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +NightingaleSeries.className = "NightingaleSeries"; +NightingaleSeries.type = "nightingale"; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeriesOptionsDef.ts +var import_ag_charts_community119 = require("ag-charts-community"); +var import_ag_charts_core44 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs15, nightingaleSeriesThemeableOptionsDef } = import_ag_charts_community119._ModuleSupport; +var nightingaleSeriesOptionsDef = { + ...commonSeriesOptionsDefs15, + ...nightingaleSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core44.required)((0, import_ag_charts_core44.constant)("nightingale")), + angleKey: (0, import_ag_charts_core44.required)(import_ag_charts_core44.string), + radiusKey: (0, import_ag_charts_core44.required)(import_ag_charts_core44.string), + angleName: import_ag_charts_core44.string, + radiusName: import_ag_charts_core44.string, + legendItemName: import_ag_charts_core44.string, + grouped: import_ag_charts_core44.boolean, + stacked: import_ag_charts_core44.boolean, + stackGroup: import_ag_charts_core44.string, + normalizedTo: import_ag_charts_core44.number +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleThemes.ts +var import_ag_charts_community120 = require("ag-charts-community"); +var { + ThemeConstants: { POLAR_AXIS_TYPE, POLAR_AXIS_SHAPE }, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS4, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS2 +} = import_ag_charts_community120._ModuleSupport; +var NIGHTINGALE_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_SERIES_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS4], + ["pattern", FILL_PATTERN_DEFAULTS2] + ] + }, + stroke: { + $if: [{ $eq: [{ $palette: "type" }, "inbuilt"] }, { $ref: "chartBackgroundColor" }, { $palette: "stroke" }] + }, + strokeWidth: 1, + label: { + ...import_ag_charts_community120._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: import_ag_charts_community120._ModuleSupport.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE.ANGLE_CATEGORY]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE.CIRCLE }, + groupPaddingInner: 0, + paddingInner: 0, + label: { + spacing: 10 + } + }, + [POLAR_AXIS_TYPE.RADIUS_NUMBER]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE.CIRCLE } + } + } +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleModule.ts +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE2 } +} = import_ag_charts_community121._ModuleSupport; +var NightingaleModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "nightingale", + moduleFactory: (ctx) => new NightingaleSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE2.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE2.RADIUS_NUMBER }], + themeTemplate: NIGHTINGALE_SERIES_THEME, + stackable: true, + groupable: true, + stackedByDefault: true +}; +var NightingaleSeriesModule = { + type: "series", + name: "nightingale", + chartType: "polar", + enterprise: true, + options: nightingaleSeriesOptionsDef, + create: (ctx) => new NightingaleSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeries.ts +var import_ag_charts_community123 = require("ag-charts-community"); +var import_ag_charts_core45 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidProperties.ts +var import_ag_charts_community122 = require("ag-charts-community"); +var { SeriesProperties: SeriesProperties9, makeSeriesTooltip: makeSeriesTooltip18, Property: Property31, Label: Label11, DropShadow: DropShadow5 } = import_ag_charts_community122._ModuleSupport; +var PyramidSeriesLabel = class extends Label11 { +}; +var PyramidSeriesStageLabel = class extends Label11 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property31 +], PyramidSeriesStageLabel.prototype, "spacing", 2); +__decorateClass([ + Property31 +], PyramidSeriesStageLabel.prototype, "placement", 2); +var PyramidProperties = class extends SeriesProperties9 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.direction = "vertical"; + this.reverse = void 0; + this.spacing = 0; + this.aspectRatio = void 0; + this.shadow = new DropShadow5().set({ enabled: false }); + this.label = new PyramidSeriesLabel(); + this.stageLabel = new PyramidSeriesStageLabel(); + this.tooltip = makeSeriesTooltip18(); + } + getStyle(index = 0) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index % fills.length], + fillOpacity, + stroke: strokes[index % strokes.length], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property31 +], PyramidProperties.prototype, "stageKey", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "valueKey", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "fills", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "strokes", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "lineDash", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "direction", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "reverse", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "spacing", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "aspectRatio", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "shadow", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "label", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidUtil.ts +function applyPyramidDatum(connector, { x, y, top, right, bottom, left }) { + connector.x0 = x - top / 2; + connector.x1 = x + top / 2; + connector.x2 = x + bottom / 2; + connector.x3 = x - bottom / 2; + connector.y0 = y - left / 2; + connector.y1 = y - right / 2; + connector.y2 = y + right / 2; + connector.y3 = y + left / 2; +} +function preparePyramidAnimationFunctions(direction) { + const fromFn = (_connector, datum) => { + const { x, y } = datum; + let { top, right, bottom, left } = datum; + if (direction === "vertical") { + top = 0; + bottom = 0; + } else { + left = 0; + right = 0; + } + return { x, y, top, right, bottom, left }; + }; + const toFn = (_connector, datum) => { + const { x, y, top, right, bottom, left } = datum; + return { x, y, top, right, bottom, left }; + }; + const applyFn = applyPyramidDatum; + return { fromFn, toFn, applyFn }; +} + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeries.ts +var { + StateMachine: StateMachine3, + valueProperty: valueProperty13, + SeriesNodePickMode: SeriesNodePickMode13, + createDatumId: createDatumId17, + BBox: BBox12, + Group: Group12, + Selection: Selection11, + Text: Text5, + PointerEvents: PointerEvents9, + applyShapeStyle: applyShapeStyle14, + mergeDefaults: mergeDefaults15, + fromToMotion: fromToMotion4, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation6, + getLabelStyles: getLabelStyles5 +} = import_ag_charts_community123._ModuleSupport; +var PyramidSeries = class extends import_ag_charts_community123._ModuleSupport.DataModelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [SeriesNodePickMode13.EXACT_SHAPE_MATCH, SeriesNodePickMode13.NEAREST_NODE] + }); + this.properties = new PyramidProperties(); + this.itemGroup = this.contentGroup.appendChild(new Group12({ name: "itemGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group12({ name: "itemLabelGroup" })); + this.stageLabelGroup = this.contentGroup.appendChild(new Group12({ name: "stageLabelGroup" })); + this.datumSelection = Selection11.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection11.select( + this.itemLabelGroup, + Text5 + ); + this.stageLabelSelection = Selection11.select(this.stageLabelGroup, Text5); + this.highlightDatumSelection = Selection11.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this.animationState = new StateMachine3( + "empty", + { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + clear: "empty", + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + this.itemLabelGroup.pointerEvents = PointerEvents9.None; + this.stageLabelGroup.pointerEvents = PointerEvents9.None; + } + addChartEventListeners() { + this.cleanup.register(this.ctx.eventsHub.on("legend:item-click", (event) => this.onLegendItemClick(event))); + } + nodeFactory() { + return new FunnelConnector(); + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + async processData(dataController) { + if (this.data == null) + return; + const { + id: seriesId, + visible, + ctx: { legendManager } + } = this; + const { stageKey, valueKey } = this.properties; + const xScaleType = "category"; + const yScaleType = "number"; + const validation = (_value, _datum, index) => visible && legendManager.getItemEnabled({ seriesId, itemId: index }); + const visibleProps = this.visible ? {} : { forceValue: 0 }; + await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty13(stageKey, xScaleType, { id: "xValue" }), + valueProperty13(valueKey, yScaleType, { id: `yValue`, ...visibleProps, validation, invalidValue: 0 }) + ] + }); + } + createNodeData() { + const { + id: seriesId, + dataModel, + processedData, + properties, + visible, + ctx: { legendManager } + } = this; + const { + stageKey, + valueKey, + direction, + reverse = direction === "horizontal", + spacing, + aspectRatio, + label, + stageLabel + } = properties; + if (dataModel == null || processedData == null) + return; + const horizontal = direction === "horizontal"; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const xDomain = dataModel.getDomain(this, "xValue", "value", processedData); + const yDomain = dataModel.getDomain(this, "yValue", "value", processedData); + const textMeasurer = (0, import_ag_charts_core45.cachedTextMeasurer)(stageLabel); + let textAlign; + let textBaseline; + if (horizontal) { + textAlign = "center"; + textBaseline = stageLabel.placement === "before" ? "bottom" : "top"; + } else { + textAlign = stageLabel.placement === "after" ? "left" : "right"; + textBaseline = "middle"; + } + const stageLabelData = stageLabel.enabled ? [] : void 0; + let maxLabelWidth = 0; + let maxLabelHeight = 0; + let yTotal = 0; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + const enabled = visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + yTotal += yValue; + if (stageLabelData == null) + continue; + const text = this.getLabelText( + xValue2, + datum, + stageKey, + "x", + xDomain, + this.properties.stageLabel, + { datum, value: yValue, stageKey, valueKey } + ); + const { width, height } = (0, import_ag_charts_core45.isArray)(text) ? (0, import_ag_charts_core45.measureTextSegments)(text, label) : textMeasurer.measureLines(text); + maxLabelWidth = Math.max(maxLabelWidth, width); + maxLabelHeight = Math.max(maxLabelHeight, height); + stageLabelData.push({ + x: Number.NaN, + y: Number.NaN, + text, + textAlign, + textBaseline, + visible: enabled + }); + } + const seriesRectWidth = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const seriesRectHeight = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const totalSpacing = spacing * (processedData.input.count - 1); + let bounds; + if (horizontal) { + const verticalInset = maxLabelHeight + stageLabel.spacing; + bounds = new BBox12( + 0, + stageLabel.placement === "before" ? verticalInset : 0, + seriesRectWidth, + seriesRectHeight - verticalInset + ); + } else { + const horizontalInset = maxLabelWidth + stageLabel.spacing; + bounds = new BBox12( + stageLabel.placement === "after" ? 0 : horizontalInset, + 0, + seriesRectWidth - horizontalInset, + seriesRectHeight + ); + } + if (aspectRatio != null && aspectRatio !== 0) { + const directionalAspectRatio = direction === "horizontal" ? 1 / aspectRatio : aspectRatio; + const constrainedWidth = Math.min(bounds.width, bounds.height * directionalAspectRatio); + const constrainedHeight = constrainedWidth / directionalAspectRatio; + bounds = new BBox12( + bounds.x + (bounds.width - constrainedWidth) / 2, + bounds.y + (bounds.height - constrainedHeight) / 2, + constrainedWidth, + constrainedHeight + ); + } + let labelX; + let labelY; + if (horizontal) { + labelY = stageLabel.placement === "before" ? bounds.y - stageLabel.spacing : bounds.y + bounds.height + stageLabel.spacing; + } else { + labelX = stageLabel.placement === "after" ? bounds.x + bounds.width + stageLabel.spacing : bounds.x - stageLabel.spacing; + } + const availableWidth = bounds.width - (horizontal ? totalSpacing : 0); + const availableHeight = bounds.height - (horizontal ? 0 : totalSpacing); + if (availableWidth < 0 || availableHeight < 0) + return; + const nodeData = []; + const labelData = []; + let yStart = 0; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + const enabled = visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + const yEnd = yStart + yValue; + const yMidRatio = (yStart + yEnd) / (2 * yTotal); + const yRangeRatio = (yEnd - yStart) / yTotal; + const xOffset = horizontal ? availableWidth * yMidRatio + spacing * datumIndex : availableWidth * 0.5; + const yOffset = horizontal ? availableHeight * 0.5 : availableHeight * yMidRatio + spacing * datumIndex; + const x = bounds.x + xOffset; + const y = bounds.y + yOffset; + if (stageLabelData != null) { + const stageLabelDatum = stageLabelData[datumIndex]; + stageLabelDatum.x = labelX ?? x; + stageLabelDatum.y = labelY ?? y; + } + let top; + let right; + let bottom; + let left; + if (horizontal) { + const barWidth = availableWidth * yRangeRatio; + top = barWidth; + bottom = barWidth; + const y0 = (xOffset + barWidth / 2) * (availableHeight / bounds.width); + const y1 = (xOffset - barWidth / 2) * (availableHeight / bounds.width); + right = reverse ? bounds.height - y0 : y0; + left = reverse ? bounds.height - y1 : y1; + } else { + const barHeight = availableHeight * yRangeRatio; + right = barHeight; + left = barHeight; + const x0 = (yOffset - barHeight / 2) * (availableWidth / bounds.height); + const x1 = (yOffset + barHeight / 2) * (availableWidth / bounds.height); + top = reverse ? bounds.width - x0 : x0; + bottom = reverse ? bounds.width - x1 : x1; + } + const text = this.getLabelText( + yValue, + datum, + valueKey, + "y", + yDomain, + label, + { + datum, + value: yValue, + stageKey, + valueKey + } + ); + const labelDatum = { + x, + y, + text, + textAlign: "center", + textBaseline: "middle", + visible: enabled + }; + labelData.push(labelDatum); + nodeData.push({ + series: this, + itemId: valueKey, + datum, + datumIndex, + index: datumIndex, + xValue: xValue2, + yValue, + x, + y, + top, + right, + bottom, + left, + label: labelDatum, + enabled, + midPoint: { + x, + y + }, + style: this.getItemStyle({ datumIndex, datum }, false) + }); + yStart = yEnd; + } + return { + itemId: seriesId, + nodeData, + labelData, + stageLabelData, + bounds + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update({ seriesRect }) { + this.checkResize(seriesRect); + const { datumSelection, labelSelection, stageLabelSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedDatum != null && (highlightedDatum.series !== this || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const stageLabelData = this.contextNodeData?.stageLabelData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection, isHighlight: false }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection, labelProperties: this.properties.label }); + this.stageLabelSelection = this.updateStageLabelSelection({ stageLabelData, stageLabelSelection }); + this.updateLabelNodes({ + labelSelection: stageLabelSelection, + labelProperties: this.properties.stageLabel + }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData); + } + getItemStyle({ datumIndex, datum }, isHighlight) { + const { properties } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults15(highlightStyle, properties.getStyle(datumIndex)); + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId17(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults15(overrides, style); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId, properties } = this; + const { stageKey, valueKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + stageKey, + valueKey, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const { properties } = this; + const { shadow } = properties; + const bounds = this.contextNodeData?.bounds; + const fillBBox = bounds ? { series: bounds, axis: bounds } : void 0; + datumSelection.each((connector, nodeDatum) => { + applyShapeStyle14(connector, nodeDatum.style, fillBBox); + applyPyramidDatum(connector, nodeDatum); + connector.fillShadow = shadow; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(this.properties.label.enabled ? opts.labelData : []); + } + updateStageLabelSelection(opts) { + return opts.stageLabelSelection.update(opts.stageLabelData); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, nodeDatum, datumIndex) => { + const { visible, x, y, text, textAlign, textBaseline } = nodeDatum; + const style = getLabelStyles5( + this, + void 0, + this.properties, + opts.labelProperties, + false, + activeHighlight + ); + const { color: fill, fontSize, fontStyle, fontWeight, fontFamily } = style; + label.visible = visible; + label.x = x; + label.y = y; + label.text = text; + label.fill = fill; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + label.setBoxing(style); + }); + } + computeFocusBounds(opts) { + const datum = this.getNodeData()?.[opts.datumIndex]; + if (datum === void 0) + return; + for (const node of this.datumSelection) { + if (node.datum === datum) { + return node.node; + } + } + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { stageKey, valueKey, tooltip } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, "xValue", processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const label = this.getLabelText( + xValue2, + datum, + stageKey, + "x", + dataModel.getDomain(this, "xValue", "value", processedData), + this.properties.stageLabel, + { datum, value: xValue2, stageKey, valueKey } + ); + const value = this.getLabelText( + yValue, + datum, + valueKey, + "y", + dataModel.getDomain(this, "yValue", "value", processedData), + this.properties.stageLabel, + { datum, value: yValue, stageKey, valueKey } + ); + const format = this.getItemStyle({ datumIndex, datum }, false); + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(datumIndex), + data: [{ label: (0, import_ag_charts_core45.toPlainText)(label), value: (0, import_ag_charts_core45.toPlainText)(value) }] + }, + { + seriesId, + datum, + title: void 0, + stageKey, + valueKey, + ...format + } + ); + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + legendItemSymbol(datumIndex) { + const { fills, strokes, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.properties; + const fill = fills[datumIndex] ?? "black"; + const stroke = strokes[datumIndex] ?? "black"; + return { + marker: { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + processedData, + dataModel, + id: seriesId, + ctx: { legendManager }, + visible + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { showInLegend } = this.properties; + const legendData = []; + const stageValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex] of rawData.entries()) { + const stageValue = stageValues[datumIndex]; + legendData.push({ + legendType: "category", + id: seriesId, + itemId: datumIndex, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { text: stageValue }, + symbol: this.legendItemSymbol(datumIndex), + hideInLegend: !showInLegend + }); + } + return legendData; + } + animateReset() { + this.ctx.animationManager.skipCurrentBatch(); + this.ctx.animationManager.stopByAnimationGroupId(this.id); + } + animateEmptyUpdateReady() { + const { datumSelection, labelSelection, properties } = this; + const fns = preparePyramidAnimationFunctions(properties.direction); + fromToMotion4(this.id, "nodes", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation6(this, "labels", this.ctx.animationManager, labelSelection); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +PyramidSeries.className = "PyramidSeries"; +PyramidSeries.type = "pyramid"; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeriesOptionsDef.ts +var import_ag_charts_community124 = require("ag-charts-community"); +var import_ag_charts_core46 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs16, pyramidSeriesThemeableOptionsDef } = import_ag_charts_community124._ModuleSupport; +var pyramidSeriesOptionsDef = { + ...pyramidSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs16, + type: (0, import_ag_charts_core46.required)((0, import_ag_charts_core46.constant)("pyramid")), + stageKey: (0, import_ag_charts_core46.required)(import_ag_charts_core46.string), + valueKey: (0, import_ag_charts_core46.required)(import_ag_charts_core46.string) +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidThemes.ts +var import_ag_charts_community125 = require("ag-charts-community"); +var { + ThemeSymbols: { DEFAULT_SHADOW_COLOUR: DEFAULT_SHADOW_COLOUR2 } +} = import_ag_charts_community125._ModuleSupport; +var PYRAMID_SERIES_THEME = { + series: { + direction: "vertical", + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + spacing: 2, + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", import_ag_charts_community125._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", import_ag_charts_community125._ModuleSupport.FILL_PATTERN_DEFAULTS], + ["image", import_ag_charts_community125._ModuleSupport.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + label: { + ...import_ag_charts_community125._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + stageLabel: { + ...import_ag_charts_community125._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 12 + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR2, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + // @ts-expect-error undocumented option + highlight: import_ag_charts_community125._ModuleSupport.singleSeriesHighlightStyle() + } +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidModule.ts +var PyramidSeriesModule = { + type: "series", + name: "pyramid", + chartType: "standalone", + enterprise: true, + options: pyramidSeriesOptionsDef, + create: (ctx) => new PyramidSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaModule.ts +var import_ag_charts_community132 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radar/radarThemes.ts +var import_ag_charts_community126 = require("ag-charts-community"); +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE3 } +} = import_ag_charts_community126._ModuleSupport; +var BASE_RADAR_SERIES_THEME = { + series: { + stroke: { $palette: "stroke" }, + label: { + ...import_ag_charts_community126._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + marker: { + enabled: true, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community126._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", import_ag_charts_community126._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community126._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + fillOpacity: 1, + shape: "circle", + size: 6, + strokeOpacity: 1, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] } + }, + highlight: import_ag_charts_community126._ModuleSupport.multiSeriesHighlightStyle(), + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + } + }, + axes: { + [POLAR_AXIS_TYPE3.ANGLE_CATEGORY]: { + label: { + spacing: 10 + } + } + } +}; +var RADAR_LINE_SERIES_THEME = import_ag_charts_community126._ModuleSupport.mergeDefaults( + { + series: { + stroke: import_ag_charts_community126._ModuleSupport.SAFE_STROKE_FILL_OPERATION, + strokeWidth: 2 + } + }, + BASE_RADAR_SERIES_THEME +); +var RADAR_AREA_SERIES_THEME = import_ag_charts_community126._ModuleSupport.mergeDefaults( + { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community126._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", import_ag_charts_community126._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community126._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: 0.8, + strokeWidth: 2, + marker: { + enabled: false + } + } + }, + BASE_RADAR_SERIES_THEME +); + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeries.ts +var import_ag_charts_community130 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radar/radarSeries.ts +var import_ag_charts_community128 = require("ag-charts-community"); +var import_ag_charts_core47 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/radar/radarSeriesProperties.ts +var import_ag_charts_community127 = require("ag-charts-community"); +var { Label: Label12, SeriesMarker: SeriesMarker2, SeriesProperties: SeriesProperties10, makeSeriesTooltip: makeSeriesTooltip19, Property: Property32 } = import_ag_charts_community127._ModuleSupport; +var RadarSeriesProperties = class extends SeriesProperties10 { + constructor() { + super(...arguments); + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.rotation = 0; + this.marker = new SeriesMarker2(); + this.label = new Label12(); + this.tooltip = makeSeriesTooltip19(); + this.connectMissingData = false; + } +}; +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "angleKey", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "angleName", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "radiusName", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "rotation", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "marker", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "connectMissingData", 2); + +// packages/ag-charts-enterprise/src/series/radar/radarSeries.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS2, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES2, + ChartAxisDirection: ChartAxisDirection17, + PolarAxis: PolarAxis2, + SeriesNodePickMode: SeriesNodePickMode14, + valueProperty: valueProperty14, + fixNumericExtent: fixNumericExtent8, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation7, + markerFadeInAnimation: markerFadeInAnimation2, + resetMarkerFn: resetMarkerFn2, + animationValidation: animationValidation8, + computeMarkerFocusBounds: computeMarkerFocusBounds3, + extent: extent2, + BBox: BBox13, + Group: Group13, + Path: Path10, + Selection: Selection12, + Text: Text6, + Marker: Marker4, + updateLabelNode: updateLabelNode7, + getMarkerStyles: getMarkerStyles2, + mergeDefaults: mergeDefaults16 +} = import_ag_charts_community128._ModuleSupport; +var RadarSeriesNodeEvent = class extends import_ag_charts_community128._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadarSeries = class extends import_ag_charts_community128._ModuleSupport.PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: "angleValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS2, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES2, + pickModes: [SeriesNodePickMode14.NEAREST_NODE, SeriesNodePickMode14.EXACT_SHAPE_MATCH], + canHaveAxes: true, + animationResetFns: { + item: resetMarkerFn2 + }, + clipFocusBox: false + }); + this.NodeEvent = RadarSeriesNodeEvent; + this.lineGroup = this.contentGroup.appendChild(new Group13({ name: "radar-line" })); + this.lineSelection = Selection12.select( + this.lineGroup, + Path10 + ); + this.resetInvalidToZero = false; + this.circleCache = { r: 0, cx: 0, cy: 0 }; + this.lineGroup.zIndex = 0; + this.itemGroup.zIndex = 1; + } + get hasData() { + return this.getHasData("angleValue"); + } + nodeFactory() { + return new Marker4(); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection17.Angle) { + return dataModel.getDomain(this, `angleValue`, "value", processedData); + } else { + const domain = dataModel.getDomain(this, `radiusValue`, "value", processedData); + const ext = extent2(domain.length === 0 ? domain : [0].concat(domain)); + return fixNumericExtent8(ext); + } + } + async processData(dataController) { + const { angleKey, radiusKey } = this.properties; + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + extraProps.push(animationValidation8()); + } + const radiusScaleType = this.axes[ChartAxisDirection17.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection17.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty14(angleKey, angleScaleType, { id: "angleValue" }), + valueProperty14(radiusKey, radiusScaleType, { id: "radiusValue", invalidValue: void 0 }), + ...extraProps + ] + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (!(r === cache.r && cx === cache.cx && cy === cache.cy)) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection17.Radius]; + return radiusAxis instanceof PolarAxis2 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + maybeRefreshNodeData() { + const didCircleChange = this.didCircleChange(); + if (!didCircleChange && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + createNodeData() { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return; + const { angleKey, radiusKey, angleName, radiusName, legendItemName, marker, label } = this.properties; + const angleScale = this.axes[ChartAxisDirection17.Angle]?.scale; + const radiusScale = this.axes[ChartAxisDirection17.Radius]?.scale; + if (!angleScale || !radiusScale) { + return; + } + const angleValues = dataModel.resolveColumnById(this, `angleValue`, processedData); + const radiusValues = dataModel.resolveColumnById(this, `radiusValue`, processedData); + const axisInnerRadius = this.getAxisInnerRadius(); + const radiusDomain = this.getSeriesDomain(ChartAxisDirection17.Radius); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const nodeData = rawData.map((datum, datumIndex) => { + const angleDatum = angleValues[datumIndex]; + const radiusDatum = radiusValues[datumIndex]; + const angle = angleScale.convert(angleDatum); + const radius = this.radius + axisInnerRadius - radiusScale.convert(radiusDatum); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + const x = cos * radius; + const y = sin * radius; + let labelNodeDatum; + if (label.enabled) { + const labelText = this.getLabelText( + radiusDatum, + datum, + radiusKey, + "radius", + radiusDomain, + label, + { value: radiusDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + let textAlign = "right"; + if ((0, import_ag_charts_core47.isNumberEqual)(cos, 0)) { + textAlign = "center"; + } else if (cos > 0) { + textAlign = "left"; + } + let textBaseline = "bottom"; + if ((0, import_ag_charts_core47.isNumberEqual)(sin, 0)) { + textBaseline = "middle"; + } else if (sin > 0) { + textBaseline = "top"; + } + labelNodeDatum = { + x: x + cos * marker.size, + y: y + sin * marker.size, + text: labelText, + textAlign, + textBaseline + }; + } + } + return { + series: this, + datum, + datumIndex, + index: datumIndex, + point: { x, y, size: marker.size }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + missing: !(0, import_ag_charts_core47.isFiniteNumber)(angle) || !(0, import_ag_charts_core47.isFiniteNumber)(radius) + }; + }); + return { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles: getMarkerStyles2(this, this.properties, marker) + }; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const { series } = this.ctx.highlightManager?.getActiveHighlight() ?? {}; + this.highlightGroup.visible = (animationEnabled || this.visible) && series === this; + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updatePathSelections(); + this.updateMarkerSelection(); + this.updateHighlightSelection(); + this.updatePathNodes(); + if (this.hasItemStylers()) { + this.updateDatumStyles(this.itemSelection, false); + this.updateDatumStyles(this.highlightSelection, true); + } + this.updateMarkers(this.itemSelection, false); + this.updateMarkers(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updatePathSelections() { + const pathData = this.visible ? [true] : []; + this.lineSelection.update(pathData); + } + updateMarkerSelection() { + const { marker, styler } = this.properties; + if (marker.isDirty()) { + this.itemSelection.clear(); + this.itemSelection.cleanup(); + this.itemSelection = Selection12.select(this.itemGroup, () => this.nodeFactory(), false); + } + const markersEnabled = styler == null ? marker.enabled : this.getStyle(false).marker.enabled; + const data = this.visible && marker.shape && markersEnabled ? this.nodeData : []; + this.itemSelection.update(data); + } + updateHighlightSelection() { + const { marker, styler } = this.properties; + if (marker.isDirty()) { + this.highlightSelection.clear(); + this.highlightSelection.cleanup(); + this.highlightSelection = Selection12.select(this.highlightGroup, () => this.nodeFactory(), false); + } + const markersEnabled = styler == null ? marker.enabled : this.getStyle(false).marker.enabled; + const highlighted = this.ctx.highlightManager?.getActiveHighlight(); + const data = this.visible && marker.shape && markersEnabled && highlighted?.datum ? [{ ...highlighted }] : []; + this.highlightSelection.update(data); + } + getMarkerFill(highlightedStyle) { + return highlightedStyle?.fill ?? this.getStyle(false).marker.fill; + } + getDatumStylerProperties(datum) { + const { id: seriesId, properties } = this; + const { angleKey, radiusKey } = properties; + return { + seriesId, + datum, + angleKey, + radiusKey + }; + } + updateDatumStyles(selection, isHighlight) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + selection.each((_, datum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { stroke, strokeWidth, strokeOpacity } = stylerStyle; + datum.style = this.getMarkerStyle( + this.properties.marker, + datum, + this.getDatumStylerProperties(datum.datum), + { isHighlight, highlightState }, + stylerStyle.marker, + { + stroke, + strokeWidth, + strokeOpacity + } + ); + }); + } + updateMarkers(selection, isHighlight) { + const fillBBox = this.getShapeFillBBox(); + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + selection.each((node, datum) => { + const style = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style, node, datum.point, fillBBox); + }); + } + updateLabels() { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + if (datum.label) { + const isHighlight = false; + node.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + updateLabelNode7(this, node, properties, properties.label, datum.label, isHighlight, activeHighlight); + } + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip, marker } = properties; + const angleAxis = axes[ChartAxisDirection17.Angle]; + const radiusAxis = axes[ChartAxisDirection17.Radius]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const angleValue = dataModel.resolveColumnById(this, `angleValue`, processedData)[datumIndex]; + const radiusValue = dataModel.resolveColumnById(this, `radiusValue`, processedData)[datumIndex]; + if (angleValue == null) + return; + const activeStyle = this.getMarkerStyle(marker, { datum, datumIndex }, this.getDatumStylerProperties(datum), { + isHighlight: false + }); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: radiusName, + fallbackLabel: radiusKey, + value: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + radiusKey, + angleName, + radiusName, + legendItemName, + ...activeStyle + } + ); + } + legendItemSymbol() { + const { stroke, strokeWidth, strokeOpacity, lineDash, marker } = this.getStyle(false); + const markerStyle = { + shape: marker.shape, + enabled: marker.enabled || strokeWidth <= 0, + fill: this.getMarkerFill() ?? marker.stroke ?? stroke ?? "rgba(0, 0, 0, 0)", + stroke: marker.stroke ?? stroke ?? "rgba(0, 0, 0, 0)", + fillOpacity: marker.fillOpacity, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }; + return { + marker: markerStyle, + line: { + stroke, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { radiusKey, radiusName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: radiusKey, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: radiusKey }), + label: { + text: legendItemName ?? radiusName ?? radiusKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + pickNodeClosestDatum(hitPoint) { + const { nodeData, centerX: cx, centerY: cy } = this; + const { x, y } = hitPoint; + const radius = this.radius; + const distanceFromCenter = Math.hypot(x - cx, y - cy); + if (distanceFromCenter > radius + this.properties.marker.size) { + return; + } + let minDistance = Infinity; + let closestDatum; + for (const datum of nodeData) { + const { point: { x: datumX = Number.NaN, y: datumY = Number.NaN } = {} } = datum; + if (Number.isNaN(datumX) || Number.isNaN(datumY)) { + continue; + } + const distance = Math.hypot(hitPoint.x - datumX - cx, hitPoint.y - datumY - cy); + if (distance < minDistance) { + minDistance = distance; + closestDatum = datum; + } + } + if (closestDatum) { + const distance = Math.max(minDistance - (closestDatum.point?.size ?? 0), 0); + return { datum: closestDatum, distance }; + } + } + computeLabelsBBox() { + const { label } = this.properties; + this.maybeRefreshNodeData(); + const textBoxes = []; + const tempText = new Text6(); + for (const nodeDatum of this.nodeData) { + if (!label.enabled || !nodeDatum.label) { + continue; + } + tempText.text = nodeDatum.label.text; + tempText.x = nodeDatum.label.x; + tempText.y = nodeDatum.label.y; + tempText.setFont(label); + tempText.setAlign(nodeDatum.label); + const box = tempText.getBBox(); + textBoxes.push(box); + } + if (textBoxes.length === 0) { + return null; + } + return BBox13.merge(textBoxes); + } + getLineNode() { + return this.lineSelection?.at(0); + } + beforePathAnimation() { + this.updatePathNodes(); + } + getPathNodesStyle() { + const highlightDatum = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightState(highlightDatum); + const highlightStyle = this.getHighlightStyle(void 0, void 0, highlightState); + const stylerStyle = this.getStyle(false, highlightState); + return mergeDefaults16(highlightStyle, stylerStyle); + } + getLinePoints() { + const { nodeData, resetInvalidToZero } = this; + const { connectMissingData } = this.properties; + if (nodeData.length === 0) { + return []; + } + const radiusAxis = this.axes[ChartAxisDirection17.Radius]; + const angleAxis = this.axes[ChartAxisDirection17.Angle]; + const reversedAngleAxis = angleAxis?.isReversed(); + const reversedRadiusAxis = radiusAxis?.isReversed(); + const data = reversedRadiusAxis && !reversedAngleAxis ? [...nodeData].reverse() : nodeData; + const points = []; + let prevPointInvalid = false; + let firstValid; + for (const [index, datum] of data.entries()) { + let { x, y } = datum.point; + const isPointInvalid = Number.isNaN(x) || Number.isNaN(y); + if (!isPointInvalid) { + firstValid ?? (firstValid = datum); + } + if (isPointInvalid && !connectMissingData) { + x = 0; + y = 0; + } + const moveTo2 = index === 0 || !resetInvalidToZero && !connectMissingData && (isPointInvalid || prevPointInvalid); + points.push({ x, y, moveTo: moveTo2 }); + prevPointInvalid = isPointInvalid; + } + if (firstValid !== void 0) { + points.push({ x: firstValid.point.x, y: firstValid.point.y, moveTo: false }); + } + return points; + } + animateSinglePath(pathNode, points, ratio3) { + const { path } = pathNode; + path.clear(true); + const axisInnerRadius = this.getAxisInnerRadius(); + const radiusAxis = this.axes[ChartAxisDirection17.Radius]; + const reversedRadiusAxis = radiusAxis?.isReversed(); + const radiusZero = reversedRadiusAxis ? this.radius + axisInnerRadius - radiusAxis?.scale.convert(0) : axisInnerRadius; + for (const point of points) { + const { x: x1, y: y1, arc, radius = 0, startAngle = 0, endAngle = 0, moveTo: moveTo2 } = point; + const angle = Math.atan2(y1, x1); + const x0 = radiusZero * Math.cos(angle); + const y0 = radiusZero * Math.sin(angle); + const t = ratio3; + const x = x0 * (1 - t) + x1 * t; + const y = y0 * (1 - t) + y1 * t; + if (arc) { + path.arc(x1, y1, radius, startAngle, endAngle); + } else if (moveTo2) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + pathNode.checkPathDirty(); + } + animatePaths(ratio3) { + const linePoints = this.getLinePoints(); + const lineNode = this.getLineNode(); + if (!lineNode) + return; + this.animateSinglePath(lineNode, linePoints, ratio3); + } + animateEmptyUpdateReady() { + const { itemSelection, labelSelection } = this; + const { animationManager } = this.ctx; + this.beforePathAnimation(); + animationManager.animate({ + id: `${this.id}_'path`, + groupId: this.id, + from: 0, + to: 1, + phase: "initial", + collapsable: false, + onUpdate: (ratio3) => this.animatePaths(ratio3), + onStop: () => this.animatePaths(1) + }); + markerFadeInAnimation2(this, animationManager, "added", itemSelection); + seriesLabelFadeInAnimation7(this, "labels", animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + super.animateWaitingUpdateReady(data); + this.resetPaths(); + } + animateReadyResize(data) { + super.animateReadyResize(data); + this.resetPaths(); + } + resetPaths() { + const lineNode = this.getLineNode(); + if (lineNode) { + const { path: linePath } = lineNode; + const linePoints = this.getLinePoints(); + const stylerStyle = this.getStyle(false); + lineNode.fill = void 0; + lineNode.stroke = stylerStyle.stroke; + lineNode.strokeWidth = stylerStyle.strokeWidth; + lineNode.strokeOpacity = stylerStyle.strokeOpacity; + lineNode.lineDash = stylerStyle.lineDash; + lineNode.lineDashOffset = stylerStyle.lineDashOffset; + linePath.clear(true); + for (const { x, y, moveTo: moveTo2 } of linePoints) { + if (moveTo2) { + linePath.moveTo(x, y); + } else { + linePath.lineTo(x, y); + } + } + lineNode.checkPathDirty(); + return stylerStyle; + } + } + getStylerResult(stylerResult, highlighted, highlightState) { + const { styler } = this.properties; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + const cbResult = this.cachedCallWithContext(styler, stylerParams) ?? {}; + const resolved = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + cbResult, + { pick: false } + ); + if (resolved) { + stylerResult = resolved; + } + } + return stylerResult; + } + getFormattedMarkerStyle(datum) { + const { angleKey, radiusKey } = this.properties; + return this.getMarkerStyle(this.properties.marker, datum, { angleKey, radiusKey }, { isHighlight: true }); + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds3(this, opts); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RadarSeries.className = "RadarSeries"; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeriesProperties.ts +var import_ag_charts_community129 = require("ag-charts-community"); +var { Property: Property33 } = import_ag_charts_community129._ModuleSupport; +var RadarAreaSeriesProperties = class extends RadarSeriesProperties { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + } +}; +__decorateClass([ + Property33 +], RadarAreaSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property33 +], RadarAreaSeriesProperties.prototype, "fillOpacity", 2); + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeries.ts +var { + ChartAxisDirection: ChartAxisDirection18, + Group: Group14, + HighlightState: HighlightState4, + Path: Path11, + PointerEvents: PointerEvents10, + Selection: Selection13, + applyShapeStyle: applyShapeStyle15, + toHighlightString: toHighlightString5 +} = import_ag_charts_community130._ModuleSupport; +var RadarAreaSeries = class extends RadarSeries { + constructor(moduleCtx) { + super(moduleCtx); + this.properties = new RadarAreaSeriesProperties(); + this.areaGroup = this.contentGroup.appendChild(new Group14({ name: "radar-area" })); + this.areaSelection = Selection13.select( + this.areaGroup, + Path11 + ); + this.resetInvalidToZero = true; + this.areaGroup.zIndex = -1; + } + updatePathSelections() { + const pathData = this.visible ? [true] : []; + this.areaSelection.update(pathData); + super.updatePathSelections(); + } + getAreaNode() { + return this.areaSelection.at(0); + } + getMarkerFill(highlightedStyle) { + if (highlightedStyle?.fill != null) + return highlightedStyle.fill; + const stylerStyle = this.getStyle(false); + return stylerStyle.marker.fill ?? stylerStyle.fill; + } + updatePathNodes() { + const styles = this.getPathNodesStyle(); + const { fill, fillOpacity, strokeWidth, stroke, strokeOpacity, lineDash, lineDashOffset, opacity } = styles; + const lineNode = this.getLineNode(); + if (lineNode) { + lineNode.setProperties({ + fill: void 0, + lineJoin: "round", + lineCap: "round", + pointerEvents: PointerEvents10.None, + opacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + } + const areaNode = this.getAreaNode(); + if (areaNode) { + applyShapeStyle15(areaNode, { fill, fillOpacity, stroke: void 0 }, this.getShapeFillBBox()); + areaNode.setProperties({ + lineJoin: "round", + pointerEvents: PointerEvents10.None, + opacity + }); + } + } + animatePaths(ratio3) { + super.animatePaths(ratio3); + const areaNode = this.getAreaNode(); + if (areaNode) { + this.animateSinglePath(areaNode, this.getAreaPoints(), ratio3); + } + } + getAreaPoints() { + const points = this.getLinePoints(); + const getPolarAxis = (direction) => { + const axis = this.axes[direction]; + return axis instanceof import_ag_charts_community130._ModuleSupport.PolarAxis ? axis : void 0; + }; + const radiusAxis = getPolarAxis(ChartAxisDirection18.Radius); + const angleAxis = getPolarAxis(ChartAxisDirection18.Angle); + const reversedRadiusAxis = radiusAxis?.isReversed(); + if (!reversedRadiusAxis) { + return points; + } + const zeroLinePoints = angleAxis?.getAxisLinePoints()?.points ?? []; + return points.concat(...zeroLinePoints); + } + resetPaths() { + const superStyle = super.resetPaths(); + const areaNode = this.getAreaNode(); + if (areaNode) { + const { path: areaPath } = areaNode; + const areaPoints = this.getAreaPoints(); + const stylerStyle = superStyle ?? this.getStyle(false); + const fillBBox = this.getShapeFillBBox(); + applyShapeStyle15( + areaNode, + { + fill: stylerStyle.fill, + stroke: void 0, + fillOpacity: stylerStyle.fillOpacity, + lineDash: stylerStyle.lineDash, + lineDashOffset: stylerStyle.lineDashOffset + }, + fillBBox + ); + areaNode.lineJoin = areaNode.lineCap = "round"; + areaPath.clear(true); + for (const { x, y, moveTo: moveTo2, arc, radius = 0, startAngle = 0, endAngle = 0 } of areaPoints) { + if (arc) { + areaPath.arc(x, y, radius, startAngle, endAngle); + } else if (moveTo2) { + areaPath.moveTo(x, y); + } else { + areaPath.lineTo(x, y); + } + } + areaPath.closePath(); + areaNode.checkPathDirty(); + return stylerStyle; + } + } + makeStylerParams(highlighted, highlightStateEnum) { + const { properties } = this; + const highlightState = toHighlightString5(highlightStateEnum ?? HighlightState4.None); + return { + marker: { + fill: properties.marker.fill, + fillOpacity: properties.marker.fillOpacity, + size: properties.marker.size, + shape: properties.marker.shape, + stroke: properties.marker.stroke, + strokeOpacity: properties.marker.strokeOpacity, + strokeWidth: properties.marker.strokeWidth, + lineDash: properties.marker.lineDash, + lineDashOffset: properties.marker.lineDashOffset + }, + highlightState, + highlighted, + fill: properties.fill, + fillOpacity: properties.fillOpacity, + lineDash: properties.lineDash, + lineDashOffset: properties.lineDashOffset, + seriesId: this.id, + stroke: properties.stroke, + strokeOpacity: properties.strokeOpacity, + strokeWidth: properties.strokeWidth, + angleKey: properties.angleKey, + radiusKey: properties.radiusKey + }; + } + getStyle(highlighted, highlightState) { + const { marker, fill, fillOpacity, lineDash, lineDashOffset, stroke, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill: markerFill = "transparent", fillOpacity: markerFillOpacity } = marker; + const stylerResult = this.getStylerResult({}, highlighted, highlightState); + stylerResult.marker ?? (stylerResult.marker = {}); + return { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? markerFill, + fillOpacity: stylerResult.marker.fillOpacity ?? markerFillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } +}; +RadarAreaSeries.className = "RadarAreaSeries"; +RadarAreaSeries.type = "radar-area"; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeriesOptionsDef.ts +var import_ag_charts_community131 = require("ag-charts-community"); +var import_ag_charts_core48 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs17, radarAreaSeriesThemeableOptionsDef } = import_ag_charts_community131._ModuleSupport; +var radarAreaSeriesOptionsDef = { + ...commonSeriesOptionsDefs17, + ...radarAreaSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core48.required)((0, import_ag_charts_core48.constant)("radar-area")), + angleKey: (0, import_ag_charts_core48.required)(import_ag_charts_core48.string), + radiusKey: (0, import_ag_charts_core48.required)(import_ag_charts_core48.string), + angleName: import_ag_charts_core48.string, + radiusName: import_ag_charts_core48.string, + legendItemName: import_ag_charts_core48.string +}; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaModule.ts +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE4 } +} = import_ag_charts_community132._ModuleSupport; +var RadarAreaModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radar-area", + moduleFactory: (ctx) => new RadarAreaSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE4.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE4.RADIUS_NUMBER }], + themeTemplate: RADAR_AREA_SERIES_THEME +}; +var RadarAreaSeriesModule = { + type: "series", + name: "radar-area", + chartType: "polar", + enterprise: true, + options: radarAreaSeriesOptionsDef, + create: (ctx) => new RadarAreaSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineModule.ts +var import_ag_charts_community135 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineSeries.ts +var import_ag_charts_community133 = require("ag-charts-community"); +var { HighlightState: HighlightState5, PointerEvents: PointerEvents11, toHighlightString: toHighlightString6 } = import_ag_charts_community133._ModuleSupport; +var RadarLineSeries = class extends RadarSeries { + constructor() { + super(...arguments); + this.properties = new RadarSeriesProperties(); + } + updatePathSelections() { + this.lineSelection.update(this.visible ? [true] : []); + } + updatePathNodes() { + const lineNode = this.getLineNode(); + if (!lineNode) + return; + const style = this.getPathNodesStyle(); + const { strokeWidth, stroke, strokeOpacity, lineDash, lineDashOffset, opacity } = style; + lineNode.setProperties({ + fill: void 0, + lineJoin: "round", + lineCap: "round", + pointerEvents: PointerEvents11.None, + opacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { properties } = this; + const highlightState = toHighlightString6(highlightStateEnum ?? HighlightState5.None); + return { + marker: { + fill: properties.marker.fill, + fillOpacity: properties.marker.fillOpacity, + size: properties.marker.size, + shape: properties.marker.shape, + stroke: properties.marker.stroke, + strokeOpacity: properties.marker.strokeOpacity, + strokeWidth: properties.marker.strokeWidth, + lineDash: properties.marker.lineDash, + lineDashOffset: properties.marker.lineDashOffset + }, + highlightState, + highlighted, + lineDash: properties.lineDash, + lineDashOffset: properties.lineDashOffset, + seriesId: this.id, + stroke: properties.stroke, + strokeOpacity: properties.strokeOpacity, + strokeWidth: properties.strokeWidth, + angleKey: properties.angleKey, + radiusKey: properties.radiusKey + }; + } + getStyle(highlighted, highlightState) { + const { marker, lineDash, lineDashOffset, stroke, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill = "transparent", fillOpacity } = marker; + const stylerResult = this.getStylerResult({}, highlighted, highlightState); + stylerResult.marker ?? (stylerResult.marker = {}); + return { + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? fill, + fillOpacity: stylerResult.marker.fillOpacity ?? fillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } +}; +RadarLineSeries.className = "RadarLineSeries"; +RadarLineSeries.type = "radar-line"; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineSeriesOptionsDef.ts +var import_ag_charts_community134 = require("ag-charts-community"); +var import_ag_charts_core49 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs18, radarLineSeriesThemeableOptionsDef } = import_ag_charts_community134._ModuleSupport; +var radarLineSeriesOptionsDef = { + ...commonSeriesOptionsDefs18, + ...radarLineSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core49.required)((0, import_ag_charts_core49.constant)("radar-line")), + angleKey: (0, import_ag_charts_core49.required)(import_ag_charts_core49.string), + radiusKey: (0, import_ag_charts_core49.required)(import_ag_charts_core49.string), + angleName: import_ag_charts_core49.string, + radiusName: import_ag_charts_core49.string, + legendItemName: import_ag_charts_core49.string +}; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE5 } = import_ag_charts_community135._ModuleSupport.ThemeConstants; +var RadarLineModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radar-line", + moduleFactory: (ctx) => new RadarLineSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE5.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE5.RADIUS_NUMBER }], + themeTemplate: RADAR_LINE_SERIES_THEME +}; +var RadarLineSeriesModule = { + type: "series", + name: "radar-line", + chartType: "polar", + enterprise: true, + options: radarLineSeriesOptionsDef, + create: (ctx) => new RadarLineSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarModule.ts +var import_ag_charts_community141 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeries.ts +var import_ag_charts_community138 = require("ag-charts-community"); +var import_ag_charts_core50 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/utils/datum.ts +function readDatum(nodeDatum) { + if (typeof nodeDatum?.datum === "object") { + return nodeDatum.datum; + } + return null; +} + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeriesProperties.ts +var import_ag_charts_community136 = require("ag-charts-community"); +var { SeriesProperties: SeriesProperties11, makeSeriesTooltip: makeSeriesTooltip20, Property: Property34, Label: Label13 } = import_ag_charts_community136._ModuleSupport; +var RadialBarSeriesProperties = class extends SeriesProperties11 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.label = new Label13(); + this.tooltip = makeSeriesTooltip20(); + } + getStyle() { + const { fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "angleKey", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "angleName", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "radiusName", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "rotation", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "stackGroup", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "normalizedTo", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarUtil.ts +var import_ag_charts_community137 = require("ag-charts-community"); +var { SectorBox: SectorBox3, motion: motion9 } = import_ag_charts_community137._ModuleSupport; +function fixRadialBarAnimationStatus(node, datum, status) { + if (status === "updated") { + if (node.previousDatum == null || Number.isNaN(node.previousDatum.innerRadius) || Number.isNaN(node.previousDatum.outerRadius)) { + return "added"; + } + if (Number.isNaN(datum.innerRadius) || Number.isNaN(datum.outerRadius)) { + return "removed"; + } + } + if (status === "added" && node.previousDatum != null) { + return "updated"; + } + return status; +} +function prepareRadialBarSeriesAnimationFunctions(axisZeroAngle) { + const fromFn = (sect, datum, status) => { + status = fixRadialBarAnimationStatus(sect, datum, status); + let startAngle; + let endAngle; + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed" || status === "updated") { + startAngle = sect.startAngle; + endAngle = sect.endAngle; + innerRadius = sect.innerRadius; + outerRadius = sect.outerRadius; + clipSector = sect.clipSector; + } else { + startAngle = axisZeroAngle; + endAngle = axisZeroAngle; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + } + clipSector ?? (clipSector = new SectorBox3(startAngle, endAngle, innerRadius, outerRadius)); + const phase = motion9.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { startAngle, endAngle, innerRadius, outerRadius, clipSector, phase }; + }; + const toFn = (sect, datum, status) => { + let startAngle; + let endAngle; + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed") { + startAngle = axisZeroAngle; + endAngle = axisZeroAngle; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + clipSector = new SectorBox3(startAngle, endAngle, innerRadius, outerRadius); + } else { + startAngle = datum.startAngle; + endAngle = datum.endAngle; + innerRadius = Number.isNaN(datum.innerRadius) ? sect.innerRadius : datum.innerRadius; + outerRadius = Number.isNaN(datum.outerRadius) ? sect.outerRadius : datum.outerRadius; + clipSector = datum.clipSector; + } + return { startAngle, endAngle, innerRadius, outerRadius, clipSector }; + }; + return { toFn, fromFn }; +} +function resetRadialBarSelectionsFn(_node, datum) { + return { + centerX: 0, + centerY: 0, + innerRadius: datum.innerRadius, + outerRadius: datum.outerRadius, + startAngle: datum.startAngle, + endAngle: datum.endAngle, + clipSector: datum.clipSector + }; +} + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeries.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS3, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES3, + ChartAxisDirection: ChartAxisDirection19, + PolarAxis: PolarAxis3, + diff: diff7, + groupAccumulativeValueProperty: groupAccumulativeValueProperty2, + keyProperty: keyProperty9, + normaliseGroupTo: normaliseGroupTo2, + valueProperty: valueProperty15, + fixNumericExtent: fixNumericExtent9, + resetLabelFn: resetLabelFn6, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation8, + seriesLabelFadeOutAnimation: seriesLabelFadeOutAnimation2, + animationValidation: animationValidation9, + angleBetween: angleBetween3, + createDatumId: createDatumId18, + CategoryScale: CategoryScale4, + Sector: Sector5, + SectorBox: SectorBox4, + motion: motion10, + isGradientFill: isGradientFill3, + applyShapeStyle: applyShapeStyle16, + updateLabelNode: updateLabelNode8, + getItemStyles: getItemStyles4 +} = import_ag_charts_community138._ModuleSupport; +var RadialBarSeriesNodeEvent = class extends import_ag_charts_community138._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadialBarSeries = class extends import_ag_charts_community138._ModuleSupport.PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: "radiusValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS3, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES3, + canHaveAxes: true, + animationResetFns: { + item: resetRadialBarSelectionsFn, + label: resetLabelFn6 + } + }); + this.properties = new RadialBarSeriesProperties(); + this.NodeEvent = RadialBarSeriesNodeEvent; + this.groupScale = new CategoryScale4(); + this.circleCache = { r: 0, cx: 0, cy: 0 }; + } + get hasData() { + return this.getHasData("angleValue-raw"); + } + nodeFactory() { + return new Sector5(); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection19.Angle) { + const xExtent = dataModel.getDomain(this, "angleValue-end", "value", processedData); + const fixedXExtent = [Math.min(xExtent[0], 0), Math.max(xExtent[1], 0)]; + return fixNumericExtent9(fixedXExtent); + } else { + return dataModel.getDomain(this, "radiusValue", "key", processedData); + } + } + async processData(dataController) { + const { angleKey, radiusKey, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const stackGroupId = this.getStackId(); + const stackGroupTrailingId = `${stackGroupId}-trailing`; + const extraProps = []; + if ((0, import_ag_charts_core50.isDefined)(normalizedTo)) { + extraProps.push(normaliseGroupTo2([stackGroupId, stackGroupTrailingId], Math.abs(normalizedTo))); + } + if (animationEnabled) { + if (this.processedData) { + extraProps.push(diff7(this.id, this.processedData)); + } + extraProps.push(animationValidation9()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const radiusScaleType = this.axes[ChartAxisDirection19.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection19.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty9(radiusKey, radiusScaleType, { id: "radiusValue" }), + valueProperty15(angleKey, angleScaleType, { + id: "angleValue-raw", + invalidValue: null, + ...visibleProps + }), + ...groupAccumulativeValueProperty2( + angleKey, + "normal", + { + id: `angleValue-end`, + rangeId: `angleValue-range`, + invalidValue: null, + groupId: stackGroupId, + separateNegative: true, + ...visibleProps + }, + angleScaleType + ), + ...groupAccumulativeValueProperty2( + angleKey, + "trailing", + { + id: `angleValue-start`, + invalidValue: null, + groupId: stackGroupTrailingId, + separateNegative: true, + ...visibleProps + }, + angleScaleType + ), + ...extraProps + ], + groupByKeys: true, + groupByData: false + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (!(r === cache.r && cx === cache.cx && cy === cache.cy)) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + maybeRefreshNodeData() { + const circleChanged = this.didCircleChange(); + if (!circleChanged && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection19.Radius]; + return radiusAxis instanceof PolarAxis3 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + createNodeData() { + const { processedData, dataModel } = this; + if (!dataModel || !processedData || processedData.type !== "grouped") + return; + const angleAxis = this.axes[ChartAxisDirection19.Angle]; + const radiusAxis = this.axes[ChartAxisDirection19.Radius]; + const angleScale = angleAxis?.scale; + const radiusScale = radiusAxis?.scale; + if (!angleScale || !radiusScale) { + return; + } + const radiusValues = dataModel.resolveKeysById(this, "radiusValue", processedData); + const angleStartValues = dataModel.resolveColumnById(this, `angleValue-start`, processedData); + const angleEndValues = dataModel.resolveColumnById(this, `angleValue-end`, processedData); + const angleRawValues = dataModel.resolveColumnById(this, `angleValue-raw`, processedData); + const angleRangeIndex = dataModel.resolveProcessedDataIndexById(this, `angleValue-range`); + let groupPaddingInner = 0; + if (radiusAxis instanceof RadiusCategoryAxis) { + groupPaddingInner = radiusAxis.groupPaddingInner; + } + const { groupScale } = this; + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + groupScale.domain = Array.from({ length: visibleGroupCount }).map((_, i) => String(i)); + groupScale.range = [0, Math.abs(radiusScale.bandwidth ?? 0)]; + groupScale.paddingInner = visibleGroupCount > 1 ? groupPaddingInner : 0; + const barWidth = groupScale.bandwidth >= 1 ? groupScale.bandwidth : groupScale.rawBandwidth; + const angleAxisReversed = angleAxis.isReversed(); + const radiusAxisReversed = radiusAxis.isReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const axisTotalRadius = axisOuterRadius + axisInnerRadius; + const angleDomain = this.getSeriesDomain(ChartAxisDirection19.Angle); + const { angleKey, radiusKey, angleName, radiusName, legendItemName, label } = this.properties; + const getLabelNodeDatum = (datum, angleDatum, x, y) => { + const labelText = this.getLabelText( + angleDatum, + datum, + angleKey, + "angle", + angleDomain, + label, + { value: angleDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + return { x, y, text: labelText, textAlign: "center", textBaseline: "middle" }; + } + }; + const nodeData = []; + const styles = getItemStyles4( + (nodeDatum, isHighlight, highlightState) => getItemStyle(this, nodeDatum, isHighlight, highlightState) + ); + const context = { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + if (!this.visible) + return context; + const { dataSources } = processedData; + const rawData = dataSources.get(this.id)?.data ?? []; + for (const { datumIndex, group } of dataModel.forEachGroupDatum(this, processedData)) { + const datum = rawData[datumIndex]; + const radiusDatum = radiusValues[datumIndex]; + if (radiusDatum == null) + return; + const angleDatum = angleRawValues[datumIndex]; + const angleStartDatum = angleStartValues[datumIndex]; + const angleEndDatum = angleEndValues[datumIndex]; + const isPositive = angleDatum >= 0 && !Object.is(angleDatum, -0); + const angleRange = group.aggregation[angleRangeIndex][isPositive ? 1 : 0]; + const reversed = isPositive === angleAxisReversed; + let startAngle = angleScale.convert(angleStartDatum, { clamp: true }); + let endAngle = angleScale.convert(angleEndDatum, { clamp: true }); + let rangeStartAngle = angleScale.convert(0, { clamp: true }); + let rangeEndAngle = angleScale.convert(angleRange, { clamp: true }); + if (reversed) { + [rangeStartAngle, rangeEndAngle] = [rangeEndAngle, rangeStartAngle]; + [startAngle, endAngle] = [endAngle, startAngle]; + } + const dataRadius = axisTotalRadius - radiusScale.convert(radiusDatum); + const innerRadius = dataRadius + groupScale.convert(String(groupIndex)); + const outerRadius = innerRadius + barWidth; + const midRadius = (innerRadius + outerRadius) / 2; + const midAngle = startAngle + angleBetween3(startAngle, endAngle) / 2; + const x = Math.cos(midAngle) * midRadius; + const y = Math.sin(midAngle) * midRadius; + const labelNodeDatum = this.properties.label.enabled ? getLabelNodeDatum(datum, angleDatum, x, y) : void 0; + const clipSector = new SectorBox4(startAngle, endAngle, innerRadius, outerRadius); + nodeData.push({ + series: this, + datum, + datumIndex, + point: { x, y, size: 0 }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + innerRadius, + outerRadius, + startAngle: rangeStartAngle, + endAngle: rangeEndAngle, + clipSector, + reversed, + index: datumIndex + }); + } + return context; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updateSectorSelection(this.itemSelection, false); + this.updateSectorSelection(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateSectorSelection(selection, isHighlight) { + let selectionData = []; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + if (isHighlight) { + if (activeHighlight?.datum && activeHighlight.series === this) { + selectionData.push(activeHighlight); + } + } else { + selectionData = this.nodeData; + } + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const fillBBox = this.getShapeFillBBox(); + const hasItemStylers = this.hasItemStylers(); + selection.update(selectionData, void 0, (datum) => this.getDatumId(datum)).each((node, nodeDatum) => { + const datum = readDatum(nodeDatum); + if (datum == null) + return; + if (hasItemStylers) { + const highlightState = this.getHighlightState(activeHighlight, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = getItemStyle(this, nodeDatum, isHighlight, highlightState); + } + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + const cornerRadius = style.cornerRadius; + const fill = style.fill; + const fillParams = import_ag_charts_community138._ModuleSupport.isGradientFill(fill) && fill.bounds !== "item" ? { centerX: 0, centerY: 0 } : void 0; + applyShapeStyle16(node, style, fillBBox, fillParams); + node.lineJoin = "round"; + node.inset = node.stroke == null ? 0 : node.strokeWidth / 2; + node.startInnerCornerRadius = datum.reversed ? cornerRadius : 0; + node.startOuterCornerRadius = datum.reversed ? cornerRadius : 0; + node.endInnerCornerRadius = datum.reversed ? 0 : cornerRadius; + node.endOuterCornerRadius = datum.reversed ? 0 : cornerRadius; + if (isHighlight) { + node.startAngle = nodeDatum.startAngle; + node.endAngle = nodeDatum.endAngle; + node.clipSector = nodeDatum.clipSector; + node.innerRadius = nodeDatum.innerRadius; + node.outerRadius = nodeDatum.outerRadius; + } + }); + } + updateLabels() { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + const isHighlight = false; + updateLabelNode8(this, node, properties, properties.label, datum.label, isHighlight, activeHighlight); + node.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + }); + } + getBarTransitionFunctions() { + const angleScale = this.axes[ChartAxisDirection19.Angle]?.scale; + let axisZeroAngle = 0; + if (!angleScale) { + return prepareRadialBarSeriesAnimationFunctions(axisZeroAngle); + } + const d0 = Math.min(angleScale.domain[0], angleScale.domain[1]); + const d1 = Math.max(angleScale.domain[0], angleScale.domain[1]); + if (d0 <= 0 && d1 >= 0) { + axisZeroAngle = angleScale.convert(0); + } + return prepareRadialBarSeriesAnimationFunctions(axisZeroAngle); + } + animateEmptyUpdateReady() { + const { labelSelection } = this; + const fns = this.getBarTransitionFunctions(); + motion10.fromToMotion(this.id, "datums", this.ctx.animationManager, [this.itemSelection], fns); + seriesLabelFadeInAnimation8(this, "labels", this.ctx.animationManager, labelSelection); + } + animateClearingUpdateEmpty() { + const { itemSelection } = this; + const { animationManager } = this.ctx; + const fns = this.getBarTransitionFunctions(); + motion10.fromToMotion(this.id, "datums", animationManager, [itemSelection], fns); + seriesLabelFadeOutAnimation2(this, "labels", animationManager, this.labelSelection); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip } = properties; + const angleAxis = axes[ChartAxisDirection19.Angle]; + const radiusAxis = axes[ChartAxisDirection19.Radius]; + const nodeDatum = this.nodeData?.[datumIndex]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis || !nodeDatum) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const radiusValue = dataModel.resolveKeysById(this, `radiusValue`, processedData)[datumIndex]; + const angleValue = dataModel.resolveColumnById(this, `angleValue-raw`, processedData)[datumIndex]; + if (radiusValue == null) + return; + const format = getItemStyle(this, nodeDatum, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: angleName, + fallbackLabel: angleKey, + value: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + angleName, + radiusKey, + radiusName, + legendItemName, + ...format + } + ); + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.itemSelection.nodes()); + } + legendItemSymbol() { + const { fill, stroke, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = getStyle( + this, + false, + false, + import_ag_charts_community138._ModuleSupport.HighlightState.None + ); + const markerStyle = { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + if (isGradientFill3(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: markerStyle + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { angleKey, angleName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: angleKey, + seriesId, + enabled: visible, + label: { + text: legendItemName ?? angleName ?? angleKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getDatumId(datum) { + return createDatumId18(datum.radiusValue); + } + computeLabelsBBox() { + return null; + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `radialBar-stack-${groupIndex}-xValues`; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +RadialBarSeries.className = "RadialBarSeries"; +RadialBarSeries.type = "radial-bar"; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeriesOptionsDef.ts +var import_ag_charts_community139 = require("ag-charts-community"); +var import_ag_charts_core51 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs19, radialBarSeriesThemeableOptionsDef } = import_ag_charts_community139._ModuleSupport; +var radialBarSeriesOptionsDef = { + ...commonSeriesOptionsDefs19, + ...radialBarSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core51.required)((0, import_ag_charts_core51.constant)("radial-bar")), + angleKey: (0, import_ag_charts_core51.required)(import_ag_charts_core51.string), + radiusKey: (0, import_ag_charts_core51.required)(import_ag_charts_core51.string), + angleName: import_ag_charts_core51.string, + radiusName: import_ag_charts_core51.string, + legendItemName: import_ag_charts_core51.string, + grouped: import_ag_charts_core51.boolean, + stacked: import_ag_charts_core51.boolean, + stackGroup: import_ag_charts_core51.string, + normalizedTo: import_ag_charts_core51.number +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarThemes.ts +var import_ag_charts_community140 = require("ag-charts-community"); +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE6 }, + FILL_GRADIENT_CONIC_SERIES_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS5, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS3 +} = import_ag_charts_community140._ModuleSupport; +var RADIAL_BAR_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_CONIC_SERIES_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS5], + ["pattern", FILL_PATTERN_DEFAULTS3] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + label: { + ...import_ag_charts_community140._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + highlight: import_ag_charts_community140._ModuleSupport.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE6.RADIUS_CATEGORY]: { + innerRadiusRatio: 0.2, + groupPaddingInner: 0.2, + paddingInner: 0.2, + paddingOuter: 0.1 + } + } +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE7 } = import_ag_charts_community141._ModuleSupport.ThemeConstants; +var RadialBarModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radial-bar", + moduleFactory: (ctx) => new RadialBarSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE7.ANGLE_NUMBER }, { type: POLAR_AXIS_TYPE7.RADIUS_CATEGORY }], + themeTemplate: RADIAL_BAR_SERIES_THEME, + stackable: true, + groupable: true +}; +var RadialBarSeriesModule = { + type: "series", + name: "radial-bar", + chartType: "polar", + enterprise: true, + options: radialBarSeriesOptionsDef, + create: (ctx) => new RadialBarSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnModule.ts +var import_ag_charts_community146 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeries.ts +var import_ag_charts_community143 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesProperties.ts +var import_ag_charts_community142 = require("ag-charts-community"); +var { Property: Property35 } = import_ag_charts_community142._ModuleSupport; +var RadialColumnSeriesProperties = class extends RadialColumnSeriesBaseProperties { +}; +__decorateClass([ + Property35 +], RadialColumnSeriesProperties.prototype, "columnWidthRatio", 2); +__decorateClass([ + Property35 +], RadialColumnSeriesProperties.prototype, "maxColumnWidthRatio", 2); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeries.ts +var { ChartAxisDirection: ChartAxisDirection20, PolarAxis: PolarAxis4, RadialColumnShape, getRadialColumnWidth } = import_ag_charts_community143._ModuleSupport; +var RadialColumnSeries = class extends RadialColumnSeriesBase { + constructor(moduleCtx) { + super(moduleCtx, { + animationResetFns: { + item: resetRadialColumnSelectionFn + } + }); + this.properties = new RadialColumnSeriesProperties(); + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `radarColumn-stack-${groupIndex}-yValues`; + } + nodeFactory() { + return new RadialColumnShape(); + } + getColumnTransitionFunctions() { + const axisZeroRadius = this.isRadiusAxisReversed() ? this.radius : this.getAxisInnerRadius(); + return prepareRadialColumnAnimationFunctions(axisZeroRadius); + } + isRadiusAxisCircle() { + const radiusAxis = this.axes[ChartAxisDirection20.Radius]; + return radiusAxis instanceof PolarAxis4 ? radiusAxis.shape === "circle" : false; + } + updateItemPath(node, datum, highlight) { + node.isBeveled = this.isRadiusAxisCircle(); + node.isRadiusAxisReversed = this.isRadiusAxisReversed(); + if (highlight) { + node.innerRadius = datum.innerRadius; + node.outerRadius = datum.outerRadius; + node.startAngle = datum.startAngle; + node.endAngle = datum.endAngle; + node.columnWidth = datum.columnWidth; + node.axisInnerRadius = datum.axisInnerRadius; + node.axisOuterRadius = datum.axisOuterRadius; + } + } + getColumnWidth(startAngle, endAngle) { + const { columnWidthRatio = 0.5, maxColumnWidthRatio = 0.5 } = this.properties; + return getRadialColumnWidth(startAngle, endAngle, this.radius, columnWidthRatio, maxColumnWidthRatio); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +RadialColumnSeries.className = "RadialColumnSeries"; +RadialColumnSeries.type = "radial-column"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesOptionsDef.ts +var import_ag_charts_community144 = require("ag-charts-community"); +var import_ag_charts_core52 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs20, radialColumnSeriesThemeableOptionsDef } = import_ag_charts_community144._ModuleSupport; +var radialColumnSeriesOptionsDef = { + ...commonSeriesOptionsDefs20, + ...radialColumnSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core52.required)((0, import_ag_charts_core52.constant)("radial-column")), + angleKey: (0, import_ag_charts_core52.required)(import_ag_charts_core52.string), + radiusKey: (0, import_ag_charts_core52.required)(import_ag_charts_core52.string), + angleName: import_ag_charts_core52.string, + radiusName: import_ag_charts_core52.string, + legendItemName: import_ag_charts_core52.string, + grouped: import_ag_charts_core52.boolean, + stacked: import_ag_charts_core52.boolean, + stackGroup: import_ag_charts_core52.string, + normalizedTo: import_ag_charts_core52.number +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnThemes.ts +var import_ag_charts_community145 = require("ag-charts-community"); +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE8, POLAR_AXIS_SHAPE: POLAR_AXIS_SHAPE2 }, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS: FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS6, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS4 +} = import_ag_charts_community145._ModuleSupport; +var RADIAL_COLUMN_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2], + ["image", FILL_IMAGE_DEFAULTS6], + ["pattern", FILL_PATTERN_DEFAULTS4] + ] + }, + stroke: { $palette: "stroke" }, + columnWidthRatio: 0.5, + maxColumnWidthRatio: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + label: { + ...import_ag_charts_community145._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: import_ag_charts_community145._ModuleSupport.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE8.ANGLE_CATEGORY]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE2.CIRCLE }, + groupPaddingInner: 0, + paddingInner: 0, + label: { + spacing: 10 + } + }, + [POLAR_AXIS_TYPE8.RADIUS_NUMBER]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE2.CIRCLE }, + innerRadiusRatio: 0.5 + } + } +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE9 } = import_ag_charts_community146._ModuleSupport.ThemeConstants; +var RadialColumnModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radial-column", + moduleFactory: (ctx) => new RadialColumnSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE9.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE9.RADIUS_NUMBER }], + themeTemplate: RADIAL_COLUMN_SERIES_THEME, + stackable: true, + groupable: true +}; +var RadialColumnSeriesModule = { + type: "series", + name: "radial-column", + chartType: "polar", + enterprise: true, + options: radialColumnSeriesOptionsDef, + create: (ctx) => new RadialColumnSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeModule.ts +var import_ag_charts_community151 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeries.ts +var import_ag_charts_community150 = require("ag-charts-community"); +var import_ag_charts_core54 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeNeedle.ts +var import_ag_charts_community147 = require("ag-charts-community"); +var { SvgPath, Rotatable, Translatable, Scalable: Scalable2 } = import_ag_charts_community147._ModuleSupport; +var RadialGaugeNeedle = class extends Rotatable(Scalable2(Translatable(SvgPath))) { + constructor() { + super(...arguments); + this.scalingCenterX = 0.5; + this.scalingCenterY = 0.5; + this.rotationCenterX = 0.5; + this.rotationCenterY = 0.5; + } +}; +RadialGaugeNeedle.defaultPathData = "M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeriesProperties.ts +var import_ag_charts_community148 = require("ag-charts-community"); +var { getColorStops: getColorStops2, normalizeAngle360: normalizeAngle3606, normalizeAngle360Inclusive: normalizeAngle360Inclusive2, toDegrees } = import_ag_charts_community148._ModuleSupport; +var { BaseProperties: BaseProperties11, makeSeriesTooltip: makeSeriesTooltip21, SeriesProperties: SeriesProperties12, PropertiesArray: PropertiesArray3, AxisLabel: AxisLabel4, Property: Property36, Label: Label14 } = import_ag_charts_community148._ModuleSupport; +var RadialGaugeDefaultTargetLabelProperties = class extends Label14 { +}; +__decorateClass([ + Property36 +], RadialGaugeDefaultTargetLabelProperties.prototype, "spacing", 2); +var RadialGaugeTargetProperties = class extends BaseProperties11 { + constructor() { + super(...arguments); + this.label = new RadialGaugeDefaultTargetLabelProperties(); + } + getStyle() { + const { + fill = "black", + fillOpacity = 1, + stroke = "black", + strokeWidth = 0, + strokeOpacity = 1, + lineDash = [0], + lineDashOffset = 0 + } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "text", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "value", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "shape", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "placement", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "spacing", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "size", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "rotation", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "fill", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "stroke", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "lineDash", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "label", 2); +var RadialGaugeBarProperties = class extends BaseProperties11 { + constructor() { + super(...arguments); + this.enabled = true; + this.fills = new PropertiesArray3(import_ag_charts_community148._ModuleSupport.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(defaultColorRange, scale) { + const { + enabled, + fill, + fills, + fillMode, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const barFill = enabled ? fill ?? createConicGradient(fills, fillMode, defaultColorRange, scale) : "none"; + return { + fill: barFill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "enabled", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "fills", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "fillMode", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "lineDashOffset", 2); +var RadialGaugeScaleIntervalProperties = class extends BaseProperties11 { + constructor() { + super(...arguments); + this.values = void 0; + this.step = void 0; + this.minSpacing = 0; + this.maxSpacing = 1e3; + } +}; +__decorateClass([ + Property36 +], RadialGaugeScaleIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleIntervalProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleIntervalProperties.prototype, "maxSpacing", 2); +var RadialGaugeScaleLabelProperties = class extends AxisLabel4 { +}; +var RadialGaugeScaleProperties = class extends BaseProperties11 { + constructor() { + super(...arguments); + this.min = 0; + this.max = 1; + this.fills = new PropertiesArray3(import_ag_charts_community148._ModuleSupport.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.defaultFill = "black"; + this.interval = new RadialGaugeScaleIntervalProperties(); + this.label = new RadialGaugeScaleLabelProperties(); + } + getStyle(barEnabled, defaultColorRange, scale) { + const { + fill, + fills, + defaultFill, + fillMode, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const scaleFill = fill ?? (barEnabled && fills.length === 0 ? defaultFill : void 0) ?? createConicGradient(fills, fillMode, defaultColorRange, scale); + return { + fill: scaleFill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "min", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "max", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "fills", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "fillMode", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "fill", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "stroke", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "defaultFill", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "interval", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "label", 2); +var RadialGaugeNeedleProperties = class extends BaseProperties11 { + constructor() { + super(...arguments); + this.enabled = true; + this.spacing = 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "enabled", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "radiusRatio", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "spacing", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "fill", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "stroke", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "lineDashOffset", 2); +var RadialGaugeLabelProperties = class extends AutoSizedLabel { +}; +__decorateClass([ + Property36 +], RadialGaugeLabelProperties.prototype, "text", 2); +var RadialGaugeSecondaryLabelProperties = class extends AutoSizedSecondaryLabel { +}; +__decorateClass([ + Property36 +], RadialGaugeSecondaryLabelProperties.prototype, "text", 2); +var RadialGaugeSeriesProperties = class extends SeriesProperties12 { + constructor() { + super(...arguments); + this.startAngle = 0; + this.endAngle = 0; + this.segmentation = new GaugeSegmentationProperties(); + this.defaultColorRange = []; + this.targets = new PropertiesArray3(RadialGaugeTargetProperties); + this.defaultTarget = new RadialGaugeTargetProperties(); + this.outerRadiusRatio = 1; + this.innerRadiusRatio = 1; + this.cornerRadius = 0; + this.cornerMode = "container"; + this.spacing = 0; + this.scale = new RadialGaugeScaleProperties(); + this.bar = new RadialGaugeBarProperties(); + this.needle = new RadialGaugeNeedleProperties(); + this.label = new RadialGaugeLabelProperties(); + this.secondaryLabel = new RadialGaugeSecondaryLabelProperties(); + this.tooltip = makeSeriesTooltip21(); + } +}; +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "value", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "startAngle", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "endAngle", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "segmentation", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "targets", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "defaultTarget", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "outerRadiusRatio", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "innerRadiusRatio", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "outerRadius", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "innerRadius", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "cornerMode", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "spacing", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "scale", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "bar", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "needle", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "secondaryLabel", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "tooltip", 2); +function createConicGradient(fills, fillMode, defaultColorRange, scale) { + const { domain, range: range2 } = scale; + const [startAngle, endAngle] = range2; + const conicAngle = normalizeAngle3606((startAngle + endAngle) / 2 + Math.PI); + const sweepAngle = normalizeAngle360Inclusive2(endAngle - startAngle); + const colorStops = getColorStops2(fills, defaultColorRange, domain, fillMode).map( + ({ color: color6, stop }) => { + stop = Math.min(Math.max(stop, 0), 1); + const angle = startAngle + sweepAngle * stop; + stop = (angle - conicAngle) / (2 * Math.PI); + stop = (stop % 1 + 1) % 1; + return { stop, color: color6 }; + } + ); + return { + type: "gradient", + gradient: "conic", + colorSpace: "oklch", + colorStops, + bounds: "series", + rotation: toDegrees(conicAngle) + 90 + }; +} + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeUtil.ts +var import_ag_charts_community149 = require("ag-charts-community"); +var import_ag_charts_core53 = require("ag-charts-core"); +var { SectorBox: SectorBox5 } = import_ag_charts_community149._ModuleSupport; +function computeClipSector(datum) { + const { startAngle, endAngle, clipStartAngle, clipEndAngle, innerRadius, outerRadius } = datum; + if (clipStartAngle == null || clipEndAngle == null) + return; + return new SectorBox5( + Math.max(clipStartAngle, startAngle), + Math.min(clipEndAngle, endAngle), + innerRadius, + outerRadius + ); +} +function clipSectorVisibility(startAngle, endAngle, clipSector) { + return Math.max(startAngle, clipSector.startAngle) <= Math.min(endAngle, clipSector.endAngle); +} +function hasClipSector(datum) { + return datum.clipStartAngle != null && datum.clipEndAngle != null; +} +function datumClipSector(datum, zero) { + const { clipStartAngle, clipEndAngle, innerRadius, outerRadius } = datum; + return new SectorBox5(clipStartAngle, zero ? clipStartAngle : clipEndAngle, innerRadius, outerRadius); +} +function prepareRadialGaugeSeriesAnimationFunctions(initialLoad, initialStartAngle) { + const phase = initialLoad ? "initial" : "update"; + const node = { + fromFn(sect, datum) { + const previousDatum = sect.previousDatum; + let { startAngle, endAngle } = previousDatum ?? datum; + const previousClipSector = previousDatum != null && hasClipSector(previousDatum) ? datumClipSector(previousDatum, initialLoad) : void 0; + const nextClipSector = hasClipSector(datum) ? datumClipSector(datum, initialLoad) : void 0; + let clipSector; + if (previousClipSector != null && nextClipSector != null) { + clipSector = previousClipSector; + } else if (previousClipSector == null && nextClipSector != null) { + clipSector = nextClipSector; + startAngle = datum.startAngle; + endAngle = datum.endAngle; + } else if (previousClipSector != null && nextClipSector == null) { + clipSector = void 0; + startAngle = datum.startAngle; + endAngle = datum.endAngle; + } else if (initialLoad) { + endAngle = startAngle; + } + return { startAngle, endAngle, clipSector, phase }; + }, + toFn(_sect, datum) { + const { startAngle, endAngle } = datum; + let clipSector; + if (hasClipSector(datum)) { + clipSector = datumClipSector(datum, false); + } + return { startAngle, endAngle, clipSector }; + }, + applyFn(sect, params) { + const { startAngle, endAngle } = params; + let { clipSector } = params; + if (clipSector != null) { + clipSector = new SectorBox5( + Math.max(startAngle, clipSector.startAngle), + Math.min(endAngle, clipSector.endAngle), + clipSector.innerRadius, + clipSector.outerRadius + ); + } + const visible = clipSector == null || clipSectorVisibility(startAngle, endAngle, clipSector); + sect.startAngle = startAngle; + sect.endAngle = endAngle; + sect.clipSector = clipSector; + sect.visible = visible; + } + }; + const needle = { + fromFn(needleNode) { + let { angle: rotation } = needleNode.previousDatum ?? needleNode.datum; + if (initialLoad) { + rotation = initialStartAngle; + } + return { rotation, phase }; + }, + toFn(_needleNode, datum) { + const { angle: rotation } = datum; + return { rotation }; + } + }; + return { node, needle }; +} +function resetRadialGaugeSeriesResetSectorFunction(_node, datum) { + const { startAngle, endAngle } = datum; + const clipSector = computeClipSector(datum); + const visible = clipSector == null || clipSectorVisibility(startAngle, endAngle, clipSector); + return { startAngle, endAngle, clipSector, visible }; +} +function resetRadialGaugeSeriesResetNeedleFunction(_node, datum) { + const { angle } = datum; + return { rotation: angle }; +} +var verticalAlignFactors3 = { + top: 0, + middle: 0.5, + bottom: 1 +}; +function formatRadialGaugeLabels(series, ctx, selection, opts, innerRadius, datumOverrides) { + const { padding, textAlign, verticalAlign } = opts; + let labelDatum; + let secondaryLabelDatum; + selection.each((_node, datum) => { + if (datum.label === "primary" /* Primary */) { + labelDatum = datum; + } else if (datum.label === "secondary" /* Secondary */) { + secondaryLabelDatum = datum; + } + }); + if (labelDatum == null) + return; + const labelText = getLabelText(series.id, ctx, labelDatum, datumOverrides?.label); + if (labelText == null) + return; + const secondaryLabelText = secondaryLabelDatum == null ? void 0 : getLabelText(series.id, ctx, secondaryLabelDatum, datumOverrides?.secondaryLabel); + const params = { padding }; + const horizontalFactor = textAlign === "center" ? 2 : 1; + const verticalFactor = verticalAlign === "middle" ? 2 : 1; + const sizeFittingHeight = (height2) => ({ + width: Math.sqrt(Math.max(innerRadius ** 2 - (height2 / verticalFactor) ** 2, 0)) * horizontalFactor, + height: Math.min(height2, verticalFactor * innerRadius), + meta: null + }); + let labelLayout; + let secondaryLabelLayout; + let height; + if (secondaryLabelDatum != null && secondaryLabelText != null) { + const layout = formatStackedLabels( + (0, import_ag_charts_core53.toPlainText)(labelText), + labelDatum, + (0, import_ag_charts_core53.toPlainText)(secondaryLabelText), + secondaryLabelDatum, + params, + sizeFittingHeight + ); + labelLayout = layout?.label; + secondaryLabelLayout = layout?.secondaryLabel; + height = layout?.height ?? 0; + } else { + const layout = formatSingleLabel((0, import_ag_charts_core53.toPlainText)(labelText), labelDatum, params, sizeFittingHeight); + labelLayout = layout?.[0]; + secondaryLabelLayout = void 0; + height = layout?.[0].height ?? 0; + } + const rectYOffset = height * verticalAlignFactors3[verticalAlign]; + selection.each((label, datum) => { + let layout; + if (datum.label === "primary" /* Primary */) { + layout = labelLayout; + } else if (datum.label === "secondary" /* Secondary */) { + layout = secondaryLabelLayout; + } + if (layout == null) { + label.visible = false; + return; + } + label.visible = true; + label.text = layout.text; + label.fontSize = layout.fontSize; + label.lineHeight = layout.lineHeight; + label.textAlign = textAlign; + label.textBaseline = "middle"; + const rectOriginInLabelRect = datum.label === "primary" /* Primary */ ? layout.height / 2 : height - layout.height / 2; + label.y = datum.centerY + rectOriginInLabelRect - rectYOffset; + label.x = datum.centerX; + }); +} + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeries.ts +var { + fromToMotion: fromToMotion5, + resetMotion: resetMotion4, + SeriesNodePickMode: SeriesNodePickMode15, + StateMachine: StateMachine4, + createDatumId: createDatumId19, + normalizeAngle360: normalizeAngle3607, + normalizeAngle360Inclusive: normalizeAngle360Inclusive3, + isBetweenAngles: isBetweenAngles2, + sectorBox, + toRadians: toRadians4, + BBox: BBox14, + Group: Group15, + PointerEvents: PointerEvents12, + Selection: Selection14, + Sector: Sector6, + SectorBox: SectorBox6, + Text: Text7, + Marker: Marker5, + tickFormat: tickFormat2, + applyShapeStyle: applyShapeStyle17, + mergeDefaults: mergeDefaults17 +} = import_ag_charts_community150._ModuleSupport; +var targetPlacementRotation = { + inside: 90, + middle: 0, + outside: -90 +}; +var outsideLabelPlacements = [ + { textAlign: "left", textBaseline: "top" }, + { textAlign: "right", textBaseline: "top" }, + { textAlign: "right", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "bottom" } +]; +var insideLabelPlacements = [ + { textAlign: "right", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "top" }, + { textAlign: "right", textBaseline: "top" } +]; +var RadialGaugeSeries = class extends import_ag_charts_community150._ModuleSupport.Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode15.EXACT_SHAPE_MATCH, SeriesNodePickMode15.NEAREST_NODE] + }); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.properties = new RadialGaugeSeriesProperties(); + this.scale = new LinearAngleScale(); + this.scaleGroup = this.contentGroup.appendChild(new Group15({ name: "scaleGroup" })); + this.itemGroup = this.contentGroup.appendChild(new Group15({ name: "itemGroup" })); + this.itemNeedleGroup = this.contentGroup.appendChild(new Group15({ name: "itemNeedleGroup" })); + this.itemTargetGroup = this.contentGroup.appendChild(new Group15({ name: "itemTargetGroup" })); + this.itemTargetLabelGroup = this.contentGroup.appendChild(new Group15({ name: "itemTargetLabelGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group15({ name: "itemLabelGroup" })); + this.highlightTargetGroup = this.highlightGroup.appendChild( + new Group15({ name: "itemTargetLabelGroup" }) + ); + this.tickGroup = this.contentGroup.appendChild(new Group15({ name: "tickGroup" })); + this.scaleSelection = Selection14.select( + this.scaleGroup, + () => this.nodeFactory() + ); + this.datumSelection = Selection14.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.needleSelection = Selection14.select( + this.itemNeedleGroup, + RadialGaugeNeedle + ); + this.targetSelection = Selection14.select( + this.itemTargetGroup, + () => this.markerFactory() + ); + this.targetLabelSelection = Selection14.select(this.itemTargetLabelGroup, Text7); + this.labelSelection = Selection14.select( + this.itemLabelGroup, + Text7 + ); + this.highlightTargetSelection = Selection14.select(this.highlightTargetGroup, () => this.markerFactory()); + this.tickSelection = Selection14.select(this.tickGroup, import_ag_charts_community150._ModuleSupport.TransformableText); + this.datumUnion = new DatumUnion(); + this.animationState = new StateMachine4("empty", { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.animateReadyResize(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateWaitingUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty" + }, + reset: "empty", + skip: "ready" + } + }); + this.scaleGroup.pointerEvents = PointerEvents12.None; + this.tickGroup.pointerEvents = PointerEvents12.None; + this.itemNeedleGroup.pointerEvents = PointerEvents12.None; + this.itemLabelGroup.pointerEvents = PointerEvents12.None; + } + get hasData() { + return this.properties.value != null; + } + nodeFactory() { + return new Sector6(); + } + markerFactory() { + const marker = new Marker5(); + marker.size = 1; + return marker; + } + processData() { + this.nodeDataRefresh = true; + this.animationState.transition("updateData"); + } + formatLabel(value) { + const { min, max } = this.properties.scale; + return formatLabel(value, { min, max }); + } + layoutScale() { + const { scale, properties } = this; + const { seriesRectWidth, seriesRectHeight } = this.nodeDataDependencies; + const { scale: scaleProps, outerRadius } = this.properties; + const { min, max, label, interval } = scaleProps; + const startAngle = toRadians4(properties.startAngle - 90); + const endAngle = toRadians4(properties.endAngle - 90); + const sweepAngle = normalizeAngle360Inclusive3(endAngle - startAngle); + const largerThanHalf = sweepAngle > Math.PI; + const containsTop = largerThanHalf || isBetweenAngles2(1.5 * Math.PI, startAngle, endAngle); + const containsRight = largerThanHalf || isBetweenAngles2(0 * Math.PI, startAngle, endAngle); + const containsBottom = largerThanHalf || isBetweenAngles2(0.5 * Math.PI, startAngle, endAngle); + const containsLeft = largerThanHalf || isBetweenAngles2(1 * Math.PI, startAngle, endAngle); + let textAlign; + if (containsLeft && !containsRight) { + textAlign = "right"; + } else if (!containsLeft && containsRight) { + textAlign = "left"; + } else { + textAlign = "center"; + } + let verticalAlign; + if (containsTop && !containsBottom) { + verticalAlign = "bottom"; + } else if (!containsTop && containsBottom) { + verticalAlign = "top"; + } else { + verticalAlign = "middle"; + } + const unitBox = sectorBox({ + startAngle, + endAngle, + innerRadius: 0, + outerRadius: 0.5 + }); + const centerXOffset = -(unitBox.x + unitBox.width / 2) * 2; + const centerYOffset = -(unitBox.y + unitBox.height / 2) * 2; + const unitBoxSize = Math.min(seriesRectWidth / unitBox.width, seriesRectHeight / unitBox.height); + scale.domain = [min, max]; + scale.range = [startAngle, endAngle]; + scale.arcLength = unitBoxSize / 2; + const { maxSpacing, minSpacing } = interval; + const { arcLength } = scale; + const minTickCount = maxSpacing ? Math.floor(arcLength / maxSpacing) : 1; + const maxTickCount = minSpacing ? Math.floor(arcLength / minSpacing) : Infinity; + const preferredTickCount = Math.floor(4 / Math.PI * Math.abs(scale.range[0] - scale.range[1])); + const tickCount = Math.max(minTickCount, Math.min(maxTickCount, preferredTickCount)); + const ticks = interval.values ?? scale.ticks({ + nice: false, + interval: interval.step, + minTickCount, + maxTickCount, + tickCount + })?.ticks ?? []; + const tickFormatter = tickFormat2(ticks, typeof label.format === "string" ? label.format : void 0); + const measurer = (0, import_ag_charts_core54.cachedTextMeasurer)(label); + const tickData = ticks.map((value, index) => { + let text; + if (label.formatter) { + text = formatWithContext(this.ctx, label.formatter, { + value, + index, + domain: scale.domain, + boundSeries: void 0 + }); + } + text ?? (text = tickFormatter?.(value)); + if (text == null) + return; + const { width, height } = (0, import_ag_charts_core54.isArray)(text) ? (0, import_ag_charts_core54.measureTextSegments)(text, label) : measurer.measureLines(text); + return { index, value, text, width, height }; + }).filter((value) => value != null); + const maxWidth = tickData.reduce((m, t) => Math.max(m, t.width), 0); + const maxHeight = tickData.reduce((m, t) => Math.max(m, t.height), 0); + const labelInset = label.enabled ? Math.max(maxWidth, maxHeight) + label.spacing : 0; + const radiusBounds = Math.max( + 0.5 * unitBoxSize - labelInset, + // seriesRect may have negative size + 0 + ); + const radius = outerRadius ?? radiusBounds; + this.centerX = seriesRectWidth / 2 + centerXOffset * radius; + this.centerY = seriesRectHeight / 2 + centerYOffset * radius; + this.radius = radius; + this.textAlign = textAlign; + this.verticalAlign = verticalAlign; + return tickData; + } + getShapeFillBBox() { + const { centerX, centerY, radius } = this; + const bbox = new BBox14(centerX - radius, centerY - radius, 2 * radius, 2 * radius); + return { + series: bbox, + axis: bbox + }; + } + getTargets() { + const { properties } = this; + const defaultTarget = properties.defaultTarget; + return Array.from(properties.targets).map((target) => { + const { + text = defaultTarget.text, + value = defaultTarget.value ?? 0, + shape = defaultTarget.shape ?? "triangle", + rotation = defaultTarget.rotation ?? 0, + placement = defaultTarget.placement ?? "middle", + spacing = defaultTarget.spacing ?? 0, + size = defaultTarget.size ?? 0 + } = target; + const { + enabled: labelEnabled = defaultTarget.label.enabled, + color: labelColor = defaultTarget.label.color ?? "black", + fontStyle: labelFontStyle = defaultTarget.label.fontStyle ?? "normal", + fontWeight: labelFontWeight = defaultTarget.label.fontWeight ?? "normal", + fontSize: labelFontSize = defaultTarget.label.fontSize, + fontFamily: labelFontFamily = defaultTarget.label.fontFamily, + spacing: labelSpacing = defaultTarget.label.spacing ?? 0 + } = target.label; + return { + text, + value, + shape, + placement, + spacing, + size, + rotation, + label: { + enabled: labelEnabled, + color: labelColor, + fontStyle: labelFontStyle, + fontWeight: labelFontWeight, + fontSize: labelFontSize, + fontFamily: labelFontFamily, + spacing: labelSpacing + }, + style: target.getStyle() + }; + }); + } + getTargetRadius(target) { + const { radius, properties } = this; + const { innerRadiusRatio, outerRadiusRatio } = properties; + const { placement, spacing, size } = target; + const outerRadius = radius * outerRadiusRatio; + const innerRadius = radius * innerRadiusRatio; + switch (placement) { + case "inside": + return Math.max(innerRadius - spacing - size / 2, 0); + case "outside": + return outerRadius + spacing + size / 2; + default: + return (innerRadius + outerRadius) / 2; + } + } + getTargetLabel(target) { + const { scale } = this; + const { value, size, placement, label } = target; + const { spacing, color: fill, fontStyle, fontWeight, fontSize, fontFamily } = label; + const lineHeight = void 0; + const angle = scale.convert(value); + const quadrant = Math.trunc(normalizeAngle3607(angle) / (Math.PI / 2)); + const offset = size / 2 + spacing; + let textAlign; + let textBaseline; + let offsetX; + let offsetY; + switch (placement) { + case "outside": + ({ textAlign, textBaseline } = outsideLabelPlacements[quadrant]); + offsetX = offset * Math.cos(angle); + offsetY = offset * Math.sin(angle); + break; + case "inside": + ({ textAlign, textBaseline } = insideLabelPlacements[quadrant]); + offsetX = -offset * Math.cos(angle); + offsetY = -offset * Math.sin(angle); + break; + default: + textAlign = "center"; + textBaseline = "bottom"; + offsetX = 0; + offsetY = -offset; + break; + } + return { + offsetX, + offsetY, + fill, + textAlign, + textBaseline, + fontStyle, + fontWeight, + fontSize, + fontFamily, + lineHeight + }; + } + createNodeData() { + const tickData = this.layoutScale(); + const { id: seriesId, scale, properties, radius, centerX, centerY } = this; + const { + value, + innerRadiusRatio, + outerRadiusRatio, + segmentation, + cornerRadius, + cornerMode, + needle, + bar, + scale: scaleProps, + label, + secondaryLabel + } = properties; + const { + outerRadius = radius * outerRadiusRatio, + innerRadius = radius * innerRadiusRatio, + defaultColorRange + } = properties; + const targets = this.getTargets(); + const nodeData = []; + const targetData = []; + const needleData = []; + const labelData = []; + const scaleData = []; + const cornersOnAllItems = cornerMode === "item"; + const containerStartAngle = scale.convert(scale.domain[0]); + const containerEndAngle = scale.convert(value); + const maxTicks = Math.ceil(normalizeAngle360Inclusive3(containerEndAngle - containerStartAngle) * radius); + let segments = segmentation.enabled ? segmentation.interval.getSegments(scale, maxTicks) : void 0; + const barStyle = bar.getStyle(defaultColorRange, scale); + const scaleStyle = scaleProps.getStyle(bar.enabled, defaultColorRange, scale); + if (segments == null && cornersOnAllItems) { + const segmentStart = Math.min(...scale.domain); + const segmentEnd = Math.max(...scale.domain); + const datum = { value, segmentStart, segmentEnd }; + const appliedCornerRadius = Math.min(cornerRadius, (outerRadius - innerRadius) / 2); + const angleInset = appliedCornerRadius / ((innerRadius + outerRadius) / 2); + nodeData.push({ + series: this, + itemId: `value`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: containerStartAngle - angleInset, + endAngle: containerEndAngle + angleInset, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornerRadius, + endCornerRadius: cornerRadius, + style: barStyle + }); + scaleData.push({ + series: this, + itemId: `scale`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: scale.range[0] - angleInset, + endAngle: scale.range[1] + angleInset, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornerRadius, + endCornerRadius: cornerRadius, + style: scaleStyle + }); + } else { + segments ?? (segments = scale.domain); + for (let i = 0; i < segments.length - 1; i++) { + const segmentStart = segments[i]; + const segmentEnd = segments[i + 1]; + const datum = { value, segmentStart, segmentEnd }; + const isStart = i === 0; + const isEnd = i === segments.length - 2; + const itemStartAngle = scale.convert(segmentStart); + const itemEndAngle = scale.convert(segmentEnd); + nodeData.push({ + series: this, + itemId: `value-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: itemStartAngle, + endAngle: itemEndAngle, + clipStartAngle: containerStartAngle, + clipEndAngle: containerEndAngle, + startCornerRadius: cornersOnAllItems || isStart ? cornerRadius : 0, + endCornerRadius: cornersOnAllItems || isEnd ? cornerRadius : 0, + style: barStyle + }); + scaleData.push({ + series: this, + itemId: `scale-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: itemStartAngle, + endAngle: itemEndAngle, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornersOnAllItems || isStart ? cornerRadius : 0, + endCornerRadius: cornersOnAllItems || isEnd ? cornerRadius : 0, + style: scaleStyle + }); + } + } + if (!needle.enabled && label.enabled) { + const { + text, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter = (params) => this.formatLabel(params.value) + } = label; + labelData.push({ + label: "primary" /* Primary */, + centerX, + centerY, + text, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + }); + } + if (!needle.enabled && secondaryLabel.enabled) { + const { + text, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + } = secondaryLabel; + labelData.push({ + label: "secondary" /* Secondary */, + centerX, + centerY, + text, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + }); + } + if (needle.enabled) { + let needleRadius = needle.radiusRatio == null ? innerRadius : radius * needle.radiusRatio; + needleRadius = Math.max(needleRadius - needle.spacing, 0); + const needleAngle = scale.convert(value); + needleData.push({ + centerX, + centerY, + radius: needleRadius, + angle: needleAngle, + series: this + }); + } + for (let i = 0; i < targets.length; i += 1) { + const target = targets[i]; + const { value: targetValue, text, size, shape, style } = target; + if (targetValue < Math.min(...scale.domain) || targetValue > Math.max(...scale.domain)) { + continue; + } + const targetRadius = this.getTargetRadius(target); + const targetAngle = scale.convert(targetValue); + const targetRotation = toRadians4(target.rotation + targetPlacementRotation[target.placement]); + targetData.push({ + series: this, + itemId: `target-${i}`, + midPoint: { + x: targetRadius * Math.cos(targetAngle) + centerX, + y: targetRadius * Math.sin(targetAngle) + centerY + }, + datum: { value: targetValue }, + datumIndex: { type: 1 /* Target */, index: i }, + type: 1 /* Target */, + value: targetValue, + text, + centerX, + centerY, + shape, + radius: targetRadius, + angle: targetAngle, + rotation: targetRotation, + size, + label: this.getTargetLabel(target), + style + }); + } + return { + itemId: seriesId, + nodeData, + needleData, + targetData, + labelData, + scaleData, + tickData + }; + } + updateSelections(resize) { + if (this.nodeDataRefresh || resize) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + highlightDatum(node) { + if (node != null && node.series === this && node.type === 1 /* Target */) { + return node; + } + } + update({ seriesRect }) { + const { + datumSelection, + labelSelection, + needleSelection, + targetSelection, + targetLabelSelection, + scaleSelection, + highlightTargetSelection, + tickSelection + } = this; + const resize = this.checkResize(seriesRect); + this.updateSelections(resize); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const needleData = this.contextNodeData?.needleData ?? []; + const targetData = this.contextNodeData?.targetData ?? []; + const scaleData = this.contextNodeData?.scaleData ?? []; + const tickData = this.contextNodeData?.tickData ?? []; + const highlightTargetDatum = this.highlightDatum(this.ctx.highlightManager.getActiveHighlight()); + this.scaleSelection = this.updateScaleSelection({ scaleData, scaleSelection }); + this.updateScaleNodes({ scaleSelection }); + this.needleSelection = this.updateNeedleSelection({ needleData, needleSelection }); + this.updateNeedleNodes({ needleSelection }); + this.targetSelection = this.updateTargetSelection({ targetData, targetSelection }); + this.updateTargetStyles({ targetSelection, isHighlight: false }); + this.updateTargetNodes({ targetSelection }); + this.targetLabelSelection = this.updateTargetLabelSelection({ targetData, targetLabelSelection }); + this.updateTargetLabelNodes({ targetLabelSelection }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightTargetSelection = this.updateTargetSelection({ + targetData: highlightTargetDatum == null ? [] : [highlightTargetDatum], + targetSelection: highlightTargetSelection + }); + this.updateTargetStyles({ targetSelection: highlightTargetSelection, isHighlight: true }); + this.updateTargetNodes({ targetSelection: highlightTargetSelection }); + this.tickSelection = this.updateTickSelection({ tickData, tickSelection }); + this.updateTickNodes({ tickSelection }); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => { + return createDatumId19(opts.nodeData.length, datum.itemId); + }); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + const { ctx, properties } = this; + const { segmentation } = properties; + const sectorSpacing = segmentation.spacing ?? 0; + const animationDisabled = ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((sector, datum) => { + const { centerX, centerY, innerRadius, outerRadius, startCornerRadius, endCornerRadius } = datum; + sector.centerX = centerX; + sector.centerY = centerY; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + sector.pointerEvents = this.properties.bar.enabled ? import_ag_charts_community150._ModuleSupport.PointerEvents.All : import_ag_charts_community150._ModuleSupport.PointerEvents.None; + applyShapeStyle17(sector, datum.style, fillBBox); + sector.startOuterCornerRadius = startCornerRadius; + sector.startInnerCornerRadius = startCornerRadius; + sector.endOuterCornerRadius = endCornerRadius; + sector.endInnerCornerRadius = endCornerRadius; + sector.radialEdgeInset = (sectorSpacing + sector.strokeWidth) / 2; + sector.concentricEdgeInset = sector.strokeWidth / 2; + if (animationDisabled || sector.previousDatum == null) { + sector.setProperties(resetRadialGaugeSeriesResetSectorFunction(sector, datum)); + } + }); + this.datumUnion.update(datumSelection, this.itemGroup, import_ag_charts_community150._ModuleSupport.Sector, (node, first, last) => { + node.clipSector ?? (node.clipSector = new SectorBox6(Number.NaN, Number.NaN, Number.NaN, Number.NaN)); + node.centerX = first.centerX; + node.centerY = first.centerY; + node.outerRadius = node.clipSector.outerRadius = first.outerRadius; + node.innerRadius = node.clipSector.innerRadius = first.innerRadius; + node.startAngle = node.clipSector.startAngle = first.startAngle; + node.startInnerCornerRadius = first.startInnerCornerRadius; + node.startOuterCornerRadius = first.startOuterCornerRadius; + node.endAngle = last.endAngle; + node.clipSector.endAngle = last.clipSector?.endAngle ?? last.endAngle; + node.endInnerCornerRadius = last.endInnerCornerRadius; + node.endOuterCornerRadius = last.endOuterCornerRadius; + node.pointerEvents = import_ag_charts_community150._ModuleSupport.PointerEvents.None; + }); + } + updateScaleSelection(opts) { + return opts.scaleSelection.update(opts.scaleData, void 0, (datum) => { + return createDatumId19(opts.scaleData.length, datum.itemId); + }); + } + updateScaleNodes(opts) { + const { scaleSelection } = opts; + const { segmentation } = this.properties; + const sectorSpacing = segmentation.spacing ?? 0; + const fillBBox = this.getShapeFillBBox(); + scaleSelection.each((sector, datum) => { + const { centerX, centerY, innerRadius, outerRadius, startCornerRadius, endCornerRadius } = datum; + sector.centerX = centerX; + sector.centerY = centerY; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + applyShapeStyle17(sector, datum.style, fillBBox); + sector.startOuterCornerRadius = startCornerRadius; + sector.startInnerCornerRadius = startCornerRadius; + sector.endOuterCornerRadius = endCornerRadius; + sector.endInnerCornerRadius = endCornerRadius; + sector.radialEdgeInset = (sectorSpacing + sector.strokeWidth) / 2; + sector.concentricEdgeInset = sector.strokeWidth / 2; + sector.setProperties(resetRadialGaugeSeriesResetSectorFunction(sector, datum)); + }); + } + updateNeedleSelection(opts) { + return opts.needleSelection.update(opts.needleData, void 0, () => createDatumId19(0)); + } + updateNeedleNodes(opts) { + const { needleSelection } = opts; + const { fill, fillOpacity, stroke, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties.needle; + const animationDisabled = this.ctx.animationManager.isSkipped(); + needleSelection.each((needle, datum) => { + const { centerX, centerY, radius } = datum; + const scale = radius * 2; + needle.d = RadialGaugeNeedle.defaultPathData; + applyShapeStyle17(needle, { + fill, + fillOpacity, + stroke, + strokeOpacity, + strokeWidth: strokeWidth / scale, + lineDash: lineDash.map((d) => d / scale), + lineDashOffset: lineDashOffset / scale + }); + needle.translationX = centerX; + needle.translationY = centerY; + needle.scalingX = scale; + needle.scalingY = scale; + if (animationDisabled) { + needle.setProperties(resetRadialGaugeSeriesResetNeedleFunction(needle, datum)); + } + }); + } + updateTargetSelection(opts) { + return opts.targetSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetStyles({ + targetSelection, + isHighlight + }) { + targetSelection.each((_, datum) => { + datum.style = this.getTargetStyle(isHighlight, datum); + }); + } + updateTargetNodes({ + targetSelection + }) { + targetSelection.each((target, datum) => { + const { centerX, centerY, angle, radius, shape, size, rotation } = datum; + applyShapeStyle17(target, datum.style); + target.size = size; + target.shape = shape === "line" ? lineMarker : shape; + target.translationX = centerX + radius * Math.cos(angle); + target.translationY = centerY + radius * Math.sin(angle); + target.rotation = angle + rotation; + }); + } + getTargetStyle(isHighlight, { datumIndex, style }) { + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + return mergeDefaults17(highlightStyle, { + ...style, + opacity: 1 + }); + } + updateTargetLabelSelection(opts) { + return opts.targetLabelSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetLabelNodes(opts) { + const { targetLabelSelection } = opts; + targetLabelSelection.each((label, target) => { + const { centerX, centerY, radius, angle, text } = target; + const { offsetX, offsetY, fill, fontStyle, fontWeight, fontSize, fontFamily, textAlign, textBaseline } = target.label; + if (text == null) { + label.visible = false; + return; + } + label.visible = true; + label.x = centerX + radius * Math.cos(angle) + offsetX; + label.y = centerY + radius * Math.sin(angle) + offsetY; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(opts.labelData, void 0, (datum) => datum.label); + } + updateLabelNodes(opts) { + const { labelSelection } = opts; + const animationDisabled = this.ctx.animationManager.isSkipped(); + labelSelection.each((label, datum) => { + label.fill = datum.fill; + label.fontStyle = datum.fontStyle; + label.fontWeight = datum.fontWeight; + label.fontFamily = datum.fontFamily; + }); + if (animationDisabled || this.labelsHaveExplicitText()) { + this.formatLabelText(); + } + } + updateTickSelection(opts) { + return opts.tickSelection.update(opts.tickData, void 0, (datum) => datum.index); + } + updateTickNodes(opts) { + const { scale, radius, centerX, centerY, properties } = this; + const { enabled, color: color6, fontFamily, fontSize, fontStyle, fontWeight, spacing } = properties.scale.label; + const rotation = toRadians4(properties.scale.label.rotation ?? 0); + opts.tickSelection.each((label, datum) => { + if (!enabled) { + label.visible = false; + return; + } + label.visible = true; + label.text = datum.text; + label.fill = color6; + label.fontFamily = fontFamily; + label.fontSize = fontSize; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.textAlign = "center"; + label.textBaseline = "middle"; + const angle = scale.convert(datum.value); + const { width, height } = datum; + const originX = Math.abs(radius * Math.cos(angle)); + const originY = Math.abs(radius * Math.sin(angle)); + const x0 = Math.min(Math.max(Math.abs(radius / Math.tan(angle)), originX - width / 2), originX + width / 2); + const y0 = Math.min( + Math.max(Math.abs(radius * Math.tan(angle)), originY - height / 2), + originY + height / 2 + ); + const outerR = Math.hypot(x0, y0); + const x = centerX + (outerR + spacing) * Math.cos(angle); + const y = centerY + (outerR + spacing) * Math.sin(angle); + label.x = x; + label.y = y; + label.rotationCenterX = x; + label.rotationCenterY = y; + label.rotation = rotation; + }); + } + labelsHaveExplicitText() { + for (const { datum } of this.labelSelection) { + if (datum.text == null) { + return false; + } + } + return true; + } + formatLabelText(datum) { + const { labelSelection, radius, textAlign, verticalAlign } = this; + const { spacing: padding, innerRadiusRatio } = this.properties; + formatRadialGaugeLabels( + this, + this.ctx, + labelSelection, + { padding, textAlign, verticalAlign }, + radius * innerRadiusRatio, + datum + ); + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + resetMotion4([this.datumSelection], resetRadialGaugeSeriesResetSectorFunction); + resetMotion4([this.needleSelection], resetRadialGaugeSeriesResetNeedleFunction); + this.formatLabelText(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + animateLabelText(params = {}) { + const { animationManager } = this.ctx; + let labelFrom; + let labelTo; + let secondaryLabelFrom; + let secondaryLabelTo; + this.labelSelection.each((label, datum) => { + label.opacity = 1; + if (datum.label === "primary" /* Primary */) { + labelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + labelTo = datum.value; + } else if (datum.label === "secondary" /* Secondary */) { + secondaryLabelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + secondaryLabelTo = datum.value; + } + }); + if (this.labelsHaveExplicitText()) { + } else if (labelTo == null || secondaryLabelTo == null) { + this.formatLabelText(); + } else if (labelFrom === labelTo && secondaryLabelFrom === secondaryLabelTo) { + this.formatLabelText({ label: labelTo, secondaryLabel: secondaryLabelTo }); + } else { + const animationId = `${this.id}_labels`; + animationManager.animate({ + id: animationId, + groupId: "label", + from: { label: labelFrom, secondaryLabel: secondaryLabelFrom }, + to: { label: labelTo, secondaryLabel: secondaryLabelTo }, + phase: params.phase ?? "update", + onUpdate: (datum) => this.formatLabelText(datum), + onStop: () => this.formatLabelText({ label: labelTo, secondaryLabel: secondaryLabelTo }) + }); + } + } + animateEmptyUpdateReady() { + const { animationManager } = this.ctx; + const { node, needle } = prepareRadialGaugeSeriesAnimationFunctions(true, this.scale.range[0]); + fromToMotion5(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion5(this.id, "needle", animationManager, [this.needleSelection], needle, () => "needle"); + fromToMotion5( + this.id, + "label", + animationManager, + [this.labelSelection], + fadeInFns, + (_label, datum) => datum.label + ); + this.animateLabelText({ + from: this.properties.scale.min, + phase: "initial" + }); + } + animateWaitingUpdateReady() { + const { animationManager } = this.ctx; + const { node, needle } = prepareRadialGaugeSeriesAnimationFunctions(false, this.scale.range[0]); + fromToMotion5(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion5(this.id, "needle", animationManager, [this.needleSelection], needle, () => "needle"); + this.animateLabelText(); + } + animateReadyResize() { + this.resetAllAnimation(); + } + dataCount() { + return Number.NaN; + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData() { + return []; + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties } = this; + const { tooltip } = properties; + let value; + let text; + let fallbackLabel; + if (datumIndex.type === 0 /* Node */) { + value = properties.value; + text = properties.label.text; + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeValue"); + } else { + ({ value, text } = properties.targets[datumIndex.index]); + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeTarget"); + } + if (value == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + data: [{ label: text, fallbackLabel, value: this.formatLabel(value) }] + }, + { seriesId, title: void 0, datum: void 0, value } + ); + } + pickNodeClosestDatum(point) { + return pickGaugeNearestDatum(this, point); + } + pickFocus(opts) { + return pickGaugeFocus(this, opts); + } + getCaptionText() { + const { value } = this.properties; + const description = []; + description.push(this.formatLabel(value)); + this.labelSelection.each((_label, datum) => { + const text = getLabelText(this.id, this.ctx, datum); + if (text != null) { + description.push((0, import_ag_charts_core54.toPlainText)(text)); + } + }); + return description.join(". "); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +RadialGaugeSeries.className = "RadialGaugeSeries"; +RadialGaugeSeries.type = "radial-gauge"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeModule.ts +var { FONT_SIZE_RATIO } = import_ag_charts_community151._ModuleSupport; +var RadialGaugeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "radial-gauge", + moduleFactory: (ctx) => new RadialGaugeSeries(ctx), + themeTemplate: { + minWidth: 200, + minHeight: 200, + tooltip: { + enabled: false + }, + series: { + outerRadiusRatio: 1, + innerRadiusRatio: 0.8, + startAngle: 270, + endAngle: 270 + 180, + defaultColorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $interpolate: [{ $palette: "secondDivergingColors" }, 5] }, + import_ag_charts_community151._ModuleSupport.SAFE_RANGE2_OPERATION + ] + }, + scale: { + // @ts-expect-error undocumented option + defaultFill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + stroke: { $path: ["/2", import_ag_charts_community151._ModuleSupport.SAFE_STROKE_FILL_OPERATION, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 12 + } + }, + bar: { + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + segmentation: { + enabled: false, + interval: {}, + spacing: 2 + }, + defaultTarget: { + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + size: 10, + shape: "triangle", + placement: "outside", + spacing: 5, + label: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 5 + } + }, + needle: { + enabled: false, + fill: { $ref: "foregroundColor" }, + spacing: 10 + }, + label: { + ...import_ag_charts_community151._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: 56, + minimumFontSize: 18 / 56, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + }, + secondaryLabel: { + ...import_ag_charts_community151._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: FONT_SIZE_RATIO.LARGE }, + minimumFontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "subtleTextColor" } + }, + tooltip: { + range: { $path: ["/tooltip/range", 10] } + } + } + } +}; +var RadialGaugeSeriesModule = { + type: "series", + name: "radial-gauge", + chartType: "standalone", + enterprise: true, + options: import_ag_charts_community151._ModuleSupport.radialGaugeSeriesOptionsDef, + create: (ctx) => new RadialGaugeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/sankey/sankeyModule.ts +var import_ag_charts_community156 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeries.ts +var import_ag_charts_community154 = require("ag-charts-community"); +var import_ag_charts_core56 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/sankey/sankeyLink.ts +var import_ag_charts_community152 = require("ag-charts-community"); +var import_ag_charts_core55 = require("ag-charts-core"); +var { BBox: BBox15, Path: Path12, Vec2, SceneChangeDetection: SceneChangeDetection7 } = import_ag_charts_community152._ModuleSupport; +var SankeyLink = class extends Path12 { + constructor() { + super(...arguments); + this.x1 = 0; + this.x2 = 0; + this.y1 = 0; + this.y2 = 0; + this.height = 0; + this.inset = 0; + this.elbows = []; + } + computeBBox() { + const x = Math.min(this.x1, this.x2); + const width = Math.max(this.x1, this.x2) - x; + const y = Math.min(this.y1, this.y2); + const height = Math.max(this.y1, this.y2) - y + this.height; + return new BBox15(x, y, width, height); + } + updatePath() { + const { path, inset } = this; + path.clear(); + const height = this.height - 2 * this.inset; + const offset = height / 2; + let x1 = this.x1 + inset; + let y1 = this.y1 + inset; + path.moveTo(x1, y1); + for (const elbow of this.elbows) { + this.updatePathSection(x1, y1, elbow.x, elbow.y, height, -offset); + x1 = elbow.x; + y1 = elbow.y; + } + const x2 = this.x2 - inset; + const y2 = this.y2 + inset; + this.updatePathSection(x1, y1, x2, y2, height, -offset); + path.lineTo(x2, y2 + height); + x1 = x2; + y1 = y2; + for (const elbow of this.elbows.toReversed()) { + this.updatePathSection(x1, y1, elbow.x, elbow.y, height, offset); + x1 = elbow.x; + y1 = elbow.y; + } + this.updatePathSection(x1, y1, this.x1 + inset, this.y1 + inset, height, offset); + path.closePath(); + } + updatePathSection(x1, y1, x2, y2, height, yOffset) { + const { path } = this; + const start = Vec2.from(x1, y1 + yOffset + height / 2); + const end = Vec2.from(x2, y2 + yOffset + height / 2); + if (Math.abs(end.y - start.y) < 2) { + path.lineTo(end.x, end.y); + return; + } + let angle = Vec2.angle(Vec2.sub(end, start)); + if (angle < 0) + angle = 2 * Math.PI + angle; + const right = 0; + const down = Math.PI / 2; + const left = Math.PI; + const up = Math.PI * 1.5; + const innerArc = getArcValues(start, end, 0); + const outerArc = getArcValues(start, end, height); + if (innerArc.radius < height) { + path.cubicCurveTo((start.x + end.x) / 2, start.y, (start.x + end.x) / 2, end.y, end.x, end.y); + return; + } + if (angle >= up) { + path.arc(start.x, y1 - innerArc.radius, innerArc.radius, down, down + outerArc.angle, true); + path.arc(end.x, y2 + outerArc.radius, outerArc.radius, up + outerArc.angle, up); + path.lineTo(end.x, end.y); + } else if (angle > right && angle <= down) { + path.arc(start.x, y1 + outerArc.radius, outerArc.radius, up, up + outerArc.angle); + path.arc(end.x, y2 - innerArc.radius, innerArc.radius, down + innerArc.angle, down, true); + path.lineTo(end.x, end.y); + } else if (angle > down && angle <= left) { + path.arc(start.x, y1 + outerArc.radius, outerArc.radius - height, up, up + outerArc.angle, true); + path.arc(end.x, y2 - innerArc.radius, innerArc.radius + height, down + innerArc.angle, down); + path.lineTo(end.x, end.y); + } else { + path.arc(start.x, y1 - innerArc.radius, innerArc.radius + height, down, down + innerArc.angle); + path.arc(end.x, y2 + outerArc.radius, outerArc.radius - height, up + outerArc.angle, up, true); + path.lineTo(end.x, end.y); + } + } +}; +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "x1", 2); +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "x2", 2); +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "y1", 2); +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "y2", 2); +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "height", 2); +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "inset", 2); +function getArcValues(start, end, minRadius) { + const lineAngle = Vec2.angle(Vec2.sub(end, start)); + const chordLength = Vec2.distance(start, end); + const bisect = Vec2.add(start, Vec2.rotate(Vec2.from(chordLength / 2, 0), lineAngle)); + const gradient = -1 / Vec2.gradient(start, end); + const intercept = Vec2.intercept(bisect, gradient); + const offset = lerpClamp(0.1, 0.5, Math.PI / 2 - Math.abs(Vec2.gradient(start, end))); + const center = Vec2.intersectAtX(gradient, intercept, start.x); + const radius = Math.max(minRadius, Vec2.distance(start, center) * offset); + const angle = Vec2.angle(Vec2.sub(center, start), Vec2.sub(center, bisect)) / -(1.1 - offset); + return { angle, radius }; +} +function lerpClamp(a, b, ratio3) { + return (0, import_ag_charts_core55.clamp)(a, (b - a) * ratio3 + a, b); +} + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeriesProperties.ts +var import_ag_charts_community153 = require("ag-charts-community"); +var { + BaseProperties: BaseProperties12, + FillGradientDefaults: FillGradientDefaults2, + FillPatternDefaults: FillPatternDefaults2, + FillImageDefaults: FillImageDefaults2, + makeSeriesTooltip: makeSeriesTooltip22, + SeriesProperties: SeriesProperties13, + Property: Property37, + Label: Label15 +} = import_ag_charts_community153._ModuleSupport; +var SankeySeriesLabelProperties = class extends Label15 { + constructor() { + super(...arguments); + this.spacing = 1; + this.placement = void 0; + this.edgePlacement = void 0; + } +}; +__decorateClass([ + Property37 +], SankeySeriesLabelProperties.prototype, "spacing", 2); +__decorateClass([ + Property37 +], SankeySeriesLabelProperties.prototype, "placement", 2); +__decorateClass([ + Property37 +], SankeySeriesLabelProperties.prototype, "edgePlacement", 2); +var SankeySeriesLinkProperties = class extends BaseProperties12 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "fill", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "stroke", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "lineDash", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "itemStyler", 2); +var SankeySeriesNodeProperties = class extends BaseProperties12 { + constructor() { + super(...arguments); + this.spacing = 1; + this.minSpacing = 0; + this.width = 1; + this.alignment = "justify"; + this.verticalAlignment = "center"; + this.sort = "auto"; + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "spacing", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "width", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "alignment", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "verticalAlignment", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "sort", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "fill", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "stroke", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "lineDash", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "itemStyler", 2); +var SankeySeriesProperties = class extends SeriesProperties13 { + constructor() { + super(); + this.nodes = void 0; + this.idKey = ""; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.sizeKey = void 0; + this.sizeName = void 0; + this.fillGradientDefaults = new FillGradientDefaults2(); + this.fillPatternDefaults = new FillPatternDefaults2(); + this.fillImageDefaults = new FillImageDefaults2(); + this.defaultColorRange = []; + this.defaultPatternFills = []; + this.fills = []; + this.strokes = []; + this.label = new SankeySeriesLabelProperties(); + this.link = new SankeySeriesLinkProperties(); + this.node = new SankeySeriesNodeProperties(); + this.tooltip = makeSeriesTooltip22(); + this.highlightStyle.deprecated = false; + } + getStyle(isLink, fills, strokes, index) { + const { + fillOpacity, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + fill = fills[index % fills.length], + stroke = strokes[index % fills.length] + } = isLink ? this.link : this.node; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "nodes", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "fromKey", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "toKey", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "fillGradientDefaults", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "fillPatternDefaults", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "fillImageDefaults", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "defaultPatternFills", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "fills", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "strokes", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "label", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "link", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "node", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeries.ts +var { + Transformable: Transformable3, + applyShapeStyle: applyShapeStyle18, + SeriesNodePickMode: SeriesNodePickMode16, + createDatumId: createDatumId20, + getShapeStyle: getShapeStyle2, + getLabelStyles: getLabelStyles6, + Rect: Rect6, + BBox: BBox16, + mergeDefaults: mergeDefaults18 +} = import_ag_charts_community154._ModuleSupport; +var SankeySeries = class extends FlowProportionSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode16.NEAREST_NODE, SeriesNodePickMode16.EXACT_SHAPE_MATCH] + }); + this.properties = new SankeySeriesProperties(); + } + isLabelEnabled() { + return (this.properties.labelKey != null || this.nodes == null) && this.properties.label.enabled; + } + linkFactory() { + return new SankeyLink(); + } + nodeFactory() { + return new Rect6(); + } + createNodeData() { + const { + id: seriesId, + _nodeDataDependencies: { seriesRectWidth, seriesRectHeight } = { seriesRectWidth: 0, seriesRectHeight: 0 } + } = this; + const { + fromKey, + toKey, + sizeKey, + labelKey, + label: { spacing: labelSpacing, placement: labelPlacement, edgePlacement: edgeLabelPlacement }, + node: { width: nodeWidth, alignment } + } = this.properties; + const createNode = (node) => ({ + ...node, + x: Number.NaN, + y: Number.NaN, + width: nodeWidth, + height: Number.NaN + }); + const createLink = (link) => ({ + ...link, + x1: Number.NaN, + x2: Number.NaN, + y1: Number.NaN, + y2: Number.NaN, + height: Number.NaN, + elbows: [] + }); + const { + nodeGraph: baseNodeGraph, + links, + maxPathLength + } = this.getNodeGraph(createNode, createLink, { includeCircularReferences: false }); + const nodeGraph = baseNodeGraph; + if (nodeGraph.size === 0) + return; + const columns = []; + for (let index = 0; index < maxPathLength; index += 1) { + columns.push({ index, size: 0, nodes: [], x: 0 }); + } + for (const graphNode of nodeGraph.values()) { + const { datum: node, linksBefore, linksAfter, maxPathLengthBefore, maxPathLengthAfter } = graphNode; + const size = Math.max( + linksBefore.reduce((acc, { link }) => acc + link.size, 0), + linksAfter.reduce((acc, { link }) => acc + link.size, 0) + ); + if (linksBefore.length === 0 && linksAfter.length === 0 || size === 0) { + graphNode.columnIndex = -1; + continue; + } + let column; + switch (alignment) { + case "left": + column = columns[maxPathLengthBefore]; + break; + case "right": + column = columns[maxPathLength - 1 - maxPathLengthAfter]; + break; + case "center": { + if (linksBefore.length !== 0) { + column = columns[maxPathLengthBefore]; + } else if (linksAfter.length === 0) { + column = columns[0]; + } else { + const columnIndex = linksAfter.reduce( + (acc, link) => Math.min(acc, link.node.maxPathLengthBefore), + maxPathLength + ) - 1; + column = columns[columnIndex]; + } + break; + } + case "justify": { + column = linksAfter.length === 0 ? columns[maxPathLength - 1] : columns[maxPathLengthBefore]; + break; + } + } + node.size = size; + const { label } = this.properties; + const labelText = label.enabled ? this.getLabelText( + node.label, + node.datum, + labelKey, + "label", + [], + this.properties.label, + { datum: node.datum, value: node.label, fromKey, toKey, sizeKey, size } + ) : void 0; + node.label = (0, import_ag_charts_core56.toPlainText)(labelText); + column.nodes.push(graphNode); + column.size += size; + graphNode.columnIndex = column.index; + } + const measurer = (0, import_ag_charts_core56.cachedTextMeasurer)(this.properties.label); + let columnLabelInsetBefore = 0; + let columnLabelInsetAfter = 0; + if (this.isLabelEnabled()) { + if (labelPlacement == null && edgeLabelPlacement == null) { + columnLabelInsetBefore = (seriesRectWidth - nodeWidth) * (1 - maxPathLength / (maxPathLength + 1)); + columnLabelInsetAfter = columnLabelInsetBefore; + } else if (edgeLabelPlacement === "outside" || edgeLabelPlacement == null) { + const reduceLabelWidthFn = (acc, n) => { + const node = n; + if (node.datum.label == null || node.datum.label === "") + return acc; + let maxWidth = (seriesRectWidth - nodeWidth) / (maxPathLength - 1) - labelSpacing; + if (labelPlacement === "center" && edgeLabelPlacement == null) + maxWidth /= 2; + const text = (0, import_ag_charts_core56.wrapText)(node.datum.label, { + maxWidth, + maxHeight: node.datum.height, + font: this.properties.label, + textWrap: "never" + }); + let { width } = measurer.measureLines(text); + if (labelPlacement === "center" && edgeLabelPlacement == null) + width /= 2; + return Math.max(acc, width); + }; + if (labelPlacement !== "right" || edgeLabelPlacement === "outside") { + columnLabelInsetBefore = nodeWidth + columns[0].nodes.reduce(reduceLabelWidthFn, 0); + } + if (labelPlacement !== "left" || edgeLabelPlacement === "outside") { + columnLabelInsetAfter = nodeWidth + columns.at(-1).nodes.reduce(reduceLabelWidthFn, 0); + } + } + } + const columnWidth = (seriesRectWidth - nodeWidth - columnLabelInsetBefore - columnLabelInsetAfter) / (maxPathLength - 1); + for (let index = 0; index < columns.length; index++) { + const column = columns[index]; + column.x = columnLabelInsetBefore + index * columnWidth; + for (const graphNode of column.nodes) { + graphNode.datum.x = column.x; + } + } + for (const graphNode of nodeGraph.values()) { + graphNode.weight = 0; + let closestColumnDiff = Infinity; + for (const link of graphNode.linksAfter) { + const node = link.node; + closestColumnDiff = Math.min(closestColumnDiff, node.columnIndex - graphNode.columnIndex); + } + if (closestColumnDiff === Infinity) { + for (const link of graphNode.linksBefore) { + const node = link.node; + closestColumnDiff = Math.min(closestColumnDiff, graphNode.columnIndex - node.columnIndex); + } + } + graphNode.closestColumnDiff = closestColumnDiff; + for (const link of graphNode.linksAfter) { + const node = link.node; + if (node.columnIndex <= graphNode.columnIndex) + continue; + for (let i = node.columnIndex - 1; i > graphNode.columnIndex; i--) { + const size = link.link.size; + const ghostNode = { + ghost: true, + datum: { ...graphNode.datum, size, y: 0, height: 0 }, + weight: 0, + linksBefore: [{ node: { columnIndex: i - 1, datum: { size } } }], + linksAfter: [{ node: { columnIndex: i + 1, datum: { size } } }], + link: link.link, + columnIndex: graphNode.columnIndex, + size: graphNode.datum.size, + closestColumnDiff, + fromNode: { y: node.datum.y }, + toNode: { y: 0 } + }; + columns[i].size += size; + columns[i].nodes.push(ghostNode); + } + } + } + const sortedColumns = columns.toSorted((a, b) => { + const aMax = a.nodes.reduce((acc, n) => Math.max(acc, n.datum.size), 0); + const bMax = b.nodes.reduce((acc, n) => Math.max(acc, n.datum.size), 0); + return bMax - aMax; + }); + const columnWeights = {}; + for (let i = 0; i < sortedColumns.length; i++) { + columnWeights[sortedColumns[i].index] = Math.pow(10, sortedColumns.length - i - 1); + } + for (const column of columns) { + for (const node of column.nodes) { + node.weight = node.datum.size / column.size * columnWeights[column.index]; + if ("ghost" in node && node.ghost) { + node.weight = node.size / column.size * columnWeights[column.index]; + continue; + } + node.weight += node.linksBefore.reduce((acc, before) => { + if (before.node.columnIndex !== column.index - 1) + return acc; + const weight = before.node.datum.size / columns[before.node.columnIndex].size * columnWeights[before.node.columnIndex]; + return Math.max(acc, weight); + }, 0); + node.weight += node.linksAfter.reduce((acc, after) => { + if (after.node.columnIndex !== column.index + 1) + return acc; + const weight = after.node.datum.size / columns[after.node.columnIndex].size * columnWeights[after.node.columnIndex]; + return Math.max(acc, weight); + }, 0); + } + column.nodes.sort((a, b) => this.sortNodes(a, b)); + } + const minSize = 1; + const getSizeScale = (spacing) => { + return columns.reduce((acc, { size, nodes }) => { + const spacingAccomodation = seriesRectHeight - nodes.length * minSize; + const spacingOccupation = (nodes.length - 1) * spacing / spacingAccomodation; + const columnSizeScale = (1 - spacingOccupation) / size; + return Math.min(acc, columnSizeScale); + }, Infinity); + }; + let nodeSpacing = this.properties.node.spacing; + let sizeScale = getSizeScale(nodeSpacing); + while (sizeScale < 0 && nodeSpacing > this.properties.node.minSpacing) { + nodeSpacing -= 1; + sizeScale = getSizeScale(nodeSpacing); + } + if (sizeScale < 0) { + import_ag_charts_core56.Logger.warnOnce( + "There was insufficient space to display the Sankey Series. Reduce [node.spacing], [node.minSpacing], or provide a larger container." + ); + return; + } + for (const column of columns) { + let columnNodesHeight = 0; + for (const node of column.nodes) { + const height = seriesRectHeight * node.datum.size * sizeScale; + node.datum.height = Math.max(minSize, height); + columnNodesHeight += height; + } + const spacingOccupation = nodeSpacing * (column.nodes.length - 1); + let y = 0; + if (this.properties.node.verticalAlignment === "bottom") { + y = seriesRectHeight - columnNodesHeight - spacingOccupation; + } else if (this.properties.node.verticalAlignment === "center") { + y = (seriesRectHeight - columnNodesHeight - spacingOccupation) / 2; + } + for (const node of column.nodes) { + node.datum.y = y; + y += seriesRectHeight * node.datum.size * sizeScale + nodeSpacing; + if ("ghost" in node && node.ghost) { + node.link.elbows.push({ x: column.x, y: node.datum.y }); + } + } + } + for (const { datum, linksBefore, linksAfter } of nodeGraph.values()) { + let y2 = datum.y; + linksBefore.sort( + (a, b) => this.sortNodes(a.node, b.node) + ); + for (const { link } of linksBefore) { + link.y2 = y2; + y2 += link.size * seriesRectHeight * sizeScale; + } + let y1 = datum.y; + linksAfter.sort( + (a, b) => this.sortNodes(a.node, b.node, { + invertColumnSort: true + }) + ); + for (const { link } of linksAfter) { + link.y1 = y1; + y1 += link.size * seriesRectHeight * sizeScale; + } + } + const nodeData = []; + const labelData = []; + const { fontSize } = this.properties.label; + for (const [index, column] of columns.entries()) { + const leading = index === 0; + const trailing = index === columns.length - 1; + let bottom = -Infinity; + column.nodes.sort((a, b) => a.datum.y - b.datum.y); + for (const n of column.nodes) { + if ("ghost" in n && n.ghost) + continue; + const { datum: node } = n; + node.midPoint = { + x: node.x + node.width / 2, + y: node.y + node.height / 2 + }; + nodeData.push(node); + if (node.label == null) + continue; + const y = node.y + node.height / 2; + let text; + if (!leading && !trailing) { + const lineHeight = (0, import_ag_charts_core56.calcLineHeight)(fontSize); + const y12 = y - lineHeight; + const y2 = y + lineHeight; + let maxX = seriesRectWidth; + for (const { datum } of nodeGraph.values()) { + const intersectsLabel = datum.x > node.x && Math.max(datum.y, y12) <= Math.min(datum.y + datum.height, y2); + if (intersectsLabel) { + maxX = Math.min(maxX, datum.x - labelSpacing); + } + } + const maxWidth = maxX - node.x - 2 * labelSpacing; + text = (0, import_ag_charts_core56.wrapText)(node.label, { + maxWidth, + maxHeight: node.height, + font: this.properties.label, + textWrap: "never", + overflow: "hide" + }); + } + if (text == null || text === "") { + const labelInset = edgeLabelPlacement == null && (leading || trailing) ? labelSpacing : labelSpacing * 2; + text = (0, import_ag_charts_core56.wrapText)(node.label, { + maxWidth: columnWidth - labelInset, + maxHeight: node.height, + font: this.properties.label, + textWrap: "never" + }); + } + if (text === "") + continue; + const { height } = measurer.measureLines(text); + const y0 = y - height / 2; + const y1 = y + height / 2; + let x = node.x + node.width + labelSpacing; + let textAlign = "left"; + let placement = labelPlacement; + if (leading && edgeLabelPlacement == null && labelPlacement == null) { + placement = "left"; + } + if (edgeLabelPlacement === "outside") { + if (leading) + placement = "left"; + if (trailing) + placement = "right"; + } else if (edgeLabelPlacement === "inside") { + if (leading) + placement = "right"; + if (trailing) + placement = "left"; + } + if (placement === "left") { + x = node.x - labelSpacing; + textAlign = "right"; + } else if (placement === "center") { + x = node.x + node.width / 2; + textAlign = "center"; + } + if (y0 >= bottom) { + labelData.push({ x, y, textAlign, text, size: node.size }); + bottom = y1; + } + } + } + for (const link of links) { + const { fromNode, toNode, size } = link; + link.height = Math.max(minSize, seriesRectHeight * size * sizeScale); + link.x1 = fromNode.x + nodeWidth; + link.x2 = toNode.x; + link.midPoint = { + x: (link.x1 + link.x2) / 2, + y: (link.y1 + link.y2) / 2 + link.height / 2 + }; + nodeData.push(link); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + sortNodes(a, b, opts) { + const { properties } = this; + if (properties.node.sort === "ascending") { + return (a.datum.label ?? "").localeCompare(b.datum.label ?? ""); + } else if (properties.node.sort === "descending") { + return (b.datum.label ?? "").localeCompare(a.datum.label ?? ""); + } else if (properties.node.sort === "data") { + return 0; + } + if (a.columnIndex < b.columnIndex) + return opts?.invertColumnSort ? 1 : -1; + if (a.columnIndex > b.columnIndex) + return opts?.invertColumnSort ? -1 : 1; + if (a.weight === b.weight) { + return a.datum.size - b.datum.size; + } + if (a.closestColumnDiff < b.closestColumnDiff) + return 1; + if (a.closestColumnDiff > b.closestColumnDiff) + return -1; + return a.weight - b.weight; + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, datum) => { + const { x, y, textAlign, text } = datum; + const params = datum; + const style = getLabelStyles6(this, void 0, params, this.properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x; + label.y = y; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = "middle"; + label.setBoxing(style); + }); + } + updateNodeSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId20(datum.type, datum.id)); + } + getNodeStyle(nodeDatum, fromNodeDatumIndex, isHighlight) { + const { properties } = this; + const { + fills, + strokes, + defaultColorRange, + defaultPatternFills, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3 + } = properties; + const { itemStyler } = properties.node; + const defaultColorStops = defaultColorRange[fromNodeDatumIndex % defaultColorRange.length].map((color6) => ({ + color: color6 + })); + const defaultPatternFill = defaultPatternFills[fromNodeDatumIndex % defaultPatternFills.length]; + const highlightStyle = this.getHighlightStyle(isHighlight, nodeDatum.datumIndex); + const baseStyle = mergeDefaults18(highlightStyle, properties.getStyle(false, fills, strokes, fromNodeDatumIndex)); + const hasNodeFill = properties.node.fill != null; + let style = getShapeStyle2( + baseStyle, + hasNodeFill ? fillGradientDefaults3 : { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + hasNodeFill ? fillPatternDefaults3 : { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + if (itemStyler != null && nodeDatum.datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId20(nodeDatum.datumIndex.index, "node", isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults18( + overrides, + style, + { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + makeItemStylerParams({ datum, datumIndex, size = 0, label }, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + size, + label, + fill + }; + } + updateNodeNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const { datumIndex } = datum; + const style = this.getNodeStyle(datum, datumIndex.index, isHighlight); + rect.x = datum.x; + rect.y = datum.y; + rect.width = Math.max(datum.width, 0); + rect.height = Math.max(datum.height, 0); + applyShapeStyle18(rect, style, fillBBox); + }); + } + getShapeFillBBox() { + const width = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const height = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const bbox = new BBox16(0, 0, width, height); + return { series: bbox, axis: bbox }; + } + updateLinkSelection(opts) { + return opts.datumSelection.update( + opts.nodeData, + void 0, + (datum) => createDatumId20(datum.type, datum.index, datum.fromNode.id, datum.toNode.id) + ); + } + getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, isHighlight) { + const { id: seriesId, properties } = this; + const { + fills, + strokes, + defaultColorRange, + defaultPatternFills, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3 + } = properties; + const { itemStyler } = properties.link; + const defaultColorStops = defaultColorRange[fromNodeDatumIndex.index % defaultColorRange.length].map( + (color6) => ({ + color: color6 + }) + ); + const defaultPatternFill = defaultPatternFills[fromNodeDatumIndex.index % defaultPatternFills.length]; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults18( + highlightStyle, + properties.getStyle(true, fills, strokes, fromNodeDatumIndex.index) + ); + const hasLinkFill = properties.link.fill != null; + let style = getShapeStyle2( + baseStyle, + hasLinkFill ? fillGradientDefaults3 : { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + hasLinkFill ? fillPatternDefaults3 : { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId20(datumIndex.index, "link", isHighlight ? "highlight" : "node"), + () => { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }); + } + ); + if (overrides) { + style = mergeDefaults18( + overrides, + style, + { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + updateLinkNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((link, datum) => { + const fromNodeDatumIndex = datum.fromNode.datumIndex; + const style = this.getLinkStyle(datum, fromNodeDatumIndex, isHighlight); + link.x1 = datum.x1; + link.y1 = datum.y1; + link.x2 = datum.x2; + link.y2 = datum.y2; + link.height = datum.height; + link.elbows = datum.elbows; + applyShapeStyle18(link, style, fillBBox); + link.inset = link.strokeWidth / 2; + }); + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + linksProcessedData, + nodesProcessedData, + properties, + ctx: { formatManager } + } = this; + const { fromKey, toKey, sizeKey, sizeName, tooltip } = properties; + const seriesDatum = this.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + if (seriesDatum == null) + return; + const nodeIndex = seriesDatum.type === 0 /* Link */ ? seriesDatum.fromNode.index : seriesDatum.index; + const title = seriesDatum.type === 0 /* Link */ ? `${seriesDatum.fromNode.label} - ${seriesDatum.toNode.label}` : seriesDatum.label; + const datum = datumIndex.type === 0 /* Link */ ? linksProcessedData?.dataSources.get(this.id)?.data[datumIndex.index] : nodesProcessedData?.dataSources.get(this.id)?.data[datumIndex.index]; + const size = seriesDatum.size; + let format; + if (seriesDatum.type === 0 /* Link */) { + const fromNodeDatumIndex = seriesDatum.fromNode.datumIndex; + format = this.getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, false); + } else { + format = this.getNodeStyle({ datumIndex, datum }, datumIndex.index, false); + } + const data = []; + if (sizeKey != null) { + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: size, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + domain: [], + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(size) }); + } + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(seriesDatum.type, nodeIndex, format), + data + }, + { + seriesId, + datum, + title, + fromKey, + toKey, + sizeKey, + sizeName, + size, + ...format + } + ); + } + computeFocusBounds(node) { + if (node instanceof Rect6) { + const { x, y, width, height } = node; + const bbox = new BBox16(x, y, width, height); + return Transformable3.toCanvas(this.contentGroup, bbox); + } + return node; + } + hasItemStylers() { + return this.properties.node.itemStyler != null || this.properties.link.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +SankeySeries.className = "SankeySeries"; +SankeySeries.type = "sankey"; + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeriesOptionsDef.ts +var import_ag_charts_community155 = require("ag-charts-community"); +var import_ag_charts_core57 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs21, sankeySeriesThemeableOptionsDef } = import_ag_charts_community155._ModuleSupport; +var sankeySeriesOptionsDef = { + ...sankeySeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs21, + type: (0, import_ag_charts_core57.required)((0, import_ag_charts_core57.constant)("sankey")), + fromKey: (0, import_ag_charts_core57.required)(import_ag_charts_core57.string), + toKey: (0, import_ag_charts_core57.required)(import_ag_charts_core57.string), + sizeKey: import_ag_charts_core57.string, + sizeName: import_ag_charts_core57.string +}; +sankeySeriesOptionsDef.fillGradientDefaults = (0, import_ag_charts_core57.undocumented)(import_ag_charts_core57.fillGradientDefaults); +sankeySeriesOptionsDef.fillPatternDefaults = (0, import_ag_charts_core57.undocumented)(import_ag_charts_core57.fillPatternDefaults); +sankeySeriesOptionsDef.fillImageDefaults = (0, import_ag_charts_core57.undocumented)(import_ag_charts_core57.fillImageDefaults); +sankeySeriesOptionsDef.defaultColorRange = (0, import_ag_charts_core57.undocumented)((0, import_ag_charts_core57.arrayOf)((0, import_ag_charts_core57.arrayOf)(import_ag_charts_core57.color))); +sankeySeriesOptionsDef.defaultPatternFills = (0, import_ag_charts_core57.undocumented)((0, import_ag_charts_core57.arrayOf)(import_ag_charts_core57.color)); + +// packages/ag-charts-enterprise/src/series/sankey/sankeyModule.ts +var SankeyModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + solo: true, + identifier: "sankey", + moduleFactory: (ctx) => new SankeySeries(ctx), + themeTemplate: { + seriesArea: { + padding: { + top: 10, + bottom: 10 + } + }, + series: { + fills: { $palette: "fills" }, + strokes: { $palette: "strokes" }, + // @ts-expect-error undocumented option + fillGradientDefaults: import_ag_charts_community156._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS, + fillPatternDefaults: import_ag_charts_community156._ModuleSupport.FILL_PATTERN_DEFAULTS, + fillImageDefaults: import_ag_charts_community156._ModuleSupport.FILL_IMAGE_DEFAULTS, + defaultColorRange: { $palette: "gradients" }, + defaultPatternFills: import_ag_charts_community156._ModuleSupport.SAFE_FILLS_OPERATION, + highlightStyle: { + series: { + dimOpacity: 0.2 + } + }, + highlight: { + ...import_ag_charts_community156._ModuleSupport.singleSeriesHighlightStyle() + }, + label: { + ...import_ag_charts_community156._ModuleSupport.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 10 + }, + node: { + spacing: { $if: [{ $greaterThan: [{ $path: "./minSpacing" }, 20] }, { $path: "./minSpacing" }, 20] }, + minSpacing: 0, + width: 10, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + link: { + fillOpacity: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + } + }, + legend: { + enabled: false, + toggleSeries: false + } + } +}; +var SankeySeriesModule = { + type: "series", + name: "sankey", + chartType: "standalone", + enterprise: true, + options: sankeySeriesOptionsDef, + create: (ctx) => new SankeySeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstModule.ts +var import_ag_charts_community160 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeries.ts +var import_ag_charts_community158 = require("ag-charts-community"); +var import_ag_charts_core58 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeriesProperties.ts +var import_ag_charts_community157 = require("ag-charts-community"); +var { HierarchySeriesProperties, HighlightStyle, makeSeriesTooltip: makeSeriesTooltip23, Property: Property38 } = import_ag_charts_community157._ModuleSupport; +var SunburstSeriesTileHighlightStyle = class extends HighlightStyle { + constructor() { + super(false); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedLabel(); + } +}; +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "label", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "secondaryLabel", 2); +var SunburstSeriesProperties = class extends HierarchySeriesProperties { + constructor() { + super(...arguments); + this.fillOpacity = 1; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.highlightStyle = new SunburstSeriesTileHighlightStyle(); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + this.tooltip = makeSeriesTooltip23(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity } = this; + return { + fill: fills[index % fills.length], + fillOpacity, + stroke: strokes[index % strokes.length], + strokeWidth, + strokeOpacity, + opacity: 1 + }; + } +}; +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "secondaryLabelKey", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "sectorSpacing", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "padding", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "highlightStyle", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "secondaryLabel", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeries.ts +var { + fromToMotion: fromToMotion6, + normalizeAngle360: normalizeAngle3608, + createDatumId: createDatumId21, + PointerEvents: PointerEvents13, + Sector: Sector7, + Group: Group16, + ScalableGroup, + Selection: Selection15, + TransformableText: TransformableText3, + BBox: BBox17, + applyShapeStyle: applyShapeStyle19, + mergeDefaults: mergeDefaults19, + formatValue: formatValue2, + getLabelStyles: getLabelStyles7 +} = import_ag_charts_community158._ModuleSupport; +var SunburstNode = class extends import_ag_charts_community158._ModuleSupport.HierarchyNode { + constructor() { + super(...arguments); + this.label = void 0; + this.secondaryLabel = void 0; + this.contentHeight = 0; + this.bbox = void 0; + // cspell:ignore bbox + this.startAngle = 0; + this.endAngle = 0; + } +}; +function setAngleData(node, startAngle = 0, angleScale = 2 * Math.PI / node.sumSize) { + for (const child of node.children) { + const endAngle = startAngle + child.sumSize * angleScale; + child.startAngle = startAngle; + child.endAngle = endAngle; + setAngleData(child, startAngle, angleScale); + startAngle = endAngle; + } +} +var SunburstSeries = class extends import_ag_charts_community158._ModuleSupport.HierarchySeries { + constructor(moduleCtx) { + super(moduleCtx); + this.NodeClass = SunburstNode; + this.properties = new SunburstSeriesProperties(); + this.scalingGroup = this.contentGroup.appendChild(new ScalableGroup()); + this.sectorGroup = this.scalingGroup.appendChild(new Group16()); + this.sectorLabelGroup = this.scalingGroup.appendChild(new Group16()); + this.highlightSectorGroup = this.scalingGroup.appendChild(new Group16()); + this.datumSelection = Selection15.select(this.sectorGroup, Sector7); + this.labelSelection = Selection15.select( + this.sectorLabelGroup, + Group16 + ); + this.highlightSelection = Selection15.select( + this.highlightSectorGroup, + Sector7 + ); + this.sectorLabelGroup.pointerEvents = PointerEvents13.None; + } + processData() { + super.processData(); + setAngleData(this.rootNode); + } + updateSelections() { + const highlightedNode = this.ctx.highlightManager?.getActiveHighlight(); + this.highlightSelection.update( + highlightedNode == null ? [] : [highlightedNode], + void 0, + (node) => this.getDatumId(node) + ); + if (!this.nodeDataRefresh) + return; + this.nodeDataRefresh = false; + const { chart } = this; + if (chart == null) + return; + const seriesRect = chart.seriesRect; + if (seriesRect == null) + return; + const descendants = Array.from(this.rootNode); + const updateLabelGroup = (group) => { + group.append([ + new TransformableText3({ tag: 0 /* Primary */ }), + new TransformableText3({ tag: 1 /* Secondary */ }) + ]); + }; + this.datumSelection.update(descendants, void 0, (node) => this.getDatumId(node)); + this.labelSelection.update(descendants, updateLabelGroup, (node) => this.getDatumId(node)); + } + getItemStyle(nodeDatum, isHighlight) { + const { properties, colorScale } = this; + const { itemStyler } = properties; + const rootIndex = nodeDatum.datumIndex?.[0] ?? 0; + const highlightStyle = isHighlight ? properties.highlightStyle : void 0; + const baseStyle = mergeDefaults19(highlightStyle, properties.getStyle(rootIndex)); + if (!isHighlight && nodeDatum.colorValue != null) { + baseStyle.fill = colorScale.convert(nodeDatum.colorValue); + } + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId21(this.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults19(overrides, style); + } + } + return style; + } + makeItemStylerParams(nodeDatum, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + depth: nodeDatum.depth ?? 0, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateNodes() { + const { chart, data, maxDepth } = this; + if (chart == null || data == null) { + return; + } + const { width, height } = chart.seriesRect; + const { + sectorSpacing = 0, + padding = 0, + cornerRadius, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName + } = this.properties; + this.contentGroup.translationX = width / 2; + this.contentGroup.translationY = height / 2; + const baseInset = sectorSpacing * 0.5; + const radius = Math.min(width, height) / 2; + const radiusScale = radius / (maxDepth + 1); + const angleOffset = -Math.PI / 2; + const seriesFillBBox = { + series: new BBox17(-radius, -radius, 2 * radius, 2 * radius), + axis: new BBox17(-radius, -radius, 2 * radius, 2 * radius) + }; + this.rootNode?.walk((node) => { + const { startAngle, endAngle } = node; + if (node.depth != null) { + const midAngle = (startAngle + endAngle) / 2 + angleOffset; + const midRadius = (node.depth + 0.5) * radiusScale; + node.midPoint.x = Math.cos(midAngle) * midRadius; + node.midPoint.y = Math.sin(midAngle) * midRadius; + } + }); + this.rootNode?.walk((node) => { + const { datum, depth, startAngle, endAngle, parent, sumSize } = node; + node.label = void 0; + node.secondaryLabel = void 0; + node.contentHeight = 0; + let labelValue; + if (datum != null && depth != null && labelKey != null) { + const value = datum[labelKey]; + labelValue = this.getLabelText( + value, + datum, + labelKey, + "label", + [], + this.properties.label, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (labelValue === "") { + labelValue = void 0; + } + let secondaryLabelValue; + if (datum != null && depth != null && secondaryLabelKey != null) { + const value = datum[secondaryLabelKey]; + secondaryLabelValue = this.getLabelText( + value, + datum, + secondaryLabelKey, + "secondaryLabel", + [], + this.properties.secondaryLabel, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (secondaryLabelValue === "") { + secondaryLabelValue = void 0; + } + if (depth == null) + return; + const innerRadius = depth * radiusScale + baseInset; + const outerRadius = (depth + 1) * radiusScale - baseInset; + const innerAngleOffset = innerRadius > baseInset ? baseInset / innerRadius : baseInset; + const outerAngleOffset = outerRadius > baseInset ? baseInset / outerRadius : baseInset; + const innerStartAngle = startAngle + innerAngleOffset; + const innerEndAngle = endAngle + innerAngleOffset; + const deltaInnerAngle = innerEndAngle - innerStartAngle; + const outerStartAngle = startAngle + outerAngleOffset; + const outerEndAngle = endAngle + outerAngleOffset; + const deltaOuterAngle = outerEndAngle - outerStartAngle; + const sizeFittingHeight = (labelHeight2) => { + const isCenterCircle = depth === 0 && parent?.sumSize === sumSize; + if (isCenterCircle) { + const labelWidth2 = 2 * Math.sqrt(outerRadius ** 2 - (labelHeight2 * 0.5) ** 2); + return { width: labelWidth2, height: labelHeight2, meta: 0 /* CenterCircle */ }; + } + const parallelHeight = labelHeight2; + const availableWidthUntilItHitsTheOuterRadius = 2 * Math.sqrt(outerRadius ** 2 - (innerRadius + parallelHeight) ** 2); + const availableWidthUntilItHitsTheStraightEdges = deltaInnerAngle < Math.PI ? 2 * innerRadius * Math.tan(deltaInnerAngle * 0.5) : Infinity; + const parallelWidth = Math.min( + availableWidthUntilItHitsTheOuterRadius, + availableWidthUntilItHitsTheStraightEdges + ); + const maxPerpendicularAngle = Math.PI / 4; + let perpendicularHeight; + let perpendicularWidth; + if (depth === 0) { + perpendicularHeight = labelHeight2; + perpendicularWidth = Math.sqrt(outerRadius ** 2 - (perpendicularHeight / 2) ** 2) - labelHeight2 / (2 * Math.tan(deltaOuterAngle * 0.5)); + } else if (normalizeAngle3608(deltaInnerAngle) < maxPerpendicularAngle) { + perpendicularHeight = 2 * innerRadius * Math.tan(deltaInnerAngle * 0.5); + perpendicularWidth = Math.sqrt(outerRadius ** 2 - (perpendicularHeight / 2) ** 2) - innerRadius; + } else { + perpendicularWidth = 0; + perpendicularHeight = 0; + } + return parallelWidth >= perpendicularWidth ? { width: parallelWidth, height: parallelHeight, meta: 1 /* Parallel */ } : { width: perpendicularWidth, height: perpendicularHeight, meta: 2 /* Perpendicular */ }; + }; + const formatting = formatLabels( + (0, import_ag_charts_core58.toPlainText)(labelValue), + this.properties.label, + (0, import_ag_charts_core58.toPlainText)(secondaryLabelValue), + this.properties.secondaryLabel, + { padding }, + sizeFittingHeight + ); + if (formatting == null) + return; + const { width: labelWidth, height: labelHeight, meta: labelPlacement, label, secondaryLabel } = formatting; + const theta = angleOffset + (startAngle + endAngle) / 2; + const top = Math.sin(theta) >= 0; + const right = Math.cos(theta) >= 0; + const circleQuarter = (top ? 3 /* Top */ : 12 /* Bottom */) & (right ? 6 /* Right */ : 9 /* Left */); + let labelRadius; + switch (labelPlacement) { + case 0 /* CenterCircle */: + labelRadius = 0; + break; + case 1 /* Parallel */: { + const opticalCentering = 0.58; + const idealRadius = outerRadius - (radiusScale - labelHeight) * opticalCentering; + const maximumRadius = Math.sqrt((outerRadius - padding) ** 2 - (labelWidth / 2) ** 2); + labelRadius = Math.min(idealRadius, maximumRadius); + break; + } + case 2 /* Perpendicular */: + if (depth === 0) { + const minimumRadius = labelHeight / (2 * Math.tan(deltaInnerAngle * 0.5)) + labelWidth * 0.5; + const maximumRadius = Math.sqrt(outerRadius ** 2 - (labelHeight * 0.5) ** 2) - labelWidth * 0.5; + labelRadius = (minimumRadius + maximumRadius) * 0.5; + } else { + labelRadius = (innerRadius + outerRadius) * 0.5; + } + break; + } + if (label != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.label; + node.label = { + ...label, + fontStyle, + fontFamily, + fontWeight, + color: color6, + labelPlacement, + circleQuarter, + radius: labelRadius, + theta + }; + } + if (secondaryLabel != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.secondaryLabel; + node.secondaryLabel = { + ...secondaryLabel, + fontStyle, + fontFamily, + fontWeight, + color: color6, + labelPlacement, + circleQuarter, + radius: labelRadius, + theta + }; + } + node.contentHeight = formatting.height; + }); + const updateSector = (nodeDatum, sector, highlighted) => { + const { depth, startAngle, endAngle } = nodeDatum; + if (depth == null) { + sector.visible = false; + return; + } + sector.visible = true; + const style = this.getItemStyle(nodeDatum, highlighted); + const fill = style.fill; + const strokeWidth = style.strokeWidth; + const fillBBox = import_ag_charts_community158._ModuleSupport.isGradientFill(fill) && fill.bounds !== "item" ? seriesFillBBox : void 0; + applyShapeStyle19(sector, style, fillBBox); + sector.centerX = 0; + sector.centerY = 0; + sector.innerRadius = depth * radiusScale; + sector.outerRadius = (depth + 1) * radiusScale; + sector.startAngle = startAngle + angleOffset; + sector.endAngle = endAngle + angleOffset; + sector.inset = baseInset + strokeWidth * 0.5; + sector.cornerRadius = cornerRadius; + }; + this.datumSelection.each((sector, datum) => { + updateSector(datum, sector, false); + }); + this.highlightSelection.each((rect, datum) => { + updateSector(datum, rect, true); + }); + const updateText = (node, text, tag, highlighted) => { + const { depth, contentHeight } = node; + const primary = tag === 0 /* Primary */; + const label = primary ? node.label : node.secondaryLabel; + if (depth == null || label == null) { + text.visible = false; + return; + } + const { labelPlacement, circleQuarter, radius: textRadius, theta } = label; + let highlightedColor; + if (highlighted) { + const highlightedLabelStyle = primary ? this.properties.highlightStyle.label : this.properties.highlightStyle.secondaryLabel; + highlightedColor = highlightedLabelStyle.color; + } + const params = { + childrenKey: this.properties.childrenKey, + colorKey: this.properties.colorKey, + colorName: this.properties.colorName ?? this.properties.colorKey, + depth: node.depth ?? Number.NaN, + labelKey: this.properties.labelKey, + secondaryLabelKey: this.properties.secondaryLabelKey, + sizeKey: this.properties.sizeKey, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }; + const baseLabelStyle = primary ? this.properties.label : this.properties.secondaryLabel; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const style = getLabelStyles7(this, node, params, baseLabelStyle, highlighted, activeHighlight); + text.text = label.text; + text.fontSize = label.fontSize; + text.lineHeight = label.lineHeight; + text.fontStyle = label.fontStyle; + text.fontFamily = label.fontFamily; + text.fontWeight = label.fontWeight; + text.fill = highlightedColor ?? label.color; + text.fillOpacity = this.getHighlightStyle(highlighted, node.datumIndex)?.opacity ?? 1; + text.setBoxing(style); + switch (labelPlacement) { + case 0 /* CenterCircle */: + text.textAlign = "center"; + text.textBaseline = "top"; + text.translationX = 0; + text.translationY = (primary ? 0 : contentHeight - label.height) - contentHeight * 0.5; + text.rotation = 0; + break; + case 1 /* Parallel */: { + const topHalf = (circleQuarter & 3 /* Top */) !== 0; + const translationRadius = primary === !topHalf ? textRadius : textRadius - (contentHeight - label.height); + text.textAlign = "center"; + text.textBaseline = topHalf ? "bottom" : "top"; + text.translationX = Math.cos(theta) * translationRadius; + text.translationY = Math.sin(theta) * translationRadius; + text.rotation = topHalf ? theta - Math.PI * 0.5 : theta + Math.PI * 0.5; + break; + } + case 2 /* Perpendicular */: { + const rightHalf = (circleQuarter & 6 /* Right */) !== 0; + const translation = primary === !rightHalf ? (contentHeight - label.height) * 0.5 : (label.height - contentHeight) * 0.5; + text.textAlign = "center"; + text.textBaseline = "middle"; + text.translationX = Math.cos(theta) * textRadius + Math.cos(theta + Math.PI / 2) * translation; + text.translationY = Math.sin(theta) * textRadius + Math.sin(theta + Math.PI / 2) * translation; + text.rotation = rightHalf ? theta : theta + Math.PI; + break; + } + } + text.visible = true; + }; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + for (const text of this.labelSelection.selectByClass(TransformableText3)) { + const datum = text.closestDatum(); + updateText(datum, text, text.tag, datum === highlightedDatum); + } + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties, ctx } = this; + const { labelKey, secondaryLabelKey, childrenKey, sizeKey, sizeName, colorKey, colorName, tooltip } = properties; + const { formatManager } = ctx; + const nodeDatum = datumIndex.reduce((n, i) => n?.children[i], this.rootNode); + if (nodeDatum == null) + return; + const { datum, depth } = nodeDatum; + if (datum == null || depth == null) + return; + const data = []; + const datumSize = sizeKey == null ? void 0 : datum[sizeKey]; + if (datumSize != null) { + const sizeDomain = [0, this.rootNode?.sumSize ?? 0]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumSize, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain: sizeDomain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue2(datumSize) }); + } + const datumColor = colorKey == null ? void 0 : datum[colorKey]; + if (datumColor != null) { + const { colorDomain } = this; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumColor, + datum, + seriesId, + legendItemName: void 0, + key: colorKey, + source: "tooltip", + property: "color", + boundSeries: this.getFormatterContext("color"), + domain: colorDomain, + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue2(datumColor) }); + } + const format = this.getItemStyle( + { ...nodeDatum, colorValue: datumColor ?? nodeDatum.colorValue }, + false + ); + const color6 = format.fill; + const markerStyle = { + shape: "square", + fill: color6, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + }; + if (import_ag_charts_community158._ModuleSupport.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return this.formatTooltipWithContext( + tooltip, + { + title: labelKey == null ? void 0 : datum[labelKey], + symbol: { + marker: markerStyle + }, + data + }, + { + seriesId, + datum, + title: void 0, + depth, + labelKey, + secondaryLabelKey, + childrenKey, + sizeKey, + sizeName, + colorKey, + colorName, + ...format + } + ); + } + createNodeData() { + return void 0; + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.datumSelection.nodes()); + } + animateEmptyUpdateReady() { + fromToMotion6(this.id, "nodes", this.ctx.animationManager, [this.scalingGroup], { + toFn() { + return { scalingX: 1, scalingY: 1 }; + }, + fromFn() { + return { scalingX: 0, scalingY: 0 }; + } + }); + } + computeFocusBounds(node) { + return node; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +SunburstSeries.className = "SunburstSeries"; +SunburstSeries.type = "sunburst"; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeriesOptionsDef.ts +var import_ag_charts_community159 = require("ag-charts-community"); +var import_ag_charts_core59 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs22, sunburstSeriesThemeableOptionsDef, without: without8 } = import_ag_charts_community159._ModuleSupport; +var sunburstSeriesOptionsDef = { + ...sunburstSeriesThemeableOptionsDef, + ...without8(commonSeriesOptionsDefs22, ["highlightStyle", "highlight", "showInLegend"]), + type: (0, import_ag_charts_core59.required)((0, import_ag_charts_core59.constant)("sunburst")), + labelKey: import_ag_charts_core59.string, + secondaryLabelKey: import_ag_charts_core59.string, + childrenKey: import_ag_charts_core59.string, + sizeKey: import_ag_charts_core59.string, + colorKey: import_ag_charts_core59.string, + sizeName: import_ag_charts_core59.string, + colorName: import_ag_charts_core59.string +}; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstModule.ts +var { BASE_FONT_SIZE, FONT_SIZE_RATIO: FONT_SIZE_RATIO2 } = import_ag_charts_community160._ModuleSupport; +var SunburstModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "sunburst", + moduleFactory: (ctx) => new SunburstSeries(ctx), + solo: true, + themeTemplate: { + series: { + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", import_ag_charts_community160._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS], + ["pattern", import_ag_charts_community160._ModuleSupport.FILL_PATTERN_DEFAULTS], + ["image", import_ag_charts_community160._ModuleSupport.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + colorRange: { $palette: "divergingColors" }, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + label: { + ...import_ag_charts_community160._ModuleSupport.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $rem: FONT_SIZE_RATIO2.LARGE }, + minimumFontSize: { $rem: 9 / BASE_FONT_SIZE }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + overflowStrategy: "ellipsis", + wrapping: "never", + spacing: 2 + }, + secondaryLabel: { + ...import_ag_charts_community160._ModuleSupport.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $rem: FONT_SIZE_RATIO2.SMALLEST }, + minimumFontSize: { $rem: 7 / BASE_FONT_SIZE }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + overflowStrategy: "ellipsis", + wrapping: "never" + }, + sectorSpacing: 2, + padding: 3, + highlightStyle: { + label: { + color: { $ref: "chartBackgroundColor" } + }, + secondaryLabel: { + color: { $ref: "chartBackgroundColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + } + }, + gradientLegend: { + enabled: true, + ...import_ag_charts_community160._ModuleSupport.LEGEND_CONTAINER_THEME + } + } +}; +var SunburstSeriesModule = { + type: "series", + name: "sunburst", + chartType: "standalone", + enterprise: true, + options: sunburstSeriesOptionsDef, + create: (ctx) => new SunburstSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/treemap/treemapModule.ts +var import_ag_charts_community164 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeries.ts +var import_ag_charts_community162 = require("ag-charts-community"); +var import_ag_charts_core60 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeriesProperties.ts +var import_ag_charts_community161 = require("ag-charts-community"); +var { BaseProperties: BaseProperties13, HierarchySeriesProperties: HierarchySeriesProperties2, HighlightStyle: HighlightStyle2, makeSeriesTooltip: makeSeriesTooltip24, Property: Property39, Label: Label16 } = import_ag_charts_community161._ModuleSupport; +var TreemapGroupLabel = class extends Label16 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property39 +], TreemapGroupLabel.prototype, "spacing", 2); +var TreemapSeriesGroup = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.textAlign = "center"; + this.gap = 0; + this.padding = 0; + this.interactive = true; + this.label = new TreemapGroupLabel(); + } +}; +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "fill", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "fillOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "stroke", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "strokeWidth", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "strokeOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "cornerRadius", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "textAlign", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "gap", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "padding", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "interactive", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "label", 2); +var TreemapSeriesTile = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.gap = 0; + this.padding = 0; + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + } +}; +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "fill", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "fillOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "stroke", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "strokeWidth", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "strokeOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "cornerRadius", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "textAlign", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "verticalAlign", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "gap", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "padding", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "label", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "secondaryLabel", 2); +var TreemapSeriesGroupHighlightStyle = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.label = new AutoSizedLabel(); + } +}; +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "label", 2); +var TreemapSeriesTileHighlightStyle = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + } +}; +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "label", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "secondaryLabel", 2); +var TreemapSeriesHighlightStyle = class extends HighlightStyle2 { + constructor() { + super(false); + this.group = new TreemapSeriesGroupHighlightStyle(); + this.tile = new TreemapSeriesTileHighlightStyle(); + } + getStyle(isLeaf) { + return isLeaf ? this.tile : this.group; + } +}; +__decorateClass([ + Property39 +], TreemapSeriesHighlightStyle.prototype, "group", 2); +__decorateClass([ + Property39 +], TreemapSeriesHighlightStyle.prototype, "tile", 2); +var TreemapSeriesProperties = class extends HierarchySeriesProperties2 { + constructor() { + super(...arguments); + this.highlightStyle = new TreemapSeriesHighlightStyle(); + this.tooltip = makeSeriesTooltip24(); + this.group = new TreemapSeriesGroup(); + this.tile = new TreemapSeriesTile(); + this.undocumentedGroupFills = []; + this.undocumentedGroupStrokes = []; + } + getStyle(isLeaf, fills, strokes, index) { + const { + fillOpacity, + strokeWidth, + strokeOpacity, + fill = isLeaf ? fills[index % fills.length] : fills[Math.min(index, fills.length)], + stroke = isLeaf ? strokes[index % fills.length] : strokes[Math.min(index, strokes.length)] + } = isLeaf ? this.tile : this.group; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + opacity: 1 + }; + } +}; +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "secondaryLabelKey", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "highlightStyle", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "group", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "tile", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "undocumentedGroupFills", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "undocumentedGroupStrokes", 2); + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeries.ts +var { + createDatumId: createDatumId22, + Rect: Rect7, + Group: Group17, + BBox: BBox18, + Selection: Selection16, + Text: Text8, + Transformable: Transformable4, + applyShapeStyle: applyShapeStyle20, + getLabelStyles: getLabelStyles8, + mergeDefaults: mergeDefaults20, + formatValue: formatValue3 +} = import_ag_charts_community162._ModuleSupport; +var TreemapNode = class extends import_ag_charts_community162._ModuleSupport.HierarchyNode { + constructor() { + super(...arguments); + this.labelValue = void 0; + this.secondaryLabelValue = void 0; + this.label = void 0; + this.secondaryLabel = void 0; + this.bbox = void 0; + this.padding = void 0; + } +}; +function nodeSize(node) { + return node.children.length > 0 ? node.sumSize - node.sizeValue : node.sizeValue; +} +var textAlignFactors2 = { + left: 0, + center: 0.5, + right: 1 +}; +var verticalAlignFactors4 = { + top: 0, + middle: 0.5, + bottom: 1 +}; +var DistantGroup = class extends import_ag_charts_community162._ModuleSupport.Group { + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } +}; +var TreemapSeries = class extends import_ag_charts_community162._ModuleSupport.HierarchySeries { + constructor() { + super(...arguments); + this.NodeClass = TreemapNode; + this.properties = new TreemapSeriesProperties(); + this.rectGroup = this.contentGroup.appendChild(new Group17()); + this.datumSelection = Selection16.select(this.rectGroup, Rect7); + this.labelSelection = Selection16.select(this.labelGroup, Group17); + this.highlightSelection = Selection16.select( + this.rectGroup, + Rect7 + ); + } + groupTitleHeight(node, bbox) { + const { labelValue } = node; + const { label: font } = this.properties.group; + const heightRatioThreshold = 3; + if (labelValue == null) { + return; + } else if (font.fontSize > bbox.width / heightRatioThreshold || font.fontSize > bbox.height / heightRatioThreshold) { + return; + } else { + const { height: fontHeight } = (0, import_ag_charts_core60.cachedTextMeasurer)(font).measureLines(labelValue); + return Math.max(fontHeight, font.fontSize); + } + } + getNodePadding(node, bbox) { + if (node.parent == null) { + return { + top: 0, + right: 0, + bottom: 0, + left: 0 + }; + } else if (node.children.length === 0) { + const { padding: padding2 } = this.properties.tile; + return { + top: padding2, + right: padding2, + bottom: padding2, + left: padding2 + }; + } + const { + label: { spacing }, + padding + } = this.properties.group; + const fontHeight = this.groupTitleHeight(node, bbox); + const titleHeight = fontHeight == null ? 0 : fontHeight + spacing; + return { + top: padding + titleHeight, + right: padding, + bottom: padding, + left: padding + }; + } + sortChildren({ children }) { + const sortedChildrenIndices = Array.from(children, (_, i) => i).filter((i) => nodeSize(children[i]) > 0).sort((aIndex, bIndex) => nodeSize(children[bIndex]) - nodeSize(children[aIndex])); + const childAt = (i) => { + const sortedIndex = sortedChildrenIndices[i]; + return children[sortedIndex]; + }; + return { sortedChildrenIndices, childAt }; + } + /** + * Squarified Treemap algorithm + * https://www.win.tue.nl/~vanwijk/stm.pdf + */ + squarify(node, bbox) { + const { datum, children } = node; + if (bbox.width <= 0 || bbox.height <= 0) { + node.bbox = void 0; + node.padding = void 0; + node.midPoint.x = Number.NaN; + node.midPoint.y = Number.NaN; + return; + } + const padding = datum == null ? { top: 0, right: 0, bottom: 0, left: 0 } : this.getNodePadding(node, bbox); + if (node.parent == null) { + node.bbox = void 0; + node.padding = void 0; + node.midPoint.x = Number.NaN; + node.midPoint.y = Number.NaN; + } else { + node.bbox = bbox; + node.padding = padding; + node.midPoint.x = bbox.x + bbox.width / 2; + node.midPoint.y = bbox.y; + } + const { sortedChildrenIndices, childAt } = this.sortChildren(node); + const allLeafNodes = sortedChildrenIndices.every((sortedIndex) => children[sortedIndex].children.length === 0); + const targetTileAspectRatio = 1; + const width = bbox.width - padding.left - padding.right; + const height = bbox.height - padding.top - padding.bottom; + if (width <= 0 || height <= 0) + return; + const numChildren = sortedChildrenIndices.length; + let stackSum = 0; + let startIndex = 0; + let minRatioDiff = Infinity; + let partitionSum = sortedChildrenIndices.reduce((sum, sortedIndex) => sum + nodeSize(children[sortedIndex]), 0); + const innerBox = new BBox18(bbox.x + padding.left, bbox.y + padding.top, width, height); + const partition = innerBox.clone(); + let i = 0; + while (i < numChildren) { + const value = nodeSize(childAt(i)); + const firstValue = nodeSize(childAt(startIndex)); + const isVertical2 = partition.width < partition.height; + stackSum += value; + const partThickness = isVertical2 ? partition.height : partition.width; + const partLength = isVertical2 ? partition.width : partition.height; + const firstTileLength = partLength * firstValue / stackSum; + let stackThickness = partThickness * stackSum / partitionSum; + const ratio3 = Math.max(firstTileLength, stackThickness) / Math.min(firstTileLength, stackThickness); + const diff8 = Math.abs(targetTileAspectRatio - ratio3); + if (diff8 < minRatioDiff) { + minRatioDiff = diff8; + i++; + continue; + } + stackSum -= value; + stackThickness = partThickness * stackSum / partitionSum; + let start2 = isVertical2 ? partition.x : partition.y; + for (let j = startIndex; j < i; j++) { + const child = childAt(j); + const childSize = nodeSize(child); + const x = isVertical2 ? start2 : partition.x; + const y = isVertical2 ? partition.y : start2; + const length = partLength * childSize / stackSum; + const stackWidth = isVertical2 ? length : stackThickness; + const stackHeight = isVertical2 ? stackThickness : length; + const childBbox = new BBox18(x, y, stackWidth, stackHeight); + this.applyGap(innerBox, childBbox, allLeafNodes); + this.squarify(child, childBbox); + partitionSum -= childSize; + start2 += length; + } + if (isVertical2) { + partition.y += stackThickness; + partition.height -= stackThickness; + } else { + partition.x += stackThickness; + partition.width -= stackThickness; + } + startIndex = i; + stackSum = 0; + minRatioDiff = Infinity; + } + const isVertical = partition.width < partition.height; + let start = isVertical ? partition.x : partition.y; + for (let childIdx = startIndex; childIdx < numChildren; childIdx++) { + const child = childAt(childIdx); + const x = isVertical ? start : partition.x; + const y = isVertical ? partition.y : start; + const part = nodeSize(child) / partitionSum; + const childWidth = partition.width * (isVertical ? part : 1); + const childHeight = partition.height * (isVertical ? 1 : part); + const childBox = new BBox18(x, y, childWidth, childHeight); + this.applyGap(innerBox, childBox, allLeafNodes); + this.squarify(child, childBox); + start += isVertical ? childWidth : childHeight; + } + } + applyGap(innerBox, childBox, allLeafNodes) { + const gap = allLeafNodes ? this.properties.tile.gap * 0.5 : this.properties.group.gap * 0.5; + const getBounds = (box) => ({ + left: box.x, + top: box.y, + right: box.x + box.width, + bottom: box.y + box.height + }); + const innerBounds = getBounds(innerBox); + const childBounds = getBounds(childBox); + const sides = ["top", "right", "bottom", "left"]; + for (const side of sides) { + if (!(0, import_ag_charts_core60.isNumberEqual)(innerBounds[side], childBounds[side])) { + childBox.shrink(gap, side); + } + } + } + createNodeData() { + return void 0; + } + getItemStyle(nodeDatum, isLeaf, isHighlight) { + const { properties, colorScale } = this; + const { itemStyler } = properties; + const rootIndex = nodeDatum.datumIndex?.[0] ?? 0; + const fills = isLeaf ? properties.fills : properties.undocumentedGroupFills; + const strokes = isLeaf ? properties.strokes : properties.undocumentedGroupStrokes; + const index = isLeaf ? rootIndex : nodeDatum.depth ?? -1; + const highlightStyle = isHighlight ? properties.highlightStyle.getStyle(isLeaf) : void 0; + const baseStyle = mergeDefaults20(highlightStyle, properties.getStyle(isLeaf, fills, strokes, index)); + if (!isHighlight && isLeaf && nodeDatum.colorValue != null) { + baseStyle.fill = colorScale.convert(nodeDatum.colorValue); + } + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId22(this.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults20(overrides, style); + } + } + return style; + } + makeItemStylerParams(nodeDatum, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + depth: nodeDatum.depth ?? -1, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateSelections() { + let highlightedNode = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedNode != null && !this.properties.group.interactive && highlightedNode.children.length !== 0) { + highlightedNode = void 0; + } + this.highlightSelection.update( + highlightedNode == null ? [] : [highlightedNode], + void 0, + (node) => this.getDatumId(node) + ); + if (!this.nodeDataRefresh) { + return; + } + this.nodeDataRefresh = false; + const { seriesRect } = this.chart ?? {}; + if (!seriesRect) + return; + const descendants = Array.from(this.rootNode); + const updateLabelGroup = (group) => { + group.append([new Text8({ tag: 0 /* Primary */ }), new Text8({ tag: 1 /* Secondary */ })]); + }; + this.datumSelection.update(descendants, void 0, (node) => this.getDatumId(node)); + this.labelSelection.update(descendants, updateLabelGroup, (node) => this.getDatumId(node)); + } + updateNodes() { + const { rootNode, data } = this; + const { + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + highlightStyle, + tile, + group + } = this.properties; + const { seriesRect } = this.chart ?? {}; + if (!seriesRect || !data) + return; + this.rootNode?.walk((node) => { + const { datum, depth, children } = node; + const isLeaf = children.length === 0; + const labelStyle = isLeaf ? tile.label : group.label; + let labelValue; + if (labelStyle.enabled && datum != null && depth != null && labelKey != null) { + const value = datum[labelKey]; + labelValue = this.getLabelText( + value, + datum, + labelKey, + "label", + [], + labelStyle, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (labelValue === "") { + labelValue = void 0; + } + let secondaryLabelValue; + if (tile.secondaryLabel.enabled && isLeaf && datum != null && depth != null && secondaryLabelKey != null) { + const value = datum[secondaryLabelKey]; + secondaryLabelValue = this.getLabelText( + value, + datum, + secondaryLabelKey, + "secondaryLabel", + [], + tile.secondaryLabel, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (secondaryLabelValue === "") { + secondaryLabelValue = void 0; + } + node.labelValue = (0, import_ag_charts_core60.toPlainText)(labelValue); + node.secondaryLabelValue = (0, import_ag_charts_core60.toPlainText)(secondaryLabelValue); + }); + const { width, height } = seriesRect; + this.squarify(rootNode, new BBox18(0, 0, width, height)); + this.rootNode?.walk((node) => { + const { bbox, children, labelValue, secondaryLabelValue } = node; + node.label = void 0; + node.secondaryLabel = void 0; + if (bbox == null) + return; + if (children.length === 0) { + const layout = { + width: bbox.width, + height: bbox.height, + meta: null + }; + const formatting = formatLabels( + labelValue, + this.properties.tile.label, + secondaryLabelValue, + this.properties.tile.secondaryLabel, + { padding: tile.padding }, + () => layout + ); + if (formatting == null) { + return; + } + const { height: labelHeight, label, secondaryLabel } = formatting; + const { textAlign, verticalAlign, padding } = tile; + const textAlignFactor = textAlignFactors2[textAlign] ?? 0.5; + const labelX = bbox.x + padding + (bbox.width - 2 * padding) * textAlignFactor; + const verticalAlignFactor = verticalAlignFactors4[verticalAlign] ?? 0.5; + const labelYStart = bbox.y + padding + labelHeight * 0.5 + (bbox.height - 2 * padding - labelHeight) * verticalAlignFactor; + if (label != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.tile.label; + node.label = { + text: label.text, + fontSize: label.fontSize, + lineHeight: label.lineHeight, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: labelX, + y: labelYStart - (labelHeight - label.height) * 0.5 + }; + } + if (secondaryLabel != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.tile.secondaryLabel; + node.secondaryLabel = { + text: secondaryLabel.text, + fontSize: secondaryLabel.fontSize, + lineHeight: secondaryLabel.fontSize, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: labelX, + y: labelYStart + (labelHeight - secondaryLabel.height) * 0.5 + }; + } + } else if (labelValue == null) { + return; + } else { + const { padding, textAlign } = group; + const groupTitleHeight = this.groupTitleHeight(node, bbox); + if (groupTitleHeight == null) + return; + const innerWidth = bbox.width - 2 * padding; + const text = (0, import_ag_charts_core60.wrapText)(labelValue, { + maxWidth: bbox.width - 2 * padding, + font: group.label, + textWrap: "never" + }); + const textAlignFactor = textAlignFactors2[textAlign] ?? 0.5; + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.group.label; + node.label = { + text, + fontSize: group.label.fontSize, + lineHeight: (0, import_ag_charts_core60.calcLineHeight)(group.label.fontSize), + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: bbox.x + padding + innerWidth * textAlignFactor, + y: bbox.y + padding + groupTitleHeight * 0.5 + }; + } + }); + const fillBBox = { + series: new BBox18(0, 0, width, height), + axis: new BBox18(0, 0, width, height) + }; + const updateRectFn = (node, rect, isHighlight) => { + const { bbox } = node; + if (bbox == null) { + rect.visible = false; + return; + } + const { depth = -1 } = node; + const isLeaf = node.children.length === 0; + const style = this.getItemStyle(node, isLeaf, isHighlight); + rect.crisp = true; + applyShapeStyle20(rect, style, fillBBox); + rect.cornerRadius = isLeaf ? tile.cornerRadius : group.cornerRadius; + rect.zIndex = [0, depth, isHighlight ? 1 : 0]; + const onlyLeaves = node.parent?.children.every((n) => n.children.length === 0); + const parentBbox = node.parent == null ? void 0 : node.parent.bbox; + const parentPadding = node.parent == null ? void 0 : node.parent.padding; + if (onlyLeaves === true && parentBbox != null && parentPadding != null) { + rect.clipBBox = bbox; + rect.x = parentBbox.x + parentPadding.left; + rect.y = parentBbox.y + parentPadding.top; + rect.width = parentBbox.width - (parentPadding.left + parentPadding.right); + rect.height = parentBbox.height - (parentPadding.top + parentPadding.bottom); + } else { + rect.clipBBox = void 0; + rect.x = bbox.x; + rect.y = bbox.y; + rect.width = bbox.width; + rect.height = bbox.height; + } + rect.visible = true; + }; + this.datumSelection.each((rect, datum) => updateRectFn(datum, rect, false)); + this.highlightSelection.each((rect, datum) => { + updateRectFn(datum, rect, true); + }); + const updateLabelFn = (node, text, tag, highlighted) => { + const isLeaf = node.children.length === 0; + const label = tag === 0 /* Primary */ ? node.label : node.secondaryLabel; + if (label == null) { + text.visible = false; + return; + } + const labelProps = tag === 0 /* Primary */ ? tile.label : tile.secondaryLabel; + let highlightedColor; + if (highlighted) { + const { tile: hTitle, group: hGroup } = highlightStyle; + highlightedColor = hTitle.secondaryLabel.color; + if (!isLeaf) { + highlightedColor = hGroup.label.color; + } else if (tag === 0 /* Primary */) { + highlightedColor = hTitle.label.color; + } + } + const params = { + childrenKey: this.properties.childrenKey, + colorKey: this.properties.colorKey, + colorName: this.properties.colorName ?? this.properties.colorKey, + depth: node.depth ?? Number.NaN, + labelKey: this.properties.labelKey, + secondaryLabelKey: this.properties.secondaryLabelKey, + sizeKey: this.properties.sizeKey, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const style = getLabelStyles8(this, node, params, labelProps, highlighted, activeHighlight); + text.text = label.text; + text.fontSize = label.fontSize; + text.lineHeight = label.lineHeight; + text.fontStyle = label.fontStyle; + text.fontFamily = label.fontFamily; + text.fontWeight = label.fontWeight; + text.fill = highlightedColor ?? label.color; + text.fillOpacity = this.getHighlightStyle(highlighted, node.datumIndex)?.opacity ?? 1; + text.textAlign = label.textAlign; + text.textBaseline = label.verticalAlign; + text.x = label.x; + text.y = label.y; + text.setBoxing(style); + text.visible = true; + text.zIndex = 1; + }; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + for (const text of this.labelSelection.selectByClass(Text8)) { + const datum = text.closestDatum(); + updateLabelFn(datum, text, text.tag, datum === highlightedDatum); + } + } + pickNodesExactShape(point) { + const nodes = super.pickNodesExactShape(point); + nodes.sort((a, b) => b.datumIndex.length - a.datumIndex.length); + return nodes; + } + pickNodeClosestDatum(point) { + const exactMatch = this.pickNodesExactShape(point); + if (exactMatch.length !== 0) { + return { datum: exactMatch[0], distance: 0 }; + } + return this.pickNodeNearestDistantObject(point, this.datumSelection.nodes()); + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties, ctx } = this; + const { formatManager } = ctx; + const { labelKey, secondaryLabelKey, childrenKey, sizeKey, sizeName, colorKey, colorName, tooltip } = properties; + const nodeDatum = datumIndex.reduce((n, i) => n?.children[i], this.rootNode); + if (nodeDatum == null) + return; + const { datum, depth, children } = nodeDatum; + if (datum == null || depth == null) + return; + const isLeaf = children.length === 0; + const data = []; + const datumSize = sizeKey == null ? void 0 : datum[sizeKey]; + if (datumSize != null) { + const sizeDomain = [0, this.rootNode?.sumSize ?? 0]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumSize, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain: sizeDomain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue3(datumSize) }); + } + const datumColor = colorKey == null ? void 0 : datum[colorKey]; + if (datumColor != null) { + const { colorDomain } = this; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumColor, + datum, + seriesId, + legendItemName: void 0, + key: colorKey, + source: "tooltip", + property: "color", + boundSeries: this.getFormatterContext("color"), + domain: colorDomain, + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue3(datumColor) }); + } + const format = this.getItemStyle( + { ...nodeDatum, colorValue: datumColor ?? nodeDatum.colorValue }, + isLeaf, + false + ); + const color6 = format.fill; + const markerStyle = { + shape: "square", + fill: color6, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + }; + if (import_ag_charts_community162._ModuleSupport.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + const symbol = isLeaf ? { marker: markerStyle } : void 0; + return this.formatTooltipWithContext( + tooltip, + { + title: labelKey == null ? void 0 : datum[labelKey], + symbol, + data + }, + { + seriesId, + datum, + title: void 0, + depth, + labelKey, + secondaryLabelKey, + childrenKey, + sizeKey, + sizeName, + colorKey, + colorName, + ...format + } + ); + } + computeFocusBounds(node) { + return Transformable4.toCanvas(this.contentGroup, node.getBBox()); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.tile.label.itemStyler != null || this.properties.group.label.itemStyler != null; + } +}; +TreemapSeries.className = "TreemapSeries"; +TreemapSeries.type = "treemap"; + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeriesOptionsDef.ts +var import_ag_charts_community163 = require("ag-charts-community"); +var import_ag_charts_core61 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs23, treemapSeriesThemeableOptionsDef, without: without9 } = import_ag_charts_community163._ModuleSupport; +var treemapSeriesOptionsDef = { + ...treemapSeriesThemeableOptionsDef, + ...without9(commonSeriesOptionsDefs23, ["highlightStyle", "highlight", "showInLegend"]), + type: (0, import_ag_charts_core61.required)((0, import_ag_charts_core61.constant)("treemap")), + labelKey: import_ag_charts_core61.string, + secondaryLabelKey: import_ag_charts_core61.string, + childrenKey: import_ag_charts_core61.string, + sizeKey: import_ag_charts_core61.string, + colorKey: import_ag_charts_core61.string, + sizeName: import_ag_charts_core61.string, + colorName: import_ag_charts_core61.string +}; +treemapSeriesOptionsDef.undocumentedGroupFills = (0, import_ag_charts_core61.undocumented)((0, import_ag_charts_core61.arrayOf)(import_ag_charts_core61.color)); +treemapSeriesOptionsDef.undocumentedGroupStrokes = (0, import_ag_charts_core61.undocumented)((0, import_ag_charts_core61.arrayOf)(import_ag_charts_core61.color)); + +// packages/ag-charts-enterprise/src/series/treemap/treemapModule.ts +var { FONT_SIZE_RATIO: FONT_SIZE_RATIO3 } = import_ag_charts_community164._ModuleSupport; +var TreemapModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "treemap", + moduleFactory: (ctx) => new TreemapSeries(ctx), + solo: true, + themeTemplate: { + series: { + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", import_ag_charts_community164._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", import_ag_charts_community164._ModuleSupport.FILL_PATTERN_DEFAULTS], + ["image", import_ag_charts_community164._ModuleSupport.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + colorRange: { $palette: "divergingColors" }, + // @ts-expect-error undocumented option + undocumentedGroupFills: { $palette: "hierarchyColors" }, + undocumentedGroupStrokes: { $palette: "secondHierarchyColors" }, + group: { + label: { + ...import_ag_charts_community164._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "textColor" }, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + spacing: 4 + }, + fill: void 0, + // Override default fill + stroke: void 0, + // Override default stroke + strokeWidth: 1, + padding: 4, + gap: 2, + textAlign: "left" + }, + tile: { + label: { + ...import_ag_charts_community164._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "chartBackgroundColor" }, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: 1.5 }, + minimumFontSize: { $rem: FONT_SIZE_RATIO3.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + wrapping: "on-space", + overflowStrategy: "ellipsis", + spacing: 2 + }, + secondaryLabel: { + ...import_ag_charts_community164._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "chartBackgroundColor" }, + fontStyle: void 0, + fontWeight: void 0, + fontSize: { $ref: "fontSize" }, + minimumFontSize: { $rem: FONT_SIZE_RATIO3.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + wrapping: "never", + overflowStrategy: "ellipsis" + }, + fill: void 0, + // Override default fill + stroke: void 0, + // Override default stroke + strokeWidth: { $isUserOption: ["../strokes/0", 2, { $isUserOption: ["./stroke", 2, 0] }] }, + padding: 3, + gap: 1 + }, + // Override defaults + highlightStyle: { + group: { + label: { + color: { $ref: "textColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + }, + tile: { + label: { + color: { $ref: "chartBackgroundColor" } + }, + secondaryLabel: { + color: { $ref: "chartBackgroundColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + } + } + }, + gradientLegend: { + enabled: true, + ...import_ag_charts_community164._ModuleSupport.LEGEND_CONTAINER_THEME + } + } +}; +var TreemapSeriesModule = { + type: "series", + name: "treemap", + chartType: "standalone", + enterprise: true, + options: treemapSeriesOptionsDef, + create: (ctx) => new TreemapSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/main-modules.ts +var ModuleRegistry = import_ag_charts_community165._ModuleSupport.ModuleRegistry; +var AllCartesianEnterpriseModules = [ + OrdinalTimeAxisModule, + BoxPlotSeriesModule, + CandlestickSeriesModule, + ConeFunnelSeriesModule, + FunnelSeriesModule, + HeatmapSeriesModule, + OhlcSeriesModule, + RangeAreaSeriesModule, + RangeBarSeriesModule, + WaterfallSeriesModule +]; +var AllPolarEnterpriseModules = [ + AngleNumberAxisModule, + AngleCategoryAxisModule, + RadiusNumberAxisModule, + RadiusCategoryAxisModule, + NightingaleSeriesModule, + RadarAreaSeriesModule, + RadarLineSeriesModule, + RadialBarSeriesModule, + RadialColumnSeriesModule +]; +var AllStandaloneEnterpriseModules = [ + StandaloneChartModule, + PyramidSeriesModule, + LinearGaugeSeriesModule, + RadialGaugeSeriesModule, + SunburstSeriesModule, + TreemapSeriesModule, + ChordSeriesModule, + SankeySeriesModule +]; +var AllTopologyEnterpriseModules = [ + TopologyChartModule, + MapLineSeriesModule, + MapLineBackgroundSeriesModule, + MapMarkerSeriesModule, + MapShapeSeriesModule, + MapShapeBackgroundSeriesModule +]; +var AllEnterpriseModules = [ + ...AllCartesianEnterpriseModules, + ...AllPolarEnterpriseModules, + ...AllStandaloneEnterpriseModules, + ...AllTopologyEnterpriseModules, + // Plugins, WIP + AnnotationsModule, + NavigatorModule, + InitialStateModule +]; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.cjs.min.js b/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.cjs.min.js new file mode 100644 index 000000000..e3d5e3984 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.cjs.min.js @@ -0,0 +1,5 @@ +"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var i in t)__defProp(e,i,{get:t[i],enumerable:!0})},__copyProps=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of __getOwnPropNames(t))!__hasOwnProp.call(e,a)&&a!==i&&__defProp(e,a,{get:()=>t[a],enumerable:!(s=__getOwnPropDesc(t,a))||s.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__decorateClass=(e,t,i,s)=>{for(var a=s>1?void 0:s?__getOwnPropDesc(t,i):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(a=(s?r(t,i,a):r(a))||a);return s&&a&&__defProp(t,i,a),a},main_modules_exports={};__export(main_modules_exports,{AllCartesianEnterpriseModules:()=>AllCartesianEnterpriseModules,AllEnterpriseModules:()=>AllEnterpriseModules,AllPolarEnterpriseModules:()=>AllPolarEnterpriseModules,AllStandaloneEnterpriseModules:()=>AllStandaloneEnterpriseModules,AllTopologyEnterpriseModules:()=>AllTopologyEnterpriseModules,AngleCategoryAxisModule:()=>AngleCategoryAxisModule,AngleNumberAxisModule:()=>AngleNumberAxisModule,BoxPlotSeriesModule:()=>BoxPlotSeriesModule,CandlestickSeriesModule:()=>CandlestickSeriesModule,ChordSeriesModule:()=>ChordSeriesModule,ConeFunnelSeriesModule:()=>ConeFunnelSeriesModule,FunnelSeriesModule:()=>FunnelSeriesModule,HeatmapSeriesModule:()=>HeatmapSeriesModule,LinearGaugeSeriesModule:()=>LinearGaugeSeriesModule,MapLineBackgroundSeriesModule:()=>MapLineBackgroundSeriesModule,MapLineSeriesModule:()=>MapLineSeriesModule,MapMarkerSeriesModule:()=>MapMarkerSeriesModule,MapShapeBackgroundSeriesModule:()=>MapShapeBackgroundSeriesModule,MapShapeSeriesModule:()=>MapShapeSeriesModule,ModuleRegistry:()=>ModuleRegistry,NightingaleSeriesModule:()=>NightingaleSeriesModule,OhlcSeriesModule:()=>OhlcSeriesModule,OrdinalTimeAxisModule:()=>OrdinalTimeAxisModule,PyramidSeriesModule:()=>PyramidSeriesModule,RadarAreaSeriesModule:()=>RadarAreaSeriesModule,RadarLineSeriesModule:()=>RadarLineSeriesModule,RadialBarSeriesModule:()=>RadialBarSeriesModule,RadialColumnSeriesModule:()=>RadialColumnSeriesModule,RadialGaugeSeriesModule:()=>RadialGaugeSeriesModule,RadiusCategoryAxisModule:()=>RadiusCategoryAxisModule,RadiusNumberAxisModule:()=>RadiusNumberAxisModule,RangeAreaSeriesModule:()=>RangeAreaSeriesModule,RangeBarSeriesModule:()=>RangeBarSeriesModule,SankeySeriesModule:()=>SankeySeriesModule,StandaloneChartModule:()=>StandaloneChartModule,SunburstSeriesModule:()=>SunburstSeriesModule,TopologyChartModule:()=>TopologyChartModule,TreemapSeriesModule:()=>TreemapSeriesModule,WaterfallSeriesModule:()=>WaterfallSeriesModule}),module.exports=__toCommonJS(main_modules_exports);var import_ag_charts_community165=require("ag-charts-community"),import_ag_charts_community13=require("ag-charts-community"),import_ag_charts_community5=require("ag-charts-community"),import_ag_charts_core4=require("ag-charts-core");function loopSymmetrically(e,t,i){const s=(o,r,n,l)=>{let c=e[0];for(let h=o;n>0?h<=r:h>r;h+=n){const p=e[h];if(l(c,p))return!0;c=p}return!1},a=Math.floor(e.length/2);return s(t,a,t,i)?!0:s(e.length-t,a,-t,i)}var import_ag_charts_community=require("ag-charts-community"),{AxisInterval,Property}=import_ag_charts_community._ModuleSupport,AngleAxisInterval=class extends AxisInterval{};__decorateClass([Property],AngleAxisInterval.prototype,"minSpacing",2);var import_ag_charts_community4=require("ag-charts-community"),import_ag_charts_core3=require("ag-charts-core"),import_ag_charts_community3=require("ag-charts-community"),import_ag_charts_core2=require("ag-charts-core"),import_ag_charts_community2=require("ag-charts-community"),import_ag_charts_core=require("ag-charts-core"),{BaseProperties,ChartAxisDirection,Property:Property2,Group,FONT_SIZE}=import_ag_charts_community2._ModuleSupport,PolarCrossLineLabel=class extends BaseProperties{constructor(){super(...arguments),this.fontSize=FONT_SIZE.LARGE,this.fontFamily="Verdana, sans-serif",this.padding=5,this.color="rgba(87, 87, 87, 1)"}};__decorateClass([Property2],PolarCrossLineLabel.prototype,"enabled",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"text",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"fontStyle",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"fontWeight",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"fontSize",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"fontFamily",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"padding",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"color",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"parallel",2);var PolarCrossLine=class extends BaseProperties{constructor(){super(...arguments),this.id=(0,import_ag_charts_core.createId)(this),this.defaultColorRange=[],this.shape="polygon",this.label=new PolarCrossLineLabel,this.scale=void 0,this.clippedRange=[-1/0,1/0],this.gridLength=0,this.sideFlag=-1,this.parallelFlipRotation=0,this.regularFlipRotation=0,this.direction=ChartAxisDirection.Angle,this.axisInnerRadius=0,this.axisOuterRadius=0,this.lineGroup=new Group({name:this.id}),this.rangeGroup=new Group({name:this.id}),this.labelGroup=new Group({name:this.id}),this._isRange=void 0}assignCrossLineGroup(e,t){e!==this._isRange&&(e?this.rangeGroup.appendChild(t):this.lineGroup.appendChild(t)),this._isRange=e}setSectorNodeProps(e){e.fill=this.fill,e.fillOpacity=this.fillOpacity??1,e.stroke=this.stroke,e.strokeOpacity=this.strokeOpacity??1,e.strokeWidth=this.strokeWidth??1,e.lineDash=this.lineDash}setLabelNodeProps(e,t,i,s,a){const{label:o}=this;e.x=t,e.y=i,e.text=o.text,e.textAlign="center",e.textBaseline=s,e.rotation=a,e.rotationCenterX=t,e.rotationCenterY=i,e.fill=o.color,e.fontFamily=o.fontFamily,e.fontSize=o.fontSize,e.fontStyle=o.fontStyle,e.visible=!0}};__decorateClass([Property2],PolarCrossLine.prototype,"enabled",2),__decorateClass([Property2],PolarCrossLine.prototype,"type",2),__decorateClass([Property2],PolarCrossLine.prototype,"range",2),__decorateClass([Property2],PolarCrossLine.prototype,"value",2),__decorateClass([Property2],PolarCrossLine.prototype,"defaultColorRange",2),__decorateClass([Property2],PolarCrossLine.prototype,"fill",2),__decorateClass([Property2],PolarCrossLine.prototype,"fillOpacity",2),__decorateClass([Property2],PolarCrossLine.prototype,"stroke",2),__decorateClass([Property2],PolarCrossLine.prototype,"strokeWidth",2),__decorateClass([Property2],PolarCrossLine.prototype,"strokeOpacity",2),__decorateClass([Property2],PolarCrossLine.prototype,"lineDash",2),__decorateClass([Property2],PolarCrossLine.prototype,"shape",2),__decorateClass([Property2],PolarCrossLine.prototype,"label",2);var{ChartAxisDirection:ChartAxisDirection2,getCrossLineValue,validateCrossLineValue,normalizeAngle360,Group:Group2,Path,Sector,RotatableText,ContinuousScale}=import_ag_charts_community3._ModuleSupport,AngleCrossLine=class extends PolarCrossLine{constructor(){super(),this.direction=ChartAxisDirection2.Angle,this.polygonNode=new Path,this.sectorNode=new Sector,this.lineNode=new Path,this.crossLineRange=new Group2,this.labelNode=new RotatableText,this.ticks=[],this.crossLineRange.append(this.polygonNode),this.crossLineRange.append(this.sectorNode),this.crossLineRange.append(this.lineNode),this.labelGroup.append(this.labelNode)}visibilityCheck(){if(!ContinuousScale.is(this.scale))return!0;const[e,t]=this.scale.domain,i=getCrossLineValue(this);if(this.type==="range"){const[s,a]=i;return s>=e&&s<=t&&a>=s&&a<=t}else return i>=e&&i<=t}update(e){const{scale:t}=this;if(!t||!validateCrossLineValue(this,t)||!this.visibilityCheck()){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.rangeGroup.visible=e,this.lineGroup.visible=e,this.labelGroup.visible=e,this.updateLineNode(e),this.updatePolygonNode(e),this.updateSectorNode(e),this.updateLabelNode(e)}updateLineNode(e){const{scale:t,type:i,value:s,lineNode:a}=this;if(!e||i!=="line"||!t){a.visible=!1;return}const o=t.convert(s);if(Number.isNaN(o)){a.visible=!1;return}const{axisInnerRadius:r,axisOuterRadius:n}=this;a.visible=!0,a.stroke=this.stroke,a.strokeOpacity=this.strokeOpacity??1,a.strokeWidth=this.strokeWidth??1,a.fill=void 0,a.lineDash=this.lineDash;const l=n*Math.cos(o),c=n*Math.sin(o),h=r*Math.cos(o),p=r*Math.sin(o);a.path.clear(!0),a.path.moveTo(h,p),a.path.lineTo(l,c),this.assignCrossLineGroup(!1,this.crossLineRange)}updatePolygonNode(e){const{polygonNode:t,range:i,scale:s,shape:a,type:o,ticks:r}=this;if(!e||o!=="range"||a!=="polygon"||!s||!i){t.visible=!1;return}const{axisInnerRadius:n,axisOuterRadius:l}=this,c=r.indexOf(i[0]),h=r.indexOf(i[1]),u=(c<=h?r.slice(c,h+1):r.slice(c).concat(r.slice(0,h+1))).map(d=>s.convert(d));t.visible=!0,this.setSectorNodeProps(t);const{path:g}=t;g.clear(!0);for(const[d,m]of u.entries()){const y=l*Math.cos(m),f=l*Math.sin(m);d===0?g.moveTo(y,f):g.lineTo(y,f)}if(n===0)g.lineTo(0,0);else{const d=u.slice().reverse();for(const m of d){const y=n*Math.cos(m),f=n*Math.sin(m);g.lineTo(y,f)}}t.path.closePath(),this.assignCrossLineGroup(!0,this.crossLineRange)}updateSectorNode(e){const{sectorNode:t,range:i,scale:s,shape:a,type:o}=this;if(!e||o!=="range"||a!=="circle"||!s||!i){t.visible=!1;return}const{axisInnerRadius:r,axisOuterRadius:n}=this,l=i.map(p=>s.convert(p)),c=s.step??0,h=s instanceof import_ag_charts_community3._ModuleSupport.BandScale?c/2:0;t.visible=!0,this.setSectorNodeProps(t),t.centerX=0,t.centerY=0,t.innerRadius=r,t.outerRadius=n,t.startAngle=l[0]-h,t.endAngle=l[1]+h,this.assignCrossLineGroup(!0,this.crossLineRange)}updateLabelNode(e){const{label:t,labelNode:i,range:s,scale:a,type:o,ticks:r}=this;if(!e||t.enabled===!1||!t.text||!a||o==="range"&&!s){i.visible=!1;return}i.visible=!0;const{axisInnerRadius:n,axisOuterRadius:l}=this;let c,h,p,u;if(o==="line"){const g=normalizeAngle360(a.convert(this.value)),d=1.5*Math.PI,m=(0,import_ag_charts_core2.isNumberEqual)(g,d)||g>d||gnormalizeAngle360(a.convert(S)));let m=(g+d)/2;g>d&&(m-=Math.PI),m=normalizeAngle360(m);const y=((0,import_ag_charts_core2.isNumberEqual)(m,0)||m>0)&&ml.value),n=r.reduce((l,c)=>Math.max(typeof c=="number"?(0,import_ag_charts_core3.countFractionDigits)(c):0,l),0);return{niceDomain:a,tickDomain:a,ticks:r,rawTickCount:void 0,fractionDigits:n,timeInterval:void 0,bbox:this.getBBox()}}update(){super.update(),this.updateRadiusLine(),this.updateGridLines(),this.updateTickLines()}normalizedAngles(){const e=normalizeAngle3602(-Math.PI/2+toRadians(this.startAngle)),t=this.endAngle==null?2*Math.PI:normalizeAngle360Inclusive(toRadians(this.endAngle)-toRadians(this.startAngle)),i=e+t;return[e,i]}computeRange(){this.range=this.normalizedAngles()}updateSelections(){const e=this.tickData;this.gridLineGroupSelection.update(this.gridLength&&this.gridLine.enabled?e:[]),this.tickLineGroupSelection.update(this.tick.enabled?e:[]),this.tickLabelGroupSelection.update(this.label.enabled?e:[]),this.gridLineGroupSelection.cleanup(),this.tickLineGroupSelection.cleanup(),this.tickLabelGroupSelection.cleanup()}updatePosition(){super.updatePosition();const{translation:e,radiusLineGroup:t}=this,i=Math.floor(e.x),s=Math.floor(e.y);t.translationX=i,t.translationY=s}updateRadiusLine(){const e=this.radiusLine,{path:t}=e;t.clear(!0);const{points:i,closePath:s}=this.getAxisLinePoints();for(const{x:a,y:o,moveTo:r,arc:n,radius:l=0,startAngle:c=0,endAngle:h=0}of i)n?t.arc(a,o,l,c,h):r?t.moveTo(a,o):t.lineTo(a,o);s&&t.closePath(),e.visible=this.line.enabled,e.stroke=this.line.stroke,e.strokeWidth=this.line.width,e.fill=void 0}getAxisLinePoints(){const{scale:e,shape:t,gridLength:i}=this,[s,a]=this.range,o=(0,import_ag_charts_core3.isNumberEqual)(a-s,2*Math.PI),r=[];if(t==="circle")o?r.push({x:i,y:0,moveTo:!0},{x:0,y:0,radius:i,startAngle:0,endAngle:2*Math.PI,arc:!0,moveTo:!1}):r.push({x:i*Math.cos(s),y:i*Math.sin(s),moveTo:!0},{x:0,y:0,radius:i,startAngle:normalizeAngle3602(s),endAngle:normalizeAngle3602(a),arc:!0,moveTo:!1});else if(t==="polygon"){const n=e.ticks({nice:this.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0})?.ticks?.map(l=>e.convert(l));if(n&&n.length>2)for(const[l,c]of n.entries()){const h=i*Math.cos(c),p=i*Math.sin(c),u=l===0;r.push({x:h,y:p,moveTo:u})}}return{points:r,closePath:o}}updateGridLines(){const{scale:e,gridLength:t,gridLine:{style:i,width:s},innerRadiusRatio:a}=this;if(!(i&&t>0))return;const o=t*a,r=i.length;this.gridLineGroupSelection.each((n,l,c)=>{const{value:h}=l,{stroke:p,lineDash:u}=i[c%r],g=e.convert(h);n.x1=o*Math.cos(g),n.y1=o*Math.sin(g),n.x2=t*Math.cos(g),n.y2=t*Math.sin(g),n.stroke=p,n.strokeWidth=s,n.lineDash=u,n.fill=void 0}),this.gridLineGroupSelection.cleanup()}updateLabels(){const{label:e,tickLabelGroupSelection:t}=this;t.each((i,s,a)=>{const o=this.labelData[a];if(!o||o.hidden){i.visible=!1;return}i.text=o.text,i.setFont(e),i.fill=e.color,i.x=o.x,i.y=o.y,i.setAlign(o),i.setBoxing(e),i.visible=!0,o.rotation?(i.rotation=o.rotation,i.rotationCenterX=o.x,i.rotationCenterY=o.y):i.rotation=0})}updateTickLines(){const{scale:e,gridLength:t,tick:i,tickLineGroupSelection:s}=this;s.each((a,o)=>{const{value:r}=o,n=e.convert(r),l=Math.cos(n),c=Math.sin(n);a.x1=t*l,a.y1=t*c,a.x2=(t+i.size)*l,a.y2=(t+i.size)*c,a.stroke=i.stroke,a.strokeWidth=i.width})}createLabelNodeData(e,t,i){const{label:s,gridLength:a,scale:o,tick:r}=this;if(!s.enabled)return[];const n=new RotatableText2,l=i.x-this.translation.x,c=i.x+i.width-this.translation.x,{fractionDigits:h}=this.layout.label,p=this.tickFormatter(this.scale.domain,this.tickData,!1,h),u=e.map((g,d)=>{const{value:m}=g,y=a+s.spacing+r.size,f=o.convert(m),S=Math.cos(f),b=Math.sin(f),x=y*S,v=y*b,{textAlign:_,textBaseline:D}=this.getLabelAlign(f),k=d===e.length-1&&m!==e[0]&&(0,import_ag_charts_core3.isNumberEqual)(normalizeAngle3602(f),normalizeAngle3602(o.convert(e[0]))),A=this.getLabelRotation(f);let L=p(m,d);n.text=L,n.x=x,n.y=v,n.setFont(s),n.textAlign=_,n.textBaseline=D,n.rotation=A,A&&(n.rotationCenterX=x,n.rotationCenterY=v);let R=A?Transformable.toCanvas(n):n.getBBox();if(R&&t.hideWhenNecessary&&!A){const O=l-R.x,B=R.x+R.width-c,C=1;if(O>C||B>C){const M={maxWidth:R.width-Math.max(O,B),font:s,textWrap:"never"};L=(0,import_ag_charts_core3.wrapTextOrSegments)(L,M),n.text=L,R=n.getBBox()}}return{text:L,x,y:v,textAlign:_,textBaseline:D,hidden:L===""||(g.hidden??k),rotation:A,box:R}});return s.avoidCollisions&&this.avoidLabelCollisions(u),u}computeLabelsBBox(e,t){this.labelData=this.createLabelNodeData(this.tickData,e,t);const i=this.labelData.map(({box:s})=>s).filter(s=>s!=null);return!this.label.enabled||i.length===0?null:BBox.merge(i)}getLabelOrientation(){const{label:e}=this;return e instanceof AngleAxisLabel?e.orientation:"fixed"}getLabelRotation(e){let t=toRadians(this.label.rotation??0);e=normalizeAngle3602(e);const i=this.getLabelOrientation();return i==="parallel"?(t+=e,e>=0&&e=Math.PI/2&&e<1.5*Math.PI&&(t+=Math.PI)),t}getLabelAlign(e){const t=Math.cos(e),i=Math.sin(e);let s,a;const o=this.getLabelOrientation(),r=(0,import_ag_charts_core3.isNumberEqual)(t,0),n=(0,import_ag_charts_core3.isNumberEqual)(i,0),l=(0,import_ag_charts_core3.isNumberEqual)(t,1),c=(0,import_ag_charts_core3.isNumberEqual)(i,-1),h=t>0&&!r,p=i>0&&!n;return o==="parallel"?(s="center",a=l&&n||p?"top":"bottom"):o==="perpendicular"?(s=c||h?"left":"right",a="middle"):(s="right",r?s="center":h&&(s="left"),a="bottom",n?a="middle":p&&(a="top")),{textAlign:s,textBaseline:a}}updateCrossLines(){const{shape:e,gridLength:t,innerRadiusRatio:i}=this;for(const s of this.crossLines)s instanceof AngleCrossLine&&(s.ticks=this.tickData.map(a=>a.value),s.shape=e,s.axisOuterRadius=t,s.axisInnerRadius=t*i);super.updateCrossLines()}};AngleAxis.CrossLineConstructor=AngleCrossLine,__decorateClass([Property3],AngleAxis.prototype,"startAngle",2),__decorateClass([Property3],AngleAxis.prototype,"endAngle",2);var{Property:Property4,CategoryScale}=import_ag_charts_community5._ModuleSupport,AngleCategoryAxis=class extends AngleAxis{constructor(e){super(e,new CategoryScale),this.groupPaddingInner=0,this.paddingInner=0,this.interval=new AngleAxisInterval}hasDefinedDomain(){return!1}generateAngleTicks(e){const{scale:t,gridLength:i}=this,{values:s,minSpacing:a}=this.interval,o={nice:this.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0},r=s??t.ticks(o,e)?.ticks??[];if(r.length<2||a==null)return r.map(p=>({value:p,visible:!0}));const n=r[0],l=t.convert(n),c=i*Math.cos(l),h=i*Math.sin(l);for(let p=1;pMath.PI)break;const d=i*Math.cos(g),m=i*Math.sin(g);if(Math.hypot(d-c,m-h)>a){const f=new Set([n]);return loopSymmetrically(r,p,(S,b)=>{f.add(b)}),r.map(S=>{const b=f.has(S);return{value:S,visible:b}})}}return[{value:n,visible:!0}]}avoidLabelCollisions(e){const{minSpacing:t}=this.label;if(e.length<3)return;const i=(l,c)=>{if(l.hidden||c.hidden)return!1;if(t==null)return l.box.collidesBBox(c.box);const h=l.box.clone().grow(t/2),p=c.box.clone().grow(t/2);return h.collidesBBox(p)},s=e[0],a=e.at(-1),o=new Set([s]),r=(0,import_ag_charts_core4.isNumberEqual)(s.x,a.x)&&(0,import_ag_charts_core4.isNumberEqual)(s.y,a.y),n=Math.floor(e.length/2);for(let l=1;l<=n;l++){const c=r?e.slice(0,-1):e;if(!loopSymmetrically(c,l,i)){loopSymmetrically(c,l,(p,u)=>{o.add(u)});break}}for(const l of e)o.has(l)||(l.hidden=!0,l.box=void 0)}tickFormatParams(){return{type:"category"}}datumFormatParams(e,t){const{datum:i,seriesId:s,legendItemName:a,key:o,source:r,property:n,domain:l,boundSeries:c}=t;return{type:"category",value:e,datum:i,seriesId:s,legendItemName:a,key:o,source:r,property:n,domain:l,boundSeries:c}}};AngleCategoryAxis.className="AngleCategoryAxis",AngleCategoryAxis.type="angle-category",__decorateClass([Property4],AngleCategoryAxis.prototype,"groupPaddingInner",2),__decorateClass([Property4],AngleCategoryAxis.prototype,"paddingInner",2),__decorateClass([Property4],AngleCategoryAxis.prototype,"interval",2);var import_ag_charts_community7=require("ag-charts-community"),import_ag_charts_core6=require("ag-charts-core"),import_ag_charts_community6=require("ag-charts-community"),import_ag_charts_core5=require("ag-charts-core"),{range,isDenseInterval,LinearScale}=import_ag_charts_community6._ModuleSupport,LinearAngleScale=class pe extends LinearScale{constructor(){super(...arguments),this.arcLength=0}static getNiceStepAndTickCount(t,i){const[s,a]=i;let o=LinearScale.getTickStep(s,a,t);const r=Number.isNaN(t.maxTickCount)?1/0:t.maxTickCount,n=Math.abs(a-s)/o;let l=Math.pow(2,Math.ceil(Math.log(n)/Math.log(2)));return l>r&&(l/=2,o*=2),{count:l,step:o}}ticks(t,i=this.domain){const{arcLength:s}=this;if(!i||i.length<2||i.some(c=>!Number.isFinite(c))||s<=0)return{ticks:[],count:0};const{nice:a,interval:o}=t,[r,n]=i;if(o){const c=Math.abs(o),h=this.getPixelRange();if(!isDenseInterval((n-r)/c,h))return range(r,n,c)}let l;if(a&&this.hasNiceRange()){const c=super.niceDomain(t,i);l=pe.getNiceStepAndTickCount(t,c).step}else l=LinearScale.getTickStep(r,n,t);return range(r,n,l)}hasNiceRange(){const t=this.range.slice().sort((s,a)=>s-a);return[Math.PI,2*Math.PI].some(s=>(0,import_ag_charts_core5.isNumberEqual)(s,t[1]-t[0]))}niceDomain(t,i=this.domain){const s=super.niceDomain(t,i);if(!this.hasNiceRange())return s;const a=s[0]>s[1],o=a?s[1]:s[0],{step:r,count:n}=pe.getNiceStepAndTickCount(t,s),l=1/r,c=r>=1?Math.ceil(o/r+n)*r:Math.ceil((o+n*r)*l)/l;return a?[c,o]:[o,c]}getPixelRange(){return this.arcLength}},{Property:Property5,angleBetween,normalisedExtentWithMetadata,findMinMax}=import_ag_charts_community7._ModuleSupport,AngleNumberAxis=class extends AngleAxis{constructor(e){super(e,new LinearAngleScale),this.shape="circle",this.interval=new AngleAxisInterval}hasDefinedDomain(){const{min:e,max:t}=this;return e!=null&&t!=null&&ep>=c&&p<=h).sort((p,u)=>p-u)}return l.map(c=>({value:c,visible:!0}))}avoidLabelCollisions(e){const{minSpacing:t}=this.label,i=(o,r)=>{if(o.hidden||r.hidden)return!1;if(t==null)return o.box.collidesBBox(r.box);const n=o.box.clone().grow(t/2),l=r.box.clone().grow(t/2);return n.collidesBBox(l)},s=e[0],a=e.at(-1);s!==a&&(0,import_ag_charts_core6.isNumberEqual)(s.x,a.x)&&(0,import_ag_charts_core6.isNumberEqual)(s.y,a.y)&&(a.hidden=!0);for(let o=1;o0&&(l.hidden=!0,l.box=void 0);return}}for(const[o,r]of e.entries())o>0&&(r.hidden=!0,r.box=void 0)}tickFormatParams(e,t,i){return{type:"number",fractionDigits:i}}datumFormatParams(e,t,i){const{datum:s,seriesId:a,legendItemName:o,key:r,source:n,property:l,domain:c,boundSeries:h}=t;return{type:"number",value:e,datum:s,seriesId:a,legendItemName:o,key:r,source:n,property:l,domain:c,boundSeries:h,fractionDigits:i}}};AngleNumberAxis.className="AngleNumberAxis",AngleNumberAxis.type="angle-number",__decorateClass([Property5],AngleNumberAxis.prototype,"min",2),__decorateClass([Property5],AngleNumberAxis.prototype,"max",2),__decorateClass([Property5],AngleNumberAxis.prototype,"interval",2);var import_ag_charts_community8=require("ag-charts-community"),{OrdinalTimeScale,Property:Property6,TimeAxisParentLevel,lowestGranularityUnitForTicks,lowestGranularityUnitForValue,minimumTimeAxisDatumGranularity,dateTruncationForDomain,intervalUnit,intervalStep,intervalEpoch,intervalMilliseconds}=import_ag_charts_community8._ModuleSupport,OrdinalTimeAxis=class extends import_ag_charts_community8._ModuleSupport.DiscreteTimeAxis{constructor(e){super(e,new OrdinalTimeScale),this.parentLevel=new TimeAxisParentLevel}get primaryLabel(){return this.parentLevel.enabled?this.parentLevel.label:void 0}get primaryTick(){return this.parentLevel.enabled?this.parentLevel.tick:void 0}processData(){super.processData();const{boundSeries:e,direction:t}=this;this.minimumTimeGranularity=minimumTimeAxisDatumGranularity(e,t,void 0,void 0)}tickFormatParams(e,t,i,s){s??(s=lowestGranularityUnitForTicks(t));const a=dateTruncationForDomain(e),o=intervalUnit(s),r=intervalStep(s),n=intervalEpoch(s);return{type:"date",unit:o,step:r,epoch:n,truncateDate:a}}datumFormatParams(e,t,i,s,a){if(typeof e=="number"&&(e=new Date(e)),s==null){const{minimumTimeGranularity:y}=this,f=lowestGranularityUnitForValue(e);y!=null&&intervalMilliseconds(y)=this.axisInnerRadius&&s<=this.axisOuterRadius),this.rangeGroup.visible=e,this.lineGroup.visible=e,this.labelGroup.visible=e,this.updatePolygonNode(e),this.updateSectorNode(e),this.updateLabelNode(e),this.assignCrossLineGroup(this.type==="range",this.crossLineRange)}updateRadii(){const{range:e,scale:t,type:i,axisInnerRadius:s,axisOuterRadius:a}=this;if(!t)return{innerRadius:0,outerRadius:0};const o=l=>a+s-l;let r,n;if(i==="line")r=o(t.convert(this.value)),n=r;else{const l=Math.abs(t?.bandwidth??0),c=e.map(h=>t.convert(h));r=o(Math.max(...c)),n=o(Math.min(...c))+l}this.outerRadius=r,this.innerRadius=n}drawPolygon(e,t,i){for(const[s,a]of t.entries()){const o=e*Math.cos(a),r=e*Math.sin(a);s===0?i.path.moveTo(o,r):i.path.lineTo(o,r)}i.path.closePath()}updatePolygonNode(e){const{gridAngles:t,polygonNode:i,scale:s,shape:a,type:o,innerRadius:r,outerRadius:n}=this;if(!e||a!=="polygon"||!s||!t){i.visible=!1;return}i.visible=!0;const l=this.getPadding();i.path.clear(!0),this.drawPolygon(n-l,t,i);const c=t.slice().reverse(),h=o==="line"?n-l:r+l;this.drawPolygon(h,c,i),this.setSectorNodeProps(i)}updateSectorNode(e){const{axisInnerRadius:t,axisOuterRadius:i,scale:s,sectorNode:a,shape:o,innerRadius:r,outerRadius:n}=this;if(!e||o!=="circle"||!s){a.visible=!1;return}a.visible=!0,a.startAngle=0,a.endAngle=2*Math.PI;const l=this.getPadding(),c=(0,import_ag_charts_core7.clamp)(t,r+l,i),h=(0,import_ag_charts_core7.clamp)(t,n-l,i);a.innerRadius=Math.min(c,h),a.outerRadius=Math.max(c,h),this.setSectorNodeProps(a)}updateLabelNode(e){const{innerRadius:t,label:i,labelNode:s,scale:a,shape:o,type:r}=this;if(!e||i.enabled===!1||!i.text||!a){s.visible=!1;return}const n=normalizeAngle360FromDegrees((i.positionAngle??0)-90),l=((0,import_ag_charts_core7.isNumberEqual)(n,0)||n>0)&&nthis.tickFormatter(...S),domain:e,range:r,reverse:n,niceMode:t,visibleRange:s,defaultTickMinSpacing:l,labelOffset:o,sideFlag:a,axisRotation:0,sizeLimit:void 0,primaryTickCount:void 0}),{tickData:h}=c,{ticks:p,rawTicks:u,rawTickCount:g,tickDomain:d,fractionDigits:m,niceDomain:y=e}=h,f=p.map(S=>this.getTickLabelProps(S,c));return this.generatedTicks={ticks:p,labels:f},{ticks:u,tickDomain:d,niceDomain:y,rawTickCount:g,fractionDigits:m,timeInterval:void 0}}updateSelections(){const{generatedTicks:e}=this;if(!e)return;const{ticks:t,labels:i}=e;this.gridLineGroupSelection.update(this.gridLength?t:[]),this.tickLabelGroupSelection.update(i),this.gridPathSelection.update(this.gridLine.enabled?this.prepareGridPathTickData(t):[]),this.gridLineGroupSelection.cleanup(),this.tickLabelGroupSelection.cleanup(),this.gridPathSelection.cleanup()}updateLabels(){if(!this.label.enabled)return;const e=import_ag_charts_community10._ModuleSupport.resetAxisLabelSelectionFn();this.tickLabelGroupSelection.each((t,i)=>{t.fill=i.color,t.text=i.text,t.textBaseline=i.textBaseline,t.textAlign=i.textAlign??"center",t.setFont(i),t.setBoxing(i),t.setProperties(e(t,i))})}updateGridLines(){const{gridLine:{style:e,width:t},shape:i,generatedTicks:s}=this;if(!e||!s)return;const a=e.length,o=(u,g)=>{const{stroke:d,lineDash:m}=e[g%a];u.stroke=d,u.strokeWidth=t,u.lineDash=m,u.fill=void 0},[r,n]=this.gridRange??[0,2*Math.PI],l=(0,import_ag_charts_core8.isNumberEqual)(n-r,2*Math.PI),p=i==="circle"?(u,g)=>{const{path:d}=u;d.clear(!0);const m=this.getTickRadius(g);l?(d.moveTo(m,0),d.arc(0,0,m,0,2*Math.PI)):(d.moveTo(m*Math.cos(r),m*Math.sin(r)),d.arc(0,0,m,normalizeAngle3603(r),normalizeAngle3603(n))),l&&d.closePath()}:(u,g)=>{const{path:d}=u,m=this.gridAngles;if(d.clear(!0),!m||m.length<3)return;const y=this.getTickRadius(g);for(const[f,S]of m.entries()){const b=y*Math.cos(S),x=y*Math.sin(S);f===0?d.moveTo(b,x):d.lineTo(b,x);for(const[v,_]of m.entries()){const D=y*Math.cos(_),k=y*Math.sin(_);v===0?d.moveTo(D,k):d.lineTo(D,k)}d.closePath()}d.closePath()};this.gridPathSelection.each((u,g,d)=>{o(u,d),p(u,g)})}updateTitle(){const e=r=>r.defaultValue,{title:t,range:i}=this,{formatter:s=e}=this.title;t.caption.enabled=t.enabled,t.caption.fontFamily=t.fontFamily,t.caption.fontSize=t.fontSize,t.caption.fontStyle=t.fontStyle,t.caption.fontWeight=t.fontWeight,t.caption.color=t.color,t.caption.wrapping=t.wrapping;let a=!1;const o=t.caption.node;t.enabled&&(a=!0,o.rotation=Math.PI/2,o.x=Math.floor((i[0]+i[1])/2),o.y=-Caption.SMALL_PADDING,o.textAlign="center",o.textBaseline="bottom",o.text=this.cachedCallWithContext(s,this.getTitleFormatterParams(this.scale.domain))),o.visible=a}updateCrossLines(){for(const e of this.crossLines)if(e instanceof RadiusCrossLine){const{shape:t,gridAngles:i,range:s,innerRadiusRatio:a}=this,o=s[0];e.shape=t,e.gridAngles=i,e.axisOuterRadius=o,e.axisInnerRadius=o*a}super.updateCrossLines()}createLabel(){return new RadiusAxisLabel}getTickLabelProps(e,t){const{label:i}=this,{rotation:s,textBaseline:a,textAlign:o}=t,r=this.scale.range,n=e.tickLabel??"",c=i.getSideFlag()*(this.getTickSize()+i.spacing+this.seriesAreaPadding),h=n!==""&&n!=null,p=s;return{...this.getLabelStyles({value:e.tick,formattedValue:e.tickLabel}),tickId:e.tickId,rotation:p,text:n,textAlign:o,textBaseline:a,visible:h,x:c,y:e.translation,rotationCenterX:c,rotationCenterY:e.translation,range:r}}};RadiusAxis.CrossLineConstructor=RadiusCrossLine,__decorateClass([Property8],RadiusAxis.prototype,"positionAngle",2);var{ProxyPropertyOnWrite,Property:Property9,CategoryScale:CategoryScale2}=import_ag_charts_community11._ModuleSupport,RadiusCategoryAxis=class extends RadiusAxis{constructor(e){super(e,new CategoryScale2),this.shape="circle",this.groupPaddingInner=0,this.paddingInner=0,this.paddingOuter=0}hasDefinedDomain(){return!1}normaliseDataDomain(e){return{domain:e,clipped:!1}}prepareGridPathTickData(e){return e.slice().reverse()}getTickRadius(e){const{scale:t,innerRadiusRatio:i}=this,s=t.range[0],a=s*i;if(CategoryScale2.is(t)){const o=t.domain,r=o.length-1-o.indexOf(e.tick);return r===0?a:t.inset+t.step*(r-.5)+t.bandwidth/2}else{const o=(s-a)/t.domain.length;return s-e.translation+a-o/2}}tickFormatParams(){return{type:"category"}}datumFormatParams(e,t){const{datum:i,seriesId:s,legendItemName:a,key:o,source:r,property:n,domain:l,boundSeries:c}=t;return{type:"category",value:e,datum:i,seriesId:s,legendItemName:a,key:o,source:r,property:n,domain:l,boundSeries:c}}};RadiusCategoryAxis.className="RadiusCategoryAxis",RadiusCategoryAxis.type="radius-category",__decorateClass([Property9],RadiusCategoryAxis.prototype,"groupPaddingInner",2),__decorateClass([ProxyPropertyOnWrite("scale","paddingInner"),Property9],RadiusCategoryAxis.prototype,"paddingInner",2),__decorateClass([ProxyPropertyOnWrite("scale","paddingOuter"),Property9],RadiusCategoryAxis.prototype,"paddingOuter",2);var import_ag_charts_community12=require("ag-charts-community"),{Property:Property10,normalisedExtentWithMetadata:normalisedExtentWithMetadata2,LinearScale:LinearScale2}=import_ag_charts_community12._ModuleSupport,RadiusNumberAxis=class extends RadiusAxis{constructor(e){super(e,new LinearScale2),this.shape="polygon"}hasDefinedDomain(){const{min:e,max:t}=this;return e!=null&&t!=null&&es!==i).sort((s,a)=>a.tick-s.tick)}getTickRadius(e){const{scale:t}=this,i=t.range[0],s=i*this.innerRadiusRatio;return i-e.translation+s}normaliseDataDomain(e){const{min:t,max:i}=this,{extent:s,clipped:a}=normalisedExtentWithMetadata2(e,t,i);return{domain:s,clipped:a}}tickFormatParams(e,t,i){return{type:"number",fractionDigits:i}}datumFormatParams(e,t,i){const{datum:s,seriesId:a,legendItemName:o,key:r,source:n,property:l,domain:c,boundSeries:h}=t;return{type:"number",value:e,datum:s,seriesId:a,legendItemName:o,key:r,source:n,property:l,domain:c,boundSeries:h,fractionDigits:i}}};RadiusNumberAxis.className="RadiusNumberAxis",RadiusNumberAxis.type="radius-number",__decorateClass([Property10],RadiusNumberAxis.prototype,"min",2),__decorateClass([Property10],RadiusNumberAxis.prototype,"max",2);var{ordinalTimeAxisOptionsDefs,angleNumberAxisOptionsDefs,angleCategoryAxisOptionsDefs,radiusNumberAxisOptionsDefs,radiusCategoryAxisOptionsDefs}=import_ag_charts_community13._ModuleSupport,OrdinalTimeAxisModule={type:"axis",name:"ordinal-time",chartType:"cartesian",enterprise:!0,options:ordinalTimeAxisOptionsDefs,create:e=>new OrdinalTimeAxis(e)},AngleNumberAxisModule={type:"axis",name:"angle-number",chartType:"polar",enterprise:!0,options:angleNumberAxisOptionsDefs,create:e=>new AngleNumberAxis(e)},AngleCategoryAxisModule={type:"axis",name:"angle-category",chartType:"polar",enterprise:!0,options:angleCategoryAxisOptionsDefs,create:e=>new AngleCategoryAxis(e)},RadiusNumberAxisModule={type:"axis",name:"radius-number",chartType:"polar",enterprise:!0,options:radiusNumberAxisOptionsDefs,create:e=>new RadiusNumberAxis(e)},RadiusCategoryAxisModule={type:"axis",name:"radius-category",chartType:"polar",enterprise:!0,options:radiusCategoryAxisOptionsDefs,create:e=>new RadiusCategoryAxis(e)},import_ag_charts_community15=require("ag-charts-community"),import_ag_charts_community14=require("ag-charts-community"),{Chart}=import_ag_charts_community14._ModuleSupport,StandaloneChart=class extends Chart{getChartType(){return"standalone"}performLayout(e){const{seriesRoot:t,annotationRoot:i}=this,{layoutBox:s}=e,a=s.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=a,this.animationRect=a;for(const o of[t,i])o.translationX=Math.floor(a.x),o.translationY=Math.floor(a.y);t.visible=this.series[0].visible,this.ctx.layoutManager.emitLayoutComplete(e,{series:{visible:!0,rect:a,paddedRect:s}})}getAriaLabel(){const e=this.series[0]?.type;if(e==null)return"";const t=this.getCaptionText();switch(e){case"radial-gauge":case"linear-gauge":{const i=[];t.length!==0&&i.push(t);for(const s of this.series)i.push(s.getCaptionText());return this.ctx.localeManager.t("ariaAnnounceGaugeChart",{caption:i.join(". ")})}case"treemap":case"sunburst":return this.ctx.localeManager.t("ariaAnnounceHierarchyChart",{caption:t});default:return this.ctx.localeManager.t("ariaAnnounceStandaloneChart",{caption:t})}}};StandaloneChart.className="StandaloneChart",StandaloneChart.type="standalone";var{isAgStandaloneChartOptions,standaloneChartOptionsDefs}=import_ag_charts_community15._ModuleSupport,StandaloneChartModule={type:"chart",name:"standalone",enterprise:!0,options:standaloneChartOptionsDefs,detect:isAgStandaloneChartOptions,create(e,t){return new StandaloneChart(e,t)}},import_ag_charts_community17=require("ag-charts-community"),import_ag_charts_community16=require("ag-charts-community"),{Chart:Chart2,MercatorScale,ChartAxisDirection:ChartAxisDirection6,Property:Property11}=import_ag_charts_community16._ModuleSupport;function isTopologySeries(e){return e.type==="map-shape"||e.type==="map-line"||e.type==="map-marker"||e.type==="map-shape-background"||e.type==="map-line-background"}var TopologyChart=class extends Chart2{constructor(e,t){super(e,t),this.ctx.zoomManager.updateAxes([ChartAxisDirection6.X,ChartAxisDirection6.Y])}getChartType(){return"topology"}async updateData(){await super.updateData();const e=this.getOptions();this.topology!==e.topology&&(this.topology=e.topology);const{topology:t}=this;for(const i of this.series)isTopologySeries(i)&&i.setChartTopology(t)}performLayout(e){const{seriesRoot:t,annotationRoot:i}=this,{layoutBox:s}=e,a=s.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=a,this.animationRect=a;const o=this.series.filter(isTopologySeries),r=o.reduce((c,h)=>{if(!h.visible)return c;const p=h.topologyBounds;return p==null?c:c==null?p:c.merge(p)},void 0);let n;if(r!=null){const{lon0:c,lat0:h,lon1:p,lat1:u}=r,g=[[c,h],[p,u]],d=MercatorScale.bounds(g),{width:m,height:y}=a,f=Math.min(m/d.width,y/d.height),S=d.width*f,b=d.height*f,x=(m-S)/2,v=(y-b)/2,_=x,D=v,k=x+S,A=v+b,L=this.ctx.zoomManager.getAxisZoom(ChartAxisDirection6.X),R=this.ctx.zoomManager.getAxisZoom(ChartAxisDirection6.Y),O=(k-_)/(L.max-L.min),B=_-O*L.min,C=(A-D)/(1-R.min-(1-R.max)),w=D-C*(1-R.max);n=new MercatorScale(g,[[B,w],[B+O,w+C]])}for(const c of o)c.scale=n;const l=this.series.some(c=>c.visible);t.visible=l;for(const c of[t,i])c.translationX=Math.floor(a.x),c.translationY=Math.floor(a.y),c.setClipRect(a.clone());this.ctx.layoutManager.emitLayoutComplete(e,{series:{visible:l,rect:a,paddedRect:s}})}};TopologyChart.className="TopologyChart",TopologyChart.type="topology",__decorateClass([Property11],TopologyChart.prototype,"topology",2);var{isAgTopologyChartOptions,topologyChartOptionsDefs}=import_ag_charts_community17._ModuleSupport,TopologyChartModule={type:"chart",name:"topology",enterprise:!0,options:topologyChartOptionsDefs,detect:isAgTopologyChartOptions,create(e,t){return new TopologyChart(e,t)}},import_ag_charts_community64=require("ag-charts-community"),import_ag_charts_community18=require("ag-charts-community"),import_ag_charts_core9=require("ag-charts-core"),{annotationCalloutStylesDefs,annotationNoteStylesDefs,annotationTextStylesDef,annotationCommentStylesDefs,annotationMeasurerStylesDefs,annotationQuickMeasurerStylesDefs,annotationShapeStylesDefs,annotationChannelTextDefs,annotationCrossLineStyleDefs,annotationFibonacciStylesDefs,annotationLineStyleDefs,annotationLineTextDefs,annotationDisjointChannelStyleDefs,annotationParallelChannelStyleDefs}=import_ag_charts_community18._ModuleSupport,serializableDate=(0,import_ag_charts_core9.optionsDefs)({__type:(0,import_ag_charts_core9.required)((0,import_ag_charts_core9.constant)("date")),value:(0,import_ag_charts_core9.or)(import_ag_charts_core9.string,import_ag_charts_core9.number)},"a serializable date object"),xValue=(0,import_ag_charts_core9.or)(import_ag_charts_core9.string,import_ag_charts_core9.number,serializableDate),annotationValue=(0,import_ag_charts_core9.or)(xValue,(0,import_ag_charts_core9.optionsDefs)({value:xValue,groupPercentage:(0,import_ag_charts_core9.numberRange)(-1,2)})),channelAnnotationTextOptionsDef={...annotationChannelTextDefs,label:import_ag_charts_core9.string},lineAnnotationTextOptionsDef={...annotationLineTextDefs,label:import_ag_charts_core9.string},annotationPointOptionsDef={x:annotationValue,y:import_ag_charts_core9.number},annotationInitialStateOptionsDef=(0,import_ag_charts_core9.typeUnion)({line:{...annotationLineStyleDefs,start:annotationPointOptionsDef,end:annotationPointOptionsDef,text:lineAnnotationTextOptionsDef},"horizontal-line":{...annotationCrossLineStyleDefs,value:annotationValue,text:lineAnnotationTextOptionsDef},"vertical-line":{...annotationCrossLineStyleDefs,value:annotationValue,text:lineAnnotationTextOptionsDef},"disjoint-channel":{...annotationDisjointChannelStyleDefs,startHeight:import_ag_charts_core9.number,endHeight:import_ag_charts_core9.number,start:annotationPointOptionsDef,end:annotationPointOptionsDef,text:channelAnnotationTextOptionsDef},"parallel-channel":{...annotationParallelChannelStyleDefs,height:import_ag_charts_core9.number,start:annotationPointOptionsDef,end:annotationPointOptionsDef,text:channelAnnotationTextOptionsDef},"fibonacci-retracement":{...annotationFibonacciStylesDefs,start:annotationPointOptionsDef,end:annotationPointOptionsDef,text:lineAnnotationTextOptionsDef,reverse:import_ag_charts_core9.boolean},"fibonacci-retracement-trend-based":{...annotationFibonacciStylesDefs,start:annotationPointOptionsDef,end:annotationPointOptionsDef,endRetracement:annotationPointOptionsDef,text:lineAnnotationTextOptionsDef,reverse:import_ag_charts_core9.boolean},callout:{...annotationCalloutStylesDefs,start:annotationPointOptionsDef,end:annotationPointOptionsDef,text:import_ag_charts_core9.string},comment:{...annotationCommentStylesDefs,...annotationPointOptionsDef,text:import_ag_charts_core9.string},note:{...annotationNoteStylesDefs,...annotationPointOptionsDef,text:import_ag_charts_core9.string},text:{...annotationTextStylesDef,...annotationPointOptionsDef,text:import_ag_charts_core9.string},arrow:{...annotationLineStyleDefs,text:lineAnnotationTextOptionsDef,start:annotationPointOptionsDef,end:annotationPointOptionsDef},"arrow-up":{...annotationShapeStylesDefs,...annotationPointOptionsDef},"arrow-down":{...annotationShapeStylesDefs,...annotationPointOptionsDef},"date-range":{...annotationMeasurerStylesDefs,extendAbove:import_ag_charts_core9.boolean,extendBelow:import_ag_charts_core9.boolean,text:lineAnnotationTextOptionsDef,start:annotationPointOptionsDef,end:annotationPointOptionsDef},"price-range":{...annotationMeasurerStylesDefs,extendLeft:import_ag_charts_core9.boolean,extendRight:import_ag_charts_core9.boolean,text:lineAnnotationTextOptionsDef,start:annotationPointOptionsDef,end:annotationPointOptionsDef},"date-price-range":{...annotationMeasurerStylesDefs,text:lineAnnotationTextOptionsDef,start:annotationPointOptionsDef,end:annotationPointOptionsDef},"quick-date-price-range":{...annotationMeasurerStylesDefs,...annotationQuickMeasurerStylesDefs,text:lineAnnotationTextOptionsDef,start:annotationPointOptionsDef,end:annotationPointOptionsDef}},"an annotation initial state object"),initialStateOptionsDef={chartType:(0,import_ag_charts_core9.union)("candlestick","hollow-candlestick","ohlc","line","step-line","hlc","high-low"),annotations:(0,import_ag_charts_core9.arrayOfDefs)(annotationInitialStateOptionsDef),legend:(0,import_ag_charts_core9.arrayOfDefs)({visible:import_ag_charts_core9.boolean,seriesId:import_ag_charts_core9.string,itemId:import_ag_charts_core9.string,legendItemName:import_ag_charts_core9.string},"legend state array"),zoom:{rangeX:{start:(0,import_ag_charts_core9.or)(import_ag_charts_core9.number,serializableDate),end:(0,import_ag_charts_core9.or)(import_ag_charts_core9.number,serializableDate)},rangeY:{start:(0,import_ag_charts_core9.or)(import_ag_charts_core9.number,serializableDate),end:(0,import_ag_charts_core9.or)(import_ag_charts_core9.number,serializableDate)},ratioX:{start:(0,import_ag_charts_core9.and)(import_ag_charts_core9.ratio,(0,import_ag_charts_core9.lessThan)("end")),end:(0,import_ag_charts_core9.and)(import_ag_charts_core9.ratio,(0,import_ag_charts_core9.greaterThan)("start"))},ratioY:{start:(0,import_ag_charts_core9.and)(import_ag_charts_core9.ratio,(0,import_ag_charts_core9.lessThan)("end")),end:(0,import_ag_charts_core9.and)(import_ag_charts_core9.ratio,(0,import_ag_charts_core9.greaterThan)("start"))},autoScaledAxes:(0,import_ag_charts_core9.arrayOf)((0,import_ag_charts_core9.constant)("y"))}},import_ag_charts_community63=require("ag-charts-community"),import_ag_charts_core20=require("ag-charts-core"),import_ag_charts_community24=require("ag-charts-community"),import_ag_charts_community21=require("ag-charts-community");function prepareBoxPlotFromTo(e){return{from:e?{scalingX:1,scalingY:0}:{scalingX:0,scalingY:1},to:{scalingX:1,scalingY:1}}}function resetBoxPlotSelectionsScalingCenterFn(e){return(t,i)=>e?{scalingCenterY:i.scaledValues.medianValue}:{scalingCenterX:i.scaledValues.medianValue}}var import_ag_charts_community19=require("ag-charts-community"),{Path:Path5,Scalable,ExtendedPath2D,SceneChangeDetection,SceneArrayChangeDetection,BBox:BBox2,clippedRoundRect:baseClippedRoundRect}=import_ag_charts_community19._ModuleSupport,BoxPlotNode=class extends Scalable(Path5){constructor(){super(...arguments),this.wickPath=new ExtendedPath2D,this.horizontal=!1,this.center=0,this.thickness=0,this.min=0,this.q1=0,this.median=0,this.q3=0,this.max=0,this.cornerRadius=0,this.crisp=!1,this.strokeAlignment=0,this.wickStroke=void 0,this.wickStrokeWidth=void 0,this.wickStrokeOpacity=void 0,this.capLengthRatio=1,this.wickStrokeAlignment=0}computeBBox(){const{horizontal:e,center:t,thickness:i,min:s,max:a}=this;return e?new BBox2(Math.min(s,a),t-i/2,Math.abs(a-s),i):new BBox2(t-i/2,Math.min(s,a),i,Math.abs(a-s))}computeDefaultGradientFillBBox(){const{horizontal:e,center:t,thickness:i,q1:s,q3:a}=this;return e?new BBox2(Math.min(s,a),t-i/2,Math.abs(a-s),i):new BBox2(t-i/2,Math.min(s,a),i,Math.abs(a-s))}isPointInPath(e,t){return this.getBBox().containsPoint(e,t)}distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}get midPoint(){return this.horizontal?{x:(this.min+this.max)/2,y:this.center}:{x:this.center,y:(this.min+this.max)/2}}alignedCoordinates(){const{thickness:e,crisp:t}=this;let{center:i,min:s,q1:a,median:o,q3:r,max:n}=this,l=i-e/2,c=i+e/2;if(t&&e>1){s=this.align(s),a=this.align(a),o=this.align(o),r=this.align(r),n=s+this.align(s,n-s);const h=this.align(e/2);i=this.align(i),l=i-h,c=i+h}return{center:i,x0:l,x1:c,min:s,max:n,q1:a,median:o,q3:r}}updatePath(){const{path:e,stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:a,lineDashOffset:o,wickStroke:r,wickStrokeWidth:n,wickStrokeOpacity:l,wickLineDash:c,wickLineDashOffset:h,strokeAlignment:p,cornerRadius:u,capLengthRatio:g,horizontal:d}=this,{center:m,x0:y,x1:f,min:S,max:b,q1:x,median:v,q3:_}=this.alignedCoordinates(),D=this.layerManager?.canvas.pixelRatio??1,k=this.wickStrokeAlignment>0?D/this.wickStrokeAlignment/2%1:0;this.path.clear(),this.wickPath.clear();const L=r!=null&&r!==t||n!=null&&n!==i||l!=null&&l!==s||c!=null&&c!==a||h!=null&&h!==o?this.wickPath:e;if(Math.abs(f-y)<=3){moveTo(L,d,m,S),lineTo(L,d,m,b);return}const R=Math.min(S,b),O=Math.max(S,b),B=Math.min(x,_),C=Math.max(x,_),w=m-Math.abs((f-y)*g)/2,M=m+Math.abs((f-y)*g)/2;moveTo(L,d,w,R-k),lineTo(L,d,M,R-k),moveTo(L,d,m-k,R-k),lineTo(L,d,m-k,B+i/2),moveTo(L,d,m-k,O+k),lineTo(L,d,m-k,C-i/2),moveTo(L,d,w,O+k),lineTo(L,d,M,O+k);const T=i/2+p,N=i/2-p,I=C-B-2*N;if(I>0){const P=y+T,F=B+N,E=f-y-2*T,G={topLeft:u,topRight:u,bottomRight:u,bottomLeft:u};clippedRoundRect(e,d,P,F,E,I,G,new BBox2(P,F,E,v-F)),clippedRoundRect(e,d,P,F,E,I,G,new BBox2(P,v,E,F+I-v))}else{const P=(B+C)/2;moveTo(e,d,y,P),lineTo(e,d,f,P)}}drawPath(e){super.drawPath(e);const{wickPath:t}=this;if(t.isEmpty())return;const{stroke:i,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r,wickStroke:n=i,wickStrokeWidth:l=s,wickStrokeOpacity:c=a,wickLineDash:h=o,wickLineDashOffset:p=r}=this;l!==0&&(e.globalAlpha*=c,typeof n=="string"&&(e.strokeStyle=n),e.lineWidth=l,h!=null&&e.setLineDash([...h]),e.lineDashOffset=p,e.stroke(t.getPath2D()))}};__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"horizontal",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"center",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"thickness",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"min",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"q1",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"median",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"q3",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"max",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"cornerRadius",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"crisp",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"strokeAlignment",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"wickStroke",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"wickStrokeWidth",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"wickStrokeOpacity",2),__decorateClass([SceneArrayChangeDetection()],BoxPlotNode.prototype,"wickLineDash",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"wickLineDashOffset",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"capLengthRatio",2),__decorateClass([SceneChangeDetection()],BoxPlotNode.prototype,"wickStrokeAlignment",2);function moveTo(e,t,i,s){t?e.moveTo(s,i):e.moveTo(i,s)}function lineTo(e,t,i,s){t?e.lineTo(s,i):e.lineTo(i,s)}function clippedRoundRect(e,t,i,s,a,o,r,n){t?baseClippedRoundRect(e,s,i,o,a,r,n==null?void 0:new BBox2(n.y,n.x,n.height,n.width)):baseClippedRoundRect(e,i,s,a,o,r,n)}var import_ag_charts_community20=require("ag-charts-community"),{BaseProperties:BaseProperties2,AbstractBarSeriesProperties,makeSeriesTooltip,Property:Property12,mergeDefaults}=import_ag_charts_community20._ModuleSupport,BoxPlotSeriesCap=class extends BaseProperties2{constructor(){super(...arguments),this.lengthRatio=.5}};__decorateClass([Property12],BoxPlotSeriesCap.prototype,"lengthRatio",2);var BoxPlotSeriesWhisker=class extends BaseProperties2{};__decorateClass([Property12],BoxPlotSeriesWhisker.prototype,"stroke",2),__decorateClass([Property12],BoxPlotSeriesWhisker.prototype,"strokeWidth",2),__decorateClass([Property12],BoxPlotSeriesWhisker.prototype,"strokeOpacity",2),__decorateClass([Property12],BoxPlotSeriesWhisker.prototype,"lineDash",2),__decorateClass([Property12],BoxPlotSeriesWhisker.prototype,"lineDashOffset",2);var BoxPlotSeriesProperties=class extends AbstractBarSeriesProperties{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.cap=new BoxPlotSeriesCap,this.whisker=new BoxPlotSeriesWhisker,this.tooltip=makeSeriesTooltip()}toJson(){const{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:s,lineDashOffset:a}=this,o=super.toJson();return o.whisker=mergeDefaults(o.whisker,{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:s,lineDashOffset:a}),o}};__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"xKey",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"minKey",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"q1Key",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"medianKey",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"q3Key",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"maxKey",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"xName",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"yName",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"minName",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"q1Name",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"medianName",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"q3Name",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"maxName",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"fill",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"stroke",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"lineDash",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"styler",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"cap",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"whisker",2),__decorateClass([Property12],BoxPlotSeriesProperties.prototype,"tooltip",2);var{fixNumericExtent,keyProperty,mergeDefaults:mergeDefaults2,SeriesNodePickMode,SMALLEST_KEY_INTERVAL,valueProperty,diff,animationValidation,computeBarFocusBounds,createDatumId,HighlightState,ContinuousScale:ContinuousScale2,ChartAxisDirection:ChartAxisDirection7,motion,getItemStyles,applyShapeFillBBox,calculateSegments,toHighlightString}=import_ag_charts_community21._ModuleSupport,BoxPlotSeriesNodeEvent=class extends import_ag_charts_community21._ModuleSupport.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.minKey=s.properties.minKey,this.q1Key=s.properties.q1Key,this.medianKey=s.properties.medianKey,this.q3Key=s.properties.q3Key,this.maxKey=s.properties.maxKey}},BoxPlotSeries=class extends import_ag_charts_community21._ModuleSupport.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[SeriesNodePickMode.NEAREST_NODE,SeriesNodePickMode.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["medianKey","q1Key","q3Key","minKey","maxKey"]},propertyNames:{x:["xName"],y:["medianName","q1Name","q3Name","minName","maxName"]},categoryKey:"xValue",pathsPerSeries:[]}),this.properties=new BoxPlotSeriesProperties,this.NodeEvent=BoxPlotSeriesNodeEvent}async processData(e){if(!this.visible)return;const{xKey:t,minKey:i,q1Key:s,medianKey:a,q3Key:o,maxKey:r}=this.properties,n=!this.ctx.animationManager.isSkipped(),l=this.getCategoryAxis()?.scale,c=this.getValueAxis()?.scale,{isContinuousX:h,xScaleType:p,yScaleType:u}=this.getScaleInformation({xScale:l,yScale:c}),g=[];n&&this.processedData&&g.push(diff(this.id,this.processedData)),n&&g.push(animationValidation());const{processedData:d}=await this.requestDataModel(e,this.data,{props:[keyProperty(t,p,{id:"xValue"}),valueProperty(i,u,{id:"minValue"}),valueProperty(s,u,{id:"q1Value"}),valueProperty(a,u,{id:"medianValue"}),valueProperty(o,u,{id:"q3Value"}),valueProperty(r,u,{id:"maxValue"}),...h?[SMALLEST_KEY_INTERVAL]:[],...g]});this.smallestDataInterval=d.reduced?.smallestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];if(e!==this.getBarDirection()){const{index:a,def:o}=i.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[a];return o.type==="key"&&o.valueType==="category"?r:this.padBandExtent(r)}const s=this.domainForClippedRange(e,["minValue","maxValue"],"xValue");return fixNumericExtent(s)}getSeriesRange(e,t){return this.domainForVisibleRange(ChartAxisDirection7.Y,["maxValue","minValue"],"xValue",t)}createNodeData(){const{visible:e,dataModel:t,processedData:i}=this,s=this.getCategoryAxis(),a=this.getValueAxis();if(!(t&&i&&s&&a))return;const{xKey:o}=this.properties,r=[],n=t.resolveKeysById(this,"xValue",i),l=t.resolveColumnById(this,"minValue",i),c=t.resolveColumnById(this,"q1Value",i),h=t.resolveColumnById(this,"medianValue",i),p=t.resolveColumnById(this,"q3Value",i),u=t.resolveColumnById(this,"maxValue",i),{barWidth:g,groupIndex:d}=this.updateGroupScale(s),m=ContinuousScale2.is(s.scale)?g*-.5:0,{groupScale:y}=this,f=this.isVertical(),S=calculateSegments(this.properties.segmentation,s,a,this.chart.seriesRect,this.ctx.scene),b={itemId:o,nodeData:r,labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:getItemStyles(this.getItemStyle.bind(this)),segments:S};if(!e)return b;const x=i.dataSources.get(this.id)?.data??[];for(const[v,_]of x.entries()){const D=n[v];if(D==null)continue;const k=l[v],A=c[v],L=h[v],R=p[v],O=u[v];if([k,A,L,R,O].some(P=>typeof P!="number")||k>A||A>L||L>R||R>O)continue;const B={xValue:s.scale.convert(D),minValue:a.scale.convert(k),q1Value:a.scale.convert(A),medianValue:a.scale.convert(L),q3Value:a.scale.convert(R),maxValue:a.scale.convert(O)},C=g;B.xValue+=y.convert(String(d))+m+C/2;const w=Math.abs(B.q3Value-B.q1Value),M=B.xValue,T=Math.min(B.q3Value,B.q1Value)+w/2,N={x:f?M:T,y:f?T:M};let I;f?I={x:N.x-C/2,y:B.minValue,width:C,height:B.maxValue-B.minValue}:I={x:B.minValue,y:N.y-C/2,width:B.maxValue-B.minValue,height:C},r.push({series:this,itemId:D,datum:_,datumIndex:v,xKey:o,bandwidth:C,scaledValues:B,midPoint:N,focusRect:I})}return b}legendItemSymbol(){const{fill:e,stroke:t,strokeWidth:i,fillOpacity:s,strokeOpacity:a,lineDash:o,lineDashOffset:r}=this.getStyle(!1,!1,HighlightState.None);return{marker:{fill:import_ag_charts_community21._ModuleSupport.deepClone(e),fillOpacity:s,stroke:t,strokeOpacity:a,strokeWidth:i,lineDash:o,lineDashOffset:r}}}getLegendData(e){const{id:t,ctx:{legendManager:i},visible:s}=this,{xKey:a,yName:o,showInLegend:r,legendItemName:n}=this.properties;return!a||e!=="category"?[]:[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:s&&i.getItemEnabled({seriesId:t,itemId:t}),label:{text:n??o??t},symbol:this.legendItemSymbol(),legendItemName:n,hideInLegend:!r}]}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:a}=this,{xKey:o,xName:r,yName:n,medianKey:l,medianName:c,q1Key:h,q1Name:p,q3Key:u,q3Name:g,minKey:d,minName:m,maxKey:y,maxName:f,legendItemName:S,tooltip:b}=a,x=this.getCategoryAxis(),v=this.getValueAxis();if(!i||!s||!x||!v)return;const _=s.dataSources.get(this.id)?.data[e],D=i.resolveKeysById(this,"xValue",s)[e],k=i.resolveColumnById(this,"minValue",s)[e],A=i.resolveColumnById(this,"q1Value",s)[e],L=i.resolveColumnById(this,"medianValue",s)[e],R=i.resolveColumnById(this,"q3Value",s)[e],O=i.resolveColumnById(this,"maxValue",s)[e];if(D==null)return;const B=this.getItemStyle(e,!1),C=[{label:m,fallbackLabel:d,value:this.getAxisValueText(v,"tooltip",k,_,d,S)},{label:p,fallbackLabel:h,value:this.getAxisValueText(v,"tooltip",A,_,h,S)},{label:c,fallbackLabel:l,value:this.getAxisValueText(v,"tooltip",L,_,l,S)},{label:g,fallbackLabel:u,value:this.getAxisValueText(v,"tooltip",R,_,u,S)},{label:f,fallbackLabel:y,value:this.getAxisValueText(v,"tooltip",O,_,y,S)}];return this.formatTooltipWithContext(b,{heading:this.getAxisValueText(x,"tooltip",D,_,o,S),title:S??n,symbol:this.legendItemSymbol(),data:C},{seriesId:t,datum:_,title:n,xKey:o,xName:r,yName:n,medianKey:l,medianName:c,q1Key:h,q1Name:p,q3Key:u,q3Name:g,minKey:d,minName:m,maxKey:y,maxName:f,...B})}animateEmptyUpdateReady({datumSelection:e}){const t=this.isVertical(),{from:i,to:s}=prepareBoxPlotFromTo(t);motion.resetMotion([e],resetBoxPlotSelectionsScalingCenterFn(t)),motion.staticFromToMotion(this.id,"datums",this.ctx.animationManager,[e],i,s,{phase:"initial"})}isLabelEnabled(){return!1}updateDatumSelection(e){const t=e.nodeData??[];return e.datumSelection.update(t)}makeStylerParams(e,t){const{id:i}=this,{cornerRadius:s,cap:{lengthRatio:a},fill:o,fillOpacity:r,lineDash:n,lineDashOffset:l,stroke:c,strokeOpacity:h,strokeWidth:p,maxKey:u,maxName:g,medianKey:d,medianName:m,minKey:y,minName:f,q1Key:S,q1Name:b,q3Key:x,q3Name:v,whisker:{lineDash:_,lineDashOffset:D,stroke:k,strokeOpacity:A,strokeWidth:L},xKey:R,xName:O,yName:B}=this.properties,C=toHighlightString(t??HighlightState.None);return{cap:{lengthRatio:a},cornerRadius:s,fill:o,fillOpacity:r,highlightState:C,highlighted:e,lineDash:n,lineDashOffset:l,maxKey:u,maxName:g??u,medianKey:d,medianName:m??d,minKey:y,minName:f??y,q1Key:S,q1Name:b??S,q3Key:x,q3Name:v??x,seriesId:i,stroke:c,strokeOpacity:h,strokeWidth:p,whisker:{lineDash:_??n,lineDashOffset:D??l,stroke:k??c,strokeOpacity:A??h,strokeWidth:L??p},xKey:R,xName:O??R,yName:B}}getStyle(e,t,i){const{cap:s,cornerRadius:a,fill:o,fillOpacity:r,lineDash:n,lineDashOffset:l,stroke:c,strokeOpacity:h,strokeWidth:p,styler:u,whisker:g}=this.properties;let d={};if(!e&&u){const m=this.makeStylerParams(t,i);d=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(u,m)??{},{pick:!1})??{}}return{cornerRadius:d.cornerRadius??a,fill:d.fill??o,fillOpacity:d.fillOpacity??r,lineDash:d.lineDash??n,lineDashOffset:d.lineDashOffset??l,opacity:1,stroke:d.stroke??c,strokeOpacity:d.strokeOpacity??h,strokeWidth:d.strokeWidth??p,cap:{lengthRatio:d.cap?.lengthRatio??s.lengthRatio},whisker:{lineDash:d.whisker?.lineDash??g.lineDash,lineDashOffset:d.whisker?.lineDashOffset??g.lineDashOffset,stroke:d.whisker?.stroke??g.stroke,strokeOpacity:d.whisker?.strokeOpacity??g.strokeOpacity,strokeWidth:d.whisker?.strokeWidth??g.strokeWidth}}}getItemStyle(e,t,i){const{properties:s}=this,{itemStyler:a}=s,o=this.getHighlightStyle(t,e,i);let r=mergeDefaults2(o,this.getStyle(e===void 0,t,i));if(a!=null&&e!=null){const u=this.cachedDatumCallback(createDatumId(e,t?"highlight":"node"),()=>{const g=this.makeItemStylerParams(e,t,r);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(a,g))});u&&(r=mergeDefaults2(u,r))}const{stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}=r;return r.whisker=mergeDefaults2(r.whisker,{stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}),r}makeItemStylerParams(e,t,i){const{id:s}=this,{xKey:a,minKey:o,q1Key:r,medianKey:n,q3Key:l,maxKey:c}=this.properties,h=this.processedData?.dataSources.get(s)?.data[e],p=this.ctx.highlightManager?.getActiveHighlight(),u=this.getHighlightStateString(p,t,e),g=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:h,xKey:a,minKey:o,q1Key:r,medianKey:n,q3Key:l,maxKey:c,highlighted:t,highlightState:u,...i,fill:g}}updateDatumStyles({datumSelection:e,isHighlight:t}){const i=this.ctx.highlightManager.getActiveHighlight();e.each((s,a)=>{const o=this.getHighlightState(i,t,a.datumIndex);a.style=this.getItemStyle(a.datumIndex,t,o)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:s}=this;if(!i)return;const a=this.isVertical(),o=this.ctx.highlightManager.getActiveHighlight(),r=this.getShapeFillBBox(),n=this.getStyle(!1,!1,HighlightState.None).strokeWidth/2,l=s.whisker.strokeWidth??s.strokeWidth;e.each((c,h)=>{const p=h.style??i.styles[this.getHighlightState(o,t,h.datumIndex)];applyShapeFillBBox(c,p.fill,r),c.fill=p.fill,c.fillOpacity=p.fillOpacity,c.stroke=p.stroke,c.strokeWidth=p.strokeWidth,c.strokeOpacity=p.strokeOpacity,c.lineDash=p.lineDash,c.lineDashOffset=p.lineDashOffset,c.wickStroke=p.whisker.stroke,c.wickStrokeWidth=p.whisker.strokeWidth,c.wickStrokeOpacity=p.whisker.strokeOpacity,c.wickLineDash=p.whisker.lineDash,c.wickLineDashOffset=p.whisker.lineDashOffset,c.cornerRadius=p.cornerRadius,c.crisp=!0,c.horizontal=!a,c.center=h.scaledValues.xValue,c.thickness=h.bandwidth,c.min=h.scaledValues.minValue,c.q1=h.scaledValues.q1Value,c.median=h.scaledValues.medianValue,c.q3=h.scaledValues.q3Value,c.max=h.scaledValues.maxValue,c.capLengthRatio=p.cap.lengthRatio,c.strokeAlignment=n,c.wickStrokeAlignment=l})}updateLabelNodes(){}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;return i.update(t)}nodeFactory(){return new BoxPlotNode}computeFocusBounds({datumIndex:e}){return computeBarFocusBounds(this,this.contextNodeData?.nodeData[e].focusRect)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null}};BoxPlotSeries.className="BoxPlotSeries",BoxPlotSeries.type="box-plot";var import_ag_charts_community22=require("ag-charts-community"),import_ag_charts_core10=require("ag-charts-core"),{boxPlotSeriesThemeableOptionsDef,commonSeriesOptionsDefs}=import_ag_charts_community22._ModuleSupport,boxPlotSeriesOptionsDef={...commonSeriesOptionsDefs,...boxPlotSeriesThemeableOptionsDef,type:(0,import_ag_charts_core10.required)((0,import_ag_charts_core10.constant)("box-plot")),xKey:(0,import_ag_charts_core10.required)(import_ag_charts_core10.string),minKey:(0,import_ag_charts_core10.required)(import_ag_charts_core10.string),q1Key:(0,import_ag_charts_core10.required)(import_ag_charts_core10.string),medianKey:(0,import_ag_charts_core10.required)(import_ag_charts_core10.string),q3Key:(0,import_ag_charts_core10.required)(import_ag_charts_core10.string),maxKey:(0,import_ag_charts_core10.required)(import_ag_charts_core10.string),xName:import_ag_charts_core10.string,yName:import_ag_charts_core10.string,minName:import_ag_charts_core10.string,q1Name:import_ag_charts_core10.string,medianName:import_ag_charts_core10.string,q3Name:import_ag_charts_core10.string,maxName:import_ag_charts_core10.string,grouped:import_ag_charts_core10.boolean,legendItemName:import_ag_charts_core10.string,segmentation:import_ag_charts_core10.shapeSegmentation},import_ag_charts_community23=require("ag-charts-community"),{ThemeConstants:{CARTESIAN_AXIS_TYPE},multiSeriesHighlightStyle,FILL_GRADIENT_LINEAR_DEFAULTS,FILL_IMAGE_DEFAULTS,FILL_PATTERN_DEFAULTS,SAFE_FILL_OPERATION,SEGMENTATION_DEFAULTS}=import_ag_charts_community23._ModuleSupport,BOX_PLOT_SERIES_THEME={series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$if:[{$or:[{$isGradient:{$palette:"fill"}},{$isPattern:{$palette:"fill"}},{$isImage:{$palette:"fill"}}]},{$palette:"fill"},{$mix:[SAFE_FILL_OPERATION,{$ref:"chartBackgroundColor"},.7]}]},["gradient",FILL_GRADIENT_LINEAR_DEFAULTS],["image",FILL_IMAGE_DEFAULTS],["pattern",FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},strokeWidth:2,fillOpacity:1,strokeOpacity:1,lineDash:void 0,lineDashOffset:0,highlight:multiSeriesHighlightStyle(),segmentation:SEGMENTATION_DEFAULTS},axes:{[CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{snap:!1}},[CARTESIAN_AXIS_TYPE.CATEGORY]:{groupPaddingInner:.2,crosshair:{enabled:!1,snap:!1}}}},BoxPlotModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"box-plot",moduleFactory:e=>new BoxPlotSeries(e),predictAxis:import_ag_charts_community24._ModuleSupport.predictCartesianTimeAxis,defaultAxes:import_ag_charts_community24._ModuleSupport.DIRECTION_SWAP_AXES,themeTemplate:BOX_PLOT_SERIES_THEME,groupable:!0},BoxPlotSeriesModule={type:"series",name:"box-plot",chartType:"cartesian",enterprise:!0,options:boxPlotSeriesOptionsDef,create:e=>new BoxPlotSeries(e)},import_ag_charts_community34=require("ag-charts-community"),import_ag_charts_community31=require("ag-charts-community"),import_ag_charts_community26=require("ag-charts-community"),import_ag_charts_core11=require("ag-charts-core"),import_ag_charts_community25=require("ag-charts-community"),{AGGREGATION_SPAN,AGGREGATION_INDEX_X_MAX,AGGREGATION_INDEX_X_MIN,AGGREGATION_INDEX_Y_MAX,AGGREGATION_INDEX_Y_MIN,aggregationDomain,aggregationRangeFittingPoints,compactAggregationIndices,createAggregationIndices}=import_ag_charts_community25._ModuleSupport,AGGREGATION_THRESHOLD=1e3,OPEN=AGGREGATION_INDEX_X_MIN,HIGH=AGGREGATION_INDEX_Y_MAX,LOW=AGGREGATION_INDEX_Y_MIN,CLOSE=AGGREGATION_INDEX_X_MAX;function aggregateOhlcData(e,t,i,s,a,o){if(t.length64;)({indexData:c,valueData:h,maxRange:l}=compactAggregationIndices(c,h,l)),p.push({maxRange:l,indexData:c});return p.reverse(),p}var{fixNumericExtent:fixNumericExtent2,keyProperty:keyProperty2,createDatumId:createDatumId2,SeriesNodePickMode:SeriesNodePickMode2,ChartAxisDirection:ChartAxisDirection8,SMALLEST_KEY_INTERVAL:SMALLEST_KEY_INTERVAL2,valueProperty:valueProperty2,diff:diff2,animationValidation:animationValidation2,computeBarFocusBounds:computeBarFocusBounds2,visibleRangeIndices,BandScale,processedDataIsAnimatable,mergeDefaults:mergeDefaults3,simpleMemorize2,getItemStylesPerItemId}=import_ag_charts_community26._ModuleSupport,memoizedAggregateOhlcData=simpleMemorize2(aggregateOhlcData),OhlcSeriesNodeEvent=class extends import_ag_charts_community26._ModuleSupport.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.openKey=s.properties.openKey,this.closeKey=s.properties.closeKey,this.highKey=s.properties.highKey,this.lowKey=s.properties.lowKey}},OhlcSeriesBase=class extends import_ag_charts_community26._ModuleSupport.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[SeriesNodePickMode2.AXIS_ALIGNED,SeriesNodePickMode2.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["lowKey","highKey","openKey","closeKey"]},propertyNames:{x:["xName"],y:["lowName","highName","openName","closeName"]},categoryKey:"xValue",pathsPerSeries:[]}),this.NodeEvent=OhlcSeriesNodeEvent,this.dataAggregationFilters=void 0}async processData(e){if(!this.visible)return;const{xKey:t,openKey:i,closeKey:s,highKey:a,lowKey:o}=this.properties,r=!this.ctx.animationManager.isSkipped(),n=this.getCategoryAxis()?.scale,l=this.getValueAxis()?.scale,{isContinuousX:c,xScaleType:h,yScaleType:p}=this.getScaleInformation({xScale:n,yScale:l}),u=[];r&&(this.processedData&&u.push(diff2(this.id,this.processedData)),u.push(animationValidation2())),i&&u.push(valueProperty2(i,p,{id:"openValue",invalidValue:void 0,missingValue:void 0}));const{dataModel:g,processedData:d}=await this.requestDataModel(e,this.data,{props:[keyProperty2(t,h,{id:"xValue"}),valueProperty2(s,p,{id:"closeValue"}),valueProperty2(a,p,{id:"highValue"}),valueProperty2(o,p,{id:"lowValue"}),...c?[SMALLEST_KEY_INTERVAL2]:[],...u]});this.smallestDataInterval=d.reduced?.smallestKeyInterval,this.dataAggregationFilters=this.aggregateData(g,d),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||processedDataIsAnimatable(t))return;const i=this.axes[ChartAxisDirection8.X];if(i==null)return;const s=e.resolveKeysById(this,"xValue",t),a=e.resolveColumnById(this,"highValue",t),o=e.resolveColumnById(this,"lowValue",t),{index:r}=e.resolveProcessedDataDefById(this,"xValue"),n=t.domain.keys[r];return memoizedAggregateOhlcData(i.scale.type,s,a,o,n,t.reduced?.smallestKeyInterval)}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];if(e!==this.getBarDirection()){const{index:a,def:o}=i.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[a];return o.type==="key"&&o.valueType==="category"?r:this.padBandExtent(r)}const s=this.domainForClippedRange(e,["highValue","lowValue"],"xValue");return fixNumericExtent2(s)}getSeriesRange(e,t){return this.domainForVisibleRange(ChartAxisDirection8.Y,["highValue","lowValue"],"xValue",t)}getZoomRangeFittingItems(e,t,i){return this.zoomFittingVisibleItems("xValue",["highValue","lowValue"],e,t,i)}getVisibleItems(e,t,i){return this.countVisibleItems("xValue",["highValue","lowValue"],e,t,i)}createNodeData(){const{visible:e,dataModel:t,processedData:i}=this,s=this.getCategoryAxis(),a=this.getValueAxis();if(!(t&&i&&s&&a))return;const o=[],{xKey:r,highKey:n,lowKey:l}=this.properties,c=i.dataSources.get(this.id)?.data??[],h=t.resolveKeysById(this,"xValue",i),p=t.resolveColumnById(this,"openValue",i),u=t.resolveColumnById(this,"closeValue",i),g=t.resolveColumnById(this,"highValue",i),d=t.resolveColumnById(this,"lowValue",i),{groupScale:m}=this,{barWidth:y,groupIndex:f}=this.updateGroupScale(s),S=m.convert(String(f)),b=y>=1?y:m.rawBandwidth,x=BandScale.is(s.scale),v={itemId:r,nodeData:o,labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:getItemStylesPerItemId(this.getItemStyle.bind(this),"up","down")};if(!e)return v;const _=(C,w,M,T,N,I,P,F)=>{const E=c[C],G=x?P/2:0,K=s.scale.convert(w)+S+G,V=a.scale.convert(M),W=a.scale.convert(T),z=a.scale.convert(N),Y=a.scale.convert(I),q=T>M,$=q?"up":"down",U=Math.min(z,Y),j=Math.max(z,Y)-U,H={x:K,y:U+j/2};o.push({series:this,itemId:$,datum:E,datumIndex:C,xKey:r,xValue:w,openValue:M,closeValue:T,highValue:N,lowValue:I,midPoint:H,aggregatedValue:T,isRising:q,centerX:K,width:P,y:U,height:j,yOpen:V,yClose:W,crisp:F})},{dataAggregationFilters:D}=this,k=s.scale,[A,L]=k.range,R=Math.abs(L-A),O=C=>k.convert(h[C])+S,B=D?.find(C=>C.maxRange>R);if(B==null){const C=i.invalidData?.get(this.id);let[w,M]=visibleRangeIndices(1,c.length,s.range,T=>{const N=x?0:-b/2,I=O(T)+N;return[I,I+b]});i.input.count<1e3&&(w=0,M=i.input.count);for(let T=w;T=I&&F>=P;if(!G){import_ag_charts_core11.Logger.warnOnce(`invalid low value for key [${l}] in data element, low value cannot be higher than datum open or close values`);continue}if(!K){import_ag_charts_core11.Logger.warnOnce(`invalid high value for key [${n}] in data element, high value cannot be lower than datum open or close values.`);continue}_(T,N,I,P,F,E,b,!0)}}else{const{maxRange:C,indexData:w}=B,[M,T]=visibleRangeIndices(1,C,s.range,N=>{const I=N*AGGREGATION_SPAN,P=w[I+OPEN],F=w[I+CLOSE];if(P===-1)return;const E=x?0:-b/2;return[O(P)+E,O(F)+E+b]});for(let N=M;N{const g=this.makeItemStylerParams(s,e,t,h);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`,"item",s],this.callWithContext(n,g))});u&&(h=mergeDefaults3(u,h))}return h}makeItemStylerParams(e,t,i,s){const{id:a,properties:o,processedData:r}=this,{xKey:n,openKey:l,closeKey:c,highKey:h,lowKey:p}=o,u=r.dataSources.get(a)?.data[t],g=this.ctx.highlightManager?.getActiveHighlight(),d=this.getHighlightStateString(g,i,t),m={seriesId:a,datum:u,itemId:e,xKey:n,openKey:l,closeKey:c,highKey:h,lowKey:p,highlighted:i,highlightState:d,...s};return"fill"in m&&"fill"in s&&(m.fill=this.filterItemStylerFillParams(s.fill)??s.fill),m}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:a}=this,{xKey:o,xName:r,yName:n,openKey:l,openName:c,highKey:h,highName:p,lowKey:u,lowName:g,closeKey:d,closeName:m,legendItemName:y,tooltip:f}=a,S=this.getCategoryAxis(),b=this.getValueAxis();if(!i||!s||!S||!b)return;const x=s.dataSources.get(this.id)?.data[e],v=i.resolveKeysById(this,"xValue",s)[e],_=i.resolveColumnById(this,"openValue",s)[e],D=i.resolveColumnById(this,"highValue",s)[e],k=i.resolveColumnById(this,"lowValue",s)[e],A=i.resolveColumnById(this,"closeValue",s)[e];if(v==null)return;const L=A>=_?"up":"down",R=this.properties.item[L],O=this.getItemStyle(e,!1),B={fill:R.fill??R.stroke,fillOpacity:R.fillOpacity??R.strokeOpacity??1,stroke:R.stroke,strokeWidth:R.strokeWidth??1,strokeOpacity:R.strokeOpacity??1,lineDash:R.lineDash??[0],lineDashOffset:R.lineDashOffset??0};return this.formatTooltipWithContext(f,{heading:this.getAxisValueText(S,"tooltip",v,x,o,y),title:y,symbol:{marker:B},data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(b,"tooltip",_,x,l,y)},{label:p,fallbackLabel:h,value:this.getAxisValueText(b,"tooltip",D,x,h,y)},{label:g,fallbackLabel:u,value:this.getAxisValueText(b,"tooltip",k,x,u,y)},{label:m,fallbackLabel:d,value:this.getAxisValueText(b,"tooltip",A,x,d,y)}]},{seriesId:t,datum:x,title:n,itemId:L,xKey:o,xName:r,yName:n,openKey:l,openName:c,highKey:h,highName:p,lowKey:u,lowName:g,closeKey:d,closeName:m,...O})}computeFocusBounds(e){const t=this.getNodeData()?.at(e.datumIndex);if(t==null)return;const{centerX:i,y:s,width:a,height:o}=t,r={x:i-a/2,y:s,width:a,height:o};return computeBarFocusBounds2(this,r)}},import_ag_charts_community28=require("ag-charts-community"),import_ag_charts_community27=require("ag-charts-community"),{Path:Path6,SceneChangeDetection:SceneChangeDetection2,BBox:BBox3}=import_ag_charts_community27._ModuleSupport,OhlcBaseNode=class extends Path6{constructor(){super(...arguments),this.centerX=0,this.y=0,this.width=0,this.height=0,this.yOpen=0,this.yClose=0,this.crisp=!1}computeBBox(){const{centerX:e,y:t,width:i,height:s}=this;return new BBox3(e-i/2,t,i,s)}isPointInPath(e,t){return this.getBBox().containsPoint(e,t)}distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}get midPoint(){return{x:this.centerX,y:this.y+this.height/2}}alignedCoordinates(){const{y:e,width:t,height:i,crisp:s}=this;let{centerX:a,yOpen:o,yClose:r}=this,n=a-t/2,l=a+t/2,c=e,h=e+i;if(s&&t>1){if(a=this.align(a),o<=r){const u=this.align(o,r-o);o=this.align(o),r=o+u}else{const u=this.align(r,o-r);r=this.align(r),o=r+u}const p=this.align(t/2);n=a-p,l=a+p,c=this.align(e),h=c+this.align(c,i)}return{centerX:a,x0:n,x1:l,y0:c,y1:h,yOpen:o,yClose:r}}executeStroke(e,t){const{width:i,strokeWidth:s}=this;i0?l/this.strokeAlignment/2%1:0;e.clear(),e.moveTo(t-c,a),e.lineTo(t-c,o),Math.abs(s-i)>1&&(e.moveTo(i,r-c),e.lineTo(t-c,r-c),e.moveTo(t-c,n-c),e.lineTo(s,n-c))}};__decorateClass([SceneChangeDetection2()],OhlcNode.prototype,"strokeAlignment",2);var{SceneArrayChangeDetection:SceneArrayChangeDetection2,SceneChangeDetection:SceneChangeDetection3,ExtendedPath2D:ExtendedPath2D2,BBox:BBox4}=import_ag_charts_community28._ModuleSupport,CandlestickNode=class extends OhlcBaseNode{constructor(){super(...arguments),this.wickPath=new ExtendedPath2D2,this.wickStroke=void 0,this.wickStrokeWidth=void 0,this.wickStrokeOpacity=void 0,this.wickStrokeAlignment=0}computeDefaultGradientFillBBox(){const{width:e,centerX:t,yOpen:i,yClose:s}=this,a=Math.min(i,s),r=Math.max(i,s)-a,n=t-e/2,l=t+e/2;return new BBox4(n,a,l-n,r)}updatePath(){const{path:e,stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:a,lineDashOffset:o,wickStroke:r,wickStrokeWidth:n,wickStrokeOpacity:l,wickLineDash:c,wickLineDashOffset:h}=this,{centerX:p,x0:u,x1:g,y0:d,y1:m,yOpen:y,yClose:f}=this.alignedCoordinates(),S=this.layerManager?.canvas.pixelRatio??1,b=this.wickStrokeAlignment>0?S/this.wickStrokeAlignment/2%1:0;this.path.clear(),this.wickPath.clear();const v=r!=null&&r!==t||n!=null&&n!==i||l!=null&&l!==s||c!=null&&c!==a||h!=null&&h!==o?this.wickPath:e;if(Math.abs(g-u)<=3){v.moveTo(p-b,d),v.lineTo(p-b,m);return}const _=Math.min(y,f),D=Math.max(y,f),k=i/2;v.moveTo(p-b,d),v.lineTo(p-b,_+k),v.moveTo(p-b,m),v.lineTo(p-b,D-k);const A=D-_-2*k;if(A>0)e.rect(u+k,_+k,g-u-2*k,A);else{const L=(_+D)/2;e.moveTo(u,L),e.lineTo(g,L)}}drawPath(e){super.drawPath(e);const{wickPath:t}=this;if(t.isEmpty())return;const{stroke:i,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r,wickStroke:n=i,wickStrokeWidth:l=s,wickStrokeOpacity:c=a,wickLineDash:h=o,wickLineDashOffset:p=r}=this;l!==0&&(e.globalAlpha*=c,typeof n=="string"&&(e.strokeStyle=n),e.lineWidth=l,h!=null&&e.setLineDash([...h]),e.lineDashOffset=p,e.stroke(t.getPath2D()))}};__decorateClass([SceneChangeDetection3()],CandlestickNode.prototype,"wickStroke",2),__decorateClass([SceneChangeDetection3()],CandlestickNode.prototype,"wickStrokeWidth",2),__decorateClass([SceneChangeDetection3()],CandlestickNode.prototype,"wickStrokeOpacity",2),__decorateClass([SceneArrayChangeDetection2()],CandlestickNode.prototype,"wickLineDash",2),__decorateClass([SceneChangeDetection3()],CandlestickNode.prototype,"wickLineDashOffset",2),__decorateClass([SceneChangeDetection3()],CandlestickNode.prototype,"wickStrokeAlignment",2);var import_ag_charts_community30=require("ag-charts-community"),import_ag_charts_community29=require("ag-charts-community"),{BaseProperties:BaseProperties3,Property:Property13,AbstractBarSeriesProperties:AbstractBarSeriesProperties2,makeSeriesTooltip:makeSeriesTooltip2}=import_ag_charts_community29._ModuleSupport,OhlcSeriesItem=class extends BaseProperties3{constructor(){super(...arguments),this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};__decorateClass([Property13],OhlcSeriesItem.prototype,"stroke",2),__decorateClass([Property13],OhlcSeriesItem.prototype,"strokeWidth",2),__decorateClass([Property13],OhlcSeriesItem.prototype,"strokeOpacity",2),__decorateClass([Property13],OhlcSeriesItem.prototype,"lineDash",2),__decorateClass([Property13],OhlcSeriesItem.prototype,"lineDashOffset",2);var OhlcSeriesItems=class extends BaseProperties3{constructor(){super(...arguments),this.up=new OhlcSeriesItem,this.down=new OhlcSeriesItem}};__decorateClass([Property13],OhlcSeriesItems.prototype,"up",2),__decorateClass([Property13],OhlcSeriesItems.prototype,"down",2);var OhlcSeriesBaseProperties=class extends AbstractBarSeriesProperties2{};__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"xKey",2),__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"openKey",2),__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"closeKey",2),__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"highKey",2),__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"lowKey",2),__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"xName",2),__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"yName",2),__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"openName",2),__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"closeName",2),__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"highName",2),__decorateClass([Property13],OhlcSeriesBaseProperties.prototype,"lowName",2);var OhlcSeriesProperties=class extends OhlcSeriesBaseProperties{constructor(){super(...arguments),this.tooltip=makeSeriesTooltip2(),this.item=new OhlcSeriesItems}getStyle(e){const{strokeWidth:t,strokeOpacity:i,stroke:s,lineDash:a,lineDashOffset:o}=this.item[e];return{stroke:s,strokeWidth:t,strokeOpacity:i,lineDash:a,lineDashOffset:o,opacity:1}}};__decorateClass([Property13],OhlcSeriesProperties.prototype,"tooltip",2),__decorateClass([Property13],OhlcSeriesProperties.prototype,"item",2),__decorateClass([Property13],OhlcSeriesProperties.prototype,"itemStyler",2);var{BaseProperties:BaseProperties4,makeSeriesTooltip:makeSeriesTooltip3,Property:Property14}=import_ag_charts_community30._ModuleSupport,CandlestickSeriesWick=class extends BaseProperties4{};__decorateClass([Property14],CandlestickSeriesWick.prototype,"stroke",2),__decorateClass([Property14],CandlestickSeriesWick.prototype,"strokeWidth",2),__decorateClass([Property14],CandlestickSeriesWick.prototype,"strokeOpacity",2),__decorateClass([Property14],CandlestickSeriesWick.prototype,"lineDash",2),__decorateClass([Property14],CandlestickSeriesWick.prototype,"lineDashOffset",2);var CandlestickSeriesItem=class extends BaseProperties4{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.wick=new CandlestickSeriesWick}};__decorateClass([Property14],CandlestickSeriesItem.prototype,"fill",2),__decorateClass([Property14],CandlestickSeriesItem.prototype,"fillOpacity",2),__decorateClass([Property14],CandlestickSeriesItem.prototype,"stroke",2),__decorateClass([Property14],CandlestickSeriesItem.prototype,"strokeWidth",2),__decorateClass([Property14],CandlestickSeriesItem.prototype,"strokeOpacity",2),__decorateClass([Property14],CandlestickSeriesItem.prototype,"lineDash",2),__decorateClass([Property14],CandlestickSeriesItem.prototype,"lineDashOffset",2),__decorateClass([Property14],CandlestickSeriesItem.prototype,"cornerRadius",2),__decorateClass([Property14],CandlestickSeriesItem.prototype,"wick",2);var CandlestickSeriesItems=class extends BaseProperties4{constructor(){super(...arguments),this.up=new CandlestickSeriesItem,this.down=new CandlestickSeriesItem}};__decorateClass([Property14],CandlestickSeriesItems.prototype,"up",2),__decorateClass([Property14],CandlestickSeriesItems.prototype,"down",2);var CandlestickSeriesProperties=class extends OhlcSeriesBaseProperties{constructor(){super(),this.item=new CandlestickSeriesItems,this.tooltip=makeSeriesTooltip3(),this.highlightStyle.deprecated=!1}getStyle(e){const{fill:t,fillOpacity:i,strokeWidth:s,strokeOpacity:a,stroke:o,lineDash:r,lineDashOffset:n,cornerRadius:l,wick:c}=this.item[e];return{fill:t,fillOpacity:i,stroke:o,strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n,cornerRadius:l,opacity:1,wick:c}}};__decorateClass([Property14],CandlestickSeriesProperties.prototype,"item",2),__decorateClass([Property14],CandlestickSeriesProperties.prototype,"tooltip",2),__decorateClass([Property14],CandlestickSeriesProperties.prototype,"itemStyler",2);var{isGradientFill,isPatternFill,isImageFill,applyShapeStyle}=import_ag_charts_community31._ModuleSupport,CandlestickSeries=class extends OhlcSeriesBase{constructor(){super(...arguments),this.properties=new CandlestickSeriesProperties}nodeFactory(){const e=new CandlestickNode;return e.lineCap="butt",e}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s.datumIndex,t,void 0,s.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:s}=this;if(!i)return;const a=this.ctx.highlightManager.getActiveHighlight(),{up:o,down:r}=s.item;e.each((n,l)=>{const{centerX:c,width:h,y:p,height:u,yOpen:g,yClose:d,crisp:m}=l,y=l.isRising?o:r,f=l.style??i.styles[l.itemId][this.getHighlightState(a,t,l.datumIndex)];n.centerX=c,n.width=h,n.y=p,n.height=u,n.yOpen=g,n.yClose=d,n.crisp=m,applyShapeStyle(n,f,this.getShapeFillBBox());const S=f?.wick;n.wickStroke=S?.stroke,n.wickStrokeWidth=S?.strokeWidth,n.wickStrokeOpacity=S?.strokeOpacity,n.wickLineDash=S?.lineDash,n.wickLineDashOffset=S?.lineDashOffset,n.wickStrokeAlignment=y.wick.strokeWidth??y.strokeWidth})}legendItemSymbol(){const{up:e,down:t}=this.properties.item,i=isGradientFill(e.fill)?e.fill.colorStops.map(r=>typeof r=="string"?r:{color:r.color,stop:r.stop==null?void 0:r.stop*.5}):[{color:isPatternFill(e.fill)||isImageFill(e.fill)?e.stroke:e.fill,stop:0},{color:isPatternFill(e.fill)||isImageFill(e.fill)?e.stroke:e.fill,stop:.5}],s=isGradientFill(t.fill)?t.fill.colorStops.map(r=>typeof r=="string"?r:{color:r.color,stop:r.stop==null?void 0:r.stop*.5}):[{color:isPatternFill(t.fill)||isImageFill(t.fill)?t.stroke:t.fill,stop:.5}],a={type:"gradient",gradient:"linear",rotation:90,colorStops:[...i,...s],reverse:!1},o={type:"gradient",gradient:"linear",rotation:90,colorStops:[{color:e.stroke,stop:0},{color:e.stroke,stop:.5},{color:t.stroke,stop:.5}],reverse:!1};return{marker:{fill:a,fillOpacity:e.fillOpacity,stroke:o,strokeWidth:e.strokeWidth??1,strokeOpacity:e.strokeOpacity??1,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset}}}getLegendData(e){const{id:t,data:i,visible:s,ctx:{legendManager:a}}=this,{xKey:o,yName:r,showInLegend:n,legendItemName:l}=this.properties;return!i?.data.length||!o||e!=="category"?[]:[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:s&&a.getItemEnabled({seriesId:t,itemId:t}),label:{text:l??r??t},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!n}]}hasItemStylers(){return this.properties.itemStyler!=null}};CandlestickSeries.className="CandleStickSeries",CandlestickSeries.type="candlestick";var import_ag_charts_community32=require("ag-charts-community"),import_ag_charts_core12=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs2,candlestickSeriesThemeableOptionsDef}=import_ag_charts_community32._ModuleSupport,candlestickSeriesOptionsDef={...commonSeriesOptionsDefs2,...candlestickSeriesThemeableOptionsDef,type:(0,import_ag_charts_core12.required)((0,import_ag_charts_core12.constant)("candlestick")),xKey:(0,import_ag_charts_core12.required)(import_ag_charts_core12.string),openKey:(0,import_ag_charts_core12.required)(import_ag_charts_core12.string),highKey:(0,import_ag_charts_core12.required)(import_ag_charts_core12.string),lowKey:(0,import_ag_charts_core12.required)(import_ag_charts_core12.string),closeKey:(0,import_ag_charts_core12.required)(import_ag_charts_core12.string),xName:import_ag_charts_core12.string,yName:import_ag_charts_core12.string,openName:import_ag_charts_core12.string,highName:import_ag_charts_core12.string,lowName:import_ag_charts_core12.string,closeName:import_ag_charts_core12.string};candlestickSeriesOptionsDef.pickOutsideVisibleMinorAxis=(0,import_ag_charts_core12.undocumented)(import_ag_charts_core12.boolean),candlestickSeriesOptionsDef.focusPriority=(0,import_ag_charts_core12.undocumented)(import_ag_charts_core12.number);var import_ag_charts_community33=require("ag-charts-community"),{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE2},multiSeriesHighlightStyle:multiSeriesHighlightStyle2,FILL_GRADIENT_LINEAR_KEYED_DEFAULTS,FILL_IMAGE_DEFAULTS:FILL_IMAGE_DEFAULTS2,FILL_PATTERN_KEYED_DEFAULTS}=import_ag_charts_community33._ModuleSupport;function itemTheme(e){return{fill:{$applySwitch:[{$path:"type"},{$if:[{$eq:[{$palette:"type"},"user-indexed"]},e==="up"?"transparent":{$palette:"fill"},{$palette:`${e}.fill`}]},["gradient",FILL_GRADIENT_LINEAR_KEYED_DEFAULTS(e)],["image",FILL_IMAGE_DEFAULTS2],["pattern",FILL_PATTERN_KEYED_DEFAULTS(e)]]},stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:`${e}.stroke`}]}}}var CANDLESTICK_SERIES_THEME={series:{item:{up:itemTheme("up"),down:itemTheme("down")},highlightStyle:{item:{strokeWidth:3}},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:multiSeriesHighlightStyle2()},animation:{enabled:!1},axes:{[CARTESIAN_AXIS_TYPE2.NUMBER]:{crosshair:{snap:!1}},[CARTESIAN_AXIS_TYPE2.ORDINAL_TIME]:{groupPaddingInner:0,crosshair:{enabled:!0}}}},{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE3,CARTESIAN_POSITION}=import_ag_charts_community34._ModuleSupport.ThemeConstants,CandlestickModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"candlestick",moduleFactory:e=>new CandlestickSeries(e),defaultAxes:[{type:CARTESIAN_AXIS_TYPE3.NUMBER,position:CARTESIAN_POSITION.LEFT},{type:CARTESIAN_AXIS_TYPE3.ORDINAL_TIME,position:CARTESIAN_POSITION.BOTTOM}],themeTemplate:CANDLESTICK_SERIES_THEME,groupable:!1},CandlestickSeriesModule={type:"series",name:"candlestick",chartType:"cartesian",enterprise:!0,options:candlestickSeriesOptionsDef,create:e=>new CandlestickSeries(e)},import_ag_charts_community40=require("ag-charts-community"),import_ag_charts_community37=require("ag-charts-community"),import_ag_charts_core14=require("ag-charts-core"),import_ag_charts_core13=require("ag-charts-core");function generateLabelSecondaryLabelFontSizeCandidates(e,t){const{fontSize:i,minimumFontSize:s=i}=e,{fontSize:a,minimumFontSize:o=a}=t,r=i-s,n=a-o;let l=e.fontSize,c=t.fontSize;const h=[{labelFontSize:i,secondaryLabelFontSize:a}];for(;l>s||c>o;){const p=r>0?(l-s)/r:-1,u=n>0?(c-o)/n:-1;p>u?l--:c--,h.push({labelFontSize:l,secondaryLabelFontSize:c})}return h.reverse(),h}function formatStackedLabels(e,t,i,s,{padding:a},o){const{spacing:r=0}=t,n=2*a,l=2*a+r,c=(t.minimumFontSize??t.fontSize)+(s.minimumFontSize??s.fontSize);if(c>o(c+l,!1).height-l)return;const h=generateLabelSecondaryLabelFontSizeCandidates(t,s),p={fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight},u={fontFamily:s.fontFamily,fontStyle:s.fontStyle,fontWeight:s.fontWeight};let g,d;return(0,import_ag_charts_core13.findMaxValue)(0,h.length-1,m=>{const{labelFontSize:y,secondaryLabelFontSize:f}=h[m],S=m===0,b={...p,fontSize:y},x={...u,fontSize:f},v=(0,import_ag_charts_core13.cachedTextMeasurer)(b).lineHeight(),_=(0,import_ag_charts_core13.cachedTextMeasurer)(x).lineHeight(),D=o(v+_+l,S),k=D.width-n,A=D.height-l;if(v+_>A||((g==null||g.fontSize!==y)&&(g=wrapLabel(t,e,k,A,b,t.wrapping,S?t.overflowStrategy:"hide")),g==null||g.width>k||g.height>A)||((d==null||d.fontSize!==f)&&(d=wrapLabel(s,i,k,A,x,s.wrapping,S?s.overflowStrategy:"hide")),d==null))return;const L=g.height+d.height;if(!(d.width>k||L>A))return{width:Math.max(g.width,d.width),height:L+r,meta:D.meta,label:g,secondaryLabel:d}})}function formatSingleLabel(e,t,{padding:i},s){const a=2*i,o=Math.min(t.minimumFontSize??t.fontSize,t.fontSize),r={fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight};return(0,import_ag_charts_core13.findMaxValue)(o,t.fontSize,n=>{const l={...r,fontSize:n},c=(0,import_ag_charts_core13.cachedTextMeasurer)(l),h=n===o,p=t.lineHeight??c.lineHeight(),u=s(p+a,h),g=u.width-a,d=u.height-a;if(p>d||g<0)return;const m=(0,import_ag_charts_core13.wrapLines)(e,{maxWidth:g,maxHeight:d,font:l,textWrap:t.wrapping,overflow:(h?t.overflowStrategy:null)??"hide"});if(!m.length)return;const{width:y,height:f}=c.measureLines(m),S=m.join(` +`);return[{width:y,height:f,text:S,fontSize:n,lineHeight:p},u.meta]})}function hasInvalidFontSize(e){return e?.minimumFontSize!=null&&e?.fontSize!=null&&e?.minimumFontSize>e?.fontSize}function formatLabels(e,t,i,s,a,o){const r=t.enabled?e:void 0,n=s.enabled?i:void 0;(hasInvalidFontSize(t)||hasInvalidFontSize(s))&&import_ag_charts_core13.Logger.warnOnce("minimumFontSize should be set to a value less than or equal to the font size");let l;r!=null&&n!=null&&(l=formatStackedLabels(r,t,n,s,a,o));let c;if(l==null&&r!=null&&(c=formatSingleLabel(r,t,a,o)),c!=null){const[p,u]=c;l={width:p.width,height:p.height,meta:u,label:p,secondaryLabel:void 0}}let h;if(l==null&&r==null&&n!=null&&(h=formatSingleLabel(n,s,a,o)),h!=null){const[p,u]=h;l={width:p.width,height:p.height,meta:u,label:void 0,secondaryLabel:p}}return l}function wrapLabel(e,t,i,s,a,o,r){const n=(0,import_ag_charts_core13.wrapLines)(t,{maxWidth:i,maxHeight:s,font:a,textWrap:o,overflow:r});if(!n.length)return;const l=(0,import_ag_charts_core13.cachedTextMeasurer)(a),c=e.lineHeight??l.lineHeight(),{width:h}=l.measureLines(n);return{width:h,lineHeight:c,text:n.join(` +`),height:n.length*c,fontSize:a.fontSize}}var import_ag_charts_community36=require("ag-charts-community"),import_ag_charts_community35=require("ag-charts-community"),{Property:Property15}=import_ag_charts_community35._ModuleSupport,BaseAutoSizedLabel=class extends import_ag_charts_community35._ModuleSupport.Label{constructor(){super(...arguments),this.wrapping="on-space",this.overflowStrategy="ellipsis"}};__decorateClass([Property15],BaseAutoSizedLabel.prototype,"wrapping",2),__decorateClass([Property15],BaseAutoSizedLabel.prototype,"overflowStrategy",2),__decorateClass([Property15],BaseAutoSizedLabel.prototype,"lineHeight",2),__decorateClass([Property15],BaseAutoSizedLabel.prototype,"minimumFontSize",2);var AutoSizedLabel=class extends BaseAutoSizedLabel{constructor(){super(...arguments),this.spacing=0}};__decorateClass([Property15],AutoSizedLabel.prototype,"spacing",2);var AutoSizedSecondaryLabel=class extends BaseAutoSizedLabel{},{CartesianSeriesProperties,makeSeriesTooltip:makeSeriesTooltip4,Property:Property16}=import_ag_charts_community36._ModuleSupport,HeatmapSeriesProperties=class extends CartesianSeriesProperties{constructor(){super(...arguments),this.colorRange=["black","black"],this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.textAlign="center",this.verticalAlign="middle",this.itemPadding=0,this.label=new AutoSizedLabel,this.tooltip=makeSeriesTooltip4()}};__decorateClass([Property16],HeatmapSeriesProperties.prototype,"title",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"xKey",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"yKey",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"colorKey",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"xName",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"yName",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"colorName",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"colorRange",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"stroke",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"textAlign",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"verticalAlign",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"itemPadding",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"label",2),__decorateClass([Property16],HeatmapSeriesProperties.prototype,"tooltip",2);var{SeriesNodePickMode:SeriesNodePickMode3,computeBarFocusBounds:computeBarFocusBounds3,getMissCount,valueProperty:valueProperty3,ChartAxisDirection:ChartAxisDirection9,DEFAULT_CARTESIAN_DIRECTION_KEYS,DEFAULT_CARTESIAN_DIRECTION_NAMES,createDatumId:createDatumId3,ColorScale,Rect,PointerEvents,applyShapeStyle:applyShapeStyle2,mergeDefaults:mergeDefaults4,formatValue,addHitTestersToQuadtree,findQuadtreeMatch,updateLabelNode}=import_ag_charts_community37._ModuleSupport,HeatmapSeriesNodeEvent=class extends import_ag_charts_community37._ModuleSupport.CartesianSeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.colorKey=s.properties.colorKey}},textAlignFactors={left:-.5,center:0,right:-.5},verticalAlignFactors={top:-.5,middle:0,bottom:-.5},HeatmapSeries=class extends import_ag_charts_community37._ModuleSupport.CartesianSeries{constructor(e){super({moduleCtx:e,propertyKeys:{...DEFAULT_CARTESIAN_DIRECTION_KEYS,color:["colorKey"]},propertyNames:{...DEFAULT_CARTESIAN_DIRECTION_NAMES,color:["colorName"]},categoryKey:void 0,pickModes:[SeriesNodePickMode3.NEAREST_NODE,SeriesNodePickMode3.EXACT_SHAPE_MATCH],pathsPerSeries:[]}),this.properties=new HeatmapSeriesProperties,this.NodeEvent=HeatmapSeriesNodeEvent,this.colorScale=new ColorScale}async processData(e){const t=this.axes[ChartAxisDirection9.X],i=this.axes[ChartAxisDirection9.Y];if(!t||!i||!this.data?.data.length)return;const{xKey:s,yKey:a,colorRange:o,colorKey:r}=this.properties,n=this.axes[ChartAxisDirection9.X]?.scale,l=this.axes[ChartAxisDirection9.Y]?.scale,{xScaleType:c,yScaleType:h}=this.getScaleInformation({xScale:n,yScale:l}),p=this.colorScale.type,{dataModel:u,processedData:g}=await this.requestDataModel(e,this.data,{props:[valueProperty3(s,c,{id:"xValue"}),valueProperty3(a,h,{id:"yValue"}),...r?[valueProperty3(r,p,{id:"colorValue",invalidValue:void 0})]:[]]});if(this.isColorScaleValid()){const d=u.resolveProcessedDataIndexById(this,"colorValue"),m=g.domain.values[d].filter(f=>f!=null),y=import_ag_charts_community37._ModuleSupport.extent(m);if(this.colorScale.domain=y??[],y?.length&&y[0]===y[1]){const f=Math.floor(o.length/2);this.colorScale.range=[o[f],o[f]]}else this.colorScale.range=o;this.colorScale.update()}}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),a=i.input.count,o=getMissCount(this,i.defs.values[s].missing),r=t.resolveProcessedDataIndexById(this,"colorValue"),n=i.domain.values[r].filter(c=>c!=null).length;return!(a===0||a===o||n===0)}xCoordinateRange(e,t){const i=this.axes[ChartAxisDirection9.X].scale,s=t*(i.bandwidth??0)/2,a=i.convert(e)+s,o=t*(i.bandwidth??10);return[a,a+o]}yCoordinateRange(e,t){const i=this.axes[ChartAxisDirection9.Y].scale,s=t*(i.bandwidth??0)/2,a=i.convert(e[0])+s,o=t*(i.bandwidth??10);return[a,a+o]}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;return!t||!i?[]:e===ChartAxisDirection9.X?t.getDomain(this,"xValue","value",i):t.getDomain(this,"yValue","value",i)}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{data:e,visible:t,axes:i,dataModel:s,processedData:a}=this,o=i[ChartAxisDirection9.X],r=i[ChartAxisDirection9.Y];if(!(e&&s&&a&&t&&o&&r))return;if(o.type!=="category"||r.type!=="category"){import_ag_charts_core14.Logger.warnOnce(`Heatmap series expected axes to have "category" type, but received "${o.type}" and "${r.type}" instead.`);return}const{xKey:n,xName:l,yKey:c,yName:h,colorKey:p,colorName:u,textAlign:g,verticalAlign:d,itemPadding:m,label:y}=this.properties,f=s.resolveColumnById(this,"xValue",a),S=s.resolveColumnById(this,"yValue",a),b=p?s.resolveColumnById(this,"colorValue",a):void 0,x=p?s.getDomain(this,"colorValue","value",a):[],v=o.scale,_=r.scale,D=(v.bandwidth??0)/2,k=(_.bandwidth??0)/2,A=[],L=[],R=v.bandwidth??10,O=_.bandwidth??10,B=(R-2*m)*textAlignFactors[g],C=(O-2*m)*verticalAlignFactors[d],w=()=>({width:R,height:O,meta:null}),M=a.dataSources.get(this.id)?.data??[];for(const[T,N]of M.entries()){const I=f[T],P=S[T],F=v.convert(I)+D,E=_.convert(P)+k,G=b?.[T],K=y.enabled&&G!=null?this.getLabelText(G,N,p,"color",x,y,{value:G,datum:N,colorKey:p,colorName:u,xKey:n,yKey:c,xName:l,yName:h}):void 0,V=formatLabels((0,import_ag_charts_core14.toPlainText)(K),this.properties.label,void 0,this.properties.label,{padding:m},w),W={x:F,y:E,size:0},z=this.getItemStyle({datumIndex:T,datum:N,colorValue:G},!1);if(A.push({series:this,itemId:c,datumIndex:T,yKey:c,xKey:n,xValue:I,yValue:P,colorValue:G,datum:N,point:W,width:R,height:O,midPoint:{x:F,y:E},missing:b!=null&&G==null,style:z}),V?.label!=null){const{text:Y,fontSize:q,lineHeight:$,height:U}=V.label,{fontStyle:j,fontFamily:H,fontWeight:te,color:Z}=this.properties.label,X=W.x+B*(R-2*m),Q=W.y+C*(O-2*m)-(V.height-U)*.5;L.push({series:this,itemId:c,datum:N,datumIndex:T,text:Y,fontSize:q,lineHeight:$,fontStyle:j,fontFamily:H,fontWeight:te,color:Z,textAlign:g,textBaseline:d,x:X,y:Q,style:z})}}return{itemId:this.properties.yKey??this.id,nodeData:A,labelData:L,scales:this.calculateScaling(),visible:this.visible}}nodeFactory(){return new Rect}update(e){return this.ctx.animationManager.skipCurrentBatch(),super.update(e)}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,s=t??[];return i.update(s)}getItemStyle({datumIndex:e,datum:t,colorValue:i},s){const{properties:a}=this,{itemStyler:o,stroke:r,strokeWidth:n,strokeOpacity:l}=a,c=this.getHighlightStyle(s,e),h=mergeDefaults4(c,{fill:this.isColorScaleValid()&&i!=null?this.colorScale.convert(i):"transparent",fillOpacity:1,stroke:r,strokeWidth:n,strokeOpacity:l,opacity:1});let p;return o!=null&&e!=null&&(p=this.cachedDatumCallback(createDatumId3(e,s?"highlight":"node"),()=>{const u=this.makeItemStylerParams(t,e,s,h);return this.callWithContext(o,u)})),p?mergeDefaults4(p,h):h}makeItemStylerParams(e,t,i,s){const{id:a,properties:o}=this,{xKey:r,yKey:n}=o,l=this.ctx.highlightManager?.getActiveHighlight(),c=this.getHighlightStateString(l,i,t),h=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:a,datum:e,xKey:r,yKey:n,highlighted:i,highlightState:c,...s,fill:h}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){const t=this.axes[ChartAxisDirection9.X],[i,s]=t?.visibleRange??[],o=!(i!==0||s!==1);e.each((r,n)=>{const{point:l,width:c,height:h,style:p}=n;applyShapeStyle2(r,p),r.crisp=o,r.x=Math.floor(l.x-c/2),r.y=Math.floor(l.y-h/2),r.width=Math.ceil(c),r.height=Math.ceil(h)})}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e,{enabled:s}=this.properties.label,a=s?t:[];return i.update(a)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,s)=>{i.pointerEvents=PointerEvents.None,i.text=s.text,i.fillOpacity=this.getHighlightStyle(!1,s.datumIndex)?.opacity??1,updateLabelNode(this,i,this.properties,this.properties.label,s,!1,t)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:a,properties:o,colorScale:r,ctx:n}=this,{formatManager:l}=n,{xKey:c,xName:h,yKey:p,yName:u,colorKey:g,colorName:d,colorRange:m,title:y,legendItemName:f,tooltip:S}=o,b=a[ChartAxisDirection9.X],x=a[ChartAxisDirection9.Y];if(!i||!s||!b||!x)return;const v=s.dataSources.get(this.id)?.data[e],_=i.resolveColumnById(this,"xValue",s)[e],D=i.resolveColumnById(this,"yValue",s)[e],k=g!=null&&this.isColorScaleValid()?i.resolveColumnById(this,"colorValue",s)[e]:void 0;if(_==null)return;const A=[];let L;if(k==null)L=m[0];else{L=r.convert(k);const B=i.getDomain(this,"colorValue","value",s),C=l.format(this.callWithContext.bind(this),{type:"number",value:k,datum:v,seriesId:t,legendItemName:f,key:g,source:"tooltip",property:"color",domain:B,boundSeries:this.getFormatterContext("color"),fractionDigits:void 0});A.push({label:d,fallbackLabel:g,value:C??formatValue(k)})}A.push({label:h,fallbackLabel:c,value:this.getAxisValueText(b,"tooltip",_,v,c,f)},{label:u,fallbackLabel:p,value:this.getAxisValueText(x,"tooltip",D,v,p,f)});const R=this.getItemStyle({datumIndex:e,datum:v,colorValue:k},!1);R.fill!=null&&(L=R.fill);const O=L==null?void 0:{marker:{shape:"square",fill:L,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0}};return this.formatTooltipWithContext(S,{title:y??f,symbol:O,data:A},{seriesId:t,datum:v,title:y,xKey:c,xName:h,yKey:p,yName:u,colorKey:g,colorName:d,...R})}getLegendData(e){return e!=="gradient"||!this.isColorScaleValid()||!this.dataModel?[]:[{legendType:"gradient",enabled:this.visible,seriesId:this.id,series:this.getFormatterContext("color"),colorDomain:this.colorScale.domain,colorRange:this.colorScale.range}]}isLabelEnabled(){return this.properties.label.enabled&&!!this.properties.colorKey}getBandScalePadding(){return{inner:0,outer:0}}computeFocusBounds({datumIndex:e}){const t=this.contextNodeData?.nodeData[e];if(t===void 0)return;const{width:i,height:s,midPoint:a}=t,o={x:a.x-i/2,y:a.y-s/2,width:i,height:s};return computeBarFocusBounds3(this,o)}initQuadTree(e){addHitTestersToQuadtree(e,this.datumNodesIter())}pickNodesExactShape(e){const t=findQuadtreeMatch(this,e);return t!=null&&t.distance<=0?[t.datum]:[]}pickNodeClosestDatum(e){return findQuadtreeMatch(this,e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};HeatmapSeries.className="HeatmapSeries",HeatmapSeries.type="heatmap";var import_ag_charts_community38=require("ag-charts-community"),import_ag_charts_core15=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs3,heatmapSeriesThemeableOptionsDef,without}=import_ag_charts_community38._ModuleSupport,heatmapSeriesOptionsDef={...without(heatmapSeriesThemeableOptionsDef,["showInLegend"]),...without(commonSeriesOptionsDefs3,["showInLegend"]),type:(0,import_ag_charts_core15.required)((0,import_ag_charts_core15.constant)("heatmap")),xKey:(0,import_ag_charts_core15.required)(import_ag_charts_core15.string),yKey:(0,import_ag_charts_core15.required)(import_ag_charts_core15.string),colorKey:import_ag_charts_core15.string,xName:import_ag_charts_core15.string,yName:import_ag_charts_core15.string,colorName:import_ag_charts_core15.string,colorRange:(0,import_ag_charts_core15.arrayOf)(import_ag_charts_core15.color)},import_ag_charts_community39=require("ag-charts-community"),HEATMAP_SERIES_THEME={series:{stroke:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$ref:"chartBackgroundColor"},{$path:["/0",{$palette:"stroke"},{$palette:"strokes"}]}]},strokeWidth:{$isUserOption:["./stroke",2,void 0]},colorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"divergingColors"},import_ag_charts_community39._ModuleSupport.SAFE_RANGE2_OPERATION]},label:{...import_ag_charts_community39._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,color:{$ref:"textColor"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},wrapping:"on-space",overflowStrategy:"ellipsis"},itemPadding:3,highlight:import_ag_charts_community39._ModuleSupport.singleSeriesHighlightStyle()},gradientLegend:{enabled:!0,...import_ag_charts_community39._ModuleSupport.LEGEND_CONTAINER_THEME}},{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE4,CARTESIAN_POSITION:CARTESIAN_POSITION2}}=import_ag_charts_community40._ModuleSupport,HeatmapModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"heatmap",moduleFactory:e=>new HeatmapSeries(e),defaultAxes:[{type:CARTESIAN_AXIS_TYPE4.CATEGORY,position:CARTESIAN_POSITION2.LEFT},{type:CARTESIAN_AXIS_TYPE4.CATEGORY,position:CARTESIAN_POSITION2.BOTTOM}],themeTemplate:HEATMAP_SERIES_THEME},HeatmapSeriesModule={type:"series",name:"heatmap",chartType:"cartesian",enterprise:!0,options:heatmapSeriesOptionsDef,create:e=>new HeatmapSeries(e)},import_ag_charts_community43=require("ag-charts-community"),import_ag_charts_community41=require("ag-charts-community"),{applyShapeStyle:applyShapeStyle3}=import_ag_charts_community41._ModuleSupport,OhlcSeries=class extends OhlcSeriesBase{constructor(){super(...arguments),this.properties=new OhlcSeriesProperties}nodeFactory(){const e=new OhlcNode;return e.lineCap="square",e}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s.datumIndex,t,void 0,s.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:s}=this;if(!i)return;const a=this.ctx.highlightManager.getActiveHighlight(),{up:o,down:r}=s.item;e.each((n,l)=>{const{centerX:c,width:h,y:p,height:u,yOpen:g,yClose:d,crisp:m}=l,y=l.isRising?o:r;n.centerX=c,n.width=h,n.y=p,n.height=u,n.yOpen=g,n.yClose=d,n.crisp=m;const f=l.style??i.styles[l.itemId][this.getHighlightState(a,t,l.datumIndex)];applyShapeStyle3(n,f),n.strokeAlignment=y.strokeWidth})}getLegendData(e){const{id:t,data:i,ctx:{legendManager:s},visible:a}=this,{xKey:o,yName:r,item:{up:n,down:l},showInLegend:c,legendItemName:h}=this.properties;if(!i?.data.length||!o||e!=="category")return[];const p={type:"gradient",gradient:"linear",colorSpace:"rgb",colorStops:[{color:n.stroke,stop:0},{color:n.stroke,stop:.5},{color:l.stroke,stop:.5}],rotation:90};return[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:a&&s.getItemEnabled({seriesId:t,itemId:t}),label:{text:h??r??t},symbol:{marker:{fill:p,fillOpacity:n.strokeOpacity,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0}},legendItemName:h,hideInLegend:!c}]}hasItemStylers(){return this.properties.itemStyler!=null}};OhlcSeries.className="ohlc",OhlcSeries.type="ohlc";var import_ag_charts_community42=require("ag-charts-community"),import_ag_charts_core16=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs4,ohlcSeriesThemeableOptionsDef}=import_ag_charts_community42._ModuleSupport,ohlcSeriesOptionsDef={...commonSeriesOptionsDefs4,...ohlcSeriesThemeableOptionsDef,type:(0,import_ag_charts_core16.required)((0,import_ag_charts_core16.constant)("ohlc")),xKey:(0,import_ag_charts_core16.required)(import_ag_charts_core16.string),openKey:(0,import_ag_charts_core16.required)(import_ag_charts_core16.string),highKey:(0,import_ag_charts_core16.required)(import_ag_charts_core16.string),lowKey:(0,import_ag_charts_core16.required)(import_ag_charts_core16.string),closeKey:(0,import_ag_charts_core16.required)(import_ag_charts_core16.string),xName:import_ag_charts_core16.string,yName:import_ag_charts_core16.string,openName:import_ag_charts_core16.string,highName:import_ag_charts_core16.string,lowName:import_ag_charts_core16.string,closeName:import_ag_charts_core16.string};ohlcSeriesOptionsDef.pickOutsideVisibleMinorAxis=(0,import_ag_charts_core16.undocumented)(import_ag_charts_core16.boolean),ohlcSeriesOptionsDef.focusPriority=(0,import_ag_charts_core16.undocumented)(import_ag_charts_core16.number);var{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE5,CARTESIAN_POSITION:CARTESIAN_POSITION3},multiSeriesHighlightStyle:multiSeriesHighlightStyle3}=import_ag_charts_community43._ModuleSupport,OhlcModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"ohlc",moduleFactory:e=>new OhlcSeries(e),defaultAxes:[{type:CARTESIAN_AXIS_TYPE5.NUMBER,position:CARTESIAN_POSITION3.LEFT},{type:CARTESIAN_AXIS_TYPE5.ORDINAL_TIME,position:CARTESIAN_POSITION3.BOTTOM}],themeTemplate:{animation:{enabled:!1},series:{item:{up:{stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:"up.stroke"}]}},down:{stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:"down.stroke"}]}}},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:multiSeriesHighlightStyle3(!1)},axes:{[CARTESIAN_AXIS_TYPE5.NUMBER]:{crosshair:{snap:!1}},[CARTESIAN_AXIS_TYPE5.ORDINAL_TIME]:{groupPaddingInner:0,crosshair:{enabled:!0}}}},groupable:!1},OhlcSeriesModule={type:"series",name:"ohlc",chartType:"cartesian",enterprise:!0,options:ohlcSeriesOptionsDef,create:e=>new OhlcSeries(e)},import_ag_charts_community51=require("ag-charts-community"),import_ag_charts_community48=require("ag-charts-community"),import_ag_charts_community44=require("ag-charts-community"),{AGGREGATION_INDEX_Y_MAX:AGGREGATION_INDEX_Y_MAX2,AGGREGATION_INDEX_Y_MIN:AGGREGATION_INDEX_Y_MIN2,aggregationDomain:aggregationDomain2,aggregationIndexForXRatio,aggregationRangeFittingPoints:aggregationRangeFittingPoints2,aggregationXRatioForXValue,compactAggregationIndices:compactAggregationIndices2,createAggregationIndices:createAggregationIndices2}=import_ag_charts_community44._ModuleSupport,AGGREGATION_THRESHOLD2=1e3;function aggregationContainsTopIndex(e,t,i,s,a,o,r){const n=e[o];if(n==null)return!1;const l=aggregationXRatioForXValue(n,t,i,r),c=aggregationIndexForXRatio(l,a);return o===s[c+AGGREGATION_INDEX_Y_MAX2]}function aggregationContainsBottomIndex(e,t,i,s,a,o,r){const n=e[o];if(n==null)return!1;const l=aggregationXRatioForXValue(n,t,i,r),c=aggregationIndexForXRatio(l,a);return o===s[c+AGGREGATION_INDEX_Y_MIN2]}function aggregateRangeAreaData(e,t,i,s,a,o,r){if(t.length64;)({maxRange:c}=compactAggregationIndices2(h,p,c,{inPlace:!0})),u=u.filter(m=>aggregationContainsTopIndex(t,n,l,h,c,m,o)),g=g.filter(m=>aggregationContainsBottomIndex(t,n,l,h,c,m,o)),d.push({maxRange:c,topIndices:u,bottomIndices:g});return d.reverse(),d}var import_ag_charts_community45=require("ag-charts-community");function getYValueAtX({span:e},t){switch(e.type){case"linear":case"step":case"multi-line":{const i=(t-e.x0)/(e.x1-e.x0);return e.y0+i*(e.y1-e.y0)}case"cubic":{const{cp0x:i,cp0y:s,cp1x:a,cp1y:o,cp2x:r,cp2y:n,cp3x:l,cp3y:c}=e;let h=.5;const p=1e-6;for(let g=0;g<10;g++){const d=1-h,y=d*d*d*i+3*d*d*h*a+3*d*h*h*r+h*h*h*l-t;if(Math.abs(y)=o.x&&t<=r.x)return{span:a,index:s};if(tl;return{intersection:s===c?null:{x:i,y:n},spanIndex:o.index,isInverted:c}}function findRangeAreaIntersections(e,t,i,s,a=!1){if(e.length===0||t.length===0)return[];const o=[];let r=a,n=0;for(let l=i;l<=s;l+=.5){const c=checkForIntersection(e,t,l,r,n);c.intersection&&o.push(c.intersection.x),n=c.spanIndex,r=c.isInverted}return o}function calculateIntersectionSegments(e,t,i,s,a={}){const o=Math.max(t.x,i.width-(t.x+t.width)),r=Math.max(t.y,i.height-(t.y+t.height)),n=[],l=(h,p)=>({x0:h,y0:-r,x1:p,y1:t.height+r});s&&n.push({clipRect:l(-o,e[0]??t.width+o),...a});const c=s?1:0;for(let h=c;h{plotInterpolatedLinePathStroke(l,c,t.removed),plotInterpolatedLinePathStroke(l,c,i.removed)},o=(l,c)=>{plotInterpolatedLinePathStroke(l,c,t.moved),plotInterpolatedLinePathStroke(l,c,i.moved)},r=(l,c)=>{plotInterpolatedLinePathStroke(l,c,t.added),plotInterpolatedLinePathStroke(l,c,i.added)},n=prepareLinePathPropertyAnimation(e,s);return{status:e,path:{addPhaseFn:r,updatePhaseFn:o,removePhaseFn:a},pathProperties:n}}function prepareRangeAreaPathAnimation(e,t,i){const s=e.scales.x?.type==="category",a=t.scales.x?.type==="category";if(s!==a||!isScaleValid(e.scales.x)||!isScaleValid(t.scales.x))return;let o="updated";t.visible&&!e.visible?o="removed":!t.visible&&e.visible&&(o="added");const r=pairUpSpans({scales:e.scales,data:e.fillData.spans},{scales:t.scales,data:t.fillData.spans},CollapseMode.Split);if(r==null)return;const n=pairUpSpans({scales:e.scales,data:e.fillData.phantomSpans},{scales:t.scales,data:t.fillData.phantomSpans},CollapseMode.Split);if(n==null)return;const l=pairUpSpans({scales:e.scales,data:e.highStrokeData.spans},{scales:t.scales,data:t.highStrokeData.spans},CollapseMode.Split);if(l==null)return;const c=pairUpSpans({scales:e.scales,data:e.lowStrokeData.spans},{scales:t.scales,data:t.lowStrokeData.spans},CollapseMode.Split);if(c==null)return;const h="fade",p=prepareAreaFillAnimationFns(o,r,n,h),u=prepareRangeAreaPathStrokeAnimationFns(o,l,c,h),g=(i?.changed??!0)||!areScalingEqual(e.scales.x,t.scales.x)||!areScalingEqual(e.scales.y,t.scales.y)||o!=="updated";return{status:o,fill:p,stroke:u,hasMotion:g}}var{valueProperty:valueProperty4,keyProperty:keyProperty3,ChartAxisDirection:ChartAxisDirection10,mergeDefaults:mergeDefaults5,updateLabelNode:updateLabelNode2,fixNumericExtent:fixNumericExtent3,buildResetPathFn,resetLabelFn,resetMarkerFn,resetMarkerPositionFn,pathSwipeInAnimation,resetMotion,markerSwipeScaleInAnimation,seriesLabelFadeInAnimation,animationValidation:animationValidation3,diff:diff3,updateClipPath,computeMarkerFocusBounds,plotAreaPathFill,plotLinePathStroke,interpolatePoints,pathFadeInAnimation,markerFadeInAnimation,fromToMotion,pathMotion,extent,applyShapeFillBBox:applyShapeFillBBox2,PointerEvents:PointerEvents2,Marker,BBox:BBox5,findMinMax:findMinMax2,applyShapeStyle:applyShapeStyle4,processedDataIsAnimatable:processedDataIsAnimatable2,simpleMemorize2:simpleMemorize22,markerEnabled,getMarkerStyles,calculateSegments:calculateSegments2,toHighlightString:toHighlightString2,HighlightState:HighlightState2}=import_ag_charts_community48._ModuleSupport,memoizedAggregateRangeAreaData=simpleMemorize22(aggregateRangeAreaData),RangeAreaSeriesNodeEvent=class extends import_ag_charts_community48._ModuleSupport.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.yLowKey=s.properties.yLowKey,this.yHighKey=s.properties.yHighKey}},BaseSeries=import_ag_charts_community48._ModuleSupport.CartesianSeries,RangeAreaSeries=class extends BaseSeries{constructor(e){super({moduleCtx:e,pathsPerSeries:["fill","lowStroke","highStroke"],pickModes:[import_ag_charts_community48._ModuleSupport.SeriesNodePickMode.AXIS_ALIGNED],propertyKeys:{[ChartAxisDirection10.X]:["xKey"],[ChartAxisDirection10.Y]:["yLowKey","yHighKey"]},propertyNames:{[ChartAxisDirection10.X]:["xName"],[ChartAxisDirection10.Y]:["yLowName","yHighName","yName"]},categoryKey:"xValue",animationResetFns:{path:buildResetPathFn({getVisible:()=>this.visible,getOpacity:()=>this.getOpacity()}),label:resetLabelFn,datum:(t,i)=>({...resetMarkerFn(t),...resetMarkerPositionFn(t,i)})},clipFocusBox:!1}),this.properties=new RangeAreaProperties,this.NodeEvent=RangeAreaSeriesNodeEvent,this.dataAggregationFilters=void 0}async processData(e){const{xKey:t,yLowKey:i,yHighKey:s}=this.properties,a=this.axes[ChartAxisDirection10.X]?.scale,o=this.axes[ChartAxisDirection10.Y]?.scale,{xScaleType:r,yScaleType:n}=this.getScaleInformation({xScale:a,yScale:o}),l=[],c=!this.ctx.animationManager.isSkipped();!this.ctx.animationManager.isSkipped()&&this.processedData&&l.push(diff3(this.id,this.processedData)),c&&l.push(animationValidation3());const{dataModel:h,processedData:p}=await this.requestDataModel(e,this.data,{props:[keyProperty3(t,r,{id:"xValue"}),valueProperty4(i,n,{id:"yLowValue"}),valueProperty4(s,n,{id:"yHighValue"}),...l]});this.dataAggregationFilters=this.aggregateData(h,p),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||processedDataIsAnimatable2(t))return;const i=this.axes[ChartAxisDirection10.X];if(i==null)return;const s=e.resolveKeysById(this,"xValue",t),a=e.resolveColumnById(this,"yHighValue",t),o=e.resolveColumnById(this,"yLowValue",t),{index:r}=e.resolveProcessedDataDefById(this,"xValue"),n=t.domain.keys[r],l=e.resolveColumnNeedsValueOf(this,"xValue",t),c=e.resolveColumnNeedsValueOf(this,"yHighValue",t);return memoizedAggregateRangeAreaData(i.scale.type,s,a,o,n,l,c)}xCoordinateRange(e){const t=this.axes[ChartAxisDirection10.X].scale.convert(e);return[t,t]}yCoordinateRange(e){const t=this.axes[ChartAxisDirection10.Y].scale.convert(e[0]);return[t,t]}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];const{domain:{keys:[s]}}=t;if(e===ChartAxisDirection10.X){const a=i.resolveProcessedDataDefById(this,"xValue");return a?.def.type==="key"&&a.def.valueType==="category"?s:fixNumericExtent3(extent(s))}else{const a=this.domainForClippedRange(ChartAxisDirection10.Y,["yHighValue","yLowValue"],"xValue"),o=findMinMax2(a);return fixNumericExtent3(o)}}getSeriesRange(e,t){return this.domainForVisibleRange(ChartAxisDirection10.Y,["yHighValue","yLowValue"],"xValue",t)}createNodeData(){const{data:e,dataModel:t,processedData:i,axes:s}=this,a=s[ChartAxisDirection10.X],o=s[ChartAxisDirection10.Y];if(!(e&&a&&o&&t&&i&&this.chart?.seriesRect))return;const r=a.scale,n=o.scale,{xKey:l,yLowKey:c,yHighKey:h,connectMissingData:p,interpolation:u,fill:g,fillOpacity:d,item:m}=this.properties,y=i.dataSources.get(this.id)?.data??[],f=(r.bandwidth??0)/2,S=t.resolveKeysById(this,"xValue",i),b=t.resolveColumnById(this,"yHighValue",i),x=t.resolveColumnById(this,"yLowValue",i),v=V=>r.convert(S[V])+f,_=[],D=[],k=[],A=(V,W,z)=>{const Y=y[V],q=S[V];if(q==null)return;const $=k.at(-1);if(Number.isFinite(W)&&Number.isFinite(z)){const U=(Q,J,ie)=>{const{size:ee}=m[Q].marker;D.push({index:V,series:this,itemId:Q,datum:Y,datumIndex:V,midPoint:{x:H,y:ie},yHighValue:W,yLowValue:z,xValue:q,xKey:l,yLowKey:c,yHighKey:h,point:{x:H,y:ie,size:ee},enabled:!0});const se=this.createLabelData({datumIndex:V,point:{x:H,y:ie},value:J,yLowValue:z,yHighValue:W,itemId:Q,inverted:j,datum:Y,series:this});_.push(se)},j=z>W,H=v(V),te=n.convert(W),Z=n.convert(z);U("high",W,te),U("low",z,Z);const X={high:{point:{x:H,y:te},xDatum:q,yDatum:W},low:{point:{x:H,y:Z},xDatum:q,yDatum:z}};Array.isArray($)?$.push(X):$==null?k.push([X]):($.skip+=1,k.push([X]))}else p||(Array.isArray($)||$==null?k.push({skip:0}):$.skip+=1)},{dataAggregationFilters:L}=this,[R,O]=r.range,B=Math.abs(O-R),C=L?.find(V=>V.maxRange>B),w=C?.topIndices,M=C?.bottomIndices;let[T,N]=this.visibleRangeIndices("xValue",a.range,w);T=Math.max(T-1,0),N=Math.min(N+1,w?.length??S.length),i.input.count<1e3&&(T=0,N=i.input.count);for(let V=T;V{if(!Array.isArray(V))return[];const W=V.map(z=>z.high);return interpolatePoints(W,u)}),P=k.flatMap(V=>{if(!Array.isArray(V))return[];const W=V.map(z=>z.low);return interpolatePoints(W,u)}),F=calculateSegments2(this.properties.segmentation,a,o,this.chart.seriesRect,this.ctx.scene,!1);let E;if(this.properties.invertedStyle.enabled){const V=b[0]{const W=m[V],{stroke:z,strokeWidth:Y,strokeOpacity:q}=W,$={fill:g,fillOpacity:d,stroke:z,strokeWidth:Y,strokeOpacity:q};return getMarkerStyles(this,W,W.marker,$)};return{itemId:`${c}-${h}`,labelData:_,nodeData:D,fillData:{itemId:"high",spans:I,phantomSpans:P},highStrokeData:{itemId:"high",spans:I},lowStrokeData:{itemId:"low",spans:P},scales:this.calculateScaling(),visible:this.visible,styles:{low:G("low"),high:G("high")},segments:F,intersectionSegments:E}}createLabelData({datumIndex:e,point:t,value:i,itemId:s,inverted:a,datum:o,series:r}){const{xKey:n,yLowKey:l,yHighKey:c,xName:h,yName:p,yLowName:u,yHighName:g,legendItemName:d,label:m}=this.properties,{placement:y}=m,f=m.spacing+(typeof m.padding=="number"?m.padding:0);let S=s;a&&(S=s==="low"?"high":"low");const b=y==="outside"&&S==="high"||y==="inside"&&S==="low"?-1:1,x=this.getSeriesDomain(ChartAxisDirection10.Y);return{x:t.x,y:t.y+f*b,series:r,itemId:s,datum:o,datumIndex:e,text:this.getLabelText(i,o,s==="high"?c:l,"y",x,m,{value:i,datum:o,itemId:s,xKey:n,yLowKey:l,yHighKey:c,xName:h,yLowName:u,yHighName:g,yName:p,legendItemName:d}),textAlign:"center",textBaseline:b===-1?"bottom":"top"}}isPathOrSelectionDirty(){const{low:e,high:t}=this.properties.item;return e.marker.isDirty()||t.marker.isDirty()}strokewidthChange(){const e=t=>{const i=this.properties.item[t].strokeWidth??0,s=this.properties.highlight.highlightedSeries.item?.[t]?.strokeWidth??i,a=this.properties.highlight.highlightedItem.item?.[t]?.strokeWidth??i;return i>a||s>a};return e("low")||e("high")}updatePathNodes(e){const{visible:t}=e,[i,s,a]=e.paths,o=this.contextNodeData?.segments,r=this.ctx.highlightManager?.getActiveHighlight(),n=this.getHighlightState(r,!1),l=this.getHighlightStyle(),{item:c,fill:h,fillOpacity:p,opacity:u}=mergeDefaults5(l,this.getStyle(!1,n));s.setProperties({datum:o,segments:o,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:PointerEvents2.None,stroke:c.low.stroke,strokeWidth:c.low.strokeWidth,strokeOpacity:c.low.strokeOpacity,lineDash:c.low.lineDash,lineDashOffset:c.low.lineDashOffset,opacity:u,visible:t}),a.setProperties({segments:o,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:PointerEvents2.None,stroke:c.high.stroke,strokeWidth:c.high.strokeWidth,strokeOpacity:c.high.strokeOpacity,lineDash:c.high.lineDash,lineDashOffset:c.high.lineDashOffset,opacity:u,visible:t});const g=this.getShapeFillBBox();applyShapeFillBBox2(i,h,g),applyShapeStyle4(i,{stroke:void 0,fill:h,fillOpacity:p,opacity:u},g);const d=this.contextNodeData?.intersectionSegments??o;i.setProperties({segments:d,pointerEvents:PointerEvents2.None,lineJoin:"round",fillShadow:this.properties.shadow,opacity:u,visible:t}),i.datum=d,updateClipPath(this,i),updateClipPath(this,s),updateClipPath(this,a)}updatePaths(e){this.updateAreaPaths(e.paths,e.contextData)}updateAreaPaths(e,t){for(const i of e)i.visible=t.visible;if(t.visible)this.updateFillPath(e,t),this.updateStrokePath(e,t);else for(const i of e)i.path.clear(),i.markDirty("RangeArea")}updateFillPath(e,t){const[i]=e;i.path.clear(),plotAreaPathFill(i,t.fillData),i.markDirty("RangeArea")}updateStrokePath(e,t){const[,i,s]=e;i.path.clear(),s.path.clear(),plotLinePathStroke(i,t.lowStrokeData.spans),plotLinePathStroke(s,t.highStrokeData.spans),i.markDirty("RangeArea"),s.markDirty("RangeArea")}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,{processedData:s,axes:a,properties:o}=this,r=o.styler?this.getStylerMarkerOptions().item:o.item,{low:n,high:l}=r,c=markerEnabled(s.input.count,a[ChartAxisDirection10.X].scale,{enabled:n.marker.enabled||l.marker.enabled});(o.item.low.marker.isDirty()||o.item.high.marker.isDirty())&&(i.clear(),i.cleanup());let h;if(c)if(n.marker.enabled&&l.marker.enabled)h=t;else{h=[];for(const p of t)r[p.itemId].marker.enabled&&h.push(p)}else h=[];return i.update(h)}updateDatumStyles({datumSelection:e,isHighlight:t}){const i=this.ctx.highlightManager.getActiveHighlight();e.each((s,a)=>{const o=this.getHighlightState(i,t,a.datumIndex),r=this.getStyle(t,o),{fill:n,fillOpacity:l,item:c}=r,{stroke:h,strokeWidth:p,strokeOpacity:u}=c[a.itemId],{marker:g}=this.properties.item[a.itemId],d=this.makeItemStylerParams(a.itemId);a.style=this.getMarkerStyle(g,a,d,{isHighlight:t,highlightState:o,resolveMarkerSubPath:["item",a.itemId,"marker"]},r.item[a.itemId].marker,{fill:n,fillOpacity:l,stroke:h,strokeWidth:p,strokeOpacity:u})})}updateDatumNodes(e){const{contextNodeData:t}=this;if(!t)return;const{datumSelection:i,isHighlight:s}=e,a=this.getShapeFillBBox(),o=this.ctx.highlightManager.getActiveHighlight();i.each((r,n)=>{const{itemId:l}=n,c=n.style??t.styles[l][this.getHighlightState(o,s,n.datumIndex)];this.applyMarkerStyle(c,r,n.point,a)}),s||(this.properties.item.low.marker.markClean(),this.properties.item.high.marker.markClean())}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;return i.update(t,s=>{s.pointerEvents=PointerEvents2.None})}updateLabelNodes(e){const t={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yName:this.properties.yName,yLowKey:this.properties.yLowKey,yLowName:this.properties.yLowName??this.properties.yLowKey,yHighKey:this.properties.yHighKey,yHighName:this.properties.yHighName??this.properties.yHighKey,legendItemName:this.properties.legendItemName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,a)=>{s.fillOpacity=this.getHighlightStyle(!1,a.datumIndex).opacity??1,updateLabelNode2(this,s,t,this.properties.label,a,!1,i)})}getHighlightData(e,t){const i=e.filter(s=>s.datum===t.datum);return i.length>0?i:void 0}getStyle(e,t){return this.getStylerCouple(e,t)[0]}getStylerMarkerOptions(){return this.getStylerCouple(!1)[1]}getStylerCouple(e,t){const{fill:i,fillOpacity:s,item:a,styler:o}=this.properties;let r={};if(o){const h=this.makeStylerParams(e,t);r=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(o,h)??{},{pick:!1})??{}}const n={item:{low:{marker:{enabled:!1}},high:{marker:{enabled:!1}}}},l=h=>{const p=r.item?.[h],{lineDash:u,lineDashOffset:g,marker:d,stroke:m,strokeOpacity:y,strokeWidth:f}=a[h];return n.item[h].marker.enabled=p?.marker?.enabled??d.enabled,{marker:{fill:p?.marker?.fill??d.fill??i,fillOpacity:p?.marker?.fillOpacity??d.fillOpacity,shape:p?.marker?.shape??d.shape,size:p?.marker?.size??d.size,lineDash:p?.marker?.lineDash??d.lineDash,lineDashOffset:p?.marker?.lineDashOffset??d.lineDashOffset,stroke:p?.marker?.stroke??d.stroke??m,strokeOpacity:p?.marker?.strokeOpacity??d.strokeOpacity,strokeWidth:p?.marker?.strokeWidth??d.strokeWidth},lineDash:p?.lineDash??u,lineDashOffset:p?.lineDashOffset??g,stroke:p?.stroke??m,strokeOpacity:p?.strokeOpacity??y,strokeWidth:p?.strokeWidth??f}};return[{fill:r.fill??i,fillOpacity:r.fillOpacity??s,opacity:1,topLevel:{lineDash:this.properties.lineDash,lineDashOffset:this.properties.lineDashOffset,marker:this.properties.marker,stroke:this.properties.stroke,strokeOpacity:this.properties.strokeOpacity,strokeWidth:this.properties.strokeWidth},item:{low:l("low"),high:l("high")}},n]}makeStylerParams(e,t){const{id:i}=this,{fill:s,fillOpacity:a,item:o,xKey:r,yHighKey:n,yLowKey:l}=this.properties,c=toHighlightString2(t??HighlightState2.None),h=p=>{const{lineDash:u,lineDashOffset:g,marker:d,stroke:m,strokeOpacity:y,strokeWidth:f}=o[p];return{marker:{fill:d.fill??s,fillOpacity:d.fillOpacity,size:d.size,shape:d.shape,stroke:d.stroke??m,strokeOpacity:d.strokeOpacity,strokeWidth:d.strokeWidth,lineDash:d.lineDash,lineDashOffset:d.lineDashOffset},lineDash:u,lineDashOffset:g,stroke:m,strokeOpacity:y,strokeWidth:f}};return{item:{low:h("low"),high:h("high")},fill:s,fillOpacity:a,highlightState:c,highlighted:e,seriesId:i,xKey:r,yLowKey:l,yHighKey:n}}makeItemStylerParams(e){const{xKey:t,yLowKey:i,yHighKey:s}=this.properties;return{xKey:t,yLowKey:i,yHighKey:s,itemId:e}}getTooltipContent(e,t){const i=t?.itemId??"high",{id:s,dataModel:a,processedData:o,axes:r,properties:n}=this,{xName:l,yName:c,yLowKey:h,yLowName:p,xKey:u,yHighKey:g,yHighName:d,tooltip:m,legendItemName:y}=n,f=r[ChartAxisDirection10.X],S=r[ChartAxisDirection10.Y];if(!a||!o||!f||!S)return;const b=o.dataSources.get(this.id)?.data[e],x=a.resolveKeysById(this,"xValue",o)[e],v=a.resolveColumnById(this,"yHighValue",o)[e],_=a.resolveColumnById(this,"yLowValue",o)[e];if(x==null)return;const D=this.getStyle(!1),k=this.makeItemStylerParams(i),A=this.getMarkerStyle(this.properties.item[i].marker,{datumIndex:e,datum:b},k,{isHighlight:!1,resolveMarkerSubPath:["item",i,"marker"]},D.item[i].marker),L=`${this.getAxisValueText(S,"tooltip",_,b,h,y)} - ${this.getAxisValueText(S,"tooltip",v,b,g,y)}`;return this.formatTooltipWithContext(m,{heading:this.getAxisValueText(f,"tooltip",x,b,u,y),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:`${p??h} - ${d??g}`,value:L}]},{seriesId:s,datum:b,title:c,itemId:i,xName:l,yName:c,yLowKey:h,yLowName:p,xKey:u,yHighKey:g,yHighName:d,legendItemName:y,...A})}legendItemSymbol(){const{fill:e,topLevel:t}=this.getStyle(!1),{stroke:i,strokeWidth:s,strokeOpacity:a,lineDash:o,marker:r}=t;return{marker:{shape:r.shape,fill:r.fill??e,stroke:r.stroke??i,fillOpacity:r.fillOpacity,strokeOpacity:r.strokeOpacity,strokeWidth:r.strokeWidth,lineDash:r.lineDash,lineDashOffset:r.lineDashOffset},line:{stroke:i,strokeOpacity:a,strokeWidth:s,lineDash:o}}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{yLowKey:s,yHighKey:a,yName:o,yLowName:r,yHighName:n,legendItemName:l,showInLegend:c}=this.properties,h=l??o??`${r??s} - ${n??a}`,p=`${s}-${a}`;return[{legendType:"category",id:t,itemId:p,seriesId:t,enabled:i,label:{text:`${h}`},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!c}]}isLabelEnabled(){return this.properties.label.enabled}onDataChange(){}nodeFactory(){return new Marker}animateEmptyUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:s,paths:a}=e,{animationManager:o}=this.ctx;this.updateAreaPaths(a,s),pathSwipeInAnimation(this,o,...a),resetMotion([t],resetMarkerPositionFn),markerSwipeScaleInAnimation(this,o,t),seriesLabelFadeInAnimation(this,"labels",o,i)}animateReadyResize(e){const{contextData:t,paths:i}=e;this.updateAreaPaths(i,t),super.animateReadyResize(e)}animateWaitingUpdateReady(e){const{animationManager:t}=this.ctx,{datumSelection:i,labelSelection:s,contextData:a,paths:o,previousContextData:r}=e,[n,l,c]=o;if(n==null&&l==null&&c==null)return;this.resetDatumAnimation(e),this.resetLabelAnimation(e);const h=()=>{this.resetPathAnimation(e),this.updateAreaPaths(o,a)},p=()=>{t.skipCurrentBatch(),h()};if(a==null||r==null){h(),markerFadeInAnimation(this,t,"added",i),pathFadeInAnimation(this,"fill_path_properties",t,"add",n),pathFadeInAnimation(this,"low_stroke_path_properties",t,"add",l),pathFadeInAnimation(this,"high_stroke_path_properties",t,"add",c),seriesLabelFadeInAnimation(this,"labels",t,s);return}const u=prepareRangeAreaPathAnimation(a,r,this.processedData?.reduced?.diff?.[this.id]);if(u===void 0){p();return}else if(u.status==="no-op")return;fromToMotion(this.id,"fill_path_properties",t,[n],u.fill.pathProperties),fromToMotion(this.id,"low_stroke_path_properties",t,[l],u.stroke.pathProperties),fromToMotion(this.id,"high_stroke_path_properties",t,[c],u.stroke.pathProperties),u.status==="added"?this.updateAreaPaths(o,a):u.status==="removed"?this.updateAreaPaths(o,r):(pathMotion(this.id,"fill_path_update",t,[n],u.fill.path),pathMotion(this.id,"low_stroke_path_update",t,[l],u.stroke.path),pathMotion(this.id,"high_stroke_path_update",t,[c],u.stroke.path)),u.hasMotion&&(markerFadeInAnimation(this,t,void 0,i),seriesLabelFadeInAnimation(this,"labels",t,s)),this.ctx.animationManager.animate({id:this.id,groupId:"reset_after_animation",phase:"trailing",from:{},to:{},onComplete:()=>this.updateAreaPaths(o,a)})}getFormattedMarkerStyle(e){const t=this.getStyle(!1),i=this.makeItemStylerParams(e.itemId);return this.getMarkerStyle(this.properties.item[e.itemId].marker,e,i,{isHighlight:!0,resolveMarkerSubPath:["item",e.itemId,"marker"]},void 0,t)}getMarkerStyle(e,t,i,s,a,o){return e.itemStyler=this.properties.marker.itemStyler,super.getMarkerStyle(e,t,i,s,a,o)}computeFocusBounds(e){const t=computeMarkerFocusBounds(this,e),i=computeMarkerFocusBounds(this,{...e,datumIndex:e.datumIndex+1});if(t&&i)return BBox5.merge([t,i])}isDatumEnabled(e,t){return t%2===0&&super.isDatumEnabled(e,t)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};RangeAreaSeries.className="RangeAreaSeries",RangeAreaSeries.type="range-area";var import_ag_charts_community49=require("ag-charts-community"),import_ag_charts_core17=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs5,rangeAreaSeriesThemeableOptionsDef}=import_ag_charts_community49._ModuleSupport,rangeAreaSeriesOptionsDef={...commonSeriesOptionsDefs5,...rangeAreaSeriesThemeableOptionsDef,type:(0,import_ag_charts_core17.required)((0,import_ag_charts_core17.constant)("range-area")),xKey:(0,import_ag_charts_core17.required)(import_ag_charts_core17.string),yLowKey:(0,import_ag_charts_core17.required)(import_ag_charts_core17.string),yHighKey:(0,import_ag_charts_core17.required)(import_ag_charts_core17.string),xName:import_ag_charts_core17.string,yName:import_ag_charts_core17.string,yLowName:import_ag_charts_core17.string,yHighName:import_ag_charts_core17.string,legendItemName:import_ag_charts_core17.string,segmentation:import_ag_charts_core17.shapeSegmentation,invertedStyle:{enabled:import_ag_charts_core17.boolean,...import_ag_charts_core17.fillOptionsDef}};rangeAreaSeriesOptionsDef.pickOutsideVisibleMinorAxis=(0,import_ag_charts_core17.undocumented)(import_ag_charts_core17.boolean),rangeAreaSeriesOptionsDef.focusPriority=(0,import_ag_charts_core17.undocumented)(import_ag_charts_core17.number);var import_ag_charts_community50=require("ag-charts-community"),RANGE_AREA_ITEM={lineDash:{$path:"/series/$index/lineDash"},lineDashOffset:{$path:"/series/$index/lineDashOffset"},stroke:{$path:["/series/$index/stroke",{$palette:"stroke"}]},strokeOpacity:{$path:"/series/$index/strokeOpacity"},strokeWidth:{$path:["/series/$index/strokeWidth",1]},marker:{enabled:{$path:"/series/$index/marker/enabled"},fill:{$isUserOption:["/series/$index/marker/fill",{$if:[{$or:[{$isGradient:{$path:"/series/$index/marker/fill"}},{$isImage:{$path:"/series/$index/marker/fill"}},{$isPattern:{$path:"/series/$index/marker/fill"}}]},{$merge:[{$path:"/series/$index/marker/fill"},{$applySwitch:[{$path:"type"},void 0,["gradient",import_ag_charts_community50._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",import_ag_charts_community50._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community50._ModuleSupport.FILL_PATTERN_DEFAULTS]]}]},{$isUserOption:["/series/$index/marker/fill",{$path:"/series/$index/marker/fill"},{$palette:"fill"}]}]},{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community50._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",import_ag_charts_community50._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community50._ModuleSupport.FILL_PATTERN_DEFAULTS]]}]},fillOpacity:{$path:"/series/$index/marker/fillOpacity"},lineDash:{$path:"/series/$index/marker/lineDash"},lineDashOffset:{$path:"/series/$index/marker/lineDashOffset"},shape:{$path:"/series/$index/marker/shape"},size:{$path:["/series/$index/marker/size",6]},stroke:{$path:["/series/$index/marker/stroke",{$palette:"stroke"}]},strokeOpacity:{$path:"/series/$index/marker/strokeOpacity"},strokeWidth:{$path:["/series/$index/marker/strokeWidth",2]}}},RANGE_AREA_SERIES_THEME={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community50._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["pattern",import_ag_charts_community50._ModuleSupport.FILL_PATTERN_DEFAULTS]]},fillOpacity:.7,stroke:{$palette:"stroke"},strokeWidth:1,marker:{enabled:!1,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community50._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",import_ag_charts_community50._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community50._ModuleSupport.FILL_PATTERN_DEFAULTS]]},shape:"circle",stroke:{$palette:"stroke"},size:6,strokeWidth:2},nodeClickRange:"nearest",item:{low:RANGE_AREA_ITEM,high:RANGE_AREA_ITEM},label:{...import_ag_charts_community50._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,placement:"outside",padding:{$isUserOption:["./spacing",0,10]},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},interpolation:{type:"linear"},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:import_ag_charts_community50._ModuleSupport.multiSeriesHighlightStyle(),segmentation:import_ag_charts_community50._ModuleSupport.SEGMENTATION_DEFAULTS,invertedStyle:{enabled:!1,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community50._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["image",import_ag_charts_community50._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community50._ModuleSupport.FILL_PATTERN_DEFAULTS]]},fillOpacity:{$path:"../fillOpacity"}}},axes:{[import_ag_charts_community50._ModuleSupport.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{enabled:!0}}}},{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE6,CARTESIAN_POSITION:CARTESIAN_POSITION4}}=import_ag_charts_community51._ModuleSupport,RangeAreaModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"range-area",moduleFactory:e=>new RangeAreaSeries(e),predictAxis:import_ag_charts_community51._ModuleSupport.predictCartesianTimeAxis,defaultAxes:[{type:CARTESIAN_AXIS_TYPE6.NUMBER,position:CARTESIAN_POSITION4.LEFT},{type:CARTESIAN_AXIS_TYPE6.CATEGORY,position:CARTESIAN_POSITION4.BOTTOM}],themeTemplate:RANGE_AREA_SERIES_THEME},RangeAreaSeriesModule={type:"series",name:"range-area",chartType:"cartesian",enterprise:!0,options:rangeAreaSeriesOptionsDef,create:e=>new RangeAreaSeries(e)},import_ag_charts_community57=require("ag-charts-community"),import_ag_charts_community54=require("ag-charts-community"),import_ag_charts_community52=require("ag-charts-community"),{aggregationDomain:aggregationDomain3,aggregationRangeFittingPoints:aggregationRangeFittingPoints3,compactAggregationIndices:compactAggregationIndices3,createAggregationIndices:createAggregationIndices3}=import_ag_charts_community52._ModuleSupport,AGGREGATION_THRESHOLD3=1e3;function aggregateRangeBarData(e,t,i,s,a,o){if(t.length64;)({indexData:c,valueData:h,maxRange:l}=compactAggregationIndices3(c,h,l)),p.push({maxRange:l,indexData:c});return p.reverse(),p}var import_ag_charts_community53=require("ag-charts-community"),{AbstractBarSeriesProperties:AbstractBarSeriesProperties3,makeSeriesTooltip:makeSeriesTooltip6,Property:Property18,DropShadow:DropShadow2,Label:Label2}=import_ag_charts_community53._ModuleSupport,RangeBarSeriesLabel=class extends Label2{constructor(){super(...arguments),this.placement="inside",this.spacing=0}};__decorateClass([Property18],RangeBarSeriesLabel.prototype,"placement",2),__decorateClass([Property18],RangeBarSeriesLabel.prototype,"spacing",2);var RangeBarProperties=class extends AbstractBarSeriesProperties3{constructor(){super(...arguments),this.fill="#99CCFF",this.fillOpacity=1,this.stroke="#99CCFF",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.shadow=new DropShadow2().set({enabled:!1}),this.label=new RangeBarSeriesLabel,this.tooltip=makeSeriesTooltip6()}};__decorateClass([Property18],RangeBarProperties.prototype,"xKey",2),__decorateClass([Property18],RangeBarProperties.prototype,"yLowKey",2),__decorateClass([Property18],RangeBarProperties.prototype,"yHighKey",2),__decorateClass([Property18],RangeBarProperties.prototype,"xName",2),__decorateClass([Property18],RangeBarProperties.prototype,"yName",2),__decorateClass([Property18],RangeBarProperties.prototype,"yLowName",2),__decorateClass([Property18],RangeBarProperties.prototype,"yHighName",2),__decorateClass([Property18],RangeBarProperties.prototype,"fill",2),__decorateClass([Property18],RangeBarProperties.prototype,"fillOpacity",2),__decorateClass([Property18],RangeBarProperties.prototype,"stroke",2),__decorateClass([Property18],RangeBarProperties.prototype,"strokeWidth",2),__decorateClass([Property18],RangeBarProperties.prototype,"strokeOpacity",2),__decorateClass([Property18],RangeBarProperties.prototype,"lineDash",2),__decorateClass([Property18],RangeBarProperties.prototype,"lineDashOffset",2),__decorateClass([Property18],RangeBarProperties.prototype,"cornerRadius",2),__decorateClass([Property18],RangeBarProperties.prototype,"styler",2),__decorateClass([Property18],RangeBarProperties.prototype,"itemStyler",2),__decorateClass([Property18],RangeBarProperties.prototype,"shadow",2),__decorateClass([Property18],RangeBarProperties.prototype,"label",2),__decorateClass([Property18],RangeBarProperties.prototype,"tooltip",2);var{SeriesNodePickMode:SeriesNodePickMode4,valueProperty:valueProperty5,keyProperty:keyProperty4,ChartAxisDirection:ChartAxisDirection11,checkCrisp,updateLabelNode:updateLabelNode3,SMALLEST_KEY_INTERVAL:SMALLEST_KEY_INTERVAL3,LARGEST_KEY_INTERVAL,diff:diff4,prepareBarAnimationFunctions,midpointStartingBarPosition,resetBarSelectionsFn,fixNumericExtent:fixNumericExtent4,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation2,resetLabelFn:resetLabelFn2,animationValidation:animationValidation4,computeBarFocusBounds:computeBarFocusBounds4,visibleRangeIndices:visibleRangeIndices2,createDatumId:createDatumId4,ContinuousScale:ContinuousScale3,Rect:Rect2,PointerEvents:PointerEvents3,motion:motion2,applyShapeStyle:applyShapeStyle5,findMinMax:findMinMax3,areScalingEqual:areScalingEqual2,processedDataIsAnimatable:processedDataIsAnimatable3,AGGREGATION_SPAN:AGGREGATION_SPAN2,AGGREGATION_INDEX_X_MAX:AGGREGATION_INDEX_X_MAX2,AGGREGATION_INDEX_X_MIN:AGGREGATION_INDEX_X_MIN2,AGGREGATION_INDEX_Y_MAX:AGGREGATION_INDEX_Y_MAX3,AGGREGATION_INDEX_Y_MIN:AGGREGATION_INDEX_Y_MIN3,mergeDefaults:mergeDefaults6,simpleMemorize2:simpleMemorize23,getItemStyles:getItemStyles2,calculateSegments:calculateSegments3,toHighlightString:toHighlightString3,HighlightState:HighlightState3}=import_ag_charts_community54._ModuleSupport,memoizedAggregateRangeBarData=simpleMemorize23(aggregateRangeBarData),RangeBarSeriesNodeEvent=class extends import_ag_charts_community54._ModuleSupport.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.yLowKey=s.properties.yLowKey,this.yHighKey=s.properties.yHighKey}},RangeBarSeries=class extends import_ag_charts_community54._ModuleSupport.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[SeriesNodePickMode4.AXIS_ALIGNED,SeriesNodePickMode4.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["yLowKey","yHighKey"]},propertyNames:{x:["xName"],y:["yLowName","yHighName","yName"]},categoryKey:"xValue",datumSelectionGarbageCollection:!1,animationResetFns:{datum:resetBarSelectionsFn,label:resetLabelFn2}}),this.properties=new RangeBarProperties,this.dataAggregationFilters=void 0,this.NodeEvent=RangeBarSeriesNodeEvent}async processData(e){const{xKey:t,yLowKey:i,yHighKey:s}=this.properties,a=this.getCategoryAxis()?.scale,o=this.getValueAxis()?.scale,{isContinuousX:r,xScaleType:n,yScaleType:l}=this.getScaleInformation({xScale:a,yScale:o}),c=[];this.ctx.animationManager.isSkipped()||(this.processedData&&c.push(diff4(this.id,this.processedData)),c.push(animationValidation4()));const h=this.visible?{}:{forceValue:0},{dataModel:p,processedData:u}=await this.requestDataModel(e,this.data,{props:[keyProperty4(t,n,{id:"xValue"}),valueProperty5(i,l,{id:"yLowValue",invalidValue:null,...h}),valueProperty5(s,l,{id:"yHighValue",invalidValue:null,...h}),...r?[SMALLEST_KEY_INTERVAL3,LARGEST_KEY_INTERVAL]:[],...c],groupByKeys:!1});this.smallestDataInterval=u.reduced?.smallestKeyInterval,this.largestDataInterval=u.reduced?.largestKeyInterval,this.dataAggregationFilters=this.aggregateData(p,u),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||processedDataIsAnimatable3(t))return;const i=this.axes[ChartAxisDirection11.X];if(i==null)return;const s=e.resolveKeysById(this,"xValue",t),a=e.resolveColumnById(this,"yHighValue",t),o=e.resolveColumnById(this,"yLowValue",t),{index:r}=e.resolveProcessedDataDefById(this,"xValue"),n=t.domain.keys[r];return memoizedAggregateRangeBarData(i.scale.type,s,a,o,n,t.reduced?.smallestKeyInterval)}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!t||!i)return[];const{keys:[s]}=t.domain;if(e===this.getCategoryDirection()){const a=i.resolveProcessedDataDefById(this,"xValue");return a?.def.type==="key"&&a?.def.valueType==="category"?s:this.padBandExtent(s)}else{const a=this.domainForClippedRange(e,["yHighValue","yLowValue"],"xValue"),o=findMinMax3(a);return fixNumericExtent4(o)}}getSeriesRange(e,t){return this.domainForVisibleRange(ChartAxisDirection11.Y,["yHighValue","yLowValue"],"xValue",t)}createNodeData(){const{data:e,dataModel:t,groupScale:i,processedData:s,visible:a}=this,o=this.getCategoryAxis(),r=this.getValueAxis();if(!(e&&o&&r&&t&&s?.dataSources&&this.chart?.seriesRect))return;const n=o.scale,l=r.scale,c=this.getBarDirection()===ChartAxisDirection11.X,{xKey:h,yLowKey:p,yHighKey:u,strokeWidth:g}=this.properties,d=`${p}-${u}`,m=calculateSegments3(this.properties.segmentation,o,r,this.chart.seriesRect,this.ctx.scene),y={itemId:d,nodeData:[],labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:getItemStyles2(this.getItemStyle.bind(this)),segments:m};if(!a)return y;const f=s.dataSources.get(this.id)?.data??[],S=t.resolveKeysById(this,"xValue",s),b=t.resolveColumnById(this,"yLowValue",s),x=t.resolveColumnById(this,"yHighValue",s),{barWidth:v,groupIndex:_}=this.updateGroupScale(o),D=ContinuousScale3.is(n)?v*-.5:0,k=i.convert(String(_)),A=checkCrisp(o?.scale,o?.visibleRange,this.smallestDataInterval,this.largestDataInterval),L=T=>Math.round(n.convert(S[T]))+k+D,R=(T,N,I,P,F,E,G)=>{const K=f[T],V=S[T];if(V==null)return;const W=b[T],z=x[T];if(!Number.isFinite(W?.valueOf())||!Number.isFinite(z?.valueOf()))return;const[Y,q]=WT.maxRange>w);if(M!=null){const{maxRange:T,indexData:N}=M,[I,P]=visibleRangeIndices2(1,T,o.range,F=>{const E=F*AGGREGATION_SPAN2,G=N[E+AGGREGATION_INDEX_X_MIN2],K=N[E+AGGREGATION_INDEX_X_MAX2];if(G===-1)return;const V=Math.trunc((G+K)/2);return[L(V),L(K)+v]});for(let F=I;Fthis.getDatumId(a))}getItemStyle(e,t,i){const{properties:s,dataModel:a,processedData:o}=this,{itemStyler:r}=s,n=this.getHighlightStyle(t,e,i);let l=mergeDefaults6(n,this.getStyle(e===void 0,t,i));if(r&&a!=null&&o!=null&&e!=null){const c=a.resolveKeysById(this,"xValue",o)[e],h=this.cachedDatumCallback(createDatumId4(this.getDatumId({xValue:c}),t?"highlight":"node"),()=>{const p=this.makeItemStylerParams(e,t,l);return this.callWithContext(r,p)});h&&(l=mergeDefaults6(h,l))}return l}makeItemStylerParams(e,t,i){const{id:s,properties:a,processedData:o}=this,{xKey:r,yHighKey:n,yLowKey:l}=a,c=o.dataSources.get(s)?.data[e],h=this.ctx.highlightManager?.getActiveHighlight(),p=this.getHighlightStateString(h,t,e),u=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:c,xKey:r,yHighKey:n,yLowKey:l,highlighted:t,highlightState:p,...i,fill:u}}updateDatumStyles(e){const t=this.ctx.highlightManager.getActiveHighlight();e.datumSelection.each((i,s)=>{if(!e.datumSelection.isGarbage(i)){const a=this.getHighlightState(t,e.isHighlight,s.datumIndex);s.style=this.getItemStyle(s.datumIndex,e.isHighlight,a)}})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight(),a=this.getCategoryDirection()===ChartAxisDirection11.X,o=this.getShapeFillBBox();e.each((r,n)=>{const l=n.style??i.styles[this.getHighlightState(s,t,n.datumIndex)];applyShapeStyle5(r,l,o),r.cornerRadius=l.cornerRadius??0,r.visible=a?n.width>0:n.height>0,r.crisp=n.crisp})}updateLabelSelection(e){const t=this.properties.label.enabled?e.labelData:[];return e.labelSelection.update(t,i=>{i.pointerEvents=PointerEvents3.None})}updateLabelNodes(e){const t={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yName:this.properties.yName,yLowKey:this.properties.yLowKey,yLowName:this.properties.yLowName??this.properties.yLowKey,yHighKey:this.properties.yHighKey,yHighName:this.properties.yHighName??this.properties.yHighKey,legendItemName:this.properties.legendItemName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,a)=>{s.fillOpacity=this.getHighlightStyle(!1,a?.datumIndex).opacity??1,updateLabelNode3(this,s,t,this.properties.label,a,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:a}=this,{xKey:o,xName:r,yName:n,yLowKey:l,yHighKey:c,yLowName:h,yHighName:p,tooltip:u,legendItemName:g}=a,d=this.getCategoryAxis(),m=this.getValueAxis();if(!i||!s||!d||!m)return;const y=s.dataSources.get(this.id)?.data[e],f=i.resolveKeysById(this,"xValue",s)[e],S=i.resolveColumnById(this,"yHighValue",s)[e],b=i.resolveColumnById(this,"yLowValue",s)[e];if(f==null)return;const x=this.getItemStyle(e,!1),v=`${this.getAxisValueText(m,"tooltip",b,y,l,g)} - ${this.getAxisValueText(m,"tooltip",S,y,c,g)}`;return this.formatTooltipWithContext(u,{heading:this.getAxisValueText(d,"tooltip",f,y,o,g),symbol:this.legendItemSymbol(),data:[{label:n,fallbackLabel:`${h??l} - ${p??c}`,value:v}]},{seriesId:t,datum:y,title:n,xKey:o,xName:r,yName:n,yLowKey:l,yHighKey:c,yLowName:h,yHighName:p,legendItemName:g,...x})}legendItemSymbol(){const{fill:e,stroke:t,strokeWidth:i,fillOpacity:s,strokeOpacity:a,lineDash:o,lineDashOffset:r}=this.getStyle(!1,!1,HighlightState3.None);return{marker:{fill:e,stroke:t,fillOpacity:s,strokeOpacity:a,strokeWidth:i,lineDash:o,lineDashOffset:r}}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{yName:s,yLowName:a,yHighName:o,yLowKey:r,yHighKey:n,legendItemName:l,showInLegend:c}=this.properties,h=l??s??`${a??r} - ${o??n}`,p=`${r}-${n}`;return[{legendType:"category",id:t,itemId:p,seriesId:t,enabled:i,label:{text:`${h}`},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!c}]}animateEmptyUpdateReady({datumSelection:e,labelSelection:t}){const i=prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(),"normal"),"unknown");motion2.fromToMotion(this.id,"datums",this.ctx.animationManager,[e],i),seriesLabelFadeInAnimation2(this,"labels",this.ctx.animationManager,t)}animateWaitingUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:s,previousContextData:a}=e,o=import_ag_charts_community54._ModuleSupport.calculateDataDiff(this.id,t,this.getDatumId.bind(this),s,a,this.processedData,this.processedDataUpdated);this.ctx.animationManager.stopByAnimationGroupId(this.id);const r=a==null?"fade":"normal",n=prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(),r),"added");motion2.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],n,(l,c)=>this.getDatumId(c),o),(o?.changed||!areScalingEqual2(s.groupScale,a?.groupScale))&&seriesLabelFadeInAnimation2(this,"labels",this.ctx.animationManager,i)}getDatumId(e){return`${e.xValue}`}isLabelEnabled(){return this.properties.label.enabled}onDataChange(){}computeFocusBounds({datumIndex:e}){return computeBarFocusBounds4(this,this.contextNodeData?.nodeData[e])}hasItemStylers(){return this.properties.styler!=null||this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};RangeBarSeries.className="RangeBarSeries",RangeBarSeries.type="range-bar";var import_ag_charts_community55=require("ag-charts-community"),import_ag_charts_core18=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs6,rangeBarSeriesThemeableOptionsDef}=import_ag_charts_community55._ModuleSupport,rangeBarSeriesOptionsDef={...commonSeriesOptionsDefs6,...rangeBarSeriesThemeableOptionsDef,type:(0,import_ag_charts_core18.required)((0,import_ag_charts_core18.constant)("range-bar")),xKey:(0,import_ag_charts_core18.required)(import_ag_charts_core18.string),yLowKey:(0,import_ag_charts_core18.required)(import_ag_charts_core18.string),yHighKey:(0,import_ag_charts_core18.required)(import_ag_charts_core18.string),xName:import_ag_charts_core18.string,yName:import_ag_charts_core18.string,yLowName:import_ag_charts_core18.string,yHighName:import_ag_charts_core18.string,legendItemName:import_ag_charts_core18.string,segmentation:import_ag_charts_core18.shapeSegmentation};rangeBarSeriesOptionsDef.pickOutsideVisibleMinorAxis=(0,import_ag_charts_core18.undocumented)(import_ag_charts_core18.boolean),rangeBarSeriesOptionsDef.focusPriority=(0,import_ag_charts_core18.undocumented)(import_ag_charts_core18.number);var import_ag_charts_community56=require("ag-charts-community"),RANGE_BAR_SERIES_THEME={series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community56._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["image",import_ag_charts_community56._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community56._ModuleSupport.FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{...import_ag_charts_community56._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},placement:"inside",padding:{$isUserOption:["./spacing",0,6]}},highlight:import_ag_charts_community56._ModuleSupport.multiSeriesHighlightStyle(),segmentation:import_ag_charts_community56._ModuleSupport.SEGMENTATION_DEFAULTS},axes:{[import_ag_charts_community56._ModuleSupport.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{enabled:!0}}}},RangeBarModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"range-bar",moduleFactory:e=>new RangeBarSeries(e),predictAxis:import_ag_charts_community57._ModuleSupport.predictCartesianTimeAxis,defaultAxes:import_ag_charts_community57._ModuleSupport.DIRECTION_SWAP_AXES,themeTemplate:RANGE_BAR_SERIES_THEME,groupable:!0},RangeBarSeriesModule={type:"series",name:"range-bar",chartType:"cartesian",enterprise:!0,options:rangeBarSeriesOptionsDef,create:e=>new RangeBarSeries(e)},import_ag_charts_community62=require("ag-charts-community"),import_ag_charts_community59=require("ag-charts-community"),import_ag_charts_community58=require("ag-charts-community"),{AbstractBarSeriesProperties:AbstractBarSeriesProperties4,BaseProperties:BaseProperties6,PropertiesArray,makeSeriesTooltip:makeSeriesTooltip7,Property:Property19,DropShadow:DropShadow3,Label:Label3}=import_ag_charts_community58._ModuleSupport,WaterfallSeriesTotal=class extends BaseProperties6{};__decorateClass([Property19],WaterfallSeriesTotal.prototype,"totalType",2),__decorateClass([Property19],WaterfallSeriesTotal.prototype,"index",2),__decorateClass([Property19],WaterfallSeriesTotal.prototype,"axisLabel",2);var WaterfallSeriesItemTooltip=class extends BaseProperties6{};__decorateClass([Property19],WaterfallSeriesItemTooltip.prototype,"renderer",2);var WaterfallSeriesLabel=class extends Label3{constructor(){super(...arguments),this.placement="outside-end",this.spacing=0}};__decorateClass([Property19],WaterfallSeriesLabel.prototype,"placement",2),__decorateClass([Property19],WaterfallSeriesLabel.prototype,"spacing",2);var WaterfallSeriesItem=class extends BaseProperties6{constructor(){super(...arguments),this.fill="#c16068",this.stroke="#c16068",this.fillOpacity=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.strokeWidth=1,this.cornerRadius=0,this.shadow=new DropShadow3().set({enabled:!1}),this.label=new WaterfallSeriesLabel,this.tooltip=new WaterfallSeriesItemTooltip}};__decorateClass([Property19],WaterfallSeriesItem.prototype,"name",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"fill",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"stroke",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"fillOpacity",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"strokeOpacity",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"lineDash",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"lineDashOffset",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"strokeWidth",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"cornerRadius",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"itemStyler",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"shadow",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"label",2),__decorateClass([Property19],WaterfallSeriesItem.prototype,"tooltip",2);var WaterfallSeriesConnectorLine=class extends BaseProperties6{constructor(){super(...arguments),this.enabled=!0,this.stroke="black",this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.strokeWidth=2}};__decorateClass([Property19],WaterfallSeriesConnectorLine.prototype,"enabled",2),__decorateClass([Property19],WaterfallSeriesConnectorLine.prototype,"stroke",2),__decorateClass([Property19],WaterfallSeriesConnectorLine.prototype,"strokeOpacity",2),__decorateClass([Property19],WaterfallSeriesConnectorLine.prototype,"lineDash",2),__decorateClass([Property19],WaterfallSeriesConnectorLine.prototype,"lineDashOffset",2),__decorateClass([Property19],WaterfallSeriesConnectorLine.prototype,"strokeWidth",2);var WaterfallSeriesItems=class extends BaseProperties6{constructor(){super(...arguments),this.positive=new WaterfallSeriesItem,this.negative=new WaterfallSeriesItem,this.total=new WaterfallSeriesItem}};__decorateClass([Property19],WaterfallSeriesItems.prototype,"positive",2),__decorateClass([Property19],WaterfallSeriesItems.prototype,"negative",2),__decorateClass([Property19],WaterfallSeriesItems.prototype,"total",2);var WaterfallSeriesProperties=class extends AbstractBarSeriesProperties4{constructor(){super(...arguments),this.item=new WaterfallSeriesItems,this.totals=new PropertiesArray(WaterfallSeriesTotal),this.line=new WaterfallSeriesConnectorLine,this.tooltip=makeSeriesTooltip7()}getStyle(e){const{fillOpacity:t,strokeWidth:i,strokeOpacity:s,fill:a,stroke:o,lineDash:r,lineDashOffset:n,cornerRadius:l}=this.item[e==="subtotal"?"total":e];return{fill:a,fillOpacity:t,stroke:o,strokeWidth:i,strokeOpacity:s,lineDash:r,lineDashOffset:n,cornerRadius:l,opacity:1}}};__decorateClass([Property19],WaterfallSeriesProperties.prototype,"xKey",2),__decorateClass([Property19],WaterfallSeriesProperties.prototype,"yKey",2),__decorateClass([Property19],WaterfallSeriesProperties.prototype,"xName",2),__decorateClass([Property19],WaterfallSeriesProperties.prototype,"yName",2),__decorateClass([Property19],WaterfallSeriesProperties.prototype,"item",2),__decorateClass([Property19],WaterfallSeriesProperties.prototype,"totals",2),__decorateClass([Property19],WaterfallSeriesProperties.prototype,"line",2),__decorateClass([Property19],WaterfallSeriesProperties.prototype,"tooltip",2);var{adjustLabelPlacement,SeriesNodePickMode:SeriesNodePickMode5,fixNumericExtent:fixNumericExtent5,valueProperty:valueProperty6,keyProperty:keyProperty5,accumulativeValueProperty,trailingAccumulatedValueProperty,ChartAxisDirection:ChartAxisDirection12,createDatumId:createDatumId5,checkCrisp:checkCrisp2,updateLabelNode:updateLabelNode4,prepareBarAnimationFunctions:prepareBarAnimationFunctions2,collapsedStartingBarPosition,resetBarSelectionsFn:resetBarSelectionsFn2,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation3,resetLabelFn:resetLabelFn3,animationValidation:animationValidation5,DEFAULT_CARTESIAN_DIRECTION_KEYS:DEFAULT_CARTESIAN_DIRECTION_KEYS2,DEFAULT_CARTESIAN_DIRECTION_NAMES:DEFAULT_CARTESIAN_DIRECTION_NAMES2,computeBarFocusBounds:computeBarFocusBounds5,isContinuous,Rect:Rect3,motion:motion3,applyShapeStyle:applyShapeStyle6,mergeDefaults:mergeDefaults7,getItemStylesPerItemId:getItemStylesPerItemId2,DataSet}=import_ag_charts_community59._ModuleSupport,WaterfallSeries=class extends import_ag_charts_community59._ModuleSupport.AbstractBarSeries{constructor(e){super({moduleCtx:e,propertyKeys:DEFAULT_CARTESIAN_DIRECTION_KEYS2,propertyNames:DEFAULT_CARTESIAN_DIRECTION_NAMES2,categoryKey:void 0,pickModes:[SeriesNodePickMode5.NEAREST_NODE,SeriesNodePickMode5.EXACT_SHAPE_MATCH],pathsPerSeries:["connector"],pathsZIndexSubOrderOffset:[-1,-1],animationResetFns:{datum:resetBarSelectionsFn2,label:resetLabelFn3}}),this.properties=new WaterfallSeriesProperties,this.seriesItemTypes=new Set(["positive","negative","total"])}async processData(e){const{xKey:t,yKey:i,totals:s}=this.properties,{data:a}=this;if(!this.visible)return;const o=S=>isContinuous(S)&&Number(S)>=0,r=S=>isContinuous(S)&&Number(S)>=0,n=S=>S==="total"||S==="subtotal",l={missingValue:void 0,invalidValue:void 0},c=[],h=s.reduce((S,b)=>{const x=S.get(b.index);return x?x.push(b):S.set(b.index,[b]),S},new Map);for(const[S,b]of a?.data.entries()??[]){c.push(b);const x=h.get(S);if(x)for(const v of x)c.push({...v.toJson(),[t]:v.axisLabel})}const p=[];this.ctx.animationManager.isSkipped()||p.push(animationValidation5());const u=this.getCategoryAxis()?.scale,g=this.getValueAxis()?.scale,{isContinuousX:d,xScaleType:m,yScaleType:y}=this.getScaleInformation({xScale:u,yScale:g}),{processedData:f}=await this.requestDataModel(e,DataSet.wrap(c),{props:[keyProperty5(t,m,{id:"xValue"}),accumulativeValueProperty(i,y,{...l,id:"yCurrent"}),accumulativeValueProperty(i,y,{...l,missingValue:0,id:"yCurrentTotal"}),accumulativeValueProperty(i,y,{...l,id:"yCurrentPositive",validation:o}),accumulativeValueProperty(i,y,{...l,id:"yCurrentNegative",validation:r}),trailingAccumulatedValueProperty(i,y,{...l,id:"yPrevious"}),valueProperty6(i,y,{id:"yRaw"}),valueProperty6("totalType","category",{id:"totalTypeValue",missingValue:void 0,validation:n}),...d?[import_ag_charts_community59._ModuleSupport.SMALLEST_KEY_INTERVAL,import_ag_charts_community59._ModuleSupport.LARGEST_KEY_INTERVAL]:[],...p]});this.smallestDataInterval=f.reduced?.smallestKeyInterval,this.largestDataInterval=f.reduced?.largestKeyInterval,this.updateSeriesItemTypes(),this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!t||!i)return[];const{keys:[s],values:a}=t.domain;if(e===this.getCategoryDirection()){const o=i.resolveProcessedDataDefById(this,"xValue");if(o?.def.type==="key"&&o?.def.valueType==="category")return s;const r=e===ChartAxisDirection12.Y,n=this.getCategoryAxis().isReversed();return this.padBandExtent(s,n!==r)}else{const o=i.resolveProcessedDataIndexById(this,"yCurrent"),r=a[o],n=[Math.min(0,r[0]),Math.max(0,r[1])];return fixNumericExtent5(n)}}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{data:e,dataModel:t,processedData:i}=this,s=this.getCategoryAxis(),a=this.getValueAxis();if(!e||!s||!a||!t||!i)return;const{line:o}=this.properties,r=s.scale,n=a.scale,l=this.getBarDirection()===ChartAxisDirection12.X,c=this.getBandwidth(s)??10,h=s.isReversed(),p=a.isReversed();if(i.type!=="ungrouped")return;const u={itemId:this.properties.yKey,nodeData:[],labelData:[],pointData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:getItemStylesPerItemId2(this.getItemStyle.bind(this),"total","subtotal","positive","negative")};if(!this.visible)return u;const g=[],d=t.resolveKeysById(this,"xValue",i),m=t.resolveColumnById(this,"yRaw",i),y=t.resolveColumnById(this,"totalTypeValue",i),f=t.resolveColumnById(this,"yCurrent",i),S=t.resolveColumnById(this,"yPrevious",i),b=t.resolveColumnById(this,"yCurrentTotal",i),x=this.getSeriesDomain(ChartAxisDirection12.Y),v=checkCrisp2(s?.scale,s?.visibleRange,this.smallestDataInterval,this.largestDataInterval);function _(w,M,T){return w||M?{cumulativeValue:b[T],trailingValue:M?k:0}:{cumulativeValue:f[T],trailingValue:S[T]}}function D(w,M,T,N,I){return w?N:M?(N??0)-(I??0):T}let k=0;const{xKey:A,yKey:L,xName:R,yName:O}=this.properties,B=i.dataSources.get(this.id)?.data??[];for(const[w,M]of B.entries()){const T=y[w],N=this.isSubtotal(T),I=this.isTotal(T),P=I||N,F=d[w];if(F==null)continue;const E=Math.round(r.convert(F)),G=m[w],{cumulativeValue:K,trailingValue:V}=_(I,N,w);P&&(k=K??0);const W=Math.round(n.convert(K)),z=Math.round(n.convert(V)),Y=D(I,N,G,K,V),q=(Y??0)>=0,$=this.getSeriesItemType(q,T),{strokeWidth:U,label:j}=this.getItemConfig($),H=q?W:z,te=q?z:W,Z=Math.max(U,Math.abs(te-H)),X={x:l?Math.min(H,te):E,y:l?E:Math.min(H,te),width:l?Z:c,height:l?c:Z},Q={x:X.x+X.width/2,y:X.y+X.height/2},J=P?W:z,ie=Math.floor(o.strokeWidth)%2/2,ee=h?W:J,se=h?J:W;let ae,oe;l?(ae={x:ee+ie,y:X.y},oe={x:se+ie,y:X.y+X.height}):(ae={x:X.x,y:ee+ie},oe={x:X.x+X.width,y:se+ie});const le={x:h?oe.x:ae.x,y:h?oe.y:ae.y,x2:h?ae.x:oe.x,y2:h?ae.y:oe.y,size:0};g.push(le);const re=$==="subtotal"?"total":$,ne=this.getLabelText(Y,M,L,"y",x,j,{itemId:re,value:Y,datum:M,xKey:A,yKey:L,xName:R,yName:O}),ce=j.spacing+(typeof j.padding=="number"?j.padding:0),he={index:w,series:this,itemId:$,datum:M,datumIndex:w,cumulativeValue:K??0,xValue:F,yValue:Y,yKey:L,xKey:A,x:X.x,y:X.y,width:X.width,height:X.height,midPoint:Q,crisp:v,label:{text:ne,...adjustLabelPlacement({isUpward:(Y??-1)>=0!==p,isVertical:!l,placement:j.placement,spacing:ce,rect:X})}};u.nodeData.push(he),u.labelData.push(he)}const C=this.properties.line.enabled;return f!=null&&C&&(u.pointData=g),u}updateSeriesItemTypes(){const{dataModel:e,seriesItemTypes:t,processedData:i}=this;if(!e||!i)return;t.clear();const s=e.resolveProcessedDataIndexById(this,"yCurrentPositive"),a=e.resolveProcessedDataIndexById(this,"yCurrentNegative"),o=e.resolveProcessedDataIndexById(this,"totalTypeValue"),r=i.domain.values[s]??[],n=i.domain.values[a]??[];r.length>0&&t.add("positive"),n.length>0&&t.add("negative");const l=i?.domain.values[o];if(l)for(const c of l)(c==="total"||c==="subtotal")&&t.add("total")}isSubtotal(e){return e==="subtotal"}isTotal(e){return e==="total"}nodeFactory(){return new Rect3}getSeriesItemType(e,t){return t??(e?"positive":"negative")}getItemConfig(e){switch(e){case"positive":return this.properties.item.positive;case"negative":return this.properties.item.negative;case"subtotal":case"total":return this.properties.item.total}}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,s=t??[];return i.update(s)}getItemStyle(e,t,i,s="total"){const{properties:a}=this,{datumIndex:o=0,datum:r}=e??{},n=s==="subtotal"?"total":s,l=a.item[n],c=this.getHighlightStyle(t,o,i),h=mergeDefaults7(c,a.getStyle(s)),{itemStyler:p}=l;let u=h;if(p!=null&&e!=null){const g=this.cachedDatumCallback(createDatumId5(o,t?"highlight":"node"),()=>{const d=this.makeItemStylerParams(s,o,r,t,u);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`,"item",n],this.callWithContext(p,d))});g&&(u=mergeDefaults7(g,u))}return u}makeItemStylerParams(e,t,i,s,a){const{id:o,properties:r}=this,{xKey:n,yKey:l}=r,c=this.ctx.highlightManager?.getActiveHighlight(),h=this.getHighlightStateString(c,s,t),p=this.filterItemStylerFillParams(a.fill)??a.fill;return{seriesId:o,itemId:e,datum:i,xKey:n,yKey:l,highlighted:s,highlightState:h,...a,fill:p}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t,void 0,s.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight(),a=this.getCategoryDirection()===ChartAxisDirection12.X,o=this.getShapeFillBBox();e.each((r,n)=>{const l=n.style??i.styles[n.itemId][this.getHighlightState(s,t,n.datumIndex)];applyShapeStyle6(r,l,o),r.cornerRadius=l.cornerRadius??0,r.visible=a?n.width>0:n.height>0,r.crisp=n.crisp})}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;if(t.length===0)return i.update([]);const s=t.filter(a=>{const{label:o}=this.getItemConfig(a.itemId);return o.enabled});return i.update(s)}updateLabelNodes(e){const t={itemId:"positive",xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xName,yKey:this.properties.yKey,yName:this.properties.yName??this.properties.yName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,a)=>{t.itemId=a.itemId,s.fillOpacity=this.getHighlightStyle(!1,a.datumIndex)?.opacity??1;const o=this.getItemConfig(a.itemId).label;updateLabelNode4(this,s,t,o,a.label,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:a}=this,{xKey:o,xName:r,yKey:n,yName:l,tooltip:c,legendItemName:h}=a,p=this.getCategoryAxis(),u=this.getValueAxis();if(!i||!s||!p||!u)return;const g=s.dataSources.get(this.id)?.data[e],d=i.resolveKeysById(this,"xValue",s)[e],m=i.resolveColumnById(this,"yRaw",s)[e],y=i.resolveColumnById(this,"yCurrentTotal",s),f=i.resolveColumnById(this,"totalTypeValue",s);if(d==null)return;const S=f[e],b=(m??0)>=0,x=this.getSeriesItemType(b,S);let v;if(this.isTotal(S))v=y[e];else if(this.isSubtotal(S)){v=y[e];for(let k=e-1;k>=0;k-=1)if(this.isSubtotal(f[k])){v=v-y[k];break}}else v=m;const _=this.contextNodeData?.nodeData?.[e],D=this.getItemStyle(_,!1,void 0,_?.itemId);return this.formatTooltipWithContext(c,{heading:this.getAxisValueText(p,"tooltip",d,g,o,h),symbol:this.legendItemSymbol(x),data:[{label:l,fallbackLabel:n,value:this.getAxisValueText(u,"tooltip",v,g,n,h)}]},{seriesId:t,datum:g,title:l,itemId:x,xKey:o,xName:r,yKey:n,yName:l,...D})}legendItemSymbol(e){const{fill:t,stroke:i,fillOpacity:s,strokeOpacity:a,strokeWidth:o,lineDash:r,lineDashOffset:n}=this.getItemConfig(e);return{marker:{fill:t,stroke:i,fillOpacity:s,strokeOpacity:a,strokeWidth:o,lineDash:r,lineDashOffset:n}}}getLegendData(e){if(e!=="category")return[];const{id:t,seriesItemTypes:i}=this,s=[],a=r=>r.charAt(0).toUpperCase()+r.substring(1),{showInLegend:o}=this.properties;for(const r of i){const{name:n}=this.getItemConfig(r);s.push({legendType:"category",id:t,itemId:r,seriesId:t,enabled:!0,label:{text:n??a(r)},symbol:this.legendItemSymbol(r),hideInLegend:!o,isFixed:!0})}return s}toggleSeriesItem(){}animateEmptyUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:s}=e,a=prepareBarAnimationFunctions2(collapsedStartingBarPosition(this.isVertical(),this.axes,"normal"),"unknown");motion3.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],a),seriesLabelFadeInAnimation3(this,"labels",this.ctx.animationManager,i);const{pointData:o}=s;o&&(this.isVertical()?this.animateConnectorLinesVertical(e):this.animateConnectorLinesHorizontal(e))}animateConnectorLinesHorizontal(e){const{pointData:t=[]}=e.contextData,[i]=e.paths,{path:s}=i;this.updateLineNode(i);const a=this.getValueAxis(),o=a?.isReversed(),r=o?(h,p)=>hh>p,n=a?.scale.convert(0),l=t.reduce((h,p)=>(r(p.x,h)&&(h=p.x),h),o?1/0:0),c=(h,p,u,g,d)=>(h-p)/(u-p)*(d-g)+g;this.ctx.animationManager.animate({id:`${this.id}_connectors`,groupId:this.id,phase:"initial",from:n,to:l,ease:import_ag_charts_community59._ModuleSupport.Motion.easeOut,collapsable:!1,onUpdate(h){s.clear(!0);for(const[p,u]of t.entries()){const g=c(h,n,l,n,u.x),d=c(h,n,l,n,u.x2);p!==0&&s.lineTo(g,u.y),s.moveTo(d,u.y2)}i.checkPathDirty()},onStop:()=>this.resetConnectorLinesPath(e)})}animateConnectorLinesVertical(e){const{pointData:t=[]}=e.contextData,[i]=e.paths,{path:s}=i;this.updateLineNode(i);const a=this.getValueAxis(),o=a?.isReversed(),r=o?(h,p)=>h>p:(h,p)=>h(r(p.y,h)&&(h=p.y),h),o?0:1/0),c=(h,p,u,g,d)=>(h-p)/(u-p)*(d-g)+g;this.ctx.animationManager.animate({id:`${this.id}_connectors`,groupId:this.id,phase:"initial",from:n,to:l,ease:import_ag_charts_community59._ModuleSupport.Motion.easeOut,collapsable:!1,onUpdate(h){s.clear(!0);for(const[p,u]of t.entries()){const g=c(h,n,l,n,u.y),d=c(h,n,l,n,u.y2);p!==0&&s.lineTo(u.x,g),s.moveTo(u.x2,d)}i.checkPathDirty()},onStop:()=>this.resetConnectorLinesPath(e)})}animateReadyResize(e){super.animateReadyResize(e),this.resetConnectorLinesPath(e)}updatePaths(e){this.resetConnectorLinesPath({contextData:e.contextData,paths:e.paths})}resetConnectorLinesPath({contextData:e,paths:t}){if(t.length===0)return;const[i]=t;this.updateLineNode(i);const{path:s}=i;s.clear(!0);const{pointData:a}=e;if(a){for(const[o,r]of a.entries())o!==0&&s.lineTo(r.x,r.y),s.moveTo(r.x2,r.y2);i.checkPathDirty()}}updateLineNode(e){const{stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:a,lineDashOffset:o}=this.properties.line;e.setProperties({fill:void 0,stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:a,lineDashOffset:o,lineJoin:"round",pointerEvents:import_ag_charts_community59._ModuleSupport.PointerEvents.None})}isLabelEnabled(){const{positive:e,negative:t,total:i}=this.properties.item;return e.label.enabled||t.label.enabled||i.label.enabled}onDataChange(){}computeFocusBounds({datumIndex:e}){return computeBarFocusBounds5(this,this.contextNodeData?.nodeData[e])}hasItemStylers(){const{positive:e,negative:t,total:i}=this.properties.item;return e.itemStyler!=null||e.label.itemStyler!=null||t.itemStyler!=null||t.label.itemStyler!=null||i.itemStyler!=null||i.label.itemStyler!=null}};WaterfallSeries.className="WaterfallSeries",WaterfallSeries.type="waterfall";var import_ag_charts_community60=require("ag-charts-community"),import_ag_charts_core19=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs7,waterfallSeriesThemeableOptionsDef}=import_ag_charts_community60._ModuleSupport,waterfallSeriesOptionsDef={...waterfallSeriesThemeableOptionsDef,...commonSeriesOptionsDefs7,type:(0,import_ag_charts_core19.required)((0,import_ag_charts_core19.constant)("waterfall")),xKey:(0,import_ag_charts_core19.required)(import_ag_charts_core19.string),yKey:(0,import_ag_charts_core19.required)(import_ag_charts_core19.string),xName:import_ag_charts_core19.string,yName:import_ag_charts_core19.string,totals:(0,import_ag_charts_core19.arrayOfDefs)({totalType:(0,import_ag_charts_core19.required)((0,import_ag_charts_core19.union)("total","subtotal")),index:(0,import_ag_charts_core19.required)(import_ag_charts_core19.positiveNumber),axisLabel:(0,import_ag_charts_core19.required)(import_ag_charts_core19.string)},"a total definition options array")},import_ag_charts_community61=require("ag-charts-community"),{FILL_GRADIENT_LINEAR_KEYED_DEFAULTS:FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2,FILL_IMAGE_DEFAULTS:FILL_IMAGE_DEFAULTS3,FILL_PATTERN_KEYED_DEFAULTS:FILL_PATTERN_KEYED_DEFAULTS2}=import_ag_charts_community61._ModuleSupport;function itemTheme2(e,t){return{fill:{$applySwitch:[{$path:"type"},{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$path:[`/${t}`,{$palette:"fill"},{$palette:"fills"}]},{$palette:`${e}.fill`}]},["gradient",FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2(e)],["image",FILL_IMAGE_DEFAULTS3],["pattern",FILL_PATTERN_KEYED_DEFAULTS2(e)]]},stroke:{$palette:`${e}.stroke`},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{...import_ag_charts_community61._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},formatter:void 0,placement:"outside-end",padding:{$isUserOption:["./spacing",0,6]}}}}var WATERFALL_SERIES_THEME={series:{item:{positive:itemTheme2("altUp",0),negative:itemTheme2("altDown",1),total:itemTheme2("neutral",2)},line:{stroke:{$palette:"neutral.stroke"},strokeOpacity:1,lineDash:[0],lineDashOffset:0,strokeWidth:2},highlight:import_ag_charts_community61._ModuleSupport.singleSeriesHighlightStyle()},legend:{enabled:!0,toggleSeries:!1}},WaterfallModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"waterfall",solo:!0,moduleFactory:e=>new WaterfallSeries(e),defaultAxes:import_ag_charts_community62._ModuleSupport.DIRECTION_SWAP_AXES,themeTemplate:WATERFALL_SERIES_THEME},WaterfallSeriesModule={type:"series",name:"waterfall",chartType:"cartesian",enterprise:!0,options:waterfallSeriesOptionsDef,create:e=>new WaterfallSeries(e)},{NewAreaSeriesModule,NewBarSeriesModule,NewBubbleSeriesModule,NewHistogramSeriesModule,NewLineSeriesModule,NewScatterSeriesModule,numberFormatValidator,textOrSegments,without:without2}=import_ag_charts_community63._ModuleSupport,navigatorHandleOptionsDef={width:import_ag_charts_core20.positiveNumber,height:import_ag_charts_core20.positiveNumber,grip:import_ag_charts_core20.boolean,fill:import_ag_charts_core20.color,stroke:import_ag_charts_core20.color,strokeWidth:import_ag_charts_core20.positiveNumber,cornerRadius:import_ag_charts_core20.positiveNumber},commonIgnoredMiniChartProperties=["cursor","highlightStyle","listeners","nodeClickRange","showInLegend","showInMiniChart","tooltip","visible","xName","yName"],barIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"errorBar","label","legendItemName","direction"],boxPlotIngnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"direction","legendItemName","minName","q1Name","medianName","q3Name","maxName"],bubbleIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"title","label","labelKey","labelName","sizeName"],heatmapIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"title","label","colorName","textAlign","verticalAlign","itemPadding","colorRange"],histogramIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"label"],lineIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"errorBar","title","label"],rangeAreaIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"label","yLowName","yHighName"],rangeBarIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"direction","label","yLowName","yHighName"],scatterIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"errorBar","title","label","labelKey","labelName"],waterfallIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"direction"],navigatorOptionsDef={enabled:import_ag_charts_core20.boolean,height:import_ag_charts_core20.positiveNumber,spacing:import_ag_charts_core20.positiveNumber,cornerRadius:import_ag_charts_core20.number,mask:{fill:import_ag_charts_core20.color,fillOpacity:import_ag_charts_core20.ratio,stroke:import_ag_charts_core20.color,strokeWidth:import_ag_charts_core20.positiveNumber},minHandle:navigatorHandleOptionsDef,maxHandle:navigatorHandleOptionsDef,miniChart:{enabled:import_ag_charts_core20.boolean,padding:{top:import_ag_charts_core20.positiveNumber,bottom:import_ag_charts_core20.positiveNumber},label:{enabled:import_ag_charts_core20.boolean,avoidCollisions:import_ag_charts_core20.boolean,spacing:import_ag_charts_core20.positiveNumber,format:numberFormatValidator,formatter:(0,import_ag_charts_core20.callbackOf)(textOrSegments),interval:{minSpacing:import_ag_charts_core20.positiveNumber,maxSpacing:import_ag_charts_core20.positiveNumber,values:import_ag_charts_core20.array,step:import_ag_charts_core20.number},...import_ag_charts_core20.fontOptionsDef},series:(0,import_ag_charts_core20.arrayOfDefs)((0,import_ag_charts_core20.typeUnion)({area:without2(NewAreaSeriesModule.options,[...commonIgnoredMiniChartProperties,"type"]),bar:without2(NewBarSeriesModule.options,[...barIgnoredMiniChartProperties,"type"]),"box-plot":without2(BoxPlotSeriesModule.options,[...boxPlotIngnoredMiniChartProperties,"type"]),bubble:without2(NewBubbleSeriesModule.options,[...bubbleIgnoredMiniChartProperties,"type"]),candlestick:without2(CandlestickSeriesModule.options,[...commonIgnoredMiniChartProperties,"type"]),heatmap:without2(HeatmapSeriesModule.options,[...heatmapIgnoredMiniChartProperties,"type"]),histogram:without2(NewHistogramSeriesModule.options,[...histogramIgnoredMiniChartProperties,"type"]),line:without2(NewLineSeriesModule.options,[...lineIgnoredMiniChartProperties,"type"]),ohlc:without2(OhlcSeriesModule.options,[...commonIgnoredMiniChartProperties,"type"]),"range-area":without2(RangeAreaSeriesModule.options,[...rangeAreaIgnoredMiniChartProperties,"type"]),"range-bar":without2(RangeBarSeriesModule.options,[...rangeBarIgnoredMiniChartProperties,"type"]),scatter:without2(NewScatterSeriesModule.options,[...scatterIgnoredMiniChartProperties,"type"]),waterfall:without2(WaterfallSeriesModule.options,[...waterfallIgnoredMiniChartProperties,"type"])},"miniChart series options"))}},{annotationOptionsDef}=import_ag_charts_community64._ModuleSupport,AnnotationsModule={type:"plugin",name:"annotations",chartType:"cartesian",options:annotationOptionsDef,create(){return null}},NavigatorModule={type:"plugin",name:"navigator",chartType:"cartesian",options:navigatorOptionsDef,create(){return null}},InitialStateModule={type:"plugin",name:"initialState",options:initialStateOptionsDef,create(){return null}},import_ag_charts_community70=require("ag-charts-community"),import_ag_charts_community68=require("ag-charts-community"),import_ag_charts_core22=require("ag-charts-core"),import_ag_charts_community65=require("ag-charts-community"),import_ag_charts_core21=require("ag-charts-core");function computeNodeGraph(e,t,i){i||(t=removeCircularLinks(t));const s=new Map;for(const o of e)s.set(o.id,{datum:o,linksBefore:[],linksAfter:[],maxPathLengthBefore:-1,maxPathLengthAfter:-1});let a=0;for(const[o,r]of s.entries())a=Math.max(a,computePathLength(s,t,r,o,-1,[])+computePathLength(s,t,r,o,1,[])+1);return{links:t,nodeGraph:s,maxPathLength:a}}function findCircularLinks(e,t,i,s){const a=s.indexOf(t);if(a!==-1){for(let r=a;r!t.has(i))}function computePathLength(e,t,i,s,a,o){if(o.includes(s))return 1/0;let r=a===-1?i.maxPathLengthBefore:i.maxPathLengthAfter;if(r===-1){r=0;const n=a===-1?i.linksBefore:i.linksAfter;for(const l of t){const{fromNode:c,toNode:h}=l,p=a===-1?h.id:c.id,u=a===-1?c.id:h.id,g=s===p?e.get(u):void 0;g!=null&&(n.push({node:g,link:l}),o?.push(s),r=Math.max(r,computePathLength(e,t,g,u,a,o)+1),o?.pop())}a===-1?i.maxPathLengthBefore=r:i.maxPathLengthAfter=r}return r}var{Series,DataController,keyProperty:keyProperty6,valueProperty:valueProperty7,Selection:Selection3,Group:Group5,TransformableText}=import_ag_charts_community65._ModuleSupport,FlowProportionSeriesNodeEvent=class extends import_ag_charts_community65._ModuleSupport.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s);const{datumIndex:a}=i,o=s.contextNodeData?.nodeData.find(r=>r.datumIndex.type===a.type&&r.datumIndex.index===a.index);this.size=o?.size,this.label=o?.type===1?o?.label:void 0}},FlowProportionSeries=class extends Series{constructor(){super(...arguments),this.NodeEvent=FlowProportionSeriesNodeEvent,this.nodeCount=0,this.linkCount=0,this.linksDataModel=void 0,this.linksProcessedData=void 0,this.nodesDataModel=void 0,this.nodesProcessedData=void 0,this.processedNodes=new Map,this.linkGroup=this.contentGroup.appendChild(new Group5({name:"linkGroup"})),this.nodeGroup=this.contentGroup.appendChild(new Group5({name:"nodeGroup"})),this.focusLinkGroup=this.highlightGroup.appendChild(new Group5({name:"linkGroup"})),this.focusNodeGroup=this.highlightGroup.appendChild(new Group5({name:"nodeGroup"})),this.highlightLinkGroup=this.highlightGroup.appendChild(new Group5({name:"linkGroup"})),this.highlightNodeGroup=this.highlightGroup.appendChild(new Group5({name:"nodeGroup"})),this.labelSelection=Selection3.select(this.labelGroup,TransformableText),this.linkSelection=Selection3.select(this.linkGroup,()=>this.linkFactory()),this.nodeSelection=Selection3.select(this.nodeGroup,()=>this.nodeFactory()),this.focusLinkSelection=Selection3.select(this.focusLinkGroup,()=>this.linkFactory()),this.focusNodeSelection=Selection3.select(this.focusNodeGroup,()=>this.nodeFactory()),this.highlightLinkSelection=Selection3.select(this.highlightLinkGroup,()=>this.linkFactory()),this.highlightNodeSelection=Selection3.select(this.highlightNodeGroup,()=>this.nodeFactory())}get nodes(){return this.properties.nodes}async processData(e){const{data:t,nodes:i}=this;if(t==null)return;const{fromKey:s,toKey:a,sizeKey:o,idKey:r,labelKey:n}=this.properties,l=new DataController("standalone",e.suppressFieldDotNotation),c=i==null?null:l.request(this.id,import_ag_charts_community65._ModuleSupport.DataSet.wrap(i)??import_ag_charts_community65._ModuleSupport.DataSet.empty(),{props:[keyProperty6(r,void 0,{id:"idValue",includeProperty:!1}),...n==null?[]:[valueProperty7(n,void 0,{id:"labelValue",includeProperty:!1})]],groupByKeys:!0}),h=e.request(this.id,t,{props:[valueProperty7(s,void 0,{id:"fromValue",includeProperty:!1}),valueProperty7(a,void 0,{id:"toValue",includeProperty:!1}),...o==null?[]:[valueProperty7(o,void 0,{id:"sizeValue",includeProperty:!1,missingValue:0})]],groupByKeys:!1});i!=null&&l.execute();const[p,u]=await Promise.all([c??Promise.resolve(null),h]);this.nodesDataModel=p?.dataModel,this.nodesProcessedData=p?.processedData,this.linksDataModel=u?.dataModel,this.linksProcessedData=u?.processedData;const g=new Map;if(p==null){const d=u.dataModel.resolveColumnById(this,"fromValue",u.processedData),m=u.dataModel.resolveColumnById(this,"toValue",u.processedData),y=S=>{const b=g.size,x=S;return{series:this,itemId:void 0,datum:{},datumIndex:{type:1,index:b},type:1,index:b,linksBefore:[],linksAfter:[],id:S,size:0,label:x,style:this.getNodeStyle({datumIndex:{type:1,index:b},datum:{},size:0,label:x},b,!1)}},f=u.processedData.dataSources.get(this.id)?.data;if(f)for(const[S]of f.entries()){const b=d[S],x=m[S];b==null||x==null||(g.has(b)||g.set(b,y(b)),g.has(x)||g.set(x,y(x)))}}else{const d=p.dataModel.resolveColumnById(this,"idValue",p.processedData),m=n==null?void 0:p.dataModel.resolveColumnById(this,"labelValue",p.processedData),y=p.processedData.dataSources.get(this.id)?.data;if(y)for(const[f,S]of y.entries()){const b=d[f],x=m?.[f],v={type:1,index:f};g.set(b,{series:this,itemId:void 0,datum:S,datumIndex:v,type:1,index:f,linksBefore:[],linksAfter:[],id:b,size:0,label:x,style:this.getNodeStyle({datumIndex:v,datum:S,size:0,label:x},f,!1)})}}this.processedNodes=g}getNodeGraph(e,t,{includeCircularReferences:i}){const{linksDataModel:s,linksProcessedData:a}=this;if(s==null||a==null){const{links:m,nodeGraph:y,maxPathLength:f}=computeNodeGraph(new Map().values(),[],i);return this.nodeCount=0,this.linkCount=0,{nodeGraph:y,links:m,maxPathLength:f}}const{sizeKey:o}=this.properties,r=s.resolveColumnById(this,"fromValue",a),n=s.resolveColumnById(this,"toValue",a),l=o==null?void 0:s.resolveColumnById(this,"sizeValue",a),c=new Map;for(const m of this.processedNodes.values()){const y=e(m);c.set(m.id,y)}const h=[],p=a.dataSources.get(this.id)?.data;if(p)for(const[m,y]of p.entries()){const f=r[m],S=n[m],b=l==null?1:l[m],x=c.get(f),v=c.get(S);if(b<=0||x==null||v==null)continue;const _={type:0,index:m},D=t({series:this,itemId:void 0,datum:y,datumIndex:_,type:0,index:m,fromNode:x,toNode:v,size:b,style:this.getLinkStyle({datum:y,datumIndex:_},x.datumIndex,!1)});h.push(D)}const{links:u,nodeGraph:g,maxPathLength:d}=computeNodeGraph(c.values(),h,i);for(const m of g.values())m.datum.linksBefore=m.linksBefore.map(y=>y.link),m.datum.linksAfter=m.linksAfter.map(y=>y.link);return this.nodeCount=g.size,this.linkCount=u.length,{nodeGraph:g,links:u,maxPathLength:d}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(e){const{seriesRect:t}=e,i={seriesRectWidth:t?.width??0,seriesRectHeight:t?.height??0};(this._nodeDataDependencies==null||this._nodeDataDependencies.seriesRectWidth!==i.seriesRectWidth||this._nodeDataDependencies.seriesRectHeight!==i.seriesRectHeight)&&(this._nodeDataDependencies=i),this.updateSelections();const s=this.contextNodeData?.nodeData??[],a=this.contextNodeData?.labelData??[];let o=this.ctx.highlightManager?.getActiveHighlight();if(o?.series===this&&o.type==null){const{itemId:h}=o;o=h==null?void 0:s.find(p=>p.type===1&&p.id===h)}else o?.series!==this&&(o=void 0);this.contentGroup.visible=this.visible,this.contentGroup.opacity=o==null?1:this.properties.highlight.unhighlightedItem.opacity??1,this.labelSelection=this.updateLabelSelection({labelData:a,labelSelection:this.labelSelection}),this.updateLabelNodes({labelSelection:this.labelSelection}),this.linkSelection=this.updateLinkSelection({nodeData:s.filter(h=>h.type===0),datumSelection:this.linkSelection}),this.updateLinkNodes({datumSelection:this.linkSelection,isHighlight:!1}),this.nodeSelection=this.updateNodeSelection({nodeData:s.filter(h=>h.type===1),datumSelection:this.nodeSelection}),this.updateNodeNodes({datumSelection:this.nodeSelection,isHighlight:!1});let r,n,l,c;o?.type===1?(r=s.filter(h=>h.type===0&&(h.toNode===o||h.fromNode===o)),n=r.map(h=>h.fromNode===o?h.toNode:h.fromNode),n.push(o),l=[],c=[o]):o?.type===0?(r=[o],n=[o.fromNode,o.toNode],l=[o],c=[]):(r=[],n=[],l=[],c=[]),this.focusLinkSelection=this.updateLinkSelection({nodeData:r,datumSelection:this.focusLinkSelection}),this.updateLinkNodes({datumSelection:this.focusLinkSelection,isHighlight:!1}),this.focusNodeSelection=this.updateNodeSelection({nodeData:n,datumSelection:this.focusNodeSelection}),this.updateNodeNodes({datumSelection:this.focusNodeSelection,isHighlight:!1}),this.highlightLinkSelection=this.updateLinkSelection({nodeData:l,datumSelection:this.highlightLinkSelection}),this.updateLinkNodes({datumSelection:this.highlightLinkSelection,isHighlight:!0}),this.highlightNodeSelection=this.updateNodeSelection({nodeData:c,datumSelection:this.highlightNodeSelection}),this.updateNodeNodes({datumSelection:this.highlightNodeSelection,isHighlight:!0})}resetAnimation(e){}dataCount(){return Number.NaN}getSeriesDomain(e){return[]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}legendItemSymbol(e,t,i={}){const{fills:s,strokes:a}=this.properties,{fill:o=s[t%s.length],fillOpacity:r=1,stroke:n=a[t%a.length],strokeWidth:l=0,strokeOpacity:c=1,lineDash:h=[0],lineDashOffset:p=0}=i;return{marker:{fill:o,fillOpacity:r,stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}}}getLegendData(e){if(e!=="category")return[];const{showInLegend:t}=this.properties;return Array.from(this.processedNodes.values(),({id:i,label:s},a)=>({legendType:"category",id:this.id,itemId:i,seriesId:this.id,enabled:!0,label:{text:s??i},symbol:this.legendItemSymbol(1,a),hideInLegend:!t,isFixed:!0}))}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.linkSelection.each((a,o)=>{const r=a.distanceSquared(e,t);r{const r=a.distanceSquared(e,t);rh.datum),c=n.indexOf(s)+t;c>=0&&c0?a=n.at(-1):a=Array.from(this.nodeSelection,p=>p.datum).at(-1)}else if(s?.type===1){const n=Array.from(this.nodeSelection,h=>h.datum),c=n.indexOf(s)+t;c>=0&&cp.datum)[0]}if(a==null)return;const o=a.type===1?Array.from(this.nodeSelection).find(n=>n.datum===a):Array.from(this.linkSelection).find(n=>n.datum===a);if(o==null)return;const r=this.computeFocusBounds(o.node);if(r!=null)return{datum:o.datum,datumIndex:this.contextNodeData?.nodeData.indexOf(o.datum)??0,otherIndex:0,bounds:r,clipFocusBox:!0}}getCategoryValue(e){}datumIndexForCategoryValue(e){}},import_ag_charts_community66=require("ag-charts-community"),{Path:Path7,SceneChangeDetection:SceneChangeDetection4}=import_ag_charts_community66._ModuleSupport;function bezierControlPoints({radius:e,startAngle:t,endAngle:i,tension:s}){const a=e*Math.cos(t),o=e*Math.sin(t),r=e*Math.cos(i),n=e*Math.sin(i),l=a*s,c=o*s,h=r*s,p=n*s;return{x:[a,l,h,r],y:[o,c,p,n]}}var ChordLink=class extends Path7{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.radius=0,this.startAngle1=0,this.endAngle1=0,this.startAngle2=0,this.endAngle2=0,this.tension=1}tensionedCurveTo(e,t,i,s,a,o,r,n){const{path:l,tension:c}=this,h=1-c;l.cubicCurveTo((i-e)*h+e,(s-t)*h+t,(a-r)*h+r,(o-n)*h+n,r,n)}updatePath(){const{path:e,centerX:t,centerY:i,radius:s}=this;let{startAngle1:a,endAngle1:o,startAngle2:r,endAngle2:n}=this;a>r&&([a,r]=[r,a],[o,n]=[n,o]),e.clear();const l=t+s*Math.cos(a),c=i+s*Math.sin(a);e.moveTo(l,c),this.tensionedCurveTo(l,c,t,i,t,i,t+s*Math.cos(n),i+s*Math.sin(n)),e.arc(t,i,s,n,r,!0),this.tensionedCurveTo(t+s*Math.cos(r),i+s*Math.sin(r),t,i,t,i,t+s*Math.cos(o),i+s*Math.sin(o)),e.arc(t,i,s,o,a,!0),e.closePath()}};__decorateClass([SceneChangeDetection4()],ChordLink.prototype,"centerX",2),__decorateClass([SceneChangeDetection4()],ChordLink.prototype,"centerY",2),__decorateClass([SceneChangeDetection4()],ChordLink.prototype,"radius",2),__decorateClass([SceneChangeDetection4()],ChordLink.prototype,"startAngle1",2),__decorateClass([SceneChangeDetection4()],ChordLink.prototype,"endAngle1",2),__decorateClass([SceneChangeDetection4()],ChordLink.prototype,"startAngle2",2),__decorateClass([SceneChangeDetection4()],ChordLink.prototype,"endAngle2",2),__decorateClass([SceneChangeDetection4()],ChordLink.prototype,"tension",2);var import_ag_charts_community67=require("ag-charts-community"),{FillGradientDefaults,FillPatternDefaults,FillImageDefaults,BaseProperties:BaseProperties7,makeSeriesTooltip:makeSeriesTooltip8,SeriesProperties,Property:Property20,Label:Label4}=import_ag_charts_community67._ModuleSupport,ChordSeriesLabelProperties=class extends Label4{constructor(){super(...arguments),this.spacing=1,this.maxWidth=1}};__decorateClass([Property20],ChordSeriesLabelProperties.prototype,"spacing",2),__decorateClass([Property20],ChordSeriesLabelProperties.prototype,"maxWidth",2);var ChordSeriesLinkProperties=class extends BaseProperties7{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0,this.tension=0}getStyle(e,t,i){const{fillOpacity:s,strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n,tension:l}=this,c=this.fill??e[i%e.length],h=this.stroke??t[i%e.length];return{fill:c,fillOpacity:s,stroke:h,strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n,tension:l}}};__decorateClass([Property20],ChordSeriesLinkProperties.prototype,"fill",2),__decorateClass([Property20],ChordSeriesLinkProperties.prototype,"fillOpacity",2),__decorateClass([Property20],ChordSeriesLinkProperties.prototype,"stroke",2),__decorateClass([Property20],ChordSeriesLinkProperties.prototype,"strokeOpacity",2),__decorateClass([Property20],ChordSeriesLinkProperties.prototype,"strokeWidth",2),__decorateClass([Property20],ChordSeriesLinkProperties.prototype,"lineDash",2),__decorateClass([Property20],ChordSeriesLinkProperties.prototype,"lineDashOffset",2),__decorateClass([Property20],ChordSeriesLinkProperties.prototype,"tension",2),__decorateClass([Property20],ChordSeriesLinkProperties.prototype,"itemStyler",2);var ChordSeriesNodeProperties=class extends BaseProperties7{constructor(){super(...arguments),this.spacing=1,this.width=1,this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t,i){const{fillOpacity:s,strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n}=this,l=this.fill??e[i%e.length],c=this.stroke??t[i%e.length];return{fill:l,fillOpacity:s,stroke:c,strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n}}};__decorateClass([Property20],ChordSeriesNodeProperties.prototype,"spacing",2),__decorateClass([Property20],ChordSeriesNodeProperties.prototype,"width",2),__decorateClass([Property20],ChordSeriesNodeProperties.prototype,"fill",2),__decorateClass([Property20],ChordSeriesNodeProperties.prototype,"fillOpacity",2),__decorateClass([Property20],ChordSeriesNodeProperties.prototype,"stroke",2),__decorateClass([Property20],ChordSeriesNodeProperties.prototype,"strokeOpacity",2),__decorateClass([Property20],ChordSeriesNodeProperties.prototype,"strokeWidth",2),__decorateClass([Property20],ChordSeriesNodeProperties.prototype,"lineDash",2),__decorateClass([Property20],ChordSeriesNodeProperties.prototype,"lineDashOffset",2),__decorateClass([Property20],ChordSeriesNodeProperties.prototype,"itemStyler",2);var ChordSeriesProperties=class extends SeriesProperties{constructor(){super(),this.idKey="",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.sizeKey=void 0,this.sizeName=void 0,this.nodes=void 0,this.fillGradientDefaults=new FillGradientDefaults,this.fillPatternDefaults=new FillPatternDefaults,this.fillImageDefaults=new FillImageDefaults,this.fills=[],this.strokes=[],this.label=new ChordSeriesLabelProperties,this.link=new ChordSeriesLinkProperties,this.node=new ChordSeriesNodeProperties,this.tooltip=makeSeriesTooltip8(),this.highlightStyle.deprecated=!1}};__decorateClass([Property20],ChordSeriesProperties.prototype,"fromKey",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"toKey",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"idKey",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"idName",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"labelKey",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"labelName",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"sizeKey",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"sizeName",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"nodes",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"fillGradientDefaults",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"fillPatternDefaults",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"fillImageDefaults",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"fills",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"strokes",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"label",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"link",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"node",2),__decorateClass([Property20],ChordSeriesProperties.prototype,"tooltip",2);var{SeriesNodePickMode:SeriesNodePickMode6,createDatumId:createDatumId6,angleBetween:angleBetween2,normalizeAngle360:normalizeAngle3604,isBetweenAngles,Sector:Sector3,evaluateBezier,applyShapeStyle:applyShapeStyle7,getShapeStyle,getLabelStyles,BBox:BBox6,mergeDefaults:mergeDefaults8}=import_ag_charts_community68._ModuleSupport,nodeMidAngle=e=>e.startAngle+angleBetween2(e.startAngle,e.endAngle)/2,ChordSeries=class extends FlowProportionSeries{constructor(e){super({moduleCtx:e,pickModes:[SeriesNodePickMode6.NEAREST_NODE,SeriesNodePickMode6.EXACT_SHAPE_MATCH]}),this.properties=new ChordSeriesProperties}isLabelEnabled(){return(this.properties.labelKey!=null||this.nodes==null)&&this.properties.label.enabled}linkFactory(){return new ChordLink}nodeFactory(){return new Sector3}createNodeData(){const{id:e,_nodeDataDependencies:{seriesRectWidth:t,seriesRectHeight:i}={seriesRectWidth:0,seriesRectHeight:0},properties:s}=this,{fromKey:a,toKey:o,sizeKey:r,labelKey:n,label:{spacing:l,maxWidth:c,fontSize:h},node:{width:p,spacing:u}}=s,g=t/2,d=i/2;let m=[];const{nodeGraph:y,links:f}=this.getNodeGraph(w=>({...w,centerX:g,centerY:d,innerRadius:Number.NaN,outerRadius:Number.NaN,startAngle:Number.NaN,endAngle:Number.NaN}),w=>({...w,centerX:g,centerY:d,radius:Number.NaN,startAngle1:Number.NaN,endAngle1:Number.NaN,startAngle2:Number.NaN,endAngle2:Number.NaN}),{includeCircularReferences:!0});let S=0;for(const[w,{datum:M,linksBefore:T,linksAfter:N}]of y.entries()){const I=T.reduce((P,{link:F})=>P+F.size,0)+N.reduce((P,{link:F})=>P+F.size,0);if(I===0)y.delete(w);else{const{label:P}=s;M.size=I,S+=M.size;const F=P.enabled?this.getLabelText(M.label,M.datum,n,"label",[],P,{datum:M.datum,value:M.label,fromKey:a,toKey:o,sizeKey:r,size:M.size}):void 0;M.label=(0,import_ag_charts_core22.toPlainText)(F)}}let b=0;if(this.isLabelEnabled()){const w=(0,import_ag_charts_core22.cachedTextMeasurer)(this.properties.label);let M=0;for(const{datum:T}of y.values()){const{id:N,label:I}=T;if(I==null)continue;const P=(0,import_ag_charts_core22.wrapText)(I,{maxWidth:c,font:this.properties.label,textWrap:"never"}),{width:F}=w.measureLines(P);M=Math.max(F,M),m.push({id:N,text:P,centerX:g,centerY:d,angle:Number.NaN,radius:Number.NaN,size:T.size})}b=M+l}const x=y.size;let v=Math.min(t,i)/2-p-b,_=u/v;if(b!==0&&(x*_>=1.5*Math.PI||v<=0)&&(m=[],v=Math.min(t,i)/2-p,_=u/v),x*_>=2*Math.PI||v<=0){import_ag_charts_core22.Logger.warnOnce("There was insufficient space to display the Chord Series.");return}const D=v,k=v+p,A=Math.max((2*Math.PI-x*_)/S,0);let L=0;for(const{datum:w}of y.values()){w.innerRadius=D,w.outerRadius=k,w.startAngle=L,w.endAngle=L+w.size*A,L=w.endAngle+_;const M=(w.innerRadius+w.outerRadius)/2,T=nodeMidAngle(w);w.midPoint={x:w.centerX+M*Math.cos(T),y:w.centerY+M*Math.sin(T)}}const R=[];for(const{datum:w,linksBefore:M,linksAfter:T}of y.values()){const N=nodeMidAngle(w),I=[...M.map(F=>({link:F.link,distance:angleBetween2(nodeMidAngle(F.node.datum),N),after:!1})),...T.map(F=>({link:F.link,distance:angleBetween2(nodeMidAngle(F.node.datum),N),after:!0}))];let P=w.startAngle;for(const{link:F,after:E}of I.toSorted((G,K)=>G.distance-K.distance)){const G=F.size*A;E?(F.startAngle1=P,F.endAngle1=P+G):(F.startAngle2=P,F.endAngle2=P+G),P+=F.size*A}R.push(w)}const{tension:O}=this.properties.link;for(const w of f){w.radius=v;const M=bezierControlPoints({radius:v,startAngle:w.startAngle1,endAngle:w.endAngle2,tension:O}),T=bezierControlPoints({radius:v,startAngle:w.startAngle2,endAngle:w.endAngle1,tension:O}),N=evaluateBezier(...M.x,.5),I=evaluateBezier(...M.y,.5),P=evaluateBezier(...T.x,.5),F=evaluateBezier(...T.y,.5);w.midPoint={x:w.centerX+(N+P)/2,y:w.centerY+(I+F)/2},R.push(w)}for(const w of m){const M=y.get(w.id)?.datum;M!=null&&(w.radius=k+l,w.angle=normalizeAngle3604(M.startAngle+angleBetween2(M.startAngle,M.endAngle)/2))}m.sort((w,M)=>w.angle-M.angle);let B=1/0,C=-1/0;return m=m.filter(w=>{const M=(0,import_ag_charts_core22.calcLineHeight)(h),T=Math.atan2(M/2,w.radius),N=w.angle-T,I=w.angle+T;return isBetweenAngles(B,N,I)||isBetweenAngles(C,N,I)?!1:(B=Math.min(N,B),C=Math.max(I,C),!0)}),{itemId:e,nodeData:R,labelData:m}}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const t={toKey:this.properties.toKey,fromKey:this.properties.fromKey,sizeKey:this.properties.sizeKey,size:Number.NaN},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{size:a,text:o,centerX:r,centerY:n,radius:l,angle:c})=>{t.size=a;const h=getLabelStyles(this,void 0,t,this.properties.label,!1,i),{fontStyle:p,fontWeight:u,fontSize:g,fontFamily:d,color:m}=h;s.visible=!0,s.translationX=r+l*Math.cos(c),s.translationY=n+l*Math.sin(c),s.text=o,s.fill=m,s.fontStyle=p,s.fontWeight=u,s.fontSize=g,s.fontFamily=d,s.textBaseline="middle",Math.cos(c)>=0?(s.textAlign="left",s.rotation=c):(s.textAlign="right",s.rotation=c-Math.PI),s.setBoxing(h)})}updateNodeSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>createDatumId6(t.type,t.id))}getNodeStyle(e,t,i){const{properties:s}=this,{fills:a,strokes:o,fillGradientDefaults:r,fillPatternDefaults:n,fillImageDefaults:l}=s,{itemStyler:c}=s.node,h=this.getHighlightStyle(i,e.datumIndex),p=mergeDefaults8(h,s.node.getStyle(a,o,t));let u=getShapeStyle(p,r,n,l);if(c!=null&&e.datumIndex!=null){const g=this.cachedDatumCallback(createDatumId6(e.datumIndex.index,"node",i?"highlight":"node"),()=>{const d=this.makeItemStylerParams(e,i,u);return this.callWithContext(c,d)});g&&(u=getShapeStyle(mergeDefaults8(g,u),r,n,l))}return u.opacity=1,u}makeItemStylerParams({datum:e,datumIndex:t,size:i=0,label:s},a,o){const{id:r}=this,n=this.ctx.highlightManager?.getActiveHighlight(),l=this.getHighlightStateString(n,a,t),c=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:r,datum:e,highlighted:a,highlightState:l,...o,size:i,label:s,fill:c}}updateNodeNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((a,o)=>{const{datumIndex:r}=o,n=this.getNodeStyle(o,r.index,i);applyShapeStyle7(a,n,s),a.centerX=o.centerX,a.centerY=o.centerY,a.innerRadius=o.innerRadius,a.outerRadius=o.outerRadius,a.startAngle=o.startAngle,a.endAngle=o.endAngle,a.inset=a.strokeWidth/2})}updateLinkSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>createDatumId6(t.type,t.index,t.fromNode.id,t.toNode.id))}getLinkStyle({datumIndex:e,datum:t},i,s){const{id:a,properties:o}=this,{fills:r,strokes:n,fillGradientDefaults:l,fillPatternDefaults:c,fillImageDefaults:h}=o,{itemStyler:p}=o.link,u=this.getHighlightStyle(s,e),g=mergeDefaults8(u,o.link.getStyle(r,n,i.index));let d=getShapeStyle(g,l,c,h);if(p!=null&&e!=null){const m=this.ctx.highlightManager?.getActiveHighlight(),y=this.cachedDatumCallback(createDatumId6(e.index,"link",s?"highlight":"node"),()=>{const f=this.getHighlightStateString(m,s,i);return this.callWithContext(p,{seriesId:a,datum:t,highlighted:s,highlightState:f,...d})});y&&(d=getShapeStyle(mergeDefaults8(y,d),l,c,h))}return d.opacity=1,d}updateLinkNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((a,o)=>{const r=o.fromNode.datumIndex,n=this.getLinkStyle(o,r,i);a.centerX=o.centerX,a.centerY=o.centerY,a.radius=o.radius,a.startAngle1=o.startAngle1,a.endAngle1=o.endAngle1,a.startAngle2=o.startAngle2,a.endAngle2=o.endAngle2,a.tension=n.tension,applyShapeStyle7(a,n,s)})}getShapeFillBBox(){const e=this._nodeDataDependencies?.seriesRectWidth??0,t=this._nodeDataDependencies?.seriesRectHeight??0,i=Math.min(e,t),s=(e-i)/2,a=(t-i)/2,o=new BBox6(s,a,e,t);return{series:o,axis:o}}getTooltipContent(e){const{id:t,linksProcessedData:i,nodesProcessedData:s,properties:a,ctx:{formatManager:o}}=this,{fromKey:r,toKey:n,sizeKey:l,sizeName:c,tooltip:h}=a,p=this.contextNodeData?.nodeData.find(S=>S.datumIndex.type===e.type&&S.datumIndex.index===e.index);if(p==null)return;const u=p.type===0?p.fromNode.index:p.index,g=p.type===0?`${p.fromNode.label} - ${p.toNode.label}`:p.label,d=e.type===0?i?.dataSources.get(this.id)?.data[e.index]:s?.dataSources.get(this.id)?.data[e.index],m=p.size;let y;if(p.type===0){const S=p.fromNode.datumIndex;y=this.getLinkStyle({datumIndex:e,datum:d},S,!1)}else{const S=p.label;y=this.getNodeStyle({datumIndex:e,datum:d,size:m,label:S},e.index,!1)}const f=[];if(l!=null){const S=o.format(this.callWithContext.bind(this),{type:"number",value:m,datum:d,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",domain:[],boundSeries:this.getFormatterContext("size"),fractionDigits:void 0});f.push({label:c,fallbackLabel:l,value:S??String(m)})}return this.formatTooltipWithContext(h,{title:g,symbol:this.legendItemSymbol(p.type,u,y),data:f},{seriesId:t,datum:d,title:g,fromKey:r,toKey:n,sizeKey:l,sizeName:c,size:m,...y})}computeFocusBounds(e){return e}hasItemStylers(){return this.properties.node.itemStyler!=null||this.properties.link.itemStyler!=null||this.properties.label.itemStyler!=null}};ChordSeries.className="ChordSeries",ChordSeries.type="chord";var import_ag_charts_community69=require("ag-charts-community"),import_ag_charts_core23=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs8,chordSeriesThemeableOptionsDef}=import_ag_charts_community69._ModuleSupport,chordSeriesOptionsDef={...chordSeriesThemeableOptionsDef,...commonSeriesOptionsDefs8,type:(0,import_ag_charts_core23.required)((0,import_ag_charts_core23.constant)("chord")),fromKey:(0,import_ag_charts_core23.required)(import_ag_charts_core23.string),toKey:(0,import_ag_charts_core23.required)(import_ag_charts_core23.string),sizeKey:import_ag_charts_core23.string,sizeName:import_ag_charts_core23.string};chordSeriesOptionsDef.fillGradientDefaults=(0,import_ag_charts_core23.undocumented)(import_ag_charts_core23.fillGradientDefaults),chordSeriesOptionsDef.fillPatternDefaults=(0,import_ag_charts_core23.undocumented)(import_ag_charts_core23.fillPatternDefaults),chordSeriesOptionsDef.fillImageDefaults=(0,import_ag_charts_core23.undocumented)(import_ag_charts_core23.fillImageDefaults);var ChordModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],solo:!0,identifier:"chord",moduleFactory:e=>new ChordSeries(e),themeTemplate:{series:{fills:{$palette:"fills"},strokes:{$palette:"strokes"},fillGradientDefaults:import_ag_charts_community70._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS,fillPatternDefaults:import_ag_charts_community70._ModuleSupport.FILL_PATTERN_DEFAULTS,fillImageDefaults:import_ag_charts_community70._ModuleSupport.FILL_IMAGE_DEFAULTS,highlightStyle:{series:{dimOpacity:.2}},highlight:import_ag_charts_community70._ModuleSupport.singleSeriesHighlightStyle(),label:{...import_ag_charts_community70._ModuleSupport.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:5,maxWidth:100},node:{spacing:8,width:10,strokeWidth:{$isUserOption:["./stroke",2,0]}},link:{fillOpacity:.5,strokeWidth:{$isUserOption:["./stroke",2,0]},tension:.4}},legend:{enabled:!1,toggleSeries:!1}}},ChordSeriesModule={type:"series",name:"chord",chartType:"standalone",enterprise:!0,options:chordSeriesOptionsDef,create:e=>new ChordSeries(e)},import_ag_charts_community71=require("ag-charts-community"),{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE7,CARTESIAN_POSITION:CARTESIAN_POSITION5},ThemeSymbols:{DEFAULT_SHADOW_COLOUR}}=import_ag_charts_community71._ModuleSupport,isHorizontal={$eq:[{$path:["/series/0/direction",void 0]},"horizontal"]},labelOptions={autoRotate:{$path:"/series/0/stageLabel/autoRotate"},autoRotateAngle:{$path:"/series/0/stageLabel/autoRotateAngle"},avoidCollisions:{$path:["/series/0/stageLabel/avoidCollisions",!0]},border:{$path:["/series/0/stageLabel/border"]},color:{$path:["/series/0/stageLabel/color",{$ref:"textColor"}]},cornerRadius:{$path:["/series/0/stageLabel/cornerRadius"]},enabled:{$if:[{$eq:[{$path:"/series/0/stageLabel/enabled"},void 0]},!0,{$path:"/series/0/stageLabel/enabled"}]},fill:{$path:["/series/0/stageLabel/fill"]},fillOpacity:{$path:["/series/0/stageLabel/fillOpacity"]},fontSize:{$path:["/series/0/stageLabel/fontSize",{$ref:"fontSize"}]},fontStyle:{$path:["/series/0/stageLabel/fontStyle",{$ref:"fontStyle"}]},fontWeight:{$path:["/series/0/stageLabel/fontWeight",{$ref:"fontWeight"}]},format:{$path:"/series/0/stageLabel/format"},formatter:{$path:"/series/0/stageLabel/formatter"},itemStyler:{$path:"/series/0/stageLabel/itemStyler"},minSpacing:{$path:"/series/0/stageLabel/minSpacing"},padding:{$path:["/series/0/stageLabel/padding"]},rotation:{$path:["/series/0/stageLabel/rotation",0]}},FUNNEL_SERIES_AXES=[{type:{$if:[isHorizontal,CARTESIAN_AXIS_TYPE7.NUMBER,CARTESIAN_AXIS_TYPE7.CATEGORY]},position:{$if:[isHorizontal,CARTESIAN_POSITION5.LEFT,{$if:[{$eq:[{$path:["/series/0/stageLabel/placement",void 0]},"after"]},CARTESIAN_POSITION5.RIGHT,CARTESIAN_POSITION5.LEFT]}]},label:{$if:[isHorizontal,void 0,labelOptions]}},{type:{$if:[isHorizontal,CARTESIAN_AXIS_TYPE7.CATEGORY,CARTESIAN_AXIS_TYPE7.NUMBER]},position:{$if:[isHorizontal,{$if:[{$eq:[{$path:["/series/0/stageLabel/placement",void 0]},"before"]},CARTESIAN_POSITION5.TOP,CARTESIAN_POSITION5.BOTTOM]},CARTESIAN_POSITION5.BOTTOM]},label:{$if:[isHorizontal,labelOptions,void 0]}}],FUNNEL_SERIES_THEME={series:{direction:"vertical",strokeWidth:{$isUserOption:["./strokes/0",2,0]},spacingRatio:.25,fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},[{$path:["/0",void 0,{$palette:"fills"}]}],{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",import_ag_charts_community71._ModuleSupport.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS],["pattern",import_ag_charts_community71._ModuleSupport.FILL_PATTERN_SINGLE_DEFAULTS],["image",import_ag_charts_community71._ModuleSupport.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},[{$path:["/0",void 0,{$palette:"strokes"}]}]]},label:{...import_ag_charts_community71._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},dropOff:{enabled:!0,fillOpacity:.2,strokeWidth:{$isUserOption:["./stroke",2,0]}},shadow:{enabled:!1,color:DEFAULT_SHADOW_COLOUR,xOffset:3,yOffset:3,blur:5},highlight:import_ag_charts_community71._ModuleSupport.singleSeriesHighlightStyle()},axes:{[CARTESIAN_AXIS_TYPE7.NUMBER]:{nice:!1,gridLine:{enabled:!1},crosshair:{enabled:!1},label:{enabled:!1}},[CARTESIAN_AXIS_TYPE7.CATEGORY]:{line:{enabled:!1}}}},import_ag_charts_community76=require("ag-charts-community"),import_ag_charts_community74=require("ag-charts-community"),import_ag_charts_community72=require("ag-charts-community"),{lineDistanceSquared,BBox:BBox7,Path:Path8,SceneChangeDetection:SceneChangeDetection5}=import_ag_charts_community72._ModuleSupport,delta=1e-6;function pointsEq([e,t],[i,s]){return Math.abs(e-i)<=delta&&Math.abs(t-s)<=delta}var FunnelConnector=class extends Path8{constructor(){super(...arguments),this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0}get midPoint(){const{x0:e,y0:t,x1:i,y1:s,x2:a,y2:o,x3:r,y3:n}=this;return{x:(e+i+a+r)/4,y:(t+s+o+n)/4}}distanceSquared(e,t){if(this.containsPoint(e,t))return 0;const{x0:i,y0:s,x1:a,y1:o,x2:r,y2:n,x3:l,y3:c}=this;return Math.min(lineDistanceSquared(e,t,i,s,a,o,1/0),lineDistanceSquared(e,t,a,o,r,n,1/0),lineDistanceSquared(e,t,r,n,l,c,1/0),lineDistanceSquared(e,t,l,c,i,s,1/0))}computeBBox(){const{x0:e,y0:t,x1:i,y1:s,x2:a,y2:o,x3:r,y3:n}=this,l=Math.min(e,i,a,r),c=Math.max(e,i,a,r)-l,h=Math.min(t,s,o,n),p=Math.max(t,s,o,n)-h;return new BBox7(l,h,c,p)}updatePath(){const{path:e,x0:t,y0:i,x1:s,y1:a,x2:o,y2:r,x3:n,y3:l}=this,c=[[t,i],[s,a],[o,r],[n,l]];e.clear();let h,p;for(const u of c){if(h!=null&&pointsEq(h,u)||p!=null&&pointsEq(p,u))continue;const[g,d]=u;h==null?e.moveTo(g,d):e.lineTo(g,d),h??(h=u),p=u}e.closePath()}};__decorateClass([SceneChangeDetection5()],FunnelConnector.prototype,"x0",2),__decorateClass([SceneChangeDetection5()],FunnelConnector.prototype,"y0",2),__decorateClass([SceneChangeDetection5()],FunnelConnector.prototype,"x1",2),__decorateClass([SceneChangeDetection5()],FunnelConnector.prototype,"y1",2),__decorateClass([SceneChangeDetection5()],FunnelConnector.prototype,"x2",2),__decorateClass([SceneChangeDetection5()],FunnelConnector.prototype,"y2",2),__decorateClass([SceneChangeDetection5()],FunnelConnector.prototype,"x3",2),__decorateClass([SceneChangeDetection5()],FunnelConnector.prototype,"y3",2);var import_ag_charts_community73=require("ag-charts-community"),{NODE_UPDATE_STATE_TO_PHASE_MAPPING}=import_ag_charts_community73._ModuleSupport;function connectorStartingPosition(e,t,i,s){const{x0:a,y0:o,x1:r,y1:n,x2:l,y2:c,x3:h,y3:p,opacity:u}=e;return i?{x0:(a+h)/2,y0:(o+p)/2,x1:(r+l)/2,y1:(n+c)/2,x2:(r+l)/2,y2:(n+c)/2,x3:(a+h)/2,y3:(o+p)/2,opacity:u}:{x0:(a+r)/2,y0:(o+n)/2,x1:(a+r)/2,y1:(o+n)/2,x2:(l+h)/2,y2:(c+p)/2,x3:(l+h)/2,y3:(c+p)/2,opacity:u}}function prepareConnectorAnimationFunctions(e,t){const i=o=>o==null;return{fromFn:(o,r,n)=>{n==="updated"&&i(r)?n="removed":n==="updated"&&i(o.previousDatum)&&(n="added");let l;n==="added"&&o.previousDatum==null&&t==="fade"?l={...resetConnectorSelectionsFn(o,r),opacity:0}:n==="unknown"||n==="added"?l=connectorStartingPosition(r,o.previousDatum,e,t):l={x0:o.x0,y0:o.y0,x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,x3:o.x3,y3:o.y3,opacity:o.opacity};const c=NODE_UPDATE_STATE_TO_PHASE_MAPPING[n];return{...l,phase:c}},toFn:(o,r,n)=>{let l;return n==="removed"&&o.datum==null&&t==="fade"?l={...resetConnectorSelectionsFn(o,r),opacity:0}:n==="removed"||i(r)?l=connectorStartingPosition(r,o.previousDatum,e,t):l=resetConnectorSelectionsFn(o,r),l}}}function resetConnectorSelectionsFn(e,t){const{x0:i,y0:s,x1:a,y1:o,x2:r,y2:n,x3:l,y3:c,opacity:h}=t;return{x0:i,y0:s,x1:a,y1:o,x2:r,y2:n,x3:l,y3:c,opacity:h}}var{SeriesNodePickMode:SeriesNodePickMode7,SeriesZIndexMap,valueProperty:valueProperty8,keyProperty:keyProperty7,ChartAxisDirection:ChartAxisDirection13,updateLabelNode:updateLabelNode5,SMALLEST_KEY_INTERVAL:SMALLEST_KEY_INTERVAL4,LARGEST_KEY_INTERVAL:LARGEST_KEY_INTERVAL2,diff:diff5,fixNumericExtent:fixNumericExtent6,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation4,resetMotion:resetMotion2,resetLabelFn:resetLabelFn4,animationValidation:animationValidation6,computeBarFocusBounds:computeBarFocusBounds6,ContinuousScale:ContinuousScale4,Group:Group6,Selection:Selection4,PointerEvents:PointerEvents4,motion:motion4,checkCrisp:checkCrisp3,createDatumId:createDatumId7,applyShapeStyle:applyShapeStyle8}=import_ag_charts_community74._ModuleSupport,FunnelSeriesNodeEvent=class extends import_ag_charts_community74._ModuleSupport.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.stageKey,this.yKey=s.properties.valueKey}},BaseFunnelSeries=class extends import_ag_charts_community74._ModuleSupport.AbstractBarSeries{constructor({moduleCtx:e,animationResetFns:t}){super({moduleCtx:e,pickModes:[SeriesNodePickMode7.AXIS_ALIGNED,SeriesNodePickMode7.EXACT_SHAPE_MATCH],propertyKeys:{x:["stageKey"],y:["valueKey"]},propertyNames:{x:[],y:[]},categoryKey:"xValue",datumSelectionGarbageCollection:!1,animationResetFns:{datum:t.datum,label:resetLabelFn4}}),this.NodeEvent=FunnelSeriesNodeEvent,this.connectorNodeGroup=this.contentGroup.appendChild(new Group6({name:`${this.id}-series-connectorNodes`,zIndex:SeriesZIndexMap.BACKGROUND})),this.connectorSelection=Selection4.select(this.connectorNodeGroup,()=>this.connectionFactory()),this.connectorNodeGroup.pointerEvents=PointerEvents4.None}get pickModeAxis(){return"main-category"}setZIndex(e){return super.setZIndex(e),this.connectorNodeGroup.zIndex=[SeriesZIndexMap.BACKGROUND,e],!0}isVertical(){return!super.isVertical()}connectionFactory(){return new FunnelConnector}async processData(e){const{stageKey:t,valueKey:i}=this.properties,{visible:s,id:a}=this,o=(d,m,y)=>s&&this.ctx.legendManager.getItemEnabled({seriesId:a,itemId:y}),r=this.getCategoryAxis()?.scale,n=this.getValueAxis()?.scale,{isContinuousX:l,xScaleType:c,yScaleType:h}=this.getScaleInformation({xScale:r,yScale:n}),p=[];this.ctx.animationManager.isSkipped()||(this.processedData&&p.push(diff5(this.id,this.processedData)),p.push(animationValidation6()));const u=this.visible?{}:{forceValue:0},{processedData:g}=await this.requestDataModel(e,this.data,{props:[keyProperty7(t,c,{id:"xValue"}),valueProperty8(i,h,{id:"yValue",...u,validation:o,invalidValue:0}),...l?[SMALLEST_KEY_INTERVAL4,LARGEST_KEY_INTERVAL2]:[],...p],groupByKeys:!1});this.smallestDataInterval=g.reduced?.smallestKeyInterval,this.largestDataInterval=g.reduced?.largestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i,id:s,ctx:{legendManager:a}}=this;if(!t||!i)return[];const{keys:[o]}=t.domain;if(e===this.getCategoryDirection()){const r=i.resolveProcessedDataDefById(this,"xValue");return r?.def.type==="key"&&r?.def.valueType==="category"?this.hasData?o.filter((n,l)=>a.getItemEnabled({seriesId:s,itemId:l})):[]:this.padBandExtent(o)}else{const r=this.domainForClippedRange(e,["yValue"],"xValue"),n=Math.max(...r),l=[-n,n];return fixNumericExtent6(l)}}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{hasData:e,data:t,dataModel:i,groupScale:s,processedData:a,id:o,ctx:{legendManager:r}}=this,n=this.getCategoryAxis(),l=this.getValueAxis();if(!(e&&t&&n&&l&&i&&a?.type==="ungrouped"))return;const c=n.scale,h=l.scale,p=this.getBarDirection()===ChartAxisDirection13.X,{stageKey:u,valueKey:g}=this.properties,d=`${g}`,m={itemId:d,nodeData:[],labelData:[],connectorData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible},y=this.visible;if(!y)return m;const f=i.resolveKeysById(this,"xValue",a),S=i.resolveColumnById(this,"yValue",a),{barWidth:b,groupIndex:x}=this.updateGroupScale(n),v=ContinuousScale4.is(c)?b*-.5:0,_=checkCrisp3(n?.scale,n?.visibleRange,this.smallestDataInterval,this.largestDataInterval);let D;const k=a.dataSources.get(this.id)?.data??[];for(const[A,L]of k.entries()){const R=y&&r.getItemEnabled({seriesId:o,itemId:A}),O=f[A];if(O==null)continue;const B=Math.round(c.convert(O))+s.convert(String(x))+v,C=S[A],w=Math.round(h.convert(-C)),M=Math.round(h.convert(C)),T=this.getItemStyle({datum:L,datumIndex:A},!1),N=Math.max(T.strokeWidth??0,Math.abs(M-w)),I={x:p?Math.min(M,w):B,y:p?B:Math.min(M,w),width:p?N:b,height:p?b:N},P={x:I.x+I.width/2,y:I.y+I.height/2},F=this.createLabelData({datumIndex:A,rect:I,barAlongX:p,yDatum:C,datum:L,visible:R}),E={index:A,series:this,itemId:d,datum:L,datumIndex:A,xValue:O,yValue:C,xKey:u,yKey:g,x:I.x,y:I.y,width:I.width,height:I.height,midPoint:P,crisp:_,label:F,visible:R};if(m.nodeData.push(E),F!=null&&m.labelData.push(F),D!=null){const G=D.rect,K=D.nodeDatum,V=D.datumIndex;p?m.connectorData.push({datum:K,datumIndex:V,x0:G.x,y0:G.y+G.height,x1:G.x+G.width,y1:G.y+G.height,x2:I.x+I.width,y2:I.y,x3:I.x,y3:I.y,opacity:1}):m.connectorData.push({datum:K,datumIndex:V,x0:G.x+G.width,y0:G.y,x1:I.x,y1:I.y,x2:I.x,y2:I.y+I.height,x3:G.x+G.width,y3:G.y+G.height,opacity:1})}R&&(D={itemId:d,rect:I,nodeDatum:E,datumIndex:A})}return m}updateNodes(e,t){super.updateNodes(e,t);const{connectorSelection:i}=this,s=this.contextNodeData?.connectorData??[];this.connectorSelection=this.updateConnectorSelection({connectorSelection:i,connectorData:s}),this.updateConnectorNodes({connectorSelection:i})}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,s=t??[];return i.update(s,void 0,a=>this.getDatumId(a))}updateConnectorSelection(e){const{connectorData:t,connectorSelection:i}=e;return i.update(this.connectorEnabled()?t:[],void 0,s=>this.getDatumId(s.datum))}updateConnectorNodes(e){const t=this.getShapeFillBBox();e.connectorSelection.each((i,s)=>{const{fill:a,fillOpacity:o,stroke:r,strokeOpacity:n,strokeWidth:l,lineDash:c,lineDashOffset:h}=this.connectorStyle(s.datumIndex);i.setProperties(resetConnectorSelectionsFn(i,s)),applyShapeStyle8(i,{fill:a,stroke:r,fillOpacity:o,strokeOpacity:n,strokeWidth:l,lineDash:c,lineDashOffset:h},t)})}updateLabelSelection(e){const t=this.properties.label.enabled?e.labelData:[];return e.labelSelection.update(t,i=>{i.pointerEvents=PointerEvents4.None})}updateLabelNodes(e){const t={stageKey:this.properties.stageKey,valueKey:this.properties.valueKey},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,a)=>{s.fillOpacity=this.getHighlightStyle(!1,a.datumIndex).opacity??1,updateLabelNode5(this,s,t,this.properties.label,a,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:a}=this,{stageKey:o,valueKey:r,tooltip:n,legendItemName:l}=a,c=this.getCategoryAxis(),h=this.getValueAxis();if(!i||!s||!c||!h)return;const p=s.dataSources.get(this.id)?.data[e],u=i.resolveKeysById(this,"xValue",s)[e],g=i.resolveColumnById(this,"yValue",s)[e];if(u!=null)return this.formatTooltipWithContext(n,{symbol:this.legendItemSymbol(e),data:[{label:this.getAxisValueText(c,"tooltip",u,p,o,l),value:this.getAxisValueText(h,"tooltip",g,p,r,l)}]},{seriesId:t,datum:p,title:o,stageKey:o,valueKey:r,...this.tooltipStyle(p,e)})}resetAllAnimation(e){super.resetAllAnimation(e),resetMotion2([this.connectorSelection],resetConnectorSelectionsFn)}animateEmptyUpdateReady({labelSelection:e}){const{connectorSelection:t}=this,i=this.isVertical(),a=prepareConnectorAnimationFunctions(i,"normal");motion4.fromToMotion(this.id,"connectors",this.ctx.animationManager,[t],a),seriesLabelFadeInAnimation4(this,"labels",this.ctx.animationManager,e)}animateWaitingUpdateReady(e){const{labelSelection:t}=e;this.ctx.animationManager.stopByAnimationGroupId(this.id),seriesLabelFadeInAnimation4(this,"labels",this.ctx.animationManager,t)}getDatumId(e){return createDatumId7(e.xValue)}isLabelEnabled(){return this.properties.label.enabled}computeFocusBounds({datumIndex:e}){return computeBarFocusBounds6(this,this.contextNodeData?.nodeData[e])}legendItemSymbol(e){const{strokeWidth:t,fillOpacity:i,strokeOpacity:s,lineDash:a,lineDashOffset:o,fill:r,stroke:n}=this.properties.getStyle(e);return{marker:{fill:r,fillOpacity:i,stroke:n,strokeWidth:t,strokeOpacity:s,lineDash:a,lineDashOffset:o}}}getLegendData(e){const{id:t,processedData:i,dataModel:s,ctx:{legendManager:a},visible:o}=this;if(!s||!i||e!=="category")return[];const{showInLegend:r}=this.properties,n=s.resolveKeysById(this,"xValue",i);return(i.dataSources.get(this.id)?.data??[]).map((l,c)=>{const h=n[c];if(h!=null)return{legendType:"category",id:t,datum:l,itemId:c,seriesId:t,enabled:o&&a.getItemEnabled({seriesId:t,itemId:c}),label:{text:String(h)},symbol:this.legendItemSymbol(c),skipAnimations:!0,hideInLegend:!r}}).filter(l=>l!=null)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}},import_ag_charts_community75=require("ag-charts-community"),{Label:Label5,AbstractBarSeriesProperties:AbstractBarSeriesProperties5,makeSeriesTooltip:makeSeriesTooltip9,AxisLabel,Property:Property21}=import_ag_charts_community75._ModuleSupport,ConeFunnelSeriesLabel=class extends Label5{constructor(){super(...arguments),this.spacing=0}};__decorateClass([Property21],ConeFunnelSeriesLabel.prototype,"placement",2),__decorateClass([Property21],ConeFunnelSeriesLabel.prototype,"spacing",2);var ConeFunnelSeriesStageLabel=class extends AxisLabel{};__decorateClass([Property21],ConeFunnelSeriesStageLabel.prototype,"placement",2);var ConeFunnelProperties=class extends AbstractBarSeriesProperties5{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.label=new ConeFunnelSeriesLabel,this.stageLabel=new ConeFunnelSeriesStageLabel,this.tooltip=makeSeriesTooltip9()}getStyle(e){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n}=this;return{fill:t[e],fillOpacity:s,stroke:i[e],strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n,opacity:1}}};__decorateClass([Property21],ConeFunnelProperties.prototype,"stageKey",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"valueKey",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"fills",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"fillOpacity",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"strokes",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"strokeWidth",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"strokeOpacity",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"lineDash",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"lineDashOffset",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"label",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"stageLabel",2),__decorateClass([Property21],ConeFunnelProperties.prototype,"tooltip",2);function resetLineSelectionsFn(e,{x:t,y:i,width:s,height:a,opacity:o}){return{x1:t,y1:i,x2:t+s,y2:i+a,opacity:o??1}}var{Line:Line3,ChartAxisDirection:ChartAxisDirection14}=import_ag_charts_community76._ModuleSupport,ConeFunnelSeries=class extends BaseFunnelSeries{constructor(e){super({moduleCtx:e,animationResetFns:{datum:resetLineSelectionsFn}}),this.properties=new ConeFunnelProperties}get hasData(){const{id:e,ctx:{legendManager:t}}=this,i=this.data?.data.reduce((s,a,o)=>s+(t.getItemEnabled({seriesId:e,itemId:o})?1:0),0);return i!=null&&i>1}getBandScalePadding(){return{inner:1,outer:0}}connectorEnabled(){return!0}getItemStyle({datumIndex:e},t){return this.properties.getStyle(e)}connectorStyle(e){return this.properties.getStyle(e)}nodeFactory(){return new Line3}createLabelData({datumIndex:e,rect:t,barAlongX:i,yDatum:s,datum:a,visible:o}){const{stageKey:r,valueKey:n,label:l}=this.properties,{spacing:c,placement:h}=l;if(!l.enabled)return;let p,u,g,d;if(i)switch(p=t.x+t.width/2,g="center",h){case"before":u=t.y-c,d="bottom";break;case"after":u=t.y+t.height+c,d="top";break;default:u=t.y+t.height/2,d="middle"}else switch(u=t.y+t.height/2,d="middle",h){case"before":p=t.x-c,g="right";break;case"after":p=t.x+t.width+c,g="left";break;default:p=t.x+t.width/2,g="center"}const m=this.getSeriesDomain(ChartAxisDirection14.Y),y=this.getLabelText(s,a,n,"y",m,l,{itemId:n,value:s,datum:a,stageKey:r,valueKey:n});return{x:p,y:u,textAlign:g,textBaseline:d,text:y,itemId:n,datum:a,datumIndex:e,series:this,visible:o}}updateDatumNodes(e){const t=this.getHighlightStyle(e.isHighlight);e.datumSelection.each((i,s)=>{i.setProperties(resetLineSelectionsFn(i,s)),i.stroke=t?.stroke,i.strokeWidth=t?.strokeWidth??0,i.strokeOpacity=t?.strokeOpacity??1,i.lineDash=t?.lineDash,i.lineDashOffset=t?.lineDashOffset??0,i.opacity=t?.opacity??1})}tooltipStyle(e,t){const{fill:i,stroke:s,fillOpacity:a,strokeOpacity:o,strokeWidth:r,lineDash:n,lineDashOffset:l}=this.properties.getStyle(t);return{fill:i,fillOpacity:a,stroke:s,strokeOpacity:o,strokeWidth:r,lineDash:n,lineDashOffset:l}}hasItemStylers(){return this.properties.label.itemStyler!=null}};ConeFunnelSeries.className="ConeFunnelSeries",ConeFunnelSeries.type="cone-funnel";var import_ag_charts_community77=require("ag-charts-community"),import_ag_charts_core24=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs9,coneFunnelSeriesThemeableOptionsDef,without:without3}=import_ag_charts_community77._ModuleSupport,coneFunnelSeriesOptionsDef={...without3(commonSeriesOptionsDefs9,["showInLegend"]),...coneFunnelSeriesThemeableOptionsDef,type:(0,import_ag_charts_core24.required)((0,import_ag_charts_core24.constant)("cone-funnel")),stageKey:(0,import_ag_charts_core24.required)(import_ag_charts_core24.string),valueKey:(0,import_ag_charts_core24.required)(import_ag_charts_core24.string)},import_ag_charts_community78=require("ag-charts-community"),{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE8}}=import_ag_charts_community78._ModuleSupport,CONE_FUNNEL_SERIES_THEME={series:{direction:"vertical",fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"secondSequentialColors"},import_ag_charts_community78._ModuleSupport.SAFE_RANGE2_OPERATION]},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",import_ag_charts_community78._ModuleSupport.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS],["pattern",import_ag_charts_community78._ModuleSupport.FILL_PATTERN_SINGLE_DEFAULTS],["image",import_ag_charts_community78._ModuleSupport.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"secondSequentialColors"},import_ag_charts_community78._ModuleSupport.SAFE_RANGE2_OPERATION]}]},strokeWidth:{$isUserOption:["./strokes/0",2,0]},label:{...import_ag_charts_community78._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},placement:"before",spacing:4},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:import_ag_charts_community78._ModuleSupport.singleSeriesHighlightStyle(!1)},seriesArea:{padding:{top:20,bottom:20}},axes:{[CARTESIAN_AXIS_TYPE8.NUMBER]:{nice:!1,gridLine:{enabled:!1},crosshair:{enabled:!1},label:{enabled:!1}},[CARTESIAN_AXIS_TYPE8.CATEGORY]:{line:{enabled:!1}}}},ConeFunnelSeriesModule={type:"series",name:"cone-funnel",chartType:"cartesian",enterprise:!0,options:coneFunnelSeriesOptionsDef,create:e=>new ConeFunnelSeries(e)},import_ag_charts_community80=require("ag-charts-community"),import_ag_charts_community79=require("ag-charts-community"),{Label:Label6,DropShadow:DropShadow4,AbstractBarSeriesProperties:AbstractBarSeriesProperties6,BaseProperties:BaseProperties8,makeSeriesTooltip:makeSeriesTooltip10,AxisLabel:AxisLabel2,Property:Property22}=import_ag_charts_community79._ModuleSupport,FunnelSeriesLabel=class extends Label6{},FunnelSeriesStageLabel=class extends AxisLabel2{};__decorateClass([Property22],FunnelSeriesStageLabel.prototype,"placement",2);var FunnelDropOff=class extends BaseProperties8{constructor(){super(...arguments),this.enabled=!0,this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(){const{fill:e,stroke:t,fillOpacity:i,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r}=this;return{fill:e,fillOpacity:i,stroke:t,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r,opacity:1}}};__decorateClass([Property22],FunnelDropOff.prototype,"enabled",2),__decorateClass([Property22],FunnelDropOff.prototype,"fill",2),__decorateClass([Property22],FunnelDropOff.prototype,"fillOpacity",2),__decorateClass([Property22],FunnelDropOff.prototype,"stroke",2),__decorateClass([Property22],FunnelDropOff.prototype,"strokeWidth",2),__decorateClass([Property22],FunnelDropOff.prototype,"strokeOpacity",2),__decorateClass([Property22],FunnelDropOff.prototype,"lineDash",2),__decorateClass([Property22],FunnelDropOff.prototype,"lineDashOffset",2);var FunnelProperties=class extends AbstractBarSeriesProperties6{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.spacingRatio=0,this.dropOff=new FunnelDropOff,this.shadow=new DropShadow4().set({enabled:!1}),this.label=new FunnelSeriesLabel,this.stageLabel=new FunnelSeriesStageLabel,this.tooltip=makeSeriesTooltip10()}getStyle(e){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n}=this;return{fill:t[e],fillOpacity:s,stroke:i[e],strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n,opacity:1}}};__decorateClass([Property22],FunnelProperties.prototype,"stageKey",2),__decorateClass([Property22],FunnelProperties.prototype,"valueKey",2),__decorateClass([Property22],FunnelProperties.prototype,"fills",2),__decorateClass([Property22],FunnelProperties.prototype,"fillOpacity",2),__decorateClass([Property22],FunnelProperties.prototype,"strokes",2),__decorateClass([Property22],FunnelProperties.prototype,"strokeWidth",2),__decorateClass([Property22],FunnelProperties.prototype,"strokeOpacity",2),__decorateClass([Property22],FunnelProperties.prototype,"lineDash",2),__decorateClass([Property22],FunnelProperties.prototype,"lineDashOffset",2),__decorateClass([Property22],FunnelProperties.prototype,"spacingRatio",2),__decorateClass([Property22],FunnelProperties.prototype,"itemStyler",2),__decorateClass([Property22],FunnelProperties.prototype,"dropOff",2),__decorateClass([Property22],FunnelProperties.prototype,"shadow",2),__decorateClass([Property22],FunnelProperties.prototype,"label",2),__decorateClass([Property22],FunnelProperties.prototype,"stageLabel",2),__decorateClass([Property22],FunnelProperties.prototype,"tooltip",2);var{ChartAxisDirection:ChartAxisDirection15,resetBarSelectionsFn:resetBarSelectionsFn3,prepareBarAnimationFunctions:prepareBarAnimationFunctions3,midpointStartingBarPosition:midpointStartingBarPosition2,createDatumId:createDatumId8,Rect:Rect4,motion:motion5,applyShapeStyle:applyShapeStyle9,mergeDefaults:mergeDefaults9}=import_ag_charts_community80._ModuleSupport,FunnelSeries=class extends BaseFunnelSeries{constructor(e){super({moduleCtx:e,animationResetFns:{datum:resetBarSelectionsFn3}}),this.properties=new FunnelProperties}getBandScalePadding(){return{inner:this.properties.spacingRatio,outer:0}}connectorEnabled(){return this.properties.dropOff.enabled}connectorStyle(e){return mergeDefaults9(this.properties.dropOff.getStyle(),this.properties.getStyle(e))}nodeFactory(){return new Rect4}createLabelData({datumIndex:e,rect:t,yDatum:i,datum:s,visible:a}){const{valueKey:o,stageKey:r,label:n}=this.properties;if(!n.enabled)return;const l=this.getSeriesDomain(ChartAxisDirection15.Y),c=this.getLabelText(i,s,o,"y",l,n,{itemId:o,value:i,datum:s,stageKey:r,valueKey:o});return{x:t.x+t.width/2,y:t.y+t.height/2,textAlign:"center",textBaseline:"middle",text:c,itemId:r,datum:s,datumIndex:e,series:this,visible:a}}getItemStyle({datum:e,datumIndex:t},i){const{id:s,properties:a}=this,{stageKey:o,valueKey:r,itemStyler:n}=a,l=this.getHighlightStyle(i,t);let h=mergeDefaults9(l,a.getStyle(t));if(n!=null){const p=this.ctx.highlightManager?.getActiveHighlight(),u=this.cachedDatumCallback(createDatumId8(t,i?"highlight":"node"),()=>{const g=this.getHighlightStateString(p,i,t);return this.callWithContext(n,{seriesId:s,datum:e,highlighted:i,highlightState:g,stageKey:o,valueKey:r,...h})});u&&(h=mergeDefaults9(u,h))}return h}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const{shadow:s}=this.properties,a=this.getCategoryDirection()===ChartAxisDirection15.X,o=this.getShapeFillBBox();e.each((r,n)=>{const l=this.getItemStyle(n,t);applyShapeStyle9(r,l,o),r.visible=a?n.width>0:n.height>0,r.crisp=n.crisp,r.fillShadow=s})}tooltipStyle(e,t){return this.getItemStyle({datum:e,datumIndex:t},!1)}animateEmptyUpdateReady(e){super.animateEmptyUpdateReady(e);const{datumSelection:t}=e,i=this.isVertical(),a=prepareBarAnimationFunctions3(midpointStartingBarPosition2(i,"normal"),"unknown");motion5.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],a)}animateWaitingUpdateReady(e){super.animateWaitingUpdateReady(e);const{datumSelection:t}=e,{processedData:i}=this,s=i?.reduced?.diff?.[this.id],a=prepareBarAnimationFunctions3(midpointStartingBarPosition2(this.isVertical(),"fade"),"added");motion5.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],a,(o,r)=>r.xValue,s)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};FunnelSeries.className="FunnelSeries",FunnelSeries.type="funnel";var import_ag_charts_community81=require("ag-charts-community"),import_ag_charts_core25=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs10,funnelSeriesThemeableOptionsDef,without:without4}=import_ag_charts_community81._ModuleSupport,funnelSeriesOptionsDef={...funnelSeriesThemeableOptionsDef,...without4(commonSeriesOptionsDefs10,["showInLegend"]),type:(0,import_ag_charts_core25.required)((0,import_ag_charts_core25.constant)("funnel")),stageKey:(0,import_ag_charts_core25.required)(import_ag_charts_core25.string),valueKey:(0,import_ag_charts_core25.required)(import_ag_charts_core25.string)},FunnelSeriesModule={type:"series",name:"funnel",chartType:"cartesian",enterprise:!0,options:funnelSeriesOptionsDef,create:e=>new FunnelSeries(e)},import_ag_charts_community87=require("ag-charts-community"),import_ag_charts_community86=require("ag-charts-community"),import_ag_charts_core30=require("ag-charts-core"),import_ag_charts_community82=require("ag-charts-community");function formatWithContext(e,t,i){return import_ag_charts_community82._ModuleSupport.callWithContext(e.chartService,t,i)}var DatumUnion=class{*[Symbol.iterator](){const{node:e,datum:t}=this;e&&t&&(yield{node:e,datum:t})}nodes(){return this.node?[this.node]:[]}update(e,t,i,s){const a=e.nodes();if(a.length===0)this.node?.remove(),this.node=void 0;else{this.node===void 0&&(this.node=new i,this.node.fillOpacity=0,this.node.strokeOpacity=0,t.appendChild(this.node));const o=a[0],r=a.toReversed().find(n=>n.datum.datum.value>n.datum.datum.segmentStart)??a.at(-1);this.node.datum=this.datum=o.datum,s(this.node,o,r)}}},import_ag_charts_core26=require("ag-charts-core"),fadeInFns={fromFn:()=>({opacity:0,phase:"initial"}),toFn:()=>({opacity:1})};function formatLabel(e,t){if(e==null)return"";const{min:i,max:s}=t,a=i===0?0:Math.ceil(Math.log10(Math.abs(i))),o=s===0?0:Math.ceil(Math.log10(Math.abs(s))),r=Math.max(2-Math.max(a,o),0);return e.toFixed(r)}function getLabelText(e,t,i,s){if(i.text!=null)return i.text;const a=s??i.value;let o;return i?.formatter!=null&&(o=formatWithContext(t,i.formatter,{seriesId:e,datum:void 0,value:a})),o==null||(0,import_ag_charts_core26.isArray)(o)?o:String(o)}function lineMarker({path:e,x:t,y:i,size:s}){e.moveTo(t,i-s/2),e.lineTo(t,i+s/2)}var import_ag_charts_core27=require("ag-charts-core");function pickGaugeNearestDatum(e,t){const i=(0,import_ag_charts_core27.iterate)(e.datumUnion.nodes(),e.targetSelection.nodes());return e.pickNodeNearestDistantObject(t,i)}function pickGaugeFocus(e,t){const i=[{data:e.contextNodeData?.nodeData,selection:e.datumUnion},{data:e.contextNodeData?.targetData,selection:e.targetSelection}].filter(l=>l.data&&l.data.length>0),s=(0,import_ag_charts_core27.clamp)(0,t.otherIndex+t.otherIndexDelta,i.length-1);if(i.length===0)return;const{data:a,selection:o}=i[s];if(a==null||a.length===0)return;const r=(0,import_ag_charts_core27.clamp)(0,t.datumIndex,a.length-1),n=a[r];for(const l of o)if(l.datum===n)return{bounds:l.node,clipFocusBox:!0,datum:n,datumIndex:r,otherIndex:s}}var import_ag_charts_community84=require("ag-charts-community"),import_ag_charts_community83=require("ag-charts-community"),import_ag_charts_core28=require("ag-charts-core"),{BaseProperties:BaseProperties9,Property:Property23}=import_ag_charts_community83._ModuleSupport,GaugeSegmentationIntervalProperties=class extends BaseProperties9{getSegments(e,t){const{values:i,step:s,count:a}=this,o=Math.min(...e.domain),r=Math.max(...e.domain);let n;if(i!=null){const l=i.filter(c=>c>o&&cc-h);n=[o,...l,r]}else if(s!=null){const l=[];for(let c=o;cc>o&&ch/l*(r-o)+o)}return n!=null&&n.length>t&&(import_ag_charts_core28.Logger.warnOnce("the configured segmentation results in more than 1 item per pixel, ignoring. Supply a segmentation configuration that results in larger segments or omit this configuration"),n=void 0),n??(n=[o,r]),n}};__decorateClass([Property23],GaugeSegmentationIntervalProperties.prototype,"values",2),__decorateClass([Property23],GaugeSegmentationIntervalProperties.prototype,"step",2),__decorateClass([Property23],GaugeSegmentationIntervalProperties.prototype,"count",2);var GaugeSegmentationProperties=class extends BaseProperties9{constructor(){super(...arguments),this.enabled=!1,this.interval=new GaugeSegmentationIntervalProperties,this.spacing=0}};__decorateClass([Property23],GaugeSegmentationProperties.prototype,"enabled",2),__decorateClass([Property23],GaugeSegmentationProperties.prototype,"interval",2),__decorateClass([Property23],GaugeSegmentationProperties.prototype,"spacing",2);var{BaseProperties:BaseProperties10,makeSeriesTooltip:makeSeriesTooltip11,SeriesProperties:SeriesProperties2,PropertiesArray:PropertiesArray2,Property:Property24,Label:Label7,AxisLabel:AxisLabel3,getColorStops}=import_ag_charts_community84._ModuleSupport,LinearGaugeDefaultTargetLabelProperties=class extends Label7{};__decorateClass([Property24],LinearGaugeDefaultTargetLabelProperties.prototype,"spacing",2);var LinearGaugeTargetProperties=class extends BaseProperties10{constructor(){super(...arguments),this.value=0,this.label=new LinearGaugeDefaultTargetLabelProperties}getStyle(e){const{fill:t=e.fill??"black",fillOpacity:i=e.fillOpacity??1,stroke:s=e.stroke??"black",strokeWidth:a=e.strokeWidth??0,strokeOpacity:o=e.strokeOpacity??1,lineDash:r=e.lineDash??[0],lineDashOffset:n=e.lineDashOffset??0}=this;return{fill:t,fillOpacity:i,stroke:s,strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n}}};__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"text",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"value",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"shape",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"placement",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"spacing",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"size",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"rotation",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"fill",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"fillOpacity",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"stroke",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"strokeWidth",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"strokeOpacity",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"lineDash",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"lineDashOffset",2),__decorateClass([Property24],LinearGaugeTargetProperties.prototype,"label",2);var LinearGaugeBarProperties=class extends BaseProperties10{constructor(){super(...arguments),this.enabled=!0,this.thicknessRatio=1,this.fills=new PropertiesArray2(import_ag_charts_community84._ModuleSupport.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t,i){const{fill:s,fills:a,fillMode:o,fillOpacity:r,stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}=this;return{fill:s??createLinearGradient(a,o,e,i,t),fillOpacity:r,stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}}};__decorateClass([Property24],LinearGaugeBarProperties.prototype,"enabled",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"thickness",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"thicknessRatio",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"fills",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"fillMode",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"fill",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"fillOpacity",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"stroke",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"strokeWidth",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"strokeOpacity",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"lineDash",2),__decorateClass([Property24],LinearGaugeBarProperties.prototype,"lineDashOffset",2);var LinearGaugeScaleIntervalProperties=class extends BaseProperties10{constructor(){super(...arguments),this.values=void 0,this.step=void 0,this.minSpacing=0,this.maxSpacing=1e3}};__decorateClass([Property24],LinearGaugeScaleIntervalProperties.prototype,"values",2),__decorateClass([Property24],LinearGaugeScaleIntervalProperties.prototype,"step",2),__decorateClass([Property24],LinearGaugeScaleIntervalProperties.prototype,"minSpacing",2),__decorateClass([Property24],LinearGaugeScaleIntervalProperties.prototype,"maxSpacing",2);var LinearGaugeScaleLabelProperties=class extends AxisLabel3{constructor(){super(...arguments),this.placement=void 0}};__decorateClass([Property24],LinearGaugeScaleLabelProperties.prototype,"placement",2);var LinearGaugeScaleProperties=class extends BaseProperties10{constructor(){super(...arguments),this.min=0,this.max=1,this.fills=new PropertiesArray2(import_ag_charts_community84._ModuleSupport.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.defaultFill="black",this.interval=new LinearGaugeScaleIntervalProperties,this.label=new LinearGaugeScaleLabelProperties}getStyle(e,t,i,s){const{fill:a,fills:o,defaultFill:r,fillMode:n,fillOpacity:l,stroke:c,strokeWidth:h,strokeOpacity:p,lineDash:u,lineDashOffset:g}=this;return{fill:a??(e&&o.length===0?r:void 0)??createLinearGradient(o,n,t,s,i),fillOpacity:l,stroke:c,strokeWidth:h,strokeOpacity:p,lineDash:u,lineDashOffset:g}}};__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"min",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"max",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"fills",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"fillMode",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"fill",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"fillOpacity",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"stroke",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"strokeWidth",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"strokeOpacity",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"lineDash",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"lineDashOffset",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"defaultFill",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"interval",2),__decorateClass([Property24],LinearGaugeScaleProperties.prototype,"label",2);var LinearGaugeLabelProperties=class extends AutoSizedLabel{constructor(){super(...arguments),this.placement="inside-center",this.avoidCollisions=!0}};__decorateClass([Property24],LinearGaugeLabelProperties.prototype,"text",2),__decorateClass([Property24],LinearGaugeLabelProperties.prototype,"placement",2),__decorateClass([Property24],LinearGaugeLabelProperties.prototype,"avoidCollisions",2);var LinearGaugeSeriesProperties=class extends SeriesProperties2{constructor(){super(...arguments),this.value=0,this.segmentation=new GaugeSegmentationProperties,this.defaultColorRange=[],this.targets=new PropertiesArray2(LinearGaugeTargetProperties),this.defaultTarget=new LinearGaugeTargetProperties,this.defaultScale=new LinearGaugeScaleProperties,this.direction="vertical",this.thickness=1,this.cornerRadius=0,this.cornerMode="container",this.margin=0,this.scale=new LinearGaugeScaleProperties,this.bar=new LinearGaugeBarProperties,this.label=new LinearGaugeLabelProperties,this.tooltip=makeSeriesTooltip11()}};__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"value",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"segmentation",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"defaultColorRange",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"targets",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"defaultTarget",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"defaultScale",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"direction",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"thickness",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"cornerMode",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"margin",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"scale",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"bar",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"label",2),__decorateClass([Property24],LinearGaugeSeriesProperties.prototype,"tooltip",2);function createLinearGradient(e,t,i,s,a){return{type:"gradient",gradient:"linear",colorSpace:"oklch",colorStops:getColorStops(e,i,s.domain,t),rotation:a?90:0,bounds:"series"}}var import_ag_charts_community85=require("ag-charts-community"),import_ag_charts_core29=require("ag-charts-core"),{BBox:BBox8}=import_ag_charts_community85._ModuleSupport;function datumRect(e){const{x0:t,y0:i,x1:s,y1:a,horizontalInset:o,verticalInset:r}=e,n=Math.min(t,s)+o,l=Math.min(i,a)+r,c=Math.max(Math.abs(s-t)-2*o,0),h=Math.max(Math.abs(a-i)-2*r,0);return{x:n,y:l,width:c,height:h}}function clipBBoxVisibility(e,t){if(t==null)return!0;const i=datumRect(e),s=1e-6,a=i.x+s,o=i.y+s,r=i.x+i.width-s,n=i.y+i.height-s,l=t.x,c=t.x+t.width,h=t.y,p=t.y+t.height;return Math.max(a,l)<=Math.min(r,c)&&Math.max(o,h)<=Math.min(n,p)}function hasClipBBox(e){const{clipX0:t,clipX1:i,clipY0:s,clipY1:a}=e;return t!=null&&i!=null||s!=null&&a!=null}function computeClipBBox(e){if(!hasClipBBox(e))return;const{x0:t,y0:i,x1:s,y1:a}=e,{x:o,y:r,width:n,height:l}=datumRect(e);let{clipX0:c,clipX1:h,clipY0:p,clipY1:u}=e;(c==null||h==null)&&(c=t,h=s),(p==null||u==null)&&(p=i,u=a);const g=Math.min(c,h),d=Math.min(p,u),m=Math.abs(h-c),y=Math.abs(u-p);return c=Math.max(o,g),p=Math.max(r,d),h=Math.min(o+n,g+m),u=Math.min(r+l,d+y),new BBox8(Math.min(c,h),Math.min(p,u),Math.abs(h-c),Math.abs(u-p))}function prepareLinearGaugeSeriesAnimationFunctions(e,t){const i=e?"initial":"update";return{node:{fromFn(a,o){const r=a.previousDatum;let{x0:n,y0:l,x1:c,y1:h,clipX0:p,clipY0:u,clipX1:g,clipY1:d}=r??o;const{horizontalInset:m,verticalInset:y}=o,f=r!=null&&hasClipBBox(r),S=hasClipBBox(o);return f&&S||(!f&&S?({x0:n,y0:l,x1:c,y1:h,clipX0:p,clipY0:u,clipX1:g,clipY1:d}=o,e&&(t?g=o.clipX0:d=o.clipY0)):f&&!S?({x0:n,y0:l,x1:c,y1:h}=o,p=void 0,u=void 0,g=void 0,d=void 0):e&&(t?c=n:h=l)),{x0:n,y0:l,x1:c,y1:h,clipX0:p,clipY0:u,clipX1:g,clipY1:d,horizontalInset:m,verticalInset:y,phase:i}},toFn(a,o){const{x0:r,y0:n,x1:l,y1:c,clipX0:h,clipY0:p,clipX1:u,clipY1:g,horizontalInset:d,verticalInset:m}=o;return{x0:r,y0:n,x1:l,y1:c,clipX0:h,clipY0:p,clipX1:u,clipY1:g,horizontalInset:d,verticalInset:m}},applyFn(a,o){a.setProperties(resetLinearGaugeSeriesResetRectFunction(a,o))}}}}function resetLinearGaugeSeriesResetRectFunction(e,t){const{x:i,y:s,width:a,height:o}=datumRect(t),r=computeClipBBox(t),n=clipBBoxVisibility(t,r);return{x:i,y:s,width:a,height:o,clipBBox:r,visible:n}}var horizontalTextAligns={Before:"right",Center:"center",After:"left"},verticalTextBaselines={Before:"top",Center:"middle",After:"bottom"},horizontalAlignFactors={Before:-1,Center:-.5,After:0},verticalAlignFactors2={Before:0,Center:-.5,After:-1};function formatLinearGaugeLabels(e,t,i,s,a,o){const{seriesRect:r,gaugeRect:n,barRect:l}=a,{padding:c,horizontal:h}=s;i.each((p,u)=>{const g=getLabelText(e.id,t,u,o?.label);let d,m;u.placement==="outside-start"?h?(d=n.x,m=r.height):(d=r.width,m=r.height-(n.y+n.height)):u.placement==="outside-end"?h?(d=r.width-(n.x+n.width),m=r.height):(d=r.width,m=n.y):u.avoidCollisions&&(d=n.width,m=n.height);let y;if(g==null)return;if(d!=null&&m!=null){const w=()=>({width:d,height:m,meta:null});y=formatSingleLabel((0,import_ag_charts_core29.toPlainText)(g),u,{padding:c},w)?.[0]}else{const w=(0,import_ag_charts_core29.cachedTextMeasurer)(u),{width:M,height:T}=(0,import_ag_charts_core29.isArray)(g)?(0,import_ag_charts_core29.measureTextSegments)(g,u):w.measureLines(g);y={text:g,fontSize:u.fontSize,lineHeight:u.lineHeight??w.lineHeight(),width:M,height:T}}if(y==null){p.visible=!1;return}const f=h?n.x:n.y+n.height,S=h?n.x+n.width:n.y,b=h?l.x:l.y+l.height,x=h?l.x+l.width:l.y,v=u.spacing*(h?1:-1);let _,D,k,A;switch(u.placement){case"outside-start":_=-1/0,D=1/0,k=f-v,A="Before";break;case"outside-end":_=-1/0,D=1/0,k=S+v,A="After";break;case"inside-start":_=f,D=x,k=f+v,A="After";break;case"inside-end":_=x,D=S,k=S-v,A="Before";break;case"inside-center":_=f,D=S,k=(f+S)/2,A="Center";break;case"bar-inside":_=b,D=x,k=(b+x)/2,A="Center";break;case"bar-inside-end":_=b,D=x,k=x-v,A="Before";break;case"bar-outside-end":_=x,D=S,k=x+v,A="After";break;case"bar-end":_=-1/0,D=1/0,k=x,A="Center";break}const L=h?k:n.x+n.width/2,R=h?n.y+n.height/2:k;let O,B;h?(O=L+horizontalAlignFactors[A]*y.width,B=O+y.width):(O=R+verticalAlignFactors2[A]*y.height,B=O+y.height);const C=Math.min(O,B)>=Math.min(_,D)&&Math.max(O,B)<=Math.max(_,D);if(u.avoidCollisions&&!C){p.visible=!1;return}p.visible=!0,p.text=y.text,p.fontSize=y.fontSize,p.lineHeight=y.lineHeight,p.textAlign=h?horizontalTextAligns[A]:"center",p.textBaseline=h?"middle":verticalTextBaselines[A],p.x=L,p.y=R})}var{fromToMotion:fromToMotion2,resetMotion:resetMotion3,SeriesNodePickMode:SeriesNodePickMode8,StateMachine,createDatumId:createDatumId9,toRadians:toRadians3,BBox:BBox9,Group:Group7,PointerEvents:PointerEvents5,Selection:Selection5,Rect:Rect5,Text,TransformableText:TransformableText2,Marker:Marker2,LinearScale:LinearScale3,generateTicks:generateTicks2,NiceMode,easing,findRangeExtent,tickFormat,mergeDefaults:mergeDefaults10,applyShapeStyle:applyShapeStyle10}=import_ag_charts_community86._ModuleSupport,horizontalTargetPlacementRotation={before:180,middle:0,after:0},verticalTargetPlacementRotation={before:90,middle:0,after:-90},LinearGaugeSeries=class extends import_ag_charts_community86._ModuleSupport.Series{constructor(e){super({moduleCtx:e,pickModes:[SeriesNodePickMode8.EXACT_SHAPE_MATCH,SeriesNodePickMode8.NEAREST_NODE]}),this.properties=new LinearGaugeSeriesProperties,this.seriesRect=BBox9.NaN,this.gaugeRect=BBox9.NaN,this.scale=new LinearScale3,this.originX=0,this.originY=0,this.scaleGroup=this.contentGroup.appendChild(new Group7({name:"scaleGroup"})),this.itemGroup=this.contentGroup.appendChild(new Group7({name:"itemGroup"})),this.itemTargetGroup=this.contentGroup.appendChild(new Group7({name:"itemTargetGroup"})),this.itemTargetLabelGroup=this.contentGroup.appendChild(new Group7({name:"itemTargetLabelGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Group7({name:"itemLabelGroup"})),this.highlightTargetGroup=this.highlightGroup.appendChild(new Group7({name:"itemTargetLabelGroup"})),this.tickGroup=this.contentGroup.appendChild(new Group7({name:"tickGroup"})),this.scaleSelection=Selection5.select(this.scaleGroup,()=>this.nodeFactory()),this.datumSelection=Selection5.select(this.itemGroup,()=>this.nodeFactory()),this.targetSelection=Selection5.select(this.itemTargetGroup,()=>this.markerFactory()),this.targetLabelSelection=Selection5.select(this.itemTargetLabelGroup,Text),this.labelSelection=Selection5.select(this.itemLabelGroup,Text),this.highlightTargetSelection=Selection5.select(this.highlightTargetGroup,()=>this.markerFactory()),this.tickSelection=Selection5.select(this.tickGroup,TransformableText2),this.datumUnion=new DatumUnion,this.animationState=new StateMachine("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.animateReadyResize(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateWaitingUpdateReady()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty"},reset:"empty",skip:"ready"}}),this.scaleGroup.pointerEvents=PointerEvents5.None,this.tickGroup.pointerEvents=PointerEvents5.None}get range(){return this.horizontal?[0,this.gaugeRect.width]:[0,this.gaugeRect.height]}get horizontal(){return this.properties.direction==="horizontal"}get hasData(){return!0}nodeFactory(){const e=new Rect5;return e.crisp=!0,e}markerFactory(){return new Marker2}processData(){this.nodeDataRefresh=!0,this.animationState.transition("updateData")}formatLabel(e){return formatLabel(e,this.properties.scale)}getShapeFillBBox(){const{properties:e,originX:t,originY:i,horizontal:s,scale:a}=this,{thickness:o}=e,r=findRangeExtent(a.range),n=new BBox9(t,i,s?r:o,s?o:r);return{axis:n,series:n}}getTargets(){const{properties:e}=this,t=e.defaultTarget;return Array.from(e.targets).map(i=>{const{text:s=t.text,value:a=t.value??0,shape:o=t.shape??"triangle",rotation:r=t.rotation??0,placement:n=t.placement??"middle",spacing:l=t.spacing??0,size:c=t.size??0}=i,{enabled:h=t.label.enabled,color:p=t.label.color??"black",fontStyle:u=t.label.fontStyle??"normal",fontWeight:g=t.label.fontWeight??"normal",fontSize:d=t.label.fontSize,fontFamily:m=t.label.fontFamily,spacing:y=t.label.spacing??0}=i.label;return{text:s,value:a,shape:o,placement:n,spacing:l,size:c,rotation:r,label:{enabled:h,color:p,fontStyle:u,fontWeight:g,fontSize:d,fontFamily:m,spacing:y},style:i.getStyle(t)}})}getTargetPoint(e){const{properties:t,originX:i,originY:s,horizontal:a,scale:o,gaugeRect:r}=this,{thickness:n}=t,{value:l,placement:c,spacing:h,size:p}=e,u=o.convert(l);let g;switch(c){case"before":g=-(h+p/2);break;case"after":g=n+h+p/2;break;default:g=n/2;break}return{x:i+r.x+(a?u:g),y:s+r.y+(a?g:u)}}getTargetLabel(e){const{size:t,placement:i,label:s}=e,{spacing:a,color:o,fontStyle:r,fontWeight:n,fontSize:l,fontFamily:c}=s,h=void 0,p=t/2+a;let u,g,d=0,m=0;return this.horizontal?(u="center",i==="after"?(g="top",m=p):(g="bottom",m=-p)):(g="middle",i==="before"?(u="right",d=-p):(u="left",d=p)),{offsetX:d,offsetY:m,fill:o,textAlign:u,textBaseline:g,fontStyle:r,fontWeight:n,fontSize:l,fontFamily:c,lineHeight:h}}labelDatum(e,t){const{placement:i,avoidCollisions:s,spacing:a,text:o,color:r,fontSize:n,minimumFontSize:l,fontStyle:c,fontWeight:h,fontFamily:p,lineHeight:u,wrapping:g,overflowStrategy:d,formatter:m=y=>this.formatLabel(y.value)}=e;return{placement:i,avoidCollisions:s,spacing:a,text:o,value:t,fill:r,fontSize:n,minimumFontSize:l,fontStyle:c,fontWeight:h,fontFamily:p,lineHeight:u,wrapping:g,overflowStrategy:d,formatter:m}}verticalLabelInset(){const{label:e}=this.properties,t=(0,import_ag_charts_core30.cachedTextMeasurer)(e),i=e.text?.split(` +`),s=(e.lineHeight??t.lineHeight())*(i?.length??1);return e.spacing+s}horizontalLabelInset(){const{scale:e,properties:t}=this,{scale:i,label:s}=t,a=s.text?.split(` +`),o=(0,import_ag_charts_core30.cachedTextMeasurer)(s),r=i.interval.values??e.ticks({nice:!1,interval:i.interval.step,minTickCount:0,maxTickCount:6,tickCount:5})?.ticks??[],l=(a??r?.map(c=>getLabelText(this.id,this.ctx,this.labelDatum(s,c))??"")).reduce((c,h)=>{const{width:p}=(0,import_ag_charts_core30.isArray)(h)?(0,import_ag_charts_core30.measureTextSegments)(h,s):o.measureLines(h);return Math.max(c,p)},0);return s.spacing+l}tickFormatter(e,t){const{format:i,formatter:s}=this.properties.scale.label;let a;return i!=null&&(a=tickFormat(t,typeof i=="string"?i:void 0)),(o,r)=>{let n;return s&&(n??(n=formatWithContext(this.ctx,s,{value:o,index:r,domain:e,boundSeries:void 0}))),n??(n=a?.(o)),n??this.formatLabel(o)}}createNodeData(){const{id:e,properties:t,horizontal:i,scale:s,seriesRect:a}=this,{value:o,segmentation:r,thickness:n,cornerRadius:l,cornerMode:c,bar:h,scale:p,label:u,defaultColorRange:g}=t;s.domain=[p.min,p.max],s.range=i?[0,a.width]:[a.height,0];let d,m;i?(m=1,d=Math.PI/2):p.label.placement==="before"?(m=1,d=0):(m=-1,d=0);let y,f,S,b;i?(y=0,f=a.width,S=(a.height-n)/2,b=S+n,u.placement==="outside-start"?y+=this.horizontalLabelInset():u.placement==="outside-end"&&(f-=this.horizontalLabelInset())):(y=(a.width-n)/2,f=y+n,b=0,S=a.height,u.placement==="outside-start"?S-=this.verticalLabelInset():u.placement==="outside-end"&&(b+=this.verticalLabelInset())),this.gaugeRect=new BBox9(Math.min(y,f),Math.min(S,b),Math.abs(f-y),Math.abs(b-S));const x=0,v=0;s.domain=[p.min,p.max],s.range=i?[y,f]:[S,b];const{tickData:{ticks:_}}=generateTicks2({scale:s,label:this.properties.scale.label,interval:this.properties.scale.interval,tickFormatter:(U,j)=>this.tickFormatter(U,j),domain:s.domain,range:this.range,reverse:!1,primaryTickCount:void 0,defaultTickMinSpacing:0,visibleRange:[0,1],niceMode:NiceMode.Off,labelOffset:0,axisRotation:d,sideFlag:m}),D=!1,k=this.getTargets(),A=[],L=[],R=[],O=[],[B,C]=s.range,w=Math.abs(C-B),M=i?s.convert(o):f,T=i?b:s.convert(o),N=r.enabled?r.spacing/2:0,I=i?N:0,P=i?0:N,F=Math.min(h.thickness??Math.round(h.thicknessRatio*n),n),E=-(n-F)/2,G=i?0:E,K=i?E:0,V=c==="item",W=Math.ceil(w);let z=r.enabled?r.interval.getSegments(s,W):void 0;const Y=h.getStyle(g,i,s),q=p.getStyle(h.enabled,g,i,s);if(z==null&&V){const U=Math.min(...s.domain),j=Math.max(...s.domain),H={value:o,segmentStart:U,segmentEnd:j};if(h.enabled){const ie=Math.min(l,F/2,w/2)*(D?-1:1),ee=i?ie:0,se=i?0:ie;A.push({series:this,itemId:"value",datum:H,datumIndex:{type:0},type:0,x0:x+y-ee-G,y0:v+S-se-K,x1:x+M+ee+G,y1:v+T+se+K,clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:l,topRightCornerRadius:l,bottomRightCornerRadius:l,bottomLeftCornerRadius:l,horizontalInset:I,verticalInset:P,style:Y})}const Z=Math.min(l,n/2,w/2)*(D?-1:1),X=i?Z:0,Q=i?0:Z;O.push({series:this,itemId:"scale",datum:H,datumIndex:{type:0},type:0,x0:x+y-X,y0:v+S-Q,x1:x+f+X,y1:v+b+Q,clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:l,topRightCornerRadius:l,bottomRightCornerRadius:l,bottomLeftCornerRadius:l,horizontalInset:I,verticalInset:P,style:q})}else{z??(z=s.domain);const U=x+y-G,j=v+S-K,H=x+M+G,te=v+T+K;for(let Z=0;ZcreateDatumId9(e.nodeData.length,t.itemId))}updateDatumNodes(e){const{datumSelection:t}=e,{ctx:i}=this,s=i.animationManager.isSkipped(),a=this.getShapeFillBBox();t.each((r,n)=>{const{topLeftCornerRadius:l,topRightCornerRadius:c,bottomRightCornerRadius:h,bottomLeftCornerRadius:p}=n;applyShapeStyle10(r,n.style,a),r.topLeftCornerRadius=l,r.topRightCornerRadius=c,r.bottomRightCornerRadius=h,r.bottomLeftCornerRadius=p,r.pointerEvents=this.properties.bar.enabled?import_ag_charts_community86._ModuleSupport.PointerEvents.All:import_ag_charts_community86._ModuleSupport.PointerEvents.None,(s||r.previousDatum==null)&&r.setProperties(resetLinearGaugeSeriesResetRectFunction(r,n))});const{horizontal:o}=this;this.datumUnion.update(t,this.itemGroup,import_ag_charts_community86._ModuleSupport.Rect,(r,n,l)=>{const c=Math.min(n.x,l.x),h=Math.max(n.x+n.width,l.x+l.width),p=Math.min(n.y,l.y),u=Math.max(n.y+n.height,l.y+l.height),g=h-c,d=u-p;r.pointerEvents=import_ag_charts_community86._ModuleSupport.PointerEvents.None,r.x=c,r.y=p,r.width=g,r.height=d,r.topLeftCornerRadius=o?n.topLeftCornerRadius:l.topLeftCornerRadius,r.topRightCornerRadius=l.topRightCornerRadius,r.bottomRightCornerRadius=o?l.bottomRightCornerRadius:n.bottomRightCornerRadius,r.bottomLeftCornerRadius=n.bottomLeftCornerRadius;const m=n.clipBBox,y=l.clipBBox??m;m&&y?r.clipBBox=BBox9.merge([m,y]).intersection(o?new BBox9(c,-1/0,g,1/0):new BBox9(-1/0,p,1/0,d)):r.clipBBox=void 0})}updateScaleSelection(e){return e.scaleSelection.update(e.scaleData,void 0,t=>createDatumId9(e.scaleData.length,t.itemId))}updateScaleNodes(e){const{scaleSelection:t}=e,i=this.getShapeFillBBox();t.each((s,a)=>{const{topLeftCornerRadius:o,topRightCornerRadius:r,bottomRightCornerRadius:n,bottomLeftCornerRadius:l}=a;applyShapeStyle10(s,a.style,i),s.setProperties(resetLinearGaugeSeriesResetRectFunction(s,a)),s.topLeftCornerRadius=o,s.topRightCornerRadius=r,s.bottomRightCornerRadius=n,s.bottomLeftCornerRadius=l,s.setProperties(resetLinearGaugeSeriesResetRectFunction(s,a))})}updateTargetSelection(e){return e.targetSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetNodes(e){const{targetSelection:t,isHighlight:i}=e;t.each((s,a)=>{const{x:o,y:r,shape:n,size:l,rotation:c}=a,h=this.getTargetStyle(i,a);applyShapeStyle10(s,h),s.size=l,s.shape=n==="line"?lineMarker:n,s.translationX=o,s.translationY=r,s.rotation=c})}getTargetStyle(e,{datumIndex:t,style:i}){const s=this.getHighlightStyle(e,t);return mergeDefaults10(s,{...i,opacity:1})}updateTargetLabelSelection(e){return e.targetLabelSelection.update(e.targetData)}updateTargetLabelNodes(e){const{targetLabelSelection:t}=e;t.each((i,s)=>{const{x:a,y:o,text:r}=s,{offsetX:n,offsetY:l,fill:c,fontStyle:h,fontWeight:p,fontSize:u,fontFamily:g,textAlign:d,textBaseline:m}=s.label;i.visible=!0,i.x=a+n,i.y=o+l,i.text=r,i.fill=c,i.fontStyle=h,i.fontWeight=p,i.fontSize=u,i.fontFamily=g,i.textAlign=d,i.textBaseline=m})}updateTickSelection(e){return e.tickSelection.update(e.tickData,void 0,t=>t.tickId)}updateTickNodes(e){const{gaugeRect:t,properties:i}=this,s=i.defaultScale,{enabled:a,color:o,fontFamily:r=s.label.fontFamily,fontSize:n=s.label.fontSize,fontStyle:l,fontWeight:c=s.label.fontWeight,spacing:h}=i.scale.label;let{placement:p}=i.scale.label;const u=toRadians3(i.scale.label.rotation??0);let g,d,m,y;this.horizontal?(p??(p="after"),g="center",d=p==="before"?"bottom":"top",y=this.originY+t.y+(p==="before"?-h:t.height+h)):(p??(p="before"),g=p==="before"?"end":"start",d="middle",m=this.originX+t.x+(p==="before"?-h:t.width+h)),e.tickSelection.each((f,S)=>{if(!a){f.visible=!1;return}const b=m??S.translation,x=y??S.translation;f.visible=!0,f.text=S.tickLabel,f.fill=o,f.fontFamily=r,f.fontSize=n,f.fontStyle=l,f.fontWeight=c,f.textBaseline=d,f.textAlign=g,f.x=b,f.y=x,f.rotationCenterX=b,f.rotationCenterY=x,f.rotation=u})}updateLabelSelection(e){return e.labelSelection.update(e.labelData,void 0,t=>"primary")}updateLabelNodes(e){const{labelSelection:t}=e,i=this.ctx.animationManager.isSkipped();t.each((s,a)=>{s.fill=a.fill,s.fontStyle=a.fontStyle,s.fontWeight=a.fontWeight,s.fontFamily=a.fontFamily}),(i||this.labelsHaveExplicitText())&&this.formatLabelText()}labelsHaveExplicitText(){for(const{datum:e}of this.labelSelection)if(e.text==null)return!1;return!0}formatLabelText(e){const{labelSelection:t,horizontal:i,scale:s,seriesRect:a,gaugeRect:o}=this,{x:r,y:n,width:l,height:c}=o,h=e?.label??this.properties.value;let p;if(i){const d=s.convert(h);p=new BBox9(r,n,d-r,c)}else{const d=s.convert(h);p=new BBox9(r,d,l,c-d)}const u={seriesRect:a,gaugeRect:o,barRect:p},{margin:g}=this.properties;formatLinearGaugeLabels(this,this.ctx,t,{padding:g,horizontal:i},u,e)}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),resetMotion3([this.datumSelection],resetLinearGaugeSeriesResetRectFunction),this.formatLabelText()}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}animateLabelText(e={}){const{animationManager:t}=this.ctx;let i=0,s=0;if(this.labelSelection.each((a,o)=>{a.opacity=1,i=a.previousDatum?.value??e.from??o.value,s=o.value}),!this.labelsHaveExplicitText())if(i===s)this.formatLabelText({label:s});else{const a=`${this.id}_labels`;t.animate({id:a,groupId:"label",from:{label:i},to:{label:s},phase:e.phase??"update",ease:easing.easeOut,onUpdate:o=>this.formatLabelText(o),onStop:()=>this.formatLabelText({label:s})})}}animateEmptyUpdateReady(){const{animationManager:e}=this.ctx,{node:t}=prepareLinearGaugeSeriesAnimationFunctions(!0,this.horizontal);fromToMotion2(this.id,"node",e,[this.datumSelection],t,(i,s)=>s.itemId),fromToMotion2(this.id,"label",e,[this.labelSelection],fadeInFns,()=>"primary"),this.animateLabelText({from:0,phase:"initial"})}animateWaitingUpdateReady(){const{animationManager:e}=this.ctx,{node:t}=prepareLinearGaugeSeriesAnimationFunctions(!1,this.horizontal);fromToMotion2(this.id,"node",e,[this.datumSelection],t,(i,s)=>s.itemId),this.animateLabelText()}animateReadyResize(){this.resetAllAnimation()}getSeriesDomain(){return[0,1]}dataCount(){return Number.NaN}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}getLegendData(){return[]}getTooltipContent(e){const{id:t,properties:i}=this,{tooltip:s}=i;if(e==null)return;let a,o,r;if(e.type===0?(a=i.value,o=i.label.text,r=this.ctx.localeManager.t("ariaLabelGaugeValue")):({value:a,text:o}=i.targets[e.index],r=this.ctx.localeManager.t("ariaLabelGaugeTarget")),a!=null)return this.formatTooltipWithContext(s,{data:[{label:o,fallbackLabel:r,value:this.formatLabel(a)}]},{seriesId:t,title:void 0,datum:void 0,value:a})}pickNodeClosestDatum(e){return pickGaugeNearestDatum(this,e)}pickFocus(e){return pickGaugeFocus(this,e)}getCaptionText(){return this.formatLabel(this.properties.value)}getCategoryValue(e){}datumIndexForCategoryValue(e){}hasItemStylers(){return this.properties.label.itemStyler!=null}};LinearGaugeSeries.className="LinearGaugeSeries",LinearGaugeSeries.type="linear-gauge";var LinearGaugeModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"linear-gauge",moduleFactory:e=>new LinearGaugeSeries(e),themeTemplate:{minWidth:200,minHeight:200,tooltip:{enabled:!1},series:{thickness:50,defaultColorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$interpolate:[{$palette:"secondDivergingColors"},5]},import_ag_charts_community87._ModuleSupport.SAFE_RANGE2_OPERATION]},scale:{defaultFill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/2",import_ag_charts_community87._ModuleSupport.SAFE_STROKE_FILL_OPERATION,{$palette:"hierarchyColors"}]},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{spacing:11}},bar:{strokeWidth:{$isUserOption:["./stroke",2,0]}},segmentation:{enabled:!1,interval:{},spacing:1},defaultTarget:{fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},size:10,shape:"triangle",placement:"after",spacing:5,label:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:5}},defaultScale:{label:{fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}}},label:{...import_ag_charts_community87._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,placement:"inside-start",fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},fontSize:{$rem:2},minimumFontSize:import_ag_charts_community87._ModuleSupport.FONT_SIZE.SMALL,spacing:18,color:{$ref:"chartBackgroundColor"}},margin:4,tooltip:{range:{$path:["/tooltip/range",10]}}}}},LinearGaugeSeriesModule={type:"series",name:"linear-gauge",chartType:"standalone",enterprise:!0,options:import_ag_charts_community87._ModuleSupport.linearGaugeSeriesOptionsDef,create:e=>new LinearGaugeSeries(e)},import_ag_charts_community96=require("ag-charts-community"),import_ag_charts_community88=require("ag-charts-community"),MAP_THEME_DEFAULTS={zoom:{axes:"xy",anchorPointX:"pointer",anchorPointY:"pointer",buttons:{anchorPointX:"middle",anchorPointY:"middle"}},legend:{enabled:!1},gradientLegend:{enabled:!1,...import_ag_charts_community88._ModuleSupport.LEGEND_CONTAINER_THEME}};function applyMapPalette(e){const t=import_ag_charts_community88._ModuleSupport.deepClone(e);return import_ag_charts_community88._ModuleSupport.jsonWalk(t,i=>{typeof i=="object"&&"$palette"in i&&(i.$mapPalette=i.$palette,delete i.$palette)}),t}var import_ag_charts_community94=require("ag-charts-community"),import_ag_charts_core31=require("ag-charts-core"),import_ag_charts_community90=require("ag-charts-community"),delta2=1e-9;function lineSegmentDistanceToPointSquared(e,t,i,s){const[a,o]=e,[r,n]=t,l=r-a,c=n-o,h=l*l+c*c;let p,u;if(Math.abs(h)t){const h=(t-a)/l,p=[i+(r-i)*h,s+(n-s)*h],u=Math.atan2(n-s,r-i);return{point:p,angle:u}}a=c,i=r,s=n}}var import_ag_charts_community89=require("ag-charts-community"),{LonLatBBox}=import_ag_charts_community89._ModuleSupport;function polygonBbox(e,t){for(const i of e){const[s,a]=i;t=LonLatBBox.extend(t,s,a,s,a)}return t}function polygonCentroid(e){if(e.length===0)return;let t=0,i=0,s=0,[a,o]=e.at(-1);for(const[r,n]of e){const l=a*n-r*o;s+=l,t+=(a+r)*l,i+=(o+n)*l,a=r,o=n}return s*=3,[t/s,i/s]}function polygonDistance(e,t,i){let s=!1,a=1/0;for(const o of e){let r=o.at(-1),[n,l]=r;for(const c of o){const[h,p]=c;p>i!=l>i&&t<(n-h)*(i-p)/(l-p)+h&&(s=!s),a=Math.min(a,lineSegmentDistanceToPointSquared(r,c,t,i)),r=c,n=h,l=p}}return(s?-1:1)*Math.sqrt(a)}var{Path:Path9,ExtendedPath2D:ExtendedPath2D3,BBox:BBox10,SceneChangeDetection:SceneChangeDetection6,SceneObjectChangeDetection,objectsEqual}=import_ag_charts_community90._ModuleSupport,GeoGeometry=class extends Path9{constructor(){super(...arguments),this.projectedGeometry=void 0,this.renderMode=3,this.strokePath=new ExtendedPath2D3}computeBBox(){return(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1),this.bbox?.clone()}updatePath(){const{projectedGeometry:e}=this;this.strokePath.clear(),this.path.clear(),this.bbox=e==null?void 0:this.drawGeometry(e,void 0)}drawPath(e){super.drawPath(e),this.renderStroke(e,this.strokePath.getPath2D())}containsPoint(e,t){const{projectedGeometry:i}=this;return i==null||!this.getBBox().containsPoint(e,t)?!1:this.geometryDistance(i,e,t)<=0}distanceSquared(e,t){const{projectedGeometry:i}=this;if(i==null)return 1/0;const s=this.geometryDistance(i,e,t);return s>0?s*s:0}geometryDistance(e,t,i){const{renderMode:s,strokeWidth:a}=this,o=(s&1)!==0,r=(s&2)!==0,n=Math.max(a/2,1)+1;switch(e.type){case"GeometryCollection":return e.geometries.reduce((l,c)=>Math.min(l,this.geometryDistance(c,t,i)),1/0);case"MultiPolygon":return o?e.coordinates.reduce((l,c)=>Math.min(l,Math.max(polygonDistance(c,t,i),0)),1/0):1/0;case"Polygon":return o?Math.max(polygonDistance(e.coordinates,t,i),0):1/0;case"MultiLineString":return r?e.coordinates.reduce((l,c)=>Math.min(l,Math.max(lineStringDistance(c,t,i)-n,0)),1/0):1/0;case"LineString":return r?Math.max(lineStringDistance(e.coordinates,t,i)-n,0):1/0;case"MultiPoint":case"Point":default:return 1/0}}drawGeometry(e,t){const{renderMode:i,path:s,strokePath:a}=this,o=(i&1)!==0,r=(i&2)!==0;switch(e.type){case"GeometryCollection":for(const n of e.geometries)t=this.drawGeometry(n,t);break;case"MultiPolygon":if(o)for(const n of e.coordinates)t=this.drawPolygon(s,n,t);break;case"Polygon":o&&(t=this.drawPolygon(s,e.coordinates,t));break;case"LineString":r&&(t=this.drawLineString(a,e.coordinates,t,!1));break;case"MultiLineString":if(r)for(const n of e.coordinates)t=this.drawLineString(a,n,t,!1);break;case"Point":case"MultiPoint":break}return t}drawPolygon(e,t,i){if(t.length<1)return i;i=this.drawLineString(e,t[0],i,!0);for(let s=1;s0&&(t=polygonBbox(i[0],t));break;case"Polygon":e.coordinates.length>0&&(t=polygonBbox(e.coordinates[0],t));break;case"MultiLineString":for(const i of e.coordinates)t=polygonBbox(i,t);break;case"LineString":t=polygonBbox(e.coordinates,t);break;case"MultiPoint":for(const i of e.coordinates){const[s,a]=i;t=LonLatBBox2.extend(t,s,a,s,a)}break;case"Point":{const[i,s]=e.coordinates;t=LonLatBBox2.extend(t,i,s,i,s);break}}return t}function largestPolygon(e){switch(e.type){case"GeometryCollection":{let t,i;for(const s of e.geometries){const a=largestPolygon(s);if(a==null)continue;const o=polygonBbox(a[0],void 0);if(o==null)continue;const r=Math.abs(o.lat1-o.lat0)*Math.abs(o.lon1-o.lon0);(t==null||r>t)&&(t=r,i=a)}return i}case"MultiPolygon":{let t,i;for(const s of e.coordinates){const a=polygonBbox(s[0],void 0);if(a==null)continue;const o=Math.abs(a.lat1-a.lat0)*Math.abs(a.lon1-a.lon0);(t==null||o>t)&&(t=o,i=s)}return i}case"Polygon":return e.coordinates;case"MultiLineString":case"LineString":case"MultiPoint":case"Point":return}}function largestLineString(e){switch(e.type){case"GeometryCollection":{let t,i;for(const s of e.geometries){const a=largestLineString(s);if(a==null)continue;const o=lineStringLength(a);o!=null&&(t==null||o>t)&&(t=o,i=a)}return i}case"MultiLineString":{let t=0,i;for(const s of e.coordinates){const a=lineStringLength(s);a>t&&(t=a,i=s)}return i}case"LineString":return e.coordinates;case"MultiPolygon":case"Polygon":case"MultiPoint":case"Point":return}}function containsType(e,t){if(e==null)return!1;switch(e.type){case"GeometryCollection":return e.geometries.some(i=>containsType(i,t));case"MultiPolygon":case"Polygon":return(t&1)!==0;case"MultiLineString":case"LineString":return(t&2)!==0;case"MultiPoint":case"Point":return(t&4)!==0}}function projectGeometry(e,t){switch(e.type){case"GeometryCollection":return{type:"GeometryCollection",geometries:e.geometries.map(i=>projectGeometry(i,t))};case"Polygon":return{type:"Polygon",coordinates:projectPolygon(e.coordinates,t)};case"MultiPolygon":return{type:"MultiPolygon",coordinates:projectMultiPolygon(e.coordinates,t)};case"MultiLineString":return{type:"MultiLineString",coordinates:projectPolygon(e.coordinates,t)};case"LineString":return{type:"LineString",coordinates:projectLineString(e.coordinates,t)};case"MultiPoint":return{type:"MultiPoint",coordinates:projectLineString(e.coordinates,t)};case"Point":return{type:"Point",coordinates:t.convert(e.coordinates)}}}function projectMultiPolygon(e,t){return e.map(i=>projectPolygon(i,t))}function projectPolygon(e,t){return e.map(i=>projectLineString(i,t))}function projectLineString(e,t){return e.map(i=>t.convert(i))}function prepareMapMarkerAnimationFunctions(){return{fromFn:(i,s,a)=>a==="removed"?{scalingX:1,scalingY:1}:i.previousDatum==null?{scalingX:0,scalingY:0}:{scalingX:i.scalingX,scalingY:i.scalingY},toFn:(i,s,a)=>a==="removed"?{scalingX:0,scalingY:0}:{scalingX:1,scalingY:1}}}function findFocusedGeoGeometry(e,t){const i=e.contextNodeData?.nodeData[t.datumIndex];if(i!==void 0){for(const s of e.datumSelection.nodes())if(s.datum===i)return s}}var import_ag_charts_community92=require("ag-charts-community"),TopologySeriesProperties=class extends import_ag_charts_community92._ModuleSupport.SeriesProperties{},TopologySeries=class extends import_ag_charts_community92._ModuleSupport.DataModelSeries{addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",e=>{this.onLegendItemClick(e)}),this.ctx.eventsHub.on("legend:item-double-click",e=>{this.onLegendItemDoubleClick(e)}))}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}},import_ag_charts_community93=require("ag-charts-community"),{Property:Property25,SeriesProperties:SeriesProperties3,makeSeriesTooltip:makeSeriesTooltip12,Label:Label8}=import_ag_charts_community93._ModuleSupport,MapLineSeriesProperties=class extends SeriesProperties3{constructor(){super(...arguments),this.topology=void 0,this.idKey="",this.topologyIdKey="name",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.maxStrokeWidth=void 0,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.label=new Label8,this.tooltip=makeSeriesTooltip12()}getStyle(){const{stroke:e,strokeOpacity:t,strokeWidth:i,lineDash:s,lineDashOffset:a}=this;return{stroke:e,strokeOpacity:t,strokeWidth:i,lineDash:s,lineDashOffset:a}}};__decorateClass([Property25],MapLineSeriesProperties.prototype,"topology",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"title",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"legendItemName",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"idKey",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"topologyIdKey",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"idName",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"labelKey",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"labelName",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"sizeKey",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"sizeName",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"colorKey",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"colorName",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"sizeDomain",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"colorRange",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"maxStrokeWidth",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"stroke",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"lineDash",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"label",2),__decorateClass([Property25],MapLineSeriesProperties.prototype,"tooltip",2);var{getMissCount:getMissCount2,getLabelStyles:getLabelStyles2,createDatumId:createDatumId10,SeriesNodePickMode:SeriesNodePickMode9,valueProperty:valueProperty9,ColorScale:ColorScale2,LinearScale:LinearScale4,Selection:Selection6,Text:Text2,Transformable:Transformable2,mergeDefaults:mergeDefaults11}=import_ag_charts_community94._ModuleSupport,MapLineSeries=class extends TopologySeries{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{size:["colorKey"],color:["colorKey"],label:["labelKey"]},propertyNames:{size:["sizeName"],color:["colorName"],label:["labelName"]},pickModes:[SeriesNodePickMode9.EXACT_SHAPE_MATCH,SeriesNodePickMode9.NEAREST_NODE],usesPlacedLabels:!0}),this.properties=new MapLineSeriesProperties,this._chartTopology=void 0,this.colorScale=new ColorScale2,this.sizeScale=new LinearScale4,this.datumSelection=Selection6.select(this.contentGroup,()=>this.nodeFactory()),this.labelSelection=Selection6.select(this.labelGroup,Text2),this.highlightDatumSelection=Selection6.select(this.highlightGroup,()=>this.nodeFactory()),this._previousDatumMidPoint=void 0}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){return super.hasData&&this.topology!=null}renderToOffscreenCanvas(){return!0}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[1,e],this.highlightGroup.zIndex=[2,e],!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}nodeFactory(){const e=new GeoGeometry;return e.renderMode=2,e.lineJoin="round",e.lineCap="round",e}async processData(e){if(this.data==null)return;const{data:t,topology:i,sizeScale:s,colorScale:a}=this,{topologyIdKey:o,idKey:r,sizeKey:n,colorKey:l,labelKey:c,sizeDomain:h,colorRange:p}=this.properties,u=new Map;for(const b of i?.features.values()??[]){const x=b.properties?.[o];x==null||!containsType(b.geometry,2)||u.set(x,b)}const g=this.sizeScale.type,d=this.colorScale.type,m=this.scale?.type,{dataModel:y,processedData:f}=await this.requestDataModel(e,t,{props:[valueProperty9(r,m,{id:"idValue",includeProperty:!1}),valueProperty9(r,m,{id:"featureValue",includeProperty:!1,processor:()=>b=>u.get(b)}),...c==null?[]:[valueProperty9(c,"category",{id:"labelValue"})],...n==null?[]:[valueProperty9(n,g,{id:"sizeValue"})],...l==null?[]:[valueProperty9(l,d,{id:"colorValue"})]]}),S=y.resolveColumnById(this,"featureValue",f);if(this.topologyBounds=S.reduce((b,x)=>{const v=x?.geometry;return v==null?b:geometryBbox(v,b)},void 0),n!=null){const b=y.resolveProcessedDataIndexById(this,"sizeValue"),x=f.domain.values[b]??[];s.domain=h??x}if(p!=null&&this.isColorScaleValid()){const b=y.resolveProcessedDataIndexById(this,"colorValue");a.domain=f.domain.values[b],a.range=p,a.update()}i==null&&import_ag_charts_core31.Logger.warnOnce("no topology was provided for [MapLineSeries]; nothing will be rendered.")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),a=i.input.count,o=getMissCount2(this,i.defs.values[s].missing);return!(a===0||a===o)}getLabelDatum(e,t,i,s){if(t==null||i==null)return;const a=largestLineString(i);if(a==null)return;const{idKey:o,idName:r,sizeKey:n,sizeName:l,colorKey:c,colorName:h,labelKey:p,labelName:u,label:g}=this.properties;if(p==null||!g.enabled)return;const d=this.getLabelText(t,e,p,"label",[],g,{value:t,datum:e,idKey:o,idName:r,sizeKey:n,sizeName:l,colorKey:c,colorName:h,labelKey:p,labelName:u});if(d==null)return;const m=s.measureLines(String(d)),y=lineStringCenter(a);if(y==null)return;const[f,S]=y.point,{width:b,height:x}=m;return{point:{x:f,y:S,size:0},label:{width:b,height:x,text:d},anchor:void 0,placement:void 0}}createNodeData(){const{id:e,dataModel:t,processedData:i,sizeScale:s,properties:a,scale:o}=this,{idKey:r,sizeKey:n,colorKey:l,labelKey:c,label:h,legendItemName:p}=a;if(t==null||i==null)return;const u=t.resolveColumnById(this,"idValue",i),g=t.resolveColumnById(this,"featureValue",i),d=c==null?void 0:t.resolveColumnById(this,"labelValue",i),m=n==null?void 0:t.resolveColumnById(this,"sizeValue",i),y=l==null?void 0:t.resolveColumnById(this,"colorValue",i),f=a.maxStrokeWidth??a.strokeWidth;s.range=[Math.min(a.strokeWidth,f),f];const S=(0,import_ag_charts_core31.cachedTextMeasurer)(h),b=new Map;for(const[A]of i.dataSources.get(this.id)?.data.entries()??[]){const L=u[A],R=g[A]?.geometry??void 0,O=R!=null&&o!=null?projectGeometry(R,o):void 0;L!=null&&O!=null&&b.set(L,O)}const x=[],v=[],_=[],D=i.dataSources.get(this.id)?.data??[];for(const[A,L]of D.entries()){const R=u[A],O=y?.[A],B=m?.[A],C=d?.[A],w=b.get(R);w==null&&_.push(R);const M=this.getLabelDatum(L,C,w,S);M!=null&&v.push(M),x.push({series:this,itemId:r,datum:L,datumIndex:A,idValue:R,labelValue:C,colorValue:O,sizeValue:B,projectedGeometry:w,legendItemName:p,style:this.getItemStyle({datumIndex:A,datum:L,colorValue:O,sizeValue:B},!1)})}const k=10;if(_.length>k){const A=_.length-k;_.length=k,_.push(`(+${A} more)`)}return _.length>0&&import_ag_charts_core31.Logger.warnOnce("some data items do not have matches in the provided topology",_),{itemId:e,nodeData:x,labelData:v}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e,highlightDatumSelection:t}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let i=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:s}=this.properties,a=s!=null&&i?.datum==null&&s===i?.legendItemName;i!=null&&(i.series!==this&&!a||i.datum==null)&&(i=void 0);const o=this.contextNodeData?.nodeData??[];this.datumSelection=this.updateDatumSelection({nodeData:o,datumSelection:e}),this.updateDatumStyles({datumSelection:e,isHighlight:!1}),this.updateDatumNodes({datumSelection:e,isHighlight:!1}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:i==null?[]:[i],datumSelection:t}),this.updateDatumStyles({datumSelection:t,isHighlight:!0}),this.updateDatumNodes({datumSelection:t,isHighlight:!0})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>createDatumId10(t.idValue))}getItemStyle({datumIndex:e=0,datum:t,colorValue:i,sizeValue:s},a){const{properties:o,colorScale:r,sizeScale:n}=this,{colorRange:l,itemStyler:c}=o,h=this.getHighlightStyle(a,e),p=mergeDefaults11(h,o.getStyle());!a&&i!=null&&(p.stroke=this.isColorScaleValid()?r.convert(i):l?.[0]??o.stroke),s!=null&&(p.strokeWidth=n.convert(s,{clamp:!0}));let u;return c!=null&&(u=this.cachedDatumCallback(createDatumId10(e,a?"highlight":"node"),()=>{const g=this.makeItemStylerParams(t,e,a,p);return this.callWithContext(c,g)})),u?mergeDefaults11(p,u):p}makeItemStylerParams(e,t,i,s){const{id:a}=this,o=this.ctx.highlightManager?.getActiveHighlight(),r=this.getHighlightStateString(o,i,t);return{seriesId:a,datum:e,highlighted:i,highlightState:r,...s}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){e.each((t,i)=>{const{projectedGeometry:s,style:a}=i;if(s==null){t.visible=!1,t.projectedGeometry=void 0;return}t.visible=!0,t.projectedGeometry=s,t.setProperties(a)})}updatePlacedLabelData(e){this.labelSelection=this.labelSelection.update(e,t=>{t.pointerEvents=import_ag_charts_community94._ModuleSupport.PointerEvents.None}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{x:a,y:o,width:r,height:n,text:l},c)=>{const h=getLabelStyles2(this,void 0,t,t.label,!1,i),{color:p,fontStyle:u,fontWeight:g,fontSize:d,fontFamily:m}=h;s.visible=!0,s.x=a+r/2,s.y=o+n/2,s.text=l,s.fill=p,s.fontStyle=u,s.fontWeight=g,s.fontSize=d,s.fontFamily=m,s.textAlign="center",s.textBaseline="middle",s.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,s.setBoxing(h)})}resetAnimation(){}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.datumSelection.each((a,o)=>{const r=a.distanceSquared(e,t);rnew MapLineSeries(e),themeTemplate:{...MAP_THEME_DEFAULTS,series:{stroke:applyMapPalette(import_ag_charts_community96._ModuleSupport.SAFE_STROKE_FILL_OPERATION),colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},applyMapPalette(import_ag_charts_community96._ModuleSupport.SAFE_RANGE2_OPERATION)]},strokeWidth:1,maxStrokeWidth:3,lineDash:[0],lineDashOffset:0,label:{...import_ag_charts_community96._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:applyMapPalette(import_ag_charts_community96._ModuleSupport.multiSeriesHighlightStyle(!1))},tooltip:{range:"exact"}}},MapLineSeriesModule={type:"series",name:"map-line",chartType:"topology",enterprise:!0,options:mapLineSeriesOptionsDef,create:e=>new MapLineSeries(e)},import_ag_charts_community98=require("ag-charts-community"),import_ag_charts_core33=require("ag-charts-core"),import_ag_charts_community97=require("ag-charts-community"),{Property:Property26,SeriesProperties:SeriesProperties4,makeSeriesTooltip:makeSeriesTooltip13}=import_ag_charts_community97._ModuleSupport,MapLineBackgroundSeriesProperties=class extends SeriesProperties4{constructor(){super(...arguments),this.topology=void 0,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.tooltip=makeSeriesTooltip13()}};__decorateClass([Property26],MapLineBackgroundSeriesProperties.prototype,"topology",2),__decorateClass([Property26],MapLineBackgroundSeriesProperties.prototype,"stroke",2),__decorateClass([Property26],MapLineBackgroundSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property26],MapLineBackgroundSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property26],MapLineBackgroundSeriesProperties.prototype,"lineDash",2),__decorateClass([Property26],MapLineBackgroundSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property26],MapLineBackgroundSeriesProperties.prototype,"tooltip",2);var{createDatumId:createDatumId11,Group:Group8,Selection:Selection7,PointerEvents:PointerEvents6}=import_ag_charts_community98._ModuleSupport,MapLineBackgroundSeries=class extends TopologySeries{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[]}),this.properties=new MapLineBackgroundSeriesProperties,this._chartTopology=void 0,this.itemGroup=this.contentGroup.appendChild(new Group8({name:"itemGroup"})),this.datumSelection=Selection7.select(this.itemGroup,()=>this.nodeFactory()),this.itemGroup.pointerEvents=PointerEvents6.None}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get focusable(){return!1}setOptionsData(){}setChartData(){}get hasData(){return!1}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,e,0],this.highlightGroup.zIndex=[0,e,1],!0}nodeFactory(){const e=new GeoGeometry;return e.renderMode=2,e.lineJoin="round",e.lineCap="round",e.pointerEvents=PointerEvents6.None,e}processData(){const{topology:e}=this;this.topologyBounds=e?.features.reduce((t,i)=>{const s=i.geometry;return s==null?t:geometryBbox(s,t)},void 0),e==null&&import_ag_charts_core33.Logger.warnOnce("no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.")}createNodeData(){const{id:e,topology:t,scale:i,properties:s}=this;if(t==null)return;const{stroke:a,strokeOpacity:o,lineDash:r,lineDashOffset:n,strokeWidth:l}=s,c=[],h=[];for(const[p,u]of t.features.entries()){const{geometry:g}=u,d=g!=null&&i!=null?projectGeometry(g,i):void 0;d!=null&&c.push({series:this,itemId:p,datum:u,datumIndex:0,index:p,projectedGeometry:d,style:{stroke:a,strokeOpacity:o,lineDash:r,lineDashOffset:n,strokeWidth:l}})}return{itemId:e,nodeData:c,labelData:h}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;const{nodeData:t=[]}=this.contextNodeData??{};this.datumSelection=this.updateDatumSelection({nodeData:t,datumSelection:e}),this.updateDatumNodes({datumSelection:e})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>createDatumId11(t.index))}updateDatumNodes(e){const{datumSelection:t}=e;t.each((i,s)=>{const{projectedGeometry:a}=s;if(a==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=a,i.setProperties(s.style)})}resetAnimation(){}getLegendData(){return[]}getTooltipContent(e){}computeFocusBounds(e){}hasItemStylers(){return!1}};MapLineBackgroundSeries.className="MapLineBackgroundSeries",MapLineBackgroundSeries.type="map-line-background";var import_ag_charts_community99=require("ag-charts-community"),import_ag_charts_core34=require("ag-charts-core"),{mapLineBackgroundSeriesThemeableOptionsDef}=import_ag_charts_community99._ModuleSupport,mapLineBackgroundSeriesOptionsDef={...mapLineBackgroundSeriesThemeableOptionsDef,type:(0,import_ag_charts_core34.required)((0,import_ag_charts_core34.constant)("map-line-background")),topology:import_ag_charts_core34.geoJson},MapLineBackgroundModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-line-background",moduleFactory:e=>new MapLineBackgroundSeries(e),themeTemplate:{...MAP_THEME_DEFAULTS,series:{stroke:{$path:["/1",{$mapPalette:"stroke"},{$mapPalette:"secondHierarchyColors"}]},strokeWidth:1,lineDash:[0],lineDashOffset:0}}},MapLineBackgroundSeriesModule={type:"series",name:"map-line-background",chartType:"topology",enterprise:!0,options:mapLineBackgroundSeriesOptionsDef,create:e=>new MapLineBackgroundSeries(e)},import_ag_charts_community104=require("ag-charts-community"),import_ag_charts_core38=require("ag-charts-core"),import_ag_charts_community102=require("ag-charts-community"),import_ag_charts_core36=require("ag-charts-core"),__MINI_CHART_SERIES_OPTIONS=void 0,__VERIFY_MINI_CHART_SERIES_OPTIONS=void 0;__VERIFY_MINI_CHART_SERIES_OPTIONS=__MINI_CHART_SERIES_OPTIONS;var __THEME_OVERRIDES=void 0,__VERIFY_THEME_OVERRIDES=void 0;__VERIFY_THEME_OVERRIDES=__THEME_OVERRIDES;var __THEMEABLE_OPTIONS=void 0,__VERIFY_THEMEABLE_OPTIONS=void 0;__VERIFY_THEMEABLE_OPTIONS=__THEMEABLE_OPTIONS;var __AXIS_LABEL_OPTIONS=void 0,__VERIFY_AXIS_LABEL_OPTIONS=void 0;__VERIFY_AXIS_LABEL_OPTIONS=__AXIS_LABEL_OPTIONS;var import_ag_charts_core35=require("ag-charts-core");function polygonPointSearch(e,t,i){const s=polygonBbox(e[0],void 0);if(s==null)return;const a=(s.lon0+s.lon1)/2,o=(s.lat0+s.lat1)/2,r=Math.abs(s.lon1-s.lon0),n=Math.abs(s.lat1-s.lat0),l=polygonCentroid(e[0]),[c,h]=l,p=-polygonDistance(e,c,h);let u;const g=(v,_)=>{const k=Math.max(_-p,0);return v-.5*k},d=(v,_,D)=>{const{distance:k,maxDistance:A}=i(e,v,_,D),L=Math.hypot(c-v,h-_),R=Math.min(Math.max(c,v-D/2),v+D/2),O=Math.min(Math.max(h,_-D/2),_+D/2),B=Math.hypot(c-R,h-O),C=g(k,L),w=g(A,B);return{distance:k,maxDistance:A,value:C,maxValue:w,x:v,y:_,stride:D}},m=(v,_,D,k)=>{const A=d(_,D,k);A.maxDistance>=0&&v.push(A)},y=Math.min(r,n)/2;let f={value:d(a,o,y),next:null};for(;f!=null;){const v=f.value,{distance:_,value:D,maxValue:k,x:A,y:L,stride:R}=v;if(f=f.next,_>0&&(u==null||D>u.value)&&(u=v),u!=null&&k-u.value<=t)continue;const O=R/2,B=[];m(B,A-O,L-O,O),m(B,A+O,L-O,O),m(B,A-O,L+O,O),m(B,A+O,L+O,O),B.sort(labelPlacementCmp),f=(0,import_ag_charts_core35.insertListItemsSorted)(f,B,labelPlacementCmp)}if(u==null)return;const{distance:S,x:b,y:x}=u;return{x:b,y:x,distance:S}}var labelPlacementCmp=(e,t)=>t.maxValue-e.maxValue;function polygonMarkerCenter(e,t){const i=polygonPointSearch(e,t,(o,r,n,l)=>{const c=-polygonDistance(o,r,n),h=c+l*Math.SQRT2;return{distance:c,maxDistance:h}});if(i==null)return;const{x:s,y:a}=i;return[s,a]}function markerPositions(e,t){let i;switch(e.type){case"GeometryCollection":return e.geometries.flatMap(s=>markerPositions(s,t));case"MultiPoint":return e.coordinates;case"Point":return[e.coordinates];case"MultiPolygon":{const s=largestPolygon(e);i=s==null?void 0:polygonMarkerCenter(s,t);break}case"Polygon":{const s=e.coordinates;i=s==null?void 0:polygonMarkerCenter(s,t);break}case"MultiLineString":{const s=largestLineString(e);i=s==null?void 0:lineStringCenter(s)?.point;break}case"LineString":{const s=e.coordinates;i=lineStringCenter(s)?.point;break}}return i==null?[]:[i]}var import_ag_charts_community100=require("ag-charts-community"),{BBox:BBox11}=import_ag_charts_community100._ModuleSupport;function getTopologyShapeFillBBox(e){if(!e)return;const{range:t}=e,i=t[0][0],s=t[0][1],a=t[1][0]-i,o=t[1][1]-s,r=new BBox11(i,s,a,o);return{series:r,axis:r}}var import_ag_charts_community101=require("ag-charts-community"),{Property:Property27,SeriesProperties:SeriesProperties5,makeSeriesTooltip:makeSeriesTooltip14,Label:Label9}=import_ag_charts_community101._ModuleSupport,MapMarkerSeriesLabel=class extends Label9{constructor(){super(...arguments),this.placement="bottom"}};__decorateClass([Property27],MapMarkerSeriesLabel.prototype,"placement",2);var MapMarkerSeriesProperties=class extends SeriesProperties5{constructor(){super(...arguments),this.topology=void 0,this.idKey=void 0,this.topologyIdKey="name",this.idName=void 0,this.latitudeKey=void 0,this.latitudeName=void 0,this.longitudeKey=void 0,this.longitudeName=void 0,this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.shape="circle",this.size=6,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.label=new MapMarkerSeriesLabel,this.tooltip=makeSeriesTooltip14()}getStyle(){const{size:e,shape:t,fill:i,fillOpacity:s,stroke:a,strokeWidth:o,strokeOpacity:r,lineDash:n,lineDashOffset:l}=this;return{size:e,shape:t,fill:i,fillOpacity:s,opacity:1,stroke:a,strokeWidth:o,strokeOpacity:r,lineDash:n,lineDashOffset:l}}};__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"topology",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"title",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"legendItemName",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"idKey",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"topologyIdKey",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"idName",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"latitudeKey",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"latitudeName",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"longitudeKey",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"longitudeName",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"labelKey",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"labelName",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"sizeKey",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"sizeName",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"colorKey",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"colorName",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"colorRange",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"shape",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"size",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"maxSize",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"sizeDomain",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"fill",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"stroke",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"lineDash",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"label",2),__decorateClass([Property27],MapMarkerSeriesProperties.prototype,"tooltip",2);var{fromToMotion:fromToMotion3,StateMachine:StateMachine2,getMissCount:getMissCount3,createDatumId:createDatumId12,SeriesNodePickMode:SeriesNodePickMode10,valueProperty:valueProperty10,computeMarkerFocusBounds:computeMarkerFocusBounds2,ColorScale:ColorScale3,LinearScale:LinearScale5,Group:Group9,Selection:Selection8,Text:Text3,Marker:Marker3,applyShapeStyle:applyShapeStyle11,getLabelStyles:getLabelStyles3,LonLatBBox:LonLatBBox3,mergeDefaults:mergeDefaults12}=import_ag_charts_community102._ModuleSupport,MapMarkerSeries=class extends TopologySeries{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{size:["colorKey"],color:["colorKey"],label:["labelKey"]},propertyNames:{size:["sizeName"],color:["colorName"],label:["labelName"]},pickModes:[SeriesNodePickMode10.EXACT_SHAPE_MATCH,SeriesNodePickMode10.NEAREST_NODE],usesPlacedLabels:!0}),this.properties=new MapMarkerSeriesProperties,this._chartTopology=void 0,this.colorScale=new ColorScale3,this.sizeScale=new LinearScale5,this.markerGroup=this.contentGroup.appendChild(new Group9({name:"markerGroup"})),this.labelSelection=Selection8.select(this.labelGroup,Text3,!1),this.markerSelection=Selection8.select(this.markerGroup,Marker3,!1),this.highlightMarkerSelection=Selection8.select(this.highlightGroup,Marker3),this.animationState=new StateMachine2("empty",{empty:{update:{target:"ready",action:()=>this.animateMarkers()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.resetAllAnimation(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateMarkers()},resize:{target:"ready",action:()=>this.resetAllAnimation()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty",action:()=>this.resetAllAnimation()},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){const e=this.properties.latitudeKey!=null&&this.properties.longitudeKey!=null;return super.hasData&&(this.topology!=null||e)}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[3,e],this.highlightGroup.zIndex=[4,e],!0}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}async processData(e){if(this.data==null)return;const{data:t,topology:i,sizeScale:s,colorScale:a}=this,{topologyIdKey:o,idKey:r,latitudeKey:n,longitudeKey:l,sizeKey:c,colorKey:h,labelKey:p,sizeDomain:u,colorRange:g}=this.properties,d=new Map;for(const k of i?.features.values()??[]){const A=k.properties?.[o];A!=null&&d.set(A,k)}const m=this.sizeScale.type,y=this.colorScale.type,f=this.scale?.type,S=n!=null&&l!=null,{dataModel:b,processedData:x}=await this.requestDataModel(e,t,{props:[...r==null?[]:[valueProperty10(r,f,{id:"idValue",includeProperty:!1}),valueProperty10(r,f,{id:"featureValue",includeProperty:!1,processor:()=>k=>d.get(k)})],...S?[valueProperty10(n,f,{id:"latValue"}),valueProperty10(l,f,{id:"lonValue"})]:[],...p?[valueProperty10(p,"category",{id:"labelValue"})]:[],...c?[valueProperty10(c,m,{id:"sizeValue"})]:[],...h?[valueProperty10(h,y,{id:"colorValue"})]:[]]}),v=r==null?void 0:b.resolveColumnById(this,"featureValue",x),_=S?b.resolveColumnById(this,"latValue",x):void 0,D=S?b.resolveColumnById(this,"lonValue",x):void 0;if(this.topologyBounds=x.dataSources.get(this.id)?.data.reduce((k,A,L)=>{const O=v?.[L]?.geometry;if(O!=null&&(k=geometryBbox(O,k)),_!=null&&D!=null){const B=D[L],C=_[L];k=LonLatBBox3.extend(k,B,C,B,C)}return k},void 0),c!=null){const k=b.resolveProcessedDataIndexById(this,"sizeValue"),A=x.domain.values[k]??[];s.domain=u??A}if(g!=null&&this.isColorScaleValid()){const k=b.resolveProcessedDataIndexById(this,"colorValue");a.domain=x.domain.values[k],a.range=g,a.update()}this.animationState.transition("updateData")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),a=i.input.count,o=getMissCount3(this,i.defs.values[s].missing);return!(a===0||a===o)}getLabelDatum(e,t,i,s,a,o){if(t==null)return;const{idKey:r,idName:n,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:p,sizeKey:u,sizeName:g,colorKey:d,colorName:m,labelKey:y,labelName:f,label:S,shape:b}=this.properties;if(y==null||!S.enabled)return;const{placement:x}=S,v=this.getLabelText(t,e,y,"label",[],S,{value:t,datum:e,idKey:r,idName:n,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:p,sizeKey:u,sizeName:g,colorKey:d,colorName:m,labelKey:y,labelName:f});if(v==null)return;const{width:_,height:D}=o.measureLines(String(v)),k=Marker3.anchor(b);return{point:{x:i,y:s,size:a},label:{width:_,height:D,text:v},anchor:k,placement:x}}createNodeData(){const{id:e,dataModel:t,processedData:i,sizeScale:s,properties:a,scale:o}=this,{idKey:r,latitudeKey:n,longitudeKey:l,sizeKey:c,colorKey:h,labelKey:p,label:u,legendItemName:g}=a;if(t==null||i==null||o==null)return;const d=n!=null&&l!=null,m=r==null?void 0:t.resolveColumnById(this,"idValue",i),y=r==null?void 0:t.resolveColumnById(this,"featureValue",i),f=d?t.resolveColumnById(this,"latValue",i):void 0,S=d?t.resolveColumnById(this,"lonValue",i):void 0,b=p==null?void 0:t.resolveColumnById(this,"labelValue",i),x=c==null?void 0:t.resolveColumnById(this,"sizeValue",i),v=h==null?void 0:t.resolveColumnById(this,"colorValue",i),_=a.maxSize??a.size;s.range=[Math.min(a.size,_),_];const D=(0,import_ag_charts_core36.cachedTextMeasurer)(u);let k;if(m!=null&&y!=null){k=new Map;for(const[C]of i.dataSources.get(this.id)?.data.entries()??[]){const w=m[C],M=y[C]?.geometry??void 0,T=M!=null&&o!=null?projectGeometry(M,o):void 0;w!=null&&T!=null&&k.set(w,T)}}const A=[],L=[],R=[],O=i.dataSources.get(this.id)?.data??[];for(const[C,w]of O.entries()){const M=m?.[C],T=S?.[C],N=f?.[C],I=v?.[C],P=x?.[C],F=b?.[C],E=P==null?a.size:s.convert(P,{clamp:!0}),G=M==null?void 0:k?.get(M);if(M!=null&&projectGeometry==null&&R.push(M),T!=null&&N!=null){const[K,V]=o.convert([T,N]),W=this.getLabelDatum(w,F,K,V,E,D);W&&L.push(W),A.push({series:this,itemId:n,datum:w,datumIndex:C,index:-1,idValue:M,lonValue:T,latValue:N,labelValue:F,sizeValue:P,colorValue:I,point:{x:K,y:V,size:E},midPoint:{x:K,y:V},legendItemName:g,style:this.getMarkerItemStyle({datumIndex:C,datum:w,colorValue:I,sizeValue:P},!1)})}else if(G!=null)for(const[K,[V,W]]of markerPositions(G,1).entries()){const z=this.getLabelDatum(w,F,V,W,E,D);z&&L.push(z),A.push({series:this,itemId:n,datum:w,datumIndex:C,index:K,idValue:M,lonValue:T,latValue:N,labelValue:F,sizeValue:P,colorValue:I,point:{x:V,y:W,size:E},midPoint:{x:V,y:W},legendItemName:g,style:this.getMarkerItemStyle({datumIndex:C,datum:w,colorValue:I,sizeValue:P},!1)})}}const B=10;if(R.length>B){const C=R.length-B;R.length=B,R.push(`(+${C} more)`)}return R.length>0&&import_ag_charts_core36.Logger.warnOnce("some data items do not have matches in the provided topology",R),{itemId:e,nodeData:A,labelData:L}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}checkScaleChange(){return this.previousScale===this.scale?!1:(this.previousScale=this.scale,!0)}update({seriesRect:e}){const t=this.checkResize(e),i=this.checkScaleChange(),{markerSelection:s,highlightMarkerSelection:a}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let o=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:r}=this.properties,n=r!=null&&o?.datum==null&&r===o?.legendItemName;o!=null&&(o.series!==this&&!n||o.datum==null)&&(o=void 0);const l=this.contextNodeData?.nodeData??[];this.markerSelection=this.updateMarkerSelection({markerData:l,markerSelection:s}),this.updateMarkerNodes({markerSelection:s,isHighlight:!1,highlightedDatum:o}),this.highlightMarkerSelection=this.updateMarkerSelection({markerData:o==null?[]:[o],markerSelection:a}),this.updateMarkerNodes({markerSelection:a,isHighlight:!0,highlightedDatum:o}),(i||t)&&this.animationState.transition("resize"),this.animationState.transition("update")}updatePlacedLabelData(e){this.labelSelection=this.labelSelection.update(e,t=>{t.pointerEvents=import_ag_charts_community102._ModuleSupport.PointerEvents.None}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{x:a,y:o,width:r,height:n,text:l},c)=>{const h=getLabelStyles3(this,void 0,t,t.label,!1,i),{color:p,fontStyle:u,fontWeight:g,fontSize:d,fontFamily:m}=h;s.visible=!0,s.x=a+r/2,s.y=o+n/2,s.text=l,s.fill=p,s.fontStyle=u,s.fontWeight=g,s.fontSize=d,s.fontFamily=m,s.textAlign="center",s.textBaseline="middle",s.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,s.setBoxing(h)})}updateMarkerSelection(e){const{markerData:t,markerSelection:i}=e;return i.update(t,void 0,s=>createDatumId12(s.index,s.idValue,s.lonValue,s.latValue))}getMarkerItemStyle({datumIndex:e,datum:t,colorValue:i,sizeValue:s},a){const{properties:o,colorScale:r,sizeScale:n}=this,{colorRange:l,itemStyler:c}=o,h=this.getHighlightStyle(a,e),p=mergeDefaults12(h,o.getStyle());!a&&i!=null&&(p.fill=this.isColorScaleValid()?r.convert(i):l?.[0]??p.fill),s!=null&&(p.size=n.convert(s,{clamp:!0}));let u=p;if(c!=null&&e!=null){const g=this.cachedDatumCallback(createDatumId12(e,a?"highlight":"node"),()=>{const d=this.makeItemStylerParams(t,e,a,u);return this.callWithContext(c,d)});g&&(u=mergeDefaults12(g,p))}return u}makeItemStylerParams(e,t,i,s){const{id:a}=this,o=this.ctx.highlightManager?.getActiveHighlight(),r=this.getHighlightStateString(o,i,t),n=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:a,datum:e,highlighted:i,highlightState:r,...s,fill:n}}updateMarkerNodes(e){const{markerSelection:t,isHighlight:i,highlightedDatum:s}=e,a=getTopologyShapeFillBBox(this.scale);t.each((o,r)=>{const{datum:n,point:l}=r,c=this.getMarkerItemStyle(r,i);o.shape=c.shape,o.size=c.size,applyShapeStyle11(o,c,a),o.x=l.x,o.y=l.y,o.scalingCenterX=l.x,o.scalingCenterY=l.y,o.zIndex=!i&&s!=null&&n===s.datum?1:0})}isProcessedDataAnimatable(){return!0}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),this.ctx.animationManager.skipCurrentBatch(),this.labelSelection.cleanup(),this.markerSelection.cleanup(),this.highlightMarkerSelection.cleanup()}animateMarkers(){const{animationManager:e}=this.ctx,t=prepareMapMarkerAnimationFunctions();fromToMotion3(this.id,"markers",e,[this.markerSelection,this.highlightMarkerSelection],t)}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}pickNodeClosestDatum(e){const{x:t,y:i}=e;let s=1/0,a;for(const o of this.contextNodeData?.nodeData??[]){const{x:r,y:n,size:l}=o.point,c=Math.max(Math.abs(r-t)-l,0),h=Math.max(Math.abs(n-i)-l,0),p=c*c+h*h;p=0?"N":"S"}, ${Math.abs(O).toFixed(4)}\xB0 ${O>=0?"W":"E"}`}const L=this.getMarkerItemStyle({datumIndex:e,datum:v,colorValue:D,sizeValue:_},!1);return this.formatTooltipWithContext(x,{heading:A,title:S??b,symbol:this.legendItemSymbol(e),data:k},{seriesId:t,datum:v,title:S,idKey:r,idName:n,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:p,colorKey:u,colorName:g,sizeKey:d,sizeName:m,labelKey:y,labelName:f,...L})}getFormattedMarkerStyle(e){const t=this.getMarkerItemStyle(e,!1);return{size:t.size,shape:t.shape}}computeFocusBounds(e){return computeMarkerFocusBounds2(this,e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};MapMarkerSeries.className="MapMarkerSeries",MapMarkerSeries.type="map-marker";var import_ag_charts_community103=require("ag-charts-community"),import_ag_charts_core37=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs12,mapMarkerSeriesThemeableOptionsDef,without:without6}=import_ag_charts_community103._ModuleSupport,mapMarkerSeriesOptionsDef={...without6(commonSeriesOptionsDefs12,["highlightStyle","highlight"]),...mapMarkerSeriesThemeableOptionsDef,type:(0,import_ag_charts_core37.required)((0,import_ag_charts_core37.constant)("map-marker")),idKey:import_ag_charts_core37.string,latitudeKey:import_ag_charts_core37.string,longitudeKey:import_ag_charts_core37.string,sizeKey:import_ag_charts_core37.string,colorKey:import_ag_charts_core37.string,labelKey:import_ag_charts_core37.string,idName:import_ag_charts_core37.string,latitudeName:import_ag_charts_core37.string,longitudeName:import_ag_charts_core37.string,sizeName:import_ag_charts_core37.string,colorName:import_ag_charts_core37.string,labelName:import_ag_charts_core37.string,topology:import_ag_charts_core37.geoJson,topologyIdKey:import_ag_charts_core37.string,legendItemName:import_ag_charts_core37.string,title:import_ag_charts_core37.string},MapMarkerModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-marker",moduleFactory:e=>new MapMarkerSeries(e),themeTemplate:{...MAP_THEME_DEFAULTS,series:{shape:"circle",maxSize:30,fill:applyMapPalette({$applySwitch:[{$path:"type"},{$mapPalette:"fill"},["gradient",import_ag_charts_community104._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",import_ag_charts_community104._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community104._ModuleSupport.FILL_PATTERN_DEFAULTS]]}),stroke:{$mapPalette:"stroke"},colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},applyMapPalette(import_ag_charts_community104._ModuleSupport.SAFE_RANGE2_OPERATION)]},fillOpacity:.5,label:{...import_ag_charts_community104._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:applyMapPalette(import_ag_charts_community104._ModuleSupport.multiSeriesHighlightStyle())},tooltip:{range:"exact"}}},MapMarkerSeriesModule={type:"series",name:"map-marker",chartType:"topology",enterprise:!0,options:mapMarkerSeriesOptionsDef,create:e=>new MapMarkerSeries(e),validate(e,t,i){const s=(0,import_ag_charts_core38.validate)(e,t,i),{cleared:a,invalid:o}=s;if(a?.idKey==null&&(a?.latitudeKey==null||a?.longitudeKey==null)){const r=l=>i?`${i}.${l}`:l,n=`Either \`${r("idKey")}\` or both \`${r("latitudeKey")}\` and \`${r("longitudeKey")}\` are required.`;o.push(new import_ag_charts_core38.ValidationError("required",n,null,i))}return s}},import_ag_charts_community108=require("ag-charts-community"),import_ag_charts_community106=require("ag-charts-community"),import_ag_charts_core39=require("ag-charts-core");function preferredLabelCenter(e,{aspectRatio:t,precision:i}){const s=polygonPointSearch(e,i,(l,c,h,p)=>{const u=maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(l,c,h,t),g=u+2*p*t,d=u*Math.SQRT2,m=g*Math.SQRT2;return{distance:d,maxDistance:m}});if(s==null)return;const{x:a,y:o,distance:r}=s,n=r/Math.SQRT2;return{x:a,y:o,maxWidth:n}}function maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(e,t,i,s,a){const[o,r]=e,[n,l]=t,c=1/a,h=n-o,p=l-r,[u,g]=r<=l?e:t,[d,m]=o<=n?e:t,[y,f]=r<=l?t:e,[S,b]=o<=n?t:e;let x=1/0;if(h===0)for(let L=0;L<=1;L+=1){const O=(L===0?c:-c)*(o-i)+s;if(O>=g&&O<=f){const C=Math.abs(s-O)*2*a;x=Math.min(x,C)}}else{const L=p/h;for(let R=0;R<=1;R+=1){const O=R===0?c:-c,B=(L*o-r-O*i+s)/(L-O);if(B>=d&&B<=S){const C=Math.abs(i-B)*2;x=Math.min(x,C)}}}const v=a,_=Math.abs((u-i)/(g-s)),D=Math.abs((y-i)/(f-s));if(fs&&_i&&ki!=c>i&&t<(l-p)*(i-u)/(c-u)+p&&(a=!a);const g=maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(n,h,t,i,s);o=Math.min(o,g),n=h,l=p,c=u}}return(a?1:-1)*o}function applyX(e,t,i){i>=t&&(e.maxX=Math.min(e.maxX,i-t)),i<=t&&(e.minX=Math.max(e.minX,i-t))}function xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(e,t,i,s,a,o){const r=a-o/2,n=a+o/2,[l,c]=t,[h,p]=i,u=h-l,g=p-c,[d,m]=l<=h?t:i,[y,f]=l<=h?i:t;if(u!==0){const S=g/u;for(let b=0;b<=1;b+=1){const v=((b===0?r:n)-c)/S+l;v>=d&&v<=y&&applyX(e,s,v)}}else Math.max(r,Math.min(c,p))<=Math.min(n,Math.max(c,p))&&applyX(e,s,l);return y=r&&f<=n?applyX(e,s,y):d>s&&m>=r&&m<=n&&applyX(e,s,d),e}function maxWidthInPolygonForRectOfHeight(e,t,i,s){const a={minX:-1/0,maxX:1/0};for(const n of e){let l=n.at(-1);for(const c of n)xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(a,l,c,t,i,s),l=c}const{minX:o,maxX:r}=a;return Number.isFinite(o)&&Number.isFinite(r)?{x:t+(o+r)/2,width:r-o}:{x:t,width:0}}var import_ag_charts_community105=require("ag-charts-community"),{Property:Property28,SeriesProperties:SeriesProperties6,makeSeriesTooltip:makeSeriesTooltip15}=import_ag_charts_community105._ModuleSupport,MapShapeSeriesProperties=class extends SeriesProperties6{constructor(){super(...arguments),this.topology=void 0,this.idKey="",this.idName=void 0,this.topologyIdKey="name",this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.padding=0,this.label=new AutoSizedSecondaryLabel,this.tooltip=makeSeriesTooltip15()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r,opacity:1}}};__decorateClass([Property28],MapShapeSeriesProperties.prototype,"topology",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"title",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"legendItemName",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"idKey",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"idName",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"topologyIdKey",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"labelKey",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"labelName",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"colorKey",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"colorName",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"colorRange",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"fill",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"stroke",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"lineDash",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"padding",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"label",2),__decorateClass([Property28],MapShapeSeriesProperties.prototype,"tooltip",2);var{getMissCount:getMissCount4,createDatumId:createDatumId13,SeriesNodePickMode:SeriesNodePickMode11,valueProperty:valueProperty11,ColorScale:ColorScale4,Group:Group10,Selection:Selection9,Text:Text4,PointerEvents:PointerEvents7,applyShapeStyle:applyShapeStyle12,getLabelStyles:getLabelStyles4,mergeDefaults:mergeDefaults13}=import_ag_charts_community106._ModuleSupport,fixedScale=import_ag_charts_community106._ModuleSupport.MercatorScale.fixedScale(),MapShapeSeries=class extends TopologySeries{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{color:["colorKey"],label:["labelKey"]},propertyNames:{color:["colorName"],label:["labelName"]},pickModes:[SeriesNodePickMode11.EXACT_SHAPE_MATCH,SeriesNodePickMode11.NEAREST_NODE]}),this.properties=new MapShapeSeriesProperties,this._chartTopology=void 0,this.colorScale=new ColorScale4,this.itemGroup=this.contentGroup.appendChild(new Group10({name:"itemGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Group10({name:"itemLabelGroup"})),this.datumSelection=Selection9.select(this.itemGroup,()=>this.nodeFactory()),this.labelSelection=Selection9.select(this.itemLabelGroup,Text4),this.highlightDatumSelection=Selection9.select(this.highlightGroup,()=>this.nodeFactory()),this.previousLabelLayouts=void 0,this._previousDatumMidPoint=void 0,this.itemLabelGroup.pointerEvents=PointerEvents7.None}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){return super.hasData&&this.topology!=null}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[1,e],this.highlightGroup.zIndex=[2,e],!0}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}nodeFactory(){const e=new GeoGeometry;return e.renderMode=1,e.lineJoin="round",e}async processData(e){if(this.data==null)return;const{data:t,topology:i,colorScale:s}=this,{topologyIdKey:a,idKey:o,colorKey:r,labelKey:n,colorRange:l}=this.properties,c=new Map;for(const m of i?.features.values()??[]){const y=m.properties?.[a];y==null||!containsType(m.geometry,1)||c.set(y,m)}const h=this.colorScale.type,p=this.scale?.type,{dataModel:u,processedData:g}=await this.requestDataModel(e,t,{props:[valueProperty11(o,p,{id:"idValue",includeProperty:!1}),valueProperty11(o,p,{id:"featureValue",includeProperty:!1,processor:()=>m=>c.get(m)}),...n?[valueProperty11(n,"category",{id:"labelValue"})]:[],...r?[valueProperty11(r,h,{id:"colorValue"})]:[]]}),d=u.resolveColumnById(this,"featureValue",g);if(this.topologyBounds=d.reduce((m,y)=>{const f=y?.geometry;return f==null?m:geometryBbox(f,m)},void 0),l!=null&&this.isColorScaleValid()){const m=u.resolveProcessedDataIndexById(this,"colorValue");s.domain=g.domain.values[m],s.range=l,s.update()}i==null&&import_ag_charts_core39.Logger.warnOnce("no topology was provided for [MapShapeSeries]; nothing will be rendered.")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),a=i.input.count,o=getMissCount4(this,i.defs.values[s].missing);return!(a===0||a===o)}getLabelLayout(e,t,i,s,a){if(t==null||s==null)return;const{idKey:o,idName:r,colorKey:n,colorName:l,labelKey:c,labelName:h,padding:p,label:u}=this.properties;if(c==null||!u.enabled)return;const g=this.getLabelText(t,e,c,"label",[],u,{value:t,datum:e,idKey:o,idName:r,colorKey:n,colorName:l,labelKey:c,labelName:h});if(g==null)return;const d=(0,import_ag_charts_core39.isArray)(g)?(0,import_ag_charts_core39.measureTextSegments)(g,u):i.measureLines(String(g)),m=(d.width+2*p)/(d.height+2*p);if(a?.geometry===s&&a?.labelText===g&&a?.aspectRatio===m)return a;const y=projectGeometry(s,fixedScale),f=largestPolygon(y);if(f==null)return;const S=preferredLabelCenter(f,{aspectRatio:m,precision:.001});if(S==null)return;const{x:b,y:x,maxWidth:v}=S;return{geometry:s,labelText:g,aspectRatio:m,x:b,y:x,maxWidth:v,fixedPolygon:f}}getLabelDatum(e,t){const{scale:i}=this;if(i==null)return;const{padding:s,label:a}=this.properties,{labelText:o,aspectRatio:r,x:n,y:l,maxWidth:c,fixedPolygon:h}=e,p={width:Math.ceil(c*t),height:Math.ceil(c*t/r),meta:n},u=formatSingleLabel((0,import_ag_charts_core39.toPlainText)(o),a,{padding:s},(x,v)=>{if(!v)return p;const _=maxWidthInPolygonForRectOfHeight(h,n,l,x/t);return{width:_.width*t,height:x,meta:_.x}});if(u==null)return;const[{text:g,fontSize:d,lineHeight:m,width:y},f]=u,S=y_){const D=x.length-_;x.length=_,x.push(`(+${D} more)`)}return x.length>0&&import_ag_charts_core39.Logger.warnOnce("some data items do not have matches in the provided topology",x),{itemId:e,nodeData:S,labelData:b}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e,labelSelection:t,highlightDatumSelection:i}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let s=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:a}=this.properties,o=a!=null&&s?.datum==null&&a===s?.legendItemName;s!=null&&(s.series!==this&&!o||s.datum==null)&&(s=void 0);const r=this.contextNodeData?.nodeData??[],n=this.contextNodeData?.labelData??[];this.datumSelection=this.updateDatumSelection({nodeData:r,datumSelection:e}),this.updateDatumStyles({datumSelection:e,isHighlight:!1}),this.updateDatumNodes({datumSelection:e}),this.labelSelection=this.updateLabelSelection({labelData:n,labelSelection:t}),this.updateLabelNodes({labelSelection:t}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:s==null?[]:[s],datumSelection:i}),this.updateDatumStyles({datumSelection:i,isHighlight:!0}),this.updateDatumNodes({datumSelection:i})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>createDatumId13(t.idValue))}getItemStyle({datumIndex:e,datum:t,colorValue:i},s){const{properties:a,colorScale:o}=this,{colorRange:r,itemStyler:n}=a,l=this.getHighlightStyle(s,e),c=mergeDefaults13(l,a.getStyle());!s&&i!=null&&(c.fill=this.isColorScaleValid()?o.convert(i):r?.[0]??c.fill);let h=c;if(n!=null&&e!=null){const p=this.cachedDatumCallback(createDatumId13(e,s?"highlight":"node"),()=>{const u=this.makeItemStylerParams(t,e,s,h);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(n,u))});p&&(h=mergeDefaults13(p,h))}return h}makeItemStylerParams(e,t,i,s){const{id:a}=this,o=this.ctx.highlightManager?.getActiveHighlight(),r=this.getHighlightStateString(o,i,t),n=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:a,datum:e,highlighted:i,highlightState:r,...s,fill:n}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){const t=getTopologyShapeFillBBox(this.scale);e.each((i,s)=>{const{projectedGeometry:a}=s;if(a==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=a,applyShapeStyle12(i,s.style,t)})}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{x:a,y:o,text:r,fontSize:n,lineHeight:l},c)=>{const h=getLabelStyles4(this,void 0,t,t.label,!1,i),{color:p,fontStyle:u,fontWeight:g,fontFamily:d}=h;s.visible=!0,s.x=a,s.y=o,s.text=r,s.fill=p,s.fontStyle=u,s.fontWeight=g,s.fontSize=n,s.lineHeight=l,s.fontFamily=d,s.textAlign="center",s.textBaseline="middle",s.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,s.setBoxing(h)})}resetAnimation(){}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.datumSelection.each((a,o)=>{const r=a.distanceSquared(e,t);rnew MapShapeSeries(e),themeTemplate:{...MAP_THEME_DEFAULTS,series:{fill:applyMapPalette({$applySwitch:[{$path:"type"},{$mapPalette:"fill"},["gradient",import_ag_charts_community108._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["image",import_ag_charts_community108._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community108._ModuleSupport.FILL_PATTERN_DEFAULTS]]}),stroke:{$ref:"chartBackgroundColor"},colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},applyMapPalette(import_ag_charts_community108._ModuleSupport.SAFE_RANGE2_OPERATION)]},fillOpacity:1,strokeWidth:1,lineDash:[0],lineDashOffset:0,padding:2,label:{...import_ag_charts_community108._ModuleSupport.LABEL_BOXING_DEFAULTS,color:{$ref:"chartBackgroundColor"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:"bold",overflowStrategy:"hide"},highlight:applyMapPalette(import_ag_charts_community108._ModuleSupport.multiSeriesHighlightStyle(!0))},tooltip:{range:"exact"}}},MapShapeSeriesModule={type:"series",name:"map-shape",chartType:"topology",enterprise:!0,options:mapShapeSeriesOptionsDef,create:e=>new MapShapeSeries(e)},import_ag_charts_community112=require("ag-charts-community"),import_ag_charts_community110=require("ag-charts-community"),import_ag_charts_core41=require("ag-charts-core"),import_ag_charts_community109=require("ag-charts-community"),{Property:Property29,SeriesProperties:SeriesProperties7,makeSeriesTooltip:makeSeriesTooltip16}=import_ag_charts_community109._ModuleSupport,MapShapeBackgroundSeriesProperties=class extends SeriesProperties7{constructor(){super(...arguments),this.topology=void 0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.tooltip=makeSeriesTooltip16()}};__decorateClass([Property29],MapShapeBackgroundSeriesProperties.prototype,"topology",2),__decorateClass([Property29],MapShapeBackgroundSeriesProperties.prototype,"fill",2),__decorateClass([Property29],MapShapeBackgroundSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property29],MapShapeBackgroundSeriesProperties.prototype,"stroke",2),__decorateClass([Property29],MapShapeBackgroundSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property29],MapShapeBackgroundSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property29],MapShapeBackgroundSeriesProperties.prototype,"lineDash",2),__decorateClass([Property29],MapShapeBackgroundSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property29],MapShapeBackgroundSeriesProperties.prototype,"tooltip",2);var{createDatumId:createDatumId14,Selection:Selection10,Group:Group11,PointerEvents:PointerEvents8}=import_ag_charts_community110._ModuleSupport,MapShapeBackgroundSeries=class extends TopologySeries{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[]}),this.properties=new MapShapeBackgroundSeriesProperties,this._chartTopology=void 0,this.itemGroup=this.contentGroup.appendChild(new Group11({name:"itemGroup"})),this.datumSelection=Selection10.select(this.itemGroup,()=>this.nodeFactory()),this.itemGroup.pointerEvents=PointerEvents8.None}get topology(){return this.properties.topology??this._chartTopology}get focusable(){return!1}setOptionsData(){}setChartData(){}getNodeData(){}get hasData(){return!1}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,e,0],this.highlightGroup.zIndex=[0,e,1],!0}nodeFactory(){const e=new GeoGeometry;return e.renderMode=1,e.lineJoin="round",e.pointerEvents=PointerEvents8.None,e}processData(){const{topology:e}=this;this.topologyBounds=e?.features.reduce((t,i)=>{const s=i.geometry;return s==null?t:geometryBbox(s,t)},void 0),e==null&&import_ag_charts_core41.Logger.warnOnce("no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.")}createNodeData(){const{id:e,topology:t,scale:i,properties:s}=this;if(t==null)return;const{fill:a,fillOpacity:o,stroke:r,strokeWidth:n,strokeOpacity:l,lineDash:c,lineDashOffset:h}=s,p=[],u=[];for(const[g,d]of t.features.entries()){const{geometry:m}=d,y=m!=null&&i!=null?projectGeometry(m,i):void 0;y!=null&&p.push({series:this,itemId:g,datum:d,datumIndex:0,index:g,projectedGeometry:y,style:{fill:a,fillOpacity:o,stroke:r,strokeWidth:n,strokeOpacity:l,lineDash:c,lineDashOffset:h}})}return{itemId:e,nodeData:p,labelData:u}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;const{nodeData:t=[]}=this.contextNodeData??{};this.datumSelection=this.updateDatumSelection({nodeData:t,datumSelection:e}),this.updateDatumNodes({datumSelection:e})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>createDatumId14(t.index))}updateDatumNodes(e){const{datumSelection:t}=e;t.each((i,s)=>{const{projectedGeometry:a}=s;if(a==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=a,i.setProperties(s.style)})}resetAnimation(){}getLegendData(){return[]}getTooltipContent(e){}pickFocus(){}computeFocusBounds(e){}hasItemStylers(){return!1}};MapShapeBackgroundSeries.className="MapShapeBackgroundSeries",MapShapeBackgroundSeries.type="map-shape-background";var import_ag_charts_community111=require("ag-charts-community"),import_ag_charts_core42=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs14,mapShapeBackgroundSeriesThemeableOptionsDef}=import_ag_charts_community111._ModuleSupport,mapShapeBackgroundSeriesOptionsDef={...mapShapeBackgroundSeriesThemeableOptionsDef,...commonSeriesOptionsDefs14,type:(0,import_ag_charts_core42.required)((0,import_ag_charts_core42.constant)("map-shape-background")),topology:import_ag_charts_core42.geoJson},MapShapeBackgroundModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-shape-background",moduleFactory:e=>new MapShapeBackgroundSeries(e),themeTemplate:{...MAP_THEME_DEFAULTS,series:{fill:applyMapPalette({$applySwitch:[{$path:"type"},{$path:["/1",{$mapPalette:"fill"},{$mapPalette:"hierarchyColors"}]},["gradient",import_ag_charts_community112._ModuleSupport.FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS],["image",import_ag_charts_community112._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community112._ModuleSupport.FILL_PATTERN_HIERARCHY_DEFAULTS]]}),stroke:{$ref:"chartBackgroundColor"},strokeWidth:1}}},MapShapeBackgroundSeriesModule={type:"series",name:"map-shape-background",chartType:"topology",enterprise:!0,options:mapShapeBackgroundSeriesOptionsDef,create:e=>new MapShapeBackgroundSeries(e)},import_ag_charts_community121=require("ag-charts-community"),import_ag_charts_community118=require("ag-charts-community"),import_ag_charts_community114=require("ag-charts-community"),import_ag_charts_core43=require("ag-charts-core"),import_ag_charts_community113=require("ag-charts-community"),{createDatumId:createDatumId15,mergeDefaults:mergeDefaults14,toHighlightString:toHighlightString4}=import_ag_charts_community113._ModuleSupport;function makeStylerParams(e,t,i){const{id:s}=e,{angleKey:a,cornerRadius:o,fill:r,fillOpacity:n,lineDash:l,lineDashOffset:c,radiusKey:h,stackGroup:p,stroke:u,strokeOpacity:g,strokeWidth:d}=e.properties,m=toHighlightString4(i??import_ag_charts_community113._ModuleSupport.HighlightState.None);return{angleKey:a,cornerRadius:o,fill:r,fillOpacity:n,highlightState:m,highlighted:t,lineDash:l,lineDashOffset:c,radiusKey:h,seriesId:s,stackGroup:p,stroke:u,strokeOpacity:g,strokeWidth:d}}function getStyle(e,t,i,s){const{styler:a}=e.properties;let o={};if(!t&&a){const r=makeStylerParams(e,i,s);o=e.ctx.optionsGraphService.resolvePartial(["series",`${e.declarationOrder}`],e.cachedCallWithContext(a,r)??{},{pick:!1})??{}}return{cornerRadius:o.cornerRadius??e.properties.cornerRadius,fill:o.fill??e.properties.fill,fillOpacity:o.fillOpacity??e.properties.fillOpacity,lineDash:o.lineDash??e.properties.lineDash,lineDashOffset:o.lineDashOffset??e.properties.lineDashOffset,stroke:o.stroke??e.properties.stroke,strokeOpacity:o.strokeOpacity??e.properties.strokeOpacity,strokeWidth:o.strokeWidth??e.properties.strokeWidth,opacity:1}}function makeItemStylerParams(e,t,i,s){const{id:a,properties:o}=e,{angleKey:r,radiusKey:n}=o,l=e.ctx.highlightManager?.getActiveHighlight(),c=e.getHighlightStateString(l,i,t.datumIndex),h=e.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:a,datum:t.datum,highlighted:i,highlightState:c,angleKey:r,radiusKey:n,...s,fill:h}}function getItemStyle(e,t,i,s){const{properties:a}=e,{itemStyler:o}=a,r=e.getHighlightStyle(i,t?.datumIndex,s);let l=mergeDefaults14(r,getStyle(e,t===void 0,i,s));if(o!=null&&t!=null){const c=e.cachedDatumCallback(createDatumId15(e.getDatumId(t),i?"highlight":"node"),()=>{const h=makeItemStylerParams(e,t,i,l);return e.callWithContext(o,h)});c&&(l=mergeDefaults14(c,l))}return l}var{DEFAULT_POLAR_DIRECTION_KEYS,DEFAULT_POLAR_DIRECTION_NAMES,ChartAxisDirection:ChartAxisDirection16,PolarAxis,diff:diff6,fixNumericExtent:fixNumericExtent7,groupAccumulativeValueProperty,keyProperty:keyProperty8,normaliseGroupTo,resetLabelFn:resetLabelFn5,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation5,seriesLabelFadeOutAnimation,valueProperty:valueProperty12,animationValidation:animationValidation7,createDatumId:createDatumId16,SeriesNodePickMode:SeriesNodePickMode12,normalizeAngle360:normalizeAngle3605,CategoryScale:CategoryScale3,motion:motion6,applyShapeStyle:applyShapeStyle13,isGradientFill:isGradientFill2,updateLabelNode:updateLabelNode6,getItemStyles:getItemStyles3}=import_ag_charts_community114._ModuleSupport,RadialColumnSeriesNodeEvent=class extends import_ag_charts_community114._ModuleSupport.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey}},RadialColumnSeriesBase=class extends import_ag_charts_community114._ModuleSupport.PolarSeries{constructor(e,{animationResetFns:t}){super({moduleCtx:e,categoryKey:"angleValue",propertyKeys:DEFAULT_POLAR_DIRECTION_KEYS,propertyNames:DEFAULT_POLAR_DIRECTION_NAMES,canHaveAxes:!0,pickModes:[SeriesNodePickMode12.NEAREST_NODE,SeriesNodePickMode12.EXACT_SHAPE_MATCH],animationResetFns:{...t,label:resetLabelFn5}}),this.NodeEvent=RadialColumnSeriesNodeEvent,this.groupScale=new CategoryScale3,this.circleCache={r:0,cx:0,cy:0}}get hasData(){return this.getHasData("radiusValue-raw")}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===ChartAxisDirection16.Angle)return t.getDomain(this,"angleValue","key",i);{const s=t.getDomain(this,"radiusValue-end","value",i),a=Number.isFinite(s[1]-s[0])?[Math.min(s[0],0),Math.max(s[1],0)]:[];return fixNumericExtent7(a)}}async processData(e){const{angleKey:t,radiusKey:i,normalizedTo:s}=this.properties,a=!this.ctx.animationManager.isSkipped(),o=this.getStackId(),r=`${o}-trailing`,n=[];(0,import_ag_charts_core43.isDefined)(s)&&n.push(normaliseGroupTo([o,r],Math.abs(s))),a&&this.processedData&&n.push(diff6(this.id,this.processedData)),a&&n.push(animationValidation7());const l=this.visible?{}:{forceValue:0},c=this.axes[ChartAxisDirection16.Radius]?.scale.type,h=this.axes[ChartAxisDirection16.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[keyProperty8(t,h,{id:"angleValue"}),valueProperty12(i,c,{id:"radiusValue-raw",invalidValue:null,...l}),...groupAccumulativeValueProperty(i,"normal",{id:"radiusValue-end",rangeId:"radiusValue-range",invalidValue:null,groupId:o,separateNegative:!0,...l},c),...groupAccumulativeValueProperty(i,"trailing",{id:"radiusValue-start",invalidValue:null,groupId:r,separateNegative:!0,...l},c),...n],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,s=this.circleCache;return e!==s.r||t!==s.cx||i!==s.cy?(this.circleCache={r:e,cx:t,cy:i},!0):!1}isRadiusAxisReversed(){return this.axes[ChartAxisDirection16.Radius]?.isReversed()}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}getAxisInnerRadius(){const e=this.axes[ChartAxisDirection16.Radius];return e instanceof PolarAxis?this.radius*e.innerRadiusRatio:0}createNodeData(){const{processedData:e,dataModel:t,groupScale:i}=this;if(!t||!e||e.type!=="grouped")return;const s=this.axes[ChartAxisDirection16.Angle],a=this.axes[ChartAxisDirection16.Radius],o=s?.scale,r=a?.scale;if(!o||!r)return;const n=t.resolveKeysById(this,"angleValue",e),l=t.resolveColumnById(this,"radiusValue-start",e),c=t.resolveColumnById(this,"radiusValue-end",e),h=t.resolveColumnById(this,"radiusValue-raw",e),p=t.resolveProcessedDataIndexById(this,"radiusValue-range");let u=0,g=0;s instanceof AngleCategoryAxis&&(u=s.groupPaddingInner,g=s.paddingInner);const m=(o.bandwidth??0)*(1-g),{index:y,visibleGroupCount:f}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);i.domain=Array.from({length:f}).map((I,P)=>String(P)),i.range=[-m/2,m/2],i.paddingInner=f>1?u:0;const S=this.isRadiusAxisReversed(),b=S?this.radius:this.getAxisInnerRadius(),x=S?this.getAxisInnerRadius():this.radius,v=x+b,{angleKey:_,radiusKey:D,angleName:k,radiusName:A,legendItemName:L,label:R}=this.properties,O=this.getSeriesDomain(ChartAxisDirection16.Radius),B=(I,P,F,E)=>{const G=this.getLabelText(P,I,D,"radius",O,R,{value:P,datum:I,angleKey:_,radiusKey:D,angleName:k,radiusName:A,legendItemName:L});if(G)return{x:F,y:E,text:G,textAlign:"center",textBaseline:"middle"}},C=[],w=getItemStyles3((I,P,F)=>getItemStyle(this,I,P,F)),M={itemId:D,nodeData:C,labelData:C,styles:w};if(!this.visible)return M;const{dataSources:T}=e,N=T.get(this.id)?.data??[];for(const{datumIndex:I,group:P}of t.forEachGroupDatum(this,e)){const F=N[I],E=n[I];if(E==null)return;const G=h[I],K=G>=0&&!Object.is(G,-0),V=l[I],W=c[I],z=P.aggregation[p][K?1:0]??0,Y=K===S;if(V===void 0||W===void 0)return;let q,$;if(N.length===1)q=-.5*Math.PI,$=1.5*Math.PI;else{const se=o.convert(E);q=normalizeAngle3605(se+i.convert(String(y))),$=normalizeAngle3605(q+i.bandwidth)}const U=q+i.bandwidth/2,j=v-r.convert(V),H=v-r.convert(W),te=(j+H)/2,Z=v-r.convert(0),X=v-r.convert(z),Q=Math.cos(U)*te,J=Math.sin(U)*te,ie=this.properties.label.enabled?B(F,G,Q,J):void 0,ee=this.getColumnWidth(q,$);C.push({series:this,datum:F,datumIndex:I,point:{x:Q,y:J,size:0},midPoint:{x:Q,y:J},label:ie,angleValue:E,radiusValue:G,negative:Y,innerRadius:j,outerRadius:H,stackInnerRadius:Z,stackOuterRadius:X,startAngle:q,endAngle:$,midAngle:U,axisInnerRadius:b,axisOuterRadius:x,columnWidth:ee,index:I})}return{itemId:D,nodeData:C,labelData:C,styles:w}}getColumnWidth(e,t){return Number.NaN}update({seriesRect:e}){const t=this.checkResize(e);this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updateSectorSelection(this.itemSelection,!1),this.updateSectorSelection(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updateSectorSelection(e,t){const{contextNodeData:i}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight();let a=[];const o=this.ctx.highlightManager?.getActiveHighlight();t?o?.datum&&o.series===this&&a.push(o):a=this.nodeData;const r=this.isRadiusAxisReversed(),n=r?this.radius:this.getAxisInnerRadius(),l=r?this.getAxisInnerRadius():this.radius,c=this.getShapeFillBBox(),h=this.hasItemStylers();e.update(a,void 0,p=>this.getDatumId(p)).each((p,u)=>{const{midPoint:g}=u;if(h){const S=this.getHighlightState(o,t,u.datumIndex);u.style=getItemStyle(this,u,t,S)}const d=u.style??i.styles[this.getHighlightState(s,t,u.datumIndex)],m=d.fill,f=isGradientFill2(m)&&m.bounds==="item"?{centerX:g?.x??0,centerY:g?.y??0}:{centerX:0,centerY:0,innerRadius:n,outerRadius:l};this.updateItemPath(p,u,t),applyShapeStyle13(p,d,c,f),p.cornerRadius=d.cornerRadius??0,p.lineJoin="round"})}updateLabels(){const e=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((t,i)=>{updateLabelNode6(this,t,this.properties,this.properties.label,i.label,!1,e),t.fillOpacity=this.getHighlightStyle(!1,i.datumIndex).opacity??1})}animateEmptyUpdateReady(){const{labelSelection:e}=this,t=this.getColumnTransitionFunctions();motion6.fromToMotion(this.id,"datums",this.ctx.animationManager,[this.itemSelection],t),seriesLabelFadeInAnimation5(this,"labels",this.ctx.animationManager,e)}animateClearingUpdateEmpty(){const{itemSelection:e}=this,{animationManager:t}=this.ctx,i=this.getColumnTransitionFunctions();motion6.fromToMotion(this.id,"datums",t,[e],i),seriesLabelFadeOutAnimation(this,"labels",t,this.labelSelection)}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:a,properties:o}=this,{angleKey:r,angleName:n,radiusKey:l,radiusName:c,legendItemName:h,tooltip:p}=o,u=a[ChartAxisDirection16.Angle],g=a[ChartAxisDirection16.Radius],d=this.nodeData?.[e];if(!i||!s||!u||!g||!d)return;const m=s.dataSources.get(this.id)?.data[e],y=i.resolveKeysById(this,"angleValue",s)[e],f=i.resolveColumnById(this,"radiusValue-raw",s)[e];if(y==null)return;const S=getItemStyle(this,d,!1);return this.formatTooltipWithContext(p,{heading:this.getAxisValueText(u,"tooltip",y,m,r,void 0),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(g,"tooltip",f,m,l,void 0)}]},{seriesId:t,datum:m,title:n,angleKey:r,angleName:n,radiusKey:l,radiusName:c,legendItemName:h,...S})}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.itemSelection.nodes())}legendItemSymbol(){const{fill:e,stroke:t,fillOpacity:i,strokeOpacity:s,strokeWidth:a,lineDash:o,lineDashOffset:r}=getStyle(this,!1,!1,import_ag_charts_community114._ModuleSupport.HighlightState.None),n={fill:e??"rgba(0, 0, 0, 0)",stroke:t??"rgba(0, 0, 0, 0)",fillOpacity:i,strokeOpacity:s,strokeWidth:a,lineDash:o,lineDashOffset:r};return import_ag_charts_community114._ModuleSupport.isGradientFill(n.fill)&&(n.fill={...n.fill,gradient:"linear",rotation:0,reverse:!1}),{marker:n}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{radiusKey:s,radiusName:a,legendItemName:o,showInLegend:r}=this.properties;return[{legendType:"category",id:t,itemId:s,seriesId:t,enabled:i,label:{text:o??a??s},symbol:this.legendItemSymbol(),legendItemName:o,hideInLegend:!r}]}getDatumId(e){return createDatumId16(e.angleValue)}computeLabelsBBox(){return null}},import_ag_charts_community115=require("ag-charts-community"),{SeriesProperties:SeriesProperties8,makeSeriesTooltip:makeSeriesTooltip17,Property:Property30,Label:Label10}=import_ag_charts_community115._ModuleSupport,RadialColumnSeriesBaseProperties=class extends SeriesProperties8{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.label=new Label10,this.tooltip=makeSeriesTooltip17()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r,cornerRadius:n}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r,cornerRadius:n,opacity:1}}};__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"angleKey",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"angleName",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"radiusKey",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"radiusName",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"legendItemName",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"fill",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"fillOpacity",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"stroke",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"strokeWidth",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"strokeOpacity",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"lineDash",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"lineDashOffset",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"cornerRadius",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"styler",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"itemStyler",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"rotation",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"stackGroup",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"normalizedTo",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"label",2),__decorateClass([Property30],RadialColumnSeriesBaseProperties.prototype,"tooltip",2);var import_ag_charts_community117=require("ag-charts-community"),import_ag_charts_community116=require("ag-charts-community"),{motion:motion7}=import_ag_charts_community116._ModuleSupport;function createAngleMotionCalculator(){const e={startAngle:new Map,endAngle:new Map},t=["startAngle","endAngle"],i=(r,n,l)=>{for(const c of t){const h=e[c];let p=(l==="removed"||l==="updated"?r:n)[c],u=(l==="removed"?r:n)[c];Number.isNaN(u)&&(u=r.previousDatum?.[c]??Number.NaN);const g=p-u;Math.abs(g)>Math.PI&&(p-=Math.sign(g)*2*Math.PI),h.set(n,{from:p,to:u})}},s=(r,n)=>({startAngle:e.startAngle.get(r)[n],endAngle:e.endAngle.get(r)[n]});return{calculate:i,from:r=>s(r,"from"),to:r=>s(r,"to")}}function fixRadialColumnAnimationStatus(e,t,i){if(i==="updated"){if(e.previousDatum==null||Number.isNaN(e.previousDatum.startAngle)||Number.isNaN(e.previousDatum.endAngle))return"added";if(Number.isNaN(t.startAngle)||Number.isNaN(t.endAngle))return"removed"}return i==="added"&&e.previousDatum!=null?"updated":i}function prepareRadialColumnAnimationFunctions(e){const t=createAngleMotionCalculator();return{toFn:(a,o,r)=>{const{startAngle:n,endAngle:l}=t.to(o);let c,h,p,u,g;return r==="removed"?(c=a.innerRadius,h=a.innerRadius,p=a.columnWidth,u=a.axisInnerRadius,g=a.axisOuterRadius):(c=Number.isNaN(o.innerRadius)?e:o.innerRadius,h=Number.isNaN(o.outerRadius)?e:o.outerRadius,p=Number.isNaN(o.columnWidth)?a.columnWidth:o.columnWidth,u=o.axisInnerRadius,g=o.axisOuterRadius),{innerRadius:c,outerRadius:h,columnWidth:p,axisInnerRadius:u,axisOuterRadius:g,startAngle:n,endAngle:l}},fromFn:(a,o,r)=>{r=fixRadialColumnAnimationStatus(a,o,r),t.calculate(a,o,r);const{startAngle:n,endAngle:l}=t.from(o);let c,h,p,u,g;r==="removed"||r==="updated"?(c=a.innerRadius,h=a.outerRadius,p=a.columnWidth,u=a.axisInnerRadius,g=a.axisOuterRadius):(c=e,h=e,p=o.columnWidth,u=o.axisInnerRadius,g=o.axisOuterRadius);const d=motion7.NODE_UPDATE_STATE_TO_PHASE_MAPPING[r];return{innerRadius:c,outerRadius:h,columnWidth:p,axisInnerRadius:u,axisOuterRadius:g,startAngle:n,endAngle:l,phase:d}}}}function resetRadialColumnSelectionFn(e,{innerRadius:t,outerRadius:i,columnWidth:s,axisInnerRadius:a,axisOuterRadius:o,startAngle:r,endAngle:n}){return{innerRadius:t,outerRadius:i,columnWidth:s,axisInnerRadius:a,axisOuterRadius:o,startAngle:r,endAngle:n}}var{SectorBox,motion:motion8}=import_ag_charts_community117._ModuleSupport;function getRadii(e){const{negative:t,innerRadius:i,outerRadius:s,stackInnerRadius:a,stackOuterRadius:o}=e;return{innerRadius:t?o:a,outerRadius:t?a:o,clipInnerRadius:t?s:i,clipOuterRadius:t?i:s}}function prepareNightingaleAnimationFunctions(e){const t=createAngleMotionCalculator();return{toFn:(a,o,r)=>{const{startAngle:n,endAngle:l}=t.to(o);let c,h,p;if(r==="removed")c=e,h=e,p=new SectorBox(n,l,c,h);else{let u,g;({innerRadius:c,outerRadius:h,clipInnerRadius:u,clipOuterRadius:g}=getRadii(o)),Number.isNaN(c)&&(c=e),Number.isNaN(h)&&(h=e),Number.isNaN(u)&&(u=e),Number.isNaN(g)&&(g=e),p=new SectorBox(n,l,u,g)}return{innerRadius:c,outerRadius:h,startAngle:n,endAngle:l,clipSector:p}},fromFn:(a,o,r)=>{r=fixRadialColumnAnimationStatus(a,o,r),t.calculate(a,o,r);const{startAngle:n,endAngle:l}=t.from(o);let c,h,p;r==="removed"||r==="updated"?(c=a.innerRadius,h=a.outerRadius,p=a.clipSector):(c=e,h=e),p??(p=new SectorBox(n,l,c,h));const u=motion8.NODE_UPDATE_STATE_TO_PHASE_MAPPING[r];return{innerRadius:c,outerRadius:h,startAngle:n,endAngle:l,clipSector:p,phase:u}}}}function resetNightingaleSelectionFn(e,t){const{startAngle:i,endAngle:s}=t,{innerRadius:a,outerRadius:o,clipInnerRadius:r,clipOuterRadius:n}=getRadii(t),l=new SectorBox(i,s,r,n);return{innerRadius:a,outerRadius:o,startAngle:i,endAngle:s,clipSector:l}}var{Sector:Sector4,SectorBox:SectorBox2,PolarZIndexMap}=import_ag_charts_community118._ModuleSupport,NightingaleSeries=class extends RadialColumnSeriesBase{constructor(e){super(e,{animationResetFns:{item:resetNightingaleSelectionFn}}),this.properties=new RadialColumnSeriesBaseProperties}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,PolarZIndexMap.FOREGROUND,e],this.highlightGroup.zIndex=[0,PolarZIndexMap.HIGHLIGHT,e],this.labelGroup.zIndex=[0,PolarZIndexMap.LABEL,e],!0}getStackId(){return`nightingale-stack-${this.seriesGrouping?.groupIndex??this.id}-yValues`}nodeFactory(){return new Sector4}updateItemPath(e,t,i){const{negative:s}=t;if(e.centerX=0,e.centerY=0,e.startOuterCornerRadius=s?0:this.properties.cornerRadius,e.endOuterCornerRadius=s?0:this.properties.cornerRadius,e.startInnerCornerRadius=s?this.properties.cornerRadius:0,e.endInnerCornerRadius=s?this.properties.cornerRadius:0,i){const{startAngle:a,endAngle:o}=t,{innerRadius:r,outerRadius:n,clipInnerRadius:l,clipOuterRadius:c}=getRadii(t);e.innerRadius=r,e.outerRadius=n,e.startAngle=a,e.endAngle=o,e.clipSector=new SectorBox2(a,o,l,c)}}getColumnTransitionFunctions(){const e=this.isRadiusAxisReversed()?this.radius:this.getAxisInnerRadius();return prepareNightingaleAnimationFunctions(e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};NightingaleSeries.className="NightingaleSeries",NightingaleSeries.type="nightingale";var import_ag_charts_community119=require("ag-charts-community"),import_ag_charts_core44=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs15,nightingaleSeriesThemeableOptionsDef}=import_ag_charts_community119._ModuleSupport,nightingaleSeriesOptionsDef={...commonSeriesOptionsDefs15,...nightingaleSeriesThemeableOptionsDef,type:(0,import_ag_charts_core44.required)((0,import_ag_charts_core44.constant)("nightingale")),angleKey:(0,import_ag_charts_core44.required)(import_ag_charts_core44.string),radiusKey:(0,import_ag_charts_core44.required)(import_ag_charts_core44.string),angleName:import_ag_charts_core44.string,radiusName:import_ag_charts_core44.string,legendItemName:import_ag_charts_core44.string,grouped:import_ag_charts_core44.boolean,stacked:import_ag_charts_core44.boolean,stackGroup:import_ag_charts_core44.string,normalizedTo:import_ag_charts_core44.number},import_ag_charts_community120=require("ag-charts-community"),{ThemeConstants:{POLAR_AXIS_TYPE,POLAR_AXIS_SHAPE},FILL_GRADIENT_RADIAL_SERIES_DEFAULTS,FILL_IMAGE_DEFAULTS:FILL_IMAGE_DEFAULTS4,FILL_PATTERN_DEFAULTS:FILL_PATTERN_DEFAULTS2}=import_ag_charts_community120._ModuleSupport,NIGHTINGALE_SERIES_THEME={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",FILL_GRADIENT_RADIAL_SERIES_DEFAULTS],["image",FILL_IMAGE_DEFAULTS4],["pattern",FILL_PATTERN_DEFAULTS2]]},stroke:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$ref:"chartBackgroundColor"},{$palette:"stroke"}]},strokeWidth:1,label:{...import_ag_charts_community120._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:import_ag_charts_community120._ModuleSupport.multiSeriesHighlightStyle()},axes:{[POLAR_AXIS_TYPE.ANGLE_CATEGORY]:{shape:{$findFirstSiblingNotOperation:POLAR_AXIS_SHAPE.CIRCLE},groupPaddingInner:0,paddingInner:0,label:{spacing:10}},[POLAR_AXIS_TYPE.RADIUS_NUMBER]:{shape:{$findFirstSiblingNotOperation:POLAR_AXIS_SHAPE.CIRCLE}}}},{ThemeConstants:{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE2}}=import_ag_charts_community121._ModuleSupport,NightingaleModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"nightingale",moduleFactory:e=>new NightingaleSeries(e),defaultAxes:[{type:POLAR_AXIS_TYPE2.ANGLE_CATEGORY},{type:POLAR_AXIS_TYPE2.RADIUS_NUMBER}],themeTemplate:NIGHTINGALE_SERIES_THEME,stackable:!0,groupable:!0,stackedByDefault:!0},NightingaleSeriesModule={type:"series",name:"nightingale",chartType:"polar",enterprise:!0,options:nightingaleSeriesOptionsDef,create:e=>new NightingaleSeries(e)},import_ag_charts_community123=require("ag-charts-community"),import_ag_charts_core45=require("ag-charts-core"),import_ag_charts_community122=require("ag-charts-community"),{SeriesProperties:SeriesProperties9,makeSeriesTooltip:makeSeriesTooltip18,Property:Property31,Label:Label11,DropShadow:DropShadow5}=import_ag_charts_community122._ModuleSupport,PyramidSeriesLabel=class extends Label11{},PyramidSeriesStageLabel=class extends Label11{constructor(){super(...arguments),this.spacing=0}};__decorateClass([Property31],PyramidSeriesStageLabel.prototype,"spacing",2),__decorateClass([Property31],PyramidSeriesStageLabel.prototype,"placement",2);var PyramidProperties=class extends SeriesProperties9{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.direction="vertical",this.reverse=void 0,this.spacing=0,this.aspectRatio=void 0,this.shadow=new DropShadow5().set({enabled:!1}),this.label=new PyramidSeriesLabel,this.stageLabel=new PyramidSeriesStageLabel,this.tooltip=makeSeriesTooltip18()}getStyle(e=0){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n}=this;return{fill:t[e%t.length],fillOpacity:s,stroke:i[e%i.length],strokeWidth:a,strokeOpacity:o,lineDash:r,lineDashOffset:n,opacity:1}}};__decorateClass([Property31],PyramidProperties.prototype,"stageKey",2),__decorateClass([Property31],PyramidProperties.prototype,"valueKey",2),__decorateClass([Property31],PyramidProperties.prototype,"fills",2),__decorateClass([Property31],PyramidProperties.prototype,"fillOpacity",2),__decorateClass([Property31],PyramidProperties.prototype,"strokes",2),__decorateClass([Property31],PyramidProperties.prototype,"strokeWidth",2),__decorateClass([Property31],PyramidProperties.prototype,"strokeOpacity",2),__decorateClass([Property31],PyramidProperties.prototype,"lineDash",2),__decorateClass([Property31],PyramidProperties.prototype,"lineDashOffset",2),__decorateClass([Property31],PyramidProperties.prototype,"direction",2),__decorateClass([Property31],PyramidProperties.prototype,"reverse",2),__decorateClass([Property31],PyramidProperties.prototype,"spacing",2),__decorateClass([Property31],PyramidProperties.prototype,"aspectRatio",2),__decorateClass([Property31],PyramidProperties.prototype,"itemStyler",2),__decorateClass([Property31],PyramidProperties.prototype,"shadow",2),__decorateClass([Property31],PyramidProperties.prototype,"label",2),__decorateClass([Property31],PyramidProperties.prototype,"stageLabel",2),__decorateClass([Property31],PyramidProperties.prototype,"tooltip",2);function applyPyramidDatum(e,{x:t,y:i,top:s,right:a,bottom:o,left:r}){e.x0=t-s/2,e.x1=t+s/2,e.x2=t+o/2,e.x3=t-o/2,e.y0=i-r/2,e.y1=i-a/2,e.y2=i+a/2,e.y3=i+r/2}function preparePyramidAnimationFunctions(e){return{fromFn:(a,o)=>{const{x:r,y:n}=o;let{top:l,right:c,bottom:h,left:p}=o;return e==="vertical"?(l=0,h=0):(p=0,c=0),{x:r,y:n,top:l,right:c,bottom:h,left:p}},toFn:(a,o)=>{const{x:r,y:n,top:l,right:c,bottom:h,left:p}=o;return{x:r,y:n,top:l,right:c,bottom:h,left:p}},applyFn:applyPyramidDatum}}var{StateMachine:StateMachine3,valueProperty:valueProperty13,SeriesNodePickMode:SeriesNodePickMode13,createDatumId:createDatumId17,BBox:BBox12,Group:Group12,Selection:Selection11,Text:Text5,PointerEvents:PointerEvents9,applyShapeStyle:applyShapeStyle14,mergeDefaults:mergeDefaults15,fromToMotion:fromToMotion4,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation6,getLabelStyles:getLabelStyles5}=import_ag_charts_community123._ModuleSupport,PyramidSeries=class extends import_ag_charts_community123._ModuleSupport.DataModelSeries{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[SeriesNodePickMode13.EXACT_SHAPE_MATCH,SeriesNodePickMode13.NEAREST_NODE]}),this.properties=new PyramidProperties,this.itemGroup=this.contentGroup.appendChild(new Group12({name:"itemGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Group12({name:"itemLabelGroup"})),this.stageLabelGroup=this.contentGroup.appendChild(new Group12({name:"stageLabelGroup"})),this.datumSelection=Selection11.select(this.itemGroup,()=>this.nodeFactory()),this.labelSelection=Selection11.select(this.itemLabelGroup,Text5),this.stageLabelSelection=Selection11.select(this.stageLabelGroup,Text5),this.highlightDatumSelection=Selection11.select(this.highlightGroup,()=>this.nodeFactory()),this.animationState=new StateMachine3("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{clear:"empty",reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable()),this.itemLabelGroup.pointerEvents=PointerEvents9.None,this.stageLabelGroup.pointerEvents=PointerEvents9.None}addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",e=>this.onLegendItemClick(e)))}nodeFactory(){return new FunnelConnector}getNodeData(){return this.contextNodeData?.nodeData}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}async processData(e){if(this.data==null)return;const{id:t,visible:i,ctx:{legendManager:s}}=this,{stageKey:a,valueKey:o}=this.properties,r="category",n="number",l=(h,p,u)=>i&&s.getItemEnabled({seriesId:t,itemId:u}),c=this.visible?{}:{forceValue:0};await this.requestDataModel(e,this.data,{props:[valueProperty13(a,r,{id:"xValue"}),valueProperty13(o,n,{id:"yValue",...c,validation:l,invalidValue:0})]})}createNodeData(){const{id:e,dataModel:t,processedData:i,properties:s,visible:a,ctx:{legendManager:o}}=this,{stageKey:r,valueKey:n,direction:l,reverse:c=l==="horizontal",spacing:h,aspectRatio:p,label:u,stageLabel:g}=s;if(t==null||i==null)return;const d=l==="horizontal",m=t.resolveColumnById(this,"xValue",i),y=t.resolveColumnById(this,"yValue",i),f=t.getDomain(this,"xValue","value",i),S=t.getDomain(this,"yValue","value",i),b=(0,import_ag_charts_core45.cachedTextMeasurer)(g);let x,v;d?(x="center",v=g.placement==="before"?"bottom":"top"):(x=g.placement==="after"?"left":"right",v="middle");const _=g.enabled?[]:void 0;let D=0,k=0,A=0;const L=i.dataSources.get(this.id)?.data??[];for(const[E,G]of L.entries()){const K=m[E],V=y[E],W=a&&o.getItemEnabled({seriesId:e,itemId:E});if(A+=V,_==null)continue;const z=this.getLabelText(K,G,r,"x",f,this.properties.stageLabel,{datum:G,value:V,stageKey:r,valueKey:n}),{width:Y,height:q}=(0,import_ag_charts_core45.isArray)(z)?(0,import_ag_charts_core45.measureTextSegments)(z,u):b.measureLines(z);D=Math.max(D,Y),k=Math.max(k,q),_.push({x:Number.NaN,y:Number.NaN,text:z,textAlign:x,textBaseline:v,visible:W})}const R=this._nodeDataDependencies?.seriesRectWidth??0,O=this._nodeDataDependencies?.seriesRectHeight??0,B=h*(i.input.count-1);let C;if(d){const E=k+g.spacing;C=new BBox12(0,g.placement==="before"?E:0,R,O-E)}else{const E=D+g.spacing;C=new BBox12(g.placement==="after"?0:E,0,R-E,O)}if(p!=null&&p!==0){const E=l==="horizontal"?1/p:p,G=Math.min(C.width,C.height*E),K=G/E;C=new BBox12(C.x+(C.width-G)/2,C.y+(C.height-K)/2,G,K)}let w,M;d?M=g.placement==="before"?C.y-g.spacing:C.y+C.height+g.spacing:w=g.placement==="after"?C.x+C.width+g.spacing:C.x-g.spacing;const T=C.width-(d?B:0),N=C.height-(d?0:B);if(T<0||N<0)return;const I=[],P=[];let F=0;for(const[E,G]of L.entries()){const K=m[E],V=y[E],W=a&&o.getItemEnabled({seriesId:e,itemId:E}),z=F+V,Y=(F+z)/(2*A),q=(z-F)/A,$=d?T*Y+h*E:T*.5,U=d?N*.5:N*Y+h*E,j=C.x+$,H=C.y+U;if(_!=null){const ee=_[E];ee.x=w??j,ee.y=M??H}let te,Z,X,Q;if(d){const ee=T*q;te=ee,X=ee;const se=($+ee/2)*(N/C.width),ae=($-ee/2)*(N/C.width);Z=c?C.height-se:se,Q=c?C.height-ae:ae}else{const ee=N*q;Z=ee,Q=ee;const se=(U-ee/2)*(T/C.height),ae=(U+ee/2)*(T/C.height);te=c?C.width-se:se,X=c?C.width-ae:ae}const J=this.getLabelText(V,G,n,"y",S,u,{datum:G,value:V,stageKey:r,valueKey:n}),ie={x:j,y:H,text:J,textAlign:"center",textBaseline:"middle",visible:W};P.push(ie),I.push({series:this,itemId:n,datum:G,datumIndex:E,index:E,xValue:K,yValue:V,x:j,y:H,top:te,right:Z,bottom:X,left:Q,label:ie,enabled:W,midPoint:{x:j,y:H},style:this.getItemStyle({datumIndex:E,datum:G},!1)}),F=z}return{itemId:e,nodeData:I,labelData:P,stageLabelData:_,bounds:C}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update({seriesRect:e}){this.checkResize(e);const{datumSelection:t,labelSelection:i,stageLabelSelection:s,highlightDatumSelection:a}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.contentGroup.opacity=this.getOpacity();let o=this.ctx.highlightManager?.getActiveHighlight();o!=null&&(o.series!==this||o.datum==null)&&(o=void 0);const r=this.contextNodeData?.nodeData??[],n=this.contextNodeData?.labelData??[],l=this.contextNodeData?.stageLabelData??[];this.datumSelection=this.updateDatumSelection({nodeData:r,datumSelection:t}),this.updateDatumStyles({datumSelection:t,isHighlight:!1}),this.updateDatumNodes({datumSelection:t,isHighlight:!1}),this.labelSelection=this.updateLabelSelection({labelData:n,labelSelection:i}),this.updateLabelNodes({labelSelection:i,labelProperties:this.properties.label}),this.stageLabelSelection=this.updateStageLabelSelection({stageLabelData:l,stageLabelSelection:s}),this.updateLabelNodes({labelSelection:s,labelProperties:this.properties.stageLabel}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:o==null?[]:[o],datumSelection:a}),this.updateDatumStyles({datumSelection:a,isHighlight:!0}),this.updateDatumNodes({datumSelection:a,isHighlight:!0}),this.animationState.transition("update")}updateDatumSelection(e){return e.datumSelection.update(e.nodeData)}getItemStyle({datumIndex:e,datum:t},i){const{properties:s}=this,{itemStyler:a}=s,o=this.getHighlightStyle(i,e);let n=mergeDefaults15(o,s.getStyle(e));if(a!=null&&e!=null){const l=this.cachedDatumCallback(createDatumId17(e,i?"highlight":"node"),()=>{const c=this.makeItemStylerParams(t,e,i,n);return this.callWithContext(a,c)});l&&(n=mergeDefaults15(l,n))}return n}makeItemStylerParams(e,t,i,s){const{id:a,properties:o}=this,{stageKey:r,valueKey:n}=o,l=this.ctx.highlightManager?.getActiveHighlight(),c=this.getHighlightStateString(l,i,t),h=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:a,datum:e,stageKey:r,valueKey:n,highlighted:i,highlightState:c,...s,fill:h}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){const{properties:t}=this,{shadow:i}=t,s=this.contextNodeData?.bounds,a=s?{series:s,axis:s}:void 0;e.each((o,r)=>{applyShapeStyle14(o,r.style,a),applyPyramidDatum(o,r),o.fillShadow=i})}updateLabelSelection(e){return e.labelSelection.update(this.properties.label.enabled?e.labelData:[])}updateStageLabelSelection(e){return e.stageLabelSelection.update(e.stageLabelData)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,s,a)=>{const{visible:o,x:r,y:n,text:l,textAlign:c,textBaseline:h}=s,p=getLabelStyles5(this,void 0,this.properties,e.labelProperties,!1,t),{color:u,fontSize:g,fontStyle:d,fontWeight:m,fontFamily:y}=p;i.visible=o,i.x=r,i.y=n,i.text=l,i.fill=u,i.fillOpacity=this.getHighlightStyle(!1,a).opacity??1,i.fontStyle=d,i.fontWeight=m,i.fontSize=g,i.fontFamily=y,i.textAlign=c,i.textBaseline=h,i.setBoxing(p)})}computeFocusBounds(e){const t=this.getNodeData()?.[e.datumIndex];if(t!==void 0){for(const i of this.datumSelection)if(i.datum===t)return i.node}}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:a}=this,{stageKey:o,valueKey:r,tooltip:n}=a;if(!i||!s)return;const l=s.dataSources.get(this.id)?.data[e],c=i.resolveColumnById(this,"xValue",s)[e],h=i.resolveColumnById(this,"yValue",s)[e];if(c==null)return;const p=this.getLabelText(c,l,o,"x",i.getDomain(this,"xValue","value",s),this.properties.stageLabel,{datum:l,value:c,stageKey:o,valueKey:r}),u=this.getLabelText(h,l,r,"y",i.getDomain(this,"yValue","value",s),this.properties.stageLabel,{datum:l,value:h,stageKey:o,valueKey:r}),g=this.getItemStyle({datumIndex:e,datum:l},!1);return this.formatTooltipWithContext(n,{symbol:this.legendItemSymbol(e),data:[{label:(0,import_ag_charts_core45.toPlainText)(p),value:(0,import_ag_charts_core45.toPlainText)(u)}]},{seriesId:t,datum:l,title:void 0,stageKey:o,valueKey:r,...g})}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.datumSelection.each((a,o)=>{const r=a.distanceSquared(e,t);rnew PyramidSeries(e)},import_ag_charts_community132=require("ag-charts-community"),import_ag_charts_community126=require("ag-charts-community"),{ThemeConstants:{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE3}}=import_ag_charts_community126._ModuleSupport,BASE_RADAR_SERIES_THEME={series:{stroke:{$palette:"stroke"},label:{...import_ag_charts_community126._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},marker:{enabled:!0,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community126._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",import_ag_charts_community126._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community126._ModuleSupport.FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},fillOpacity:1,shape:"circle",size:6,strokeOpacity:1,strokeWidth:{$isUserOption:["./stroke",1,0]}},highlight:import_ag_charts_community126._ModuleSupport.multiSeriesHighlightStyle(),tooltip:{range:{$path:["/tooltip/range","nearest"]}}},axes:{[POLAR_AXIS_TYPE3.ANGLE_CATEGORY]:{label:{spacing:10}}}},RADAR_LINE_SERIES_THEME=import_ag_charts_community126._ModuleSupport.mergeDefaults({series:{stroke:import_ag_charts_community126._ModuleSupport.SAFE_STROKE_FILL_OPERATION,strokeWidth:2}},BASE_RADAR_SERIES_THEME),RADAR_AREA_SERIES_THEME=import_ag_charts_community126._ModuleSupport.mergeDefaults({series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community126._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["image",import_ag_charts_community126._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community126._ModuleSupport.FILL_PATTERN_DEFAULTS]]},fillOpacity:.8,strokeWidth:2,marker:{enabled:!1}}},BASE_RADAR_SERIES_THEME),import_ag_charts_community130=require("ag-charts-community"),import_ag_charts_community128=require("ag-charts-community"),import_ag_charts_core47=require("ag-charts-core"),import_ag_charts_community127=require("ag-charts-community"),{Label:Label12,SeriesMarker:SeriesMarker2,SeriesProperties:SeriesProperties10,makeSeriesTooltip:makeSeriesTooltip19,Property:Property32}=import_ag_charts_community127._ModuleSupport,RadarSeriesProperties=class extends SeriesProperties10{constructor(){super(...arguments),this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.rotation=0,this.marker=new SeriesMarker2,this.label=new Label12,this.tooltip=makeSeriesTooltip19(),this.connectMissingData=!1}};__decorateClass([Property32],RadarSeriesProperties.prototype,"angleKey",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"radiusKey",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"angleName",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"radiusName",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"legendItemName",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"stroke",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"lineDash",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"rotation",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"styler",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"marker",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"label",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"tooltip",2),__decorateClass([Property32],RadarSeriesProperties.prototype,"connectMissingData",2);var{DEFAULT_POLAR_DIRECTION_KEYS:DEFAULT_POLAR_DIRECTION_KEYS2,DEFAULT_POLAR_DIRECTION_NAMES:DEFAULT_POLAR_DIRECTION_NAMES2,ChartAxisDirection:ChartAxisDirection17,PolarAxis:PolarAxis2,SeriesNodePickMode:SeriesNodePickMode14,valueProperty:valueProperty14,fixNumericExtent:fixNumericExtent8,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation7,markerFadeInAnimation:markerFadeInAnimation2,resetMarkerFn:resetMarkerFn2,animationValidation:animationValidation8,computeMarkerFocusBounds:computeMarkerFocusBounds3,extent:extent2,BBox:BBox13,Group:Group13,Path:Path10,Selection:Selection12,Text:Text6,Marker:Marker4,updateLabelNode:updateLabelNode7,getMarkerStyles:getMarkerStyles2,mergeDefaults:mergeDefaults16}=import_ag_charts_community128._ModuleSupport,RadarSeriesNodeEvent=class extends import_ag_charts_community128._ModuleSupport.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey}},RadarSeries=class extends import_ag_charts_community128._ModuleSupport.PolarSeries{constructor(e){super({moduleCtx:e,categoryKey:"angleValue",propertyKeys:DEFAULT_POLAR_DIRECTION_KEYS2,propertyNames:DEFAULT_POLAR_DIRECTION_NAMES2,pickModes:[SeriesNodePickMode14.NEAREST_NODE,SeriesNodePickMode14.EXACT_SHAPE_MATCH],canHaveAxes:!0,animationResetFns:{item:resetMarkerFn2},clipFocusBox:!1}),this.NodeEvent=RadarSeriesNodeEvent,this.lineGroup=this.contentGroup.appendChild(new Group13({name:"radar-line"})),this.lineSelection=Selection12.select(this.lineGroup,Path10),this.resetInvalidToZero=!1,this.circleCache={r:0,cx:0,cy:0},this.lineGroup.zIndex=0,this.itemGroup.zIndex=1}get hasData(){return this.getHasData("angleValue")}nodeFactory(){return new Marker4}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===ChartAxisDirection17.Angle)return t.getDomain(this,"angleValue","value",i);{const s=t.getDomain(this,"radiusValue","value",i),a=extent2(s.length===0?s:[0].concat(s));return fixNumericExtent8(a)}}async processData(e){const{angleKey:t,radiusKey:i}=this.properties,s=[];this.ctx.animationManager.isSkipped()||s.push(animationValidation8());const a=this.axes[ChartAxisDirection17.Radius]?.scale.type,o=this.axes[ChartAxisDirection17.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[valueProperty14(t,o,{id:"angleValue"}),valueProperty14(i,a,{id:"radiusValue",invalidValue:void 0}),...s]}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,s=this.circleCache;return e===s.r&&t===s.cx&&i===s.cy?!1:(this.circleCache={r:e,cx:t,cy:i},!0)}getAxisInnerRadius(){const e=this.axes[ChartAxisDirection17.Radius];return e instanceof PolarAxis2?this.radius*e.innerRadiusRatio:0}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}createNodeData(){const{processedData:e,dataModel:t}=this;if(!e||!t)return;const{angleKey:i,radiusKey:s,angleName:a,radiusName:o,legendItemName:r,marker:n,label:l}=this.properties,c=this.axes[ChartAxisDirection17.Angle]?.scale,h=this.axes[ChartAxisDirection17.Radius]?.scale;if(!c||!h)return;const p=t.resolveColumnById(this,"angleValue",e),u=t.resolveColumnById(this,"radiusValue",e),g=this.getAxisInnerRadius(),d=this.getSeriesDomain(ChartAxisDirection17.Radius),y=(e.dataSources.get(this.id)?.data??[]).map((f,S)=>{const b=p[S],x=u[S],v=c.convert(b),_=this.radius+g-h.convert(x),D=Math.cos(v),k=Math.sin(v),A=D*_,L=k*_;let R;if(l.enabled){const O=this.getLabelText(x,f,s,"radius",d,l,{value:x,datum:f,angleKey:i,radiusKey:s,angleName:a,radiusName:o,legendItemName:r});if(O){let B="right";(0,import_ag_charts_core47.isNumberEqual)(D,0)?B="center":D>0&&(B="left");let C="bottom";(0,import_ag_charts_core47.isNumberEqual)(k,0)?C="middle":k>0&&(C="top"),R={x:A+D*n.size,y:L+k*n.size,text:O,textAlign:B,textBaseline:C}}}return{series:this,datum:f,datumIndex:S,index:S,point:{x:A,y:L,size:n.size},midPoint:{x:A,y:L},label:R,angleValue:b,radiusValue:x,missing:!(0,import_ag_charts_core47.isFiniteNumber)(v)||!(0,import_ag_charts_core47.isFiniteNumber)(_)}});return{itemId:s,nodeData:y,labelData:y,styles:getMarkerStyles2(this,this.properties,n)}}update({seriesRect:e}){const t=this.checkResize(e),i=!this.ctx.animationManager.isSkipped(),{series:s}=this.ctx.highlightManager?.getActiveHighlight()??{};this.highlightGroup.visible=(i||this.visible)&&s===this,this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updatePathSelections(),this.updateMarkerSelection(),this.updateHighlightSelection(),this.updatePathNodes(),this.hasItemStylers()&&(this.updateDatumStyles(this.itemSelection,!1),this.updateDatumStyles(this.highlightSelection,!0)),this.updateMarkers(this.itemSelection,!1),this.updateMarkers(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updatePathSelections(){const e=this.visible?[!0]:[];this.lineSelection.update(e)}updateMarkerSelection(){const{marker:e,styler:t}=this.properties;e.isDirty()&&(this.itemSelection.clear(),this.itemSelection.cleanup(),this.itemSelection=Selection12.select(this.itemGroup,()=>this.nodeFactory(),!1));const i=t==null?e.enabled:this.getStyle(!1).marker.enabled,s=this.visible&&e.shape&&i?this.nodeData:[];this.itemSelection.update(s)}updateHighlightSelection(){const{marker:e,styler:t}=this.properties;e.isDirty()&&(this.highlightSelection.clear(),this.highlightSelection.cleanup(),this.highlightSelection=Selection12.select(this.highlightGroup,()=>this.nodeFactory(),!1));const i=t==null?e.enabled:this.getStyle(!1).marker.enabled,s=this.ctx.highlightManager?.getActiveHighlight(),a=this.visible&&e.shape&&i&&s?.datum?[{...s}]:[];this.highlightSelection.update(a)}getMarkerFill(e){return e?.fill??this.getStyle(!1).marker.fill}getDatumStylerProperties(e){const{id:t,properties:i}=this,{angleKey:s,radiusKey:a}=i;return{seriesId:t,datum:e,angleKey:s,radiusKey:a}}updateDatumStyles(e,t){const i=this.ctx.highlightManager.getActiveHighlight();e.each((s,a)=>{const o=this.getHighlightState(i,t,a.datumIndex),r=this.getStyle(t,o),{stroke:n,strokeWidth:l,strokeOpacity:c}=r;a.style=this.getMarkerStyle(this.properties.marker,a,this.getDatumStylerProperties(a.datum),{isHighlight:t,highlightState:o},r.marker,{stroke:n,strokeWidth:l,strokeOpacity:c})})}updateMarkers(e,t){const i=this.getShapeFillBBox(),{contextNodeData:s}=this;if(!s)return;const a=this.ctx.highlightManager.getActiveHighlight();e.each((o,r)=>{const n=r.style??s.styles[this.getHighlightState(a,t,r.datumIndex)];this.applyMarkerStyle(n,o,r.point,i)})}updateLabels(){const{properties:e}=this,t=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((i,s)=>{s.label&&(i.fillOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1,updateLabelNode7(this,i,e,e.label,s.label,!1,t))})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:a,properties:o}=this,{angleKey:r,angleName:n,radiusKey:l,radiusName:c,legendItemName:h,tooltip:p,marker:u}=o,g=a[ChartAxisDirection17.Angle],d=a[ChartAxisDirection17.Radius];if(!i||!s||!g||!d)return;const m=s.dataSources.get(this.id)?.data[e],y=i.resolveColumnById(this,"angleValue",s)[e],f=i.resolveColumnById(this,"radiusValue",s)[e];if(y==null)return;const S=this.getMarkerStyle(u,{datum:m,datumIndex:e},this.getDatumStylerProperties(m),{isHighlight:!1});return this.formatTooltipWithContext(p,{heading:this.getAxisValueText(g,"tooltip",y,m,r,void 0),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(d,"tooltip",f,m,l,void 0)}]},{seriesId:t,datum:m,title:n,angleKey:r,radiusKey:l,angleName:n,radiusName:c,legendItemName:h,...S})}legendItemSymbol(){const{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:s,marker:a}=this.getStyle(!1);return{marker:{shape:a.shape,enabled:a.enabled||t<=0,fill:this.getMarkerFill()??a.stroke??e??"rgba(0, 0, 0, 0)",stroke:a.stroke??e??"rgba(0, 0, 0, 0)",fillOpacity:a.fillOpacity,strokeOpacity:a.strokeOpacity,strokeWidth:a.strokeWidth,lineDash:a.lineDash,lineDashOffset:a.lineDashOffset},line:{stroke:e,strokeOpacity:i,strokeWidth:t,lineDash:s}}}getLegendData(e){if(e!=="category")return[];const{id:t,ctx:{legendManager:i},visible:s}=this,{radiusKey:a,radiusName:o,legendItemName:r,showInLegend:n}=this.properties;return[{legendType:"category",id:t,itemId:a,seriesId:t,enabled:s&&i.getItemEnabled({seriesId:t,itemId:a}),label:{text:r??o??a},symbol:this.legendItemSymbol(),legendItemName:r,hideInLegend:!n}]}pickNodeClosestDatum(e){const{nodeData:t,centerX:i,centerY:s}=this,{x:a,y:o}=e,r=this.radius;if(Math.hypot(a-i,o-s)>r+this.properties.marker.size)return;let l=1/0,c;for(const h of t){const{point:{x:p=Number.NaN,y:u=Number.NaN}={}}=h;if(Number.isNaN(p)||Number.isNaN(u))continue;const g=Math.hypot(e.x-p-i,e.y-u-s);gthis.animatePaths(s),onStop:()=>this.animatePaths(1)}),markerFadeInAnimation2(this,i,"added",e),seriesLabelFadeInAnimation7(this,"labels",i,t)}animateWaitingUpdateReady(e){super.animateWaitingUpdateReady(e),this.resetPaths()}animateReadyResize(e){super.animateReadyResize(e),this.resetPaths()}resetPaths(){const e=this.getLineNode();if(e){const{path:t}=e,i=this.getLinePoints(),s=this.getStyle(!1);e.fill=void 0,e.stroke=s.stroke,e.strokeWidth=s.strokeWidth,e.strokeOpacity=s.strokeOpacity,e.lineDash=s.lineDash,e.lineDashOffset=s.lineDashOffset,t.clear(!0);for(const{x:a,y:o,moveTo:r}of i)r?t.moveTo(a,o):t.lineTo(a,o);return e.checkPathDirty(),s}}getStylerResult(e,t,i){const{styler:s}=this.properties;if(s){const a=this.makeStylerParams(t,i),o=this.cachedCallWithContext(s,a)??{},r=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],o,{pick:!1});r&&(e=r)}return e}getFormattedMarkerStyle(e){const{angleKey:t,radiusKey:i}=this.properties;return this.getMarkerStyle(this.properties.marker,e,{angleKey:t,radiusKey:i},{isHighlight:!0})}computeFocusBounds(e){return computeMarkerFocusBounds3(this,e)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};RadarSeries.className="RadarSeries";var import_ag_charts_community129=require("ag-charts-community"),{Property:Property33}=import_ag_charts_community129._ModuleSupport,RadarAreaSeriesProperties=class extends RadarSeriesProperties{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1}};__decorateClass([Property33],RadarAreaSeriesProperties.prototype,"fill",2),__decorateClass([Property33],RadarAreaSeriesProperties.prototype,"fillOpacity",2);var{ChartAxisDirection:ChartAxisDirection18,Group:Group14,HighlightState:HighlightState4,Path:Path11,PointerEvents:PointerEvents10,Selection:Selection13,applyShapeStyle:applyShapeStyle15,toHighlightString:toHighlightString5}=import_ag_charts_community130._ModuleSupport,RadarAreaSeries=class extends RadarSeries{constructor(e){super(e),this.properties=new RadarAreaSeriesProperties,this.areaGroup=this.contentGroup.appendChild(new Group14({name:"radar-area"})),this.areaSelection=Selection13.select(this.areaGroup,Path11),this.resetInvalidToZero=!0,this.areaGroup.zIndex=-1}updatePathSelections(){const e=this.visible?[!0]:[];this.areaSelection.update(e),super.updatePathSelections()}getAreaNode(){return this.areaSelection.at(0)}getMarkerFill(e){if(e?.fill!=null)return e.fill;const t=this.getStyle(!1);return t.marker.fill??t.fill}updatePathNodes(){const e=this.getPathNodesStyle(),{fill:t,fillOpacity:i,strokeWidth:s,stroke:a,strokeOpacity:o,lineDash:r,lineDashOffset:n,opacity:l}=e,c=this.getLineNode();c&&c.setProperties({fill:void 0,lineJoin:"round",lineCap:"round",pointerEvents:PointerEvents10.None,opacity:l,stroke:a,strokeWidth:s,strokeOpacity:o,lineDash:r,lineDashOffset:n});const h=this.getAreaNode();h&&(applyShapeStyle15(h,{fill:t,fillOpacity:i,stroke:void 0},this.getShapeFillBBox()),h.setProperties({lineJoin:"round",pointerEvents:PointerEvents10.None,opacity:l}))}animatePaths(e){super.animatePaths(e);const t=this.getAreaNode();t&&this.animateSinglePath(t,this.getAreaPoints(),e)}getAreaPoints(){const e=this.getLinePoints(),t=r=>{const n=this.axes[r];return n instanceof import_ag_charts_community130._ModuleSupport.PolarAxis?n:void 0},i=t(ChartAxisDirection18.Radius),s=t(ChartAxisDirection18.Angle);if(!i?.isReversed())return e;const o=s?.getAxisLinePoints()?.points??[];return e.concat(...o)}resetPaths(){const e=super.resetPaths(),t=this.getAreaNode();if(t){const{path:i}=t,s=this.getAreaPoints(),a=e??this.getStyle(!1),o=this.getShapeFillBBox();applyShapeStyle15(t,{fill:a.fill,stroke:void 0,fillOpacity:a.fillOpacity,lineDash:a.lineDash,lineDashOffset:a.lineDashOffset},o),t.lineJoin=t.lineCap="round",i.clear(!0);for(const{x:r,y:n,moveTo:l,arc:c,radius:h=0,startAngle:p=0,endAngle:u=0}of s)c?i.arc(r,n,h,p,u):l?i.moveTo(r,n):i.lineTo(r,n);return i.closePath(),t.checkPathDirty(),a}}makeStylerParams(e,t){const{properties:i}=this,s=toHighlightString5(t??HighlightState4.None);return{marker:{fill:i.marker.fill,fillOpacity:i.marker.fillOpacity,size:i.marker.size,shape:i.marker.shape,stroke:i.marker.stroke,strokeOpacity:i.marker.strokeOpacity,strokeWidth:i.marker.strokeWidth,lineDash:i.marker.lineDash,lineDashOffset:i.marker.lineDashOffset},highlightState:s,highlighted:e,fill:i.fill,fillOpacity:i.fillOpacity,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,seriesId:this.id,stroke:i.stroke,strokeOpacity:i.strokeOpacity,strokeWidth:i.strokeWidth,angleKey:i.angleKey,radiusKey:i.radiusKey}}getStyle(e,t){const{marker:i,fill:s,fillOpacity:a,lineDash:o,lineDashOffset:r,stroke:n,strokeOpacity:l,strokeWidth:c}=this.properties,{size:h,shape:p,fill:u="transparent",fillOpacity:g}=i,d=this.getStylerResult({},e,t);return d.marker??(d.marker={}),{fill:d.fill??s,fillOpacity:d.fillOpacity??a,lineDash:d.lineDash??o,lineDashOffset:d.lineDashOffset??r,stroke:d.stroke??n,strokeOpacity:d.strokeOpacity??l,strokeWidth:d.strokeWidth??c,marker:{enabled:d.marker.enabled??i.enabled,fill:d.marker.fill??u,fillOpacity:d.marker.fillOpacity??g,shape:d.marker.shape??p,size:d.marker.size??h,lineDash:d.marker.lineDash??i.lineDash??o,lineDashOffset:d.marker.lineDashOffset??i.lineDashOffset??r,stroke:d.marker.stroke??i.stroke??n,strokeOpacity:d.marker.strokeOpacity??i.strokeOpacity??l,strokeWidth:d.marker.strokeWidth??i.strokeWidth??c}}}};RadarAreaSeries.className="RadarAreaSeries",RadarAreaSeries.type="radar-area";var import_ag_charts_community131=require("ag-charts-community"),import_ag_charts_core48=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs17,radarAreaSeriesThemeableOptionsDef}=import_ag_charts_community131._ModuleSupport,radarAreaSeriesOptionsDef={...commonSeriesOptionsDefs17,...radarAreaSeriesThemeableOptionsDef,type:(0,import_ag_charts_core48.required)((0,import_ag_charts_core48.constant)("radar-area")),angleKey:(0,import_ag_charts_core48.required)(import_ag_charts_core48.string),radiusKey:(0,import_ag_charts_core48.required)(import_ag_charts_core48.string),angleName:import_ag_charts_core48.string,radiusName:import_ag_charts_core48.string,legendItemName:import_ag_charts_core48.string},{ThemeConstants:{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE4}}=import_ag_charts_community132._ModuleSupport,RadarAreaModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radar-area",moduleFactory:e=>new RadarAreaSeries(e),defaultAxes:[{type:POLAR_AXIS_TYPE4.ANGLE_CATEGORY},{type:POLAR_AXIS_TYPE4.RADIUS_NUMBER}],themeTemplate:RADAR_AREA_SERIES_THEME},RadarAreaSeriesModule={type:"series",name:"radar-area",chartType:"polar",enterprise:!0,options:radarAreaSeriesOptionsDef,create:e=>new RadarAreaSeries(e)},import_ag_charts_community135=require("ag-charts-community"),import_ag_charts_community133=require("ag-charts-community"),{HighlightState:HighlightState5,PointerEvents:PointerEvents11,toHighlightString:toHighlightString6}=import_ag_charts_community133._ModuleSupport,RadarLineSeries=class extends RadarSeries{constructor(){super(...arguments),this.properties=new RadarSeriesProperties}updatePathSelections(){this.lineSelection.update(this.visible?[!0]:[])}updatePathNodes(){const e=this.getLineNode();if(!e)return;const t=this.getPathNodesStyle(),{strokeWidth:i,stroke:s,strokeOpacity:a,lineDash:o,lineDashOffset:r,opacity:n}=t;e.setProperties({fill:void 0,lineJoin:"round",lineCap:"round",pointerEvents:PointerEvents11.None,opacity:n,stroke:s,strokeWidth:i,strokeOpacity:a,lineDash:o,lineDashOffset:r})}makeStylerParams(e,t){const{properties:i}=this,s=toHighlightString6(t??HighlightState5.None);return{marker:{fill:i.marker.fill,fillOpacity:i.marker.fillOpacity,size:i.marker.size,shape:i.marker.shape,stroke:i.marker.stroke,strokeOpacity:i.marker.strokeOpacity,strokeWidth:i.marker.strokeWidth,lineDash:i.marker.lineDash,lineDashOffset:i.marker.lineDashOffset},highlightState:s,highlighted:e,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,seriesId:this.id,stroke:i.stroke,strokeOpacity:i.strokeOpacity,strokeWidth:i.strokeWidth,angleKey:i.angleKey,radiusKey:i.radiusKey}}getStyle(e,t){const{marker:i,lineDash:s,lineDashOffset:a,stroke:o,strokeOpacity:r,strokeWidth:n}=this.properties,{size:l,shape:c,fill:h="transparent",fillOpacity:p}=i,u=this.getStylerResult({},e,t);return u.marker??(u.marker={}),{lineDash:u.lineDash??s,lineDashOffset:u.lineDashOffset??a,stroke:u.stroke??o,strokeOpacity:u.strokeOpacity??r,strokeWidth:u.strokeWidth??n,marker:{enabled:u.marker.enabled??i.enabled,fill:u.marker.fill??h,fillOpacity:u.marker.fillOpacity??p,shape:u.marker.shape??c,size:u.marker.size??l,lineDash:u.marker.lineDash??i.lineDash??s,lineDashOffset:u.marker.lineDashOffset??i.lineDashOffset??a,stroke:u.marker.stroke??i.stroke??o,strokeOpacity:u.marker.strokeOpacity??i.strokeOpacity??r,strokeWidth:u.marker.strokeWidth??i.strokeWidth??n}}}};RadarLineSeries.className="RadarLineSeries",RadarLineSeries.type="radar-line";var import_ag_charts_community134=require("ag-charts-community"),import_ag_charts_core49=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs18,radarLineSeriesThemeableOptionsDef}=import_ag_charts_community134._ModuleSupport,radarLineSeriesOptionsDef={...commonSeriesOptionsDefs18,...radarLineSeriesThemeableOptionsDef,type:(0,import_ag_charts_core49.required)((0,import_ag_charts_core49.constant)("radar-line")),angleKey:(0,import_ag_charts_core49.required)(import_ag_charts_core49.string),radiusKey:(0,import_ag_charts_core49.required)(import_ag_charts_core49.string),angleName:import_ag_charts_core49.string,radiusName:import_ag_charts_core49.string,legendItemName:import_ag_charts_core49.string},{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE5}=import_ag_charts_community135._ModuleSupport.ThemeConstants,RadarLineModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radar-line",moduleFactory:e=>new RadarLineSeries(e),defaultAxes:[{type:POLAR_AXIS_TYPE5.ANGLE_CATEGORY},{type:POLAR_AXIS_TYPE5.RADIUS_NUMBER}],themeTemplate:RADAR_LINE_SERIES_THEME},RadarLineSeriesModule={type:"series",name:"radar-line",chartType:"polar",enterprise:!0,options:radarLineSeriesOptionsDef,create:e=>new RadarLineSeries(e)},import_ag_charts_community141=require("ag-charts-community"),import_ag_charts_community138=require("ag-charts-community"),import_ag_charts_core50=require("ag-charts-core");function readDatum(e){return typeof e?.datum=="object"?e.datum:null}var import_ag_charts_community136=require("ag-charts-community"),{SeriesProperties:SeriesProperties11,makeSeriesTooltip:makeSeriesTooltip20,Property:Property34,Label:Label13}=import_ag_charts_community136._ModuleSupport,RadialBarSeriesProperties=class extends SeriesProperties11{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.label=new Label13,this.tooltip=makeSeriesTooltip20()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r,cornerRadius:n}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r,cornerRadius:n,opacity:1}}};__decorateClass([Property34],RadialBarSeriesProperties.prototype,"angleKey",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"radiusKey",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"angleName",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"radiusName",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"legendItemName",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"fill",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"stroke",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"lineDash",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"styler",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"rotation",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"stackGroup",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"normalizedTo",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"label",2),__decorateClass([Property34],RadialBarSeriesProperties.prototype,"tooltip",2);var import_ag_charts_community137=require("ag-charts-community"),{SectorBox:SectorBox3,motion:motion9}=import_ag_charts_community137._ModuleSupport;function fixRadialBarAnimationStatus(e,t,i){if(i==="updated"){if(e.previousDatum==null||Number.isNaN(e.previousDatum.innerRadius)||Number.isNaN(e.previousDatum.outerRadius))return"added";if(Number.isNaN(t.innerRadius)||Number.isNaN(t.outerRadius))return"removed"}return i==="added"&&e.previousDatum!=null?"updated":i}function prepareRadialBarSeriesAnimationFunctions(e){return{toFn:(s,a,o)=>{let r,n,l,c,h;return o==="removed"?(r=e,n=e,l=a.innerRadius,c=a.outerRadius,h=new SectorBox3(r,n,l,c)):(r=a.startAngle,n=a.endAngle,l=Number.isNaN(a.innerRadius)?s.innerRadius:a.innerRadius,c=Number.isNaN(a.outerRadius)?s.outerRadius:a.outerRadius,h=a.clipSector),{startAngle:r,endAngle:n,innerRadius:l,outerRadius:c,clipSector:h}},fromFn:(s,a,o)=>{o=fixRadialBarAnimationStatus(s,a,o);let r,n,l,c,h;o==="removed"||o==="updated"?(r=s.startAngle,n=s.endAngle,l=s.innerRadius,c=s.outerRadius,h=s.clipSector):(r=e,n=e,l=a.innerRadius,c=a.outerRadius),h??(h=new SectorBox3(r,n,l,c));const p=motion9.NODE_UPDATE_STATE_TO_PHASE_MAPPING[o];return{startAngle:r,endAngle:n,innerRadius:l,outerRadius:c,clipSector:h,phase:p}}}}function resetRadialBarSelectionsFn(e,t){return{centerX:0,centerY:0,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,clipSector:t.clipSector}}var{DEFAULT_POLAR_DIRECTION_KEYS:DEFAULT_POLAR_DIRECTION_KEYS3,DEFAULT_POLAR_DIRECTION_NAMES:DEFAULT_POLAR_DIRECTION_NAMES3,ChartAxisDirection:ChartAxisDirection19,PolarAxis:PolarAxis3,diff:diff7,groupAccumulativeValueProperty:groupAccumulativeValueProperty2,keyProperty:keyProperty9,normaliseGroupTo:normaliseGroupTo2,valueProperty:valueProperty15,fixNumericExtent:fixNumericExtent9,resetLabelFn:resetLabelFn6,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation8,seriesLabelFadeOutAnimation:seriesLabelFadeOutAnimation2,animationValidation:animationValidation9,angleBetween:angleBetween3,createDatumId:createDatumId18,CategoryScale:CategoryScale4,Sector:Sector5,SectorBox:SectorBox4,motion:motion10,isGradientFill:isGradientFill3,applyShapeStyle:applyShapeStyle16,updateLabelNode:updateLabelNode8,getItemStyles:getItemStyles4}=import_ag_charts_community138._ModuleSupport,RadialBarSeriesNodeEvent=class extends import_ag_charts_community138._ModuleSupport.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey}},RadialBarSeries=class extends import_ag_charts_community138._ModuleSupport.PolarSeries{constructor(e){super({moduleCtx:e,categoryKey:"radiusValue",propertyKeys:DEFAULT_POLAR_DIRECTION_KEYS3,propertyNames:DEFAULT_POLAR_DIRECTION_NAMES3,canHaveAxes:!0,animationResetFns:{item:resetRadialBarSelectionsFn,label:resetLabelFn6}}),this.properties=new RadialBarSeriesProperties,this.NodeEvent=RadialBarSeriesNodeEvent,this.groupScale=new CategoryScale4,this.circleCache={r:0,cx:0,cy:0}}get hasData(){return this.getHasData("angleValue-raw")}nodeFactory(){return new Sector5}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===ChartAxisDirection19.Angle){const s=t.getDomain(this,"angleValue-end","value",i),a=[Math.min(s[0],0),Math.max(s[1],0)];return fixNumericExtent9(a)}else return t.getDomain(this,"radiusValue","key",i)}async processData(e){const{angleKey:t,radiusKey:i,normalizedTo:s}=this.properties,a=!this.ctx.animationManager.isSkipped(),o=this.getStackId(),r=`${o}-trailing`,n=[];(0,import_ag_charts_core50.isDefined)(s)&&n.push(normaliseGroupTo2([o,r],Math.abs(s))),a&&(this.processedData&&n.push(diff7(this.id,this.processedData)),n.push(animationValidation9()));const l=this.visible?{}:{forceValue:0},c=this.axes[ChartAxisDirection19.Radius]?.scale.type,h=this.axes[ChartAxisDirection19.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[keyProperty9(i,c,{id:"radiusValue"}),valueProperty15(t,h,{id:"angleValue-raw",invalidValue:null,...l}),...groupAccumulativeValueProperty2(t,"normal",{id:"angleValue-end",rangeId:"angleValue-range",invalidValue:null,groupId:o,separateNegative:!0,...l},h),...groupAccumulativeValueProperty2(t,"trailing",{id:"angleValue-start",invalidValue:null,groupId:r,separateNegative:!0,...l},h),...n],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,s=this.circleCache;return e===s.r&&t===s.cx&&i===s.cy?!1:(this.circleCache={r:e,cx:t,cy:i},!0)}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}getAxisInnerRadius(){const e=this.axes[ChartAxisDirection19.Radius];return e instanceof PolarAxis3?this.radius*e.innerRadiusRatio:0}createNodeData(){const{processedData:e,dataModel:t}=this;if(!t||!e||e.type!=="grouped")return;const i=this.axes[ChartAxisDirection19.Angle],s=this.axes[ChartAxisDirection19.Radius],a=i?.scale,o=s?.scale;if(!a||!o)return;const r=t.resolveKeysById(this,"radiusValue",e),n=t.resolveColumnById(this,"angleValue-start",e),l=t.resolveColumnById(this,"angleValue-end",e),c=t.resolveColumnById(this,"angleValue-raw",e),h=t.resolveProcessedDataIndexById(this,"angleValue-range");let p=0;s instanceof RadiusCategoryAxis&&(p=s.groupPaddingInner);const{groupScale:u}=this,{index:g,visibleGroupCount:d}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);u.domain=Array.from({length:d}).map((N,I)=>String(I)),u.range=[0,Math.abs(o.bandwidth??0)],u.paddingInner=d>1?p:0;const m=u.bandwidth>=1?u.bandwidth:u.rawBandwidth,y=i.isReversed(),f=s.isReversed(),S=f?this.radius:this.getAxisInnerRadius(),x=(f?this.getAxisInnerRadius():this.radius)+S,v=this.getSeriesDomain(ChartAxisDirection19.Angle),{angleKey:_,radiusKey:D,angleName:k,radiusName:A,legendItemName:L,label:R}=this.properties,O=(N,I,P,F)=>{const E=this.getLabelText(I,N,_,"angle",v,R,{value:I,datum:N,angleKey:_,radiusKey:D,angleName:k,radiusName:A,legendItemName:L});if(E)return{x:P,y:F,text:E,textAlign:"center",textBaseline:"middle"}},B=[],C=getItemStyles4((N,I,P)=>getItemStyle(this,N,I,P)),w={itemId:D,nodeData:B,labelData:B,styles:C};if(!this.visible)return w;const{dataSources:M}=e,T=M.get(this.id)?.data??[];for(const{datumIndex:N,group:I}of t.forEachGroupDatum(this,e)){const P=T[N],F=r[N];if(F==null)return;const E=c[N],G=n[N],K=l[N],V=E>=0&&!Object.is(E,-0),W=I.aggregation[h][V?1:0],z=V===y;let Y=a.convert(G,{clamp:!0}),q=a.convert(K,{clamp:!0}),$=a.convert(0,{clamp:!0}),U=a.convert(W,{clamp:!0});z&&([$,U]=[U,$],[Y,q]=[q,Y]);const H=x-o.convert(F)+u.convert(String(g)),te=H+m,Z=(H+te)/2,X=Y+angleBetween3(Y,q)/2,Q=Math.cos(X)*Z,J=Math.sin(X)*Z,ie=this.properties.label.enabled?O(P,E,Q,J):void 0,ee=new SectorBox4(Y,q,H,te);B.push({series:this,datum:P,datumIndex:N,point:{x:Q,y:J,size:0},midPoint:{x:Q,y:J},label:ie,angleValue:E,radiusValue:F,innerRadius:H,outerRadius:te,startAngle:$,endAngle:U,clipSector:ee,reversed:z,index:N})}return w}update({seriesRect:e}){const t=this.checkResize(e);this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updateSectorSelection(this.itemSelection,!1),this.updateSectorSelection(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updateSectorSelection(e,t){let i=[];const s=this.ctx.highlightManager?.getActiveHighlight();t?s?.datum&&s.series===this&&i.push(s):i=this.nodeData;const{contextNodeData:a}=this;if(!a)return;const o=this.ctx.highlightManager.getActiveHighlight(),r=this.getShapeFillBBox(),n=this.hasItemStylers();e.update(i,void 0,l=>this.getDatumId(l)).each((l,c)=>{const h=readDatum(c);if(h==null)return;if(n){const m=this.getHighlightState(s,t,c.datumIndex);c.style=getItemStyle(this,c,t,m)}const p=c.style??a.styles[this.getHighlightState(o,t,c.datumIndex)],u=p.cornerRadius,g=p.fill,d=import_ag_charts_community138._ModuleSupport.isGradientFill(g)&&g.bounds!=="item"?{centerX:0,centerY:0}:void 0;applyShapeStyle16(l,p,r,d),l.lineJoin="round",l.inset=l.stroke==null?0:l.strokeWidth/2,l.startInnerCornerRadius=h.reversed?u:0,l.startOuterCornerRadius=h.reversed?u:0,l.endInnerCornerRadius=h.reversed?0:u,l.endOuterCornerRadius=h.reversed?0:u,t&&(l.startAngle=c.startAngle,l.endAngle=c.endAngle,l.clipSector=c.clipSector,l.innerRadius=c.innerRadius,l.outerRadius=c.outerRadius)})}updateLabels(){const{properties:e}=this,t=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((i,s)=>{updateLabelNode8(this,i,e,e.label,s.label,!1,t),i.fillOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1})}getBarTransitionFunctions(){const e=this.axes[ChartAxisDirection19.Angle]?.scale;let t=0;if(!e)return prepareRadialBarSeriesAnimationFunctions(t);const i=Math.min(e.domain[0],e.domain[1]),s=Math.max(e.domain[0],e.domain[1]);return i<=0&&s>=0&&(t=e.convert(0)),prepareRadialBarSeriesAnimationFunctions(t)}animateEmptyUpdateReady(){const{labelSelection:e}=this,t=this.getBarTransitionFunctions();motion10.fromToMotion(this.id,"datums",this.ctx.animationManager,[this.itemSelection],t),seriesLabelFadeInAnimation8(this,"labels",this.ctx.animationManager,e)}animateClearingUpdateEmpty(){const{itemSelection:e}=this,{animationManager:t}=this.ctx,i=this.getBarTransitionFunctions();motion10.fromToMotion(this.id,"datums",t,[e],i),seriesLabelFadeOutAnimation2(this,"labels",t,this.labelSelection)}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:a,properties:o}=this,{angleKey:r,angleName:n,radiusKey:l,radiusName:c,legendItemName:h,tooltip:p}=o,u=a[ChartAxisDirection19.Angle],g=a[ChartAxisDirection19.Radius],d=this.nodeData?.[e];if(!i||!s||!u||!g||!d)return;const m=s.dataSources.get(this.id)?.data[e],y=i.resolveKeysById(this,"radiusValue",s)[e],f=i.resolveColumnById(this,"angleValue-raw",s)[e];if(y==null)return;const S=getItemStyle(this,d,!1);return this.formatTooltipWithContext(p,{heading:this.getAxisValueText(g,"tooltip",y,m,l,void 0),symbol:this.legendItemSymbol(),data:[{label:n,fallbackLabel:r,value:this.getAxisValueText(u,"tooltip",f,m,r,void 0)}]},{seriesId:t,datum:m,title:n,angleKey:r,angleName:n,radiusKey:l,radiusName:c,legendItemName:h,...S})}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.itemSelection.nodes())}legendItemSymbol(){const{fill:e,stroke:t,fillOpacity:i,strokeOpacity:s,strokeWidth:a,lineDash:o,lineDashOffset:r}=getStyle(this,!1,!1,import_ag_charts_community138._ModuleSupport.HighlightState.None),n={fill:e??"rgba(0, 0, 0, 0)",stroke:t??"rgba(0, 0, 0, 0)",fillOpacity:i,strokeOpacity:s,strokeWidth:a,lineDash:o,lineDashOffset:r};return isGradientFill3(n.fill)&&(n.fill={...n.fill,gradient:"linear",rotation:0,reverse:!1}),{marker:n}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{angleKey:s,angleName:a,legendItemName:o,showInLegend:r}=this.properties;return[{legendType:"category",id:t,itemId:s,seriesId:t,enabled:i,label:{text:o??a??s},symbol:this.legendItemSymbol(),legendItemName:o,hideInLegend:!r}]}getDatumId(e){return createDatumId18(e.radiusValue)}computeLabelsBBox(){return null}getStackId(){return`radialBar-stack-${this.seriesGrouping?.groupIndex??this.id}-xValues`}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};RadialBarSeries.className="RadialBarSeries",RadialBarSeries.type="radial-bar";var import_ag_charts_community139=require("ag-charts-community"),import_ag_charts_core51=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs19,radialBarSeriesThemeableOptionsDef}=import_ag_charts_community139._ModuleSupport,radialBarSeriesOptionsDef={...commonSeriesOptionsDefs19,...radialBarSeriesThemeableOptionsDef,type:(0,import_ag_charts_core51.required)((0,import_ag_charts_core51.constant)("radial-bar")),angleKey:(0,import_ag_charts_core51.required)(import_ag_charts_core51.string),radiusKey:(0,import_ag_charts_core51.required)(import_ag_charts_core51.string),angleName:import_ag_charts_core51.string,radiusName:import_ag_charts_core51.string,legendItemName:import_ag_charts_core51.string,grouped:import_ag_charts_core51.boolean,stacked:import_ag_charts_core51.boolean,stackGroup:import_ag_charts_core51.string,normalizedTo:import_ag_charts_core51.number},import_ag_charts_community140=require("ag-charts-community"),{ThemeConstants:{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE6},FILL_GRADIENT_CONIC_SERIES_DEFAULTS,FILL_IMAGE_DEFAULTS:FILL_IMAGE_DEFAULTS5,FILL_PATTERN_DEFAULTS:FILL_PATTERN_DEFAULTS3}=import_ag_charts_community140._ModuleSupport,RADIAL_BAR_SERIES_THEME={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",FILL_GRADIENT_CONIC_SERIES_DEFAULTS],["image",FILL_IMAGE_DEFAULTS5],["pattern",FILL_PATTERN_DEFAULTS3]]},stroke:{$palette:"stroke"},strokeWidth:{$isUserOption:["./stroke",1,0]},label:{...import_ag_charts_community140._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},highlight:import_ag_charts_community140._ModuleSupport.multiSeriesHighlightStyle()},axes:{[POLAR_AXIS_TYPE6.RADIUS_CATEGORY]:{innerRadiusRatio:.2,groupPaddingInner:.2,paddingInner:.2,paddingOuter:.1}}},{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE7}=import_ag_charts_community141._ModuleSupport.ThemeConstants,RadialBarModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radial-bar",moduleFactory:e=>new RadialBarSeries(e),defaultAxes:[{type:POLAR_AXIS_TYPE7.ANGLE_NUMBER},{type:POLAR_AXIS_TYPE7.RADIUS_CATEGORY}],themeTemplate:RADIAL_BAR_SERIES_THEME,stackable:!0,groupable:!0},RadialBarSeriesModule={type:"series",name:"radial-bar",chartType:"polar",enterprise:!0,options:radialBarSeriesOptionsDef,create:e=>new RadialBarSeries(e)},import_ag_charts_community146=require("ag-charts-community"),import_ag_charts_community143=require("ag-charts-community"),import_ag_charts_community142=require("ag-charts-community"),{Property:Property35}=import_ag_charts_community142._ModuleSupport,RadialColumnSeriesProperties=class extends RadialColumnSeriesBaseProperties{};__decorateClass([Property35],RadialColumnSeriesProperties.prototype,"columnWidthRatio",2),__decorateClass([Property35],RadialColumnSeriesProperties.prototype,"maxColumnWidthRatio",2);var{ChartAxisDirection:ChartAxisDirection20,PolarAxis:PolarAxis4,RadialColumnShape,getRadialColumnWidth}=import_ag_charts_community143._ModuleSupport,RadialColumnSeries=class extends RadialColumnSeriesBase{constructor(e){super(e,{animationResetFns:{item:resetRadialColumnSelectionFn}}),this.properties=new RadialColumnSeriesProperties}getStackId(){return`radarColumn-stack-${this.seriesGrouping?.groupIndex??this.id}-yValues`}nodeFactory(){return new RadialColumnShape}getColumnTransitionFunctions(){const e=this.isRadiusAxisReversed()?this.radius:this.getAxisInnerRadius();return prepareRadialColumnAnimationFunctions(e)}isRadiusAxisCircle(){const e=this.axes[ChartAxisDirection20.Radius];return e instanceof PolarAxis4?e.shape==="circle":!1}updateItemPath(e,t,i){e.isBeveled=this.isRadiusAxisCircle(),e.isRadiusAxisReversed=this.isRadiusAxisReversed(),i&&(e.innerRadius=t.innerRadius,e.outerRadius=t.outerRadius,e.startAngle=t.startAngle,e.endAngle=t.endAngle,e.columnWidth=t.columnWidth,e.axisInnerRadius=t.axisInnerRadius,e.axisOuterRadius=t.axisOuterRadius)}getColumnWidth(e,t){const{columnWidthRatio:i=.5,maxColumnWidthRatio:s=.5}=this.properties;return getRadialColumnWidth(e,t,this.radius,i,s)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};RadialColumnSeries.className="RadialColumnSeries",RadialColumnSeries.type="radial-column";var import_ag_charts_community144=require("ag-charts-community"),import_ag_charts_core52=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs20,radialColumnSeriesThemeableOptionsDef}=import_ag_charts_community144._ModuleSupport,radialColumnSeriesOptionsDef={...commonSeriesOptionsDefs20,...radialColumnSeriesThemeableOptionsDef,type:(0,import_ag_charts_core52.required)((0,import_ag_charts_core52.constant)("radial-column")),angleKey:(0,import_ag_charts_core52.required)(import_ag_charts_core52.string),radiusKey:(0,import_ag_charts_core52.required)(import_ag_charts_core52.string),angleName:import_ag_charts_core52.string,radiusName:import_ag_charts_core52.string,legendItemName:import_ag_charts_core52.string,grouped:import_ag_charts_core52.boolean,stacked:import_ag_charts_core52.boolean,stackGroup:import_ag_charts_core52.string,normalizedTo:import_ag_charts_core52.number},import_ag_charts_community145=require("ag-charts-community"),{ThemeConstants:{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE8,POLAR_AXIS_SHAPE:POLAR_AXIS_SHAPE2},FILL_GRADIENT_RADIAL_SERIES_DEFAULTS:FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2,FILL_IMAGE_DEFAULTS:FILL_IMAGE_DEFAULTS6,FILL_PATTERN_DEFAULTS:FILL_PATTERN_DEFAULTS4}=import_ag_charts_community145._ModuleSupport,RADIAL_COLUMN_SERIES_THEME={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2],["image",FILL_IMAGE_DEFAULTS6],["pattern",FILL_PATTERN_DEFAULTS4]]},stroke:{$palette:"stroke"},columnWidthRatio:.5,maxColumnWidthRatio:.5,strokeWidth:{$isUserOption:["./stroke",1,0]},label:{...import_ag_charts_community145._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:import_ag_charts_community145._ModuleSupport.multiSeriesHighlightStyle()},axes:{[POLAR_AXIS_TYPE8.ANGLE_CATEGORY]:{shape:{$findFirstSiblingNotOperation:POLAR_AXIS_SHAPE2.CIRCLE},groupPaddingInner:0,paddingInner:0,label:{spacing:10}},[POLAR_AXIS_TYPE8.RADIUS_NUMBER]:{shape:{$findFirstSiblingNotOperation:POLAR_AXIS_SHAPE2.CIRCLE},innerRadiusRatio:.5}}},{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE9}=import_ag_charts_community146._ModuleSupport.ThemeConstants,RadialColumnModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radial-column",moduleFactory:e=>new RadialColumnSeries(e),defaultAxes:[{type:POLAR_AXIS_TYPE9.ANGLE_CATEGORY},{type:POLAR_AXIS_TYPE9.RADIUS_NUMBER}],themeTemplate:RADIAL_COLUMN_SERIES_THEME,stackable:!0,groupable:!0},RadialColumnSeriesModule={type:"series",name:"radial-column",chartType:"polar",enterprise:!0,options:radialColumnSeriesOptionsDef,create:e=>new RadialColumnSeries(e)},import_ag_charts_community151=require("ag-charts-community"),import_ag_charts_community150=require("ag-charts-community"),import_ag_charts_core54=require("ag-charts-core"),import_ag_charts_community147=require("ag-charts-community"),{SvgPath,Rotatable,Translatable,Scalable:Scalable2}=import_ag_charts_community147._ModuleSupport,RadialGaugeNeedle=class extends Rotatable(Scalable2(Translatable(SvgPath))){constructor(){super(...arguments),this.scalingCenterX=.5,this.scalingCenterY=.5,this.rotationCenterX=.5,this.rotationCenterY=.5}};RadialGaugeNeedle.defaultPathData="M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z";var import_ag_charts_community148=require("ag-charts-community"),{getColorStops:getColorStops2,normalizeAngle360:normalizeAngle3606,normalizeAngle360Inclusive:normalizeAngle360Inclusive2,toDegrees}=import_ag_charts_community148._ModuleSupport,{BaseProperties:BaseProperties11,makeSeriesTooltip:makeSeriesTooltip21,SeriesProperties:SeriesProperties12,PropertiesArray:PropertiesArray3,AxisLabel:AxisLabel4,Property:Property36,Label:Label14}=import_ag_charts_community148._ModuleSupport,RadialGaugeDefaultTargetLabelProperties=class extends Label14{};__decorateClass([Property36],RadialGaugeDefaultTargetLabelProperties.prototype,"spacing",2);var RadialGaugeTargetProperties=class extends BaseProperties11{constructor(){super(...arguments),this.label=new RadialGaugeDefaultTargetLabelProperties}getStyle(){const{fill:e="black",fillOpacity:t=1,stroke:i="black",strokeWidth:s=0,strokeOpacity:a=1,lineDash:o=[0],lineDashOffset:r=0}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:a,lineDash:o,lineDashOffset:r}}};__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"text",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"value",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"shape",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"placement",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"spacing",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"size",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"rotation",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"fill",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"fillOpacity",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"stroke",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"strokeWidth",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"strokeOpacity",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"lineDash",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"lineDashOffset",2),__decorateClass([Property36],RadialGaugeTargetProperties.prototype,"label",2);var RadialGaugeBarProperties=class extends BaseProperties11{constructor(){super(...arguments),this.enabled=!0,this.fills=new PropertiesArray3(import_ag_charts_community148._ModuleSupport.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t){const{enabled:i,fill:s,fills:a,fillMode:o,fillOpacity:r,stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}=this;return{fill:i?s??createConicGradient(a,o,e,t):"none",fillOpacity:r,stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}}};__decorateClass([Property36],RadialGaugeBarProperties.prototype,"enabled",2),__decorateClass([Property36],RadialGaugeBarProperties.prototype,"fills",2),__decorateClass([Property36],RadialGaugeBarProperties.prototype,"fillMode",2),__decorateClass([Property36],RadialGaugeBarProperties.prototype,"fill",2),__decorateClass([Property36],RadialGaugeBarProperties.prototype,"fillOpacity",2),__decorateClass([Property36],RadialGaugeBarProperties.prototype,"stroke",2),__decorateClass([Property36],RadialGaugeBarProperties.prototype,"strokeWidth",2),__decorateClass([Property36],RadialGaugeBarProperties.prototype,"strokeOpacity",2),__decorateClass([Property36],RadialGaugeBarProperties.prototype,"lineDash",2),__decorateClass([Property36],RadialGaugeBarProperties.prototype,"lineDashOffset",2);var RadialGaugeScaleIntervalProperties=class extends BaseProperties11{constructor(){super(...arguments),this.values=void 0,this.step=void 0,this.minSpacing=0,this.maxSpacing=1e3}};__decorateClass([Property36],RadialGaugeScaleIntervalProperties.prototype,"values",2),__decorateClass([Property36],RadialGaugeScaleIntervalProperties.prototype,"step",2),__decorateClass([Property36],RadialGaugeScaleIntervalProperties.prototype,"minSpacing",2),__decorateClass([Property36],RadialGaugeScaleIntervalProperties.prototype,"maxSpacing",2);var RadialGaugeScaleLabelProperties=class extends AxisLabel4{},RadialGaugeScaleProperties=class extends BaseProperties11{constructor(){super(...arguments),this.min=0,this.max=1,this.fills=new PropertiesArray3(import_ag_charts_community148._ModuleSupport.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.defaultFill="black",this.interval=new RadialGaugeScaleIntervalProperties,this.label=new RadialGaugeScaleLabelProperties}getStyle(e,t,i){const{fill:s,fills:a,defaultFill:o,fillMode:r,fillOpacity:n,stroke:l,strokeWidth:c,strokeOpacity:h,lineDash:p,lineDashOffset:u}=this;return{fill:s??(e&&a.length===0?o:void 0)??createConicGradient(a,r,t,i),fillOpacity:n,stroke:l,strokeWidth:c,strokeOpacity:h,lineDash:p,lineDashOffset:u}}};__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"min",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"max",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"fills",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"fillMode",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"fill",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"fillOpacity",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"stroke",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"strokeWidth",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"strokeOpacity",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"lineDash",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"lineDashOffset",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"defaultFill",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"interval",2),__decorateClass([Property36],RadialGaugeScaleProperties.prototype,"label",2);var RadialGaugeNeedleProperties=class extends BaseProperties11{constructor(){super(...arguments),this.enabled=!0,this.spacing=0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};__decorateClass([Property36],RadialGaugeNeedleProperties.prototype,"enabled",2),__decorateClass([Property36],RadialGaugeNeedleProperties.prototype,"radiusRatio",2),__decorateClass([Property36],RadialGaugeNeedleProperties.prototype,"spacing",2),__decorateClass([Property36],RadialGaugeNeedleProperties.prototype,"fill",2),__decorateClass([Property36],RadialGaugeNeedleProperties.prototype,"fillOpacity",2),__decorateClass([Property36],RadialGaugeNeedleProperties.prototype,"stroke",2),__decorateClass([Property36],RadialGaugeNeedleProperties.prototype,"strokeWidth",2),__decorateClass([Property36],RadialGaugeNeedleProperties.prototype,"strokeOpacity",2),__decorateClass([Property36],RadialGaugeNeedleProperties.prototype,"lineDash",2),__decorateClass([Property36],RadialGaugeNeedleProperties.prototype,"lineDashOffset",2);var RadialGaugeLabelProperties=class extends AutoSizedLabel{};__decorateClass([Property36],RadialGaugeLabelProperties.prototype,"text",2);var RadialGaugeSecondaryLabelProperties=class extends AutoSizedSecondaryLabel{};__decorateClass([Property36],RadialGaugeSecondaryLabelProperties.prototype,"text",2);var RadialGaugeSeriesProperties=class extends SeriesProperties12{constructor(){super(...arguments),this.startAngle=0,this.endAngle=0,this.segmentation=new GaugeSegmentationProperties,this.defaultColorRange=[],this.targets=new PropertiesArray3(RadialGaugeTargetProperties),this.defaultTarget=new RadialGaugeTargetProperties,this.outerRadiusRatio=1,this.innerRadiusRatio=1,this.cornerRadius=0,this.cornerMode="container",this.spacing=0,this.scale=new RadialGaugeScaleProperties,this.bar=new RadialGaugeBarProperties,this.needle=new RadialGaugeNeedleProperties,this.label=new RadialGaugeLabelProperties,this.secondaryLabel=new RadialGaugeSecondaryLabelProperties,this.tooltip=makeSeriesTooltip21()}};__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"value",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"startAngle",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"endAngle",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"segmentation",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"defaultColorRange",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"targets",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"defaultTarget",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"outerRadiusRatio",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"innerRadiusRatio",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"outerRadius",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"innerRadius",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"cornerMode",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"spacing",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"scale",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"bar",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"needle",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"label",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"secondaryLabel",2),__decorateClass([Property36],RadialGaugeSeriesProperties.prototype,"tooltip",2);function createConicGradient(e,t,i,s){const{domain:a,range:o}=s,[r,n]=o,l=normalizeAngle3606((r+n)/2+Math.PI),c=normalizeAngle360Inclusive2(n-r);return{type:"gradient",gradient:"conic",colorSpace:"oklch",colorStops:getColorStops2(e,i,a,t).map(({color:p,stop:u})=>(u=Math.min(Math.max(u,0),1),u=(r+c*u-l)/(2*Math.PI),u=(u%1+1)%1,{stop:u,color:p})),bounds:"series",rotation:toDegrees(l)+90}}var import_ag_charts_community149=require("ag-charts-community"),import_ag_charts_core53=require("ag-charts-core"),{SectorBox:SectorBox5}=import_ag_charts_community149._ModuleSupport;function computeClipSector(e){const{startAngle:t,endAngle:i,clipStartAngle:s,clipEndAngle:a,innerRadius:o,outerRadius:r}=e;if(!(s==null||a==null))return new SectorBox5(Math.max(s,t),Math.min(a,i),o,r)}function clipSectorVisibility(e,t,i){return Math.max(e,i.startAngle)<=Math.min(t,i.endAngle)}function hasClipSector(e){return e.clipStartAngle!=null&&e.clipEndAngle!=null}function datumClipSector(e,t){const{clipStartAngle:i,clipEndAngle:s,innerRadius:a,outerRadius:o}=e;return new SectorBox5(i,t?i:s,a,o)}function prepareRadialGaugeSeriesAnimationFunctions(e,t){const i=e?"initial":"update";return{node:{fromFn(o,r){const n=o.previousDatum;let{startAngle:l,endAngle:c}=n??r;const h=n!=null&&hasClipSector(n)?datumClipSector(n,e):void 0,p=hasClipSector(r)?datumClipSector(r,e):void 0;let u;return h!=null&&p!=null?u=h:h==null&&p!=null?(u=p,l=r.startAngle,c=r.endAngle):h!=null&&p==null?(u=void 0,l=r.startAngle,c=r.endAngle):e&&(c=l),{startAngle:l,endAngle:c,clipSector:u,phase:i}},toFn(o,r){const{startAngle:n,endAngle:l}=r;let c;return hasClipSector(r)&&(c=datumClipSector(r,!1)),{startAngle:n,endAngle:l,clipSector:c}},applyFn(o,r){const{startAngle:n,endAngle:l}=r;let{clipSector:c}=r;c!=null&&(c=new SectorBox5(Math.max(n,c.startAngle),Math.min(l,c.endAngle),c.innerRadius,c.outerRadius));const h=c==null||clipSectorVisibility(n,l,c);o.startAngle=n,o.endAngle=l,o.clipSector=c,o.visible=h}},needle:{fromFn(o){let{angle:r}=o.previousDatum??o.datum;return e&&(r=t),{rotation:r,phase:i}},toFn(o,r){const{angle:n}=r;return{rotation:n}}}}}function resetRadialGaugeSeriesResetSectorFunction(e,t){const{startAngle:i,endAngle:s}=t,a=computeClipSector(t),o=a==null||clipSectorVisibility(i,s,a);return{startAngle:i,endAngle:s,clipSector:a,visible:o}}function resetRadialGaugeSeriesResetNeedleFunction(e,t){const{angle:i}=t;return{rotation:i}}var verticalAlignFactors3={top:0,middle:.5,bottom:1};function formatRadialGaugeLabels(e,t,i,s,a,o){const{padding:r,textAlign:n,verticalAlign:l}=s;let c,h;if(i.each((v,_)=>{_.label==="primary"?c=_:_.label==="secondary"&&(h=_)}),c==null)return;const p=getLabelText(e.id,t,c,o?.label);if(p==null)return;const u=h==null?void 0:getLabelText(e.id,t,h,o?.secondaryLabel),g={padding:r},d=n==="center"?2:1,m=l==="middle"?2:1,y=v=>({width:Math.sqrt(Math.max(a**2-(v/m)**2,0))*d,height:Math.min(v,m*a),meta:null});let f,S,b;if(h!=null&&u!=null){const v=formatStackedLabels((0,import_ag_charts_core53.toPlainText)(p),c,(0,import_ag_charts_core53.toPlainText)(u),h,g,y);f=v?.label,S=v?.secondaryLabel,b=v?.height??0}else{const v=formatSingleLabel((0,import_ag_charts_core53.toPlainText)(p),c,g,y);f=v?.[0],S=void 0,b=v?.[0].height??0}const x=b*verticalAlignFactors3[l];i.each((v,_)=>{let D;if(_.label==="primary"?D=f:_.label==="secondary"&&(D=S),D==null){v.visible=!1;return}v.visible=!0,v.text=D.text,v.fontSize=D.fontSize,v.lineHeight=D.lineHeight,v.textAlign=n,v.textBaseline="middle";const k=_.label==="primary"?D.height/2:b-D.height/2;v.y=_.centerY+k-x,v.x=_.centerX})}var{fromToMotion:fromToMotion5,resetMotion:resetMotion4,SeriesNodePickMode:SeriesNodePickMode15,StateMachine:StateMachine4,createDatumId:createDatumId19,normalizeAngle360:normalizeAngle3607,normalizeAngle360Inclusive:normalizeAngle360Inclusive3,isBetweenAngles:isBetweenAngles2,sectorBox,toRadians:toRadians4,BBox:BBox14,Group:Group15,PointerEvents:PointerEvents12,Selection:Selection14,Sector:Sector6,SectorBox:SectorBox6,Text:Text7,Marker:Marker5,tickFormat:tickFormat2,applyShapeStyle:applyShapeStyle17,mergeDefaults:mergeDefaults17}=import_ag_charts_community150._ModuleSupport,targetPlacementRotation={inside:90,middle:0,outside:-90},outsideLabelPlacements=[{textAlign:"left",textBaseline:"top"},{textAlign:"right",textBaseline:"top"},{textAlign:"right",textBaseline:"bottom"},{textAlign:"left",textBaseline:"bottom"}],insideLabelPlacements=[{textAlign:"right",textBaseline:"bottom"},{textAlign:"left",textBaseline:"bottom"},{textAlign:"left",textBaseline:"top"},{textAlign:"right",textBaseline:"top"}],RadialGaugeSeries=class extends import_ag_charts_community150._ModuleSupport.Series{constructor(e){super({moduleCtx:e,pickModes:[SeriesNodePickMode15.EXACT_SHAPE_MATCH,SeriesNodePickMode15.NEAREST_NODE]}),this.centerX=0,this.centerY=0,this.radius=0,this.textAlign="center",this.verticalAlign="middle",this.properties=new RadialGaugeSeriesProperties,this.scale=new LinearAngleScale,this.scaleGroup=this.contentGroup.appendChild(new Group15({name:"scaleGroup"})),this.itemGroup=this.contentGroup.appendChild(new Group15({name:"itemGroup"})),this.itemNeedleGroup=this.contentGroup.appendChild(new Group15({name:"itemNeedleGroup"})),this.itemTargetGroup=this.contentGroup.appendChild(new Group15({name:"itemTargetGroup"})),this.itemTargetLabelGroup=this.contentGroup.appendChild(new Group15({name:"itemTargetLabelGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Group15({name:"itemLabelGroup"})),this.highlightTargetGroup=this.highlightGroup.appendChild(new Group15({name:"itemTargetLabelGroup"})),this.tickGroup=this.contentGroup.appendChild(new Group15({name:"tickGroup"})),this.scaleSelection=Selection14.select(this.scaleGroup,()=>this.nodeFactory()),this.datumSelection=Selection14.select(this.itemGroup,()=>this.nodeFactory()),this.needleSelection=Selection14.select(this.itemNeedleGroup,RadialGaugeNeedle),this.targetSelection=Selection14.select(this.itemTargetGroup,()=>this.markerFactory()),this.targetLabelSelection=Selection14.select(this.itemTargetLabelGroup,Text7),this.labelSelection=Selection14.select(this.itemLabelGroup,Text7),this.highlightTargetSelection=Selection14.select(this.highlightTargetGroup,()=>this.markerFactory()),this.tickSelection=Selection14.select(this.tickGroup,import_ag_charts_community150._ModuleSupport.TransformableText),this.datumUnion=new DatumUnion,this.animationState=new StateMachine4("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.animateReadyResize(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateWaitingUpdateReady()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty"},reset:"empty",skip:"ready"}}),this.scaleGroup.pointerEvents=PointerEvents12.None,this.tickGroup.pointerEvents=PointerEvents12.None,this.itemNeedleGroup.pointerEvents=PointerEvents12.None,this.itemLabelGroup.pointerEvents=PointerEvents12.None}get hasData(){return this.properties.value!=null}nodeFactory(){return new Sector6}markerFactory(){const e=new Marker5;return e.size=1,e}processData(){this.nodeDataRefresh=!0,this.animationState.transition("updateData")}formatLabel(e){const{min:t,max:i}=this.properties.scale;return formatLabel(e,{min:t,max:i})}layoutScale(){const{scale:e,properties:t}=this,{seriesRectWidth:i,seriesRectHeight:s}=this.nodeDataDependencies,{scale:a,outerRadius:o}=this.properties,{min:r,max:n,label:l,interval:c}=a,h=toRadians4(t.startAngle-90),p=toRadians4(t.endAngle-90),g=normalizeAngle360Inclusive3(p-h)>Math.PI,d=g||isBetweenAngles2(1.5*Math.PI,h,p),m=g||isBetweenAngles2(0*Math.PI,h,p),y=g||isBetweenAngles2(.5*Math.PI,h,p),f=g||isBetweenAngles2(1*Math.PI,h,p);let S;f&&!m?S="right":!f&&m?S="left":S="center";let b;d&&!y?b="bottom":!d&&y?b="top":b="middle";const x=sectorBox({startAngle:h,endAngle:p,innerRadius:0,outerRadius:.5}),v=-(x.x+x.width/2)*2,_=-(x.y+x.height/2)*2,D=Math.min(i/x.width,s/x.height);e.domain=[r,n],e.range=[h,p],e.arcLength=D/2;const{maxSpacing:k,minSpacing:A}=c,{arcLength:L}=e,R=k?Math.floor(L/k):1,O=A?Math.floor(L/A):1/0,B=Math.floor(4/Math.PI*Math.abs(e.range[0]-e.range[1])),C=Math.max(R,Math.min(O,B)),w=c.values??e.ticks({nice:!1,interval:c.step,minTickCount:R,maxTickCount:O,tickCount:C})?.ticks??[],M=tickFormat2(w,typeof l.format=="string"?l.format:void 0),T=(0,import_ag_charts_core54.cachedTextMeasurer)(l),N=w.map((K,V)=>{let W;if(l.formatter&&(W=formatWithContext(this.ctx,l.formatter,{value:K,index:V,domain:e.domain,boundSeries:void 0})),W??(W=M?.(K)),W==null)return;const{width:z,height:Y}=(0,import_ag_charts_core54.isArray)(W)?(0,import_ag_charts_core54.measureTextSegments)(W,l):T.measureLines(W);return{index:V,value:K,text:W,width:z,height:Y}}).filter(K=>K!=null),I=N.reduce((K,V)=>Math.max(K,V.width),0),P=N.reduce((K,V)=>Math.max(K,V.height),0),F=l.enabled?Math.max(I,P)+l.spacing:0,E=Math.max(.5*D-F,0),G=o??E;return this.centerX=i/2+v*G,this.centerY=s/2+_*G,this.radius=G,this.textAlign=S,this.verticalAlign=b,N}getShapeFillBBox(){const{centerX:e,centerY:t,radius:i}=this,s=new BBox14(e-i,t-i,2*i,2*i);return{series:s,axis:s}}getTargets(){const{properties:e}=this,t=e.defaultTarget;return Array.from(e.targets).map(i=>{const{text:s=t.text,value:a=t.value??0,shape:o=t.shape??"triangle",rotation:r=t.rotation??0,placement:n=t.placement??"middle",spacing:l=t.spacing??0,size:c=t.size??0}=i,{enabled:h=t.label.enabled,color:p=t.label.color??"black",fontStyle:u=t.label.fontStyle??"normal",fontWeight:g=t.label.fontWeight??"normal",fontSize:d=t.label.fontSize,fontFamily:m=t.label.fontFamily,spacing:y=t.label.spacing??0}=i.label;return{text:s,value:a,shape:o,placement:n,spacing:l,size:c,rotation:r,label:{enabled:h,color:p,fontStyle:u,fontWeight:g,fontSize:d,fontFamily:m,spacing:y},style:i.getStyle()}})}getTargetRadius(e){const{radius:t,properties:i}=this,{innerRadiusRatio:s,outerRadiusRatio:a}=i,{placement:o,spacing:r,size:n}=e,l=t*a,c=t*s;switch(o){case"inside":return Math.max(c-r-n/2,0);case"outside":return l+r+n/2;default:return(c+l)/2}}getTargetLabel(e){const{scale:t}=this,{value:i,size:s,placement:a,label:o}=e,{spacing:r,color:n,fontStyle:l,fontWeight:c,fontSize:h,fontFamily:p}=o,u=void 0,g=t.convert(i),d=Math.trunc(normalizeAngle3607(g)/(Math.PI/2)),m=s/2+r;let y,f,S,b;switch(a){case"outside":({textAlign:y,textBaseline:f}=outsideLabelPlacements[d]),S=m*Math.cos(g),b=m*Math.sin(g);break;case"inside":({textAlign:y,textBaseline:f}=insideLabelPlacements[d]),S=-m*Math.cos(g),b=-m*Math.sin(g);break;default:y="center",f="bottom",S=0,b=-m;break}return{offsetX:S,offsetY:b,fill:n,textAlign:y,textBaseline:f,fontStyle:l,fontWeight:c,fontSize:h,fontFamily:p,lineHeight:u}}createNodeData(){const e=this.layoutScale(),{id:t,scale:i,properties:s,radius:a,centerX:o,centerY:r}=this,{value:n,innerRadiusRatio:l,outerRadiusRatio:c,segmentation:h,cornerRadius:p,cornerMode:u,needle:g,bar:d,scale:m,label:y,secondaryLabel:f}=s,{outerRadius:S=a*c,innerRadius:b=a*l,defaultColorRange:x}=s,v=this.getTargets(),_=[],D=[],k=[],A=[],L=[],R=u==="item",O=i.convert(i.domain[0]),B=i.convert(n),C=Math.ceil(normalizeAngle360Inclusive3(B-O)*a);let w=h.enabled?h.interval.getSegments(i,C):void 0;const M=d.getStyle(x,i),T=m.getStyle(d.enabled,x,i);if(w==null&&R){const N=Math.min(...i.domain),I=Math.max(...i.domain),P={value:n,segmentStart:N,segmentEnd:I},E=Math.min(p,(S-b)/2)/((b+S)/2);_.push({series:this,itemId:"value",datum:P,datumIndex:{type:0},type:0,centerX:o,centerY:r,outerRadius:S,innerRadius:b,startAngle:O-E,endAngle:B+E,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:p,endCornerRadius:p,style:M}),L.push({series:this,itemId:"scale",datum:P,datumIndex:{type:0},type:0,centerX:o,centerY:r,outerRadius:S,innerRadius:b,startAngle:i.range[0]-E,endAngle:i.range[1]+E,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:p,endCornerRadius:p,style:T})}else{w??(w=i.domain);for(let N=0;Nthis.formatLabel(z.value)}=y;A.push({label:"primary",centerX:o,centerY:r,text:N,value:n,fill:I,fontSize:P,minimumFontSize:F,fontStyle:E,fontWeight:G,fontFamily:K,lineHeight:V,formatter:W})}if(!g.enabled&&f.enabled){const{text:N,color:I,fontSize:P,minimumFontSize:F,fontStyle:E,fontWeight:G,fontFamily:K,lineHeight:V,formatter:W}=f;A.push({label:"secondary",centerX:o,centerY:r,text:N,value:n,fill:I,fontSize:P,minimumFontSize:F,fontStyle:E,fontWeight:G,fontFamily:K,lineHeight:V,formatter:W})}if(g.enabled){let N=g.radiusRatio==null?b:a*g.radiusRatio;N=Math.max(N-g.spacing,0);const I=i.convert(n);k.push({centerX:o,centerY:r,radius:N,angle:I,series:this})}for(let N=0;NMath.max(...i.domain))continue;const V=this.getTargetRadius(I),W=i.convert(P),z=toRadians4(I.rotation+targetPlacementRotation[I.placement]);D.push({series:this,itemId:`target-${N}`,midPoint:{x:V*Math.cos(W)+o,y:V*Math.sin(W)+r},datum:{value:P},datumIndex:{type:1,index:N},type:1,value:P,text:F,centerX:o,centerY:r,shape:G,radius:V,angle:W,rotation:z,size:E,label:this.getTargetLabel(I),style:K})}return{itemId:t,nodeData:_,needleData:k,targetData:D,labelData:A,scaleData:L,tickData:e}}updateSelections(e){(this.nodeDataRefresh||e)&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}highlightDatum(e){if(e!=null&&e.series===this&&e.type===1)return e}update({seriesRect:e}){const{datumSelection:t,labelSelection:i,needleSelection:s,targetSelection:a,targetLabelSelection:o,scaleSelection:r,highlightTargetSelection:n,tickSelection:l}=this,c=this.checkResize(e);this.updateSelections(c),this.contentGroup.visible=this.visible,this.contentGroup.opacity=this.getOpacity();const h=this.contextNodeData?.nodeData??[],p=this.contextNodeData?.labelData??[],u=this.contextNodeData?.needleData??[],g=this.contextNodeData?.targetData??[],d=this.contextNodeData?.scaleData??[],m=this.contextNodeData?.tickData??[],y=this.highlightDatum(this.ctx.highlightManager.getActiveHighlight());this.scaleSelection=this.updateScaleSelection({scaleData:d,scaleSelection:r}),this.updateScaleNodes({scaleSelection:r}),this.needleSelection=this.updateNeedleSelection({needleData:u,needleSelection:s}),this.updateNeedleNodes({needleSelection:s}),this.targetSelection=this.updateTargetSelection({targetData:g,targetSelection:a}),this.updateTargetStyles({targetSelection:a,isHighlight:!1}),this.updateTargetNodes({targetSelection:a}),this.targetLabelSelection=this.updateTargetLabelSelection({targetData:g,targetLabelSelection:o}),this.updateTargetLabelNodes({targetLabelSelection:o}),this.datumSelection=this.updateDatumSelection({nodeData:h,datumSelection:t}),this.updateDatumNodes({datumSelection:t}),this.labelSelection=this.updateLabelSelection({labelData:p,labelSelection:i}),this.updateLabelNodes({labelSelection:i}),this.highlightTargetSelection=this.updateTargetSelection({targetData:y==null?[]:[y],targetSelection:n}),this.updateTargetStyles({targetSelection:n,isHighlight:!0}),this.updateTargetNodes({targetSelection:n}),this.tickSelection=this.updateTickSelection({tickData:m,tickSelection:l}),this.updateTickNodes({tickSelection:l}),c&&this.animationState.transition("resize"),this.animationState.transition("update")}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>createDatumId19(e.nodeData.length,t.itemId))}updateDatumNodes(e){const{datumSelection:t}=e,{ctx:i,properties:s}=this,{segmentation:a}=s,o=a.spacing??0,r=i.animationManager.isSkipped(),n=this.getShapeFillBBox();t.each((l,c)=>{const{centerX:h,centerY:p,innerRadius:u,outerRadius:g,startCornerRadius:d,endCornerRadius:m}=c;l.centerX=h,l.centerY=p,l.innerRadius=u,l.outerRadius=g,l.pointerEvents=this.properties.bar.enabled?import_ag_charts_community150._ModuleSupport.PointerEvents.All:import_ag_charts_community150._ModuleSupport.PointerEvents.None,applyShapeStyle17(l,c.style,n),l.startOuterCornerRadius=d,l.startInnerCornerRadius=d,l.endOuterCornerRadius=m,l.endInnerCornerRadius=m,l.radialEdgeInset=(o+l.strokeWidth)/2,l.concentricEdgeInset=l.strokeWidth/2,(r||l.previousDatum==null)&&l.setProperties(resetRadialGaugeSeriesResetSectorFunction(l,c))}),this.datumUnion.update(t,this.itemGroup,import_ag_charts_community150._ModuleSupport.Sector,(l,c,h)=>{l.clipSector??(l.clipSector=new SectorBox6(Number.NaN,Number.NaN,Number.NaN,Number.NaN)),l.centerX=c.centerX,l.centerY=c.centerY,l.outerRadius=l.clipSector.outerRadius=c.outerRadius,l.innerRadius=l.clipSector.innerRadius=c.innerRadius,l.startAngle=l.clipSector.startAngle=c.startAngle,l.startInnerCornerRadius=c.startInnerCornerRadius,l.startOuterCornerRadius=c.startOuterCornerRadius,l.endAngle=h.endAngle,l.clipSector.endAngle=h.clipSector?.endAngle??h.endAngle,l.endInnerCornerRadius=h.endInnerCornerRadius,l.endOuterCornerRadius=h.endOuterCornerRadius,l.pointerEvents=import_ag_charts_community150._ModuleSupport.PointerEvents.None})}updateScaleSelection(e){return e.scaleSelection.update(e.scaleData,void 0,t=>createDatumId19(e.scaleData.length,t.itemId))}updateScaleNodes(e){const{scaleSelection:t}=e,{segmentation:i}=this.properties,s=i.spacing??0,a=this.getShapeFillBBox();t.each((o,r)=>{const{centerX:n,centerY:l,innerRadius:c,outerRadius:h,startCornerRadius:p,endCornerRadius:u}=r;o.centerX=n,o.centerY=l,o.innerRadius=c,o.outerRadius=h,applyShapeStyle17(o,r.style,a),o.startOuterCornerRadius=p,o.startInnerCornerRadius=p,o.endOuterCornerRadius=u,o.endInnerCornerRadius=u,o.radialEdgeInset=(s+o.strokeWidth)/2,o.concentricEdgeInset=o.strokeWidth/2,o.setProperties(resetRadialGaugeSeriesResetSectorFunction(o,r))})}updateNeedleSelection(e){return e.needleSelection.update(e.needleData,void 0,()=>createDatumId19(0))}updateNeedleNodes(e){const{needleSelection:t}=e,{fill:i,fillOpacity:s,stroke:a,strokeOpacity:o,strokeWidth:r,lineDash:n,lineDashOffset:l}=this.properties.needle,c=this.ctx.animationManager.isSkipped();t.each((h,p)=>{const{centerX:u,centerY:g,radius:d}=p,m=d*2;h.d=RadialGaugeNeedle.defaultPathData,applyShapeStyle17(h,{fill:i,fillOpacity:s,stroke:a,strokeOpacity:o,strokeWidth:r/m,lineDash:n.map(y=>y/m),lineDashOffset:l/m}),h.translationX=u,h.translationY=g,h.scalingX=m,h.scalingY=m,c&&h.setProperties(resetRadialGaugeSeriesResetNeedleFunction(h,p))})}updateTargetSelection(e){return e.targetSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetStyles({targetSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getTargetStyle(t,s)})}updateTargetNodes({targetSelection:e}){e.each((t,i)=>{const{centerX:s,centerY:a,angle:o,radius:r,shape:n,size:l,rotation:c}=i;applyShapeStyle17(t,i.style),t.size=l,t.shape=n==="line"?lineMarker:n,t.translationX=s+r*Math.cos(o),t.translationY=a+r*Math.sin(o),t.rotation=o+c})}getTargetStyle(e,{datumIndex:t,style:i}){const s=this.getHighlightStyle(e,t);return mergeDefaults17(s,{...i,opacity:1})}updateTargetLabelSelection(e){return e.targetLabelSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetLabelNodes(e){const{targetLabelSelection:t}=e;t.each((i,s)=>{const{centerX:a,centerY:o,radius:r,angle:n,text:l}=s,{offsetX:c,offsetY:h,fill:p,fontStyle:u,fontWeight:g,fontSize:d,fontFamily:m,textAlign:y,textBaseline:f}=s.label;if(l==null){i.visible=!1;return}i.visible=!0,i.x=a+r*Math.cos(n)+c,i.y=o+r*Math.sin(n)+h,i.text=l,i.fill=p,i.fontStyle=u,i.fontWeight=g,i.fontSize=d,i.fontFamily=m,i.textAlign=y,i.textBaseline=f})}updateLabelSelection(e){return e.labelSelection.update(e.labelData,void 0,t=>t.label)}updateLabelNodes(e){const{labelSelection:t}=e,i=this.ctx.animationManager.isSkipped();t.each((s,a)=>{s.fill=a.fill,s.fontStyle=a.fontStyle,s.fontWeight=a.fontWeight,s.fontFamily=a.fontFamily}),(i||this.labelsHaveExplicitText())&&this.formatLabelText()}updateTickSelection(e){return e.tickSelection.update(e.tickData,void 0,t=>t.index)}updateTickNodes(e){const{scale:t,radius:i,centerX:s,centerY:a,properties:o}=this,{enabled:r,color:n,fontFamily:l,fontSize:c,fontStyle:h,fontWeight:p,spacing:u}=o.scale.label,g=toRadians4(o.scale.label.rotation??0);e.tickSelection.each((d,m)=>{if(!r){d.visible=!1;return}d.visible=!0,d.text=m.text,d.fill=n,d.fontFamily=l,d.fontSize=c,d.fontStyle=h,d.fontWeight=p,d.textAlign="center",d.textBaseline="middle";const y=t.convert(m.value),{width:f,height:S}=m,b=Math.abs(i*Math.cos(y)),x=Math.abs(i*Math.sin(y)),v=Math.min(Math.max(Math.abs(i/Math.tan(y)),b-f/2),b+f/2),_=Math.min(Math.max(Math.abs(i*Math.tan(y)),x-S/2),x+S/2),D=Math.hypot(v,_),k=s+(D+u)*Math.cos(y),A=a+(D+u)*Math.sin(y);d.x=k,d.y=A,d.rotationCenterX=k,d.rotationCenterY=A,d.rotation=g})}labelsHaveExplicitText(){for(const{datum:e}of this.labelSelection)if(e.text==null)return!1;return!0}formatLabelText(e){const{labelSelection:t,radius:i,textAlign:s,verticalAlign:a}=this,{spacing:o,innerRadiusRatio:r}=this.properties;formatRadialGaugeLabels(this,this.ctx,t,{padding:o,textAlign:s,verticalAlign:a},i*r,e)}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),resetMotion4([this.datumSelection],resetRadialGaugeSeriesResetSectorFunction),resetMotion4([this.needleSelection],resetRadialGaugeSeriesResetNeedleFunction),this.formatLabelText()}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}animateLabelText(e={}){const{animationManager:t}=this.ctx;let i,s,a,o;if(this.labelSelection.each((r,n)=>{r.opacity=1,n.label==="primary"?(i=r.previousDatum?.value??e.from??n.value,s=n.value):n.label==="secondary"&&(a=r.previousDatum?.value??e.from??n.value,o=n.value)}),!this.labelsHaveExplicitText())if(s==null||o==null)this.formatLabelText();else if(i===s&&a===o)this.formatLabelText({label:s,secondaryLabel:o});else{const r=`${this.id}_labels`;t.animate({id:r,groupId:"label",from:{label:i,secondaryLabel:a},to:{label:s,secondaryLabel:o},phase:e.phase??"update",onUpdate:n=>this.formatLabelText(n),onStop:()=>this.formatLabelText({label:s,secondaryLabel:o})})}}animateEmptyUpdateReady(){const{animationManager:e}=this.ctx,{node:t,needle:i}=prepareRadialGaugeSeriesAnimationFunctions(!0,this.scale.range[0]);fromToMotion5(this.id,"node",e,[this.datumSelection],t,(s,a)=>a.itemId),fromToMotion5(this.id,"needle",e,[this.needleSelection],i,()=>"needle"),fromToMotion5(this.id,"label",e,[this.labelSelection],fadeInFns,(s,a)=>a.label),this.animateLabelText({from:this.properties.scale.min,phase:"initial"})}animateWaitingUpdateReady(){const{animationManager:e}=this.ctx,{node:t,needle:i}=prepareRadialGaugeSeriesAnimationFunctions(!1,this.scale.range[0]);fromToMotion5(this.id,"node",e,[this.datumSelection],t,(s,a)=>a.itemId),fromToMotion5(this.id,"needle",e,[this.needleSelection],i,()=>"needle"),this.animateLabelText()}animateReadyResize(){this.resetAllAnimation()}dataCount(){return Number.NaN}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}getLegendData(){return[]}getTooltipContent(e){const{id:t,properties:i}=this,{tooltip:s}=i;let a,o,r;if(e.type===0?(a=i.value,o=i.label.text,r=this.ctx.localeManager.t("ariaLabelGaugeValue")):({value:a,text:o}=i.targets[e.index],r=this.ctx.localeManager.t("ariaLabelGaugeTarget")),a!=null)return this.formatTooltipWithContext(s,{data:[{label:o,fallbackLabel:r,value:this.formatLabel(a)}]},{seriesId:t,title:void 0,datum:void 0,value:a})}pickNodeClosestDatum(e){return pickGaugeNearestDatum(this,e)}pickFocus(e){return pickGaugeFocus(this,e)}getCaptionText(){const{value:e}=this.properties,t=[];return t.push(this.formatLabel(e)),this.labelSelection.each((i,s)=>{const a=getLabelText(this.id,this.ctx,s);a!=null&&t.push((0,import_ag_charts_core54.toPlainText)(a))}),t.join(". ")}getCategoryValue(e){}datumIndexForCategoryValue(e){}hasItemStylers(){return this.properties.label.itemStyler!=null}};RadialGaugeSeries.className="RadialGaugeSeries",RadialGaugeSeries.type="radial-gauge";var{FONT_SIZE_RATIO}=import_ag_charts_community151._ModuleSupport,RadialGaugeModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"radial-gauge",moduleFactory:e=>new RadialGaugeSeries(e),themeTemplate:{minWidth:200,minHeight:200,tooltip:{enabled:!1},series:{outerRadiusRatio:1,innerRadiusRatio:.8,startAngle:270,endAngle:450,defaultColorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$interpolate:[{$palette:"secondDivergingColors"},5]},import_ag_charts_community151._ModuleSupport.SAFE_RANGE2_OPERATION]},scale:{defaultFill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/2",import_ag_charts_community151._ModuleSupport.SAFE_STROKE_FILL_OPERATION,{$palette:"hierarchyColors"}]},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:12}},bar:{strokeWidth:{$isUserOption:["./stroke",2,0]}},segmentation:{enabled:!1,interval:{},spacing:2},defaultTarget:{fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},size:10,shape:"triangle",placement:"outside",spacing:5,label:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:5}},needle:{enabled:!1,fill:{$ref:"foregroundColor"},spacing:10},label:{...import_ag_charts_community151._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:56,minimumFontSize:18/56,fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}},secondaryLabel:{...import_ag_charts_community151._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:FONT_SIZE_RATIO.LARGE},minimumFontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"subtleTextColor"}},tooltip:{range:{$path:["/tooltip/range",10]}}}}},RadialGaugeSeriesModule={type:"series",name:"radial-gauge",chartType:"standalone",enterprise:!0,options:import_ag_charts_community151._ModuleSupport.radialGaugeSeriesOptionsDef,create:e=>new RadialGaugeSeries(e)},import_ag_charts_community156=require("ag-charts-community"),import_ag_charts_community154=require("ag-charts-community"),import_ag_charts_core56=require("ag-charts-core"),import_ag_charts_community152=require("ag-charts-community"),import_ag_charts_core55=require("ag-charts-core"),{BBox:BBox15,Path:Path12,Vec2,SceneChangeDetection:SceneChangeDetection7}=import_ag_charts_community152._ModuleSupport,SankeyLink=class extends Path12{constructor(){super(...arguments),this.x1=0,this.x2=0,this.y1=0,this.y2=0,this.height=0,this.inset=0,this.elbows=[]}computeBBox(){const e=Math.min(this.x1,this.x2),t=Math.max(this.x1,this.x2)-e,i=Math.min(this.y1,this.y2),s=Math.max(this.y1,this.y2)-i+this.height;return new BBox15(e,i,t,s)}updatePath(){const{path:e,inset:t}=this;e.clear();const i=this.height-2*this.inset,s=i/2;let a=this.x1+t,o=this.y1+t;e.moveTo(a,o);for(const l of this.elbows)this.updatePathSection(a,o,l.x,l.y,i,-s),a=l.x,o=l.y;const r=this.x2-t,n=this.y2+t;this.updatePathSection(a,o,r,n,i,-s),e.lineTo(r,n+i),a=r,o=n;for(const l of this.elbows.toReversed())this.updatePathSection(a,o,l.x,l.y,i,s),a=l.x,o=l.y;this.updatePathSection(a,o,this.x1+t,this.y1+t,i,s),e.closePath()}updatePathSection(e,t,i,s,a,o){const{path:r}=this,n=Vec2.from(e,t+o+a/2),l=Vec2.from(i,s+o+a/2);if(Math.abs(l.y-n.y)<2){r.lineTo(l.x,l.y);return}let c=Vec2.angle(Vec2.sub(l,n));c<0&&(c=2*Math.PI+c);const h=0,p=Math.PI/2,u=Math.PI,g=Math.PI*1.5,d=getArcValues(n,l,0),m=getArcValues(n,l,a);if(d.radius=g?(r.arc(n.x,t-d.radius,d.radius,p,p+m.angle,!0),r.arc(l.x,s+m.radius,m.radius,g+m.angle,g),r.lineTo(l.x,l.y)):c>h&&c<=p?(r.arc(n.x,t+m.radius,m.radius,g,g+m.angle),r.arc(l.x,s-d.radius,d.radius,p+d.angle,p,!0),r.lineTo(l.x,l.y)):c>p&&c<=u?(r.arc(n.x,t+m.radius,m.radius-a,g,g+m.angle,!0),r.arc(l.x,s-d.radius,d.radius+a,p+d.angle,p),r.lineTo(l.x,l.y)):(r.arc(n.x,t-d.radius,d.radius+a,p,p+d.angle),r.arc(l.x,s+m.radius,m.radius-a,g+m.angle,g,!0),r.lineTo(l.x,l.y))}};__decorateClass([SceneChangeDetection7()],SankeyLink.prototype,"x1",2),__decorateClass([SceneChangeDetection7()],SankeyLink.prototype,"x2",2),__decorateClass([SceneChangeDetection7()],SankeyLink.prototype,"y1",2),__decorateClass([SceneChangeDetection7()],SankeyLink.prototype,"y2",2),__decorateClass([SceneChangeDetection7()],SankeyLink.prototype,"height",2),__decorateClass([SceneChangeDetection7()],SankeyLink.prototype,"inset",2);function getArcValues(e,t,i){const s=Vec2.angle(Vec2.sub(t,e)),a=Vec2.distance(e,t),o=Vec2.add(e,Vec2.rotate(Vec2.from(a/2,0),s)),r=-1/Vec2.gradient(e,t),n=Vec2.intercept(o,r),l=lerpClamp(.1,.5,Math.PI/2-Math.abs(Vec2.gradient(e,t))),c=Vec2.intersectAtX(r,n,e.x),h=Math.max(i,Vec2.distance(e,c)*l);return{angle:Vec2.angle(Vec2.sub(c,e),Vec2.sub(c,o))/-(1.1-l),radius:h}}function lerpClamp(e,t,i){return(0,import_ag_charts_core55.clamp)(e,(t-e)*i+e,t)}var import_ag_charts_community153=require("ag-charts-community"),{BaseProperties:BaseProperties12,FillGradientDefaults:FillGradientDefaults2,FillPatternDefaults:FillPatternDefaults2,FillImageDefaults:FillImageDefaults2,makeSeriesTooltip:makeSeriesTooltip22,SeriesProperties:SeriesProperties13,Property:Property37,Label:Label15}=import_ag_charts_community153._ModuleSupport,SankeySeriesLabelProperties=class extends Label15{constructor(){super(...arguments),this.spacing=1,this.placement=void 0,this.edgePlacement=void 0}};__decorateClass([Property37],SankeySeriesLabelProperties.prototype,"spacing",2),__decorateClass([Property37],SankeySeriesLabelProperties.prototype,"placement",2),__decorateClass([Property37],SankeySeriesLabelProperties.prototype,"edgePlacement",2);var SankeySeriesLinkProperties=class extends BaseProperties12{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}};__decorateClass([Property37],SankeySeriesLinkProperties.prototype,"fill",2),__decorateClass([Property37],SankeySeriesLinkProperties.prototype,"fillOpacity",2),__decorateClass([Property37],SankeySeriesLinkProperties.prototype,"stroke",2),__decorateClass([Property37],SankeySeriesLinkProperties.prototype,"strokeOpacity",2),__decorateClass([Property37],SankeySeriesLinkProperties.prototype,"strokeWidth",2),__decorateClass([Property37],SankeySeriesLinkProperties.prototype,"lineDash",2),__decorateClass([Property37],SankeySeriesLinkProperties.prototype,"lineDashOffset",2),__decorateClass([Property37],SankeySeriesLinkProperties.prototype,"itemStyler",2);var SankeySeriesNodeProperties=class extends BaseProperties12{constructor(){super(...arguments),this.spacing=1,this.minSpacing=0,this.width=1,this.alignment="justify",this.verticalAlignment="center",this.sort="auto",this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}};__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"spacing",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"minSpacing",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"width",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"alignment",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"verticalAlignment",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"sort",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"fill",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"fillOpacity",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"stroke",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"strokeOpacity",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"strokeWidth",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"lineDash",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"lineDashOffset",2),__decorateClass([Property37],SankeySeriesNodeProperties.prototype,"itemStyler",2);var SankeySeriesProperties=class extends SeriesProperties13{constructor(){super(),this.nodes=void 0,this.idKey="",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.sizeKey=void 0,this.sizeName=void 0,this.fillGradientDefaults=new FillGradientDefaults2,this.fillPatternDefaults=new FillPatternDefaults2,this.fillImageDefaults=new FillImageDefaults2,this.defaultColorRange=[],this.defaultPatternFills=[],this.fills=[],this.strokes=[],this.label=new SankeySeriesLabelProperties,this.link=new SankeySeriesLinkProperties,this.node=new SankeySeriesNodeProperties,this.tooltip=makeSeriesTooltip22(),this.highlightStyle.deprecated=!1}getStyle(e,t,i,s){const{fillOpacity:a,strokeWidth:o,strokeOpacity:r,lineDash:n,lineDashOffset:l,fill:c=t[s%t.length],stroke:h=i[s%t.length]}=e?this.link:this.node;return{fill:c,fillOpacity:a,stroke:h,strokeWidth:o,strokeOpacity:r,lineDash:n,lineDashOffset:l}}};__decorateClass([Property37],SankeySeriesProperties.prototype,"nodes",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"fromKey",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"toKey",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"idKey",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"idName",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"labelKey",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"labelName",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"sizeKey",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"sizeName",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"fillGradientDefaults",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"fillPatternDefaults",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"fillImageDefaults",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"defaultColorRange",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"defaultPatternFills",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"fills",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"strokes",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"label",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"link",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"node",2),__decorateClass([Property37],SankeySeriesProperties.prototype,"tooltip",2);var{Transformable:Transformable3,applyShapeStyle:applyShapeStyle18,SeriesNodePickMode:SeriesNodePickMode16,createDatumId:createDatumId20,getShapeStyle:getShapeStyle2,getLabelStyles:getLabelStyles6,Rect:Rect6,BBox:BBox16,mergeDefaults:mergeDefaults18}=import_ag_charts_community154._ModuleSupport,SankeySeries=class extends FlowProportionSeries{constructor(e){super({moduleCtx:e,pickModes:[SeriesNodePickMode16.NEAREST_NODE,SeriesNodePickMode16.EXACT_SHAPE_MATCH]}),this.properties=new SankeySeriesProperties}isLabelEnabled(){return(this.properties.labelKey!=null||this.nodes==null)&&this.properties.label.enabled}linkFactory(){return new SankeyLink}nodeFactory(){return new Rect6}createNodeData(){const{id:e,_nodeDataDependencies:{seriesRectWidth:t,seriesRectHeight:i}={seriesRectWidth:0,seriesRectHeight:0}}=this,{fromKey:s,toKey:a,sizeKey:o,labelKey:r,label:{spacing:n,placement:l,edgePlacement:c},node:{width:h,alignment:p}}=this.properties,u=M=>({...M,x:Number.NaN,y:Number.NaN,width:h,height:Number.NaN}),g=M=>({...M,x1:Number.NaN,x2:Number.NaN,y1:Number.NaN,y2:Number.NaN,height:Number.NaN,elbows:[]}),{nodeGraph:d,links:m,maxPathLength:y}=this.getNodeGraph(u,g,{includeCircularReferences:!1}),f=d;if(f.size===0)return;const S=[];for(let M=0;MW+z.size,0),I.reduce((W,{link:z})=>W+z.size,0));if(N.length===0&&I.length===0||E===0){M.columnIndex=-1;continue}let G;switch(p){case"left":G=S[P];break;case"right":G=S[y-1-F];break;case"center":{if(N.length!==0)G=S[P];else if(I.length===0)G=S[0];else{const W=I.reduce((z,Y)=>Math.min(z,Y.node.maxPathLengthBefore),y)-1;G=S[W]}break}case"justify":{G=I.length===0?S[y-1]:S[P];break}}T.size=E;const{label:K}=this.properties,V=K.enabled?this.getLabelText(T.label,T.datum,r,"label",[],this.properties.label,{datum:T.datum,value:T.label,fromKey:s,toKey:a,sizeKey:o,size:E}):void 0;T.label=(0,import_ag_charts_core56.toPlainText)(V),G.nodes.push(M),G.size+=E,M.columnIndex=G.index}const b=(0,import_ag_charts_core56.cachedTextMeasurer)(this.properties.label);let x=0,v=0;if(this.isLabelEnabled()){if(l==null&&c==null)x=(t-h)*(1-y/(y+1)),v=x;else if(c==="outside"||c==null){const M=(T,N)=>{const I=N;if(I.datum.label==null||I.datum.label==="")return T;let P=(t-h)/(y-1)-n;l==="center"&&c==null&&(P/=2);const F=(0,import_ag_charts_core56.wrapText)(I.datum.label,{maxWidth:P,maxHeight:I.datum.height,font:this.properties.label,textWrap:"never"});let{width:E}=b.measureLines(F);return l==="center"&&c==null&&(E/=2),Math.max(T,E)};(l!=="right"||c==="outside")&&(x=h+S[0].nodes.reduce(M,0)),(l!=="left"||c==="outside")&&(v=h+S.at(-1).nodes.reduce(M,0))}}const _=(t-h-x-v)/(y-1);for(let M=0;MM.columnIndex;P--){const F=N.link.size,E={ghost:!0,datum:{...M.datum,size:F,y:0,height:0},weight:0,linksBefore:[{node:{columnIndex:P-1,datum:{size:F}}}],linksAfter:[{node:{columnIndex:P+1,datum:{size:F}}}],link:N.link,columnIndex:M.columnIndex,size:M.datum.size,closestColumnDiff:T,fromNode:{y:I.datum.y},toNode:{y:0}};S[P].size+=F,S[P].nodes.push(E)}}}const D=S.toSorted((M,T)=>{const N=M.nodes.reduce((P,F)=>Math.max(P,F.datum.size),0);return T.nodes.reduce((P,F)=>Math.max(P,F.datum.size),0)-N}),k={};for(let M=0;M{if(I.node.columnIndex!==M.index-1)return N;const P=I.node.datum.size/S[I.node.columnIndex].size*k[I.node.columnIndex];return Math.max(N,P)},0),T.weight+=T.linksAfter.reduce((N,I)=>{if(I.node.columnIndex!==M.index+1)return N;const P=I.node.datum.size/S[I.node.columnIndex].size*k[I.node.columnIndex];return Math.max(N,P)},0)}M.nodes.sort((T,N)=>this.sortNodes(T,N))}const A=1,L=M=>S.reduce((T,{size:N,nodes:I})=>{const P=i-I.length*A,E=(1-(I.length-1)*M/P)/N;return Math.min(T,E)},1/0);let R=this.properties.node.spacing,O=L(R);for(;O<0&&R>this.properties.node.minSpacing;)R-=1,O=L(R);if(O<0){import_ag_charts_core56.Logger.warnOnce("There was insufficient space to display the Sankey Series. Reduce [node.spacing], [node.minSpacing], or provide a larger container.");return}for(const M of S){let T=0;for(const P of M.nodes){const F=i*P.datum.size*O;P.datum.height=Math.max(A,F),T+=F}const N=R*(M.nodes.length-1);let I=0;this.properties.node.verticalAlignment==="bottom"?I=i-T-N:this.properties.node.verticalAlignment==="center"&&(I=(i-T-N)/2);for(const P of M.nodes)P.datum.y=I,I+=i*P.datum.size*O+R,"ghost"in P&&P.ghost&&P.link.elbows.push({x:M.x,y:P.datum.y})}for(const{datum:M,linksBefore:T,linksAfter:N}of f.values()){let I=M.y;T.sort((F,E)=>this.sortNodes(F.node,E.node));for(const{link:F}of T)F.y2=I,I+=F.size*i*O;let P=M.y;N.sort((F,E)=>this.sortNodes(F.node,E.node,{invertColumnSort:!0}));for(const{link:F}of N)F.y1=P,P+=F.size*i*O}const B=[],C=[],{fontSize:w}=this.properties.label;for(const[M,T]of S.entries()){const N=M===0,I=M===S.length-1;let P=-1/0;T.nodes.sort((F,E)=>F.datum.y-E.datum.y);for(const F of T.nodes){if("ghost"in F&&F.ghost)continue;const{datum:E}=F;if(E.midPoint={x:E.x+E.width/2,y:E.y+E.height/2},B.push(E),E.label==null)continue;const G=E.y+E.height/2;let K;if(!N&&!I){const U=(0,import_ag_charts_core56.calcLineHeight)(w),j=G-U,H=G+U;let te=t;for(const{datum:X}of f.values())X.x>E.x&&Math.max(X.y,j)<=Math.min(X.y+X.height,H)&&(te=Math.min(te,X.x-n));const Z=te-E.x-2*n;K=(0,import_ag_charts_core56.wrapText)(E.label,{maxWidth:Z,maxHeight:E.height,font:this.properties.label,textWrap:"never",overflow:"hide"})}if(K==null||K===""){const U=c==null&&(N||I)?n:n*2;K=(0,import_ag_charts_core56.wrapText)(E.label,{maxWidth:_-U,maxHeight:E.height,font:this.properties.label,textWrap:"never"})}if(K==="")continue;const{height:V}=b.measureLines(K),W=G-V/2,z=G+V/2;let Y=E.x+E.width+n,q="left",$=l;N&&c==null&&l==null&&($="left"),c==="outside"?(N&&($="left"),I&&($="right")):c==="inside"&&(N&&($="right"),I&&($="left")),$==="left"?(Y=E.x-n,q="right"):$==="center"&&(Y=E.x+E.width/2,q="center"),W>=P&&(C.push({x:Y,y:G,textAlign:q,text:K,size:E.size}),P=z)}}for(const M of m){const{fromNode:T,toNode:N,size:I}=M;M.height=Math.max(A,i*I*O),M.x1=T.x+h,M.x2=N.x,M.midPoint={x:(M.x1+M.x2)/2,y:(M.y1+M.y2)/2+M.height/2},B.push(M)}return{itemId:e,nodeData:B,labelData:C}}sortNodes(e,t,i){const{properties:s}=this;return s.node.sort==="ascending"?(e.datum.label??"").localeCompare(t.datum.label??""):s.node.sort==="descending"?(t.datum.label??"").localeCompare(e.datum.label??""):s.node.sort==="data"?0:e.columnIndext.columnIndex?i?.invertColumnSort?-1:1:e.weight===t.weight?e.datum.size-t.datum.size:e.closestColumnDifft.closestColumnDiff?-1:e.weight-t.weight}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,s)=>{const{x:a,y:o,textAlign:r,text:n}=s,c=getLabelStyles6(this,void 0,s,this.properties.label,!1,t),{color:h,fontStyle:p,fontWeight:u,fontSize:g,fontFamily:d}=c;i.visible=!0,i.x=a,i.y=o,i.text=n,i.fill=h,i.fontStyle=p,i.fontWeight=u,i.fontSize=g,i.fontFamily=d,i.textAlign=r,i.textBaseline="middle",i.setBoxing(c)})}updateNodeSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>createDatumId20(t.type,t.id))}getNodeStyle(e,t,i){const{properties:s}=this,{fills:a,strokes:o,defaultColorRange:r,defaultPatternFills:n,fillGradientDefaults:l,fillPatternDefaults:c,fillImageDefaults:h}=s,{itemStyler:p}=s.node,u=r[t%r.length].map(S=>({color:S})),g=n[t%n.length],d=this.getHighlightStyle(i,e.datumIndex),m=mergeDefaults18(d,s.getStyle(!1,a,o,t)),y=s.node.fill!=null;let f=getShapeStyle2(m,y?l:{...l.toJson(),colorStops:u},y?c:{...c.toJson(),fill:g,stroke:g},h);if(p!=null&&e.datumIndex!=null){const S=this.cachedDatumCallback(createDatumId20(e.datumIndex.index,"node",i?"highlight":"node"),()=>{const b=this.makeItemStylerParams(e,i,f);return this.callWithContext(p,b)});S&&(f=mergeDefaults18(S,f,{...l.toJson(),colorStops:u},{...c.toJson(),fill:g,stroke:g},h))}return f.opacity=1,f}makeItemStylerParams({datum:e,datumIndex:t,size:i=0,label:s},a,o){const{id:r}=this,n=this.ctx.highlightManager?.getActiveHighlight(),l=this.getHighlightStateString(n,a,t),c=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:r,datum:e,highlighted:a,highlightState:l,...o,size:i,label:s,fill:c}}updateNodeNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((a,o)=>{const{datumIndex:r}=o,n=this.getNodeStyle(o,r.index,i);a.x=o.x,a.y=o.y,a.width=Math.max(o.width,0),a.height=Math.max(o.height,0),applyShapeStyle18(a,n,s)})}getShapeFillBBox(){const e=this._nodeDataDependencies?.seriesRectWidth??0,t=this._nodeDataDependencies?.seriesRectHeight??0,i=new BBox16(0,0,e,t);return{series:i,axis:i}}updateLinkSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>createDatumId20(t.type,t.index,t.fromNode.id,t.toNode.id))}getLinkStyle({datumIndex:e,datum:t},i,s){const{id:a,properties:o}=this,{fills:r,strokes:n,defaultColorRange:l,defaultPatternFills:c,fillGradientDefaults:h,fillPatternDefaults:p,fillImageDefaults:u}=o,{itemStyler:g}=o.link,d=l[i.index%l.length].map(x=>({color:x})),m=c[i.index%c.length],y=this.getHighlightStyle(s,e),f=mergeDefaults18(y,o.getStyle(!0,r,n,i.index)),S=o.link.fill!=null;let b=getShapeStyle2(f,S?h:{...h.toJson(),colorStops:d},S?p:{...p.toJson(),fill:m,stroke:m},u);if(g!=null&&e!=null){const x=this.cachedDatumCallback(createDatumId20(e.index,"link",s?"highlight":"node"),()=>{const v=this.ctx.highlightManager?.getActiveHighlight(),_=this.getHighlightStateString(v,s,e);return this.callWithContext(g,{seriesId:a,datum:t,highlighted:s,highlightState:_,...b})});x&&(b=mergeDefaults18(x,b,{...h.toJson(),colorStops:d},{...p.toJson(),fill:m,stroke:m},u))}return b.opacity=1,b}updateLinkNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((a,o)=>{const r=o.fromNode.datumIndex,n=this.getLinkStyle(o,r,i);a.x1=o.x1,a.y1=o.y1,a.x2=o.x2,a.y2=o.y2,a.height=o.height,a.elbows=o.elbows,applyShapeStyle18(a,n,s),a.inset=a.strokeWidth/2})}getTooltipContent(e){const{id:t,linksProcessedData:i,nodesProcessedData:s,properties:a,ctx:{formatManager:o}}=this,{fromKey:r,toKey:n,sizeKey:l,sizeName:c,tooltip:h}=a,p=this.contextNodeData?.nodeData.find(S=>S.datumIndex.type===e.type&&S.datumIndex.index===e.index);if(p==null)return;const u=p.type===0?p.fromNode.index:p.index,g=p.type===0?`${p.fromNode.label} - ${p.toNode.label}`:p.label,d=e.type===0?i?.dataSources.get(this.id)?.data[e.index]:s?.dataSources.get(this.id)?.data[e.index],m=p.size;let y;if(p.type===0){const S=p.fromNode.datumIndex;y=this.getLinkStyle({datumIndex:e,datum:d},S,!1)}else y=this.getNodeStyle({datumIndex:e,datum:d},e.index,!1);const f=[];if(l!=null){const S=o.format(this.callWithContext.bind(this),{type:"number",value:m,datum:d,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",domain:[],boundSeries:this.getFormatterContext("size"),fractionDigits:void 0});f.push({label:c,fallbackLabel:l,value:S??String(m)})}return this.formatTooltipWithContext(h,{title:g,symbol:this.legendItemSymbol(p.type,u,y),data:f},{seriesId:t,datum:d,title:g,fromKey:r,toKey:n,sizeKey:l,sizeName:c,size:m,...y})}computeFocusBounds(e){if(e instanceof Rect6){const{x:t,y:i,width:s,height:a}=e,o=new BBox16(t,i,s,a);return Transformable3.toCanvas(this.contentGroup,o)}return e}hasItemStylers(){return this.properties.node.itemStyler!=null||this.properties.link.itemStyler!=null||this.properties.label.itemStyler!=null}};SankeySeries.className="SankeySeries",SankeySeries.type="sankey";var import_ag_charts_community155=require("ag-charts-community"),import_ag_charts_core57=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs21,sankeySeriesThemeableOptionsDef}=import_ag_charts_community155._ModuleSupport,sankeySeriesOptionsDef={...sankeySeriesThemeableOptionsDef,...commonSeriesOptionsDefs21,type:(0,import_ag_charts_core57.required)((0,import_ag_charts_core57.constant)("sankey")),fromKey:(0,import_ag_charts_core57.required)(import_ag_charts_core57.string),toKey:(0,import_ag_charts_core57.required)(import_ag_charts_core57.string),sizeKey:import_ag_charts_core57.string,sizeName:import_ag_charts_core57.string};sankeySeriesOptionsDef.fillGradientDefaults=(0,import_ag_charts_core57.undocumented)(import_ag_charts_core57.fillGradientDefaults),sankeySeriesOptionsDef.fillPatternDefaults=(0,import_ag_charts_core57.undocumented)(import_ag_charts_core57.fillPatternDefaults),sankeySeriesOptionsDef.fillImageDefaults=(0,import_ag_charts_core57.undocumented)(import_ag_charts_core57.fillImageDefaults),sankeySeriesOptionsDef.defaultColorRange=(0,import_ag_charts_core57.undocumented)((0,import_ag_charts_core57.arrayOf)((0,import_ag_charts_core57.arrayOf)(import_ag_charts_core57.color))),sankeySeriesOptionsDef.defaultPatternFills=(0,import_ag_charts_core57.undocumented)((0,import_ag_charts_core57.arrayOf)(import_ag_charts_core57.color));var SankeyModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],solo:!0,identifier:"sankey",moduleFactory:e=>new SankeySeries(e),themeTemplate:{seriesArea:{padding:{top:10,bottom:10}},series:{fills:{$palette:"fills"},strokes:{$palette:"strokes"},fillGradientDefaults:import_ag_charts_community156._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS,fillPatternDefaults:import_ag_charts_community156._ModuleSupport.FILL_PATTERN_DEFAULTS,fillImageDefaults:import_ag_charts_community156._ModuleSupport.FILL_IMAGE_DEFAULTS,defaultColorRange:{$palette:"gradients"},defaultPatternFills:import_ag_charts_community156._ModuleSupport.SAFE_FILLS_OPERATION,highlightStyle:{series:{dimOpacity:.2}},highlight:{...import_ag_charts_community156._ModuleSupport.singleSeriesHighlightStyle()},label:{...import_ag_charts_community156._ModuleSupport.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:10},node:{spacing:{$if:[{$greaterThan:[{$path:"./minSpacing"},20]},{$path:"./minSpacing"},20]},minSpacing:0,width:10,strokeWidth:{$isUserOption:["./stroke",2,0]}},link:{fillOpacity:.5,strokeWidth:{$isUserOption:["./stroke",2,0]}}},legend:{enabled:!1,toggleSeries:!1}}},SankeySeriesModule={type:"series",name:"sankey",chartType:"standalone",enterprise:!0,options:sankeySeriesOptionsDef,create:e=>new SankeySeries(e)},import_ag_charts_community160=require("ag-charts-community"),import_ag_charts_community158=require("ag-charts-community"),import_ag_charts_core58=require("ag-charts-core"),import_ag_charts_community157=require("ag-charts-community"),{HierarchySeriesProperties,HighlightStyle,makeSeriesTooltip:makeSeriesTooltip23,Property:Property38}=import_ag_charts_community157._ModuleSupport,SunburstSeriesTileHighlightStyle=class extends HighlightStyle{constructor(){super(!1),this.label=new AutoSizedLabel,this.secondaryLabel=new AutoSizedLabel}};__decorateClass([Property38],SunburstSeriesTileHighlightStyle.prototype,"fill",2),__decorateClass([Property38],SunburstSeriesTileHighlightStyle.prototype,"fillOpacity",2),__decorateClass([Property38],SunburstSeriesTileHighlightStyle.prototype,"stroke",2),__decorateClass([Property38],SunburstSeriesTileHighlightStyle.prototype,"strokeWidth",2),__decorateClass([Property38],SunburstSeriesTileHighlightStyle.prototype,"strokeOpacity",2),__decorateClass([Property38],SunburstSeriesTileHighlightStyle.prototype,"label",2),__decorateClass([Property38],SunburstSeriesTileHighlightStyle.prototype,"secondaryLabel",2);var SunburstSeriesProperties=class extends HierarchySeriesProperties{constructor(){super(...arguments),this.fillOpacity=1,this.strokeWidth=0,this.strokeOpacity=1,this.cornerRadius=0,this.highlightStyle=new SunburstSeriesTileHighlightStyle,this.label=new AutoSizedLabel,this.secondaryLabel=new AutoSizedSecondaryLabel,this.tooltip=makeSeriesTooltip23()}getStyle(e){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:a,strokeOpacity:o}=this;return{fill:t[e%t.length],fillOpacity:s,stroke:i[e%i.length],strokeWidth:a,strokeOpacity:o,opacity:1}}};__decorateClass([Property38],SunburstSeriesProperties.prototype,"sizeName",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"labelKey",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"secondaryLabelKey",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"sectorSpacing",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"padding",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"highlightStyle",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"label",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"secondaryLabel",2),__decorateClass([Property38],SunburstSeriesProperties.prototype,"tooltip",2);var{fromToMotion:fromToMotion6,normalizeAngle360:normalizeAngle3608,createDatumId:createDatumId21,PointerEvents:PointerEvents13,Sector:Sector7,Group:Group16,ScalableGroup,Selection:Selection15,TransformableText:TransformableText3,BBox:BBox17,applyShapeStyle:applyShapeStyle19,mergeDefaults:mergeDefaults19,formatValue:formatValue2,getLabelStyles:getLabelStyles7}=import_ag_charts_community158._ModuleSupport,SunburstNode=class extends import_ag_charts_community158._ModuleSupport.HierarchyNode{constructor(){super(...arguments),this.label=void 0,this.secondaryLabel=void 0,this.contentHeight=0,this.bbox=void 0,this.startAngle=0,this.endAngle=0}};function setAngleData(e,t=0,i=2*Math.PI/e.sumSize){for(const s of e.children){const a=t+s.sumSize*i;s.startAngle=t,s.endAngle=a,setAngleData(s,t,i),t=a}}var SunburstSeries=class extends import_ag_charts_community158._ModuleSupport.HierarchySeries{constructor(e){super(e),this.NodeClass=SunburstNode,this.properties=new SunburstSeriesProperties,this.scalingGroup=this.contentGroup.appendChild(new ScalableGroup),this.sectorGroup=this.scalingGroup.appendChild(new Group16),this.sectorLabelGroup=this.scalingGroup.appendChild(new Group16),this.highlightSectorGroup=this.scalingGroup.appendChild(new Group16),this.datumSelection=Selection15.select(this.sectorGroup,Sector7),this.labelSelection=Selection15.select(this.sectorLabelGroup,Group16),this.highlightSelection=Selection15.select(this.highlightSectorGroup,Sector7),this.sectorLabelGroup.pointerEvents=PointerEvents13.None}processData(){super.processData(),setAngleData(this.rootNode)}updateSelections(){const e=this.ctx.highlightManager?.getActiveHighlight();if(this.highlightSelection.update(e==null?[]:[e],void 0,o=>this.getDatumId(o)),!this.nodeDataRefresh)return;this.nodeDataRefresh=!1;const{chart:t}=this;if(t==null||t.seriesRect==null)return;const s=Array.from(this.rootNode),a=o=>{o.append([new TransformableText3({tag:0}),new TransformableText3({tag:1})])};this.datumSelection.update(s,void 0,o=>this.getDatumId(o)),this.labelSelection.update(s,a,o=>this.getDatumId(o))}getItemStyle(e,t){const{properties:i,colorScale:s}=this,{itemStyler:a}=i,o=e.datumIndex?.[0]??0,r=t?i.highlightStyle:void 0,n=mergeDefaults19(r,i.getStyle(o));!t&&e.colorValue!=null&&(n.fill=s.convert(e.colorValue));let l=n;if(a!=null&&e!=null){const c=this.cachedDatumCallback(createDatumId21(this.getDatumId(e),t?"highlight":"node"),()=>{const h=this.makeItemStylerParams(e,t,l);return this.callWithContext(a,h)});c&&(l=mergeDefaults19(c,l))}return l}makeItemStylerParams(e,t,i){const{id:s}=this,a=this.ctx.highlightManager?.getActiveHighlight(),o=this.getHighlightStateString(a,t,e.datumIndex),r=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:e.datum,depth:e.depth??0,highlighted:t,highlightState:o,...i,fill:r}}updateNodes(){const{chart:e,data:t,maxDepth:i}=this;if(e==null||t==null)return;const{width:s,height:a}=e.seriesRect,{sectorSpacing:o=0,padding:r=0,cornerRadius:n,childrenKey:l,colorKey:c,colorName:h,labelKey:p,secondaryLabelKey:u,sizeKey:g,sizeName:d}=this.properties;this.contentGroup.translationX=s/2,this.contentGroup.translationY=a/2;const m=o*.5,y=Math.min(s,a)/2,f=y/(i+1),S=-Math.PI/2,b={series:new BBox17(-y,-y,2*y,2*y),axis:new BBox17(-y,-y,2*y,2*y)};this.rootNode?.walk(D=>{const{startAngle:k,endAngle:A}=D;if(D.depth!=null){const L=(k+A)/2+S,R=(D.depth+.5)*f;D.midPoint.x=Math.cos(L)*R,D.midPoint.y=Math.sin(L)*R}}),this.rootNode?.walk(D=>{const{datum:k,depth:A,startAngle:L,endAngle:R,parent:O,sumSize:B}=D;D.label=void 0,D.secondaryLabel=void 0,D.contentHeight=0;let C;if(k!=null&&A!=null&&p!=null){const J=k[p];C=this.getLabelText(J,k,p,"label",[],this.properties.label,{depth:A,datum:k,childrenKey:l,colorKey:c,colorName:h,labelKey:p,secondaryLabelKey:u,sizeKey:g,sizeName:d,value:J})}C===""&&(C=void 0);let w;if(k!=null&&A!=null&&u!=null){const J=k[u];w=this.getLabelText(J,k,u,"secondaryLabel",[],this.properties.secondaryLabel,{depth:A,datum:k,childrenKey:l,colorKey:c,colorName:h,labelKey:p,secondaryLabelKey:u,sizeKey:g,sizeName:d,value:J})}if(w===""&&(w=void 0),A==null)return;const M=A*f+m,T=(A+1)*f-m,N=M>m?m/M:m,I=T>m?m/T:m,P=L+N,E=R+N-P,G=L+I,V=R+I-G,W=J=>{if(A===0&&O?.sumSize===B)return{width:2*Math.sqrt(T**2-(J*.5)**2),height:J,meta:0};const ee=J,se=2*Math.sqrt(T**2-(M+ee)**2),ae=E=ne?{width:oe,height:ee,meta:1}:{width:ne,height:re,meta:2}},z=formatLabels((0,import_ag_charts_core58.toPlainText)(C),this.properties.label,(0,import_ag_charts_core58.toPlainText)(w),this.properties.secondaryLabel,{padding:r},W);if(z==null)return;const{width:Y,height:q,meta:$,label:U,secondaryLabel:j}=z,H=S+(L+R)/2,te=Math.sin(H)>=0,Z=Math.cos(H)>=0,X=(te?3:12)&(Z?6:9);let Q;switch($){case 0:Q=0;break;case 1:{const ie=T-(f-q)*.58,ee=Math.sqrt((T-r)**2-(Y/2)**2);Q=Math.min(ie,ee);break}case 2:if(A===0){const J=q/(2*Math.tan(E*.5))+Y*.5,ie=Math.sqrt(T**2-(q*.5)**2)-Y*.5;Q=(J+ie)*.5}else Q=(M+T)*.5;break}if(U!=null){const{fontStyle:J="normal",fontFamily:ie,fontWeight:ee="normal",color:se="black"}=this.properties.label;D.label={...U,fontStyle:J,fontFamily:ie,fontWeight:ee,color:se,labelPlacement:$,circleQuarter:X,radius:Q,theta:H}}if(j!=null){const{fontStyle:J="normal",fontFamily:ie,fontWeight:ee="normal",color:se="black"}=this.properties.secondaryLabel;D.secondaryLabel={...j,fontStyle:J,fontFamily:ie,fontWeight:ee,color:se,labelPlacement:$,circleQuarter:X,radius:Q,theta:H}}D.contentHeight=z.height});const x=(D,k,A)=>{const{depth:L,startAngle:R,endAngle:O}=D;if(L==null){k.visible=!1;return}k.visible=!0;const B=this.getItemStyle(D,A),C=B.fill,w=B.strokeWidth,M=import_ag_charts_community158._ModuleSupport.isGradientFill(C)&&C.bounds!=="item"?b:void 0;applyShapeStyle19(k,B,M),k.centerX=0,k.centerY=0,k.innerRadius=L*f,k.outerRadius=(L+1)*f,k.startAngle=R+S,k.endAngle=O+S,k.inset=m+w*.5,k.cornerRadius=n};this.datumSelection.each((D,k)=>{x(k,D,!1)}),this.highlightSelection.each((D,k)=>{x(k,D,!0)});const v=(D,k,A,L)=>{const{depth:R,contentHeight:O}=D,B=A===0,C=B?D.label:D.secondaryLabel;if(R==null||C==null){k.visible=!1;return}const{labelPlacement:w,circleQuarter:M,radius:T,theta:N}=C;let I;L&&(I=(B?this.properties.highlightStyle.label:this.properties.highlightStyle.secondaryLabel).color);const P={childrenKey:this.properties.childrenKey,colorKey:this.properties.colorKey,colorName:this.properties.colorName??this.properties.colorKey,depth:D.depth??Number.NaN,labelKey:this.properties.labelKey,secondaryLabelKey:this.properties.secondaryLabelKey,sizeKey:this.properties.sizeKey,sizeName:this.properties.sizeName??this.properties.sizeKey},F=B?this.properties.label:this.properties.secondaryLabel,E=this.ctx.highlightManager?.getActiveHighlight(),G=getLabelStyles7(this,D,P,F,L,E);switch(k.text=C.text,k.fontSize=C.fontSize,k.lineHeight=C.lineHeight,k.fontStyle=C.fontStyle,k.fontFamily=C.fontFamily,k.fontWeight=C.fontWeight,k.fill=I??C.color,k.fillOpacity=this.getHighlightStyle(L,D.datumIndex)?.opacity??1,k.setBoxing(G),w){case 0:k.textAlign="center",k.textBaseline="top",k.translationX=0,k.translationY=(B?0:O-C.height)-O*.5,k.rotation=0;break;case 1:{const K=(M&3)!==0,V=B===!K?T:T-(O-C.height);k.textAlign="center",k.textBaseline=K?"bottom":"top",k.translationX=Math.cos(N)*V,k.translationY=Math.sin(N)*V,k.rotation=K?N-Math.PI*.5:N+Math.PI*.5;break}case 2:{const K=(M&6)!==0,V=B===!K?(O-C.height)*.5:(C.height-O)*.5;k.textAlign="center",k.textBaseline="middle",k.translationX=Math.cos(N)*T+Math.cos(N+Math.PI/2)*V,k.translationY=Math.sin(N)*T+Math.sin(N+Math.PI/2)*V,k.rotation=K?N:N+Math.PI;break}}k.visible=!0},_=this.ctx.highlightManager?.getActiveHighlight();for(const D of this.labelSelection.selectByClass(TransformableText3)){const k=D.closestDatum();v(k,D,D.tag,k===_)}}getTooltipContent(e){const{id:t,properties:i,ctx:s}=this,{labelKey:a,secondaryLabelKey:o,childrenKey:r,sizeKey:n,sizeName:l,colorKey:c,colorName:h,tooltip:p}=i,{formatManager:u}=s,g=e.reduce((_,D)=>_?.children[D],this.rootNode);if(g==null)return;const{datum:d,depth:m}=g;if(d==null||m==null)return;const y=[],f=n==null?void 0:d[n];if(f!=null){const _=[0,this.rootNode?.sumSize??0],D=u.format(this.callWithContext.bind(this),{type:"number",value:f,datum:d,seriesId:t,legendItemName:void 0,key:n,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:_,fractionDigits:void 0});y.push({label:l,fallbackLabel:n,value:D??formatValue2(f)})}const S=c==null?void 0:d[c];if(S!=null){const{colorDomain:_}=this,D=u.format(this.callWithContext.bind(this),{type:"number",value:S,datum:d,seriesId:t,legendItemName:void 0,key:c,source:"tooltip",property:"color",boundSeries:this.getFormatterContext("color"),domain:_,fractionDigits:void 0});y.push({label:h,fallbackLabel:c,value:D??formatValue2(S)})}const b=this.getItemStyle({...g,colorValue:S??g.colorValue},!1),v={shape:"square",fill:b.fill,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0};return import_ag_charts_community158._ModuleSupport.isGradientFill(v.fill)&&(v.fill={...v.fill,gradient:"linear",rotation:0,reverse:!1}),this.formatTooltipWithContext(p,{title:a==null?void 0:d[a],symbol:{marker:v},data:y},{seriesId:t,datum:d,title:void 0,depth:m,labelKey:a,secondaryLabelKey:o,childrenKey:r,sizeKey:n,sizeName:l,colorKey:c,colorName:h,...b})}createNodeData(){}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.datumSelection.nodes())}animateEmptyUpdateReady(){fromToMotion6(this.id,"nodes",this.ctx.animationManager,[this.scalingGroup],{toFn(){return{scalingX:1,scalingY:1}},fromFn(){return{scalingX:0,scalingY:0}}})}computeFocusBounds(e){return e}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};SunburstSeries.className="SunburstSeries",SunburstSeries.type="sunburst";var import_ag_charts_community159=require("ag-charts-community"),import_ag_charts_core59=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs22,sunburstSeriesThemeableOptionsDef,without:without8}=import_ag_charts_community159._ModuleSupport,sunburstSeriesOptionsDef={...sunburstSeriesThemeableOptionsDef,...without8(commonSeriesOptionsDefs22,["highlightStyle","highlight","showInLegend"]),type:(0,import_ag_charts_core59.required)((0,import_ag_charts_core59.constant)("sunburst")),labelKey:import_ag_charts_core59.string,secondaryLabelKey:import_ag_charts_core59.string,childrenKey:import_ag_charts_core59.string,sizeKey:import_ag_charts_core59.string,colorKey:import_ag_charts_core59.string,sizeName:import_ag_charts_core59.string,colorName:import_ag_charts_core59.string},{BASE_FONT_SIZE,FONT_SIZE_RATIO:FONT_SIZE_RATIO2}=import_ag_charts_community160._ModuleSupport,SunburstModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"sunburst",moduleFactory:e=>new SunburstSeries(e),solo:!0,themeTemplate:{series:{fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",import_ag_charts_community160._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS],["pattern",import_ag_charts_community160._ModuleSupport.FILL_PATTERN_DEFAULTS],["image",import_ag_charts_community160._ModuleSupport.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"strokes"}]},colorRange:{$palette:"divergingColors"},strokeWidth:{$isUserOption:["./strokes/0",2,0]},label:{...import_ag_charts_community160._ModuleSupport.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$rem:FONT_SIZE_RATIO2.LARGE},minimumFontSize:{$rem:9/BASE_FONT_SIZE},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},overflowStrategy:"ellipsis",wrapping:"never",spacing:2},secondaryLabel:{...import_ag_charts_community160._ModuleSupport.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$rem:FONT_SIZE_RATIO2.SMALLEST},minimumFontSize:{$rem:7/BASE_FONT_SIZE},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},overflowStrategy:"ellipsis",wrapping:"never"},sectorSpacing:2,padding:3,highlightStyle:{label:{color:{$ref:"chartBackgroundColor"}},secondaryLabel:{color:{$ref:"chartBackgroundColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2}},gradientLegend:{enabled:!0,...import_ag_charts_community160._ModuleSupport.LEGEND_CONTAINER_THEME}}},SunburstSeriesModule={type:"series",name:"sunburst",chartType:"standalone",enterprise:!0,options:sunburstSeriesOptionsDef,create:e=>new SunburstSeries(e)},import_ag_charts_community164=require("ag-charts-community"),import_ag_charts_community162=require("ag-charts-community"),import_ag_charts_core60=require("ag-charts-core"),import_ag_charts_community161=require("ag-charts-community"),{BaseProperties:BaseProperties13,HierarchySeriesProperties:HierarchySeriesProperties2,HighlightStyle:HighlightStyle2,makeSeriesTooltip:makeSeriesTooltip24,Property:Property39,Label:Label16}=import_ag_charts_community161._ModuleSupport,TreemapGroupLabel=class extends Label16{constructor(){super(...arguments),this.spacing=0}};__decorateClass([Property39],TreemapGroupLabel.prototype,"spacing",2);var TreemapSeriesGroup=class extends BaseProperties13{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.cornerRadius=0,this.textAlign="center",this.gap=0,this.padding=0,this.interactive=!0,this.label=new TreemapGroupLabel}};__decorateClass([Property39],TreemapSeriesGroup.prototype,"fill",2),__decorateClass([Property39],TreemapSeriesGroup.prototype,"fillOpacity",2),__decorateClass([Property39],TreemapSeriesGroup.prototype,"stroke",2),__decorateClass([Property39],TreemapSeriesGroup.prototype,"strokeWidth",2),__decorateClass([Property39],TreemapSeriesGroup.prototype,"strokeOpacity",2),__decorateClass([Property39],TreemapSeriesGroup.prototype,"cornerRadius",2),__decorateClass([Property39],TreemapSeriesGroup.prototype,"textAlign",2),__decorateClass([Property39],TreemapSeriesGroup.prototype,"gap",2),__decorateClass([Property39],TreemapSeriesGroup.prototype,"padding",2),__decorateClass([Property39],TreemapSeriesGroup.prototype,"interactive",2),__decorateClass([Property39],TreemapSeriesGroup.prototype,"label",2);var TreemapSeriesTile=class extends BaseProperties13{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.cornerRadius=0,this.textAlign="center",this.verticalAlign="middle",this.gap=0,this.padding=0,this.label=new AutoSizedLabel,this.secondaryLabel=new AutoSizedSecondaryLabel}};__decorateClass([Property39],TreemapSeriesTile.prototype,"fill",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"fillOpacity",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"stroke",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"strokeWidth",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"strokeOpacity",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"cornerRadius",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"textAlign",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"verticalAlign",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"gap",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"padding",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"label",2),__decorateClass([Property39],TreemapSeriesTile.prototype,"secondaryLabel",2);var TreemapSeriesGroupHighlightStyle=class extends BaseProperties13{constructor(){super(...arguments),this.label=new AutoSizedLabel}};__decorateClass([Property39],TreemapSeriesGroupHighlightStyle.prototype,"fill",2),__decorateClass([Property39],TreemapSeriesGroupHighlightStyle.prototype,"fillOpacity",2),__decorateClass([Property39],TreemapSeriesGroupHighlightStyle.prototype,"stroke",2),__decorateClass([Property39],TreemapSeriesGroupHighlightStyle.prototype,"strokeWidth",2),__decorateClass([Property39],TreemapSeriesGroupHighlightStyle.prototype,"strokeOpacity",2),__decorateClass([Property39],TreemapSeriesGroupHighlightStyle.prototype,"label",2);var TreemapSeriesTileHighlightStyle=class extends BaseProperties13{constructor(){super(...arguments),this.label=new AutoSizedLabel,this.secondaryLabel=new AutoSizedSecondaryLabel}};__decorateClass([Property39],TreemapSeriesTileHighlightStyle.prototype,"fill",2),__decorateClass([Property39],TreemapSeriesTileHighlightStyle.prototype,"fillOpacity",2),__decorateClass([Property39],TreemapSeriesTileHighlightStyle.prototype,"stroke",2),__decorateClass([Property39],TreemapSeriesTileHighlightStyle.prototype,"strokeWidth",2),__decorateClass([Property39],TreemapSeriesTileHighlightStyle.prototype,"strokeOpacity",2),__decorateClass([Property39],TreemapSeriesTileHighlightStyle.prototype,"label",2),__decorateClass([Property39],TreemapSeriesTileHighlightStyle.prototype,"secondaryLabel",2);var TreemapSeriesHighlightStyle=class extends HighlightStyle2{constructor(){super(!1),this.group=new TreemapSeriesGroupHighlightStyle,this.tile=new TreemapSeriesTileHighlightStyle}getStyle(e){return e?this.tile:this.group}};__decorateClass([Property39],TreemapSeriesHighlightStyle.prototype,"group",2),__decorateClass([Property39],TreemapSeriesHighlightStyle.prototype,"tile",2);var TreemapSeriesProperties=class extends HierarchySeriesProperties2{constructor(){super(...arguments),this.highlightStyle=new TreemapSeriesHighlightStyle,this.tooltip=makeSeriesTooltip24(),this.group=new TreemapSeriesGroup,this.tile=new TreemapSeriesTile,this.undocumentedGroupFills=[],this.undocumentedGroupStrokes=[]}getStyle(e,t,i,s){const{fillOpacity:a,strokeWidth:o,strokeOpacity:r,fill:n=e?t[s%t.length]:t[Math.min(s,t.length)],stroke:l=e?i[s%t.length]:i[Math.min(s,i.length)]}=e?this.tile:this.group;return{fill:n,fillOpacity:a,stroke:l,strokeWidth:o,strokeOpacity:r,opacity:1}}};__decorateClass([Property39],TreemapSeriesProperties.prototype,"sizeName",2),__decorateClass([Property39],TreemapSeriesProperties.prototype,"labelKey",2),__decorateClass([Property39],TreemapSeriesProperties.prototype,"secondaryLabelKey",2),__decorateClass([Property39],TreemapSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property39],TreemapSeriesProperties.prototype,"highlightStyle",2),__decorateClass([Property39],TreemapSeriesProperties.prototype,"tooltip",2),__decorateClass([Property39],TreemapSeriesProperties.prototype,"group",2),__decorateClass([Property39],TreemapSeriesProperties.prototype,"tile",2),__decorateClass([Property39],TreemapSeriesProperties.prototype,"undocumentedGroupFills",2),__decorateClass([Property39],TreemapSeriesProperties.prototype,"undocumentedGroupStrokes",2);var{createDatumId:createDatumId22,Rect:Rect7,Group:Group17,BBox:BBox18,Selection:Selection16,Text:Text8,Transformable:Transformable4,applyShapeStyle:applyShapeStyle20,getLabelStyles:getLabelStyles8,mergeDefaults:mergeDefaults20,formatValue:formatValue3}=import_ag_charts_community162._ModuleSupport,TreemapNode=class extends import_ag_charts_community162._ModuleSupport.HierarchyNode{constructor(){super(...arguments),this.labelValue=void 0,this.secondaryLabelValue=void 0,this.label=void 0,this.secondaryLabel=void 0,this.bbox=void 0,this.padding=void 0}};function nodeSize(e){return e.children.length>0?e.sumSize-e.sizeValue:e.sizeValue}var textAlignFactors2={left:0,center:.5,right:1},verticalAlignFactors4={top:0,middle:.5,bottom:1},DistantGroup=class extends import_ag_charts_community162._ModuleSupport.Group{distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}},TreemapSeries=class extends import_ag_charts_community162._ModuleSupport.HierarchySeries{constructor(){super(...arguments),this.NodeClass=TreemapNode,this.properties=new TreemapSeriesProperties,this.rectGroup=this.contentGroup.appendChild(new Group17),this.datumSelection=Selection16.select(this.rectGroup,Rect7),this.labelSelection=Selection16.select(this.labelGroup,Group17),this.highlightSelection=Selection16.select(this.rectGroup,Rect7)}groupTitleHeight(e,t){const{labelValue:i}=e,{label:s}=this.properties.group,a=3;if(i!=null){if(s.fontSize>t.width/a||s.fontSize>t.height/a)return;{const{height:o}=(0,import_ag_charts_core60.cachedTextMeasurer)(s).measureLines(i);return Math.max(o,s.fontSize)}}}getNodePadding(e,t){if(e.parent==null)return{top:0,right:0,bottom:0,left:0};if(e.children.length===0){const{padding:r}=this.properties.tile;return{top:r,right:r,bottom:r,left:r}}const{label:{spacing:i},padding:s}=this.properties.group,a=this.groupTitleHeight(e,t),o=a==null?0:a+i;return{top:s+o,right:s,bottom:s,left:s}}sortChildren({children:e}){const t=Array.from(e,(s,a)=>a).filter(s=>nodeSize(e[s])>0).sort((s,a)=>nodeSize(e[a])-nodeSize(e[s]));return{sortedChildrenIndices:t,childAt:s=>{const a=t[s];return e[a]}}}squarify(e,t){const{datum:i,children:s}=e;if(t.width<=0||t.height<=0){e.bbox=void 0,e.padding=void 0,e.midPoint.x=Number.NaN,e.midPoint.y=Number.NaN;return}const a=i==null?{top:0,right:0,bottom:0,left:0}:this.getNodePadding(e,t);e.parent==null?(e.bbox=void 0,e.padding=void 0,e.midPoint.x=Number.NaN,e.midPoint.y=Number.NaN):(e.bbox=t,e.padding=a,e.midPoint.x=t.x+t.width/2,e.midPoint.y=t.y);const{sortedChildrenIndices:o,childAt:r}=this.sortChildren(e),n=o.every(v=>s[v].children.length===0),l=1,c=t.width-a.left-a.right,h=t.height-a.top-a.bottom;if(c<=0||h<=0)return;const p=o.length;let u=0,g=0,d=1/0,m=o.reduce((v,_)=>v+nodeSize(s[_]),0);const y=new BBox18(t.x+a.left,t.y+a.top,c,h),f=y.clone();let S=0;for(;S({left:l.x,top:l.y,right:l.x+l.width,bottom:l.y+l.height}),o=a(e),r=a(t),n=["top","right","bottom","left"];for(const l of n)(0,import_ag_charts_core60.isNumberEqual)(o[l],r[l])||t.shrink(s,l)}createNodeData(){}getItemStyle(e,t,i){const{properties:s,colorScale:a}=this,{itemStyler:o}=s,r=e.datumIndex?.[0]??0,n=t?s.fills:s.undocumentedGroupFills,l=t?s.strokes:s.undocumentedGroupStrokes,c=t?r:e.depth??-1,h=i?s.highlightStyle.getStyle(t):void 0,p=mergeDefaults20(h,s.getStyle(t,n,l,c));!i&&t&&e.colorValue!=null&&(p.fill=a.convert(e.colorValue));let u=p;if(o!=null&&e!=null){const g=this.cachedDatumCallback(createDatumId22(this.getDatumId(e),i?"highlight":"node"),()=>{const d=this.makeItemStylerParams(e,i,u);return this.callWithContext(o,d)});g&&(u=mergeDefaults20(g,u))}return u}makeItemStylerParams(e,t,i){const{id:s}=this,a=this.ctx.highlightManager?.getActiveHighlight(),o=this.getHighlightStateString(a,t,e.datumIndex),r=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:e.datum,depth:e.depth??-1,highlighted:t,highlightState:o,...i,fill:r}}updateSelections(){let e=this.ctx.highlightManager?.getActiveHighlight();if(e!=null&&!this.properties.group.interactive&&e.children.length!==0&&(e=void 0),this.highlightSelection.update(e==null?[]:[e],void 0,a=>this.getDatumId(a)),!this.nodeDataRefresh)return;this.nodeDataRefresh=!1;const{seriesRect:t}=this.chart??{};if(!t)return;const i=Array.from(this.rootNode),s=a=>{a.append([new Text8({tag:0}),new Text8({tag:1})])};this.datumSelection.update(i,void 0,a=>this.getDatumId(a)),this.labelSelection.update(i,s,a=>this.getDatumId(a))}updateNodes(){const{rootNode:e,data:t}=this,{childrenKey:i,colorKey:s,colorName:a,labelKey:o,secondaryLabelKey:r,sizeKey:n,sizeName:l,highlightStyle:c,tile:h,group:p}=this.properties,{seriesRect:u}=this.chart??{};if(!u||!t)return;this.rootNode?.walk(b=>{const{datum:x,depth:v,children:_}=b,D=_.length===0,k=D?h.label:p.label;let A;if(k.enabled&&x!=null&&v!=null&&o!=null){const R=x[o];A=this.getLabelText(R,x,o,"label",[],k,{depth:v,datum:x,childrenKey:i,colorKey:s,colorName:a,labelKey:o,secondaryLabelKey:r,sizeKey:n,sizeName:l,value:R})}A===""&&(A=void 0);let L;if(h.secondaryLabel.enabled&&D&&x!=null&&v!=null&&r!=null){const R=x[r];L=this.getLabelText(R,x,r,"secondaryLabel",[],h.secondaryLabel,{depth:v,datum:x,childrenKey:i,colorKey:s,colorName:a,labelKey:o,secondaryLabelKey:r,sizeKey:n,sizeName:l,value:R})}L===""&&(L=void 0),b.labelValue=(0,import_ag_charts_core60.toPlainText)(A),b.secondaryLabelValue=(0,import_ag_charts_core60.toPlainText)(L)});const{width:g,height:d}=u;this.squarify(e,new BBox18(0,0,g,d)),this.rootNode?.walk(b=>{const{bbox:x,children:v,labelValue:_,secondaryLabelValue:D}=b;if(b.label=void 0,b.secondaryLabel=void 0,x!=null)if(v.length===0){const k={width:x.width,height:x.height,meta:null},A=formatLabels(_,this.properties.tile.label,D,this.properties.tile.secondaryLabel,{padding:h.padding},()=>k);if(A==null)return;const{height:L,label:R,secondaryLabel:O}=A,{textAlign:B,verticalAlign:C,padding:w}=h,M=textAlignFactors2[B]??.5,T=x.x+w+(x.width-2*w)*M,N=verticalAlignFactors4[C]??.5,I=x.y+w+L*.5+(x.height-2*w-L)*N;if(R!=null){const{fontStyle:P="normal",fontFamily:F,fontWeight:E="normal",color:G="black"}=this.properties.tile.label;b.label={text:R.text,fontSize:R.fontSize,lineHeight:R.lineHeight,fontStyle:P,fontFamily:F,fontWeight:E,color:G,textAlign:B,verticalAlign:"middle",x:T,y:I-(L-R.height)*.5}}if(O!=null){const{fontStyle:P="normal",fontFamily:F,fontWeight:E="normal",color:G="black"}=this.properties.tile.secondaryLabel;b.secondaryLabel={text:O.text,fontSize:O.fontSize,lineHeight:O.fontSize,fontStyle:P,fontFamily:F,fontWeight:E,color:G,textAlign:B,verticalAlign:"middle",x:T,y:I+(L-O.height)*.5}}}else{if(_==null)return;{const{padding:k,textAlign:A}=p,L=this.groupTitleHeight(b,x);if(L==null)return;const R=x.width-2*k,O=(0,import_ag_charts_core60.wrapText)(_,{maxWidth:x.width-2*k,font:p.label,textWrap:"never"}),B=textAlignFactors2[A]??.5,{fontStyle:C="normal",fontFamily:w,fontWeight:M="normal",color:T="black"}=this.properties.group.label;b.label={text:O,fontSize:p.label.fontSize,lineHeight:(0,import_ag_charts_core60.calcLineHeight)(p.label.fontSize),fontStyle:C,fontFamily:w,fontWeight:M,color:T,textAlign:A,verticalAlign:"middle",x:x.x+k+R*B,y:x.y+k+L*.5}}}});const m={series:new BBox18(0,0,g,d),axis:new BBox18(0,0,g,d)},y=(b,x,v)=>{const{bbox:_}=b;if(_==null){x.visible=!1;return}const{depth:D=-1}=b,k=b.children.length===0,A=this.getItemStyle(b,k,v);x.crisp=!0,applyShapeStyle20(x,A,m),x.cornerRadius=k?h.cornerRadius:p.cornerRadius,x.zIndex=[0,D,v?1:0];const L=b.parent?.children.every(B=>B.children.length===0),R=b.parent==null?void 0:b.parent.bbox,O=b.parent==null?void 0:b.parent.padding;L===!0&&R!=null&&O!=null?(x.clipBBox=_,x.x=R.x+O.left,x.y=R.y+O.top,x.width=R.width-(O.left+O.right),x.height=R.height-(O.top+O.bottom)):(x.clipBBox=void 0,x.x=_.x,x.y=_.y,x.width=_.width,x.height=_.height),x.visible=!0};this.datumSelection.each((b,x)=>y(x,b,!1)),this.highlightSelection.each((b,x)=>{y(x,b,!0)});const f=(b,x,v,_)=>{const D=b.children.length===0,k=v===0?b.label:b.secondaryLabel;if(k==null){x.visible=!1;return}const A=v===0?h.label:h.secondaryLabel;let L;if(_){const{tile:C,group:w}=c;L=C.secondaryLabel.color,D?v===0&&(L=C.label.color):L=w.label.color}const R={childrenKey:this.properties.childrenKey,colorKey:this.properties.colorKey,colorName:this.properties.colorName??this.properties.colorKey,depth:b.depth??Number.NaN,labelKey:this.properties.labelKey,secondaryLabelKey:this.properties.secondaryLabelKey,sizeKey:this.properties.sizeKey,sizeName:this.properties.sizeName??this.properties.sizeKey},O=this.ctx.highlightManager?.getActiveHighlight(),B=getLabelStyles8(this,b,R,A,_,O);x.text=k.text,x.fontSize=k.fontSize,x.lineHeight=k.lineHeight,x.fontStyle=k.fontStyle,x.fontFamily=k.fontFamily,x.fontWeight=k.fontWeight,x.fill=L??k.color,x.fillOpacity=this.getHighlightStyle(_,b.datumIndex)?.opacity??1,x.textAlign=k.textAlign,x.textBaseline=k.verticalAlign,x.x=k.x,x.y=k.y,x.setBoxing(B),x.visible=!0,x.zIndex=1},S=this.ctx.highlightManager?.getActiveHighlight();for(const b of this.labelSelection.selectByClass(Text8)){const x=b.closestDatum();f(x,b,b.tag,x===S)}}pickNodesExactShape(e){const t=super.pickNodesExactShape(e);return t.sort((i,s)=>s.datumIndex.length-i.datumIndex.length),t}pickNodeClosestDatum(e){const t=this.pickNodesExactShape(e);return t.length!==0?{datum:t[0],distance:0}:this.pickNodeNearestDistantObject(e,this.datumSelection.nodes())}getTooltipContent(e){const{id:t,properties:i,ctx:s}=this,{formatManager:a}=s,{labelKey:o,secondaryLabelKey:r,childrenKey:n,sizeKey:l,sizeName:c,colorKey:h,colorName:p,tooltip:u}=i,g=e.reduce((A,L)=>A?.children[L],this.rootNode);if(g==null)return;const{datum:d,depth:m,children:y}=g;if(d==null||m==null)return;const f=y.length===0,S=[],b=l==null?void 0:d[l];if(b!=null){const A=[0,this.rootNode?.sumSize??0],L=a.format(this.callWithContext.bind(this),{type:"number",value:b,datum:d,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:A,fractionDigits:void 0});S.push({label:c,fallbackLabel:l,value:L??formatValue3(b)})}const x=h==null?void 0:d[h];if(x!=null){const{colorDomain:A}=this,L=a.format(this.callWithContext.bind(this),{type:"number",value:x,datum:d,seriesId:t,legendItemName:void 0,key:h,source:"tooltip",property:"color",boundSeries:this.getFormatterContext("color"),domain:A,fractionDigits:void 0});S.push({label:p,fallbackLabel:h,value:L??formatValue3(x)})}const v=this.getItemStyle({...g,colorValue:x??g.colorValue},f,!1),D={shape:"square",fill:v.fill,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0};import_ag_charts_community162._ModuleSupport.isGradientFill(D.fill)&&(D.fill={...D.fill,gradient:"linear",rotation:0,reverse:!1});const k=f?{marker:D}:void 0;return this.formatTooltipWithContext(u,{title:o==null?void 0:d[o],symbol:k,data:S},{seriesId:t,datum:d,title:void 0,depth:m,labelKey:o,secondaryLabelKey:r,childrenKey:n,sizeKey:l,sizeName:c,colorKey:h,colorName:p,...v})}computeFocusBounds(e){return Transformable4.toCanvas(this.contentGroup,e.getBBox())}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.tile.label.itemStyler!=null||this.properties.group.label.itemStyler!=null}};TreemapSeries.className="TreemapSeries",TreemapSeries.type="treemap";var import_ag_charts_community163=require("ag-charts-community"),import_ag_charts_core61=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs23,treemapSeriesThemeableOptionsDef,without:without9}=import_ag_charts_community163._ModuleSupport,treemapSeriesOptionsDef={...treemapSeriesThemeableOptionsDef,...without9(commonSeriesOptionsDefs23,["highlightStyle","highlight","showInLegend"]),type:(0,import_ag_charts_core61.required)((0,import_ag_charts_core61.constant)("treemap")),labelKey:import_ag_charts_core61.string,secondaryLabelKey:import_ag_charts_core61.string,childrenKey:import_ag_charts_core61.string,sizeKey:import_ag_charts_core61.string,colorKey:import_ag_charts_core61.string,sizeName:import_ag_charts_core61.string,colorName:import_ag_charts_core61.string};treemapSeriesOptionsDef.undocumentedGroupFills=(0,import_ag_charts_core61.undocumented)((0,import_ag_charts_core61.arrayOf)(import_ag_charts_core61.color)),treemapSeriesOptionsDef.undocumentedGroupStrokes=(0,import_ag_charts_core61.undocumented)((0,import_ag_charts_core61.arrayOf)(import_ag_charts_core61.color));var{FONT_SIZE_RATIO:FONT_SIZE_RATIO3}=import_ag_charts_community164._ModuleSupport,TreemapModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"treemap",moduleFactory:e=>new TreemapSeries(e),solo:!0,themeTemplate:{series:{fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",import_ag_charts_community164._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["pattern",import_ag_charts_community164._ModuleSupport.FILL_PATTERN_DEFAULTS],["image",import_ag_charts_community164._ModuleSupport.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"strokes"}]},colorRange:{$palette:"divergingColors"},undocumentedGroupFills:{$palette:"hierarchyColors"},undocumentedGroupStrokes:{$palette:"secondHierarchyColors"},group:{label:{...import_ag_charts_community164._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"textColor"},fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},spacing:4},fill:void 0,stroke:void 0,strokeWidth:1,padding:4,gap:2,textAlign:"left"},tile:{label:{...import_ag_charts_community164._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"chartBackgroundColor"},fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:1.5},minimumFontSize:{$rem:FONT_SIZE_RATIO3.SMALLER},fontFamily:{$ref:"fontFamily"},wrapping:"on-space",overflowStrategy:"ellipsis",spacing:2},secondaryLabel:{...import_ag_charts_community164._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"chartBackgroundColor"},fontStyle:void 0,fontWeight:void 0,fontSize:{$ref:"fontSize"},minimumFontSize:{$rem:FONT_SIZE_RATIO3.SMALLER},fontFamily:{$ref:"fontFamily"},wrapping:"never",overflowStrategy:"ellipsis"},fill:void 0,stroke:void 0,strokeWidth:{$isUserOption:["../strokes/0",2,{$isUserOption:["./stroke",2,0]}]},padding:3,gap:1},highlightStyle:{group:{label:{color:{$ref:"textColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2},tile:{label:{color:{$ref:"chartBackgroundColor"}},secondaryLabel:{color:{$ref:"chartBackgroundColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2}}},gradientLegend:{enabled:!0,...import_ag_charts_community164._ModuleSupport.LEGEND_CONTAINER_THEME}}},TreemapSeriesModule={type:"series",name:"treemap",chartType:"standalone",enterprise:!0,options:treemapSeriesOptionsDef,create:e=>new TreemapSeries(e)},ModuleRegistry=import_ag_charts_community165._ModuleSupport.ModuleRegistry,AllCartesianEnterpriseModules=[OrdinalTimeAxisModule,BoxPlotSeriesModule,CandlestickSeriesModule,ConeFunnelSeriesModule,FunnelSeriesModule,HeatmapSeriesModule,OhlcSeriesModule,RangeAreaSeriesModule,RangeBarSeriesModule,WaterfallSeriesModule],AllPolarEnterpriseModules=[AngleNumberAxisModule,AngleCategoryAxisModule,RadiusNumberAxisModule,RadiusCategoryAxisModule,NightingaleSeriesModule,RadarAreaSeriesModule,RadarLineSeriesModule,RadialBarSeriesModule,RadialColumnSeriesModule],AllStandaloneEnterpriseModules=[StandaloneChartModule,PyramidSeriesModule,LinearGaugeSeriesModule,RadialGaugeSeriesModule,SunburstSeriesModule,TreemapSeriesModule,ChordSeriesModule,SankeySeriesModule],AllTopologyEnterpriseModules=[TopologyChartModule,MapLineSeriesModule,MapLineBackgroundSeriesModule,MapMarkerSeriesModule,MapShapeSeriesModule,MapShapeBackgroundSeriesModule],AllEnterpriseModules=[...AllCartesianEnterpriseModules,...AllPolarEnterpriseModules,...AllStandaloneEnterpriseModules,...AllTopologyEnterpriseModules,AnnotationsModule,NavigatorModule,InitialStateModule]; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.esm.min.mjs b/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.esm.min.mjs new file mode 100644 index 000000000..93d871109 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.esm.min.mjs @@ -0,0 +1,5 @@ +var Au=Object.defineProperty,Mu=Object.getOwnPropertyDescriptor,h=(e,t,i,s)=>{for(var o=s>1?void 0:s?Mu(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(o=(s?n(t,i,o):n(o))||o);return s&&o&&Au(t,i,o),o};import{_ModuleSupport as Nu}from"ag-charts-community";import{_ModuleSupport as Lu}from"ag-charts-community";import{_ModuleSupport as Tu}from"ag-charts-community";import{isNumberEqual as Kr}from"ag-charts-core";function Ta(e,t,i){const s=(a,n,r,l)=>{let c=e[0];for(let p=a;r>0?p<=n:p>n;p+=r){const d=e[p];if(l(c,d))return!0;c=d}return!1},o=Math.floor(e.length/2);return s(t,o,t,i)?!0:s(e.length-t,o,-t,i)}import{_ModuleSupport as Ru}from"ag-charts-community";var{AxisInterval:Pu,Property:Cu}=Ru,Ra=class extends Pu{};h([Cu],Ra.prototype,"minSpacing",2);import{_ModuleSupport as qs}from"ag-charts-community";import{countFractionDigits as Ou,isNumberEqual as Ei,wrapTextOrSegments as _u}from"ag-charts-core";import{_ModuleSupport as Wr}from"ag-charts-community";import{isNumberEqual as zr}from"ag-charts-core";import{_ModuleSupport as wu}from"ag-charts-community";import{createId as Eu}from"ag-charts-core";var{BaseProperties:$r,ChartAxisDirection:Fu,Property:ke,Group:Pa,FONT_SIZE:Bu}=wu,vt=class extends $r{constructor(){super(...arguments),this.fontSize=Bu.LARGE,this.fontFamily="Verdana, sans-serif",this.padding=5,this.color="rgba(87, 87, 87, 1)"}};h([ke],vt.prototype,"enabled",2),h([ke],vt.prototype,"text",2),h([ke],vt.prototype,"fontStyle",2),h([ke],vt.prototype,"fontWeight",2),h([ke],vt.prototype,"fontSize",2),h([ke],vt.prototype,"fontFamily",2),h([ke],vt.prototype,"padding",2),h([ke],vt.prototype,"color",2),h([ke],vt.prototype,"parallel",2);var et=class extends $r{constructor(){super(...arguments),this.id=Eu(this),this.defaultColorRange=[],this.shape="polygon",this.label=new vt,this.scale=void 0,this.clippedRange=[-1/0,1/0],this.gridLength=0,this.sideFlag=-1,this.parallelFlipRotation=0,this.regularFlipRotation=0,this.direction=Fu.Angle,this.axisInnerRadius=0,this.axisOuterRadius=0,this.lineGroup=new Pa({name:this.id}),this.rangeGroup=new Pa({name:this.id}),this.labelGroup=new Pa({name:this.id}),this._isRange=void 0}assignCrossLineGroup(e,t){e!==this._isRange&&(e?this.rangeGroup.appendChild(t):this.lineGroup.appendChild(t)),this._isRange=e}setSectorNodeProps(e){e.fill=this.fill,e.fillOpacity=this.fillOpacity??1,e.stroke=this.stroke,e.strokeOpacity=this.strokeOpacity??1,e.strokeWidth=this.strokeWidth??1,e.lineDash=this.lineDash}setLabelNodeProps(e,t,i,s,o){const{label:a}=this;e.x=t,e.y=i,e.text=a.text,e.textAlign="center",e.textBaseline=s,e.rotation=o,e.rotationCenterX=t,e.rotationCenterY=i,e.fill=a.color,e.fontFamily=a.fontFamily,e.fontSize=a.fontSize,e.fontStyle=a.fontStyle,e.visible=!0}};h([ke],et.prototype,"enabled",2),h([ke],et.prototype,"type",2),h([ke],et.prototype,"range",2),h([ke],et.prototype,"value",2),h([ke],et.prototype,"defaultColorRange",2),h([ke],et.prototype,"fill",2),h([ke],et.prototype,"fillOpacity",2),h([ke],et.prototype,"stroke",2),h([ke],et.prototype,"strokeWidth",2),h([ke],et.prototype,"strokeOpacity",2),h([ke],et.prototype,"lineDash",2),h([ke],et.prototype,"shape",2),h([ke],et.prototype,"label",2);var{ChartAxisDirection:Gu,getCrossLineValue:Vu,validateCrossLineValue:Ku,normalizeAngle360:Ca,Group:Wu,Path:Hr,Sector:zu,RotatableText:$u,ContinuousScale:Hu}=Wr,Oa=class extends et{constructor(){super(),this.direction=Gu.Angle,this.polygonNode=new Hr,this.sectorNode=new zu,this.lineNode=new Hr,this.crossLineRange=new Wu,this.labelNode=new $u,this.ticks=[],this.crossLineRange.append(this.polygonNode),this.crossLineRange.append(this.sectorNode),this.crossLineRange.append(this.lineNode),this.labelGroup.append(this.labelNode)}visibilityCheck(){if(!Hu.is(this.scale))return!0;const[e,t]=this.scale.domain,i=Vu(this);if(this.type==="range"){const[s,o]=i;return s>=e&&s<=t&&o>=s&&o<=t}else return i>=e&&i<=t}update(e){const{scale:t}=this;if(!t||!Ku(this,t)||!this.visibilityCheck()){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.rangeGroup.visible=e,this.lineGroup.visible=e,this.labelGroup.visible=e,this.updateLineNode(e),this.updatePolygonNode(e),this.updateSectorNode(e),this.updateLabelNode(e)}updateLineNode(e){const{scale:t,type:i,value:s,lineNode:o}=this;if(!e||i!=="line"||!t){o.visible=!1;return}const a=t.convert(s);if(Number.isNaN(a)){o.visible=!1;return}const{axisInnerRadius:n,axisOuterRadius:r}=this;o.visible=!0,o.stroke=this.stroke,o.strokeOpacity=this.strokeOpacity??1,o.strokeWidth=this.strokeWidth??1,o.fill=void 0,o.lineDash=this.lineDash;const l=r*Math.cos(a),c=r*Math.sin(a),p=n*Math.cos(a),d=n*Math.sin(a);o.path.clear(!0),o.path.moveTo(p,d),o.path.lineTo(l,c),this.assignCrossLineGroup(!1,this.crossLineRange)}updatePolygonNode(e){const{polygonNode:t,range:i,scale:s,shape:o,type:a,ticks:n}=this;if(!e||a!=="range"||o!=="polygon"||!s||!i){t.visible=!1;return}const{axisInnerRadius:r,axisOuterRadius:l}=this,c=n.indexOf(i[0]),p=n.indexOf(i[1]),u=(c<=p?n.slice(c,p+1):n.slice(c).concat(n.slice(0,p+1))).map(g=>s.convert(g));t.visible=!0,this.setSectorNodeProps(t);const{path:m}=t;m.clear(!0);for(const[g,y]of u.entries()){const f=l*Math.cos(y),S=l*Math.sin(y);g===0?m.moveTo(f,S):m.lineTo(f,S)}if(r===0)m.lineTo(0,0);else{const g=u.slice().reverse();for(const y of g){const f=r*Math.cos(y),S=r*Math.sin(y);m.lineTo(f,S)}}t.path.closePath(),this.assignCrossLineGroup(!0,this.crossLineRange)}updateSectorNode(e){const{sectorNode:t,range:i,scale:s,shape:o,type:a}=this;if(!e||a!=="range"||o!=="circle"||!s||!i){t.visible=!1;return}const{axisInnerRadius:n,axisOuterRadius:r}=this,l=i.map(d=>s.convert(d)),c=s.step??0,p=s instanceof Wr.BandScale?c/2:0;t.visible=!0,this.setSectorNodeProps(t),t.centerX=0,t.centerY=0,t.innerRadius=n,t.outerRadius=r,t.startAngle=l[0]-p,t.endAngle=l[1]+p,this.assignCrossLineGroup(!0,this.crossLineRange)}updateLabelNode(e){const{label:t,labelNode:i,range:s,scale:o,type:a,ticks:n}=this;if(!e||t.enabled===!1||!t.text||!o||a==="range"&&!s){i.visible=!1;return}i.visible=!0;const{axisInnerRadius:r,axisOuterRadius:l}=this;let c,p,d,u;if(a==="line"){const m=Ca(o.convert(this.value)),g=1.5*Math.PI,y=zr(m,g)||m>g||mCa(o.convert(x)));let y=(m+g)/2;m>g&&(y-=Math.PI),y=Ca(y);const f=(zr(y,0)||y>0)&&yl.value),r=n.reduce((l,c)=>Math.max(typeof c=="number"?Ou(c):0,l),0);return{niceDomain:o,tickDomain:o,ticks:n,rawTickCount:void 0,fractionDigits:r,timeInterval:void 0,bbox:this.getBBox()}}update(){super.update(),this.updateRadiusLine(),this.updateGridLines(),this.updateTickLines()}normalizedAngles(){const e=qt(-Math.PI/2+ys(this.startAngle)),t=this.endAngle==null?2*Math.PI:Yu(ys(this.endAngle)-ys(this.startAngle)),i=e+t;return[e,i]}computeRange(){this.range=this.normalizedAngles()}updateSelections(){const e=this.tickData;this.gridLineGroupSelection.update(this.gridLength&&this.gridLine.enabled?e:[]),this.tickLineGroupSelection.update(this.tick.enabled?e:[]),this.tickLabelGroupSelection.update(this.label.enabled?e:[]),this.gridLineGroupSelection.cleanup(),this.tickLineGroupSelection.cleanup(),this.tickLabelGroupSelection.cleanup()}updatePosition(){super.updatePosition();const{translation:e,radiusLineGroup:t}=this,i=Math.floor(e.x),s=Math.floor(e.y);t.translationX=i,t.translationY=s}updateRadiusLine(){const e=this.radiusLine,{path:t}=e;t.clear(!0);const{points:i,closePath:s}=this.getAxisLinePoints();for(const{x:o,y:a,moveTo:n,arc:r,radius:l=0,startAngle:c=0,endAngle:p=0}of i)r?t.arc(o,a,l,c,p):n?t.moveTo(o,a):t.lineTo(o,a);s&&t.closePath(),e.visible=this.line.enabled,e.stroke=this.line.stroke,e.strokeWidth=this.line.width,e.fill=void 0}getAxisLinePoints(){const{scale:e,shape:t,gridLength:i}=this,[s,o]=this.range,a=Ei(o-s,2*Math.PI),n=[];if(t==="circle")a?n.push({x:i,y:0,moveTo:!0},{x:0,y:0,radius:i,startAngle:0,endAngle:2*Math.PI,arc:!0,moveTo:!1}):n.push({x:i*Math.cos(s),y:i*Math.sin(s),moveTo:!0},{x:0,y:0,radius:i,startAngle:qt(s),endAngle:qt(o),arc:!0,moveTo:!1});else if(t==="polygon"){const r=e.ticks({nice:this.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0})?.ticks?.map(l=>e.convert(l));if(r&&r.length>2)for(const[l,c]of r.entries()){const p=i*Math.cos(c),d=i*Math.sin(c),u=l===0;n.push({x:p,y:d,moveTo:u})}}return{points:n,closePath:a}}updateGridLines(){const{scale:e,gridLength:t,gridLine:{style:i,width:s},innerRadiusRatio:o}=this;if(!(i&&t>0))return;const a=t*o,n=i.length;this.gridLineGroupSelection.each((r,l,c)=>{const{value:p}=l,{stroke:d,lineDash:u}=i[c%n],m=e.convert(p);r.x1=a*Math.cos(m),r.y1=a*Math.sin(m),r.x2=t*Math.cos(m),r.y2=t*Math.sin(m),r.stroke=d,r.strokeWidth=s,r.lineDash=u,r.fill=void 0}),this.gridLineGroupSelection.cleanup()}updateLabels(){const{label:e,tickLabelGroupSelection:t}=this;t.each((i,s,o)=>{const a=this.labelData[o];if(!a||a.hidden){i.visible=!1;return}i.text=a.text,i.setFont(e),i.fill=e.color,i.x=a.x,i.y=a.y,i.setAlign(a),i.setBoxing(e),i.visible=!0,a.rotation?(i.rotation=a.rotation,i.rotationCenterX=a.x,i.rotationCenterY=a.y):i.rotation=0})}updateTickLines(){const{scale:e,gridLength:t,tick:i,tickLineGroupSelection:s}=this;s.each((o,a)=>{const{value:n}=a,r=e.convert(n),l=Math.cos(r),c=Math.sin(r);o.x1=t*l,o.y1=t*c,o.x2=(t+i.size)*l,o.y2=(t+i.size)*c,o.stroke=i.stroke,o.strokeWidth=i.width})}createLabelNodeData(e,t,i){const{label:s,gridLength:o,scale:a,tick:n}=this;if(!s.enabled)return[];const r=new qu,l=i.x-this.translation.x,c=i.x+i.width-this.translation.x,{fractionDigits:p}=this.layout.label,d=this.tickFormatter(this.scale.domain,this.tickData,!1,p),u=e.map((m,g)=>{const{value:y}=m,f=o+s.spacing+n.size,S=a.convert(y),x=Math.cos(S),v=Math.sin(S),b=f*x,k=f*v,{textAlign:A,textBaseline:I}=this.getLabelAlign(S),D=g===e.length-1&&y!==e[0]&&Ei(qt(S),qt(a.convert(e[0]))),N=this.getLabelRotation(S);let R=d(y,g);r.text=R,r.x=b,r.y=k,r.setFont(s),r.textAlign=A,r.textBaseline=I,r.rotation=N,N&&(r.rotationCenterX=b,r.rotationCenterY=k);let C=N?ju.toCanvas(r):r.getBBox();if(C&&t.hideWhenNecessary&&!N){const w=l-C.x,G=C.x+C.width-c,_=1;if(w>_||G>_){const L={maxWidth:C.width-Math.max(w,G),font:s,textWrap:"never"};R=_u(R,L),r.text=R,C=r.getBBox()}}return{text:R,x:b,y:k,textAlign:A,textBaseline:I,hidden:R===""||(m.hidden??D),rotation:N,box:C}});return s.avoidCollisions&&this.avoidLabelCollisions(u),u}computeLabelsBBox(e,t){this.labelData=this.createLabelNodeData(this.tickData,e,t);const i=this.labelData.map(({box:s})=>s).filter(s=>s!=null);return!this.label.enabled||i.length===0?null:Ju.merge(i)}getLabelOrientation(){const{label:e}=this;return e instanceof wa?e.orientation:"fixed"}getLabelRotation(e){let t=ys(this.label.rotation??0);e=qt(e);const i=this.getLabelOrientation();return i==="parallel"?(t+=e,e>=0&&e=Math.PI/2&&e<1.5*Math.PI&&(t+=Math.PI)),t}getLabelAlign(e){const t=Math.cos(e),i=Math.sin(e);let s,o;const a=this.getLabelOrientation(),n=Ei(t,0),r=Ei(i,0),l=Ei(t,1),c=Ei(i,-1),p=t>0&&!n,d=i>0&&!r;return a==="parallel"?(s="center",o=l&&r||d?"top":"bottom"):a==="perpendicular"?(s=c||p?"left":"right",o="middle"):(s="right",n?s="center":p&&(s="left"),o="bottom",r?o="middle":d&&(o="top")),{textAlign:s,textBaseline:o}}updateCrossLines(){const{shape:e,gridLength:t,innerRadiusRatio:i}=this;for(const s of this.crossLines)s instanceof Oa&&(s.ticks=this.tickData.map(o=>o.value),s.shape=e,s.axisOuterRadius=t,s.axisInnerRadius=t*i);super.updateCrossLines()}};fs.CrossLineConstructor=Oa,h([_a],fs.prototype,"startAngle",2),h([_a],fs.prototype,"endAngle",2);var{Property:Ea,CategoryScale:Zu}=Tu,di=class extends fs{constructor(e){super(e,new Zu),this.groupPaddingInner=0,this.paddingInner=0,this.interval=new Ra}hasDefinedDomain(){return!1}generateAngleTicks(e){const{scale:t,gridLength:i}=this,{values:s,minSpacing:o}=this.interval,a={nice:this.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0},n=s??t.ticks(a,e)?.ticks??[];if(n.length<2||o==null)return n.map(d=>({value:d,visible:!0}));const r=n[0],l=t.convert(r),c=i*Math.cos(l),p=i*Math.sin(l);for(let d=1;dMath.PI)break;const g=i*Math.cos(m),y=i*Math.sin(m);if(Math.hypot(g-c,y-p)>o){const S=new Set([r]);return Ta(n,d,(x,v)=>{S.add(v)}),n.map(x=>{const v=S.has(x);return{value:x,visible:v}})}}return[{value:r,visible:!0}]}avoidLabelCollisions(e){const{minSpacing:t}=this.label;if(e.length<3)return;const i=(l,c)=>{if(l.hidden||c.hidden)return!1;if(t==null)return l.box.collidesBBox(c.box);const p=l.box.clone().grow(t/2),d=c.box.clone().grow(t/2);return p.collidesBBox(d)},s=e[0],o=e.at(-1),a=new Set([s]),n=Kr(s.x,o.x)&&Kr(s.y,o.y),r=Math.floor(e.length/2);for(let l=1;l<=r;l++){const c=n?e.slice(0,-1):e;if(!Ta(c,l,i)){Ta(c,l,(d,u)=>{a.add(u)});break}}for(const l of e)a.has(l)||(l.hidden=!0,l.box=void 0)}tickFormatParams(){return{type:"category"}}datumFormatParams(e,t){const{datum:i,seriesId:s,legendItemName:o,key:a,source:n,property:r,domain:l,boundSeries:c}=t;return{type:"category",value:e,datum:i,seriesId:s,legendItemName:o,key:a,source:n,property:r,domain:l,boundSeries:c}}};di.className="AngleCategoryAxis",di.type="angle-category",h([Ea],di.prototype,"groupPaddingInner",2),h([Ea],di.prototype,"paddingInner",2),h([Ea],di.prototype,"interval",2);import{_ModuleSupport as Qu}from"ag-charts-community";import{isNumberEqual as Ur}from"ag-charts-core";import{_ModuleSupport as eg}from"ag-charts-community";import{isNumberEqual as tg}from"ag-charts-core";var{range:qr,isDenseInterval:ig,LinearScale:Fa}=eg,jr=class Vr extends Fa{constructor(){super(...arguments),this.arcLength=0}static getNiceStepAndTickCount(t,i){const[s,o]=i;let a=Fa.getTickStep(s,o,t);const n=Number.isNaN(t.maxTickCount)?1/0:t.maxTickCount,r=Math.abs(o-s)/a;let l=Math.pow(2,Math.ceil(Math.log(r)/Math.log(2)));return l>n&&(l/=2,a*=2),{count:l,step:a}}ticks(t,i=this.domain){const{arcLength:s}=this;if(!i||i.length<2||i.some(c=>!Number.isFinite(c))||s<=0)return{ticks:[],count:0};const{nice:o,interval:a}=t,[n,r]=i;if(a){const c=Math.abs(a),p=this.getPixelRange();if(!ig((r-n)/c,p))return qr(n,r,c)}let l;if(o&&this.hasNiceRange()){const c=super.niceDomain(t,i);l=Vr.getNiceStepAndTickCount(t,c).step}else l=Fa.getTickStep(n,r,t);return qr(n,r,l)}hasNiceRange(){const t=this.range.slice().sort((s,o)=>s-o);return[Math.PI,2*Math.PI].some(s=>tg(s,t[1]-t[0]))}niceDomain(t,i=this.domain){const s=super.niceDomain(t,i);if(!this.hasNiceRange())return s;const o=s[0]>s[1],a=o?s[1]:s[0],{step:n,count:r}=Vr.getNiceStepAndTickCount(t,s),l=1/n,c=n>=1?Math.ceil(a/n+r)*n:Math.ceil((a+r*n)*l)/l;return o?[c,a]:[a,c]}getPixelRange(){return this.arcLength}},{Property:Ba,angleBetween:sg,normalisedExtentWithMetadata:og,findMinMax:ag}=Qu,Fi=class extends fs{constructor(e){super(e,new jr),this.shape="circle",this.interval=new Ra}hasDefinedDomain(){const{min:e,max:t}=this;return e!=null&&t!=null&&ed>=c&&d<=p).sort((d,u)=>d-u)}return l.map(c=>({value:c,visible:!0}))}avoidLabelCollisions(e){const{minSpacing:t}=this.label,i=(a,n)=>{if(a.hidden||n.hidden)return!1;if(t==null)return a.box.collidesBBox(n.box);const r=a.box.clone().grow(t/2),l=n.box.clone().grow(t/2);return r.collidesBBox(l)},s=e[0],o=e.at(-1);s!==o&&Ur(s.x,o.x)&&Ur(s.y,o.y)&&(o.hidden=!0);for(let a=1;a0&&(l.hidden=!0,l.box=void 0);return}}for(const[a,n]of e.entries())a>0&&(n.hidden=!0,n.box=void 0)}tickFormatParams(e,t,i){return{type:"number",fractionDigits:i}}datumFormatParams(e,t,i){const{datum:s,seriesId:o,legendItemName:a,key:n,source:r,property:l,domain:c,boundSeries:p}=t;return{type:"number",value:e,datum:s,seriesId:o,legendItemName:a,key:n,source:r,property:l,domain:c,boundSeries:p,fractionDigits:i}}};Fi.className="AngleNumberAxis",Fi.type="angle-number",h([Ba],Fi.prototype,"min",2),h([Ba],Fi.prototype,"max",2),h([Ba],Fi.prototype,"interval",2);import{_ModuleSupport as Jr}from"ag-charts-community";var{OrdinalTimeScale:ng,Property:rg,TimeAxisParentLevel:lg,lowestGranularityUnitForTicks:cg,lowestGranularityUnitForValue:hg,minimumTimeAxisDatumGranularity:pg,dateTruncationForDomain:dg,intervalUnit:Zr,intervalStep:Qr,intervalEpoch:el,intervalMilliseconds:tl}=Jr,js=class extends Jr.DiscreteTimeAxis{constructor(e){super(e,new ng),this.parentLevel=new lg}get primaryLabel(){return this.parentLevel.enabled?this.parentLevel.label:void 0}get primaryTick(){return this.parentLevel.enabled?this.parentLevel.tick:void 0}processData(){super.processData();const{boundSeries:e,direction:t}=this;this.minimumTimeGranularity=pg(e,t,void 0,void 0)}tickFormatParams(e,t,i,s){s??(s=cg(t));const o=dg(e),a=Zr(s),n=Qr(s),r=el(s);return{type:"date",unit:a,step:n,epoch:r,truncateDate:o}}datumFormatParams(e,t,i,s,o){if(typeof e=="number"&&(e=new Date(e)),s==null){const{minimumTimeGranularity:f}=this,S=hg(e);f!=null&&tl(f)=this.axisInnerRadius&&s<=this.axisOuterRadius),this.rangeGroup.visible=e,this.lineGroup.visible=e,this.labelGroup.visible=e,this.updatePolygonNode(e),this.updateSectorNode(e),this.updateLabelNode(e),this.assignCrossLineGroup(this.type==="range",this.crossLineRange)}updateRadii(){const{range:e,scale:t,type:i,axisInnerRadius:s,axisOuterRadius:o}=this;if(!t)return{innerRadius:0,outerRadius:0};const a=l=>o+s-l;let n,r;if(i==="line")n=a(t.convert(this.value)),r=n;else{const l=Math.abs(t?.bandwidth??0),c=e.map(p=>t.convert(p));n=a(Math.max(...c)),r=a(Math.min(...c))+l}this.outerRadius=n,this.innerRadius=r}drawPolygon(e,t,i){for(const[s,o]of t.entries()){const a=e*Math.cos(o),n=e*Math.sin(o);s===0?i.path.moveTo(a,n):i.path.lineTo(a,n)}i.path.closePath()}updatePolygonNode(e){const{gridAngles:t,polygonNode:i,scale:s,shape:o,type:a,innerRadius:n,outerRadius:r}=this;if(!e||o!=="polygon"||!s||!t){i.visible=!1;return}i.visible=!0;const l=this.getPadding();i.path.clear(!0),this.drawPolygon(r-l,t,i);const c=t.slice().reverse(),p=a==="line"?r-l:n+l;this.drawPolygon(p,c,i),this.setSectorNodeProps(i)}updateSectorNode(e){const{axisInnerRadius:t,axisOuterRadius:i,scale:s,sectorNode:o,shape:a,innerRadius:n,outerRadius:r}=this;if(!e||a!=="circle"||!s){o.visible=!1;return}o.visible=!0,o.startAngle=0,o.endAngle=2*Math.PI;const l=this.getPadding(),c=sl(t,n+l,i),p=sl(t,r-l,i);o.innerRadius=Math.min(c,p),o.outerRadius=Math.max(c,p),this.setSectorNodeProps(o)}updateLabelNode(e){const{innerRadius:t,label:i,labelNode:s,scale:o,shape:a,type:n}=this;if(!e||i.enabled===!1||!i.text||!o){s.visible=!1;return}const r=xg((i.positionAngle??0)-90),l=(mg(r,0)||r>0)&&rthis.tickFormatter(...x),domain:e,range:n,reverse:r,niceMode:t,visibleRange:s,defaultTickMinSpacing:l,labelOffset:a,sideFlag:o,axisRotation:0,sizeLimit:void 0,primaryTickCount:void 0}),{tickData:p}=c,{ticks:d,rawTicks:u,rawTickCount:m,tickDomain:g,fractionDigits:y,niceDomain:f=e}=p,S=d.map(x=>this.getTickLabelProps(x,c));return this.generatedTicks={ticks:d,labels:S},{ticks:u,tickDomain:g,niceDomain:f,rawTickCount:m,fractionDigits:y,timeInterval:void 0}}updateSelections(){const{generatedTicks:e}=this;if(!e)return;const{ticks:t,labels:i}=e;this.gridLineGroupSelection.update(this.gridLength?t:[]),this.tickLabelGroupSelection.update(i),this.gridPathSelection.update(this.gridLine.enabled?this.prepareGridPathTickData(t):[]),this.gridLineGroupSelection.cleanup(),this.tickLabelGroupSelection.cleanup(),this.gridPathSelection.cleanup()}updateLabels(){if(!this.label.enabled)return;const e=Js.resetAxisLabelSelectionFn();this.tickLabelGroupSelection.each((t,i)=>{t.fill=i.color,t.text=i.text,t.textBaseline=i.textBaseline,t.textAlign=i.textAlign??"center",t.setFont(i),t.setBoxing(i),t.setProperties(e(t,i))})}updateGridLines(){const{gridLine:{style:e,width:t},shape:i,generatedTicks:s}=this;if(!e||!s)return;const o=e.length,a=(u,m)=>{const{stroke:g,lineDash:y}=e[m%o];u.stroke=g,u.strokeWidth=t,u.lineDash=y,u.fill=void 0},[n,r]=this.gridRange??[0,2*Math.PI],l=gg(r-n,2*Math.PI),d=i==="circle"?(u,m)=>{const{path:g}=u;g.clear(!0);const y=this.getTickRadius(m);l?(g.moveTo(y,0),g.arc(0,0,y,0,2*Math.PI)):(g.moveTo(y*Math.cos(n),y*Math.sin(n)),g.arc(0,0,y,al(n),al(r))),l&&g.closePath()}:(u,m)=>{const{path:g}=u,y=this.gridAngles;if(g.clear(!0),!y||y.length<3)return;const f=this.getTickRadius(m);for(const[S,x]of y.entries()){const v=f*Math.cos(x),b=f*Math.sin(x);S===0?g.moveTo(v,b):g.lineTo(v,b);for(const[k,A]of y.entries()){const I=f*Math.cos(A),D=f*Math.sin(A);k===0?g.moveTo(I,D):g.lineTo(I,D)}g.closePath()}g.closePath()};this.gridPathSelection.each((u,m,g)=>{a(u,g),d(u,m)})}updateTitle(){const e=n=>n.defaultValue,{title:t,range:i}=this,{formatter:s=e}=this.title;t.caption.enabled=t.enabled,t.caption.fontFamily=t.fontFamily,t.caption.fontSize=t.fontSize,t.caption.fontStyle=t.fontStyle,t.caption.fontWeight=t.fontWeight,t.caption.color=t.color,t.caption.wrapping=t.wrapping;let o=!1;const a=t.caption.node;t.enabled&&(o=!0,a.rotation=Math.PI/2,a.x=Math.floor((i[0]+i[1])/2),a.y=-Ng.SMALL_PADDING,a.textAlign="center",a.textBaseline="bottom",a.text=this.cachedCallWithContext(s,this.getTitleFormatterParams(this.scale.domain))),a.visible=o}updateCrossLines(){for(const e of this.crossLines)if(e instanceof Ga){const{shape:t,gridAngles:i,range:s,innerRadiusRatio:o}=this,a=s[0];e.shape=t,e.gridAngles=i,e.axisOuterRadius=a,e.axisInnerRadius=a*o}super.updateCrossLines()}createLabel(){return new Ka}getTickLabelProps(e,t){const{label:i}=this,{rotation:s,textBaseline:o,textAlign:a}=t,n=this.scale.range,r=e.tickLabel??"",c=i.getSideFlag()*(this.getTickSize()+i.spacing+this.seriesAreaPadding),p=r!==""&&r!=null,d=s;return{...this.getLabelStyles({value:e.tick,formattedValue:e.tickLabel}),tickId:e.tickId,rotation:d,text:r,textAlign:a,textBaseline:o,visible:p,x:c,y:e.translation,rotationCenterX:c,rotationCenterY:e.translation,range:n}}};Zs.CrossLineConstructor=Ga,h([Va],Zs.prototype,"positionAngle",2);var{ProxyPropertyOnWrite:cl,Property:Wa,CategoryScale:hl}=ug,ui=class extends Zs{constructor(e){super(e,new hl),this.shape="circle",this.groupPaddingInner=0,this.paddingInner=0,this.paddingOuter=0}hasDefinedDomain(){return!1}normaliseDataDomain(e){return{domain:e,clipped:!1}}prepareGridPathTickData(e){return e.slice().reverse()}getTickRadius(e){const{scale:t,innerRadiusRatio:i}=this,s=t.range[0],o=s*i;if(hl.is(t)){const a=t.domain,n=a.length-1-a.indexOf(e.tick);return n===0?o:t.inset+t.step*(n-.5)+t.bandwidth/2}else{const a=(s-o)/t.domain.length;return s-e.translation+o-a/2}}tickFormatParams(){return{type:"category"}}datumFormatParams(e,t){const{datum:i,seriesId:s,legendItemName:o,key:a,source:n,property:r,domain:l,boundSeries:c}=t;return{type:"category",value:e,datum:i,seriesId:s,legendItemName:o,key:a,source:n,property:r,domain:l,boundSeries:c}}};ui.className="RadiusCategoryAxis",ui.type="radius-category",h([Wa],ui.prototype,"groupPaddingInner",2),h([cl("scale","paddingInner"),Wa],ui.prototype,"paddingInner",2),h([cl("scale","paddingOuter"),Wa],ui.prototype,"paddingOuter",2);import{_ModuleSupport as Cg}from"ag-charts-community";var{Property:pl,normalisedExtentWithMetadata:Og,LinearScale:_g}=Cg,Ss=class extends Zs{constructor(e){super(e,new _g),this.shape="polygon"}hasDefinedDomain(){const{min:e,max:t}=this;return e!=null&&t!=null&&es!==i).sort((s,o)=>o.tick-s.tick)}getTickRadius(e){const{scale:t}=this,i=t.range[0],s=i*this.innerRadiusRatio;return i-e.translation+s}normaliseDataDomain(e){const{min:t,max:i}=this,{extent:s,clipped:o}=Og(e,t,i);return{domain:s,clipped:o}}tickFormatParams(e,t,i){return{type:"number",fractionDigits:i}}datumFormatParams(e,t,i){const{datum:s,seriesId:o,legendItemName:a,key:n,source:r,property:l,domain:c,boundSeries:p}=t;return{type:"number",value:e,datum:s,seriesId:o,legendItemName:a,key:n,source:r,property:l,domain:c,boundSeries:p,fractionDigits:i}}};Ss.className="RadiusNumberAxis",Ss.type="radius-number",h([pl],Ss.prototype,"min",2),h([pl],Ss.prototype,"max",2);var{ordinalTimeAxisOptionsDefs:wg,angleNumberAxisOptionsDefs:Eg,angleCategoryAxisOptionsDefs:Fg,radiusNumberAxisOptionsDefs:Bg,radiusCategoryAxisOptionsDefs:Gg}=Lu,dl={type:"axis",name:"ordinal-time",chartType:"cartesian",enterprise:!0,options:wg,create:e=>new js(e)},ul={type:"axis",name:"angle-number",chartType:"polar",enterprise:!0,options:Eg,create:e=>new Fi(e)},gl={type:"axis",name:"angle-category",chartType:"polar",enterprise:!0,options:Fg,create:e=>new di(e)},ml={type:"axis",name:"radius-number",chartType:"polar",enterprise:!0,options:Bg,create:e=>new Ss(e)},yl={type:"axis",name:"radius-category",chartType:"polar",enterprise:!0,options:Gg,create:e=>new ui(e)};import{_ModuleSupport as Vg}from"ag-charts-community";import{_ModuleSupport as Kg}from"ag-charts-community";var{Chart:Wg}=Kg,za=class extends Wg{getChartType(){return"standalone"}performLayout(e){const{seriesRoot:t,annotationRoot:i}=this,{layoutBox:s}=e,o=s.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=o,this.animationRect=o;for(const a of[t,i])a.translationX=Math.floor(o.x),a.translationY=Math.floor(o.y);t.visible=this.series[0].visible,this.ctx.layoutManager.emitLayoutComplete(e,{series:{visible:!0,rect:o,paddedRect:s}})}getAriaLabel(){const e=this.series[0]?.type;if(e==null)return"";const t=this.getCaptionText();switch(e){case"radial-gauge":case"linear-gauge":{const i=[];t.length!==0&&i.push(t);for(const s of this.series)i.push(s.getCaptionText());return this.ctx.localeManager.t("ariaAnnounceGaugeChart",{caption:i.join(". ")})}case"treemap":case"sunburst":return this.ctx.localeManager.t("ariaAnnounceHierarchyChart",{caption:t});default:return this.ctx.localeManager.t("ariaAnnounceStandaloneChart",{caption:t})}}};za.className="StandaloneChart",za.type="standalone";var{isAgStandaloneChartOptions:zg,standaloneChartOptionsDefs:$g}=Vg,fl={type:"chart",name:"standalone",enterprise:!0,options:$g,detect:zg,create(e,t){return new za(e,t)}};import{_ModuleSupport as Hg}from"ag-charts-community";import{_ModuleSupport as Xg}from"ag-charts-community";var{Chart:Yg,MercatorScale:Sl,ChartAxisDirection:Qs,Property:Ug}=Xg;function xl(e){return e.type==="map-shape"||e.type==="map-line"||e.type==="map-marker"||e.type==="map-shape-background"||e.type==="map-line-background"}var eo=class extends Yg{constructor(e,t){super(e,t),this.ctx.zoomManager.updateAxes([Qs.X,Qs.Y])}getChartType(){return"topology"}async updateData(){await super.updateData();const e=this.getOptions();this.topology!==e.topology&&(this.topology=e.topology);const{topology:t}=this;for(const i of this.series)xl(i)&&i.setChartTopology(t)}performLayout(e){const{seriesRoot:t,annotationRoot:i}=this,{layoutBox:s}=e,o=s.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=o,this.animationRect=o;const a=this.series.filter(xl),n=a.reduce((c,p)=>{if(!p.visible)return c;const d=p.topologyBounds;return d==null?c:c==null?d:c.merge(d)},void 0);let r;if(n!=null){const{lon0:c,lat0:p,lon1:d,lat1:u}=n,m=[[c,p],[d,u]],g=Sl.bounds(m),{width:y,height:f}=o,S=Math.min(y/g.width,f/g.height),x=g.width*S,v=g.height*S,b=(y-x)/2,k=(f-v)/2,A=b,I=k,D=b+x,N=k+v,R=this.ctx.zoomManager.getAxisZoom(Qs.X),C=this.ctx.zoomManager.getAxisZoom(Qs.Y),w=(D-A)/(R.max-R.min),G=A-w*R.min,_=(N-I)/(1-C.min-(1-C.max)),E=I-_*(1-C.max);r=new Sl(m,[[G,E],[G+w,E+_]])}for(const c of a)c.scale=r;const l=this.series.some(c=>c.visible);t.visible=l;for(const c of[t,i])c.translationX=Math.floor(o.x),c.translationY=Math.floor(o.y),c.setClipRect(o.clone());this.ctx.layoutManager.emitLayoutComplete(e,{series:{visible:l,rect:o,paddedRect:s}})}};eo.className="TopologyChart",eo.type="topology",h([Ug],eo.prototype,"topology",2);var{isAgTopologyChartOptions:qg,topologyChartOptionsDefs:jg}=Hg,bl={type:"chart",name:"topology",enterprise:!0,options:jg,detect:qg,create(e,t){return new eo(e,t)}};import{_ModuleSupport as Jg}from"ag-charts-community";import{_ModuleSupport as Zg}from"ag-charts-community";import{and as to,arrayOf as Qg,arrayOfDefs as vl,boolean as gi,constant as kl,greaterThan as Dl,lessThan as Il,number as Ct,numberRange as em,optionsDefs as Al,or as mi,ratio as io,required as tm,string as kt,typeUnion as im,union as sm}from"ag-charts-core";var{annotationCalloutStylesDefs:om,annotationNoteStylesDefs:am,annotationTextStylesDef:nm,annotationCommentStylesDefs:rm,annotationMeasurerStylesDefs:so,annotationQuickMeasurerStylesDefs:lm,annotationShapeStylesDefs:Ml,annotationChannelTextDefs:cm,annotationCrossLineStyleDefs:Nl,annotationFibonacciStylesDefs:Ll,annotationLineStyleDefs:Tl,annotationLineTextDefs:hm,annotationDisjointChannelStyleDefs:pm,annotationParallelChannelStyleDefs:dm}=Zg,xs=Al({__type:tm(kl("date")),value:mi(kt,Ct)},"a serializable date object"),Rl=mi(kt,Ct,xs),$a=mi(Rl,Al({value:Rl,groupPercentage:em(-1,2)})),Pl={...cm,label:kt},Ot={...hm,label:kt},ge={x:$a,y:Ct},um=im({line:{...Tl,start:ge,end:ge,text:Ot},"horizontal-line":{...Nl,value:$a,text:Ot},"vertical-line":{...Nl,value:$a,text:Ot},"disjoint-channel":{...pm,startHeight:Ct,endHeight:Ct,start:ge,end:ge,text:Pl},"parallel-channel":{...dm,height:Ct,start:ge,end:ge,text:Pl},"fibonacci-retracement":{...Ll,start:ge,end:ge,text:Ot,reverse:gi},"fibonacci-retracement-trend-based":{...Ll,start:ge,end:ge,endRetracement:ge,text:Ot,reverse:gi},callout:{...om,start:ge,end:ge,text:kt},comment:{...rm,...ge,text:kt},note:{...am,...ge,text:kt},text:{...nm,...ge,text:kt},arrow:{...Tl,text:Ot,start:ge,end:ge},"arrow-up":{...Ml,...ge},"arrow-down":{...Ml,...ge},"date-range":{...so,extendAbove:gi,extendBelow:gi,text:Ot,start:ge,end:ge},"price-range":{...so,extendLeft:gi,extendRight:gi,text:Ot,start:ge,end:ge},"date-price-range":{...so,text:Ot,start:ge,end:ge},"quick-date-price-range":{...so,...lm,text:Ot,start:ge,end:ge}},"an annotation initial state object"),gm={chartType:sm("candlestick","hollow-candlestick","ohlc","line","step-line","hlc","high-low"),annotations:vl(um),legend:vl({visible:gi,seriesId:kt,itemId:kt,legendItemName:kt},"legend state array"),zoom:{rangeX:{start:mi(Ct,xs),end:mi(Ct,xs)},rangeY:{start:mi(Ct,xs),end:mi(Ct,xs)},ratioX:{start:to(io,Il("end")),end:to(io,Dl("start"))},ratioY:{start:to(io,Il("end")),end:to(io,Dl("start"))},autoScaledAxes:Qg(kl("y"))}};import{_ModuleSupport as mm}from"ag-charts-community";import{array as ym,arrayOfDefs as fm,boolean as bs,callbackOf as Sm,color as oo,fontOptionsDef as xm,number as Cl,positiveNumber as gt,ratio as bm,typeUnion as vm}from"ag-charts-core";import{_ModuleSupport as Ol}from"ag-charts-community";import{_ModuleSupport as ao}from"ag-charts-community";function km(e){return{from:e?{scalingX:1,scalingY:0}:{scalingX:0,scalingY:1},to:{scalingX:1,scalingY:1}}}function Dm(e){return(t,i)=>e?{scalingCenterY:i.scaledValues.medianValue}:{scalingCenterX:i.scaledValues.medianValue}}import{_ModuleSupport as Im}from"ag-charts-community";var{Path:Am,Scalable:Mm,ExtendedPath2D:Nm,SceneChangeDetection:He,SceneArrayChangeDetection:Lm,BBox:yi,clippedRoundRect:_l}=Im,Ee=class extends Mm(Am){constructor(){super(...arguments),this.wickPath=new Nm,this.horizontal=!1,this.center=0,this.thickness=0,this.min=0,this.q1=0,this.median=0,this.q3=0,this.max=0,this.cornerRadius=0,this.crisp=!1,this.strokeAlignment=0,this.wickStroke=void 0,this.wickStrokeWidth=void 0,this.wickStrokeOpacity=void 0,this.capLengthRatio=1,this.wickStrokeAlignment=0}computeBBox(){const{horizontal:e,center:t,thickness:i,min:s,max:o}=this;return e?new yi(Math.min(s,o),t-i/2,Math.abs(o-s),i):new yi(t-i/2,Math.min(s,o),i,Math.abs(o-s))}computeDefaultGradientFillBBox(){const{horizontal:e,center:t,thickness:i,q1:s,q3:o}=this;return e?new yi(Math.min(s,o),t-i/2,Math.abs(o-s),i):new yi(t-i/2,Math.min(s,o),i,Math.abs(o-s))}isPointInPath(e,t){return this.getBBox().containsPoint(e,t)}distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}get midPoint(){return this.horizontal?{x:(this.min+this.max)/2,y:this.center}:{x:this.center,y:(this.min+this.max)/2}}alignedCoordinates(){const{thickness:e,crisp:t}=this;let{center:i,min:s,q1:o,median:a,q3:n,max:r}=this,l=i-e/2,c=i+e/2;if(t&&e>1){s=this.align(s),o=this.align(o),a=this.align(a),n=this.align(n),r=s+this.align(s,r-s);const p=this.align(e/2);i=this.align(i),l=i-p,c=i+p}return{center:i,x0:l,x1:c,min:s,max:r,q1:o,median:a,q3:n}}updatePath(){const{path:e,stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:o,lineDashOffset:a,wickStroke:n,wickStrokeWidth:r,wickStrokeOpacity:l,wickLineDash:c,wickLineDashOffset:p,strokeAlignment:d,cornerRadius:u,capLengthRatio:m,horizontal:g}=this,{center:y,x0:f,x1:S,min:x,max:v,q1:b,median:k,q3:A}=this.alignedCoordinates(),I=this.layerManager?.canvas.pixelRatio??1,D=this.wickStrokeAlignment>0?I/this.wickStrokeAlignment/2%1:0;this.path.clear(),this.wickPath.clear();const R=n!=null&&n!==t||r!=null&&r!==i||l!=null&&l!==s||c!=null&&c!==o||p!=null&&p!==a?this.wickPath:e;if(Math.abs(S-f)<=3){Bi(R,g,y,x),Gi(R,g,y,v);return}const C=Math.min(x,v),w=Math.max(x,v),G=Math.min(b,A),_=Math.max(b,A),E=y-Math.abs((S-f)*m)/2,L=y+Math.abs((S-f)*m)/2;Bi(R,g,E,C-D),Gi(R,g,L,C-D),Bi(R,g,y-D,C-D),Gi(R,g,y-D,G+i/2),Bi(R,g,y-D,w+D),Gi(R,g,y-D,_-i/2),Bi(R,g,E,w+D),Gi(R,g,L,w+D);const P=i/2+d,T=i/2-d,M=_-G-2*T;if(M>0){const O=f+P,B=G+T,F=S-f-2*P,V={topLeft:u,topRight:u,bottomRight:u,bottomLeft:u};wl(e,g,O,B,F,M,V,new yi(O,B,F,k-B)),wl(e,g,O,B,F,M,V,new yi(O,k,F,B+M-k))}else{const O=(G+_)/2;Bi(e,g,f,O),Gi(e,g,S,O)}}drawPath(e){super.drawPath(e);const{wickPath:t}=this;if(t.isEmpty())return;const{stroke:i,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n,wickStroke:r=i,wickStrokeWidth:l=s,wickStrokeOpacity:c=o,wickLineDash:p=a,wickLineDashOffset:d=n}=this;l!==0&&(e.globalAlpha*=c,typeof r=="string"&&(e.strokeStyle=r),e.lineWidth=l,p!=null&&e.setLineDash([...p]),e.lineDashOffset=d,e.stroke(t.getPath2D()))}};h([He()],Ee.prototype,"horizontal",2),h([He()],Ee.prototype,"center",2),h([He()],Ee.prototype,"thickness",2),h([He()],Ee.prototype,"min",2),h([He()],Ee.prototype,"q1",2),h([He()],Ee.prototype,"median",2),h([He()],Ee.prototype,"q3",2),h([He()],Ee.prototype,"max",2),h([He()],Ee.prototype,"cornerRadius",2),h([He()],Ee.prototype,"crisp",2),h([He()],Ee.prototype,"strokeAlignment",2),h([He()],Ee.prototype,"wickStroke",2),h([He()],Ee.prototype,"wickStrokeWidth",2),h([He()],Ee.prototype,"wickStrokeOpacity",2),h([Lm()],Ee.prototype,"wickLineDash",2),h([He()],Ee.prototype,"wickLineDashOffset",2),h([He()],Ee.prototype,"capLengthRatio",2),h([He()],Ee.prototype,"wickStrokeAlignment",2);function Bi(e,t,i,s){t?e.moveTo(s,i):e.moveTo(i,s)}function Gi(e,t,i,s){t?e.lineTo(s,i):e.lineTo(i,s)}function wl(e,t,i,s,o,a,n,r){t?_l(e,s,i,a,o,n,r==null?void 0:new yi(r.y,r.x,r.height,r.width)):_l(e,i,s,o,a,n,r)}import{_ModuleSupport as Tm}from"ag-charts-community";var{BaseProperties:El,AbstractBarSeriesProperties:Rm,makeSeriesTooltip:Pm,Property:he,mergeDefaults:Cm}=Tm,Fl=class extends El{constructor(){super(...arguments),this.lengthRatio=.5}};h([he],Fl.prototype,"lengthRatio",2);var Vi=class extends El{};h([he],Vi.prototype,"stroke",2),h([he],Vi.prototype,"strokeWidth",2),h([he],Vi.prototype,"strokeOpacity",2),h([he],Vi.prototype,"lineDash",2),h([he],Vi.prototype,"lineDashOffset",2);var me=class extends Rm{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.cap=new Fl,this.whisker=new Vi,this.tooltip=Pm()}toJson(){const{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:s,lineDashOffset:o}=this,a=super.toJson();return a.whisker=Cm(a.whisker,{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:s,lineDashOffset:o}),a}};h([he],me.prototype,"xKey",2),h([he],me.prototype,"minKey",2),h([he],me.prototype,"q1Key",2),h([he],me.prototype,"medianKey",2),h([he],me.prototype,"q3Key",2),h([he],me.prototype,"maxKey",2),h([he],me.prototype,"xName",2),h([he],me.prototype,"yName",2),h([he],me.prototype,"minName",2),h([he],me.prototype,"q1Name",2),h([he],me.prototype,"medianName",2),h([he],me.prototype,"q3Name",2),h([he],me.prototype,"maxName",2),h([he],me.prototype,"fill",2),h([he],me.prototype,"fillOpacity",2),h([he],me.prototype,"stroke",2),h([he],me.prototype,"strokeWidth",2),h([he],me.prototype,"strokeOpacity",2),h([he],me.prototype,"lineDash",2),h([he],me.prototype,"lineDashOffset",2),h([he],me.prototype,"cornerRadius",2),h([he],me.prototype,"styler",2),h([he],me.prototype,"itemStyler",2),h([he],me.prototype,"cap",2),h([he],me.prototype,"whisker",2),h([he],me.prototype,"tooltip",2);var{fixNumericExtent:Om,keyProperty:_m,mergeDefaults:Ha,SeriesNodePickMode:Bl,SMALLEST_KEY_INTERVAL:wm,valueProperty:vs,diff:Em,animationValidation:Fm,computeBarFocusBounds:Bm,createDatumId:Gm,HighlightState:Xa,ContinuousScale:Vm,ChartAxisDirection:Km,motion:Gl,getItemStyles:Wm,applyShapeFillBBox:zm,calculateSegments:$m,toHighlightString:Hm}=ao,Xm=class extends ao.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.minKey=s.properties.minKey,this.q1Key=s.properties.q1Key,this.medianKey=s.properties.medianKey,this.q3Key=s.properties.q3Key,this.maxKey=s.properties.maxKey}},no=class extends ao.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[Bl.NEAREST_NODE,Bl.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["medianKey","q1Key","q3Key","minKey","maxKey"]},propertyNames:{x:["xName"],y:["medianName","q1Name","q3Name","minName","maxName"]},categoryKey:"xValue",pathsPerSeries:[]}),this.properties=new me,this.NodeEvent=Xm}async processData(e){if(!this.visible)return;const{xKey:t,minKey:i,q1Key:s,medianKey:o,q3Key:a,maxKey:n}=this.properties,r=!this.ctx.animationManager.isSkipped(),l=this.getCategoryAxis()?.scale,c=this.getValueAxis()?.scale,{isContinuousX:p,xScaleType:d,yScaleType:u}=this.getScaleInformation({xScale:l,yScale:c}),m=[];r&&this.processedData&&m.push(Em(this.id,this.processedData)),r&&m.push(Fm());const{processedData:g}=await this.requestDataModel(e,this.data,{props:[_m(t,d,{id:"xValue"}),vs(i,u,{id:"minValue"}),vs(s,u,{id:"q1Value"}),vs(o,u,{id:"medianValue"}),vs(a,u,{id:"q3Value"}),vs(n,u,{id:"maxValue"}),...p?[wm]:[],...m]});this.smallestDataInterval=g.reduced?.smallestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];if(e!==this.getBarDirection()){const{index:o,def:a}=i.resolveProcessedDataDefById(this,"xValue"),n=t.domain.keys[o];return a.type==="key"&&a.valueType==="category"?n:this.padBandExtent(n)}const s=this.domainForClippedRange(e,["minValue","maxValue"],"xValue");return Om(s)}getSeriesRange(e,t){return this.domainForVisibleRange(Km.Y,["maxValue","minValue"],"xValue",t)}createNodeData(){const{visible:e,dataModel:t,processedData:i}=this,s=this.getCategoryAxis(),o=this.getValueAxis();if(!(t&&i&&s&&o))return;const{xKey:a}=this.properties,n=[],r=t.resolveKeysById(this,"xValue",i),l=t.resolveColumnById(this,"minValue",i),c=t.resolveColumnById(this,"q1Value",i),p=t.resolveColumnById(this,"medianValue",i),d=t.resolveColumnById(this,"q3Value",i),u=t.resolveColumnById(this,"maxValue",i),{barWidth:m,groupIndex:g}=this.updateGroupScale(s),y=Vm.is(s.scale)?m*-.5:0,{groupScale:f}=this,S=this.isVertical(),x=$m(this.properties.segmentation,s,o,this.chart.seriesRect,this.ctx.scene),v={itemId:a,nodeData:n,labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:Wm(this.getItemStyle.bind(this)),segments:x};if(!e)return v;const b=i.dataSources.get(this.id)?.data??[];for(const[k,A]of b.entries()){const I=r[k];if(I==null)continue;const D=l[k],N=c[k],R=p[k],C=d[k],w=u[k];if([D,N,R,C,w].some(O=>typeof O!="number")||D>N||N>R||R>C||C>w)continue;const G={xValue:s.scale.convert(I),minValue:o.scale.convert(D),q1Value:o.scale.convert(N),medianValue:o.scale.convert(R),q3Value:o.scale.convert(C),maxValue:o.scale.convert(w)},_=m;G.xValue+=f.convert(String(g))+y+_/2;const E=Math.abs(G.q3Value-G.q1Value),L=G.xValue,P=Math.min(G.q3Value,G.q1Value)+E/2,T={x:S?L:P,y:S?P:L};let M;S?M={x:T.x-_/2,y:G.minValue,width:_,height:G.maxValue-G.minValue}:M={x:G.minValue,y:T.y-_/2,width:G.maxValue-G.minValue,height:_},n.push({series:this,itemId:I,datum:A,datumIndex:k,xKey:a,bandwidth:_,scaledValues:G,midPoint:T,focusRect:M})}return v}legendItemSymbol(){const{fill:e,stroke:t,strokeWidth:i,fillOpacity:s,strokeOpacity:o,lineDash:a,lineDashOffset:n}=this.getStyle(!1,!1,Xa.None);return{marker:{fill:ao.deepClone(e),fillOpacity:s,stroke:t,strokeOpacity:o,strokeWidth:i,lineDash:a,lineDashOffset:n}}}getLegendData(e){const{id:t,ctx:{legendManager:i},visible:s}=this,{xKey:o,yName:a,showInLegend:n,legendItemName:r}=this.properties;return!o||e!=="category"?[]:[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:s&&i.getItemEnabled({seriesId:t,itemId:t}),label:{text:r??a??t},symbol:this.legendItemSymbol(),legendItemName:r,hideInLegend:!n}]}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:o}=this,{xKey:a,xName:n,yName:r,medianKey:l,medianName:c,q1Key:p,q1Name:d,q3Key:u,q3Name:m,minKey:g,minName:y,maxKey:f,maxName:S,legendItemName:x,tooltip:v}=o,b=this.getCategoryAxis(),k=this.getValueAxis();if(!i||!s||!b||!k)return;const A=s.dataSources.get(this.id)?.data[e],I=i.resolveKeysById(this,"xValue",s)[e],D=i.resolveColumnById(this,"minValue",s)[e],N=i.resolveColumnById(this,"q1Value",s)[e],R=i.resolveColumnById(this,"medianValue",s)[e],C=i.resolveColumnById(this,"q3Value",s)[e],w=i.resolveColumnById(this,"maxValue",s)[e];if(I==null)return;const G=this.getItemStyle(e,!1),_=[{label:y,fallbackLabel:g,value:this.getAxisValueText(k,"tooltip",D,A,g,x)},{label:d,fallbackLabel:p,value:this.getAxisValueText(k,"tooltip",N,A,p,x)},{label:c,fallbackLabel:l,value:this.getAxisValueText(k,"tooltip",R,A,l,x)},{label:m,fallbackLabel:u,value:this.getAxisValueText(k,"tooltip",C,A,u,x)},{label:S,fallbackLabel:f,value:this.getAxisValueText(k,"tooltip",w,A,f,x)}];return this.formatTooltipWithContext(v,{heading:this.getAxisValueText(b,"tooltip",I,A,a,x),title:x??r,symbol:this.legendItemSymbol(),data:_},{seriesId:t,datum:A,title:r,xKey:a,xName:n,yName:r,medianKey:l,medianName:c,q1Key:p,q1Name:d,q3Key:u,q3Name:m,minKey:g,minName:y,maxKey:f,maxName:S,...G})}animateEmptyUpdateReady({datumSelection:e}){const t=this.isVertical(),{from:i,to:s}=km(t);Gl.resetMotion([e],Dm(t)),Gl.staticFromToMotion(this.id,"datums",this.ctx.animationManager,[e],i,s,{phase:"initial"})}isLabelEnabled(){return!1}updateDatumSelection(e){const t=e.nodeData??[];return e.datumSelection.update(t)}makeStylerParams(e,t){const{id:i}=this,{cornerRadius:s,cap:{lengthRatio:o},fill:a,fillOpacity:n,lineDash:r,lineDashOffset:l,stroke:c,strokeOpacity:p,strokeWidth:d,maxKey:u,maxName:m,medianKey:g,medianName:y,minKey:f,minName:S,q1Key:x,q1Name:v,q3Key:b,q3Name:k,whisker:{lineDash:A,lineDashOffset:I,stroke:D,strokeOpacity:N,strokeWidth:R},xKey:C,xName:w,yName:G}=this.properties,_=Hm(t??Xa.None);return{cap:{lengthRatio:o},cornerRadius:s,fill:a,fillOpacity:n,highlightState:_,highlighted:e,lineDash:r,lineDashOffset:l,maxKey:u,maxName:m??u,medianKey:g,medianName:y??g,minKey:f,minName:S??f,q1Key:x,q1Name:v??x,q3Key:b,q3Name:k??b,seriesId:i,stroke:c,strokeOpacity:p,strokeWidth:d,whisker:{lineDash:A??r,lineDashOffset:I??l,stroke:D??c,strokeOpacity:N??p,strokeWidth:R??d},xKey:C,xName:w??C,yName:G}}getStyle(e,t,i){const{cap:s,cornerRadius:o,fill:a,fillOpacity:n,lineDash:r,lineDashOffset:l,stroke:c,strokeOpacity:p,strokeWidth:d,styler:u,whisker:m}=this.properties;let g={};if(!e&&u){const y=this.makeStylerParams(t,i);g=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(u,y)??{},{pick:!1})??{}}return{cornerRadius:g.cornerRadius??o,fill:g.fill??a,fillOpacity:g.fillOpacity??n,lineDash:g.lineDash??r,lineDashOffset:g.lineDashOffset??l,opacity:1,stroke:g.stroke??c,strokeOpacity:g.strokeOpacity??p,strokeWidth:g.strokeWidth??d,cap:{lengthRatio:g.cap?.lengthRatio??s.lengthRatio},whisker:{lineDash:g.whisker?.lineDash??m.lineDash,lineDashOffset:g.whisker?.lineDashOffset??m.lineDashOffset,stroke:g.whisker?.stroke??m.stroke,strokeOpacity:g.whisker?.strokeOpacity??m.strokeOpacity,strokeWidth:g.whisker?.strokeWidth??m.strokeWidth}}}getItemStyle(e,t,i){const{properties:s}=this,{itemStyler:o}=s,a=this.getHighlightStyle(t,e,i);let n=Ha(a,this.getStyle(e===void 0,t,i));if(o!=null&&e!=null){const u=this.cachedDatumCallback(Gm(e,t?"highlight":"node"),()=>{const m=this.makeItemStylerParams(e,t,n);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(o,m))});u&&(n=Ha(u,n))}const{stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:p,lineDashOffset:d}=n;return n.whisker=Ha(n.whisker,{stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:p,lineDashOffset:d}),n}makeItemStylerParams(e,t,i){const{id:s}=this,{xKey:o,minKey:a,q1Key:n,medianKey:r,q3Key:l,maxKey:c}=this.properties,p=this.processedData?.dataSources.get(s)?.data[e],d=this.ctx.highlightManager?.getActiveHighlight(),u=this.getHighlightStateString(d,t,e),m=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:p,xKey:o,minKey:a,q1Key:n,medianKey:r,q3Key:l,maxKey:c,highlighted:t,highlightState:u,...i,fill:m}}updateDatumStyles({datumSelection:e,isHighlight:t}){const i=this.ctx.highlightManager.getActiveHighlight();e.each((s,o)=>{const a=this.getHighlightState(i,t,o.datumIndex);o.style=this.getItemStyle(o.datumIndex,t,a)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:s}=this;if(!i)return;const o=this.isVertical(),a=this.ctx.highlightManager.getActiveHighlight(),n=this.getShapeFillBBox(),r=this.getStyle(!1,!1,Xa.None).strokeWidth/2,l=s.whisker.strokeWidth??s.strokeWidth;e.each((c,p)=>{const d=p.style??i.styles[this.getHighlightState(a,t,p.datumIndex)];zm(c,d.fill,n),c.fill=d.fill,c.fillOpacity=d.fillOpacity,c.stroke=d.stroke,c.strokeWidth=d.strokeWidth,c.strokeOpacity=d.strokeOpacity,c.lineDash=d.lineDash,c.lineDashOffset=d.lineDashOffset,c.wickStroke=d.whisker.stroke,c.wickStrokeWidth=d.whisker.strokeWidth,c.wickStrokeOpacity=d.whisker.strokeOpacity,c.wickLineDash=d.whisker.lineDash,c.wickLineDashOffset=d.whisker.lineDashOffset,c.cornerRadius=d.cornerRadius,c.crisp=!0,c.horizontal=!o,c.center=p.scaledValues.xValue,c.thickness=p.bandwidth,c.min=p.scaledValues.minValue,c.q1=p.scaledValues.q1Value,c.median=p.scaledValues.medianValue,c.q3=p.scaledValues.q3Value,c.max=p.scaledValues.maxValue,c.capLengthRatio=d.cap.lengthRatio,c.strokeAlignment=r,c.wickStrokeAlignment=l})}updateLabelNodes(){}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;return i.update(t)}nodeFactory(){return new Ee}computeFocusBounds({datumIndex:e}){return Bm(this,this.contextNodeData?.nodeData[e].focusRect)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null}};no.className="BoxPlotSeries",no.type="box-plot";import{_ModuleSupport as Ym}from"ag-charts-community";import{boolean as Um,constant as qm,required as fi,shapeSegmentation as jm,string as nt}from"ag-charts-core";var{boxPlotSeriesThemeableOptionsDef:Jm,commonSeriesOptionsDefs:Zm}=Ym,Qm={...Zm,...Jm,type:fi(qm("box-plot")),xKey:fi(nt),minKey:fi(nt),q1Key:fi(nt),medianKey:fi(nt),q3Key:fi(nt),maxKey:fi(nt),xName:nt,yName:nt,minName:nt,q1Name:nt,medianName:nt,q3Name:nt,maxName:nt,grouped:Um,legendItemName:nt,segmentation:jm};import{_ModuleSupport as ey}from"ag-charts-community";var{ThemeConstants:{CARTESIAN_AXIS_TYPE:Vl},multiSeriesHighlightStyle:ty,FILL_GRADIENT_LINEAR_DEFAULTS:iy,FILL_IMAGE_DEFAULTS:sy,FILL_PATTERN_DEFAULTS:oy,SAFE_FILL_OPERATION:ay,SEGMENTATION_DEFAULTS:ny}=ey,ry={series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$if:[{$or:[{$isGradient:{$palette:"fill"}},{$isPattern:{$palette:"fill"}},{$isImage:{$palette:"fill"}}]},{$palette:"fill"},{$mix:[ay,{$ref:"chartBackgroundColor"},.7]}]},["gradient",iy],["image",sy],["pattern",oy]]},stroke:{$palette:"stroke"},strokeWidth:2,fillOpacity:1,strokeOpacity:1,lineDash:void 0,lineDashOffset:0,highlight:ty(),segmentation:ny},axes:{[Vl.NUMBER]:{crosshair:{snap:!1}},[Vl.CATEGORY]:{groupPaddingInner:.2,crosshair:{enabled:!1,snap:!1}}}},XT={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"box-plot",moduleFactory:e=>new no(e),predictAxis:Ol.predictCartesianTimeAxis,defaultAxes:Ol.DIRECTION_SWAP_AXES,themeTemplate:ry,groupable:!0},Ya={type:"series",name:"box-plot",chartType:"cartesian",enterprise:!0,options:Qm,create:e=>new no(e)};import{_ModuleSupport as ly}from"ag-charts-community";import{_ModuleSupport as cy}from"ag-charts-community";import{_ModuleSupport as Ua}from"ag-charts-community";import{Logger as Kl}from"ag-charts-core";import{_ModuleSupport as hy}from"ag-charts-community";var{AGGREGATION_SPAN:Wl,AGGREGATION_INDEX_X_MAX:py,AGGREGATION_INDEX_X_MIN:dy,AGGREGATION_INDEX_Y_MAX:uy,AGGREGATION_INDEX_Y_MIN:gy,aggregationDomain:my,aggregationRangeFittingPoints:yy,compactAggregationIndices:fy,createAggregationIndices:Sy}=hy,xy=1e3,zl=dy,by=uy,vy=gy,$l=py;function ky(e,t,i,s,o,a){if(t.length64;)({indexData:c,valueData:p,maxRange:l}=fy(c,p,l)),d.push({maxRange:l,indexData:c});return d.reverse(),d}var{fixNumericExtent:Dy,keyProperty:Iy,createDatumId:Hl,SeriesNodePickMode:Xl,ChartAxisDirection:Yl,SMALLEST_KEY_INTERVAL:Ay,valueProperty:ro,diff:My,animationValidation:Ny,computeBarFocusBounds:Ly,visibleRangeIndices:Ul,BandScale:Ty,processedDataIsAnimatable:Ry,mergeDefaults:ql,simpleMemorize2:Py,getItemStylesPerItemId:Cy}=Ua,Oy=Py(ky),_y=class extends Ua.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.openKey=s.properties.openKey,this.closeKey=s.properties.closeKey,this.highKey=s.properties.highKey,this.lowKey=s.properties.lowKey}},jl=class extends Ua.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[Xl.AXIS_ALIGNED,Xl.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["lowKey","highKey","openKey","closeKey"]},propertyNames:{x:["xName"],y:["lowName","highName","openName","closeName"]},categoryKey:"xValue",pathsPerSeries:[]}),this.NodeEvent=_y,this.dataAggregationFilters=void 0}async processData(e){if(!this.visible)return;const{xKey:t,openKey:i,closeKey:s,highKey:o,lowKey:a}=this.properties,n=!this.ctx.animationManager.isSkipped(),r=this.getCategoryAxis()?.scale,l=this.getValueAxis()?.scale,{isContinuousX:c,xScaleType:p,yScaleType:d}=this.getScaleInformation({xScale:r,yScale:l}),u=[];n&&(this.processedData&&u.push(My(this.id,this.processedData)),u.push(Ny())),i&&u.push(ro(i,d,{id:"openValue",invalidValue:void 0,missingValue:void 0}));const{dataModel:m,processedData:g}=await this.requestDataModel(e,this.data,{props:[Iy(t,p,{id:"xValue"}),ro(s,d,{id:"closeValue"}),ro(o,d,{id:"highValue"}),ro(a,d,{id:"lowValue"}),...c?[Ay]:[],...u]});this.smallestDataInterval=g.reduced?.smallestKeyInterval,this.dataAggregationFilters=this.aggregateData(m,g),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||Ry(t))return;const i=this.axes[Yl.X];if(i==null)return;const s=e.resolveKeysById(this,"xValue",t),o=e.resolveColumnById(this,"highValue",t),a=e.resolveColumnById(this,"lowValue",t),{index:n}=e.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[n];return Oy(i.scale.type,s,o,a,r,t.reduced?.smallestKeyInterval)}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];if(e!==this.getBarDirection()){const{index:o,def:a}=i.resolveProcessedDataDefById(this,"xValue"),n=t.domain.keys[o];return a.type==="key"&&a.valueType==="category"?n:this.padBandExtent(n)}const s=this.domainForClippedRange(e,["highValue","lowValue"],"xValue");return Dy(s)}getSeriesRange(e,t){return this.domainForVisibleRange(Yl.Y,["highValue","lowValue"],"xValue",t)}getZoomRangeFittingItems(e,t,i){return this.zoomFittingVisibleItems("xValue",["highValue","lowValue"],e,t,i)}getVisibleItems(e,t,i){return this.countVisibleItems("xValue",["highValue","lowValue"],e,t,i)}createNodeData(){const{visible:e,dataModel:t,processedData:i}=this,s=this.getCategoryAxis(),o=this.getValueAxis();if(!(t&&i&&s&&o))return;const a=[],{xKey:n,highKey:r,lowKey:l}=this.properties,c=i.dataSources.get(this.id)?.data??[],p=t.resolveKeysById(this,"xValue",i),d=t.resolveColumnById(this,"openValue",i),u=t.resolveColumnById(this,"closeValue",i),m=t.resolveColumnById(this,"highValue",i),g=t.resolveColumnById(this,"lowValue",i),{groupScale:y}=this,{barWidth:f,groupIndex:S}=this.updateGroupScale(s),x=y.convert(String(S)),v=f>=1?f:y.rawBandwidth,b=Ty.is(s.scale),k={itemId:n,nodeData:a,labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:Cy(this.getItemStyle.bind(this),"up","down")};if(!e)return k;const A=(_,E,L,P,T,M,O,B)=>{const F=c[_],V=b?O/2:0,W=s.scale.convert(E)+x+V,K=o.scale.convert(L),z=o.scale.convert(P),$=o.scale.convert(T),Z=o.scale.convert(M),q=P>L,Y=q?"up":"down",Q=Math.min($,Z),ie=Math.max($,Z)-Q,U={x:W,y:Q+ie/2};a.push({series:this,itemId:Y,datum:F,datumIndex:_,xKey:n,xValue:E,openValue:L,closeValue:P,highValue:T,lowValue:M,midPoint:U,aggregatedValue:P,isRising:q,centerX:W,width:O,y:Q,height:ie,yOpen:K,yClose:z,crisp:B})},{dataAggregationFilters:I}=this,D=s.scale,[N,R]=D.range,C=Math.abs(R-N),w=_=>D.convert(p[_])+x,G=I?.find(_=>_.maxRange>C);if(G==null){const _=i.invalidData?.get(this.id);let[E,L]=Ul(1,c.length,s.range,P=>{const T=b?0:-v/2,M=w(P)+T;return[M,M+v]});i.input.count<1e3&&(E=0,L=i.input.count);for(let P=E;P=M&&B>=O;if(!V){Kl.warnOnce(`invalid low value for key [${l}] in data element, low value cannot be higher than datum open or close values`);continue}if(!W){Kl.warnOnce(`invalid high value for key [${r}] in data element, high value cannot be lower than datum open or close values.`);continue}A(P,T,M,O,B,F,v,!0)}}else{const{maxRange:_,indexData:E}=G,[L,P]=Ul(1,_,s.range,T=>{const M=T*Wl,O=E[M+zl],B=E[M+$l];if(O===-1)return;const F=b?0:-v/2;return[w(O)+F,w(B)+F+v]});for(let T=L;T{const m=this.makeItemStylerParams(s,e,t,p);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`,"item",s],this.callWithContext(r,m))});u&&(p=ql(u,p))}return p}makeItemStylerParams(e,t,i,s){const{id:o,properties:a,processedData:n}=this,{xKey:r,openKey:l,closeKey:c,highKey:p,lowKey:d}=a,u=n.dataSources.get(o)?.data[t],m=this.ctx.highlightManager?.getActiveHighlight(),g=this.getHighlightStateString(m,i,t),y={seriesId:o,datum:u,itemId:e,xKey:r,openKey:l,closeKey:c,highKey:p,lowKey:d,highlighted:i,highlightState:g,...s};return"fill"in y&&"fill"in s&&(y.fill=this.filterItemStylerFillParams(s.fill)??s.fill),y}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:o}=this,{xKey:a,xName:n,yName:r,openKey:l,openName:c,highKey:p,highName:d,lowKey:u,lowName:m,closeKey:g,closeName:y,legendItemName:f,tooltip:S}=o,x=this.getCategoryAxis(),v=this.getValueAxis();if(!i||!s||!x||!v)return;const b=s.dataSources.get(this.id)?.data[e],k=i.resolveKeysById(this,"xValue",s)[e],A=i.resolveColumnById(this,"openValue",s)[e],I=i.resolveColumnById(this,"highValue",s)[e],D=i.resolveColumnById(this,"lowValue",s)[e],N=i.resolveColumnById(this,"closeValue",s)[e];if(k==null)return;const R=N>=A?"up":"down",C=this.properties.item[R],w=this.getItemStyle(e,!1),G={fill:C.fill??C.stroke,fillOpacity:C.fillOpacity??C.strokeOpacity??1,stroke:C.stroke,strokeWidth:C.strokeWidth??1,strokeOpacity:C.strokeOpacity??1,lineDash:C.lineDash??[0],lineDashOffset:C.lineDashOffset??0};return this.formatTooltipWithContext(S,{heading:this.getAxisValueText(x,"tooltip",k,b,a,f),title:f,symbol:{marker:G},data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(v,"tooltip",A,b,l,f)},{label:d,fallbackLabel:p,value:this.getAxisValueText(v,"tooltip",I,b,p,f)},{label:m,fallbackLabel:u,value:this.getAxisValueText(v,"tooltip",D,b,u,f)},{label:y,fallbackLabel:g,value:this.getAxisValueText(v,"tooltip",N,b,g,f)}]},{seriesId:t,datum:b,title:r,itemId:R,xKey:a,xName:n,yName:r,openKey:l,openName:c,highKey:p,highName:d,lowKey:u,lowName:m,closeKey:g,closeName:y,...w})}computeFocusBounds(e){const t=this.getNodeData()?.at(e.datumIndex);if(t==null)return;const{centerX:i,y:s,width:o,height:a}=t,n={x:i-o/2,y:s,width:o,height:a};return Ly(this,n)}};import{_ModuleSupport as wy}from"ag-charts-community";import{_ModuleSupport as Ey}from"ag-charts-community";var{Path:Fy,SceneChangeDetection:jt,BBox:By}=Ey,Wt=class extends Fy{constructor(){super(...arguments),this.centerX=0,this.y=0,this.width=0,this.height=0,this.yOpen=0,this.yClose=0,this.crisp=!1}computeBBox(){const{centerX:e,y:t,width:i,height:s}=this;return new By(e-i/2,t,i,s)}isPointInPath(e,t){return this.getBBox().containsPoint(e,t)}distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}get midPoint(){return{x:this.centerX,y:this.y+this.height/2}}alignedCoordinates(){const{y:e,width:t,height:i,crisp:s}=this;let{centerX:o,yOpen:a,yClose:n}=this,r=o-t/2,l=o+t/2,c=e,p=e+i;if(s&&t>1){if(o=this.align(o),a<=n){const u=this.align(a,n-a);a=this.align(a),n=a+u}else{const u=this.align(n,a-n);n=this.align(n),a=n+u}const d=this.align(t/2);r=o-d,l=o+d,c=this.align(e),p=c+this.align(c,i)}return{centerX:o,x0:r,x1:l,y0:c,y1:p,yOpen:a,yClose:n}}executeStroke(e,t){const{width:i,strokeWidth:s}=this;i0?l/this.strokeAlignment/2%1:0;e.clear(),e.moveTo(t-c,o),e.lineTo(t-c,a),Math.abs(s-i)>1&&(e.moveTo(i,n-c),e.lineTo(t-c,n-c),e.moveTo(t-c,r-c),e.lineTo(s,r-c))}};h([jt()],Jl.prototype,"strokeAlignment",2);var{SceneArrayChangeDetection:Gy,SceneChangeDetection:ks,ExtendedPath2D:Vy,BBox:Ky}=wy,Si=class extends Wt{constructor(){super(...arguments),this.wickPath=new Vy,this.wickStroke=void 0,this.wickStrokeWidth=void 0,this.wickStrokeOpacity=void 0,this.wickStrokeAlignment=0}computeDefaultGradientFillBBox(){const{width:e,centerX:t,yOpen:i,yClose:s}=this,o=Math.min(i,s),n=Math.max(i,s)-o,r=t-e/2,l=t+e/2;return new Ky(r,o,l-r,n)}updatePath(){const{path:e,stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:o,lineDashOffset:a,wickStroke:n,wickStrokeWidth:r,wickStrokeOpacity:l,wickLineDash:c,wickLineDashOffset:p}=this,{centerX:d,x0:u,x1:m,y0:g,y1:y,yOpen:f,yClose:S}=this.alignedCoordinates(),x=this.layerManager?.canvas.pixelRatio??1,v=this.wickStrokeAlignment>0?x/this.wickStrokeAlignment/2%1:0;this.path.clear(),this.wickPath.clear();const k=n!=null&&n!==t||r!=null&&r!==i||l!=null&&l!==s||c!=null&&c!==o||p!=null&&p!==a?this.wickPath:e;if(Math.abs(m-u)<=3){k.moveTo(d-v,g),k.lineTo(d-v,y);return}const A=Math.min(f,S),I=Math.max(f,S),D=i/2;k.moveTo(d-v,g),k.lineTo(d-v,A+D),k.moveTo(d-v,y),k.lineTo(d-v,I-D);const N=I-A-2*D;if(N>0)e.rect(u+D,A+D,m-u-2*D,N);else{const R=(A+I)/2;e.moveTo(u,R),e.lineTo(m,R)}}drawPath(e){super.drawPath(e);const{wickPath:t}=this;if(t.isEmpty())return;const{stroke:i,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n,wickStroke:r=i,wickStrokeWidth:l=s,wickStrokeOpacity:c=o,wickLineDash:p=a,wickLineDashOffset:d=n}=this;l!==0&&(e.globalAlpha*=c,typeof r=="string"&&(e.strokeStyle=r),e.lineWidth=l,p!=null&&e.setLineDash([...p]),e.lineDashOffset=d,e.stroke(t.getPath2D()))}};h([ks()],Si.prototype,"wickStroke",2),h([ks()],Si.prototype,"wickStrokeWidth",2),h([ks()],Si.prototype,"wickStrokeOpacity",2),h([Gy()],Si.prototype,"wickLineDash",2),h([ks()],Si.prototype,"wickLineDashOffset",2),h([ks()],Si.prototype,"wickStrokeAlignment",2);import{_ModuleSupport as Wy}from"ag-charts-community";import{_ModuleSupport as zy}from"ag-charts-community";var{BaseProperties:Zl,Property:Me,AbstractBarSeriesProperties:$y,makeSeriesTooltip:Hy}=zy,xi=class extends Zl{constructor(){super(...arguments),this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};h([Me],xi.prototype,"stroke",2),h([Me],xi.prototype,"strokeWidth",2),h([Me],xi.prototype,"strokeOpacity",2),h([Me],xi.prototype,"lineDash",2),h([Me],xi.prototype,"lineDashOffset",2);var qa=class extends Zl{constructor(){super(...arguments),this.up=new xi,this.down=new xi}};h([Me],qa.prototype,"up",2),h([Me],qa.prototype,"down",2);var lt=class extends $y{};h([Me],lt.prototype,"xKey",2),h([Me],lt.prototype,"openKey",2),h([Me],lt.prototype,"closeKey",2),h([Me],lt.prototype,"highKey",2),h([Me],lt.prototype,"lowKey",2),h([Me],lt.prototype,"xName",2),h([Me],lt.prototype,"yName",2),h([Me],lt.prototype,"openName",2),h([Me],lt.prototype,"closeName",2),h([Me],lt.prototype,"highName",2),h([Me],lt.prototype,"lowName",2);var lo=class extends lt{constructor(){super(...arguments),this.tooltip=Hy(),this.item=new qa}getStyle(e){const{strokeWidth:t,strokeOpacity:i,stroke:s,lineDash:o,lineDashOffset:a}=this.item[e];return{stroke:s,strokeWidth:t,strokeOpacity:i,lineDash:o,lineDashOffset:a,opacity:1}}};h([Me],lo.prototype,"tooltip",2),h([Me],lo.prototype,"item",2),h([Me],lo.prototype,"itemStyler",2);var{BaseProperties:ja,makeSeriesTooltip:Xy,Property:Fe}=Wy,Ki=class extends ja{};h([Fe],Ki.prototype,"stroke",2),h([Fe],Ki.prototype,"strokeWidth",2),h([Fe],Ki.prototype,"strokeOpacity",2),h([Fe],Ki.prototype,"lineDash",2),h([Fe],Ki.prototype,"lineDashOffset",2);var Dt=class extends ja{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.wick=new Ki}};h([Fe],Dt.prototype,"fill",2),h([Fe],Dt.prototype,"fillOpacity",2),h([Fe],Dt.prototype,"stroke",2),h([Fe],Dt.prototype,"strokeWidth",2),h([Fe],Dt.prototype,"strokeOpacity",2),h([Fe],Dt.prototype,"lineDash",2),h([Fe],Dt.prototype,"lineDashOffset",2),h([Fe],Dt.prototype,"cornerRadius",2),h([Fe],Dt.prototype,"wick",2);var Ja=class extends ja{constructor(){super(...arguments),this.up=new Dt,this.down=new Dt}};h([Fe],Ja.prototype,"up",2),h([Fe],Ja.prototype,"down",2);var co=class extends lt{constructor(){super(),this.item=new Ja,this.tooltip=Xy(),this.highlightStyle.deprecated=!1}getStyle(e){const{fill:t,fillOpacity:i,strokeWidth:s,strokeOpacity:o,stroke:a,lineDash:n,lineDashOffset:r,cornerRadius:l,wick:c}=this.item[e];return{fill:t,fillOpacity:i,stroke:a,strokeWidth:s,strokeOpacity:o,lineDash:n,lineDashOffset:r,cornerRadius:l,opacity:1,wick:c}}};h([Fe],co.prototype,"item",2),h([Fe],co.prototype,"tooltip",2),h([Fe],co.prototype,"itemStyler",2);var{isGradientFill:Ql,isPatternFill:Za,isImageFill:Qa,applyShapeStyle:Yy}=cy,ho=class extends jl{constructor(){super(...arguments),this.properties=new co}nodeFactory(){const e=new Si;return e.lineCap="butt",e}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s.datumIndex,t,void 0,s.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:s}=this;if(!i)return;const o=this.ctx.highlightManager.getActiveHighlight(),{up:a,down:n}=s.item;e.each((r,l)=>{const{centerX:c,width:p,y:d,height:u,yOpen:m,yClose:g,crisp:y}=l,f=l.isRising?a:n,S=l.style??i.styles[l.itemId][this.getHighlightState(o,t,l.datumIndex)];r.centerX=c,r.width=p,r.y=d,r.height=u,r.yOpen=m,r.yClose=g,r.crisp=y,Yy(r,S,this.getShapeFillBBox());const x=S?.wick;r.wickStroke=x?.stroke,r.wickStrokeWidth=x?.strokeWidth,r.wickStrokeOpacity=x?.strokeOpacity,r.wickLineDash=x?.lineDash,r.wickLineDashOffset=x?.lineDashOffset,r.wickStrokeAlignment=f.wick.strokeWidth??f.strokeWidth})}legendItemSymbol(){const{up:e,down:t}=this.properties.item,i=Ql(e.fill)?e.fill.colorStops.map(n=>typeof n=="string"?n:{color:n.color,stop:n.stop==null?void 0:n.stop*.5}):[{color:Za(e.fill)||Qa(e.fill)?e.stroke:e.fill,stop:0},{color:Za(e.fill)||Qa(e.fill)?e.stroke:e.fill,stop:.5}],s=Ql(t.fill)?t.fill.colorStops.map(n=>typeof n=="string"?n:{color:n.color,stop:n.stop==null?void 0:n.stop*.5}):[{color:Za(t.fill)||Qa(t.fill)?t.stroke:t.fill,stop:.5}],o={type:"gradient",gradient:"linear",rotation:90,colorStops:[...i,...s],reverse:!1},a={type:"gradient",gradient:"linear",rotation:90,colorStops:[{color:e.stroke,stop:0},{color:e.stroke,stop:.5},{color:t.stroke,stop:.5}],reverse:!1};return{marker:{fill:o,fillOpacity:e.fillOpacity,stroke:a,strokeWidth:e.strokeWidth??1,strokeOpacity:e.strokeOpacity??1,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset}}}getLegendData(e){const{id:t,data:i,visible:s,ctx:{legendManager:o}}=this,{xKey:a,yName:n,showInLegend:r,legendItemName:l}=this.properties;return!i?.data.length||!a||e!=="category"?[]:[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:s&&o.getItemEnabled({seriesId:t,itemId:t}),label:{text:l??n??t},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!r}]}hasItemStylers(){return this.properties.itemStyler!=null}};ho.className="CandleStickSeries",ho.type="candlestick";import{_ModuleSupport as Uy}from"ag-charts-community";import{boolean as qy,constant as jy,number as Jy,required as Wi,string as It,undocumented as ec}from"ag-charts-core";var{commonSeriesOptionsDefs:Zy,candlestickSeriesThemeableOptionsDef:Qy}=Uy,en={...Zy,...Qy,type:Wi(jy("candlestick")),xKey:Wi(It),openKey:Wi(It),highKey:Wi(It),lowKey:Wi(It),closeKey:Wi(It),xName:It,yName:It,openName:It,highName:It,lowName:It,closeName:It};en.pickOutsideVisibleMinorAxis=ec(qy),en.focusPriority=ec(Jy);import{_ModuleSupport as ef}from"ag-charts-community";var{ThemeConstants:{CARTESIAN_AXIS_TYPE:tc},multiSeriesHighlightStyle:tf,FILL_GRADIENT_LINEAR_KEYED_DEFAULTS:sf,FILL_IMAGE_DEFAULTS:of,FILL_PATTERN_KEYED_DEFAULTS:af}=ef;function ic(e){return{fill:{$applySwitch:[{$path:"type"},{$if:[{$eq:[{$palette:"type"},"user-indexed"]},e==="up"?"transparent":{$palette:"fill"},{$palette:`${e}.fill`}]},["gradient",sf(e)],["image",of],["pattern",af(e)]]},stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:`${e}.stroke`}]}}}var nf={series:{item:{up:ic("up"),down:ic("down")},highlightStyle:{item:{strokeWidth:3}},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:tf()},animation:{enabled:!1},axes:{[tc.NUMBER]:{crosshair:{snap:!1}},[tc.ORDINAL_TIME]:{groupPaddingInner:0,crosshair:{enabled:!0}}}},{CARTESIAN_AXIS_TYPE:sc,CARTESIAN_POSITION:oc}=ly.ThemeConstants,aR={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"candlestick",moduleFactory:e=>new ho(e),defaultAxes:[{type:sc.NUMBER,position:oc.LEFT},{type:sc.ORDINAL_TIME,position:oc.BOTTOM}],themeTemplate:nf,groupable:!1},tn={type:"series",name:"candlestick",chartType:"cartesian",enterprise:!0,options:en,create:e=>new ho(e)};import{_ModuleSupport as rf}from"ag-charts-community";import{_ModuleSupport as po}from"ag-charts-community";import{Logger as lf,toPlainText as cf}from"ag-charts-core";import{Logger as hf,cachedTextMeasurer as uo,findMaxValue as ac,wrapLines as nc}from"ag-charts-core";function pf(e,t){const{fontSize:i,minimumFontSize:s=i}=e,{fontSize:o,minimumFontSize:a=o}=t,n=i-s,r=o-a;let l=e.fontSize,c=t.fontSize;const p=[{labelFontSize:i,secondaryLabelFontSize:o}];for(;l>s||c>a;){const d=n>0?(l-s)/n:-1,u=r>0?(c-a)/r:-1;d>u?l--:c--,p.push({labelFontSize:l,secondaryLabelFontSize:c})}return p.reverse(),p}function rc(e,t,i,s,{padding:o},a){const{spacing:n=0}=t,r=2*o,l=2*o+n,c=(t.minimumFontSize??t.fontSize)+(s.minimumFontSize??s.fontSize);if(c>a(c+l,!1).height-l)return;const p=pf(t,s),d={fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight},u={fontFamily:s.fontFamily,fontStyle:s.fontStyle,fontWeight:s.fontWeight};let m,g;return ac(0,p.length-1,y=>{const{labelFontSize:f,secondaryLabelFontSize:S}=p[y],x=y===0,v={...d,fontSize:f},b={...u,fontSize:S},k=uo(v).lineHeight(),A=uo(b).lineHeight(),I=a(k+A+l,x),D=I.width-r,N=I.height-l;if(k+A>N||((m==null||m.fontSize!==f)&&(m=cc(t,e,D,N,v,t.wrapping,x?t.overflowStrategy:"hide")),m==null||m.width>D||m.height>N)||((g==null||g.fontSize!==S)&&(g=cc(s,i,D,N,b,s.wrapping,x?s.overflowStrategy:"hide")),g==null))return;const R=m.height+g.height;if(!(g.width>D||R>N))return{width:Math.max(m.width,g.width),height:R+n,meta:I.meta,label:m,secondaryLabel:g}})}function Ds(e,t,{padding:i},s){const o=2*i,a=Math.min(t.minimumFontSize??t.fontSize,t.fontSize),n={fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight};return ac(a,t.fontSize,r=>{const l={...n,fontSize:r},c=uo(l),p=r===a,d=t.lineHeight??c.lineHeight(),u=s(d+o,p),m=u.width-o,g=u.height-o;if(d>g||m<0)return;const y=nc(e,{maxWidth:m,maxHeight:g,font:l,textWrap:t.wrapping,overflow:(p?t.overflowStrategy:null)??"hide"});if(!y.length)return;const{width:f,height:S}=c.measureLines(y),x=y.join(` +`);return[{width:f,height:S,text:x,fontSize:r,lineHeight:d},u.meta]})}function lc(e){return e?.minimumFontSize!=null&&e?.fontSize!=null&&e?.minimumFontSize>e?.fontSize}function sn(e,t,i,s,o,a){const n=t.enabled?e:void 0,r=s.enabled?i:void 0;(lc(t)||lc(s))&&hf.warnOnce("minimumFontSize should be set to a value less than or equal to the font size");let l;n!=null&&r!=null&&(l=rc(n,t,r,s,o,a));let c;if(l==null&&n!=null&&(c=Ds(n,t,o,a)),c!=null){const[d,u]=c;l={width:d.width,height:d.height,meta:u,label:d,secondaryLabel:void 0}}let p;if(l==null&&n==null&&r!=null&&(p=Ds(r,s,o,a)),p!=null){const[d,u]=p;l={width:d.width,height:d.height,meta:u,label:void 0,secondaryLabel:d}}return l}function cc(e,t,i,s,o,a,n){const r=nc(t,{maxWidth:i,maxHeight:s,font:o,textWrap:a,overflow:n});if(!r.length)return;const l=uo(o),c=e.lineHeight??l.lineHeight(),{width:p}=l.measureLines(r);return{width:p,lineHeight:c,text:r.join(` +`),height:r.length*c,fontSize:o.fontSize}}import{_ModuleSupport as df}from"ag-charts-community";import{_ModuleSupport as hc}from"ag-charts-community";var{Property:Is}=hc,zi=class extends hc.Label{constructor(){super(...arguments),this.wrapping="on-space",this.overflowStrategy="ellipsis"}};h([Is],zi.prototype,"wrapping",2),h([Is],zi.prototype,"overflowStrategy",2),h([Is],zi.prototype,"lineHeight",2),h([Is],zi.prototype,"minimumFontSize",2);var _t=class extends zi{constructor(){super(...arguments),this.spacing=0}};h([Is],_t.prototype,"spacing",2);var As=class extends zi{},{CartesianSeriesProperties:uf,makeSeriesTooltip:gf,Property:Xe}=df,Ve=class extends uf{constructor(){super(...arguments),this.colorRange=["black","black"],this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.textAlign="center",this.verticalAlign="middle",this.itemPadding=0,this.label=new _t,this.tooltip=gf()}};h([Xe],Ve.prototype,"title",2),h([Xe],Ve.prototype,"xKey",2),h([Xe],Ve.prototype,"yKey",2),h([Xe],Ve.prototype,"colorKey",2),h([Xe],Ve.prototype,"xName",2),h([Xe],Ve.prototype,"yName",2),h([Xe],Ve.prototype,"colorName",2),h([Xe],Ve.prototype,"colorRange",2),h([Xe],Ve.prototype,"stroke",2),h([Xe],Ve.prototype,"strokeOpacity",2),h([Xe],Ve.prototype,"strokeWidth",2),h([Xe],Ve.prototype,"textAlign",2),h([Xe],Ve.prototype,"verticalAlign",2),h([Xe],Ve.prototype,"itemPadding",2),h([Xe],Ve.prototype,"itemStyler",2),h([Xe],Ve.prototype,"label",2),h([Xe],Ve.prototype,"tooltip",2);var{SeriesNodePickMode:pc,computeBarFocusBounds:mf,getMissCount:yf,valueProperty:on,ChartAxisDirection:mt,DEFAULT_CARTESIAN_DIRECTION_KEYS:ff,DEFAULT_CARTESIAN_DIRECTION_NAMES:Sf,createDatumId:xf,ColorScale:bf,Rect:vf,PointerEvents:kf,applyShapeStyle:Df,mergeDefaults:dc,formatValue:If,addHitTestersToQuadtree:Af,findQuadtreeMatch:uc,updateLabelNode:Mf}=po,Nf=class extends po.CartesianSeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.colorKey=s.properties.colorKey}},Lf={left:-.5,center:0,right:-.5},Tf={top:-.5,middle:0,bottom:-.5},go=class extends po.CartesianSeries{constructor(e){super({moduleCtx:e,propertyKeys:{...ff,color:["colorKey"]},propertyNames:{...Sf,color:["colorName"]},categoryKey:void 0,pickModes:[pc.NEAREST_NODE,pc.EXACT_SHAPE_MATCH],pathsPerSeries:[]}),this.properties=new Ve,this.NodeEvent=Nf,this.colorScale=new bf}async processData(e){const t=this.axes[mt.X],i=this.axes[mt.Y];if(!t||!i||!this.data?.data.length)return;const{xKey:s,yKey:o,colorRange:a,colorKey:n}=this.properties,r=this.axes[mt.X]?.scale,l=this.axes[mt.Y]?.scale,{xScaleType:c,yScaleType:p}=this.getScaleInformation({xScale:r,yScale:l}),d=this.colorScale.type,{dataModel:u,processedData:m}=await this.requestDataModel(e,this.data,{props:[on(s,c,{id:"xValue"}),on(o,p,{id:"yValue"}),...n?[on(n,d,{id:"colorValue",invalidValue:void 0})]:[]]});if(this.isColorScaleValid()){const g=u.resolveProcessedDataIndexById(this,"colorValue"),y=m.domain.values[g].filter(S=>S!=null),f=po.extent(y);if(this.colorScale.domain=f??[],f?.length&&f[0]===f[1]){const S=Math.floor(a.length/2);this.colorScale.range=[a[S],a[S]]}else this.colorScale.range=a;this.colorScale.update()}}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),o=i.input.count,a=yf(this,i.defs.values[s].missing),n=t.resolveProcessedDataIndexById(this,"colorValue"),r=i.domain.values[n].filter(c=>c!=null).length;return!(o===0||o===a||r===0)}xCoordinateRange(e,t){const i=this.axes[mt.X].scale,s=t*(i.bandwidth??0)/2,o=i.convert(e)+s,a=t*(i.bandwidth??10);return[o,o+a]}yCoordinateRange(e,t){const i=this.axes[mt.Y].scale,s=t*(i.bandwidth??0)/2,o=i.convert(e[0])+s,a=t*(i.bandwidth??10);return[o,o+a]}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;return!t||!i?[]:e===mt.X?t.getDomain(this,"xValue","value",i):t.getDomain(this,"yValue","value",i)}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{data:e,visible:t,axes:i,dataModel:s,processedData:o}=this,a=i[mt.X],n=i[mt.Y];if(!(e&&s&&o&&t&&a&&n))return;if(a.type!=="category"||n.type!=="category"){lf.warnOnce(`Heatmap series expected axes to have "category" type, but received "${a.type}" and "${n.type}" instead.`);return}const{xKey:r,xName:l,yKey:c,yName:p,colorKey:d,colorName:u,textAlign:m,verticalAlign:g,itemPadding:y,label:f}=this.properties,S=s.resolveColumnById(this,"xValue",o),x=s.resolveColumnById(this,"yValue",o),v=d?s.resolveColumnById(this,"colorValue",o):void 0,b=d?s.getDomain(this,"colorValue","value",o):[],k=a.scale,A=n.scale,I=(k.bandwidth??0)/2,D=(A.bandwidth??0)/2,N=[],R=[],C=k.bandwidth??10,w=A.bandwidth??10,G=(C-2*y)*Lf[m],_=(w-2*y)*Tf[g],E=()=>({width:C,height:w,meta:null}),L=o.dataSources.get(this.id)?.data??[];for(const[P,T]of L.entries()){const M=S[P],O=x[P],B=k.convert(M)+I,F=A.convert(O)+D,V=v?.[P],W=f.enabled&&V!=null?this.getLabelText(V,T,d,"color",b,f,{value:V,datum:T,colorKey:d,colorName:u,xKey:r,yKey:c,xName:l,yName:p}):void 0,K=sn(cf(W),this.properties.label,void 0,this.properties.label,{padding:y},E),z={x:B,y:F,size:0},$=this.getItemStyle({datumIndex:P,datum:T,colorValue:V},!1);if(N.push({series:this,itemId:c,datumIndex:P,yKey:c,xKey:r,xValue:M,yValue:O,colorValue:V,datum:T,point:z,width:C,height:w,midPoint:{x:B,y:F},missing:v!=null&&V==null,style:$}),K?.label!=null){const{text:Z,fontSize:q,lineHeight:Y,height:Q}=K.label,{fontStyle:ie,fontFamily:U,fontWeight:ce,color:ae}=this.properties.label,j=z.x+G*(C-2*y),re=z.y+_*(w-2*y)-(K.height-Q)*.5;R.push({series:this,itemId:c,datum:T,datumIndex:P,text:Z,fontSize:q,lineHeight:Y,fontStyle:ie,fontFamily:U,fontWeight:ce,color:ae,textAlign:m,textBaseline:g,x:j,y:re,style:$})}}return{itemId:this.properties.yKey??this.id,nodeData:N,labelData:R,scales:this.calculateScaling(),visible:this.visible}}nodeFactory(){return new vf}update(e){return this.ctx.animationManager.skipCurrentBatch(),super.update(e)}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,s=t??[];return i.update(s)}getItemStyle({datumIndex:e,datum:t,colorValue:i},s){const{properties:o}=this,{itemStyler:a,stroke:n,strokeWidth:r,strokeOpacity:l}=o,c=this.getHighlightStyle(s,e),p=dc(c,{fill:this.isColorScaleValid()&&i!=null?this.colorScale.convert(i):"transparent",fillOpacity:1,stroke:n,strokeWidth:r,strokeOpacity:l,opacity:1});let d;return a!=null&&e!=null&&(d=this.cachedDatumCallback(xf(e,s?"highlight":"node"),()=>{const u=this.makeItemStylerParams(t,e,s,p);return this.callWithContext(a,u)})),d?dc(d,p):p}makeItemStylerParams(e,t,i,s){const{id:o,properties:a}=this,{xKey:n,yKey:r}=a,l=this.ctx.highlightManager?.getActiveHighlight(),c=this.getHighlightStateString(l,i,t),p=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:o,datum:e,xKey:n,yKey:r,highlighted:i,highlightState:c,...s,fill:p}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){const t=this.axes[mt.X],[i,s]=t?.visibleRange??[],a=!(i!==0||s!==1);e.each((n,r)=>{const{point:l,width:c,height:p,style:d}=r;Df(n,d),n.crisp=a,n.x=Math.floor(l.x-c/2),n.y=Math.floor(l.y-p/2),n.width=Math.ceil(c),n.height=Math.ceil(p)})}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e,{enabled:s}=this.properties.label,o=s?t:[];return i.update(o)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,s)=>{i.pointerEvents=kf.None,i.text=s.text,i.fillOpacity=this.getHighlightStyle(!1,s.datumIndex)?.opacity??1,Mf(this,i,this.properties,this.properties.label,s,!1,t)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:o,properties:a,colorScale:n,ctx:r}=this,{formatManager:l}=r,{xKey:c,xName:p,yKey:d,yName:u,colorKey:m,colorName:g,colorRange:y,title:f,legendItemName:S,tooltip:x}=a,v=o[mt.X],b=o[mt.Y];if(!i||!s||!v||!b)return;const k=s.dataSources.get(this.id)?.data[e],A=i.resolveColumnById(this,"xValue",s)[e],I=i.resolveColumnById(this,"yValue",s)[e],D=m!=null&&this.isColorScaleValid()?i.resolveColumnById(this,"colorValue",s)[e]:void 0;if(A==null)return;const N=[];let R;if(D==null)R=y[0];else{R=n.convert(D);const G=i.getDomain(this,"colorValue","value",s),_=l.format(this.callWithContext.bind(this),{type:"number",value:D,datum:k,seriesId:t,legendItemName:S,key:m,source:"tooltip",property:"color",domain:G,boundSeries:this.getFormatterContext("color"),fractionDigits:void 0});N.push({label:g,fallbackLabel:m,value:_??If(D)})}N.push({label:p,fallbackLabel:c,value:this.getAxisValueText(v,"tooltip",A,k,c,S)},{label:u,fallbackLabel:d,value:this.getAxisValueText(b,"tooltip",I,k,d,S)});const C=this.getItemStyle({datumIndex:e,datum:k,colorValue:D},!1);C.fill!=null&&(R=C.fill);const w=R==null?void 0:{marker:{shape:"square",fill:R,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0}};return this.formatTooltipWithContext(x,{title:f??S,symbol:w,data:N},{seriesId:t,datum:k,title:f,xKey:c,xName:p,yKey:d,yName:u,colorKey:m,colorName:g,...C})}getLegendData(e){return e!=="gradient"||!this.isColorScaleValid()||!this.dataModel?[]:[{legendType:"gradient",enabled:this.visible,seriesId:this.id,series:this.getFormatterContext("color"),colorDomain:this.colorScale.domain,colorRange:this.colorScale.range}]}isLabelEnabled(){return this.properties.label.enabled&&!!this.properties.colorKey}getBandScalePadding(){return{inner:0,outer:0}}computeFocusBounds({datumIndex:e}){const t=this.contextNodeData?.nodeData[e];if(t===void 0)return;const{width:i,height:s,midPoint:o}=t,a={x:o.x-i/2,y:o.y-s/2,width:i,height:s};return mf(this,a)}initQuadTree(e){Af(e,this.datumNodesIter())}pickNodesExactShape(e){const t=uc(this,e);return t!=null&&t.distance<=0?[t.datum]:[]}pickNodeClosestDatum(e){return uc(this,e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};go.className="HeatmapSeries",go.type="heatmap";import{_ModuleSupport as Rf}from"ag-charts-community";import{arrayOf as Pf,color as Cf,constant as Of,required as an,string as $i}from"ag-charts-core";var{commonSeriesOptionsDefs:_f,heatmapSeriesThemeableOptionsDef:wf,without:gc}=Rf,Ef={...gc(wf,["showInLegend"]),...gc(_f,["showInLegend"]),type:an(Of("heatmap")),xKey:an($i),yKey:an($i),colorKey:$i,xName:$i,yName:$i,colorName:$i,colorRange:Pf(Cf)};import{_ModuleSupport as mo}from"ag-charts-community";var Ff={series:{stroke:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$ref:"chartBackgroundColor"},{$path:["/0",{$palette:"stroke"},{$palette:"strokes"}]}]},strokeWidth:{$isUserOption:["./stroke",2,void 0]},colorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"divergingColors"},mo.SAFE_RANGE2_OPERATION]},label:{...mo.LABEL_BOXING_DEFAULTS,enabled:!1,color:{$ref:"textColor"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},wrapping:"on-space",overflowStrategy:"ellipsis"},itemPadding:3,highlight:mo.singleSeriesHighlightStyle()},gradientLegend:{enabled:!0,...mo.LEGEND_CONTAINER_THEME}},{ThemeConstants:{CARTESIAN_AXIS_TYPE:mc,CARTESIAN_POSITION:yc}}=rf,mR={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"heatmap",moduleFactory:e=>new go(e),defaultAxes:[{type:mc.CATEGORY,position:yc.LEFT},{type:mc.CATEGORY,position:yc.BOTTOM}],themeTemplate:Ff},nn={type:"series",name:"heatmap",chartType:"cartesian",enterprise:!0,options:Ef,create:e=>new go(e)};import{_ModuleSupport as Bf}from"ag-charts-community";import{_ModuleSupport as Gf}from"ag-charts-community";var{applyShapeStyle:Vf}=Gf,yo=class extends jl{constructor(){super(...arguments),this.properties=new lo}nodeFactory(){const e=new Jl;return e.lineCap="square",e}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s.datumIndex,t,void 0,s.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:s}=this;if(!i)return;const o=this.ctx.highlightManager.getActiveHighlight(),{up:a,down:n}=s.item;e.each((r,l)=>{const{centerX:c,width:p,y:d,height:u,yOpen:m,yClose:g,crisp:y}=l,f=l.isRising?a:n;r.centerX=c,r.width=p,r.y=d,r.height=u,r.yOpen=m,r.yClose=g,r.crisp=y;const S=l.style??i.styles[l.itemId][this.getHighlightState(o,t,l.datumIndex)];Vf(r,S),r.strokeAlignment=f.strokeWidth})}getLegendData(e){const{id:t,data:i,ctx:{legendManager:s},visible:o}=this,{xKey:a,yName:n,item:{up:r,down:l},showInLegend:c,legendItemName:p}=this.properties;if(!i?.data.length||!a||e!=="category")return[];const d={type:"gradient",gradient:"linear",colorSpace:"rgb",colorStops:[{color:r.stroke,stop:0},{color:r.stroke,stop:.5},{color:l.stroke,stop:.5}],rotation:90};return[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:o&&s.getItemEnabled({seriesId:t,itemId:t}),label:{text:p??n??t},symbol:{marker:{fill:d,fillOpacity:r.strokeOpacity,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0}},legendItemName:p,hideInLegend:!c}]}hasItemStylers(){return this.properties.itemStyler!=null}};yo.className="ohlc",yo.type="ohlc";import{_ModuleSupport as Kf}from"ag-charts-community";import{boolean as Wf,constant as zf,number as $f,required as Hi,string as At,undocumented as fc}from"ag-charts-core";var{commonSeriesOptionsDefs:Hf,ohlcSeriesThemeableOptionsDef:Xf}=Kf,rn={...Hf,...Xf,type:Hi(zf("ohlc")),xKey:Hi(At),openKey:Hi(At),highKey:Hi(At),lowKey:Hi(At),closeKey:Hi(At),xName:At,yName:At,openName:At,highName:At,lowName:At,closeName:At};rn.pickOutsideVisibleMinorAxis=fc(Wf),rn.focusPriority=fc($f);var{ThemeConstants:{CARTESIAN_AXIS_TYPE:fo,CARTESIAN_POSITION:Sc},multiSeriesHighlightStyle:Yf}=Bf,bR={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"ohlc",moduleFactory:e=>new yo(e),defaultAxes:[{type:fo.NUMBER,position:Sc.LEFT},{type:fo.ORDINAL_TIME,position:Sc.BOTTOM}],themeTemplate:{animation:{enabled:!1},series:{item:{up:{stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:"up.stroke"}]}},down:{stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:"down.stroke"}]}}},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:Yf(!1)},axes:{[fo.NUMBER]:{crosshair:{snap:!1}},[fo.ORDINAL_TIME]:{groupPaddingInner:0,crosshair:{enabled:!0}}}},groupable:!1},ln={type:"series",name:"ohlc",chartType:"cartesian",enterprise:!0,options:rn,create:e=>new yo(e)};import{_ModuleSupport as xc}from"ag-charts-community";import{_ModuleSupport as So}from"ag-charts-community";import{_ModuleSupport as Uf}from"ag-charts-community";var{AGGREGATION_INDEX_Y_MAX:qf,AGGREGATION_INDEX_Y_MIN:jf,aggregationDomain:Jf,aggregationIndexForXRatio:bc,aggregationRangeFittingPoints:Zf,aggregationXRatioForXValue:vc,compactAggregationIndices:Qf,createAggregationIndices:eS}=Uf,tS=1e3;function kc(e,t,i,s,o,a,n){const r=e[a];if(r==null)return!1;const l=vc(r,t,i,n),c=bc(l,o);return a===s[c+qf]}function Dc(e,t,i,s,o,a,n){const r=e[a];if(r==null)return!1;const l=vc(r,t,i,n),c=bc(l,o);return a===s[c+jf]}function iS(e,t,i,s,o,a,n){if(t.length64;)({maxRange:c}=Qf(p,d,c,{inPlace:!0})),u=u.filter(y=>kc(t,r,l,p,c,y,a)),m=m.filter(y=>Dc(t,r,l,p,c,y,a)),g.push({maxRange:c,topIndices:u,bottomIndices:m});return g.reverse(),g}import{_ModuleSupport as sS}from"ag-charts-community";function Ic({span:e},t){switch(e.type){case"linear":case"step":case"multi-line":{const i=(t-e.x0)/(e.x1-e.x0);return e.y0+i*(e.y1-e.y0)}case"cubic":{const{cp0x:i,cp0y:s,cp1x:o,cp1y:a,cp2x:n,cp2y:r,cp3x:l,cp3y:c}=e;let p=.5;const d=1e-6;for(let m=0;m<10;m++){const g=1-p,f=g*g*g*i+3*g*g*p*o+3*g*p*p*n+p*p*p*l-t;if(Math.abs(f)=a.x&&t<=n.x)return{span:o,index:s};if(tl;return{intersection:s===c?null:{x:i,y:r},spanIndex:a.index,isInverted:c}}function aS(e,t,i,s,o=!1){if(e.length===0||t.length===0)return[];const a=[];let n=o,r=0;for(let l=i;l<=s;l+=.5){const c=oS(e,t,l,n,r);c.intersection&&a.push(c.intersection.x),r=c.spanIndex,n=c.isInverted}return a}function nS(e,t,i,s,o={}){const a=Math.max(t.x,i.width-(t.x+t.width)),n=Math.max(t.y,i.height-(t.y+t.height)),r=[],l=(p,d)=>({x0:p,y0:-n,x1:d,y1:t.height+n});s&&r.push({clipRect:l(-a,e[0]??t.width+a),...o});const c=s?1:0;for(let p=c;p{Xi(l,c,t.removed),Xi(l,c,i.removed)},a=(l,c)=>{Xi(l,c,t.moved),Xi(l,c,i.moved)},n=(l,c)=>{Xi(l,c,t.added),Xi(l,c,i.added)},r=yS(e,s);return{status:e,path:{addPhaseFn:n,updatePhaseFn:a,removePhaseFn:o},pathProperties:r}}function SS(e,t,i){const s=e.scales.x?.type==="category",o=t.scales.x?.type==="category";if(s!==o||!Mc(e.scales.x)||!Mc(t.scales.x))return;let a="updated";t.visible&&!e.visible?a="removed":!t.visible&&e.visible&&(a="added");const n=vo({scales:e.scales,data:e.fillData.spans},{scales:t.scales,data:t.fillData.spans},bo.Split);if(n==null)return;const r=vo({scales:e.scales,data:e.fillData.phantomSpans},{scales:t.scales,data:t.fillData.phantomSpans},bo.Split);if(r==null)return;const l=vo({scales:e.scales,data:e.highStrokeData.spans},{scales:t.scales,data:t.highStrokeData.spans},bo.Split);if(l==null)return;const c=vo({scales:e.scales,data:e.lowStrokeData.spans},{scales:t.scales,data:t.lowStrokeData.spans},bo.Split);if(c==null)return;const p="fade",d=mS(a,n,r,p),u=fS(a,l,c,p),m=(i?.changed??!0)||!Nc(e.scales.x,t.scales.x)||!Nc(e.scales.y,t.scales.y)||a!=="updated";return{status:a,fill:d,stroke:u,hasMotion:m}}var{valueProperty:Lc,keyProperty:xS,ChartAxisDirection:Ke,mergeDefaults:bS,updateLabelNode:vS,fixNumericExtent:Tc,buildResetPathFn:kS,resetLabelFn:DS,resetMarkerFn:IS,resetMarkerPositionFn:Rc,pathSwipeInAnimation:AS,resetMotion:MS,markerSwipeScaleInAnimation:NS,seriesLabelFadeInAnimation:dn,animationValidation:LS,diff:TS,updateClipPath:un,computeMarkerFocusBounds:Pc,plotAreaPathFill:RS,plotLinePathStroke:Cc,interpolatePoints:Oc,pathFadeInAnimation:gn,markerFadeInAnimation:_c,fromToMotion:mn,pathMotion:yn,extent:PS,applyShapeFillBBox:CS,PointerEvents:ko,Marker:OS,BBox:_S,findMinMax:wS,applyShapeStyle:ES,processedDataIsAnimatable:FS,simpleMemorize2:BS,markerEnabled:GS,getMarkerStyles:VS,calculateSegments:KS,toHighlightString:WS,HighlightState:zS}=So,$S=BS(iS),HS=class extends So.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.yLowKey=s.properties.yLowKey,this.yHighKey=s.properties.yHighKey}},XS=So.CartesianSeries,Do=class extends XS{constructor(e){super({moduleCtx:e,pathsPerSeries:["fill","lowStroke","highStroke"],pickModes:[So.SeriesNodePickMode.AXIS_ALIGNED],propertyKeys:{[Ke.X]:["xKey"],[Ke.Y]:["yLowKey","yHighKey"]},propertyNames:{[Ke.X]:["xName"],[Ke.Y]:["yLowName","yHighName","yName"]},categoryKey:"xValue",animationResetFns:{path:kS({getVisible:()=>this.visible,getOpacity:()=>this.getOpacity()}),label:DS,datum:(t,i)=>({...IS(t),...Rc(t,i)})},clipFocusBox:!1}),this.properties=new Se,this.NodeEvent=HS,this.dataAggregationFilters=void 0}async processData(e){const{xKey:t,yLowKey:i,yHighKey:s}=this.properties,o=this.axes[Ke.X]?.scale,a=this.axes[Ke.Y]?.scale,{xScaleType:n,yScaleType:r}=this.getScaleInformation({xScale:o,yScale:a}),l=[],c=!this.ctx.animationManager.isSkipped();!this.ctx.animationManager.isSkipped()&&this.processedData&&l.push(TS(this.id,this.processedData)),c&&l.push(LS());const{dataModel:p,processedData:d}=await this.requestDataModel(e,this.data,{props:[xS(t,n,{id:"xValue"}),Lc(i,r,{id:"yLowValue"}),Lc(s,r,{id:"yHighValue"}),...l]});this.dataAggregationFilters=this.aggregateData(p,d),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||FS(t))return;const i=this.axes[Ke.X];if(i==null)return;const s=e.resolveKeysById(this,"xValue",t),o=e.resolveColumnById(this,"yHighValue",t),a=e.resolveColumnById(this,"yLowValue",t),{index:n}=e.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[n],l=e.resolveColumnNeedsValueOf(this,"xValue",t),c=e.resolveColumnNeedsValueOf(this,"yHighValue",t);return $S(i.scale.type,s,o,a,r,l,c)}xCoordinateRange(e){const t=this.axes[Ke.X].scale.convert(e);return[t,t]}yCoordinateRange(e){const t=this.axes[Ke.Y].scale.convert(e[0]);return[t,t]}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];const{domain:{keys:[s]}}=t;if(e===Ke.X){const o=i.resolveProcessedDataDefById(this,"xValue");return o?.def.type==="key"&&o.def.valueType==="category"?s:Tc(PS(s))}else{const o=this.domainForClippedRange(Ke.Y,["yHighValue","yLowValue"],"xValue"),a=wS(o);return Tc(a)}}getSeriesRange(e,t){return this.domainForVisibleRange(Ke.Y,["yHighValue","yLowValue"],"xValue",t)}createNodeData(){const{data:e,dataModel:t,processedData:i,axes:s}=this,o=s[Ke.X],a=s[Ke.Y];if(!(e&&o&&a&&t&&i&&this.chart?.seriesRect))return;const n=o.scale,r=a.scale,{xKey:l,yLowKey:c,yHighKey:p,connectMissingData:d,interpolation:u,fill:m,fillOpacity:g,item:y}=this.properties,f=i.dataSources.get(this.id)?.data??[],S=(n.bandwidth??0)/2,x=t.resolveKeysById(this,"xValue",i),v=t.resolveColumnById(this,"yHighValue",i),b=t.resolveColumnById(this,"yLowValue",i),k=K=>n.convert(x[K])+S,A=[],I=[],D=[],N=(K,z,$)=>{const Z=f[K],q=x[K];if(q==null)return;const Y=D.at(-1);if(Number.isFinite(z)&&Number.isFinite($)){const Q=(re,se,ue)=>{const{size:le}=y[re].marker;I.push({index:K,series:this,itemId:re,datum:Z,datumIndex:K,midPoint:{x:U,y:ue},yHighValue:z,yLowValue:$,xValue:q,xKey:l,yLowKey:c,yHighKey:p,point:{x:U,y:ue,size:le},enabled:!0});const ye=this.createLabelData({datumIndex:K,point:{x:U,y:ue},value:se,yLowValue:$,yHighValue:z,itemId:re,inverted:ie,datum:Z,series:this});A.push(ye)},ie=$>z,U=k(K),ce=r.convert(z),ae=r.convert($);Q("high",z,ce),Q("low",$,ae);const j={high:{point:{x:U,y:ce},xDatum:q,yDatum:z},low:{point:{x:U,y:ae},xDatum:q,yDatum:$}};Array.isArray(Y)?Y.push(j):Y==null?D.push([j]):(Y.skip+=1,D.push([j]))}else d||(Array.isArray(Y)||Y==null?D.push({skip:0}):Y.skip+=1)},{dataAggregationFilters:R}=this,[C,w]=n.range,G=Math.abs(w-C),_=R?.find(K=>K.maxRange>G),E=_?.topIndices,L=_?.bottomIndices;let[P,T]=this.visibleRangeIndices("xValue",o.range,E);P=Math.max(P-1,0),T=Math.min(T+1,E?.length??x.length),i.input.count<1e3&&(P=0,T=i.input.count);for(let K=P;K{if(!Array.isArray(K))return[];const z=K.map($=>$.high);return Oc(z,u)}),O=D.flatMap(K=>{if(!Array.isArray(K))return[];const z=K.map($=>$.low);return Oc(z,u)}),B=KS(this.properties.segmentation,o,a,this.chart.seriesRect,this.ctx.scene,!1);let F;if(this.properties.invertedStyle.enabled){const K=v[0]{const z=y[K],{stroke:$,strokeWidth:Z,strokeOpacity:q}=z,Y={fill:m,fillOpacity:g,stroke:$,strokeWidth:Z,strokeOpacity:q};return VS(this,z,z.marker,Y)};return{itemId:`${c}-${p}`,labelData:A,nodeData:I,fillData:{itemId:"high",spans:M,phantomSpans:O},highStrokeData:{itemId:"high",spans:M},lowStrokeData:{itemId:"low",spans:O},scales:this.calculateScaling(),visible:this.visible,styles:{low:V("low"),high:V("high")},segments:B,intersectionSegments:F}}createLabelData({datumIndex:e,point:t,value:i,itemId:s,inverted:o,datum:a,series:n}){const{xKey:r,yLowKey:l,yHighKey:c,xName:p,yName:d,yLowName:u,yHighName:m,legendItemName:g,label:y}=this.properties,{placement:f}=y,S=y.spacing+(typeof y.padding=="number"?y.padding:0);let x=s;o&&(x=s==="low"?"high":"low");const v=f==="outside"&&x==="high"||f==="inside"&&x==="low"?-1:1,b=this.getSeriesDomain(Ke.Y);return{x:t.x,y:t.y+S*v,series:n,itemId:s,datum:a,datumIndex:e,text:this.getLabelText(i,a,s==="high"?c:l,"y",b,y,{value:i,datum:a,itemId:s,xKey:r,yLowKey:l,yHighKey:c,xName:p,yLowName:u,yHighName:m,yName:d,legendItemName:g}),textAlign:"center",textBaseline:v===-1?"bottom":"top"}}isPathOrSelectionDirty(){const{low:e,high:t}=this.properties.item;return e.marker.isDirty()||t.marker.isDirty()}strokewidthChange(){const e=t=>{const i=this.properties.item[t].strokeWidth??0,s=this.properties.highlight.highlightedSeries.item?.[t]?.strokeWidth??i,o=this.properties.highlight.highlightedItem.item?.[t]?.strokeWidth??i;return i>o||s>o};return e("low")||e("high")}updatePathNodes(e){const{visible:t}=e,[i,s,o]=e.paths,a=this.contextNodeData?.segments,n=this.ctx.highlightManager?.getActiveHighlight(),r=this.getHighlightState(n,!1),l=this.getHighlightStyle(),{item:c,fill:p,fillOpacity:d,opacity:u}=bS(l,this.getStyle(!1,r));s.setProperties({datum:a,segments:a,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:ko.None,stroke:c.low.stroke,strokeWidth:c.low.strokeWidth,strokeOpacity:c.low.strokeOpacity,lineDash:c.low.lineDash,lineDashOffset:c.low.lineDashOffset,opacity:u,visible:t}),o.setProperties({segments:a,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:ko.None,stroke:c.high.stroke,strokeWidth:c.high.strokeWidth,strokeOpacity:c.high.strokeOpacity,lineDash:c.high.lineDash,lineDashOffset:c.high.lineDashOffset,opacity:u,visible:t});const m=this.getShapeFillBBox();CS(i,p,m),ES(i,{stroke:void 0,fill:p,fillOpacity:d,opacity:u},m);const g=this.contextNodeData?.intersectionSegments??a;i.setProperties({segments:g,pointerEvents:ko.None,lineJoin:"round",fillShadow:this.properties.shadow,opacity:u,visible:t}),i.datum=g,un(this,i),un(this,s),un(this,o)}updatePaths(e){this.updateAreaPaths(e.paths,e.contextData)}updateAreaPaths(e,t){for(const i of e)i.visible=t.visible;if(t.visible)this.updateFillPath(e,t),this.updateStrokePath(e,t);else for(const i of e)i.path.clear(),i.markDirty("RangeArea")}updateFillPath(e,t){const[i]=e;i.path.clear(),RS(i,t.fillData),i.markDirty("RangeArea")}updateStrokePath(e,t){const[,i,s]=e;i.path.clear(),s.path.clear(),Cc(i,t.lowStrokeData.spans),Cc(s,t.highStrokeData.spans),i.markDirty("RangeArea"),s.markDirty("RangeArea")}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,{processedData:s,axes:o,properties:a}=this,n=a.styler?this.getStylerMarkerOptions().item:a.item,{low:r,high:l}=n,c=GS(s.input.count,o[Ke.X].scale,{enabled:r.marker.enabled||l.marker.enabled});(a.item.low.marker.isDirty()||a.item.high.marker.isDirty())&&(i.clear(),i.cleanup());let p;if(c)if(r.marker.enabled&&l.marker.enabled)p=t;else{p=[];for(const d of t)n[d.itemId].marker.enabled&&p.push(d)}else p=[];return i.update(p)}updateDatumStyles({datumSelection:e,isHighlight:t}){const i=this.ctx.highlightManager.getActiveHighlight();e.each((s,o)=>{const a=this.getHighlightState(i,t,o.datumIndex),n=this.getStyle(t,a),{fill:r,fillOpacity:l,item:c}=n,{stroke:p,strokeWidth:d,strokeOpacity:u}=c[o.itemId],{marker:m}=this.properties.item[o.itemId],g=this.makeItemStylerParams(o.itemId);o.style=this.getMarkerStyle(m,o,g,{isHighlight:t,highlightState:a,resolveMarkerSubPath:["item",o.itemId,"marker"]},n.item[o.itemId].marker,{fill:r,fillOpacity:l,stroke:p,strokeWidth:d,strokeOpacity:u})})}updateDatumNodes(e){const{contextNodeData:t}=this;if(!t)return;const{datumSelection:i,isHighlight:s}=e,o=this.getShapeFillBBox(),a=this.ctx.highlightManager.getActiveHighlight();i.each((n,r)=>{const{itemId:l}=r,c=r.style??t.styles[l][this.getHighlightState(a,s,r.datumIndex)];this.applyMarkerStyle(c,n,r.point,o)}),s||(this.properties.item.low.marker.markClean(),this.properties.item.high.marker.markClean())}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;return i.update(t,s=>{s.pointerEvents=ko.None})}updateLabelNodes(e){const t={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yName:this.properties.yName,yLowKey:this.properties.yLowKey,yLowName:this.properties.yLowName??this.properties.yLowKey,yHighKey:this.properties.yHighKey,yHighName:this.properties.yHighName??this.properties.yHighKey,legendItemName:this.properties.legendItemName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,o)=>{s.fillOpacity=this.getHighlightStyle(!1,o.datumIndex).opacity??1,vS(this,s,t,this.properties.label,o,!1,i)})}getHighlightData(e,t){const i=e.filter(s=>s.datum===t.datum);return i.length>0?i:void 0}getStyle(e,t){return this.getStylerCouple(e,t)[0]}getStylerMarkerOptions(){return this.getStylerCouple(!1)[1]}getStylerCouple(e,t){const{fill:i,fillOpacity:s,item:o,styler:a}=this.properties;let n={};if(a){const p=this.makeStylerParams(e,t);n=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(a,p)??{},{pick:!1})??{}}const r={item:{low:{marker:{enabled:!1}},high:{marker:{enabled:!1}}}},l=p=>{const d=n.item?.[p],{lineDash:u,lineDashOffset:m,marker:g,stroke:y,strokeOpacity:f,strokeWidth:S}=o[p];return r.item[p].marker.enabled=d?.marker?.enabled??g.enabled,{marker:{fill:d?.marker?.fill??g.fill??i,fillOpacity:d?.marker?.fillOpacity??g.fillOpacity,shape:d?.marker?.shape??g.shape,size:d?.marker?.size??g.size,lineDash:d?.marker?.lineDash??g.lineDash,lineDashOffset:d?.marker?.lineDashOffset??g.lineDashOffset,stroke:d?.marker?.stroke??g.stroke??y,strokeOpacity:d?.marker?.strokeOpacity??g.strokeOpacity,strokeWidth:d?.marker?.strokeWidth??g.strokeWidth},lineDash:d?.lineDash??u,lineDashOffset:d?.lineDashOffset??m,stroke:d?.stroke??y,strokeOpacity:d?.strokeOpacity??f,strokeWidth:d?.strokeWidth??S}};return[{fill:n.fill??i,fillOpacity:n.fillOpacity??s,opacity:1,topLevel:{lineDash:this.properties.lineDash,lineDashOffset:this.properties.lineDashOffset,marker:this.properties.marker,stroke:this.properties.stroke,strokeOpacity:this.properties.strokeOpacity,strokeWidth:this.properties.strokeWidth},item:{low:l("low"),high:l("high")}},r]}makeStylerParams(e,t){const{id:i}=this,{fill:s,fillOpacity:o,item:a,xKey:n,yHighKey:r,yLowKey:l}=this.properties,c=WS(t??zS.None),p=d=>{const{lineDash:u,lineDashOffset:m,marker:g,stroke:y,strokeOpacity:f,strokeWidth:S}=a[d];return{marker:{fill:g.fill??s,fillOpacity:g.fillOpacity,size:g.size,shape:g.shape,stroke:g.stroke??y,strokeOpacity:g.strokeOpacity,strokeWidth:g.strokeWidth,lineDash:g.lineDash,lineDashOffset:g.lineDashOffset},lineDash:u,lineDashOffset:m,stroke:y,strokeOpacity:f,strokeWidth:S}};return{item:{low:p("low"),high:p("high")},fill:s,fillOpacity:o,highlightState:c,highlighted:e,seriesId:i,xKey:n,yLowKey:l,yHighKey:r}}makeItemStylerParams(e){const{xKey:t,yLowKey:i,yHighKey:s}=this.properties;return{xKey:t,yLowKey:i,yHighKey:s,itemId:e}}getTooltipContent(e,t){const i=t?.itemId??"high",{id:s,dataModel:o,processedData:a,axes:n,properties:r}=this,{xName:l,yName:c,yLowKey:p,yLowName:d,xKey:u,yHighKey:m,yHighName:g,tooltip:y,legendItemName:f}=r,S=n[Ke.X],x=n[Ke.Y];if(!o||!a||!S||!x)return;const v=a.dataSources.get(this.id)?.data[e],b=o.resolveKeysById(this,"xValue",a)[e],k=o.resolveColumnById(this,"yHighValue",a)[e],A=o.resolveColumnById(this,"yLowValue",a)[e];if(b==null)return;const I=this.getStyle(!1),D=this.makeItemStylerParams(i),N=this.getMarkerStyle(this.properties.item[i].marker,{datumIndex:e,datum:v},D,{isHighlight:!1,resolveMarkerSubPath:["item",i,"marker"]},I.item[i].marker),R=`${this.getAxisValueText(x,"tooltip",A,v,p,f)} - ${this.getAxisValueText(x,"tooltip",k,v,m,f)}`;return this.formatTooltipWithContext(y,{heading:this.getAxisValueText(S,"tooltip",b,v,u,f),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:`${d??p} - ${g??m}`,value:R}]},{seriesId:s,datum:v,title:c,itemId:i,xName:l,yName:c,yLowKey:p,yLowName:d,xKey:u,yHighKey:m,yHighName:g,legendItemName:f,...N})}legendItemSymbol(){const{fill:e,topLevel:t}=this.getStyle(!1),{stroke:i,strokeWidth:s,strokeOpacity:o,lineDash:a,marker:n}=t;return{marker:{shape:n.shape,fill:n.fill??e,stroke:n.stroke??i,fillOpacity:n.fillOpacity,strokeOpacity:n.strokeOpacity,strokeWidth:n.strokeWidth,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset},line:{stroke:i,strokeOpacity:o,strokeWidth:s,lineDash:a}}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{yLowKey:s,yHighKey:o,yName:a,yLowName:n,yHighName:r,legendItemName:l,showInLegend:c}=this.properties,p=l??a??`${n??s} - ${r??o}`,d=`${s}-${o}`;return[{legendType:"category",id:t,itemId:d,seriesId:t,enabled:i,label:{text:`${p}`},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!c}]}isLabelEnabled(){return this.properties.label.enabled}onDataChange(){}nodeFactory(){return new OS}animateEmptyUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:s,paths:o}=e,{animationManager:a}=this.ctx;this.updateAreaPaths(o,s),AS(this,a,...o),MS([t],Rc),NS(this,a,t),dn(this,"labels",a,i)}animateReadyResize(e){const{contextData:t,paths:i}=e;this.updateAreaPaths(i,t),super.animateReadyResize(e)}animateWaitingUpdateReady(e){const{animationManager:t}=this.ctx,{datumSelection:i,labelSelection:s,contextData:o,paths:a,previousContextData:n}=e,[r,l,c]=a;if(r==null&&l==null&&c==null)return;this.resetDatumAnimation(e),this.resetLabelAnimation(e);const p=()=>{this.resetPathAnimation(e),this.updateAreaPaths(a,o)},d=()=>{t.skipCurrentBatch(),p()};if(o==null||n==null){p(),_c(this,t,"added",i),gn(this,"fill_path_properties",t,"add",r),gn(this,"low_stroke_path_properties",t,"add",l),gn(this,"high_stroke_path_properties",t,"add",c),dn(this,"labels",t,s);return}const u=SS(o,n,this.processedData?.reduced?.diff?.[this.id]);if(u===void 0){d();return}else if(u.status==="no-op")return;mn(this.id,"fill_path_properties",t,[r],u.fill.pathProperties),mn(this.id,"low_stroke_path_properties",t,[l],u.stroke.pathProperties),mn(this.id,"high_stroke_path_properties",t,[c],u.stroke.pathProperties),u.status==="added"?this.updateAreaPaths(a,o):u.status==="removed"?this.updateAreaPaths(a,n):(yn(this.id,"fill_path_update",t,[r],u.fill.path),yn(this.id,"low_stroke_path_update",t,[l],u.stroke.path),yn(this.id,"high_stroke_path_update",t,[c],u.stroke.path)),u.hasMotion&&(_c(this,t,void 0,i),dn(this,"labels",t,s)),this.ctx.animationManager.animate({id:this.id,groupId:"reset_after_animation",phase:"trailing",from:{},to:{},onComplete:()=>this.updateAreaPaths(a,o)})}getFormattedMarkerStyle(e){const t=this.getStyle(!1),i=this.makeItemStylerParams(e.itemId);return this.getMarkerStyle(this.properties.item[e.itemId].marker,e,i,{isHighlight:!0,resolveMarkerSubPath:["item",e.itemId,"marker"]},void 0,t)}getMarkerStyle(e,t,i,s,o,a){return e.itemStyler=this.properties.marker.itemStyler,super.getMarkerStyle(e,t,i,s,o,a)}computeFocusBounds(e){const t=Pc(this,e),i=Pc(this,{...e,datumIndex:e.datumIndex+1});if(t&&i)return _S.merge([t,i])}isDatumEnabled(e,t){return t%2===0&&super.isDatumEnabled(e,t)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};Do.className="RangeAreaSeries",Do.type="range-area";import{_ModuleSupport as YS}from"ag-charts-community";import{boolean as wc,constant as US,fillOptionsDef as qS,number as jS,required as Io,shapeSegmentation as JS,string as Zt,undocumented as Ec}from"ag-charts-core";var{commonSeriesOptionsDefs:ZS,rangeAreaSeriesThemeableOptionsDef:QS}=YS,fn={...ZS,...QS,type:Io(US("range-area")),xKey:Io(Zt),yLowKey:Io(Zt),yHighKey:Io(Zt),xName:Zt,yName:Zt,yLowName:Zt,yHighName:Zt,legendItemName:Zt,segmentation:JS,invertedStyle:{enabled:wc,...qS}};fn.pickOutsideVisibleMinorAxis=Ec(wc),fn.focusPriority=Ec(jS);import{_ModuleSupport as We}from"ag-charts-community";var Fc={lineDash:{$path:"/series/$index/lineDash"},lineDashOffset:{$path:"/series/$index/lineDashOffset"},stroke:{$path:["/series/$index/stroke",{$palette:"stroke"}]},strokeOpacity:{$path:"/series/$index/strokeOpacity"},strokeWidth:{$path:["/series/$index/strokeWidth",1]},marker:{enabled:{$path:"/series/$index/marker/enabled"},fill:{$isUserOption:["/series/$index/marker/fill",{$if:[{$or:[{$isGradient:{$path:"/series/$index/marker/fill"}},{$isImage:{$path:"/series/$index/marker/fill"}},{$isPattern:{$path:"/series/$index/marker/fill"}}]},{$merge:[{$path:"/series/$index/marker/fill"},{$applySwitch:[{$path:"type"},void 0,["gradient",We.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",We.FILL_IMAGE_DEFAULTS],["pattern",We.FILL_PATTERN_DEFAULTS]]}]},{$isUserOption:["/series/$index/marker/fill",{$path:"/series/$index/marker/fill"},{$palette:"fill"}]}]},{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",We.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",We.FILL_IMAGE_DEFAULTS],["pattern",We.FILL_PATTERN_DEFAULTS]]}]},fillOpacity:{$path:"/series/$index/marker/fillOpacity"},lineDash:{$path:"/series/$index/marker/lineDash"},lineDashOffset:{$path:"/series/$index/marker/lineDashOffset"},shape:{$path:"/series/$index/marker/shape"},size:{$path:["/series/$index/marker/size",6]},stroke:{$path:["/series/$index/marker/stroke",{$palette:"stroke"}]},strokeOpacity:{$path:"/series/$index/marker/strokeOpacity"},strokeWidth:{$path:["/series/$index/marker/strokeWidth",2]}}},ex={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",We.FILL_GRADIENT_LINEAR_DEFAULTS],["pattern",We.FILL_PATTERN_DEFAULTS]]},fillOpacity:.7,stroke:{$palette:"stroke"},strokeWidth:1,marker:{enabled:!1,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",We.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",We.FILL_IMAGE_DEFAULTS],["pattern",We.FILL_PATTERN_DEFAULTS]]},shape:"circle",stroke:{$palette:"stroke"},size:6,strokeWidth:2},nodeClickRange:"nearest",item:{low:Fc,high:Fc},label:{...We.LABEL_BOXING_DEFAULTS,enabled:!1,placement:"outside",padding:{$isUserOption:["./spacing",0,10]},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},interpolation:{type:"linear"},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:We.multiSeriesHighlightStyle(),segmentation:We.SEGMENTATION_DEFAULTS,invertedStyle:{enabled:!1,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",We.FILL_GRADIENT_LINEAR_DEFAULTS],["image",We.FILL_IMAGE_DEFAULTS],["pattern",We.FILL_PATTERN_DEFAULTS]]},fillOpacity:{$path:"../fillOpacity"}}},axes:{[We.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{enabled:!0}}}},{ThemeConstants:{CARTESIAN_AXIS_TYPE:Bc,CARTESIAN_POSITION:Gc}}=xc,RR={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"range-area",moduleFactory:e=>new Do(e),predictAxis:xc.predictCartesianTimeAxis,defaultAxes:[{type:Bc.NUMBER,position:Gc.LEFT},{type:Bc.CATEGORY,position:Gc.BOTTOM}],themeTemplate:ex},Sn={type:"series",name:"range-area",chartType:"cartesian",enterprise:!0,options:fn,create:e=>new Do(e)};import{_ModuleSupport as Vc}from"ag-charts-community";import{_ModuleSupport as Ao}from"ag-charts-community";import{_ModuleSupport as tx}from"ag-charts-community";var{aggregationDomain:ix,aggregationRangeFittingPoints:sx,compactAggregationIndices:ox,createAggregationIndices:ax}=tx,nx=1e3;function rx(e,t,i,s,o,a){if(t.length64;)({indexData:c,valueData:p,maxRange:l}=ox(c,p,l)),d.push({maxRange:l,indexData:c});return d.reverse(),d}import{_ModuleSupport as lx}from"ag-charts-community";var{AbstractBarSeriesProperties:cx,makeSeriesTooltip:hx,Property:De,DropShadow:px,Label:dx}=lx,xn=class extends dx{constructor(){super(...arguments),this.placement="inside",this.spacing=0}};h([De],xn.prototype,"placement",2),h([De],xn.prototype,"spacing",2);var Ne=class extends cx{constructor(){super(...arguments),this.fill="#99CCFF",this.fillOpacity=1,this.stroke="#99CCFF",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.shadow=new px().set({enabled:!1}),this.label=new xn,this.tooltip=hx()}};h([De],Ne.prototype,"xKey",2),h([De],Ne.prototype,"yLowKey",2),h([De],Ne.prototype,"yHighKey",2),h([De],Ne.prototype,"xName",2),h([De],Ne.prototype,"yName",2),h([De],Ne.prototype,"yLowName",2),h([De],Ne.prototype,"yHighName",2),h([De],Ne.prototype,"fill",2),h([De],Ne.prototype,"fillOpacity",2),h([De],Ne.prototype,"stroke",2),h([De],Ne.prototype,"strokeWidth",2),h([De],Ne.prototype,"strokeOpacity",2),h([De],Ne.prototype,"lineDash",2),h([De],Ne.prototype,"lineDashOffset",2),h([De],Ne.prototype,"cornerRadius",2),h([De],Ne.prototype,"styler",2),h([De],Ne.prototype,"itemStyler",2),h([De],Ne.prototype,"shadow",2),h([De],Ne.prototype,"label",2),h([De],Ne.prototype,"tooltip",2);var{SeriesNodePickMode:Kc,valueProperty:Wc,keyProperty:ux,ChartAxisDirection:Ms,checkCrisp:gx,updateLabelNode:mx,SMALLEST_KEY_INTERVAL:yx,LARGEST_KEY_INTERVAL:fx,diff:Sx,prepareBarAnimationFunctions:zc,midpointStartingBarPosition:$c,resetBarSelectionsFn:xx,fixNumericExtent:bx,seriesLabelFadeInAnimation:Hc,resetLabelFn:vx,animationValidation:kx,computeBarFocusBounds:Dx,visibleRangeIndices:Ix,createDatumId:Ax,ContinuousScale:Mx,Rect:Nx,PointerEvents:Lx,motion:Xc,applyShapeStyle:Tx,findMinMax:Rx,areScalingEqual:Px,processedDataIsAnimatable:Cx,AGGREGATION_SPAN:Yc,AGGREGATION_INDEX_X_MAX:Uc,AGGREGATION_INDEX_X_MIN:qc,AGGREGATION_INDEX_Y_MAX:Ox,AGGREGATION_INDEX_Y_MIN:_x,mergeDefaults:jc,simpleMemorize2:wx,getItemStyles:Ex,calculateSegments:Fx,toHighlightString:Bx,HighlightState:Jc}=Ao,Gx=wx(rx),Vx=class extends Ao.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.yLowKey=s.properties.yLowKey,this.yHighKey=s.properties.yHighKey}},Mo=class extends Ao.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[Kc.AXIS_ALIGNED,Kc.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["yLowKey","yHighKey"]},propertyNames:{x:["xName"],y:["yLowName","yHighName","yName"]},categoryKey:"xValue",datumSelectionGarbageCollection:!1,animationResetFns:{datum:xx,label:vx}}),this.properties=new Ne,this.dataAggregationFilters=void 0,this.NodeEvent=Vx}async processData(e){const{xKey:t,yLowKey:i,yHighKey:s}=this.properties,o=this.getCategoryAxis()?.scale,a=this.getValueAxis()?.scale,{isContinuousX:n,xScaleType:r,yScaleType:l}=this.getScaleInformation({xScale:o,yScale:a}),c=[];this.ctx.animationManager.isSkipped()||(this.processedData&&c.push(Sx(this.id,this.processedData)),c.push(kx()));const p=this.visible?{}:{forceValue:0},{dataModel:d,processedData:u}=await this.requestDataModel(e,this.data,{props:[ux(t,r,{id:"xValue"}),Wc(i,l,{id:"yLowValue",invalidValue:null,...p}),Wc(s,l,{id:"yHighValue",invalidValue:null,...p}),...n?[yx,fx]:[],...c],groupByKeys:!1});this.smallestDataInterval=u.reduced?.smallestKeyInterval,this.largestDataInterval=u.reduced?.largestKeyInterval,this.dataAggregationFilters=this.aggregateData(d,u),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||Cx(t))return;const i=this.axes[Ms.X];if(i==null)return;const s=e.resolveKeysById(this,"xValue",t),o=e.resolveColumnById(this,"yHighValue",t),a=e.resolveColumnById(this,"yLowValue",t),{index:n}=e.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[n];return Gx(i.scale.type,s,o,a,r,t.reduced?.smallestKeyInterval)}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!t||!i)return[];const{keys:[s]}=t.domain;if(e===this.getCategoryDirection()){const o=i.resolveProcessedDataDefById(this,"xValue");return o?.def.type==="key"&&o?.def.valueType==="category"?s:this.padBandExtent(s)}else{const o=this.domainForClippedRange(e,["yHighValue","yLowValue"],"xValue"),a=Rx(o);return bx(a)}}getSeriesRange(e,t){return this.domainForVisibleRange(Ms.Y,["yHighValue","yLowValue"],"xValue",t)}createNodeData(){const{data:e,dataModel:t,groupScale:i,processedData:s,visible:o}=this,a=this.getCategoryAxis(),n=this.getValueAxis();if(!(e&&a&&n&&t&&s?.dataSources&&this.chart?.seriesRect))return;const r=a.scale,l=n.scale,c=this.getBarDirection()===Ms.X,{xKey:p,yLowKey:d,yHighKey:u,strokeWidth:m}=this.properties,g=`${d}-${u}`,y=Fx(this.properties.segmentation,a,n,this.chart.seriesRect,this.ctx.scene),f={itemId:g,nodeData:[],labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:Ex(this.getItemStyle.bind(this)),segments:y};if(!o)return f;const S=s.dataSources.get(this.id)?.data??[],x=t.resolveKeysById(this,"xValue",s),v=t.resolveColumnById(this,"yLowValue",s),b=t.resolveColumnById(this,"yHighValue",s),{barWidth:k,groupIndex:A}=this.updateGroupScale(a),I=Mx.is(r)?k*-.5:0,D=i.convert(String(A)),N=gx(a?.scale,a?.visibleRange,this.smallestDataInterval,this.largestDataInterval),R=P=>Math.round(r.convert(x[P]))+D+I,C=(P,T,M,O,B,F,V)=>{const W=S[P],K=x[P];if(K==null)return;const z=v[P],$=b[P];if(!Number.isFinite(z?.valueOf())||!Number.isFinite($?.valueOf()))return;const[Z,q]=z<$?[z,$]:[$,z],Y=Math.round(l.convert(F)),Q=Math.round(l.convert(B)),ie=Math.max(m,Math.abs(Q-Y)),U={x:c?Math.min(Y,Q):M,y:c?M:Math.min(Y,Q),width:c?ie:O,height:c?O:ie},ce={x:U.x+U.width/2,y:U.y+U.height/2},ae=this.createLabelData({datumIndex:P,rect:U,barAlongX:c,yLowValue:Z,yHighValue:q,datum:W,series:this}),j={index:T,series:this,itemId:g,datum:W,datumIndex:P,xValue:K,yLowValue:z,yHighValue:$,yLowKey:d,yHighKey:u,xKey:p,x:U.x,y:U.y,width:U.width,height:U.height,midPoint:ce,crisp:V,labels:ae};f.nodeData.push(j),f.labelData.push(...ae)},{dataAggregationFilters:w}=this,[G,_]=r.range,E=Math.abs(_-G),L=w?.find(P=>P.maxRange>E);if(L!=null){const{maxRange:P,indexData:T}=L,[M,O]=Ix(1,P,a.range,B=>{const F=B*Yc,V=T[F+qc],W=T[F+Uc];if(V===-1)return;const K=Math.trunc((V+W)/2);return[R(K),R(W)+k]});for(let B=M;Bthis.getDatumId(o))}getItemStyle(e,t,i){const{properties:s,dataModel:o,processedData:a}=this,{itemStyler:n}=s,r=this.getHighlightStyle(t,e,i);let l=jc(r,this.getStyle(e===void 0,t,i));if(n&&o!=null&&a!=null&&e!=null){const c=o.resolveKeysById(this,"xValue",a)[e],p=this.cachedDatumCallback(Ax(this.getDatumId({xValue:c}),t?"highlight":"node"),()=>{const d=this.makeItemStylerParams(e,t,l);return this.callWithContext(n,d)});p&&(l=jc(p,l))}return l}makeItemStylerParams(e,t,i){const{id:s,properties:o,processedData:a}=this,{xKey:n,yHighKey:r,yLowKey:l}=o,c=a.dataSources.get(s)?.data[e],p=this.ctx.highlightManager?.getActiveHighlight(),d=this.getHighlightStateString(p,t,e),u=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:c,xKey:n,yHighKey:r,yLowKey:l,highlighted:t,highlightState:d,...i,fill:u}}updateDatumStyles(e){const t=this.ctx.highlightManager.getActiveHighlight();e.datumSelection.each((i,s)=>{if(!e.datumSelection.isGarbage(i)){const o=this.getHighlightState(t,e.isHighlight,s.datumIndex);s.style=this.getItemStyle(s.datumIndex,e.isHighlight,o)}})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight(),o=this.getCategoryDirection()===Ms.X,a=this.getShapeFillBBox();e.each((n,r)=>{const l=r.style??i.styles[this.getHighlightState(s,t,r.datumIndex)];Tx(n,l,a),n.cornerRadius=l.cornerRadius??0,n.visible=o?r.width>0:r.height>0,n.crisp=r.crisp})}updateLabelSelection(e){const t=this.properties.label.enabled?e.labelData:[];return e.labelSelection.update(t,i=>{i.pointerEvents=Lx.None})}updateLabelNodes(e){const t={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yName:this.properties.yName,yLowKey:this.properties.yLowKey,yLowName:this.properties.yLowName??this.properties.yLowKey,yHighKey:this.properties.yHighKey,yHighName:this.properties.yHighName??this.properties.yHighKey,legendItemName:this.properties.legendItemName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,o)=>{s.fillOpacity=this.getHighlightStyle(!1,o?.datumIndex).opacity??1,mx(this,s,t,this.properties.label,o,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:o}=this,{xKey:a,xName:n,yName:r,yLowKey:l,yHighKey:c,yLowName:p,yHighName:d,tooltip:u,legendItemName:m}=o,g=this.getCategoryAxis(),y=this.getValueAxis();if(!i||!s||!g||!y)return;const f=s.dataSources.get(this.id)?.data[e],S=i.resolveKeysById(this,"xValue",s)[e],x=i.resolveColumnById(this,"yHighValue",s)[e],v=i.resolveColumnById(this,"yLowValue",s)[e];if(S==null)return;const b=this.getItemStyle(e,!1),k=`${this.getAxisValueText(y,"tooltip",v,f,l,m)} - ${this.getAxisValueText(y,"tooltip",x,f,c,m)}`;return this.formatTooltipWithContext(u,{heading:this.getAxisValueText(g,"tooltip",S,f,a,m),symbol:this.legendItemSymbol(),data:[{label:r,fallbackLabel:`${p??l} - ${d??c}`,value:k}]},{seriesId:t,datum:f,title:r,xKey:a,xName:n,yName:r,yLowKey:l,yHighKey:c,yLowName:p,yHighName:d,legendItemName:m,...b})}legendItemSymbol(){const{fill:e,stroke:t,strokeWidth:i,fillOpacity:s,strokeOpacity:o,lineDash:a,lineDashOffset:n}=this.getStyle(!1,!1,Jc.None);return{marker:{fill:e,stroke:t,fillOpacity:s,strokeOpacity:o,strokeWidth:i,lineDash:a,lineDashOffset:n}}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{yName:s,yLowName:o,yHighName:a,yLowKey:n,yHighKey:r,legendItemName:l,showInLegend:c}=this.properties,p=l??s??`${o??n} - ${a??r}`,d=`${n}-${r}`;return[{legendType:"category",id:t,itemId:d,seriesId:t,enabled:i,label:{text:`${p}`},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!c}]}animateEmptyUpdateReady({datumSelection:e,labelSelection:t}){const i=zc($c(this.isVertical(),"normal"),"unknown");Xc.fromToMotion(this.id,"datums",this.ctx.animationManager,[e],i),Hc(this,"labels",this.ctx.animationManager,t)}animateWaitingUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:s,previousContextData:o}=e,a=Ao.calculateDataDiff(this.id,t,this.getDatumId.bind(this),s,o,this.processedData,this.processedDataUpdated);this.ctx.animationManager.stopByAnimationGroupId(this.id);const n=o==null?"fade":"normal",r=zc($c(this.isVertical(),n),"added");Xc.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],r,(l,c)=>this.getDatumId(c),a),(a?.changed||!Px(s.groupScale,o?.groupScale))&&Hc(this,"labels",this.ctx.animationManager,i)}getDatumId(e){return`${e.xValue}`}isLabelEnabled(){return this.properties.label.enabled}onDataChange(){}computeFocusBounds({datumIndex:e}){return Dx(this,this.contextNodeData?.nodeData[e])}hasItemStylers(){return this.properties.styler!=null||this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};Mo.className="RangeBarSeries",Mo.type="range-bar";import{_ModuleSupport as Kx}from"ag-charts-community";import{boolean as Wx,constant as zx,number as $x,required as No,shapeSegmentation as Hx,string as Qt,undocumented as Zc}from"ag-charts-core";var{commonSeriesOptionsDefs:Xx,rangeBarSeriesThemeableOptionsDef:Yx}=Kx,bn={...Xx,...Yx,type:No(zx("range-bar")),xKey:No(Qt),yLowKey:No(Qt),yHighKey:No(Qt),xName:Qt,yName:Qt,yLowName:Qt,yHighName:Qt,legendItemName:Qt,segmentation:Hx};bn.pickOutsideVisibleMinorAxis=Zc(Wx),bn.focusPriority=Zc($x);import{_ModuleSupport as bi}from"ag-charts-community";var Ux={series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",bi.FILL_GRADIENT_LINEAR_DEFAULTS],["image",bi.FILL_IMAGE_DEFAULTS],["pattern",bi.FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{...bi.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},placement:"inside",padding:{$isUserOption:["./spacing",0,6]}},highlight:bi.multiSeriesHighlightStyle(),segmentation:bi.SEGMENTATION_DEFAULTS},axes:{[bi.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{enabled:!0}}}},BR={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"range-bar",moduleFactory:e=>new Mo(e),predictAxis:Vc.predictCartesianTimeAxis,defaultAxes:Vc.DIRECTION_SWAP_AXES,themeTemplate:Ux,groupable:!0},vn={type:"series",name:"range-bar",chartType:"cartesian",enterprise:!0,options:bn,create:e=>new Mo(e)};import{_ModuleSupport as qx}from"ag-charts-community";import{_ModuleSupport as vi}from"ag-charts-community";import{_ModuleSupport as jx}from"ag-charts-community";var{AbstractBarSeriesProperties:Jx,BaseProperties:Ns,PropertiesArray:Zx,makeSeriesTooltip:Qx,Property:ne,DropShadow:eb,Label:tb}=jx,Lo=class extends Ns{};h([ne],Lo.prototype,"totalType",2),h([ne],Lo.prototype,"index",2),h([ne],Lo.prototype,"axisLabel",2);var Qc=class extends Ns{};h([ne],Qc.prototype,"renderer",2);var kn=class extends tb{constructor(){super(...arguments),this.placement="outside-end",this.spacing=0}};h([ne],kn.prototype,"placement",2),h([ne],kn.prototype,"spacing",2);var je=class extends Ns{constructor(){super(...arguments),this.fill="#c16068",this.stroke="#c16068",this.fillOpacity=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.strokeWidth=1,this.cornerRadius=0,this.shadow=new eb().set({enabled:!1}),this.label=new kn,this.tooltip=new Qc}};h([ne],je.prototype,"name",2),h([ne],je.prototype,"fill",2),h([ne],je.prototype,"stroke",2),h([ne],je.prototype,"fillOpacity",2),h([ne],je.prototype,"strokeOpacity",2),h([ne],je.prototype,"lineDash",2),h([ne],je.prototype,"lineDashOffset",2),h([ne],je.prototype,"strokeWidth",2),h([ne],je.prototype,"cornerRadius",2),h([ne],je.prototype,"itemStyler",2),h([ne],je.prototype,"shadow",2),h([ne],je.prototype,"label",2),h([ne],je.prototype,"tooltip",2);var ki=class extends Ns{constructor(){super(...arguments),this.enabled=!0,this.stroke="black",this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.strokeWidth=2}};h([ne],ki.prototype,"enabled",2),h([ne],ki.prototype,"stroke",2),h([ne],ki.prototype,"strokeOpacity",2),h([ne],ki.prototype,"lineDash",2),h([ne],ki.prototype,"lineDashOffset",2),h([ne],ki.prototype,"strokeWidth",2);var To=class extends Ns{constructor(){super(...arguments),this.positive=new je,this.negative=new je,this.total=new je}};h([ne],To.prototype,"positive",2),h([ne],To.prototype,"negative",2),h([ne],To.prototype,"total",2);var zt=class extends Jx{constructor(){super(...arguments),this.item=new To,this.totals=new Zx(Lo),this.line=new ki,this.tooltip=Qx()}getStyle(e){const{fillOpacity:t,strokeWidth:i,strokeOpacity:s,fill:o,stroke:a,lineDash:n,lineDashOffset:r,cornerRadius:l}=this.item[e==="subtotal"?"total":e];return{fill:o,fillOpacity:t,stroke:a,strokeWidth:i,strokeOpacity:s,lineDash:n,lineDashOffset:r,cornerRadius:l,opacity:1}}};h([ne],zt.prototype,"xKey",2),h([ne],zt.prototype,"yKey",2),h([ne],zt.prototype,"xName",2),h([ne],zt.prototype,"yName",2),h([ne],zt.prototype,"item",2),h([ne],zt.prototype,"totals",2),h([ne],zt.prototype,"line",2),h([ne],zt.prototype,"tooltip",2);var{adjustLabelPlacement:ib,SeriesNodePickMode:eh,fixNumericExtent:sb,valueProperty:th,keyProperty:ob,accumulativeValueProperty:Ro,trailingAccumulatedValueProperty:ab,ChartAxisDirection:Po,createDatumId:nb,checkCrisp:rb,updateLabelNode:lb,prepareBarAnimationFunctions:cb,collapsedStartingBarPosition:hb,resetBarSelectionsFn:pb,seriesLabelFadeInAnimation:db,resetLabelFn:ub,animationValidation:gb,DEFAULT_CARTESIAN_DIRECTION_KEYS:mb,DEFAULT_CARTESIAN_DIRECTION_NAMES:yb,computeBarFocusBounds:fb,isContinuous:ih,Rect:Sb,motion:xb,applyShapeStyle:bb,mergeDefaults:sh,getItemStylesPerItemId:vb,DataSet:kb}=vi,Co=class extends vi.AbstractBarSeries{constructor(e){super({moduleCtx:e,propertyKeys:mb,propertyNames:yb,categoryKey:void 0,pickModes:[eh.NEAREST_NODE,eh.EXACT_SHAPE_MATCH],pathsPerSeries:["connector"],pathsZIndexSubOrderOffset:[-1,-1],animationResetFns:{datum:pb,label:ub}}),this.properties=new zt,this.seriesItemTypes=new Set(["positive","negative","total"])}async processData(e){const{xKey:t,yKey:i,totals:s}=this.properties,{data:o}=this;if(!this.visible)return;const a=x=>ih(x)&&Number(x)>=0,n=x=>ih(x)&&Number(x)>=0,r=x=>x==="total"||x==="subtotal",l={missingValue:void 0,invalidValue:void 0},c=[],p=s.reduce((x,v)=>{const b=x.get(v.index);return b?b.push(v):x.set(v.index,[v]),x},new Map);for(const[x,v]of o?.data.entries()??[]){c.push(v);const b=p.get(x);if(b)for(const k of b)c.push({...k.toJson(),[t]:k.axisLabel})}const d=[];this.ctx.animationManager.isSkipped()||d.push(gb());const u=this.getCategoryAxis()?.scale,m=this.getValueAxis()?.scale,{isContinuousX:g,xScaleType:y,yScaleType:f}=this.getScaleInformation({xScale:u,yScale:m}),{processedData:S}=await this.requestDataModel(e,kb.wrap(c),{props:[ob(t,y,{id:"xValue"}),Ro(i,f,{...l,id:"yCurrent"}),Ro(i,f,{...l,missingValue:0,id:"yCurrentTotal"}),Ro(i,f,{...l,id:"yCurrentPositive",validation:a}),Ro(i,f,{...l,id:"yCurrentNegative",validation:n}),ab(i,f,{...l,id:"yPrevious"}),th(i,f,{id:"yRaw"}),th("totalType","category",{id:"totalTypeValue",missingValue:void 0,validation:r}),...g?[vi.SMALLEST_KEY_INTERVAL,vi.LARGEST_KEY_INTERVAL]:[],...d]});this.smallestDataInterval=S.reduced?.smallestKeyInterval,this.largestDataInterval=S.reduced?.largestKeyInterval,this.updateSeriesItemTypes(),this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!t||!i)return[];const{keys:[s],values:o}=t.domain;if(e===this.getCategoryDirection()){const a=i.resolveProcessedDataDefById(this,"xValue");if(a?.def.type==="key"&&a?.def.valueType==="category")return s;const n=e===Po.Y,r=this.getCategoryAxis().isReversed();return this.padBandExtent(s,r!==n)}else{const a=i.resolveProcessedDataIndexById(this,"yCurrent"),n=o[a],r=[Math.min(0,n[0]),Math.max(0,n[1])];return sb(r)}}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{data:e,dataModel:t,processedData:i}=this,s=this.getCategoryAxis(),o=this.getValueAxis();if(!e||!s||!o||!t||!i)return;const{line:a}=this.properties,n=s.scale,r=o.scale,l=this.getBarDirection()===Po.X,c=this.getBandwidth(s)??10,p=s.isReversed(),d=o.isReversed();if(i.type!=="ungrouped")return;const u={itemId:this.properties.yKey,nodeData:[],labelData:[],pointData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:vb(this.getItemStyle.bind(this),"total","subtotal","positive","negative")};if(!this.visible)return u;const m=[],g=t.resolveKeysById(this,"xValue",i),y=t.resolveColumnById(this,"yRaw",i),f=t.resolveColumnById(this,"totalTypeValue",i),S=t.resolveColumnById(this,"yCurrent",i),x=t.resolveColumnById(this,"yPrevious",i),v=t.resolveColumnById(this,"yCurrentTotal",i),b=this.getSeriesDomain(Po.Y),k=rb(s?.scale,s?.visibleRange,this.smallestDataInterval,this.largestDataInterval);function A(E,L,P){return E||L?{cumulativeValue:v[P],trailingValue:L?D:0}:{cumulativeValue:S[P],trailingValue:x[P]}}function I(E,L,P,T,M){return E?T:L?(T??0)-(M??0):P}let D=0;const{xKey:N,yKey:R,xName:C,yName:w}=this.properties,G=i.dataSources.get(this.id)?.data??[];for(const[E,L]of G.entries()){const P=f[E],T=this.isSubtotal(P),M=this.isTotal(P),O=M||T,B=g[E];if(B==null)continue;const F=Math.round(n.convert(B)),V=y[E],{cumulativeValue:W,trailingValue:K}=A(M,T,E);O&&(D=W??0);const z=Math.round(r.convert(W)),$=Math.round(r.convert(K)),Z=I(M,T,V,W,K),q=(Z??0)>=0,Y=this.getSeriesItemType(q,P),{strokeWidth:Q,label:ie}=this.getItemConfig(Y),U=q?z:$,ce=q?$:z,ae=Math.max(Q,Math.abs(ce-U)),j={x:l?Math.min(U,ce):F,y:l?F:Math.min(U,ce),width:l?ae:c,height:l?c:ae},re={x:j.x+j.width/2,y:j.y+j.height/2},se=O?z:$,ue=Math.floor(a.strokeWidth)%2/2,le=p?z:se,ye=p?se:z;let we,rt;l?(we={x:le+ue,y:j.y},rt={x:ye+ue,y:j.y+j.height}):(we={x:j.x,y:le+ue},rt={x:j.x+j.width,y:ye+ue});const pi={x:p?rt.x:we.x,y:p?rt.y:we.y,x2:p?we.x:rt.x,y2:p?we.y:rt.y,size:0};m.push(pi);const bt=Y==="subtotal"?"total":Y,Pt=this.getLabelText(Z,L,R,"y",b,ie,{itemId:bt,value:Z,datum:L,xKey:N,yKey:R,xName:C,yName:w}),gs=ie.spacing+(typeof ie.padding=="number"?ie.padding:0),ms={index:E,series:this,itemId:Y,datum:L,datumIndex:E,cumulativeValue:W??0,xValue:B,yValue:Z,yKey:R,xKey:N,x:j.x,y:j.y,width:j.width,height:j.height,midPoint:re,crisp:k,label:{text:Pt,...ib({isUpward:(Z??-1)>=0!==d,isVertical:!l,placement:ie.placement,spacing:gs,rect:j})}};u.nodeData.push(ms),u.labelData.push(ms)}const _=this.properties.line.enabled;return S!=null&&_&&(u.pointData=m),u}updateSeriesItemTypes(){const{dataModel:e,seriesItemTypes:t,processedData:i}=this;if(!e||!i)return;t.clear();const s=e.resolveProcessedDataIndexById(this,"yCurrentPositive"),o=e.resolveProcessedDataIndexById(this,"yCurrentNegative"),a=e.resolveProcessedDataIndexById(this,"totalTypeValue"),n=i.domain.values[s]??[],r=i.domain.values[o]??[];n.length>0&&t.add("positive"),r.length>0&&t.add("negative");const l=i?.domain.values[a];if(l)for(const c of l)(c==="total"||c==="subtotal")&&t.add("total")}isSubtotal(e){return e==="subtotal"}isTotal(e){return e==="total"}nodeFactory(){return new Sb}getSeriesItemType(e,t){return t??(e?"positive":"negative")}getItemConfig(e){switch(e){case"positive":return this.properties.item.positive;case"negative":return this.properties.item.negative;case"subtotal":case"total":return this.properties.item.total}}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,s=t??[];return i.update(s)}getItemStyle(e,t,i,s="total"){const{properties:o}=this,{datumIndex:a=0,datum:n}=e??{},r=s==="subtotal"?"total":s,l=o.item[r],c=this.getHighlightStyle(t,a,i),p=sh(c,o.getStyle(s)),{itemStyler:d}=l;let u=p;if(d!=null&&e!=null){const m=this.cachedDatumCallback(nb(a,t?"highlight":"node"),()=>{const g=this.makeItemStylerParams(s,a,n,t,u);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`,"item",r],this.callWithContext(d,g))});m&&(u=sh(m,u))}return u}makeItemStylerParams(e,t,i,s,o){const{id:a,properties:n}=this,{xKey:r,yKey:l}=n,c=this.ctx.highlightManager?.getActiveHighlight(),p=this.getHighlightStateString(c,s,t),d=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:a,itemId:e,datum:i,xKey:r,yKey:l,highlighted:s,highlightState:p,...o,fill:d}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t,void 0,s.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight(),o=this.getCategoryDirection()===Po.X,a=this.getShapeFillBBox();e.each((n,r)=>{const l=r.style??i.styles[r.itemId][this.getHighlightState(s,t,r.datumIndex)];bb(n,l,a),n.cornerRadius=l.cornerRadius??0,n.visible=o?r.width>0:r.height>0,n.crisp=r.crisp})}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;if(t.length===0)return i.update([]);const s=t.filter(o=>{const{label:a}=this.getItemConfig(o.itemId);return a.enabled});return i.update(s)}updateLabelNodes(e){const t={itemId:"positive",xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xName,yKey:this.properties.yKey,yName:this.properties.yName??this.properties.yName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,o)=>{t.itemId=o.itemId,s.fillOpacity=this.getHighlightStyle(!1,o.datumIndex)?.opacity??1;const a=this.getItemConfig(o.itemId).label;lb(this,s,t,a,o.label,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:o}=this,{xKey:a,xName:n,yKey:r,yName:l,tooltip:c,legendItemName:p}=o,d=this.getCategoryAxis(),u=this.getValueAxis();if(!i||!s||!d||!u)return;const m=s.dataSources.get(this.id)?.data[e],g=i.resolveKeysById(this,"xValue",s)[e],y=i.resolveColumnById(this,"yRaw",s)[e],f=i.resolveColumnById(this,"yCurrentTotal",s),S=i.resolveColumnById(this,"totalTypeValue",s);if(g==null)return;const x=S[e],v=(y??0)>=0,b=this.getSeriesItemType(v,x);let k;if(this.isTotal(x))k=f[e];else if(this.isSubtotal(x)){k=f[e];for(let D=e-1;D>=0;D-=1)if(this.isSubtotal(S[D])){k=k-f[D];break}}else k=y;const A=this.contextNodeData?.nodeData?.[e],I=this.getItemStyle(A,!1,void 0,A?.itemId);return this.formatTooltipWithContext(c,{heading:this.getAxisValueText(d,"tooltip",g,m,a,p),symbol:this.legendItemSymbol(b),data:[{label:l,fallbackLabel:r,value:this.getAxisValueText(u,"tooltip",k,m,r,p)}]},{seriesId:t,datum:m,title:l,itemId:b,xKey:a,xName:n,yKey:r,yName:l,...I})}legendItemSymbol(e){const{fill:t,stroke:i,fillOpacity:s,strokeOpacity:o,strokeWidth:a,lineDash:n,lineDashOffset:r}=this.getItemConfig(e);return{marker:{fill:t,stroke:i,fillOpacity:s,strokeOpacity:o,strokeWidth:a,lineDash:n,lineDashOffset:r}}}getLegendData(e){if(e!=="category")return[];const{id:t,seriesItemTypes:i}=this,s=[],o=n=>n.charAt(0).toUpperCase()+n.substring(1),{showInLegend:a}=this.properties;for(const n of i){const{name:r}=this.getItemConfig(n);s.push({legendType:"category",id:t,itemId:n,seriesId:t,enabled:!0,label:{text:r??o(n)},symbol:this.legendItemSymbol(n),hideInLegend:!a,isFixed:!0})}return s}toggleSeriesItem(){}animateEmptyUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:s}=e,o=cb(hb(this.isVertical(),this.axes,"normal"),"unknown");xb.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],o),db(this,"labels",this.ctx.animationManager,i);const{pointData:a}=s;a&&(this.isVertical()?this.animateConnectorLinesVertical(e):this.animateConnectorLinesHorizontal(e))}animateConnectorLinesHorizontal(e){const{pointData:t=[]}=e.contextData,[i]=e.paths,{path:s}=i;this.updateLineNode(i);const o=this.getValueAxis(),a=o?.isReversed(),n=a?(p,d)=>pp>d,r=o?.scale.convert(0),l=t.reduce((p,d)=>(n(d.x,p)&&(p=d.x),p),a?1/0:0),c=(p,d,u,m,g)=>(p-d)/(u-d)*(g-m)+m;this.ctx.animationManager.animate({id:`${this.id}_connectors`,groupId:this.id,phase:"initial",from:r,to:l,ease:vi.Motion.easeOut,collapsable:!1,onUpdate(p){s.clear(!0);for(const[d,u]of t.entries()){const m=c(p,r,l,r,u.x),g=c(p,r,l,r,u.x2);d!==0&&s.lineTo(m,u.y),s.moveTo(g,u.y2)}i.checkPathDirty()},onStop:()=>this.resetConnectorLinesPath(e)})}animateConnectorLinesVertical(e){const{pointData:t=[]}=e.contextData,[i]=e.paths,{path:s}=i;this.updateLineNode(i);const o=this.getValueAxis(),a=o?.isReversed(),n=a?(p,d)=>p>d:(p,d)=>p(n(d.y,p)&&(p=d.y),p),a?0:1/0),c=(p,d,u,m,g)=>(p-d)/(u-d)*(g-m)+m;this.ctx.animationManager.animate({id:`${this.id}_connectors`,groupId:this.id,phase:"initial",from:r,to:l,ease:vi.Motion.easeOut,collapsable:!1,onUpdate(p){s.clear(!0);for(const[d,u]of t.entries()){const m=c(p,r,l,r,u.y),g=c(p,r,l,r,u.y2);d!==0&&s.lineTo(u.x,m),s.moveTo(u.x2,g)}i.checkPathDirty()},onStop:()=>this.resetConnectorLinesPath(e)})}animateReadyResize(e){super.animateReadyResize(e),this.resetConnectorLinesPath(e)}updatePaths(e){this.resetConnectorLinesPath({contextData:e.contextData,paths:e.paths})}resetConnectorLinesPath({contextData:e,paths:t}){if(t.length===0)return;const[i]=t;this.updateLineNode(i);const{path:s}=i;s.clear(!0);const{pointData:o}=e;if(o){for(const[a,n]of o.entries())a!==0&&s.lineTo(n.x,n.y),s.moveTo(n.x2,n.y2);i.checkPathDirty()}}updateLineNode(e){const{stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:o,lineDashOffset:a}=this.properties.line;e.setProperties({fill:void 0,stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:o,lineDashOffset:a,lineJoin:"round",pointerEvents:vi.PointerEvents.None})}isLabelEnabled(){const{positive:e,negative:t,total:i}=this.properties.item;return e.label.enabled||t.label.enabled||i.label.enabled}onDataChange(){}computeFocusBounds({datumIndex:e}){return fb(this,this.contextNodeData?.nodeData[e])}hasItemStylers(){const{positive:e,negative:t,total:i}=this.properties.item;return e.itemStyler!=null||e.label.itemStyler!=null||t.itemStyler!=null||t.label.itemStyler!=null||i.itemStyler!=null||i.label.itemStyler!=null}};Co.className="WaterfallSeries",Co.type="waterfall";import{_ModuleSupport as Db}from"ag-charts-community";import{arrayOfDefs as Ib,constant as Ab,positiveNumber as Mb,required as Yi,string as Ls,union as Nb}from"ag-charts-core";var{commonSeriesOptionsDefs:Lb,waterfallSeriesThemeableOptionsDef:Tb}=Db,Rb={...Tb,...Lb,type:Yi(Ab("waterfall")),xKey:Yi(Ls),yKey:Yi(Ls),xName:Ls,yName:Ls,totals:Ib({totalType:Yi(Nb("total","subtotal")),index:Yi(Mb),axisLabel:Yi(Ls)},"a total definition options array")};import{_ModuleSupport as Dn}from"ag-charts-community";var{FILL_GRADIENT_LINEAR_KEYED_DEFAULTS:Pb,FILL_IMAGE_DEFAULTS:Cb,FILL_PATTERN_KEYED_DEFAULTS:Ob}=Dn;function In(e,t){return{fill:{$applySwitch:[{$path:"type"},{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$path:[`/${t}`,{$palette:"fill"},{$palette:"fills"}]},{$palette:`${e}.fill`}]},["gradient",Pb(e)],["image",Cb],["pattern",Ob(e)]]},stroke:{$palette:`${e}.stroke`},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{...Dn.LABEL_BOXING_DEFAULTS,enabled:!1,fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},formatter:void 0,placement:"outside-end",padding:{$isUserOption:["./spacing",0,6]}}}}var _b={series:{item:{positive:In("altUp",0),negative:In("altDown",1),total:In("neutral",2)},line:{stroke:{$palette:"neutral.stroke"},strokeOpacity:1,lineDash:[0],lineDashOffset:0,strokeWidth:2},highlight:Dn.singleSeriesHighlightStyle()},legend:{enabled:!0,toggleSeries:!1}},HR={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"waterfall",solo:!0,moduleFactory:e=>new Co(e),defaultAxes:qx.DIRECTION_SWAP_AXES,themeTemplate:_b},An={type:"series",name:"waterfall",chartType:"cartesian",enterprise:!0,options:Rb,create:e=>new Co(e)},{NewAreaSeriesModule:wb,NewBarSeriesModule:Eb,NewBubbleSeriesModule:Fb,NewHistogramSeriesModule:Bb,NewLineSeriesModule:Gb,NewScatterSeriesModule:Vb,numberFormatValidator:Kb,textOrSegments:Wb,without:ct}=mm,oh={width:gt,height:gt,grip:bs,fill:oo,stroke:oo,strokeWidth:gt,cornerRadius:gt},ht=["cursor","highlightStyle","listeners","nodeClickRange","showInLegend","showInMiniChart","tooltip","visible","xName","yName"],zb=[...ht,"errorBar","label","legendItemName","direction"],$b=[...ht,"direction","legendItemName","minName","q1Name","medianName","q3Name","maxName"],Hb=[...ht,"title","label","labelKey","labelName","sizeName"],Xb=[...ht,"title","label","colorName","textAlign","verticalAlign","itemPadding","colorRange"],Yb=[...ht,"label"],Ub=[...ht,"errorBar","title","label"],qb=[...ht,"label","yLowName","yHighName"],jb=[...ht,"direction","label","yLowName","yHighName"],Jb=[...ht,"errorBar","title","label","labelKey","labelName"],Zb=[...ht,"direction"],Qb={enabled:bs,height:gt,spacing:gt,cornerRadius:Cl,mask:{fill:oo,fillOpacity:bm,stroke:oo,strokeWidth:gt},minHandle:oh,maxHandle:oh,miniChart:{enabled:bs,padding:{top:gt,bottom:gt},label:{enabled:bs,avoidCollisions:bs,spacing:gt,format:Kb,formatter:Sm(Wb),interval:{minSpacing:gt,maxSpacing:gt,values:ym,step:Cl},...xm},series:fm(vm({area:ct(wb.options,[...ht,"type"]),bar:ct(Eb.options,[...zb,"type"]),"box-plot":ct(Ya.options,[...$b,"type"]),bubble:ct(Fb.options,[...Hb,"type"]),candlestick:ct(tn.options,[...ht,"type"]),heatmap:ct(nn.options,[...Xb,"type"]),histogram:ct(Bb.options,[...Yb,"type"]),line:ct(Gb.options,[...Ub,"type"]),ohlc:ct(ln.options,[...ht,"type"]),"range-area":ct(Sn.options,[...qb,"type"]),"range-bar":ct(vn.options,[...jb,"type"]),scatter:ct(Vb.options,[...Jb,"type"]),waterfall:ct(An.options,[...Zb,"type"])},"miniChart series options"))}},{annotationOptionsDef:ev}=Jg,tv={type:"plugin",name:"annotations",chartType:"cartesian",options:ev,create(){return null}},iv={type:"plugin",name:"navigator",chartType:"cartesian",options:Qb,create(){return null}},sv={type:"plugin",name:"initialState",options:gm,create(){return null}};import{_ModuleSupport as Ts}from"ag-charts-community";import{_ModuleSupport as ov}from"ag-charts-community";import{Logger as av,cachedTextMeasurer as nv,calcLineHeight as rv,toPlainText as lv,wrapText as cv}from"ag-charts-core";import{_ModuleSupport as Oo}from"ag-charts-community";import{Logger as hv}from"ag-charts-core";function ah(e,t,i){i||(t=pv(t));const s=new Map;for(const a of e)s.set(a.id,{datum:a,linksBefore:[],linksAfter:[],maxPathLengthBefore:-1,maxPathLengthAfter:-1});let o=0;for(const[a,n]of s.entries())o=Math.max(o,Mn(s,t,n,a,-1,[])+Mn(s,t,n,a,1,[])+1);return{links:t,nodeGraph:s,maxPathLength:o}}function nh(e,t,i,s){const o=s.indexOf(t);if(o!==-1){for(let n=o;n!t.has(i))}function Mn(e,t,i,s,o,a){if(a.includes(s))return 1/0;let n=o===-1?i.maxPathLengthBefore:i.maxPathLengthAfter;if(n===-1){n=0;const r=o===-1?i.linksBefore:i.linksAfter;for(const l of t){const{fromNode:c,toNode:p}=l,d=o===-1?p.id:c.id,u=o===-1?c.id:p.id,m=s===d?e.get(u):void 0;m!=null&&(r.push({node:m,link:l}),a?.push(s),n=Math.max(n,Mn(e,t,m,u,o,a)+1),a?.pop())}o===-1?i.maxPathLengthBefore=n:i.maxPathLengthAfter=n}return n}var{Series:dv,DataController:uv,keyProperty:gv,valueProperty:_o,Selection:Di,Group:Ui,TransformableText:mv}=Oo,yv=class extends Oo.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s);const{datumIndex:o}=i,a=s.contextNodeData?.nodeData.find(n=>n.datumIndex.type===o.type&&n.datumIndex.index===o.index);this.size=a?.size,this.label=a?.type===1?a?.label:void 0}},rh=class extends dv{constructor(){super(...arguments),this.NodeEvent=yv,this.nodeCount=0,this.linkCount=0,this.linksDataModel=void 0,this.linksProcessedData=void 0,this.nodesDataModel=void 0,this.nodesProcessedData=void 0,this.processedNodes=new Map,this.linkGroup=this.contentGroup.appendChild(new Ui({name:"linkGroup"})),this.nodeGroup=this.contentGroup.appendChild(new Ui({name:"nodeGroup"})),this.focusLinkGroup=this.highlightGroup.appendChild(new Ui({name:"linkGroup"})),this.focusNodeGroup=this.highlightGroup.appendChild(new Ui({name:"nodeGroup"})),this.highlightLinkGroup=this.highlightGroup.appendChild(new Ui({name:"linkGroup"})),this.highlightNodeGroup=this.highlightGroup.appendChild(new Ui({name:"nodeGroup"})),this.labelSelection=Di.select(this.labelGroup,mv),this.linkSelection=Di.select(this.linkGroup,()=>this.linkFactory()),this.nodeSelection=Di.select(this.nodeGroup,()=>this.nodeFactory()),this.focusLinkSelection=Di.select(this.focusLinkGroup,()=>this.linkFactory()),this.focusNodeSelection=Di.select(this.focusNodeGroup,()=>this.nodeFactory()),this.highlightLinkSelection=Di.select(this.highlightLinkGroup,()=>this.linkFactory()),this.highlightNodeSelection=Di.select(this.highlightNodeGroup,()=>this.nodeFactory())}get nodes(){return this.properties.nodes}async processData(e){const{data:t,nodes:i}=this;if(t==null)return;const{fromKey:s,toKey:o,sizeKey:a,idKey:n,labelKey:r}=this.properties,l=new uv("standalone",e.suppressFieldDotNotation),c=i==null?null:l.request(this.id,Oo.DataSet.wrap(i)??Oo.DataSet.empty(),{props:[gv(n,void 0,{id:"idValue",includeProperty:!1}),...r==null?[]:[_o(r,void 0,{id:"labelValue",includeProperty:!1})]],groupByKeys:!0}),p=e.request(this.id,t,{props:[_o(s,void 0,{id:"fromValue",includeProperty:!1}),_o(o,void 0,{id:"toValue",includeProperty:!1}),...a==null?[]:[_o(a,void 0,{id:"sizeValue",includeProperty:!1,missingValue:0})]],groupByKeys:!1});i!=null&&l.execute();const[d,u]=await Promise.all([c??Promise.resolve(null),p]);this.nodesDataModel=d?.dataModel,this.nodesProcessedData=d?.processedData,this.linksDataModel=u?.dataModel,this.linksProcessedData=u?.processedData;const m=new Map;if(d==null){const g=u.dataModel.resolveColumnById(this,"fromValue",u.processedData),y=u.dataModel.resolveColumnById(this,"toValue",u.processedData),f=x=>{const v=m.size,b=x;return{series:this,itemId:void 0,datum:{},datumIndex:{type:1,index:v},type:1,index:v,linksBefore:[],linksAfter:[],id:x,size:0,label:b,style:this.getNodeStyle({datumIndex:{type:1,index:v},datum:{},size:0,label:b},v,!1)}},S=u.processedData.dataSources.get(this.id)?.data;if(S)for(const[x]of S.entries()){const v=g[x],b=y[x];v==null||b==null||(m.has(v)||m.set(v,f(v)),m.has(b)||m.set(b,f(b)))}}else{const g=d.dataModel.resolveColumnById(this,"idValue",d.processedData),y=r==null?void 0:d.dataModel.resolveColumnById(this,"labelValue",d.processedData),f=d.processedData.dataSources.get(this.id)?.data;if(f)for(const[S,x]of f.entries()){const v=g[S],b=y?.[S],k={type:1,index:S};m.set(v,{series:this,itemId:void 0,datum:x,datumIndex:k,type:1,index:S,linksBefore:[],linksAfter:[],id:v,size:0,label:b,style:this.getNodeStyle({datumIndex:k,datum:x,size:0,label:b},S,!1)})}}this.processedNodes=m}getNodeGraph(e,t,{includeCircularReferences:i}){const{linksDataModel:s,linksProcessedData:o}=this;if(s==null||o==null){const{links:y,nodeGraph:f,maxPathLength:S}=ah(new Map().values(),[],i);return this.nodeCount=0,this.linkCount=0,{nodeGraph:f,links:y,maxPathLength:S}}const{sizeKey:a}=this.properties,n=s.resolveColumnById(this,"fromValue",o),r=s.resolveColumnById(this,"toValue",o),l=a==null?void 0:s.resolveColumnById(this,"sizeValue",o),c=new Map;for(const y of this.processedNodes.values()){const f=e(y);c.set(y.id,f)}const p=[],d=o.dataSources.get(this.id)?.data;if(d)for(const[y,f]of d.entries()){const S=n[y],x=r[y],v=l==null?1:l[y],b=c.get(S),k=c.get(x);if(v<=0||b==null||k==null)continue;const A={type:0,index:y},I=t({series:this,itemId:void 0,datum:f,datumIndex:A,type:0,index:y,fromNode:b,toNode:k,size:v,style:this.getLinkStyle({datum:f,datumIndex:A},b.datumIndex,!1)});p.push(I)}const{links:u,nodeGraph:m,maxPathLength:g}=ah(c.values(),p,i);for(const y of m.values())y.datum.linksBefore=y.linksBefore.map(f=>f.link),y.datum.linksAfter=y.linksAfter.map(f=>f.link);return this.nodeCount=m.size,this.linkCount=u.length,{nodeGraph:m,links:u,maxPathLength:g}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(e){const{seriesRect:t}=e,i={seriesRectWidth:t?.width??0,seriesRectHeight:t?.height??0};(this._nodeDataDependencies==null||this._nodeDataDependencies.seriesRectWidth!==i.seriesRectWidth||this._nodeDataDependencies.seriesRectHeight!==i.seriesRectHeight)&&(this._nodeDataDependencies=i),this.updateSelections();const s=this.contextNodeData?.nodeData??[],o=this.contextNodeData?.labelData??[];let a=this.ctx.highlightManager?.getActiveHighlight();if(a?.series===this&&a.type==null){const{itemId:p}=a;a=p==null?void 0:s.find(d=>d.type===1&&d.id===p)}else a?.series!==this&&(a=void 0);this.contentGroup.visible=this.visible,this.contentGroup.opacity=a==null?1:this.properties.highlight.unhighlightedItem.opacity??1,this.labelSelection=this.updateLabelSelection({labelData:o,labelSelection:this.labelSelection}),this.updateLabelNodes({labelSelection:this.labelSelection}),this.linkSelection=this.updateLinkSelection({nodeData:s.filter(p=>p.type===0),datumSelection:this.linkSelection}),this.updateLinkNodes({datumSelection:this.linkSelection,isHighlight:!1}),this.nodeSelection=this.updateNodeSelection({nodeData:s.filter(p=>p.type===1),datumSelection:this.nodeSelection}),this.updateNodeNodes({datumSelection:this.nodeSelection,isHighlight:!1});let n,r,l,c;a?.type===1?(n=s.filter(p=>p.type===0&&(p.toNode===a||p.fromNode===a)),r=n.map(p=>p.fromNode===a?p.toNode:p.fromNode),r.push(a),l=[],c=[a]):a?.type===0?(n=[a],r=[a.fromNode,a.toNode],l=[a],c=[]):(n=[],r=[],l=[],c=[]),this.focusLinkSelection=this.updateLinkSelection({nodeData:n,datumSelection:this.focusLinkSelection}),this.updateLinkNodes({datumSelection:this.focusLinkSelection,isHighlight:!1}),this.focusNodeSelection=this.updateNodeSelection({nodeData:r,datumSelection:this.focusNodeSelection}),this.updateNodeNodes({datumSelection:this.focusNodeSelection,isHighlight:!1}),this.highlightLinkSelection=this.updateLinkSelection({nodeData:l,datumSelection:this.highlightLinkSelection}),this.updateLinkNodes({datumSelection:this.highlightLinkSelection,isHighlight:!0}),this.highlightNodeSelection=this.updateNodeSelection({nodeData:c,datumSelection:this.highlightNodeSelection}),this.updateNodeNodes({datumSelection:this.highlightNodeSelection,isHighlight:!0})}resetAnimation(e){}dataCount(){return Number.NaN}getSeriesDomain(e){return[]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}legendItemSymbol(e,t,i={}){const{fills:s,strokes:o}=this.properties,{fill:a=s[t%s.length],fillOpacity:n=1,stroke:r=o[t%o.length],strokeWidth:l=0,strokeOpacity:c=1,lineDash:p=[0],lineDashOffset:d=0}=i;return{marker:{fill:a,fillOpacity:n,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:p,lineDashOffset:d}}}getLegendData(e){if(e!=="category")return[];const{showInLegend:t}=this.properties;return Array.from(this.processedNodes.values(),({id:i,label:s},o)=>({legendType:"category",id:this.id,itemId:i,seriesId:this.id,enabled:!0,label:{text:s??i},symbol:this.legendItemSymbol(1,o),hideInLegend:!t,isFixed:!0}))}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.linkSelection.each((o,a)=>{const n=o.distanceSquared(e,t);n{const n=o.distanceSquared(e,t);np.datum),c=r.indexOf(s)+t;c>=0&&c0?o=r.at(-1):o=Array.from(this.nodeSelection,d=>d.datum).at(-1)}else if(s?.type===1){const r=Array.from(this.nodeSelection,p=>p.datum),c=r.indexOf(s)+t;c>=0&&cd.datum)[0]}if(o==null)return;const a=o.type===1?Array.from(this.nodeSelection).find(r=>r.datum===o):Array.from(this.linkSelection).find(r=>r.datum===o);if(a==null)return;const n=this.computeFocusBounds(a.node);if(n!=null)return{datum:a.datum,datumIndex:this.contextNodeData?.nodeData.indexOf(a.datum)??0,otherIndex:0,bounds:n,clipFocusBox:!0}}getCategoryValue(e){}datumIndexForCategoryValue(e){}};import{_ModuleSupport as fv}from"ag-charts-community";var{Path:Sv,SceneChangeDetection:ei}=fv;function lh({radius:e,startAngle:t,endAngle:i,tension:s}){const o=e*Math.cos(t),a=e*Math.sin(t),n=e*Math.cos(i),r=e*Math.sin(i),l=o*s,c=a*s,p=n*s,d=r*s;return{x:[o,l,p,n],y:[a,c,d,r]}}var $t=class extends Sv{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.radius=0,this.startAngle1=0,this.endAngle1=0,this.startAngle2=0,this.endAngle2=0,this.tension=1}tensionedCurveTo(e,t,i,s,o,a,n,r){const{path:l,tension:c}=this,p=1-c;l.cubicCurveTo((i-e)*p+e,(s-t)*p+t,(o-n)*p+n,(a-r)*p+r,n,r)}updatePath(){const{path:e,centerX:t,centerY:i,radius:s}=this;let{startAngle1:o,endAngle1:a,startAngle2:n,endAngle2:r}=this;o>n&&([o,n]=[n,o],[a,r]=[r,a]),e.clear();const l=t+s*Math.cos(o),c=i+s*Math.sin(o);e.moveTo(l,c),this.tensionedCurveTo(l,c,t,i,t,i,t+s*Math.cos(r),i+s*Math.sin(r)),e.arc(t,i,s,r,n,!0),this.tensionedCurveTo(t+s*Math.cos(n),i+s*Math.sin(n),t,i,t,i,t+s*Math.cos(a),i+s*Math.sin(a)),e.arc(t,i,s,a,o,!0),e.closePath()}};h([ei()],$t.prototype,"centerX",2),h([ei()],$t.prototype,"centerY",2),h([ei()],$t.prototype,"radius",2),h([ei()],$t.prototype,"startAngle1",2),h([ei()],$t.prototype,"endAngle1",2),h([ei()],$t.prototype,"startAngle2",2),h([ei()],$t.prototype,"endAngle2",2),h([ei()],$t.prototype,"tension",2);import{_ModuleSupport as xv}from"ag-charts-community";var{FillGradientDefaults:bv,FillPatternDefaults:vv,FillImageDefaults:kv,BaseProperties:ch,makeSeriesTooltip:Dv,SeriesProperties:Iv,Property:oe,Label:Av}=xv,Nn=class extends Av{constructor(){super(...arguments),this.spacing=1,this.maxWidth=1}};h([oe],Nn.prototype,"spacing",2),h([oe],Nn.prototype,"maxWidth",2);var wt=class extends ch{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0,this.tension=0}getStyle(e,t,i){const{fillOpacity:s,strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r,tension:l}=this,c=this.fill??e[i%e.length],p=this.stroke??t[i%e.length];return{fill:c,fillOpacity:s,stroke:p,strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r,tension:l}}};h([oe],wt.prototype,"fill",2),h([oe],wt.prototype,"fillOpacity",2),h([oe],wt.prototype,"stroke",2),h([oe],wt.prototype,"strokeOpacity",2),h([oe],wt.prototype,"strokeWidth",2),h([oe],wt.prototype,"lineDash",2),h([oe],wt.prototype,"lineDashOffset",2),h([oe],wt.prototype,"tension",2),h([oe],wt.prototype,"itemStyler",2);var Mt=class extends ch{constructor(){super(...arguments),this.spacing=1,this.width=1,this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t,i){const{fillOpacity:s,strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r}=this,l=this.fill??e[i%e.length],c=this.stroke??t[i%e.length];return{fill:l,fillOpacity:s,stroke:c,strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r}}};h([oe],Mt.prototype,"spacing",2),h([oe],Mt.prototype,"width",2),h([oe],Mt.prototype,"fill",2),h([oe],Mt.prototype,"fillOpacity",2),h([oe],Mt.prototype,"stroke",2),h([oe],Mt.prototype,"strokeOpacity",2),h([oe],Mt.prototype,"strokeWidth",2),h([oe],Mt.prototype,"lineDash",2),h([oe],Mt.prototype,"lineDashOffset",2),h([oe],Mt.prototype,"itemStyler",2);var Be=class extends Iv{constructor(){super(),this.idKey="",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.sizeKey=void 0,this.sizeName=void 0,this.nodes=void 0,this.fillGradientDefaults=new bv,this.fillPatternDefaults=new vv,this.fillImageDefaults=new kv,this.fills=[],this.strokes=[],this.label=new Nn,this.link=new wt,this.node=new Mt,this.tooltip=Dv(),this.highlightStyle.deprecated=!1}};h([oe],Be.prototype,"fromKey",2),h([oe],Be.prototype,"toKey",2),h([oe],Be.prototype,"idKey",2),h([oe],Be.prototype,"idName",2),h([oe],Be.prototype,"labelKey",2),h([oe],Be.prototype,"labelName",2),h([oe],Be.prototype,"sizeKey",2),h([oe],Be.prototype,"sizeName",2),h([oe],Be.prototype,"nodes",2),h([oe],Be.prototype,"fillGradientDefaults",2),h([oe],Be.prototype,"fillPatternDefaults",2),h([oe],Be.prototype,"fillImageDefaults",2),h([oe],Be.prototype,"fills",2),h([oe],Be.prototype,"strokes",2),h([oe],Be.prototype,"label",2),h([oe],Be.prototype,"link",2),h([oe],Be.prototype,"node",2),h([oe],Be.prototype,"tooltip",2);var{SeriesNodePickMode:hh,createDatumId:wo,angleBetween:Eo,normalizeAngle360:Mv,isBetweenAngles:ph,Sector:Nv,evaluateBezier:Fo,applyShapeStyle:dh,getShapeStyle:Bo,getLabelStyles:Lv,BBox:Tv,mergeDefaults:Go}=ov,Vo=e=>e.startAngle+Eo(e.startAngle,e.endAngle)/2,Ko=class extends rh{constructor(e){super({moduleCtx:e,pickModes:[hh.NEAREST_NODE,hh.EXACT_SHAPE_MATCH]}),this.properties=new Be}isLabelEnabled(){return(this.properties.labelKey!=null||this.nodes==null)&&this.properties.label.enabled}linkFactory(){return new $t}nodeFactory(){return new Nv}createNodeData(){const{id:e,_nodeDataDependencies:{seriesRectWidth:t,seriesRectHeight:i}={seriesRectWidth:0,seriesRectHeight:0},properties:s}=this,{fromKey:o,toKey:a,sizeKey:n,labelKey:r,label:{spacing:l,maxWidth:c,fontSize:p},node:{width:d,spacing:u}}=s,m=t/2,g=i/2;let y=[];const{nodeGraph:f,links:S}=this.getNodeGraph(E=>({...E,centerX:m,centerY:g,innerRadius:Number.NaN,outerRadius:Number.NaN,startAngle:Number.NaN,endAngle:Number.NaN}),E=>({...E,centerX:m,centerY:g,radius:Number.NaN,startAngle1:Number.NaN,endAngle1:Number.NaN,startAngle2:Number.NaN,endAngle2:Number.NaN}),{includeCircularReferences:!0});let x=0;for(const[E,{datum:L,linksBefore:P,linksAfter:T}]of f.entries()){const M=P.reduce((O,{link:B})=>O+B.size,0)+T.reduce((O,{link:B})=>O+B.size,0);if(M===0)f.delete(E);else{const{label:O}=s;L.size=M,x+=L.size;const B=O.enabled?this.getLabelText(L.label,L.datum,r,"label",[],O,{datum:L.datum,value:L.label,fromKey:o,toKey:a,sizeKey:n,size:L.size}):void 0;L.label=lv(B)}}let v=0;if(this.isLabelEnabled()){const E=nv(this.properties.label);let L=0;for(const{datum:P}of f.values()){const{id:T,label:M}=P;if(M==null)continue;const O=cv(M,{maxWidth:c,font:this.properties.label,textWrap:"never"}),{width:B}=E.measureLines(O);L=Math.max(B,L),y.push({id:T,text:O,centerX:m,centerY:g,angle:Number.NaN,radius:Number.NaN,size:P.size})}v=L+l}const b=f.size;let k=Math.min(t,i)/2-d-v,A=u/k;if(v!==0&&(b*A>=1.5*Math.PI||k<=0)&&(y=[],k=Math.min(t,i)/2-d,A=u/k),b*A>=2*Math.PI||k<=0){av.warnOnce("There was insufficient space to display the Chord Series.");return}const I=k,D=k+d,N=Math.max((2*Math.PI-b*A)/x,0);let R=0;for(const{datum:E}of f.values()){E.innerRadius=I,E.outerRadius=D,E.startAngle=R,E.endAngle=R+E.size*N,R=E.endAngle+A;const L=(E.innerRadius+E.outerRadius)/2,P=Vo(E);E.midPoint={x:E.centerX+L*Math.cos(P),y:E.centerY+L*Math.sin(P)}}const C=[];for(const{datum:E,linksBefore:L,linksAfter:P}of f.values()){const T=Vo(E),M=[...L.map(B=>({link:B.link,distance:Eo(Vo(B.node.datum),T),after:!1})),...P.map(B=>({link:B.link,distance:Eo(Vo(B.node.datum),T),after:!0}))];let O=E.startAngle;for(const{link:B,after:F}of M.toSorted((V,W)=>V.distance-W.distance)){const V=B.size*N;F?(B.startAngle1=O,B.endAngle1=O+V):(B.startAngle2=O,B.endAngle2=O+V),O+=B.size*N}C.push(E)}const{tension:w}=this.properties.link;for(const E of S){E.radius=k;const L=lh({radius:k,startAngle:E.startAngle1,endAngle:E.endAngle2,tension:w}),P=lh({radius:k,startAngle:E.startAngle2,endAngle:E.endAngle1,tension:w}),T=Fo(...L.x,.5),M=Fo(...L.y,.5),O=Fo(...P.x,.5),B=Fo(...P.y,.5);E.midPoint={x:E.centerX+(T+O)/2,y:E.centerY+(M+B)/2},C.push(E)}for(const E of y){const L=f.get(E.id)?.datum;L!=null&&(E.radius=D+l,E.angle=Mv(L.startAngle+Eo(L.startAngle,L.endAngle)/2))}y.sort((E,L)=>E.angle-L.angle);let G=1/0,_=-1/0;return y=y.filter(E=>{const L=rv(p),P=Math.atan2(L/2,E.radius),T=E.angle-P,M=E.angle+P;return ph(G,T,M)||ph(_,T,M)?!1:(G=Math.min(T,G),_=Math.max(M,_),!0)}),{itemId:e,nodeData:C,labelData:y}}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const t={toKey:this.properties.toKey,fromKey:this.properties.fromKey,sizeKey:this.properties.sizeKey,size:Number.NaN},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{size:o,text:a,centerX:n,centerY:r,radius:l,angle:c})=>{t.size=o;const p=Lv(this,void 0,t,this.properties.label,!1,i),{fontStyle:d,fontWeight:u,fontSize:m,fontFamily:g,color:y}=p;s.visible=!0,s.translationX=n+l*Math.cos(c),s.translationY=r+l*Math.sin(c),s.text=a,s.fill=y,s.fontStyle=d,s.fontWeight=u,s.fontSize=m,s.fontFamily=g,s.textBaseline="middle",Math.cos(c)>=0?(s.textAlign="left",s.rotation=c):(s.textAlign="right",s.rotation=c-Math.PI),s.setBoxing(p)})}updateNodeSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>wo(t.type,t.id))}getNodeStyle(e,t,i){const{properties:s}=this,{fills:o,strokes:a,fillGradientDefaults:n,fillPatternDefaults:r,fillImageDefaults:l}=s,{itemStyler:c}=s.node,p=this.getHighlightStyle(i,e.datumIndex),d=Go(p,s.node.getStyle(o,a,t));let u=Bo(d,n,r,l);if(c!=null&&e.datumIndex!=null){const m=this.cachedDatumCallback(wo(e.datumIndex.index,"node",i?"highlight":"node"),()=>{const g=this.makeItemStylerParams(e,i,u);return this.callWithContext(c,g)});m&&(u=Bo(Go(m,u),n,r,l))}return u.opacity=1,u}makeItemStylerParams({datum:e,datumIndex:t,size:i=0,label:s},o,a){const{id:n}=this,r=this.ctx.highlightManager?.getActiveHighlight(),l=this.getHighlightStateString(r,o,t),c=this.filterItemStylerFillParams(a.fill)??a.fill;return{seriesId:n,datum:e,highlighted:o,highlightState:l,...a,size:i,label:s,fill:c}}updateNodeNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((o,a)=>{const{datumIndex:n}=a,r=this.getNodeStyle(a,n.index,i);dh(o,r,s),o.centerX=a.centerX,o.centerY=a.centerY,o.innerRadius=a.innerRadius,o.outerRadius=a.outerRadius,o.startAngle=a.startAngle,o.endAngle=a.endAngle,o.inset=o.strokeWidth/2})}updateLinkSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>wo(t.type,t.index,t.fromNode.id,t.toNode.id))}getLinkStyle({datumIndex:e,datum:t},i,s){const{id:o,properties:a}=this,{fills:n,strokes:r,fillGradientDefaults:l,fillPatternDefaults:c,fillImageDefaults:p}=a,{itemStyler:d}=a.link,u=this.getHighlightStyle(s,e),m=Go(u,a.link.getStyle(n,r,i.index));let g=Bo(m,l,c,p);if(d!=null&&e!=null){const y=this.ctx.highlightManager?.getActiveHighlight(),f=this.cachedDatumCallback(wo(e.index,"link",s?"highlight":"node"),()=>{const S=this.getHighlightStateString(y,s,i);return this.callWithContext(d,{seriesId:o,datum:t,highlighted:s,highlightState:S,...g})});f&&(g=Bo(Go(f,g),l,c,p))}return g.opacity=1,g}updateLinkNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((o,a)=>{const n=a.fromNode.datumIndex,r=this.getLinkStyle(a,n,i);o.centerX=a.centerX,o.centerY=a.centerY,o.radius=a.radius,o.startAngle1=a.startAngle1,o.endAngle1=a.endAngle1,o.startAngle2=a.startAngle2,o.endAngle2=a.endAngle2,o.tension=r.tension,dh(o,r,s)})}getShapeFillBBox(){const e=this._nodeDataDependencies?.seriesRectWidth??0,t=this._nodeDataDependencies?.seriesRectHeight??0,i=Math.min(e,t),s=(e-i)/2,o=(t-i)/2,a=new Tv(s,o,e,t);return{series:a,axis:a}}getTooltipContent(e){const{id:t,linksProcessedData:i,nodesProcessedData:s,properties:o,ctx:{formatManager:a}}=this,{fromKey:n,toKey:r,sizeKey:l,sizeName:c,tooltip:p}=o,d=this.contextNodeData?.nodeData.find(x=>x.datumIndex.type===e.type&&x.datumIndex.index===e.index);if(d==null)return;const u=d.type===0?d.fromNode.index:d.index,m=d.type===0?`${d.fromNode.label} - ${d.toNode.label}`:d.label,g=e.type===0?i?.dataSources.get(this.id)?.data[e.index]:s?.dataSources.get(this.id)?.data[e.index],y=d.size;let f;if(d.type===0){const x=d.fromNode.datumIndex;f=this.getLinkStyle({datumIndex:e,datum:g},x,!1)}else{const x=d.label;f=this.getNodeStyle({datumIndex:e,datum:g,size:y,label:x},e.index,!1)}const S=[];if(l!=null){const x=a.format(this.callWithContext.bind(this),{type:"number",value:y,datum:g,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",domain:[],boundSeries:this.getFormatterContext("size"),fractionDigits:void 0});S.push({label:c,fallbackLabel:l,value:x??String(y)})}return this.formatTooltipWithContext(p,{title:m,symbol:this.legendItemSymbol(d.type,u,f),data:S},{seriesId:t,datum:g,title:m,fromKey:n,toKey:r,sizeKey:l,sizeName:c,size:y,...f})}computeFocusBounds(e){return e}hasItemStylers(){return this.properties.node.itemStyler!=null||this.properties.link.itemStyler!=null||this.properties.label.itemStyler!=null}};Ko.className="ChordSeries",Ko.type="chord";import{_ModuleSupport as Rv}from"ag-charts-community";import{constant as Pv,fillGradientDefaults as Cv,fillImageDefaults as Ov,fillPatternDefaults as _v,required as Ln,string as Wo,undocumented as Tn}from"ag-charts-core";var{commonSeriesOptionsDefs:wv,chordSeriesThemeableOptionsDef:Ev}=Rv,zo={...Ev,...wv,type:Ln(Pv("chord")),fromKey:Ln(Wo),toKey:Ln(Wo),sizeKey:Wo,sizeName:Wo};zo.fillGradientDefaults=Tn(Cv),zo.fillPatternDefaults=Tn(_v),zo.fillImageDefaults=Tn(Ov);var tP={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],solo:!0,identifier:"chord",moduleFactory:e=>new Ko(e),themeTemplate:{series:{fills:{$palette:"fills"},strokes:{$palette:"strokes"},fillGradientDefaults:Ts.FILL_GRADIENT_LINEAR_DEFAULTS,fillPatternDefaults:Ts.FILL_PATTERN_DEFAULTS,fillImageDefaults:Ts.FILL_IMAGE_DEFAULTS,highlightStyle:{series:{dimOpacity:.2}},highlight:Ts.singleSeriesHighlightStyle(),label:{...Ts.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:5,maxWidth:100},node:{spacing:8,width:10,strokeWidth:{$isUserOption:["./stroke",2,0]}},link:{fillOpacity:.5,strokeWidth:{$isUserOption:["./stroke",2,0]},tension:.4}},legend:{enabled:!1,toggleSeries:!1}}},uh={type:"series",name:"chord",chartType:"standalone",enterprise:!0,options:zo,create:e=>new Ko(e)};import{_ModuleSupport as qi}from"ag-charts-community";var{ThemeConstants:{CARTESIAN_AXIS_TYPE:ji,CARTESIAN_POSITION:Ji},ThemeSymbols:{DEFAULT_SHADOW_COLOUR:Fv}}=qi,Zi={$eq:[{$path:["/series/0/direction",void 0]},"horizontal"]},gh={autoRotate:{$path:"/series/0/stageLabel/autoRotate"},autoRotateAngle:{$path:"/series/0/stageLabel/autoRotateAngle"},avoidCollisions:{$path:["/series/0/stageLabel/avoidCollisions",!0]},border:{$path:["/series/0/stageLabel/border"]},color:{$path:["/series/0/stageLabel/color",{$ref:"textColor"}]},cornerRadius:{$path:["/series/0/stageLabel/cornerRadius"]},enabled:{$if:[{$eq:[{$path:"/series/0/stageLabel/enabled"},void 0]},!0,{$path:"/series/0/stageLabel/enabled"}]},fill:{$path:["/series/0/stageLabel/fill"]},fillOpacity:{$path:["/series/0/stageLabel/fillOpacity"]},fontSize:{$path:["/series/0/stageLabel/fontSize",{$ref:"fontSize"}]},fontStyle:{$path:["/series/0/stageLabel/fontStyle",{$ref:"fontStyle"}]},fontWeight:{$path:["/series/0/stageLabel/fontWeight",{$ref:"fontWeight"}]},format:{$path:"/series/0/stageLabel/format"},formatter:{$path:"/series/0/stageLabel/formatter"},itemStyler:{$path:"/series/0/stageLabel/itemStyler"},minSpacing:{$path:"/series/0/stageLabel/minSpacing"},padding:{$path:["/series/0/stageLabel/padding"]},rotation:{$path:["/series/0/stageLabel/rotation",0]}},sP=[{type:{$if:[Zi,ji.NUMBER,ji.CATEGORY]},position:{$if:[Zi,Ji.LEFT,{$if:[{$eq:[{$path:["/series/0/stageLabel/placement",void 0]},"after"]},Ji.RIGHT,Ji.LEFT]}]},label:{$if:[Zi,void 0,gh]}},{type:{$if:[Zi,ji.CATEGORY,ji.NUMBER]},position:{$if:[Zi,{$if:[{$eq:[{$path:["/series/0/stageLabel/placement",void 0]},"before"]},Ji.TOP,Ji.BOTTOM]},Ji.BOTTOM]},label:{$if:[Zi,gh,void 0]}}],oP={series:{direction:"vertical",strokeWidth:{$isUserOption:["./strokes/0",2,0]},spacingRatio:.25,fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},[{$path:["/0",void 0,{$palette:"fills"}]}],{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",qi.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS],["pattern",qi.FILL_PATTERN_SINGLE_DEFAULTS],["image",qi.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},[{$path:["/0",void 0,{$palette:"strokes"}]}]]},label:{...qi.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},dropOff:{enabled:!0,fillOpacity:.2,strokeWidth:{$isUserOption:["./stroke",2,0]}},shadow:{enabled:!1,color:Fv,xOffset:3,yOffset:3,blur:5},highlight:qi.singleSeriesHighlightStyle()},axes:{[ji.NUMBER]:{nice:!1,gridLine:{enabled:!1},crosshair:{enabled:!1},label:{enabled:!1}},[ji.CATEGORY]:{line:{enabled:!1}}}};import{_ModuleSupport as Bv}from"ag-charts-community";import{_ModuleSupport as Rn}from"ag-charts-community";import{_ModuleSupport as Gv}from"ag-charts-community";var{lineDistanceSquared:$o,BBox:Vv,Path:Kv,SceneChangeDetection:ti}=Gv,mh=1e-6;function yh([e,t],[i,s]){return Math.abs(e-i)<=mh&&Math.abs(t-s)<=mh}var Et=class extends Kv{constructor(){super(...arguments),this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0}get midPoint(){const{x0:e,y0:t,x1:i,y1:s,x2:o,y2:a,x3:n,y3:r}=this;return{x:(e+i+o+n)/4,y:(t+s+a+r)/4}}distanceSquared(e,t){if(this.containsPoint(e,t))return 0;const{x0:i,y0:s,x1:o,y1:a,x2:n,y2:r,x3:l,y3:c}=this;return Math.min($o(e,t,i,s,o,a,1/0),$o(e,t,o,a,n,r,1/0),$o(e,t,n,r,l,c,1/0),$o(e,t,l,c,i,s,1/0))}computeBBox(){const{x0:e,y0:t,x1:i,y1:s,x2:o,y2:a,x3:n,y3:r}=this,l=Math.min(e,i,o,n),c=Math.max(e,i,o,n)-l,p=Math.min(t,s,a,r),d=Math.max(t,s,a,r)-p;return new Vv(l,p,c,d)}updatePath(){const{path:e,x0:t,y0:i,x1:s,y1:o,x2:a,y2:n,x3:r,y3:l}=this,c=[[t,i],[s,o],[a,n],[r,l]];e.clear();let p,d;for(const u of c){if(p!=null&&yh(p,u)||d!=null&&yh(d,u))continue;const[m,g]=u;p==null?e.moveTo(m,g):e.lineTo(m,g),p??(p=u),d=u}e.closePath()}};h([ti()],Et.prototype,"x0",2),h([ti()],Et.prototype,"y0",2),h([ti()],Et.prototype,"x1",2),h([ti()],Et.prototype,"y1",2),h([ti()],Et.prototype,"x2",2),h([ti()],Et.prototype,"y2",2),h([ti()],Et.prototype,"x3",2),h([ti()],Et.prototype,"y3",2);import{_ModuleSupport as Wv}from"ag-charts-community";var{NODE_UPDATE_STATE_TO_PHASE_MAPPING:zv}=Wv;function fh(e,t,i,s){const{x0:o,y0:a,x1:n,y1:r,x2:l,y2:c,x3:p,y3:d,opacity:u}=e;return i?{x0:(o+p)/2,y0:(a+d)/2,x1:(n+l)/2,y1:(r+c)/2,x2:(n+l)/2,y2:(r+c)/2,x3:(o+p)/2,y3:(a+d)/2,opacity:u}:{x0:(o+n)/2,y0:(a+r)/2,x1:(o+n)/2,y1:(a+r)/2,x2:(l+p)/2,y2:(c+d)/2,x3:(l+p)/2,y3:(c+d)/2,opacity:u}}function $v(e,t){const i=a=>a==null;return{fromFn:(a,n,r)=>{r==="updated"&&i(n)?r="removed":r==="updated"&&i(a.previousDatum)&&(r="added");let l;r==="added"&&a.previousDatum==null&&t==="fade"?l={...Rs(a,n),opacity:0}:r==="unknown"||r==="added"?l=fh(n,a.previousDatum,e,t):l={x0:a.x0,y0:a.y0,x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2,x3:a.x3,y3:a.y3,opacity:a.opacity};const c=zv[r];return{...l,phase:c}},toFn:(a,n,r)=>{let l;return r==="removed"&&a.datum==null&&t==="fade"?l={...Rs(a,n),opacity:0}:r==="removed"||i(n)?l=fh(n,a.previousDatum,e,t):l=Rs(a,n),l}}}function Rs(e,t){const{x0:i,y0:s,x1:o,y1:a,x2:n,y2:r,x3:l,y3:c,opacity:p}=t;return{x0:i,y0:s,x1:o,y1:a,x2:n,y2:r,x3:l,y3:c,opacity:p}}var{SeriesNodePickMode:Sh,SeriesZIndexMap:xh,valueProperty:Hv,keyProperty:Xv,ChartAxisDirection:Yv,updateLabelNode:Uv,SMALLEST_KEY_INTERVAL:qv,LARGEST_KEY_INTERVAL:jv,diff:Jv,fixNumericExtent:Zv,seriesLabelFadeInAnimation:bh,resetMotion:Qv,resetLabelFn:ek,animationValidation:tk,computeBarFocusBounds:ik,ContinuousScale:sk,Group:ok,Selection:ak,PointerEvents:vh,motion:nk,checkCrisp:rk,createDatumId:lk,applyShapeStyle:ck}=Rn,hk=class extends Rn.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.stageKey,this.yKey=s.properties.valueKey}},kh=class extends Rn.AbstractBarSeries{constructor({moduleCtx:e,animationResetFns:t}){super({moduleCtx:e,pickModes:[Sh.AXIS_ALIGNED,Sh.EXACT_SHAPE_MATCH],propertyKeys:{x:["stageKey"],y:["valueKey"]},propertyNames:{x:[],y:[]},categoryKey:"xValue",datumSelectionGarbageCollection:!1,animationResetFns:{datum:t.datum,label:ek}}),this.NodeEvent=hk,this.connectorNodeGroup=this.contentGroup.appendChild(new ok({name:`${this.id}-series-connectorNodes`,zIndex:xh.BACKGROUND})),this.connectorSelection=ak.select(this.connectorNodeGroup,()=>this.connectionFactory()),this.connectorNodeGroup.pointerEvents=vh.None}get pickModeAxis(){return"main-category"}setZIndex(e){return super.setZIndex(e),this.connectorNodeGroup.zIndex=[xh.BACKGROUND,e],!0}isVertical(){return!super.isVertical()}connectionFactory(){return new Et}async processData(e){const{stageKey:t,valueKey:i}=this.properties,{visible:s,id:o}=this,a=(g,y,f)=>s&&this.ctx.legendManager.getItemEnabled({seriesId:o,itemId:f}),n=this.getCategoryAxis()?.scale,r=this.getValueAxis()?.scale,{isContinuousX:l,xScaleType:c,yScaleType:p}=this.getScaleInformation({xScale:n,yScale:r}),d=[];this.ctx.animationManager.isSkipped()||(this.processedData&&d.push(Jv(this.id,this.processedData)),d.push(tk()));const u=this.visible?{}:{forceValue:0},{processedData:m}=await this.requestDataModel(e,this.data,{props:[Xv(t,c,{id:"xValue"}),Hv(i,p,{id:"yValue",...u,validation:a,invalidValue:0}),...l?[qv,jv]:[],...d],groupByKeys:!1});this.smallestDataInterval=m.reduced?.smallestKeyInterval,this.largestDataInterval=m.reduced?.largestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i,id:s,ctx:{legendManager:o}}=this;if(!t||!i)return[];const{keys:[a]}=t.domain;if(e===this.getCategoryDirection()){const n=i.resolveProcessedDataDefById(this,"xValue");return n?.def.type==="key"&&n?.def.valueType==="category"?this.hasData?a.filter((r,l)=>o.getItemEnabled({seriesId:s,itemId:l})):[]:this.padBandExtent(a)}else{const n=this.domainForClippedRange(e,["yValue"],"xValue"),r=Math.max(...n),l=[-r,r];return Zv(l)}}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{hasData:e,data:t,dataModel:i,groupScale:s,processedData:o,id:a,ctx:{legendManager:n}}=this,r=this.getCategoryAxis(),l=this.getValueAxis();if(!(e&&t&&r&&l&&i&&o?.type==="ungrouped"))return;const c=r.scale,p=l.scale,d=this.getBarDirection()===Yv.X,{stageKey:u,valueKey:m}=this.properties,g=`${m}`,y={itemId:g,nodeData:[],labelData:[],connectorData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible},f=this.visible;if(!f)return y;const S=i.resolveKeysById(this,"xValue",o),x=i.resolveColumnById(this,"yValue",o),{barWidth:v,groupIndex:b}=this.updateGroupScale(r),k=sk.is(c)?v*-.5:0,A=rk(r?.scale,r?.visibleRange,this.smallestDataInterval,this.largestDataInterval);let I;const D=o.dataSources.get(this.id)?.data??[];for(const[N,R]of D.entries()){const C=f&&n.getItemEnabled({seriesId:a,itemId:N}),w=S[N];if(w==null)continue;const G=Math.round(c.convert(w))+s.convert(String(b))+k,_=x[N],E=Math.round(p.convert(-_)),L=Math.round(p.convert(_)),P=this.getItemStyle({datum:R,datumIndex:N},!1),T=Math.max(P.strokeWidth??0,Math.abs(L-E)),M={x:d?Math.min(L,E):G,y:d?G:Math.min(L,E),width:d?T:v,height:d?v:T},O={x:M.x+M.width/2,y:M.y+M.height/2},B=this.createLabelData({datumIndex:N,rect:M,barAlongX:d,yDatum:_,datum:R,visible:C}),F={index:N,series:this,itemId:g,datum:R,datumIndex:N,xValue:w,yValue:_,xKey:u,yKey:m,x:M.x,y:M.y,width:M.width,height:M.height,midPoint:O,crisp:A,label:B,visible:C};if(y.nodeData.push(F),B!=null&&y.labelData.push(B),I!=null){const V=I.rect,W=I.nodeDatum,K=I.datumIndex;d?y.connectorData.push({datum:W,datumIndex:K,x0:V.x,y0:V.y+V.height,x1:V.x+V.width,y1:V.y+V.height,x2:M.x+M.width,y2:M.y,x3:M.x,y3:M.y,opacity:1}):y.connectorData.push({datum:W,datumIndex:K,x0:V.x+V.width,y0:V.y,x1:M.x,y1:M.y,x2:M.x,y2:M.y+M.height,x3:V.x+V.width,y3:V.y+V.height,opacity:1})}C&&(I={itemId:g,rect:M,nodeDatum:F,datumIndex:N})}return y}updateNodes(e,t){super.updateNodes(e,t);const{connectorSelection:i}=this,s=this.contextNodeData?.connectorData??[];this.connectorSelection=this.updateConnectorSelection({connectorSelection:i,connectorData:s}),this.updateConnectorNodes({connectorSelection:i})}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,s=t??[];return i.update(s,void 0,o=>this.getDatumId(o))}updateConnectorSelection(e){const{connectorData:t,connectorSelection:i}=e;return i.update(this.connectorEnabled()?t:[],void 0,s=>this.getDatumId(s.datum))}updateConnectorNodes(e){const t=this.getShapeFillBBox();e.connectorSelection.each((i,s)=>{const{fill:o,fillOpacity:a,stroke:n,strokeOpacity:r,strokeWidth:l,lineDash:c,lineDashOffset:p}=this.connectorStyle(s.datumIndex);i.setProperties(Rs(i,s)),ck(i,{fill:o,stroke:n,fillOpacity:a,strokeOpacity:r,strokeWidth:l,lineDash:c,lineDashOffset:p},t)})}updateLabelSelection(e){const t=this.properties.label.enabled?e.labelData:[];return e.labelSelection.update(t,i=>{i.pointerEvents=vh.None})}updateLabelNodes(e){const t={stageKey:this.properties.stageKey,valueKey:this.properties.valueKey},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,o)=>{s.fillOpacity=this.getHighlightStyle(!1,o.datumIndex).opacity??1,Uv(this,s,t,this.properties.label,o,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:o}=this,{stageKey:a,valueKey:n,tooltip:r,legendItemName:l}=o,c=this.getCategoryAxis(),p=this.getValueAxis();if(!i||!s||!c||!p)return;const d=s.dataSources.get(this.id)?.data[e],u=i.resolveKeysById(this,"xValue",s)[e],m=i.resolveColumnById(this,"yValue",s)[e];if(u!=null)return this.formatTooltipWithContext(r,{symbol:this.legendItemSymbol(e),data:[{label:this.getAxisValueText(c,"tooltip",u,d,a,l),value:this.getAxisValueText(p,"tooltip",m,d,n,l)}]},{seriesId:t,datum:d,title:a,stageKey:a,valueKey:n,...this.tooltipStyle(d,e)})}resetAllAnimation(e){super.resetAllAnimation(e),Qv([this.connectorSelection],Rs)}animateEmptyUpdateReady({labelSelection:e}){const{connectorSelection:t}=this,i=this.isVertical(),o=$v(i,"normal");nk.fromToMotion(this.id,"connectors",this.ctx.animationManager,[t],o),bh(this,"labels",this.ctx.animationManager,e)}animateWaitingUpdateReady(e){const{labelSelection:t}=e;this.ctx.animationManager.stopByAnimationGroupId(this.id),bh(this,"labels",this.ctx.animationManager,t)}getDatumId(e){return lk(e.xValue)}isLabelEnabled(){return this.properties.label.enabled}computeFocusBounds({datumIndex:e}){return ik(this,this.contextNodeData?.nodeData[e])}legendItemSymbol(e){const{strokeWidth:t,fillOpacity:i,strokeOpacity:s,lineDash:o,lineDashOffset:a,fill:n,stroke:r}=this.properties.getStyle(e);return{marker:{fill:n,fillOpacity:i,stroke:r,strokeWidth:t,strokeOpacity:s,lineDash:o,lineDashOffset:a}}}getLegendData(e){const{id:t,processedData:i,dataModel:s,ctx:{legendManager:o},visible:a}=this;if(!s||!i||e!=="category")return[];const{showInLegend:n}=this.properties,r=s.resolveKeysById(this,"xValue",i);return(i.dataSources.get(this.id)?.data??[]).map((l,c)=>{const p=r[c];if(p!=null)return{legendType:"category",id:t,datum:l,itemId:c,seriesId:t,enabled:a&&o.getItemEnabled({seriesId:t,itemId:c}),label:{text:String(p)},symbol:this.legendItemSymbol(c),skipAnimations:!0,hideInLegend:!n}}).filter(l=>l!=null)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};import{_ModuleSupport as pk}from"ag-charts-community";var{Label:dk,AbstractBarSeriesProperties:uk,makeSeriesTooltip:gk,AxisLabel:mk,Property:tt}=pk,Pn=class extends dk{constructor(){super(...arguments),this.spacing=0}};h([tt],Pn.prototype,"placement",2),h([tt],Pn.prototype,"spacing",2);var Dh=class extends mk{};h([tt],Dh.prototype,"placement",2);var pt=class extends uk{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.label=new Pn,this.stageLabel=new Dh,this.tooltip=gk()}getStyle(e){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r}=this;return{fill:t[e],fillOpacity:s,stroke:i[e],strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r,opacity:1}}};h([tt],pt.prototype,"stageKey",2),h([tt],pt.prototype,"valueKey",2),h([tt],pt.prototype,"fills",2),h([tt],pt.prototype,"fillOpacity",2),h([tt],pt.prototype,"strokes",2),h([tt],pt.prototype,"strokeWidth",2),h([tt],pt.prototype,"strokeOpacity",2),h([tt],pt.prototype,"lineDash",2),h([tt],pt.prototype,"lineDashOffset",2),h([tt],pt.prototype,"label",2),h([tt],pt.prototype,"stageLabel",2),h([tt],pt.prototype,"tooltip",2);function Ih(e,{x:t,y:i,width:s,height:o,opacity:a}){return{x1:t,y1:i,x2:t+s,y2:i+o,opacity:a??1}}var{Line:yk,ChartAxisDirection:fk}=Bv,Cn=class extends kh{constructor(e){super({moduleCtx:e,animationResetFns:{datum:Ih}}),this.properties=new pt}get hasData(){const{id:e,ctx:{legendManager:t}}=this,i=this.data?.data.reduce((s,o,a)=>s+(t.getItemEnabled({seriesId:e,itemId:a})?1:0),0);return i!=null&&i>1}getBandScalePadding(){return{inner:1,outer:0}}connectorEnabled(){return!0}getItemStyle({datumIndex:e},t){return this.properties.getStyle(e)}connectorStyle(e){return this.properties.getStyle(e)}nodeFactory(){return new yk}createLabelData({datumIndex:e,rect:t,barAlongX:i,yDatum:s,datum:o,visible:a}){const{stageKey:n,valueKey:r,label:l}=this.properties,{spacing:c,placement:p}=l;if(!l.enabled)return;let d,u,m,g;if(i)switch(d=t.x+t.width/2,m="center",p){case"before":u=t.y-c,g="bottom";break;case"after":u=t.y+t.height+c,g="top";break;default:u=t.y+t.height/2,g="middle"}else switch(u=t.y+t.height/2,g="middle",p){case"before":d=t.x-c,m="right";break;case"after":d=t.x+t.width+c,m="left";break;default:d=t.x+t.width/2,m="center"}const y=this.getSeriesDomain(fk.Y),f=this.getLabelText(s,o,r,"y",y,l,{itemId:r,value:s,datum:o,stageKey:n,valueKey:r});return{x:d,y:u,textAlign:m,textBaseline:g,text:f,itemId:r,datum:o,datumIndex:e,series:this,visible:a}}updateDatumNodes(e){const t=this.getHighlightStyle(e.isHighlight);e.datumSelection.each((i,s)=>{i.setProperties(Ih(i,s)),i.stroke=t?.stroke,i.strokeWidth=t?.strokeWidth??0,i.strokeOpacity=t?.strokeOpacity??1,i.lineDash=t?.lineDash,i.lineDashOffset=t?.lineDashOffset??0,i.opacity=t?.opacity??1})}tooltipStyle(e,t){const{fill:i,stroke:s,fillOpacity:o,strokeOpacity:a,strokeWidth:n,lineDash:r,lineDashOffset:l}=this.properties.getStyle(t);return{fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:n,lineDash:r,lineDashOffset:l}}hasItemStylers(){return this.properties.label.itemStyler!=null}};Cn.className="ConeFunnelSeries",Cn.type="cone-funnel";import{_ModuleSupport as Sk}from"ag-charts-community";import{constant as xk,required as On,string as Ah}from"ag-charts-core";var{commonSeriesOptionsDefs:bk,coneFunnelSeriesThemeableOptionsDef:vk,without:kk}=Sk,Dk={...kk(bk,["showInLegend"]),...vk,type:On(xk("cone-funnel")),stageKey:On(Ah),valueKey:On(Ah)};import{_ModuleSupport as ii}from"ag-charts-community";var{ThemeConstants:{CARTESIAN_AXIS_TYPE:Mh}}=ii,uP={series:{direction:"vertical",fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"secondSequentialColors"},ii.SAFE_RANGE2_OPERATION]},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",ii.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS],["pattern",ii.FILL_PATTERN_SINGLE_DEFAULTS],["image",ii.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"secondSequentialColors"},ii.SAFE_RANGE2_OPERATION]}]},strokeWidth:{$isUserOption:["./strokes/0",2,0]},label:{...ii.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},placement:"before",spacing:4},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:ii.singleSeriesHighlightStyle(!1)},seriesArea:{padding:{top:20,bottom:20}},axes:{[Mh.NUMBER]:{nice:!1,gridLine:{enabled:!1},crosshair:{enabled:!1},label:{enabled:!1}},[Mh.CATEGORY]:{line:{enabled:!1}}}},Nh={type:"series",name:"cone-funnel",chartType:"cartesian",enterprise:!0,options:Dk,create:e=>new Cn(e)};import{_ModuleSupport as Ik}from"ag-charts-community";import{_ModuleSupport as Ak}from"ag-charts-community";var{Label:Mk,DropShadow:Nk,AbstractBarSeriesProperties:Lk,BaseProperties:Tk,makeSeriesTooltip:Rk,AxisLabel:Pk,Property:fe}=Ak,Ck=class extends Mk{},Lh=class extends Pk{};h([fe],Lh.prototype,"placement",2);var Ht=class extends Tk{constructor(){super(...arguments),this.enabled=!0,this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(){const{fill:e,stroke:t,fillOpacity:i,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n}=this;return{fill:e,fillOpacity:i,stroke:t,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n,opacity:1}}};h([fe],Ht.prototype,"enabled",2),h([fe],Ht.prototype,"fill",2),h([fe],Ht.prototype,"fillOpacity",2),h([fe],Ht.prototype,"stroke",2),h([fe],Ht.prototype,"strokeWidth",2),h([fe],Ht.prototype,"strokeOpacity",2),h([fe],Ht.prototype,"lineDash",2),h([fe],Ht.prototype,"lineDashOffset",2);var Ye=class extends Lk{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.spacingRatio=0,this.dropOff=new Ht,this.shadow=new Nk().set({enabled:!1}),this.label=new Ck,this.stageLabel=new Lh,this.tooltip=Rk()}getStyle(e){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r}=this;return{fill:t[e],fillOpacity:s,stroke:i[e],strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r,opacity:1}}};h([fe],Ye.prototype,"stageKey",2),h([fe],Ye.prototype,"valueKey",2),h([fe],Ye.prototype,"fills",2),h([fe],Ye.prototype,"fillOpacity",2),h([fe],Ye.prototype,"strokes",2),h([fe],Ye.prototype,"strokeWidth",2),h([fe],Ye.prototype,"strokeOpacity",2),h([fe],Ye.prototype,"lineDash",2),h([fe],Ye.prototype,"lineDashOffset",2),h([fe],Ye.prototype,"spacingRatio",2),h([fe],Ye.prototype,"itemStyler",2),h([fe],Ye.prototype,"dropOff",2),h([fe],Ye.prototype,"shadow",2),h([fe],Ye.prototype,"label",2),h([fe],Ye.prototype,"stageLabel",2),h([fe],Ye.prototype,"tooltip",2);var{ChartAxisDirection:Th,resetBarSelectionsFn:Ok,prepareBarAnimationFunctions:Rh,midpointStartingBarPosition:Ph,createDatumId:_k,Rect:wk,motion:Ch,applyShapeStyle:Ek,mergeDefaults:_n}=Ik,wn=class extends kh{constructor(e){super({moduleCtx:e,animationResetFns:{datum:Ok}}),this.properties=new Ye}getBandScalePadding(){return{inner:this.properties.spacingRatio,outer:0}}connectorEnabled(){return this.properties.dropOff.enabled}connectorStyle(e){return _n(this.properties.dropOff.getStyle(),this.properties.getStyle(e))}nodeFactory(){return new wk}createLabelData({datumIndex:e,rect:t,yDatum:i,datum:s,visible:o}){const{valueKey:a,stageKey:n,label:r}=this.properties;if(!r.enabled)return;const l=this.getSeriesDomain(Th.Y),c=this.getLabelText(i,s,a,"y",l,r,{itemId:a,value:i,datum:s,stageKey:n,valueKey:a});return{x:t.x+t.width/2,y:t.y+t.height/2,textAlign:"center",textBaseline:"middle",text:c,itemId:n,datum:s,datumIndex:e,series:this,visible:o}}getItemStyle({datum:e,datumIndex:t},i){const{id:s,properties:o}=this,{stageKey:a,valueKey:n,itemStyler:r}=o,l=this.getHighlightStyle(i,t);let p=_n(l,o.getStyle(t));if(r!=null){const d=this.ctx.highlightManager?.getActiveHighlight(),u=this.cachedDatumCallback(_k(t,i?"highlight":"node"),()=>{const m=this.getHighlightStateString(d,i,t);return this.callWithContext(r,{seriesId:s,datum:e,highlighted:i,highlightState:m,stageKey:a,valueKey:n,...p})});u&&(p=_n(u,p))}return p}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const{shadow:s}=this.properties,o=this.getCategoryDirection()===Th.X,a=this.getShapeFillBBox();e.each((n,r)=>{const l=this.getItemStyle(r,t);Ek(n,l,a),n.visible=o?r.width>0:r.height>0,n.crisp=r.crisp,n.fillShadow=s})}tooltipStyle(e,t){return this.getItemStyle({datum:e,datumIndex:t},!1)}animateEmptyUpdateReady(e){super.animateEmptyUpdateReady(e);const{datumSelection:t}=e,i=this.isVertical(),o=Rh(Ph(i,"normal"),"unknown");Ch.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],o)}animateWaitingUpdateReady(e){super.animateWaitingUpdateReady(e);const{datumSelection:t}=e,{processedData:i}=this,s=i?.reduced?.diff?.[this.id],o=Rh(Ph(this.isVertical(),"fade"),"added");Ch.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],o,(a,n)=>n.xValue,s)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};wn.className="FunnelSeries",wn.type="funnel";import{_ModuleSupport as Fk}from"ag-charts-community";import{constant as Bk,required as En,string as Oh}from"ag-charts-core";var{commonSeriesOptionsDefs:Gk,funnelSeriesThemeableOptionsDef:Vk,without:Kk}=Fk,Wk={...Vk,...Kk(Gk,["showInLegend"]),type:En(Bk("funnel")),stageKey:En(Oh),valueKey:En(Oh)},_h={type:"series",name:"funnel",chartType:"cartesian",enterprise:!0,options:Wk,create:e=>new wn(e)};import{_ModuleSupport as Ps}from"ag-charts-community";import{_ModuleSupport as Qi}from"ag-charts-community";import{cachedTextMeasurer as wh,isArray as zk,measureTextSegments as $k}from"ag-charts-core";import{_ModuleSupport as Hk}from"ag-charts-community";function Fn(e,t,i){return Hk.callWithContext(e.chartService,t,i)}var Eh=class{*[Symbol.iterator](){const{node:e,datum:t}=this;e&&t&&(yield{node:e,datum:t})}nodes(){return this.node?[this.node]:[]}update(e,t,i,s){const o=e.nodes();if(o.length===0)this.node?.remove(),this.node=void 0;else{this.node===void 0&&(this.node=new i,this.node.fillOpacity=0,this.node.strokeOpacity=0,t.appendChild(this.node));const a=o[0],n=o.toReversed().find(r=>r.datum.datum.value>r.datum.datum.segmentStart)??o.at(-1);this.node.datum=this.datum=a.datum,s(this.node,a,n)}}};import{isArray as Xk}from"ag-charts-core";var Fh={fromFn:()=>({opacity:0,phase:"initial"}),toFn:()=>({opacity:1})};function Bh(e,t){if(e==null)return"";const{min:i,max:s}=t,o=i===0?0:Math.ceil(Math.log10(Math.abs(i))),a=s===0?0:Math.ceil(Math.log10(Math.abs(s))),n=Math.max(2-Math.max(o,a),0);return e.toFixed(n)}function Cs(e,t,i,s){if(i.text!=null)return i.text;const o=s??i.value;let a;return i?.formatter!=null&&(a=Fn(t,i.formatter,{seriesId:e,datum:void 0,value:o})),a==null||Xk(a)?a:String(a)}function Gh({path:e,x:t,y:i,size:s}){e.moveTo(t,i-s/2),e.lineTo(t,i+s/2)}import{clamp as Vh,iterate as Yk}from"ag-charts-core";function Kh(e,t){const i=Yk(e.datumUnion.nodes(),e.targetSelection.nodes());return e.pickNodeNearestDistantObject(t,i)}function Wh(e,t){const i=[{data:e.contextNodeData?.nodeData,selection:e.datumUnion},{data:e.contextNodeData?.targetData,selection:e.targetSelection}].filter(l=>l.data&&l.data.length>0),s=Vh(0,t.otherIndex+t.otherIndexDelta,i.length-1);if(i.length===0)return;const{data:o,selection:a}=i[s];if(o==null||o.length===0)return;const n=Vh(0,t.datumIndex,o.length-1),r=o[n];for(const l of a)if(l.datum===r)return{bounds:l.node,clipFocusBox:!0,datum:r,datumIndex:n,otherIndex:s}}import{_ModuleSupport as Bn}from"ag-charts-community";import{_ModuleSupport as Uk}from"ag-charts-community";import{Logger as qk}from"ag-charts-core";var{BaseProperties:zh,Property:es}=Uk,Ho=class extends zh{getSegments(e,t){const{values:i,step:s,count:o}=this,a=Math.min(...e.domain),n=Math.max(...e.domain);let r;if(i!=null){const l=i.filter(c=>c>a&&cc-p);r=[a,...l,n]}else if(s!=null){const l=[];for(let c=a;cc>a&&cp/l*(n-a)+a)}return r!=null&&r.length>t&&(qk.warnOnce("the configured segmentation results in more than 1 item per pixel, ignoring. Supply a segmentation configuration that results in larger segments or omit this configuration"),r=void 0),r??(r=[a,n]),r}};h([es],Ho.prototype,"values",2),h([es],Ho.prototype,"step",2),h([es],Ho.prototype,"count",2);var Os=class extends zh{constructor(){super(...arguments),this.enabled=!1,this.interval=new Ho,this.spacing=0}};h([es],Os.prototype,"enabled",2),h([es],Os.prototype,"interval",2),h([es],Os.prototype,"spacing",2);var{BaseProperties:Xo,makeSeriesTooltip:jk,SeriesProperties:Jk,PropertiesArray:Gn,Property:X,Label:Zk,AxisLabel:Qk,getColorStops:eD}=Bn,$h=class extends Zk{};h([X],$h.prototype,"spacing",2);var Ue=class extends Xo{constructor(){super(...arguments),this.value=0,this.label=new $h}getStyle(e){const{fill:t=e.fill??"black",fillOpacity:i=e.fillOpacity??1,stroke:s=e.stroke??"black",strokeWidth:o=e.strokeWidth??0,strokeOpacity:a=e.strokeOpacity??1,lineDash:n=e.lineDash??[0],lineDashOffset:r=e.lineDashOffset??0}=this;return{fill:t,fillOpacity:i,stroke:s,strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r}}};h([X],Ue.prototype,"text",2),h([X],Ue.prototype,"value",2),h([X],Ue.prototype,"shape",2),h([X],Ue.prototype,"placement",2),h([X],Ue.prototype,"spacing",2),h([X],Ue.prototype,"size",2),h([X],Ue.prototype,"rotation",2),h([X],Ue.prototype,"fill",2),h([X],Ue.prototype,"fillOpacity",2),h([X],Ue.prototype,"stroke",2),h([X],Ue.prototype,"strokeWidth",2),h([X],Ue.prototype,"strokeOpacity",2),h([X],Ue.prototype,"lineDash",2),h([X],Ue.prototype,"lineDashOffset",2),h([X],Ue.prototype,"label",2);var dt=class extends Xo{constructor(){super(...arguments),this.enabled=!0,this.thicknessRatio=1,this.fills=new Gn(Bn.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t,i){const{fill:s,fills:o,fillMode:a,fillOpacity:n,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:p,lineDashOffset:d}=this;return{fill:s??Xh(o,a,e,i,t),fillOpacity:n,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:p,lineDashOffset:d}}};h([X],dt.prototype,"enabled",2),h([X],dt.prototype,"thickness",2),h([X],dt.prototype,"thicknessRatio",2),h([X],dt.prototype,"fills",2),h([X],dt.prototype,"fillMode",2),h([X],dt.prototype,"fill",2),h([X],dt.prototype,"fillOpacity",2),h([X],dt.prototype,"stroke",2),h([X],dt.prototype,"strokeWidth",2),h([X],dt.prototype,"strokeOpacity",2),h([X],dt.prototype,"lineDash",2),h([X],dt.prototype,"lineDashOffset",2);var _s=class extends Xo{constructor(){super(...arguments),this.values=void 0,this.step=void 0,this.minSpacing=0,this.maxSpacing=1e3}};h([X],_s.prototype,"values",2),h([X],_s.prototype,"step",2),h([X],_s.prototype,"minSpacing",2),h([X],_s.prototype,"maxSpacing",2);var Hh=class extends Qk{constructor(){super(...arguments),this.placement=void 0}};h([X],Hh.prototype,"placement",2);var Je=class extends Xo{constructor(){super(...arguments),this.min=0,this.max=1,this.fills=new Gn(Bn.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.defaultFill="black",this.interval=new _s,this.label=new Hh}getStyle(e,t,i,s){const{fill:o,fills:a,defaultFill:n,fillMode:r,fillOpacity:l,stroke:c,strokeWidth:p,strokeOpacity:d,lineDash:u,lineDashOffset:m}=this;return{fill:o??(e&&a.length===0?n:void 0)??Xh(a,r,t,s,i),fillOpacity:l,stroke:c,strokeWidth:p,strokeOpacity:d,lineDash:u,lineDashOffset:m}}};h([X],Je.prototype,"min",2),h([X],Je.prototype,"max",2),h([X],Je.prototype,"fills",2),h([X],Je.prototype,"fillMode",2),h([X],Je.prototype,"fill",2),h([X],Je.prototype,"fillOpacity",2),h([X],Je.prototype,"stroke",2),h([X],Je.prototype,"strokeWidth",2),h([X],Je.prototype,"strokeOpacity",2),h([X],Je.prototype,"lineDash",2),h([X],Je.prototype,"lineDashOffset",2),h([X],Je.prototype,"defaultFill",2),h([X],Je.prototype,"interval",2),h([X],Je.prototype,"label",2);var Yo=class extends _t{constructor(){super(...arguments),this.placement="inside-center",this.avoidCollisions=!0}};h([X],Yo.prototype,"text",2),h([X],Yo.prototype,"placement",2),h([X],Yo.prototype,"avoidCollisions",2);var Ze=class extends Jk{constructor(){super(...arguments),this.value=0,this.segmentation=new Os,this.defaultColorRange=[],this.targets=new Gn(Ue),this.defaultTarget=new Ue,this.defaultScale=new Je,this.direction="vertical",this.thickness=1,this.cornerRadius=0,this.cornerMode="container",this.margin=0,this.scale=new Je,this.bar=new dt,this.label=new Yo,this.tooltip=jk()}};h([X],Ze.prototype,"value",2),h([X],Ze.prototype,"segmentation",2),h([X],Ze.prototype,"defaultColorRange",2),h([X],Ze.prototype,"targets",2),h([X],Ze.prototype,"defaultTarget",2),h([X],Ze.prototype,"defaultScale",2),h([X],Ze.prototype,"direction",2),h([X],Ze.prototype,"thickness",2),h([X],Ze.prototype,"cornerRadius",2),h([X],Ze.prototype,"cornerMode",2),h([X],Ze.prototype,"margin",2),h([X],Ze.prototype,"scale",2),h([X],Ze.prototype,"bar",2),h([X],Ze.prototype,"label",2),h([X],Ze.prototype,"tooltip",2);function Xh(e,t,i,s,o){return{type:"gradient",gradient:"linear",colorSpace:"oklch",colorStops:eD(e,i,s.domain,t),rotation:o?90:0,bounds:"series"}}import{_ModuleSupport as tD}from"ag-charts-community";import{cachedTextMeasurer as iD,isArray as sD,measureTextSegments as oD,toPlainText as aD}from"ag-charts-core";var{BBox:nD}=tD;function Vn(e){const{x0:t,y0:i,x1:s,y1:o,horizontalInset:a,verticalInset:n}=e,r=Math.min(t,s)+a,l=Math.min(i,o)+n,c=Math.max(Math.abs(s-t)-2*a,0),p=Math.max(Math.abs(o-i)-2*n,0);return{x:r,y:l,width:c,height:p}}function rD(e,t){if(t==null)return!0;const i=Vn(e),s=1e-6,o=i.x+s,a=i.y+s,n=i.x+i.width-s,r=i.y+i.height-s,l=t.x,c=t.x+t.width,p=t.y,d=t.y+t.height;return Math.max(o,l)<=Math.min(n,c)&&Math.max(a,p)<=Math.min(r,d)}function Kn(e){const{clipX0:t,clipX1:i,clipY0:s,clipY1:o}=e;return t!=null&&i!=null||s!=null&&o!=null}function lD(e){if(!Kn(e))return;const{x0:t,y0:i,x1:s,y1:o}=e,{x:a,y:n,width:r,height:l}=Vn(e);let{clipX0:c,clipX1:p,clipY0:d,clipY1:u}=e;(c==null||p==null)&&(c=t,p=s),(d==null||u==null)&&(d=i,u=o);const m=Math.min(c,p),g=Math.min(d,u),y=Math.abs(p-c),f=Math.abs(u-d);return c=Math.max(a,m),d=Math.max(n,g),p=Math.min(a+r,m+y),u=Math.min(n+l,g+f),new nD(Math.min(c,p),Math.min(d,u),Math.abs(p-c),Math.abs(u-d))}function Yh(e,t){const i=e?"initial":"update";return{node:{fromFn(o,a){const n=o.previousDatum;let{x0:r,y0:l,x1:c,y1:p,clipX0:d,clipY0:u,clipX1:m,clipY1:g}=n??a;const{horizontalInset:y,verticalInset:f}=a,S=n!=null&&Kn(n),x=Kn(a);return S&&x||(!S&&x?({x0:r,y0:l,x1:c,y1:p,clipX0:d,clipY0:u,clipX1:m,clipY1:g}=a,e&&(t?m=a.clipX0:g=a.clipY0)):S&&!x?({x0:r,y0:l,x1:c,y1:p}=a,d=void 0,u=void 0,m=void 0,g=void 0):e&&(t?c=r:p=l)),{x0:r,y0:l,x1:c,y1:p,clipX0:d,clipY0:u,clipX1:m,clipY1:g,horizontalInset:y,verticalInset:f,phase:i}},toFn(o,a){const{x0:n,y0:r,x1:l,y1:c,clipX0:p,clipY0:d,clipX1:u,clipY1:m,horizontalInset:g,verticalInset:y}=a;return{x0:n,y0:r,x1:l,y1:c,clipX0:p,clipY0:d,clipX1:u,clipY1:m,horizontalInset:g,verticalInset:y}},applyFn(o,a){o.setProperties(ws(o,a))}}}}function ws(e,t){const{x:i,y:s,width:o,height:a}=Vn(t),n=lD(t),r=rD(t,n);return{x:i,y:s,width:o,height:a,clipBBox:n,visible:r}}var cD={Before:"right",Center:"center",After:"left"},hD={Before:"top",Center:"middle",After:"bottom"},pD={Before:-1,Center:-.5,After:0},dD={Before:0,Center:-.5,After:-1};function uD(e,t,i,s,o,a){const{seriesRect:n,gaugeRect:r,barRect:l}=o,{padding:c,horizontal:p}=s;i.each((d,u)=>{const m=Cs(e.id,t,u,a?.label);let g,y;u.placement==="outside-start"?p?(g=r.x,y=n.height):(g=n.width,y=n.height-(r.y+r.height)):u.placement==="outside-end"?p?(g=n.width-(r.x+r.width),y=n.height):(g=n.width,y=r.y):u.avoidCollisions&&(g=r.width,y=r.height);let f;if(m==null)return;if(g!=null&&y!=null){const E=()=>({width:g,height:y,meta:null});f=Ds(aD(m),u,{padding:c},E)?.[0]}else{const E=iD(u),{width:L,height:P}=sD(m)?oD(m,u):E.measureLines(m);f={text:m,fontSize:u.fontSize,lineHeight:u.lineHeight??E.lineHeight(),width:L,height:P}}if(f==null){d.visible=!1;return}const S=p?r.x:r.y+r.height,x=p?r.x+r.width:r.y,v=p?l.x:l.y+l.height,b=p?l.x+l.width:l.y,k=u.spacing*(p?1:-1);let A,I,D,N;switch(u.placement){case"outside-start":A=-1/0,I=1/0,D=S-k,N="Before";break;case"outside-end":A=-1/0,I=1/0,D=x+k,N="After";break;case"inside-start":A=S,I=b,D=S+k,N="After";break;case"inside-end":A=b,I=x,D=x-k,N="Before";break;case"inside-center":A=S,I=x,D=(S+x)/2,N="Center";break;case"bar-inside":A=v,I=b,D=(v+b)/2,N="Center";break;case"bar-inside-end":A=v,I=b,D=b-k,N="Before";break;case"bar-outside-end":A=b,I=x,D=b+k,N="After";break;case"bar-end":A=-1/0,I=1/0,D=b,N="Center";break}const R=p?D:r.x+r.width/2,C=p?r.y+r.height/2:D;let w,G;p?(w=R+pD[N]*f.width,G=w+f.width):(w=C+dD[N]*f.height,G=w+f.height);const _=Math.min(w,G)>=Math.min(A,I)&&Math.max(w,G)<=Math.max(A,I);if(u.avoidCollisions&&!_){d.visible=!1;return}d.visible=!0,d.text=f.text,d.fontSize=f.fontSize,d.lineHeight=f.lineHeight,d.textAlign=p?cD[N]:"center",d.textBaseline=p?"middle":hD[N],d.x=R,d.y=C})}var{fromToMotion:Wn,resetMotion:gD,SeriesNodePickMode:Uh,StateMachine:mD,createDatumId:qh,toRadians:jh,BBox:Ft,Group:Ii,PointerEvents:Jh,Selection:Ai,Rect:yD,Text:Zh,TransformableText:fD,Marker:SD,LinearScale:xD,generateTicks:bD,NiceMode:vD,easing:kD,findRangeExtent:DD,tickFormat:ID,mergeDefaults:AD,applyShapeStyle:zn}=Qi,MD={before:180,middle:0,after:0},ND={before:90,middle:0,after:-90},Uo=class extends Qi.Series{constructor(e){super({moduleCtx:e,pickModes:[Uh.EXACT_SHAPE_MATCH,Uh.NEAREST_NODE]}),this.properties=new Ze,this.seriesRect=Ft.NaN,this.gaugeRect=Ft.NaN,this.scale=new xD,this.originX=0,this.originY=0,this.scaleGroup=this.contentGroup.appendChild(new Ii({name:"scaleGroup"})),this.itemGroup=this.contentGroup.appendChild(new Ii({name:"itemGroup"})),this.itemTargetGroup=this.contentGroup.appendChild(new Ii({name:"itemTargetGroup"})),this.itemTargetLabelGroup=this.contentGroup.appendChild(new Ii({name:"itemTargetLabelGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Ii({name:"itemLabelGroup"})),this.highlightTargetGroup=this.highlightGroup.appendChild(new Ii({name:"itemTargetLabelGroup"})),this.tickGroup=this.contentGroup.appendChild(new Ii({name:"tickGroup"})),this.scaleSelection=Ai.select(this.scaleGroup,()=>this.nodeFactory()),this.datumSelection=Ai.select(this.itemGroup,()=>this.nodeFactory()),this.targetSelection=Ai.select(this.itemTargetGroup,()=>this.markerFactory()),this.targetLabelSelection=Ai.select(this.itemTargetLabelGroup,Zh),this.labelSelection=Ai.select(this.itemLabelGroup,Zh),this.highlightTargetSelection=Ai.select(this.highlightTargetGroup,()=>this.markerFactory()),this.tickSelection=Ai.select(this.tickGroup,fD),this.datumUnion=new Eh,this.animationState=new mD("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.animateReadyResize(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateWaitingUpdateReady()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty"},reset:"empty",skip:"ready"}}),this.scaleGroup.pointerEvents=Jh.None,this.tickGroup.pointerEvents=Jh.None}get range(){return this.horizontal?[0,this.gaugeRect.width]:[0,this.gaugeRect.height]}get horizontal(){return this.properties.direction==="horizontal"}get hasData(){return!0}nodeFactory(){const e=new yD;return e.crisp=!0,e}markerFactory(){return new SD}processData(){this.nodeDataRefresh=!0,this.animationState.transition("updateData")}formatLabel(e){return Bh(e,this.properties.scale)}getShapeFillBBox(){const{properties:e,originX:t,originY:i,horizontal:s,scale:o}=this,{thickness:a}=e,n=DD(o.range),r=new Ft(t,i,s?n:a,s?a:n);return{axis:r,series:r}}getTargets(){const{properties:e}=this,t=e.defaultTarget;return Array.from(e.targets).map(i=>{const{text:s=t.text,value:o=t.value??0,shape:a=t.shape??"triangle",rotation:n=t.rotation??0,placement:r=t.placement??"middle",spacing:l=t.spacing??0,size:c=t.size??0}=i,{enabled:p=t.label.enabled,color:d=t.label.color??"black",fontStyle:u=t.label.fontStyle??"normal",fontWeight:m=t.label.fontWeight??"normal",fontSize:g=t.label.fontSize,fontFamily:y=t.label.fontFamily,spacing:f=t.label.spacing??0}=i.label;return{text:s,value:o,shape:a,placement:r,spacing:l,size:c,rotation:n,label:{enabled:p,color:d,fontStyle:u,fontWeight:m,fontSize:g,fontFamily:y,spacing:f},style:i.getStyle(t)}})}getTargetPoint(e){const{properties:t,originX:i,originY:s,horizontal:o,scale:a,gaugeRect:n}=this,{thickness:r}=t,{value:l,placement:c,spacing:p,size:d}=e,u=a.convert(l);let m;switch(c){case"before":m=-(p+d/2);break;case"after":m=r+p+d/2;break;default:m=r/2;break}return{x:i+n.x+(o?u:m),y:s+n.y+(o?m:u)}}getTargetLabel(e){const{size:t,placement:i,label:s}=e,{spacing:o,color:a,fontStyle:n,fontWeight:r,fontSize:l,fontFamily:c}=s,p=void 0,d=t/2+o;let u,m,g=0,y=0;return this.horizontal?(u="center",i==="after"?(m="top",y=d):(m="bottom",y=-d)):(m="middle",i==="before"?(u="right",g=-d):(u="left",g=d)),{offsetX:g,offsetY:y,fill:a,textAlign:u,textBaseline:m,fontStyle:n,fontWeight:r,fontSize:l,fontFamily:c,lineHeight:p}}labelDatum(e,t){const{placement:i,avoidCollisions:s,spacing:o,text:a,color:n,fontSize:r,minimumFontSize:l,fontStyle:c,fontWeight:p,fontFamily:d,lineHeight:u,wrapping:m,overflowStrategy:g,formatter:y=f=>this.formatLabel(f.value)}=e;return{placement:i,avoidCollisions:s,spacing:o,text:a,value:t,fill:n,fontSize:r,minimumFontSize:l,fontStyle:c,fontWeight:p,fontFamily:d,lineHeight:u,wrapping:m,overflowStrategy:g,formatter:y}}verticalLabelInset(){const{label:e}=this.properties,t=wh(e),i=e.text?.split(` +`),s=(e.lineHeight??t.lineHeight())*(i?.length??1);return e.spacing+s}horizontalLabelInset(){const{scale:e,properties:t}=this,{scale:i,label:s}=t,o=s.text?.split(` +`),a=wh(s),n=i.interval.values??e.ticks({nice:!1,interval:i.interval.step,minTickCount:0,maxTickCount:6,tickCount:5})?.ticks??[],l=(o??n?.map(c=>Cs(this.id,this.ctx,this.labelDatum(s,c))??"")).reduce((c,p)=>{const{width:d}=zk(p)?$k(p,s):a.measureLines(p);return Math.max(c,d)},0);return s.spacing+l}tickFormatter(e,t){const{format:i,formatter:s}=this.properties.scale.label;let o;return i!=null&&(o=ID(t,typeof i=="string"?i:void 0)),(a,n)=>{let r;return s&&(r??(r=Fn(this.ctx,s,{value:a,index:n,domain:e,boundSeries:void 0}))),r??(r=o?.(a)),r??this.formatLabel(a)}}createNodeData(){const{id:e,properties:t,horizontal:i,scale:s,seriesRect:o}=this,{value:a,segmentation:n,thickness:r,cornerRadius:l,cornerMode:c,bar:p,scale:d,label:u,defaultColorRange:m}=t;s.domain=[d.min,d.max],s.range=i?[0,o.width]:[o.height,0];let g,y;i?(y=1,g=Math.PI/2):d.label.placement==="before"?(y=1,g=0):(y=-1,g=0);let f,S,x,v;i?(f=0,S=o.width,x=(o.height-r)/2,v=x+r,u.placement==="outside-start"?f+=this.horizontalLabelInset():u.placement==="outside-end"&&(S-=this.horizontalLabelInset())):(f=(o.width-r)/2,S=f+r,v=0,x=o.height,u.placement==="outside-start"?x-=this.verticalLabelInset():u.placement==="outside-end"&&(v+=this.verticalLabelInset())),this.gaugeRect=new Ft(Math.min(f,S),Math.min(x,v),Math.abs(S-f),Math.abs(v-x));const b=0,k=0;s.domain=[d.min,d.max],s.range=i?[f,S]:[x,v];const{tickData:{ticks:A}}=bD({scale:s,label:this.properties.scale.label,interval:this.properties.scale.interval,tickFormatter:(Q,ie)=>this.tickFormatter(Q,ie),domain:s.domain,range:this.range,reverse:!1,primaryTickCount:void 0,defaultTickMinSpacing:0,visibleRange:[0,1],niceMode:vD.Off,labelOffset:0,axisRotation:g,sideFlag:y}),I=!1,D=this.getTargets(),N=[],R=[],C=[],w=[],[G,_]=s.range,E=Math.abs(_-G),L=i?s.convert(a):S,P=i?v:s.convert(a),T=n.enabled?n.spacing/2:0,M=i?T:0,O=i?0:T,B=Math.min(p.thickness??Math.round(p.thicknessRatio*r),r),F=-(r-B)/2,V=i?0:F,W=i?F:0,K=c==="item",z=Math.ceil(E);let $=n.enabled?n.interval.getSegments(s,z):void 0;const Z=p.getStyle(m,i,s),q=d.getStyle(p.enabled,m,i,s);if($==null&&K){const Q=Math.min(...s.domain),ie=Math.max(...s.domain),U={value:a,segmentStart:Q,segmentEnd:ie};if(p.enabled){const ue=Math.min(l,B/2,E/2)*(I?-1:1),le=i?ue:0,ye=i?0:ue;N.push({series:this,itemId:"value",datum:U,datumIndex:{type:0},type:0,x0:b+f-le-V,y0:k+x-ye-W,x1:b+L+le+V,y1:k+P+ye+W,clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:l,topRightCornerRadius:l,bottomRightCornerRadius:l,bottomLeftCornerRadius:l,horizontalInset:M,verticalInset:O,style:Z})}const ae=Math.min(l,r/2,E/2)*(I?-1:1),j=i?ae:0,re=i?0:ae;w.push({series:this,itemId:"scale",datum:U,datumIndex:{type:0},type:0,x0:b+f-j,y0:k+x-re,x1:b+S+j,y1:k+v+re,clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:l,topRightCornerRadius:l,bottomRightCornerRadius:l,bottomLeftCornerRadius:l,horizontalInset:M,verticalInset:O,style:q})}else{$??($=s.domain);const Q=b+f-V,ie=k+x-W,U=b+L+V,ce=k+P+W;for(let ae=0;ae<$.length-1;ae+=1){const j=$[ae+0],re=$[ae+1],se={value:a,segmentStart:j,segmentEnd:re},ue=ae===0,le=ae===$.length-2,ye=s.convert(j),we=s.convert(re),rt=K||ue?l:0,pi=K||le?l:0,bt=i?rt:pi,Pt=pi,gs=i?pi:rt,ms=rt;p.enabled&&N.push({series:this,itemId:`value-${ae}`,datum:se,datumIndex:{type:0},type:0,x0:b+(i?ye:f),y0:k+(i?x:ye),x1:b+(i?we:S),y1:k+(i?v:we),clipX0:Q,clipY0:ie,clipX1:U,clipY1:ce,topLeftCornerRadius:bt,topRightCornerRadius:Pt,bottomRightCornerRadius:gs,bottomLeftCornerRadius:ms,horizontalInset:M,verticalInset:O,style:Z}),w.push({series:this,itemId:`scale-${ae}`,datum:se,datumIndex:{type:0},type:0,x0:b+(i?ye:f),y0:k+(i?x:ye),x1:b+(i?we:S),y1:k+(i?v:we),clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:bt,topRightCornerRadius:Pt,bottomRightCornerRadius:gs,bottomLeftCornerRadius:ms,horizontalInset:M,verticalInset:O,style:q})}}u.enabled&&C.push(this.labelDatum(u,a));const Y=i?MD:ND;for(let Q=0;Qqh(e.nodeData.length,t.itemId))}updateDatumNodes(e){const{datumSelection:t}=e,{ctx:i}=this,s=i.animationManager.isSkipped(),o=this.getShapeFillBBox();t.each((n,r)=>{const{topLeftCornerRadius:l,topRightCornerRadius:c,bottomRightCornerRadius:p,bottomLeftCornerRadius:d}=r;zn(n,r.style,o),n.topLeftCornerRadius=l,n.topRightCornerRadius=c,n.bottomRightCornerRadius=p,n.bottomLeftCornerRadius=d,n.pointerEvents=this.properties.bar.enabled?Qi.PointerEvents.All:Qi.PointerEvents.None,(s||n.previousDatum==null)&&n.setProperties(ws(n,r))});const{horizontal:a}=this;this.datumUnion.update(t,this.itemGroup,Qi.Rect,(n,r,l)=>{const c=Math.min(r.x,l.x),p=Math.max(r.x+r.width,l.x+l.width),d=Math.min(r.y,l.y),u=Math.max(r.y+r.height,l.y+l.height),m=p-c,g=u-d;n.pointerEvents=Qi.PointerEvents.None,n.x=c,n.y=d,n.width=m,n.height=g,n.topLeftCornerRadius=a?r.topLeftCornerRadius:l.topLeftCornerRadius,n.topRightCornerRadius=l.topRightCornerRadius,n.bottomRightCornerRadius=a?l.bottomRightCornerRadius:r.bottomRightCornerRadius,n.bottomLeftCornerRadius=r.bottomLeftCornerRadius;const y=r.clipBBox,f=l.clipBBox??y;y&&f?n.clipBBox=Ft.merge([y,f]).intersection(a?new Ft(c,-1/0,m,1/0):new Ft(-1/0,d,1/0,g)):n.clipBBox=void 0})}updateScaleSelection(e){return e.scaleSelection.update(e.scaleData,void 0,t=>qh(e.scaleData.length,t.itemId))}updateScaleNodes(e){const{scaleSelection:t}=e,i=this.getShapeFillBBox();t.each((s,o)=>{const{topLeftCornerRadius:a,topRightCornerRadius:n,bottomRightCornerRadius:r,bottomLeftCornerRadius:l}=o;zn(s,o.style,i),s.setProperties(ws(s,o)),s.topLeftCornerRadius=a,s.topRightCornerRadius=n,s.bottomRightCornerRadius=r,s.bottomLeftCornerRadius=l,s.setProperties(ws(s,o))})}updateTargetSelection(e){return e.targetSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetNodes(e){const{targetSelection:t,isHighlight:i}=e;t.each((s,o)=>{const{x:a,y:n,shape:r,size:l,rotation:c}=o,p=this.getTargetStyle(i,o);zn(s,p),s.size=l,s.shape=r==="line"?Gh:r,s.translationX=a,s.translationY=n,s.rotation=c})}getTargetStyle(e,{datumIndex:t,style:i}){const s=this.getHighlightStyle(e,t);return AD(s,{...i,opacity:1})}updateTargetLabelSelection(e){return e.targetLabelSelection.update(e.targetData)}updateTargetLabelNodes(e){const{targetLabelSelection:t}=e;t.each((i,s)=>{const{x:o,y:a,text:n}=s,{offsetX:r,offsetY:l,fill:c,fontStyle:p,fontWeight:d,fontSize:u,fontFamily:m,textAlign:g,textBaseline:y}=s.label;i.visible=!0,i.x=o+r,i.y=a+l,i.text=n,i.fill=c,i.fontStyle=p,i.fontWeight=d,i.fontSize=u,i.fontFamily=m,i.textAlign=g,i.textBaseline=y})}updateTickSelection(e){return e.tickSelection.update(e.tickData,void 0,t=>t.tickId)}updateTickNodes(e){const{gaugeRect:t,properties:i}=this,s=i.defaultScale,{enabled:o,color:a,fontFamily:n=s.label.fontFamily,fontSize:r=s.label.fontSize,fontStyle:l,fontWeight:c=s.label.fontWeight,spacing:p}=i.scale.label;let{placement:d}=i.scale.label;const u=jh(i.scale.label.rotation??0);let m,g,y,f;this.horizontal?(d??(d="after"),m="center",g=d==="before"?"bottom":"top",f=this.originY+t.y+(d==="before"?-p:t.height+p)):(d??(d="before"),m=d==="before"?"end":"start",g="middle",y=this.originX+t.x+(d==="before"?-p:t.width+p)),e.tickSelection.each((S,x)=>{if(!o){S.visible=!1;return}const v=y??x.translation,b=f??x.translation;S.visible=!0,S.text=x.tickLabel,S.fill=a,S.fontFamily=n,S.fontSize=r,S.fontStyle=l,S.fontWeight=c,S.textBaseline=g,S.textAlign=m,S.x=v,S.y=b,S.rotationCenterX=v,S.rotationCenterY=b,S.rotation=u})}updateLabelSelection(e){return e.labelSelection.update(e.labelData,void 0,t=>"primary")}updateLabelNodes(e){const{labelSelection:t}=e,i=this.ctx.animationManager.isSkipped();t.each((s,o)=>{s.fill=o.fill,s.fontStyle=o.fontStyle,s.fontWeight=o.fontWeight,s.fontFamily=o.fontFamily}),(i||this.labelsHaveExplicitText())&&this.formatLabelText()}labelsHaveExplicitText(){for(const{datum:e}of this.labelSelection)if(e.text==null)return!1;return!0}formatLabelText(e){const{labelSelection:t,horizontal:i,scale:s,seriesRect:o,gaugeRect:a}=this,{x:n,y:r,width:l,height:c}=a,p=e?.label??this.properties.value;let d;if(i){const g=s.convert(p);d=new Ft(n,r,g-n,c)}else{const g=s.convert(p);d=new Ft(n,g,l,c-g)}const u={seriesRect:o,gaugeRect:a,barRect:d},{margin:m}=this.properties;uD(this,this.ctx,t,{padding:m,horizontal:i},u,e)}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),gD([this.datumSelection],ws),this.formatLabelText()}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}animateLabelText(e={}){const{animationManager:t}=this.ctx;let i=0,s=0;if(this.labelSelection.each((o,a)=>{o.opacity=1,i=o.previousDatum?.value??e.from??a.value,s=a.value}),!this.labelsHaveExplicitText())if(i===s)this.formatLabelText({label:s});else{const o=`${this.id}_labels`;t.animate({id:o,groupId:"label",from:{label:i},to:{label:s},phase:e.phase??"update",ease:kD.easeOut,onUpdate:a=>this.formatLabelText(a),onStop:()=>this.formatLabelText({label:s})})}}animateEmptyUpdateReady(){const{animationManager:e}=this.ctx,{node:t}=Yh(!0,this.horizontal);Wn(this.id,"node",e,[this.datumSelection],t,(i,s)=>s.itemId),Wn(this.id,"label",e,[this.labelSelection],Fh,()=>"primary"),this.animateLabelText({from:0,phase:"initial"})}animateWaitingUpdateReady(){const{animationManager:e}=this.ctx,{node:t}=Yh(!1,this.horizontal);Wn(this.id,"node",e,[this.datumSelection],t,(i,s)=>s.itemId),this.animateLabelText()}animateReadyResize(){this.resetAllAnimation()}getSeriesDomain(){return[0,1]}dataCount(){return Number.NaN}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}getLegendData(){return[]}getTooltipContent(e){const{id:t,properties:i}=this,{tooltip:s}=i;if(e==null)return;let o,a,n;if(e.type===0?(o=i.value,a=i.label.text,n=this.ctx.localeManager.t("ariaLabelGaugeValue")):({value:o,text:a}=i.targets[e.index],n=this.ctx.localeManager.t("ariaLabelGaugeTarget")),o!=null)return this.formatTooltipWithContext(s,{data:[{label:a,fallbackLabel:n,value:this.formatLabel(o)}]},{seriesId:t,title:void 0,datum:void 0,value:o})}pickNodeClosestDatum(e){return Kh(this,e)}pickFocus(e){return Wh(this,e)}getCaptionText(){return this.formatLabel(this.properties.value)}getCategoryValue(e){}datumIndexForCategoryValue(e){}hasItemStylers(){return this.properties.label.itemStyler!=null}};Uo.className="LinearGaugeSeries",Uo.type="linear-gauge";var TP={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"linear-gauge",moduleFactory:e=>new Uo(e),themeTemplate:{minWidth:200,minHeight:200,tooltip:{enabled:!1},series:{thickness:50,defaultColorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$interpolate:[{$palette:"secondDivergingColors"},5]},Ps.SAFE_RANGE2_OPERATION]},scale:{defaultFill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/2",Ps.SAFE_STROKE_FILL_OPERATION,{$palette:"hierarchyColors"}]},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{spacing:11}},bar:{strokeWidth:{$isUserOption:["./stroke",2,0]}},segmentation:{enabled:!1,interval:{},spacing:1},defaultTarget:{fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},size:10,shape:"triangle",placement:"after",spacing:5,label:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:5}},defaultScale:{label:{fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}}},label:{...Ps.LABEL_BOXING_DEFAULTS,enabled:!1,placement:"inside-start",fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},fontSize:{$rem:2},minimumFontSize:Ps.FONT_SIZE.SMALL,spacing:18,color:{$ref:"chartBackgroundColor"}},margin:4,tooltip:{range:{$path:["/tooltip/range",10]}}}}},Qh={type:"series",name:"linear-gauge",chartType:"standalone",enterprise:!0,options:Ps.linearGaugeSeriesOptionsDef,create:e=>new Uo(e)};import{_ModuleSupport as qo}from"ag-charts-community";import{_ModuleSupport as $n}from"ag-charts-community";var Es={zoom:{axes:"xy",anchorPointX:"pointer",anchorPointY:"pointer",buttons:{anchorPointX:"middle",anchorPointY:"middle"}},legend:{enabled:!1},gradientLegend:{enabled:!1,...$n.LEGEND_CONTAINER_THEME}};function Bt(e){const t=$n.deepClone(e);return $n.jsonWalk(t,i=>{typeof i=="object"&&"$palette"in i&&(i.$mapPalette=i.$palette,delete i.$palette)}),t}import{_ModuleSupport as ep}from"ag-charts-community";import{Logger as tp,cachedTextMeasurer as LD}from"ag-charts-core";import{_ModuleSupport as TD}from"ag-charts-community";var RD=1e-9;function ip(e,t,i,s){const[o,a]=e,[n,r]=t,l=n-o,c=r-a,p=l*l+c*c;let d,u;if(Math.abs(p)t){const p=(t-o)/l,d=[i+(n-i)*p,s+(r-s)*p],u=Math.atan2(r-s,n-i);return{point:d,angle:u}}o=c,i=n,s=r}}import{_ModuleSupport as PD}from"ag-charts-community";var{LonLatBBox:CD}=PD;function Mi(e,t){for(const i of e){const[s,o]=i;t=CD.extend(t,s,o,s,o)}return t}function OD(e){if(e.length===0)return;let t=0,i=0,s=0,[o,a]=e.at(-1);for(const[n,r]of e){const l=o*r-n*a;s+=l,t+=(o+n)*l,i+=(a+r)*l,o=n,a=r}return s*=3,[t/s,i/s]}function Jo(e,t,i){let s=!1,o=1/0;for(const a of e){let n=a.at(-1),[r,l]=n;for(const c of a){const[p,d]=c;d>i!=l>i&&t<(r-p)*(i-d)/(l-d)+p&&(s=!s),o=Math.min(o,ip(n,c,t,i)),n=c,r=p,l=d}}return(s?-1:1)*Math.sqrt(o)}var{Path:_D,ExtendedPath2D:wD,BBox:ED,SceneChangeDetection:FD,SceneObjectChangeDetection:BD,objectsEqual:GD}=TD,ts=class extends _D{constructor(){super(...arguments),this.projectedGeometry=void 0,this.renderMode=3,this.strokePath=new wD}computeBBox(){return(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1),this.bbox?.clone()}updatePath(){const{projectedGeometry:e}=this;this.strokePath.clear(),this.path.clear(),this.bbox=e==null?void 0:this.drawGeometry(e,void 0)}drawPath(e){super.drawPath(e),this.renderStroke(e,this.strokePath.getPath2D())}containsPoint(e,t){const{projectedGeometry:i}=this;return i==null||!this.getBBox().containsPoint(e,t)?!1:this.geometryDistance(i,e,t)<=0}distanceSquared(e,t){const{projectedGeometry:i}=this;if(i==null)return 1/0;const s=this.geometryDistance(i,e,t);return s>0?s*s:0}geometryDistance(e,t,i){const{renderMode:s,strokeWidth:o}=this,a=(s&1)!==0,n=(s&2)!==0,r=Math.max(o/2,1)+1;switch(e.type){case"GeometryCollection":return e.geometries.reduce((l,c)=>Math.min(l,this.geometryDistance(c,t,i)),1/0);case"MultiPolygon":return a?e.coordinates.reduce((l,c)=>Math.min(l,Math.max(Jo(c,t,i),0)),1/0):1/0;case"Polygon":return a?Math.max(Jo(e.coordinates,t,i),0):1/0;case"MultiLineString":return n?e.coordinates.reduce((l,c)=>Math.min(l,Math.max(sp(c,t,i)-r,0)),1/0):1/0;case"LineString":return n?Math.max(sp(e.coordinates,t,i)-r,0):1/0;case"MultiPoint":case"Point":default:return 1/0}}drawGeometry(e,t){const{renderMode:i,path:s,strokePath:o}=this,a=(i&1)!==0,n=(i&2)!==0;switch(e.type){case"GeometryCollection":for(const r of e.geometries)t=this.drawGeometry(r,t);break;case"MultiPolygon":if(a)for(const r of e.coordinates)t=this.drawPolygon(s,r,t);break;case"Polygon":a&&(t=this.drawPolygon(s,e.coordinates,t));break;case"LineString":n&&(t=this.drawLineString(o,e.coordinates,t,!1));break;case"MultiLineString":if(n)for(const r of e.coordinates)t=this.drawLineString(o,r,t,!1);break;case"Point":case"MultiPoint":break}return t}drawPolygon(e,t,i){if(t.length<1)return i;i=this.drawLineString(e,t[0],i,!0);for(let s=1;s0&&(t=Mi(i[0],t));break;case"Polygon":e.coordinates.length>0&&(t=Mi(e.coordinates[0],t));break;case"MultiLineString":for(const i of e.coordinates)t=Mi(i,t);break;case"LineString":t=Mi(e.coordinates,t);break;case"MultiPoint":for(const i of e.coordinates){const[s,o]=i;t=Xn.extend(t,s,o,s,o)}break;case"Point":{const[i,s]=e.coordinates;t=Xn.extend(t,i,s,i,s);break}}return t}function Zo(e){switch(e.type){case"GeometryCollection":{let t,i;for(const s of e.geometries){const o=Zo(s);if(o==null)continue;const a=Mi(o[0],void 0);if(a==null)continue;const n=Math.abs(a.lat1-a.lat0)*Math.abs(a.lon1-a.lon0);(t==null||n>t)&&(t=n,i=o)}return i}case"MultiPolygon":{let t,i;for(const s of e.coordinates){const o=Mi(s[0],void 0);if(o==null)continue;const a=Math.abs(o.lat1-o.lat0)*Math.abs(o.lon1-o.lon0);(t==null||a>t)&&(t=a,i=s)}return i}case"Polygon":return e.coordinates;case"MultiLineString":case"LineString":case"MultiPoint":case"Point":return}}function Qo(e){switch(e.type){case"GeometryCollection":{let t,i;for(const s of e.geometries){const o=Qo(s);if(o==null)continue;const a=Hn(o);a!=null&&(t==null||a>t)&&(t=a,i=o)}return i}case"MultiLineString":{let t=0,i;for(const s of e.coordinates){const o=Hn(s);o>t&&(t=o,i=s)}return i}case"LineString":return e.coordinates;case"MultiPolygon":case"Polygon":case"MultiPoint":case"Point":return}}function Yn(e,t){if(e==null)return!1;switch(e.type){case"GeometryCollection":return e.geometries.some(i=>Yn(i,t));case"MultiPolygon":case"Polygon":return(t&1)!==0;case"MultiLineString":case"LineString":return(t&2)!==0;case"MultiPoint":case"Point":return(t&4)!==0}}function si(e,t){switch(e.type){case"GeometryCollection":return{type:"GeometryCollection",geometries:e.geometries.map(i=>si(i,t))};case"Polygon":return{type:"Polygon",coordinates:Un(e.coordinates,t)};case"MultiPolygon":return{type:"MultiPolygon",coordinates:KD(e.coordinates,t)};case"MultiLineString":return{type:"MultiLineString",coordinates:Un(e.coordinates,t)};case"LineString":return{type:"LineString",coordinates:qn(e.coordinates,t)};case"MultiPoint":return{type:"MultiPoint",coordinates:qn(e.coordinates,t)};case"Point":return{type:"Point",coordinates:t.convert(e.coordinates)}}}function KD(e,t){return e.map(i=>Un(i,t))}function Un(e,t){return e.map(i=>qn(i,t))}function qn(e,t){return e.map(i=>t.convert(i))}function WD(){return{fromFn:(i,s,o)=>o==="removed"?{scalingX:1,scalingY:1}:i.previousDatum==null?{scalingX:0,scalingY:0}:{scalingX:i.scalingX,scalingY:i.scalingY},toFn:(i,s,o)=>o==="removed"?{scalingX:0,scalingY:0}:{scalingX:1,scalingY:1}}}function op(e,t){const i=e.contextNodeData?.nodeData[t.datumIndex];if(i!==void 0){for(const s of e.datumSelection.nodes())if(s.datum===i)return s}}import{_ModuleSupport as ap}from"ag-charts-community";var BP=class extends ap.SeriesProperties{},Fs=class extends ap.DataModelSeries{addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",e=>{this.onLegendItemClick(e)}),this.ctx.eventsHub.on("legend:item-double-click",e=>{this.onLegendItemDoubleClick(e)}))}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}};import{_ModuleSupport as zD}from"ag-charts-community";var{Property:be,SeriesProperties:$D,makeSeriesTooltip:HD,Label:XD}=zD,xe=class extends $D{constructor(){super(...arguments),this.topology=void 0,this.idKey="",this.topologyIdKey="name",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.maxStrokeWidth=void 0,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.label=new XD,this.tooltip=HD()}getStyle(){const{stroke:e,strokeOpacity:t,strokeWidth:i,lineDash:s,lineDashOffset:o}=this;return{stroke:e,strokeOpacity:t,strokeWidth:i,lineDash:s,lineDashOffset:o}}};h([be],xe.prototype,"topology",2),h([be],xe.prototype,"title",2),h([be],xe.prototype,"legendItemName",2),h([be],xe.prototype,"idKey",2),h([be],xe.prototype,"topologyIdKey",2),h([be],xe.prototype,"idName",2),h([be],xe.prototype,"labelKey",2),h([be],xe.prototype,"labelName",2),h([be],xe.prototype,"sizeKey",2),h([be],xe.prototype,"sizeName",2),h([be],xe.prototype,"colorKey",2),h([be],xe.prototype,"colorName",2),h([be],xe.prototype,"sizeDomain",2),h([be],xe.prototype,"colorRange",2),h([be],xe.prototype,"maxStrokeWidth",2),h([be],xe.prototype,"stroke",2),h([be],xe.prototype,"strokeOpacity",2),h([be],xe.prototype,"strokeWidth",2),h([be],xe.prototype,"lineDash",2),h([be],xe.prototype,"lineDashOffset",2),h([be],xe.prototype,"itemStyler",2),h([be],xe.prototype,"label",2),h([be],xe.prototype,"tooltip",2);var{getMissCount:YD,getLabelStyles:UD,createDatumId:np,SeriesNodePickMode:rp,valueProperty:Bs,ColorScale:qD,LinearScale:jD,Selection:jn,Text:JD,Transformable:ZD,mergeDefaults:lp}=ep,ea=class extends Fs{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{size:["colorKey"],color:["colorKey"],label:["labelKey"]},propertyNames:{size:["sizeName"],color:["colorName"],label:["labelName"]},pickModes:[rp.EXACT_SHAPE_MATCH,rp.NEAREST_NODE],usesPlacedLabels:!0}),this.properties=new xe,this._chartTopology=void 0,this.colorScale=new qD,this.sizeScale=new jD,this.datumSelection=jn.select(this.contentGroup,()=>this.nodeFactory()),this.labelSelection=jn.select(this.labelGroup,JD),this.highlightDatumSelection=jn.select(this.highlightGroup,()=>this.nodeFactory()),this._previousDatumMidPoint=void 0}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){return super.hasData&&this.topology!=null}renderToOffscreenCanvas(){return!0}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[1,e],this.highlightGroup.zIndex=[2,e],!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}nodeFactory(){const e=new ts;return e.renderMode=2,e.lineJoin="round",e.lineCap="round",e}async processData(e){if(this.data==null)return;const{data:t,topology:i,sizeScale:s,colorScale:o}=this,{topologyIdKey:a,idKey:n,sizeKey:r,colorKey:l,labelKey:c,sizeDomain:p,colorRange:d}=this.properties,u=new Map;for(const v of i?.features.values()??[]){const b=v.properties?.[a];b==null||!Yn(v.geometry,2)||u.set(b,v)}const m=this.sizeScale.type,g=this.colorScale.type,y=this.scale?.type,{dataModel:f,processedData:S}=await this.requestDataModel(e,t,{props:[Bs(n,y,{id:"idValue",includeProperty:!1}),Bs(n,y,{id:"featureValue",includeProperty:!1,processor:()=>v=>u.get(v)}),...c==null?[]:[Bs(c,"category",{id:"labelValue"})],...r==null?[]:[Bs(r,m,{id:"sizeValue"})],...l==null?[]:[Bs(l,g,{id:"colorValue"})]]}),x=f.resolveColumnById(this,"featureValue",S);if(this.topologyBounds=x.reduce((v,b)=>{const k=b?.geometry;return k==null?v:is(k,v)},void 0),r!=null){const v=f.resolveProcessedDataIndexById(this,"sizeValue"),b=S.domain.values[v]??[];s.domain=p??b}if(d!=null&&this.isColorScaleValid()){const v=f.resolveProcessedDataIndexById(this,"colorValue");o.domain=S.domain.values[v],o.range=d,o.update()}i==null&&tp.warnOnce("no topology was provided for [MapLineSeries]; nothing will be rendered.")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),o=i.input.count,a=YD(this,i.defs.values[s].missing);return!(o===0||o===a)}getLabelDatum(e,t,i,s){if(t==null||i==null)return;const o=Qo(i);if(o==null)return;const{idKey:a,idName:n,sizeKey:r,sizeName:l,colorKey:c,colorName:p,labelKey:d,labelName:u,label:m}=this.properties;if(d==null||!m.enabled)return;const g=this.getLabelText(t,e,d,"label",[],m,{value:t,datum:e,idKey:a,idName:n,sizeKey:r,sizeName:l,colorKey:c,colorName:p,labelKey:d,labelName:u});if(g==null)return;const y=s.measureLines(String(g)),f=jo(o);if(f==null)return;const[S,x]=f.point,{width:v,height:b}=y;return{point:{x:S,y:x,size:0},label:{width:v,height:b,text:g},anchor:void 0,placement:void 0}}createNodeData(){const{id:e,dataModel:t,processedData:i,sizeScale:s,properties:o,scale:a}=this,{idKey:n,sizeKey:r,colorKey:l,labelKey:c,label:p,legendItemName:d}=o;if(t==null||i==null)return;const u=t.resolveColumnById(this,"idValue",i),m=t.resolveColumnById(this,"featureValue",i),g=c==null?void 0:t.resolveColumnById(this,"labelValue",i),y=r==null?void 0:t.resolveColumnById(this,"sizeValue",i),f=l==null?void 0:t.resolveColumnById(this,"colorValue",i),S=o.maxStrokeWidth??o.strokeWidth;s.range=[Math.min(o.strokeWidth,S),S];const x=LD(p),v=new Map;for(const[N]of i.dataSources.get(this.id)?.data.entries()??[]){const R=u[N],C=m[N]?.geometry??void 0,w=C!=null&&a!=null?si(C,a):void 0;R!=null&&w!=null&&v.set(R,w)}const b=[],k=[],A=[],I=i.dataSources.get(this.id)?.data??[];for(const[N,R]of I.entries()){const C=u[N],w=f?.[N],G=y?.[N],_=g?.[N],E=v.get(C);E==null&&A.push(C);const L=this.getLabelDatum(R,_,E,x);L!=null&&k.push(L),b.push({series:this,itemId:n,datum:R,datumIndex:N,idValue:C,labelValue:_,colorValue:w,sizeValue:G,projectedGeometry:E,legendItemName:d,style:this.getItemStyle({datumIndex:N,datum:R,colorValue:w,sizeValue:G},!1)})}const D=10;if(A.length>D){const N=A.length-D;A.length=D,A.push(`(+${N} more)`)}return A.length>0&&tp.warnOnce("some data items do not have matches in the provided topology",A),{itemId:e,nodeData:b,labelData:k}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e,highlightDatumSelection:t}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let i=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:s}=this.properties,o=s!=null&&i?.datum==null&&s===i?.legendItemName;i!=null&&(i.series!==this&&!o||i.datum==null)&&(i=void 0);const a=this.contextNodeData?.nodeData??[];this.datumSelection=this.updateDatumSelection({nodeData:a,datumSelection:e}),this.updateDatumStyles({datumSelection:e,isHighlight:!1}),this.updateDatumNodes({datumSelection:e,isHighlight:!1}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:i==null?[]:[i],datumSelection:t}),this.updateDatumStyles({datumSelection:t,isHighlight:!0}),this.updateDatumNodes({datumSelection:t,isHighlight:!0})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>np(t.idValue))}getItemStyle({datumIndex:e=0,datum:t,colorValue:i,sizeValue:s},o){const{properties:a,colorScale:n,sizeScale:r}=this,{colorRange:l,itemStyler:c}=a,p=this.getHighlightStyle(o,e),d=lp(p,a.getStyle());!o&&i!=null&&(d.stroke=this.isColorScaleValid()?n.convert(i):l?.[0]??a.stroke),s!=null&&(d.strokeWidth=r.convert(s,{clamp:!0}));let u;return c!=null&&(u=this.cachedDatumCallback(np(e,o?"highlight":"node"),()=>{const m=this.makeItemStylerParams(t,e,o,d);return this.callWithContext(c,m)})),u?lp(d,u):d}makeItemStylerParams(e,t,i,s){const{id:o}=this,a=this.ctx.highlightManager?.getActiveHighlight(),n=this.getHighlightStateString(a,i,t);return{seriesId:o,datum:e,highlighted:i,highlightState:n,...s}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){e.each((t,i)=>{const{projectedGeometry:s,style:o}=i;if(s==null){t.visible=!1,t.projectedGeometry=void 0;return}t.visible=!0,t.projectedGeometry=s,t.setProperties(o)})}updatePlacedLabelData(e){this.labelSelection=this.labelSelection.update(e,t=>{t.pointerEvents=ep.PointerEvents.None}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{x:o,y:a,width:n,height:r,text:l},c)=>{const p=UD(this,void 0,t,t.label,!1,i),{color:d,fontStyle:u,fontWeight:m,fontSize:g,fontFamily:y}=p;s.visible=!0,s.x=o+n/2,s.y=a+r/2,s.text=l,s.fill=d,s.fontStyle=u,s.fontWeight=m,s.fontSize=g,s.fontFamily=y,s.textAlign="center",s.textBaseline="middle",s.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,s.setBoxing(p)})}resetAnimation(){}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.datumSelection.each((o,a)=>{const n=o.distanceSquared(e,t);nnew ea(e),themeTemplate:{...Es,series:{stroke:Bt(qo.SAFE_STROKE_FILL_OPERATION),colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},Bt(qo.SAFE_RANGE2_OPERATION)]},strokeWidth:1,maxStrokeWidth:3,lineDash:[0],lineDashOffset:0,label:{...qo.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:Bt(qo.multiSeriesHighlightStyle(!1))},tooltip:{range:"exact"}}},pp={type:"series",name:"map-line",chartType:"topology",enterprise:!0,options:hp,create:e=>new ea(e)};import{_ModuleSupport as h0}from"ag-charts-community";import{Logger as p0}from"ag-charts-core";import{_ModuleSupport as d0}from"ag-charts-community";var{Property:Ni,SeriesProperties:u0,makeSeriesTooltip:g0}=d0,oi=class extends u0{constructor(){super(...arguments),this.topology=void 0,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.tooltip=g0()}};h([Ni],oi.prototype,"topology",2),h([Ni],oi.prototype,"stroke",2),h([Ni],oi.prototype,"strokeOpacity",2),h([Ni],oi.prototype,"strokeWidth",2),h([Ni],oi.prototype,"lineDash",2),h([Ni],oi.prototype,"lineDashOffset",2),h([Ni],oi.prototype,"tooltip",2);var{createDatumId:m0,Group:y0,Selection:f0,PointerEvents:dp}=h0,ta=class extends Fs{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[]}),this.properties=new oi,this._chartTopology=void 0,this.itemGroup=this.contentGroup.appendChild(new y0({name:"itemGroup"})),this.datumSelection=f0.select(this.itemGroup,()=>this.nodeFactory()),this.itemGroup.pointerEvents=dp.None}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get focusable(){return!1}setOptionsData(){}setChartData(){}get hasData(){return!1}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,e,0],this.highlightGroup.zIndex=[0,e,1],!0}nodeFactory(){const e=new ts;return e.renderMode=2,e.lineJoin="round",e.lineCap="round",e.pointerEvents=dp.None,e}processData(){const{topology:e}=this;this.topologyBounds=e?.features.reduce((t,i)=>{const s=i.geometry;return s==null?t:is(s,t)},void 0),e==null&&p0.warnOnce("no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.")}createNodeData(){const{id:e,topology:t,scale:i,properties:s}=this;if(t==null)return;const{stroke:o,strokeOpacity:a,lineDash:n,lineDashOffset:r,strokeWidth:l}=s,c=[],p=[];for(const[d,u]of t.features.entries()){const{geometry:m}=u,g=m!=null&&i!=null?si(m,i):void 0;g!=null&&c.push({series:this,itemId:d,datum:u,datumIndex:0,index:d,projectedGeometry:g,style:{stroke:o,strokeOpacity:a,lineDash:n,lineDashOffset:r,strokeWidth:l}})}return{itemId:e,nodeData:c,labelData:p}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;const{nodeData:t=[]}=this.contextNodeData??{};this.datumSelection=this.updateDatumSelection({nodeData:t,datumSelection:e}),this.updateDatumNodes({datumSelection:e})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>m0(t.index))}updateDatumNodes(e){const{datumSelection:t}=e;t.each((i,s)=>{const{projectedGeometry:o}=s;if(o==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=o,i.setProperties(s.style)})}resetAnimation(){}getLegendData(){return[]}getTooltipContent(e){}computeFocusBounds(e){}hasItemStylers(){return!1}};ta.className="MapLineBackgroundSeries",ta.type="map-line-background";import{_ModuleSupport as S0}from"ag-charts-community";import{constant as x0,geoJson as b0,required as v0}from"ag-charts-core";var{mapLineBackgroundSeriesThemeableOptionsDef:k0}=S0,D0={...k0,type:v0(x0("map-line-background")),topology:b0},UP={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-line-background",moduleFactory:e=>new ta(e),themeTemplate:{...Es,series:{stroke:{$path:["/1",{$mapPalette:"stroke"},{$mapPalette:"secondHierarchyColors"}]},strokeWidth:1,lineDash:[0],lineDashOffset:0}}},up={type:"series",name:"map-line-background",chartType:"topology",enterprise:!0,options:D0,create:e=>new ta(e)};import{_ModuleSupport as ss}from"ag-charts-community";import{ValidationError as I0,validate as A0}from"ag-charts-core";import{_ModuleSupport as gp}from"ag-charts-community";import{Logger as M0,cachedTextMeasurer as N0}from"ag-charts-core";var L0=void 0,T0=void 0;T0=L0;var R0=void 0,P0=void 0;P0=R0;var C0=void 0,O0=void 0;O0=C0;var _0=void 0,w0=void 0;w0=_0;import{insertListItemsSorted as E0}from"ag-charts-core";function mp(e,t,i){const s=Mi(e[0],void 0);if(s==null)return;const o=(s.lon0+s.lon1)/2,a=(s.lat0+s.lat1)/2,n=Math.abs(s.lon1-s.lon0),r=Math.abs(s.lat1-s.lat0),l=OD(e[0]),[c,p]=l,d=-Jo(e,c,p);let u;const m=(k,A)=>{const D=Math.max(A-d,0);return k-.5*D},g=(k,A,I)=>{const{distance:D,maxDistance:N}=i(e,k,A,I),R=Math.hypot(c-k,p-A),C=Math.min(Math.max(c,k-I/2),k+I/2),w=Math.min(Math.max(p,A-I/2),A+I/2),G=Math.hypot(c-C,p-w),_=m(D,R),E=m(N,G);return{distance:D,maxDistance:N,value:_,maxValue:E,x:k,y:A,stride:I}},y=(k,A,I,D)=>{const N=g(A,I,D);N.maxDistance>=0&&k.push(N)},f=Math.min(n,r)/2;let S={value:g(o,a,f),next:null};for(;S!=null;){const k=S.value,{distance:A,value:I,maxValue:D,x:N,y:R,stride:C}=k;if(S=S.next,A>0&&(u==null||I>u.value)&&(u=k),u!=null&&D-u.value<=t)continue;const w=C/2,G=[];y(G,N-w,R-w,w),y(G,N+w,R-w,w),y(G,N-w,R+w,w),y(G,N+w,R+w,w),G.sort(yp),S=E0(S,G,yp)}if(u==null)return;const{distance:x,x:v,y:b}=u;return{x:v,y:b,distance:x}}var yp=(e,t)=>t.maxValue-e.maxValue;function Jn(e,t){const i=mp(e,t,(a,n,r,l)=>{const c=-Jo(a,n,r),p=c+l*Math.SQRT2;return{distance:c,maxDistance:p}});if(i==null)return;const{x:s,y:o}=i;return[s,o]}function fp(e,t){let i;switch(e.type){case"GeometryCollection":return e.geometries.flatMap(s=>fp(s,t));case"MultiPoint":return e.coordinates;case"Point":return[e.coordinates];case"MultiPolygon":{const s=Zo(e);i=s==null?void 0:Jn(s,t);break}case"Polygon":{const s=e.coordinates;i=s==null?void 0:Jn(s,t);break}case"MultiLineString":{const s=Qo(e);i=s==null?void 0:jo(s)?.point;break}case"LineString":{const s=e.coordinates;i=jo(s)?.point;break}}return i==null?[]:[i]}import{_ModuleSupport as F0}from"ag-charts-community";var{BBox:B0}=F0;function Sp(e){if(!e)return;const{range:t}=e,i=t[0][0],s=t[0][1],o=t[1][0]-i,a=t[1][1]-s,n=new B0(i,s,o,a);return{series:n,axis:n}}import{_ModuleSupport as G0}from"ag-charts-community";var{Property:pe,SeriesProperties:V0,makeSeriesTooltip:K0,Label:W0}=G0,xp=class extends W0{constructor(){super(...arguments),this.placement="bottom"}};h([pe],xp.prototype,"placement",2);var de=class extends V0{constructor(){super(...arguments),this.topology=void 0,this.idKey=void 0,this.topologyIdKey="name",this.idName=void 0,this.latitudeKey=void 0,this.latitudeName=void 0,this.longitudeKey=void 0,this.longitudeName=void 0,this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.shape="circle",this.size=6,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.label=new xp,this.tooltip=K0()}getStyle(){const{size:e,shape:t,fill:i,fillOpacity:s,stroke:o,strokeWidth:a,strokeOpacity:n,lineDash:r,lineDashOffset:l}=this;return{size:e,shape:t,fill:i,fillOpacity:s,opacity:1,stroke:o,strokeWidth:a,strokeOpacity:n,lineDash:r,lineDashOffset:l}}};h([pe],de.prototype,"topology",2),h([pe],de.prototype,"title",2),h([pe],de.prototype,"legendItemName",2),h([pe],de.prototype,"idKey",2),h([pe],de.prototype,"topologyIdKey",2),h([pe],de.prototype,"idName",2),h([pe],de.prototype,"latitudeKey",2),h([pe],de.prototype,"latitudeName",2),h([pe],de.prototype,"longitudeKey",2),h([pe],de.prototype,"longitudeName",2),h([pe],de.prototype,"labelKey",2),h([pe],de.prototype,"labelName",2),h([pe],de.prototype,"sizeKey",2),h([pe],de.prototype,"sizeName",2),h([pe],de.prototype,"colorKey",2),h([pe],de.prototype,"colorName",2),h([pe],de.prototype,"colorRange",2),h([pe],de.prototype,"shape",2),h([pe],de.prototype,"size",2),h([pe],de.prototype,"maxSize",2),h([pe],de.prototype,"sizeDomain",2),h([pe],de.prototype,"fill",2),h([pe],de.prototype,"fillOpacity",2),h([pe],de.prototype,"stroke",2),h([pe],de.prototype,"strokeWidth",2),h([pe],de.prototype,"strokeOpacity",2),h([pe],de.prototype,"lineDash",2),h([pe],de.prototype,"lineDashOffset",2),h([pe],de.prototype,"itemStyler",2),h([pe],de.prototype,"label",2),h([pe],de.prototype,"tooltip",2);var{fromToMotion:z0,StateMachine:$0,getMissCount:H0,createDatumId:bp,SeriesNodePickMode:vp,valueProperty:Li,computeMarkerFocusBounds:X0,ColorScale:Y0,LinearScale:U0,Group:q0,Selection:Zn,Text:j0,Marker:Qn,applyShapeStyle:J0,getLabelStyles:Z0,LonLatBBox:Q0,mergeDefaults:kp}=gp,ia=class extends Fs{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{size:["colorKey"],color:["colorKey"],label:["labelKey"]},propertyNames:{size:["sizeName"],color:["colorName"],label:["labelName"]},pickModes:[vp.EXACT_SHAPE_MATCH,vp.NEAREST_NODE],usesPlacedLabels:!0}),this.properties=new de,this._chartTopology=void 0,this.colorScale=new Y0,this.sizeScale=new U0,this.markerGroup=this.contentGroup.appendChild(new q0({name:"markerGroup"})),this.labelSelection=Zn.select(this.labelGroup,j0,!1),this.markerSelection=Zn.select(this.markerGroup,Qn,!1),this.highlightMarkerSelection=Zn.select(this.highlightGroup,Qn),this.animationState=new $0("empty",{empty:{update:{target:"ready",action:()=>this.animateMarkers()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.resetAllAnimation(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateMarkers()},resize:{target:"ready",action:()=>this.resetAllAnimation()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty",action:()=>this.resetAllAnimation()},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){const e=this.properties.latitudeKey!=null&&this.properties.longitudeKey!=null;return super.hasData&&(this.topology!=null||e)}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[3,e],this.highlightGroup.zIndex=[4,e],!0}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}async processData(e){if(this.data==null)return;const{data:t,topology:i,sizeScale:s,colorScale:o}=this,{topologyIdKey:a,idKey:n,latitudeKey:r,longitudeKey:l,sizeKey:c,colorKey:p,labelKey:d,sizeDomain:u,colorRange:m}=this.properties,g=new Map;for(const D of i?.features.values()??[]){const N=D.properties?.[a];N!=null&&g.set(N,D)}const y=this.sizeScale.type,f=this.colorScale.type,S=this.scale?.type,x=r!=null&&l!=null,{dataModel:v,processedData:b}=await this.requestDataModel(e,t,{props:[...n==null?[]:[Li(n,S,{id:"idValue",includeProperty:!1}),Li(n,S,{id:"featureValue",includeProperty:!1,processor:()=>D=>g.get(D)})],...x?[Li(r,S,{id:"latValue"}),Li(l,S,{id:"lonValue"})]:[],...d?[Li(d,"category",{id:"labelValue"})]:[],...c?[Li(c,y,{id:"sizeValue"})]:[],...p?[Li(p,f,{id:"colorValue"})]:[]]}),k=n==null?void 0:v.resolveColumnById(this,"featureValue",b),A=x?v.resolveColumnById(this,"latValue",b):void 0,I=x?v.resolveColumnById(this,"lonValue",b):void 0;if(this.topologyBounds=b.dataSources.get(this.id)?.data.reduce((D,N,R)=>{const w=k?.[R]?.geometry;if(w!=null&&(D=is(w,D)),A!=null&&I!=null){const G=I[R],_=A[R];D=Q0.extend(D,G,_,G,_)}return D},void 0),c!=null){const D=v.resolveProcessedDataIndexById(this,"sizeValue"),N=b.domain.values[D]??[];s.domain=u??N}if(m!=null&&this.isColorScaleValid()){const D=v.resolveProcessedDataIndexById(this,"colorValue");o.domain=b.domain.values[D],o.range=m,o.update()}this.animationState.transition("updateData")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),o=i.input.count,a=H0(this,i.defs.values[s].missing);return!(o===0||o===a)}getLabelDatum(e,t,i,s,o,a){if(t==null)return;const{idKey:n,idName:r,latitudeKey:l,latitudeName:c,longitudeKey:p,longitudeName:d,sizeKey:u,sizeName:m,colorKey:g,colorName:y,labelKey:f,labelName:S,label:x,shape:v}=this.properties;if(f==null||!x.enabled)return;const{placement:b}=x,k=this.getLabelText(t,e,f,"label",[],x,{value:t,datum:e,idKey:n,idName:r,latitudeKey:l,latitudeName:c,longitudeKey:p,longitudeName:d,sizeKey:u,sizeName:m,colorKey:g,colorName:y,labelKey:f,labelName:S});if(k==null)return;const{width:A,height:I}=a.measureLines(String(k)),D=Qn.anchor(v);return{point:{x:i,y:s,size:o},label:{width:A,height:I,text:k},anchor:D,placement:b}}createNodeData(){const{id:e,dataModel:t,processedData:i,sizeScale:s,properties:o,scale:a}=this,{idKey:n,latitudeKey:r,longitudeKey:l,sizeKey:c,colorKey:p,labelKey:d,label:u,legendItemName:m}=o;if(t==null||i==null||a==null)return;const g=r!=null&&l!=null,y=n==null?void 0:t.resolveColumnById(this,"idValue",i),f=n==null?void 0:t.resolveColumnById(this,"featureValue",i),S=g?t.resolveColumnById(this,"latValue",i):void 0,x=g?t.resolveColumnById(this,"lonValue",i):void 0,v=d==null?void 0:t.resolveColumnById(this,"labelValue",i),b=c==null?void 0:t.resolveColumnById(this,"sizeValue",i),k=p==null?void 0:t.resolveColumnById(this,"colorValue",i),A=o.maxSize??o.size;s.range=[Math.min(o.size,A),A];const I=N0(u);let D;if(y!=null&&f!=null){D=new Map;for(const[_]of i.dataSources.get(this.id)?.data.entries()??[]){const E=y[_],L=f[_]?.geometry??void 0,P=L!=null&&a!=null?si(L,a):void 0;E!=null&&P!=null&&D.set(E,P)}}const N=[],R=[],C=[],w=i.dataSources.get(this.id)?.data??[];for(const[_,E]of w.entries()){const L=y?.[_],P=x?.[_],T=S?.[_],M=k?.[_],O=b?.[_],B=v?.[_],F=O==null?o.size:s.convert(O,{clamp:!0}),V=L==null?void 0:D?.get(L);if(L!=null&&si==null&&C.push(L),P!=null&&T!=null){const[W,K]=a.convert([P,T]),z=this.getLabelDatum(E,B,W,K,F,I);z&&R.push(z),N.push({series:this,itemId:r,datum:E,datumIndex:_,index:-1,idValue:L,lonValue:P,latValue:T,labelValue:B,sizeValue:O,colorValue:M,point:{x:W,y:K,size:F},midPoint:{x:W,y:K},legendItemName:m,style:this.getMarkerItemStyle({datumIndex:_,datum:E,colorValue:M,sizeValue:O},!1)})}else if(V!=null)for(const[W,[K,z]]of fp(V,1).entries()){const $=this.getLabelDatum(E,B,K,z,F,I);$&&R.push($),N.push({series:this,itemId:r,datum:E,datumIndex:_,index:W,idValue:L,lonValue:P,latValue:T,labelValue:B,sizeValue:O,colorValue:M,point:{x:K,y:z,size:F},midPoint:{x:K,y:z},legendItemName:m,style:this.getMarkerItemStyle({datumIndex:_,datum:E,colorValue:M,sizeValue:O},!1)})}}const G=10;if(C.length>G){const _=C.length-G;C.length=G,C.push(`(+${_} more)`)}return C.length>0&&M0.warnOnce("some data items do not have matches in the provided topology",C),{itemId:e,nodeData:N,labelData:R}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}checkScaleChange(){return this.previousScale===this.scale?!1:(this.previousScale=this.scale,!0)}update({seriesRect:e}){const t=this.checkResize(e),i=this.checkScaleChange(),{markerSelection:s,highlightMarkerSelection:o}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let a=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:n}=this.properties,r=n!=null&&a?.datum==null&&n===a?.legendItemName;a!=null&&(a.series!==this&&!r||a.datum==null)&&(a=void 0);const l=this.contextNodeData?.nodeData??[];this.markerSelection=this.updateMarkerSelection({markerData:l,markerSelection:s}),this.updateMarkerNodes({markerSelection:s,isHighlight:!1,highlightedDatum:a}),this.highlightMarkerSelection=this.updateMarkerSelection({markerData:a==null?[]:[a],markerSelection:o}),this.updateMarkerNodes({markerSelection:o,isHighlight:!0,highlightedDatum:a}),(i||t)&&this.animationState.transition("resize"),this.animationState.transition("update")}updatePlacedLabelData(e){this.labelSelection=this.labelSelection.update(e,t=>{t.pointerEvents=gp.PointerEvents.None}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{x:o,y:a,width:n,height:r,text:l},c)=>{const p=Z0(this,void 0,t,t.label,!1,i),{color:d,fontStyle:u,fontWeight:m,fontSize:g,fontFamily:y}=p;s.visible=!0,s.x=o+n/2,s.y=a+r/2,s.text=l,s.fill=d,s.fontStyle=u,s.fontWeight=m,s.fontSize=g,s.fontFamily=y,s.textAlign="center",s.textBaseline="middle",s.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,s.setBoxing(p)})}updateMarkerSelection(e){const{markerData:t,markerSelection:i}=e;return i.update(t,void 0,s=>bp(s.index,s.idValue,s.lonValue,s.latValue))}getMarkerItemStyle({datumIndex:e,datum:t,colorValue:i,sizeValue:s},o){const{properties:a,colorScale:n,sizeScale:r}=this,{colorRange:l,itemStyler:c}=a,p=this.getHighlightStyle(o,e),d=kp(p,a.getStyle());!o&&i!=null&&(d.fill=this.isColorScaleValid()?n.convert(i):l?.[0]??d.fill),s!=null&&(d.size=r.convert(s,{clamp:!0}));let u=d;if(c!=null&&e!=null){const m=this.cachedDatumCallback(bp(e,o?"highlight":"node"),()=>{const g=this.makeItemStylerParams(t,e,o,u);return this.callWithContext(c,g)});m&&(u=kp(m,d))}return u}makeItemStylerParams(e,t,i,s){const{id:o}=this,a=this.ctx.highlightManager?.getActiveHighlight(),n=this.getHighlightStateString(a,i,t),r=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:o,datum:e,highlighted:i,highlightState:n,...s,fill:r}}updateMarkerNodes(e){const{markerSelection:t,isHighlight:i,highlightedDatum:s}=e,o=Sp(this.scale);t.each((a,n)=>{const{datum:r,point:l}=n,c=this.getMarkerItemStyle(n,i);a.shape=c.shape,a.size=c.size,J0(a,c,o),a.x=l.x,a.y=l.y,a.scalingCenterX=l.x,a.scalingCenterY=l.y,a.zIndex=!i&&s!=null&&r===s.datum?1:0})}isProcessedDataAnimatable(){return!0}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),this.ctx.animationManager.skipCurrentBatch(),this.labelSelection.cleanup(),this.markerSelection.cleanup(),this.highlightMarkerSelection.cleanup()}animateMarkers(){const{animationManager:e}=this.ctx,t=WD();z0(this.id,"markers",e,[this.markerSelection,this.highlightMarkerSelection],t)}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}pickNodeClosestDatum(e){const{x:t,y:i}=e;let s=1/0,o;for(const a of this.contextNodeData?.nodeData??[]){const{x:n,y:r,size:l}=a.point,c=Math.max(Math.abs(n-t)-l,0),p=Math.max(Math.abs(r-i)-l,0),d=c*c+p*p;d=0?"N":"S"}, ${Math.abs(w).toFixed(4)}\xB0 ${w>=0?"W":"E"}`}const R=this.getMarkerItemStyle({datumIndex:e,datum:k,colorValue:I,sizeValue:A},!1);return this.formatTooltipWithContext(b,{heading:N,title:x??v,symbol:this.legendItemSymbol(e),data:D},{seriesId:t,datum:k,title:x,idKey:n,idName:r,latitudeKey:l,latitudeName:c,longitudeKey:p,longitudeName:d,colorKey:u,colorName:m,sizeKey:g,sizeName:y,labelKey:f,labelName:S,...R})}getFormattedMarkerStyle(e){const t=this.getMarkerItemStyle(e,!1);return{size:t.size,shape:t.shape}}computeFocusBounds(e){return X0(this,e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};ia.className="MapMarkerSeries",ia.type="map-marker";import{_ModuleSupport as eI}from"ag-charts-community";import{constant as tI,geoJson as iI,required as sI,string as it}from"ag-charts-core";var{commonSeriesOptionsDefs:oI,mapMarkerSeriesThemeableOptionsDef:aI,without:nI}=eI,rI={...nI(oI,["highlightStyle","highlight"]),...aI,type:sI(tI("map-marker")),idKey:it,latitudeKey:it,longitudeKey:it,sizeKey:it,colorKey:it,labelKey:it,idName:it,latitudeName:it,longitudeName:it,sizeName:it,colorName:it,labelName:it,topology:iI,topologyIdKey:it,legendItemName:it,title:it},oC={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-marker",moduleFactory:e=>new ia(e),themeTemplate:{...Es,series:{shape:"circle",maxSize:30,fill:Bt({$applySwitch:[{$path:"type"},{$mapPalette:"fill"},["gradient",ss.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",ss.FILL_IMAGE_DEFAULTS],["pattern",ss.FILL_PATTERN_DEFAULTS]]}),stroke:{$mapPalette:"stroke"},colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},Bt(ss.SAFE_RANGE2_OPERATION)]},fillOpacity:.5,label:{...ss.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:Bt(ss.multiSeriesHighlightStyle())},tooltip:{range:"exact"}}},Dp={type:"series",name:"map-marker",chartType:"topology",enterprise:!0,options:rI,create:e=>new ia(e),validate(e,t,i){const s=A0(e,t,i),{cleared:o,invalid:a}=s;if(o?.idKey==null&&(o?.latitudeKey==null||o?.longitudeKey==null)){const n=l=>i?`${i}.${l}`:l,r=`Either \`${n("idKey")}\` or both \`${n("latitudeKey")}\` and \`${n("longitudeKey")}\` are required.`;a.push(new I0("required",r,null,i))}return s}};import{_ModuleSupport as os}from"ag-charts-community";import{_ModuleSupport as Ip}from"ag-charts-community";import{Logger as Ap,cachedTextMeasurer as lI,isArray as cI,measureTextSegments as hI,toPlainText as pI}from"ag-charts-core";function dI(e,{aspectRatio:t,precision:i}){const s=mp(e,i,(l,c,p,d)=>{const u=gI(l,c,p,t),m=u+2*d*t,g=u*Math.SQRT2,y=m*Math.SQRT2;return{distance:g,maxDistance:y}});if(s==null)return;const{x:o,y:a,distance:n}=s,r=n/Math.SQRT2;return{x:o,y:a,maxWidth:r}}function uI(e,t,i,s,o){const[a,n]=e,[r,l]=t,c=1/o,p=r-a,d=l-n,[u,m]=n<=l?e:t,[g,y]=a<=r?e:t,[f,S]=n<=l?t:e,[x,v]=a<=r?t:e;let b=1/0;if(p===0)for(let R=0;R<=1;R+=1){const w=(R===0?c:-c)*(a-i)+s;if(w>=m&&w<=S){const _=Math.abs(s-w)*2*o;b=Math.min(b,_)}}else{const R=d/p;for(let C=0;C<=1;C+=1){const w=C===0?c:-c,G=(R*a-n-w*i+s)/(R-w);if(G>=g&&G<=x){const _=Math.abs(i-G)*2;b=Math.min(b,_)}}}const k=o,A=Math.abs((u-i)/(m-s)),I=Math.abs((f-i)/(S-s));if(Ss&&Ai&&Di!=c>i&&t<(l-d)*(i-u)/(c-u)+d&&(o=!o);const m=uI(r,p,t,i,s);a=Math.min(a,m),r=p,l=d,c=u}}return(o?1:-1)*a}function sa(e,t,i){i>=t&&(e.maxX=Math.min(e.maxX,i-t)),i<=t&&(e.minX=Math.max(e.minX,i-t))}function mI(e,t,i,s,o,a){const n=o-a/2,r=o+a/2,[l,c]=t,[p,d]=i,u=p-l,m=d-c,[g,y]=l<=p?t:i,[f,S]=l<=p?i:t;if(u!==0){const x=m/u;for(let v=0;v<=1;v+=1){const k=((v===0?n:r)-c)/x+l;k>=g&&k<=f&&sa(e,s,k)}}else Math.max(n,Math.min(c,d))<=Math.min(r,Math.max(c,d))&&sa(e,s,l);return f=n&&S<=r?sa(e,s,f):g>s&&y>=n&&y<=r&&sa(e,s,g),e}function yI(e,t,i,s){const o={minX:-1/0,maxX:1/0};for(const r of e){let l=r.at(-1);for(const c of r)mI(o,l,c,t,i,s),l=c}const{minX:a,maxX:n}=o;return Number.isFinite(a)&&Number.isFinite(n)?{x:t+(a+n)/2,width:n-a}:{x:t,width:0}}import{_ModuleSupport as fI}from"ag-charts-community";var{Property:Ie,SeriesProperties:SI,makeSeriesTooltip:xI}=fI,ve=class extends SI{constructor(){super(...arguments),this.topology=void 0,this.idKey="",this.idName=void 0,this.topologyIdKey="name",this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.padding=0,this.label=new As,this.tooltip=xI()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n,opacity:1}}};h([Ie],ve.prototype,"topology",2),h([Ie],ve.prototype,"title",2),h([Ie],ve.prototype,"legendItemName",2),h([Ie],ve.prototype,"idKey",2),h([Ie],ve.prototype,"idName",2),h([Ie],ve.prototype,"topologyIdKey",2),h([Ie],ve.prototype,"labelKey",2),h([Ie],ve.prototype,"labelName",2),h([Ie],ve.prototype,"colorKey",2),h([Ie],ve.prototype,"colorName",2),h([Ie],ve.prototype,"colorRange",2),h([Ie],ve.prototype,"fill",2),h([Ie],ve.prototype,"fillOpacity",2),h([Ie],ve.prototype,"stroke",2),h([Ie],ve.prototype,"strokeOpacity",2),h([Ie],ve.prototype,"strokeWidth",2),h([Ie],ve.prototype,"lineDash",2),h([Ie],ve.prototype,"lineDashOffset",2),h([Ie],ve.prototype,"padding",2),h([Ie],ve.prototype,"itemStyler",2),h([Ie],ve.prototype,"label",2),h([Ie],ve.prototype,"tooltip",2);var{getMissCount:bI,createDatumId:Mp,SeriesNodePickMode:Np,valueProperty:oa,ColorScale:vI,Group:Lp,Selection:er,Text:kI,PointerEvents:DI,applyShapeStyle:II,getLabelStyles:AI,mergeDefaults:Tp}=Ip,Rp=Ip.MercatorScale.fixedScale(),aa=class extends Fs{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{color:["colorKey"],label:["labelKey"]},propertyNames:{color:["colorName"],label:["labelName"]},pickModes:[Np.EXACT_SHAPE_MATCH,Np.NEAREST_NODE]}),this.properties=new ve,this._chartTopology=void 0,this.colorScale=new vI,this.itemGroup=this.contentGroup.appendChild(new Lp({name:"itemGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Lp({name:"itemLabelGroup"})),this.datumSelection=er.select(this.itemGroup,()=>this.nodeFactory()),this.labelSelection=er.select(this.itemLabelGroup,kI),this.highlightDatumSelection=er.select(this.highlightGroup,()=>this.nodeFactory()),this.previousLabelLayouts=void 0,this._previousDatumMidPoint=void 0,this.itemLabelGroup.pointerEvents=DI.None}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){return super.hasData&&this.topology!=null}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[1,e],this.highlightGroup.zIndex=[2,e],!0}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}nodeFactory(){const e=new ts;return e.renderMode=1,e.lineJoin="round",e}async processData(e){if(this.data==null)return;const{data:t,topology:i,colorScale:s}=this,{topologyIdKey:o,idKey:a,colorKey:n,labelKey:r,colorRange:l}=this.properties,c=new Map;for(const y of i?.features.values()??[]){const f=y.properties?.[o];f==null||!Yn(y.geometry,1)||c.set(f,y)}const p=this.colorScale.type,d=this.scale?.type,{dataModel:u,processedData:m}=await this.requestDataModel(e,t,{props:[oa(a,d,{id:"idValue",includeProperty:!1}),oa(a,d,{id:"featureValue",includeProperty:!1,processor:()=>y=>c.get(y)}),...r?[oa(r,"category",{id:"labelValue"})]:[],...n?[oa(n,p,{id:"colorValue"})]:[]]}),g=u.resolveColumnById(this,"featureValue",m);if(this.topologyBounds=g.reduce((y,f)=>{const S=f?.geometry;return S==null?y:is(S,y)},void 0),l!=null&&this.isColorScaleValid()){const y=u.resolveProcessedDataIndexById(this,"colorValue");s.domain=m.domain.values[y],s.range=l,s.update()}i==null&&Ap.warnOnce("no topology was provided for [MapShapeSeries]; nothing will be rendered.")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),o=i.input.count,a=bI(this,i.defs.values[s].missing);return!(o===0||o===a)}getLabelLayout(e,t,i,s,o){if(t==null||s==null)return;const{idKey:a,idName:n,colorKey:r,colorName:l,labelKey:c,labelName:p,padding:d,label:u}=this.properties;if(c==null||!u.enabled)return;const m=this.getLabelText(t,e,c,"label",[],u,{value:t,datum:e,idKey:a,idName:n,colorKey:r,colorName:l,labelKey:c,labelName:p});if(m==null)return;const g=cI(m)?hI(m,u):i.measureLines(String(m)),y=(g.width+2*d)/(g.height+2*d);if(o?.geometry===s&&o?.labelText===m&&o?.aspectRatio===y)return o;const f=si(s,Rp),S=Zo(f);if(S==null)return;const x=dI(S,{aspectRatio:y,precision:.001});if(x==null)return;const{x:v,y:b,maxWidth:k}=x;return{geometry:s,labelText:m,aspectRatio:y,x:v,y:b,maxWidth:k,fixedPolygon:S}}getLabelDatum(e,t){const{scale:i}=this;if(i==null)return;const{padding:s,label:o}=this.properties,{labelText:a,aspectRatio:n,x:r,y:l,maxWidth:c,fixedPolygon:p}=e,d={width:Math.ceil(c*t),height:Math.ceil(c*t/n),meta:r},u=Ds(pI(a),o,{padding:s},(b,k)=>{if(!k)return d;const A=yI(p,r,l,b/t);return{width:A.width*t,height:b,meta:A.x}});if(u==null)return;const[{text:m,fontSize:g,lineHeight:y,width:f},S]=u,x=fA){const I=b.length-A;b.length=A,b.push(`(+${I} more)`)}return b.length>0&&Ap.warnOnce("some data items do not have matches in the provided topology",b),{itemId:e,nodeData:x,labelData:v}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e,labelSelection:t,highlightDatumSelection:i}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let s=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:o}=this.properties,a=o!=null&&s?.datum==null&&o===s?.legendItemName;s!=null&&(s.series!==this&&!a||s.datum==null)&&(s=void 0);const n=this.contextNodeData?.nodeData??[],r=this.contextNodeData?.labelData??[];this.datumSelection=this.updateDatumSelection({nodeData:n,datumSelection:e}),this.updateDatumStyles({datumSelection:e,isHighlight:!1}),this.updateDatumNodes({datumSelection:e}),this.labelSelection=this.updateLabelSelection({labelData:r,labelSelection:t}),this.updateLabelNodes({labelSelection:t}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:s==null?[]:[s],datumSelection:i}),this.updateDatumStyles({datumSelection:i,isHighlight:!0}),this.updateDatumNodes({datumSelection:i})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>Mp(t.idValue))}getItemStyle({datumIndex:e,datum:t,colorValue:i},s){const{properties:o,colorScale:a}=this,{colorRange:n,itemStyler:r}=o,l=this.getHighlightStyle(s,e),c=Tp(l,o.getStyle());!s&&i!=null&&(c.fill=this.isColorScaleValid()?a.convert(i):n?.[0]??c.fill);let p=c;if(r!=null&&e!=null){const d=this.cachedDatumCallback(Mp(e,s?"highlight":"node"),()=>{const u=this.makeItemStylerParams(t,e,s,p);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(r,u))});d&&(p=Tp(d,p))}return p}makeItemStylerParams(e,t,i,s){const{id:o}=this,a=this.ctx.highlightManager?.getActiveHighlight(),n=this.getHighlightStateString(a,i,t),r=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:o,datum:e,highlighted:i,highlightState:n,...s,fill:r}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){const t=Sp(this.scale);e.each((i,s)=>{const{projectedGeometry:o}=s;if(o==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=o,II(i,s.style,t)})}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{x:o,y:a,text:n,fontSize:r,lineHeight:l},c)=>{const p=AI(this,void 0,t,t.label,!1,i),{color:d,fontStyle:u,fontWeight:m,fontFamily:g}=p;s.visible=!0,s.x=o,s.y=a,s.text=n,s.fill=d,s.fontStyle=u,s.fontWeight=m,s.fontSize=r,s.lineHeight=l,s.fontFamily=g,s.textAlign="center",s.textBaseline="middle",s.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,s.setBoxing(p)})}resetAnimation(){}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.datumSelection.each((o,a)=>{const n=o.distanceSquared(e,t);nnew aa(e),themeTemplate:{...Es,series:{fill:Bt({$applySwitch:[{$path:"type"},{$mapPalette:"fill"},["gradient",os.FILL_GRADIENT_LINEAR_DEFAULTS],["image",os.FILL_IMAGE_DEFAULTS],["pattern",os.FILL_PATTERN_DEFAULTS]]}),stroke:{$ref:"chartBackgroundColor"},colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},Bt(os.SAFE_RANGE2_OPERATION)]},fillOpacity:1,strokeWidth:1,lineDash:[0],lineDashOffset:0,padding:2,label:{...os.LABEL_BOXING_DEFAULTS,color:{$ref:"chartBackgroundColor"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:"bold",overflowStrategy:"hide"},highlight:Bt(os.multiSeriesHighlightStyle(!0))},tooltip:{range:"exact"}}},Cp={type:"series",name:"map-shape",chartType:"topology",enterprise:!0,options:CI,create:e=>new aa(e)};import{_ModuleSupport as tr}from"ag-charts-community";import{_ModuleSupport as OI}from"ag-charts-community";import{Logger as _I}from"ag-charts-core";import{_ModuleSupport as wI}from"ag-charts-community";var{Property:Yt,SeriesProperties:EI,makeSeriesTooltip:FI}=wI,Gt=class extends EI{constructor(){super(...arguments),this.topology=void 0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.tooltip=FI()}};h([Yt],Gt.prototype,"topology",2),h([Yt],Gt.prototype,"fill",2),h([Yt],Gt.prototype,"fillOpacity",2),h([Yt],Gt.prototype,"stroke",2),h([Yt],Gt.prototype,"strokeOpacity",2),h([Yt],Gt.prototype,"strokeWidth",2),h([Yt],Gt.prototype,"lineDash",2),h([Yt],Gt.prototype,"lineDashOffset",2),h([Yt],Gt.prototype,"tooltip",2);var{createDatumId:BI,Selection:GI,Group:VI,PointerEvents:Op}=OI,na=class extends Fs{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[]}),this.properties=new Gt,this._chartTopology=void 0,this.itemGroup=this.contentGroup.appendChild(new VI({name:"itemGroup"})),this.datumSelection=GI.select(this.itemGroup,()=>this.nodeFactory()),this.itemGroup.pointerEvents=Op.None}get topology(){return this.properties.topology??this._chartTopology}get focusable(){return!1}setOptionsData(){}setChartData(){}getNodeData(){}get hasData(){return!1}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,e,0],this.highlightGroup.zIndex=[0,e,1],!0}nodeFactory(){const e=new ts;return e.renderMode=1,e.lineJoin="round",e.pointerEvents=Op.None,e}processData(){const{topology:e}=this;this.topologyBounds=e?.features.reduce((t,i)=>{const s=i.geometry;return s==null?t:is(s,t)},void 0),e==null&&_I.warnOnce("no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.")}createNodeData(){const{id:e,topology:t,scale:i,properties:s}=this;if(t==null)return;const{fill:o,fillOpacity:a,stroke:n,strokeWidth:r,strokeOpacity:l,lineDash:c,lineDashOffset:p}=s,d=[],u=[];for(const[m,g]of t.features.entries()){const{geometry:y}=g,f=y!=null&&i!=null?si(y,i):void 0;f!=null&&d.push({series:this,itemId:m,datum:g,datumIndex:0,index:m,projectedGeometry:f,style:{fill:o,fillOpacity:a,stroke:n,strokeWidth:r,strokeOpacity:l,lineDash:c,lineDashOffset:p}})}return{itemId:e,nodeData:d,labelData:u}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;const{nodeData:t=[]}=this.contextNodeData??{};this.datumSelection=this.updateDatumSelection({nodeData:t,datumSelection:e}),this.updateDatumNodes({datumSelection:e})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>BI(t.index))}updateDatumNodes(e){const{datumSelection:t}=e;t.each((i,s)=>{const{projectedGeometry:o}=s;if(o==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=o,i.setProperties(s.style)})}resetAnimation(){}getLegendData(){return[]}getTooltipContent(e){}pickFocus(){}computeFocusBounds(e){}hasItemStylers(){return!1}};na.className="MapShapeBackgroundSeries",na.type="map-shape-background";import{_ModuleSupport as KI}from"ag-charts-community";import{constant as WI,geoJson as zI,required as $I}from"ag-charts-core";var{commonSeriesOptionsDefs:HI,mapShapeBackgroundSeriesThemeableOptionsDef:XI}=KI,YI={...XI,...HI,type:$I(WI("map-shape-background")),topology:zI},SC={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-shape-background",moduleFactory:e=>new na(e),themeTemplate:{...Es,series:{fill:Bt({$applySwitch:[{$path:"type"},{$path:["/1",{$mapPalette:"fill"},{$mapPalette:"hierarchyColors"}]},["gradient",tr.FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS],["image",tr.FILL_IMAGE_DEFAULTS],["pattern",tr.FILL_PATTERN_HIERARCHY_DEFAULTS]]}),stroke:{$ref:"chartBackgroundColor"},strokeWidth:1}}},_p={type:"series",name:"map-shape-background",chartType:"topology",enterprise:!0,options:YI,create:e=>new na(e)};import{_ModuleSupport as UI}from"ag-charts-community";import{_ModuleSupport as qI}from"ag-charts-community";import{_ModuleSupport as Gs}from"ag-charts-community";import{isDefined as jI}from"ag-charts-core";import{_ModuleSupport as wp}from"ag-charts-community";var{createDatumId:JI,mergeDefaults:Ep,toHighlightString:ZI}=wp;function QI(e,t,i){const{id:s}=e,{angleKey:o,cornerRadius:a,fill:n,fillOpacity:r,lineDash:l,lineDashOffset:c,radiusKey:p,stackGroup:d,stroke:u,strokeOpacity:m,strokeWidth:g}=e.properties,y=ZI(i??wp.HighlightState.None);return{angleKey:o,cornerRadius:a,fill:n,fillOpacity:r,highlightState:y,highlighted:t,lineDash:l,lineDashOffset:c,radiusKey:p,seriesId:s,stackGroup:d,stroke:u,strokeOpacity:m,strokeWidth:g}}function ir(e,t,i,s){const{styler:o}=e.properties;let a={};if(!t&&o){const n=QI(e,i,s);a=e.ctx.optionsGraphService.resolvePartial(["series",`${e.declarationOrder}`],e.cachedCallWithContext(o,n)??{},{pick:!1})??{}}return{cornerRadius:a.cornerRadius??e.properties.cornerRadius,fill:a.fill??e.properties.fill,fillOpacity:a.fillOpacity??e.properties.fillOpacity,lineDash:a.lineDash??e.properties.lineDash,lineDashOffset:a.lineDashOffset??e.properties.lineDashOffset,stroke:a.stroke??e.properties.stroke,strokeOpacity:a.strokeOpacity??e.properties.strokeOpacity,strokeWidth:a.strokeWidth??e.properties.strokeWidth,opacity:1}}function eA(e,t,i,s){const{id:o,properties:a}=e,{angleKey:n,radiusKey:r}=a,l=e.ctx.highlightManager?.getActiveHighlight(),c=e.getHighlightStateString(l,i,t.datumIndex),p=e.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:o,datum:t.datum,highlighted:i,highlightState:c,angleKey:n,radiusKey:r,...s,fill:p}}function as(e,t,i,s){const{properties:o}=e,{itemStyler:a}=o,n=e.getHighlightStyle(i,t?.datumIndex,s);let l=Ep(n,ir(e,t===void 0,i,s));if(a!=null&&t!=null){const c=e.cachedDatumCallback(JI(e.getDatumId(t),i?"highlight":"node"),()=>{const p=eA(e,t,i,l);return e.callWithContext(a,p)});c&&(l=Ep(c,l))}return l}var{DEFAULT_POLAR_DIRECTION_KEYS:tA,DEFAULT_POLAR_DIRECTION_NAMES:iA,ChartAxisDirection:Vt,PolarAxis:sA,diff:oA,fixNumericExtent:aA,groupAccumulativeValueProperty:Fp,keyProperty:nA,normaliseGroupTo:rA,resetLabelFn:lA,seriesLabelFadeInAnimation:cA,seriesLabelFadeOutAnimation:hA,valueProperty:pA,animationValidation:dA,createDatumId:uA,SeriesNodePickMode:Bp,normalizeAngle360:Gp,CategoryScale:gA,motion:Vp,applyShapeStyle:mA,isGradientFill:yA,updateLabelNode:fA,getItemStyles:SA}=Gs,xA=class extends Gs.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey}},Kp=class extends Gs.PolarSeries{constructor(e,{animationResetFns:t}){super({moduleCtx:e,categoryKey:"angleValue",propertyKeys:tA,propertyNames:iA,canHaveAxes:!0,pickModes:[Bp.NEAREST_NODE,Bp.EXACT_SHAPE_MATCH],animationResetFns:{...t,label:lA}}),this.NodeEvent=xA,this.groupScale=new gA,this.circleCache={r:0,cx:0,cy:0}}get hasData(){return this.getHasData("radiusValue-raw")}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===Vt.Angle)return t.getDomain(this,"angleValue","key",i);{const s=t.getDomain(this,"radiusValue-end","value",i),o=Number.isFinite(s[1]-s[0])?[Math.min(s[0],0),Math.max(s[1],0)]:[];return aA(o)}}async processData(e){const{angleKey:t,radiusKey:i,normalizedTo:s}=this.properties,o=!this.ctx.animationManager.isSkipped(),a=this.getStackId(),n=`${a}-trailing`,r=[];jI(s)&&r.push(rA([a,n],Math.abs(s))),o&&this.processedData&&r.push(oA(this.id,this.processedData)),o&&r.push(dA());const l=this.visible?{}:{forceValue:0},c=this.axes[Vt.Radius]?.scale.type,p=this.axes[Vt.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[nA(t,p,{id:"angleValue"}),pA(i,c,{id:"radiusValue-raw",invalidValue:null,...l}),...Fp(i,"normal",{id:"radiusValue-end",rangeId:"radiusValue-range",invalidValue:null,groupId:a,separateNegative:!0,...l},c),...Fp(i,"trailing",{id:"radiusValue-start",invalidValue:null,groupId:n,separateNegative:!0,...l},c),...r],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,s=this.circleCache;return e!==s.r||t!==s.cx||i!==s.cy?(this.circleCache={r:e,cx:t,cy:i},!0):!1}isRadiusAxisReversed(){return this.axes[Vt.Radius]?.isReversed()}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}getAxisInnerRadius(){const e=this.axes[Vt.Radius];return e instanceof sA?this.radius*e.innerRadiusRatio:0}createNodeData(){const{processedData:e,dataModel:t,groupScale:i}=this;if(!t||!e||e.type!=="grouped")return;const s=this.axes[Vt.Angle],o=this.axes[Vt.Radius],a=s?.scale,n=o?.scale;if(!a||!n)return;const r=t.resolveKeysById(this,"angleValue",e),l=t.resolveColumnById(this,"radiusValue-start",e),c=t.resolveColumnById(this,"radiusValue-end",e),p=t.resolveColumnById(this,"radiusValue-raw",e),d=t.resolveProcessedDataIndexById(this,"radiusValue-range");let u=0,m=0;s instanceof di&&(u=s.groupPaddingInner,m=s.paddingInner);const y=(a.bandwidth??0)*(1-m),{index:f,visibleGroupCount:S}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);i.domain=Array.from({length:S}).map((M,O)=>String(O)),i.range=[-y/2,y/2],i.paddingInner=S>1?u:0;const x=this.isRadiusAxisReversed(),v=x?this.radius:this.getAxisInnerRadius(),b=x?this.getAxisInnerRadius():this.radius,k=b+v,{angleKey:A,radiusKey:I,angleName:D,radiusName:N,legendItemName:R,label:C}=this.properties,w=this.getSeriesDomain(Vt.Radius),G=(M,O,B,F)=>{const V=this.getLabelText(O,M,I,"radius",w,C,{value:O,datum:M,angleKey:A,radiusKey:I,angleName:D,radiusName:N,legendItemName:R});if(V)return{x:B,y:F,text:V,textAlign:"center",textBaseline:"middle"}},_=[],E=SA((M,O,B)=>as(this,M,O,B)),L={itemId:I,nodeData:_,labelData:_,styles:E};if(!this.visible)return L;const{dataSources:P}=e,T=P.get(this.id)?.data??[];for(const{datumIndex:M,group:O}of t.forEachGroupDatum(this,e)){const B=T[M],F=r[M];if(F==null)return;const V=p[M],W=V>=0&&!Object.is(V,-0),K=l[M],z=c[M],$=O.aggregation[d][W?1:0]??0,Z=W===x;if(K===void 0||z===void 0)return;let q,Y;if(T.length===1)q=-.5*Math.PI,Y=1.5*Math.PI;else{const ye=a.convert(F);q=Gp(ye+i.convert(String(f))),Y=Gp(q+i.bandwidth)}const Q=q+i.bandwidth/2,ie=k-n.convert(K),U=k-n.convert(z),ce=(ie+U)/2,ae=k-n.convert(0),j=k-n.convert($),re=Math.cos(Q)*ce,se=Math.sin(Q)*ce,ue=this.properties.label.enabled?G(B,V,re,se):void 0,le=this.getColumnWidth(q,Y);_.push({series:this,datum:B,datumIndex:M,point:{x:re,y:se,size:0},midPoint:{x:re,y:se},label:ue,angleValue:F,radiusValue:V,negative:Z,innerRadius:ie,outerRadius:U,stackInnerRadius:ae,stackOuterRadius:j,startAngle:q,endAngle:Y,midAngle:Q,axisInnerRadius:v,axisOuterRadius:b,columnWidth:le,index:M})}return{itemId:I,nodeData:_,labelData:_,styles:E}}getColumnWidth(e,t){return Number.NaN}update({seriesRect:e}){const t=this.checkResize(e);this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updateSectorSelection(this.itemSelection,!1),this.updateSectorSelection(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updateSectorSelection(e,t){const{contextNodeData:i}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight();let o=[];const a=this.ctx.highlightManager?.getActiveHighlight();t?a?.datum&&a.series===this&&o.push(a):o=this.nodeData;const n=this.isRadiusAxisReversed(),r=n?this.radius:this.getAxisInnerRadius(),l=n?this.getAxisInnerRadius():this.radius,c=this.getShapeFillBBox(),p=this.hasItemStylers();e.update(o,void 0,d=>this.getDatumId(d)).each((d,u)=>{const{midPoint:m}=u;if(p){const x=this.getHighlightState(a,t,u.datumIndex);u.style=as(this,u,t,x)}const g=u.style??i.styles[this.getHighlightState(s,t,u.datumIndex)],y=g.fill,S=yA(y)&&y.bounds==="item"?{centerX:m?.x??0,centerY:m?.y??0}:{centerX:0,centerY:0,innerRadius:r,outerRadius:l};this.updateItemPath(d,u,t),mA(d,g,c,S),d.cornerRadius=g.cornerRadius??0,d.lineJoin="round"})}updateLabels(){const e=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((t,i)=>{fA(this,t,this.properties,this.properties.label,i.label,!1,e),t.fillOpacity=this.getHighlightStyle(!1,i.datumIndex).opacity??1})}animateEmptyUpdateReady(){const{labelSelection:e}=this,t=this.getColumnTransitionFunctions();Vp.fromToMotion(this.id,"datums",this.ctx.animationManager,[this.itemSelection],t),cA(this,"labels",this.ctx.animationManager,e)}animateClearingUpdateEmpty(){const{itemSelection:e}=this,{animationManager:t}=this.ctx,i=this.getColumnTransitionFunctions();Vp.fromToMotion(this.id,"datums",t,[e],i),hA(this,"labels",t,this.labelSelection)}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:o,properties:a}=this,{angleKey:n,angleName:r,radiusKey:l,radiusName:c,legendItemName:p,tooltip:d}=a,u=o[Vt.Angle],m=o[Vt.Radius],g=this.nodeData?.[e];if(!i||!s||!u||!m||!g)return;const y=s.dataSources.get(this.id)?.data[e],f=i.resolveKeysById(this,"angleValue",s)[e],S=i.resolveColumnById(this,"radiusValue-raw",s)[e];if(f==null)return;const x=as(this,g,!1);return this.formatTooltipWithContext(d,{heading:this.getAxisValueText(u,"tooltip",f,y,n,void 0),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(m,"tooltip",S,y,l,void 0)}]},{seriesId:t,datum:y,title:r,angleKey:n,angleName:r,radiusKey:l,radiusName:c,legendItemName:p,...x})}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.itemSelection.nodes())}legendItemSymbol(){const{fill:e,stroke:t,fillOpacity:i,strokeOpacity:s,strokeWidth:o,lineDash:a,lineDashOffset:n}=ir(this,!1,!1,Gs.HighlightState.None),r={fill:e??"rgba(0, 0, 0, 0)",stroke:t??"rgba(0, 0, 0, 0)",fillOpacity:i,strokeOpacity:s,strokeWidth:o,lineDash:a,lineDashOffset:n};return Gs.isGradientFill(r.fill)&&(r.fill={...r.fill,gradient:"linear",rotation:0,reverse:!1}),{marker:r}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{radiusKey:s,radiusName:o,legendItemName:a,showInLegend:n}=this.properties;return[{legendType:"category",id:t,itemId:s,seriesId:t,enabled:i,label:{text:a??o??s},symbol:this.legendItemSymbol(),legendItemName:a,hideInLegend:!n}]}getDatumId(e){return uA(e.angleValue)}computeLabelsBBox(){return null}};import{_ModuleSupport as bA}from"ag-charts-community";var{SeriesProperties:vA,makeSeriesTooltip:kA,Property:Ce,Label:DA}=bA,Ae=class extends vA{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.label=new DA,this.tooltip=kA()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n,cornerRadius:r}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n,cornerRadius:r,opacity:1}}};h([Ce],Ae.prototype,"angleKey",2),h([Ce],Ae.prototype,"angleName",2),h([Ce],Ae.prototype,"radiusKey",2),h([Ce],Ae.prototype,"radiusName",2),h([Ce],Ae.prototype,"legendItemName",2),h([Ce],Ae.prototype,"fill",2),h([Ce],Ae.prototype,"fillOpacity",2),h([Ce],Ae.prototype,"stroke",2),h([Ce],Ae.prototype,"strokeWidth",2),h([Ce],Ae.prototype,"strokeOpacity",2),h([Ce],Ae.prototype,"lineDash",2),h([Ce],Ae.prototype,"lineDashOffset",2),h([Ce],Ae.prototype,"cornerRadius",2),h([Ce],Ae.prototype,"styler",2),h([Ce],Ae.prototype,"itemStyler",2),h([Ce],Ae.prototype,"rotation",2),h([Ce],Ae.prototype,"stackGroup",2),h([Ce],Ae.prototype,"normalizedTo",2),h([Ce],Ae.prototype,"label",2),h([Ce],Ae.prototype,"tooltip",2);import{_ModuleSupport as IA}from"ag-charts-community";import{_ModuleSupport as AA}from"ag-charts-community";var{motion:MA}=AA;function Wp(){const e={startAngle:new Map,endAngle:new Map},t=["startAngle","endAngle"],i=(n,r,l)=>{for(const c of t){const p=e[c];let d=(l==="removed"||l==="updated"?n:r)[c],u=(l==="removed"?n:r)[c];Number.isNaN(u)&&(u=n.previousDatum?.[c]??Number.NaN);const m=d-u;Math.abs(m)>Math.PI&&(d-=Math.sign(m)*2*Math.PI),p.set(r,{from:d,to:u})}},s=(n,r)=>({startAngle:e.startAngle.get(n)[r],endAngle:e.endAngle.get(n)[r]});return{calculate:i,from:n=>s(n,"from"),to:n=>s(n,"to")}}function zp(e,t,i){if(i==="updated"){if(e.previousDatum==null||Number.isNaN(e.previousDatum.startAngle)||Number.isNaN(e.previousDatum.endAngle))return"added";if(Number.isNaN(t.startAngle)||Number.isNaN(t.endAngle))return"removed"}return i==="added"&&e.previousDatum!=null?"updated":i}function NA(e){const t=Wp();return{toFn:(o,a,n)=>{const{startAngle:r,endAngle:l}=t.to(a);let c,p,d,u,m;return n==="removed"?(c=o.innerRadius,p=o.innerRadius,d=o.columnWidth,u=o.axisInnerRadius,m=o.axisOuterRadius):(c=Number.isNaN(a.innerRadius)?e:a.innerRadius,p=Number.isNaN(a.outerRadius)?e:a.outerRadius,d=Number.isNaN(a.columnWidth)?o.columnWidth:a.columnWidth,u=a.axisInnerRadius,m=a.axisOuterRadius),{innerRadius:c,outerRadius:p,columnWidth:d,axisInnerRadius:u,axisOuterRadius:m,startAngle:r,endAngle:l}},fromFn:(o,a,n)=>{n=zp(o,a,n),t.calculate(o,a,n);const{startAngle:r,endAngle:l}=t.from(a);let c,p,d,u,m;n==="removed"||n==="updated"?(c=o.innerRadius,p=o.outerRadius,d=o.columnWidth,u=o.axisInnerRadius,m=o.axisOuterRadius):(c=e,p=e,d=a.columnWidth,u=a.axisInnerRadius,m=a.axisOuterRadius);const g=MA.NODE_UPDATE_STATE_TO_PHASE_MAPPING[n];return{innerRadius:c,outerRadius:p,columnWidth:d,axisInnerRadius:u,axisOuterRadius:m,startAngle:r,endAngle:l,phase:g}}}}function LA(e,{innerRadius:t,outerRadius:i,columnWidth:s,axisInnerRadius:o,axisOuterRadius:a,startAngle:n,endAngle:r}){return{innerRadius:t,outerRadius:i,columnWidth:s,axisInnerRadius:o,axisOuterRadius:a,startAngle:n,endAngle:r}}var{SectorBox:ra,motion:TA}=IA;function sr(e){const{negative:t,innerRadius:i,outerRadius:s,stackInnerRadius:o,stackOuterRadius:a}=e;return{innerRadius:t?a:o,outerRadius:t?o:a,clipInnerRadius:t?s:i,clipOuterRadius:t?i:s}}function RA(e){const t=Wp();return{toFn:(o,a,n)=>{const{startAngle:r,endAngle:l}=t.to(a);let c,p,d;if(n==="removed")c=e,p=e,d=new ra(r,l,c,p);else{let u,m;({innerRadius:c,outerRadius:p,clipInnerRadius:u,clipOuterRadius:m}=sr(a)),Number.isNaN(c)&&(c=e),Number.isNaN(p)&&(p=e),Number.isNaN(u)&&(u=e),Number.isNaN(m)&&(m=e),d=new ra(r,l,u,m)}return{innerRadius:c,outerRadius:p,startAngle:r,endAngle:l,clipSector:d}},fromFn:(o,a,n)=>{n=zp(o,a,n),t.calculate(o,a,n);const{startAngle:r,endAngle:l}=t.from(a);let c,p,d;n==="removed"||n==="updated"?(c=o.innerRadius,p=o.outerRadius,d=o.clipSector):(c=e,p=e),d??(d=new ra(r,l,c,p));const u=TA.NODE_UPDATE_STATE_TO_PHASE_MAPPING[n];return{innerRadius:c,outerRadius:p,startAngle:r,endAngle:l,clipSector:d,phase:u}}}}function PA(e,t){const{startAngle:i,endAngle:s}=t,{innerRadius:o,outerRadius:a,clipInnerRadius:n,clipOuterRadius:r}=sr(t),l=new ra(i,s,n,r);return{innerRadius:o,outerRadius:a,startAngle:i,endAngle:s,clipSector:l}}var{Sector:CA,SectorBox:OA,PolarZIndexMap:or}=qI,la=class extends Kp{constructor(e){super(e,{animationResetFns:{item:PA}}),this.properties=new Ae}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,or.FOREGROUND,e],this.highlightGroup.zIndex=[0,or.HIGHLIGHT,e],this.labelGroup.zIndex=[0,or.LABEL,e],!0}getStackId(){return`nightingale-stack-${this.seriesGrouping?.groupIndex??this.id}-yValues`}nodeFactory(){return new CA}updateItemPath(e,t,i){const{negative:s}=t;if(e.centerX=0,e.centerY=0,e.startOuterCornerRadius=s?0:this.properties.cornerRadius,e.endOuterCornerRadius=s?0:this.properties.cornerRadius,e.startInnerCornerRadius=s?this.properties.cornerRadius:0,e.endInnerCornerRadius=s?this.properties.cornerRadius:0,i){const{startAngle:o,endAngle:a}=t,{innerRadius:n,outerRadius:r,clipInnerRadius:l,clipOuterRadius:c}=sr(t);e.innerRadius=n,e.outerRadius=r,e.startAngle=o,e.endAngle=a,e.clipSector=new OA(o,a,l,c)}}getColumnTransitionFunctions(){const e=this.isRadiusAxisReversed()?this.radius:this.getAxisInnerRadius();return RA(e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};la.className="NightingaleSeries",la.type="nightingale";import{_ModuleSupport as _A}from"ag-charts-community";import{boolean as $p,constant as wA,number as EA,required as ar,string as ns}from"ag-charts-core";var{commonSeriesOptionsDefs:FA,nightingaleSeriesThemeableOptionsDef:BA}=_A,GA={...FA,...BA,type:ar(wA("nightingale")),angleKey:ar(ns),radiusKey:ar(ns),angleName:ns,radiusName:ns,legendItemName:ns,grouped:$p,stacked:$p,stackGroup:ns,normalizedTo:EA};import{_ModuleSupport as nr}from"ag-charts-community";var{ThemeConstants:{POLAR_AXIS_TYPE:Hp,POLAR_AXIS_SHAPE:Xp},FILL_GRADIENT_RADIAL_SERIES_DEFAULTS:VA,FILL_IMAGE_DEFAULTS:KA,FILL_PATTERN_DEFAULTS:WA}=nr,zA={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",VA],["image",KA],["pattern",WA]]},stroke:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$ref:"chartBackgroundColor"},{$palette:"stroke"}]},strokeWidth:1,label:{...nr.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:nr.multiSeriesHighlightStyle()},axes:{[Hp.ANGLE_CATEGORY]:{shape:{$findFirstSiblingNotOperation:Xp.CIRCLE},groupPaddingInner:0,paddingInner:0,label:{spacing:10}},[Hp.RADIUS_NUMBER]:{shape:{$findFirstSiblingNotOperation:Xp.CIRCLE}}}},{ThemeConstants:{POLAR_AXIS_TYPE:Yp}}=UI,RC={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"nightingale",moduleFactory:e=>new la(e),defaultAxes:[{type:Yp.ANGLE_CATEGORY},{type:Yp.RADIUS_NUMBER}],themeTemplate:zA,stackable:!0,groupable:!0,stackedByDefault:!0},Up={type:"series",name:"nightingale",chartType:"polar",enterprise:!0,options:GA,create:e=>new la(e)};import{_ModuleSupport as qp}from"ag-charts-community";import{cachedTextMeasurer as $A,isArray as HA,measureTextSegments as XA,toPlainText as jp}from"ag-charts-core";import{_ModuleSupport as YA}from"ag-charts-community";var{SeriesProperties:UA,makeSeriesTooltip:qA,Property:Oe,Label:Jp,DropShadow:jA}=YA,JA=class extends Jp{},rr=class extends Jp{constructor(){super(...arguments),this.spacing=0}};h([Oe],rr.prototype,"spacing",2),h([Oe],rr.prototype,"placement",2);var Ge=class extends UA{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.direction="vertical",this.reverse=void 0,this.spacing=0,this.aspectRatio=void 0,this.shadow=new jA().set({enabled:!1}),this.label=new JA,this.stageLabel=new rr,this.tooltip=qA()}getStyle(e=0){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r}=this;return{fill:t[e%t.length],fillOpacity:s,stroke:i[e%i.length],strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r,opacity:1}}};h([Oe],Ge.prototype,"stageKey",2),h([Oe],Ge.prototype,"valueKey",2),h([Oe],Ge.prototype,"fills",2),h([Oe],Ge.prototype,"fillOpacity",2),h([Oe],Ge.prototype,"strokes",2),h([Oe],Ge.prototype,"strokeWidth",2),h([Oe],Ge.prototype,"strokeOpacity",2),h([Oe],Ge.prototype,"lineDash",2),h([Oe],Ge.prototype,"lineDashOffset",2),h([Oe],Ge.prototype,"direction",2),h([Oe],Ge.prototype,"reverse",2),h([Oe],Ge.prototype,"spacing",2),h([Oe],Ge.prototype,"aspectRatio",2),h([Oe],Ge.prototype,"itemStyler",2),h([Oe],Ge.prototype,"shadow",2),h([Oe],Ge.prototype,"label",2),h([Oe],Ge.prototype,"stageLabel",2),h([Oe],Ge.prototype,"tooltip",2);function Zp(e,{x:t,y:i,top:s,right:o,bottom:a,left:n}){e.x0=t-s/2,e.x1=t+s/2,e.x2=t+a/2,e.x3=t-a/2,e.y0=i-n/2,e.y1=i-o/2,e.y2=i+o/2,e.y3=i+n/2}function ZA(e){return{fromFn:(o,a)=>{const{x:n,y:r}=a;let{top:l,right:c,bottom:p,left:d}=a;return e==="vertical"?(l=0,p=0):(d=0,c=0),{x:n,y:r,top:l,right:c,bottom:p,left:d}},toFn:(o,a)=>{const{x:n,y:r,top:l,right:c,bottom:p,left:d}=a;return{x:n,y:r,top:l,right:c,bottom:p,left:d}},applyFn:Zp}}var{StateMachine:QA,valueProperty:Qp,SeriesNodePickMode:ed,createDatumId:eM,BBox:lr,Group:cr,Selection:ca,Text:td,PointerEvents:id,applyShapeStyle:tM,mergeDefaults:sd,fromToMotion:iM,seriesLabelFadeInAnimation:sM,getLabelStyles:oM}=qp,hr=class extends qp.DataModelSeries{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[ed.EXACT_SHAPE_MATCH,ed.NEAREST_NODE]}),this.properties=new Ge,this.itemGroup=this.contentGroup.appendChild(new cr({name:"itemGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new cr({name:"itemLabelGroup"})),this.stageLabelGroup=this.contentGroup.appendChild(new cr({name:"stageLabelGroup"})),this.datumSelection=ca.select(this.itemGroup,()=>this.nodeFactory()),this.labelSelection=ca.select(this.itemLabelGroup,td),this.stageLabelSelection=ca.select(this.stageLabelGroup,td),this.highlightDatumSelection=ca.select(this.highlightGroup,()=>this.nodeFactory()),this.animationState=new QA("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{clear:"empty",reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable()),this.itemLabelGroup.pointerEvents=id.None,this.stageLabelGroup.pointerEvents=id.None}addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",e=>this.onLegendItemClick(e)))}nodeFactory(){return new Et}getNodeData(){return this.contextNodeData?.nodeData}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}async processData(e){if(this.data==null)return;const{id:t,visible:i,ctx:{legendManager:s}}=this,{stageKey:o,valueKey:a}=this.properties,n="category",r="number",l=(p,d,u)=>i&&s.getItemEnabled({seriesId:t,itemId:u}),c=this.visible?{}:{forceValue:0};await this.requestDataModel(e,this.data,{props:[Qp(o,n,{id:"xValue"}),Qp(a,r,{id:"yValue",...c,validation:l,invalidValue:0})]})}createNodeData(){const{id:e,dataModel:t,processedData:i,properties:s,visible:o,ctx:{legendManager:a}}=this,{stageKey:n,valueKey:r,direction:l,reverse:c=l==="horizontal",spacing:p,aspectRatio:d,label:u,stageLabel:m}=s;if(t==null||i==null)return;const g=l==="horizontal",y=t.resolveColumnById(this,"xValue",i),f=t.resolveColumnById(this,"yValue",i),S=t.getDomain(this,"xValue","value",i),x=t.getDomain(this,"yValue","value",i),v=$A(m);let b,k;g?(b="center",k=m.placement==="before"?"bottom":"top"):(b=m.placement==="after"?"left":"right",k="middle");const A=m.enabled?[]:void 0;let I=0,D=0,N=0;const R=i.dataSources.get(this.id)?.data??[];for(const[F,V]of R.entries()){const W=y[F],K=f[F],z=o&&a.getItemEnabled({seriesId:e,itemId:F});if(N+=K,A==null)continue;const $=this.getLabelText(W,V,n,"x",S,this.properties.stageLabel,{datum:V,value:K,stageKey:n,valueKey:r}),{width:Z,height:q}=HA($)?XA($,u):v.measureLines($);I=Math.max(I,Z),D=Math.max(D,q),A.push({x:Number.NaN,y:Number.NaN,text:$,textAlign:b,textBaseline:k,visible:z})}const C=this._nodeDataDependencies?.seriesRectWidth??0,w=this._nodeDataDependencies?.seriesRectHeight??0,G=p*(i.input.count-1);let _;if(g){const F=D+m.spacing;_=new lr(0,m.placement==="before"?F:0,C,w-F)}else{const F=I+m.spacing;_=new lr(m.placement==="after"?0:F,0,C-F,w)}if(d!=null&&d!==0){const F=l==="horizontal"?1/d:d,V=Math.min(_.width,_.height*F),W=V/F;_=new lr(_.x+(_.width-V)/2,_.y+(_.height-W)/2,V,W)}let E,L;g?L=m.placement==="before"?_.y-m.spacing:_.y+_.height+m.spacing:E=m.placement==="after"?_.x+_.width+m.spacing:_.x-m.spacing;const P=_.width-(g?G:0),T=_.height-(g?0:G);if(P<0||T<0)return;const M=[],O=[];let B=0;for(const[F,V]of R.entries()){const W=y[F],K=f[F],z=o&&a.getItemEnabled({seriesId:e,itemId:F}),$=B+K,Z=(B+$)/(2*N),q=($-B)/N,Y=g?P*Z+p*F:P*.5,Q=g?T*.5:T*Z+p*F,ie=_.x+Y,U=_.y+Q;if(A!=null){const le=A[F];le.x=E??ie,le.y=L??U}let ce,ae,j,re;if(g){const le=P*q;ce=le,j=le;const ye=(Y+le/2)*(T/_.width),we=(Y-le/2)*(T/_.width);ae=c?_.height-ye:ye,re=c?_.height-we:we}else{const le=T*q;ae=le,re=le;const ye=(Q-le/2)*(P/_.height),we=(Q+le/2)*(P/_.height);ce=c?_.width-ye:ye,j=c?_.width-we:we}const se=this.getLabelText(K,V,r,"y",x,u,{datum:V,value:K,stageKey:n,valueKey:r}),ue={x:ie,y:U,text:se,textAlign:"center",textBaseline:"middle",visible:z};O.push(ue),M.push({series:this,itemId:r,datum:V,datumIndex:F,index:F,xValue:W,yValue:K,x:ie,y:U,top:ce,right:ae,bottom:j,left:re,label:ue,enabled:z,midPoint:{x:ie,y:U},style:this.getItemStyle({datumIndex:F,datum:V},!1)}),B=$}return{itemId:e,nodeData:M,labelData:O,stageLabelData:A,bounds:_}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update({seriesRect:e}){this.checkResize(e);const{datumSelection:t,labelSelection:i,stageLabelSelection:s,highlightDatumSelection:o}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.contentGroup.opacity=this.getOpacity();let a=this.ctx.highlightManager?.getActiveHighlight();a!=null&&(a.series!==this||a.datum==null)&&(a=void 0);const n=this.contextNodeData?.nodeData??[],r=this.contextNodeData?.labelData??[],l=this.contextNodeData?.stageLabelData??[];this.datumSelection=this.updateDatumSelection({nodeData:n,datumSelection:t}),this.updateDatumStyles({datumSelection:t,isHighlight:!1}),this.updateDatumNodes({datumSelection:t,isHighlight:!1}),this.labelSelection=this.updateLabelSelection({labelData:r,labelSelection:i}),this.updateLabelNodes({labelSelection:i,labelProperties:this.properties.label}),this.stageLabelSelection=this.updateStageLabelSelection({stageLabelData:l,stageLabelSelection:s}),this.updateLabelNodes({labelSelection:s,labelProperties:this.properties.stageLabel}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:a==null?[]:[a],datumSelection:o}),this.updateDatumStyles({datumSelection:o,isHighlight:!0}),this.updateDatumNodes({datumSelection:o,isHighlight:!0}),this.animationState.transition("update")}updateDatumSelection(e){return e.datumSelection.update(e.nodeData)}getItemStyle({datumIndex:e,datum:t},i){const{properties:s}=this,{itemStyler:o}=s,a=this.getHighlightStyle(i,e);let r=sd(a,s.getStyle(e));if(o!=null&&e!=null){const l=this.cachedDatumCallback(eM(e,i?"highlight":"node"),()=>{const c=this.makeItemStylerParams(t,e,i,r);return this.callWithContext(o,c)});l&&(r=sd(l,r))}return r}makeItemStylerParams(e,t,i,s){const{id:o,properties:a}=this,{stageKey:n,valueKey:r}=a,l=this.ctx.highlightManager?.getActiveHighlight(),c=this.getHighlightStateString(l,i,t),p=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:o,datum:e,stageKey:n,valueKey:r,highlighted:i,highlightState:c,...s,fill:p}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){const{properties:t}=this,{shadow:i}=t,s=this.contextNodeData?.bounds,o=s?{series:s,axis:s}:void 0;e.each((a,n)=>{tM(a,n.style,o),Zp(a,n),a.fillShadow=i})}updateLabelSelection(e){return e.labelSelection.update(this.properties.label.enabled?e.labelData:[])}updateStageLabelSelection(e){return e.stageLabelSelection.update(e.stageLabelData)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,s,o)=>{const{visible:a,x:n,y:r,text:l,textAlign:c,textBaseline:p}=s,d=oM(this,void 0,this.properties,e.labelProperties,!1,t),{color:u,fontSize:m,fontStyle:g,fontWeight:y,fontFamily:f}=d;i.visible=a,i.x=n,i.y=r,i.text=l,i.fill=u,i.fillOpacity=this.getHighlightStyle(!1,o).opacity??1,i.fontStyle=g,i.fontWeight=y,i.fontSize=m,i.fontFamily=f,i.textAlign=c,i.textBaseline=p,i.setBoxing(d)})}computeFocusBounds(e){const t=this.getNodeData()?.[e.datumIndex];if(t!==void 0){for(const i of this.datumSelection)if(i.datum===t)return i.node}}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:o}=this,{stageKey:a,valueKey:n,tooltip:r}=o;if(!i||!s)return;const l=s.dataSources.get(this.id)?.data[e],c=i.resolveColumnById(this,"xValue",s)[e],p=i.resolveColumnById(this,"yValue",s)[e];if(c==null)return;const d=this.getLabelText(c,l,a,"x",i.getDomain(this,"xValue","value",s),this.properties.stageLabel,{datum:l,value:c,stageKey:a,valueKey:n}),u=this.getLabelText(p,l,n,"y",i.getDomain(this,"yValue","value",s),this.properties.stageLabel,{datum:l,value:p,stageKey:a,valueKey:n}),m=this.getItemStyle({datumIndex:e,datum:l},!1);return this.formatTooltipWithContext(r,{symbol:this.legendItemSymbol(e),data:[{label:jp(d),value:jp(u)}]},{seriesId:t,datum:l,title:void 0,stageKey:a,valueKey:n,...m})}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.datumSelection.each((o,a)=>{const n=o.distanceSquared(e,t);nnew hr(e)};import{_ModuleSupport as pM}from"ag-charts-community";import{_ModuleSupport as ft}from"ag-charts-community";var{ThemeConstants:{POLAR_AXIS_TYPE:dM}}=ft,nd={series:{stroke:{$palette:"stroke"},label:{...ft.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},marker:{enabled:!0,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",ft.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",ft.FILL_IMAGE_DEFAULTS],["pattern",ft.FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},fillOpacity:1,shape:"circle",size:6,strokeOpacity:1,strokeWidth:{$isUserOption:["./stroke",1,0]}},highlight:ft.multiSeriesHighlightStyle(),tooltip:{range:{$path:["/tooltip/range","nearest"]}}},axes:{[dM.ANGLE_CATEGORY]:{label:{spacing:10}}}},uM=ft.mergeDefaults({series:{stroke:ft.SAFE_STROKE_FILL_OPERATION,strokeWidth:2}},nd),gM=ft.mergeDefaults({series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",ft.FILL_GRADIENT_LINEAR_DEFAULTS],["image",ft.FILL_IMAGE_DEFAULTS],["pattern",ft.FILL_PATTERN_DEFAULTS]]},fillOpacity:.8,strokeWidth:2,marker:{enabled:!1}}},nd);import{_ModuleSupport as rd}from"ag-charts-community";import{_ModuleSupport as dr}from"ag-charts-community";import{isFiniteNumber as ld,isNumberEqual as cd}from"ag-charts-core";import{_ModuleSupport as mM}from"ag-charts-community";var{Label:yM,SeriesMarker:fM,SeriesProperties:SM,makeSeriesTooltip:xM,Property:Qe}=mM,ze=class extends SM{constructor(){super(...arguments),this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.rotation=0,this.marker=new fM,this.label=new yM,this.tooltip=xM(),this.connectMissingData=!1}};h([Qe],ze.prototype,"angleKey",2),h([Qe],ze.prototype,"radiusKey",2),h([Qe],ze.prototype,"angleName",2),h([Qe],ze.prototype,"radiusName",2),h([Qe],ze.prototype,"legendItemName",2),h([Qe],ze.prototype,"stroke",2),h([Qe],ze.prototype,"strokeWidth",2),h([Qe],ze.prototype,"strokeOpacity",2),h([Qe],ze.prototype,"lineDash",2),h([Qe],ze.prototype,"lineDashOffset",2),h([Qe],ze.prototype,"rotation",2),h([Qe],ze.prototype,"styler",2),h([Qe],ze.prototype,"marker",2),h([Qe],ze.prototype,"label",2),h([Qe],ze.prototype,"tooltip",2),h([Qe],ze.prototype,"connectMissingData",2);var{DEFAULT_POLAR_DIRECTION_KEYS:bM,DEFAULT_POLAR_DIRECTION_NAMES:vM,ChartAxisDirection:St,PolarAxis:kM,SeriesNodePickMode:hd,valueProperty:pd,fixNumericExtent:DM,seriesLabelFadeInAnimation:IM,markerFadeInAnimation:AM,resetMarkerFn:MM,animationValidation:NM,computeMarkerFocusBounds:LM,extent:TM,BBox:RM,Group:PM,Path:CM,Selection:ur,Text:OM,Marker:_M,updateLabelNode:wM,getMarkerStyles:EM,mergeDefaults:FM}=dr,BM=class extends dr.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey}},gr=class extends dr.PolarSeries{constructor(e){super({moduleCtx:e,categoryKey:"angleValue",propertyKeys:bM,propertyNames:vM,pickModes:[hd.NEAREST_NODE,hd.EXACT_SHAPE_MATCH],canHaveAxes:!0,animationResetFns:{item:MM},clipFocusBox:!1}),this.NodeEvent=BM,this.lineGroup=this.contentGroup.appendChild(new PM({name:"radar-line"})),this.lineSelection=ur.select(this.lineGroup,CM),this.resetInvalidToZero=!1,this.circleCache={r:0,cx:0,cy:0},this.lineGroup.zIndex=0,this.itemGroup.zIndex=1}get hasData(){return this.getHasData("angleValue")}nodeFactory(){return new _M}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===St.Angle)return t.getDomain(this,"angleValue","value",i);{const s=t.getDomain(this,"radiusValue","value",i),o=TM(s.length===0?s:[0].concat(s));return DM(o)}}async processData(e){const{angleKey:t,radiusKey:i}=this.properties,s=[];this.ctx.animationManager.isSkipped()||s.push(NM());const o=this.axes[St.Radius]?.scale.type,a=this.axes[St.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[pd(t,a,{id:"angleValue"}),pd(i,o,{id:"radiusValue",invalidValue:void 0}),...s]}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,s=this.circleCache;return e===s.r&&t===s.cx&&i===s.cy?!1:(this.circleCache={r:e,cx:t,cy:i},!0)}getAxisInnerRadius(){const e=this.axes[St.Radius];return e instanceof kM?this.radius*e.innerRadiusRatio:0}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}createNodeData(){const{processedData:e,dataModel:t}=this;if(!e||!t)return;const{angleKey:i,radiusKey:s,angleName:o,radiusName:a,legendItemName:n,marker:r,label:l}=this.properties,c=this.axes[St.Angle]?.scale,p=this.axes[St.Radius]?.scale;if(!c||!p)return;const d=t.resolveColumnById(this,"angleValue",e),u=t.resolveColumnById(this,"radiusValue",e),m=this.getAxisInnerRadius(),g=this.getSeriesDomain(St.Radius),f=(e.dataSources.get(this.id)?.data??[]).map((S,x)=>{const v=d[x],b=u[x],k=c.convert(v),A=this.radius+m-p.convert(b),I=Math.cos(k),D=Math.sin(k),N=I*A,R=D*A;let C;if(l.enabled){const w=this.getLabelText(b,S,s,"radius",g,l,{value:b,datum:S,angleKey:i,radiusKey:s,angleName:o,radiusName:a,legendItemName:n});if(w){let G="right";cd(I,0)?G="center":I>0&&(G="left");let _="bottom";cd(D,0)?_="middle":D>0&&(_="top"),C={x:N+I*r.size,y:R+D*r.size,text:w,textAlign:G,textBaseline:_}}}return{series:this,datum:S,datumIndex:x,index:x,point:{x:N,y:R,size:r.size},midPoint:{x:N,y:R},label:C,angleValue:v,radiusValue:b,missing:!ld(k)||!ld(A)}});return{itemId:s,nodeData:f,labelData:f,styles:EM(this,this.properties,r)}}update({seriesRect:e}){const t=this.checkResize(e),i=!this.ctx.animationManager.isSkipped(),{series:s}=this.ctx.highlightManager?.getActiveHighlight()??{};this.highlightGroup.visible=(i||this.visible)&&s===this,this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updatePathSelections(),this.updateMarkerSelection(),this.updateHighlightSelection(),this.updatePathNodes(),this.hasItemStylers()&&(this.updateDatumStyles(this.itemSelection,!1),this.updateDatumStyles(this.highlightSelection,!0)),this.updateMarkers(this.itemSelection,!1),this.updateMarkers(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updatePathSelections(){const e=this.visible?[!0]:[];this.lineSelection.update(e)}updateMarkerSelection(){const{marker:e,styler:t}=this.properties;e.isDirty()&&(this.itemSelection.clear(),this.itemSelection.cleanup(),this.itemSelection=ur.select(this.itemGroup,()=>this.nodeFactory(),!1));const i=t==null?e.enabled:this.getStyle(!1).marker.enabled,s=this.visible&&e.shape&&i?this.nodeData:[];this.itemSelection.update(s)}updateHighlightSelection(){const{marker:e,styler:t}=this.properties;e.isDirty()&&(this.highlightSelection.clear(),this.highlightSelection.cleanup(),this.highlightSelection=ur.select(this.highlightGroup,()=>this.nodeFactory(),!1));const i=t==null?e.enabled:this.getStyle(!1).marker.enabled,s=this.ctx.highlightManager?.getActiveHighlight(),o=this.visible&&e.shape&&i&&s?.datum?[{...s}]:[];this.highlightSelection.update(o)}getMarkerFill(e){return e?.fill??this.getStyle(!1).marker.fill}getDatumStylerProperties(e){const{id:t,properties:i}=this,{angleKey:s,radiusKey:o}=i;return{seriesId:t,datum:e,angleKey:s,radiusKey:o}}updateDatumStyles(e,t){const i=this.ctx.highlightManager.getActiveHighlight();e.each((s,o)=>{const a=this.getHighlightState(i,t,o.datumIndex),n=this.getStyle(t,a),{stroke:r,strokeWidth:l,strokeOpacity:c}=n;o.style=this.getMarkerStyle(this.properties.marker,o,this.getDatumStylerProperties(o.datum),{isHighlight:t,highlightState:a},n.marker,{stroke:r,strokeWidth:l,strokeOpacity:c})})}updateMarkers(e,t){const i=this.getShapeFillBBox(),{contextNodeData:s}=this;if(!s)return;const o=this.ctx.highlightManager.getActiveHighlight();e.each((a,n)=>{const r=n.style??s.styles[this.getHighlightState(o,t,n.datumIndex)];this.applyMarkerStyle(r,a,n.point,i)})}updateLabels(){const{properties:e}=this,t=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((i,s)=>{s.label&&(i.fillOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1,wM(this,i,e,e.label,s.label,!1,t))})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:o,properties:a}=this,{angleKey:n,angleName:r,radiusKey:l,radiusName:c,legendItemName:p,tooltip:d,marker:u}=a,m=o[St.Angle],g=o[St.Radius];if(!i||!s||!m||!g)return;const y=s.dataSources.get(this.id)?.data[e],f=i.resolveColumnById(this,"angleValue",s)[e],S=i.resolveColumnById(this,"radiusValue",s)[e];if(f==null)return;const x=this.getMarkerStyle(u,{datum:y,datumIndex:e},this.getDatumStylerProperties(y),{isHighlight:!1});return this.formatTooltipWithContext(d,{heading:this.getAxisValueText(m,"tooltip",f,y,n,void 0),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(g,"tooltip",S,y,l,void 0)}]},{seriesId:t,datum:y,title:r,angleKey:n,radiusKey:l,angleName:r,radiusName:c,legendItemName:p,...x})}legendItemSymbol(){const{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:s,marker:o}=this.getStyle(!1);return{marker:{shape:o.shape,enabled:o.enabled||t<=0,fill:this.getMarkerFill()??o.stroke??e??"rgba(0, 0, 0, 0)",stroke:o.stroke??e??"rgba(0, 0, 0, 0)",fillOpacity:o.fillOpacity,strokeOpacity:o.strokeOpacity,strokeWidth:o.strokeWidth,lineDash:o.lineDash,lineDashOffset:o.lineDashOffset},line:{stroke:e,strokeOpacity:i,strokeWidth:t,lineDash:s}}}getLegendData(e){if(e!=="category")return[];const{id:t,ctx:{legendManager:i},visible:s}=this,{radiusKey:o,radiusName:a,legendItemName:n,showInLegend:r}=this.properties;return[{legendType:"category",id:t,itemId:o,seriesId:t,enabled:s&&i.getItemEnabled({seriesId:t,itemId:o}),label:{text:n??a??o},symbol:this.legendItemSymbol(),legendItemName:n,hideInLegend:!r}]}pickNodeClosestDatum(e){const{nodeData:t,centerX:i,centerY:s}=this,{x:o,y:a}=e,n=this.radius;if(Math.hypot(o-i,a-s)>n+this.properties.marker.size)return;let l=1/0,c;for(const p of t){const{point:{x:d=Number.NaN,y:u=Number.NaN}={}}=p;if(Number.isNaN(d)||Number.isNaN(u))continue;const m=Math.hypot(e.x-d-i,e.y-u-s);mthis.animatePaths(s),onStop:()=>this.animatePaths(1)}),AM(this,i,"added",e),IM(this,"labels",i,t)}animateWaitingUpdateReady(e){super.animateWaitingUpdateReady(e),this.resetPaths()}animateReadyResize(e){super.animateReadyResize(e),this.resetPaths()}resetPaths(){const e=this.getLineNode();if(e){const{path:t}=e,i=this.getLinePoints(),s=this.getStyle(!1);e.fill=void 0,e.stroke=s.stroke,e.strokeWidth=s.strokeWidth,e.strokeOpacity=s.strokeOpacity,e.lineDash=s.lineDash,e.lineDashOffset=s.lineDashOffset,t.clear(!0);for(const{x:o,y:a,moveTo:n}of i)n?t.moveTo(o,a):t.lineTo(o,a);return e.checkPathDirty(),s}}getStylerResult(e,t,i){const{styler:s}=this.properties;if(s){const o=this.makeStylerParams(t,i),a=this.cachedCallWithContext(s,o)??{},n=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],a,{pick:!1});n&&(e=n)}return e}getFormattedMarkerStyle(e){const{angleKey:t,radiusKey:i}=this.properties;return this.getMarkerStyle(this.properties.marker,e,{angleKey:t,radiusKey:i},{isHighlight:!0})}computeFocusBounds(e){return LM(this,e)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};gr.className="RadarSeries";import{_ModuleSupport as GM}from"ag-charts-community";var{Property:dd}=GM,mr=class extends ze{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1}};h([dd],mr.prototype,"fill",2),h([dd],mr.prototype,"fillOpacity",2);var{ChartAxisDirection:ud,Group:VM,HighlightState:KM,Path:WM,PointerEvents:gd,Selection:zM,applyShapeStyle:md,toHighlightString:$M}=rd,ha=class extends gr{constructor(e){super(e),this.properties=new mr,this.areaGroup=this.contentGroup.appendChild(new VM({name:"radar-area"})),this.areaSelection=zM.select(this.areaGroup,WM),this.resetInvalidToZero=!0,this.areaGroup.zIndex=-1}updatePathSelections(){const e=this.visible?[!0]:[];this.areaSelection.update(e),super.updatePathSelections()}getAreaNode(){return this.areaSelection.at(0)}getMarkerFill(e){if(e?.fill!=null)return e.fill;const t=this.getStyle(!1);return t.marker.fill??t.fill}updatePathNodes(){const e=this.getPathNodesStyle(),{fill:t,fillOpacity:i,strokeWidth:s,stroke:o,strokeOpacity:a,lineDash:n,lineDashOffset:r,opacity:l}=e,c=this.getLineNode();c&&c.setProperties({fill:void 0,lineJoin:"round",lineCap:"round",pointerEvents:gd.None,opacity:l,stroke:o,strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r});const p=this.getAreaNode();p&&(md(p,{fill:t,fillOpacity:i,stroke:void 0},this.getShapeFillBBox()),p.setProperties({lineJoin:"round",pointerEvents:gd.None,opacity:l}))}animatePaths(e){super.animatePaths(e);const t=this.getAreaNode();t&&this.animateSinglePath(t,this.getAreaPoints(),e)}getAreaPoints(){const e=this.getLinePoints(),t=n=>{const r=this.axes[n];return r instanceof rd.PolarAxis?r:void 0},i=t(ud.Radius),s=t(ud.Angle);if(!i?.isReversed())return e;const a=s?.getAxisLinePoints()?.points??[];return e.concat(...a)}resetPaths(){const e=super.resetPaths(),t=this.getAreaNode();if(t){const{path:i}=t,s=this.getAreaPoints(),o=e??this.getStyle(!1),a=this.getShapeFillBBox();md(t,{fill:o.fill,stroke:void 0,fillOpacity:o.fillOpacity,lineDash:o.lineDash,lineDashOffset:o.lineDashOffset},a),t.lineJoin=t.lineCap="round",i.clear(!0);for(const{x:n,y:r,moveTo:l,arc:c,radius:p=0,startAngle:d=0,endAngle:u=0}of s)c?i.arc(n,r,p,d,u):l?i.moveTo(n,r):i.lineTo(n,r);return i.closePath(),t.checkPathDirty(),o}}makeStylerParams(e,t){const{properties:i}=this,s=$M(t??KM.None);return{marker:{fill:i.marker.fill,fillOpacity:i.marker.fillOpacity,size:i.marker.size,shape:i.marker.shape,stroke:i.marker.stroke,strokeOpacity:i.marker.strokeOpacity,strokeWidth:i.marker.strokeWidth,lineDash:i.marker.lineDash,lineDashOffset:i.marker.lineDashOffset},highlightState:s,highlighted:e,fill:i.fill,fillOpacity:i.fillOpacity,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,seriesId:this.id,stroke:i.stroke,strokeOpacity:i.strokeOpacity,strokeWidth:i.strokeWidth,angleKey:i.angleKey,radiusKey:i.radiusKey}}getStyle(e,t){const{marker:i,fill:s,fillOpacity:o,lineDash:a,lineDashOffset:n,stroke:r,strokeOpacity:l,strokeWidth:c}=this.properties,{size:p,shape:d,fill:u="transparent",fillOpacity:m}=i,g=this.getStylerResult({},e,t);return g.marker??(g.marker={}),{fill:g.fill??s,fillOpacity:g.fillOpacity??o,lineDash:g.lineDash??a,lineDashOffset:g.lineDashOffset??n,stroke:g.stroke??r,strokeOpacity:g.strokeOpacity??l,strokeWidth:g.strokeWidth??c,marker:{enabled:g.marker.enabled??i.enabled,fill:g.marker.fill??u,fillOpacity:g.marker.fillOpacity??m,shape:g.marker.shape??d,size:g.marker.size??p,lineDash:g.marker.lineDash??i.lineDash??a,lineDashOffset:g.marker.lineDashOffset??i.lineDashOffset??n,stroke:g.marker.stroke??i.stroke??r,strokeOpacity:g.marker.strokeOpacity??i.strokeOpacity??l,strokeWidth:g.marker.strokeWidth??i.strokeWidth??c}}}};ha.className="RadarAreaSeries",ha.type="radar-area";import{_ModuleSupport as HM}from"ag-charts-community";import{constant as XM,required as yr,string as Vs}from"ag-charts-core";var{commonSeriesOptionsDefs:YM,radarAreaSeriesThemeableOptionsDef:UM}=HM,qM={...YM,...UM,type:yr(XM("radar-area")),angleKey:yr(Vs),radiusKey:yr(Vs),angleName:Vs,radiusName:Vs,legendItemName:Vs},{ThemeConstants:{POLAR_AXIS_TYPE:yd}}=pM,YC={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radar-area",moduleFactory:e=>new ha(e),defaultAxes:[{type:yd.ANGLE_CATEGORY},{type:yd.RADIUS_NUMBER}],themeTemplate:gM},fd={type:"series",name:"radar-area",chartType:"polar",enterprise:!0,options:qM,create:e=>new ha(e)};import{_ModuleSupport as jM}from"ag-charts-community";import{_ModuleSupport as JM}from"ag-charts-community";var{HighlightState:ZM,PointerEvents:QM,toHighlightString:eN}=JM,pa=class extends gr{constructor(){super(...arguments),this.properties=new ze}updatePathSelections(){this.lineSelection.update(this.visible?[!0]:[])}updatePathNodes(){const e=this.getLineNode();if(!e)return;const t=this.getPathNodesStyle(),{strokeWidth:i,stroke:s,strokeOpacity:o,lineDash:a,lineDashOffset:n,opacity:r}=t;e.setProperties({fill:void 0,lineJoin:"round",lineCap:"round",pointerEvents:QM.None,opacity:r,stroke:s,strokeWidth:i,strokeOpacity:o,lineDash:a,lineDashOffset:n})}makeStylerParams(e,t){const{properties:i}=this,s=eN(t??ZM.None);return{marker:{fill:i.marker.fill,fillOpacity:i.marker.fillOpacity,size:i.marker.size,shape:i.marker.shape,stroke:i.marker.stroke,strokeOpacity:i.marker.strokeOpacity,strokeWidth:i.marker.strokeWidth,lineDash:i.marker.lineDash,lineDashOffset:i.marker.lineDashOffset},highlightState:s,highlighted:e,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,seriesId:this.id,stroke:i.stroke,strokeOpacity:i.strokeOpacity,strokeWidth:i.strokeWidth,angleKey:i.angleKey,radiusKey:i.radiusKey}}getStyle(e,t){const{marker:i,lineDash:s,lineDashOffset:o,stroke:a,strokeOpacity:n,strokeWidth:r}=this.properties,{size:l,shape:c,fill:p="transparent",fillOpacity:d}=i,u=this.getStylerResult({},e,t);return u.marker??(u.marker={}),{lineDash:u.lineDash??s,lineDashOffset:u.lineDashOffset??o,stroke:u.stroke??a,strokeOpacity:u.strokeOpacity??n,strokeWidth:u.strokeWidth??r,marker:{enabled:u.marker.enabled??i.enabled,fill:u.marker.fill??p,fillOpacity:u.marker.fillOpacity??d,shape:u.marker.shape??c,size:u.marker.size??l,lineDash:u.marker.lineDash??i.lineDash??s,lineDashOffset:u.marker.lineDashOffset??i.lineDashOffset??o,stroke:u.marker.stroke??i.stroke??a,strokeOpacity:u.marker.strokeOpacity??i.strokeOpacity??n,strokeWidth:u.marker.strokeWidth??i.strokeWidth??r}}}};pa.className="RadarLineSeries",pa.type="radar-line";import{_ModuleSupport as tN}from"ag-charts-community";import{constant as iN,required as fr,string as Ks}from"ag-charts-core";var{commonSeriesOptionsDefs:sN,radarLineSeriesThemeableOptionsDef:oN}=tN,aN={...sN,...oN,type:fr(iN("radar-line")),angleKey:fr(Ks),radiusKey:fr(Ks),angleName:Ks,radiusName:Ks,legendItemName:Ks},{POLAR_AXIS_TYPE:Sd}=jM.ThemeConstants,ZC={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radar-line",moduleFactory:e=>new pa(e),defaultAxes:[{type:Sd.ANGLE_CATEGORY},{type:Sd.RADIUS_NUMBER}],themeTemplate:uM},xd={type:"series",name:"radar-line",chartType:"polar",enterprise:!0,options:aN,create:e=>new pa(e)};import{_ModuleSupport as nN}from"ag-charts-community";import{_ModuleSupport as Ws}from"ag-charts-community";import{isDefined as rN}from"ag-charts-core";function lN(e){return typeof e?.datum=="object"?e.datum:null}import{_ModuleSupport as cN}from"ag-charts-community";var{SeriesProperties:hN,makeSeriesTooltip:pN,Property:_e,Label:dN}=cN,Le=class extends hN{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.label=new dN,this.tooltip=pN()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n,cornerRadius:r}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n,cornerRadius:r,opacity:1}}};h([_e],Le.prototype,"angleKey",2),h([_e],Le.prototype,"radiusKey",2),h([_e],Le.prototype,"angleName",2),h([_e],Le.prototype,"radiusName",2),h([_e],Le.prototype,"legendItemName",2),h([_e],Le.prototype,"fill",2),h([_e],Le.prototype,"fillOpacity",2),h([_e],Le.prototype,"stroke",2),h([_e],Le.prototype,"strokeWidth",2),h([_e],Le.prototype,"strokeOpacity",2),h([_e],Le.prototype,"lineDash",2),h([_e],Le.prototype,"lineDashOffset",2),h([_e],Le.prototype,"cornerRadius",2),h([_e],Le.prototype,"styler",2),h([_e],Le.prototype,"itemStyler",2),h([_e],Le.prototype,"rotation",2),h([_e],Le.prototype,"stackGroup",2),h([_e],Le.prototype,"normalizedTo",2),h([_e],Le.prototype,"label",2),h([_e],Le.prototype,"tooltip",2);import{_ModuleSupport as uN}from"ag-charts-community";var{SectorBox:bd,motion:gN}=uN;function mN(e,t,i){if(i==="updated"){if(e.previousDatum==null||Number.isNaN(e.previousDatum.innerRadius)||Number.isNaN(e.previousDatum.outerRadius))return"added";if(Number.isNaN(t.innerRadius)||Number.isNaN(t.outerRadius))return"removed"}return i==="added"&&e.previousDatum!=null?"updated":i}function vd(e){return{toFn:(s,o,a)=>{let n,r,l,c,p;return a==="removed"?(n=e,r=e,l=o.innerRadius,c=o.outerRadius,p=new bd(n,r,l,c)):(n=o.startAngle,r=o.endAngle,l=Number.isNaN(o.innerRadius)?s.innerRadius:o.innerRadius,c=Number.isNaN(o.outerRadius)?s.outerRadius:o.outerRadius,p=o.clipSector),{startAngle:n,endAngle:r,innerRadius:l,outerRadius:c,clipSector:p}},fromFn:(s,o,a)=>{a=mN(s,o,a);let n,r,l,c,p;a==="removed"||a==="updated"?(n=s.startAngle,r=s.endAngle,l=s.innerRadius,c=s.outerRadius,p=s.clipSector):(n=e,r=e,l=o.innerRadius,c=o.outerRadius),p??(p=new bd(n,r,l,c));const d=gN.NODE_UPDATE_STATE_TO_PHASE_MAPPING[a];return{startAngle:n,endAngle:r,innerRadius:l,outerRadius:c,clipSector:p,phase:d}}}}function yN(e,t){return{centerX:0,centerY:0,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,clipSector:t.clipSector}}var{DEFAULT_POLAR_DIRECTION_KEYS:fN,DEFAULT_POLAR_DIRECTION_NAMES:SN,ChartAxisDirection:Kt,PolarAxis:xN,diff:bN,groupAccumulativeValueProperty:kd,keyProperty:vN,normaliseGroupTo:kN,valueProperty:DN,fixNumericExtent:IN,resetLabelFn:AN,seriesLabelFadeInAnimation:MN,seriesLabelFadeOutAnimation:NN,animationValidation:LN,angleBetween:TN,createDatumId:RN,CategoryScale:PN,Sector:CN,SectorBox:ON,motion:Dd,isGradientFill:_N,applyShapeStyle:wN,updateLabelNode:EN,getItemStyles:FN}=Ws,BN=class extends Ws.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey}},da=class extends Ws.PolarSeries{constructor(e){super({moduleCtx:e,categoryKey:"radiusValue",propertyKeys:fN,propertyNames:SN,canHaveAxes:!0,animationResetFns:{item:yN,label:AN}}),this.properties=new Le,this.NodeEvent=BN,this.groupScale=new PN,this.circleCache={r:0,cx:0,cy:0}}get hasData(){return this.getHasData("angleValue-raw")}nodeFactory(){return new CN}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===Kt.Angle){const s=t.getDomain(this,"angleValue-end","value",i),o=[Math.min(s[0],0),Math.max(s[1],0)];return IN(o)}else return t.getDomain(this,"radiusValue","key",i)}async processData(e){const{angleKey:t,radiusKey:i,normalizedTo:s}=this.properties,o=!this.ctx.animationManager.isSkipped(),a=this.getStackId(),n=`${a}-trailing`,r=[];rN(s)&&r.push(kN([a,n],Math.abs(s))),o&&(this.processedData&&r.push(bN(this.id,this.processedData)),r.push(LN()));const l=this.visible?{}:{forceValue:0},c=this.axes[Kt.Radius]?.scale.type,p=this.axes[Kt.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[vN(i,c,{id:"radiusValue"}),DN(t,p,{id:"angleValue-raw",invalidValue:null,...l}),...kd(t,"normal",{id:"angleValue-end",rangeId:"angleValue-range",invalidValue:null,groupId:a,separateNegative:!0,...l},p),...kd(t,"trailing",{id:"angleValue-start",invalidValue:null,groupId:n,separateNegative:!0,...l},p),...r],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,s=this.circleCache;return e===s.r&&t===s.cx&&i===s.cy?!1:(this.circleCache={r:e,cx:t,cy:i},!0)}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}getAxisInnerRadius(){const e=this.axes[Kt.Radius];return e instanceof xN?this.radius*e.innerRadiusRatio:0}createNodeData(){const{processedData:e,dataModel:t}=this;if(!t||!e||e.type!=="grouped")return;const i=this.axes[Kt.Angle],s=this.axes[Kt.Radius],o=i?.scale,a=s?.scale;if(!o||!a)return;const n=t.resolveKeysById(this,"radiusValue",e),r=t.resolveColumnById(this,"angleValue-start",e),l=t.resolveColumnById(this,"angleValue-end",e),c=t.resolveColumnById(this,"angleValue-raw",e),p=t.resolveProcessedDataIndexById(this,"angleValue-range");let d=0;s instanceof ui&&(d=s.groupPaddingInner);const{groupScale:u}=this,{index:m,visibleGroupCount:g}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);u.domain=Array.from({length:g}).map((T,M)=>String(M)),u.range=[0,Math.abs(a.bandwidth??0)],u.paddingInner=g>1?d:0;const y=u.bandwidth>=1?u.bandwidth:u.rawBandwidth,f=i.isReversed(),S=s.isReversed(),x=S?this.radius:this.getAxisInnerRadius(),b=(S?this.getAxisInnerRadius():this.radius)+x,k=this.getSeriesDomain(Kt.Angle),{angleKey:A,radiusKey:I,angleName:D,radiusName:N,legendItemName:R,label:C}=this.properties,w=(T,M,O,B)=>{const F=this.getLabelText(M,T,A,"angle",k,C,{value:M,datum:T,angleKey:A,radiusKey:I,angleName:D,radiusName:N,legendItemName:R});if(F)return{x:O,y:B,text:F,textAlign:"center",textBaseline:"middle"}},G=[],_=FN((T,M,O)=>as(this,T,M,O)),E={itemId:I,nodeData:G,labelData:G,styles:_};if(!this.visible)return E;const{dataSources:L}=e,P=L.get(this.id)?.data??[];for(const{datumIndex:T,group:M}of t.forEachGroupDatum(this,e)){const O=P[T],B=n[T];if(B==null)return;const F=c[T],V=r[T],W=l[T],K=F>=0&&!Object.is(F,-0),z=M.aggregation[p][K?1:0],$=K===f;let Z=o.convert(V,{clamp:!0}),q=o.convert(W,{clamp:!0}),Y=o.convert(0,{clamp:!0}),Q=o.convert(z,{clamp:!0});$&&([Y,Q]=[Q,Y],[Z,q]=[q,Z]);const U=b-a.convert(B)+u.convert(String(m)),ce=U+y,ae=(U+ce)/2,j=Z+TN(Z,q)/2,re=Math.cos(j)*ae,se=Math.sin(j)*ae,ue=this.properties.label.enabled?w(O,F,re,se):void 0,le=new ON(Z,q,U,ce);G.push({series:this,datum:O,datumIndex:T,point:{x:re,y:se,size:0},midPoint:{x:re,y:se},label:ue,angleValue:F,radiusValue:B,innerRadius:U,outerRadius:ce,startAngle:Y,endAngle:Q,clipSector:le,reversed:$,index:T})}return E}update({seriesRect:e}){const t=this.checkResize(e);this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updateSectorSelection(this.itemSelection,!1),this.updateSectorSelection(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updateSectorSelection(e,t){let i=[];const s=this.ctx.highlightManager?.getActiveHighlight();t?s?.datum&&s.series===this&&i.push(s):i=this.nodeData;const{contextNodeData:o}=this;if(!o)return;const a=this.ctx.highlightManager.getActiveHighlight(),n=this.getShapeFillBBox(),r=this.hasItemStylers();e.update(i,void 0,l=>this.getDatumId(l)).each((l,c)=>{const p=lN(c);if(p==null)return;if(r){const y=this.getHighlightState(s,t,c.datumIndex);c.style=as(this,c,t,y)}const d=c.style??o.styles[this.getHighlightState(a,t,c.datumIndex)],u=d.cornerRadius,m=d.fill,g=Ws.isGradientFill(m)&&m.bounds!=="item"?{centerX:0,centerY:0}:void 0;wN(l,d,n,g),l.lineJoin="round",l.inset=l.stroke==null?0:l.strokeWidth/2,l.startInnerCornerRadius=p.reversed?u:0,l.startOuterCornerRadius=p.reversed?u:0,l.endInnerCornerRadius=p.reversed?0:u,l.endOuterCornerRadius=p.reversed?0:u,t&&(l.startAngle=c.startAngle,l.endAngle=c.endAngle,l.clipSector=c.clipSector,l.innerRadius=c.innerRadius,l.outerRadius=c.outerRadius)})}updateLabels(){const{properties:e}=this,t=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((i,s)=>{EN(this,i,e,e.label,s.label,!1,t),i.fillOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1})}getBarTransitionFunctions(){const e=this.axes[Kt.Angle]?.scale;let t=0;if(!e)return vd(t);const i=Math.min(e.domain[0],e.domain[1]),s=Math.max(e.domain[0],e.domain[1]);return i<=0&&s>=0&&(t=e.convert(0)),vd(t)}animateEmptyUpdateReady(){const{labelSelection:e}=this,t=this.getBarTransitionFunctions();Dd.fromToMotion(this.id,"datums",this.ctx.animationManager,[this.itemSelection],t),MN(this,"labels",this.ctx.animationManager,e)}animateClearingUpdateEmpty(){const{itemSelection:e}=this,{animationManager:t}=this.ctx,i=this.getBarTransitionFunctions();Dd.fromToMotion(this.id,"datums",t,[e],i),NN(this,"labels",t,this.labelSelection)}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:o,properties:a}=this,{angleKey:n,angleName:r,radiusKey:l,radiusName:c,legendItemName:p,tooltip:d}=a,u=o[Kt.Angle],m=o[Kt.Radius],g=this.nodeData?.[e];if(!i||!s||!u||!m||!g)return;const y=s.dataSources.get(this.id)?.data[e],f=i.resolveKeysById(this,"radiusValue",s)[e],S=i.resolveColumnById(this,"angleValue-raw",s)[e];if(f==null)return;const x=as(this,g,!1);return this.formatTooltipWithContext(d,{heading:this.getAxisValueText(m,"tooltip",f,y,l,void 0),symbol:this.legendItemSymbol(),data:[{label:r,fallbackLabel:n,value:this.getAxisValueText(u,"tooltip",S,y,n,void 0)}]},{seriesId:t,datum:y,title:r,angleKey:n,angleName:r,radiusKey:l,radiusName:c,legendItemName:p,...x})}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.itemSelection.nodes())}legendItemSymbol(){const{fill:e,stroke:t,fillOpacity:i,strokeOpacity:s,strokeWidth:o,lineDash:a,lineDashOffset:n}=ir(this,!1,!1,Ws.HighlightState.None),r={fill:e??"rgba(0, 0, 0, 0)",stroke:t??"rgba(0, 0, 0, 0)",fillOpacity:i,strokeOpacity:s,strokeWidth:o,lineDash:a,lineDashOffset:n};return _N(r.fill)&&(r.fill={...r.fill,gradient:"linear",rotation:0,reverse:!1}),{marker:r}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{angleKey:s,angleName:o,legendItemName:a,showInLegend:n}=this.properties;return[{legendType:"category",id:t,itemId:s,seriesId:t,enabled:i,label:{text:a??o??s},symbol:this.legendItemSymbol(),legendItemName:a,hideInLegend:!n}]}getDatumId(e){return RN(e.radiusValue)}computeLabelsBBox(){return null}getStackId(){return`radialBar-stack-${this.seriesGrouping?.groupIndex??this.id}-xValues`}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};da.className="RadialBarSeries",da.type="radial-bar";import{_ModuleSupport as GN}from"ag-charts-community";import{boolean as Id,constant as VN,number as KN,required as Sr,string as rs}from"ag-charts-core";var{commonSeriesOptionsDefs:WN,radialBarSeriesThemeableOptionsDef:zN}=GN,$N={...WN,...zN,type:Sr(VN("radial-bar")),angleKey:Sr(rs),radiusKey:Sr(rs),angleName:rs,radiusName:rs,legendItemName:rs,grouped:Id,stacked:Id,stackGroup:rs,normalizedTo:KN};import{_ModuleSupport as xr}from"ag-charts-community";var{ThemeConstants:{POLAR_AXIS_TYPE:HN},FILL_GRADIENT_CONIC_SERIES_DEFAULTS:XN,FILL_IMAGE_DEFAULTS:YN,FILL_PATTERN_DEFAULTS:UN}=xr,qN={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",XN],["image",YN],["pattern",UN]]},stroke:{$palette:"stroke"},strokeWidth:{$isUserOption:["./stroke",1,0]},label:{...xr.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},highlight:xr.multiSeriesHighlightStyle()},axes:{[HN.RADIUS_CATEGORY]:{innerRadiusRatio:.2,groupPaddingInner:.2,paddingInner:.2,paddingOuter:.1}}},{POLAR_AXIS_TYPE:Ad}=nN.ThemeConstants,rO={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radial-bar",moduleFactory:e=>new da(e),defaultAxes:[{type:Ad.ANGLE_NUMBER},{type:Ad.RADIUS_CATEGORY}],themeTemplate:qN,stackable:!0,groupable:!0},Md={type:"series",name:"radial-bar",chartType:"polar",enterprise:!0,options:$N,create:e=>new da(e)};import{_ModuleSupport as jN}from"ag-charts-community";import{_ModuleSupport as JN}from"ag-charts-community";import{_ModuleSupport as ZN}from"ag-charts-community";var{Property:Nd}=ZN,br=class extends Ae{};h([Nd],br.prototype,"columnWidthRatio",2),h([Nd],br.prototype,"maxColumnWidthRatio",2);var{ChartAxisDirection:QN,PolarAxis:e2,RadialColumnShape:t2,getRadialColumnWidth:i2}=JN,ua=class extends Kp{constructor(e){super(e,{animationResetFns:{item:LA}}),this.properties=new br}getStackId(){return`radarColumn-stack-${this.seriesGrouping?.groupIndex??this.id}-yValues`}nodeFactory(){return new t2}getColumnTransitionFunctions(){const e=this.isRadiusAxisReversed()?this.radius:this.getAxisInnerRadius();return NA(e)}isRadiusAxisCircle(){const e=this.axes[QN.Radius];return e instanceof e2?e.shape==="circle":!1}updateItemPath(e,t,i){e.isBeveled=this.isRadiusAxisCircle(),e.isRadiusAxisReversed=this.isRadiusAxisReversed(),i&&(e.innerRadius=t.innerRadius,e.outerRadius=t.outerRadius,e.startAngle=t.startAngle,e.endAngle=t.endAngle,e.columnWidth=t.columnWidth,e.axisInnerRadius=t.axisInnerRadius,e.axisOuterRadius=t.axisOuterRadius)}getColumnWidth(e,t){const{columnWidthRatio:i=.5,maxColumnWidthRatio:s=.5}=this.properties;return i2(e,t,this.radius,i,s)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};ua.className="RadialColumnSeries",ua.type="radial-column";import{_ModuleSupport as s2}from"ag-charts-community";import{boolean as Ld,constant as o2,number as a2,required as vr,string as ls}from"ag-charts-core";var{commonSeriesOptionsDefs:n2,radialColumnSeriesThemeableOptionsDef:r2}=s2,l2={...n2,...r2,type:vr(o2("radial-column")),angleKey:vr(ls),radiusKey:vr(ls),angleName:ls,radiusName:ls,legendItemName:ls,grouped:Ld,stacked:Ld,stackGroup:ls,normalizedTo:a2};import{_ModuleSupport as kr}from"ag-charts-community";var{ThemeConstants:{POLAR_AXIS_TYPE:Td,POLAR_AXIS_SHAPE:Rd},FILL_GRADIENT_RADIAL_SERIES_DEFAULTS:c2,FILL_IMAGE_DEFAULTS:h2,FILL_PATTERN_DEFAULTS:p2}=kr,d2={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",c2],["image",h2],["pattern",p2]]},stroke:{$palette:"stroke"},columnWidthRatio:.5,maxColumnWidthRatio:.5,strokeWidth:{$isUserOption:["./stroke",1,0]},label:{...kr.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:kr.multiSeriesHighlightStyle()},axes:{[Td.ANGLE_CATEGORY]:{shape:{$findFirstSiblingNotOperation:Rd.CIRCLE},groupPaddingInner:0,paddingInner:0,label:{spacing:10}},[Td.RADIUS_NUMBER]:{shape:{$findFirstSiblingNotOperation:Rd.CIRCLE},innerRadiusRatio:.5}}},{POLAR_AXIS_TYPE:Pd}=jN.ThemeConstants,gO={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radial-column",moduleFactory:e=>new ua(e),defaultAxes:[{type:Pd.ANGLE_CATEGORY},{type:Pd.RADIUS_NUMBER}],themeTemplate:d2,stackable:!0,groupable:!0},Cd={type:"series",name:"radial-column",chartType:"polar",enterprise:!0,options:l2,create:e=>new ua(e)};import{_ModuleSupport as cs}from"ag-charts-community";import{_ModuleSupport as Ri}from"ag-charts-community";import{cachedTextMeasurer as u2,isArray as g2,measureTextSegments as m2,toPlainText as y2}from"ag-charts-core";import{_ModuleSupport as f2}from"ag-charts-community";var{SvgPath:S2,Rotatable:x2,Translatable:b2,Scalable:v2}=f2,Dr=class extends x2(v2(b2(S2))){constructor(){super(...arguments),this.scalingCenterX=.5,this.scalingCenterY=.5,this.rotationCenterX=.5,this.rotationCenterY=.5}};Dr.defaultPathData="M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z";import{_ModuleSupport as ga}from"ag-charts-community";var{getColorStops:k2,normalizeAngle360:D2,normalizeAngle360Inclusive:I2,toDegrees:A2}=ga,{BaseProperties:zs,makeSeriesTooltip:M2,SeriesProperties:N2,PropertiesArray:Ir,AxisLabel:L2,Property:H,Label:T2}=ga,Od=class extends T2{};h([H],Od.prototype,"spacing",2);var qe=class extends zs{constructor(){super(...arguments),this.label=new Od}getStyle(){const{fill:e="black",fillOpacity:t=1,stroke:i="black",strokeWidth:s=0,strokeOpacity:o=1,lineDash:a=[0],lineDashOffset:n=0}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:n}}};h([H],qe.prototype,"text",2),h([H],qe.prototype,"value",2),h([H],qe.prototype,"shape",2),h([H],qe.prototype,"placement",2),h([H],qe.prototype,"spacing",2),h([H],qe.prototype,"size",2),h([H],qe.prototype,"rotation",2),h([H],qe.prototype,"fill",2),h([H],qe.prototype,"fillOpacity",2),h([H],qe.prototype,"stroke",2),h([H],qe.prototype,"strokeWidth",2),h([H],qe.prototype,"strokeOpacity",2),h([H],qe.prototype,"lineDash",2),h([H],qe.prototype,"lineDashOffset",2),h([H],qe.prototype,"label",2);var Lt=class extends zs{constructor(){super(...arguments),this.enabled=!0,this.fills=new Ir(ga.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t){const{enabled:i,fill:s,fills:o,fillMode:a,fillOpacity:n,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:p,lineDashOffset:d}=this;return{fill:i?s??Ed(o,a,e,t):"none",fillOpacity:n,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:p,lineDashOffset:d}}};h([H],Lt.prototype,"enabled",2),h([H],Lt.prototype,"fills",2),h([H],Lt.prototype,"fillMode",2),h([H],Lt.prototype,"fill",2),h([H],Lt.prototype,"fillOpacity",2),h([H],Lt.prototype,"stroke",2),h([H],Lt.prototype,"strokeWidth",2),h([H],Lt.prototype,"strokeOpacity",2),h([H],Lt.prototype,"lineDash",2),h([H],Lt.prototype,"lineDashOffset",2);var $s=class extends zs{constructor(){super(...arguments),this.values=void 0,this.step=void 0,this.minSpacing=0,this.maxSpacing=1e3}};h([H],$s.prototype,"values",2),h([H],$s.prototype,"step",2),h([H],$s.prototype,"minSpacing",2),h([H],$s.prototype,"maxSpacing",2);var R2=class extends L2{},st=class extends zs{constructor(){super(...arguments),this.min=0,this.max=1,this.fills=new Ir(ga.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.defaultFill="black",this.interval=new $s,this.label=new R2}getStyle(e,t,i){const{fill:s,fills:o,defaultFill:a,fillMode:n,fillOpacity:r,stroke:l,strokeWidth:c,strokeOpacity:p,lineDash:d,lineDashOffset:u}=this;return{fill:s??(e&&o.length===0?a:void 0)??Ed(o,n,t,i),fillOpacity:r,stroke:l,strokeWidth:c,strokeOpacity:p,lineDash:d,lineDashOffset:u}}};h([H],st.prototype,"min",2),h([H],st.prototype,"max",2),h([H],st.prototype,"fills",2),h([H],st.prototype,"fillMode",2),h([H],st.prototype,"fill",2),h([H],st.prototype,"fillOpacity",2),h([H],st.prototype,"stroke",2),h([H],st.prototype,"strokeWidth",2),h([H],st.prototype,"strokeOpacity",2),h([H],st.prototype,"lineDash",2),h([H],st.prototype,"lineDashOffset",2),h([H],st.prototype,"defaultFill",2),h([H],st.prototype,"interval",2),h([H],st.prototype,"label",2);var Tt=class extends zs{constructor(){super(...arguments),this.enabled=!0,this.spacing=0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};h([H],Tt.prototype,"enabled",2),h([H],Tt.prototype,"radiusRatio",2),h([H],Tt.prototype,"spacing",2),h([H],Tt.prototype,"fill",2),h([H],Tt.prototype,"fillOpacity",2),h([H],Tt.prototype,"stroke",2),h([H],Tt.prototype,"strokeWidth",2),h([H],Tt.prototype,"strokeOpacity",2),h([H],Tt.prototype,"lineDash",2),h([H],Tt.prototype,"lineDashOffset",2);var _d=class extends _t{};h([H],_d.prototype,"text",2);var wd=class extends As{};h([H],wd.prototype,"text",2);var Te=class extends N2{constructor(){super(...arguments),this.startAngle=0,this.endAngle=0,this.segmentation=new Os,this.defaultColorRange=[],this.targets=new Ir(qe),this.defaultTarget=new qe,this.outerRadiusRatio=1,this.innerRadiusRatio=1,this.cornerRadius=0,this.cornerMode="container",this.spacing=0,this.scale=new st,this.bar=new Lt,this.needle=new Tt,this.label=new _d,this.secondaryLabel=new wd,this.tooltip=M2()}};h([H],Te.prototype,"value",2),h([H],Te.prototype,"startAngle",2),h([H],Te.prototype,"endAngle",2),h([H],Te.prototype,"segmentation",2),h([H],Te.prototype,"defaultColorRange",2),h([H],Te.prototype,"targets",2),h([H],Te.prototype,"defaultTarget",2),h([H],Te.prototype,"outerRadiusRatio",2),h([H],Te.prototype,"innerRadiusRatio",2),h([H],Te.prototype,"outerRadius",2),h([H],Te.prototype,"innerRadius",2),h([H],Te.prototype,"cornerRadius",2),h([H],Te.prototype,"cornerMode",2),h([H],Te.prototype,"spacing",2),h([H],Te.prototype,"scale",2),h([H],Te.prototype,"bar",2),h([H],Te.prototype,"needle",2),h([H],Te.prototype,"label",2),h([H],Te.prototype,"secondaryLabel",2),h([H],Te.prototype,"tooltip",2);function Ed(e,t,i,s){const{domain:o,range:a}=s,[n,r]=a,l=D2((n+r)/2+Math.PI),c=I2(r-n);return{type:"gradient",gradient:"conic",colorSpace:"oklch",colorStops:k2(e,i,o,t).map(({color:d,stop:u})=>(u=Math.min(Math.max(u,0),1),u=(n+c*u-l)/(2*Math.PI),u=(u%1+1)%1,{stop:u,color:d})),bounds:"series",rotation:A2(l)+90}}import{_ModuleSupport as P2}from"ag-charts-community";import{toPlainText as Ar}from"ag-charts-core";var{SectorBox:Mr}=P2;function C2(e){const{startAngle:t,endAngle:i,clipStartAngle:s,clipEndAngle:o,innerRadius:a,outerRadius:n}=e;if(!(s==null||o==null))return new Mr(Math.max(s,t),Math.min(o,i),a,n)}function Fd(e,t,i){return Math.max(e,i.startAngle)<=Math.min(t,i.endAngle)}function Nr(e){return e.clipStartAngle!=null&&e.clipEndAngle!=null}function Lr(e,t){const{clipStartAngle:i,clipEndAngle:s,innerRadius:o,outerRadius:a}=e;return new Mr(i,t?i:s,o,a)}function Bd(e,t){const i=e?"initial":"update";return{node:{fromFn(a,n){const r=a.previousDatum;let{startAngle:l,endAngle:c}=r??n;const p=r!=null&&Nr(r)?Lr(r,e):void 0,d=Nr(n)?Lr(n,e):void 0;let u;return p!=null&&d!=null?u=p:p==null&&d!=null?(u=d,l=n.startAngle,c=n.endAngle):p!=null&&d==null?(u=void 0,l=n.startAngle,c=n.endAngle):e&&(c=l),{startAngle:l,endAngle:c,clipSector:u,phase:i}},toFn(a,n){const{startAngle:r,endAngle:l}=n;let c;return Nr(n)&&(c=Lr(n,!1)),{startAngle:r,endAngle:l,clipSector:c}},applyFn(a,n){const{startAngle:r,endAngle:l}=n;let{clipSector:c}=n;c!=null&&(c=new Mr(Math.max(r,c.startAngle),Math.min(l,c.endAngle),c.innerRadius,c.outerRadius));const p=c==null||Fd(r,l,c);a.startAngle=r,a.endAngle=l,a.clipSector=c,a.visible=p}},needle:{fromFn(a){let{angle:n}=a.previousDatum??a.datum;return e&&(n=t),{rotation:n,phase:i}},toFn(a,n){const{angle:r}=n;return{rotation:r}}}}}function Tr(e,t){const{startAngle:i,endAngle:s}=t,o=C2(t),a=o==null||Fd(i,s,o);return{startAngle:i,endAngle:s,clipSector:o,visible:a}}function Gd(e,t){const{angle:i}=t;return{rotation:i}}var O2={top:0,middle:.5,bottom:1};function _2(e,t,i,s,o,a){const{padding:n,textAlign:r,verticalAlign:l}=s;let c,p;if(i.each((k,A)=>{A.label==="primary"?c=A:A.label==="secondary"&&(p=A)}),c==null)return;const d=Cs(e.id,t,c,a?.label);if(d==null)return;const u=p==null?void 0:Cs(e.id,t,p,a?.secondaryLabel),m={padding:n},g=r==="center"?2:1,y=l==="middle"?2:1,f=k=>({width:Math.sqrt(Math.max(o**2-(k/y)**2,0))*g,height:Math.min(k,y*o),meta:null});let S,x,v;if(p!=null&&u!=null){const k=rc(Ar(d),c,Ar(u),p,m,f);S=k?.label,x=k?.secondaryLabel,v=k?.height??0}else{const k=Ds(Ar(d),c,m,f);S=k?.[0],x=void 0,v=k?.[0].height??0}const b=v*O2[l];i.each((k,A)=>{let I;if(A.label==="primary"?I=S:A.label==="secondary"&&(I=x),I==null){k.visible=!1;return}k.visible=!0,k.text=I.text,k.fontSize=I.fontSize,k.lineHeight=I.lineHeight,k.textAlign=r,k.textBaseline="middle";const D=A.label==="primary"?I.height/2:v-I.height/2;k.y=A.centerY+D-b,k.x=A.centerX})}var{fromToMotion:Hs,resetMotion:Vd,SeriesNodePickMode:Kd,StateMachine:w2,createDatumId:Rr,normalizeAngle360:E2,normalizeAngle360Inclusive:Wd,isBetweenAngles:ma,sectorBox:F2,toRadians:ya,BBox:B2,Group:ai,PointerEvents:fa,Selection:ni,Sector:G2,SectorBox:V2,Text:zd,Marker:K2,tickFormat:W2,applyShapeStyle:Sa,mergeDefaults:z2}=Ri,$2={inside:90,middle:0,outside:-90},H2=[{textAlign:"left",textBaseline:"top"},{textAlign:"right",textBaseline:"top"},{textAlign:"right",textBaseline:"bottom"},{textAlign:"left",textBaseline:"bottom"}],X2=[{textAlign:"right",textBaseline:"bottom"},{textAlign:"left",textBaseline:"bottom"},{textAlign:"left",textBaseline:"top"},{textAlign:"right",textBaseline:"top"}],xa=class extends Ri.Series{constructor(e){super({moduleCtx:e,pickModes:[Kd.EXACT_SHAPE_MATCH,Kd.NEAREST_NODE]}),this.centerX=0,this.centerY=0,this.radius=0,this.textAlign="center",this.verticalAlign="middle",this.properties=new Te,this.scale=new jr,this.scaleGroup=this.contentGroup.appendChild(new ai({name:"scaleGroup"})),this.itemGroup=this.contentGroup.appendChild(new ai({name:"itemGroup"})),this.itemNeedleGroup=this.contentGroup.appendChild(new ai({name:"itemNeedleGroup"})),this.itemTargetGroup=this.contentGroup.appendChild(new ai({name:"itemTargetGroup"})),this.itemTargetLabelGroup=this.contentGroup.appendChild(new ai({name:"itemTargetLabelGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new ai({name:"itemLabelGroup"})),this.highlightTargetGroup=this.highlightGroup.appendChild(new ai({name:"itemTargetLabelGroup"})),this.tickGroup=this.contentGroup.appendChild(new ai({name:"tickGroup"})),this.scaleSelection=ni.select(this.scaleGroup,()=>this.nodeFactory()),this.datumSelection=ni.select(this.itemGroup,()=>this.nodeFactory()),this.needleSelection=ni.select(this.itemNeedleGroup,Dr),this.targetSelection=ni.select(this.itemTargetGroup,()=>this.markerFactory()),this.targetLabelSelection=ni.select(this.itemTargetLabelGroup,zd),this.labelSelection=ni.select(this.itemLabelGroup,zd),this.highlightTargetSelection=ni.select(this.highlightTargetGroup,()=>this.markerFactory()),this.tickSelection=ni.select(this.tickGroup,Ri.TransformableText),this.datumUnion=new Eh,this.animationState=new w2("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.animateReadyResize(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateWaitingUpdateReady()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty"},reset:"empty",skip:"ready"}}),this.scaleGroup.pointerEvents=fa.None,this.tickGroup.pointerEvents=fa.None,this.itemNeedleGroup.pointerEvents=fa.None,this.itemLabelGroup.pointerEvents=fa.None}get hasData(){return this.properties.value!=null}nodeFactory(){return new G2}markerFactory(){const e=new K2;return e.size=1,e}processData(){this.nodeDataRefresh=!0,this.animationState.transition("updateData")}formatLabel(e){const{min:t,max:i}=this.properties.scale;return Bh(e,{min:t,max:i})}layoutScale(){const{scale:e,properties:t}=this,{seriesRectWidth:i,seriesRectHeight:s}=this.nodeDataDependencies,{scale:o,outerRadius:a}=this.properties,{min:n,max:r,label:l,interval:c}=o,p=ya(t.startAngle-90),d=ya(t.endAngle-90),m=Wd(d-p)>Math.PI,g=m||ma(1.5*Math.PI,p,d),y=m||ma(0*Math.PI,p,d),f=m||ma(.5*Math.PI,p,d),S=m||ma(1*Math.PI,p,d);let x;S&&!y?x="right":!S&&y?x="left":x="center";let v;g&&!f?v="bottom":!g&&f?v="top":v="middle";const b=F2({startAngle:p,endAngle:d,innerRadius:0,outerRadius:.5}),k=-(b.x+b.width/2)*2,A=-(b.y+b.height/2)*2,I=Math.min(i/b.width,s/b.height);e.domain=[n,r],e.range=[p,d],e.arcLength=I/2;const{maxSpacing:D,minSpacing:N}=c,{arcLength:R}=e,C=D?Math.floor(R/D):1,w=N?Math.floor(R/N):1/0,G=Math.floor(4/Math.PI*Math.abs(e.range[0]-e.range[1])),_=Math.max(C,Math.min(w,G)),E=c.values??e.ticks({nice:!1,interval:c.step,minTickCount:C,maxTickCount:w,tickCount:_})?.ticks??[],L=W2(E,typeof l.format=="string"?l.format:void 0),P=u2(l),T=E.map((W,K)=>{let z;if(l.formatter&&(z=Fn(this.ctx,l.formatter,{value:W,index:K,domain:e.domain,boundSeries:void 0})),z??(z=L?.(W)),z==null)return;const{width:$,height:Z}=g2(z)?m2(z,l):P.measureLines(z);return{index:K,value:W,text:z,width:$,height:Z}}).filter(W=>W!=null),M=T.reduce((W,K)=>Math.max(W,K.width),0),O=T.reduce((W,K)=>Math.max(W,K.height),0),B=l.enabled?Math.max(M,O)+l.spacing:0,F=Math.max(.5*I-B,0),V=a??F;return this.centerX=i/2+k*V,this.centerY=s/2+A*V,this.radius=V,this.textAlign=x,this.verticalAlign=v,T}getShapeFillBBox(){const{centerX:e,centerY:t,radius:i}=this,s=new B2(e-i,t-i,2*i,2*i);return{series:s,axis:s}}getTargets(){const{properties:e}=this,t=e.defaultTarget;return Array.from(e.targets).map(i=>{const{text:s=t.text,value:o=t.value??0,shape:a=t.shape??"triangle",rotation:n=t.rotation??0,placement:r=t.placement??"middle",spacing:l=t.spacing??0,size:c=t.size??0}=i,{enabled:p=t.label.enabled,color:d=t.label.color??"black",fontStyle:u=t.label.fontStyle??"normal",fontWeight:m=t.label.fontWeight??"normal",fontSize:g=t.label.fontSize,fontFamily:y=t.label.fontFamily,spacing:f=t.label.spacing??0}=i.label;return{text:s,value:o,shape:a,placement:r,spacing:l,size:c,rotation:n,label:{enabled:p,color:d,fontStyle:u,fontWeight:m,fontSize:g,fontFamily:y,spacing:f},style:i.getStyle()}})}getTargetRadius(e){const{radius:t,properties:i}=this,{innerRadiusRatio:s,outerRadiusRatio:o}=i,{placement:a,spacing:n,size:r}=e,l=t*o,c=t*s;switch(a){case"inside":return Math.max(c-n-r/2,0);case"outside":return l+n+r/2;default:return(c+l)/2}}getTargetLabel(e){const{scale:t}=this,{value:i,size:s,placement:o,label:a}=e,{spacing:n,color:r,fontStyle:l,fontWeight:c,fontSize:p,fontFamily:d}=a,u=void 0,m=t.convert(i),g=Math.trunc(E2(m)/(Math.PI/2)),y=s/2+n;let f,S,x,v;switch(o){case"outside":({textAlign:f,textBaseline:S}=H2[g]),x=y*Math.cos(m),v=y*Math.sin(m);break;case"inside":({textAlign:f,textBaseline:S}=X2[g]),x=-y*Math.cos(m),v=-y*Math.sin(m);break;default:f="center",S="bottom",x=0,v=-y;break}return{offsetX:x,offsetY:v,fill:r,textAlign:f,textBaseline:S,fontStyle:l,fontWeight:c,fontSize:p,fontFamily:d,lineHeight:u}}createNodeData(){const e=this.layoutScale(),{id:t,scale:i,properties:s,radius:o,centerX:a,centerY:n}=this,{value:r,innerRadiusRatio:l,outerRadiusRatio:c,segmentation:p,cornerRadius:d,cornerMode:u,needle:m,bar:g,scale:y,label:f,secondaryLabel:S}=s,{outerRadius:x=o*c,innerRadius:v=o*l,defaultColorRange:b}=s,k=this.getTargets(),A=[],I=[],D=[],N=[],R=[],C=u==="item",w=i.convert(i.domain[0]),G=i.convert(r),_=Math.ceil(Wd(G-w)*o);let E=p.enabled?p.interval.getSegments(i,_):void 0;const L=g.getStyle(b,i),P=y.getStyle(g.enabled,b,i);if(E==null&&C){const T=Math.min(...i.domain),M=Math.max(...i.domain),O={value:r,segmentStart:T,segmentEnd:M},F=Math.min(d,(x-v)/2)/((v+x)/2);A.push({series:this,itemId:"value",datum:O,datumIndex:{type:0},type:0,centerX:a,centerY:n,outerRadius:x,innerRadius:v,startAngle:w-F,endAngle:G+F,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:d,endCornerRadius:d,style:L}),R.push({series:this,itemId:"scale",datum:O,datumIndex:{type:0},type:0,centerX:a,centerY:n,outerRadius:x,innerRadius:v,startAngle:i.range[0]-F,endAngle:i.range[1]+F,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:d,endCornerRadius:d,style:P})}else{E??(E=i.domain);for(let T=0;Tthis.formatLabel($.value)}=f;N.push({label:"primary",centerX:a,centerY:n,text:T,value:r,fill:M,fontSize:O,minimumFontSize:B,fontStyle:F,fontWeight:V,fontFamily:W,lineHeight:K,formatter:z})}if(!m.enabled&&S.enabled){const{text:T,color:M,fontSize:O,minimumFontSize:B,fontStyle:F,fontWeight:V,fontFamily:W,lineHeight:K,formatter:z}=S;N.push({label:"secondary",centerX:a,centerY:n,text:T,value:r,fill:M,fontSize:O,minimumFontSize:B,fontStyle:F,fontWeight:V,fontFamily:W,lineHeight:K,formatter:z})}if(m.enabled){let T=m.radiusRatio==null?v:o*m.radiusRatio;T=Math.max(T-m.spacing,0);const M=i.convert(r);D.push({centerX:a,centerY:n,radius:T,angle:M,series:this})}for(let T=0;TMath.max(...i.domain))continue;const K=this.getTargetRadius(M),z=i.convert(O),$=ya(M.rotation+$2[M.placement]);I.push({series:this,itemId:`target-${T}`,midPoint:{x:K*Math.cos(z)+a,y:K*Math.sin(z)+n},datum:{value:O},datumIndex:{type:1,index:T},type:1,value:O,text:B,centerX:a,centerY:n,shape:V,radius:K,angle:z,rotation:$,size:F,label:this.getTargetLabel(M),style:W})}return{itemId:t,nodeData:A,needleData:D,targetData:I,labelData:N,scaleData:R,tickData:e}}updateSelections(e){(this.nodeDataRefresh||e)&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}highlightDatum(e){if(e!=null&&e.series===this&&e.type===1)return e}update({seriesRect:e}){const{datumSelection:t,labelSelection:i,needleSelection:s,targetSelection:o,targetLabelSelection:a,scaleSelection:n,highlightTargetSelection:r,tickSelection:l}=this,c=this.checkResize(e);this.updateSelections(c),this.contentGroup.visible=this.visible,this.contentGroup.opacity=this.getOpacity();const p=this.contextNodeData?.nodeData??[],d=this.contextNodeData?.labelData??[],u=this.contextNodeData?.needleData??[],m=this.contextNodeData?.targetData??[],g=this.contextNodeData?.scaleData??[],y=this.contextNodeData?.tickData??[],f=this.highlightDatum(this.ctx.highlightManager.getActiveHighlight());this.scaleSelection=this.updateScaleSelection({scaleData:g,scaleSelection:n}),this.updateScaleNodes({scaleSelection:n}),this.needleSelection=this.updateNeedleSelection({needleData:u,needleSelection:s}),this.updateNeedleNodes({needleSelection:s}),this.targetSelection=this.updateTargetSelection({targetData:m,targetSelection:o}),this.updateTargetStyles({targetSelection:o,isHighlight:!1}),this.updateTargetNodes({targetSelection:o}),this.targetLabelSelection=this.updateTargetLabelSelection({targetData:m,targetLabelSelection:a}),this.updateTargetLabelNodes({targetLabelSelection:a}),this.datumSelection=this.updateDatumSelection({nodeData:p,datumSelection:t}),this.updateDatumNodes({datumSelection:t}),this.labelSelection=this.updateLabelSelection({labelData:d,labelSelection:i}),this.updateLabelNodes({labelSelection:i}),this.highlightTargetSelection=this.updateTargetSelection({targetData:f==null?[]:[f],targetSelection:r}),this.updateTargetStyles({targetSelection:r,isHighlight:!0}),this.updateTargetNodes({targetSelection:r}),this.tickSelection=this.updateTickSelection({tickData:y,tickSelection:l}),this.updateTickNodes({tickSelection:l}),c&&this.animationState.transition("resize"),this.animationState.transition("update")}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>Rr(e.nodeData.length,t.itemId))}updateDatumNodes(e){const{datumSelection:t}=e,{ctx:i,properties:s}=this,{segmentation:o}=s,a=o.spacing??0,n=i.animationManager.isSkipped(),r=this.getShapeFillBBox();t.each((l,c)=>{const{centerX:p,centerY:d,innerRadius:u,outerRadius:m,startCornerRadius:g,endCornerRadius:y}=c;l.centerX=p,l.centerY=d,l.innerRadius=u,l.outerRadius=m,l.pointerEvents=this.properties.bar.enabled?Ri.PointerEvents.All:Ri.PointerEvents.None,Sa(l,c.style,r),l.startOuterCornerRadius=g,l.startInnerCornerRadius=g,l.endOuterCornerRadius=y,l.endInnerCornerRadius=y,l.radialEdgeInset=(a+l.strokeWidth)/2,l.concentricEdgeInset=l.strokeWidth/2,(n||l.previousDatum==null)&&l.setProperties(Tr(l,c))}),this.datumUnion.update(t,this.itemGroup,Ri.Sector,(l,c,p)=>{l.clipSector??(l.clipSector=new V2(Number.NaN,Number.NaN,Number.NaN,Number.NaN)),l.centerX=c.centerX,l.centerY=c.centerY,l.outerRadius=l.clipSector.outerRadius=c.outerRadius,l.innerRadius=l.clipSector.innerRadius=c.innerRadius,l.startAngle=l.clipSector.startAngle=c.startAngle,l.startInnerCornerRadius=c.startInnerCornerRadius,l.startOuterCornerRadius=c.startOuterCornerRadius,l.endAngle=p.endAngle,l.clipSector.endAngle=p.clipSector?.endAngle??p.endAngle,l.endInnerCornerRadius=p.endInnerCornerRadius,l.endOuterCornerRadius=p.endOuterCornerRadius,l.pointerEvents=Ri.PointerEvents.None})}updateScaleSelection(e){return e.scaleSelection.update(e.scaleData,void 0,t=>Rr(e.scaleData.length,t.itemId))}updateScaleNodes(e){const{scaleSelection:t}=e,{segmentation:i}=this.properties,s=i.spacing??0,o=this.getShapeFillBBox();t.each((a,n)=>{const{centerX:r,centerY:l,innerRadius:c,outerRadius:p,startCornerRadius:d,endCornerRadius:u}=n;a.centerX=r,a.centerY=l,a.innerRadius=c,a.outerRadius=p,Sa(a,n.style,o),a.startOuterCornerRadius=d,a.startInnerCornerRadius=d,a.endOuterCornerRadius=u,a.endInnerCornerRadius=u,a.radialEdgeInset=(s+a.strokeWidth)/2,a.concentricEdgeInset=a.strokeWidth/2,a.setProperties(Tr(a,n))})}updateNeedleSelection(e){return e.needleSelection.update(e.needleData,void 0,()=>Rr(0))}updateNeedleNodes(e){const{needleSelection:t}=e,{fill:i,fillOpacity:s,stroke:o,strokeOpacity:a,strokeWidth:n,lineDash:r,lineDashOffset:l}=this.properties.needle,c=this.ctx.animationManager.isSkipped();t.each((p,d)=>{const{centerX:u,centerY:m,radius:g}=d,y=g*2;p.d=Dr.defaultPathData,Sa(p,{fill:i,fillOpacity:s,stroke:o,strokeOpacity:a,strokeWidth:n/y,lineDash:r.map(f=>f/y),lineDashOffset:l/y}),p.translationX=u,p.translationY=m,p.scalingX=y,p.scalingY=y,c&&p.setProperties(Gd(p,d))})}updateTargetSelection(e){return e.targetSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetStyles({targetSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getTargetStyle(t,s)})}updateTargetNodes({targetSelection:e}){e.each((t,i)=>{const{centerX:s,centerY:o,angle:a,radius:n,shape:r,size:l,rotation:c}=i;Sa(t,i.style),t.size=l,t.shape=r==="line"?Gh:r,t.translationX=s+n*Math.cos(a),t.translationY=o+n*Math.sin(a),t.rotation=a+c})}getTargetStyle(e,{datumIndex:t,style:i}){const s=this.getHighlightStyle(e,t);return z2(s,{...i,opacity:1})}updateTargetLabelSelection(e){return e.targetLabelSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetLabelNodes(e){const{targetLabelSelection:t}=e;t.each((i,s)=>{const{centerX:o,centerY:a,radius:n,angle:r,text:l}=s,{offsetX:c,offsetY:p,fill:d,fontStyle:u,fontWeight:m,fontSize:g,fontFamily:y,textAlign:f,textBaseline:S}=s.label;if(l==null){i.visible=!1;return}i.visible=!0,i.x=o+n*Math.cos(r)+c,i.y=a+n*Math.sin(r)+p,i.text=l,i.fill=d,i.fontStyle=u,i.fontWeight=m,i.fontSize=g,i.fontFamily=y,i.textAlign=f,i.textBaseline=S})}updateLabelSelection(e){return e.labelSelection.update(e.labelData,void 0,t=>t.label)}updateLabelNodes(e){const{labelSelection:t}=e,i=this.ctx.animationManager.isSkipped();t.each((s,o)=>{s.fill=o.fill,s.fontStyle=o.fontStyle,s.fontWeight=o.fontWeight,s.fontFamily=o.fontFamily}),(i||this.labelsHaveExplicitText())&&this.formatLabelText()}updateTickSelection(e){return e.tickSelection.update(e.tickData,void 0,t=>t.index)}updateTickNodes(e){const{scale:t,radius:i,centerX:s,centerY:o,properties:a}=this,{enabled:n,color:r,fontFamily:l,fontSize:c,fontStyle:p,fontWeight:d,spacing:u}=a.scale.label,m=ya(a.scale.label.rotation??0);e.tickSelection.each((g,y)=>{if(!n){g.visible=!1;return}g.visible=!0,g.text=y.text,g.fill=r,g.fontFamily=l,g.fontSize=c,g.fontStyle=p,g.fontWeight=d,g.textAlign="center",g.textBaseline="middle";const f=t.convert(y.value),{width:S,height:x}=y,v=Math.abs(i*Math.cos(f)),b=Math.abs(i*Math.sin(f)),k=Math.min(Math.max(Math.abs(i/Math.tan(f)),v-S/2),v+S/2),A=Math.min(Math.max(Math.abs(i*Math.tan(f)),b-x/2),b+x/2),I=Math.hypot(k,A),D=s+(I+u)*Math.cos(f),N=o+(I+u)*Math.sin(f);g.x=D,g.y=N,g.rotationCenterX=D,g.rotationCenterY=N,g.rotation=m})}labelsHaveExplicitText(){for(const{datum:e}of this.labelSelection)if(e.text==null)return!1;return!0}formatLabelText(e){const{labelSelection:t,radius:i,textAlign:s,verticalAlign:o}=this,{spacing:a,innerRadiusRatio:n}=this.properties;_2(this,this.ctx,t,{padding:a,textAlign:s,verticalAlign:o},i*n,e)}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),Vd([this.datumSelection],Tr),Vd([this.needleSelection],Gd),this.formatLabelText()}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}animateLabelText(e={}){const{animationManager:t}=this.ctx;let i,s,o,a;if(this.labelSelection.each((n,r)=>{n.opacity=1,r.label==="primary"?(i=n.previousDatum?.value??e.from??r.value,s=r.value):r.label==="secondary"&&(o=n.previousDatum?.value??e.from??r.value,a=r.value)}),!this.labelsHaveExplicitText())if(s==null||a==null)this.formatLabelText();else if(i===s&&o===a)this.formatLabelText({label:s,secondaryLabel:a});else{const n=`${this.id}_labels`;t.animate({id:n,groupId:"label",from:{label:i,secondaryLabel:o},to:{label:s,secondaryLabel:a},phase:e.phase??"update",onUpdate:r=>this.formatLabelText(r),onStop:()=>this.formatLabelText({label:s,secondaryLabel:a})})}}animateEmptyUpdateReady(){const{animationManager:e}=this.ctx,{node:t,needle:i}=Bd(!0,this.scale.range[0]);Hs(this.id,"node",e,[this.datumSelection],t,(s,o)=>o.itemId),Hs(this.id,"needle",e,[this.needleSelection],i,()=>"needle"),Hs(this.id,"label",e,[this.labelSelection],Fh,(s,o)=>o.label),this.animateLabelText({from:this.properties.scale.min,phase:"initial"})}animateWaitingUpdateReady(){const{animationManager:e}=this.ctx,{node:t,needle:i}=Bd(!1,this.scale.range[0]);Hs(this.id,"node",e,[this.datumSelection],t,(s,o)=>o.itemId),Hs(this.id,"needle",e,[this.needleSelection],i,()=>"needle"),this.animateLabelText()}animateReadyResize(){this.resetAllAnimation()}dataCount(){return Number.NaN}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}getLegendData(){return[]}getTooltipContent(e){const{id:t,properties:i}=this,{tooltip:s}=i;let o,a,n;if(e.type===0?(o=i.value,a=i.label.text,n=this.ctx.localeManager.t("ariaLabelGaugeValue")):({value:o,text:a}=i.targets[e.index],n=this.ctx.localeManager.t("ariaLabelGaugeTarget")),o!=null)return this.formatTooltipWithContext(s,{data:[{label:a,fallbackLabel:n,value:this.formatLabel(o)}]},{seriesId:t,title:void 0,datum:void 0,value:o})}pickNodeClosestDatum(e){return Kh(this,e)}pickFocus(e){return Wh(this,e)}getCaptionText(){const{value:e}=this.properties,t=[];return t.push(this.formatLabel(e)),this.labelSelection.each((i,s)=>{const o=Cs(this.id,this.ctx,s);o!=null&&t.push(y2(o))}),t.join(". ")}getCategoryValue(e){}datumIndexForCategoryValue(e){}hasItemStylers(){return this.properties.label.itemStyler!=null}};xa.className="RadialGaugeSeries",xa.type="radial-gauge";var{FONT_SIZE_RATIO:Y2}=cs,kO={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"radial-gauge",moduleFactory:e=>new xa(e),themeTemplate:{minWidth:200,minHeight:200,tooltip:{enabled:!1},series:{outerRadiusRatio:1,innerRadiusRatio:.8,startAngle:270,endAngle:450,defaultColorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$interpolate:[{$palette:"secondDivergingColors"},5]},cs.SAFE_RANGE2_OPERATION]},scale:{defaultFill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/2",cs.SAFE_STROKE_FILL_OPERATION,{$palette:"hierarchyColors"}]},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:12}},bar:{strokeWidth:{$isUserOption:["./stroke",2,0]}},segmentation:{enabled:!1,interval:{},spacing:2},defaultTarget:{fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},size:10,shape:"triangle",placement:"outside",spacing:5,label:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:5}},needle:{enabled:!1,fill:{$ref:"foregroundColor"},spacing:10},label:{...cs.LABEL_BOXING_DEFAULTS,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:56,minimumFontSize:18/56,fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}},secondaryLabel:{...cs.LABEL_BOXING_DEFAULTS,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:Y2.LARGE},minimumFontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"subtleTextColor"}},tooltip:{range:{$path:["/tooltip/range",10]}}}}},$d={type:"series",name:"radial-gauge",chartType:"standalone",enterprise:!0,options:cs.radialGaugeSeriesOptionsDef,create:e=>new xa(e)};import{_ModuleSupport as hs}from"ag-charts-community";import{_ModuleSupport as U2}from"ag-charts-community";import{Logger as q2,cachedTextMeasurer as j2,calcLineHeight as J2,toPlainText as Z2,wrapText as Pr}from"ag-charts-core";import{_ModuleSupport as Q2}from"ag-charts-community";import{clamp as eL}from"ag-charts-core";var{BBox:tL,Path:iL,Vec2:$e,SceneChangeDetection:ps}=Q2,Pi=class extends iL{constructor(){super(...arguments),this.x1=0,this.x2=0,this.y1=0,this.y2=0,this.height=0,this.inset=0,this.elbows=[]}computeBBox(){const e=Math.min(this.x1,this.x2),t=Math.max(this.x1,this.x2)-e,i=Math.min(this.y1,this.y2),s=Math.max(this.y1,this.y2)-i+this.height;return new tL(e,i,t,s)}updatePath(){const{path:e,inset:t}=this;e.clear();const i=this.height-2*this.inset,s=i/2;let o=this.x1+t,a=this.y1+t;e.moveTo(o,a);for(const l of this.elbows)this.updatePathSection(o,a,l.x,l.y,i,-s),o=l.x,a=l.y;const n=this.x2-t,r=this.y2+t;this.updatePathSection(o,a,n,r,i,-s),e.lineTo(n,r+i),o=n,a=r;for(const l of this.elbows.toReversed())this.updatePathSection(o,a,l.x,l.y,i,s),o=l.x,a=l.y;this.updatePathSection(o,a,this.x1+t,this.y1+t,i,s),e.closePath()}updatePathSection(e,t,i,s,o,a){const{path:n}=this,r=$e.from(e,t+a+o/2),l=$e.from(i,s+a+o/2);if(Math.abs(l.y-r.y)<2){n.lineTo(l.x,l.y);return}let c=$e.angle($e.sub(l,r));c<0&&(c=2*Math.PI+c);const p=0,d=Math.PI/2,u=Math.PI,m=Math.PI*1.5,g=Hd(r,l,0),y=Hd(r,l,o);if(g.radius=m?(n.arc(r.x,t-g.radius,g.radius,d,d+y.angle,!0),n.arc(l.x,s+y.radius,y.radius,m+y.angle,m),n.lineTo(l.x,l.y)):c>p&&c<=d?(n.arc(r.x,t+y.radius,y.radius,m,m+y.angle),n.arc(l.x,s-g.radius,g.radius,d+g.angle,d,!0),n.lineTo(l.x,l.y)):c>d&&c<=u?(n.arc(r.x,t+y.radius,y.radius-o,m,m+y.angle,!0),n.arc(l.x,s-g.radius,g.radius+o,d+g.angle,d),n.lineTo(l.x,l.y)):(n.arc(r.x,t-g.radius,g.radius+o,d,d+g.angle),n.arc(l.x,s+y.radius,y.radius-o,m+y.angle,m,!0),n.lineTo(l.x,l.y))}};h([ps()],Pi.prototype,"x1",2),h([ps()],Pi.prototype,"x2",2),h([ps()],Pi.prototype,"y1",2),h([ps()],Pi.prototype,"y2",2),h([ps()],Pi.prototype,"height",2),h([ps()],Pi.prototype,"inset",2);function Hd(e,t,i){const s=$e.angle($e.sub(t,e)),o=$e.distance(e,t),a=$e.add(e,$e.rotate($e.from(o/2,0),s)),n=-1/$e.gradient(e,t),r=$e.intercept(a,n),l=sL(.1,.5,Math.PI/2-Math.abs($e.gradient(e,t))),c=$e.intersectAtX(n,r,e.x),p=Math.max(i,$e.distance(e,c)*l);return{angle:$e.angle($e.sub(c,e),$e.sub(c,a))/-(1.1-l),radius:p}}function sL(e,t,i){return eL(e,(t-e)*i+e,t)}import{_ModuleSupport as oL}from"ag-charts-community";var{BaseProperties:Xd,FillGradientDefaults:aL,FillPatternDefaults:nL,FillImageDefaults:rL,makeSeriesTooltip:lL,SeriesProperties:cL,Property:te,Label:hL}=oL,ba=class extends hL{constructor(){super(...arguments),this.spacing=1,this.placement=void 0,this.edgePlacement=void 0}};h([te],ba.prototype,"spacing",2),h([te],ba.prototype,"placement",2),h([te],ba.prototype,"edgePlacement",2);var Ut=class extends Xd{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}};h([te],Ut.prototype,"fill",2),h([te],Ut.prototype,"fillOpacity",2),h([te],Ut.prototype,"stroke",2),h([te],Ut.prototype,"strokeOpacity",2),h([te],Ut.prototype,"strokeWidth",2),h([te],Ut.prototype,"lineDash",2),h([te],Ut.prototype,"lineDashOffset",2),h([te],Ut.prototype,"itemStyler",2);var ot=class extends Xd{constructor(){super(...arguments),this.spacing=1,this.minSpacing=0,this.width=1,this.alignment="justify",this.verticalAlignment="center",this.sort="auto",this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}};h([te],ot.prototype,"spacing",2),h([te],ot.prototype,"minSpacing",2),h([te],ot.prototype,"width",2),h([te],ot.prototype,"alignment",2),h([te],ot.prototype,"verticalAlignment",2),h([te],ot.prototype,"sort",2),h([te],ot.prototype,"fill",2),h([te],ot.prototype,"fillOpacity",2),h([te],ot.prototype,"stroke",2),h([te],ot.prototype,"strokeOpacity",2),h([te],ot.prototype,"strokeWidth",2),h([te],ot.prototype,"lineDash",2),h([te],ot.prototype,"lineDashOffset",2),h([te],ot.prototype,"itemStyler",2);var Re=class extends cL{constructor(){super(),this.nodes=void 0,this.idKey="",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.sizeKey=void 0,this.sizeName=void 0,this.fillGradientDefaults=new aL,this.fillPatternDefaults=new nL,this.fillImageDefaults=new rL,this.defaultColorRange=[],this.defaultPatternFills=[],this.fills=[],this.strokes=[],this.label=new ba,this.link=new Ut,this.node=new ot,this.tooltip=lL(),this.highlightStyle.deprecated=!1}getStyle(e,t,i,s){const{fillOpacity:o,strokeWidth:a,strokeOpacity:n,lineDash:r,lineDashOffset:l,fill:c=t[s%t.length],stroke:p=i[s%t.length]}=e?this.link:this.node;return{fill:c,fillOpacity:o,stroke:p,strokeWidth:a,strokeOpacity:n,lineDash:r,lineDashOffset:l}}};h([te],Re.prototype,"nodes",2),h([te],Re.prototype,"fromKey",2),h([te],Re.prototype,"toKey",2),h([te],Re.prototype,"idKey",2),h([te],Re.prototype,"idName",2),h([te],Re.prototype,"labelKey",2),h([te],Re.prototype,"labelName",2),h([te],Re.prototype,"sizeKey",2),h([te],Re.prototype,"sizeName",2),h([te],Re.prototype,"fillGradientDefaults",2),h([te],Re.prototype,"fillPatternDefaults",2),h([te],Re.prototype,"fillImageDefaults",2),h([te],Re.prototype,"defaultColorRange",2),h([te],Re.prototype,"defaultPatternFills",2),h([te],Re.prototype,"fills",2),h([te],Re.prototype,"strokes",2),h([te],Re.prototype,"label",2),h([te],Re.prototype,"link",2),h([te],Re.prototype,"node",2),h([te],Re.prototype,"tooltip",2);var{Transformable:pL,applyShapeStyle:Yd,SeriesNodePickMode:Ud,createDatumId:va,getShapeStyle:qd,getLabelStyles:dL,Rect:jd,BBox:Jd,mergeDefaults:ka}=U2,Da=class extends rh{constructor(e){super({moduleCtx:e,pickModes:[Ud.NEAREST_NODE,Ud.EXACT_SHAPE_MATCH]}),this.properties=new Re}isLabelEnabled(){return(this.properties.labelKey!=null||this.nodes==null)&&this.properties.label.enabled}linkFactory(){return new Pi}nodeFactory(){return new jd}createNodeData(){const{id:e,_nodeDataDependencies:{seriesRectWidth:t,seriesRectHeight:i}={seriesRectWidth:0,seriesRectHeight:0}}=this,{fromKey:s,toKey:o,sizeKey:a,labelKey:n,label:{spacing:r,placement:l,edgePlacement:c},node:{width:p,alignment:d}}=this.properties,u=L=>({...L,x:Number.NaN,y:Number.NaN,width:p,height:Number.NaN}),m=L=>({...L,x1:Number.NaN,x2:Number.NaN,y1:Number.NaN,y2:Number.NaN,height:Number.NaN,elbows:[]}),{nodeGraph:g,links:y,maxPathLength:f}=this.getNodeGraph(u,m,{includeCircularReferences:!1}),S=g;if(S.size===0)return;const x=[];for(let L=0;Lz+$.size,0),M.reduce((z,{link:$})=>z+$.size,0));if(T.length===0&&M.length===0||F===0){L.columnIndex=-1;continue}let V;switch(d){case"left":V=x[O];break;case"right":V=x[f-1-B];break;case"center":{if(T.length!==0)V=x[O];else if(M.length===0)V=x[0];else{const z=M.reduce(($,Z)=>Math.min($,Z.node.maxPathLengthBefore),f)-1;V=x[z]}break}case"justify":{V=M.length===0?x[f-1]:x[O];break}}P.size=F;const{label:W}=this.properties,K=W.enabled?this.getLabelText(P.label,P.datum,n,"label",[],this.properties.label,{datum:P.datum,value:P.label,fromKey:s,toKey:o,sizeKey:a,size:F}):void 0;P.label=Z2(K),V.nodes.push(L),V.size+=F,L.columnIndex=V.index}const v=j2(this.properties.label);let b=0,k=0;if(this.isLabelEnabled()){if(l==null&&c==null)b=(t-p)*(1-f/(f+1)),k=b;else if(c==="outside"||c==null){const L=(P,T)=>{const M=T;if(M.datum.label==null||M.datum.label==="")return P;let O=(t-p)/(f-1)-r;l==="center"&&c==null&&(O/=2);const B=Pr(M.datum.label,{maxWidth:O,maxHeight:M.datum.height,font:this.properties.label,textWrap:"never"});let{width:F}=v.measureLines(B);return l==="center"&&c==null&&(F/=2),Math.max(P,F)};(l!=="right"||c==="outside")&&(b=p+x[0].nodes.reduce(L,0)),(l!=="left"||c==="outside")&&(k=p+x.at(-1).nodes.reduce(L,0))}}const A=(t-p-b-k)/(f-1);for(let L=0;LL.columnIndex;O--){const B=T.link.size,F={ghost:!0,datum:{...L.datum,size:B,y:0,height:0},weight:0,linksBefore:[{node:{columnIndex:O-1,datum:{size:B}}}],linksAfter:[{node:{columnIndex:O+1,datum:{size:B}}}],link:T.link,columnIndex:L.columnIndex,size:L.datum.size,closestColumnDiff:P,fromNode:{y:M.datum.y},toNode:{y:0}};x[O].size+=B,x[O].nodes.push(F)}}}const I=x.toSorted((L,P)=>{const T=L.nodes.reduce((O,B)=>Math.max(O,B.datum.size),0);return P.nodes.reduce((O,B)=>Math.max(O,B.datum.size),0)-T}),D={};for(let L=0;L{if(M.node.columnIndex!==L.index-1)return T;const O=M.node.datum.size/x[M.node.columnIndex].size*D[M.node.columnIndex];return Math.max(T,O)},0),P.weight+=P.linksAfter.reduce((T,M)=>{if(M.node.columnIndex!==L.index+1)return T;const O=M.node.datum.size/x[M.node.columnIndex].size*D[M.node.columnIndex];return Math.max(T,O)},0)}L.nodes.sort((P,T)=>this.sortNodes(P,T))}const N=1,R=L=>x.reduce((P,{size:T,nodes:M})=>{const O=i-M.length*N,F=(1-(M.length-1)*L/O)/T;return Math.min(P,F)},1/0);let C=this.properties.node.spacing,w=R(C);for(;w<0&&C>this.properties.node.minSpacing;)C-=1,w=R(C);if(w<0){q2.warnOnce("There was insufficient space to display the Sankey Series. Reduce [node.spacing], [node.minSpacing], or provide a larger container.");return}for(const L of x){let P=0;for(const O of L.nodes){const B=i*O.datum.size*w;O.datum.height=Math.max(N,B),P+=B}const T=C*(L.nodes.length-1);let M=0;this.properties.node.verticalAlignment==="bottom"?M=i-P-T:this.properties.node.verticalAlignment==="center"&&(M=(i-P-T)/2);for(const O of L.nodes)O.datum.y=M,M+=i*O.datum.size*w+C,"ghost"in O&&O.ghost&&O.link.elbows.push({x:L.x,y:O.datum.y})}for(const{datum:L,linksBefore:P,linksAfter:T}of S.values()){let M=L.y;P.sort((B,F)=>this.sortNodes(B.node,F.node));for(const{link:B}of P)B.y2=M,M+=B.size*i*w;let O=L.y;T.sort((B,F)=>this.sortNodes(B.node,F.node,{invertColumnSort:!0}));for(const{link:B}of T)B.y1=O,O+=B.size*i*w}const G=[],_=[],{fontSize:E}=this.properties.label;for(const[L,P]of x.entries()){const T=L===0,M=L===x.length-1;let O=-1/0;P.nodes.sort((B,F)=>B.datum.y-F.datum.y);for(const B of P.nodes){if("ghost"in B&&B.ghost)continue;const{datum:F}=B;if(F.midPoint={x:F.x+F.width/2,y:F.y+F.height/2},G.push(F),F.label==null)continue;const V=F.y+F.height/2;let W;if(!T&&!M){const Q=J2(E),ie=V-Q,U=V+Q;let ce=t;for(const{datum:j}of S.values())j.x>F.x&&Math.max(j.y,ie)<=Math.min(j.y+j.height,U)&&(ce=Math.min(ce,j.x-r));const ae=ce-F.x-2*r;W=Pr(F.label,{maxWidth:ae,maxHeight:F.height,font:this.properties.label,textWrap:"never",overflow:"hide"})}if(W==null||W===""){const Q=c==null&&(T||M)?r:r*2;W=Pr(F.label,{maxWidth:A-Q,maxHeight:F.height,font:this.properties.label,textWrap:"never"})}if(W==="")continue;const{height:K}=v.measureLines(W),z=V-K/2,$=V+K/2;let Z=F.x+F.width+r,q="left",Y=l;T&&c==null&&l==null&&(Y="left"),c==="outside"?(T&&(Y="left"),M&&(Y="right")):c==="inside"&&(T&&(Y="right"),M&&(Y="left")),Y==="left"?(Z=F.x-r,q="right"):Y==="center"&&(Z=F.x+F.width/2,q="center"),z>=O&&(_.push({x:Z,y:V,textAlign:q,text:W,size:F.size}),O=$)}}for(const L of y){const{fromNode:P,toNode:T,size:M}=L;L.height=Math.max(N,i*M*w),L.x1=P.x+p,L.x2=T.x,L.midPoint={x:(L.x1+L.x2)/2,y:(L.y1+L.y2)/2+L.height/2},G.push(L)}return{itemId:e,nodeData:G,labelData:_}}sortNodes(e,t,i){const{properties:s}=this;return s.node.sort==="ascending"?(e.datum.label??"").localeCompare(t.datum.label??""):s.node.sort==="descending"?(t.datum.label??"").localeCompare(e.datum.label??""):s.node.sort==="data"?0:e.columnIndext.columnIndex?i?.invertColumnSort?-1:1:e.weight===t.weight?e.datum.size-t.datum.size:e.closestColumnDifft.closestColumnDiff?-1:e.weight-t.weight}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,s)=>{const{x:o,y:a,textAlign:n,text:r}=s,c=dL(this,void 0,s,this.properties.label,!1,t),{color:p,fontStyle:d,fontWeight:u,fontSize:m,fontFamily:g}=c;i.visible=!0,i.x=o,i.y=a,i.text=r,i.fill=p,i.fontStyle=d,i.fontWeight=u,i.fontSize=m,i.fontFamily=g,i.textAlign=n,i.textBaseline="middle",i.setBoxing(c)})}updateNodeSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>va(t.type,t.id))}getNodeStyle(e,t,i){const{properties:s}=this,{fills:o,strokes:a,defaultColorRange:n,defaultPatternFills:r,fillGradientDefaults:l,fillPatternDefaults:c,fillImageDefaults:p}=s,{itemStyler:d}=s.node,u=n[t%n.length].map(x=>({color:x})),m=r[t%r.length],g=this.getHighlightStyle(i,e.datumIndex),y=ka(g,s.getStyle(!1,o,a,t)),f=s.node.fill!=null;let S=qd(y,f?l:{...l.toJson(),colorStops:u},f?c:{...c.toJson(),fill:m,stroke:m},p);if(d!=null&&e.datumIndex!=null){const x=this.cachedDatumCallback(va(e.datumIndex.index,"node",i?"highlight":"node"),()=>{const v=this.makeItemStylerParams(e,i,S);return this.callWithContext(d,v)});x&&(S=ka(x,S,{...l.toJson(),colorStops:u},{...c.toJson(),fill:m,stroke:m},p))}return S.opacity=1,S}makeItemStylerParams({datum:e,datumIndex:t,size:i=0,label:s},o,a){const{id:n}=this,r=this.ctx.highlightManager?.getActiveHighlight(),l=this.getHighlightStateString(r,o,t),c=this.filterItemStylerFillParams(a.fill)??a.fill;return{seriesId:n,datum:e,highlighted:o,highlightState:l,...a,size:i,label:s,fill:c}}updateNodeNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((o,a)=>{const{datumIndex:n}=a,r=this.getNodeStyle(a,n.index,i);o.x=a.x,o.y=a.y,o.width=Math.max(a.width,0),o.height=Math.max(a.height,0),Yd(o,r,s)})}getShapeFillBBox(){const e=this._nodeDataDependencies?.seriesRectWidth??0,t=this._nodeDataDependencies?.seriesRectHeight??0,i=new Jd(0,0,e,t);return{series:i,axis:i}}updateLinkSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>va(t.type,t.index,t.fromNode.id,t.toNode.id))}getLinkStyle({datumIndex:e,datum:t},i,s){const{id:o,properties:a}=this,{fills:n,strokes:r,defaultColorRange:l,defaultPatternFills:c,fillGradientDefaults:p,fillPatternDefaults:d,fillImageDefaults:u}=a,{itemStyler:m}=a.link,g=l[i.index%l.length].map(b=>({color:b})),y=c[i.index%c.length],f=this.getHighlightStyle(s,e),S=ka(f,a.getStyle(!0,n,r,i.index)),x=a.link.fill!=null;let v=qd(S,x?p:{...p.toJson(),colorStops:g},x?d:{...d.toJson(),fill:y,stroke:y},u);if(m!=null&&e!=null){const b=this.cachedDatumCallback(va(e.index,"link",s?"highlight":"node"),()=>{const k=this.ctx.highlightManager?.getActiveHighlight(),A=this.getHighlightStateString(k,s,e);return this.callWithContext(m,{seriesId:o,datum:t,highlighted:s,highlightState:A,...v})});b&&(v=ka(b,v,{...p.toJson(),colorStops:g},{...d.toJson(),fill:y,stroke:y},u))}return v.opacity=1,v}updateLinkNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((o,a)=>{const n=a.fromNode.datumIndex,r=this.getLinkStyle(a,n,i);o.x1=a.x1,o.y1=a.y1,o.x2=a.x2,o.y2=a.y2,o.height=a.height,o.elbows=a.elbows,Yd(o,r,s),o.inset=o.strokeWidth/2})}getTooltipContent(e){const{id:t,linksProcessedData:i,nodesProcessedData:s,properties:o,ctx:{formatManager:a}}=this,{fromKey:n,toKey:r,sizeKey:l,sizeName:c,tooltip:p}=o,d=this.contextNodeData?.nodeData.find(x=>x.datumIndex.type===e.type&&x.datumIndex.index===e.index);if(d==null)return;const u=d.type===0?d.fromNode.index:d.index,m=d.type===0?`${d.fromNode.label} - ${d.toNode.label}`:d.label,g=e.type===0?i?.dataSources.get(this.id)?.data[e.index]:s?.dataSources.get(this.id)?.data[e.index],y=d.size;let f;if(d.type===0){const x=d.fromNode.datumIndex;f=this.getLinkStyle({datumIndex:e,datum:g},x,!1)}else f=this.getNodeStyle({datumIndex:e,datum:g},e.index,!1);const S=[];if(l!=null){const x=a.format(this.callWithContext.bind(this),{type:"number",value:y,datum:g,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",domain:[],boundSeries:this.getFormatterContext("size"),fractionDigits:void 0});S.push({label:c,fallbackLabel:l,value:x??String(y)})}return this.formatTooltipWithContext(p,{title:m,symbol:this.legendItemSymbol(d.type,u,f),data:S},{seriesId:t,datum:g,title:m,fromKey:n,toKey:r,sizeKey:l,sizeName:c,size:y,...f})}computeFocusBounds(e){if(e instanceof jd){const{x:t,y:i,width:s,height:o}=e,a=new Jd(t,i,s,o);return pL.toCanvas(this.contentGroup,a)}return e}hasItemStylers(){return this.properties.node.itemStyler!=null||this.properties.link.itemStyler!=null||this.properties.label.itemStyler!=null}};Da.className="SankeySeries",Da.type="sankey";import{_ModuleSupport as uL}from"ag-charts-community";import{arrayOf as Cr,color as Zd,constant as gL,fillGradientDefaults as mL,fillImageDefaults as yL,fillPatternDefaults as fL,required as Or,string as Ia,undocumented as Xs}from"ag-charts-core";var{commonSeriesOptionsDefs:SL,sankeySeriesThemeableOptionsDef:xL}=uL,ds={...xL,...SL,type:Or(gL("sankey")),fromKey:Or(Ia),toKey:Or(Ia),sizeKey:Ia,sizeName:Ia};ds.fillGradientDefaults=Xs(mL),ds.fillPatternDefaults=Xs(fL),ds.fillImageDefaults=Xs(yL),ds.defaultColorRange=Xs(Cr(Cr(Zd))),ds.defaultPatternFills=Xs(Cr(Zd));var PO={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],solo:!0,identifier:"sankey",moduleFactory:e=>new Da(e),themeTemplate:{seriesArea:{padding:{top:10,bottom:10}},series:{fills:{$palette:"fills"},strokes:{$palette:"strokes"},fillGradientDefaults:hs.FILL_GRADIENT_LINEAR_DEFAULTS,fillPatternDefaults:hs.FILL_PATTERN_DEFAULTS,fillImageDefaults:hs.FILL_IMAGE_DEFAULTS,defaultColorRange:{$palette:"gradients"},defaultPatternFills:hs.SAFE_FILLS_OPERATION,highlightStyle:{series:{dimOpacity:.2}},highlight:{...hs.singleSeriesHighlightStyle()},label:{...hs.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:10},node:{spacing:{$if:[{$greaterThan:[{$path:"./minSpacing"},20]},{$path:"./minSpacing"},20]},minSpacing:0,width:10,strokeWidth:{$isUserOption:["./stroke",2,0]}},link:{fillOpacity:.5,strokeWidth:{$isUserOption:["./stroke",2,0]}}},legend:{enabled:!1,toggleSeries:!1}}},Qd={type:"series",name:"sankey",chartType:"standalone",enterprise:!0,options:ds,create:e=>new Da(e)};import{_ModuleSupport as Ci}from"ag-charts-community";import{_ModuleSupport as Ys}from"ag-charts-community";import{toPlainText as eu}from"ag-charts-core";import{_ModuleSupport as bL}from"ag-charts-community";var{HierarchySeriesProperties:vL,HighlightStyle:kL,makeSeriesTooltip:DL,Property:Pe}=bL,ri=class extends kL{constructor(){super(!1),this.label=new _t,this.secondaryLabel=new _t}};h([Pe],ri.prototype,"fill",2),h([Pe],ri.prototype,"fillOpacity",2),h([Pe],ri.prototype,"stroke",2),h([Pe],ri.prototype,"strokeWidth",2),h([Pe],ri.prototype,"strokeOpacity",2),h([Pe],ri.prototype,"label",2),h([Pe],ri.prototype,"secondaryLabel",2);var at=class extends vL{constructor(){super(...arguments),this.fillOpacity=1,this.strokeWidth=0,this.strokeOpacity=1,this.cornerRadius=0,this.highlightStyle=new ri,this.label=new _t,this.secondaryLabel=new As,this.tooltip=DL()}getStyle(e){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:o,strokeOpacity:a}=this;return{fill:t[e%t.length],fillOpacity:s,stroke:i[e%i.length],strokeWidth:o,strokeOpacity:a,opacity:1}}};h([Pe],at.prototype,"sizeName",2),h([Pe],at.prototype,"labelKey",2),h([Pe],at.prototype,"secondaryLabelKey",2),h([Pe],at.prototype,"fillOpacity",2),h([Pe],at.prototype,"strokeWidth",2),h([Pe],at.prototype,"strokeOpacity",2),h([Pe],at.prototype,"cornerRadius",2),h([Pe],at.prototype,"sectorSpacing",2),h([Pe],at.prototype,"padding",2),h([Pe],at.prototype,"itemStyler",2),h([Pe],at.prototype,"highlightStyle",2),h([Pe],at.prototype,"label",2),h([Pe],at.prototype,"secondaryLabel",2),h([Pe],at.prototype,"tooltip",2);var{fromToMotion:IL,normalizeAngle360:AL,createDatumId:ML,PointerEvents:NL,Sector:tu,Group:Aa,ScalableGroup:LL,Selection:_r,TransformableText:wr,BBox:iu,applyShapeStyle:TL,mergeDefaults:su,formatValue:ou,getLabelStyles:RL}=Ys,PL=class extends Ys.HierarchyNode{constructor(){super(...arguments),this.label=void 0,this.secondaryLabel=void 0,this.contentHeight=0,this.bbox=void 0,this.startAngle=0,this.endAngle=0}};function au(e,t=0,i=2*Math.PI/e.sumSize){for(const s of e.children){const o=t+s.sumSize*i;s.startAngle=t,s.endAngle=o,au(s,t,i),t=o}}var Ma=class extends Ys.HierarchySeries{constructor(e){super(e),this.NodeClass=PL,this.properties=new at,this.scalingGroup=this.contentGroup.appendChild(new LL),this.sectorGroup=this.scalingGroup.appendChild(new Aa),this.sectorLabelGroup=this.scalingGroup.appendChild(new Aa),this.highlightSectorGroup=this.scalingGroup.appendChild(new Aa),this.datumSelection=_r.select(this.sectorGroup,tu),this.labelSelection=_r.select(this.sectorLabelGroup,Aa),this.highlightSelection=_r.select(this.highlightSectorGroup,tu),this.sectorLabelGroup.pointerEvents=NL.None}processData(){super.processData(),au(this.rootNode)}updateSelections(){const e=this.ctx.highlightManager?.getActiveHighlight();if(this.highlightSelection.update(e==null?[]:[e],void 0,a=>this.getDatumId(a)),!this.nodeDataRefresh)return;this.nodeDataRefresh=!1;const{chart:t}=this;if(t==null||t.seriesRect==null)return;const s=Array.from(this.rootNode),o=a=>{a.append([new wr({tag:0}),new wr({tag:1})])};this.datumSelection.update(s,void 0,a=>this.getDatumId(a)),this.labelSelection.update(s,o,a=>this.getDatumId(a))}getItemStyle(e,t){const{properties:i,colorScale:s}=this,{itemStyler:o}=i,a=e.datumIndex?.[0]??0,n=t?i.highlightStyle:void 0,r=su(n,i.getStyle(a));!t&&e.colorValue!=null&&(r.fill=s.convert(e.colorValue));let l=r;if(o!=null&&e!=null){const c=this.cachedDatumCallback(ML(this.getDatumId(e),t?"highlight":"node"),()=>{const p=this.makeItemStylerParams(e,t,l);return this.callWithContext(o,p)});c&&(l=su(c,l))}return l}makeItemStylerParams(e,t,i){const{id:s}=this,o=this.ctx.highlightManager?.getActiveHighlight(),a=this.getHighlightStateString(o,t,e.datumIndex),n=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:e.datum,depth:e.depth??0,highlighted:t,highlightState:a,...i,fill:n}}updateNodes(){const{chart:e,data:t,maxDepth:i}=this;if(e==null||t==null)return;const{width:s,height:o}=e.seriesRect,{sectorSpacing:a=0,padding:n=0,cornerRadius:r,childrenKey:l,colorKey:c,colorName:p,labelKey:d,secondaryLabelKey:u,sizeKey:m,sizeName:g}=this.properties;this.contentGroup.translationX=s/2,this.contentGroup.translationY=o/2;const y=a*.5,f=Math.min(s,o)/2,S=f/(i+1),x=-Math.PI/2,v={series:new iu(-f,-f,2*f,2*f),axis:new iu(-f,-f,2*f,2*f)};this.rootNode?.walk(I=>{const{startAngle:D,endAngle:N}=I;if(I.depth!=null){const R=(D+N)/2+x,C=(I.depth+.5)*S;I.midPoint.x=Math.cos(R)*C,I.midPoint.y=Math.sin(R)*C}}),this.rootNode?.walk(I=>{const{datum:D,depth:N,startAngle:R,endAngle:C,parent:w,sumSize:G}=I;I.label=void 0,I.secondaryLabel=void 0,I.contentHeight=0;let _;if(D!=null&&N!=null&&d!=null){const se=D[d];_=this.getLabelText(se,D,d,"label",[],this.properties.label,{depth:N,datum:D,childrenKey:l,colorKey:c,colorName:p,labelKey:d,secondaryLabelKey:u,sizeKey:m,sizeName:g,value:se})}_===""&&(_=void 0);let E;if(D!=null&&N!=null&&u!=null){const se=D[u];E=this.getLabelText(se,D,u,"secondaryLabel",[],this.properties.secondaryLabel,{depth:N,datum:D,childrenKey:l,colorKey:c,colorName:p,labelKey:d,secondaryLabelKey:u,sizeKey:m,sizeName:g,value:se})}if(E===""&&(E=void 0),N==null)return;const L=N*S+y,P=(N+1)*S-y,T=L>y?y/L:y,M=P>y?y/P:y,O=R+T,F=C+T-O,V=R+M,K=C+M-V,z=se=>{if(N===0&&w?.sumSize===G)return{width:2*Math.sqrt(P**2-(se*.5)**2),height:se,meta:0};const le=se,ye=2*Math.sqrt(P**2-(L+le)**2),we=F=Pt?{width:rt,height:le,meta:1}:{width:Pt,height:bt,meta:2}},$=sn(eu(_),this.properties.label,eu(E),this.properties.secondaryLabel,{padding:n},z);if($==null)return;const{width:Z,height:q,meta:Y,label:Q,secondaryLabel:ie}=$,U=x+(R+C)/2,ce=Math.sin(U)>=0,ae=Math.cos(U)>=0,j=(ce?3:12)&(ae?6:9);let re;switch(Y){case 0:re=0;break;case 1:{const ue=P-(S-q)*.58,le=Math.sqrt((P-n)**2-(Z/2)**2);re=Math.min(ue,le);break}case 2:if(N===0){const se=q/(2*Math.tan(F*.5))+Z*.5,ue=Math.sqrt(P**2-(q*.5)**2)-Z*.5;re=(se+ue)*.5}else re=(L+P)*.5;break}if(Q!=null){const{fontStyle:se="normal",fontFamily:ue,fontWeight:le="normal",color:ye="black"}=this.properties.label;I.label={...Q,fontStyle:se,fontFamily:ue,fontWeight:le,color:ye,labelPlacement:Y,circleQuarter:j,radius:re,theta:U}}if(ie!=null){const{fontStyle:se="normal",fontFamily:ue,fontWeight:le="normal",color:ye="black"}=this.properties.secondaryLabel;I.secondaryLabel={...ie,fontStyle:se,fontFamily:ue,fontWeight:le,color:ye,labelPlacement:Y,circleQuarter:j,radius:re,theta:U}}I.contentHeight=$.height});const b=(I,D,N)=>{const{depth:R,startAngle:C,endAngle:w}=I;if(R==null){D.visible=!1;return}D.visible=!0;const G=this.getItemStyle(I,N),_=G.fill,E=G.strokeWidth,L=Ys.isGradientFill(_)&&_.bounds!=="item"?v:void 0;TL(D,G,L),D.centerX=0,D.centerY=0,D.innerRadius=R*S,D.outerRadius=(R+1)*S,D.startAngle=C+x,D.endAngle=w+x,D.inset=y+E*.5,D.cornerRadius=r};this.datumSelection.each((I,D)=>{b(D,I,!1)}),this.highlightSelection.each((I,D)=>{b(D,I,!0)});const k=(I,D,N,R)=>{const{depth:C,contentHeight:w}=I,G=N===0,_=G?I.label:I.secondaryLabel;if(C==null||_==null){D.visible=!1;return}const{labelPlacement:E,circleQuarter:L,radius:P,theta:T}=_;let M;R&&(M=(G?this.properties.highlightStyle.label:this.properties.highlightStyle.secondaryLabel).color);const O={childrenKey:this.properties.childrenKey,colorKey:this.properties.colorKey,colorName:this.properties.colorName??this.properties.colorKey,depth:I.depth??Number.NaN,labelKey:this.properties.labelKey,secondaryLabelKey:this.properties.secondaryLabelKey,sizeKey:this.properties.sizeKey,sizeName:this.properties.sizeName??this.properties.sizeKey},B=G?this.properties.label:this.properties.secondaryLabel,F=this.ctx.highlightManager?.getActiveHighlight(),V=RL(this,I,O,B,R,F);switch(D.text=_.text,D.fontSize=_.fontSize,D.lineHeight=_.lineHeight,D.fontStyle=_.fontStyle,D.fontFamily=_.fontFamily,D.fontWeight=_.fontWeight,D.fill=M??_.color,D.fillOpacity=this.getHighlightStyle(R,I.datumIndex)?.opacity??1,D.setBoxing(V),E){case 0:D.textAlign="center",D.textBaseline="top",D.translationX=0,D.translationY=(G?0:w-_.height)-w*.5,D.rotation=0;break;case 1:{const W=(L&3)!==0,K=G===!W?P:P-(w-_.height);D.textAlign="center",D.textBaseline=W?"bottom":"top",D.translationX=Math.cos(T)*K,D.translationY=Math.sin(T)*K,D.rotation=W?T-Math.PI*.5:T+Math.PI*.5;break}case 2:{const W=(L&6)!==0,K=G===!W?(w-_.height)*.5:(_.height-w)*.5;D.textAlign="center",D.textBaseline="middle",D.translationX=Math.cos(T)*P+Math.cos(T+Math.PI/2)*K,D.translationY=Math.sin(T)*P+Math.sin(T+Math.PI/2)*K,D.rotation=W?T:T+Math.PI;break}}D.visible=!0},A=this.ctx.highlightManager?.getActiveHighlight();for(const I of this.labelSelection.selectByClass(wr)){const D=I.closestDatum();k(D,I,I.tag,D===A)}}getTooltipContent(e){const{id:t,properties:i,ctx:s}=this,{labelKey:o,secondaryLabelKey:a,childrenKey:n,sizeKey:r,sizeName:l,colorKey:c,colorName:p,tooltip:d}=i,{formatManager:u}=s,m=e.reduce((A,I)=>A?.children[I],this.rootNode);if(m==null)return;const{datum:g,depth:y}=m;if(g==null||y==null)return;const f=[],S=r==null?void 0:g[r];if(S!=null){const A=[0,this.rootNode?.sumSize??0],I=u.format(this.callWithContext.bind(this),{type:"number",value:S,datum:g,seriesId:t,legendItemName:void 0,key:r,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:A,fractionDigits:void 0});f.push({label:l,fallbackLabel:r,value:I??ou(S)})}const x=c==null?void 0:g[c];if(x!=null){const{colorDomain:A}=this,I=u.format(this.callWithContext.bind(this),{type:"number",value:x,datum:g,seriesId:t,legendItemName:void 0,key:c,source:"tooltip",property:"color",boundSeries:this.getFormatterContext("color"),domain:A,fractionDigits:void 0});f.push({label:p,fallbackLabel:c,value:I??ou(x)})}const v=this.getItemStyle({...m,colorValue:x??m.colorValue},!1),k={shape:"square",fill:v.fill,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0};return Ys.isGradientFill(k.fill)&&(k.fill={...k.fill,gradient:"linear",rotation:0,reverse:!1}),this.formatTooltipWithContext(d,{title:o==null?void 0:g[o],symbol:{marker:k},data:f},{seriesId:t,datum:g,title:void 0,depth:y,labelKey:o,secondaryLabelKey:a,childrenKey:n,sizeKey:r,sizeName:l,colorKey:c,colorName:p,...v})}createNodeData(){}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.datumSelection.nodes())}animateEmptyUpdateReady(){IL(this.id,"nodes",this.ctx.animationManager,[this.scalingGroup],{toFn(){return{scalingX:1,scalingY:1}},fromFn(){return{scalingX:0,scalingY:0}}})}computeFocusBounds(e){return e}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};Ma.className="SunburstSeries",Ma.type="sunburst";import{_ModuleSupport as CL}from"ag-charts-community";import{constant as OL,required as _L,string as Oi}from"ag-charts-core";var{commonSeriesOptionsDefs:wL,sunburstSeriesThemeableOptionsDef:EL,without:FL}=CL,BL={...EL,...FL(wL,["highlightStyle","highlight","showInLegend"]),type:_L(OL("sunburst")),labelKey:Oi,secondaryLabelKey:Oi,childrenKey:Oi,sizeKey:Oi,colorKey:Oi,sizeName:Oi,colorName:Oi},{BASE_FONT_SIZE:nu,FONT_SIZE_RATIO:ru}=Ci,BO={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"sunburst",moduleFactory:e=>new Ma(e),solo:!0,themeTemplate:{series:{fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",Ci.FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS],["pattern",Ci.FILL_PATTERN_DEFAULTS],["image",Ci.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"strokes"}]},colorRange:{$palette:"divergingColors"},strokeWidth:{$isUserOption:["./strokes/0",2,0]},label:{...Ci.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$rem:ru.LARGE},minimumFontSize:{$rem:9/nu},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},overflowStrategy:"ellipsis",wrapping:"never",spacing:2},secondaryLabel:{...Ci.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$rem:ru.SMALLEST},minimumFontSize:{$rem:7/nu},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},overflowStrategy:"ellipsis",wrapping:"never"},sectorSpacing:2,padding:3,highlightStyle:{label:{color:{$ref:"chartBackgroundColor"}},secondaryLabel:{color:{$ref:"chartBackgroundColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2}},gradientLegend:{enabled:!0,...Ci.LEGEND_CONTAINER_THEME}}},lu={type:"series",name:"sunburst",chartType:"standalone",enterprise:!0,options:BL,create:e=>new Ma(e)};import{_ModuleSupport as li}from"ag-charts-community";import{_ModuleSupport as Us}from"ag-charts-community";import{cachedTextMeasurer as GL,calcLineHeight as VL,isNumberEqual as KL,toPlainText as cu,wrapText as WL}from"ag-charts-core";import{_ModuleSupport as zL}from"ag-charts-community";var{BaseProperties:Na,HierarchySeriesProperties:$L,HighlightStyle:HL,makeSeriesTooltip:XL,Property:J,Label:YL}=zL,hu=class extends YL{constructor(){super(...arguments),this.spacing=0}};h([J],hu.prototype,"spacing",2);var xt=class extends Na{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.cornerRadius=0,this.textAlign="center",this.gap=0,this.padding=0,this.interactive=!0,this.label=new hu}};h([J],xt.prototype,"fill",2),h([J],xt.prototype,"fillOpacity",2),h([J],xt.prototype,"stroke",2),h([J],xt.prototype,"strokeWidth",2),h([J],xt.prototype,"strokeOpacity",2),h([J],xt.prototype,"cornerRadius",2),h([J],xt.prototype,"textAlign",2),h([J],xt.prototype,"gap",2),h([J],xt.prototype,"padding",2),h([J],xt.prototype,"interactive",2),h([J],xt.prototype,"label",2);var ut=class extends Na{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.cornerRadius=0,this.textAlign="center",this.verticalAlign="middle",this.gap=0,this.padding=0,this.label=new _t,this.secondaryLabel=new As}};h([J],ut.prototype,"fill",2),h([J],ut.prototype,"fillOpacity",2),h([J],ut.prototype,"stroke",2),h([J],ut.prototype,"strokeWidth",2),h([J],ut.prototype,"strokeOpacity",2),h([J],ut.prototype,"cornerRadius",2),h([J],ut.prototype,"textAlign",2),h([J],ut.prototype,"verticalAlign",2),h([J],ut.prototype,"gap",2),h([J],ut.prototype,"padding",2),h([J],ut.prototype,"label",2),h([J],ut.prototype,"secondaryLabel",2);var _i=class extends Na{constructor(){super(...arguments),this.label=new _t}};h([J],_i.prototype,"fill",2),h([J],_i.prototype,"fillOpacity",2),h([J],_i.prototype,"stroke",2),h([J],_i.prototype,"strokeWidth",2),h([J],_i.prototype,"strokeOpacity",2),h([J],_i.prototype,"label",2);var ci=class extends Na{constructor(){super(...arguments),this.label=new _t,this.secondaryLabel=new As}};h([J],ci.prototype,"fill",2),h([J],ci.prototype,"fillOpacity",2),h([J],ci.prototype,"stroke",2),h([J],ci.prototype,"strokeWidth",2),h([J],ci.prototype,"strokeOpacity",2),h([J],ci.prototype,"label",2),h([J],ci.prototype,"secondaryLabel",2);var Er=class extends HL{constructor(){super(!1),this.group=new _i,this.tile=new ci}getStyle(e){return e?this.tile:this.group}};h([J],Er.prototype,"group",2),h([J],Er.prototype,"tile",2);var Rt=class extends $L{constructor(){super(...arguments),this.highlightStyle=new Er,this.tooltip=XL(),this.group=new xt,this.tile=new ut,this.undocumentedGroupFills=[],this.undocumentedGroupStrokes=[]}getStyle(e,t,i,s){const{fillOpacity:o,strokeWidth:a,strokeOpacity:n,fill:r=e?t[s%t.length]:t[Math.min(s,t.length)],stroke:l=e?i[s%t.length]:i[Math.min(s,i.length)]}=e?this.tile:this.group;return{fill:r,fillOpacity:o,stroke:l,strokeWidth:a,strokeOpacity:n,opacity:1}}};h([J],Rt.prototype,"sizeName",2),h([J],Rt.prototype,"labelKey",2),h([J],Rt.prototype,"secondaryLabelKey",2),h([J],Rt.prototype,"itemStyler",2),h([J],Rt.prototype,"highlightStyle",2),h([J],Rt.prototype,"tooltip",2),h([J],Rt.prototype,"group",2),h([J],Rt.prototype,"tile",2),h([J],Rt.prototype,"undocumentedGroupFills",2),h([J],Rt.prototype,"undocumentedGroupStrokes",2);var{createDatumId:UL,Rect:pu,Group:du,BBox:us,Selection:Fr,Text:Br,Transformable:qL,applyShapeStyle:jL,getLabelStyles:JL,mergeDefaults:uu,formatValue:gu}=Us,ZL=class extends Us.HierarchyNode{constructor(){super(...arguments),this.labelValue=void 0,this.secondaryLabelValue=void 0,this.label=void 0,this.secondaryLabel=void 0,this.bbox=void 0,this.padding=void 0}};function hi(e){return e.children.length>0?e.sumSize-e.sizeValue:e.sizeValue}var mu={left:0,center:.5,right:1},QL={top:0,middle:.5,bottom:1},zO=class extends Us.Group{distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}},La=class extends Us.HierarchySeries{constructor(){super(...arguments),this.NodeClass=ZL,this.properties=new Rt,this.rectGroup=this.contentGroup.appendChild(new du),this.datumSelection=Fr.select(this.rectGroup,pu),this.labelSelection=Fr.select(this.labelGroup,du),this.highlightSelection=Fr.select(this.rectGroup,pu)}groupTitleHeight(e,t){const{labelValue:i}=e,{label:s}=this.properties.group,o=3;if(i!=null){if(s.fontSize>t.width/o||s.fontSize>t.height/o)return;{const{height:a}=GL(s).measureLines(i);return Math.max(a,s.fontSize)}}}getNodePadding(e,t){if(e.parent==null)return{top:0,right:0,bottom:0,left:0};if(e.children.length===0){const{padding:n}=this.properties.tile;return{top:n,right:n,bottom:n,left:n}}const{label:{spacing:i},padding:s}=this.properties.group,o=this.groupTitleHeight(e,t),a=o==null?0:o+i;return{top:s+a,right:s,bottom:s,left:s}}sortChildren({children:e}){const t=Array.from(e,(s,o)=>o).filter(s=>hi(e[s])>0).sort((s,o)=>hi(e[o])-hi(e[s]));return{sortedChildrenIndices:t,childAt:s=>{const o=t[s];return e[o]}}}squarify(e,t){const{datum:i,children:s}=e;if(t.width<=0||t.height<=0){e.bbox=void 0,e.padding=void 0,e.midPoint.x=Number.NaN,e.midPoint.y=Number.NaN;return}const o=i==null?{top:0,right:0,bottom:0,left:0}:this.getNodePadding(e,t);e.parent==null?(e.bbox=void 0,e.padding=void 0,e.midPoint.x=Number.NaN,e.midPoint.y=Number.NaN):(e.bbox=t,e.padding=o,e.midPoint.x=t.x+t.width/2,e.midPoint.y=t.y);const{sortedChildrenIndices:a,childAt:n}=this.sortChildren(e),r=a.every(k=>s[k].children.length===0),l=1,c=t.width-o.left-o.right,p=t.height-o.top-o.bottom;if(c<=0||p<=0)return;const d=a.length;let u=0,m=0,g=1/0,y=a.reduce((k,A)=>k+hi(s[A]),0);const f=new us(t.x+o.left,t.y+o.top,c,p),S=f.clone();let x=0;for(;x({left:l.x,top:l.y,right:l.x+l.width,bottom:l.y+l.height}),a=o(e),n=o(t),r=["top","right","bottom","left"];for(const l of r)KL(a[l],n[l])||t.shrink(s,l)}createNodeData(){}getItemStyle(e,t,i){const{properties:s,colorScale:o}=this,{itemStyler:a}=s,n=e.datumIndex?.[0]??0,r=t?s.fills:s.undocumentedGroupFills,l=t?s.strokes:s.undocumentedGroupStrokes,c=t?n:e.depth??-1,p=i?s.highlightStyle.getStyle(t):void 0,d=uu(p,s.getStyle(t,r,l,c));!i&&t&&e.colorValue!=null&&(d.fill=o.convert(e.colorValue));let u=d;if(a!=null&&e!=null){const m=this.cachedDatumCallback(UL(this.getDatumId(e),i?"highlight":"node"),()=>{const g=this.makeItemStylerParams(e,i,u);return this.callWithContext(a,g)});m&&(u=uu(m,u))}return u}makeItemStylerParams(e,t,i){const{id:s}=this,o=this.ctx.highlightManager?.getActiveHighlight(),a=this.getHighlightStateString(o,t,e.datumIndex),n=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:e.datum,depth:e.depth??-1,highlighted:t,highlightState:a,...i,fill:n}}updateSelections(){let e=this.ctx.highlightManager?.getActiveHighlight();if(e!=null&&!this.properties.group.interactive&&e.children.length!==0&&(e=void 0),this.highlightSelection.update(e==null?[]:[e],void 0,o=>this.getDatumId(o)),!this.nodeDataRefresh)return;this.nodeDataRefresh=!1;const{seriesRect:t}=this.chart??{};if(!t)return;const i=Array.from(this.rootNode),s=o=>{o.append([new Br({tag:0}),new Br({tag:1})])};this.datumSelection.update(i,void 0,o=>this.getDatumId(o)),this.labelSelection.update(i,s,o=>this.getDatumId(o))}updateNodes(){const{rootNode:e,data:t}=this,{childrenKey:i,colorKey:s,colorName:o,labelKey:a,secondaryLabelKey:n,sizeKey:r,sizeName:l,highlightStyle:c,tile:p,group:d}=this.properties,{seriesRect:u}=this.chart??{};if(!u||!t)return;this.rootNode?.walk(v=>{const{datum:b,depth:k,children:A}=v,I=A.length===0,D=I?p.label:d.label;let N;if(D.enabled&&b!=null&&k!=null&&a!=null){const C=b[a];N=this.getLabelText(C,b,a,"label",[],D,{depth:k,datum:b,childrenKey:i,colorKey:s,colorName:o,labelKey:a,secondaryLabelKey:n,sizeKey:r,sizeName:l,value:C})}N===""&&(N=void 0);let R;if(p.secondaryLabel.enabled&&I&&b!=null&&k!=null&&n!=null){const C=b[n];R=this.getLabelText(C,b,n,"secondaryLabel",[],p.secondaryLabel,{depth:k,datum:b,childrenKey:i,colorKey:s,colorName:o,labelKey:a,secondaryLabelKey:n,sizeKey:r,sizeName:l,value:C})}R===""&&(R=void 0),v.labelValue=cu(N),v.secondaryLabelValue=cu(R)});const{width:m,height:g}=u;this.squarify(e,new us(0,0,m,g)),this.rootNode?.walk(v=>{const{bbox:b,children:k,labelValue:A,secondaryLabelValue:I}=v;if(v.label=void 0,v.secondaryLabel=void 0,b!=null)if(k.length===0){const D={width:b.width,height:b.height,meta:null},N=sn(A,this.properties.tile.label,I,this.properties.tile.secondaryLabel,{padding:p.padding},()=>D);if(N==null)return;const{height:R,label:C,secondaryLabel:w}=N,{textAlign:G,verticalAlign:_,padding:E}=p,L=mu[G]??.5,P=b.x+E+(b.width-2*E)*L,T=QL[_]??.5,M=b.y+E+R*.5+(b.height-2*E-R)*T;if(C!=null){const{fontStyle:O="normal",fontFamily:B,fontWeight:F="normal",color:V="black"}=this.properties.tile.label;v.label={text:C.text,fontSize:C.fontSize,lineHeight:C.lineHeight,fontStyle:O,fontFamily:B,fontWeight:F,color:V,textAlign:G,verticalAlign:"middle",x:P,y:M-(R-C.height)*.5}}if(w!=null){const{fontStyle:O="normal",fontFamily:B,fontWeight:F="normal",color:V="black"}=this.properties.tile.secondaryLabel;v.secondaryLabel={text:w.text,fontSize:w.fontSize,lineHeight:w.fontSize,fontStyle:O,fontFamily:B,fontWeight:F,color:V,textAlign:G,verticalAlign:"middle",x:P,y:M+(R-w.height)*.5}}}else{if(A==null)return;{const{padding:D,textAlign:N}=d,R=this.groupTitleHeight(v,b);if(R==null)return;const C=b.width-2*D,w=WL(A,{maxWidth:b.width-2*D,font:d.label,textWrap:"never"}),G=mu[N]??.5,{fontStyle:_="normal",fontFamily:E,fontWeight:L="normal",color:P="black"}=this.properties.group.label;v.label={text:w,fontSize:d.label.fontSize,lineHeight:VL(d.label.fontSize),fontStyle:_,fontFamily:E,fontWeight:L,color:P,textAlign:N,verticalAlign:"middle",x:b.x+D+C*G,y:b.y+D+R*.5}}}});const y={series:new us(0,0,m,g),axis:new us(0,0,m,g)},f=(v,b,k)=>{const{bbox:A}=v;if(A==null){b.visible=!1;return}const{depth:I=-1}=v,D=v.children.length===0,N=this.getItemStyle(v,D,k);b.crisp=!0,jL(b,N,y),b.cornerRadius=D?p.cornerRadius:d.cornerRadius,b.zIndex=[0,I,k?1:0];const R=v.parent?.children.every(G=>G.children.length===0),C=v.parent==null?void 0:v.parent.bbox,w=v.parent==null?void 0:v.parent.padding;R===!0&&C!=null&&w!=null?(b.clipBBox=A,b.x=C.x+w.left,b.y=C.y+w.top,b.width=C.width-(w.left+w.right),b.height=C.height-(w.top+w.bottom)):(b.clipBBox=void 0,b.x=A.x,b.y=A.y,b.width=A.width,b.height=A.height),b.visible=!0};this.datumSelection.each((v,b)=>f(b,v,!1)),this.highlightSelection.each((v,b)=>{f(b,v,!0)});const S=(v,b,k,A)=>{const I=v.children.length===0,D=k===0?v.label:v.secondaryLabel;if(D==null){b.visible=!1;return}const N=k===0?p.label:p.secondaryLabel;let R;if(A){const{tile:_,group:E}=c;R=_.secondaryLabel.color,I?k===0&&(R=_.label.color):R=E.label.color}const C={childrenKey:this.properties.childrenKey,colorKey:this.properties.colorKey,colorName:this.properties.colorName??this.properties.colorKey,depth:v.depth??Number.NaN,labelKey:this.properties.labelKey,secondaryLabelKey:this.properties.secondaryLabelKey,sizeKey:this.properties.sizeKey,sizeName:this.properties.sizeName??this.properties.sizeKey},w=this.ctx.highlightManager?.getActiveHighlight(),G=JL(this,v,C,N,A,w);b.text=D.text,b.fontSize=D.fontSize,b.lineHeight=D.lineHeight,b.fontStyle=D.fontStyle,b.fontFamily=D.fontFamily,b.fontWeight=D.fontWeight,b.fill=R??D.color,b.fillOpacity=this.getHighlightStyle(A,v.datumIndex)?.opacity??1,b.textAlign=D.textAlign,b.textBaseline=D.verticalAlign,b.x=D.x,b.y=D.y,b.setBoxing(G),b.visible=!0,b.zIndex=1},x=this.ctx.highlightManager?.getActiveHighlight();for(const v of this.labelSelection.selectByClass(Br)){const b=v.closestDatum();S(b,v,v.tag,b===x)}}pickNodesExactShape(e){const t=super.pickNodesExactShape(e);return t.sort((i,s)=>s.datumIndex.length-i.datumIndex.length),t}pickNodeClosestDatum(e){const t=this.pickNodesExactShape(e);return t.length!==0?{datum:t[0],distance:0}:this.pickNodeNearestDistantObject(e,this.datumSelection.nodes())}getTooltipContent(e){const{id:t,properties:i,ctx:s}=this,{formatManager:o}=s,{labelKey:a,secondaryLabelKey:n,childrenKey:r,sizeKey:l,sizeName:c,colorKey:p,colorName:d,tooltip:u}=i,m=e.reduce((N,R)=>N?.children[R],this.rootNode);if(m==null)return;const{datum:g,depth:y,children:f}=m;if(g==null||y==null)return;const S=f.length===0,x=[],v=l==null?void 0:g[l];if(v!=null){const N=[0,this.rootNode?.sumSize??0],R=o.format(this.callWithContext.bind(this),{type:"number",value:v,datum:g,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:N,fractionDigits:void 0});x.push({label:c,fallbackLabel:l,value:R??gu(v)})}const b=p==null?void 0:g[p];if(b!=null){const{colorDomain:N}=this,R=o.format(this.callWithContext.bind(this),{type:"number",value:b,datum:g,seriesId:t,legendItemName:void 0,key:p,source:"tooltip",property:"color",boundSeries:this.getFormatterContext("color"),domain:N,fractionDigits:void 0});x.push({label:d,fallbackLabel:p,value:R??gu(b)})}const k=this.getItemStyle({...m,colorValue:b??m.colorValue},S,!1),I={shape:"square",fill:k.fill,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0};Us.isGradientFill(I.fill)&&(I.fill={...I.fill,gradient:"linear",rotation:0,reverse:!1});const D=S?{marker:I}:void 0;return this.formatTooltipWithContext(u,{title:a==null?void 0:g[a],symbol:D,data:x},{seriesId:t,datum:g,title:void 0,depth:y,labelKey:a,secondaryLabelKey:n,childrenKey:r,sizeKey:l,sizeName:c,colorKey:p,colorName:d,...k})}computeFocusBounds(e){return qL.toCanvas(this.contentGroup,e.getBBox())}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.tile.label.itemStyler!=null||this.properties.group.label.itemStyler!=null}};La.className="TreemapSeries",La.type="treemap";import{_ModuleSupport as eT}from"ag-charts-community";import{arrayOf as yu,color as fu,constant as tT,required as iT,string as wi,undocumented as Su}from"ag-charts-core";var{commonSeriesOptionsDefs:sT,treemapSeriesThemeableOptionsDef:oT,without:aT}=eT,Gr={...oT,...aT(sT,["highlightStyle","highlight","showInLegend"]),type:iT(tT("treemap")),labelKey:wi,secondaryLabelKey:wi,childrenKey:wi,sizeKey:wi,colorKey:wi,sizeName:wi,colorName:wi};Gr.undocumentedGroupFills=Su(yu(fu)),Gr.undocumentedGroupStrokes=Su(yu(fu));var{FONT_SIZE_RATIO:xu}=li,XO={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"treemap",moduleFactory:e=>new La(e),solo:!0,themeTemplate:{series:{fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",li.FILL_GRADIENT_LINEAR_DEFAULTS],["pattern",li.FILL_PATTERN_DEFAULTS],["image",li.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"strokes"}]},colorRange:{$palette:"divergingColors"},undocumentedGroupFills:{$palette:"hierarchyColors"},undocumentedGroupStrokes:{$palette:"secondHierarchyColors"},group:{label:{...li.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"textColor"},fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},spacing:4},fill:void 0,stroke:void 0,strokeWidth:1,padding:4,gap:2,textAlign:"left"},tile:{label:{...li.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"chartBackgroundColor"},fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:1.5},minimumFontSize:{$rem:xu.SMALLER},fontFamily:{$ref:"fontFamily"},wrapping:"on-space",overflowStrategy:"ellipsis",spacing:2},secondaryLabel:{...li.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"chartBackgroundColor"},fontStyle:void 0,fontWeight:void 0,fontSize:{$ref:"fontSize"},minimumFontSize:{$rem:xu.SMALLER},fontFamily:{$ref:"fontFamily"},wrapping:"never",overflowStrategy:"ellipsis"},fill:void 0,stroke:void 0,strokeWidth:{$isUserOption:["../strokes/0",2,{$isUserOption:["./stroke",2,0]}]},padding:3,gap:1},highlightStyle:{group:{label:{color:{$ref:"textColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2},tile:{label:{color:{$ref:"chartBackgroundColor"}},secondaryLabel:{color:{$ref:"chartBackgroundColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2}}},gradientLegend:{enabled:!0,...li.LEGEND_CONTAINER_THEME}}},bu={type:"series",name:"treemap",chartType:"standalone",enterprise:!0,options:Gr,create:e=>new La(e)},nT=Nu.ModuleRegistry,vu=[dl,Ya,tn,Nh,_h,nn,ln,Sn,vn,An],ku=[ul,gl,ml,yl,Up,fd,xd,Md,Cd],Du=[fl,ad,Qh,$d,lu,bu,uh,Qd],Iu=[bl,pp,up,Dp,Cp,_p],rT=[...vu,...ku,...Du,...Iu,tv,iv,sv];export{vu as AllCartesianEnterpriseModules,rT as AllEnterpriseModules,ku as AllPolarEnterpriseModules,Du as AllStandaloneEnterpriseModules,Iu as AllTopologyEnterpriseModules,gl as AngleCategoryAxisModule,ul as AngleNumberAxisModule,Ya as BoxPlotSeriesModule,tn as CandlestickSeriesModule,uh as ChordSeriesModule,Nh as ConeFunnelSeriesModule,_h as FunnelSeriesModule,nn as HeatmapSeriesModule,Qh as LinearGaugeSeriesModule,up as MapLineBackgroundSeriesModule,pp as MapLineSeriesModule,Dp as MapMarkerSeriesModule,_p as MapShapeBackgroundSeriesModule,Cp as MapShapeSeriesModule,nT as ModuleRegistry,Up as NightingaleSeriesModule,ln as OhlcSeriesModule,dl as OrdinalTimeAxisModule,ad as PyramidSeriesModule,fd as RadarAreaSeriesModule,xd as RadarLineSeriesModule,Md as RadialBarSeriesModule,Cd as RadialColumnSeriesModule,$d as RadialGaugeSeriesModule,yl as RadiusCategoryAxisModule,ml as RadiusNumberAxisModule,Sn as RangeAreaSeriesModule,vn as RangeBarSeriesModule,Qd as SankeySeriesModule,fl as StandaloneChartModule,lu as SunburstSeriesModule,bl as TopologyChartModule,bu as TreemapSeriesModule,An as WaterfallSeriesModule}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.esm.mjs b/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.esm.mjs new file mode 100644 index 000000000..1ecb1b23f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/package/main-modules.esm.mjs @@ -0,0 +1,26493 @@ +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __decorateClass = (decorators, target, key, kind) => { + var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; + for (var i = decorators.length - 1, decorator; i >= 0; i--) + if (decorator = decorators[i]) + result = (kind ? decorator(target, key, result) : decorator(result)) || result; + if (kind && result) + __defProp(target, key, result); + return result; +}; + +// packages/ag-charts-enterprise/src/main-modules.ts +import { _ModuleSupport as _ModuleSupport165 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/axes/axisModules.ts +import { _ModuleSupport as _ModuleSupport13 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxis.ts +import { _ModuleSupport as _ModuleSupport5 } from "ag-charts-community"; +import { isNumberEqual as isNumberEqual3 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/utils/polar.ts +function loopSymmetrically(items, step, iterator) { + const loop = (start, end, loopStep, loopIterator) => { + let prev = items[0]; + for (let i = start; loopStep > 0 ? i <= end : i > end; i += loopStep) { + const curr = items[i]; + if (loopIterator(prev, curr)) + return true; + prev = curr; + } + return false; + }; + const midIndex = Math.floor(items.length / 2); + if (loop(step, midIndex, step, iterator)) + return true; + return loop(items.length - step, midIndex, -step, iterator); +} + +// packages/ag-charts-enterprise/src/axes/angle-number/angleAxisInterval.ts +import { _ModuleSupport } from "ag-charts-community"; +var { AxisInterval, Property } = _ModuleSupport; +var AngleAxisInterval = class extends AxisInterval { +}; +__decorateClass([ + Property +], AngleAxisInterval.prototype, "minSpacing", 2); + +// packages/ag-charts-enterprise/src/axes/angle/angleAxis.ts +import { _ModuleSupport as _ModuleSupport4 } from "ag-charts-community"; +import { countFractionDigits, isNumberEqual as isNumberEqual2, wrapTextOrSegments } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/angleCrossLine.ts +import { _ModuleSupport as _ModuleSupport3 } from "ag-charts-community"; +import { isNumberEqual } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/polarCrossLine.ts +import { _ModuleSupport as _ModuleSupport2 } from "ag-charts-community"; +import { createId } from "ag-charts-core"; +var { BaseProperties, ChartAxisDirection, Property: Property2, Group, FONT_SIZE } = _ModuleSupport2; +var PolarCrossLineLabel = class extends BaseProperties { + constructor() { + super(...arguments); + this.fontSize = FONT_SIZE.LARGE; + this.fontFamily = "Verdana, sans-serif"; + this.padding = 5; + this.color = "rgba(87, 87, 87, 1)"; + } +}; +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "enabled", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "text", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontStyle", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontWeight", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontSize", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontFamily", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "padding", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "color", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "parallel", 2); +var PolarCrossLine = class extends BaseProperties { + constructor() { + super(...arguments); + this.id = createId(this); + this.defaultColorRange = []; + this.shape = "polygon"; + this.label = new PolarCrossLineLabel(); + this.scale = void 0; + this.clippedRange = [-Infinity, Infinity]; + this.gridLength = 0; + this.sideFlag = -1; + this.parallelFlipRotation = 0; + this.regularFlipRotation = 0; + this.direction = ChartAxisDirection.Angle; + this.axisInnerRadius = 0; + this.axisOuterRadius = 0; + this.lineGroup = new Group({ name: this.id }); + this.rangeGroup = new Group({ name: this.id }); + this.labelGroup = new Group({ name: this.id }); + this._isRange = void 0; + } + assignCrossLineGroup(isRange, crossLineRange) { + if (isRange !== this._isRange) { + if (isRange) { + this.rangeGroup.appendChild(crossLineRange); + } else { + this.lineGroup.appendChild(crossLineRange); + } + } + this._isRange = isRange; + } + setSectorNodeProps(node) { + node.fill = this.fill; + node.fillOpacity = this.fillOpacity ?? 1; + node.stroke = this.stroke; + node.strokeOpacity = this.strokeOpacity ?? 1; + node.strokeWidth = this.strokeWidth ?? 1; + node.lineDash = this.lineDash; + } + setLabelNodeProps(node, x, y, baseline, rotation) { + const { label } = this; + node.x = x; + node.y = y; + node.text = label.text; + node.textAlign = "center"; + node.textBaseline = baseline; + node.rotation = rotation; + node.rotationCenterX = x; + node.rotationCenterY = y; + node.fill = label.color; + node.fontFamily = label.fontFamily; + node.fontSize = label.fontSize; + node.fontStyle = label.fontStyle; + node.visible = true; + } +}; +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "enabled", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "type", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "range", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "value", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "defaultColorRange", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "fill", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "fillOpacity", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "stroke", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "strokeWidth", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "strokeOpacity", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "lineDash", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "shape", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "label", 2); + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/angleCrossLine.ts +var { + ChartAxisDirection: ChartAxisDirection2, + getCrossLineValue, + validateCrossLineValue, + normalizeAngle360, + Group: Group2, + Path, + Sector, + RotatableText, + ContinuousScale +} = _ModuleSupport3; +var AngleCrossLine = class extends PolarCrossLine { + constructor() { + super(); + this.direction = ChartAxisDirection2.Angle; + this.polygonNode = new Path(); + this.sectorNode = new Sector(); + this.lineNode = new Path(); + this.crossLineRange = new Group2(); + this.labelNode = new RotatableText(); + this.ticks = []; + this.crossLineRange.append(this.polygonNode); + this.crossLineRange.append(this.sectorNode); + this.crossLineRange.append(this.lineNode); + this.labelGroup.append(this.labelNode); + } + visibilityCheck() { + if (!ContinuousScale.is(this.scale)) { + return true; + } + const [d0, d1] = this.scale.domain; + const value = getCrossLineValue(this); + if (this.type === "range") { + const [start, end] = value; + return start >= d0 && start <= d1 && end >= start && end <= d1; + } else { + return value >= d0 && value <= d1; + } + } + update(visible) { + const { scale } = this; + if (!scale || !validateCrossLineValue(this, scale) || !this.visibilityCheck()) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updateLineNode(visible); + this.updatePolygonNode(visible); + this.updateSectorNode(visible); + this.updateLabelNode(visible); + } + updateLineNode(visible) { + const { scale, type, value, lineNode: line } = this; + if (!visible || type !== "line" || !scale) { + line.visible = false; + return; + } + const angle = scale.convert(value); + if (Number.isNaN(angle)) { + line.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + line.visible = true; + line.stroke = this.stroke; + line.strokeOpacity = this.strokeOpacity ?? 1; + line.strokeWidth = this.strokeWidth ?? 1; + line.fill = void 0; + line.lineDash = this.lineDash; + const x = axisOuterRadius * Math.cos(angle); + const y = axisOuterRadius * Math.sin(angle); + const x0 = axisInnerRadius * Math.cos(angle); + const y0 = axisInnerRadius * Math.sin(angle); + line.path.clear(true); + line.path.moveTo(x0, y0); + line.path.lineTo(x, y); + this.assignCrossLineGroup(false, this.crossLineRange); + } + updatePolygonNode(visible) { + const { polygonNode: polygon, range: range2, scale, shape, type, ticks } = this; + if (!visible || type !== "range" || shape !== "polygon" || !scale || !range2) { + polygon.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + const startIndex = ticks.indexOf(range2[0]); + const endIndex = ticks.indexOf(range2[1]); + const stops = startIndex <= endIndex ? ticks.slice(startIndex, endIndex + 1) : ticks.slice(startIndex).concat(ticks.slice(0, endIndex + 1)); + const angles = stops.map((value) => scale.convert(value)); + polygon.visible = true; + this.setSectorNodeProps(polygon); + const { path } = polygon; + path.clear(true); + for (const [index, angle] of angles.entries()) { + const x = axisOuterRadius * Math.cos(angle); + const y = axisOuterRadius * Math.sin(angle); + if (index === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + if (axisInnerRadius === 0) { + path.lineTo(0, 0); + } else { + const reversedAngles = angles.slice().reverse(); + for (const angle of reversedAngles) { + const x = axisInnerRadius * Math.cos(angle); + const y = axisInnerRadius * Math.sin(angle); + path.lineTo(x, y); + } + } + polygon.path.closePath(); + this.assignCrossLineGroup(true, this.crossLineRange); + } + updateSectorNode(visible) { + const { sectorNode: sector, range: range2, scale, shape, type } = this; + if (!visible || type !== "range" || shape !== "circle" || !scale || !range2) { + sector.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + const angles = range2.map((value) => scale.convert(value)); + const step = scale.step ?? 0; + const padding = scale instanceof _ModuleSupport3.BandScale ? step / 2 : 0; + sector.visible = true; + this.setSectorNodeProps(sector); + sector.centerX = 0; + sector.centerY = 0; + sector.innerRadius = axisInnerRadius; + sector.outerRadius = axisOuterRadius; + sector.startAngle = angles[0] - padding; + sector.endAngle = angles[1] + padding; + this.assignCrossLineGroup(true, this.crossLineRange); + } + updateLabelNode(visible) { + const { label, labelNode: node, range: range2, scale, type, ticks } = this; + if (!visible || label.enabled === false || !label.text || !scale || type === "range" && !range2) { + node.visible = false; + return; + } + node.visible = true; + const { axisInnerRadius, axisOuterRadius } = this; + let labelX; + let labelY; + let rotation; + let textBaseline; + if (type === "line") { + const angle = normalizeAngle360(scale.convert(this.value)); + const angle270 = 1.5 * Math.PI; + const isRightSide = isNumberEqual(angle, angle270) || angle > angle270 || angle < Math.PI / 2; + const midX = (axisInnerRadius + axisOuterRadius) / 2 * Math.cos(angle); + const midY = (axisInnerRadius + axisOuterRadius) / 2 * Math.sin(angle); + labelX = midX + label.padding * Math.cos(angle + Math.PI / 2); + labelY = midY + label.padding * Math.sin(angle + Math.PI / 2); + textBaseline = isRightSide ? "top" : "bottom"; + rotation = isRightSide ? angle : angle - Math.PI; + } else { + const [startAngle, endAngle] = range2.map((value) => normalizeAngle360(scale.convert(value))); + let angle = (startAngle + endAngle) / 2; + if (startAngle > endAngle) { + angle -= Math.PI; + } + angle = normalizeAngle360(angle); + const isBottomSide = (isNumberEqual(angle, 0) || angle > 0) && angle < Math.PI; + let distance; + if (this.shape === "circle" || ticks.length < 3) { + distance = axisOuterRadius - label.padding; + } else { + distance = axisOuterRadius * Math.cos(Math.PI / ticks.length) - label.padding; + } + labelX = distance * Math.cos(angle); + labelY = distance * Math.sin(angle); + textBaseline = isBottomSide ? "bottom" : "top"; + rotation = isBottomSide ? angle - Math.PI / 2 : angle + Math.PI / 2; + } + this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation); + } +}; +AngleCrossLine.className = "AngleCrossLine"; + +// packages/ag-charts-enterprise/src/axes/angle/angleAxis.ts +var { + ChartAxisDirection: ChartAxisDirection3, + Property: Property3, + toRadians, + normalizeAngle360: normalizeAngle3602, + normalizeAngle360Inclusive, + Path: Path2, + RotatableText: RotatableText2, + Transformable, + BBox, + Selection, + Line +} = _ModuleSupport4; +var AngleAxisLabel = class extends _ModuleSupport4.AxisLabel { + constructor() { + super(...arguments); + this.orientation = "fixed"; + } +}; +__decorateClass([ + Property3 +], AngleAxisLabel.prototype, "orientation", 2); +var AngleAxis = class extends _ModuleSupport4.PolarAxis { + constructor(moduleCtx, scale) { + super(moduleCtx, scale); + this.startAngle = 0; + this.endAngle = void 0; + this.tickLineGroupSelection = Selection.select( + this.tickLineGroup, + Line, + false + ); + this.gridLineGroupSelection = Selection.select( + this.gridLineGroup, + Line, + false + ); + this.labelData = []; + this.tickData = []; + this.radiusLineGroup = this.axisGroup.appendChild(new _ModuleSupport4.TransformableGroup()); + this.radiusLine = this.radiusLineGroup.appendChild(new Path2()); + this.includeInvisibleDomains = true; + } + get direction() { + return ChartAxisDirection3.Angle; + } + createLabel() { + return new AngleAxisLabel(); + } + calculateRotations() { + const rotation = toRadians(this.startAngle); + const parallelFlipRotation = normalizeAngle3602(rotation); + const regularFlipRotation = normalizeAngle3602(rotation - Math.PI / 2); + return { rotation, parallelFlipRotation, regularFlipRotation }; + } + calculateTickLayout(domain) { + const { nice, scale } = this; + const ticksParams = { + nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + const niceDomain = nice ? scale.niceDomain(ticksParams, domain) : domain; + const tickData = this.generateAngleTicks(niceDomain); + this.tickData = tickData; + const ticks = tickData.map((t) => t.value); + const fractionDigits = ticks.reduce( + (f, t) => Math.max(typeof t === "number" ? countFractionDigits(t) : 0, f), + 0 + ); + return { + niceDomain, + tickDomain: niceDomain, + ticks, + rawTickCount: void 0, + fractionDigits, + timeInterval: void 0, + bbox: this.getBBox() + }; + } + update() { + super.update(); + this.updateRadiusLine(); + this.updateGridLines(); + this.updateTickLines(); + } + normalizedAngles() { + const startAngle = normalizeAngle3602(-Math.PI / 2 + toRadians(this.startAngle)); + const sweep = this.endAngle == null ? 2 * Math.PI : normalizeAngle360Inclusive(toRadians(this.endAngle) - toRadians(this.startAngle)); + const endAngle = startAngle + sweep; + return [startAngle, endAngle]; + } + computeRange() { + this.range = this.normalizedAngles(); + } + updateSelections() { + const data = this.tickData; + this.gridLineGroupSelection.update(this.gridLength && this.gridLine.enabled ? data : []); + this.tickLineGroupSelection.update(this.tick.enabled ? data : []); + this.tickLabelGroupSelection.update(this.label.enabled ? data : []); + this.gridLineGroupSelection.cleanup(); + this.tickLineGroupSelection.cleanup(); + this.tickLabelGroupSelection.cleanup(); + } + updatePosition() { + super.updatePosition(); + const { translation, radiusLineGroup } = this; + const translationX = Math.floor(translation.x); + const translationY = Math.floor(translation.y); + radiusLineGroup.translationX = translationX; + radiusLineGroup.translationY = translationY; + } + updateRadiusLine() { + const node = this.radiusLine; + const { path } = node; + path.clear(true); + const { points, closePath } = this.getAxisLinePoints(); + for (const { x, y, moveTo: moveTo2, arc, radius = 0, startAngle = 0, endAngle = 0 } of points) { + if (arc) { + path.arc(x, y, radius, startAngle, endAngle); + } else if (moveTo2) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + if (closePath) { + path.closePath(); + } + node.visible = this.line.enabled; + node.stroke = this.line.stroke; + node.strokeWidth = this.line.width; + node.fill = void 0; + } + getAxisLinePoints() { + const { scale, shape, gridLength: radius } = this; + const [startAngle, endAngle] = this.range; + const isFullCircle = isNumberEqual2(endAngle - startAngle, 2 * Math.PI); + const points = []; + if (shape === "circle") { + if (isFullCircle) { + points.push( + { x: radius, y: 0, moveTo: true }, + { + x: 0, + y: 0, + radius, + startAngle: 0, + endAngle: 2 * Math.PI, + arc: true, + moveTo: false + } + ); + } else { + points.push( + { + x: radius * Math.cos(startAngle), + y: radius * Math.sin(startAngle), + moveTo: true + }, + { + x: 0, + y: 0, + radius, + startAngle: normalizeAngle3602(startAngle), + endAngle: normalizeAngle3602(endAngle), + arc: true, + moveTo: false + } + ); + } + } else if (shape === "polygon") { + const angles = scale.ticks({ + nice: this.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.map((value) => scale.convert(value)); + if (angles && angles.length > 2) { + for (const [i, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + const moveTo2 = i === 0; + points.push({ x, y, moveTo: moveTo2 }); + } + } + } + return { points, closePath: isFullCircle }; + } + updateGridLines() { + const { + scale, + gridLength: radius, + gridLine: { style, width }, + innerRadiusRatio + } = this; + if (!(style && radius > 0)) { + return; + } + const innerRadius = radius * innerRadiusRatio; + const styleCount = style.length; + this.gridLineGroupSelection.each((line, datum, index) => { + const { value } = datum; + const { stroke, lineDash } = style[index % styleCount]; + const angle = scale.convert(value); + line.x1 = innerRadius * Math.cos(angle); + line.y1 = innerRadius * Math.sin(angle); + line.x2 = radius * Math.cos(angle); + line.y2 = radius * Math.sin(angle); + line.stroke = stroke; + line.strokeWidth = width; + line.lineDash = lineDash; + line.fill = void 0; + }); + this.gridLineGroupSelection.cleanup(); + } + updateLabels() { + const { label, tickLabelGroupSelection } = this; + tickLabelGroupSelection.each((node, _, index) => { + const labelDatum = this.labelData[index]; + if (!labelDatum || labelDatum.hidden) { + node.visible = false; + return; + } + node.text = labelDatum.text; + node.setFont(label); + node.fill = label.color; + node.x = labelDatum.x; + node.y = labelDatum.y; + node.setAlign(labelDatum); + node.setBoxing(label); + node.visible = true; + if (labelDatum.rotation) { + node.rotation = labelDatum.rotation; + node.rotationCenterX = labelDatum.x; + node.rotationCenterY = labelDatum.y; + } else { + node.rotation = 0; + } + }); + } + updateTickLines() { + const { scale, gridLength: radius, tick, tickLineGroupSelection } = this; + tickLineGroupSelection.each((line, datum) => { + const { value } = datum; + const angle = scale.convert(value); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + line.x1 = radius * cos; + line.y1 = radius * sin; + line.x2 = (radius + tick.size) * cos; + line.y2 = (radius + tick.size) * sin; + line.stroke = tick.stroke; + line.strokeWidth = tick.width; + }); + } + createLabelNodeData(ticks, options, seriesRect) { + const { label, gridLength: radius, scale, tick } = this; + if (!label.enabled) { + return []; + } + const tempText = new RotatableText2(); + const seriesLeft = seriesRect.x - this.translation.x; + const seriesRight = seriesRect.x + seriesRect.width - this.translation.x; + const { fractionDigits } = this.layout.label; + const axisTickFormatter = this.tickFormatter(this.scale.domain, this.tickData, false, fractionDigits); + const labelData = ticks.map((datum, index) => { + const { value } = datum; + const distance = radius + label.spacing + tick.size; + const angle = scale.convert(value); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + const x = distance * cos; + const y = distance * sin; + const { textAlign, textBaseline } = this.getLabelAlign(angle); + const isLastTickOverFirst = index === ticks.length - 1 && value !== ticks[0] && isNumberEqual2(normalizeAngle3602(angle), normalizeAngle3602(scale.convert(ticks[0]))); + const rotation = this.getLabelRotation(angle); + let text = axisTickFormatter(value, index); + tempText.text = text; + tempText.x = x; + tempText.y = y; + tempText.setFont(label); + tempText.textAlign = textAlign; + tempText.textBaseline = textBaseline; + tempText.rotation = rotation; + if (rotation) { + tempText.rotationCenterX = x; + tempText.rotationCenterY = y; + } + let box = rotation ? Transformable.toCanvas(tempText) : tempText.getBBox(); + if (box && options.hideWhenNecessary && !rotation) { + const overflowLeft = seriesLeft - box.x; + const overflowRight = box.x + box.width - seriesRight; + const pixelError = 1; + if (overflowLeft > pixelError || overflowRight > pixelError) { + const availWidth = box.width - Math.max(overflowLeft, overflowRight); + const wrapOptions = { maxWidth: availWidth, font: label, textWrap: "never" }; + text = wrapTextOrSegments(text, wrapOptions); + tempText.text = text; + box = tempText.getBBox(); + } + } + return { + text, + x, + y, + textAlign, + textBaseline, + hidden: text === "" || (datum.hidden ?? isLastTickOverFirst), + rotation, + box + }; + }); + if (label.avoidCollisions) { + this.avoidLabelCollisions(labelData); + } + return labelData; + } + computeLabelsBBox(options, seriesRect) { + this.labelData = this.createLabelNodeData(this.tickData, options, seriesRect); + const textBoxes = this.labelData.map(({ box }) => box).filter((box) => box != null); + if (!this.label.enabled || textBoxes.length === 0) { + return null; + } + return BBox.merge(textBoxes); + } + getLabelOrientation() { + const { label } = this; + return label instanceof AngleAxisLabel ? label.orientation : "fixed"; + } + getLabelRotation(tickAngle) { + let rotation = toRadians(this.label.rotation ?? 0); + tickAngle = normalizeAngle3602(tickAngle); + const orientation = this.getLabelOrientation(); + if (orientation === "parallel") { + rotation += tickAngle; + if (tickAngle >= 0 && tickAngle < Math.PI) { + rotation -= Math.PI / 2; + } else { + rotation += Math.PI / 2; + } + } else if (orientation === "perpendicular") { + rotation += tickAngle; + if (tickAngle >= Math.PI / 2 && tickAngle < 1.5 * Math.PI) { + rotation += Math.PI; + } + } + return rotation; + } + getLabelAlign(tickAngle) { + const cos = Math.cos(tickAngle); + const sin = Math.sin(tickAngle); + let textAlign; + let textBaseline; + const orientation = this.getLabelOrientation(); + const isCos0 = isNumberEqual2(cos, 0); + const isSin0 = isNumberEqual2(sin, 0); + const isCos1 = isNumberEqual2(cos, 1); + const isSinMinus1 = isNumberEqual2(sin, -1); + const isCosPositive = cos > 0 && !isCos0; + const isSinPositive = sin > 0 && !isSin0; + if (orientation === "parallel") { + textAlign = "center"; + textBaseline = isCos1 && isSin0 || isSinPositive ? "top" : "bottom"; + } else if (orientation === "perpendicular") { + textAlign = isSinMinus1 || isCosPositive ? "left" : "right"; + textBaseline = "middle"; + } else { + textAlign = "right"; + if (isCos0) { + textAlign = "center"; + } else if (isCosPositive) { + textAlign = "left"; + } + textBaseline = "bottom"; + if (isSin0) { + textBaseline = "middle"; + } else if (isSinPositive) { + textBaseline = "top"; + } + } + return { textAlign, textBaseline }; + } + updateCrossLines() { + const { shape, gridLength: radius, innerRadiusRatio } = this; + for (const crossLine of this.crossLines) { + if (crossLine instanceof AngleCrossLine) { + crossLine.ticks = this.tickData.map((t) => t.value); + crossLine.shape = shape; + crossLine.axisOuterRadius = radius; + crossLine.axisInnerRadius = radius * innerRadiusRatio; + } + } + super.updateCrossLines(); + } +}; +AngleAxis.CrossLineConstructor = AngleCrossLine; +__decorateClass([ + Property3 +], AngleAxis.prototype, "startAngle", 2); +__decorateClass([ + Property3 +], AngleAxis.prototype, "endAngle", 2); + +// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxis.ts +var { Property: Property4, CategoryScale } = _ModuleSupport5; +var AngleCategoryAxis = class extends AngleAxis { + constructor(moduleCtx) { + super(moduleCtx, new CategoryScale()); + this.groupPaddingInner = 0; + this.paddingInner = 0; + this.interval = new AngleAxisInterval(); + } + hasDefinedDomain() { + return false; + } + generateAngleTicks(domain) { + const { scale, gridLength: radius } = this; + const { values, minSpacing } = this.interval; + const tickParams = { + nice: this.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + const ticks = values ?? scale.ticks(tickParams, domain)?.ticks ?? []; + if (ticks.length < 2 || minSpacing == null) { + return ticks.map((value) => { + return { value, visible: true }; + }); + } + const startTick = ticks[0]; + const startAngle = scale.convert(startTick); + const startX = radius * Math.cos(startAngle); + const startY = radius * Math.sin(startAngle); + for (let step = 1; step < ticks.length - 1; step++) { + const nextTick = ticks[step]; + const nextAngle = scale.convert(nextTick); + if (nextAngle - startAngle > Math.PI) { + break; + } + const nextX = radius * Math.cos(nextAngle); + const nextY = radius * Math.sin(nextAngle); + const spacing = Math.hypot(nextX - startX, nextY - startY); + if (spacing > minSpacing) { + const visibleTicks = /* @__PURE__ */ new Set([startTick]); + loopSymmetrically(ticks, step, (_, next) => { + visibleTicks.add(next); + }); + return ticks.map((value) => { + const visible = visibleTicks.has(value); + return { value, visible }; + }); + } + } + return [{ value: startTick, visible: true }]; + } + avoidLabelCollisions(labelData) { + const { minSpacing } = this.label; + if (labelData.length < 3) + return; + const labelsCollide = (prev, next) => { + if (prev.hidden || next.hidden) { + return false; + } else if (minSpacing == null) { + return prev.box.collidesBBox(next.box); + } + const prevBox = prev.box.clone().grow(minSpacing / 2); + const nextBox = next.box.clone().grow(minSpacing / 2); + return prevBox.collidesBBox(nextBox); + }; + const firstLabel = labelData[0]; + const lastLabel = labelData.at(-1); + const visibleLabels = /* @__PURE__ */ new Set([firstLabel]); + const lastLabelIsOverFirst = isNumberEqual3(firstLabel.x, lastLabel.x) && isNumberEqual3(firstLabel.y, lastLabel.y); + const maxStep = Math.floor(labelData.length / 2); + for (let step = 1; step <= maxStep; step++) { + const labels = lastLabelIsOverFirst ? labelData.slice(0, -1) : labelData; + const collisionDetected = loopSymmetrically(labels, step, labelsCollide); + if (!collisionDetected) { + loopSymmetrically(labels, step, (_, next) => { + visibleLabels.add(next); + }); + break; + } + } + for (const datum of labelData) { + if (!visibleLabels.has(datum)) { + datum.hidden = true; + datum.box = void 0; + } + } + } + tickFormatParams() { + return { type: "category" }; + } + datumFormatParams(value, params) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +AngleCategoryAxis.className = "AngleCategoryAxis"; +AngleCategoryAxis.type = "angle-category"; +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "paddingInner", 2); +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "interval", 2); + +// packages/ag-charts-enterprise/src/axes/angle-number/angleNumberAxis.ts +import { _ModuleSupport as _ModuleSupport7 } from "ag-charts-community"; +import { isNumberEqual as isNumberEqual5 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/axes/angle-number/linearAngleScale.ts +import { _ModuleSupport as _ModuleSupport6 } from "ag-charts-community"; +import { isNumberEqual as isNumberEqual4 } from "ag-charts-core"; +var { range, isDenseInterval, LinearScale } = _ModuleSupport6; +var LinearAngleScale = class _LinearAngleScale extends LinearScale { + constructor() { + super(...arguments); + this.arcLength = 0; + } + static getNiceStepAndTickCount(ticks, domain) { + const [start, stop] = domain; + let step = LinearScale.getTickStep(start, stop, ticks); + const maxTickCount = Number.isNaN(ticks.maxTickCount) ? Infinity : ticks.maxTickCount; + const expectedTickCount = Math.abs(stop - start) / step; + let niceTickCount = Math.pow(2, Math.ceil(Math.log(expectedTickCount) / Math.log(2))); + if (niceTickCount > maxTickCount) { + niceTickCount /= 2; + step *= 2; + } + return { count: niceTickCount, step }; + } + ticks(ticks, domain = this.domain) { + const { arcLength } = this; + if (!domain || domain.length < 2 || domain.some((d) => !Number.isFinite(d)) || arcLength <= 0) { + return { ticks: [], count: 0 }; + } + const { nice, interval } = ticks; + const [d0, d1] = domain; + if (interval) { + const step2 = Math.abs(interval); + const availableRange = this.getPixelRange(); + if (!isDenseInterval((d1 - d0) / step2, availableRange)) { + return range(d0, d1, step2); + } + } + let step; + if (nice && this.hasNiceRange()) { + const linearNiceDomain = super.niceDomain(ticks, domain); + step = _LinearAngleScale.getNiceStepAndTickCount(ticks, linearNiceDomain).step; + } else { + step = LinearScale.getTickStep(d0, d1, ticks); + } + return range(d0, d1, step); + } + hasNiceRange() { + const sortedRange = this.range.slice().sort((a, b) => a - b); + const niceRanges = [Math.PI, 2 * Math.PI]; + return niceRanges.some((r) => isNumberEqual4(r, sortedRange[1] - sortedRange[0])); + } + niceDomain(ticks, domain = this.domain) { + const linearNiceDomain = super.niceDomain(ticks, domain); + if (!this.hasNiceRange()) + return linearNiceDomain; + const reversed = linearNiceDomain[0] > linearNiceDomain[1]; + const start = reversed ? linearNiceDomain[1] : linearNiceDomain[0]; + const { step, count } = _LinearAngleScale.getNiceStepAndTickCount(ticks, linearNiceDomain); + const s = 1 / step; + const stop = step >= 1 ? Math.ceil(start / step + count) * step : Math.ceil((start + count * step) * s) / s; + return reversed ? [stop, start] : [start, stop]; + } + getPixelRange() { + return this.arcLength; + } +}; + +// packages/ag-charts-enterprise/src/axes/angle-number/angleNumberAxis.ts +var { Property: Property5, angleBetween, normalisedExtentWithMetadata, findMinMax } = _ModuleSupport7; +var AngleNumberAxis = class extends AngleAxis { + constructor(moduleCtx) { + super(moduleCtx, new LinearAngleScale()); + this.shape = "circle"; + this.interval = new AngleAxisInterval(); + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata(d, min, max); + return { domain: extent3, clipped }; + } + updateScale() { + super.updateScale(); + this.scale.arcLength = this.getRangeArcLength(); + } + getRangeArcLength() { + const { range: requestedRange } = this; + const min = Math.min(...requestedRange); + const max = Math.max(...requestedRange); + const rotation = angleBetween(min, max) || 2 * Math.PI; + const radius = this.gridLength; + return rotation * radius; + } + generateAngleTicks(domain) { + const { scale, range: requestedRange, nice } = this; + const { values, step, minSpacing, maxSpacing } = this.interval; + let rawTicks; + if (values == null) { + const { arcLength } = scale; + const minTickCount = maxSpacing ? Math.floor(arcLength / maxSpacing) : 1; + const maxTickCount = minSpacing ? Math.floor(arcLength / minSpacing) : Infinity; + const preferredTickCount = Math.floor(4 / Math.PI * Math.abs(requestedRange[0] - requestedRange[1])); + const tickCount = Math.max(minTickCount, Math.min(maxTickCount, preferredTickCount)); + const tickParams = { + nice, + interval: step, + tickCount, + minTickCount, + maxTickCount + }; + rawTicks = scale.ticks(tickParams, domain)?.ticks ?? []; + } else { + const [d0, d1] = findMinMax(domain.map(Number)); + rawTicks = values.filter((value) => value >= d0 && value <= d1).sort((a, b) => a - b); + } + return rawTicks.map((value) => ({ value, visible: true })); + } + avoidLabelCollisions(labelData) { + const { minSpacing } = this.label; + const labelsCollide = (prev, next) => { + if (prev.hidden || next.hidden) { + return false; + } else if (minSpacing == null) { + return prev.box.collidesBBox(next.box); + } + const prevBox = prev.box.clone().grow(minSpacing / 2); + const nextBox = next.box.clone().grow(minSpacing / 2); + return prevBox.collidesBBox(nextBox); + }; + const firstLabel = labelData[0]; + const lastLabel = labelData.at(-1); + if (firstLabel !== lastLabel && isNumberEqual5(firstLabel.x, lastLabel.x) && isNumberEqual5(firstLabel.y, lastLabel.y)) { + lastLabel.hidden = true; + } + for (let step = 1; step < labelData.length; step *= 2) { + let collisionDetected = false; + for (let i = step; i < labelData.length; i += step) { + const next = labelData[i]; + const prev = labelData[i - step]; + if (labelsCollide(prev, next)) { + collisionDetected = true; + break; + } + } + if (!collisionDetected) { + for (const [i, datum] of labelData.entries()) { + if (i % step > 0) { + datum.hidden = true; + datum.box = void 0; + } + } + return; + } + } + for (const [i, datum] of labelData.entries()) { + if (i > 0) { + datum.hidden = true; + datum.box = void 0; + } + } + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +AngleNumberAxis.className = "AngleNumberAxis"; +AngleNumberAxis.type = "angle-number"; +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "min", 2); +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "max", 2); +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "interval", 2); + +// packages/ag-charts-enterprise/src/axes/ordinal/ordinalTimeAxis.ts +import { + _ModuleSupport as _ModuleSupport8 +} from "ag-charts-community"; +var { + OrdinalTimeScale, + Property: Property6, + TimeAxisParentLevel, + lowestGranularityUnitForTicks, + lowestGranularityUnitForValue, + minimumTimeAxisDatumGranularity, + dateTruncationForDomain, + intervalUnit, + intervalStep, + intervalEpoch, + intervalMilliseconds +} = _ModuleSupport8; +var OrdinalTimeAxis = class extends _ModuleSupport8.DiscreteTimeAxis { + constructor(moduleCtx) { + super(moduleCtx, new OrdinalTimeScale()); + this.parentLevel = new TimeAxisParentLevel(); + } + get primaryLabel() { + return this.parentLevel.enabled ? this.parentLevel.label : void 0; + } + get primaryTick() { + return this.parentLevel.enabled ? this.parentLevel.tick : void 0; + } + processData() { + super.processData(); + const { boundSeries, direction } = this; + this.minimumTimeGranularity = minimumTimeAxisDatumGranularity(boundSeries, direction, void 0, void 0); + } + tickFormatParams(domain, ticks, _fractionDigits, timeInterval) { + timeInterval ?? (timeInterval = lowestGranularityUnitForTicks(ticks)); + const truncateDate = dateTruncationForDomain(domain); + const unit = intervalUnit(timeInterval); + const step = intervalStep(timeInterval); + const epoch = intervalEpoch(timeInterval); + return { type: "date", unit, step, epoch, truncateDate }; + } + datumFormatParams(value, params, _fractionDigits, timeInterval, style) { + if (typeof value === "number") + value = new Date(value); + if (timeInterval == null) { + const { minimumTimeGranularity } = this; + const datumGranularity = lowestGranularityUnitForValue(value); + if (minimumTimeGranularity != null && intervalMilliseconds(minimumTimeGranularity) < intervalMilliseconds(datumGranularity)) { + timeInterval = minimumTimeGranularity; + } else { + timeInterval = datumGranularity; + } + } + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + const unit = intervalUnit(timeInterval); + const step = intervalStep(timeInterval); + const epoch = intervalEpoch(timeInterval); + return { + type: "date", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + unit, + step, + epoch, + style + }; + } +}; +OrdinalTimeAxis.className = "OrdinalTimeAxis"; +OrdinalTimeAxis.type = "ordinal-time"; +__decorateClass([ + Property6 +], OrdinalTimeAxis.prototype, "parentLevel", 2); + +// packages/ag-charts-enterprise/src/axes/radius-category/radiusCategoryAxis.ts +import { _ModuleSupport as _ModuleSupport11 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/axes/radius/radiusAxis.ts +import { _ModuleSupport as _ModuleSupport10 } from "ag-charts-community"; +import { isNumberEqual as isNumberEqual7 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/radiusCrossLine.ts +import { _ModuleSupport as _ModuleSupport9 } from "ag-charts-community"; +import { clamp, isNumberEqual as isNumberEqual6 } from "ag-charts-core"; +var { + ChartAxisDirection: ChartAxisDirection4, + Property: Property7, + validateCrossLineValue: validateCrossLineValue2, + normalizeAngle360FromDegrees, + Group: Group3, + Path: Path3, + Sector: Sector2, + RotatableText: RotatableText3 +} = _ModuleSupport9; +var RadiusCrossLineLabel = class extends PolarCrossLineLabel { + constructor() { + super(...arguments); + this.positionAngle = void 0; + } +}; +__decorateClass([ + Property7 +], RadiusCrossLineLabel.prototype, "positionAngle", 2); +var RadiusCrossLine = class extends PolarCrossLine { + constructor() { + super(); + this.direction = ChartAxisDirection4.Radius; + this.label = new RadiusCrossLineLabel(); + this.polygonNode = new Path3(); + this.sectorNode = new Sector2(); + this.crossLineRange = new Group3(); + this.labelNode = new RotatableText3(); + this.outerRadius = 0; + this.innerRadius = 0; + this.crossLineRange.append(this.polygonNode); + this.crossLineRange.append(this.sectorNode); + this.labelGroup.append(this.labelNode); + } + update(visible) { + const { scale } = this; + if (!scale || !validateCrossLineValue2(this, scale)) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.updateRadii(); + const { innerRadius, outerRadius } = this; + visible && (visible = innerRadius >= this.axisInnerRadius && outerRadius <= this.axisOuterRadius); + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updatePolygonNode(visible); + this.updateSectorNode(visible); + this.updateLabelNode(visible); + this.assignCrossLineGroup(this.type === "range", this.crossLineRange); + } + updateRadii() { + const { range: range2, scale, type, axisInnerRadius, axisOuterRadius } = this; + if (!scale) + return { innerRadius: 0, outerRadius: 0 }; + const getRadius = (value) => axisOuterRadius + axisInnerRadius - value; + let outerRadius, innerRadius; + if (type === "line") { + outerRadius = getRadius(scale.convert(this.value)); + innerRadius = outerRadius; + } else { + const bandwidth = Math.abs(scale?.bandwidth ?? 0); + const convertedRange = range2.map((r) => scale.convert(r)); + outerRadius = getRadius(Math.max(...convertedRange)); + innerRadius = getRadius(Math.min(...convertedRange)) + bandwidth; + } + this.outerRadius = outerRadius; + this.innerRadius = innerRadius; + } + drawPolygon(radius, angles, polygon) { + for (const [index, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + if (index === 0) { + polygon.path.moveTo(x, y); + } else { + polygon.path.lineTo(x, y); + } + } + polygon.path.closePath(); + } + updatePolygonNode(visible) { + const { gridAngles, polygonNode: polygon, scale, shape, type, innerRadius, outerRadius } = this; + if (!visible || shape !== "polygon" || !scale || !gridAngles) { + polygon.visible = false; + return; + } + polygon.visible = true; + const padding = this.getPadding(); + polygon.path.clear(true); + this.drawPolygon(outerRadius - padding, gridAngles, polygon); + const reversedAngles = gridAngles.slice().reverse(); + const innerPolygonRadius = type === "line" ? outerRadius - padding : innerRadius + padding; + this.drawPolygon(innerPolygonRadius, reversedAngles, polygon); + this.setSectorNodeProps(polygon); + } + updateSectorNode(visible) { + const { axisInnerRadius, axisOuterRadius, scale, sectorNode: sector, shape, innerRadius, outerRadius } = this; + if (!visible || shape !== "circle" || !scale) { + sector.visible = false; + return; + } + sector.visible = true; + sector.startAngle = 0; + sector.endAngle = 2 * Math.PI; + const padding = this.getPadding(); + const r0 = clamp(axisInnerRadius, innerRadius + padding, axisOuterRadius); + const r1 = clamp(axisInnerRadius, outerRadius - padding, axisOuterRadius); + sector.innerRadius = Math.min(r0, r1); + sector.outerRadius = Math.max(r0, r1); + this.setSectorNodeProps(sector); + } + updateLabelNode(visible) { + const { innerRadius, label, labelNode: node, scale, shape, type } = this; + if (!visible || label.enabled === false || !label.text || !scale) { + node.visible = false; + return; + } + const angle = normalizeAngle360FromDegrees((label.positionAngle ?? 0) - 90); + const isBottomSide = (isNumberEqual6(angle, 0) || angle > 0) && angle < Math.PI; + const rotation = isBottomSide ? angle - Math.PI / 2 : angle + Math.PI / 2; + let distance; + const angles = this.gridAngles ?? []; + if (type === "line") { + distance = innerRadius + label.padding; + } else if (shape === "circle" || angles.length < 3) { + distance = innerRadius - label.padding; + } else { + distance = innerRadius * Math.cos(Math.PI / angles.length) - label.padding; + } + const labelX = distance * Math.cos(angle); + const labelY = distance * Math.sin(angle); + let textBaseline; + if (type === "line") { + textBaseline = isBottomSide ? "top" : "bottom"; + } else { + textBaseline = isBottomSide ? "bottom" : "top"; + } + this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation); + } + getPadding() { + const { scale } = this; + if (!scale) + return 0; + const bandwidth = Math.abs(scale.bandwidth ?? 0); + const step = Math.abs(scale.step ?? 0); + return scale instanceof _ModuleSupport9.BandScale ? (step - bandwidth) / 2 : 0; + } +}; +RadiusCrossLine.className = "RadiusCrossLine"; + +// packages/ag-charts-enterprise/src/axes/radius/radiusAxis.ts +var { + ChartAxisDirection: ChartAxisDirection5, + ZIndexMap, + Property: Property8, + normalizeAngle360: normalizeAngle3603, + toRadians: toRadians2, + Caption, + Group: Group4, + TransformableGroup, + Path: Path4, + Line: Line2, + Selection: Selection2, + generateTicks, + AxisGroupZIndexMap +} = _ModuleSupport10; +var RadiusAxisLabel = class extends _ModuleSupport10.AxisLabel { + constructor() { + super(...arguments); + this.autoRotateAngle = 335; + } +}; +__decorateClass([ + Property8 +], RadiusAxisLabel.prototype, "autoRotate", 2); +__decorateClass([ + Property8 +], RadiusAxisLabel.prototype, "autoRotateAngle", 2); +var RadiusAxis = class extends _ModuleSupport10.PolarAxis { + constructor(moduleCtx, scale) { + super(moduleCtx, scale); + this.positionAngle = 0; + this.gridLineGroupSelection = Selection2.select( + this.gridLineGroup, + Line2, + false + ); + this.generatedTicks = void 0; + this.headingLabelGroup = this.axisGroup.appendChild( + new TransformableGroup({ name: `${this.id}-Axis-heading` }) + ); + this.lineNodeGroup = this.axisGroup.appendChild( + new TransformableGroup({ name: `${this.id}-Axis-line` }) + ); + this.lineNode = this.lineNodeGroup.appendChild( + new Line2({ + name: `${this.id}-Axis-line`, + zIndex: AxisGroupZIndexMap.AxisLine + }) + ); + this.gridPathGroup = this.gridGroup.appendChild( + new Group4({ + name: `${this.id}-gridPaths`, + zIndex: ZIndexMap.AXIS_GRID + }) + ); + this.gridPathSelection = Selection2.select(this.gridPathGroup, Path4); + this.headingLabelGroup.appendChild(this.title.caption.node); + this.cleanup.register(this.title.caption.registerInteraction(this.moduleCtx, "afterend")); + } + get direction() { + return ChartAxisDirection5.Radius; + } + getAxisTransform() { + const maxRadius = this.scale.range[0]; + const { translation, positionAngle, innerRadiusRatio } = this; + const innerRadius = maxRadius * innerRadiusRatio; + const rotation = toRadians2(positionAngle); + return { + translationX: translation.x, + translationY: translation.y - maxRadius - innerRadius, + rotation, + rotationCenterX: 0, + rotationCenterY: maxRadius + innerRadius + }; + } + update() { + super.update(); + this.updateTitle(); + this.updateGridLines(); + const { enabled, stroke, width } = this.line; + this.lineNode.setProperties({ + stroke, + strokeWidth: enabled ? width : 0, + x1: 0, + y1: this.range[0], + x2: 0, + y2: this.range[1] + }); + } + updatePosition() { + super.updatePosition(); + const axisTransform = this.getAxisTransform(); + this.tickLineGroup.setProperties(axisTransform); + this.tickLabelGroup.setProperties(axisTransform); + this.lineNodeGroup.setProperties(axisTransform); + this.headingLabelGroup.setProperties(axisTransform); + } + calculateRotations() { + const rotation = 0; + const parallelFlipRotation = 0; + const regularFlipRotation = -Math.PI / 2; + return { rotation, parallelFlipRotation, regularFlipRotation }; + } + calculateTickLayout(domain, niceMode, _visibleRange) { + const visibleRange = [0, 1]; + const sideFlag = this.label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + this.label.spacing + this.seriesAreaPadding); + const { range: range2, reverse, defaultTickMinSpacing } = this; + const tickGenerationResult = generateTicks({ + scale: this.scale, + label: this.label, + interval: this.interval, + tickFormatter: (...args) => this.tickFormatter(...args), + domain, + range: range2, + reverse, + niceMode, + visibleRange, + defaultTickMinSpacing, + labelOffset: labelX, + sideFlag, + axisRotation: 0, + sizeLimit: void 0, + primaryTickCount: void 0 + }); + const { tickData } = tickGenerationResult; + const { ticks, rawTicks, rawTickCount, tickDomain, fractionDigits, niceDomain = domain } = tickData; + const labels = ticks.map((d) => this.getTickLabelProps(d, tickGenerationResult)); + this.generatedTicks = { ticks, labels }; + return { ticks: rawTicks, tickDomain, niceDomain, rawTickCount, fractionDigits, timeInterval: void 0 }; + } + updateSelections() { + const { generatedTicks } = this; + if (!generatedTicks) + return; + const { ticks, labels } = generatedTicks; + this.gridLineGroupSelection.update(this.gridLength ? ticks : []); + this.tickLabelGroupSelection.update(labels); + this.gridPathSelection.update(this.gridLine.enabled ? this.prepareGridPathTickData(ticks) : []); + this.gridLineGroupSelection.cleanup(); + this.tickLabelGroupSelection.cleanup(); + this.gridPathSelection.cleanup(); + } + // TODO - abstract out + updateLabels() { + if (!this.label.enabled) + return; + const axisLabelPositionFn = _ModuleSupport10.resetAxisLabelSelectionFn(); + this.tickLabelGroupSelection.each((node, datum) => { + node.fill = datum.color; + node.text = datum.text; + node.textBaseline = datum.textBaseline; + node.textAlign = datum.textAlign ?? "center"; + node.setFont(datum); + node.setBoxing(datum); + node.setProperties(axisLabelPositionFn(node, datum)); + }); + } + updateGridLines() { + const { + gridLine: { style, width }, + shape, + generatedTicks + } = this; + if (!style || !generatedTicks) { + return; + } + const styleCount = style.length; + const setStyle = (node, index) => { + const { stroke, lineDash } = style[index % styleCount]; + node.stroke = stroke; + node.strokeWidth = width; + node.lineDash = lineDash; + node.fill = void 0; + }; + const [startAngle, endAngle] = this.gridRange ?? [0, 2 * Math.PI]; + const isFullCircle = isNumberEqual7(endAngle - startAngle, 2 * Math.PI); + const drawCircleShape = (node, value) => { + const { path } = node; + path.clear(true); + const radius = this.getTickRadius(value); + if (isFullCircle) { + path.moveTo(radius, 0); + path.arc(0, 0, radius, 0, 2 * Math.PI); + } else { + path.moveTo(radius * Math.cos(startAngle), radius * Math.sin(startAngle)); + path.arc(0, 0, radius, normalizeAngle3603(startAngle), normalizeAngle3603(endAngle)); + } + if (isFullCircle) { + path.closePath(); + } + }; + const drawPolygonShape = (node, value) => { + const { path } = node; + const angles = this.gridAngles; + path.clear(true); + if (!angles || angles.length < 3) { + return; + } + const radius = this.getTickRadius(value); + for (const [idx, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + if (idx === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + for (const [innerIdx, innerAngle] of angles.entries()) { + const x2 = radius * Math.cos(innerAngle); + const y2 = radius * Math.sin(innerAngle); + if (innerIdx === 0) { + path.moveTo(x2, y2); + } else { + path.lineTo(x2, y2); + } + } + path.closePath(); + } + path.closePath(); + }; + const drawFn = shape === "circle" ? drawCircleShape : drawPolygonShape; + this.gridPathSelection.each((node, value, index) => { + setStyle(node, index); + drawFn(node, value); + }); + } + updateTitle() { + const identityFormatter = (params) => params.defaultValue; + const { title, range: requestedRange } = this; + const { formatter = identityFormatter } = this.title; + title.caption.enabled = title.enabled; + title.caption.fontFamily = title.fontFamily; + title.caption.fontSize = title.fontSize; + title.caption.fontStyle = title.fontStyle; + title.caption.fontWeight = title.fontWeight; + title.caption.color = title.color; + title.caption.wrapping = title.wrapping; + let titleVisible = false; + const titleNode = title.caption.node; + if (title.enabled) { + titleVisible = true; + titleNode.rotation = Math.PI / 2; + titleNode.x = Math.floor((requestedRange[0] + requestedRange[1]) / 2); + titleNode.y = -Caption.SMALL_PADDING; + titleNode.textAlign = "center"; + titleNode.textBaseline = "bottom"; + titleNode.text = this.cachedCallWithContext(formatter, this.getTitleFormatterParams(this.scale.domain)); + } + titleNode.visible = titleVisible; + } + updateCrossLines() { + for (const crossLine of this.crossLines) { + if (crossLine instanceof RadiusCrossLine) { + const { shape, gridAngles, range: range2, innerRadiusRatio } = this; + const radius = range2[0]; + crossLine.shape = shape; + crossLine.gridAngles = gridAngles; + crossLine.axisOuterRadius = radius; + crossLine.axisInnerRadius = radius * innerRadiusRatio; + } + } + super.updateCrossLines(); + } + createLabel() { + return new RadiusAxisLabel(); + } + // TODO - abstract out (shared with cartesian axis) + getTickLabelProps(datum, tickGenerationResult) { + const { label } = this; + const { rotation, textBaseline, textAlign } = tickGenerationResult; + const range2 = this.scale.range; + const text = datum.tickLabel ?? ""; + const sideFlag = label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + label.spacing + this.seriesAreaPadding); + const visible = text !== "" && text != null; + const combinedRotation = rotation; + return { + ...this.getLabelStyles({ value: datum.tick, formattedValue: datum.tickLabel }), + tickId: datum.tickId, + rotation: combinedRotation, + text, + textAlign, + textBaseline, + visible, + x: labelX, + y: datum.translation, + rotationCenterX: labelX, + rotationCenterY: datum.translation, + range: range2 + }; + } +}; +RadiusAxis.CrossLineConstructor = RadiusCrossLine; +__decorateClass([ + Property8 +], RadiusAxis.prototype, "positionAngle", 2); + +// packages/ag-charts-enterprise/src/axes/radius-category/radiusCategoryAxis.ts +var { ProxyPropertyOnWrite, Property: Property9, CategoryScale: CategoryScale2 } = _ModuleSupport11; +var RadiusCategoryAxis = class extends RadiusAxis { + constructor(moduleCtx) { + super(moduleCtx, new CategoryScale2()); + this.shape = "circle"; + this.groupPaddingInner = 0; + this.paddingInner = 0; + this.paddingOuter = 0; + } + hasDefinedDomain() { + return false; + } + normaliseDataDomain(domain) { + return { domain, clipped: false }; + } + prepareGridPathTickData(data) { + return data.slice().reverse(); + } + getTickRadius(tickDatum) { + const { scale, innerRadiusRatio } = this; + const maxRadius = scale.range[0]; + const minRadius = maxRadius * innerRadiusRatio; + if (CategoryScale2.is(scale)) { + const ticks = scale.domain; + const index = ticks.length - 1 - ticks.indexOf(tickDatum.tick); + return index === 0 ? minRadius : scale.inset + scale.step * (index - 0.5) + scale.bandwidth / 2; + } else { + const tickRange = (maxRadius - minRadius) / scale.domain.length; + return maxRadius - tickDatum.translation + minRadius - tickRange / 2; + } + } + tickFormatParams() { + return { type: "category" }; + } + datumFormatParams(value, params) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +RadiusCategoryAxis.className = "RadiusCategoryAxis"; +RadiusCategoryAxis.type = "radius-category"; +__decorateClass([ + Property9 +], RadiusCategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass([ + ProxyPropertyOnWrite("scale", "paddingInner"), + Property9 +], RadiusCategoryAxis.prototype, "paddingInner", 2); +__decorateClass([ + ProxyPropertyOnWrite("scale", "paddingOuter"), + Property9 +], RadiusCategoryAxis.prototype, "paddingOuter", 2); + +// packages/ag-charts-enterprise/src/axes/radius-number/radiusNumberAxis.ts +import { _ModuleSupport as _ModuleSupport12 } from "ag-charts-community"; +var { Property: Property10, normalisedExtentWithMetadata: normalisedExtentWithMetadata2, LinearScale: LinearScale2 } = _ModuleSupport12; +var RadiusNumberAxis = class extends RadiusAxis { + constructor(moduleCtx) { + super(moduleCtx, new LinearScale2()); + this.shape = "polygon"; + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + prepareGridPathTickData(data) { + const { scale } = this; + const domainTop = scale.domain[1]; + return data.filter(({ tick }) => tick !== domainTop).sort((a, b) => b.tick - a.tick); + } + getTickRadius(tickDatum) { + const { scale } = this; + const maxRadius = scale.range[0]; + const minRadius = maxRadius * this.innerRadiusRatio; + return maxRadius - tickDatum.translation + minRadius; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata2(d, min, max); + return { domain: extent3, clipped }; + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +RadiusNumberAxis.className = "RadiusNumberAxis"; +RadiusNumberAxis.type = "radius-number"; +__decorateClass([ + Property10 +], RadiusNumberAxis.prototype, "min", 2); +__decorateClass([ + Property10 +], RadiusNumberAxis.prototype, "max", 2); + +// packages/ag-charts-enterprise/src/axes/axisModules.ts +var { + ordinalTimeAxisOptionsDefs, + angleNumberAxisOptionsDefs, + angleCategoryAxisOptionsDefs, + radiusNumberAxisOptionsDefs, + radiusCategoryAxisOptionsDefs +} = _ModuleSupport13; +var OrdinalTimeAxisModule = { + type: "axis", + name: "ordinal-time", + chartType: "cartesian", + enterprise: true, + options: ordinalTimeAxisOptionsDefs, + create: (ctx) => new OrdinalTimeAxis(ctx) +}; +var AngleNumberAxisModule = { + type: "axis", + name: "angle-number", + chartType: "polar", + enterprise: true, + options: angleNumberAxisOptionsDefs, + create: (ctx) => new AngleNumberAxis(ctx) +}; +var AngleCategoryAxisModule = { + type: "axis", + name: "angle-category", + chartType: "polar", + enterprise: true, + options: angleCategoryAxisOptionsDefs, + create: (ctx) => new AngleCategoryAxis(ctx) +}; +var RadiusNumberAxisModule = { + type: "axis", + name: "radius-number", + chartType: "polar", + enterprise: true, + options: radiusNumberAxisOptionsDefs, + create: (ctx) => new RadiusNumberAxis(ctx) +}; +var RadiusCategoryAxisModule = { + type: "axis", + name: "radius-category", + chartType: "polar", + enterprise: true, + options: radiusCategoryAxisOptionsDefs, + create: (ctx) => new RadiusCategoryAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/charts/standaloneChartModule.ts +import { _ModuleSupport as _ModuleSupport15 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/charts/standaloneChart.ts +import { _ModuleSupport as _ModuleSupport14 } from "ag-charts-community"; +var { Chart } = _ModuleSupport14; +var StandaloneChart = class extends Chart { + getChartType() { + return "standalone"; + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(seriesRect.x); + group.translationY = Math.floor(seriesRect.y); + } + seriesRoot.visible = this.series[0].visible; + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: true, rect: seriesRect, paddedRect: layoutBox } + }); + } + getAriaLabel() { + const seriesType = this.series[0]?.type; + if (seriesType == null) + return ""; + const caption = this.getCaptionText(); + switch (seriesType) { + case "radial-gauge": + case "linear-gauge": { + const captions = []; + if (caption.length !== 0) { + captions.push(caption); + } + for (const series of this.series) { + captions.push(series.getCaptionText()); + } + return this.ctx.localeManager.t("ariaAnnounceGaugeChart", { caption: captions.join(". ") }); + } + case "treemap": + case "sunburst": + return this.ctx.localeManager.t("ariaAnnounceHierarchyChart", { caption }); + default: { + return this.ctx.localeManager.t("ariaAnnounceStandaloneChart", { caption }); + } + } + } +}; +StandaloneChart.className = "StandaloneChart"; +StandaloneChart.type = "standalone"; + +// packages/ag-charts-enterprise/src/charts/standaloneChartModule.ts +var { isAgStandaloneChartOptions, standaloneChartOptionsDefs } = _ModuleSupport15; +var StandaloneChartModule = { + type: "chart", + name: "standalone", + enterprise: true, + options: standaloneChartOptionsDefs, + detect: isAgStandaloneChartOptions, + create(options, resources) { + return new StandaloneChart(options, resources); + } +}; + +// packages/ag-charts-enterprise/src/charts/topologyChartModule.ts +import { _ModuleSupport as _ModuleSupport17 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/charts/topologyChart.ts +import { _ModuleSupport as _ModuleSupport16 } from "ag-charts-community"; +var { Chart: Chart2, MercatorScale, ChartAxisDirection: ChartAxisDirection6, Property: Property11 } = _ModuleSupport16; +function isTopologySeries(series) { + return series.type === "map-shape" || series.type === "map-line" || series.type === "map-marker" || series.type === "map-shape-background" || series.type === "map-line-background"; +} +var TopologyChart = class extends Chart2 { + constructor(options, resources) { + super(options, resources); + this.ctx.zoomManager.updateAxes([ChartAxisDirection6.X, ChartAxisDirection6.Y]); + } + getChartType() { + return "topology"; + } + async updateData() { + await super.updateData(); + const options = this.getOptions(); + if (this.topology !== options.topology) { + this.topology = options.topology; + } + const { topology } = this; + for (const series of this.series) { + if (isTopologySeries(series)) { + series.setChartTopology(topology); + } + } + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + const mapSeries = this.series.filter(isTopologySeries); + const combinedBbox = mapSeries.reduce((combined, series) => { + if (!series.visible) + return combined; + const bbox = series.topologyBounds; + if (bbox == null) + return combined; + if (combined == null) + return bbox; + return combined.merge(bbox); + }, void 0); + let scale; + if (combinedBbox != null) { + const { lon0, lat0, lon1, lat1 } = combinedBbox; + const domain = [ + [lon0, lat0], + [lon1, lat1] + ]; + const bounds = MercatorScale.bounds(domain); + const { width, height } = seriesRect; + const viewBoxScale = Math.min(width / bounds.width, height / bounds.height); + const viewBoxWidth = bounds.width * viewBoxScale; + const viewBoxHeight = bounds.height * viewBoxScale; + const viewBoxOriginX = (width - viewBoxWidth) / 2; + const viewBoxOriginY = (height - viewBoxHeight) / 2; + const x0 = viewBoxOriginX; + const y0 = viewBoxOriginY; + const x1 = viewBoxOriginX + viewBoxWidth; + const y1 = viewBoxOriginY + viewBoxHeight; + const xZoom = this.ctx.zoomManager.getAxisZoom(ChartAxisDirection6.X); + const yZoom = this.ctx.zoomManager.getAxisZoom(ChartAxisDirection6.Y); + const xSpan = (x1 - x0) / (xZoom.max - xZoom.min); + const xStart = x0 - xSpan * xZoom.min; + const ySpan = (y1 - y0) / (1 - yZoom.min - (1 - yZoom.max)); + const yStart = y0 - ySpan * (1 - yZoom.max); + scale = new MercatorScale(domain, [ + [xStart, yStart], + [xStart + xSpan, yStart + ySpan] + ]); + } + for (const series of mapSeries) { + series.scale = scale; + } + const seriesVisible = this.series.some((s) => s.visible); + seriesRoot.visible = seriesVisible; + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(seriesRect.x); + group.translationY = Math.floor(seriesRect.y); + group.setClipRect(seriesRect.clone()); + } + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: seriesVisible, rect: seriesRect, paddedRect: layoutBox } + }); + } +}; +TopologyChart.className = "TopologyChart"; +TopologyChart.type = "topology"; +__decorateClass([ + Property11 +], TopologyChart.prototype, "topology", 2); + +// packages/ag-charts-enterprise/src/charts/topologyChartModule.ts +var { isAgTopologyChartOptions, topologyChartOptionsDefs } = _ModuleSupport17; +var TopologyChartModule = { + type: "chart", + name: "topology", + enterprise: true, + options: topologyChartOptionsDefs, + detect: isAgTopologyChartOptions, + create(options, resources) { + return new TopologyChart(options, resources); + } +}; + +// packages/ag-charts-enterprise/src/features/sync/pluginModules.ts +import { _ModuleSupport as _ModuleSupport64 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/annotationOptionsDef.ts +import { + _ModuleSupport as _ModuleSupport18 +} from "ag-charts-community"; +import { + and, + arrayOf, + arrayOfDefs, + boolean, + constant, + greaterThan, + lessThan, + number, + numberRange, + optionsDefs, + or, + ratio, + required, + string, + typeUnion, + union +} from "ag-charts-core"; +var { + annotationCalloutStylesDefs, + annotationNoteStylesDefs, + annotationTextStylesDef, + annotationCommentStylesDefs, + annotationMeasurerStylesDefs, + annotationQuickMeasurerStylesDefs, + annotationShapeStylesDefs, + annotationChannelTextDefs, + annotationCrossLineStyleDefs, + annotationFibonacciStylesDefs, + annotationLineStyleDefs, + annotationLineTextDefs, + annotationDisjointChannelStyleDefs, + annotationParallelChannelStyleDefs +} = _ModuleSupport18; +var serializableDate = optionsDefs( + { + __type: required(constant("date")), + value: or(string, number) + }, + "a serializable date object" +); +var xValue = or(string, number, serializableDate); +var annotationValue = or( + xValue, + optionsDefs({ + value: xValue, + groupPercentage: numberRange(-1, 2) + }) +); +var channelAnnotationTextOptionsDef = { + ...annotationChannelTextDefs, + label: string +}; +var lineAnnotationTextOptionsDef = { + ...annotationLineTextDefs, + label: string +}; +var annotationPointOptionsDef = { + x: annotationValue, + y: number +}; +var annotationInitialStateOptionsDef = typeUnion( + { + line: { + ...annotationLineStyleDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef + }, + "horizontal-line": { + ...annotationCrossLineStyleDefs, + value: annotationValue, + text: lineAnnotationTextOptionsDef + }, + "vertical-line": { + ...annotationCrossLineStyleDefs, + value: annotationValue, + text: lineAnnotationTextOptionsDef + }, + "disjoint-channel": { + ...annotationDisjointChannelStyleDefs, + startHeight: number, + endHeight: number, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: channelAnnotationTextOptionsDef + }, + "parallel-channel": { + ...annotationParallelChannelStyleDefs, + height: number, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: channelAnnotationTextOptionsDef + }, + "fibonacci-retracement": { + ...annotationFibonacciStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef, + reverse: boolean + }, + "fibonacci-retracement-trend-based": { + ...annotationFibonacciStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + endRetracement: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef, + reverse: boolean + }, + callout: { + ...annotationCalloutStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: string + }, + comment: { + ...annotationCommentStylesDefs, + ...annotationPointOptionsDef, + text: string + }, + note: { + ...annotationNoteStylesDefs, + ...annotationPointOptionsDef, + text: string + }, + text: { + ...annotationTextStylesDef, + ...annotationPointOptionsDef, + text: string + }, + arrow: { + ...annotationLineStyleDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "arrow-up": { + ...annotationShapeStylesDefs, + ...annotationPointOptionsDef + }, + "arrow-down": { + ...annotationShapeStylesDefs, + ...annotationPointOptionsDef + }, + "date-range": { + ...annotationMeasurerStylesDefs, + extendAbove: boolean, + extendBelow: boolean, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "price-range": { + ...annotationMeasurerStylesDefs, + extendLeft: boolean, + extendRight: boolean, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "date-price-range": { + ...annotationMeasurerStylesDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "quick-date-price-range": { + ...annotationMeasurerStylesDefs, + ...annotationQuickMeasurerStylesDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + } + }, + "an annotation initial state object" +); +var initialStateOptionsDef = { + chartType: union("candlestick", "hollow-candlestick", "ohlc", "line", "step-line", "hlc", "high-low"), + annotations: arrayOfDefs(annotationInitialStateOptionsDef), + legend: arrayOfDefs( + { + visible: boolean, + seriesId: string, + itemId: string, + legendItemName: string + }, + "legend state array" + ), + zoom: { + rangeX: { + start: or(number, serializableDate), + end: or(number, serializableDate) + }, + rangeY: { + start: or(number, serializableDate), + end: or(number, serializableDate) + }, + ratioX: { + start: and(ratio, lessThan("end")), + end: and(ratio, greaterThan("start")) + }, + ratioY: { + start: and(ratio, lessThan("end")), + end: and(ratio, greaterThan("start")) + }, + autoScaledAxes: arrayOf(constant("y")) + } +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorOptionsDefs.ts +import { _ModuleSupport as _ModuleSupport63 } from "ag-charts-community"; +import { + array, + arrayOfDefs as arrayOfDefs3, + boolean as boolean7, + callbackOf, + color as color2, + fontOptionsDef, + number as number6, + positiveNumber as positiveNumber2, + ratio as ratio2, + typeUnion as typeUnion2 +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotModule.ts +import { _ModuleSupport as _ModuleSupport24 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeries.ts +import { + _ModuleSupport as _ModuleSupport21 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/box-plot/blotPlotUtil.ts +function prepareBoxPlotFromTo(isVertical) { + const from = isVertical ? { scalingX: 1, scalingY: 0 } : { scalingX: 0, scalingY: 1 }; + const to = { scalingX: 1, scalingY: 1 }; + return { from, to }; +} +function resetBoxPlotSelectionsScalingCenterFn(isVertical) { + return (_node, datum) => { + if (isVertical) { + return { scalingCenterY: datum.scaledValues.medianValue }; + } + return { scalingCenterX: datum.scaledValues.medianValue }; + }; +} + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotNode.ts +import { _ModuleSupport as _ModuleSupport19 } from "ag-charts-community"; +var { + Path: Path5, + Scalable, + ExtendedPath2D, + SceneChangeDetection, + SceneArrayChangeDetection, + BBox: BBox2, + clippedRoundRect: baseClippedRoundRect +} = _ModuleSupport19; +var BoxPlotNode = class extends Scalable(Path5) { + constructor() { + super(...arguments); + this.wickPath = new ExtendedPath2D(); + this.horizontal = false; + this.center = 0; + this.thickness = 0; + this.min = 0; + this.q1 = 0; + this.median = 0; + this.q3 = 0; + this.max = 0; + this.cornerRadius = 0; + this.crisp = false; + this.strokeAlignment = 0; + this.wickStroke = void 0; + this.wickStrokeWidth = void 0; + this.wickStrokeOpacity = void 0; + this.capLengthRatio = 1; + this.wickStrokeAlignment = 0; + } + computeBBox() { + const { horizontal, center, thickness, min, max } = this; + return horizontal ? new BBox2(Math.min(min, max), center - thickness / 2, Math.abs(max - min), thickness) : new BBox2(center - thickness / 2, Math.min(min, max), thickness, Math.abs(max - min)); + } + computeDefaultGradientFillBBox() { + const { horizontal, center, thickness, q1, q3 } = this; + return horizontal ? new BBox2(Math.min(q1, q3), center - thickness / 2, Math.abs(q3 - q1), thickness) : new BBox2(center - thickness / 2, Math.min(q1, q3), thickness, Math.abs(q3 - q1)); + } + isPointInPath(x, y) { + return this.getBBox().containsPoint(x, y); + } + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } + get midPoint() { + return this.horizontal ? { x: (this.min + this.max) / 2, y: this.center } : { x: this.center, y: (this.min + this.max) / 2 }; + } + alignedCoordinates() { + const { thickness, crisp } = this; + let { center, min, q1, median, q3, max } = this; + let x0 = center - thickness / 2; + let x1 = center + thickness / 2; + if (crisp && thickness > 1) { + min = this.align(min); + q1 = this.align(q1); + median = this.align(median); + q3 = this.align(q3); + max = min + this.align(min, max - min); + const halfWidth = this.align(thickness / 2); + center = this.align(center); + x0 = center - halfWidth; + x1 = center + halfWidth; + } + return { center, x0, x1, min, max, q1, median, q3 }; + } + updatePath() { + const { + path, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke, + wickStrokeWidth, + wickStrokeOpacity, + wickLineDash, + wickLineDashOffset, + strokeAlignment, + cornerRadius, + capLengthRatio, + horizontal + } = this; + const { center, x0, x1, min, max, q1, median, q3 } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const wickStrokeAlignment = this.wickStrokeAlignment > 0 ? pixelRatio / this.wickStrokeAlignment / 2 % 1 : 0; + this.path.clear(); + this.wickPath.clear(); + const needsWickPath = wickStroke != null && wickStroke !== stroke || wickStrokeWidth != null && wickStrokeWidth !== strokeWidth || wickStrokeOpacity != null && wickStrokeOpacity !== strokeOpacity || wickLineDash != null && wickLineDash !== lineDash || wickLineDashOffset != null && wickLineDashOffset !== lineDashOffset; + const wickPath = needsWickPath ? this.wickPath : path; + if (Math.abs(x1 - x0) <= 3) { + moveTo(wickPath, horizontal, center, min); + lineTo(wickPath, horizontal, center, max); + return; + } + const wickTop = Math.min(min, max); + const wickBottom = Math.max(min, max); + const boxTop = Math.min(q1, q3); + const boxBottom = Math.max(q1, q3); + const capX0 = center - Math.abs((x1 - x0) * capLengthRatio) / 2; + const capX1 = center + Math.abs((x1 - x0) * capLengthRatio) / 2; + moveTo(wickPath, horizontal, capX0, wickTop - wickStrokeAlignment); + lineTo(wickPath, horizontal, capX1, wickTop - wickStrokeAlignment); + moveTo(wickPath, horizontal, center - wickStrokeAlignment, wickTop - wickStrokeAlignment); + lineTo(wickPath, horizontal, center - wickStrokeAlignment, boxTop + strokeWidth / 2); + moveTo(wickPath, horizontal, center - wickStrokeAlignment, wickBottom + wickStrokeAlignment); + lineTo(wickPath, horizontal, center - wickStrokeAlignment, boxBottom - strokeWidth / 2); + moveTo(wickPath, horizontal, capX0, wickBottom + wickStrokeAlignment); + lineTo(wickPath, horizontal, capX1, wickBottom + wickStrokeAlignment); + const horizontalBoxStrokeAdjustment = strokeWidth / 2 + strokeAlignment; + const verticalBoxStrokeAdjustment = strokeWidth / 2 - strokeAlignment; + const rectHeight = boxBottom - boxTop - 2 * verticalBoxStrokeAdjustment; + if (rectHeight > 0) { + const rectX = x0 + horizontalBoxStrokeAdjustment; + const rectY = boxTop + verticalBoxStrokeAdjustment; + const rectWidth = x1 - x0 - 2 * horizontalBoxStrokeAdjustment; + const cornerRadii = { + topLeft: cornerRadius, + topRight: cornerRadius, + bottomRight: cornerRadius, + bottomLeft: cornerRadius + }; + clippedRoundRect( + path, + horizontal, + rectX, + rectY, + rectWidth, + rectHeight, + cornerRadii, + new BBox2(rectX, rectY, rectWidth, median - rectY) + ); + clippedRoundRect( + path, + horizontal, + rectX, + rectY, + rectWidth, + rectHeight, + cornerRadii, + new BBox2(rectX, median, rectWidth, rectY + rectHeight - median) + ); + } else { + const boxMid = (boxTop + boxBottom) / 2; + moveTo(path, horizontal, x0, boxMid); + lineTo(path, horizontal, x1, boxMid); + } + } + drawPath(ctx) { + super.drawPath(ctx); + const { wickPath } = this; + if (wickPath.isEmpty()) + return; + const { + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke = stroke, + wickStrokeWidth = strokeWidth, + wickStrokeOpacity = strokeOpacity, + wickLineDash = lineDash, + wickLineDashOffset = lineDashOffset + } = this; + if (wickStrokeWidth === 0) + return; + ctx.globalAlpha *= wickStrokeOpacity; + if (typeof wickStroke === "string") { + ctx.strokeStyle = wickStroke; + } + ctx.lineWidth = wickStrokeWidth; + if (wickLineDash != null) { + ctx.setLineDash([...wickLineDash]); + } + ctx.lineDashOffset = wickLineDashOffset; + ctx.stroke(wickPath.getPath2D()); + } +}; +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "horizontal", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "center", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "thickness", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "min", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "q1", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "median", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "q3", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "max", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "cornerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "crisp", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "strokeAlignment", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "wickStroke", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "wickStrokeWidth", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "wickStrokeOpacity", 2); +__decorateClass([ + SceneArrayChangeDetection() +], BoxPlotNode.prototype, "wickLineDash", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "wickLineDashOffset", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "capLengthRatio", 2); +__decorateClass([ + SceneChangeDetection() +], BoxPlotNode.prototype, "wickStrokeAlignment", 2); +function moveTo(path, horizontal, x, y) { + if (horizontal) { + path.moveTo(y, x); + } else { + path.moveTo(x, y); + } +} +function lineTo(path, horizontal, x, y) { + if (horizontal) { + path.lineTo(y, x); + } else { + path.lineTo(x, y); + } +} +function clippedRoundRect(path, horizontal, x, y, width, height, cornerRadii, clipBBox) { + if (horizontal) { + baseClippedRoundRect( + // eslint-disable-next-line sonarjs/arguments-order + path, + y, + x, + height, + width, + cornerRadii, + clipBBox == null ? void 0 : new BBox2(clipBBox.y, clipBBox.x, clipBBox.height, clipBBox.width) + ); + } else { + baseClippedRoundRect(path, x, y, width, height, cornerRadii, clipBBox); + } +} + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport20 } from "ag-charts-community"; +var { BaseProperties: BaseProperties2, AbstractBarSeriesProperties, makeSeriesTooltip, Property: Property12, mergeDefaults } = _ModuleSupport20; +var BoxPlotSeriesCap = class extends BaseProperties2 { + constructor() { + super(...arguments); + this.lengthRatio = 0.5; + } +}; +__decorateClass([ + Property12 +], BoxPlotSeriesCap.prototype, "lengthRatio", 2); +var BoxPlotSeriesWhisker = class extends BaseProperties2 { +}; +__decorateClass([ + Property12 +], BoxPlotSeriesWhisker.prototype, "stroke", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesWhisker.prototype, "strokeWidth", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesWhisker.prototype, "strokeOpacity", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesWhisker.prototype, "lineDash", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesWhisker.prototype, "lineDashOffset", 2); +var BoxPlotSeriesProperties = class extends AbstractBarSeriesProperties { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.cap = new BoxPlotSeriesCap(); + this.whisker = new BoxPlotSeriesWhisker(); + this.tooltip = makeSeriesTooltip(); + } + toJson() { + const { stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const properties = super.toJson(); + properties.whisker = mergeDefaults(properties.whisker, { + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + return properties; + } +}; +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "minKey", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "q1Key", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "medianKey", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "q3Key", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "maxKey", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "minName", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "q1Name", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "medianName", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "q3Name", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "maxName", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "cap", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "whisker", 2); +__decorateClass([ + Property12 +], BoxPlotSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeries.ts +var { + fixNumericExtent, + keyProperty, + mergeDefaults: mergeDefaults2, + SeriesNodePickMode, + SMALLEST_KEY_INTERVAL, + valueProperty, + diff, + animationValidation, + computeBarFocusBounds, + createDatumId, + HighlightState, + ContinuousScale: ContinuousScale2, + ChartAxisDirection: ChartAxisDirection7, + motion, + getItemStyles, + applyShapeFillBBox, + calculateSegments, + toHighlightString +} = _ModuleSupport21; +var BoxPlotSeriesNodeEvent = class extends _ModuleSupport21.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.minKey = series.properties.minKey; + this.q1Key = series.properties.q1Key; + this.medianKey = series.properties.medianKey; + this.q3Key = series.properties.q3Key; + this.maxKey = series.properties.maxKey; + } +}; +var BoxPlotSeries = class extends _ModuleSupport21.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode.NEAREST_NODE, SeriesNodePickMode.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["medianKey", "q1Key", "q3Key", "minKey", "maxKey"] + }, + propertyNames: { + x: ["xName"], + y: ["medianName", "q1Name", "q3Name", "minName", "maxName"] + }, + categoryKey: "xValue", + pathsPerSeries: [] + }); + this.properties = new BoxPlotSeriesProperties(); + this.NodeEvent = BoxPlotSeriesNodeEvent; + } + async processData(dataController) { + if (!this.visible) + return; + const { xKey, minKey, q1Key, medianKey, q3Key, maxKey } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (animationEnabled && this.processedData) { + extraProps.push(diff(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation()); + } + const { processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty(xKey, xScaleType, { id: `xValue` }), + valueProperty(minKey, yScaleType, { id: `minValue` }), + valueProperty(q1Key, yScaleType, { id: `q1Value` }), + valueProperty(medianKey, yScaleType, { id: `medianValue` }), + valueProperty(q3Key, yScaleType, { id: `q3Value` }), + valueProperty(maxKey, yScaleType, { id: `maxValue` }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL] : [], + ...extraProps + ] + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + if (direction !== this.getBarDirection()) { + const { index, def } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = processedData.domain.keys[index]; + if (def.type === "key" && def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yExtent = this.domainForClippedRange(direction, ["minValue", "maxValue"], "xValue"); + return fixNumericExtent(yExtent); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection7.Y, ["maxValue", "minValue"], "xValue", visibleRange); + } + createNodeData() { + const { visible, dataModel, processedData } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const { xKey } = this.properties; + const nodeData = []; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const minValues = dataModel.resolveColumnById(this, "minValue", processedData); + const q1Values = dataModel.resolveColumnById(this, "q1Value", processedData); + const medianValues = dataModel.resolveColumnById(this, "medianValue", processedData); + const q3Values = dataModel.resolveColumnById(this, "q3Value", processedData); + const maxValues = dataModel.resolveColumnById(this, "maxValue", processedData); + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale2.is(xAxis.scale) ? barWidth * -0.5 : 0; + const { groupScale } = this; + const isVertical = this.isVertical(); + const segments = calculateSegments( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + const context = { + itemId: xKey, + nodeData, + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStyles(this.getItemStyle.bind(this)), + segments + }; + if (!visible) + return context; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const minValue = minValues[datumIndex]; + const q1Value = q1Values[datumIndex]; + const medianValue = medianValues[datumIndex]; + const q3Value = q3Values[datumIndex]; + const maxValue = maxValues[datumIndex]; + if ([minValue, q1Value, medianValue, q3Value, maxValue].some((value) => typeof value !== "number") || minValue > q1Value || q1Value > medianValue || medianValue > q3Value || q3Value > maxValue) { + continue; + } + const scaledValues = { + xValue: xAxis.scale.convert(xValue2), + minValue: yAxis.scale.convert(minValue), + q1Value: yAxis.scale.convert(q1Value), + medianValue: yAxis.scale.convert(medianValue), + q3Value: yAxis.scale.convert(q3Value), + maxValue: yAxis.scale.convert(maxValue) + }; + const bandwidth = barWidth; + scaledValues.xValue += groupScale.convert(String(groupIndex)) + barOffset + bandwidth / 2; + const height = Math.abs(scaledValues.q3Value - scaledValues.q1Value); + const midX = scaledValues.xValue; + const midY = Math.min(scaledValues.q3Value, scaledValues.q1Value) + height / 2; + const midPoint = { + x: isVertical ? midX : midY, + y: isVertical ? midY : midX + }; + let focusRect; + if (isVertical) { + focusRect = { + x: midPoint.x - bandwidth / 2, + y: scaledValues.minValue, + width: bandwidth, + height: scaledValues.maxValue - scaledValues.minValue + }; + } else { + focusRect = { + x: scaledValues.minValue, + y: midPoint.y - bandwidth / 2, + width: scaledValues.maxValue - scaledValues.minValue, + height: bandwidth + }; + } + nodeData.push({ + series: this, + itemId: xValue2, + datum, + datumIndex, + xKey, + bandwidth, + scaledValues, + midPoint, + focusRect + }); + } + return context; + } + legendItemSymbol() { + const { fill, stroke, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + HighlightState.None + ); + return { + marker: { + fill: _ModuleSupport21.deepClone(fill), + fillOpacity, + stroke, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { xKey, yName, showInLegend, legendItemName } = this.properties; + if (!xKey || legendType !== "category") { + return []; + } + return [ + { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: seriesId }), + label: { + text: legendItemName ?? yName ?? seriesId + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { + xKey, + xName, + yName, + medianKey, + medianName, + q1Key, + q1Name, + q3Key, + q3Name, + minKey, + minName, + maxKey, + maxName, + legendItemName, + tooltip + } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const minValue = dataModel.resolveColumnById(this, `minValue`, processedData)[datumIndex]; + const q1Value = dataModel.resolveColumnById(this, `q1Value`, processedData)[datumIndex]; + const medianValue = dataModel.resolveColumnById(this, `medianValue`, processedData)[datumIndex]; + const q3Value = dataModel.resolveColumnById(this, `q3Value`, processedData)[datumIndex]; + const maxValue = dataModel.resolveColumnById(this, `maxValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + const data = [ + { + label: minName, + fallbackLabel: minKey, + value: this.getAxisValueText(yAxis, "tooltip", minValue, datum, minKey, legendItemName) + }, + { + label: q1Name, + fallbackLabel: q1Key, + value: this.getAxisValueText(yAxis, "tooltip", q1Value, datum, q1Key, legendItemName) + }, + { + label: medianName, + fallbackLabel: medianKey, + value: this.getAxisValueText(yAxis, "tooltip", medianValue, datum, medianKey, legendItemName) + }, + { + label: q3Name, + fallbackLabel: q3Key, + value: this.getAxisValueText(yAxis, "tooltip", q3Value, datum, q3Key, legendItemName) + }, + { + label: maxName, + fallbackLabel: maxKey, + value: this.getAxisValueText(yAxis, "tooltip", maxValue, datum, maxKey, legendItemName) + } + ]; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + title: legendItemName ?? yName, + symbol: this.legendItemSymbol(), + data + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yName, + medianKey, + medianName, + q1Key, + q1Name, + q3Key, + q3Name, + minKey, + minName, + maxKey, + maxName, + ...format + } + ); + } + animateEmptyUpdateReady({ + datumSelection + }) { + const isVertical = this.isVertical(); + const { from, to } = prepareBoxPlotFromTo(isVertical); + motion.resetMotion([datumSelection], resetBoxPlotSelectionsScalingCenterFn(isVertical)); + motion.staticFromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], from, to, { + phase: "initial" + }); + } + isLabelEnabled() { + return false; + } + updateDatumSelection(opts) { + const data = opts.nodeData ?? []; + return opts.datumSelection.update(data); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + cap: { lengthRatio }, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke, + strokeOpacity, + strokeWidth, + maxKey, + maxName, + medianKey, + medianName, + minKey, + minName, + q1Key, + q1Name, + q3Key, + q3Name, + whisker: { + lineDash: whiskerLineDash, + lineDashOffset: whiskerLineDashOffset, + stroke: whiskerStroke, + strokeOpacity: whiskerStrokeOpacity, + strokeWidth: whiskerStrokeWidth + }, + xKey, + xName, + yName + } = this.properties; + const highlightState = toHighlightString(highlightStateEnum ?? HighlightState.None); + return { + cap: { lengthRatio }, + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + maxKey, + maxName: maxName ?? maxKey, + medianKey, + medianName: medianName ?? medianKey, + minKey, + minName: minName ?? minKey, + q1Key, + q1Name: q1Name ?? q1Key, + q3Key, + q3Name: q3Name ?? q3Key, + seriesId, + stroke, + strokeOpacity, + strokeWidth, + whisker: { + lineDash: whiskerLineDash ?? lineDash, + lineDashOffset: whiskerLineDashOffset ?? lineDashOffset, + stroke: whiskerStroke ?? stroke, + strokeOpacity: whiskerStrokeOpacity ?? strokeOpacity, + strokeWidth: whiskerStrokeWidth ?? strokeWidth + }, + xKey, + xName: xName ?? xKey, + yName + }; + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cap, + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke, + strokeOpacity, + strokeWidth, + styler, + whisker + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + cap: { lengthRatio: stylerResult.cap?.lengthRatio ?? cap.lengthRatio }, + whisker: { + lineDash: stylerResult.whisker?.lineDash ?? whisker.lineDash, + lineDashOffset: stylerResult.whisker?.lineDashOffset ?? whisker.lineDashOffset, + stroke: stylerResult.whisker?.stroke ?? whisker.stroke, + strokeOpacity: stylerResult.whisker?.strokeOpacity ?? whisker.strokeOpacity, + strokeWidth: stylerResult.whisker?.strokeWidth ?? whisker.strokeWidth + } + }; + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style = mergeDefaults2(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults2(overrides, style); + } + } + const { stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = style; + style.whisker = mergeDefaults2(style.whisker, { + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + return style; + } + makeItemStylerParams(datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const { xKey, minKey, q1Key, medianKey, q3Key, maxKey } = this.properties; + const datum = this.processedData?.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + minKey, + q1Key, + medianKey, + q3Key, + maxKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((_, nodeDatum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = this.getItemStyle(nodeDatum.datumIndex, isHighlight, highlightState); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const isVertical = this.isVertical(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const fillBBox = this.getShapeFillBBox(); + const strokeAlignment = this.getStyle(false, false, HighlightState.None).strokeWidth / 2; + const wickStrokeAlignment = properties.whisker.strokeWidth ?? properties.strokeWidth; + datumSelection.each((boxPlotNode, nodeDatum) => { + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + applyShapeFillBBox(boxPlotNode, style.fill, fillBBox); + boxPlotNode.fill = style.fill; + boxPlotNode.fillOpacity = style.fillOpacity; + boxPlotNode.stroke = style.stroke; + boxPlotNode.strokeWidth = style.strokeWidth; + boxPlotNode.strokeOpacity = style.strokeOpacity; + boxPlotNode.lineDash = style.lineDash; + boxPlotNode.lineDashOffset = style.lineDashOffset; + boxPlotNode.wickStroke = style.whisker.stroke; + boxPlotNode.wickStrokeWidth = style.whisker.strokeWidth; + boxPlotNode.wickStrokeOpacity = style.whisker.strokeOpacity; + boxPlotNode.wickLineDash = style.whisker.lineDash; + boxPlotNode.wickLineDashOffset = style.whisker.lineDashOffset; + boxPlotNode.cornerRadius = style.cornerRadius; + boxPlotNode.crisp = true; + boxPlotNode.horizontal = !isVertical; + boxPlotNode.center = nodeDatum.scaledValues.xValue; + boxPlotNode.thickness = nodeDatum.bandwidth; + boxPlotNode.min = nodeDatum.scaledValues.minValue; + boxPlotNode.q1 = nodeDatum.scaledValues.q1Value; + boxPlotNode.median = nodeDatum.scaledValues.medianValue; + boxPlotNode.q3 = nodeDatum.scaledValues.q3Value; + boxPlotNode.max = nodeDatum.scaledValues.maxValue; + boxPlotNode.capLengthRatio = style.cap.lengthRatio; + boxPlotNode.strokeAlignment = strokeAlignment; + boxPlotNode.wickStrokeAlignment = wickStrokeAlignment; + }); + } + updateLabelNodes() { + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData); + } + nodeFactory() { + return new BoxPlotNode(); + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds(this, this.contextNodeData?.nodeData[datumIndex].focusRect); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null; + } +}; +BoxPlotSeries.className = "BoxPlotSeries"; +BoxPlotSeries.type = "box-plot"; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport22 } from "ag-charts-community"; +import { boolean as boolean2, constant as constant2, required as required2, shapeSegmentation, string as string2 } from "ag-charts-core"; +var { boxPlotSeriesThemeableOptionsDef, commonSeriesOptionsDefs } = _ModuleSupport22; +var boxPlotSeriesOptionsDef = { + ...commonSeriesOptionsDefs, + ...boxPlotSeriesThemeableOptionsDef, + type: required2(constant2("box-plot")), + xKey: required2(string2), + minKey: required2(string2), + q1Key: required2(string2), + medianKey: required2(string2), + q3Key: required2(string2), + maxKey: required2(string2), + xName: string2, + yName: string2, + minName: string2, + q1Name: string2, + medianName: string2, + q3Name: string2, + maxName: string2, + grouped: boolean2, + legendItemName: string2, + segmentation: shapeSegmentation +}; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotThemes.ts +import { _ModuleSupport as _ModuleSupport23 } from "ag-charts-community"; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE }, + multiSeriesHighlightStyle, + FILL_GRADIENT_LINEAR_DEFAULTS, + FILL_IMAGE_DEFAULTS, + FILL_PATTERN_DEFAULTS, + SAFE_FILL_OPERATION, + SEGMENTATION_DEFAULTS +} = _ModuleSupport23; +var BOX_PLOT_SERIES_THEME = { + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { + $or: [ + { $isGradient: { $palette: "fill" } }, + { $isPattern: { $palette: "fill" } }, + { $isImage: { $palette: "fill" } } + ] + }, + { $palette: "fill" }, + { $mix: [SAFE_FILL_OPERATION, { $ref: "chartBackgroundColor" }, 0.7] } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: 2, + fillOpacity: 1, + strokeOpacity: 1, + lineDash: void 0, + lineDashOffset: 0, + highlight: multiSeriesHighlightStyle(), + segmentation: SEGMENTATION_DEFAULTS + }, + axes: { + [CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE.CATEGORY]: { + groupPaddingInner: 0.2, + crosshair: { + enabled: false, + snap: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotModule.ts +var BoxPlotModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "box-plot", + moduleFactory: (ctx) => new BoxPlotSeries(ctx), + predictAxis: _ModuleSupport24.predictCartesianTimeAxis, + defaultAxes: _ModuleSupport24.DIRECTION_SWAP_AXES, + themeTemplate: BOX_PLOT_SERIES_THEME, + groupable: true +}; +var BoxPlotSeriesModule = { + type: "series", + name: "box-plot", + chartType: "cartesian", + enterprise: true, + options: boxPlotSeriesOptionsDef, + create: (ctx) => new BoxPlotSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickModule.ts +import { _ModuleSupport as _ModuleSupport34 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeries.ts +import { _ModuleSupport as _ModuleSupport31 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesBase.ts +import { + _ModuleSupport as _ModuleSupport26 +} from "ag-charts-community"; +import { Logger } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcAggregation.ts +import { _ModuleSupport as _ModuleSupport25 } from "ag-charts-community"; +var { + AGGREGATION_SPAN, + AGGREGATION_INDEX_X_MAX, + AGGREGATION_INDEX_X_MIN, + AGGREGATION_INDEX_Y_MAX, + AGGREGATION_INDEX_Y_MIN, + aggregationDomain, + aggregationRangeFittingPoints, + compactAggregationIndices, + createAggregationIndices +} = _ModuleSupport25; +var AGGREGATION_THRESHOLD = 1e3; +var OPEN = AGGREGATION_INDEX_X_MIN; +var HIGH = AGGREGATION_INDEX_Y_MAX; +var LOW = AGGREGATION_INDEX_Y_MIN; +var CLOSE = AGGREGATION_INDEX_X_MAX; +function aggregateOhlcData(scale, xValues, highValues, lowValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD) + return; + const [d0, d1] = aggregationDomain(scale, domain); + let maxRange = aggregationRangeFittingPoints(xValues, d0, d1, { smallestKeyInterval }); + let { indexData, valueData } = createAggregationIndices(xValues, highValues, lowValues, d0, d1, maxRange); + const filters = [{ maxRange, indexData }]; + while (maxRange > 64) { + ({ indexData, valueData, maxRange } = compactAggregationIndices(indexData, valueData, maxRange)); + filters.push({ maxRange, indexData }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesBase.ts +var { + fixNumericExtent: fixNumericExtent2, + keyProperty: keyProperty2, + createDatumId: createDatumId2, + SeriesNodePickMode: SeriesNodePickMode2, + ChartAxisDirection: ChartAxisDirection8, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL2, + valueProperty: valueProperty2, + diff: diff2, + animationValidation: animationValidation2, + computeBarFocusBounds: computeBarFocusBounds2, + visibleRangeIndices, + BandScale, + processedDataIsAnimatable, + mergeDefaults: mergeDefaults3, + simpleMemorize2, + getItemStylesPerItemId +} = _ModuleSupport26; +var memoizedAggregateOhlcData = simpleMemorize2(aggregateOhlcData); +var OhlcSeriesNodeEvent = class extends _ModuleSupport26.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.openKey = series.properties.openKey; + this.closeKey = series.properties.closeKey; + this.highKey = series.properties.highKey; + this.lowKey = series.properties.lowKey; + } +}; +var OhlcSeriesBase = class extends _ModuleSupport26.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode2.AXIS_ALIGNED, SeriesNodePickMode2.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["lowKey", "highKey", "openKey", "closeKey"] + }, + propertyNames: { + x: ["xName"], + y: ["lowName", "highName", "openName", "closeName"] + }, + categoryKey: "xValue", + pathsPerSeries: [] + }); + this.NodeEvent = OhlcSeriesNodeEvent; + this.dataAggregationFilters = void 0; + } + async processData(dataController) { + if (!this.visible) + return; + const { xKey, openKey, closeKey, highKey, lowKey } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (animationEnabled) { + if (this.processedData) { + extraProps.push(diff2(this.id, this.processedData)); + } + extraProps.push(animationValidation2()); + } + if (openKey) { + extraProps.push( + valueProperty2(openKey, yScaleType, { + id: `openValue`, + invalidValue: void 0, + missingValue: void 0 + }) + ); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty2(xKey, xScaleType, { id: `xValue` }), + valueProperty2(closeKey, yScaleType, { id: `closeValue` }), + valueProperty2(highKey, yScaleType, { id: `highValue` }), + valueProperty2(lowKey, yScaleType, { id: `lowValue` }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL2] : [], + ...extraProps + ] + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.dataAggregationFilters = this.aggregateData( + dataModel, + processedData + ); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection8.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const highValues = dataModel.resolveColumnById(this, `highValue`, processedData); + const lowValues = dataModel.resolveColumnById(this, `lowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateOhlcData( + xAxis.scale.type, + xValues, + highValues, + lowValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + if (direction !== this.getBarDirection()) { + const { index, def } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = processedData.domain.keys[index]; + if (def.type === "key" && def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yExtent = this.domainForClippedRange(direction, ["highValue", "lowValue"], "xValue"); + return fixNumericExtent2(yExtent); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection8.Y, ["highValue", "lowValue"], "xValue", visibleRange); + } + getZoomRangeFittingItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.zoomFittingVisibleItems( + "xValue", + ["highValue", "lowValue"], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + getVisibleItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.countVisibleItems( + "xValue", + ["highValue", "lowValue"], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + createNodeData() { + const { visible, dataModel, processedData } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const nodeData = []; + const { xKey, highKey, lowKey } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const openValues = dataModel.resolveColumnById(this, "openValue", processedData); + const closeValues = dataModel.resolveColumnById(this, "closeValue", processedData); + const highValues = dataModel.resolveColumnById(this, "highValue", processedData); + const lowValues = dataModel.resolveColumnById(this, "lowValue", processedData); + const { groupScale } = this; + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const groupOffset = groupScale.convert(String(groupIndex)); + const effectiveBarWidth = barWidth >= 1 ? barWidth : groupScale.rawBandwidth; + const applyWidthOffset = BandScale.is(xAxis.scale); + const context = { + itemId: xKey, + nodeData, + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStylesPerItemId(this.getItemStyle.bind(this), "up", "down") + }; + if (!visible) + return context; + const handleDatum = (datumIndex, xValue2, openValue, closeValue, highValue, lowValue, width, crisp) => { + const datum = rawData[datumIndex]; + const xOffset = applyWidthOffset ? width / 2 : 0; + const centerX = xAxis.scale.convert(xValue2) + groupOffset + xOffset; + const yOpen = yAxis.scale.convert(openValue); + const yClose = yAxis.scale.convert(closeValue); + const yHigh = yAxis.scale.convert(highValue); + const yLow = yAxis.scale.convert(lowValue); + const isRising = closeValue > openValue; + const itemId = isRising ? "up" : "down"; + const y = Math.min(yHigh, yLow); + const height = Math.max(yHigh, yLow) - y; + const midPoint = { + x: centerX, + y: y + height / 2 + }; + nodeData.push({ + series: this, + itemId, + datum, + datumIndex, + xKey, + xValue: xValue2, + openValue, + closeValue, + highValue, + lowValue, + midPoint, + aggregatedValue: closeValue, + isRising, + centerX, + width, + y, + height, + yOpen, + yClose, + crisp + }); + }; + const { dataAggregationFilters } = this; + const xScale = xAxis.scale; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const xPosition = (index) => xScale.convert(xValues[index]) + groupOffset; + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + if (dataAggregationFilter == null) { + const invalidData = processedData.invalidData?.get(this.id); + let [start, end] = visibleRangeIndices(1, rawData.length, xAxis.range, (index) => { + const xOffset = applyWidthOffset ? 0 : -effectiveBarWidth / 2; + const x = xPosition(index) + xOffset; + return [x, x + effectiveBarWidth]; + }); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let datumIndex = start; datumIndex < end; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const openValue = openValues[datumIndex]; + const closeValue = closeValues[datumIndex]; + const highValue = highValues[datumIndex]; + const lowValue = lowValues[datumIndex]; + const validLowValue = lowValue != null && lowValue <= openValue && lowValue <= closeValue; + const validHighValue = highValue != null && highValue >= openValue && highValue >= closeValue; + if (!validLowValue) { + Logger.warnOnce( + `invalid low value for key [${lowKey}] in data element, low value cannot be higher than datum open or close values` + ); + continue; + } + if (!validHighValue) { + Logger.warnOnce( + `invalid high value for key [${highKey}] in data element, high value cannot be lower than datum open or close values.` + ); + continue; + } + handleDatum(datumIndex, xValue2, openValue, closeValue, highValue, lowValue, effectiveBarWidth, true); + } + } else { + const { maxRange, indexData } = dataAggregationFilter; + const [start, end] = visibleRangeIndices(1, maxRange, xAxis.range, (index) => { + const aggIndex = index * AGGREGATION_SPAN; + const openIndex = indexData[aggIndex + OPEN]; + const closeIndex = indexData[aggIndex + CLOSE]; + if (openIndex === -1) + return; + const xOffset = applyWidthOffset ? 0 : -effectiveBarWidth / 2; + return [xPosition(openIndex) + xOffset, xPosition(closeIndex) + xOffset + effectiveBarWidth]; + }); + for (let i = start; i < end; i += 1) { + const aggIndex = i * AGGREGATION_SPAN; + const openIndex = indexData[aggIndex + OPEN]; + const closeIndex = indexData[aggIndex + CLOSE]; + const highIndex = indexData[aggIndex + HIGH]; + const lowIndex = indexData[aggIndex + LOW]; + if (openIndex === -1) + continue; + const midDatumIndex = Math.trunc((openIndex + closeIndex) / 2); + const xValue2 = xValues[midDatumIndex]; + if (xValue2 == null) + continue; + const openValue = openValues[openIndex]; + const closeValue = closeValues[closeIndex]; + const highValue = highValues[highIndex]; + const lowValue = lowValues[lowIndex]; + const width = Math.abs(xPosition(closeIndex) - xPosition(openIndex)) + effectiveBarWidth; + handleDatum(midDatumIndex, xValue2, openValue, closeValue, highValue, lowValue, width, false); + } + } + return context; + } + isVertical() { + return true; + } + isLabelEnabled() { + return false; + } + updateDatumSelection(opts) { + const data = opts.nodeData ?? []; + return opts.datumSelection.update(data); + } + updateLabelNodes(_opts) { + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData); + } + getItemStyle(datumIndex, isHighlight, highlightState, itemId = "up") { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + const baseStyle = mergeDefaults3(highlightStyle, properties.getStyle(itemId)); + let style = baseStyle; + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId2(createDatumId2(xValue2), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(itemId, datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`, "item", itemId], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults3(overrides, style); + } + } + return style; + } + makeItemStylerParams(itemId, datumIndex, isHighlight, style) { + const { id: seriesId, properties, processedData } = this; + const { xKey, openKey, closeKey, highKey, lowKey } = properties; + const datum = processedData.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const params = { + seriesId, + datum, + itemId, + xKey, + openKey, + closeKey, + highKey, + lowKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style + }; + if ("fill" in params && "fill" in style) { + params.fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + } + return params; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { + xKey, + xName, + yName, + openKey, + openName, + highKey, + highName, + lowKey, + lowName, + closeKey, + closeName, + legendItemName, + tooltip + } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const openValue = dataModel.resolveColumnById(this, `openValue`, processedData)[datumIndex]; + const highValue = dataModel.resolveColumnById(this, `highValue`, processedData)[datumIndex]; + const lowValue = dataModel.resolveColumnById(this, `lowValue`, processedData)[datumIndex]; + const closeValue = dataModel.resolveColumnById(this, `closeValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const itemId = closeValue >= openValue ? "up" : "down"; + const item = this.properties.item[itemId]; + const format = this.getItemStyle(datumIndex, false); + const marker = { + fill: item.fill ?? item.stroke, + fillOpacity: item.fillOpacity ?? item.strokeOpacity ?? 1, + stroke: item.stroke, + strokeWidth: item.strokeWidth ?? 1, + strokeOpacity: item.strokeOpacity ?? 1, + lineDash: item.lineDash ?? [0], + lineDashOffset: item.lineDashOffset ?? 0 + }; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + title: legendItemName, + symbol: { + marker + }, + data: [ + { + label: openName, + fallbackLabel: openKey, + value: this.getAxisValueText(yAxis, "tooltip", openValue, datum, openKey, legendItemName) + }, + { + label: highName, + fallbackLabel: highKey, + value: this.getAxisValueText(yAxis, "tooltip", highValue, datum, highKey, legendItemName) + }, + { + label: lowName, + fallbackLabel: lowKey, + value: this.getAxisValueText(yAxis, "tooltip", lowValue, datum, lowKey, legendItemName) + }, + { + label: closeName, + fallbackLabel: closeKey, + value: this.getAxisValueText(yAxis, "tooltip", closeValue, datum, closeKey, legendItemName) + } + ] + }, + { + seriesId, + datum, + title: yName, + itemId, + xKey, + xName, + yName, + openKey, + openName, + highKey, + highName, + lowKey, + lowName, + closeKey, + closeName, + ...format + } + ); + } + computeFocusBounds(opts) { + const nodeDatum = this.getNodeData()?.at(opts.datumIndex); + if (nodeDatum == null) + return; + const { centerX, y, width, height } = nodeDatum; + const datum = { + x: centerX - width / 2, + y, + width, + height + }; + return computeBarFocusBounds2(this, datum); + } +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickNode.ts +import { _ModuleSupport as _ModuleSupport28 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcNode.ts +import { _ModuleSupport as _ModuleSupport27 } from "ag-charts-community"; +var { Path: Path6, SceneChangeDetection: SceneChangeDetection2, BBox: BBox3 } = _ModuleSupport27; +var OhlcBaseNode = class extends Path6 { + constructor() { + super(...arguments); + this.centerX = 0; + this.y = 0; + this.width = 0; + this.height = 0; + this.yOpen = 0; + this.yClose = 0; + this.crisp = false; + } + computeBBox() { + const { centerX, y, width, height } = this; + return new BBox3(centerX - width / 2, y, width, height); + } + isPointInPath(x, y) { + return this.getBBox().containsPoint(x, y); + } + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } + get midPoint() { + return { x: this.centerX, y: this.y + this.height / 2 }; + } + alignedCoordinates() { + const { y, width, height, crisp } = this; + let { centerX, yOpen, yClose } = this; + let x0 = centerX - width / 2; + let x1 = centerX + width / 2; + let y0 = y; + let y1 = y + height; + if (crisp && width > 1) { + centerX = this.align(centerX); + if (yOpen <= yClose) { + const h = this.align(yOpen, yClose - yOpen); + yOpen = this.align(yOpen); + yClose = yOpen + h; + } else { + const h = this.align(yClose, yOpen - yClose); + yClose = this.align(yClose); + yOpen = yClose + h; + } + const halfWidth = this.align(width / 2); + x0 = centerX - halfWidth; + x1 = centerX + halfWidth; + y0 = this.align(y); + y1 = y0 + this.align(y0, height); + } + return { centerX, x0, x1, y0, y1, yOpen, yClose }; + } + executeStroke(ctx, path) { + const { width, strokeWidth } = this; + if (width < strokeWidth) { + ctx.lineWidth = width; + } + super.executeStroke(ctx, path); + } +}; +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "centerX", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "y", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "width", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "height", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "yOpen", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "yClose", 2); +__decorateClass([ + SceneChangeDetection2() +], OhlcBaseNode.prototype, "crisp", 2); +var OhlcNode = class extends OhlcBaseNode { + constructor() { + super(...arguments); + this.strokeAlignment = 0; + } + updatePath() { + const { path } = this; + const { centerX, x0, x1, y0, y1, yOpen, yClose } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const strokeAlignment = this.strokeAlignment > 0 ? pixelRatio / this.strokeAlignment / 2 % 1 : 0; + path.clear(); + path.moveTo(centerX - strokeAlignment, y0); + path.lineTo(centerX - strokeAlignment, y1); + if (Math.abs(x1 - x0) > 1) { + path.moveTo(x0, yOpen - strokeAlignment); + path.lineTo(centerX - strokeAlignment, yOpen - strokeAlignment); + path.moveTo(centerX - strokeAlignment, yClose - strokeAlignment); + path.lineTo(x1, yClose - strokeAlignment); + } + } +}; +__decorateClass([ + SceneChangeDetection2() +], OhlcNode.prototype, "strokeAlignment", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickNode.ts +var { SceneArrayChangeDetection: SceneArrayChangeDetection2, SceneChangeDetection: SceneChangeDetection3, ExtendedPath2D: ExtendedPath2D2, BBox: BBox4 } = _ModuleSupport28; +var CandlestickNode = class extends OhlcBaseNode { + constructor() { + super(...arguments); + this.wickPath = new ExtendedPath2D2(); + this.wickStroke = void 0; + this.wickStrokeWidth = void 0; + this.wickStrokeOpacity = void 0; + this.wickStrokeAlignment = 0; + } + computeDefaultGradientFillBBox() { + const { width, centerX, yOpen, yClose } = this; + const boxTop = Math.min(yOpen, yClose); + const boxBottom = Math.max(yOpen, yClose); + const rectHeight = boxBottom - boxTop; + const x0 = centerX - width / 2; + const x1 = centerX + width / 2; + return new BBox4(x0, boxTop, x1 - x0, rectHeight); + } + updatePath() { + const { + path, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke, + wickStrokeWidth, + wickStrokeOpacity, + wickLineDash, + wickLineDashOffset + } = this; + const { centerX, x0, x1, y0, y1, yOpen, yClose } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const wickStrokeAlignment = this.wickStrokeAlignment > 0 ? pixelRatio / this.wickStrokeAlignment / 2 % 1 : 0; + this.path.clear(); + this.wickPath.clear(); + const needsWickPath = wickStroke != null && wickStroke !== stroke || wickStrokeWidth != null && wickStrokeWidth !== strokeWidth || wickStrokeOpacity != null && wickStrokeOpacity !== strokeOpacity || wickLineDash != null && wickLineDash !== lineDash || wickLineDashOffset != null && wickLineDashOffset !== lineDashOffset; + const wickPath = needsWickPath ? this.wickPath : path; + if (Math.abs(x1 - x0) <= 3) { + wickPath.moveTo(centerX - wickStrokeAlignment, y0); + wickPath.lineTo(centerX - wickStrokeAlignment, y1); + return; + } + const boxTop = Math.min(yOpen, yClose); + const boxBottom = Math.max(yOpen, yClose); + const boxStrokeAdjustment = strokeWidth / 2; + wickPath.moveTo(centerX - wickStrokeAlignment, y0); + wickPath.lineTo(centerX - wickStrokeAlignment, boxTop + boxStrokeAdjustment); + wickPath.moveTo(centerX - wickStrokeAlignment, y1); + wickPath.lineTo(centerX - wickStrokeAlignment, boxBottom - boxStrokeAdjustment); + const rectHeight = boxBottom - boxTop - 2 * boxStrokeAdjustment; + if (rectHeight > 0) { + path.rect( + x0 + boxStrokeAdjustment, + boxTop + boxStrokeAdjustment, + x1 - x0 - 2 * boxStrokeAdjustment, + rectHeight + ); + } else { + const boxMid = (boxTop + boxBottom) / 2; + path.moveTo(x0, boxMid); + path.lineTo(x1, boxMid); + } + } + drawPath(ctx) { + super.drawPath(ctx); + const { wickPath } = this; + if (wickPath.isEmpty()) + return; + const { + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke = stroke, + wickStrokeWidth = strokeWidth, + wickStrokeOpacity = strokeOpacity, + wickLineDash = lineDash, + wickLineDashOffset = lineDashOffset + } = this; + if (wickStrokeWidth === 0) + return; + ctx.globalAlpha *= wickStrokeOpacity; + if (typeof wickStroke === "string") { + ctx.strokeStyle = wickStroke; + } + ctx.lineWidth = wickStrokeWidth; + if (wickLineDash != null) { + ctx.setLineDash([...wickLineDash]); + } + ctx.lineDashOffset = wickLineDashOffset; + ctx.stroke(wickPath.getPath2D()); + } +}; +__decorateClass([ + SceneChangeDetection3() +], CandlestickNode.prototype, "wickStroke", 2); +__decorateClass([ + SceneChangeDetection3() +], CandlestickNode.prototype, "wickStrokeWidth", 2); +__decorateClass([ + SceneChangeDetection3() +], CandlestickNode.prototype, "wickStrokeOpacity", 2); +__decorateClass([ + SceneArrayChangeDetection2() +], CandlestickNode.prototype, "wickLineDash", 2); +__decorateClass([ + SceneChangeDetection3() +], CandlestickNode.prototype, "wickLineDashOffset", 2); +__decorateClass([ + SceneChangeDetection3() +], CandlestickNode.prototype, "wickStrokeAlignment", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport30 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport29 } from "ag-charts-community"; +var { BaseProperties: BaseProperties3, Property: Property13, AbstractBarSeriesProperties: AbstractBarSeriesProperties2, makeSeriesTooltip: makeSeriesTooltip2 } = _ModuleSupport29; +var OhlcSeriesItem = class extends BaseProperties3 { + constructor() { + super(...arguments); + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property13 +], OhlcSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property13 +], OhlcSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property13 +], OhlcSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property13 +], OhlcSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property13 +], OhlcSeriesItem.prototype, "lineDashOffset", 2); +var OhlcSeriesItems = class extends BaseProperties3 { + constructor() { + super(...arguments); + this.up = new OhlcSeriesItem(); + this.down = new OhlcSeriesItem(); + } +}; +__decorateClass([ + Property13 +], OhlcSeriesItems.prototype, "up", 2); +__decorateClass([ + Property13 +], OhlcSeriesItems.prototype, "down", 2); +var OhlcSeriesBaseProperties = class extends AbstractBarSeriesProperties2 { +}; +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "xKey", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "openKey", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "closeKey", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "highKey", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "lowKey", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "xName", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "yName", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "openName", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "closeName", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "highName", 2); +__decorateClass([ + Property13 +], OhlcSeriesBaseProperties.prototype, "lowName", 2); +var OhlcSeriesProperties = class extends OhlcSeriesBaseProperties { + constructor() { + super(...arguments); + this.tooltip = makeSeriesTooltip2(); + this.item = new OhlcSeriesItems(); + } + getStyle(itemId) { + const { strokeWidth, strokeOpacity, stroke, lineDash, lineDashOffset } = this.item[itemId]; + return { + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property13 +], OhlcSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property13 +], OhlcSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property13 +], OhlcSeriesProperties.prototype, "itemStyler", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesProperties.ts +var { BaseProperties: BaseProperties4, makeSeriesTooltip: makeSeriesTooltip3, Property: Property14 } = _ModuleSupport30; +var CandlestickSeriesWick = class extends BaseProperties4 { +}; +__decorateClass([ + Property14 +], CandlestickSeriesWick.prototype, "stroke", 2); +__decorateClass([ + Property14 +], CandlestickSeriesWick.prototype, "strokeWidth", 2); +__decorateClass([ + Property14 +], CandlestickSeriesWick.prototype, "strokeOpacity", 2); +__decorateClass([ + Property14 +], CandlestickSeriesWick.prototype, "lineDash", 2); +__decorateClass([ + Property14 +], CandlestickSeriesWick.prototype, "lineDashOffset", 2); +var CandlestickSeriesItem = class extends BaseProperties4 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.wick = new CandlestickSeriesWick(); + } +}; +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "fill", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "fillOpacity", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "lineDashOffset", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "cornerRadius", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItem.prototype, "wick", 2); +var CandlestickSeriesItems = class extends BaseProperties4 { + constructor() { + super(...arguments); + this.up = new CandlestickSeriesItem(); + this.down = new CandlestickSeriesItem(); + } +}; +__decorateClass([ + Property14 +], CandlestickSeriesItems.prototype, "up", 2); +__decorateClass([ + Property14 +], CandlestickSeriesItems.prototype, "down", 2); +var CandlestickSeriesProperties = class extends OhlcSeriesBaseProperties { + constructor() { + super(); + this.item = new CandlestickSeriesItems(); + this.tooltip = makeSeriesTooltip3(); + this.highlightStyle.deprecated = false; + } + getStyle(itemId) { + const { fill, fillOpacity, strokeWidth, strokeOpacity, stroke, lineDash, lineDashOffset, cornerRadius, wick } = this.item[itemId]; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1, + wick + }; + } +}; +__decorateClass([ + Property14 +], CandlestickSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property14 +], CandlestickSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property14 +], CandlestickSeriesProperties.prototype, "itemStyler", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeries.ts +var { isGradientFill, isPatternFill, isImageFill, applyShapeStyle } = _ModuleSupport31; +var CandlestickSeries = class extends OhlcSeriesBase { + constructor() { + super(...arguments); + this.properties = new CandlestickSeriesProperties(); + } + nodeFactory() { + const node = new CandlestickNode(); + node.lineCap = "butt"; + return node; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { up, down } = properties.item; + datumSelection.each((node, datum) => { + const { centerX, width, y, height, yOpen, yClose, crisp } = datum; + const baseStyle = datum.isRising ? up : down; + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + node.centerX = centerX; + node.width = width; + node.y = y; + node.height = height; + node.yOpen = yOpen; + node.yClose = yClose; + node.crisp = crisp; + applyShapeStyle(node, style, this.getShapeFillBBox()); + const styleWick = style?.wick; + node.wickStroke = styleWick?.stroke; + node.wickStrokeWidth = styleWick?.strokeWidth; + node.wickStrokeOpacity = styleWick?.strokeOpacity; + node.wickLineDash = styleWick?.lineDash; + node.wickLineDashOffset = styleWick?.lineDashOffset; + node.wickStrokeAlignment = baseStyle.wick.strokeWidth ?? baseStyle.strokeWidth; + }); + } + legendItemSymbol() { + const { up, down } = this.properties.item; + const upColorStops = isGradientFill(up.fill) ? up.fill.colorStops.map( + (c) => typeof c === "string" ? c : { color: c.color, stop: c.stop == null ? void 0 : c.stop * 0.5 } + ) : [ + { color: isPatternFill(up.fill) || isImageFill(up.fill) ? up.stroke : up.fill, stop: 0 }, + { color: isPatternFill(up.fill) || isImageFill(up.fill) ? up.stroke : up.fill, stop: 0.5 } + ]; + const downColorStops = isGradientFill(down.fill) ? down.fill.colorStops.map( + (c) => typeof c === "string" ? c : { color: c.color, stop: c.stop == null ? void 0 : c.stop * 0.5 } + ) : [{ color: isPatternFill(down.fill) || isImageFill(down.fill) ? down.stroke : down.fill, stop: 0.5 }]; + const fill = { + type: "gradient", + gradient: "linear", + rotation: 90, + colorStops: [...upColorStops, ...downColorStops], + reverse: false + }; + const stroke = { + type: "gradient", + gradient: "linear", + rotation: 90, + colorStops: [ + { color: up.stroke, stop: 0 }, + { color: up.stroke, stop: 0.5 }, + { color: down.stroke, stop: 0.5 } + ], + reverse: false + }; + return { + marker: { + fill, + fillOpacity: up.fillOpacity, + stroke, + strokeWidth: up.strokeWidth ?? 1, + strokeOpacity: up.strokeOpacity ?? 1, + lineDash: up.lineDash, + lineDashOffset: up.lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id, + data, + visible, + ctx: { legendManager } + } = this; + const { xKey, yName, showInLegend, legendItemName } = this.properties; + if (!data?.data.length || !xKey || legendType !== "category") { + return []; + } + return [ + { + legendType: "category", + id, + itemId: id, + seriesId: id, + enabled: visible && legendManager.getItemEnabled({ seriesId: id, itemId: id }), + label: { + text: legendItemName ?? yName ?? id + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + hasItemStylers() { + return this.properties.itemStyler != null; + } +}; +CandlestickSeries.className = "CandleStickSeries"; +CandlestickSeries.type = "candlestick"; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport32 } from "ag-charts-community"; +import { boolean as boolean3, constant as constant3, number as number2, required as required3, string as string3, undocumented } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs2, candlestickSeriesThemeableOptionsDef } = _ModuleSupport32; +var candlestickSeriesOptionsDef = { + ...commonSeriesOptionsDefs2, + ...candlestickSeriesThemeableOptionsDef, + type: required3(constant3("candlestick")), + xKey: required3(string3), + openKey: required3(string3), + highKey: required3(string3), + lowKey: required3(string3), + closeKey: required3(string3), + xName: string3, + yName: string3, + openName: string3, + highName: string3, + lowName: string3, + closeName: string3 +}; +candlestickSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented(boolean3); +candlestickSeriesOptionsDef.focusPriority = undocumented(number2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickThemes.ts +import { _ModuleSupport as _ModuleSupport33 } from "ag-charts-community"; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE2 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle2, + FILL_GRADIENT_LINEAR_KEYED_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS2, + FILL_PATTERN_KEYED_DEFAULTS +} = _ModuleSupport33; +function itemTheme(key) { + return { + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + key === "up" ? "transparent" : { $palette: "fill" }, + { $palette: `${key}.fill` } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_KEYED_DEFAULTS(key)], + ["image", FILL_IMAGE_DEFAULTS2], + ["pattern", FILL_PATTERN_KEYED_DEFAULTS(key)] + ] + }, + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: `${key}.stroke` } + ] + } + }; +} +var CANDLESTICK_SERIES_THEME = { + series: { + item: { + up: itemTheme("up"), + down: itemTheme("down") + }, + highlightStyle: { + item: { strokeWidth: 3 } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: multiSeriesHighlightStyle2() + }, + animation: { enabled: false }, + axes: { + [CARTESIAN_AXIS_TYPE2.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE2.ORDINAL_TIME]: { + groupPaddingInner: 0, + crosshair: { + enabled: true + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickModule.ts +var { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE3, CARTESIAN_POSITION } = _ModuleSupport34.ThemeConstants; +var CandlestickModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "candlestick", + moduleFactory: (ctx) => new CandlestickSeries(ctx), + defaultAxes: [ + { + type: CARTESIAN_AXIS_TYPE3.NUMBER, + position: CARTESIAN_POSITION.LEFT + }, + { + type: CARTESIAN_AXIS_TYPE3.ORDINAL_TIME, + position: CARTESIAN_POSITION.BOTTOM + } + ], + themeTemplate: CANDLESTICK_SERIES_THEME, + groupable: false +}; +var CandlestickSeriesModule = { + type: "series", + name: "candlestick", + chartType: "cartesian", + enterprise: true, + options: candlestickSeriesOptionsDef, + create: (ctx) => new CandlestickSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapModule.ts +import { _ModuleSupport as _ModuleSupport40 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeries.ts +import { _ModuleSupport as _ModuleSupport37 } from "ag-charts-community"; +import { Logger as Logger3, toPlainText } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/util/labelFormatter.ts +import { Logger as Logger2, cachedTextMeasurer, findMaxValue, wrapLines } from "ag-charts-core"; +function generateLabelSecondaryLabelFontSizeCandidates(label, secondaryLabel) { + const { fontSize: labelFontSize, minimumFontSize: labelMinimumFontSize = labelFontSize } = label; + const { + fontSize: secondaryLabelFontSize, + minimumFontSize: secondaryLabelMinimumFontSize = secondaryLabelFontSize + } = secondaryLabel; + const labelTracks = labelFontSize - labelMinimumFontSize; + const secondaryLabelTracks = secondaryLabelFontSize - secondaryLabelMinimumFontSize; + let currentLabelFontSize = label.fontSize; + let currentSecondaryLabelFontSize = secondaryLabel.fontSize; + const out = [{ labelFontSize, secondaryLabelFontSize }]; + while (currentLabelFontSize > labelMinimumFontSize || currentSecondaryLabelFontSize > secondaryLabelMinimumFontSize) { + const labelProgress = labelTracks > 0 ? (currentLabelFontSize - labelMinimumFontSize) / labelTracks : -1; + const secondaryLabelProgress = secondaryLabelTracks > 0 ? (currentSecondaryLabelFontSize - secondaryLabelMinimumFontSize) / secondaryLabelTracks : -1; + if (labelProgress > secondaryLabelProgress) { + currentLabelFontSize--; + } else { + currentSecondaryLabelFontSize--; + } + out.push({ + labelFontSize: currentLabelFontSize, + secondaryLabelFontSize: currentSecondaryLabelFontSize + }); + } + out.reverse(); + return out; +} +function formatStackedLabels(labelValue, labelProps, secondaryLabelValue, secondaryLabelProps, { padding }, sizeFittingHeight) { + const { spacing = 0 } = labelProps; + const widthAdjust = 2 * padding; + const heightAdjust = 2 * padding + spacing; + const minimumHeight = (labelProps.minimumFontSize ?? labelProps.fontSize) + (secondaryLabelProps.minimumFontSize ?? secondaryLabelProps.fontSize); + if (minimumHeight > sizeFittingHeight(minimumHeight + heightAdjust, false).height - heightAdjust) + return; + const fontSizeCandidates = generateLabelSecondaryLabelFontSizeCandidates(labelProps, secondaryLabelProps); + const labelTextSizeProps = { + fontFamily: labelProps.fontFamily, + fontStyle: labelProps.fontStyle, + fontWeight: labelProps.fontWeight + }; + const secondaryLabelTextSizeProps = { + fontFamily: secondaryLabelProps.fontFamily, + fontStyle: secondaryLabelProps.fontStyle, + fontWeight: secondaryLabelProps.fontWeight + }; + let label; + let secondaryLabel; + return findMaxValue(0, fontSizeCandidates.length - 1, (index) => { + const { labelFontSize, secondaryLabelFontSize } = fontSizeCandidates[index]; + const allowTruncation = index === 0; + const labelFont = { ...labelTextSizeProps, fontSize: labelFontSize }; + const secondaryLabelFont = { ...secondaryLabelTextSizeProps, fontSize: secondaryLabelFontSize }; + const labelLineHeight = cachedTextMeasurer(labelFont).lineHeight(); + const secondaryLabelLineHeight = cachedTextMeasurer(secondaryLabelFont).lineHeight(); + const sizeFitting = sizeFittingHeight( + labelLineHeight + secondaryLabelLineHeight + heightAdjust, + allowTruncation + ); + const availableWidth = sizeFitting.width - widthAdjust; + const availableHeight = sizeFitting.height - heightAdjust; + if (labelLineHeight + secondaryLabelLineHeight > availableHeight) + return; + if (label == null || label.fontSize !== labelFontSize) { + label = wrapLabel( + labelProps, + labelValue, + availableWidth, + availableHeight, + labelFont, + labelProps.wrapping, + allowTruncation ? labelProps.overflowStrategy : "hide" + ); + } + if (label == null || label.width > availableWidth || label.height > availableHeight) + return; + if (secondaryLabel == null || secondaryLabel.fontSize !== secondaryLabelFontSize) { + secondaryLabel = wrapLabel( + secondaryLabelProps, + secondaryLabelValue, + availableWidth, + availableHeight, + secondaryLabelFont, + secondaryLabelProps.wrapping, + allowTruncation ? secondaryLabelProps.overflowStrategy : "hide" + ); + } + if (secondaryLabel == null) + return; + const totalLabelHeight = label.height + secondaryLabel.height; + if (secondaryLabel.width > availableWidth || totalLabelHeight > availableHeight) + return; + return { + width: Math.max(label.width, secondaryLabel.width), + height: totalLabelHeight + spacing, + meta: sizeFitting.meta, + label, + secondaryLabel + }; + }); +} +function formatSingleLabel(value, props, { padding }, sizeFittingHeight) { + const sizeAdjust = 2 * padding; + const minimumFontSize = Math.min(props.minimumFontSize ?? props.fontSize, props.fontSize); + const textSizeProps = { + fontFamily: props.fontFamily, + fontStyle: props.fontStyle, + fontWeight: props.fontWeight + }; + return findMaxValue(minimumFontSize, props.fontSize, (fontSize) => { + const currentFont = { ...textSizeProps, fontSize }; + const measurer = cachedTextMeasurer(currentFont); + const allowTruncation = fontSize === minimumFontSize; + const lineHeight = props.lineHeight ?? measurer.lineHeight(); + const sizeFitting = sizeFittingHeight(lineHeight + sizeAdjust, allowTruncation); + const availableWidth = sizeFitting.width - sizeAdjust; + const availableHeight = sizeFitting.height - sizeAdjust; + if (lineHeight > availableHeight || availableWidth < 0) + return; + const lines = wrapLines(value, { + maxWidth: availableWidth, + maxHeight: availableHeight, + font: currentFont, + textWrap: props.wrapping, + overflow: (allowTruncation ? props.overflowStrategy : null) ?? "hide" + }); + if (!lines.length) + return; + const { width, height } = measurer.measureLines(lines); + const text = lines.join("\n"); + return [{ width, height, text, fontSize, lineHeight }, sizeFitting.meta]; + }); +} +function hasInvalidFontSize(label) { + return label?.minimumFontSize != null && label?.fontSize != null && label?.minimumFontSize > label?.fontSize; +} +function formatLabels(baseLabelValue, labelProps, baseSecondaryLabelValue, secondaryLabelProps, layoutParams, sizeFittingHeight) { + const labelValue = labelProps.enabled ? baseLabelValue : void 0; + const secondaryLabelValue = secondaryLabelProps.enabled ? baseSecondaryLabelValue : void 0; + if (hasInvalidFontSize(labelProps) || hasInvalidFontSize(secondaryLabelProps)) { + Logger2.warnOnce(`minimumFontSize should be set to a value less than or equal to the font size`); + } + let value; + if (labelValue != null && secondaryLabelValue != null) { + value = formatStackedLabels( + labelValue, + labelProps, + secondaryLabelValue, + secondaryLabelProps, + layoutParams, + sizeFittingHeight + ); + } + let labelMeta; + if (value == null && labelValue != null) { + labelMeta = formatSingleLabel(labelValue, labelProps, layoutParams, sizeFittingHeight); + } + if (labelMeta != null) { + const [label, meta] = labelMeta; + value = { + width: label.width, + height: label.height, + meta, + label, + secondaryLabel: void 0 + }; + } + let secondaryLabelMeta; + if (value == null && labelValue == null && secondaryLabelValue != null) { + secondaryLabelMeta = formatSingleLabel( + secondaryLabelValue, + secondaryLabelProps, + layoutParams, + sizeFittingHeight + ); + } + if (secondaryLabelMeta != null) { + const [secondaryLabel, meta] = secondaryLabelMeta; + value = { + width: secondaryLabel.width, + height: secondaryLabel.height, + meta, + label: void 0, + secondaryLabel + }; + } + return value; +} +function wrapLabel(props, text, maxWidth, maxHeight, font, textWrap, overflow) { + const lines = wrapLines(text, { maxWidth, maxHeight, font, textWrap, overflow }); + if (!lines.length) + return; + const measurer = cachedTextMeasurer(font); + const lineHeight = props.lineHeight ?? measurer.lineHeight(); + const { width } = measurer.measureLines(lines); + return { + width, + lineHeight, + text: lines.join("\n"), + height: lines.length * lineHeight, + fontSize: font.fontSize + }; +} + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport36 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/util/autoSizedLabel.ts +import { _ModuleSupport as _ModuleSupport35 } from "ag-charts-community"; +var { Property: Property15 } = _ModuleSupport35; +var BaseAutoSizedLabel = class extends _ModuleSupport35.Label { + constructor() { + super(...arguments); + this.wrapping = "on-space"; + this.overflowStrategy = "ellipsis"; + } +}; +__decorateClass([ + Property15 +], BaseAutoSizedLabel.prototype, "wrapping", 2); +__decorateClass([ + Property15 +], BaseAutoSizedLabel.prototype, "overflowStrategy", 2); +__decorateClass([ + Property15 +], BaseAutoSizedLabel.prototype, "lineHeight", 2); +__decorateClass([ + Property15 +], BaseAutoSizedLabel.prototype, "minimumFontSize", 2); +var AutoSizedLabel = class extends BaseAutoSizedLabel { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property15 +], AutoSizedLabel.prototype, "spacing", 2); +var AutoSizedSecondaryLabel = class extends BaseAutoSizedLabel { +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesProperties.ts +var { CartesianSeriesProperties, makeSeriesTooltip: makeSeriesTooltip4, Property: Property16 } = _ModuleSupport36; +var HeatmapSeriesProperties = class extends CartesianSeriesProperties { + constructor() { + super(...arguments); + this.colorRange = ["black", "black"]; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.itemPadding = 0; + this.label = new AutoSizedLabel(); + this.tooltip = makeSeriesTooltip4(); + } +}; +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "textAlign", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "verticalAlign", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "itemPadding", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property16 +], HeatmapSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode3, + computeBarFocusBounds: computeBarFocusBounds3, + getMissCount, + valueProperty: valueProperty3, + ChartAxisDirection: ChartAxisDirection9, + DEFAULT_CARTESIAN_DIRECTION_KEYS, + DEFAULT_CARTESIAN_DIRECTION_NAMES, + createDatumId: createDatumId3, + ColorScale, + Rect, + PointerEvents, + applyShapeStyle: applyShapeStyle2, + mergeDefaults: mergeDefaults4, + formatValue, + addHitTestersToQuadtree, + findQuadtreeMatch, + updateLabelNode +} = _ModuleSupport37; +var HeatmapSeriesNodeEvent = class extends _ModuleSupport37.CartesianSeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.colorKey = series.properties.colorKey; + } +}; +var textAlignFactors = { + left: -0.5, + center: 0, + right: -0.5 +}; +var verticalAlignFactors = { + top: -0.5, + middle: 0, + bottom: -0.5 +}; +var HeatmapSeries = class extends _ModuleSupport37.CartesianSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: { + ...DEFAULT_CARTESIAN_DIRECTION_KEYS, + color: ["colorKey"] + }, + propertyNames: { + ...DEFAULT_CARTESIAN_DIRECTION_NAMES, + color: ["colorName"] + }, + categoryKey: void 0, + pickModes: [SeriesNodePickMode3.NEAREST_NODE, SeriesNodePickMode3.EXACT_SHAPE_MATCH], + pathsPerSeries: [] + }); + this.properties = new HeatmapSeriesProperties(); + this.NodeEvent = HeatmapSeriesNodeEvent; + this.colorScale = new ColorScale(); + } + async processData(dataController) { + const xAxis = this.axes[ChartAxisDirection9.X]; + const yAxis = this.axes[ChartAxisDirection9.Y]; + if (!xAxis || !yAxis || !this.data?.data.length) { + return; + } + const { xKey, yKey, colorRange, colorKey } = this.properties; + const xScale = this.axes[ChartAxisDirection9.X]?.scale; + const yScale = this.axes[ChartAxisDirection9.Y]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const colorScaleType = this.colorScale.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty3(xKey, xScaleType, { id: "xValue" }), + valueProperty3(yKey, yScaleType, { id: "yValue" }), + ...colorKey ? [valueProperty3(colorKey, colorScaleType, { id: "colorValue", invalidValue: void 0 })] : [] + ] + }); + if (this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const rawDomain = processedData.domain.values[colorKeyIdx].filter((v) => v != null); + const domain = _ModuleSupport37.extent(rawDomain); + this.colorScale.domain = domain ?? []; + if (domain?.length && domain[0] === domain[1]) { + const midIndex = Math.floor(colorRange.length / 2); + this.colorScale.range = [colorRange[midIndex], colorRange[midIndex]]; + } else { + this.colorScale.range = colorRange; + } + this.colorScale.update(); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorDataIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount(this, processedData.defs.values[colorDataIdx].missing); + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const actualCount = processedData.domain.values[colorKeyIdx].filter((v) => v != null).length; + const colorDataMissing = dataCount === 0 || dataCount === missCount || actualCount === 0; + return !colorDataMissing; + } + xCoordinateRange(xValue2, pixelSize) { + const xScale = this.axes[ChartAxisDirection9.X].scale; + const xOffset = pixelSize * (xScale.bandwidth ?? 0) / 2; + const x = xScale.convert(xValue2) + xOffset; + const width = pixelSize * (xScale.bandwidth ?? 10); + return [x, x + width]; + } + yCoordinateRange(yValues, pixelSize) { + const yScale = this.axes[ChartAxisDirection9.Y].scale; + const yOffset = pixelSize * (yScale.bandwidth ?? 0) / 2; + const y = yScale.convert(yValues[0]) + yOffset; + const height = pixelSize * (yScale.bandwidth ?? 10); + return [y, y + height]; + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) + return []; + if (direction === ChartAxisDirection9.X) { + return dataModel.getDomain(this, `xValue`, "value", processedData); + } else { + return dataModel.getDomain(this, `yValue`, "value", processedData); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { data, visible, axes, dataModel, processedData } = this; + const xAxis = axes[ChartAxisDirection9.X]; + const yAxis = axes[ChartAxisDirection9.Y]; + if (!(data && dataModel && processedData && visible && xAxis && yAxis)) + return; + if (xAxis.type !== "category" || yAxis.type !== "category") { + Logger3.warnOnce( + `Heatmap series expected axes to have "category" type, but received "${xAxis.type}" and "${yAxis.type}" instead.` + ); + return; + } + const { xKey, xName, yKey, yName, colorKey, colorName, textAlign, verticalAlign, itemPadding, label } = this.properties; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const colorValues = colorKey ? dataModel.resolveColumnById(this, `colorValue`, processedData) : void 0; + const colorDomain = colorKey ? dataModel.getDomain(this, "colorValue", "value", processedData) : []; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const yOffset = (yScale.bandwidth ?? 0) / 2; + const nodeData = []; + const labelData = []; + const width = xScale.bandwidth ?? 10; + const height = yScale.bandwidth ?? 10; + const textAlignFactor = (width - 2 * itemPadding) * textAlignFactors[textAlign]; + const verticalAlignFactor = (height - 2 * itemPadding) * verticalAlignFactors[verticalAlign]; + const sizeFittingHeight = () => ({ width, height, meta: null }); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xDatum = xValues[datumIndex]; + const yDatum = yValues[datumIndex]; + const x = xScale.convert(xDatum) + xOffset; + const y = yScale.convert(yDatum) + yOffset; + const colorValue = colorValues?.[datumIndex]; + const labelText = label.enabled && colorValue != null ? this.getLabelText( + colorValue, + datum, + colorKey, + "color", + colorDomain, + label, + { value: colorValue, datum, colorKey, colorName, xKey, yKey, xName, yName } + ) : void 0; + const labels = formatLabels( + toPlainText(labelText), + this.properties.label, + void 0, + this.properties.label, + { padding: itemPadding }, + sizeFittingHeight + ); + const point = { x, y, size: 0 }; + const style = this.getItemStyle({ datumIndex, datum, colorValue }, false); + nodeData.push({ + series: this, + itemId: yKey, + datumIndex, + yKey, + xKey, + xValue: xDatum, + yValue: yDatum, + colorValue, + datum, + point, + width, + height, + midPoint: { x, y }, + missing: colorValues != null && colorValue == null, + style + }); + if (labels?.label != null) { + const { text, fontSize, lineHeight, height: labelHeight } = labels.label; + const { fontStyle, fontFamily, fontWeight, color: color6 } = this.properties.label; + const lx = point.x + textAlignFactor * (width - 2 * itemPadding); + const ly = point.y + verticalAlignFactor * (height - 2 * itemPadding) - (labels.height - labelHeight) * 0.5; + labelData.push({ + series: this, + itemId: yKey, + datum, + datumIndex, + text, + fontSize, + lineHeight, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + textBaseline: verticalAlign, + x: lx, + y: ly, + style + }); + } + } + return { + itemId: this.properties.yKey ?? this.id, + nodeData, + labelData, + scales: this.calculateScaling(), + visible: this.visible + }; + } + nodeFactory() { + return new Rect(); + } + update(params) { + this.ctx.animationManager.skipCurrentBatch(); + return super.update(params); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data); + } + getItemStyle({ datumIndex, datum, colorValue }, isHighlight) { + const { properties } = this; + const { itemStyler, stroke, strokeWidth, strokeOpacity } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const style = mergeDefaults4(highlightStyle, { + fill: this.isColorScaleValid() && colorValue != null ? this.colorScale.convert(colorValue) : "transparent", + fillOpacity: 1, + stroke, + strokeWidth, + strokeOpacity, + opacity: 1 + }); + let overrides; + if (itemStyler != null && datumIndex != null) { + overrides = this.cachedDatumCallback(createDatumId3(datumIndex, isHighlight ? "highlight" : "node"), () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + }); + } + return overrides ? mergeDefaults4(overrides, style) : style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId, properties } = this; + const { xKey, yKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + yKey, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const xAxis = this.axes[ChartAxisDirection9.X]; + const [visibleMin, visibleMax] = xAxis?.visibleRange ?? []; + const isZoomed = visibleMin !== 0 || visibleMax !== 1; + const crisp = !isZoomed; + datumSelection.each((rect, nodeDatum) => { + const { point, width, height, style } = nodeDatum; + applyShapeStyle2(rect, style); + rect.crisp = crisp; + rect.x = Math.floor(point.x - width / 2); + rect.y = Math.floor(point.y - height / 2); + rect.width = Math.ceil(width); + rect.height = Math.ceil(height); + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + const { enabled } = this.properties.label; + const data = enabled ? labelData : []; + return labelSelection.update(data); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((text, datum) => { + text.pointerEvents = PointerEvents.None; + text.text = datum.text; + text.fillOpacity = this.getHighlightStyle(false, datum.datumIndex)?.opacity ?? 1; + updateLabelNode(this, text, this.properties, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties, colorScale, ctx } = this; + const { formatManager } = ctx; + const { xKey, xName, yKey, yName, colorKey, colorName, colorRange, title, legendItemName, tooltip } = properties; + const xAxis = axes[ChartAxisDirection9.X]; + const yAxis = axes[ChartAxisDirection9.Y]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + const colorValue = colorKey != null && this.isColorScaleValid() ? dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex] : void 0; + if (xValue2 == null) + return; + const data = []; + let fill; + if (colorValue == null) { + fill = colorRange[0]; + } else { + fill = colorScale.convert(colorValue); + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue(colorValue) }); + } + data.push( + { + label: xName, + fallbackLabel: xKey, + value: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName) + }, + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, yKey, legendItemName) + } + ); + const format = this.getItemStyle({ datumIndex, datum, colorValue }, false); + if (format.fill != null) { + fill = format.fill; + } + const symbol = fill == null ? void 0 : { + marker: { + shape: "square", + fill, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + } + }; + return this.formatTooltipWithContext( + tooltip, + { title: title ?? legendItemName, symbol, data }, + { + seriesId, + datum, + title, + xKey, + xName, + yKey, + yName, + colorKey, + colorName, + ...format + } + ); + } + getLegendData(legendType) { + if (legendType !== "gradient" || !this.isColorScaleValid() || !this.dataModel) { + return []; + } + return [ + { + legendType: "gradient", + enabled: this.visible, + seriesId: this.id, + series: this.getFormatterContext("color"), + colorDomain: this.colorScale.domain, + colorRange: this.colorScale.range + } + ]; + } + isLabelEnabled() { + return this.properties.label.enabled && Boolean(this.properties.colorKey); + } + getBandScalePadding() { + return { inner: 0, outer: 0 }; + } + computeFocusBounds({ datumIndex }) { + const datum = this.contextNodeData?.nodeData[datumIndex]; + if (datum === void 0) + return void 0; + const { width, height, midPoint } = datum; + const focusRect = { x: midPoint.x - width / 2, y: midPoint.y - height / 2, width, height }; + return computeBarFocusBounds3(this, focusRect); + } + initQuadTree(quadtree) { + addHitTestersToQuadtree(quadtree, this.datumNodesIter()); + } + pickNodesExactShape(point) { + const item = findQuadtreeMatch(this, point); + return item != null && item.distance <= 0 ? [item.datum] : []; + } + pickNodeClosestDatum(point) { + return findQuadtreeMatch(this, point); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +HeatmapSeries.className = "HeatmapSeries"; +HeatmapSeries.type = "heatmap"; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport38 } from "ag-charts-community"; +import { arrayOf as arrayOf2, color, constant as constant4, required as required4, string as string4 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs3, heatmapSeriesThemeableOptionsDef, without } = _ModuleSupport38; +var heatmapSeriesOptionsDef = { + ...without(heatmapSeriesThemeableOptionsDef, ["showInLegend"]), + ...without(commonSeriesOptionsDefs3, ["showInLegend"]), + type: required4(constant4("heatmap")), + xKey: required4(string4), + yKey: required4(string4), + colorKey: string4, + xName: string4, + yName: string4, + colorName: string4, + colorRange: arrayOf2(color) +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapThemes.ts +import { _ModuleSupport as _ModuleSupport39 } from "ag-charts-community"; +var HEATMAP_SERIES_THEME = { + series: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $ref: "chartBackgroundColor" }, + { $path: ["/0", { $palette: "stroke" }, { $palette: "strokes" }] } + ] + }, + strokeWidth: { $isUserOption: ["./stroke", 2, void 0] }, + // @ts-expect-error undocumented option + colorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "divergingColors" }, + _ModuleSupport39.SAFE_RANGE2_OPERATION + ] + }, + label: { + ..._ModuleSupport39.LABEL_BOXING_DEFAULTS, + enabled: false, + color: { $ref: "textColor" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + wrapping: "on-space", + overflowStrategy: "ellipsis" + }, + itemPadding: 3, + highlight: _ModuleSupport39.singleSeriesHighlightStyle() + }, + gradientLegend: { + enabled: true, + ..._ModuleSupport39.LEGEND_CONTAINER_THEME + } +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE4, CARTESIAN_POSITION: CARTESIAN_POSITION2 } +} = _ModuleSupport40; +var HeatmapModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "heatmap", + moduleFactory: (ctx) => new HeatmapSeries(ctx), + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE4.CATEGORY, position: CARTESIAN_POSITION2.LEFT }, + { type: CARTESIAN_AXIS_TYPE4.CATEGORY, position: CARTESIAN_POSITION2.BOTTOM } + ], + themeTemplate: HEATMAP_SERIES_THEME +}; +var HeatmapSeriesModule = { + type: "series", + name: "heatmap", + chartType: "cartesian", + enterprise: true, + options: heatmapSeriesOptionsDef, + create: (ctx) => new HeatmapSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcModule.ts +import { _ModuleSupport as _ModuleSupport43 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeries.ts +import { _ModuleSupport as _ModuleSupport41 } from "ag-charts-community"; +var { applyShapeStyle: applyShapeStyle3 } = _ModuleSupport41; +var OhlcSeries = class extends OhlcSeriesBase { + constructor() { + super(...arguments); + this.properties = new OhlcSeriesProperties(); + } + nodeFactory() { + const node = new OhlcNode(); + node.lineCap = "square"; + return node; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { up, down } = properties.item; + datumSelection.each((node, datum) => { + const { centerX, width, y, height, yOpen, yClose, crisp } = datum; + const baseStyle = datum.isRising ? up : down; + node.centerX = centerX; + node.width = width; + node.y = y; + node.height = height; + node.yOpen = yOpen; + node.yClose = yClose; + node.crisp = crisp; + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle3(node, style); + node.strokeAlignment = baseStyle.strokeWidth; + }); + } + getLegendData(legendType) { + const { + id, + data, + ctx: { legendManager }, + visible + } = this; + const { + xKey, + yName, + item: { up, down }, + showInLegend, + legendItemName + } = this.properties; + if (!data?.data.length || !xKey || legendType !== "category") { + return []; + } + const fill = { + type: "gradient", + gradient: "linear", + colorSpace: "rgb", + colorStops: [ + { color: up.stroke, stop: 0 }, + { color: up.stroke, stop: 0.5 }, + { color: down.stroke, stop: 0.5 } + ], + rotation: 90 + }; + return [ + { + legendType: "category", + id, + itemId: id, + seriesId: id, + enabled: visible && legendManager.getItemEnabled({ seriesId: id, itemId: id }), + label: { + text: legendItemName ?? yName ?? id + }, + symbol: { + marker: { + fill, + fillOpacity: up.strokeOpacity, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + } + }, + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + hasItemStylers() { + return this.properties.itemStyler != null; + } +}; +OhlcSeries.className = "ohlc"; +OhlcSeries.type = "ohlc"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport42 } from "ag-charts-community"; +import { boolean as boolean4, constant as constant5, number as number3, required as required5, string as string5, undocumented as undocumented2 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs4, ohlcSeriesThemeableOptionsDef } = _ModuleSupport42; +var ohlcSeriesOptionsDef = { + ...commonSeriesOptionsDefs4, + ...ohlcSeriesThemeableOptionsDef, + type: required5(constant5("ohlc")), + xKey: required5(string5), + openKey: required5(string5), + highKey: required5(string5), + lowKey: required5(string5), + closeKey: required5(string5), + xName: string5, + yName: string5, + openName: string5, + highName: string5, + lowName: string5, + closeName: string5 +}; +ohlcSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented2(boolean4); +ohlcSeriesOptionsDef.focusPriority = undocumented2(number3); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE5, CARTESIAN_POSITION: CARTESIAN_POSITION3 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle3 +} = _ModuleSupport43; +var OhlcModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "ohlc", + moduleFactory: (ctx) => new OhlcSeries(ctx), + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE5.NUMBER, position: CARTESIAN_POSITION3.LEFT }, + { type: CARTESIAN_AXIS_TYPE5.ORDINAL_TIME, position: CARTESIAN_POSITION3.BOTTOM } + ], + themeTemplate: { + animation: { enabled: false }, + series: { + item: { + up: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: "up.stroke" } + ] + } + }, + down: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: "down.stroke" } + ] + } + } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: multiSeriesHighlightStyle3(false) + }, + axes: { + [CARTESIAN_AXIS_TYPE5.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE5.ORDINAL_TIME]: { + groupPaddingInner: 0, + crosshair: { + enabled: true + } + } + } + }, + groupable: false +}; +var OhlcSeriesModule = { + type: "series", + name: "ohlc", + chartType: "cartesian", + enterprise: true, + options: ohlcSeriesOptionsDef, + create: (ctx) => new OhlcSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaModule.ts +import { _ModuleSupport as _ModuleSupport51 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/range-area/rangeArea.ts +import { + _ModuleSupport as _ModuleSupport48 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaAggregation.ts +import { _ModuleSupport as _ModuleSupport44 } from "ag-charts-community"; +var { + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX2, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN2, + aggregationDomain: aggregationDomain2, + aggregationIndexForXRatio, + aggregationRangeFittingPoints: aggregationRangeFittingPoints2, + aggregationXRatioForXValue, + compactAggregationIndices: compactAggregationIndices2, + createAggregationIndices: createAggregationIndices2 +} = _ModuleSupport44; +var AGGREGATION_THRESHOLD2 = 1e3; +function aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf); + const aggIndex = aggregationIndexForXRatio(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MAX2]; +} +function aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf); + const aggIndex = aggregationIndexForXRatio(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MIN2]; +} +function aggregateRangeAreaData(scale, xValues, highValues, lowValues, domain, xNeedsValueOf, yNeedsValueOf) { + if (xValues.length < AGGREGATION_THRESHOLD2) + return; + const [d0, d1] = aggregationDomain2(scale, domain); + let maxRange = aggregationRangeFittingPoints2(xValues, d0, d1, { xNeedsValueOf }); + const { indexData, valueData } = createAggregationIndices2(xValues, highValues, lowValues, d0, d1, maxRange, { + xNeedsValueOf, + yNeedsValueOf + }); + let topIndices = []; + let bottomIndices = []; + for (let datumIndex = 0; datumIndex < xValues.length; datumIndex += 1) { + if (aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf)) { + topIndices.push(datumIndex); + } + if (aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf)) { + bottomIndices.push(datumIndex); + } + } + const filters = [{ maxRange, topIndices, bottomIndices }]; + while (maxRange > 64) { + ({ maxRange } = compactAggregationIndices2(indexData, valueData, maxRange, { inPlace: true })); + topIndices = topIndices.filter( + (datumIndex) => aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) + ); + bottomIndices = bottomIndices.filter( + (datumIndex) => aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) + ); + filters.push({ maxRange, topIndices, bottomIndices }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaIntersection.ts +import { _ModuleSupport as _ModuleSupport45 } from "ag-charts-community"; +function getYValueAtX({ span }, x) { + switch (span.type) { + case "linear": + case "step": + case "multi-line": { + const t = (x - span.x0) / (span.x1 - span.x0); + return span.y0 + t * (span.y1 - span.y0); + } + case "cubic": { + const { cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y } = span; + let t = 0.5; + const tolerance = 1e-6; + for (let i = 0; i < 10; i++) { + const mt2 = 1 - t; + const xt = mt2 * mt2 * mt2 * cp0x + 3 * mt2 * mt2 * t * cp1x + 3 * mt2 * t * t * cp2x + t * t * t * cp3x; + const fx = xt - x; + if (Math.abs(fx) < tolerance) + break; + const dxdt = 3 * mt2 * mt2 * (cp1x - cp0x) + 6 * mt2 * t * (cp2x - cp1x) + 3 * t * t * (cp3x - cp2x); + if (Math.abs(dxdt) < 1e-12) + break; + t = t - fx / dxdt; + t = Math.max(0, Math.min(1, t)); + } + const mt = 1 - t; + return mt * mt * mt * cp0y + 3 * mt * mt * t * cp1y + 3 * mt * t * t * cp2y + t * t * t * cp3y; + } + } +} +function findSpanForX(spans, x, startIndex = 0) { + for (let i = startIndex; i < spans.length; i++) { + const span = spans[i]; + const [start, end] = _ModuleSupport45.spanRange(span.span); + if (x >= start.x && x <= end.x) { + return { span, index: i }; + } + if (x < start.x) { + break; + } + } + return { span: null, index: startIndex }; +} +function checkForIntersection(highSpans, lowSpans, x, wasInverted, spanIndex) { + const high = findSpanForX(highSpans, x, spanIndex); + const low = findSpanForX(lowSpans, x, spanIndex); + if (!high.span || !low.span) { + return { intersection: null, spanIndex: high.index, isInverted: wasInverted }; + } + const highY = getYValueAtX(high.span, x); + const lowY = getYValueAtX(low.span, x); + const isInverted = highY > lowY; + const intersection = wasInverted === isInverted ? null : { x, y: highY }; + return { intersection, spanIndex: high.index, isInverted }; +} +function findRangeAreaIntersections(highSpans, lowSpans, minX, maxX, initiallyInverted = false) { + if (highSpans.length === 0 || lowSpans.length === 0) + return []; + const intersections = []; + let wasInverted = initiallyInverted; + let spanIndex = 0; + for (let x = minX; x <= maxX; x += 0.5) { + const result = checkForIntersection(highSpans, lowSpans, x, wasInverted, spanIndex); + if (result.intersection) { + intersections.push(result.intersection.x); + } + spanIndex = result.spanIndex; + wasInverted = result.isInverted; + } + return intersections; +} +function calculateIntersectionSegments(intersections, seriesRect, chartSize, startsInverted, style = {}) { + const horizontalMargin = Math.max(seriesRect.x, chartSize.width - (seriesRect.x + seriesRect.width)); + const verticalMargin = Math.max(seriesRect.y, chartSize.height - (seriesRect.y + seriesRect.height)); + const result = []; + const createClipRect = (x0, x1) => ({ + x0, + y0: -verticalMargin, + x1, + y1: seriesRect.height + verticalMargin + }); + if (startsInverted) { + result.push({ + clipRect: createClipRect(-horizontalMargin, intersections[0] ?? seriesRect.width + horizontalMargin), + ...style + }); + } + const startIndex = startsInverted ? 1 : 0; + for (let i = startIndex; i < intersections.length; i += 2) { + result.push({ + clipRect: createClipRect(intersections[i], intersections[i + 1] ?? seriesRect.width + horizontalMargin), + ...style + }); + } + return result; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaProperties.ts +import { _ModuleSupport as _ModuleSupport46 } from "ag-charts-community"; +var { + BaseProperties: BaseProperties5, + CartesianSeriesProperties: CartesianSeriesProperties2, + InterpolationProperties, + SeriesMarker, + makeSeriesTooltip: makeSeriesTooltip5, + Property: Property17, + DropShadow, + Label +} = _ModuleSupport46; +var RangeAreaSeriesLabel = class extends Label { + constructor() { + super(...arguments); + this.placement = "outside"; + this.spacing = 0; + } +}; +__decorateClass([ + Property17 +], RangeAreaSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property17 +], RangeAreaSeriesLabel.prototype, "spacing", 2); +var RangeAreaInvertedStyle = class { + constructor() { + this.enabled = false; + this.fillOpacity = 1; + } +}; +__decorateClass([ + Property17 +], RangeAreaInvertedStyle.prototype, "enabled", 2); +__decorateClass([ + Property17 +], RangeAreaInvertedStyle.prototype, "fill", 2); +__decorateClass([ + Property17 +], RangeAreaInvertedStyle.prototype, "fillOpacity", 2); +var RangeAreaLineStyle = class extends BaseProperties5 { + constructor() { + super(...arguments); + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.marker = new SeriesMarker(); + } +}; +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "stroke", 2); +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "lineDash", 2); +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "lineDashOffset", 2); +__decorateClass([ + Property17 +], RangeAreaLineStyle.prototype, "marker", 2); +var RangeAreaItemProperties = class extends BaseProperties5 { + constructor() { + super(...arguments); + this.low = new RangeAreaLineStyle(); + this.high = new RangeAreaLineStyle(); + } +}; +__decorateClass([ + Property17 +], RangeAreaItemProperties.prototype, "low", 2); +__decorateClass([ + Property17 +], RangeAreaItemProperties.prototype, "high", 2); +var SharedRangeAreaMarker = class extends BaseProperties5 { +}; +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "enabled", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "shape", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "size", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "fill", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "fillOpacity", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "stroke", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "strokeWidth", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "strokeOpacity", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "lineDash", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "lineDashOffset", 2); +__decorateClass([ + Property17 +], SharedRangeAreaMarker.prototype, "itemStyler", 2); +var RangeAreaProperties = class extends CartesianSeriesProperties2 { + constructor() { + super(...arguments); + this.fill = "#99CCFF"; + this.fillOpacity = 1; + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.interpolation = new InterpolationProperties(); + this.item = new RangeAreaItemProperties(); + this.invertedStyle = new RangeAreaInvertedStyle(); + this.shadow = new DropShadow().set({ enabled: false }); + this.marker = new SharedRangeAreaMarker(); + this.label = new RangeAreaSeriesLabel(); + this.tooltip = makeSeriesTooltip5(); + this.connectMissingData = false; + } +}; +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "xKey", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "yLowKey", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "yHighKey", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "xName", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "yName", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "yLowName", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "yHighName", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "fill", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "stroke", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "lineDash", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "interpolation", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "styler", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "item", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "invertedStyle", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "shadow", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "marker", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "label", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "tooltip", 2); +__decorateClass([ + Property17 +], RangeAreaProperties.prototype, "connectMissingData", 2); + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaUtil.ts +import { + _ModuleSupport as _ModuleSupport47 +} from "ag-charts-community"; +var { + CollapseMode, + isScaleValid, + pairUpSpans, + prepareAreaFillAnimationFns, + plotInterpolatedLinePathStroke, + prepareLinePathPropertyAnimation, + areScalingEqual +} = _ModuleSupport47; +function prepareRangeAreaPathStrokeAnimationFns(status, highSpans, lowSpans, visibleToggleMode) { + const removePhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.removed); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.removed); + }; + const updatePhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.moved); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.moved); + }; + const addPhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.added); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.added); + }; + const pathProperties = prepareLinePathPropertyAnimation(status, visibleToggleMode); + return { status, path: { addPhaseFn, updatePhaseFn, removePhaseFn }, pathProperties }; +} +function prepareRangeAreaPathAnimation(newData, oldData, diff8) { + const isCategoryBased = newData.scales.x?.type === "category"; + const wasCategoryBased = oldData.scales.x?.type === "category"; + if (isCategoryBased !== wasCategoryBased || !isScaleValid(newData.scales.x) || !isScaleValid(oldData.scales.x)) { + return; + } + let status = "updated"; + if (oldData.visible && !newData.visible) { + status = "removed"; + } else if (!oldData.visible && newData.visible) { + status = "added"; + } + const fillSpans = pairUpSpans( + { scales: newData.scales, data: newData.fillData.spans }, + { scales: oldData.scales, data: oldData.fillData.spans }, + CollapseMode.Split + ); + if (fillSpans == null) + return; + const fillPhantomSpans = pairUpSpans( + { scales: newData.scales, data: newData.fillData.phantomSpans }, + { scales: oldData.scales, data: oldData.fillData.phantomSpans }, + CollapseMode.Split + ); + if (fillPhantomSpans == null) + return; + const highStrokeSpans = pairUpSpans( + { scales: newData.scales, data: newData.highStrokeData.spans }, + { scales: oldData.scales, data: oldData.highStrokeData.spans }, + CollapseMode.Split + ); + if (highStrokeSpans == null) + return; + const lowStrokeSpans = pairUpSpans( + { scales: newData.scales, data: newData.lowStrokeData.spans }, + { scales: oldData.scales, data: oldData.lowStrokeData.spans }, + CollapseMode.Split + ); + if (lowStrokeSpans == null) + return; + const fadeMode = "fade"; + const fill = prepareAreaFillAnimationFns(status, fillSpans, fillPhantomSpans, fadeMode); + const stroke = prepareRangeAreaPathStrokeAnimationFns(status, highStrokeSpans, lowStrokeSpans, fadeMode); + const hasMotion = (diff8?.changed ?? true) || !areScalingEqual(newData.scales.x, oldData.scales.x) || !areScalingEqual(newData.scales.y, oldData.scales.y) || status !== "updated"; + return { status, fill, stroke, hasMotion }; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeArea.ts +var { + valueProperty: valueProperty4, + keyProperty: keyProperty3, + ChartAxisDirection: ChartAxisDirection10, + mergeDefaults: mergeDefaults5, + updateLabelNode: updateLabelNode2, + fixNumericExtent: fixNumericExtent3, + buildResetPathFn, + resetLabelFn, + resetMarkerFn, + resetMarkerPositionFn, + pathSwipeInAnimation, + resetMotion, + markerSwipeScaleInAnimation, + seriesLabelFadeInAnimation, + animationValidation: animationValidation3, + diff: diff3, + updateClipPath, + computeMarkerFocusBounds, + plotAreaPathFill, + plotLinePathStroke, + interpolatePoints, + pathFadeInAnimation, + markerFadeInAnimation, + fromToMotion, + pathMotion, + extent, + applyShapeFillBBox: applyShapeFillBBox2, + PointerEvents: PointerEvents2, + Marker, + BBox: BBox5, + findMinMax: findMinMax2, + applyShapeStyle: applyShapeStyle4, + processedDataIsAnimatable: processedDataIsAnimatable2, + simpleMemorize2: simpleMemorize22, + markerEnabled, + getMarkerStyles, + calculateSegments: calculateSegments2, + toHighlightString: toHighlightString2, + HighlightState: HighlightState2 +} = _ModuleSupport48; +var memoizedAggregateRangeAreaData = simpleMemorize22(aggregateRangeAreaData); +var RangeAreaSeriesNodeEvent = class extends _ModuleSupport48.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yLowKey = series.properties.yLowKey; + this.yHighKey = series.properties.yHighKey; + } +}; +var BaseSeries = _ModuleSupport48.CartesianSeries; +var RangeAreaSeries = class extends BaseSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pathsPerSeries: ["fill", "lowStroke", "highStroke"], + pickModes: [_ModuleSupport48.SeriesNodePickMode.AXIS_ALIGNED], + propertyKeys: { + [ChartAxisDirection10.X]: ["xKey"], + [ChartAxisDirection10.Y]: ["yLowKey", "yHighKey"] + }, + propertyNames: { + [ChartAxisDirection10.X]: ["xName"], + [ChartAxisDirection10.Y]: ["yLowName", "yHighName", "yName"] + }, + categoryKey: "xValue", + animationResetFns: { + path: buildResetPathFn({ getVisible: () => this.visible, getOpacity: () => this.getOpacity() }), + label: resetLabelFn, + datum: (node, datum) => ({ ...resetMarkerFn(node), ...resetMarkerPositionFn(node, datum) }) + }, + clipFocusBox: false + }); + this.properties = new RangeAreaProperties(); + this.NodeEvent = RangeAreaSeriesNodeEvent; + this.dataAggregationFilters = void 0; + } + async processData(dataController) { + const { xKey, yLowKey, yHighKey } = this.properties; + const xScale = this.axes[ChartAxisDirection10.X]?.scale; + const yScale = this.axes[ChartAxisDirection10.Y]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + if (!this.ctx.animationManager.isSkipped() && this.processedData) { + extraProps.push(diff3(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation3()); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty3(xKey, xScaleType, { id: `xValue` }), + valueProperty4(yLowKey, yScaleType, { id: `yLowValue` }), + valueProperty4(yHighKey, yScaleType, { id: `yHighValue` }), + ...extraProps + ] + }); + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable2(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection10.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + const xNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `xValue`, processedData); + const yNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `yHighValue`, processedData); + return memoizedAggregateRangeAreaData( + xAxis.scale.type, + xValues, + yHighValues, + yLowValues, + domain, + xNeedsValueOf, + yNeedsValueOf + ); + } + xCoordinateRange(xValue2) { + const x = this.axes[ChartAxisDirection10.X].scale.convert(xValue2); + return [x, x]; + } + yCoordinateRange(yValues) { + const y = this.axes[ChartAxisDirection10.Y].scale.convert(yValues[0]); + return [y, y]; + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + const { + domain: { + keys: [keys] + } + } = processedData; + if (direction === ChartAxisDirection10.X) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef.def.valueType === "category") { + return keys; + } + return fixNumericExtent3(extent(keys)); + } else { + const yExtent = this.domainForClippedRange(ChartAxisDirection10.Y, ["yHighValue", "yLowValue"], "xValue"); + const fixedYExtent = findMinMax2(yExtent); + return fixNumericExtent3(fixedYExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection10.Y, ["yHighValue", "yLowValue"], "xValue", visibleRange); + } + createNodeData() { + const { data, dataModel, processedData, axes } = this; + const xAxis = axes[ChartAxisDirection10.X]; + const yAxis = axes[ChartAxisDirection10.Y]; + if (!(data && xAxis && yAxis && dataModel && processedData && this.chart?.seriesRect)) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const { xKey, yLowKey, yHighKey, connectMissingData, interpolation, fill, fillOpacity, item } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yHighValues = dataModel.resolveColumnById(this, "yHighValue", processedData); + const yLowValues = dataModel.resolveColumnById(this, "yLowValue", processedData); + const xPosition = (index) => xScale.convert(xValues[index]) + xOffset; + const labelData = []; + const markerData = []; + const spanPoints = []; + const handleDatumPoint = (datumIndex, yHighValue, yLowValue) => { + const datum = rawData[datumIndex]; + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return; + const currentSpanPoints = spanPoints.at(-1); + if (Number.isFinite(yHighValue) && Number.isFinite(yLowValue)) { + const appendMarker = (id, yValue, y) => { + const { size } = item[id].marker; + markerData.push({ + index: datumIndex, + series: this, + itemId: id, + datum, + datumIndex, + midPoint: { x, y }, + yHighValue, + yLowValue, + xValue: xValue2, + xKey, + yLowKey, + yHighKey, + point: { x, y, size }, + enabled: true + }); + const highLabelDatum = this.createLabelData({ + datumIndex, + point: { x, y }, + value: yValue, + yLowValue, + yHighValue, + itemId: id, + inverted, + datum, + series: this + }); + labelData.push(highLabelDatum); + }; + const inverted = yLowValue > yHighValue; + const x = xPosition(datumIndex); + const yHighCoordinate = yScale.convert(yHighValue); + const yLowCoordinate = yScale.convert(yLowValue); + appendMarker("high", yHighValue, yHighCoordinate); + appendMarker("low", yLowValue, yLowCoordinate); + const spanPoint = { + high: { + point: { x, y: yHighCoordinate }, + xDatum: xValue2, + yDatum: yHighValue + }, + low: { + point: { x, y: yLowCoordinate }, + xDatum: xValue2, + yDatum: yLowValue + } + }; + if (Array.isArray(currentSpanPoints)) { + currentSpanPoints.push(spanPoint); + } else if (currentSpanPoints == null) { + spanPoints.push([spanPoint]); + } else { + currentSpanPoints.skip += 1; + spanPoints.push([spanPoint]); + } + } else if (!connectMissingData) { + if (Array.isArray(currentSpanPoints) || currentSpanPoints == null) { + spanPoints.push({ skip: 0 }); + } else { + currentSpanPoints.skip += 1; + } + } + }; + const { dataAggregationFilters } = this; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + const topIndices = dataAggregationFilter?.topIndices; + const bottomIndices = dataAggregationFilter?.bottomIndices; + let [start, end] = this.visibleRangeIndices("xValue", xAxis.range, topIndices); + start = Math.max(start - 1, 0); + end = Math.min(end + 1, topIndices?.length ?? xValues.length); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let i = start; i < end; i += 1) { + const topDatumIndex = topIndices?.[i] ?? i; + const bottomDatumIndex = bottomIndices?.[i] ?? i; + handleDatumPoint(topDatumIndex, yHighValues[topDatumIndex], yLowValues[bottomDatumIndex]); + } + const highSpans = spanPoints.flatMap((p) => { + if (!Array.isArray(p)) + return []; + const highPoints = p.map((d) => d.high); + return interpolatePoints(highPoints, interpolation); + }); + const lowSpans = spanPoints.flatMap((p) => { + if (!Array.isArray(p)) + return []; + const lowPoints = p.map((d) => d.low); + return interpolatePoints(lowPoints, interpolation); + }); + const segments = calculateSegments2( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene, + false + ); + let intersectionSegments = void 0; + if (this.properties.invertedStyle.enabled) { + const startsInverted = yHighValues[0] < yLowValues[0]; + const intersectionXValues = findRangeAreaIntersections( + highSpans, + lowSpans, + xScale.range[0], + xScale.range[1], + startsInverted + ); + intersectionSegments = calculateIntersectionSegments( + intersectionXValues, + this.chart.seriesRect, + this.ctx.scene, + startsInverted, + this.properties.invertedStyle + ); + } + const getLowOrHighMarkerStyles = (lowOrHigh) => { + const line = item[lowOrHigh]; + const { stroke, strokeWidth, strokeOpacity } = line; + const inheritedStyles = { fill, fillOpacity, stroke, strokeWidth, strokeOpacity }; + return getMarkerStyles(this, line, line.marker, inheritedStyles); + }; + const context = { + itemId: `${yLowKey}-${yHighKey}`, + labelData, + nodeData: markerData, + fillData: { itemId: "high", spans: highSpans, phantomSpans: lowSpans }, + highStrokeData: { itemId: "high", spans: highSpans }, + lowStrokeData: { itemId: "low", spans: lowSpans }, + scales: this.calculateScaling(), + visible: this.visible, + styles: { + low: getLowOrHighMarkerStyles("low"), + high: getLowOrHighMarkerStyles("high") + }, + segments, + intersectionSegments + }; + return context; + } + createLabelData({ + datumIndex, + point, + value, + itemId, + inverted, + datum, + series + }) { + const { xKey, yLowKey, yHighKey, xName, yName, yLowName, yHighName, legendItemName, label } = this.properties; + const { placement } = label; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + let actualItemId = itemId; + if (inverted) { + actualItemId = itemId === "low" ? "high" : "low"; + } + const direction = placement === "outside" && actualItemId === "high" || placement === "inside" && actualItemId === "low" ? -1 : 1; + const yDomain = this.getSeriesDomain(ChartAxisDirection10.Y); + return { + x: point.x, + y: point.y + spacing * direction, + series, + itemId, + datum, + datumIndex, + text: this.getLabelText( + value, + datum, + itemId === "high" ? yHighKey : yLowKey, + "y", + yDomain, + label, + { value, datum, itemId, xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName } + ), + textAlign: "center", + textBaseline: direction === -1 ? "bottom" : "top" + }; + } + isPathOrSelectionDirty() { + const { low, high } = this.properties.item; + return low.marker.isDirty() || high.marker.isDirty(); + } + strokewidthChange() { + const itemStrokeWidthChange = (lowOrHigh) => { + const unhighlightedStrokeWidth = this.properties.item[lowOrHigh].strokeWidth ?? 0; + const highlightedSeriesStrokeWidth = this.properties.highlight.highlightedSeries.item?.[lowOrHigh]?.strokeWidth ?? unhighlightedStrokeWidth; + const highlightedItemStrokeWidth = this.properties.highlight.highlightedItem.item?.[lowOrHigh]?.strokeWidth ?? unhighlightedStrokeWidth; + return unhighlightedStrokeWidth > highlightedItemStrokeWidth || highlightedSeriesStrokeWidth > highlightedItemStrokeWidth; + }; + return itemStrokeWidthChange("low") || itemStrokeWidthChange("high"); + } + updatePathNodes(opts) { + const { visible } = opts; + const [fillPath, lowStrokePath, highStrokePath] = opts.paths; + const segments = this.contextNodeData?.segments; + const highlightDatum = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightState(highlightDatum, false); + const highlightStyle = this.getHighlightStyle(); + const { item, fill, fillOpacity, opacity } = mergeDefaults5( + highlightStyle, + this.getStyle(false, highlightState) + ); + lowStrokePath.setProperties({ + datum: segments, + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: PointerEvents2.None, + stroke: item.low.stroke, + strokeWidth: item.low.strokeWidth, + strokeOpacity: item.low.strokeOpacity, + lineDash: item.low.lineDash, + lineDashOffset: item.low.lineDashOffset, + opacity, + visible + }); + highStrokePath.setProperties({ + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: PointerEvents2.None, + stroke: item.high.stroke, + strokeWidth: item.high.strokeWidth, + strokeOpacity: item.high.strokeOpacity, + lineDash: item.high.lineDash, + lineDashOffset: item.high.lineDashOffset, + opacity, + visible + }); + const fillBBox = this.getShapeFillBBox(); + applyShapeFillBBox2(fillPath, fill, fillBBox); + applyShapeStyle4(fillPath, { stroke: void 0, fill, fillOpacity, opacity }, fillBBox); + const fillSegments = this.contextNodeData?.intersectionSegments ?? segments; + fillPath.setProperties({ + segments: fillSegments, + pointerEvents: PointerEvents2.None, + lineJoin: "round", + fillShadow: this.properties.shadow, + opacity, + visible + }); + fillPath.datum = fillSegments; + updateClipPath(this, fillPath); + updateClipPath(this, lowStrokePath); + updateClipPath(this, highStrokePath); + } + updatePaths(opts) { + this.updateAreaPaths(opts.paths, opts.contextData); + } + updateAreaPaths(paths, contextData) { + for (const path of paths) { + path.visible = contextData.visible; + } + if (contextData.visible) { + this.updateFillPath(paths, contextData); + this.updateStrokePath(paths, contextData); + } else { + for (const path of paths) { + path.path.clear(); + path.markDirty("RangeArea"); + } + } + } + updateFillPath(paths, contextData) { + const [fill] = paths; + fill.path.clear(); + plotAreaPathFill(fill, contextData.fillData); + fill.markDirty("RangeArea"); + } + updateStrokePath(paths, contextData) { + const [, lowStroke, highStroke] = paths; + lowStroke.path.clear(); + highStroke.path.clear(); + plotLinePathStroke(lowStroke, contextData.lowStrokeData.spans); + plotLinePathStroke(highStroke, contextData.highStrokeData.spans); + lowStroke.markDirty("RangeArea"); + highStroke.markDirty("RangeArea"); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const { processedData, axes, properties } = this; + const rules = properties.styler ? this.getStylerMarkerOptions().item : properties.item; + const { low, high } = rules; + const markersEnabled = markerEnabled(processedData.input.count, axes[ChartAxisDirection10.X].scale, { + enabled: low.marker.enabled || high.marker.enabled + }); + if (properties.item.low.marker.isDirty() || properties.item.high.marker.isDirty()) { + datumSelection.clear(); + datumSelection.cleanup(); + } + let resolvedNodeData; + if (markersEnabled) { + if (low.marker.enabled && high.marker.enabled) { + resolvedNodeData = nodeData; + } else { + resolvedNodeData = []; + for (const datum of nodeData) { + if (rules[datum.itemId].marker.enabled) { + resolvedNodeData.push(datum); + } + } + } + } else { + resolvedNodeData = []; + } + return datumSelection.update(resolvedNodeData); + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((_, datum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { fill, fillOpacity, item } = stylerStyle; + const { stroke, strokeWidth, strokeOpacity } = item[datum.itemId]; + const { marker } = this.properties.item[datum.itemId]; + const params = this.makeItemStylerParams(datum.itemId); + datum.style = this.getMarkerStyle( + marker, + datum, + params, + { isHighlight, highlightState, resolveMarkerSubPath: ["item", datum.itemId, "marker"] }, + stylerStyle.item[datum.itemId].marker, + { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity + } + ); + }); + } + updateDatumNodes(opts) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum) => { + const { itemId } = datum; + const style = datum.style ?? contextNodeData.styles[itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style, node, datum.point, fillBBox); + }); + if (!isHighlight) { + this.properties.item.low.marker.markClean(); + this.properties.item.high.marker.markClean(); + } + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData, (text) => { + text.pointerEvents = PointerEvents2.None; + }); + } + updateLabelNodes(opts) { + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yName: this.properties.yName, + yLowKey: this.properties.yLowKey, + yLowName: this.properties.yLowName ?? this.properties.yLowKey, + yHighKey: this.properties.yHighKey, + yHighName: this.properties.yHighName ?? this.properties.yHighKey, + legendItemName: this.properties.legendItemName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + updateLabelNode2(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getHighlightData(nodeData, highlightedItem) { + const highlightItems = nodeData.filter((nodeDatum) => nodeDatum.datum === highlightedItem.datum); + return highlightItems.length > 0 ? highlightItems : void 0; + } + getStyle(highlighted, highlightState) { + return this.getStylerCouple(highlighted, highlightState)[0]; + } + getStylerMarkerOptions() { + return this.getStylerCouple(false)[1]; + } + getStylerCouple(highlighted, highlightState) { + const { fill, fillOpacity, item, styler } = this.properties; + let stylerResult = {}; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + const markerOpts = { + item: { low: { marker: { enabled: false } }, high: { marker: { enabled: false } } } + }; + const makeItemResult = (lowOrHigh) => { + const stylerItem = stylerResult.item?.[lowOrHigh]; + const { lineDash, lineDashOffset, marker, stroke, strokeOpacity, strokeWidth } = item[lowOrHigh]; + markerOpts.item[lowOrHigh].marker.enabled = stylerItem?.marker?.enabled ?? marker.enabled; + return { + marker: { + fill: stylerItem?.marker?.fill ?? marker.fill ?? fill, + fillOpacity: stylerItem?.marker?.fillOpacity ?? marker.fillOpacity, + shape: stylerItem?.marker?.shape ?? marker.shape, + size: stylerItem?.marker?.size ?? marker.size, + lineDash: stylerItem?.marker?.lineDash ?? marker.lineDash, + lineDashOffset: stylerItem?.marker?.lineDashOffset ?? marker.lineDashOffset, + stroke: stylerItem?.marker?.stroke ?? marker.stroke ?? stroke, + strokeOpacity: stylerItem?.marker?.strokeOpacity ?? marker.strokeOpacity, + strokeWidth: stylerItem?.marker?.strokeWidth ?? marker.strokeWidth + }, + lineDash: stylerItem?.lineDash ?? lineDash, + lineDashOffset: stylerItem?.lineDashOffset ?? lineDashOffset, + stroke: stylerItem?.stroke ?? stroke, + strokeOpacity: stylerItem?.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerItem?.strokeWidth ?? strokeWidth + }; + }; + const style = { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + opacity: 1, + topLevel: { + lineDash: this.properties.lineDash, + lineDashOffset: this.properties.lineDashOffset, + marker: this.properties.marker, + stroke: this.properties.stroke, + strokeOpacity: this.properties.strokeOpacity, + strokeWidth: this.properties.strokeWidth + }, + item: { + low: makeItemResult("low"), + high: makeItemResult("high") + } + }; + return [style, markerOpts]; + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { fill, fillOpacity, item, xKey, yHighKey, yLowKey } = this.properties; + const highlightState = toHighlightString2(highlightStateEnum ?? HighlightState2.None); + const makeItemParam = (lowOrHigh) => { + const { lineDash, lineDashOffset, marker, stroke, strokeOpacity, strokeWidth } = item[lowOrHigh]; + return { + marker: { + fill: marker.fill ?? fill, + fillOpacity: marker.fillOpacity, + size: marker.size, + shape: marker.shape, + stroke: marker.stroke ?? stroke, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }, + lineDash, + lineDashOffset, + stroke, + strokeOpacity, + strokeWidth + }; + }; + return { + item: { + low: makeItemParam("low"), + high: makeItemParam("high") + }, + fill, + fillOpacity, + highlightState, + highlighted, + seriesId, + xKey, + yLowKey, + yHighKey + }; + } + makeItemStylerParams(itemId) { + const { xKey, yLowKey, yHighKey } = this.properties; + return { xKey, yLowKey, yHighKey, itemId }; + } + getTooltipContent(datumIndex, removeThisDatum) { + const itemId = removeThisDatum?.itemId ?? "high"; + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { xName, yName, yLowKey, yLowName, xKey, yHighKey, yHighName, tooltip, legendItemName } = properties; + const xAxis = axes[ChartAxisDirection10.X]; + const yAxis = axes[ChartAxisDirection10.Y]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yHighValue = dataModel.resolveColumnById(this, `yHighValue`, processedData)[datumIndex]; + const yLowValue = dataModel.resolveColumnById(this, `yLowValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(itemId); + const format = this.getMarkerStyle( + this.properties.item[itemId].marker, + { datumIndex, datum }, + params, + { isHighlight: false, resolveMarkerSubPath: ["item", itemId, "marker"] }, + stylerStyle.item[itemId].marker + ); + const value = `${this.getAxisValueText(yAxis, "tooltip", yLowValue, datum, yLowKey, legendItemName)} - ${this.getAxisValueText(yAxis, "tooltip", yHighValue, datum, yHighKey, legendItemName)}`; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [{ label: yName, fallbackLabel: `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`, value }] + }, + { + seriesId, + datum, + title: yName, + itemId, + xName, + yName, + yLowKey, + yLowName, + xKey, + yHighKey, + yHighName, + legendItemName, + ...format + } + ); + } + legendItemSymbol() { + const { fill, topLevel } = this.getStyle(false); + const { stroke, strokeWidth, strokeOpacity, lineDash, marker } = topLevel; + const markerStyle = { + shape: marker.shape, + fill: marker.fill ?? fill, + stroke: marker.stroke ?? stroke, + fillOpacity: marker.fillOpacity, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }; + return { + marker: markerStyle, + line: { + stroke, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { yLowKey, yHighKey, yName, yLowName, yHighName, legendItemName, showInLegend } = this.properties; + const legendItemText = legendItemName ?? yName ?? `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`; + const itemId = `${yLowKey}-${yHighKey}`; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible, + label: { text: `${legendItemText}` }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + isLabelEnabled() { + return this.properties.label.enabled; + } + onDataChange() { + } + nodeFactory() { + return new Marker(); + } + animateEmptyUpdateReady(animationData) { + const { datumSelection, labelSelection, contextData, paths } = animationData; + const { animationManager } = this.ctx; + this.updateAreaPaths(paths, contextData); + pathSwipeInAnimation(this, animationManager, ...paths); + resetMotion([datumSelection], resetMarkerPositionFn); + markerSwipeScaleInAnimation(this, animationManager, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + } + animateReadyResize(animationData) { + const { contextData, paths } = animationData; + this.updateAreaPaths(paths, contextData); + super.animateReadyResize(animationData); + } + animateWaitingUpdateReady(animationData) { + const { animationManager } = this.ctx; + const { datumSelection, labelSelection, contextData, paths, previousContextData } = animationData; + const [fill, lowStroke, highStroke] = paths; + if (fill == null && lowStroke == null && highStroke == null) + return; + this.resetDatumAnimation(animationData); + this.resetLabelAnimation(animationData); + const update = () => { + this.resetPathAnimation(animationData); + this.updateAreaPaths(paths, contextData); + }; + const skip = () => { + animationManager.skipCurrentBatch(); + update(); + }; + if (contextData == null || previousContextData == null) { + update(); + markerFadeInAnimation(this, animationManager, "added", datumSelection); + pathFadeInAnimation(this, "fill_path_properties", animationManager, "add", fill); + pathFadeInAnimation(this, "low_stroke_path_properties", animationManager, "add", lowStroke); + pathFadeInAnimation(this, "high_stroke_path_properties", animationManager, "add", highStroke); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + return; + } + const fns = prepareRangeAreaPathAnimation( + contextData, + previousContextData, + this.processedData?.reduced?.diff?.[this.id] + ); + if (fns === void 0) { + skip(); + return; + } else if (fns.status === "no-op") { + return; + } + fromToMotion(this.id, "fill_path_properties", animationManager, [fill], fns.fill.pathProperties); + fromToMotion(this.id, "low_stroke_path_properties", animationManager, [lowStroke], fns.stroke.pathProperties); + fromToMotion(this.id, "high_stroke_path_properties", animationManager, [highStroke], fns.stroke.pathProperties); + if (fns.status === "added") { + this.updateAreaPaths(paths, contextData); + } else if (fns.status === "removed") { + this.updateAreaPaths(paths, previousContextData); + } else { + pathMotion(this.id, "fill_path_update", animationManager, [fill], fns.fill.path); + pathMotion(this.id, "low_stroke_path_update", animationManager, [lowStroke], fns.stroke.path); + pathMotion(this.id, "high_stroke_path_update", animationManager, [highStroke], fns.stroke.path); + } + if (fns.hasMotion) { + markerFadeInAnimation(this, animationManager, void 0, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + } + this.ctx.animationManager.animate({ + id: this.id, + groupId: "reset_after_animation", + phase: "trailing", + from: {}, + to: {}, + onComplete: () => this.updateAreaPaths(paths, contextData) + }); + } + getFormattedMarkerStyle(datum) { + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(datum.itemId); + return this.getMarkerStyle( + this.properties.item[datum.itemId].marker, + datum, + params, + { isHighlight: true, resolveMarkerSubPath: ["item", datum.itemId, "marker"] }, + void 0, + stylerStyle + ); + } + getMarkerStyle(marker, datum, params, opts, defaultOverrideStyle, inheritedStyle) { + true; + marker.itemStyler = this.properties.marker.itemStyler; + return super.getMarkerStyle(marker, datum, params, opts, defaultOverrideStyle, inheritedStyle); + } + computeFocusBounds(opts) { + const hiBox = computeMarkerFocusBounds(this, opts); + const loBox = computeMarkerFocusBounds(this, { ...opts, datumIndex: opts.datumIndex + 1 }); + if (hiBox && loBox) { + return BBox5.merge([hiBox, loBox]); + } + return void 0; + } + isDatumEnabled(nodeData, datumIndex) { + return datumIndex % 2 === 0 && super.isDatumEnabled(nodeData, datumIndex); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RangeAreaSeries.className = "RangeAreaSeries"; +RangeAreaSeries.type = "range-area"; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport49 } from "ag-charts-community"; +import { + boolean as boolean5, + constant as constant6, + fillOptionsDef, + number as number4, + required as required6, + shapeSegmentation as shapeSegmentation2, + string as string6, + undocumented as undocumented3 +} from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs5, rangeAreaSeriesThemeableOptionsDef } = _ModuleSupport49; +var rangeAreaSeriesOptionsDef = { + ...commonSeriesOptionsDefs5, + ...rangeAreaSeriesThemeableOptionsDef, + type: required6(constant6("range-area")), + xKey: required6(string6), + yLowKey: required6(string6), + yHighKey: required6(string6), + xName: string6, + yName: string6, + yLowName: string6, + yHighName: string6, + legendItemName: string6, + segmentation: shapeSegmentation2, + invertedStyle: { + enabled: boolean5, + ...fillOptionsDef + } +}; +rangeAreaSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented3(boolean5); +rangeAreaSeriesOptionsDef.focusPriority = undocumented3(number4); + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaThemes.ts +import { _ModuleSupport as _ModuleSupport50 } from "ag-charts-community"; +var RANGE_AREA_ITEM = { + lineDash: { + $path: "/series/$index/lineDash" + }, + lineDashOffset: { + $path: "/series/$index/lineDashOffset" + }, + stroke: { + $path: ["/series/$index/stroke", { $palette: "stroke" }] + }, + strokeOpacity: { + $path: "/series/$index/strokeOpacity" + }, + strokeWidth: { + $path: ["/series/$index/strokeWidth", 1] + }, + marker: { + enabled: { + $path: "/series/$index/marker/enabled" + }, + fill: { + $isUserOption: [ + "/series/$index/marker/fill", + { + $if: [ + { + $or: [ + { $isGradient: { $path: "/series/$index/marker/fill" } }, + { $isImage: { $path: "/series/$index/marker/fill" } }, + { $isPattern: { $path: "/series/$index/marker/fill" } } + ] + }, + { + $merge: [ + { $path: "/series/$index/marker/fill" }, + { + $applySwitch: [ + { $path: "type" }, + void 0, + // default case shouldn't be hit because of $if + ["gradient", _ModuleSupport50.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", _ModuleSupport50.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport50.FILL_PATTERN_DEFAULTS] + ] + } + ] + }, + { + $isUserOption: [ + "/series/$index/marker/fill", + { $path: "/series/$index/marker/fill" }, + { $palette: "fill" } + ] + } + ] + }, + { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport50.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", _ModuleSupport50.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport50.FILL_PATTERN_DEFAULTS] + ] + } + ] + }, + fillOpacity: { + $path: "/series/$index/marker/fillOpacity" + }, + lineDash: { + $path: "/series/$index/marker/lineDash" + }, + lineDashOffset: { + $path: "/series/$index/marker/lineDashOffset" + }, + shape: { + $path: "/series/$index/marker/shape" + }, + size: { + $path: ["/series/$index/marker/size", 6] + }, + stroke: { + $path: ["/series/$index/marker/stroke", { $palette: "stroke" }] + }, + strokeOpacity: { + $path: "/series/$index/marker/strokeOpacity" + }, + strokeWidth: { + $path: ["/series/$index/marker/strokeWidth", 2] + } + } +}; +var RANGE_AREA_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport50.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", _ModuleSupport50.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: 0.7, + stroke: { $palette: "stroke" }, + strokeWidth: 1, + marker: { + enabled: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport50.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", _ModuleSupport50.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport50.FILL_PATTERN_DEFAULTS] + ] + }, + shape: "circle", + stroke: { $palette: "stroke" }, + size: 6, + strokeWidth: 2 + }, + nodeClickRange: "nearest", + item: { + low: RANGE_AREA_ITEM, + high: RANGE_AREA_ITEM + }, + label: { + ..._ModuleSupport50.LABEL_BOXING_DEFAULTS, + enabled: false, + placement: "outside", + padding: { $isUserOption: ["./spacing", 0, 10] }, + // compatibility with old `padding` property (now named `spacing`). + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + interpolation: { + type: "linear" + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: _ModuleSupport50.multiSeriesHighlightStyle(), + segmentation: _ModuleSupport50.SEGMENTATION_DEFAULTS, + invertedStyle: { + enabled: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + // @todo(AG-14792) should be { $path: '../fill' } to inherit from series.fill + ["gradient", _ModuleSupport50.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", _ModuleSupport50.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport50.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: { $path: "../fillOpacity" } + } + }, + axes: { + [_ModuleSupport50.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { enabled: true } + } + } +}; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE6, CARTESIAN_POSITION: CARTESIAN_POSITION4 } +} = _ModuleSupport51; +var RangeAreaModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "range-area", + moduleFactory: (ctx) => new RangeAreaSeries(ctx), + predictAxis: _ModuleSupport51.predictCartesianTimeAxis, + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE6.NUMBER, position: CARTESIAN_POSITION4.LEFT }, + { type: CARTESIAN_AXIS_TYPE6.CATEGORY, position: CARTESIAN_POSITION4.BOTTOM } + ], + themeTemplate: RANGE_AREA_SERIES_THEME +}; +var RangeAreaSeriesModule = { + type: "series", + name: "range-area", + chartType: "cartesian", + enterprise: true, + options: rangeAreaSeriesOptionsDef, + create: (ctx) => new RangeAreaSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarModule.ts +import { _ModuleSupport as _ModuleSupport57 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeries.ts +import { + _ModuleSupport as _ModuleSupport54 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarAggregation.ts +import { _ModuleSupport as _ModuleSupport52 } from "ag-charts-community"; +var { aggregationDomain: aggregationDomain3, aggregationRangeFittingPoints: aggregationRangeFittingPoints3, compactAggregationIndices: compactAggregationIndices3, createAggregationIndices: createAggregationIndices3 } = _ModuleSupport52; +var AGGREGATION_THRESHOLD3 = 1e3; +function aggregateRangeBarData(scale, xValues, highValues, lowValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD3) + return; + const [d0, d1] = aggregationDomain3(scale, domain); + let maxRange = aggregationRangeFittingPoints3(xValues, d0, d1, { smallestKeyInterval }); + let { indexData, valueData } = createAggregationIndices3(xValues, highValues, lowValues, d0, d1, maxRange); + const filters = [{ maxRange, indexData }]; + while (maxRange > 64) { + ({ indexData, valueData, maxRange } = compactAggregationIndices3(indexData, valueData, maxRange)); + filters.push({ maxRange, indexData }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarProperties.ts +import { _ModuleSupport as _ModuleSupport53 } from "ag-charts-community"; +var { AbstractBarSeriesProperties: AbstractBarSeriesProperties3, makeSeriesTooltip: makeSeriesTooltip6, Property: Property18, DropShadow: DropShadow2, Label: Label2 } = _ModuleSupport53; +var RangeBarSeriesLabel = class extends Label2 { + constructor() { + super(...arguments); + this.placement = "inside"; + this.spacing = 0; + } +}; +__decorateClass([ + Property18 +], RangeBarSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property18 +], RangeBarSeriesLabel.prototype, "spacing", 2); +var RangeBarProperties = class extends AbstractBarSeriesProperties3 { + constructor() { + super(...arguments); + this.fill = "#99CCFF"; + this.fillOpacity = 1; + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.shadow = new DropShadow2().set({ enabled: false }); + this.label = new RangeBarSeriesLabel(); + this.tooltip = makeSeriesTooltip6(); + } +}; +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "xKey", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "yLowKey", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "yHighKey", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "xName", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "yName", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "yLowName", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "yHighName", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "styler", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "shadow", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "label", 2); +__decorateClass([ + Property18 +], RangeBarProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode4, + valueProperty: valueProperty5, + keyProperty: keyProperty4, + ChartAxisDirection: ChartAxisDirection11, + checkCrisp, + updateLabelNode: updateLabelNode3, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL3, + LARGEST_KEY_INTERVAL, + diff: diff4, + prepareBarAnimationFunctions, + midpointStartingBarPosition, + resetBarSelectionsFn, + fixNumericExtent: fixNumericExtent4, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation2, + resetLabelFn: resetLabelFn2, + animationValidation: animationValidation4, + computeBarFocusBounds: computeBarFocusBounds4, + visibleRangeIndices: visibleRangeIndices2, + createDatumId: createDatumId4, + ContinuousScale: ContinuousScale3, + Rect: Rect2, + PointerEvents: PointerEvents3, + motion: motion2, + applyShapeStyle: applyShapeStyle5, + findMinMax: findMinMax3, + areScalingEqual: areScalingEqual2, + processedDataIsAnimatable: processedDataIsAnimatable3, + AGGREGATION_SPAN: AGGREGATION_SPAN2, + AGGREGATION_INDEX_X_MAX: AGGREGATION_INDEX_X_MAX2, + AGGREGATION_INDEX_X_MIN: AGGREGATION_INDEX_X_MIN2, + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX3, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN3, + mergeDefaults: mergeDefaults6, + simpleMemorize2: simpleMemorize23, + getItemStyles: getItemStyles2, + calculateSegments: calculateSegments3, + toHighlightString: toHighlightString3, + HighlightState: HighlightState3 +} = _ModuleSupport54; +var memoizedAggregateRangeBarData = simpleMemorize23(aggregateRangeBarData); +var RangeBarSeriesNodeEvent = class extends _ModuleSupport54.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yLowKey = series.properties.yLowKey; + this.yHighKey = series.properties.yHighKey; + } +}; +var RangeBarSeries = class extends _ModuleSupport54.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode4.AXIS_ALIGNED, SeriesNodePickMode4.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["yLowKey", "yHighKey"] + }, + propertyNames: { + x: ["xName"], + y: ["yLowName", "yHighName", "yName"] + }, + categoryKey: "xValue", + datumSelectionGarbageCollection: false, + animationResetFns: { + datum: resetBarSelectionsFn, + label: resetLabelFn2 + } + }); + this.properties = new RangeBarProperties(); + this.dataAggregationFilters = void 0; + this.NodeEvent = RangeBarSeriesNodeEvent; + } + async processData(dataController) { + const { xKey, yLowKey, yHighKey } = this.properties; + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + if (this.processedData) { + extraProps.push(diff4(this.id, this.processedData)); + } + extraProps.push(animationValidation4()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty4(xKey, xScaleType, { id: "xValue" }), + valueProperty5(yLowKey, yScaleType, { id: `yLowValue`, invalidValue: null, ...visibleProps }), + valueProperty5(yHighKey, yScaleType, { id: `yHighValue`, invalidValue: null, ...visibleProps }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL3, LARGEST_KEY_INTERVAL] : [], + ...extraProps + ], + groupByKeys: false + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable3(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection11.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateRangeBarData( + xAxis.scale.type, + xValues, + yHighValues, + yLowValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys] + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } else { + const yExtent = this.domainForClippedRange(direction, ["yHighValue", "yLowValue"], "xValue"); + const fixedYExtent = findMinMax3(yExtent); + return fixNumericExtent4(fixedYExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection11.Y, ["yHighValue", "yLowValue"], "xValue", visibleRange); + } + createNodeData() { + const { data, dataModel, groupScale, processedData, visible } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(data && xAxis && yAxis && dataModel && processedData?.dataSources && this.chart?.seriesRect)) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection11.X; + const { xKey, yLowKey, yHighKey, strokeWidth } = this.properties; + const itemId = `${yLowKey}-${yHighKey}`; + const segments = calculateSegments3( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + const context = { + itemId, + nodeData: [], + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStyles2(this.getItemStyle.bind(this)), + segments + }; + if (!visible) + return context; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const { barWidth: effectiveBarWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale3.is(xScale) ? effectiveBarWidth * -0.5 : 0; + const groupOffset = groupScale.convert(String(groupIndex)); + const defaultCrisp = checkCrisp( + xAxis?.scale, + xAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + const xPosition = (datumIndex) => Math.round(xScale.convert(xValues[datumIndex])) + groupOffset + barOffset; + const handleDatum = (datumIndex, groupedDataIndex, x, width, yLow, yHigh, crisp) => { + const datum = rawData[datumIndex]; + const xDatum = xValues[datumIndex]; + if (xDatum == null) + return; + const rawLowValue = yLowValues[datumIndex]; + const rawHighValue = yHighValues[datumIndex]; + if (!Number.isFinite(rawLowValue?.valueOf()) || !Number.isFinite(rawHighValue?.valueOf())) + return; + const [yLowValue, yHighValue] = rawLowValue < rawHighValue ? [rawLowValue, rawHighValue] : [rawHighValue, rawLowValue]; + const y = Math.round(yScale.convert(yHigh)); + const bottomY = Math.round(yScale.convert(yLow)); + const height = Math.max(strokeWidth, Math.abs(bottomY - y)); + const rect = { + x: barAlongX ? Math.min(y, bottomY) : x, + y: barAlongX ? x : Math.min(y, bottomY), + width: barAlongX ? height : width, + height: barAlongX ? width : height + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const labelData = this.createLabelData({ + datumIndex, + rect, + barAlongX, + yLowValue, + yHighValue, + datum, + series: this + }); + const nodeDatum = { + index: groupedDataIndex, + series: this, + itemId, + datum, + datumIndex, + xValue: xDatum, + yLowValue: rawLowValue, + yHighValue: rawHighValue, + yLowKey, + yHighKey, + xKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + labels: labelData + }; + context.nodeData.push(nodeDatum); + context.labelData.push(...labelData); + }; + const { dataAggregationFilters } = this; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + if (dataAggregationFilter != null) { + const { maxRange, indexData } = dataAggregationFilter; + const [start, end] = visibleRangeIndices2(1, maxRange, xAxis.range, (index) => { + const aggIndex = index * AGGREGATION_SPAN2; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN2]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX2]; + if (xMinIndex === -1) + return; + const midDatumIndex = Math.trunc((xMinIndex + xMaxIndex) / 2); + return [xPosition(midDatumIndex), xPosition(xMaxIndex) + effectiveBarWidth]; + }); + for (let i = start; i < end; i += 1) { + const aggIndex = i * AGGREGATION_SPAN2; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN2]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX2]; + const yMinIndex = indexData[aggIndex + AGGREGATION_INDEX_Y_MIN3]; + const yMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_Y_MAX3]; + if (xMinIndex === -1) + continue; + const midDatumIndex = Math.trunc((xMinIndex + xMaxIndex) / 2); + const xValue2 = xValues[midDatumIndex]; + if (xValue2 == null) + continue; + const x = xPosition(midDatumIndex); + const width = Math.abs(xPosition(xMinIndex) - xPosition(xMaxIndex)) + effectiveBarWidth; + const yLow = yLowValues[yMinIndex]; + const yHigh = yHighValues[yMaxIndex]; + handleDatum(midDatumIndex, 0, x, width, yLow, yHigh, false); + } + } else if (processedData.type === "ungrouped") { + const invalidData = processedData.invalidData?.get(this.id); + let [start, end] = this.visibleRangeIndices("xValue", xAxis.range); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let datumIndex = start; datumIndex < end; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const x = xPosition(datumIndex); + const width = effectiveBarWidth; + const yLow = yLowValues[datumIndex]; + const yHigh = yHighValues[datumIndex]; + handleDatum(datumIndex, 0, x, width, yLow, yHigh, defaultCrisp); + } + } else { + for (const { datumIndex, groupIndex: groupDataIndex } of dataModel.forEachGroupDatum(this, processedData)) { + const x = xPosition(datumIndex); + const width = effectiveBarWidth; + const yLow = yLowValues[datumIndex]; + const yHigh = yHighValues[datumIndex]; + handleDatum(datumIndex, groupDataIndex, x, width, yLow, yHigh, defaultCrisp); + } + } + return context; + } + createLabelData({ + datumIndex, + rect, + barAlongX, + yLowValue, + yHighValue, + datum, + series + }) { + const { xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName, label } = this.properties; + const labelParams = { datum, xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName }; + const { placement } = label; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + const paddingDirection = placement === "outside" ? 1 : -1; + const labelPadding = spacing * paddingDirection; + const yDomain = this.getSeriesDomain(ChartAxisDirection11.Y); + const yLowLabel = { + datumIndex, + x: rect.x + (barAlongX ? -labelPadding : rect.width / 2), + y: rect.y + (barAlongX ? rect.height / 2 : rect.height + labelPadding), + textAlign: barAlongX ? "left" : "center", + textBaseline: barAlongX ? "middle" : "bottom", + text: this.getLabelText( + yLowValue, + datum, + yLowKey, + "y", + yDomain, + label, + { itemId: "low", value: yLowValue, ...labelParams } + ), + itemId: "low", + datum, + series + }; + const yHighLabel = { + datumIndex, + x: rect.x + (barAlongX ? rect.width + labelPadding : rect.width / 2), + y: rect.y + (barAlongX ? rect.height / 2 : -labelPadding), + textAlign: barAlongX ? "right" : "center", + textBaseline: barAlongX ? "middle" : "top", + text: this.getLabelText( + yHighValue, + datum, + yHighKey, + "y", + yDomain, + label, + { itemId: "high", value: yHighValue, ...labelParams } + ), + itemId: "high", + datum, + series + }; + if (placement === "outside") { + yLowLabel.textAlign = barAlongX ? "right" : "center"; + yLowLabel.textBaseline = barAlongX ? "middle" : "top"; + yHighLabel.textAlign = barAlongX ? "left" : "center"; + yHighLabel.textBaseline = barAlongX ? "middle" : "bottom"; + } + return [yLowLabel, yHighLabel]; + } + nodeFactory() { + return new Rect2(); + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke, + strokeOpacity, + strokeWidth, + styler + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth + }; + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke, + strokeOpacity, + strokeWidth, + xKey, + yLowKey, + yHighKey + } = this.properties; + const highlightState = toHighlightString3(highlightStateEnum ?? HighlightState3.None); + return { + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + seriesId, + stroke, + strokeOpacity, + strokeWidth, + xKey, + yLowKey, + yHighKey + }; + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data, void 0, (datum) => this.getDatumId(datum)); + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style = mergeDefaults6(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId4(this.getDatumId({ xValue: xValue2 }), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults6(overrides, style); + } + } + return style; + } + makeItemStylerParams(datumIndex, isHighlight, style) { + const { id: seriesId, properties, processedData } = this; + const { xKey, yHighKey, yLowKey } = properties; + const datum = processedData.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + yHighKey, + yLowKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles(opts) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + opts.datumSelection.each((node, datum) => { + if (!opts.datumSelection.isGarbage(node)) { + const highlightState = this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex); + datum.style = this.getItemStyle(datum.datumIndex, opts.isHighlight, highlightState); + } + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection11.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle5(rect, style, fillBBox); + rect.cornerRadius = style.cornerRadius ?? 0; + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + }); + } + updateLabelSelection(opts) { + const labelData = this.properties.label.enabled ? opts.labelData : []; + return opts.labelSelection.update(labelData, (text) => { + text.pointerEvents = PointerEvents3.None; + }); + } + updateLabelNodes(opts) { + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yName: this.properties.yName, + yLowKey: this.properties.yLowKey, + yLowName: this.properties.yLowName ?? this.properties.yLowKey, + yHighKey: this.properties.yHighKey, + yHighName: this.properties.yHighName ?? this.properties.yHighKey, + legendItemName: this.properties.legendItemName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum?.datumIndex).opacity ?? 1; + updateLabelNode3(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yName, yLowKey, yHighKey, yLowName, yHighName, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yHighValue = dataModel.resolveColumnById(this, `yHighValue`, processedData)[datumIndex]; + const yLowValue = dataModel.resolveColumnById(this, `yLowValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + const value = `${this.getAxisValueText(yAxis, "tooltip", yLowValue, datum, yLowKey, legendItemName)} - ${this.getAxisValueText(yAxis, "tooltip", yHighValue, datum, yHighKey, legendItemName)}`; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [{ label: yName, fallbackLabel: `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`, value }] + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yName, + yLowKey, + yHighKey, + yLowName, + yHighName, + legendItemName, + ...format + } + ); + } + legendItemSymbol() { + const { fill, stroke, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + HighlightState3.None + ); + return { + marker: { + fill, + stroke, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { yName, yLowName, yHighName, yLowKey, yHighKey, legendItemName, showInLegend } = this.properties; + const legendItemText = legendItemName ?? yName ?? `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`; + const itemId = `${yLowKey}-${yHighKey}`; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible, + label: { text: `${legendItemText}` }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + animateEmptyUpdateReady({ datumSelection, labelSelection }) { + const fns = prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(), "normal"), "unknown"); + motion2.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation2(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const { datumSelection: datumSelections, labelSelection, contextData, previousContextData } = data; + const dataDiff = _ModuleSupport54.calculateDataDiff( + this.id, + datumSelections, + this.getDatumId.bind(this), + contextData, + previousContextData, + this.processedData, + this.processedDataUpdated + ); + this.ctx.animationManager.stopByAnimationGroupId(this.id); + const mode = previousContextData == null ? "fade" : "normal"; + const fns = prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(), mode), "added"); + motion2.fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [datumSelections], + fns, + (_, datum) => this.getDatumId(datum), + dataDiff + ); + if (dataDiff?.changed || !areScalingEqual2(contextData.groupScale, previousContextData?.groupScale)) { + seriesLabelFadeInAnimation2(this, "labels", this.ctx.animationManager, labelSelection); + } + } + getDatumId(datum) { + return `${datum.xValue}`; + } + isLabelEnabled() { + return this.properties.label.enabled; + } + onDataChange() { + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds4(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RangeBarSeries.className = "RangeBarSeries"; +RangeBarSeries.type = "range-bar"; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport55 } from "ag-charts-community"; +import { + boolean as boolean6, + constant as constant7, + number as number5, + required as required7, + shapeSegmentation as shapeSegmentation3, + string as string7, + undocumented as undocumented4 +} from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs6, rangeBarSeriesThemeableOptionsDef } = _ModuleSupport55; +var rangeBarSeriesOptionsDef = { + ...commonSeriesOptionsDefs6, + ...rangeBarSeriesThemeableOptionsDef, + type: required7(constant7("range-bar")), + xKey: required7(string7), + yLowKey: required7(string7), + yHighKey: required7(string7), + xName: string7, + yName: string7, + yLowName: string7, + yHighName: string7, + legendItemName: string7, + segmentation: shapeSegmentation3 +}; +rangeBarSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented4(boolean6); +rangeBarSeriesOptionsDef.focusPriority = undocumented4(number5); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarThemes.ts +import { _ModuleSupport as _ModuleSupport56 } from "ag-charts-community"; +var RANGE_BAR_SERIES_THEME = { + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport56.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", _ModuleSupport56.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport56.FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + ..._ModuleSupport56.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + placement: "inside", + padding: { $isUserOption: ["./spacing", 0, 6] } + // compatibility with old `padding` property (now named `spacing`). + }, + highlight: _ModuleSupport56.multiSeriesHighlightStyle(), + segmentation: _ModuleSupport56.SEGMENTATION_DEFAULTS + }, + axes: { + [_ModuleSupport56.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { enabled: true } + } + } +}; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarModule.ts +var RangeBarModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "range-bar", + moduleFactory: (ctx) => new RangeBarSeries(ctx), + predictAxis: _ModuleSupport57.predictCartesianTimeAxis, + defaultAxes: _ModuleSupport57.DIRECTION_SWAP_AXES, + themeTemplate: RANGE_BAR_SERIES_THEME, + groupable: true +}; +var RangeBarSeriesModule = { + type: "series", + name: "range-bar", + chartType: "cartesian", + enterprise: true, + options: rangeBarSeriesOptionsDef, + create: (ctx) => new RangeBarSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallModule.ts +import { _ModuleSupport as _ModuleSupport62 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeries.ts +import { _ModuleSupport as _ModuleSupport59 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport58 } from "ag-charts-community"; +var { AbstractBarSeriesProperties: AbstractBarSeriesProperties4, BaseProperties: BaseProperties6, PropertiesArray, makeSeriesTooltip: makeSeriesTooltip7, Property: Property19, DropShadow: DropShadow3, Label: Label3 } = _ModuleSupport58; +var WaterfallSeriesTotal = class extends BaseProperties6 { +}; +__decorateClass([ + Property19 +], WaterfallSeriesTotal.prototype, "totalType", 2); +__decorateClass([ + Property19 +], WaterfallSeriesTotal.prototype, "index", 2); +__decorateClass([ + Property19 +], WaterfallSeriesTotal.prototype, "axisLabel", 2); +var WaterfallSeriesItemTooltip = class extends BaseProperties6 { +}; +__decorateClass([ + Property19 +], WaterfallSeriesItemTooltip.prototype, "renderer", 2); +var WaterfallSeriesLabel = class extends Label3 { + constructor() { + super(...arguments); + this.placement = "outside-end"; + this.spacing = 0; + } +}; +__decorateClass([ + Property19 +], WaterfallSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property19 +], WaterfallSeriesLabel.prototype, "spacing", 2); +var WaterfallSeriesItem = class extends BaseProperties6 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.stroke = "#c16068"; + this.fillOpacity = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.cornerRadius = 0; + this.shadow = new DropShadow3().set({ enabled: false }); + this.label = new WaterfallSeriesLabel(); + this.tooltip = new WaterfallSeriesItemTooltip(); + } +}; +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "name", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "fill", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "fillOpacity", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "lineDashOffset", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "cornerRadius", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "itemStyler", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "shadow", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "label", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItem.prototype, "tooltip", 2); +var WaterfallSeriesConnectorLine = class extends BaseProperties6 { + constructor() { + super(...arguments); + this.enabled = true; + this.stroke = "black"; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.strokeWidth = 2; + } +}; +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "enabled", 2); +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "stroke", 2); +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "strokeOpacity", 2); +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "lineDash", 2); +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "lineDashOffset", 2); +__decorateClass([ + Property19 +], WaterfallSeriesConnectorLine.prototype, "strokeWidth", 2); +var WaterfallSeriesItems = class extends BaseProperties6 { + constructor() { + super(...arguments); + this.positive = new WaterfallSeriesItem(); + this.negative = new WaterfallSeriesItem(); + this.total = new WaterfallSeriesItem(); + } +}; +__decorateClass([ + Property19 +], WaterfallSeriesItems.prototype, "positive", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItems.prototype, "negative", 2); +__decorateClass([ + Property19 +], WaterfallSeriesItems.prototype, "total", 2); +var WaterfallSeriesProperties = class extends AbstractBarSeriesProperties4 { + constructor() { + super(...arguments); + this.item = new WaterfallSeriesItems(); + this.totals = new PropertiesArray(WaterfallSeriesTotal); + this.line = new WaterfallSeriesConnectorLine(); + this.tooltip = makeSeriesTooltip7(); + } + getStyle(itemId) { + const { fillOpacity, strokeWidth, strokeOpacity, fill, stroke, lineDash, lineDashOffset, cornerRadius } = this.item[itemId === "subtotal" ? "total" : itemId]; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "totals", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "line", 2); +__decorateClass([ + Property19 +], WaterfallSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeries.ts +var { + adjustLabelPlacement, + SeriesNodePickMode: SeriesNodePickMode5, + fixNumericExtent: fixNumericExtent5, + valueProperty: valueProperty6, + keyProperty: keyProperty5, + accumulativeValueProperty, + trailingAccumulatedValueProperty, + ChartAxisDirection: ChartAxisDirection12, + createDatumId: createDatumId5, + checkCrisp: checkCrisp2, + updateLabelNode: updateLabelNode4, + prepareBarAnimationFunctions: prepareBarAnimationFunctions2, + collapsedStartingBarPosition, + resetBarSelectionsFn: resetBarSelectionsFn2, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation3, + resetLabelFn: resetLabelFn3, + animationValidation: animationValidation5, + DEFAULT_CARTESIAN_DIRECTION_KEYS: DEFAULT_CARTESIAN_DIRECTION_KEYS2, + DEFAULT_CARTESIAN_DIRECTION_NAMES: DEFAULT_CARTESIAN_DIRECTION_NAMES2, + computeBarFocusBounds: computeBarFocusBounds5, + isContinuous, + Rect: Rect3, + motion: motion3, + applyShapeStyle: applyShapeStyle6, + mergeDefaults: mergeDefaults7, + getItemStylesPerItemId: getItemStylesPerItemId2, + DataSet +} = _ModuleSupport59; +var WaterfallSeries = class extends _ModuleSupport59.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: DEFAULT_CARTESIAN_DIRECTION_KEYS2, + propertyNames: DEFAULT_CARTESIAN_DIRECTION_NAMES2, + categoryKey: void 0, + pickModes: [SeriesNodePickMode5.NEAREST_NODE, SeriesNodePickMode5.EXACT_SHAPE_MATCH], + pathsPerSeries: ["connector"], + pathsZIndexSubOrderOffset: [-1, -1], + animationResetFns: { + datum: resetBarSelectionsFn2, + label: resetLabelFn3 + } + }); + this.properties = new WaterfallSeriesProperties(); + this.seriesItemTypes = /* @__PURE__ */ new Set(["positive", "negative", "total"]); + } + async processData(dataController) { + const { xKey, yKey, totals } = this.properties; + const { data } = this; + if (!this.visible) + return; + const positiveNumber3 = (v) => isContinuous(v) && Number(v) >= 0; + const negativeNumber = (v) => isContinuous(v) && Number(v) >= 0; + const totalTypeValue = (v) => v === "total" || v === "subtotal"; + const propertyDefinition = { missingValue: void 0, invalidValue: void 0 }; + const dataWithTotals = []; + const totalsMap = totals.reduce((result, total) => { + const totalsAtIndex = result.get(total.index); + if (totalsAtIndex) { + totalsAtIndex.push(total); + } else { + result.set(total.index, [total]); + } + return result; + }, /* @__PURE__ */ new Map()); + for (const [i, datum] of data?.data.entries() ?? []) { + dataWithTotals.push(datum); + const totalsAtIndex = totalsMap.get(i); + if (totalsAtIndex) { + for (const total of totalsAtIndex) { + dataWithTotals.push({ ...total.toJson(), [xKey]: total.axisLabel }); + } + } + } + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + extraProps.push(animationValidation5()); + } + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const { processedData } = await this.requestDataModel( + dataController, + DataSet.wrap(dataWithTotals), + { + props: [ + keyProperty5(xKey, xScaleType, { id: `xValue` }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrent` + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + missingValue: 0, + id: `yCurrentTotal` + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrentPositive`, + validation: positiveNumber3 + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrentNegative`, + validation: negativeNumber + }), + trailingAccumulatedValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yPrevious` + }), + valueProperty6(yKey, yScaleType, { id: `yRaw` }), + // Raw value pass-through. + valueProperty6("totalType", "category", { + id: `totalTypeValue`, + missingValue: void 0, + validation: totalTypeValue + }), + ...isContinuousX ? [_ModuleSupport59.SMALLEST_KEY_INTERVAL, _ModuleSupport59.LARGEST_KEY_INTERVAL] : [], + ...extraProps + ] + } + ); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.updateSeriesItemTypes(); + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys], + values + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + return keys; + } + const isDirectionY = direction === ChartAxisDirection12.Y; + const isReversed = this.getCategoryAxis().isReversed(); + return this.padBandExtent(keys, isReversed !== isDirectionY); + } else { + const yCurrIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrent"); + const yExtent = values[yCurrIndex]; + const fixedYExtent = [Math.min(0, yExtent[0]), Math.max(0, yExtent[1])]; + return fixNumericExtent5(fixedYExtent); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { data, dataModel, processedData } = this; + const categoryAxis = this.getCategoryAxis(); + const valueAxis = this.getValueAxis(); + if (!data || !categoryAxis || !valueAxis || !dataModel || !processedData) { + return; + } + const { line } = this.properties; + const xScale = categoryAxis.scale; + const yScale = valueAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection12.X; + const barWidth = this.getBandwidth(categoryAxis) ?? 10; + const categoryAxisReversed = categoryAxis.isReversed(); + const valueAxisReversed = valueAxis.isReversed(); + if (processedData.type !== "ungrouped") + return; + const context = { + itemId: this.properties.yKey, + nodeData: [], + labelData: [], + pointData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStylesPerItemId2(this.getItemStyle.bind(this), "total", "subtotal", "positive", "negative") + }; + if (!this.visible) + return context; + const pointData = []; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yRawValues = dataModel.resolveColumnById(this, `yRaw`, processedData); + const totalTypeValues = dataModel.resolveColumnById( + this, + `totalTypeValue`, + processedData + ); + const yCurrValues = dataModel.resolveColumnById(this, "yCurrent", processedData); + const yPrevValues = dataModel.resolveColumnById(this, "yPrevious", processedData); + const yCurrTotalValues = dataModel.resolveColumnById(this, "yCurrentTotal", processedData); + const yDomain = this.getSeriesDomain(ChartAxisDirection12.Y); + const crisp = checkCrisp2( + categoryAxis?.scale, + categoryAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + function getValues(isTotal, isSubtotal, datumIndex) { + if (isTotal || isSubtotal) { + return { + cumulativeValue: yCurrTotalValues[datumIndex], + trailingValue: isSubtotal ? trailingSubtotal : 0 + }; + } + return { + cumulativeValue: yCurrValues[datumIndex], + trailingValue: yPrevValues[datumIndex] + }; + } + function getValue(isTotal, isSubtotal, rawValue, cumulativeValue, trailingValue) { + if (isTotal) { + return cumulativeValue; + } + if (isSubtotal) { + return (cumulativeValue ?? 0) - (trailingValue ?? 0); + } + return rawValue; + } + let trailingSubtotal = 0; + const { xKey, yKey, xName, yName } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const datumType = totalTypeValues[datumIndex]; + const isSubtotal = this.isSubtotal(datumType); + const isTotal = this.isTotal(datumType); + const isTotalOrSubtotal = isTotal || isSubtotal; + const xDatum = xValues[datumIndex]; + if (xDatum == null) + continue; + const x = Math.round(xScale.convert(xDatum)); + const rawValue = yRawValues[datumIndex]; + const { cumulativeValue, trailingValue } = getValues(isTotal, isSubtotal, datumIndex); + if (isTotalOrSubtotal) { + trailingSubtotal = cumulativeValue ?? 0; + } + const currY = Math.round(yScale.convert(cumulativeValue)); + const trailY = Math.round(yScale.convert(trailingValue)); + const value = getValue(isTotal, isSubtotal, rawValue, cumulativeValue, trailingValue); + const isPositive = (value ?? 0) >= 0; + const seriesItemType = this.getSeriesItemType(isPositive, datumType); + const { strokeWidth, label } = this.getItemConfig(seriesItemType); + const y = isPositive ? currY : trailY; + const bottomY = isPositive ? trailY : currY; + const barHeight = Math.max(strokeWidth, Math.abs(bottomY - y)); + const rect = { + x: barAlongX ? Math.min(y, bottomY) : x, + y: barAlongX ? x : Math.min(y, bottomY), + width: barAlongX ? barHeight : barWidth, + height: barAlongX ? barWidth : barHeight + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const pointY = isTotalOrSubtotal ? currY : trailY; + const pixelAlignmentOffset = Math.floor(line.strokeWidth) % 2 / 2; + const startY = categoryAxisReversed ? currY : pointY; + const stopY = categoryAxisReversed ? pointY : currY; + let startCoordinates; + let stopCoordinates; + if (barAlongX) { + startCoordinates = { + x: startY + pixelAlignmentOffset, + y: rect.y + }; + stopCoordinates = { + x: stopY + pixelAlignmentOffset, + y: rect.y + rect.height + }; + } else { + startCoordinates = { + x: rect.x, + y: startY + pixelAlignmentOffset + }; + stopCoordinates = { + x: rect.x + rect.width, + y: stopY + pixelAlignmentOffset + }; + } + const pathPoint = { + // lineTo + x: categoryAxisReversed ? stopCoordinates.x : startCoordinates.x, + y: categoryAxisReversed ? stopCoordinates.y : startCoordinates.y, + // moveTo + x2: categoryAxisReversed ? startCoordinates.x : stopCoordinates.x, + y2: categoryAxisReversed ? startCoordinates.y : stopCoordinates.y, + size: 0 + }; + pointData.push(pathPoint); + const itemId = seriesItemType === "subtotal" ? "total" : seriesItemType; + const labelText = this.getLabelText( + value, + datum, + yKey, + "y", + yDomain, + label, + { + itemId, + value, + datum, + xKey, + yKey, + xName, + yName + } + ); + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + const nodeDatum = { + index: datumIndex, + series: this, + itemId: seriesItemType, + datum, + datumIndex, + cumulativeValue: cumulativeValue ?? 0, + xValue: xDatum, + yValue: value, + yKey, + xKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + label: { + text: labelText, + ...adjustLabelPlacement({ + isUpward: (value ?? -1) >= 0 !== valueAxisReversed, + isVertical: !barAlongX, + placement: label.placement, + spacing, + rect + }) + } + }; + context.nodeData.push(nodeDatum); + context.labelData.push(nodeDatum); + } + const connectorLinesEnabled = this.properties.line.enabled; + if (yCurrValues != null && connectorLinesEnabled) { + context.pointData = pointData; + } + return context; + } + updateSeriesItemTypes() { + const { dataModel, seriesItemTypes, processedData } = this; + if (!dataModel || !processedData) { + return; + } + seriesItemTypes.clear(); + const yPositiveIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrentPositive"); + const yNegativeIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrentNegative"); + const totalTypeIndex = dataModel.resolveProcessedDataIndexById(this, `totalTypeValue`); + const positiveDomain = processedData.domain.values[yPositiveIndex] ?? []; + const negativeDomain = processedData.domain.values[yNegativeIndex] ?? []; + if (positiveDomain.length > 0) { + seriesItemTypes.add("positive"); + } + if (negativeDomain.length > 0) { + seriesItemTypes.add("negative"); + } + const itemTypes = processedData?.domain.values[totalTypeIndex]; + if (!itemTypes) { + return; + } + for (const type of itemTypes) { + if (type === "total" || type === "subtotal") { + seriesItemTypes.add("total"); + } + } + } + isSubtotal(datumType) { + return datumType === "subtotal"; + } + isTotal(datumType) { + return datumType === "total"; + } + nodeFactory() { + return new Rect3(); + } + getSeriesItemType(isPositive, datumType) { + return datumType ?? (isPositive ? "positive" : "negative"); + } + getItemConfig(seriesItemType) { + switch (seriesItemType) { + case "positive": { + return this.properties.item.positive; + } + case "negative": { + return this.properties.item.negative; + } + case "subtotal": + case "total": { + return this.properties.item.total; + } + } + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data); + } + getItemStyle(nodeDatum, isHighlight, highlightState, itemId = "total") { + const { properties } = this; + const { datumIndex = 0, datum } = nodeDatum ?? {}; + const propertyItemId = itemId === "subtotal" ? "total" : itemId; + const item = properties.item[propertyItemId]; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + const baseStyle = mergeDefaults7(highlightStyle, properties.getStyle(itemId)); + const { itemStyler } = item; + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId5(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(itemId, datumIndex, datum, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`, "item", propertyItemId], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults7(overrides, style); + } + } + return style; + } + makeItemStylerParams(itemId, datumIndex, datum, isHighlight, style) { + const { id: seriesId, properties } = this; + const { xKey, yKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + itemId, + datum, + xKey, + yKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection12.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle6(rect, style, fillBBox); + rect.cornerRadius = style.cornerRadius ?? 0; + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + if (labelData.length === 0) { + return labelSelection.update([]); + } + const data = labelData.filter((labelDatum) => { + const { label } = this.getItemConfig(labelDatum.itemId); + return label.enabled; + }); + return labelSelection.update(data); + } + updateLabelNodes(opts) { + const params = { + itemId: "positive", + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xName, + yKey: this.properties.yKey, + yName: this.properties.yName ?? this.properties.yName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + params.itemId = datum.itemId; + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex)?.opacity ?? 1; + const label = this.getItemConfig(datum.itemId).label; + updateLabelNode4(this, textNode, params, label, datum.label, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yKey, yName, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yRaw`, processedData)[datumIndex]; + const yCurrTotalValues = dataModel.resolveColumnById(this, "yCurrentTotal", processedData); + const totalTypeValues = dataModel.resolveColumnById( + this, + `totalTypeValue`, + processedData + ); + if (xValue2 == null) + return; + const datumType = totalTypeValues[datumIndex]; + const isPositive = (yValue ?? 0) >= 0; + const seriesItemType = this.getSeriesItemType(isPositive, datumType); + let total; + if (this.isTotal(datumType)) { + total = yCurrTotalValues[datumIndex]; + } else if (this.isSubtotal(datumType)) { + total = yCurrTotalValues[datumIndex]; + for (let previousIndex = datumIndex - 1; previousIndex >= 0; previousIndex -= 1) { + if (this.isSubtotal(totalTypeValues[previousIndex])) { + total = total - yCurrTotalValues[previousIndex]; + break; + } + } + } else { + total = yValue; + } + const nodeDatum = this.contextNodeData?.nodeData?.[datumIndex]; + const format = this.getItemStyle(nodeDatum, false, void 0, nodeDatum?.itemId); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(seriesItemType), + data: [ + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", total, datum, yKey, legendItemName) + } + ] + }, + { seriesId, datum, title: yName, itemId: seriesItemType, xKey, xName, yKey, yName, ...format } + ); + } + legendItemSymbol(item) { + const { fill, stroke, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.getItemConfig(item); + return { + marker: { + fill, + stroke, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id, seriesItemTypes } = this; + const legendData = []; + const capitalise = (text) => text.charAt(0).toUpperCase() + text.substring(1); + const { showInLegend } = this.properties; + for (const item of seriesItemTypes) { + const { name } = this.getItemConfig(item); + legendData.push({ + legendType: "category", + id, + itemId: item, + seriesId: id, + enabled: true, + label: { text: name ?? capitalise(item) }, + symbol: this.legendItemSymbol(item), + hideInLegend: !showInLegend, + isFixed: true + }); + } + return legendData; + } + toggleSeriesItem() { + } + animateEmptyUpdateReady(opts) { + const { datumSelection, labelSelection, contextData } = opts; + const fns = prepareBarAnimationFunctions2( + collapsedStartingBarPosition(this.isVertical(), this.axes, "normal"), + "unknown" + ); + motion3.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation3(this, "labels", this.ctx.animationManager, labelSelection); + const { pointData } = contextData; + if (!pointData) + return; + if (this.isVertical()) { + this.animateConnectorLinesVertical(opts); + } else { + this.animateConnectorLinesHorizontal(opts); + } + } + animateConnectorLinesHorizontal(opts) { + const { pointData = [] } = opts.contextData; + const [lineNode] = opts.paths; + const { path: linePath } = lineNode; + this.updateLineNode(lineNode); + const valueAxis = this.getValueAxis(); + const valueAxisReversed = valueAxis?.isReversed(); + const compare = valueAxisReversed ? (v, v2) => v < v2 : (v, v2) => v > v2; + const startX = valueAxis?.scale.convert(0); + const endX = pointData.reduce( + (end, point) => { + if (compare(point.x, end)) { + end = point.x; + } + return end; + }, + valueAxisReversed ? Infinity : 0 + ); + const scale = (value, start1, end1, start2, end2) => { + return (value - start1) / (end1 - start1) * (end2 - start2) + start2; + }; + this.ctx.animationManager.animate({ + id: `${this.id}_connectors`, + groupId: this.id, + phase: "initial", + from: startX, + to: endX, + ease: _ModuleSupport59.Motion.easeOut, + collapsable: false, + onUpdate(pointX) { + linePath.clear(true); + for (const [index, point] of pointData.entries()) { + const x = scale(pointX, startX, endX, startX, point.x); + const x2 = scale(pointX, startX, endX, startX, point.x2); + if (index !== 0) { + linePath.lineTo(x, point.y); + } + linePath.moveTo(x2, point.y2); + } + lineNode.checkPathDirty(); + }, + onStop: () => this.resetConnectorLinesPath(opts) + }); + } + animateConnectorLinesVertical(opts) { + const { pointData = [] } = opts.contextData; + const [lineNode] = opts.paths; + const { path: linePath } = lineNode; + this.updateLineNode(lineNode); + const valueAxis = this.getValueAxis(); + const valueAxisReversed = valueAxis?.isReversed(); + const compare = valueAxisReversed ? (v, v2) => v > v2 : (v, v2) => v < v2; + const startY = valueAxis?.scale.convert(0); + const endY = pointData.reduce( + (end, point) => { + if (compare(point.y, end)) { + end = point.y; + } + return end; + }, + valueAxisReversed ? 0 : Infinity + ); + const scale = (value, start1, end1, start2, end2) => { + return (value - start1) / (end1 - start1) * (end2 - start2) + start2; + }; + this.ctx.animationManager.animate({ + id: `${this.id}_connectors`, + groupId: this.id, + phase: "initial", + from: startY, + to: endY, + ease: _ModuleSupport59.Motion.easeOut, + collapsable: false, + onUpdate(pointY) { + linePath.clear(true); + for (const [index, point] of pointData.entries()) { + const y = scale(pointY, startY, endY, startY, point.y); + const y2 = scale(pointY, startY, endY, startY, point.y2); + if (index !== 0) { + linePath.lineTo(point.x, y); + } + linePath.moveTo(point.x2, y2); + } + lineNode.checkPathDirty(); + }, + onStop: () => this.resetConnectorLinesPath(opts) + }); + } + animateReadyResize(data) { + super.animateReadyResize(data); + this.resetConnectorLinesPath(data); + } + updatePaths(opts) { + this.resetConnectorLinesPath({ contextData: opts.contextData, paths: opts.paths }); + } + resetConnectorLinesPath({ + contextData, + paths + }) { + if (paths.length === 0) { + return; + } + const [lineNode] = paths; + this.updateLineNode(lineNode); + const { path: linePath } = lineNode; + linePath.clear(true); + const { pointData } = contextData; + if (!pointData) { + return; + } + for (const [index, point] of pointData.entries()) { + if (index !== 0) { + linePath.lineTo(point.x, point.y); + } + linePath.moveTo(point.x2, point.y2); + } + lineNode.checkPathDirty(); + } + updateLineNode(lineNode) { + const { stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this.properties.line; + lineNode.setProperties({ + fill: void 0, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + lineJoin: "round", + pointerEvents: _ModuleSupport59.PointerEvents.None + }); + } + isLabelEnabled() { + const { positive, negative, total } = this.properties.item; + return positive.label.enabled || negative.label.enabled || total.label.enabled; + } + onDataChange() { + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds5(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + const { positive, negative, total } = this.properties.item; + return positive.itemStyler != null || positive.label.itemStyler != null || negative.itemStyler != null || negative.label.itemStyler != null || total.itemStyler != null || total.label.itemStyler != null; + } +}; +WaterfallSeries.className = "WaterfallSeries"; +WaterfallSeries.type = "waterfall"; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport60 } from "ag-charts-community"; +import { arrayOfDefs as arrayOfDefs2, constant as constant8, positiveNumber, required as required8, string as string8, union as union2 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs7, waterfallSeriesThemeableOptionsDef } = _ModuleSupport60; +var waterfallSeriesOptionsDef = { + ...waterfallSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs7, + type: required8(constant8("waterfall")), + xKey: required8(string8), + yKey: required8(string8), + xName: string8, + yName: string8, + totals: arrayOfDefs2( + { + totalType: required8(union2("total", "subtotal")), + index: required8(positiveNumber), + axisLabel: required8(string8) + }, + "a total definition options array" + ) +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallThemes.ts +import { _ModuleSupport as _ModuleSupport61 } from "ag-charts-community"; +var { FILL_GRADIENT_LINEAR_KEYED_DEFAULTS: FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2, FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS3, FILL_PATTERN_KEYED_DEFAULTS: FILL_PATTERN_KEYED_DEFAULTS2 } = _ModuleSupport61; +function itemTheme2(key, index) { + return { + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $path: [`/${index}`, { $palette: "fill" }, { $palette: "fills" }] }, + { $palette: `${key}.fill` } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2(key)], + ["image", FILL_IMAGE_DEFAULTS3], + ["pattern", FILL_PATTERN_KEYED_DEFAULTS2(key)] + ] + }, + stroke: { $palette: `${key}.stroke` }, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + ..._ModuleSupport61.LABEL_BOXING_DEFAULTS, + enabled: false, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + formatter: void 0, + placement: "outside-end", + padding: { $isUserOption: ["./spacing", 0, 6] } + // compatibility with old `padding` property (now named `spacing`). + } + }; +} +var WATERFALL_SERIES_THEME = { + series: { + item: { + positive: itemTheme2("altUp", 0), + negative: itemTheme2("altDown", 1), + total: itemTheme2("neutral", 2) + }, + line: { + stroke: { $palette: "neutral.stroke" }, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0, + strokeWidth: 2 + }, + highlight: _ModuleSupport61.singleSeriesHighlightStyle() + }, + legend: { + enabled: true, + toggleSeries: false + } +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallModule.ts +var WaterfallModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "waterfall", + solo: true, + moduleFactory: (ctx) => new WaterfallSeries(ctx), + defaultAxes: _ModuleSupport62.DIRECTION_SWAP_AXES, + themeTemplate: WATERFALL_SERIES_THEME +}; +var WaterfallSeriesModule = { + type: "series", + name: "waterfall", + chartType: "cartesian", + enterprise: true, + options: waterfallSeriesOptionsDef, + create: (ctx) => new WaterfallSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorOptionsDefs.ts +var { + NewAreaSeriesModule, + NewBarSeriesModule, + NewBubbleSeriesModule, + NewHistogramSeriesModule, + NewLineSeriesModule, + NewScatterSeriesModule, + numberFormatValidator, + textOrSegments, + without: without2 +} = _ModuleSupport63; +var navigatorHandleOptionsDef = { + width: positiveNumber2, + height: positiveNumber2, + grip: boolean7, + fill: color2, + stroke: color2, + strokeWidth: positiveNumber2, + cornerRadius: positiveNumber2 +}; +var commonIgnoredMiniChartProperties = [ + "cursor", + "highlightStyle", + "listeners", + "nodeClickRange", + "showInLegend", + "showInMiniChart", + "tooltip", + "visible", + "xName", + "yName" +]; +var barIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "label", + "legendItemName", + "direction" +]; +var boxPlotIngnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction", + "legendItemName", + "minName", + "q1Name", + "medianName", + "q3Name", + "maxName" +]; +var bubbleIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "title", + "label", + "labelKey", + "labelName", + "sizeName" +]; +var heatmapIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "title", + "label", + "colorName", + "textAlign", + "verticalAlign", + "itemPadding", + "colorRange" +]; +var histogramIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "label" +]; +var lineIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "title", + "label" +]; +var rangeAreaIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "label", + "yLowName", + "yHighName" +]; +var rangeBarIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction", + "label", + "yLowName", + "yHighName" +]; +var scatterIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "title", + "label", + "labelKey", + "labelName" +]; +var waterfallIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction" +]; +var navigatorOptionsDef = { + enabled: boolean7, + height: positiveNumber2, + spacing: positiveNumber2, + cornerRadius: number6, + mask: { + fill: color2, + fillOpacity: ratio2, + stroke: color2, + strokeWidth: positiveNumber2 + }, + minHandle: navigatorHandleOptionsDef, + maxHandle: navigatorHandleOptionsDef, + miniChart: { + enabled: boolean7, + padding: { + top: positiveNumber2, + bottom: positiveNumber2 + }, + label: { + enabled: boolean7, + avoidCollisions: boolean7, + spacing: positiveNumber2, + format: numberFormatValidator, + formatter: callbackOf(textOrSegments), + interval: { + minSpacing: positiveNumber2, + maxSpacing: positiveNumber2, + values: array, + step: number6 + }, + ...fontOptionsDef + }, + series: arrayOfDefs3( + typeUnion2( + { + area: without2(NewAreaSeriesModule.options, [...commonIgnoredMiniChartProperties, "type"]), + bar: without2(NewBarSeriesModule.options, [...barIgnoredMiniChartProperties, "type"]), + "box-plot": without2(BoxPlotSeriesModule.options, [...boxPlotIngnoredMiniChartProperties, "type"]), + bubble: without2(NewBubbleSeriesModule.options, [...bubbleIgnoredMiniChartProperties, "type"]), + candlestick: without2(CandlestickSeriesModule.options, [ + ...commonIgnoredMiniChartProperties, + "type" + ]), + heatmap: without2(HeatmapSeriesModule.options, [...heatmapIgnoredMiniChartProperties, "type"]), + histogram: without2(NewHistogramSeriesModule.options, [ + ...histogramIgnoredMiniChartProperties, + "type" + ]), + line: without2(NewLineSeriesModule.options, [...lineIgnoredMiniChartProperties, "type"]), + ohlc: without2(OhlcSeriesModule.options, [...commonIgnoredMiniChartProperties, "type"]), + "range-area": without2(RangeAreaSeriesModule.options, [ + ...rangeAreaIgnoredMiniChartProperties, + "type" + ]), + "range-bar": without2(RangeBarSeriesModule.options, [...rangeBarIgnoredMiniChartProperties, "type"]), + scatter: without2(NewScatterSeriesModule.options, [...scatterIgnoredMiniChartProperties, "type"]), + waterfall: without2(WaterfallSeriesModule.options, [...waterfallIgnoredMiniChartProperties, "type"]) + }, + "miniChart series options" + ) + ) + } +}; + +// packages/ag-charts-enterprise/src/features/sync/pluginModules.ts +var { annotationOptionsDef } = _ModuleSupport64; +var AnnotationsModule = { + type: "plugin", + name: "annotations", + chartType: "cartesian", + options: annotationOptionsDef, + create() { + return null; + } +}; +var NavigatorModule = { + type: "plugin", + name: "navigator", + chartType: "cartesian", + options: navigatorOptionsDef, + create() { + return null; + } +}; +var InitialStateModule = { + type: "plugin", + name: "initialState", + options: initialStateOptionsDef, + create() { + return null; + } +}; + +// packages/ag-charts-enterprise/src/series/chord/chordModule.ts +import { _ModuleSupport as _ModuleSupport70 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/chord/chordSeries.ts +import { _ModuleSupport as _ModuleSupport68 } from "ag-charts-community"; +import { + Logger as Logger5, + cachedTextMeasurer as cachedTextMeasurer2, + calcLineHeight, + toPlainText as toPlainText2, + wrapText +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionSeries.ts +import { _ModuleSupport as _ModuleSupport65 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionUtil.ts +import { Logger as Logger4 } from "ag-charts-core"; +function computeNodeGraph(nodes, links, includeCircularReferences) { + if (!includeCircularReferences) { + links = removeCircularLinks(links); + } + const nodeGraph = /* @__PURE__ */ new Map(); + for (const datum of nodes) { + nodeGraph.set(datum.id, { + datum, + linksBefore: [], + linksAfter: [], + maxPathLengthBefore: -1, + maxPathLengthAfter: -1 + }); + } + let maxPathLength = 0; + for (const [id, node] of nodeGraph.entries()) { + maxPathLength = Math.max( + maxPathLength, + computePathLength(nodeGraph, links, node, id, -1, []) + computePathLength(nodeGraph, links, node, id, 1, []) + 1 + ); + } + return { links, nodeGraph, maxPathLength }; +} +function findCircularLinks(links, link, into, stack) { + const stackIndex = stack.indexOf(link); + if (stackIndex !== -1) { + for (let i = stackIndex; i < stack.length; i += 1) { + into.add(stack[i]); + } + return; + } + stack.push(link); + const { toNode } = link; + for (const next of links) { + if (next.fromNode === toNode) { + findCircularLinks(links, next, into, stack); + } + } + stack.pop(); +} +function removeCircularLinks(links) { + const circularLinks = /* @__PURE__ */ new Set(); + for (const link of links) { + findCircularLinks(links, link, circularLinks, []); + } + if (circularLinks.size !== 0) { + Logger4.warnOnce("Some links formed circular references. These will be removed from the output."); + } + return circularLinks.size === 0 ? links : links.filter((link) => !circularLinks.has(link)); +} +function computePathLength(nodeGraph, links, node, id, direction, stack) { + if (stack.includes(id)) { + return Infinity; + } + let maxPathLength = direction === -1 ? node.maxPathLengthBefore : node.maxPathLengthAfter; + if (maxPathLength === -1) { + maxPathLength = 0; + const connectedLinks = direction === -1 ? node.linksBefore : node.linksAfter; + for (const link of links) { + const { fromNode, toNode } = link; + const linkId = direction === -1 ? toNode.id : fromNode.id; + const nextNodeId = direction === -1 ? fromNode.id : toNode.id; + const nextNode = id === linkId ? nodeGraph.get(nextNodeId) : void 0; + if (nextNode == null) + continue; + connectedLinks.push({ node: nextNode, link }); + stack?.push(id); + maxPathLength = Math.max( + maxPathLength, + computePathLength(nodeGraph, links, nextNode, nextNodeId, direction, stack) + 1 + ); + stack?.pop(); + } + if (direction === -1) { + node.maxPathLengthBefore = maxPathLength; + } else { + node.maxPathLengthAfter = maxPathLength; + } + } + return maxPathLength; +} + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionSeries.ts +var { Series, DataController, keyProperty: keyProperty6, valueProperty: valueProperty7, Selection: Selection3, Group: Group5, TransformableText } = _ModuleSupport65; +var FlowProportionSeriesNodeEvent = class extends _ModuleSupport65.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + const { datumIndex } = datum; + const nodeDatum = series.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + this.size = nodeDatum?.size; + this.label = nodeDatum?.type === 1 /* Node */ ? nodeDatum?.label : void 0; + } +}; +var FlowProportionSeries = class extends Series { + constructor() { + super(...arguments); + this.NodeEvent = FlowProportionSeriesNodeEvent; + this.nodeCount = 0; + this.linkCount = 0; + this.linksDataModel = void 0; + this.linksProcessedData = void 0; + this.nodesDataModel = void 0; + this.nodesProcessedData = void 0; + this.processedNodes = /* @__PURE__ */ new Map(); + this.linkGroup = this.contentGroup.appendChild(new Group5({ name: "linkGroup" })); + this.nodeGroup = this.contentGroup.appendChild(new Group5({ name: "nodeGroup" })); + this.focusLinkGroup = this.highlightGroup.appendChild(new Group5({ name: "linkGroup" })); + this.focusNodeGroup = this.highlightGroup.appendChild(new Group5({ name: "nodeGroup" })); + this.highlightLinkGroup = this.highlightGroup.appendChild(new Group5({ name: "linkGroup" })); + this.highlightNodeGroup = this.highlightGroup.appendChild(new Group5({ name: "nodeGroup" })); + this.labelSelection = Selection3.select( + this.labelGroup, + TransformableText + ); + this.linkSelection = Selection3.select( + this.linkGroup, + () => this.linkFactory() + ); + this.nodeSelection = Selection3.select( + this.nodeGroup, + () => this.nodeFactory() + ); + this.focusLinkSelection = Selection3.select( + this.focusLinkGroup, + () => this.linkFactory() + ); + this.focusNodeSelection = Selection3.select( + this.focusNodeGroup, + () => this.nodeFactory() + ); + this.highlightLinkSelection = Selection3.select( + this.highlightLinkGroup, + () => this.linkFactory() + ); + this.highlightNodeSelection = Selection3.select( + this.highlightNodeGroup, + () => this.nodeFactory() + ); + } + get nodes() { + return this.properties.nodes; + } + async processData(dataController) { + const { data, nodes } = this; + if (data == null) + return; + const { fromKey, toKey, sizeKey, idKey, labelKey } = this.properties; + const nodesDataController = new DataController("standalone", dataController.suppressFieldDotNotation); + const nodesDataModelPromise = nodes == null ? null : nodesDataController.request( + this.id, + _ModuleSupport65.DataSet.wrap(nodes) ?? _ModuleSupport65.DataSet.empty(), + { + props: [ + keyProperty6(idKey, void 0, { id: "idValue", includeProperty: false }), + ...labelKey == null ? [] : [valueProperty7(labelKey, void 0, { id: "labelValue", includeProperty: false })] + ], + groupByKeys: true + } + ); + const linksDataModelPromise = dataController.request(this.id, data, { + props: [ + valueProperty7(fromKey, void 0, { id: "fromValue", includeProperty: false }), + valueProperty7(toKey, void 0, { id: "toValue", includeProperty: false }), + ...sizeKey == null ? [] : [ + valueProperty7(sizeKey, void 0, { + id: "sizeValue", + includeProperty: false, + missingValue: 0 + }) + ] + ], + groupByKeys: false + }); + if (nodes != null) { + nodesDataController.execute(); + } + const [nodesDataModel, linksDataModel] = await Promise.all([ + nodesDataModelPromise ?? Promise.resolve(null), + linksDataModelPromise + ]); + this.nodesDataModel = nodesDataModel?.dataModel; + this.nodesProcessedData = nodesDataModel?.processedData; + this.linksDataModel = linksDataModel?.dataModel; + this.linksProcessedData = linksDataModel?.processedData; + const processedNodes = /* @__PURE__ */ new Map(); + if (nodesDataModel == null) { + const fromIdValues = linksDataModel.dataModel.resolveColumnById( + this, + "fromValue", + linksDataModel.processedData + ); + const toIdValues = linksDataModel.dataModel.resolveColumnById( + this, + "toValue", + linksDataModel.processedData + ); + const createImplicitNode = (id) => { + const datumIndex = processedNodes.size; + const label = id; + return { + series: this, + itemId: void 0, + datum: {}, + // Must be a referential object for tooltips + datumIndex: { type: 1 /* Node */, index: datumIndex }, + type: 1 /* Node */, + index: datumIndex, + linksBefore: [], + linksAfter: [], + id, + size: 0, + label, + style: this.getNodeStyle( + { + datumIndex: { type: 1 /* Node */, index: datumIndex }, + datum: {}, + size: 0, + label + }, + datumIndex, + false + ) + }; + }; + const linkData = linksDataModel.processedData.dataSources.get(this.id)?.data; + if (linkData) { + for (const [datumIndex] of linkData.entries()) { + const fromId = fromIdValues[datumIndex]; + const toId = toIdValues[datumIndex]; + if (fromId == null || toId == null) + continue; + if (!processedNodes.has(fromId)) { + processedNodes.set(fromId, createImplicitNode(fromId)); + } + if (!processedNodes.has(toId)) { + processedNodes.set(toId, createImplicitNode(toId)); + } + } + } + } else { + const nodeIdValues = nodesDataModel.dataModel.resolveColumnById( + this, + "idValue", + nodesDataModel.processedData + ); + const labelValues = labelKey == null ? void 0 : nodesDataModel.dataModel.resolveColumnById( + this, + "labelValue", + nodesDataModel.processedData + ); + const nodeData = nodesDataModel.processedData.dataSources.get(this.id)?.data; + if (nodeData) { + for (const [datumIndex, datum] of nodeData.entries()) { + const id = nodeIdValues[datumIndex]; + const label = labelValues?.[datumIndex]; + const nodeDatumIndex = { type: 1 /* Node */, index: datumIndex }; + processedNodes.set(id, { + series: this, + itemId: void 0, + datum, + datumIndex: nodeDatumIndex, + type: 1 /* Node */, + index: datumIndex, + linksBefore: [], + linksAfter: [], + id, + size: 0, + label, + style: this.getNodeStyle( + { datumIndex: nodeDatumIndex, datum, size: 0, label }, + datumIndex, + false + ) + }); + } + } + } + this.processedNodes = processedNodes; + } + getNodeGraph(createNode, createLink, { includeCircularReferences }) { + const { linksDataModel, linksProcessedData } = this; + if (linksDataModel == null || linksProcessedData == null) { + const { links: links2, nodeGraph: nodeGraph2, maxPathLength: maxPathLength2 } = computeNodeGraph( + (/* @__PURE__ */ new Map()).values(), + [], + includeCircularReferences + ); + this.nodeCount = 0; + this.linkCount = 0; + return { nodeGraph: nodeGraph2, links: links2, maxPathLength: maxPathLength2 }; + } + const { sizeKey } = this.properties; + const fromIdValues = linksDataModel.resolveColumnById(this, "fromValue", linksProcessedData); + const toIdValues = linksDataModel.resolveColumnById(this, "toValue", linksProcessedData); + const sizeValues = sizeKey == null ? void 0 : linksDataModel.resolveColumnById(this, "sizeValue", linksProcessedData); + const nodesById = /* @__PURE__ */ new Map(); + for (const datum of this.processedNodes.values()) { + const node = createNode(datum); + nodesById.set(datum.id, node); + } + const baseLinks = []; + const linkData = linksProcessedData.dataSources.get(this.id)?.data; + if (linkData) { + for (const [datumIndex, datum] of linkData.entries()) { + const fromId = fromIdValues[datumIndex]; + const toId = toIdValues[datumIndex]; + const size = sizeValues == null ? 1 : sizeValues[datumIndex]; + const fromNode = nodesById.get(fromId); + const toNode = nodesById.get(toId); + if (size <= 0 || fromNode == null || toNode == null) + continue; + const linkNodeDatumIndex = { type: 0 /* Link */, index: datumIndex }; + const link = createLink({ + series: this, + itemId: void 0, + datum, + datumIndex: linkNodeDatumIndex, + type: 0 /* Link */, + index: datumIndex, + fromNode, + toNode, + size, + style: this.getLinkStyle( + { datum, datumIndex: linkNodeDatumIndex }, + fromNode.datumIndex, + false + ) + }); + baseLinks.push(link); + } + } + const { links, nodeGraph, maxPathLength } = computeNodeGraph( + nodesById.values(), + baseLinks, + includeCircularReferences + ); + for (const node of nodeGraph.values()) { + node.datum.linksBefore = node.linksBefore.map((linkedNode) => linkedNode.link); + node.datum.linksAfter = node.linksAfter.map((linkedNode) => linkedNode.link); + } + this.nodeCount = nodeGraph.size; + this.linkCount = links.length; + return { nodeGraph, links, maxPathLength }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update(opts) { + const { seriesRect } = opts; + const newNodeDataDependencies = { + seriesRectWidth: seriesRect?.width ?? 0, + seriesRectHeight: seriesRect?.height ?? 0 + }; + if (this._nodeDataDependencies == null || this._nodeDataDependencies.seriesRectWidth !== newNodeDataDependencies.seriesRectWidth || this._nodeDataDependencies.seriesRectHeight !== newNodeDataDependencies.seriesRectHeight) { + this._nodeDataDependencies = newNodeDataDependencies; + } + this.updateSelections(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedDatum?.series === this && highlightedDatum.type == null) { + const { itemId } = highlightedDatum; + highlightedDatum = itemId == null ? void 0 : nodeData.find((node) => node.type === 1 /* Node */ && node.id === itemId); + } else if (highlightedDatum?.series !== this) { + highlightedDatum = void 0; + } + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = highlightedDatum == null ? 1 : this.properties.highlight.unhighlightedItem.opacity ?? 1; + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection: this.labelSelection }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + this.linkSelection = this.updateLinkSelection({ + nodeData: nodeData.filter((d) => d.type === 0 /* Link */), + datumSelection: this.linkSelection + }); + this.updateLinkNodes({ datumSelection: this.linkSelection, isHighlight: false }); + this.nodeSelection = this.updateNodeSelection({ + nodeData: nodeData.filter((d) => d.type === 1 /* Node */), + datumSelection: this.nodeSelection + }); + this.updateNodeNodes({ datumSelection: this.nodeSelection, isHighlight: false }); + let focusLinkSelection; + let focusNodeSelection; + let highlightLinkSelection; + let highlightNodeSelection; + if (highlightedDatum?.type === 1 /* Node */) { + focusLinkSelection = nodeData.filter((node) => { + return node.type === 0 /* Link */ && (node.toNode === highlightedDatum || node.fromNode === highlightedDatum); + }); + focusNodeSelection = focusLinkSelection.map((link) => { + return link.fromNode === highlightedDatum ? link.toNode : link.fromNode; + }); + focusNodeSelection.push(highlightedDatum); + highlightLinkSelection = []; + highlightNodeSelection = [highlightedDatum]; + } else if (highlightedDatum?.type === 0 /* Link */) { + focusLinkSelection = [highlightedDatum]; + focusNodeSelection = [highlightedDatum.fromNode, highlightedDatum.toNode]; + highlightLinkSelection = [highlightedDatum]; + highlightNodeSelection = []; + } else { + focusLinkSelection = []; + focusNodeSelection = []; + highlightLinkSelection = []; + highlightNodeSelection = []; + } + this.focusLinkSelection = this.updateLinkSelection({ + nodeData: focusLinkSelection, + datumSelection: this.focusLinkSelection + }); + this.updateLinkNodes({ datumSelection: this.focusLinkSelection, isHighlight: false }); + this.focusNodeSelection = this.updateNodeSelection({ + nodeData: focusNodeSelection, + datumSelection: this.focusNodeSelection + }); + this.updateNodeNodes({ datumSelection: this.focusNodeSelection, isHighlight: false }); + this.highlightLinkSelection = this.updateLinkSelection({ + nodeData: highlightLinkSelection, + datumSelection: this.highlightLinkSelection + }); + this.updateLinkNodes({ datumSelection: this.highlightLinkSelection, isHighlight: true }); + this.highlightNodeSelection = this.updateNodeSelection({ + nodeData: highlightNodeSelection, + datumSelection: this.highlightNodeSelection + }); + this.updateNodeNodes({ datumSelection: this.highlightNodeSelection, isHighlight: true }); + } + resetAnimation(_chartAnimationPhase) { + } + dataCount() { + return Number.NaN; + } + getSeriesDomain(_direction) { + return []; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + legendItemSymbol(_type, nodeIndex, format = {}) { + const { fills, strokes } = this.properties; + const { + fill = fills[nodeIndex % fills.length], + fillOpacity = 1, + stroke = strokes[nodeIndex % strokes.length], + strokeWidth = 0, + strokeOpacity = 1, + lineDash = [0], + lineDashOffset = 0 + } = format; + return { + marker: { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") + return []; + const { showInLegend } = this.properties; + return Array.from( + this.processedNodes.values(), + ({ id, label }, nodeIndex) => ({ + legendType: "category", + id: this.id, + itemId: id, + seriesId: this.id, + enabled: true, + label: { text: label ?? id }, + symbol: this.legendItemSymbol(1 /* Node */, nodeIndex), + hideInLegend: !showInLegend, + isFixed: true + }) + ); + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.linkSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + this.nodeSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + getDatumAriaText(datum, description) { + if (datum.type === 0 /* Link */) { + return this.ctx.localeManager.t("ariaAnnounceFlowProportionLink", { + index: datum.index + 1, + count: this.linkCount, + from: datum.fromNode.id, + to: datum.toNode.id, + size: datum.size, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }); + } else if (datum.type === 1 /* Node */) { + return this.ctx.localeManager.t("ariaAnnounceFlowProportionNode", { + index: datum.index + 1, + count: this.nodeCount, + description + }); + } + } + pickFocus(opts) { + const { datumIndexDelta: childDelta, otherIndexDelta: depthDelta } = opts; + const currentNodeDatum = this.contextNodeData?.nodeData[opts.datumIndex - opts.datumIndexDelta]; + let nextNodeDatum = currentNodeDatum; + if (depthDelta !== 0 || childDelta === 0) + return; + if (currentNodeDatum?.type === 0 /* Link */) { + const allLinks = Array.from(this.linkSelection, (link) => link.datum); + const selfIndex = allLinks.indexOf(currentNodeDatum); + const nextIndex = selfIndex + childDelta; + if (nextIndex >= 0 && nextIndex < allLinks.length) { + nextNodeDatum = allLinks[nextIndex]; + } else if (nextIndex > 0) { + nextNodeDatum = allLinks.at(-1); + } else { + const allNodes = Array.from(this.nodeSelection, (node) => node.datum); + nextNodeDatum = allNodes.at(-1); + } + } else if (currentNodeDatum?.type === 1 /* Node */) { + const allNodes = Array.from(this.nodeSelection, (node) => node.datum); + const selfIndex = allNodes.indexOf(currentNodeDatum); + const nextIndex = selfIndex + childDelta; + if (nextIndex >= 0 && nextIndex < allNodes.length) { + nextNodeDatum = allNodes[nextIndex]; + } else if (nextIndex < 0) { + nextNodeDatum = allNodes[0]; + } else { + const allLinks = Array.from(this.linkSelection, (link) => link.datum); + nextNodeDatum = allLinks[0]; + } + } + if (nextNodeDatum == null) + return; + const nodeDatum = nextNodeDatum.type === 1 /* Node */ ? Array.from(this.nodeSelection).find((n) => n.datum === nextNodeDatum) : Array.from(this.linkSelection).find((n) => n.datum === nextNodeDatum); + if (nodeDatum == null) + return; + const bounds = this.computeFocusBounds(nodeDatum.node); + if (bounds == null) + return; + return { + datum: nodeDatum.datum, + datumIndex: this.contextNodeData?.nodeData.indexOf(nodeDatum.datum) ?? 0, + otherIndex: 0, + bounds, + clipFocusBox: true + }; + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } +}; + +// packages/ag-charts-enterprise/src/series/chord/chordLink.ts +import { _ModuleSupport as _ModuleSupport66 } from "ag-charts-community"; +var { Path: Path7, SceneChangeDetection: SceneChangeDetection4 } = _ModuleSupport66; +function bezierControlPoints({ + radius, + startAngle, + endAngle, + tension +}) { + const cp0x = radius * Math.cos(startAngle); + const cp0y = radius * Math.sin(startAngle); + const cp3x = radius * Math.cos(endAngle); + const cp3y = radius * Math.sin(endAngle); + const cp1x = cp0x * tension; + const cp1y = cp0y * tension; + const cp2x = cp3x * tension; + const cp2y = cp3y * tension; + return { + x: [cp0x, cp1x, cp2x, cp3x], + y: [cp0y, cp1y, cp2y, cp3y] + }; +} +var ChordLink = class extends Path7 { + constructor() { + super(...arguments); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.startAngle1 = 0; + this.endAngle1 = 0; + this.startAngle2 = 0; + this.endAngle2 = 0; + this.tension = 1; + } + tensionedCurveTo(cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y) { + const { path, tension } = this; + const scale = 1 - tension; + path.cubicCurveTo( + (cp1x - cp0x) * scale + cp0x, + (cp1y - cp0y) * scale + cp0y, + (cp2x - cp3x) * scale + cp3x, + (cp2y - cp3y) * scale + cp3y, + cp3x, + cp3y + ); + } + updatePath() { + const { path, centerX, centerY, radius } = this; + let { startAngle1, endAngle1, startAngle2, endAngle2 } = this; + if (startAngle1 > startAngle2) { + [startAngle1, startAngle2] = [startAngle2, startAngle1]; + [endAngle1, endAngle2] = [endAngle2, endAngle1]; + } + path.clear(); + const startX = centerX + radius * Math.cos(startAngle1); + const startY = centerY + radius * Math.sin(startAngle1); + path.moveTo(startX, startY); + this.tensionedCurveTo( + startX, + startY, + centerX, + centerY, + centerX, + centerY, + centerX + radius * Math.cos(endAngle2), + centerY + radius * Math.sin(endAngle2) + ); + path.arc(centerX, centerY, radius, endAngle2, startAngle2, true); + this.tensionedCurveTo( + centerX + radius * Math.cos(startAngle2), + centerY + radius * Math.sin(startAngle2), + centerX, + centerY, + centerX, + centerY, + centerX + radius * Math.cos(endAngle1), + centerY + radius * Math.sin(endAngle1) + ); + path.arc(centerX, centerY, radius, endAngle1, startAngle1, true); + path.closePath(); + } +}; +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "centerX", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "centerY", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "radius", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "startAngle1", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "endAngle1", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "startAngle2", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "endAngle2", 2); +__decorateClass([ + SceneChangeDetection4() +], ChordLink.prototype, "tension", 2); + +// packages/ag-charts-enterprise/src/series/chord/chordSeriesProperties.ts +import { + _ModuleSupport as _ModuleSupport67 +} from "ag-charts-community"; +var { + FillGradientDefaults, + FillPatternDefaults, + FillImageDefaults, + BaseProperties: BaseProperties7, + makeSeriesTooltip: makeSeriesTooltip8, + SeriesProperties, + Property: Property20, + Label: Label4 +} = _ModuleSupport67; +var ChordSeriesLabelProperties = class extends Label4 { + constructor() { + super(...arguments); + this.spacing = 1; + this.maxWidth = 1; + } +}; +__decorateClass([ + Property20 +], ChordSeriesLabelProperties.prototype, "spacing", 2); +__decorateClass([ + Property20 +], ChordSeriesLabelProperties.prototype, "maxWidth", 2); +var ChordSeriesLinkProperties = class extends BaseProperties7 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tension = 0; + } + getStyle(fills, strokes, index) { + const { fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset, tension } = this; + const fill = this.fill ?? fills[index % fills.length]; + const stroke = this.stroke ?? strokes[index % fills.length]; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + tension + }; + } +}; +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "fill", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "stroke", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "lineDash", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "tension", 2); +__decorateClass([ + Property20 +], ChordSeriesLinkProperties.prototype, "itemStyler", 2); +var ChordSeriesNodeProperties = class extends BaseProperties7 { + constructor() { + super(...arguments); + this.spacing = 1; + this.width = 1; + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(fills, strokes, index) { + const { fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const fill = this.fill ?? fills[index % fills.length]; + const stroke = this.stroke ?? strokes[index % fills.length]; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "spacing", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "width", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "fill", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "stroke", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "lineDash", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property20 +], ChordSeriesNodeProperties.prototype, "itemStyler", 2); +var ChordSeriesProperties = class extends SeriesProperties { + constructor() { + super(); + this.idKey = ""; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.sizeKey = void 0; + this.sizeName = void 0; + this.nodes = void 0; + this.fillGradientDefaults = new FillGradientDefaults(); + this.fillPatternDefaults = new FillPatternDefaults(); + this.fillImageDefaults = new FillImageDefaults(); + this.fills = []; + this.strokes = []; + this.label = new ChordSeriesLabelProperties(); + this.link = new ChordSeriesLinkProperties(); + this.node = new ChordSeriesNodeProperties(); + this.tooltip = makeSeriesTooltip8(); + this.highlightStyle.deprecated = false; + } +}; +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "fromKey", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "toKey", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "nodes", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "fillGradientDefaults", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "fillPatternDefaults", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "fillImageDefaults", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "fills", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "strokes", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "link", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "node", 2); +__decorateClass([ + Property20 +], ChordSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/chord/chordSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode6, + createDatumId: createDatumId6, + angleBetween: angleBetween2, + normalizeAngle360: normalizeAngle3604, + isBetweenAngles, + Sector: Sector3, + evaluateBezier, + applyShapeStyle: applyShapeStyle7, + getShapeStyle, + getLabelStyles, + BBox: BBox6, + mergeDefaults: mergeDefaults8 +} = _ModuleSupport68; +var nodeMidAngle = (node) => node.startAngle + angleBetween2(node.startAngle, node.endAngle) / 2; +var ChordSeries = class extends FlowProportionSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode6.NEAREST_NODE, SeriesNodePickMode6.EXACT_SHAPE_MATCH] + }); + this.properties = new ChordSeriesProperties(); + } + isLabelEnabled() { + return (this.properties.labelKey != null || this.nodes == null) && this.properties.label.enabled; + } + linkFactory() { + return new ChordLink(); + } + nodeFactory() { + return new Sector3(); + } + createNodeData() { + const { + id: seriesId, + _nodeDataDependencies: { seriesRectWidth, seriesRectHeight } = { seriesRectWidth: 0, seriesRectHeight: 0 }, + properties + } = this; + const { + fromKey, + toKey, + sizeKey, + labelKey, + label: { spacing: labelSpacing, maxWidth: labelMaxWidth, fontSize }, + node: { width: nodeWidth, spacing: nodeSpacing } + } = properties; + const centerX = seriesRectWidth / 2; + const centerY = seriesRectHeight / 2; + let labelData = []; + const { nodeGraph, links } = this.getNodeGraph( + (node) => ({ + ...node, + centerX, + centerY, + innerRadius: Number.NaN, + outerRadius: Number.NaN, + startAngle: Number.NaN, + endAngle: Number.NaN + }), + (link) => ({ + ...link, + centerX, + centerY, + radius: Number.NaN, + startAngle1: Number.NaN, + endAngle1: Number.NaN, + startAngle2: Number.NaN, + endAngle2: Number.NaN + }), + { includeCircularReferences: true } + ); + let totalSize = 0; + for (const [id, { datum: node, linksBefore, linksAfter }] of nodeGraph.entries()) { + const size = linksBefore.reduce((acc, { link }) => acc + link.size, 0) + linksAfter.reduce((acc, { link }) => acc + link.size, 0); + if (size === 0) { + nodeGraph.delete(id); + } else { + const { label } = properties; + node.size = size; + totalSize += node.size; + const labelText = label.enabled ? this.getLabelText( + node.label, + node.datum, + labelKey, + "label", + [], + label, + { datum: node.datum, value: node.label, fromKey, toKey, sizeKey, size: node.size } + ) : void 0; + node.label = toPlainText2(labelText); + } + } + let labelInset = 0; + if (this.isLabelEnabled()) { + const measurer = cachedTextMeasurer2(this.properties.label); + let maxMeasuredLabelWidth = 0; + for (const { datum: node } of nodeGraph.values()) { + const { id, label } = node; + if (label == null) + continue; + const text = wrapText(label, { + maxWidth: labelMaxWidth, + font: this.properties.label, + textWrap: "never" + }); + const { width } = measurer.measureLines(text); + maxMeasuredLabelWidth = Math.max(width, maxMeasuredLabelWidth); + labelData.push({ + id, + text, + centerX, + centerY, + angle: Number.NaN, + radius: Number.NaN, + size: node.size + }); + } + labelInset = maxMeasuredLabelWidth + labelSpacing; + } + const nodeCount = nodeGraph.size; + let radius = Math.min(seriesRectWidth, seriesRectHeight) / 2 - nodeWidth - labelInset; + let spacingSweep = nodeSpacing / radius; + if (labelInset !== 0 && (nodeCount * spacingSweep >= 1.5 * Math.PI || radius <= 0)) { + labelData = []; + radius = Math.min(seriesRectWidth, seriesRectHeight) / 2 - nodeWidth; + spacingSweep = nodeSpacing / radius; + } + if (nodeCount * spacingSweep >= 2 * Math.PI || radius <= 0) { + Logger5.warnOnce("There was insufficient space to display the Chord Series."); + return; + } + const innerRadius = radius; + const outerRadius = radius + nodeWidth; + const sizeScale = Math.max((2 * Math.PI - nodeCount * spacingSweep) / totalSize, 0); + let nodeAngle = 0; + for (const { datum: node } of nodeGraph.values()) { + node.innerRadius = innerRadius; + node.outerRadius = outerRadius; + node.startAngle = nodeAngle; + node.endAngle = nodeAngle + node.size * sizeScale; + nodeAngle = node.endAngle + spacingSweep; + const midR = (node.innerRadius + node.outerRadius) / 2; + const midAngle = nodeMidAngle(node); + node.midPoint = { + x: node.centerX + midR * Math.cos(midAngle), + y: node.centerY + midR * Math.sin(midAngle) + }; + } + const nodeData = []; + for (const { datum: node, linksBefore, linksAfter } of nodeGraph.values()) { + const midAngle = nodeMidAngle(node); + const combinedLinks = [ + ...linksBefore.map((l) => ({ + link: l.link, + distance: angleBetween2(nodeMidAngle(l.node.datum), midAngle), + after: false + })), + ...linksAfter.map((l) => ({ + link: l.link, + distance: angleBetween2(nodeMidAngle(l.node.datum), midAngle), + after: true + })) + ]; + let linkAngle = node.startAngle; + for (const { link, after } of combinedLinks.toSorted((a, b) => a.distance - b.distance)) { + const linkSweep = link.size * sizeScale; + if (after) { + link.startAngle1 = linkAngle; + link.endAngle1 = linkAngle + linkSweep; + } else { + link.startAngle2 = linkAngle; + link.endAngle2 = linkAngle + linkSweep; + } + linkAngle += link.size * sizeScale; + } + nodeData.push(node); + } + const { tension } = this.properties.link; + for (const link of links) { + link.radius = radius; + const outer = bezierControlPoints({ + radius, + startAngle: link.startAngle1, + endAngle: link.endAngle2, + tension + }); + const inner = bezierControlPoints({ + radius, + startAngle: link.startAngle2, + endAngle: link.endAngle1, + tension + }); + const outerX = evaluateBezier(...outer.x, 0.5); + const outerY = evaluateBezier(...outer.y, 0.5); + const innerX = evaluateBezier(...inner.x, 0.5); + const innerY = evaluateBezier(...inner.y, 0.5); + link.midPoint = { + x: link.centerX + (outerX + innerX) / 2, + y: link.centerY + (outerY + innerY) / 2 + }; + nodeData.push(link); + } + for (const label of labelData) { + const node = nodeGraph.get(label.id)?.datum; + if (node == null) + continue; + label.radius = outerRadius + labelSpacing; + label.angle = normalizeAngle3604(node.startAngle + angleBetween2(node.startAngle, node.endAngle) / 2); + } + labelData.sort((a, b) => a.angle - b.angle); + let minAngle = Infinity; + let maxAngle = -Infinity; + labelData = labelData.filter((label) => { + const labelHeight = calcLineHeight(fontSize); + const da = Math.atan2(labelHeight / 2, label.radius); + const a0 = label.angle - da; + const a1 = label.angle + da; + if (isBetweenAngles(minAngle, a0, a1)) + return false; + if (isBetweenAngles(maxAngle, a0, a1)) + return false; + minAngle = Math.min(a0, minAngle); + maxAngle = Math.max(a1, maxAngle); + return true; + }); + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const params = { + toKey: this.properties.toKey, + fromKey: this.properties.fromKey, + sizeKey: this.properties.sizeKey, + size: Number.NaN + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { size, text, centerX, centerY, radius, angle }) => { + params.size = size; + const style = getLabelStyles(this, void 0, params, this.properties.label, false, activeHighlight); + const { fontStyle, fontWeight, fontSize, fontFamily, color: fill } = style; + label.visible = true; + label.translationX = centerX + radius * Math.cos(angle); + label.translationY = centerY + radius * Math.sin(angle); + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textBaseline = "middle"; + if (Math.cos(angle) >= 0) { + label.textAlign = "left"; + label.rotation = angle; + } else { + label.textAlign = "right"; + label.rotation = angle - Math.PI; + } + label.setBoxing(style); + }); + } + updateNodeSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId6(datum.type, datum.id)); + } + getNodeStyle(nodeDatum, fromNodeDatumIndex, isHighlight) { + const { properties } = this; + const { fills, strokes, fillGradientDefaults: fillGradientDefaults3, fillPatternDefaults: fillPatternDefaults3, fillImageDefaults: fillImageDefaults3 } = properties; + const { itemStyler } = properties.node; + const highlightStyle = this.getHighlightStyle(isHighlight, nodeDatum.datumIndex); + const baseStyle = mergeDefaults8(highlightStyle, properties.node.getStyle(fills, strokes, fromNodeDatumIndex)); + let style = getShapeStyle(baseStyle, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + if (itemStyler != null && nodeDatum.datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId6(nodeDatum.datumIndex.index, "node", isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = getShapeStyle( + mergeDefaults8(overrides, style), + fillGradientDefaults3, + fillPatternDefaults3, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + makeItemStylerParams({ datum, datumIndex, size = 0, label }, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + size, + label, + fill + }; + } + updateNodeNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((sector, datum) => { + const { datumIndex } = datum; + const style = this.getNodeStyle(datum, datumIndex.index, isHighlight); + applyShapeStyle7(sector, style, fillBBox); + sector.centerX = datum.centerX; + sector.centerY = datum.centerY; + sector.innerRadius = datum.innerRadius; + sector.outerRadius = datum.outerRadius; + sector.startAngle = datum.startAngle; + sector.endAngle = datum.endAngle; + sector.inset = sector.strokeWidth / 2; + }); + } + updateLinkSelection(opts) { + return opts.datumSelection.update( + opts.nodeData, + void 0, + (datum) => createDatumId6(datum.type, datum.index, datum.fromNode.id, datum.toNode.id) + ); + } + getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, isHighlight) { + const { id: seriesId, properties } = this; + const { fills, strokes, fillGradientDefaults: fillGradientDefaults3, fillPatternDefaults: fillPatternDefaults3, fillImageDefaults: fillImageDefaults3 } = properties; + const { itemStyler } = properties.link; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults8( + highlightStyle, + properties.link.getStyle(fills, strokes, fromNodeDatumIndex.index) + ); + let style = getShapeStyle(baseStyle, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + if (itemStyler != null && datumIndex != null) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const overrides = this.cachedDatumCallback( + createDatumId6(datumIndex.index, "link", isHighlight ? "highlight" : "node"), + () => { + const highlightState = this.getHighlightStateString( + activeHighlight, + isHighlight, + fromNodeDatumIndex + ); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }); + } + ); + if (overrides) { + style = getShapeStyle( + mergeDefaults8(overrides, style), + fillGradientDefaults3, + fillPatternDefaults3, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + updateLinkNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((link, datum) => { + const fromNodeDatumIndex = datum.fromNode.datumIndex; + const style = this.getLinkStyle(datum, fromNodeDatumIndex, isHighlight); + link.centerX = datum.centerX; + link.centerY = datum.centerY; + link.radius = datum.radius; + link.startAngle1 = datum.startAngle1; + link.endAngle1 = datum.endAngle1; + link.startAngle2 = datum.startAngle2; + link.endAngle2 = datum.endAngle2; + link.tension = style.tension; + applyShapeStyle7(link, style, fillBBox); + }); + } + getShapeFillBBox() { + const width = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const height = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const size = Math.min(width, height); + const x = (width - size) / 2; + const y = (height - size) / 2; + const bbox = new BBox6(x, y, width, height); + return { series: bbox, axis: bbox }; + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + linksProcessedData, + nodesProcessedData, + properties, + ctx: { formatManager } + } = this; + const { fromKey, toKey, sizeKey, sizeName, tooltip } = properties; + const seriesDatum = this.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + if (seriesDatum == null) + return; + const nodeIndex = seriesDatum.type === 0 /* Link */ ? seriesDatum.fromNode.index : seriesDatum.index; + const title = seriesDatum.type === 0 /* Link */ ? `${seriesDatum.fromNode.label} - ${seriesDatum.toNode.label}` : seriesDatum.label; + const datum = datumIndex.type === 0 /* Link */ ? linksProcessedData?.dataSources.get(this.id)?.data[datumIndex.index] : nodesProcessedData?.dataSources.get(this.id)?.data[datumIndex.index]; + const size = seriesDatum.size; + let format; + if (seriesDatum.type === 0 /* Link */) { + const fromNodeDatumIndex = seriesDatum.fromNode.datumIndex; + format = this.getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, false); + } else { + const label = seriesDatum.label; + format = this.getNodeStyle({ datumIndex, datum, size, label }, datumIndex.index, false); + } + const data = []; + if (sizeKey != null) { + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: size, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + domain: [], + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(size) }); + } + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(seriesDatum.type, nodeIndex, format), + data + }, + { + seriesId, + datum, + title, + fromKey, + toKey, + sizeKey, + sizeName, + size, + ...format + } + ); + } + computeFocusBounds(node) { + return node; + } + hasItemStylers() { + return this.properties.node.itemStyler != null || this.properties.link.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +ChordSeries.className = "ChordSeries"; +ChordSeries.type = "chord"; + +// packages/ag-charts-enterprise/src/series/chord/chordSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport69 } from "ag-charts-community"; +import { + constant as constant9, + fillGradientDefaults, + fillImageDefaults, + fillPatternDefaults, + required as required9, + string as string9, + undocumented as undocumented5 +} from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs8, chordSeriesThemeableOptionsDef } = _ModuleSupport69; +var chordSeriesOptionsDef = { + ...chordSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs8, + type: required9(constant9("chord")), + fromKey: required9(string9), + toKey: required9(string9), + sizeKey: string9, + sizeName: string9 +}; +chordSeriesOptionsDef.fillGradientDefaults = undocumented5(fillGradientDefaults); +chordSeriesOptionsDef.fillPatternDefaults = undocumented5(fillPatternDefaults); +chordSeriesOptionsDef.fillImageDefaults = undocumented5(fillImageDefaults); + +// packages/ag-charts-enterprise/src/series/chord/chordModule.ts +var ChordModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + solo: true, + identifier: "chord", + moduleFactory: (ctx) => new ChordSeries(ctx), + themeTemplate: { + series: { + fills: { $palette: "fills" }, + strokes: { $palette: "strokes" }, + // @ts-expect-error undocumented option + fillGradientDefaults: _ModuleSupport70.FILL_GRADIENT_LINEAR_DEFAULTS, + fillPatternDefaults: _ModuleSupport70.FILL_PATTERN_DEFAULTS, + fillImageDefaults: _ModuleSupport70.FILL_IMAGE_DEFAULTS, + highlightStyle: { + series: { + dimOpacity: 0.2 + } + }, + highlight: _ModuleSupport70.singleSeriesHighlightStyle(), + label: { + ..._ModuleSupport70.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 5, + maxWidth: 100 + }, + node: { + spacing: 8, + width: 10, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + link: { + fillOpacity: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + tension: 0.4 + } + }, + legend: { + enabled: false, + toggleSeries: false + } + } +}; +var ChordSeriesModule = { + type: "series", + name: "chord", + chartType: "standalone", + enterprise: true, + options: chordSeriesOptionsDef, + create: (ctx) => new ChordSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelThemes.ts +import { _ModuleSupport as _ModuleSupport71 } from "ag-charts-community"; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE7, CARTESIAN_POSITION: CARTESIAN_POSITION5 }, + ThemeSymbols: { DEFAULT_SHADOW_COLOUR } +} = _ModuleSupport71; +var isHorizontal = { $eq: [{ $path: ["/series/0/direction", void 0] }, "horizontal"] }; +var labelOptions = { + autoRotate: { $path: "/series/0/stageLabel/autoRotate" }, + autoRotateAngle: { $path: "/series/0/stageLabel/autoRotateAngle" }, + avoidCollisions: { $path: ["/series/0/stageLabel/avoidCollisions", true] }, + border: { $path: ["/series/0/stageLabel/border"] }, + color: { $path: ["/series/0/stageLabel/color", { $ref: "textColor" }] }, + cornerRadius: { $path: ["/series/0/stageLabel/cornerRadius"] }, + enabled: { + $if: [ + { $eq: [{ $path: "/series/0/stageLabel/enabled" }, void 0] }, + true, + { $path: "/series/0/stageLabel/enabled" } + ] + }, + fill: { $path: ["/series/0/stageLabel/fill"] }, + fillOpacity: { $path: ["/series/0/stageLabel/fillOpacity"] }, + fontSize: { $path: ["/series/0/stageLabel/fontSize", { $ref: "fontSize" }] }, + fontStyle: { $path: ["/series/0/stageLabel/fontStyle", { $ref: "fontStyle" }] }, + fontWeight: { $path: ["/series/0/stageLabel/fontWeight", { $ref: "fontWeight" }] }, + format: { $path: "/series/0/stageLabel/format" }, + formatter: { $path: "/series/0/stageLabel/formatter" }, + itemStyler: { $path: "/series/0/stageLabel/itemStyler" }, + minSpacing: { $path: "/series/0/stageLabel/minSpacing" }, + padding: { $path: ["/series/0/stageLabel/padding"] }, + rotation: { $path: ["/series/0/stageLabel/rotation", 0] } +}; +var FUNNEL_SERIES_AXES = [ + { + type: { + $if: [isHorizontal, CARTESIAN_AXIS_TYPE7.NUMBER, CARTESIAN_AXIS_TYPE7.CATEGORY] + }, + position: { + $if: [ + isHorizontal, + CARTESIAN_POSITION5.LEFT, + { + $if: [ + { $eq: [{ $path: ["/series/0/stageLabel/placement", void 0] }, "after"] }, + CARTESIAN_POSITION5.RIGHT, + CARTESIAN_POSITION5.LEFT + ] + } + ] + }, + label: { + $if: [isHorizontal, void 0, labelOptions] + } + }, + { + type: { + $if: [isHorizontal, CARTESIAN_AXIS_TYPE7.CATEGORY, CARTESIAN_AXIS_TYPE7.NUMBER] + }, + position: { + $if: [ + isHorizontal, + { + $if: [ + { $eq: [{ $path: ["/series/0/stageLabel/placement", void 0] }, "before"] }, + CARTESIAN_POSITION5.TOP, + CARTESIAN_POSITION5.BOTTOM + ] + }, + CARTESIAN_POSITION5.BOTTOM + ] + }, + label: { + $if: [isHorizontal, labelOptions, void 0] + } + } +]; +var FUNNEL_SERIES_THEME = { + series: { + direction: "vertical", + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + spacingRatio: 0.25, + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + [{ $path: ["/0", void 0, { $palette: "fills" }] }], + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", _ModuleSupport71.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS], + ["pattern", _ModuleSupport71.FILL_PATTERN_SINGLE_DEFAULTS], + ["image", _ModuleSupport71.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + [{ $path: ["/0", void 0, { $palette: "strokes" }] }] + ] + }, + label: { + ..._ModuleSupport71.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + dropOff: { + enabled: true, + fillOpacity: 0.2, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + highlight: _ModuleSupport71.singleSeriesHighlightStyle() + }, + axes: { + [CARTESIAN_AXIS_TYPE7.NUMBER]: { + nice: false, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false + }, + label: { + enabled: false + } + }, + [CARTESIAN_AXIS_TYPE7.CATEGORY]: { + line: { + enabled: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeries.ts +import { + _ModuleSupport as _ModuleSupport76 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/funnel/baseFunnelSeries.ts +import { + _ModuleSupport as _ModuleSupport74 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/funnel/funnelConnector.ts +import { _ModuleSupport as _ModuleSupport72 } from "ag-charts-community"; +var { lineDistanceSquared, BBox: BBox7, Path: Path8, SceneChangeDetection: SceneChangeDetection5 } = _ModuleSupport72; +var delta = 1e-6; +function pointsEq([ax, ay], [bx, by]) { + return Math.abs(ax - bx) <= delta && Math.abs(ay - by) <= delta; +} +var FunnelConnector = class extends Path8 { + constructor() { + super(...arguments); + this.x0 = 0; + this.y0 = 0; + this.x1 = 0; + this.y1 = 0; + this.x2 = 0; + this.y2 = 0; + this.x3 = 0; + this.y3 = 0; + } + get midPoint() { + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + return { + x: (x0 + x1 + x2 + x3) / 4, + y: (y0 + y1 + y2 + y3) / 4 + }; + } + distanceSquared(x, y) { + if (this.containsPoint(x, y)) + return 0; + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + return Math.min( + lineDistanceSquared(x, y, x0, y0, x1, y1, Infinity), + lineDistanceSquared(x, y, x1, y1, x2, y2, Infinity), + lineDistanceSquared(x, y, x2, y2, x3, y3, Infinity), + lineDistanceSquared(x, y, x3, y3, x0, y0, Infinity) + ); + } + computeBBox() { + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + const x = Math.min(x0, x1, x2, x3); + const width = Math.max(x0, x1, x2, x3) - x; + const y = Math.min(y0, y1, y2, y3); + const height = Math.max(y0, y1, y2, y3) - y; + return new BBox7(x, y, width, height); + } + updatePath() { + const { path, x0, y0, x1, y1, x2, y2, x3, y3 } = this; + const points = [ + [x0, y0], + [x1, y1], + [x2, y2], + [x3, y3] + ]; + path.clear(); + let start; + let current; + for (const p of points) { + if (start != null && pointsEq(start, p) || current != null && pointsEq(current, p)) { + continue; + } + const [x, y] = p; + if (start == null) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + start ?? (start = p); + current = p; + } + path.closePath(); + } +}; +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "x0", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "y0", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "x1", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "y1", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "x2", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "y2", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "x3", 2); +__decorateClass([ + SceneChangeDetection5() +], FunnelConnector.prototype, "y3", 2); + +// packages/ag-charts-enterprise/src/series/funnel/funnelUtil.ts +import { _ModuleSupport as _ModuleSupport73 } from "ag-charts-community"; +var { NODE_UPDATE_STATE_TO_PHASE_MAPPING } = _ModuleSupport73; +function connectorStartingPosition(datum, _prevDatum, isVertical, _mode) { + const { x0, y0, x1, y1, x2, y2, x3, y3, opacity } = datum; + if (isVertical) { + return { + x0: (x0 + x3) / 2, + y0: (y0 + y3) / 2, + x1: (x1 + x2) / 2, + y1: (y1 + y2) / 2, + x2: (x1 + x2) / 2, + y2: (y1 + y2) / 2, + x3: (x0 + x3) / 2, + y3: (y0 + y3) / 2, + opacity + }; + } else { + return { + x0: (x0 + x1) / 2, + y0: (y0 + y1) / 2, + x1: (x0 + x1) / 2, + y1: (y0 + y1) / 2, + x2: (x2 + x3) / 2, + y2: (y2 + y3) / 2, + x3: (x2 + x3) / 2, + y3: (y2 + y3) / 2, + opacity + }; + } +} +function prepareConnectorAnimationFunctions(isVertical, mode) { + const isRemoved = (datum) => datum == null; + const fromFn = (connector, datum, status) => { + if (status === "updated" && isRemoved(datum)) { + status = "removed"; + } else if (status === "updated" && isRemoved(connector.previousDatum)) { + status = "added"; + } + let source; + if (status === "added" && connector.previousDatum == null && mode === "fade") { + source = { ...resetConnectorSelectionsFn(connector, datum), opacity: 0 }; + } else if (status === "unknown" || status === "added") { + source = connectorStartingPosition(datum, connector.previousDatum, isVertical, mode); + } else { + source = { + x0: connector.x0, + y0: connector.y0, + x1: connector.x1, + y1: connector.y1, + x2: connector.x2, + y2: connector.y2, + x3: connector.x3, + y3: connector.y3, + opacity: connector.opacity + }; + } + const phase = NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { ...source, phase }; + }; + const toFn = (connector, datum, status) => { + let source; + if (status === "removed" && connector.datum == null && mode === "fade") { + source = { ...resetConnectorSelectionsFn(connector, datum), opacity: 0 }; + } else if (status === "removed" || isRemoved(datum)) { + source = connectorStartingPosition(datum, connector.previousDatum, isVertical, mode); + } else { + source = resetConnectorSelectionsFn(connector, datum); + } + return source; + }; + return { fromFn, toFn }; +} +function resetConnectorSelectionsFn(_node, datum) { + const { x0, y0, x1, y1, x2, y2, x3, y3, opacity } = datum; + return { x0, y0, x1, y1, x2, y2, x3, y3, opacity }; +} + +// packages/ag-charts-enterprise/src/series/funnel/baseFunnelSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode7, + SeriesZIndexMap, + valueProperty: valueProperty8, + keyProperty: keyProperty7, + ChartAxisDirection: ChartAxisDirection13, + updateLabelNode: updateLabelNode5, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL4, + LARGEST_KEY_INTERVAL: LARGEST_KEY_INTERVAL2, + diff: diff5, + fixNumericExtent: fixNumericExtent6, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation4, + resetMotion: resetMotion2, + resetLabelFn: resetLabelFn4, + animationValidation: animationValidation6, + computeBarFocusBounds: computeBarFocusBounds6, + ContinuousScale: ContinuousScale4, + Group: Group6, + Selection: Selection4, + PointerEvents: PointerEvents4, + motion: motion4, + checkCrisp: checkCrisp3, + createDatumId: createDatumId7, + applyShapeStyle: applyShapeStyle8 +} = _ModuleSupport74; +var FunnelSeriesNodeEvent = class extends _ModuleSupport74.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.stageKey; + this.yKey = series.properties.valueKey; + } +}; +var BaseFunnelSeries = class extends _ModuleSupport74.AbstractBarSeries { + constructor({ + moduleCtx, + animationResetFns + }) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode7.AXIS_ALIGNED, SeriesNodePickMode7.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["stageKey"], + y: ["valueKey"] + }, + propertyNames: { + x: [], + y: [] + }, + categoryKey: "xValue", + datumSelectionGarbageCollection: false, + animationResetFns: { + datum: animationResetFns.datum, + label: resetLabelFn4 + } + }); + // @ts-expect-error xKey/yKey renamed + this.NodeEvent = FunnelSeriesNodeEvent; + this.connectorNodeGroup = this.contentGroup.appendChild( + new Group6({ + name: `${this.id}-series-connectorNodes`, + zIndex: SeriesZIndexMap.BACKGROUND + }) + ); + this.connectorSelection = Selection4.select( + this.connectorNodeGroup, + () => this.connectionFactory() + ); + this.connectorNodeGroup.pointerEvents = PointerEvents4.None; + } + get pickModeAxis() { + return "main-category"; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.connectorNodeGroup.zIndex = [SeriesZIndexMap.BACKGROUND, zIndex]; + return true; + } + isVertical() { + return !super.isVertical(); + } + connectionFactory() { + return new FunnelConnector(); + } + async processData(dataController) { + const { stageKey, valueKey } = this.properties; + const { visible, id: seriesId } = this; + const validation = (_value, _datum, index) => visible && this.ctx.legendManager.getItemEnabled({ seriesId, itemId: index }); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + if (this.processedData) { + extraProps.push(diff5(this.id, this.processedData)); + } + extraProps.push(animationValidation6()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const { processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty7(stageKey, xScaleType, { id: "xValue" }), + valueProperty8(valueKey, yScaleType, { id: `yValue`, ...visibleProps, validation, invalidValue: 0 }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL4, LARGEST_KEY_INTERVAL2] : [], + ...extraProps + ], + groupByKeys: false + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { + processedData, + dataModel, + id: seriesId, + ctx: { legendManager } + } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys] + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + if (!this.hasData) + return []; + return keys.filter((_key, index) => legendManager.getItemEnabled({ seriesId, itemId: index })); + } + return this.padBandExtent(keys); + } else { + const yExtent = this.domainForClippedRange(direction, ["yValue"], "xValue"); + const maxExtent = Math.max(...yExtent); + const fixedYExtent = [-maxExtent, maxExtent]; + return fixNumericExtent6(fixedYExtent); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { + hasData, + data, + dataModel, + groupScale, + processedData, + id: seriesId, + ctx: { legendManager } + } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(hasData && data && xAxis && yAxis && dataModel && processedData?.type === "ungrouped")) { + return; + } + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection13.X; + const { stageKey, valueKey } = this.properties; + const itemId = `${valueKey}`; + const context = { + itemId, + nodeData: [], + labelData: [], + connectorData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible + }; + const isVisible = this.visible; + if (!isVisible) + return context; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale4.is(xScale) ? barWidth * -0.5 : 0; + const crisp = checkCrisp3( + xAxis?.scale, + xAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + let previousConnection; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const visible = isVisible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + const xDatum = xValues[datumIndex]; + if (xDatum == null) + continue; + const x = Math.round(xScale.convert(xDatum)) + groupScale.convert(String(groupIndex)) + barOffset; + const yDatum = yValues[datumIndex]; + const yNegative = Math.round(yScale.convert(-yDatum)); + const yPositive = Math.round(yScale.convert(yDatum)); + const style = this.getItemStyle({ datum, datumIndex }, false); + const barHeight = Math.max(style.strokeWidth ?? 0, Math.abs(yPositive - yNegative)); + const rect = { + x: barAlongX ? Math.min(yPositive, yNegative) : x, + y: barAlongX ? x : Math.min(yPositive, yNegative), + width: barAlongX ? barHeight : barWidth, + height: barAlongX ? barWidth : barHeight + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const labelData = this.createLabelData({ + datumIndex, + rect, + barAlongX, + yDatum, + datum, + visible + }); + const nodeDatum = { + index: datumIndex, + series: this, + itemId, + datum, + datumIndex, + xValue: xDatum, + yValue: yDatum, + xKey: stageKey, + yKey: valueKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + label: labelData, + visible + }; + context.nodeData.push(nodeDatum); + if (labelData != null) { + context.labelData.push(labelData); + } + if (previousConnection != null) { + const prevRect = previousConnection.rect; + const startNodeDatum = previousConnection.nodeDatum; + const startDatumIndex = previousConnection.datumIndex; + if (barAlongX) { + context.connectorData.push({ + datum: startNodeDatum, + datumIndex: startDatumIndex, + x0: prevRect.x, + y0: prevRect.y + prevRect.height, + x1: prevRect.x + prevRect.width, + y1: prevRect.y + prevRect.height, + x2: rect.x + rect.width, + y2: rect.y, + x3: rect.x, + y3: rect.y, + opacity: 1 + }); + } else { + context.connectorData.push({ + datum: startNodeDatum, + datumIndex: startDatumIndex, + x0: prevRect.x + prevRect.width, + y0: prevRect.y, + x1: rect.x, + y1: rect.y, + x2: rect.x, + y2: rect.y + rect.height, + x3: prevRect.x + prevRect.width, + y3: prevRect.y + prevRect.height, + opacity: 1 + }); + } + } + if (visible) { + previousConnection = { + itemId, + rect, + nodeDatum, + datumIndex + }; + } + } + return context; + } + updateNodes(seriesHighlighted, nodeRefresh) { + super.updateNodes(seriesHighlighted, nodeRefresh); + const { connectorSelection } = this; + const connectorData = this.contextNodeData?.connectorData ?? []; + this.connectorSelection = this.updateConnectorSelection({ connectorSelection, connectorData }); + this.updateConnectorNodes({ connectorSelection }); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data, void 0, (datum) => this.getDatumId(datum)); + } + updateConnectorSelection(opts) { + const { connectorData, connectorSelection } = opts; + return connectorSelection.update( + this.connectorEnabled() ? connectorData : [], + void 0, + (connector) => this.getDatumId(connector.datum) + ); + } + updateConnectorNodes(opts) { + const fillBBox = this.getShapeFillBBox(); + opts.connectorSelection.each((connector, datum) => { + const { fill, fillOpacity, stroke, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.connectorStyle(datum.datumIndex); + connector.setProperties(resetConnectorSelectionsFn(connector, datum)); + applyShapeStyle8( + connector, + { + fill, + stroke, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }, + fillBBox + ); + }); + } + updateLabelSelection(opts) { + const labelData = this.properties.label.enabled ? opts.labelData : []; + return opts.labelSelection.update(labelData, (text) => { + text.pointerEvents = PointerEvents4.None; + }); + } + updateLabelNodes(opts) { + const params = { + stageKey: this.properties.stageKey, + valueKey: this.properties.valueKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + updateLabelNode5(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { stageKey, valueKey, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, "xValue", processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(datumIndex), + data: [ + { + label: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, stageKey, legendItemName), + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, valueKey, legendItemName) + } + ] + }, + { seriesId, datum, title: stageKey, stageKey, valueKey, ...this.tooltipStyle(datum, datumIndex) } + ); + } + resetAllAnimation(data) { + super.resetAllAnimation(data); + resetMotion2([this.connectorSelection], resetConnectorSelectionsFn); + } + animateEmptyUpdateReady({ labelSelection }) { + const { connectorSelection } = this; + const isVertical = this.isVertical(); + const mode = "normal"; + const connectorFns = prepareConnectorAnimationFunctions(isVertical, mode); + motion4.fromToMotion(this.id, "connectors", this.ctx.animationManager, [connectorSelection], connectorFns); + seriesLabelFadeInAnimation4(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const { labelSelection: labelSelections } = data; + this.ctx.animationManager.stopByAnimationGroupId(this.id); + seriesLabelFadeInAnimation4(this, "labels", this.ctx.animationManager, labelSelections); + } + getDatumId(datum) { + return createDatumId7(datum.xValue); + } + isLabelEnabled() { + return this.properties.label.enabled; + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds6(this, this.contextNodeData?.nodeData[datumIndex]); + } + legendItemSymbol(datumIndex) { + const { strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset, fill, stroke } = this.properties.getStyle(datumIndex); + return { + marker: { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id: seriesId, + processedData, + dataModel, + ctx: { legendManager }, + visible + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { showInLegend } = this.properties; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + return (processedData.dataSources.get(this.id)?.data ?? []).map((datum, datumIndex) => { + const stageValue = xValues[datumIndex]; + if (stageValue == null) + return; + return { + legendType: "category", + id: seriesId, + datum, + itemId: datumIndex, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { text: String(stageValue) }, + symbol: this.legendItemSymbol(datumIndex), + skipAnimations: true, + hideInLegend: !showInLegend + }; + }).filter((datum) => datum != null); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelProperties.ts +import { _ModuleSupport as _ModuleSupport75 } from "ag-charts-community"; +var { Label: Label5, AbstractBarSeriesProperties: AbstractBarSeriesProperties5, makeSeriesTooltip: makeSeriesTooltip9, AxisLabel, Property: Property21 } = _ModuleSupport75; +var ConeFunnelSeriesLabel = class extends Label5 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property21 +], ConeFunnelSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property21 +], ConeFunnelSeriesLabel.prototype, "spacing", 2); +var ConeFunnelSeriesStageLabel = class extends AxisLabel { +}; +__decorateClass([ + Property21 +], ConeFunnelSeriesStageLabel.prototype, "placement", 2); +var ConeFunnelProperties = class extends AbstractBarSeriesProperties5 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new ConeFunnelSeriesLabel(); + this.stageLabel = new ConeFunnelSeriesStageLabel(); + this.tooltip = makeSeriesTooltip9(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index], + fillOpacity, + stroke: strokes[index], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "stageKey", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "valueKey", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "fills", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "strokes", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "lineDash", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "label", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property21 +], ConeFunnelProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelUtil.ts +function resetLineSelectionsFn(_node, { x, y, width, height, opacity }) { + return { x1: x, y1: y, x2: x + width, y2: y + height, opacity: opacity ?? 1 }; +} + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeries.ts +var { Line: Line3, ChartAxisDirection: ChartAxisDirection14 } = _ModuleSupport76; +var ConeFunnelSeries = class extends BaseFunnelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + animationResetFns: { + datum: resetLineSelectionsFn + } + }); + this.properties = new ConeFunnelProperties(); + } + get hasData() { + const { + id: seriesId, + ctx: { legendManager } + } = this; + const visibleItems = this.data?.data.reduce( + (accum, _, datumIndex) => accum + (legendManager.getItemEnabled({ seriesId, itemId: datumIndex }) ? 1 : 0), + 0 + ); + return visibleItems != null && visibleItems > 1; + } + getBandScalePadding() { + return { inner: 1, outer: 0 }; + } + connectorEnabled() { + return true; + } + getItemStyle({ datumIndex }, _isHighlight) { + return this.properties.getStyle(datumIndex); + } + connectorStyle(index) { + return this.properties.getStyle(index); + } + nodeFactory() { + return new Line3(); + } + createLabelData({ + datumIndex, + rect, + barAlongX, + yDatum, + datum, + visible + }) { + const { stageKey, valueKey, label } = this.properties; + const { spacing, placement } = label; + if (!label.enabled) + return; + let x; + let y; + let textAlign; + let textBaseline; + if (barAlongX) { + x = rect.x + rect.width / 2; + textAlign = "center"; + switch (placement) { + case "before": + y = rect.y - spacing; + textBaseline = "bottom"; + break; + case "after": + y = rect.y + rect.height + spacing; + textBaseline = "top"; + break; + default: + y = rect.y + rect.height / 2; + textBaseline = "middle"; + } + } else { + y = rect.y + rect.height / 2; + textBaseline = "middle"; + switch (placement) { + case "before": + x = rect.x - spacing; + textAlign = "right"; + break; + case "after": + x = rect.x + rect.width + spacing; + textAlign = "left"; + break; + default: + x = rect.x + rect.width / 2; + textAlign = "center"; + } + } + const yDomain = this.getSeriesDomain(ChartAxisDirection14.Y); + const text = this.getLabelText( + yDatum, + datum, + valueKey, + "y", + yDomain, + label, + { itemId: valueKey, value: yDatum, datum, stageKey, valueKey } + ); + return { + x, + y, + textAlign, + textBaseline, + text, + itemId: valueKey, + datum, + datumIndex, + series: this, + visible + }; + } + updateDatumNodes(opts) { + const highlightStyle = this.getHighlightStyle(opts.isHighlight); + opts.datumSelection.each((line, datum) => { + line.setProperties(resetLineSelectionsFn(line, datum)); + line.stroke = highlightStyle?.stroke; + line.strokeWidth = highlightStyle?.strokeWidth ?? 0; + line.strokeOpacity = highlightStyle?.strokeOpacity ?? 1; + line.lineDash = highlightStyle?.lineDash; + line.lineDashOffset = highlightStyle?.lineDashOffset ?? 0; + line.opacity = highlightStyle?.opacity ?? 1; + }); + } + tooltipStyle(_datum, datumIndex) { + const { fill, stroke, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties.getStyle(datumIndex); + return { + fill, + fillOpacity, + stroke, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +ConeFunnelSeries.className = "ConeFunnelSeries"; +ConeFunnelSeries.type = "cone-funnel"; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport77 } from "ag-charts-community"; +import { constant as constant10, required as required10, string as string10 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs9, coneFunnelSeriesThemeableOptionsDef, without: without3 } = _ModuleSupport77; +var coneFunnelSeriesOptionsDef = { + ...without3(commonSeriesOptionsDefs9, ["showInLegend"]), + ...coneFunnelSeriesThemeableOptionsDef, + type: required10(constant10("cone-funnel")), + stageKey: required10(string10), + valueKey: required10(string10) +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelThemes.ts +import { _ModuleSupport as _ModuleSupport78 } from "ag-charts-community"; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE8 } +} = _ModuleSupport78; +var CONE_FUNNEL_SERIES_THEME = { + series: { + direction: "vertical", + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "secondSequentialColors" }, + _ModuleSupport78.SAFE_RANGE2_OPERATION + ] + }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", _ModuleSupport78.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS], + ["pattern", _ModuleSupport78.FILL_PATTERN_SINGLE_DEFAULTS], + ["image", _ModuleSupport78.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "secondSequentialColors" }, + _ModuleSupport78.SAFE_RANGE2_OPERATION + ] + } + ] + }, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + label: { + ..._ModuleSupport78.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + placement: "before", + spacing: 4 + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: _ModuleSupport78.singleSeriesHighlightStyle(false) + }, + seriesArea: { + padding: { + top: 20, + bottom: 20 + } + }, + axes: { + [CARTESIAN_AXIS_TYPE8.NUMBER]: { + nice: false, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false + }, + label: { + enabled: false + } + }, + [CARTESIAN_AXIS_TYPE8.CATEGORY]: { + line: { + enabled: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelModule.ts +var ConeFunnelSeriesModule = { + type: "series", + name: "cone-funnel", + chartType: "cartesian", + enterprise: true, + options: coneFunnelSeriesOptionsDef, + create: (ctx) => new ConeFunnelSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeries.ts +import { + _ModuleSupport as _ModuleSupport80 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/funnel/funnelProperties.ts +import { _ModuleSupport as _ModuleSupport79 } from "ag-charts-community"; +var { Label: Label6, DropShadow: DropShadow4, AbstractBarSeriesProperties: AbstractBarSeriesProperties6, BaseProperties: BaseProperties8, makeSeriesTooltip: makeSeriesTooltip10, AxisLabel: AxisLabel2, Property: Property22 } = _ModuleSupport79; +var FunnelSeriesLabel = class extends Label6 { +}; +var FunnelSeriesStageLabel = class extends AxisLabel2 { +}; +__decorateClass([ + Property22 +], FunnelSeriesStageLabel.prototype, "placement", 2); +var FunnelDropOff = class extends BaseProperties8 { + constructor() { + super(...arguments); + this.enabled = true; + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle() { + const { fill, stroke, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "enabled", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "fill", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "fillOpacity", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "stroke", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "strokeWidth", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "strokeOpacity", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "lineDash", 2); +__decorateClass([ + Property22 +], FunnelDropOff.prototype, "lineDashOffset", 2); +var FunnelProperties = class extends AbstractBarSeriesProperties6 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.spacingRatio = 0; + this.dropOff = new FunnelDropOff(); + this.shadow = new DropShadow4().set({ enabled: false }); + this.label = new FunnelSeriesLabel(); + this.stageLabel = new FunnelSeriesStageLabel(); + this.tooltip = makeSeriesTooltip10(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index], + fillOpacity, + stroke: strokes[index], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property22 +], FunnelProperties.prototype, "stageKey", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "valueKey", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "fills", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "strokes", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "lineDash", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "spacingRatio", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "dropOff", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "shadow", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "label", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property22 +], FunnelProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeries.ts +var { + ChartAxisDirection: ChartAxisDirection15, + resetBarSelectionsFn: resetBarSelectionsFn3, + prepareBarAnimationFunctions: prepareBarAnimationFunctions3, + midpointStartingBarPosition: midpointStartingBarPosition2, + createDatumId: createDatumId8, + Rect: Rect4, + motion: motion5, + applyShapeStyle: applyShapeStyle9, + mergeDefaults: mergeDefaults9 +} = _ModuleSupport80; +var FunnelSeries = class extends BaseFunnelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + animationResetFns: { + datum: resetBarSelectionsFn3 + } + }); + this.properties = new FunnelProperties(); + } + getBandScalePadding() { + return { inner: this.properties.spacingRatio, outer: 0 }; + } + connectorEnabled() { + return this.properties.dropOff.enabled; + } + connectorStyle(index) { + return mergeDefaults9(this.properties.dropOff.getStyle(), this.properties.getStyle(index)); + } + nodeFactory() { + return new Rect4(); + } + createLabelData({ + datumIndex, + rect, + yDatum, + datum, + visible + }) { + const { valueKey, stageKey, label } = this.properties; + if (!label.enabled) + return; + const yDomain = this.getSeriesDomain(ChartAxisDirection15.Y); + const text = this.getLabelText( + yDatum, + datum, + valueKey, + "y", + yDomain, + label, + { itemId: valueKey, value: yDatum, datum, stageKey, valueKey } + ); + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2, + textAlign: "center", + textBaseline: "middle", + text, + itemId: stageKey, + datum, + datumIndex, + series: this, + visible + }; + } + getItemStyle({ datum, datumIndex }, isHighlight) { + const { id: seriesId, properties } = this; + const { stageKey, valueKey, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults9(highlightStyle, properties.getStyle(datumIndex)); + let style = baseStyle; + if (itemStyler != null) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const overrides = this.cachedDatumCallback( + createDatumId8(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState: highlightStateString, + stageKey, + valueKey, + ...style + }); + } + ); + if (overrides) { + style = mergeDefaults9(overrides, style); + } + } + return style; + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { shadow } = this.properties; + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection15.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = this.getItemStyle(datum, isHighlight); + applyShapeStyle9(rect, style, fillBBox); + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + rect.fillShadow = shadow; + }); + } + tooltipStyle(datum, datumIndex) { + return this.getItemStyle({ datum, datumIndex }, false); + } + animateEmptyUpdateReady(params) { + super.animateEmptyUpdateReady(params); + const { datumSelection } = params; + const isVertical = this.isVertical(); + const mode = "normal"; + const barFns = prepareBarAnimationFunctions3(midpointStartingBarPosition2(isVertical, mode), "unknown"); + motion5.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], barFns); + } + animateWaitingUpdateReady(data) { + super.animateWaitingUpdateReady(data); + const { datumSelection: datumSelections } = data; + const { processedData } = this; + const dataDiff = processedData?.reduced?.diff?.[this.id]; + const fns = prepareBarAnimationFunctions3(midpointStartingBarPosition2(this.isVertical(), "fade"), "added"); + motion5.fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [datumSelections], + fns, + (_, datum) => datum.xValue, + dataDiff + ); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +FunnelSeries.className = "FunnelSeries"; +FunnelSeries.type = "funnel"; + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport81 } from "ag-charts-community"; +import { constant as constant11, required as required11, string as string11 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs10, funnelSeriesThemeableOptionsDef, without: without4 } = _ModuleSupport81; +var funnelSeriesOptionsDef = { + ...funnelSeriesThemeableOptionsDef, + ...without4(commonSeriesOptionsDefs10, ["showInLegend"]), + type: required11(constant11("funnel")), + stageKey: required11(string11), + valueKey: required11(string11) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelModule.ts +var FunnelSeriesModule = { + type: "series", + name: "funnel", + chartType: "cartesian", + enterprise: true, + options: funnelSeriesOptionsDef, + create: (ctx) => new FunnelSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeModule.ts +import { _ModuleSupport as _ModuleSupport87 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeries.ts +import { + _ModuleSupport as _ModuleSupport86 +} from "ag-charts-community"; +import { cachedTextMeasurer as cachedTextMeasurer4, isArray as isArray3, measureTextSegments as measureTextSegments2 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/utils/formatter.ts +import { _ModuleSupport as _ModuleSupport82 } from "ag-charts-community"; +function formatWithContext(ctx, formatter, params) { + return _ModuleSupport82.callWithContext(ctx.chartService, formatter, params); +} + +// packages/ag-charts-enterprise/src/series/gauge-util/datumUnion.ts +var DatumUnion = class { + *[Symbol.iterator]() { + const { node, datum } = this; + if (node && datum) + yield { node, datum }; + } + nodes() { + return this.node ? [this.node] : []; + } + update(datumSelection, group, ctor, nodeUpdater) { + const nodes = datumSelection.nodes(); + if (nodes.length === 0) { + this.node?.remove(); + this.node = void 0; + } else { + if (this.node === void 0) { + this.node = new ctor(); + this.node.fillOpacity = 0; + this.node.strokeOpacity = 0; + group.appendChild(this.node); + } + const first = nodes[0]; + const last = nodes.toReversed().find((n) => n.datum.datum.value > n.datum.datum.segmentStart) ?? nodes.at(-1); + this.node.datum = this.datum = first.datum; + nodeUpdater(this.node, first, last); + } + } +}; + +// packages/ag-charts-enterprise/src/series/gauge-util/label.ts +import { isArray } from "ag-charts-core"; +var fadeInFns = { + fromFn: () => ({ opacity: 0, phase: "initial" }), + toFn: () => ({ opacity: 1 }) +}; +function formatLabel(value, scale) { + if (value == null) + return ""; + const { min, max } = scale; + const minLog10 = min === 0 ? 0 : Math.ceil(Math.log10(Math.abs(min))); + const maxLog10 = max === 0 ? 0 : Math.ceil(Math.log10(Math.abs(max))); + const dp = Math.max(2 - Math.max(minLog10, maxLog10), 0); + return value.toFixed(dp); +} +function getLabelText(seriesId, ctx, datum, valueOverride) { + if (datum.text != null) + return datum.text; + const value = valueOverride ?? datum.value; + let labelFormat; + if (datum?.formatter != null) { + labelFormat = formatWithContext(ctx, datum.formatter, { seriesId, datum: void 0, value }); + } + return labelFormat == null || isArray(labelFormat) ? labelFormat : String(labelFormat); +} + +// packages/ag-charts-enterprise/src/series/gauge-util/lineMarker.ts +function lineMarker({ path, x, y, size }) { + path.moveTo(x, y - size / 2); + path.lineTo(x, y + size / 2); +} + +// packages/ag-charts-enterprise/src/series/gauge-util/pick.ts +import { clamp as clamp2, iterate } from "ag-charts-core"; +function pickGaugeNearestDatum(self, point) { + const it = iterate(self.datumUnion.nodes(), self.targetSelection.nodes()); + return self.pickNodeNearestDistantObject(point, it); +} +function pickGaugeFocus(self, opts) { + const others = [ + { data: self.contextNodeData?.nodeData, selection: self.datumUnion }, + { data: self.contextNodeData?.targetData, selection: self.targetSelection } + ].filter((v) => v.data && v.data.length > 0); + const otherIndex = clamp2(0, opts.otherIndex + opts.otherIndexDelta, others.length - 1); + if (others.length === 0) + return; + const { data, selection } = others[otherIndex]; + if (data == null || data.length === 0) + return; + const datumIndex = clamp2(0, opts.datumIndex, data.length - 1); + const datum = data[datumIndex]; + for (const node of selection) { + if (node.datum === datum) { + const bounds = node.node; + return { bounds, clipFocusBox: true, datum, datumIndex, otherIndex }; + } + } +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport84 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/gauge-util/segmentation.ts +import { _ModuleSupport as _ModuleSupport83 } from "ag-charts-community"; +import { Logger as Logger6 } from "ag-charts-core"; +var { BaseProperties: BaseProperties9, Property: Property23 } = _ModuleSupport83; +var GaugeSegmentationIntervalProperties = class extends BaseProperties9 { + getSegments(scale, maxTicks) { + const { values, step, count } = this; + const d0 = Math.min(...scale.domain); + const d1 = Math.max(...scale.domain); + let ticks; + if (values != null) { + const segments = values.filter((v) => v > d0 && v < d1).sort((a, b) => a - b); + ticks = [d0, ...segments, d1]; + } else if (step != null) { + const segments = []; + for (let i = d0; i < d1; i += step) { + segments.push(i); + } + segments.push(d1); + ticks = segments; + } else if (count == null) { + const segments = scale.ticks({ + nice: true, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.filter((v) => v > d0 && v < d1); + ticks = segments == null ? void 0 : [d0, ...segments, d1]; + } else { + const segments = count + 1; + ticks = Array.from({ length: segments + 1 }, (_, i) => i / segments * (d1 - d0) + d0); + } + if (ticks != null && ticks.length > maxTicks) { + Logger6.warnOnce( + `the configured segmentation results in more than 1 item per pixel, ignoring. Supply a segmentation configuration that results in larger segments or omit this configuration` + ); + ticks = void 0; + } + ticks ?? (ticks = [d0, d1]); + return ticks; + } +}; +__decorateClass([ + Property23 +], GaugeSegmentationIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property23 +], GaugeSegmentationIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property23 +], GaugeSegmentationIntervalProperties.prototype, "count", 2); +var GaugeSegmentationProperties = class extends BaseProperties9 { + constructor() { + super(...arguments); + this.enabled = false; + this.interval = new GaugeSegmentationIntervalProperties(); + this.spacing = 0; + } +}; +__decorateClass([ + Property23 +], GaugeSegmentationProperties.prototype, "enabled", 2); +__decorateClass([ + Property23 +], GaugeSegmentationProperties.prototype, "interval", 2); +__decorateClass([ + Property23 +], GaugeSegmentationProperties.prototype, "spacing", 2); + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeriesProperties.ts +var { + BaseProperties: BaseProperties10, + makeSeriesTooltip: makeSeriesTooltip11, + SeriesProperties: SeriesProperties2, + PropertiesArray: PropertiesArray2, + Property: Property24, + Label: Label7, + AxisLabel: AxisLabel3, + getColorStops +} = _ModuleSupport84; +var LinearGaugeDefaultTargetLabelProperties = class extends Label7 { +}; +__decorateClass([ + Property24 +], LinearGaugeDefaultTargetLabelProperties.prototype, "spacing", 2); +var LinearGaugeTargetProperties = class extends BaseProperties10 { + constructor() { + super(...arguments); + this.value = 0; + this.label = new LinearGaugeDefaultTargetLabelProperties(); + } + getStyle(defaultTarget) { + const { + fill = defaultTarget.fill ?? "black", + fillOpacity = defaultTarget.fillOpacity ?? 1, + stroke = defaultTarget.stroke ?? "black", + strokeWidth = defaultTarget.strokeWidth ?? 0, + strokeOpacity = defaultTarget.strokeOpacity ?? 1, + lineDash = defaultTarget.lineDash ?? [0], + lineDashOffset = defaultTarget.lineDashOffset ?? 0 + } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "text", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "value", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "shape", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "placement", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "spacing", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "size", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "rotation", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "fill", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "stroke", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "lineDash", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property24 +], LinearGaugeTargetProperties.prototype, "label", 2); +var LinearGaugeBarProperties = class extends BaseProperties10 { + constructor() { + super(...arguments); + this.enabled = true; + this.thicknessRatio = 1; + this.fills = new PropertiesArray2(_ModuleSupport84.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(defaultColorRange, horizontal, scale) { + const { fill, fills, fillMode, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const barFill = fill ?? createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal); + return { + fill: barFill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "enabled", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "thickness", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "thicknessRatio", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "fills", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "fillMode", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property24 +], LinearGaugeBarProperties.prototype, "lineDashOffset", 2); +var LinearGaugeScaleIntervalProperties = class extends BaseProperties10 { + constructor() { + super(...arguments); + this.values = void 0; + this.step = void 0; + this.minSpacing = 0; + this.maxSpacing = 1e3; + } +}; +__decorateClass([ + Property24 +], LinearGaugeScaleIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleIntervalProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleIntervalProperties.prototype, "maxSpacing", 2); +var LinearGaugeScaleLabelProperties = class extends AxisLabel3 { + constructor() { + super(...arguments); + this.placement = void 0; + } +}; +__decorateClass([ + Property24 +], LinearGaugeScaleLabelProperties.prototype, "placement", 2); +var LinearGaugeScaleProperties = class extends BaseProperties10 { + constructor() { + super(...arguments); + this.min = 0; + this.max = 1; + this.fills = new PropertiesArray2(_ModuleSupport84.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.defaultFill = "black"; + this.interval = new LinearGaugeScaleIntervalProperties(); + this.label = new LinearGaugeScaleLabelProperties(); + } + getStyle(barEnabled, defaultColorRange, horizontal, scale) { + const { + fill, + fills, + defaultFill, + fillMode, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const scaleFill = fill ?? (barEnabled && fills.length === 0 ? defaultFill : void 0) ?? createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal); + return { + fill: scaleFill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "min", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "max", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "fills", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "fillMode", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "fill", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "stroke", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "defaultFill", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "interval", 2); +__decorateClass([ + Property24 +], LinearGaugeScaleProperties.prototype, "label", 2); +var LinearGaugeLabelProperties = class extends AutoSizedLabel { + constructor() { + super(...arguments); + this.placement = "inside-center"; + this.avoidCollisions = true; + } +}; +__decorateClass([ + Property24 +], LinearGaugeLabelProperties.prototype, "text", 2); +__decorateClass([ + Property24 +], LinearGaugeLabelProperties.prototype, "placement", 2); +__decorateClass([ + Property24 +], LinearGaugeLabelProperties.prototype, "avoidCollisions", 2); +var LinearGaugeSeriesProperties = class extends SeriesProperties2 { + constructor() { + super(...arguments); + this.value = 0; + this.segmentation = new GaugeSegmentationProperties(); + this.defaultColorRange = []; + this.targets = new PropertiesArray2(LinearGaugeTargetProperties); + this.defaultTarget = new LinearGaugeTargetProperties(); + this.defaultScale = new LinearGaugeScaleProperties(); + this.direction = "vertical"; + this.thickness = 1; + this.cornerRadius = 0; + this.cornerMode = "container"; + this.margin = 0; + this.scale = new LinearGaugeScaleProperties(); + this.bar = new LinearGaugeBarProperties(); + this.label = new LinearGaugeLabelProperties(); + this.tooltip = makeSeriesTooltip11(); + } +}; +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "value", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "segmentation", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "targets", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "defaultTarget", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "defaultScale", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "direction", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "thickness", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "cornerMode", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "margin", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "scale", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "bar", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property24 +], LinearGaugeSeriesProperties.prototype, "tooltip", 2); +function createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal) { + const colorStops = getColorStops(fills, defaultColorRange, scale.domain, fillMode); + return { + type: "gradient", + gradient: "linear", + colorSpace: "oklch", + colorStops, + rotation: horizontal ? 90 : 0, + bounds: "series" + }; +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeUtil.ts +import { _ModuleSupport as _ModuleSupport85 } from "ag-charts-community"; +import { cachedTextMeasurer as cachedTextMeasurer3, isArray as isArray2, measureTextSegments, toPlainText as toPlainText3 } from "ag-charts-core"; +var { BBox: BBox8 } = _ModuleSupport85; +function datumRect(datum) { + const { x0, y0, x1, y1, horizontalInset, verticalInset } = datum; + const x = Math.min(x0, x1) + horizontalInset; + const y = Math.min(y0, y1) + verticalInset; + const width = Math.max(Math.abs(x1 - x0) - 2 * horizontalInset, 0); + const height = Math.max(Math.abs(y1 - y0) - 2 * verticalInset, 0); + return { x, y, width, height }; +} +function clipBBoxVisibility(datum, clipBBox) { + if (clipBBox == null) + return true; + const rect = datumRect(datum); + const delta3 = 1e-6; + const x0 = rect.x + delta3; + const y0 = rect.y + delta3; + const x1 = rect.x + rect.width - delta3; + const y1 = rect.y + rect.height - delta3; + const clipX0 = clipBBox.x; + const clipX1 = clipBBox.x + clipBBox.width; + const clipY0 = clipBBox.y; + const clipY1 = clipBBox.y + clipBBox.height; + return Math.max(x0, clipX0) <= Math.min(x1, clipX1) && Math.max(y0, clipY0) <= Math.min(y1, clipY1); +} +function hasClipBBox(datum) { + const { clipX0, clipX1, clipY0, clipY1 } = datum; + return clipX0 != null && clipX1 != null || clipY0 != null && clipY1 != null; +} +function computeClipBBox(datum) { + if (!hasClipBBox(datum)) + return; + const { x0, y0, x1, y1 } = datum; + const { x, y, width, height } = datumRect(datum); + let { clipX0, clipX1, clipY0, clipY1 } = datum; + if (clipX0 == null || clipX1 == null) { + clipX0 = x0; + clipX1 = x1; + } + if (clipY0 == null || clipY1 == null) { + clipY0 = y0; + clipY1 = y1; + } + const clipX = Math.min(clipX0, clipX1); + const clipY = Math.min(clipY0, clipY1); + const clipWidth = Math.abs(clipX1 - clipX0); + const clipHeight = Math.abs(clipY1 - clipY0); + clipX0 = Math.max(x, clipX); + clipY0 = Math.max(y, clipY); + clipX1 = Math.min(x + width, clipX + clipWidth); + clipY1 = Math.min(y + height, clipY + clipHeight); + return new BBox8( + Math.min(clipX0, clipX1), + Math.min(clipY0, clipY1), + Math.abs(clipX1 - clipX0), + Math.abs(clipY1 - clipY0) + ); +} +function prepareLinearGaugeSeriesAnimationFunctions(initialLoad, horizontal) { + const phase = initialLoad ? "initial" : "update"; + const node = { + fromFn(sect, datum) { + const previousDatum = sect.previousDatum; + let { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1 } = previousDatum ?? datum; + const { horizontalInset, verticalInset } = datum; + const previousHadClipBBox = previousDatum != null && hasClipBBox(previousDatum); + const nextHasClipBBox = hasClipBBox(datum); + if (previousHadClipBBox && nextHasClipBBox) { + } else if (!previousHadClipBBox && nextHasClipBBox) { + ({ x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1 } = datum); + if (initialLoad) { + if (horizontal) { + clipX1 = datum.clipX0; + } else { + clipY1 = datum.clipY0; + } + } + } else if (previousHadClipBBox && !nextHasClipBBox) { + ({ x0, y0, x1, y1 } = datum); + clipX0 = void 0; + clipY0 = void 0; + clipX1 = void 0; + clipY1 = void 0; + } else if (initialLoad) { + if (horizontal) { + x1 = x0; + } else { + y1 = y0; + } + } + return { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset, phase }; + }, + toFn(_sect, datum) { + const { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset } = datum; + return { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset }; + }, + applyFn(rect, params) { + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, params)); + } + }; + return { node }; +} +function resetLinearGaugeSeriesResetRectFunction(_node, datum) { + const { x, y, width, height } = datumRect(datum); + const clipBBox = computeClipBBox(datum); + const visible = clipBBoxVisibility(datum, clipBBox); + return { x, y, width, height, clipBBox, visible }; +} +var horizontalTextAligns = { + ["Before" /* Before */]: "right", + ["Center" /* Center */]: "center", + ["After" /* After */]: "left" +}; +var verticalTextBaselines = { + ["Before" /* Before */]: "top", + ["Center" /* Center */]: "middle", + ["After" /* After */]: "bottom" +}; +var horizontalAlignFactors = { + ["Before" /* Before */]: -1, + ["Center" /* Center */]: -0.5, + ["After" /* After */]: 0 +}; +var verticalAlignFactors2 = { + ["Before" /* Before */]: 0, + ["Center" /* Center */]: -0.5, + ["After" /* After */]: -1 +}; +function formatLinearGaugeLabels(series, ctx, selection, opts, bboxes, datumOverrides) { + const { seriesRect, gaugeRect, barRect } = bboxes; + const { padding, horizontal } = opts; + selection.each((label, labelDatum) => { + const labelText = getLabelText(series.id, ctx, labelDatum, datumOverrides?.label); + let boundingWidth; + let boundingHeight; + if (labelDatum.placement === "outside-start") { + if (horizontal) { + boundingWidth = gaugeRect.x; + boundingHeight = seriesRect.height; + } else { + boundingWidth = seriesRect.width; + boundingHeight = seriesRect.height - (gaugeRect.y + gaugeRect.height); + } + } else if (labelDatum.placement === "outside-end") { + if (horizontal) { + boundingWidth = seriesRect.width - (gaugeRect.x + gaugeRect.width); + boundingHeight = seriesRect.height; + } else { + boundingWidth = seriesRect.width; + boundingHeight = gaugeRect.y; + } + } else if (labelDatum.avoidCollisions) { + boundingWidth = gaugeRect.width; + boundingHeight = gaugeRect.height; + } + let layout; + if (labelText == null) { + return; + } else if (boundingWidth != null && boundingHeight != null) { + const sizeFittingHeight = () => ({ + width: boundingWidth, + height: boundingHeight, + meta: null + }); + const labelMeta = formatSingleLabel(toPlainText3(labelText), labelDatum, { padding }, sizeFittingHeight); + layout = labelMeta?.[0]; + } else { + const measurer = cachedTextMeasurer3(labelDatum); + const { width, height } = isArray2(labelText) ? measureTextSegments(labelText, labelDatum) : measurer.measureLines(labelText); + layout = { + text: labelText, + fontSize: labelDatum.fontSize, + lineHeight: labelDatum.lineHeight ?? measurer.lineHeight(), + width, + height + }; + } + if (layout == null) { + label.visible = false; + return; + } + const scale0 = horizontal ? gaugeRect.x : gaugeRect.y + gaugeRect.height; + const scale1 = horizontal ? gaugeRect.x + gaugeRect.width : gaugeRect.y; + const bar0 = horizontal ? barRect.x : barRect.y + barRect.height; + const bar1 = horizontal ? barRect.x + barRect.width : barRect.y; + const offset = labelDatum.spacing * (horizontal ? 1 : -1); + let bounds0; + let bounds1; + let s; + let align; + switch (labelDatum.placement) { + case "outside-start": + bounds0 = -Infinity; + bounds1 = Infinity; + s = scale0 - offset; + align = "Before" /* Before */; + break; + case "outside-end": + bounds0 = -Infinity; + bounds1 = Infinity; + s = scale1 + offset; + align = "After" /* After */; + break; + case "inside-start": + bounds0 = scale0; + bounds1 = bar1; + s = scale0 + offset; + align = "After" /* After */; + break; + case "inside-end": + bounds0 = bar1; + bounds1 = scale1; + s = scale1 - offset; + align = "Before" /* Before */; + break; + case "inside-center": + bounds0 = scale0; + bounds1 = scale1; + s = (scale0 + scale1) / 2; + align = "Center" /* Center */; + break; + case "bar-inside": + bounds0 = bar0; + bounds1 = bar1; + s = (bar0 + bar1) / 2; + align = "Center" /* Center */; + break; + case "bar-inside-end": + bounds0 = bar0; + bounds1 = bar1; + s = bar1 - offset; + align = "Before" /* Before */; + break; + case "bar-outside-end": + bounds0 = bar1; + bounds1 = scale1; + s = bar1 + offset; + align = "After" /* After */; + break; + case "bar-end": + bounds0 = -Infinity; + bounds1 = Infinity; + s = bar1; + align = "Center" /* Center */; + break; + } + const x = horizontal ? s : gaugeRect.x + gaugeRect.width / 2; + const y = horizontal ? gaugeRect.y + gaugeRect.height / 2 : s; + let s0; + let s1; + if (horizontal) { + s0 = x + horizontalAlignFactors[align] * layout.width; + s1 = s0 + layout.width; + } else { + s0 = y + verticalAlignFactors2[align] * layout.height; + s1 = s0 + layout.height; + } + const inside = Math.min(s0, s1) >= Math.min(bounds0, bounds1) && Math.max(s0, s1) <= Math.max(bounds0, bounds1); + if (labelDatum.avoidCollisions && !inside) { + label.visible = false; + return; + } + label.visible = true; + label.text = layout.text; + label.fontSize = layout.fontSize; + label.lineHeight = layout.lineHeight; + label.textAlign = horizontal ? horizontalTextAligns[align] : "center"; + label.textBaseline = horizontal ? "middle" : verticalTextBaselines[align]; + label.x = x; + label.y = y; + }); +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeries.ts +var { + fromToMotion: fromToMotion2, + resetMotion: resetMotion3, + SeriesNodePickMode: SeriesNodePickMode8, + StateMachine, + createDatumId: createDatumId9, + toRadians: toRadians3, + BBox: BBox9, + Group: Group7, + PointerEvents: PointerEvents5, + Selection: Selection5, + Rect: Rect5, + Text, + TransformableText: TransformableText2, + Marker: Marker2, + LinearScale: LinearScale3, + generateTicks: generateTicks2, + NiceMode, + easing, + findRangeExtent, + tickFormat, + mergeDefaults: mergeDefaults10, + applyShapeStyle: applyShapeStyle10 +} = _ModuleSupport86; +var horizontalTargetPlacementRotation = { + before: 180, + middle: 0, + after: 0 +}; +var verticalTargetPlacementRotation = { + before: 90, + middle: 0, + after: -90 +}; +var LinearGaugeSeries = class extends _ModuleSupport86.Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode8.EXACT_SHAPE_MATCH, SeriesNodePickMode8.NEAREST_NODE] + }); + this.properties = new LinearGaugeSeriesProperties(); + this.seriesRect = BBox9.NaN; + this.gaugeRect = BBox9.NaN; + this.scale = new LinearScale3(); + this.originX = 0; + this.originY = 0; + this.scaleGroup = this.contentGroup.appendChild(new Group7({ name: "scaleGroup" })); + this.itemGroup = this.contentGroup.appendChild(new Group7({ name: "itemGroup" })); + this.itemTargetGroup = this.contentGroup.appendChild(new Group7({ name: "itemTargetGroup" })); + this.itemTargetLabelGroup = this.contentGroup.appendChild(new Group7({ name: "itemTargetLabelGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group7({ name: "itemLabelGroup" })); + this.highlightTargetGroup = this.highlightGroup.appendChild( + new Group7({ name: "itemTargetLabelGroup" }) + ); + this.tickGroup = this.contentGroup.appendChild(new Group7({ name: "tickGroup" })); + this.scaleSelection = Selection5.select( + this.scaleGroup, + () => this.nodeFactory() + ); + this.datumSelection = Selection5.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.targetSelection = Selection5.select( + this.itemTargetGroup, + () => this.markerFactory() + ); + this.targetLabelSelection = Selection5.select(this.itemTargetLabelGroup, Text); + this.labelSelection = Selection5.select( + this.itemLabelGroup, + Text + ); + this.highlightTargetSelection = Selection5.select(this.highlightTargetGroup, () => this.markerFactory()); + this.tickSelection = Selection5.select(this.tickGroup, TransformableText2); + this.datumUnion = new DatumUnion(); + this.animationState = new StateMachine("empty", { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.animateReadyResize(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateWaitingUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty" + }, + reset: "empty", + skip: "ready" + } + }); + this.scaleGroup.pointerEvents = PointerEvents5.None; + this.tickGroup.pointerEvents = PointerEvents5.None; + } + get range() { + return this.horizontal ? [0, this.gaugeRect.width] : [0, this.gaugeRect.height]; + } + get horizontal() { + return this.properties.direction === "horizontal"; + } + get hasData() { + return true; + } + nodeFactory() { + const rect = new Rect5(); + rect.crisp = true; + return rect; + } + markerFactory() { + return new Marker2(); + } + processData() { + this.nodeDataRefresh = true; + this.animationState.transition("updateData"); + } + formatLabel(value) { + return formatLabel(value, this.properties.scale); + } + getShapeFillBBox() { + const { properties, originX, originY, horizontal, scale } = this; + const { thickness } = properties; + const length = findRangeExtent(scale.range); + const bbox = new BBox9(originX, originY, horizontal ? length : thickness, horizontal ? thickness : length); + return { + axis: bbox, + series: bbox + }; + } + getTargets() { + const { properties } = this; + const defaultTarget = properties.defaultTarget; + return Array.from(properties.targets).map((target) => { + const { + text = defaultTarget.text, + value = defaultTarget.value ?? 0, + shape = defaultTarget.shape ?? "triangle", + rotation = defaultTarget.rotation ?? 0, + placement = defaultTarget.placement ?? "middle", + spacing = defaultTarget.spacing ?? 0, + size = defaultTarget.size ?? 0 + } = target; + const { + enabled: labelEnabled = defaultTarget.label.enabled, + color: labelColor = defaultTarget.label.color ?? "black", + fontStyle: labelFontStyle = defaultTarget.label.fontStyle ?? "normal", + fontWeight: labelFontWeight = defaultTarget.label.fontWeight ?? "normal", + fontSize: labelFontSize = defaultTarget.label.fontSize, + fontFamily: labelFontFamily = defaultTarget.label.fontFamily, + spacing: labelSpacing = defaultTarget.label.spacing ?? 0 + } = target.label; + return { + text, + value, + shape, + placement, + spacing, + size, + rotation, + label: { + enabled: labelEnabled, + color: labelColor, + fontStyle: labelFontStyle, + fontWeight: labelFontWeight, + fontSize: labelFontSize, + fontFamily: labelFontFamily, + spacing: labelSpacing + }, + style: target.getStyle(defaultTarget) + }; + }); + } + getTargetPoint(target) { + const { properties, originX, originY, horizontal, scale, gaugeRect } = this; + const { thickness } = properties; + const { value, placement, spacing, size } = target; + const mainOffset = scale.convert(value); + let crossOffset; + switch (placement) { + case "before": + crossOffset = -(spacing + size / 2); + break; + case "after": + crossOffset = thickness + spacing + size / 2; + break; + default: + crossOffset = thickness / 2; + break; + } + return { + x: originX + gaugeRect.x + (horizontal ? mainOffset : crossOffset), + y: originY + gaugeRect.y + (horizontal ? crossOffset : mainOffset) + }; + } + getTargetLabel(target) { + const { size, placement, label } = target; + const { spacing, color: fill, fontStyle, fontWeight, fontSize, fontFamily } = label; + const lineHeight = void 0; + const offset = size / 2 + spacing; + let textAlign; + let textBaseline; + let offsetX = 0; + let offsetY = 0; + if (this.horizontal) { + textAlign = "center"; + if (placement === "after") { + textBaseline = "top"; + offsetY = offset; + } else { + textBaseline = "bottom"; + offsetY = -offset; + } + } else { + textBaseline = "middle"; + if (placement === "before") { + textAlign = "right"; + offsetX = -offset; + } else { + textAlign = "left"; + offsetX = offset; + } + } + return { + offsetX, + offsetY, + fill, + textAlign, + textBaseline, + fontStyle, + fontWeight, + fontSize, + fontFamily, + lineHeight + }; + } + labelDatum(label, value) { + const { + placement, + avoidCollisions, + spacing, + text, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + wrapping, + overflowStrategy, + formatter = (params) => this.formatLabel(params.value) + } = label; + return { + placement, + avoidCollisions, + spacing, + text, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + wrapping, + overflowStrategy, + formatter + }; + } + verticalLabelInset() { + const { label } = this.properties; + const measurer = cachedTextMeasurer4(label); + const lines = label.text?.split("\n"); + const labelSize = (label.lineHeight ?? measurer.lineHeight()) * (lines?.length ?? 1); + return label.spacing + labelSize; + } + horizontalLabelInset() { + const { scale, properties } = this; + const { scale: scaleProps, label } = properties; + const lines = label.text?.split("\n"); + const measurer = cachedTextMeasurer4(label); + const ticks = scaleProps.interval.values ?? scale.ticks({ + nice: false, + interval: scaleProps.interval.step, + minTickCount: 0, + maxTickCount: 6, + tickCount: 5 + })?.ticks ?? []; + const linesOrTicks = lines ?? ticks?.map((tick) => getLabelText(this.id, this.ctx, this.labelDatum(label, tick)) ?? ""); + const labelSize = linesOrTicks.reduce((accum, text) => { + const { width } = isArray3(text) ? measureTextSegments2(text, label) : measurer.measureLines(text); + return Math.max(accum, width); + }, 0); + return label.spacing + labelSize; + } + tickFormatter(domain, ticks) { + const { format, formatter } = this.properties.scale.label; + let tickFormatter; + if (format != null) { + tickFormatter = tickFormat(ticks, typeof format === "string" ? format : void 0); + } + return (value, index) => { + let r = void 0; + if (formatter) { + r ?? (r = formatWithContext(this.ctx, formatter, { value, index, domain, boundSeries: void 0 })); + } + r ?? (r = tickFormatter?.(value)); + return r ?? this.formatLabel(value); + }; + } + createNodeData() { + const { id: seriesId, properties, horizontal, scale, seriesRect } = this; + const { + value, + segmentation, + thickness, + cornerRadius, + cornerMode, + bar, + scale: scaleProps, + label, + defaultColorRange + } = properties; + scale.domain = [scaleProps.min, scaleProps.max]; + scale.range = horizontal ? [0, seriesRect.width] : [seriesRect.height, 0]; + let axisRotation; + let sideFlag; + if (horizontal) { + sideFlag = 1; + axisRotation = Math.PI / 2; + } else if (scaleProps.label.placement === "before") { + sideFlag = 1; + axisRotation = 0; + } else { + sideFlag = -1; + axisRotation = 0; + } + let x0; + let x1; + let y0; + let y1; + if (horizontal) { + x0 = 0; + x1 = seriesRect.width; + y0 = (seriesRect.height - thickness) / 2; + y1 = y0 + thickness; + if (label.placement === "outside-start") { + x0 += this.horizontalLabelInset(); + } else if (label.placement === "outside-end") { + x1 -= this.horizontalLabelInset(); + } + } else { + x0 = (seriesRect.width - thickness) / 2; + x1 = x0 + thickness; + y1 = 0; + y0 = seriesRect.height; + if (label.placement === "outside-start") { + y0 -= this.verticalLabelInset(); + } else if (label.placement === "outside-end") { + y1 += this.verticalLabelInset(); + } + } + this.gaugeRect = new BBox9(Math.min(x0, x1), Math.min(y0, y1), Math.abs(x1 - x0), Math.abs(y1 - y0)); + const originX = 0; + const originY = 0; + scale.domain = [scaleProps.min, scaleProps.max]; + scale.range = horizontal ? [x0, x1] : [y0, y1]; + const { + tickData: { ticks: tickData } + } = generateTicks2({ + scale, + label: this.properties.scale.label, + interval: this.properties.scale.interval, + tickFormatter: (domain, ticks) => this.tickFormatter(domain, ticks), + domain: scale.domain, + range: this.range, + reverse: false, + primaryTickCount: void 0, + defaultTickMinSpacing: 0, + visibleRange: [0, 1], + niceMode: NiceMode.Off, + labelOffset: 0, + axisRotation, + sideFlag + }); + const isReversed = false; + const targets = this.getTargets(); + const nodeData = []; + const targetData = []; + const labelData = []; + const scaleData = []; + const [m0, m1] = scale.range; + const mainAxisSize = Math.abs(m1 - m0); + const containerX = horizontal ? scale.convert(value) : x1; + const containerY = horizontal ? y1 : scale.convert(value); + const inset = segmentation.enabled ? segmentation.spacing / 2 : 0; + const horizontalInset = horizontal ? inset : 0; + const verticalInset = horizontal ? 0 : inset; + const barThickness = Math.min(bar.thickness ?? Math.round(bar.thicknessRatio * thickness), thickness); + const barInset = -(thickness - barThickness) / 2; + const barXInset = horizontal ? 0 : barInset; + const barYInset = horizontal ? barInset : 0; + const cornersOnAllItems = cornerMode === "item"; + const maxTicks = Math.ceil(mainAxisSize); + let segments = segmentation.enabled ? segmentation.interval.getSegments(scale, maxTicks) : void 0; + const barStyle = bar.getStyle(defaultColorRange, horizontal, scale); + const scaleStyle = scaleProps.getStyle(bar.enabled, defaultColorRange, horizontal, scale); + if (segments == null && cornersOnAllItems) { + const segmentStart = Math.min(...scale.domain); + const segmentEnd = Math.max(...scale.domain); + const datum = { value, segmentStart, segmentEnd }; + if (bar.enabled) { + const barAppliedCornerRadius = Math.min(cornerRadius, barThickness / 2, mainAxisSize / 2); + const barCornerInset = barAppliedCornerRadius * (isReversed ? -1 : 1); + const barCornerXInset = horizontal ? barCornerInset : 0; + const barCornerYInset = horizontal ? 0 : barCornerInset; + nodeData.push({ + series: this, + itemId: `value`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + x0 - barCornerXInset - barXInset, + y0: originY + y0 - barCornerYInset - barYInset, + x1: originX + containerX + barCornerXInset + barXInset, + y1: originY + containerY + barCornerYInset + barYInset, + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius: cornerRadius, + topRightCornerRadius: cornerRadius, + bottomRightCornerRadius: cornerRadius, + bottomLeftCornerRadius: cornerRadius, + horizontalInset, + verticalInset, + style: barStyle + }); + } + const scaleAppliedCornerRadius = Math.min(cornerRadius, thickness / 2, mainAxisSize / 2); + const scaleCornerInset = scaleAppliedCornerRadius * (isReversed ? -1 : 1); + const scaleCornerXInset = horizontal ? scaleCornerInset : 0; + const scaleCornerYInset = horizontal ? 0 : scaleCornerInset; + scaleData.push({ + series: this, + itemId: `scale`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + x0 - scaleCornerXInset, + y0: originY + y0 - scaleCornerYInset, + x1: originX + x1 + scaleCornerXInset, + y1: originY + y1 + scaleCornerYInset, + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius: cornerRadius, + topRightCornerRadius: cornerRadius, + bottomRightCornerRadius: cornerRadius, + bottomLeftCornerRadius: cornerRadius, + horizontalInset, + verticalInset, + style: scaleStyle + }); + } else { + segments ?? (segments = scale.domain); + const clipX0 = originX + x0 - barXInset; + const clipY0 = originY + y0 - barYInset; + const clipX1 = originX + containerX + barXInset; + const clipY1 = originY + containerY + barYInset; + for (let i = 0; i < segments.length - 1; i += 1) { + const segmentStart = segments[i + 0]; + const segmentEnd = segments[i + 1]; + const datum = { value, segmentStart, segmentEnd }; + const isStart = i === 0; + const isEnd = i === segments.length - 2; + const itemStart = scale.convert(segmentStart); + const itemEnd = scale.convert(segmentEnd); + const startCornerRadius = cornersOnAllItems || isStart ? cornerRadius : 0; + const endCornerRadius = cornersOnAllItems || isEnd ? cornerRadius : 0; + const topLeftCornerRadius = horizontal ? startCornerRadius : endCornerRadius; + const topRightCornerRadius = endCornerRadius; + const bottomRightCornerRadius = horizontal ? endCornerRadius : startCornerRadius; + const bottomLeftCornerRadius = startCornerRadius; + if (bar.enabled) { + nodeData.push({ + series: this, + itemId: `value-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + (horizontal ? itemStart : x0), + y0: originY + (horizontal ? y0 : itemStart), + x1: originX + (horizontal ? itemEnd : x1), + y1: originY + (horizontal ? y1 : itemEnd), + clipX0, + clipY0, + clipX1, + clipY1, + topLeftCornerRadius, + topRightCornerRadius, + bottomRightCornerRadius, + bottomLeftCornerRadius, + horizontalInset, + verticalInset, + style: barStyle + }); + } + scaleData.push({ + series: this, + itemId: `scale-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + (horizontal ? itemStart : x0), + y0: originY + (horizontal ? y0 : itemStart), + x1: originX + (horizontal ? itemEnd : x1), + y1: originY + (horizontal ? y1 : itemEnd), + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius, + topRightCornerRadius, + bottomRightCornerRadius, + bottomLeftCornerRadius, + horizontalInset, + verticalInset, + style: scaleStyle + }); + } + } + if (label.enabled) { + labelData.push(this.labelDatum(label, value)); + } + const targetPlacementRotation2 = horizontal ? horizontalTargetPlacementRotation : verticalTargetPlacementRotation; + for (let i = 0; i < targets.length; i += 1) { + const target = targets[i]; + const { value: targetValue, text, shape, size, style } = target; + const targetPoint = this.getTargetPoint(target); + const targetRotation = toRadians3(target.rotation + targetPlacementRotation2[target.placement]); + targetData.push({ + series: this, + itemId: `target-${i}`, + midPoint: targetPoint, + datum: { value: targetValue }, + datumIndex: { type: 1 /* Target */, index: i }, + type: 1 /* Target */, + value: targetValue, + text, + x: targetPoint.x, + y: targetPoint.y, + shape, + size, + rotation: targetRotation, + label: this.getTargetLabel(target), + style + }); + } + return { + itemId: seriesId, + nodeData, + tickData, + targetData, + labelData, + scaleData + }; + } + updateSelections(resize) { + if (this.nodeDataRefresh || resize) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + highlightDatum(node) { + if (node != null && node.series === this && node.type === 1 /* Target */) { + return node; + } + } + update({ seriesRect }) { + const { + datumSelection, + labelSelection, + targetSelection, + targetLabelSelection, + scaleSelection, + highlightTargetSelection, + tickSelection + } = this; + this.seriesRect = seriesRect ?? BBox9.NaN; + const resize = this.checkResize(seriesRect); + this.updateSelections(resize); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const targetData = this.contextNodeData?.targetData ?? []; + const scaleData = this.contextNodeData?.scaleData ?? []; + const tickData = this.contextNodeData?.tickData ?? []; + const highlightTargetDatum = this.highlightDatum(this.ctx.highlightManager.getActiveHighlight()); + this.scaleSelection = this.updateScaleSelection({ scaleData, scaleSelection }); + this.updateScaleNodes({ scaleSelection }); + this.targetSelection = this.updateTargetSelection({ targetData, targetSelection }); + this.updateTargetNodes({ targetSelection, isHighlight: false }); + this.targetLabelSelection = this.updateTargetLabelSelection({ targetData, targetLabelSelection }); + this.updateTargetLabelNodes({ targetLabelSelection }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightTargetSelection = this.updateTargetSelection({ + targetData: highlightTargetDatum == null ? [] : [highlightTargetDatum], + targetSelection: highlightTargetSelection + }); + this.updateTargetNodes({ targetSelection: highlightTargetSelection, isHighlight: true }); + this.tickSelection = this.updateTickSelection({ tickData, tickSelection }); + this.updateTickNodes({ tickSelection }); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => { + return createDatumId9(opts.nodeData.length, datum.itemId); + }); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + const { ctx } = this; + const animationDisabled = ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle10(rect, datum.style, fillBBox); + rect.topLeftCornerRadius = topLeftCornerRadius; + rect.topRightCornerRadius = topRightCornerRadius; + rect.bottomRightCornerRadius = bottomRightCornerRadius; + rect.bottomLeftCornerRadius = bottomLeftCornerRadius; + rect.pointerEvents = this.properties.bar.enabled ? _ModuleSupport86.PointerEvents.All : _ModuleSupport86.PointerEvents.None; + if (animationDisabled || rect.previousDatum == null) { + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + } + }); + const { horizontal } = this; + this.datumUnion.update(datumSelection, this.itemGroup, _ModuleSupport86.Rect, (node, first, last) => { + const left = Math.min(first.x, last.x); + const right = Math.max(first.x + first.width, last.x + last.width); + const top = Math.min(first.y, last.y); + const bottom = Math.max(first.y + first.height, last.y + last.height); + const width = right - left; + const height = bottom - top; + node.pointerEvents = _ModuleSupport86.PointerEvents.None; + node.x = left; + node.y = top; + node.width = width; + node.height = height; + node.topLeftCornerRadius = horizontal ? first.topLeftCornerRadius : last.topLeftCornerRadius; + node.topRightCornerRadius = last.topRightCornerRadius; + node.bottomRightCornerRadius = horizontal ? last.bottomRightCornerRadius : first.bottomRightCornerRadius; + node.bottomLeftCornerRadius = first.bottomLeftCornerRadius; + const firstClipBBox = first.clipBBox; + const lastClipBBox = last.clipBBox ?? firstClipBBox; + if (firstClipBBox && lastClipBBox) { + node.clipBBox = BBox9.merge([firstClipBBox, lastClipBBox]).intersection( + horizontal ? new BBox9(left, -Infinity, width, Infinity) : new BBox9(-Infinity, top, Infinity, height) + ); + } else { + node.clipBBox = void 0; + } + }); + } + updateScaleSelection(opts) { + return opts.scaleSelection.update(opts.scaleData, void 0, (datum) => { + return createDatumId9(opts.scaleData.length, datum.itemId); + }); + } + updateScaleNodes(opts) { + const { scaleSelection } = opts; + const fillBBox = this.getShapeFillBBox(); + scaleSelection.each((rect, datum) => { + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle10(rect, datum.style, fillBBox); + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + rect.topLeftCornerRadius = topLeftCornerRadius; + rect.topRightCornerRadius = topRightCornerRadius; + rect.bottomRightCornerRadius = bottomRightCornerRadius; + rect.bottomLeftCornerRadius = bottomLeftCornerRadius; + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + }); + } + updateTargetSelection(opts) { + return opts.targetSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetNodes(opts) { + const { targetSelection, isHighlight } = opts; + targetSelection.each((target, datum) => { + const { x, y, shape, size, rotation } = datum; + const style = this.getTargetStyle(isHighlight, datum); + applyShapeStyle10(target, style); + target.size = size; + target.shape = shape === "line" ? lineMarker : shape; + target.translationX = x; + target.translationY = y; + target.rotation = rotation; + }); + } + getTargetStyle(isHighlight, { datumIndex, style }) { + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + return mergeDefaults10(highlightStyle, { + ...style, + opacity: 1 + }); + } + updateTargetLabelSelection(opts) { + return opts.targetLabelSelection.update(opts.targetData); + } + updateTargetLabelNodes(opts) { + const { targetLabelSelection } = opts; + targetLabelSelection.each((label, target) => { + const { x, y, text } = target; + const { offsetX, offsetY, fill, fontStyle, fontWeight, fontSize, fontFamily, textAlign, textBaseline } = target.label; + label.visible = true; + label.x = x + offsetX; + label.y = y + offsetY; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + }); + } + updateTickSelection(opts) { + return opts.tickSelection.update(opts.tickData, void 0, (datum) => datum.tickId); + } + updateTickNodes(opts) { + const { gaugeRect, properties } = this; + const defaultScale = properties.defaultScale; + const { + enabled, + color: color6, + fontFamily = defaultScale.label.fontFamily, + fontSize = defaultScale.label.fontSize, + fontStyle, + fontWeight = defaultScale.label.fontWeight, + spacing + } = properties.scale.label; + let { placement } = properties.scale.label; + const rotation = toRadians3(properties.scale.label.rotation ?? 0); + let textAlign; + let textBaseline; + let textX; + let textY; + if (this.horizontal) { + placement ?? (placement = "after"); + textAlign = "center"; + textBaseline = placement === "before" ? "bottom" : "top"; + textY = this.originY + gaugeRect.y + (placement === "before" ? -spacing : gaugeRect.height + spacing); + } else { + placement ?? (placement = "before"); + textAlign = placement === "before" ? "end" : "start"; + textBaseline = "middle"; + textX = this.originX + gaugeRect.x + (placement === "before" ? -spacing : gaugeRect.width + spacing); + } + opts.tickSelection.each((label, datum) => { + if (!enabled) { + label.visible = false; + return; + } + const x = textX ?? datum.translation; + const y = textY ?? datum.translation; + label.visible = true; + label.text = datum.tickLabel; + label.fill = color6; + label.fontFamily = fontFamily; + label.fontSize = fontSize; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.textBaseline = textBaseline; + label.textAlign = textAlign; + label.x = x; + label.y = y; + label.rotationCenterX = x; + label.rotationCenterY = y; + label.rotation = rotation; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(opts.labelData, void 0, (_datum) => "primary"); + } + updateLabelNodes(opts) { + const { labelSelection } = opts; + const animationDisabled = this.ctx.animationManager.isSkipped(); + labelSelection.each((label, datum) => { + label.fill = datum.fill; + label.fontStyle = datum.fontStyle; + label.fontWeight = datum.fontWeight; + label.fontFamily = datum.fontFamily; + }); + if (animationDisabled || this.labelsHaveExplicitText()) { + this.formatLabelText(); + } + } + labelsHaveExplicitText() { + for (const { datum } of this.labelSelection) { + if (datum.text == null) { + return false; + } + } + return true; + } + formatLabelText(datum) { + const { labelSelection, horizontal, scale, seriesRect, gaugeRect } = this; + const { x, y, width, height } = gaugeRect; + const value = datum?.label ?? this.properties.value; + let barRect; + if (horizontal) { + const xValue2 = scale.convert(value); + barRect = new BBox9(x, y, xValue2 - x, height); + } else { + const yValue = scale.convert(value); + barRect = new BBox9(x, yValue, width, height - yValue); + } + const bboxes = { seriesRect, gaugeRect, barRect }; + const { margin: padding } = this.properties; + formatLinearGaugeLabels(this, this.ctx, labelSelection, { padding, horizontal }, bboxes, datum); + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + resetMotion3([this.datumSelection], resetLinearGaugeSeriesResetRectFunction); + this.formatLabelText(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + animateLabelText(params = {}) { + const { animationManager } = this.ctx; + let labelFrom = 0; + let labelTo = 0; + this.labelSelection.each((label, datum) => { + label.opacity = 1; + labelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + labelTo = datum.value; + }); + if (this.labelsHaveExplicitText()) { + } else if (labelFrom === labelTo) { + this.formatLabelText({ label: labelTo }); + } else { + const animationId = `${this.id}_labels`; + animationManager.animate({ + id: animationId, + groupId: "label", + from: { label: labelFrom }, + to: { label: labelTo }, + phase: params.phase ?? "update", + ease: easing.easeOut, + onUpdate: (datum) => this.formatLabelText(datum), + onStop: () => this.formatLabelText({ label: labelTo }) + }); + } + } + animateEmptyUpdateReady() { + const { animationManager } = this.ctx; + const { node } = prepareLinearGaugeSeriesAnimationFunctions(true, this.horizontal); + fromToMotion2(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion2(this.id, "label", animationManager, [this.labelSelection], fadeInFns, () => "primary"); + this.animateLabelText({ from: 0, phase: "initial" }); + } + animateWaitingUpdateReady() { + const { animationManager } = this.ctx; + const { node } = prepareLinearGaugeSeriesAnimationFunctions(false, this.horizontal); + fromToMotion2(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + this.animateLabelText(); + } + animateReadyResize() { + this.resetAllAnimation(); + } + getSeriesDomain() { + return [0, 1]; + } + dataCount() { + return Number.NaN; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData() { + return []; + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties } = this; + const { tooltip } = properties; + if (datumIndex == null) + return; + let value; + let text; + let fallbackLabel; + if (datumIndex.type === 0 /* Node */) { + value = properties.value; + text = properties.label.text; + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeValue"); + } else { + ({ value, text } = properties.targets[datumIndex.index]); + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeTarget"); + } + if (value == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + data: [{ label: text, fallbackLabel, value: this.formatLabel(value) }] + }, + { seriesId, title: void 0, datum: void 0, value } + ); + } + pickNodeClosestDatum(point) { + return pickGaugeNearestDatum(this, point); + } + pickFocus(opts) { + return pickGaugeFocus(this, opts); + } + getCaptionText() { + return this.formatLabel(this.properties.value); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +LinearGaugeSeries.className = "LinearGaugeSeries"; +LinearGaugeSeries.type = "linear-gauge"; + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeModule.ts +var LinearGaugeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "linear-gauge", + moduleFactory: (ctx) => new LinearGaugeSeries(ctx), + themeTemplate: { + minWidth: 200, + minHeight: 200, + tooltip: { + enabled: false + }, + series: { + thickness: 50, + defaultColorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $interpolate: [{ $palette: "secondDivergingColors" }, 5] }, + _ModuleSupport87.SAFE_RANGE2_OPERATION + ] + }, + scale: { + // @ts-expect-error undocumented option + defaultFill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + stroke: { $path: ["/2", _ModuleSupport87.SAFE_STROKE_FILL_OPERATION, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + spacing: 11 + } + }, + bar: { + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + segmentation: { + enabled: false, + interval: {}, + spacing: 1 + }, + defaultTarget: { + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + size: 10, + shape: "triangle", + placement: "after", + spacing: 5, + label: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 5 + } + }, + defaultScale: { + label: { + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + } + }, + label: { + ..._ModuleSupport87.LABEL_BOXING_DEFAULTS, + enabled: false, + placement: "inside-start", + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: 2 }, + minimumFontSize: _ModuleSupport87.FONT_SIZE.SMALL, + spacing: 18, + color: { $ref: "chartBackgroundColor" } + }, + margin: 4, + tooltip: { + range: { $path: ["/tooltip/range", 10] } + } + } + } +}; +var LinearGaugeSeriesModule = { + type: "series", + name: "linear-gauge", + chartType: "standalone", + enterprise: true, + options: _ModuleSupport87.linearGaugeSeriesOptionsDef, + create: (ctx) => new LinearGaugeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineModule.ts +import { _ModuleSupport as _ModuleSupport96 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/map-util/mapThemeDefaults.ts +import { _ModuleSupport as _ModuleSupport88 } from "ag-charts-community"; +var MAP_THEME_DEFAULTS = { + zoom: { + axes: "xy", + anchorPointX: "pointer", + anchorPointY: "pointer", + buttons: { + // @ts-expect-error undocumented options + anchorPointX: "middle", + anchorPointY: "middle" + } + }, + legend: { + enabled: false + }, + gradientLegend: { + enabled: false, + ..._ModuleSupport88.LEGEND_CONTAINER_THEME + } +}; +function applyMapPalette(object) { + const clone = _ModuleSupport88.deepClone(object); + _ModuleSupport88.jsonWalk(clone, (value) => { + if (typeof value === "object" && "$palette" in value) { + value["$mapPalette"] = value["$palette"]; + delete value["$palette"]; + } + }); + return clone; +} + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeries.ts +import { _ModuleSupport as _ModuleSupport94 } from "ag-charts-community"; +import { Logger as Logger7, cachedTextMeasurer as cachedTextMeasurer5 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/map-util/geoGeometry.ts +import { _ModuleSupport as _ModuleSupport90 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/map-util/lineStringUtil.ts +var delta2 = 1e-9; +function lineSegmentDistanceToPointSquared(a, b, x, y) { + const [ax, ay] = a; + const [bx, by] = b; + const abx = bx - ax; + const aby = by - ay; + const l = abx * abx + aby * aby; + let x0; + let y0; + if (Math.abs(l) < delta2) { + x0 = ax; + y0 = ay; + } else { + let t = ((x - ax) * abx + (y - ay) * aby) / l; + t = Math.max(0, Math.min(1, t)); + x0 = ax + t * (bx - ax); + y0 = ay + t * (by - ay); + } + const dx = x - x0; + const dy = y - y0; + return dx * dx + dy * dy; +} +function lineStringDistance(lineString, x, y) { + let minDistanceSquared = Infinity; + let p0 = lineString.at(-1); + for (const p1 of lineString) { + minDistanceSquared = Math.min(minDistanceSquared, lineSegmentDistanceToPointSquared(p0, p1, x, y)); + p0 = p1; + } + return Math.sqrt(minDistanceSquared); +} +function lineStringLength(lineSegment) { + let [x0, y0] = lineSegment[0]; + let totalDistance = 0; + for (let i = 1; i < lineSegment.length; i += 1) { + const [x1, y1] = lineSegment[i]; + const distance = Math.hypot(x1 - x0, y1 - y0); + totalDistance += distance; + x0 = x1; + y0 = y1; + } + return totalDistance; +} +function lineStringCenter(lineSegment) { + if (lineSegment.length === 0) + return; + const targetDistance = lineStringLength(lineSegment) / 2; + let [x0, y0] = lineSegment[0]; + let totalDistance = 0; + for (let i = 1; i < lineSegment.length; i += 1) { + const [x1, y1] = lineSegment[i]; + const segmentDistance = Math.hypot(x1 - x0, y1 - y0); + const nextDistance = totalDistance + segmentDistance; + if (nextDistance > targetDistance) { + const ratio3 = (targetDistance - totalDistance) / segmentDistance; + const point = [x0 + (x1 - x0) * ratio3, y0 + (y1 - y0) * ratio3]; + const angle = Math.atan2(y1 - y0, x1 - x0); + return { point, angle }; + } + totalDistance = nextDistance; + x0 = x1; + y0 = y1; + } +} + +// packages/ag-charts-enterprise/src/series/map-util/polygonUtil.ts +import { _ModuleSupport as _ModuleSupport89 } from "ag-charts-community"; +var { LonLatBBox } = _ModuleSupport89; +function polygonBbox(polygon, into) { + for (const coordinates of polygon) { + const [lon, lat] = coordinates; + into = LonLatBBox.extend(into, lon, lat, lon, lat); + } + return into; +} +function polygonCentroid(polygon) { + if (polygon.length === 0) + return; + let x = 0; + let y = 0; + let k = 0; + let [x0, y0] = polygon.at(-1); + for (const [x1, y1] of polygon) { + const c = x0 * y1 - x1 * y0; + k += c; + x += (x0 + x1) * c; + y += (y0 + y1) * c; + x0 = x1; + y0 = y1; + } + k *= 3; + return [x / k, y / k]; +} +function polygonDistance(polygons, x, y) { + let inside = false; + let minDistanceSquared = Infinity; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + let [x0, y0] = p0; + for (const p1 of polygon) { + const [x1, y1] = p1; + if (y1 > y !== y0 > y && x < (x0 - x1) * (y - y1) / (y0 - y1) + x1) { + inside = !inside; + } + minDistanceSquared = Math.min(minDistanceSquared, lineSegmentDistanceToPointSquared(p0, p1, x, y)); + p0 = p1; + x0 = x1; + y0 = y1; + } + } + return (inside ? -1 : 1) * Math.sqrt(minDistanceSquared); +} + +// packages/ag-charts-enterprise/src/series/map-util/geoGeometry.ts +var { Path: Path9, ExtendedPath2D: ExtendedPath2D3, BBox: BBox10, SceneChangeDetection: SceneChangeDetection6, SceneObjectChangeDetection, objectsEqual } = _ModuleSupport90; +var GeoGeometry = class extends Path9 { + constructor() { + super(...arguments); + this.projectedGeometry = void 0; + this.renderMode = 3 /* All */; + // Keep non-filled shapes separate so we don't fill them + this.strokePath = new ExtendedPath2D3(); + } + computeBBox() { + if (this.dirtyPath || this.isDirtyPath()) { + this.updatePath(); + this.dirtyPath = false; + } + return this.bbox?.clone(); + } + updatePath() { + const { projectedGeometry } = this; + this.strokePath.clear(); + this.path.clear(); + this.bbox = projectedGeometry == null ? void 0 : this.drawGeometry(projectedGeometry, void 0); + } + drawPath(ctx) { + super.drawPath(ctx); + this.renderStroke(ctx, this.strokePath.getPath2D()); + } + containsPoint(x, y) { + const { projectedGeometry } = this; + if (projectedGeometry == null) + return false; + if (!this.getBBox().containsPoint(x, y)) + return false; + return this.geometryDistance(projectedGeometry, x, y) <= 0; + } + distanceSquared(x, y) { + const { projectedGeometry } = this; + if (projectedGeometry == null) + return Infinity; + const distance = this.geometryDistance(projectedGeometry, x, y); + return distance > 0 ? distance * distance : 0; + } + geometryDistance(geometry, x, y) { + const { renderMode, strokeWidth } = this; + const drawPolygons = (renderMode & 1 /* Polygons */) !== 0; + const drawLines = (renderMode & 2 /* Lines */) !== 0; + const minStrokeDistance = Math.max(strokeWidth / 2, 1) + 1; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.reduce( + (minDistance, g) => Math.min(minDistance, this.geometryDistance(g, x, y)), + Infinity + ); + case "MultiPolygon": + return drawPolygons ? geometry.coordinates.reduce( + (minDistance, polygon) => Math.min(minDistance, Math.max(polygonDistance(polygon, x, y), 0)), + Infinity + ) : Infinity; + case "Polygon": + return drawPolygons ? Math.max(polygonDistance(geometry.coordinates, x, y), 0) : Infinity; + case "MultiLineString": + return drawLines ? geometry.coordinates.reduce((minDistance, lineString) => { + return Math.min( + minDistance, + Math.max(lineStringDistance(lineString, x, y) - minStrokeDistance, 0) + ); + }, Infinity) : Infinity; + case "LineString": + return drawLines ? Math.max(lineStringDistance(geometry.coordinates, x, y) - minStrokeDistance, 0) : Infinity; + case "MultiPoint": + case "Point": + default: + return Infinity; + } + } + drawGeometry(geometry, bbox) { + const { renderMode, path, strokePath } = this; + const drawPolygons = (renderMode & 1 /* Polygons */) !== 0; + const drawLines = (renderMode & 2 /* Lines */) !== 0; + switch (geometry.type) { + case "GeometryCollection": + for (const g of geometry.geometries) { + bbox = this.drawGeometry(g, bbox); + } + break; + case "MultiPolygon": + if (drawPolygons) { + for (const coordinates of geometry.coordinates) { + bbox = this.drawPolygon(path, coordinates, bbox); + } + } + break; + case "Polygon": + if (drawPolygons) { + bbox = this.drawPolygon(path, geometry.coordinates, bbox); + } + break; + case "LineString": + if (drawLines) { + bbox = this.drawLineString(strokePath, geometry.coordinates, bbox, false); + } + break; + case "MultiLineString": + if (drawLines) { + for (const coordinates of geometry.coordinates) { + bbox = this.drawLineString(strokePath, coordinates, bbox, false); + } + } + break; + case "Point": + case "MultiPoint": + break; + } + return bbox; + } + drawPolygon(path, polygons, bbox) { + if (polygons.length < 1) + return bbox; + bbox = this.drawLineString(path, polygons[0], bbox, true); + for (let i = 1; i < polygons.length; i += 1) { + const enclave = polygons[i]; + this.drawLineString(path, enclave, void 0, true); + } + return bbox; + } + drawLineString(path, coordinates, bbox, isClosed) { + if (coordinates.length < 2) + return bbox; + const end = isClosed ? coordinates.length - 1 : coordinates.length; + for (let i = 0; i < end; i += 1) { + const [x, y] = coordinates[i]; + if (i === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + if (bbox == null) { + bbox = new BBox10(x, y, 0, 0); + } else { + const { x: x0, y: y0 } = bbox; + const x1 = x0 + bbox.width; + const y1 = y0 + bbox.height; + bbox.x = Math.min(x0, x); + bbox.y = Math.min(y0, y); + bbox.width = Math.max(x1, x) - bbox.x; + bbox.height = Math.max(y1, y) - bbox.y; + } + } + if (isClosed) { + path.closePath(); + } + return bbox; + } +}; +__decorateClass([ + SceneObjectChangeDetection({ equals: objectsEqual }) +], GeoGeometry.prototype, "projectedGeometry", 2); +__decorateClass([ + SceneChangeDetection6() +], GeoGeometry.prototype, "renderMode", 2); + +// packages/ag-charts-enterprise/src/series/map-util/geometryUtil.ts +import { _ModuleSupport as _ModuleSupport91 } from "ag-charts-community"; +var { LonLatBBox: LonLatBBox2 } = _ModuleSupport91; +function geometryBbox(geometry, into) { + if (geometry.bbox != null) { + const [lon0, lat0, lon1, lat1] = geometry.bbox; + into = LonLatBBox2.extend(into, lon0, lat0, lon1, lat1); + return into; + } + switch (geometry.type) { + case "GeometryCollection": + for (const g of geometry.geometries) { + into = geometryBbox(g, into); + } + break; + case "MultiPolygon": + for (const c of geometry.coordinates) { + if (c.length > 0) { + into = polygonBbox(c[0], into); + } + } + break; + case "Polygon": + if (geometry.coordinates.length > 0) { + into = polygonBbox(geometry.coordinates[0], into); + } + break; + case "MultiLineString": + for (const c of geometry.coordinates) { + into = polygonBbox(c, into); + } + break; + case "LineString": + into = polygonBbox(geometry.coordinates, into); + break; + case "MultiPoint": + for (const p of geometry.coordinates) { + const [lon, lat] = p; + into = LonLatBBox2.extend(into, lon, lat, lon, lat); + } + break; + case "Point": { + const [lon, lat] = geometry.coordinates; + into = LonLatBBox2.extend(into, lon, lat, lon, lat); + break; + } + } + return into; +} +function largestPolygon(geometry) { + switch (geometry.type) { + case "GeometryCollection": { + let maxArea; + let maxPolygon; + for (const g of geometry.geometries) { + const polygon = largestPolygon(g); + if (polygon == null) + continue; + const bbox = polygonBbox(polygon[0], void 0); + if (bbox == null) + continue; + const area = Math.abs(bbox.lat1 - bbox.lat0) * Math.abs(bbox.lon1 - bbox.lon0); + if (maxArea == null || area > maxArea) { + maxArea = area; + maxPolygon = polygon; + } + } + return maxPolygon; + } + case "MultiPolygon": { + let maxArea; + let maxPolygon; + for (const polygon of geometry.coordinates) { + const bbox = polygonBbox(polygon[0], void 0); + if (bbox == null) + continue; + const area = Math.abs(bbox.lat1 - bbox.lat0) * Math.abs(bbox.lon1 - bbox.lon0); + if (maxArea == null || area > maxArea) { + maxArea = area; + maxPolygon = polygon; + } + } + return maxPolygon; + } + case "Polygon": + return geometry.coordinates; + case "MultiLineString": + case "LineString": + case "MultiPoint": + case "Point": + return; + } +} +function largestLineString(geometry) { + switch (geometry.type) { + case "GeometryCollection": { + let maxLength; + let maxLineString; + for (const g of geometry.geometries) { + const lineString = largestLineString(g); + if (lineString == null) + continue; + const length = lineStringLength(lineString); + if (length == null) + continue; + if (maxLength == null || length > maxLength) { + maxLength = length; + maxLineString = lineString; + } + } + return maxLineString; + } + case "MultiLineString": { + let maxLength = 0; + let maxLineString; + for (const lineString of geometry.coordinates) { + const length = lineStringLength(lineString); + if (length > maxLength) { + maxLength = length; + maxLineString = lineString; + } + } + return maxLineString; + } + case "LineString": + return geometry.coordinates; + case "MultiPolygon": + case "Polygon": + case "MultiPoint": + case "Point": + return; + } +} +function containsType(geometry, type) { + if (geometry == null) + return false; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.some((g) => containsType(g, type)); + case "MultiPolygon": + case "Polygon": + return (type & 1 /* Polygon */) !== 0; + case "MultiLineString": + case "LineString": + return (type & 2 /* LineString */) !== 0; + case "MultiPoint": + case "Point": + return (type & 4 /* Point */) !== 0; + } +} +function projectGeometry(geometry, scale) { + switch (geometry.type) { + case "GeometryCollection": + return { + type: "GeometryCollection", + geometries: geometry.geometries.map((g) => projectGeometry(g, scale)) + }; + case "Polygon": + return { + type: "Polygon", + coordinates: projectPolygon(geometry.coordinates, scale) + }; + case "MultiPolygon": + return { + type: "MultiPolygon", + coordinates: projectMultiPolygon(geometry.coordinates, scale) + }; + case "MultiLineString": + return { + type: "MultiLineString", + coordinates: projectPolygon(geometry.coordinates, scale) + }; + case "LineString": + return { + type: "LineString", + coordinates: projectLineString(geometry.coordinates, scale) + }; + case "MultiPoint": + return { + type: "MultiPoint", + coordinates: projectLineString(geometry.coordinates, scale) + }; + case "Point": + return { + type: "Point", + coordinates: scale.convert(geometry.coordinates) + }; + } +} +function projectMultiPolygon(multiPolygon, scale) { + return multiPolygon.map((polygon) => projectPolygon(polygon, scale)); +} +function projectPolygon(polygon, scale) { + return polygon.map((lineString) => projectLineString(lineString, scale)); +} +function projectLineString(lineString, scale) { + return lineString.map((lonLat) => scale.convert(lonLat)); +} + +// packages/ag-charts-enterprise/src/series/map-util/mapUtil.ts +function prepareMapMarkerAnimationFunctions() { + const fromFn = (marker, _datum, status) => { + if (status === "removed") { + return { scalingX: 1, scalingY: 1 }; + } else if (marker.previousDatum == null) { + return { scalingX: 0, scalingY: 0 }; + } + return { scalingX: marker.scalingX, scalingY: marker.scalingY }; + }; + const toFn = (_marker, _datum, status) => { + if (status === "removed") { + return { scalingX: 0, scalingY: 0 }; + } + return { scalingX: 1, scalingY: 1 }; + }; + return { fromFn, toFn }; +} +function findFocusedGeoGeometry(series, opts) { + const datum = series.contextNodeData?.nodeData[opts.datumIndex]; + if (datum === void 0) + return void 0; + for (const node of series.datumSelection.nodes()) { + if (node.datum === datum) { + return node; + } + } + return void 0; +} + +// packages/ag-charts-enterprise/src/series/map-util/topologySeries.ts +import { _ModuleSupport as _ModuleSupport92 } from "ag-charts-community"; +var TopologySeriesProperties = class extends _ModuleSupport92.SeriesProperties { +}; +var TopologySeries = class extends _ModuleSupport92.DataModelSeries { + addChartEventListeners() { + this.cleanup.register( + this.ctx.eventsHub.on("legend:item-click", (event) => { + this.onLegendItemClick(event); + }), + this.ctx.eventsHub.on("legend:item-double-click", (event) => { + this.onLegendItemDoubleClick(event); + }) + ); + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } +}; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport93 } from "ag-charts-community"; +var { Property: Property25, SeriesProperties: SeriesProperties3, makeSeriesTooltip: makeSeriesTooltip12, Label: Label8 } = _ModuleSupport93; +var MapLineSeriesProperties = class extends SeriesProperties3 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = ""; + this.topologyIdKey = "name"; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.maxStrokeWidth = void 0; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new Label8(); + this.tooltip = makeSeriesTooltip12(); + } + getStyle() { + const { stroke, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this; + return { + stroke, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "sizeDomain", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "maxStrokeWidth", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property25 +], MapLineSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeries.ts +var { + getMissCount: getMissCount2, + getLabelStyles: getLabelStyles2, + createDatumId: createDatumId10, + SeriesNodePickMode: SeriesNodePickMode9, + valueProperty: valueProperty9, + ColorScale: ColorScale2, + LinearScale: LinearScale4, + Selection: Selection6, + Text: Text2, + Transformable: Transformable2, + mergeDefaults: mergeDefaults11 +} = _ModuleSupport94; +var MapLineSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + size: ["colorKey"], + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + size: ["sizeName"], + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode9.EXACT_SHAPE_MATCH, SeriesNodePickMode9.NEAREST_NODE], + usesPlacedLabels: true + }); + this.properties = new MapLineSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale2(); + this.sizeScale = new LinearScale4(); + this.datumSelection = Selection6.select( + this.contentGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection6.select(this.labelGroup, Text2); + this.highlightDatumSelection = Selection6.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this._previousDatumMidPoint = void 0; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + return super.hasData && this.topology != null; + } + renderToOffscreenCanvas() { + return true; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [1 /* ShapeLine */, zIndex]; + this.highlightGroup.zIndex = [2 /* ShapeLineHighlight */, zIndex]; + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 2 /* Lines */; + geoGeometry.lineJoin = "round"; + geoGeometry.lineCap = "round"; + return geoGeometry; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, sizeScale, colorScale } = this; + const { topologyIdKey, idKey, sizeKey, colorKey, labelKey, sizeDomain, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null || !containsType(feature.geometry, 2 /* LineString */)) + continue; + featureById.set(property, feature); + } + const sizeScaleType = this.sizeScale.type; + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + valueProperty9(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty9(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }), + ...labelKey == null ? [] : [valueProperty9(labelKey, "category", { id: "labelValue" })], + ...sizeKey == null ? [] : [valueProperty9(sizeKey, sizeScaleType, { id: "sizeValue" })], + ...colorKey == null ? [] : [valueProperty9(colorKey, colorScaleType, { id: "colorValue" })] + ] + }); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + this.topologyBounds = featureValues.reduce((current, feature) => { + const geometry = feature?.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (sizeKey != null) { + const sizeIdx = dataModel.resolveProcessedDataIndexById(this, `sizeValue`); + const processedSize = processedData.domain.values[sizeIdx] ?? []; + sizeScale.domain = sizeDomain ?? processedSize; + } + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + if (topology == null) { + Logger7.warnOnce(`no topology was provided for [MapLineSeries]; nothing will be rendered.`); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount2(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelDatum(datum, labelValue, projectedGeometry, measurer) { + if (labelValue == null || projectedGeometry == null) + return; + const lineString = largestLineString(projectedGeometry); + if (lineString == null) + return; + const { idKey, idName, sizeKey, sizeName, colorKey, colorName, labelKey, labelName, label } = this.properties; + if (labelKey == null || !label.enabled) + return; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const labelSize = measurer.measureLines(String(labelText)); + const labelCenter = lineStringCenter(lineString); + if (labelCenter == null) + return; + const [x, y] = labelCenter.point; + const { width, height } = labelSize; + return { + point: { x, y, size: 0 }, + label: { width, height, text: labelText }, + anchor: void 0, + placement: void 0 + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, sizeScale, properties, scale } = this; + const { idKey, sizeKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null) + return; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const sizeValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const maxStrokeWidth = properties.maxStrokeWidth ?? properties.strokeWidth; + sizeScale.range = [Math.min(properties.strokeWidth, maxStrokeWidth), maxStrokeWidth]; + const measurer = cachedTextMeasurer5(label); + const projectedGeometries = /* @__PURE__ */ new Map(); + for (const [datumIndex] of processedData.dataSources.get(this.id)?.data.entries() ?? []) { + const id = idValues[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (id != null && projectedGeometry != null) { + projectedGeometries.set(id, projectedGeometry); + } + } + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const sizeValue = sizeValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const projectedGeometry = projectedGeometries.get(idValue); + if (projectedGeometry == null) { + missingGeometries.push(idValue); + } + const labelDatum = this.getLabelDatum(datum, labelValue, projectedGeometry, measurer); + if (labelDatum != null) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: idKey, + datum, + datumIndex, + idValue, + labelValue, + colorValue, + sizeValue, + projectedGeometry, + legendItemName, + style: this.getItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + Logger7.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection, isHighlight: false }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection, isHighlight: true }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId10(datum.idValue)); + } + getItemStyle({ datumIndex = 0, datum, colorValue, sizeValue }, isHighlight) { + const { properties, colorScale, sizeScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const style = mergeDefaults11(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + style.stroke = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? properties.stroke; + } + if (sizeValue != null) { + style.strokeWidth = sizeScale.convert(sizeValue, { clamp: true }); + } + let overrides; + if (itemStyler != null) { + overrides = this.cachedDatumCallback(createDatumId10(datumIndex, isHighlight ? "highlight" : "node"), () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + }); + } + return overrides ? mergeDefaults11(style, overrides) : style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + datumSelection.each((geoGeometry, nodeDatum) => { + const { projectedGeometry, style } = nodeDatum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(style); + }); + } + updatePlacedLabelData(labelData) { + this.labelSelection = this.labelSelection.update(labelData, (text) => { + text.pointerEvents = _ModuleSupport94.PointerEvents.None; + }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, width, height, text }, datumIndex) => { + const style = getLabelStyles2(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x + width / 2; + label.y = y + height / 2; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + resetAnimation() { + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + datumMidPoint(datum) { + const { _previousDatumMidPoint } = this; + if (_previousDatumMidPoint?.datum === datum) { + return _previousDatumMidPoint.point; + } + const projectedGeometry = datum.projectedGeometry; + const lineString = projectedGeometry == null ? void 0 : largestLineString(projectedGeometry); + const center = lineString == null ? void 0 : lineStringCenter(lineString)?.point; + const point = center == null ? void 0 : { x: center[0], y: center[1] }; + this._previousDatumMidPoint = { datum, point }; + return point; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { strokeWidth, strokeOpacity, lineDash } = properties; + let { stroke } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + stroke = this.colorScale.convert(colorValue); + } + return { + marker: { + fill: void 0, + fillOpacity: 0, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 0, + lineDash: [0], + lineDashOffset: 0, + enabled: false + }, + line: { + stroke, + strokeWidth, + strokeOpacity, + lineDash + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idKey, idName, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + idKey, + idName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + legendItemName, + tooltip + } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const sizeValue = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (sizeValue != null && sizeKey != null) { + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: sizeValue, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + domain, + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(sizeValue) }); + } + if (colorValue != null && colorKey != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + const format = this.getItemStyle({ datumIndex, datum, colorValue, sizeValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: idValues[datumIndex], + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { + seriesId, + datum, + title, + idKey, + idName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + ...format + } + ); + } + computeFocusBounds(opts) { + const geometry = findFocusedGeoGeometry(this, opts); + return geometry ? Transformable2.toCanvas(this.contentGroup, geometry.getBBox()) : void 0; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapLineSeries.className = "MapLineSeries"; +MapLineSeries.type = "map-line"; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport95 } from "ag-charts-community"; +import { + and as and2, + arrayLength, + arrayOf as arrayOf3, + color as color3, + constant as constant12, + geoJson, + required as required12, + string as string12, + undocumented as undocumented6 +} from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs11, mapLineSeriesThemeableOptionsDef, without: without5 } = _ModuleSupport95; +var mapLineSeriesOptionsDef = { + ...without5(commonSeriesOptionsDefs11, ["highlightStyle", "highlight"]), + ...mapLineSeriesThemeableOptionsDef, + type: required12(constant12("map-line")), + idKey: required12(string12), + sizeKey: string12, + colorKey: string12, + labelKey: string12, + idName: string12, + sizeName: string12, + colorName: string12, + labelName: string12, + topology: geoJson, + topologyIdKey: string12, + legendItemName: string12, + title: string12 +}; +mapLineSeriesOptionsDef.colorRange = undocumented6(and2(arrayOf3(color3), arrayLength(1))); + +// packages/ag-charts-enterprise/src/series/map-line/mapLineModule.ts +var MapLineModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-line", + moduleFactory: (ctx) => new MapLineSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + stroke: applyMapPalette(_ModuleSupport96.SAFE_STROKE_FILL_OPERATION), + // @ts-expect-error undocumented option + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(_ModuleSupport96.SAFE_RANGE2_OPERATION) + ] + }, + strokeWidth: 1, + maxStrokeWidth: 3, + lineDash: [0], + lineDashOffset: 0, + label: { + ..._ModuleSupport96.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: applyMapPalette(_ModuleSupport96.multiSeriesHighlightStyle(false)) + }, + tooltip: { + range: "exact" + } + } +}; +var MapLineSeriesModule = { + type: "series", + name: "map-line", + chartType: "topology", + enterprise: true, + options: mapLineSeriesOptionsDef, + create: (ctx) => new MapLineSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeries.ts +import { _ModuleSupport as _ModuleSupport98 } from "ag-charts-community"; +import { Logger as Logger8 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport97 } from "ag-charts-community"; +var { Property: Property26, SeriesProperties: SeriesProperties4, makeSeriesTooltip: makeSeriesTooltip13 } = _ModuleSupport97; +var MapLineBackgroundSeriesProperties = class extends SeriesProperties4 { + constructor() { + super(...arguments); + this.topology = void 0; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tooltip = makeSeriesTooltip13(); + } +}; +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property26 +], MapLineBackgroundSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeries.ts +var { createDatumId: createDatumId11, Group: Group8, Selection: Selection7, PointerEvents: PointerEvents6 } = _ModuleSupport98; +var MapLineBackgroundSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [] + }); + this.properties = new MapLineBackgroundSeriesProperties(); + this._chartTopology = void 0; + this.itemGroup = this.contentGroup.appendChild(new Group8({ name: "itemGroup" })); + this.datumSelection = Selection7.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.itemGroup.pointerEvents = PointerEvents6.None; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get focusable() { + return false; + } + setOptionsData() { + } + setChartData() { + } + get hasData() { + return false; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 0]; + this.highlightGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 1]; + return true; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 2 /* Lines */; + geoGeometry.lineJoin = "round"; + geoGeometry.lineCap = "round"; + geoGeometry.pointerEvents = PointerEvents6.None; + return geoGeometry; + } + processData() { + const { topology } = this; + this.topologyBounds = topology?.features.reduce((current, feature) => { + const geometry = feature.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (topology == null) { + Logger8.warnOnce(`no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.`); + } + } + createNodeData() { + const { id: seriesId, topology, scale, properties } = this; + if (topology == null) + return; + const { stroke, strokeOpacity, lineDash, lineDashOffset, strokeWidth } = properties; + const nodeData = []; + const labelData = []; + for (const [index, feature] of topology.features.entries()) { + const { geometry } = feature; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (projectedGeometry == null) + continue; + nodeData.push({ + series: this, + itemId: index, + datum: feature, + datumIndex: 0, + index, + projectedGeometry, + style: { stroke, strokeOpacity, lineDash, lineDashOffset, strokeWidth } + }); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + const { nodeData = [] } = this.contextNodeData ?? {}; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId11(datum.index)); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + datumSelection.each((geoGeometry, datum) => { + const { projectedGeometry } = datum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(datum.style); + }); + } + resetAnimation() { + } + getLegendData() { + return []; + } + getTooltipContent(_seriesDatum) { + return; + } + computeFocusBounds(_opts) { + return void 0; + } + hasItemStylers() { + return false; + } +}; +MapLineBackgroundSeries.className = "MapLineBackgroundSeries"; +MapLineBackgroundSeries.type = "map-line-background"; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport99 } from "ag-charts-community"; +import { constant as constant13, geoJson as geoJson2, required as required13 } from "ag-charts-core"; +var { mapLineBackgroundSeriesThemeableOptionsDef } = _ModuleSupport99; +var mapLineBackgroundSeriesOptionsDef = { + ...mapLineBackgroundSeriesThemeableOptionsDef, + type: required13(constant13("map-line-background")), + topology: geoJson2 +}; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundModule.ts +var MapLineBackgroundModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-line-background", + moduleFactory: (ctx) => new MapLineBackgroundSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + stroke: { $path: ["/1", { $mapPalette: "stroke" }, { $mapPalette: "secondHierarchyColors" }] }, + strokeWidth: 1, + lineDash: [0], + lineDashOffset: 0 + } + } +}; +var MapLineBackgroundSeriesModule = { + type: "series", + name: "map-line-background", + chartType: "topology", + enterprise: true, + options: mapLineBackgroundSeriesOptionsDef, + create: (ctx) => new MapLineBackgroundSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerModule.ts +import { _ModuleSupport as _ModuleSupport104 } from "ag-charts-community"; +import { ValidationError, validate } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeries.ts +import { _ModuleSupport as _ModuleSupport102 } from "ag-charts-community"; +import { Logger as Logger9, cachedTextMeasurer as cachedTextMeasurer6 } from "ag-charts-core"; + +// packages/ag-charts-types/src/chart/navigatorOptions.ts +var __MINI_CHART_SERIES_OPTIONS = void 0; +var __VERIFY_MINI_CHART_SERIES_OPTIONS = void 0; +__VERIFY_MINI_CHART_SERIES_OPTIONS = __MINI_CHART_SERIES_OPTIONS; + +// packages/ag-charts-types/src/chart/themeOptions.ts +var __THEME_OVERRIDES = void 0; +var __VERIFY_THEME_OVERRIDES = void 0; +__VERIFY_THEME_OVERRIDES = __THEME_OVERRIDES; + +// packages/ag-charts-types/src/presets/gauge/commonOptions.ts +var __THEMEABLE_OPTIONS = void 0; +var __VERIFY_THEMEABLE_OPTIONS = void 0; +__VERIFY_THEMEABLE_OPTIONS = __THEMEABLE_OPTIONS; +var __AXIS_LABEL_OPTIONS = void 0; +var __VERIFY_AXIS_LABEL_OPTIONS = void 0; +__VERIFY_AXIS_LABEL_OPTIONS = __AXIS_LABEL_OPTIONS; + +// packages/ag-charts-enterprise/src/series/map-util/polygonPointSearch.ts +import { insertListItemsSorted } from "ag-charts-core"; +function polygonPointSearch(polygons, precision, valueFn) { + const bbox = polygonBbox(polygons[0], void 0); + if (bbox == null) + return; + const boundingXCenter = (bbox.lon0 + bbox.lon1) / 2; + const boundingYCenter = (bbox.lat0 + bbox.lat1) / 2; + const boundingWidth = Math.abs(bbox.lon1 - bbox.lon0); + const boundingHeight = Math.abs(bbox.lat1 - bbox.lat0); + const centroid = polygonCentroid(polygons[0]); + const [cx, cy] = centroid; + const centroidDistanceToPolygon = -polygonDistance(polygons, cx, cy); + let bestResult; + const cellValue = (distanceToPolygon, distanceToCentroid) => { + const centroidDriftFactor = 0.5; + const centroidDrift = Math.max(distanceToCentroid - centroidDistanceToPolygon, 0); + return distanceToPolygon - centroidDriftFactor * centroidDrift; + }; + const createLabelPlacement = (x2, y2, stride) => { + const { distance: distance2, maxDistance } = valueFn(polygons, x2, y2, stride); + const distanceToCentroid = Math.hypot(cx - x2, cy - y2); + const maxXTowardsCentroid = Math.min(Math.max(cx, x2 - stride / 2), x2 + stride / 2); + const maxYTowardsCentroid = Math.min(Math.max(cy, y2 - stride / 2), y2 + stride / 2); + const minDistanceToCentroid = Math.hypot(cx - maxXTowardsCentroid, cy - maxYTowardsCentroid); + const value = cellValue(distance2, distanceToCentroid); + const maxValue = cellValue(maxDistance, minDistanceToCentroid); + return { distance: distance2, maxDistance, value, maxValue, x: x2, y: y2, stride }; + }; + const appendLabelPlacement = (into, x2, y2, stride) => { + const labelPlacement = createLabelPlacement(x2, y2, stride); + if (labelPlacement.maxDistance >= 0) { + into.push(labelPlacement); + } + }; + const initialStride = Math.min(boundingWidth, boundingHeight) / 2; + let queue = { + value: createLabelPlacement(boundingXCenter, boundingYCenter, initialStride), + next: null + }; + while (queue != null) { + const item = queue.value; + const { distance: distance2, value, maxValue, x: x2, y: y2, stride } = item; + queue = queue.next; + if (distance2 > 0 && (bestResult == null || value > bestResult.value)) { + bestResult = item; + } + if (bestResult != null && maxValue - bestResult.value <= precision) { + continue; + } + const nextStride = stride / 2; + const newLabelPlacements = []; + appendLabelPlacement(newLabelPlacements, x2 - nextStride, y2 - nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 + nextStride, y2 - nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 - nextStride, y2 + nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 + nextStride, y2 + nextStride, nextStride); + newLabelPlacements.sort(labelPlacementCmp); + queue = insertListItemsSorted(queue, newLabelPlacements, labelPlacementCmp); + } + if (bestResult == null) + return; + const { distance, x, y } = bestResult; + return { x, y, distance }; +} +var labelPlacementCmp = (a, b) => b.maxValue - a.maxValue; + +// packages/ag-charts-enterprise/src/series/map-util/markerUtil.ts +function polygonMarkerCenter(polygons, precision) { + const result = polygonPointSearch(polygons, precision, (p, x2, y2, stride) => { + const distance = -polygonDistance(p, x2, y2); + const maxDistance = distance + stride * Math.SQRT2; + return { distance, maxDistance }; + }); + if (result == null) + return; + const { x, y } = result; + return [x, y]; +} +function markerPositions(geometry, precision) { + let center; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.flatMap((g) => markerPositions(g, precision)); + case "MultiPoint": + return geometry.coordinates; + case "Point": + return [geometry.coordinates]; + case "MultiPolygon": { + const polygon = largestPolygon(geometry); + center = polygon == null ? void 0 : polygonMarkerCenter(polygon, precision); + break; + } + case "Polygon": { + const polygon = geometry.coordinates; + center = polygon == null ? void 0 : polygonMarkerCenter(polygon, precision); + break; + } + case "MultiLineString": { + const lineString = largestLineString(geometry); + center = lineString == null ? void 0 : lineStringCenter(lineString)?.point; + break; + } + case "LineString": { + const lineString = geometry.coordinates; + center = lineStringCenter(lineString)?.point; + break; + } + } + return center == null ? [] : [center]; +} + +// packages/ag-charts-enterprise/src/series/map-util/shapeFillBBox.ts +import { _ModuleSupport as _ModuleSupport100 } from "ag-charts-community"; +var { BBox: BBox11 } = _ModuleSupport100; +function getTopologyShapeFillBBox(scale) { + if (!scale) + return; + const { range: range2 } = scale; + const x = range2[0][0]; + const y = range2[0][1]; + const width = range2[1][0] - x; + const height = range2[1][1] - y; + const bbox = new BBox11(x, y, width, height); + return { + series: bbox, + axis: bbox + }; +} + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport101 } from "ag-charts-community"; +var { Property: Property27, SeriesProperties: SeriesProperties5, makeSeriesTooltip: makeSeriesTooltip14, Label: Label9 } = _ModuleSupport101; +var MapMarkerSeriesLabel = class extends Label9 { + constructor() { + super(...arguments); + this.placement = "bottom"; + } +}; +__decorateClass([ + Property27 +], MapMarkerSeriesLabel.prototype, "placement", 2); +var MapMarkerSeriesProperties = class extends SeriesProperties5 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = void 0; + this.topologyIdKey = "name"; + this.idName = void 0; + this.latitudeKey = void 0; + this.latitudeName = void 0; + this.longitudeKey = void 0; + this.longitudeName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.shape = "circle"; + this.size = 6; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new MapMarkerSeriesLabel(); + this.tooltip = makeSeriesTooltip14(); + } + getStyle() { + const { size, shape, fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + size, + shape, + fill, + fillOpacity, + opacity: 1, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "latitudeKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "latitudeName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "longitudeKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "longitudeName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "shape", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "size", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "maxSize", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "sizeDomain", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property27 +], MapMarkerSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeries.ts +var { + fromToMotion: fromToMotion3, + StateMachine: StateMachine2, + getMissCount: getMissCount3, + createDatumId: createDatumId12, + SeriesNodePickMode: SeriesNodePickMode10, + valueProperty: valueProperty10, + computeMarkerFocusBounds: computeMarkerFocusBounds2, + ColorScale: ColorScale3, + LinearScale: LinearScale5, + Group: Group9, + Selection: Selection8, + Text: Text3, + Marker: Marker3, + applyShapeStyle: applyShapeStyle11, + getLabelStyles: getLabelStyles3, + LonLatBBox: LonLatBBox3, + mergeDefaults: mergeDefaults12 +} = _ModuleSupport102; +var MapMarkerSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + size: ["colorKey"], + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + size: ["sizeName"], + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode10.EXACT_SHAPE_MATCH, SeriesNodePickMode10.NEAREST_NODE], + usesPlacedLabels: true + }); + this.properties = new MapMarkerSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale3(); + this.sizeScale = new LinearScale5(); + this.markerGroup = this.contentGroup.appendChild(new Group9({ name: "markerGroup" })); + this.labelSelection = Selection8.select(this.labelGroup, Text3, false); + this.markerSelection = Selection8.select( + this.markerGroup, + Marker3, + false + ); + this.highlightMarkerSelection = Selection8.select(this.highlightGroup, Marker3); + this.animationState = new StateMachine2( + "empty", + { + empty: { + update: { + target: "ready", + action: () => this.animateMarkers() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.resetAllAnimation(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateMarkers() + }, + // chart.ts transitions to updateData on zoom change + resize: { + target: "ready", + action: () => this.resetAllAnimation() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty", + action: () => this.resetAllAnimation() + }, + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + const hasLatLon = this.properties.latitudeKey != null && this.properties.longitudeKey != null; + return super.hasData && (this.topology != null || hasLatLon); + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [3 /* Marker */, zIndex]; + this.highlightGroup.zIndex = [4 /* MarkerHighlight */, zIndex]; + return true; + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, sizeScale, colorScale } = this; + const { topologyIdKey, idKey, latitudeKey, longitudeKey, sizeKey, colorKey, labelKey, sizeDomain, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null) + continue; + featureById.set(property, feature); + } + const sizeScaleType = this.sizeScale.type; + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const hasLatLon = latitudeKey != null && longitudeKey != null; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + ...idKey == null ? [] : [ + valueProperty10(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty10(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }) + ], + ...hasLatLon ? [ + valueProperty10(latitudeKey, mercatorScaleType, { id: "latValue" }), + valueProperty10(longitudeKey, mercatorScaleType, { id: "lonValue" }) + ] : [], + ...labelKey ? [valueProperty10(labelKey, "category", { id: "labelValue" })] : [], + ...sizeKey ? [valueProperty10(sizeKey, sizeScaleType, { id: "sizeValue" })] : [], + ...colorKey ? [valueProperty10(colorKey, colorScaleType, { id: "colorValue" })] : [] + ] + }); + const featureValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `featureValue`, processedData); + const latValues = hasLatLon ? dataModel.resolveColumnById(this, `latValue`, processedData) : void 0; + const lonValues = hasLatLon ? dataModel.resolveColumnById(this, `lonValue`, processedData) : void 0; + this.topologyBounds = processedData.dataSources.get(this.id)?.data.reduce((current, _datum, datumIndex) => { + const feature = featureValues?.[datumIndex]; + const geometry = feature?.geometry; + if (geometry != null) { + current = geometryBbox(geometry, current); + } + if (latValues != null && lonValues != null) { + const lon = lonValues[datumIndex]; + const lat = latValues[datumIndex]; + current = LonLatBBox3.extend(current, lon, lat, lon, lat); + } + return current; + }, void 0); + if (sizeKey != null) { + const sizeIdx = dataModel.resolveProcessedDataIndexById(this, `sizeValue`); + const processedSize = processedData.domain.values[sizeIdx] ?? []; + sizeScale.domain = sizeDomain ?? processedSize; + } + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + this.animationState.transition("updateData"); + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount3(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelDatum(datum, labelValue, x, y, size, measurer) { + if (labelValue == null) + return; + const { + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName, + label, + shape + } = this.properties; + if (labelKey == null || !label.enabled) + return; + const { placement } = label; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const { width, height } = measurer.measureLines(String(labelText)); + const anchor = Marker3.anchor(shape); + return { + point: { x, y, size }, + label: { width, height, text: labelText }, + anchor, + placement + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, sizeScale, properties, scale } = this; + const { idKey, latitudeKey, longitudeKey, sizeKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null || scale == null) + return; + const hasLatLon = latitudeKey != null && longitudeKey != null; + const idValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `featureValue`, processedData); + const latValues = hasLatLon ? dataModel.resolveColumnById(this, `latValue`, processedData) : void 0; + const lonValues = hasLatLon ? dataModel.resolveColumnById(this, `lonValue`, processedData) : void 0; + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const sizeValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const markerMaxSize = properties.maxSize ?? properties.size; + sizeScale.range = [Math.min(properties.size, markerMaxSize), markerMaxSize]; + const measurer = cachedTextMeasurer6(label); + let projectedGeometries; + if (idValues != null && featureValues != null) { + projectedGeometries = /* @__PURE__ */ new Map(); + for (const [datumIndex] of processedData.dataSources.get(this.id)?.data.entries() ?? []) { + const id = idValues[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (id != null && projectedGeometry != null) { + projectedGeometries.set(id, projectedGeometry); + } + } + } + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues?.[datumIndex]; + const lonValue = lonValues?.[datumIndex]; + const latValue = latValues?.[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const sizeValue = sizeValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const size = sizeValue == null ? properties.size : sizeScale.convert(sizeValue, { clamp: true }); + const projectedGeometry = idValue == null ? void 0 : projectedGeometries?.get(idValue); + if (idValue != null && projectGeometry == null) { + missingGeometries.push(idValue); + } + if (lonValue != null && latValue != null) { + const [x, y] = scale.convert([lonValue, latValue]); + const labelDatum = this.getLabelDatum(datum, labelValue, x, y, size, measurer); + if (labelDatum) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: latitudeKey, + datum, + datumIndex, + index: -1, + idValue, + lonValue, + latValue, + labelValue, + sizeValue, + colorValue, + point: { x, y, size }, + midPoint: { x, y }, + legendItemName, + style: this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } else if (projectedGeometry != null) { + for (const [index, [x, y]] of markerPositions(projectedGeometry, 1).entries()) { + const labelDatum = this.getLabelDatum(datum, labelValue, x, y, size, measurer); + if (labelDatum) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: latitudeKey, + datum, + datumIndex, + index, + idValue, + lonValue, + latValue, + labelValue, + sizeValue, + colorValue, + point: { x, y, size }, + midPoint: { x, y }, + legendItemName, + style: this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } + } + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + Logger9.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + checkScaleChange() { + if (this.previousScale === this.scale) + return false; + this.previousScale = this.scale; + return true; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + const scaleChange = this.checkScaleChange(); + const { markerSelection, highlightMarkerSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + this.markerSelection = this.updateMarkerSelection({ markerData: nodeData, markerSelection }); + this.updateMarkerNodes({ markerSelection, isHighlight: false, highlightedDatum }); + this.highlightMarkerSelection = this.updateMarkerSelection({ + markerData: highlightedDatum == null ? [] : [highlightedDatum], + markerSelection: highlightMarkerSelection + }); + this.updateMarkerNodes({ + markerSelection: highlightMarkerSelection, + isHighlight: true, + highlightedDatum + }); + if (scaleChange || resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updatePlacedLabelData(labelData) { + this.labelSelection = this.labelSelection.update(labelData, (text) => { + text.pointerEvents = _ModuleSupport102.PointerEvents.None; + }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, width, height, text }, datumIndex) => { + const style = getLabelStyles3(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x + width / 2; + label.y = y + height / 2; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + updateMarkerSelection(opts) { + const { markerData, markerSelection } = opts; + return markerSelection.update( + markerData, + void 0, + (datum) => createDatumId12(datum.index, datum.idValue, datum.lonValue, datum.latValue) + ); + } + getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, isHighlight) { + const { properties, colorScale, sizeScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults12(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + baseStyle.fill = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? baseStyle.fill; + } + if (sizeValue != null) { + baseStyle.size = sizeScale.convert(sizeValue, { clamp: true }); + } + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId12(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults12(overrides, baseStyle); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateMarkerNodes(opts) { + const { markerSelection, isHighlight, highlightedDatum } = opts; + const fillBBox = getTopologyShapeFillBBox(this.scale); + markerSelection.each((marker, markerDatum) => { + const { datum, point } = markerDatum; + const style = this.getMarkerItemStyle(markerDatum, isHighlight); + marker.shape = style.shape; + marker.size = style.size; + applyShapeStyle11(marker, style, fillBBox); + marker.x = point.x; + marker.y = point.y; + marker.scalingCenterX = point.x; + marker.scalingCenterY = point.y; + marker.zIndex = !isHighlight && highlightedDatum != null && datum === highlightedDatum.datum ? 1 : 0; + }); + } + isProcessedDataAnimatable() { + return true; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + this.ctx.animationManager.skipCurrentBatch(); + this.labelSelection.cleanup(); + this.markerSelection.cleanup(); + this.highlightMarkerSelection.cleanup(); + } + animateMarkers() { + const { animationManager } = this.ctx; + const fns = prepareMapMarkerAnimationFunctions(); + fromToMotion3(this.id, "markers", animationManager, [this.markerSelection, this.highlightMarkerSelection], fns); + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + pickNodeClosestDatum(p) { + const { x: x0, y: y0 } = p; + let minDistanceSquared = Infinity; + let minDatum; + for (const datum of this.contextNodeData?.nodeData ?? []) { + const { x, y, size } = datum.point; + const dx = Math.max(Math.abs(x - x0) - size, 0); + const dy = Math.max(Math.abs(y - y0) - size, 0); + const distanceSquared = dx * dx + dy * dy; + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + } + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { shape, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + let { fill } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + fill = this.colorScale.convert(colorValue); + } + return { + marker: { + shape, + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idName, idKey, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey ?? seriesId }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + legendItemName, + tooltip + } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const sizeValue = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (sizeKey != null && sizeValue != null) { + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: sizeValue, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + domain, + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(sizeValue) }); + } + if (colorKey != null && colorValue != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + let heading; + if (idKey != null) { + heading = dataModel.resolveColumnById(this, `idValue`, processedData)[datumIndex]; + } else if (latitudeKey != null && longitudeKey != null) { + const latValue = dataModel.resolveColumnById(this, `latValue`, processedData)[datumIndex]; + const lonValue = dataModel.resolveColumnById(this, `lonValue`, processedData)[datumIndex]; + heading = `${Math.abs(latValue).toFixed(4)}\xB0 ${latValue >= 0 ? "N" : "S"}, ${Math.abs(lonValue).toFixed(4)}\xB0 ${lonValue >= 0 ? "W" : "E"}`; + } + const format = this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading, + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { + seriesId, + datum, + title, + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + ...format + } + ); + } + getFormattedMarkerStyle(markerDatum) { + const format = this.getMarkerItemStyle(markerDatum, false); + return { size: format.size, shape: format.shape }; + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds2(this, opts); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapMarkerSeries.className = "MapMarkerSeries"; +MapMarkerSeries.type = "map-marker"; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport103 } from "ag-charts-community"; +import { constant as constant14, geoJson as geoJson3, required as required14, string as string13 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs12, mapMarkerSeriesThemeableOptionsDef, without: without6 } = _ModuleSupport103; +var mapMarkerSeriesOptionsDef = { + ...without6(commonSeriesOptionsDefs12, ["highlightStyle", "highlight"]), + ...mapMarkerSeriesThemeableOptionsDef, + type: required14(constant14("map-marker")), + idKey: string13, + latitudeKey: string13, + longitudeKey: string13, + sizeKey: string13, + colorKey: string13, + labelKey: string13, + idName: string13, + latitudeName: string13, + longitudeName: string13, + sizeName: string13, + colorName: string13, + labelName: string13, + topology: geoJson3, + topologyIdKey: string13, + legendItemName: string13, + title: string13 +}; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerModule.ts +var MapMarkerModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-marker", + moduleFactory: (ctx) => new MapMarkerSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + shape: "circle", + maxSize: 30, + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $mapPalette: "fill" }, + ["gradient", _ModuleSupport104.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", _ModuleSupport104.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport104.FILL_PATTERN_DEFAULTS] + ] + }), + stroke: { $mapPalette: "stroke" }, + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(_ModuleSupport104.SAFE_RANGE2_OPERATION) + ] + }, + fillOpacity: 0.5, + label: { + ..._ModuleSupport104.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: applyMapPalette(_ModuleSupport104.multiSeriesHighlightStyle()) + }, + tooltip: { + range: "exact" + } + } +}; +var MapMarkerSeriesModule = { + type: "series", + name: "map-marker", + chartType: "topology", + enterprise: true, + options: mapMarkerSeriesOptionsDef, + create: (ctx) => new MapMarkerSeries(ctx), + validate(options, optionsDefs2, path) { + const result = validate(options, optionsDefs2, path); + const { cleared, invalid } = result; + if (cleared?.idKey == null && (cleared?.latitudeKey == null || cleared?.longitudeKey == null)) { + const extendPath = (key) => path ? `${path}.${key}` : key; + const message = `Either \`${extendPath("idKey")}\` or both \`${extendPath("latitudeKey")}\` and \`${extendPath("longitudeKey")}\` are required.`; + invalid.push(new ValidationError("required", message, null, path)); + } + return result; + } +}; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeModule.ts +import { _ModuleSupport as _ModuleSupport108 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeries.ts +import { _ModuleSupport as _ModuleSupport106 } from "ag-charts-community"; +import { + Logger as Logger10, + cachedTextMeasurer as cachedTextMeasurer7, + isArray as isArray4, + measureTextSegments as measureTextSegments3, + toPlainText as toPlainText4 +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/map-util/polygonLabelUtil.ts +function preferredLabelCenter(polygons, { aspectRatio, precision }) { + const result = polygonPointSearch(polygons, precision, (p, cx, cy, stride) => { + const width = maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(p, cx, cy, aspectRatio); + const maxWidth2 = width + 2 * stride * aspectRatio; + const distance2 = width * Math.SQRT2; + const maxDistance = maxWidth2 * Math.SQRT2; + return { distance: distance2, maxDistance }; + }); + if (result == null) + return; + const { x, y, distance } = result; + const maxWidth = distance / Math.SQRT2; + return { x, y, maxWidth }; +} +function maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(a, b, cx, cy, aspectRatio) { + const [ax, ay] = a; + const [bx, by] = b; + const positiveM = 1 / aspectRatio; + const abx = bx - ax; + const aby = by - ay; + const [topPointX, topPointY] = ay <= by ? a : b; + const [leftPointX, leftPointY] = ax <= bx ? a : b; + const [bottomPointX, bottomPointY] = ay <= by ? b : a; + const [rightPointX, rightPointY] = ax <= bx ? b : a; + let maxWidth = Infinity; + if (abx === 0) { + for (let i = 0; i <= 1; i += 1) { + const m = i === 0 ? positiveM : -positiveM; + const y = m * (ax - cx) + cy; + if (y >= topPointY && y <= bottomPointY) { + const height = Math.abs(cy - y) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } + } + } else { + const abm = aby / abx; + for (let i = 0; i <= 1; i += 1) { + const m = i === 0 ? positiveM : -positiveM; + const x = (abm * ax - ay - m * cx + cy) / (abm - m); + if (x >= leftPointX && x <= rightPointX) { + const width = Math.abs(cx - x) * 2; + maxWidth = Math.min(maxWidth, width); + } + } + } + const positiveMRecip = aspectRatio; + const centerToTopMRecip = Math.abs((topPointX - cx) / (topPointY - cy)); + const centerToBottomMRecip = Math.abs((bottomPointX - cx) / (bottomPointY - cy)); + if (bottomPointY < cy && centerToBottomMRecip < positiveMRecip) { + const height = Math.abs(cy - bottomPointY) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } else if (topPointY > cy && centerToTopMRecip < positiveMRecip) { + const height = Math.abs(cy - topPointY) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } + const centerToLeftM = Math.abs((leftPointY - cy) / (leftPointX - cx)); + const centerToRightM = Math.abs((rightPointY - cy) / (rightPointX - cx)); + if (rightPointX < cx && centerToRightM < positiveM) { + const width = Math.abs(cx - rightPointX) * 2; + maxWidth = Math.min(maxWidth, width); + } else if (leftPointX > cx && centerToLeftM < positiveM) { + const width = Math.abs(cx - leftPointX) * 2; + maxWidth = Math.min(maxWidth, width); + } + return maxWidth; +} +function maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(polygons, cx, cy, aspectRatio) { + let inside = false; + let minWidth = Infinity; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + let [x0, y0] = p0; + for (const p1 of polygon) { + const [x1, y1] = p1; + if (y1 > cy !== y0 > cy && cx < (x0 - x1) * (cy - y1) / (y0 - y1) + x1) { + inside = !inside; + } + const width = maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(p0, p1, cx, cy, aspectRatio); + minWidth = Math.min(minWidth, width); + p0 = p1; + x0 = x1; + y0 = y1; + } + } + return (inside ? 1 : -1) * minWidth; +} +function applyX(into, cx, x) { + if (x >= cx) { + into.maxX = Math.min(into.maxX, x - cx); + } + if (x <= cx) { + into.minX = Math.max(into.minX, x - cx); + } +} +function xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(into, a, b, cx, cy, height) { + const ry0 = cy - height / 2; + const ry1 = cy + height / 2; + const [ax, ay] = a; + const [bx, by] = b; + const abx = bx - ax; + const aby = by - ay; + const [leftPointX, leftPointY] = ax <= bx ? a : b; + const [rightPointX, rightPointY] = ax <= bx ? b : a; + if (abx !== 0) { + const abm = aby / abx; + for (let i = 0; i <= 1; i += 1) { + const y = i === 0 ? ry0 : ry1; + const x = (y - ay) / abm + ax; + if (x >= leftPointX && x <= rightPointX) { + applyX(into, cx, x); + } + } + } else if (Math.max(ry0, Math.min(ay, by)) <= Math.min(ry1, Math.max(ay, by))) { + applyX(into, cx, ax); + } + if (rightPointX < cx && rightPointY >= ry0 && rightPointY <= ry1) { + applyX(into, cx, rightPointX); + } else if (leftPointX > cx && leftPointY >= ry0 && leftPointY <= ry1) { + applyX(into, cx, leftPointX); + } + return into; +} +function maxWidthInPolygonForRectOfHeight(polygons, cx, cy, height) { + const result = { + minX: -Infinity, + maxX: Infinity + }; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + for (const p1 of polygon) { + xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(result, p0, p1, cx, cy, height); + p0 = p1; + } + } + const { minX, maxX } = result; + if (Number.isFinite(minX) && Number.isFinite(maxX)) { + return { x: cx + (minX + maxX) / 2, width: maxX - minX }; + } else { + return { x: cx, width: 0 }; + } +} + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport105 } from "ag-charts-community"; +var { Property: Property28, SeriesProperties: SeriesProperties6, makeSeriesTooltip: makeSeriesTooltip15 } = _ModuleSupport105; +var MapShapeSeriesProperties = class extends SeriesProperties6 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = ""; + this.idName = void 0; + this.topologyIdKey = "name"; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.padding = 0; + this.label = new AutoSizedSecondaryLabel(); + this.tooltip = makeSeriesTooltip15(); + } + getStyle() { + const { fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "padding", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property28 +], MapShapeSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeries.ts +var { + getMissCount: getMissCount4, + createDatumId: createDatumId13, + SeriesNodePickMode: SeriesNodePickMode11, + valueProperty: valueProperty11, + ColorScale: ColorScale4, + Group: Group10, + Selection: Selection9, + Text: Text4, + PointerEvents: PointerEvents7, + applyShapeStyle: applyShapeStyle12, + getLabelStyles: getLabelStyles4, + mergeDefaults: mergeDefaults13 +} = _ModuleSupport106; +var fixedScale = _ModuleSupport106.MercatorScale.fixedScale(); +var MapShapeSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode11.EXACT_SHAPE_MATCH, SeriesNodePickMode11.NEAREST_NODE] + }); + this.properties = new MapShapeSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale4(); + this.itemGroup = this.contentGroup.appendChild(new Group10({ name: "itemGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group10({ name: "itemLabelGroup" })); + this.datumSelection = Selection9.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection9.select( + this.itemLabelGroup, + Text4 + ); + this.highlightDatumSelection = Selection9.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this.previousLabelLayouts = void 0; + this._previousDatumMidPoint = void 0; + this.itemLabelGroup.pointerEvents = PointerEvents7.None; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + return super.hasData && this.topology != null; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [1 /* ShapeLine */, zIndex]; + this.highlightGroup.zIndex = [2 /* ShapeLineHighlight */, zIndex]; + return true; + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 1 /* Polygons */; + geoGeometry.lineJoin = "round"; + return geoGeometry; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, colorScale } = this; + const { topologyIdKey, idKey, colorKey, labelKey, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null || !containsType(feature.geometry, 1 /* Polygon */)) + continue; + featureById.set(property, feature); + } + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + valueProperty11(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty11(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }), + ...labelKey ? [valueProperty11(labelKey, "category", { id: "labelValue" })] : [], + ...colorKey ? [valueProperty11(colorKey, colorScaleType, { id: "colorValue" })] : [] + ] + }); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + this.topologyBounds = featureValues.reduce((current, feature) => { + const geometry = feature?.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + if (topology == null) { + Logger10.warnOnce(`no topology was provided for [MapShapeSeries]; nothing will be rendered.`); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount4(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelLayout(datum, labelValue, measurer, geometry, previousLabelLayout) { + if (labelValue == null || geometry == null) + return; + const { idKey, idName, colorKey, colorName, labelKey, labelName, padding, label } = this.properties; + if (labelKey == null || !label.enabled) + return; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const baseSize = isArray4(labelText) ? measureTextSegments3(labelText, label) : measurer.measureLines(String(labelText)); + const aspectRatio = (baseSize.width + 2 * padding) / (baseSize.height + 2 * padding); + if (previousLabelLayout?.geometry === geometry && previousLabelLayout?.labelText === labelText && previousLabelLayout?.aspectRatio === aspectRatio) { + return previousLabelLayout; + } + const fixedGeometry = projectGeometry(geometry, fixedScale); + const fixedPolygon = largestPolygon(fixedGeometry); + if (fixedPolygon == null) + return; + const labelPlacement = preferredLabelCenter(fixedPolygon, { + aspectRatio, + precision: 1e-3 + }); + if (labelPlacement == null) + return; + const { x, y, maxWidth } = labelPlacement; + return { geometry, labelText, aspectRatio, x, y, maxWidth, fixedPolygon }; + } + getLabelDatum(labelLayout, scaling) { + const { scale } = this; + if (scale == null) + return; + const { padding, label } = this.properties; + const { labelText, aspectRatio, x: untruncatedX, y, maxWidth, fixedPolygon } = labelLayout; + const maxSizeWithoutTruncation = { + width: Math.ceil(maxWidth * scaling), + height: Math.ceil(maxWidth * scaling / aspectRatio), + meta: untruncatedX + }; + const labelFormatting = formatSingleLabel( + toPlainText4(labelText), + label, + { padding }, + (height, allowTruncation) => { + if (!allowTruncation) { + return maxSizeWithoutTruncation; + } + const result = maxWidthInPolygonForRectOfHeight(fixedPolygon, untruncatedX, y, height / scaling); + return { + width: result.width * scaling, + height, + meta: result.x + }; + } + ); + if (labelFormatting == null) + return; + const [{ text, fontSize, lineHeight, width }, formattingX] = labelFormatting; + const x = width < maxSizeWithoutTruncation.width ? untruncatedX : formattingX; + const position = this.scale.convert(fixedScale.invert([x, y])); + return { + x: position[0], + y: position[1], + text, + fontSize, + lineHeight + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, properties, scale, previousLabelLayouts } = this; + const { idKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null) + return; + const scaling = scale == null ? Number.NaN : (scale.range[1][0] - scale.range[0][0]) / scale.bounds.width; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const measurer = cachedTextMeasurer7(label); + const labelLayouts = /* @__PURE__ */ new Map(); + this.previousLabelLayouts = labelLayouts; + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + if (geometry == null) { + missingGeometries.push(idValue); + } + const labelLayout = this.getLabelLayout( + datum, + labelValue, + measurer, + geometry, + previousLabelLayouts?.get(idValue) + ); + if (labelLayout != null) { + labelLayouts.set(idValue, labelLayout); + } + const labelDatum = labelLayout != null && scale != null ? this.getLabelDatum(labelLayout, scaling) : void 0; + if (labelDatum != null) { + labelData.push(labelDatum); + } + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + nodeData.push({ + series: this, + itemId: idKey, + datum, + datumIndex, + idValue, + colorValue, + labelValue, + projectedGeometry, + legendItemName, + style: this.getItemStyle({ datum, datumIndex, colorValue }, false) + }); + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + Logger10.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection, labelSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId13(datum.idValue)); + } + getItemStyle({ datumIndex, datum, colorValue }, isHighlight) { + const { properties, colorScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults13(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + baseStyle.fill = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? baseStyle.fill; + } + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId13(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults13(overrides, style); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const fillBBox = getTopologyShapeFillBBox(this.scale); + datumSelection.each((geoGeometry, nodeDatum) => { + const { projectedGeometry } = nodeDatum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + applyShapeStyle12(geoGeometry, nodeDatum.style, fillBBox); + }); + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, text, fontSize, lineHeight }, datumIndex) => { + const style = getLabelStyles4(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontFamily } = style; + label.visible = true; + label.x = x; + label.y = y; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.lineHeight = lineHeight; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + resetAnimation() { + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + datumMidPoint(datum) { + const { _previousDatumMidPoint } = this; + if (_previousDatumMidPoint?.datum === datum) { + return _previousDatumMidPoint.point; + } + const projectedGeometry = datum.projectedGeometry; + const polygon = projectedGeometry == null ? void 0 : largestPolygon(projectedGeometry); + const center = polygon == null ? void 0 : polygonMarkerCenter(polygon, 2); + const point = center == null ? void 0 : { x: center[0], y: center[1] }; + this._previousDatumMidPoint = { datum, point }; + return point; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + let { fill } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + fill = this.colorScale.convert(colorValue); + } + return { + marker: { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idKey, idName, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { idKey, idName, colorKey, colorName, labelKey, labelName, legendItemName, title, tooltip } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const idValue = dataModel.resolveColumnById(this, `idValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (colorValue != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + const format = this.getItemStyle({ datum, datumIndex, colorValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: idValue, + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { seriesId, datum, title, idKey, idName, colorKey, colorName, labelKey, labelName, ...format } + ); + } + computeFocusBounds(opts) { + return findFocusedGeoGeometry(this, opts); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapShapeSeries.className = "MapShapeSeries"; +MapShapeSeries.type = "map-shape"; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport107 } from "ag-charts-community"; +import { constant as constant15, geoJson as geoJson4, required as required15, string as string14 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs13, mapShapeSeriesThemeableOptionsDef, without: without7 } = _ModuleSupport107; +var mapShapeSeriesOptionsDef = { + ...without7(commonSeriesOptionsDefs13, ["highlightStyle", "highlight"]), + ...mapShapeSeriesThemeableOptionsDef, + type: required15(constant15("map-shape")), + idKey: required15(string14), + colorKey: string14, + labelKey: string14, + idName: string14, + colorName: string14, + labelName: string14, + topology: geoJson4, + topologyIdKey: string14, + legendItemName: string14, + title: string14 +}; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeModule.ts +var MapShapeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-shape", + moduleFactory: (ctx) => new MapShapeSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $mapPalette: "fill" }, + ["gradient", _ModuleSupport108.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", _ModuleSupport108.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport108.FILL_PATTERN_DEFAULTS] + ] + }), + stroke: { $ref: "chartBackgroundColor" }, + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(_ModuleSupport108.SAFE_RANGE2_OPERATION) + ] + }, + fillOpacity: 1, + strokeWidth: 1, + lineDash: [0], + lineDashOffset: 0, + padding: 2, + label: { + ..._ModuleSupport108.LABEL_BOXING_DEFAULTS, + color: { $ref: "chartBackgroundColor" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: "bold", + overflowStrategy: "hide" + }, + highlight: applyMapPalette(_ModuleSupport108.multiSeriesHighlightStyle(true)) + }, + tooltip: { + range: "exact" + } + } +}; +var MapShapeSeriesModule = { + type: "series", + name: "map-shape", + chartType: "topology", + enterprise: true, + options: mapShapeSeriesOptionsDef, + create: (ctx) => new MapShapeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundModule.ts +import { _ModuleSupport as _ModuleSupport112 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeries.ts +import { _ModuleSupport as _ModuleSupport110 } from "ag-charts-community"; +import { Logger as Logger11 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport109 } from "ag-charts-community"; +var { Property: Property29, SeriesProperties: SeriesProperties7, makeSeriesTooltip: makeSeriesTooltip16 } = _ModuleSupport109; +var MapShapeBackgroundSeriesProperties = class extends SeriesProperties7 { + constructor() { + super(...arguments); + this.topology = void 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tooltip = makeSeriesTooltip16(); + } +}; +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property29 +], MapShapeBackgroundSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeries.ts +var { createDatumId: createDatumId14, Selection: Selection10, Group: Group11, PointerEvents: PointerEvents8 } = _ModuleSupport110; +var MapShapeBackgroundSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [] + }); + this.properties = new MapShapeBackgroundSeriesProperties(); + this._chartTopology = void 0; + this.itemGroup = this.contentGroup.appendChild(new Group11({ name: "itemGroup" })); + this.datumSelection = Selection10.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.itemGroup.pointerEvents = PointerEvents8.None; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get focusable() { + return false; + } + setOptionsData() { + } + setChartData() { + } + getNodeData() { + return; + } + get hasData() { + return false; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 0]; + this.highlightGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 1]; + return true; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 1 /* Polygons */; + geoGeometry.lineJoin = "round"; + geoGeometry.pointerEvents = PointerEvents8.None; + return geoGeometry; + } + processData() { + const { topology } = this; + this.topologyBounds = topology?.features.reduce((current, feature) => { + const geometry = feature.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (topology == null) { + Logger11.warnOnce(`no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.`); + } + } + createNodeData() { + const { id: seriesId, topology, scale, properties } = this; + if (topology == null) + return; + const { fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + const nodeData = []; + const labelData = []; + for (const [index, feature] of topology.features.entries()) { + const { geometry } = feature; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (projectedGeometry == null) + continue; + nodeData.push({ + series: this, + itemId: index, + datum: feature, + datumIndex: 0, + index, + projectedGeometry, + style: { fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset } + }); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + const { nodeData = [] } = this.contextNodeData ?? {}; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId14(datum.index)); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + datumSelection.each((geoGeometry, datum) => { + const { projectedGeometry } = datum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(datum.style); + }); + } + resetAnimation() { + } + getLegendData() { + return []; + } + getTooltipContent(_seriesDatum) { + return; + } + pickFocus() { + return void 0; + } + computeFocusBounds(_opts) { + return void 0; + } + hasItemStylers() { + return false; + } +}; +MapShapeBackgroundSeries.className = "MapShapeBackgroundSeries"; +MapShapeBackgroundSeries.type = "map-shape-background"; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport111 } from "ag-charts-community"; +import { constant as constant16, geoJson as geoJson5, required as required16 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs14, mapShapeBackgroundSeriesThemeableOptionsDef } = _ModuleSupport111; +var mapShapeBackgroundSeriesOptionsDef = { + ...mapShapeBackgroundSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs14, + type: required16(constant16("map-shape-background")), + topology: geoJson5 +}; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundModule.ts +var MapShapeBackgroundModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-shape-background", + moduleFactory: (ctx) => new MapShapeBackgroundSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $path: ["/1", { $mapPalette: "fill" }, { $mapPalette: "hierarchyColors" }] }, + ["gradient", _ModuleSupport112.FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS], + ["image", _ModuleSupport112.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport112.FILL_PATTERN_HIERARCHY_DEFAULTS] + ] + }), + stroke: { $ref: "chartBackgroundColor" }, + strokeWidth: 1 + } + } +}; +var MapShapeBackgroundSeriesModule = { + type: "series", + name: "map-shape-background", + chartType: "topology", + enterprise: true, + options: mapShapeBackgroundSeriesOptionsDef, + create: (ctx) => new MapShapeBackgroundSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleModule.ts +import { _ModuleSupport as _ModuleSupport121 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeries.ts +import { _ModuleSupport as _ModuleSupport118 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBase.ts +import { _ModuleSupport as _ModuleSupport114 } from "ag-charts-community"; +import { isDefined } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/util/radialUtil.ts +import { _ModuleSupport as _ModuleSupport113 } from "ag-charts-community"; +var { createDatumId: createDatumId15, mergeDefaults: mergeDefaults14, toHighlightString: toHighlightString4 } = _ModuleSupport113; +function makeStylerParams(series, highlighted, highlightStateEnum) { + const { id: seriesId } = series; + const { + angleKey, + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + radiusKey, + stackGroup, + stroke, + strokeOpacity, + strokeWidth + } = series.properties; + const highlightState = toHighlightString4(highlightStateEnum ?? _ModuleSupport113.HighlightState.None); + return { + angleKey, + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + radiusKey, + seriesId, + stackGroup, + stroke, + strokeOpacity, + strokeWidth + }; +} +function getStyle(series, ignoreStylerCallback, highlighted, highlightState) { + const { styler } = series.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = makeStylerParams(series, highlighted, highlightState); + stylerResult = series.ctx.optionsGraphService.resolvePartial( + ["series", `${series.declarationOrder}`], + series.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? series.properties.cornerRadius, + fill: stylerResult.fill ?? series.properties.fill, + fillOpacity: stylerResult.fillOpacity ?? series.properties.fillOpacity, + lineDash: stylerResult.lineDash ?? series.properties.lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? series.properties.lineDashOffset, + stroke: stylerResult.stroke ?? series.properties.stroke, + strokeOpacity: stylerResult.strokeOpacity ?? series.properties.strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? series.properties.strokeWidth, + opacity: 1 + }; +} +function makeItemStylerParams(series, nodeDatum, isHighlight, style) { + const { id: seriesId, properties } = series; + const { angleKey, radiusKey } = properties; + const activeHighlight = series.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = series.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = series.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + highlighted: isHighlight, + highlightState: highlightStateString, + angleKey, + radiusKey, + ...style, + fill + }; +} +function getItemStyle(series, nodeDatum, isHighlight, highlightState) { + const { properties } = series; + const { itemStyler } = properties; + const highlightStyle = series.getHighlightStyle(isHighlight, nodeDatum?.datumIndex, highlightState); + const baseStyle = mergeDefaults14( + highlightStyle, + getStyle(series, nodeDatum === void 0, isHighlight, highlightState) + ); + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = series.cachedDatumCallback( + createDatumId15(series.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = makeItemStylerParams(series, nodeDatum, isHighlight, style); + return series.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults14(overrides, style); + } + } + return style; +} + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBase.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS, + DEFAULT_POLAR_DIRECTION_NAMES, + ChartAxisDirection: ChartAxisDirection16, + PolarAxis, + diff: diff6, + fixNumericExtent: fixNumericExtent7, + groupAccumulativeValueProperty, + keyProperty: keyProperty8, + normaliseGroupTo, + resetLabelFn: resetLabelFn5, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation5, + seriesLabelFadeOutAnimation, + valueProperty: valueProperty12, + animationValidation: animationValidation7, + createDatumId: createDatumId16, + SeriesNodePickMode: SeriesNodePickMode12, + normalizeAngle360: normalizeAngle3605, + CategoryScale: CategoryScale3, + motion: motion6, + applyShapeStyle: applyShapeStyle13, + isGradientFill: isGradientFill2, + updateLabelNode: updateLabelNode6, + getItemStyles: getItemStyles3 +} = _ModuleSupport114; +var RadialColumnSeriesNodeEvent = class extends _ModuleSupport114.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadialColumnSeriesBase = class extends _ModuleSupport114.PolarSeries { + constructor(moduleCtx, { + animationResetFns + }) { + super({ + moduleCtx, + categoryKey: "angleValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES, + canHaveAxes: true, + pickModes: [SeriesNodePickMode12.NEAREST_NODE, SeriesNodePickMode12.EXACT_SHAPE_MATCH], + animationResetFns: { + ...animationResetFns, + label: resetLabelFn5 + } + }); + this.NodeEvent = RadialColumnSeriesNodeEvent; + this.groupScale = new CategoryScale3(); + this.circleCache = { r: 0, cx: 0, cy: 0 }; + } + get hasData() { + return this.getHasData("radiusValue-raw"); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection16.Angle) { + return dataModel.getDomain(this, "angleValue", "key", processedData); + } else { + const yExtent = dataModel.getDomain(this, "radiusValue-end", "value", processedData); + const fixedYExtent = Number.isFinite(yExtent[1] - yExtent[0]) ? [Math.min(yExtent[0], 0), Math.max(yExtent[1], 0)] : []; + return fixNumericExtent7(fixedYExtent); + } + } + async processData(dataController) { + const { angleKey, radiusKey, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const stackGroupId = this.getStackId(); + const stackGroupTrailingId = `${stackGroupId}-trailing`; + const extraProps = []; + if (isDefined(normalizedTo)) { + extraProps.push(normaliseGroupTo([stackGroupId, stackGroupTrailingId], Math.abs(normalizedTo))); + } + if (animationEnabled && this.processedData) { + extraProps.push(diff6(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation7()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const radiusScaleType = this.axes[ChartAxisDirection16.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection16.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty8(angleKey, angleScaleType, { id: "angleValue" }), + valueProperty12(radiusKey, radiusScaleType, { + id: "radiusValue-raw", + invalidValue: null, + ...visibleProps + }), + ...groupAccumulativeValueProperty( + radiusKey, + "normal", + { + id: `radiusValue-end`, + rangeId: `radiusValue-range`, + invalidValue: null, + groupId: stackGroupId, + separateNegative: true, + ...visibleProps + }, + radiusScaleType + ), + ...groupAccumulativeValueProperty( + radiusKey, + "trailing", + { + id: `radiusValue-start`, + invalidValue: null, + groupId: stackGroupTrailingId, + separateNegative: true, + ...visibleProps + }, + radiusScaleType + ), + ...extraProps + ], + groupByKeys: true, + groupByData: false + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (r !== cache.r || cx !== cache.cx || cy !== cache.cy) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + isRadiusAxisReversed() { + return this.axes[ChartAxisDirection16.Radius]?.isReversed(); + } + maybeRefreshNodeData() { + const circleChanged = this.didCircleChange(); + if (!circleChanged && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection16.Radius]; + return radiusAxis instanceof PolarAxis ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + createNodeData() { + const { processedData, dataModel, groupScale } = this; + if (!dataModel || !processedData || processedData.type !== "grouped") + return; + const angleAxis = this.axes[ChartAxisDirection16.Angle]; + const radiusAxis = this.axes[ChartAxisDirection16.Radius]; + const angleScale = angleAxis?.scale; + const radiusScale = radiusAxis?.scale; + if (!angleScale || !radiusScale) { + return; + } + const angleValues = dataModel.resolveKeysById(this, `angleValue`, processedData); + const radiusStartValues = dataModel.resolveColumnById(this, `radiusValue-start`, processedData); + const radiusEndValues = dataModel.resolveColumnById(this, `radiusValue-end`, processedData); + const radiusRawValues = dataModel.resolveColumnById(this, `radiusValue-raw`, processedData); + const radiusRangeIndex = dataModel.resolveProcessedDataIndexById(this, `radiusValue-range`); + let groupPaddingInner = 0; + let groupPaddingOuter = 0; + if (angleAxis instanceof AngleCategoryAxis) { + groupPaddingInner = angleAxis.groupPaddingInner; + groupPaddingOuter = angleAxis.paddingInner; + } + const groupAngleStep = angleScale.bandwidth ?? 0; + const paddedGroupAngleStep = groupAngleStep * (1 - groupPaddingOuter); + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + groupScale.domain = Array.from({ length: visibleGroupCount }).map((_, i) => String(i)); + groupScale.range = [-paddedGroupAngleStep / 2, paddedGroupAngleStep / 2]; + groupScale.paddingInner = visibleGroupCount > 1 ? groupPaddingInner : 0; + const radiusAxisReversed = this.isRadiusAxisReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const axisTotalRadius = axisOuterRadius + axisInnerRadius; + const { angleKey, radiusKey, angleName, radiusName, legendItemName, label } = this.properties; + const radiusDomain = this.getSeriesDomain(ChartAxisDirection16.Radius); + const getLabelNodeDatum = (datum, radiusDatum, x, y) => { + const labelText = this.getLabelText( + radiusDatum, + datum, + radiusKey, + "radius", + radiusDomain, + label, + { value: radiusDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + return { x, y, text: labelText, textAlign: "center", textBaseline: "middle" }; + } + }; + const nodeData = []; + const styles = getItemStyles3( + (nodeDatum, isHighlight, highlightState) => getItemStyle(this, nodeDatum, isHighlight, highlightState) + ); + const context = { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + if (!this.visible) + return context; + const { dataSources } = processedData; + const rawData = dataSources.get(this.id)?.data ?? []; + for (const { datumIndex, group } of dataModel.forEachGroupDatum(this, processedData)) { + const datum = rawData[datumIndex]; + const angleDatum = angleValues[datumIndex]; + if (angleDatum == null) + return; + const radiusDatum = radiusRawValues[datumIndex]; + const isPositive = radiusDatum >= 0 && !Object.is(radiusDatum, -0); + const innerRadiusDatum = radiusStartValues[datumIndex]; + const outerRadiusDatum = radiusEndValues[datumIndex]; + const radiusRange = group.aggregation[radiusRangeIndex][isPositive ? 1 : 0] ?? 0; + const negative = isPositive === radiusAxisReversed; + if (innerRadiusDatum === void 0 || outerRadiusDatum === void 0) + return; + let startAngle; + let endAngle; + if (rawData.length === 1) { + startAngle = -0.5 * Math.PI; + endAngle = 1.5 * Math.PI; + } else { + const groupAngle = angleScale.convert(angleDatum); + startAngle = normalizeAngle3605(groupAngle + groupScale.convert(String(groupIndex))); + endAngle = normalizeAngle3605(startAngle + groupScale.bandwidth); + } + const angle = startAngle + groupScale.bandwidth / 2; + const innerRadius = axisTotalRadius - radiusScale.convert(innerRadiusDatum); + const outerRadius = axisTotalRadius - radiusScale.convert(outerRadiusDatum); + const midRadius = (innerRadius + outerRadius) / 2; + const stackInnerRadius = axisTotalRadius - radiusScale.convert(0); + const stackOuterRadius = axisTotalRadius - radiusScale.convert(radiusRange); + const x = Math.cos(angle) * midRadius; + const y = Math.sin(angle) * midRadius; + const labelNodeDatum = this.properties.label.enabled ? getLabelNodeDatum(datum, radiusDatum, x, y) : void 0; + const columnWidth = this.getColumnWidth(startAngle, endAngle); + nodeData.push({ + series: this, + datum, + datumIndex, + point: { x, y, size: 0 }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + negative, + innerRadius, + outerRadius, + stackInnerRadius, + stackOuterRadius, + startAngle, + endAngle, + midAngle: angle, + axisInnerRadius, + axisOuterRadius, + columnWidth, + index: datumIndex + }); + } + return { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + } + getColumnWidth(_startAngle, _endAngle) { + return Number.NaN; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updateSectorSelection(this.itemSelection, false); + this.updateSectorSelection(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateSectorSelection(selection, isHighlight) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + let selectionData = []; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + if (isHighlight) { + if (activeHighlight?.datum && activeHighlight.series === this) { + selectionData.push(activeHighlight); + } + } else { + selectionData = this.nodeData; + } + const radiusAxisReversed = this.isRadiusAxisReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const fillBBox = this.getShapeFillBBox(); + const hasItemStylers = this.hasItemStylers(); + selection.update(selectionData, void 0, (datum) => this.getDatumId(datum)).each((node, nodeDatum) => { + const { midPoint } = nodeDatum; + if (hasItemStylers) { + const highlightState = this.getHighlightState(activeHighlight, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = getItemStyle(this, nodeDatum, isHighlight, highlightState); + } + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + const fill = style.fill; + const itemBounds = isGradientFill2(fill) && fill.bounds === "item"; + const fillParams = itemBounds ? { centerX: midPoint?.x ?? 0, centerY: midPoint?.y ?? 0 } : { centerX: 0, centerY: 0, innerRadius: axisInnerRadius, outerRadius: axisOuterRadius }; + this.updateItemPath(node, nodeDatum, isHighlight); + applyShapeStyle13(node, style, fillBBox, fillParams); + node.cornerRadius = style.cornerRadius ?? 0; + node.lineJoin = "round"; + }); + } + updateLabels() { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + updateLabelNode6(this, node, this.properties, this.properties.label, datum.label, false, activeHighlight); + node.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + }); + } + animateEmptyUpdateReady() { + const { labelSelection } = this; + const fns = this.getColumnTransitionFunctions(); + motion6.fromToMotion(this.id, "datums", this.ctx.animationManager, [this.itemSelection], fns); + seriesLabelFadeInAnimation5(this, "labels", this.ctx.animationManager, labelSelection); + } + animateClearingUpdateEmpty() { + const { itemSelection } = this; + const { animationManager } = this.ctx; + const fns = this.getColumnTransitionFunctions(); + motion6.fromToMotion(this.id, "datums", animationManager, [itemSelection], fns); + seriesLabelFadeOutAnimation(this, "labels", animationManager, this.labelSelection); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip } = properties; + const angleAxis = axes[ChartAxisDirection16.Angle]; + const radiusAxis = axes[ChartAxisDirection16.Radius]; + const nodeDatum = this.nodeData?.[datumIndex]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis || !nodeDatum) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const angleValue = dataModel.resolveKeysById(this, `angleValue`, processedData)[datumIndex]; + const radiusValue = dataModel.resolveColumnById(this, `radiusValue-raw`, processedData)[datumIndex]; + if (angleValue == null) + return; + const format = getItemStyle(this, nodeDatum, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: radiusName, + fallbackLabel: radiusKey, + value: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + angleName, + radiusKey, + radiusName, + legendItemName, + ...format + } + ); + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.itemSelection.nodes()); + } + legendItemSymbol() { + const { fill, stroke, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = getStyle( + this, + false, + false, + _ModuleSupport114.HighlightState.None + ); + const markerStyle = { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + if (_ModuleSupport114.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: markerStyle + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { radiusKey, radiusName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: radiusKey, + seriesId, + enabled: visible, + label: { + text: legendItemName ?? radiusName ?? radiusKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getDatumId(datum) { + return createDatumId16(datum.angleValue); + } + computeLabelsBBox() { + return null; + } +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBaseProperties.ts +import { _ModuleSupport as _ModuleSupport115 } from "ag-charts-community"; +var { SeriesProperties: SeriesProperties8, makeSeriesTooltip: makeSeriesTooltip17, Property: Property30, Label: Label10 } = _ModuleSupport115; +var RadialColumnSeriesBaseProperties = class extends SeriesProperties8 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.label = new Label10(); + this.tooltip = makeSeriesTooltip17(); + } + getStyle() { + const { fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "angleKey", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "angleName", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "radiusName", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "fill", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "stroke", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "lineDash", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "styler", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "rotation", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "stackGroup", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "normalizedTo", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "label", 2); +__decorateClass([ + Property30 +], RadialColumnSeriesBaseProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleUtil.ts +import { _ModuleSupport as _ModuleSupport117 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnUtil.ts +import { _ModuleSupport as _ModuleSupport116 } from "ag-charts-community"; +var { motion: motion7 } = _ModuleSupport116; +function createAngleMotionCalculator() { + const angles = { + startAngle: /* @__PURE__ */ new Map(), + endAngle: /* @__PURE__ */ new Map() + }; + const angleKeys = ["startAngle", "endAngle"]; + const calculate = (node, datum, status) => { + for (const key of angleKeys) { + const map = angles[key]; + let from2 = (status === "removed" || status === "updated" ? node : datum)[key]; + let to2 = (status === "removed" ? node : datum)[key]; + if (Number.isNaN(to2)) { + to2 = node.previousDatum?.[key] ?? Number.NaN; + } + const diff8 = from2 - to2; + if (Math.abs(diff8) > Math.PI) { + from2 -= Math.sign(diff8) * 2 * Math.PI; + } + map.set(datum, { from: from2, to: to2 }); + } + }; + const getAngles = (datum, fromToKey) => { + return { + startAngle: angles.startAngle.get(datum)[fromToKey], + endAngle: angles.endAngle.get(datum)[fromToKey] + }; + }; + const from = (datum) => getAngles(datum, "from"); + const to = (datum) => getAngles(datum, "to"); + return { calculate, from, to }; +} +function fixRadialColumnAnimationStatus(node, datum, status) { + if (status === "updated") { + if (node.previousDatum == null || Number.isNaN(node.previousDatum.startAngle) || Number.isNaN(node.previousDatum.endAngle)) { + return "added"; + } + if (Number.isNaN(datum.startAngle) || Number.isNaN(datum.endAngle)) { + return "removed"; + } + } + if (status === "added" && node.previousDatum != null) { + return "updated"; + } + return status; +} +function prepareRadialColumnAnimationFunctions(axisZeroRadius) { + const angles = createAngleMotionCalculator(); + const fromFn = (node, datum, status) => { + status = fixRadialColumnAnimationStatus(node, datum, status); + angles.calculate(node, datum, status); + const { startAngle, endAngle } = angles.from(datum); + let innerRadius; + let outerRadius; + let columnWidth; + let axisInnerRadius; + let axisOuterRadius; + if (status === "removed" || status === "updated") { + innerRadius = node.innerRadius; + outerRadius = node.outerRadius; + columnWidth = node.columnWidth; + axisInnerRadius = node.axisInnerRadius; + axisOuterRadius = node.axisOuterRadius; + } else { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + columnWidth = datum.columnWidth; + axisInnerRadius = datum.axisInnerRadius; + axisOuterRadius = datum.axisOuterRadius; + } + const phase = motion7.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { + innerRadius, + outerRadius, + columnWidth, + axisInnerRadius, + axisOuterRadius, + startAngle, + endAngle, + phase + }; + }; + const toFn = (node, datum, status) => { + const { startAngle, endAngle } = angles.to(datum); + let innerRadius; + let outerRadius; + let columnWidth; + let axisInnerRadius; + let axisOuterRadius; + if (status === "removed") { + innerRadius = node.innerRadius; + outerRadius = node.innerRadius; + columnWidth = node.columnWidth; + axisInnerRadius = node.axisInnerRadius; + axisOuterRadius = node.axisOuterRadius; + } else { + innerRadius = Number.isNaN(datum.innerRadius) ? axisZeroRadius : datum.innerRadius; + outerRadius = Number.isNaN(datum.outerRadius) ? axisZeroRadius : datum.outerRadius; + columnWidth = Number.isNaN(datum.columnWidth) ? node.columnWidth : datum.columnWidth; + axisInnerRadius = datum.axisInnerRadius; + axisOuterRadius = datum.axisOuterRadius; + } + return { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle }; + }; + return { toFn, fromFn }; +} +function resetRadialColumnSelectionFn(_node, { + innerRadius, + outerRadius, + columnWidth, + axisInnerRadius, + axisOuterRadius, + startAngle, + endAngle +}) { + return { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle }; +} + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleUtil.ts +var { SectorBox, motion: motion8 } = _ModuleSupport117; +function getRadii(datum) { + const { negative, innerRadius, outerRadius, stackInnerRadius, stackOuterRadius } = datum; + return { + innerRadius: negative ? stackOuterRadius : stackInnerRadius, + outerRadius: negative ? stackInnerRadius : stackOuterRadius, + clipInnerRadius: negative ? outerRadius : innerRadius, + clipOuterRadius: negative ? innerRadius : outerRadius + }; +} +function prepareNightingaleAnimationFunctions(axisZeroRadius) { + const angles = createAngleMotionCalculator(); + const fromFn = (sect, datum, status) => { + status = fixRadialColumnAnimationStatus(sect, datum, status); + angles.calculate(sect, datum, status); + const { startAngle, endAngle } = angles.from(datum); + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed" || status === "updated") { + innerRadius = sect.innerRadius; + outerRadius = sect.outerRadius; + clipSector = sect.clipSector; + } else { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + } + clipSector ?? (clipSector = new SectorBox(startAngle, endAngle, innerRadius, outerRadius)); + const phase = motion8.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { innerRadius, outerRadius, startAngle, endAngle, clipSector, phase }; + }; + const toFn = (_sect, datum, status) => { + const { startAngle, endAngle } = angles.to(datum); + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed") { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + clipSector = new SectorBox(startAngle, endAngle, innerRadius, outerRadius); + } else { + let clipInnerRadius, clipOuterRadius; + ({ innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum)); + if (Number.isNaN(innerRadius)) + innerRadius = axisZeroRadius; + if (Number.isNaN(outerRadius)) + outerRadius = axisZeroRadius; + if (Number.isNaN(clipInnerRadius)) + clipInnerRadius = axisZeroRadius; + if (Number.isNaN(clipOuterRadius)) + clipOuterRadius = axisZeroRadius; + clipSector = new SectorBox(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + } + return { innerRadius, outerRadius, startAngle, endAngle, clipSector }; + }; + return { toFn, fromFn }; +} +function resetNightingaleSelectionFn(_sect, datum) { + const { startAngle, endAngle } = datum; + const { innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum); + const clipSector = new SectorBox(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + return { innerRadius, outerRadius, startAngle, endAngle, clipSector }; +} + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeries.ts +var { Sector: Sector4, SectorBox: SectorBox2, PolarZIndexMap } = _ModuleSupport118; +var NightingaleSeries = class extends RadialColumnSeriesBase { + // TODO: Enable once the options contract has been revisited + // @TempValidate + // sectorSpacing = 1; + constructor(moduleCtx) { + super(moduleCtx, { animationResetFns: { item: resetNightingaleSelectionFn } }); + this.properties = new RadialColumnSeriesBaseProperties(); + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0, PolarZIndexMap.FOREGROUND, zIndex]; + this.highlightGroup.zIndex = [0, PolarZIndexMap.HIGHLIGHT, zIndex]; + this.labelGroup.zIndex = [0, PolarZIndexMap.LABEL, zIndex]; + return true; + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `nightingale-stack-${groupIndex}-yValues`; + } + nodeFactory() { + return new Sector4(); + } + updateItemPath(node, datum, highlight) { + const { negative } = datum; + node.centerX = 0; + node.centerY = 0; + node.startOuterCornerRadius = negative ? 0 : this.properties.cornerRadius; + node.endOuterCornerRadius = negative ? 0 : this.properties.cornerRadius; + node.startInnerCornerRadius = negative ? this.properties.cornerRadius : 0; + node.endInnerCornerRadius = negative ? this.properties.cornerRadius : 0; + if (highlight) { + const { startAngle, endAngle } = datum; + const { innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum); + node.innerRadius = innerRadius; + node.outerRadius = outerRadius; + node.startAngle = startAngle; + node.endAngle = endAngle; + node.clipSector = new SectorBox2(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + } + } + getColumnTransitionFunctions() { + const axisZeroRadius = this.isRadiusAxisReversed() ? this.radius : this.getAxisInnerRadius(); + return prepareNightingaleAnimationFunctions(axisZeroRadius); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +NightingaleSeries.className = "NightingaleSeries"; +NightingaleSeries.type = "nightingale"; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport119 } from "ag-charts-community"; +import { boolean as boolean8, constant as constant17, number as number7, required as required17, string as string15 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs15, nightingaleSeriesThemeableOptionsDef } = _ModuleSupport119; +var nightingaleSeriesOptionsDef = { + ...commonSeriesOptionsDefs15, + ...nightingaleSeriesThemeableOptionsDef, + type: required17(constant17("nightingale")), + angleKey: required17(string15), + radiusKey: required17(string15), + angleName: string15, + radiusName: string15, + legendItemName: string15, + grouped: boolean8, + stacked: boolean8, + stackGroup: string15, + normalizedTo: number7 +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleThemes.ts +import { _ModuleSupport as _ModuleSupport120 } from "ag-charts-community"; +var { + ThemeConstants: { POLAR_AXIS_TYPE, POLAR_AXIS_SHAPE }, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS4, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS2 +} = _ModuleSupport120; +var NIGHTINGALE_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_SERIES_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS4], + ["pattern", FILL_PATTERN_DEFAULTS2] + ] + }, + stroke: { + $if: [{ $eq: [{ $palette: "type" }, "inbuilt"] }, { $ref: "chartBackgroundColor" }, { $palette: "stroke" }] + }, + strokeWidth: 1, + label: { + ..._ModuleSupport120.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: _ModuleSupport120.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE.ANGLE_CATEGORY]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE.CIRCLE }, + groupPaddingInner: 0, + paddingInner: 0, + label: { + spacing: 10 + } + }, + [POLAR_AXIS_TYPE.RADIUS_NUMBER]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE.CIRCLE } + } + } +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleModule.ts +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE2 } +} = _ModuleSupport121; +var NightingaleModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "nightingale", + moduleFactory: (ctx) => new NightingaleSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE2.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE2.RADIUS_NUMBER }], + themeTemplate: NIGHTINGALE_SERIES_THEME, + stackable: true, + groupable: true, + stackedByDefault: true +}; +var NightingaleSeriesModule = { + type: "series", + name: "nightingale", + chartType: "polar", + enterprise: true, + options: nightingaleSeriesOptionsDef, + create: (ctx) => new NightingaleSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeries.ts +import { + _ModuleSupport as _ModuleSupport123 +} from "ag-charts-community"; +import { + cachedTextMeasurer as cachedTextMeasurer8, + isArray as isArray5, + measureTextSegments as measureTextSegments4, + toPlainText as toPlainText5 +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidProperties.ts +import { _ModuleSupport as _ModuleSupport122 } from "ag-charts-community"; +var { SeriesProperties: SeriesProperties9, makeSeriesTooltip: makeSeriesTooltip18, Property: Property31, Label: Label11, DropShadow: DropShadow5 } = _ModuleSupport122; +var PyramidSeriesLabel = class extends Label11 { +}; +var PyramidSeriesStageLabel = class extends Label11 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property31 +], PyramidSeriesStageLabel.prototype, "spacing", 2); +__decorateClass([ + Property31 +], PyramidSeriesStageLabel.prototype, "placement", 2); +var PyramidProperties = class extends SeriesProperties9 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.direction = "vertical"; + this.reverse = void 0; + this.spacing = 0; + this.aspectRatio = void 0; + this.shadow = new DropShadow5().set({ enabled: false }); + this.label = new PyramidSeriesLabel(); + this.stageLabel = new PyramidSeriesStageLabel(); + this.tooltip = makeSeriesTooltip18(); + } + getStyle(index = 0) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index % fills.length], + fillOpacity, + stroke: strokes[index % strokes.length], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property31 +], PyramidProperties.prototype, "stageKey", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "valueKey", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "fills", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "strokes", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "lineDash", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "direction", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "reverse", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "spacing", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "aspectRatio", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "shadow", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "label", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property31 +], PyramidProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidUtil.ts +function applyPyramidDatum(connector, { x, y, top, right, bottom, left }) { + connector.x0 = x - top / 2; + connector.x1 = x + top / 2; + connector.x2 = x + bottom / 2; + connector.x3 = x - bottom / 2; + connector.y0 = y - left / 2; + connector.y1 = y - right / 2; + connector.y2 = y + right / 2; + connector.y3 = y + left / 2; +} +function preparePyramidAnimationFunctions(direction) { + const fromFn = (_connector, datum) => { + const { x, y } = datum; + let { top, right, bottom, left } = datum; + if (direction === "vertical") { + top = 0; + bottom = 0; + } else { + left = 0; + right = 0; + } + return { x, y, top, right, bottom, left }; + }; + const toFn = (_connector, datum) => { + const { x, y, top, right, bottom, left } = datum; + return { x, y, top, right, bottom, left }; + }; + const applyFn = applyPyramidDatum; + return { fromFn, toFn, applyFn }; +} + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeries.ts +var { + StateMachine: StateMachine3, + valueProperty: valueProperty13, + SeriesNodePickMode: SeriesNodePickMode13, + createDatumId: createDatumId17, + BBox: BBox12, + Group: Group12, + Selection: Selection11, + Text: Text5, + PointerEvents: PointerEvents9, + applyShapeStyle: applyShapeStyle14, + mergeDefaults: mergeDefaults15, + fromToMotion: fromToMotion4, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation6, + getLabelStyles: getLabelStyles5 +} = _ModuleSupport123; +var PyramidSeries = class extends _ModuleSupport123.DataModelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [SeriesNodePickMode13.EXACT_SHAPE_MATCH, SeriesNodePickMode13.NEAREST_NODE] + }); + this.properties = new PyramidProperties(); + this.itemGroup = this.contentGroup.appendChild(new Group12({ name: "itemGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group12({ name: "itemLabelGroup" })); + this.stageLabelGroup = this.contentGroup.appendChild(new Group12({ name: "stageLabelGroup" })); + this.datumSelection = Selection11.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection11.select( + this.itemLabelGroup, + Text5 + ); + this.stageLabelSelection = Selection11.select(this.stageLabelGroup, Text5); + this.highlightDatumSelection = Selection11.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this.animationState = new StateMachine3( + "empty", + { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + clear: "empty", + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + this.itemLabelGroup.pointerEvents = PointerEvents9.None; + this.stageLabelGroup.pointerEvents = PointerEvents9.None; + } + addChartEventListeners() { + this.cleanup.register(this.ctx.eventsHub.on("legend:item-click", (event) => this.onLegendItemClick(event))); + } + nodeFactory() { + return new FunnelConnector(); + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + async processData(dataController) { + if (this.data == null) + return; + const { + id: seriesId, + visible, + ctx: { legendManager } + } = this; + const { stageKey, valueKey } = this.properties; + const xScaleType = "category"; + const yScaleType = "number"; + const validation = (_value, _datum, index) => visible && legendManager.getItemEnabled({ seriesId, itemId: index }); + const visibleProps = this.visible ? {} : { forceValue: 0 }; + await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty13(stageKey, xScaleType, { id: "xValue" }), + valueProperty13(valueKey, yScaleType, { id: `yValue`, ...visibleProps, validation, invalidValue: 0 }) + ] + }); + } + createNodeData() { + const { + id: seriesId, + dataModel, + processedData, + properties, + visible, + ctx: { legendManager } + } = this; + const { + stageKey, + valueKey, + direction, + reverse = direction === "horizontal", + spacing, + aspectRatio, + label, + stageLabel + } = properties; + if (dataModel == null || processedData == null) + return; + const horizontal = direction === "horizontal"; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const xDomain = dataModel.getDomain(this, "xValue", "value", processedData); + const yDomain = dataModel.getDomain(this, "yValue", "value", processedData); + const textMeasurer = cachedTextMeasurer8(stageLabel); + let textAlign; + let textBaseline; + if (horizontal) { + textAlign = "center"; + textBaseline = stageLabel.placement === "before" ? "bottom" : "top"; + } else { + textAlign = stageLabel.placement === "after" ? "left" : "right"; + textBaseline = "middle"; + } + const stageLabelData = stageLabel.enabled ? [] : void 0; + let maxLabelWidth = 0; + let maxLabelHeight = 0; + let yTotal = 0; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + const enabled = visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + yTotal += yValue; + if (stageLabelData == null) + continue; + const text = this.getLabelText( + xValue2, + datum, + stageKey, + "x", + xDomain, + this.properties.stageLabel, + { datum, value: yValue, stageKey, valueKey } + ); + const { width, height } = isArray5(text) ? measureTextSegments4(text, label) : textMeasurer.measureLines(text); + maxLabelWidth = Math.max(maxLabelWidth, width); + maxLabelHeight = Math.max(maxLabelHeight, height); + stageLabelData.push({ + x: Number.NaN, + y: Number.NaN, + text, + textAlign, + textBaseline, + visible: enabled + }); + } + const seriesRectWidth = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const seriesRectHeight = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const totalSpacing = spacing * (processedData.input.count - 1); + let bounds; + if (horizontal) { + const verticalInset = maxLabelHeight + stageLabel.spacing; + bounds = new BBox12( + 0, + stageLabel.placement === "before" ? verticalInset : 0, + seriesRectWidth, + seriesRectHeight - verticalInset + ); + } else { + const horizontalInset = maxLabelWidth + stageLabel.spacing; + bounds = new BBox12( + stageLabel.placement === "after" ? 0 : horizontalInset, + 0, + seriesRectWidth - horizontalInset, + seriesRectHeight + ); + } + if (aspectRatio != null && aspectRatio !== 0) { + const directionalAspectRatio = direction === "horizontal" ? 1 / aspectRatio : aspectRatio; + const constrainedWidth = Math.min(bounds.width, bounds.height * directionalAspectRatio); + const constrainedHeight = constrainedWidth / directionalAspectRatio; + bounds = new BBox12( + bounds.x + (bounds.width - constrainedWidth) / 2, + bounds.y + (bounds.height - constrainedHeight) / 2, + constrainedWidth, + constrainedHeight + ); + } + let labelX; + let labelY; + if (horizontal) { + labelY = stageLabel.placement === "before" ? bounds.y - stageLabel.spacing : bounds.y + bounds.height + stageLabel.spacing; + } else { + labelX = stageLabel.placement === "after" ? bounds.x + bounds.width + stageLabel.spacing : bounds.x - stageLabel.spacing; + } + const availableWidth = bounds.width - (horizontal ? totalSpacing : 0); + const availableHeight = bounds.height - (horizontal ? 0 : totalSpacing); + if (availableWidth < 0 || availableHeight < 0) + return; + const nodeData = []; + const labelData = []; + let yStart = 0; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + const enabled = visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + const yEnd = yStart + yValue; + const yMidRatio = (yStart + yEnd) / (2 * yTotal); + const yRangeRatio = (yEnd - yStart) / yTotal; + const xOffset = horizontal ? availableWidth * yMidRatio + spacing * datumIndex : availableWidth * 0.5; + const yOffset = horizontal ? availableHeight * 0.5 : availableHeight * yMidRatio + spacing * datumIndex; + const x = bounds.x + xOffset; + const y = bounds.y + yOffset; + if (stageLabelData != null) { + const stageLabelDatum = stageLabelData[datumIndex]; + stageLabelDatum.x = labelX ?? x; + stageLabelDatum.y = labelY ?? y; + } + let top; + let right; + let bottom; + let left; + if (horizontal) { + const barWidth = availableWidth * yRangeRatio; + top = barWidth; + bottom = barWidth; + const y0 = (xOffset + barWidth / 2) * (availableHeight / bounds.width); + const y1 = (xOffset - barWidth / 2) * (availableHeight / bounds.width); + right = reverse ? bounds.height - y0 : y0; + left = reverse ? bounds.height - y1 : y1; + } else { + const barHeight = availableHeight * yRangeRatio; + right = barHeight; + left = barHeight; + const x0 = (yOffset - barHeight / 2) * (availableWidth / bounds.height); + const x1 = (yOffset + barHeight / 2) * (availableWidth / bounds.height); + top = reverse ? bounds.width - x0 : x0; + bottom = reverse ? bounds.width - x1 : x1; + } + const text = this.getLabelText( + yValue, + datum, + valueKey, + "y", + yDomain, + label, + { + datum, + value: yValue, + stageKey, + valueKey + } + ); + const labelDatum = { + x, + y, + text, + textAlign: "center", + textBaseline: "middle", + visible: enabled + }; + labelData.push(labelDatum); + nodeData.push({ + series: this, + itemId: valueKey, + datum, + datumIndex, + index: datumIndex, + xValue: xValue2, + yValue, + x, + y, + top, + right, + bottom, + left, + label: labelDatum, + enabled, + midPoint: { + x, + y + }, + style: this.getItemStyle({ datumIndex, datum }, false) + }); + yStart = yEnd; + } + return { + itemId: seriesId, + nodeData, + labelData, + stageLabelData, + bounds + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update({ seriesRect }) { + this.checkResize(seriesRect); + const { datumSelection, labelSelection, stageLabelSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedDatum != null && (highlightedDatum.series !== this || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const stageLabelData = this.contextNodeData?.stageLabelData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection, isHighlight: false }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection, labelProperties: this.properties.label }); + this.stageLabelSelection = this.updateStageLabelSelection({ stageLabelData, stageLabelSelection }); + this.updateLabelNodes({ + labelSelection: stageLabelSelection, + labelProperties: this.properties.stageLabel + }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData); + } + getItemStyle({ datumIndex, datum }, isHighlight) { + const { properties } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults15(highlightStyle, properties.getStyle(datumIndex)); + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId17(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults15(overrides, style); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId, properties } = this; + const { stageKey, valueKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + stageKey, + valueKey, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const { properties } = this; + const { shadow } = properties; + const bounds = this.contextNodeData?.bounds; + const fillBBox = bounds ? { series: bounds, axis: bounds } : void 0; + datumSelection.each((connector, nodeDatum) => { + applyShapeStyle14(connector, nodeDatum.style, fillBBox); + applyPyramidDatum(connector, nodeDatum); + connector.fillShadow = shadow; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(this.properties.label.enabled ? opts.labelData : []); + } + updateStageLabelSelection(opts) { + return opts.stageLabelSelection.update(opts.stageLabelData); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, nodeDatum, datumIndex) => { + const { visible, x, y, text, textAlign, textBaseline } = nodeDatum; + const style = getLabelStyles5( + this, + void 0, + this.properties, + opts.labelProperties, + false, + activeHighlight + ); + const { color: fill, fontSize, fontStyle, fontWeight, fontFamily } = style; + label.visible = visible; + label.x = x; + label.y = y; + label.text = text; + label.fill = fill; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + label.setBoxing(style); + }); + } + computeFocusBounds(opts) { + const datum = this.getNodeData()?.[opts.datumIndex]; + if (datum === void 0) + return; + for (const node of this.datumSelection) { + if (node.datum === datum) { + return node.node; + } + } + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { stageKey, valueKey, tooltip } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, "xValue", processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const label = this.getLabelText( + xValue2, + datum, + stageKey, + "x", + dataModel.getDomain(this, "xValue", "value", processedData), + this.properties.stageLabel, + { datum, value: xValue2, stageKey, valueKey } + ); + const value = this.getLabelText( + yValue, + datum, + valueKey, + "y", + dataModel.getDomain(this, "yValue", "value", processedData), + this.properties.stageLabel, + { datum, value: yValue, stageKey, valueKey } + ); + const format = this.getItemStyle({ datumIndex, datum }, false); + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(datumIndex), + data: [{ label: toPlainText5(label), value: toPlainText5(value) }] + }, + { + seriesId, + datum, + title: void 0, + stageKey, + valueKey, + ...format + } + ); + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + legendItemSymbol(datumIndex) { + const { fills, strokes, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.properties; + const fill = fills[datumIndex] ?? "black"; + const stroke = strokes[datumIndex] ?? "black"; + return { + marker: { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + processedData, + dataModel, + id: seriesId, + ctx: { legendManager }, + visible + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { showInLegend } = this.properties; + const legendData = []; + const stageValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex] of rawData.entries()) { + const stageValue = stageValues[datumIndex]; + legendData.push({ + legendType: "category", + id: seriesId, + itemId: datumIndex, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { text: stageValue }, + symbol: this.legendItemSymbol(datumIndex), + hideInLegend: !showInLegend + }); + } + return legendData; + } + animateReset() { + this.ctx.animationManager.skipCurrentBatch(); + this.ctx.animationManager.stopByAnimationGroupId(this.id); + } + animateEmptyUpdateReady() { + const { datumSelection, labelSelection, properties } = this; + const fns = preparePyramidAnimationFunctions(properties.direction); + fromToMotion4(this.id, "nodes", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation6(this, "labels", this.ctx.animationManager, labelSelection); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +PyramidSeries.className = "PyramidSeries"; +PyramidSeries.type = "pyramid"; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport124 } from "ag-charts-community"; +import { constant as constant18, required as required18, string as string16 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs16, pyramidSeriesThemeableOptionsDef } = _ModuleSupport124; +var pyramidSeriesOptionsDef = { + ...pyramidSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs16, + type: required18(constant18("pyramid")), + stageKey: required18(string16), + valueKey: required18(string16) +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidThemes.ts +import { _ModuleSupport as _ModuleSupport125 } from "ag-charts-community"; +var { + ThemeSymbols: { DEFAULT_SHADOW_COLOUR: DEFAULT_SHADOW_COLOUR2 } +} = _ModuleSupport125; +var PYRAMID_SERIES_THEME = { + series: { + direction: "vertical", + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + spacing: 2, + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", _ModuleSupport125.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", _ModuleSupport125.FILL_PATTERN_DEFAULTS], + ["image", _ModuleSupport125.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + label: { + ..._ModuleSupport125.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + stageLabel: { + ..._ModuleSupport125.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 12 + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR2, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + // @ts-expect-error undocumented option + highlight: _ModuleSupport125.singleSeriesHighlightStyle() + } +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidModule.ts +var PyramidSeriesModule = { + type: "series", + name: "pyramid", + chartType: "standalone", + enterprise: true, + options: pyramidSeriesOptionsDef, + create: (ctx) => new PyramidSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaModule.ts +import { _ModuleSupport as _ModuleSupport132 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radar/radarThemes.ts +import { _ModuleSupport as _ModuleSupport126 } from "ag-charts-community"; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE3 } +} = _ModuleSupport126; +var BASE_RADAR_SERIES_THEME = { + series: { + stroke: { $palette: "stroke" }, + label: { + ..._ModuleSupport126.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + marker: { + enabled: true, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport126.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", _ModuleSupport126.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport126.FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + fillOpacity: 1, + shape: "circle", + size: 6, + strokeOpacity: 1, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] } + }, + highlight: _ModuleSupport126.multiSeriesHighlightStyle(), + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + } + }, + axes: { + [POLAR_AXIS_TYPE3.ANGLE_CATEGORY]: { + label: { + spacing: 10 + } + } + } +}; +var RADAR_LINE_SERIES_THEME = _ModuleSupport126.mergeDefaults( + { + series: { + stroke: _ModuleSupport126.SAFE_STROKE_FILL_OPERATION, + strokeWidth: 2 + } + }, + BASE_RADAR_SERIES_THEME +); +var RADAR_AREA_SERIES_THEME = _ModuleSupport126.mergeDefaults( + { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport126.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", _ModuleSupport126.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport126.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: 0.8, + strokeWidth: 2, + marker: { + enabled: false + } + } + }, + BASE_RADAR_SERIES_THEME +); + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeries.ts +import { + _ModuleSupport as _ModuleSupport130 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radar/radarSeries.ts +import { + _ModuleSupport as _ModuleSupport128 +} from "ag-charts-community"; +import { isFiniteNumber, isNumberEqual as isNumberEqual8 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/radar/radarSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport127 } from "ag-charts-community"; +var { Label: Label12, SeriesMarker: SeriesMarker2, SeriesProperties: SeriesProperties10, makeSeriesTooltip: makeSeriesTooltip19, Property: Property32 } = _ModuleSupport127; +var RadarSeriesProperties = class extends SeriesProperties10 { + constructor() { + super(...arguments); + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.rotation = 0; + this.marker = new SeriesMarker2(); + this.label = new Label12(); + this.tooltip = makeSeriesTooltip19(); + this.connectMissingData = false; + } +}; +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "angleKey", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "angleName", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "radiusName", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "rotation", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "marker", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property32 +], RadarSeriesProperties.prototype, "connectMissingData", 2); + +// packages/ag-charts-enterprise/src/series/radar/radarSeries.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS2, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES2, + ChartAxisDirection: ChartAxisDirection17, + PolarAxis: PolarAxis2, + SeriesNodePickMode: SeriesNodePickMode14, + valueProperty: valueProperty14, + fixNumericExtent: fixNumericExtent8, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation7, + markerFadeInAnimation: markerFadeInAnimation2, + resetMarkerFn: resetMarkerFn2, + animationValidation: animationValidation8, + computeMarkerFocusBounds: computeMarkerFocusBounds3, + extent: extent2, + BBox: BBox13, + Group: Group13, + Path: Path10, + Selection: Selection12, + Text: Text6, + Marker: Marker4, + updateLabelNode: updateLabelNode7, + getMarkerStyles: getMarkerStyles2, + mergeDefaults: mergeDefaults16 +} = _ModuleSupport128; +var RadarSeriesNodeEvent = class extends _ModuleSupport128.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadarSeries = class extends _ModuleSupport128.PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: "angleValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS2, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES2, + pickModes: [SeriesNodePickMode14.NEAREST_NODE, SeriesNodePickMode14.EXACT_SHAPE_MATCH], + canHaveAxes: true, + animationResetFns: { + item: resetMarkerFn2 + }, + clipFocusBox: false + }); + this.NodeEvent = RadarSeriesNodeEvent; + this.lineGroup = this.contentGroup.appendChild(new Group13({ name: "radar-line" })); + this.lineSelection = Selection12.select( + this.lineGroup, + Path10 + ); + this.resetInvalidToZero = false; + this.circleCache = { r: 0, cx: 0, cy: 0 }; + this.lineGroup.zIndex = 0; + this.itemGroup.zIndex = 1; + } + get hasData() { + return this.getHasData("angleValue"); + } + nodeFactory() { + return new Marker4(); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection17.Angle) { + return dataModel.getDomain(this, `angleValue`, "value", processedData); + } else { + const domain = dataModel.getDomain(this, `radiusValue`, "value", processedData); + const ext = extent2(domain.length === 0 ? domain : [0].concat(domain)); + return fixNumericExtent8(ext); + } + } + async processData(dataController) { + const { angleKey, radiusKey } = this.properties; + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + extraProps.push(animationValidation8()); + } + const radiusScaleType = this.axes[ChartAxisDirection17.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection17.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty14(angleKey, angleScaleType, { id: "angleValue" }), + valueProperty14(radiusKey, radiusScaleType, { id: "radiusValue", invalidValue: void 0 }), + ...extraProps + ] + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (!(r === cache.r && cx === cache.cx && cy === cache.cy)) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection17.Radius]; + return radiusAxis instanceof PolarAxis2 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + maybeRefreshNodeData() { + const didCircleChange = this.didCircleChange(); + if (!didCircleChange && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + createNodeData() { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return; + const { angleKey, radiusKey, angleName, radiusName, legendItemName, marker, label } = this.properties; + const angleScale = this.axes[ChartAxisDirection17.Angle]?.scale; + const radiusScale = this.axes[ChartAxisDirection17.Radius]?.scale; + if (!angleScale || !radiusScale) { + return; + } + const angleValues = dataModel.resolveColumnById(this, `angleValue`, processedData); + const radiusValues = dataModel.resolveColumnById(this, `radiusValue`, processedData); + const axisInnerRadius = this.getAxisInnerRadius(); + const radiusDomain = this.getSeriesDomain(ChartAxisDirection17.Radius); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const nodeData = rawData.map((datum, datumIndex) => { + const angleDatum = angleValues[datumIndex]; + const radiusDatum = radiusValues[datumIndex]; + const angle = angleScale.convert(angleDatum); + const radius = this.radius + axisInnerRadius - radiusScale.convert(radiusDatum); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + const x = cos * radius; + const y = sin * radius; + let labelNodeDatum; + if (label.enabled) { + const labelText = this.getLabelText( + radiusDatum, + datum, + radiusKey, + "radius", + radiusDomain, + label, + { value: radiusDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + let textAlign = "right"; + if (isNumberEqual8(cos, 0)) { + textAlign = "center"; + } else if (cos > 0) { + textAlign = "left"; + } + let textBaseline = "bottom"; + if (isNumberEqual8(sin, 0)) { + textBaseline = "middle"; + } else if (sin > 0) { + textBaseline = "top"; + } + labelNodeDatum = { + x: x + cos * marker.size, + y: y + sin * marker.size, + text: labelText, + textAlign, + textBaseline + }; + } + } + return { + series: this, + datum, + datumIndex, + index: datumIndex, + point: { x, y, size: marker.size }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + missing: !isFiniteNumber(angle) || !isFiniteNumber(radius) + }; + }); + return { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles: getMarkerStyles2(this, this.properties, marker) + }; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const { series } = this.ctx.highlightManager?.getActiveHighlight() ?? {}; + this.highlightGroup.visible = (animationEnabled || this.visible) && series === this; + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updatePathSelections(); + this.updateMarkerSelection(); + this.updateHighlightSelection(); + this.updatePathNodes(); + if (this.hasItemStylers()) { + this.updateDatumStyles(this.itemSelection, false); + this.updateDatumStyles(this.highlightSelection, true); + } + this.updateMarkers(this.itemSelection, false); + this.updateMarkers(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updatePathSelections() { + const pathData = this.visible ? [true] : []; + this.lineSelection.update(pathData); + } + updateMarkerSelection() { + const { marker, styler } = this.properties; + if (marker.isDirty()) { + this.itemSelection.clear(); + this.itemSelection.cleanup(); + this.itemSelection = Selection12.select(this.itemGroup, () => this.nodeFactory(), false); + } + const markersEnabled = styler == null ? marker.enabled : this.getStyle(false).marker.enabled; + const data = this.visible && marker.shape && markersEnabled ? this.nodeData : []; + this.itemSelection.update(data); + } + updateHighlightSelection() { + const { marker, styler } = this.properties; + if (marker.isDirty()) { + this.highlightSelection.clear(); + this.highlightSelection.cleanup(); + this.highlightSelection = Selection12.select(this.highlightGroup, () => this.nodeFactory(), false); + } + const markersEnabled = styler == null ? marker.enabled : this.getStyle(false).marker.enabled; + const highlighted = this.ctx.highlightManager?.getActiveHighlight(); + const data = this.visible && marker.shape && markersEnabled && highlighted?.datum ? [{ ...highlighted }] : []; + this.highlightSelection.update(data); + } + getMarkerFill(highlightedStyle) { + return highlightedStyle?.fill ?? this.getStyle(false).marker.fill; + } + getDatumStylerProperties(datum) { + const { id: seriesId, properties } = this; + const { angleKey, radiusKey } = properties; + return { + seriesId, + datum, + angleKey, + radiusKey + }; + } + updateDatumStyles(selection, isHighlight) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + selection.each((_, datum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { stroke, strokeWidth, strokeOpacity } = stylerStyle; + datum.style = this.getMarkerStyle( + this.properties.marker, + datum, + this.getDatumStylerProperties(datum.datum), + { isHighlight, highlightState }, + stylerStyle.marker, + { + stroke, + strokeWidth, + strokeOpacity + } + ); + }); + } + updateMarkers(selection, isHighlight) { + const fillBBox = this.getShapeFillBBox(); + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + selection.each((node, datum) => { + const style = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style, node, datum.point, fillBBox); + }); + } + updateLabels() { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + if (datum.label) { + const isHighlight = false; + node.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + updateLabelNode7(this, node, properties, properties.label, datum.label, isHighlight, activeHighlight); + } + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip, marker } = properties; + const angleAxis = axes[ChartAxisDirection17.Angle]; + const radiusAxis = axes[ChartAxisDirection17.Radius]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const angleValue = dataModel.resolveColumnById(this, `angleValue`, processedData)[datumIndex]; + const radiusValue = dataModel.resolveColumnById(this, `radiusValue`, processedData)[datumIndex]; + if (angleValue == null) + return; + const activeStyle = this.getMarkerStyle(marker, { datum, datumIndex }, this.getDatumStylerProperties(datum), { + isHighlight: false + }); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: radiusName, + fallbackLabel: radiusKey, + value: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + radiusKey, + angleName, + radiusName, + legendItemName, + ...activeStyle + } + ); + } + legendItemSymbol() { + const { stroke, strokeWidth, strokeOpacity, lineDash, marker } = this.getStyle(false); + const markerStyle = { + shape: marker.shape, + enabled: marker.enabled || strokeWidth <= 0, + fill: this.getMarkerFill() ?? marker.stroke ?? stroke ?? "rgba(0, 0, 0, 0)", + stroke: marker.stroke ?? stroke ?? "rgba(0, 0, 0, 0)", + fillOpacity: marker.fillOpacity, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }; + return { + marker: markerStyle, + line: { + stroke, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { radiusKey, radiusName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: radiusKey, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: radiusKey }), + label: { + text: legendItemName ?? radiusName ?? radiusKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + pickNodeClosestDatum(hitPoint) { + const { nodeData, centerX: cx, centerY: cy } = this; + const { x, y } = hitPoint; + const radius = this.radius; + const distanceFromCenter = Math.hypot(x - cx, y - cy); + if (distanceFromCenter > radius + this.properties.marker.size) { + return; + } + let minDistance = Infinity; + let closestDatum; + for (const datum of nodeData) { + const { point: { x: datumX = Number.NaN, y: datumY = Number.NaN } = {} } = datum; + if (Number.isNaN(datumX) || Number.isNaN(datumY)) { + continue; + } + const distance = Math.hypot(hitPoint.x - datumX - cx, hitPoint.y - datumY - cy); + if (distance < minDistance) { + minDistance = distance; + closestDatum = datum; + } + } + if (closestDatum) { + const distance = Math.max(minDistance - (closestDatum.point?.size ?? 0), 0); + return { datum: closestDatum, distance }; + } + } + computeLabelsBBox() { + const { label } = this.properties; + this.maybeRefreshNodeData(); + const textBoxes = []; + const tempText = new Text6(); + for (const nodeDatum of this.nodeData) { + if (!label.enabled || !nodeDatum.label) { + continue; + } + tempText.text = nodeDatum.label.text; + tempText.x = nodeDatum.label.x; + tempText.y = nodeDatum.label.y; + tempText.setFont(label); + tempText.setAlign(nodeDatum.label); + const box = tempText.getBBox(); + textBoxes.push(box); + } + if (textBoxes.length === 0) { + return null; + } + return BBox13.merge(textBoxes); + } + getLineNode() { + return this.lineSelection?.at(0); + } + beforePathAnimation() { + this.updatePathNodes(); + } + getPathNodesStyle() { + const highlightDatum = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightState(highlightDatum); + const highlightStyle = this.getHighlightStyle(void 0, void 0, highlightState); + const stylerStyle = this.getStyle(false, highlightState); + return mergeDefaults16(highlightStyle, stylerStyle); + } + getLinePoints() { + const { nodeData, resetInvalidToZero } = this; + const { connectMissingData } = this.properties; + if (nodeData.length === 0) { + return []; + } + const radiusAxis = this.axes[ChartAxisDirection17.Radius]; + const angleAxis = this.axes[ChartAxisDirection17.Angle]; + const reversedAngleAxis = angleAxis?.isReversed(); + const reversedRadiusAxis = radiusAxis?.isReversed(); + const data = reversedRadiusAxis && !reversedAngleAxis ? [...nodeData].reverse() : nodeData; + const points = []; + let prevPointInvalid = false; + let firstValid; + for (const [index, datum] of data.entries()) { + let { x, y } = datum.point; + const isPointInvalid = Number.isNaN(x) || Number.isNaN(y); + if (!isPointInvalid) { + firstValid ?? (firstValid = datum); + } + if (isPointInvalid && !connectMissingData) { + x = 0; + y = 0; + } + const moveTo2 = index === 0 || !resetInvalidToZero && !connectMissingData && (isPointInvalid || prevPointInvalid); + points.push({ x, y, moveTo: moveTo2 }); + prevPointInvalid = isPointInvalid; + } + if (firstValid !== void 0) { + points.push({ x: firstValid.point.x, y: firstValid.point.y, moveTo: false }); + } + return points; + } + animateSinglePath(pathNode, points, ratio3) { + const { path } = pathNode; + path.clear(true); + const axisInnerRadius = this.getAxisInnerRadius(); + const radiusAxis = this.axes[ChartAxisDirection17.Radius]; + const reversedRadiusAxis = radiusAxis?.isReversed(); + const radiusZero = reversedRadiusAxis ? this.radius + axisInnerRadius - radiusAxis?.scale.convert(0) : axisInnerRadius; + for (const point of points) { + const { x: x1, y: y1, arc, radius = 0, startAngle = 0, endAngle = 0, moveTo: moveTo2 } = point; + const angle = Math.atan2(y1, x1); + const x0 = radiusZero * Math.cos(angle); + const y0 = radiusZero * Math.sin(angle); + const t = ratio3; + const x = x0 * (1 - t) + x1 * t; + const y = y0 * (1 - t) + y1 * t; + if (arc) { + path.arc(x1, y1, radius, startAngle, endAngle); + } else if (moveTo2) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + pathNode.checkPathDirty(); + } + animatePaths(ratio3) { + const linePoints = this.getLinePoints(); + const lineNode = this.getLineNode(); + if (!lineNode) + return; + this.animateSinglePath(lineNode, linePoints, ratio3); + } + animateEmptyUpdateReady() { + const { itemSelection, labelSelection } = this; + const { animationManager } = this.ctx; + this.beforePathAnimation(); + animationManager.animate({ + id: `${this.id}_'path`, + groupId: this.id, + from: 0, + to: 1, + phase: "initial", + collapsable: false, + onUpdate: (ratio3) => this.animatePaths(ratio3), + onStop: () => this.animatePaths(1) + }); + markerFadeInAnimation2(this, animationManager, "added", itemSelection); + seriesLabelFadeInAnimation7(this, "labels", animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + super.animateWaitingUpdateReady(data); + this.resetPaths(); + } + animateReadyResize(data) { + super.animateReadyResize(data); + this.resetPaths(); + } + resetPaths() { + const lineNode = this.getLineNode(); + if (lineNode) { + const { path: linePath } = lineNode; + const linePoints = this.getLinePoints(); + const stylerStyle = this.getStyle(false); + lineNode.fill = void 0; + lineNode.stroke = stylerStyle.stroke; + lineNode.strokeWidth = stylerStyle.strokeWidth; + lineNode.strokeOpacity = stylerStyle.strokeOpacity; + lineNode.lineDash = stylerStyle.lineDash; + lineNode.lineDashOffset = stylerStyle.lineDashOffset; + linePath.clear(true); + for (const { x, y, moveTo: moveTo2 } of linePoints) { + if (moveTo2) { + linePath.moveTo(x, y); + } else { + linePath.lineTo(x, y); + } + } + lineNode.checkPathDirty(); + return stylerStyle; + } + } + getStylerResult(stylerResult, highlighted, highlightState) { + const { styler } = this.properties; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + const cbResult = this.cachedCallWithContext(styler, stylerParams) ?? {}; + const resolved = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + cbResult, + { pick: false } + ); + if (resolved) { + stylerResult = resolved; + } + } + return stylerResult; + } + getFormattedMarkerStyle(datum) { + const { angleKey, radiusKey } = this.properties; + return this.getMarkerStyle(this.properties.marker, datum, { angleKey, radiusKey }, { isHighlight: true }); + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds3(this, opts); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RadarSeries.className = "RadarSeries"; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeriesProperties.ts +import { + _ModuleSupport as _ModuleSupport129 +} from "ag-charts-community"; +var { Property: Property33 } = _ModuleSupport129; +var RadarAreaSeriesProperties = class extends RadarSeriesProperties { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + } +}; +__decorateClass([ + Property33 +], RadarAreaSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property33 +], RadarAreaSeriesProperties.prototype, "fillOpacity", 2); + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeries.ts +var { + ChartAxisDirection: ChartAxisDirection18, + Group: Group14, + HighlightState: HighlightState4, + Path: Path11, + PointerEvents: PointerEvents10, + Selection: Selection13, + applyShapeStyle: applyShapeStyle15, + toHighlightString: toHighlightString5 +} = _ModuleSupport130; +var RadarAreaSeries = class extends RadarSeries { + constructor(moduleCtx) { + super(moduleCtx); + this.properties = new RadarAreaSeriesProperties(); + this.areaGroup = this.contentGroup.appendChild(new Group14({ name: "radar-area" })); + this.areaSelection = Selection13.select( + this.areaGroup, + Path11 + ); + this.resetInvalidToZero = true; + this.areaGroup.zIndex = -1; + } + updatePathSelections() { + const pathData = this.visible ? [true] : []; + this.areaSelection.update(pathData); + super.updatePathSelections(); + } + getAreaNode() { + return this.areaSelection.at(0); + } + getMarkerFill(highlightedStyle) { + if (highlightedStyle?.fill != null) + return highlightedStyle.fill; + const stylerStyle = this.getStyle(false); + return stylerStyle.marker.fill ?? stylerStyle.fill; + } + updatePathNodes() { + const styles = this.getPathNodesStyle(); + const { fill, fillOpacity, strokeWidth, stroke, strokeOpacity, lineDash, lineDashOffset, opacity } = styles; + const lineNode = this.getLineNode(); + if (lineNode) { + lineNode.setProperties({ + fill: void 0, + lineJoin: "round", + lineCap: "round", + pointerEvents: PointerEvents10.None, + opacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + } + const areaNode = this.getAreaNode(); + if (areaNode) { + applyShapeStyle15(areaNode, { fill, fillOpacity, stroke: void 0 }, this.getShapeFillBBox()); + areaNode.setProperties({ + lineJoin: "round", + pointerEvents: PointerEvents10.None, + opacity + }); + } + } + animatePaths(ratio3) { + super.animatePaths(ratio3); + const areaNode = this.getAreaNode(); + if (areaNode) { + this.animateSinglePath(areaNode, this.getAreaPoints(), ratio3); + } + } + getAreaPoints() { + const points = this.getLinePoints(); + const getPolarAxis = (direction) => { + const axis = this.axes[direction]; + return axis instanceof _ModuleSupport130.PolarAxis ? axis : void 0; + }; + const radiusAxis = getPolarAxis(ChartAxisDirection18.Radius); + const angleAxis = getPolarAxis(ChartAxisDirection18.Angle); + const reversedRadiusAxis = radiusAxis?.isReversed(); + if (!reversedRadiusAxis) { + return points; + } + const zeroLinePoints = angleAxis?.getAxisLinePoints()?.points ?? []; + return points.concat(...zeroLinePoints); + } + resetPaths() { + const superStyle = super.resetPaths(); + const areaNode = this.getAreaNode(); + if (areaNode) { + const { path: areaPath } = areaNode; + const areaPoints = this.getAreaPoints(); + const stylerStyle = superStyle ?? this.getStyle(false); + const fillBBox = this.getShapeFillBBox(); + applyShapeStyle15( + areaNode, + { + fill: stylerStyle.fill, + stroke: void 0, + fillOpacity: stylerStyle.fillOpacity, + lineDash: stylerStyle.lineDash, + lineDashOffset: stylerStyle.lineDashOffset + }, + fillBBox + ); + areaNode.lineJoin = areaNode.lineCap = "round"; + areaPath.clear(true); + for (const { x, y, moveTo: moveTo2, arc, radius = 0, startAngle = 0, endAngle = 0 } of areaPoints) { + if (arc) { + areaPath.arc(x, y, radius, startAngle, endAngle); + } else if (moveTo2) { + areaPath.moveTo(x, y); + } else { + areaPath.lineTo(x, y); + } + } + areaPath.closePath(); + areaNode.checkPathDirty(); + return stylerStyle; + } + } + makeStylerParams(highlighted, highlightStateEnum) { + const { properties } = this; + const highlightState = toHighlightString5(highlightStateEnum ?? HighlightState4.None); + return { + marker: { + fill: properties.marker.fill, + fillOpacity: properties.marker.fillOpacity, + size: properties.marker.size, + shape: properties.marker.shape, + stroke: properties.marker.stroke, + strokeOpacity: properties.marker.strokeOpacity, + strokeWidth: properties.marker.strokeWidth, + lineDash: properties.marker.lineDash, + lineDashOffset: properties.marker.lineDashOffset + }, + highlightState, + highlighted, + fill: properties.fill, + fillOpacity: properties.fillOpacity, + lineDash: properties.lineDash, + lineDashOffset: properties.lineDashOffset, + seriesId: this.id, + stroke: properties.stroke, + strokeOpacity: properties.strokeOpacity, + strokeWidth: properties.strokeWidth, + angleKey: properties.angleKey, + radiusKey: properties.radiusKey + }; + } + getStyle(highlighted, highlightState) { + const { marker, fill, fillOpacity, lineDash, lineDashOffset, stroke, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill: markerFill = "transparent", fillOpacity: markerFillOpacity } = marker; + const stylerResult = this.getStylerResult({}, highlighted, highlightState); + stylerResult.marker ?? (stylerResult.marker = {}); + return { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? markerFill, + fillOpacity: stylerResult.marker.fillOpacity ?? markerFillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } +}; +RadarAreaSeries.className = "RadarAreaSeries"; +RadarAreaSeries.type = "radar-area"; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport131 } from "ag-charts-community"; +import { constant as constant19, required as required19, string as string17 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs17, radarAreaSeriesThemeableOptionsDef } = _ModuleSupport131; +var radarAreaSeriesOptionsDef = { + ...commonSeriesOptionsDefs17, + ...radarAreaSeriesThemeableOptionsDef, + type: required19(constant19("radar-area")), + angleKey: required19(string17), + radiusKey: required19(string17), + angleName: string17, + radiusName: string17, + legendItemName: string17 +}; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaModule.ts +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE4 } +} = _ModuleSupport132; +var RadarAreaModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radar-area", + moduleFactory: (ctx) => new RadarAreaSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE4.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE4.RADIUS_NUMBER }], + themeTemplate: RADAR_AREA_SERIES_THEME +}; +var RadarAreaSeriesModule = { + type: "series", + name: "radar-area", + chartType: "polar", + enterprise: true, + options: radarAreaSeriesOptionsDef, + create: (ctx) => new RadarAreaSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineModule.ts +import { _ModuleSupport as _ModuleSupport135 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineSeries.ts +import { + _ModuleSupport as _ModuleSupport133 +} from "ag-charts-community"; +var { HighlightState: HighlightState5, PointerEvents: PointerEvents11, toHighlightString: toHighlightString6 } = _ModuleSupport133; +var RadarLineSeries = class extends RadarSeries { + constructor() { + super(...arguments); + this.properties = new RadarSeriesProperties(); + } + updatePathSelections() { + this.lineSelection.update(this.visible ? [true] : []); + } + updatePathNodes() { + const lineNode = this.getLineNode(); + if (!lineNode) + return; + const style = this.getPathNodesStyle(); + const { strokeWidth, stroke, strokeOpacity, lineDash, lineDashOffset, opacity } = style; + lineNode.setProperties({ + fill: void 0, + lineJoin: "round", + lineCap: "round", + pointerEvents: PointerEvents11.None, + opacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { properties } = this; + const highlightState = toHighlightString6(highlightStateEnum ?? HighlightState5.None); + return { + marker: { + fill: properties.marker.fill, + fillOpacity: properties.marker.fillOpacity, + size: properties.marker.size, + shape: properties.marker.shape, + stroke: properties.marker.stroke, + strokeOpacity: properties.marker.strokeOpacity, + strokeWidth: properties.marker.strokeWidth, + lineDash: properties.marker.lineDash, + lineDashOffset: properties.marker.lineDashOffset + }, + highlightState, + highlighted, + lineDash: properties.lineDash, + lineDashOffset: properties.lineDashOffset, + seriesId: this.id, + stroke: properties.stroke, + strokeOpacity: properties.strokeOpacity, + strokeWidth: properties.strokeWidth, + angleKey: properties.angleKey, + radiusKey: properties.radiusKey + }; + } + getStyle(highlighted, highlightState) { + const { marker, lineDash, lineDashOffset, stroke, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill = "transparent", fillOpacity } = marker; + const stylerResult = this.getStylerResult({}, highlighted, highlightState); + stylerResult.marker ?? (stylerResult.marker = {}); + return { + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? fill, + fillOpacity: stylerResult.marker.fillOpacity ?? fillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } +}; +RadarLineSeries.className = "RadarLineSeries"; +RadarLineSeries.type = "radar-line"; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport134 } from "ag-charts-community"; +import { constant as constant20, required as required20, string as string18 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs18, radarLineSeriesThemeableOptionsDef } = _ModuleSupport134; +var radarLineSeriesOptionsDef = { + ...commonSeriesOptionsDefs18, + ...radarLineSeriesThemeableOptionsDef, + type: required20(constant20("radar-line")), + angleKey: required20(string18), + radiusKey: required20(string18), + angleName: string18, + radiusName: string18, + legendItemName: string18 +}; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE5 } = _ModuleSupport135.ThemeConstants; +var RadarLineModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radar-line", + moduleFactory: (ctx) => new RadarLineSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE5.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE5.RADIUS_NUMBER }], + themeTemplate: RADAR_LINE_SERIES_THEME +}; +var RadarLineSeriesModule = { + type: "series", + name: "radar-line", + chartType: "polar", + enterprise: true, + options: radarLineSeriesOptionsDef, + create: (ctx) => new RadarLineSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarModule.ts +import { _ModuleSupport as _ModuleSupport141 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeries.ts +import { + _ModuleSupport as _ModuleSupport138 +} from "ag-charts-community"; +import { isDefined as isDefined2 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/utils/datum.ts +function readDatum(nodeDatum) { + if (typeof nodeDatum?.datum === "object") { + return nodeDatum.datum; + } + return null; +} + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport136 } from "ag-charts-community"; +var { SeriesProperties: SeriesProperties11, makeSeriesTooltip: makeSeriesTooltip20, Property: Property34, Label: Label13 } = _ModuleSupport136; +var RadialBarSeriesProperties = class extends SeriesProperties11 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.label = new Label13(); + this.tooltip = makeSeriesTooltip20(); + } + getStyle() { + const { fill, fillOpacity, stroke, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "angleKey", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "angleName", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "radiusName", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "rotation", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "stackGroup", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "normalizedTo", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property34 +], RadialBarSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarUtil.ts +import { _ModuleSupport as _ModuleSupport137 } from "ag-charts-community"; +var { SectorBox: SectorBox3, motion: motion9 } = _ModuleSupport137; +function fixRadialBarAnimationStatus(node, datum, status) { + if (status === "updated") { + if (node.previousDatum == null || Number.isNaN(node.previousDatum.innerRadius) || Number.isNaN(node.previousDatum.outerRadius)) { + return "added"; + } + if (Number.isNaN(datum.innerRadius) || Number.isNaN(datum.outerRadius)) { + return "removed"; + } + } + if (status === "added" && node.previousDatum != null) { + return "updated"; + } + return status; +} +function prepareRadialBarSeriesAnimationFunctions(axisZeroAngle) { + const fromFn = (sect, datum, status) => { + status = fixRadialBarAnimationStatus(sect, datum, status); + let startAngle; + let endAngle; + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed" || status === "updated") { + startAngle = sect.startAngle; + endAngle = sect.endAngle; + innerRadius = sect.innerRadius; + outerRadius = sect.outerRadius; + clipSector = sect.clipSector; + } else { + startAngle = axisZeroAngle; + endAngle = axisZeroAngle; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + } + clipSector ?? (clipSector = new SectorBox3(startAngle, endAngle, innerRadius, outerRadius)); + const phase = motion9.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { startAngle, endAngle, innerRadius, outerRadius, clipSector, phase }; + }; + const toFn = (sect, datum, status) => { + let startAngle; + let endAngle; + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed") { + startAngle = axisZeroAngle; + endAngle = axisZeroAngle; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + clipSector = new SectorBox3(startAngle, endAngle, innerRadius, outerRadius); + } else { + startAngle = datum.startAngle; + endAngle = datum.endAngle; + innerRadius = Number.isNaN(datum.innerRadius) ? sect.innerRadius : datum.innerRadius; + outerRadius = Number.isNaN(datum.outerRadius) ? sect.outerRadius : datum.outerRadius; + clipSector = datum.clipSector; + } + return { startAngle, endAngle, innerRadius, outerRadius, clipSector }; + }; + return { toFn, fromFn }; +} +function resetRadialBarSelectionsFn(_node, datum) { + return { + centerX: 0, + centerY: 0, + innerRadius: datum.innerRadius, + outerRadius: datum.outerRadius, + startAngle: datum.startAngle, + endAngle: datum.endAngle, + clipSector: datum.clipSector + }; +} + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeries.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS3, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES3, + ChartAxisDirection: ChartAxisDirection19, + PolarAxis: PolarAxis3, + diff: diff7, + groupAccumulativeValueProperty: groupAccumulativeValueProperty2, + keyProperty: keyProperty9, + normaliseGroupTo: normaliseGroupTo2, + valueProperty: valueProperty15, + fixNumericExtent: fixNumericExtent9, + resetLabelFn: resetLabelFn6, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation8, + seriesLabelFadeOutAnimation: seriesLabelFadeOutAnimation2, + animationValidation: animationValidation9, + angleBetween: angleBetween3, + createDatumId: createDatumId18, + CategoryScale: CategoryScale4, + Sector: Sector5, + SectorBox: SectorBox4, + motion: motion10, + isGradientFill: isGradientFill3, + applyShapeStyle: applyShapeStyle16, + updateLabelNode: updateLabelNode8, + getItemStyles: getItemStyles4 +} = _ModuleSupport138; +var RadialBarSeriesNodeEvent = class extends _ModuleSupport138.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadialBarSeries = class extends _ModuleSupport138.PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: "radiusValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS3, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES3, + canHaveAxes: true, + animationResetFns: { + item: resetRadialBarSelectionsFn, + label: resetLabelFn6 + } + }); + this.properties = new RadialBarSeriesProperties(); + this.NodeEvent = RadialBarSeriesNodeEvent; + this.groupScale = new CategoryScale4(); + this.circleCache = { r: 0, cx: 0, cy: 0 }; + } + get hasData() { + return this.getHasData("angleValue-raw"); + } + nodeFactory() { + return new Sector5(); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection19.Angle) { + const xExtent = dataModel.getDomain(this, "angleValue-end", "value", processedData); + const fixedXExtent = [Math.min(xExtent[0], 0), Math.max(xExtent[1], 0)]; + return fixNumericExtent9(fixedXExtent); + } else { + return dataModel.getDomain(this, "radiusValue", "key", processedData); + } + } + async processData(dataController) { + const { angleKey, radiusKey, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const stackGroupId = this.getStackId(); + const stackGroupTrailingId = `${stackGroupId}-trailing`; + const extraProps = []; + if (isDefined2(normalizedTo)) { + extraProps.push(normaliseGroupTo2([stackGroupId, stackGroupTrailingId], Math.abs(normalizedTo))); + } + if (animationEnabled) { + if (this.processedData) { + extraProps.push(diff7(this.id, this.processedData)); + } + extraProps.push(animationValidation9()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const radiusScaleType = this.axes[ChartAxisDirection19.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection19.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty9(radiusKey, radiusScaleType, { id: "radiusValue" }), + valueProperty15(angleKey, angleScaleType, { + id: "angleValue-raw", + invalidValue: null, + ...visibleProps + }), + ...groupAccumulativeValueProperty2( + angleKey, + "normal", + { + id: `angleValue-end`, + rangeId: `angleValue-range`, + invalidValue: null, + groupId: stackGroupId, + separateNegative: true, + ...visibleProps + }, + angleScaleType + ), + ...groupAccumulativeValueProperty2( + angleKey, + "trailing", + { + id: `angleValue-start`, + invalidValue: null, + groupId: stackGroupTrailingId, + separateNegative: true, + ...visibleProps + }, + angleScaleType + ), + ...extraProps + ], + groupByKeys: true, + groupByData: false + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (!(r === cache.r && cx === cache.cx && cy === cache.cy)) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + maybeRefreshNodeData() { + const circleChanged = this.didCircleChange(); + if (!circleChanged && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection19.Radius]; + return radiusAxis instanceof PolarAxis3 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + createNodeData() { + const { processedData, dataModel } = this; + if (!dataModel || !processedData || processedData.type !== "grouped") + return; + const angleAxis = this.axes[ChartAxisDirection19.Angle]; + const radiusAxis = this.axes[ChartAxisDirection19.Radius]; + const angleScale = angleAxis?.scale; + const radiusScale = radiusAxis?.scale; + if (!angleScale || !radiusScale) { + return; + } + const radiusValues = dataModel.resolveKeysById(this, "radiusValue", processedData); + const angleStartValues = dataModel.resolveColumnById(this, `angleValue-start`, processedData); + const angleEndValues = dataModel.resolveColumnById(this, `angleValue-end`, processedData); + const angleRawValues = dataModel.resolveColumnById(this, `angleValue-raw`, processedData); + const angleRangeIndex = dataModel.resolveProcessedDataIndexById(this, `angleValue-range`); + let groupPaddingInner = 0; + if (radiusAxis instanceof RadiusCategoryAxis) { + groupPaddingInner = radiusAxis.groupPaddingInner; + } + const { groupScale } = this; + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + groupScale.domain = Array.from({ length: visibleGroupCount }).map((_, i) => String(i)); + groupScale.range = [0, Math.abs(radiusScale.bandwidth ?? 0)]; + groupScale.paddingInner = visibleGroupCount > 1 ? groupPaddingInner : 0; + const barWidth = groupScale.bandwidth >= 1 ? groupScale.bandwidth : groupScale.rawBandwidth; + const angleAxisReversed = angleAxis.isReversed(); + const radiusAxisReversed = radiusAxis.isReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const axisTotalRadius = axisOuterRadius + axisInnerRadius; + const angleDomain = this.getSeriesDomain(ChartAxisDirection19.Angle); + const { angleKey, radiusKey, angleName, radiusName, legendItemName, label } = this.properties; + const getLabelNodeDatum = (datum, angleDatum, x, y) => { + const labelText = this.getLabelText( + angleDatum, + datum, + angleKey, + "angle", + angleDomain, + label, + { value: angleDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + return { x, y, text: labelText, textAlign: "center", textBaseline: "middle" }; + } + }; + const nodeData = []; + const styles = getItemStyles4( + (nodeDatum, isHighlight, highlightState) => getItemStyle(this, nodeDatum, isHighlight, highlightState) + ); + const context = { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + if (!this.visible) + return context; + const { dataSources } = processedData; + const rawData = dataSources.get(this.id)?.data ?? []; + for (const { datumIndex, group } of dataModel.forEachGroupDatum(this, processedData)) { + const datum = rawData[datumIndex]; + const radiusDatum = radiusValues[datumIndex]; + if (radiusDatum == null) + return; + const angleDatum = angleRawValues[datumIndex]; + const angleStartDatum = angleStartValues[datumIndex]; + const angleEndDatum = angleEndValues[datumIndex]; + const isPositive = angleDatum >= 0 && !Object.is(angleDatum, -0); + const angleRange = group.aggregation[angleRangeIndex][isPositive ? 1 : 0]; + const reversed = isPositive === angleAxisReversed; + let startAngle = angleScale.convert(angleStartDatum, { clamp: true }); + let endAngle = angleScale.convert(angleEndDatum, { clamp: true }); + let rangeStartAngle = angleScale.convert(0, { clamp: true }); + let rangeEndAngle = angleScale.convert(angleRange, { clamp: true }); + if (reversed) { + [rangeStartAngle, rangeEndAngle] = [rangeEndAngle, rangeStartAngle]; + [startAngle, endAngle] = [endAngle, startAngle]; + } + const dataRadius = axisTotalRadius - radiusScale.convert(radiusDatum); + const innerRadius = dataRadius + groupScale.convert(String(groupIndex)); + const outerRadius = innerRadius + barWidth; + const midRadius = (innerRadius + outerRadius) / 2; + const midAngle = startAngle + angleBetween3(startAngle, endAngle) / 2; + const x = Math.cos(midAngle) * midRadius; + const y = Math.sin(midAngle) * midRadius; + const labelNodeDatum = this.properties.label.enabled ? getLabelNodeDatum(datum, angleDatum, x, y) : void 0; + const clipSector = new SectorBox4(startAngle, endAngle, innerRadius, outerRadius); + nodeData.push({ + series: this, + datum, + datumIndex, + point: { x, y, size: 0 }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + innerRadius, + outerRadius, + startAngle: rangeStartAngle, + endAngle: rangeEndAngle, + clipSector, + reversed, + index: datumIndex + }); + } + return context; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updateSectorSelection(this.itemSelection, false); + this.updateSectorSelection(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateSectorSelection(selection, isHighlight) { + let selectionData = []; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + if (isHighlight) { + if (activeHighlight?.datum && activeHighlight.series === this) { + selectionData.push(activeHighlight); + } + } else { + selectionData = this.nodeData; + } + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const fillBBox = this.getShapeFillBBox(); + const hasItemStylers = this.hasItemStylers(); + selection.update(selectionData, void 0, (datum) => this.getDatumId(datum)).each((node, nodeDatum) => { + const datum = readDatum(nodeDatum); + if (datum == null) + return; + if (hasItemStylers) { + const highlightState = this.getHighlightState(activeHighlight, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = getItemStyle(this, nodeDatum, isHighlight, highlightState); + } + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + const cornerRadius = style.cornerRadius; + const fill = style.fill; + const fillParams = _ModuleSupport138.isGradientFill(fill) && fill.bounds !== "item" ? { centerX: 0, centerY: 0 } : void 0; + applyShapeStyle16(node, style, fillBBox, fillParams); + node.lineJoin = "round"; + node.inset = node.stroke == null ? 0 : node.strokeWidth / 2; + node.startInnerCornerRadius = datum.reversed ? cornerRadius : 0; + node.startOuterCornerRadius = datum.reversed ? cornerRadius : 0; + node.endInnerCornerRadius = datum.reversed ? 0 : cornerRadius; + node.endOuterCornerRadius = datum.reversed ? 0 : cornerRadius; + if (isHighlight) { + node.startAngle = nodeDatum.startAngle; + node.endAngle = nodeDatum.endAngle; + node.clipSector = nodeDatum.clipSector; + node.innerRadius = nodeDatum.innerRadius; + node.outerRadius = nodeDatum.outerRadius; + } + }); + } + updateLabels() { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + const isHighlight = false; + updateLabelNode8(this, node, properties, properties.label, datum.label, isHighlight, activeHighlight); + node.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + }); + } + getBarTransitionFunctions() { + const angleScale = this.axes[ChartAxisDirection19.Angle]?.scale; + let axisZeroAngle = 0; + if (!angleScale) { + return prepareRadialBarSeriesAnimationFunctions(axisZeroAngle); + } + const d0 = Math.min(angleScale.domain[0], angleScale.domain[1]); + const d1 = Math.max(angleScale.domain[0], angleScale.domain[1]); + if (d0 <= 0 && d1 >= 0) { + axisZeroAngle = angleScale.convert(0); + } + return prepareRadialBarSeriesAnimationFunctions(axisZeroAngle); + } + animateEmptyUpdateReady() { + const { labelSelection } = this; + const fns = this.getBarTransitionFunctions(); + motion10.fromToMotion(this.id, "datums", this.ctx.animationManager, [this.itemSelection], fns); + seriesLabelFadeInAnimation8(this, "labels", this.ctx.animationManager, labelSelection); + } + animateClearingUpdateEmpty() { + const { itemSelection } = this; + const { animationManager } = this.ctx; + const fns = this.getBarTransitionFunctions(); + motion10.fromToMotion(this.id, "datums", animationManager, [itemSelection], fns); + seriesLabelFadeOutAnimation2(this, "labels", animationManager, this.labelSelection); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip } = properties; + const angleAxis = axes[ChartAxisDirection19.Angle]; + const radiusAxis = axes[ChartAxisDirection19.Radius]; + const nodeDatum = this.nodeData?.[datumIndex]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis || !nodeDatum) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const radiusValue = dataModel.resolveKeysById(this, `radiusValue`, processedData)[datumIndex]; + const angleValue = dataModel.resolveColumnById(this, `angleValue-raw`, processedData)[datumIndex]; + if (radiusValue == null) + return; + const format = getItemStyle(this, nodeDatum, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: angleName, + fallbackLabel: angleKey, + value: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + angleName, + radiusKey, + radiusName, + legendItemName, + ...format + } + ); + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.itemSelection.nodes()); + } + legendItemSymbol() { + const { fill, stroke, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = getStyle( + this, + false, + false, + _ModuleSupport138.HighlightState.None + ); + const markerStyle = { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + if (isGradientFill3(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: markerStyle + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { angleKey, angleName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: angleKey, + seriesId, + enabled: visible, + label: { + text: legendItemName ?? angleName ?? angleKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getDatumId(datum) { + return createDatumId18(datum.radiusValue); + } + computeLabelsBBox() { + return null; + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `radialBar-stack-${groupIndex}-xValues`; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +RadialBarSeries.className = "RadialBarSeries"; +RadialBarSeries.type = "radial-bar"; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport139 } from "ag-charts-community"; +import { boolean as boolean9, constant as constant21, number as number8, required as required21, string as string19 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs19, radialBarSeriesThemeableOptionsDef } = _ModuleSupport139; +var radialBarSeriesOptionsDef = { + ...commonSeriesOptionsDefs19, + ...radialBarSeriesThemeableOptionsDef, + type: required21(constant21("radial-bar")), + angleKey: required21(string19), + radiusKey: required21(string19), + angleName: string19, + radiusName: string19, + legendItemName: string19, + grouped: boolean9, + stacked: boolean9, + stackGroup: string19, + normalizedTo: number8 +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarThemes.ts +import { _ModuleSupport as _ModuleSupport140 } from "ag-charts-community"; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE6 }, + FILL_GRADIENT_CONIC_SERIES_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS5, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS3 +} = _ModuleSupport140; +var RADIAL_BAR_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_CONIC_SERIES_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS5], + ["pattern", FILL_PATTERN_DEFAULTS3] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + label: { + ..._ModuleSupport140.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + highlight: _ModuleSupport140.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE6.RADIUS_CATEGORY]: { + innerRadiusRatio: 0.2, + groupPaddingInner: 0.2, + paddingInner: 0.2, + paddingOuter: 0.1 + } + } +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE7 } = _ModuleSupport141.ThemeConstants; +var RadialBarModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radial-bar", + moduleFactory: (ctx) => new RadialBarSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE7.ANGLE_NUMBER }, { type: POLAR_AXIS_TYPE7.RADIUS_CATEGORY }], + themeTemplate: RADIAL_BAR_SERIES_THEME, + stackable: true, + groupable: true +}; +var RadialBarSeriesModule = { + type: "series", + name: "radial-bar", + chartType: "polar", + enterprise: true, + options: radialBarSeriesOptionsDef, + create: (ctx) => new RadialBarSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnModule.ts +import { _ModuleSupport as _ModuleSupport146 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeries.ts +import { _ModuleSupport as _ModuleSupport143 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport142 } from "ag-charts-community"; +var { Property: Property35 } = _ModuleSupport142; +var RadialColumnSeriesProperties = class extends RadialColumnSeriesBaseProperties { +}; +__decorateClass([ + Property35 +], RadialColumnSeriesProperties.prototype, "columnWidthRatio", 2); +__decorateClass([ + Property35 +], RadialColumnSeriesProperties.prototype, "maxColumnWidthRatio", 2); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeries.ts +var { ChartAxisDirection: ChartAxisDirection20, PolarAxis: PolarAxis4, RadialColumnShape, getRadialColumnWidth } = _ModuleSupport143; +var RadialColumnSeries = class extends RadialColumnSeriesBase { + constructor(moduleCtx) { + super(moduleCtx, { + animationResetFns: { + item: resetRadialColumnSelectionFn + } + }); + this.properties = new RadialColumnSeriesProperties(); + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `radarColumn-stack-${groupIndex}-yValues`; + } + nodeFactory() { + return new RadialColumnShape(); + } + getColumnTransitionFunctions() { + const axisZeroRadius = this.isRadiusAxisReversed() ? this.radius : this.getAxisInnerRadius(); + return prepareRadialColumnAnimationFunctions(axisZeroRadius); + } + isRadiusAxisCircle() { + const radiusAxis = this.axes[ChartAxisDirection20.Radius]; + return radiusAxis instanceof PolarAxis4 ? radiusAxis.shape === "circle" : false; + } + updateItemPath(node, datum, highlight) { + node.isBeveled = this.isRadiusAxisCircle(); + node.isRadiusAxisReversed = this.isRadiusAxisReversed(); + if (highlight) { + node.innerRadius = datum.innerRadius; + node.outerRadius = datum.outerRadius; + node.startAngle = datum.startAngle; + node.endAngle = datum.endAngle; + node.columnWidth = datum.columnWidth; + node.axisInnerRadius = datum.axisInnerRadius; + node.axisOuterRadius = datum.axisOuterRadius; + } + } + getColumnWidth(startAngle, endAngle) { + const { columnWidthRatio = 0.5, maxColumnWidthRatio = 0.5 } = this.properties; + return getRadialColumnWidth(startAngle, endAngle, this.radius, columnWidthRatio, maxColumnWidthRatio); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +RadialColumnSeries.className = "RadialColumnSeries"; +RadialColumnSeries.type = "radial-column"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport144 } from "ag-charts-community"; +import { boolean as boolean10, constant as constant22, number as number9, required as required22, string as string20 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs20, radialColumnSeriesThemeableOptionsDef } = _ModuleSupport144; +var radialColumnSeriesOptionsDef = { + ...commonSeriesOptionsDefs20, + ...radialColumnSeriesThemeableOptionsDef, + type: required22(constant22("radial-column")), + angleKey: required22(string20), + radiusKey: required22(string20), + angleName: string20, + radiusName: string20, + legendItemName: string20, + grouped: boolean10, + stacked: boolean10, + stackGroup: string20, + normalizedTo: number9 +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnThemes.ts +import { _ModuleSupport as _ModuleSupport145 } from "ag-charts-community"; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE8, POLAR_AXIS_SHAPE: POLAR_AXIS_SHAPE2 }, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS: FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS6, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS4 +} = _ModuleSupport145; +var RADIAL_COLUMN_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2], + ["image", FILL_IMAGE_DEFAULTS6], + ["pattern", FILL_PATTERN_DEFAULTS4] + ] + }, + stroke: { $palette: "stroke" }, + columnWidthRatio: 0.5, + maxColumnWidthRatio: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + label: { + ..._ModuleSupport145.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: _ModuleSupport145.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE8.ANGLE_CATEGORY]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE2.CIRCLE }, + groupPaddingInner: 0, + paddingInner: 0, + label: { + spacing: 10 + } + }, + [POLAR_AXIS_TYPE8.RADIUS_NUMBER]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE2.CIRCLE }, + innerRadiusRatio: 0.5 + } + } +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE9 } = _ModuleSupport146.ThemeConstants; +var RadialColumnModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radial-column", + moduleFactory: (ctx) => new RadialColumnSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE9.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE9.RADIUS_NUMBER }], + themeTemplate: RADIAL_COLUMN_SERIES_THEME, + stackable: true, + groupable: true +}; +var RadialColumnSeriesModule = { + type: "series", + name: "radial-column", + chartType: "polar", + enterprise: true, + options: radialColumnSeriesOptionsDef, + create: (ctx) => new RadialColumnSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeModule.ts +import { _ModuleSupport as _ModuleSupport151 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeries.ts +import { + _ModuleSupport as _ModuleSupport150 +} from "ag-charts-community"; +import { cachedTextMeasurer as cachedTextMeasurer9, isArray as isArray6, measureTextSegments as measureTextSegments5, toPlainText as toPlainText7 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeNeedle.ts +import { _ModuleSupport as _ModuleSupport147 } from "ag-charts-community"; +var { SvgPath, Rotatable, Translatable, Scalable: Scalable2 } = _ModuleSupport147; +var RadialGaugeNeedle = class extends Rotatable(Scalable2(Translatable(SvgPath))) { + constructor() { + super(...arguments); + this.scalingCenterX = 0.5; + this.scalingCenterY = 0.5; + this.rotationCenterX = 0.5; + this.rotationCenterY = 0.5; + } +}; +RadialGaugeNeedle.defaultPathData = "M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport148 } from "ag-charts-community"; +var { getColorStops: getColorStops2, normalizeAngle360: normalizeAngle3606, normalizeAngle360Inclusive: normalizeAngle360Inclusive2, toDegrees } = _ModuleSupport148; +var { BaseProperties: BaseProperties11, makeSeriesTooltip: makeSeriesTooltip21, SeriesProperties: SeriesProperties12, PropertiesArray: PropertiesArray3, AxisLabel: AxisLabel4, Property: Property36, Label: Label14 } = _ModuleSupport148; +var RadialGaugeDefaultTargetLabelProperties = class extends Label14 { +}; +__decorateClass([ + Property36 +], RadialGaugeDefaultTargetLabelProperties.prototype, "spacing", 2); +var RadialGaugeTargetProperties = class extends BaseProperties11 { + constructor() { + super(...arguments); + this.label = new RadialGaugeDefaultTargetLabelProperties(); + } + getStyle() { + const { + fill = "black", + fillOpacity = 1, + stroke = "black", + strokeWidth = 0, + strokeOpacity = 1, + lineDash = [0], + lineDashOffset = 0 + } = this; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "text", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "value", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "shape", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "placement", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "spacing", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "size", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "rotation", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "fill", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "stroke", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "lineDash", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property36 +], RadialGaugeTargetProperties.prototype, "label", 2); +var RadialGaugeBarProperties = class extends BaseProperties11 { + constructor() { + super(...arguments); + this.enabled = true; + this.fills = new PropertiesArray3(_ModuleSupport148.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(defaultColorRange, scale) { + const { + enabled, + fill, + fills, + fillMode, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const barFill = enabled ? fill ?? createConicGradient(fills, fillMode, defaultColorRange, scale) : "none"; + return { + fill: barFill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "enabled", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "fills", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "fillMode", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property36 +], RadialGaugeBarProperties.prototype, "lineDashOffset", 2); +var RadialGaugeScaleIntervalProperties = class extends BaseProperties11 { + constructor() { + super(...arguments); + this.values = void 0; + this.step = void 0; + this.minSpacing = 0; + this.maxSpacing = 1e3; + } +}; +__decorateClass([ + Property36 +], RadialGaugeScaleIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleIntervalProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleIntervalProperties.prototype, "maxSpacing", 2); +var RadialGaugeScaleLabelProperties = class extends AxisLabel4 { +}; +var RadialGaugeScaleProperties = class extends BaseProperties11 { + constructor() { + super(...arguments); + this.min = 0; + this.max = 1; + this.fills = new PropertiesArray3(_ModuleSupport148.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.defaultFill = "black"; + this.interval = new RadialGaugeScaleIntervalProperties(); + this.label = new RadialGaugeScaleLabelProperties(); + } + getStyle(barEnabled, defaultColorRange, scale) { + const { + fill, + fills, + defaultFill, + fillMode, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const scaleFill = fill ?? (barEnabled && fills.length === 0 ? defaultFill : void 0) ?? createConicGradient(fills, fillMode, defaultColorRange, scale); + return { + fill: scaleFill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "min", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "max", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "fills", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "fillMode", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "fill", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "stroke", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "defaultFill", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "interval", 2); +__decorateClass([ + Property36 +], RadialGaugeScaleProperties.prototype, "label", 2); +var RadialGaugeNeedleProperties = class extends BaseProperties11 { + constructor() { + super(...arguments); + this.enabled = true; + this.spacing = 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "enabled", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "radiusRatio", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "spacing", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "fill", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "stroke", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property36 +], RadialGaugeNeedleProperties.prototype, "lineDashOffset", 2); +var RadialGaugeLabelProperties = class extends AutoSizedLabel { +}; +__decorateClass([ + Property36 +], RadialGaugeLabelProperties.prototype, "text", 2); +var RadialGaugeSecondaryLabelProperties = class extends AutoSizedSecondaryLabel { +}; +__decorateClass([ + Property36 +], RadialGaugeSecondaryLabelProperties.prototype, "text", 2); +var RadialGaugeSeriesProperties = class extends SeriesProperties12 { + constructor() { + super(...arguments); + this.startAngle = 0; + this.endAngle = 0; + this.segmentation = new GaugeSegmentationProperties(); + this.defaultColorRange = []; + this.targets = new PropertiesArray3(RadialGaugeTargetProperties); + this.defaultTarget = new RadialGaugeTargetProperties(); + this.outerRadiusRatio = 1; + this.innerRadiusRatio = 1; + this.cornerRadius = 0; + this.cornerMode = "container"; + this.spacing = 0; + this.scale = new RadialGaugeScaleProperties(); + this.bar = new RadialGaugeBarProperties(); + this.needle = new RadialGaugeNeedleProperties(); + this.label = new RadialGaugeLabelProperties(); + this.secondaryLabel = new RadialGaugeSecondaryLabelProperties(); + this.tooltip = makeSeriesTooltip21(); + } +}; +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "value", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "startAngle", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "endAngle", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "segmentation", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "targets", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "defaultTarget", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "outerRadiusRatio", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "innerRadiusRatio", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "outerRadius", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "innerRadius", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "cornerMode", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "spacing", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "scale", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "bar", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "needle", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "secondaryLabel", 2); +__decorateClass([ + Property36 +], RadialGaugeSeriesProperties.prototype, "tooltip", 2); +function createConicGradient(fills, fillMode, defaultColorRange, scale) { + const { domain, range: range2 } = scale; + const [startAngle, endAngle] = range2; + const conicAngle = normalizeAngle3606((startAngle + endAngle) / 2 + Math.PI); + const sweepAngle = normalizeAngle360Inclusive2(endAngle - startAngle); + const colorStops = getColorStops2(fills, defaultColorRange, domain, fillMode).map( + ({ color: color6, stop }) => { + stop = Math.min(Math.max(stop, 0), 1); + const angle = startAngle + sweepAngle * stop; + stop = (angle - conicAngle) / (2 * Math.PI); + stop = (stop % 1 + 1) % 1; + return { stop, color: color6 }; + } + ); + return { + type: "gradient", + gradient: "conic", + colorSpace: "oklch", + colorStops, + bounds: "series", + rotation: toDegrees(conicAngle) + 90 + }; +} + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeUtil.ts +import { _ModuleSupport as _ModuleSupport149 } from "ag-charts-community"; +import { toPlainText as toPlainText6 } from "ag-charts-core"; +var { SectorBox: SectorBox5 } = _ModuleSupport149; +function computeClipSector(datum) { + const { startAngle, endAngle, clipStartAngle, clipEndAngle, innerRadius, outerRadius } = datum; + if (clipStartAngle == null || clipEndAngle == null) + return; + return new SectorBox5( + Math.max(clipStartAngle, startAngle), + Math.min(clipEndAngle, endAngle), + innerRadius, + outerRadius + ); +} +function clipSectorVisibility(startAngle, endAngle, clipSector) { + return Math.max(startAngle, clipSector.startAngle) <= Math.min(endAngle, clipSector.endAngle); +} +function hasClipSector(datum) { + return datum.clipStartAngle != null && datum.clipEndAngle != null; +} +function datumClipSector(datum, zero) { + const { clipStartAngle, clipEndAngle, innerRadius, outerRadius } = datum; + return new SectorBox5(clipStartAngle, zero ? clipStartAngle : clipEndAngle, innerRadius, outerRadius); +} +function prepareRadialGaugeSeriesAnimationFunctions(initialLoad, initialStartAngle) { + const phase = initialLoad ? "initial" : "update"; + const node = { + fromFn(sect, datum) { + const previousDatum = sect.previousDatum; + let { startAngle, endAngle } = previousDatum ?? datum; + const previousClipSector = previousDatum != null && hasClipSector(previousDatum) ? datumClipSector(previousDatum, initialLoad) : void 0; + const nextClipSector = hasClipSector(datum) ? datumClipSector(datum, initialLoad) : void 0; + let clipSector; + if (previousClipSector != null && nextClipSector != null) { + clipSector = previousClipSector; + } else if (previousClipSector == null && nextClipSector != null) { + clipSector = nextClipSector; + startAngle = datum.startAngle; + endAngle = datum.endAngle; + } else if (previousClipSector != null && nextClipSector == null) { + clipSector = void 0; + startAngle = datum.startAngle; + endAngle = datum.endAngle; + } else if (initialLoad) { + endAngle = startAngle; + } + return { startAngle, endAngle, clipSector, phase }; + }, + toFn(_sect, datum) { + const { startAngle, endAngle } = datum; + let clipSector; + if (hasClipSector(datum)) { + clipSector = datumClipSector(datum, false); + } + return { startAngle, endAngle, clipSector }; + }, + applyFn(sect, params) { + const { startAngle, endAngle } = params; + let { clipSector } = params; + if (clipSector != null) { + clipSector = new SectorBox5( + Math.max(startAngle, clipSector.startAngle), + Math.min(endAngle, clipSector.endAngle), + clipSector.innerRadius, + clipSector.outerRadius + ); + } + const visible = clipSector == null || clipSectorVisibility(startAngle, endAngle, clipSector); + sect.startAngle = startAngle; + sect.endAngle = endAngle; + sect.clipSector = clipSector; + sect.visible = visible; + } + }; + const needle = { + fromFn(needleNode) { + let { angle: rotation } = needleNode.previousDatum ?? needleNode.datum; + if (initialLoad) { + rotation = initialStartAngle; + } + return { rotation, phase }; + }, + toFn(_needleNode, datum) { + const { angle: rotation } = datum; + return { rotation }; + } + }; + return { node, needle }; +} +function resetRadialGaugeSeriesResetSectorFunction(_node, datum) { + const { startAngle, endAngle } = datum; + const clipSector = computeClipSector(datum); + const visible = clipSector == null || clipSectorVisibility(startAngle, endAngle, clipSector); + return { startAngle, endAngle, clipSector, visible }; +} +function resetRadialGaugeSeriesResetNeedleFunction(_node, datum) { + const { angle } = datum; + return { rotation: angle }; +} +var verticalAlignFactors3 = { + top: 0, + middle: 0.5, + bottom: 1 +}; +function formatRadialGaugeLabels(series, ctx, selection, opts, innerRadius, datumOverrides) { + const { padding, textAlign, verticalAlign } = opts; + let labelDatum; + let secondaryLabelDatum; + selection.each((_node, datum) => { + if (datum.label === "primary" /* Primary */) { + labelDatum = datum; + } else if (datum.label === "secondary" /* Secondary */) { + secondaryLabelDatum = datum; + } + }); + if (labelDatum == null) + return; + const labelText = getLabelText(series.id, ctx, labelDatum, datumOverrides?.label); + if (labelText == null) + return; + const secondaryLabelText = secondaryLabelDatum == null ? void 0 : getLabelText(series.id, ctx, secondaryLabelDatum, datumOverrides?.secondaryLabel); + const params = { padding }; + const horizontalFactor = textAlign === "center" ? 2 : 1; + const verticalFactor = verticalAlign === "middle" ? 2 : 1; + const sizeFittingHeight = (height2) => ({ + width: Math.sqrt(Math.max(innerRadius ** 2 - (height2 / verticalFactor) ** 2, 0)) * horizontalFactor, + height: Math.min(height2, verticalFactor * innerRadius), + meta: null + }); + let labelLayout; + let secondaryLabelLayout; + let height; + if (secondaryLabelDatum != null && secondaryLabelText != null) { + const layout = formatStackedLabels( + toPlainText6(labelText), + labelDatum, + toPlainText6(secondaryLabelText), + secondaryLabelDatum, + params, + sizeFittingHeight + ); + labelLayout = layout?.label; + secondaryLabelLayout = layout?.secondaryLabel; + height = layout?.height ?? 0; + } else { + const layout = formatSingleLabel(toPlainText6(labelText), labelDatum, params, sizeFittingHeight); + labelLayout = layout?.[0]; + secondaryLabelLayout = void 0; + height = layout?.[0].height ?? 0; + } + const rectYOffset = height * verticalAlignFactors3[verticalAlign]; + selection.each((label, datum) => { + let layout; + if (datum.label === "primary" /* Primary */) { + layout = labelLayout; + } else if (datum.label === "secondary" /* Secondary */) { + layout = secondaryLabelLayout; + } + if (layout == null) { + label.visible = false; + return; + } + label.visible = true; + label.text = layout.text; + label.fontSize = layout.fontSize; + label.lineHeight = layout.lineHeight; + label.textAlign = textAlign; + label.textBaseline = "middle"; + const rectOriginInLabelRect = datum.label === "primary" /* Primary */ ? layout.height / 2 : height - layout.height / 2; + label.y = datum.centerY + rectOriginInLabelRect - rectYOffset; + label.x = datum.centerX; + }); +} + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeries.ts +var { + fromToMotion: fromToMotion5, + resetMotion: resetMotion4, + SeriesNodePickMode: SeriesNodePickMode15, + StateMachine: StateMachine4, + createDatumId: createDatumId19, + normalizeAngle360: normalizeAngle3607, + normalizeAngle360Inclusive: normalizeAngle360Inclusive3, + isBetweenAngles: isBetweenAngles2, + sectorBox, + toRadians: toRadians4, + BBox: BBox14, + Group: Group15, + PointerEvents: PointerEvents12, + Selection: Selection14, + Sector: Sector6, + SectorBox: SectorBox6, + Text: Text7, + Marker: Marker5, + tickFormat: tickFormat2, + applyShapeStyle: applyShapeStyle17, + mergeDefaults: mergeDefaults17 +} = _ModuleSupport150; +var targetPlacementRotation = { + inside: 90, + middle: 0, + outside: -90 +}; +var outsideLabelPlacements = [ + { textAlign: "left", textBaseline: "top" }, + { textAlign: "right", textBaseline: "top" }, + { textAlign: "right", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "bottom" } +]; +var insideLabelPlacements = [ + { textAlign: "right", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "top" }, + { textAlign: "right", textBaseline: "top" } +]; +var RadialGaugeSeries = class extends _ModuleSupport150.Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode15.EXACT_SHAPE_MATCH, SeriesNodePickMode15.NEAREST_NODE] + }); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.properties = new RadialGaugeSeriesProperties(); + this.scale = new LinearAngleScale(); + this.scaleGroup = this.contentGroup.appendChild(new Group15({ name: "scaleGroup" })); + this.itemGroup = this.contentGroup.appendChild(new Group15({ name: "itemGroup" })); + this.itemNeedleGroup = this.contentGroup.appendChild(new Group15({ name: "itemNeedleGroup" })); + this.itemTargetGroup = this.contentGroup.appendChild(new Group15({ name: "itemTargetGroup" })); + this.itemTargetLabelGroup = this.contentGroup.appendChild(new Group15({ name: "itemTargetLabelGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group15({ name: "itemLabelGroup" })); + this.highlightTargetGroup = this.highlightGroup.appendChild( + new Group15({ name: "itemTargetLabelGroup" }) + ); + this.tickGroup = this.contentGroup.appendChild(new Group15({ name: "tickGroup" })); + this.scaleSelection = Selection14.select( + this.scaleGroup, + () => this.nodeFactory() + ); + this.datumSelection = Selection14.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.needleSelection = Selection14.select( + this.itemNeedleGroup, + RadialGaugeNeedle + ); + this.targetSelection = Selection14.select( + this.itemTargetGroup, + () => this.markerFactory() + ); + this.targetLabelSelection = Selection14.select(this.itemTargetLabelGroup, Text7); + this.labelSelection = Selection14.select( + this.itemLabelGroup, + Text7 + ); + this.highlightTargetSelection = Selection14.select(this.highlightTargetGroup, () => this.markerFactory()); + this.tickSelection = Selection14.select(this.tickGroup, _ModuleSupport150.TransformableText); + this.datumUnion = new DatumUnion(); + this.animationState = new StateMachine4("empty", { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.animateReadyResize(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateWaitingUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty" + }, + reset: "empty", + skip: "ready" + } + }); + this.scaleGroup.pointerEvents = PointerEvents12.None; + this.tickGroup.pointerEvents = PointerEvents12.None; + this.itemNeedleGroup.pointerEvents = PointerEvents12.None; + this.itemLabelGroup.pointerEvents = PointerEvents12.None; + } + get hasData() { + return this.properties.value != null; + } + nodeFactory() { + return new Sector6(); + } + markerFactory() { + const marker = new Marker5(); + marker.size = 1; + return marker; + } + processData() { + this.nodeDataRefresh = true; + this.animationState.transition("updateData"); + } + formatLabel(value) { + const { min, max } = this.properties.scale; + return formatLabel(value, { min, max }); + } + layoutScale() { + const { scale, properties } = this; + const { seriesRectWidth, seriesRectHeight } = this.nodeDataDependencies; + const { scale: scaleProps, outerRadius } = this.properties; + const { min, max, label, interval } = scaleProps; + const startAngle = toRadians4(properties.startAngle - 90); + const endAngle = toRadians4(properties.endAngle - 90); + const sweepAngle = normalizeAngle360Inclusive3(endAngle - startAngle); + const largerThanHalf = sweepAngle > Math.PI; + const containsTop = largerThanHalf || isBetweenAngles2(1.5 * Math.PI, startAngle, endAngle); + const containsRight = largerThanHalf || isBetweenAngles2(0 * Math.PI, startAngle, endAngle); + const containsBottom = largerThanHalf || isBetweenAngles2(0.5 * Math.PI, startAngle, endAngle); + const containsLeft = largerThanHalf || isBetweenAngles2(1 * Math.PI, startAngle, endAngle); + let textAlign; + if (containsLeft && !containsRight) { + textAlign = "right"; + } else if (!containsLeft && containsRight) { + textAlign = "left"; + } else { + textAlign = "center"; + } + let verticalAlign; + if (containsTop && !containsBottom) { + verticalAlign = "bottom"; + } else if (!containsTop && containsBottom) { + verticalAlign = "top"; + } else { + verticalAlign = "middle"; + } + const unitBox = sectorBox({ + startAngle, + endAngle, + innerRadius: 0, + outerRadius: 0.5 + }); + const centerXOffset = -(unitBox.x + unitBox.width / 2) * 2; + const centerYOffset = -(unitBox.y + unitBox.height / 2) * 2; + const unitBoxSize = Math.min(seriesRectWidth / unitBox.width, seriesRectHeight / unitBox.height); + scale.domain = [min, max]; + scale.range = [startAngle, endAngle]; + scale.arcLength = unitBoxSize / 2; + const { maxSpacing, minSpacing } = interval; + const { arcLength } = scale; + const minTickCount = maxSpacing ? Math.floor(arcLength / maxSpacing) : 1; + const maxTickCount = minSpacing ? Math.floor(arcLength / minSpacing) : Infinity; + const preferredTickCount = Math.floor(4 / Math.PI * Math.abs(scale.range[0] - scale.range[1])); + const tickCount = Math.max(minTickCount, Math.min(maxTickCount, preferredTickCount)); + const ticks = interval.values ?? scale.ticks({ + nice: false, + interval: interval.step, + minTickCount, + maxTickCount, + tickCount + })?.ticks ?? []; + const tickFormatter = tickFormat2(ticks, typeof label.format === "string" ? label.format : void 0); + const measurer = cachedTextMeasurer9(label); + const tickData = ticks.map((value, index) => { + let text; + if (label.formatter) { + text = formatWithContext(this.ctx, label.formatter, { + value, + index, + domain: scale.domain, + boundSeries: void 0 + }); + } + text ?? (text = tickFormatter?.(value)); + if (text == null) + return; + const { width, height } = isArray6(text) ? measureTextSegments5(text, label) : measurer.measureLines(text); + return { index, value, text, width, height }; + }).filter((value) => value != null); + const maxWidth = tickData.reduce((m, t) => Math.max(m, t.width), 0); + const maxHeight = tickData.reduce((m, t) => Math.max(m, t.height), 0); + const labelInset = label.enabled ? Math.max(maxWidth, maxHeight) + label.spacing : 0; + const radiusBounds = Math.max( + 0.5 * unitBoxSize - labelInset, + // seriesRect may have negative size + 0 + ); + const radius = outerRadius ?? radiusBounds; + this.centerX = seriesRectWidth / 2 + centerXOffset * radius; + this.centerY = seriesRectHeight / 2 + centerYOffset * radius; + this.radius = radius; + this.textAlign = textAlign; + this.verticalAlign = verticalAlign; + return tickData; + } + getShapeFillBBox() { + const { centerX, centerY, radius } = this; + const bbox = new BBox14(centerX - radius, centerY - radius, 2 * radius, 2 * radius); + return { + series: bbox, + axis: bbox + }; + } + getTargets() { + const { properties } = this; + const defaultTarget = properties.defaultTarget; + return Array.from(properties.targets).map((target) => { + const { + text = defaultTarget.text, + value = defaultTarget.value ?? 0, + shape = defaultTarget.shape ?? "triangle", + rotation = defaultTarget.rotation ?? 0, + placement = defaultTarget.placement ?? "middle", + spacing = defaultTarget.spacing ?? 0, + size = defaultTarget.size ?? 0 + } = target; + const { + enabled: labelEnabled = defaultTarget.label.enabled, + color: labelColor = defaultTarget.label.color ?? "black", + fontStyle: labelFontStyle = defaultTarget.label.fontStyle ?? "normal", + fontWeight: labelFontWeight = defaultTarget.label.fontWeight ?? "normal", + fontSize: labelFontSize = defaultTarget.label.fontSize, + fontFamily: labelFontFamily = defaultTarget.label.fontFamily, + spacing: labelSpacing = defaultTarget.label.spacing ?? 0 + } = target.label; + return { + text, + value, + shape, + placement, + spacing, + size, + rotation, + label: { + enabled: labelEnabled, + color: labelColor, + fontStyle: labelFontStyle, + fontWeight: labelFontWeight, + fontSize: labelFontSize, + fontFamily: labelFontFamily, + spacing: labelSpacing + }, + style: target.getStyle() + }; + }); + } + getTargetRadius(target) { + const { radius, properties } = this; + const { innerRadiusRatio, outerRadiusRatio } = properties; + const { placement, spacing, size } = target; + const outerRadius = radius * outerRadiusRatio; + const innerRadius = radius * innerRadiusRatio; + switch (placement) { + case "inside": + return Math.max(innerRadius - spacing - size / 2, 0); + case "outside": + return outerRadius + spacing + size / 2; + default: + return (innerRadius + outerRadius) / 2; + } + } + getTargetLabel(target) { + const { scale } = this; + const { value, size, placement, label } = target; + const { spacing, color: fill, fontStyle, fontWeight, fontSize, fontFamily } = label; + const lineHeight = void 0; + const angle = scale.convert(value); + const quadrant = Math.trunc(normalizeAngle3607(angle) / (Math.PI / 2)); + const offset = size / 2 + spacing; + let textAlign; + let textBaseline; + let offsetX; + let offsetY; + switch (placement) { + case "outside": + ({ textAlign, textBaseline } = outsideLabelPlacements[quadrant]); + offsetX = offset * Math.cos(angle); + offsetY = offset * Math.sin(angle); + break; + case "inside": + ({ textAlign, textBaseline } = insideLabelPlacements[quadrant]); + offsetX = -offset * Math.cos(angle); + offsetY = -offset * Math.sin(angle); + break; + default: + textAlign = "center"; + textBaseline = "bottom"; + offsetX = 0; + offsetY = -offset; + break; + } + return { + offsetX, + offsetY, + fill, + textAlign, + textBaseline, + fontStyle, + fontWeight, + fontSize, + fontFamily, + lineHeight + }; + } + createNodeData() { + const tickData = this.layoutScale(); + const { id: seriesId, scale, properties, radius, centerX, centerY } = this; + const { + value, + innerRadiusRatio, + outerRadiusRatio, + segmentation, + cornerRadius, + cornerMode, + needle, + bar, + scale: scaleProps, + label, + secondaryLabel + } = properties; + const { + outerRadius = radius * outerRadiusRatio, + innerRadius = radius * innerRadiusRatio, + defaultColorRange + } = properties; + const targets = this.getTargets(); + const nodeData = []; + const targetData = []; + const needleData = []; + const labelData = []; + const scaleData = []; + const cornersOnAllItems = cornerMode === "item"; + const containerStartAngle = scale.convert(scale.domain[0]); + const containerEndAngle = scale.convert(value); + const maxTicks = Math.ceil(normalizeAngle360Inclusive3(containerEndAngle - containerStartAngle) * radius); + let segments = segmentation.enabled ? segmentation.interval.getSegments(scale, maxTicks) : void 0; + const barStyle = bar.getStyle(defaultColorRange, scale); + const scaleStyle = scaleProps.getStyle(bar.enabled, defaultColorRange, scale); + if (segments == null && cornersOnAllItems) { + const segmentStart = Math.min(...scale.domain); + const segmentEnd = Math.max(...scale.domain); + const datum = { value, segmentStart, segmentEnd }; + const appliedCornerRadius = Math.min(cornerRadius, (outerRadius - innerRadius) / 2); + const angleInset = appliedCornerRadius / ((innerRadius + outerRadius) / 2); + nodeData.push({ + series: this, + itemId: `value`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: containerStartAngle - angleInset, + endAngle: containerEndAngle + angleInset, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornerRadius, + endCornerRadius: cornerRadius, + style: barStyle + }); + scaleData.push({ + series: this, + itemId: `scale`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: scale.range[0] - angleInset, + endAngle: scale.range[1] + angleInset, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornerRadius, + endCornerRadius: cornerRadius, + style: scaleStyle + }); + } else { + segments ?? (segments = scale.domain); + for (let i = 0; i < segments.length - 1; i++) { + const segmentStart = segments[i]; + const segmentEnd = segments[i + 1]; + const datum = { value, segmentStart, segmentEnd }; + const isStart = i === 0; + const isEnd = i === segments.length - 2; + const itemStartAngle = scale.convert(segmentStart); + const itemEndAngle = scale.convert(segmentEnd); + nodeData.push({ + series: this, + itemId: `value-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: itemStartAngle, + endAngle: itemEndAngle, + clipStartAngle: containerStartAngle, + clipEndAngle: containerEndAngle, + startCornerRadius: cornersOnAllItems || isStart ? cornerRadius : 0, + endCornerRadius: cornersOnAllItems || isEnd ? cornerRadius : 0, + style: barStyle + }); + scaleData.push({ + series: this, + itemId: `scale-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: itemStartAngle, + endAngle: itemEndAngle, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornersOnAllItems || isStart ? cornerRadius : 0, + endCornerRadius: cornersOnAllItems || isEnd ? cornerRadius : 0, + style: scaleStyle + }); + } + } + if (!needle.enabled && label.enabled) { + const { + text, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter = (params) => this.formatLabel(params.value) + } = label; + labelData.push({ + label: "primary" /* Primary */, + centerX, + centerY, + text, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + }); + } + if (!needle.enabled && secondaryLabel.enabled) { + const { + text, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + } = secondaryLabel; + labelData.push({ + label: "secondary" /* Secondary */, + centerX, + centerY, + text, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + }); + } + if (needle.enabled) { + let needleRadius = needle.radiusRatio == null ? innerRadius : radius * needle.radiusRatio; + needleRadius = Math.max(needleRadius - needle.spacing, 0); + const needleAngle = scale.convert(value); + needleData.push({ + centerX, + centerY, + radius: needleRadius, + angle: needleAngle, + series: this + }); + } + for (let i = 0; i < targets.length; i += 1) { + const target = targets[i]; + const { value: targetValue, text, size, shape, style } = target; + if (targetValue < Math.min(...scale.domain) || targetValue > Math.max(...scale.domain)) { + continue; + } + const targetRadius = this.getTargetRadius(target); + const targetAngle = scale.convert(targetValue); + const targetRotation = toRadians4(target.rotation + targetPlacementRotation[target.placement]); + targetData.push({ + series: this, + itemId: `target-${i}`, + midPoint: { + x: targetRadius * Math.cos(targetAngle) + centerX, + y: targetRadius * Math.sin(targetAngle) + centerY + }, + datum: { value: targetValue }, + datumIndex: { type: 1 /* Target */, index: i }, + type: 1 /* Target */, + value: targetValue, + text, + centerX, + centerY, + shape, + radius: targetRadius, + angle: targetAngle, + rotation: targetRotation, + size, + label: this.getTargetLabel(target), + style + }); + } + return { + itemId: seriesId, + nodeData, + needleData, + targetData, + labelData, + scaleData, + tickData + }; + } + updateSelections(resize) { + if (this.nodeDataRefresh || resize) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + highlightDatum(node) { + if (node != null && node.series === this && node.type === 1 /* Target */) { + return node; + } + } + update({ seriesRect }) { + const { + datumSelection, + labelSelection, + needleSelection, + targetSelection, + targetLabelSelection, + scaleSelection, + highlightTargetSelection, + tickSelection + } = this; + const resize = this.checkResize(seriesRect); + this.updateSelections(resize); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const needleData = this.contextNodeData?.needleData ?? []; + const targetData = this.contextNodeData?.targetData ?? []; + const scaleData = this.contextNodeData?.scaleData ?? []; + const tickData = this.contextNodeData?.tickData ?? []; + const highlightTargetDatum = this.highlightDatum(this.ctx.highlightManager.getActiveHighlight()); + this.scaleSelection = this.updateScaleSelection({ scaleData, scaleSelection }); + this.updateScaleNodes({ scaleSelection }); + this.needleSelection = this.updateNeedleSelection({ needleData, needleSelection }); + this.updateNeedleNodes({ needleSelection }); + this.targetSelection = this.updateTargetSelection({ targetData, targetSelection }); + this.updateTargetStyles({ targetSelection, isHighlight: false }); + this.updateTargetNodes({ targetSelection }); + this.targetLabelSelection = this.updateTargetLabelSelection({ targetData, targetLabelSelection }); + this.updateTargetLabelNodes({ targetLabelSelection }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightTargetSelection = this.updateTargetSelection({ + targetData: highlightTargetDatum == null ? [] : [highlightTargetDatum], + targetSelection: highlightTargetSelection + }); + this.updateTargetStyles({ targetSelection: highlightTargetSelection, isHighlight: true }); + this.updateTargetNodes({ targetSelection: highlightTargetSelection }); + this.tickSelection = this.updateTickSelection({ tickData, tickSelection }); + this.updateTickNodes({ tickSelection }); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => { + return createDatumId19(opts.nodeData.length, datum.itemId); + }); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + const { ctx, properties } = this; + const { segmentation } = properties; + const sectorSpacing = segmentation.spacing ?? 0; + const animationDisabled = ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((sector, datum) => { + const { centerX, centerY, innerRadius, outerRadius, startCornerRadius, endCornerRadius } = datum; + sector.centerX = centerX; + sector.centerY = centerY; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + sector.pointerEvents = this.properties.bar.enabled ? _ModuleSupport150.PointerEvents.All : _ModuleSupport150.PointerEvents.None; + applyShapeStyle17(sector, datum.style, fillBBox); + sector.startOuterCornerRadius = startCornerRadius; + sector.startInnerCornerRadius = startCornerRadius; + sector.endOuterCornerRadius = endCornerRadius; + sector.endInnerCornerRadius = endCornerRadius; + sector.radialEdgeInset = (sectorSpacing + sector.strokeWidth) / 2; + sector.concentricEdgeInset = sector.strokeWidth / 2; + if (animationDisabled || sector.previousDatum == null) { + sector.setProperties(resetRadialGaugeSeriesResetSectorFunction(sector, datum)); + } + }); + this.datumUnion.update(datumSelection, this.itemGroup, _ModuleSupport150.Sector, (node, first, last) => { + node.clipSector ?? (node.clipSector = new SectorBox6(Number.NaN, Number.NaN, Number.NaN, Number.NaN)); + node.centerX = first.centerX; + node.centerY = first.centerY; + node.outerRadius = node.clipSector.outerRadius = first.outerRadius; + node.innerRadius = node.clipSector.innerRadius = first.innerRadius; + node.startAngle = node.clipSector.startAngle = first.startAngle; + node.startInnerCornerRadius = first.startInnerCornerRadius; + node.startOuterCornerRadius = first.startOuterCornerRadius; + node.endAngle = last.endAngle; + node.clipSector.endAngle = last.clipSector?.endAngle ?? last.endAngle; + node.endInnerCornerRadius = last.endInnerCornerRadius; + node.endOuterCornerRadius = last.endOuterCornerRadius; + node.pointerEvents = _ModuleSupport150.PointerEvents.None; + }); + } + updateScaleSelection(opts) { + return opts.scaleSelection.update(opts.scaleData, void 0, (datum) => { + return createDatumId19(opts.scaleData.length, datum.itemId); + }); + } + updateScaleNodes(opts) { + const { scaleSelection } = opts; + const { segmentation } = this.properties; + const sectorSpacing = segmentation.spacing ?? 0; + const fillBBox = this.getShapeFillBBox(); + scaleSelection.each((sector, datum) => { + const { centerX, centerY, innerRadius, outerRadius, startCornerRadius, endCornerRadius } = datum; + sector.centerX = centerX; + sector.centerY = centerY; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + applyShapeStyle17(sector, datum.style, fillBBox); + sector.startOuterCornerRadius = startCornerRadius; + sector.startInnerCornerRadius = startCornerRadius; + sector.endOuterCornerRadius = endCornerRadius; + sector.endInnerCornerRadius = endCornerRadius; + sector.radialEdgeInset = (sectorSpacing + sector.strokeWidth) / 2; + sector.concentricEdgeInset = sector.strokeWidth / 2; + sector.setProperties(resetRadialGaugeSeriesResetSectorFunction(sector, datum)); + }); + } + updateNeedleSelection(opts) { + return opts.needleSelection.update(opts.needleData, void 0, () => createDatumId19(0)); + } + updateNeedleNodes(opts) { + const { needleSelection } = opts; + const { fill, fillOpacity, stroke, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties.needle; + const animationDisabled = this.ctx.animationManager.isSkipped(); + needleSelection.each((needle, datum) => { + const { centerX, centerY, radius } = datum; + const scale = radius * 2; + needle.d = RadialGaugeNeedle.defaultPathData; + applyShapeStyle17(needle, { + fill, + fillOpacity, + stroke, + strokeOpacity, + strokeWidth: strokeWidth / scale, + lineDash: lineDash.map((d) => d / scale), + lineDashOffset: lineDashOffset / scale + }); + needle.translationX = centerX; + needle.translationY = centerY; + needle.scalingX = scale; + needle.scalingY = scale; + if (animationDisabled) { + needle.setProperties(resetRadialGaugeSeriesResetNeedleFunction(needle, datum)); + } + }); + } + updateTargetSelection(opts) { + return opts.targetSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetStyles({ + targetSelection, + isHighlight + }) { + targetSelection.each((_, datum) => { + datum.style = this.getTargetStyle(isHighlight, datum); + }); + } + updateTargetNodes({ + targetSelection + }) { + targetSelection.each((target, datum) => { + const { centerX, centerY, angle, radius, shape, size, rotation } = datum; + applyShapeStyle17(target, datum.style); + target.size = size; + target.shape = shape === "line" ? lineMarker : shape; + target.translationX = centerX + radius * Math.cos(angle); + target.translationY = centerY + radius * Math.sin(angle); + target.rotation = angle + rotation; + }); + } + getTargetStyle(isHighlight, { datumIndex, style }) { + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + return mergeDefaults17(highlightStyle, { + ...style, + opacity: 1 + }); + } + updateTargetLabelSelection(opts) { + return opts.targetLabelSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetLabelNodes(opts) { + const { targetLabelSelection } = opts; + targetLabelSelection.each((label, target) => { + const { centerX, centerY, radius, angle, text } = target; + const { offsetX, offsetY, fill, fontStyle, fontWeight, fontSize, fontFamily, textAlign, textBaseline } = target.label; + if (text == null) { + label.visible = false; + return; + } + label.visible = true; + label.x = centerX + radius * Math.cos(angle) + offsetX; + label.y = centerY + radius * Math.sin(angle) + offsetY; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(opts.labelData, void 0, (datum) => datum.label); + } + updateLabelNodes(opts) { + const { labelSelection } = opts; + const animationDisabled = this.ctx.animationManager.isSkipped(); + labelSelection.each((label, datum) => { + label.fill = datum.fill; + label.fontStyle = datum.fontStyle; + label.fontWeight = datum.fontWeight; + label.fontFamily = datum.fontFamily; + }); + if (animationDisabled || this.labelsHaveExplicitText()) { + this.formatLabelText(); + } + } + updateTickSelection(opts) { + return opts.tickSelection.update(opts.tickData, void 0, (datum) => datum.index); + } + updateTickNodes(opts) { + const { scale, radius, centerX, centerY, properties } = this; + const { enabled, color: color6, fontFamily, fontSize, fontStyle, fontWeight, spacing } = properties.scale.label; + const rotation = toRadians4(properties.scale.label.rotation ?? 0); + opts.tickSelection.each((label, datum) => { + if (!enabled) { + label.visible = false; + return; + } + label.visible = true; + label.text = datum.text; + label.fill = color6; + label.fontFamily = fontFamily; + label.fontSize = fontSize; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.textAlign = "center"; + label.textBaseline = "middle"; + const angle = scale.convert(datum.value); + const { width, height } = datum; + const originX = Math.abs(radius * Math.cos(angle)); + const originY = Math.abs(radius * Math.sin(angle)); + const x0 = Math.min(Math.max(Math.abs(radius / Math.tan(angle)), originX - width / 2), originX + width / 2); + const y0 = Math.min( + Math.max(Math.abs(radius * Math.tan(angle)), originY - height / 2), + originY + height / 2 + ); + const outerR = Math.hypot(x0, y0); + const x = centerX + (outerR + spacing) * Math.cos(angle); + const y = centerY + (outerR + spacing) * Math.sin(angle); + label.x = x; + label.y = y; + label.rotationCenterX = x; + label.rotationCenterY = y; + label.rotation = rotation; + }); + } + labelsHaveExplicitText() { + for (const { datum } of this.labelSelection) { + if (datum.text == null) { + return false; + } + } + return true; + } + formatLabelText(datum) { + const { labelSelection, radius, textAlign, verticalAlign } = this; + const { spacing: padding, innerRadiusRatio } = this.properties; + formatRadialGaugeLabels( + this, + this.ctx, + labelSelection, + { padding, textAlign, verticalAlign }, + radius * innerRadiusRatio, + datum + ); + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + resetMotion4([this.datumSelection], resetRadialGaugeSeriesResetSectorFunction); + resetMotion4([this.needleSelection], resetRadialGaugeSeriesResetNeedleFunction); + this.formatLabelText(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + animateLabelText(params = {}) { + const { animationManager } = this.ctx; + let labelFrom; + let labelTo; + let secondaryLabelFrom; + let secondaryLabelTo; + this.labelSelection.each((label, datum) => { + label.opacity = 1; + if (datum.label === "primary" /* Primary */) { + labelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + labelTo = datum.value; + } else if (datum.label === "secondary" /* Secondary */) { + secondaryLabelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + secondaryLabelTo = datum.value; + } + }); + if (this.labelsHaveExplicitText()) { + } else if (labelTo == null || secondaryLabelTo == null) { + this.formatLabelText(); + } else if (labelFrom === labelTo && secondaryLabelFrom === secondaryLabelTo) { + this.formatLabelText({ label: labelTo, secondaryLabel: secondaryLabelTo }); + } else { + const animationId = `${this.id}_labels`; + animationManager.animate({ + id: animationId, + groupId: "label", + from: { label: labelFrom, secondaryLabel: secondaryLabelFrom }, + to: { label: labelTo, secondaryLabel: secondaryLabelTo }, + phase: params.phase ?? "update", + onUpdate: (datum) => this.formatLabelText(datum), + onStop: () => this.formatLabelText({ label: labelTo, secondaryLabel: secondaryLabelTo }) + }); + } + } + animateEmptyUpdateReady() { + const { animationManager } = this.ctx; + const { node, needle } = prepareRadialGaugeSeriesAnimationFunctions(true, this.scale.range[0]); + fromToMotion5(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion5(this.id, "needle", animationManager, [this.needleSelection], needle, () => "needle"); + fromToMotion5( + this.id, + "label", + animationManager, + [this.labelSelection], + fadeInFns, + (_label, datum) => datum.label + ); + this.animateLabelText({ + from: this.properties.scale.min, + phase: "initial" + }); + } + animateWaitingUpdateReady() { + const { animationManager } = this.ctx; + const { node, needle } = prepareRadialGaugeSeriesAnimationFunctions(false, this.scale.range[0]); + fromToMotion5(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion5(this.id, "needle", animationManager, [this.needleSelection], needle, () => "needle"); + this.animateLabelText(); + } + animateReadyResize() { + this.resetAllAnimation(); + } + dataCount() { + return Number.NaN; + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData() { + return []; + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties } = this; + const { tooltip } = properties; + let value; + let text; + let fallbackLabel; + if (datumIndex.type === 0 /* Node */) { + value = properties.value; + text = properties.label.text; + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeValue"); + } else { + ({ value, text } = properties.targets[datumIndex.index]); + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeTarget"); + } + if (value == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + data: [{ label: text, fallbackLabel, value: this.formatLabel(value) }] + }, + { seriesId, title: void 0, datum: void 0, value } + ); + } + pickNodeClosestDatum(point) { + return pickGaugeNearestDatum(this, point); + } + pickFocus(opts) { + return pickGaugeFocus(this, opts); + } + getCaptionText() { + const { value } = this.properties; + const description = []; + description.push(this.formatLabel(value)); + this.labelSelection.each((_label, datum) => { + const text = getLabelText(this.id, this.ctx, datum); + if (text != null) { + description.push(toPlainText7(text)); + } + }); + return description.join(". "); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +RadialGaugeSeries.className = "RadialGaugeSeries"; +RadialGaugeSeries.type = "radial-gauge"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeModule.ts +var { FONT_SIZE_RATIO } = _ModuleSupport151; +var RadialGaugeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "radial-gauge", + moduleFactory: (ctx) => new RadialGaugeSeries(ctx), + themeTemplate: { + minWidth: 200, + minHeight: 200, + tooltip: { + enabled: false + }, + series: { + outerRadiusRatio: 1, + innerRadiusRatio: 0.8, + startAngle: 270, + endAngle: 270 + 180, + defaultColorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $interpolate: [{ $palette: "secondDivergingColors" }, 5] }, + _ModuleSupport151.SAFE_RANGE2_OPERATION + ] + }, + scale: { + // @ts-expect-error undocumented option + defaultFill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + stroke: { $path: ["/2", _ModuleSupport151.SAFE_STROKE_FILL_OPERATION, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 12 + } + }, + bar: { + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + segmentation: { + enabled: false, + interval: {}, + spacing: 2 + }, + defaultTarget: { + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + size: 10, + shape: "triangle", + placement: "outside", + spacing: 5, + label: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 5 + } + }, + needle: { + enabled: false, + fill: { $ref: "foregroundColor" }, + spacing: 10 + }, + label: { + ..._ModuleSupport151.LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: 56, + minimumFontSize: 18 / 56, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + }, + secondaryLabel: { + ..._ModuleSupport151.LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: FONT_SIZE_RATIO.LARGE }, + minimumFontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "subtleTextColor" } + }, + tooltip: { + range: { $path: ["/tooltip/range", 10] } + } + } + } +}; +var RadialGaugeSeriesModule = { + type: "series", + name: "radial-gauge", + chartType: "standalone", + enterprise: true, + options: _ModuleSupport151.radialGaugeSeriesOptionsDef, + create: (ctx) => new RadialGaugeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/sankey/sankeyModule.ts +import { _ModuleSupport as _ModuleSupport156 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeries.ts +import { + _ModuleSupport as _ModuleSupport154 +} from "ag-charts-community"; +import { Logger as Logger12, cachedTextMeasurer as cachedTextMeasurer10, calcLineHeight as calcLineHeight2, toPlainText as toPlainText8, wrapText as wrapText2 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/sankey/sankeyLink.ts +import { _ModuleSupport as _ModuleSupport152 } from "ag-charts-community"; +import { clamp as clamp3 } from "ag-charts-core"; +var { BBox: BBox15, Path: Path12, Vec2, SceneChangeDetection: SceneChangeDetection7 } = _ModuleSupport152; +var SankeyLink = class extends Path12 { + constructor() { + super(...arguments); + this.x1 = 0; + this.x2 = 0; + this.y1 = 0; + this.y2 = 0; + this.height = 0; + this.inset = 0; + this.elbows = []; + } + computeBBox() { + const x = Math.min(this.x1, this.x2); + const width = Math.max(this.x1, this.x2) - x; + const y = Math.min(this.y1, this.y2); + const height = Math.max(this.y1, this.y2) - y + this.height; + return new BBox15(x, y, width, height); + } + updatePath() { + const { path, inset } = this; + path.clear(); + const height = this.height - 2 * this.inset; + const offset = height / 2; + let x1 = this.x1 + inset; + let y1 = this.y1 + inset; + path.moveTo(x1, y1); + for (const elbow of this.elbows) { + this.updatePathSection(x1, y1, elbow.x, elbow.y, height, -offset); + x1 = elbow.x; + y1 = elbow.y; + } + const x2 = this.x2 - inset; + const y2 = this.y2 + inset; + this.updatePathSection(x1, y1, x2, y2, height, -offset); + path.lineTo(x2, y2 + height); + x1 = x2; + y1 = y2; + for (const elbow of this.elbows.toReversed()) { + this.updatePathSection(x1, y1, elbow.x, elbow.y, height, offset); + x1 = elbow.x; + y1 = elbow.y; + } + this.updatePathSection(x1, y1, this.x1 + inset, this.y1 + inset, height, offset); + path.closePath(); + } + updatePathSection(x1, y1, x2, y2, height, yOffset) { + const { path } = this; + const start = Vec2.from(x1, y1 + yOffset + height / 2); + const end = Vec2.from(x2, y2 + yOffset + height / 2); + if (Math.abs(end.y - start.y) < 2) { + path.lineTo(end.x, end.y); + return; + } + let angle = Vec2.angle(Vec2.sub(end, start)); + if (angle < 0) + angle = 2 * Math.PI + angle; + const right = 0; + const down = Math.PI / 2; + const left = Math.PI; + const up = Math.PI * 1.5; + const innerArc = getArcValues(start, end, 0); + const outerArc = getArcValues(start, end, height); + if (innerArc.radius < height) { + path.cubicCurveTo((start.x + end.x) / 2, start.y, (start.x + end.x) / 2, end.y, end.x, end.y); + return; + } + if (angle >= up) { + path.arc(start.x, y1 - innerArc.radius, innerArc.radius, down, down + outerArc.angle, true); + path.arc(end.x, y2 + outerArc.radius, outerArc.radius, up + outerArc.angle, up); + path.lineTo(end.x, end.y); + } else if (angle > right && angle <= down) { + path.arc(start.x, y1 + outerArc.radius, outerArc.radius, up, up + outerArc.angle); + path.arc(end.x, y2 - innerArc.radius, innerArc.radius, down + innerArc.angle, down, true); + path.lineTo(end.x, end.y); + } else if (angle > down && angle <= left) { + path.arc(start.x, y1 + outerArc.radius, outerArc.radius - height, up, up + outerArc.angle, true); + path.arc(end.x, y2 - innerArc.radius, innerArc.radius + height, down + innerArc.angle, down); + path.lineTo(end.x, end.y); + } else { + path.arc(start.x, y1 - innerArc.radius, innerArc.radius + height, down, down + innerArc.angle); + path.arc(end.x, y2 + outerArc.radius, outerArc.radius - height, up + outerArc.angle, up, true); + path.lineTo(end.x, end.y); + } + } +}; +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "x1", 2); +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "x2", 2); +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "y1", 2); +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "y2", 2); +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "height", 2); +__decorateClass([ + SceneChangeDetection7() +], SankeyLink.prototype, "inset", 2); +function getArcValues(start, end, minRadius) { + const lineAngle = Vec2.angle(Vec2.sub(end, start)); + const chordLength = Vec2.distance(start, end); + const bisect = Vec2.add(start, Vec2.rotate(Vec2.from(chordLength / 2, 0), lineAngle)); + const gradient = -1 / Vec2.gradient(start, end); + const intercept = Vec2.intercept(bisect, gradient); + const offset = lerpClamp(0.1, 0.5, Math.PI / 2 - Math.abs(Vec2.gradient(start, end))); + const center = Vec2.intersectAtX(gradient, intercept, start.x); + const radius = Math.max(minRadius, Vec2.distance(start, center) * offset); + const angle = Vec2.angle(Vec2.sub(center, start), Vec2.sub(center, bisect)) / -(1.1 - offset); + return { angle, radius }; +} +function lerpClamp(a, b, ratio3) { + return clamp3(a, (b - a) * ratio3 + a, b); +} + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeriesProperties.ts +import { + _ModuleSupport as _ModuleSupport153 +} from "ag-charts-community"; +var { + BaseProperties: BaseProperties12, + FillGradientDefaults: FillGradientDefaults2, + FillPatternDefaults: FillPatternDefaults2, + FillImageDefaults: FillImageDefaults2, + makeSeriesTooltip: makeSeriesTooltip22, + SeriesProperties: SeriesProperties13, + Property: Property37, + Label: Label15 +} = _ModuleSupport153; +var SankeySeriesLabelProperties = class extends Label15 { + constructor() { + super(...arguments); + this.spacing = 1; + this.placement = void 0; + this.edgePlacement = void 0; + } +}; +__decorateClass([ + Property37 +], SankeySeriesLabelProperties.prototype, "spacing", 2); +__decorateClass([ + Property37 +], SankeySeriesLabelProperties.prototype, "placement", 2); +__decorateClass([ + Property37 +], SankeySeriesLabelProperties.prototype, "edgePlacement", 2); +var SankeySeriesLinkProperties = class extends BaseProperties12 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "fill", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "stroke", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "lineDash", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property37 +], SankeySeriesLinkProperties.prototype, "itemStyler", 2); +var SankeySeriesNodeProperties = class extends BaseProperties12 { + constructor() { + super(...arguments); + this.spacing = 1; + this.minSpacing = 0; + this.width = 1; + this.alignment = "justify"; + this.verticalAlignment = "center"; + this.sort = "auto"; + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "spacing", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "width", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "alignment", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "verticalAlignment", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "sort", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "fill", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "stroke", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "lineDash", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property37 +], SankeySeriesNodeProperties.prototype, "itemStyler", 2); +var SankeySeriesProperties = class extends SeriesProperties13 { + constructor() { + super(); + this.nodes = void 0; + this.idKey = ""; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.sizeKey = void 0; + this.sizeName = void 0; + this.fillGradientDefaults = new FillGradientDefaults2(); + this.fillPatternDefaults = new FillPatternDefaults2(); + this.fillImageDefaults = new FillImageDefaults2(); + this.defaultColorRange = []; + this.defaultPatternFills = []; + this.fills = []; + this.strokes = []; + this.label = new SankeySeriesLabelProperties(); + this.link = new SankeySeriesLinkProperties(); + this.node = new SankeySeriesNodeProperties(); + this.tooltip = makeSeriesTooltip22(); + this.highlightStyle.deprecated = false; + } + getStyle(isLink, fills, strokes, index) { + const { + fillOpacity, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + fill = fills[index % fills.length], + stroke = strokes[index % fills.length] + } = isLink ? this.link : this.node; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "nodes", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "fromKey", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "toKey", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "fillGradientDefaults", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "fillPatternDefaults", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "fillImageDefaults", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "defaultPatternFills", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "fills", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "strokes", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "label", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "link", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "node", 2); +__decorateClass([ + Property37 +], SankeySeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeries.ts +var { + Transformable: Transformable3, + applyShapeStyle: applyShapeStyle18, + SeriesNodePickMode: SeriesNodePickMode16, + createDatumId: createDatumId20, + getShapeStyle: getShapeStyle2, + getLabelStyles: getLabelStyles6, + Rect: Rect6, + BBox: BBox16, + mergeDefaults: mergeDefaults18 +} = _ModuleSupport154; +var SankeySeries = class extends FlowProportionSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode16.NEAREST_NODE, SeriesNodePickMode16.EXACT_SHAPE_MATCH] + }); + this.properties = new SankeySeriesProperties(); + } + isLabelEnabled() { + return (this.properties.labelKey != null || this.nodes == null) && this.properties.label.enabled; + } + linkFactory() { + return new SankeyLink(); + } + nodeFactory() { + return new Rect6(); + } + createNodeData() { + const { + id: seriesId, + _nodeDataDependencies: { seriesRectWidth, seriesRectHeight } = { seriesRectWidth: 0, seriesRectHeight: 0 } + } = this; + const { + fromKey, + toKey, + sizeKey, + labelKey, + label: { spacing: labelSpacing, placement: labelPlacement, edgePlacement: edgeLabelPlacement }, + node: { width: nodeWidth, alignment } + } = this.properties; + const createNode = (node) => ({ + ...node, + x: Number.NaN, + y: Number.NaN, + width: nodeWidth, + height: Number.NaN + }); + const createLink = (link) => ({ + ...link, + x1: Number.NaN, + x2: Number.NaN, + y1: Number.NaN, + y2: Number.NaN, + height: Number.NaN, + elbows: [] + }); + const { + nodeGraph: baseNodeGraph, + links, + maxPathLength + } = this.getNodeGraph(createNode, createLink, { includeCircularReferences: false }); + const nodeGraph = baseNodeGraph; + if (nodeGraph.size === 0) + return; + const columns = []; + for (let index = 0; index < maxPathLength; index += 1) { + columns.push({ index, size: 0, nodes: [], x: 0 }); + } + for (const graphNode of nodeGraph.values()) { + const { datum: node, linksBefore, linksAfter, maxPathLengthBefore, maxPathLengthAfter } = graphNode; + const size = Math.max( + linksBefore.reduce((acc, { link }) => acc + link.size, 0), + linksAfter.reduce((acc, { link }) => acc + link.size, 0) + ); + if (linksBefore.length === 0 && linksAfter.length === 0 || size === 0) { + graphNode.columnIndex = -1; + continue; + } + let column; + switch (alignment) { + case "left": + column = columns[maxPathLengthBefore]; + break; + case "right": + column = columns[maxPathLength - 1 - maxPathLengthAfter]; + break; + case "center": { + if (linksBefore.length !== 0) { + column = columns[maxPathLengthBefore]; + } else if (linksAfter.length === 0) { + column = columns[0]; + } else { + const columnIndex = linksAfter.reduce( + (acc, link) => Math.min(acc, link.node.maxPathLengthBefore), + maxPathLength + ) - 1; + column = columns[columnIndex]; + } + break; + } + case "justify": { + column = linksAfter.length === 0 ? columns[maxPathLength - 1] : columns[maxPathLengthBefore]; + break; + } + } + node.size = size; + const { label } = this.properties; + const labelText = label.enabled ? this.getLabelText( + node.label, + node.datum, + labelKey, + "label", + [], + this.properties.label, + { datum: node.datum, value: node.label, fromKey, toKey, sizeKey, size } + ) : void 0; + node.label = toPlainText8(labelText); + column.nodes.push(graphNode); + column.size += size; + graphNode.columnIndex = column.index; + } + const measurer = cachedTextMeasurer10(this.properties.label); + let columnLabelInsetBefore = 0; + let columnLabelInsetAfter = 0; + if (this.isLabelEnabled()) { + if (labelPlacement == null && edgeLabelPlacement == null) { + columnLabelInsetBefore = (seriesRectWidth - nodeWidth) * (1 - maxPathLength / (maxPathLength + 1)); + columnLabelInsetAfter = columnLabelInsetBefore; + } else if (edgeLabelPlacement === "outside" || edgeLabelPlacement == null) { + const reduceLabelWidthFn = (acc, n) => { + const node = n; + if (node.datum.label == null || node.datum.label === "") + return acc; + let maxWidth = (seriesRectWidth - nodeWidth) / (maxPathLength - 1) - labelSpacing; + if (labelPlacement === "center" && edgeLabelPlacement == null) + maxWidth /= 2; + const text = wrapText2(node.datum.label, { + maxWidth, + maxHeight: node.datum.height, + font: this.properties.label, + textWrap: "never" + }); + let { width } = measurer.measureLines(text); + if (labelPlacement === "center" && edgeLabelPlacement == null) + width /= 2; + return Math.max(acc, width); + }; + if (labelPlacement !== "right" || edgeLabelPlacement === "outside") { + columnLabelInsetBefore = nodeWidth + columns[0].nodes.reduce(reduceLabelWidthFn, 0); + } + if (labelPlacement !== "left" || edgeLabelPlacement === "outside") { + columnLabelInsetAfter = nodeWidth + columns.at(-1).nodes.reduce(reduceLabelWidthFn, 0); + } + } + } + const columnWidth = (seriesRectWidth - nodeWidth - columnLabelInsetBefore - columnLabelInsetAfter) / (maxPathLength - 1); + for (let index = 0; index < columns.length; index++) { + const column = columns[index]; + column.x = columnLabelInsetBefore + index * columnWidth; + for (const graphNode of column.nodes) { + graphNode.datum.x = column.x; + } + } + for (const graphNode of nodeGraph.values()) { + graphNode.weight = 0; + let closestColumnDiff = Infinity; + for (const link of graphNode.linksAfter) { + const node = link.node; + closestColumnDiff = Math.min(closestColumnDiff, node.columnIndex - graphNode.columnIndex); + } + if (closestColumnDiff === Infinity) { + for (const link of graphNode.linksBefore) { + const node = link.node; + closestColumnDiff = Math.min(closestColumnDiff, graphNode.columnIndex - node.columnIndex); + } + } + graphNode.closestColumnDiff = closestColumnDiff; + for (const link of graphNode.linksAfter) { + const node = link.node; + if (node.columnIndex <= graphNode.columnIndex) + continue; + for (let i = node.columnIndex - 1; i > graphNode.columnIndex; i--) { + const size = link.link.size; + const ghostNode = { + ghost: true, + datum: { ...graphNode.datum, size, y: 0, height: 0 }, + weight: 0, + linksBefore: [{ node: { columnIndex: i - 1, datum: { size } } }], + linksAfter: [{ node: { columnIndex: i + 1, datum: { size } } }], + link: link.link, + columnIndex: graphNode.columnIndex, + size: graphNode.datum.size, + closestColumnDiff, + fromNode: { y: node.datum.y }, + toNode: { y: 0 } + }; + columns[i].size += size; + columns[i].nodes.push(ghostNode); + } + } + } + const sortedColumns = columns.toSorted((a, b) => { + const aMax = a.nodes.reduce((acc, n) => Math.max(acc, n.datum.size), 0); + const bMax = b.nodes.reduce((acc, n) => Math.max(acc, n.datum.size), 0); + return bMax - aMax; + }); + const columnWeights = {}; + for (let i = 0; i < sortedColumns.length; i++) { + columnWeights[sortedColumns[i].index] = Math.pow(10, sortedColumns.length - i - 1); + } + for (const column of columns) { + for (const node of column.nodes) { + node.weight = node.datum.size / column.size * columnWeights[column.index]; + if ("ghost" in node && node.ghost) { + node.weight = node.size / column.size * columnWeights[column.index]; + continue; + } + node.weight += node.linksBefore.reduce((acc, before) => { + if (before.node.columnIndex !== column.index - 1) + return acc; + const weight = before.node.datum.size / columns[before.node.columnIndex].size * columnWeights[before.node.columnIndex]; + return Math.max(acc, weight); + }, 0); + node.weight += node.linksAfter.reduce((acc, after) => { + if (after.node.columnIndex !== column.index + 1) + return acc; + const weight = after.node.datum.size / columns[after.node.columnIndex].size * columnWeights[after.node.columnIndex]; + return Math.max(acc, weight); + }, 0); + } + column.nodes.sort((a, b) => this.sortNodes(a, b)); + } + const minSize = 1; + const getSizeScale = (spacing) => { + return columns.reduce((acc, { size, nodes }) => { + const spacingAccomodation = seriesRectHeight - nodes.length * minSize; + const spacingOccupation = (nodes.length - 1) * spacing / spacingAccomodation; + const columnSizeScale = (1 - spacingOccupation) / size; + return Math.min(acc, columnSizeScale); + }, Infinity); + }; + let nodeSpacing = this.properties.node.spacing; + let sizeScale = getSizeScale(nodeSpacing); + while (sizeScale < 0 && nodeSpacing > this.properties.node.minSpacing) { + nodeSpacing -= 1; + sizeScale = getSizeScale(nodeSpacing); + } + if (sizeScale < 0) { + Logger12.warnOnce( + "There was insufficient space to display the Sankey Series. Reduce [node.spacing], [node.minSpacing], or provide a larger container." + ); + return; + } + for (const column of columns) { + let columnNodesHeight = 0; + for (const node of column.nodes) { + const height = seriesRectHeight * node.datum.size * sizeScale; + node.datum.height = Math.max(minSize, height); + columnNodesHeight += height; + } + const spacingOccupation = nodeSpacing * (column.nodes.length - 1); + let y = 0; + if (this.properties.node.verticalAlignment === "bottom") { + y = seriesRectHeight - columnNodesHeight - spacingOccupation; + } else if (this.properties.node.verticalAlignment === "center") { + y = (seriesRectHeight - columnNodesHeight - spacingOccupation) / 2; + } + for (const node of column.nodes) { + node.datum.y = y; + y += seriesRectHeight * node.datum.size * sizeScale + nodeSpacing; + if ("ghost" in node && node.ghost) { + node.link.elbows.push({ x: column.x, y: node.datum.y }); + } + } + } + for (const { datum, linksBefore, linksAfter } of nodeGraph.values()) { + let y2 = datum.y; + linksBefore.sort( + (a, b) => this.sortNodes(a.node, b.node) + ); + for (const { link } of linksBefore) { + link.y2 = y2; + y2 += link.size * seriesRectHeight * sizeScale; + } + let y1 = datum.y; + linksAfter.sort( + (a, b) => this.sortNodes(a.node, b.node, { + invertColumnSort: true + }) + ); + for (const { link } of linksAfter) { + link.y1 = y1; + y1 += link.size * seriesRectHeight * sizeScale; + } + } + const nodeData = []; + const labelData = []; + const { fontSize } = this.properties.label; + for (const [index, column] of columns.entries()) { + const leading = index === 0; + const trailing = index === columns.length - 1; + let bottom = -Infinity; + column.nodes.sort((a, b) => a.datum.y - b.datum.y); + for (const n of column.nodes) { + if ("ghost" in n && n.ghost) + continue; + const { datum: node } = n; + node.midPoint = { + x: node.x + node.width / 2, + y: node.y + node.height / 2 + }; + nodeData.push(node); + if (node.label == null) + continue; + const y = node.y + node.height / 2; + let text; + if (!leading && !trailing) { + const lineHeight = calcLineHeight2(fontSize); + const y12 = y - lineHeight; + const y2 = y + lineHeight; + let maxX = seriesRectWidth; + for (const { datum } of nodeGraph.values()) { + const intersectsLabel = datum.x > node.x && Math.max(datum.y, y12) <= Math.min(datum.y + datum.height, y2); + if (intersectsLabel) { + maxX = Math.min(maxX, datum.x - labelSpacing); + } + } + const maxWidth = maxX - node.x - 2 * labelSpacing; + text = wrapText2(node.label, { + maxWidth, + maxHeight: node.height, + font: this.properties.label, + textWrap: "never", + overflow: "hide" + }); + } + if (text == null || text === "") { + const labelInset = edgeLabelPlacement == null && (leading || trailing) ? labelSpacing : labelSpacing * 2; + text = wrapText2(node.label, { + maxWidth: columnWidth - labelInset, + maxHeight: node.height, + font: this.properties.label, + textWrap: "never" + }); + } + if (text === "") + continue; + const { height } = measurer.measureLines(text); + const y0 = y - height / 2; + const y1 = y + height / 2; + let x = node.x + node.width + labelSpacing; + let textAlign = "left"; + let placement = labelPlacement; + if (leading && edgeLabelPlacement == null && labelPlacement == null) { + placement = "left"; + } + if (edgeLabelPlacement === "outside") { + if (leading) + placement = "left"; + if (trailing) + placement = "right"; + } else if (edgeLabelPlacement === "inside") { + if (leading) + placement = "right"; + if (trailing) + placement = "left"; + } + if (placement === "left") { + x = node.x - labelSpacing; + textAlign = "right"; + } else if (placement === "center") { + x = node.x + node.width / 2; + textAlign = "center"; + } + if (y0 >= bottom) { + labelData.push({ x, y, textAlign, text, size: node.size }); + bottom = y1; + } + } + } + for (const link of links) { + const { fromNode, toNode, size } = link; + link.height = Math.max(minSize, seriesRectHeight * size * sizeScale); + link.x1 = fromNode.x + nodeWidth; + link.x2 = toNode.x; + link.midPoint = { + x: (link.x1 + link.x2) / 2, + y: (link.y1 + link.y2) / 2 + link.height / 2 + }; + nodeData.push(link); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + sortNodes(a, b, opts) { + const { properties } = this; + if (properties.node.sort === "ascending") { + return (a.datum.label ?? "").localeCompare(b.datum.label ?? ""); + } else if (properties.node.sort === "descending") { + return (b.datum.label ?? "").localeCompare(a.datum.label ?? ""); + } else if (properties.node.sort === "data") { + return 0; + } + if (a.columnIndex < b.columnIndex) + return opts?.invertColumnSort ? 1 : -1; + if (a.columnIndex > b.columnIndex) + return opts?.invertColumnSort ? -1 : 1; + if (a.weight === b.weight) { + return a.datum.size - b.datum.size; + } + if (a.closestColumnDiff < b.closestColumnDiff) + return 1; + if (a.closestColumnDiff > b.closestColumnDiff) + return -1; + return a.weight - b.weight; + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, datum) => { + const { x, y, textAlign, text } = datum; + const params = datum; + const style = getLabelStyles6(this, void 0, params, this.properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x; + label.y = y; + label.text = text; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = "middle"; + label.setBoxing(style); + }); + } + updateNodeSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId20(datum.type, datum.id)); + } + getNodeStyle(nodeDatum, fromNodeDatumIndex, isHighlight) { + const { properties } = this; + const { + fills, + strokes, + defaultColorRange, + defaultPatternFills, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3 + } = properties; + const { itemStyler } = properties.node; + const defaultColorStops = defaultColorRange[fromNodeDatumIndex % defaultColorRange.length].map((color6) => ({ + color: color6 + })); + const defaultPatternFill = defaultPatternFills[fromNodeDatumIndex % defaultPatternFills.length]; + const highlightStyle = this.getHighlightStyle(isHighlight, nodeDatum.datumIndex); + const baseStyle = mergeDefaults18(highlightStyle, properties.getStyle(false, fills, strokes, fromNodeDatumIndex)); + const hasNodeFill = properties.node.fill != null; + let style = getShapeStyle2( + baseStyle, + hasNodeFill ? fillGradientDefaults3 : { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + hasNodeFill ? fillPatternDefaults3 : { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + if (itemStyler != null && nodeDatum.datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId20(nodeDatum.datumIndex.index, "node", isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults18( + overrides, + style, + { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + makeItemStylerParams({ datum, datumIndex, size = 0, label }, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + size, + label, + fill + }; + } + updateNodeNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const { datumIndex } = datum; + const style = this.getNodeStyle(datum, datumIndex.index, isHighlight); + rect.x = datum.x; + rect.y = datum.y; + rect.width = Math.max(datum.width, 0); + rect.height = Math.max(datum.height, 0); + applyShapeStyle18(rect, style, fillBBox); + }); + } + getShapeFillBBox() { + const width = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const height = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const bbox = new BBox16(0, 0, width, height); + return { series: bbox, axis: bbox }; + } + updateLinkSelection(opts) { + return opts.datumSelection.update( + opts.nodeData, + void 0, + (datum) => createDatumId20(datum.type, datum.index, datum.fromNode.id, datum.toNode.id) + ); + } + getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, isHighlight) { + const { id: seriesId, properties } = this; + const { + fills, + strokes, + defaultColorRange, + defaultPatternFills, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3 + } = properties; + const { itemStyler } = properties.link; + const defaultColorStops = defaultColorRange[fromNodeDatumIndex.index % defaultColorRange.length].map( + (color6) => ({ + color: color6 + }) + ); + const defaultPatternFill = defaultPatternFills[fromNodeDatumIndex.index % defaultPatternFills.length]; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults18( + highlightStyle, + properties.getStyle(true, fills, strokes, fromNodeDatumIndex.index) + ); + const hasLinkFill = properties.link.fill != null; + let style = getShapeStyle2( + baseStyle, + hasLinkFill ? fillGradientDefaults3 : { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + hasLinkFill ? fillPatternDefaults3 : { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId20(datumIndex.index, "link", isHighlight ? "highlight" : "node"), + () => { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }); + } + ); + if (overrides) { + style = mergeDefaults18( + overrides, + style, + { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + updateLinkNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((link, datum) => { + const fromNodeDatumIndex = datum.fromNode.datumIndex; + const style = this.getLinkStyle(datum, fromNodeDatumIndex, isHighlight); + link.x1 = datum.x1; + link.y1 = datum.y1; + link.x2 = datum.x2; + link.y2 = datum.y2; + link.height = datum.height; + link.elbows = datum.elbows; + applyShapeStyle18(link, style, fillBBox); + link.inset = link.strokeWidth / 2; + }); + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + linksProcessedData, + nodesProcessedData, + properties, + ctx: { formatManager } + } = this; + const { fromKey, toKey, sizeKey, sizeName, tooltip } = properties; + const seriesDatum = this.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + if (seriesDatum == null) + return; + const nodeIndex = seriesDatum.type === 0 /* Link */ ? seriesDatum.fromNode.index : seriesDatum.index; + const title = seriesDatum.type === 0 /* Link */ ? `${seriesDatum.fromNode.label} - ${seriesDatum.toNode.label}` : seriesDatum.label; + const datum = datumIndex.type === 0 /* Link */ ? linksProcessedData?.dataSources.get(this.id)?.data[datumIndex.index] : nodesProcessedData?.dataSources.get(this.id)?.data[datumIndex.index]; + const size = seriesDatum.size; + let format; + if (seriesDatum.type === 0 /* Link */) { + const fromNodeDatumIndex = seriesDatum.fromNode.datumIndex; + format = this.getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, false); + } else { + format = this.getNodeStyle({ datumIndex, datum }, datumIndex.index, false); + } + const data = []; + if (sizeKey != null) { + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: size, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + domain: [], + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(size) }); + } + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(seriesDatum.type, nodeIndex, format), + data + }, + { + seriesId, + datum, + title, + fromKey, + toKey, + sizeKey, + sizeName, + size, + ...format + } + ); + } + computeFocusBounds(node) { + if (node instanceof Rect6) { + const { x, y, width, height } = node; + const bbox = new BBox16(x, y, width, height); + return Transformable3.toCanvas(this.contentGroup, bbox); + } + return node; + } + hasItemStylers() { + return this.properties.node.itemStyler != null || this.properties.link.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +SankeySeries.className = "SankeySeries"; +SankeySeries.type = "sankey"; + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport155 } from "ag-charts-community"; +import { + arrayOf as arrayOf4, + color as color4, + constant as constant23, + fillGradientDefaults as fillGradientDefaults2, + fillImageDefaults as fillImageDefaults2, + fillPatternDefaults as fillPatternDefaults2, + required as required23, + string as string21, + undocumented as undocumented7 +} from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs21, sankeySeriesThemeableOptionsDef } = _ModuleSupport155; +var sankeySeriesOptionsDef = { + ...sankeySeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs21, + type: required23(constant23("sankey")), + fromKey: required23(string21), + toKey: required23(string21), + sizeKey: string21, + sizeName: string21 +}; +sankeySeriesOptionsDef.fillGradientDefaults = undocumented7(fillGradientDefaults2); +sankeySeriesOptionsDef.fillPatternDefaults = undocumented7(fillPatternDefaults2); +sankeySeriesOptionsDef.fillImageDefaults = undocumented7(fillImageDefaults2); +sankeySeriesOptionsDef.defaultColorRange = undocumented7(arrayOf4(arrayOf4(color4))); +sankeySeriesOptionsDef.defaultPatternFills = undocumented7(arrayOf4(color4)); + +// packages/ag-charts-enterprise/src/series/sankey/sankeyModule.ts +var SankeyModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + solo: true, + identifier: "sankey", + moduleFactory: (ctx) => new SankeySeries(ctx), + themeTemplate: { + seriesArea: { + padding: { + top: 10, + bottom: 10 + } + }, + series: { + fills: { $palette: "fills" }, + strokes: { $palette: "strokes" }, + // @ts-expect-error undocumented option + fillGradientDefaults: _ModuleSupport156.FILL_GRADIENT_LINEAR_DEFAULTS, + fillPatternDefaults: _ModuleSupport156.FILL_PATTERN_DEFAULTS, + fillImageDefaults: _ModuleSupport156.FILL_IMAGE_DEFAULTS, + defaultColorRange: { $palette: "gradients" }, + defaultPatternFills: _ModuleSupport156.SAFE_FILLS_OPERATION, + highlightStyle: { + series: { + dimOpacity: 0.2 + } + }, + highlight: { + ..._ModuleSupport156.singleSeriesHighlightStyle() + }, + label: { + ..._ModuleSupport156.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 10 + }, + node: { + spacing: { $if: [{ $greaterThan: [{ $path: "./minSpacing" }, 20] }, { $path: "./minSpacing" }, 20] }, + minSpacing: 0, + width: 10, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + link: { + fillOpacity: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + } + }, + legend: { + enabled: false, + toggleSeries: false + } + } +}; +var SankeySeriesModule = { + type: "series", + name: "sankey", + chartType: "standalone", + enterprise: true, + options: sankeySeriesOptionsDef, + create: (ctx) => new SankeySeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstModule.ts +import { _ModuleSupport as _ModuleSupport160 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeries.ts +import { _ModuleSupport as _ModuleSupport158 } from "ag-charts-community"; +import { toPlainText as toPlainText9 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport157 } from "ag-charts-community"; +var { HierarchySeriesProperties, HighlightStyle, makeSeriesTooltip: makeSeriesTooltip23, Property: Property38 } = _ModuleSupport157; +var SunburstSeriesTileHighlightStyle = class extends HighlightStyle { + constructor() { + super(false); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedLabel(); + } +}; +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "label", 2); +__decorateClass([ + Property38 +], SunburstSeriesTileHighlightStyle.prototype, "secondaryLabel", 2); +var SunburstSeriesProperties = class extends HierarchySeriesProperties { + constructor() { + super(...arguments); + this.fillOpacity = 1; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.highlightStyle = new SunburstSeriesTileHighlightStyle(); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + this.tooltip = makeSeriesTooltip23(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity } = this; + return { + fill: fills[index % fills.length], + fillOpacity, + stroke: strokes[index % strokes.length], + strokeWidth, + strokeOpacity, + opacity: 1 + }; + } +}; +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "secondaryLabelKey", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "sectorSpacing", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "padding", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "highlightStyle", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "secondaryLabel", 2); +__decorateClass([ + Property38 +], SunburstSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeries.ts +var { + fromToMotion: fromToMotion6, + normalizeAngle360: normalizeAngle3608, + createDatumId: createDatumId21, + PointerEvents: PointerEvents13, + Sector: Sector7, + Group: Group16, + ScalableGroup, + Selection: Selection15, + TransformableText: TransformableText3, + BBox: BBox17, + applyShapeStyle: applyShapeStyle19, + mergeDefaults: mergeDefaults19, + formatValue: formatValue2, + getLabelStyles: getLabelStyles7 +} = _ModuleSupport158; +var SunburstNode = class extends _ModuleSupport158.HierarchyNode { + constructor() { + super(...arguments); + this.label = void 0; + this.secondaryLabel = void 0; + this.contentHeight = 0; + this.bbox = void 0; + // cspell:ignore bbox + this.startAngle = 0; + this.endAngle = 0; + } +}; +function setAngleData(node, startAngle = 0, angleScale = 2 * Math.PI / node.sumSize) { + for (const child of node.children) { + const endAngle = startAngle + child.sumSize * angleScale; + child.startAngle = startAngle; + child.endAngle = endAngle; + setAngleData(child, startAngle, angleScale); + startAngle = endAngle; + } +} +var SunburstSeries = class extends _ModuleSupport158.HierarchySeries { + constructor(moduleCtx) { + super(moduleCtx); + this.NodeClass = SunburstNode; + this.properties = new SunburstSeriesProperties(); + this.scalingGroup = this.contentGroup.appendChild(new ScalableGroup()); + this.sectorGroup = this.scalingGroup.appendChild(new Group16()); + this.sectorLabelGroup = this.scalingGroup.appendChild(new Group16()); + this.highlightSectorGroup = this.scalingGroup.appendChild(new Group16()); + this.datumSelection = Selection15.select(this.sectorGroup, Sector7); + this.labelSelection = Selection15.select( + this.sectorLabelGroup, + Group16 + ); + this.highlightSelection = Selection15.select( + this.highlightSectorGroup, + Sector7 + ); + this.sectorLabelGroup.pointerEvents = PointerEvents13.None; + } + processData() { + super.processData(); + setAngleData(this.rootNode); + } + updateSelections() { + const highlightedNode = this.ctx.highlightManager?.getActiveHighlight(); + this.highlightSelection.update( + highlightedNode == null ? [] : [highlightedNode], + void 0, + (node) => this.getDatumId(node) + ); + if (!this.nodeDataRefresh) + return; + this.nodeDataRefresh = false; + const { chart } = this; + if (chart == null) + return; + const seriesRect = chart.seriesRect; + if (seriesRect == null) + return; + const descendants = Array.from(this.rootNode); + const updateLabelGroup = (group) => { + group.append([ + new TransformableText3({ tag: 0 /* Primary */ }), + new TransformableText3({ tag: 1 /* Secondary */ }) + ]); + }; + this.datumSelection.update(descendants, void 0, (node) => this.getDatumId(node)); + this.labelSelection.update(descendants, updateLabelGroup, (node) => this.getDatumId(node)); + } + getItemStyle(nodeDatum, isHighlight) { + const { properties, colorScale } = this; + const { itemStyler } = properties; + const rootIndex = nodeDatum.datumIndex?.[0] ?? 0; + const highlightStyle = isHighlight ? properties.highlightStyle : void 0; + const baseStyle = mergeDefaults19(highlightStyle, properties.getStyle(rootIndex)); + if (!isHighlight && nodeDatum.colorValue != null) { + baseStyle.fill = colorScale.convert(nodeDatum.colorValue); + } + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId21(this.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults19(overrides, style); + } + } + return style; + } + makeItemStylerParams(nodeDatum, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + depth: nodeDatum.depth ?? 0, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateNodes() { + const { chart, data, maxDepth } = this; + if (chart == null || data == null) { + return; + } + const { width, height } = chart.seriesRect; + const { + sectorSpacing = 0, + padding = 0, + cornerRadius, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName + } = this.properties; + this.contentGroup.translationX = width / 2; + this.contentGroup.translationY = height / 2; + const baseInset = sectorSpacing * 0.5; + const radius = Math.min(width, height) / 2; + const radiusScale = radius / (maxDepth + 1); + const angleOffset = -Math.PI / 2; + const seriesFillBBox = { + series: new BBox17(-radius, -radius, 2 * radius, 2 * radius), + axis: new BBox17(-radius, -radius, 2 * radius, 2 * radius) + }; + this.rootNode?.walk((node) => { + const { startAngle, endAngle } = node; + if (node.depth != null) { + const midAngle = (startAngle + endAngle) / 2 + angleOffset; + const midRadius = (node.depth + 0.5) * radiusScale; + node.midPoint.x = Math.cos(midAngle) * midRadius; + node.midPoint.y = Math.sin(midAngle) * midRadius; + } + }); + this.rootNode?.walk((node) => { + const { datum, depth, startAngle, endAngle, parent, sumSize } = node; + node.label = void 0; + node.secondaryLabel = void 0; + node.contentHeight = 0; + let labelValue; + if (datum != null && depth != null && labelKey != null) { + const value = datum[labelKey]; + labelValue = this.getLabelText( + value, + datum, + labelKey, + "label", + [], + this.properties.label, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (labelValue === "") { + labelValue = void 0; + } + let secondaryLabelValue; + if (datum != null && depth != null && secondaryLabelKey != null) { + const value = datum[secondaryLabelKey]; + secondaryLabelValue = this.getLabelText( + value, + datum, + secondaryLabelKey, + "secondaryLabel", + [], + this.properties.secondaryLabel, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (secondaryLabelValue === "") { + secondaryLabelValue = void 0; + } + if (depth == null) + return; + const innerRadius = depth * radiusScale + baseInset; + const outerRadius = (depth + 1) * radiusScale - baseInset; + const innerAngleOffset = innerRadius > baseInset ? baseInset / innerRadius : baseInset; + const outerAngleOffset = outerRadius > baseInset ? baseInset / outerRadius : baseInset; + const innerStartAngle = startAngle + innerAngleOffset; + const innerEndAngle = endAngle + innerAngleOffset; + const deltaInnerAngle = innerEndAngle - innerStartAngle; + const outerStartAngle = startAngle + outerAngleOffset; + const outerEndAngle = endAngle + outerAngleOffset; + const deltaOuterAngle = outerEndAngle - outerStartAngle; + const sizeFittingHeight = (labelHeight2) => { + const isCenterCircle = depth === 0 && parent?.sumSize === sumSize; + if (isCenterCircle) { + const labelWidth2 = 2 * Math.sqrt(outerRadius ** 2 - (labelHeight2 * 0.5) ** 2); + return { width: labelWidth2, height: labelHeight2, meta: 0 /* CenterCircle */ }; + } + const parallelHeight = labelHeight2; + const availableWidthUntilItHitsTheOuterRadius = 2 * Math.sqrt(outerRadius ** 2 - (innerRadius + parallelHeight) ** 2); + const availableWidthUntilItHitsTheStraightEdges = deltaInnerAngle < Math.PI ? 2 * innerRadius * Math.tan(deltaInnerAngle * 0.5) : Infinity; + const parallelWidth = Math.min( + availableWidthUntilItHitsTheOuterRadius, + availableWidthUntilItHitsTheStraightEdges + ); + const maxPerpendicularAngle = Math.PI / 4; + let perpendicularHeight; + let perpendicularWidth; + if (depth === 0) { + perpendicularHeight = labelHeight2; + perpendicularWidth = Math.sqrt(outerRadius ** 2 - (perpendicularHeight / 2) ** 2) - labelHeight2 / (2 * Math.tan(deltaOuterAngle * 0.5)); + } else if (normalizeAngle3608(deltaInnerAngle) < maxPerpendicularAngle) { + perpendicularHeight = 2 * innerRadius * Math.tan(deltaInnerAngle * 0.5); + perpendicularWidth = Math.sqrt(outerRadius ** 2 - (perpendicularHeight / 2) ** 2) - innerRadius; + } else { + perpendicularWidth = 0; + perpendicularHeight = 0; + } + return parallelWidth >= perpendicularWidth ? { width: parallelWidth, height: parallelHeight, meta: 1 /* Parallel */ } : { width: perpendicularWidth, height: perpendicularHeight, meta: 2 /* Perpendicular */ }; + }; + const formatting = formatLabels( + toPlainText9(labelValue), + this.properties.label, + toPlainText9(secondaryLabelValue), + this.properties.secondaryLabel, + { padding }, + sizeFittingHeight + ); + if (formatting == null) + return; + const { width: labelWidth, height: labelHeight, meta: labelPlacement, label, secondaryLabel } = formatting; + const theta = angleOffset + (startAngle + endAngle) / 2; + const top = Math.sin(theta) >= 0; + const right = Math.cos(theta) >= 0; + const circleQuarter = (top ? 3 /* Top */ : 12 /* Bottom */) & (right ? 6 /* Right */ : 9 /* Left */); + let labelRadius; + switch (labelPlacement) { + case 0 /* CenterCircle */: + labelRadius = 0; + break; + case 1 /* Parallel */: { + const opticalCentering = 0.58; + const idealRadius = outerRadius - (radiusScale - labelHeight) * opticalCentering; + const maximumRadius = Math.sqrt((outerRadius - padding) ** 2 - (labelWidth / 2) ** 2); + labelRadius = Math.min(idealRadius, maximumRadius); + break; + } + case 2 /* Perpendicular */: + if (depth === 0) { + const minimumRadius = labelHeight / (2 * Math.tan(deltaInnerAngle * 0.5)) + labelWidth * 0.5; + const maximumRadius = Math.sqrt(outerRadius ** 2 - (labelHeight * 0.5) ** 2) - labelWidth * 0.5; + labelRadius = (minimumRadius + maximumRadius) * 0.5; + } else { + labelRadius = (innerRadius + outerRadius) * 0.5; + } + break; + } + if (label != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.label; + node.label = { + ...label, + fontStyle, + fontFamily, + fontWeight, + color: color6, + labelPlacement, + circleQuarter, + radius: labelRadius, + theta + }; + } + if (secondaryLabel != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.secondaryLabel; + node.secondaryLabel = { + ...secondaryLabel, + fontStyle, + fontFamily, + fontWeight, + color: color6, + labelPlacement, + circleQuarter, + radius: labelRadius, + theta + }; + } + node.contentHeight = formatting.height; + }); + const updateSector = (nodeDatum, sector, highlighted) => { + const { depth, startAngle, endAngle } = nodeDatum; + if (depth == null) { + sector.visible = false; + return; + } + sector.visible = true; + const style = this.getItemStyle(nodeDatum, highlighted); + const fill = style.fill; + const strokeWidth = style.strokeWidth; + const fillBBox = _ModuleSupport158.isGradientFill(fill) && fill.bounds !== "item" ? seriesFillBBox : void 0; + applyShapeStyle19(sector, style, fillBBox); + sector.centerX = 0; + sector.centerY = 0; + sector.innerRadius = depth * radiusScale; + sector.outerRadius = (depth + 1) * radiusScale; + sector.startAngle = startAngle + angleOffset; + sector.endAngle = endAngle + angleOffset; + sector.inset = baseInset + strokeWidth * 0.5; + sector.cornerRadius = cornerRadius; + }; + this.datumSelection.each((sector, datum) => { + updateSector(datum, sector, false); + }); + this.highlightSelection.each((rect, datum) => { + updateSector(datum, rect, true); + }); + const updateText = (node, text, tag, highlighted) => { + const { depth, contentHeight } = node; + const primary = tag === 0 /* Primary */; + const label = primary ? node.label : node.secondaryLabel; + if (depth == null || label == null) { + text.visible = false; + return; + } + const { labelPlacement, circleQuarter, radius: textRadius, theta } = label; + let highlightedColor; + if (highlighted) { + const highlightedLabelStyle = primary ? this.properties.highlightStyle.label : this.properties.highlightStyle.secondaryLabel; + highlightedColor = highlightedLabelStyle.color; + } + const params = { + childrenKey: this.properties.childrenKey, + colorKey: this.properties.colorKey, + colorName: this.properties.colorName ?? this.properties.colorKey, + depth: node.depth ?? Number.NaN, + labelKey: this.properties.labelKey, + secondaryLabelKey: this.properties.secondaryLabelKey, + sizeKey: this.properties.sizeKey, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }; + const baseLabelStyle = primary ? this.properties.label : this.properties.secondaryLabel; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const style = getLabelStyles7(this, node, params, baseLabelStyle, highlighted, activeHighlight); + text.text = label.text; + text.fontSize = label.fontSize; + text.lineHeight = label.lineHeight; + text.fontStyle = label.fontStyle; + text.fontFamily = label.fontFamily; + text.fontWeight = label.fontWeight; + text.fill = highlightedColor ?? label.color; + text.fillOpacity = this.getHighlightStyle(highlighted, node.datumIndex)?.opacity ?? 1; + text.setBoxing(style); + switch (labelPlacement) { + case 0 /* CenterCircle */: + text.textAlign = "center"; + text.textBaseline = "top"; + text.translationX = 0; + text.translationY = (primary ? 0 : contentHeight - label.height) - contentHeight * 0.5; + text.rotation = 0; + break; + case 1 /* Parallel */: { + const topHalf = (circleQuarter & 3 /* Top */) !== 0; + const translationRadius = primary === !topHalf ? textRadius : textRadius - (contentHeight - label.height); + text.textAlign = "center"; + text.textBaseline = topHalf ? "bottom" : "top"; + text.translationX = Math.cos(theta) * translationRadius; + text.translationY = Math.sin(theta) * translationRadius; + text.rotation = topHalf ? theta - Math.PI * 0.5 : theta + Math.PI * 0.5; + break; + } + case 2 /* Perpendicular */: { + const rightHalf = (circleQuarter & 6 /* Right */) !== 0; + const translation = primary === !rightHalf ? (contentHeight - label.height) * 0.5 : (label.height - contentHeight) * 0.5; + text.textAlign = "center"; + text.textBaseline = "middle"; + text.translationX = Math.cos(theta) * textRadius + Math.cos(theta + Math.PI / 2) * translation; + text.translationY = Math.sin(theta) * textRadius + Math.sin(theta + Math.PI / 2) * translation; + text.rotation = rightHalf ? theta : theta + Math.PI; + break; + } + } + text.visible = true; + }; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + for (const text of this.labelSelection.selectByClass(TransformableText3)) { + const datum = text.closestDatum(); + updateText(datum, text, text.tag, datum === highlightedDatum); + } + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties, ctx } = this; + const { labelKey, secondaryLabelKey, childrenKey, sizeKey, sizeName, colorKey, colorName, tooltip } = properties; + const { formatManager } = ctx; + const nodeDatum = datumIndex.reduce((n, i) => n?.children[i], this.rootNode); + if (nodeDatum == null) + return; + const { datum, depth } = nodeDatum; + if (datum == null || depth == null) + return; + const data = []; + const datumSize = sizeKey == null ? void 0 : datum[sizeKey]; + if (datumSize != null) { + const sizeDomain = [0, this.rootNode?.sumSize ?? 0]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumSize, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain: sizeDomain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue2(datumSize) }); + } + const datumColor = colorKey == null ? void 0 : datum[colorKey]; + if (datumColor != null) { + const { colorDomain } = this; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumColor, + datum, + seriesId, + legendItemName: void 0, + key: colorKey, + source: "tooltip", + property: "color", + boundSeries: this.getFormatterContext("color"), + domain: colorDomain, + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue2(datumColor) }); + } + const format = this.getItemStyle( + { ...nodeDatum, colorValue: datumColor ?? nodeDatum.colorValue }, + false + ); + const color6 = format.fill; + const markerStyle = { + shape: "square", + fill: color6, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + }; + if (_ModuleSupport158.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return this.formatTooltipWithContext( + tooltip, + { + title: labelKey == null ? void 0 : datum[labelKey], + symbol: { + marker: markerStyle + }, + data + }, + { + seriesId, + datum, + title: void 0, + depth, + labelKey, + secondaryLabelKey, + childrenKey, + sizeKey, + sizeName, + colorKey, + colorName, + ...format + } + ); + } + createNodeData() { + return void 0; + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.datumSelection.nodes()); + } + animateEmptyUpdateReady() { + fromToMotion6(this.id, "nodes", this.ctx.animationManager, [this.scalingGroup], { + toFn() { + return { scalingX: 1, scalingY: 1 }; + }, + fromFn() { + return { scalingX: 0, scalingY: 0 }; + } + }); + } + computeFocusBounds(node) { + return node; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +SunburstSeries.className = "SunburstSeries"; +SunburstSeries.type = "sunburst"; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport159 } from "ag-charts-community"; +import { constant as constant24, required as required24, string as string22 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs22, sunburstSeriesThemeableOptionsDef, without: without8 } = _ModuleSupport159; +var sunburstSeriesOptionsDef = { + ...sunburstSeriesThemeableOptionsDef, + ...without8(commonSeriesOptionsDefs22, ["highlightStyle", "highlight", "showInLegend"]), + type: required24(constant24("sunburst")), + labelKey: string22, + secondaryLabelKey: string22, + childrenKey: string22, + sizeKey: string22, + colorKey: string22, + sizeName: string22, + colorName: string22 +}; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstModule.ts +var { BASE_FONT_SIZE, FONT_SIZE_RATIO: FONT_SIZE_RATIO2 } = _ModuleSupport160; +var SunburstModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "sunburst", + moduleFactory: (ctx) => new SunburstSeries(ctx), + solo: true, + themeTemplate: { + series: { + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", _ModuleSupport160.FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS], + ["pattern", _ModuleSupport160.FILL_PATTERN_DEFAULTS], + ["image", _ModuleSupport160.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + colorRange: { $palette: "divergingColors" }, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + label: { + ..._ModuleSupport160.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $rem: FONT_SIZE_RATIO2.LARGE }, + minimumFontSize: { $rem: 9 / BASE_FONT_SIZE }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + overflowStrategy: "ellipsis", + wrapping: "never", + spacing: 2 + }, + secondaryLabel: { + ..._ModuleSupport160.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $rem: FONT_SIZE_RATIO2.SMALLEST }, + minimumFontSize: { $rem: 7 / BASE_FONT_SIZE }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + overflowStrategy: "ellipsis", + wrapping: "never" + }, + sectorSpacing: 2, + padding: 3, + highlightStyle: { + label: { + color: { $ref: "chartBackgroundColor" } + }, + secondaryLabel: { + color: { $ref: "chartBackgroundColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + } + }, + gradientLegend: { + enabled: true, + ..._ModuleSupport160.LEGEND_CONTAINER_THEME + } + } +}; +var SunburstSeriesModule = { + type: "series", + name: "sunburst", + chartType: "standalone", + enterprise: true, + options: sunburstSeriesOptionsDef, + create: (ctx) => new SunburstSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/treemap/treemapModule.ts +import { _ModuleSupport as _ModuleSupport164 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeries.ts +import { + _ModuleSupport as _ModuleSupport162 +} from "ag-charts-community"; +import { + cachedTextMeasurer as cachedTextMeasurer11, + calcLineHeight as calcLineHeight3, + isNumberEqual as isNumberEqual9, + toPlainText as toPlainText10, + wrapText as wrapText3 +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport161 } from "ag-charts-community"; +var { BaseProperties: BaseProperties13, HierarchySeriesProperties: HierarchySeriesProperties2, HighlightStyle: HighlightStyle2, makeSeriesTooltip: makeSeriesTooltip24, Property: Property39, Label: Label16 } = _ModuleSupport161; +var TreemapGroupLabel = class extends Label16 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property39 +], TreemapGroupLabel.prototype, "spacing", 2); +var TreemapSeriesGroup = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.textAlign = "center"; + this.gap = 0; + this.padding = 0; + this.interactive = true; + this.label = new TreemapGroupLabel(); + } +}; +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "fill", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "fillOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "stroke", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "strokeWidth", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "strokeOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "cornerRadius", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "textAlign", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "gap", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "padding", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "interactive", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroup.prototype, "label", 2); +var TreemapSeriesTile = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.gap = 0; + this.padding = 0; + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + } +}; +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "fill", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "fillOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "stroke", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "strokeWidth", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "strokeOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "cornerRadius", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "textAlign", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "verticalAlign", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "gap", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "padding", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "label", 2); +__decorateClass([ + Property39 +], TreemapSeriesTile.prototype, "secondaryLabel", 2); +var TreemapSeriesGroupHighlightStyle = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.label = new AutoSizedLabel(); + } +}; +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesGroupHighlightStyle.prototype, "label", 2); +var TreemapSeriesTileHighlightStyle = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + } +}; +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "label", 2); +__decorateClass([ + Property39 +], TreemapSeriesTileHighlightStyle.prototype, "secondaryLabel", 2); +var TreemapSeriesHighlightStyle = class extends HighlightStyle2 { + constructor() { + super(false); + this.group = new TreemapSeriesGroupHighlightStyle(); + this.tile = new TreemapSeriesTileHighlightStyle(); + } + getStyle(isLeaf) { + return isLeaf ? this.tile : this.group; + } +}; +__decorateClass([ + Property39 +], TreemapSeriesHighlightStyle.prototype, "group", 2); +__decorateClass([ + Property39 +], TreemapSeriesHighlightStyle.prototype, "tile", 2); +var TreemapSeriesProperties = class extends HierarchySeriesProperties2 { + constructor() { + super(...arguments); + this.highlightStyle = new TreemapSeriesHighlightStyle(); + this.tooltip = makeSeriesTooltip24(); + this.group = new TreemapSeriesGroup(); + this.tile = new TreemapSeriesTile(); + this.undocumentedGroupFills = []; + this.undocumentedGroupStrokes = []; + } + getStyle(isLeaf, fills, strokes, index) { + const { + fillOpacity, + strokeWidth, + strokeOpacity, + fill = isLeaf ? fills[index % fills.length] : fills[Math.min(index, fills.length)], + stroke = isLeaf ? strokes[index % fills.length] : strokes[Math.min(index, strokes.length)] + } = isLeaf ? this.tile : this.group; + return { + fill, + fillOpacity, + stroke, + strokeWidth, + strokeOpacity, + opacity: 1 + }; + } +}; +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "secondaryLabelKey", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "highlightStyle", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "group", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "tile", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "undocumentedGroupFills", 2); +__decorateClass([ + Property39 +], TreemapSeriesProperties.prototype, "undocumentedGroupStrokes", 2); + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeries.ts +var { + createDatumId: createDatumId22, + Rect: Rect7, + Group: Group17, + BBox: BBox18, + Selection: Selection16, + Text: Text8, + Transformable: Transformable4, + applyShapeStyle: applyShapeStyle20, + getLabelStyles: getLabelStyles8, + mergeDefaults: mergeDefaults20, + formatValue: formatValue3 +} = _ModuleSupport162; +var TreemapNode = class extends _ModuleSupport162.HierarchyNode { + constructor() { + super(...arguments); + this.labelValue = void 0; + this.secondaryLabelValue = void 0; + this.label = void 0; + this.secondaryLabel = void 0; + this.bbox = void 0; + this.padding = void 0; + } +}; +function nodeSize(node) { + return node.children.length > 0 ? node.sumSize - node.sizeValue : node.sizeValue; +} +var textAlignFactors2 = { + left: 0, + center: 0.5, + right: 1 +}; +var verticalAlignFactors4 = { + top: 0, + middle: 0.5, + bottom: 1 +}; +var DistantGroup = class extends _ModuleSupport162.Group { + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } +}; +var TreemapSeries = class extends _ModuleSupport162.HierarchySeries { + constructor() { + super(...arguments); + this.NodeClass = TreemapNode; + this.properties = new TreemapSeriesProperties(); + this.rectGroup = this.contentGroup.appendChild(new Group17()); + this.datumSelection = Selection16.select(this.rectGroup, Rect7); + this.labelSelection = Selection16.select(this.labelGroup, Group17); + this.highlightSelection = Selection16.select( + this.rectGroup, + Rect7 + ); + } + groupTitleHeight(node, bbox) { + const { labelValue } = node; + const { label: font } = this.properties.group; + const heightRatioThreshold = 3; + if (labelValue == null) { + return; + } else if (font.fontSize > bbox.width / heightRatioThreshold || font.fontSize > bbox.height / heightRatioThreshold) { + return; + } else { + const { height: fontHeight } = cachedTextMeasurer11(font).measureLines(labelValue); + return Math.max(fontHeight, font.fontSize); + } + } + getNodePadding(node, bbox) { + if (node.parent == null) { + return { + top: 0, + right: 0, + bottom: 0, + left: 0 + }; + } else if (node.children.length === 0) { + const { padding: padding2 } = this.properties.tile; + return { + top: padding2, + right: padding2, + bottom: padding2, + left: padding2 + }; + } + const { + label: { spacing }, + padding + } = this.properties.group; + const fontHeight = this.groupTitleHeight(node, bbox); + const titleHeight = fontHeight == null ? 0 : fontHeight + spacing; + return { + top: padding + titleHeight, + right: padding, + bottom: padding, + left: padding + }; + } + sortChildren({ children }) { + const sortedChildrenIndices = Array.from(children, (_, i) => i).filter((i) => nodeSize(children[i]) > 0).sort((aIndex, bIndex) => nodeSize(children[bIndex]) - nodeSize(children[aIndex])); + const childAt = (i) => { + const sortedIndex = sortedChildrenIndices[i]; + return children[sortedIndex]; + }; + return { sortedChildrenIndices, childAt }; + } + /** + * Squarified Treemap algorithm + * https://www.win.tue.nl/~vanwijk/stm.pdf + */ + squarify(node, bbox) { + const { datum, children } = node; + if (bbox.width <= 0 || bbox.height <= 0) { + node.bbox = void 0; + node.padding = void 0; + node.midPoint.x = Number.NaN; + node.midPoint.y = Number.NaN; + return; + } + const padding = datum == null ? { top: 0, right: 0, bottom: 0, left: 0 } : this.getNodePadding(node, bbox); + if (node.parent == null) { + node.bbox = void 0; + node.padding = void 0; + node.midPoint.x = Number.NaN; + node.midPoint.y = Number.NaN; + } else { + node.bbox = bbox; + node.padding = padding; + node.midPoint.x = bbox.x + bbox.width / 2; + node.midPoint.y = bbox.y; + } + const { sortedChildrenIndices, childAt } = this.sortChildren(node); + const allLeafNodes = sortedChildrenIndices.every((sortedIndex) => children[sortedIndex].children.length === 0); + const targetTileAspectRatio = 1; + const width = bbox.width - padding.left - padding.right; + const height = bbox.height - padding.top - padding.bottom; + if (width <= 0 || height <= 0) + return; + const numChildren = sortedChildrenIndices.length; + let stackSum = 0; + let startIndex = 0; + let minRatioDiff = Infinity; + let partitionSum = sortedChildrenIndices.reduce((sum, sortedIndex) => sum + nodeSize(children[sortedIndex]), 0); + const innerBox = new BBox18(bbox.x + padding.left, bbox.y + padding.top, width, height); + const partition = innerBox.clone(); + let i = 0; + while (i < numChildren) { + const value = nodeSize(childAt(i)); + const firstValue = nodeSize(childAt(startIndex)); + const isVertical2 = partition.width < partition.height; + stackSum += value; + const partThickness = isVertical2 ? partition.height : partition.width; + const partLength = isVertical2 ? partition.width : partition.height; + const firstTileLength = partLength * firstValue / stackSum; + let stackThickness = partThickness * stackSum / partitionSum; + const ratio3 = Math.max(firstTileLength, stackThickness) / Math.min(firstTileLength, stackThickness); + const diff8 = Math.abs(targetTileAspectRatio - ratio3); + if (diff8 < minRatioDiff) { + minRatioDiff = diff8; + i++; + continue; + } + stackSum -= value; + stackThickness = partThickness * stackSum / partitionSum; + let start2 = isVertical2 ? partition.x : partition.y; + for (let j = startIndex; j < i; j++) { + const child = childAt(j); + const childSize = nodeSize(child); + const x = isVertical2 ? start2 : partition.x; + const y = isVertical2 ? partition.y : start2; + const length = partLength * childSize / stackSum; + const stackWidth = isVertical2 ? length : stackThickness; + const stackHeight = isVertical2 ? stackThickness : length; + const childBbox = new BBox18(x, y, stackWidth, stackHeight); + this.applyGap(innerBox, childBbox, allLeafNodes); + this.squarify(child, childBbox); + partitionSum -= childSize; + start2 += length; + } + if (isVertical2) { + partition.y += stackThickness; + partition.height -= stackThickness; + } else { + partition.x += stackThickness; + partition.width -= stackThickness; + } + startIndex = i; + stackSum = 0; + minRatioDiff = Infinity; + } + const isVertical = partition.width < partition.height; + let start = isVertical ? partition.x : partition.y; + for (let childIdx = startIndex; childIdx < numChildren; childIdx++) { + const child = childAt(childIdx); + const x = isVertical ? start : partition.x; + const y = isVertical ? partition.y : start; + const part = nodeSize(child) / partitionSum; + const childWidth = partition.width * (isVertical ? part : 1); + const childHeight = partition.height * (isVertical ? 1 : part); + const childBox = new BBox18(x, y, childWidth, childHeight); + this.applyGap(innerBox, childBox, allLeafNodes); + this.squarify(child, childBox); + start += isVertical ? childWidth : childHeight; + } + } + applyGap(innerBox, childBox, allLeafNodes) { + const gap = allLeafNodes ? this.properties.tile.gap * 0.5 : this.properties.group.gap * 0.5; + const getBounds = (box) => ({ + left: box.x, + top: box.y, + right: box.x + box.width, + bottom: box.y + box.height + }); + const innerBounds = getBounds(innerBox); + const childBounds = getBounds(childBox); + const sides = ["top", "right", "bottom", "left"]; + for (const side of sides) { + if (!isNumberEqual9(innerBounds[side], childBounds[side])) { + childBox.shrink(gap, side); + } + } + } + createNodeData() { + return void 0; + } + getItemStyle(nodeDatum, isLeaf, isHighlight) { + const { properties, colorScale } = this; + const { itemStyler } = properties; + const rootIndex = nodeDatum.datumIndex?.[0] ?? 0; + const fills = isLeaf ? properties.fills : properties.undocumentedGroupFills; + const strokes = isLeaf ? properties.strokes : properties.undocumentedGroupStrokes; + const index = isLeaf ? rootIndex : nodeDatum.depth ?? -1; + const highlightStyle = isHighlight ? properties.highlightStyle.getStyle(isLeaf) : void 0; + const baseStyle = mergeDefaults20(highlightStyle, properties.getStyle(isLeaf, fills, strokes, index)); + if (!isHighlight && isLeaf && nodeDatum.colorValue != null) { + baseStyle.fill = colorScale.convert(nodeDatum.colorValue); + } + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId22(this.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults20(overrides, style); + } + } + return style; + } + makeItemStylerParams(nodeDatum, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + depth: nodeDatum.depth ?? -1, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateSelections() { + let highlightedNode = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedNode != null && !this.properties.group.interactive && highlightedNode.children.length !== 0) { + highlightedNode = void 0; + } + this.highlightSelection.update( + highlightedNode == null ? [] : [highlightedNode], + void 0, + (node) => this.getDatumId(node) + ); + if (!this.nodeDataRefresh) { + return; + } + this.nodeDataRefresh = false; + const { seriesRect } = this.chart ?? {}; + if (!seriesRect) + return; + const descendants = Array.from(this.rootNode); + const updateLabelGroup = (group) => { + group.append([new Text8({ tag: 0 /* Primary */ }), new Text8({ tag: 1 /* Secondary */ })]); + }; + this.datumSelection.update(descendants, void 0, (node) => this.getDatumId(node)); + this.labelSelection.update(descendants, updateLabelGroup, (node) => this.getDatumId(node)); + } + updateNodes() { + const { rootNode, data } = this; + const { + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + highlightStyle, + tile, + group + } = this.properties; + const { seriesRect } = this.chart ?? {}; + if (!seriesRect || !data) + return; + this.rootNode?.walk((node) => { + const { datum, depth, children } = node; + const isLeaf = children.length === 0; + const labelStyle = isLeaf ? tile.label : group.label; + let labelValue; + if (labelStyle.enabled && datum != null && depth != null && labelKey != null) { + const value = datum[labelKey]; + labelValue = this.getLabelText( + value, + datum, + labelKey, + "label", + [], + labelStyle, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (labelValue === "") { + labelValue = void 0; + } + let secondaryLabelValue; + if (tile.secondaryLabel.enabled && isLeaf && datum != null && depth != null && secondaryLabelKey != null) { + const value = datum[secondaryLabelKey]; + secondaryLabelValue = this.getLabelText( + value, + datum, + secondaryLabelKey, + "secondaryLabel", + [], + tile.secondaryLabel, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (secondaryLabelValue === "") { + secondaryLabelValue = void 0; + } + node.labelValue = toPlainText10(labelValue); + node.secondaryLabelValue = toPlainText10(secondaryLabelValue); + }); + const { width, height } = seriesRect; + this.squarify(rootNode, new BBox18(0, 0, width, height)); + this.rootNode?.walk((node) => { + const { bbox, children, labelValue, secondaryLabelValue } = node; + node.label = void 0; + node.secondaryLabel = void 0; + if (bbox == null) + return; + if (children.length === 0) { + const layout = { + width: bbox.width, + height: bbox.height, + meta: null + }; + const formatting = formatLabels( + labelValue, + this.properties.tile.label, + secondaryLabelValue, + this.properties.tile.secondaryLabel, + { padding: tile.padding }, + () => layout + ); + if (formatting == null) { + return; + } + const { height: labelHeight, label, secondaryLabel } = formatting; + const { textAlign, verticalAlign, padding } = tile; + const textAlignFactor = textAlignFactors2[textAlign] ?? 0.5; + const labelX = bbox.x + padding + (bbox.width - 2 * padding) * textAlignFactor; + const verticalAlignFactor = verticalAlignFactors4[verticalAlign] ?? 0.5; + const labelYStart = bbox.y + padding + labelHeight * 0.5 + (bbox.height - 2 * padding - labelHeight) * verticalAlignFactor; + if (label != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.tile.label; + node.label = { + text: label.text, + fontSize: label.fontSize, + lineHeight: label.lineHeight, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: labelX, + y: labelYStart - (labelHeight - label.height) * 0.5 + }; + } + if (secondaryLabel != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.tile.secondaryLabel; + node.secondaryLabel = { + text: secondaryLabel.text, + fontSize: secondaryLabel.fontSize, + lineHeight: secondaryLabel.fontSize, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: labelX, + y: labelYStart + (labelHeight - secondaryLabel.height) * 0.5 + }; + } + } else if (labelValue == null) { + return; + } else { + const { padding, textAlign } = group; + const groupTitleHeight = this.groupTitleHeight(node, bbox); + if (groupTitleHeight == null) + return; + const innerWidth = bbox.width - 2 * padding; + const text = wrapText3(labelValue, { + maxWidth: bbox.width - 2 * padding, + font: group.label, + textWrap: "never" + }); + const textAlignFactor = textAlignFactors2[textAlign] ?? 0.5; + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.group.label; + node.label = { + text, + fontSize: group.label.fontSize, + lineHeight: calcLineHeight3(group.label.fontSize), + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: bbox.x + padding + innerWidth * textAlignFactor, + y: bbox.y + padding + groupTitleHeight * 0.5 + }; + } + }); + const fillBBox = { + series: new BBox18(0, 0, width, height), + axis: new BBox18(0, 0, width, height) + }; + const updateRectFn = (node, rect, isHighlight) => { + const { bbox } = node; + if (bbox == null) { + rect.visible = false; + return; + } + const { depth = -1 } = node; + const isLeaf = node.children.length === 0; + const style = this.getItemStyle(node, isLeaf, isHighlight); + rect.crisp = true; + applyShapeStyle20(rect, style, fillBBox); + rect.cornerRadius = isLeaf ? tile.cornerRadius : group.cornerRadius; + rect.zIndex = [0, depth, isHighlight ? 1 : 0]; + const onlyLeaves = node.parent?.children.every((n) => n.children.length === 0); + const parentBbox = node.parent == null ? void 0 : node.parent.bbox; + const parentPadding = node.parent == null ? void 0 : node.parent.padding; + if (onlyLeaves === true && parentBbox != null && parentPadding != null) { + rect.clipBBox = bbox; + rect.x = parentBbox.x + parentPadding.left; + rect.y = parentBbox.y + parentPadding.top; + rect.width = parentBbox.width - (parentPadding.left + parentPadding.right); + rect.height = parentBbox.height - (parentPadding.top + parentPadding.bottom); + } else { + rect.clipBBox = void 0; + rect.x = bbox.x; + rect.y = bbox.y; + rect.width = bbox.width; + rect.height = bbox.height; + } + rect.visible = true; + }; + this.datumSelection.each((rect, datum) => updateRectFn(datum, rect, false)); + this.highlightSelection.each((rect, datum) => { + updateRectFn(datum, rect, true); + }); + const updateLabelFn = (node, text, tag, highlighted) => { + const isLeaf = node.children.length === 0; + const label = tag === 0 /* Primary */ ? node.label : node.secondaryLabel; + if (label == null) { + text.visible = false; + return; + } + const labelProps = tag === 0 /* Primary */ ? tile.label : tile.secondaryLabel; + let highlightedColor; + if (highlighted) { + const { tile: hTitle, group: hGroup } = highlightStyle; + highlightedColor = hTitle.secondaryLabel.color; + if (!isLeaf) { + highlightedColor = hGroup.label.color; + } else if (tag === 0 /* Primary */) { + highlightedColor = hTitle.label.color; + } + } + const params = { + childrenKey: this.properties.childrenKey, + colorKey: this.properties.colorKey, + colorName: this.properties.colorName ?? this.properties.colorKey, + depth: node.depth ?? Number.NaN, + labelKey: this.properties.labelKey, + secondaryLabelKey: this.properties.secondaryLabelKey, + sizeKey: this.properties.sizeKey, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const style = getLabelStyles8(this, node, params, labelProps, highlighted, activeHighlight); + text.text = label.text; + text.fontSize = label.fontSize; + text.lineHeight = label.lineHeight; + text.fontStyle = label.fontStyle; + text.fontFamily = label.fontFamily; + text.fontWeight = label.fontWeight; + text.fill = highlightedColor ?? label.color; + text.fillOpacity = this.getHighlightStyle(highlighted, node.datumIndex)?.opacity ?? 1; + text.textAlign = label.textAlign; + text.textBaseline = label.verticalAlign; + text.x = label.x; + text.y = label.y; + text.setBoxing(style); + text.visible = true; + text.zIndex = 1; + }; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + for (const text of this.labelSelection.selectByClass(Text8)) { + const datum = text.closestDatum(); + updateLabelFn(datum, text, text.tag, datum === highlightedDatum); + } + } + pickNodesExactShape(point) { + const nodes = super.pickNodesExactShape(point); + nodes.sort((a, b) => b.datumIndex.length - a.datumIndex.length); + return nodes; + } + pickNodeClosestDatum(point) { + const exactMatch = this.pickNodesExactShape(point); + if (exactMatch.length !== 0) { + return { datum: exactMatch[0], distance: 0 }; + } + return this.pickNodeNearestDistantObject(point, this.datumSelection.nodes()); + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties, ctx } = this; + const { formatManager } = ctx; + const { labelKey, secondaryLabelKey, childrenKey, sizeKey, sizeName, colorKey, colorName, tooltip } = properties; + const nodeDatum = datumIndex.reduce((n, i) => n?.children[i], this.rootNode); + if (nodeDatum == null) + return; + const { datum, depth, children } = nodeDatum; + if (datum == null || depth == null) + return; + const isLeaf = children.length === 0; + const data = []; + const datumSize = sizeKey == null ? void 0 : datum[sizeKey]; + if (datumSize != null) { + const sizeDomain = [0, this.rootNode?.sumSize ?? 0]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumSize, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain: sizeDomain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue3(datumSize) }); + } + const datumColor = colorKey == null ? void 0 : datum[colorKey]; + if (datumColor != null) { + const { colorDomain } = this; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumColor, + datum, + seriesId, + legendItemName: void 0, + key: colorKey, + source: "tooltip", + property: "color", + boundSeries: this.getFormatterContext("color"), + domain: colorDomain, + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue3(datumColor) }); + } + const format = this.getItemStyle( + { ...nodeDatum, colorValue: datumColor ?? nodeDatum.colorValue }, + isLeaf, + false + ); + const color6 = format.fill; + const markerStyle = { + shape: "square", + fill: color6, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + }; + if (_ModuleSupport162.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + const symbol = isLeaf ? { marker: markerStyle } : void 0; + return this.formatTooltipWithContext( + tooltip, + { + title: labelKey == null ? void 0 : datum[labelKey], + symbol, + data + }, + { + seriesId, + datum, + title: void 0, + depth, + labelKey, + secondaryLabelKey, + childrenKey, + sizeKey, + sizeName, + colorKey, + colorName, + ...format + } + ); + } + computeFocusBounds(node) { + return Transformable4.toCanvas(this.contentGroup, node.getBBox()); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.tile.label.itemStyler != null || this.properties.group.label.itemStyler != null; + } +}; +TreemapSeries.className = "TreemapSeries"; +TreemapSeries.type = "treemap"; + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport163 } from "ag-charts-community"; +import { arrayOf as arrayOf5, color as color5, constant as constant25, required as required25, string as string23, undocumented as undocumented8 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs23, treemapSeriesThemeableOptionsDef, without: without9 } = _ModuleSupport163; +var treemapSeriesOptionsDef = { + ...treemapSeriesThemeableOptionsDef, + ...without9(commonSeriesOptionsDefs23, ["highlightStyle", "highlight", "showInLegend"]), + type: required25(constant25("treemap")), + labelKey: string23, + secondaryLabelKey: string23, + childrenKey: string23, + sizeKey: string23, + colorKey: string23, + sizeName: string23, + colorName: string23 +}; +treemapSeriesOptionsDef.undocumentedGroupFills = undocumented8(arrayOf5(color5)); +treemapSeriesOptionsDef.undocumentedGroupStrokes = undocumented8(arrayOf5(color5)); + +// packages/ag-charts-enterprise/src/series/treemap/treemapModule.ts +var { FONT_SIZE_RATIO: FONT_SIZE_RATIO3 } = _ModuleSupport164; +var TreemapModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "treemap", + moduleFactory: (ctx) => new TreemapSeries(ctx), + solo: true, + themeTemplate: { + series: { + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", _ModuleSupport164.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", _ModuleSupport164.FILL_PATTERN_DEFAULTS], + ["image", _ModuleSupport164.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + colorRange: { $palette: "divergingColors" }, + // @ts-expect-error undocumented option + undocumentedGroupFills: { $palette: "hierarchyColors" }, + undocumentedGroupStrokes: { $palette: "secondHierarchyColors" }, + group: { + label: { + ..._ModuleSupport164.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "textColor" }, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + spacing: 4 + }, + fill: void 0, + // Override default fill + stroke: void 0, + // Override default stroke + strokeWidth: 1, + padding: 4, + gap: 2, + textAlign: "left" + }, + tile: { + label: { + ..._ModuleSupport164.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "chartBackgroundColor" }, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: 1.5 }, + minimumFontSize: { $rem: FONT_SIZE_RATIO3.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + wrapping: "on-space", + overflowStrategy: "ellipsis", + spacing: 2 + }, + secondaryLabel: { + ..._ModuleSupport164.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "chartBackgroundColor" }, + fontStyle: void 0, + fontWeight: void 0, + fontSize: { $ref: "fontSize" }, + minimumFontSize: { $rem: FONT_SIZE_RATIO3.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + wrapping: "never", + overflowStrategy: "ellipsis" + }, + fill: void 0, + // Override default fill + stroke: void 0, + // Override default stroke + strokeWidth: { $isUserOption: ["../strokes/0", 2, { $isUserOption: ["./stroke", 2, 0] }] }, + padding: 3, + gap: 1 + }, + // Override defaults + highlightStyle: { + group: { + label: { + color: { $ref: "textColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + }, + tile: { + label: { + color: { $ref: "chartBackgroundColor" } + }, + secondaryLabel: { + color: { $ref: "chartBackgroundColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + } + } + }, + gradientLegend: { + enabled: true, + ..._ModuleSupport164.LEGEND_CONTAINER_THEME + } + } +}; +var TreemapSeriesModule = { + type: "series", + name: "treemap", + chartType: "standalone", + enterprise: true, + options: treemapSeriesOptionsDef, + create: (ctx) => new TreemapSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/main-modules.ts +var ModuleRegistry = _ModuleSupport165.ModuleRegistry; +var AllCartesianEnterpriseModules = [ + OrdinalTimeAxisModule, + BoxPlotSeriesModule, + CandlestickSeriesModule, + ConeFunnelSeriesModule, + FunnelSeriesModule, + HeatmapSeriesModule, + OhlcSeriesModule, + RangeAreaSeriesModule, + RangeBarSeriesModule, + WaterfallSeriesModule +]; +var AllPolarEnterpriseModules = [ + AngleNumberAxisModule, + AngleCategoryAxisModule, + RadiusNumberAxisModule, + RadiusCategoryAxisModule, + NightingaleSeriesModule, + RadarAreaSeriesModule, + RadarLineSeriesModule, + RadialBarSeriesModule, + RadialColumnSeriesModule +]; +var AllStandaloneEnterpriseModules = [ + StandaloneChartModule, + PyramidSeriesModule, + LinearGaugeSeriesModule, + RadialGaugeSeriesModule, + SunburstSeriesModule, + TreemapSeriesModule, + ChordSeriesModule, + SankeySeriesModule +]; +var AllTopologyEnterpriseModules = [ + TopologyChartModule, + MapLineSeriesModule, + MapLineBackgroundSeriesModule, + MapMarkerSeriesModule, + MapShapeSeriesModule, + MapShapeBackgroundSeriesModule +]; +var AllEnterpriseModules = [ + ...AllCartesianEnterpriseModules, + ...AllPolarEnterpriseModules, + ...AllStandaloneEnterpriseModules, + ...AllTopologyEnterpriseModules, + // Plugins, WIP + AnnotationsModule, + NavigatorModule, + InitialStateModule +]; +export { + AllCartesianEnterpriseModules, + AllEnterpriseModules, + AllPolarEnterpriseModules, + AllStandaloneEnterpriseModules, + AllTopologyEnterpriseModules, + AngleCategoryAxisModule, + AngleNumberAxisModule, + BoxPlotSeriesModule, + CandlestickSeriesModule, + ChordSeriesModule, + ConeFunnelSeriesModule, + FunnelSeriesModule, + HeatmapSeriesModule, + LinearGaugeSeriesModule, + MapLineBackgroundSeriesModule, + MapLineSeriesModule, + MapMarkerSeriesModule, + MapShapeBackgroundSeriesModule, + MapShapeSeriesModule, + ModuleRegistry, + NightingaleSeriesModule, + OhlcSeriesModule, + OrdinalTimeAxisModule, + PyramidSeriesModule, + RadarAreaSeriesModule, + RadarLineSeriesModule, + RadialBarSeriesModule, + RadialColumnSeriesModule, + RadialGaugeSeriesModule, + RadiusCategoryAxisModule, + RadiusNumberAxisModule, + RangeAreaSeriesModule, + RangeBarSeriesModule, + SankeySeriesModule, + StandaloneChartModule, + SunburstSeriesModule, + TopologyChartModule, + TreemapSeriesModule, + WaterfallSeriesModule +}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/package/main.cjs.js b/yuthon_report/static/src/lib/ag-chart/dist/package/main.cjs.js new file mode 100644 index 000000000..cc5828556 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/package/main.cjs.js @@ -0,0 +1,44813 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var __decorateClass = (decorators, target, key, kind) => { + var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; + for (var i = decorators.length - 1, decorator; i >= 0; i--) + if (decorator = decorators[i]) + result = (kind ? decorator(target, key, result) : decorator(result)) || result; + if (kind && result) + __defProp(target, key, result); + return result; +}; + +// packages/ag-charts-enterprise/src/main.ts +var main_exports = {}; +__export(main_exports, { + AgChartsEnterpriseModule: () => AgChartsEnterpriseModule, + LicenseManager: () => LicenseManager2, + setupEnterpriseModules: () => setupEnterpriseModules2 +}); +module.exports = __toCommonJS(main_exports); +var import_ag_charts_community283 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/license/md5.ts +var MD5 = class { + constructor() { + this.ieCompatibility = false; + } + init() { + this.ieCompatibility = this.md5("hello") != "5d41402abc4b2a76b9719d911017c592"; + } + md5cycle(x, k) { + let a = x[0], b = x[1], c = x[2], d = x[3]; + a = this.ff(a, b, c, d, k[0], 7, -680876936); + d = this.ff(d, a, b, c, k[1], 12, -389564586); + c = this.ff(c, d, a, b, k[2], 17, 606105819); + b = this.ff(b, c, d, a, k[3], 22, -1044525330); + a = this.ff(a, b, c, d, k[4], 7, -176418897); + d = this.ff(d, a, b, c, k[5], 12, 1200080426); + c = this.ff(c, d, a, b, k[6], 17, -1473231341); + b = this.ff(b, c, d, a, k[7], 22, -45705983); + a = this.ff(a, b, c, d, k[8], 7, 1770035416); + d = this.ff(d, a, b, c, k[9], 12, -1958414417); + c = this.ff(c, d, a, b, k[10], 17, -42063); + b = this.ff(b, c, d, a, k[11], 22, -1990404162); + a = this.ff(a, b, c, d, k[12], 7, 1804603682); + d = this.ff(d, a, b, c, k[13], 12, -40341101); + c = this.ff(c, d, a, b, k[14], 17, -1502002290); + b = this.ff(b, c, d, a, k[15], 22, 1236535329); + a = this.gg(a, b, c, d, k[1], 5, -165796510); + d = this.gg(d, a, b, c, k[6], 9, -1069501632); + c = this.gg(c, d, a, b, k[11], 14, 643717713); + b = this.gg(b, c, d, a, k[0], 20, -373897302); + a = this.gg(a, b, c, d, k[5], 5, -701558691); + d = this.gg(d, a, b, c, k[10], 9, 38016083); + c = this.gg(c, d, a, b, k[15], 14, -660478335); + b = this.gg(b, c, d, a, k[4], 20, -405537848); + a = this.gg(a, b, c, d, k[9], 5, 568446438); + d = this.gg(d, a, b, c, k[14], 9, -1019803690); + c = this.gg(c, d, a, b, k[3], 14, -187363961); + b = this.gg(b, c, d, a, k[8], 20, 1163531501); + a = this.gg(a, b, c, d, k[13], 5, -1444681467); + d = this.gg(d, a, b, c, k[2], 9, -51403784); + c = this.gg(c, d, a, b, k[7], 14, 1735328473); + b = this.gg(b, c, d, a, k[12], 20, -1926607734); + a = this.hh(a, b, c, d, k[5], 4, -378558); + d = this.hh(d, a, b, c, k[8], 11, -2022574463); + c = this.hh(c, d, a, b, k[11], 16, 1839030562); + b = this.hh(b, c, d, a, k[14], 23, -35309556); + a = this.hh(a, b, c, d, k[1], 4, -1530992060); + d = this.hh(d, a, b, c, k[4], 11, 1272893353); + c = this.hh(c, d, a, b, k[7], 16, -155497632); + b = this.hh(b, c, d, a, k[10], 23, -1094730640); + a = this.hh(a, b, c, d, k[13], 4, 681279174); + d = this.hh(d, a, b, c, k[0], 11, -358537222); + c = this.hh(c, d, a, b, k[3], 16, -722521979); + b = this.hh(b, c, d, a, k[6], 23, 76029189); + a = this.hh(a, b, c, d, k[9], 4, -640364487); + d = this.hh(d, a, b, c, k[12], 11, -421815835); + c = this.hh(c, d, a, b, k[15], 16, 530742520); + b = this.hh(b, c, d, a, k[2], 23, -995338651); + a = this.ii(a, b, c, d, k[0], 6, -198630844); + d = this.ii(d, a, b, c, k[7], 10, 1126891415); + c = this.ii(c, d, a, b, k[14], 15, -1416354905); + b = this.ii(b, c, d, a, k[5], 21, -57434055); + a = this.ii(a, b, c, d, k[12], 6, 1700485571); + d = this.ii(d, a, b, c, k[3], 10, -1894986606); + c = this.ii(c, d, a, b, k[10], 15, -1051523); + b = this.ii(b, c, d, a, k[1], 21, -2054922799); + a = this.ii(a, b, c, d, k[8], 6, 1873313359); + d = this.ii(d, a, b, c, k[15], 10, -30611744); + c = this.ii(c, d, a, b, k[6], 15, -1560198380); + b = this.ii(b, c, d, a, k[13], 21, 1309151649); + a = this.ii(a, b, c, d, k[4], 6, -145523070); + d = this.ii(d, a, b, c, k[11], 10, -1120210379); + c = this.ii(c, d, a, b, k[2], 15, 718787259); + b = this.ii(b, c, d, a, k[9], 21, -343485551); + x[0] = this.add32(a, x[0]); + x[1] = this.add32(b, x[1]); + x[2] = this.add32(c, x[2]); + x[3] = this.add32(d, x[3]); + } + cmn(q, a, b, x, s, t) { + a = this.add32(this.add32(a, q), this.add32(x, t)); + return this.add32(a << s | a >>> 32 - s, b); + } + ff(a, b, c, d, x, s, t) { + return this.cmn(b & c | ~b & d, a, b, x, s, t); + } + gg(a, b, c, d, x, s, t) { + return this.cmn(b & d | c & ~d, a, b, x, s, t); + } + hh(a, b, c, d, x, s, t) { + return this.cmn(b ^ c ^ d, a, b, x, s, t); + } + ii(a, b, c, d, x, s, t) { + return this.cmn(c ^ (b | ~d), a, b, x, s, t); + } + md51(s) { + const n = s.length; + const state = [1732584193, -271733879, -1732584194, 271733878]; + let i; + for (i = 64; i <= s.length; i += 64) { + this.md5cycle(state, this.md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + const tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < s.length; i++) { + tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3); + } + tail[i >> 2] |= 128 << (i % 4 << 3); + if (i > 55) { + this.md5cycle(state, tail); + for (i = 0; i < 16; i++) { + tail[i] = 0; + } + } + tail[14] = n * 8; + this.md5cycle(state, tail); + return state; + } + /* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5 + * algorithm for multi-byte characters (perhaps by adding every four 16-bit characters and + * shortening the sum to 32 bits). Otherwise I suthis.ggest performing MD-5 as if every character + * was two bytes--e.g., 0040 0025 = @%--but then how will an ordinary MD-5 sum be matched? + * There is no way to standardize text to something like UTF-8 before transformation; speed cost is + * utterly prohibitive. The JavaScript standard itself needs to look at this: it should start + * providing access to strings as preformed UTF-8 8-bit unsigned value arrays. + */ + md5blk(s) { + const md5blks = []; + for (let i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + } + rhex(n) { + const hex_chr = "0123456789abcdef".split(""); + let s = "", j = 0; + for (; j < 4; j++) { + s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15]; + } + return s; + } + hex(x) { + for (let i = 0; i < x.length; i++) { + x[i] = this.rhex(x[i]); + } + return x.join(""); + } + md5(s) { + return this.hex(this.md51(s)); + } + add32(a, b) { + return this.ieCompatibility ? this.add32Compat(a, b) : this.add32Std(a, b); + } + /* this function is much faster, so if possible we use it. Some IEs are the only ones I know of that + need the idiotic second function, generated by an if clause. */ + add32Std(a, b) { + return a + b & 4294967295; + } + add32Compat(x, y) { + const lsw = (x & 65535) + (y & 65535), msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 65535; + } +}; + +// packages/ag-charts-enterprise/src/license/licenseManager.ts +function missingOrEmpty(value) { + return value == null || value.length === 0; +} +var LICENSE_TYPES = { + "01": "GRID", + "02": "CHARTS", + "0102": "BOTH" +}; +var LICENSING_HELP_URL = "https://www.ag-grid.com/charts/licensing/"; +var _LicenseManager = class _LicenseManager { + constructor(document2) { + this.watermarkMessage = void 0; + this.totalMessageLength = 124; + this.document = document2; + this.md5 = new MD5(); + this.md5.init(); + } + validateLicense() { + const licenseDetails = this.getLicenseDetails(_LicenseManager.licenseKey, _LicenseManager.gridContext); + const currentLicenseName = `AG ${licenseDetails.currentLicenseType === "BOTH" ? "Grid and " : ""}Charts Enterprise`; + let suppliedLicenseName = ""; + if (licenseDetails.suppliedLicenseType === "BOTH") { + suppliedLicenseName = "AG Grid and AG Charts Enterprise"; + } else if (licenseDetails.suppliedLicenseType === "GRID") { + suppliedLicenseName = "AG Grid Enterprise"; + } else if (licenseDetails.suppliedLicenseType !== void 0) { + suppliedLicenseName = "AG Charts Enterprise"; + } + if (licenseDetails.missing) { + if (!this.isWebsiteUrl() || this.isForceWatermark()) { + this.outputMissingLicenseKey(currentLicenseName); + } + } else if (licenseDetails.expired) { + const gridReleaseDate = _LicenseManager.getChartsReleaseDate(); + const formattedReleaseDate = _LicenseManager.formatDate(gridReleaseDate); + this.outputExpiredKey(licenseDetails.expiry, formattedReleaseDate, suppliedLicenseName); + } else if (!licenseDetails.valid) { + this.outputInvalidLicenseKey( + !!licenseDetails.incorrectLicenseType, + currentLicenseName, + suppliedLicenseName + ); + } else if (licenseDetails.isTrial && licenseDetails.trialExpired) { + this.outputExpiredTrialKey(licenseDetails.expiry, currentLicenseName, suppliedLicenseName); + } + } + static extractExpiry(license) { + const restrictionHashed = license.substring(license.lastIndexOf("_") + 1, license.length); + return new Date(Number.parseInt(_LicenseManager.decode(restrictionHashed), 10)); + } + static extractLicenseComponents(licenseKey) { + let cleanedLicenseKey = licenseKey.replaceAll(/[\u200B-\u200D\uFEFF]/g, ""); + cleanedLicenseKey = cleanedLicenseKey.replaceAll(/\r?\n|\r/g, ""); + if (licenseKey.length <= 32) { + return { md5: null, license: licenseKey, version: null, isTrial: null }; + } + const hashStart = cleanedLicenseKey.length - 32; + const md5 = cleanedLicenseKey.substring(hashStart); + const license = cleanedLicenseKey.substring(0, hashStart); + const [version, isTrial, type] = _LicenseManager.extractBracketedInformation(cleanedLicenseKey); + return { md5, license, version, isTrial, type }; + } + getLicenseDetails(licenseKey, gridContext = false) { + const currentLicenseType = "CHARTS"; + if (missingOrEmpty(licenseKey)) { + return { + licenseKey, + valid: false, + missing: true, + currentLicenseType + }; + } + const chartsReleaseDate = _LicenseManager.getChartsReleaseDate(); + const { md5, license, version, isTrial, type } = _LicenseManager.extractLicenseComponents(licenseKey); + let valid = md5 === this.md5.md5(license) && !licenseKey.includes("For_Trialing_ag-Grid_Only"); + let trialExpired = void 0; + let expired = void 0; + let expiry = null; + let incorrectLicenseType = false; + let suppliedLicenseType = void 0; + function handleTrial() { + const now = /* @__PURE__ */ new Date(); + trialExpired = expiry < now; + expired = void 0; + } + if (valid) { + expiry = _LicenseManager.extractExpiry(license); + valid = !Number.isNaN(expiry.getTime()); + if (valid) { + expired = chartsReleaseDate > expiry; + switch (version) { + case "legacy": + case "2": { + valid = false; + break; + } + case "3": { + if (missingOrEmpty(type)) { + valid = false; + } else { + suppliedLicenseType = type; + if (type !== LICENSE_TYPES["02"] && type !== LICENSE_TYPES["0102"]) { + valid = false; + incorrectLicenseType = true; + } else if (isTrial) { + handleTrial(); + } + } + } + } + } + } + if (!valid) { + return { + licenseKey, + valid, + incorrectLicenseType, + currentLicenseType, + suppliedLicenseType + }; + } + return { + licenseKey, + valid, + expiry: _LicenseManager.formatDate(expiry), + expired, + version, + isTrial, + trialExpired, + invalidLicenseTypeForCombo: gridContext ? suppliedLicenseType !== "BOTH" : void 0, + incorrectLicenseType, + currentLicenseType, + suppliedLicenseType + }; + } + isDisplayWatermark() { + return this.isForceWatermark() || !this.isLocalhost() && !this.isE2ETest() && !this.isWebsiteUrl() && !missingOrEmpty(this.watermarkMessage); + } + getWatermarkMessage() { + return this.watermarkMessage ?? ""; + } + getHostname() { + if (!this.document) { + return "localhost"; + } + const win = this.document.defaultView ?? globalThis; + if (!win) { + return "localhost"; + } + const loc = win.location; + const { hostname = "" } = loc; + return hostname; + } + isForceWatermark() { + if (!this.document) { + return false; + } + const win = this.document?.defaultView ?? globalThis.window != void 0 ? globalThis : void 0; + if (!win) { + return false; + } + const { pathname } = win.location; + return pathname ? pathname.includes("forceWatermark") : false; + } + isWebsiteUrl() { + const hostname = this.getHostname(); + return /^((?:[\w-]+\.)?ag-grid\.com)$/.exec(hostname) !== null; + } + isLocalhost() { + const hostname = this.getHostname(); + return /^(?:127\.0\.0\.1|localhost)$/.exec(hostname) !== null; + } + isE2ETest() { + const hostname = this.getHostname(); + return /^(?:172\.17\.0\.1|host\.docker\.internal)$/.exec(hostname) !== null; + } + static formatDate(date) { + const monthNames = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ]; + const day = date.getDate(); + const monthIndex = date.getMonth(); + const year = date.getFullYear(); + return day + " " + monthNames[monthIndex] + " " + year; + } + static getChartsReleaseDate() { + return new Date(Number.parseInt(_LicenseManager.decode(_LicenseManager.RELEASE_INFORMATION), 10)); + } + static decode(input) { + const keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + let t = ""; + let n, r, i; + let s, o, u, a; + let f = 0; + const e = input.replaceAll(/[^A-Za-z0-9+/=]/g, ""); + while (f < e.length) { + s = keystr.indexOf(e.charAt(f++)); + o = keystr.indexOf(e.charAt(f++)); + u = keystr.indexOf(e.charAt(f++)); + a = keystr.indexOf(e.charAt(f++)); + n = s << 2 | o >> 4; + r = (o & 15) << 4 | u >> 2; + i = (u & 3) << 6 | a; + t = t + String.fromCodePoint(n); + if (u != 64) { + t = t + String.fromCodePoint(r); + } + if (a != 64) { + t = t + String.fromCodePoint(i); + } + } + t = _LicenseManager.utf8_decode(t); + return t; + } + static utf8_decode(input) { + input = input.replaceAll("rn", "n"); + let t = ""; + for (let n = 0; n < input.length; n++) { + const r = input.codePointAt(n); + if (r < 128) { + t += String.fromCodePoint(r); + } else if (r > 127 && r < 2048) { + t += String.fromCodePoint(r >> 6 | 192); + t += String.fromCodePoint(r & 63 | 128); + } else { + t += String.fromCodePoint(r >> 12 | 224); + t += String.fromCodePoint(r >> 6 & 63 | 128); + t += String.fromCodePoint(r & 63 | 128); + } + } + return t; + } + static setGridContext(gridContext = false) { + _LicenseManager.gridContext = gridContext; + } + static setLicenseKey(licenseKey) { + if (this.licenseKey && this.licenseKey !== licenseKey) { + console.warn( + `License Key being set multiple times with different values. This can result in an incorrect license key being used.` + ); + } + _LicenseManager.licenseKey = licenseKey; + } + static extractBracketedInformation(licenseKey) { + if (!licenseKey.includes("[")) { + return ["legacy", false, void 0]; + } + const matches = licenseKey.match(/\[(.*?)\]/g).map((match) => match.replace("[", "").replace("]", "")); + if (!matches || matches.length === 0) { + return ["legacy", false, void 0]; + } + const isTrial = matches.filter((match) => match === "TRIAL").length === 1; + const rawVersion = matches.find((match) => match.startsWith("v")); + const version = rawVersion ? rawVersion.replace("v", "") : "legacy"; + const type = LICENSE_TYPES[matches.find((match) => LICENSE_TYPES[match])]; + return [version, isTrial, type]; + } + centerPadAndOutput(input) { + const paddingRequired = this.totalMessageLength - input.length; + console.error(input.padStart(paddingRequired / 2 + input.length, "*").padEnd(this.totalMessageLength, "*")); + } + padAndOutput(input, padding = "*", terminateWithPadding = "") { + console.error( + input.padEnd(this.totalMessageLength - terminateWithPadding.length, padding) + terminateWithPadding + ); + } + outputInvalidLicenseKey(incorrectLicenseType, currentLicenseName, suppliedLicenseName) { + if (!_LicenseManager.gridContext) { + if (incorrectLicenseType) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Incompatible License Key "); + this.padAndOutput( + `* Your license key is for ${suppliedLicenseName} only and does not cover you for ${currentLicenseName}.`, + " ", + "*" + ); + this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } else { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Invalid License Key "); + this.padAndOutput(`* Your license key is not valid.`, " ", "*"); + this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + } + this.watermarkMessage = "Invalid License"; + } + outputExpiredTrialKey(formattedExpiryDate, currentLicenseName, suppliedLicenseName) { + if (!_LicenseManager.gridContext) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Trial Period Expired. "); + this.padAndOutput( + `* Your trial only license for ${suppliedLicenseName} expired on ${formattedExpiryDate}.`, + " ", + "*" + ); + this.padAndOutput("* Please email info@ag-grid.com to purchase a license.", " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + this.watermarkMessage = "Trial Period Expired"; + } + outputMissingLicenseKey(currentLicenseName) { + if (!_LicenseManager.gridContext) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" License Key Not Found "); + this.padAndOutput(`* All ${currentLicenseName} features are unlocked for trial.`, " ", "*"); + this.padAndOutput( + "* If you want to hide the watermark please email info@ag-grid.com for a trial license key.", + " ", + "*" + ); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + this.watermarkMessage = "For Trial Use Only"; + } + outputExpiredKey(formattedExpiryDate, formattedReleaseDate, currentLicenseName) { + if (!_LicenseManager.gridContext) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Incompatible Software Version "); + this.padAndOutput( + `* Your license key works with versions of ${currentLicenseName} released before ${formattedExpiryDate}.`, + " ", + "*" + ); + this.padAndOutput(`* The version you are trying to use was released on ${formattedReleaseDate}.`, " ", "*"); + this.padAndOutput("* Please contact info@ag-grid.com to renew your license key.", " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + this.watermarkMessage = "License Expired"; + } +}; +_LicenseManager.RELEASE_INFORMATION = "MTc2MTcyODQ5OTU1NQ=="; +_LicenseManager.gridContext = false; +var LicenseManager = _LicenseManager; + +// packages/ag-charts-enterprise/src/setup.ts +var import_ag_charts_community282 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxis.ts +var import_ag_charts_community5 = require("ag-charts-community"); +var import_ag_charts_core4 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/utils/polar.ts +function loopSymmetrically(items, step, iterator) { + const loop = (start, end, loopStep, loopIterator) => { + let prev = items[0]; + for (let i = start; loopStep > 0 ? i <= end : i > end; i += loopStep) { + const curr = items[i]; + if (loopIterator(prev, curr)) + return true; + prev = curr; + } + return false; + }; + const midIndex = Math.floor(items.length / 2); + if (loop(step, midIndex, step, iterator)) + return true; + return loop(items.length - step, midIndex, -step, iterator); +} + +// packages/ag-charts-enterprise/src/axes/angle-number/angleAxisInterval.ts +var import_ag_charts_community = require("ag-charts-community"); +var { AxisInterval, Property } = import_ag_charts_community._ModuleSupport; +var AngleAxisInterval = class extends AxisInterval { +}; +__decorateClass([ + Property +], AngleAxisInterval.prototype, "minSpacing", 2); + +// packages/ag-charts-enterprise/src/axes/angle/angleAxis.ts +var import_ag_charts_community4 = require("ag-charts-community"); +var import_ag_charts_core3 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/angleCrossLine.ts +var import_ag_charts_community3 = require("ag-charts-community"); +var import_ag_charts_core2 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/polarCrossLine.ts +var import_ag_charts_community2 = require("ag-charts-community"); +var import_ag_charts_core = require("ag-charts-core"); +var { BaseProperties, ChartAxisDirection, Property: Property2, Group, FONT_SIZE } = import_ag_charts_community2._ModuleSupport; +var PolarCrossLineLabel = class extends BaseProperties { + constructor() { + super(...arguments); + this.fontSize = FONT_SIZE.LARGE; + this.fontFamily = "Verdana, sans-serif"; + this.padding = 5; + this.color = "rgba(87, 87, 87, 1)"; + } +}; +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "enabled", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "text", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontStyle", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontWeight", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontSize", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontFamily", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "padding", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "color", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "parallel", 2); +var PolarCrossLine = class extends BaseProperties { + constructor() { + super(...arguments); + this.id = (0, import_ag_charts_core.createId)(this); + this.defaultColorRange = []; + this.shape = "polygon"; + this.label = new PolarCrossLineLabel(); + this.scale = void 0; + this.clippedRange = [-Infinity, Infinity]; + this.gridLength = 0; + this.sideFlag = -1; + this.parallelFlipRotation = 0; + this.regularFlipRotation = 0; + this.direction = ChartAxisDirection.Angle; + this.axisInnerRadius = 0; + this.axisOuterRadius = 0; + this.lineGroup = new Group({ name: this.id }); + this.rangeGroup = new Group({ name: this.id }); + this.labelGroup = new Group({ name: this.id }); + this._isRange = void 0; + } + assignCrossLineGroup(isRange, crossLineRange) { + if (isRange !== this._isRange) { + if (isRange) { + this.rangeGroup.appendChild(crossLineRange); + } else { + this.lineGroup.appendChild(crossLineRange); + } + } + this._isRange = isRange; + } + setSectorNodeProps(node) { + node.fill = this.fill; + node.fillOpacity = this.fillOpacity ?? 1; + node.stroke = this.stroke; + node.strokeOpacity = this.strokeOpacity ?? 1; + node.strokeWidth = this.strokeWidth ?? 1; + node.lineDash = this.lineDash; + } + setLabelNodeProps(node, x, y, baseline, rotation) { + const { label } = this; + node.x = x; + node.y = y; + node.text = label.text; + node.textAlign = "center"; + node.textBaseline = baseline; + node.rotation = rotation; + node.rotationCenterX = x; + node.rotationCenterY = y; + node.fill = label.color; + node.fontFamily = label.fontFamily; + node.fontSize = label.fontSize; + node.fontStyle = label.fontStyle; + node.visible = true; + } +}; +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "enabled", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "type", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "range", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "value", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "defaultColorRange", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "fill", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "fillOpacity", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "stroke", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "strokeWidth", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "strokeOpacity", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "lineDash", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "shape", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "label", 2); + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/angleCrossLine.ts +var { + ChartAxisDirection: ChartAxisDirection2, + getCrossLineValue, + validateCrossLineValue, + normalizeAngle360, + Group: Group2, + Path, + Sector, + RotatableText, + ContinuousScale +} = import_ag_charts_community3._ModuleSupport; +var AngleCrossLine = class extends PolarCrossLine { + constructor() { + super(); + this.direction = ChartAxisDirection2.Angle; + this.polygonNode = new Path(); + this.sectorNode = new Sector(); + this.lineNode = new Path(); + this.crossLineRange = new Group2(); + this.labelNode = new RotatableText(); + this.ticks = []; + this.crossLineRange.append(this.polygonNode); + this.crossLineRange.append(this.sectorNode); + this.crossLineRange.append(this.lineNode); + this.labelGroup.append(this.labelNode); + } + visibilityCheck() { + if (!ContinuousScale.is(this.scale)) { + return true; + } + const [d0, d1] = this.scale.domain; + const value = getCrossLineValue(this); + if (this.type === "range") { + const [start, end] = value; + return start >= d0 && start <= d1 && end >= start && end <= d1; + } else { + return value >= d0 && value <= d1; + } + } + update(visible) { + const { scale } = this; + if (!scale || !validateCrossLineValue(this, scale) || !this.visibilityCheck()) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updateLineNode(visible); + this.updatePolygonNode(visible); + this.updateSectorNode(visible); + this.updateLabelNode(visible); + } + updateLineNode(visible) { + const { scale, type, value, lineNode: line } = this; + if (!visible || type !== "line" || !scale) { + line.visible = false; + return; + } + const angle = scale.convert(value); + if (Number.isNaN(angle)) { + line.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + line.visible = true; + line.stroke = this.stroke; + line.strokeOpacity = this.strokeOpacity ?? 1; + line.strokeWidth = this.strokeWidth ?? 1; + line.fill = void 0; + line.lineDash = this.lineDash; + const x = axisOuterRadius * Math.cos(angle); + const y = axisOuterRadius * Math.sin(angle); + const x0 = axisInnerRadius * Math.cos(angle); + const y0 = axisInnerRadius * Math.sin(angle); + line.path.clear(true); + line.path.moveTo(x0, y0); + line.path.lineTo(x, y); + this.assignCrossLineGroup(false, this.crossLineRange); + } + updatePolygonNode(visible) { + const { polygonNode: polygon, range: range2, scale, shape, type, ticks } = this; + if (!visible || type !== "range" || shape !== "polygon" || !scale || !range2) { + polygon.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + const startIndex = ticks.indexOf(range2[0]); + const endIndex = ticks.indexOf(range2[1]); + const stops = startIndex <= endIndex ? ticks.slice(startIndex, endIndex + 1) : ticks.slice(startIndex).concat(ticks.slice(0, endIndex + 1)); + const angles = stops.map((value) => scale.convert(value)); + polygon.visible = true; + this.setSectorNodeProps(polygon); + const { path } = polygon; + path.clear(true); + for (const [index, angle] of angles.entries()) { + const x = axisOuterRadius * Math.cos(angle); + const y = axisOuterRadius * Math.sin(angle); + if (index === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + if (axisInnerRadius === 0) { + path.lineTo(0, 0); + } else { + const reversedAngles = angles.slice().reverse(); + for (const angle of reversedAngles) { + const x = axisInnerRadius * Math.cos(angle); + const y = axisInnerRadius * Math.sin(angle); + path.lineTo(x, y); + } + } + polygon.path.closePath(); + this.assignCrossLineGroup(true, this.crossLineRange); + } + updateSectorNode(visible) { + const { sectorNode: sector, range: range2, scale, shape, type } = this; + if (!visible || type !== "range" || shape !== "circle" || !scale || !range2) { + sector.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + const angles = range2.map((value) => scale.convert(value)); + const step = scale.step ?? 0; + const padding = scale instanceof import_ag_charts_community3._ModuleSupport.BandScale ? step / 2 : 0; + sector.visible = true; + this.setSectorNodeProps(sector); + sector.centerX = 0; + sector.centerY = 0; + sector.innerRadius = axisInnerRadius; + sector.outerRadius = axisOuterRadius; + sector.startAngle = angles[0] - padding; + sector.endAngle = angles[1] + padding; + this.assignCrossLineGroup(true, this.crossLineRange); + } + updateLabelNode(visible) { + const { label, labelNode: node, range: range2, scale, type, ticks } = this; + if (!visible || label.enabled === false || !label.text || !scale || type === "range" && !range2) { + node.visible = false; + return; + } + node.visible = true; + const { axisInnerRadius, axisOuterRadius } = this; + let labelX; + let labelY; + let rotation; + let textBaseline; + if (type === "line") { + const angle = normalizeAngle360(scale.convert(this.value)); + const angle270 = 1.5 * Math.PI; + const isRightSide = (0, import_ag_charts_core2.isNumberEqual)(angle, angle270) || angle > angle270 || angle < Math.PI / 2; + const midX = (axisInnerRadius + axisOuterRadius) / 2 * Math.cos(angle); + const midY = (axisInnerRadius + axisOuterRadius) / 2 * Math.sin(angle); + labelX = midX + label.padding * Math.cos(angle + Math.PI / 2); + labelY = midY + label.padding * Math.sin(angle + Math.PI / 2); + textBaseline = isRightSide ? "top" : "bottom"; + rotation = isRightSide ? angle : angle - Math.PI; + } else { + const [startAngle, endAngle] = range2.map((value) => normalizeAngle360(scale.convert(value))); + let angle = (startAngle + endAngle) / 2; + if (startAngle > endAngle) { + angle -= Math.PI; + } + angle = normalizeAngle360(angle); + const isBottomSide = ((0, import_ag_charts_core2.isNumberEqual)(angle, 0) || angle > 0) && angle < Math.PI; + let distance; + if (this.shape === "circle" || ticks.length < 3) { + distance = axisOuterRadius - label.padding; + } else { + distance = axisOuterRadius * Math.cos(Math.PI / ticks.length) - label.padding; + } + labelX = distance * Math.cos(angle); + labelY = distance * Math.sin(angle); + textBaseline = isBottomSide ? "bottom" : "top"; + rotation = isBottomSide ? angle - Math.PI / 2 : angle + Math.PI / 2; + } + this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation); + } +}; +AngleCrossLine.className = "AngleCrossLine"; + +// packages/ag-charts-enterprise/src/axes/angle/angleAxis.ts +var { + ChartAxisDirection: ChartAxisDirection3, + Property: Property3, + toRadians, + normalizeAngle360: normalizeAngle3602, + normalizeAngle360Inclusive, + Path: Path2, + RotatableText: RotatableText2, + Transformable, + BBox, + Selection, + Line +} = import_ag_charts_community4._ModuleSupport; +var AngleAxisLabel = class extends import_ag_charts_community4._ModuleSupport.AxisLabel { + constructor() { + super(...arguments); + this.orientation = "fixed"; + } +}; +__decorateClass([ + Property3 +], AngleAxisLabel.prototype, "orientation", 2); +var AngleAxis = class extends import_ag_charts_community4._ModuleSupport.PolarAxis { + constructor(moduleCtx, scale) { + super(moduleCtx, scale); + this.startAngle = 0; + this.endAngle = void 0; + this.tickLineGroupSelection = Selection.select( + this.tickLineGroup, + Line, + false + ); + this.gridLineGroupSelection = Selection.select( + this.gridLineGroup, + Line, + false + ); + this.labelData = []; + this.tickData = []; + this.radiusLineGroup = this.axisGroup.appendChild(new import_ag_charts_community4._ModuleSupport.TransformableGroup()); + this.radiusLine = this.radiusLineGroup.appendChild(new Path2()); + this.includeInvisibleDomains = true; + } + get direction() { + return ChartAxisDirection3.Angle; + } + createLabel() { + return new AngleAxisLabel(); + } + calculateRotations() { + const rotation = toRadians(this.startAngle); + const parallelFlipRotation = normalizeAngle3602(rotation); + const regularFlipRotation = normalizeAngle3602(rotation - Math.PI / 2); + return { rotation, parallelFlipRotation, regularFlipRotation }; + } + calculateTickLayout(domain) { + const { nice, scale } = this; + const ticksParams = { + nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + const niceDomain = nice ? scale.niceDomain(ticksParams, domain) : domain; + const tickData = this.generateAngleTicks(niceDomain); + this.tickData = tickData; + const ticks = tickData.map((t) => t.value); + const fractionDigits = ticks.reduce( + (f, t) => Math.max(typeof t === "number" ? (0, import_ag_charts_core3.countFractionDigits)(t) : 0, f), + 0 + ); + return { + niceDomain, + tickDomain: niceDomain, + ticks, + rawTickCount: void 0, + fractionDigits, + timeInterval: void 0, + bbox: this.getBBox() + }; + } + update() { + super.update(); + this.updateRadiusLine(); + this.updateGridLines(); + this.updateTickLines(); + } + normalizedAngles() { + const startAngle = normalizeAngle3602(-Math.PI / 2 + toRadians(this.startAngle)); + const sweep = this.endAngle == null ? 2 * Math.PI : normalizeAngle360Inclusive(toRadians(this.endAngle) - toRadians(this.startAngle)); + const endAngle = startAngle + sweep; + return [startAngle, endAngle]; + } + computeRange() { + this.range = this.normalizedAngles(); + } + updateSelections() { + const data = this.tickData; + this.gridLineGroupSelection.update(this.gridLength && this.gridLine.enabled ? data : []); + this.tickLineGroupSelection.update(this.tick.enabled ? data : []); + this.tickLabelGroupSelection.update(this.label.enabled ? data : []); + this.gridLineGroupSelection.cleanup(); + this.tickLineGroupSelection.cleanup(); + this.tickLabelGroupSelection.cleanup(); + } + updatePosition() { + super.updatePosition(); + const { translation, radiusLineGroup } = this; + const translationX = Math.floor(translation.x); + const translationY = Math.floor(translation.y); + radiusLineGroup.translationX = translationX; + radiusLineGroup.translationY = translationY; + } + updateRadiusLine() { + const node = this.radiusLine; + const { path } = node; + path.clear(true); + const { points, closePath } = this.getAxisLinePoints(); + for (const { x, y, moveTo: moveTo2, arc, radius = 0, startAngle = 0, endAngle = 0 } of points) { + if (arc) { + path.arc(x, y, radius, startAngle, endAngle); + } else if (moveTo2) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + if (closePath) { + path.closePath(); + } + node.visible = this.line.enabled; + node.stroke = this.line.stroke; + node.strokeWidth = this.line.width; + node.fill = void 0; + } + getAxisLinePoints() { + const { scale, shape, gridLength: radius } = this; + const [startAngle, endAngle] = this.range; + const isFullCircle = (0, import_ag_charts_core3.isNumberEqual)(endAngle - startAngle, 2 * Math.PI); + const points = []; + if (shape === "circle") { + if (isFullCircle) { + points.push( + { x: radius, y: 0, moveTo: true }, + { + x: 0, + y: 0, + radius, + startAngle: 0, + endAngle: 2 * Math.PI, + arc: true, + moveTo: false + } + ); + } else { + points.push( + { + x: radius * Math.cos(startAngle), + y: radius * Math.sin(startAngle), + moveTo: true + }, + { + x: 0, + y: 0, + radius, + startAngle: normalizeAngle3602(startAngle), + endAngle: normalizeAngle3602(endAngle), + arc: true, + moveTo: false + } + ); + } + } else if (shape === "polygon") { + const angles = scale.ticks({ + nice: this.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.map((value) => scale.convert(value)); + if (angles && angles.length > 2) { + for (const [i, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + const moveTo2 = i === 0; + points.push({ x, y, moveTo: moveTo2 }); + } + } + } + return { points, closePath: isFullCircle }; + } + updateGridLines() { + const { + scale, + gridLength: radius, + gridLine: { style, width }, + innerRadiusRatio + } = this; + if (!(style && radius > 0)) { + return; + } + const innerRadius = radius * innerRadiusRatio; + const styleCount = style.length; + this.gridLineGroupSelection.each((line, datum, index) => { + const { value } = datum; + const { stroke: stroke2, lineDash } = style[index % styleCount]; + const angle = scale.convert(value); + line.x1 = innerRadius * Math.cos(angle); + line.y1 = innerRadius * Math.sin(angle); + line.x2 = radius * Math.cos(angle); + line.y2 = radius * Math.sin(angle); + line.stroke = stroke2; + line.strokeWidth = width; + line.lineDash = lineDash; + line.fill = void 0; + }); + this.gridLineGroupSelection.cleanup(); + } + updateLabels() { + const { label, tickLabelGroupSelection } = this; + tickLabelGroupSelection.each((node, _, index) => { + const labelDatum = this.labelData[index]; + if (!labelDatum || labelDatum.hidden) { + node.visible = false; + return; + } + node.text = labelDatum.text; + node.setFont(label); + node.fill = label.color; + node.x = labelDatum.x; + node.y = labelDatum.y; + node.setAlign(labelDatum); + node.setBoxing(label); + node.visible = true; + if (labelDatum.rotation) { + node.rotation = labelDatum.rotation; + node.rotationCenterX = labelDatum.x; + node.rotationCenterY = labelDatum.y; + } else { + node.rotation = 0; + } + }); + } + updateTickLines() { + const { scale, gridLength: radius, tick, tickLineGroupSelection } = this; + tickLineGroupSelection.each((line, datum) => { + const { value } = datum; + const angle = scale.convert(value); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + line.x1 = radius * cos; + line.y1 = radius * sin; + line.x2 = (radius + tick.size) * cos; + line.y2 = (radius + tick.size) * sin; + line.stroke = tick.stroke; + line.strokeWidth = tick.width; + }); + } + createLabelNodeData(ticks, options, seriesRect) { + const { label, gridLength: radius, scale, tick } = this; + if (!label.enabled) { + return []; + } + const tempText = new RotatableText2(); + const seriesLeft = seriesRect.x - this.translation.x; + const seriesRight = seriesRect.x + seriesRect.width - this.translation.x; + const { fractionDigits } = this.layout.label; + const axisTickFormatter = this.tickFormatter(this.scale.domain, this.tickData, false, fractionDigits); + const labelData = ticks.map((datum, index) => { + const { value } = datum; + const distance = radius + label.spacing + tick.size; + const angle = scale.convert(value); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + const x = distance * cos; + const y = distance * sin; + const { textAlign, textBaseline } = this.getLabelAlign(angle); + const isLastTickOverFirst = index === ticks.length - 1 && value !== ticks[0] && (0, import_ag_charts_core3.isNumberEqual)(normalizeAngle3602(angle), normalizeAngle3602(scale.convert(ticks[0]))); + const rotation = this.getLabelRotation(angle); + let text2 = axisTickFormatter(value, index); + tempText.text = text2; + tempText.x = x; + tempText.y = y; + tempText.setFont(label); + tempText.textAlign = textAlign; + tempText.textBaseline = textBaseline; + tempText.rotation = rotation; + if (rotation) { + tempText.rotationCenterX = x; + tempText.rotationCenterY = y; + } + let box = rotation ? Transformable.toCanvas(tempText) : tempText.getBBox(); + if (box && options.hideWhenNecessary && !rotation) { + const overflowLeft = seriesLeft - box.x; + const overflowRight = box.x + box.width - seriesRight; + const pixelError = 1; + if (overflowLeft > pixelError || overflowRight > pixelError) { + const availWidth = box.width - Math.max(overflowLeft, overflowRight); + const wrapOptions = { maxWidth: availWidth, font: label, textWrap: "never" }; + text2 = (0, import_ag_charts_core3.wrapTextOrSegments)(text2, wrapOptions); + tempText.text = text2; + box = tempText.getBBox(); + } + } + return { + text: text2, + x, + y, + textAlign, + textBaseline, + hidden: text2 === "" || (datum.hidden ?? isLastTickOverFirst), + rotation, + box + }; + }); + if (label.avoidCollisions) { + this.avoidLabelCollisions(labelData); + } + return labelData; + } + computeLabelsBBox(options, seriesRect) { + this.labelData = this.createLabelNodeData(this.tickData, options, seriesRect); + const textBoxes = this.labelData.map(({ box }) => box).filter((box) => box != null); + if (!this.label.enabled || textBoxes.length === 0) { + return null; + } + return BBox.merge(textBoxes); + } + getLabelOrientation() { + const { label } = this; + return label instanceof AngleAxisLabel ? label.orientation : "fixed"; + } + getLabelRotation(tickAngle) { + let rotation = toRadians(this.label.rotation ?? 0); + tickAngle = normalizeAngle3602(tickAngle); + const orientation = this.getLabelOrientation(); + if (orientation === "parallel") { + rotation += tickAngle; + if (tickAngle >= 0 && tickAngle < Math.PI) { + rotation -= Math.PI / 2; + } else { + rotation += Math.PI / 2; + } + } else if (orientation === "perpendicular") { + rotation += tickAngle; + if (tickAngle >= Math.PI / 2 && tickAngle < 1.5 * Math.PI) { + rotation += Math.PI; + } + } + return rotation; + } + getLabelAlign(tickAngle) { + const cos = Math.cos(tickAngle); + const sin = Math.sin(tickAngle); + let textAlign; + let textBaseline; + const orientation = this.getLabelOrientation(); + const isCos0 = (0, import_ag_charts_core3.isNumberEqual)(cos, 0); + const isSin0 = (0, import_ag_charts_core3.isNumberEqual)(sin, 0); + const isCos1 = (0, import_ag_charts_core3.isNumberEqual)(cos, 1); + const isSinMinus1 = (0, import_ag_charts_core3.isNumberEqual)(sin, -1); + const isCosPositive = cos > 0 && !isCos0; + const isSinPositive = sin > 0 && !isSin0; + if (orientation === "parallel") { + textAlign = "center"; + textBaseline = isCos1 && isSin0 || isSinPositive ? "top" : "bottom"; + } else if (orientation === "perpendicular") { + textAlign = isSinMinus1 || isCosPositive ? "left" : "right"; + textBaseline = "middle"; + } else { + textAlign = "right"; + if (isCos0) { + textAlign = "center"; + } else if (isCosPositive) { + textAlign = "left"; + } + textBaseline = "bottom"; + if (isSin0) { + textBaseline = "middle"; + } else if (isSinPositive) { + textBaseline = "top"; + } + } + return { textAlign, textBaseline }; + } + updateCrossLines() { + const { shape, gridLength: radius, innerRadiusRatio } = this; + for (const crossLine of this.crossLines) { + if (crossLine instanceof AngleCrossLine) { + crossLine.ticks = this.tickData.map((t) => t.value); + crossLine.shape = shape; + crossLine.axisOuterRadius = radius; + crossLine.axisInnerRadius = radius * innerRadiusRatio; + } + } + super.updateCrossLines(); + } +}; +AngleAxis.CrossLineConstructor = AngleCrossLine; +__decorateClass([ + Property3 +], AngleAxis.prototype, "startAngle", 2); +__decorateClass([ + Property3 +], AngleAxis.prototype, "endAngle", 2); + +// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxis.ts +var { Property: Property4, CategoryScale } = import_ag_charts_community5._ModuleSupport; +var AngleCategoryAxis = class extends AngleAxis { + constructor(moduleCtx) { + super(moduleCtx, new CategoryScale()); + this.groupPaddingInner = 0; + this.paddingInner = 0; + this.interval = new AngleAxisInterval(); + } + hasDefinedDomain() { + return false; + } + generateAngleTicks(domain) { + const { scale, gridLength: radius } = this; + const { values, minSpacing } = this.interval; + const tickParams = { + nice: this.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + const ticks = values ?? scale.ticks(tickParams, domain)?.ticks ?? []; + if (ticks.length < 2 || minSpacing == null) { + return ticks.map((value) => { + return { value, visible: true }; + }); + } + const startTick = ticks[0]; + const startAngle = scale.convert(startTick); + const startX = radius * Math.cos(startAngle); + const startY = radius * Math.sin(startAngle); + for (let step = 1; step < ticks.length - 1; step++) { + const nextTick = ticks[step]; + const nextAngle = scale.convert(nextTick); + if (nextAngle - startAngle > Math.PI) { + break; + } + const nextX = radius * Math.cos(nextAngle); + const nextY = radius * Math.sin(nextAngle); + const spacing = Math.hypot(nextX - startX, nextY - startY); + if (spacing > minSpacing) { + const visibleTicks = /* @__PURE__ */ new Set([startTick]); + loopSymmetrically(ticks, step, (_, next) => { + visibleTicks.add(next); + }); + return ticks.map((value) => { + const visible = visibleTicks.has(value); + return { value, visible }; + }); + } + } + return [{ value: startTick, visible: true }]; + } + avoidLabelCollisions(labelData) { + const { minSpacing } = this.label; + if (labelData.length < 3) + return; + const labelsCollide = (prev, next) => { + if (prev.hidden || next.hidden) { + return false; + } else if (minSpacing == null) { + return prev.box.collidesBBox(next.box); + } + const prevBox = prev.box.clone().grow(minSpacing / 2); + const nextBox = next.box.clone().grow(minSpacing / 2); + return prevBox.collidesBBox(nextBox); + }; + const firstLabel = labelData[0]; + const lastLabel = labelData.at(-1); + const visibleLabels = /* @__PURE__ */ new Set([firstLabel]); + const lastLabelIsOverFirst = (0, import_ag_charts_core4.isNumberEqual)(firstLabel.x, lastLabel.x) && (0, import_ag_charts_core4.isNumberEqual)(firstLabel.y, lastLabel.y); + const maxStep = Math.floor(labelData.length / 2); + for (let step = 1; step <= maxStep; step++) { + const labels = lastLabelIsOverFirst ? labelData.slice(0, -1) : labelData; + const collisionDetected = loopSymmetrically(labels, step, labelsCollide); + if (!collisionDetected) { + loopSymmetrically(labels, step, (_, next) => { + visibleLabels.add(next); + }); + break; + } + } + for (const datum of labelData) { + if (!visibleLabels.has(datum)) { + datum.hidden = true; + datum.box = void 0; + } + } + } + tickFormatParams() { + return { type: "category" }; + } + datumFormatParams(value, params) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +AngleCategoryAxis.className = "AngleCategoryAxis"; +AngleCategoryAxis.type = "angle-category"; +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "paddingInner", 2); +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "interval", 2); + +// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxisModule.ts +var AngleCategoryAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "angle-category", + moduleFactory: (ctx) => new AngleCategoryAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/axes/angle-number/angleNumberAxis.ts +var import_ag_charts_community7 = require("ag-charts-community"); +var import_ag_charts_core6 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/axes/angle-number/linearAngleScale.ts +var import_ag_charts_community6 = require("ag-charts-community"); +var import_ag_charts_core5 = require("ag-charts-core"); +var { range, isDenseInterval, LinearScale } = import_ag_charts_community6._ModuleSupport; +var LinearAngleScale = class _LinearAngleScale extends LinearScale { + constructor() { + super(...arguments); + this.arcLength = 0; + } + static getNiceStepAndTickCount(ticks, domain) { + const [start, stop] = domain; + let step = LinearScale.getTickStep(start, stop, ticks); + const maxTickCount = Number.isNaN(ticks.maxTickCount) ? Infinity : ticks.maxTickCount; + const expectedTickCount = Math.abs(stop - start) / step; + let niceTickCount = Math.pow(2, Math.ceil(Math.log(expectedTickCount) / Math.log(2))); + if (niceTickCount > maxTickCount) { + niceTickCount /= 2; + step *= 2; + } + return { count: niceTickCount, step }; + } + ticks(ticks, domain = this.domain) { + const { arcLength } = this; + if (!domain || domain.length < 2 || domain.some((d) => !Number.isFinite(d)) || arcLength <= 0) { + return { ticks: [], count: 0 }; + } + const { nice, interval } = ticks; + const [d0, d1] = domain; + if (interval) { + const step2 = Math.abs(interval); + const availableRange = this.getPixelRange(); + if (!isDenseInterval((d1 - d0) / step2, availableRange)) { + return range(d0, d1, step2); + } + } + let step; + if (nice && this.hasNiceRange()) { + const linearNiceDomain = super.niceDomain(ticks, domain); + step = _LinearAngleScale.getNiceStepAndTickCount(ticks, linearNiceDomain).step; + } else { + step = LinearScale.getTickStep(d0, d1, ticks); + } + return range(d0, d1, step); + } + hasNiceRange() { + const sortedRange = this.range.slice().sort((a, b) => a - b); + const niceRanges = [Math.PI, 2 * Math.PI]; + return niceRanges.some((r) => (0, import_ag_charts_core5.isNumberEqual)(r, sortedRange[1] - sortedRange[0])); + } + niceDomain(ticks, domain = this.domain) { + const linearNiceDomain = super.niceDomain(ticks, domain); + if (!this.hasNiceRange()) + return linearNiceDomain; + const reversed = linearNiceDomain[0] > linearNiceDomain[1]; + const start = reversed ? linearNiceDomain[1] : linearNiceDomain[0]; + const { step, count } = _LinearAngleScale.getNiceStepAndTickCount(ticks, linearNiceDomain); + const s = 1 / step; + const stop = step >= 1 ? Math.ceil(start / step + count) * step : Math.ceil((start + count * step) * s) / s; + return reversed ? [stop, start] : [start, stop]; + } + getPixelRange() { + return this.arcLength; + } +}; + +// packages/ag-charts-enterprise/src/axes/angle-number/angleNumberAxis.ts +var { Property: Property5, angleBetween, normalisedExtentWithMetadata, findMinMax } = import_ag_charts_community7._ModuleSupport; +var AngleNumberAxis = class extends AngleAxis { + constructor(moduleCtx) { + super(moduleCtx, new LinearAngleScale()); + this.shape = "circle"; + this.interval = new AngleAxisInterval(); + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata(d, min, max); + return { domain: extent3, clipped }; + } + updateScale() { + super.updateScale(); + this.scale.arcLength = this.getRangeArcLength(); + } + getRangeArcLength() { + const { range: requestedRange } = this; + const min = Math.min(...requestedRange); + const max = Math.max(...requestedRange); + const rotation = angleBetween(min, max) || 2 * Math.PI; + const radius = this.gridLength; + return rotation * radius; + } + generateAngleTicks(domain) { + const { scale, range: requestedRange, nice } = this; + const { values, step, minSpacing, maxSpacing } = this.interval; + let rawTicks; + if (values == null) { + const { arcLength } = scale; + const minTickCount = maxSpacing ? Math.floor(arcLength / maxSpacing) : 1; + const maxTickCount = minSpacing ? Math.floor(arcLength / minSpacing) : Infinity; + const preferredTickCount = Math.floor(4 / Math.PI * Math.abs(requestedRange[0] - requestedRange[1])); + const tickCount = Math.max(minTickCount, Math.min(maxTickCount, preferredTickCount)); + const tickParams = { + nice, + interval: step, + tickCount, + minTickCount, + maxTickCount + }; + rawTicks = scale.ticks(tickParams, domain)?.ticks ?? []; + } else { + const [d0, d1] = findMinMax(domain.map(Number)); + rawTicks = values.filter((value) => value >= d0 && value <= d1).sort((a, b) => a - b); + } + return rawTicks.map((value) => ({ value, visible: true })); + } + avoidLabelCollisions(labelData) { + const { minSpacing } = this.label; + const labelsCollide = (prev, next) => { + if (prev.hidden || next.hidden) { + return false; + } else if (minSpacing == null) { + return prev.box.collidesBBox(next.box); + } + const prevBox = prev.box.clone().grow(minSpacing / 2); + const nextBox = next.box.clone().grow(minSpacing / 2); + return prevBox.collidesBBox(nextBox); + }; + const firstLabel = labelData[0]; + const lastLabel = labelData.at(-1); + if (firstLabel !== lastLabel && (0, import_ag_charts_core6.isNumberEqual)(firstLabel.x, lastLabel.x) && (0, import_ag_charts_core6.isNumberEqual)(firstLabel.y, lastLabel.y)) { + lastLabel.hidden = true; + } + for (let step = 1; step < labelData.length; step *= 2) { + let collisionDetected = false; + for (let i = step; i < labelData.length; i += step) { + const next = labelData[i]; + const prev = labelData[i - step]; + if (labelsCollide(prev, next)) { + collisionDetected = true; + break; + } + } + if (!collisionDetected) { + for (const [i, datum] of labelData.entries()) { + if (i % step > 0) { + datum.hidden = true; + datum.box = void 0; + } + } + return; + } + } + for (const [i, datum] of labelData.entries()) { + if (i > 0) { + datum.hidden = true; + datum.box = void 0; + } + } + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +AngleNumberAxis.className = "AngleNumberAxis"; +AngleNumberAxis.type = "angle-number"; +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "min", 2); +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "max", 2); +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "interval", 2); + +// packages/ag-charts-enterprise/src/axes/angle-number/angleNumberAxisModule.ts +var AngleNumberAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "angle-number", + moduleFactory: (ctx) => new AngleNumberAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/axes/ordinal/ordinalTimeAxis.ts +var import_ag_charts_community8 = require("ag-charts-community"); +var { + OrdinalTimeScale, + Property: Property6, + TimeAxisParentLevel, + lowestGranularityUnitForTicks, + lowestGranularityUnitForValue, + minimumTimeAxisDatumGranularity, + dateTruncationForDomain, + intervalUnit, + intervalStep, + intervalEpoch, + intervalMilliseconds +} = import_ag_charts_community8._ModuleSupport; +var OrdinalTimeAxis = class extends import_ag_charts_community8._ModuleSupport.DiscreteTimeAxis { + constructor(moduleCtx) { + super(moduleCtx, new OrdinalTimeScale()); + this.parentLevel = new TimeAxisParentLevel(); + } + get primaryLabel() { + return this.parentLevel.enabled ? this.parentLevel.label : void 0; + } + get primaryTick() { + return this.parentLevel.enabled ? this.parentLevel.tick : void 0; + } + processData() { + super.processData(); + const { boundSeries, direction } = this; + this.minimumTimeGranularity = minimumTimeAxisDatumGranularity(boundSeries, direction, void 0, void 0); + } + tickFormatParams(domain, ticks, _fractionDigits, timeInterval) { + timeInterval ?? (timeInterval = lowestGranularityUnitForTicks(ticks)); + const truncateDate = dateTruncationForDomain(domain); + const unit = intervalUnit(timeInterval); + const step = intervalStep(timeInterval); + const epoch = intervalEpoch(timeInterval); + return { type: "date", unit, step, epoch, truncateDate }; + } + datumFormatParams(value, params, _fractionDigits, timeInterval, style) { + if (typeof value === "number") + value = new Date(value); + if (timeInterval == null) { + const { minimumTimeGranularity } = this; + const datumGranularity = lowestGranularityUnitForValue(value); + if (minimumTimeGranularity != null && intervalMilliseconds(minimumTimeGranularity) < intervalMilliseconds(datumGranularity)) { + timeInterval = minimumTimeGranularity; + } else { + timeInterval = datumGranularity; + } + } + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + const unit = intervalUnit(timeInterval); + const step = intervalStep(timeInterval); + const epoch = intervalEpoch(timeInterval); + return { + type: "date", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + unit, + step, + epoch, + style + }; + } +}; +OrdinalTimeAxis.className = "OrdinalTimeAxis"; +OrdinalTimeAxis.type = "ordinal-time"; +__decorateClass([ + Property6 +], OrdinalTimeAxis.prototype, "parentLevel", 2); + +// packages/ag-charts-enterprise/src/axes/ordinal/ordinalTimeAxisModule.ts +var OrdinalTimeAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "ordinal-time", + moduleFactory: (ctx) => new OrdinalTimeAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/axes/radius-category/radiusCategoryAxis.ts +var import_ag_charts_community11 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/axes/radius/radiusAxis.ts +var import_ag_charts_community10 = require("ag-charts-community"); +var import_ag_charts_core8 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/radiusCrossLine.ts +var import_ag_charts_community9 = require("ag-charts-community"); +var import_ag_charts_core7 = require("ag-charts-core"); +var { + ChartAxisDirection: ChartAxisDirection4, + Property: Property7, + validateCrossLineValue: validateCrossLineValue2, + normalizeAngle360FromDegrees, + Group: Group3, + Path: Path3, + Sector: Sector2, + RotatableText: RotatableText3 +} = import_ag_charts_community9._ModuleSupport; +var RadiusCrossLineLabel = class extends PolarCrossLineLabel { + constructor() { + super(...arguments); + this.positionAngle = void 0; + } +}; +__decorateClass([ + Property7 +], RadiusCrossLineLabel.prototype, "positionAngle", 2); +var RadiusCrossLine = class extends PolarCrossLine { + constructor() { + super(); + this.direction = ChartAxisDirection4.Radius; + this.label = new RadiusCrossLineLabel(); + this.polygonNode = new Path3(); + this.sectorNode = new Sector2(); + this.crossLineRange = new Group3(); + this.labelNode = new RotatableText3(); + this.outerRadius = 0; + this.innerRadius = 0; + this.crossLineRange.append(this.polygonNode); + this.crossLineRange.append(this.sectorNode); + this.labelGroup.append(this.labelNode); + } + update(visible) { + const { scale } = this; + if (!scale || !validateCrossLineValue2(this, scale)) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.updateRadii(); + const { innerRadius, outerRadius } = this; + visible && (visible = innerRadius >= this.axisInnerRadius && outerRadius <= this.axisOuterRadius); + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updatePolygonNode(visible); + this.updateSectorNode(visible); + this.updateLabelNode(visible); + this.assignCrossLineGroup(this.type === "range", this.crossLineRange); + } + updateRadii() { + const { range: range2, scale, type, axisInnerRadius, axisOuterRadius } = this; + if (!scale) + return { innerRadius: 0, outerRadius: 0 }; + const getRadius = (value) => axisOuterRadius + axisInnerRadius - value; + let outerRadius, innerRadius; + if (type === "line") { + outerRadius = getRadius(scale.convert(this.value)); + innerRadius = outerRadius; + } else { + const bandwidth = Math.abs(scale?.bandwidth ?? 0); + const convertedRange = range2.map((r) => scale.convert(r)); + outerRadius = getRadius(Math.max(...convertedRange)); + innerRadius = getRadius(Math.min(...convertedRange)) + bandwidth; + } + this.outerRadius = outerRadius; + this.innerRadius = innerRadius; + } + drawPolygon(radius, angles, polygon) { + for (const [index, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + if (index === 0) { + polygon.path.moveTo(x, y); + } else { + polygon.path.lineTo(x, y); + } + } + polygon.path.closePath(); + } + updatePolygonNode(visible) { + const { gridAngles, polygonNode: polygon, scale, shape, type, innerRadius, outerRadius } = this; + if (!visible || shape !== "polygon" || !scale || !gridAngles) { + polygon.visible = false; + return; + } + polygon.visible = true; + const padding = this.getPadding(); + polygon.path.clear(true); + this.drawPolygon(outerRadius - padding, gridAngles, polygon); + const reversedAngles = gridAngles.slice().reverse(); + const innerPolygonRadius = type === "line" ? outerRadius - padding : innerRadius + padding; + this.drawPolygon(innerPolygonRadius, reversedAngles, polygon); + this.setSectorNodeProps(polygon); + } + updateSectorNode(visible) { + const { axisInnerRadius, axisOuterRadius, scale, sectorNode: sector, shape, innerRadius, outerRadius } = this; + if (!visible || shape !== "circle" || !scale) { + sector.visible = false; + return; + } + sector.visible = true; + sector.startAngle = 0; + sector.endAngle = 2 * Math.PI; + const padding = this.getPadding(); + const r0 = (0, import_ag_charts_core7.clamp)(axisInnerRadius, innerRadius + padding, axisOuterRadius); + const r1 = (0, import_ag_charts_core7.clamp)(axisInnerRadius, outerRadius - padding, axisOuterRadius); + sector.innerRadius = Math.min(r0, r1); + sector.outerRadius = Math.max(r0, r1); + this.setSectorNodeProps(sector); + } + updateLabelNode(visible) { + const { innerRadius, label, labelNode: node, scale, shape, type } = this; + if (!visible || label.enabled === false || !label.text || !scale) { + node.visible = false; + return; + } + const angle = normalizeAngle360FromDegrees((label.positionAngle ?? 0) - 90); + const isBottomSide = ((0, import_ag_charts_core7.isNumberEqual)(angle, 0) || angle > 0) && angle < Math.PI; + const rotation = isBottomSide ? angle - Math.PI / 2 : angle + Math.PI / 2; + let distance; + const angles = this.gridAngles ?? []; + if (type === "line") { + distance = innerRadius + label.padding; + } else if (shape === "circle" || angles.length < 3) { + distance = innerRadius - label.padding; + } else { + distance = innerRadius * Math.cos(Math.PI / angles.length) - label.padding; + } + const labelX = distance * Math.cos(angle); + const labelY = distance * Math.sin(angle); + let textBaseline; + if (type === "line") { + textBaseline = isBottomSide ? "top" : "bottom"; + } else { + textBaseline = isBottomSide ? "bottom" : "top"; + } + this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation); + } + getPadding() { + const { scale } = this; + if (!scale) + return 0; + const bandwidth = Math.abs(scale.bandwidth ?? 0); + const step = Math.abs(scale.step ?? 0); + return scale instanceof import_ag_charts_community9._ModuleSupport.BandScale ? (step - bandwidth) / 2 : 0; + } +}; +RadiusCrossLine.className = "RadiusCrossLine"; + +// packages/ag-charts-enterprise/src/axes/radius/radiusAxis.ts +var { + ChartAxisDirection: ChartAxisDirection5, + ZIndexMap, + Property: Property8, + normalizeAngle360: normalizeAngle3603, + toRadians: toRadians2, + Caption, + Group: Group4, + TransformableGroup, + Path: Path4, + Line: Line2, + Selection: Selection2, + generateTicks, + AxisGroupZIndexMap +} = import_ag_charts_community10._ModuleSupport; +var RadiusAxisLabel = class extends import_ag_charts_community10._ModuleSupport.AxisLabel { + constructor() { + super(...arguments); + this.autoRotateAngle = 335; + } +}; +__decorateClass([ + Property8 +], RadiusAxisLabel.prototype, "autoRotate", 2); +__decorateClass([ + Property8 +], RadiusAxisLabel.prototype, "autoRotateAngle", 2); +var RadiusAxis = class extends import_ag_charts_community10._ModuleSupport.PolarAxis { + constructor(moduleCtx, scale) { + super(moduleCtx, scale); + this.positionAngle = 0; + this.gridLineGroupSelection = Selection2.select( + this.gridLineGroup, + Line2, + false + ); + this.generatedTicks = void 0; + this.headingLabelGroup = this.axisGroup.appendChild( + new TransformableGroup({ name: `${this.id}-Axis-heading` }) + ); + this.lineNodeGroup = this.axisGroup.appendChild( + new TransformableGroup({ name: `${this.id}-Axis-line` }) + ); + this.lineNode = this.lineNodeGroup.appendChild( + new Line2({ + name: `${this.id}-Axis-line`, + zIndex: AxisGroupZIndexMap.AxisLine + }) + ); + this.gridPathGroup = this.gridGroup.appendChild( + new Group4({ + name: `${this.id}-gridPaths`, + zIndex: ZIndexMap.AXIS_GRID + }) + ); + this.gridPathSelection = Selection2.select(this.gridPathGroup, Path4); + this.headingLabelGroup.appendChild(this.title.caption.node); + this.cleanup.register(this.title.caption.registerInteraction(this.moduleCtx, "afterend")); + } + get direction() { + return ChartAxisDirection5.Radius; + } + getAxisTransform() { + const maxRadius = this.scale.range[0]; + const { translation, positionAngle, innerRadiusRatio } = this; + const innerRadius = maxRadius * innerRadiusRatio; + const rotation = toRadians2(positionAngle); + return { + translationX: translation.x, + translationY: translation.y - maxRadius - innerRadius, + rotation, + rotationCenterX: 0, + rotationCenterY: maxRadius + innerRadius + }; + } + update() { + super.update(); + this.updateTitle(); + this.updateGridLines(); + const { enabled, stroke: stroke2, width } = this.line; + this.lineNode.setProperties({ + stroke: stroke2, + strokeWidth: enabled ? width : 0, + x1: 0, + y1: this.range[0], + x2: 0, + y2: this.range[1] + }); + } + updatePosition() { + super.updatePosition(); + const axisTransform = this.getAxisTransform(); + this.tickLineGroup.setProperties(axisTransform); + this.tickLabelGroup.setProperties(axisTransform); + this.lineNodeGroup.setProperties(axisTransform); + this.headingLabelGroup.setProperties(axisTransform); + } + calculateRotations() { + const rotation = 0; + const parallelFlipRotation = 0; + const regularFlipRotation = -Math.PI / 2; + return { rotation, parallelFlipRotation, regularFlipRotation }; + } + calculateTickLayout(domain, niceMode, _visibleRange) { + const visibleRange = [0, 1]; + const sideFlag = this.label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + this.label.spacing + this.seriesAreaPadding); + const { range: range2, reverse, defaultTickMinSpacing } = this; + const tickGenerationResult = generateTicks({ + scale: this.scale, + label: this.label, + interval: this.interval, + tickFormatter: (...args) => this.tickFormatter(...args), + domain, + range: range2, + reverse, + niceMode, + visibleRange, + defaultTickMinSpacing, + labelOffset: labelX, + sideFlag, + axisRotation: 0, + sizeLimit: void 0, + primaryTickCount: void 0 + }); + const { tickData } = tickGenerationResult; + const { ticks, rawTicks, rawTickCount, tickDomain, fractionDigits, niceDomain = domain } = tickData; + const labels = ticks.map((d) => this.getTickLabelProps(d, tickGenerationResult)); + this.generatedTicks = { ticks, labels }; + return { ticks: rawTicks, tickDomain, niceDomain, rawTickCount, fractionDigits, timeInterval: void 0 }; + } + updateSelections() { + const { generatedTicks } = this; + if (!generatedTicks) + return; + const { ticks, labels } = generatedTicks; + this.gridLineGroupSelection.update(this.gridLength ? ticks : []); + this.tickLabelGroupSelection.update(labels); + this.gridPathSelection.update(this.gridLine.enabled ? this.prepareGridPathTickData(ticks) : []); + this.gridLineGroupSelection.cleanup(); + this.tickLabelGroupSelection.cleanup(); + this.gridPathSelection.cleanup(); + } + // TODO - abstract out + updateLabels() { + if (!this.label.enabled) + return; + const axisLabelPositionFn = import_ag_charts_community10._ModuleSupport.resetAxisLabelSelectionFn(); + this.tickLabelGroupSelection.each((node, datum) => { + node.fill = datum.color; + node.text = datum.text; + node.textBaseline = datum.textBaseline; + node.textAlign = datum.textAlign ?? "center"; + node.setFont(datum); + node.setBoxing(datum); + node.setProperties(axisLabelPositionFn(node, datum)); + }); + } + updateGridLines() { + const { + gridLine: { style, width }, + shape, + generatedTicks + } = this; + if (!style || !generatedTicks) { + return; + } + const styleCount = style.length; + const setStyle = (node, index) => { + const { stroke: stroke2, lineDash } = style[index % styleCount]; + node.stroke = stroke2; + node.strokeWidth = width; + node.lineDash = lineDash; + node.fill = void 0; + }; + const [startAngle, endAngle] = this.gridRange ?? [0, 2 * Math.PI]; + const isFullCircle = (0, import_ag_charts_core8.isNumberEqual)(endAngle - startAngle, 2 * Math.PI); + const drawCircleShape = (node, value) => { + const { path } = node; + path.clear(true); + const radius = this.getTickRadius(value); + if (isFullCircle) { + path.moveTo(radius, 0); + path.arc(0, 0, radius, 0, 2 * Math.PI); + } else { + path.moveTo(radius * Math.cos(startAngle), radius * Math.sin(startAngle)); + path.arc(0, 0, radius, normalizeAngle3603(startAngle), normalizeAngle3603(endAngle)); + } + if (isFullCircle) { + path.closePath(); + } + }; + const drawPolygonShape = (node, value) => { + const { path } = node; + const angles = this.gridAngles; + path.clear(true); + if (!angles || angles.length < 3) { + return; + } + const radius = this.getTickRadius(value); + for (const [idx, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + if (idx === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + for (const [innerIdx, innerAngle] of angles.entries()) { + const x2 = radius * Math.cos(innerAngle); + const y2 = radius * Math.sin(innerAngle); + if (innerIdx === 0) { + path.moveTo(x2, y2); + } else { + path.lineTo(x2, y2); + } + } + path.closePath(); + } + path.closePath(); + }; + const drawFn = shape === "circle" ? drawCircleShape : drawPolygonShape; + this.gridPathSelection.each((node, value, index) => { + setStyle(node, index); + drawFn(node, value); + }); + } + updateTitle() { + const identityFormatter = (params) => params.defaultValue; + const { title, range: requestedRange } = this; + const { formatter = identityFormatter } = this.title; + title.caption.enabled = title.enabled; + title.caption.fontFamily = title.fontFamily; + title.caption.fontSize = title.fontSize; + title.caption.fontStyle = title.fontStyle; + title.caption.fontWeight = title.fontWeight; + title.caption.color = title.color; + title.caption.wrapping = title.wrapping; + let titleVisible = false; + const titleNode = title.caption.node; + if (title.enabled) { + titleVisible = true; + titleNode.rotation = Math.PI / 2; + titleNode.x = Math.floor((requestedRange[0] + requestedRange[1]) / 2); + titleNode.y = -Caption.SMALL_PADDING; + titleNode.textAlign = "center"; + titleNode.textBaseline = "bottom"; + titleNode.text = this.cachedCallWithContext(formatter, this.getTitleFormatterParams(this.scale.domain)); + } + titleNode.visible = titleVisible; + } + updateCrossLines() { + for (const crossLine of this.crossLines) { + if (crossLine instanceof RadiusCrossLine) { + const { shape, gridAngles, range: range2, innerRadiusRatio } = this; + const radius = range2[0]; + crossLine.shape = shape; + crossLine.gridAngles = gridAngles; + crossLine.axisOuterRadius = radius; + crossLine.axisInnerRadius = radius * innerRadiusRatio; + } + } + super.updateCrossLines(); + } + createLabel() { + return new RadiusAxisLabel(); + } + // TODO - abstract out (shared with cartesian axis) + getTickLabelProps(datum, tickGenerationResult) { + const { label } = this; + const { rotation, textBaseline, textAlign } = tickGenerationResult; + const range2 = this.scale.range; + const text2 = datum.tickLabel ?? ""; + const sideFlag = label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + label.spacing + this.seriesAreaPadding); + const visible = text2 !== "" && text2 != null; + const combinedRotation = rotation; + return { + ...this.getLabelStyles({ value: datum.tick, formattedValue: datum.tickLabel }), + tickId: datum.tickId, + rotation: combinedRotation, + text: text2, + textAlign, + textBaseline, + visible, + x: labelX, + y: datum.translation, + rotationCenterX: labelX, + rotationCenterY: datum.translation, + range: range2 + }; + } +}; +RadiusAxis.CrossLineConstructor = RadiusCrossLine; +__decorateClass([ + Property8 +], RadiusAxis.prototype, "positionAngle", 2); + +// packages/ag-charts-enterprise/src/axes/radius-category/radiusCategoryAxis.ts +var { ProxyPropertyOnWrite, Property: Property9, CategoryScale: CategoryScale2 } = import_ag_charts_community11._ModuleSupport; +var RadiusCategoryAxis = class extends RadiusAxis { + constructor(moduleCtx) { + super(moduleCtx, new CategoryScale2()); + this.shape = "circle"; + this.groupPaddingInner = 0; + this.paddingInner = 0; + this.paddingOuter = 0; + } + hasDefinedDomain() { + return false; + } + normaliseDataDomain(domain) { + return { domain, clipped: false }; + } + prepareGridPathTickData(data) { + return data.slice().reverse(); + } + getTickRadius(tickDatum) { + const { scale, innerRadiusRatio } = this; + const maxRadius = scale.range[0]; + const minRadius = maxRadius * innerRadiusRatio; + if (CategoryScale2.is(scale)) { + const ticks = scale.domain; + const index = ticks.length - 1 - ticks.indexOf(tickDatum.tick); + return index === 0 ? minRadius : scale.inset + scale.step * (index - 0.5) + scale.bandwidth / 2; + } else { + const tickRange = (maxRadius - minRadius) / scale.domain.length; + return maxRadius - tickDatum.translation + minRadius - tickRange / 2; + } + } + tickFormatParams() { + return { type: "category" }; + } + datumFormatParams(value, params) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +RadiusCategoryAxis.className = "RadiusCategoryAxis"; +RadiusCategoryAxis.type = "radius-category"; +__decorateClass([ + Property9 +], RadiusCategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass([ + ProxyPropertyOnWrite("scale", "paddingInner"), + Property9 +], RadiusCategoryAxis.prototype, "paddingInner", 2); +__decorateClass([ + ProxyPropertyOnWrite("scale", "paddingOuter"), + Property9 +], RadiusCategoryAxis.prototype, "paddingOuter", 2); + +// packages/ag-charts-enterprise/src/axes/radius-category/radiusCategoryAxisModule.ts +var RadiusCategoryAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radius-category", + moduleFactory: (ctx) => new RadiusCategoryAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/axes/radius-number/radiusNumberAxis.ts +var import_ag_charts_community12 = require("ag-charts-community"); +var { Property: Property10, normalisedExtentWithMetadata: normalisedExtentWithMetadata2, LinearScale: LinearScale2 } = import_ag_charts_community12._ModuleSupport; +var RadiusNumberAxis = class extends RadiusAxis { + constructor(moduleCtx) { + super(moduleCtx, new LinearScale2()); + this.shape = "polygon"; + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + prepareGridPathTickData(data) { + const { scale } = this; + const domainTop = scale.domain[1]; + return data.filter(({ tick }) => tick !== domainTop).sort((a, b) => b.tick - a.tick); + } + getTickRadius(tickDatum) { + const { scale } = this; + const maxRadius = scale.range[0]; + const minRadius = maxRadius * this.innerRadiusRatio; + return maxRadius - tickDatum.translation + minRadius; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata2(d, min, max); + return { domain: extent3, clipped }; + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +RadiusNumberAxis.className = "RadiusNumberAxis"; +RadiusNumberAxis.type = "radius-number"; +__decorateClass([ + Property10 +], RadiusNumberAxis.prototype, "min", 2); +__decorateClass([ + Property10 +], RadiusNumberAxis.prototype, "max", 2); + +// packages/ag-charts-enterprise/src/axes/radius-number/radiusNumberAxisModule.ts +var RadiusNumberAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radius-number", + moduleFactory: (ctx) => new RadiusNumberAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/features/animation/animation.ts +var import_ag_charts_community13 = require("ag-charts-community"); +var { ObserveChanges, Property: Property11 } = import_ag_charts_community13._ModuleSupport; +var Animation = class extends import_ag_charts_community13._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + ctx.animationManager.skip(false); + this.cleanup.register(() => { + ctx.animationManager.skip(true); + }); + } +}; +__decorateClass([ + ObserveChanges((target, newValue) => { + target.ctx.animationManager.skip(!newValue); + }), + Property11 +], Animation.prototype, "enabled", 2); +__decorateClass([ + ObserveChanges((target, newValue) => { + target.ctx.animationManager.defaultDuration = newValue; + }), + Property11 +], Animation.prototype, "duration", 2); +__decorateClass([ + ObserveChanges((target, newValue) => { + target.ctx.animationManager.maxAnimatableItems = newValue ?? Infinity; + }), + Property11 +], Animation.prototype, "maxAnimatableItems", 2); + +// packages/ag-charts-enterprise/src/features/animation/animationModule.ts +var AnimationModule = { + type: "root", + optionsKey: "animation", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Animation(ctx), + themeTemplate: { + animation: { + enabled: true, + maxAnimatableItems: 1e3 + } + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotations.ts +var import_ag_charts_community88 = require("ag-charts-community"); +var import_ag_charts_core43 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/text-input/textInput.ts +var import_ag_charts_community14 = require("ag-charts-community"); +var import_ag_charts_core9 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/text-input/textInputTemplate.html +var textInputTemplate_default = '
'; + +// packages/ag-charts-enterprise/src/features/text-input/textInput.ts +var { focusCursorAtEnd } = import_ag_charts_community14._ModuleSupport; +var moduleId = "text-input"; +var canvasOverlay = "canvas-overlay"; +var TextInput = class extends import_ag_charts_community14._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.layout = { + getTextInputCoords: () => ({ x: 0, y: 0 }), + getTextPosition: () => "center", + alignment: "center", + textAlign: "center" + }; + this.visible = false; + this.element = ctx.domManager.addChild(canvasOverlay, moduleId); + this.element.classList.add("ag-charts-text-input"); + this.cleanup.register(() => ctx.domManager.removeChild(canvasOverlay, moduleId)); + } + setKeyDownHandler(handler) { + this.cleanup.register((0, import_ag_charts_core9.attachListener)(this.element, "keydown", handler)); + } + show(opts) { + this.element.innerHTML = textInputTemplate_default; + const textArea = this.element.firstElementChild; + (0, import_ag_charts_core9.setAttributes)(textArea, { + role: "textbox", + // AG-15233 + "data-preventdefault": false + // AG-13715 + }); + if (!textArea.isContentEditable) { + textArea.contentEditable = "true"; + } + textArea.setAttribute( + "placeholder", + this.ctx.localeManager.t(opts.placeholderText ?? "inputTextareaPlaceholder") + ); + if (opts.styles?.placeholderColor) { + textArea.style.setProperty("--placeholder-text-color", opts.styles?.placeholderColor); + } + textArea.innerText = opts.text ?? ""; + textArea.style.color = opts.styles?.color ?? "inherit"; + textArea.style.fontFamily = opts.styles?.fontFamily ?? "inherit"; + textArea.style.fontSize = opts.styles?.fontSize ? `${opts.styles.fontSize}px` : "inherit"; + textArea.style.fontStyle = opts.styles?.fontStyle ?? "inherit"; + textArea.style.fontWeight = typeof opts.styles?.fontWeight === "number" ? `${opts.styles.fontWeight}` : opts.styles?.fontWeight ?? "inherit"; + focusCursorAtEnd(textArea); + textArea.addEventListener("input", () => { + this.updatePosition(); + opts.onChange?.(this.getValue(), this.getBBox()); + }); + textArea.addEventListener("click", (event) => { + event.stopPropagation(); + }); + if (opts.layout) { + this.layout = opts.layout; + this.updatePosition(); + } + opts.onChange?.(this.getValue(), this.getBBox()); + this.visible = true; + } + hide() { + this.element.innerHTML = ""; + this.layout = { + getTextInputCoords: () => ({ x: 0, y: 0 }), + getTextPosition: () => "center", + alignment: "center", + textAlign: "center" + }; + this.visible = false; + } + isVisible() { + return this.visible; + } + updateColor(color6) { + if (!this.element.firstElementChild) + return; + this.element.firstElementChild.style.color = color6; + } + updateFontSize(fontSize) { + if (!this.element.firstElementChild) + return; + this.element.firstElementChild.style.fontSize = `${fontSize}px`; + this.updatePosition(); + return this.getBBox(); + } + getValue() { + if (!this.element.firstElementChild) + return; + return this.element.firstElementChild.innerText.trim(); + } + updatePosition() { + const { element } = this; + const textArea = element.firstElementChild; + if (!textArea) + return; + const sceneRect = this.ctx.domManager.getBoundingClientRect(); + const { width, getTextInputCoords, getTextPosition, alignment, textAlign } = this.layout; + element.style.setProperty("width", width ? `${width}px` : "unset"); + const textRect = textArea.getBoundingClientRect(); + const point = getTextInputCoords(textRect.height); + let horizontalPosition = point.x; + if (alignment === "center") { + horizontalPosition -= (width ?? textRect.width) / 2; + } else if (alignment === "right") { + horizontalPosition -= width ?? textRect.width; + } + const position = getTextPosition(); + let verticalPosition = point.y; + if (position === "center") { + verticalPosition -= textRect.height / 2; + } else if (position === "bottom") { + verticalPosition -= textRect.height; + } + element.style.setProperty("top", `${verticalPosition}px`); + element.style.setProperty("left", `${horizontalPosition}px`); + element.style.setProperty("max-width", `${sceneRect.width - horizontalPosition}px`); + element.style.setProperty("text-align", alignment); + textArea.style.setProperty("text-align", textAlign); + } + getBBox() { + const { left, top, width, height } = this.element.getBoundingClientRect(); + return new import_ag_charts_community14._ModuleSupport.BBox(left, top, width, height); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotationAxesButtons.ts +var import_ag_charts_community15 = require("ag-charts-community"); +var { BaseProperties: BaseProperties2, Property: Property12 } = import_ag_charts_community15._ModuleSupport; +var AxesButtons = class extends BaseProperties2 { + constructor() { + super(...arguments); + this.enabled = false; + this.axes = "y"; + } +}; +__decorateClass([ + Property12 +], AxesButtons.prototype, "enabled", 2); +__decorateClass([ + Property12 +], AxesButtons.prototype, "axes", 2); + +// packages/ag-charts-enterprise/src/features/annotations/annotationDefaults.ts +var import_ag_charts_community35 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/annotationTypes.ts +var AnnotationType = /* @__PURE__ */ ((AnnotationType3) => { + AnnotationType3["Line"] = "line"; + AnnotationType3["HorizontalLine"] = "horizontal-line"; + AnnotationType3["VerticalLine"] = "vertical-line"; + AnnotationType3["DisjointChannel"] = "disjoint-channel"; + AnnotationType3["ParallelChannel"] = "parallel-channel"; + AnnotationType3["FibonacciRetracement"] = "fibonacci-retracement"; + AnnotationType3["FibonacciRetracementTrendBased"] = "fibonacci-retracement-trend-based"; + AnnotationType3["Callout"] = "callout"; + AnnotationType3["Comment"] = "comment"; + AnnotationType3["Note"] = "note"; + AnnotationType3["Text"] = "text"; + AnnotationType3["Arrow"] = "arrow"; + AnnotationType3["ArrowUp"] = "arrow-up"; + AnnotationType3["ArrowDown"] = "arrow-down"; + AnnotationType3["DateRange"] = "date-range"; + AnnotationType3["PriceRange"] = "price-range"; + AnnotationType3["DatePriceRange"] = "date-price-range"; + AnnotationType3["QuickDatePriceRange"] = "quick-date-price-range"; + return AnnotationType3; +})(AnnotationType || {}); +var ANNOTATION_TYPES = Object.values(AnnotationType); +function stringToAnnotationType(value) { + for (const t of ANNOTATION_TYPES) { + if (t === value) + return t; + } +} + +// packages/ag-charts-enterprise/src/features/annotations/utils/has.ts +var import_ag_charts_core24 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutProperties.ts +var import_ag_charts_community19 = require("ag-charts-community"); +var import_ag_charts_core12 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/annotationProperties.ts +var import_ag_charts_community16 = require("ag-charts-community"); +var import_ag_charts_core10 = require("ag-charts-core"); +var { BaseProperties: BaseProperties3, FONT_SIZE: FONT_SIZE2, Property: Property13 } = import_ag_charts_community16._ModuleSupport; +var PointProperties = class extends BaseProperties3 { +}; +__decorateClass([ + Property13 +], PointProperties.prototype, "x", 2); +__decorateClass([ + Property13 +], PointProperties.prototype, "y", 2); +var ChannelAnnotationMiddleProperties = class extends Stroke(LineStyle(Visible(BaseProperties3))) { +}; +var AxisLabelProperties = class extends Stroke(LineStyle(Fill(Label(Font(BaseProperties3))))) { + constructor() { + super(...arguments); + this.cornerRadius = 2; + } +}; +__decorateClass([ + Property13 +], AxisLabelProperties.prototype, "enabled", 2); +__decorateClass([ + Property13 +], AxisLabelProperties.prototype, "cornerRadius", 2); +var BackgroundProperties = class extends Fill(BaseProperties3) { +}; +var HandleProperties = class extends Stroke(LineStyle(Fill(BaseProperties3))) { +}; +var LineTextProperties = class extends Font(BaseProperties3) { + constructor() { + super(...arguments); + this.label = ""; + this.position = "top"; + this.alignment = "left"; + } +}; +__decorateClass([ + Property13 +], LineTextProperties.prototype, "label", 2); +__decorateClass([ + Property13 +], LineTextProperties.prototype, "position", 2); +__decorateClass([ + Property13 +], LineTextProperties.prototype, "alignment", 2); +var LabelTextProperties = class extends Font(BaseProperties3) { +}; +var ChannelTextProperties = class extends Font(BaseProperties3) { + constructor() { + super(...arguments); + this.label = ""; + } +}; +__decorateClass([ + Property13 +], ChannelTextProperties.prototype, "label", 2); +__decorateClass([ + Property13 +], ChannelTextProperties.prototype, "position", 2); +__decorateClass([ + Property13 +], ChannelTextProperties.prototype, "alignment", 2); +function Annotation(Parent) { + class AnnotationInternal extends Writeable(Visible(Parent)) { + constructor() { + super(...arguments); + // A uuid is required, over the usual incrementing index, as annotations can be restored from external databases + this.id = (0, import_ag_charts_core10.generateUUID)(); + } + } + return AnnotationInternal; +} +function Line3(Parent) { + class LineInternal extends Parent { + constructor() { + super(...arguments); + this.start = new PointProperties(); + this.end = new PointProperties(); + } + } + __decorateClass([ + Property13 + ], LineInternal.prototype, "start", 2); + __decorateClass([ + Property13 + ], LineInternal.prototype, "end", 2); + return LineInternal; +} +function Point(Parent) { + class PointInternal extends Parent { + } + __decorateClass([ + Property13 + ], PointInternal.prototype, "x", 2); + __decorateClass([ + Property13 + ], PointInternal.prototype, "y", 2); + return PointInternal; +} +function Value(Parent) { + class ValueInternal extends Parent { + } + __decorateClass([ + Property13 + ], ValueInternal.prototype, "value", 2); + return ValueInternal; +} +function Background(Parent) { + class BackgroundInternal extends Parent { + constructor() { + super(...arguments); + this.background = new BackgroundProperties(); + } + } + __decorateClass([ + Property13 + ], BackgroundInternal.prototype, "background", 2); + return BackgroundInternal; +} +function Handle(Parent) { + class HandleInternal extends Parent { + constructor() { + super(...arguments); + this.handle = new HandleProperties(); + } + } + __decorateClass([ + Property13 + ], HandleInternal.prototype, "handle", 2); + return HandleInternal; +} +function AxisLabel(Parent) { + class AxisLabelInternal extends Parent { + constructor() { + super(...arguments); + this.axisLabel = new AxisLabelProperties(); + } + } + __decorateClass([ + Property13 + ], AxisLabelInternal.prototype, "axisLabel", 2); + return AxisLabelInternal; +} +function Label(Parent) { + class LabelInternal extends Parent { + constructor() { + super(...arguments); + this.padding = void 0; + this.textAlign = "center"; + this.formatter = void 0; + } + // TODO: making this generic causes issues with mixins sequence + } + __decorateClass([ + Property13 + ], LabelInternal.prototype, "padding", 2); + __decorateClass([ + Property13 + ], LabelInternal.prototype, "textAlign", 2); + __decorateClass([ + Property13 + ], LabelInternal.prototype, "formatter", 2); + return LabelInternal; +} +function Cappable(Parent) { + class CappableInternal extends Parent { + } + return CappableInternal; +} +function Extendable(Parent) { + class ExtendableInternal extends Parent { + } + __decorateClass([ + Property13 + ], ExtendableInternal.prototype, "extendStart", 2); + __decorateClass([ + Property13 + ], ExtendableInternal.prototype, "extendEnd", 2); + return ExtendableInternal; +} +function Writeable(Parent) { + class WriteableInternal extends Parent { + isWriteable() { + return !this.locked && !this.readOnly; + } + isHoverable() { + return !this.readOnly; + } + } + __decorateClass([ + Property13 + ], WriteableInternal.prototype, "locked", 2); + __decorateClass([ + Property13 + ], WriteableInternal.prototype, "readOnly", 2); + return WriteableInternal; +} +function Localisable(Parent) { + class LocalisableInternal extends Parent { + setLocaleManager(localeManager) { + this.localeManager ?? (this.localeManager = localeManager); + } + } + return LocalisableInternal; +} +function Visible(Parent) { + class VisibleInternal extends Parent { + } + __decorateClass([ + Property13 + ], VisibleInternal.prototype, "visible", 2); + return VisibleInternal; +} +function Fill(Parent) { + class FillInternal extends Parent { + } + __decorateClass([ + Property13 + ], FillInternal.prototype, "fill", 2); + __decorateClass([ + Property13 + ], FillInternal.prototype, "fillOpacity", 2); + return FillInternal; +} +function Stroke(Parent) { + class StrokeInternal extends Parent { + } + __decorateClass([ + Property13 + ], StrokeInternal.prototype, "stroke", 2); + __decorateClass([ + Property13 + ], StrokeInternal.prototype, "strokeOpacity", 2); + __decorateClass([ + Property13 + ], StrokeInternal.prototype, "strokeWidth", 2); + return StrokeInternal; +} +function LineStyle(Parent) { + class LineDashInternal extends Parent { + constructor() { + super(...arguments); + this.lineCap = void 0; + this.computedLineDash = void 0; + } + } + __decorateClass([ + Property13 + ], LineDashInternal.prototype, "lineDash", 2); + __decorateClass([ + Property13 + ], LineDashInternal.prototype, "lineDashOffset", 2); + __decorateClass([ + Property13 + ], LineDashInternal.prototype, "lineStyle", 2); + return LineDashInternal; +} +function Font(Parent) { + class FontInternal extends Parent { + constructor() { + super(...arguments); + this.fontSize = FONT_SIZE2.SMALL; + this.fontFamily = "Verdana, sans-serif"; + } + } + __decorateClass([ + Property13 + ], FontInternal.prototype, "fontStyle", 2); + __decorateClass([ + Property13 + ], FontInternal.prototype, "fontWeight", 2); + __decorateClass([ + Property13 + ], FontInternal.prototype, "fontSize", 2); + __decorateClass([ + Property13 + ], FontInternal.prototype, "fontFamily", 2); + __decorateClass([ + Property13 + ], FontInternal.prototype, "color", 2); + return FontInternal; +} + +// packages/ag-charts-enterprise/src/features/annotations/properties/textualStartEndProperties.ts +var import_ag_charts_community18 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/utils/scale.ts +var import_ag_charts_core11 = require("ag-charts-core"); +function getGrouping(d) { + if ((0, import_ag_charts_core11.isNumber)(d) || (0, import_ag_charts_core11.isString)(d) || (0, import_ag_charts_core11.isDate)(d)) { + return { value: d, groupPercentage: 0 }; + } + return d ?? { value: void 0, groupPercentage: 0 }; +} +function getGroupingValue(d) { + return getGrouping(d)?.value; +} + +// packages/ag-charts-enterprise/src/features/annotations/utils/values.ts +function convertLine(datum, context) { + if (datum.start == null || datum.end == null) + return; + const start = convertPoint(datum.start, context); + const end = convertPoint(datum.end, context); + if (start == null || end == null) + return; + return { x1: start.x, y1: start.y, x2: end.x, y2: end.y }; +} +function convertPoint(point, context) { + const x = convert(point.x, context.xAxis); + const y = convert(point.y, context.yAxis); + return { x, y }; +} +function convert(p, context) { + if (p == null) + return 0; + const { value, groupPercentage } = getGrouping(p); + const { scale, snapToGroup } = context; + const width = scale.bandwidth === 0 ? scale.step ?? 0 : scale.bandwidth ?? 0; + const offset = snapToGroup ? width / 2 : width * groupPercentage; + return scale.convert(value) + offset; +} +function invertCoords(coords, context) { + const x = invert(coords.x, context.xAxis); + const y = invert(coords.y, context.yAxis); + return { x, y }; +} +function invert(n, context) { + const { scale } = context; + if (context.continuous && scale.step == null) { + return context.scaleInvert(n); + } + const value = context.scaleInvertNearest(n); + const width = scale.bandwidth === 0 ? scale.step : scale.bandwidth ?? 0; + const bandStart = scale.convert(value); + const bandEnd = bandStart + width; + const groupPercentage = bandStart === bandEnd ? 0 : (n - bandStart) / (bandEnd - bandStart); + return { value, groupPercentage }; +} + +// packages/ag-charts-enterprise/src/features/annotations/properties/startEndProperties.ts +var import_ag_charts_community17 = require("ag-charts-community"); +var { BaseProperties: BaseProperties4 } = import_ag_charts_community17._ModuleSupport; +var StartEndProperties = class extends Annotation(Line3(Handle(BaseProperties4))) { + constructor() { + super(...arguments); + this.snapToAngle = 45; + } + getDefaultColor(_colorPickerType) { + return void 0; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/properties/textualStartEndProperties.ts +var { Property: Property14 } = import_ag_charts_community18._ModuleSupport; +var TextualStartEndProperties = class extends Localisable(Label(Font(StartEndProperties))) { + constructor() { + super(...arguments); + this.text = ""; + this.position = "top"; + this.alignment = "left"; + this.placement = "inside"; + this.placeholderText = "inputTextareaPlaceholder"; + } + getDefaultColor(_colorPickerType) { + return this.color; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } + getPlaceholderColor() { + return void 0; + } + getPadding() { + const { padding = 0 } = this; + return { + top: padding, + right: padding, + bottom: padding, + left: padding + }; + } + getText() { + const isPlaceholder = this.text.length == 0; + let text2 = this.text; + if (isPlaceholder) { + text2 = this.placeholderText ?? ""; + if (this.localeManager) + text2 = this.localeManager.t(text2); + } + return { + text: text2, + isPlaceholder + }; + } + getTextInputCoords(context, _height) { + return convertPoint(this.end, context); + } + getTextPosition() { + return this.position; + } +}; +__decorateClass([ + Property14 +], TextualStartEndProperties.prototype, "text", 2); + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutProperties.ts +var { Property: Property15, Color } = import_ag_charts_community19._ModuleSupport; +var DEFAULT_CALLOUT_PADDING = { + top: 6, + right: 12, + bottom: 9, + left: 12 +}; +var CalloutProperties = class extends Fill(Stroke(TextualStartEndProperties)) { + constructor() { + super(...arguments); + this.type = "callout" /* Callout */; + this.position = "bottom"; + this.alignment = "left"; + } + static is(value) { + return (0, import_ag_charts_core12.isObject)(value) && value.type === "callout" /* Callout */; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fill; + case `line-color`: + return this.stroke; + case `text-color`: + default: + return this.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fillOpacity; + case `line-color`: + return this.strokeOpacity; + case `text-color`: + default: + return void 0; + } + } + getPlaceholderColor() { + const { r, g, b } = Color.fromString(this.color ?? "#888888"); + return new Color(r, g, b, 0.66).toString(); + } + getPadding() { + const { padding } = this; + if (padding == null) { + return { ...DEFAULT_CALLOUT_PADDING }; + } + return { + top: padding, + right: padding, + bottom: padding, + left: padding + }; + } + getTextInputCoords(context, height) { + const coords = super.getTextInputCoords(context, height); + const padding = this.getPadding(); + const paddingLeft = padding.left ?? 0; + const paddingBottom = padding.bottom ?? 0; + return { + x: coords.x + paddingLeft, + y: coords.y - paddingBottom + }; + } +}; +__decorateClass([ + Property15 +], CalloutProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentProperties.ts +var import_ag_charts_community21 = require("ag-charts-community"); +var import_ag_charts_core13 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/properties/textualPointProperties.ts +var import_ag_charts_community20 = require("ag-charts-community"); +var { BaseProperties: BaseProperties5, Property: Property16 } = import_ag_charts_community20._ModuleSupport; +var TextualPointProperties = class extends Annotation(Point(Handle(Label(Font(BaseProperties5))))) { + constructor() { + super(...arguments); + this.text = ""; + this.position = "top"; + this.alignment = "left"; + this.placement = "inside"; + this.placeholderText = "inputTextareaPlaceholder"; + } + getDefaultColor(_colorPickerType) { + return this.color; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } + getPlaceholderColor() { + return void 0; + } + getPadding() { + const { padding = 0 } = this; + return { + top: padding, + right: padding, + bottom: padding, + left: padding + }; + } + getText() { + const isPlaceholder = this.text.length == 0; + const text2 = isPlaceholder ? this.placeholderText ?? "" : this.text; + return { + text: text2, + isPlaceholder + }; + } + getTextInputCoords(context, _height) { + return convertPoint(this, context); + } + getTextPosition() { + return this.position; + } +}; +__decorateClass([ + Property16 +], TextualPointProperties.prototype, "text", 2); + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentProperties.ts +var { Property: Property17, Color: Color2 } = import_ag_charts_community21._ModuleSupport; +var DEFAULT_COMMENT_PADDING = { + top: 8, + right: 14, + bottom: 8, + left: 14 +}; +var CommentProperties = class extends Fill(Stroke(TextualPointProperties)) { + constructor() { + super(...arguments); + this.type = "comment" /* Comment */; + this.position = "bottom"; + this.alignment = "left"; + } + static is(value) { + return (0, import_ag_charts_core13.isObject)(value) && value.type === "comment" /* Comment */; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fill; + case `line-color`: + return this.stroke; + case `text-color`: + default: + return this.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fillOpacity; + case `line-color`: + return this.strokeOpacity; + case `text-color`: + default: + return void 0; + } + } + getPlaceholderColor() { + const { r, g, b } = Color2.fromString(this.color ?? "#888888"); + return new Color2(r, g, b, 0.66).toString(); + } + getPadding() { + const { padding, fontSize } = this; + if (padding == null) { + return { + top: Math.max(fontSize * 0.4, DEFAULT_COMMENT_PADDING.top), + bottom: Math.max(fontSize * 0.4, DEFAULT_COMMENT_PADDING.bottom), + left: Math.max(fontSize * 0.8, DEFAULT_COMMENT_PADDING.left), + right: Math.max(fontSize * 0.8, DEFAULT_COMMENT_PADDING.right) + }; + } + return { + top: padding, + right: padding, + bottom: padding, + left: padding + }; + } + getTextInputCoords(context, height) { + const coords = super.getTextInputCoords(context, height); + const padding = this.getPadding(); + return { + x: coords.x + padding.left, + y: coords.y - padding.bottom + }; + } +}; +__decorateClass([ + Property17 +], CommentProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerProperties.ts +var import_ag_charts_community23 = require("ag-charts-community"); +var import_ag_charts_core14 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/utils/line.ts +var import_ag_charts_community22 = require("ag-charts-community"); +var { Vec2 } = import_ag_charts_community22._ModuleSupport; +function getLineStyle(lineDash, lineStyle) { + return lineDash ? "dashed" : lineStyle ?? "solid"; +} +function getComputedLineDash(strokeWidth, styleType) { + switch (styleType) { + case "solid": + return []; + case "dashed": + return [strokeWidth * 4, strokeWidth * 2]; + case "dotted": + return [0, strokeWidth * 2]; + } +} +function getLineDash(lineDash, computedLineDash, lineStyle, strokeWidth) { + const styleType = getLineStyle(lineDash, lineStyle); + return computedLineDash ?? lineDash ?? getComputedLineDash(strokeWidth ?? 1, styleType); +} +function getLineCap(lineCap, lineDash, lineStyle) { + const styleType = getLineStyle(lineDash, lineStyle); + return lineCap ?? styleType === "dotted" ? "round" : void 0; +} +function boundsIntersections(coords, bounds) { + const [p1, p2] = Vec2.from(coords); + const reflection = bounds.height; + const gradient = Vec2.gradient(p2, p1, reflection); + const intercept = Vec2.intercept(p2, gradient, reflection); + const fallback = [ + { x: p1.x, y: reflection ?? 0 }, + { x: p1.x, y: reflection == null ? bounds.height : reflection - bounds.height } + ]; + if (gradient === Infinity) { + return fallback; + } + let points = [ + Vec2.intersectAtY(gradient, intercept, 0, reflection), + Vec2.intersectAtY(gradient, intercept, bounds.height, reflection), + Vec2.intersectAtX(gradient, intercept, 0, reflection), + Vec2.intersectAtX(gradient, intercept, bounds.width, reflection) + ]; + points = points.filter((p) => p.x >= bounds.x && p.x <= bounds.width && p.y >= bounds.y && p.y <= bounds.height).sort((a, b) => { + if (a.x === b.x) + return 0; + return a.x < b.x ? -1 : 1; + }); + if (points.length !== 2) { + return fallback; + } + return points; +} + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerProperties.ts +var { BaseProperties: BaseProperties6, Property: Property18 } = import_ag_charts_community23._ModuleSupport; +var MeasurerStatisticsDivider = class extends Stroke(BaseProperties6) { +}; +var MeasurerStatistics = class extends Font(Fill(Stroke(BaseProperties6))) { + constructor() { + super(...arguments); + this.divider = new MeasurerStatisticsDivider(); + } +}; +__decorateClass([ + Property18 +], MeasurerStatistics.prototype, "divider", 2); +var MeasurerDirectionProperties = class extends Fill(Stroke(Handle(BaseProperties6))) { + constructor() { + super(...arguments); + this.statistics = new MeasurerStatistics(); + } +}; +__decorateClass([ + Property18 +], MeasurerDirectionProperties.prototype, "statistics", 2); +var MeasurerTypeProperties = class extends Localisable(Background(Stroke(LineStyle(StartEndProperties)))) { + constructor() { + super(...arguments); + this.direction = "both"; + this.hasDateRange = false; + this.hasPriceRange = false; + this.statistics = new MeasurerStatistics(); + this.getVolume = () => void 0; + this.text = new LineTextProperties(); + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fill; + case `line-color`: + return this.stroke; + case `text-color`: + return this.text.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fillOpacity; + case `line-color`: + return this.strokeOpacity; + } + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property18 +], MeasurerTypeProperties.prototype, "statistics", 2); +__decorateClass([ + Property18 +], MeasurerTypeProperties.prototype, "text", 2); +function DateRange(Parent) { + class DateRangeInternal extends Parent { + constructor() { + super(...arguments); + this.hasDateRange = true; + } + } + return DateRangeInternal; +} +function PriceRange(Parent) { + class PriceRangeInternal extends Parent { + constructor() { + super(...arguments); + this.hasPriceRange = true; + } + } + return PriceRangeInternal; +} +var DateRangeProperties = class extends DateRange(MeasurerTypeProperties) { + constructor() { + super(...arguments); + this.type = "date-range" /* DateRange */; + this.direction = "horizontal"; + } + static is(value) { + return (0, import_ag_charts_core14.isObject)(value) && value.type === "date-range" /* DateRange */; + } +}; +__decorateClass([ + Property18 +], DateRangeProperties.prototype, "type", 2); +__decorateClass([ + Property18 +], DateRangeProperties.prototype, "extendAbove", 2); +__decorateClass([ + Property18 +], DateRangeProperties.prototype, "extendBelow", 2); +var PriceRangeProperties = class extends PriceRange(MeasurerTypeProperties) { + constructor() { + super(...arguments); + this.type = "price-range" /* PriceRange */; + this.direction = "vertical"; + } + static is(value) { + return (0, import_ag_charts_core14.isObject)(value) && value.type === "price-range" /* PriceRange */; + } +}; +__decorateClass([ + Property18 +], PriceRangeProperties.prototype, "type", 2); +__decorateClass([ + Property18 +], PriceRangeProperties.prototype, "extendLeft", 2); +__decorateClass([ + Property18 +], PriceRangeProperties.prototype, "extendRight", 2); +var DatePriceRangeProperties = class extends DateRange(PriceRange(MeasurerTypeProperties)) { + constructor() { + super(...arguments); + this.type = "date-price-range" /* DatePriceRange */; + this.direction = "both"; + } + static is(value) { + return (0, import_ag_charts_core14.isObject)(value) && value.type === "date-price-range" /* DatePriceRange */; + } +}; +__decorateClass([ + Property18 +], DatePriceRangeProperties.prototype, "type", 2); +var QuickDatePriceRangeProperties = class extends DateRange(PriceRange(MeasurerTypeProperties)) { + constructor() { + super(...arguments); + this.type = "quick-date-price-range" /* QuickDatePriceRange */; + this.up = new MeasurerDirectionProperties(); + this.down = new MeasurerDirectionProperties(); + this.direction = "both"; + } + static is(value) { + return (0, import_ag_charts_core14.isObject)(value) && value.type === "quick-date-price-range" /* QuickDatePriceRange */; + } +}; +__decorateClass([ + Property18 +], QuickDatePriceRangeProperties.prototype, "type", 2); +__decorateClass([ + Property18 +], QuickDatePriceRangeProperties.prototype, "up", 2); +__decorateClass([ + Property18 +], QuickDatePriceRangeProperties.prototype, "down", 2); + +// packages/ag-charts-enterprise/src/features/annotations/note/noteProperties.ts +var import_ag_charts_community25 = require("ag-charts-community"); +var import_ag_charts_core16 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/text/util.ts +var import_ag_charts_community24 = require("ag-charts-community"); +var import_ag_charts_core15 = require("ag-charts-core"); +var { BBox: BBox2 } = import_ag_charts_community24._ModuleSupport; +var ANNOTATION_TEXT_LINE_HEIGHT = 1.38; +function maybeWrapText(options, text2, maxWidth) { + return maxWidth ? (0, import_ag_charts_core15.wrapText)(text2, { maxWidth, font: options, textWrap: "always", avoidOrphans: false }) : text2; +} +function measureAnnotationText(options, text2) { + const { lineMetrics, width } = (0, import_ag_charts_core15.cachedTextMeasurer)(options).measureLines(text2); + const height = lineMetrics.length * (0, import_ag_charts_core15.calcLineHeight)(options.fontSize, ANNOTATION_TEXT_LINE_HEIGHT); + return { width, height }; +} +function getBBox(options, text2, coords, bbox) { + let width = bbox?.width ?? 0; + let height = bbox?.height ?? 0; + if (!bbox) { + const wrappedText = options.width == null ? text2 : maybeWrapText(options, text2, options.width); + ({ width, height } = measureAnnotationText(options, wrappedText)); + } + return new BBox2(coords.x, coords.y, width, height); +} +function updateTextNode(node, text2, isPlaceholder, config, { x, y }, textBaseline) { + const { visible = true, fontFamily, fontSize = 14, fontStyle, fontWeight, textAlign } = config; + const lineHeight = (0, import_ag_charts_core15.calcLineHeight)(fontSize, ANNOTATION_TEXT_LINE_HEIGHT); + textBaseline ?? (textBaseline = config.position == "center" ? "middle" : config.position); + const fill = isPlaceholder ? config.getPlaceholderColor() : config.color; + node.setProperties({ + x, + y, + visible, + text: text2, + fill, + fontFamily, + fontSize, + fontStyle, + fontWeight, + textAlign, + lineHeight, + textBaseline + }); +} + +// packages/ag-charts-enterprise/src/features/annotations/note/noteProperties.ts +var { BaseProperties: BaseProperties7, Property: Property19 } = import_ag_charts_community25._ModuleSupport; +var DEFAULT_NOTE_PADDING = 10; +var HANDLE_SIZE = 11; +var ICON_HEIGHT = 20; +var ICON_WIDTH = 22; +var ICON_SPACING = 10; +var LABEL_OFFSET = ICON_HEIGHT + ICON_SPACING; +var TOOLBAR_OFFSET = 34; +var NoteBackgroundProperties = class extends Fill(Stroke(BaseProperties7)) { +}; +var NoteProperties = class extends Fill(Stroke(TextualPointProperties)) { + constructor() { + super(...arguments); + this.type = "note" /* Note */; + this.background = new NoteBackgroundProperties(); + this.position = "bottom"; + this.alignment = "center"; + this.width = 200; + } + static is(value) { + return (0, import_ag_charts_core16.isObject)(value) && value.type === "note" /* Note */; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `line-color`: + return this.fill; + case `text-color`: + return this.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `line-color`: + return this.fillOpacity; + case `text-color`: + return void 0; + } + } + getPadding() { + const padding = this.padding ?? DEFAULT_NOTE_PADDING; + return { + top: padding, + right: padding, + bottom: padding, + left: padding + }; + } + getTextInputCoords(context, height) { + const { width, text: text2 } = this; + const textInputCoords = super.getTextInputCoords(context, height); + const padding = this.getPadding().top; + const bbox = getBBox(this, text2, textInputCoords); + bbox.x = (0, import_ag_charts_core16.clamp)(width / 2, bbox.x, context.seriesRect.width - width / 2); + const topY = bbox.y - LABEL_OFFSET - padding * 2; + const bottomY = bbox.y + HANDLE_SIZE + padding * 2; + const textHeight = Math.max(bbox.height, height); + if (topY - textHeight - TOOLBAR_OFFSET < 0) { + bbox.y = bottomY; + this.position = "top"; + } else { + bbox.y = topY + padding; + this.position = "bottom"; + } + return { + x: bbox.x, + y: bbox.y + }; + } + isHoverable() { + return true; + } +}; +__decorateClass([ + Property19 +], NoteProperties.prototype, "type", 2); +__decorateClass([ + Property19 +], NoteProperties.prototype, "background", 2); + +// packages/ag-charts-enterprise/src/features/annotations/properties/pointProperties.ts +var import_ag_charts_community26 = require("ag-charts-community"); +var { BaseProperties: BaseProperties8 } = import_ag_charts_community26._ModuleSupport; +var PointProperties2 = class extends Annotation(Point(Handle(BaseProperties8))) { + getDefaultColor(_colorPickerType) { + return void 0; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/properties/shapePointProperties.ts +var ShapePointProperties = class _ShapePointProperties extends Fill(PointProperties2) { + constructor() { + super(...arguments); + this.size = 32; + } + static is(value) { + return value instanceof _ShapePointProperties; + } + getDefaultColor(colorPickerType) { + return colorPickerType === `fill-color` ? this.fill : void 0; + } + getDefaultOpacity(colorPickerType) { + return colorPickerType === `fill-color` ? this.fillOpacity : void 0; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/cross-line/crossLineProperties.ts +var import_ag_charts_community27 = require("ag-charts-community"); +var import_ag_charts_core17 = require("ag-charts-core"); +var { BaseProperties: BaseProperties9, Property: Property20 } = import_ag_charts_community27._ModuleSupport; +var HorizontalLineProperties = class extends Annotation(Value(Handle(AxisLabel(Stroke(LineStyle(BaseProperties9)))))) { + constructor() { + super(...arguments); + this.direction = "horizontal"; + this.type = "horizontal-line" /* HorizontalLine */; + this.text = new LineTextProperties(); + } + static is(value) { + return (0, import_ag_charts_core17.isObject)(value) && value.type === "horizontal-line" /* HorizontalLine */; + } + getDefaultColor() { + return this.stroke; + } + getDefaultOpacity() { + return this.strokeOpacity; + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property20 +], HorizontalLineProperties.prototype, "type", 2); +__decorateClass([ + Property20 +], HorizontalLineProperties.prototype, "text", 2); +var VerticalLineProperties = class extends Annotation(Value(Handle(AxisLabel(Stroke(LineStyle(BaseProperties9)))))) { + constructor() { + super(...arguments); + this.direction = "vertical"; + this.type = "vertical-line" /* VerticalLine */; + this.text = new LineTextProperties(); + } + static is(value) { + return (0, import_ag_charts_core17.isObject)(value) && value.type === "vertical-line" /* VerticalLine */; + } + getDefaultColor() { + return this.stroke; + } + getDefaultOpacity() { + return this.strokeOpacity; + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property20 +], VerticalLineProperties.prototype, "type", 2); +__decorateClass([ + Property20 +], VerticalLineProperties.prototype, "text", 2); + +// packages/ag-charts-enterprise/src/features/annotations/disjoint-channel/disjointChannelProperties.ts +var import_ag_charts_community28 = require("ag-charts-community"); +var import_ag_charts_core18 = require("ag-charts-core"); +var { BaseProperties: BaseProperties10, Property: Property21 } = import_ag_charts_community28._ModuleSupport; +var DisjointChannelProperties = class extends Annotation( + Background(Line3(Handle(Extendable(Stroke(LineStyle(BaseProperties10)))))) +) { + constructor() { + super(...arguments); + this.type = "disjoint-channel" /* DisjointChannel */; + this.text = new ChannelTextProperties(); + this.snapToAngle = 45; + } + static is(value) { + return (0, import_ag_charts_core18.isObject)(value) && value.type === "disjoint-channel" /* DisjointChannel */; + } + get bottom() { + const bottom = { + start: { x: this.start.x, y: this.start.y }, + end: { x: this.end.x, y: this.end.y } + }; + if (typeof bottom.start.y === "number" && typeof bottom.end.y === "number") { + bottom.start.y -= this.startHeight; + bottom.end.y -= this.endHeight; + } else { + import_ag_charts_core18.Logger.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`); + } + return bottom; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fill; + case `line-color`: + return this.stroke; + case "text-color": + return this.text.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fillOpacity; + case `line-color`: + return this.strokeOpacity; + } + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property21 +], DisjointChannelProperties.prototype, "type", 2); +__decorateClass([ + Property21 +], DisjointChannelProperties.prototype, "startHeight", 2); +__decorateClass([ + Property21 +], DisjointChannelProperties.prototype, "endHeight", 2); +__decorateClass([ + Property21 +], DisjointChannelProperties.prototype, "text", 2); + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedProperties.ts +var import_ag_charts_community31 = require("ag-charts-community"); +var import_ag_charts_core20 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/properties/fibonacciProperties.ts +var import_ag_charts_community30 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/line/lineProperties.ts +var import_ag_charts_community29 = require("ag-charts-community"); +var import_ag_charts_core19 = require("ag-charts-core"); +var { Property: Property22 } = import_ag_charts_community29._ModuleSupport; +var LineTypeProperties = class extends Localisable( + Cappable(Extendable(Stroke(LineStyle(StartEndProperties)))) +) { + constructor() { + super(...arguments); + this.text = new LineTextProperties(); + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case "line-color": + return this.stroke; + case "text-color": + return this.text.color; + } + } + getDefaultOpacity() { + return this.strokeOpacity; + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property22 +], LineTypeProperties.prototype, "text", 2); +var ArrowProperties = class extends LineTypeProperties { + constructor() { + super(...arguments); + this.type = "arrow" /* Arrow */; + this.endCap = "arrow"; + } + static is(value) { + return (0, import_ag_charts_core19.isObject)(value) && value.type === "arrow" /* Arrow */; + } +}; +__decorateClass([ + Property22 +], ArrowProperties.prototype, "type", 2); +var LineProperties = class extends LineTypeProperties { + constructor() { + super(...arguments); + this.type = "line" /* Line */; + } + static is(value) { + return (0, import_ag_charts_core19.isObject)(value) && value.type === "line" /* Line */; + } +}; +__decorateClass([ + Property22 +], LineProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/properties/fibonacciProperties.ts +var { Property: Property23 } = import_ag_charts_community30._ModuleSupport; +var FibonacciProperties = class extends LineTypeProperties { + constructor() { + super(...arguments); + this.label = new LabelTextProperties(); + this.reverse = false; + this.showFill = true; + this.isMultiColor = true; + this.strokes = []; + this.bands = 10; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case "line-color": + return this.rangeStroke ?? this.stroke; + case "text-color": + return this.text.color; + } + } +}; +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "label", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "reverse", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "showFill", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "isMultiColor", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "strokes", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "rangeStroke", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "bands", 2); + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedProperties.ts +var { Property: Property24 } = import_ag_charts_community31._ModuleSupport; +var FibonacciRetracementTrendBasedProperties = class extends FibonacciProperties { + constructor() { + super(...arguments); + this.type = "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */; + this.endRetracement = new PointProperties(); + } + static is(value) { + return (0, import_ag_charts_core20.isObject)(value) && value.type === "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */; + } +}; +__decorateClass([ + Property24 +], FibonacciRetracementTrendBasedProperties.prototype, "type", 2); +__decorateClass([ + Property24 +], FibonacciRetracementTrendBasedProperties.prototype, "endRetracement", 2); + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement/fibonacciRetracementProperties.ts +var import_ag_charts_community32 = require("ag-charts-community"); +var import_ag_charts_core21 = require("ag-charts-core"); +var { Property: Property25 } = import_ag_charts_community32._ModuleSupport; +var FibonacciRetracementProperties = class extends FibonacciProperties { + constructor() { + super(...arguments); + this.type = "fibonacci-retracement" /* FibonacciRetracement */; + } + static is(value) { + return (0, import_ag_charts_core21.isObject)(value) && value.type === "fibonacci-retracement" /* FibonacciRetracement */; + } +}; +__decorateClass([ + Property25 +], FibonacciRetracementProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/parallel-channel/parallelChannelProperties.ts +var import_ag_charts_community33 = require("ag-charts-community"); +var import_ag_charts_core22 = require("ag-charts-core"); +var { BaseProperties: BaseProperties11, Property: Property26 } = import_ag_charts_community33._ModuleSupport; +var ParallelChannelProperties = class extends Annotation( + Background(Line3(Handle(Extendable(Stroke(LineStyle(BaseProperties11)))))) +) { + constructor() { + super(...arguments); + this.type = "parallel-channel" /* ParallelChannel */; + this.middle = new ChannelAnnotationMiddleProperties(); + this.text = new ChannelTextProperties(); + this.snapToAngle = 45; + } + static is(value) { + return (0, import_ag_charts_core22.isObject)(value) && value.type === "parallel-channel" /* ParallelChannel */; + } + get bottom() { + const bottom = { + start: { x: this.start.x, y: this.start.y }, + end: { x: this.end.x, y: this.end.y } + }; + if (typeof bottom.start.y === "number" && typeof bottom.end.y === "number") { + bottom.start.y -= this.height; + bottom.end.y -= this.height; + } else { + import_ag_charts_core22.Logger.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`); + } + return bottom; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fill; + case `line-color`: + return this.stroke; + case "text-color": + return this.text.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fillOpacity; + case `line-color`: + return this.strokeOpacity; + } + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property26 +], ParallelChannelProperties.prototype, "type", 2); +__decorateClass([ + Property26 +], ParallelChannelProperties.prototype, "height", 2); +__decorateClass([ + Property26 +], ParallelChannelProperties.prototype, "middle", 2); +__decorateClass([ + Property26 +], ParallelChannelProperties.prototype, "text", 2); + +// packages/ag-charts-enterprise/src/features/annotations/text/textProperties.ts +var import_ag_charts_community34 = require("ag-charts-community"); +var import_ag_charts_core23 = require("ag-charts-core"); +var { Property: Property27 } = import_ag_charts_community34._ModuleSupport; +var TextProperties = class extends TextualPointProperties { + constructor() { + super(...arguments); + this.type = "text" /* Text */; + this.position = "bottom"; + } + static is(value) { + return (0, import_ag_charts_core23.isObject)(value) && value.type === "text" /* Text */; + } +}; +__decorateClass([ + Property27 +], TextProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/utils/types.ts +function isEphemeralType(datum) { + return QuickDatePriceRangeProperties.is(datum); +} +function isLineType(datum) { + return LineProperties.is(datum) || HorizontalLineProperties.is(datum) || VerticalLineProperties.is(datum) || ArrowProperties.is(datum) || isFibonacciType(datum); +} +function isChannelType(datum) { + return DisjointChannelProperties.is(datum) || ParallelChannelProperties.is(datum); +} +function isFibonacciType(datum) { + return FibonacciRetracementProperties.is(datum) || FibonacciRetracementTrendBasedProperties.is(datum); +} +function isTextType(datum) { + return CalloutProperties.is(datum) || CommentProperties.is(datum) || NoteProperties.is(datum) || TextProperties.is(datum); +} +function isMeasurerType(datum) { + return DateRangeProperties.is(datum) || PriceRangeProperties.is(datum) || DatePriceRangeProperties.is(datum) || QuickDatePriceRangeProperties.is(datum); +} + +// packages/ag-charts-enterprise/src/features/annotations/utils/has.ts +function hasFontSize(datum) { + return isTextType(datum) && !NoteProperties.is(datum); +} +function hasLineStyle(datum) { + return isLineType(datum) || isChannelType(datum) || isMeasurerType(datum) && !QuickDatePriceRangeProperties.is(datum); +} +function hasLineColor(datum) { + return isLineType(datum) || isChannelType(datum) || isMeasurerType(datum) || CalloutProperties.is(datum) || NoteProperties.is(datum); +} +function hasIconColor(datum) { + return NoteProperties.is(datum); +} +function hasFillColor(datum) { + return isChannelType(datum) || isMeasurerType(datum) || CalloutProperties.is(datum) || CommentProperties.is(datum) || ShapePointProperties.is(datum); +} +function hasTextColor(datum) { + return isTextType(datum) && !NoteProperties.is(datum); +} +function hasLineText(datum) { + return (isLineType(datum) || isChannelType(datum) || isMeasurerType(datum)) && !isEphemeralType(datum) && (0, import_ag_charts_core24.isObject)(datum.text); +} + +// packages/ag-charts-enterprise/src/features/annotations/utils/styles.ts +function setFontSize(datum, fontSize) { + if ("fontSize" in datum) + datum.fontSize = fontSize; + if (hasLineText(datum)) + datum.text.fontSize = fontSize; +} +function setLineStyle(datum, style) { + const strokeWidth = style?.strokeWidth ?? datum.strokeWidth ?? 1; + const lineType = style?.type ?? datum.lineStyle; + const lineStyle = lineType ?? getLineStyle(datum.lineDash, lineType); + const computedLineDash = getComputedLineDash(strokeWidth, lineStyle); + datum.strokeWidth = strokeWidth; + datum.computedLineDash = computedLineDash; + datum.lineStyle = lineStyle; + datum.lineCap = lineStyle === "dotted" ? "round" : void 0; +} +function setColor(datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor) { + switch (colorPickerType) { + case `fill-color`: { + if ("fill" in datum) + datum.fill = color6; + if ("fillOpacity" in datum) + datum.fillOpacity = opacity; + if ("background" in datum) { + datum.background.fill = color6; + datum.background.fillOpacity = opacity; + } + break; + } + case `line-color`: { + if ("axisLabel" in datum) { + datum.axisLabel.fill = color6; + datum.axisLabel.fillOpacity = opacity; + datum.axisLabel.stroke = color6; + datum.axisLabel.strokeOpacity = opacity; + } + if ("fill" in datum && "fillOpacity" in datum && hasIconColor(datum)) { + datum.fill = color6; + datum.fillOpacity = opacity; + } else { + if ("strokeOpacity" in datum) + datum.strokeOpacity = opacity; + if ("isMultiColor" in datum && "rangeStroke" in datum) { + datum.isMultiColor = isMultiColor; + datum.rangeStroke = color6; + } else if ("stroke" in datum) { + datum.stroke = color6; + } + } + break; + } + case `text-color`: { + if ("color" in datum) + datum.color = colorOpacity; + if (hasLineText(datum)) + datum.text.color = color6; + break; + } + } +} + +// packages/ag-charts-enterprise/src/features/annotations/annotationDefaults.ts +var { deepClone } = import_ag_charts_community35._ModuleSupport; +var AnnotationDefaults = class { + constructor() { + this.mementoOriginatorKey = "annotation-defaults"; + this.colors = new Map( + Object.values(AnnotationType).map((type) => [ + type, + /* @__PURE__ */ new Map([ + ["line-color", void 0], + ["fill-color", void 0], + ["text-color", void 0] + ]) + ]) + ); + this.fontSizes = /* @__PURE__ */ new Map([ + ["callout" /* Callout */, void 0], + ["comment" /* Comment */, void 0], + ["text" /* Text */, void 0], + ["arrow" /* Arrow */, void 0], + ["line" /* Line */, void 0], + ["disjoint-channel" /* DisjointChannel */, void 0], + ["parallel-channel" /* ParallelChannel */, void 0], + ["date-range" /* DateRange */, void 0], + ["price-range" /* PriceRange */, void 0], + ["date-price-range" /* DatePriceRange */, void 0] + ]); + this.lineStyles = /* @__PURE__ */ new Map([ + ["line" /* Line */, void 0], + ["horizontal-line" /* HorizontalLine */, void 0], + ["vertical-line" /* VerticalLine */, void 0], + ["disjoint-channel" /* DisjointChannel */, void 0], + ["parallel-channel" /* ParallelChannel */, void 0], + ["arrow" /* Arrow */, void 0], + ["date-range" /* DateRange */, void 0], + ["price-range" /* PriceRange */, void 0], + ["date-price-range" /* DatePriceRange */, void 0] + ]); + this.lineTextAlignments = /* @__PURE__ */ new Map([ + ["line" /* Line */, void 0], + ["horizontal-line" /* HorizontalLine */, void 0], + ["vertical-line" /* VerticalLine */, void 0], + ["disjoint-channel" /* DisjointChannel */, void 0], + ["parallel-channel" /* ParallelChannel */, void 0], + ["arrow" /* Arrow */, void 0], + ["date-range" /* DateRange */, void 0], + ["price-range" /* PriceRange */, void 0], + ["date-price-range" /* DatePriceRange */, void 0] + ]); + this.lineTextPositions = /* @__PURE__ */ new Map([ + ["line" /* Line */, void 0], + ["horizontal-line" /* HorizontalLine */, void 0], + ["vertical-line" /* VerticalLine */, void 0], + ["disjoint-channel" /* DisjointChannel */, void 0], + ["parallel-channel" /* ParallelChannel */, void 0], + ["arrow" /* Arrow */, void 0], + ["date-range" /* DateRange */, void 0], + ["price-range" /* PriceRange */, void 0], + ["date-price-range" /* DatePriceRange */, void 0] + ]); + this.fibonacciOptions = /* @__PURE__ */ new Map([ + [ + "fibonacci-retracement" /* FibonacciRetracement */, + { + bands: void 0, + reverse: void 0, + showFill: void 0 + } + ], + [ + "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */, + { + bands: void 0, + reverse: void 0, + showFill: void 0 + } + ] + ]); + } + createMemento() { + return { + colors: deepClone(this.colors), + fontSizes: deepClone(this.fontSizes), + lineStyles: deepClone(this.lineStyles), + lineTextAlignments: deepClone(this.lineTextAlignments), + lineTextPositions: deepClone(this.lineTextPositions), + fibonacciOptions: deepClone(this.fibonacciOptions) + }; + } + guardMemento(_blob) { + return true; + } + restoreMemento(_version, _mementoVersion, blob) { + this.colors = deepClone(blob.colors); + this.fontSizes = deepClone(blob.fontSizes); + this.lineStyles = deepClone(blob.lineStyles); + this.lineTextAlignments = deepClone(blob.lineTextAlignments); + this.lineTextPositions = deepClone(blob.lineTextPositions); + this.fibonacciOptions = deepClone(blob.fibonacciOptions); + } + setDefaultColor(type, colorType, colorOpacity, color6, opacity, isMultiColor) { + this.colors.get(type)?.set(colorType, [colorOpacity, color6, opacity, isMultiColor]); + } + setDefaultFontSize(type, fontSize) { + this.fontSizes.set(type, fontSize); + } + setDefaultLineStyleType(type, lineStyleType) { + const defaultStyle = this.lineStyles.get(type); + if (defaultStyle) { + defaultStyle.type = lineStyleType; + } else { + this.lineStyles.set(type, { type: lineStyleType }); + } + } + setDefaultLineStyleWidth(type, strokeWidth) { + const defaultStyle = this.lineStyles.get(type); + if (defaultStyle) { + defaultStyle.strokeWidth = strokeWidth; + } else { + this.lineStyles.set(type, { strokeWidth }); + } + } + setDefaultLineTextAlignment(type, alignment) { + this.lineTextAlignments.set(type, alignment); + } + setDefaultLineTextPosition(type, position) { + this.lineTextPositions.set(type, position); + } + setDefaultFibonacciOptions(type, key, value) { + if (type != "fibonacci-retracement" /* FibonacciRetracement */ && type != "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */) + return; + const options = this.fibonacciOptions.get(type); + options[key] = value; + this.fibonacciOptions.set(type, options); + } + applyDefaults(datum) { + for (const [annotationType, colors] of this.colors) { + if (datum.type !== annotationType) + continue; + for (const [colorPickerType, [colorOpacity, color6, opacity, isMultiColor] = []] of colors) { + if (colorOpacity && color6 && opacity != null && isMultiColor != null) { + setColor(datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + } + } + } + for (const [annotationType, size] of this.fontSizes) { + if (datum.type !== annotationType || size == null) + continue; + setFontSize(datum, size); + } + for (const [annotationType, style] of this.lineStyles) { + if (datum.type !== annotationType || style == null) + continue; + setLineStyle(datum, style); + } + for (const [annotationType, position] of this.lineTextPositions) { + if (datum.type !== annotationType || position == null) + continue; + datum.text.position = position; + } + for (const [annotationType, alignment] of this.lineTextAlignments) { + if (datum.type !== annotationType || alignment == null) + continue; + datum.text.alignment = alignment; + } + for (const [annotationType, options] of this.fibonacciOptions) { + if (datum.type !== annotationType || options == null) + continue; + for (const option of Object.keys(options)) { + const value = options[option]; + if (value == null) { + continue; + } + datum.set({ [option]: value }); + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotationOptionsToolbar.ts +var import_ag_charts_community38 = require("ag-charts-community"); +var import_ag_charts_core26 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/components/color-picker/colorPicker.ts +var import_ag_charts_community36 = require("ag-charts-community"); +var import_ag_charts_core25 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/components/color-picker/colorPickerTemplate.html +var colorPickerTemplate_default = '
'; + +// packages/ag-charts-enterprise/src/components/color-picker/colorPicker.ts +var { Color: Color3 } = import_ag_charts_community36._ModuleSupport; +var getHsva = (input) => { + try { + const color6 = Color3.fromString(input); + const [h, s, v] = color6.toHSB(); + return [h, s, v, color6.a]; + } catch { + return; + } +}; +var ColorPicker = class extends import_ag_charts_community36._ModuleSupport.AnchoredPopover { + constructor(ctx, options) { + super(ctx, "color-picker", options); + this.hasChanged = false; + this.hideFns.push(() => { + this.i18nUpdater = void 0; + if (this.hasChanged) + this.onChangeHide?.(); + }); + this.cleanup.register(this.ctx.eventsHub.on("locale:change", () => this.i18nUpdater?.())); + } + show(options) { + this.hasChanged = false; + this.onChangeHide = options.onChangeHide; + const { element, initialFocus } = this.createColorPicker(options); + const popover = this.showWithChildren([element], { initialFocus, ...options }); + popover.classList.add("ag-charts-color-picker"); + popover.setAttribute("role", "dialog"); + } + createColorPicker(opts) { + const { localeManager } = this.ctx; + let isMultiColor = opts.isMultiColor ?? false; + let [h, s, v, a] = getHsva(opts.color ?? "#f00") ?? [0, 1, 0.5, 1]; + a = opts.opacity ?? a; + const colorPicker = (0, import_ag_charts_core25.createElement)("div", "ag-charts-color-picker__content"); + colorPicker.innerHTML = colorPickerTemplate_default; + colorPicker.ariaLabel = this.ctx.localeManager.t("ariaLabelColorPicker"); + const paletteInput = colorPicker.querySelector(".ag-charts-color-picker__palette"); + const hueInput = colorPicker.querySelector(".ag-charts-color-picker__hue-input"); + const multiColorButton = colorPicker.querySelector( + ".ag-charts-color-picker__multi-color-button" + ); + const alphaInput = colorPicker.querySelector(".ag-charts-color-picker__alpha-input"); + const colorInput = colorPicker.querySelector(".ag-charts-color-picker__color-input"); + const colorInputLabel = colorPicker.querySelector(".ag-charts-color-picker__color-label"); + const updatePaletteInputAriaValue = (first) => { + const key = { s: "ariaValueColorPalette", v: "ariaValueColorPaletteFirstV" }[first]; + paletteInput.ariaValueText = localeManager.t(key, { s, v }); + }; + this.i18nUpdater = () => { + paletteInput.ariaRoleDescription = localeManager.t("ariaRoleDescription2DSlider"); + paletteInput.ariaLabel = localeManager.t("ariaLabelColorPickerPalette"); + hueInput.ariaLabel = localeManager.t("ariaLabelColorPickerHue"); + multiColorButton.ariaLabel = localeManager.t("ariaLabelColorPickerMultiColor"); + alphaInput.ariaLabel = localeManager.t("ariaLabelColorPickerAlpha"); + colorInput.ariaLabel = localeManager.t("ariaLabelColor"); + updatePaletteInputAriaValue("s"); + }; + this.i18nUpdater(); + multiColorButton.classList.toggle( + "ag-charts-color-picker__multi-color-button--hidden", + !opts.hasMultiColorOption + ); + const update = (trackChange = true) => { + const color6 = Color3.fromHSB(h, s, v, a); + const colorString = color6.toHexString(); + colorPicker.style.setProperty("--h", `${h}`); + colorPicker.style.setProperty("--s", `${s}`); + colorPicker.style.setProperty("--v", `${v}`); + colorPicker.style.setProperty("--a", `${a}`); + colorPicker.style.setProperty("--color", colorString.slice(0, 7)); + colorPicker.style.setProperty("--color-a", colorString); + hueInput.value = `${h}`; + alphaInput.value = `${a}`; + alphaInput.classList.toggle("ag-charts-color-picker__alpha-input--opaque", a === 1); + multiColorButton.classList.toggle("ag-charts-color-picker__multi-color-button--active", isMultiColor); + colorInputLabel.classList.toggle("ag-charts-color-picker__color-label--multi-color", isMultiColor); + if (document.activeElement !== colorInput) { + multiColorButton.ariaChecked = isMultiColor.toString(); + colorInput.value = isMultiColor ? localeManager.t("ariaLabelColorPickerMultiColor") : colorString.toUpperCase(); + } + if (trackChange || opts.color == null) { + const plainColor = Color3.fromHSB(h, s, v, 1).toHexString(); + opts.onChange?.(colorString, plainColor, a, isMultiColor); + } + if (trackChange) + this.hasChanged = true; + }; + update(false); + const preventDefault = (event) => event.preventDefault(); + const stopPropagation = (event) => event.stopPropagation(); + const beginPaletteInteraction = (e) => { + e.preventDefault(); + const currentTarget = e.currentTarget; + currentTarget.focus(); + const rect = currentTarget.getBoundingClientRect(); + const pointerMove = ({ clientX, clientY }) => { + isMultiColor = false; + s = Math.min(Math.max((clientX - rect.left) / rect.width, 0), 1); + v = 1 - Math.min(Math.max((clientY - rect.top) / rect.height, 0), 1); + update(); + updatePaletteInputAriaValue("s"); + }; + pointerMove(e); + const pointerUp = (0, import_ag_charts_core25.attachListener)((0, import_ag_charts_core25.getWindow)(), "pointermove", pointerMove); + (0, import_ag_charts_core25.getWindow)().addEventListener("pointerup", pointerUp, { once: true }); + }; + colorPicker.addEventListener("mousedown", stopPropagation); + colorPicker.addEventListener("touchstart", stopPropagation); + colorPicker.addEventListener("touchmove", stopPropagation); + colorPicker.addEventListener("keydown", (e) => { + e.stopPropagation(); + switch (e.key) { + case "Enter": + case "Escape": + this.hide(); + break; + default: + return; + } + e.preventDefault(); + }); + paletteInput.addEventListener("pointerdown", beginPaletteInteraction); + paletteInput.addEventListener("touchstart", preventDefault, { passive: false }); + paletteInput.addEventListener("touchmove", preventDefault, { passive: false }); + paletteInput.addEventListener("keydown", (e) => { + if (e.key === "ArrowLeft") { + s = (0, import_ag_charts_core25.clamp)(0, s - 0.01, 1); + updatePaletteInputAriaValue("s"); + } else if (e.key === "ArrowRight") { + s = (0, import_ag_charts_core25.clamp)(0, s + 0.01, 1); + updatePaletteInputAriaValue("s"); + } else if (e.key === "ArrowUp") { + v = (0, import_ag_charts_core25.clamp)(0, v + 0.01, 1); + updatePaletteInputAriaValue("v"); + } else if (e.key === "ArrowDown") { + v = (0, import_ag_charts_core25.clamp)(0, v - 0.01, 1); + updatePaletteInputAriaValue("v"); + } else { + return; + } + e.preventDefault(); + update(); + }); + paletteInput.addEventListener("focus", () => { + updatePaletteInputAriaValue("s"); + }); + multiColorButton.addEventListener("click", () => { + isMultiColor = !isMultiColor; + update(); + }); + hueInput.addEventListener("input", (e) => { + isMultiColor = false; + h = e.currentTarget.valueAsNumber ?? 0; + update(); + }); + alphaInput.addEventListener("input", (e) => { + isMultiColor = false; + a = e.currentTarget.valueAsNumber ?? 0; + update(); + }); + colorInput.addEventListener("input", (e) => { + isMultiColor = false; + const hsva = getHsva(e.currentTarget.value); + if (hsva == null) + return; + [h, s, v, a] = hsva; + update(); + }); + colorInput.addEventListener("blur", () => update()); + colorInput.addEventListener("keydown", (e) => { + if (e.key === "Enter") { + e.currentTarget.blur(); + update(); + } + }); + return { element: colorPicker, initialFocus: paletteInput }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotationsMenuOptions.ts +var import_ag_charts_community37 = require("ag-charts-community"); +function channelMenuItemVisible(scale) { + return !(scale instanceof import_ag_charts_community37._ModuleSupport.LogScale) && !(scale instanceof import_ag_charts_community37._ModuleSupport.BandScale); +} +var LINE_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsTrendLine", + icon: "trend-line-drawing", + value: "line" /* Line */ + }, + { + label: "toolbarAnnotationsHorizontalLine", + icon: "horizontal-line-drawing", + value: "horizontal-line" /* HorizontalLine */ + }, + { + label: "toolbarAnnotationsVerticalLine", + icon: "vertical-line-drawing", + value: "vertical-line" /* VerticalLine */ + }, + { + label: "toolbarAnnotationsParallelChannel", + icon: "parallel-channel-drawing", + value: "parallel-channel" /* ParallelChannel */, + visible: channelMenuItemVisible + }, + { + label: "toolbarAnnotationsDisjointChannel", + icon: "disjoint-channel-drawing", + value: "disjoint-channel" /* DisjointChannel */, + visible: channelMenuItemVisible + } +]; +var FIBONACCI_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsFibonacciRetracement", + icon: "fibonacci-retracement-drawing", + value: "fibonacci-retracement" /* FibonacciRetracement */ + }, + { + label: "toolbarAnnotationsFibonacciRetracementTrendBased", + icon: "fibonacci-retracement-trend-based-drawing", + value: "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */ + } +]; +var FIBONACCI_RATIO_ITEMS = [ + { label: "Fibonacci - Extended", value: 10 }, + { label: "Fibonacci - 6 Band", value: 6 }, + { label: "Fibonacci - 4 Band", value: 4 } +]; +var TEXT_ANNOTATION_ITEMS = [ + { label: "toolbarAnnotationsText", icon: "text-annotation", value: "text" /* Text */ }, + { label: "toolbarAnnotationsComment", icon: "comment-annotation", value: "comment" /* Comment */ }, + { label: "toolbarAnnotationsCallout", icon: "callout-annotation", value: "callout" /* Callout */ }, + { label: "toolbarAnnotationsNote", icon: "note-annotation", value: "note" /* Note */ } +]; +var SHAPE_ANNOTATION_ITEMS = [ + { label: "toolbarAnnotationsArrow", icon: "arrow-drawing", value: "arrow" /* Arrow */ }, + { label: "toolbarAnnotationsArrowUp", icon: "arrow-up-drawing", value: "arrow-up" /* ArrowUp */ }, + { label: "toolbarAnnotationsArrowDown", icon: "arrow-down-drawing", value: "arrow-down" /* ArrowDown */ } +]; +var MEASURER_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsQuickDatePriceRange", + icon: "measurer-drawing", + value: "quick-date-price-range" /* QuickDatePriceRange */ + }, + { label: "toolbarAnnotationsDateRange", icon: "date-range-drawing", value: "date-range" /* DateRange */ }, + { label: "toolbarAnnotationsPriceRange", icon: "price-range-drawing", value: "price-range" /* PriceRange */ }, + { + label: "toolbarAnnotationsDatePriceRange", + icon: "date-price-range-drawing", + value: "date-price-range" /* DatePriceRange */ + } +]; +var LINE_STROKE_WIDTH_ITEMS = [ + { strokeWidth: 1, label: "1", value: 1 }, + { strokeWidth: 2, label: "2", value: 2 }, + { strokeWidth: 3, label: "3", value: 3 }, + { strokeWidth: 4, label: "4", value: 4 }, + { strokeWidth: 8, label: "8", value: 8 } +]; +var LINE_STYLE_TYPE_ITEMS = [ + { icon: "line-style-solid", altText: "iconAltTextLineStyleSolid", value: "solid" }, + { icon: "line-style-dashed", altText: "iconAltTextLineStyleDashed", value: "dashed" }, + { icon: "line-style-dotted", altText: "iconAltTextLineStyleDotted", value: "dotted" } +]; +var TEXT_SIZE_ITEMS = [ + { label: "10", value: 10 }, + { label: "12", value: 12 }, + { label: "14", value: 14 }, + { label: "16", value: 16 }, + { label: "18", value: 18 }, + { label: "22", value: 22 }, + { label: "28", value: 28 }, + { label: "36", value: 36 }, + { label: "46", value: 46 } +]; + +// packages/ag-charts-enterprise/src/features/annotations/annotationOptionsToolbar.ts +var { Color: Color4, FloatingToolbar, Menu, PropertiesArray, ToolbarButtonProperties, ToolbarButtonWidget, Property: Property28 } = import_ag_charts_community38._ModuleSupport; +var AnnotationOptionsButtonProperties = class extends ToolbarButtonProperties { + constructor() { + super(...arguments); + this.checkedOverrides = new ToolbarButtonProperties(); + } +}; +__decorateClass([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "value", 2); +__decorateClass([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "checkedOverrides", 2); +__decorateClass([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "color", 2); +__decorateClass([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "isMultiColor", 2); +var AnnotationOptionsButtonWidget = class extends ToolbarButtonWidget { + update(options) { + super.update(options); + if (options.value === "line-stroke-width" /* LineStrokeWidth */) { + this.updateLineStrokeWidth(options); + } + if (options.value === "fill-color" /* FillColor */ || options.value === "line-color" /* LineColor */ || options.value === "text-color" /* TextColor */) { + this.updateFillColor(options); + } + } + updateFillColor(options) { + const element = this.getElement(); + element.classList.add("ag-charts-annotations__color-picker-button"); + element.classList.toggle("ag-charts-annotations__color-picker-button--multi-color", options.isMultiColor); + element.style.setProperty("--color", options.color ?? null); + } + updateLineStrokeWidth(options) { + const element = this.getElement(); + element.classList.add("ag-charts-annotations__stroke-width-button"); + element.style.setProperty("--stroke-width", `${options.strokeWidth}px`); + } +}; +var FloatingAnnotationOptionsToolbar = class extends FloatingToolbar { + createButtonWidget() { + return new AnnotationOptionsButtonWidget(this.localeManager); + } +}; +var AnnotationOptionsToolbar = class extends import_ag_charts_community38._ModuleSupport.BaseProperties { + constructor(ctx, getActiveDatum) { + super(); + this.ctx = ctx; + this.getActiveDatum = getActiveDatum; + this.enabled = true; + this.buttons = new PropertiesArray(AnnotationOptionsButtonProperties); + this.cleanup = new import_ag_charts_core26.CleanupRegistry(); + this.events = new import_ag_charts_core26.EventEmitter(); + this.visibleButtons = []; + this.toolbar = new FloatingAnnotationOptionsToolbar( + this.ctx, + "ariaLabelAnnotationOptionsToolbar", + "annotation-options" + ); + this.colorPicker = new ColorPicker(this.ctx); + this.textSizeMenu = new Menu(this.ctx, "text-size"); + this.lineStyleTypeMenu = new Menu(this.ctx, "annotations-line-style-type"); + this.lineStrokeWidthMenu = new Menu(this.ctx, "annotations-line-stroke-width"); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPress.bind(this)), + this.toolbar.addToolbarListener("toolbar-moved", this.onToolbarMoved.bind(this)), + ctx.widgets.seriesWidget.addListener("drag-start", this.onDragStart.bind(this)), + ctx.widgets.seriesWidget.addListener("drag-end", this.onDragEnd.bind(this)), + () => { + this.colorPicker.destroy(); + this.toolbar.destroy(); + } + ); + } + onDragStart() { + this.toolbar.ignorePointerEvents(); + } + onDragEnd() { + this.toolbar.capturePointerEvents(); + } + destroy() { + this.cleanup.flush(); + } + show() { + if (!this.enabled) + return; + this.toolbar.show(); + } + hide() { + this.toolbar.hide(); + } + updateButtons(datum) { + if (!this.enabled) + return; + const visible = { + ["line-style-type" /* LineStyleType */]: hasLineStyle(datum), + ["line-stroke-width" /* LineStrokeWidth */]: hasLineStyle(datum), + ["line-color" /* LineColor */]: hasLineColor(datum), + ["text-color" /* TextColor */]: hasTextColor(datum), + ["fill-color" /* FillColor */]: hasFillColor(datum), + ["text-size" /* TextSize */]: hasFontSize(datum), + ["settings" /* Settings */]: hasLineText(datum), + ["lock" /* Lock */]: true, + ["delete" /* Delete */]: true + }; + this.visibleButtons = this.buttons.filter((button) => visible[button.value]); + this.toolbar.clearButtons(); + this.toolbar.updateButtons(this.visibleButtons); + this.refreshButtons(datum); + } + setAnchorScene(scene) { + if (this.toolbar.hasBeenDragged()) + return; + this.toolbar.setAnchor(scene.getAnchor()); + } + hideOverlays() { + this.toolbar.clearActiveButton(); + this.colorPicker.hide({ lastFocus: null }); + this.textSizeMenu.hide(); + this.lineStyleTypeMenu.hide(); + this.lineStrokeWidthMenu.hide(); + this.events.emit("hid-overlays", null); + } + clearActiveButton() { + this.toolbar.clearActiveButton(); + } + updateColors(datum) { + this.updateColorPickerColor( + "line-color" /* LineColor */, + datum.getDefaultColor("line-color" /* LineColor */), + datum.getDefaultOpacity("line-color" /* LineColor */), + "isMultiColor" in datum && datum?.isMultiColor + ); + this.updateColorPickerColor( + "fill-color" /* FillColor */, + datum.getDefaultColor("fill-color" /* FillColor */), + datum.getDefaultOpacity("fill-color" /* FillColor */), + "isMultiColor" in datum && datum?.isMultiColor + ); + this.updateColorPickerColor( + "text-color" /* TextColor */, + datum.getDefaultColor("text-color" /* TextColor */), + datum.getDefaultOpacity("text-color" /* TextColor */), + "isMultiColor" in datum && datum?.isMultiColor + ); + } + updateColorPickerColor(colorPickerType, color6, opacity, isMultiColor) { + if (color6 != null && opacity != null) { + const { r, g, b } = Color4.fromString(color6); + color6 = Color4.fromArray([r, g, b, opacity]).toHexString(); + } + this.updateButtonByValue(colorPickerType, { color: color6, isMultiColor }); + } + updateFontSize(fontSize) { + this.updateButtonByValue("text-size" /* TextSize */, { + label: fontSize == null ? void 0 : String(fontSize) + }); + } + updateLineStyleType(item) { + this.updateButtonByValue("line-style-type" /* LineStyleType */, { + icon: item.icon + }); + } + updateStrokeWidth(item) { + this.updateButtonByValue("line-stroke-width" /* LineStrokeWidth */, { + label: item.label, + strokeWidth: item.value + }); + } + onButtonPress({ + event, + button, + buttonWidget + }) { + const datum = this.getActiveDatum(); + if (!datum) + return; + this.hideOverlays(); + switch (button.value) { + case "line-style-type" /* LineStyleType */: { + const lineStyle = hasLineStyle(datum) ? getLineStyle(datum.lineDash, datum.lineStyle) : void 0; + this.lineStyleTypeMenu.show(buttonWidget, { + items: LINE_STYLE_TYPE_ITEMS, + ariaLabel: this.ctx.localeManager.t("toolbarAnnotationsLineStyle"), + value: lineStyle, + onPress: (item) => this.onLineStyleTypeMenuPress(item, datum), + class: "ag-charts-annotations__line-style-type-menu" + }); + break; + } + case "line-stroke-width" /* LineStrokeWidth */: { + const strokeWidth = hasLineStyle(datum) ? datum.strokeWidth : void 0; + this.lineStrokeWidthMenu.show(buttonWidget, { + items: LINE_STROKE_WIDTH_ITEMS, + ariaLabel: this.ctx.localeManager.t("toolbarAnnotationsLineStrokeWidth"), + value: strokeWidth, + onPress: (item) => this.onLineStrokeWidthMenuPress(item, datum), + class: "ag-charts-annotations__line-stroke-width-menu" + }); + break; + } + case "line-color" /* LineColor */: + case "fill-color" /* FillColor */: + case "text-color" /* TextColor */: { + this.toolbar.toggleActiveButtonByIndex(button.index); + this.colorPicker.show({ + color: datum?.getDefaultColor(button.value), + opacity: datum?.getDefaultOpacity(button.value), + sourceEvent: event.sourceEvent, + hasMultiColorOption: "isMultiColor" in datum, + isMultiColor: "isMultiColor" in datum && datum?.isMultiColor, + onChange: datum == null ? void 0 : this.onColorPickerChange.bind(this, button.value, datum), + onChangeHide: ((type) => { + this.events.emit("saved-color", { + type: datum.type, + colorPickerType: button.value, + color: datum.getDefaultColor(type) + }); + }).bind(this, button.value) + }); + break; + } + case "text-size" /* TextSize */: { + const fontSize = isTextType(datum) ? datum.fontSize : void 0; + this.textSizeMenu.show(buttonWidget, { + items: TEXT_SIZE_ITEMS, + ariaLabel: this.ctx.localeManager.t("toolbarAnnotationsTextSize"), + value: fontSize, + onPress: (item) => this.onTextSizeMenuPress(item, datum), + class: "ag-charts-annotations__text-size-menu" + }); + break; + } + case "delete" /* Delete */: { + this.events.emit("pressed-delete", null); + break; + } + case "lock" /* Lock */: { + datum.locked = !datum.locked; + this.refreshButtons(datum); + this.events.emit("pressed-lock", { locked: datum.locked }); + break; + } + case "settings" /* Settings */: { + this.toolbar.toggleActiveButtonByIndex(button.index); + this.events.emit("pressed-settings", event); + break; + } + } + } + onToolbarMoved(event) { + const { buttonBounds, popoverBounds } = event; + const colorPickerAnchor = { x: popoverBounds.x, y: popoverBounds.y + popoverBounds.height + 4 }; + const colorPickerFallbackAnchor = { y: popoverBounds.y - 4 }; + this.colorPicker.setAnchor(colorPickerAnchor, colorPickerFallbackAnchor); + for (const [index, bounds] of buttonBounds.entries()) { + const button = this.visibleButtons.at(index); + if (!button) + continue; + const anchor = { x: bounds.x, y: bounds.y + bounds.height - 1 }; + const fallbackAnchor = { y: bounds.y }; + switch (button.value) { + case "line-stroke-width" /* LineStrokeWidth */: + this.lineStrokeWidthMenu.setAnchor(anchor, fallbackAnchor); + break; + case "line-style-type" /* LineStyleType */: + this.lineStyleTypeMenu.setAnchor(anchor, fallbackAnchor); + break; + case "text-size" /* TextSize */: + this.textSizeMenu.setAnchor(anchor, fallbackAnchor); + break; + } + } + } + onColorPickerChange(colorPickerType, datum, colorOpacity, color6, opacity, isMultiColor) { + this.events.emit("updated-color", { + type: datum.type, + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }); + this.updateColorPickerColor(colorPickerType, colorOpacity, opacity, isMultiColor); + } + onTextSizeMenuPress(item, datum) { + if (!hasFontSize(datum)) + return; + const fontSize = item.value; + this.events.emit("updated-font-size", { type: datum.type, fontSize }); + this.textSizeMenu.hide(); + this.updateFontSize(fontSize); + } + onLineStyleTypeMenuPress(item, datum) { + if (!hasLineStyle(datum)) + return; + const type = item.value; + this.events.emit("updated-line-style", { type: datum.type, lineStyleType: type }); + this.lineStyleTypeMenu.hide(); + this.updateLineStyleType(item); + } + onLineStrokeWidthMenuPress(item, datum) { + if (!hasLineStyle(datum)) { + return; + } + const strokeWidth = item.value; + this.events.emit("updated-line-width", { type: datum.type, strokeWidth }); + this.lineStrokeWidthMenu.hide(); + this.updateStrokeWidth(item); + } + refreshButtons(datum) { + const locked = datum.locked ?? false; + for (const [index, button] of this.visibleButtons.entries()) { + if (!button) + continue; + if (button.value === "lock" /* Lock */) { + this.toolbar.toggleSwitchCheckedByIndex(index, locked); + this.updateButtonByIndex(index, locked ? button.checkedOverrides.toJson() : button.toJson()); + } else { + this.toolbar.toggleButtonEnabledByIndex(index, !locked); + } + } + if (hasFontSize(datum)) + this.updateFontSize(datum.fontSize); + this.updateColors(datum); + this.updateLineStyles(datum); + } + updateLineStyles(datum) { + if (!hasLineStyle(datum)) + return; + const strokeWidth = datum.strokeWidth ?? 1; + const lineStyleType = getLineStyle(datum.lineDash, datum.lineStyle); + this.updateStrokeWidth({ + strokeWidth, + value: strokeWidth, + label: String(strokeWidth) + }); + this.updateLineStyleType( + LINE_STYLE_TYPE_ITEMS.find((item) => item.value === lineStyleType) ?? LINE_STYLE_TYPE_ITEMS[0] + ); + } + updateButtonByValue(value, change) { + const index = this.visibleButtons.findIndex((button) => button.value === value); + if (index === -1) + return; + this.updateButtonByIndex(index, change); + } + updateButtonByIndex(index, change) { + const button = this.visibleButtons.at(index); + if (!button) + return; + this.toolbar.updateButtonByIndex(index, { ...button.toJson(), ...change, value: change.value ?? button.value }); + } +}; +__decorateClass([ + Property28 +], AnnotationOptionsToolbar.prototype, "enabled", 2); +__decorateClass([ + Property28 +], AnnotationOptionsToolbar.prototype, "buttons", 2); + +// packages/ag-charts-enterprise/src/features/annotations/states/dragState.ts +var import_ag_charts_community39 = require("ag-charts-community"); +var { StateMachine, StateMachineProperty, Vec2: Vec22, Debug } = import_ag_charts_community39._ModuleSupport; +var DragStateMachine = class extends StateMachine { + constructor(ctx) { + const actionKeyChange = ({ context }) => { + this.node?.drag(this.datum, this.offset, context, this.snapping); + ctx.update(); + }; + super("idle", { + idle: { + dragStart: { + target: "dragging", + action: ({ offset, context }) => { + this.hasMoved = false; + this.dragStart = offset; + this.offset = offset; + this.node?.dragStart(this.datum, offset, context); + } + } + }, + dragging: { + keyDown: actionKeyChange, + keyUp: actionKeyChange, + drag: ({ offset, context }) => { + this.hasMoved = Vec22.lengthSquared(Vec22.sub(offset, this.dragStart)) > 0; + this.offset = offset; + this.node?.drag(this.datum, offset, context, this.snapping); + ctx.update(); + }, + dragEnd: { + target: StateMachine.parent, + action: () => { + this.node?.stopDragging(); + if (this.hasMoved) + ctx.recordAction("Move annotation"); + ctx.update(); + } + } + } + }); + this.debug = Debug.create(true, "annotations"); + this.hasMoved = false; + this.snapping = false; + } +}; +__decorateClass([ + StateMachineProperty() +], DragStateMachine.prototype, "snapping", 2); +__decorateClass([ + StateMachineProperty() +], DragStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty() +], DragStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/arrow-down/arrowDownProperties.ts +var import_ag_charts_community40 = require("ag-charts-community"); +var import_ag_charts_core27 = require("ag-charts-core"); +var { Property: Property29 } = import_ag_charts_community40._ModuleSupport; +var ArrowDownProperties = class extends ShapePointProperties { + constructor() { + super(...arguments); + this.type = "arrow-down" /* ArrowDown */; + } + static is(value) { + return (0, import_ag_charts_core27.isObject)(value) && value.type === "arrow-down" /* ArrowDown */; + } +}; +__decorateClass([ + Property29 +], ArrowDownProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/arrow-down/arrowDownScene.ts +var import_ag_charts_community47 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/arrow-up/arrowUpScene.ts +var import_ag_charts_community46 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/annotationScene.ts +var import_ag_charts_community43 = require("ag-charts-community"); +var import_ag_charts_core28 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/handle.ts +var import_ag_charts_community42 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/annotationShape.ts +var import_ag_charts_community41 = require("ag-charts-community"); +var AnnotationShape = class extends import_ag_charts_community41._ModuleSupport.Marker { + // Use exact method for this, rather than the Marker's high performance approximation. + isPointInPath(x, y) { + this.updatePathIfDirty(); + return this.path.closedPath && this.path.isPointInPath(x, y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/handle.ts +var _Handle = class _Handle extends import_ag_charts_community42._ModuleSupport.Group { + constructor() { + super(...arguments); + this.active = false; + this.locked = false; + this.visible = false; + this.zIndex = 1; + } + drag(target) { + const { handle: handle2, locked } = this; + if (locked) { + return { point: { x: handle2.x, y: handle2.y }, offset: { x: 0, y: 0 } }; + } + return { + point: target, + offset: { x: target.x - handle2.x, y: target.y - handle2.y } + }; + } + toggleActive(active) { + this.active = active; + if (!active) { + this.handle.strokeWidth = _Handle.INACTIVE_STROKE_WIDTH; + } + } + toggleHovered(hovered) { + this.glow.visible = !this.locked && hovered; + this.glow.dirtyPath = true; + } + toggleDragging(dragging) { + if (this.locked) + return; + this.handle.visible = !dragging; + this.glow.visible = this.glow.visible && !dragging; + this.handle.dirtyPath = true; + this.glow.dirtyPath = true; + } + toggleLocked(locked) { + this.locked = locked; + } + getCursor() { + return void 0; + } + containsPoint(x, y) { + return this.handle.containsPoint(x, y); + } +}; +_Handle.INACTIVE_STROKE_WIDTH = 2; +var Handle2 = _Handle; +var _InvariantHandle = class _InvariantHandle extends Handle2 { + constructor() { + super(); + this.handle = new AnnotationShape({ shape: "circle" }); + this.glow = new AnnotationShape({ shape: "circle" }); + this.append([this.handle]); + this.handle.size = _InvariantHandle.HANDLE_SIZE; + this.handle.strokeWidth = Handle2.INACTIVE_STROKE_WIDTH; + this.handle.zIndex = 2; + } + update(styles) { + this.handle.setProperties({ ...styles, strokeWidth: Handle2.INACTIVE_STROKE_WIDTH }); + } + drag(target) { + return { point: target, offset: { x: 0, y: 0 } }; + } +}; +_InvariantHandle.HANDLE_SIZE = 7; +_InvariantHandle.GLOW_SIZE = 9; +var InvariantHandle = _InvariantHandle; +var _UnivariantHandle = class _UnivariantHandle extends Handle2 { + constructor() { + super(); + this.handle = new import_ag_charts_community42._ModuleSupport.Rect(); + this.glow = new import_ag_charts_community42._ModuleSupport.Rect(); + this.gradient = "horizontal"; + this.append([this.glow, this.handle]); + this.handle.cornerRadius = _UnivariantHandle.CORNER_RADIUS; + this.handle.width = _UnivariantHandle.HANDLE_SIZE; + this.handle.height = _UnivariantHandle.HANDLE_SIZE; + this.handle.strokeWidth = Handle2.INACTIVE_STROKE_WIDTH; + this.handle.zIndex = 2; + this.glow.cornerRadius = _UnivariantHandle.CORNER_RADIUS; + this.glow.width = _UnivariantHandle.GLOW_SIZE; + this.glow.height = _UnivariantHandle.GLOW_SIZE; + this.glow.strokeWidth = 0; + this.glow.fillOpacity = 0.2; + this.glow.zIndex = 1; + this.glow.visible = false; + } + toggleLocked(locked) { + super.toggleLocked(locked); + if (locked) { + const offset = (_UnivariantHandle.HANDLE_SIZE - InvariantHandle.HANDLE_SIZE) / 2; + this.handle.cornerRadius = 1; + this.handle.fill = this.handle.stroke; + this.handle.strokeWidth = 0; + this.handle.x += offset; + this.handle.y += offset; + this.handle.width = InvariantHandle.HANDLE_SIZE; + this.handle.height = InvariantHandle.HANDLE_SIZE; + this.glow.width = InvariantHandle.GLOW_SIZE; + this.glow.height = InvariantHandle.GLOW_SIZE; + } else { + this.handle.cornerRadius = _UnivariantHandle.CORNER_RADIUS; + this.handle.width = _UnivariantHandle.HANDLE_SIZE; + this.handle.height = _UnivariantHandle.HANDLE_SIZE; + this.glow.width = _UnivariantHandle.GLOW_SIZE; + this.glow.height = _UnivariantHandle.GLOW_SIZE; + if (this.cachedStyles) { + this.handle.setProperties(this.cachedStyles); + } + } + } + update(styles) { + this.cachedStyles = { ...styles }; + if (!this.active) { + delete styles.strokeWidth; + } + if (this.locked) { + delete styles.fill; + delete styles.strokeWidth; + const offset = (_UnivariantHandle.HANDLE_SIZE - InvariantHandle.HANDLE_SIZE) / 2; + styles.x -= offset; + styles.y -= offset; + this.cachedStyles.x -= offset; + this.cachedStyles.y -= offset; + } + this.handle.setProperties(styles); + this.glow.setProperties({ + ...styles, + x: (styles.x ?? this.glow.x) - 2, + y: (styles.y ?? this.glow.y) - 2, + strokeWidth: 0, + fill: styles.stroke + }); + } + drag(target) { + if (this.locked) { + return { point: target, offset: { x: 0, y: 0 } }; + } + if (this.gradient === "vertical") { + return { + point: { x: target.x, y: this.handle.y }, + offset: { x: target.x - this.handle.x, y: 0 } + }; + } + return { + point: { x: this.handle.x, y: target.y }, + offset: { x: 0, y: target.y - this.handle.y } + }; + } + getCursor() { + if (this.locked) + return; + return this.gradient === "vertical" ? "col-resize" : "row-resize"; + } +}; +_UnivariantHandle.HANDLE_SIZE = 12; +_UnivariantHandle.GLOW_SIZE = 16; +_UnivariantHandle.CORNER_RADIUS = 4; +var UnivariantHandle = _UnivariantHandle; +var _DivariantHandle = class _DivariantHandle extends Handle2 { + constructor() { + super(); + this.handle = new AnnotationShape({ shape: "circle" }); + this.glow = new AnnotationShape({ shape: "circle" }); + this.append([this.glow, this.handle]); + this.handle.size = _DivariantHandle.HANDLE_SIZE; + this.handle.strokeWidth = Handle2.INACTIVE_STROKE_WIDTH; + this.handle.zIndex = 2; + this.glow.size = _DivariantHandle.GLOW_SIZE; + this.glow.strokeWidth = 0; + this.glow.fillOpacity = 0.2; + this.glow.zIndex = 1; + this.glow.visible = false; + } + toggleLocked(locked) { + super.toggleLocked(locked); + if (locked) { + this.handle.fill = this.handle.stroke; + this.handle.strokeWidth = 0; + this.handle.size = InvariantHandle.HANDLE_SIZE; + this.glow.size = InvariantHandle.GLOW_SIZE; + } else { + this.handle.size = _DivariantHandle.HANDLE_SIZE; + this.glow.size = _DivariantHandle.GLOW_SIZE; + if (this.cachedStyles) { + this.handle.setProperties(this.cachedStyles); + } + } + } + update(styles) { + this.cachedStyles = { ...styles }; + if (!this.active) { + delete styles.strokeWidth; + } + if (this.locked) { + delete styles.fill; + delete styles.strokeWidth; + } + this.handle.setProperties(styles); + this.glow.setProperties({ ...styles, strokeWidth: 0, fill: styles.stroke }); + } + getCursor() { + return "pointer"; + } +}; +_DivariantHandle.HANDLE_SIZE = 11; +_DivariantHandle.GLOW_SIZE = 17; +var DivariantHandle = _DivariantHandle; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/annotationScene.ts +var { ZIndexMap: ZIndexMap2 } = import_ag_charts_community43._ModuleSupport; +var AnnotationScene = class extends import_ag_charts_community43._ModuleSupport.Group { + constructor() { + super(...arguments); + this.name = "AnnotationScene"; + this.zIndex = ZIndexMap2.CHART_ANNOTATION; + } + static isCheck(value, type) { + return (0, import_ag_charts_core28.isObject)(value) && Object.hasOwn(value, "type") && value.type === type; + } + toggleHovered(hovered, active, readOnly) { + if (readOnly === true) + return; + this.toggleHandles(hovered || active); + } + computeBBoxWithoutHandles() { + return import_ag_charts_community43._ModuleSupport.Transformable.toCanvas( + this, + import_ag_charts_community43._ModuleSupport.Group.computeChildrenBBox(this.excludeChildren({ instance: Handle2 })) + ); + } + updateNode(constructor, node, isConfigured) { + if (!isConfigured && node) { + node.remove(); + return; + } + if (isConfigured && node == null) { + node = new constructor(); + this.appendChild(node); + } + return node; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/pointScene.ts +var import_ag_charts_community45 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/utils/coords.ts +var import_ag_charts_community44 = require("ag-charts-community"); +var import_ag_charts_core29 = require("ag-charts-core"); +var { ContinuousScale: ContinuousScale2, Vec2: Vec23, toRadians: toRadians3 } = import_ag_charts_community44._ModuleSupport; +function snapPoint(offset, context, snapping = false, origin, angleStep = 1) { + if (!snapping) + return invertCoords(offset, context); + const center = origin ? convertPoint(origin, context) : Vec23.origin(); + return invertCoords(snapToAngle(offset, center, angleStep), context); +} +function snapToAngle(vector, center, step) { + const radial = Vec23.sub(vector, center); + const stepRadians = toRadians3(step); + const theta = Math.round(Vec23.angle(radial) / stepRadians) * stepRadians; + return Vec23.rotate(radial, theta, center); +} +function getDragStartState(points, context) { + const dragState = {}; + for (const [name, point] of (0, import_ag_charts_core29.entries)(points)) { + dragState[name] = convertPoint(point, context); + } + return dragState; +} +function translate(vectors, translation, context, options = { + overflowContinuous: 0, + translateVectors: void 0, + invertYVectors: void 0, + snap: void 0 +}) { + const { xAxis, yAxis } = context; + const vectorNames = Object.keys(vectors); + const overflowsX = []; + const overflowsY = []; + const translateVectors = new Set(options.translateVectors ?? vectorNames); + const invertYVectors = new Set(options.invertYVectors ?? []); + const movingVectors = /* @__PURE__ */ new Set([...translateVectors, ...invertYVectors]); + const invertYTranslation = Vec23.multiply(translation, Vec23.from(1, -1)); + for (const name of vectorNames) { + if (movingVectors.has(name)) { + vectors[name] = Vec23.add(vectors[name], invertYVectors.has(name) ? invertYTranslation : translation); + if (options.snap) { + vectors[name] = snapToAngle(vectors[name], options.snap.vectors[name], options.snap.angle); + } + } + overflowsX.push(xAxis.getRangeOverflow(vectors[name].x)); + overflowsY.push(yAxis.getRangeOverflow(vectors[name].y)); + } + const sortNumbersAbs = (a, b) => Math.abs(a) - Math.abs(b); + const overflowDirection = (scale, directionTranslation, overflows) => { + if (options.overflowContinuous === 0 || !ContinuousScale2.is(scale)) { + return overflows.toSorted(sortNumbersAbs).at(-1) ?? 0; + } + if (vectorNames.length === movingVectors.size) { + return overflows.toSorted(sortNumbersAbs).at(-options.overflowContinuous - 1) ?? 0; + } + if (overflows.filter((value) => value !== 0).length <= options.overflowContinuous) { + return 0; + } + const newTranslatedOverflows = overflows.filter( + (value, index) => value !== 0 && Math.abs(value) <= Math.abs(directionTranslation) && movingVectors.has(vectorNames[index]) + ); + return newTranslatedOverflows.toSorted(sortNumbersAbs).at(-1) ?? 0; + }; + const overflow = Vec23.from( + overflowDirection(xAxis.scale, translation.x, overflowsX), + overflowDirection(yAxis.scale, translation.y, overflowsY) + ); + if (!Vec23.equal(overflow, Vec23.origin())) { + for (const name of vectorNames) { + if (!movingVectors.has(name)) + continue; + vectors[name] = Vec23.round(Vec23.sub(vectors[name], overflow), 4); + } + } + const result = {}; + for (const name of vectorNames) { + result[name] = invertCoords(vectors[name], context); + } + return result; +} + +// packages/ag-charts-enterprise/src/features/annotations/scenes/pointScene.ts +var { Vec2: Vec24 } = import_ag_charts_community45._ModuleSupport; +var PointScene = class extends AnnotationScene { + constructor() { + super(...arguments); + this.handle = new DivariantHandle(); + this.anchor = { + x: 0, + y: 0, + position: "above" + }; + } + update(datum, context) { + const coords = convertPoint(datum, context); + this.updateHandle(datum, coords); + this.anchor = this.updateAnchor(datum, coords, context); + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ handle: datum }, context) + }; + } + drag(datum, target, context) { + const { dragState } = this; + if (!datum.isWriteable() || !dragState) + return; + const { point } = translate({ point: dragState.handle }, Vec24.sub(target, dragState.offset), context); + datum.x = point.x; + datum.y = point.y; + } + translate(datum, translation, context) { + if (!datum.isWriteable()) + return; + const { point } = translate({ point: convertPoint(datum, context) }, translation, context); + datum.x = point.x; + datum.y = point.y; + } + toggleHandles(show) { + this.handle.visible = Boolean(show); + this.handle.toggleHovered(this.activeHandle === "handle"); + } + toggleActive(active) { + this.toggleHandles(active); + this.handle.toggleActive(active); + } + stopDragging() { + this.handle.toggleDragging(false); + } + copy(datum, copiedDatum, context) { + const coords = convertPoint(datum, context); + const point = invertCoords({ x: coords.x - 30, y: coords.y - 30 }, context); + copiedDatum.x = point.x; + copiedDatum.y = point.y; + return copiedDatum; + } + getAnchor() { + return this.anchor; + } + getCursor() { + return "pointer"; + } + containsPoint(x, y) { + const { handle: handle2 } = this; + this.activeHandle = void 0; + if (handle2.containsPoint(x, y)) { + this.activeHandle = "handle"; + return true; + } + return false; + } + getNodeAtCoords(x, y) { + if (this.handle.containsPoint(x, y)) + return "handle"; + } + updateHandle(datum, point, bbox) { + const { x, y } = this.getHandleCoords(datum, point, bbox); + const styles = this.getHandleStyles(datum); + this.handle.update({ ...styles, x, y }); + this.handle.toggleLocked(datum.locked ?? false); + } + updateAnchor(datum, point, context) { + const coords = this.getHandleCoords(datum, point); + return { + x: coords.x + context.seriesRect.x, + y: coords.y + context.seriesRect.y, + position: this.anchor.position + }; + } + getHandleCoords(_datum, point, _bbox) { + return { + x: point.x, + y: point.y + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/shapePointScene.ts +var ShapePointScene = class extends PointScene { + constructor() { + super(); + this.append([this.handle]); + } + update(datum, context) { + super.update(datum, context); + const coords = convertPoint(datum, context); + this.updateShape(datum, coords); + } + updateShape(datum, point) { + this.updateShapeStyles(datum); + this.updateShapePath(datum, point); + } + updateShapeStyles(datum) { + const { shape } = this; + shape.fill = datum.fill; + shape.fillOpacity = datum.fillOpacity ?? 1; + } + updateShapePath(datum, point) { + const { shape } = this; + shape.x = point.x; + shape.y = point.y; + shape.size = datum.size; + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.shape.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.shape.containsPoint(x, y)) + return "shape"; + return super.getNodeAtCoords(x, y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-up/arrowUpScene.ts +var arrowUpPoints = [ + [0.5, 0], + [1, 0.5], + [0.75, 0.5], + [0.75, 1], + [0.25, 1], + [0.25, 0.5], + [0, 0.5] +]; +function arrowUp(params) { + import_ag_charts_community46._ModuleSupport.drawMarkerUnitPolygon(params, arrowUpPoints); +} +arrowUp.anchor = { x: 0.5, y: 0 }; +var ArrowUpScene = class extends ShapePointScene { + constructor() { + super(); + this.type = "arrow-up" /* ArrowUp */; + this.shape = new AnnotationShape({ shape: arrowUp }); + this.append([this.shape]); + } + static is(value) { + return AnnotationScene.isCheck(value, "arrow-up" /* ArrowUp */); + } + getHandleCoords(datum, point) { + const halfSize = DivariantHandle.HANDLE_SIZE / 2; + const handleCoords = super.getHandleCoords(datum, point); + handleCoords.y -= halfSize; + return handleCoords; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-down/arrowDownScene.ts +var arrowDownPoints = arrowUpPoints.map(([x, y]) => [x, 1 - y]); +function arrowDown(params) { + import_ag_charts_community47._ModuleSupport.drawMarkerUnitPolygon(params, arrowDownPoints); +} +arrowDown.anchor = { x: 0.5, y: 1 }; +var ArrowDownScene = class extends ShapePointScene { + constructor() { + super(); + this.type = "arrow-down" /* ArrowDown */; + this.shape = new AnnotationShape({ shape: arrowDown }); + this.append([this.shape]); + } + static is(value) { + return AnnotationScene.isCheck(value, "arrow-down" /* ArrowDown */); + } + updateAnchor(datum, point, context) { + const anchor = super.updateAnchor(datum, point, context); + anchor.y -= datum.size; + return anchor; + } + getHandleCoords(datum, point) { + const halfSize = DivariantHandle.HANDLE_SIZE / 2; + const handleCoords = super.getHandleCoords(datum, point); + handleCoords.y += halfSize; + return handleCoords; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/states/pointState.ts +var import_ag_charts_community48 = require("ag-charts-community"); +var { StateMachine: StateMachine2, StateMachineProperty: StateMachineProperty2, Debug: Debug2 } = import_ag_charts_community48._ModuleSupport; +var PointStateMachine = class extends StateMachine2 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ x: point.x, y: point.y }); + ctx.create(datum); + }; + const actionFirstRender = () => { + this.node?.toggleActive(true); + ctx.showAnnotationOptions(); + ctx.update(); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + cancel: StateMachine2.parent, + reset: StateMachine2.parent + }, + "waiting-first-render": { + render: { + target: StateMachine2.parent, + action: actionFirstRender + } + } + }); + this.debug = Debug2.create(true, "annotations"); + } +}; +__decorateClass([ + StateMachineProperty2() +], PointStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/arrow-down/arrowDownState.ts +var ArrowDownStateMachine = class extends PointStateMachine { + createDatum() { + return new ArrowDownProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-down/arrowDownConfig.ts +var arrowDownConfig = { + type: "arrow-down" /* ArrowDown */, + datum: ArrowDownProperties, + scene: ArrowDownScene, + isDatum: ArrowDownProperties.is, + translate: (node, datum, translation, context) => { + if (ArrowDownProperties.is(datum) && ArrowDownScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (ArrowDownProperties.is(datum) && ArrowDownProperties.is(copiedDatum) && ArrowDownScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ArrowDownProperties.is(datum) && ArrowDownScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ArrowDownStateMachine({ + ...ctx, + create: createDatum("arrow-down" /* ArrowDown */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-up/arrowUpProperties.ts +var import_ag_charts_community49 = require("ag-charts-community"); +var import_ag_charts_core30 = require("ag-charts-core"); +var { Property: Property30 } = import_ag_charts_community49._ModuleSupport; +var ArrowUpProperties = class extends ShapePointProperties { + constructor() { + super(...arguments); + this.type = "arrow-up" /* ArrowUp */; + } + static is(value) { + return (0, import_ag_charts_core30.isObject)(value) && value.type === "arrow-up" /* ArrowUp */; + } +}; +__decorateClass([ + Property30 +], ArrowUpProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/arrow-up/arrowUpState.ts +var ArrowUpStateMachine = class extends PointStateMachine { + createDatum() { + return new ArrowUpProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-up/arrowUpConfig.ts +var arrowUpConfig = { + type: "arrow-up" /* ArrowUp */, + datum: ArrowUpProperties, + scene: ArrowUpScene, + isDatum: ArrowUpProperties.is, + translate: (node, datum, translation, context) => { + if (ArrowUpProperties.is(datum) && ArrowUpScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (ArrowUpProperties.is(datum) && ArrowUpProperties.is(copiedDatum) && ArrowUpScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ArrowUpProperties.is(datum) && ArrowUpScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ArrowUpStateMachine({ + ...ctx, + create: createDatum("arrow-up" /* ArrowUp */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutScene.ts +var import_ag_charts_community53 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/textualStartEndScene.ts +var import_ag_charts_community52 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/startEndScene.ts +var import_ag_charts_community51 = require("ag-charts-community"); +var import_ag_charts_core31 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/linearScene.ts +var import_ag_charts_community50 = require("ag-charts-community"); +var { Vec2: Vec25, Vec4 } = import_ag_charts_community50._ModuleSupport; +var LinearScene = class extends AnnotationScene { + constructor() { + super(...arguments); + this.overflowContinuous = 0; + } + extendLine({ x1, y1, x2, y2 }, datum, context) { + const linePoints = { x1, y1, x2, y2 }; + if (!datum.extendStart && !datum.extendEnd) { + return linePoints; + } + const [left, right] = boundsIntersections(linePoints, context.yAxis.bounds); + const isFlippedX = linePoints.x2 < linePoints.x1; + const isFlippedY = linePoints.y1 >= linePoints.y2; + const isVertical = linePoints.x2 === linePoints.x1; + if (datum.extendEnd) { + if (isVertical) { + linePoints.y2 = isFlippedY ? right.y : left.y; + } else { + linePoints.x2 = isFlippedX ? left.x : right.x; + linePoints.y2 = isFlippedX ? left.y : right.y; + } + } + if (datum.extendStart) { + if (isVertical) { + linePoints.y1 = isFlippedY ? left.y : right.y; + } else { + linePoints.x1 = isFlippedX ? right.x : left.x; + linePoints.y1 = isFlippedX ? right.y : left.y; + } + } + return linePoints; + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ start: datum.start, end: datum.end }, context) + }; + } + drag(datum, target, context, snapping) { + if (!datum.isWriteable()) + return; + if (this.activeHandle) { + this.dragHandle(datum, target, context, snapping); + } else { + this.dragAll(datum, target, context); + } + } + dragAll(datum, target, context) { + const { dragState } = this; + if (!dragState) + return; + this.translatePoints(datum, dragState.start, dragState.end, Vec25.sub(target, dragState.offset), context); + } + translate(datum, translation, context) { + if (!datum.isWriteable()) + return; + this.translatePoints( + datum, + convertPoint(datum.start, context), + convertPoint(datum.end, context), + translation, + context + ); + } + copy(datum, copiedDatum, context) { + const coords = convertLine(datum, context); + if (!coords) { + return; + } + const bbox = this.computeBBoxWithoutHandles(); + const translation = { x: -bbox.width / 2, y: -bbox.height / 2 }; + this.translatePoints(copiedDatum, Vec4.start(coords), Vec4.end(coords), translation, context); + return copiedDatum; + } + translatePoints(datum, start, end, translation, context) { + const vectors = this.getTranslatePointsVectors(start, end); + const points = translate(vectors, translation, context, { + overflowContinuous: this.overflowContinuous + }); + datum.start.x = points.start.x; + datum.end.x = points.end.x; + datum.start.y = points.start.y; + datum.end.y = points.end.y; + } + getTranslatePointsVectors(start, end) { + return { start, end }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/startEndScene.ts +var { Vec2: Vec26, Vec4: Vec42 } = import_ag_charts_community51._ModuleSupport; +var StartEndScene = class extends LinearScene { + constructor() { + super(...arguments); + this.start = new DivariantHandle(); + this.end = new DivariantHandle(); + this.anchor = { + x: 0, + y: 0, + position: "above" + }; + } + update(datum, context) { + const coords = convertLine(datum, context); + if (coords == null) { + return; + } + this.updateHandles(datum, coords); + this.updateAnchor(datum, coords, context); + } + toggleHandles(show) { + if (typeof show === "boolean") { + this.start.visible = show; + this.end.visible = show; + } else { + for (const [handle2, visible] of (0, import_ag_charts_core31.entries)(show)) { + this[handle2].visible = visible; + } + } + this.start.toggleHovered(this.activeHandle === "start"); + this.end.toggleHovered(this.activeHandle === "end"); + } + toggleActive(active) { + this.toggleHandles(active); + this.start.toggleActive(active); + this.end.toggleActive(active); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, dragState } = this; + if (!activeHandle || !dragState) + return; + this[activeHandle].toggleDragging(true); + const snapHandle = activeHandle === "start" ? "end" : "start"; + const snap = snapping ? { vectors: { [activeHandle]: convertPoint(datum[snapHandle], context) }, angle: datum.snapToAngle } : void 0; + const { [activeHandle]: point } = translate( + { [activeHandle]: dragState[activeHandle] }, + Vec26.sub(target, dragState.offset), + context, + { overflowContinuous: 0, snap } + ); + datum[activeHandle].x = point.x; + datum[activeHandle].y = point.y; + } + stopDragging() { + this.start.toggleDragging(false); + this.end.toggleDragging(false); + } + getAnchor() { + return this.anchor; + } + getCursor() { + return "pointer"; + } + containsPoint(x, y) { + const { start, end } = this; + this.activeHandle = void 0; + if (start.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + if (end.containsPoint(x, y)) { + this.activeHandle = "end"; + return true; + } + return false; + } + getNodeAtCoords(x, y) { + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y)) + return "handle"; + } + updateHandles(datum, coords, bbox) { + this.start.update({ + ...this.getHandleStyles(datum, "start"), + ...this.getHandleCoords(datum, coords, "start") + }); + this.end.update({ + ...this.getHandleStyles(datum, "end"), + ...this.getHandleCoords(datum, coords, "end", bbox) + }); + this.start.toggleLocked(datum.locked ?? false); + this.end.toggleLocked(datum.locked ?? false); + } + updateAnchor(_datum, coords, context, _bbox) { + this.anchor = { + x: coords.x1 + context.seriesRect.x, + y: coords.y1 + context.seriesRect.y, + position: this.anchor.position + }; + } + getHandleCoords(_datum, coords, handle2, _bbox) { + return handle2 === "start" ? Vec42.start(coords) : Vec42.end(coords); + } + getHandleStyles(datum, _handle) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/textualStartEndScene.ts +var { Vec4: Vec43 } = import_ag_charts_community52._ModuleSupport; +var TextualStartEndScene = class extends StartEndScene { + constructor() { + super(...arguments); + this.label = new import_ag_charts_community52._ModuleSupport.Text({ zIndex: 1 }); + this.anchor = { + x: 0, + y: 0, + position: "above-left" + }; + } + setTextInputBBox(bbox) { + this.textInputBBox = bbox; + this.markDirty("TextualStartEndScene"); + } + update(datum, context) { + const coords = convertLine(datum, context); + if (coords == null) { + return; + } + const bbox = this.getTextBBox(datum, coords); + this.updateLabel(datum, bbox, coords); + this.updateHandles(datum, coords, bbox); + this.updateShape(datum, bbox, coords); + this.updateAnchor(datum, coords, context, bbox); + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.label.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.label.containsPoint(x, y)) + return "text"; + return super.getNodeAtCoords(x, y); + } + getTextBBox(datum, coords) { + const { text: text2 } = datum.getText(); + return getBBox(datum, text2, Vec43.end(coords), this.textInputBBox); + } + updateLabel(datum, bbox, coords) { + const { text: text2, isPlaceholder } = datum.getText(); + updateTextNode(this.label, text2, isPlaceholder, datum, this.getLabelCoords(datum, bbox, coords)); + } + updateShape(_datum, _textBBox, _coords) { + } + getLabelCoords(_datum, _bbox, coords) { + return Vec43.end(coords); + } + getHandleStyles(datum, handle2) { + return { + ...super.getHandleStyles(datum, handle2), + stroke: datum.handle.stroke ?? datum.color + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutScene.ts +var { drawCorner, Path: Path5 } = import_ag_charts_community53._ModuleSupport; +var CalloutScene = class extends TextualStartEndScene { + constructor() { + super(); + this.type = "callout" /* Callout */; + this.shape = new Path5(); + this.append([this.shape, this.label, this.start, this.end]); + } + static is(value) { + return AnnotationScene.isCheck(value, "callout" /* Callout */); + } + drag(datum, target, context, snapping) { + if (!datum.isWriteable()) + return; + if (this.activeHandle === "end") { + this.dragHandle(datum, target, context, snapping); + } else { + this.dragAll(datum, target, context); + } + } + getLabelCoords(datum, bbox, coords) { + const padding = datum.getPadding(); + const { + bodyBounds = { + x: 0, + y: 0, + width: 0, + height: 0 + } + } = this.getDimensions(datum, bbox, coords) ?? {}; + return { + x: bodyBounds.x + padding.left, + y: bodyBounds.y - padding.bottom + }; + } + getHandleStyles(datum, handle2) { + return handle2 === "start" ? { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + } : { fill: void 0, strokeWidth: 0 }; + } + updateAnchor(datum, coords, context, bbox) { + const { bodyBounds } = this.getDimensions(datum, bbox, coords) ?? {}; + const bounds = bodyBounds ?? bbox; + this.anchor = { + x: bounds.x + context.seriesRect.x, + y: bounds.y + context.seriesRect.y - bounds.height, + position: this.anchor.position + }; + } + updateShape(datum, textBBox, coords) { + const { shape } = this; + shape.fill = datum.fill; + shape.fillOpacity = datum.fillOpacity ?? 1; + shape.stroke = datum.stroke; + shape.strokeWidth = datum.strokeWidth ?? 1; + shape.strokeOpacity = datum.strokeOpacity ?? 1; + const { tailPoint, bodyBounds } = this.getDimensions(datum, textBBox, coords) ?? {}; + if (!tailPoint || !bodyBounds) { + return; + } + this.updatePath(tailPoint, bodyBounds); + } + updatePath(tailPoint, bodyBounds) { + const { x: tailX, y: tailY } = tailPoint; + const { x, y, width, height } = bodyBounds; + const top = y - height; + const right = x + width; + const placement = this.calculateCalloutPlacement({ x: tailX, y: tailY }, bodyBounds); + const cornerRadius = 8; + const pathParams = [ + { + coordinates: { + x0: x, + x1: x + cornerRadius, + y0: top + cornerRadius, + y1: top, + cx: placement === `topLeft` ? tailX : x + cornerRadius, + cy: placement === `topLeft` ? tailY : top + cornerRadius + }, + type: placement === `topLeft` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: x + cornerRadius, + x1: right - cornerRadius, + y0: top, + y1: top, + cx: tailX, + cy: tailY + }, + type: placement === `top` ? "calloutSide" : "side" + }, + { + coordinates: { + x0: right - cornerRadius, + x1: right, + y0: top, + y1: top + cornerRadius, + cx: placement === `topRight` ? tailX : right - cornerRadius, + cy: placement === `topRight` ? tailY : top + cornerRadius + }, + type: placement === `topRight` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: right, + x1: right, + y0: top + cornerRadius, + y1: y - cornerRadius, + cx: tailX, + cy: tailY + }, + type: placement === `right` ? "calloutSide" : "side" + }, + { + coordinates: { + x0: right, + x1: right - cornerRadius, + y0: y - cornerRadius, + y1: y, + cx: placement === `bottomRight` ? tailX : right - cornerRadius, + cy: placement === `bottomRight` ? tailY : y - cornerRadius + }, + type: placement === `bottomRight` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: right - cornerRadius, + x1: x + cornerRadius, + y0: y, + y1: y, + cx: tailX, + cy: tailY + }, + type: placement === `bottom` ? "calloutSide" : "side" + }, + { + coordinates: { + x0: x + cornerRadius, + x1: x, + y0: y, + y1: y - cornerRadius, + cx: placement === `bottomLeft` ? tailX : x + cornerRadius, + cy: placement === `bottomLeft` ? tailY : y - cornerRadius + }, + type: placement === `bottomLeft` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: x, + x1: x, + y0: y - cornerRadius, + y1: top + cornerRadius, + cx: tailX, + cy: tailY + }, + type: placement === `left` ? "calloutSide" : "side" + } + ]; + const { path } = this.shape; + path.clear(); + path.moveTo(x, top + cornerRadius); + for (const { coordinates, type } of pathParams) { + this.drawPath(path, coordinates, cornerRadius, type); + } + path.closePath(); + } + drawPath(path, { x0, y0, x1, y1, cx, cy }, cornerRadius, type) { + const sideTailRadius = 6; + switch (type) { + case "calloutCorner": { + path.lineTo(cx, cy); + path.lineTo(x1, y1); + break; + } + case "corner": { + drawCorner( + path, + { + x0, + x1, + y0, + y1, + cx, + cy + }, + cornerRadius, + false + ); + break; + } + case "calloutSide": { + if (x0 === x1) { + const direction = y0 > y1 ? -1 : 1; + const midY = Math.min(y0, y1) + Math.abs(y0 - y1) / 2; + path.lineTo(x0, midY - sideTailRadius * direction); + path.lineTo(cx, cy); + path.lineTo(x0, midY + sideTailRadius * direction); + path.lineTo(x1, y1); + } else { + const direction = x0 > x1 ? -1 : 1; + const midX = Math.min(x0, x1) + Math.abs(x1 - x0) / 2; + path.lineTo(midX - sideTailRadius * direction, y0); + path.lineTo(cx, cy); + path.lineTo(midX + sideTailRadius * direction, y0); + path.lineTo(x1, y1); + } + break; + } + case "side": + default: { + path.lineTo(x1, y1); + break; + } + } + } + calculateCalloutPlacement(placement, bounds) { + const right = bounds.x + bounds.width; + const top = bounds.y - bounds.height; + let xPlacement; + let yPlacement; + if (placement.x > right) { + xPlacement = "right"; + } else if (placement.x < bounds.x) { + xPlacement = "left"; + } + if (placement.y > bounds.y) { + yPlacement = "bottom"; + } else if (placement.y < top) { + yPlacement = "top"; + } + if (xPlacement && yPlacement) { + return `${yPlacement}${xPlacement[0].toUpperCase()}${xPlacement.substring(1)}`; + } else { + return yPlacement ?? xPlacement; + } + } + getDimensions(datum, textBBox, coords) { + const { fontSize } = datum; + const padding = datum.getPadding(); + const horizontalPadding = padding.left + padding.right; + const verticalPadding = padding.top + padding.bottom; + const width = textBBox.width + horizontalPadding; + const height = Math.max(textBBox.height + verticalPadding, fontSize + verticalPadding); + return { + tailPoint: { + x: coords.x1, + y: coords.y1 + }, + bodyBounds: { + x: textBBox.x, + y: textBBox.y, + width, + height + } + }; + } + containsPoint(x, y) { + const { start, end, shape } = this; + this.activeHandle = void 0; + if (start.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + const bodyContainsPoint = end.containsPoint(x, y) || shape.containsPoint(x, y); + if (bodyContainsPoint) { + this.activeHandle = "end"; + } + return bodyContainsPoint; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/states/textualStartEndState.ts +var import_ag_charts_community54 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/states/textualStateUtils.ts +function guardCancelAndExit({ key }) { + return key === "Escape"; +} +function guardSaveAndExit({ key, shiftKey }) { + return !shiftKey && key === "Enter"; +} + +// packages/ag-charts-enterprise/src/features/annotations/states/textualStartEndState.ts +var { StateMachine: StateMachine3, StateMachineProperty: StateMachineProperty3, Debug: Debug3 } = import_ag_charts_community54._ModuleSupport; +var TextualStartEndStateMachine = class extends StateMachine3 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point, visible: true }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ start: true }); + }; + const onStartEditing = () => { + ctx.showTextInput(); + if (this.datum) + this.datum.visible = false; + }; + const onStopEditing = () => { + ctx.hideTextInput(); + if (this.datum) + this.datum.visible = true; + ctx.deselect(); + }; + const actionUpdateTextInputBBox = (bbox) => { + this.node?.setTextInputBBox(bbox); + ctx.update(); + }; + const onEndHover = ({ point }) => { + const { datum, node } = this; + datum?.set({ end: point }); + node?.toggleActive(true); + node?.toggleHandles({ end: false }); + ctx.update(); + }; + const onEndClick = () => { + ctx.showAnnotationOptions(); + this.node?.toggleHandles({ end: true }); + }; + const actionColor = ({ + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }) => { + const { datum } = this; + if (!datum) + return; + if (colorPickerType === "text-color") { + ctx.updateTextInputColor(color6); + } + setColor(datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + ctx.update(); + }; + const actionFontSize = (fontSize) => { + const { datum, node } = this; + if (!datum || !node || !isTextType(datum)) + return; + datum.fontSize = fontSize; + ctx.updateTextInputFontSize(fontSize); + ctx.update(); + }; + const actionCancel = () => { + ctx.delete(); + }; + const actionSave = ({ textInputValue, bbox }) => { + const { datum } = this; + if (bbox != null && textInputValue != null && textInputValue.length > 0) { + if (!isTextType(datum)) { + return; + } + const wrappedText = maybeWrapText(datum, textInputValue, bbox.width); + datum?.set({ text: wrappedText }); + ctx.update(); + ctx.recordAction(`Create ${datum?.type} annotation`); + } else { + ctx.delete(); + } + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + dragStart: { + target: "waiting-first-render", + action: actionCreate + }, + cancel: StateMachine3.parent, + reset: StateMachine3.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: onEndHover, + drag: onEndHover, + click: { + target: "edit", + action: onEndClick + }, + dragEnd: { + target: "edit", + action: onEndClick + }, + reset: { + target: StateMachine3.parent, + action: actionCancel + }, + cancel: { + target: StateMachine3.parent, + action: actionCancel + } + }, + edit: { + onEnter: onStartEditing, + updateTextInputBBox: actionUpdateTextInputBBox, + color: actionColor, + fontSize: actionFontSize, + textInput: [ + { + guard: guardCancelAndExit, + target: StateMachine3.parent, + action: actionCancel + }, + { + guard: guardSaveAndExit, + target: StateMachine3.parent, + action: actionSave + } + ], + click: { + target: StateMachine3.parent, + action: actionSave + }, + dragStart: { + target: StateMachine3.parent, + action: actionSave + }, + resize: { + target: StateMachine3.parent, + action: actionSave + }, + onExit: onStopEditing, + cancel: { + target: StateMachine3.parent, + action: actionCancel + } + } + }); + this.debug = Debug3.create(true, "annotations"); + } +}; +__decorateClass([ + StateMachineProperty3() +], TextualStartEndStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty3() +], TextualStartEndStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutState.ts +var CalloutStateMachine = class extends TextualStartEndStateMachine { + createDatum() { + return new CalloutProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutConfig.ts +var calloutConfig = { + type: "callout" /* Callout */, + datum: CalloutProperties, + scene: CalloutScene, + isDatum: CalloutProperties.is, + translate: (node, datum, transition, context) => { + if (CalloutProperties.is(datum) && CalloutScene.is(node)) + return node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (CalloutProperties.is(datum) && CalloutProperties.is(copiedDatum) && CalloutScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (CalloutProperties.is(datum) && CalloutScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CalloutStateMachine({ + ...ctx, + create: createDatum("callout" /* Callout */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentScene.ts +var import_ag_charts_community56 = require("ag-charts-community"); +var import_ag_charts_core32 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/textualPointScene.ts +var import_ag_charts_community55 = require("ag-charts-community"); +var TextualPointScene = class extends PointScene { + constructor() { + super(...arguments); + this.label = new import_ag_charts_community55._ModuleSupport.Text({ zIndex: 1 }); + this.anchor = { + x: 0, + y: 0, + position: "above-left" + }; + } + setTextInputBBox(bbox) { + this.textInputBBox = bbox; + this.markDirty("TextualPointScene"); + } + update(datum, context) { + const coords = convertPoint(datum, context); + const bbox = this.getTextBBox(datum, coords, context); + this.updateLabel(datum, bbox); + this.updateHandle(datum, coords, bbox); + this.updateShape(datum, bbox); + this.anchor = this.updateAnchor(datum, bbox, context); + } + copy(datum, copiedDatum, context) { + const coords = convertPoint(datum, context); + const bbox = this.getTextBBox(datum, coords, context); + const padding = datum.getPadding(); + const horizontalPadding = padding.left + padding.right; + const verticalPadding = padding.top + padding.bottom; + const xOffset = (bbox.width + horizontalPadding) / 2; + const yOffset = bbox.height + verticalPadding; + const point = invertCoords({ x: coords.x - xOffset, y: coords.y - yOffset }, context); + copiedDatum.x = point.x; + copiedDatum.y = point.y; + return copiedDatum; + } + containsPoint(x, y) { + const { label } = this; + return super.containsPoint(x, y) || label.visible && label.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.label.visible && this.label.containsPoint(x, y)) + return "text"; + return super.getNodeAtCoords(x, y); + } + getTextBBox(datum, coords, _context) { + const { text: text2 } = datum.getText(); + return getBBox(datum, text2, { x: coords.x, y: coords.y }, this.textInputBBox); + } + updateLabel(datum, bbox) { + const { text: text2, isPlaceholder } = datum.getText(); + updateTextNode( + this.label, + text2, + isPlaceholder, + datum, + this.getLabelCoords(datum, bbox), + this.getTextBaseline(datum) + ); + } + updateShape(_datum, _bbox) { + } + updateAnchor(_datum, bbox, context) { + return { + x: bbox.x + context.seriesRect.x, + y: bbox.y + context.seriesRect.y - bbox.height, + position: this.anchor.position + }; + } + getLabelCoords(_datum, bbox) { + return bbox; + } + getTextBaseline(datum) { + return datum.position == "center" ? "middle" : datum.position; + } + getHandleCoords(_datum, _coords, bbox) { + return bbox; + } + getHandleStyles(datum) { + const styles = super.getHandleStyles(datum); + styles.stroke = datum.handle.stroke ?? datum.color; + return styles; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentScene.ts +var { drawCorner: drawCorner2 } = import_ag_charts_community56._ModuleSupport; +var CommentScene = class extends TextualPointScene { + constructor() { + super(); + this.type = "comment" /* Comment */; + this.shape = new import_ag_charts_community56._ModuleSupport.Path(); + this.append([this.shape, this.label, this.handle]); + } + static is(value) { + return AnnotationScene.isCheck(value, "comment" /* Comment */); + } + updateShape(datum, bbox) { + const { shape } = this; + shape.fill = datum.fill; + shape.fillOpacity = datum.fillOpacity ?? 1; + shape.stroke = datum.stroke ?? "transparent"; + shape.strokeWidth = datum.strokeWidth ?? 1; + shape.strokeOpacity = datum.strokeOpacity ?? 1; + this.updatePath(datum, bbox); + } + getLabelCoords(datum, point) { + const padding = datum.getPadding(); + return { + x: point.x + padding.left, + y: point.y - padding.bottom + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke ?? datum.fill, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } + updateAnchor(datum, bbox, context) { + const anchor = super.updateAnchor(datum, bbox, context); + const padding = datum.getPadding(); + anchor.y -= padding.bottom + padding.top; + return anchor; + } + updatePath(datum, bbox) { + const padding = datum.getPadding(); + const { x, y } = bbox; + let { width, height } = bbox; + const { fontSize } = datum; + const horizontalPadding = padding.left + padding.right; + const verticalPadding = padding.top + padding.bottom; + width = width + horizontalPadding; + height = Math.max(height + verticalPadding, fontSize + verticalPadding); + const top = y - height; + const right = x + width; + const cornerRadius = ((0, import_ag_charts_core32.calcLineHeight)(fontSize, ANNOTATION_TEXT_LINE_HEIGHT) + verticalPadding) / 2; + const { path } = this.shape; + path.clear(); + path.moveTo(x, y); + path.lineTo(x, top + cornerRadius); + drawCorner2( + path, + { + x0: x, + x1: x + cornerRadius, + y0: top + cornerRadius, + y1: top, + cx: x + cornerRadius, + cy: top + cornerRadius + }, + cornerRadius, + false + ); + path.lineTo(right - cornerRadius, top); + drawCorner2( + path, + { + x0: right - cornerRadius, + x1: right, + y0: top, + y1: top + cornerRadius, + cx: right - cornerRadius, + cy: top + cornerRadius + }, + cornerRadius, + false + ); + path.lineTo(right, y - cornerRadius); + drawCorner2( + path, + { + x0: right, + x1: right - cornerRadius, + y0: y - cornerRadius, + y1: y, + cx: right - cornerRadius, + cy: y - cornerRadius + }, + cornerRadius, + false + ); + path.closePath(); + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.shape.containsPoint(x, y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/states/textualPointState.ts +var import_ag_charts_community57 = require("ag-charts-community"); +var { StateMachine: StateMachine4, StateMachineProperty: StateMachineProperty4, Debug: Debug4 } = import_ag_charts_community57._ModuleSupport; +var TextualPointStateMachine = class extends StateMachine4 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ x: point.x, y: point.y }); + ctx.create(datum); + }; + const actionFirstRender = () => { + this.node?.toggleActive(true); + ctx.showAnnotationOptions(); + ctx.update(); + }; + const onStartEditing = () => { + ctx.showTextInput(); + if (this.datum) { + this.datum.visible = false; + } + }; + const onStopEditing = () => { + ctx.hideTextInput(); + if (this.datum) + this.datum.visible = true; + ctx.deselect(); + }; + const actionUpdateTextInputBBox = (bbox) => { + this.node?.setTextInputBBox(bbox); + ctx.update(); + }; + const actionColor = ({ + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }) => { + if (!this.datum) + return; + if (colorPickerType === "text-color") { + ctx.updateTextInputColor(color6); + } + setColor(this.datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + ctx.update(); + }; + const actionFontSize = (fontSize) => { + const { datum, node } = this; + if (!datum || !node || !isTextType(datum)) + return; + datum.fontSize = fontSize; + ctx.updateTextInputFontSize(fontSize); + ctx.update(); + }; + const actionCancel = () => { + ctx.delete(); + }; + const actionSave = ({ textInputValue, bbox }) => { + if (bbox != null && textInputValue != null && textInputValue.length > 0) { + const { datum } = this; + if (!isTextType(datum)) { + return; + } + const wrappedText = maybeWrapText(datum, textInputValue, bbox.width); + datum?.set({ text: wrappedText }); + ctx.update(); + ctx.recordAction(`Create ${datum?.type} annotation`); + } else { + ctx.delete(); + } + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + dragStart: { + target: "waiting-first-render", + action: actionCreate + }, + cancel: StateMachine4.parent, + reset: StateMachine4.parent + }, + "waiting-first-render": { + render: { + target: "edit", + action: actionFirstRender + } + }, + edit: { + onEnter: onStartEditing, + updateTextInputBBox: actionUpdateTextInputBBox, + color: actionColor, + fontSize: actionFontSize, + textInput: [ + { + guard: guardCancelAndExit, + target: StateMachine4.parent, + action: actionCancel + }, + { + guard: guardSaveAndExit, + target: StateMachine4.parent, + action: actionSave + } + ], + click: { + target: StateMachine4.parent, + action: actionSave + }, + dragStart: { + target: StateMachine4.parent, + action: actionSave + }, + resize: { + target: StateMachine4.parent, + action: actionSave + }, + onExit: onStopEditing, + cancel: { + target: StateMachine4.parent, + action: actionCancel + } + } + }); + this.debug = Debug4.create(true, "annotations"); + } +}; +__decorateClass([ + StateMachineProperty4() +], TextualPointStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty4() +], TextualPointStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentState.ts +var CommentStateMachine = class extends TextualPointStateMachine { + createDatum() { + return new CommentProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentConfig.ts +var commentConfig = { + type: "comment" /* Comment */, + datum: CommentProperties, + scene: CommentScene, + isDatum: CommentProperties.is, + translate: (node, datum, translation, context) => { + if (CommentProperties.is(datum) && CommentScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (CommentProperties.is(datum) && CommentProperties.is(copiedDatum) && CommentScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (CommentProperties.is(datum) && CommentScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CommentStateMachine({ + ...ctx, + create: createDatum("comment" /* Comment */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/cross-line/crossLineScene.ts +var import_ag_charts_community62 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/axisLabelScene.ts +var import_ag_charts_community58 = require("ag-charts-community"); +var { calculateLabelTranslation } = import_ag_charts_community58._ModuleSupport; +var AxisLabelScene = class extends import_ag_charts_community58._ModuleSupport.Group { + constructor() { + super({ name: "AnnotationAxisLabelGroup" }); + this.label = new import_ag_charts_community58._ModuleSupport.Text({ zIndex: 1 }); + this.rect = new import_ag_charts_community58._ModuleSupport.Rect(); + const { label } = this; + label.fontSize = 12; + label.fontFamily = "Verdana, sans-serif"; + label.fill = "black"; + label.textBaseline = "middle"; + label.textAlign = "center"; + this.append([this.rect, this.label]); + } + update(opts) { + this.updateLabel(opts); + this.updateRect(opts); + this.updatePosition(opts); + } + updateLabel({ value, styles, context }) { + const { fontWeight, fontSize, fontStyle, fontFamily, textAlign, color: color6 = "white", formatter } = styles; + const text2 = formatter ? formatter({ value }) : context.formatScaleValue(value, "annotation-label"); + this.label.setProperties({ + fontWeight, + fontSize, + fontStyle, + fontFamily, + textAlign, + fill: color6, + text: text2 + }); + } + updateRect({ styles }) { + const { rect } = this; + const { cornerRadius, fill, fillOpacity, stroke: stroke2, strokeOpacity } = styles; + rect.fill = fill; + rect.fillOpacity = fillOpacity ?? 1; + rect.stroke = stroke2; + rect.strokeOpacity = strokeOpacity ?? 1; + rect.cornerRadius = cornerRadius ?? 0; + } + updatePosition({ x, y, context, styles: { padding } }) { + const { label, rect } = this; + const labelBBox = label.getBBox()?.clone(); + const horizontalPadding = padding ?? 8; + const verticalPadding = padding ?? 4; + const { xTranslation, yTranslation } = calculateLabelTranslation({ + yDirection: true, + padding: context.labelPadding, + position: context.position ?? "left", + bbox: labelBBox + }); + labelBBox.grow(horizontalPadding, "horizontal"); + labelBBox.grow(verticalPadding, "vertical"); + const translationX = x + xTranslation; + const translationY = y + yTranslation; + label.x = translationX; + label.y = translationY; + rect.y = translationY - Math.round(labelBBox.height / 2); + rect.x = translationX - Math.round(labelBBox.width / 2); + rect.height = labelBBox.height; + rect.width = labelBBox.width; + } +}; +AxisLabelScene.className = "AxisLabel"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/collidableLineScene.ts +var import_ag_charts_community59 = require("ag-charts-community"); +var { Vec2: Vec27 } = import_ag_charts_community59._ModuleSupport; +var CollidableLine = class extends import_ag_charts_community59._ModuleSupport.Line { + constructor() { + super(...arguments); + this.growCollisionBox = 9; + this.clipMask = /* @__PURE__ */ new Map(); + } + setProperties(styles) { + super.setProperties(styles); + this.updateCollisionBBox(); + return this; + } + updateCollisionBBox() { + const { growCollisionBox, strokeWidth, x1, y1, x2, y2 } = this; + let height = strokeWidth + growCollisionBox; + if (height % 2 === 0) + height += 1; + const topLeft = Vec27.from(x1, y1 - Math.floor(height / 2)); + const bottomRight = Vec27.from(x2, y2); + const width = Vec27.distance(topLeft, bottomRight); + this.collisionBBox = new import_ag_charts_community59._ModuleSupport.BBox(topLeft.x, topLeft.y, width, height); + } + isPointInPath(pointX, pointY) { + const { collisionBBox, x1, y1, x2, y2 } = this; + if (!collisionBBox) + return false; + const v1 = Vec27.from(x1, y1); + const v2 = Vec27.from(x2, y2); + const point = Vec27.sub(Vec27.from(pointX, pointY), v1); + const end = Vec27.sub(v2, v1); + const rotated = Vec27.rotate(point, Vec27.angle(point, end), v1); + return collisionBBox.containsPoint(rotated.x, rotated.y) ?? false; + } + render(renderCtx) { + const { clipMask } = this; + const { ctx } = renderCtx; + if (clipMask.size === 0) { + super.render(renderCtx); + return; + } + ctx.save(); + try { + for (const mask of this.clipMask.values()) { + const { x, y, radius } = mask; + ctx.beginPath(); + ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height); + ctx.ellipse(x, y, radius, radius, 0, Math.PI * 2, 0, true); + ctx.clip(); + } + super.render(renderCtx); + } finally { + ctx.restore(); + } + } + setClipMask(id, mask) { + const cm = this.clipMask.get(id); + if (import_ag_charts_community59._ModuleSupport.jsonDiff(cm, mask) != null) { + this.markDirty("CollidableLine"); + } + if (mask) { + this.clipMask.set(id, mask); + } else { + this.clipMask.delete(id); + } + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/collidableTextScene.ts +var import_ag_charts_community60 = require("ag-charts-community"); +var CollidableText = class extends import_ag_charts_community60._ModuleSupport.TransformableText { + constructor() { + super(...arguments); + this.growCollisionBox = { + top: 4, + right: 4, + bottom: 4, + left: 4 + }; + } + isPointInPath(pointX, pointY) { + const localPoint = this.fromParentPoint(pointX, pointY); + const uBBox = this.computeBBoxWithoutTransforms(); + if (!uBBox) + return false; + return uBBox.grow(this.growCollisionBox).containsPoint(localPoint.x, localPoint.y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/utils/lineWithText.ts +var import_ag_charts_community61 = require("ag-charts-community"); +var { Vec2: Vec28 } = import_ag_charts_community61._ModuleSupport; +function updateLineText(id, line, coords, textProperties, textNode, text2, lineWidth) { + if (!text2 || !textNode || !textProperties) { + line.setClipMask(id); + return; + } + const { alignment, position } = textProperties; + const numbers = getNumbers(coords, textProperties.fontSize, lineWidth); + const { point, textBaseline } = positionAndAlignment(numbers, position, alignment); + setProperties(textNode, text2, textProperties, point, numbers.angle, textBaseline); + const { x, y, width, height } = textNode.getBBox(); + const diameter = Vec28.length(Vec28.from(width, height)); + const clipMask = { + x: x + width / 2, + y: y + height / 2, + radius: diameter / 2 + Vec28.length(numbers.offset) + }; + if (position === "center") { + line.setClipMask(id, clipMask); + } else { + line.setClipMask(id); + } + return { clipMask, numbers }; +} +function updateChannelText(offsetInsideTextLabel, top, bottom, textProperties, lineWidth, textNode, text2) { + if (!text2 || !textNode) + return; + const { alignment, position } = textProperties; + const [actualTop, actualBottom] = top.y1 <= bottom.y1 ? [top, bottom] : [bottom, top]; + let relativeLine = actualTop; + if (position === "bottom") { + relativeLine = actualBottom; + } else if (position === "inside") { + relativeLine = { + x1: (actualTop.x1 + actualBottom.x1) / 2, + y1: (actualTop.y1 + actualBottom.y1) / 2, + x2: (actualTop.x2 + actualBottom.x2) / 2, + y2: (actualTop.y2 + actualBottom.y2) / 2 + }; + } + const numbers = getNumbers(relativeLine, textProperties.fontSize, lineWidth); + const { point, textBaseline } = positionAndAlignment( + numbers, + position === "inside" ? "center" : position, + alignment, + offsetInsideTextLabel + ); + setProperties(textNode, text2, textProperties, point, numbers.angle, textBaseline); +} +function getNumbers(coords, fontSize, strokeWidth) { + let [left, right] = Vec28.from(coords); + if (left.x > right.x) + [left, right] = [right, left]; + const normal = Vec28.normalized(Vec28.sub(right, left)); + const angle = Vec28.angle(normal); + const inset = Vec28.multiply(normal, DivariantHandle.HANDLE_SIZE / 2 + (fontSize ?? 14) / 2); + const offset = Vec28.multiply(normal, (strokeWidth ?? 2) / 2 + (fontSize ?? 14) / 3); + return { left, right, normal, angle, inset, offset }; +} +function positionAndAlignment({ left, right, normal, angle, inset, offset }, position, alignment, offsetInsideTextLabel) { + let point; + if (alignment === "right") { + point = Vec28.sub(right, inset); + } else if (alignment === "center") { + point = Vec28.add(left, Vec28.multiply(normal, Vec28.distance(left, right) / 2)); + } else { + point = Vec28.add(left, inset); + } + let textBaseline = "bottom"; + if (position === "bottom") { + point = Vec28.rotate(offset, angle + Math.PI / 2, point); + textBaseline = "top"; + } else if (position === "center" && !offsetInsideTextLabel) { + textBaseline = "middle"; + } else { + point = Vec28.rotate(offset, angle - Math.PI / 2, point); + } + return { point, textBaseline }; +} +function setProperties(scene, text2, textProperties, point, angle, textBaseline) { + scene.setProperties({ + text: text2, + x: point.x, + y: point.y, + rotation: angle, + rotationCenterX: point.x, + rotationCenterY: point.y, + fill: textProperties.color, + fontFamily: textProperties.fontFamily, + fontSize: textProperties.fontSize, + fontStyle: textProperties.fontStyle, + fontWeight: textProperties.fontWeight, + textAlign: textProperties.alignment, + textBaseline + }); +} + +// packages/ag-charts-enterprise/src/features/annotations/cross-line/crossLineScene.ts +var { ChartAxisDirection: ChartAxisDirection6, Vec2: Vec29, Vec4: Vec44 } = import_ag_charts_community62._ModuleSupport; +var CrossLineScene = class extends AnnotationScene { + constructor() { + super(); + this.type = "cross-line"; + this.line = new CollidableLine(); + this.middle = new UnivariantHandle(); + this.isHorizontal = false; + this.append([this.line, this.middle]); + } + static is(value) { + return AnnotationScene.isCheck(value, "cross-line"); + } + update(datum, context) { + const { seriesRect } = context; + this.seriesRect = seriesRect; + this.isHorizontal = HorizontalLineProperties.is(datum); + const axisContext = this.isHorizontal ? context.yAxis : context.xAxis; + const coords = this.convertCrossLine(datum, axisContext); + if (coords == null) { + this.visible = false; + return; + } + this.visible = datum.visible ?? true; + if (!this.visible) + return; + this.updateLine(datum, coords); + this.updateHandle(datum, coords); + this.updateText(datum, coords); + this.updateAxisLabel(datum, axisContext, coords); + } + updateLine(datum, coords) { + const { line } = this; + const { lineDashOffset, stroke: stroke2, strokeWidth, strokeOpacity } = datum; + const { x1, y1, x2, y2 } = coords; + line.setProperties({ + x1, + y1, + x2, + y2, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke2, + strokeWidth, + strokeOpacity, + fillOpacity: 0 + }); + } + updateHandle(datum, coords) { + const { middle } = this; + const { locked, stroke: stroke2, strokeWidth, strokeOpacity } = datum; + const handleStyles = { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? stroke2, + strokeOpacity: datum.handle.strokeOpacity ?? strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? strokeWidth + }; + const handlePosition = Vec29.sub( + Vec44.center(coords), + Vec29.from(middle.handle.width / 2, middle.handle.height / 2) + ); + middle.gradient = this.isHorizontal ? "horizontal" : "vertical"; + middle.update({ ...handleStyles, ...handlePosition }); + middle.toggleLocked(locked ?? false); + } + updateText(datum, coords) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateLineText(this.line.id, this.line, coords, datum.text, this.text, datum.text.label, datum.strokeWidth); + } + createAxisLabel(context) { + const axisLabel2 = new AxisLabelScene(); + context.attachLabel(axisLabel2); + return axisLabel2; + } + updateAxisLabel(datum, axisContext, coords) { + this.axisLabel ?? (this.axisLabel = this.createAxisLabel(axisContext)); + const { axisLabel: axisLabel2, seriesRect } = this; + const { direction, position } = axisContext; + if (datum.axisLabel.enabled) { + axisLabel2.visible = this.visible; + const labelCorner = position === "left" || position === "top" ? Vec44.start(coords) : Vec44.end(coords); + const labelPosition = direction === ChartAxisDirection6.X ? labelCorner.x : labelCorner.y; + if (!axisContext.inRange(labelPosition)) { + axisLabel2.visible = false; + return; + } + const value = getGroupingValue(datum.value); + axisLabel2.update({ + ...Vec29.add(labelCorner, Vec29.required(seriesRect)), + value, + styles: datum.axisLabel, + context: axisContext + }); + } else { + axisLabel2.visible = false; + } + } + setAxisLabelOpacity(opacity) { + if (!this.axisLabel) + return; + this.axisLabel.opacity = opacity; + } + setAxisLabelVisible(visible) { + if (!this.axisLabel) + return; + this.axisLabel.visible = visible; + } + toggleHandles(show) { + this.middle.visible = show; + this.middle.toggleHovered(this.activeHandle === "middle"); + } + destroy() { + super.destroy(); + this.axisLabel?.destroy(); + } + toggleActive(active) { + this.toggleHandles(active); + this.middle.toggleActive(active); + } + dragStart(datum, target, context) { + const middle = HorizontalLineProperties.is(datum) ? { x: target.x, y: convert(datum.value, context.yAxis) } : { x: convert(datum.value, context.xAxis), y: target.y }; + this.dragState = { + offset: target, + middle + }; + } + drag(datum, target, context) { + const { activeHandle, dragState } = this; + if (!datum.isWriteable() || !dragState) + return; + if (activeHandle) { + this[activeHandle].toggleDragging(true); + } + this.translatePoint(datum, dragState.middle, Vec29.sub(target, dragState.offset), context); + } + translate(datum, translation, context) { + if (!datum.isWriteable()) + return; + const vector = HorizontalLineProperties.is(datum) ? Vec29.from(0, convert(datum.value, context.yAxis)) : Vec29.from(convert(datum.value, context.xAxis), 0); + this.translatePoint(datum, vector, translation, context); + } + translatePoint(datum, value, translation, context) { + const isHorizontal2 = HorizontalLineProperties.is(datum); + if (isHorizontal2) { + translation.x = 0; + } else { + translation.y = 0; + } + const { point } = translate({ point: value }, translation, context); + datum.value = isHorizontal2 ? point.y : point.x; + } + stopDragging() { + this.middle.toggleDragging(false); + } + copy(datum, copiedDatum, context) { + const isHorizontal2 = HorizontalLineProperties.is(datum); + const axisContext = this.isHorizontal ? context.yAxis : context.xAxis; + const coords = this.convertCrossLine(datum, axisContext); + if (!coords) { + return; + } + const yOffset = isHorizontal2 ? -30 : 0; + const xOffset = isHorizontal2 ? 0 : -30; + const point = invertCoords({ x: coords.x1 + xOffset, y: coords.y1 + yOffset }, context); + copiedDatum.set({ value: isHorizontal2 ? point.y : point.x }); + return copiedDatum; + } + getCursor() { + if (this.activeHandle == null) + return "pointer"; + return this[this.activeHandle].getCursor(); + } + containsPoint(x, y) { + const { middle, line, text: text2 } = this; + this.activeHandle = void 0; + if (middle.containsPoint(x, y)) { + this.activeHandle = "middle"; + return true; + } + return line.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.line.isPointInPath(x, y)) + return "line"; + if (this.middle.containsPoint(x, y)) + return "handle"; + } + getAnchor() { + const bbox = this.computeBBoxWithoutHandles(); + if (this.isHorizontal) { + return { x: bbox.x + bbox.width / 2, y: bbox.y }; + } + return { x: bbox.x + bbox.width, y: bbox.y + bbox.height / 2, position: "right" }; + } + convertCrossLine(datum, context) { + if (datum.value == null) + return; + let x1 = 0; + let y1 = 0; + let x2, y2; + const { bounds } = context; + const scaledValue = convert(datum.value, context); + if (HorizontalLineProperties.is(datum)) { + x2 = bounds.width; + y1 = scaledValue; + y2 = scaledValue; + } else { + x1 = scaledValue; + x2 = scaledValue; + y2 = bounds.height; + } + return { x1, y1, x2, y2 }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/cross-line/crossLineState.ts +var import_ag_charts_community63 = require("ag-charts-community"); +var { StateMachine: StateMachine5, StateMachineProperty: StateMachineProperty5, Debug: Debug5 } = import_ag_charts_community63._ModuleSupport; +var CrossLineStateMachine = class extends StateMachine5 { + constructor(direction, ctx) { + const onClick = ({ point }) => { + const isHorizontal2 = direction === "horizontal"; + const datum = isHorizontal2 ? new HorizontalLineProperties() : new VerticalLineProperties(); + datum.set({ value: isHorizontal2 ? point.y : point.x }); + ctx.create(datum); + ctx.recordAction( + `Create ${isHorizontal2 ? "horizontal-line" /* HorizontalLine */ : "vertical-line" /* VerticalLine */} annotation` + ); + }; + const actionFirstRender = () => { + this.node?.toggleActive(true); + ctx.showAnnotationOptions(); + ctx.update(); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: onClick + }, + drag: { + target: "waiting-first-render", + action: onClick + }, + reset: StateMachine5.parent, + cancel: StateMachine5.parent + }, + "waiting-first-render": { + render: { + target: StateMachine5.parent, + action: actionFirstRender + } + } + }); + this.debug = Debug5.create(true, "annotations"); + } +}; +__decorateClass([ + StateMachineProperty5() +], CrossLineStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/cross-line/crossLineConfig.ts +var horizontalLineConfig = { + type: "horizontal-line" /* HorizontalLine */, + datum: HorizontalLineProperties, + scene: CrossLineScene, + isDatum: HorizontalLineProperties.is, + translate: (node, datum, translation, context) => { + if (HorizontalLineProperties.is(datum) && CrossLineScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (HorizontalLineProperties.is(datum) && HorizontalLineProperties.is(copiedDatum) && CrossLineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (HorizontalLineProperties.is(datum) && CrossLineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CrossLineStateMachine("horizontal", { + ...ctx, + create: createDatum("horizontal-line" /* HorizontalLine */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var verticalLineConfig = { + type: "vertical-line" /* VerticalLine */, + datum: VerticalLineProperties, + scene: CrossLineScene, + isDatum: VerticalLineProperties.is, + translate: (node, datum, translation, context) => { + if (VerticalLineProperties.is(datum) && CrossLineScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (VerticalLineProperties.is(datum) && VerticalLineProperties.is(copiedDatum) && CrossLineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (VerticalLineProperties.is(datum) && CrossLineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CrossLineStateMachine("vertical", { + ...ctx, + create: createDatum("vertical-line" /* VerticalLine */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/disjoint-channel/disjointChannelScene.ts +var import_ag_charts_community66 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/channelScene.ts +var import_ag_charts_community65 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/withBackgroundScene.ts +var import_ag_charts_community64 = require("ag-charts-community"); +var { Vec4: Vec45 } = import_ag_charts_community64._ModuleSupport; +var WithBackgroundScene = class { + static updateBackground(datum, top, bottom, context) { + const { background } = this; + const { seriesRect } = context; + background.path.clear(true); + const bounds = Vec45.from(0, 0, seriesRect.width, seriesRect.height); + const points = this.getBackgroundPoints(datum, top, bottom, bounds); + for (let i = 0; i < points.length; i++) { + const point = points[i]; + if (i === 0) { + background.path.moveTo(point.x, point.y); + } else { + background.path.lineTo(point.x, point.y); + } + } + background.path.closePath(); + background.checkPathDirty(); + const backgroundStyles = this.getBackgroundStyles?.(datum) ?? datum.background; + background.fill = backgroundStyles.fill; + background.fillOpacity = backgroundStyles.fillOpacity ?? 1; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/channelScene.ts +var ChannelScene = class extends LinearScene { + constructor() { + super(...arguments); + this.handles = {}; + this.overflowContinuous = 2; + this.topLine = new CollidableLine(); + this.bottomLine = new CollidableLine(); + this.background = new import_ag_charts_community65._ModuleSupport.Path({ zIndex: -1 }); + this.anchor = { x: 0, y: 0 }; + this.updateBackground = WithBackgroundScene.updateBackground.bind(this); + } + update(datum, context) { + const { locked, visible } = datum; + const top = convertLine(datum, context); + const bottom = convertLine(datum.bottom, context); + if (top == null || bottom == null) { + this.visible = false; + return; + } else { + this.visible = visible ?? true; + } + const topLine = this.extendLine(top, datum, context); + const bottomLine = this.extendLine(bottom, datum, context); + this.updateLines(datum, topLine, bottomLine, context, top, bottom); + this.updateHandles(datum, top, bottom); + this.updateText(datum, top, bottom); + this.updateBackground(datum, topLine, bottomLine, context); + this.updateAnchor(top, bottom); + for (const handle2 of Object.values(this.handles)) { + handle2.toggleLocked(locked ?? false); + } + } + toggleHandles(show) { + const { handles } = this; + if (typeof show === "boolean") { + for (const [handle2, node] of Object.entries(handles)) { + node.visible = show; + node.toggleHovered(this.activeHandle === handle2); + } + return; + } + for (const [handle2, visible] of Object.entries(show)) { + const node = handles[handle2]; + node.visible = visible ?? true; + node.toggleHovered(this.activeHandle === handle2); + } + } + toggleActive(active) { + this.toggleHandles(active); + for (const node of Object.values(this.handles)) { + node.toggleActive(active); + } + } + stopDragging() { + const { activeHandle, handles } = this; + if (activeHandle == null) + return; + handles[activeHandle].toggleDragging(false); + } + getAnchor() { + return this.anchor; + } + getCursor() { + if (this.activeHandle == null) + return "pointer"; + return this.handles[this.activeHandle].getCursor(); + } + containsPoint(x, y) { + const { handles, topLine, bottomLine, text: text2 } = this; + this.activeHandle = void 0; + for (const [handle2, child] of Object.entries(handles)) { + if (child.containsPoint(x, y)) { + this.activeHandle = handle2; + return true; + } + } + return topLine.containsPoint(x, y) || bottomLine.containsPoint(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.topLine.containsPoint(x, y) || this.bottomLine.containsPoint(x, y)) + return "line"; + for (const [, child] of Object.entries(this.handles)) { + if (child.containsPoint(x, y)) + return "handle"; + } + } + updateAnchor(top, bottom) { + const { x, y } = import_ag_charts_community65._ModuleSupport.Transformable.toCanvasPoint( + this.topLine, + (top.x1 + top.x2) / 2, + Math.min(top.y1, top.y2, bottom.y1, bottom.y2) + ); + this.anchor.x = x; + this.anchor.y = y; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/disjoint-channel/disjointChannelScene.ts +var { Vec2: Vec210, Vec4: Vec46 } = import_ag_charts_community66._ModuleSupport; +var DisjointChannelScene = class extends ChannelScene { + constructor() { + super(); + this.type = "disjoint-channel"; + this.handles = { + topLeft: new DivariantHandle(), + topRight: new DivariantHandle(), + bottomLeft: new DivariantHandle(), + bottomRight: new UnivariantHandle() + }; + this.append([this.background, this.topLine, this.bottomLine, ...Object.values(this.handles)]); + } + static is(value) { + return AnnotationScene.isCheck(value, "disjoint-channel"); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, handles } = this; + if (activeHandle == null) + return; + const { offset } = handles[activeHandle].drag(target); + handles[activeHandle].toggleDragging(true); + if (activeHandle === "bottomRight") { + offset.x = 0; + } + let translateVectors = []; + let invertYVectors = []; + let allowSnapping = snapping; + switch (activeHandle) { + case "topLeft": + translateVectors = ["topLeft"]; + invertYVectors = ["bottomLeft"]; + break; + case "bottomLeft": + translateVectors = ["bottomLeft"]; + invertYVectors = ["topLeft"]; + break; + case "topRight": + translateVectors = ["topRight"]; + invertYVectors = ["bottomRight"]; + break; + case "bottomRight": + translateVectors = ["bottomLeft", "bottomRight"]; + allowSnapping = false; + break; + } + const top = convertLine(datum, context); + const bottom = convertLine(datum.bottom, context); + if (!top || !bottom) + return; + const vectors = { + topLeft: Vec46.start(top), + topRight: Vec46.end(top), + bottomLeft: Vec46.start(bottom), + bottomRight: Vec46.end(bottom) + }; + const snap = { + vectors: { + topLeft: vectors.topRight, + bottomLeft: vectors.bottomRight, + topRight: vectors.topLeft, + bottomRight: vectors.bottomLeft + }, + angle: datum.snapToAngle + }; + const points = translate(vectors, offset, context, { + overflowContinuous: this.overflowContinuous, + translateVectors, + invertYVectors, + snap: allowSnapping ? snap : void 0 + }); + datum.start.x = points.topLeft.x; + datum.start.y = points.topLeft.y; + datum.end.x = points.topRight.x; + datum.end.y = points.topRight.y; + datum.startHeight = points.topLeft.y - points.bottomLeft.y; + datum.endHeight = points.topRight.y - points.bottomRight.y; + } + getTranslatePointsVectors(start, end) { + const { bottomLeft, bottomRight, topLeft, topRight } = this.handles; + const startHeight = bottomLeft.getBBox().y - topLeft.getBBox().y; + const endHeight = bottomRight.getBBox().y - topRight.getBBox().y; + const bottomStart = Vec210.add(start, Vec210.from(0, startHeight)); + const bottomEnd = Vec210.add(end, Vec210.from(0, endHeight)); + return { start, end, bottomStart, bottomEnd }; + } + updateLines(datum, top, bottom) { + const { topLine, bottomLine } = this; + const { lineDashOffset, stroke: stroke2, strokeOpacity, strokeWidth } = datum; + const lineStyles = { + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth + }; + topLine.setProperties({ ...top, ...lineStyles }); + bottomLine.setProperties({ ...bottom, ...lineStyles }); + } + updateHandles(datum, top, bottom) { + const { + handles: { topLeft, topRight, bottomLeft, bottomRight } + } = this; + const handleStyles = { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + topLeft.update({ ...handleStyles, ...Vec46.start(top) }); + topRight.update({ ...handleStyles, ...Vec46.end(top) }); + bottomLeft.update({ ...handleStyles, ...Vec46.start(bottom) }); + bottomRight.update({ + ...handleStyles, + ...Vec210.sub(Vec46.end(bottom), Vec210.from(bottomRight.handle.width / 2, bottomRight.handle.height / 2)) + }); + } + updateText(datum, top, bottom) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateChannelText(false, top, bottom, datum.text, datum.strokeWidth, this.text, datum.text.label); + } + getBackgroundPoints(datum, top, bottom, bounds) { + const isFlippedX = top.x1 > top.x2; + const isFlippedY = top.y1 > top.y2; + const topY = isFlippedY ? bounds.y2 : bounds.y1; + const bottomY = isFlippedY ? bounds.y1 : bounds.y2; + const points = Vec210.from(top); + if (datum.extendEnd && top.y2 === bottomY) { + points.push(Vec210.from(isFlippedX ? bounds.x1 : bounds.x2, isFlippedY ? bounds.y1 : bounds.y2)); + } + if (datum.extendEnd && bottom.y2 === topY) { + points.push(Vec210.from(isFlippedX ? bounds.x1 : bounds.x2, isFlippedY ? bounds.y2 : bounds.y1)); + } + points.push(...Vec210.from(bottom).reverse()); + if (datum.extendStart && bottom.y1 === bottomY) { + points.push(Vec210.from(isFlippedX ? bounds.x2 : bounds.x1, isFlippedY ? bounds.y1 : bounds.y2)); + } + if (datum.extendStart && top.y1 === topY) { + points.push(Vec210.from(isFlippedX ? bounds.x2 : bounds.x1, isFlippedY ? bounds.y2 : bounds.y1)); + } + return points; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/disjoint-channel/disjointChannelState.ts +var import_ag_charts_community67 = require("ag-charts-community"); +var import_ag_charts_core33 = require("ag-charts-core"); +var { StateMachine: StateMachine6, StateMachineProperty: StateMachineProperty6, Debug: Debug6 } = import_ag_charts_community67._ModuleSupport; +var DisjointChannelStateMachine = class extends StateMachine6 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = new DisjointChannelProperties(); + datum.set({ start: point, end: point, startHeight: 0, endHeight: 0 }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ topLeft: true, topRight: false, bottomLeft: false, bottomRight: false }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ topRight: true }); + ctx.update(); + }; + const actionHeightUpdate = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !(0, import_ag_charts_core33.isNumber)(startY) || !(0, import_ag_charts_core33.isNumber)(endY) || !(0, import_ag_charts_core33.isNumber)(pointY)) + return; + const endHeight = endY - (pointY ?? 0); + const startHeight = (startY - endY) * 2 + endHeight; + const bottomStart = { x: datum?.start.x, y: startY - startHeight }; + const bottomEnd = { x: datum?.end.x, y: point.y }; + node?.toggleHandles({ bottomLeft: true, bottomRight: true }); + if (!ctx.validatePoint(bottomStart, { overflowContinuous: true }) || !ctx.validatePoint(bottomEnd, { overflowContinuous: true })) { + return; + } + datum.set({ startHeight, endHeight }); + ctx.update(); + }; + const actionHeightFinish = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !(0, import_ag_charts_core33.isNumber)(startY) || !(0, import_ag_charts_core33.isNumber)(endY) || !(0, import_ag_charts_core33.isNumber)(pointY)) + return; + const endHeight = endY - (pointY ?? 0); + const startHeight = (startY - endY) * 2 + endHeight; + const bottomStart = { x: datum.start.x, y: startY - endHeight }; + const bottomEnd = { x: datum.end.x, y: point.y }; + node?.toggleHandles(true); + if (!ctx.validatePoint(bottomStart, { overflowContinuous: true }) || !ctx.validatePoint(bottomEnd, { overflowContinuous: true })) { + return; + } + datum.set({ startHeight, endHeight }); + ctx.recordAction(`Create ${"disjoint-channel" /* DisjointChannel */} annotation`); + ctx.showAnnotationOptions(); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine6.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + drag: actionEndUpdate, + click: { + target: "height", + action: actionEndFinish + }, + dragEnd: { + target: "height", + action: actionEndFinish + }, + reset: { + target: StateMachine6.parent, + action: actionCancel + }, + cancel: { + target: StateMachine6.parent, + action: actionCancel + } + }, + height: { + hover: actionHeightUpdate, + click: { + target: StateMachine6.parent, + action: actionHeightFinish + }, + drag: { + target: StateMachine6.parent, + action: actionHeightFinish + }, + reset: { + target: StateMachine6.parent, + action: actionCancel + }, + cancel: { + target: StateMachine6.parent, + action: actionCancel + } + } + }); + this.debug = Debug6.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass([ + StateMachineProperty6() +], DisjointChannelStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty6() +], DisjointChannelStateMachine.prototype, "node", 2); +__decorateClass([ + StateMachineProperty6() +], DisjointChannelStateMachine.prototype, "snapping", 2); + +// packages/ag-charts-enterprise/src/features/annotations/disjoint-channel/disjointChannelConfig.ts +var disjointChannelConfig = { + type: "disjoint-channel" /* DisjointChannel */, + datum: DisjointChannelProperties, + scene: DisjointChannelScene, + isDatum: DisjointChannelProperties.is, + translate: (node, datum, transition, context) => { + if (DisjointChannelProperties.is(datum) && DisjointChannelScene.is(node)) { + node.translate(datum, transition, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (DisjointChannelProperties.is(datum) && DisjointChannelProperties.is(copiedDatum) && DisjointChannelScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (DisjointChannelProperties.is(datum) && DisjointChannelScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new DisjointChannelStateMachine({ + ...ctx, + create: createDatum("disjoint-channel" /* DisjointChannel */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedScene.ts +var import_ag_charts_community70 = require("ag-charts-community"); +var import_ag_charts_core35 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/fibonacciScene.ts +var import_ag_charts_community68 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/utils/fibonacci.ts +var FIBONACCI_RETRACEMENT_RATIOS = [0, 23.6, 38.2, 50, 61.8, 78.6, 100]; +var FIBONACCI_EXTENSION_RATIOS = [161.8, 261.8, 361.8, 423.6]; +var FIBONACCI_RATIOS = [...FIBONACCI_RETRACEMENT_RATIOS, ...FIBONACCI_EXTENSION_RATIOS]; +var FIBONACCI_RATIOS_MAP = { + 10: FIBONACCI_RATIOS, + 6: FIBONACCI_RETRACEMENT_RATIOS, + 4: FIBONACCI_RETRACEMENT_RATIOS.filter((r) => r !== 78.6 && r !== 23.6) +}; +var FIBONACCI_RANGE_LABEL_PADDING = 10; +function getFibonacciCoords(coords1, coords2) { + const { x2, y1, y2 } = coords1; + const trendLineVerticalDistance = y1 - y2; + if (coords2 == null) { + return { + x1: x2, + x2, + y1: y2 - trendLineVerticalDistance, + y2 + }; + } + return { + x1: coords2.x1, + x2: coords2.x2, + y1: coords2.y2 - trendLineVerticalDistance, + y2: coords2.y2 + }; +} +function createFibonacciRangesData({ x1, y1, x2, y2 }, context, reverse, yZero, bands = 10) { + const verticalDistance = y1 - y2; + const direction = reverse ? -1 : 1; + let startY = yZero; + const data = []; + for (const [index, ratio3] of FIBONACCI_RATIOS_MAP[bands].entries()) { + const endY = yZero + verticalDistance * (ratio3 / 100) * direction; + const yDatumVal = context.yAxis.scaleInvert(endY); + data.push({ + id: index, + x1, + x2, + y1: startY, + y2: endY, + tag: ratio3 == 100 ? 0 /* OneLine */ : 1 /* HorizontalLine */, + label: { + x1: Math.min(x1, x2) - FIBONACCI_RANGE_LABEL_PADDING, + x2, + y1: endY, + y2: endY, + text: `${(ratio3 / 100).toFixed(3)} (${yDatumVal.toFixed(2)})` + } + }); + startY = endY; + } + return data; +} + +// packages/ag-charts-enterprise/src/features/annotations/scenes/fibonacciScene.ts +var { Vec2: Vec211, Vec4: Vec47 } = import_ag_charts_community68._ModuleSupport; +var FibonacciScene = class extends AnnotationScene { + constructor() { + super(); + this.trendLine = new CollidableLine(); + this.rangeFillsGroup = new import_ag_charts_community68._ModuleSupport.Group({ + name: `${this.id}-range-fills` + }); + this.rangeFillsGroupSelection = import_ag_charts_community68._ModuleSupport.Selection.select(this.rangeFillsGroup, import_ag_charts_community68._ModuleSupport.Range); + this.rangeStrokesGroup = new import_ag_charts_community68._ModuleSupport.Group({ + name: `${this.id}-range-strokes` + }); + this.rangeStrokesGroupSelection = import_ag_charts_community68._ModuleSupport.Selection.select(this.rangeStrokesGroup, CollidableLine); + this.labelsGroup = new import_ag_charts_community68._ModuleSupport.Group({ + name: `${this.id}-ranges-labels` + }); + this.labelsGroupSelection = import_ag_charts_community68._ModuleSupport.Selection.select(this.labelsGroup, CollidableText); + this.anchor = { + x: 0, + y: 0, + position: "above" + }; + this.append([this.trendLine, this.rangeFillsGroup, this.rangeStrokesGroup, this.labelsGroup]); + } + update(datum, context) { + let coords = convertLine(datum, context); + if (coords == null) { + this.visible = false; + return; + } + coords = Vec47.round(coords); + this.visible = datum.visible ?? true; + if (!this.visible) + return; + this.updateLine(datum, coords, this.trendLine); + this.updateHandles(datum, coords); + this.updateAnchor(datum, coords, context); + const { reverse } = datum; + const extendedCoords = this.extendLine(coords, datum, context); + const yZero = reverse ? extendedCoords.y1 : extendedCoords.y2; + const yOne = reverse ? extendedCoords.y2 : extendedCoords.y1; + const data = createFibonacciRangesData(extendedCoords, context, datum.reverse, yZero, datum.bands); + this.updateRanges(datum, data, context); + const oneLinePoints = { ...extendedCoords, y1: yOne, y2: yOne }; + this.updateText(datum, oneLinePoints); + } + extendLine({ x1, y1, x2, y2 }, datum, context) { + const linePoints = { x1, y1, x2, y2 }; + if (!datum.extendStart && !datum.extendEnd) { + return linePoints; + } + const { x, width } = context.xAxis.bounds; + if (datum.extendEnd) { + linePoints[x1 > x2 ? "x1" : "x2"] = x + width; + } + if (datum.extendStart) { + linePoints[x1 > x2 ? "x2" : "x1"] = x; + } + return linePoints; + } + updateLine(datum, coords, line) { + if (!coords || !line) { + return; + } + const { lineDashOffset, strokeWidth, strokeOpacity, stroke: stroke2 } = datum; + line.setProperties({ + ...coords, + lineCap: datum.getLineCap(), + lineDash: [3, 4], + lineDashOffset, + strokeWidth, + strokeOpacity, + fillOpacity: 0, + stroke: stroke2 + }); + } + updateRangeStrokes(datum) { + const { lineDashOffset, strokeWidth, strokeOpacity, strokes, rangeStroke, isMultiColor } = datum; + this.rangeStrokesGroupSelection.each((line, { x1, x2, y2, tag }, index) => { + const y = y2; + const color6 = isMultiColor ? strokes[index % strokes.length] : rangeStroke; + line.setProperties({ + x1, + x2, + y1: y, + y2: y, + stroke: color6, + strokeOpacity, + strokeWidth, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + tag + }); + }); + } + updateRanges(datum, data, context) { + const getDatumId = (d) => d.id; + this.rangeFillsGroupSelection.update(data, void 0, getDatumId); + this.rangeStrokesGroupSelection.update(data, void 0, getDatumId); + this.labelsGroupSelection.update(data, void 0, getDatumId); + this.updateRangeFills(datum); + this.updateRangeStrokes(datum); + this.updateRangeLabels(datum, context); + } + updateRangeFills(datum) { + const { + lineDashOffset, + strokeWidth, + strokeOpacity, + strokes: colors, + rangeStroke, + showFill, + isMultiColor + } = datum; + this.rangeFillsGroupSelection.each((range2, { x1, x2, y1, y2 }, index) => { + const color6 = isMultiColor ? colors[index % colors.length] : rangeStroke; + if (!showFill) { + range2.visible = false; + return; + } + range2.setProperties({ + x1, + x2, + y1, + y2, + startLine: false, + endLine: false, + stroke: color6, + strokeOpacity, + fill: color6, + fillOpacity: (strokeOpacity ?? 1) * 0.15, + strokeWidth, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + visible: true + }); + }); + } + updateRangeLabels(trendLineProperties, { xAxis }) { + const { rangeStrokesGroupSelection } = this; + const { + strokes: colors, + strokeWidth, + rangeStroke, + isMultiColor, + label: { fontFamily, fontSize, fontStyle, fontWeight, color: color6 } + } = trendLineProperties; + const labelProperties = { + fontFamily, + fontSize, + fontStyle, + fontWeight + }; + const withinBounds = this.checkWithinBounds(xAxis, labelProperties, this.labelsGroupSelection.at(0)); + this.labelsGroupSelection.each((textNode, datum, index) => { + const textColor = color6 ?? (isMultiColor ? colors[index % colors.length] : rangeStroke); + const line = rangeStrokesGroupSelection.at(index); + if (!line) { + return; + } + const { text: text2, ...coords } = datum.label; + if (withinBounds) { + textNode.setProperties({ + ...labelProperties, + text: text2, + x: coords.x1, + y: coords.y1, + textBaseline: "middle", + textAlign: "end", + fill: textColor + }); + updateLineText(textNode.id, line, coords); + } else { + const textProperties = { + ...labelProperties, + label: text2, + position: "center", + alignment: "left", + color: textColor + }; + updateLineText(textNode.id, line, coords, textProperties, textNode, text2, strokeWidth); + } + }); + } + checkWithinBounds(xAxis, fontOptions, textNode) { + if (!textNode) { + return false; + } + const { text: text2, ...coords } = textNode.datum.label; + textNode.setProperties({ + ...fontOptions, + text: text2, + x: coords.x1, + y: coords.y1, + textBaseline: "middle", + textAlign: "end" + }); + const { x } = textNode.getBBox(); + return x >= xAxis.bounds.x && x <= xAxis.bounds.x + xAxis.bounds.width; + } + updateText(datum, coords) { + const oneLine = this.rangeStrokesGroupSelection.selectByTag(0 /* OneLine */)[0]; + if (!oneLine) { + return; + } + const { text: textProperties, strokeWidth } = datum; + this.text = this.updateNode(CollidableText, this.text, !!textProperties.label); + updateLineText(oneLine.id, oneLine, coords, textProperties, this.text, textProperties.label, strokeWidth); + } + updateAnchor(_datum, coords, _context, _bbox) { + const point = Vec47.topCenter(coords); + Vec211.apply(this.anchor, import_ag_charts_community68._ModuleSupport.Transformable.toCanvasPoint(this.trendLine, point.x, point.y)); + } + containsPoint(x, y) { + const { trendLine, rangeStrokesGroupSelection, text: text2 } = this; + let isInStrokePath = false; + rangeStrokesGroupSelection.each((line) => isInStrokePath || (isInStrokePath = line.isPointInPath(x, y))); + return isInStrokePath || trendLine.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.trendLine.isPointInPath(x, y)) + return "line"; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + } + drag(datum, target, context, snapping) { + if (!datum.isWriteable()) + return; + if (this.activeHandle) { + this.dragHandle(datum, target, context, snapping); + } else { + this.dragAll(datum, target, context); + } + } + getAnchor() { + return this.anchor; + } + getCursor() { + return "pointer"; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/utils/validation.ts +var import_ag_charts_community69 = require("ag-charts-community"); +var import_ag_charts_core34 = require("ag-charts-core"); +var { ContinuousScale: ContinuousScale3 } = import_ag_charts_community69._ModuleSupport; +function validateDatumPoint(context, point, options = { overflowContinuous: false }, warningPrefix) { + if (point.x == null || point.y == null) { + if (warningPrefix) { + import_ag_charts_core34.Logger.warnOnce(`${warningPrefix}requires both an [x] and [y] property, ignoring.`); + } + return false; + } + const { xAxis, yAxis } = context; + const continuousX = options.overflowContinuous && ContinuousScale3.is(xAxis.scale); + const continuousY = options.overflowContinuous && ContinuousScale3.is(yAxis.scale); + const validX = continuousX || validateDatumPointDirection(point.x, xAxis); + const validY = continuousY || validateDatumPointDirection(point.y, yAxis); + if (validX && validY) + return true; + if (warningPrefix) { + let text2 = "x & y domains"; + if (validX) + text2 = "y domain"; + if (validY) + text2 = "x domain"; + const xValue2 = getGroupingValue(point.x); + const yValue = getGroupingValue(point.y); + import_ag_charts_core34.Logger.warnOnce(`${warningPrefix}is outside the ${text2}, ignoring. - x: [${xValue2}], y: ${yValue}]`); + } + return false; +} +function validateDatumPointDirection(d, context) { + const { domain } = context.scale; + const value = getGroupingValue(d); + if (domain && value != null && context.continuous) { + return value >= domain[0] && value <= domain.at(-1); + } + return true; +} + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedScene.ts +var { Vec2: Vec212, Vec4: Vec48 } = import_ag_charts_community70._ModuleSupport; +var FibonacciRetracementTrendBasedScene = class extends FibonacciScene { + constructor() { + super(); + this.type = "fibonacci-retracement-trend-based"; + this.endRetracementLine = new CollidableLine(); + this.start = new DivariantHandle(); + this.end = new DivariantHandle(); + this.endRetracement = new DivariantHandle(); + this.append([this.endRetracementLine, this.start, this.end, this.endRetracement]); + } + static is(value) { + return AnnotationScene.isCheck(value, "fibonacci-retracement-trend-based"); + } + update(datum, context) { + let { coords1, coords2 } = this.getCoords(datum, context); + if (coords1 == null || coords2 == null) { + this.visible = false; + return; + } + coords1 = Vec48.round(coords1); + coords2 = Vec48.round(coords2); + this.visible = datum.visible ?? true; + if (!this.visible) + return; + if (datum.endRetracement.x == void 0 || datum.endRetracement.y == void 0) { + coords2 = void 0; + } + this.updateLine(datum, coords1, this.trendLine); + this.updateLine(datum, coords2, this.endRetracementLine); + this.updateHandles(datum, coords1, coords2); + this.updateAnchor(datum, coords2 ?? coords1, context); + const { reverse, bands } = datum; + const coords = getFibonacciCoords(coords1, coords2); + const extendedCoords = this.extendLine(coords, datum, context); + const yZero = extendedCoords.y2; + const yOne = extendedCoords.y1; + const data = coords2 ? createFibonacciRangesData(extendedCoords, context, reverse, yZero, bands) : []; + this.updateRanges(datum, data, context); + const oneLinePoints = { ...extendedCoords, y1: yOne, y2: yOne }; + this.updateText(datum, oneLinePoints); + } + containsPoint(x, y) { + const { start, end, endRetracement, endRetracementLine } = this; + this.activeHandle = void 0; + if (start.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + if (end.containsPoint(x, y)) { + this.activeHandle = "end"; + return true; + } + if (endRetracement.containsPoint(x, y)) { + this.activeHandle = "endRetracement"; + return true; + } + return endRetracementLine.isPointInPath(x, y) || super.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y) || this.endRetracement.containsPoint(x, y)) + return "handle"; + if (this.endRetracementLine.isPointInPath(x, y)) + return "line"; + return super.getNodeAtCoords(x, y); + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ start: datum.start, end: datum.end, endRetracement: datum.endRetracement }, context) + }; + } + stopDragging() { + this.start.toggleDragging(false); + this.end.toggleDragging(false); + this.endRetracement.toggleDragging(false); + } + dragAll(datum, target, context) { + const { dragState } = this; + if (!dragState) + return; + this.translatePoints({ + datum, + start: dragState.start, + end: dragState.end, + endRetracement: dragState.endRetracement, + translation: Vec212.sub(target, dragState.offset), + context + }); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, dragState } = this; + if (!activeHandle || !dragState) + return; + this[activeHandle].toggleDragging(true); + const point = snapping ? this.snapToAngle(datum, target, context) : invertCoords(this[activeHandle].drag(target).point, context); + if (!point || !validateDatumPoint(context, point)) + return; + datum[activeHandle].x = point.x; + datum[activeHandle].y = point.y; + } + snapToAngle(datum, coords, context) { + const { activeHandle } = this; + const handles = ["start", "end", "endRetracement"]; + if (!activeHandle) + return; + const index = (handles.indexOf(activeHandle) + 1) % handles.length; + const fixedHandle = handles[index]; + this[activeHandle].toggleDragging(true); + const fixed = convertPoint(datum[fixedHandle], context); + return invertCoords(snapToAngle(coords, fixed, datum.snapToAngle), context); + } + translatePoints({ + datum, + start, + end, + endRetracement, + translation, + context + }) { + const points = translate({ start, end, endRetracement }, translation, context, { overflowContinuous: 2 }); + datum.start.x = points.start.x; + datum.end.x = points.end.x; + datum.endRetracement.x = points.endRetracement.x; + datum.start.y = points.start.y; + datum.end.y = points.end.y; + datum.endRetracement.y = points.endRetracement.y; + } + translate(datum, translation, context) { + this.translatePoints({ + datum, + start: convertPoint(datum.start, context), + end: convertPoint(datum.end, context), + endRetracement: convertPoint(datum.endRetracement, context), + translation, + context + }); + } + copy(datum, copiedDatum, context) { + const { coords1, coords2 } = this.getCoords(datum, context); + if (!coords1 || !coords2) { + return; + } + const bbox = this.computeBBoxWithoutHandles(); + this.translatePoints({ + datum: copiedDatum, + start: Vec48.start(coords1), + end: Vec48.end(coords1), + endRetracement: Vec48.end(coords2), + translation: { x: -bbox.width / 2, y: -bbox.height / 2 }, + context + }); + return copiedDatum; + } + getCoords(datum, context) { + return { + coords1: convertLine(datum, context), + coords2: convertLine({ start: datum.end, end: datum.endRetracement }, context) + }; + } + toggleHandles(show) { + if (typeof show === "boolean") { + this.start.visible = show; + this.end.visible = show; + this.endRetracement.visible = show; + } else { + for (const [handle2, visible] of (0, import_ag_charts_core35.entries)(show)) { + this[handle2].visible = visible; + } + } + this.start.toggleHovered(this.activeHandle === "start"); + this.end.toggleHovered(this.activeHandle === "end"); + this.endRetracement.toggleHovered(this.activeHandle === "endRetracement"); + } + toggleActive(active) { + this.toggleHandles(active); + this.start.toggleActive(active); + this.end.toggleActive(active); + this.endRetracement.toggleActive(active); + } + updateHandles(datum, coords1, coords2, bbox) { + this.start.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords1, "start") + }); + this.end.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords1, "end", bbox) + }); + if (coords2) { + this.endRetracement.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords2, "endRetracement", bbox) + }); + } + this.start.toggleLocked(datum.locked ?? false); + this.end.toggleLocked(datum.locked ?? false); + this.endRetracement.toggleLocked(datum.locked ?? false); + } + getHandleCoords(_datum, coords, handle2, _bbox) { + return handle2 === "start" ? Vec48.start(coords) : Vec48.end(coords); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedState.ts +var import_ag_charts_community71 = require("ag-charts-community"); +var { StateMachine: StateMachine7, StateMachineProperty: StateMachineProperty7, Debug: Debug7 } = import_ag_charts_community71._ModuleSupport; +var FibonacciRetracementTrendBasedStateMachine = class extends StateMachine7 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ start: true, end: false, endRetracement: false }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + const { datum } = this; + if (!datum) + return; + datum.endRetracement.x = datum.end.x; + datum.endRetracement.y = datum.end.y; + this.node?.toggleHandles({ end: true }); + ctx.update(); + }; + const actionEndRetracementUpdate = ({ + offset, + context + }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ endRetracement: snapPoint(offset, context, snapping, datum.end, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndRetracementFinish = () => { + this.node?.toggleHandles({ endRetracement: true }); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + const onExitEnd = () => { + ctx.showAnnotationOptions(); + ctx.recordAction(`Create ${this.datum?.type} annotation`); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine7.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + click: { + target: "endRetracement", + action: actionEndFinish + }, + drag: actionEndUpdate, + dragEnd: { + target: "endRetracement", + action: actionEndFinish + }, + reset: { + target: StateMachine7.parent, + action: actionCancel + }, + cancel: { + target: StateMachine7.parent, + action: actionCancel + }, + onExit: onExitEnd + }, + endRetracement: { + hover: actionEndRetracementUpdate, + click: { + target: StateMachine7.parent, + action: actionEndRetracementFinish + }, + drag: { + target: StateMachine7.parent, + action: actionEndRetracementFinish + }, + reset: { + target: StateMachine7.parent, + action: actionCancel + }, + cancel: { + target: StateMachine7.parent, + action: actionCancel + } + } + }); + this.debug = Debug7.create(true, "annotations"); + this.snapping = false; + } + createDatum() { + return new FibonacciRetracementTrendBasedProperties(); + } +}; +__decorateClass([ + StateMachineProperty7() +], FibonacciRetracementTrendBasedStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty7() +], FibonacciRetracementTrendBasedStateMachine.prototype, "node", 2); +__decorateClass([ + StateMachineProperty7() +], FibonacciRetracementTrendBasedStateMachine.prototype, "snapping", 2); + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedConfig.ts +var fibonacciRetracementTrendBasedConfig = { + type: "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */, + datum: FibonacciRetracementTrendBasedProperties, + scene: FibonacciRetracementTrendBasedScene, + isDatum: FibonacciRetracementTrendBasedProperties.is, + translate: (node, datum, transition, context) => { + if (FibonacciRetracementTrendBasedProperties.is(datum) && FibonacciRetracementTrendBasedScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (FibonacciRetracementTrendBasedProperties.is(datum) && FibonacciRetracementTrendBasedProperties.is(copiedDatum) && FibonacciRetracementTrendBasedScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (FibonacciRetracementTrendBasedProperties.is(datum) && FibonacciRetracementTrendBasedScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new FibonacciRetracementTrendBasedStateMachine({ + ...ctx, + create: createDatum("fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement/fibonacciRetracementScene.ts +var import_ag_charts_community72 = require("ag-charts-community"); +var import_ag_charts_core36 = require("ag-charts-core"); +var { Vec2: Vec213, Vec4: Vec49 } = import_ag_charts_community72._ModuleSupport; +var FibonacciRetracementScene = class extends FibonacciScene { + constructor() { + super(); + this.type = "fibonacci-retracement"; + this.start = new DivariantHandle(); + this.end = new DivariantHandle(); + this.append([this.start, this.end]); + } + static is(value) { + return AnnotationScene.isCheck(value, "fibonacci-retracement"); + } + containsPoint(x, y) { + const { start, end } = this; + this.activeHandle = void 0; + if (start.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + if (end.containsPoint(x, y)) { + this.activeHandle = "end"; + return true; + } + return super.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y)) + return "handle"; + return super.getNodeAtCoords(x, y); + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ start: datum.start, end: datum.end }, context) + }; + } + stopDragging() { + this.start.toggleDragging(false); + this.end.toggleDragging(false); + } + dragAll(datum, target, context) { + const { dragState } = this; + if (!dragState) + return; + this.translatePoints({ + datum, + start: dragState.start, + end: dragState.end, + translation: Vec213.sub(target, dragState.offset), + context + }); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, dragState } = this; + if (!activeHandle || !dragState) + return; + this[activeHandle].toggleDragging(true); + const point = snapping ? this.snapToAngle(datum, target, context) : invertCoords(this[activeHandle].drag(target).point, context); + if (!point || !validateDatumPoint(context, point)) + return; + datum[activeHandle].x = point.x; + datum[activeHandle].y = point.y; + } + snapToAngle(datum, coords, context) { + const { activeHandle } = this; + const handles = ["start", "end"]; + const fixedHandle = handles.find((handle2) => handle2 !== activeHandle); + if (!activeHandle || !fixedHandle) + return; + this[activeHandle].toggleDragging(true); + const fixed = convertPoint(datum[fixedHandle], context); + return invertCoords(snapToAngle(coords, fixed, datum.snapToAngle), context); + } + translatePoints({ + datum, + start, + end, + translation, + context + }) { + const points = translate({ start, end }, translation, context, { overflowContinuous: 1 }); + datum.start.x = points.start.x; + datum.end.x = points.end.x; + datum.start.y = points.start.y; + datum.end.y = points.end.y; + } + translate(datum, translation, context) { + this.translatePoints({ + datum, + start: convertPoint(datum.start, context), + end: convertPoint(datum.end, context), + translation, + context + }); + } + copy(datum, copiedDatum, context) { + const coords = convertLine(datum, context); + if (!coords) { + return; + } + const bbox = this.computeBBoxWithoutHandles(); + this.translatePoints({ + datum: copiedDatum, + start: { x: coords.x1, y: coords.y1 }, + end: { x: coords.x2, y: coords.y2 }, + translation: { x: -bbox.width / 2, y: -bbox.height / 2 }, + context + }); + return copiedDatum; + } + toggleHandles(show) { + if (typeof show === "boolean") { + this.start.visible = show; + this.end.visible = show; + } else { + for (const [handle2, visible] of (0, import_ag_charts_core36.entries)(show)) { + this[handle2].visible = visible; + } + } + this.start.toggleHovered(this.activeHandle === "start"); + this.end.toggleHovered(this.activeHandle === "end"); + } + toggleActive(active) { + this.toggleHandles(active); + this.start.toggleActive(active); + this.end.toggleActive(active); + } + updateHandles(datum, coords, _coords2, bbox) { + this.start.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords, "start") + }); + this.end.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords, "end", bbox) + }); + this.start.toggleLocked(datum.locked ?? false); + this.end.toggleLocked(datum.locked ?? false); + } + getHandleCoords(_datum, coords, handle2, _bbox) { + return handle2 === "start" ? Vec49.start(coords) : Vec49.end(coords); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/line/lineState.ts +var import_ag_charts_community73 = require("ag-charts-community"); +var { StateMachine: StateMachine8, StateMachineProperty: StateMachineProperty8, Debug: Debug8 } = import_ag_charts_community73._ModuleSupport; +var LineTypeStateMachine = class extends StateMachine8 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ start: true, end: false }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ end: true }); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + const onExitEnd = () => { + ctx.showAnnotationOptions(); + ctx.recordAction(`Create ${this.datum?.type} annotation`); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine8.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + click: { + target: StateMachine8.parent, + action: actionEndFinish + }, + drag: actionEndUpdate, + dragEnd: { + target: StateMachine8.parent, + action: actionEndFinish + }, + reset: { + target: StateMachine8.parent, + action: actionCancel + }, + cancel: { + target: StateMachine8.parent, + action: actionCancel + }, + onExit: onExitEnd + } + }); + this.debug = Debug8.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass([ + StateMachineProperty8() +], LineTypeStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty8() +], LineTypeStateMachine.prototype, "node", 2); +__decorateClass([ + StateMachineProperty8() +], LineTypeStateMachine.prototype, "snapping", 2); +var ArrowStateMachine = class extends LineTypeStateMachine { + createDatum() { + return new ArrowProperties(); + } +}; +var LineStateMachine = class extends LineTypeStateMachine { + createDatum() { + return new LineProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement/fibonacciRetracementState.ts +var FibonacciRetracementStateMachine = class extends LineTypeStateMachine { + createDatum() { + return new FibonacciRetracementProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement/fibonacciRetracementConfig.ts +var fibonacciRetracementConfig = { + type: "fibonacci-retracement" /* FibonacciRetracement */, + datum: FibonacciRetracementProperties, + scene: FibonacciRetracementScene, + isDatum: FibonacciRetracementProperties.is, + translate: (node, datum, transition, context) => { + if (FibonacciRetracementProperties.is(datum) && FibonacciRetracementScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (FibonacciRetracementProperties.is(datum) && FibonacciRetracementProperties.is(copiedDatum) && FibonacciRetracementScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (FibonacciRetracementProperties.is(datum) && FibonacciRetracementScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new FibonacciRetracementStateMachine({ + ...ctx, + create: createDatum("fibonacci-retracement" /* FibonacciRetracement */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/line/lineScene.ts +var import_ag_charts_community75 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/scenes/capScene.ts +var import_ag_charts_community74 = require("ag-charts-community"); +var { Vec2: Vec214 } = import_ag_charts_community74._ModuleSupport; +var CapScene = class extends import_ag_charts_community74._ModuleSupport.Group { +}; +var ArrowCapScene = class extends CapScene { + constructor() { + super(); + this.type = "arrow"; + this.path = new import_ag_charts_community74._ModuleSupport.Path(); + this.armLength = 6; + this.append([this.path]); + } + update(options) { + const { path } = this; + const { x, y, angle, ...rest } = options; + const origin = Vec214.from(x, y); + const offsetAngle = 3 * Math.PI / 4; + const armLength = this.armLength + (options.strokeWidth ?? 0) * 2; + const leftEnd = Vec214.rotate(Vec214.from(0, armLength), angle + offsetAngle, origin); + const rightEnd = Vec214.rotate(Vec214.from(armLength, 0), angle - offsetAngle, origin); + path.setProperties(rest); + path.fillOpacity = 0; + path.path.clear(); + path.path.moveTo(leftEnd.x, leftEnd.y); + path.path.lineTo(origin.x, origin.y); + path.path.lineTo(rightEnd.x, rightEnd.y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/line/lineScene.ts +var { Vec2: Vec215, Vec4: Vec410 } = import_ag_charts_community75._ModuleSupport; +var LineScene = class extends StartEndScene { + constructor() { + super(); + this.type = "line"; + this.line = new CollidableLine(); + this.append([this.line, this.start, this.end]); + } + static is(value) { + return AnnotationScene.isCheck(value, "line"); + } + update(datum, context) { + let coords = convertLine(datum, context); + if (coords == null) { + this.visible = false; + return; + } + coords = Vec410.round(coords); + this.visible = datum.visible ?? true; + if (!this.visible) + return; + this.updateLine(datum, coords, context); + this.updateHandles(datum, coords); + this.updateText(datum, coords); + this.updateCaps(datum, coords); + this.updateAnchor(datum, coords, context); + } + updateLine(datum, coords, context) { + const { line } = this; + const { lineDashOffset, stroke: stroke2, strokeWidth, strokeOpacity } = datum; + const linePoints = this.extendLine(coords, datum, context); + line.setProperties({ + ...linePoints, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke2, + strokeWidth, + strokeOpacity, + fillOpacity: 0 + }); + } + updateText(datum, coords) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateLineText(this.line.id, this.line, coords, datum.text, this.text, datum.text.label, datum.strokeWidth); + } + updateCaps(datum, coords) { + if (!datum.startCap && this.startCap) { + this.startCap.remove(); + this.startCap = void 0; + } + if (!datum.endCap && this.endCap) { + this.endCap.remove(); + this.endCap = void 0; + } + if (!datum.startCap && !datum.endCap) + return; + const { stroke: stroke2, strokeWidth, strokeOpacity } = datum; + const [start, end] = Vec215.from(coords); + const angle = Vec215.angle(Vec215.sub(end, start)); + if (datum.startCap) { + if (this.startCap && this.startCap.type !== datum.startCap) { + this.startCap.remove(); + this.startCap = void 0; + } + if (this.startCap == null) { + this.startCap = new ArrowCapScene(); + this.append([this.startCap]); + } + this.startCap.update({ + x: start.x, + y: start.y, + angle: angle - Math.PI, + stroke: stroke2, + strokeWidth, + strokeOpacity + }); + } + if (datum.endCap) { + if (this.endCap && this.endCap.type !== datum.endCap) { + this.endCap.remove(); + this.endCap = void 0; + } + if (this.endCap == null) { + this.endCap = new ArrowCapScene(); + this.append([this.endCap]); + } + this.endCap.update({ + x: end.x, + y: end.y, + angle, + stroke: stroke2, + strokeWidth, + strokeOpacity + }); + } + } + updateAnchor(_datum, coords, _context, _bbox) { + const point = Vec410.topCenter(coords); + Vec215.apply(this.anchor, import_ag_charts_community75._ModuleSupport.Transformable.toCanvasPoint(this.line, point.x, point.y)); + } + containsPoint(x, y) { + const { line, text: text2 } = this; + return super.containsPoint(x, y) || line.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.line.isPointInPath(x, y)) + return "line"; + return super.getNodeAtCoords(x, y); + } + getHandleCoords(_datum, coords, handle2, _bbox) { + const { startCap, endCap } = this; + let [startPoint, endPoint] = Vec215.from(coords); + const angle = Vec215.angle(Vec215.sub(endPoint, startPoint)); + if (startCap) { + startPoint = Vec215.rotate(Vec215.from(0, -DivariantHandle.HANDLE_SIZE / 2), angle, startPoint); + } + if (endCap) { + endPoint = Vec215.rotate(Vec215.from(0, DivariantHandle.HANDLE_SIZE / 2), angle, endPoint); + } + return handle2 === "start" ? startPoint : endPoint; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/line/lineConfig.ts +var lineConfig = { + type: "line" /* Line */, + datum: LineProperties, + scene: LineScene, + isDatum: LineProperties.is, + translate: (node, datum, transition, context) => { + if (LineProperties.is(datum) && LineScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (LineProperties.is(datum) && LineProperties.is(copiedDatum) && LineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (LineProperties.is(datum) && LineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new LineStateMachine({ + ...ctx, + create: createDatum("line" /* Line */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var arrowConfig = { + type: "arrow" /* Arrow */, + datum: ArrowProperties, + scene: LineScene, + isDatum: ArrowProperties.is, + translate: (node, datum, transition, context) => { + if (ArrowProperties.is(datum) && LineScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (ArrowProperties.is(datum) && ArrowProperties.is(copiedDatum) && LineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ArrowProperties.is(datum) && LineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ArrowStateMachine({ + ...ctx, + create: createDatum("arrow" /* Arrow */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerScene.ts +var import_ag_charts_community78 = require("ag-charts-community"); +var import_ag_charts_core37 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerStatisticsScene.ts +var import_ag_charts_community77 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/utils/layout.ts +var import_ag_charts_community76 = require("ag-charts-community"); +function layoutScenesRow(scenes, startX = 0, gap = 0) { + let x = startX; + for (const scene of scenes) { + if (Array.isArray(scene)) { + for (const scene_ of scene) { + layoutSetX(scene_, x); + } + x += import_ag_charts_community76._ModuleSupport.Group.computeChildrenBBox(scene).width + gap; + } else { + layoutSetX(scene, x); + x += scene.getBBox().width + gap; + } + } +} +function layoutScenesColumn(scenes, startY = 0, gap = 0) { + let y = startY; + for (const scene of scenes) { + if (Array.isArray(scene)) { + for (const scene_ of scene) { + layoutSetY(scene_, y); + } + y += import_ag_charts_community76._ModuleSupport.Group.computeChildrenBBox(scene).height + gap; + } else { + layoutSetY(scene, y); + y += scene.getBBox().height + gap; + } + } +} +function layoutSetX(scene, x) { + if ("x1" in scene) { + scene.x2 = x + (scene.x2 - scene.x1); + scene.x1 = x; + } else { + scene.x = x; + } +} +function layoutSetY(scene, y) { + if ("y1" in scene) { + scene.y2 = y + (scene.y2 - scene.y1); + scene.y1 = y; + } else { + scene.y = y; + } +} +function layoutAddX(scene, x) { + if ("x1" in scene) { + scene.x1 += x; + scene.x2 += x; + } else { + scene.x += x; + } +} +function layoutAddY(scene, y) { + if ("y1" in scene) { + scene.y1 += y; + scene.y2 += y; + } else { + scene.y += y; + } +} + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerStatisticsScene.ts +var { Vec4: Vec411 } = import_ag_charts_community77._ModuleSupport; +var MeasurerStatisticsScene = class extends import_ag_charts_community77._ModuleSupport.Group { + constructor() { + super(); + this.name = "MeasurerStatisticsScene"; + this.background = new import_ag_charts_community77._ModuleSupport.Rect(); + this.dateRangeBarsText = new import_ag_charts_community77._ModuleSupport.Text(); + this.dateRangeDivider = new import_ag_charts_community77._ModuleSupport.Line(); + this.dateRangeValueText = new import_ag_charts_community77._ModuleSupport.Text(); + this.priceRangeValueText = new import_ag_charts_community77._ModuleSupport.Text(); + this.priceRangeDivider = new import_ag_charts_community77._ModuleSupport.Line(); + this.priceRangePercentageText = new import_ag_charts_community77._ModuleSupport.Text(); + this.volumeText = new import_ag_charts_community77._ModuleSupport.Text(); + this.volumeFormatter = new Intl.NumberFormat("en-US", { + notation: "compact", + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }); + this.append([ + this.background, + this.dateRangeBarsText, + this.dateRangeDivider, + this.dateRangeValueText, + this.priceRangeValueText, + this.priceRangeDivider, + this.priceRangePercentageText, + this.volumeText + ]); + } + update(datum, stats, anchor, coords, context, verticalDirection, localeManager) { + this.verticalDirection = verticalDirection; + const scenes = this.updateStatistics(datum, stats, anchor, localeManager); + const bbox = import_ag_charts_community77._ModuleSupport.Group.computeChildrenBBox(scenes.flat()); + const padding = 10; + bbox.grow(padding); + this.updateBackground(datum, bbox, padding); + this.reposition(scenes, padding, context); + this.checkVisibility(datum, context, coords); + } + checkVisibility(datum, context, coords) { + const bounds = Vec411.from(new import_ag_charts_community77._ModuleSupport.BBox(0, 0, context.seriesRect.width, context.seriesRect.height)); + if (Vec411.collides(coords, bounds)) { + this.visible = datum.visible ?? true; + } else { + this.visible = false; + } + } + updateStatistics(datum, stats, anchor, localeManager) { + const { + dateRangeBarsText, + dateRangeDivider, + dateRangeValueText, + priceRangeValueText, + priceRangeDivider, + priceRangePercentageText, + volumeText + } = this; + const horizontalGap = 8; + const verticalGap = 6; + const dividerLineHeight = datum.statistics.fontSize + 3; + const dividerLineOffset = -2; + const textStyles = this.getTextStyles(datum); + const dividerLineStyles = { + ...this.getDividerStyles(datum), + x1: 0, + y1: 0, + x2: 0, + y2: dividerLineHeight + }; + const dateScenes = [dateRangeBarsText, dateRangeDivider, dateRangeValueText]; + const priceScenes = [priceRangeValueText, priceRangeDivider, priceRangePercentageText]; + const scenes = []; + if (stats.priceRange) { + priceRangeValueText.setProperties({ + ...textStyles, + text: this.formatPriceRangeValue(stats.priceRange.value, localeManager) + }); + priceRangeDivider.setProperties(dividerLineStyles); + priceRangePercentageText.setProperties({ + ...textStyles, + text: this.formatPriceRangePercentage(stats.priceRange.percentage, localeManager) + }); + layoutScenesRow(priceScenes, anchor.x, horizontalGap); + scenes.push(priceScenes); + } + if (stats.dateRange) { + dateRangeBarsText.setProperties({ + ...textStyles, + text: this.formatDateRangeBars(stats.dateRange.bars, localeManager) + }); + dateRangeDivider.setProperties(dividerLineStyles); + dateRangeValueText.setProperties({ + ...textStyles, + text: this.formatDateRangeValue(stats.dateRange.value) + }); + layoutScenesRow(dateScenes, anchor.x, horizontalGap); + scenes.push(dateScenes); + } + if (stats.volume == null) { + volumeText.visible = false; + } else { + volumeText.setProperties({ + ...textStyles, + x: anchor.x, + text: this.formatVolume(stats.volume, localeManager), + visible: true + }); + scenes.push(volumeText); + } + layoutScenesColumn(scenes, anchor.y, verticalGap); + priceRangeDivider.y1 += dividerLineOffset; + priceRangeDivider.y2 += dividerLineOffset; + dateRangeDivider.y1 += dividerLineOffset; + dateRangeDivider.y2 += dividerLineOffset; + return scenes; + } + updateBackground(datum, bbox, padding) { + const styles = this.getBackgroundStyles(datum); + this.background.setProperties({ + ...styles, + ...bbox, + x: bbox.x - bbox.width / 2 + padding, + y: bbox.y + }); + } + reposition(scenes, padding, context) { + const { width, height } = context.seriesRect; + const background = Vec411.from(this.background.getBBox()); + let offsetX = 0; + if (background.x1 < 0) + offsetX = -background.x1; + if (background.x2 > width) + offsetX = width - background.x2; + const offsetY = Math.min(padding, height - background.y2); + for (const scene of scenes) { + if (Array.isArray(scene)) { + const rowWidth = import_ag_charts_community77._ModuleSupport.Group.computeChildrenBBox(scene).width; + for (const scene_ of scene) { + layoutAddX(scene_, offsetX - rowWidth / 2); + layoutAddY(scene_, offsetY); + } + } else { + layoutAddX(scene, offsetX - scene.getBBox().width / 2); + layoutAddY(scene, offsetY); + } + } + this.background.x += offsetX; + this.background.y += offsetY; + } + getTextStyles(datum) { + return { + fill: datum.statistics.color, + fontFamily: datum.statistics.fontFamily, + fontSize: datum.statistics.fontSize, + fontStyle: datum.statistics.fontStyle, + fontWeight: datum.statistics.fontWeight, + textBaseline: "top" + }; + } + getDividerStyles(datum) { + return { + stroke: datum.statistics.divider.stroke, + strokeOpacity: datum.statistics.divider.strokeOpacity, + strokeWidth: datum.statistics.divider.strokeWidth + }; + } + getBackgroundStyles(datum) { + return { + fill: datum.statistics.fill, + stroke: datum.statistics.stroke, + strokeOpacity: datum.statistics.strokeOpacity, + strokeWidth: datum.statistics.strokeWidth, + cornerRadius: 4 + }; + } + formatDateRangeBars(bars, localeManager) { + return localeManager?.t("measurerDateRangeBars", { value: bars }) ?? `${bars}`; + } + formatDateRangeValue(time) { + const range2 = []; + const sign = time >= 0 ? "" : "-"; + time = Math.abs(time); + const MINUTE = 1e3 * 60; + const HOUR = MINUTE * 60; + const DAY2 = HOUR * 24; + const minutes = Math.floor(time / MINUTE); + const hours = Math.floor(time / HOUR); + const days = Math.floor(time / DAY2); + const remainderHours = hours % (DAY2 / HOUR); + const remainderMinutes = minutes % (HOUR / MINUTE); + if (days >= 1) + range2.push(`${days}d`); + if (hours >= 1 && (time < DAY2 || remainderHours !== 0)) + range2.push(`${remainderHours}h`); + if (time < HOUR || remainderMinutes !== 0) + range2.push(`${remainderMinutes}m`); + range2[0] = `${sign}${range2[0]}`; + return range2.join(" "); + } + formatPriceRangeValue(value, localeManager) { + return localeManager?.t("measurerPriceRangeValue", { value: Number(value.toFixed(2)) }) ?? `${value}`; + } + formatPriceRangePercentage(percentage, localeManager) { + return localeManager?.t("measurerPriceRangePercent", { value: percentage }) ?? `${percentage}`; + } + formatVolume(volume, localeManager) { + const volumeString = Number.isNaN(volume) ? "" : this.volumeFormatter.format(volume); + return localeManager?.t("measurerVolume", { value: volumeString }) ?? volumeString; + } +}; +var QuickMeasurerStatisticsScene = class extends MeasurerStatisticsScene { + getDirectionStyles(datum) { + return this.verticalDirection === "down" ? datum.down.statistics : datum.up.statistics; + } + getTextStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + ...super.getTextStyles(datum), + fill: styles.color, + fontFamily: styles.fontFamily, + fontSize: styles.fontSize, + fontStyle: styles.fontStyle, + fontWeight: styles.fontWeight + }; + } + getDividerStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + stroke: styles.divider.stroke, + strokeOpacity: styles.divider.strokeOpacity, + strokeWidth: styles.divider.strokeWidth + }; + } + getBackgroundStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + ...super.getBackgroundStyles(datum), + fill: styles.fill, + stroke: styles.stroke, + strokeOpacity: styles.strokeOpacity, + strokeWidth: styles.strokeWidth + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerScene.ts +var { Vec2: Vec216, Vec4: Vec412 } = import_ag_charts_community78._ModuleSupport; +var MeasurerScene = class extends StartEndScene { + constructor() { + super(); + this.type = "measurer"; + this.horizontalLine = new CollidableLine(); + this.verticalLine = new CollidableLine(); + // These four bounding lines are named after the way they are drawn, e.g. the horizontalStartLine is a horizontal + // line that is only shown when the measurer has the 'vertical' direction. + this.horizontalStartLine = new CollidableLine(); + this.horizontalEndLine = new CollidableLine(); + this.verticalStartLine = new CollidableLine(); + this.verticalEndLine = new CollidableLine(); + this.horizontalEndCap = new ArrowCapScene(); + this.verticalEndCap = new ArrowCapScene(); + this.background = new import_ag_charts_community78._ModuleSupport.Path({ zIndex: -1 }); + this.updateBackground = WithBackgroundScene.updateBackground.bind(this); + this.statistics = this.createStatisticsScene(); + this.statistics.zIndex = 1; + this.append([ + this.background, + this.verticalStartLine, + this.verticalEndLine, + this.horizontalStartLine, + this.horizontalEndLine, + this.horizontalLine, + this.verticalLine, + this.horizontalEndCap, + this.verticalEndCap, + this.start, + this.end, + this.statistics + ]); + } + static is(value) { + return AnnotationScene.isCheck(value, "measurer"); + } + createStatisticsScene() { + return new MeasurerStatisticsScene(); + } + update(datum, context) { + const coords = convertLine(datum, context); + if (coords == null) { + this.visible = false; + return; + } + this.visible = datum.visible ?? true; + if (!this.visible) + return; + const extended = this.extendPerpendicular(coords, datum, context); + const verticalStart = { ...extended, y2: extended.y1 }; + const verticalEnd = { ...extended, y1: extended.y2 }; + this.verticalDirection = coords.y1 < coords.y2 ? "down" : "up"; + this.updateVisibilities(datum); + this.updateLines(datum, coords); + this.updateHandles(datum, coords); + this.updateText(datum, coords); + this.updateCaps(datum, coords); + this.updateBoundingLines(datum, extended); + this.updateBackground(datum, verticalStart, verticalEnd, context); + this.updateStatistics(datum, coords, context); + this.updateAnchor(datum, coords, context); + } + extendPerpendicular(coords, datum, context) { + const extended = { + x1: Math.min(coords.x1, coords.x2), + x2: Math.max(coords.x1, coords.x2), + y1: Math.min(coords.y1, coords.y2), + y2: Math.max(coords.y1, coords.y2) + }; + const [start, end] = Vec216.from(context.yAxis.bounds); + if (DateRangeProperties.is(datum)) { + if (datum.extendAbove) + extended.y1 = start.y; + if (datum.extendBelow) + extended.y2 = end.y; + } else if (PriceRangeProperties.is(datum)) { + if (datum.extendLeft) + extended.x1 = start.x; + if (datum.extendRight) + extended.x2 = end.x; + } + return extended; + } + updateVisibilities(datum) { + const { + horizontalStartLine, + horizontalEndLine, + horizontalEndCap, + verticalStartLine, + verticalEndLine, + verticalEndCap + } = this; + const { direction } = datum; + verticalStartLine.visible = direction !== "vertical"; + verticalEndLine.visible = direction !== "vertical"; + horizontalEndCap.visible = direction !== "vertical"; + horizontalStartLine.visible = direction !== "horizontal"; + horizontalEndLine.visible = direction !== "horizontal"; + verticalEndCap.visible = direction !== "horizontal"; + } + updateLines(datum, coords) { + const { horizontalLine, verticalLine } = this; + const { direction } = datum; + const { x1, y1, x2, y2 } = coords; + const center = Vec216.round(Vec412.center(coords), 0); + const lineStyles = this.getLineStyles(datum); + if (direction !== "vertical") { + horizontalLine.setProperties({ + ...lineStyles, + x1, + x2, + y1: center.y, + y2: center.y + }); + } + if (direction !== "horizontal") { + verticalLine.setProperties({ + ...lineStyles, + x1: center.x, + x2: center.x, + y1, + y2 + }); + } + } + updateText(datum, coords) { + const { direction } = datum; + const center = Vec216.round(Vec412.center(coords), 0); + let line; + const textCoords = { ...coords }; + if (direction === "vertical") { + line = this.verticalLine; + textCoords.x1 = center.x; + textCoords.x2 = center.x; + } else { + line = this.horizontalLine; + textCoords.y1 = center.y; + textCoords.y2 = center.y; + } + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + const { id } = line; + const clip = updateLineText(id, line, textCoords, datum.text, this.text, datum.text.label, datum.strokeWidth); + let verticalClipMask; + if (direction === "both" && clip && this.text) { + const textBBox = Vec412.from(this.text.getBBox()); + const { offset } = clip.numbers; + const crossesVerticalLine = textBBox.x1 <= center.x + offset.x && textBBox.x2 >= center.x - offset.x; + if (crossesVerticalLine) { + verticalClipMask = { + x: center.x, + y: clip.clipMask.y, + radius: this.text.getBBox().height / 2 + Vec216.length(offset) + }; + } + } + this.verticalLine.setClipMask(id, verticalClipMask); + } + updateCaps(datum, coords) { + const { horizontalEndCap, verticalEndCap } = this; + const { direction } = datum; + const { x1, y1, x2, y2 } = coords; + const center = Vec216.round(Vec412.center(coords), 0); + const { stroke: stroke2, strokeWidth, strokeOpacity } = this.getLineStyles(datum); + const capStyles = { stroke: stroke2, strokeWidth, strokeOpacity }; + if (direction !== "vertical") { + const angle = x1 <= x2 ? 0 : Math.PI; + let x = x2; + if (direction === "horizontal") { + x += x1 <= x2 ? -2 : 2; + } + horizontalEndCap.update({ ...capStyles, x, y: center.y, angle }); + } + if (direction !== "horizontal") { + const angle = y1 <= y2 ? Math.PI / 2 : Math.PI / -2; + let y = y2; + if (direction === "vertical") { + y += y1 <= y2 ? -2 : 2; + } + verticalEndCap.update({ ...capStyles, x: center.x, y, angle }); + } + } + updateBoundingLines(datum, extendedCoords) { + const { verticalStartLine, verticalEndLine, horizontalStartLine, horizontalEndLine } = this; + const { direction } = datum; + const { x1, y1, x2, y2 } = extendedCoords; + const lineStyles = this.getLineStyles(datum); + if (direction === "horizontal") { + verticalStartLine.setProperties({ ...lineStyles, x1, y1, x2: x1, y2 }); + verticalEndLine.setProperties({ ...lineStyles, x1: x2, y1, x2, y2 }); + } + if (direction === "vertical") { + horizontalStartLine.setProperties({ ...lineStyles, x1, y1, x2, y2: y1 }); + horizontalEndLine.setProperties({ ...lineStyles, x1, y1: y2, x2, y2 }); + } + } + updateStatistics(datum, coords, context) { + const point = Vec216.add(Vec412.bottomCenter(coords), Vec216.from(0, 10)); + const statistics = { volume: this.getVolume(datum) }; + if (datum.hasPriceRange) { + statistics.priceRange = { + percentage: this.getPriceRangePercentage(datum), + value: this.getPriceRangeValue(datum) + }; + } + if (datum.hasDateRange) { + statistics.dateRange = { + bars: this.getDateRangeBars(coords, context), + value: this.getDateRangeValue(datum) + }; + } + this.statistics.update(datum, statistics, point, coords, context, this.verticalDirection, datum.localeManager); + } + updateAnchor(_datum, coords, _context, _bbox) { + const point = Vec412.topCenter(coords); + Vec216.apply(this.anchor, import_ag_charts_community78._ModuleSupport.Transformable.toCanvasPoint(this.horizontalLine, point.x, point.y)); + } + getBackgroundPoints(_datum, verticalStart, verticalEnd, _bounds) { + const [startStart, startEnd] = Vec216.from(verticalStart); + const [endStart, endEnd] = Vec216.from(verticalEnd); + return [startStart, startEnd, endEnd, endStart]; + } + getLineStyles(datum) { + const { lineDashOffset, stroke: stroke2, strokeWidth, strokeOpacity } = datum; + return { + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke2, + strokeWidth, + strokeOpacity, + fillOpacity: 0 + }; + } + getBackgroundStyles(datum) { + const { background } = datum; + return { + fill: background.fill, + fillOpacity: background.fillOpacity + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + } + containsPoint(x, y) { + const { + horizontalLine, + text: text2, + verticalLine, + horizontalStartLine, + horizontalEndLine, + verticalStartLine, + verticalEndLine + } = this; + return super.containsPoint(x, y) || horizontalLine.isPointInPath(x, y) || verticalLine.isPointInPath(x, y) || horizontalStartLine.visible && horizontalStartLine.isPointInPath(x, y) || horizontalEndLine.visible && horizontalEndLine.isPointInPath(x, y) || verticalStartLine.visible && verticalStartLine.isPointInPath(x, y) || verticalEndLine.visible && verticalEndLine.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y)) + return "handle"; + return "line"; + } + getDateRangeBars(coords, context) { + const { step } = context.xAxis.scale; + const sign = coords.x1 <= coords.x2 ? 1 : -1; + return step ? Math.round(Vec412.width(coords) / step) * sign : 0; + } + getDateRangeValue(datum) { + const start = getGroupingValue(datum.start.x); + const end = getGroupingValue(datum.end.x); + if (!(0, import_ag_charts_core37.isDate)(start) || !(0, import_ag_charts_core37.isDate)(end)) { + throw new Error("Can not create a date range measurement of non-date x-axis."); + } + return end.getTime() - start.getTime(); + } + getPriceRangePercentage(datum) { + if (datum.start.y == null || datum.end.y == null) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + const endY = getGroupingValue(datum.end.y); + const startY = getGroupingValue(datum.start.y); + if (!(0, import_ag_charts_core37.isNumber)(endY) || !(0, import_ag_charts_core37.isNumber)(startY)) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + return (endY - startY) / startY; + } + getPriceRangeValue(datum) { + if (datum.start.y == null || datum.end.y == null) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + const endY = getGroupingValue(datum.end.y); + const startY = getGroupingValue(datum.start.y); + if (!(0, import_ag_charts_core37.isNumber)(endY) || !(0, import_ag_charts_core37.isNumber)(startY)) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + return endY - startY; + } + getVolume(datum) { + return datum.getVolume(datum.start.x, datum.end.x); + } +}; +var QuickMeasurerScene = class extends MeasurerScene { + constructor() { + super(...arguments); + this.type = "quick-measurer"; + } + static is(value) { + return AnnotationScene.isCheck(value, "quick-measurer"); + } + createStatisticsScene() { + return new QuickMeasurerStatisticsScene(); + } + getDirectionStyles(datum) { + return this.verticalDirection === "down" ? datum.down : datum.up; + } + getLineStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + ...super.getLineStyles(datum), + stroke: styles.stroke, + strokeWidth: styles.strokeWidth, + strokeOpacity: styles.strokeOpacity + }; + } + getBackgroundStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + fill: styles.fill, + fillOpacity: styles.fillOpacity + }; + } + getHandleStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + fill: styles.handle.fill, + stroke: styles.handle.stroke ?? styles.stroke, + strokeOpacity: styles.handle.strokeOpacity ?? styles.strokeOpacity, + strokeWidth: styles.handle.strokeWidth ?? styles.strokeWidth + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerState.ts +var import_ag_charts_community79 = require("ag-charts-community"); +var { StateMachine: StateMachine9, StateMachineProperty: StateMachineProperty9, Debug: Debug9 } = import_ag_charts_community79._ModuleSupport; +var MeasurerTypeStateMachine = class extends StateMachine9 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point }); + ctx.create(datum); + }; + const actionEndUpdate = ({ point }) => { + const { datum, node } = this; + datum?.set({ end: point }); + node?.toggleActive(true); + node?.toggleHandles({ end: false }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ end: true }); + }; + const actionCancel = () => ctx.delete(); + const onExitEnd = () => { + ctx.showAnnotationOptions(); + ctx.recordAction(`Create ${this.node?.type} annotation`); + }; + super("start", { + start: { + reset: StateMachine9.parent, + click: { + target: "end", + action: actionCreate + }, + drag: { + target: "end", + action: actionCreate + } + }, + end: { + hover: actionEndUpdate, + drag: actionEndUpdate, + click: { + target: StateMachine9.parent, + action: actionEndFinish + }, + dragEnd: { + target: StateMachine9.parent, + action: actionEndFinish + }, + reset: { + target: StateMachine9.parent, + action: actionCancel + }, + cancel: { + target: StateMachine9.parent, + action: actionCancel + }, + onExit: onExitEnd + } + }); + this.debug = Debug9.create(true, "annotations"); + } +}; +__decorateClass([ + StateMachineProperty9() +], MeasurerTypeStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty9() +], MeasurerTypeStateMachine.prototype, "node", 2); +var DateRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new DateRangeProperties(); + } +}; +var PriceRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new PriceRangeProperties(); + } +}; +var DatePriceRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new DatePriceRangeProperties(); + } +}; +var QuickDatePriceRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new QuickDatePriceRangeProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerConfig.ts +var dateRangeConfig = { + type: "date-range" /* DateRange */, + datum: DateRangeProperties, + scene: MeasurerScene, + isDatum: DateRangeProperties.is, + translate: (node, datum, translation, context) => { + if (DateRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (DateRangeProperties.is(datum) && DateRangeProperties.is(copiedDatum) && MeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (DateRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new DateRangeStateMachine({ + ...ctx, + create: createDatum("date-range" /* DateRange */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var priceRangeConfig = { + type: "price-range" /* PriceRange */, + datum: PriceRangeProperties, + scene: MeasurerScene, + isDatum: PriceRangeProperties.is, + translate: (node, datum, translation, context) => { + if (PriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (PriceRangeProperties.is(datum) && PriceRangeProperties.is(copiedDatum) && MeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (PriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new PriceRangeStateMachine({ + ...ctx, + create: createDatum("date-range" /* DateRange */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var datePriceRangeConfig = { + type: "date-price-range" /* DatePriceRange */, + datum: DatePriceRangeProperties, + scene: MeasurerScene, + isDatum: DatePriceRangeProperties.is, + translate: (node, datum, translation, context) => { + if (DatePriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (DatePriceRangeProperties.is(datum) && DatePriceRangeProperties.is(copiedDatum) && MeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (DatePriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new DatePriceRangeStateMachine({ + ...ctx, + create: createDatum("date-range" /* DateRange */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var quickDatePriceRangeConfig = { + type: "quick-date-price-range" /* QuickDatePriceRange */, + datum: QuickDatePriceRangeProperties, + scene: QuickMeasurerScene, + isDatum: QuickDatePriceRangeProperties.is, + translate: (node, datum, translation, context) => { + if (QuickDatePriceRangeProperties.is(datum) && QuickMeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (QuickDatePriceRangeProperties.is(datum) && QuickDatePriceRangeProperties.is(copiedDatum) && QuickMeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (QuickDatePriceRangeProperties.is(datum) && QuickMeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new QuickDatePriceRangeStateMachine({ + ...ctx, + create: createDatum("quick-date-price-range" /* QuickDatePriceRange */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/note/noteScene.ts +var import_ag_charts_community80 = require("ag-charts-community"); +var import_ag_charts_core38 = require("ag-charts-core"); +var { ZIndexMap: ZIndexMap3 } = import_ag_charts_community80._ModuleSupport; +var NoteScene = class extends TextualPointScene { + constructor() { + super(); + this.type = "note" /* Note */; + this.shape = new import_ag_charts_community80._ModuleSupport.Rect(); + this.iconBackground = new import_ag_charts_community80._ModuleSupport.TranslatableSvgPath( + "M22 1.83333C22 0.820811 21.1792 0 20.1667 0H1.83333C0.820811 0 0 0.82081 0 1.83333V13.9868C0 14.9994 0.820811 15.8202 1.83333 15.8202L5.88971 15.8202C6.44575 15.8202 6.97175 16.0725 7.31971 16.5062L9.57006 19.3112C10.304 20.2259 11.6962 20.2259 12.4301 19.3112L14.6804 16.5062C15.0284 16.0725 15.5544 15.8202 16.1104 15.8202L20.1667 15.8202C21.1792 15.8202 22 14.9994 22 13.9868V1.83333Z" + ); + this.iconLines = new import_ag_charts_community80._ModuleSupport.TranslatableSvgPath( + "M17.1114 5.75C17.1114 6.16421 16.7756 6.5 16.3614 6.5H5.63916C5.22495 6.5 4.88916 6.16421 4.88916 5.75V5.75C4.88916 5.33579 5.22495 5 5.63916 5H16.3614C16.7756 5 17.1114 5.33579 17.1114 5.75V5.75ZM17.1114 9.25C17.1114 9.66421 16.7756 10 16.3614 10H5.63916C5.22495 10 4.88916 9.66421 4.88916 9.25V9.25C4.88916 8.83579 5.22495 8.5 5.63916 8.5H16.3614C16.7756 8.5 17.1114 8.83579 17.1114 9.25V9.25Z" + ); + this.active = false; + this.shape.visible = false; + this.label.visible = false; + this.iconBackground.fillShadow = new import_ag_charts_community80._ModuleSupport.DropShadow(); + this.append([this.shape, this.label, this.iconBackground, this.iconLines, this.handle]); + } + static is(value) { + return AnnotationScene.isCheck(value, "note" /* Note */); + } + update(datum, context) { + this.updateIcon(datum, context); + super.update(datum, context); + } + getTextBBox(datum, coords, context) { + const bbox = super.getTextBBox(datum, coords, context); + bbox.x -= datum.width / 2; + bbox.x = (0, import_ag_charts_core38.clamp)(0, bbox.x, context.seriesRect.width - datum.width); + const padding = datum.getPadding().top; + const topY = bbox.y - LABEL_OFFSET - padding * 2; + const bottomY = bbox.y + DivariantHandle.HANDLE_SIZE + padding * 2; + if (topY - bbox.height - TOOLBAR_OFFSET < 0) { + bbox.y = bottomY; + datum.position = "top"; + } else { + bbox.y = topY + padding; + datum.position = "bottom"; + } + return bbox; + } + updateLabel(datum, bbox) { + const labelVisibility = datum.visible === false ? false : this.label.visible; + super.updateLabel(datum, bbox); + this.label.visible = labelVisibility; + this.label.text = (0, import_ag_charts_core38.wrapText)(datum.text, { + maxWidth: 200, + font: datum, + textWrap: "always", + avoidOrphans: false + }); + } + updateShape(datum, bbox) { + const { shape } = this; + shape.fill = datum.background.fill; + shape.fillOpacity = datum.background.fillOpacity ?? 1; + shape.stroke = datum.background.stroke; + shape.strokeOpacity = datum.background.strokeOpacity ?? 1; + shape.strokeWidth = datum.background.strokeWidth ?? 1; + shape.cornerRadius = 4; + const padding = datum.getPadding().top; + const isPositionTop = datum.position === "top"; + shape.x = bbox.x - padding; + shape.width = datum.width + padding * 2; + shape.height = bbox.height + padding * 2; + shape.y = bbox.y + (isPositionTop ? 0 : -bbox.height) - padding; + } + updateIcon(datum, context) { + const { active, iconBackground, iconLines } = this; + const { x, y } = convertPoint(datum, context); + iconBackground.translationX = x - ICON_WIDTH / 2; + iconBackground.translationY = y - ICON_HEIGHT; + iconLines.translationX = iconBackground.translationX; + iconLines.translationY = iconBackground.translationY; + iconBackground.fill = datum.fill; + iconBackground.fillOpacity = datum.fillOpacity ?? 1; + iconBackground.stroke = datum.stroke; + iconBackground.strokeOpacity = datum.strokeOpacity ?? 1; + iconBackground.strokeWidth = datum.strokeWidth ?? 1; + iconLines.fill = datum.stroke; + if (active) { + iconBackground.fillShadow.color = datum.fill ?? "rgba(0, 0, 0, 0.22)"; + } else { + iconBackground.fillShadow.color = "rgba(0, 0, 0, 0.22)"; + } + } + updateAnchor(datum, bbox, context) { + const padding = datum.getPadding().top; + const isPositionTop = datum.position === "top"; + const direction = isPositionTop ? 1 : -1; + return { + x: bbox.x + context.seriesRect.x + datum.width / 2, + y: bbox.y + context.seriesRect.y + direction * (bbox.height + padding), + position: isPositionTop ? "below" : "above" + }; + } + getLabelCoords(datum, bbox) { + const isPositionTop = datum.position === "top"; + const padding = datum.getPadding().top + (0, import_ag_charts_core38.calcLineHeight)(datum.fontSize, ANNOTATION_TEXT_LINE_HEIGHT) / 2; + return { x: bbox.x, y: bbox.y + (isPositionTop ? padding / 2 : 0) }; + } + getTextBaseline(datum) { + return datum.position === "top" ? "middle" : datum.position; + } + getHandleCoords(_datum, coords, _bbox) { + return { + x: coords.x, + y: coords.y + DivariantHandle.HANDLE_SIZE / 2 + 4 + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.fill, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } + toggleHovered(hovered, active, readOnly) { + super.toggleHovered(hovered, active, readOnly); + const visible = hovered || active && !readOnly; + this.label.visible = visible; + this.shape.visible = visible; + this.zIndex = visible ? ZIndexMap3.CHART_ANNOTATION_FOCUSED : ZIndexMap3.CHART_ANNOTATION; + } + toggleActive(active) { + super.toggleActive(active); + this.label.visible = active; + this.shape.visible = active; + this.active = active; + } + containsPoint(x, y) { + if (this.shape.visible && this.shape.containsPoint(x, y)) + return true; + if (this.iconBackground.containsPoint(x, y)) + return true; + return super.containsPoint(x, y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/note/noteState.ts +var NoteStateMachine = class extends TextualPointStateMachine { + createDatum() { + return new NoteProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/note/noteConfig.ts +var noteConfig = { + type: "note" /* Note */, + datum: NoteProperties, + scene: NoteScene, + isDatum: NoteProperties.is, + translate: (node, datum, transition, context) => { + if (NoteProperties.is(datum) && NoteScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (NoteProperties.is(datum) && NoteProperties.is(copiedDatum) && NoteScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (NoteProperties.is(datum) && NoteScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new NoteStateMachine({ + ...ctx, + create: createDatum("note" /* Note */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/parallel-channel/parallelChannelScene.ts +var import_ag_charts_community81 = require("ag-charts-community"); +var { Vec2: Vec217, Vec4: Vec413 } = import_ag_charts_community81._ModuleSupport; +var ParallelChannelScene = class extends ChannelScene { + constructor() { + super(); + this.type = "parallel-channel"; + this.handles = { + topLeft: new DivariantHandle(), + topMiddle: new UnivariantHandle(), + topRight: new DivariantHandle(), + bottomLeft: new DivariantHandle(), + bottomMiddle: new UnivariantHandle(), + bottomRight: new DivariantHandle() + }; + this.middleLine = new CollidableLine(); + this.append([this.background, this.topLine, this.middleLine, this.bottomLine, ...Object.values(this.handles)]); + } + static is(value) { + return AnnotationScene.isCheck(value, "parallel-channel"); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, handles } = this; + if (activeHandle == null) + return; + const { offset } = handles[activeHandle].drag(target); + handles[activeHandle].toggleDragging(true); + if (activeHandle === "topMiddle" || activeHandle === "bottomMiddle") { + offset.x = 0; + } + let translateVectors = []; + let allowSnapping = snapping; + switch (activeHandle) { + case "topLeft": + case "bottomLeft": + translateVectors = ["topLeft", "bottomLeft"]; + break; + case "topMiddle": + translateVectors = ["topLeft", "topRight"]; + offset.y -= UnivariantHandle.HANDLE_SIZE / 2; + allowSnapping = false; + break; + case "topRight": + case "bottomRight": + translateVectors = ["topRight", "bottomRight"]; + break; + case "bottomMiddle": + translateVectors = ["bottomLeft", "bottomRight"]; + offset.y -= UnivariantHandle.HANDLE_SIZE / 2; + allowSnapping = false; + break; + } + const top = convertLine(datum, context); + const bottom = convertLine(datum.bottom, context); + if (!top || !bottom) + return; + const vectors = { + topLeft: Vec413.start(top), + topRight: Vec413.end(top), + bottomLeft: Vec413.start(bottom), + bottomRight: Vec413.end(bottom) + }; + const snap = { + vectors: { + topLeft: vectors.topRight, + bottomLeft: vectors.bottomRight, + topRight: vectors.topLeft, + bottomRight: vectors.bottomLeft + }, + angle: datum.snapToAngle + }; + const points = translate(vectors, offset, context, { + overflowContinuous: this.overflowContinuous, + translateVectors, + snap: allowSnapping ? snap : void 0 + }); + datum.start.x = points.topLeft.x; + datum.start.y = points.topLeft.y; + datum.end.x = points.topRight.x; + datum.end.y = points.topRight.y; + datum.height = points.topLeft.y - points.bottomLeft.y; + } + getTranslatePointsVectors(start, end) { + const { bottomLeft, topLeft } = this.handles; + const height = bottomLeft.getBBox().y - topLeft.getBBox().y; + const bottomStart = Vec217.add(start, Vec217.from(0, height)); + const bottomEnd = Vec217.add(end, Vec217.from(0, height)); + return { start, end, bottomStart, bottomEnd }; + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.middleLine.visible && this.middleLine.strokeWidth > 0 && this.middleLine.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.middleLine.visible && this.middleLine.strokeWidth > 0 && this.middleLine.containsPoint(x, y)) + return "line"; + return super.getNodeAtCoords(x, y); + } + updateLines(datum, top, bottom, context, naturalTop, naturalBottom) { + const { topLine, middleLine, bottomLine } = this; + const { lineDashOffset, stroke: stroke2, strokeOpacity, strokeWidth } = datum; + const lineDash = datum.getLineDash(); + const lineStyles = { + lineCap: datum.getLineCap(), + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth + }; + topLine.setProperties({ ...top, ...lineStyles }); + bottomLine.setProperties({ ...bottom, ...lineStyles }); + const middlePoints = this.extendLine( + { + x1: naturalTop.x1, + y1: naturalBottom.y1 + (naturalTop.y1 - naturalBottom.y1) / 2, + x2: naturalTop.x2, + y2: naturalBottom.y2 + (naturalTop.y2 - naturalBottom.y2) / 2 + }, + datum, + context + ); + middleLine.setProperties({ + ...middlePoints, + lineDash: datum.middle.lineDash ?? lineDash, + lineDashOffset: datum.middle.lineDashOffset ?? lineDashOffset, + stroke: datum.middle.stroke ?? stroke2, + strokeOpacity: datum.middle.strokeOpacity ?? strokeOpacity, + strokeWidth: datum.middle.strokeWidth ?? strokeWidth, + visible: datum.middle.visible ?? true + }); + } + updateHandles(datum, top, bottom) { + const { + handles: { topLeft, topMiddle, topRight, bottomLeft, bottomMiddle, bottomRight } + } = this; + const handleStyles = { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + topLeft.update({ ...handleStyles, ...Vec413.start(top) }); + topRight.update({ ...handleStyles, ...Vec413.end(top) }); + bottomLeft.update({ ...handleStyles, ...Vec413.start(bottom) }); + bottomRight.update({ ...handleStyles, ...Vec413.end(bottom) }); + topMiddle.update({ + ...handleStyles, + ...Vec217.sub(Vec413.center(top), Vec217.from(topMiddle.handle.width / 2, topMiddle.handle.height / 2)) + }); + bottomMiddle.update({ + ...handleStyles, + ...Vec217.sub(Vec413.center(bottom), Vec217.from(bottomMiddle.handle.width / 2, bottomMiddle.handle.height / 2)) + }); + } + updateText(datum, top, bottom) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateChannelText(true, top, bottom, datum.text, datum.strokeWidth, this.text, datum.text.label); + } + getBackgroundPoints(datum, top, bottom, bounds) { + const isFlippedX = top.x1 > top.x2; + const isFlippedY = top.y1 > top.y2; + const outOfBoundsStart = top.x1 !== bottom.x1 && top.y1 !== bottom.y1; + const outOfBoundsEnd = top.x2 !== bottom.x2 && top.y2 !== bottom.y2; + const points = Vec217.from(top); + if (datum.extendEnd && outOfBoundsEnd) { + points.push(Vec217.from(isFlippedX ? bounds.x1 : bounds.x2, isFlippedY ? bounds.y1 : bounds.y2)); + } + points.push(...Vec217.from(bottom).reverse()); + if (datum.extendStart && outOfBoundsStart) { + points.push(Vec217.from(isFlippedX ? bounds.x2 : bounds.x1, isFlippedY ? bounds.y2 : bounds.y1)); + } + return points; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/parallel-channel/parallelChannelState.ts +var import_ag_charts_community82 = require("ag-charts-community"); +var import_ag_charts_core39 = require("ag-charts-core"); +var { StateMachine: StateMachine10, StateMachineProperty: StateMachineProperty10, Debug: Debug10 } = import_ag_charts_community82._ModuleSupport; +var ParallelChannelStateMachine = class extends StateMachine10 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = new ParallelChannelProperties(); + datum.set({ start: point, end: point, height: 0 }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ + topLeft: true, + topMiddle: false, + topRight: false, + bottomLeft: false, + bottomMiddle: false, + bottomRight: false + }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ + topRight: true + }); + ctx.update(); + }; + const actionHeightUpdate = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !(0, import_ag_charts_core39.isNumber)(startY) || !(0, import_ag_charts_core39.isNumber)(endY) || !(0, import_ag_charts_core39.isNumber)(pointY)) + return; + const height = endY - (pointY ?? 0); + const bottomStartY = startY - height; + node?.toggleHandles({ bottomLeft: true, bottomRight: true }); + if (!ctx.validatePoint({ x: datum.start.x, y: bottomStartY }, { overflowContinuous: true }) || !ctx.validatePoint({ x: datum.end.x, y: point.y }, { overflowContinuous: true })) { + return; + } + datum.set({ height }); + ctx.update(); + }; + const actionHeightFinish = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !(0, import_ag_charts_core39.isNumber)(startY) || !(0, import_ag_charts_core39.isNumber)(endY) || !(0, import_ag_charts_core39.isNumber)(pointY)) + return; + const height = endY - (pointY ?? 0); + const bottomStartY = startY - height; + node?.toggleHandles(true); + if (!ctx.validatePoint({ x: datum.start.x, y: bottomStartY }, { overflowContinuous: true }) || !ctx.validatePoint({ x: datum.end.x, y: point.y }, { overflowContinuous: true })) { + return; + } + datum.set({ height }); + ctx.recordAction(`Create ${"parallel-channel" /* ParallelChannel */} annotation`); + ctx.showAnnotationOptions(); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine10.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + drag: actionEndUpdate, + click: { + target: "height", + action: actionEndFinish + }, + dragEnd: { + target: "height", + action: actionEndFinish + }, + reset: { + target: StateMachine10.parent, + action: actionCancel + }, + cancel: { + target: StateMachine10.parent, + action: actionCancel + } + }, + height: { + hover: actionHeightUpdate, + click: { + target: StateMachine10.parent, + action: actionHeightFinish + }, + drag: { + target: StateMachine10.parent, + action: actionHeightFinish + }, + reset: { + target: StateMachine10.parent, + action: actionCancel + }, + cancel: { + target: StateMachine10.parent, + action: actionCancel + } + } + }); + this.debug = Debug10.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass([ + StateMachineProperty10() +], ParallelChannelStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty10() +], ParallelChannelStateMachine.prototype, "node", 2); +__decorateClass([ + StateMachineProperty10() +], ParallelChannelStateMachine.prototype, "snapping", 2); + +// packages/ag-charts-enterprise/src/features/annotations/parallel-channel/parallelChannelConfig.ts +var parallelChannelConfig = { + type: "parallel-channel" /* ParallelChannel */, + datum: ParallelChannelProperties, + scene: ParallelChannelScene, + isDatum: ParallelChannelProperties.is, + translate: (node, datum, transition, context) => { + if (ParallelChannelProperties.is(datum) && ParallelChannelScene.is(node)) { + node.translate(datum, transition, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (ParallelChannelProperties.is(datum) && ParallelChannelProperties.is(copiedDatum) && ParallelChannelScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ParallelChannelProperties.is(datum) && ParallelChannelScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ParallelChannelStateMachine({ + ...ctx, + create: createDatum("parallel-channel" /* ParallelChannel */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/text/textScene.ts +var TextScene = class extends TextualPointScene { + constructor() { + super(); + this.type = "text" /* Text */; + this.append([this.label, this.handle]); + } + static is(value) { + return AnnotationScene.isCheck(value, "text" /* Text */); + } + getHandleCoords(_datum, point) { + const halfSize = DivariantHandle.HANDLE_SIZE / 2; + return { + x: point.x + halfSize, + y: point.y + 2 + halfSize + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/text/textState.ts +var TextStateMachine = class extends TextualPointStateMachine { + createDatum() { + return new TextProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/text/textConfig.ts +var textConfig = { + type: "text" /* Text */, + datum: TextProperties, + scene: TextScene, + isDatum: TextProperties.is, + translate: (node, datum, transition, context) => { + if (TextProperties.is(datum) && TextScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (TextProperties.is(datum) && TextProperties.is(copiedDatum) && TextScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (TextProperties.is(datum) && TextScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new TextStateMachine({ + ...ctx, + create: createDatum("text" /* Text */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotationsConfig.ts +var annotationConfigs = { + // Lines + [lineConfig.type]: lineConfig, + [horizontalLineConfig.type]: horizontalLineConfig, + [verticalLineConfig.type]: verticalLineConfig, + // Channels + [parallelChannelConfig.type]: parallelChannelConfig, + [disjointChannelConfig.type]: disjointChannelConfig, + // Fibonaccis + [fibonacciRetracementConfig.type]: fibonacciRetracementConfig, + [fibonacciRetracementTrendBasedConfig.type]: fibonacciRetracementTrendBasedConfig, + // Texts + [calloutConfig.type]: calloutConfig, + [commentConfig.type]: commentConfig, + [noteConfig.type]: noteConfig, + [textConfig.type]: textConfig, + // Shapes + [arrowConfig.type]: arrowConfig, + [arrowUpConfig.type]: arrowUpConfig, + [arrowDownConfig.type]: arrowDownConfig, + // Measurers + [dateRangeConfig.type]: dateRangeConfig, + [priceRangeConfig.type]: priceRangeConfig, + [datePriceRangeConfig.type]: datePriceRangeConfig, + [quickDatePriceRangeConfig.type]: quickDatePriceRangeConfig +}; +function getTypedDatum(datum) { + for (const { isDatum } of Object.values(annotationConfigs)) { + if (isDatum(datum)) { + return datum; + } + } +} + +// packages/ag-charts-enterprise/src/features/annotations/annotationsStateMachine.ts +var import_ag_charts_community83 = require("ag-charts-community"); +var { ActionOnSet, ParallelStateMachine, StateMachine: StateMachine11, StateMachineProperty: StateMachineProperty11, Debug: Debug11 } = import_ag_charts_community83._ModuleSupport; +var AnnotationsStateMachine = class extends ParallelStateMachine { + constructor(ctx) { + super( + new SnappingStateMachine((snapping) => { + this.snapping = snapping; + }), + new UpdateMachine(() => { + this.node = this.active == null ? void 0 : ctx.node(this.active); + }), + new AnnotationsMainStateMachine(ctx, (index) => { + this.active = index; + this.datum = this.active == null ? void 0 : ctx.datum(this.active); + this.node = this.active == null ? void 0 : ctx.node(this.active); + }) + ); + this.snapping = false; + } + // TODO: remove this leak + getActive() { + return this.active; + } + // TODO: remove this leak + isActive(index) { + return index === this.active; + } +}; +__decorateClass([ + StateMachineProperty11() +], AnnotationsStateMachine.prototype, "snapping", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsStateMachine.prototype, "node", 2); +var SnappingStateMachine = class extends StateMachine11 { + constructor(setSnapping) { + super("idle" /* Idle */, { + ["idle" /* Idle */]: { + hover: ({ shiftKey }) => setSnapping(shiftKey), + keyDown: ({ shiftKey }) => setSnapping(shiftKey), + keyUp: ({ shiftKey }) => setSnapping(shiftKey), + click: ({ shiftKey }) => setSnapping(shiftKey), + drag: ({ shiftKey }) => setSnapping(shiftKey) + }, + ["dragging" /* Dragging */]: {}, + ["translating" /* Translating */]: {}, + ["text-input" /* TextInput */]: {} + }); + } +}; +var UpdateMachine = class extends StateMachine11 { + constructor(update) { + super("idle" /* Idle */, { + ["idle" /* Idle */]: { + onEnter: update, + render: update + }, + ["dragging" /* Dragging */]: { + onEnter: update, + render: update + }, + ["translating" /* Translating */]: { + onEnter: update, + render: update + }, + ["text-input" /* TextInput */]: { + render: update + } + }); + } +}; +var AnnotationsMainStateMachine = class extends StateMachine11 { + constructor(ctx, setActive) { + const createDatum = (type) => (datum) => { + ctx.create(type, datum); + this.active = ctx.selectLast(); + }; + const deleteDatum = () => { + if (this.active != null) + ctx.delete(this.active); + this.active = void 0; + ctx.select(); + }; + const stateMachineHelpers = { + createDatum + }; + const createStateMachineContext = { + ...ctx, + delete: deleteDatum, + showTextInput: () => { + if (this.active != null) + ctx.showTextInput(this.active); + }, + deselect: () => { + const prevActive = this.active; + this.active = void 0; + this.hovered = void 0; + ctx.select(this.active, prevActive); + }, + showAnnotationOptions: () => { + if (this.active != null) + ctx.showAnnotationOptions(this.active); + } + }; + const createStateMachines = Object.fromEntries( + Object.entries(annotationConfigs).map(([type, config]) => [ + type, + config.createState(createStateMachineContext, stateMachineHelpers) + ]) + ); + const dragStateMachines = Object.fromEntries( + Object.entries(annotationConfigs).map(([type, config]) => [ + type, + config.dragState(ctx, stateMachineHelpers) + ]) + ); + const actionColor = ({ + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }) => { + if (!this.datum) + return; + if (colorPickerType === "text-color") { + ctx.updateTextInputColor(color6); + } + setColor(this.datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + ctx.update(); + }; + const actionFontSize = (fontSize) => { + const { datum, node } = this; + if (!datum || !node) + return; + if (isTextType(datum)) { + datum.fontSize = fontSize; + ctx.updateTextInputFontSize(fontSize); + } else if (hasLineText(datum)) { + datum.text.fontSize = fontSize; + } + ctx.update(); + }; + const actionLineStyle = (lineStyle) => { + const { datum, node } = this; + if (!datum || !node || !hasLineStyle(datum)) + return; + setLineStyle(datum, lineStyle); + ctx.update(); + }; + const actionUpdateTextInputBBox = (bbox) => { + const { node } = this; + if (!node || !("setTextInputBBox" in node)) + return; + node.setTextInputBBox(bbox); + ctx.update(); + }; + const actionSaveText = ({ textInputValue, bbox }) => { + const { datum } = this; + if (bbox != null && textInputValue != null && textInputValue.length > 0) { + if (!isTextType(datum)) { + return; + } + const wrappedText = maybeWrapText(datum, textInputValue, bbox.width); + datum.set({ text: wrappedText }); + ctx.update(); + ctx.recordAction(`Change ${datum.type} annotation text`); + } else { + ctx.delete(this.active); + ctx.recordAction(`Delete ${datum?.type} annotation`); + } + }; + const actionCancel = () => { + ctx.updateTextInputBBox(void 0); + }; + const guardActive = () => this.active != null; + const guardCopied = () => this.copied != null; + const guardActiveHasLineText = () => { + const { active, datum } = this; + if (active == null) + return false; + if (!datum) + return false; + return hasLineText(datum) && datum.isWriteable(); + }; + const guardActiveNotEphemeral = () => this.active != null && !isEphemeralType(this.datum); + const guardHovered = () => this.hovered != null; + super("idle" /* Idle */, { + ["idle" /* Idle */]: { + onEnter: () => { + ctx.select(this.active, this.active); + if (this.hoverCoords) { + this.hovered = ctx.hoverAtCoords(this.hoverCoords, this.active, this.hovered); + } + }, + hover: ({ offset }) => { + this.hovered = ctx.hoverAtCoords(offset, this.active, this.hovered); + this.hoverCoords = offset; + }, + translate: { + guard: guardActive, + target: "translating" /* Translating */, + action: ({ translation }) => { + ctx.startInteracting(); + ctx.translate(this.active, translation); + ctx.update(); + } + }, + copy: { + guard: guardActiveNotEphemeral, + action: () => { + this.copied = ctx.copy(this.active); + } + }, + cut: { + guard: guardActiveNotEphemeral, + action: () => { + this.copied = ctx.copy(this.active); + deleteDatum(); + } + }, + paste: { + guard: guardCopied, + action: () => { + ctx.paste(this.copied); + } + }, + selectLast: () => { + const previousActive = this.active; + this.active = ctx.selectLast(); + ctx.select(this.active, previousActive); + }, + click: [ + { + guard: () => { + const { active, hovered, datum } = this; + if (active == null || hovered !== active) + return false; + if (!datum) + return false; + return isTextType(datum) && datum.isWriteable(); + }, + target: "text-input" /* TextInput */ + }, + { + action: () => { + const prevActive = this.active; + this.active = this.hovered; + ctx.select(this.active, prevActive); + } + } + ], + dblclick: { + guard: guardActiveHasLineText, + action: ({ offset }) => { + const nodeAtCoords = ctx.getNodeAtCoords(offset, this.active) === "text" ? "text" : "line"; + ctx.showAnnotationSettings(this.active, void 0, nodeAtCoords); + } + }, + dragStart: [ + { + guard: guardHovered, + target: "dragging" /* Dragging */, + action: () => { + const prevActive = this.active; + this.active = this.hovered; + ctx.select(this.active, prevActive); + ctx.startInteracting(); + } + }, + { + action: () => { + const prevActive = this.active; + this.active = this.hovered; + ctx.select(this.active, prevActive); + } + } + ], + color: { + guard: guardActive, + action: actionColor + }, + fontSize: { + guard: guardActive, + action: actionFontSize + }, + lineProps: { + guard: guardActive, + action: (props) => { + const datum = getTypedDatum(this.datum); + datum?.set(props); + ctx.update(); + ctx.recordAction( + `Change ${datum?.type} ${Object.entries(props).map(([key, value]) => `${key} to ${value}`).join(", ")}` + ); + } + }, + lineStyle: { + guard: guardActive, + action: actionLineStyle + }, + lineText: { + guard: guardActive, + action: (props) => { + const datum = getTypedDatum(this.datum); + if (!hasLineText(datum)) + return; + if (isChannelType(datum) && props.position === "center") { + props.position = "inside"; + } + datum.text.set(props); + ctx.update(); + } + }, + updateTextInputBBox: { + guard: guardActive, + action: actionUpdateTextInputBBox + }, + toolbarPressSettings: { + guard: guardActiveHasLineText, + action: (sourceEvent) => { + ctx.showAnnotationSettings(this.active, sourceEvent); + } + }, + reset: () => { + if (this.active != null) { + this.node?.toggleActive(false); + } + this.hovered = void 0; + this.active = void 0; + ctx.select(this.active, this.active); + ctx.resetToIdle(); + }, + delete: () => { + if (this.active == null) + return; + ctx.delete(this.active); + if (isEphemeralType(this.datum)) + return; + ctx.recordAction(`Delete ${this.datum?.type} annotation`); + }, + deleteAll: () => { + ctx.deleteAll(); + }, + ...createStateMachines + }, + ["dragging" /* Dragging */]: { + onEnter: (_, data) => { + if (this.active == null) + return; + const type = ctx.getAnnotationType(this.active); + if (!type) + return; + this.transitionRoot(type); + this.transitionRoot("dragStart", data); + }, + ...dragStateMachines + }, + ["translating" /* Translating */]: { + onEnter: () => { + }, + translate: { + guard: guardActive, + target: "translating" /* Translating */, + action: ({ translation }) => { + ctx.startInteracting(); + ctx.translate(this.active, translation); + ctx.update(); + } + }, + translateEnd: { + guard: guardActive, + target: "idle" /* Idle */ + }, + onExit: () => { + ctx.stopInteracting(); + ctx.update(); + ctx.recordAction("Translate annotation"); + } + }, + ["text-input" /* TextInput */]: { + onEnter: () => { + if (this.active == null) + return; + const datum = getTypedDatum(this.datum); + if (!datum || !("getTextInputCoords" in datum)) + return; + ctx.startInteracting(); + ctx.showTextInput(this.active); + datum.visible = false; + ctx.update(); + }, + updateTextInputBBox: { + guard: guardActive, + action: actionUpdateTextInputBBox + }, + resize: { + target: "idle" /* Idle */, + action: actionSaveText + }, + click: { + target: "idle" /* Idle */, + action: actionSaveText + }, + drag: { + target: "idle" /* Idle */, + action: actionSaveText + }, + textInput: [ + { + guard: guardCancelAndExit, + target: "idle" /* Idle */, + action: actionCancel + }, + { + guard: guardSaveAndExit, + target: "idle" /* Idle */, + action: actionSaveText + } + ], + color: { + guard: guardActive, + action: actionColor + }, + fontSize: { + guard: guardActive, + action: actionFontSize + }, + cancel: { + target: "idle" /* Idle */, + action: actionCancel + }, + onExit: () => { + ctx.stopInteracting(); + ctx.hideTextInput(); + const wasActive = this.active; + this.active = this.hovered = void 0; + ctx.select(this.active, wasActive); + if (wasActive == null) + return; + const datum = ctx.datum(wasActive); + const node = ctx.node(wasActive); + if (!datum || !node) + return; + datum.visible = true; + } + } + }); + this.setActive = setActive; + this.debug = Debug11.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass([ + ActionOnSet({ + changeValue(newValue) { + this.setActive(newValue); + } + }), + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "active", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "hovered", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "hoverCoords", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "copied", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "snapping", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/annotationsToolbar.ts +var import_ag_charts_community84 = require("ag-charts-community"); +var import_ag_charts_core40 = require("ag-charts-core"); +var { ActionOnSet: ActionOnSet2, LayoutElement, Menu: Menu2, PropertiesArray: PropertiesArray2, ToolbarButtonProperties: ToolbarButtonProperties2, Property: Property31, ChartAxisDirection: ChartAxisDirection7 } = import_ag_charts_community84._ModuleSupport; +var AnnotationsToolbarButtonProperties = class extends ToolbarButtonProperties2 { +}; +__decorateClass([ + Property31 +], AnnotationsToolbarButtonProperties.prototype, "value", 2); +var AnnotationsToolbar = class extends import_ag_charts_community84._ModuleSupport.BaseProperties { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + this.padding = 20; + this.buttons = new PropertiesArray2(AnnotationsToolbarButtonProperties); + this.events = new import_ag_charts_core40.EventEmitter(); + this.annotationMenu = new Menu2(this.ctx, "annotations"); + this.cleanup = new import_ag_charts_core40.CleanupRegistry(); + this.toolbar = ctx.sharedToolbar.getSharedToolbar("annotations"); + const onKeyDown = this.onKeyDown.bind(this); + this.toolbar.addListener("keydown", onKeyDown); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onToolbarButtonPress.bind(this)), + ctx.layoutManager.registerElement(LayoutElement.ToolbarLeft, this.onLayoutStart.bind(this)), + () => { + this.toolbar.removeListener("keydown", onKeyDown); + this.toolbar.destroy(); + } + ); + } + destroy() { + this.cleanup.flush(); + } + toggleClearButtonEnabled(enabled) { + const index = this.buttons.findIndex((button) => button.value === "clear"); + this.toolbar.toggleButtonEnabledByIndex(index, enabled); + } + resetButtonIcons() { + for (const [index, button] of this.buttons.entries()) { + switch (button.value) { + case "line-menu": + this.updateButtonByIndex(index, { icon: "trend-line-drawing", value: "line-menu" }); + break; + case "fibonacci-menu": + this.updateButtonByIndex(index, { icon: "fibonacci-retracement-drawing", value: "fibonacci-menu" }); + break; + case "text-menu": + this.updateButtonByIndex(index, { icon: "text-annotation", value: "text-menu" }); + break; + case "shape-menu": + this.updateButtonByIndex(index, { icon: "arrow-drawing", value: "shape-menu" }); + break; + case "measurer-menu": + this.updateButtonByIndex(index, { icon: "measurer-drawing", value: "measurer-menu" }); + break; + } + } + } + hideOverlays() { + this.annotationMenu.hide(); + } + clearActiveButton() { + this.toolbar.clearActiveButton(); + } + onLayoutStart(event) { + if (!this.enabled) + return; + this.toolbar.updateButtons(this.buttons); + this.toolbar.layout(event.layoutBox, this.padding); + } + refreshButtonsEnabled(enabled) { + for (const [index, button] of this.buttons.entries()) { + if (!button) + continue; + this.toolbar.toggleButtonEnabledByIndex(index, enabled); + } + } + onToolbarButtonPress({ + event, + button, + buttonBounds, + buttonWidget + }) { + const axisScale = this.ctx.axisManager.getAxisContext(ChartAxisDirection7.Y)[0].scale; + switch (button.value) { + case "clear": + this.events.emit("pressed-clear", null); + break; + case "line-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsLineAnnotations", + LINE_ANNOTATION_ITEMS.filter((item) => item.visible ? item.visible(axisScale) : true) + ); + break; + case "fibonacci-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsFibonacciAnnotations", + FIBONACCI_ANNOTATION_ITEMS + ); + break; + case "text-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsTextAnnotations", + TEXT_ANNOTATION_ITEMS + ); + break; + case "shape-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsShapeAnnotations", + SHAPE_ANNOTATION_ITEMS + ); + break; + case "measurer-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsMeasurerAnnotations", + MEASURER_ANNOTATION_ITEMS + ); + break; + } + } + onToolbarButtonPressShowMenu(event, buttonBounds, controller, menu, ariaLabel, items) { + this.events.emit("pressed-show-menu", null); + const index = this.buttons.findIndex((button) => button.value === menu); + this.toolbar.toggleActiveButtonByIndex(index); + this.annotationMenu.setAnchor({ x: buttonBounds.x + buttonBounds.width + 6, y: buttonBounds.y }); + this.annotationMenu.show(controller, { + items, + ariaLabel: this.ctx.localeManager.t(ariaLabel), + class: "ag-charts-annotations__toolbar-menu", + sourceEvent: event.sourceEvent, + onPress: this.onButtonPressMenuCreateAnnotation.bind(this, menu) + }); + } + onButtonPressMenuCreateAnnotation(menu, item) { + const index = this.buttons.findIndex((button) => button.value === menu); + this.updateButtonByIndex(index, { icon: item.icon }); + this.events.emit("pressed-create-annotation", { annotation: item.value }); + this.annotationMenu.hide(); + } + onKeyDown({ sourceEvent }) { + if (sourceEvent.key === "Escape") { + this.events.emit("cancel-create-annotation", null); + } + } + updateButtonByIndex(index, change) { + const button = this.buttons.at(index); + if (!button) + return; + button.set({ ...button.toJson(), ...change, value: change.value ?? button.value }); + this.toolbar.updateButtonByIndex(index, { ...button.toJson() }); + } +}; +__decorateClass([ + Property31, + ActionOnSet2({ + changeValue(enabled) { + this.toolbar?.setHidden(!enabled); + } + }) +], AnnotationsToolbar.prototype, "enabled", 2); +__decorateClass([ + Property31 +], AnnotationsToolbar.prototype, "padding", 2); +__decorateClass([ + Property31 +], AnnotationsToolbar.prototype, "buttons", 2); + +// packages/ag-charts-enterprise/src/features/annotations/axisButton.ts +var import_ag_charts_community85 = require("ag-charts-community"); +var { BaseModuleInstance, InteractionState, Property: Property32, ChartAxisDirection: ChartAxisDirection8, getIconClassNames } = import_ag_charts_community85._ModuleSupport; +var DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS = `ag-charts-annotations__axis-button`; +var AxisButton = class extends BaseModuleInstance { + constructor(ctx, axisCtx, onButtonClick, seriesRect) { + super(); + this.ctx = ctx; + this.axisCtx = axisCtx; + this.onButtonClick = onButtonClick; + this.seriesRect = seriesRect; + this.enabled = true; + this.snap = false; + this.padding = 0; + this.button = this.setup(); + this.toggleVisibility(false); + this.updateButtonElement(); + this.snap = Boolean(axisCtx.scale.bandwidth); + ctx.domManager.addEventListener("focusin", ({ target }) => { + const htmlTarget = target instanceof HTMLElement ? target : void 0; + const isSeriesAreaChild = htmlTarget && ctx.domManager.contains(htmlTarget, "series-area"); + if (!isSeriesAreaChild && htmlTarget !== this.button.getElement()) + this.hide(); + }); + this.cleanup.register( + ctx.widgets.seriesWidget.addListener("drag-move", (e) => this.onMouseDrag(e)), + ctx.widgets.seriesWidget.addListener("mousemove", (e) => this.onMouseMove(e)), + ctx.widgets.seriesWidget.addListener("mouseleave", () => this.onMouseLeave()), + ctx.widgets.seriesDragInterpreter?.events.on("click", (e) => this.onClick(e)), + ctx.eventsHub.on("series:focus-change", () => this.onKeyPress()), + ctx.eventsHub.on("zoom:pan-start", () => this.hide()), + ctx.eventsHub.on("zoom:change", () => this.hide()), + () => this.destroyElements(), + () => this.button.destroy() + ); + } + update(seriesRect, padding) { + this.seriesRect = seriesRect; + this.padding = padding; + } + setup() { + const button = new import_ag_charts_community85._Widget.ButtonWidget(); + button.addClass(DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS); + button.setTabIndex(-1); + button.setAriaLabel(this.ctx.localeManager.t("ariaLabelAddHorizontalLine")); + this.ctx.widgets.seriesWidget.getElement().appendChild(button.getElement()); + return button; + } + destroyElements() { + this.ctx.domManager.removeChild("canvas-overlay", DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS); + } + onMouseMove(e) { + if (this.ctx.interactionManager.isState(InteractionState.Clickable)) + this.show(e); + } + onMouseDrag(e) { + if (this.ctx.interactionManager.isState(InteractionState.AnnotationsMoveable)) + this.show(e); + } + onMouseLeave() { + if (this.ctx.interactionManager.isState(InteractionState.Clickable)) + this.hide(); + } + onClick(e) { + if (this.ctx.interactionManager.isState(InteractionState.Clickable) && e.device === "touch") + this.show(e); + } + show(event) { + const { sourceEvent, currentX: x, currentY: y } = event; + if (!(this.enabled && this.ctx.widgets.seriesWidget.getElement().contains(sourceEvent.target))) { + this.hide(); + return; + } + this.toggleVisibility(true); + const buttonCoords = this.getButtonCoordinates({ x, y }); + this.coords = { + x: buttonCoords.x + this.button.clientWidth / 2, + y: buttonCoords.y + this.button.clientHeight / 2 + }; + this.updatePosition(buttonCoords); + } + hide() { + this.toggleVisibility(false); + } + onKeyPress() { + if (this.snap && this.ctx.interactionManager.isState(InteractionState.Default)) + return; + this.hide(); + } + getButtonCoordinates({ x, y }) { + const { + axisCtx: { direction, position }, + seriesRect, + snap, + axisCtx, + padding + } = this; + const { clientWidth: buttonWidth, clientHeight: buttonHeight } = this.button; + const [minY, maxY] = [0, seriesRect.height]; + const [minX, maxX] = [0, seriesRect.width]; + if (snap) { + x = convert(invert(x - seriesRect.x, axisCtx), axisCtx) + seriesRect.x; + y = convert(invert(y - seriesRect.y, axisCtx), axisCtx) + seriesRect.y; + } + if (direction === ChartAxisDirection8.X) { + const crosshairLabelPadding = 5; + const offset = buttonHeight - Math.max(0, padding - crosshairLabelPadding); + x = x - buttonWidth / 2; + y = position === "top" ? minY - buttonHeight + offset : maxY - offset; + } else { + const crosshairLabelPadding = 9; + const offset = buttonWidth - Math.max(0, padding - crosshairLabelPadding); + x = position === "left" ? minX - buttonWidth + offset : maxX - offset; + y = y - buttonHeight / 2; + } + return { x, y }; + } + toggleVisibility(visible) { + const { button } = this; + if (button == null) + return; + const isVisible = this.enabled && visible; + this.toggleClass("-hidden", !isVisible); + } + toggleClass(name, include) { + this.button.toggleClass(`${DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS}-${name}`, include); + } + updatePosition({ x, y }) { + this.button.getElement().style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`; + } + updateButtonElement() { + const { button } = this; + button.addListener("click", () => this.onButtonClick(this.coords)); + button.addListener("touchend", () => this.onButtonClick(this.coords)); + button.addListener("drag-start", () => { + }); + button.setInnerHTML( + `` + ); + } +}; +__decorateClass([ + Property32 +], AxisButton.prototype, "enabled", 2); + +// packages/ag-charts-enterprise/src/features/annotations/settings-dialog/settingsDialog.ts +var import_ag_charts_community87 = require("ag-charts-community"); +var import_ag_charts_core42 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/components/dialog/dialog.ts +var import_ag_charts_community86 = require("ag-charts-community"); +var import_ag_charts_core41 = require("ag-charts-core"); +var { + Color: Color5, + DraggablePopover, + NativeWidget, + Vec2: Vec218, + createButton, + createCheckbox, + createSelect, + createTextArea, + initRovingTabIndex, + getIconClassNames: getIconClassNames2, + mapValues +} = import_ag_charts_community86._ModuleSupport; +var _Dialog = class _Dialog extends DraggablePopover { + constructor(ctx, id) { + super(ctx, id); + this.dragHandleDraggingClass = "ag-charts-dialog__drag-handle--dragging"; + this.colorPicker = new ColorPicker(this.ctx, { detached: true }); + this.cleanup.register(ctx.eventsHub.on("layout:complete", this.onLayoutComplete.bind(this))); + } + showWithChildren(children, options) { + const popover = super.showWithChildren(children, options); + popover.classList.add("ag-charts-dialog"); + popover.setAttribute("role", "dialog"); + popover.addEventListener("mousedown", (event) => { + if (event.target.classList?.contains("ag-charts-dialog__color-picker-button")) + return; + this.colorPicker.hide(); + }); + popover.addEventListener("keydown", this.onKeyDown.bind(this)); + (0, import_ag_charts_core41.getWindow)().requestAnimationFrame(() => this.reposition()); + this.colorPicker.attachTo(this); + return popover; + } + updatePosition(position) { + super.updatePosition(position); + const { anchor, fallbackAnchor } = this.getColorPickerAnchors() ?? {}; + if (!anchor) + return; + this.colorPicker.setAnchor(anchor, fallbackAnchor); + } + /************** + * Containers * + **************/ + createTabs(tablistLabel, initial, tabs) { + const element = (0, import_ag_charts_core41.createElement)("div", "ag-charts-dialog__tabs"); + const tabButtonIds = mapValues(tabs, () => (0, import_ag_charts_core41.createElementId)()); + const tabPanelIds = mapValues(tabs, () => (0, import_ag_charts_core41.createElementId)()); + for (const [key, tab] of (0, import_ag_charts_core41.entries)(tabs)) { + (0, import_ag_charts_core41.setAttributes)(tab.panel, { + id: tabPanelIds[key], + role: "tabpanel", + "aria-labelledby": tabButtonIds[key] + }); + } + const onPressTab = (active) => { + for (const [key, tab] of (0, import_ag_charts_core41.entries)(tabs)) { + tab.panel.classList.toggle("ag-charts-dialog__tab-panel--active", key === active); + tabButtons[key].classList.toggle("ag-charts-dialog__tab-button--active", key === active); + (0, import_ag_charts_core41.setAttribute)(tabButtons[key], "aria-selected", key === active); + if (key === active) + tab.onShow?.(); + } + }; + const header = new NativeWidget((0, import_ag_charts_core41.createElement)("div", "ag-charts-dialog__header")); + header.addListener("drag-start", (event) => { + const { sourceEvent } = event; + if (sourceEvent.target instanceof Element && sourceEvent.target.classList.contains("ag-charts-dialog__header")) { + this.onDragStart(event); + } + }); + header.addListener("drag-move", (event) => this.onDragMove(event)); + header.addListener("drag-end", () => this.onDragEnd()); + const dragHandle = new DragHandleWidget(); + this.setDragHandle(dragHandle); + const tabButtons = mapValues( + tabs, + (tab, key) => createButton( + { + label: this.ctx.localeManager.t(tab.label), + onPress: () => onPressTab(key) + }, + { + id: tabButtonIds[key], + class: "ag-charts-dialog__tab-button", + role: "tab", + "aria-controls": tabPanelIds[key] + } + ) + ); + const tabList = (0, import_ag_charts_core41.createElement)("div", "ag-charts-dialog__tab-list"); + (0, import_ag_charts_core41.setAttributes)(tabList, { role: "tablist", "aria-label": this.ctx.localeManager.t(tablistLabel) }); + tabList.append(...Object.values(tabButtons)); + const closeButton = this.createHeaderCloseButton(); + header.getElement().append(dragHandle.getElement(), tabList, closeButton); + element.append(header.getElement(), ...Object.values(tabs).map((t) => t.panel)); + onPressTab(initial); + initRovingTabIndex({ orientation: "horizontal", buttons: Object.values(tabButtons) }); + return { tabs: element, initialFocus: tabButtons[initial] }; + } + createTabPanel() { + return (0, import_ag_charts_core41.createElement)("div", "ag-charts-dialog__tab-panel"); + } + /********** + * Inputs * + **********/ + createInputGroupLine() { + return (0, import_ag_charts_core41.createElement)("div", "ag-charts-dialog__input-group-line"); + } + createRadioGroup({ label, options, value, onChange }) { + const group = this.createInputGroup(label); + (0, import_ag_charts_core41.setAttributes)(group, { + role: "radiogroup", + tabindex: -1, + "aria-label": this.ctx.localeManager.t(label) + }); + const activeClass = "ag-charts-dialog__button--active"; + const buttons2 = []; + for (const button of options) { + const { icon, altText: altTextKey } = button; + const altText = this.ctx.localeManager.t(altTextKey); + const buttonEl = createButton( + { + icon, + altText, + onPress: () => { + for (const b of Array.from(group.children)) { + b.classList.remove(activeClass); + b.ariaChecked = "false"; + } + buttonEl.classList.add(activeClass); + buttonEl.ariaChecked = "true"; + onChange(button.value); + } + }, + { + "aria-checked": button.value === value, + class: "ag-charts-dialog__button", + role: "radio", + title: altText + } + ); + if (button.value === value) { + buttonEl.classList.add(activeClass); + } + group.appendChild(buttonEl); + buttons2.push(buttonEl); + } + initRovingTabIndex({ orientation: "horizontal", buttons: buttons2 }); + return group; + } + createSelect({ altText, label, options, value, onChange }) { + const group = this.createInputGroup(label); + const altTextT = this.ctx.localeManager.t(altText); + const select = createSelect( + { value, options, onChange }, + { class: "ag-charts-dialog__select", "aria-label": altTextT, title: altTextT } + ); + group.append(select); + return group; + } + createTextArea({ placeholder, value, onChange }) { + const placeholderT = placeholder ? this.ctx.localeManager.t(placeholder) : void 0; + return createTextArea({ value, onChange }, { placeholder: placeholderT }); + } + createCheckbox({ label, checked, onChange }) { + const id = (0, import_ag_charts_core41.createElementId)(); + const group = this.createInputGroup(label, { for: id }); + const checkbox = createCheckbox( + { checked, onChange }, + { class: "ag-charts-dialog__checkbox", role: "switch", id } + ); + group.append(checkbox); + return group; + } + createColorPicker({ + color: color6, + opacity, + label, + altText, + onChange, + onChangeHide, + isMultiColor, + hasMultiColorOption + }) { + const group = this.createInputGroup(label); + const altTextT = this.ctx.localeManager.t(altText); + const colorEl = createButton( + { + label: altTextT, + onPress: (event) => { + const { anchor, fallbackAnchor } = this.getColorPickerAnchors(colorEl) ?? {}; + this.colorPicker.show({ + anchor, + fallbackAnchor, + color: color6, + opacity, + isMultiColor, + hasMultiColorOption, + sourceEvent: event, + onChange: (newColorOpacity, newColor, newOpacity, newIsMultiColor) => { + colorEl.style.setProperty("--color", newColorOpacity); + colorEl.classList.toggle( + "ag-charts-dialog__color-picker-button--multi-color", + newIsMultiColor + ); + onChange(newColorOpacity, newColor, newOpacity, newIsMultiColor); + }, + onChangeHide + }); + } + }, + { + "aria-label": altTextT, + tabindex: 0, + class: "ag-charts-dialog__color-picker-button", + title: altTextT + } + ); + if (isMultiColor) { + colorEl.classList.toggle("ag-charts-dialog__color-picker-button--multi-color"); + } else if (color6) { + const hex = Color5.fromString(color6); + const hexWithOpacity = new Color5(hex.r, hex.g, hex.b, opacity); + colorEl.style.setProperty("--color", hexWithOpacity.toHexString()); + } + group.append(colorEl); + this.hideFns.push(() => { + this.colorPicker.hide(); + }); + return group; + } + /*********** + * Private * + ***********/ + createHeaderCloseButton() { + return createButton( + { icon: "close", altText: this.ctx.localeManager.t("iconAltTextClose"), onPress: () => this.hide() }, + { class: "ag-charts-dialog__close-button" } + ); + } + createInputGroup(label, options) { + const group = (0, import_ag_charts_core41.createElement)("div", "ag-charts-dialog__input-group"); + const labelEl = (0, import_ag_charts_core41.createElement)("label", "ag-charts-dialog__input-group-label"); + labelEl.innerText = this.ctx.localeManager.t(label); + (0, import_ag_charts_core41.setAttribute)(labelEl, "for", options?.for); + group.appendChild(labelEl); + return group; + } + onLayoutComplete(event) { + this.seriesRect = event.series.paddedRect; + this.reposition(); + } + onKeyDown(event) { + if (event.altKey || event.ctrlKey || event.metaKey || event.isComposing || event.key !== "Escape") + return; + this.hide(); + } + reposition() { + const { seriesRect, ctx } = this; + const clientRect = ctx.domManager.getBoundingClientRect(); + const popover = this.getPopoverElement(); + if (!seriesRect || !popover) + return; + const outerOffset = Vec218.from(0, seriesRect.y); + const outerSize = Vec218.from(clientRect.width, seriesRect.height); + const popoverSize = Vec218.from(popover); + const halfWidth = Vec218.from(0.5, 1); + let position; + if (seriesRect.width > 1e3) { + const bottomCenter = Vec218.sub( + Vec218.add(outerOffset, Vec218.multiply(outerSize, halfWidth)), + Vec218.multiply(popoverSize, halfWidth) + ); + position = Vec218.sub(bottomCenter, Vec218.from(0, _Dialog.offset)); + } else { + const bottomRight = Vec218.sub(Vec218.add(outerOffset, outerSize), popoverSize); + position = Vec218.sub(bottomRight, _Dialog.offset); + } + this.updatePosition(position); + } + getColorPickerAnchors(element) { + if (element) + this.colorPickerAnchorElement = element; + if (!this.colorPickerAnchorElement) + return; + const rect = this.colorPickerAnchorElement.getBoundingClientRect(); + const canvasRect = this.ctx.domManager.getBoundingClientRect(); + const topLeft = Vec218.sub(Vec218.from(rect.x, rect.y), Vec218.from(canvasRect.left, canvasRect.top)); + const anchor = Vec218.add(topLeft, Vec218.from(0, rect.height + 5)); + const fallbackAnchor = Vec218.sub(topLeft, Vec218.from(0, 5)); + return { anchor, fallbackAnchor }; + } +}; +_Dialog.offset = 60; +var Dialog = _Dialog; +var DragHandleWidget = class extends NativeWidget { + constructor() { + super((0, import_ag_charts_core41.createElement)("div", "ag-charts-dialog__drag-handle")); + const icon = new NativeWidget((0, import_ag_charts_core41.createElement)("span", getIconClassNames2("drag-handle"))); + icon.setAriaHidden(true); + this.addChild(icon); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/settings-dialog/settingsDialog.ts +var { focusCursorAtEnd: focusCursorAtEnd2 } = import_ag_charts_community87._ModuleSupport; +var AnnotationSettingsDialog = class extends Dialog { + constructor(ctx) { + super(ctx, "settings"); + this.events = new import_ag_charts_core42.EventEmitter(); + this.hideFns.push(() => this.events.emit("hidden", null)); + } + show(datum, options) { + const lineTab = this.createLinearLineTab(datum, options); + const textTab = this.createLinearTextTab(datum, options); + let lineLabel = "dialogHeaderLine"; + if (isChannelType(datum)) { + lineLabel = "dialogHeaderChannel"; + } else if (isFibonacciType(datum)) { + lineLabel = "dialogHeaderFibonacciRange"; + } else if (datum.type === "date-range" /* DateRange */) { + lineLabel = "dialogHeaderDateRange"; + } else if (datum.type === "price-range" /* PriceRange */) { + lineLabel = "dialogHeaderPriceRange"; + } else if (datum.type === "date-price-range" /* DatePriceRange */) { + lineLabel = "dialogHeaderDatePriceRange"; + } + const { tabs, initialFocus } = this.createTabs("ariaLabelSettingsTabBar", options.initialSelectedTab, { + line: { + label: lineLabel, + panel: lineTab + }, + text: { + label: "dialogHeaderText", + panel: textTab.panel, + onShow: textTab.onShow + } + }); + options.initialFocus = initialFocus; + const popover = this.showWithChildren([tabs], options); + popover.classList.add("ag-charts-dialog--annotation-settings"); + } + createLinearLineTab(datum, options) { + const panel = this.createTabPanel(); + const groupOne = this.createInputGroupLine(); + const groupTwo = this.createInputGroupLine(); + const hasMultiColorOption = "isMultiColor" in datum; + const lineColorPicker = this.createColorPickerInput( + "line-color", + datum.getDefaultColor("line-color"), + datum.getDefaultOpacity("line-color"), + hasMultiColorOption ? datum.isMultiColor : false, + hasMultiColorOption, + options.onChangeLineColor, + options.onChangeHideLineColor + ); + const strokeWidth = this.createStrokeWidthSelect(datum.strokeWidth ?? 2, options.onChangeLineStyleWidth); + const lineStyle = this.createLineStyleRadioGroup(datum.lineStyle ?? "solid", options.onChangeLineStyleType); + groupOne.append(lineColorPicker); + if ("background" in datum) { + const fillColorPicker = this.createColorPickerInput( + "fill-color", + datum.getDefaultColor("fill-color"), + datum.getDefaultOpacity("fill-color"), + false, + false, + options.onChangeFillColor, + options.onChangeHideFillColor + ); + groupOne.append(fillColorPicker); + groupTwo.append(strokeWidth); + } else if ("showFill" in datum) { + groupOne.append( + this.createCheckbox({ + label: "dialogInputShowFill", + checked: datum.showFill ?? true, + onChange: (showFill) => options.onChangeLine({ showFill }) + }) + ); + groupTwo.append(strokeWidth); + } else { + groupOne.append(strokeWidth); + } + groupTwo.append(lineStyle); + panel.append(groupOne, groupTwo); + if ("bands" in datum) { + panel.append( + this.createFibonacciRatioSelect(datum.bands ?? 10, (bands) => options.onChangeLine({ bands })) + ); + } + if ("extendStart" in datum && "extendEnd" in datum) { + panel.append( + this.createCheckbox({ + label: isChannelType(datum) ? "dialogInputExtendChannelStart" : "dialogInputExtendLineStart", + checked: datum.extendStart ?? false, + onChange: (extendStart) => options.onChangeLine({ extendStart }) + }), + this.createCheckbox({ + label: isChannelType(datum) ? "dialogInputExtendChannelEnd" : "dialogInputExtendLineEnd", + checked: datum.extendEnd ?? false, + onChange: (extendEnd) => options.onChangeLine({ extendEnd }) + }) + ); + } + if ("extendAbove" in datum && "extendBelow" in datum) { + panel.append( + this.createCheckbox({ + label: "dialogInputExtendAbove", + checked: datum.extendAbove ?? false, + onChange: (extendAbove) => options.onChangeLine({ extendAbove }) + }), + this.createCheckbox({ + label: "dialogInputExtendBelow", + checked: datum.extendBelow ?? false, + onChange: (extendBelow) => options.onChangeLine({ extendBelow }) + }) + ); + } + if ("extendLeft" in datum && "extendRight" in datum) { + panel.append( + this.createCheckbox({ + label: "dialogInputExtendLeft", + checked: datum.extendLeft ?? false, + onChange: (extendLeft) => options.onChangeLine({ extendLeft }) + }), + this.createCheckbox({ + label: "dialogInputExtendRight", + checked: datum.extendRight ?? false, + onChange: (extendRight) => options.onChangeLine({ extendRight }) + }) + ); + } + if ("reverse" in datum && "showFill" in datum) { + panel.append( + this.createCheckbox({ + label: "dialogInputReverse", + checked: datum.reverse ?? false, + onChange: (reverse) => options.onChangeLine({ reverse }) + }) + ); + } + return panel; + } + createLinearTextTab(datum, options) { + const panel = this.createTabPanel(); + const textArea = this.createTextArea({ + placeholder: "inputTextareaPlaceholder", + value: datum.text.label, + onChange: (value) => options.onChangeText({ label: value }) + }); + const fontSize = this.createFontSizeSelect(datum.text.fontSize, options.onChangeTextFontSize); + const colorPicker = this.createColorPickerInput( + "text-color", + datum.text.color, + 1, + false, + false, + options.onChangeTextColor, + options.onChangeHideTextColor + ); + const textPosition = datum.text.position === "inside" ? "center" : datum.text.position; + const position = this.createPositionRadioGroup( + textPosition ?? "top", + (value) => options.onChangeText({ position: value }) + ); + const alignment = this.createAlignmentRadioGroup( + datum.text.alignment ?? "center", + (value) => options.onChangeText({ alignment: value }) + ); + const inputGroupLine = this.createInputGroupLine(); + inputGroupLine.append(fontSize, colorPicker, position, alignment); + panel.append(textArea, inputGroupLine); + return { panel, onShow: () => focusCursorAtEnd2(textArea) }; + } + createColorPickerInput(colorType, color6, opacity, isMultiColor, hasMultiColorOption, onChange, onChangeHide) { + const label = colorType === "fill-color" ? "dialogInputFillColorPicker" : "dialogInputColorPicker"; + const altText = colorType === "fill-color" ? "dialogInputFillColorPickerAltText" : "dialogInputColorPickerAltText"; + return this.createColorPicker({ + label, + altText, + color: color6, + opacity, + isMultiColor, + hasMultiColorOption, + onChange, + onChangeHide + }); + } + createStrokeWidthSelect(strokeWidth, onChange) { + return this.createSelect({ + label: "dialogInputStrokeWidth", + altText: "dialogInputStrokeWidthAltText", + options: LINE_STROKE_WIDTH_ITEMS.map(({ label, value }) => ({ label, value: `${value}` })), + value: String(strokeWidth), + onChange: (value) => onChange(Number(value)) + }); + } + createFibonacciRatioSelect(bands, onChange) { + return this.createSelect({ + label: "dialogInputFibonacciBands", + altText: "dialogInputFibonacciBandsAltText", + options: FIBONACCI_RATIO_ITEMS.map(({ label, value }) => ({ label, value: `${value}` })), + value: String(bands), + onChange: (value) => onChange(Number(value)) + }); + } + createLineStyleRadioGroup(lineStyle, onChange) { + return this.createRadioGroup({ + label: "dialogInputLineStyle", + options: [ + { icon: "line-style-solid", altText: "iconAltTextLineStyleSolid", value: "solid" }, + { icon: "line-style-dashed", altText: "iconAltTextLineStyleDashed", value: "dashed" }, + { icon: "line-style-dotted", altText: "iconAltTextLineStyleDotted", value: "dotted" } + ], + value: lineStyle, + onChange + }); + } + createFontSizeSelect(fontSize, onChange) { + return this.createSelect({ + label: "dialogInputFontSize", + altText: "dialogInputFontSizeAltText", + options: TEXT_SIZE_ITEMS.map(({ label, value }) => ({ label, value: String(value) })), + value: String(fontSize), + onChange: (value) => onChange(Number(value)) + }); + } + createPositionRadioGroup(position, onChange) { + return this.createRadioGroup({ + label: "dialogInputPosition", + options: [ + { icon: "position-top", altText: "iconAltTextPositionTop", value: "top" }, + { icon: "position-center", altText: "iconAltTextPositionCenter", value: "center" }, + { icon: "position-bottom", altText: "iconAltTextPositionBottom", value: "bottom" } + ], + value: position, + onChange + }); + } + createAlignmentRadioGroup(alignment, onChange) { + return this.createRadioGroup({ + label: "dialogInputAlign", + options: [ + { icon: "align-left", altText: "iconAltTextAlignLeft", value: "left" }, + { icon: "align-center", altText: "iconAltTextAlignCenter", value: "center" }, + { icon: "align-right", altText: "iconAltTextAlignRight", value: "right" } + ], + value: alignment, + onChange + }); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/utils/axis.ts +function calculateAxisLabelPadding(axisLayout) { + return axisLayout.gridPadding + axisLayout.seriesAreaPadding + axisLayout.tickSize + axisLayout.label.spacing; +} + +// packages/ag-charts-enterprise/src/features/annotations/utils/update.ts +function updateAnnotation(node, datum, context) { + for (const { update } of Object.values(annotationConfigs)) { + update(node, datum, context); + } +} + +// packages/ag-charts-enterprise/src/features/annotations/annotations.ts +var { + ChartUpdateType, + InteractionState: InteractionState2, + PropertiesArray: PropertiesArray3, + Property: Property33, + ChartAxisDirection: ChartAxisDirection9, + keyProperty, + valueProperty, + Vec2: Vec219, + Selection: Selection3, + BBox: BBox3 +} = import_ag_charts_community88._ModuleSupport; +var _Annotations = class _Annotations extends import_ag_charts_community88._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + this.toolbar = new AnnotationsToolbar(this.ctx); + this.optionsToolbar = new AnnotationOptionsToolbar(this.ctx, () => { + const active = this.state.getActive(); + if (active == null) + return; + return getTypedDatum(this.annotationData.at(active)); + }); + this.axesButtons = new AxesButtons(); + this.snap = false; + // Hidden options for use with measurer statistics + this.data = void 0; + this.xKey = void 0; + this.volumeKey = void 0; + this.annotationData = new PropertiesArray3( + _Annotations.createAnnotationDatum + ); + this.defaults = new AnnotationDefaults(); + this.container = new import_ag_charts_community88._ModuleSupport.Group({ name: "static-annotations" }); + this.annotations = new Selection3( + this.container, + this.createAnnotationScene.bind(this) + ); + this.settingsDialog = new AnnotationSettingsDialog(this.ctx); + this.textInput = new TextInput(this.ctx); + this.postUpdateFns = []; + this.state = this.setupStateMachine(); + this.setupListeners(); + this.setupDOM(); + this.ctx.historyManager.addMementoOriginator(ctx.annotationManager); + this.ctx.historyManager.addMementoOriginator(this.defaults); + this.textInput.setKeyDownHandler(this.onTextInput.bind(this)); + this.cleanup.register(() => { + this.clear(); + this.xAxis?.button?.destroy(); + this.yAxis?.button?.destroy(); + }); + } + setupStateMachine() { + const { ctx } = this; + return new AnnotationsStateMachine({ + resetToIdle: () => { + ctx.domManager.updateCursor("annotations"); + this.popAnnotationState(InteractionState2.Annotations); + this.hideOverlays(); + this.optionsToolbar.hide(); + this.deleteEphemeralAnnotations(); + this.update(); + }, + hoverAtCoords: (coords, active, previousHovered) => { + let hovered; + this.annotations.each((annotation, datum, index) => { + if (!datum.isHoverable()) + return; + const contains = annotation.containsPoint(coords.x, coords.y); + if (contains) + hovered ?? (hovered = index); + annotation.toggleHovered(contains, active === index, datum.readOnly); + }); + if (hovered != null) { + ctx.tooltipManager.suppressTooltip("annotations"); + } else if (!this.isAnnotationState()) { + ctx.tooltipManager.unsuppressTooltip("annotations"); + } + if (hovered == null || !this.annotationData.at(hovered)?.readOnly) { + this.ctx.domManager.updateCursor( + "annotations", + hovered == null ? void 0 : this.annotations.at(hovered)?.getCursor() + ); + } + if (hovered !== previousHovered) { + this.update(); + } + return hovered; + }, + getNodeAtCoords: (coords, active) => { + const node = this.annotations.at(active); + if (!node) { + return; + } + return node.getNodeAtCoords(coords.x, coords.y); + }, + translate: (index, translation) => { + const node = this.annotations.at(index); + const datum = getTypedDatum(this.annotationData.at(index)); + if (!node || !datum) { + return; + } + return this.translateNode(node, datum, translation); + }, + copy: (index) => { + const node = this.annotations.at(index); + const datum = getTypedDatum(this.annotationData.at(index)); + if (!node || !datum) { + return; + } + return this.createAnnotationDatumCopy(node, datum); + }, + paste: (datum) => { + this.createAnnotation(datum.type, datum, false); + this.postUpdateFns.push(() => { + this.state.transitionAsync("selectLast"); + this.state.transitionAsync("copy"); + }); + }, + select: (index, previous) => { + const { annotations, optionsToolbar: optionsToolbar2, toolbar: toolbar2 } = this; + this.hideOverlays(); + toolbar2.clearActiveButton(); + toolbar2.resetButtonIcons(); + const selectedNode = index == null ? null : annotations.at(index); + const previousNode = previous == null ? null : annotations.at(previous); + const selectedDatum = index == null ? null : this.annotationData.at(index); + if (previousNode === selectedNode && selectedNode != null) { + return; + } + previousNode?.toggleActive(false); + optionsToolbar2.hide(); + if (selectedNode && !selectedDatum?.readOnly) { + this.pushAnnotationState(InteractionState2.AnnotationsSelected); + selectedNode.toggleActive(true); + if (!isEphemeralType(selectedDatum)) { + optionsToolbar2.updateButtons(this.annotationData.at(index)); + this.postUpdateFns.push(() => { + optionsToolbar2.show(); + optionsToolbar2.setAnchorScene(selectedNode); + }); + } + } else { + this.popAnnotationState(InteractionState2.AnnotationsSelected); + this.popAnnotationState(InteractionState2.Annotations); + } + if (!isEphemeralType(selectedDatum)) { + this.deleteEphemeralAnnotations(); + } + this.update(); + }, + selectLast: () => { + this.pushAnnotationState(InteractionState2.AnnotationsSelected); + return this.annotationData.length - 1; + }, + startInteracting: () => { + this.pushAnnotationState(InteractionState2.Annotations); + }, + stopInteracting: () => { + this.popAnnotationState(InteractionState2.Annotations); + }, + create: (type, datum) => { + this.createAnnotation(type, datum); + }, + delete: (index) => { + this.annotationData.splice(index, 1); + }, + deleteAll: () => { + const readOnly = this.annotationData.filter((datum) => { + if (datum.readOnly === true) + return datum; + }); + this.annotationData.splice(0, this.annotationData.length); + for (const datum of readOnly) { + this.annotationData.push(datum); + } + }, + validatePoint: (point, options) => { + const context = this.getAnnotationContext(); + return context ? validateDatumPoint(context, point, options) : true; + }, + getAnnotationType: (index) => { + return stringToAnnotationType(this.annotationData[index].type); + }, + datum: (index) => { + return this.annotationData.at(index); + }, + node: (index) => { + return this.annotations.at(index); + }, + recordAction: (label) => { + this.recordActionAfterNextUpdate(label); + }, + update: () => { + this.postUpdateFns.push(() => { + const active = this.state.getActive(); + const node = active == null ? null : this.annotations.at(active); + if (node == null) + return; + this.optionsToolbar.setAnchorScene(node); + }); + this.update(); + }, + showTextInput: (active) => { + const datum = getTypedDatum(this.annotationData.at(active)); + const node = this.annotations.at(active); + if (!node || !datum || !("getTextInputCoords" in datum) || !("getTextPosition" in datum)) + return; + const styles = { + color: datum.color, + fontFamily: datum.fontFamily, + fontSize: datum.fontSize, + fontStyle: datum.fontStyle, + fontWeight: datum.fontWeight, + placeholderColor: datum.getPlaceholderColor() + }; + const context = this.getAnnotationContext(); + const getTextInputCoords = (height) => Vec219.add(datum.getTextInputCoords(context, height), Vec219.required(this.seriesRect)); + const getTextPosition = () => datum.getTextPosition(); + this.textInput.show({ + styles, + layout: { + getTextInputCoords, + getTextPosition, + alignment: datum.alignment, + textAlign: datum.textAlign, + width: datum.width + }, + text: datum.text, + placeholderText: datum.placeholderText, + onChange: (_text, bbox) => { + this.state.transition("updateTextInputBBox", bbox); + } + }); + this.ctx.domManager.updateCursor("annotations"); + }, + hideTextInput: () => { + this.textInput.hide(); + }, + updateTextInputColor: (color6) => { + this.textInput.updateColor(color6); + }, + updateTextInputFontSize: (fontSize) => { + const bbox = this.textInput.updateFontSize(fontSize); + this.state.transition("updateTextInputBBox", bbox); + }, + updateTextInputBBox: (bbox) => { + this.state.transition("updateTextInputBBox", bbox); + }, + showAnnotationOptions: (active) => { + const node = this.annotations.at(active); + if (!node || isEphemeralType(this.annotationData.at(active))) + return; + this.optionsToolbar.updateButtons(this.annotationData.at(active)); + this.optionsToolbar.show(); + this.optionsToolbar.setAnchorScene(node); + }, + showAnnotationSettings: (active, sourceEvent, initialTab = "line") => { + const datum = this.annotationData.at(active); + if (!isLineType(datum) && !isChannelType(datum) && !isMeasurerType(datum)) + return; + if (isEphemeralType(datum)) + return; + const onChangeColor = (colorType) => (colorOpacity, color6, opacity, isMultiColor) => { + this.setColorAndDefault(datum.type, colorType, colorOpacity, color6, opacity, isMultiColor); + this.optionsToolbar.updateColorPickerColor(colorType, color6, opacity, isMultiColor); + }; + const onChangeHideColor = (colorType) => () => { + this.recordActionAfterNextUpdate( + `Change ${datum.type} ${colorType} to ${datum.getDefaultColor(colorType)}`, + ["annotations", "defaults"] + ); + this.update(); + }; + const options = { + initialSelectedTab: initialTab, + ariaLabel: this.ctx.localeManager.t("ariaLabelAnnotationSettingsDialog"), + sourceEvent, + onChangeLine: (props) => { + this.state.transition("lineProps", props); + if (props.bands != null) + this.defaults.setDefaultFibonacciOptions(datum.type, "bands", props.bands); + if (props.reverse != null) + this.defaults.setDefaultFibonacciOptions(datum.type, "reverse", props.reverse); + if (props.showFill != null) + this.defaults.setDefaultFibonacciOptions(datum.type, "showFill", props.showFill); + }, + onChangeText: (props) => { + this.state.transition("lineText", props); + if (props.alignment) + this.defaults.setDefaultLineTextAlignment(datum.type, props.alignment); + if (props.position) + this.defaults.setDefaultLineTextPosition(datum.type, props.position); + this.recordActionAfterNextUpdate( + `Change ${datum.type} text ${Object.keys(props).map((key) => `${key} to ${props[key]}`).join(", ")}` + ); + }, + onChangeFillColor: onChangeColor("fill-color"), + onChangeHideFillColor: onChangeHideColor("fill-color"), + onChangeLineColor: onChangeColor("line-color"), + onChangeHideLineColor: onChangeHideColor("line-color"), + onChangeLineStyleType: (lineStyleType) => { + this.setLineStyleTypeAndDefault(datum.type, lineStyleType); + this.optionsToolbar.updateLineStyleType( + LINE_STYLE_TYPE_ITEMS.find((item) => item.value === lineStyleType) ?? LINE_STYLE_TYPE_ITEMS[0] + ); + }, + onChangeLineStyleWidth: (strokeWidth) => { + this.setLineStyleWidthAndDefault(datum.type, strokeWidth); + this.optionsToolbar.updateStrokeWidth({ + strokeWidth, + value: strokeWidth, + label: String(strokeWidth) + }); + }, + onChangeTextColor: onChangeColor("text-color"), + onChangeHideTextColor: onChangeHideColor("text-color"), + onChangeTextFontSize: (fontSize) => { + this.setFontSizeAndDefault(datum.type, fontSize); + } + }; + this.settingsDialog.show(datum, options); + } + }); + } + setupListeners() { + const { ctx, optionsToolbar: optionsToolbar2, settingsDialog, toolbar: toolbar2 } = this; + const { seriesWidget, seriesDragInterpreter, chartWidget } = ctx.widgets; + if (seriesDragInterpreter) { + this.cleanup.register( + // Interactions + seriesDragInterpreter.events.on("click", this.hoverTouchPreHandler.bind(this)), + seriesDragInterpreter.events.on("drag-start", this.hoverTouchPreHandler.bind(this)), + seriesDragInterpreter.events.on("drag-move", this.dragMoveTouchPreHandler.bind(this)), + seriesDragInterpreter.events.on("mousemove", this.onHover.bind(this)), + seriesDragInterpreter.events.on("click", this.onClick.bind(this)), + seriesDragInterpreter.events.on("dblclick", this.onDoubleClick.bind(this)), + seriesDragInterpreter.events.on("drag-start", this.onDragStart.bind(this)), + seriesDragInterpreter.events.on("drag-move", this.onDrag.bind(this)), + seriesDragInterpreter.events.on("drag-end", this.onDragEnd.bind(this)) + ); + } + this.cleanup.register( + // Interactions + seriesWidget.addListener("keydown", this.onKeyDown.bind(this)), + seriesWidget.addListener("keyup", this.onKeyUp.bind(this)), + chartWidget.addListener("click", this.onCancel.bind(this)), + // Services + ctx.eventsHub.on("annotations:restore", this.onRestoreAnnotations.bind(this)), + ctx.eventsHub.on("layout:complete", this.onLayoutComplete.bind(this)), + ctx.updateService.addListener("pre-scene-render", this.onPreRender.bind(this)), + ctx.eventsHub.on("zoom:change", () => this.onResize()), + ctx.eventsHub.on("dom:resize", () => this.onResize()), + // Toolbar + toolbar2.events.on("cancel-create-annotation", () => { + this.cancel(); + this.reset(); + this.update(); + }), + toolbar2.events.on("pressed-create-annotation", ({ annotation }) => { + this.cancel(); + this.pushAnnotationState(InteractionState2.Annotations); + this.state.transition(annotation); + this.update(); + }), + toolbar2.events.on("pressed-clear", () => { + this.clear(); + this.recordActionAfterNextUpdate("Clear all"); + }), + toolbar2.events.on("pressed-show-menu", () => { + this.cancel(); + this.reset(); + }), + toolbar2.events.on("pressed-unrelated", () => { + this.reset(); + }), + // Annotation Options Toolbar + optionsToolbar2.events.on("pressed-delete", () => { + this.cancel(); + this.delete(); + this.reset(); + }), + optionsToolbar2.events.on("pressed-settings", ({ sourceEvent }) => { + this.state.transition("toolbarPressSettings", sourceEvent); + }), + optionsToolbar2.events.on("pressed-lock", ({ locked }) => { + this.recordActionAfterNextUpdate(locked ? "Locked" : "Unlocked"); + this.update(); + }), + optionsToolbar2.events.on("hid-overlays", () => { + this.settingsDialog.hide(); + }), + optionsToolbar2.events.on("saved-color", ({ type, colorPickerType, color: color6 }) => { + this.recordActionAfterNextUpdate(`Change ${type} ${colorPickerType} to ${color6}`, [ + "annotations", + "defaults" + ]); + }), + optionsToolbar2.events.on( + "updated-color", + ({ type, colorPickerType, colorOpacity, color: color6, opacity, isMultiColor }) => { + this.setColorAndDefault(type, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + } + ), + optionsToolbar2.events.on("updated-font-size", ({ type, fontSize }) => { + this.setFontSizeAndDefault(type, fontSize); + }), + optionsToolbar2.events.on("updated-line-style", ({ type, lineStyleType }) => { + this.setLineStyleTypeAndDefault(type, lineStyleType); + }), + optionsToolbar2.events.on("updated-line-width", ({ type, strokeWidth }) => { + this.setLineStyleWidthAndDefault(type, strokeWidth); + }), + // Settings Dialog + settingsDialog.events.on("hidden", () => { + this.optionsToolbar.clearActiveButton(); + }) + ); + } + setupDOM() { + const { ctx, toolbar: toolbar2, optionsToolbar: optionsToolbar2 } = this; + this.cleanup.register(ctx.annotationManager.attachNode(this.container), () => { + ctx.domManager.removeStyles(DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS); + toolbar2.destroy(); + optionsToolbar2.destroy(); + }); + } + async processData(dataController) { + if (!this.enabled || this.data == null || this.xKey == null || this.volumeKey == null) + return; + const props = [ + keyProperty(this.xKey, void 0, { id: "date" }), + valueProperty(this.volumeKey, "number", { id: "volume" }) + ]; + const dataSet = import_ag_charts_community88._ModuleSupport.DataSet.wrap(this.data) ?? import_ag_charts_community88._ModuleSupport.DataSet.empty(); + const { dataModel, processedData } = await dataController.request("annotations", dataSet, { + props + }); + this.dataModel = dataModel; + this.processedData = processedData; + } + /** + * Create an annotation scene within the `this.annotations` scene selection. This method is automatically called by + * the selection when a new scene is required. + */ + createAnnotationScene(datum) { + if (datum.type in annotationConfigs) { + return new annotationConfigs[datum.type].scene(); + } + throw new Error( + `AG Charts - Cannot create annotation scene of type [${datum.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.` + ); + } + /** + * Create an annotation datum within the `this.annotationData` properties array. It is created as an instance + * of `AnnotationProperties` from the given config for its type. This method is only called when annotations + * are added from the initial state. + */ + static createAnnotationDatum(params) { + if (params.type in annotationConfigs) { + return new annotationConfigs[params.type].datum().set(params); + } + throw new Error( + `AG Charts - Cannot create annotation datum of unknown type [${params.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.` + ); + } + /** + * Append an annotation datum to `this.annotationData`, applying default styles. This method is called when a user + * interacts with the chart to draw their own annotations. + */ + createAnnotation(type, datum, applyDefaults = true) { + this.annotationData.push(datum); + if (applyDefaults) { + const styles = this.ctx.annotationManager.getAnnotationTypeStyles(type); + if (styles) + datum.set(styles); + this.defaults.applyDefaults(datum); + } + this.injectDatumDependencies(datum); + this.update(); + } + injectDatumDependencies(datum) { + if ("setLocaleManager" in datum) { + datum.setLocaleManager(this.ctx.localeManager); + } + if ("getVolume" in datum) { + datum.getVolume = this.getDatumRangeVolume.bind(this); + } + } + getDatumRangeVolume(fromPoint, toPoint) { + const { dataModel, processedData } = this; + let from = getGroupingValue(fromPoint); + let to = getGroupingValue(toPoint); + if (!(0, import_ag_charts_core43.isValidDate)(from) || !(0, import_ag_charts_core43.isValidDate)(to) || !dataModel || !processedData || this.volumeKey == null) + return; + if (from > to) { + [from, to] = [to, from]; + } + const dateValues = dataModel.resolveKeysById({ id: "annotations" }, "date", processedData); + const volumeValues = dataModel.resolveColumnById({ id: "annotations" }, "volume", processedData); + let sum = 0; + for (let datumIndex = 0; datumIndex < processedData.input.count; datumIndex++) { + const key = dateValues[datumIndex]; + if ((0, import_ag_charts_core43.isValidDate)(key) && key >= from && key <= to) { + sum += volumeValues[datumIndex]; + } + } + return sum; + } + translateNode(node, datum, translation) { + const config = this.getAnnotationConfig(datum); + const context = this.getAnnotationContext(); + if (!context) { + return; + } + config.translate(node, datum, translation, context); + } + createAnnotationDatumCopy(node, datum) { + const config = this.getAnnotationConfig(datum); + const newDatum = new config.datum(); + newDatum.set(datum.toJson()); + const context = this.getAnnotationContext(); + if (!context) { + return; + } + return config.copy(node, datum, newDatum, context); + } + getAnnotationConfig(datum) { + if (datum.type in annotationConfigs) { + return annotationConfigs[datum.type]; + } + throw new Error( + `AG Charts - Cannot get annotation config of unknown type [${datum.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.` + ); + } + onRestoreAnnotations(event) { + if (!this.enabled) + return; + this.clear(); + this.annotationData.set(event.annotations); + this.postUpdateFns.push(() => { + this.ctx.annotationManager.fireChangedEvent(); + }); + this.update(); + } + onLayoutComplete(event) { + const seriesRect = event.series.paddedRect; + this.seriesRect = seriesRect; + this.container.setClipRect(seriesRect); + for (const axisLayout of event.axes ?? []) { + if (axisLayout.direction === import_ag_charts_community88._ModuleSupport.ChartAxisDirection.X) { + this.xAxis = this.getAxis(axisLayout, seriesRect, this.xAxis?.button); + } else { + this.yAxis = this.getAxis(axisLayout, seriesRect, this.yAxis?.button); + } + } + if (this.showAnnotations()) { + this.animateAnnotations({ from: 0, to: 1, phase: "trailing" }); + } else { + this.animateAnnotations({ from: 1, to: 0, phase: "remove" }); + } + } + showAnnotations() { + if (!this.yAxis || !this.xAxis) { + return false; + } + const hasData = this.ctx.chartService.series.some((s) => s.hasData); + const seriesIds = this.yAxis.context.seriesIds(); + const anyBoundSeriesVisible = seriesIds.some((id) => { + const series = this.ctx.chartService.series.find((s) => s.id === id); + return series?.visible; + }); + return hasData && anyBoundSeriesVisible; + } + animateAnnotations({ from, to, phase }) { + const { annotations } = this; + this.ctx.animationManager?.animate({ + from, + to, + id: "chart-annotations", + phase, + groupId: "opacity", + onUpdate(value) { + annotations.each((node) => { + node.opacity = value; + if ("setAxisLabelOpacity" in node) { + node.setAxisLabelOpacity(value); + } + }); + }, + onStop() { + annotations.each((node) => { + node.opacity = to; + if ("setAxisLabelOpacity" in node) { + node.setAxisLabelOpacity(to); + } + }); + } + }); + } + onPreRender() { + this.updateAnnotations(); + this.state.transition("render"); + } + getAxis(axisLayout, seriesRect, button) { + const axisCtx = this.ctx.axisManager.getAxisContext(axisLayout.direction)[0]; + const { position: axisPosition = "bottom", direction } = axisCtx; + const padding = axisLayout.gridPadding + axisLayout.seriesAreaPadding; + const bounds = new BBox3(0, 0, seriesRect.width, seriesRect.height).grow(padding, axisPosition); + const lineDirection = direction === ChartAxisDirection9.X ? "vertical" : "horizontal"; + const { axesButtons, snap } = this; + const buttonEnabled = this.enabled && axesButtons.enabled && (axesButtons.axes === "xy" || axesButtons.axes === direction); + if (buttonEnabled) { + button ?? (button = new AxisButton( + this.ctx, + { ...axisCtx, snapToGroup: snap }, + (coords) => this.onAxisButtonClick(coords, lineDirection), + seriesRect + )); + const axisLabelPadding = calculateAxisLabelPadding(axisLayout); + button.update(seriesRect, axisLabelPadding); + } else { + button?.destroy(); + button = void 0; + } + return { layout: axisLayout, context: axisCtx, bounds, button }; + } + recordActionAfterNextUpdate(label, types = ["annotations"]) { + const { + defaults, + ctx: { annotationManager, historyManager } + } = this; + const originators = types.map((type) => type === "defaults" ? defaults : annotationManager); + this.postUpdateFns.push(() => { + historyManager.record(label, ...originators); + annotationManager.fireChangedEvent(); + }); + } + setColorAndDefault(datumType, colorPickerType, colorOpacity, color6, opacity, isMultiColor) { + this.state.transition("color", { colorPickerType, colorOpacity, color: color6, opacity, isMultiColor }); + this.defaults.setDefaultColor(datumType, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + } + setFontSizeAndDefault(datumType, fontSize) { + this.state.transition("fontSize", fontSize); + this.defaults.setDefaultFontSize(datumType, fontSize); + this.recordActionAfterNextUpdate(`Change ${datumType} font size to ${fontSize}`, ["annotations", "defaults"]); + } + setLineStyleTypeAndDefault(datumType, styleType) { + this.state.transition("lineStyle", { type: styleType }); + this.defaults.setDefaultLineStyleType(datumType, styleType); + this.recordActionAfterNextUpdate(`Change ${datumType} line style to ${styleType}`, ["annotations", "defaults"]); + } + setLineStyleWidthAndDefault(datumType, strokeWidth) { + this.state.transition("lineStyle", { strokeWidth }); + this.defaults.setDefaultLineStyleWidth(datumType, strokeWidth); + this.recordActionAfterNextUpdate(`Change ${datumType} stroke width to ${strokeWidth}`, [ + "annotations", + "defaults" + ]); + } + updateAnnotations() { + const { + annotationData, + annotations, + seriesRect, + ctx: { annotationManager } + } = this; + const context = this.getAnnotationContext(); + if (!seriesRect || !context) + return; + annotationManager.updateData(annotationData.toJson()); + const showAnnotations = this.showAnnotations(); + this.toolbar.refreshButtonsEnabled(showAnnotations); + this.toolbar.toggleClearButtonEnabled(annotationData.length > 0 && showAnnotations); + annotations.update(annotationData ?? [], void 0, (datum) => datum.id).each((node, datum) => { + if (!showAnnotations) { + node.visible = false; + if ("setAxisLabelVisible" in node) { + node.setAxisLabelVisible(false); + } + return; + } + if ("setAxisLabelVisible" in node) { + node.setAxisLabelVisible(true); + } + this.injectDatumDependencies(datum); + updateAnnotation(node, datum, context); + }); + for (const fn of this.postUpdateFns) { + fn(); + } + this.postUpdateFns = []; + } + getAnnotationContext() { + const { seriesRect, xAxis, yAxis, snap } = this; + if (!(seriesRect && xAxis && yAxis)) { + return; + } + return { + seriesRect, + xAxis: { + ...xAxis.context, + bounds: xAxis.bounds, + labelPadding: calculateAxisLabelPadding(xAxis.layout), + snapToGroup: snap + }, + yAxis: { + ...yAxis.context, + bounds: yAxis.bounds, + labelPadding: calculateAxisLabelPadding(xAxis.layout), + snapToGroup: snap + } + }; + } + onHover(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const shiftKey = event.sourceEvent.shiftKey; + const offset = Vec219.from(event); + const point = invertCoords(offset, context); + state.transition("hover", { offset, point, shiftKey, context }); + } + onClick(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const shiftKey = event.sourceEvent.shiftKey; + const point = invertCoords(Vec219.from(event), context); + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + state.transition("click", { point, shiftKey, textInputValue, bbox }); + } + onDoubleClick(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const offset = Vec219.from(event); + state.transition("dblclick", { offset }); + } + onAxisButtonClick(coords, direction) { + this.cancel(); + this.reset(); + const context = this.getAnnotationContext(); + if (!this.annotationData || !context) + return; + const { state } = this; + this.pushAnnotationState(InteractionState2.Annotations); + const isHorizontal2 = direction === "horizontal"; + state.transition(isHorizontal2 ? "horizontal-line" /* HorizontalLine */ : "vertical-line" /* VerticalLine */); + this.optionsToolbar.hide(); + if (!coords) { + return; + } + const point = invertCoords(coords, context); + if (!validateDatumPoint(context, point)) { + return; + } + state.transition("click", { point, shiftKey: false }); + this.update(); + } + onResize() { + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + this.state.transition("resize", { textInputValue, bbox }); + } + hoverTouchPreHandler(event) { + if (event.device === "touch") { + this.onHover(event); + } + } + dragMoveTouchPreHandler(event) { + if (event.device === "touch" && this.ctx.interactionManager.isState(InteractionState2.AnnotationsSelected)) { + event.sourceEvent.preventDefault(); + } + } + onDragStart(event) { + if (!this.ctx.interactionManager.isState(InteractionState2.AnnotationsDraggable)) + return; + const context = this.getAnnotationContext(); + if (!context) + return; + const offset = Vec219.from(event); + const point = invertCoords(offset, context); + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + this.state.transition("dragStart", { context, offset, point, textInputValue, bbox }); + } + onDrag(event) { + if (!this.ctx.interactionManager.isState(InteractionState2.AnnotationsDraggable)) + return; + const context = this.getAnnotationContext(); + if (!context) + return; + const offset = Vec219.from(event); + const point = invertCoords(offset, context); + const shiftKey = event.sourceEvent.shiftKey; + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + this.state.transition("drag", { context, offset, point, shiftKey, textInputValue, bbox }); + } + onDragEnd() { + this.state.transition("dragEnd"); + } + onCancel(widgetEvent) { + const { sourceEvent } = widgetEvent ?? {}; + if (sourceEvent?.currentTarget !== sourceEvent?.target) + return; + this.cancel(); + this.reset(); + } + onDelete() { + if (this.textInput.isVisible()) + return; + this.cancel(); + this.delete(); + this.reset(); + this.update(); + } + onTextInput(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const { key, shiftKey } = event; + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + state.transition("textInput", { key, shiftKey, textInputValue, bbox, context }); + } + onKeyDown(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) { + return; + } + const { sourceEvent } = event; + const { shiftKey, ctrlKey, metaKey } = sourceEvent; + const ctrlMeta = ctrlKey || metaKey; + const ctrlShift = ctrlKey || shiftKey; + state.transition("keyDown", { shiftKey, context }); + const translation = { x: 0, y: 0 }; + const xStep = Math.max(context?.xAxis.scale.bandwidth ?? 0, ctrlShift ? 10 : 1); + const yStep = Math.max(context?.yAxis.scale.bandwidth ?? 0, ctrlShift ? 10 : 1); + switch (sourceEvent.key) { + case "ArrowDown": + translation.y = yStep; + break; + case "ArrowUp": + translation.y = -yStep; + break; + case "ArrowLeft": + translation.x = -xStep; + break; + case "ArrowRight": + translation.x = xStep; + break; + case "Escape": + this.onCancel(); + return; + case "Backspace": + case "Delete": + this.onDelete(); + return; + } + if (translation.x || translation.y) { + state.transition("translate", { translation }); + sourceEvent.stopPropagation(); + sourceEvent.preventDefault(); + } + if (!ctrlMeta) { + return; + } + switch (sourceEvent.key) { + case "c": + state.transition("copy"); + return; + case "x": + state.transition("cut"); + this.recordActionAfterNextUpdate("Cut annotation"); + return; + case "v": + state.transition("paste"); + this.recordActionAfterNextUpdate("Paste annotation"); + return; + } + } + onKeyUp(event) { + const { shiftKey } = event.sourceEvent; + const context = this.getAnnotationContext(); + if (!context) { + return; + } + this.state.transition("keyUp", { shiftKey, context }); + this.state.transition("translateEnd"); + } + clear() { + this.cancel(); + this.deleteAll(); + this.reset(); + } + reset() { + this.state.transition("reset"); + } + cancel() { + this.state.transition("cancel"); + } + delete() { + this.state.transition("delete"); + } + deleteAll() { + this.state.transition("deleteAll"); + } + deleteEphemeralAnnotations() { + let deletedEphemeral = false; + for (const [index, datum] of this.annotationData.entries()) { + if (isEphemeralType(datum)) { + this.annotationData.splice(index, 1); + deletedEphemeral = true; + } + } + if (deletedEphemeral) { + this.recordActionAfterNextUpdate("Delete ephemeral annotations"); + } + } + hideOverlays() { + this.settingsDialog.hide(); + this.toolbar.hideOverlays(); + this.optionsToolbar.hideOverlays(); + } + pushAnnotationState(state) { + this.ctx.interactionManager.pushState(state); + this.ctx.tooltipManager.suppressTooltip("annotations"); + } + popAnnotationState(state) { + this.ctx.interactionManager.popState(state); + this.ctx.tooltipManager.unsuppressTooltip("annotations"); + } + isAnnotationState() { + return this.ctx.interactionManager.isState(InteractionState2.Annotations) || this.ctx.interactionManager.isState(InteractionState2.AnnotationsSelected); + } + update(status = ChartUpdateType.PRE_SCENE_RENDER) { + this.ctx.updateService.update(status); + } +}; +__decorateClass([ + Property33 +], _Annotations.prototype, "enabled", 2); +__decorateClass([ + Property33 +], _Annotations.prototype, "toolbar", 2); +__decorateClass([ + Property33 +], _Annotations.prototype, "optionsToolbar", 2); +__decorateClass([ + Property33 +], _Annotations.prototype, "axesButtons", 2); +__decorateClass([ + Property33 +], _Annotations.prototype, "snap", 2); +var Annotations = _Annotations; + +// packages/ag-charts-enterprise/src/features/annotations/annotationsTheme.ts +var import_ag_charts_community89 = require("ag-charts-community"); +var { FONT_SIZE_RATIO, ThemeSymbols } = import_ag_charts_community89._ModuleSupport; +var stroke = { + stroke: { $ref: "foregroundColor" }, + strokeOpacity: 1, + strokeWidth: 2 +}; +var handle = { + fill: ThemeSymbols.DEFAULT_ANNOTATION_HANDLE_FILL, + strokeOpacity: 1, + strokeWidth: 2 +}; +var font = { + color: { $ref: "chartBackgroundColor" }, + fontSize: { $rem: FONT_SIZE_RATIO.LARGE }, + fontFamily: { $ref: "fontFamily" } +}; +var axisLabel = { + ...font, + enabled: true, + fill: { $ref: "foregroundColor" }, + fontSize: { $ref: "fontSize" } +}; +var text = { + ...font, + textAlign: "left" +}; +var lineText = { + ...font, + position: "top", + alignment: "center", + color: { $ref: "textColor" } +}; +var channelText = { + ...font, + position: "top", + alignment: "center", + color: { $ref: "textColor" } +}; +var measurerStatistics = { + ...font, + fontSize: { $ref: "fontSize" }, + color: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_COLOR, + fill: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_FILL, + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_STROKE, + strokeWidth: 1, + divider: { + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE, + strokeWidth: 1, + strokeOpacity: 0.5 + } +}; +var measurer = { + ...stroke, + background: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + handle: { ...handle }, + text: { ...lineText }, + statistics: { ...measurerStatistics } +}; +var toolbar = { + buttons: { + $shallowSimple: [ + { + icon: "text-annotation", + tooltip: "toolbarAnnotationsTextAnnotations", + value: "text-menu" + }, + { + icon: "trend-line-drawing", + tooltip: "toolbarAnnotationsLineAnnotations", + value: "line-menu" + }, + { + icon: "arrow-drawing", + tooltip: "toolbarAnnotationsShapeAnnotations", + value: "shape-menu" + }, + { + icon: "delete", + tooltip: "toolbarAnnotationsClearAll", + value: "clear" + } + ] + }, + padding: { $ref: "chartPadding" } +}; +var optionsToolbar = { + buttons: { + $shallowSimple: [ + { + icon: "text-annotation", + tooltip: "toolbarAnnotationsTextColor", + value: "text-color" + }, + { + icon: "line-color", + tooltip: "toolbarAnnotationsLineColor", + value: "line-color" + }, + { + icon: "fill-color", + tooltip: "toolbarAnnotationsFillColor", + value: "fill-color" + }, + { + tooltip: "toolbarAnnotationsTextSize", + value: "text-size" + }, + { + tooltip: "toolbarAnnotationsLineStrokeWidth", + value: "line-stroke-width" + }, + { + icon: "line-style-solid", + tooltip: "toolbarAnnotationsLineStyle", + value: "line-style-type" + }, + { + icon: "settings", + tooltip: "toolbarAnnotationsSettings", + value: "settings" + }, + { + icon: "unlocked", + tooltip: "toolbarAnnotationsLock", + ariaLabel: "toolbarAnnotationsLock", + checkedOverrides: { + icon: "locked", + tooltip: "toolbarAnnotationsUnlock" + }, + value: "lock" + }, + { + icon: "delete", + tooltip: "toolbarAnnotationsDelete", + value: "delete" + } + ] + } +}; +var annotationsTheme = { + enabled: false, + // Lines + line: { + ...stroke, + handle: { ...handle }, + text: { ...lineText } + }, + "horizontal-line": { + ...stroke, + handle: { ...handle }, + axisLabel: { ...axisLabel }, + text: { ...lineText } + }, + "vertical-line": { + ...stroke, + handle: { ...handle }, + axisLabel: { ...axisLabel }, + text: { ...lineText } + }, + // Channels + "disjoint-channel": { + ...stroke, + background: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + handle: { ...handle }, + text: { ...channelText } + }, + "parallel-channel": { + ...stroke, + middle: { + lineDash: [6, 5], + strokeWidth: 1 + }, + background: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + handle: { ...handle }, + text: { ...channelText } + }, + // Fibonnaccis + "fibonacci-retracement": { + ...stroke, + strokes: ThemeSymbols.DEFAULT_FIBONACCI_STROKES, + rangeStroke: { $ref: "foregroundColor" }, + handle: { ...handle }, + text: { ...lineText, position: "center" }, + label: { + ...font, + color: void 0, + fontSize: { $rem: FONT_SIZE_RATIO.SMALLER } + } + }, + "fibonacci-retracement-trend-based": { + ...stroke, + strokes: ThemeSymbols.DEFAULT_FIBONACCI_STROKES, + rangeStroke: { $ref: "foregroundColor" }, + handle: { ...handle }, + text: { ...lineText, position: "center" }, + label: { + ...font, + color: void 0, + fontSize: { $rem: FONT_SIZE_RATIO.SMALLER } + } + }, + // Texts + callout: { + ...stroke, + ...text, + color: { $ref: "textColor" }, + handle: { ...handle }, + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + comment: { + ...text, + fontWeight: 700, + handle: { ...handle }, + fill: { $ref: "foregroundColor" } + }, + note: { + ...text, + color: ThemeSymbols.DEFAULT_TEXTBOX_COLOR, + fill: ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, + stroke: { $ref: "chartBackgroundColor" }, + strokeWidth: 1, + strokeOpacity: 1, + handle: { ...handle }, + background: { + fill: ThemeSymbols.DEFAULT_TEXTBOX_FILL, + stroke: ThemeSymbols.DEFAULT_TEXTBOX_STROKE, + strokeWidth: 1 + } + }, + text: { + ...text, + color: { $ref: "textColor" }, + handle: { ...handle } + }, + // Shapes + arrow: { + ...stroke, + handle: { ...handle }, + text: { ...lineText } + }, + "arrow-up": { + fill: { $palette: "up.fill" }, + handle: { ...handle, stroke: { $ref: "foregroundColor" } } + }, + "arrow-down": { + fill: { $palette: "down.fill" }, + handle: { ...handle, stroke: { $ref: "foregroundColor" } } + }, + // Measurers + "date-range": { + ...measurer + }, + "price-range": { + ...measurer + }, + "date-price-range": { + ...measurer + }, + "quick-date-price-range": { + up: { + ...stroke, + fill: ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + fillOpacity: 0.2, + handle: { ...handle }, + statistics: { + ...measurerStatistics, + color: "#fff", + fill: ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + strokeWidth: 0, + divider: { + stroke: "#fff", + strokeWidth: 1, + strokeOpacity: 0.5 + } + } + }, + down: { + ...stroke, + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE, + fill: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, + fillOpacity: 0.2, + handle: { + ...handle, + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE + }, + statistics: { + ...measurerStatistics, + color: "#fff", + fill: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, + strokeWidth: 0, + divider: { + stroke: "#fff", + strokeWidth: 1, + strokeOpacity: 0.5 + } + } + } + }, + axesButtons: {}, + // Toolbars + toolbar, + optionsToolbar +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotationsModule.ts +var AnnotationsModule = { + type: "root", + optionsKey: "annotations", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new Annotations(ctx), + themeTemplate: { + annotations: annotationsTheme + } +}; + +// packages/ag-charts-enterprise/src/features/background/background.ts +var import_ag_charts_community91 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/image/image.ts +var import_ag_charts_community90 = require("ag-charts-community"); +var import_ag_charts_core44 = require("ag-charts-core"); +var { BaseProperties: BaseProperties12, ObserveChanges: ObserveChanges2, ProxyProperty, Property: Property34, calculatePlacement } = import_ag_charts_community90._ModuleSupport; +var Image = class extends BaseProperties12 { + constructor() { + super(); + this.opacity = 1; + this.loadedSynchronously = true; + this.containerWidth = 0; + this.containerHeight = 0; + this.onLoad = void 0; + this.onImageLoad = () => { + if (this.loadedSynchronously) { + return; + } + this.node.visible = false; + this.performLayout(this.containerWidth, this.containerHeight); + this.onLoad?.(); + }; + this.imageElement = (0, import_ag_charts_core44.createElement)("img"); + this.imageElement.onload = this.onImageLoad; + this.node = new import_ag_charts_community90._ModuleSupport.Image(this.imageElement); + } + get complete() { + return this.imageElement.width > 0 && this.imageElement.height > 0; + } + performLayout(containerWidth, containerHeight) { + this.containerWidth = containerWidth; + this.containerHeight = containerHeight; + const container = { width: containerWidth, height: containerHeight }; + const placement = calculatePlacement(this.imageElement.width, this.imageElement.height, container, this); + this.node.setProperties( + this.complete ? { + visible: true, + opacity: this.opacity, + ...placement + } : { visible: false } + ); + return placement; + } +}; +__decorateClass([ + Property34 +], Image.prototype, "top", 2); +__decorateClass([ + Property34 +], Image.prototype, "right", 2); +__decorateClass([ + Property34 +], Image.prototype, "bottom", 2); +__decorateClass([ + Property34 +], Image.prototype, "left", 2); +__decorateClass([ + Property34 +], Image.prototype, "width", 2); +__decorateClass([ + Property34 +], Image.prototype, "height", 2); +__decorateClass([ + Property34 +], Image.prototype, "opacity", 2); +__decorateClass([ + ProxyProperty("imageElement.src"), + ObserveChanges2((target) => target.loadedSynchronously = target.complete) +], Image.prototype, "url", 2); + +// packages/ag-charts-enterprise/src/features/background/background.ts +var { ActionOnSet: ActionOnSet3, Property: Property35 } = import_ag_charts_community91._ModuleSupport; +var Background2 = class extends import_ag_charts_community91._ModuleSupport.Background { + constructor() { + super(...arguments); + this.image = new Image(); + } + onLayoutComplete(event) { + super.onLayoutComplete(event); + if (this.image) { + const { width, height } = event.chart; + this.image.performLayout(width, height); + } + } + onImageLoad() { + this.ctx.updateService.update(import_ag_charts_community91._ModuleSupport.ChartUpdateType.SCENE_RENDER); + } +}; +__decorateClass([ + Property35, + ActionOnSet3({ + newValue(image) { + this.node.appendChild(image.node); + image.onLoad = () => this.onImageLoad(); + }, + oldValue(image) { + image.node.remove(); + image.onLoad = void 0; + } + }) +], Background2.prototype, "image", 2); + +// packages/ag-charts-enterprise/src/features/background/backgroundModule.ts +var BackgroundModule = { + type: "root", + optionsKey: "background", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Background2(ctx) +}; + +// packages/ag-charts-enterprise/src/features/band-highlight/bandHighlight.ts +var import_ag_charts_community92 = require("ag-charts-community"); +var import_ag_charts_core45 = require("ag-charts-core"); +var { + Range, + TranslatableGroup, + BBox: BBox4, + Property: Property36, + ZIndexMap: ZIndexMap4, + ChartAxisDirection: ChartAxisDirection10, + FillGradientDefaults, + FillImageDefaults, + FillPatternDefaults, + getShapeFill, + InteractionState: InteractionState3 +} = import_ag_charts_community92._ModuleSupport; +var BandHighlight = class extends import_ag_charts_community92._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.id = (0, import_ag_charts_core45.createId)(this); + this.enabled = false; + this.stroke = "rgb(195, 195, 195)"; + this.lineDash = [6, 3]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.fill = "#c16068"; + this.fillOpacity = 1; + this.fillGradientDefaults = new FillGradientDefaults(); + this.fillPatternDefaults = new FillPatternDefaults(); + this.fillImageDefaults = new FillImageDefaults(); + this.bounds = new BBox4(0, 0, 0, 0); + this.bandHighlightGroup = new TranslatableGroup({ + name: "bandHighlight", + zIndex: ZIndexMap4.AXIS_BAND_HIGHLIGHT + }); + this.rangeNode = this.bandHighlightGroup.appendChild(new Range()); + this.activeAxisHighlight = void 0; + this.axisCtx = ctx.parent; + this.hideBand(); + ctx.domManager.addEventListener("focusin", ({ target }) => { + const isSeriesAreaChild = target instanceof HTMLElement && ctx.domManager.contains(target, "series-area"); + if (this.bandHighlightGroup.visible && !isSeriesAreaChild) { + this.hideBand(); + this.ctx.updateService.update(import_ag_charts_community92._ModuleSupport.ChartUpdateType.PERFORM_LAYOUT); + } + }); + const { + widgets: { seriesWidget, seriesDragInterpreter }, + animationManager, + eventsHub + } = ctx; + this.cleanup.register( + ctx.scene.attachNode(this.bandHighlightGroup), + seriesWidget.addListener("mousemove", (event) => this.onHoverLikeEvent(event)), + seriesWidget.addListener("mouseleave", () => this.clearAllHighlight()), + animationManager.addListener("animation-start", () => this.clearAllHighlight()), + eventsHub.on("layout:complete", (event) => this.layout(event)), + eventsHub.on("series:focus-change", () => this.onKeyPress()), + eventsHub.on("zoom:pan-start", () => this.clearAllHighlight()), + eventsHub.on("zoom:change", () => this.clearAllHighlight()), + eventsHub.on("dom:resize", () => this.clearAllHighlight()), + eventsHub.on("axis:change", () => this.axisChange()) + ); + if (seriesDragInterpreter) { + this.cleanup.register( + seriesDragInterpreter.events.on("drag-move", (event) => this.onHoverLikeEvent(event)), + seriesDragInterpreter.events.on("click", (event) => this.onClick(event)) + ); + } + } + axisChange() { + this.onHighlightChange(); + } + isHover(event) { + return event.type === "mousemove" || event.type === "click" || event.device === "touch" && this.ctx.chartService.touch.dragAction === "hover"; + } + onClick(event) { + if (event.device === "touch") { + this.onHoverLikeEvent(event); + } + } + clearAllHighlight() { + if (!this.ctx.interactionManager.isState(InteractionState3.Clickable)) + return; + this.onHighlightChange(); + } + onKeyPress() { + if (this.ctx.interactionManager.isState(InteractionState3.Default)) { + this.onHighlightChange(); + } + } + onHoverLikeEvent(event) { + const requiredState = this.isHover(event) ? InteractionState3.Clickable : InteractionState3.AnnotationsMoveable; + if (!this.ctx.interactionManager.isState(requiredState)) + return; + this.handleHoverHighlight(event); + } + handleHoverHighlight(event) { + if (!event) + return; + const { currentX: x, currentY: y } = event; + this.onHighlightChange(this.axisCtx.pickBand({ x, y })); + } + layout({ series: { rect, visible }, axes }) { + if (!visible || !axes || !this.enabled) + return; + const { position: axisPosition = "left", axisId } = this.axisCtx; + const axisLayout = axes.find((a) => a.id === axisId); + if (!axisLayout) + return; + this.axisLayout = axisLayout; + this.bounds = rect.clone().grow(axisLayout.gridPadding, axisPosition); + const { bandHighlightGroup, bounds } = this; + bandHighlightGroup.translationX = Math.round(bounds.x); + bandHighlightGroup.translationY = Math.round(bounds.y); + this.updateBand(); + } + updateBand() { + const { + rangeNode: node, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + fill, + fillOpacity, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3, + lineDashOffset, + axisLayout + } = this; + if (!axisLayout) + return; + node.stroke = stroke2; + node.strokeWidth = strokeWidth; + node.strokeOpacity = strokeOpacity; + node.lineDash = lineDash; + node.lineDashOffset = lineDashOffset; + node.fill = getShapeFill(fill, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + node.fillOpacity = fillOpacity; + node.startLine = true; + node.endLine = true; + } + isVertical() { + return this.axisCtx.direction === ChartAxisDirection10.X; + } + onHighlightChange(axisBandDatum) { + if (!this.enabled) + return; + this.activeAxisHighlight = axisBandDatum; + if (this.activeAxisHighlight) { + this.showBand(); + } else { + this.hideBand(); + } + this.ctx.updateService.update(import_ag_charts_community92._ModuleSupport.ChartUpdateType.SCENE_RENDER); + } + updateBandPosition() { + const { rangeNode, bounds } = this; + const { band } = this.activeAxisHighlight ?? {}; + if (band == void 0) { + this.hideBand(); + return; + } + let r0 = Math.min(...band); + let r1 = Math.max(...band); + if (r1 - r0 < 1) { + const mid = (r0 + r1) / 2; + r0 = mid - 0.5; + r1 = mid + 0.5; + } + if (this.isVertical()) { + rangeNode.y1 = 0; + rangeNode.y2 = bounds.height; + rangeNode.x1 = r0; + rangeNode.x2 = r1; + rangeNode.horizontal = true; + } else { + rangeNode.y1 = r0; + rangeNode.y2 = r1; + rangeNode.x1 = 0; + rangeNode.x2 = bounds.width; + rangeNode.horizontal = false; + } + } + showBand() { + this.updateBandPosition(); + this.bandHighlightGroup.visible = true; + } + hideBand() { + this.bandHighlightGroup.visible = false; + } +}; +__decorateClass([ + Property36 +], BandHighlight.prototype, "enabled", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "stroke", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "lineDash", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "lineDashOffset", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "strokeWidth", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "strokeOpacity", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "fill", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "fillOpacity", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "fillGradientDefaults", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "fillPatternDefaults", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "fillImageDefaults", 2); + +// packages/ag-charts-enterprise/src/features/band-highlight/bandHighlightModule.ts +var BandHighlightModule = { + type: "axis-option", + optionsKey: "bandHighlight", + packageType: "enterprise", + chartTypes: ["cartesian"], + axisTypes: ["category", "ordinal-time", "unit-time", "grouped-category"], + moduleFactory: (ctx) => new BandHighlight(ctx), + themeTemplate: { + bandHighlight: { + enabled: false, + strokeWidth: 0, + lineDash: [], + fill: { $foregroundBackgroundMix: 0.05 } + } + } +}; + +// packages/ag-charts-enterprise/src/features/chart-toolbar/chartToolbar.ts +var import_ag_charts_community93 = require("ag-charts-community"); +var import_ag_charts_core46 = require("ag-charts-core"); +var { ActionOnSet: ActionOnSet4, LayoutElement: LayoutElement2, Menu: Menu3, Property: Property37 } = import_ag_charts_community93._ModuleSupport; +var menuItems = [ + { label: "toolbarSeriesTypeOHLC", icon: "ohlc-series", value: "ohlc" }, + { label: "toolbarSeriesTypeCandles", icon: "candlestick-series", value: "candlestick" }, + { label: "toolbarSeriesTypeHollowCandles", icon: "hollow-candlestick-series", value: "hollow-candlestick" }, + { label: "toolbarSeriesTypeLine", icon: "line-series", value: "line" }, + { label: "toolbarSeriesTypeStepLine", icon: "step-line-series", value: "step-line" }, + { label: "toolbarSeriesTypeHLC", icon: "hlc-series", value: "hlc" }, + { label: "toolbarSeriesTypeHighLow", icon: "high-low-series", value: "high-low" } +]; +var ChartToolbar = class extends import_ag_charts_community93._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.menu = new Menu3(this.ctx, "chart-toolbar"); + this.toolbar = ctx.sharedToolbar.getSharedToolbar("chartToolbar"); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPressed.bind(this)), + ctx.layoutManager.registerElement(LayoutElement2.ToolbarLeft, this.onLayoutStart.bind(this)), + () => this.toolbar.destroy() + ); + } + onLayoutStart(event) { + if (!this.enabled) + return; + this.updateButton(); + this.toolbar.layout(event.layoutBox); + } + onButtonPressed({ event, buttonBounds, buttonWidget }) { + this.menu.setAnchor({ x: buttonBounds.x + buttonBounds.width + 6, y: buttonBounds.y }); + this.menu.show(buttonWidget, { + items: menuItems, + menuItemRole: "menuitemradio", + ariaLabel: this.ctx.localeManager.t("toolbarSeriesTypeDropdown"), + class: "ag-charts-chart-toolbar__menu", + value: this.getChartType(), + sourceEvent: event.sourceEvent, + onPress: (item) => { + this.setChartType(item.value); + this.hidePopover(); + }, + onHide: () => { + this.toolbar.clearActiveButton(); + } + }); + this.toolbar.toggleActiveButtonByIndex(0); + } + updateButton() { + const chartType = this.getChartType(); + const icon = menuItems.find((item) => item.value === chartType)?.icon; + if (icon != null) { + this.toolbar.updateButtons([{ icon, tooltip: "toolbarSeriesTypeDropdown", value: "menu" }]); + } + } + hidePopover() { + this.toolbar.clearActiveButton(); + this.menu.hide(); + } + setChartType(chartType) { + const options = { chartType }; + this.ctx.chartService.publicApi?.updateDelta(options).catch((e) => import_ag_charts_core46.Logger.error(e)); + } + getChartType() { + const chartType = this.ctx.chartService.publicApi?.getOptions()?.chartType; + if (chartType == null || !menuItems.some((item) => item.value === chartType)) { + return "candlestick"; + } + return chartType; + } +}; +__decorateClass([ + Property37, + ActionOnSet4({ + changeValue(enabled) { + this.toolbar?.setHidden(!enabled); + } + }) +], ChartToolbar.prototype, "enabled", 2); + +// packages/ag-charts-enterprise/src/features/chart-toolbar/chartToolbarModule.ts +var ChartToolbarModule = { + type: "root", + optionsKey: "chartToolbar", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new ChartToolbar(ctx) +}; + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenuModule.ts +var import_ag_charts_community95 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenu.ts +var import_ag_charts_community94 = require("ag-charts-community"); +var import_ag_charts_core48 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenuItem.ts +var import_ag_charts_core47 = require("ag-charts-core"); +function showsFor(showOn, showing) { + if (showOn === "always") + return true; + if (showOn === "series-area") + return showing === "series-area" || showing === "series-node"; + return showOn === showing; +} +function appendItem(showing, item, result) { + let mustShow = true; + if (item.type === "separator") { + const last = result.at(-1); + mustShow = last !== void 0 && last.type !== "separator"; + } + mustShow && (mustShow = showsFor(item.showOn ?? "always", showing)); + if (mustShow) { + const menuItem = new ContextMenuItem(item); + result.push(menuItem); + return menuItem; + } +} +function appendBuiltinItem(showing, registry, keyword, result) { + if (registry.isVisible(keyword)) { + appendItem(showing, registry.builtins.items[keyword], result); + } +} +function expandBuiltin(showing, registry, keyword, result) { + const { builtins } = registry; + if ((0, import_ag_charts_core47.isKeyOf)(keyword, builtins.lists)) { + for (const childKeyword of builtins.lists[keyword]) { + appendBuiltinItem(showing, registry, childKeyword, result); + } + } else { + appendBuiltinItem(showing, registry, keyword, result); + } +} +function expandItems(showing, registry, items, result) { + for (const item of items) { + if (typeof item === "string") { + expandBuiltin(showing, registry, item, result); + } else { + const menuItem = appendItem(showing, item, result); + if (item.items && menuItem && item.items.length > 0) { + expandItems(showing, registry, item.items, menuItem.items); + } + } + } + if (result.at(-1)?.type === "separator") { + result.pop(); + } +} +var ContextMenuItem = class { + constructor(options) { + this.type = "action"; + this.showOn = "always"; + this.label = ""; + this.iconUrl = void 0; + this.enabled = true; + this.items = []; + this.action = void 0; + if (options) + this.setOptions(options); + this.items = []; + } + setField(key, that, value) { + that[key] = value; + } + setOptions(options) { + let key; + for (key in options) { + if (options[key] !== void 0) { + this.setField(key, this, options[key]); + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenuStyles.ts +var DEFAULT_CONTEXT_MENU_CLASS = "ag-charts-context-menu"; + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenu.ts +var { Property: Property38, ContextMenuRegistry, callWithContext, getIconClassNames: getIconClassNames3 } = import_ag_charts_community94._ModuleSupport; +var moduleId2 = "context-menu"; +var ContextMenu = class extends import_ag_charts_community94._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + this.darkTheme = false; + this.items = ["defaults"]; + // State + this.pickedNode = void 0; + this.showEvent = void 0; + this.x = 0; + this.y = 0; + this.collapsingSubMenus = 0; + this.menuWidget = new import_ag_charts_community94._Widget.MenuWidget(); + this.interactionManager = ctx.interactionManager; + this.element = ctx.domManager.addChild("canvas-overlay", moduleId2); + this.element.classList.add(DEFAULT_CONTEXT_MENU_CLASS); + this.element.style.display = "none"; + this.element.addEventListener("contextmenu", (event) => event.preventDefault()); + this.element.addEventListener("focusout", ({ relatedTarget }) => { + if (this.collapsingSubMenus > 0) + return; + if (relatedTarget == null || relatedTarget instanceof Node && !this.element.contains(relatedTarget)) { + this.hide(); + } + }); + this.cleanup.register( + () => this.element.remove(), + () => this.menuWidget.destroy(), + ctx.eventsHub.on("dom:hidden", () => this.hide()), + this.menuWidget.addListener("collapse-widget", () => this.onCollapse()) + ); + this.menuWidget.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__menu`); + if (typeof MutationObserver !== "undefined") { + const observer = new MutationObserver(() => { + if (this.element.contains(this.menuWidget.getElement())) { + this.reposition(); + } + }); + observer.observe(this.element, { childList: true }); + this.mutationObserver = observer; + this.cleanup.register(() => observer.disconnect()); + } + this.ctx.contextMenuRegistry.builtins.items["download"].action = () => { + const title = ctx.chartService.title; + let fileName = "image"; + if (title?.enabled) { + fileName = title.node.getPlainText().replace(/\.+/, ""); + } + this.ctx.chartService.publicApi?.download({ fileName }).catch((e) => { + import_ag_charts_core48.Logger.error("Unable to download chart", e); + }); + }; + this.cleanup.register(this.ctx.eventsHub.on("context-menu:complete", (e) => this.onContext(e))); + } + expandItemsOptions(showing) { + const result = []; + expandItems(showing, this.ctx.contextMenuRegistry, this.items, result); + return result; + } + onContext(event) { + if (!this.enabled) + return; + event.widgetEvent.sourceEvent.preventDefault(); + this.showEvent = event.widgetEvent.sourceEvent; + this.x = event.x; + this.y = event.y; + this.pickedNode = void 0; + this.pickedLegendItem = void 0; + if (ContextMenuRegistry.check("series-node", event)) { + this.pickedNode = event.context.pickedNode; + } else if (ContextMenuRegistry.check("legend-item", event)) { + this.pickedLegendItem = event.context.legendItem; + } + const expandedItems = this.expandItemsOptions(event.showOn); + if (expandedItems.length === 0) + return; + this.show(event.widgetEvent, expandedItems); + } + show(widgetEvent, expandedItems) { + const { sourceEvent } = widgetEvent; + this.interactionManager.pushState(import_ag_charts_community94._ModuleSupport.InteractionState.ContextMenu); + this.element.style.display = "block"; + const overrideFocusVisible = sourceEvent.pointerType === "touch" ? false : void 0; + if (overrideFocusVisible !== void 0) { + this.ctx.chartService.overrideFocusVisible(overrideFocusVisible); + } + this.createMenu(expandedItems); + this.element.appendChild(this.menuWidget.getElement()); + this.menuWidget.expand({ sourceEvent, overrideFocusVisible }); + } + hide() { + this.menuWidget.collapse(); + } + onCollapse() { + this.interactionManager.popState(import_ag_charts_community94._ModuleSupport.InteractionState.ContextMenu); + this.menuWidget.getElement().remove(); + this.element.style.display = "none"; + } + onSubMenuExpand(button, menu) { + const bounds = button.getBounds(); + button.setFocusOverride(true); + button.getElement().insertAdjacentElement("afterend", menu.getElement()); + menu.getElement().style.position = "absolute"; + const canvasRect = this.ctx.domManager.getBoundingClientRect(); + const buttonClientRect = button.getBoundingClientRect(); + const remainingSpaceOnRight = canvasRect.right - buttonClientRect.right; + const remainingSpaceOnLeft = buttonClientRect.left - canvasRect.left; + const { offsetWidth: menuOffsetWidth, offsetHeight: menuOffsetHeight } = menu.getElement(); + let y = bounds.y; + if (canvasRect.height > menuOffsetHeight) { + const remainingSpaceOnBottom = canvasRect.bottom - buttonClientRect.top; + if (remainingSpaceOnBottom < menuOffsetHeight) { + y -= menuOffsetHeight - remainingSpaceOnBottom; + } + } + if (remainingSpaceOnRight >= menuOffsetWidth) { + menu.setBounds({ x: bounds.x + bounds.width, y }); + } else { + const x = bounds.x - menuOffsetWidth; + const leftDelta = remainingSpaceOnLeft + x; + if (leftDelta >= 0) { + menu.setBounds({ x, y }); + } else { + menu.setBounds({ x: x - leftDelta, y }); + } + } + } + onSubMenuCollapse(button, menu) { + button.setFocusOverride(void 0); + this.collapsingSubMenus++; + menu.remove(); + this.collapsingSubMenus--; + } + createMenu(expandedItems) { + const { menuWidget } = this; + menuWidget.clear(); + menuWidget.setTabIndex(-1); + this.createMenuItems(menuWidget, expandedItems); + } + createMenuItems(menuWidget, expandedItems) { + for (const item of expandedItems) { + switch (item.type) { + case "separator": { + const sep = menuWidget.addSeparator(); + sep.classList.add(`${DEFAULT_CONTEXT_MENU_CLASS}__divider`); + break; + } + case "action": { + if (item.items.length === 0) { + const btn = new import_ag_charts_community94._Widget.MenuItemWidget(); + this.initButtonElement(btn, item); + menuWidget.addChild(btn); + } else { + const { subMenuButton, subMenu } = menuWidget.addSubMenu(); + subMenu.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__menu`); + subMenu.addListener("expand-widget", () => this.onSubMenuExpand(subMenuButton, subMenu)); + subMenu.addListener("collapse-widget", () => this.onSubMenuCollapse(subMenuButton, subMenu)); + this.initButtonElement(subMenuButton, item); + this.createMenuItems(subMenu, item.items); + } + break; + } + default: + throw new Error("unhandled case"); + } + } + } + createButtonOnClick(showOn, callback) { + if (ContextMenuRegistry.checkCallback("legend-item", showOn, callback)) { + return (widgetEvent) => { + const event = widgetEvent.sourceEvent; + if (this.pickedLegendItem) { + const { seriesId, itemId, label } = this.pickedLegendItem; + const { chartService: chart } = this.ctx; + if (typeof itemId !== "string") { + import_ag_charts_core48.Logger.error(`unexpected itemId type: [${typeof itemId}] (expected [string])`); + return; + } + const series = chart.series.find((s) => s.id === seriesId); + const callers = [series?.properties, chart]; + const apiEvent = { + type: "contextmenu", + seriesId, + itemId, + text: (0, import_ag_charts_core48.toPlainText)(label.text), + event + }; + callWithContext(callers, callback, apiEvent); + this.hide(); + } else { + import_ag_charts_core48.Logger.error("legend item not found"); + } + }; + } else if (ContextMenuRegistry.checkCallback("series-area", showOn, callback)) { + return () => { + const caller = this.ctx.chartService; + const apiEvent = { type: "seriesContextMenuAction", event: this.showEvent }; + callWithContext(caller, callback, apiEvent); + this.hide(); + }; + } else if (ContextMenuRegistry.checkCallback("series-node", showOn, callback)) { + return () => { + const { showEvent } = this; + const { chartService: chart } = this.ctx; + const pickedNode = this.pickedNode; + const callers = [pickedNode?.series.properties, chart]; + const apiEvent = pickedNode?.series.createNodeContextMenuActionEvent(showEvent, pickedNode); + if (apiEvent) { + callWithContext(callers, callback, apiEvent); + } else { + import_ag_charts_core48.Logger.error("series node not found"); + } + this.hide(); + }; + } + return () => { + const caller = this.ctx.chartService; + const apiEvent = { type: "contextMenuEvent", event: this.showEvent }; + callWithContext(caller, callback, apiEvent); + this.hide(); + }; + } + initTableCells(elem) { + const cellIcon = (0, import_ag_charts_core48.createElement)("div"); + const cellLabel = (0, import_ag_charts_core48.createElement)("div"); + const cellArrow = (0, import_ag_charts_core48.createElement)("div"); + cellIcon.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__icon`, true); + cellLabel.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__cell`, true); + cellArrow.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__cell`, true); + cellIcon.ariaHidden = "true"; + cellLabel.role = "presentation"; + cellArrow.ariaHidden = "true"; + elem.append(cellIcon, cellLabel, cellArrow); + return { cellIcon, cellLabel, cellArrow }; + } + initButtonElement(button, item) { + button.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__item`); + button.setEnabled(item.enabled); + const label = this.ctx.localeManager.t(item.label); + const cellPaddingClass = `${DEFAULT_CONTEXT_MENU_CLASS}__cellpadding`; + const { cellIcon, cellLabel, cellArrow } = this.initTableCells(button.getElement()); + cellLabel.textContent = label; + cellLabel.classList.add(cellPaddingClass); + if (item.iconUrl != null) { + const img = (0, import_ag_charts_core48.createElement)("img"); + img.src = item.iconUrl; + cellIcon.append(img); + cellIcon.classList.add(cellPaddingClass); + } + if (item.items.length > 0) { + const span = (0, import_ag_charts_core48.createElement)("span", getIconClassNames3("chevron-right")); + cellArrow.append(span); + cellArrow.classList.add(cellPaddingClass); + } + const { showOn, action } = item; + if (action != null) { + button.addListener("click", this.createButtonOnClick(showOn, action)); + } + if (item.items.length === 0) { + button.addListener("mouseleave", () => button.setFocusOverride(false)); + button.addListener("mouseenter", () => button.setFocusOverride(void 0)); + } + } + reposition() { + let { x, y } = this; + this.element.style.top = "unset"; + this.element.style.bottom = "unset"; + const canvasRect = this.ctx.domManager.getBoundingClientRect(); + const { offsetWidth: width, offsetHeight: height } = this.element; + x = (0, import_ag_charts_core48.clamp)(0, x, canvasRect.width - width); + y = (0, import_ag_charts_core48.clamp)(0, y, canvasRect.height - height); + this.element.style.left = `${x}px`; + this.element.style.top = `calc(${y}px - 0.5em)`; + } + destroy() { + super.destroy(); + this.mutationObserver?.disconnect(); + this.ctx.domManager.removeStyles(moduleId2); + this.ctx.domManager.removeChild("canvas-overlay", moduleId2); + } +}; +__decorateClass([ + Property38 +], ContextMenu.prototype, "enabled", 2); +__decorateClass([ + Property38 +], ContextMenu.prototype, "darkTheme", 2); +__decorateClass([ + Property38 +], ContextMenu.prototype, "items", 2); + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenuModule.ts +var ContextMenuModule = { + type: "root", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + optionsKey: "contextMenu", + moduleFactory: (ctx) => new ContextMenu(ctx), + themeTemplate: { + contextMenu: { + enabled: true, + darkTheme: import_ag_charts_community95._ModuleSupport.ThemeSymbols.IS_DARK_THEME + } + } +}; + +// packages/ag-charts-enterprise/src/features/crosshair/crosshair.ts +var import_ag_charts_community97 = require("ag-charts-community"); +var import_ag_charts_core50 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/utils/datum.ts +function readDatum(nodeDatum) { + if (typeof nodeDatum?.datum === "object") { + return nodeDatum.datum; + } + return null; +} + +// packages/ag-charts-enterprise/src/features/crosshair/crosshairLabel.ts +var import_ag_charts_community96 = require("ag-charts-community"); +var import_ag_charts_core49 = require("ag-charts-core"); +var { FormatManager, BaseProperties: BaseProperties13, Property: Property39 } = import_ag_charts_community96._ModuleSupport; +var DEFAULT_LABEL_CLASS = "ag-charts-crosshair-label"; +var CrosshairLabelProperties = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.enabled = true; + this.xOffset = 0; + this.yOffset = 0; + this.format = void 0; + this.renderer = void 0; + this._cachedFormatter = void 0; + } + formatValue(callWithContext2, type, value, params) { + const { formatter, format } = this; + const { domain, boundSeries } = params; + let result; + if (formatter != null) { + const fractionDigits = params.type === "number" ? params.fractionDigits : void 0; + const unit = params.type === "date" ? params.unit : void 0; + const step = params.type === "date" ? params.step : void 0; + result = callWithContext2(formatter, { value, domain, fractionDigits, unit, step, boundSeries }); + } + if (format != null) { + let cachedFormatter = this._cachedFormatter; + if (cachedFormatter == null || cachedFormatter.type !== type || cachedFormatter.format !== format) { + cachedFormatter = { + type, + format, + formatter: FormatManager.getFormatter(type, format) + }; + this._cachedFormatter = cachedFormatter; + } + result ?? (result = cachedFormatter.formatter?.(value)); + } + return result == null ? void 0 : String(result); + } +}; +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "enabled", 2); +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "xOffset", 2); +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "yOffset", 2); +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "formatter", 2); +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "format", 2); +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "renderer", 2); +var CrosshairLabel = class extends CrosshairLabelProperties { + constructor(domManager, key, axisId) { + super(); + this.domManager = domManager; + this.id = (0, import_ag_charts_core49.createId)(this); + this.element = domManager.addChild("canvas-overlay", `crosshair-label-${this.id}`); + this.element.classList.add(DEFAULT_LABEL_CLASS); + (0, import_ag_charts_core49.setAttribute)(this.element, "aria-hidden", true); + this.element.dataset.key = key; + this.element.dataset.axisId = axisId; + } + show(meta) { + const { element } = this; + const left = meta.x + this.xOffset; + const top = meta.y + this.yOffset; + element.style.top = `${Math.round(top)}px`; + element.style.left = `${Math.round(left)}px`; + this.toggle(true); + } + setLabelHtml({ html, styles }) { + if (html !== void 0) { + this.element.innerHTML = html; + } + if (styles !== void 0) { + const styleElement = this.element.children[0] ?? this.element; + Object.assign(styleElement.style, styles); + } + } + getBBox() { + const { element } = this; + return new import_ag_charts_community96._ModuleSupport.BBox( + element.clientLeft, + element.clientTop, + element.clientWidth, + element.clientHeight + ); + } + toggle(visible) { + this.element.classList.toggle(`ag-charts-crosshair-label--hidden`, !visible); + } + destroy() { + this.domManager.removeChild("canvas-overlay", `crosshair-label-${this.id}`); + } + toLabelHtml(input, defaults) { + if (typeof input === "string") { + return { html: input, styles: {} }; + } + defaults = defaults ?? {}; + const { + text: text2 = defaults.text ?? "", + color: color6 = defaults.color, + backgroundColor = defaults.backgroundColor, + opacity = defaults.opacity ?? 1 + } = input; + const styles = { + opacity, + "background-color": backgroundColor?.toLowerCase(), + color: color6 + }; + return { + html: `
+ ${text2} +
`, + styles + }; + } +}; + +// packages/ag-charts-enterprise/src/features/crosshair/crosshair.ts +var { Group: Group5, TranslatableGroup: TranslatableGroup2, Line: Line4, BBox: BBox5, InteractionState: InteractionState4, Property: Property40, ZIndexMap: ZIndexMap5, ChartAxisDirection: ChartAxisDirection11 } = import_ag_charts_community97._ModuleSupport; +var Crosshair = class extends import_ag_charts_community97._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.id = (0, import_ag_charts_core50.createId)(this); + this.enabled = false; + this.stroke = "rgb(195, 195, 195)"; + this.lineDash = [6, 3]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.snap = true; + this.label = new CrosshairLabelProperties(); + this.seriesRect = new BBox5(0, 0, 0, 0); + this.bounds = new BBox5(0, 0, 0, 0); + this.crosshairGroup = new TranslatableGroup2({ + name: "crosshairs", + zIndex: ZIndexMap5.SERIES_CROSSHAIR + }); + this.lineGroup = this.crosshairGroup.appendChild( + new Group5({ + name: `${this.id}-crosshair-lines`, + zIndex: ZIndexMap5.SERIES_CROSSHAIR + }) + ); + this.lineGroupSelection = import_ag_charts_community97._ModuleSupport.Selection.select(this.lineGroup, Line4, false); + this.activeHighlight = void 0; + this.axisCtx = ctx.parent; + this.labels = {}; + this.hideCrosshairs(); + ctx.domManager.addEventListener("focusin", ({ target }) => { + const isSeriesAreaChild = target instanceof HTMLElement && ctx.domManager.contains(target, "series-area"); + if (this.crosshairGroup.visible && !isSeriesAreaChild) { + this.hideCrosshairs(); + this.ctx.updateService.update(import_ag_charts_community97._ModuleSupport.ChartUpdateType.PERFORM_LAYOUT); + } + }); + const { seriesDragInterpreter } = ctx.widgets; + this.cleanup.register( + ctx.scene.attachNode(this.crosshairGroup), + ctx.widgets.seriesWidget.addListener("mousemove", (event) => this.onMouseHoverLike(event)), + ctx.widgets.seriesWidget.addListener("mouseleave", () => this.onMouseOut()), + ctx.eventsHub.on("series:focus-change", () => this.onKeyPress()), + ctx.eventsHub.on("zoom:pan-start", () => this.onMouseOut()), + ctx.eventsHub.on("zoom:change", () => this.onMouseOut()), + ctx.eventsHub.on("highlight:change", (event) => this.onHighlightChange(event)), + ctx.eventsHub.on("layout:complete", (event) => this.layout(event)), + () => { + for (const label of Object.values(this.labels)) { + label.destroy(); + } + } + ); + if (seriesDragInterpreter) { + this.cleanup.register( + seriesDragInterpreter.events.on("drag-move", (event) => this.onMouseHoverLike(event)), + seriesDragInterpreter.events.on("click", (event) => this.onClick(event)) + ); + } + } + layout({ series: { rect, visible }, axes }) { + if (!visible || !axes || !this.enabled) + return; + this.seriesRect = rect; + const { position: axisPosition = "left", axisId } = this.axisCtx; + const axisLayout = axes.find((a) => a.id === axisId); + if (!axisLayout) + return; + this.axisLayout = axisLayout; + this.bounds = rect.clone().grow(axisLayout.gridPadding + axisLayout.seriesAreaPadding, axisPosition); + const { crosshairGroup, bounds } = this; + crosshairGroup.translationX = Math.round(bounds.x); + crosshairGroup.translationY = Math.round(bounds.y); + const crosshairKeys = ["pointer", ...this.axisCtx.seriesKeyProperties()]; + this.updateSelections(crosshairKeys); + this.updateLines(); + this.updateLabels(crosshairKeys); + } + updateSelections(data) { + this.lineGroupSelection.update(data, void 0, (key) => key); + } + updateLabels(keys) { + const { labels, ctx } = this; + for (const key of keys) { + if (this.label.enabled) { + labels[key] ?? (labels[key] = new CrosshairLabel(ctx.domManager, key, this.axisCtx.axisId)); + } + if (labels[key]) { + this.updateLabel(labels[key]); + } + } + } + updateLabel(label) { + const { enabled, xOffset, yOffset, format, renderer } = this.label; + label.enabled = enabled; + label.xOffset = xOffset; + label.yOffset = yOffset; + label.format = format; + label.renderer = renderer; + } + updateLines() { + const { lineGroupSelection, bounds, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset, axisLayout } = this; + if (!axisLayout) + return; + const isVertical = this.isVertical(); + lineGroupSelection.each((line) => { + line.stroke = stroke2; + line.strokeWidth = strokeWidth; + line.strokeOpacity = strokeOpacity; + line.lineDash = lineDash; + line.lineDashOffset = lineDashOffset; + line.y1 = 0; + line.y2 = isVertical ? bounds.height : 0; + line.x1 = 0; + line.x2 = isVertical ? 0 : bounds.width; + }); + } + isVertical() { + return this.axisCtx.direction === ChartAxisDirection11.X; + } + isHover(event) { + return event.type === "mousemove" || event.type === "click" || event.device === "touch" && this.ctx.chartService.touch.dragAction === "hover"; + } + formatValue(value) { + return (0, import_ag_charts_core50.toPlainText)(this.axisCtx.formatScaleValue(value, "crosshair", this.label)); + } + onClick(event) { + if (event.device === "touch") { + this.onMouseHoverLike(event); + } + } + onMouseHoverLike(event) { + if (!this.enabled || this.snap) + return; + const requiredState = this.isHover(event) ? InteractionState4.Clickable : InteractionState4.AnnotationsMoveable; + if (!this.ctx.interactionManager.isState(requiredState)) + return; + this.updatePositions(this.getData(event)); + this.crosshairGroup.visible = true; + this.ctx.updateService.update(import_ag_charts_community97._ModuleSupport.ChartUpdateType.SCENE_RENDER); + } + onMouseOut() { + if (!this.ctx.interactionManager.isState(InteractionState4.Clickable)) + return; + this.hideCrosshairs(); + this.ctx.updateService.update(import_ag_charts_community97._ModuleSupport.ChartUpdateType.SCENE_RENDER); + } + onKeyPress() { + if (this.enabled && !this.snap && this.ctx.interactionManager.isState(InteractionState4.Default)) { + this.hideCrosshairs(); + } + } + onHighlightChange(event) { + if (!this.enabled) + return; + const { crosshairGroup, axisCtx } = this; + const { datum, series } = event.currentHighlight ?? {}; + const hasCrosshair = datum && (series?.axes.x?.id === axisCtx.axisId || series?.axes.y?.id === axisCtx.axisId); + this.activeHighlight = hasCrosshair ? event.currentHighlight : void 0; + if (!this.activeHighlight) { + this.hideCrosshairs(); + } else if (this.snap) { + const activeHighlightData = this.getActiveHighlightData(this.activeHighlight); + this.updatePositions(activeHighlightData); + crosshairGroup.visible = true; + } + } + isInRange(value) { + return this.axisCtx.inRange(value); + } + updatePositions(data) { + const { seriesRect, lineGroupSelection } = this; + lineGroupSelection.each((line, key) => { + const lineData = data[key]; + if (!lineData) { + line.visible = false; + this.hideLabel(key); + return; + } + line.visible = true; + const { value, position } = lineData; + let x = 0; + let y = 0; + if (this.isVertical()) { + x = position; + line.x = Math.round(x); + } else { + y = position; + line.y = Math.round(y); + } + if (this.label.enabled) { + this.showLabel(x + seriesRect.x, y + seriesRect.y, value, key); + } else { + this.hideLabel(key); + } + }); + } + getData(event) { + const { axisCtx } = this; + const key = "pointer"; + const { xKey = "", yKey = "" } = this.activeHighlight ?? {}; + const { currentX, currentY } = event; + const datum = readDatum(this.activeHighlight); + const isVertical = this.isVertical(); + const position = isVertical ? currentX : currentY; + let value = datum?.[isVertical ? xKey : yKey] ?? ""; + if (axisCtx.continuous) { + value = axisCtx.scaleInvert(position); + } + return { [key]: { position, value } }; + } + getActiveHighlightData(activeHighlight) { + const { axisCtx } = this; + const { series, xKey = "", aggregatedValue, cumulativeValue, midPoint } = activeHighlight; + const datum = readDatum(activeHighlight); + const seriesKeyProperties = series.getKeyProperties(axisCtx.direction); + const halfBandwidth = (axisCtx.scale.bandwidth ?? 0) / 2; + const matchingAxisId = series.axes[axisCtx.direction]?.id === axisCtx.axisId; + const isYKey = seriesKeyProperties.includes("yKey") && matchingAxisId; + const isXKey = seriesKeyProperties.includes("xKey") && matchingAxisId; + const datumValue = aggregatedValue ?? cumulativeValue; + if (isYKey && datumValue !== void 0) { + const position = axisCtx.scale.convert(datumValue) + halfBandwidth; + const isInRange = this.isInRange(position); + return isInRange ? { + yKey: { value: datumValue, position } + } : {}; + } + if (isXKey) { + const position = (this.isVertical() ? midPoint?.x : midPoint?.y) ?? 0; + const value = axisCtx.continuous ? axisCtx.scaleInvert(position) : datum?.[xKey]; + return this.isInRange(position) ? { xKey: { value, position } } : {}; + } + const activeHighlightData = {}; + for (const key of seriesKeyProperties) { + const keyValue = series.properties[key]; + const value = datum?.[keyValue]; + const position = axisCtx.scale.convert(value) + halfBandwidth; + const isInRange = this.isInRange(position); + if (isInRange) { + activeHighlightData[key] = { value, position }; + } + } + return activeHighlightData; + } + getLabelHtml(value, label) { + const fractionDigits = this.axisLayout?.label?.fractionDigits ?? 0; + const defaults = { text: this.formatValue(value) }; + if (this.label.renderer) { + return label.toLabelHtml(this.label.renderer({ value, fractionDigits }), defaults); + } + return label.toLabelHtml(defaults); + } + showLabel(x, y, value, key) { + if (!this.axisLayout) + return; + const { bounds } = this; + const label = this.labels[key]; + const html = this.getLabelHtml(value, label); + label.setLabelHtml(html); + const { width, height } = label.getBBox(); + const axisPosition = this.axisCtx.position; + let padding = this.axisLayout.label.spacing + this.axisLayout.tickSize; + if (this.axisCtx.direction === ChartAxisDirection11.X) { + padding -= 4; + label.show({ + x: x - width / 2, + y: axisPosition === "bottom" ? bounds.y + bounds.height + padding : bounds.y - height - padding + }); + } else { + padding -= 8; + label.show({ + x: axisPosition === "right" ? bounds.x + bounds.width + padding : bounds.x - width - padding, + y: y - height / 2 + }); + } + } + hideCrosshairs() { + this.crosshairGroup.visible = false; + for (const key of Object.keys(this.labels)) { + this.hideLabel(key); + } + } + hideLabel(key) { + this.labels[key]?.toggle(false); + } +}; +__decorateClass([ + Property40 +], Crosshair.prototype, "enabled", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "stroke", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "lineDash", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "lineDashOffset", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "strokeWidth", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "strokeOpacity", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "snap", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "label", 2); + +// packages/ag-charts-enterprise/src/features/crosshair/crosshairModule.ts +var CrosshairModule = { + type: "axis-option", + optionsKey: "crosshair", + packageType: "enterprise", + chartTypes: ["cartesian"], + axisTypes: ["category", "time", "unit-time", "ordinal-time", "number", "log"], + moduleFactory: (ctx) => new Crosshair(ctx), + themeTemplate: { + crosshair: { + snap: true, + stroke: { $ref: "subtleTextColor" }, + strokeWidth: 1, + strokeOpacity: 1, + lineDash: [5, 6], + lineDashOffset: 0, + label: { + enabled: true + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/data-source/dataSource.ts +var import_ag_charts_community98 = require("ag-charts-community"); +var { ActionOnSet: ActionOnSet5, Property: Property41 } = import_ag_charts_community98._ModuleSupport; +var DataSource = class extends import_ag_charts_community98._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.enabled = false; + this.getData = () => Promise.resolve(); + this.dataService = ctx.dataService; + } + updateCallback(enabled, getData) { + if (!this.dataService) + return; + if (enabled && getData != null) { + this.dataService.updateCallback(getData); + } else { + this.dataService.clearCallback(); + } + } +}; +__decorateClass([ + ActionOnSet5({ + newValue(enabled) { + this.updateCallback(enabled, this.getData); + } + }), + Property41 +], DataSource.prototype, "enabled", 2); +__decorateClass([ + ActionOnSet5({ + newValue(getData) { + this.updateCallback(this.enabled, getData); + } + }), + Property41 +], DataSource.prototype, "getData", 2); +__decorateClass([ + ActionOnSet5({ + newValue(requestThrottle) { + this.dataService.requestThrottle = requestThrottle; + } + }) +], DataSource.prototype, "requestThrottle", 2); +__decorateClass([ + ActionOnSet5({ + newValue(updateThrottle) { + this.dataService.dispatchThrottle = updateThrottle; + } + }) +], DataSource.prototype, "updateThrottle", 2); +__decorateClass([ + ActionOnSet5({ + newValue(updateDuringInteraction) { + this.dataService.dispatchOnlyLatest = !updateDuringInteraction; + } + }) +], DataSource.prototype, "updateDuringInteraction", 2); + +// packages/ag-charts-enterprise/src/features/data-source/dataSourceModule.ts +var DataSourceModule = { + type: "root", + optionsKey: "dataSource", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new DataSource(ctx), + themeTemplate: { + dataSource: { enabled: false } + } +}; + +// packages/ag-charts-enterprise/src/features/error-bar/errorBarModule.ts +var import_ag_charts_community102 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/error-bar/errorBar.ts +var import_ag_charts_community101 = require("ag-charts-community"); +var import_ag_charts_core51 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/error-bar/errorBarNode.ts +var import_ag_charts_community99 = require("ag-charts-community"); +var { nearestSquared, nearestSquaredInContainer, partialAssign, mergeDefaults, BBox: BBox6 } = import_ag_charts_community99._ModuleSupport; +var HierarchicalBBox = class { + constructor(components) { + this.components = components; + this.union = BBox6.merge(components); + } + containsPoint(x, y) { + if (!this.union.containsPoint(x, y)) { + return false; + } + for (const bbox of this.components) { + if (bbox.containsPoint(x, y)) { + return true; + } + } + return false; + } +}; +var ErrorBarNode = class extends import_ag_charts_community99._ModuleSupport.Group { + constructor() { + super(); + this.capLength = Number.NaN; + this._datum = void 0; + this.whiskerPath = new import_ag_charts_community99._ModuleSupport.Path(); + this.capsPath = new import_ag_charts_community99._ModuleSupport.Path(); + this.bboxes = new HierarchicalBBox([]); + this.append([this.whiskerPath, this.capsPath]); + } + get datum() { + return this._datum; + } + set datum(datum) { + this._datum = datum; + } + calculateCapLength(capsTheme, capDefaults) { + const { lengthRatio = 1, length } = capsTheme; + const { lengthRatioMultiplier, lengthMax } = capDefaults; + const desiredLength = length ?? lengthRatio * lengthRatioMultiplier; + return Math.min(desiredLength, lengthMax); + } + getItemStylerParams(options, style, highlighted, highlightState) { + const { datum } = this; + if (datum == null || options.itemStyler == null) + return; + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = options; + return { + ...style, + datum: datum.datum, + seriesId: datum.series.id, + xKey: datum.xKey, + yKey: datum.yKey, + xLowerKey, + xUpperKey, + yLowerKey, + yUpperKey, + highlighted, + highlightState + }; + } + formatStyles(style, options, caller, highlighted, highlightState) { + let { cap: capsStyle, ...whiskerStyle } = style; + const params = this.getItemStylerParams(options, style, highlighted, highlightState); + if (params != null && options.itemStyler != null) { + const result = caller.callWithContext(options.itemStyler, params); + whiskerStyle = mergeDefaults(result, whiskerStyle); + capsStyle = mergeDefaults(result?.cap, result, capsStyle); + } + return { whiskerStyle, capsStyle }; + } + applyStyling(target, source) { + partialAssign( + ["visible", "stroke", "strokeWidth", "strokeOpacity", "lineDash", "lineDashOffset"], + target, + source + ); + } + update(style, formatters, caller, highlighted, highlightState) { + if (this.datum === void 0) { + return; + } + const { whiskerStyle, capsStyle } = this.formatStyles(style, formatters, caller, highlighted, highlightState); + const { xBar, yBar, capDefaults } = this.datum; + const whisker = this.whiskerPath; + this.applyStyling(whisker, whiskerStyle); + whisker.path.clear(true); + if (yBar !== void 0) { + whisker.path.moveTo(yBar.lowerPoint.x, yBar.lowerPoint.y); + whisker.path.lineTo(yBar.upperPoint.x, yBar.upperPoint.y); + } + if (xBar !== void 0) { + whisker.path.moveTo(xBar.lowerPoint.x, xBar.lowerPoint.y); + whisker.path.lineTo(xBar.upperPoint.x, xBar.upperPoint.y); + } + whisker.path.closePath(); + this.capLength = this.calculateCapLength(capsStyle ?? {}, capDefaults); + const capOffset = this.capLength / 2; + const caps = this.capsPath; + this.applyStyling(caps, capsStyle); + caps.path.clear(true); + if (yBar !== void 0) { + caps.path.moveTo(yBar.lowerPoint.x - capOffset, yBar.lowerPoint.y); + caps.path.lineTo(yBar.lowerPoint.x + capOffset, yBar.lowerPoint.y); + caps.path.moveTo(yBar.upperPoint.x - capOffset, yBar.upperPoint.y); + caps.path.lineTo(yBar.upperPoint.x + capOffset, yBar.upperPoint.y); + } + if (xBar !== void 0) { + caps.path.moveTo(xBar.lowerPoint.x, xBar.lowerPoint.y - capOffset); + caps.path.lineTo(xBar.lowerPoint.x, xBar.lowerPoint.y + capOffset); + caps.path.moveTo(xBar.upperPoint.x, xBar.upperPoint.y - capOffset); + caps.path.lineTo(xBar.upperPoint.x, xBar.upperPoint.y + capOffset); + } + caps.path.closePath(); + } + updateBBoxes() { + const { capLength, whiskerPath: whisker, capsPath: caps } = this; + const { yBar, xBar } = this.datum ?? {}; + const capOffset = capLength / 2; + const components = []; + if (yBar !== void 0) { + const whiskerHeight = yBar.lowerPoint.y - yBar.upperPoint.y; + components.push( + new BBox6(yBar.lowerPoint.x, yBar.upperPoint.y, whisker.strokeWidth, whiskerHeight), + new BBox6(yBar.lowerPoint.x - capOffset, yBar.lowerPoint.y, capLength, caps.strokeWidth), + new BBox6(yBar.upperPoint.x - capOffset, yBar.upperPoint.y, capLength, caps.strokeWidth) + ); + } + if (xBar !== void 0) { + const whiskerWidth = xBar.upperPoint.x - xBar.lowerPoint.x; + components.push( + new BBox6(xBar.lowerPoint.x, xBar.upperPoint.y, whiskerWidth, whisker.strokeWidth), + new BBox6(xBar.lowerPoint.x, xBar.lowerPoint.y - capOffset, caps.strokeWidth, capLength), + new BBox6(xBar.upperPoint.x, xBar.upperPoint.y - capOffset, caps.strokeWidth, capLength) + ); + } + this.bboxes.components = components; + this.bboxes.union = BBox6.merge(components); + } + containsPoint(x, y) { + return this.bboxes.containsPoint(x, y); + } + pickNode(x, y) { + return this.containsPoint(x, y) ? this : void 0; + } + nearestSquared(x, y, maxDistance) { + const { bboxes } = this; + if (bboxes.union.distanceSquared(x, y) > maxDistance) { + return { nearest: void 0, distanceSquared: Infinity }; + } + const { distanceSquared } = nearestSquared(x, y, bboxes.components); + return { nearest: this, distanceSquared }; + } +}; +var ErrorBarGroup = class extends import_ag_charts_community99._ModuleSupport.Group { + nearestSquared(x, y) { + const { nearest, distanceSquared } = nearestSquaredInContainer(x, y, { + children: this.children() + }); + if (nearest !== void 0 && !Number.isNaN(distanceSquared)) { + return { datum: nearest.datum, distanceSquared }; + } + } +}; + +// packages/ag-charts-enterprise/src/features/error-bar/errorBarProperties.ts +var import_ag_charts_community100 = require("ag-charts-community"); +var { BaseProperties: BaseProperties14, Property: Property42 } = import_ag_charts_community100._ModuleSupport; +var ErrorBarCap = class extends BaseProperties14 { +}; +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "visible", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "stroke", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "strokeWidth", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "strokeOpacity", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "lineDash", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "lineDashOffset", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "length", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "lengthRatio", 2); +var ErrorBarProperties = class extends BaseProperties14 { + constructor() { + super(...arguments); + this.visible = true; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cap = new ErrorBarCap(); + } +}; +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "yLowerKey", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "yLowerName", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "yUpperKey", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "yUpperName", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "xLowerKey", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "xLowerName", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "xUpperKey", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "xUpperName", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "visible", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "cap", 2); + +// packages/ag-charts-enterprise/src/features/error-bar/errorBar.ts +var { fixNumericExtent, groupAccumulativeValueProperty, mergeDefaults: mergeDefaults2, valueProperty: valueProperty2, ChartAxisDirection: ChartAxisDirection12 } = import_ag_charts_community101._ModuleSupport; +function toErrorBoundCartesianSeries(ctx) { + for (const supportedType of import_ag_charts_community101.AgErrorBarSupportedSeriesTypes) { + if (supportedType === ctx.series.type) { + return ctx.series; + } + } + throw new Error( + `AG Charts - unsupported series type '${ctx.series.type}', error bars supported series types: ${import_ag_charts_community101.AgErrorBarSupportedSeriesTypes.join(", ")}` + ); +} +var ErrorBars = class _ErrorBars extends import_ag_charts_community101._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.properties = new ErrorBarProperties(); + const series = toErrorBoundCartesianSeries(ctx); + const { annotationGroup, annotationSelections } = series; + this.cartesianSeries = series; + this.groupNode = new ErrorBarGroup({ + name: `${annotationGroup.id}-errorBars` + }); + annotationGroup.appendChild(this.groupNode); + this.selection = import_ag_charts_community101._ModuleSupport.Selection.select(this.groupNode, () => this.errorBarFactory()); + annotationSelections.add(this.selection); + series.addEventListener("seriesVisibilityChange", (e) => this.onToggleSeriesItem(e)); + this.cleanup.register( + series.events.on("data-processed", (e) => this.onDataProcessed(e)), + series.events.on("data-update", (e) => this.onDataUpdate(e)), + ctx.eventsHub.on("highlight:change", (event) => this.onHighlightChange(event)), + () => this.groupNode.remove(), + () => annotationSelections.delete(this.selection) + ); + } + hasErrorBars() { + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = this.properties; + return (0, import_ag_charts_core51.isDefined)(xLowerKey) && (0, import_ag_charts_core51.isDefined)(xUpperKey) || (0, import_ag_charts_core51.isDefined)(yLowerKey) && (0, import_ag_charts_core51.isDefined)(yUpperKey); + } + isStacked() { + const stackCount = this.cartesianSeries.seriesGrouping?.stackCount; + return stackCount == null ? false : stackCount > 0; + } + getUnstackPropertyDefinition(opts) { + const props = []; + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey, xErrorsID, yErrorsID } = this.getMaybeFlippedKeys(); + const { xScaleType, yScaleType } = opts; + if (yLowerKey != null && yUpperKey != null) { + props.push( + valueProperty2(yLowerKey, yScaleType, { id: `${yErrorsID}-lower` }), + valueProperty2(yUpperKey, yScaleType, { id: `${yErrorsID}-upper` }) + ); + } + if (xLowerKey != null && xUpperKey != null) { + props.push( + valueProperty2(xLowerKey, xScaleType, { id: `${xErrorsID}-lower` }), + valueProperty2(xUpperKey, xScaleType, { id: `${xErrorsID}-upper` }) + ); + } + return props; + } + getStackPropertyDefinition(opts) { + const props = []; + const { cartesianSeries } = this; + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey, xErrorsID, yErrorsID } = this.getMaybeFlippedKeys(); + const { xScaleType, yScaleType } = opts; + const groupIndex = cartesianSeries.seriesGrouping?.groupIndex ?? cartesianSeries.id; + const groupOpts = { + invalidValue: null, + missingValue: 0, + separateNegative: true, + ...cartesianSeries.visible ? {} : { forceValue: 0 } + }; + const makeErrorProperty = (key, id, type, scaleType) => { + return groupAccumulativeValueProperty( + key, + "normal", + { + id: `${id}-${type}`, + groupId: `errorGroup-${groupIndex}-${type}`, + ...groupOpts + }, + scaleType + ); + }; + const pushErrorProperties = (lowerKey, upperKey, id, scaleType) => { + props.push( + ...makeErrorProperty(lowerKey, id, "lower", scaleType), + ...makeErrorProperty(upperKey, id, "upper", scaleType) + ); + }; + if (yLowerKey != null && yUpperKey != null) { + pushErrorProperties(yLowerKey, yUpperKey, yErrorsID, yScaleType); + } + if (xLowerKey != null && xUpperKey != null) { + pushErrorProperties(xLowerKey, xUpperKey, xErrorsID, xScaleType); + } + return props; + } + getPropertyDefinitions(opts) { + if (this.isStacked()) { + return this.getStackPropertyDefinition(opts); + } else { + return this.getUnstackPropertyDefinition(opts); + } + } + onDataProcessed(event) { + this.dataModel = event.dataModel; + this.processedData = event.processedData; + } + getDomain(direction) { + const { xLowerKey, xUpperKey, xErrorsID, yLowerKey, yUpperKey, yErrorsID } = this.getMaybeFlippedKeys(); + const hasAxisErrors = direction === ChartAxisDirection12.X ? (0, import_ag_charts_core51.isDefined)(xLowerKey) && (0, import_ag_charts_core51.isDefined)(xUpperKey) : (0, import_ag_charts_core51.isDefined)(yLowerKey) && (0, import_ag_charts_core51.isDefined)(yUpperKey); + if (hasAxisErrors) { + const { dataModel, processedData, cartesianSeries: series } = this; + if (dataModel != null && processedData != null) { + const id = { x: xErrorsID, y: yErrorsID }[direction]; + const lowerDomain = dataModel.getDomain(series, `${id}-lower`, "value", processedData); + const upperDomain = dataModel.getDomain(series, `${id}-upper`, "value", processedData); + const domain = [Math.min(...lowerDomain, ...upperDomain), Math.max(...lowerDomain, ...upperDomain)]; + return fixNumericExtent(domain); + } + } + return []; + } + onDataUpdate(event) { + this.dataModel = event.dataModel; + this.processedData = event.processedData; + if ((0, import_ag_charts_core51.isDefined)(event.dataModel) && (0, import_ag_charts_core51.isDefined)(event.processedData)) { + this.createNodeData(); + this.update(); + } + } + getNodeData() { + return this.hasErrorBars() ? this.cartesianSeries.contextNodeData?.nodeData : void 0; + } + createNodeData() { + const nodeData = this.getNodeData(); + const xScale = this.cartesianSeries.axes[ChartAxisDirection12.X]?.scale; + const yScale = this.cartesianSeries.axes[ChartAxisDirection12.Y]?.scale; + if (!xScale || !yScale || !nodeData) { + return; + } + for (let i = 0; i < nodeData.length; i++) { + const { midPoint, xLower, xUpper, yLower, yUpper } = this.getDatum(nodeData, i); + if (midPoint != null) { + let xBar, yBar; + if ((0, import_ag_charts_core51.isDefined)(xLower) && (0, import_ag_charts_core51.isDefined)(xUpper)) { + xBar = { + lowerPoint: { x: this.convert(xScale, xLower), y: midPoint.y }, + upperPoint: { x: this.convert(xScale, xUpper), y: midPoint.y } + }; + } + if ((0, import_ag_charts_core51.isDefined)(yLower) && (0, import_ag_charts_core51.isDefined)(yUpper)) { + yBar = { + lowerPoint: { x: midPoint.x, y: this.convert(yScale, yLower) }, + upperPoint: { x: midPoint.x, y: this.convert(yScale, yUpper) } + }; + } + nodeData[i].xBar = xBar; + nodeData[i].yBar = yBar; + } + } + } + getMaybeFlippedKeys() { + let { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = this.properties; + let [xErrorsID, yErrorsID] = ["xValue-errors", "yValue-errors"]; + if (this.cartesianSeries.shouldFlipXY()) { + [xLowerKey, yLowerKey] = [yLowerKey, xLowerKey]; + [xUpperKey, yUpperKey] = [yUpperKey, xUpperKey]; + [xErrorsID, yErrorsID] = [yErrorsID, xErrorsID]; + } + return { xLowerKey, xUpperKey, xErrorsID, yLowerKey, yUpperKey, yErrorsID }; + } + static getDatumKey(nodeDatum, key, offset) { + if (key == null) { + return; + } + const datum = readDatum(nodeDatum); + const value = datum?.[key]; + if (value == null) { + return; + } + if (typeof value !== "number") { + import_ag_charts_core51.Logger.warnOnce(`Found [${key}] error value of type ${typeof value}. Expected number type`); + return; + } + return value + offset; + } + getDatum(nodeData, datumIndex) { + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = this.getMaybeFlippedKeys(); + const datum = nodeData[datumIndex]; + const d = datum.cumulativeValue == null || !this.isStacked() ? 0 : datum.cumulativeValue - datum.yValue; + const [xOffset, yOffset] = this.cartesianSeries.shouldFlipXY() ? [d, 0] : [0, d]; + return { + midPoint: datum.midPoint, + xLower: _ErrorBars.getDatumKey(datum, xLowerKey, xOffset), + xUpper: _ErrorBars.getDatumKey(datum, xUpperKey, xOffset), + yLower: _ErrorBars.getDatumKey(datum, yLowerKey, yOffset), + yUpper: _ErrorBars.getDatumKey(datum, yUpperKey, yOffset) + }; + } + convert(scale, value) { + const offset = (scale.bandwidth ?? 0) / 2; + return scale.convert(value) + offset; + } + update() { + const nodeData = this.getNodeData(); + if (nodeData != null) { + this.selection.update(nodeData); + this.selection.each((node, datum, i) => this.updateNode(node, datum, i)); + } + } + updateNode(node, datum, _index) { + node.datum = datum; + node.update(this.getDefaultStyle(), this.properties, this.cartesianSeries, false, "none"); + node.updateBBoxes(); + } + pickNodeExact(point) { + const { x, y } = point; + const node = this.groupNode.pickNode(x, y); + if (node != null) { + return { datum: node.datum, distanceSquared: 0 }; + } + } + pickNodeNearest(point) { + return this.groupNode.nearestSquared(point.x, point.y); + } + pickNodeMainAxisFirst(point, majorDirection) { + let closestDatum; + let closestDistance = [Infinity, Infinity]; + const referencePoints = [point.x, point.y]; + if (majorDirection === ChartAxisDirection12.Y) { + referencePoints.reverse(); + } + for (const child of this.groupNode.children()) { + const childBBox = child.getBBox(); + const childReferencePoints = [childBBox.x + childBBox.width / 2, childBBox.y + childBBox.height / 2]; + if (majorDirection === ChartAxisDirection12.Y) { + childReferencePoints.reverse(); + } + const childDistances = []; + for (let i = 0; i < referencePoints.length; i++) { + childDistances.push(Math.abs(referencePoints[i] - childReferencePoints[i])); + } + if (childDistances[0] < closestDistance[0] || childDistances[0] == closestDistance[0] && childDistances[1] < closestDistance[1]) { + closestDatum = child.datum; + closestDistance = childDistances; + } + } + if (closestDatum) { + return { + datum: closestDatum, + distanceSquared: Math.pow(closestDistance[0], 2) + Math.pow(closestDistance[1], 2) + }; + } + } + getTooltipParams() { + const { + xLowerKey, + xUpperKey, + yLowerKey, + yUpperKey, + xLowerName = xLowerKey, + xUpperName = xUpperKey, + yLowerName = yLowerKey, + yUpperName = yUpperKey + } = this.properties; + return { xLowerKey, xLowerName, xUpperKey, xUpperName, yLowerKey, yLowerName, yUpperKey, yUpperName }; + } + onToggleSeriesItem(event) { + this.groupNode.visible = event.visible; + } + makeStyle(baseStyle) { + return { + visible: baseStyle.visible, + lineDash: baseStyle.lineDash, + lineDashOffset: baseStyle.lineDashOffset, + stroke: baseStyle.stroke, + strokeWidth: baseStyle.strokeWidth, + strokeOpacity: baseStyle.strokeOpacity, + cap: mergeDefaults2(this.properties.cap, baseStyle) + }; + } + getDefaultStyle() { + return this.makeStyle(this.getWhiskerProperties()); + } + getHighlightStyle() { + return this.makeStyle(this.getWhiskerProperties()); + } + restyleHighlightChange(highlightChange, style, highlighted) { + const nodeData = this.getNodeData(); + if (nodeData == null) + return; + for (let i = 0; i < nodeData.length; i++) { + if (highlightChange === nodeData[i]) { + this.selection.at(i)?.update( + style, + this.properties, + this.cartesianSeries, + highlighted, + highlighted ? "highlighted-item" : "unhighlighted-item" + ); + break; + } + } + } + onHighlightChange(event) { + const { previousHighlight, currentHighlight } = event; + if (currentHighlight?.series === this.cartesianSeries) { + this.restyleHighlightChange(currentHighlight, this.getHighlightStyle(), true); + } + if (previousHighlight?.series === this.cartesianSeries) { + this.restyleHighlightChange(previousHighlight, this.getDefaultStyle(), false); + } + this.groupNode.opacity = this.cartesianSeries.getOpacity(); + } + errorBarFactory() { + return new ErrorBarNode(); + } + getWhiskerProperties() { + const { stroke: stroke2, strokeWidth, visible, strokeOpacity, lineDash, lineDashOffset } = this.properties; + return { stroke: stroke2, strokeWidth, visible, strokeOpacity, lineDash, lineDashOffset }; + } +}; + +// packages/ag-charts-enterprise/src/features/error-bar/errorBarTheme.ts +var ERROR_BARS_THEME = { + series: { + errorBar: { + visible: true, + stroke: { $ref: "foregroundColor" }, + strokeWidth: 1, + strokeOpacity: 1, + cap: { + length: void 0, + lengthRatio: void 0 + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/error-bar/errorBarModule.ts +var ErrorBarsModule = { + type: "series-option", + identifier: "error-bars", + optionsKey: "errorBar", + packageType: "enterprise", + chartTypes: ["cartesian"], + seriesTypes: import_ag_charts_community102.AgErrorBarSupportedSeriesTypes, + moduleFactory: (ctx) => new ErrorBars(ctx), + themeTemplate: ERROR_BARS_THEME +}; + +// packages/ag-charts-enterprise/src/features/foreground/foreground.ts +var import_ag_charts_community103 = require("ag-charts-community"); +var { ZIndexMap: ZIndexMap6, ActionOnSet: ActionOnSet6, Property: Property43, ProxyPropertyOnWrite: ProxyPropertyOnWrite2 } = import_ag_charts_community103._ModuleSupport; +var Foreground = class extends import_ag_charts_community103._ModuleSupport.Background { + constructor() { + super(...arguments); + this.image = new Image(); + this.fill = "transparent"; + this.fillOpacity = void 0; + } + createNode() { + return new import_ag_charts_community103._ModuleSupport.Group({ name: "foreground", zIndex: ZIndexMap6.FOREGROUND }); + } + onLayoutComplete(event) { + super.onLayoutComplete(event); + const { width, height } = event.chart; + let placement = { + x: 0, + y: 0, + width, + height + }; + if (this.image) { + placement = this.image.performLayout(width, height); + } + if (this.text) { + this.updateTextNode(placement); + } + } + onImageLoad() { + this.ctx.updateService.update(import_ag_charts_community103._ModuleSupport.ChartUpdateType.SCENE_RENDER); + } + updateTextNode(placement) { + const { textNode } = this; + textNode.fontWeight = "bold"; + textNode.fontFamily = "Impact, sans-serif"; + textNode.fontSize = 19; + textNode.opacity = 0.7; + textNode.fill = "#9b9b9b"; + textNode.textBaseline = "top"; + const textBBox = this.textNode.getBBox(); + const textPadding = 10; + textNode.x = placement.x + placement.width / 2 - textBBox.width / 2; + textNode.y = placement.y + placement.height + textPadding; + } +}; +__decorateClass([ + Property43, + ActionOnSet6({ + newValue(image) { + this.node.appendChild(image.node); + image.onLoad = () => this.onImageLoad(); + }, + oldValue(image) { + image.node.remove(); + image.onLoad = void 0; + } + }) +], Foreground.prototype, "image", 2); +__decorateClass([ + Property43, + ProxyPropertyOnWrite2("rectNode", "fill") +], Foreground.prototype, "fill", 2); +__decorateClass([ + Property43, + ProxyPropertyOnWrite2("rectNode", "fillOpacity") +], Foreground.prototype, "fillOpacity", 2); + +// packages/ag-charts-enterprise/src/features/foreground/foregroundModule.ts +var ForegroundModule = { + type: "root", + optionsKey: "foreground", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Foreground(ctx) +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigator.ts +var import_ag_charts_community110 = require("ag-charts-community"); +var import_ag_charts_core54 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/navigator/miniChart.ts +var import_ag_charts_community105 = require("ag-charts-community"); +var import_ag_charts_core52 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/navigator/shapes/miniChartGroup.ts +var import_ag_charts_community104 = require("ag-charts-community"); +var { TranslatableGroup: TranslatableGroup3, SceneChangeDetection } = import_ag_charts_community104._ModuleSupport; +var MiniChartGroup = class extends TranslatableGroup3 { + constructor() { + super(...arguments); + this.inset = 0; + this.cornerRadius = 0; + } + applyClip(ctx, clipRect) { + const { cornerRadius, inset } = this; + const { x, y, width, height } = clipRect; + const path = new Path2D(); + path.roundRect(x + inset, y + inset, width - 2 * inset, height - 2 * inset, cornerRadius); + ctx.clip(path); + } +}; +__decorateClass([ + SceneChangeDetection() +], MiniChartGroup.prototype, "inset", 2); +__decorateClass([ + SceneChangeDetection() +], MiniChartGroup.prototype, "cornerRadius", 2); + +// packages/ag-charts-enterprise/src/features/navigator/miniChart.ts +var { Property: Property44, ZIndexMap: ZIndexMap7, ActionOnSet: ActionOnSet7, CategoryAxis, Padding, Group: Group6, BBox: BBox7, ProxyProperty: ProxyProperty2, stackCartesianSeries } = import_ag_charts_community105._ModuleSupport; +var MiniChartPadding = class { + constructor() { + this.top = 0; + this.bottom = 0; + } +}; +__decorateClass([ + Property44 +], MiniChartPadding.prototype, "top", 2); +__decorateClass([ + Property44 +], MiniChartPadding.prototype, "bottom", 2); +var MiniChart = class extends import_ag_charts_community105._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.padding = new MiniChartPadding(); + this.root = new Group6({ name: "root" }); + this.seriesRoot = this.root.appendChild( + new MiniChartGroup({ name: "Series-root", zIndex: ZIndexMap7.SERIES_LAYER, renderToOffscreenCanvas: true }) + ); + this.axisGridGroup = this.root.appendChild(new Group6({ name: "Axes-Grids", zIndex: ZIndexMap7.AXIS_GRID })); + this.axisGroup = this.root.appendChild(new Group6({ name: "Axes-Grids", zIndex: ZIndexMap7.AXIS_GRID })); + this.axisLabelGroup = this.root.appendChild(new Group6({ name: "Axes-Labels", zIndex: ZIndexMap7.SERIES_LABEL })); + this.axisCrosslineRangeGroup = this.root.appendChild( + new Group6({ name: "Axes-Crosslines-Range", zIndex: ZIndexMap7.SERIES_CROSSLINE_RANGE }) + ); + this.axisCrosslineLineGroup = this.root.appendChild( + new Group6({ name: "Axes-Crosslines-Line", zIndex: ZIndexMap7.SERIES_CROSSLINE_LINE }) + ); + this.axisCrosslineLabelGroup = this.root.appendChild( + new Group6({ name: "Axes-Crosslines-Label", zIndex: ZIndexMap7.SERIES_LABEL }) + ); + this.data = []; + this._destroyed = false; + this.miniChartAnimationPhase = "initial"; + // Should be available after the first layout. + this.seriesRect = void 0; + this.axes = []; + this.series = []; + } + destroy() { + if (this._destroyed) { + return; + } + this.destroySeries(this.series); + for (const a of this.axes) { + a.destroy(); + } + this.axes = []; + this._destroyed = true; + } + onSeriesChange(newValue, oldValue) { + const seriesToDestroy = oldValue?.filter((series) => !newValue.includes(series)) ?? []; + this.destroySeries(seriesToDestroy); + for (const series of newValue) { + if (oldValue?.includes(series)) + continue; + series.attachSeries(this.seriesRoot, this.seriesRoot, void 0); + series.chart = {}; + Object.defineProperty(series.chart, "mode", { + get: () => "standalone" + }); + Object.defineProperty(series.chart, "isMiniChart", { + get: () => true + }); + Object.defineProperty(series.chart, "seriesRect", { + get: () => this.seriesRect + }); + series.resetAnimation(this.miniChartAnimationPhase === "initial" ? "initial" : "disabled"); + } + this.seriesRect = void 0; + } + destroySeries(allSeries) { + if (allSeries) { + for (const series of allSeries) { + series.destroy(); + series.detachSeries(this.seriesRoot, this.seriesRoot, void 0); + series.chart = void 0; + } + } + } + assignSeriesToAxes() { + for (const axis of this.axes) { + axis.boundSeries = this.series.filter((s) => { + const seriesAxis = s.axes[axis.direction]; + return seriesAxis === axis; + }); + } + } + assignAxesToSeries() { + const directionToAxesMap = {}; + for (const axis of this.axes) { + const direction = axis.direction; + const directionAxes = directionToAxesMap[direction] ?? (directionToAxesMap[direction] = []); + directionAxes.push(axis); + } + for (const series of this.series) { + for (const direction of series.directions) { + const directionAxes = directionToAxesMap[direction]; + if (!directionAxes) { + import_ag_charts_core52.Logger.warnOnce( + `no available axis for direction [${direction}]; check series and axes configuration.` + ); + continue; + } + const seriesKeys = series.getKeys(direction); + const newAxis = this.findMatchingAxis(directionAxes, seriesKeys); + if (!newAxis) { + import_ag_charts_core52.Logger.warnOnce( + `no matching axis for direction [${direction}] and keys [${seriesKeys}]; check series and axes configuration.` + ); + continue; + } + series.axes[direction] = newAxis; + } + } + } + findMatchingAxis(directionAxes, directionKeys) { + for (const axis of directionAxes) { + if (!axis.keys.length) { + return axis; + } + if (!directionKeys) { + continue; + } + for (const directionKey of directionKeys) { + if (axis.keys.includes(directionKey)) { + return axis; + } + } + } + } + updateData(data) { + for (const s of this.series) { + s.setChartData(data); + } + if (this.miniChartAnimationPhase === "initial") { + this.ctx.animationManager.onBatchStop(() => { + this.miniChartAnimationPhase = "ready"; + for (const s of this.series) { + s.resetAnimation("disabled"); + } + }); + } + } + async processData(dataController) { + if (this.series.some((s) => s.canHaveAxes)) { + this.assignAxesToSeries(); + this.assignSeriesToAxes(); + } + await Promise.all( + this.series.map(async (s) => { + s.resetDatumCallbackCache(); + return s.processData(dataController); + }) + ); + for (const axis of this.axes) { + axis.processData(); + } + } + computeAxisPadding() { + const padding = new Padding(); + if (!this.enabled) { + return padding; + } + for (const { position, thickness, line, label } of this.axes) { + if (position == null) + continue; + let size; + if (thickness) { + size = thickness; + } else { + size = (line.enabled ? line.width : 0) + (label.enabled ? (0, import_ag_charts_core52.calcLineHeight)(label.fontSize ?? 0) + label.spacing : 0); + } + padding[position] = Math.ceil(size); + } + return padding; + } + async layout(width, height) { + var _a; + const { padding } = this; + const animated = this.seriesRect != null; + const seriesRect = new BBox7(0, 0, width, height - (padding.top + padding.bottom)); + const resized = this.seriesRect == null || this.seriesRect.width !== width || this.seriesRect.height !== height; + this.seriesRect = seriesRect; + this.seriesRoot.translationY = padding.top; + this.seriesRoot.setClipRectCanvasSpace(new BBox7(0, -padding.top, width, height)); + for (const axis of this.axes) { + const { position = "left" } = axis; + switch (position) { + case "top": + case "bottom": + axis.range = [0, seriesRect.width]; + axis.gridLength = seriesRect.height; + break; + case "right": + case "left": { + const isCategoryAxis = axis instanceof CategoryAxis; + axis.range = isCategoryAxis ? [0, seriesRect.height] : [seriesRect.height, 0]; + axis.gridLength = seriesRect.width; + break; + } + } + axis.gridPadding = 0; + axis.translation.x = 0; + axis.translation.y = 0; + if (position === "right") { + axis.translation.x = width; + } else if (position === "bottom") { + axis.translation.y = height; + } + if (!animated) { + axis.resetAnimation("initial"); + } + if (axis.crossLines) { + for (const crossLine of axis.crossLines) { + if (crossLine instanceof import_ag_charts_community105._ModuleSupport.CartesianCrossLine) { + crossLine.position = axis.position ?? "top"; + (_a = crossLine.label).parallel ?? (_a.parallel = axis.label?.parallel); + } + } + } + axis.calculateLayout(); + axis.update(); + } + if (resized) { + stackCartesianSeries(this.series); + } + await Promise.all(this.series.map(async (series) => series.update({ seriesRect }))); + } +}; +__decorateClass([ + Property44 +], MiniChart.prototype, "enabled", 2); +__decorateClass([ + ProxyProperty2(["seriesRoot", "inset"]) +], MiniChart.prototype, "inset", 2); +__decorateClass([ + ProxyProperty2(["seriesRoot", "cornerRadius"]) +], MiniChart.prototype, "cornerRadius", 2); +__decorateClass([ + ActionOnSet7({ + changeValue(newValue, oldValue = []) { + const axisNodes = { + axisNode: this.axisGroup, + gridNode: this.axisGridGroup, + labelNode: this.axisLabelGroup, + crossLineLineNode: this.axisCrosslineLineGroup, + crossLineRangeNode: this.axisCrosslineRangeGroup, + crossLineLabelNode: this.axisCrosslineLabelGroup + }; + for (const axis of oldValue) { + if (newValue.includes(axis)) + continue; + axis.detachAxis(); + axis.destroy(); + } + for (const axis of newValue) { + if (oldValue?.includes(axis)) + continue; + axis.attachAxis(axisNodes); + } + } + }) +], MiniChart.prototype, "axes", 2); +__decorateClass([ + ActionOnSet7({ + changeValue(newValue, oldValue) { + this.onSeriesChange(newValue, oldValue); + } + }) +], MiniChart.prototype, "series", 2); + +// packages/ag-charts-enterprise/src/features/navigator/navigatorDOMProxy.ts +var import_ag_charts_community106 = require("ag-charts-community"); +var import_ag_charts_core53 = require("ag-charts-core"); +var { SliderWidget } = import_ag_charts_community106._ModuleSupport; +var NavigatorDOMProxy = class { + constructor(ctx, sliderHandlers) { + this.ctx = ctx; + this.sliderHandlers = sliderHandlers; + this._min = 0; + this._max = 1; + this.minRange = 1e-3; + this.dragStartX = 0; + this.ctx = ctx; + this.toolbar = ctx.proxyInteractionService.createProxyContainer({ + type: "toolbar", + domManagerId: `navigator-toolbar`, + classList: ["ag-charts-proxy-navigator-toolbar"], + orientation: "vertical", + ariaLabel: { id: "ariaLabelNavigator" } + }); + this.sliders = [ + ctx.proxyInteractionService.createProxyElement({ + type: "slider", + domIndex: 1, + ariaLabel: { id: "ariaLabelNavigatorMinimum" }, + parent: this.toolbar, + cursor: "ew-resize" + }), + ctx.proxyInteractionService.createProxyElement({ + type: "slider", + domIndex: -Infinity, + ariaLabel: { id: "ariaLabelNavigatorRange" }, + parent: this.toolbar, + cursor: "grab" + }), + ctx.proxyInteractionService.createProxyElement({ + type: "slider", + domIndex: 2, + ariaLabel: { id: "ariaLabelNavigatorMaximum" }, + parent: this.toolbar, + cursor: "ew-resize" + }) + ]; + for (const [index, key] of ["min", "pan", "max"].entries()) { + const slider = this.sliders[index]; + slider.step = SliderWidget.STEP_HUNDRETH; + slider.keyboardStep = SliderWidget.STEP_ONE; + slider.orientation = "horizontal"; + slider.setPreventsDefault(false); + slider.addListener("drag-start", (ev) => this.onDragStart(index, ev, key)); + slider.addListener("drag-move", (ev) => this.onDrag(slider, ev, key)); + slider.addListener("drag-end", () => this.updateSliderRatios()); + slider.addListener("contextmenu", (ev) => this.onContextMenu(slider, ev)); + } + this.sliders[0].addListener("change", () => this.onMinSliderChange()); + this.sliders[1].addListener("change", () => this.onPanSliderChange()); + this.sliders[2].addListener("change", () => this.onMaxSliderChange()); + this.updateSliderRatios(); + this.updateVisibility(false); + } + destroy() { + this.toolbar.destroy(); + } + updateVisibility(visible) { + this.toolbar.setHidden(!visible); + } + updateZoom() { + const { _min: min, _max: max } = this; + if (min == null || max == null) + return; + return this.ctx.zoomManager.updateZoom("navigator", { x: { min, max } }); + } + updateBounds(bounds) { + this.toolbar.setBounds(bounds); + } + updateSliderBounds(sliderIndex, bounds) { + this.sliders[sliderIndex].setBounds(bounds); + } + updateMinMax(min, max) { + this._min = min; + this._max = max; + this.updateSliderRatios(); + } + updateSliderRatios() { + let { _min: min, _max: max } = this; + min = Math.round(min * 100) / 100; + max = Math.round(max * 100) / 100; + const panAria = this.ctx.localeManager.t("ariaValuePanRange", { min, max }); + this.sliders[0].setValueRatio(min); + this.sliders[1].setValueRatio(min, { ariaValueText: panAria }); + this.sliders[2].setValueRatio(max); + } + toCanvasOffsets(event) { + return { offsetX: this.dragStartX + event.originDeltaX }; + } + moveToFront(index) { + if (index === 1) + return; + const frontSlider = this.sliders[index]; + const otherSlider = this.sliders[2 - index]; + this.toolbar.moveChild(otherSlider, frontSlider.domIndex - 1); + } + onDragStart(index, event, key) { + const slider = this.sliders[index]; + const toolbarLeft = this.toolbar.cssLeft(); + const sliderLeft = slider.cssLeft(); + this.dragStartX = toolbarLeft + sliderLeft + event.offsetX; + this.moveToFront(index); + event.sourceEvent.preventDefault(); + this.sliderHandlers.onDragStart(key, this.toCanvasOffsets(event)); + } + onDrag(_slider, event, key) { + event.sourceEvent.preventDefault(); + this.sliderHandlers.onDrag(key, this.toCanvasOffsets(event)); + } + onContextMenu(slider, widgetEvent) { + const { offsetX, offsetY } = widgetEvent; + const { x: toolbarX, y: toolbarY } = this.toolbar.getBounds(); + const { x: sliderX, y: sliderY } = slider.getBounds(); + const canvasX = offsetX + toolbarX + sliderX; + const canvasY = offsetY + toolbarY + sliderY; + this.ctx.contextMenuRegistry.dispatchContext("always", { widgetEvent, canvasX, canvasY }, void 0); + } + onPanSliderChange() { + const ratio3 = this.sliders[1].getValueRatio(); + const span = this._max - this._min; + this._min = (0, import_ag_charts_core53.clamp)(0, ratio3, 1 - span); + this._max = this._min + span; + this.updateZoom(); + } + onMinSliderChange() { + this._min = this.sliders[0].clampValueRatio(0, this._max - this.minRange); + this.updateZoom(); + } + onMaxSliderChange() { + this._max = this.sliders[2].clampValueRatio(this._min + this.minRange, 1); + this.updateZoom(); + } +}; + +// packages/ag-charts-enterprise/src/features/navigator/shapes/rangeHandle.ts +var import_ag_charts_community107 = require("ag-charts-community"); +var { Property: Property45, SceneChangeDetection: SceneChangeDetection2, BBox: BBox8, ExtendedPath2D } = import_ag_charts_community107._ModuleSupport; +var RangeHandle = class extends import_ag_charts_community107._ModuleSupport.Path { + constructor() { + super(...arguments); + this.zIndex = 3; + this.centerX = 0; + this.centerY = 0; + this.width = 8; + this.height = 16; + this.cornerRadius = 4; + this.grip = true; + this.gripPath = new ExtendedPath2D(); + } + setCenter(x, y) { + this.dirtyPath = true; + if (this.centerX !== x || this.centerY !== y) { + this.centerX = x; + this.centerY = y; + this.markDirty("center"); + } + } + static align(minHandle, maxHandle, x, y, width, height, min, max, pixelAlign) { + const minHandleX = minHandle.align(x + width * min) + pixelAlign; + const maxHandleX = minHandleX + minHandle.align(x + width * min, width * (max - min)) - 2 * pixelAlign; + const handleY = minHandle.align(y + height / 2); + minHandle.setCenter(minHandleX, handleY); + maxHandle.setCenter(maxHandleX, handleY); + } + computeBBox() { + const { centerX, centerY, width, height } = this; + const x = centerX - width / 2; + const y = centerY - height / 2; + return new BBox8(x, y, width, height); + } + isPointInPath(x, y) { + const bbox = this.getBBox(); + return bbox.containsPoint(x, y); + } + updatePath() { + const { centerX, centerY, path, gripPath, strokeWidth, cornerRadius, grip } = this; + const pixelAlign = strokeWidth / 2; + const pixelRatio = this.layerManager?.canvas?.pixelRatio ?? 1; + path.clear(); + gripPath.clear(); + const halfWidth = Math.floor(this.width / 2 * pixelRatio) / pixelRatio; + const halfHeight = Math.floor(this.height / 2 * pixelRatio) / pixelRatio; + path.roundRect( + centerX - halfWidth + pixelAlign, + centerY - halfHeight + pixelAlign, + 2 * (halfWidth - pixelAlign), + 2 * (halfHeight - pixelAlign), + cornerRadius + ); + const gripSpacing = 3; + if (grip) { + for (let x = -0.5; x <= 0.5; x += 1) { + for (let y = -1; y <= 1; y += 1) { + gripPath.arc(centerX + x * gripSpacing, centerY + y * gripSpacing, 1, 0, 2 * Math.PI); + gripPath.closePath(); + } + } + } + } + renderFill(ctx, path) { + const { stroke: stroke2 } = this; + super.renderFill(ctx, path); + ctx.fillStyle = typeof stroke2 === "string" ? stroke2 : "black"; + ctx.fill(this.gripPath.getPath2D()); + } +}; +RangeHandle.className = "RangeHandle"; +__decorateClass([ + Property45, + SceneChangeDetection2() +], RangeHandle.prototype, "width", 2); +__decorateClass([ + Property45, + SceneChangeDetection2() +], RangeHandle.prototype, "height", 2); +__decorateClass([ + Property45, + SceneChangeDetection2() +], RangeHandle.prototype, "cornerRadius", 2); +__decorateClass([ + Property45, + SceneChangeDetection2() +], RangeHandle.prototype, "grip", 2); + +// packages/ag-charts-enterprise/src/features/navigator/shapes/rangeMask.ts +var import_ag_charts_community108 = require("ag-charts-community"); +var { Path: Path6, BBox: BBox9, ExtendedPath2D: ExtendedPath2D2, clippedRoundRect, Property: Property46, SceneChangeDetection: SceneChangeDetection3 } = import_ag_charts_community108._ModuleSupport; +var RangeMask = class extends Path6 { + constructor() { + super(...arguments); + this.cornerRadius = 4; + this.zIndex = 2; + this.x = 0; + this.y = 0; + this.width = 200; + this.height = 30; + this.min = 0; + this.max = 1; + this.visiblePath = new ExtendedPath2D2(); + } + layout(x, y, width, height, min, max) { + min = Number.isNaN(min) ? this.min : min; + max = Number.isNaN(max) ? this.max : max; + if (x !== this.x || y !== this.y || width !== this.width || this.height !== height || min !== this.min || max !== this.max) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.min = min; + this.max = max; + this.dirtyPath = true; + this.markDirty("RangeMask.layout"); + } + } + computeBBox() { + const { x, y, width, height } = this; + return new BBox9(x, y, width, height); + } + computeVisibleRangeBBox() { + const { x, y, width, height, min, max } = this; + const minX = x + width * min; + const maxX = x + width * max; + return new BBox9(minX, y, maxX - minX, height); + } + updatePath() { + const { path, visiblePath, x, y, width, height, min, max, strokeWidth, cornerRadius } = this; + const pixelAlign = strokeWidth / 2; + path.clear(); + visiblePath.clear(); + const ax = this.align(x) + pixelAlign; + const ay = this.align(y) + pixelAlign; + const aw = this.align(x, width) - 2 * pixelAlign; + const ah = this.align(y, height) - 2 * pixelAlign; + const minX = this.align(x + width * min) + pixelAlign; + const maxX = minX + this.align(x + width * min, width * (max - min)) - 2 * pixelAlign; + const cornerRadiusParams = { + topLeft: cornerRadius, + topRight: cornerRadius, + bottomRight: cornerRadius, + bottomLeft: cornerRadius + }; + const drawRect = (p, x0, x1) => { + if (x1 - x0 < 1) + return; + const bbox = new BBox9(x0, ay, x1 - x0, ah); + clippedRoundRect(p, ax, ay, aw, ah, cornerRadiusParams, bbox); + }; + drawRect(path, ax, minX); + drawRect(path, maxX, aw + ax); + drawRect(visiblePath, minX, maxX); + } + renderStroke(ctx, path) { + super.renderStroke(ctx, path); + super.renderStroke(ctx, this.visiblePath.getPath2D()); + } +}; +RangeMask.className = "RangeMask"; +__decorateClass([ + Property46, + SceneChangeDetection3() +], RangeMask.prototype, "cornerRadius", 2); + +// packages/ag-charts-enterprise/src/features/navigator/shapes/rangeSelector.ts +var import_ag_charts_community109 = require("ag-charts-community"); +var RangeSelector = class extends import_ag_charts_community109._ModuleSupport.Group { + constructor(children) { + super({ name: "rangeSelectorGroup", zIndex: import_ag_charts_community109._ModuleSupport.ZIndexMap.NAVIGATOR }); + this.x = 0; + this.y = 0; + this.width = 200; + this.height = 30; + this.lOffset = 0; + this.rOffset = 0; + this.background = this.appendChild( + new import_ag_charts_community109._ModuleSupport.TranslatableGroup({ name: "navigator-background", zIndex: 1 }) + ); + this.append(children); + } + layout(x, y, width, height, lOffset, rOffset) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.lOffset = lOffset; + this.rOffset = rOffset; + this.background.translationX = x; + this.background.translationY = y; + this.markDirty("RangeSelector"); + } + updateBackground(oldGroup, newGroup) { + if (oldGroup != null) { + oldGroup.remove(); + } + if (newGroup != null) { + this.background.appendChild(newGroup); + } + this.markDirty("RangeSelector"); + } + computeBBox() { + const { x, y, width, height, lOffset, rOffset } = this; + return new import_ag_charts_community109._ModuleSupport.BBox(x - lOffset, y, width + (lOffset + rOffset), height); + } +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigator.ts +var { BaseModuleInstance: BaseModuleInstance2, ObserveChanges: ObserveChanges3, Property: Property47 } = import_ag_charts_community110._ModuleSupport; +var Navigator = class extends BaseModuleInstance2 { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.mask = new RangeMask(); + this.minHandle = new RangeHandle(); + this.maxHandle = new RangeHandle(); + this.maskVisibleRange = { + id: "navigator-mask-visible-range", + getBBox: () => this.mask.computeVisibleRangeBBox(), + toCanvasBBox: () => this.mask.computeVisibleRangeBBox(), + fromCanvasPoint: (x, y) => ({ x, y }) + }; + this.height = 30; + this.cornerRadius = 0; + this.spacing = 10; + this.x = 0; + this.y = 0; + this.width = 0; + this.rangeSelector = new RangeSelector([this.mask, this.minHandle, this.maxHandle]); + this.cleanup.register( + ctx.scene.attachNode(this.rangeSelector), + ctx.eventsHub.on("locale:change", () => this.updateZoom()), + ctx.layoutManager.registerElement(import_ag_charts_community110._ModuleSupport.LayoutElement.Navigator, (e) => this.onLayoutStart(e)), + ctx.eventsHub.on("layout:complete", (e) => this.onLayoutComplete(e)), + ctx.eventsHub.on("zoom:change", (event) => this.onZoomChange(event)) + ); + this.domProxy = new NavigatorDOMProxy(ctx, this); + this.updateGroupVisibility(); + this.miniChart = new MiniChart(ctx); + } + updateBackground(oldGroup, newGroup) { + this.rangeSelector?.updateBackground(oldGroup, newGroup); + } + updateGroupVisibility() { + const { enabled } = this; + if (this.rangeSelector == null || enabled === this.rangeSelector.visible) + return; + this.rangeSelector.visible = enabled; + this.domProxy.updateVisibility(enabled); + if (enabled) { + this.updateZoom(); + } else { + this.ctx.zoomManager.updateZoom("navigator"); + } + } + onLayoutStart(ctx) { + if (this.enabled) { + const { layoutBox } = ctx; + const navigatorTotalHeight = this.height + this.spacing; + layoutBox.shrink(navigatorTotalHeight, "bottom"); + this.y = layoutBox.y + layoutBox.height + this.spacing; + } else { + this.y = 0; + } + if (this.enabled && this.miniChart) { + const { top, bottom } = this.miniChart.computeAxisPadding(); + ctx.layoutBox.shrink(top + bottom, "bottom"); + this.y -= bottom; + this.miniChart.inset = this.mask.strokeWidth / 2; + this.miniChart.cornerRadius = this.mask.cornerRadius; + } + } + onLayoutComplete(opts) { + const { x, width } = opts.series.rect; + const { y, height } = this; + this.domProxy.updateVisibility(this.enabled); + if (this.enabled) { + const { _min: min, _max: max } = this.domProxy; + this.layoutNodes(x, y, width, height, min, max); + this.domProxy.updateBounds({ x, y, width, height }); + } + this.x = x; + this.width = width; + this.miniChart?.layout(width, height).catch((e) => import_ag_charts_core54.Logger.error(e)); + } + canDrag() { + return this.enabled && this.ctx.interactionManager.isState(import_ag_charts_community110._ModuleSupport.InteractionState.ZoomDraggable); + } + onDragStart(dragging, { offsetX }) { + if (!this.canDrag()) + return; + if (dragging === "pan") { + this.panStart = (offsetX - this.x) / this.width - this.domProxy._min; + } + this.ctx.zoomManager.fireZoomPanStartEvent("navigator"); + } + onDrag(dragging, { offsetX }) { + if (!this.canDrag()) + return; + const { panStart, x, width } = this; + const { minRange } = this.domProxy; + let { _min: min, _max: max } = this.domProxy; + const ratio3 = (offsetX - x) / width; + if (dragging === "min") { + min = (0, import_ag_charts_core54.clamp)(0, ratio3, max - minRange); + } else if (dragging === "max") { + max = (0, import_ag_charts_core54.clamp)(min + minRange, ratio3, 1); + } else if (dragging === "pan" && panStart != null) { + const span = max - min; + min = (0, import_ag_charts_core54.clamp)(0, ratio3 - panStart, 1 - span); + max = min + span; + } + this.domProxy._min = min; + this.domProxy._max = max; + this.updateZoom(); + } + onZoomChange(event) { + const { x: xZoom } = event; + if (!xZoom) + return; + const { x, y, width, height } = this; + const { min, max } = xZoom; + this.domProxy.updateMinMax(min, max); + this.layoutNodes(x, y, width, height, min, max); + } + layoutNodes(x, y, width, height, min, max) { + const { rangeSelector, mask, minHandle, maxHandle } = this; + mask.layout(x, y, width, height, min, max); + rangeSelector.layout(x, y, width, height, minHandle.width / 2, maxHandle.width / 2); + RangeHandle.align(minHandle, maxHandle, x, y, width, height, min, max, mask.strokeWidth / 2); + if (min + (max - min) / 2 < 0.5) { + minHandle.zIndex = 3; + maxHandle.zIndex = 4; + } else { + minHandle.zIndex = 4; + maxHandle.zIndex = 3; + } + for (const [index, node] of [minHandle, this.maskVisibleRange, maxHandle].entries()) { + const bbox = node.getBBox(); + const tbox = { x: bbox.x - x, y: bbox.y - y, height: bbox.height, width: bbox.width }; + this.domProxy.updateSliderBounds(index, tbox); + } + } + updateZoom() { + if (!this.enabled) + return; + this.domProxy.updateZoom(); + } + updateData(data) { + return this.miniChart?.updateData(data); + } + async processData(dataController) { + if (this.miniChart) { + return this.miniChart?.processData(dataController); + } + } +}; +__decorateClass([ + ObserveChanges3((target, value, oldValue) => { + target.updateBackground(oldValue?.root, value?.root); + }) +], Navigator.prototype, "miniChart", 2); +__decorateClass([ + Property47, + ObserveChanges3((target, value) => { + target.ctx.zoomManager.setNavigatorEnabled(Boolean(value)); + target.updateGroupVisibility(); + }) +], Navigator.prototype, "enabled", 2); +__decorateClass([ + Property47 +], Navigator.prototype, "height", 2); +__decorateClass([ + Property47, + ObserveChanges3((target, value) => { + target.mask.cornerRadius = value; + }) +], Navigator.prototype, "cornerRadius", 2); +__decorateClass([ + Property47 +], Navigator.prototype, "spacing", 2); + +// packages/ag-charts-enterprise/src/features/navigator/navigatorTheme.ts +var import_ag_charts_community156 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/navigator/navigatorOptionsDefs.ts +var import_ag_charts_community155 = require("ag-charts-community"); +var import_ag_charts_core65 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotModule.ts +var import_ag_charts_community116 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeries.ts +var import_ag_charts_community113 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/box-plot/blotPlotUtil.ts +function prepareBoxPlotFromTo(isVertical) { + const from = isVertical ? { scalingX: 1, scalingY: 0 } : { scalingX: 0, scalingY: 1 }; + const to = { scalingX: 1, scalingY: 1 }; + return { from, to }; +} +function resetBoxPlotSelectionsScalingCenterFn(isVertical) { + return (_node, datum) => { + if (isVertical) { + return { scalingCenterY: datum.scaledValues.medianValue }; + } + return { scalingCenterX: datum.scaledValues.medianValue }; + }; +} + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotNode.ts +var import_ag_charts_community111 = require("ag-charts-community"); +var { + Path: Path7, + Scalable, + ExtendedPath2D: ExtendedPath2D3, + SceneChangeDetection: SceneChangeDetection4, + SceneArrayChangeDetection, + BBox: BBox10, + clippedRoundRect: baseClippedRoundRect +} = import_ag_charts_community111._ModuleSupport; +var BoxPlotNode = class extends Scalable(Path7) { + constructor() { + super(...arguments); + this.wickPath = new ExtendedPath2D3(); + this.horizontal = false; + this.center = 0; + this.thickness = 0; + this.min = 0; + this.q1 = 0; + this.median = 0; + this.q3 = 0; + this.max = 0; + this.cornerRadius = 0; + this.crisp = false; + this.strokeAlignment = 0; + this.wickStroke = void 0; + this.wickStrokeWidth = void 0; + this.wickStrokeOpacity = void 0; + this.capLengthRatio = 1; + this.wickStrokeAlignment = 0; + } + computeBBox() { + const { horizontal, center, thickness, min, max } = this; + return horizontal ? new BBox10(Math.min(min, max), center - thickness / 2, Math.abs(max - min), thickness) : new BBox10(center - thickness / 2, Math.min(min, max), thickness, Math.abs(max - min)); + } + computeDefaultGradientFillBBox() { + const { horizontal, center, thickness, q1, q3 } = this; + return horizontal ? new BBox10(Math.min(q1, q3), center - thickness / 2, Math.abs(q3 - q1), thickness) : new BBox10(center - thickness / 2, Math.min(q1, q3), thickness, Math.abs(q3 - q1)); + } + isPointInPath(x, y) { + return this.getBBox().containsPoint(x, y); + } + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } + get midPoint() { + return this.horizontal ? { x: (this.min + this.max) / 2, y: this.center } : { x: this.center, y: (this.min + this.max) / 2 }; + } + alignedCoordinates() { + const { thickness, crisp } = this; + let { center, min, q1, median, q3, max } = this; + let x0 = center - thickness / 2; + let x1 = center + thickness / 2; + if (crisp && thickness > 1) { + min = this.align(min); + q1 = this.align(q1); + median = this.align(median); + q3 = this.align(q3); + max = min + this.align(min, max - min); + const halfWidth = this.align(thickness / 2); + center = this.align(center); + x0 = center - halfWidth; + x1 = center + halfWidth; + } + return { center, x0, x1, min, max, q1, median, q3 }; + } + updatePath() { + const { + path, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke, + wickStrokeWidth, + wickStrokeOpacity, + wickLineDash, + wickLineDashOffset, + strokeAlignment, + cornerRadius, + capLengthRatio, + horizontal + } = this; + const { center, x0, x1, min, max, q1, median, q3 } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const wickStrokeAlignment = this.wickStrokeAlignment > 0 ? pixelRatio / this.wickStrokeAlignment / 2 % 1 : 0; + this.path.clear(); + this.wickPath.clear(); + const needsWickPath = wickStroke != null && wickStroke !== stroke2 || wickStrokeWidth != null && wickStrokeWidth !== strokeWidth || wickStrokeOpacity != null && wickStrokeOpacity !== strokeOpacity || wickLineDash != null && wickLineDash !== lineDash || wickLineDashOffset != null && wickLineDashOffset !== lineDashOffset; + const wickPath = needsWickPath ? this.wickPath : path; + if (Math.abs(x1 - x0) <= 3) { + moveTo(wickPath, horizontal, center, min); + lineTo(wickPath, horizontal, center, max); + return; + } + const wickTop = Math.min(min, max); + const wickBottom = Math.max(min, max); + const boxTop = Math.min(q1, q3); + const boxBottom = Math.max(q1, q3); + const capX0 = center - Math.abs((x1 - x0) * capLengthRatio) / 2; + const capX1 = center + Math.abs((x1 - x0) * capLengthRatio) / 2; + moveTo(wickPath, horizontal, capX0, wickTop - wickStrokeAlignment); + lineTo(wickPath, horizontal, capX1, wickTop - wickStrokeAlignment); + moveTo(wickPath, horizontal, center - wickStrokeAlignment, wickTop - wickStrokeAlignment); + lineTo(wickPath, horizontal, center - wickStrokeAlignment, boxTop + strokeWidth / 2); + moveTo(wickPath, horizontal, center - wickStrokeAlignment, wickBottom + wickStrokeAlignment); + lineTo(wickPath, horizontal, center - wickStrokeAlignment, boxBottom - strokeWidth / 2); + moveTo(wickPath, horizontal, capX0, wickBottom + wickStrokeAlignment); + lineTo(wickPath, horizontal, capX1, wickBottom + wickStrokeAlignment); + const horizontalBoxStrokeAdjustment = strokeWidth / 2 + strokeAlignment; + const verticalBoxStrokeAdjustment = strokeWidth / 2 - strokeAlignment; + const rectHeight = boxBottom - boxTop - 2 * verticalBoxStrokeAdjustment; + if (rectHeight > 0) { + const rectX = x0 + horizontalBoxStrokeAdjustment; + const rectY = boxTop + verticalBoxStrokeAdjustment; + const rectWidth = x1 - x0 - 2 * horizontalBoxStrokeAdjustment; + const cornerRadii = { + topLeft: cornerRadius, + topRight: cornerRadius, + bottomRight: cornerRadius, + bottomLeft: cornerRadius + }; + clippedRoundRect2( + path, + horizontal, + rectX, + rectY, + rectWidth, + rectHeight, + cornerRadii, + new BBox10(rectX, rectY, rectWidth, median - rectY) + ); + clippedRoundRect2( + path, + horizontal, + rectX, + rectY, + rectWidth, + rectHeight, + cornerRadii, + new BBox10(rectX, median, rectWidth, rectY + rectHeight - median) + ); + } else { + const boxMid = (boxTop + boxBottom) / 2; + moveTo(path, horizontal, x0, boxMid); + lineTo(path, horizontal, x1, boxMid); + } + } + drawPath(ctx) { + super.drawPath(ctx); + const { wickPath } = this; + if (wickPath.isEmpty()) + return; + const { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke = stroke2, + wickStrokeWidth = strokeWidth, + wickStrokeOpacity = strokeOpacity, + wickLineDash = lineDash, + wickLineDashOffset = lineDashOffset + } = this; + if (wickStrokeWidth === 0) + return; + ctx.globalAlpha *= wickStrokeOpacity; + if (typeof wickStroke === "string") { + ctx.strokeStyle = wickStroke; + } + ctx.lineWidth = wickStrokeWidth; + if (wickLineDash != null) { + ctx.setLineDash([...wickLineDash]); + } + ctx.lineDashOffset = wickLineDashOffset; + ctx.stroke(wickPath.getPath2D()); + } +}; +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "horizontal", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "center", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "thickness", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "min", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "q1", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "median", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "q3", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "max", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "cornerRadius", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "crisp", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "strokeAlignment", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStroke", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStrokeWidth", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStrokeOpacity", 2); +__decorateClass([ + SceneArrayChangeDetection() +], BoxPlotNode.prototype, "wickLineDash", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickLineDashOffset", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "capLengthRatio", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStrokeAlignment", 2); +function moveTo(path, horizontal, x, y) { + if (horizontal) { + path.moveTo(y, x); + } else { + path.moveTo(x, y); + } +} +function lineTo(path, horizontal, x, y) { + if (horizontal) { + path.lineTo(y, x); + } else { + path.lineTo(x, y); + } +} +function clippedRoundRect2(path, horizontal, x, y, width, height, cornerRadii, clipBBox) { + if (horizontal) { + baseClippedRoundRect( + // eslint-disable-next-line sonarjs/arguments-order + path, + y, + x, + height, + width, + cornerRadii, + clipBBox == null ? void 0 : new BBox10(clipBBox.y, clipBBox.x, clipBBox.height, clipBBox.width) + ); + } else { + baseClippedRoundRect(path, x, y, width, height, cornerRadii, clipBBox); + } +} + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeriesProperties.ts +var import_ag_charts_community112 = require("ag-charts-community"); +var { BaseProperties: BaseProperties15, AbstractBarSeriesProperties, makeSeriesTooltip, Property: Property48, mergeDefaults: mergeDefaults3 } = import_ag_charts_community112._ModuleSupport; +var BoxPlotSeriesCap = class extends BaseProperties15 { + constructor() { + super(...arguments); + this.lengthRatio = 0.5; + } +}; +__decorateClass([ + Property48 +], BoxPlotSeriesCap.prototype, "lengthRatio", 2); +var BoxPlotSeriesWhisker = class extends BaseProperties15 { +}; +__decorateClass([ + Property48 +], BoxPlotSeriesWhisker.prototype, "stroke", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesWhisker.prototype, "strokeWidth", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesWhisker.prototype, "strokeOpacity", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesWhisker.prototype, "lineDash", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesWhisker.prototype, "lineDashOffset", 2); +var BoxPlotSeriesProperties = class extends AbstractBarSeriesProperties { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.cap = new BoxPlotSeriesCap(); + this.whisker = new BoxPlotSeriesWhisker(); + this.tooltip = makeSeriesTooltip(); + } + toJson() { + const { stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const properties = super.toJson(); + properties.whisker = mergeDefaults3(properties.whisker, { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + return properties; + } +}; +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "minKey", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "q1Key", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "medianKey", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "q3Key", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "maxKey", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "minName", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "q1Name", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "medianName", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "q3Name", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "maxName", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "cap", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "whisker", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeries.ts +var { + fixNumericExtent: fixNumericExtent2, + keyProperty: keyProperty2, + mergeDefaults: mergeDefaults4, + SeriesNodePickMode, + SMALLEST_KEY_INTERVAL, + valueProperty: valueProperty3, + diff, + animationValidation, + computeBarFocusBounds, + createDatumId, + HighlightState, + ContinuousScale: ContinuousScale4, + ChartAxisDirection: ChartAxisDirection13, + motion, + getItemStyles, + applyShapeFillBBox, + calculateSegments, + toHighlightString +} = import_ag_charts_community113._ModuleSupport; +var BoxPlotSeriesNodeEvent = class extends import_ag_charts_community113._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.minKey = series.properties.minKey; + this.q1Key = series.properties.q1Key; + this.medianKey = series.properties.medianKey; + this.q3Key = series.properties.q3Key; + this.maxKey = series.properties.maxKey; + } +}; +var BoxPlotSeries = class extends import_ag_charts_community113._ModuleSupport.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode.NEAREST_NODE, SeriesNodePickMode.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["medianKey", "q1Key", "q3Key", "minKey", "maxKey"] + }, + propertyNames: { + x: ["xName"], + y: ["medianName", "q1Name", "q3Name", "minName", "maxName"] + }, + categoryKey: "xValue", + pathsPerSeries: [] + }); + this.properties = new BoxPlotSeriesProperties(); + this.NodeEvent = BoxPlotSeriesNodeEvent; + } + async processData(dataController) { + if (!this.visible) + return; + const { xKey, minKey, q1Key, medianKey, q3Key, maxKey } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (animationEnabled && this.processedData) { + extraProps.push(diff(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation()); + } + const { processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty2(xKey, xScaleType, { id: `xValue` }), + valueProperty3(minKey, yScaleType, { id: `minValue` }), + valueProperty3(q1Key, yScaleType, { id: `q1Value` }), + valueProperty3(medianKey, yScaleType, { id: `medianValue` }), + valueProperty3(q3Key, yScaleType, { id: `q3Value` }), + valueProperty3(maxKey, yScaleType, { id: `maxValue` }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL] : [], + ...extraProps + ] + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + if (direction !== this.getBarDirection()) { + const { index, def } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = processedData.domain.keys[index]; + if (def.type === "key" && def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yExtent = this.domainForClippedRange(direction, ["minValue", "maxValue"], "xValue"); + return fixNumericExtent2(yExtent); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection13.Y, ["maxValue", "minValue"], "xValue", visibleRange); + } + createNodeData() { + const { visible, dataModel, processedData } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const { xKey } = this.properties; + const nodeData = []; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const minValues = dataModel.resolveColumnById(this, "minValue", processedData); + const q1Values = dataModel.resolveColumnById(this, "q1Value", processedData); + const medianValues = dataModel.resolveColumnById(this, "medianValue", processedData); + const q3Values = dataModel.resolveColumnById(this, "q3Value", processedData); + const maxValues = dataModel.resolveColumnById(this, "maxValue", processedData); + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale4.is(xAxis.scale) ? barWidth * -0.5 : 0; + const { groupScale } = this; + const isVertical = this.isVertical(); + const segments = calculateSegments( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + const context = { + itemId: xKey, + nodeData, + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStyles(this.getItemStyle.bind(this)), + segments + }; + if (!visible) + return context; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const minValue = minValues[datumIndex]; + const q1Value = q1Values[datumIndex]; + const medianValue = medianValues[datumIndex]; + const q3Value = q3Values[datumIndex]; + const maxValue = maxValues[datumIndex]; + if ([minValue, q1Value, medianValue, q3Value, maxValue].some((value) => typeof value !== "number") || minValue > q1Value || q1Value > medianValue || medianValue > q3Value || q3Value > maxValue) { + continue; + } + const scaledValues = { + xValue: xAxis.scale.convert(xValue2), + minValue: yAxis.scale.convert(minValue), + q1Value: yAxis.scale.convert(q1Value), + medianValue: yAxis.scale.convert(medianValue), + q3Value: yAxis.scale.convert(q3Value), + maxValue: yAxis.scale.convert(maxValue) + }; + const bandwidth = barWidth; + scaledValues.xValue += groupScale.convert(String(groupIndex)) + barOffset + bandwidth / 2; + const height = Math.abs(scaledValues.q3Value - scaledValues.q1Value); + const midX = scaledValues.xValue; + const midY = Math.min(scaledValues.q3Value, scaledValues.q1Value) + height / 2; + const midPoint = { + x: isVertical ? midX : midY, + y: isVertical ? midY : midX + }; + let focusRect; + if (isVertical) { + focusRect = { + x: midPoint.x - bandwidth / 2, + y: scaledValues.minValue, + width: bandwidth, + height: scaledValues.maxValue - scaledValues.minValue + }; + } else { + focusRect = { + x: scaledValues.minValue, + y: midPoint.y - bandwidth / 2, + width: scaledValues.maxValue - scaledValues.minValue, + height: bandwidth + }; + } + nodeData.push({ + series: this, + itemId: xValue2, + datum, + datumIndex, + xKey, + bandwidth, + scaledValues, + midPoint, + focusRect + }); + } + return context; + } + legendItemSymbol() { + const { fill, stroke: stroke2, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + HighlightState.None + ); + return { + marker: { + fill: import_ag_charts_community113._ModuleSupport.deepClone(fill), + fillOpacity, + stroke: stroke2, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { xKey, yName, showInLegend, legendItemName } = this.properties; + if (!xKey || legendType !== "category") { + return []; + } + return [ + { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: seriesId }), + label: { + text: legendItemName ?? yName ?? seriesId + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { + xKey, + xName, + yName, + medianKey, + medianName, + q1Key, + q1Name, + q3Key, + q3Name, + minKey, + minName, + maxKey, + maxName, + legendItemName, + tooltip + } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const minValue = dataModel.resolveColumnById(this, `minValue`, processedData)[datumIndex]; + const q1Value = dataModel.resolveColumnById(this, `q1Value`, processedData)[datumIndex]; + const medianValue = dataModel.resolveColumnById(this, `medianValue`, processedData)[datumIndex]; + const q3Value = dataModel.resolveColumnById(this, `q3Value`, processedData)[datumIndex]; + const maxValue = dataModel.resolveColumnById(this, `maxValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + const data = [ + { + label: minName, + fallbackLabel: minKey, + value: this.getAxisValueText(yAxis, "tooltip", minValue, datum, minKey, legendItemName) + }, + { + label: q1Name, + fallbackLabel: q1Key, + value: this.getAxisValueText(yAxis, "tooltip", q1Value, datum, q1Key, legendItemName) + }, + { + label: medianName, + fallbackLabel: medianKey, + value: this.getAxisValueText(yAxis, "tooltip", medianValue, datum, medianKey, legendItemName) + }, + { + label: q3Name, + fallbackLabel: q3Key, + value: this.getAxisValueText(yAxis, "tooltip", q3Value, datum, q3Key, legendItemName) + }, + { + label: maxName, + fallbackLabel: maxKey, + value: this.getAxisValueText(yAxis, "tooltip", maxValue, datum, maxKey, legendItemName) + } + ]; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + title: legendItemName ?? yName, + symbol: this.legendItemSymbol(), + data + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yName, + medianKey, + medianName, + q1Key, + q1Name, + q3Key, + q3Name, + minKey, + minName, + maxKey, + maxName, + ...format + } + ); + } + animateEmptyUpdateReady({ + datumSelection + }) { + const isVertical = this.isVertical(); + const { from, to } = prepareBoxPlotFromTo(isVertical); + motion.resetMotion([datumSelection], resetBoxPlotSelectionsScalingCenterFn(isVertical)); + motion.staticFromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], from, to, { + phase: "initial" + }); + } + isLabelEnabled() { + return false; + } + updateDatumSelection(opts) { + const data = opts.nodeData ?? []; + return opts.datumSelection.update(data); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + cap: { lengthRatio }, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth, + maxKey, + maxName, + medianKey, + medianName, + minKey, + minName, + q1Key, + q1Name, + q3Key, + q3Name, + whisker: { + lineDash: whiskerLineDash, + lineDashOffset: whiskerLineDashOffset, + stroke: whiskerStroke, + strokeOpacity: whiskerStrokeOpacity, + strokeWidth: whiskerStrokeWidth + }, + xKey, + xName, + yName + } = this.properties; + const highlightState = toHighlightString(highlightStateEnum ?? HighlightState.None); + return { + cap: { lengthRatio }, + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + maxKey, + maxName: maxName ?? maxKey, + medianKey, + medianName: medianName ?? medianKey, + minKey, + minName: minName ?? minKey, + q1Key, + q1Name: q1Name ?? q1Key, + q3Key, + q3Name: q3Name ?? q3Key, + seriesId, + stroke: stroke2, + strokeOpacity, + strokeWidth, + whisker: { + lineDash: whiskerLineDash ?? lineDash, + lineDashOffset: whiskerLineDashOffset ?? lineDashOffset, + stroke: whiskerStroke ?? stroke2, + strokeOpacity: whiskerStrokeOpacity ?? strokeOpacity, + strokeWidth: whiskerStrokeWidth ?? strokeWidth + }, + xKey, + xName: xName ?? xKey, + yName + }; + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cap, + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth, + styler, + whisker + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke2, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + cap: { lengthRatio: stylerResult.cap?.lengthRatio ?? cap.lengthRatio }, + whisker: { + lineDash: stylerResult.whisker?.lineDash ?? whisker.lineDash, + lineDashOffset: stylerResult.whisker?.lineDashOffset ?? whisker.lineDashOffset, + stroke: stylerResult.whisker?.stroke ?? whisker.stroke, + strokeOpacity: stylerResult.whisker?.strokeOpacity ?? whisker.strokeOpacity, + strokeWidth: stylerResult.whisker?.strokeWidth ?? whisker.strokeWidth + } + }; + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style = mergeDefaults4(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults4(overrides, style); + } + } + const { stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = style; + style.whisker = mergeDefaults4(style.whisker, { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + return style; + } + makeItemStylerParams(datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const { xKey, minKey, q1Key, medianKey, q3Key, maxKey } = this.properties; + const datum = this.processedData?.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + minKey, + q1Key, + medianKey, + q3Key, + maxKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((_, nodeDatum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = this.getItemStyle(nodeDatum.datumIndex, isHighlight, highlightState); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const isVertical = this.isVertical(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const fillBBox = this.getShapeFillBBox(); + const strokeAlignment = this.getStyle(false, false, HighlightState.None).strokeWidth / 2; + const wickStrokeAlignment = properties.whisker.strokeWidth ?? properties.strokeWidth; + datumSelection.each((boxPlotNode, nodeDatum) => { + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + applyShapeFillBBox(boxPlotNode, style.fill, fillBBox); + boxPlotNode.fill = style.fill; + boxPlotNode.fillOpacity = style.fillOpacity; + boxPlotNode.stroke = style.stroke; + boxPlotNode.strokeWidth = style.strokeWidth; + boxPlotNode.strokeOpacity = style.strokeOpacity; + boxPlotNode.lineDash = style.lineDash; + boxPlotNode.lineDashOffset = style.lineDashOffset; + boxPlotNode.wickStroke = style.whisker.stroke; + boxPlotNode.wickStrokeWidth = style.whisker.strokeWidth; + boxPlotNode.wickStrokeOpacity = style.whisker.strokeOpacity; + boxPlotNode.wickLineDash = style.whisker.lineDash; + boxPlotNode.wickLineDashOffset = style.whisker.lineDashOffset; + boxPlotNode.cornerRadius = style.cornerRadius; + boxPlotNode.crisp = true; + boxPlotNode.horizontal = !isVertical; + boxPlotNode.center = nodeDatum.scaledValues.xValue; + boxPlotNode.thickness = nodeDatum.bandwidth; + boxPlotNode.min = nodeDatum.scaledValues.minValue; + boxPlotNode.q1 = nodeDatum.scaledValues.q1Value; + boxPlotNode.median = nodeDatum.scaledValues.medianValue; + boxPlotNode.q3 = nodeDatum.scaledValues.q3Value; + boxPlotNode.max = nodeDatum.scaledValues.maxValue; + boxPlotNode.capLengthRatio = style.cap.lengthRatio; + boxPlotNode.strokeAlignment = strokeAlignment; + boxPlotNode.wickStrokeAlignment = wickStrokeAlignment; + }); + } + updateLabelNodes() { + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData); + } + nodeFactory() { + return new BoxPlotNode(); + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds(this, this.contextNodeData?.nodeData[datumIndex].focusRect); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null; + } +}; +BoxPlotSeries.className = "BoxPlotSeries"; +BoxPlotSeries.type = "box-plot"; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeriesOptionsDef.ts +var import_ag_charts_community114 = require("ag-charts-community"); +var import_ag_charts_core55 = require("ag-charts-core"); +var { boxPlotSeriesThemeableOptionsDef, commonSeriesOptionsDefs } = import_ag_charts_community114._ModuleSupport; +var boxPlotSeriesOptionsDef = { + ...commonSeriesOptionsDefs, + ...boxPlotSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core55.required)((0, import_ag_charts_core55.constant)("box-plot")), + xKey: (0, import_ag_charts_core55.required)(import_ag_charts_core55.string), + minKey: (0, import_ag_charts_core55.required)(import_ag_charts_core55.string), + q1Key: (0, import_ag_charts_core55.required)(import_ag_charts_core55.string), + medianKey: (0, import_ag_charts_core55.required)(import_ag_charts_core55.string), + q3Key: (0, import_ag_charts_core55.required)(import_ag_charts_core55.string), + maxKey: (0, import_ag_charts_core55.required)(import_ag_charts_core55.string), + xName: import_ag_charts_core55.string, + yName: import_ag_charts_core55.string, + minName: import_ag_charts_core55.string, + q1Name: import_ag_charts_core55.string, + medianName: import_ag_charts_core55.string, + q3Name: import_ag_charts_core55.string, + maxName: import_ag_charts_core55.string, + grouped: import_ag_charts_core55.boolean, + legendItemName: import_ag_charts_core55.string, + segmentation: import_ag_charts_core55.shapeSegmentation +}; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotThemes.ts +var import_ag_charts_community115 = require("ag-charts-community"); +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE }, + multiSeriesHighlightStyle, + FILL_GRADIENT_LINEAR_DEFAULTS, + FILL_IMAGE_DEFAULTS, + FILL_PATTERN_DEFAULTS, + SAFE_FILL_OPERATION, + SEGMENTATION_DEFAULTS +} = import_ag_charts_community115._ModuleSupport; +var BOX_PLOT_SERIES_THEME = { + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { + $or: [ + { $isGradient: { $palette: "fill" } }, + { $isPattern: { $palette: "fill" } }, + { $isImage: { $palette: "fill" } } + ] + }, + { $palette: "fill" }, + { $mix: [SAFE_FILL_OPERATION, { $ref: "chartBackgroundColor" }, 0.7] } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: 2, + fillOpacity: 1, + strokeOpacity: 1, + lineDash: void 0, + lineDashOffset: 0, + highlight: multiSeriesHighlightStyle(), + segmentation: SEGMENTATION_DEFAULTS + }, + axes: { + [CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE.CATEGORY]: { + groupPaddingInner: 0.2, + crosshair: { + enabled: false, + snap: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotModule.ts +var BoxPlotModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "box-plot", + moduleFactory: (ctx) => new BoxPlotSeries(ctx), + predictAxis: import_ag_charts_community116._ModuleSupport.predictCartesianTimeAxis, + defaultAxes: import_ag_charts_community116._ModuleSupport.DIRECTION_SWAP_AXES, + themeTemplate: BOX_PLOT_SERIES_THEME, + groupable: true +}; +var BoxPlotSeriesModule = { + type: "series", + name: "box-plot", + chartType: "cartesian", + enterprise: true, + options: boxPlotSeriesOptionsDef, + create: (ctx) => new BoxPlotSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickModule.ts +var import_ag_charts_community126 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeries.ts +var import_ag_charts_community123 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesBase.ts +var import_ag_charts_community118 = require("ag-charts-community"); +var import_ag_charts_core56 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcAggregation.ts +var import_ag_charts_community117 = require("ag-charts-community"); +var { + AGGREGATION_SPAN, + AGGREGATION_INDEX_X_MAX, + AGGREGATION_INDEX_X_MIN, + AGGREGATION_INDEX_Y_MAX, + AGGREGATION_INDEX_Y_MIN, + aggregationDomain, + aggregationRangeFittingPoints, + compactAggregationIndices, + createAggregationIndices +} = import_ag_charts_community117._ModuleSupport; +var AGGREGATION_THRESHOLD = 1e3; +var OPEN = AGGREGATION_INDEX_X_MIN; +var HIGH = AGGREGATION_INDEX_Y_MAX; +var LOW = AGGREGATION_INDEX_Y_MIN; +var CLOSE = AGGREGATION_INDEX_X_MAX; +function aggregateOhlcData(scale, xValues, highValues, lowValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD) + return; + const [d0, d1] = aggregationDomain(scale, domain); + let maxRange = aggregationRangeFittingPoints(xValues, d0, d1, { smallestKeyInterval }); + let { indexData, valueData } = createAggregationIndices(xValues, highValues, lowValues, d0, d1, maxRange); + const filters = [{ maxRange, indexData }]; + while (maxRange > 64) { + ({ indexData, valueData, maxRange } = compactAggregationIndices(indexData, valueData, maxRange)); + filters.push({ maxRange, indexData }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesBase.ts +var { + fixNumericExtent: fixNumericExtent3, + keyProperty: keyProperty3, + createDatumId: createDatumId2, + SeriesNodePickMode: SeriesNodePickMode2, + ChartAxisDirection: ChartAxisDirection14, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL2, + valueProperty: valueProperty4, + diff: diff2, + animationValidation: animationValidation2, + computeBarFocusBounds: computeBarFocusBounds2, + visibleRangeIndices, + BandScale, + processedDataIsAnimatable, + mergeDefaults: mergeDefaults5, + simpleMemorize2, + getItemStylesPerItemId +} = import_ag_charts_community118._ModuleSupport; +var memoizedAggregateOhlcData = simpleMemorize2(aggregateOhlcData); +var OhlcSeriesNodeEvent = class extends import_ag_charts_community118._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.openKey = series.properties.openKey; + this.closeKey = series.properties.closeKey; + this.highKey = series.properties.highKey; + this.lowKey = series.properties.lowKey; + } +}; +var OhlcSeriesBase = class extends import_ag_charts_community118._ModuleSupport.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode2.AXIS_ALIGNED, SeriesNodePickMode2.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["lowKey", "highKey", "openKey", "closeKey"] + }, + propertyNames: { + x: ["xName"], + y: ["lowName", "highName", "openName", "closeName"] + }, + categoryKey: "xValue", + pathsPerSeries: [] + }); + this.NodeEvent = OhlcSeriesNodeEvent; + this.dataAggregationFilters = void 0; + } + async processData(dataController) { + if (!this.visible) + return; + const { xKey, openKey, closeKey, highKey, lowKey } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (animationEnabled) { + if (this.processedData) { + extraProps.push(diff2(this.id, this.processedData)); + } + extraProps.push(animationValidation2()); + } + if (openKey) { + extraProps.push( + valueProperty4(openKey, yScaleType, { + id: `openValue`, + invalidValue: void 0, + missingValue: void 0 + }) + ); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty3(xKey, xScaleType, { id: `xValue` }), + valueProperty4(closeKey, yScaleType, { id: `closeValue` }), + valueProperty4(highKey, yScaleType, { id: `highValue` }), + valueProperty4(lowKey, yScaleType, { id: `lowValue` }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL2] : [], + ...extraProps + ] + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.dataAggregationFilters = this.aggregateData( + dataModel, + processedData + ); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection14.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const highValues = dataModel.resolveColumnById(this, `highValue`, processedData); + const lowValues = dataModel.resolveColumnById(this, `lowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateOhlcData( + xAxis.scale.type, + xValues, + highValues, + lowValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + if (direction !== this.getBarDirection()) { + const { index, def } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = processedData.domain.keys[index]; + if (def.type === "key" && def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yExtent = this.domainForClippedRange(direction, ["highValue", "lowValue"], "xValue"); + return fixNumericExtent3(yExtent); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection14.Y, ["highValue", "lowValue"], "xValue", visibleRange); + } + getZoomRangeFittingItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.zoomFittingVisibleItems( + "xValue", + ["highValue", "lowValue"], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + getVisibleItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.countVisibleItems( + "xValue", + ["highValue", "lowValue"], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + createNodeData() { + const { visible, dataModel, processedData } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const nodeData = []; + const { xKey, highKey, lowKey } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const openValues = dataModel.resolveColumnById(this, "openValue", processedData); + const closeValues = dataModel.resolveColumnById(this, "closeValue", processedData); + const highValues = dataModel.resolveColumnById(this, "highValue", processedData); + const lowValues = dataModel.resolveColumnById(this, "lowValue", processedData); + const { groupScale } = this; + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const groupOffset = groupScale.convert(String(groupIndex)); + const effectiveBarWidth = barWidth >= 1 ? barWidth : groupScale.rawBandwidth; + const applyWidthOffset = BandScale.is(xAxis.scale); + const context = { + itemId: xKey, + nodeData, + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStylesPerItemId(this.getItemStyle.bind(this), "up", "down") + }; + if (!visible) + return context; + const handleDatum = (datumIndex, xValue2, openValue, closeValue, highValue, lowValue, width, crisp) => { + const datum = rawData[datumIndex]; + const xOffset = applyWidthOffset ? width / 2 : 0; + const centerX = xAxis.scale.convert(xValue2) + groupOffset + xOffset; + const yOpen = yAxis.scale.convert(openValue); + const yClose = yAxis.scale.convert(closeValue); + const yHigh = yAxis.scale.convert(highValue); + const yLow = yAxis.scale.convert(lowValue); + const isRising = closeValue > openValue; + const itemId = isRising ? "up" : "down"; + const y = Math.min(yHigh, yLow); + const height = Math.max(yHigh, yLow) - y; + const midPoint = { + x: centerX, + y: y + height / 2 + }; + nodeData.push({ + series: this, + itemId, + datum, + datumIndex, + xKey, + xValue: xValue2, + openValue, + closeValue, + highValue, + lowValue, + midPoint, + aggregatedValue: closeValue, + isRising, + centerX, + width, + y, + height, + yOpen, + yClose, + crisp + }); + }; + const { dataAggregationFilters } = this; + const xScale = xAxis.scale; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const xPosition = (index) => xScale.convert(xValues[index]) + groupOffset; + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + if (dataAggregationFilter == null) { + const invalidData = processedData.invalidData?.get(this.id); + let [start, end] = visibleRangeIndices(1, rawData.length, xAxis.range, (index) => { + const xOffset = applyWidthOffset ? 0 : -effectiveBarWidth / 2; + const x = xPosition(index) + xOffset; + return [x, x + effectiveBarWidth]; + }); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let datumIndex = start; datumIndex < end; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const openValue = openValues[datumIndex]; + const closeValue = closeValues[datumIndex]; + const highValue = highValues[datumIndex]; + const lowValue = lowValues[datumIndex]; + const validLowValue = lowValue != null && lowValue <= openValue && lowValue <= closeValue; + const validHighValue = highValue != null && highValue >= openValue && highValue >= closeValue; + if (!validLowValue) { + import_ag_charts_core56.Logger.warnOnce( + `invalid low value for key [${lowKey}] in data element, low value cannot be higher than datum open or close values` + ); + continue; + } + if (!validHighValue) { + import_ag_charts_core56.Logger.warnOnce( + `invalid high value for key [${highKey}] in data element, high value cannot be lower than datum open or close values.` + ); + continue; + } + handleDatum(datumIndex, xValue2, openValue, closeValue, highValue, lowValue, effectiveBarWidth, true); + } + } else { + const { maxRange, indexData } = dataAggregationFilter; + const [start, end] = visibleRangeIndices(1, maxRange, xAxis.range, (index) => { + const aggIndex = index * AGGREGATION_SPAN; + const openIndex = indexData[aggIndex + OPEN]; + const closeIndex = indexData[aggIndex + CLOSE]; + if (openIndex === -1) + return; + const xOffset = applyWidthOffset ? 0 : -effectiveBarWidth / 2; + return [xPosition(openIndex) + xOffset, xPosition(closeIndex) + xOffset + effectiveBarWidth]; + }); + for (let i = start; i < end; i += 1) { + const aggIndex = i * AGGREGATION_SPAN; + const openIndex = indexData[aggIndex + OPEN]; + const closeIndex = indexData[aggIndex + CLOSE]; + const highIndex = indexData[aggIndex + HIGH]; + const lowIndex = indexData[aggIndex + LOW]; + if (openIndex === -1) + continue; + const midDatumIndex = Math.trunc((openIndex + closeIndex) / 2); + const xValue2 = xValues[midDatumIndex]; + if (xValue2 == null) + continue; + const openValue = openValues[openIndex]; + const closeValue = closeValues[closeIndex]; + const highValue = highValues[highIndex]; + const lowValue = lowValues[lowIndex]; + const width = Math.abs(xPosition(closeIndex) - xPosition(openIndex)) + effectiveBarWidth; + handleDatum(midDatumIndex, xValue2, openValue, closeValue, highValue, lowValue, width, false); + } + } + return context; + } + isVertical() { + return true; + } + isLabelEnabled() { + return false; + } + updateDatumSelection(opts) { + const data = opts.nodeData ?? []; + return opts.datumSelection.update(data); + } + updateLabelNodes(_opts) { + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData); + } + getItemStyle(datumIndex, isHighlight, highlightState, itemId = "up") { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + const baseStyle = mergeDefaults5(highlightStyle, properties.getStyle(itemId)); + let style = baseStyle; + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId2(createDatumId2(xValue2), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(itemId, datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`, "item", itemId], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults5(overrides, style); + } + } + return style; + } + makeItemStylerParams(itemId, datumIndex, isHighlight, style) { + const { id: seriesId, properties, processedData } = this; + const { xKey, openKey, closeKey, highKey, lowKey } = properties; + const datum = processedData.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const params = { + seriesId, + datum, + itemId, + xKey, + openKey, + closeKey, + highKey, + lowKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style + }; + if ("fill" in params && "fill" in style) { + params.fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + } + return params; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { + xKey, + xName, + yName, + openKey, + openName, + highKey, + highName, + lowKey, + lowName, + closeKey, + closeName, + legendItemName, + tooltip + } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const openValue = dataModel.resolveColumnById(this, `openValue`, processedData)[datumIndex]; + const highValue = dataModel.resolveColumnById(this, `highValue`, processedData)[datumIndex]; + const lowValue = dataModel.resolveColumnById(this, `lowValue`, processedData)[datumIndex]; + const closeValue = dataModel.resolveColumnById(this, `closeValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const itemId = closeValue >= openValue ? "up" : "down"; + const item = this.properties.item[itemId]; + const format = this.getItemStyle(datumIndex, false); + const marker = { + fill: item.fill ?? item.stroke, + fillOpacity: item.fillOpacity ?? item.strokeOpacity ?? 1, + stroke: item.stroke, + strokeWidth: item.strokeWidth ?? 1, + strokeOpacity: item.strokeOpacity ?? 1, + lineDash: item.lineDash ?? [0], + lineDashOffset: item.lineDashOffset ?? 0 + }; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + title: legendItemName, + symbol: { + marker + }, + data: [ + { + label: openName, + fallbackLabel: openKey, + value: this.getAxisValueText(yAxis, "tooltip", openValue, datum, openKey, legendItemName) + }, + { + label: highName, + fallbackLabel: highKey, + value: this.getAxisValueText(yAxis, "tooltip", highValue, datum, highKey, legendItemName) + }, + { + label: lowName, + fallbackLabel: lowKey, + value: this.getAxisValueText(yAxis, "tooltip", lowValue, datum, lowKey, legendItemName) + }, + { + label: closeName, + fallbackLabel: closeKey, + value: this.getAxisValueText(yAxis, "tooltip", closeValue, datum, closeKey, legendItemName) + } + ] + }, + { + seriesId, + datum, + title: yName, + itemId, + xKey, + xName, + yName, + openKey, + openName, + highKey, + highName, + lowKey, + lowName, + closeKey, + closeName, + ...format + } + ); + } + computeFocusBounds(opts) { + const nodeDatum = this.getNodeData()?.at(opts.datumIndex); + if (nodeDatum == null) + return; + const { centerX, y, width, height } = nodeDatum; + const datum = { + x: centerX - width / 2, + y, + width, + height + }; + return computeBarFocusBounds2(this, datum); + } +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickNode.ts +var import_ag_charts_community120 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcNode.ts +var import_ag_charts_community119 = require("ag-charts-community"); +var { Path: Path8, SceneChangeDetection: SceneChangeDetection5, BBox: BBox11 } = import_ag_charts_community119._ModuleSupport; +var OhlcBaseNode = class extends Path8 { + constructor() { + super(...arguments); + this.centerX = 0; + this.y = 0; + this.width = 0; + this.height = 0; + this.yOpen = 0; + this.yClose = 0; + this.crisp = false; + } + computeBBox() { + const { centerX, y, width, height } = this; + return new BBox11(centerX - width / 2, y, width, height); + } + isPointInPath(x, y) { + return this.getBBox().containsPoint(x, y); + } + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } + get midPoint() { + return { x: this.centerX, y: this.y + this.height / 2 }; + } + alignedCoordinates() { + const { y, width, height, crisp } = this; + let { centerX, yOpen, yClose } = this; + let x0 = centerX - width / 2; + let x1 = centerX + width / 2; + let y0 = y; + let y1 = y + height; + if (crisp && width > 1) { + centerX = this.align(centerX); + if (yOpen <= yClose) { + const h = this.align(yOpen, yClose - yOpen); + yOpen = this.align(yOpen); + yClose = yOpen + h; + } else { + const h = this.align(yClose, yOpen - yClose); + yClose = this.align(yClose); + yOpen = yClose + h; + } + const halfWidth = this.align(width / 2); + x0 = centerX - halfWidth; + x1 = centerX + halfWidth; + y0 = this.align(y); + y1 = y0 + this.align(y0, height); + } + return { centerX, x0, x1, y0, y1, yOpen, yClose }; + } + executeStroke(ctx, path) { + const { width, strokeWidth } = this; + if (width < strokeWidth) { + ctx.lineWidth = width; + } + super.executeStroke(ctx, path); + } +}; +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "centerX", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "y", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "width", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "height", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "yOpen", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "yClose", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "crisp", 2); +var OhlcNode = class extends OhlcBaseNode { + constructor() { + super(...arguments); + this.strokeAlignment = 0; + } + updatePath() { + const { path } = this; + const { centerX, x0, x1, y0, y1, yOpen, yClose } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const strokeAlignment = this.strokeAlignment > 0 ? pixelRatio / this.strokeAlignment / 2 % 1 : 0; + path.clear(); + path.moveTo(centerX - strokeAlignment, y0); + path.lineTo(centerX - strokeAlignment, y1); + if (Math.abs(x1 - x0) > 1) { + path.moveTo(x0, yOpen - strokeAlignment); + path.lineTo(centerX - strokeAlignment, yOpen - strokeAlignment); + path.moveTo(centerX - strokeAlignment, yClose - strokeAlignment); + path.lineTo(x1, yClose - strokeAlignment); + } + } +}; +__decorateClass([ + SceneChangeDetection5() +], OhlcNode.prototype, "strokeAlignment", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickNode.ts +var { SceneArrayChangeDetection: SceneArrayChangeDetection2, SceneChangeDetection: SceneChangeDetection6, ExtendedPath2D: ExtendedPath2D4, BBox: BBox12 } = import_ag_charts_community120._ModuleSupport; +var CandlestickNode = class extends OhlcBaseNode { + constructor() { + super(...arguments); + this.wickPath = new ExtendedPath2D4(); + this.wickStroke = void 0; + this.wickStrokeWidth = void 0; + this.wickStrokeOpacity = void 0; + this.wickStrokeAlignment = 0; + } + computeDefaultGradientFillBBox() { + const { width, centerX, yOpen, yClose } = this; + const boxTop = Math.min(yOpen, yClose); + const boxBottom = Math.max(yOpen, yClose); + const rectHeight = boxBottom - boxTop; + const x0 = centerX - width / 2; + const x1 = centerX + width / 2; + return new BBox12(x0, boxTop, x1 - x0, rectHeight); + } + updatePath() { + const { + path, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke, + wickStrokeWidth, + wickStrokeOpacity, + wickLineDash, + wickLineDashOffset + } = this; + const { centerX, x0, x1, y0, y1, yOpen, yClose } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const wickStrokeAlignment = this.wickStrokeAlignment > 0 ? pixelRatio / this.wickStrokeAlignment / 2 % 1 : 0; + this.path.clear(); + this.wickPath.clear(); + const needsWickPath = wickStroke != null && wickStroke !== stroke2 || wickStrokeWidth != null && wickStrokeWidth !== strokeWidth || wickStrokeOpacity != null && wickStrokeOpacity !== strokeOpacity || wickLineDash != null && wickLineDash !== lineDash || wickLineDashOffset != null && wickLineDashOffset !== lineDashOffset; + const wickPath = needsWickPath ? this.wickPath : path; + if (Math.abs(x1 - x0) <= 3) { + wickPath.moveTo(centerX - wickStrokeAlignment, y0); + wickPath.lineTo(centerX - wickStrokeAlignment, y1); + return; + } + const boxTop = Math.min(yOpen, yClose); + const boxBottom = Math.max(yOpen, yClose); + const boxStrokeAdjustment = strokeWidth / 2; + wickPath.moveTo(centerX - wickStrokeAlignment, y0); + wickPath.lineTo(centerX - wickStrokeAlignment, boxTop + boxStrokeAdjustment); + wickPath.moveTo(centerX - wickStrokeAlignment, y1); + wickPath.lineTo(centerX - wickStrokeAlignment, boxBottom - boxStrokeAdjustment); + const rectHeight = boxBottom - boxTop - 2 * boxStrokeAdjustment; + if (rectHeight > 0) { + path.rect( + x0 + boxStrokeAdjustment, + boxTop + boxStrokeAdjustment, + x1 - x0 - 2 * boxStrokeAdjustment, + rectHeight + ); + } else { + const boxMid = (boxTop + boxBottom) / 2; + path.moveTo(x0, boxMid); + path.lineTo(x1, boxMid); + } + } + drawPath(ctx) { + super.drawPath(ctx); + const { wickPath } = this; + if (wickPath.isEmpty()) + return; + const { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke = stroke2, + wickStrokeWidth = strokeWidth, + wickStrokeOpacity = strokeOpacity, + wickLineDash = lineDash, + wickLineDashOffset = lineDashOffset + } = this; + if (wickStrokeWidth === 0) + return; + ctx.globalAlpha *= wickStrokeOpacity; + if (typeof wickStroke === "string") { + ctx.strokeStyle = wickStroke; + } + ctx.lineWidth = wickStrokeWidth; + if (wickLineDash != null) { + ctx.setLineDash([...wickLineDash]); + } + ctx.lineDashOffset = wickLineDashOffset; + ctx.stroke(wickPath.getPath2D()); + } +}; +__decorateClass([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStroke", 2); +__decorateClass([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStrokeWidth", 2); +__decorateClass([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStrokeOpacity", 2); +__decorateClass([ + SceneArrayChangeDetection2() +], CandlestickNode.prototype, "wickLineDash", 2); +__decorateClass([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickLineDashOffset", 2); +__decorateClass([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStrokeAlignment", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesProperties.ts +var import_ag_charts_community122 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesProperties.ts +var import_ag_charts_community121 = require("ag-charts-community"); +var { BaseProperties: BaseProperties16, Property: Property49, AbstractBarSeriesProperties: AbstractBarSeriesProperties2, makeSeriesTooltip: makeSeriesTooltip2 } = import_ag_charts_community121._ModuleSupport; +var OhlcSeriesItem = class extends BaseProperties16 { + constructor() { + super(...arguments); + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property49 +], OhlcSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property49 +], OhlcSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property49 +], OhlcSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property49 +], OhlcSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property49 +], OhlcSeriesItem.prototype, "lineDashOffset", 2); +var OhlcSeriesItems = class extends BaseProperties16 { + constructor() { + super(...arguments); + this.up = new OhlcSeriesItem(); + this.down = new OhlcSeriesItem(); + } +}; +__decorateClass([ + Property49 +], OhlcSeriesItems.prototype, "up", 2); +__decorateClass([ + Property49 +], OhlcSeriesItems.prototype, "down", 2); +var OhlcSeriesBaseProperties = class extends AbstractBarSeriesProperties2 { +}; +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "xKey", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "openKey", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "closeKey", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "highKey", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "lowKey", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "xName", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "yName", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "openName", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "closeName", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "highName", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "lowName", 2); +var OhlcSeriesProperties = class extends OhlcSeriesBaseProperties { + constructor() { + super(...arguments); + this.tooltip = makeSeriesTooltip2(); + this.item = new OhlcSeriesItems(); + } + getStyle(itemId) { + const { strokeWidth, strokeOpacity, stroke: stroke2, lineDash, lineDashOffset } = this.item[itemId]; + return { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property49 +], OhlcSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property49 +], OhlcSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property49 +], OhlcSeriesProperties.prototype, "itemStyler", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesProperties.ts +var { BaseProperties: BaseProperties17, makeSeriesTooltip: makeSeriesTooltip3, Property: Property50 } = import_ag_charts_community122._ModuleSupport; +var CandlestickSeriesWick = class extends BaseProperties17 { +}; +__decorateClass([ + Property50 +], CandlestickSeriesWick.prototype, "stroke", 2); +__decorateClass([ + Property50 +], CandlestickSeriesWick.prototype, "strokeWidth", 2); +__decorateClass([ + Property50 +], CandlestickSeriesWick.prototype, "strokeOpacity", 2); +__decorateClass([ + Property50 +], CandlestickSeriesWick.prototype, "lineDash", 2); +__decorateClass([ + Property50 +], CandlestickSeriesWick.prototype, "lineDashOffset", 2); +var CandlestickSeriesItem = class extends BaseProperties17 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.wick = new CandlestickSeriesWick(); + } +}; +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "fill", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "fillOpacity", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "lineDashOffset", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "cornerRadius", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "wick", 2); +var CandlestickSeriesItems = class extends BaseProperties17 { + constructor() { + super(...arguments); + this.up = new CandlestickSeriesItem(); + this.down = new CandlestickSeriesItem(); + } +}; +__decorateClass([ + Property50 +], CandlestickSeriesItems.prototype, "up", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItems.prototype, "down", 2); +var CandlestickSeriesProperties = class extends OhlcSeriesBaseProperties { + constructor() { + super(); + this.item = new CandlestickSeriesItems(); + this.tooltip = makeSeriesTooltip3(); + this.highlightStyle.deprecated = false; + } + getStyle(itemId) { + const { fill, fillOpacity, strokeWidth, strokeOpacity, stroke: stroke2, lineDash, lineDashOffset, cornerRadius, wick } = this.item[itemId]; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1, + wick + }; + } +}; +__decorateClass([ + Property50 +], CandlestickSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property50 +], CandlestickSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property50 +], CandlestickSeriesProperties.prototype, "itemStyler", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeries.ts +var { isGradientFill, isPatternFill, isImageFill, applyShapeStyle } = import_ag_charts_community123._ModuleSupport; +var CandlestickSeries = class extends OhlcSeriesBase { + constructor() { + super(...arguments); + this.properties = new CandlestickSeriesProperties(); + } + nodeFactory() { + const node = new CandlestickNode(); + node.lineCap = "butt"; + return node; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { up, down } = properties.item; + datumSelection.each((node, datum) => { + const { centerX, width, y, height, yOpen, yClose, crisp } = datum; + const baseStyle = datum.isRising ? up : down; + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + node.centerX = centerX; + node.width = width; + node.y = y; + node.height = height; + node.yOpen = yOpen; + node.yClose = yClose; + node.crisp = crisp; + applyShapeStyle(node, style, this.getShapeFillBBox()); + const styleWick = style?.wick; + node.wickStroke = styleWick?.stroke; + node.wickStrokeWidth = styleWick?.strokeWidth; + node.wickStrokeOpacity = styleWick?.strokeOpacity; + node.wickLineDash = styleWick?.lineDash; + node.wickLineDashOffset = styleWick?.lineDashOffset; + node.wickStrokeAlignment = baseStyle.wick.strokeWidth ?? baseStyle.strokeWidth; + }); + } + legendItemSymbol() { + const { up, down } = this.properties.item; + const upColorStops = isGradientFill(up.fill) ? up.fill.colorStops.map( + (c) => typeof c === "string" ? c : { color: c.color, stop: c.stop == null ? void 0 : c.stop * 0.5 } + ) : [ + { color: isPatternFill(up.fill) || isImageFill(up.fill) ? up.stroke : up.fill, stop: 0 }, + { color: isPatternFill(up.fill) || isImageFill(up.fill) ? up.stroke : up.fill, stop: 0.5 } + ]; + const downColorStops = isGradientFill(down.fill) ? down.fill.colorStops.map( + (c) => typeof c === "string" ? c : { color: c.color, stop: c.stop == null ? void 0 : c.stop * 0.5 } + ) : [{ color: isPatternFill(down.fill) || isImageFill(down.fill) ? down.stroke : down.fill, stop: 0.5 }]; + const fill = { + type: "gradient", + gradient: "linear", + rotation: 90, + colorStops: [...upColorStops, ...downColorStops], + reverse: false + }; + const stroke2 = { + type: "gradient", + gradient: "linear", + rotation: 90, + colorStops: [ + { color: up.stroke, stop: 0 }, + { color: up.stroke, stop: 0.5 }, + { color: down.stroke, stop: 0.5 } + ], + reverse: false + }; + return { + marker: { + fill, + fillOpacity: up.fillOpacity, + stroke: stroke2, + strokeWidth: up.strokeWidth ?? 1, + strokeOpacity: up.strokeOpacity ?? 1, + lineDash: up.lineDash, + lineDashOffset: up.lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id, + data, + visible, + ctx: { legendManager } + } = this; + const { xKey, yName, showInLegend, legendItemName } = this.properties; + if (!data?.data.length || !xKey || legendType !== "category") { + return []; + } + return [ + { + legendType: "category", + id, + itemId: id, + seriesId: id, + enabled: visible && legendManager.getItemEnabled({ seriesId: id, itemId: id }), + label: { + text: legendItemName ?? yName ?? id + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + hasItemStylers() { + return this.properties.itemStyler != null; + } +}; +CandlestickSeries.className = "CandleStickSeries"; +CandlestickSeries.type = "candlestick"; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesOptionsDef.ts +var import_ag_charts_community124 = require("ag-charts-community"); +var import_ag_charts_core57 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs2, candlestickSeriesThemeableOptionsDef } = import_ag_charts_community124._ModuleSupport; +var candlestickSeriesOptionsDef = { + ...commonSeriesOptionsDefs2, + ...candlestickSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core57.required)((0, import_ag_charts_core57.constant)("candlestick")), + xKey: (0, import_ag_charts_core57.required)(import_ag_charts_core57.string), + openKey: (0, import_ag_charts_core57.required)(import_ag_charts_core57.string), + highKey: (0, import_ag_charts_core57.required)(import_ag_charts_core57.string), + lowKey: (0, import_ag_charts_core57.required)(import_ag_charts_core57.string), + closeKey: (0, import_ag_charts_core57.required)(import_ag_charts_core57.string), + xName: import_ag_charts_core57.string, + yName: import_ag_charts_core57.string, + openName: import_ag_charts_core57.string, + highName: import_ag_charts_core57.string, + lowName: import_ag_charts_core57.string, + closeName: import_ag_charts_core57.string +}; +candlestickSeriesOptionsDef.pickOutsideVisibleMinorAxis = (0, import_ag_charts_core57.undocumented)(import_ag_charts_core57.boolean); +candlestickSeriesOptionsDef.focusPriority = (0, import_ag_charts_core57.undocumented)(import_ag_charts_core57.number); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickThemes.ts +var import_ag_charts_community125 = require("ag-charts-community"); +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE2 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle2, + FILL_GRADIENT_LINEAR_KEYED_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS2, + FILL_PATTERN_KEYED_DEFAULTS +} = import_ag_charts_community125._ModuleSupport; +function itemTheme(key) { + return { + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + key === "up" ? "transparent" : { $palette: "fill" }, + { $palette: `${key}.fill` } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_KEYED_DEFAULTS(key)], + ["image", FILL_IMAGE_DEFAULTS2], + ["pattern", FILL_PATTERN_KEYED_DEFAULTS(key)] + ] + }, + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: `${key}.stroke` } + ] + } + }; +} +var CANDLESTICK_SERIES_THEME = { + series: { + item: { + up: itemTheme("up"), + down: itemTheme("down") + }, + highlightStyle: { + item: { strokeWidth: 3 } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: multiSeriesHighlightStyle2() + }, + animation: { enabled: false }, + axes: { + [CARTESIAN_AXIS_TYPE2.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE2.ORDINAL_TIME]: { + groupPaddingInner: 0, + crosshair: { + enabled: true + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickModule.ts +var { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE3, CARTESIAN_POSITION } = import_ag_charts_community126._ModuleSupport.ThemeConstants; +var CandlestickModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "candlestick", + moduleFactory: (ctx) => new CandlestickSeries(ctx), + defaultAxes: [ + { + type: CARTESIAN_AXIS_TYPE3.NUMBER, + position: CARTESIAN_POSITION.LEFT + }, + { + type: CARTESIAN_AXIS_TYPE3.ORDINAL_TIME, + position: CARTESIAN_POSITION.BOTTOM + } + ], + themeTemplate: CANDLESTICK_SERIES_THEME, + groupable: false +}; +var CandlestickSeriesModule = { + type: "series", + name: "candlestick", + chartType: "cartesian", + enterprise: true, + options: candlestickSeriesOptionsDef, + create: (ctx) => new CandlestickSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapModule.ts +var import_ag_charts_community132 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeries.ts +var import_ag_charts_community129 = require("ag-charts-community"); +var import_ag_charts_core59 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/util/labelFormatter.ts +var import_ag_charts_core58 = require("ag-charts-core"); +function generateLabelSecondaryLabelFontSizeCandidates(label, secondaryLabel) { + const { fontSize: labelFontSize, minimumFontSize: labelMinimumFontSize = labelFontSize } = label; + const { + fontSize: secondaryLabelFontSize, + minimumFontSize: secondaryLabelMinimumFontSize = secondaryLabelFontSize + } = secondaryLabel; + const labelTracks = labelFontSize - labelMinimumFontSize; + const secondaryLabelTracks = secondaryLabelFontSize - secondaryLabelMinimumFontSize; + let currentLabelFontSize = label.fontSize; + let currentSecondaryLabelFontSize = secondaryLabel.fontSize; + const out = [{ labelFontSize, secondaryLabelFontSize }]; + while (currentLabelFontSize > labelMinimumFontSize || currentSecondaryLabelFontSize > secondaryLabelMinimumFontSize) { + const labelProgress = labelTracks > 0 ? (currentLabelFontSize - labelMinimumFontSize) / labelTracks : -1; + const secondaryLabelProgress = secondaryLabelTracks > 0 ? (currentSecondaryLabelFontSize - secondaryLabelMinimumFontSize) / secondaryLabelTracks : -1; + if (labelProgress > secondaryLabelProgress) { + currentLabelFontSize--; + } else { + currentSecondaryLabelFontSize--; + } + out.push({ + labelFontSize: currentLabelFontSize, + secondaryLabelFontSize: currentSecondaryLabelFontSize + }); + } + out.reverse(); + return out; +} +function formatStackedLabels(labelValue, labelProps, secondaryLabelValue, secondaryLabelProps, { padding }, sizeFittingHeight) { + const { spacing = 0 } = labelProps; + const widthAdjust = 2 * padding; + const heightAdjust = 2 * padding + spacing; + const minimumHeight = (labelProps.minimumFontSize ?? labelProps.fontSize) + (secondaryLabelProps.minimumFontSize ?? secondaryLabelProps.fontSize); + if (minimumHeight > sizeFittingHeight(minimumHeight + heightAdjust, false).height - heightAdjust) + return; + const fontSizeCandidates = generateLabelSecondaryLabelFontSizeCandidates(labelProps, secondaryLabelProps); + const labelTextSizeProps = { + fontFamily: labelProps.fontFamily, + fontStyle: labelProps.fontStyle, + fontWeight: labelProps.fontWeight + }; + const secondaryLabelTextSizeProps = { + fontFamily: secondaryLabelProps.fontFamily, + fontStyle: secondaryLabelProps.fontStyle, + fontWeight: secondaryLabelProps.fontWeight + }; + let label; + let secondaryLabel; + return (0, import_ag_charts_core58.findMaxValue)(0, fontSizeCandidates.length - 1, (index) => { + const { labelFontSize, secondaryLabelFontSize } = fontSizeCandidates[index]; + const allowTruncation = index === 0; + const labelFont = { ...labelTextSizeProps, fontSize: labelFontSize }; + const secondaryLabelFont = { ...secondaryLabelTextSizeProps, fontSize: secondaryLabelFontSize }; + const labelLineHeight = (0, import_ag_charts_core58.cachedTextMeasurer)(labelFont).lineHeight(); + const secondaryLabelLineHeight = (0, import_ag_charts_core58.cachedTextMeasurer)(secondaryLabelFont).lineHeight(); + const sizeFitting = sizeFittingHeight( + labelLineHeight + secondaryLabelLineHeight + heightAdjust, + allowTruncation + ); + const availableWidth = sizeFitting.width - widthAdjust; + const availableHeight = sizeFitting.height - heightAdjust; + if (labelLineHeight + secondaryLabelLineHeight > availableHeight) + return; + if (label == null || label.fontSize !== labelFontSize) { + label = wrapLabel( + labelProps, + labelValue, + availableWidth, + availableHeight, + labelFont, + labelProps.wrapping, + allowTruncation ? labelProps.overflowStrategy : "hide" + ); + } + if (label == null || label.width > availableWidth || label.height > availableHeight) + return; + if (secondaryLabel == null || secondaryLabel.fontSize !== secondaryLabelFontSize) { + secondaryLabel = wrapLabel( + secondaryLabelProps, + secondaryLabelValue, + availableWidth, + availableHeight, + secondaryLabelFont, + secondaryLabelProps.wrapping, + allowTruncation ? secondaryLabelProps.overflowStrategy : "hide" + ); + } + if (secondaryLabel == null) + return; + const totalLabelHeight = label.height + secondaryLabel.height; + if (secondaryLabel.width > availableWidth || totalLabelHeight > availableHeight) + return; + return { + width: Math.max(label.width, secondaryLabel.width), + height: totalLabelHeight + spacing, + meta: sizeFitting.meta, + label, + secondaryLabel + }; + }); +} +function formatSingleLabel(value, props, { padding }, sizeFittingHeight) { + const sizeAdjust = 2 * padding; + const minimumFontSize = Math.min(props.minimumFontSize ?? props.fontSize, props.fontSize); + const textSizeProps = { + fontFamily: props.fontFamily, + fontStyle: props.fontStyle, + fontWeight: props.fontWeight + }; + return (0, import_ag_charts_core58.findMaxValue)(minimumFontSize, props.fontSize, (fontSize) => { + const currentFont = { ...textSizeProps, fontSize }; + const measurer2 = (0, import_ag_charts_core58.cachedTextMeasurer)(currentFont); + const allowTruncation = fontSize === minimumFontSize; + const lineHeight = props.lineHeight ?? measurer2.lineHeight(); + const sizeFitting = sizeFittingHeight(lineHeight + sizeAdjust, allowTruncation); + const availableWidth = sizeFitting.width - sizeAdjust; + const availableHeight = sizeFitting.height - sizeAdjust; + if (lineHeight > availableHeight || availableWidth < 0) + return; + const lines = (0, import_ag_charts_core58.wrapLines)(value, { + maxWidth: availableWidth, + maxHeight: availableHeight, + font: currentFont, + textWrap: props.wrapping, + overflow: (allowTruncation ? props.overflowStrategy : null) ?? "hide" + }); + if (!lines.length) + return; + const { width, height } = measurer2.measureLines(lines); + const text2 = lines.join("\n"); + return [{ width, height, text: text2, fontSize, lineHeight }, sizeFitting.meta]; + }); +} +function hasInvalidFontSize(label) { + return label?.minimumFontSize != null && label?.fontSize != null && label?.minimumFontSize > label?.fontSize; +} +function formatLabels(baseLabelValue, labelProps, baseSecondaryLabelValue, secondaryLabelProps, layoutParams, sizeFittingHeight) { + const labelValue = labelProps.enabled ? baseLabelValue : void 0; + const secondaryLabelValue = secondaryLabelProps.enabled ? baseSecondaryLabelValue : void 0; + if (hasInvalidFontSize(labelProps) || hasInvalidFontSize(secondaryLabelProps)) { + import_ag_charts_core58.Logger.warnOnce(`minimumFontSize should be set to a value less than or equal to the font size`); + } + let value; + if (labelValue != null && secondaryLabelValue != null) { + value = formatStackedLabels( + labelValue, + labelProps, + secondaryLabelValue, + secondaryLabelProps, + layoutParams, + sizeFittingHeight + ); + } + let labelMeta; + if (value == null && labelValue != null) { + labelMeta = formatSingleLabel(labelValue, labelProps, layoutParams, sizeFittingHeight); + } + if (labelMeta != null) { + const [label, meta] = labelMeta; + value = { + width: label.width, + height: label.height, + meta, + label, + secondaryLabel: void 0 + }; + } + let secondaryLabelMeta; + if (value == null && labelValue == null && secondaryLabelValue != null) { + secondaryLabelMeta = formatSingleLabel( + secondaryLabelValue, + secondaryLabelProps, + layoutParams, + sizeFittingHeight + ); + } + if (secondaryLabelMeta != null) { + const [secondaryLabel, meta] = secondaryLabelMeta; + value = { + width: secondaryLabel.width, + height: secondaryLabel.height, + meta, + label: void 0, + secondaryLabel + }; + } + return value; +} +function wrapLabel(props, text2, maxWidth, maxHeight, font2, textWrap, overflow) { + const lines = (0, import_ag_charts_core58.wrapLines)(text2, { maxWidth, maxHeight, font: font2, textWrap, overflow }); + if (!lines.length) + return; + const measurer2 = (0, import_ag_charts_core58.cachedTextMeasurer)(font2); + const lineHeight = props.lineHeight ?? measurer2.lineHeight(); + const { width } = measurer2.measureLines(lines); + return { + width, + lineHeight, + text: lines.join("\n"), + height: lines.length * lineHeight, + fontSize: font2.fontSize + }; +} + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesProperties.ts +var import_ag_charts_community128 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/util/autoSizedLabel.ts +var import_ag_charts_community127 = require("ag-charts-community"); +var { Property: Property51 } = import_ag_charts_community127._ModuleSupport; +var BaseAutoSizedLabel = class extends import_ag_charts_community127._ModuleSupport.Label { + constructor() { + super(...arguments); + this.wrapping = "on-space"; + this.overflowStrategy = "ellipsis"; + } +}; +__decorateClass([ + Property51 +], BaseAutoSizedLabel.prototype, "wrapping", 2); +__decorateClass([ + Property51 +], BaseAutoSizedLabel.prototype, "overflowStrategy", 2); +__decorateClass([ + Property51 +], BaseAutoSizedLabel.prototype, "lineHeight", 2); +__decorateClass([ + Property51 +], BaseAutoSizedLabel.prototype, "minimumFontSize", 2); +var AutoSizedLabel = class extends BaseAutoSizedLabel { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property51 +], AutoSizedLabel.prototype, "spacing", 2); +var AutoSizedSecondaryLabel = class extends BaseAutoSizedLabel { +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesProperties.ts +var { CartesianSeriesProperties, makeSeriesTooltip: makeSeriesTooltip4, Property: Property52 } = import_ag_charts_community128._ModuleSupport; +var HeatmapSeriesProperties = class extends CartesianSeriesProperties { + constructor() { + super(...arguments); + this.colorRange = ["black", "black"]; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.itemPadding = 0; + this.label = new AutoSizedLabel(); + this.tooltip = makeSeriesTooltip4(); + } +}; +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "textAlign", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "verticalAlign", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "itemPadding", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode3, + computeBarFocusBounds: computeBarFocusBounds3, + getMissCount, + valueProperty: valueProperty5, + ChartAxisDirection: ChartAxisDirection15, + DEFAULT_CARTESIAN_DIRECTION_KEYS, + DEFAULT_CARTESIAN_DIRECTION_NAMES, + createDatumId: createDatumId3, + ColorScale, + Rect, + PointerEvents, + applyShapeStyle: applyShapeStyle2, + mergeDefaults: mergeDefaults6, + formatValue, + addHitTestersToQuadtree, + findQuadtreeMatch, + updateLabelNode +} = import_ag_charts_community129._ModuleSupport; +var HeatmapSeriesNodeEvent = class extends import_ag_charts_community129._ModuleSupport.CartesianSeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.colorKey = series.properties.colorKey; + } +}; +var textAlignFactors = { + left: -0.5, + center: 0, + right: -0.5 +}; +var verticalAlignFactors = { + top: -0.5, + middle: 0, + bottom: -0.5 +}; +var HeatmapSeries = class extends import_ag_charts_community129._ModuleSupport.CartesianSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: { + ...DEFAULT_CARTESIAN_DIRECTION_KEYS, + color: ["colorKey"] + }, + propertyNames: { + ...DEFAULT_CARTESIAN_DIRECTION_NAMES, + color: ["colorName"] + }, + categoryKey: void 0, + pickModes: [SeriesNodePickMode3.NEAREST_NODE, SeriesNodePickMode3.EXACT_SHAPE_MATCH], + pathsPerSeries: [] + }); + this.properties = new HeatmapSeriesProperties(); + this.NodeEvent = HeatmapSeriesNodeEvent; + this.colorScale = new ColorScale(); + } + async processData(dataController) { + const xAxis = this.axes[ChartAxisDirection15.X]; + const yAxis = this.axes[ChartAxisDirection15.Y]; + if (!xAxis || !yAxis || !this.data?.data.length) { + return; + } + const { xKey, yKey, colorRange, colorKey } = this.properties; + const xScale = this.axes[ChartAxisDirection15.X]?.scale; + const yScale = this.axes[ChartAxisDirection15.Y]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const colorScaleType = this.colorScale.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty5(xKey, xScaleType, { id: "xValue" }), + valueProperty5(yKey, yScaleType, { id: "yValue" }), + ...colorKey ? [valueProperty5(colorKey, colorScaleType, { id: "colorValue", invalidValue: void 0 })] : [] + ] + }); + if (this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const rawDomain = processedData.domain.values[colorKeyIdx].filter((v) => v != null); + const domain = import_ag_charts_community129._ModuleSupport.extent(rawDomain); + this.colorScale.domain = domain ?? []; + if (domain?.length && domain[0] === domain[1]) { + const midIndex = Math.floor(colorRange.length / 2); + this.colorScale.range = [colorRange[midIndex], colorRange[midIndex]]; + } else { + this.colorScale.range = colorRange; + } + this.colorScale.update(); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorDataIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount(this, processedData.defs.values[colorDataIdx].missing); + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const actualCount = processedData.domain.values[colorKeyIdx].filter((v) => v != null).length; + const colorDataMissing = dataCount === 0 || dataCount === missCount || actualCount === 0; + return !colorDataMissing; + } + xCoordinateRange(xValue2, pixelSize) { + const xScale = this.axes[ChartAxisDirection15.X].scale; + const xOffset = pixelSize * (xScale.bandwidth ?? 0) / 2; + const x = xScale.convert(xValue2) + xOffset; + const width = pixelSize * (xScale.bandwidth ?? 10); + return [x, x + width]; + } + yCoordinateRange(yValues, pixelSize) { + const yScale = this.axes[ChartAxisDirection15.Y].scale; + const yOffset = pixelSize * (yScale.bandwidth ?? 0) / 2; + const y = yScale.convert(yValues[0]) + yOffset; + const height = pixelSize * (yScale.bandwidth ?? 10); + return [y, y + height]; + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) + return []; + if (direction === ChartAxisDirection15.X) { + return dataModel.getDomain(this, `xValue`, "value", processedData); + } else { + return dataModel.getDomain(this, `yValue`, "value", processedData); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { data, visible, axes, dataModel, processedData } = this; + const xAxis = axes[ChartAxisDirection15.X]; + const yAxis = axes[ChartAxisDirection15.Y]; + if (!(data && dataModel && processedData && visible && xAxis && yAxis)) + return; + if (xAxis.type !== "category" || yAxis.type !== "category") { + import_ag_charts_core59.Logger.warnOnce( + `Heatmap series expected axes to have "category" type, but received "${xAxis.type}" and "${yAxis.type}" instead.` + ); + return; + } + const { xKey, xName, yKey, yName, colorKey, colorName, textAlign, verticalAlign, itemPadding, label } = this.properties; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const colorValues = colorKey ? dataModel.resolveColumnById(this, `colorValue`, processedData) : void 0; + const colorDomain = colorKey ? dataModel.getDomain(this, "colorValue", "value", processedData) : []; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const yOffset = (yScale.bandwidth ?? 0) / 2; + const nodeData = []; + const labelData = []; + const width = xScale.bandwidth ?? 10; + const height = yScale.bandwidth ?? 10; + const textAlignFactor = (width - 2 * itemPadding) * textAlignFactors[textAlign]; + const verticalAlignFactor = (height - 2 * itemPadding) * verticalAlignFactors[verticalAlign]; + const sizeFittingHeight = () => ({ width, height, meta: null }); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xDatum = xValues[datumIndex]; + const yDatum = yValues[datumIndex]; + const x = xScale.convert(xDatum) + xOffset; + const y = yScale.convert(yDatum) + yOffset; + const colorValue = colorValues?.[datumIndex]; + const labelText = label.enabled && colorValue != null ? this.getLabelText( + colorValue, + datum, + colorKey, + "color", + colorDomain, + label, + { value: colorValue, datum, colorKey, colorName, xKey, yKey, xName, yName } + ) : void 0; + const labels = formatLabels( + (0, import_ag_charts_core59.toPlainText)(labelText), + this.properties.label, + void 0, + this.properties.label, + { padding: itemPadding }, + sizeFittingHeight + ); + const point = { x, y, size: 0 }; + const style = this.getItemStyle({ datumIndex, datum, colorValue }, false); + nodeData.push({ + series: this, + itemId: yKey, + datumIndex, + yKey, + xKey, + xValue: xDatum, + yValue: yDatum, + colorValue, + datum, + point, + width, + height, + midPoint: { x, y }, + missing: colorValues != null && colorValue == null, + style + }); + if (labels?.label != null) { + const { text: text2, fontSize, lineHeight, height: labelHeight } = labels.label; + const { fontStyle, fontFamily, fontWeight, color: color6 } = this.properties.label; + const lx = point.x + textAlignFactor * (width - 2 * itemPadding); + const ly = point.y + verticalAlignFactor * (height - 2 * itemPadding) - (labels.height - labelHeight) * 0.5; + labelData.push({ + series: this, + itemId: yKey, + datum, + datumIndex, + text: text2, + fontSize, + lineHeight, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + textBaseline: verticalAlign, + x: lx, + y: ly, + style + }); + } + } + return { + itemId: this.properties.yKey ?? this.id, + nodeData, + labelData, + scales: this.calculateScaling(), + visible: this.visible + }; + } + nodeFactory() { + return new Rect(); + } + update(params) { + this.ctx.animationManager.skipCurrentBatch(); + return super.update(params); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data); + } + getItemStyle({ datumIndex, datum, colorValue }, isHighlight) { + const { properties } = this; + const { itemStyler, stroke: stroke2, strokeWidth, strokeOpacity } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const style = mergeDefaults6(highlightStyle, { + fill: this.isColorScaleValid() && colorValue != null ? this.colorScale.convert(colorValue) : "transparent", + fillOpacity: 1, + stroke: stroke2, + strokeWidth, + strokeOpacity, + opacity: 1 + }); + let overrides; + if (itemStyler != null && datumIndex != null) { + overrides = this.cachedDatumCallback(createDatumId3(datumIndex, isHighlight ? "highlight" : "node"), () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + }); + } + return overrides ? mergeDefaults6(overrides, style) : style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId, properties } = this; + const { xKey, yKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + yKey, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const xAxis = this.axes[ChartAxisDirection15.X]; + const [visibleMin, visibleMax] = xAxis?.visibleRange ?? []; + const isZoomed = visibleMin !== 0 || visibleMax !== 1; + const crisp = !isZoomed; + datumSelection.each((rect, nodeDatum) => { + const { point, width, height, style } = nodeDatum; + applyShapeStyle2(rect, style); + rect.crisp = crisp; + rect.x = Math.floor(point.x - width / 2); + rect.y = Math.floor(point.y - height / 2); + rect.width = Math.ceil(width); + rect.height = Math.ceil(height); + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + const { enabled } = this.properties.label; + const data = enabled ? labelData : []; + return labelSelection.update(data); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((text2, datum) => { + text2.pointerEvents = PointerEvents.None; + text2.text = datum.text; + text2.fillOpacity = this.getHighlightStyle(false, datum.datumIndex)?.opacity ?? 1; + updateLabelNode(this, text2, this.properties, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties, colorScale, ctx } = this; + const { formatManager } = ctx; + const { xKey, xName, yKey, yName, colorKey, colorName, colorRange, title, legendItemName, tooltip } = properties; + const xAxis = axes[ChartAxisDirection15.X]; + const yAxis = axes[ChartAxisDirection15.Y]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + const colorValue = colorKey != null && this.isColorScaleValid() ? dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex] : void 0; + if (xValue2 == null) + return; + const data = []; + let fill; + if (colorValue == null) { + fill = colorRange[0]; + } else { + fill = colorScale.convert(colorValue); + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue(colorValue) }); + } + data.push( + { + label: xName, + fallbackLabel: xKey, + value: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName) + }, + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, yKey, legendItemName) + } + ); + const format = this.getItemStyle({ datumIndex, datum, colorValue }, false); + if (format.fill != null) { + fill = format.fill; + } + const symbol = fill == null ? void 0 : { + marker: { + shape: "square", + fill, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + } + }; + return this.formatTooltipWithContext( + tooltip, + { title: title ?? legendItemName, symbol, data }, + { + seriesId, + datum, + title, + xKey, + xName, + yKey, + yName, + colorKey, + colorName, + ...format + } + ); + } + getLegendData(legendType) { + if (legendType !== "gradient" || !this.isColorScaleValid() || !this.dataModel) { + return []; + } + return [ + { + legendType: "gradient", + enabled: this.visible, + seriesId: this.id, + series: this.getFormatterContext("color"), + colorDomain: this.colorScale.domain, + colorRange: this.colorScale.range + } + ]; + } + isLabelEnabled() { + return this.properties.label.enabled && Boolean(this.properties.colorKey); + } + getBandScalePadding() { + return { inner: 0, outer: 0 }; + } + computeFocusBounds({ datumIndex }) { + const datum = this.contextNodeData?.nodeData[datumIndex]; + if (datum === void 0) + return void 0; + const { width, height, midPoint } = datum; + const focusRect = { x: midPoint.x - width / 2, y: midPoint.y - height / 2, width, height }; + return computeBarFocusBounds3(this, focusRect); + } + initQuadTree(quadtree) { + addHitTestersToQuadtree(quadtree, this.datumNodesIter()); + } + pickNodesExactShape(point) { + const item = findQuadtreeMatch(this, point); + return item != null && item.distance <= 0 ? [item.datum] : []; + } + pickNodeClosestDatum(point) { + return findQuadtreeMatch(this, point); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +HeatmapSeries.className = "HeatmapSeries"; +HeatmapSeries.type = "heatmap"; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesOptionsDef.ts +var import_ag_charts_community130 = require("ag-charts-community"); +var import_ag_charts_core60 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs3, heatmapSeriesThemeableOptionsDef, without } = import_ag_charts_community130._ModuleSupport; +var heatmapSeriesOptionsDef = { + ...without(heatmapSeriesThemeableOptionsDef, ["showInLegend"]), + ...without(commonSeriesOptionsDefs3, ["showInLegend"]), + type: (0, import_ag_charts_core60.required)((0, import_ag_charts_core60.constant)("heatmap")), + xKey: (0, import_ag_charts_core60.required)(import_ag_charts_core60.string), + yKey: (0, import_ag_charts_core60.required)(import_ag_charts_core60.string), + colorKey: import_ag_charts_core60.string, + xName: import_ag_charts_core60.string, + yName: import_ag_charts_core60.string, + colorName: import_ag_charts_core60.string, + colorRange: (0, import_ag_charts_core60.arrayOf)(import_ag_charts_core60.color) +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapThemes.ts +var import_ag_charts_community131 = require("ag-charts-community"); +var HEATMAP_SERIES_THEME = { + series: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $ref: "chartBackgroundColor" }, + { $path: ["/0", { $palette: "stroke" }, { $palette: "strokes" }] } + ] + }, + strokeWidth: { $isUserOption: ["./stroke", 2, void 0] }, + // @ts-expect-error undocumented option + colorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "divergingColors" }, + import_ag_charts_community131._ModuleSupport.SAFE_RANGE2_OPERATION + ] + }, + label: { + ...import_ag_charts_community131._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + color: { $ref: "textColor" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + wrapping: "on-space", + overflowStrategy: "ellipsis" + }, + itemPadding: 3, + highlight: import_ag_charts_community131._ModuleSupport.singleSeriesHighlightStyle() + }, + gradientLegend: { + enabled: true, + ...import_ag_charts_community131._ModuleSupport.LEGEND_CONTAINER_THEME + } +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE4, CARTESIAN_POSITION: CARTESIAN_POSITION2 } +} = import_ag_charts_community132._ModuleSupport; +var HeatmapModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "heatmap", + moduleFactory: (ctx) => new HeatmapSeries(ctx), + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE4.CATEGORY, position: CARTESIAN_POSITION2.LEFT }, + { type: CARTESIAN_AXIS_TYPE4.CATEGORY, position: CARTESIAN_POSITION2.BOTTOM } + ], + themeTemplate: HEATMAP_SERIES_THEME +}; +var HeatmapSeriesModule = { + type: "series", + name: "heatmap", + chartType: "cartesian", + enterprise: true, + options: heatmapSeriesOptionsDef, + create: (ctx) => new HeatmapSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcModule.ts +var import_ag_charts_community135 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeries.ts +var import_ag_charts_community133 = require("ag-charts-community"); +var { applyShapeStyle: applyShapeStyle3 } = import_ag_charts_community133._ModuleSupport; +var OhlcSeries = class extends OhlcSeriesBase { + constructor() { + super(...arguments); + this.properties = new OhlcSeriesProperties(); + } + nodeFactory() { + const node = new OhlcNode(); + node.lineCap = "square"; + return node; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { up, down } = properties.item; + datumSelection.each((node, datum) => { + const { centerX, width, y, height, yOpen, yClose, crisp } = datum; + const baseStyle = datum.isRising ? up : down; + node.centerX = centerX; + node.width = width; + node.y = y; + node.height = height; + node.yOpen = yOpen; + node.yClose = yClose; + node.crisp = crisp; + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle3(node, style); + node.strokeAlignment = baseStyle.strokeWidth; + }); + } + getLegendData(legendType) { + const { + id, + data, + ctx: { legendManager }, + visible + } = this; + const { + xKey, + yName, + item: { up, down }, + showInLegend, + legendItemName + } = this.properties; + if (!data?.data.length || !xKey || legendType !== "category") { + return []; + } + const fill = { + type: "gradient", + gradient: "linear", + colorSpace: "rgb", + colorStops: [ + { color: up.stroke, stop: 0 }, + { color: up.stroke, stop: 0.5 }, + { color: down.stroke, stop: 0.5 } + ], + rotation: 90 + }; + return [ + { + legendType: "category", + id, + itemId: id, + seriesId: id, + enabled: visible && legendManager.getItemEnabled({ seriesId: id, itemId: id }), + label: { + text: legendItemName ?? yName ?? id + }, + symbol: { + marker: { + fill, + fillOpacity: up.strokeOpacity, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + } + }, + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + hasItemStylers() { + return this.properties.itemStyler != null; + } +}; +OhlcSeries.className = "ohlc"; +OhlcSeries.type = "ohlc"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesOptionsDef.ts +var import_ag_charts_community134 = require("ag-charts-community"); +var import_ag_charts_core61 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs4, ohlcSeriesThemeableOptionsDef } = import_ag_charts_community134._ModuleSupport; +var ohlcSeriesOptionsDef = { + ...commonSeriesOptionsDefs4, + ...ohlcSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core61.required)((0, import_ag_charts_core61.constant)("ohlc")), + xKey: (0, import_ag_charts_core61.required)(import_ag_charts_core61.string), + openKey: (0, import_ag_charts_core61.required)(import_ag_charts_core61.string), + highKey: (0, import_ag_charts_core61.required)(import_ag_charts_core61.string), + lowKey: (0, import_ag_charts_core61.required)(import_ag_charts_core61.string), + closeKey: (0, import_ag_charts_core61.required)(import_ag_charts_core61.string), + xName: import_ag_charts_core61.string, + yName: import_ag_charts_core61.string, + openName: import_ag_charts_core61.string, + highName: import_ag_charts_core61.string, + lowName: import_ag_charts_core61.string, + closeName: import_ag_charts_core61.string +}; +ohlcSeriesOptionsDef.pickOutsideVisibleMinorAxis = (0, import_ag_charts_core61.undocumented)(import_ag_charts_core61.boolean); +ohlcSeriesOptionsDef.focusPriority = (0, import_ag_charts_core61.undocumented)(import_ag_charts_core61.number); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE5, CARTESIAN_POSITION: CARTESIAN_POSITION3 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle3 +} = import_ag_charts_community135._ModuleSupport; +var OhlcModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "ohlc", + moduleFactory: (ctx) => new OhlcSeries(ctx), + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE5.NUMBER, position: CARTESIAN_POSITION3.LEFT }, + { type: CARTESIAN_AXIS_TYPE5.ORDINAL_TIME, position: CARTESIAN_POSITION3.BOTTOM } + ], + themeTemplate: { + animation: { enabled: false }, + series: { + item: { + up: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: "up.stroke" } + ] + } + }, + down: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: "down.stroke" } + ] + } + } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: multiSeriesHighlightStyle3(false) + }, + axes: { + [CARTESIAN_AXIS_TYPE5.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE5.ORDINAL_TIME]: { + groupPaddingInner: 0, + crosshair: { + enabled: true + } + } + } + }, + groupable: false +}; +var OhlcSeriesModule = { + type: "series", + name: "ohlc", + chartType: "cartesian", + enterprise: true, + options: ohlcSeriesOptionsDef, + create: (ctx) => new OhlcSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaModule.ts +var import_ag_charts_community143 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/range-area/rangeArea.ts +var import_ag_charts_community140 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaAggregation.ts +var import_ag_charts_community136 = require("ag-charts-community"); +var { + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX2, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN2, + aggregationDomain: aggregationDomain2, + aggregationIndexForXRatio, + aggregationRangeFittingPoints: aggregationRangeFittingPoints2, + aggregationXRatioForXValue, + compactAggregationIndices: compactAggregationIndices2, + createAggregationIndices: createAggregationIndices2 +} = import_ag_charts_community136._ModuleSupport; +var AGGREGATION_THRESHOLD2 = 1e3; +function aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf); + const aggIndex = aggregationIndexForXRatio(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MAX2]; +} +function aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf); + const aggIndex = aggregationIndexForXRatio(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MIN2]; +} +function aggregateRangeAreaData(scale, xValues, highValues, lowValues, domain, xNeedsValueOf, yNeedsValueOf) { + if (xValues.length < AGGREGATION_THRESHOLD2) + return; + const [d0, d1] = aggregationDomain2(scale, domain); + let maxRange = aggregationRangeFittingPoints2(xValues, d0, d1, { xNeedsValueOf }); + const { indexData, valueData } = createAggregationIndices2(xValues, highValues, lowValues, d0, d1, maxRange, { + xNeedsValueOf, + yNeedsValueOf + }); + let topIndices = []; + let bottomIndices = []; + for (let datumIndex = 0; datumIndex < xValues.length; datumIndex += 1) { + if (aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf)) { + topIndices.push(datumIndex); + } + if (aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf)) { + bottomIndices.push(datumIndex); + } + } + const filters = [{ maxRange, topIndices, bottomIndices }]; + while (maxRange > 64) { + ({ maxRange } = compactAggregationIndices2(indexData, valueData, maxRange, { inPlace: true })); + topIndices = topIndices.filter( + (datumIndex) => aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) + ); + bottomIndices = bottomIndices.filter( + (datumIndex) => aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) + ); + filters.push({ maxRange, topIndices, bottomIndices }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaIntersection.ts +var import_ag_charts_community137 = require("ag-charts-community"); +function getYValueAtX({ span }, x) { + switch (span.type) { + case "linear": + case "step": + case "multi-line": { + const t = (x - span.x0) / (span.x1 - span.x0); + return span.y0 + t * (span.y1 - span.y0); + } + case "cubic": { + const { cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y } = span; + let t = 0.5; + const tolerance = 1e-6; + for (let i = 0; i < 10; i++) { + const mt2 = 1 - t; + const xt = mt2 * mt2 * mt2 * cp0x + 3 * mt2 * mt2 * t * cp1x + 3 * mt2 * t * t * cp2x + t * t * t * cp3x; + const fx = xt - x; + if (Math.abs(fx) < tolerance) + break; + const dxdt = 3 * mt2 * mt2 * (cp1x - cp0x) + 6 * mt2 * t * (cp2x - cp1x) + 3 * t * t * (cp3x - cp2x); + if (Math.abs(dxdt) < 1e-12) + break; + t = t - fx / dxdt; + t = Math.max(0, Math.min(1, t)); + } + const mt = 1 - t; + return mt * mt * mt * cp0y + 3 * mt * mt * t * cp1y + 3 * mt * t * t * cp2y + t * t * t * cp3y; + } + } +} +function findSpanForX(spans, x, startIndex = 0) { + for (let i = startIndex; i < spans.length; i++) { + const span = spans[i]; + const [start, end] = import_ag_charts_community137._ModuleSupport.spanRange(span.span); + if (x >= start.x && x <= end.x) { + return { span, index: i }; + } + if (x < start.x) { + break; + } + } + return { span: null, index: startIndex }; +} +function checkForIntersection(highSpans, lowSpans, x, wasInverted, spanIndex) { + const high = findSpanForX(highSpans, x, spanIndex); + const low = findSpanForX(lowSpans, x, spanIndex); + if (!high.span || !low.span) { + return { intersection: null, spanIndex: high.index, isInverted: wasInverted }; + } + const highY = getYValueAtX(high.span, x); + const lowY = getYValueAtX(low.span, x); + const isInverted = highY > lowY; + const intersection = wasInverted === isInverted ? null : { x, y: highY }; + return { intersection, spanIndex: high.index, isInverted }; +} +function findRangeAreaIntersections(highSpans, lowSpans, minX, maxX, initiallyInverted = false) { + if (highSpans.length === 0 || lowSpans.length === 0) + return []; + const intersections = []; + let wasInverted = initiallyInverted; + let spanIndex = 0; + for (let x = minX; x <= maxX; x += 0.5) { + const result = checkForIntersection(highSpans, lowSpans, x, wasInverted, spanIndex); + if (result.intersection) { + intersections.push(result.intersection.x); + } + spanIndex = result.spanIndex; + wasInverted = result.isInverted; + } + return intersections; +} +function calculateIntersectionSegments(intersections, seriesRect, chartSize, startsInverted, style = {}) { + const horizontalMargin = Math.max(seriesRect.x, chartSize.width - (seriesRect.x + seriesRect.width)); + const verticalMargin = Math.max(seriesRect.y, chartSize.height - (seriesRect.y + seriesRect.height)); + const result = []; + const createClipRect = (x0, x1) => ({ + x0, + y0: -verticalMargin, + x1, + y1: seriesRect.height + verticalMargin + }); + if (startsInverted) { + result.push({ + clipRect: createClipRect(-horizontalMargin, intersections[0] ?? seriesRect.width + horizontalMargin), + ...style + }); + } + const startIndex = startsInverted ? 1 : 0; + for (let i = startIndex; i < intersections.length; i += 2) { + result.push({ + clipRect: createClipRect(intersections[i], intersections[i + 1] ?? seriesRect.width + horizontalMargin), + ...style + }); + } + return result; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaProperties.ts +var import_ag_charts_community138 = require("ag-charts-community"); +var { + BaseProperties: BaseProperties18, + CartesianSeriesProperties: CartesianSeriesProperties2, + InterpolationProperties, + SeriesMarker, + makeSeriesTooltip: makeSeriesTooltip5, + Property: Property53, + DropShadow, + Label: Label2 +} = import_ag_charts_community138._ModuleSupport; +var RangeAreaSeriesLabel = class extends Label2 { + constructor() { + super(...arguments); + this.placement = "outside"; + this.spacing = 0; + } +}; +__decorateClass([ + Property53 +], RangeAreaSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property53 +], RangeAreaSeriesLabel.prototype, "spacing", 2); +var RangeAreaInvertedStyle = class { + constructor() { + this.enabled = false; + this.fillOpacity = 1; + } +}; +__decorateClass([ + Property53 +], RangeAreaInvertedStyle.prototype, "enabled", 2); +__decorateClass([ + Property53 +], RangeAreaInvertedStyle.prototype, "fill", 2); +__decorateClass([ + Property53 +], RangeAreaInvertedStyle.prototype, "fillOpacity", 2); +var RangeAreaLineStyle = class extends BaseProperties18 { + constructor() { + super(...arguments); + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.marker = new SeriesMarker(); + } +}; +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "stroke", 2); +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "lineDash", 2); +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "lineDashOffset", 2); +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "marker", 2); +var RangeAreaItemProperties = class extends BaseProperties18 { + constructor() { + super(...arguments); + this.low = new RangeAreaLineStyle(); + this.high = new RangeAreaLineStyle(); + } +}; +__decorateClass([ + Property53 +], RangeAreaItemProperties.prototype, "low", 2); +__decorateClass([ + Property53 +], RangeAreaItemProperties.prototype, "high", 2); +var SharedRangeAreaMarker = class extends BaseProperties18 { +}; +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "enabled", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "shape", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "size", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "fill", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "fillOpacity", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "stroke", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "strokeWidth", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "strokeOpacity", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "lineDash", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "lineDashOffset", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "itemStyler", 2); +var RangeAreaProperties = class extends CartesianSeriesProperties2 { + constructor() { + super(...arguments); + this.fill = "#99CCFF"; + this.fillOpacity = 1; + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.interpolation = new InterpolationProperties(); + this.item = new RangeAreaItemProperties(); + this.invertedStyle = new RangeAreaInvertedStyle(); + this.shadow = new DropShadow().set({ enabled: false }); + this.marker = new SharedRangeAreaMarker(); + this.label = new RangeAreaSeriesLabel(); + this.tooltip = makeSeriesTooltip5(); + this.connectMissingData = false; + } +}; +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "xKey", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "yLowKey", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "yHighKey", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "xName", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "yName", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "yLowName", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "yHighName", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "fill", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "stroke", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "lineDash", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "interpolation", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "styler", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "item", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "invertedStyle", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "shadow", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "marker", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "label", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "tooltip", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "connectMissingData", 2); + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaUtil.ts +var import_ag_charts_community139 = require("ag-charts-community"); +var { + CollapseMode, + isScaleValid, + pairUpSpans, + prepareAreaFillAnimationFns, + plotInterpolatedLinePathStroke, + prepareLinePathPropertyAnimation, + areScalingEqual +} = import_ag_charts_community139._ModuleSupport; +function prepareRangeAreaPathStrokeAnimationFns(status, highSpans, lowSpans, visibleToggleMode) { + const removePhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.removed); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.removed); + }; + const updatePhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.moved); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.moved); + }; + const addPhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.added); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.added); + }; + const pathProperties = prepareLinePathPropertyAnimation(status, visibleToggleMode); + return { status, path: { addPhaseFn, updatePhaseFn, removePhaseFn }, pathProperties }; +} +function prepareRangeAreaPathAnimation(newData, oldData, diff8) { + const isCategoryBased = newData.scales.x?.type === "category"; + const wasCategoryBased = oldData.scales.x?.type === "category"; + if (isCategoryBased !== wasCategoryBased || !isScaleValid(newData.scales.x) || !isScaleValid(oldData.scales.x)) { + return; + } + let status = "updated"; + if (oldData.visible && !newData.visible) { + status = "removed"; + } else if (!oldData.visible && newData.visible) { + status = "added"; + } + const fillSpans = pairUpSpans( + { scales: newData.scales, data: newData.fillData.spans }, + { scales: oldData.scales, data: oldData.fillData.spans }, + CollapseMode.Split + ); + if (fillSpans == null) + return; + const fillPhantomSpans = pairUpSpans( + { scales: newData.scales, data: newData.fillData.phantomSpans }, + { scales: oldData.scales, data: oldData.fillData.phantomSpans }, + CollapseMode.Split + ); + if (fillPhantomSpans == null) + return; + const highStrokeSpans = pairUpSpans( + { scales: newData.scales, data: newData.highStrokeData.spans }, + { scales: oldData.scales, data: oldData.highStrokeData.spans }, + CollapseMode.Split + ); + if (highStrokeSpans == null) + return; + const lowStrokeSpans = pairUpSpans( + { scales: newData.scales, data: newData.lowStrokeData.spans }, + { scales: oldData.scales, data: oldData.lowStrokeData.spans }, + CollapseMode.Split + ); + if (lowStrokeSpans == null) + return; + const fadeMode = "fade"; + const fill = prepareAreaFillAnimationFns(status, fillSpans, fillPhantomSpans, fadeMode); + const stroke2 = prepareRangeAreaPathStrokeAnimationFns(status, highStrokeSpans, lowStrokeSpans, fadeMode); + const hasMotion = (diff8?.changed ?? true) || !areScalingEqual(newData.scales.x, oldData.scales.x) || !areScalingEqual(newData.scales.y, oldData.scales.y) || status !== "updated"; + return { status, fill, stroke: stroke2, hasMotion }; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeArea.ts +var { + valueProperty: valueProperty6, + keyProperty: keyProperty4, + ChartAxisDirection: ChartAxisDirection16, + mergeDefaults: mergeDefaults7, + updateLabelNode: updateLabelNode2, + fixNumericExtent: fixNumericExtent4, + buildResetPathFn, + resetLabelFn, + resetMarkerFn, + resetMarkerPositionFn, + pathSwipeInAnimation, + resetMotion, + markerSwipeScaleInAnimation, + seriesLabelFadeInAnimation, + animationValidation: animationValidation3, + diff: diff3, + updateClipPath, + computeMarkerFocusBounds, + plotAreaPathFill, + plotLinePathStroke, + interpolatePoints, + pathFadeInAnimation, + markerFadeInAnimation, + fromToMotion, + pathMotion, + extent, + applyShapeFillBBox: applyShapeFillBBox2, + PointerEvents: PointerEvents2, + Marker, + BBox: BBox13, + findMinMax: findMinMax2, + applyShapeStyle: applyShapeStyle4, + processedDataIsAnimatable: processedDataIsAnimatable2, + simpleMemorize2: simpleMemorize22, + markerEnabled, + getMarkerStyles, + calculateSegments: calculateSegments2, + toHighlightString: toHighlightString2, + HighlightState: HighlightState2 +} = import_ag_charts_community140._ModuleSupport; +var memoizedAggregateRangeAreaData = simpleMemorize22(aggregateRangeAreaData); +var RangeAreaSeriesNodeEvent = class extends import_ag_charts_community140._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yLowKey = series.properties.yLowKey; + this.yHighKey = series.properties.yHighKey; + } +}; +var BaseSeries = import_ag_charts_community140._ModuleSupport.CartesianSeries; +var RangeAreaSeries = class extends BaseSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pathsPerSeries: ["fill", "lowStroke", "highStroke"], + pickModes: [import_ag_charts_community140._ModuleSupport.SeriesNodePickMode.AXIS_ALIGNED], + propertyKeys: { + [ChartAxisDirection16.X]: ["xKey"], + [ChartAxisDirection16.Y]: ["yLowKey", "yHighKey"] + }, + propertyNames: { + [ChartAxisDirection16.X]: ["xName"], + [ChartAxisDirection16.Y]: ["yLowName", "yHighName", "yName"] + }, + categoryKey: "xValue", + animationResetFns: { + path: buildResetPathFn({ getVisible: () => this.visible, getOpacity: () => this.getOpacity() }), + label: resetLabelFn, + datum: (node, datum) => ({ ...resetMarkerFn(node), ...resetMarkerPositionFn(node, datum) }) + }, + clipFocusBox: false + }); + this.properties = new RangeAreaProperties(); + this.NodeEvent = RangeAreaSeriesNodeEvent; + this.dataAggregationFilters = void 0; + } + async processData(dataController) { + const { xKey, yLowKey, yHighKey } = this.properties; + const xScale = this.axes[ChartAxisDirection16.X]?.scale; + const yScale = this.axes[ChartAxisDirection16.Y]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + if (!this.ctx.animationManager.isSkipped() && this.processedData) { + extraProps.push(diff3(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation3()); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty4(xKey, xScaleType, { id: `xValue` }), + valueProperty6(yLowKey, yScaleType, { id: `yLowValue` }), + valueProperty6(yHighKey, yScaleType, { id: `yHighValue` }), + ...extraProps + ] + }); + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable2(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection16.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + const xNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `xValue`, processedData); + const yNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `yHighValue`, processedData); + return memoizedAggregateRangeAreaData( + xAxis.scale.type, + xValues, + yHighValues, + yLowValues, + domain, + xNeedsValueOf, + yNeedsValueOf + ); + } + xCoordinateRange(xValue2) { + const x = this.axes[ChartAxisDirection16.X].scale.convert(xValue2); + return [x, x]; + } + yCoordinateRange(yValues) { + const y = this.axes[ChartAxisDirection16.Y].scale.convert(yValues[0]); + return [y, y]; + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + const { + domain: { + keys: [keys] + } + } = processedData; + if (direction === ChartAxisDirection16.X) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef.def.valueType === "category") { + return keys; + } + return fixNumericExtent4(extent(keys)); + } else { + const yExtent = this.domainForClippedRange(ChartAxisDirection16.Y, ["yHighValue", "yLowValue"], "xValue"); + const fixedYExtent = findMinMax2(yExtent); + return fixNumericExtent4(fixedYExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection16.Y, ["yHighValue", "yLowValue"], "xValue", visibleRange); + } + createNodeData() { + const { data, dataModel, processedData, axes } = this; + const xAxis = axes[ChartAxisDirection16.X]; + const yAxis = axes[ChartAxisDirection16.Y]; + if (!(data && xAxis && yAxis && dataModel && processedData && this.chart?.seriesRect)) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const { xKey, yLowKey, yHighKey, connectMissingData, interpolation, fill, fillOpacity, item } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yHighValues = dataModel.resolveColumnById(this, "yHighValue", processedData); + const yLowValues = dataModel.resolveColumnById(this, "yLowValue", processedData); + const xPosition = (index) => xScale.convert(xValues[index]) + xOffset; + const labelData = []; + const markerData = []; + const spanPoints = []; + const handleDatumPoint = (datumIndex, yHighValue, yLowValue) => { + const datum = rawData[datumIndex]; + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return; + const currentSpanPoints = spanPoints.at(-1); + if (Number.isFinite(yHighValue) && Number.isFinite(yLowValue)) { + const appendMarker = (id, yValue, y) => { + const { size } = item[id].marker; + markerData.push({ + index: datumIndex, + series: this, + itemId: id, + datum, + datumIndex, + midPoint: { x, y }, + yHighValue, + yLowValue, + xValue: xValue2, + xKey, + yLowKey, + yHighKey, + point: { x, y, size }, + enabled: true + }); + const highLabelDatum = this.createLabelData({ + datumIndex, + point: { x, y }, + value: yValue, + yLowValue, + yHighValue, + itemId: id, + inverted, + datum, + series: this + }); + labelData.push(highLabelDatum); + }; + const inverted = yLowValue > yHighValue; + const x = xPosition(datumIndex); + const yHighCoordinate = yScale.convert(yHighValue); + const yLowCoordinate = yScale.convert(yLowValue); + appendMarker("high", yHighValue, yHighCoordinate); + appendMarker("low", yLowValue, yLowCoordinate); + const spanPoint = { + high: { + point: { x, y: yHighCoordinate }, + xDatum: xValue2, + yDatum: yHighValue + }, + low: { + point: { x, y: yLowCoordinate }, + xDatum: xValue2, + yDatum: yLowValue + } + }; + if (Array.isArray(currentSpanPoints)) { + currentSpanPoints.push(spanPoint); + } else if (currentSpanPoints == null) { + spanPoints.push([spanPoint]); + } else { + currentSpanPoints.skip += 1; + spanPoints.push([spanPoint]); + } + } else if (!connectMissingData) { + if (Array.isArray(currentSpanPoints) || currentSpanPoints == null) { + spanPoints.push({ skip: 0 }); + } else { + currentSpanPoints.skip += 1; + } + } + }; + const { dataAggregationFilters } = this; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + const topIndices = dataAggregationFilter?.topIndices; + const bottomIndices = dataAggregationFilter?.bottomIndices; + let [start, end] = this.visibleRangeIndices("xValue", xAxis.range, topIndices); + start = Math.max(start - 1, 0); + end = Math.min(end + 1, topIndices?.length ?? xValues.length); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let i = start; i < end; i += 1) { + const topDatumIndex = topIndices?.[i] ?? i; + const bottomDatumIndex = bottomIndices?.[i] ?? i; + handleDatumPoint(topDatumIndex, yHighValues[topDatumIndex], yLowValues[bottomDatumIndex]); + } + const highSpans = spanPoints.flatMap((p) => { + if (!Array.isArray(p)) + return []; + const highPoints = p.map((d) => d.high); + return interpolatePoints(highPoints, interpolation); + }); + const lowSpans = spanPoints.flatMap((p) => { + if (!Array.isArray(p)) + return []; + const lowPoints = p.map((d) => d.low); + return interpolatePoints(lowPoints, interpolation); + }); + const segments = calculateSegments2( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene, + false + ); + let intersectionSegments = void 0; + if (this.properties.invertedStyle.enabled) { + const startsInverted = yHighValues[0] < yLowValues[0]; + const intersectionXValues = findRangeAreaIntersections( + highSpans, + lowSpans, + xScale.range[0], + xScale.range[1], + startsInverted + ); + intersectionSegments = calculateIntersectionSegments( + intersectionXValues, + this.chart.seriesRect, + this.ctx.scene, + startsInverted, + this.properties.invertedStyle + ); + } + const getLowOrHighMarkerStyles = (lowOrHigh) => { + const line = item[lowOrHigh]; + const { stroke: stroke2, strokeWidth, strokeOpacity } = line; + const inheritedStyles = { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity }; + return getMarkerStyles(this, line, line.marker, inheritedStyles); + }; + const context = { + itemId: `${yLowKey}-${yHighKey}`, + labelData, + nodeData: markerData, + fillData: { itemId: "high", spans: highSpans, phantomSpans: lowSpans }, + highStrokeData: { itemId: "high", spans: highSpans }, + lowStrokeData: { itemId: "low", spans: lowSpans }, + scales: this.calculateScaling(), + visible: this.visible, + styles: { + low: getLowOrHighMarkerStyles("low"), + high: getLowOrHighMarkerStyles("high") + }, + segments, + intersectionSegments + }; + return context; + } + createLabelData({ + datumIndex, + point, + value, + itemId, + inverted, + datum, + series + }) { + const { xKey, yLowKey, yHighKey, xName, yName, yLowName, yHighName, legendItemName, label } = this.properties; + const { placement } = label; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + let actualItemId = itemId; + if (inverted) { + actualItemId = itemId === "low" ? "high" : "low"; + } + const direction = placement === "outside" && actualItemId === "high" || placement === "inside" && actualItemId === "low" ? -1 : 1; + const yDomain = this.getSeriesDomain(ChartAxisDirection16.Y); + return { + x: point.x, + y: point.y + spacing * direction, + series, + itemId, + datum, + datumIndex, + text: this.getLabelText( + value, + datum, + itemId === "high" ? yHighKey : yLowKey, + "y", + yDomain, + label, + { value, datum, itemId, xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName } + ), + textAlign: "center", + textBaseline: direction === -1 ? "bottom" : "top" + }; + } + isPathOrSelectionDirty() { + const { low, high } = this.properties.item; + return low.marker.isDirty() || high.marker.isDirty(); + } + strokewidthChange() { + const itemStrokeWidthChange = (lowOrHigh) => { + const unhighlightedStrokeWidth = this.properties.item[lowOrHigh].strokeWidth ?? 0; + const highlightedSeriesStrokeWidth = this.properties.highlight.highlightedSeries.item?.[lowOrHigh]?.strokeWidth ?? unhighlightedStrokeWidth; + const highlightedItemStrokeWidth = this.properties.highlight.highlightedItem.item?.[lowOrHigh]?.strokeWidth ?? unhighlightedStrokeWidth; + return unhighlightedStrokeWidth > highlightedItemStrokeWidth || highlightedSeriesStrokeWidth > highlightedItemStrokeWidth; + }; + return itemStrokeWidthChange("low") || itemStrokeWidthChange("high"); + } + updatePathNodes(opts) { + const { visible } = opts; + const [fillPath, lowStrokePath, highStrokePath] = opts.paths; + const segments = this.contextNodeData?.segments; + const highlightDatum = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightState(highlightDatum, false); + const highlightStyle = this.getHighlightStyle(); + const { item, fill, fillOpacity, opacity } = mergeDefaults7( + highlightStyle, + this.getStyle(false, highlightState) + ); + lowStrokePath.setProperties({ + datum: segments, + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: PointerEvents2.None, + stroke: item.low.stroke, + strokeWidth: item.low.strokeWidth, + strokeOpacity: item.low.strokeOpacity, + lineDash: item.low.lineDash, + lineDashOffset: item.low.lineDashOffset, + opacity, + visible + }); + highStrokePath.setProperties({ + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: PointerEvents2.None, + stroke: item.high.stroke, + strokeWidth: item.high.strokeWidth, + strokeOpacity: item.high.strokeOpacity, + lineDash: item.high.lineDash, + lineDashOffset: item.high.lineDashOffset, + opacity, + visible + }); + const fillBBox = this.getShapeFillBBox(); + applyShapeFillBBox2(fillPath, fill, fillBBox); + applyShapeStyle4(fillPath, { stroke: void 0, fill, fillOpacity, opacity }, fillBBox); + const fillSegments = this.contextNodeData?.intersectionSegments ?? segments; + fillPath.setProperties({ + segments: fillSegments, + pointerEvents: PointerEvents2.None, + lineJoin: "round", + fillShadow: this.properties.shadow, + opacity, + visible + }); + fillPath.datum = fillSegments; + updateClipPath(this, fillPath); + updateClipPath(this, lowStrokePath); + updateClipPath(this, highStrokePath); + } + updatePaths(opts) { + this.updateAreaPaths(opts.paths, opts.contextData); + } + updateAreaPaths(paths, contextData) { + for (const path of paths) { + path.visible = contextData.visible; + } + if (contextData.visible) { + this.updateFillPath(paths, contextData); + this.updateStrokePath(paths, contextData); + } else { + for (const path of paths) { + path.path.clear(); + path.markDirty("RangeArea"); + } + } + } + updateFillPath(paths, contextData) { + const [fill] = paths; + fill.path.clear(); + plotAreaPathFill(fill, contextData.fillData); + fill.markDirty("RangeArea"); + } + updateStrokePath(paths, contextData) { + const [, lowStroke, highStroke] = paths; + lowStroke.path.clear(); + highStroke.path.clear(); + plotLinePathStroke(lowStroke, contextData.lowStrokeData.spans); + plotLinePathStroke(highStroke, contextData.highStrokeData.spans); + lowStroke.markDirty("RangeArea"); + highStroke.markDirty("RangeArea"); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const { processedData, axes, properties } = this; + const rules = properties.styler ? this.getStylerMarkerOptions().item : properties.item; + const { low, high } = rules; + const markersEnabled = markerEnabled(processedData.input.count, axes[ChartAxisDirection16.X].scale, { + enabled: low.marker.enabled || high.marker.enabled + }); + if (properties.item.low.marker.isDirty() || properties.item.high.marker.isDirty()) { + datumSelection.clear(); + datumSelection.cleanup(); + } + let resolvedNodeData; + if (markersEnabled) { + if (low.marker.enabled && high.marker.enabled) { + resolvedNodeData = nodeData; + } else { + resolvedNodeData = []; + for (const datum of nodeData) { + if (rules[datum.itemId].marker.enabled) { + resolvedNodeData.push(datum); + } + } + } + } else { + resolvedNodeData = []; + } + return datumSelection.update(resolvedNodeData); + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((_, datum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { fill, fillOpacity, item } = stylerStyle; + const { stroke: stroke2, strokeWidth, strokeOpacity } = item[datum.itemId]; + const { marker } = this.properties.item[datum.itemId]; + const params = this.makeItemStylerParams(datum.itemId); + datum.style = this.getMarkerStyle( + marker, + datum, + params, + { isHighlight, highlightState, resolveMarkerSubPath: ["item", datum.itemId, "marker"] }, + stylerStyle.item[datum.itemId].marker, + { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity + } + ); + }); + } + updateDatumNodes(opts) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum) => { + const { itemId } = datum; + const style = datum.style ?? contextNodeData.styles[itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style, node, datum.point, fillBBox); + }); + if (!isHighlight) { + this.properties.item.low.marker.markClean(); + this.properties.item.high.marker.markClean(); + } + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData, (text2) => { + text2.pointerEvents = PointerEvents2.None; + }); + } + updateLabelNodes(opts) { + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yName: this.properties.yName, + yLowKey: this.properties.yLowKey, + yLowName: this.properties.yLowName ?? this.properties.yLowKey, + yHighKey: this.properties.yHighKey, + yHighName: this.properties.yHighName ?? this.properties.yHighKey, + legendItemName: this.properties.legendItemName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + updateLabelNode2(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getHighlightData(nodeData, highlightedItem) { + const highlightItems = nodeData.filter((nodeDatum) => nodeDatum.datum === highlightedItem.datum); + return highlightItems.length > 0 ? highlightItems : void 0; + } + getStyle(highlighted, highlightState) { + return this.getStylerCouple(highlighted, highlightState)[0]; + } + getStylerMarkerOptions() { + return this.getStylerCouple(false)[1]; + } + getStylerCouple(highlighted, highlightState) { + const { fill, fillOpacity, item, styler } = this.properties; + let stylerResult = {}; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + const markerOpts = { + item: { low: { marker: { enabled: false } }, high: { marker: { enabled: false } } } + }; + const makeItemResult = (lowOrHigh) => { + const stylerItem = stylerResult.item?.[lowOrHigh]; + const { lineDash, lineDashOffset, marker, stroke: stroke2, strokeOpacity, strokeWidth } = item[lowOrHigh]; + markerOpts.item[lowOrHigh].marker.enabled = stylerItem?.marker?.enabled ?? marker.enabled; + return { + marker: { + fill: stylerItem?.marker?.fill ?? marker.fill ?? fill, + fillOpacity: stylerItem?.marker?.fillOpacity ?? marker.fillOpacity, + shape: stylerItem?.marker?.shape ?? marker.shape, + size: stylerItem?.marker?.size ?? marker.size, + lineDash: stylerItem?.marker?.lineDash ?? marker.lineDash, + lineDashOffset: stylerItem?.marker?.lineDashOffset ?? marker.lineDashOffset, + stroke: stylerItem?.marker?.stroke ?? marker.stroke ?? stroke2, + strokeOpacity: stylerItem?.marker?.strokeOpacity ?? marker.strokeOpacity, + strokeWidth: stylerItem?.marker?.strokeWidth ?? marker.strokeWidth + }, + lineDash: stylerItem?.lineDash ?? lineDash, + lineDashOffset: stylerItem?.lineDashOffset ?? lineDashOffset, + stroke: stylerItem?.stroke ?? stroke2, + strokeOpacity: stylerItem?.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerItem?.strokeWidth ?? strokeWidth + }; + }; + const style = { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + opacity: 1, + topLevel: { + lineDash: this.properties.lineDash, + lineDashOffset: this.properties.lineDashOffset, + marker: this.properties.marker, + stroke: this.properties.stroke, + strokeOpacity: this.properties.strokeOpacity, + strokeWidth: this.properties.strokeWidth + }, + item: { + low: makeItemResult("low"), + high: makeItemResult("high") + } + }; + return [style, markerOpts]; + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { fill, fillOpacity, item, xKey, yHighKey, yLowKey } = this.properties; + const highlightState = toHighlightString2(highlightStateEnum ?? HighlightState2.None); + const makeItemParam = (lowOrHigh) => { + const { lineDash, lineDashOffset, marker, stroke: stroke2, strokeOpacity, strokeWidth } = item[lowOrHigh]; + return { + marker: { + fill: marker.fill ?? fill, + fillOpacity: marker.fillOpacity, + size: marker.size, + shape: marker.shape, + stroke: marker.stroke ?? stroke2, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }, + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth + }; + }; + return { + item: { + low: makeItemParam("low"), + high: makeItemParam("high") + }, + fill, + fillOpacity, + highlightState, + highlighted, + seriesId, + xKey, + yLowKey, + yHighKey + }; + } + makeItemStylerParams(itemId) { + const { xKey, yLowKey, yHighKey } = this.properties; + return { xKey, yLowKey, yHighKey, itemId }; + } + getTooltipContent(datumIndex, removeThisDatum) { + const itemId = removeThisDatum?.itemId ?? "high"; + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { xName, yName, yLowKey, yLowName, xKey, yHighKey, yHighName, tooltip, legendItemName } = properties; + const xAxis = axes[ChartAxisDirection16.X]; + const yAxis = axes[ChartAxisDirection16.Y]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yHighValue = dataModel.resolveColumnById(this, `yHighValue`, processedData)[datumIndex]; + const yLowValue = dataModel.resolveColumnById(this, `yLowValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(itemId); + const format = this.getMarkerStyle( + this.properties.item[itemId].marker, + { datumIndex, datum }, + params, + { isHighlight: false, resolveMarkerSubPath: ["item", itemId, "marker"] }, + stylerStyle.item[itemId].marker + ); + const value = `${this.getAxisValueText(yAxis, "tooltip", yLowValue, datum, yLowKey, legendItemName)} - ${this.getAxisValueText(yAxis, "tooltip", yHighValue, datum, yHighKey, legendItemName)}`; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [{ label: yName, fallbackLabel: `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`, value }] + }, + { + seriesId, + datum, + title: yName, + itemId, + xName, + yName, + yLowKey, + yLowName, + xKey, + yHighKey, + yHighName, + legendItemName, + ...format + } + ); + } + legendItemSymbol() { + const { fill, topLevel } = this.getStyle(false); + const { stroke: stroke2, strokeWidth, strokeOpacity, lineDash, marker } = topLevel; + const markerStyle = { + shape: marker.shape, + fill: marker.fill ?? fill, + stroke: marker.stroke ?? stroke2, + fillOpacity: marker.fillOpacity, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }; + return { + marker: markerStyle, + line: { + stroke: stroke2, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { yLowKey, yHighKey, yName, yLowName, yHighName, legendItemName, showInLegend } = this.properties; + const legendItemText = legendItemName ?? yName ?? `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`; + const itemId = `${yLowKey}-${yHighKey}`; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible, + label: { text: `${legendItemText}` }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + isLabelEnabled() { + return this.properties.label.enabled; + } + onDataChange() { + } + nodeFactory() { + return new Marker(); + } + animateEmptyUpdateReady(animationData) { + const { datumSelection, labelSelection, contextData, paths } = animationData; + const { animationManager } = this.ctx; + this.updateAreaPaths(paths, contextData); + pathSwipeInAnimation(this, animationManager, ...paths); + resetMotion([datumSelection], resetMarkerPositionFn); + markerSwipeScaleInAnimation(this, animationManager, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + } + animateReadyResize(animationData) { + const { contextData, paths } = animationData; + this.updateAreaPaths(paths, contextData); + super.animateReadyResize(animationData); + } + animateWaitingUpdateReady(animationData) { + const { animationManager } = this.ctx; + const { datumSelection, labelSelection, contextData, paths, previousContextData } = animationData; + const [fill, lowStroke, highStroke] = paths; + if (fill == null && lowStroke == null && highStroke == null) + return; + this.resetDatumAnimation(animationData); + this.resetLabelAnimation(animationData); + const update = () => { + this.resetPathAnimation(animationData); + this.updateAreaPaths(paths, contextData); + }; + const skip = () => { + animationManager.skipCurrentBatch(); + update(); + }; + if (contextData == null || previousContextData == null) { + update(); + markerFadeInAnimation(this, animationManager, "added", datumSelection); + pathFadeInAnimation(this, "fill_path_properties", animationManager, "add", fill); + pathFadeInAnimation(this, "low_stroke_path_properties", animationManager, "add", lowStroke); + pathFadeInAnimation(this, "high_stroke_path_properties", animationManager, "add", highStroke); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + return; + } + const fns = prepareRangeAreaPathAnimation( + contextData, + previousContextData, + this.processedData?.reduced?.diff?.[this.id] + ); + if (fns === void 0) { + skip(); + return; + } else if (fns.status === "no-op") { + return; + } + fromToMotion(this.id, "fill_path_properties", animationManager, [fill], fns.fill.pathProperties); + fromToMotion(this.id, "low_stroke_path_properties", animationManager, [lowStroke], fns.stroke.pathProperties); + fromToMotion(this.id, "high_stroke_path_properties", animationManager, [highStroke], fns.stroke.pathProperties); + if (fns.status === "added") { + this.updateAreaPaths(paths, contextData); + } else if (fns.status === "removed") { + this.updateAreaPaths(paths, previousContextData); + } else { + pathMotion(this.id, "fill_path_update", animationManager, [fill], fns.fill.path); + pathMotion(this.id, "low_stroke_path_update", animationManager, [lowStroke], fns.stroke.path); + pathMotion(this.id, "high_stroke_path_update", animationManager, [highStroke], fns.stroke.path); + } + if (fns.hasMotion) { + markerFadeInAnimation(this, animationManager, void 0, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + } + this.ctx.animationManager.animate({ + id: this.id, + groupId: "reset_after_animation", + phase: "trailing", + from: {}, + to: {}, + onComplete: () => this.updateAreaPaths(paths, contextData) + }); + } + getFormattedMarkerStyle(datum) { + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(datum.itemId); + return this.getMarkerStyle( + this.properties.item[datum.itemId].marker, + datum, + params, + { isHighlight: true, resolveMarkerSubPath: ["item", datum.itemId, "marker"] }, + void 0, + stylerStyle + ); + } + getMarkerStyle(marker, datum, params, opts, defaultOverrideStyle, inheritedStyle) { + true; + marker.itemStyler = this.properties.marker.itemStyler; + return super.getMarkerStyle(marker, datum, params, opts, defaultOverrideStyle, inheritedStyle); + } + computeFocusBounds(opts) { + const hiBox = computeMarkerFocusBounds(this, opts); + const loBox = computeMarkerFocusBounds(this, { ...opts, datumIndex: opts.datumIndex + 1 }); + if (hiBox && loBox) { + return BBox13.merge([hiBox, loBox]); + } + return void 0; + } + isDatumEnabled(nodeData, datumIndex) { + return datumIndex % 2 === 0 && super.isDatumEnabled(nodeData, datumIndex); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RangeAreaSeries.className = "RangeAreaSeries"; +RangeAreaSeries.type = "range-area"; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaSeriesOptionsDef.ts +var import_ag_charts_community141 = require("ag-charts-community"); +var import_ag_charts_core62 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs5, rangeAreaSeriesThemeableOptionsDef } = import_ag_charts_community141._ModuleSupport; +var rangeAreaSeriesOptionsDef = { + ...commonSeriesOptionsDefs5, + ...rangeAreaSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core62.required)((0, import_ag_charts_core62.constant)("range-area")), + xKey: (0, import_ag_charts_core62.required)(import_ag_charts_core62.string), + yLowKey: (0, import_ag_charts_core62.required)(import_ag_charts_core62.string), + yHighKey: (0, import_ag_charts_core62.required)(import_ag_charts_core62.string), + xName: import_ag_charts_core62.string, + yName: import_ag_charts_core62.string, + yLowName: import_ag_charts_core62.string, + yHighName: import_ag_charts_core62.string, + legendItemName: import_ag_charts_core62.string, + segmentation: import_ag_charts_core62.shapeSegmentation, + invertedStyle: { + enabled: import_ag_charts_core62.boolean, + ...import_ag_charts_core62.fillOptionsDef + } +}; +rangeAreaSeriesOptionsDef.pickOutsideVisibleMinorAxis = (0, import_ag_charts_core62.undocumented)(import_ag_charts_core62.boolean); +rangeAreaSeriesOptionsDef.focusPriority = (0, import_ag_charts_core62.undocumented)(import_ag_charts_core62.number); + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaThemes.ts +var import_ag_charts_community142 = require("ag-charts-community"); +var RANGE_AREA_ITEM = { + lineDash: { + $path: "/series/$index/lineDash" + }, + lineDashOffset: { + $path: "/series/$index/lineDashOffset" + }, + stroke: { + $path: ["/series/$index/stroke", { $palette: "stroke" }] + }, + strokeOpacity: { + $path: "/series/$index/strokeOpacity" + }, + strokeWidth: { + $path: ["/series/$index/strokeWidth", 1] + }, + marker: { + enabled: { + $path: "/series/$index/marker/enabled" + }, + fill: { + $isUserOption: [ + "/series/$index/marker/fill", + { + $if: [ + { + $or: [ + { $isGradient: { $path: "/series/$index/marker/fill" } }, + { $isImage: { $path: "/series/$index/marker/fill" } }, + { $isPattern: { $path: "/series/$index/marker/fill" } } + ] + }, + { + $merge: [ + { $path: "/series/$index/marker/fill" }, + { + $applySwitch: [ + { $path: "type" }, + void 0, + // default case shouldn't be hit because of $if + ["gradient", import_ag_charts_community142._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", import_ag_charts_community142._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community142._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + } + ] + }, + { + $isUserOption: [ + "/series/$index/marker/fill", + { $path: "/series/$index/marker/fill" }, + { $palette: "fill" } + ] + } + ] + }, + { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community142._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", import_ag_charts_community142._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community142._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + } + ] + }, + fillOpacity: { + $path: "/series/$index/marker/fillOpacity" + }, + lineDash: { + $path: "/series/$index/marker/lineDash" + }, + lineDashOffset: { + $path: "/series/$index/marker/lineDashOffset" + }, + shape: { + $path: "/series/$index/marker/shape" + }, + size: { + $path: ["/series/$index/marker/size", 6] + }, + stroke: { + $path: ["/series/$index/marker/stroke", { $palette: "stroke" }] + }, + strokeOpacity: { + $path: "/series/$index/marker/strokeOpacity" + }, + strokeWidth: { + $path: ["/series/$index/marker/strokeWidth", 2] + } + } +}; +var RANGE_AREA_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community142._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", import_ag_charts_community142._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: 0.7, + stroke: { $palette: "stroke" }, + strokeWidth: 1, + marker: { + enabled: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community142._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", import_ag_charts_community142._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community142._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + shape: "circle", + stroke: { $palette: "stroke" }, + size: 6, + strokeWidth: 2 + }, + nodeClickRange: "nearest", + item: { + low: RANGE_AREA_ITEM, + high: RANGE_AREA_ITEM + }, + label: { + ...import_ag_charts_community142._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + placement: "outside", + padding: { $isUserOption: ["./spacing", 0, 10] }, + // compatibility with old `padding` property (now named `spacing`). + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + interpolation: { + type: "linear" + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: import_ag_charts_community142._ModuleSupport.multiSeriesHighlightStyle(), + segmentation: import_ag_charts_community142._ModuleSupport.SEGMENTATION_DEFAULTS, + invertedStyle: { + enabled: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + // @todo(AG-14792) should be { $path: '../fill' } to inherit from series.fill + ["gradient", import_ag_charts_community142._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", import_ag_charts_community142._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community142._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: { $path: "../fillOpacity" } + } + }, + axes: { + [import_ag_charts_community142._ModuleSupport.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { enabled: true } + } + } +}; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE6, CARTESIAN_POSITION: CARTESIAN_POSITION4 } +} = import_ag_charts_community143._ModuleSupport; +var RangeAreaModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "range-area", + moduleFactory: (ctx) => new RangeAreaSeries(ctx), + predictAxis: import_ag_charts_community143._ModuleSupport.predictCartesianTimeAxis, + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE6.NUMBER, position: CARTESIAN_POSITION4.LEFT }, + { type: CARTESIAN_AXIS_TYPE6.CATEGORY, position: CARTESIAN_POSITION4.BOTTOM } + ], + themeTemplate: RANGE_AREA_SERIES_THEME +}; +var RangeAreaSeriesModule = { + type: "series", + name: "range-area", + chartType: "cartesian", + enterprise: true, + options: rangeAreaSeriesOptionsDef, + create: (ctx) => new RangeAreaSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarModule.ts +var import_ag_charts_community149 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeries.ts +var import_ag_charts_community146 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarAggregation.ts +var import_ag_charts_community144 = require("ag-charts-community"); +var { aggregationDomain: aggregationDomain3, aggregationRangeFittingPoints: aggregationRangeFittingPoints3, compactAggregationIndices: compactAggregationIndices3, createAggregationIndices: createAggregationIndices3 } = import_ag_charts_community144._ModuleSupport; +var AGGREGATION_THRESHOLD3 = 1e3; +function aggregateRangeBarData(scale, xValues, highValues, lowValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD3) + return; + const [d0, d1] = aggregationDomain3(scale, domain); + let maxRange = aggregationRangeFittingPoints3(xValues, d0, d1, { smallestKeyInterval }); + let { indexData, valueData } = createAggregationIndices3(xValues, highValues, lowValues, d0, d1, maxRange); + const filters = [{ maxRange, indexData }]; + while (maxRange > 64) { + ({ indexData, valueData, maxRange } = compactAggregationIndices3(indexData, valueData, maxRange)); + filters.push({ maxRange, indexData }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarProperties.ts +var import_ag_charts_community145 = require("ag-charts-community"); +var { AbstractBarSeriesProperties: AbstractBarSeriesProperties3, makeSeriesTooltip: makeSeriesTooltip6, Property: Property54, DropShadow: DropShadow2, Label: Label3 } = import_ag_charts_community145._ModuleSupport; +var RangeBarSeriesLabel = class extends Label3 { + constructor() { + super(...arguments); + this.placement = "inside"; + this.spacing = 0; + } +}; +__decorateClass([ + Property54 +], RangeBarSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property54 +], RangeBarSeriesLabel.prototype, "spacing", 2); +var RangeBarProperties = class extends AbstractBarSeriesProperties3 { + constructor() { + super(...arguments); + this.fill = "#99CCFF"; + this.fillOpacity = 1; + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.shadow = new DropShadow2().set({ enabled: false }); + this.label = new RangeBarSeriesLabel(); + this.tooltip = makeSeriesTooltip6(); + } +}; +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "xKey", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "yLowKey", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "yHighKey", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "xName", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "yName", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "yLowName", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "yHighName", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "styler", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "shadow", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "label", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode4, + valueProperty: valueProperty7, + keyProperty: keyProperty5, + ChartAxisDirection: ChartAxisDirection17, + checkCrisp, + updateLabelNode: updateLabelNode3, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL3, + LARGEST_KEY_INTERVAL, + diff: diff4, + prepareBarAnimationFunctions, + midpointStartingBarPosition, + resetBarSelectionsFn, + fixNumericExtent: fixNumericExtent5, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation2, + resetLabelFn: resetLabelFn2, + animationValidation: animationValidation4, + computeBarFocusBounds: computeBarFocusBounds4, + visibleRangeIndices: visibleRangeIndices2, + createDatumId: createDatumId4, + ContinuousScale: ContinuousScale5, + Rect: Rect2, + PointerEvents: PointerEvents3, + motion: motion2, + applyShapeStyle: applyShapeStyle5, + findMinMax: findMinMax3, + areScalingEqual: areScalingEqual2, + processedDataIsAnimatable: processedDataIsAnimatable3, + AGGREGATION_SPAN: AGGREGATION_SPAN2, + AGGREGATION_INDEX_X_MAX: AGGREGATION_INDEX_X_MAX2, + AGGREGATION_INDEX_X_MIN: AGGREGATION_INDEX_X_MIN2, + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX3, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN3, + mergeDefaults: mergeDefaults8, + simpleMemorize2: simpleMemorize23, + getItemStyles: getItemStyles2, + calculateSegments: calculateSegments3, + toHighlightString: toHighlightString3, + HighlightState: HighlightState3 +} = import_ag_charts_community146._ModuleSupport; +var memoizedAggregateRangeBarData = simpleMemorize23(aggregateRangeBarData); +var RangeBarSeriesNodeEvent = class extends import_ag_charts_community146._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yLowKey = series.properties.yLowKey; + this.yHighKey = series.properties.yHighKey; + } +}; +var RangeBarSeries = class extends import_ag_charts_community146._ModuleSupport.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode4.AXIS_ALIGNED, SeriesNodePickMode4.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["yLowKey", "yHighKey"] + }, + propertyNames: { + x: ["xName"], + y: ["yLowName", "yHighName", "yName"] + }, + categoryKey: "xValue", + datumSelectionGarbageCollection: false, + animationResetFns: { + datum: resetBarSelectionsFn, + label: resetLabelFn2 + } + }); + this.properties = new RangeBarProperties(); + this.dataAggregationFilters = void 0; + this.NodeEvent = RangeBarSeriesNodeEvent; + } + async processData(dataController) { + const { xKey, yLowKey, yHighKey } = this.properties; + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + if (this.processedData) { + extraProps.push(diff4(this.id, this.processedData)); + } + extraProps.push(animationValidation4()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty5(xKey, xScaleType, { id: "xValue" }), + valueProperty7(yLowKey, yScaleType, { id: `yLowValue`, invalidValue: null, ...visibleProps }), + valueProperty7(yHighKey, yScaleType, { id: `yHighValue`, invalidValue: null, ...visibleProps }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL3, LARGEST_KEY_INTERVAL] : [], + ...extraProps + ], + groupByKeys: false + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable3(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection17.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateRangeBarData( + xAxis.scale.type, + xValues, + yHighValues, + yLowValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys] + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } else { + const yExtent = this.domainForClippedRange(direction, ["yHighValue", "yLowValue"], "xValue"); + const fixedYExtent = findMinMax3(yExtent); + return fixNumericExtent5(fixedYExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection17.Y, ["yHighValue", "yLowValue"], "xValue", visibleRange); + } + createNodeData() { + const { data, dataModel, groupScale, processedData, visible } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(data && xAxis && yAxis && dataModel && processedData?.dataSources && this.chart?.seriesRect)) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection17.X; + const { xKey, yLowKey, yHighKey, strokeWidth } = this.properties; + const itemId = `${yLowKey}-${yHighKey}`; + const segments = calculateSegments3( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + const context = { + itemId, + nodeData: [], + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStyles2(this.getItemStyle.bind(this)), + segments + }; + if (!visible) + return context; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const { barWidth: effectiveBarWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale5.is(xScale) ? effectiveBarWidth * -0.5 : 0; + const groupOffset = groupScale.convert(String(groupIndex)); + const defaultCrisp = checkCrisp( + xAxis?.scale, + xAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + const xPosition = (datumIndex) => Math.round(xScale.convert(xValues[datumIndex])) + groupOffset + barOffset; + const handleDatum = (datumIndex, groupedDataIndex, x, width, yLow, yHigh, crisp) => { + const datum = rawData[datumIndex]; + const xDatum = xValues[datumIndex]; + if (xDatum == null) + return; + const rawLowValue = yLowValues[datumIndex]; + const rawHighValue = yHighValues[datumIndex]; + if (!Number.isFinite(rawLowValue?.valueOf()) || !Number.isFinite(rawHighValue?.valueOf())) + return; + const [yLowValue, yHighValue] = rawLowValue < rawHighValue ? [rawLowValue, rawHighValue] : [rawHighValue, rawLowValue]; + const y = Math.round(yScale.convert(yHigh)); + const bottomY = Math.round(yScale.convert(yLow)); + const height = Math.max(strokeWidth, Math.abs(bottomY - y)); + const rect = { + x: barAlongX ? Math.min(y, bottomY) : x, + y: barAlongX ? x : Math.min(y, bottomY), + width: barAlongX ? height : width, + height: barAlongX ? width : height + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const labelData = this.createLabelData({ + datumIndex, + rect, + barAlongX, + yLowValue, + yHighValue, + datum, + series: this + }); + const nodeDatum = { + index: groupedDataIndex, + series: this, + itemId, + datum, + datumIndex, + xValue: xDatum, + yLowValue: rawLowValue, + yHighValue: rawHighValue, + yLowKey, + yHighKey, + xKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + labels: labelData + }; + context.nodeData.push(nodeDatum); + context.labelData.push(...labelData); + }; + const { dataAggregationFilters } = this; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + if (dataAggregationFilter != null) { + const { maxRange, indexData } = dataAggregationFilter; + const [start, end] = visibleRangeIndices2(1, maxRange, xAxis.range, (index) => { + const aggIndex = index * AGGREGATION_SPAN2; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN2]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX2]; + if (xMinIndex === -1) + return; + const midDatumIndex = Math.trunc((xMinIndex + xMaxIndex) / 2); + return [xPosition(midDatumIndex), xPosition(xMaxIndex) + effectiveBarWidth]; + }); + for (let i = start; i < end; i += 1) { + const aggIndex = i * AGGREGATION_SPAN2; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN2]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX2]; + const yMinIndex = indexData[aggIndex + AGGREGATION_INDEX_Y_MIN3]; + const yMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_Y_MAX3]; + if (xMinIndex === -1) + continue; + const midDatumIndex = Math.trunc((xMinIndex + xMaxIndex) / 2); + const xValue2 = xValues[midDatumIndex]; + if (xValue2 == null) + continue; + const x = xPosition(midDatumIndex); + const width = Math.abs(xPosition(xMinIndex) - xPosition(xMaxIndex)) + effectiveBarWidth; + const yLow = yLowValues[yMinIndex]; + const yHigh = yHighValues[yMaxIndex]; + handleDatum(midDatumIndex, 0, x, width, yLow, yHigh, false); + } + } else if (processedData.type === "ungrouped") { + const invalidData = processedData.invalidData?.get(this.id); + let [start, end] = this.visibleRangeIndices("xValue", xAxis.range); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let datumIndex = start; datumIndex < end; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const x = xPosition(datumIndex); + const width = effectiveBarWidth; + const yLow = yLowValues[datumIndex]; + const yHigh = yHighValues[datumIndex]; + handleDatum(datumIndex, 0, x, width, yLow, yHigh, defaultCrisp); + } + } else { + for (const { datumIndex, groupIndex: groupDataIndex } of dataModel.forEachGroupDatum(this, processedData)) { + const x = xPosition(datumIndex); + const width = effectiveBarWidth; + const yLow = yLowValues[datumIndex]; + const yHigh = yHighValues[datumIndex]; + handleDatum(datumIndex, groupDataIndex, x, width, yLow, yHigh, defaultCrisp); + } + } + return context; + } + createLabelData({ + datumIndex, + rect, + barAlongX, + yLowValue, + yHighValue, + datum, + series + }) { + const { xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName, label } = this.properties; + const labelParams = { datum, xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName }; + const { placement } = label; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + const paddingDirection = placement === "outside" ? 1 : -1; + const labelPadding = spacing * paddingDirection; + const yDomain = this.getSeriesDomain(ChartAxisDirection17.Y); + const yLowLabel = { + datumIndex, + x: rect.x + (barAlongX ? -labelPadding : rect.width / 2), + y: rect.y + (barAlongX ? rect.height / 2 : rect.height + labelPadding), + textAlign: barAlongX ? "left" : "center", + textBaseline: barAlongX ? "middle" : "bottom", + text: this.getLabelText( + yLowValue, + datum, + yLowKey, + "y", + yDomain, + label, + { itemId: "low", value: yLowValue, ...labelParams } + ), + itemId: "low", + datum, + series + }; + const yHighLabel = { + datumIndex, + x: rect.x + (barAlongX ? rect.width + labelPadding : rect.width / 2), + y: rect.y + (barAlongX ? rect.height / 2 : -labelPadding), + textAlign: barAlongX ? "right" : "center", + textBaseline: barAlongX ? "middle" : "top", + text: this.getLabelText( + yHighValue, + datum, + yHighKey, + "y", + yDomain, + label, + { itemId: "high", value: yHighValue, ...labelParams } + ), + itemId: "high", + datum, + series + }; + if (placement === "outside") { + yLowLabel.textAlign = barAlongX ? "right" : "center"; + yLowLabel.textBaseline = barAlongX ? "middle" : "top"; + yHighLabel.textAlign = barAlongX ? "left" : "center"; + yHighLabel.textBaseline = barAlongX ? "middle" : "bottom"; + } + return [yLowLabel, yHighLabel]; + } + nodeFactory() { + return new Rect2(); + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth, + styler + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke2, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth + }; + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth, + xKey, + yLowKey, + yHighKey + } = this.properties; + const highlightState = toHighlightString3(highlightStateEnum ?? HighlightState3.None); + return { + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + seriesId, + stroke: stroke2, + strokeOpacity, + strokeWidth, + xKey, + yLowKey, + yHighKey + }; + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data, void 0, (datum) => this.getDatumId(datum)); + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style = mergeDefaults8(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId4(this.getDatumId({ xValue: xValue2 }), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults8(overrides, style); + } + } + return style; + } + makeItemStylerParams(datumIndex, isHighlight, style) { + const { id: seriesId, properties, processedData } = this; + const { xKey, yHighKey, yLowKey } = properties; + const datum = processedData.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + yHighKey, + yLowKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles(opts) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + opts.datumSelection.each((node, datum) => { + if (!opts.datumSelection.isGarbage(node)) { + const highlightState = this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex); + datum.style = this.getItemStyle(datum.datumIndex, opts.isHighlight, highlightState); + } + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection17.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle5(rect, style, fillBBox); + rect.cornerRadius = style.cornerRadius ?? 0; + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + }); + } + updateLabelSelection(opts) { + const labelData = this.properties.label.enabled ? opts.labelData : []; + return opts.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = PointerEvents3.None; + }); + } + updateLabelNodes(opts) { + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yName: this.properties.yName, + yLowKey: this.properties.yLowKey, + yLowName: this.properties.yLowName ?? this.properties.yLowKey, + yHighKey: this.properties.yHighKey, + yHighName: this.properties.yHighName ?? this.properties.yHighKey, + legendItemName: this.properties.legendItemName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum?.datumIndex).opacity ?? 1; + updateLabelNode3(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yName, yLowKey, yHighKey, yLowName, yHighName, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yHighValue = dataModel.resolveColumnById(this, `yHighValue`, processedData)[datumIndex]; + const yLowValue = dataModel.resolveColumnById(this, `yLowValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + const value = `${this.getAxisValueText(yAxis, "tooltip", yLowValue, datum, yLowKey, legendItemName)} - ${this.getAxisValueText(yAxis, "tooltip", yHighValue, datum, yHighKey, legendItemName)}`; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [{ label: yName, fallbackLabel: `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`, value }] + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yName, + yLowKey, + yHighKey, + yLowName, + yHighName, + legendItemName, + ...format + } + ); + } + legendItemSymbol() { + const { fill, stroke: stroke2, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + HighlightState3.None + ); + return { + marker: { + fill, + stroke: stroke2, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { yName, yLowName, yHighName, yLowKey, yHighKey, legendItemName, showInLegend } = this.properties; + const legendItemText = legendItemName ?? yName ?? `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`; + const itemId = `${yLowKey}-${yHighKey}`; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible, + label: { text: `${legendItemText}` }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + animateEmptyUpdateReady({ datumSelection, labelSelection }) { + const fns = prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(), "normal"), "unknown"); + motion2.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation2(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const { datumSelection: datumSelections, labelSelection, contextData, previousContextData } = data; + const dataDiff = import_ag_charts_community146._ModuleSupport.calculateDataDiff( + this.id, + datumSelections, + this.getDatumId.bind(this), + contextData, + previousContextData, + this.processedData, + this.processedDataUpdated + ); + this.ctx.animationManager.stopByAnimationGroupId(this.id); + const mode = previousContextData == null ? "fade" : "normal"; + const fns = prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(), mode), "added"); + motion2.fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [datumSelections], + fns, + (_, datum) => this.getDatumId(datum), + dataDiff + ); + if (dataDiff?.changed || !areScalingEqual2(contextData.groupScale, previousContextData?.groupScale)) { + seriesLabelFadeInAnimation2(this, "labels", this.ctx.animationManager, labelSelection); + } + } + getDatumId(datum) { + return `${datum.xValue}`; + } + isLabelEnabled() { + return this.properties.label.enabled; + } + onDataChange() { + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds4(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RangeBarSeries.className = "RangeBarSeries"; +RangeBarSeries.type = "range-bar"; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeriesOptionsDef.ts +var import_ag_charts_community147 = require("ag-charts-community"); +var import_ag_charts_core63 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs6, rangeBarSeriesThemeableOptionsDef } = import_ag_charts_community147._ModuleSupport; +var rangeBarSeriesOptionsDef = { + ...commonSeriesOptionsDefs6, + ...rangeBarSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core63.required)((0, import_ag_charts_core63.constant)("range-bar")), + xKey: (0, import_ag_charts_core63.required)(import_ag_charts_core63.string), + yLowKey: (0, import_ag_charts_core63.required)(import_ag_charts_core63.string), + yHighKey: (0, import_ag_charts_core63.required)(import_ag_charts_core63.string), + xName: import_ag_charts_core63.string, + yName: import_ag_charts_core63.string, + yLowName: import_ag_charts_core63.string, + yHighName: import_ag_charts_core63.string, + legendItemName: import_ag_charts_core63.string, + segmentation: import_ag_charts_core63.shapeSegmentation +}; +rangeBarSeriesOptionsDef.pickOutsideVisibleMinorAxis = (0, import_ag_charts_core63.undocumented)(import_ag_charts_core63.boolean); +rangeBarSeriesOptionsDef.focusPriority = (0, import_ag_charts_core63.undocumented)(import_ag_charts_core63.number); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarThemes.ts +var import_ag_charts_community148 = require("ag-charts-community"); +var RANGE_BAR_SERIES_THEME = { + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community148._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", import_ag_charts_community148._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community148._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + ...import_ag_charts_community148._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + placement: "inside", + padding: { $isUserOption: ["./spacing", 0, 6] } + // compatibility with old `padding` property (now named `spacing`). + }, + highlight: import_ag_charts_community148._ModuleSupport.multiSeriesHighlightStyle(), + segmentation: import_ag_charts_community148._ModuleSupport.SEGMENTATION_DEFAULTS + }, + axes: { + [import_ag_charts_community148._ModuleSupport.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { enabled: true } + } + } +}; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarModule.ts +var RangeBarModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "range-bar", + moduleFactory: (ctx) => new RangeBarSeries(ctx), + predictAxis: import_ag_charts_community149._ModuleSupport.predictCartesianTimeAxis, + defaultAxes: import_ag_charts_community149._ModuleSupport.DIRECTION_SWAP_AXES, + themeTemplate: RANGE_BAR_SERIES_THEME, + groupable: true +}; +var RangeBarSeriesModule = { + type: "series", + name: "range-bar", + chartType: "cartesian", + enterprise: true, + options: rangeBarSeriesOptionsDef, + create: (ctx) => new RangeBarSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallModule.ts +var import_ag_charts_community154 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeries.ts +var import_ag_charts_community151 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeriesProperties.ts +var import_ag_charts_community150 = require("ag-charts-community"); +var { AbstractBarSeriesProperties: AbstractBarSeriesProperties4, BaseProperties: BaseProperties19, PropertiesArray: PropertiesArray4, makeSeriesTooltip: makeSeriesTooltip7, Property: Property55, DropShadow: DropShadow3, Label: Label4 } = import_ag_charts_community150._ModuleSupport; +var WaterfallSeriesTotal = class extends BaseProperties19 { +}; +__decorateClass([ + Property55 +], WaterfallSeriesTotal.prototype, "totalType", 2); +__decorateClass([ + Property55 +], WaterfallSeriesTotal.prototype, "index", 2); +__decorateClass([ + Property55 +], WaterfallSeriesTotal.prototype, "axisLabel", 2); +var WaterfallSeriesItemTooltip = class extends BaseProperties19 { +}; +__decorateClass([ + Property55 +], WaterfallSeriesItemTooltip.prototype, "renderer", 2); +var WaterfallSeriesLabel = class extends Label4 { + constructor() { + super(...arguments); + this.placement = "outside-end"; + this.spacing = 0; + } +}; +__decorateClass([ + Property55 +], WaterfallSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property55 +], WaterfallSeriesLabel.prototype, "spacing", 2); +var WaterfallSeriesItem = class extends BaseProperties19 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.stroke = "#c16068"; + this.fillOpacity = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.cornerRadius = 0; + this.shadow = new DropShadow3().set({ enabled: false }); + this.label = new WaterfallSeriesLabel(); + this.tooltip = new WaterfallSeriesItemTooltip(); + } +}; +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "name", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "fill", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "fillOpacity", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "lineDashOffset", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "cornerRadius", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "itemStyler", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "shadow", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "label", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "tooltip", 2); +var WaterfallSeriesConnectorLine = class extends BaseProperties19 { + constructor() { + super(...arguments); + this.enabled = true; + this.stroke = "black"; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.strokeWidth = 2; + } +}; +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "enabled", 2); +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "stroke", 2); +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "strokeOpacity", 2); +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "lineDash", 2); +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "lineDashOffset", 2); +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "strokeWidth", 2); +var WaterfallSeriesItems = class extends BaseProperties19 { + constructor() { + super(...arguments); + this.positive = new WaterfallSeriesItem(); + this.negative = new WaterfallSeriesItem(); + this.total = new WaterfallSeriesItem(); + } +}; +__decorateClass([ + Property55 +], WaterfallSeriesItems.prototype, "positive", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItems.prototype, "negative", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItems.prototype, "total", 2); +var WaterfallSeriesProperties = class extends AbstractBarSeriesProperties4 { + constructor() { + super(...arguments); + this.item = new WaterfallSeriesItems(); + this.totals = new PropertiesArray4(WaterfallSeriesTotal); + this.line = new WaterfallSeriesConnectorLine(); + this.tooltip = makeSeriesTooltip7(); + } + getStyle(itemId) { + const { fillOpacity, strokeWidth, strokeOpacity, fill, stroke: stroke2, lineDash, lineDashOffset, cornerRadius } = this.item[itemId === "subtotal" ? "total" : itemId]; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "totals", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "line", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeries.ts +var { + adjustLabelPlacement, + SeriesNodePickMode: SeriesNodePickMode5, + fixNumericExtent: fixNumericExtent6, + valueProperty: valueProperty8, + keyProperty: keyProperty6, + accumulativeValueProperty, + trailingAccumulatedValueProperty, + ChartAxisDirection: ChartAxisDirection18, + createDatumId: createDatumId5, + checkCrisp: checkCrisp2, + updateLabelNode: updateLabelNode4, + prepareBarAnimationFunctions: prepareBarAnimationFunctions2, + collapsedStartingBarPosition, + resetBarSelectionsFn: resetBarSelectionsFn2, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation3, + resetLabelFn: resetLabelFn3, + animationValidation: animationValidation5, + DEFAULT_CARTESIAN_DIRECTION_KEYS: DEFAULT_CARTESIAN_DIRECTION_KEYS2, + DEFAULT_CARTESIAN_DIRECTION_NAMES: DEFAULT_CARTESIAN_DIRECTION_NAMES2, + computeBarFocusBounds: computeBarFocusBounds5, + isContinuous, + Rect: Rect3, + motion: motion3, + applyShapeStyle: applyShapeStyle6, + mergeDefaults: mergeDefaults9, + getItemStylesPerItemId: getItemStylesPerItemId2, + DataSet +} = import_ag_charts_community151._ModuleSupport; +var WaterfallSeries = class extends import_ag_charts_community151._ModuleSupport.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: DEFAULT_CARTESIAN_DIRECTION_KEYS2, + propertyNames: DEFAULT_CARTESIAN_DIRECTION_NAMES2, + categoryKey: void 0, + pickModes: [SeriesNodePickMode5.NEAREST_NODE, SeriesNodePickMode5.EXACT_SHAPE_MATCH], + pathsPerSeries: ["connector"], + pathsZIndexSubOrderOffset: [-1, -1], + animationResetFns: { + datum: resetBarSelectionsFn2, + label: resetLabelFn3 + } + }); + this.properties = new WaterfallSeriesProperties(); + this.seriesItemTypes = /* @__PURE__ */ new Set(["positive", "negative", "total"]); + } + async processData(dataController) { + const { xKey, yKey, totals } = this.properties; + const { data } = this; + if (!this.visible) + return; + const positiveNumber3 = (v) => isContinuous(v) && Number(v) >= 0; + const negativeNumber = (v) => isContinuous(v) && Number(v) >= 0; + const totalTypeValue = (v) => v === "total" || v === "subtotal"; + const propertyDefinition = { missingValue: void 0, invalidValue: void 0 }; + const dataWithTotals = []; + const totalsMap = totals.reduce((result, total) => { + const totalsAtIndex = result.get(total.index); + if (totalsAtIndex) { + totalsAtIndex.push(total); + } else { + result.set(total.index, [total]); + } + return result; + }, /* @__PURE__ */ new Map()); + for (const [i, datum] of data?.data.entries() ?? []) { + dataWithTotals.push(datum); + const totalsAtIndex = totalsMap.get(i); + if (totalsAtIndex) { + for (const total of totalsAtIndex) { + dataWithTotals.push({ ...total.toJson(), [xKey]: total.axisLabel }); + } + } + } + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + extraProps.push(animationValidation5()); + } + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const { processedData } = await this.requestDataModel( + dataController, + DataSet.wrap(dataWithTotals), + { + props: [ + keyProperty6(xKey, xScaleType, { id: `xValue` }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrent` + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + missingValue: 0, + id: `yCurrentTotal` + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrentPositive`, + validation: positiveNumber3 + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrentNegative`, + validation: negativeNumber + }), + trailingAccumulatedValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yPrevious` + }), + valueProperty8(yKey, yScaleType, { id: `yRaw` }), + // Raw value pass-through. + valueProperty8("totalType", "category", { + id: `totalTypeValue`, + missingValue: void 0, + validation: totalTypeValue + }), + ...isContinuousX ? [import_ag_charts_community151._ModuleSupport.SMALLEST_KEY_INTERVAL, import_ag_charts_community151._ModuleSupport.LARGEST_KEY_INTERVAL] : [], + ...extraProps + ] + } + ); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.updateSeriesItemTypes(); + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys], + values + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + return keys; + } + const isDirectionY = direction === ChartAxisDirection18.Y; + const isReversed = this.getCategoryAxis().isReversed(); + return this.padBandExtent(keys, isReversed !== isDirectionY); + } else { + const yCurrIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrent"); + const yExtent = values[yCurrIndex]; + const fixedYExtent = [Math.min(0, yExtent[0]), Math.max(0, yExtent[1])]; + return fixNumericExtent6(fixedYExtent); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { data, dataModel, processedData } = this; + const categoryAxis = this.getCategoryAxis(); + const valueAxis = this.getValueAxis(); + if (!data || !categoryAxis || !valueAxis || !dataModel || !processedData) { + return; + } + const { line } = this.properties; + const xScale = categoryAxis.scale; + const yScale = valueAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection18.X; + const barWidth = this.getBandwidth(categoryAxis) ?? 10; + const categoryAxisReversed = categoryAxis.isReversed(); + const valueAxisReversed = valueAxis.isReversed(); + if (processedData.type !== "ungrouped") + return; + const context = { + itemId: this.properties.yKey, + nodeData: [], + labelData: [], + pointData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStylesPerItemId2(this.getItemStyle.bind(this), "total", "subtotal", "positive", "negative") + }; + if (!this.visible) + return context; + const pointData = []; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yRawValues = dataModel.resolveColumnById(this, `yRaw`, processedData); + const totalTypeValues = dataModel.resolveColumnById( + this, + `totalTypeValue`, + processedData + ); + const yCurrValues = dataModel.resolveColumnById(this, "yCurrent", processedData); + const yPrevValues = dataModel.resolveColumnById(this, "yPrevious", processedData); + const yCurrTotalValues = dataModel.resolveColumnById(this, "yCurrentTotal", processedData); + const yDomain = this.getSeriesDomain(ChartAxisDirection18.Y); + const crisp = checkCrisp2( + categoryAxis?.scale, + categoryAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + function getValues(isTotal, isSubtotal, datumIndex) { + if (isTotal || isSubtotal) { + return { + cumulativeValue: yCurrTotalValues[datumIndex], + trailingValue: isSubtotal ? trailingSubtotal : 0 + }; + } + return { + cumulativeValue: yCurrValues[datumIndex], + trailingValue: yPrevValues[datumIndex] + }; + } + function getValue(isTotal, isSubtotal, rawValue, cumulativeValue, trailingValue) { + if (isTotal) { + return cumulativeValue; + } + if (isSubtotal) { + return (cumulativeValue ?? 0) - (trailingValue ?? 0); + } + return rawValue; + } + let trailingSubtotal = 0; + const { xKey, yKey, xName, yName } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const datumType = totalTypeValues[datumIndex]; + const isSubtotal = this.isSubtotal(datumType); + const isTotal = this.isTotal(datumType); + const isTotalOrSubtotal = isTotal || isSubtotal; + const xDatum = xValues[datumIndex]; + if (xDatum == null) + continue; + const x = Math.round(xScale.convert(xDatum)); + const rawValue = yRawValues[datumIndex]; + const { cumulativeValue, trailingValue } = getValues(isTotal, isSubtotal, datumIndex); + if (isTotalOrSubtotal) { + trailingSubtotal = cumulativeValue ?? 0; + } + const currY = Math.round(yScale.convert(cumulativeValue)); + const trailY = Math.round(yScale.convert(trailingValue)); + const value = getValue(isTotal, isSubtotal, rawValue, cumulativeValue, trailingValue); + const isPositive = (value ?? 0) >= 0; + const seriesItemType = this.getSeriesItemType(isPositive, datumType); + const { strokeWidth, label } = this.getItemConfig(seriesItemType); + const y = isPositive ? currY : trailY; + const bottomY = isPositive ? trailY : currY; + const barHeight = Math.max(strokeWidth, Math.abs(bottomY - y)); + const rect = { + x: barAlongX ? Math.min(y, bottomY) : x, + y: barAlongX ? x : Math.min(y, bottomY), + width: barAlongX ? barHeight : barWidth, + height: barAlongX ? barWidth : barHeight + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const pointY = isTotalOrSubtotal ? currY : trailY; + const pixelAlignmentOffset = Math.floor(line.strokeWidth) % 2 / 2; + const startY = categoryAxisReversed ? currY : pointY; + const stopY = categoryAxisReversed ? pointY : currY; + let startCoordinates; + let stopCoordinates; + if (barAlongX) { + startCoordinates = { + x: startY + pixelAlignmentOffset, + y: rect.y + }; + stopCoordinates = { + x: stopY + pixelAlignmentOffset, + y: rect.y + rect.height + }; + } else { + startCoordinates = { + x: rect.x, + y: startY + pixelAlignmentOffset + }; + stopCoordinates = { + x: rect.x + rect.width, + y: stopY + pixelAlignmentOffset + }; + } + const pathPoint = { + // lineTo + x: categoryAxisReversed ? stopCoordinates.x : startCoordinates.x, + y: categoryAxisReversed ? stopCoordinates.y : startCoordinates.y, + // moveTo + x2: categoryAxisReversed ? startCoordinates.x : stopCoordinates.x, + y2: categoryAxisReversed ? startCoordinates.y : stopCoordinates.y, + size: 0 + }; + pointData.push(pathPoint); + const itemId = seriesItemType === "subtotal" ? "total" : seriesItemType; + const labelText = this.getLabelText( + value, + datum, + yKey, + "y", + yDomain, + label, + { + itemId, + value, + datum, + xKey, + yKey, + xName, + yName + } + ); + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + const nodeDatum = { + index: datumIndex, + series: this, + itemId: seriesItemType, + datum, + datumIndex, + cumulativeValue: cumulativeValue ?? 0, + xValue: xDatum, + yValue: value, + yKey, + xKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + label: { + text: labelText, + ...adjustLabelPlacement({ + isUpward: (value ?? -1) >= 0 !== valueAxisReversed, + isVertical: !barAlongX, + placement: label.placement, + spacing, + rect + }) + } + }; + context.nodeData.push(nodeDatum); + context.labelData.push(nodeDatum); + } + const connectorLinesEnabled = this.properties.line.enabled; + if (yCurrValues != null && connectorLinesEnabled) { + context.pointData = pointData; + } + return context; + } + updateSeriesItemTypes() { + const { dataModel, seriesItemTypes, processedData } = this; + if (!dataModel || !processedData) { + return; + } + seriesItemTypes.clear(); + const yPositiveIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrentPositive"); + const yNegativeIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrentNegative"); + const totalTypeIndex = dataModel.resolveProcessedDataIndexById(this, `totalTypeValue`); + const positiveDomain = processedData.domain.values[yPositiveIndex] ?? []; + const negativeDomain = processedData.domain.values[yNegativeIndex] ?? []; + if (positiveDomain.length > 0) { + seriesItemTypes.add("positive"); + } + if (negativeDomain.length > 0) { + seriesItemTypes.add("negative"); + } + const itemTypes = processedData?.domain.values[totalTypeIndex]; + if (!itemTypes) { + return; + } + for (const type of itemTypes) { + if (type === "total" || type === "subtotal") { + seriesItemTypes.add("total"); + } + } + } + isSubtotal(datumType) { + return datumType === "subtotal"; + } + isTotal(datumType) { + return datumType === "total"; + } + nodeFactory() { + return new Rect3(); + } + getSeriesItemType(isPositive, datumType) { + return datumType ?? (isPositive ? "positive" : "negative"); + } + getItemConfig(seriesItemType) { + switch (seriesItemType) { + case "positive": { + return this.properties.item.positive; + } + case "negative": { + return this.properties.item.negative; + } + case "subtotal": + case "total": { + return this.properties.item.total; + } + } + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data); + } + getItemStyle(nodeDatum, isHighlight, highlightState, itemId = "total") { + const { properties } = this; + const { datumIndex = 0, datum } = nodeDatum ?? {}; + const propertyItemId = itemId === "subtotal" ? "total" : itemId; + const item = properties.item[propertyItemId]; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + const baseStyle = mergeDefaults9(highlightStyle, properties.getStyle(itemId)); + const { itemStyler } = item; + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId5(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(itemId, datumIndex, datum, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`, "item", propertyItemId], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults9(overrides, style); + } + } + return style; + } + makeItemStylerParams(itemId, datumIndex, datum, isHighlight, style) { + const { id: seriesId, properties } = this; + const { xKey, yKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + itemId, + datum, + xKey, + yKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection18.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle6(rect, style, fillBBox); + rect.cornerRadius = style.cornerRadius ?? 0; + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + if (labelData.length === 0) { + return labelSelection.update([]); + } + const data = labelData.filter((labelDatum) => { + const { label } = this.getItemConfig(labelDatum.itemId); + return label.enabled; + }); + return labelSelection.update(data); + } + updateLabelNodes(opts) { + const params = { + itemId: "positive", + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xName, + yKey: this.properties.yKey, + yName: this.properties.yName ?? this.properties.yName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + params.itemId = datum.itemId; + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex)?.opacity ?? 1; + const label = this.getItemConfig(datum.itemId).label; + updateLabelNode4(this, textNode, params, label, datum.label, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yKey, yName, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yRaw`, processedData)[datumIndex]; + const yCurrTotalValues = dataModel.resolveColumnById(this, "yCurrentTotal", processedData); + const totalTypeValues = dataModel.resolveColumnById( + this, + `totalTypeValue`, + processedData + ); + if (xValue2 == null) + return; + const datumType = totalTypeValues[datumIndex]; + const isPositive = (yValue ?? 0) >= 0; + const seriesItemType = this.getSeriesItemType(isPositive, datumType); + let total; + if (this.isTotal(datumType)) { + total = yCurrTotalValues[datumIndex]; + } else if (this.isSubtotal(datumType)) { + total = yCurrTotalValues[datumIndex]; + for (let previousIndex = datumIndex - 1; previousIndex >= 0; previousIndex -= 1) { + if (this.isSubtotal(totalTypeValues[previousIndex])) { + total = total - yCurrTotalValues[previousIndex]; + break; + } + } + } else { + total = yValue; + } + const nodeDatum = this.contextNodeData?.nodeData?.[datumIndex]; + const format = this.getItemStyle(nodeDatum, false, void 0, nodeDatum?.itemId); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(seriesItemType), + data: [ + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", total, datum, yKey, legendItemName) + } + ] + }, + { seriesId, datum, title: yName, itemId: seriesItemType, xKey, xName, yKey, yName, ...format } + ); + } + legendItemSymbol(item) { + const { fill, stroke: stroke2, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.getItemConfig(item); + return { + marker: { + fill, + stroke: stroke2, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id, seriesItemTypes } = this; + const legendData = []; + const capitalise = (text2) => text2.charAt(0).toUpperCase() + text2.substring(1); + const { showInLegend } = this.properties; + for (const item of seriesItemTypes) { + const { name } = this.getItemConfig(item); + legendData.push({ + legendType: "category", + id, + itemId: item, + seriesId: id, + enabled: true, + label: { text: name ?? capitalise(item) }, + symbol: this.legendItemSymbol(item), + hideInLegend: !showInLegend, + isFixed: true + }); + } + return legendData; + } + toggleSeriesItem() { + } + animateEmptyUpdateReady(opts) { + const { datumSelection, labelSelection, contextData } = opts; + const fns = prepareBarAnimationFunctions2( + collapsedStartingBarPosition(this.isVertical(), this.axes, "normal"), + "unknown" + ); + motion3.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation3(this, "labels", this.ctx.animationManager, labelSelection); + const { pointData } = contextData; + if (!pointData) + return; + if (this.isVertical()) { + this.animateConnectorLinesVertical(opts); + } else { + this.animateConnectorLinesHorizontal(opts); + } + } + animateConnectorLinesHorizontal(opts) { + const { pointData = [] } = opts.contextData; + const [lineNode] = opts.paths; + const { path: linePath } = lineNode; + this.updateLineNode(lineNode); + const valueAxis = this.getValueAxis(); + const valueAxisReversed = valueAxis?.isReversed(); + const compare = valueAxisReversed ? (v, v2) => v < v2 : (v, v2) => v > v2; + const startX = valueAxis?.scale.convert(0); + const endX = pointData.reduce( + (end, point) => { + if (compare(point.x, end)) { + end = point.x; + } + return end; + }, + valueAxisReversed ? Infinity : 0 + ); + const scale = (value, start1, end1, start2, end2) => { + return (value - start1) / (end1 - start1) * (end2 - start2) + start2; + }; + this.ctx.animationManager.animate({ + id: `${this.id}_connectors`, + groupId: this.id, + phase: "initial", + from: startX, + to: endX, + ease: import_ag_charts_community151._ModuleSupport.Motion.easeOut, + collapsable: false, + onUpdate(pointX) { + linePath.clear(true); + for (const [index, point] of pointData.entries()) { + const x = scale(pointX, startX, endX, startX, point.x); + const x2 = scale(pointX, startX, endX, startX, point.x2); + if (index !== 0) { + linePath.lineTo(x, point.y); + } + linePath.moveTo(x2, point.y2); + } + lineNode.checkPathDirty(); + }, + onStop: () => this.resetConnectorLinesPath(opts) + }); + } + animateConnectorLinesVertical(opts) { + const { pointData = [] } = opts.contextData; + const [lineNode] = opts.paths; + const { path: linePath } = lineNode; + this.updateLineNode(lineNode); + const valueAxis = this.getValueAxis(); + const valueAxisReversed = valueAxis?.isReversed(); + const compare = valueAxisReversed ? (v, v2) => v > v2 : (v, v2) => v < v2; + const startY = valueAxis?.scale.convert(0); + const endY = pointData.reduce( + (end, point) => { + if (compare(point.y, end)) { + end = point.y; + } + return end; + }, + valueAxisReversed ? 0 : Infinity + ); + const scale = (value, start1, end1, start2, end2) => { + return (value - start1) / (end1 - start1) * (end2 - start2) + start2; + }; + this.ctx.animationManager.animate({ + id: `${this.id}_connectors`, + groupId: this.id, + phase: "initial", + from: startY, + to: endY, + ease: import_ag_charts_community151._ModuleSupport.Motion.easeOut, + collapsable: false, + onUpdate(pointY) { + linePath.clear(true); + for (const [index, point] of pointData.entries()) { + const y = scale(pointY, startY, endY, startY, point.y); + const y2 = scale(pointY, startY, endY, startY, point.y2); + if (index !== 0) { + linePath.lineTo(point.x, y); + } + linePath.moveTo(point.x2, y2); + } + lineNode.checkPathDirty(); + }, + onStop: () => this.resetConnectorLinesPath(opts) + }); + } + animateReadyResize(data) { + super.animateReadyResize(data); + this.resetConnectorLinesPath(data); + } + updatePaths(opts) { + this.resetConnectorLinesPath({ contextData: opts.contextData, paths: opts.paths }); + } + resetConnectorLinesPath({ + contextData, + paths + }) { + if (paths.length === 0) { + return; + } + const [lineNode] = paths; + this.updateLineNode(lineNode); + const { path: linePath } = lineNode; + linePath.clear(true); + const { pointData } = contextData; + if (!pointData) { + return; + } + for (const [index, point] of pointData.entries()) { + if (index !== 0) { + linePath.lineTo(point.x, point.y); + } + linePath.moveTo(point.x2, point.y2); + } + lineNode.checkPathDirty(); + } + updateLineNode(lineNode) { + const { stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this.properties.line; + lineNode.setProperties({ + fill: void 0, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + lineJoin: "round", + pointerEvents: import_ag_charts_community151._ModuleSupport.PointerEvents.None + }); + } + isLabelEnabled() { + const { positive, negative, total } = this.properties.item; + return positive.label.enabled || negative.label.enabled || total.label.enabled; + } + onDataChange() { + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds5(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + const { positive, negative, total } = this.properties.item; + return positive.itemStyler != null || positive.label.itemStyler != null || negative.itemStyler != null || negative.label.itemStyler != null || total.itemStyler != null || total.label.itemStyler != null; + } +}; +WaterfallSeries.className = "WaterfallSeries"; +WaterfallSeries.type = "waterfall"; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeriesOptionsDef.ts +var import_ag_charts_community152 = require("ag-charts-community"); +var import_ag_charts_core64 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs7, waterfallSeriesThemeableOptionsDef } = import_ag_charts_community152._ModuleSupport; +var waterfallSeriesOptionsDef = { + ...waterfallSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs7, + type: (0, import_ag_charts_core64.required)((0, import_ag_charts_core64.constant)("waterfall")), + xKey: (0, import_ag_charts_core64.required)(import_ag_charts_core64.string), + yKey: (0, import_ag_charts_core64.required)(import_ag_charts_core64.string), + xName: import_ag_charts_core64.string, + yName: import_ag_charts_core64.string, + totals: (0, import_ag_charts_core64.arrayOfDefs)( + { + totalType: (0, import_ag_charts_core64.required)((0, import_ag_charts_core64.union)("total", "subtotal")), + index: (0, import_ag_charts_core64.required)(import_ag_charts_core64.positiveNumber), + axisLabel: (0, import_ag_charts_core64.required)(import_ag_charts_core64.string) + }, + "a total definition options array" + ) +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallThemes.ts +var import_ag_charts_community153 = require("ag-charts-community"); +var { FILL_GRADIENT_LINEAR_KEYED_DEFAULTS: FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2, FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS3, FILL_PATTERN_KEYED_DEFAULTS: FILL_PATTERN_KEYED_DEFAULTS2 } = import_ag_charts_community153._ModuleSupport; +function itemTheme2(key, index) { + return { + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $path: [`/${index}`, { $palette: "fill" }, { $palette: "fills" }] }, + { $palette: `${key}.fill` } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2(key)], + ["image", FILL_IMAGE_DEFAULTS3], + ["pattern", FILL_PATTERN_KEYED_DEFAULTS2(key)] + ] + }, + stroke: { $palette: `${key}.stroke` }, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + ...import_ag_charts_community153._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + formatter: void 0, + placement: "outside-end", + padding: { $isUserOption: ["./spacing", 0, 6] } + // compatibility with old `padding` property (now named `spacing`). + } + }; +} +var WATERFALL_SERIES_THEME = { + series: { + item: { + positive: itemTheme2("altUp", 0), + negative: itemTheme2("altDown", 1), + total: itemTheme2("neutral", 2) + }, + line: { + stroke: { $palette: "neutral.stroke" }, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0, + strokeWidth: 2 + }, + highlight: import_ag_charts_community153._ModuleSupport.singleSeriesHighlightStyle() + }, + legend: { + enabled: true, + toggleSeries: false + } +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallModule.ts +var WaterfallModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "waterfall", + solo: true, + moduleFactory: (ctx) => new WaterfallSeries(ctx), + defaultAxes: import_ag_charts_community154._ModuleSupport.DIRECTION_SWAP_AXES, + themeTemplate: WATERFALL_SERIES_THEME +}; +var WaterfallSeriesModule = { + type: "series", + name: "waterfall", + chartType: "cartesian", + enterprise: true, + options: waterfallSeriesOptionsDef, + create: (ctx) => new WaterfallSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorOptionsDefs.ts +var { + NewAreaSeriesModule, + NewBarSeriesModule, + NewBubbleSeriesModule, + NewHistogramSeriesModule, + NewLineSeriesModule, + NewScatterSeriesModule, + numberFormatValidator, + textOrSegments, + without: without2 +} = import_ag_charts_community155._ModuleSupport; +var navigatorHandleOptionsDef = { + width: import_ag_charts_core65.positiveNumber, + height: import_ag_charts_core65.positiveNumber, + grip: import_ag_charts_core65.boolean, + fill: import_ag_charts_core65.color, + stroke: import_ag_charts_core65.color, + strokeWidth: import_ag_charts_core65.positiveNumber, + cornerRadius: import_ag_charts_core65.positiveNumber +}; +var commonIgnoredMiniChartProperties = [ + "cursor", + "highlightStyle", + "listeners", + "nodeClickRange", + "showInLegend", + "showInMiniChart", + "tooltip", + "visible", + "xName", + "yName" +]; +var barIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "label", + "legendItemName", + "direction" +]; +var boxPlotIngnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction", + "legendItemName", + "minName", + "q1Name", + "medianName", + "q3Name", + "maxName" +]; +var bubbleIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "title", + "label", + "labelKey", + "labelName", + "sizeName" +]; +var heatmapIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "title", + "label", + "colorName", + "textAlign", + "verticalAlign", + "itemPadding", + "colorRange" +]; +var histogramIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "label" +]; +var lineIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "title", + "label" +]; +var rangeAreaIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "label", + "yLowName", + "yHighName" +]; +var rangeBarIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction", + "label", + "yLowName", + "yHighName" +]; +var scatterIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "title", + "label", + "labelKey", + "labelName" +]; +var waterfallIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction" +]; +var navigatorOptionsDef = { + enabled: import_ag_charts_core65.boolean, + height: import_ag_charts_core65.positiveNumber, + spacing: import_ag_charts_core65.positiveNumber, + cornerRadius: import_ag_charts_core65.number, + mask: { + fill: import_ag_charts_core65.color, + fillOpacity: import_ag_charts_core65.ratio, + stroke: import_ag_charts_core65.color, + strokeWidth: import_ag_charts_core65.positiveNumber + }, + minHandle: navigatorHandleOptionsDef, + maxHandle: navigatorHandleOptionsDef, + miniChart: { + enabled: import_ag_charts_core65.boolean, + padding: { + top: import_ag_charts_core65.positiveNumber, + bottom: import_ag_charts_core65.positiveNumber + }, + label: { + enabled: import_ag_charts_core65.boolean, + avoidCollisions: import_ag_charts_core65.boolean, + spacing: import_ag_charts_core65.positiveNumber, + format: numberFormatValidator, + formatter: (0, import_ag_charts_core65.callbackOf)(textOrSegments), + interval: { + minSpacing: import_ag_charts_core65.positiveNumber, + maxSpacing: import_ag_charts_core65.positiveNumber, + values: import_ag_charts_core65.array, + step: import_ag_charts_core65.number + }, + ...import_ag_charts_core65.fontOptionsDef + }, + series: (0, import_ag_charts_core65.arrayOfDefs)( + (0, import_ag_charts_core65.typeUnion)( + { + area: without2(NewAreaSeriesModule.options, [...commonIgnoredMiniChartProperties, "type"]), + bar: without2(NewBarSeriesModule.options, [...barIgnoredMiniChartProperties, "type"]), + "box-plot": without2(BoxPlotSeriesModule.options, [...boxPlotIngnoredMiniChartProperties, "type"]), + bubble: without2(NewBubbleSeriesModule.options, [...bubbleIgnoredMiniChartProperties, "type"]), + candlestick: without2(CandlestickSeriesModule.options, [ + ...commonIgnoredMiniChartProperties, + "type" + ]), + heatmap: without2(HeatmapSeriesModule.options, [...heatmapIgnoredMiniChartProperties, "type"]), + histogram: without2(NewHistogramSeriesModule.options, [ + ...histogramIgnoredMiniChartProperties, + "type" + ]), + line: without2(NewLineSeriesModule.options, [...lineIgnoredMiniChartProperties, "type"]), + ohlc: without2(OhlcSeriesModule.options, [...commonIgnoredMiniChartProperties, "type"]), + "range-area": without2(RangeAreaSeriesModule.options, [ + ...rangeAreaIgnoredMiniChartProperties, + "type" + ]), + "range-bar": without2(RangeBarSeriesModule.options, [...rangeBarIgnoredMiniChartProperties, "type"]), + scatter: without2(NewScatterSeriesModule.options, [...scatterIgnoredMiniChartProperties, "type"]), + waterfall: without2(WaterfallSeriesModule.options, [...waterfallIgnoredMiniChartProperties, "type"]) + }, + "miniChart series options" + ) + ) + } +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorTheme.ts +var validMiniChartSeriesTypes = [ + "area", + "bar", + "bubble", + "candlestick", + "heatmap", + "histogram", + "line", + "ohlc", + "range-area", + "range-bar", + "scatter", + "waterfall" +]; +var priceVolumePresetIgnoredMiniChartProperties = [ + "itemStyler", + "direction", + "fill", + "fillGradientDefaults", + "fillPatternDefaults", + "fillImageDefaults", + "fillOpacity", + "shadow", + "focusPriority", + "highlight", + "lineDash", + "lineDashOffset", + "strokeWidth" +]; +function miniChartSeriesTheme(seriesPath, typePath) { + return { + $merge: [ + { + $switch: [ + typePath, + {}, + [ + ["area", "line", "range-area"], + { + marker: { + enabled: { + $isUserOption: [ + "/series/$index/marker/enabled", + { $path: ["/series/$index/marker/enabled", false] }, + false + ] + } + } + } + ] + ] + }, + { + $omit: [ + { + $switch: [ + typePath, + commonIgnoredMiniChartProperties, + ["bar", barIgnoredMiniChartProperties], + ["box-plot", boxPlotIngnoredMiniChartProperties], + ["bubble", bubbleIgnoredMiniChartProperties], + ["heatmap", heatmapIgnoredMiniChartProperties], + ["histogram", histogramIgnoredMiniChartProperties], + [ + "line", + [...lineIgnoredMiniChartProperties, ...priceVolumePresetIgnoredMiniChartProperties] + ], + ["range-area", rangeAreaIgnoredMiniChartProperties], + ["range-bar", rangeBarIgnoredMiniChartProperties], + ["scatter", scatterIgnoredMiniChartProperties], + ["waterfall", waterfallIgnoredMiniChartProperties] + ] + }, + seriesPath + ] + } + ] + }; +} +var NAVIGATOR_THEME = { + enabled: false, + height: { $if: [{ $path: "./miniChart/enabled" }, 40, 18] }, + cornerRadius: 4, + mask: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.1, + stroke: { $ref: "borderColor" }, + strokeWidth: 1 + }, + minHandle: { + fill: { $ref: "chartBackgroundColor" }, + stroke: { $ref: "borderColor" }, + strokeWidth: 1, + width: 12, + height: 24, + cornerRadius: 4 + }, + maxHandle: { + fill: { $ref: "chartBackgroundColor" }, + stroke: { $ref: "borderColor" }, + strokeWidth: 1, + width: 12, + height: 24, + cornerRadius: 4 + }, + miniChart: { + enabled: false, + label: { + color: { $ref: "textColor" }, + fontSize: { $rem: import_ag_charts_community156._ModuleSupport.FONT_SIZE_RATIO.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + spacing: 5 + }, + padding: { + top: 0, + bottom: 0 + }, + series: { + $apply: [ + miniChartSeriesTheme( + { $path: "/series/$index" }, + { + $path: [ + "/navigator/miniChart/series/$index/type", + { $path: ["type", { $path: "/series/$index/type" }] } + ] + } + ), + { + // TODO: this should be a $switch but switches can not resolve the case value yet + $if: [ + { + $or: validMiniChartSeriesTypes.map((type) => ({ + $eq: [{ $path: "/series/0/type" }, type] + })) + }, + { + $map: [ + miniChartSeriesTheme({ $value: "$1" }, { $path: "/series/$index/type" }), + { $path: "/series" } + ] + }, + void 0 + ] + } + ] + } + } +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorModule.ts +var NavigatorModule = { + type: "root", + optionsKey: "navigator", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new Navigator(ctx), + removable: false, + // Toggling this module causes zoom state flakiness. + themeTemplate: { + navigator: NAVIGATOR_THEME + } +}; + +// packages/ag-charts-enterprise/src/features/ranges/ranges.ts +var import_ag_charts_community158 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/ranges/rangesButtonProperties.ts +var import_ag_charts_community157 = require("ag-charts-community"); +var { ToolbarButtonProperties: ToolbarButtonProperties3, Property: Property56 } = import_ag_charts_community157._ModuleSupport; +var RangesButtonProperties = class extends ToolbarButtonProperties3 { +}; +__decorateClass([ + Property56 +], RangesButtonProperties.prototype, "value", 2); + +// packages/ag-charts-enterprise/src/features/ranges/ranges.ts +var { ChartAxisDirection: ChartAxisDirection19, LayoutElement: LayoutElement3, PropertiesArray: PropertiesArray5, Toolbar, Property: Property57 } = import_ag_charts_community158._ModuleSupport; +var Ranges = class extends import_ag_charts_community158._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.buttons = new PropertiesArray5(RangesButtonProperties); + this.verticalSpacing = 10; + this.container = ctx.domManager.addChild("canvas-overlay", "range-buttons"); + this.container.role = "presentation"; + this.toolbar = new Toolbar(this.ctx, "ariaLabelRangesToolbar", "horizontal"); + this.toolbar.addClass("ag-charts-range-buttons"); + this.container.append(this.toolbar.getElement()); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPress.bind(this)), + ctx.layoutManager.registerElement(LayoutElement3.ToolbarBottom, this.onLayoutStart.bind(this)), + ctx.eventsHub.on("zoom:change", this.onZoomChanged.bind(this)), + this.teardown.bind(this) + ); + } + teardown() { + this.toolbar.getElement().remove(); + this.toolbar.destroy(); + } + onLayoutStart(event) { + const { buttons: buttons2, ctx, enabled, toolbar: toolbar2, verticalSpacing } = this; + const { layoutBox } = event; + if (!enabled || !ctx.zoomManager.isZoomEnabled()) { + toolbar2.setHidden(true); + return; + } + toolbar2.setHidden(false); + toolbar2.updateButtons(buttons2); + const height = toolbar2.getBounds().height; + toolbar2.setBounds({ + x: layoutBox.x, + y: layoutBox.y + layoutBox.height - height, + width: layoutBox.width, + height + }); + layoutBox.shrink({ bottom: height + verticalSpacing }); + } + onZoomChanged() { + this.toolbar.clearActiveButton(); + } + onButtonPress({ button: { index } }) { + const { zoomManager } = this.ctx; + const button = this.buttons.at(index); + if (!button) + return; + const { value } = button; + if (value == null) { + zoomManager.resetZoom("zoom-buttons"); + } else if (typeof value === "number") { + zoomManager.extendToEnd("zoom-buttons", ChartAxisDirection19.X, value); + } else if (Array.isArray(value)) { + zoomManager.updateWith("zoom-buttons", ChartAxisDirection19.X, () => value); + } else if (typeof value === "function") { + zoomManager.updateWith("zoom-buttons", ChartAxisDirection19.X, value); + } + this.toolbar.toggleActiveButtonByIndex(index); + } +}; +__decorateClass([ + Property57 +], Ranges.prototype, "enabled", 2); +__decorateClass([ + Property57 +], Ranges.prototype, "buttons", 2); + +// packages/ag-charts-enterprise/src/features/ranges/rangesModule.ts +var DAY = 1e3 * 60 * 60 * 24; +var MONTH = DAY * 30; +var YEAR = DAY * 365; +var RangesModule = { + type: "root", + optionsKey: "ranges", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new Ranges(ctx), + themeTemplate: { + ranges: { + enabled: false, + buttons: { + $shallowSimple: [ + { + label: "toolbarRange1Month", + ariaLabel: "toolbarRange1MonthAria", + value: MONTH + }, + { + label: "toolbarRange3Months", + ariaLabel: "toolbarRange3MonthsAria", + value: 3 * MONTH + }, + { + label: "toolbarRange6Months", + ariaLabel: "toolbarRange6MonthsAria", + value: 6 * MONTH + }, + { + label: "toolbarRangeYearToDate", + ariaLabel: "toolbarRangeYearToDateAria", + value: (_start, end) => [ + (/* @__PURE__ */ new Date(`${new Date(end).getFullYear()}-01-01`)).getTime(), + void 0 + ] + }, + { + label: "toolbarRange1Year", + ariaLabel: "toolbarRange1YearAria", + value: YEAR + }, + { + label: "toolbarRangeAll", + ariaLabel: "toolbarRangeAllAria", + value: void 0 + // Reset zoom + } + ] + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/shared-toolbar/sharedToolbar.ts +var import_ag_charts_community159 = require("ag-charts-community"); +var _SharedToolbar = class _SharedToolbar extends import_ag_charts_community159._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.activeSections = /* @__PURE__ */ new Set(); + this.sectionButtons = { + annotations: [], + chartToolbar: [] + }; + this.container = this.ctx.domManager.addChild("canvas-overlay", "shared-toolbar"); + this.container.role = "presentation"; + } + getSharedToolbar(section) { + if (!this.sharedToolbar) { + this.createSharedToolbar(); + } + if (section === "chartToolbar" && this.sharedToolbar) { + this.sharedToolbar.setAriaLabelId("ariaLabelFinancialCharts"); + } + return this.toolbarWithSection(section); + } + createSharedToolbar() { + this.sharedToolbar = new import_ag_charts_community159._ModuleSupport.Toolbar(this.ctx, "ariaLabelAnnotationsToolbar", "vertical"); + this.sharedToolbar.addClass("ag-charts-shared-toolbar"); + this.container.append(this.sharedToolbar.getElement()); + this.cleanup.register(() => { + if (!this.sharedToolbar) + return; + this.sharedToolbar.getElement().remove(); + this.sharedToolbar.destroy(); + this.sharedToolbar = void 0; + }); + } + toolbarWithSection(section) { + const sharedToolbar = this.sharedToolbar; + const withSection = { + layout: (layoutBox, padding) => { + if (this.firstLayoutSection != null && this.firstLayoutSection !== section && this.activeSections.has(this.firstLayoutSection)) { + return; + } + this.firstLayoutSection = section; + const width = sharedToolbar.getBounds().width; + sharedToolbar.setBounds({ + x: layoutBox.x, + y: layoutBox.y, + width + }); + layoutBox.shrink({ left: width + sharedToolbar.horizontalSpacing + (padding ?? 0) }); + }, + addToolbarListener: (eventType, handler) => { + return sharedToolbar.addToolbarListener(eventType, (sharedEvent) => { + const sectionIndex = this.getSectionIndex(section, sharedEvent.button.index); + if (sectionIndex < 0) + return; + const event = { + ...sharedEvent, + button: this.sectionButtons[section][sectionIndex] + }; + handler(event); + }); + }, + updateButtons: (buttons2) => { + this.sectionButtons[section] = buttons2; + const sharedButtons = _SharedToolbar.SECTION_ORDER.flatMap((order) => this.sectionButtons[order]); + sharedToolbar.updateButtons(sharedButtons); + }, + updateButtonByIndex: (index, button) => { + sharedToolbar.updateButtonByIndex(this.getIndex(section, index), button); + }, + toggleActiveButtonByIndex: (index) => { + sharedToolbar.toggleActiveButtonByIndex(this.getIndex(section, index)); + }, + toggleButtonEnabledByIndex: (index, enabled) => { + sharedToolbar.toggleButtonEnabledByIndex(this.getIndex(section, index), enabled); + }, + setHidden: (hidden) => { + if (hidden) { + this.activeSections.delete(section); + } else { + this.activeSections.add(section); + } + let sum = 0; + for (const order of _SharedToolbar.SECTION_ORDER) { + if (order !== section) { + sum += this.sectionButtons[order].length; + continue; + } + for (const index of this.sectionButtons[section].keys()) { + sharedToolbar.setButtonHiddenByIndex(sum + index, hidden); + } + } + }, + destroy: () => { + withSection.setHidden(true); + if (this.activeSections.size === 0) { + this.destroy(); + } + }, + clearActiveButton: sharedToolbar.clearActiveButton.bind(sharedToolbar), + addListener: sharedToolbar.addListener.bind(sharedToolbar), + removeListener: sharedToolbar.removeListener.bind(sharedToolbar) + }; + withSection.setHidden(false); + return withSection; + } + getIndex(section, index) { + let sum = 0; + for (const order of _SharedToolbar.SECTION_ORDER) { + if (order === section) + return sum + index; + sum += this.sectionButtons[order].length; + } + return -1; + } + getSectionIndex(section, index) { + let sum = 0; + for (const order of _SharedToolbar.SECTION_ORDER) { + if (order === section) { + if (index >= sum + this.sectionButtons[section].length) + return -1; + return index - sum; + } + sum += this.sectionButtons[order].length; + } + return -1; + } +}; +_SharedToolbar.SECTION_ORDER = ["chartToolbar", "annotations"]; +var SharedToolbar = _SharedToolbar; + +// packages/ag-charts-enterprise/src/features/shared-toolbar/sharedToolbarModule.ts +var SharedToolbarModule = { + type: "context", + contextKey: "sharedToolbar", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new SharedToolbar(ctx) +}; + +// packages/ag-charts-enterprise/src/features/status-bar/statusBarModule.ts +var import_ag_charts_community161 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/status-bar/statusBar.ts +var import_ag_charts_community160 = require("ag-charts-community"); +var import_ag_charts_core66 = require("ag-charts-core"); +var { ZIndexMap: ZIndexMap8, LayoutElement: LayoutElement4, Property: Property58, BaseProperties: BaseProperties20, valueProperty: valueProperty9, Group: Group7, Label: Label5, Rect: Rect4, Text } = import_ag_charts_community160._ModuleSupport; +var chartConfigurations = { + ohlc: 2 /* Open */ | 4 /* Close */ | 8 /* Low */ | 16 /* High */ | 32 /* Volume */, + candlestick: 2 /* Open */ | 4 /* Close */ | 8 /* Low */ | 16 /* High */ | 32 /* Volume */, + "hollow-candlestick": 2 /* Open */ | 4 /* Close */ | 8 /* Low */ | 16 /* High */ | 32 /* Volume */, + line: 64 /* UnlabelledClose */ | 32 /* Volume */, + "step-line": 64 /* UnlabelledClose */ | 32 /* Volume */, + hlc: 128 /* NeutralClose */ | 8 /* Low */ | 16 /* High */ | 32 /* Volume */, + "high-low": 512 /* NeutralLow */ | 256 /* NeutralHigh */ | 32 /* Volume */ +}; +var itemIdMap = { + up: "positive", + down: "negative" +}; +var neutralColorMap = { + hlc: "altNeutral" +}; +var StatusBarBackground = class extends BaseProperties20 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + } +}; +__decorateClass([ + Property58 +], StatusBarBackground.prototype, "fill", 2); +__decorateClass([ + Property58 +], StatusBarBackground.prototype, "fillOpacity", 2); +var StatusBar = class extends import_ag_charts_community160._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.openKey = void 0; + this.highKey = void 0; + this.lowKey = void 0; + this.closeKey = void 0; + this.volumeKey = void 0; + this.title = new Label5(); + this.positive = new Label5(); + this.negative = new Label5(); + this.neutral = new Label5(); + this.altNeutral = new Label5(); + this.background = new StatusBarBackground(); + this.layoutStyle = "block"; + this.id = "status-bar"; + this.data = void 0; + this.layer = new Group7({ + name: "StatusBar", + zIndex: ZIndexMap8.STATUS_BAR + }); + this.labelGroup = this.layer.appendChild(new import_ag_charts_community160._ModuleSupport.TranslatableGroup()); + this.backgroundNode = this.labelGroup.appendChild(new Rect4()); + this.labels = [ + { + label: "O", + configuration: 2 /* Open */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "openValue", + key: "openKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "H", + configuration: 16 /* High */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "highValue", + key: "highKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "H", + configuration: 256 /* NeutralHigh */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + style: "neutral", + id: "highValue", + key: "highKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "L", + configuration: 8 /* Low */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "lowValue", + key: "lowKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "L", + configuration: 512 /* NeutralLow */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + style: "neutral", + id: "lowValue", + key: "lowKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "C", + configuration: 4 /* Close */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "closeValue", + key: "closeKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "C", + configuration: 128 /* NeutralClose */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "closeValue", + key: "closeKey", + style: "neutral", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "", + configuration: 64 /* UnlabelledClose */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + style: "neutral", + id: "closeValue", + key: "closeKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + notation: "compact", + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "Vol", + configuration: 32 /* Volume */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "volumeValue", + key: "volumeKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + notation: "compact", + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + } + ]; + this.highlightManager = ctx.highlightManager; + this.labelGroup.visible = false; + this.cleanup.register( + ctx.scene.attachNode(this.layer), + ctx.layoutManager.registerElement(LayoutElement4.Overlay, (e) => this.startPerformLayout(e)), + ctx.eventsHub.on("layout:complete", (e) => this.onLayoutComplete(e)), + ctx.eventsHub.on("highlight:change", () => this.updateHighlight()) + ); + } + async processData(dataController) { + if (!this.enabled || this.data == null) + return; + const props = []; + for (const label of this.labels) { + const { id, key } = label; + const datumKey = this[key]; + if (datumKey == null) { + label.domain = void 0; + } else { + props.push(valueProperty9(datumKey, "number", { id })); + } + } + if (props.length === 0) + return; + const dataSet = import_ag_charts_community160._ModuleSupport.DataSet.wrap(this.data) ?? import_ag_charts_community160._ModuleSupport.DataSet.empty(); + const { processedData, dataModel } = await dataController.request(this.id, dataSet, { + props + }); + for (const label of this.labels) { + const { id, key } = label; + const datumKey = this[key]; + if (datumKey != null) { + label.domain = dataModel.getDomain(this, id, "value", processedData); + } + } + } + startPerformLayout(opts) { + this.labelGroup.translationX = 0; + this.labelGroup.translationY = 0; + if (!this.enabled) + return; + const { layoutBox } = opts; + const innerSpacing = 4; + const outerSpacing = 12; + const spacingAbove = 0; + const spacingBelow = 8; + this.labelGroup.translationY = layoutBox.y + spacingAbove; + const maxFontSize = Math.max(this.title.fontSize, this.positive.fontSize, this.negative.fontSize); + const lineHeight = (0, import_ag_charts_core66.calcLineHeight)(maxFontSize); + const labelConfigurations = chartConfigurations[this.getChartType()] ?? 0; + let left = 0; + let offsetTop; + let textVAlign = "alphabetic"; + if (this.layoutStyle === "block") { + layoutBox.shrink(spacingAbove + lineHeight + spacingBelow, "top"); + offsetTop = maxFontSize + (lineHeight - maxFontSize) / 2; + } else { + const { title } = this.ctx.chartService; + textVAlign = "top"; + offsetTop = spacingAbove + title.padding; + if (title.enabled) { + const titleBox = title.node.getBBox(); + left = titleBox.x + titleBox.width + outerSpacing; + } else { + left = title.padding; + } + } + for (const { label, configuration, title, value, domain, formatter } of this.labels) { + if (domain == null || (labelConfigurations & configuration) === 0) { + title.visible = false; + value.visible = false; + continue; + } + const positiveTextMeasurer = (0, import_ag_charts_core66.cachedTextMeasurer)(this.positive); + const negativeTextMeasurer = (0, import_ag_charts_core66.cachedTextMeasurer)(this.negative); + const maxValueWidth = Math.max( + positiveTextMeasurer.textWidth(formatter.format(domain[0])), + positiveTextMeasurer.textWidth(formatter.format(domain[1])), + negativeTextMeasurer.textWidth(formatter.format(domain[0])), + negativeTextMeasurer.textWidth(formatter.format(domain[1])) + ); + title.visible = true; + value.visible = true; + const titleMetrics = (0, import_ag_charts_core66.cachedTextMeasurer)(this.title).measureLines(label); + title.setFont(this.title); + title.fill = this.title.color; + title.text = label; + title.textBaseline = textVAlign; + title.y = offsetTop; + title.x = left; + left += titleMetrics.width + innerSpacing; + value.textBaseline = textVAlign; + value.y = offsetTop; + value.x = left; + left += maxValueWidth + outerSpacing; + } + this.backgroundNode.x = 0; + this.backgroundNode.y = 0; + this.backgroundNode.width = left - outerSpacing; + this.backgroundNode.height = lineHeight + spacingAbove + spacingBelow; + this.backgroundNode.fill = this.background.fill; + this.backgroundNode.fillOpacity = this.background.fillOpacity; + } + onLayoutComplete(opts) { + this.labelGroup.translationX = opts.series.rect.x; + this.updateHighlight(); + } + updateHighlight() { + if (!this.enabled) + return; + const activeHighlight = this.highlightManager.getActiveHighlight(); + const datum = activeHighlight?.datum ?? this.data?.at(-1); + if (datum == null) { + this.labelGroup.visible = false; + return; + } + this.labelGroup.visible = true; + const itemId = activeHighlight?.itemId; + let baseStyle = itemId == null ? void 0 : itemIdMap[itemId]; + if (baseStyle == null && this.openKey != null && this.closeKey != null) { + if (datum[this.openKey] < datum[this.closeKey]) { + baseStyle = "positive"; + } else { + baseStyle = "negative"; + } + } + for (const { domain, value, key, formatter, style } of this.labels) { + if (domain == null) + continue; + let labelStyle = style ?? baseStyle ?? "neutral"; + if (labelStyle === "neutral") { + labelStyle = neutralColorMap[this.getChartType()] ?? labelStyle; + } + const datumKey = this[key]; + const datumValue = datumKey == null ? void 0 : datum?.[datumKey]; + value.setFont(this[labelStyle]); + value.fill = this[labelStyle].color; + value.text = typeof datumValue === "number" ? formatter.format(datumValue) : ""; + } + } + getChartType() { + let chartType = this.ctx.chartService.publicApi?.getOptions()?.chartType; + if (chartType == null || chartConfigurations[chartType] == null) { + chartType = "candlestick"; + } + return chartType; + } +}; +__decorateClass([ + Property58 +], StatusBar.prototype, "enabled", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "openKey", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "highKey", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "lowKey", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "closeKey", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "volumeKey", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "title", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "positive", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "negative", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "neutral", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "altNeutral", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "background", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "layoutStyle", 2); + +// packages/ag-charts-enterprise/src/features/status-bar/statusBarModule.ts +var StatusBarModule = { + type: "root", + identifier: "status-bar", + optionsKey: "statusBar", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new StatusBar(ctx), + themeTemplate: { + statusBar: { + enabled: false, + layoutStyle: import_ag_charts_community161._ModuleSupport.ThemeSymbols.DEFAULT_CAPTION_LAYOUT_STYLE, + title: { + color: { $ref: "textColor" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + positive: { + color: { $palette: "up.stroke" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + negative: { + color: { $palette: "down.stroke" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + neutral: { + color: { $palette: "neutral.stroke" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + background: { + fill: { $ref: "chartBackgroundColor" }, + fillOpacity: 0.5 + }, + altNeutral: { + color: "gray", + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/sync/chartSync.ts +var import_ag_charts_community162 = require("ag-charts-community"); +var import_ag_charts_core68 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/zoom/zoomUtils.ts +var import_ag_charts_core67 = require("ag-charts-core"); +var UNIT_MIN = 0; +var UNIT_MAX = 1; +var UNIT_SIZE = UNIT_MAX - UNIT_MIN; +var DEFAULT_ANCHOR_POINT_X = "end"; +var DEFAULT_ANCHOR_POINT_Y = "middle"; +var ZOOM_VALID_CHECK_DEBOUNCE = 300; +var constrain = (value, min = UNIT_MIN, max = UNIT_MAX) => (0, import_ag_charts_core67.clamp)(min, value, max); +function unitZoomState() { + return { x: { min: UNIT_MIN, max: UNIT_MAX }, y: { min: UNIT_MIN, max: UNIT_MAX } }; +} +function dx(zoom) { + return zoom.x.max - zoom.x.min; +} +function dy(zoom) { + return zoom.y.max - zoom.y.min; +} +function isZoomRangeEqual(left, right) { + return (0, import_ag_charts_core67.isNumberEqual)(left.min, right.min) && (0, import_ag_charts_core67.isNumberEqual)(left.max, right.max); +} +function isZoomEqual(left, right) { + return isZoomRangeEqual(left.x, right.x) && isZoomRangeEqual(left.y, right.y); +} +function isMaxZoom(zoom) { + return isZoomEqual(zoom, unitZoomState()); +} +function definedZoomState(zoom) { + return { + x: { min: zoom?.x?.min ?? UNIT_MIN, max: zoom?.x?.max ?? UNIT_MAX }, + y: { min: zoom?.y?.min ?? UNIT_MIN, max: zoom?.y?.max ?? UNIT_MAX } + }; +} +function pointToRatio(bbox, x, y) { + if (!bbox) + return { x: 0, y: 0 }; + const constrainedX = constrain(x - bbox.x, 0, bbox.x + bbox.width); + const constrainedY = constrain(y - bbox.y, 0, bbox.y + bbox.height); + const rx = 1 / bbox.width * constrainedX; + const ry = 1 - 1 / bbox.height * constrainedY; + return { x: constrain(rx), y: constrain(ry) }; +} +function translateZoom(zoom, x, y) { + return { + x: { min: zoom.x.min + x, max: zoom.x.max + x }, + y: { min: zoom.y.min + y, max: zoom.y.max + y } + }; +} +function scaleZoom(zoom, sx, sy) { + return { + x: { min: zoom.x.min, max: zoom.x.min + dx(zoom) * sx }, + y: { min: zoom.y.min, max: zoom.y.min + dy(zoom) * sy } + }; +} +function scaleZoomCenter(zoom, sx, sy) { + const dx_ = dx(zoom); + const dy_ = dy(zoom); + const cx = zoom.x.min + dx_ / 2; + const cy = zoom.y.min + dy_ / 2; + return { + x: { min: cx - dx_ * sx / 2, max: cx + dx_ * sx / 2 }, + y: { min: cy - dy_ * sy / 2, max: cy + dy_ * sy / 2 } + }; +} +function scaleZoomAxisWithAnchor(newState, oldState, anchor, origin) { + const { min, max } = oldState; + const center = min + (max - min) / 2; + const diff8 = newState.max - newState.min; + switch (anchor) { + case "start": + return { min, max: oldState.min + diff8 }; + case "end": + return { min: oldState.max - diff8, max }; + case "middle": + return { min: center - diff8 / 2, max: center + diff8 / 2 }; + case "pointer": + return scaleZoomAxisWithPoint(newState, oldState, origin ?? center); + default: + return { min, max }; + } +} +function scaleZoomAxisWithPoint(newState, oldState, origin) { + const newDelta = newState.max - newState.min; + const oldDelta = oldState.max - oldState.min; + const scaledOrigin = origin * (1 - (oldDelta - newDelta)); + const translation = origin - scaledOrigin; + const min = newState.min + translation; + const max = newState.max + translation; + return { min, max }; +} +function multiplyZoom(zoom, nx, ny) { + return { + x: { min: zoom.x.min * nx, max: zoom.x.max * nx }, + y: { min: zoom.y.min * ny, max: zoom.y.max * ny } + }; +} +function constrainZoom(zoom) { + return { + x: constrainAxis(zoom.x), + y: constrainAxis(zoom.y) + }; +} +function constrainAxis(axis) { + const size = axis.max - axis.min; + let min = axis.max > UNIT_MAX ? UNIT_MAX - size : axis.min; + let max = axis.min < UNIT_MIN ? size : axis.max; + min = Math.max(UNIT_MIN, min); + max = Math.min(UNIT_MAX, max); + return { min, max }; +} + +// packages/ag-charts-enterprise/src/features/sync/chartSync.ts +var { + BaseProperties: BaseProperties21, + CartesianAxis, + ChartAxisDirection: ChartAxisDirection20, + ContinuousScale: ContinuousScale6, + TimeScale, + UnitTimeScale, + ChartUpdateType: ChartUpdateType2, + ObserveChanges: ObserveChanges4, + TooltipManager, + Property: Property59, + findMinMax: findMinMax4, + isObjectWithStringProperty +} = import_ag_charts_community162._ModuleSupport; +var debug = import_ag_charts_community162._ModuleSupport.Debug.create("sync"); +function getDirectionKeys(series, primary, secondary) { + const primaryKeys = series.getKeys(primary); + const secondaryKeys = series.getKeys(secondary); + if (series.shouldFlipXY?.()) { + return [secondaryKeys, primaryKeys]; + } + return [primaryKeys, secondaryKeys]; +} +function syncedDirections(axes = "x") { + switch (axes) { + case "x": + return [ChartAxisDirection20.X]; + case "y": + return [ChartAxisDirection20.Y]; + case "xy": + return [ChartAxisDirection20.X, ChartAxisDirection20.Y]; + } +} +function domainChanged(scale, a, b) { + if (TimeScale.is(scale) || UnitTimeScale.is(scale)) { + return !(0, import_ag_charts_core68.arraysEqual)( + a.map((x) => x?.valueOf()), + b.map((x) => x?.valueOf()) + ); + } else { + return !(0, import_ag_charts_core68.arraysEqual)(a, b); + } +} +var ChartSync = class extends BaseProperties21 { + constructor(moduleContext) { + super(); + this.moduleContext = moduleContext; + this.enabled = false; + this.axes = "x"; + this.nodeInteraction = true; + this.zoom = true; + this.domainMode = "key"; + this.domainSync = new import_ag_charts_core68.AsyncAwaitQueue(); + } + updateSiblings(groupId) { + const { syncManager } = this.moduleContext; + for (const chart of syncManager.getGroupSiblings(groupId ?? this.groupId)) { + debug("ChartSync.updateSiblings()", chart.id, chart); + this.updateChart(chart); + } + } + updateChart(chart, updateType = ChartUpdateType2.PROCESS_DOMAIN) { + debug("ChartSync.updateChart()", chart.id, ChartUpdateType2[updateType], chart); + if (updateType === ChartUpdateType2.PROCESS_DOMAIN) { + chart.ctx.updateService.update(updateType, { forceNodeDataRefresh: true }); + } else { + chart.ctx.updateService.update(updateType); + } + } + enabledZoomSync() { + const { eventsHub } = this.moduleContext; + this.disableZoomSync?.(); + this.disableZoomSync = eventsHub.on("zoom:change", this.onZoom.bind(this)); + } + onZoom() { + const { syncManager } = this.moduleContext; + for (const chart of syncManager.getGroupSiblings(this.groupId)) { + if (!chart.modulesManager.getModule("sync")?.zoom) + continue; + const zoomModule = chart.modulesManager.getModule("zoom"); + if (!zoomModule) + continue; + const zoom = this.prepareZoomUpdate(); + debug("ChartsSyncManager.enabledZoomSync()", chart.id, zoom); + zoomModule.updateSyncZoom(zoom); + } + } + enabledNodeInteractionSync() { + this.disableNodeInteractionSync?.(); + this.disableNodeInteractionSync = this.moduleContext.eventsHub.on( + "highlight:change", + this.onHighlightChange.bind(this) + ); + } + onHighlightChange(event) { + const { syncManager } = this.moduleContext; + if (event.callerId.endsWith("-sync")) + return; + debug("ChartSync.onHighlightChange()", event); + const series = event.currentHighlight?.series; + const [mainDirection] = syncedDirections(this.axes); + const secondaryDirection = mainDirection === ChartAxisDirection20.X ? ChartAxisDirection20.Y : ChartAxisDirection20.X; + const [primaryKeys, secondaryKeys] = series ? getDirectionKeys(series, mainDirection, secondaryDirection) : []; + const datum = readDatum(event.currentHighlight); + let eventValue = primaryKeys?.[0] ? datum?.[primaryKeys[0]] : void 0; + let valueIsDate = false; + if ((0, import_ag_charts_core68.isDate)(eventValue)) { + valueIsDate = true; + eventValue = eventValue.getTime(); + } + if (!event.currentHighlight?.datum) { + for (const chart of syncManager.getGroupSiblings(this.groupId)) { + if (!chart.modulesManager.getModule("sync")?.nodeInteraction) + continue; + chart.ctx.highlightManager.updateHighlight(`${chart.id}-sync`); + chart.ctx.tooltipManager.removeTooltip(`${chart.id}-sync`); + } + return; + } + const useSecondaryDirectionKey = syncManager.getGroupSyncMode(this.groupId) === "multi-series"; + this.findMatchingHighlightNodes( + mainDirection, + secondaryDirection, + useSecondaryDirectionKey ? secondaryKeys : [], + valueIsDate, + eventValue, + event + ); + } + findMatchingHighlightNodes(primaryDirection, secondaryDirection, secondaryKeys, valueIsDate, eventValue, event) { + const { syncManager } = this.moduleContext; + debug("ChartSync.findMatchingHighlightNodes()", { + mainDirection: primaryDirection, + secondaryKeys + }); + for (const chart of syncManager.getGroupSiblings(this.groupId)) { + if (!chart.modulesManager.getModule("sync")?.nodeInteraction) + continue; + let dispatched = false; + for (const axis of chart.axes) { + if (!CartesianAxis.is(axis) || axis.direction !== primaryDirection) + continue; + const matchingNodes = chart.series.filter((s) => { + if (!s.visible) + return false; + if (secondaryKeys.length > 0) { + const [, seriesKeys] = getDirectionKeys(s, primaryDirection, secondaryDirection); + return secondaryKeys.every((key) => seriesKeys.includes(key)); + } + return true; + }).map(this.findMatchingNodes(axis, primaryDirection, valueIsDate, eventValue)).filter(import_ag_charts_core68.isDefined); + if (matchingNodes.length === 1 && matchingNodes[0]?.nodeDatum !== chart.ctx.highlightManager.getActiveHighlight()) { + this.dispatchHighlightUpdate(chart, matchingNodes[0].nodeDatum); + dispatched = true; + break; + } + } + if (!dispatched) { + debug("ChartSync.findMatchingHighlightNodes() - no matching nodes", chart.id, event); + this.dispatchHighlightUpdate(chart); + } + } + } + findMatchingNodes(axis, mainDirection, valueIsDate, eventValue) { + return (series) => { + const seriesKeys = series.getKeys(axis.direction); + if (axis.keys.length && !axis.keys.some((key) => seriesKeys.includes(key))) + return; + const nodeData = series.contextNodeData?.nodeData ?? []; + if (!nodeData?.length) + return; + const firstNode = nodeData[0]; + const mainDirectionKey = `${mainDirection}Key`; + if (!isObjectWithStringProperty(firstNode, mainDirectionKey)) + return; + const valueKey = firstNode[mainDirectionKey]; + const nodeDatum = nodeData.find((datum) => { + const nodeValue = datum.datum[valueKey]; + return valueIsDate ? nodeValue.getTime() === eventValue : nodeValue === eventValue; + }); + return nodeDatum ? { series, nodeDatum } : null; + }; + } + dispatchHighlightUpdate(chart, nodeDatum) { + debug("ChartSync.dispatchHighlightUpdate()", chart.id, nodeDatum); + chart.ctx.highlightManager.updateHighlight(`${chart.id}-sync`, nodeDatum); + const tooltipEnabled = nodeDatum?.series.tooltipEnabled ?? chart.tooltip.enabled; + if (nodeDatum && tooltipEnabled) { + const bbox = chart.seriesAreaBoundingBox; + const canvasX = bbox.x + (nodeDatum.midPoint?.x ?? nodeDatum.point?.x ?? 0); + const canvasY = bbox.y + (nodeDatum.midPoint?.y ?? nodeDatum.point?.y ?? 0); + const tooltipMeta = TooltipManager.makeTooltipMeta( + { type: "pointermove", canvasX, canvasY }, + nodeDatum.series, + nodeDatum, + void 0 + ); + chart.ctx.tooltipManager.updateTooltip( + `${chart.id}-sync`, + tooltipMeta, + chart.getTooltipContent(nodeDatum.series, nodeDatum.datumIndex, nodeDatum, "tooltip") + ); + } else { + chart.ctx.tooltipManager.removeTooltip(`${chart.id}-sync`); + } + this.updateChart(chart, ChartUpdateType2.SERIES_UPDATE); + } + async getSyncedDomain(axis) { + if (!CartesianAxis.is(axis) || this.axes !== "xy" && this.axes !== axis.direction) { + return; + } + const { groupState, directionDomains, domainsByKey, positionDomains } = this.updateDomainState(axis); + this.validateAxis(axis, groupState); + await this.waitForDomainsToBeReady(); + if (this.domainMode === "position") { + return this.calculateDerivedDomain(axis, positionDomains); + } + if (this.domainMode === "direction" || axis.keys.length === 0) { + return this.calculateDerivedDomain(axis, directionDomains); + } + return this.calculateKeyDerivedDomain(axis, domainsByKey); + } + updateDomainState(axis) { + var _a, _b, _c, _d, _e; + const { syncManager } = this.moduleContext; + const chartId = syncManager.getChart().id; + const axisId = axis.id; + const groupState = syncManager.getGroupState(this.groupId); + if (!groupState) + throw new Error("AG Charts - no GroupState for groupId: " + this.groupId); + const domainsByDirection = groupState.domains ?? (groupState.domains = {}); + const directionDomains = domainsByDirection[_a = axis.direction] ?? (domainsByDirection[_a] = { derived: [], sources: {}, dirty: true }); + const chartDirectionDomains = (_b = directionDomains.sources)[chartId] ?? (_b[chartId] = {}); + chartDirectionDomains[axisId] = axis.dataDomain.domain; + directionDomains.dirty = true; + const domainsByKey = groupState.domainsByKey ?? (groupState.domainsByKey = {}); + for (const key of axis.keys ?? []) { + const keyDomains = domainsByKey[key] ?? (domainsByKey[key] = { derived: [], sources: {}, dirty: true }); + const chartKeyDomains = (_c = keyDomains.sources)[chartId] ?? (_c[chartId] = {}); + chartKeyDomains[axisId] = axis.dataDomain.domain; + keyDomains.dirty = true; + } + const domainsByPosition = groupState.domainsByPosition ?? (groupState.domainsByPosition = {}); + const positionDomains = domainsByPosition[_d = axis.position] ?? (domainsByPosition[_d] = { derived: [], sources: {}, dirty: true }); + const chartPositionDomains = (_e = positionDomains.sources)[chartId] ?? (_e[chartId] = {}); + chartPositionDomains[axisId] = axis.dataDomain.domain; + positionDomains.dirty = true; + return { groupState, directionDomains, domainsByKey, positionDomains }; + } + validateAxis(axis, groupState) { + const multiSeries = this.moduleContext.syncManager.getGroupSyncMode(this.groupId) === "multi-series"; + if (!syncedDirections(this.axes).includes(axis.direction)) + return; + if (multiSeries) { + this.validateMultiSeries(axis, groupState); + } else { + this.validateSingleSeries(axis, groupState); + } + } + validateMultiSeries(axis, groupState) { + const { min, max, nice, reverse } = axis; + const matchingKeys = new Set(axis.boundSeries.flatMap((s) => s.getKeys(axis.direction))); + for (const member of groupState.members) { + const { axes, modulesManager } = member; + const memberSyncDirections = syncedDirections(modulesManager.getModule("sync")?.axes); + const keyMatchedAxes = axes.filter((a) => memberSyncDirections.includes(a.direction)).filter((a) => a.boundSeries.some((s) => s.getKeys(a.direction).some((k) => matchingKeys.has(k)))); + if (keyMatchedAxes.length === 0) + continue; + const [firstAxis] = keyMatchedAxes; + if (firstAxis.min !== min || firstAxis.max !== max || firstAxis.nice !== nice || firstAxis.reverse !== reverse) { + import_ag_charts_core68.Logger.warnOnce( + "To allow synchronization, ensure that all synchronized axes with matching keys have matching min, max, nice, and reverse properties." + ); + this.enabled = false; + return; + } + } + } + validateSingleSeries(axis, groupState) { + const members = groupState.members; + const [{ axes: syncAxes }] = members; + const { direction, min, max, nice, reverse } = axis; + for (const nextAxis of syncAxes) { + if (direction !== nextAxis.direction) + continue; + if (nice !== nextAxis.nice || reverse !== nextAxis.reverse || min !== nextAxis.min && ((0, import_ag_charts_core68.isFiniteNumber)(min) || (0, import_ag_charts_core68.isFiniteNumber)(nextAxis.min)) || max !== nextAxis.max && ((0, import_ag_charts_core68.isFiniteNumber)(max) || (0, import_ag_charts_core68.isFiniteNumber)(nextAxis.max))) { + import_ag_charts_core68.Logger.warnOnce( + "To allow synchronization, ensure that all charts have matching min, max, nice, and reverse properties on the synchronized axes." + ); + this.enabled = false; + return; + } + } + } + calculateDerivedDomain(axis, directionDomains) { + if (!directionDomains.dirty) + return directionDomains.derived; + const previousDerived = directionDomains.derived; + directionDomains.derived = (0, import_ag_charts_core68.unique)( + Object.values(directionDomains.sources).map((d) => Object.values(d)).flat(2) + ); + if (ContinuousScale6.is(axis.scale)) { + directionDomains.derived = findMinMax4(directionDomains.derived); + } + directionDomains.dirty = false; + if (domainChanged(axis.scale, previousDerived, directionDomains.derived)) { + debug(axis.id, "updated", axis.keys, { before: previousDerived, after: directionDomains.derived }); + this.updateSiblings(); + } + return directionDomains.derived; + } + calculateKeyDerivedDomain(axis, domainsByKey) { + let previousDerived = []; + let newDerived = []; + let updated = false; + for (const key of axis.keys ?? []) { + const keyDomains = domainsByKey[key]; + const previousDerivedForKey = keyDomains.derived; + previousDerived.push(...previousDerivedForKey); + if (!keyDomains.dirty) { + newDerived.push(...keyDomains.derived); + continue; + } + keyDomains.derived = (0, import_ag_charts_core68.unique)( + Object.values(keyDomains.sources).map((d) => Object.values(d)).flat(2) + ); + if (ContinuousScale6.is(axis.scale)) { + keyDomains.derived = findMinMax4(keyDomains.derived); + } + newDerived.push(...keyDomains.derived); + keyDomains.dirty = false; + updated || (updated = !(0, import_ag_charts_core68.arraysEqual)(previousDerivedForKey, keyDomains.derived)); + } + if (ContinuousScale6.is(axis.scale)) { + previousDerived = findMinMax4(previousDerived); + newDerived = findMinMax4(newDerived); + } + if (updated && domainChanged(axis.scale, previousDerived, newDerived)) { + debug(axis.id, "updated", axis.keys, { before: previousDerived, after: newDerived }); + this.updateSiblings(); + } + return newDerived; + } + removeAxis(axis) { + if (!CartesianAxis.is(axis) || this.axes !== "xy" && this.axes !== axis.direction) { + return; + } + const { syncManager } = this.moduleContext; + const syncGroup = syncManager.getGroupState(this.groupId); + const chartId = syncManager.getChart().id; + const axisId = axis.id; + delete syncGroup?.domains?.[axis.direction]?.sources?.[chartId]?.[axisId]; + for (const key of axis.keys ?? []) { + delete syncGroup?.domainsByKey?.[key]?.sources?.[chartId]?.[axisId]; + } + delete syncGroup?.domainsByPosition?.[axis.position]?.sources?.[chartId]?.[axisId]; + } + async waitForDomainsToBeReady() { + const { syncManager } = this.moduleContext; + let count = 0; + while (syncManager.getGroupMembers(this.groupId).some((c) => c.syncStatus === "init")) { + debug("ChartSync.waitForDomainsToBeReady() - waiting for all domains to be calculated", this.groupId); + await this.domainSync.await(); + count++; + } + if (count > 0) { + debug("ChartSync.waitForDomainsToBeReady() - waited for", count, "iterations"); + } + this.domainSync.notify(); + } + prepareZoomUpdate() { + const { zoomManager } = this.moduleContext; + const zoom = zoomManager.getZoom(); + if (this.axes === "x") { + delete zoom?.y; + } else if (this.axes === "y") { + delete zoom?.x; + } + return definedZoomState(zoom); + } + onEnabledChange() { + const { syncManager } = this.moduleContext; + if (this.enabled) { + syncManager.subscribe(this.groupId); + } else { + syncManager.unsubscribe(this.groupId); + } + this.updateSiblings(); + this.onNodeInteractionChange(); + this.onZoomChange(); + } + onGroupIdChange(newValue, oldValue) { + if (!this.enabled || newValue === oldValue) + return; + const { syncManager } = this.moduleContext; + syncManager.unsubscribe(oldValue); + syncManager.subscribe(newValue); + this.updateSiblings(oldValue); + this.updateSiblings(newValue); + } + onAxesChange() { + if (!this.enabled) + return; + const { syncManager } = this.moduleContext; + this.updateChart(syncManager.getChart()); + } + onNodeInteractionChange() { + if (this.enabled && this.nodeInteraction) { + this.enabledNodeInteractionSync(); + } else { + this.disableNodeInteractionSync?.(); + } + } + onZoomChange() { + if (this.enabled && this.zoom) { + this.enabledZoomSync(); + } else { + this.disableZoomSync?.(); + } + } + destroy() { + const { syncManager } = this.moduleContext; + syncManager.unsubscribe(this.groupId); + this.updateSiblings(); + this.disableZoomSync?.(); + } +}; +ChartSync.className = "Sync"; +__decorateClass([ + Property59, + ObserveChanges4((target) => target.onEnabledChange()) +], ChartSync.prototype, "enabled", 2); +__decorateClass([ + Property59, + ObserveChanges4((target, newValue, oldValue) => target.onGroupIdChange(newValue, oldValue)) +], ChartSync.prototype, "groupId", 2); +__decorateClass([ + Property59, + ObserveChanges4((target) => target.onAxesChange()) +], ChartSync.prototype, "axes", 2); +__decorateClass([ + Property59, + ObserveChanges4((target) => target.onNodeInteractionChange()) +], ChartSync.prototype, "nodeInteraction", 2); +__decorateClass([ + Property59, + ObserveChanges4((target) => target.onZoomChange()) +], ChartSync.prototype, "zoom", 2); +__decorateClass([ + Property59, + ObserveChanges4((target) => target.onAxesChange()) +], ChartSync.prototype, "domainMode", 2); + +// packages/ag-charts-enterprise/src/features/sync/syncModule.ts +var SyncModule = { + type: "root", + optionsKey: "sync", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new ChartSync(ctx), + themeTemplate: { + sync: { enabled: false } + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoom.ts +var import_ag_charts_community170 = require("ag-charts-community"); +var import_ag_charts_core74 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/features/zoom/scenes/zoomRect.ts +var import_ag_charts_community163 = require("ag-charts-community"); +var { Property: Property60 } = import_ag_charts_community163._ModuleSupport; +var VALID_COLOR = "#2196f3"; +var INVALID_COLOR = "#8a8a8a"; +var ZoomRect = class extends import_ag_charts_community163._ModuleSupport.Rect { + constructor() { + super(...arguments); + this.fill = VALID_COLOR; + this.fillOpacity = 0.2; + this.zIndex = import_ag_charts_community163._ModuleSupport.ZIndexMap.ZOOM_SELECTION; + } + updateValid() { + this.fill = VALID_COLOR; + } + updateInvalid() { + this.fill = INVALID_COLOR; + } +}; +ZoomRect.className = "ZoomRect"; +__decorateClass([ + Property60 +], ZoomRect.prototype, "fill", 2); +__decorateClass([ + Property60 +], ZoomRect.prototype, "fillOpacity", 2); + +// packages/ag-charts-enterprise/src/features/zoom/zoomAxisDragger.ts +var import_ag_charts_community164 = require("ag-charts-community"); +var ZoomAxisDragger = class { + update(event, direction, anchor, bbox, zoom, axisZoom) { + this.oldZoom ?? (this.oldZoom = definedZoomState( + direction === import_ag_charts_community164._ModuleSupport.ChartAxisDirection.X ? { ...zoom, x: axisZoom } : { ...zoom, y: axisZoom } + )); + this.updateCoords(event.offsetX, event.offsetY); + return this.updateZoom(direction, anchor, bbox); + } + stop() { + this.coords = void 0; + this.oldZoom = void 0; + } + updateCoords(x, y) { + if (this.coords) { + this.coords.x2 = x; + this.coords.y2 = y; + } else { + this.coords = { x1: x, y1: y, x2: x, y2: y }; + } + } + updateZoom(direction, anchor, bbox) { + const { coords, oldZoom } = this; + let newZoom = definedZoomState(oldZoom); + if (!coords || !oldZoom) { + if (direction === import_ag_charts_community164._ModuleSupport.ChartAxisDirection.X) + return newZoom.x; + return newZoom.y; + } + const origin = pointToRatio(bbox, coords.x1, coords.y1); + const target = pointToRatio(bbox, coords.x2, coords.y2); + if (direction === import_ag_charts_community164._ModuleSupport.ChartAxisDirection.X) { + const scaleX = (target.x - origin.x) * dx(oldZoom); + newZoom.x.max += scaleX; + newZoom.x = scaleZoomAxisWithAnchor(newZoom.x, oldZoom.x, anchor, origin.x); + newZoom = constrainZoom(newZoom); + return newZoom.x; + } + const scaleY = (target.y - origin.y) * dy(oldZoom); + newZoom.y.max -= scaleY; + newZoom.y = scaleZoomAxisWithAnchor(newZoom.y, oldZoom.y, anchor, origin.y); + newZoom = constrainZoom(newZoom); + return newZoom.y; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomContextMenu.ts +var ZoomContextMenu = class { + constructor(eventsHub, contextMenuRegistry, zoomManager, getModuleProperties, canResetZoom, getRect, updateZoom, isZoomValid) { + this.eventsHub = eventsHub; + this.contextMenuRegistry = contextMenuRegistry; + this.zoomManager = zoomManager; + this.getModuleProperties = getModuleProperties; + this.canResetZoom = canResetZoom; + this.getRect = getRect; + this.updateZoom = updateZoom; + this.isZoomValid = isZoomValid; + } + registerActions(enabled) { + const { contextMenuRegistry } = this; + const action = enabled ? "show" : "hide"; + contextMenuRegistry.toggle("zoom-to-cursor", action); + contextMenuRegistry.toggle("pan-to-cursor", action); + contextMenuRegistry.toggle("reset-zoom", action); + if (!enabled) { + return; + } + contextMenuRegistry.builtins.items["zoom-to-cursor"].action = this.onZoomToHere.bind(this); + contextMenuRegistry.builtins.items["pan-to-cursor"].action = this.onPanToHere.bind(this); + contextMenuRegistry.builtins.items["reset-zoom"].action = this.onResetZoom.bind(this); + const shouldEnableZoomToHere = (event) => { + const rect = this.getRect(); + if (!rect) + return true; + const origin = pointToRatio(rect, event.x, event.y); + return this.iterateFindNextZoomAtPoint(origin) != null; + }; + const shouldEnablePanToHere = () => { + return !isZoomEqual(definedZoomState(this.zoomManager.getZoom()), unitZoomState()); + }; + const removeListener = this.eventsHub.on("context-menu:setup", (event) => { + contextMenuRegistry.builtins.items["zoom-to-cursor"].enabled = shouldEnableZoomToHere(event); + contextMenuRegistry.builtins.items["pan-to-cursor"].enabled = shouldEnablePanToHere(); + contextMenuRegistry.builtins.items["reset-zoom"].enabled = this.canResetZoom(); + }); + return () => { + removeListener(); + contextMenuRegistry.toggle("zoom-to-cursor", "hide"); + contextMenuRegistry.toggle("pan-to-cursor", "hide"); + contextMenuRegistry.toggle("reset-zoom", "hide"); + }; + } + computeOrigin(event) { + const rect = this.getRect(); + const { enabled } = this.getModuleProperties(); + if (!enabled || !rect || !event?.target || !(event instanceof MouseEvent)) + return; + const relativeRect = { x: 0, y: 0, width: rect.width, height: rect.height }; + return pointToRatio(relativeRect, event.offsetX, event.offsetY); + } + onZoomToHere({ event }) { + const origin = this.computeOrigin(event); + if (!origin) + return; + const zoom = this.iterateFindNextZoomAtPoint(origin); + if (zoom == null) + return; + this.updateZoom(zoom); + } + onPanToHere({ event }) { + const origin = this.computeOrigin(event); + if (!origin) + return; + const zoom = definedZoomState(this.zoomManager.getZoom()); + const scaleX = dx(zoom); + const scaleY = dy(zoom); + const scaledOriginX = origin.x * scaleX; + const scaledOriginY = origin.y * scaleY; + const halfSize = UNIT_SIZE / 2; + let newZoom = { + x: { min: origin.x - halfSize, max: origin.x + halfSize }, + y: { min: origin.y - halfSize, max: origin.y + halfSize } + }; + newZoom = scaleZoomCenter(newZoom, scaleX, scaleY); + newZoom = translateZoom(newZoom, zoom.x.min - origin.x + scaledOriginX, zoom.y.min - origin.y + scaledOriginY); + this.updateZoom(constrainZoom(newZoom)); + } + onResetZoom(_actionEvent) { + this.zoomManager.resetZoom("zoom"); + } + iterateFindNextZoomAtPoint(origin) { + const { scrollingStep } = this.getModuleProperties(); + for (let i = scrollingStep; i <= 1 - scrollingStep; i += scrollingStep) { + const zoom = this.getNextZoomAtPoint(origin, i); + if (this.isZoomValid(zoom)) { + return zoom; + } + } + } + getNextZoomAtPoint(origin, step) { + const { isScalingX, isScalingY } = this.getModuleProperties(); + const zoom = definedZoomState(this.zoomManager.getZoom()); + const scaledOriginX = origin.x * dx(zoom); + const scaledOriginY = origin.y * dy(zoom); + const halfSize = UNIT_SIZE / 2; + let newZoom = { + x: { min: origin.x - halfSize, max: origin.x + halfSize }, + y: { min: origin.y - halfSize, max: origin.y + halfSize } + }; + newZoom = scaleZoomCenter( + newZoom, + isScalingX ? dx(zoom) * step : UNIT_SIZE, + isScalingY ? dy(zoom) * step : UNIT_SIZE + ); + newZoom = translateZoom(newZoom, zoom.x.min - origin.x + scaledOriginX, zoom.y.min - origin.y + scaledOriginY); + return constrainZoom(newZoom); + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomDOMProxy.ts +var import_ag_charts_community165 = require("ag-charts-community"); +var import_ag_charts_core69 = require("ag-charts-core"); +var { ChartAxisDirection: ChartAxisDirection21 } = import_ag_charts_community165._ModuleSupport; +var ZoomDOMProxy = class { + constructor(axesHandlers) { + this.axesHandlers = axesHandlers; + this.axes = []; + this.overlappingAxisIds = /* @__PURE__ */ new Set(); + } + destroy() { + for (const a of this.axes) { + a.div.destroy(); + } + } + update(enableAxisDragging, enableAxisScrolling, ctx, seriesRect) { + this.seriesRect = seriesRect; + for (const ax of this.axes) { + ax.div.setHidden(!enableAxisDragging && !enableAxisScrolling); + } + if (!enableAxisDragging && !enableAxisScrolling) + return; + const { X, Y } = ChartAxisDirection21; + const axesCtx = [...ctx.axisManager.getAxisContext(X), ...ctx.axisManager.getAxisContext(Y)]; + const { removed, added } = this.diffAxisIds(axesCtx); + if (removed.length > 0) { + this.axes = this.axes.filter((entry) => { + if (removed.includes(entry.axisId)) { + entry.div.destroy(); + this.overlappingAxisIds.delete(entry.axisId); + if (this.hoveredAxisId === entry.axisId) + this.hoveredAxisId = void 0; + if (this.activeAxisId === entry.axisId) + this.activeAxisId = void 0; + return false; + } + return true; + }); + } + for (const newAxisCtx of added) { + const { axisId, direction } = newAxisCtx; + this.axes.push(this.initAxis(ctx, axisId, this.axesHandlers, direction)); + } + for (const axis of this.axes) { + const axisCtx = axesCtx.find((ac) => ac.axisId === axis.axisId); + const bbox = axisCtx.getCanvasBounds(); + axis.div.setHidden((0, import_ag_charts_core69.boxEmpty)(bbox)); + if (bbox == void 0) { + axis.bounds = void 0; + } else { + axis.div.setBounds(bbox); + axis.bounds = new import_ag_charts_community165._ModuleSupport.BBox(bbox.x, bbox.y, bbox.width, bbox.height); + } + } + this.updateOverlappingAxisPointerEvents(enableAxisDragging, enableAxisScrolling); + } + setAxisCursor(cursor) { + this.cursor = cursor; + for (const axis of this.axes) { + axis.div.setCursor(this.getCursor(axis.direction)); + } + } + toggleAxisDraggingCursor(direction, enabled) { + for (const axis of this.axes) { + if (axis.direction !== direction) + continue; + axis.div.setCursor(enabled ? this.getCursor(direction) : void 0); + } + } + updateOverlappingAxisPointerEvents(enableAxisDragging, enableAxisScrolling) { + this.overlappingAxisIds.clear(); + const shouldEnableInteraction = (enableAxisDragging || enableAxisScrolling) && this.seriesRect; + for (const axis of this.axes) { + if (!shouldEnableInteraction) { + axis.div.setPointerEvents(void 0); + continue; + } + const isOverlapping = Boolean(axis.bounds?.collidesBBox(this.seriesRect)); + if (isOverlapping) { + this.overlappingAxisIds.add(axis.axisId); + axis.div.setPointerEvents("none"); + } else { + axis.div.setPointerEvents(void 0); + } + } + this.cleanupAxisState(); + } + cleanupAxisState() { + if (this.hoveredAxisId && !this.overlappingAxisIds.has(this.hoveredAxisId)) { + this.hoveredAxisId = void 0; + } + if (this.activeAxisId && !this.overlappingAxisIds.has(this.activeAxisId)) { + this.activeAxisId = void 0; + } + } + pickAxisAtPoint(x, y) { + for (const axis of this.axes) { + if (!this.overlappingAxisIds.has(axis.axisId)) + continue; + if (axis.bounds?.containsPoint(x, y)) { + return { axisId: axis.axisId, direction: axis.direction }; + } + } + return void 0; + } + setHoveredAxis(axisId) { + if (this.overlappingAxisIds.has(axisId)) { + this.hoveredAxisId = axisId; + } + } + clearHoveredAxis() { + if (!this.activeAxisId) { + this.hoveredAxisId = void 0; + } + } + beginDelegatedAxisDrag(axisId) { + if (!this.overlappingAxisIds.has(axisId)) + return false; + this.activeAxisId = axisId; + this.hoveredAxisId = void 0; + return true; + } + endDelegatedAxisDrag(axisId) { + if (this.activeAxisId === axisId) { + this.activeAxisId = void 0; + } + this.hoveredAxisId = void 0; + } + hasOverlappingAxes() { + return this.overlappingAxisIds.size > 0; + } + getHoveredAxis() { + if (!this.hoveredAxisId) + return void 0; + const axis = this.axes.find((a) => a.axisId === this.hoveredAxisId); + return axis ? { axisId: axis.axisId, direction: axis.direction } : void 0; + } + getCursor(direction) { + if (this.cursor) + return this.cursor; + return direction === ChartAxisDirection21.X ? "ew-resize" : "ns-resize"; + } + initAxis(ctx, axisId, handlers, direction) { + const where = "afterend"; + const div = ctx.proxyInteractionService.createProxyElement({ type: "region", domManagerId: axisId, where }); + div.setCursor(this.getCursor(direction)); + div.addListener("drag-start", (e) => { + if (e.device === "touch") { + e.sourceEvent.preventDefault(); + } + this.activeAxisId = axisId; + handlers.onAxisDragStart(direction); + }); + div.addListener("drag-move", (event) => handlers.onAxisDragMove(axisId, direction, event)); + div.addListener("drag-end", () => { + this.activeAxisId = void 0; + this.hoveredAxisId = void 0; + handlers.onAxisDragEnd(); + }); + div.addListener("dblclick", () => handlers.onAxisDoubleClick(axisId, direction)); + div.addListener("wheel", (event) => handlers.onAxisWheel(axisId, direction, event)); + return { axisId, div, direction }; + } + diffAxisIds(axesCtx) { + const myIds = this.axes.map((entry) => entry.axisId); + const ctxIds = axesCtx.map((ctx) => ctx.axisId); + const removed = myIds.filter((id) => !ctxIds.includes(id)); + const added = axesCtx.filter((ac) => !myIds.includes(ac.axisId)); + return { removed, added }; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomPanner.ts +var import_ag_charts_community166 = require("ag-charts-community"); +var import_ag_charts_core70 = require("ag-charts-core"); +var maxZoomCoords = 16; +var decelerationValues = { + off: 1, + short: 0.01, + long: 2e-3 +}; +var ZoomPanner = class { + constructor() { + this.deceleration = 1; + this.zoomCoordsHistoryIndex = 0; + this.coordsHistory = []; + } + get decelerationValue() { + const { deceleration } = this; + return Math.max( + typeof deceleration === "number" ? deceleration : decelerationValues[deceleration] ?? 1, + 1e-4 + ); + } + addListener(_type, fn) { + this.onUpdate = fn; + return () => { + this.onUpdate = void 0; + }; + } + stopInteractions() { + if (this.inertiaHandle != null) { + cancelAnimationFrame(this.inertiaHandle); + this.inertiaHandle = void 0; + } + } + update(event) { + this.updateCoords(event.currentX, event.currentY); + const { x1 = 0, y1 = 0, x2 = 0, y2 = 0 } = this.coords ?? {}; + this.onUpdate?.({ + type: "update", + deltaX: this.isPanningX() ? x1 - x2 : 0, + deltaY: this.isPanningY() ? y1 - y2 : 0 + }); + } + start(direction) { + this.direction = direction; + this.coordsMonitorTimeout = setInterval(this.recordCurrentZoomCoords.bind(this), 16); + } + stop() { + const { coordsHistory } = this; + let deltaX = 0; + let deltaY = 0; + let deltaT = 0; + if (coordsHistory.length > 0) { + const arrayIndex = this.zoomCoordsHistoryIndex % maxZoomCoords; + let index1 = arrayIndex - 1; + if (index1 < 0) + index1 = coordsHistory.length - 1; + let index0 = arrayIndex; + if (index0 >= coordsHistory.length) + index0 = 0; + const coords1 = coordsHistory[index1]; + const coords0 = coordsHistory[index0]; + deltaX = this.isPanningX() ? coords1.x - coords0.x : 0; + deltaY = this.isPanningY() ? coords1.y - coords0.y : 0; + deltaT = coords1.t - coords0.t; + } + this.coords = void 0; + this.direction = void 0; + clearInterval(this.coordsMonitorTimeout); + this.coordsMonitorTimeout = void 0; + this.zoomCoordsHistoryIndex = 0; + this.coordsHistory.length = 0; + if (deltaT > 0 && this.decelerationValue < 1) { + const xVelocity = deltaX / deltaT; + const yVelocity = deltaY / deltaT; + const velocity = Math.hypot(xVelocity, yVelocity); + const angle = Math.atan2(yVelocity, xVelocity); + const t0 = performance.now(); + this.inertiaHandle = (0, import_ag_charts_core70.getWindow)().requestAnimationFrame((t) => { + this.animateInertia(t, t, t0, velocity, angle); + }); + } + } + recordCurrentZoomCoords() { + const { coords, coordsHistory, zoomCoordsHistoryIndex } = this; + if (!coords) + return; + const { x2: x, y2: y } = coords; + const t = Date.now(); + coordsHistory[zoomCoordsHistoryIndex % maxZoomCoords] = { x, y, t }; + this.zoomCoordsHistoryIndex += 1; + } + animateInertia(t, prevT, t0, velocity, angle) { + const friction = 1 - this.decelerationValue; + const maxS = -velocity / Math.log(friction); + const s0 = velocity * (friction ** (prevT - t0) - 1) / Math.log(friction); + const s1 = velocity * (friction ** (t - t0) - 1) / Math.log(friction); + this.onUpdate?.({ + type: "update", + deltaX: this.isPanningX() ? -Math.cos(angle) * (s1 - s0) : 0, + deltaY: this.isPanningY() ? -Math.sin(angle) * (s1 - s0) : 0 + }); + if (s1 >= maxS - 1) + return; + this.inertiaHandle = requestAnimationFrame((nextT) => { + this.animateInertia(nextT, t, t0, velocity, angle); + }); + } + updateCoords(x, y) { + if (this.coords) { + this.coords = { x1: this.coords.x2, y1: this.coords.y2, x2: x, y2: y }; + } else { + this.coords = { x1: x, y1: y, x2: x, y2: y }; + } + } + isPanningX() { + return this.direction == null || this.direction === import_ag_charts_community166._ModuleSupport.ChartAxisDirection.X; + } + isPanningY() { + return this.direction == null || this.direction === import_ag_charts_community166._ModuleSupport.ChartAxisDirection.Y; + } + translateZooms(bbox, currentZooms, deltaX, deltaY) { + const offset = pointToRatio(bbox, bbox.x + Math.abs(deltaX), bbox.y + bbox.height - Math.abs(deltaY)); + const offsetX = Math.sign(deltaX) * offset.x; + const offsetY = -Math.sign(deltaY) * offset.y; + const newZooms = {}; + for (const [axisId, { direction, zoom: currentZoom }] of (0, import_ag_charts_core70.entries)(currentZooms)) { + if (currentZoom && currentZoom.min === UNIT_MIN && currentZoom.max === UNIT_MAX) { + continue; + } + let zoom = definedZoomState({ [direction]: currentZoom }); + zoom = constrainZoom(translateZoom(zoom, offsetX * dx(zoom), offsetY * dy(zoom))); + newZooms[axisId] = { direction, zoom: zoom[direction] }; + } + return newZooms; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomScrollPanner.ts +var import_ag_charts_community167 = require("ag-charts-community"); +var import_ag_charts_core71 = require("ag-charts-core"); +var DELTA_SCALE = 200; +var ZoomScrollPanner = class { + update(event, step, bbox, zooms) { + const deltaX = event.deltaX * step * DELTA_SCALE; + return this.translateZooms(bbox, zooms, deltaX); + } + translateZooms(bbox, currentZooms, deltaX) { + const newZooms = {}; + const offset = pointToRatio(bbox, bbox.x + Math.abs(deltaX), 0); + const offsetX = deltaX < 0 ? -offset.x : offset.x; + for (const [axisId, { direction, zoom: currentZoom }] of (0, import_ag_charts_core71.entries)(currentZooms)) { + if (direction !== import_ag_charts_community167._ModuleSupport.ChartAxisDirection.X) + continue; + let zoom = definedZoomState({ x: currentZoom }); + zoom = constrainZoom(translateZoom(zoom, offsetX * dx(zoom), 0)); + newZooms[axisId] = { direction, zoom: zoom.x }; + } + return newZooms; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomScroller.ts +var import_ag_charts_community168 = require("ag-charts-community"); +var import_ag_charts_core72 = require("ag-charts-core"); +var ZoomScroller = class { + updateAxes(event, props, bbox, zooms) { + const sourceEvent = event.sourceEvent; + const newZooms = {}; + const { anchorPointX, anchorPointY, isScalingX, isScalingY, scrollingStep } = props; + const origin = pointToRatio( + bbox, + sourceEvent.offsetX ?? sourceEvent.clientX, + sourceEvent.offsetY ?? sourceEvent.clientY + ); + for (const [axisId, { direction, zoom }] of (0, import_ag_charts_core72.entries)(zooms)) { + if (zoom == null) + continue; + let newZoom = { ...zoom }; + const delta3 = scrollingStep * event.deltaY * (zoom.max - zoom.min); + if (direction === import_ag_charts_community168._ModuleSupport.ChartAxisDirection.X && isScalingX) { + newZoom.max += delta3; + newZoom = scaleZoomAxisWithAnchor(newZoom, zoom, anchorPointX, origin.x); + } else if (direction === import_ag_charts_community168._ModuleSupport.ChartAxisDirection.Y && isScalingY) { + newZoom.max += delta3; + newZoom = scaleZoomAxisWithAnchor(newZoom, zoom, anchorPointY, origin.y); + } else { + continue; + } + if (newZoom.max < newZoom.min) + continue; + newZooms[axisId] = { direction, zoom: constrainAxis(newZoom) }; + } + return newZooms; + } + update(event, props, bbox, oldZoom) { + const { anchorPointX, anchorPointY, isScalingX, isScalingY, scrollingStep } = props; + const canvasX = event.offsetX + bbox.x; + const canvasY = event.offsetY + bbox.y; + const origin = pointToRatio(bbox, canvasX, canvasY); + const dir = event.deltaY; + let newZoom = definedZoomState(oldZoom); + newZoom.x.max += isScalingX ? scrollingStep * dir * dx(oldZoom) : 0; + newZoom.y.max += isScalingY ? scrollingStep * dir * dy(oldZoom) : 0; + if (newZoom.x.max < newZoom.x.min || newZoom.y.max < newZoom.y.min) + return; + if (isScalingX) { + newZoom.x = scaleZoomAxisWithAnchor(newZoom.x, oldZoom.x, anchorPointX, origin.x); + } + if (isScalingY) { + newZoom.y = scaleZoomAxisWithAnchor(newZoom.y, oldZoom.y, anchorPointY, origin.y); + } + newZoom = constrainZoom(newZoom); + return newZoom; + } + updateDelta(delta3, props, oldZoom) { + const { anchorPointX, anchorPointY, isScalingX, isScalingY, scrollingStep } = props; + let newZoom = definedZoomState(oldZoom); + newZoom.x.max += isScalingX ? scrollingStep * -delta3 * dx(oldZoom) : 0; + newZoom.y.max += isScalingY ? scrollingStep * -delta3 * dy(oldZoom) : 0; + if (isScalingX) { + newZoom.x = scaleZoomAxisWithAnchor(newZoom.x, oldZoom.x, anchorPointX); + } + if (isScalingY) { + newZoom.y = scaleZoomAxisWithAnchor(newZoom.y, oldZoom.y, anchorPointY); + } + newZoom = constrainZoom(newZoom); + return newZoom; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomSelector.ts +var ZoomSelector = class { + constructor(rect, getZoom, isZoomValid) { + this.rect = rect; + this.getZoom = getZoom; + this.isZoomValid = isZoomValid; + this.rect.visible = false; + } + update(event, props, bbox) { + const canvasX = event.currentX + (bbox?.x ?? 0); + const canvasY = event.currentY + (bbox?.y ?? 0); + this.rect.visible = true; + this.updateCoords(canvasX, canvasY, props, bbox); + this.updateRect(bbox); + } + stop(innerBBox, bbox, currentZoom) { + let zoom = definedZoomState(); + if (!innerBBox || !bbox) + return zoom; + if (this.coords) { + zoom = this.createZoomFromCoords(bbox, currentZoom); + } + const multiplyX = bbox.width / innerBBox.width; + const multiplyY = bbox.height / innerBBox.height; + zoom = constrainZoom(multiplyZoom(zoom, multiplyX, multiplyY)); + this.reset(); + return zoom; + } + reset() { + this.coords = void 0; + this.rect.visible = false; + } + didUpdate() { + return this.rect.visible && this.rect.width > 0 && this.rect.height > 0; + } + updateCoords(x, y, props, bbox) { + if (!this.coords) { + this.coords = { x1: x, y1: y, x2: x, y2: y }; + return; + } + const { coords } = this; + coords.x2 = x; + coords.y2 = y; + if (!bbox) + return; + const { isScalingX, isScalingY, keepAspectRatio } = props; + const normal = this.getNormalisedDimensions(); + if (keepAspectRatio && isScalingX && isScalingY) { + const aspectRatio = bbox.width / bbox.height; + if (coords.y2 < coords.y1) { + coords.y2 = Math.min(coords.y1 - normal.width / aspectRatio, coords.y1); + } else { + coords.y2 = Math.max(coords.y1 + normal.width / aspectRatio, coords.y1); + } + } + if (!isScalingX) { + coords.x1 = bbox.x; + coords.x2 = bbox.x + bbox.width; + } + if (!isScalingY) { + coords.y1 = bbox.y; + coords.y2 = bbox.y + bbox.height; + } + } + updateRect(bbox) { + if (!bbox) + return; + const { rect } = this; + const normal = this.getNormalisedDimensions(); + const { width, height } = normal; + let { x, y } = normal; + x = Math.max(x, bbox.x); + x -= Math.max(0, x + width - (bbox.x + bbox.width)); + y = Math.max(y, bbox.y); + y -= Math.max(0, y + height - (bbox.y + bbox.height)); + rect.x = x; + rect.y = y; + rect.width = width; + rect.height = height; + const zoom = this.createZoomFromCoords(bbox, this.getZoom()); + if (this.isZoomValid(zoom)) { + rect.updateValid(); + } else { + rect.updateInvalid(); + } + } + createZoomFromCoords(bbox, currentZoom) { + const oldZoom = definedZoomState(currentZoom); + const normal = this.getNormalisedDimensions(); + const origin = pointToRatio(bbox, normal.x, normal.y + normal.height); + const xFactor = normal.width / bbox.width; + const yFactor = normal.height / bbox.height; + let newZoom = scaleZoom(oldZoom, xFactor, yFactor); + const translateX = origin.x * dx(oldZoom); + const translateY = origin.y * dy(oldZoom); + newZoom = translateZoom(newZoom, translateX, translateY); + newZoom = constrainZoom(newZoom); + return newZoom; + } + getNormalisedDimensions() { + const { x1 = 0, y1 = 0, x2 = 0, y2 = 0 } = this.coords ?? {}; + const x = Math.min(x1, x2); + const y = Math.min(y1, y2); + const width = x1 <= x2 ? x2 - x1 : x1 - x2; + const height = y1 <= y2 ? y2 - y1 : y1 - y2; + return { x, y, width, height }; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomToolbar.ts +var import_ag_charts_community169 = require("ag-charts-community"); +var import_ag_charts_core73 = require("ag-charts-core"); +var { + ActionOnSet: ActionOnSet8, + BaseProperties: BaseProperties22, + ChartAxisDirection: ChartAxisDirection22, + NativeWidget: NativeWidget2, + PropertiesArray: PropertiesArray6, + Toolbar: Toolbar2, + ToolbarButtonProperties: ToolbarButtonProperties4, + Property: Property61 +} = import_ag_charts_community169._ModuleSupport; +var ZoomButtonProperties = class extends ToolbarButtonProperties4 { +}; +__decorateClass([ + Property61 +], ZoomButtonProperties.prototype, "value", 2); +__decorateClass([ + Property61 +], ZoomButtonProperties.prototype, "section", 2); +var ZoomToolbar = class extends BaseProperties22 { + constructor(ctx, getModuleProperties, canResetZoom, updateZoom, updateAxisZoom, resetZoom, isZoomValid) { + super(); + this.ctx = ctx; + this.getModuleProperties = getModuleProperties; + this.canResetZoom = canResetZoom; + this.updateZoom = updateZoom; + this.updateAxisZoom = updateAxisZoom; + this.resetZoom = resetZoom; + this.isZoomValid = isZoomValid; + this.enabled = false; + this.buttons = new PropertiesArray6(ZoomButtonProperties); + this.visible = "hover"; + this.verticalSpacing = 10; + this.detectionRange = 38; + this.cleanup = new import_ag_charts_core73.CleanupRegistry(); + this.toggleButtonsDebounced = (0, import_ag_charts_core73.debounce)(this.toggleButtons.bind(this), ZOOM_VALID_CHECK_DEBOUNCE, { + leading: true, + trailing: true + }); + this.container = new NativeWidget2((0, import_ag_charts_core73.createElement)("div")); + this.container.addClass("ag-charts-zoom-buttons"); + ctx.domManager.addChild("canvas-overlay", "zoom-buttons", this.container.getElement()); + this.toolbar = new Toolbar2(ctx, "ariaLabelZoomToolbar", "horizontal"); + this.container.addChild(this.toolbar); + this.toolbar.getElement().style.transform = `translateY(54px)`; + this.toggleVisibility(this.visible === "always"); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPress.bind(this)), + this.toolbar.addToolbarListener("button-focused", this.onButtonFocus.bind(this)), + ctx.widgets.containerWidget.addListener("mousemove", this.onHover.bind(this)), + ctx.widgets.containerWidget.addListener("mouseleave", this.onLeave.bind(this)), + ctx.eventsHub.on("layout:complete", this.onLayoutComplete.bind(this)), + this.teardown.bind(this) + ); + } + destroy() { + this.cleanup.flush(); + } + toggleVisibleZoomed(maxZoom) { + if (this.visible !== "zoomed") + return; + this.toggleVisibility(!maxZoom); + } + teardown() { + this.ctx.domManager.removeChild("canvas-overlay", "zoom-buttons"); + this.container.destroy(); + } + onLayoutComplete(event) { + const { buttons: buttons2, container } = this; + const { rect } = event.series; + for (const b of buttons2) { + if (b.tooltip == null && b.label == null) { + const map = { + "pan-end": "toolbarZoomPanEnd", + "pan-left": "toolbarZoomPanLeft", + "pan-right": "toolbarZoomPanRight", + "pan-start": "toolbarZoomPanStart", + "zoom-in": "toolbarZoomZoomIn", + "zoom-out": "toolbarZoomZoomOut", + reset: "toolbarZoomReset" + }; + b.tooltip = map[b.value]; + } + } + this.toolbar.updateButtons(buttons2); + this.toggleButtonsDebounced(); + const height = container.getBounds().height; + container.setBounds({ y: rect.y + rect.height - height }); + } + onHover(event) { + if (!this.enabled || this.visible !== "hover" || this.toolbar.isHidden()) + return; + const { + container, + detectionRange, + ctx: { scene } + } = this; + const { + currentY, + sourceEvent: { target } + } = event; + const element = container.getElement(); + const detectionY = element.offsetTop - detectionRange; + const visible = currentY > detectionY && currentY < scene.canvas.element.offsetHeight || target === element; + this.toggleVisibility(visible); + } + onLeave() { + if (this.visible !== "hover") + return; + this.toggleVisibility(false); + } + toggleVisibility(visible, immediate = false) { + const { container, toolbar: toolbar2, verticalSpacing } = this; + toolbar2.toggleClass("ag-charts-zoom-buttons__toolbar--hidden", !visible); + const element = toolbar2.getElement(); + element.style.transitionDuration = immediate ? "0s" : ""; + element.style.transform = visible ? "translateY(0)" : `translateY(${container.getBounds().height + verticalSpacing}px)`; + } + toggleButtons() { + const zoom = definedZoomState(this.ctx.zoomManager.getZoom()); + if (this.previousZoom && isZoomEqual(this.previousZoom, zoom)) + return; + this.previousZoom = zoom; + for (const [index, button] of this.buttons.entries()) { + let enabled = true; + switch (button?.value) { + case "pan-start": + enabled = zoom.x.min > UNIT_MIN; + break; + case "pan-end": + enabled = zoom.x.max < UNIT_MAX; + break; + case "pan-left": + enabled = zoom.x.min > UNIT_MIN; + break; + case "pan-right": + enabled = zoom.x.max < UNIT_MAX; + break; + case "zoom-out": + enabled = !isZoomEqual(zoom, unitZoomState()); + break; + case "zoom-in": + enabled = this.isZoomValid( + this.getNextZoomStateUnified("zoom-in", zoom, this.getModuleProperties()) + ); + break; + case "reset": + enabled = this.canResetZoom(zoom); + break; + } + this.toolbar.toggleButtonEnabledByIndex(index, enabled); + } + } + onButtonPress({ button }) { + if (!this.enabled || this.toolbar.isHidden()) + return; + const props = this.getModuleProperties(); + if (props.independentAxes && button.value !== "reset") { + const axisZooms = this.ctx.zoomManager.getAxisZooms(); + for (const [axisId, { direction, zoom }] of (0, import_ag_charts_core73.entries)(axisZooms)) { + if (zoom == null) + continue; + this.onButtonPressAxis(button, props, axisId, direction, zoom); + } + } else { + this.onButtonPressUnified(button, props); + } + } + onButtonFocus(_event) { + this.toggleVisibility(true, true); + } + onButtonPressAxis(event, props, axisId, direction, zoom) { + const { isScalingX, isScalingY, scrollingStep } = props; + let newZoom = { ...zoom }; + const delta3 = zoom.max - zoom.min; + switch (event.value) { + case "pan-start": + newZoom.max = delta3; + newZoom.min = 0; + break; + case "pan-end": + newZoom.min = newZoom.max - delta3; + newZoom.max = UNIT_MAX; + break; + case "pan-left": + newZoom.min -= delta3 * scrollingStep; + newZoom.max -= delta3 * scrollingStep; + break; + case "pan-right": + newZoom.min += delta3 * scrollingStep; + newZoom.max += delta3 * scrollingStep; + break; + case "zoom-in": + case "zoom-out": { + const isDirectionX = direction === ChartAxisDirection22.X; + const isScalingDirection = isDirectionX && isScalingX || !isDirectionX && isScalingY; + let scale = event.value === "zoom-in" ? 1 - scrollingStep : 1 + scrollingStep; + if (!isScalingDirection) + scale = 1; + const placement = isDirectionX ? this.getAnchorPointX(props) : this.getAnchorPointY(props); + newZoom.max = newZoom.min + (newZoom.max - newZoom.min) * scale; + newZoom = scaleZoomAxisWithAnchor(newZoom, zoom, placement); + break; + } + } + this.updateAxisZoom(axisId, direction, constrainAxis(newZoom)); + } + onButtonPressUnified(event, props) { + const { scrollingStep } = props; + const oldZoom = definedZoomState(this.ctx.zoomManager.getZoom()); + let zoom = definedZoomState(oldZoom); + switch (event.value) { + case "reset": + this.resetZoom(); + return; + case "pan-start": + zoom.x.max = dx(zoom); + zoom.x.min = 0; + break; + case "pan-end": + zoom.x.min = UNIT_MAX - dx(zoom); + zoom.x.max = UNIT_MAX; + break; + case "pan-left": + zoom = translateZoom(zoom, -dx(zoom) * scrollingStep, 0); + break; + case "pan-right": + zoom = translateZoom(zoom, dx(zoom) * scrollingStep, 0); + break; + case "zoom-in": + case "zoom-out": { + zoom = this.getNextZoomStateUnified(event.value, oldZoom, props); + break; + } + } + this.updateZoom(constrainZoom(zoom)); + } + getNextZoomStateUnified(button, oldZoom, props) { + const { isScalingX, isScalingY, scrollingStep } = props; + const scale = button === "zoom-in" ? 1 - scrollingStep : 1 + scrollingStep; + const zoom = scaleZoom(oldZoom, isScalingX ? scale : 1, isScalingY ? scale : 1); + zoom.x = scaleZoomAxisWithAnchor(zoom.x, oldZoom.x, this.getAnchorPointX(props)); + zoom.y = scaleZoomAxisWithAnchor(zoom.y, oldZoom.y, this.getAnchorPointY(props)); + return zoom; + } + getAnchorPointX(props) { + const anchorPointX = this.anchorPointX ?? props.anchorPointX; + return anchorPointX === "pointer" ? DEFAULT_ANCHOR_POINT_X : anchorPointX; + } + getAnchorPointY(props) { + const anchorPointY = this.anchorPointY ?? props.anchorPointY; + return anchorPointY === "pointer" ? DEFAULT_ANCHOR_POINT_Y : anchorPointY; + } +}; +__decorateClass([ + Property61, + ActionOnSet8({ + changeValue(enabled) { + this.toolbar?.setHidden(!enabled); + } + }) +], ZoomToolbar.prototype, "enabled", 2); +__decorateClass([ + Property61 +], ZoomToolbar.prototype, "buttons", 2); +__decorateClass([ + Property61, + ActionOnSet8({ + changeValue(visible, oldValue) { + if (oldValue == null) + return; + const always = visible === "always"; + const zoomed = visible === "zoomed" && this.previousZoom != null && !isMaxZoom(this.previousZoom); + this.toggleVisibility(always || zoomed); + } + }) +], ZoomToolbar.prototype, "visible", 2); +__decorateClass([ + Property61 +], ZoomToolbar.prototype, "anchorPointX", 2); +__decorateClass([ + Property61 +], ZoomToolbar.prototype, "anchorPointY", 2); + +// packages/ag-charts-enterprise/src/features/zoom/zoomTwoFingers.ts +var N = 1e6; +function clientToNormal({ min, max }, a, Rx, Rw) { + if (Rw === 0) + return 0; + return N * ((a - Rx) / Rw * (max - min) + min); +} +function solveTwoUnknowns(x1, x2, a1, a2, Rx, Rw) { + [x1, x2] = [Math.min(x1, x2), Math.max(x1, x2)]; + [a1, a2] = [Math.min(a1, a2), Math.max(a1, a2)]; + const t1 = N * (a1 - Rx) / Rw; + const t2 = N * (a2 - Rx) / Rw; + const c = (a1 - Rx) / (a2 - Rx); + const min = (x1 - c * x2) / (N - t1 + c * (t2 - N)); + const max = (x2 + (t2 - N) * min) / t2; + return { min, max }; +} +function isRangeOverlapping(centerA, radiusA, centerB, radiusB) { + if (radiusA === 0) + radiusA = 30; + if (radiusB === 0) + radiusB = 30; + const minA = centerA - radiusA; + const maxA = centerA + radiusA; + const minB = centerB - radiusB; + const maxB = centerB + radiusB; + return !(maxA < minB || maxB < minA); +} +var ZoomTwoFingers = class { + constructor() { + this.touchStart = { + origins: [ + { identifier: 0, normalX: Number.NaN, normalY: Number.NaN }, + { identifier: 0, normalX: Number.NaN, normalY: Number.NaN } + ] + }; + this.initialZoom = { x: { min: 0, max: 1 }, y: { min: 0, max: 1 } }; + this.previous = { a1: Number.NaN, a2: Number.NaN, b1: Number.NaN, b2: Number.NaN }; + } + start(event, target, zoom) { + if (event.sourceEvent.targetTouches.length !== 2) + return false; + event.sourceEvent.preventDefault(); + const targetTouches = Array.from(event.sourceEvent.targetTouches); + const { x: Rx, y: Ry, width: Rw, height: Rh } = target.getBoundingClientRect(); + this.initialZoom.x.min = zoom.x?.min ?? 0; + this.initialZoom.x.max = zoom.x?.max ?? 1; + this.initialZoom.y.min = zoom.y?.min ?? 0; + this.initialZoom.y.max = zoom.y?.max ?? 1; + for (const t of this.touchStart.origins) { + t.identifier = 0; + } + this.previous.a1 = Number.NaN; + this.previous.a2 = Number.NaN; + this.previous.b1 = Number.NaN; + this.previous.b2 = Number.NaN; + for (const i of [0, 1]) { + const a = targetTouches[i].clientX; + const b = Ry + Rh - targetTouches[i].clientY; + this.touchStart.origins[i].identifier = targetTouches[i].identifier; + this.touchStart.origins[i].normalX = clientToNormal(this.initialZoom.x, a, Rx, Rw); + this.touchStart.origins[i].normalY = clientToNormal(this.initialZoom.y, b, Ry, Rh); + } + const [tA, tB] = targetTouches; + const [oA, oB] = this.touchStart.origins; + const xOverlap = isRangeOverlapping(tA.clientX, tA.radiusX, tB.clientX, tB.radiusX); + const yOverlap = isRangeOverlapping(tA.clientY, tA.radiusY, tB.clientY, tB.radiusY); + if (yOverlap) + oA.normalY = oB.normalY = (oA.normalY + oB.normalY) / 2; + if (xOverlap) + oA.normalX = oB.normalX = (oA.normalX + oB.normalX) / 2; + return true; + } + update(event, target) { + event.sourceEvent.preventDefault(); + const targetTouches = Array.from(event.sourceEvent.targetTouches); + const { x: Rx, y: Ry, width: Rw, height: Rh } = target.getBoundingClientRect(); + const { origins } = this.touchStart; + const touches = [0, 1].map((i) => targetTouches.find((t) => t.identifier === origins[i].identifier)); + const x1 = origins[0].normalX; + const x2 = origins[1].normalX; + const a1 = touches[0].clientX; + const a2 = touches[1].clientX; + const y1 = origins[0].normalY; + const y2 = origins[1].normalY; + const b1 = Ry + Rh - touches[0].clientY; + const b2 = Ry + Rh - touches[1].clientY; + return this.twitchTolerantZoomPan4(x1, x2, a1, a2, y1, y2, b1, b2, Rx, Ry, Rw, Rh); + } + end(event) { + const identifiers = Array.from(event.sourceEvent.targetTouches).map((t) => t.identifier); + return !identifiers.includes(this.touchStart.origins[0].identifier) || !identifiers.includes(this.touchStart.origins[1].identifier); + } + // Small touch deltas on an axis, which can defined as one fingers moving ±1 pixel and the other not moving, can + // cause the canvas to flicker between two zoompan views. + // + // For example, consider two fingers moving upwards slowly on the Y-axis with the following events (Y=0 is the top + // of the screen): + // + // [0]: { finger1: { clientY: 101 }, finger2: { clientY: 201 } } + // [1]: { finger1: { clientY: 101 }, finger2: { clientY: 200 } } + // [2]: { finger1: { clientY: 100 }, finger2: { clientY: 200 } } + // + // The following transitions cause these changes to the zoompan respectively. + // + // [0] => [1] : yMin decreases, yMax increases + // [1] => [2] : yMin increases, yMax decreases + // + // At highly-zoomed views, this sudden shift in yMin/yMax in the [1] => [2] transition is very noticeable. When many + // of these kind of a transitions occur, the chart flickers between pan states instead of smoothly panning. Note + // however that, if we didn't receive event [1], our transition would like this: + // + // [0] => [2] : yMin increases, yMax increases + // + // ... which is a smooth panning transition. Therefore to prevent flickering, we skip event [1]. + twitchTolerantZoomPan4(x1, x2, a1, a2, y1, y2, b1, b2, Rx, Ry, Rw, Rh) { + const { initialZoom, previous } = this; + const x = twitchTolerantZoomPan2(x1, x2, a1, a2, previous, "a1", "a2", Rx, Rw, initialZoom.x); + const y = twitchTolerantZoomPan2(y1, y2, b1, b2, previous, "b1", "b2", Ry, Rh, initialZoom.y); + return { x, y }; + } +}; +function twitchTolerantZoomPan2(x1, x2, a1, a2, previous, previousKey1, previousKey2, Rx, Rw, initialZoom) { + if (x1 == x2) { + const xn1 = clientToNormal(initialZoom, a1, Rx, Rw); + const xn2 = clientToNormal(initialZoom, a2, Rx, Rw); + const xavg = (xn1 + xn2) / 2; + const dzoom = (x1 - xavg) / N; + return { min: initialZoom.min + dzoom, max: initialZoom.max + dzoom }; + } else { + const a1prev = previous[previousKey1]; + const a2prev = previous[previousKey2]; + const dx2 = Math.abs(a1 - a1prev) + Math.abs(a2 - a2prev); + if (dx2 <= 1) { + a1 = a1prev; + a2 = a2prev; + } else { + previous[previousKey1] = a1; + previous[previousKey2] = a2; + } + return solveTwoUnknowns(x1, x2, a1, a2, Rx, Rw); + } +} + +// packages/ag-charts-enterprise/src/features/zoom/zoom.ts +var { ActionOnSet: ActionOnSet9, ChartAxisDirection: ChartAxisDirection23, ChartUpdateType: ChartUpdateType3, Property: Property62, InteractionState: InteractionState5, ProxyProperty: ProxyProperty3 } = import_ag_charts_community170._ModuleSupport; +var round = (value) => (0, import_ag_charts_core74.roundTo)(value, 10); +var CURSOR_ID = "zoom-cursor"; +var TOOLTIP_ID = "zoom-tooltip"; +var ZoomAutoScaling = class extends import_ag_charts_community170._ModuleSupport.BaseProperties { + constructor(onChange) { + super(); + this.onChange = onChange; + this.enabled = false; + this.padding = 0; + } +}; +__decorateClass([ + Property62, + ActionOnSet9({ + changeValue(enabled) { + this.onChange({ enabled, padding: this.padding }); + } + }) +], ZoomAutoScaling.prototype, "enabled", 2); +__decorateClass([ + Property62, + ActionOnSet9({ + changeValue(padding) { + this.onChange({ enabled: this.enabled, padding }); + } + }) +], ZoomAutoScaling.prototype, "padding", 2); +var Zoom = class extends import_ag_charts_community170._ModuleSupport.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.enableAxisDragging = true; + this.enableAxisScrolling = false; + this.enableDoubleClickToReset = true; + this.enablePanning = true; + this.enableScrolling = true; + this.enableSelecting = false; + this.enableTwoFingerZoom = true; + this.panKey = "alt"; + this.axes = "x"; + this.scrollingStep = UNIT_SIZE / 10; + this.keepAspectRatio = false; + this.minVisibleItems = 2; + this.anchorPointX = DEFAULT_ANCHOR_POINT_X; + this.anchorPointY = DEFAULT_ANCHOR_POINT_Y; + this.autoScaling = new ZoomAutoScaling((newValue) => { + this.ctx.zoomManager.setAutoScaleYAxis(newValue.enabled, newValue.padding); + }); + this.axisDraggingMode = "zoom"; + this.canResetZoom = (zoom) => { + zoom ?? (zoom = this.getZoom()); + return !isZoomEqual(zoom, this.getResetZoom()); + }; + this.buttons = new ZoomToolbar( + this.ctx, + this.getModuleProperties.bind(this), + this.canResetZoom, + this.updateZoom.bind(this), + this.updateAxisZoom.bind(this), + this.resetZoom.bind(this), + this.isZoomValid.bind(this) + ); + // Zoom methods + this.axisDragger = new ZoomAxisDragger(); + this.panner = new ZoomPanner(); + this.scroller = new ZoomScroller(); + this.scrollPanner = new ZoomScrollPanner(); + this.twoFingers = new ZoomTwoFingers(); + this.deceleration = "short"; + // State + this.dragState = 0 /* None */; + this.isState = (state) => this.ctx.interactionManager.isState(state); + this.destroyContextMenuActions = void 0; + this.isFirstWheelEvent = true; + this.debouncedWheelReset = (0, import_ag_charts_core74.debounce)(() => { + this.isFirstWheelEvent = true; + this.wasFirstWheelEventZoomCapped = void 0; + }, 100); + this.previousZoomValid = true; + this.previousAxisZoomValid = { + [import_ag_charts_community170._ModuleSupport.ChartAxisDirection.X]: true, + [import_ag_charts_community170._ModuleSupport.ChartAxisDirection.Y]: true + }; + this.toggleAxisDraggingCursorsDebounced = (0, import_ag_charts_core74.debounce)( + this.toggleAxisDraggingCursors.bind(this), + ZOOM_VALID_CHECK_DEBOUNCE, + { + leading: true, + trailing: true + } + ); + const selectionRect = new ZoomRect(); + this.selector = new ZoomSelector(selectionRect, this.getZoom.bind(this), this.isZoomValid.bind(this)); + this.contextMenu = new ZoomContextMenu( + ctx.eventsHub, + ctx.contextMenuRegistry, + ctx.zoomManager, + this.getModuleProperties.bind(this), + this.canResetZoom, + () => this.paddedRect, + this.updateZoom.bind(this), + this.isZoomValid.bind(this) + ); + this.domProxy = new ZoomDOMProxy({ + onAxisDragStart: (direction) => this.onAxisDragStart(direction), + onAxisDragMove: (id, direction, event) => this.onAxisDragMove(id, direction, event), + onAxisDragEnd: () => this.onAxisDragEnd(), + onAxisDoubleClick: (id) => this.onAxisDoubleClick(id), + onAxisWheel: (id, direction, event) => this.onAxisWheel(id, direction, event) + }); + if (ctx.widgets.seriesDragInterpreter) { + this.cleanup.register( + ctx.widgets.seriesDragInterpreter.events.on("dblclick", (event) => this.onSeriesAreaDoubleClick(event)), + ctx.widgets.seriesDragInterpreter.events.on("drag-move", (event) => this.onSeriesAreaDragMove(event)), + ctx.widgets.seriesDragInterpreter.events.on("drag-start", (event) => this.onSeriesAreaDragStart(event)), + ctx.widgets.seriesDragInterpreter.events.on("drag-end", () => this.onSeriesAreaDragEnd()) + ); + } + this.cleanup.register( + ctx.scene.attachNode(selectionRect), + ctx.eventsHub.on("series-area:hover", (event) => this.onSeriesAreaHoverEvent(event)), + ctx.eventsHub.on("series-area:click", (event) => this.onSeriesAreaClickEvent(event)), + ctx.eventsHub.on("series:keynav-zoom", (event) => this.onNavZoom(event)), + ctx.widgets.seriesWidget.addListener("wheel", (event) => this.onWheel(event)), + ctx.widgets.seriesWidget.addListener("touchstart", (event, current) => this.onTouchStart(event, current)), + ctx.widgets.seriesWidget.addListener("touchmove", (event, current) => this.onTouchMove(event, current)), + ctx.widgets.seriesWidget.addListener("touchend", (event) => this.onTouchEnd(event)), + ctx.widgets.seriesWidget.addListener("touchcancel", (event) => this.onTouchEnd(event)), + ctx.updateService.addListener("process-data", (event) => this.onProcessData(event)), + ctx.eventsHub.on("layout:complete", (event) => this.onLayoutComplete(event)), + ctx.eventsHub.on("zoom:change", (event) => this.onZoomChange(event)), + ctx.eventsHub.on("zoom:pan-start", (event) => this.onZoomPanStart(event)), + this.panner.addListener("update", (event) => this.onPanUpdate(event)), + () => this.teardown() + ); + } + teardown() { + this.ctx.zoomManager.setZoomModuleEnabled(false); + this.buttons.destroy(); + this.destroyContextMenuActions?.(); + this.domProxy.destroy(); + } + onEnabledChange(enabled) { + this.ctx.zoomManager.setZoomModuleEnabled(enabled); + if (this.contextMenu) { + this.destroyContextMenuActions?.(); + this.destroyContextMenuActions = this.contextMenu.registerActions(enabled); + } + } + isIgnoredTouch(event) { + if (event?.device !== "touch") { + return false; + } + if (this.ctx.chartService.touch.dragAction !== "drag") { + return true; + } + if (this.enableSelecting) { + return false; + } + if (!this.enablePanning) { + return true; + } + return isMaxZoom(this.getZoom()); + } + onSeriesAreaDoubleClick(event) { + const { enabled, enableDoubleClickToReset } = this; + if (!enabled || !enableDoubleClickToReset) + return; + if (event?.preventZoomDblClick || !this.isState(InteractionState5.ZoomClickable)) + return; + this.resetZoom(); + } + onSeriesAreaHoverEvent(event) { + if (!this.shouldHandleAxisHover(event)) { + this.clearHoveredAxis(); + return; + } + const axis = this.domProxy.pickAxisAtPoint(event.x, event.y); + if (axis) { + this.domProxy.setHoveredAxis(axis.axisId); + this.ctx.domManager.updateCursor(CURSOR_ID, this.domProxy.getCursor(axis.direction)); + } else { + this.clearHoveredAxis(); + } + } + onSeriesAreaClickEvent(event) { + if (!this.shouldHandleAxisClick(event)) + return; + const axis = this.domProxy.pickAxisAtPoint(event.x, event.y); + if (axis && event.sourceEvent?.type === "dblclick") { + this.onAxisDoubleClick(axis.axisId); + } + } + shouldHandleAxisHover(event) { + const { enabled, enableAxisDragging, enableAxisScrolling, dragState } = this; + return enabled && (enableAxisDragging || enableAxisScrolling) && !event.consumed && !this.activeAxis && dragState === 0 /* None */ && this.domProxy.hasOverlappingAxes(); + } + shouldHandleAxisClick(event) { + const { enabled, enableAxisDragging, enableAxisScrolling, enableDoubleClickToReset } = this; + return enabled && !this.activeAxis && !event.consumed && (enableAxisDragging || enableAxisScrolling || enableDoubleClickToReset); + } + clearHoveredAxis() { + if (this.activeAxis) + return; + this.domProxy.clearHoveredAxis(); + if (this.dragState === 0 /* None */) { + this.ctx.domManager.updateCursor(CURSOR_ID); + } + } + tryBeginAxisDelegation(event) { + const hoveredAxis = this.domProxy.getHoveredAxis(); + if (!this.enabled || !this.enableAxisDragging || !hoveredAxis) { + return false; + } + if (!this.domProxy.beginDelegatedAxisDrag(hoveredAxis.axisId)) { + return false; + } + this.activeAxis = hoveredAxis; + this.onAxisDragStart(hoveredAxis.direction); + const cursor = this.dragState === 2 /* Pan */ ? "grabbing" : this.domProxy.getCursor(hoveredAxis.direction); + this.ctx.domManager.updateCursor(CURSOR_ID, cursor); + if (event.device === "touch") { + event.sourceEvent.preventDefault(); + } + return true; + } + onSeriesAreaDragStart(event) { + const { + enabled, + enablePanning, + enableSelecting, + ctx: { domManager, zoomManager } + } = this; + if (!enabled || !this.isState(InteractionState5.ZoomDraggable) || this.dragState !== 0 /* None */ || this.isIgnoredTouch(event)) { + return; + } + this.panner.stopInteractions(); + if (this.tryBeginAxisDelegation(event)) { + return; + } + let newDragState = 0 /* None */; + const panKeyPressed = this.isPanningKeyPressed(event.sourceEvent); + if (enablePanning && (!enableSelecting || panKeyPressed)) { + domManager.updateCursor(CURSOR_ID, "grabbing"); + newDragState = 2 /* Pan */; + this.panner.start(); + } else if (enableSelecting && !panKeyPressed) { + newDragState = 3 /* Select */; + } + if ((this.dragState = newDragState) !== 0 /* None */) { + zoomManager.fireZoomPanStartEvent("zoom"); + } + } + onSeriesAreaDragMove(event) { + const { + dragState, + enabled, + paddedRect, + panner, + selector, + ctx: { interactionManager, tooltipManager, updateService } + } = this; + if (this.activeAxis) { + this.onAxisDragMove(this.activeAxis.axisId, this.activeAxis.direction, event); + return; + } + if (!enabled || !paddedRect || !this.isState(InteractionState5.ZoomDraggable) || this.isIgnoredTouch(event)) { + return; + } + interactionManager.pushState(import_ag_charts_community170._ModuleSupport.InteractionState.ZoomDrag); + if (event.device === "touch") { + event.sourceEvent.preventDefault(); + } + switch (dragState) { + case 2 /* Pan */: + panner.update(event); + break; + case 3 /* Select */: + selector.update(event, this.getModuleProperties(), paddedRect); + break; + case 0 /* None */: + return; + } + tooltipManager.updateTooltip(TOOLTIP_ID); + updateService.update(ChartUpdateType3.PERFORM_LAYOUT, { skipAnimations: true }); + } + onSeriesAreaDragEnd() { + const { + ctx: { interactionManager } + } = this; + if (this.activeAxis) { + this.handleAxisDragEnd(); + return; + } + interactionManager.popState(import_ag_charts_community170._ModuleSupport.InteractionState.ZoomDrag); + if (!this.enabled || this.dragState === 0 /* None */) + return; + this.handleRegularDragEnd(); + this.resetDragState(); + } + handleAxisDragEnd() { + this.onAxisDragEnd(); + this.domProxy.endDelegatedAxisDrag(this.activeAxis.axisId); + this.activeAxis = void 0; + this.clearHoveredAxis(); + } + handleRegularDragEnd() { + const { panner, selector } = this; + switch (this.dragState) { + case 2 /* Pan */: + panner.stop(); + break; + case 3 /* Select */: + if (selector.didUpdate()) { + const newZoom = selector.stop(this.seriesRect, this.paddedRect, this.getZoom()); + this.updateZoom(newZoom); + } + break; + } + } + resetDragState() { + this.dragState = 0 /* None */; + this.ctx.domManager.updateCursor(CURSOR_ID); + this.ctx.tooltipManager.removeTooltip(TOOLTIP_ID); + } + onAxisDoubleClick(id) { + const { + enabled, + enableDoubleClickToReset, + ctx: { zoomManager } + } = this; + if (!enabled || !enableDoubleClickToReset || !this.isState(InteractionState5.ZoomClickable)) + return; + this.previousAxisZoomValid = { [ChartAxisDirection23.X]: true, [ChartAxisDirection23.Y]: true }; + zoomManager.resetAxisZoom("zoom", id); + } + onAxisDragStart(direction) { + const { + axisDraggingMode, + domProxy, + enabled, + enableAxisDragging, + panner, + ctx: { zoomManager } + } = this; + if (!enabled || !enableAxisDragging) + return; + panner.stopInteractions(); + if (axisDraggingMode === "pan") { + domProxy.setAxisCursor("grabbing"); + this.dragState = 2 /* Pan */; + this.panner.start(direction); + zoomManager.fireZoomPanStartEvent("zoom"); + } else { + this.dragState = 1 /* Axis */; + } + } + onAxisDragMove(axisId, direction, event) { + const { + anchorPointX, + anchorPointY, + axisDragger, + dragState, + enabled, + enableAxisDragging, + seriesRect, + shouldFlipXY, + ctx: { interactionManager, tooltipManager, updateService, zoomManager } + } = this; + if (!enabled || !enableAxisDragging || !seriesRect) + return; + interactionManager.pushState(import_ag_charts_community170._ModuleSupport.InteractionState.ZoomDrag); + if (event.device === "touch") { + event.sourceEvent.preventDefault(); + } + const zoom = this.getZoom(); + if (dragState === 2 /* Pan */) { + this.panner.update({ currentX: event.offsetX, currentY: event.offsetY }); + } else { + let anchor = direction === ChartAxisDirection23.X ? anchorPointX : anchorPointY; + if (shouldFlipXY) + anchor = direction === ChartAxisDirection23.X ? anchorPointY : anchorPointX; + const axisZoom = zoomManager.getAxisZoom(axisId); + const newZoom = axisDragger.update(event, direction, anchor, seriesRect, zoom, axisZoom); + zoomManager.setAxisManuallyAdjusted("zoom", axisId); + this.updateAxisZoom(axisId, direction, newZoom, { + directional: true + }); + } + tooltipManager.updateTooltip(TOOLTIP_ID); + updateService.update(ChartUpdateType3.PERFORM_LAYOUT, { skipAnimations: true }); + } + onAxisDragEnd() { + const { + axisDraggingMode, + axisDragger, + dragState, + domProxy, + enabled, + enableAxisDragging, + ctx: { domManager, interactionManager, tooltipManager } + } = this; + interactionManager.popState(import_ag_charts_community170._ModuleSupport.InteractionState.ZoomDrag); + if (!enabled || !enableAxisDragging || dragState === 0 /* None */) + return; + this.dragState = 0 /* None */; + if (axisDraggingMode === "pan") { + domProxy.setAxisCursor("grab"); + this.panner.stop(); + } + axisDragger.stop(); + domManager.updateCursor(CURSOR_ID); + tooltipManager.removeTooltip(TOOLTIP_ID); + } + onNavZoom(event) { + const { enabled, enableScrolling, scroller } = this; + const isDefaultState = this.ctx.interactionManager.isState(import_ag_charts_community170._ModuleSupport.InteractionState.Default); + if (!isDefaultState || !enabled || !enableScrolling) + return; + event.widgetEvent.sourceEvent.preventDefault(); + this.updateZoom(scroller.updateDelta(event.delta, this.getModuleProperties(), this.getZoom())); + } + onWheel(event) { + const { enabled, enablePanning, enableScrolling, paddedRect } = this; + if (!enabled || !enableScrolling || !paddedRect || !this.isState(InteractionState5.ZoomWheelable)) + return; + const { deltaX, deltaY } = event.sourceEvent; + const isHorizontalScrolling = deltaX != null && deltaY != null && Math.abs(deltaX) > Math.abs(deltaY); + if (enablePanning && isHorizontalScrolling) { + this.onWheelPanning(event); + } else { + this.onWheelScrolling(event); + } + } + onWheelPanning(event) { + const { + scrollingStep, + scrollPanner, + seriesRect, + ctx: { zoomManager } + } = this; + if (!seriesRect) + return; + event.sourceEvent.preventDefault(); + const newZooms = scrollPanner.update(event, scrollingStep, seriesRect, zoomManager.getAxisZooms()); + for (const [axisId, { direction, zoom }] of (0, import_ag_charts_core74.entries)(newZooms)) { + this.updateAxisZoom(axisId, direction, zoom); + } + } + onWheelScrolling(event) { + const zoom = this.getZoom(); + const isZoomCapped = event.deltaY > 0 && isMaxZoom(zoom); + this.handleWheelScrolling(event, isZoomCapped); + } + onAxisWheel(axisId, axisDirection, event) { + const { + enableAxisScrolling, + ctx: { zoomManager } + } = this; + if (!enableAxisScrolling) + return; + if (axisDirection !== ChartAxisDirection23.X && axisDirection !== ChartAxisDirection23.Y) { + return; + } + const isScalingX = axisDirection === ChartAxisDirection23.X; + const isScalingY = !isScalingX; + const props = this.getModuleProperties({ isScalingX, isScalingY }); + const zoom = this.getZoom(); + const isZoomCapped = event.deltaY > 0 && zoom[axisDirection].min === UNIT_MIN && zoom[axisDirection].max === UNIT_MAX; + zoomManager.setAxisManuallyAdjusted("zoom", axisId); + this.handleWheelScrolling(event, isZoomCapped, props); + } + handleWheelScrolling(event, isZoomCapped, props = this.getModuleProperties()) { + const { + enableIndependentAxes, + scroller, + seriesRect, + ctx: { zoomManager } + } = this; + if (!seriesRect) + return; + let updated = true; + if (enableIndependentAxes === true) { + const newZooms = scroller.updateAxes(event, props, seriesRect, zoomManager.getAxisZooms()); + for (const [axisId, { direction, zoom: axisZoom }] of (0, import_ag_charts_core74.entries)(newZooms)) { + const constrainedZoom = direction === ChartAxisDirection23.X ? this.constrainZoom({ x: axisZoom, y: { min: UNIT_MAX, max: UNIT_MAX } }).x : axisZoom; + updated && (updated = this.updateAxisZoom( + axisId, + direction, + constrainedZoom + )); + } + } else { + const newZoom = scroller.update(event, props, seriesRect, this.getZoom()); + if (newZoom == null) + return; + updated = this.updateUnifiedZoom(newZoom, { directional: true }); + } + isZoomCapped || (isZoomCapped = event.deltaY < 0 && !updated); + if (this.firstWheelEventDirection != null && this.firstWheelEventDirection !== event.deltaY < 0) { + this.isFirstWheelEvent = true; + } + if (this.isFirstWheelEvent) { + this.wasFirstWheelEventZoomCapped = isZoomCapped; + this.firstWheelEventDirection = event.deltaY < 0; + if (!isZoomCapped) { + event.sourceEvent.preventDefault(); + } + } else if (this.wasFirstWheelEventZoomCapped === false) { + event.sourceEvent.preventDefault(); + } + this.isFirstWheelEvent = false; + this.debouncedWheelReset(); + } + onTouchStart(event, current) { + if (!this.enableTwoFingerZoom || this.dragState !== 0 /* None */) + return; + if (this.twoFingers.start(event, current, this.getZoom())) { + this.dragState = 4 /* TwoFingers */; + } + } + onTouchMove(event, current) { + if (!this.enableTwoFingerZoom || this.dragState !== 4 /* TwoFingers */) + return; + const newZoom = this.twoFingers.update(event, current); + this.updateZoom(constrainZoom(newZoom)); + } + onTouchEnd(event) { + if (!this.enableTwoFingerZoom || this.dragState !== 4 /* TwoFingers */) + return; + event.sourceEvent.preventDefault(); + if (this.twoFingers.end(event)) { + this.dragState = 0 /* None */; + } + } + onProcessData(event) { + this.shouldFlipXY = event.series.shouldFlipXY; + } + onLayoutComplete(event) { + this.domProxy.update(this.enableAxisDragging, this.enableAxisScrolling, this.ctx, event.series.rect); + if (!this.enabled) + return; + this.seriesRect = event.series.rect; + this.paddedRect = event.series.paddedRect; + if (this.enableAxisDragging) { + this.toggleAxisDraggingCursorsDebounced(); + } + } + onZoomChange(event) { + if (event.callerId !== "zoom") { + this.panner.stopInteractions(); + } + const zoom = this.getZoom(); + this.buttons.toggleVisibleZoomed(isMaxZoom(zoom)); + } + onZoomPanStart(event) { + if (event.callerId === "zoom") { + this.panner.stopInteractions(); + } + } + onPanUpdate(event) { + const { + panner, + seriesRect, + ctx: { tooltipManager, zoomManager } + } = this; + if (!seriesRect) + return; + const newZooms = panner.translateZooms(seriesRect, zoomManager.getAxisZooms(), event.deltaX, event.deltaY); + for (const [axisId, { direction, zoom }] of (0, import_ag_charts_core74.entries)(newZooms)) { + this.updateAxisZoom(axisId, direction, zoom); + } + tooltipManager.updateTooltip(TOOLTIP_ID); + } + isPanningKeyPressed(event) { + switch (this.panKey) { + case "alt": + return event.altKey; + case "ctrl": + return event.ctrlKey; + case "shift": + return event.shiftKey; + case "meta": + return event.metaKey; + } + } + isScalingX() { + if (this.axes === "xy") + return true; + return this.shouldFlipXY ? this.axes === "y" : this.axes === "x"; + } + isScalingY() { + if (this.axes === "xy") + return true; + return this.shouldFlipXY ? this.axes === "x" : this.axes === "y"; + } + getAnchorPointX() { + return this.shouldFlipXY ? this.anchorPointY : this.anchorPointX; + } + getAnchorPointY() { + return this.shouldFlipXY ? this.anchorPointX : this.anchorPointY; + } + constrainZoom(newZoom) { + const { + minVisibleItems, + ctx: { zoomManager } + } = this; + if (minVisibleItems === 0) + return newZoom; + const constrainedZoom = zoomManager.constrainZoomToItemCount(newZoom, minVisibleItems); + return constrainedZoom ?? newZoom; + } + isZoomValid(newZoom, options) { + const { + minVisibleItems, + ctx: { zoomManager } + } = this; + if (minVisibleItems === 0) { + this.previousZoomValid = true; + return true; + } + const zoom = this.getZoom(); + const zoomedInX = round(dx(newZoom)) < round(dx(zoom)); + const zoomedInY = round(dy(newZoom)) < round(dy(zoom)); + if (!zoomedInX && !zoomedInY) { + this.previousZoomValid = true; + return true; + } + if (!this.previousZoomValid && options?.directional) { + return false; + } + const valid = zoomManager.isVisibleItemsCountAtLeast(newZoom, minVisibleItems, options?.includeYVisibleRange); + this.previousZoomValid = options?.directional ? valid : true; + return valid; + } + isAxisZoomValid(direction, axisZoom, options) { + const { + minVisibleItems, + ctx: { zoomManager } + } = this; + const zoom = this.getZoom(); + const deltaAxis = axisZoom.max - axisZoom.min; + const deltaOld = zoom[direction].max - zoom[direction].min; + const newZoom = { ...zoom, [direction]: axisZoom }; + if (deltaAxis >= deltaOld) { + this.previousAxisZoomValid[direction] = true; + return true; + } + if (!this.previousAxisZoomValid[direction] && options?.directional) { + return false; + } + const valid = zoomManager.isVisibleItemsCountAtLeast(newZoom, minVisibleItems); + this.previousAxisZoomValid[direction] = options?.directional ? valid : true; + return valid; + } + resetZoom() { + this.previousZoomValid = true; + this.previousAxisZoomValid = { [ChartAxisDirection23.X]: true, [ChartAxisDirection23.Y]: true }; + this.ctx.zoomManager.resetZoom("zoom"); + } + updateSyncZoom(zoom) { + this.updateZoom(zoom); + } + updateZoom(zoom) { + if (this.enableIndependentAxes) { + this.updatePrimaryAxisZooms(zoom); + } else { + this.updateUnifiedZoom(zoom); + } + } + updateUnifiedZoom(zoom, validOptions) { + zoom = this.constrainZoom(zoom); + if (!this.isZoomValid(zoom, validOptions)) { + this.ctx.updateService.update(ChartUpdateType3.SCENE_RENDER, { skipAnimations: true }); + return false; + } + this.ctx.zoomManager.updateZoom("zoom", zoom); + return true; + } + updatePrimaryAxisZooms(zoom) { + this.updatePrimaryAxisZoom(zoom, ChartAxisDirection23.X); + this.updatePrimaryAxisZoom(zoom, ChartAxisDirection23.Y); + } + updatePrimaryAxisZoom(zoom, direction) { + const axisId = this.ctx.zoomManager.getPrimaryAxisId(direction); + if (axisId == null) + return; + this.updateAxisZoom(axisId, direction, zoom[direction]); + } + updateAxisZoom(axisId, direction, axisZoom, validOptions) { + const { + enableIndependentAxes, + ctx: { zoomManager } + } = this; + if (!axisZoom) + return false; + const zoom = this.getZoom(); + if (enableIndependentAxes !== true) { + zoom[direction] = axisZoom; + return this.updateUnifiedZoom(zoom, validOptions); + } + if (!this.isAxisZoomValid(direction, axisZoom, validOptions)) + return false; + zoomManager.updateAxisZoom("zoom", axisId, axisZoom); + return true; + } + updateAxisCursor(opts) { + if (!this.domProxy) + return; + const { + enableAxisDragging = this.enableAxisDragging, + enableAxisScrolling = this.enableAxisScrolling, + axisDraggingMode = this.axisDraggingMode + } = opts; + if (enableAxisDragging) { + this.domProxy.setAxisCursor(axisDraggingMode === "pan" ? "grab" : void 0); + } else if (enableAxisScrolling) { + this.domProxy.setAxisCursor("default"); + } else { + this.domProxy.setAxisCursor(void 0); + } + } + toggleAxisDraggingCursors() { + const { anchorPointX, anchorPointY, domProxy } = this; + const zoom = this.getZoom(); + let showCursorX = dx(zoom) !== UNIT_SIZE; + let showCursorY = dy(zoom) !== UNIT_SIZE; + if (!showCursorX) { + const checkZoomX = scaleZoom(zoom, 0.999, 1); + checkZoomX.x = scaleZoomAxisWithAnchor(checkZoomX.x, zoom.x, anchorPointX); + showCursorX = this.isZoomValid(checkZoomX, { includeYVisibleRange: true }); + } + if (!showCursorY) { + const checkZoomY = scaleZoom(zoom, 1, 0.999); + checkZoomY.y = scaleZoomAxisWithAnchor(checkZoomY.y, zoom.y, anchorPointY); + showCursorY = this.isZoomValid(checkZoomY, { includeYVisibleRange: true }); + } + domProxy.toggleAxisDraggingCursor(ChartAxisDirection23.X, showCursorX); + domProxy.toggleAxisDraggingCursor(ChartAxisDirection23.Y, showCursorY); + } + getZoom() { + return definedZoomState(this.ctx.zoomManager.getZoom()); + } + getResetZoom() { + return definedZoomState(this.ctx.zoomManager.getRestoredZoom()); + } + getModuleProperties(overrides) { + return { + anchorPointX: overrides?.anchorPointX ?? this.getAnchorPointX(), + anchorPointY: overrides?.anchorPointY ?? this.getAnchorPointY(), + enabled: overrides?.enabled ?? this.enabled, + independentAxes: overrides?.independentAxes ?? this.enableIndependentAxes === true, + isScalingX: overrides?.isScalingX ?? this.isScalingX(), + isScalingY: overrides?.isScalingY ?? this.isScalingY(), + keepAspectRatio: overrides?.keepAspectRatio ?? this.keepAspectRatio, + scrollingStep: overrides?.scrollingStep ?? this.scrollingStep + }; + } +}; +__decorateClass([ + ActionOnSet9({ + newValue(enabled) { + this.onEnabledChange(enabled); + } + }), + Property62 +], Zoom.prototype, "enabled", 2); +__decorateClass([ + ActionOnSet9({ + changeValue(newValue) { + this.updateAxisCursor({ enableAxisDragging: newValue }); + } + }), + Property62 +], Zoom.prototype, "enableAxisDragging", 2); +__decorateClass([ + ActionOnSet9({ + changeValue(newValue) { + this.updateAxisCursor({ enableAxisScrolling: newValue }); + } + }), + Property62 +], Zoom.prototype, "enableAxisScrolling", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "enableDoubleClickToReset", 2); +__decorateClass([ + ActionOnSet9({ + changeValue(newValue) { + this.ctx.zoomManager.setIndependentAxes(Boolean(newValue)); + } + }), + Property62 +], Zoom.prototype, "enableIndependentAxes", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "enablePanning", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "enableScrolling", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "enableSelecting", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "enableTwoFingerZoom", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "panKey", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "axes", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "scrollingStep", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "keepAspectRatio", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "minVisibleItems", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "anchorPointX", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "anchorPointY", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "autoScaling", 2); +__decorateClass([ + ActionOnSet9({ + changeValue(newValue) { + this.updateAxisCursor({ axisDraggingMode: newValue }); + } + }), + Property62 +], Zoom.prototype, "axisDraggingMode", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "buttons", 2); +__decorateClass([ + ProxyProperty3("panner.deceleration"), + Property62 +], Zoom.prototype, "deceleration", 2); + +// packages/ag-charts-enterprise/src/features/zoom/zoomModule.ts +var buttons = { + enabled: true, + visible: "hover", + buttons: [ + { + icon: "zoom-out", + value: "zoom-out", + section: "scale" + }, + { + icon: "zoom-in", + value: "zoom-in", + section: "scale" + }, + { + icon: "pan-left", + value: "pan-left", + section: "pan" + }, + { + icon: "pan-right", + value: "pan-right", + section: "pan" + }, + { + icon: "reset", + value: "reset", + section: "reset" + } + ] +}; +var ZoomModule = { + type: "root", + optionsKey: "zoom", + packageType: "enterprise", + chartTypes: ["cartesian", "topology"], + moduleFactory: (ctx) => new Zoom(ctx), + themeTemplate: { + zoom: { + anchorPointX: "end", + anchorPointY: "middle", + axes: "x", + buttons, + enabled: false, + enableAxisDragging: true, + enableDoubleClickToReset: true, + enablePanning: true, + enableScrolling: true, + enableSelecting: false, + enableTwoFingerZoom: true, + deceleration: "short", + minVisibleItems: 2, + panKey: "alt", + scrollingStep: 0.1, + autoScaling: { + enabled: { $eq: [{ $path: "../axes" }, "x"] }, + padding: 0.05 + } + } + } +}; + +// packages/ag-charts-enterprise/src/gradient-legend/gradientLegendModule.ts +var import_ag_charts_community174 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/gradient-legend/gradientLegend.ts +var import_ag_charts_community173 = require("ag-charts-community"); +var import_ag_charts_core76 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/gradient-legend/axisTicks.ts +var import_ag_charts_community172 = require("ag-charts-community"); +var import_ag_charts_core75 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/utils/formatter.ts +var import_ag_charts_community171 = require("ag-charts-community"); +function formatWithContext(ctx, formatter, params) { + return import_ag_charts_community171._ModuleSupport.callWithContext(ctx.chartService, formatter, params); +} + +// packages/ag-charts-enterprise/src/gradient-legend/axisTicks.ts +var { + AxisInterval: AxisInterval2, + AxisLabel: AxisLabel2, + ZIndexMap: ZIndexMap9, + LinearScale: LinearScale3, + BBox: BBox14, + TranslatableGroup: TranslatableGroup4, + Selection: Selection4, + Text: Text2, + createIdsGenerator, + findMinMax: findMinMax5, + findRangeExtent, + estimateTickCount +} = import_ag_charts_community172._ModuleSupport; +var _AxisTicks = class _AxisTicks { + constructor(ctx, dataProvider) { + this.ctx = ctx; + this.dataProvider = dataProvider; + this.id = (0, import_ag_charts_core75.createId)(this); + this.axisGroup = new TranslatableGroup4({ name: `${this.id}-AxisTicks`, zIndex: ZIndexMap9.AXIS }); + this.labelSelection = Selection4.select(this.axisGroup, Text2); + this.interval = new AxisInterval2(); + this.label = new AxisLabel2(); + this.scale = new LinearScale3(); + this.placement = "bottom"; + this.translationX = 0; + this.translationY = 0; + this.padding = 0; + } + get horizontal() { + return this.placement.startsWith("top") || this.placement.startsWith("bottom"); + } + attachAxis(axisNode) { + axisNode.appendChild(this.axisGroup); + } + calculateLayout() { + const { placement, translationX, translationY, horizontal, label } = this; + function unreachable(_a) { + return void 0; + } + let textBaseline; + let textAlign; + switch (placement) { + case "top": + case "top-right": + case "top-left": + textBaseline = "bottom"; + textAlign = "center"; + label.mirrored = false; + label.parallel = true; + break; + case "bottom": + case "bottom-right": + case "bottom-left": + textBaseline = "top"; + textAlign = "center"; + label.mirrored = false; + label.parallel = true; + break; + case "right": + case "right-top": + case "right-bottom": + case "left": + case "left-top": + case "left-bottom": + textBaseline = "middle"; + textAlign = "left"; + label.mirrored = true; + label.parallel = false; + break; + default: + unreachable(placement); + } + const boxes = []; + const tickGenerationResult = this.generateTicks(); + const { ticks } = tickGenerationResult; + this.labelSelection.update(ticks, void 0, (datum) => datum.tickId); + this.axisGroup.setProperties({ translationX, translationY }); + this.labelSelection.each((node, datum) => { + node.fontFamily = label.fontFamily; + node.fontSize = label.fontSize; + node.fontStyle = label.fontStyle; + node.fontWeight = label.fontWeight; + node.fill = label.color; + node.textBaseline = textBaseline; + node.textAlign = textAlign; + node.text = datum.tickLabel; + node.x = horizontal ? datum.translation : 0; + node.y = horizontal ? 0 : datum.translation; + boxes.push(node.getBBox()); + }); + return boxes.length > 0 ? BBox14.merge(boxes).translate(translationX, translationY) : void 0; + } + tickFormatter(domain, _ticks, _primary, fractionDigits) { + const { ctx } = this; + const { formatManager } = ctx; + const boundSeries = this.dataProvider.data.flatMap((d) => d.series); + return (value, index) => { + const formatParams = { + type: "number", + value, + datum: void 0, + seriesId: void 0, + legendItemName: void 0, + key: void 0, + source: "gradient-legend", + property: "color", + domain, + boundSeries, + fractionDigits + }; + return this.label.formatValue((fn, params) => formatWithContext(ctx, fn, params), formatParams, index) ?? formatManager.format((fn, params) => formatWithContext(ctx, fn, params), formatParams) ?? formatManager.defaultFormat(formatParams); + }; + } + inRange(x, tolerance = 1e-3) { + const [min, max] = findMinMax5(this.scale.range); + return x >= min - tolerance && x <= max + tolerance; + } + generateTicks() { + const { minSpacing, maxSpacing } = this.interval; + const { maxTickCount, minTickCount, tickCount } = estimateTickCount( + findRangeExtent(this.scale.range), + 1, + minSpacing, + maxSpacing, + _AxisTicks.DefaultTickCount, + _AxisTicks.DefaultMinSpacing + ); + const tickData = this.getTicksData({ + nice: true, + interval: this.interval.step, + tickCount, + minTickCount, + maxTickCount + }); + if (this.placement === "bottom" || this.placement === "top") { + const measurer2 = (0, import_ag_charts_core75.cachedTextMeasurer)(this.label); + const { domain } = this.scale; + const reversed = domain[0] > domain[1]; + const direction = reversed ? -1 : 1; + let lastTickPosition = -Infinity * direction; + tickData.ticks = tickData.ticks.filter((data) => { + if (Math.sign(data.translation - lastTickPosition) !== direction) + return false; + const { width: labelWidth } = (0, import_ag_charts_core75.isArray)(data.tickLabel) ? (0, import_ag_charts_core75.measureTextSegments)(data.tickLabel, this.label) : measurer2.measureLines(data.tickLabel); + lastTickPosition = data.translation + labelWidth * direction; + return true; + }); + } + return tickData; + } + getTicksData(tickParams) { + const ticks = []; + const domain = tickParams.nice ? this.scale.niceDomain(tickParams) : this.scale.domain; + const rawTicks = this.scale.ticks(tickParams, domain)?.ticks ?? []; + const fractionDigits = rawTicks.reduce((max, tick) => Math.max(max, (0, import_ag_charts_core75.countFractionDigits)(tick)), 0); + const idGenerator = createIdsGenerator(); + const tickFormatter = this.tickFormatter(domain, rawTicks, false, fractionDigits); + for (let index = 0; index < rawTicks.length; index++) { + const tick = rawTicks[index]; + const translation = this.scale.convert(tick); + if (!this.inRange(translation)) + continue; + const tickLabel = tickFormatter(tick, index); + if (tickLabel == null || tickLabel === "") + continue; + const tickId = idGenerator((0, import_ag_charts_core75.toPlainText)(tickLabel)); + ticks.push({ tick, tickId, tickLabel, translation }); + } + return { rawTicks, fractionDigits, ticks }; + } +}; +_AxisTicks.DefaultTickCount = 5; +_AxisTicks.DefaultMinSpacing = 10; +var AxisTicks = _AxisTicks; + +// packages/ag-charts-enterprise/src/gradient-legend/gradientLegend.ts +var { + BaseProperties: BaseProperties23, + ZIndexMap: ZIndexMap10, + ProxyProperty: ProxyProperty4, + Property: Property63, + LayoutElement: LayoutElement5, + Group: Group8, + Rect: Rect5, + Marker: Marker2, + TranslatableGroup: TranslatableGroup5, + BBox: BBox15, + expandLegendPosition +} = import_ag_charts_community173._ModuleSupport; +var GradientBar = class extends BaseProperties23 { + constructor() { + super(...arguments); + this.thickness = 16; + this.preferredLength = 100; + } +}; +__decorateClass([ + Property63 +], GradientBar.prototype, "thickness", 2); +__decorateClass([ + Property63 +], GradientBar.prototype, "preferredLength", 2); +var GradientLegendScale = class extends import_ag_charts_community173._ModuleSupport.BaseProperties { + constructor(axisTicks) { + super(); + this.axisTicks = axisTicks; + } +}; +__decorateClass([ + ProxyProperty4("axisTicks.label") +], GradientLegendScale.prototype, "label", 2); +__decorateClass([ + ProxyProperty4("axisTicks.interval") +], GradientLegendScale.prototype, "interval", 2); +__decorateClass([ + ProxyProperty4("axisTicks.padding") +], GradientLegendScale.prototype, "padding", 2); +var GradientLegend = class extends import_ag_charts_community173._ModuleSupport.BaseProperties { + constructor(ctx) { + super(); + this.ctx = ctx; + this.id = (0, import_ag_charts_core76.createId)(this); + this.legendGroup = new TranslatableGroup5({ name: "legend", zIndex: ZIndexMap10.LEGEND }); + this.containerNode = this.legendGroup.appendChild(new Rect5({ name: "legend-container" })); + this.gradientRect = new Rect5(); + this.arrow = new Marker2({ shape: "triangle" }); + this.ticksGroup = new Group8({ name: "legend-axis-group" }); + this.cleanup = new import_ag_charts_core76.CleanupRegistry(); + this.enabled = false; + this.position = "bottom"; + this.reverseOrder = false; + this.gradient = new GradientBar(); + this.spacing = 20; + this.border = new import_ag_charts_community173._ModuleSupport.Border(this.containerNode); + this.cornerRadius = 0; + this.fillOpacity = 1; + this.padding = 4; + this.data = []; + this.highlightManager = ctx.highlightManager; + this.axisTicks = new AxisTicks(ctx, this); + this.axisTicks.attachAxis(this.ticksGroup); + this.scale = new GradientLegendScale(this.axisTicks); + this.legendGroup.append([this.gradientRect, this.arrow, this.ticksGroup]); + this.cleanup.register( + ctx.eventsHub.on("highlight:change", () => this.onChartHoverChange()), + ctx.layoutManager.registerElement(LayoutElement5.Legend, (e) => this.onStartLayout(e)), + () => this.legendGroup.remove() + ); + } + isVertical() { + const { placement } = expandLegendPosition(this.position); + return placement.startsWith("right") || placement.startsWith("left"); + } + destroy() { + this.cleanup.flush(); + } + attachLegend(scene) { + scene.appendChild(this.legendGroup); + } + onStartLayout(ctx) { + const [data] = this.data; + if (!this.enabled || !data?.enabled || data.legendType !== "gradient") { + this.legendGroup.visible = false; + return; + } + const { colorRange } = this.normalizeColorArrays(data); + const gradientRectBBox = this.updateGradientRect(ctx.layoutBox, colorRange); + const axisBBox = this.updateAxis(data, gradientRectBBox) ?? new BBox15(0, 0, 0, 0); + const legendBBox = BBox15.merge([gradientRectBBox, axisBBox]); + const { strokeWidth, padding } = this.getContainerStyles(); + legendBBox.grow(padding).grow(strokeWidth); + const { left, top } = this.getMeasurements(ctx.layoutBox, legendBBox); + this.updateContainer(legendBBox); + this.updateArrow(); + this.legendGroup.visible = true; + this.legendGroup.translationX = left; + this.legendGroup.translationY = top; + } + normalizeColorArrays(data) { + let colorDomain = data.colorDomain.slice(); + const colorRange = data.colorRange.slice(); + if (colorDomain.length === colorRange.length) { + return { colorDomain, colorRange }; + } + if (colorDomain.length > colorRange.length) { + colorRange.splice(colorDomain.length); + } + const [d0, d1] = colorDomain; + const count = colorRange.length; + colorDomain = colorRange.map((_, i) => { + if (i === 0) { + return d0; + } else if (i === count - 1) { + return d1; + } + return d0 + (d1 - d0) * i / (count - 1); + }); + return { colorDomain, colorRange }; + } + updateGradientRect(shrinkRect, colorRange) { + const { gradientRect, gradient } = this; + const { preferredLength, thickness } = gradient; + const gradientRectBBox = new BBox15(0, 0, 0, 0); + let angle; + if (this.isVertical()) { + angle = 0; + gradientRectBBox.width = thickness; + gradientRectBBox.height = Math.min(shrinkRect.height, preferredLength); + } else { + angle = 90; + gradientRectBBox.width = Math.min(shrinkRect.width, preferredLength); + gradientRectBBox.height = thickness; + } + gradientRect.x = gradientRectBBox.x; + gradientRect.y = gradientRectBBox.y; + gradientRect.width = gradientRectBBox.width; + gradientRect.height = gradientRectBBox.height; + gradientRect.fill = { + type: "gradient", + gradient: "linear", + colorSpace: "oklch", + colorStops: colorRange.map((color6, i) => ({ + stop: i / (colorRange.length - 1), + color: color6 + })), + rotation: angle + }; + return gradientRectBBox; + } + updateAxis(data, gradientRectBBox) { + const { axisTicks, gradient, scale } = this; + const { placement } = expandLegendPosition(this.position); + const vertical = this.isVertical(); + const positiveAxis = this.reverseOrder !== vertical; + axisTicks.placement = placement; + const offset = gradient.thickness + (scale.padding ?? 0); + axisTicks.translationX = vertical ? offset : gradientRectBBox.x; + axisTicks.translationY = vertical ? gradientRectBBox.y : offset; + axisTicks.scale.domain = positiveAxis ? data.colorDomain.slice().reverse() : data.colorDomain; + axisTicks.scale.range = vertical ? [gradientRectBBox.x, gradientRectBBox.height] : [gradientRectBBox.y, gradientRectBBox.width]; + return axisTicks.calculateLayout(); + } + updateContainer(bbox) { + const containerStyles = this.getContainerStyles(); + import_ag_charts_community173._ModuleSupport.applyShapeStyle(this.containerNode, containerStyles); + this.containerNode.cornerRadius = containerStyles.cornerRadius; + this.containerNode.x = bbox.x; + this.containerNode.y = bbox.y; + this.containerNode.width = bbox.width; + this.containerNode.height = bbox.height; + } + updateArrow() { + const highlighted = this.highlightManager.getActiveHighlight(); + const { arrow } = this; + if (highlighted?.colorValue == null) { + arrow.visible = false; + return; + } + const { scale, label } = this.axisTicks; + const size = label.fontSize ?? 0; + const t = scale.convert(highlighted.colorValue); + let { x, y } = this.gradientRect; + let rotation = Math.PI; + if (this.isVertical()) { + x -= size / 2; + y += t; + rotation /= 2; + } else { + x += t; + y -= size / 2; + } + arrow.visible = true; + arrow.fill = label.color; + arrow.rotation = rotation; + arrow.size = size; + arrow.translationX = x; + arrow.translationY = y; + } + getMeasurements(shrinkRect, legendBBox) { + function unreachable(_a) { + return void 0; + } + let { x: left, y: top } = shrinkRect; + const { width, height } = legendBBox; + const { placement, floating, xOffset, yOffset } = expandLegendPosition(this.position); + const containerStyles = this.getContainerStyles(); + left += containerStyles.strokeWidth + containerStyles.padding.left; + top += containerStyles.strokeWidth + containerStyles.padding.top; + switch (placement) { + case "left": + top += shrinkRect.height / 2 - height / 2; + break; + case "right": + left += shrinkRect.width - width; + top += shrinkRect.height / 2 - height / 2; + break; + case "top": + left += shrinkRect.width / 2 - width / 2; + break; + case "bottom": + left += shrinkRect.width / 2 - width / 2; + top += shrinkRect.height - height; + break; + case "right-top": + case "top-right": + left += shrinkRect.width - width; + break; + case "right-bottom": + case "bottom-right": + left += shrinkRect.width - width; + top += shrinkRect.height - height; + break; + case "left-bottom": + case "bottom-left": + top += shrinkRect.height - height; + break; + case "left-top": + case "top-left": + break; + default: + unreachable(placement); + } + if (!floating) { + switch (placement) { + case "left": + case "left-top": + case "left-bottom": + shrinkRect.shrink(width + this.spacing, "left"); + break; + case "right": + case "right-top": + case "right-bottom": + shrinkRect.shrink(width + this.spacing, "right"); + break; + case "top": + case "top-left": + case "top-right": + shrinkRect.shrink(height + this.spacing, "top"); + break; + case "bottom": + case "bottom-left": + case "bottom-right": + shrinkRect.shrink(height + this.spacing, "bottom"); + break; + default: + unreachable(placement); + } + } + left += xOffset; + top += yOffset; + return { top, left }; + } + getContainerStyles() { + const { stroke: stroke2, strokeOpacity, strokeWidth } = this.border; + const { cornerRadius, fill, fillOpacity, padding } = this; + const isPaddingNumber = typeof padding === "number"; + return { + cornerRadius, + fill, + fillOpacity, + padding: { + top: isPaddingNumber ? padding : padding.top ?? 0, + right: isPaddingNumber ? padding : padding.right ?? 0, + bottom: isPaddingNumber ? padding : padding.bottom ?? 0, + left: isPaddingNumber ? padding : padding.left ?? 0 + }, + stroke: stroke2, + strokeOpacity, + strokeWidth: this.border.enabled ? strokeWidth : 0 + }; + } + onChartHoverChange() { + if (!this.enabled) + return; + this.updateArrow(); + } +}; +GradientLegend.className = "GradientLegend"; +__decorateClass([ + Property63 +], GradientLegend.prototype, "enabled", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "position", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "reverseOrder", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "gradient", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "spacing", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "border", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "cornerRadius", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "fill", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "fillOpacity", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "padding", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "scale", 2); + +// packages/ag-charts-enterprise/src/gradient-legend/gradientLegendModule.ts +var GradientLegendModule = { + type: "legend", + optionsKey: "gradientLegend", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + identifier: "gradient", + moduleFactory: (ctx) => new GradientLegend(ctx), + themeTemplate: { + enabled: false, + position: "bottom", + spacing: 20, + scale: { + padding: 13, + label: { + color: { $ref: "textColor" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + minSpacing: 5 + }, + interval: { + minSpacing: 15 + } + }, + gradient: { + preferredLength: 100, + thickness: 16 + }, + reverseOrder: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $ref: "chartBackgroundColour" }, + ["gradient", import_ag_charts_community174._ModuleSupport.FILL_GRADIENT_BLANK_DEFAULTS], + ["pattern", import_ag_charts_community174._ModuleSupport.FILL_PATTERN_BLANK_DEFAULTS], + ["image", import_ag_charts_community174._ModuleSupport.FILL_IMAGE_BLANK_DEFAULTS] + ] + } + }, + removable: "standalone-only" +}; + +// packages/ag-charts-enterprise/src/license/watermark.ts +var import_ag_charts_core77 = require("ag-charts-core"); +function injectWatermark(domManager, text2) { + const element = domManager.addChild("canvas-overlay", "watermark"); + const textElement = (0, import_ag_charts_core77.createElement)("span"); + textElement.innerText = text2; + element.addEventListener("animationend", () => { + domManager.removeChild("canvas-overlay", "watermark"); + domManager.removeStyles("watermark"); + }); + element.classList.add("ag-watermark"); + element.appendChild(textElement); +} + +// packages/ag-charts-enterprise/src/main-modules.ts +var import_ag_charts_community281 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/axes/axisModules.ts +var import_ag_charts_community175 = require("ag-charts-community"); +var { + ordinalTimeAxisOptionsDefs, + angleNumberAxisOptionsDefs, + angleCategoryAxisOptionsDefs, + radiusNumberAxisOptionsDefs, + radiusCategoryAxisOptionsDefs +} = import_ag_charts_community175._ModuleSupport; +var OrdinalTimeAxisModule2 = { + type: "axis", + name: "ordinal-time", + chartType: "cartesian", + enterprise: true, + options: ordinalTimeAxisOptionsDefs, + create: (ctx) => new OrdinalTimeAxis(ctx) +}; +var AngleNumberAxisModule2 = { + type: "axis", + name: "angle-number", + chartType: "polar", + enterprise: true, + options: angleNumberAxisOptionsDefs, + create: (ctx) => new AngleNumberAxis(ctx) +}; +var AngleCategoryAxisModule2 = { + type: "axis", + name: "angle-category", + chartType: "polar", + enterprise: true, + options: angleCategoryAxisOptionsDefs, + create: (ctx) => new AngleCategoryAxis(ctx) +}; +var RadiusNumberAxisModule2 = { + type: "axis", + name: "radius-number", + chartType: "polar", + enterprise: true, + options: radiusNumberAxisOptionsDefs, + create: (ctx) => new RadiusNumberAxis(ctx) +}; +var RadiusCategoryAxisModule2 = { + type: "axis", + name: "radius-category", + chartType: "polar", + enterprise: true, + options: radiusCategoryAxisOptionsDefs, + create: (ctx) => new RadiusCategoryAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/charts/standaloneChartModule.ts +var import_ag_charts_community177 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/charts/standaloneChart.ts +var import_ag_charts_community176 = require("ag-charts-community"); +var { Chart } = import_ag_charts_community176._ModuleSupport; +var StandaloneChart = class extends Chart { + getChartType() { + return "standalone"; + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(seriesRect.x); + group.translationY = Math.floor(seriesRect.y); + } + seriesRoot.visible = this.series[0].visible; + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: true, rect: seriesRect, paddedRect: layoutBox } + }); + } + getAriaLabel() { + const seriesType = this.series[0]?.type; + if (seriesType == null) + return ""; + const caption = this.getCaptionText(); + switch (seriesType) { + case "radial-gauge": + case "linear-gauge": { + const captions = []; + if (caption.length !== 0) { + captions.push(caption); + } + for (const series of this.series) { + captions.push(series.getCaptionText()); + } + return this.ctx.localeManager.t("ariaAnnounceGaugeChart", { caption: captions.join(". ") }); + } + case "treemap": + case "sunburst": + return this.ctx.localeManager.t("ariaAnnounceHierarchyChart", { caption }); + default: { + return this.ctx.localeManager.t("ariaAnnounceStandaloneChart", { caption }); + } + } + } +}; +StandaloneChart.className = "StandaloneChart"; +StandaloneChart.type = "standalone"; + +// packages/ag-charts-enterprise/src/charts/standaloneChartModule.ts +var { isAgStandaloneChartOptions, standaloneChartOptionsDefs } = import_ag_charts_community177._ModuleSupport; +var StandaloneChartModule = { + type: "chart", + name: "standalone", + enterprise: true, + options: standaloneChartOptionsDefs, + detect: isAgStandaloneChartOptions, + create(options, resources) { + return new StandaloneChart(options, resources); + } +}; + +// packages/ag-charts-enterprise/src/charts/topologyChartModule.ts +var import_ag_charts_community179 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/charts/topologyChart.ts +var import_ag_charts_community178 = require("ag-charts-community"); +var { Chart: Chart2, MercatorScale, ChartAxisDirection: ChartAxisDirection24, Property: Property64 } = import_ag_charts_community178._ModuleSupport; +function isTopologySeries(series) { + return series.type === "map-shape" || series.type === "map-line" || series.type === "map-marker" || series.type === "map-shape-background" || series.type === "map-line-background"; +} +var TopologyChart = class extends Chart2 { + constructor(options, resources) { + super(options, resources); + this.ctx.zoomManager.updateAxes([ChartAxisDirection24.X, ChartAxisDirection24.Y]); + } + getChartType() { + return "topology"; + } + async updateData() { + await super.updateData(); + const options = this.getOptions(); + if (this.topology !== options.topology) { + this.topology = options.topology; + } + const { topology } = this; + for (const series of this.series) { + if (isTopologySeries(series)) { + series.setChartTopology(topology); + } + } + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + const mapSeries = this.series.filter(isTopologySeries); + const combinedBbox = mapSeries.reduce((combined, series) => { + if (!series.visible) + return combined; + const bbox = series.topologyBounds; + if (bbox == null) + return combined; + if (combined == null) + return bbox; + return combined.merge(bbox); + }, void 0); + let scale; + if (combinedBbox != null) { + const { lon0, lat0, lon1, lat1 } = combinedBbox; + const domain = [ + [lon0, lat0], + [lon1, lat1] + ]; + const bounds = MercatorScale.bounds(domain); + const { width, height } = seriesRect; + const viewBoxScale = Math.min(width / bounds.width, height / bounds.height); + const viewBoxWidth = bounds.width * viewBoxScale; + const viewBoxHeight = bounds.height * viewBoxScale; + const viewBoxOriginX = (width - viewBoxWidth) / 2; + const viewBoxOriginY = (height - viewBoxHeight) / 2; + const x0 = viewBoxOriginX; + const y0 = viewBoxOriginY; + const x1 = viewBoxOriginX + viewBoxWidth; + const y1 = viewBoxOriginY + viewBoxHeight; + const xZoom = this.ctx.zoomManager.getAxisZoom(ChartAxisDirection24.X); + const yZoom = this.ctx.zoomManager.getAxisZoom(ChartAxisDirection24.Y); + const xSpan = (x1 - x0) / (xZoom.max - xZoom.min); + const xStart = x0 - xSpan * xZoom.min; + const ySpan = (y1 - y0) / (1 - yZoom.min - (1 - yZoom.max)); + const yStart = y0 - ySpan * (1 - yZoom.max); + scale = new MercatorScale(domain, [ + [xStart, yStart], + [xStart + xSpan, yStart + ySpan] + ]); + } + for (const series of mapSeries) { + series.scale = scale; + } + const seriesVisible = this.series.some((s) => s.visible); + seriesRoot.visible = seriesVisible; + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(seriesRect.x); + group.translationY = Math.floor(seriesRect.y); + group.setClipRect(seriesRect.clone()); + } + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: seriesVisible, rect: seriesRect, paddedRect: layoutBox } + }); + } +}; +TopologyChart.className = "TopologyChart"; +TopologyChart.type = "topology"; +__decorateClass([ + Property64 +], TopologyChart.prototype, "topology", 2); + +// packages/ag-charts-enterprise/src/charts/topologyChartModule.ts +var { isAgTopologyChartOptions, topologyChartOptionsDefs } = import_ag_charts_community179._ModuleSupport; +var TopologyChartModule = { + type: "chart", + name: "topology", + enterprise: true, + options: topologyChartOptionsDefs, + detect: isAgTopologyChartOptions, + create(options, resources) { + return new TopologyChart(options, resources); + } +}; + +// packages/ag-charts-enterprise/src/features/sync/pluginModules.ts +var import_ag_charts_community181 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/features/annotations/annotationOptionsDef.ts +var import_ag_charts_community180 = require("ag-charts-community"); +var import_ag_charts_core78 = require("ag-charts-core"); +var { + annotationCalloutStylesDefs, + annotationNoteStylesDefs, + annotationTextStylesDef, + annotationCommentStylesDefs, + annotationMeasurerStylesDefs, + annotationQuickMeasurerStylesDefs, + annotationShapeStylesDefs, + annotationChannelTextDefs, + annotationCrossLineStyleDefs, + annotationFibonacciStylesDefs, + annotationLineStyleDefs, + annotationLineTextDefs, + annotationDisjointChannelStyleDefs, + annotationParallelChannelStyleDefs +} = import_ag_charts_community180._ModuleSupport; +var serializableDate = (0, import_ag_charts_core78.optionsDefs)( + { + __type: (0, import_ag_charts_core78.required)((0, import_ag_charts_core78.constant)("date")), + value: (0, import_ag_charts_core78.or)(import_ag_charts_core78.string, import_ag_charts_core78.number) + }, + "a serializable date object" +); +var xValue = (0, import_ag_charts_core78.or)(import_ag_charts_core78.string, import_ag_charts_core78.number, serializableDate); +var annotationValue = (0, import_ag_charts_core78.or)( + xValue, + (0, import_ag_charts_core78.optionsDefs)({ + value: xValue, + groupPercentage: (0, import_ag_charts_core78.numberRange)(-1, 2) + }) +); +var channelAnnotationTextOptionsDef = { + ...annotationChannelTextDefs, + label: import_ag_charts_core78.string +}; +var lineAnnotationTextOptionsDef = { + ...annotationLineTextDefs, + label: import_ag_charts_core78.string +}; +var annotationPointOptionsDef = { + x: annotationValue, + y: import_ag_charts_core78.number +}; +var annotationInitialStateOptionsDef = (0, import_ag_charts_core78.typeUnion)( + { + line: { + ...annotationLineStyleDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef + }, + "horizontal-line": { + ...annotationCrossLineStyleDefs, + value: annotationValue, + text: lineAnnotationTextOptionsDef + }, + "vertical-line": { + ...annotationCrossLineStyleDefs, + value: annotationValue, + text: lineAnnotationTextOptionsDef + }, + "disjoint-channel": { + ...annotationDisjointChannelStyleDefs, + startHeight: import_ag_charts_core78.number, + endHeight: import_ag_charts_core78.number, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: channelAnnotationTextOptionsDef + }, + "parallel-channel": { + ...annotationParallelChannelStyleDefs, + height: import_ag_charts_core78.number, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: channelAnnotationTextOptionsDef + }, + "fibonacci-retracement": { + ...annotationFibonacciStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef, + reverse: import_ag_charts_core78.boolean + }, + "fibonacci-retracement-trend-based": { + ...annotationFibonacciStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + endRetracement: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef, + reverse: import_ag_charts_core78.boolean + }, + callout: { + ...annotationCalloutStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: import_ag_charts_core78.string + }, + comment: { + ...annotationCommentStylesDefs, + ...annotationPointOptionsDef, + text: import_ag_charts_core78.string + }, + note: { + ...annotationNoteStylesDefs, + ...annotationPointOptionsDef, + text: import_ag_charts_core78.string + }, + text: { + ...annotationTextStylesDef, + ...annotationPointOptionsDef, + text: import_ag_charts_core78.string + }, + arrow: { + ...annotationLineStyleDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "arrow-up": { + ...annotationShapeStylesDefs, + ...annotationPointOptionsDef + }, + "arrow-down": { + ...annotationShapeStylesDefs, + ...annotationPointOptionsDef + }, + "date-range": { + ...annotationMeasurerStylesDefs, + extendAbove: import_ag_charts_core78.boolean, + extendBelow: import_ag_charts_core78.boolean, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "price-range": { + ...annotationMeasurerStylesDefs, + extendLeft: import_ag_charts_core78.boolean, + extendRight: import_ag_charts_core78.boolean, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "date-price-range": { + ...annotationMeasurerStylesDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "quick-date-price-range": { + ...annotationMeasurerStylesDefs, + ...annotationQuickMeasurerStylesDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + } + }, + "an annotation initial state object" +); +var initialStateOptionsDef = { + chartType: (0, import_ag_charts_core78.union)("candlestick", "hollow-candlestick", "ohlc", "line", "step-line", "hlc", "high-low"), + annotations: (0, import_ag_charts_core78.arrayOfDefs)(annotationInitialStateOptionsDef), + legend: (0, import_ag_charts_core78.arrayOfDefs)( + { + visible: import_ag_charts_core78.boolean, + seriesId: import_ag_charts_core78.string, + itemId: import_ag_charts_core78.string, + legendItemName: import_ag_charts_core78.string + }, + "legend state array" + ), + zoom: { + rangeX: { + start: (0, import_ag_charts_core78.or)(import_ag_charts_core78.number, serializableDate), + end: (0, import_ag_charts_core78.or)(import_ag_charts_core78.number, serializableDate) + }, + rangeY: { + start: (0, import_ag_charts_core78.or)(import_ag_charts_core78.number, serializableDate), + end: (0, import_ag_charts_core78.or)(import_ag_charts_core78.number, serializableDate) + }, + ratioX: { + start: (0, import_ag_charts_core78.and)(import_ag_charts_core78.ratio, (0, import_ag_charts_core78.lessThan)("end")), + end: (0, import_ag_charts_core78.and)(import_ag_charts_core78.ratio, (0, import_ag_charts_core78.greaterThan)("start")) + }, + ratioY: { + start: (0, import_ag_charts_core78.and)(import_ag_charts_core78.ratio, (0, import_ag_charts_core78.lessThan)("end")), + end: (0, import_ag_charts_core78.and)(import_ag_charts_core78.ratio, (0, import_ag_charts_core78.greaterThan)("start")) + }, + autoScaledAxes: (0, import_ag_charts_core78.arrayOf)((0, import_ag_charts_core78.constant)("y")) + } +}; + +// packages/ag-charts-enterprise/src/features/sync/pluginModules.ts +var { annotationOptionsDef } = import_ag_charts_community181._ModuleSupport; +var AnnotationsModule2 = { + type: "plugin", + name: "annotations", + chartType: "cartesian", + options: annotationOptionsDef, + create() { + return null; + } +}; +var NavigatorModule2 = { + type: "plugin", + name: "navigator", + chartType: "cartesian", + options: navigatorOptionsDef, + create() { + return null; + } +}; +var InitialStateModule = { + type: "plugin", + name: "initialState", + options: initialStateOptionsDef, + create() { + return null; + } +}; + +// packages/ag-charts-enterprise/src/series/chord/chordModule.ts +var import_ag_charts_community187 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/chord/chordSeries.ts +var import_ag_charts_community185 = require("ag-charts-community"); +var import_ag_charts_core80 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionSeries.ts +var import_ag_charts_community182 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionUtil.ts +var import_ag_charts_core79 = require("ag-charts-core"); +function computeNodeGraph(nodes, links, includeCircularReferences) { + if (!includeCircularReferences) { + links = removeCircularLinks(links); + } + const nodeGraph = /* @__PURE__ */ new Map(); + for (const datum of nodes) { + nodeGraph.set(datum.id, { + datum, + linksBefore: [], + linksAfter: [], + maxPathLengthBefore: -1, + maxPathLengthAfter: -1 + }); + } + let maxPathLength = 0; + for (const [id, node] of nodeGraph.entries()) { + maxPathLength = Math.max( + maxPathLength, + computePathLength(nodeGraph, links, node, id, -1, []) + computePathLength(nodeGraph, links, node, id, 1, []) + 1 + ); + } + return { links, nodeGraph, maxPathLength }; +} +function findCircularLinks(links, link, into, stack) { + const stackIndex = stack.indexOf(link); + if (stackIndex !== -1) { + for (let i = stackIndex; i < stack.length; i += 1) { + into.add(stack[i]); + } + return; + } + stack.push(link); + const { toNode } = link; + for (const next of links) { + if (next.fromNode === toNode) { + findCircularLinks(links, next, into, stack); + } + } + stack.pop(); +} +function removeCircularLinks(links) { + const circularLinks = /* @__PURE__ */ new Set(); + for (const link of links) { + findCircularLinks(links, link, circularLinks, []); + } + if (circularLinks.size !== 0) { + import_ag_charts_core79.Logger.warnOnce("Some links formed circular references. These will be removed from the output."); + } + return circularLinks.size === 0 ? links : links.filter((link) => !circularLinks.has(link)); +} +function computePathLength(nodeGraph, links, node, id, direction, stack) { + if (stack.includes(id)) { + return Infinity; + } + let maxPathLength = direction === -1 ? node.maxPathLengthBefore : node.maxPathLengthAfter; + if (maxPathLength === -1) { + maxPathLength = 0; + const connectedLinks = direction === -1 ? node.linksBefore : node.linksAfter; + for (const link of links) { + const { fromNode, toNode } = link; + const linkId = direction === -1 ? toNode.id : fromNode.id; + const nextNodeId = direction === -1 ? fromNode.id : toNode.id; + const nextNode = id === linkId ? nodeGraph.get(nextNodeId) : void 0; + if (nextNode == null) + continue; + connectedLinks.push({ node: nextNode, link }); + stack?.push(id); + maxPathLength = Math.max( + maxPathLength, + computePathLength(nodeGraph, links, nextNode, nextNodeId, direction, stack) + 1 + ); + stack?.pop(); + } + if (direction === -1) { + node.maxPathLengthBefore = maxPathLength; + } else { + node.maxPathLengthAfter = maxPathLength; + } + } + return maxPathLength; +} + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionSeries.ts +var { Series, DataController, keyProperty: keyProperty7, valueProperty: valueProperty10, Selection: Selection5, Group: Group9, TransformableText } = import_ag_charts_community182._ModuleSupport; +var FlowProportionSeriesNodeEvent = class extends import_ag_charts_community182._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + const { datumIndex } = datum; + const nodeDatum = series.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + this.size = nodeDatum?.size; + this.label = nodeDatum?.type === 1 /* Node */ ? nodeDatum?.label : void 0; + } +}; +var FlowProportionSeries = class extends Series { + constructor() { + super(...arguments); + this.NodeEvent = FlowProportionSeriesNodeEvent; + this.nodeCount = 0; + this.linkCount = 0; + this.linksDataModel = void 0; + this.linksProcessedData = void 0; + this.nodesDataModel = void 0; + this.nodesProcessedData = void 0; + this.processedNodes = /* @__PURE__ */ new Map(); + this.linkGroup = this.contentGroup.appendChild(new Group9({ name: "linkGroup" })); + this.nodeGroup = this.contentGroup.appendChild(new Group9({ name: "nodeGroup" })); + this.focusLinkGroup = this.highlightGroup.appendChild(new Group9({ name: "linkGroup" })); + this.focusNodeGroup = this.highlightGroup.appendChild(new Group9({ name: "nodeGroup" })); + this.highlightLinkGroup = this.highlightGroup.appendChild(new Group9({ name: "linkGroup" })); + this.highlightNodeGroup = this.highlightGroup.appendChild(new Group9({ name: "nodeGroup" })); + this.labelSelection = Selection5.select( + this.labelGroup, + TransformableText + ); + this.linkSelection = Selection5.select( + this.linkGroup, + () => this.linkFactory() + ); + this.nodeSelection = Selection5.select( + this.nodeGroup, + () => this.nodeFactory() + ); + this.focusLinkSelection = Selection5.select( + this.focusLinkGroup, + () => this.linkFactory() + ); + this.focusNodeSelection = Selection5.select( + this.focusNodeGroup, + () => this.nodeFactory() + ); + this.highlightLinkSelection = Selection5.select( + this.highlightLinkGroup, + () => this.linkFactory() + ); + this.highlightNodeSelection = Selection5.select( + this.highlightNodeGroup, + () => this.nodeFactory() + ); + } + get nodes() { + return this.properties.nodes; + } + async processData(dataController) { + const { data, nodes } = this; + if (data == null) + return; + const { fromKey, toKey, sizeKey, idKey, labelKey } = this.properties; + const nodesDataController = new DataController("standalone", dataController.suppressFieldDotNotation); + const nodesDataModelPromise = nodes == null ? null : nodesDataController.request( + this.id, + import_ag_charts_community182._ModuleSupport.DataSet.wrap(nodes) ?? import_ag_charts_community182._ModuleSupport.DataSet.empty(), + { + props: [ + keyProperty7(idKey, void 0, { id: "idValue", includeProperty: false }), + ...labelKey == null ? [] : [valueProperty10(labelKey, void 0, { id: "labelValue", includeProperty: false })] + ], + groupByKeys: true + } + ); + const linksDataModelPromise = dataController.request(this.id, data, { + props: [ + valueProperty10(fromKey, void 0, { id: "fromValue", includeProperty: false }), + valueProperty10(toKey, void 0, { id: "toValue", includeProperty: false }), + ...sizeKey == null ? [] : [ + valueProperty10(sizeKey, void 0, { + id: "sizeValue", + includeProperty: false, + missingValue: 0 + }) + ] + ], + groupByKeys: false + }); + if (nodes != null) { + nodesDataController.execute(); + } + const [nodesDataModel, linksDataModel] = await Promise.all([ + nodesDataModelPromise ?? Promise.resolve(null), + linksDataModelPromise + ]); + this.nodesDataModel = nodesDataModel?.dataModel; + this.nodesProcessedData = nodesDataModel?.processedData; + this.linksDataModel = linksDataModel?.dataModel; + this.linksProcessedData = linksDataModel?.processedData; + const processedNodes = /* @__PURE__ */ new Map(); + if (nodesDataModel == null) { + const fromIdValues = linksDataModel.dataModel.resolveColumnById( + this, + "fromValue", + linksDataModel.processedData + ); + const toIdValues = linksDataModel.dataModel.resolveColumnById( + this, + "toValue", + linksDataModel.processedData + ); + const createImplicitNode = (id) => { + const datumIndex = processedNodes.size; + const label = id; + return { + series: this, + itemId: void 0, + datum: {}, + // Must be a referential object for tooltips + datumIndex: { type: 1 /* Node */, index: datumIndex }, + type: 1 /* Node */, + index: datumIndex, + linksBefore: [], + linksAfter: [], + id, + size: 0, + label, + style: this.getNodeStyle( + { + datumIndex: { type: 1 /* Node */, index: datumIndex }, + datum: {}, + size: 0, + label + }, + datumIndex, + false + ) + }; + }; + const linkData = linksDataModel.processedData.dataSources.get(this.id)?.data; + if (linkData) { + for (const [datumIndex] of linkData.entries()) { + const fromId = fromIdValues[datumIndex]; + const toId = toIdValues[datumIndex]; + if (fromId == null || toId == null) + continue; + if (!processedNodes.has(fromId)) { + processedNodes.set(fromId, createImplicitNode(fromId)); + } + if (!processedNodes.has(toId)) { + processedNodes.set(toId, createImplicitNode(toId)); + } + } + } + } else { + const nodeIdValues = nodesDataModel.dataModel.resolveColumnById( + this, + "idValue", + nodesDataModel.processedData + ); + const labelValues = labelKey == null ? void 0 : nodesDataModel.dataModel.resolveColumnById( + this, + "labelValue", + nodesDataModel.processedData + ); + const nodeData = nodesDataModel.processedData.dataSources.get(this.id)?.data; + if (nodeData) { + for (const [datumIndex, datum] of nodeData.entries()) { + const id = nodeIdValues[datumIndex]; + const label = labelValues?.[datumIndex]; + const nodeDatumIndex = { type: 1 /* Node */, index: datumIndex }; + processedNodes.set(id, { + series: this, + itemId: void 0, + datum, + datumIndex: nodeDatumIndex, + type: 1 /* Node */, + index: datumIndex, + linksBefore: [], + linksAfter: [], + id, + size: 0, + label, + style: this.getNodeStyle( + { datumIndex: nodeDatumIndex, datum, size: 0, label }, + datumIndex, + false + ) + }); + } + } + } + this.processedNodes = processedNodes; + } + getNodeGraph(createNode, createLink, { includeCircularReferences }) { + const { linksDataModel, linksProcessedData } = this; + if (linksDataModel == null || linksProcessedData == null) { + const { links: links2, nodeGraph: nodeGraph2, maxPathLength: maxPathLength2 } = computeNodeGraph( + (/* @__PURE__ */ new Map()).values(), + [], + includeCircularReferences + ); + this.nodeCount = 0; + this.linkCount = 0; + return { nodeGraph: nodeGraph2, links: links2, maxPathLength: maxPathLength2 }; + } + const { sizeKey } = this.properties; + const fromIdValues = linksDataModel.resolveColumnById(this, "fromValue", linksProcessedData); + const toIdValues = linksDataModel.resolveColumnById(this, "toValue", linksProcessedData); + const sizeValues = sizeKey == null ? void 0 : linksDataModel.resolveColumnById(this, "sizeValue", linksProcessedData); + const nodesById = /* @__PURE__ */ new Map(); + for (const datum of this.processedNodes.values()) { + const node = createNode(datum); + nodesById.set(datum.id, node); + } + const baseLinks = []; + const linkData = linksProcessedData.dataSources.get(this.id)?.data; + if (linkData) { + for (const [datumIndex, datum] of linkData.entries()) { + const fromId = fromIdValues[datumIndex]; + const toId = toIdValues[datumIndex]; + const size = sizeValues == null ? 1 : sizeValues[datumIndex]; + const fromNode = nodesById.get(fromId); + const toNode = nodesById.get(toId); + if (size <= 0 || fromNode == null || toNode == null) + continue; + const linkNodeDatumIndex = { type: 0 /* Link */, index: datumIndex }; + const link = createLink({ + series: this, + itemId: void 0, + datum, + datumIndex: linkNodeDatumIndex, + type: 0 /* Link */, + index: datumIndex, + fromNode, + toNode, + size, + style: this.getLinkStyle( + { datum, datumIndex: linkNodeDatumIndex }, + fromNode.datumIndex, + false + ) + }); + baseLinks.push(link); + } + } + const { links, nodeGraph, maxPathLength } = computeNodeGraph( + nodesById.values(), + baseLinks, + includeCircularReferences + ); + for (const node of nodeGraph.values()) { + node.datum.linksBefore = node.linksBefore.map((linkedNode) => linkedNode.link); + node.datum.linksAfter = node.linksAfter.map((linkedNode) => linkedNode.link); + } + this.nodeCount = nodeGraph.size; + this.linkCount = links.length; + return { nodeGraph, links, maxPathLength }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update(opts) { + const { seriesRect } = opts; + const newNodeDataDependencies = { + seriesRectWidth: seriesRect?.width ?? 0, + seriesRectHeight: seriesRect?.height ?? 0 + }; + if (this._nodeDataDependencies == null || this._nodeDataDependencies.seriesRectWidth !== newNodeDataDependencies.seriesRectWidth || this._nodeDataDependencies.seriesRectHeight !== newNodeDataDependencies.seriesRectHeight) { + this._nodeDataDependencies = newNodeDataDependencies; + } + this.updateSelections(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedDatum?.series === this && highlightedDatum.type == null) { + const { itemId } = highlightedDatum; + highlightedDatum = itemId == null ? void 0 : nodeData.find((node) => node.type === 1 /* Node */ && node.id === itemId); + } else if (highlightedDatum?.series !== this) { + highlightedDatum = void 0; + } + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = highlightedDatum == null ? 1 : this.properties.highlight.unhighlightedItem.opacity ?? 1; + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection: this.labelSelection }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + this.linkSelection = this.updateLinkSelection({ + nodeData: nodeData.filter((d) => d.type === 0 /* Link */), + datumSelection: this.linkSelection + }); + this.updateLinkNodes({ datumSelection: this.linkSelection, isHighlight: false }); + this.nodeSelection = this.updateNodeSelection({ + nodeData: nodeData.filter((d) => d.type === 1 /* Node */), + datumSelection: this.nodeSelection + }); + this.updateNodeNodes({ datumSelection: this.nodeSelection, isHighlight: false }); + let focusLinkSelection; + let focusNodeSelection; + let highlightLinkSelection; + let highlightNodeSelection; + if (highlightedDatum?.type === 1 /* Node */) { + focusLinkSelection = nodeData.filter((node) => { + return node.type === 0 /* Link */ && (node.toNode === highlightedDatum || node.fromNode === highlightedDatum); + }); + focusNodeSelection = focusLinkSelection.map((link) => { + return link.fromNode === highlightedDatum ? link.toNode : link.fromNode; + }); + focusNodeSelection.push(highlightedDatum); + highlightLinkSelection = []; + highlightNodeSelection = [highlightedDatum]; + } else if (highlightedDatum?.type === 0 /* Link */) { + focusLinkSelection = [highlightedDatum]; + focusNodeSelection = [highlightedDatum.fromNode, highlightedDatum.toNode]; + highlightLinkSelection = [highlightedDatum]; + highlightNodeSelection = []; + } else { + focusLinkSelection = []; + focusNodeSelection = []; + highlightLinkSelection = []; + highlightNodeSelection = []; + } + this.focusLinkSelection = this.updateLinkSelection({ + nodeData: focusLinkSelection, + datumSelection: this.focusLinkSelection + }); + this.updateLinkNodes({ datumSelection: this.focusLinkSelection, isHighlight: false }); + this.focusNodeSelection = this.updateNodeSelection({ + nodeData: focusNodeSelection, + datumSelection: this.focusNodeSelection + }); + this.updateNodeNodes({ datumSelection: this.focusNodeSelection, isHighlight: false }); + this.highlightLinkSelection = this.updateLinkSelection({ + nodeData: highlightLinkSelection, + datumSelection: this.highlightLinkSelection + }); + this.updateLinkNodes({ datumSelection: this.highlightLinkSelection, isHighlight: true }); + this.highlightNodeSelection = this.updateNodeSelection({ + nodeData: highlightNodeSelection, + datumSelection: this.highlightNodeSelection + }); + this.updateNodeNodes({ datumSelection: this.highlightNodeSelection, isHighlight: true }); + } + resetAnimation(_chartAnimationPhase) { + } + dataCount() { + return Number.NaN; + } + getSeriesDomain(_direction) { + return []; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + legendItemSymbol(_type, nodeIndex, format = {}) { + const { fills, strokes } = this.properties; + const { + fill = fills[nodeIndex % fills.length], + fillOpacity = 1, + stroke: stroke2 = strokes[nodeIndex % strokes.length], + strokeWidth = 0, + strokeOpacity = 1, + lineDash = [0], + lineDashOffset = 0 + } = format; + return { + marker: { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") + return []; + const { showInLegend } = this.properties; + return Array.from( + this.processedNodes.values(), + ({ id, label }, nodeIndex) => ({ + legendType: "category", + id: this.id, + itemId: id, + seriesId: this.id, + enabled: true, + label: { text: label ?? id }, + symbol: this.legendItemSymbol(1 /* Node */, nodeIndex), + hideInLegend: !showInLegend, + isFixed: true + }) + ); + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.linkSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + this.nodeSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + getDatumAriaText(datum, description) { + if (datum.type === 0 /* Link */) { + return this.ctx.localeManager.t("ariaAnnounceFlowProportionLink", { + index: datum.index + 1, + count: this.linkCount, + from: datum.fromNode.id, + to: datum.toNode.id, + size: datum.size, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }); + } else if (datum.type === 1 /* Node */) { + return this.ctx.localeManager.t("ariaAnnounceFlowProportionNode", { + index: datum.index + 1, + count: this.nodeCount, + description + }); + } + } + pickFocus(opts) { + const { datumIndexDelta: childDelta, otherIndexDelta: depthDelta } = opts; + const currentNodeDatum = this.contextNodeData?.nodeData[opts.datumIndex - opts.datumIndexDelta]; + let nextNodeDatum = currentNodeDatum; + if (depthDelta !== 0 || childDelta === 0) + return; + if (currentNodeDatum?.type === 0 /* Link */) { + const allLinks = Array.from(this.linkSelection, (link) => link.datum); + const selfIndex = allLinks.indexOf(currentNodeDatum); + const nextIndex = selfIndex + childDelta; + if (nextIndex >= 0 && nextIndex < allLinks.length) { + nextNodeDatum = allLinks[nextIndex]; + } else if (nextIndex > 0) { + nextNodeDatum = allLinks.at(-1); + } else { + const allNodes = Array.from(this.nodeSelection, (node) => node.datum); + nextNodeDatum = allNodes.at(-1); + } + } else if (currentNodeDatum?.type === 1 /* Node */) { + const allNodes = Array.from(this.nodeSelection, (node) => node.datum); + const selfIndex = allNodes.indexOf(currentNodeDatum); + const nextIndex = selfIndex + childDelta; + if (nextIndex >= 0 && nextIndex < allNodes.length) { + nextNodeDatum = allNodes[nextIndex]; + } else if (nextIndex < 0) { + nextNodeDatum = allNodes[0]; + } else { + const allLinks = Array.from(this.linkSelection, (link) => link.datum); + nextNodeDatum = allLinks[0]; + } + } + if (nextNodeDatum == null) + return; + const nodeDatum = nextNodeDatum.type === 1 /* Node */ ? Array.from(this.nodeSelection).find((n) => n.datum === nextNodeDatum) : Array.from(this.linkSelection).find((n) => n.datum === nextNodeDatum); + if (nodeDatum == null) + return; + const bounds = this.computeFocusBounds(nodeDatum.node); + if (bounds == null) + return; + return { + datum: nodeDatum.datum, + datumIndex: this.contextNodeData?.nodeData.indexOf(nodeDatum.datum) ?? 0, + otherIndex: 0, + bounds, + clipFocusBox: true + }; + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } +}; + +// packages/ag-charts-enterprise/src/series/chord/chordLink.ts +var import_ag_charts_community183 = require("ag-charts-community"); +var { Path: Path9, SceneChangeDetection: SceneChangeDetection7 } = import_ag_charts_community183._ModuleSupport; +function bezierControlPoints({ + radius, + startAngle, + endAngle, + tension +}) { + const cp0x = radius * Math.cos(startAngle); + const cp0y = radius * Math.sin(startAngle); + const cp3x = radius * Math.cos(endAngle); + const cp3y = radius * Math.sin(endAngle); + const cp1x = cp0x * tension; + const cp1y = cp0y * tension; + const cp2x = cp3x * tension; + const cp2y = cp3y * tension; + return { + x: [cp0x, cp1x, cp2x, cp3x], + y: [cp0y, cp1y, cp2y, cp3y] + }; +} +var ChordLink = class extends Path9 { + constructor() { + super(...arguments); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.startAngle1 = 0; + this.endAngle1 = 0; + this.startAngle2 = 0; + this.endAngle2 = 0; + this.tension = 1; + } + tensionedCurveTo(cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y) { + const { path, tension } = this; + const scale = 1 - tension; + path.cubicCurveTo( + (cp1x - cp0x) * scale + cp0x, + (cp1y - cp0y) * scale + cp0y, + (cp2x - cp3x) * scale + cp3x, + (cp2y - cp3y) * scale + cp3y, + cp3x, + cp3y + ); + } + updatePath() { + const { path, centerX, centerY, radius } = this; + let { startAngle1, endAngle1, startAngle2, endAngle2 } = this; + if (startAngle1 > startAngle2) { + [startAngle1, startAngle2] = [startAngle2, startAngle1]; + [endAngle1, endAngle2] = [endAngle2, endAngle1]; + } + path.clear(); + const startX = centerX + radius * Math.cos(startAngle1); + const startY = centerY + radius * Math.sin(startAngle1); + path.moveTo(startX, startY); + this.tensionedCurveTo( + startX, + startY, + centerX, + centerY, + centerX, + centerY, + centerX + radius * Math.cos(endAngle2), + centerY + radius * Math.sin(endAngle2) + ); + path.arc(centerX, centerY, radius, endAngle2, startAngle2, true); + this.tensionedCurveTo( + centerX + radius * Math.cos(startAngle2), + centerY + radius * Math.sin(startAngle2), + centerX, + centerY, + centerX, + centerY, + centerX + radius * Math.cos(endAngle1), + centerY + radius * Math.sin(endAngle1) + ); + path.arc(centerX, centerY, radius, endAngle1, startAngle1, true); + path.closePath(); + } +}; +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "centerX", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "centerY", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "radius", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "startAngle1", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "endAngle1", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "startAngle2", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "endAngle2", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "tension", 2); + +// packages/ag-charts-enterprise/src/series/chord/chordSeriesProperties.ts +var import_ag_charts_community184 = require("ag-charts-community"); +var { + FillGradientDefaults: FillGradientDefaults2, + FillPatternDefaults: FillPatternDefaults2, + FillImageDefaults: FillImageDefaults2, + BaseProperties: BaseProperties24, + makeSeriesTooltip: makeSeriesTooltip8, + SeriesProperties, + Property: Property65, + Label: Label6 +} = import_ag_charts_community184._ModuleSupport; +var ChordSeriesLabelProperties = class extends Label6 { + constructor() { + super(...arguments); + this.spacing = 1; + this.maxWidth = 1; + } +}; +__decorateClass([ + Property65 +], ChordSeriesLabelProperties.prototype, "spacing", 2); +__decorateClass([ + Property65 +], ChordSeriesLabelProperties.prototype, "maxWidth", 2); +var ChordSeriesLinkProperties = class extends BaseProperties24 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tension = 0; + } + getStyle(fills, strokes, index) { + const { fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset, tension } = this; + const fill = this.fill ?? fills[index % fills.length]; + const stroke2 = this.stroke ?? strokes[index % fills.length]; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + tension + }; + } +}; +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "fill", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "stroke", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "lineDash", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "tension", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "itemStyler", 2); +var ChordSeriesNodeProperties = class extends BaseProperties24 { + constructor() { + super(...arguments); + this.spacing = 1; + this.width = 1; + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(fills, strokes, index) { + const { fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const fill = this.fill ?? fills[index % fills.length]; + const stroke2 = this.stroke ?? strokes[index % fills.length]; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "spacing", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "width", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "fill", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "stroke", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "lineDash", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "itemStyler", 2); +var ChordSeriesProperties = class extends SeriesProperties { + constructor() { + super(); + this.idKey = ""; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.sizeKey = void 0; + this.sizeName = void 0; + this.nodes = void 0; + this.fillGradientDefaults = new FillGradientDefaults2(); + this.fillPatternDefaults = new FillPatternDefaults2(); + this.fillImageDefaults = new FillImageDefaults2(); + this.fills = []; + this.strokes = []; + this.label = new ChordSeriesLabelProperties(); + this.link = new ChordSeriesLinkProperties(); + this.node = new ChordSeriesNodeProperties(); + this.tooltip = makeSeriesTooltip8(); + this.highlightStyle.deprecated = false; + } +}; +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "fromKey", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "toKey", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "nodes", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "fillGradientDefaults", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "fillPatternDefaults", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "fillImageDefaults", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "fills", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "strokes", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "link", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "node", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/chord/chordSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode6, + createDatumId: createDatumId6, + angleBetween: angleBetween2, + normalizeAngle360: normalizeAngle3604, + isBetweenAngles, + Sector: Sector3, + evaluateBezier, + applyShapeStyle: applyShapeStyle7, + getShapeStyle, + getLabelStyles, + BBox: BBox16, + mergeDefaults: mergeDefaults10 +} = import_ag_charts_community185._ModuleSupport; +var nodeMidAngle = (node) => node.startAngle + angleBetween2(node.startAngle, node.endAngle) / 2; +var ChordSeries = class extends FlowProportionSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode6.NEAREST_NODE, SeriesNodePickMode6.EXACT_SHAPE_MATCH] + }); + this.properties = new ChordSeriesProperties(); + } + isLabelEnabled() { + return (this.properties.labelKey != null || this.nodes == null) && this.properties.label.enabled; + } + linkFactory() { + return new ChordLink(); + } + nodeFactory() { + return new Sector3(); + } + createNodeData() { + const { + id: seriesId, + _nodeDataDependencies: { seriesRectWidth, seriesRectHeight } = { seriesRectWidth: 0, seriesRectHeight: 0 }, + properties + } = this; + const { + fromKey, + toKey, + sizeKey, + labelKey, + label: { spacing: labelSpacing, maxWidth: labelMaxWidth, fontSize }, + node: { width: nodeWidth, spacing: nodeSpacing } + } = properties; + const centerX = seriesRectWidth / 2; + const centerY = seriesRectHeight / 2; + let labelData = []; + const { nodeGraph, links } = this.getNodeGraph( + (node) => ({ + ...node, + centerX, + centerY, + innerRadius: Number.NaN, + outerRadius: Number.NaN, + startAngle: Number.NaN, + endAngle: Number.NaN + }), + (link) => ({ + ...link, + centerX, + centerY, + radius: Number.NaN, + startAngle1: Number.NaN, + endAngle1: Number.NaN, + startAngle2: Number.NaN, + endAngle2: Number.NaN + }), + { includeCircularReferences: true } + ); + let totalSize = 0; + for (const [id, { datum: node, linksBefore, linksAfter }] of nodeGraph.entries()) { + const size = linksBefore.reduce((acc, { link }) => acc + link.size, 0) + linksAfter.reduce((acc, { link }) => acc + link.size, 0); + if (size === 0) { + nodeGraph.delete(id); + } else { + const { label } = properties; + node.size = size; + totalSize += node.size; + const labelText = label.enabled ? this.getLabelText( + node.label, + node.datum, + labelKey, + "label", + [], + label, + { datum: node.datum, value: node.label, fromKey, toKey, sizeKey, size: node.size } + ) : void 0; + node.label = (0, import_ag_charts_core80.toPlainText)(labelText); + } + } + let labelInset = 0; + if (this.isLabelEnabled()) { + const measurer2 = (0, import_ag_charts_core80.cachedTextMeasurer)(this.properties.label); + let maxMeasuredLabelWidth = 0; + for (const { datum: node } of nodeGraph.values()) { + const { id, label } = node; + if (label == null) + continue; + const text2 = (0, import_ag_charts_core80.wrapText)(label, { + maxWidth: labelMaxWidth, + font: this.properties.label, + textWrap: "never" + }); + const { width } = measurer2.measureLines(text2); + maxMeasuredLabelWidth = Math.max(width, maxMeasuredLabelWidth); + labelData.push({ + id, + text: text2, + centerX, + centerY, + angle: Number.NaN, + radius: Number.NaN, + size: node.size + }); + } + labelInset = maxMeasuredLabelWidth + labelSpacing; + } + const nodeCount = nodeGraph.size; + let radius = Math.min(seriesRectWidth, seriesRectHeight) / 2 - nodeWidth - labelInset; + let spacingSweep = nodeSpacing / radius; + if (labelInset !== 0 && (nodeCount * spacingSweep >= 1.5 * Math.PI || radius <= 0)) { + labelData = []; + radius = Math.min(seriesRectWidth, seriesRectHeight) / 2 - nodeWidth; + spacingSweep = nodeSpacing / radius; + } + if (nodeCount * spacingSweep >= 2 * Math.PI || radius <= 0) { + import_ag_charts_core80.Logger.warnOnce("There was insufficient space to display the Chord Series."); + return; + } + const innerRadius = radius; + const outerRadius = radius + nodeWidth; + const sizeScale = Math.max((2 * Math.PI - nodeCount * spacingSweep) / totalSize, 0); + let nodeAngle = 0; + for (const { datum: node } of nodeGraph.values()) { + node.innerRadius = innerRadius; + node.outerRadius = outerRadius; + node.startAngle = nodeAngle; + node.endAngle = nodeAngle + node.size * sizeScale; + nodeAngle = node.endAngle + spacingSweep; + const midR = (node.innerRadius + node.outerRadius) / 2; + const midAngle = nodeMidAngle(node); + node.midPoint = { + x: node.centerX + midR * Math.cos(midAngle), + y: node.centerY + midR * Math.sin(midAngle) + }; + } + const nodeData = []; + for (const { datum: node, linksBefore, linksAfter } of nodeGraph.values()) { + const midAngle = nodeMidAngle(node); + const combinedLinks = [ + ...linksBefore.map((l) => ({ + link: l.link, + distance: angleBetween2(nodeMidAngle(l.node.datum), midAngle), + after: false + })), + ...linksAfter.map((l) => ({ + link: l.link, + distance: angleBetween2(nodeMidAngle(l.node.datum), midAngle), + after: true + })) + ]; + let linkAngle = node.startAngle; + for (const { link, after } of combinedLinks.toSorted((a, b) => a.distance - b.distance)) { + const linkSweep = link.size * sizeScale; + if (after) { + link.startAngle1 = linkAngle; + link.endAngle1 = linkAngle + linkSweep; + } else { + link.startAngle2 = linkAngle; + link.endAngle2 = linkAngle + linkSweep; + } + linkAngle += link.size * sizeScale; + } + nodeData.push(node); + } + const { tension } = this.properties.link; + for (const link of links) { + link.radius = radius; + const outer = bezierControlPoints({ + radius, + startAngle: link.startAngle1, + endAngle: link.endAngle2, + tension + }); + const inner = bezierControlPoints({ + radius, + startAngle: link.startAngle2, + endAngle: link.endAngle1, + tension + }); + const outerX = evaluateBezier(...outer.x, 0.5); + const outerY = evaluateBezier(...outer.y, 0.5); + const innerX = evaluateBezier(...inner.x, 0.5); + const innerY = evaluateBezier(...inner.y, 0.5); + link.midPoint = { + x: link.centerX + (outerX + innerX) / 2, + y: link.centerY + (outerY + innerY) / 2 + }; + nodeData.push(link); + } + for (const label of labelData) { + const node = nodeGraph.get(label.id)?.datum; + if (node == null) + continue; + label.radius = outerRadius + labelSpacing; + label.angle = normalizeAngle3604(node.startAngle + angleBetween2(node.startAngle, node.endAngle) / 2); + } + labelData.sort((a, b) => a.angle - b.angle); + let minAngle = Infinity; + let maxAngle = -Infinity; + labelData = labelData.filter((label) => { + const labelHeight = (0, import_ag_charts_core80.calcLineHeight)(fontSize); + const da = Math.atan2(labelHeight / 2, label.radius); + const a0 = label.angle - da; + const a1 = label.angle + da; + if (isBetweenAngles(minAngle, a0, a1)) + return false; + if (isBetweenAngles(maxAngle, a0, a1)) + return false; + minAngle = Math.min(a0, minAngle); + maxAngle = Math.max(a1, maxAngle); + return true; + }); + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const params = { + toKey: this.properties.toKey, + fromKey: this.properties.fromKey, + sizeKey: this.properties.sizeKey, + size: Number.NaN + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { size, text: text2, centerX, centerY, radius, angle }) => { + params.size = size; + const style = getLabelStyles(this, void 0, params, this.properties.label, false, activeHighlight); + const { fontStyle, fontWeight, fontSize, fontFamily, color: fill } = style; + label.visible = true; + label.translationX = centerX + radius * Math.cos(angle); + label.translationY = centerY + radius * Math.sin(angle); + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textBaseline = "middle"; + if (Math.cos(angle) >= 0) { + label.textAlign = "left"; + label.rotation = angle; + } else { + label.textAlign = "right"; + label.rotation = angle - Math.PI; + } + label.setBoxing(style); + }); + } + updateNodeSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId6(datum.type, datum.id)); + } + getNodeStyle(nodeDatum, fromNodeDatumIndex, isHighlight) { + const { properties } = this; + const { fills, strokes, fillGradientDefaults: fillGradientDefaults3, fillPatternDefaults: fillPatternDefaults3, fillImageDefaults: fillImageDefaults3 } = properties; + const { itemStyler } = properties.node; + const highlightStyle = this.getHighlightStyle(isHighlight, nodeDatum.datumIndex); + const baseStyle = mergeDefaults10(highlightStyle, properties.node.getStyle(fills, strokes, fromNodeDatumIndex)); + let style = getShapeStyle(baseStyle, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + if (itemStyler != null && nodeDatum.datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId6(nodeDatum.datumIndex.index, "node", isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = getShapeStyle( + mergeDefaults10(overrides, style), + fillGradientDefaults3, + fillPatternDefaults3, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + makeItemStylerParams({ datum, datumIndex, size = 0, label }, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + size, + label, + fill + }; + } + updateNodeNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((sector, datum) => { + const { datumIndex } = datum; + const style = this.getNodeStyle(datum, datumIndex.index, isHighlight); + applyShapeStyle7(sector, style, fillBBox); + sector.centerX = datum.centerX; + sector.centerY = datum.centerY; + sector.innerRadius = datum.innerRadius; + sector.outerRadius = datum.outerRadius; + sector.startAngle = datum.startAngle; + sector.endAngle = datum.endAngle; + sector.inset = sector.strokeWidth / 2; + }); + } + updateLinkSelection(opts) { + return opts.datumSelection.update( + opts.nodeData, + void 0, + (datum) => createDatumId6(datum.type, datum.index, datum.fromNode.id, datum.toNode.id) + ); + } + getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, isHighlight) { + const { id: seriesId, properties } = this; + const { fills, strokes, fillGradientDefaults: fillGradientDefaults3, fillPatternDefaults: fillPatternDefaults3, fillImageDefaults: fillImageDefaults3 } = properties; + const { itemStyler } = properties.link; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults10( + highlightStyle, + properties.link.getStyle(fills, strokes, fromNodeDatumIndex.index) + ); + let style = getShapeStyle(baseStyle, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + if (itemStyler != null && datumIndex != null) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const overrides = this.cachedDatumCallback( + createDatumId6(datumIndex.index, "link", isHighlight ? "highlight" : "node"), + () => { + const highlightState = this.getHighlightStateString( + activeHighlight, + isHighlight, + fromNodeDatumIndex + ); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }); + } + ); + if (overrides) { + style = getShapeStyle( + mergeDefaults10(overrides, style), + fillGradientDefaults3, + fillPatternDefaults3, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + updateLinkNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((link, datum) => { + const fromNodeDatumIndex = datum.fromNode.datumIndex; + const style = this.getLinkStyle(datum, fromNodeDatumIndex, isHighlight); + link.centerX = datum.centerX; + link.centerY = datum.centerY; + link.radius = datum.radius; + link.startAngle1 = datum.startAngle1; + link.endAngle1 = datum.endAngle1; + link.startAngle2 = datum.startAngle2; + link.endAngle2 = datum.endAngle2; + link.tension = style.tension; + applyShapeStyle7(link, style, fillBBox); + }); + } + getShapeFillBBox() { + const width = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const height = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const size = Math.min(width, height); + const x = (width - size) / 2; + const y = (height - size) / 2; + const bbox = new BBox16(x, y, width, height); + return { series: bbox, axis: bbox }; + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + linksProcessedData, + nodesProcessedData, + properties, + ctx: { formatManager } + } = this; + const { fromKey, toKey, sizeKey, sizeName, tooltip } = properties; + const seriesDatum = this.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + if (seriesDatum == null) + return; + const nodeIndex = seriesDatum.type === 0 /* Link */ ? seriesDatum.fromNode.index : seriesDatum.index; + const title = seriesDatum.type === 0 /* Link */ ? `${seriesDatum.fromNode.label} - ${seriesDatum.toNode.label}` : seriesDatum.label; + const datum = datumIndex.type === 0 /* Link */ ? linksProcessedData?.dataSources.get(this.id)?.data[datumIndex.index] : nodesProcessedData?.dataSources.get(this.id)?.data[datumIndex.index]; + const size = seriesDatum.size; + let format; + if (seriesDatum.type === 0 /* Link */) { + const fromNodeDatumIndex = seriesDatum.fromNode.datumIndex; + format = this.getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, false); + } else { + const label = seriesDatum.label; + format = this.getNodeStyle({ datumIndex, datum, size, label }, datumIndex.index, false); + } + const data = []; + if (sizeKey != null) { + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: size, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + domain: [], + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(size) }); + } + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(seriesDatum.type, nodeIndex, format), + data + }, + { + seriesId, + datum, + title, + fromKey, + toKey, + sizeKey, + sizeName, + size, + ...format + } + ); + } + computeFocusBounds(node) { + return node; + } + hasItemStylers() { + return this.properties.node.itemStyler != null || this.properties.link.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +ChordSeries.className = "ChordSeries"; +ChordSeries.type = "chord"; + +// packages/ag-charts-enterprise/src/series/chord/chordSeriesOptionsDef.ts +var import_ag_charts_community186 = require("ag-charts-community"); +var import_ag_charts_core81 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs8, chordSeriesThemeableOptionsDef } = import_ag_charts_community186._ModuleSupport; +var chordSeriesOptionsDef = { + ...chordSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs8, + type: (0, import_ag_charts_core81.required)((0, import_ag_charts_core81.constant)("chord")), + fromKey: (0, import_ag_charts_core81.required)(import_ag_charts_core81.string), + toKey: (0, import_ag_charts_core81.required)(import_ag_charts_core81.string), + sizeKey: import_ag_charts_core81.string, + sizeName: import_ag_charts_core81.string +}; +chordSeriesOptionsDef.fillGradientDefaults = (0, import_ag_charts_core81.undocumented)(import_ag_charts_core81.fillGradientDefaults); +chordSeriesOptionsDef.fillPatternDefaults = (0, import_ag_charts_core81.undocumented)(import_ag_charts_core81.fillPatternDefaults); +chordSeriesOptionsDef.fillImageDefaults = (0, import_ag_charts_core81.undocumented)(import_ag_charts_core81.fillImageDefaults); + +// packages/ag-charts-enterprise/src/series/chord/chordModule.ts +var ChordModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + solo: true, + identifier: "chord", + moduleFactory: (ctx) => new ChordSeries(ctx), + themeTemplate: { + series: { + fills: { $palette: "fills" }, + strokes: { $palette: "strokes" }, + // @ts-expect-error undocumented option + fillGradientDefaults: import_ag_charts_community187._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS, + fillPatternDefaults: import_ag_charts_community187._ModuleSupport.FILL_PATTERN_DEFAULTS, + fillImageDefaults: import_ag_charts_community187._ModuleSupport.FILL_IMAGE_DEFAULTS, + highlightStyle: { + series: { + dimOpacity: 0.2 + } + }, + highlight: import_ag_charts_community187._ModuleSupport.singleSeriesHighlightStyle(), + label: { + ...import_ag_charts_community187._ModuleSupport.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 5, + maxWidth: 100 + }, + node: { + spacing: 8, + width: 10, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + link: { + fillOpacity: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + tension: 0.4 + } + }, + legend: { + enabled: false, + toggleSeries: false + } + } +}; +var ChordSeriesModule = { + type: "series", + name: "chord", + chartType: "standalone", + enterprise: true, + options: chordSeriesOptionsDef, + create: (ctx) => new ChordSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelThemes.ts +var import_ag_charts_community188 = require("ag-charts-community"); +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE7, CARTESIAN_POSITION: CARTESIAN_POSITION5 }, + ThemeSymbols: { DEFAULT_SHADOW_COLOUR } +} = import_ag_charts_community188._ModuleSupport; +var isHorizontal = { $eq: [{ $path: ["/series/0/direction", void 0] }, "horizontal"] }; +var labelOptions = { + autoRotate: { $path: "/series/0/stageLabel/autoRotate" }, + autoRotateAngle: { $path: "/series/0/stageLabel/autoRotateAngle" }, + avoidCollisions: { $path: ["/series/0/stageLabel/avoidCollisions", true] }, + border: { $path: ["/series/0/stageLabel/border"] }, + color: { $path: ["/series/0/stageLabel/color", { $ref: "textColor" }] }, + cornerRadius: { $path: ["/series/0/stageLabel/cornerRadius"] }, + enabled: { + $if: [ + { $eq: [{ $path: "/series/0/stageLabel/enabled" }, void 0] }, + true, + { $path: "/series/0/stageLabel/enabled" } + ] + }, + fill: { $path: ["/series/0/stageLabel/fill"] }, + fillOpacity: { $path: ["/series/0/stageLabel/fillOpacity"] }, + fontSize: { $path: ["/series/0/stageLabel/fontSize", { $ref: "fontSize" }] }, + fontStyle: { $path: ["/series/0/stageLabel/fontStyle", { $ref: "fontStyle" }] }, + fontWeight: { $path: ["/series/0/stageLabel/fontWeight", { $ref: "fontWeight" }] }, + format: { $path: "/series/0/stageLabel/format" }, + formatter: { $path: "/series/0/stageLabel/formatter" }, + itemStyler: { $path: "/series/0/stageLabel/itemStyler" }, + minSpacing: { $path: "/series/0/stageLabel/minSpacing" }, + padding: { $path: ["/series/0/stageLabel/padding"] }, + rotation: { $path: ["/series/0/stageLabel/rotation", 0] } +}; +var FUNNEL_SERIES_AXES = [ + { + type: { + $if: [isHorizontal, CARTESIAN_AXIS_TYPE7.NUMBER, CARTESIAN_AXIS_TYPE7.CATEGORY] + }, + position: { + $if: [ + isHorizontal, + CARTESIAN_POSITION5.LEFT, + { + $if: [ + { $eq: [{ $path: ["/series/0/stageLabel/placement", void 0] }, "after"] }, + CARTESIAN_POSITION5.RIGHT, + CARTESIAN_POSITION5.LEFT + ] + } + ] + }, + label: { + $if: [isHorizontal, void 0, labelOptions] + } + }, + { + type: { + $if: [isHorizontal, CARTESIAN_AXIS_TYPE7.CATEGORY, CARTESIAN_AXIS_TYPE7.NUMBER] + }, + position: { + $if: [ + isHorizontal, + { + $if: [ + { $eq: [{ $path: ["/series/0/stageLabel/placement", void 0] }, "before"] }, + CARTESIAN_POSITION5.TOP, + CARTESIAN_POSITION5.BOTTOM + ] + }, + CARTESIAN_POSITION5.BOTTOM + ] + }, + label: { + $if: [isHorizontal, labelOptions, void 0] + } + } +]; +var FUNNEL_SERIES_THEME = { + series: { + direction: "vertical", + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + spacingRatio: 0.25, + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + [{ $path: ["/0", void 0, { $palette: "fills" }] }], + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", import_ag_charts_community188._ModuleSupport.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS], + ["pattern", import_ag_charts_community188._ModuleSupport.FILL_PATTERN_SINGLE_DEFAULTS], + ["image", import_ag_charts_community188._ModuleSupport.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + [{ $path: ["/0", void 0, { $palette: "strokes" }] }] + ] + }, + label: { + ...import_ag_charts_community188._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + dropOff: { + enabled: true, + fillOpacity: 0.2, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + highlight: import_ag_charts_community188._ModuleSupport.singleSeriesHighlightStyle() + }, + axes: { + [CARTESIAN_AXIS_TYPE7.NUMBER]: { + nice: false, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false + }, + label: { + enabled: false + } + }, + [CARTESIAN_AXIS_TYPE7.CATEGORY]: { + line: { + enabled: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeries.ts +var import_ag_charts_community193 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/funnel/baseFunnelSeries.ts +var import_ag_charts_community191 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/funnel/funnelConnector.ts +var import_ag_charts_community189 = require("ag-charts-community"); +var { lineDistanceSquared, BBox: BBox17, Path: Path10, SceneChangeDetection: SceneChangeDetection8 } = import_ag_charts_community189._ModuleSupport; +var delta = 1e-6; +function pointsEq([ax, ay], [bx, by]) { + return Math.abs(ax - bx) <= delta && Math.abs(ay - by) <= delta; +} +var FunnelConnector = class extends Path10 { + constructor() { + super(...arguments); + this.x0 = 0; + this.y0 = 0; + this.x1 = 0; + this.y1 = 0; + this.x2 = 0; + this.y2 = 0; + this.x3 = 0; + this.y3 = 0; + } + get midPoint() { + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + return { + x: (x0 + x1 + x2 + x3) / 4, + y: (y0 + y1 + y2 + y3) / 4 + }; + } + distanceSquared(x, y) { + if (this.containsPoint(x, y)) + return 0; + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + return Math.min( + lineDistanceSquared(x, y, x0, y0, x1, y1, Infinity), + lineDistanceSquared(x, y, x1, y1, x2, y2, Infinity), + lineDistanceSquared(x, y, x2, y2, x3, y3, Infinity), + lineDistanceSquared(x, y, x3, y3, x0, y0, Infinity) + ); + } + computeBBox() { + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + const x = Math.min(x0, x1, x2, x3); + const width = Math.max(x0, x1, x2, x3) - x; + const y = Math.min(y0, y1, y2, y3); + const height = Math.max(y0, y1, y2, y3) - y; + return new BBox17(x, y, width, height); + } + updatePath() { + const { path, x0, y0, x1, y1, x2, y2, x3, y3 } = this; + const points = [ + [x0, y0], + [x1, y1], + [x2, y2], + [x3, y3] + ]; + path.clear(); + let start; + let current; + for (const p of points) { + if (start != null && pointsEq(start, p) || current != null && pointsEq(current, p)) { + continue; + } + const [x, y] = p; + if (start == null) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + start ?? (start = p); + current = p; + } + path.closePath(); + } +}; +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x0", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y0", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x1", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y1", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x2", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y2", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x3", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y3", 2); + +// packages/ag-charts-enterprise/src/series/funnel/funnelUtil.ts +var import_ag_charts_community190 = require("ag-charts-community"); +var { NODE_UPDATE_STATE_TO_PHASE_MAPPING } = import_ag_charts_community190._ModuleSupport; +function connectorStartingPosition(datum, _prevDatum, isVertical, _mode) { + const { x0, y0, x1, y1, x2, y2, x3, y3, opacity } = datum; + if (isVertical) { + return { + x0: (x0 + x3) / 2, + y0: (y0 + y3) / 2, + x1: (x1 + x2) / 2, + y1: (y1 + y2) / 2, + x2: (x1 + x2) / 2, + y2: (y1 + y2) / 2, + x3: (x0 + x3) / 2, + y3: (y0 + y3) / 2, + opacity + }; + } else { + return { + x0: (x0 + x1) / 2, + y0: (y0 + y1) / 2, + x1: (x0 + x1) / 2, + y1: (y0 + y1) / 2, + x2: (x2 + x3) / 2, + y2: (y2 + y3) / 2, + x3: (x2 + x3) / 2, + y3: (y2 + y3) / 2, + opacity + }; + } +} +function prepareConnectorAnimationFunctions(isVertical, mode) { + const isRemoved = (datum) => datum == null; + const fromFn = (connector, datum, status) => { + if (status === "updated" && isRemoved(datum)) { + status = "removed"; + } else if (status === "updated" && isRemoved(connector.previousDatum)) { + status = "added"; + } + let source; + if (status === "added" && connector.previousDatum == null && mode === "fade") { + source = { ...resetConnectorSelectionsFn(connector, datum), opacity: 0 }; + } else if (status === "unknown" || status === "added") { + source = connectorStartingPosition(datum, connector.previousDatum, isVertical, mode); + } else { + source = { + x0: connector.x0, + y0: connector.y0, + x1: connector.x1, + y1: connector.y1, + x2: connector.x2, + y2: connector.y2, + x3: connector.x3, + y3: connector.y3, + opacity: connector.opacity + }; + } + const phase = NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { ...source, phase }; + }; + const toFn = (connector, datum, status) => { + let source; + if (status === "removed" && connector.datum == null && mode === "fade") { + source = { ...resetConnectorSelectionsFn(connector, datum), opacity: 0 }; + } else if (status === "removed" || isRemoved(datum)) { + source = connectorStartingPosition(datum, connector.previousDatum, isVertical, mode); + } else { + source = resetConnectorSelectionsFn(connector, datum); + } + return source; + }; + return { fromFn, toFn }; +} +function resetConnectorSelectionsFn(_node, datum) { + const { x0, y0, x1, y1, x2, y2, x3, y3, opacity } = datum; + return { x0, y0, x1, y1, x2, y2, x3, y3, opacity }; +} + +// packages/ag-charts-enterprise/src/series/funnel/baseFunnelSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode7, + SeriesZIndexMap, + valueProperty: valueProperty11, + keyProperty: keyProperty8, + ChartAxisDirection: ChartAxisDirection25, + updateLabelNode: updateLabelNode5, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL4, + LARGEST_KEY_INTERVAL: LARGEST_KEY_INTERVAL2, + diff: diff5, + fixNumericExtent: fixNumericExtent7, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation4, + resetMotion: resetMotion2, + resetLabelFn: resetLabelFn4, + animationValidation: animationValidation6, + computeBarFocusBounds: computeBarFocusBounds6, + ContinuousScale: ContinuousScale7, + Group: Group10, + Selection: Selection6, + PointerEvents: PointerEvents4, + motion: motion4, + checkCrisp: checkCrisp3, + createDatumId: createDatumId7, + applyShapeStyle: applyShapeStyle8 +} = import_ag_charts_community191._ModuleSupport; +var FunnelSeriesNodeEvent = class extends import_ag_charts_community191._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.stageKey; + this.yKey = series.properties.valueKey; + } +}; +var BaseFunnelSeries = class extends import_ag_charts_community191._ModuleSupport.AbstractBarSeries { + constructor({ + moduleCtx, + animationResetFns + }) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode7.AXIS_ALIGNED, SeriesNodePickMode7.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["stageKey"], + y: ["valueKey"] + }, + propertyNames: { + x: [], + y: [] + }, + categoryKey: "xValue", + datumSelectionGarbageCollection: false, + animationResetFns: { + datum: animationResetFns.datum, + label: resetLabelFn4 + } + }); + // @ts-expect-error xKey/yKey renamed + this.NodeEvent = FunnelSeriesNodeEvent; + this.connectorNodeGroup = this.contentGroup.appendChild( + new Group10({ + name: `${this.id}-series-connectorNodes`, + zIndex: SeriesZIndexMap.BACKGROUND + }) + ); + this.connectorSelection = Selection6.select( + this.connectorNodeGroup, + () => this.connectionFactory() + ); + this.connectorNodeGroup.pointerEvents = PointerEvents4.None; + } + get pickModeAxis() { + return "main-category"; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.connectorNodeGroup.zIndex = [SeriesZIndexMap.BACKGROUND, zIndex]; + return true; + } + isVertical() { + return !super.isVertical(); + } + connectionFactory() { + return new FunnelConnector(); + } + async processData(dataController) { + const { stageKey, valueKey } = this.properties; + const { visible, id: seriesId } = this; + const validation = (_value, _datum, index) => visible && this.ctx.legendManager.getItemEnabled({ seriesId, itemId: index }); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + if (this.processedData) { + extraProps.push(diff5(this.id, this.processedData)); + } + extraProps.push(animationValidation6()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const { processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty8(stageKey, xScaleType, { id: "xValue" }), + valueProperty11(valueKey, yScaleType, { id: `yValue`, ...visibleProps, validation, invalidValue: 0 }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL4, LARGEST_KEY_INTERVAL2] : [], + ...extraProps + ], + groupByKeys: false + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { + processedData, + dataModel, + id: seriesId, + ctx: { legendManager } + } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys] + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + if (!this.hasData) + return []; + return keys.filter((_key, index) => legendManager.getItemEnabled({ seriesId, itemId: index })); + } + return this.padBandExtent(keys); + } else { + const yExtent = this.domainForClippedRange(direction, ["yValue"], "xValue"); + const maxExtent = Math.max(...yExtent); + const fixedYExtent = [-maxExtent, maxExtent]; + return fixNumericExtent7(fixedYExtent); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { + hasData, + data, + dataModel, + groupScale, + processedData, + id: seriesId, + ctx: { legendManager } + } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(hasData && data && xAxis && yAxis && dataModel && processedData?.type === "ungrouped")) { + return; + } + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection25.X; + const { stageKey, valueKey } = this.properties; + const itemId = `${valueKey}`; + const context = { + itemId, + nodeData: [], + labelData: [], + connectorData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible + }; + const isVisible = this.visible; + if (!isVisible) + return context; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale7.is(xScale) ? barWidth * -0.5 : 0; + const crisp = checkCrisp3( + xAxis?.scale, + xAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + let previousConnection; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const visible = isVisible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + const xDatum = xValues[datumIndex]; + if (xDatum == null) + continue; + const x = Math.round(xScale.convert(xDatum)) + groupScale.convert(String(groupIndex)) + barOffset; + const yDatum = yValues[datumIndex]; + const yNegative = Math.round(yScale.convert(-yDatum)); + const yPositive = Math.round(yScale.convert(yDatum)); + const style = this.getItemStyle({ datum, datumIndex }, false); + const barHeight = Math.max(style.strokeWidth ?? 0, Math.abs(yPositive - yNegative)); + const rect = { + x: barAlongX ? Math.min(yPositive, yNegative) : x, + y: barAlongX ? x : Math.min(yPositive, yNegative), + width: barAlongX ? barHeight : barWidth, + height: barAlongX ? barWidth : barHeight + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const labelData = this.createLabelData({ + datumIndex, + rect, + barAlongX, + yDatum, + datum, + visible + }); + const nodeDatum = { + index: datumIndex, + series: this, + itemId, + datum, + datumIndex, + xValue: xDatum, + yValue: yDatum, + xKey: stageKey, + yKey: valueKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + label: labelData, + visible + }; + context.nodeData.push(nodeDatum); + if (labelData != null) { + context.labelData.push(labelData); + } + if (previousConnection != null) { + const prevRect = previousConnection.rect; + const startNodeDatum = previousConnection.nodeDatum; + const startDatumIndex = previousConnection.datumIndex; + if (barAlongX) { + context.connectorData.push({ + datum: startNodeDatum, + datumIndex: startDatumIndex, + x0: prevRect.x, + y0: prevRect.y + prevRect.height, + x1: prevRect.x + prevRect.width, + y1: prevRect.y + prevRect.height, + x2: rect.x + rect.width, + y2: rect.y, + x3: rect.x, + y3: rect.y, + opacity: 1 + }); + } else { + context.connectorData.push({ + datum: startNodeDatum, + datumIndex: startDatumIndex, + x0: prevRect.x + prevRect.width, + y0: prevRect.y, + x1: rect.x, + y1: rect.y, + x2: rect.x, + y2: rect.y + rect.height, + x3: prevRect.x + prevRect.width, + y3: prevRect.y + prevRect.height, + opacity: 1 + }); + } + } + if (visible) { + previousConnection = { + itemId, + rect, + nodeDatum, + datumIndex + }; + } + } + return context; + } + updateNodes(seriesHighlighted, nodeRefresh) { + super.updateNodes(seriesHighlighted, nodeRefresh); + const { connectorSelection } = this; + const connectorData = this.contextNodeData?.connectorData ?? []; + this.connectorSelection = this.updateConnectorSelection({ connectorSelection, connectorData }); + this.updateConnectorNodes({ connectorSelection }); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data, void 0, (datum) => this.getDatumId(datum)); + } + updateConnectorSelection(opts) { + const { connectorData, connectorSelection } = opts; + return connectorSelection.update( + this.connectorEnabled() ? connectorData : [], + void 0, + (connector) => this.getDatumId(connector.datum) + ); + } + updateConnectorNodes(opts) { + const fillBBox = this.getShapeFillBBox(); + opts.connectorSelection.each((connector, datum) => { + const { fill, fillOpacity, stroke: stroke2, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.connectorStyle(datum.datumIndex); + connector.setProperties(resetConnectorSelectionsFn(connector, datum)); + applyShapeStyle8( + connector, + { + fill, + stroke: stroke2, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }, + fillBBox + ); + }); + } + updateLabelSelection(opts) { + const labelData = this.properties.label.enabled ? opts.labelData : []; + return opts.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = PointerEvents4.None; + }); + } + updateLabelNodes(opts) { + const params = { + stageKey: this.properties.stageKey, + valueKey: this.properties.valueKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + updateLabelNode5(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { stageKey, valueKey, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, "xValue", processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(datumIndex), + data: [ + { + label: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, stageKey, legendItemName), + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, valueKey, legendItemName) + } + ] + }, + { seriesId, datum, title: stageKey, stageKey, valueKey, ...this.tooltipStyle(datum, datumIndex) } + ); + } + resetAllAnimation(data) { + super.resetAllAnimation(data); + resetMotion2([this.connectorSelection], resetConnectorSelectionsFn); + } + animateEmptyUpdateReady({ labelSelection }) { + const { connectorSelection } = this; + const isVertical = this.isVertical(); + const mode = "normal"; + const connectorFns = prepareConnectorAnimationFunctions(isVertical, mode); + motion4.fromToMotion(this.id, "connectors", this.ctx.animationManager, [connectorSelection], connectorFns); + seriesLabelFadeInAnimation4(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const { labelSelection: labelSelections } = data; + this.ctx.animationManager.stopByAnimationGroupId(this.id); + seriesLabelFadeInAnimation4(this, "labels", this.ctx.animationManager, labelSelections); + } + getDatumId(datum) { + return createDatumId7(datum.xValue); + } + isLabelEnabled() { + return this.properties.label.enabled; + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds6(this, this.contextNodeData?.nodeData[datumIndex]); + } + legendItemSymbol(datumIndex) { + const { strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset, fill, stroke: stroke2 } = this.properties.getStyle(datumIndex); + return { + marker: { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id: seriesId, + processedData, + dataModel, + ctx: { legendManager }, + visible + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { showInLegend } = this.properties; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + return (processedData.dataSources.get(this.id)?.data ?? []).map((datum, datumIndex) => { + const stageValue = xValues[datumIndex]; + if (stageValue == null) + return; + return { + legendType: "category", + id: seriesId, + datum, + itemId: datumIndex, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { text: String(stageValue) }, + symbol: this.legendItemSymbol(datumIndex), + skipAnimations: true, + hideInLegend: !showInLegend + }; + }).filter((datum) => datum != null); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelProperties.ts +var import_ag_charts_community192 = require("ag-charts-community"); +var { Label: Label7, AbstractBarSeriesProperties: AbstractBarSeriesProperties5, makeSeriesTooltip: makeSeriesTooltip9, AxisLabel: AxisLabel3, Property: Property66 } = import_ag_charts_community192._ModuleSupport; +var ConeFunnelSeriesLabel = class extends Label7 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property66 +], ConeFunnelSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property66 +], ConeFunnelSeriesLabel.prototype, "spacing", 2); +var ConeFunnelSeriesStageLabel = class extends AxisLabel3 { +}; +__decorateClass([ + Property66 +], ConeFunnelSeriesStageLabel.prototype, "placement", 2); +var ConeFunnelProperties = class extends AbstractBarSeriesProperties5 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new ConeFunnelSeriesLabel(); + this.stageLabel = new ConeFunnelSeriesStageLabel(); + this.tooltip = makeSeriesTooltip9(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index], + fillOpacity, + stroke: strokes[index], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "stageKey", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "valueKey", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "fills", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "strokes", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "lineDash", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "label", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelUtil.ts +function resetLineSelectionsFn(_node, { x, y, width, height, opacity }) { + return { x1: x, y1: y, x2: x + width, y2: y + height, opacity: opacity ?? 1 }; +} + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeries.ts +var { Line: Line5, ChartAxisDirection: ChartAxisDirection26 } = import_ag_charts_community193._ModuleSupport; +var ConeFunnelSeries = class extends BaseFunnelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + animationResetFns: { + datum: resetLineSelectionsFn + } + }); + this.properties = new ConeFunnelProperties(); + } + get hasData() { + const { + id: seriesId, + ctx: { legendManager } + } = this; + const visibleItems = this.data?.data.reduce( + (accum, _, datumIndex) => accum + (legendManager.getItemEnabled({ seriesId, itemId: datumIndex }) ? 1 : 0), + 0 + ); + return visibleItems != null && visibleItems > 1; + } + getBandScalePadding() { + return { inner: 1, outer: 0 }; + } + connectorEnabled() { + return true; + } + getItemStyle({ datumIndex }, _isHighlight) { + return this.properties.getStyle(datumIndex); + } + connectorStyle(index) { + return this.properties.getStyle(index); + } + nodeFactory() { + return new Line5(); + } + createLabelData({ + datumIndex, + rect, + barAlongX, + yDatum, + datum, + visible + }) { + const { stageKey, valueKey, label } = this.properties; + const { spacing, placement } = label; + if (!label.enabled) + return; + let x; + let y; + let textAlign; + let textBaseline; + if (barAlongX) { + x = rect.x + rect.width / 2; + textAlign = "center"; + switch (placement) { + case "before": + y = rect.y - spacing; + textBaseline = "bottom"; + break; + case "after": + y = rect.y + rect.height + spacing; + textBaseline = "top"; + break; + default: + y = rect.y + rect.height / 2; + textBaseline = "middle"; + } + } else { + y = rect.y + rect.height / 2; + textBaseline = "middle"; + switch (placement) { + case "before": + x = rect.x - spacing; + textAlign = "right"; + break; + case "after": + x = rect.x + rect.width + spacing; + textAlign = "left"; + break; + default: + x = rect.x + rect.width / 2; + textAlign = "center"; + } + } + const yDomain = this.getSeriesDomain(ChartAxisDirection26.Y); + const text2 = this.getLabelText( + yDatum, + datum, + valueKey, + "y", + yDomain, + label, + { itemId: valueKey, value: yDatum, datum, stageKey, valueKey } + ); + return { + x, + y, + textAlign, + textBaseline, + text: text2, + itemId: valueKey, + datum, + datumIndex, + series: this, + visible + }; + } + updateDatumNodes(opts) { + const highlightStyle = this.getHighlightStyle(opts.isHighlight); + opts.datumSelection.each((line, datum) => { + line.setProperties(resetLineSelectionsFn(line, datum)); + line.stroke = highlightStyle?.stroke; + line.strokeWidth = highlightStyle?.strokeWidth ?? 0; + line.strokeOpacity = highlightStyle?.strokeOpacity ?? 1; + line.lineDash = highlightStyle?.lineDash; + line.lineDashOffset = highlightStyle?.lineDashOffset ?? 0; + line.opacity = highlightStyle?.opacity ?? 1; + }); + } + tooltipStyle(_datum, datumIndex) { + const { fill, stroke: stroke2, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties.getStyle(datumIndex); + return { + fill, + fillOpacity, + stroke: stroke2, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +ConeFunnelSeries.className = "ConeFunnelSeries"; +ConeFunnelSeries.type = "cone-funnel"; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeriesOptionsDef.ts +var import_ag_charts_community194 = require("ag-charts-community"); +var import_ag_charts_core82 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs9, coneFunnelSeriesThemeableOptionsDef, without: without3 } = import_ag_charts_community194._ModuleSupport; +var coneFunnelSeriesOptionsDef = { + ...without3(commonSeriesOptionsDefs9, ["showInLegend"]), + ...coneFunnelSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core82.required)((0, import_ag_charts_core82.constant)("cone-funnel")), + stageKey: (0, import_ag_charts_core82.required)(import_ag_charts_core82.string), + valueKey: (0, import_ag_charts_core82.required)(import_ag_charts_core82.string) +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelThemes.ts +var import_ag_charts_community195 = require("ag-charts-community"); +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE8 } +} = import_ag_charts_community195._ModuleSupport; +var CONE_FUNNEL_SERIES_THEME = { + series: { + direction: "vertical", + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "secondSequentialColors" }, + import_ag_charts_community195._ModuleSupport.SAFE_RANGE2_OPERATION + ] + }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", import_ag_charts_community195._ModuleSupport.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS], + ["pattern", import_ag_charts_community195._ModuleSupport.FILL_PATTERN_SINGLE_DEFAULTS], + ["image", import_ag_charts_community195._ModuleSupport.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "secondSequentialColors" }, + import_ag_charts_community195._ModuleSupport.SAFE_RANGE2_OPERATION + ] + } + ] + }, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + label: { + ...import_ag_charts_community195._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + placement: "before", + spacing: 4 + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: import_ag_charts_community195._ModuleSupport.singleSeriesHighlightStyle(false) + }, + seriesArea: { + padding: { + top: 20, + bottom: 20 + } + }, + axes: { + [CARTESIAN_AXIS_TYPE8.NUMBER]: { + nice: false, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false + }, + label: { + enabled: false + } + }, + [CARTESIAN_AXIS_TYPE8.CATEGORY]: { + line: { + enabled: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelModule.ts +var ConeFunnelModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "cone-funnel", + moduleFactory: (ctx) => new ConeFunnelSeries(ctx), + solo: true, + defaultAxes: FUNNEL_SERIES_AXES, + themeTemplate: CONE_FUNNEL_SERIES_THEME +}; +var ConeFunnelSeriesModule = { + type: "series", + name: "cone-funnel", + chartType: "cartesian", + enterprise: true, + options: coneFunnelSeriesOptionsDef, + create: (ctx) => new ConeFunnelSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeries.ts +var import_ag_charts_community197 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/funnel/funnelProperties.ts +var import_ag_charts_community196 = require("ag-charts-community"); +var { Label: Label8, DropShadow: DropShadow4, AbstractBarSeriesProperties: AbstractBarSeriesProperties6, BaseProperties: BaseProperties25, makeSeriesTooltip: makeSeriesTooltip10, AxisLabel: AxisLabel4, Property: Property67 } = import_ag_charts_community196._ModuleSupport; +var FunnelSeriesLabel = class extends Label8 { +}; +var FunnelSeriesStageLabel = class extends AxisLabel4 { +}; +__decorateClass([ + Property67 +], FunnelSeriesStageLabel.prototype, "placement", 2); +var FunnelDropOff = class extends BaseProperties25 { + constructor() { + super(...arguments); + this.enabled = true; + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle() { + const { fill, stroke: stroke2, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "enabled", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "fill", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "fillOpacity", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "stroke", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "strokeWidth", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "strokeOpacity", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "lineDash", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "lineDashOffset", 2); +var FunnelProperties = class extends AbstractBarSeriesProperties6 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.spacingRatio = 0; + this.dropOff = new FunnelDropOff(); + this.shadow = new DropShadow4().set({ enabled: false }); + this.label = new FunnelSeriesLabel(); + this.stageLabel = new FunnelSeriesStageLabel(); + this.tooltip = makeSeriesTooltip10(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index], + fillOpacity, + stroke: strokes[index], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property67 +], FunnelProperties.prototype, "stageKey", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "valueKey", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "fills", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "strokes", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "lineDash", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "spacingRatio", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "dropOff", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "shadow", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "label", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeries.ts +var { + ChartAxisDirection: ChartAxisDirection27, + resetBarSelectionsFn: resetBarSelectionsFn3, + prepareBarAnimationFunctions: prepareBarAnimationFunctions3, + midpointStartingBarPosition: midpointStartingBarPosition2, + createDatumId: createDatumId8, + Rect: Rect6, + motion: motion5, + applyShapeStyle: applyShapeStyle9, + mergeDefaults: mergeDefaults11 +} = import_ag_charts_community197._ModuleSupport; +var FunnelSeries = class extends BaseFunnelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + animationResetFns: { + datum: resetBarSelectionsFn3 + } + }); + this.properties = new FunnelProperties(); + } + getBandScalePadding() { + return { inner: this.properties.spacingRatio, outer: 0 }; + } + connectorEnabled() { + return this.properties.dropOff.enabled; + } + connectorStyle(index) { + return mergeDefaults11(this.properties.dropOff.getStyle(), this.properties.getStyle(index)); + } + nodeFactory() { + return new Rect6(); + } + createLabelData({ + datumIndex, + rect, + yDatum, + datum, + visible + }) { + const { valueKey, stageKey, label } = this.properties; + if (!label.enabled) + return; + const yDomain = this.getSeriesDomain(ChartAxisDirection27.Y); + const text2 = this.getLabelText( + yDatum, + datum, + valueKey, + "y", + yDomain, + label, + { itemId: valueKey, value: yDatum, datum, stageKey, valueKey } + ); + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2, + textAlign: "center", + textBaseline: "middle", + text: text2, + itemId: stageKey, + datum, + datumIndex, + series: this, + visible + }; + } + getItemStyle({ datum, datumIndex }, isHighlight) { + const { id: seriesId, properties } = this; + const { stageKey, valueKey, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults11(highlightStyle, properties.getStyle(datumIndex)); + let style = baseStyle; + if (itemStyler != null) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const overrides = this.cachedDatumCallback( + createDatumId8(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState: highlightStateString, + stageKey, + valueKey, + ...style + }); + } + ); + if (overrides) { + style = mergeDefaults11(overrides, style); + } + } + return style; + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { shadow } = this.properties; + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection27.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = this.getItemStyle(datum, isHighlight); + applyShapeStyle9(rect, style, fillBBox); + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + rect.fillShadow = shadow; + }); + } + tooltipStyle(datum, datumIndex) { + return this.getItemStyle({ datum, datumIndex }, false); + } + animateEmptyUpdateReady(params) { + super.animateEmptyUpdateReady(params); + const { datumSelection } = params; + const isVertical = this.isVertical(); + const mode = "normal"; + const barFns = prepareBarAnimationFunctions3(midpointStartingBarPosition2(isVertical, mode), "unknown"); + motion5.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], barFns); + } + animateWaitingUpdateReady(data) { + super.animateWaitingUpdateReady(data); + const { datumSelection: datumSelections } = data; + const { processedData } = this; + const dataDiff = processedData?.reduced?.diff?.[this.id]; + const fns = prepareBarAnimationFunctions3(midpointStartingBarPosition2(this.isVertical(), "fade"), "added"); + motion5.fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [datumSelections], + fns, + (_, datum) => datum.xValue, + dataDiff + ); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +FunnelSeries.className = "FunnelSeries"; +FunnelSeries.type = "funnel"; + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeriesOptionsDef.ts +var import_ag_charts_community198 = require("ag-charts-community"); +var import_ag_charts_core83 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs10, funnelSeriesThemeableOptionsDef, without: without4 } = import_ag_charts_community198._ModuleSupport; +var funnelSeriesOptionsDef = { + ...funnelSeriesThemeableOptionsDef, + ...without4(commonSeriesOptionsDefs10, ["showInLegend"]), + type: (0, import_ag_charts_core83.required)((0, import_ag_charts_core83.constant)("funnel")), + stageKey: (0, import_ag_charts_core83.required)(import_ag_charts_core83.string), + valueKey: (0, import_ag_charts_core83.required)(import_ag_charts_core83.string) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelModule.ts +var FunnelModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "funnel", + moduleFactory: (ctx) => new FunnelSeries(ctx), + solo: true, + defaultAxes: FUNNEL_SERIES_AXES, + themeTemplate: FUNNEL_SERIES_THEME +}; +var FunnelSeriesModule = { + type: "series", + name: "funnel", + chartType: "cartesian", + enterprise: true, + options: funnelSeriesOptionsDef, + create: (ctx) => new FunnelSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeModule.ts +var import_ag_charts_community203 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeries.ts +var import_ag_charts_community202 = require("ag-charts-community"); +var import_ag_charts_core88 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/gauge-util/datumUnion.ts +var DatumUnion = class { + *[Symbol.iterator]() { + const { node, datum } = this; + if (node && datum) + yield { node, datum }; + } + nodes() { + return this.node ? [this.node] : []; + } + update(datumSelection, group, ctor, nodeUpdater) { + const nodes = datumSelection.nodes(); + if (nodes.length === 0) { + this.node?.remove(); + this.node = void 0; + } else { + if (this.node === void 0) { + this.node = new ctor(); + this.node.fillOpacity = 0; + this.node.strokeOpacity = 0; + group.appendChild(this.node); + } + const first = nodes[0]; + const last = nodes.toReversed().find((n) => n.datum.datum.value > n.datum.datum.segmentStart) ?? nodes.at(-1); + this.node.datum = this.datum = first.datum; + nodeUpdater(this.node, first, last); + } + } +}; + +// packages/ag-charts-enterprise/src/series/gauge-util/label.ts +var import_ag_charts_core84 = require("ag-charts-core"); +var fadeInFns = { + fromFn: () => ({ opacity: 0, phase: "initial" }), + toFn: () => ({ opacity: 1 }) +}; +function formatLabel(value, scale) { + if (value == null) + return ""; + const { min, max } = scale; + const minLog10 = min === 0 ? 0 : Math.ceil(Math.log10(Math.abs(min))); + const maxLog10 = max === 0 ? 0 : Math.ceil(Math.log10(Math.abs(max))); + const dp = Math.max(2 - Math.max(minLog10, maxLog10), 0); + return value.toFixed(dp); +} +function getLabelText(seriesId, ctx, datum, valueOverride) { + if (datum.text != null) + return datum.text; + const value = valueOverride ?? datum.value; + let labelFormat; + if (datum?.formatter != null) { + labelFormat = formatWithContext(ctx, datum.formatter, { seriesId, datum: void 0, value }); + } + return labelFormat == null || (0, import_ag_charts_core84.isArray)(labelFormat) ? labelFormat : String(labelFormat); +} + +// packages/ag-charts-enterprise/src/series/gauge-util/lineMarker.ts +function lineMarker({ path, x, y, size }) { + path.moveTo(x, y - size / 2); + path.lineTo(x, y + size / 2); +} + +// packages/ag-charts-enterprise/src/series/gauge-util/pick.ts +var import_ag_charts_core85 = require("ag-charts-core"); +function pickGaugeNearestDatum(self, point) { + const it = (0, import_ag_charts_core85.iterate)(self.datumUnion.nodes(), self.targetSelection.nodes()); + return self.pickNodeNearestDistantObject(point, it); +} +function pickGaugeFocus(self, opts) { + const others = [ + { data: self.contextNodeData?.nodeData, selection: self.datumUnion }, + { data: self.contextNodeData?.targetData, selection: self.targetSelection } + ].filter((v) => v.data && v.data.length > 0); + const otherIndex = (0, import_ag_charts_core85.clamp)(0, opts.otherIndex + opts.otherIndexDelta, others.length - 1); + if (others.length === 0) + return; + const { data, selection } = others[otherIndex]; + if (data == null || data.length === 0) + return; + const datumIndex = (0, import_ag_charts_core85.clamp)(0, opts.datumIndex, data.length - 1); + const datum = data[datumIndex]; + for (const node of selection) { + if (node.datum === datum) { + const bounds = node.node; + return { bounds, clipFocusBox: true, datum, datumIndex, otherIndex }; + } + } +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeriesProperties.ts +var import_ag_charts_community200 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/gauge-util/segmentation.ts +var import_ag_charts_community199 = require("ag-charts-community"); +var import_ag_charts_core86 = require("ag-charts-core"); +var { BaseProperties: BaseProperties26, Property: Property68 } = import_ag_charts_community199._ModuleSupport; +var GaugeSegmentationIntervalProperties = class extends BaseProperties26 { + getSegments(scale, maxTicks) { + const { values, step, count } = this; + const d0 = Math.min(...scale.domain); + const d1 = Math.max(...scale.domain); + let ticks; + if (values != null) { + const segments = values.filter((v) => v > d0 && v < d1).sort((a, b) => a - b); + ticks = [d0, ...segments, d1]; + } else if (step != null) { + const segments = []; + for (let i = d0; i < d1; i += step) { + segments.push(i); + } + segments.push(d1); + ticks = segments; + } else if (count == null) { + const segments = scale.ticks({ + nice: true, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.filter((v) => v > d0 && v < d1); + ticks = segments == null ? void 0 : [d0, ...segments, d1]; + } else { + const segments = count + 1; + ticks = Array.from({ length: segments + 1 }, (_, i) => i / segments * (d1 - d0) + d0); + } + if (ticks != null && ticks.length > maxTicks) { + import_ag_charts_core86.Logger.warnOnce( + `the configured segmentation results in more than 1 item per pixel, ignoring. Supply a segmentation configuration that results in larger segments or omit this configuration` + ); + ticks = void 0; + } + ticks ?? (ticks = [d0, d1]); + return ticks; + } +}; +__decorateClass([ + Property68 +], GaugeSegmentationIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property68 +], GaugeSegmentationIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property68 +], GaugeSegmentationIntervalProperties.prototype, "count", 2); +var GaugeSegmentationProperties = class extends BaseProperties26 { + constructor() { + super(...arguments); + this.enabled = false; + this.interval = new GaugeSegmentationIntervalProperties(); + this.spacing = 0; + } +}; +__decorateClass([ + Property68 +], GaugeSegmentationProperties.prototype, "enabled", 2); +__decorateClass([ + Property68 +], GaugeSegmentationProperties.prototype, "interval", 2); +__decorateClass([ + Property68 +], GaugeSegmentationProperties.prototype, "spacing", 2); + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeriesProperties.ts +var { + BaseProperties: BaseProperties27, + makeSeriesTooltip: makeSeriesTooltip11, + SeriesProperties: SeriesProperties2, + PropertiesArray: PropertiesArray7, + Property: Property69, + Label: Label9, + AxisLabel: AxisLabel5, + getColorStops +} = import_ag_charts_community200._ModuleSupport; +var LinearGaugeDefaultTargetLabelProperties = class extends Label9 { +}; +__decorateClass([ + Property69 +], LinearGaugeDefaultTargetLabelProperties.prototype, "spacing", 2); +var LinearGaugeTargetProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.value = 0; + this.label = new LinearGaugeDefaultTargetLabelProperties(); + } + getStyle(defaultTarget) { + const { + fill = defaultTarget.fill ?? "black", + fillOpacity = defaultTarget.fillOpacity ?? 1, + stroke: stroke2 = defaultTarget.stroke ?? "black", + strokeWidth = defaultTarget.strokeWidth ?? 0, + strokeOpacity = defaultTarget.strokeOpacity ?? 1, + lineDash = defaultTarget.lineDash ?? [0], + lineDashOffset = defaultTarget.lineDashOffset ?? 0 + } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "text", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "value", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "shape", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "placement", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "spacing", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "size", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "rotation", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "fill", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "stroke", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "lineDash", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "label", 2); +var LinearGaugeBarProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.enabled = true; + this.thicknessRatio = 1; + this.fills = new PropertiesArray7(import_ag_charts_community200._ModuleSupport.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(defaultColorRange, horizontal, scale) { + const { fill, fills, fillMode, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const barFill = fill ?? createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal); + return { + fill: barFill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "enabled", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "thickness", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "thicknessRatio", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "fills", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "fillMode", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "lineDashOffset", 2); +var LinearGaugeScaleIntervalProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.values = void 0; + this.step = void 0; + this.minSpacing = 0; + this.maxSpacing = 1e3; + } +}; +__decorateClass([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "maxSpacing", 2); +var LinearGaugeScaleLabelProperties = class extends AxisLabel5 { + constructor() { + super(...arguments); + this.placement = void 0; + } +}; +__decorateClass([ + Property69 +], LinearGaugeScaleLabelProperties.prototype, "placement", 2); +var LinearGaugeScaleProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.min = 0; + this.max = 1; + this.fills = new PropertiesArray7(import_ag_charts_community200._ModuleSupport.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.defaultFill = "black"; + this.interval = new LinearGaugeScaleIntervalProperties(); + this.label = new LinearGaugeScaleLabelProperties(); + } + getStyle(barEnabled, defaultColorRange, horizontal, scale) { + const { + fill, + fills, + defaultFill, + fillMode, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const scaleFill = fill ?? (barEnabled && fills.length === 0 ? defaultFill : void 0) ?? createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal); + return { + fill: scaleFill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "min", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "max", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "fills", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "fillMode", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "fill", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "stroke", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "defaultFill", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "interval", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "label", 2); +var LinearGaugeLabelProperties = class extends AutoSizedLabel { + constructor() { + super(...arguments); + this.placement = "inside-center"; + this.avoidCollisions = true; + } +}; +__decorateClass([ + Property69 +], LinearGaugeLabelProperties.prototype, "text", 2); +__decorateClass([ + Property69 +], LinearGaugeLabelProperties.prototype, "placement", 2); +__decorateClass([ + Property69 +], LinearGaugeLabelProperties.prototype, "avoidCollisions", 2); +var LinearGaugeSeriesProperties = class extends SeriesProperties2 { + constructor() { + super(...arguments); + this.value = 0; + this.segmentation = new GaugeSegmentationProperties(); + this.defaultColorRange = []; + this.targets = new PropertiesArray7(LinearGaugeTargetProperties); + this.defaultTarget = new LinearGaugeTargetProperties(); + this.defaultScale = new LinearGaugeScaleProperties(); + this.direction = "vertical"; + this.thickness = 1; + this.cornerRadius = 0; + this.cornerMode = "container"; + this.margin = 0; + this.scale = new LinearGaugeScaleProperties(); + this.bar = new LinearGaugeBarProperties(); + this.label = new LinearGaugeLabelProperties(); + this.tooltip = makeSeriesTooltip11(); + } +}; +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "value", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "segmentation", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "targets", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "defaultTarget", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "defaultScale", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "direction", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "thickness", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "cornerMode", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "margin", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "scale", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "bar", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "tooltip", 2); +function createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal) { + const colorStops = getColorStops(fills, defaultColorRange, scale.domain, fillMode); + return { + type: "gradient", + gradient: "linear", + colorSpace: "oklch", + colorStops, + rotation: horizontal ? 90 : 0, + bounds: "series" + }; +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeUtil.ts +var import_ag_charts_community201 = require("ag-charts-community"); +var import_ag_charts_core87 = require("ag-charts-core"); +var { BBox: BBox18 } = import_ag_charts_community201._ModuleSupport; +function datumRect(datum) { + const { x0, y0, x1, y1, horizontalInset, verticalInset } = datum; + const x = Math.min(x0, x1) + horizontalInset; + const y = Math.min(y0, y1) + verticalInset; + const width = Math.max(Math.abs(x1 - x0) - 2 * horizontalInset, 0); + const height = Math.max(Math.abs(y1 - y0) - 2 * verticalInset, 0); + return { x, y, width, height }; +} +function clipBBoxVisibility(datum, clipBBox) { + if (clipBBox == null) + return true; + const rect = datumRect(datum); + const delta3 = 1e-6; + const x0 = rect.x + delta3; + const y0 = rect.y + delta3; + const x1 = rect.x + rect.width - delta3; + const y1 = rect.y + rect.height - delta3; + const clipX0 = clipBBox.x; + const clipX1 = clipBBox.x + clipBBox.width; + const clipY0 = clipBBox.y; + const clipY1 = clipBBox.y + clipBBox.height; + return Math.max(x0, clipX0) <= Math.min(x1, clipX1) && Math.max(y0, clipY0) <= Math.min(y1, clipY1); +} +function hasClipBBox(datum) { + const { clipX0, clipX1, clipY0, clipY1 } = datum; + return clipX0 != null && clipX1 != null || clipY0 != null && clipY1 != null; +} +function computeClipBBox(datum) { + if (!hasClipBBox(datum)) + return; + const { x0, y0, x1, y1 } = datum; + const { x, y, width, height } = datumRect(datum); + let { clipX0, clipX1, clipY0, clipY1 } = datum; + if (clipX0 == null || clipX1 == null) { + clipX0 = x0; + clipX1 = x1; + } + if (clipY0 == null || clipY1 == null) { + clipY0 = y0; + clipY1 = y1; + } + const clipX = Math.min(clipX0, clipX1); + const clipY = Math.min(clipY0, clipY1); + const clipWidth = Math.abs(clipX1 - clipX0); + const clipHeight = Math.abs(clipY1 - clipY0); + clipX0 = Math.max(x, clipX); + clipY0 = Math.max(y, clipY); + clipX1 = Math.min(x + width, clipX + clipWidth); + clipY1 = Math.min(y + height, clipY + clipHeight); + return new BBox18( + Math.min(clipX0, clipX1), + Math.min(clipY0, clipY1), + Math.abs(clipX1 - clipX0), + Math.abs(clipY1 - clipY0) + ); +} +function prepareLinearGaugeSeriesAnimationFunctions(initialLoad, horizontal) { + const phase = initialLoad ? "initial" : "update"; + const node = { + fromFn(sect, datum) { + const previousDatum = sect.previousDatum; + let { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1 } = previousDatum ?? datum; + const { horizontalInset, verticalInset } = datum; + const previousHadClipBBox = previousDatum != null && hasClipBBox(previousDatum); + const nextHasClipBBox = hasClipBBox(datum); + if (previousHadClipBBox && nextHasClipBBox) { + } else if (!previousHadClipBBox && nextHasClipBBox) { + ({ x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1 } = datum); + if (initialLoad) { + if (horizontal) { + clipX1 = datum.clipX0; + } else { + clipY1 = datum.clipY0; + } + } + } else if (previousHadClipBBox && !nextHasClipBBox) { + ({ x0, y0, x1, y1 } = datum); + clipX0 = void 0; + clipY0 = void 0; + clipX1 = void 0; + clipY1 = void 0; + } else if (initialLoad) { + if (horizontal) { + x1 = x0; + } else { + y1 = y0; + } + } + return { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset, phase }; + }, + toFn(_sect, datum) { + const { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset } = datum; + return { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset }; + }, + applyFn(rect, params) { + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, params)); + } + }; + return { node }; +} +function resetLinearGaugeSeriesResetRectFunction(_node, datum) { + const { x, y, width, height } = datumRect(datum); + const clipBBox = computeClipBBox(datum); + const visible = clipBBoxVisibility(datum, clipBBox); + return { x, y, width, height, clipBBox, visible }; +} +var horizontalTextAligns = { + ["Before" /* Before */]: "right", + ["Center" /* Center */]: "center", + ["After" /* After */]: "left" +}; +var verticalTextBaselines = { + ["Before" /* Before */]: "top", + ["Center" /* Center */]: "middle", + ["After" /* After */]: "bottom" +}; +var horizontalAlignFactors = { + ["Before" /* Before */]: -1, + ["Center" /* Center */]: -0.5, + ["After" /* After */]: 0 +}; +var verticalAlignFactors2 = { + ["Before" /* Before */]: 0, + ["Center" /* Center */]: -0.5, + ["After" /* After */]: -1 +}; +function formatLinearGaugeLabels(series, ctx, selection, opts, bboxes, datumOverrides) { + const { seriesRect, gaugeRect, barRect } = bboxes; + const { padding, horizontal } = opts; + selection.each((label, labelDatum) => { + const labelText = getLabelText(series.id, ctx, labelDatum, datumOverrides?.label); + let boundingWidth; + let boundingHeight; + if (labelDatum.placement === "outside-start") { + if (horizontal) { + boundingWidth = gaugeRect.x; + boundingHeight = seriesRect.height; + } else { + boundingWidth = seriesRect.width; + boundingHeight = seriesRect.height - (gaugeRect.y + gaugeRect.height); + } + } else if (labelDatum.placement === "outside-end") { + if (horizontal) { + boundingWidth = seriesRect.width - (gaugeRect.x + gaugeRect.width); + boundingHeight = seriesRect.height; + } else { + boundingWidth = seriesRect.width; + boundingHeight = gaugeRect.y; + } + } else if (labelDatum.avoidCollisions) { + boundingWidth = gaugeRect.width; + boundingHeight = gaugeRect.height; + } + let layout; + if (labelText == null) { + return; + } else if (boundingWidth != null && boundingHeight != null) { + const sizeFittingHeight = () => ({ + width: boundingWidth, + height: boundingHeight, + meta: null + }); + const labelMeta = formatSingleLabel((0, import_ag_charts_core87.toPlainText)(labelText), labelDatum, { padding }, sizeFittingHeight); + layout = labelMeta?.[0]; + } else { + const measurer2 = (0, import_ag_charts_core87.cachedTextMeasurer)(labelDatum); + const { width, height } = (0, import_ag_charts_core87.isArray)(labelText) ? (0, import_ag_charts_core87.measureTextSegments)(labelText, labelDatum) : measurer2.measureLines(labelText); + layout = { + text: labelText, + fontSize: labelDatum.fontSize, + lineHeight: labelDatum.lineHeight ?? measurer2.lineHeight(), + width, + height + }; + } + if (layout == null) { + label.visible = false; + return; + } + const scale0 = horizontal ? gaugeRect.x : gaugeRect.y + gaugeRect.height; + const scale1 = horizontal ? gaugeRect.x + gaugeRect.width : gaugeRect.y; + const bar0 = horizontal ? barRect.x : barRect.y + barRect.height; + const bar1 = horizontal ? barRect.x + barRect.width : barRect.y; + const offset = labelDatum.spacing * (horizontal ? 1 : -1); + let bounds0; + let bounds1; + let s; + let align; + switch (labelDatum.placement) { + case "outside-start": + bounds0 = -Infinity; + bounds1 = Infinity; + s = scale0 - offset; + align = "Before" /* Before */; + break; + case "outside-end": + bounds0 = -Infinity; + bounds1 = Infinity; + s = scale1 + offset; + align = "After" /* After */; + break; + case "inside-start": + bounds0 = scale0; + bounds1 = bar1; + s = scale0 + offset; + align = "After" /* After */; + break; + case "inside-end": + bounds0 = bar1; + bounds1 = scale1; + s = scale1 - offset; + align = "Before" /* Before */; + break; + case "inside-center": + bounds0 = scale0; + bounds1 = scale1; + s = (scale0 + scale1) / 2; + align = "Center" /* Center */; + break; + case "bar-inside": + bounds0 = bar0; + bounds1 = bar1; + s = (bar0 + bar1) / 2; + align = "Center" /* Center */; + break; + case "bar-inside-end": + bounds0 = bar0; + bounds1 = bar1; + s = bar1 - offset; + align = "Before" /* Before */; + break; + case "bar-outside-end": + bounds0 = bar1; + bounds1 = scale1; + s = bar1 + offset; + align = "After" /* After */; + break; + case "bar-end": + bounds0 = -Infinity; + bounds1 = Infinity; + s = bar1; + align = "Center" /* Center */; + break; + } + const x = horizontal ? s : gaugeRect.x + gaugeRect.width / 2; + const y = horizontal ? gaugeRect.y + gaugeRect.height / 2 : s; + let s0; + let s1; + if (horizontal) { + s0 = x + horizontalAlignFactors[align] * layout.width; + s1 = s0 + layout.width; + } else { + s0 = y + verticalAlignFactors2[align] * layout.height; + s1 = s0 + layout.height; + } + const inside = Math.min(s0, s1) >= Math.min(bounds0, bounds1) && Math.max(s0, s1) <= Math.max(bounds0, bounds1); + if (labelDatum.avoidCollisions && !inside) { + label.visible = false; + return; + } + label.visible = true; + label.text = layout.text; + label.fontSize = layout.fontSize; + label.lineHeight = layout.lineHeight; + label.textAlign = horizontal ? horizontalTextAligns[align] : "center"; + label.textBaseline = horizontal ? "middle" : verticalTextBaselines[align]; + label.x = x; + label.y = y; + }); +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeries.ts +var { + fromToMotion: fromToMotion2, + resetMotion: resetMotion3, + SeriesNodePickMode: SeriesNodePickMode8, + StateMachine: StateMachine12, + createDatumId: createDatumId9, + toRadians: toRadians4, + BBox: BBox19, + Group: Group11, + PointerEvents: PointerEvents5, + Selection: Selection7, + Rect: Rect7, + Text: Text3, + TransformableText: TransformableText2, + Marker: Marker3, + LinearScale: LinearScale4, + generateTicks: generateTicks2, + NiceMode, + easing, + findRangeExtent: findRangeExtent2, + tickFormat, + mergeDefaults: mergeDefaults12, + applyShapeStyle: applyShapeStyle10 +} = import_ag_charts_community202._ModuleSupport; +var horizontalTargetPlacementRotation = { + before: 180, + middle: 0, + after: 0 +}; +var verticalTargetPlacementRotation = { + before: 90, + middle: 0, + after: -90 +}; +var LinearGaugeSeries = class extends import_ag_charts_community202._ModuleSupport.Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode8.EXACT_SHAPE_MATCH, SeriesNodePickMode8.NEAREST_NODE] + }); + this.properties = new LinearGaugeSeriesProperties(); + this.seriesRect = BBox19.NaN; + this.gaugeRect = BBox19.NaN; + this.scale = new LinearScale4(); + this.originX = 0; + this.originY = 0; + this.scaleGroup = this.contentGroup.appendChild(new Group11({ name: "scaleGroup" })); + this.itemGroup = this.contentGroup.appendChild(new Group11({ name: "itemGroup" })); + this.itemTargetGroup = this.contentGroup.appendChild(new Group11({ name: "itemTargetGroup" })); + this.itemTargetLabelGroup = this.contentGroup.appendChild(new Group11({ name: "itemTargetLabelGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group11({ name: "itemLabelGroup" })); + this.highlightTargetGroup = this.highlightGroup.appendChild( + new Group11({ name: "itemTargetLabelGroup" }) + ); + this.tickGroup = this.contentGroup.appendChild(new Group11({ name: "tickGroup" })); + this.scaleSelection = Selection7.select( + this.scaleGroup, + () => this.nodeFactory() + ); + this.datumSelection = Selection7.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.targetSelection = Selection7.select( + this.itemTargetGroup, + () => this.markerFactory() + ); + this.targetLabelSelection = Selection7.select(this.itemTargetLabelGroup, Text3); + this.labelSelection = Selection7.select( + this.itemLabelGroup, + Text3 + ); + this.highlightTargetSelection = Selection7.select(this.highlightTargetGroup, () => this.markerFactory()); + this.tickSelection = Selection7.select(this.tickGroup, TransformableText2); + this.datumUnion = new DatumUnion(); + this.animationState = new StateMachine12("empty", { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.animateReadyResize(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateWaitingUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty" + }, + reset: "empty", + skip: "ready" + } + }); + this.scaleGroup.pointerEvents = PointerEvents5.None; + this.tickGroup.pointerEvents = PointerEvents5.None; + } + get range() { + return this.horizontal ? [0, this.gaugeRect.width] : [0, this.gaugeRect.height]; + } + get horizontal() { + return this.properties.direction === "horizontal"; + } + get hasData() { + return true; + } + nodeFactory() { + const rect = new Rect7(); + rect.crisp = true; + return rect; + } + markerFactory() { + return new Marker3(); + } + processData() { + this.nodeDataRefresh = true; + this.animationState.transition("updateData"); + } + formatLabel(value) { + return formatLabel(value, this.properties.scale); + } + getShapeFillBBox() { + const { properties, originX, originY, horizontal, scale } = this; + const { thickness } = properties; + const length = findRangeExtent2(scale.range); + const bbox = new BBox19(originX, originY, horizontal ? length : thickness, horizontal ? thickness : length); + return { + axis: bbox, + series: bbox + }; + } + getTargets() { + const { properties } = this; + const defaultTarget = properties.defaultTarget; + return Array.from(properties.targets).map((target) => { + const { + text: text2 = defaultTarget.text, + value = defaultTarget.value ?? 0, + shape = defaultTarget.shape ?? "triangle", + rotation = defaultTarget.rotation ?? 0, + placement = defaultTarget.placement ?? "middle", + spacing = defaultTarget.spacing ?? 0, + size = defaultTarget.size ?? 0 + } = target; + const { + enabled: labelEnabled = defaultTarget.label.enabled, + color: labelColor = defaultTarget.label.color ?? "black", + fontStyle: labelFontStyle = defaultTarget.label.fontStyle ?? "normal", + fontWeight: labelFontWeight = defaultTarget.label.fontWeight ?? "normal", + fontSize: labelFontSize = defaultTarget.label.fontSize, + fontFamily: labelFontFamily = defaultTarget.label.fontFamily, + spacing: labelSpacing = defaultTarget.label.spacing ?? 0 + } = target.label; + return { + text: text2, + value, + shape, + placement, + spacing, + size, + rotation, + label: { + enabled: labelEnabled, + color: labelColor, + fontStyle: labelFontStyle, + fontWeight: labelFontWeight, + fontSize: labelFontSize, + fontFamily: labelFontFamily, + spacing: labelSpacing + }, + style: target.getStyle(defaultTarget) + }; + }); + } + getTargetPoint(target) { + const { properties, originX, originY, horizontal, scale, gaugeRect } = this; + const { thickness } = properties; + const { value, placement, spacing, size } = target; + const mainOffset = scale.convert(value); + let crossOffset; + switch (placement) { + case "before": + crossOffset = -(spacing + size / 2); + break; + case "after": + crossOffset = thickness + spacing + size / 2; + break; + default: + crossOffset = thickness / 2; + break; + } + return { + x: originX + gaugeRect.x + (horizontal ? mainOffset : crossOffset), + y: originY + gaugeRect.y + (horizontal ? crossOffset : mainOffset) + }; + } + getTargetLabel(target) { + const { size, placement, label } = target; + const { spacing, color: fill, fontStyle, fontWeight, fontSize, fontFamily } = label; + const lineHeight = void 0; + const offset = size / 2 + spacing; + let textAlign; + let textBaseline; + let offsetX = 0; + let offsetY = 0; + if (this.horizontal) { + textAlign = "center"; + if (placement === "after") { + textBaseline = "top"; + offsetY = offset; + } else { + textBaseline = "bottom"; + offsetY = -offset; + } + } else { + textBaseline = "middle"; + if (placement === "before") { + textAlign = "right"; + offsetX = -offset; + } else { + textAlign = "left"; + offsetX = offset; + } + } + return { + offsetX, + offsetY, + fill, + textAlign, + textBaseline, + fontStyle, + fontWeight, + fontSize, + fontFamily, + lineHeight + }; + } + labelDatum(label, value) { + const { + placement, + avoidCollisions, + spacing, + text: text2, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + wrapping, + overflowStrategy, + formatter = (params) => this.formatLabel(params.value) + } = label; + return { + placement, + avoidCollisions, + spacing, + text: text2, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + wrapping, + overflowStrategy, + formatter + }; + } + verticalLabelInset() { + const { label } = this.properties; + const measurer2 = (0, import_ag_charts_core88.cachedTextMeasurer)(label); + const lines = label.text?.split("\n"); + const labelSize = (label.lineHeight ?? measurer2.lineHeight()) * (lines?.length ?? 1); + return label.spacing + labelSize; + } + horizontalLabelInset() { + const { scale, properties } = this; + const { scale: scaleProps, label } = properties; + const lines = label.text?.split("\n"); + const measurer2 = (0, import_ag_charts_core88.cachedTextMeasurer)(label); + const ticks = scaleProps.interval.values ?? scale.ticks({ + nice: false, + interval: scaleProps.interval.step, + minTickCount: 0, + maxTickCount: 6, + tickCount: 5 + })?.ticks ?? []; + const linesOrTicks = lines ?? ticks?.map((tick) => getLabelText(this.id, this.ctx, this.labelDatum(label, tick)) ?? ""); + const labelSize = linesOrTicks.reduce((accum, text2) => { + const { width } = (0, import_ag_charts_core88.isArray)(text2) ? (0, import_ag_charts_core88.measureTextSegments)(text2, label) : measurer2.measureLines(text2); + return Math.max(accum, width); + }, 0); + return label.spacing + labelSize; + } + tickFormatter(domain, ticks) { + const { format, formatter } = this.properties.scale.label; + let tickFormatter; + if (format != null) { + tickFormatter = tickFormat(ticks, typeof format === "string" ? format : void 0); + } + return (value, index) => { + let r = void 0; + if (formatter) { + r ?? (r = formatWithContext(this.ctx, formatter, { value, index, domain, boundSeries: void 0 })); + } + r ?? (r = tickFormatter?.(value)); + return r ?? this.formatLabel(value); + }; + } + createNodeData() { + const { id: seriesId, properties, horizontal, scale, seriesRect } = this; + const { + value, + segmentation, + thickness, + cornerRadius, + cornerMode, + bar, + scale: scaleProps, + label, + defaultColorRange + } = properties; + scale.domain = [scaleProps.min, scaleProps.max]; + scale.range = horizontal ? [0, seriesRect.width] : [seriesRect.height, 0]; + let axisRotation; + let sideFlag; + if (horizontal) { + sideFlag = 1; + axisRotation = Math.PI / 2; + } else if (scaleProps.label.placement === "before") { + sideFlag = 1; + axisRotation = 0; + } else { + sideFlag = -1; + axisRotation = 0; + } + let x0; + let x1; + let y0; + let y1; + if (horizontal) { + x0 = 0; + x1 = seriesRect.width; + y0 = (seriesRect.height - thickness) / 2; + y1 = y0 + thickness; + if (label.placement === "outside-start") { + x0 += this.horizontalLabelInset(); + } else if (label.placement === "outside-end") { + x1 -= this.horizontalLabelInset(); + } + } else { + x0 = (seriesRect.width - thickness) / 2; + x1 = x0 + thickness; + y1 = 0; + y0 = seriesRect.height; + if (label.placement === "outside-start") { + y0 -= this.verticalLabelInset(); + } else if (label.placement === "outside-end") { + y1 += this.verticalLabelInset(); + } + } + this.gaugeRect = new BBox19(Math.min(x0, x1), Math.min(y0, y1), Math.abs(x1 - x0), Math.abs(y1 - y0)); + const originX = 0; + const originY = 0; + scale.domain = [scaleProps.min, scaleProps.max]; + scale.range = horizontal ? [x0, x1] : [y0, y1]; + const { + tickData: { ticks: tickData } + } = generateTicks2({ + scale, + label: this.properties.scale.label, + interval: this.properties.scale.interval, + tickFormatter: (domain, ticks) => this.tickFormatter(domain, ticks), + domain: scale.domain, + range: this.range, + reverse: false, + primaryTickCount: void 0, + defaultTickMinSpacing: 0, + visibleRange: [0, 1], + niceMode: NiceMode.Off, + labelOffset: 0, + axisRotation, + sideFlag + }); + const isReversed = false; + const targets = this.getTargets(); + const nodeData = []; + const targetData = []; + const labelData = []; + const scaleData = []; + const [m0, m1] = scale.range; + const mainAxisSize = Math.abs(m1 - m0); + const containerX = horizontal ? scale.convert(value) : x1; + const containerY = horizontal ? y1 : scale.convert(value); + const inset = segmentation.enabled ? segmentation.spacing / 2 : 0; + const horizontalInset = horizontal ? inset : 0; + const verticalInset = horizontal ? 0 : inset; + const barThickness = Math.min(bar.thickness ?? Math.round(bar.thicknessRatio * thickness), thickness); + const barInset = -(thickness - barThickness) / 2; + const barXInset = horizontal ? 0 : barInset; + const barYInset = horizontal ? barInset : 0; + const cornersOnAllItems = cornerMode === "item"; + const maxTicks = Math.ceil(mainAxisSize); + let segments = segmentation.enabled ? segmentation.interval.getSegments(scale, maxTicks) : void 0; + const barStyle = bar.getStyle(defaultColorRange, horizontal, scale); + const scaleStyle = scaleProps.getStyle(bar.enabled, defaultColorRange, horizontal, scale); + if (segments == null && cornersOnAllItems) { + const segmentStart = Math.min(...scale.domain); + const segmentEnd = Math.max(...scale.domain); + const datum = { value, segmentStart, segmentEnd }; + if (bar.enabled) { + const barAppliedCornerRadius = Math.min(cornerRadius, barThickness / 2, mainAxisSize / 2); + const barCornerInset = barAppliedCornerRadius * (isReversed ? -1 : 1); + const barCornerXInset = horizontal ? barCornerInset : 0; + const barCornerYInset = horizontal ? 0 : barCornerInset; + nodeData.push({ + series: this, + itemId: `value`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + x0 - barCornerXInset - barXInset, + y0: originY + y0 - barCornerYInset - barYInset, + x1: originX + containerX + barCornerXInset + barXInset, + y1: originY + containerY + barCornerYInset + barYInset, + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius: cornerRadius, + topRightCornerRadius: cornerRadius, + bottomRightCornerRadius: cornerRadius, + bottomLeftCornerRadius: cornerRadius, + horizontalInset, + verticalInset, + style: barStyle + }); + } + const scaleAppliedCornerRadius = Math.min(cornerRadius, thickness / 2, mainAxisSize / 2); + const scaleCornerInset = scaleAppliedCornerRadius * (isReversed ? -1 : 1); + const scaleCornerXInset = horizontal ? scaleCornerInset : 0; + const scaleCornerYInset = horizontal ? 0 : scaleCornerInset; + scaleData.push({ + series: this, + itemId: `scale`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + x0 - scaleCornerXInset, + y0: originY + y0 - scaleCornerYInset, + x1: originX + x1 + scaleCornerXInset, + y1: originY + y1 + scaleCornerYInset, + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius: cornerRadius, + topRightCornerRadius: cornerRadius, + bottomRightCornerRadius: cornerRadius, + bottomLeftCornerRadius: cornerRadius, + horizontalInset, + verticalInset, + style: scaleStyle + }); + } else { + segments ?? (segments = scale.domain); + const clipX0 = originX + x0 - barXInset; + const clipY0 = originY + y0 - barYInset; + const clipX1 = originX + containerX + barXInset; + const clipY1 = originY + containerY + barYInset; + for (let i = 0; i < segments.length - 1; i += 1) { + const segmentStart = segments[i + 0]; + const segmentEnd = segments[i + 1]; + const datum = { value, segmentStart, segmentEnd }; + const isStart = i === 0; + const isEnd = i === segments.length - 2; + const itemStart = scale.convert(segmentStart); + const itemEnd = scale.convert(segmentEnd); + const startCornerRadius = cornersOnAllItems || isStart ? cornerRadius : 0; + const endCornerRadius = cornersOnAllItems || isEnd ? cornerRadius : 0; + const topLeftCornerRadius = horizontal ? startCornerRadius : endCornerRadius; + const topRightCornerRadius = endCornerRadius; + const bottomRightCornerRadius = horizontal ? endCornerRadius : startCornerRadius; + const bottomLeftCornerRadius = startCornerRadius; + if (bar.enabled) { + nodeData.push({ + series: this, + itemId: `value-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + (horizontal ? itemStart : x0), + y0: originY + (horizontal ? y0 : itemStart), + x1: originX + (horizontal ? itemEnd : x1), + y1: originY + (horizontal ? y1 : itemEnd), + clipX0, + clipY0, + clipX1, + clipY1, + topLeftCornerRadius, + topRightCornerRadius, + bottomRightCornerRadius, + bottomLeftCornerRadius, + horizontalInset, + verticalInset, + style: barStyle + }); + } + scaleData.push({ + series: this, + itemId: `scale-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + (horizontal ? itemStart : x0), + y0: originY + (horizontal ? y0 : itemStart), + x1: originX + (horizontal ? itemEnd : x1), + y1: originY + (horizontal ? y1 : itemEnd), + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius, + topRightCornerRadius, + bottomRightCornerRadius, + bottomLeftCornerRadius, + horizontalInset, + verticalInset, + style: scaleStyle + }); + } + } + if (label.enabled) { + labelData.push(this.labelDatum(label, value)); + } + const targetPlacementRotation2 = horizontal ? horizontalTargetPlacementRotation : verticalTargetPlacementRotation; + for (let i = 0; i < targets.length; i += 1) { + const target = targets[i]; + const { value: targetValue, text: text2, shape, size, style } = target; + const targetPoint = this.getTargetPoint(target); + const targetRotation = toRadians4(target.rotation + targetPlacementRotation2[target.placement]); + targetData.push({ + series: this, + itemId: `target-${i}`, + midPoint: targetPoint, + datum: { value: targetValue }, + datumIndex: { type: 1 /* Target */, index: i }, + type: 1 /* Target */, + value: targetValue, + text: text2, + x: targetPoint.x, + y: targetPoint.y, + shape, + size, + rotation: targetRotation, + label: this.getTargetLabel(target), + style + }); + } + return { + itemId: seriesId, + nodeData, + tickData, + targetData, + labelData, + scaleData + }; + } + updateSelections(resize) { + if (this.nodeDataRefresh || resize) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + highlightDatum(node) { + if (node != null && node.series === this && node.type === 1 /* Target */) { + return node; + } + } + update({ seriesRect }) { + const { + datumSelection, + labelSelection, + targetSelection, + targetLabelSelection, + scaleSelection, + highlightTargetSelection, + tickSelection + } = this; + this.seriesRect = seriesRect ?? BBox19.NaN; + const resize = this.checkResize(seriesRect); + this.updateSelections(resize); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const targetData = this.contextNodeData?.targetData ?? []; + const scaleData = this.contextNodeData?.scaleData ?? []; + const tickData = this.contextNodeData?.tickData ?? []; + const highlightTargetDatum = this.highlightDatum(this.ctx.highlightManager.getActiveHighlight()); + this.scaleSelection = this.updateScaleSelection({ scaleData, scaleSelection }); + this.updateScaleNodes({ scaleSelection }); + this.targetSelection = this.updateTargetSelection({ targetData, targetSelection }); + this.updateTargetNodes({ targetSelection, isHighlight: false }); + this.targetLabelSelection = this.updateTargetLabelSelection({ targetData, targetLabelSelection }); + this.updateTargetLabelNodes({ targetLabelSelection }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightTargetSelection = this.updateTargetSelection({ + targetData: highlightTargetDatum == null ? [] : [highlightTargetDatum], + targetSelection: highlightTargetSelection + }); + this.updateTargetNodes({ targetSelection: highlightTargetSelection, isHighlight: true }); + this.tickSelection = this.updateTickSelection({ tickData, tickSelection }); + this.updateTickNodes({ tickSelection }); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => { + return createDatumId9(opts.nodeData.length, datum.itemId); + }); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + const { ctx } = this; + const animationDisabled = ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle10(rect, datum.style, fillBBox); + rect.topLeftCornerRadius = topLeftCornerRadius; + rect.topRightCornerRadius = topRightCornerRadius; + rect.bottomRightCornerRadius = bottomRightCornerRadius; + rect.bottomLeftCornerRadius = bottomLeftCornerRadius; + rect.pointerEvents = this.properties.bar.enabled ? import_ag_charts_community202._ModuleSupport.PointerEvents.All : import_ag_charts_community202._ModuleSupport.PointerEvents.None; + if (animationDisabled || rect.previousDatum == null) { + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + } + }); + const { horizontal } = this; + this.datumUnion.update(datumSelection, this.itemGroup, import_ag_charts_community202._ModuleSupport.Rect, (node, first, last) => { + const left = Math.min(first.x, last.x); + const right = Math.max(first.x + first.width, last.x + last.width); + const top = Math.min(first.y, last.y); + const bottom = Math.max(first.y + first.height, last.y + last.height); + const width = right - left; + const height = bottom - top; + node.pointerEvents = import_ag_charts_community202._ModuleSupport.PointerEvents.None; + node.x = left; + node.y = top; + node.width = width; + node.height = height; + node.topLeftCornerRadius = horizontal ? first.topLeftCornerRadius : last.topLeftCornerRadius; + node.topRightCornerRadius = last.topRightCornerRadius; + node.bottomRightCornerRadius = horizontal ? last.bottomRightCornerRadius : first.bottomRightCornerRadius; + node.bottomLeftCornerRadius = first.bottomLeftCornerRadius; + const firstClipBBox = first.clipBBox; + const lastClipBBox = last.clipBBox ?? firstClipBBox; + if (firstClipBBox && lastClipBBox) { + node.clipBBox = BBox19.merge([firstClipBBox, lastClipBBox]).intersection( + horizontal ? new BBox19(left, -Infinity, width, Infinity) : new BBox19(-Infinity, top, Infinity, height) + ); + } else { + node.clipBBox = void 0; + } + }); + } + updateScaleSelection(opts) { + return opts.scaleSelection.update(opts.scaleData, void 0, (datum) => { + return createDatumId9(opts.scaleData.length, datum.itemId); + }); + } + updateScaleNodes(opts) { + const { scaleSelection } = opts; + const fillBBox = this.getShapeFillBBox(); + scaleSelection.each((rect, datum) => { + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle10(rect, datum.style, fillBBox); + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + rect.topLeftCornerRadius = topLeftCornerRadius; + rect.topRightCornerRadius = topRightCornerRadius; + rect.bottomRightCornerRadius = bottomRightCornerRadius; + rect.bottomLeftCornerRadius = bottomLeftCornerRadius; + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + }); + } + updateTargetSelection(opts) { + return opts.targetSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetNodes(opts) { + const { targetSelection, isHighlight } = opts; + targetSelection.each((target, datum) => { + const { x, y, shape, size, rotation } = datum; + const style = this.getTargetStyle(isHighlight, datum); + applyShapeStyle10(target, style); + target.size = size; + target.shape = shape === "line" ? lineMarker : shape; + target.translationX = x; + target.translationY = y; + target.rotation = rotation; + }); + } + getTargetStyle(isHighlight, { datumIndex, style }) { + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + return mergeDefaults12(highlightStyle, { + ...style, + opacity: 1 + }); + } + updateTargetLabelSelection(opts) { + return opts.targetLabelSelection.update(opts.targetData); + } + updateTargetLabelNodes(opts) { + const { targetLabelSelection } = opts; + targetLabelSelection.each((label, target) => { + const { x, y, text: text2 } = target; + const { offsetX, offsetY, fill, fontStyle, fontWeight, fontSize, fontFamily, textAlign, textBaseline } = target.label; + label.visible = true; + label.x = x + offsetX; + label.y = y + offsetY; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + }); + } + updateTickSelection(opts) { + return opts.tickSelection.update(opts.tickData, void 0, (datum) => datum.tickId); + } + updateTickNodes(opts) { + const { gaugeRect, properties } = this; + const defaultScale = properties.defaultScale; + const { + enabled, + color: color6, + fontFamily = defaultScale.label.fontFamily, + fontSize = defaultScale.label.fontSize, + fontStyle, + fontWeight = defaultScale.label.fontWeight, + spacing + } = properties.scale.label; + let { placement } = properties.scale.label; + const rotation = toRadians4(properties.scale.label.rotation ?? 0); + let textAlign; + let textBaseline; + let textX; + let textY; + if (this.horizontal) { + placement ?? (placement = "after"); + textAlign = "center"; + textBaseline = placement === "before" ? "bottom" : "top"; + textY = this.originY + gaugeRect.y + (placement === "before" ? -spacing : gaugeRect.height + spacing); + } else { + placement ?? (placement = "before"); + textAlign = placement === "before" ? "end" : "start"; + textBaseline = "middle"; + textX = this.originX + gaugeRect.x + (placement === "before" ? -spacing : gaugeRect.width + spacing); + } + opts.tickSelection.each((label, datum) => { + if (!enabled) { + label.visible = false; + return; + } + const x = textX ?? datum.translation; + const y = textY ?? datum.translation; + label.visible = true; + label.text = datum.tickLabel; + label.fill = color6; + label.fontFamily = fontFamily; + label.fontSize = fontSize; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.textBaseline = textBaseline; + label.textAlign = textAlign; + label.x = x; + label.y = y; + label.rotationCenterX = x; + label.rotationCenterY = y; + label.rotation = rotation; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(opts.labelData, void 0, (_datum) => "primary"); + } + updateLabelNodes(opts) { + const { labelSelection } = opts; + const animationDisabled = this.ctx.animationManager.isSkipped(); + labelSelection.each((label, datum) => { + label.fill = datum.fill; + label.fontStyle = datum.fontStyle; + label.fontWeight = datum.fontWeight; + label.fontFamily = datum.fontFamily; + }); + if (animationDisabled || this.labelsHaveExplicitText()) { + this.formatLabelText(); + } + } + labelsHaveExplicitText() { + for (const { datum } of this.labelSelection) { + if (datum.text == null) { + return false; + } + } + return true; + } + formatLabelText(datum) { + const { labelSelection, horizontal, scale, seriesRect, gaugeRect } = this; + const { x, y, width, height } = gaugeRect; + const value = datum?.label ?? this.properties.value; + let barRect; + if (horizontal) { + const xValue2 = scale.convert(value); + barRect = new BBox19(x, y, xValue2 - x, height); + } else { + const yValue = scale.convert(value); + barRect = new BBox19(x, yValue, width, height - yValue); + } + const bboxes = { seriesRect, gaugeRect, barRect }; + const { margin: padding } = this.properties; + formatLinearGaugeLabels(this, this.ctx, labelSelection, { padding, horizontal }, bboxes, datum); + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + resetMotion3([this.datumSelection], resetLinearGaugeSeriesResetRectFunction); + this.formatLabelText(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + animateLabelText(params = {}) { + const { animationManager } = this.ctx; + let labelFrom = 0; + let labelTo = 0; + this.labelSelection.each((label, datum) => { + label.opacity = 1; + labelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + labelTo = datum.value; + }); + if (this.labelsHaveExplicitText()) { + } else if (labelFrom === labelTo) { + this.formatLabelText({ label: labelTo }); + } else { + const animationId = `${this.id}_labels`; + animationManager.animate({ + id: animationId, + groupId: "label", + from: { label: labelFrom }, + to: { label: labelTo }, + phase: params.phase ?? "update", + ease: easing.easeOut, + onUpdate: (datum) => this.formatLabelText(datum), + onStop: () => this.formatLabelText({ label: labelTo }) + }); + } + } + animateEmptyUpdateReady() { + const { animationManager } = this.ctx; + const { node } = prepareLinearGaugeSeriesAnimationFunctions(true, this.horizontal); + fromToMotion2(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion2(this.id, "label", animationManager, [this.labelSelection], fadeInFns, () => "primary"); + this.animateLabelText({ from: 0, phase: "initial" }); + } + animateWaitingUpdateReady() { + const { animationManager } = this.ctx; + const { node } = prepareLinearGaugeSeriesAnimationFunctions(false, this.horizontal); + fromToMotion2(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + this.animateLabelText(); + } + animateReadyResize() { + this.resetAllAnimation(); + } + getSeriesDomain() { + return [0, 1]; + } + dataCount() { + return Number.NaN; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData() { + return []; + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties } = this; + const { tooltip } = properties; + if (datumIndex == null) + return; + let value; + let text2; + let fallbackLabel; + if (datumIndex.type === 0 /* Node */) { + value = properties.value; + text2 = properties.label.text; + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeValue"); + } else { + ({ value, text: text2 } = properties.targets[datumIndex.index]); + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeTarget"); + } + if (value == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + data: [{ label: text2, fallbackLabel, value: this.formatLabel(value) }] + }, + { seriesId, title: void 0, datum: void 0, value } + ); + } + pickNodeClosestDatum(point) { + return pickGaugeNearestDatum(this, point); + } + pickFocus(opts) { + return pickGaugeFocus(this, opts); + } + getCaptionText() { + return this.formatLabel(this.properties.value); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +LinearGaugeSeries.className = "LinearGaugeSeries"; +LinearGaugeSeries.type = "linear-gauge"; + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeModule.ts +var LinearGaugeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "linear-gauge", + moduleFactory: (ctx) => new LinearGaugeSeries(ctx), + themeTemplate: { + minWidth: 200, + minHeight: 200, + tooltip: { + enabled: false + }, + series: { + thickness: 50, + defaultColorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $interpolate: [{ $palette: "secondDivergingColors" }, 5] }, + import_ag_charts_community203._ModuleSupport.SAFE_RANGE2_OPERATION + ] + }, + scale: { + // @ts-expect-error undocumented option + defaultFill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + stroke: { $path: ["/2", import_ag_charts_community203._ModuleSupport.SAFE_STROKE_FILL_OPERATION, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + spacing: 11 + } + }, + bar: { + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + segmentation: { + enabled: false, + interval: {}, + spacing: 1 + }, + defaultTarget: { + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + size: 10, + shape: "triangle", + placement: "after", + spacing: 5, + label: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 5 + } + }, + defaultScale: { + label: { + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + } + }, + label: { + ...import_ag_charts_community203._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + placement: "inside-start", + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: 2 }, + minimumFontSize: import_ag_charts_community203._ModuleSupport.FONT_SIZE.SMALL, + spacing: 18, + color: { $ref: "chartBackgroundColor" } + }, + margin: 4, + tooltip: { + range: { $path: ["/tooltip/range", 10] } + } + } + } +}; +var LinearGaugeSeriesModule = { + type: "series", + name: "linear-gauge", + chartType: "standalone", + enterprise: true, + options: import_ag_charts_community203._ModuleSupport.linearGaugeSeriesOptionsDef, + create: (ctx) => new LinearGaugeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineModule.ts +var import_ag_charts_community212 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/map-util/mapThemeDefaults.ts +var import_ag_charts_community204 = require("ag-charts-community"); +var MAP_THEME_DEFAULTS = { + zoom: { + axes: "xy", + anchorPointX: "pointer", + anchorPointY: "pointer", + buttons: { + // @ts-expect-error undocumented options + anchorPointX: "middle", + anchorPointY: "middle" + } + }, + legend: { + enabled: false + }, + gradientLegend: { + enabled: false, + ...import_ag_charts_community204._ModuleSupport.LEGEND_CONTAINER_THEME + } +}; +function applyMapPalette(object) { + const clone = import_ag_charts_community204._ModuleSupport.deepClone(object); + import_ag_charts_community204._ModuleSupport.jsonWalk(clone, (value) => { + if (typeof value === "object" && "$palette" in value) { + value["$mapPalette"] = value["$palette"]; + delete value["$palette"]; + } + }); + return clone; +} + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeries.ts +var import_ag_charts_community210 = require("ag-charts-community"); +var import_ag_charts_core89 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/map-util/geoGeometry.ts +var import_ag_charts_community206 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/map-util/lineStringUtil.ts +var delta2 = 1e-9; +function lineSegmentDistanceToPointSquared(a, b, x, y) { + const [ax, ay] = a; + const [bx, by] = b; + const abx = bx - ax; + const aby = by - ay; + const l = abx * abx + aby * aby; + let x0; + let y0; + if (Math.abs(l) < delta2) { + x0 = ax; + y0 = ay; + } else { + let t = ((x - ax) * abx + (y - ay) * aby) / l; + t = Math.max(0, Math.min(1, t)); + x0 = ax + t * (bx - ax); + y0 = ay + t * (by - ay); + } + const dx2 = x - x0; + const dy2 = y - y0; + return dx2 * dx2 + dy2 * dy2; +} +function lineStringDistance(lineString, x, y) { + let minDistanceSquared = Infinity; + let p0 = lineString.at(-1); + for (const p1 of lineString) { + minDistanceSquared = Math.min(minDistanceSquared, lineSegmentDistanceToPointSquared(p0, p1, x, y)); + p0 = p1; + } + return Math.sqrt(minDistanceSquared); +} +function lineStringLength(lineSegment) { + let [x0, y0] = lineSegment[0]; + let totalDistance = 0; + for (let i = 1; i < lineSegment.length; i += 1) { + const [x1, y1] = lineSegment[i]; + const distance = Math.hypot(x1 - x0, y1 - y0); + totalDistance += distance; + x0 = x1; + y0 = y1; + } + return totalDistance; +} +function lineStringCenter(lineSegment) { + if (lineSegment.length === 0) + return; + const targetDistance = lineStringLength(lineSegment) / 2; + let [x0, y0] = lineSegment[0]; + let totalDistance = 0; + for (let i = 1; i < lineSegment.length; i += 1) { + const [x1, y1] = lineSegment[i]; + const segmentDistance = Math.hypot(x1 - x0, y1 - y0); + const nextDistance = totalDistance + segmentDistance; + if (nextDistance > targetDistance) { + const ratio3 = (targetDistance - totalDistance) / segmentDistance; + const point = [x0 + (x1 - x0) * ratio3, y0 + (y1 - y0) * ratio3]; + const angle = Math.atan2(y1 - y0, x1 - x0); + return { point, angle }; + } + totalDistance = nextDistance; + x0 = x1; + y0 = y1; + } +} + +// packages/ag-charts-enterprise/src/series/map-util/polygonUtil.ts +var import_ag_charts_community205 = require("ag-charts-community"); +var { LonLatBBox } = import_ag_charts_community205._ModuleSupport; +function polygonBbox(polygon, into) { + for (const coordinates of polygon) { + const [lon, lat] = coordinates; + into = LonLatBBox.extend(into, lon, lat, lon, lat); + } + return into; +} +function polygonCentroid(polygon) { + if (polygon.length === 0) + return; + let x = 0; + let y = 0; + let k = 0; + let [x0, y0] = polygon.at(-1); + for (const [x1, y1] of polygon) { + const c = x0 * y1 - x1 * y0; + k += c; + x += (x0 + x1) * c; + y += (y0 + y1) * c; + x0 = x1; + y0 = y1; + } + k *= 3; + return [x / k, y / k]; +} +function polygonDistance(polygons, x, y) { + let inside = false; + let minDistanceSquared = Infinity; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + let [x0, y0] = p0; + for (const p1 of polygon) { + const [x1, y1] = p1; + if (y1 > y !== y0 > y && x < (x0 - x1) * (y - y1) / (y0 - y1) + x1) { + inside = !inside; + } + minDistanceSquared = Math.min(minDistanceSquared, lineSegmentDistanceToPointSquared(p0, p1, x, y)); + p0 = p1; + x0 = x1; + y0 = y1; + } + } + return (inside ? -1 : 1) * Math.sqrt(minDistanceSquared); +} + +// packages/ag-charts-enterprise/src/series/map-util/geoGeometry.ts +var { Path: Path11, ExtendedPath2D: ExtendedPath2D5, BBox: BBox20, SceneChangeDetection: SceneChangeDetection9, SceneObjectChangeDetection, objectsEqual } = import_ag_charts_community206._ModuleSupport; +var GeoGeometry = class extends Path11 { + constructor() { + super(...arguments); + this.projectedGeometry = void 0; + this.renderMode = 3 /* All */; + // Keep non-filled shapes separate so we don't fill them + this.strokePath = new ExtendedPath2D5(); + } + computeBBox() { + if (this.dirtyPath || this.isDirtyPath()) { + this.updatePath(); + this.dirtyPath = false; + } + return this.bbox?.clone(); + } + updatePath() { + const { projectedGeometry } = this; + this.strokePath.clear(); + this.path.clear(); + this.bbox = projectedGeometry == null ? void 0 : this.drawGeometry(projectedGeometry, void 0); + } + drawPath(ctx) { + super.drawPath(ctx); + this.renderStroke(ctx, this.strokePath.getPath2D()); + } + containsPoint(x, y) { + const { projectedGeometry } = this; + if (projectedGeometry == null) + return false; + if (!this.getBBox().containsPoint(x, y)) + return false; + return this.geometryDistance(projectedGeometry, x, y) <= 0; + } + distanceSquared(x, y) { + const { projectedGeometry } = this; + if (projectedGeometry == null) + return Infinity; + const distance = this.geometryDistance(projectedGeometry, x, y); + return distance > 0 ? distance * distance : 0; + } + geometryDistance(geometry, x, y) { + const { renderMode, strokeWidth } = this; + const drawPolygons = (renderMode & 1 /* Polygons */) !== 0; + const drawLines = (renderMode & 2 /* Lines */) !== 0; + const minStrokeDistance = Math.max(strokeWidth / 2, 1) + 1; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.reduce( + (minDistance, g) => Math.min(minDistance, this.geometryDistance(g, x, y)), + Infinity + ); + case "MultiPolygon": + return drawPolygons ? geometry.coordinates.reduce( + (minDistance, polygon) => Math.min(minDistance, Math.max(polygonDistance(polygon, x, y), 0)), + Infinity + ) : Infinity; + case "Polygon": + return drawPolygons ? Math.max(polygonDistance(geometry.coordinates, x, y), 0) : Infinity; + case "MultiLineString": + return drawLines ? geometry.coordinates.reduce((minDistance, lineString) => { + return Math.min( + minDistance, + Math.max(lineStringDistance(lineString, x, y) - minStrokeDistance, 0) + ); + }, Infinity) : Infinity; + case "LineString": + return drawLines ? Math.max(lineStringDistance(geometry.coordinates, x, y) - minStrokeDistance, 0) : Infinity; + case "MultiPoint": + case "Point": + default: + return Infinity; + } + } + drawGeometry(geometry, bbox) { + const { renderMode, path, strokePath } = this; + const drawPolygons = (renderMode & 1 /* Polygons */) !== 0; + const drawLines = (renderMode & 2 /* Lines */) !== 0; + switch (geometry.type) { + case "GeometryCollection": + for (const g of geometry.geometries) { + bbox = this.drawGeometry(g, bbox); + } + break; + case "MultiPolygon": + if (drawPolygons) { + for (const coordinates of geometry.coordinates) { + bbox = this.drawPolygon(path, coordinates, bbox); + } + } + break; + case "Polygon": + if (drawPolygons) { + bbox = this.drawPolygon(path, geometry.coordinates, bbox); + } + break; + case "LineString": + if (drawLines) { + bbox = this.drawLineString(strokePath, geometry.coordinates, bbox, false); + } + break; + case "MultiLineString": + if (drawLines) { + for (const coordinates of geometry.coordinates) { + bbox = this.drawLineString(strokePath, coordinates, bbox, false); + } + } + break; + case "Point": + case "MultiPoint": + break; + } + return bbox; + } + drawPolygon(path, polygons, bbox) { + if (polygons.length < 1) + return bbox; + bbox = this.drawLineString(path, polygons[0], bbox, true); + for (let i = 1; i < polygons.length; i += 1) { + const enclave = polygons[i]; + this.drawLineString(path, enclave, void 0, true); + } + return bbox; + } + drawLineString(path, coordinates, bbox, isClosed) { + if (coordinates.length < 2) + return bbox; + const end = isClosed ? coordinates.length - 1 : coordinates.length; + for (let i = 0; i < end; i += 1) { + const [x, y] = coordinates[i]; + if (i === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + if (bbox == null) { + bbox = new BBox20(x, y, 0, 0); + } else { + const { x: x0, y: y0 } = bbox; + const x1 = x0 + bbox.width; + const y1 = y0 + bbox.height; + bbox.x = Math.min(x0, x); + bbox.y = Math.min(y0, y); + bbox.width = Math.max(x1, x) - bbox.x; + bbox.height = Math.max(y1, y) - bbox.y; + } + } + if (isClosed) { + path.closePath(); + } + return bbox; + } +}; +__decorateClass([ + SceneObjectChangeDetection({ equals: objectsEqual }) +], GeoGeometry.prototype, "projectedGeometry", 2); +__decorateClass([ + SceneChangeDetection9() +], GeoGeometry.prototype, "renderMode", 2); + +// packages/ag-charts-enterprise/src/series/map-util/geometryUtil.ts +var import_ag_charts_community207 = require("ag-charts-community"); +var { LonLatBBox: LonLatBBox2 } = import_ag_charts_community207._ModuleSupport; +function geometryBbox(geometry, into) { + if (geometry.bbox != null) { + const [lon0, lat0, lon1, lat1] = geometry.bbox; + into = LonLatBBox2.extend(into, lon0, lat0, lon1, lat1); + return into; + } + switch (geometry.type) { + case "GeometryCollection": + for (const g of geometry.geometries) { + into = geometryBbox(g, into); + } + break; + case "MultiPolygon": + for (const c of geometry.coordinates) { + if (c.length > 0) { + into = polygonBbox(c[0], into); + } + } + break; + case "Polygon": + if (geometry.coordinates.length > 0) { + into = polygonBbox(geometry.coordinates[0], into); + } + break; + case "MultiLineString": + for (const c of geometry.coordinates) { + into = polygonBbox(c, into); + } + break; + case "LineString": + into = polygonBbox(geometry.coordinates, into); + break; + case "MultiPoint": + for (const p of geometry.coordinates) { + const [lon, lat] = p; + into = LonLatBBox2.extend(into, lon, lat, lon, lat); + } + break; + case "Point": { + const [lon, lat] = geometry.coordinates; + into = LonLatBBox2.extend(into, lon, lat, lon, lat); + break; + } + } + return into; +} +function largestPolygon(geometry) { + switch (geometry.type) { + case "GeometryCollection": { + let maxArea; + let maxPolygon; + for (const g of geometry.geometries) { + const polygon = largestPolygon(g); + if (polygon == null) + continue; + const bbox = polygonBbox(polygon[0], void 0); + if (bbox == null) + continue; + const area = Math.abs(bbox.lat1 - bbox.lat0) * Math.abs(bbox.lon1 - bbox.lon0); + if (maxArea == null || area > maxArea) { + maxArea = area; + maxPolygon = polygon; + } + } + return maxPolygon; + } + case "MultiPolygon": { + let maxArea; + let maxPolygon; + for (const polygon of geometry.coordinates) { + const bbox = polygonBbox(polygon[0], void 0); + if (bbox == null) + continue; + const area = Math.abs(bbox.lat1 - bbox.lat0) * Math.abs(bbox.lon1 - bbox.lon0); + if (maxArea == null || area > maxArea) { + maxArea = area; + maxPolygon = polygon; + } + } + return maxPolygon; + } + case "Polygon": + return geometry.coordinates; + case "MultiLineString": + case "LineString": + case "MultiPoint": + case "Point": + return; + } +} +function largestLineString(geometry) { + switch (geometry.type) { + case "GeometryCollection": { + let maxLength; + let maxLineString; + for (const g of geometry.geometries) { + const lineString = largestLineString(g); + if (lineString == null) + continue; + const length = lineStringLength(lineString); + if (length == null) + continue; + if (maxLength == null || length > maxLength) { + maxLength = length; + maxLineString = lineString; + } + } + return maxLineString; + } + case "MultiLineString": { + let maxLength = 0; + let maxLineString; + for (const lineString of geometry.coordinates) { + const length = lineStringLength(lineString); + if (length > maxLength) { + maxLength = length; + maxLineString = lineString; + } + } + return maxLineString; + } + case "LineString": + return geometry.coordinates; + case "MultiPolygon": + case "Polygon": + case "MultiPoint": + case "Point": + return; + } +} +function containsType(geometry, type) { + if (geometry == null) + return false; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.some((g) => containsType(g, type)); + case "MultiPolygon": + case "Polygon": + return (type & 1 /* Polygon */) !== 0; + case "MultiLineString": + case "LineString": + return (type & 2 /* LineString */) !== 0; + case "MultiPoint": + case "Point": + return (type & 4 /* Point */) !== 0; + } +} +function projectGeometry(geometry, scale) { + switch (geometry.type) { + case "GeometryCollection": + return { + type: "GeometryCollection", + geometries: geometry.geometries.map((g) => projectGeometry(g, scale)) + }; + case "Polygon": + return { + type: "Polygon", + coordinates: projectPolygon(geometry.coordinates, scale) + }; + case "MultiPolygon": + return { + type: "MultiPolygon", + coordinates: projectMultiPolygon(geometry.coordinates, scale) + }; + case "MultiLineString": + return { + type: "MultiLineString", + coordinates: projectPolygon(geometry.coordinates, scale) + }; + case "LineString": + return { + type: "LineString", + coordinates: projectLineString(geometry.coordinates, scale) + }; + case "MultiPoint": + return { + type: "MultiPoint", + coordinates: projectLineString(geometry.coordinates, scale) + }; + case "Point": + return { + type: "Point", + coordinates: scale.convert(geometry.coordinates) + }; + } +} +function projectMultiPolygon(multiPolygon, scale) { + return multiPolygon.map((polygon) => projectPolygon(polygon, scale)); +} +function projectPolygon(polygon, scale) { + return polygon.map((lineString) => projectLineString(lineString, scale)); +} +function projectLineString(lineString, scale) { + return lineString.map((lonLat) => scale.convert(lonLat)); +} + +// packages/ag-charts-enterprise/src/series/map-util/mapUtil.ts +function prepareMapMarkerAnimationFunctions() { + const fromFn = (marker, _datum, status) => { + if (status === "removed") { + return { scalingX: 1, scalingY: 1 }; + } else if (marker.previousDatum == null) { + return { scalingX: 0, scalingY: 0 }; + } + return { scalingX: marker.scalingX, scalingY: marker.scalingY }; + }; + const toFn = (_marker, _datum, status) => { + if (status === "removed") { + return { scalingX: 0, scalingY: 0 }; + } + return { scalingX: 1, scalingY: 1 }; + }; + return { fromFn, toFn }; +} +function findFocusedGeoGeometry(series, opts) { + const datum = series.contextNodeData?.nodeData[opts.datumIndex]; + if (datum === void 0) + return void 0; + for (const node of series.datumSelection.nodes()) { + if (node.datum === datum) { + return node; + } + } + return void 0; +} + +// packages/ag-charts-enterprise/src/series/map-util/topologySeries.ts +var import_ag_charts_community208 = require("ag-charts-community"); +var TopologySeriesProperties = class extends import_ag_charts_community208._ModuleSupport.SeriesProperties { +}; +var TopologySeries = class extends import_ag_charts_community208._ModuleSupport.DataModelSeries { + addChartEventListeners() { + this.cleanup.register( + this.ctx.eventsHub.on("legend:item-click", (event) => { + this.onLegendItemClick(event); + }), + this.ctx.eventsHub.on("legend:item-double-click", (event) => { + this.onLegendItemDoubleClick(event); + }) + ); + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } +}; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeriesProperties.ts +var import_ag_charts_community209 = require("ag-charts-community"); +var { Property: Property70, SeriesProperties: SeriesProperties3, makeSeriesTooltip: makeSeriesTooltip12, Label: Label10 } = import_ag_charts_community209._ModuleSupport; +var MapLineSeriesProperties = class extends SeriesProperties3 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = ""; + this.topologyIdKey = "name"; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.maxStrokeWidth = void 0; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new Label10(); + this.tooltip = makeSeriesTooltip12(); + } + getStyle() { + const { stroke: stroke2, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this; + return { + stroke: stroke2, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "sizeDomain", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "maxStrokeWidth", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeries.ts +var { + getMissCount: getMissCount2, + getLabelStyles: getLabelStyles2, + createDatumId: createDatumId10, + SeriesNodePickMode: SeriesNodePickMode9, + valueProperty: valueProperty12, + ColorScale: ColorScale2, + LinearScale: LinearScale5, + Selection: Selection8, + Text: Text4, + Transformable: Transformable2, + mergeDefaults: mergeDefaults13 +} = import_ag_charts_community210._ModuleSupport; +var MapLineSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + size: ["colorKey"], + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + size: ["sizeName"], + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode9.EXACT_SHAPE_MATCH, SeriesNodePickMode9.NEAREST_NODE], + usesPlacedLabels: true + }); + this.properties = new MapLineSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale2(); + this.sizeScale = new LinearScale5(); + this.datumSelection = Selection8.select( + this.contentGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection8.select(this.labelGroup, Text4); + this.highlightDatumSelection = Selection8.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this._previousDatumMidPoint = void 0; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + return super.hasData && this.topology != null; + } + renderToOffscreenCanvas() { + return true; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [1 /* ShapeLine */, zIndex]; + this.highlightGroup.zIndex = [2 /* ShapeLineHighlight */, zIndex]; + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 2 /* Lines */; + geoGeometry.lineJoin = "round"; + geoGeometry.lineCap = "round"; + return geoGeometry; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, sizeScale, colorScale } = this; + const { topologyIdKey, idKey, sizeKey, colorKey, labelKey, sizeDomain, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null || !containsType(feature.geometry, 2 /* LineString */)) + continue; + featureById.set(property, feature); + } + const sizeScaleType = this.sizeScale.type; + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + valueProperty12(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty12(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }), + ...labelKey == null ? [] : [valueProperty12(labelKey, "category", { id: "labelValue" })], + ...sizeKey == null ? [] : [valueProperty12(sizeKey, sizeScaleType, { id: "sizeValue" })], + ...colorKey == null ? [] : [valueProperty12(colorKey, colorScaleType, { id: "colorValue" })] + ] + }); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + this.topologyBounds = featureValues.reduce((current, feature) => { + const geometry = feature?.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (sizeKey != null) { + const sizeIdx = dataModel.resolveProcessedDataIndexById(this, `sizeValue`); + const processedSize = processedData.domain.values[sizeIdx] ?? []; + sizeScale.domain = sizeDomain ?? processedSize; + } + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + if (topology == null) { + import_ag_charts_core89.Logger.warnOnce(`no topology was provided for [MapLineSeries]; nothing will be rendered.`); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount2(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelDatum(datum, labelValue, projectedGeometry, measurer2) { + if (labelValue == null || projectedGeometry == null) + return; + const lineString = largestLineString(projectedGeometry); + if (lineString == null) + return; + const { idKey, idName, sizeKey, sizeName, colorKey, colorName, labelKey, labelName, label } = this.properties; + if (labelKey == null || !label.enabled) + return; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const labelSize = measurer2.measureLines(String(labelText)); + const labelCenter = lineStringCenter(lineString); + if (labelCenter == null) + return; + const [x, y] = labelCenter.point; + const { width, height } = labelSize; + return { + point: { x, y, size: 0 }, + label: { width, height, text: labelText }, + anchor: void 0, + placement: void 0 + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, sizeScale, properties, scale } = this; + const { idKey, sizeKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null) + return; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const sizeValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const maxStrokeWidth = properties.maxStrokeWidth ?? properties.strokeWidth; + sizeScale.range = [Math.min(properties.strokeWidth, maxStrokeWidth), maxStrokeWidth]; + const measurer2 = (0, import_ag_charts_core89.cachedTextMeasurer)(label); + const projectedGeometries = /* @__PURE__ */ new Map(); + for (const [datumIndex] of processedData.dataSources.get(this.id)?.data.entries() ?? []) { + const id = idValues[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (id != null && projectedGeometry != null) { + projectedGeometries.set(id, projectedGeometry); + } + } + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const sizeValue = sizeValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const projectedGeometry = projectedGeometries.get(idValue); + if (projectedGeometry == null) { + missingGeometries.push(idValue); + } + const labelDatum = this.getLabelDatum(datum, labelValue, projectedGeometry, measurer2); + if (labelDatum != null) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: idKey, + datum, + datumIndex, + idValue, + labelValue, + colorValue, + sizeValue, + projectedGeometry, + legendItemName, + style: this.getItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + import_ag_charts_core89.Logger.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection, isHighlight: false }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection, isHighlight: true }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId10(datum.idValue)); + } + getItemStyle({ datumIndex = 0, datum, colorValue, sizeValue }, isHighlight) { + const { properties, colorScale, sizeScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const style = mergeDefaults13(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + style.stroke = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? properties.stroke; + } + if (sizeValue != null) { + style.strokeWidth = sizeScale.convert(sizeValue, { clamp: true }); + } + let overrides; + if (itemStyler != null) { + overrides = this.cachedDatumCallback(createDatumId10(datumIndex, isHighlight ? "highlight" : "node"), () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + }); + } + return overrides ? mergeDefaults13(style, overrides) : style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + datumSelection.each((geoGeometry, nodeDatum) => { + const { projectedGeometry, style } = nodeDatum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(style); + }); + } + updatePlacedLabelData(labelData) { + this.labelSelection = this.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = import_ag_charts_community210._ModuleSupport.PointerEvents.None; + }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, width, height, text: text2 }, datumIndex) => { + const style = getLabelStyles2(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x + width / 2; + label.y = y + height / 2; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + resetAnimation() { + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + datumMidPoint(datum) { + const { _previousDatumMidPoint } = this; + if (_previousDatumMidPoint?.datum === datum) { + return _previousDatumMidPoint.point; + } + const projectedGeometry = datum.projectedGeometry; + const lineString = projectedGeometry == null ? void 0 : largestLineString(projectedGeometry); + const center = lineString == null ? void 0 : lineStringCenter(lineString)?.point; + const point = center == null ? void 0 : { x: center[0], y: center[1] }; + this._previousDatumMidPoint = { datum, point }; + return point; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { strokeWidth, strokeOpacity, lineDash } = properties; + let { stroke: stroke2 } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + stroke2 = this.colorScale.convert(colorValue); + } + return { + marker: { + fill: void 0, + fillOpacity: 0, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 0, + lineDash: [0], + lineDashOffset: 0, + enabled: false + }, + line: { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idKey, idName, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + idKey, + idName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + legendItemName, + tooltip + } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const sizeValue = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (sizeValue != null && sizeKey != null) { + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: sizeValue, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + domain, + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(sizeValue) }); + } + if (colorValue != null && colorKey != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + const format = this.getItemStyle({ datumIndex, datum, colorValue, sizeValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: idValues[datumIndex], + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { + seriesId, + datum, + title, + idKey, + idName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + ...format + } + ); + } + computeFocusBounds(opts) { + const geometry = findFocusedGeoGeometry(this, opts); + return geometry ? Transformable2.toCanvas(this.contentGroup, geometry.getBBox()) : void 0; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapLineSeries.className = "MapLineSeries"; +MapLineSeries.type = "map-line"; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeriesOptionsDef.ts +var import_ag_charts_community211 = require("ag-charts-community"); +var import_ag_charts_core90 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs11, mapLineSeriesThemeableOptionsDef, without: without5 } = import_ag_charts_community211._ModuleSupport; +var mapLineSeriesOptionsDef = { + ...without5(commonSeriesOptionsDefs11, ["highlightStyle", "highlight"]), + ...mapLineSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core90.required)((0, import_ag_charts_core90.constant)("map-line")), + idKey: (0, import_ag_charts_core90.required)(import_ag_charts_core90.string), + sizeKey: import_ag_charts_core90.string, + colorKey: import_ag_charts_core90.string, + labelKey: import_ag_charts_core90.string, + idName: import_ag_charts_core90.string, + sizeName: import_ag_charts_core90.string, + colorName: import_ag_charts_core90.string, + labelName: import_ag_charts_core90.string, + topology: import_ag_charts_core90.geoJson, + topologyIdKey: import_ag_charts_core90.string, + legendItemName: import_ag_charts_core90.string, + title: import_ag_charts_core90.string +}; +mapLineSeriesOptionsDef.colorRange = (0, import_ag_charts_core90.undocumented)((0, import_ag_charts_core90.and)((0, import_ag_charts_core90.arrayOf)(import_ag_charts_core90.color), (0, import_ag_charts_core90.arrayLength)(1))); + +// packages/ag-charts-enterprise/src/series/map-line/mapLineModule.ts +var MapLineModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-line", + moduleFactory: (ctx) => new MapLineSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + stroke: applyMapPalette(import_ag_charts_community212._ModuleSupport.SAFE_STROKE_FILL_OPERATION), + // @ts-expect-error undocumented option + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(import_ag_charts_community212._ModuleSupport.SAFE_RANGE2_OPERATION) + ] + }, + strokeWidth: 1, + maxStrokeWidth: 3, + lineDash: [0], + lineDashOffset: 0, + label: { + ...import_ag_charts_community212._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: applyMapPalette(import_ag_charts_community212._ModuleSupport.multiSeriesHighlightStyle(false)) + }, + tooltip: { + range: "exact" + } + } +}; +var MapLineSeriesModule = { + type: "series", + name: "map-line", + chartType: "topology", + enterprise: true, + options: mapLineSeriesOptionsDef, + create: (ctx) => new MapLineSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeries.ts +var import_ag_charts_community214 = require("ag-charts-community"); +var import_ag_charts_core91 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeriesProperties.ts +var import_ag_charts_community213 = require("ag-charts-community"); +var { Property: Property71, SeriesProperties: SeriesProperties4, makeSeriesTooltip: makeSeriesTooltip13 } = import_ag_charts_community213._ModuleSupport; +var MapLineBackgroundSeriesProperties = class extends SeriesProperties4 { + constructor() { + super(...arguments); + this.topology = void 0; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tooltip = makeSeriesTooltip13(); + } +}; +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeries.ts +var { createDatumId: createDatumId11, Group: Group12, Selection: Selection9, PointerEvents: PointerEvents6 } = import_ag_charts_community214._ModuleSupport; +var MapLineBackgroundSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [] + }); + this.properties = new MapLineBackgroundSeriesProperties(); + this._chartTopology = void 0; + this.itemGroup = this.contentGroup.appendChild(new Group12({ name: "itemGroup" })); + this.datumSelection = Selection9.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.itemGroup.pointerEvents = PointerEvents6.None; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get focusable() { + return false; + } + setOptionsData() { + } + setChartData() { + } + get hasData() { + return false; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 0]; + this.highlightGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 1]; + return true; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 2 /* Lines */; + geoGeometry.lineJoin = "round"; + geoGeometry.lineCap = "round"; + geoGeometry.pointerEvents = PointerEvents6.None; + return geoGeometry; + } + processData() { + const { topology } = this; + this.topologyBounds = topology?.features.reduce((current, feature) => { + const geometry = feature.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (topology == null) { + import_ag_charts_core91.Logger.warnOnce(`no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.`); + } + } + createNodeData() { + const { id: seriesId, topology, scale, properties } = this; + if (topology == null) + return; + const { stroke: stroke2, strokeOpacity, lineDash, lineDashOffset, strokeWidth } = properties; + const nodeData = []; + const labelData = []; + for (const [index, feature] of topology.features.entries()) { + const { geometry } = feature; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (projectedGeometry == null) + continue; + nodeData.push({ + series: this, + itemId: index, + datum: feature, + datumIndex: 0, + index, + projectedGeometry, + style: { stroke: stroke2, strokeOpacity, lineDash, lineDashOffset, strokeWidth } + }); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + const { nodeData = [] } = this.contextNodeData ?? {}; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId11(datum.index)); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + datumSelection.each((geoGeometry, datum) => { + const { projectedGeometry } = datum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(datum.style); + }); + } + resetAnimation() { + } + getLegendData() { + return []; + } + getTooltipContent(_seriesDatum) { + return; + } + computeFocusBounds(_opts) { + return void 0; + } + hasItemStylers() { + return false; + } +}; +MapLineBackgroundSeries.className = "MapLineBackgroundSeries"; +MapLineBackgroundSeries.type = "map-line-background"; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeriesOptionsDef.ts +var import_ag_charts_community215 = require("ag-charts-community"); +var import_ag_charts_core92 = require("ag-charts-core"); +var { mapLineBackgroundSeriesThemeableOptionsDef } = import_ag_charts_community215._ModuleSupport; +var mapLineBackgroundSeriesOptionsDef = { + ...mapLineBackgroundSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core92.required)((0, import_ag_charts_core92.constant)("map-line-background")), + topology: import_ag_charts_core92.geoJson +}; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundModule.ts +var MapLineBackgroundModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-line-background", + moduleFactory: (ctx) => new MapLineBackgroundSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + stroke: { $path: ["/1", { $mapPalette: "stroke" }, { $mapPalette: "secondHierarchyColors" }] }, + strokeWidth: 1, + lineDash: [0], + lineDashOffset: 0 + } + } +}; +var MapLineBackgroundSeriesModule = { + type: "series", + name: "map-line-background", + chartType: "topology", + enterprise: true, + options: mapLineBackgroundSeriesOptionsDef, + create: (ctx) => new MapLineBackgroundSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerModule.ts +var import_ag_charts_community220 = require("ag-charts-community"); +var import_ag_charts_core96 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeries.ts +var import_ag_charts_community218 = require("ag-charts-community"); +var import_ag_charts_core94 = require("ag-charts-core"); + +// packages/ag-charts-types/src/chart/navigatorOptions.ts +var __MINI_CHART_SERIES_OPTIONS = void 0; +var __VERIFY_MINI_CHART_SERIES_OPTIONS = void 0; +__VERIFY_MINI_CHART_SERIES_OPTIONS = __MINI_CHART_SERIES_OPTIONS; + +// packages/ag-charts-types/src/chart/themeOptions.ts +var __THEME_OVERRIDES = void 0; +var __VERIFY_THEME_OVERRIDES = void 0; +__VERIFY_THEME_OVERRIDES = __THEME_OVERRIDES; + +// packages/ag-charts-types/src/presets/gauge/commonOptions.ts +var __THEMEABLE_OPTIONS = void 0; +var __VERIFY_THEMEABLE_OPTIONS = void 0; +__VERIFY_THEMEABLE_OPTIONS = __THEMEABLE_OPTIONS; +var __AXIS_LABEL_OPTIONS = void 0; +var __VERIFY_AXIS_LABEL_OPTIONS = void 0; +__VERIFY_AXIS_LABEL_OPTIONS = __AXIS_LABEL_OPTIONS; + +// packages/ag-charts-enterprise/src/series/map-util/polygonPointSearch.ts +var import_ag_charts_core93 = require("ag-charts-core"); +function polygonPointSearch(polygons, precision, valueFn) { + const bbox = polygonBbox(polygons[0], void 0); + if (bbox == null) + return; + const boundingXCenter = (bbox.lon0 + bbox.lon1) / 2; + const boundingYCenter = (bbox.lat0 + bbox.lat1) / 2; + const boundingWidth = Math.abs(bbox.lon1 - bbox.lon0); + const boundingHeight = Math.abs(bbox.lat1 - bbox.lat0); + const centroid = polygonCentroid(polygons[0]); + const [cx, cy] = centroid; + const centroidDistanceToPolygon = -polygonDistance(polygons, cx, cy); + let bestResult; + const cellValue = (distanceToPolygon, distanceToCentroid) => { + const centroidDriftFactor = 0.5; + const centroidDrift = Math.max(distanceToCentroid - centroidDistanceToPolygon, 0); + return distanceToPolygon - centroidDriftFactor * centroidDrift; + }; + const createLabelPlacement = (x2, y2, stride) => { + const { distance: distance2, maxDistance } = valueFn(polygons, x2, y2, stride); + const distanceToCentroid = Math.hypot(cx - x2, cy - y2); + const maxXTowardsCentroid = Math.min(Math.max(cx, x2 - stride / 2), x2 + stride / 2); + const maxYTowardsCentroid = Math.min(Math.max(cy, y2 - stride / 2), y2 + stride / 2); + const minDistanceToCentroid = Math.hypot(cx - maxXTowardsCentroid, cy - maxYTowardsCentroid); + const value = cellValue(distance2, distanceToCentroid); + const maxValue = cellValue(maxDistance, minDistanceToCentroid); + return { distance: distance2, maxDistance, value, maxValue, x: x2, y: y2, stride }; + }; + const appendLabelPlacement = (into, x2, y2, stride) => { + const labelPlacement = createLabelPlacement(x2, y2, stride); + if (labelPlacement.maxDistance >= 0) { + into.push(labelPlacement); + } + }; + const initialStride = Math.min(boundingWidth, boundingHeight) / 2; + let queue = { + value: createLabelPlacement(boundingXCenter, boundingYCenter, initialStride), + next: null + }; + while (queue != null) { + const item = queue.value; + const { distance: distance2, value, maxValue, x: x2, y: y2, stride } = item; + queue = queue.next; + if (distance2 > 0 && (bestResult == null || value > bestResult.value)) { + bestResult = item; + } + if (bestResult != null && maxValue - bestResult.value <= precision) { + continue; + } + const nextStride = stride / 2; + const newLabelPlacements = []; + appendLabelPlacement(newLabelPlacements, x2 - nextStride, y2 - nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 + nextStride, y2 - nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 - nextStride, y2 + nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 + nextStride, y2 + nextStride, nextStride); + newLabelPlacements.sort(labelPlacementCmp); + queue = (0, import_ag_charts_core93.insertListItemsSorted)(queue, newLabelPlacements, labelPlacementCmp); + } + if (bestResult == null) + return; + const { distance, x, y } = bestResult; + return { x, y, distance }; +} +var labelPlacementCmp = (a, b) => b.maxValue - a.maxValue; + +// packages/ag-charts-enterprise/src/series/map-util/markerUtil.ts +function polygonMarkerCenter(polygons, precision) { + const result = polygonPointSearch(polygons, precision, (p, x2, y2, stride) => { + const distance = -polygonDistance(p, x2, y2); + const maxDistance = distance + stride * Math.SQRT2; + return { distance, maxDistance }; + }); + if (result == null) + return; + const { x, y } = result; + return [x, y]; +} +function markerPositions(geometry, precision) { + let center; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.flatMap((g) => markerPositions(g, precision)); + case "MultiPoint": + return geometry.coordinates; + case "Point": + return [geometry.coordinates]; + case "MultiPolygon": { + const polygon = largestPolygon(geometry); + center = polygon == null ? void 0 : polygonMarkerCenter(polygon, precision); + break; + } + case "Polygon": { + const polygon = geometry.coordinates; + center = polygon == null ? void 0 : polygonMarkerCenter(polygon, precision); + break; + } + case "MultiLineString": { + const lineString = largestLineString(geometry); + center = lineString == null ? void 0 : lineStringCenter(lineString)?.point; + break; + } + case "LineString": { + const lineString = geometry.coordinates; + center = lineStringCenter(lineString)?.point; + break; + } + } + return center == null ? [] : [center]; +} + +// packages/ag-charts-enterprise/src/series/map-util/shapeFillBBox.ts +var import_ag_charts_community216 = require("ag-charts-community"); +var { BBox: BBox21 } = import_ag_charts_community216._ModuleSupport; +function getTopologyShapeFillBBox(scale) { + if (!scale) + return; + const { range: range2 } = scale; + const x = range2[0][0]; + const y = range2[0][1]; + const width = range2[1][0] - x; + const height = range2[1][1] - y; + const bbox = new BBox21(x, y, width, height); + return { + series: bbox, + axis: bbox + }; +} + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeriesProperties.ts +var import_ag_charts_community217 = require("ag-charts-community"); +var { Property: Property72, SeriesProperties: SeriesProperties5, makeSeriesTooltip: makeSeriesTooltip14, Label: Label11 } = import_ag_charts_community217._ModuleSupport; +var MapMarkerSeriesLabel = class extends Label11 { + constructor() { + super(...arguments); + this.placement = "bottom"; + } +}; +__decorateClass([ + Property72 +], MapMarkerSeriesLabel.prototype, "placement", 2); +var MapMarkerSeriesProperties = class extends SeriesProperties5 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = void 0; + this.topologyIdKey = "name"; + this.idName = void 0; + this.latitudeKey = void 0; + this.latitudeName = void 0; + this.longitudeKey = void 0; + this.longitudeName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.shape = "circle"; + this.size = 6; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new MapMarkerSeriesLabel(); + this.tooltip = makeSeriesTooltip14(); + } + getStyle() { + const { size, shape, fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + size, + shape, + fill, + fillOpacity, + opacity: 1, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "latitudeKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "latitudeName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "longitudeKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "longitudeName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "shape", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "size", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "maxSize", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "sizeDomain", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeries.ts +var { + fromToMotion: fromToMotion3, + StateMachine: StateMachine13, + getMissCount: getMissCount3, + createDatumId: createDatumId12, + SeriesNodePickMode: SeriesNodePickMode10, + valueProperty: valueProperty13, + computeMarkerFocusBounds: computeMarkerFocusBounds2, + ColorScale: ColorScale3, + LinearScale: LinearScale6, + Group: Group13, + Selection: Selection10, + Text: Text5, + Marker: Marker4, + applyShapeStyle: applyShapeStyle11, + getLabelStyles: getLabelStyles3, + LonLatBBox: LonLatBBox3, + mergeDefaults: mergeDefaults14 +} = import_ag_charts_community218._ModuleSupport; +var MapMarkerSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + size: ["colorKey"], + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + size: ["sizeName"], + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode10.EXACT_SHAPE_MATCH, SeriesNodePickMode10.NEAREST_NODE], + usesPlacedLabels: true + }); + this.properties = new MapMarkerSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale3(); + this.sizeScale = new LinearScale6(); + this.markerGroup = this.contentGroup.appendChild(new Group13({ name: "markerGroup" })); + this.labelSelection = Selection10.select(this.labelGroup, Text5, false); + this.markerSelection = Selection10.select( + this.markerGroup, + Marker4, + false + ); + this.highlightMarkerSelection = Selection10.select(this.highlightGroup, Marker4); + this.animationState = new StateMachine13( + "empty", + { + empty: { + update: { + target: "ready", + action: () => this.animateMarkers() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.resetAllAnimation(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateMarkers() + }, + // chart.ts transitions to updateData on zoom change + resize: { + target: "ready", + action: () => this.resetAllAnimation() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty", + action: () => this.resetAllAnimation() + }, + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + const hasLatLon = this.properties.latitudeKey != null && this.properties.longitudeKey != null; + return super.hasData && (this.topology != null || hasLatLon); + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [3 /* Marker */, zIndex]; + this.highlightGroup.zIndex = [4 /* MarkerHighlight */, zIndex]; + return true; + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, sizeScale, colorScale } = this; + const { topologyIdKey, idKey, latitudeKey, longitudeKey, sizeKey, colorKey, labelKey, sizeDomain, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null) + continue; + featureById.set(property, feature); + } + const sizeScaleType = this.sizeScale.type; + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const hasLatLon = latitudeKey != null && longitudeKey != null; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + ...idKey == null ? [] : [ + valueProperty13(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty13(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }) + ], + ...hasLatLon ? [ + valueProperty13(latitudeKey, mercatorScaleType, { id: "latValue" }), + valueProperty13(longitudeKey, mercatorScaleType, { id: "lonValue" }) + ] : [], + ...labelKey ? [valueProperty13(labelKey, "category", { id: "labelValue" })] : [], + ...sizeKey ? [valueProperty13(sizeKey, sizeScaleType, { id: "sizeValue" })] : [], + ...colorKey ? [valueProperty13(colorKey, colorScaleType, { id: "colorValue" })] : [] + ] + }); + const featureValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `featureValue`, processedData); + const latValues = hasLatLon ? dataModel.resolveColumnById(this, `latValue`, processedData) : void 0; + const lonValues = hasLatLon ? dataModel.resolveColumnById(this, `lonValue`, processedData) : void 0; + this.topologyBounds = processedData.dataSources.get(this.id)?.data.reduce((current, _datum, datumIndex) => { + const feature = featureValues?.[datumIndex]; + const geometry = feature?.geometry; + if (geometry != null) { + current = geometryBbox(geometry, current); + } + if (latValues != null && lonValues != null) { + const lon = lonValues[datumIndex]; + const lat = latValues[datumIndex]; + current = LonLatBBox3.extend(current, lon, lat, lon, lat); + } + return current; + }, void 0); + if (sizeKey != null) { + const sizeIdx = dataModel.resolveProcessedDataIndexById(this, `sizeValue`); + const processedSize = processedData.domain.values[sizeIdx] ?? []; + sizeScale.domain = sizeDomain ?? processedSize; + } + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + this.animationState.transition("updateData"); + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount3(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelDatum(datum, labelValue, x, y, size, measurer2) { + if (labelValue == null) + return; + const { + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName, + label, + shape + } = this.properties; + if (labelKey == null || !label.enabled) + return; + const { placement } = label; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const { width, height } = measurer2.measureLines(String(labelText)); + const anchor = Marker4.anchor(shape); + return { + point: { x, y, size }, + label: { width, height, text: labelText }, + anchor, + placement + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, sizeScale, properties, scale } = this; + const { idKey, latitudeKey, longitudeKey, sizeKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null || scale == null) + return; + const hasLatLon = latitudeKey != null && longitudeKey != null; + const idValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `featureValue`, processedData); + const latValues = hasLatLon ? dataModel.resolveColumnById(this, `latValue`, processedData) : void 0; + const lonValues = hasLatLon ? dataModel.resolveColumnById(this, `lonValue`, processedData) : void 0; + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const sizeValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const markerMaxSize = properties.maxSize ?? properties.size; + sizeScale.range = [Math.min(properties.size, markerMaxSize), markerMaxSize]; + const measurer2 = (0, import_ag_charts_core94.cachedTextMeasurer)(label); + let projectedGeometries; + if (idValues != null && featureValues != null) { + projectedGeometries = /* @__PURE__ */ new Map(); + for (const [datumIndex] of processedData.dataSources.get(this.id)?.data.entries() ?? []) { + const id = idValues[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (id != null && projectedGeometry != null) { + projectedGeometries.set(id, projectedGeometry); + } + } + } + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues?.[datumIndex]; + const lonValue = lonValues?.[datumIndex]; + const latValue = latValues?.[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const sizeValue = sizeValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const size = sizeValue == null ? properties.size : sizeScale.convert(sizeValue, { clamp: true }); + const projectedGeometry = idValue == null ? void 0 : projectedGeometries?.get(idValue); + if (idValue != null && projectGeometry == null) { + missingGeometries.push(idValue); + } + if (lonValue != null && latValue != null) { + const [x, y] = scale.convert([lonValue, latValue]); + const labelDatum = this.getLabelDatum(datum, labelValue, x, y, size, measurer2); + if (labelDatum) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: latitudeKey, + datum, + datumIndex, + index: -1, + idValue, + lonValue, + latValue, + labelValue, + sizeValue, + colorValue, + point: { x, y, size }, + midPoint: { x, y }, + legendItemName, + style: this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } else if (projectedGeometry != null) { + for (const [index, [x, y]] of markerPositions(projectedGeometry, 1).entries()) { + const labelDatum = this.getLabelDatum(datum, labelValue, x, y, size, measurer2); + if (labelDatum) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: latitudeKey, + datum, + datumIndex, + index, + idValue, + lonValue, + latValue, + labelValue, + sizeValue, + colorValue, + point: { x, y, size }, + midPoint: { x, y }, + legendItemName, + style: this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } + } + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + import_ag_charts_core94.Logger.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + checkScaleChange() { + if (this.previousScale === this.scale) + return false; + this.previousScale = this.scale; + return true; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + const scaleChange = this.checkScaleChange(); + const { markerSelection, highlightMarkerSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + this.markerSelection = this.updateMarkerSelection({ markerData: nodeData, markerSelection }); + this.updateMarkerNodes({ markerSelection, isHighlight: false, highlightedDatum }); + this.highlightMarkerSelection = this.updateMarkerSelection({ + markerData: highlightedDatum == null ? [] : [highlightedDatum], + markerSelection: highlightMarkerSelection + }); + this.updateMarkerNodes({ + markerSelection: highlightMarkerSelection, + isHighlight: true, + highlightedDatum + }); + if (scaleChange || resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updatePlacedLabelData(labelData) { + this.labelSelection = this.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = import_ag_charts_community218._ModuleSupport.PointerEvents.None; + }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, width, height, text: text2 }, datumIndex) => { + const style = getLabelStyles3(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x + width / 2; + label.y = y + height / 2; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + updateMarkerSelection(opts) { + const { markerData, markerSelection } = opts; + return markerSelection.update( + markerData, + void 0, + (datum) => createDatumId12(datum.index, datum.idValue, datum.lonValue, datum.latValue) + ); + } + getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, isHighlight) { + const { properties, colorScale, sizeScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults14(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + baseStyle.fill = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? baseStyle.fill; + } + if (sizeValue != null) { + baseStyle.size = sizeScale.convert(sizeValue, { clamp: true }); + } + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId12(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults14(overrides, baseStyle); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateMarkerNodes(opts) { + const { markerSelection, isHighlight, highlightedDatum } = opts; + const fillBBox = getTopologyShapeFillBBox(this.scale); + markerSelection.each((marker, markerDatum) => { + const { datum, point } = markerDatum; + const style = this.getMarkerItemStyle(markerDatum, isHighlight); + marker.shape = style.shape; + marker.size = style.size; + applyShapeStyle11(marker, style, fillBBox); + marker.x = point.x; + marker.y = point.y; + marker.scalingCenterX = point.x; + marker.scalingCenterY = point.y; + marker.zIndex = !isHighlight && highlightedDatum != null && datum === highlightedDatum.datum ? 1 : 0; + }); + } + isProcessedDataAnimatable() { + return true; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + this.ctx.animationManager.skipCurrentBatch(); + this.labelSelection.cleanup(); + this.markerSelection.cleanup(); + this.highlightMarkerSelection.cleanup(); + } + animateMarkers() { + const { animationManager } = this.ctx; + const fns = prepareMapMarkerAnimationFunctions(); + fromToMotion3(this.id, "markers", animationManager, [this.markerSelection, this.highlightMarkerSelection], fns); + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + pickNodeClosestDatum(p) { + const { x: x0, y: y0 } = p; + let minDistanceSquared = Infinity; + let minDatum; + for (const datum of this.contextNodeData?.nodeData ?? []) { + const { x, y, size } = datum.point; + const dx2 = Math.max(Math.abs(x - x0) - size, 0); + const dy2 = Math.max(Math.abs(y - y0) - size, 0); + const distanceSquared = dx2 * dx2 + dy2 * dy2; + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + } + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { shape, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + let { fill } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + fill = this.colorScale.convert(colorValue); + } + return { + marker: { + shape, + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idName, idKey, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey ?? seriesId }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + legendItemName, + tooltip + } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const sizeValue = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (sizeKey != null && sizeValue != null) { + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: sizeValue, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + domain, + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(sizeValue) }); + } + if (colorKey != null && colorValue != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + let heading; + if (idKey != null) { + heading = dataModel.resolveColumnById(this, `idValue`, processedData)[datumIndex]; + } else if (latitudeKey != null && longitudeKey != null) { + const latValue = dataModel.resolveColumnById(this, `latValue`, processedData)[datumIndex]; + const lonValue = dataModel.resolveColumnById(this, `lonValue`, processedData)[datumIndex]; + heading = `${Math.abs(latValue).toFixed(4)}\xB0 ${latValue >= 0 ? "N" : "S"}, ${Math.abs(lonValue).toFixed(4)}\xB0 ${lonValue >= 0 ? "W" : "E"}`; + } + const format = this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading, + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { + seriesId, + datum, + title, + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + ...format + } + ); + } + getFormattedMarkerStyle(markerDatum) { + const format = this.getMarkerItemStyle(markerDatum, false); + return { size: format.size, shape: format.shape }; + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds2(this, opts); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapMarkerSeries.className = "MapMarkerSeries"; +MapMarkerSeries.type = "map-marker"; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeriesOptionsDef.ts +var import_ag_charts_community219 = require("ag-charts-community"); +var import_ag_charts_core95 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs12, mapMarkerSeriesThemeableOptionsDef, without: without6 } = import_ag_charts_community219._ModuleSupport; +var mapMarkerSeriesOptionsDef = { + ...without6(commonSeriesOptionsDefs12, ["highlightStyle", "highlight"]), + ...mapMarkerSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core95.required)((0, import_ag_charts_core95.constant)("map-marker")), + idKey: import_ag_charts_core95.string, + latitudeKey: import_ag_charts_core95.string, + longitudeKey: import_ag_charts_core95.string, + sizeKey: import_ag_charts_core95.string, + colorKey: import_ag_charts_core95.string, + labelKey: import_ag_charts_core95.string, + idName: import_ag_charts_core95.string, + latitudeName: import_ag_charts_core95.string, + longitudeName: import_ag_charts_core95.string, + sizeName: import_ag_charts_core95.string, + colorName: import_ag_charts_core95.string, + labelName: import_ag_charts_core95.string, + topology: import_ag_charts_core95.geoJson, + topologyIdKey: import_ag_charts_core95.string, + legendItemName: import_ag_charts_core95.string, + title: import_ag_charts_core95.string +}; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerModule.ts +var MapMarkerModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-marker", + moduleFactory: (ctx) => new MapMarkerSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + shape: "circle", + maxSize: 30, + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $mapPalette: "fill" }, + ["gradient", import_ag_charts_community220._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", import_ag_charts_community220._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community220._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }), + stroke: { $mapPalette: "stroke" }, + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(import_ag_charts_community220._ModuleSupport.SAFE_RANGE2_OPERATION) + ] + }, + fillOpacity: 0.5, + label: { + ...import_ag_charts_community220._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: applyMapPalette(import_ag_charts_community220._ModuleSupport.multiSeriesHighlightStyle()) + }, + tooltip: { + range: "exact" + } + } +}; +var MapMarkerSeriesModule = { + type: "series", + name: "map-marker", + chartType: "topology", + enterprise: true, + options: mapMarkerSeriesOptionsDef, + create: (ctx) => new MapMarkerSeries(ctx), + validate(options, optionsDefs2, path) { + const result = (0, import_ag_charts_core96.validate)(options, optionsDefs2, path); + const { cleared, invalid } = result; + if (cleared?.idKey == null && (cleared?.latitudeKey == null || cleared?.longitudeKey == null)) { + const extendPath = (key) => path ? `${path}.${key}` : key; + const message = `Either \`${extendPath("idKey")}\` or both \`${extendPath("latitudeKey")}\` and \`${extendPath("longitudeKey")}\` are required.`; + invalid.push(new import_ag_charts_core96.ValidationError("required", message, null, path)); + } + return result; + } +}; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeModule.ts +var import_ag_charts_community224 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeries.ts +var import_ag_charts_community222 = require("ag-charts-community"); +var import_ag_charts_core97 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/map-util/polygonLabelUtil.ts +function preferredLabelCenter(polygons, { aspectRatio, precision }) { + const result = polygonPointSearch(polygons, precision, (p, cx, cy, stride) => { + const width = maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(p, cx, cy, aspectRatio); + const maxWidth2 = width + 2 * stride * aspectRatio; + const distance2 = width * Math.SQRT2; + const maxDistance = maxWidth2 * Math.SQRT2; + return { distance: distance2, maxDistance }; + }); + if (result == null) + return; + const { x, y, distance } = result; + const maxWidth = distance / Math.SQRT2; + return { x, y, maxWidth }; +} +function maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(a, b, cx, cy, aspectRatio) { + const [ax, ay] = a; + const [bx, by] = b; + const positiveM = 1 / aspectRatio; + const abx = bx - ax; + const aby = by - ay; + const [topPointX, topPointY] = ay <= by ? a : b; + const [leftPointX, leftPointY] = ax <= bx ? a : b; + const [bottomPointX, bottomPointY] = ay <= by ? b : a; + const [rightPointX, rightPointY] = ax <= bx ? b : a; + let maxWidth = Infinity; + if (abx === 0) { + for (let i = 0; i <= 1; i += 1) { + const m = i === 0 ? positiveM : -positiveM; + const y = m * (ax - cx) + cy; + if (y >= topPointY && y <= bottomPointY) { + const height = Math.abs(cy - y) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } + } + } else { + const abm = aby / abx; + for (let i = 0; i <= 1; i += 1) { + const m = i === 0 ? positiveM : -positiveM; + const x = (abm * ax - ay - m * cx + cy) / (abm - m); + if (x >= leftPointX && x <= rightPointX) { + const width = Math.abs(cx - x) * 2; + maxWidth = Math.min(maxWidth, width); + } + } + } + const positiveMRecip = aspectRatio; + const centerToTopMRecip = Math.abs((topPointX - cx) / (topPointY - cy)); + const centerToBottomMRecip = Math.abs((bottomPointX - cx) / (bottomPointY - cy)); + if (bottomPointY < cy && centerToBottomMRecip < positiveMRecip) { + const height = Math.abs(cy - bottomPointY) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } else if (topPointY > cy && centerToTopMRecip < positiveMRecip) { + const height = Math.abs(cy - topPointY) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } + const centerToLeftM = Math.abs((leftPointY - cy) / (leftPointX - cx)); + const centerToRightM = Math.abs((rightPointY - cy) / (rightPointX - cx)); + if (rightPointX < cx && centerToRightM < positiveM) { + const width = Math.abs(cx - rightPointX) * 2; + maxWidth = Math.min(maxWidth, width); + } else if (leftPointX > cx && centerToLeftM < positiveM) { + const width = Math.abs(cx - leftPointX) * 2; + maxWidth = Math.min(maxWidth, width); + } + return maxWidth; +} +function maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(polygons, cx, cy, aspectRatio) { + let inside = false; + let minWidth = Infinity; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + let [x0, y0] = p0; + for (const p1 of polygon) { + const [x1, y1] = p1; + if (y1 > cy !== y0 > cy && cx < (x0 - x1) * (cy - y1) / (y0 - y1) + x1) { + inside = !inside; + } + const width = maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(p0, p1, cx, cy, aspectRatio); + minWidth = Math.min(minWidth, width); + p0 = p1; + x0 = x1; + y0 = y1; + } + } + return (inside ? 1 : -1) * minWidth; +} +function applyX(into, cx, x) { + if (x >= cx) { + into.maxX = Math.min(into.maxX, x - cx); + } + if (x <= cx) { + into.minX = Math.max(into.minX, x - cx); + } +} +function xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(into, a, b, cx, cy, height) { + const ry0 = cy - height / 2; + const ry1 = cy + height / 2; + const [ax, ay] = a; + const [bx, by] = b; + const abx = bx - ax; + const aby = by - ay; + const [leftPointX, leftPointY] = ax <= bx ? a : b; + const [rightPointX, rightPointY] = ax <= bx ? b : a; + if (abx !== 0) { + const abm = aby / abx; + for (let i = 0; i <= 1; i += 1) { + const y = i === 0 ? ry0 : ry1; + const x = (y - ay) / abm + ax; + if (x >= leftPointX && x <= rightPointX) { + applyX(into, cx, x); + } + } + } else if (Math.max(ry0, Math.min(ay, by)) <= Math.min(ry1, Math.max(ay, by))) { + applyX(into, cx, ax); + } + if (rightPointX < cx && rightPointY >= ry0 && rightPointY <= ry1) { + applyX(into, cx, rightPointX); + } else if (leftPointX > cx && leftPointY >= ry0 && leftPointY <= ry1) { + applyX(into, cx, leftPointX); + } + return into; +} +function maxWidthInPolygonForRectOfHeight(polygons, cx, cy, height) { + const result = { + minX: -Infinity, + maxX: Infinity + }; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + for (const p1 of polygon) { + xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(result, p0, p1, cx, cy, height); + p0 = p1; + } + } + const { minX, maxX } = result; + if (Number.isFinite(minX) && Number.isFinite(maxX)) { + return { x: cx + (minX + maxX) / 2, width: maxX - minX }; + } else { + return { x: cx, width: 0 }; + } +} + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeriesProperties.ts +var import_ag_charts_community221 = require("ag-charts-community"); +var { Property: Property73, SeriesProperties: SeriesProperties6, makeSeriesTooltip: makeSeriesTooltip15 } = import_ag_charts_community221._ModuleSupport; +var MapShapeSeriesProperties = class extends SeriesProperties6 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = ""; + this.idName = void 0; + this.topologyIdKey = "name"; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.padding = 0; + this.label = new AutoSizedSecondaryLabel(); + this.tooltip = makeSeriesTooltip15(); + } + getStyle() { + const { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "padding", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeries.ts +var { + getMissCount: getMissCount4, + createDatumId: createDatumId13, + SeriesNodePickMode: SeriesNodePickMode11, + valueProperty: valueProperty14, + ColorScale: ColorScale4, + Group: Group14, + Selection: Selection11, + Text: Text6, + PointerEvents: PointerEvents7, + applyShapeStyle: applyShapeStyle12, + getLabelStyles: getLabelStyles4, + mergeDefaults: mergeDefaults15 +} = import_ag_charts_community222._ModuleSupport; +var fixedScale = import_ag_charts_community222._ModuleSupport.MercatorScale.fixedScale(); +var MapShapeSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode11.EXACT_SHAPE_MATCH, SeriesNodePickMode11.NEAREST_NODE] + }); + this.properties = new MapShapeSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale4(); + this.itemGroup = this.contentGroup.appendChild(new Group14({ name: "itemGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group14({ name: "itemLabelGroup" })); + this.datumSelection = Selection11.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection11.select( + this.itemLabelGroup, + Text6 + ); + this.highlightDatumSelection = Selection11.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this.previousLabelLayouts = void 0; + this._previousDatumMidPoint = void 0; + this.itemLabelGroup.pointerEvents = PointerEvents7.None; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + return super.hasData && this.topology != null; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [1 /* ShapeLine */, zIndex]; + this.highlightGroup.zIndex = [2 /* ShapeLineHighlight */, zIndex]; + return true; + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 1 /* Polygons */; + geoGeometry.lineJoin = "round"; + return geoGeometry; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, colorScale } = this; + const { topologyIdKey, idKey, colorKey, labelKey, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null || !containsType(feature.geometry, 1 /* Polygon */)) + continue; + featureById.set(property, feature); + } + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + valueProperty14(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty14(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }), + ...labelKey ? [valueProperty14(labelKey, "category", { id: "labelValue" })] : [], + ...colorKey ? [valueProperty14(colorKey, colorScaleType, { id: "colorValue" })] : [] + ] + }); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + this.topologyBounds = featureValues.reduce((current, feature) => { + const geometry = feature?.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + if (topology == null) { + import_ag_charts_core97.Logger.warnOnce(`no topology was provided for [MapShapeSeries]; nothing will be rendered.`); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount4(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelLayout(datum, labelValue, measurer2, geometry, previousLabelLayout) { + if (labelValue == null || geometry == null) + return; + const { idKey, idName, colorKey, colorName, labelKey, labelName, padding, label } = this.properties; + if (labelKey == null || !label.enabled) + return; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const baseSize = (0, import_ag_charts_core97.isArray)(labelText) ? (0, import_ag_charts_core97.measureTextSegments)(labelText, label) : measurer2.measureLines(String(labelText)); + const aspectRatio = (baseSize.width + 2 * padding) / (baseSize.height + 2 * padding); + if (previousLabelLayout?.geometry === geometry && previousLabelLayout?.labelText === labelText && previousLabelLayout?.aspectRatio === aspectRatio) { + return previousLabelLayout; + } + const fixedGeometry = projectGeometry(geometry, fixedScale); + const fixedPolygon = largestPolygon(fixedGeometry); + if (fixedPolygon == null) + return; + const labelPlacement = preferredLabelCenter(fixedPolygon, { + aspectRatio, + precision: 1e-3 + }); + if (labelPlacement == null) + return; + const { x, y, maxWidth } = labelPlacement; + return { geometry, labelText, aspectRatio, x, y, maxWidth, fixedPolygon }; + } + getLabelDatum(labelLayout, scaling) { + const { scale } = this; + if (scale == null) + return; + const { padding, label } = this.properties; + const { labelText, aspectRatio, x: untruncatedX, y, maxWidth, fixedPolygon } = labelLayout; + const maxSizeWithoutTruncation = { + width: Math.ceil(maxWidth * scaling), + height: Math.ceil(maxWidth * scaling / aspectRatio), + meta: untruncatedX + }; + const labelFormatting = formatSingleLabel( + (0, import_ag_charts_core97.toPlainText)(labelText), + label, + { padding }, + (height, allowTruncation) => { + if (!allowTruncation) { + return maxSizeWithoutTruncation; + } + const result = maxWidthInPolygonForRectOfHeight(fixedPolygon, untruncatedX, y, height / scaling); + return { + width: result.width * scaling, + height, + meta: result.x + }; + } + ); + if (labelFormatting == null) + return; + const [{ text: text2, fontSize, lineHeight, width }, formattingX] = labelFormatting; + const x = width < maxSizeWithoutTruncation.width ? untruncatedX : formattingX; + const position = this.scale.convert(fixedScale.invert([x, y])); + return { + x: position[0], + y: position[1], + text: text2, + fontSize, + lineHeight + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, properties, scale, previousLabelLayouts } = this; + const { idKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null) + return; + const scaling = scale == null ? Number.NaN : (scale.range[1][0] - scale.range[0][0]) / scale.bounds.width; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const measurer2 = (0, import_ag_charts_core97.cachedTextMeasurer)(label); + const labelLayouts = /* @__PURE__ */ new Map(); + this.previousLabelLayouts = labelLayouts; + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + if (geometry == null) { + missingGeometries.push(idValue); + } + const labelLayout = this.getLabelLayout( + datum, + labelValue, + measurer2, + geometry, + previousLabelLayouts?.get(idValue) + ); + if (labelLayout != null) { + labelLayouts.set(idValue, labelLayout); + } + const labelDatum = labelLayout != null && scale != null ? this.getLabelDatum(labelLayout, scaling) : void 0; + if (labelDatum != null) { + labelData.push(labelDatum); + } + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + nodeData.push({ + series: this, + itemId: idKey, + datum, + datumIndex, + idValue, + colorValue, + labelValue, + projectedGeometry, + legendItemName, + style: this.getItemStyle({ datum, datumIndex, colorValue }, false) + }); + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + import_ag_charts_core97.Logger.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection, labelSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId13(datum.idValue)); + } + getItemStyle({ datumIndex, datum, colorValue }, isHighlight) { + const { properties, colorScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults15(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + baseStyle.fill = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? baseStyle.fill; + } + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId13(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults15(overrides, style); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const fillBBox = getTopologyShapeFillBBox(this.scale); + datumSelection.each((geoGeometry, nodeDatum) => { + const { projectedGeometry } = nodeDatum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + applyShapeStyle12(geoGeometry, nodeDatum.style, fillBBox); + }); + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, text: text2, fontSize, lineHeight }, datumIndex) => { + const style = getLabelStyles4(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontFamily } = style; + label.visible = true; + label.x = x; + label.y = y; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.lineHeight = lineHeight; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + resetAnimation() { + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + datumMidPoint(datum) { + const { _previousDatumMidPoint } = this; + if (_previousDatumMidPoint?.datum === datum) { + return _previousDatumMidPoint.point; + } + const projectedGeometry = datum.projectedGeometry; + const polygon = projectedGeometry == null ? void 0 : largestPolygon(projectedGeometry); + const center = polygon == null ? void 0 : polygonMarkerCenter(polygon, 2); + const point = center == null ? void 0 : { x: center[0], y: center[1] }; + this._previousDatumMidPoint = { datum, point }; + return point; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + let { fill } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + fill = this.colorScale.convert(colorValue); + } + return { + marker: { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idKey, idName, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { idKey, idName, colorKey, colorName, labelKey, labelName, legendItemName, title, tooltip } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const idValue = dataModel.resolveColumnById(this, `idValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (colorValue != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + const format = this.getItemStyle({ datum, datumIndex, colorValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: idValue, + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { seriesId, datum, title, idKey, idName, colorKey, colorName, labelKey, labelName, ...format } + ); + } + computeFocusBounds(opts) { + return findFocusedGeoGeometry(this, opts); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapShapeSeries.className = "MapShapeSeries"; +MapShapeSeries.type = "map-shape"; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeriesOptionsDef.ts +var import_ag_charts_community223 = require("ag-charts-community"); +var import_ag_charts_core98 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs13, mapShapeSeriesThemeableOptionsDef, without: without7 } = import_ag_charts_community223._ModuleSupport; +var mapShapeSeriesOptionsDef = { + ...without7(commonSeriesOptionsDefs13, ["highlightStyle", "highlight"]), + ...mapShapeSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core98.required)((0, import_ag_charts_core98.constant)("map-shape")), + idKey: (0, import_ag_charts_core98.required)(import_ag_charts_core98.string), + colorKey: import_ag_charts_core98.string, + labelKey: import_ag_charts_core98.string, + idName: import_ag_charts_core98.string, + colorName: import_ag_charts_core98.string, + labelName: import_ag_charts_core98.string, + topology: import_ag_charts_core98.geoJson, + topologyIdKey: import_ag_charts_core98.string, + legendItemName: import_ag_charts_core98.string, + title: import_ag_charts_core98.string +}; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeModule.ts +var MapShapeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-shape", + moduleFactory: (ctx) => new MapShapeSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $mapPalette: "fill" }, + ["gradient", import_ag_charts_community224._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", import_ag_charts_community224._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community224._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }), + stroke: { $ref: "chartBackgroundColor" }, + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(import_ag_charts_community224._ModuleSupport.SAFE_RANGE2_OPERATION) + ] + }, + fillOpacity: 1, + strokeWidth: 1, + lineDash: [0], + lineDashOffset: 0, + padding: 2, + label: { + ...import_ag_charts_community224._ModuleSupport.LABEL_BOXING_DEFAULTS, + color: { $ref: "chartBackgroundColor" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: "bold", + overflowStrategy: "hide" + }, + highlight: applyMapPalette(import_ag_charts_community224._ModuleSupport.multiSeriesHighlightStyle(true)) + }, + tooltip: { + range: "exact" + } + } +}; +var MapShapeSeriesModule = { + type: "series", + name: "map-shape", + chartType: "topology", + enterprise: true, + options: mapShapeSeriesOptionsDef, + create: (ctx) => new MapShapeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundModule.ts +var import_ag_charts_community228 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeries.ts +var import_ag_charts_community226 = require("ag-charts-community"); +var import_ag_charts_core99 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeriesProperties.ts +var import_ag_charts_community225 = require("ag-charts-community"); +var { Property: Property74, SeriesProperties: SeriesProperties7, makeSeriesTooltip: makeSeriesTooltip16 } = import_ag_charts_community225._ModuleSupport; +var MapShapeBackgroundSeriesProperties = class extends SeriesProperties7 { + constructor() { + super(...arguments); + this.topology = void 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tooltip = makeSeriesTooltip16(); + } +}; +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeries.ts +var { createDatumId: createDatumId14, Selection: Selection12, Group: Group15, PointerEvents: PointerEvents8 } = import_ag_charts_community226._ModuleSupport; +var MapShapeBackgroundSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [] + }); + this.properties = new MapShapeBackgroundSeriesProperties(); + this._chartTopology = void 0; + this.itemGroup = this.contentGroup.appendChild(new Group15({ name: "itemGroup" })); + this.datumSelection = Selection12.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.itemGroup.pointerEvents = PointerEvents8.None; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get focusable() { + return false; + } + setOptionsData() { + } + setChartData() { + } + getNodeData() { + return; + } + get hasData() { + return false; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 0]; + this.highlightGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 1]; + return true; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 1 /* Polygons */; + geoGeometry.lineJoin = "round"; + geoGeometry.pointerEvents = PointerEvents8.None; + return geoGeometry; + } + processData() { + const { topology } = this; + this.topologyBounds = topology?.features.reduce((current, feature) => { + const geometry = feature.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (topology == null) { + import_ag_charts_core99.Logger.warnOnce(`no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.`); + } + } + createNodeData() { + const { id: seriesId, topology, scale, properties } = this; + if (topology == null) + return; + const { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + const nodeData = []; + const labelData = []; + for (const [index, feature] of topology.features.entries()) { + const { geometry } = feature; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (projectedGeometry == null) + continue; + nodeData.push({ + series: this, + itemId: index, + datum: feature, + datumIndex: 0, + index, + projectedGeometry, + style: { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } + }); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + const { nodeData = [] } = this.contextNodeData ?? {}; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId14(datum.index)); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + datumSelection.each((geoGeometry, datum) => { + const { projectedGeometry } = datum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(datum.style); + }); + } + resetAnimation() { + } + getLegendData() { + return []; + } + getTooltipContent(_seriesDatum) { + return; + } + pickFocus() { + return void 0; + } + computeFocusBounds(_opts) { + return void 0; + } + hasItemStylers() { + return false; + } +}; +MapShapeBackgroundSeries.className = "MapShapeBackgroundSeries"; +MapShapeBackgroundSeries.type = "map-shape-background"; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeriesOptionsDef.ts +var import_ag_charts_community227 = require("ag-charts-community"); +var import_ag_charts_core100 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs14, mapShapeBackgroundSeriesThemeableOptionsDef } = import_ag_charts_community227._ModuleSupport; +var mapShapeBackgroundSeriesOptionsDef = { + ...mapShapeBackgroundSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs14, + type: (0, import_ag_charts_core100.required)((0, import_ag_charts_core100.constant)("map-shape-background")), + topology: import_ag_charts_core100.geoJson +}; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundModule.ts +var MapShapeBackgroundModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-shape-background", + moduleFactory: (ctx) => new MapShapeBackgroundSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $path: ["/1", { $mapPalette: "fill" }, { $mapPalette: "hierarchyColors" }] }, + ["gradient", import_ag_charts_community228._ModuleSupport.FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS], + ["image", import_ag_charts_community228._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community228._ModuleSupport.FILL_PATTERN_HIERARCHY_DEFAULTS] + ] + }), + stroke: { $ref: "chartBackgroundColor" }, + strokeWidth: 1 + } + } +}; +var MapShapeBackgroundSeriesModule = { + type: "series", + name: "map-shape-background", + chartType: "topology", + enterprise: true, + options: mapShapeBackgroundSeriesOptionsDef, + create: (ctx) => new MapShapeBackgroundSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleModule.ts +var import_ag_charts_community237 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeries.ts +var import_ag_charts_community234 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBase.ts +var import_ag_charts_community230 = require("ag-charts-community"); +var import_ag_charts_core101 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/util/radialUtil.ts +var import_ag_charts_community229 = require("ag-charts-community"); +var { createDatumId: createDatumId15, mergeDefaults: mergeDefaults16, toHighlightString: toHighlightString4 } = import_ag_charts_community229._ModuleSupport; +function makeStylerParams(series, highlighted, highlightStateEnum) { + const { id: seriesId } = series; + const { + angleKey, + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + radiusKey, + stackGroup, + stroke: stroke2, + strokeOpacity, + strokeWidth + } = series.properties; + const highlightState = toHighlightString4(highlightStateEnum ?? import_ag_charts_community229._ModuleSupport.HighlightState.None); + return { + angleKey, + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + radiusKey, + seriesId, + stackGroup, + stroke: stroke2, + strokeOpacity, + strokeWidth + }; +} +function getStyle(series, ignoreStylerCallback, highlighted, highlightState) { + const { styler } = series.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = makeStylerParams(series, highlighted, highlightState); + stylerResult = series.ctx.optionsGraphService.resolvePartial( + ["series", `${series.declarationOrder}`], + series.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? series.properties.cornerRadius, + fill: stylerResult.fill ?? series.properties.fill, + fillOpacity: stylerResult.fillOpacity ?? series.properties.fillOpacity, + lineDash: stylerResult.lineDash ?? series.properties.lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? series.properties.lineDashOffset, + stroke: stylerResult.stroke ?? series.properties.stroke, + strokeOpacity: stylerResult.strokeOpacity ?? series.properties.strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? series.properties.strokeWidth, + opacity: 1 + }; +} +function makeItemStylerParams(series, nodeDatum, isHighlight, style) { + const { id: seriesId, properties } = series; + const { angleKey, radiusKey } = properties; + const activeHighlight = series.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = series.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = series.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + highlighted: isHighlight, + highlightState: highlightStateString, + angleKey, + radiusKey, + ...style, + fill + }; +} +function getItemStyle(series, nodeDatum, isHighlight, highlightState) { + const { properties } = series; + const { itemStyler } = properties; + const highlightStyle = series.getHighlightStyle(isHighlight, nodeDatum?.datumIndex, highlightState); + const baseStyle = mergeDefaults16( + highlightStyle, + getStyle(series, nodeDatum === void 0, isHighlight, highlightState) + ); + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = series.cachedDatumCallback( + createDatumId15(series.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = makeItemStylerParams(series, nodeDatum, isHighlight, style); + return series.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults16(overrides, style); + } + } + return style; +} + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBase.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS, + DEFAULT_POLAR_DIRECTION_NAMES, + ChartAxisDirection: ChartAxisDirection28, + PolarAxis, + diff: diff6, + fixNumericExtent: fixNumericExtent8, + groupAccumulativeValueProperty: groupAccumulativeValueProperty2, + keyProperty: keyProperty9, + normaliseGroupTo, + resetLabelFn: resetLabelFn5, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation5, + seriesLabelFadeOutAnimation, + valueProperty: valueProperty15, + animationValidation: animationValidation7, + createDatumId: createDatumId16, + SeriesNodePickMode: SeriesNodePickMode12, + normalizeAngle360: normalizeAngle3605, + CategoryScale: CategoryScale3, + motion: motion6, + applyShapeStyle: applyShapeStyle13, + isGradientFill: isGradientFill2, + updateLabelNode: updateLabelNode6, + getItemStyles: getItemStyles3 +} = import_ag_charts_community230._ModuleSupport; +var RadialColumnSeriesNodeEvent = class extends import_ag_charts_community230._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadialColumnSeriesBase = class extends import_ag_charts_community230._ModuleSupport.PolarSeries { + constructor(moduleCtx, { + animationResetFns + }) { + super({ + moduleCtx, + categoryKey: "angleValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES, + canHaveAxes: true, + pickModes: [SeriesNodePickMode12.NEAREST_NODE, SeriesNodePickMode12.EXACT_SHAPE_MATCH], + animationResetFns: { + ...animationResetFns, + label: resetLabelFn5 + } + }); + this.NodeEvent = RadialColumnSeriesNodeEvent; + this.groupScale = new CategoryScale3(); + this.circleCache = { r: 0, cx: 0, cy: 0 }; + } + get hasData() { + return this.getHasData("radiusValue-raw"); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection28.Angle) { + return dataModel.getDomain(this, "angleValue", "key", processedData); + } else { + const yExtent = dataModel.getDomain(this, "radiusValue-end", "value", processedData); + const fixedYExtent = Number.isFinite(yExtent[1] - yExtent[0]) ? [Math.min(yExtent[0], 0), Math.max(yExtent[1], 0)] : []; + return fixNumericExtent8(fixedYExtent); + } + } + async processData(dataController) { + const { angleKey, radiusKey, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const stackGroupId = this.getStackId(); + const stackGroupTrailingId = `${stackGroupId}-trailing`; + const extraProps = []; + if ((0, import_ag_charts_core101.isDefined)(normalizedTo)) { + extraProps.push(normaliseGroupTo([stackGroupId, stackGroupTrailingId], Math.abs(normalizedTo))); + } + if (animationEnabled && this.processedData) { + extraProps.push(diff6(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation7()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const radiusScaleType = this.axes[ChartAxisDirection28.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection28.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty9(angleKey, angleScaleType, { id: "angleValue" }), + valueProperty15(radiusKey, radiusScaleType, { + id: "radiusValue-raw", + invalidValue: null, + ...visibleProps + }), + ...groupAccumulativeValueProperty2( + radiusKey, + "normal", + { + id: `radiusValue-end`, + rangeId: `radiusValue-range`, + invalidValue: null, + groupId: stackGroupId, + separateNegative: true, + ...visibleProps + }, + radiusScaleType + ), + ...groupAccumulativeValueProperty2( + radiusKey, + "trailing", + { + id: `radiusValue-start`, + invalidValue: null, + groupId: stackGroupTrailingId, + separateNegative: true, + ...visibleProps + }, + radiusScaleType + ), + ...extraProps + ], + groupByKeys: true, + groupByData: false + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (r !== cache.r || cx !== cache.cx || cy !== cache.cy) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + isRadiusAxisReversed() { + return this.axes[ChartAxisDirection28.Radius]?.isReversed(); + } + maybeRefreshNodeData() { + const circleChanged = this.didCircleChange(); + if (!circleChanged && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection28.Radius]; + return radiusAxis instanceof PolarAxis ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + createNodeData() { + const { processedData, dataModel, groupScale } = this; + if (!dataModel || !processedData || processedData.type !== "grouped") + return; + const angleAxis = this.axes[ChartAxisDirection28.Angle]; + const radiusAxis = this.axes[ChartAxisDirection28.Radius]; + const angleScale = angleAxis?.scale; + const radiusScale = radiusAxis?.scale; + if (!angleScale || !radiusScale) { + return; + } + const angleValues = dataModel.resolveKeysById(this, `angleValue`, processedData); + const radiusStartValues = dataModel.resolveColumnById(this, `radiusValue-start`, processedData); + const radiusEndValues = dataModel.resolveColumnById(this, `radiusValue-end`, processedData); + const radiusRawValues = dataModel.resolveColumnById(this, `radiusValue-raw`, processedData); + const radiusRangeIndex = dataModel.resolveProcessedDataIndexById(this, `radiusValue-range`); + let groupPaddingInner = 0; + let groupPaddingOuter = 0; + if (angleAxis instanceof AngleCategoryAxis) { + groupPaddingInner = angleAxis.groupPaddingInner; + groupPaddingOuter = angleAxis.paddingInner; + } + const groupAngleStep = angleScale.bandwidth ?? 0; + const paddedGroupAngleStep = groupAngleStep * (1 - groupPaddingOuter); + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + groupScale.domain = Array.from({ length: visibleGroupCount }).map((_, i) => String(i)); + groupScale.range = [-paddedGroupAngleStep / 2, paddedGroupAngleStep / 2]; + groupScale.paddingInner = visibleGroupCount > 1 ? groupPaddingInner : 0; + const radiusAxisReversed = this.isRadiusAxisReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const axisTotalRadius = axisOuterRadius + axisInnerRadius; + const { angleKey, radiusKey, angleName, radiusName, legendItemName, label } = this.properties; + const radiusDomain = this.getSeriesDomain(ChartAxisDirection28.Radius); + const getLabelNodeDatum = (datum, radiusDatum, x, y) => { + const labelText = this.getLabelText( + radiusDatum, + datum, + radiusKey, + "radius", + radiusDomain, + label, + { value: radiusDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + return { x, y, text: labelText, textAlign: "center", textBaseline: "middle" }; + } + }; + const nodeData = []; + const styles = getItemStyles3( + (nodeDatum, isHighlight, highlightState) => getItemStyle(this, nodeDatum, isHighlight, highlightState) + ); + const context = { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + if (!this.visible) + return context; + const { dataSources } = processedData; + const rawData = dataSources.get(this.id)?.data ?? []; + for (const { datumIndex, group } of dataModel.forEachGroupDatum(this, processedData)) { + const datum = rawData[datumIndex]; + const angleDatum = angleValues[datumIndex]; + if (angleDatum == null) + return; + const radiusDatum = radiusRawValues[datumIndex]; + const isPositive = radiusDatum >= 0 && !Object.is(radiusDatum, -0); + const innerRadiusDatum = radiusStartValues[datumIndex]; + const outerRadiusDatum = radiusEndValues[datumIndex]; + const radiusRange = group.aggregation[radiusRangeIndex][isPositive ? 1 : 0] ?? 0; + const negative = isPositive === radiusAxisReversed; + if (innerRadiusDatum === void 0 || outerRadiusDatum === void 0) + return; + let startAngle; + let endAngle; + if (rawData.length === 1) { + startAngle = -0.5 * Math.PI; + endAngle = 1.5 * Math.PI; + } else { + const groupAngle = angleScale.convert(angleDatum); + startAngle = normalizeAngle3605(groupAngle + groupScale.convert(String(groupIndex))); + endAngle = normalizeAngle3605(startAngle + groupScale.bandwidth); + } + const angle = startAngle + groupScale.bandwidth / 2; + const innerRadius = axisTotalRadius - radiusScale.convert(innerRadiusDatum); + const outerRadius = axisTotalRadius - radiusScale.convert(outerRadiusDatum); + const midRadius = (innerRadius + outerRadius) / 2; + const stackInnerRadius = axisTotalRadius - radiusScale.convert(0); + const stackOuterRadius = axisTotalRadius - radiusScale.convert(radiusRange); + const x = Math.cos(angle) * midRadius; + const y = Math.sin(angle) * midRadius; + const labelNodeDatum = this.properties.label.enabled ? getLabelNodeDatum(datum, radiusDatum, x, y) : void 0; + const columnWidth = this.getColumnWidth(startAngle, endAngle); + nodeData.push({ + series: this, + datum, + datumIndex, + point: { x, y, size: 0 }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + negative, + innerRadius, + outerRadius, + stackInnerRadius, + stackOuterRadius, + startAngle, + endAngle, + midAngle: angle, + axisInnerRadius, + axisOuterRadius, + columnWidth, + index: datumIndex + }); + } + return { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + } + getColumnWidth(_startAngle, _endAngle) { + return Number.NaN; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updateSectorSelection(this.itemSelection, false); + this.updateSectorSelection(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateSectorSelection(selection, isHighlight) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + let selectionData = []; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + if (isHighlight) { + if (activeHighlight?.datum && activeHighlight.series === this) { + selectionData.push(activeHighlight); + } + } else { + selectionData = this.nodeData; + } + const radiusAxisReversed = this.isRadiusAxisReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const fillBBox = this.getShapeFillBBox(); + const hasItemStylers = this.hasItemStylers(); + selection.update(selectionData, void 0, (datum) => this.getDatumId(datum)).each((node, nodeDatum) => { + const { midPoint } = nodeDatum; + if (hasItemStylers) { + const highlightState = this.getHighlightState(activeHighlight, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = getItemStyle(this, nodeDatum, isHighlight, highlightState); + } + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + const fill = style.fill; + const itemBounds = isGradientFill2(fill) && fill.bounds === "item"; + const fillParams = itemBounds ? { centerX: midPoint?.x ?? 0, centerY: midPoint?.y ?? 0 } : { centerX: 0, centerY: 0, innerRadius: axisInnerRadius, outerRadius: axisOuterRadius }; + this.updateItemPath(node, nodeDatum, isHighlight); + applyShapeStyle13(node, style, fillBBox, fillParams); + node.cornerRadius = style.cornerRadius ?? 0; + node.lineJoin = "round"; + }); + } + updateLabels() { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + updateLabelNode6(this, node, this.properties, this.properties.label, datum.label, false, activeHighlight); + node.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + }); + } + animateEmptyUpdateReady() { + const { labelSelection } = this; + const fns = this.getColumnTransitionFunctions(); + motion6.fromToMotion(this.id, "datums", this.ctx.animationManager, [this.itemSelection], fns); + seriesLabelFadeInAnimation5(this, "labels", this.ctx.animationManager, labelSelection); + } + animateClearingUpdateEmpty() { + const { itemSelection } = this; + const { animationManager } = this.ctx; + const fns = this.getColumnTransitionFunctions(); + motion6.fromToMotion(this.id, "datums", animationManager, [itemSelection], fns); + seriesLabelFadeOutAnimation(this, "labels", animationManager, this.labelSelection); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip } = properties; + const angleAxis = axes[ChartAxisDirection28.Angle]; + const radiusAxis = axes[ChartAxisDirection28.Radius]; + const nodeDatum = this.nodeData?.[datumIndex]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis || !nodeDatum) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const angleValue = dataModel.resolveKeysById(this, `angleValue`, processedData)[datumIndex]; + const radiusValue = dataModel.resolveColumnById(this, `radiusValue-raw`, processedData)[datumIndex]; + if (angleValue == null) + return; + const format = getItemStyle(this, nodeDatum, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: radiusName, + fallbackLabel: radiusKey, + value: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + angleName, + radiusKey, + radiusName, + legendItemName, + ...format + } + ); + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.itemSelection.nodes()); + } + legendItemSymbol() { + const { fill, stroke: stroke2, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = getStyle( + this, + false, + false, + import_ag_charts_community230._ModuleSupport.HighlightState.None + ); + const markerStyle = { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke2 ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + if (import_ag_charts_community230._ModuleSupport.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: markerStyle + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { radiusKey, radiusName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: radiusKey, + seriesId, + enabled: visible, + label: { + text: legendItemName ?? radiusName ?? radiusKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getDatumId(datum) { + return createDatumId16(datum.angleValue); + } + computeLabelsBBox() { + return null; + } +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBaseProperties.ts +var import_ag_charts_community231 = require("ag-charts-community"); +var { SeriesProperties: SeriesProperties8, makeSeriesTooltip: makeSeriesTooltip17, Property: Property75, Label: Label12 } = import_ag_charts_community231._ModuleSupport; +var RadialColumnSeriesBaseProperties = class extends SeriesProperties8 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.label = new Label12(); + this.tooltip = makeSeriesTooltip17(); + } + getStyle() { + const { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "angleKey", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "angleName", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "radiusName", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "fill", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "stroke", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "lineDash", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "styler", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "rotation", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "stackGroup", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "normalizedTo", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "label", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleUtil.ts +var import_ag_charts_community233 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnUtil.ts +var import_ag_charts_community232 = require("ag-charts-community"); +var { motion: motion7 } = import_ag_charts_community232._ModuleSupport; +function createAngleMotionCalculator() { + const angles = { + startAngle: /* @__PURE__ */ new Map(), + endAngle: /* @__PURE__ */ new Map() + }; + const angleKeys = ["startAngle", "endAngle"]; + const calculate = (node, datum, status) => { + for (const key of angleKeys) { + const map = angles[key]; + let from2 = (status === "removed" || status === "updated" ? node : datum)[key]; + let to2 = (status === "removed" ? node : datum)[key]; + if (Number.isNaN(to2)) { + to2 = node.previousDatum?.[key] ?? Number.NaN; + } + const diff8 = from2 - to2; + if (Math.abs(diff8) > Math.PI) { + from2 -= Math.sign(diff8) * 2 * Math.PI; + } + map.set(datum, { from: from2, to: to2 }); + } + }; + const getAngles = (datum, fromToKey) => { + return { + startAngle: angles.startAngle.get(datum)[fromToKey], + endAngle: angles.endAngle.get(datum)[fromToKey] + }; + }; + const from = (datum) => getAngles(datum, "from"); + const to = (datum) => getAngles(datum, "to"); + return { calculate, from, to }; +} +function fixRadialColumnAnimationStatus(node, datum, status) { + if (status === "updated") { + if (node.previousDatum == null || Number.isNaN(node.previousDatum.startAngle) || Number.isNaN(node.previousDatum.endAngle)) { + return "added"; + } + if (Number.isNaN(datum.startAngle) || Number.isNaN(datum.endAngle)) { + return "removed"; + } + } + if (status === "added" && node.previousDatum != null) { + return "updated"; + } + return status; +} +function prepareRadialColumnAnimationFunctions(axisZeroRadius) { + const angles = createAngleMotionCalculator(); + const fromFn = (node, datum, status) => { + status = fixRadialColumnAnimationStatus(node, datum, status); + angles.calculate(node, datum, status); + const { startAngle, endAngle } = angles.from(datum); + let innerRadius; + let outerRadius; + let columnWidth; + let axisInnerRadius; + let axisOuterRadius; + if (status === "removed" || status === "updated") { + innerRadius = node.innerRadius; + outerRadius = node.outerRadius; + columnWidth = node.columnWidth; + axisInnerRadius = node.axisInnerRadius; + axisOuterRadius = node.axisOuterRadius; + } else { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + columnWidth = datum.columnWidth; + axisInnerRadius = datum.axisInnerRadius; + axisOuterRadius = datum.axisOuterRadius; + } + const phase = motion7.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { + innerRadius, + outerRadius, + columnWidth, + axisInnerRadius, + axisOuterRadius, + startAngle, + endAngle, + phase + }; + }; + const toFn = (node, datum, status) => { + const { startAngle, endAngle } = angles.to(datum); + let innerRadius; + let outerRadius; + let columnWidth; + let axisInnerRadius; + let axisOuterRadius; + if (status === "removed") { + innerRadius = node.innerRadius; + outerRadius = node.innerRadius; + columnWidth = node.columnWidth; + axisInnerRadius = node.axisInnerRadius; + axisOuterRadius = node.axisOuterRadius; + } else { + innerRadius = Number.isNaN(datum.innerRadius) ? axisZeroRadius : datum.innerRadius; + outerRadius = Number.isNaN(datum.outerRadius) ? axisZeroRadius : datum.outerRadius; + columnWidth = Number.isNaN(datum.columnWidth) ? node.columnWidth : datum.columnWidth; + axisInnerRadius = datum.axisInnerRadius; + axisOuterRadius = datum.axisOuterRadius; + } + return { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle }; + }; + return { toFn, fromFn }; +} +function resetRadialColumnSelectionFn(_node, { + innerRadius, + outerRadius, + columnWidth, + axisInnerRadius, + axisOuterRadius, + startAngle, + endAngle +}) { + return { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle }; +} + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleUtil.ts +var { SectorBox, motion: motion8 } = import_ag_charts_community233._ModuleSupport; +function getRadii(datum) { + const { negative, innerRadius, outerRadius, stackInnerRadius, stackOuterRadius } = datum; + return { + innerRadius: negative ? stackOuterRadius : stackInnerRadius, + outerRadius: negative ? stackInnerRadius : stackOuterRadius, + clipInnerRadius: negative ? outerRadius : innerRadius, + clipOuterRadius: negative ? innerRadius : outerRadius + }; +} +function prepareNightingaleAnimationFunctions(axisZeroRadius) { + const angles = createAngleMotionCalculator(); + const fromFn = (sect, datum, status) => { + status = fixRadialColumnAnimationStatus(sect, datum, status); + angles.calculate(sect, datum, status); + const { startAngle, endAngle } = angles.from(datum); + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed" || status === "updated") { + innerRadius = sect.innerRadius; + outerRadius = sect.outerRadius; + clipSector = sect.clipSector; + } else { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + } + clipSector ?? (clipSector = new SectorBox(startAngle, endAngle, innerRadius, outerRadius)); + const phase = motion8.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { innerRadius, outerRadius, startAngle, endAngle, clipSector, phase }; + }; + const toFn = (_sect, datum, status) => { + const { startAngle, endAngle } = angles.to(datum); + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed") { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + clipSector = new SectorBox(startAngle, endAngle, innerRadius, outerRadius); + } else { + let clipInnerRadius, clipOuterRadius; + ({ innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum)); + if (Number.isNaN(innerRadius)) + innerRadius = axisZeroRadius; + if (Number.isNaN(outerRadius)) + outerRadius = axisZeroRadius; + if (Number.isNaN(clipInnerRadius)) + clipInnerRadius = axisZeroRadius; + if (Number.isNaN(clipOuterRadius)) + clipOuterRadius = axisZeroRadius; + clipSector = new SectorBox(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + } + return { innerRadius, outerRadius, startAngle, endAngle, clipSector }; + }; + return { toFn, fromFn }; +} +function resetNightingaleSelectionFn(_sect, datum) { + const { startAngle, endAngle } = datum; + const { innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum); + const clipSector = new SectorBox(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + return { innerRadius, outerRadius, startAngle, endAngle, clipSector }; +} + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeries.ts +var { Sector: Sector4, SectorBox: SectorBox2, PolarZIndexMap } = import_ag_charts_community234._ModuleSupport; +var NightingaleSeries = class extends RadialColumnSeriesBase { + // TODO: Enable once the options contract has been revisited + // @TempValidate + // sectorSpacing = 1; + constructor(moduleCtx) { + super(moduleCtx, { animationResetFns: { item: resetNightingaleSelectionFn } }); + this.properties = new RadialColumnSeriesBaseProperties(); + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0, PolarZIndexMap.FOREGROUND, zIndex]; + this.highlightGroup.zIndex = [0, PolarZIndexMap.HIGHLIGHT, zIndex]; + this.labelGroup.zIndex = [0, PolarZIndexMap.LABEL, zIndex]; + return true; + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `nightingale-stack-${groupIndex}-yValues`; + } + nodeFactory() { + return new Sector4(); + } + updateItemPath(node, datum, highlight) { + const { negative } = datum; + node.centerX = 0; + node.centerY = 0; + node.startOuterCornerRadius = negative ? 0 : this.properties.cornerRadius; + node.endOuterCornerRadius = negative ? 0 : this.properties.cornerRadius; + node.startInnerCornerRadius = negative ? this.properties.cornerRadius : 0; + node.endInnerCornerRadius = negative ? this.properties.cornerRadius : 0; + if (highlight) { + const { startAngle, endAngle } = datum; + const { innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum); + node.innerRadius = innerRadius; + node.outerRadius = outerRadius; + node.startAngle = startAngle; + node.endAngle = endAngle; + node.clipSector = new SectorBox2(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + } + } + getColumnTransitionFunctions() { + const axisZeroRadius = this.isRadiusAxisReversed() ? this.radius : this.getAxisInnerRadius(); + return prepareNightingaleAnimationFunctions(axisZeroRadius); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +NightingaleSeries.className = "NightingaleSeries"; +NightingaleSeries.type = "nightingale"; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeriesOptionsDef.ts +var import_ag_charts_community235 = require("ag-charts-community"); +var import_ag_charts_core102 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs15, nightingaleSeriesThemeableOptionsDef } = import_ag_charts_community235._ModuleSupport; +var nightingaleSeriesOptionsDef = { + ...commonSeriesOptionsDefs15, + ...nightingaleSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core102.required)((0, import_ag_charts_core102.constant)("nightingale")), + angleKey: (0, import_ag_charts_core102.required)(import_ag_charts_core102.string), + radiusKey: (0, import_ag_charts_core102.required)(import_ag_charts_core102.string), + angleName: import_ag_charts_core102.string, + radiusName: import_ag_charts_core102.string, + legendItemName: import_ag_charts_core102.string, + grouped: import_ag_charts_core102.boolean, + stacked: import_ag_charts_core102.boolean, + stackGroup: import_ag_charts_core102.string, + normalizedTo: import_ag_charts_core102.number +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleThemes.ts +var import_ag_charts_community236 = require("ag-charts-community"); +var { + ThemeConstants: { POLAR_AXIS_TYPE, POLAR_AXIS_SHAPE }, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS4, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS2 +} = import_ag_charts_community236._ModuleSupport; +var NIGHTINGALE_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_SERIES_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS4], + ["pattern", FILL_PATTERN_DEFAULTS2] + ] + }, + stroke: { + $if: [{ $eq: [{ $palette: "type" }, "inbuilt"] }, { $ref: "chartBackgroundColor" }, { $palette: "stroke" }] + }, + strokeWidth: 1, + label: { + ...import_ag_charts_community236._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: import_ag_charts_community236._ModuleSupport.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE.ANGLE_CATEGORY]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE.CIRCLE }, + groupPaddingInner: 0, + paddingInner: 0, + label: { + spacing: 10 + } + }, + [POLAR_AXIS_TYPE.RADIUS_NUMBER]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE.CIRCLE } + } + } +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleModule.ts +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE2 } +} = import_ag_charts_community237._ModuleSupport; +var NightingaleModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "nightingale", + moduleFactory: (ctx) => new NightingaleSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE2.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE2.RADIUS_NUMBER }], + themeTemplate: NIGHTINGALE_SERIES_THEME, + stackable: true, + groupable: true, + stackedByDefault: true +}; +var NightingaleSeriesModule = { + type: "series", + name: "nightingale", + chartType: "polar", + enterprise: true, + options: nightingaleSeriesOptionsDef, + create: (ctx) => new NightingaleSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeries.ts +var import_ag_charts_community239 = require("ag-charts-community"); +var import_ag_charts_core103 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidProperties.ts +var import_ag_charts_community238 = require("ag-charts-community"); +var { SeriesProperties: SeriesProperties9, makeSeriesTooltip: makeSeriesTooltip18, Property: Property76, Label: Label13, DropShadow: DropShadow5 } = import_ag_charts_community238._ModuleSupport; +var PyramidSeriesLabel = class extends Label13 { +}; +var PyramidSeriesStageLabel = class extends Label13 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property76 +], PyramidSeriesStageLabel.prototype, "spacing", 2); +__decorateClass([ + Property76 +], PyramidSeriesStageLabel.prototype, "placement", 2); +var PyramidProperties = class extends SeriesProperties9 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.direction = "vertical"; + this.reverse = void 0; + this.spacing = 0; + this.aspectRatio = void 0; + this.shadow = new DropShadow5().set({ enabled: false }); + this.label = new PyramidSeriesLabel(); + this.stageLabel = new PyramidSeriesStageLabel(); + this.tooltip = makeSeriesTooltip18(); + } + getStyle(index = 0) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index % fills.length], + fillOpacity, + stroke: strokes[index % strokes.length], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property76 +], PyramidProperties.prototype, "stageKey", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "valueKey", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "fills", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "strokes", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "lineDash", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "direction", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "reverse", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "spacing", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "aspectRatio", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "shadow", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "label", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidUtil.ts +function applyPyramidDatum(connector, { x, y, top, right, bottom, left }) { + connector.x0 = x - top / 2; + connector.x1 = x + top / 2; + connector.x2 = x + bottom / 2; + connector.x3 = x - bottom / 2; + connector.y0 = y - left / 2; + connector.y1 = y - right / 2; + connector.y2 = y + right / 2; + connector.y3 = y + left / 2; +} +function preparePyramidAnimationFunctions(direction) { + const fromFn = (_connector, datum) => { + const { x, y } = datum; + let { top, right, bottom, left } = datum; + if (direction === "vertical") { + top = 0; + bottom = 0; + } else { + left = 0; + right = 0; + } + return { x, y, top, right, bottom, left }; + }; + const toFn = (_connector, datum) => { + const { x, y, top, right, bottom, left } = datum; + return { x, y, top, right, bottom, left }; + }; + const applyFn = applyPyramidDatum; + return { fromFn, toFn, applyFn }; +} + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeries.ts +var { + StateMachine: StateMachine14, + valueProperty: valueProperty16, + SeriesNodePickMode: SeriesNodePickMode13, + createDatumId: createDatumId17, + BBox: BBox22, + Group: Group16, + Selection: Selection13, + Text: Text7, + PointerEvents: PointerEvents9, + applyShapeStyle: applyShapeStyle14, + mergeDefaults: mergeDefaults17, + fromToMotion: fromToMotion4, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation6, + getLabelStyles: getLabelStyles5 +} = import_ag_charts_community239._ModuleSupport; +var PyramidSeries = class extends import_ag_charts_community239._ModuleSupport.DataModelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [SeriesNodePickMode13.EXACT_SHAPE_MATCH, SeriesNodePickMode13.NEAREST_NODE] + }); + this.properties = new PyramidProperties(); + this.itemGroup = this.contentGroup.appendChild(new Group16({ name: "itemGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group16({ name: "itemLabelGroup" })); + this.stageLabelGroup = this.contentGroup.appendChild(new Group16({ name: "stageLabelGroup" })); + this.datumSelection = Selection13.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection13.select( + this.itemLabelGroup, + Text7 + ); + this.stageLabelSelection = Selection13.select(this.stageLabelGroup, Text7); + this.highlightDatumSelection = Selection13.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this.animationState = new StateMachine14( + "empty", + { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + clear: "empty", + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + this.itemLabelGroup.pointerEvents = PointerEvents9.None; + this.stageLabelGroup.pointerEvents = PointerEvents9.None; + } + addChartEventListeners() { + this.cleanup.register(this.ctx.eventsHub.on("legend:item-click", (event) => this.onLegendItemClick(event))); + } + nodeFactory() { + return new FunnelConnector(); + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + async processData(dataController) { + if (this.data == null) + return; + const { + id: seriesId, + visible, + ctx: { legendManager } + } = this; + const { stageKey, valueKey } = this.properties; + const xScaleType = "category"; + const yScaleType = "number"; + const validation = (_value, _datum, index) => visible && legendManager.getItemEnabled({ seriesId, itemId: index }); + const visibleProps = this.visible ? {} : { forceValue: 0 }; + await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty16(stageKey, xScaleType, { id: "xValue" }), + valueProperty16(valueKey, yScaleType, { id: `yValue`, ...visibleProps, validation, invalidValue: 0 }) + ] + }); + } + createNodeData() { + const { + id: seriesId, + dataModel, + processedData, + properties, + visible, + ctx: { legendManager } + } = this; + const { + stageKey, + valueKey, + direction, + reverse = direction === "horizontal", + spacing, + aspectRatio, + label, + stageLabel + } = properties; + if (dataModel == null || processedData == null) + return; + const horizontal = direction === "horizontal"; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const xDomain = dataModel.getDomain(this, "xValue", "value", processedData); + const yDomain = dataModel.getDomain(this, "yValue", "value", processedData); + const textMeasurer = (0, import_ag_charts_core103.cachedTextMeasurer)(stageLabel); + let textAlign; + let textBaseline; + if (horizontal) { + textAlign = "center"; + textBaseline = stageLabel.placement === "before" ? "bottom" : "top"; + } else { + textAlign = stageLabel.placement === "after" ? "left" : "right"; + textBaseline = "middle"; + } + const stageLabelData = stageLabel.enabled ? [] : void 0; + let maxLabelWidth = 0; + let maxLabelHeight = 0; + let yTotal = 0; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + const enabled = visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + yTotal += yValue; + if (stageLabelData == null) + continue; + const text2 = this.getLabelText( + xValue2, + datum, + stageKey, + "x", + xDomain, + this.properties.stageLabel, + { datum, value: yValue, stageKey, valueKey } + ); + const { width, height } = (0, import_ag_charts_core103.isArray)(text2) ? (0, import_ag_charts_core103.measureTextSegments)(text2, label) : textMeasurer.measureLines(text2); + maxLabelWidth = Math.max(maxLabelWidth, width); + maxLabelHeight = Math.max(maxLabelHeight, height); + stageLabelData.push({ + x: Number.NaN, + y: Number.NaN, + text: text2, + textAlign, + textBaseline, + visible: enabled + }); + } + const seriesRectWidth = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const seriesRectHeight = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const totalSpacing = spacing * (processedData.input.count - 1); + let bounds; + if (horizontal) { + const verticalInset = maxLabelHeight + stageLabel.spacing; + bounds = new BBox22( + 0, + stageLabel.placement === "before" ? verticalInset : 0, + seriesRectWidth, + seriesRectHeight - verticalInset + ); + } else { + const horizontalInset = maxLabelWidth + stageLabel.spacing; + bounds = new BBox22( + stageLabel.placement === "after" ? 0 : horizontalInset, + 0, + seriesRectWidth - horizontalInset, + seriesRectHeight + ); + } + if (aspectRatio != null && aspectRatio !== 0) { + const directionalAspectRatio = direction === "horizontal" ? 1 / aspectRatio : aspectRatio; + const constrainedWidth = Math.min(bounds.width, bounds.height * directionalAspectRatio); + const constrainedHeight = constrainedWidth / directionalAspectRatio; + bounds = new BBox22( + bounds.x + (bounds.width - constrainedWidth) / 2, + bounds.y + (bounds.height - constrainedHeight) / 2, + constrainedWidth, + constrainedHeight + ); + } + let labelX; + let labelY; + if (horizontal) { + labelY = stageLabel.placement === "before" ? bounds.y - stageLabel.spacing : bounds.y + bounds.height + stageLabel.spacing; + } else { + labelX = stageLabel.placement === "after" ? bounds.x + bounds.width + stageLabel.spacing : bounds.x - stageLabel.spacing; + } + const availableWidth = bounds.width - (horizontal ? totalSpacing : 0); + const availableHeight = bounds.height - (horizontal ? 0 : totalSpacing); + if (availableWidth < 0 || availableHeight < 0) + return; + const nodeData = []; + const labelData = []; + let yStart = 0; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + const enabled = visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + const yEnd = yStart + yValue; + const yMidRatio = (yStart + yEnd) / (2 * yTotal); + const yRangeRatio = (yEnd - yStart) / yTotal; + const xOffset = horizontal ? availableWidth * yMidRatio + spacing * datumIndex : availableWidth * 0.5; + const yOffset = horizontal ? availableHeight * 0.5 : availableHeight * yMidRatio + spacing * datumIndex; + const x = bounds.x + xOffset; + const y = bounds.y + yOffset; + if (stageLabelData != null) { + const stageLabelDatum = stageLabelData[datumIndex]; + stageLabelDatum.x = labelX ?? x; + stageLabelDatum.y = labelY ?? y; + } + let top; + let right; + let bottom; + let left; + if (horizontal) { + const barWidth = availableWidth * yRangeRatio; + top = barWidth; + bottom = barWidth; + const y0 = (xOffset + barWidth / 2) * (availableHeight / bounds.width); + const y1 = (xOffset - barWidth / 2) * (availableHeight / bounds.width); + right = reverse ? bounds.height - y0 : y0; + left = reverse ? bounds.height - y1 : y1; + } else { + const barHeight = availableHeight * yRangeRatio; + right = barHeight; + left = barHeight; + const x0 = (yOffset - barHeight / 2) * (availableWidth / bounds.height); + const x1 = (yOffset + barHeight / 2) * (availableWidth / bounds.height); + top = reverse ? bounds.width - x0 : x0; + bottom = reverse ? bounds.width - x1 : x1; + } + const text2 = this.getLabelText( + yValue, + datum, + valueKey, + "y", + yDomain, + label, + { + datum, + value: yValue, + stageKey, + valueKey + } + ); + const labelDatum = { + x, + y, + text: text2, + textAlign: "center", + textBaseline: "middle", + visible: enabled + }; + labelData.push(labelDatum); + nodeData.push({ + series: this, + itemId: valueKey, + datum, + datumIndex, + index: datumIndex, + xValue: xValue2, + yValue, + x, + y, + top, + right, + bottom, + left, + label: labelDatum, + enabled, + midPoint: { + x, + y + }, + style: this.getItemStyle({ datumIndex, datum }, false) + }); + yStart = yEnd; + } + return { + itemId: seriesId, + nodeData, + labelData, + stageLabelData, + bounds + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update({ seriesRect }) { + this.checkResize(seriesRect); + const { datumSelection, labelSelection, stageLabelSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedDatum != null && (highlightedDatum.series !== this || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const stageLabelData = this.contextNodeData?.stageLabelData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection, isHighlight: false }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection, labelProperties: this.properties.label }); + this.stageLabelSelection = this.updateStageLabelSelection({ stageLabelData, stageLabelSelection }); + this.updateLabelNodes({ + labelSelection: stageLabelSelection, + labelProperties: this.properties.stageLabel + }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData); + } + getItemStyle({ datumIndex, datum }, isHighlight) { + const { properties } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults17(highlightStyle, properties.getStyle(datumIndex)); + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId17(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults17(overrides, style); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId, properties } = this; + const { stageKey, valueKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + stageKey, + valueKey, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const { properties } = this; + const { shadow } = properties; + const bounds = this.contextNodeData?.bounds; + const fillBBox = bounds ? { series: bounds, axis: bounds } : void 0; + datumSelection.each((connector, nodeDatum) => { + applyShapeStyle14(connector, nodeDatum.style, fillBBox); + applyPyramidDatum(connector, nodeDatum); + connector.fillShadow = shadow; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(this.properties.label.enabled ? opts.labelData : []); + } + updateStageLabelSelection(opts) { + return opts.stageLabelSelection.update(opts.stageLabelData); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, nodeDatum, datumIndex) => { + const { visible, x, y, text: text2, textAlign, textBaseline } = nodeDatum; + const style = getLabelStyles5( + this, + void 0, + this.properties, + opts.labelProperties, + false, + activeHighlight + ); + const { color: fill, fontSize, fontStyle, fontWeight, fontFamily } = style; + label.visible = visible; + label.x = x; + label.y = y; + label.text = text2; + label.fill = fill; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + label.setBoxing(style); + }); + } + computeFocusBounds(opts) { + const datum = this.getNodeData()?.[opts.datumIndex]; + if (datum === void 0) + return; + for (const node of this.datumSelection) { + if (node.datum === datum) { + return node.node; + } + } + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { stageKey, valueKey, tooltip } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, "xValue", processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const label = this.getLabelText( + xValue2, + datum, + stageKey, + "x", + dataModel.getDomain(this, "xValue", "value", processedData), + this.properties.stageLabel, + { datum, value: xValue2, stageKey, valueKey } + ); + const value = this.getLabelText( + yValue, + datum, + valueKey, + "y", + dataModel.getDomain(this, "yValue", "value", processedData), + this.properties.stageLabel, + { datum, value: yValue, stageKey, valueKey } + ); + const format = this.getItemStyle({ datumIndex, datum }, false); + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(datumIndex), + data: [{ label: (0, import_ag_charts_core103.toPlainText)(label), value: (0, import_ag_charts_core103.toPlainText)(value) }] + }, + { + seriesId, + datum, + title: void 0, + stageKey, + valueKey, + ...format + } + ); + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + legendItemSymbol(datumIndex) { + const { fills, strokes, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.properties; + const fill = fills[datumIndex] ?? "black"; + const stroke2 = strokes[datumIndex] ?? "black"; + return { + marker: { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + processedData, + dataModel, + id: seriesId, + ctx: { legendManager }, + visible + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { showInLegend } = this.properties; + const legendData = []; + const stageValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex] of rawData.entries()) { + const stageValue = stageValues[datumIndex]; + legendData.push({ + legendType: "category", + id: seriesId, + itemId: datumIndex, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { text: stageValue }, + symbol: this.legendItemSymbol(datumIndex), + hideInLegend: !showInLegend + }); + } + return legendData; + } + animateReset() { + this.ctx.animationManager.skipCurrentBatch(); + this.ctx.animationManager.stopByAnimationGroupId(this.id); + } + animateEmptyUpdateReady() { + const { datumSelection, labelSelection, properties } = this; + const fns = preparePyramidAnimationFunctions(properties.direction); + fromToMotion4(this.id, "nodes", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation6(this, "labels", this.ctx.animationManager, labelSelection); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +PyramidSeries.className = "PyramidSeries"; +PyramidSeries.type = "pyramid"; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeriesOptionsDef.ts +var import_ag_charts_community240 = require("ag-charts-community"); +var import_ag_charts_core104 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs16, pyramidSeriesThemeableOptionsDef } = import_ag_charts_community240._ModuleSupport; +var pyramidSeriesOptionsDef = { + ...pyramidSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs16, + type: (0, import_ag_charts_core104.required)((0, import_ag_charts_core104.constant)("pyramid")), + stageKey: (0, import_ag_charts_core104.required)(import_ag_charts_core104.string), + valueKey: (0, import_ag_charts_core104.required)(import_ag_charts_core104.string) +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidThemes.ts +var import_ag_charts_community241 = require("ag-charts-community"); +var { + ThemeSymbols: { DEFAULT_SHADOW_COLOUR: DEFAULT_SHADOW_COLOUR2 } +} = import_ag_charts_community241._ModuleSupport; +var PYRAMID_SERIES_THEME = { + series: { + direction: "vertical", + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + spacing: 2, + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", import_ag_charts_community241._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", import_ag_charts_community241._ModuleSupport.FILL_PATTERN_DEFAULTS], + ["image", import_ag_charts_community241._ModuleSupport.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + label: { + ...import_ag_charts_community241._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + stageLabel: { + ...import_ag_charts_community241._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 12 + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR2, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + // @ts-expect-error undocumented option + highlight: import_ag_charts_community241._ModuleSupport.singleSeriesHighlightStyle() + } +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidModule.ts +var PyramidModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "pyramid", + moduleFactory: (ctx) => new PyramidSeries(ctx), + solo: true, + themeTemplate: PYRAMID_SERIES_THEME +}; +var PyramidSeriesModule = { + type: "series", + name: "pyramid", + chartType: "standalone", + enterprise: true, + options: pyramidSeriesOptionsDef, + create: (ctx) => new PyramidSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaModule.ts +var import_ag_charts_community248 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radar/radarThemes.ts +var import_ag_charts_community242 = require("ag-charts-community"); +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE3 } +} = import_ag_charts_community242._ModuleSupport; +var BASE_RADAR_SERIES_THEME = { + series: { + stroke: { $palette: "stroke" }, + label: { + ...import_ag_charts_community242._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + marker: { + enabled: true, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community242._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", import_ag_charts_community242._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community242._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + fillOpacity: 1, + shape: "circle", + size: 6, + strokeOpacity: 1, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] } + }, + highlight: import_ag_charts_community242._ModuleSupport.multiSeriesHighlightStyle(), + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + } + }, + axes: { + [POLAR_AXIS_TYPE3.ANGLE_CATEGORY]: { + label: { + spacing: 10 + } + } + } +}; +var RADAR_LINE_SERIES_THEME = import_ag_charts_community242._ModuleSupport.mergeDefaults( + { + series: { + stroke: import_ag_charts_community242._ModuleSupport.SAFE_STROKE_FILL_OPERATION, + strokeWidth: 2 + } + }, + BASE_RADAR_SERIES_THEME +); +var RADAR_AREA_SERIES_THEME = import_ag_charts_community242._ModuleSupport.mergeDefaults( + { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", import_ag_charts_community242._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", import_ag_charts_community242._ModuleSupport.FILL_IMAGE_DEFAULTS], + ["pattern", import_ag_charts_community242._ModuleSupport.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: 0.8, + strokeWidth: 2, + marker: { + enabled: false + } + } + }, + BASE_RADAR_SERIES_THEME +); + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeries.ts +var import_ag_charts_community246 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radar/radarSeries.ts +var import_ag_charts_community244 = require("ag-charts-community"); +var import_ag_charts_core105 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/radar/radarSeriesProperties.ts +var import_ag_charts_community243 = require("ag-charts-community"); +var { Label: Label14, SeriesMarker: SeriesMarker2, SeriesProperties: SeriesProperties10, makeSeriesTooltip: makeSeriesTooltip19, Property: Property77 } = import_ag_charts_community243._ModuleSupport; +var RadarSeriesProperties = class extends SeriesProperties10 { + constructor() { + super(...arguments); + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.rotation = 0; + this.marker = new SeriesMarker2(); + this.label = new Label14(); + this.tooltip = makeSeriesTooltip19(); + this.connectMissingData = false; + } +}; +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "angleKey", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "angleName", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "radiusName", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "rotation", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "marker", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "connectMissingData", 2); + +// packages/ag-charts-enterprise/src/series/radar/radarSeries.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS2, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES2, + ChartAxisDirection: ChartAxisDirection29, + PolarAxis: PolarAxis2, + SeriesNodePickMode: SeriesNodePickMode14, + valueProperty: valueProperty17, + fixNumericExtent: fixNumericExtent9, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation7, + markerFadeInAnimation: markerFadeInAnimation2, + resetMarkerFn: resetMarkerFn2, + animationValidation: animationValidation8, + computeMarkerFocusBounds: computeMarkerFocusBounds3, + extent: extent2, + BBox: BBox23, + Group: Group17, + Path: Path12, + Selection: Selection14, + Text: Text8, + Marker: Marker5, + updateLabelNode: updateLabelNode7, + getMarkerStyles: getMarkerStyles2, + mergeDefaults: mergeDefaults18 +} = import_ag_charts_community244._ModuleSupport; +var RadarSeriesNodeEvent = class extends import_ag_charts_community244._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadarSeries = class extends import_ag_charts_community244._ModuleSupport.PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: "angleValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS2, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES2, + pickModes: [SeriesNodePickMode14.NEAREST_NODE, SeriesNodePickMode14.EXACT_SHAPE_MATCH], + canHaveAxes: true, + animationResetFns: { + item: resetMarkerFn2 + }, + clipFocusBox: false + }); + this.NodeEvent = RadarSeriesNodeEvent; + this.lineGroup = this.contentGroup.appendChild(new Group17({ name: "radar-line" })); + this.lineSelection = Selection14.select( + this.lineGroup, + Path12 + ); + this.resetInvalidToZero = false; + this.circleCache = { r: 0, cx: 0, cy: 0 }; + this.lineGroup.zIndex = 0; + this.itemGroup.zIndex = 1; + } + get hasData() { + return this.getHasData("angleValue"); + } + nodeFactory() { + return new Marker5(); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection29.Angle) { + return dataModel.getDomain(this, `angleValue`, "value", processedData); + } else { + const domain = dataModel.getDomain(this, `radiusValue`, "value", processedData); + const ext = extent2(domain.length === 0 ? domain : [0].concat(domain)); + return fixNumericExtent9(ext); + } + } + async processData(dataController) { + const { angleKey, radiusKey } = this.properties; + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + extraProps.push(animationValidation8()); + } + const radiusScaleType = this.axes[ChartAxisDirection29.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection29.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty17(angleKey, angleScaleType, { id: "angleValue" }), + valueProperty17(radiusKey, radiusScaleType, { id: "radiusValue", invalidValue: void 0 }), + ...extraProps + ] + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (!(r === cache.r && cx === cache.cx && cy === cache.cy)) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection29.Radius]; + return radiusAxis instanceof PolarAxis2 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + maybeRefreshNodeData() { + const didCircleChange = this.didCircleChange(); + if (!didCircleChange && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + createNodeData() { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return; + const { angleKey, radiusKey, angleName, radiusName, legendItemName, marker, label } = this.properties; + const angleScale = this.axes[ChartAxisDirection29.Angle]?.scale; + const radiusScale = this.axes[ChartAxisDirection29.Radius]?.scale; + if (!angleScale || !radiusScale) { + return; + } + const angleValues = dataModel.resolveColumnById(this, `angleValue`, processedData); + const radiusValues = dataModel.resolveColumnById(this, `radiusValue`, processedData); + const axisInnerRadius = this.getAxisInnerRadius(); + const radiusDomain = this.getSeriesDomain(ChartAxisDirection29.Radius); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const nodeData = rawData.map((datum, datumIndex) => { + const angleDatum = angleValues[datumIndex]; + const radiusDatum = radiusValues[datumIndex]; + const angle = angleScale.convert(angleDatum); + const radius = this.radius + axisInnerRadius - radiusScale.convert(radiusDatum); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + const x = cos * radius; + const y = sin * radius; + let labelNodeDatum; + if (label.enabled) { + const labelText = this.getLabelText( + radiusDatum, + datum, + radiusKey, + "radius", + radiusDomain, + label, + { value: radiusDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + let textAlign = "right"; + if ((0, import_ag_charts_core105.isNumberEqual)(cos, 0)) { + textAlign = "center"; + } else if (cos > 0) { + textAlign = "left"; + } + let textBaseline = "bottom"; + if ((0, import_ag_charts_core105.isNumberEqual)(sin, 0)) { + textBaseline = "middle"; + } else if (sin > 0) { + textBaseline = "top"; + } + labelNodeDatum = { + x: x + cos * marker.size, + y: y + sin * marker.size, + text: labelText, + textAlign, + textBaseline + }; + } + } + return { + series: this, + datum, + datumIndex, + index: datumIndex, + point: { x, y, size: marker.size }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + missing: !(0, import_ag_charts_core105.isFiniteNumber)(angle) || !(0, import_ag_charts_core105.isFiniteNumber)(radius) + }; + }); + return { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles: getMarkerStyles2(this, this.properties, marker) + }; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const { series } = this.ctx.highlightManager?.getActiveHighlight() ?? {}; + this.highlightGroup.visible = (animationEnabled || this.visible) && series === this; + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updatePathSelections(); + this.updateMarkerSelection(); + this.updateHighlightSelection(); + this.updatePathNodes(); + if (this.hasItemStylers()) { + this.updateDatumStyles(this.itemSelection, false); + this.updateDatumStyles(this.highlightSelection, true); + } + this.updateMarkers(this.itemSelection, false); + this.updateMarkers(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updatePathSelections() { + const pathData = this.visible ? [true] : []; + this.lineSelection.update(pathData); + } + updateMarkerSelection() { + const { marker, styler } = this.properties; + if (marker.isDirty()) { + this.itemSelection.clear(); + this.itemSelection.cleanup(); + this.itemSelection = Selection14.select(this.itemGroup, () => this.nodeFactory(), false); + } + const markersEnabled = styler == null ? marker.enabled : this.getStyle(false).marker.enabled; + const data = this.visible && marker.shape && markersEnabled ? this.nodeData : []; + this.itemSelection.update(data); + } + updateHighlightSelection() { + const { marker, styler } = this.properties; + if (marker.isDirty()) { + this.highlightSelection.clear(); + this.highlightSelection.cleanup(); + this.highlightSelection = Selection14.select(this.highlightGroup, () => this.nodeFactory(), false); + } + const markersEnabled = styler == null ? marker.enabled : this.getStyle(false).marker.enabled; + const highlighted = this.ctx.highlightManager?.getActiveHighlight(); + const data = this.visible && marker.shape && markersEnabled && highlighted?.datum ? [{ ...highlighted }] : []; + this.highlightSelection.update(data); + } + getMarkerFill(highlightedStyle) { + return highlightedStyle?.fill ?? this.getStyle(false).marker.fill; + } + getDatumStylerProperties(datum) { + const { id: seriesId, properties } = this; + const { angleKey, radiusKey } = properties; + return { + seriesId, + datum, + angleKey, + radiusKey + }; + } + updateDatumStyles(selection, isHighlight) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + selection.each((_, datum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { stroke: stroke2, strokeWidth, strokeOpacity } = stylerStyle; + datum.style = this.getMarkerStyle( + this.properties.marker, + datum, + this.getDatumStylerProperties(datum.datum), + { isHighlight, highlightState }, + stylerStyle.marker, + { + stroke: stroke2, + strokeWidth, + strokeOpacity + } + ); + }); + } + updateMarkers(selection, isHighlight) { + const fillBBox = this.getShapeFillBBox(); + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + selection.each((node, datum) => { + const style = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style, node, datum.point, fillBBox); + }); + } + updateLabels() { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + if (datum.label) { + const isHighlight = false; + node.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + updateLabelNode7(this, node, properties, properties.label, datum.label, isHighlight, activeHighlight); + } + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip, marker } = properties; + const angleAxis = axes[ChartAxisDirection29.Angle]; + const radiusAxis = axes[ChartAxisDirection29.Radius]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const angleValue = dataModel.resolveColumnById(this, `angleValue`, processedData)[datumIndex]; + const radiusValue = dataModel.resolveColumnById(this, `radiusValue`, processedData)[datumIndex]; + if (angleValue == null) + return; + const activeStyle = this.getMarkerStyle(marker, { datum, datumIndex }, this.getDatumStylerProperties(datum), { + isHighlight: false + }); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: radiusName, + fallbackLabel: radiusKey, + value: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + radiusKey, + angleName, + radiusName, + legendItemName, + ...activeStyle + } + ); + } + legendItemSymbol() { + const { stroke: stroke2, strokeWidth, strokeOpacity, lineDash, marker } = this.getStyle(false); + const markerStyle = { + shape: marker.shape, + enabled: marker.enabled || strokeWidth <= 0, + fill: this.getMarkerFill() ?? marker.stroke ?? stroke2 ?? "rgba(0, 0, 0, 0)", + stroke: marker.stroke ?? stroke2 ?? "rgba(0, 0, 0, 0)", + fillOpacity: marker.fillOpacity, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }; + return { + marker: markerStyle, + line: { + stroke: stroke2, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { radiusKey, radiusName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: radiusKey, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: radiusKey }), + label: { + text: legendItemName ?? radiusName ?? radiusKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + pickNodeClosestDatum(hitPoint) { + const { nodeData, centerX: cx, centerY: cy } = this; + const { x, y } = hitPoint; + const radius = this.radius; + const distanceFromCenter = Math.hypot(x - cx, y - cy); + if (distanceFromCenter > radius + this.properties.marker.size) { + return; + } + let minDistance = Infinity; + let closestDatum; + for (const datum of nodeData) { + const { point: { x: datumX = Number.NaN, y: datumY = Number.NaN } = {} } = datum; + if (Number.isNaN(datumX) || Number.isNaN(datumY)) { + continue; + } + const distance = Math.hypot(hitPoint.x - datumX - cx, hitPoint.y - datumY - cy); + if (distance < minDistance) { + minDistance = distance; + closestDatum = datum; + } + } + if (closestDatum) { + const distance = Math.max(minDistance - (closestDatum.point?.size ?? 0), 0); + return { datum: closestDatum, distance }; + } + } + computeLabelsBBox() { + const { label } = this.properties; + this.maybeRefreshNodeData(); + const textBoxes = []; + const tempText = new Text8(); + for (const nodeDatum of this.nodeData) { + if (!label.enabled || !nodeDatum.label) { + continue; + } + tempText.text = nodeDatum.label.text; + tempText.x = nodeDatum.label.x; + tempText.y = nodeDatum.label.y; + tempText.setFont(label); + tempText.setAlign(nodeDatum.label); + const box = tempText.getBBox(); + textBoxes.push(box); + } + if (textBoxes.length === 0) { + return null; + } + return BBox23.merge(textBoxes); + } + getLineNode() { + return this.lineSelection?.at(0); + } + beforePathAnimation() { + this.updatePathNodes(); + } + getPathNodesStyle() { + const highlightDatum = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightState(highlightDatum); + const highlightStyle = this.getHighlightStyle(void 0, void 0, highlightState); + const stylerStyle = this.getStyle(false, highlightState); + return mergeDefaults18(highlightStyle, stylerStyle); + } + getLinePoints() { + const { nodeData, resetInvalidToZero } = this; + const { connectMissingData } = this.properties; + if (nodeData.length === 0) { + return []; + } + const radiusAxis = this.axes[ChartAxisDirection29.Radius]; + const angleAxis = this.axes[ChartAxisDirection29.Angle]; + const reversedAngleAxis = angleAxis?.isReversed(); + const reversedRadiusAxis = radiusAxis?.isReversed(); + const data = reversedRadiusAxis && !reversedAngleAxis ? [...nodeData].reverse() : nodeData; + const points = []; + let prevPointInvalid = false; + let firstValid; + for (const [index, datum] of data.entries()) { + let { x, y } = datum.point; + const isPointInvalid = Number.isNaN(x) || Number.isNaN(y); + if (!isPointInvalid) { + firstValid ?? (firstValid = datum); + } + if (isPointInvalid && !connectMissingData) { + x = 0; + y = 0; + } + const moveTo2 = index === 0 || !resetInvalidToZero && !connectMissingData && (isPointInvalid || prevPointInvalid); + points.push({ x, y, moveTo: moveTo2 }); + prevPointInvalid = isPointInvalid; + } + if (firstValid !== void 0) { + points.push({ x: firstValid.point.x, y: firstValid.point.y, moveTo: false }); + } + return points; + } + animateSinglePath(pathNode, points, ratio3) { + const { path } = pathNode; + path.clear(true); + const axisInnerRadius = this.getAxisInnerRadius(); + const radiusAxis = this.axes[ChartAxisDirection29.Radius]; + const reversedRadiusAxis = radiusAxis?.isReversed(); + const radiusZero = reversedRadiusAxis ? this.radius + axisInnerRadius - radiusAxis?.scale.convert(0) : axisInnerRadius; + for (const point of points) { + const { x: x1, y: y1, arc, radius = 0, startAngle = 0, endAngle = 0, moveTo: moveTo2 } = point; + const angle = Math.atan2(y1, x1); + const x0 = radiusZero * Math.cos(angle); + const y0 = radiusZero * Math.sin(angle); + const t = ratio3; + const x = x0 * (1 - t) + x1 * t; + const y = y0 * (1 - t) + y1 * t; + if (arc) { + path.arc(x1, y1, radius, startAngle, endAngle); + } else if (moveTo2) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + pathNode.checkPathDirty(); + } + animatePaths(ratio3) { + const linePoints = this.getLinePoints(); + const lineNode = this.getLineNode(); + if (!lineNode) + return; + this.animateSinglePath(lineNode, linePoints, ratio3); + } + animateEmptyUpdateReady() { + const { itemSelection, labelSelection } = this; + const { animationManager } = this.ctx; + this.beforePathAnimation(); + animationManager.animate({ + id: `${this.id}_'path`, + groupId: this.id, + from: 0, + to: 1, + phase: "initial", + collapsable: false, + onUpdate: (ratio3) => this.animatePaths(ratio3), + onStop: () => this.animatePaths(1) + }); + markerFadeInAnimation2(this, animationManager, "added", itemSelection); + seriesLabelFadeInAnimation7(this, "labels", animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + super.animateWaitingUpdateReady(data); + this.resetPaths(); + } + animateReadyResize(data) { + super.animateReadyResize(data); + this.resetPaths(); + } + resetPaths() { + const lineNode = this.getLineNode(); + if (lineNode) { + const { path: linePath } = lineNode; + const linePoints = this.getLinePoints(); + const stylerStyle = this.getStyle(false); + lineNode.fill = void 0; + lineNode.stroke = stylerStyle.stroke; + lineNode.strokeWidth = stylerStyle.strokeWidth; + lineNode.strokeOpacity = stylerStyle.strokeOpacity; + lineNode.lineDash = stylerStyle.lineDash; + lineNode.lineDashOffset = stylerStyle.lineDashOffset; + linePath.clear(true); + for (const { x, y, moveTo: moveTo2 } of linePoints) { + if (moveTo2) { + linePath.moveTo(x, y); + } else { + linePath.lineTo(x, y); + } + } + lineNode.checkPathDirty(); + return stylerStyle; + } + } + getStylerResult(stylerResult, highlighted, highlightState) { + const { styler } = this.properties; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + const cbResult = this.cachedCallWithContext(styler, stylerParams) ?? {}; + const resolved = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + cbResult, + { pick: false } + ); + if (resolved) { + stylerResult = resolved; + } + } + return stylerResult; + } + getFormattedMarkerStyle(datum) { + const { angleKey, radiusKey } = this.properties; + return this.getMarkerStyle(this.properties.marker, datum, { angleKey, radiusKey }, { isHighlight: true }); + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds3(this, opts); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RadarSeries.className = "RadarSeries"; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeriesProperties.ts +var import_ag_charts_community245 = require("ag-charts-community"); +var { Property: Property78 } = import_ag_charts_community245._ModuleSupport; +var RadarAreaSeriesProperties = class extends RadarSeriesProperties { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + } +}; +__decorateClass([ + Property78 +], RadarAreaSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property78 +], RadarAreaSeriesProperties.prototype, "fillOpacity", 2); + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeries.ts +var { + ChartAxisDirection: ChartAxisDirection30, + Group: Group18, + HighlightState: HighlightState4, + Path: Path13, + PointerEvents: PointerEvents10, + Selection: Selection15, + applyShapeStyle: applyShapeStyle15, + toHighlightString: toHighlightString5 +} = import_ag_charts_community246._ModuleSupport; +var RadarAreaSeries = class extends RadarSeries { + constructor(moduleCtx) { + super(moduleCtx); + this.properties = new RadarAreaSeriesProperties(); + this.areaGroup = this.contentGroup.appendChild(new Group18({ name: "radar-area" })); + this.areaSelection = Selection15.select( + this.areaGroup, + Path13 + ); + this.resetInvalidToZero = true; + this.areaGroup.zIndex = -1; + } + updatePathSelections() { + const pathData = this.visible ? [true] : []; + this.areaSelection.update(pathData); + super.updatePathSelections(); + } + getAreaNode() { + return this.areaSelection.at(0); + } + getMarkerFill(highlightedStyle) { + if (highlightedStyle?.fill != null) + return highlightedStyle.fill; + const stylerStyle = this.getStyle(false); + return stylerStyle.marker.fill ?? stylerStyle.fill; + } + updatePathNodes() { + const styles = this.getPathNodesStyle(); + const { fill, fillOpacity, strokeWidth, stroke: stroke2, strokeOpacity, lineDash, lineDashOffset, opacity } = styles; + const lineNode = this.getLineNode(); + if (lineNode) { + lineNode.setProperties({ + fill: void 0, + lineJoin: "round", + lineCap: "round", + pointerEvents: PointerEvents10.None, + opacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + } + const areaNode = this.getAreaNode(); + if (areaNode) { + applyShapeStyle15(areaNode, { fill, fillOpacity, stroke: void 0 }, this.getShapeFillBBox()); + areaNode.setProperties({ + lineJoin: "round", + pointerEvents: PointerEvents10.None, + opacity + }); + } + } + animatePaths(ratio3) { + super.animatePaths(ratio3); + const areaNode = this.getAreaNode(); + if (areaNode) { + this.animateSinglePath(areaNode, this.getAreaPoints(), ratio3); + } + } + getAreaPoints() { + const points = this.getLinePoints(); + const getPolarAxis = (direction) => { + const axis = this.axes[direction]; + return axis instanceof import_ag_charts_community246._ModuleSupport.PolarAxis ? axis : void 0; + }; + const radiusAxis = getPolarAxis(ChartAxisDirection30.Radius); + const angleAxis = getPolarAxis(ChartAxisDirection30.Angle); + const reversedRadiusAxis = radiusAxis?.isReversed(); + if (!reversedRadiusAxis) { + return points; + } + const zeroLinePoints = angleAxis?.getAxisLinePoints()?.points ?? []; + return points.concat(...zeroLinePoints); + } + resetPaths() { + const superStyle = super.resetPaths(); + const areaNode = this.getAreaNode(); + if (areaNode) { + const { path: areaPath } = areaNode; + const areaPoints = this.getAreaPoints(); + const stylerStyle = superStyle ?? this.getStyle(false); + const fillBBox = this.getShapeFillBBox(); + applyShapeStyle15( + areaNode, + { + fill: stylerStyle.fill, + stroke: void 0, + fillOpacity: stylerStyle.fillOpacity, + lineDash: stylerStyle.lineDash, + lineDashOffset: stylerStyle.lineDashOffset + }, + fillBBox + ); + areaNode.lineJoin = areaNode.lineCap = "round"; + areaPath.clear(true); + for (const { x, y, moveTo: moveTo2, arc, radius = 0, startAngle = 0, endAngle = 0 } of areaPoints) { + if (arc) { + areaPath.arc(x, y, radius, startAngle, endAngle); + } else if (moveTo2) { + areaPath.moveTo(x, y); + } else { + areaPath.lineTo(x, y); + } + } + areaPath.closePath(); + areaNode.checkPathDirty(); + return stylerStyle; + } + } + makeStylerParams(highlighted, highlightStateEnum) { + const { properties } = this; + const highlightState = toHighlightString5(highlightStateEnum ?? HighlightState4.None); + return { + marker: { + fill: properties.marker.fill, + fillOpacity: properties.marker.fillOpacity, + size: properties.marker.size, + shape: properties.marker.shape, + stroke: properties.marker.stroke, + strokeOpacity: properties.marker.strokeOpacity, + strokeWidth: properties.marker.strokeWidth, + lineDash: properties.marker.lineDash, + lineDashOffset: properties.marker.lineDashOffset + }, + highlightState, + highlighted, + fill: properties.fill, + fillOpacity: properties.fillOpacity, + lineDash: properties.lineDash, + lineDashOffset: properties.lineDashOffset, + seriesId: this.id, + stroke: properties.stroke, + strokeOpacity: properties.strokeOpacity, + strokeWidth: properties.strokeWidth, + angleKey: properties.angleKey, + radiusKey: properties.radiusKey + }; + } + getStyle(highlighted, highlightState) { + const { marker, fill, fillOpacity, lineDash, lineDashOffset, stroke: stroke2, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill: markerFill = "transparent", fillOpacity: markerFillOpacity } = marker; + const stylerResult = this.getStylerResult({}, highlighted, highlightState); + stylerResult.marker ?? (stylerResult.marker = {}); + return { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke2, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? markerFill, + fillOpacity: stylerResult.marker.fillOpacity ?? markerFillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke2, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } +}; +RadarAreaSeries.className = "RadarAreaSeries"; +RadarAreaSeries.type = "radar-area"; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeriesOptionsDef.ts +var import_ag_charts_community247 = require("ag-charts-community"); +var import_ag_charts_core106 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs17, radarAreaSeriesThemeableOptionsDef } = import_ag_charts_community247._ModuleSupport; +var radarAreaSeriesOptionsDef = { + ...commonSeriesOptionsDefs17, + ...radarAreaSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core106.required)((0, import_ag_charts_core106.constant)("radar-area")), + angleKey: (0, import_ag_charts_core106.required)(import_ag_charts_core106.string), + radiusKey: (0, import_ag_charts_core106.required)(import_ag_charts_core106.string), + angleName: import_ag_charts_core106.string, + radiusName: import_ag_charts_core106.string, + legendItemName: import_ag_charts_core106.string +}; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaModule.ts +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE4 } +} = import_ag_charts_community248._ModuleSupport; +var RadarAreaModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radar-area", + moduleFactory: (ctx) => new RadarAreaSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE4.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE4.RADIUS_NUMBER }], + themeTemplate: RADAR_AREA_SERIES_THEME +}; +var RadarAreaSeriesModule = { + type: "series", + name: "radar-area", + chartType: "polar", + enterprise: true, + options: radarAreaSeriesOptionsDef, + create: (ctx) => new RadarAreaSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineModule.ts +var import_ag_charts_community251 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineSeries.ts +var import_ag_charts_community249 = require("ag-charts-community"); +var { HighlightState: HighlightState5, PointerEvents: PointerEvents11, toHighlightString: toHighlightString6 } = import_ag_charts_community249._ModuleSupport; +var RadarLineSeries = class extends RadarSeries { + constructor() { + super(...arguments); + this.properties = new RadarSeriesProperties(); + } + updatePathSelections() { + this.lineSelection.update(this.visible ? [true] : []); + } + updatePathNodes() { + const lineNode = this.getLineNode(); + if (!lineNode) + return; + const style = this.getPathNodesStyle(); + const { strokeWidth, stroke: stroke2, strokeOpacity, lineDash, lineDashOffset, opacity } = style; + lineNode.setProperties({ + fill: void 0, + lineJoin: "round", + lineCap: "round", + pointerEvents: PointerEvents11.None, + opacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { properties } = this; + const highlightState = toHighlightString6(highlightStateEnum ?? HighlightState5.None); + return { + marker: { + fill: properties.marker.fill, + fillOpacity: properties.marker.fillOpacity, + size: properties.marker.size, + shape: properties.marker.shape, + stroke: properties.marker.stroke, + strokeOpacity: properties.marker.strokeOpacity, + strokeWidth: properties.marker.strokeWidth, + lineDash: properties.marker.lineDash, + lineDashOffset: properties.marker.lineDashOffset + }, + highlightState, + highlighted, + lineDash: properties.lineDash, + lineDashOffset: properties.lineDashOffset, + seriesId: this.id, + stroke: properties.stroke, + strokeOpacity: properties.strokeOpacity, + strokeWidth: properties.strokeWidth, + angleKey: properties.angleKey, + radiusKey: properties.radiusKey + }; + } + getStyle(highlighted, highlightState) { + const { marker, lineDash, lineDashOffset, stroke: stroke2, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill = "transparent", fillOpacity } = marker; + const stylerResult = this.getStylerResult({}, highlighted, highlightState); + stylerResult.marker ?? (stylerResult.marker = {}); + return { + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke2, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? fill, + fillOpacity: stylerResult.marker.fillOpacity ?? fillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke2, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } +}; +RadarLineSeries.className = "RadarLineSeries"; +RadarLineSeries.type = "radar-line"; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineSeriesOptionsDef.ts +var import_ag_charts_community250 = require("ag-charts-community"); +var import_ag_charts_core107 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs18, radarLineSeriesThemeableOptionsDef } = import_ag_charts_community250._ModuleSupport; +var radarLineSeriesOptionsDef = { + ...commonSeriesOptionsDefs18, + ...radarLineSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core107.required)((0, import_ag_charts_core107.constant)("radar-line")), + angleKey: (0, import_ag_charts_core107.required)(import_ag_charts_core107.string), + radiusKey: (0, import_ag_charts_core107.required)(import_ag_charts_core107.string), + angleName: import_ag_charts_core107.string, + radiusName: import_ag_charts_core107.string, + legendItemName: import_ag_charts_core107.string +}; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE5 } = import_ag_charts_community251._ModuleSupport.ThemeConstants; +var RadarLineModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radar-line", + moduleFactory: (ctx) => new RadarLineSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE5.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE5.RADIUS_NUMBER }], + themeTemplate: RADAR_LINE_SERIES_THEME +}; +var RadarLineSeriesModule = { + type: "series", + name: "radar-line", + chartType: "polar", + enterprise: true, + options: radarLineSeriesOptionsDef, + create: (ctx) => new RadarLineSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarModule.ts +var import_ag_charts_community257 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeries.ts +var import_ag_charts_community254 = require("ag-charts-community"); +var import_ag_charts_core108 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeriesProperties.ts +var import_ag_charts_community252 = require("ag-charts-community"); +var { SeriesProperties: SeriesProperties11, makeSeriesTooltip: makeSeriesTooltip20, Property: Property79, Label: Label15 } = import_ag_charts_community252._ModuleSupport; +var RadialBarSeriesProperties = class extends SeriesProperties11 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.label = new Label15(); + this.tooltip = makeSeriesTooltip20(); + } + getStyle() { + const { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "angleKey", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "angleName", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "radiusName", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "rotation", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "stackGroup", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "normalizedTo", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarUtil.ts +var import_ag_charts_community253 = require("ag-charts-community"); +var { SectorBox: SectorBox3, motion: motion9 } = import_ag_charts_community253._ModuleSupport; +function fixRadialBarAnimationStatus(node, datum, status) { + if (status === "updated") { + if (node.previousDatum == null || Number.isNaN(node.previousDatum.innerRadius) || Number.isNaN(node.previousDatum.outerRadius)) { + return "added"; + } + if (Number.isNaN(datum.innerRadius) || Number.isNaN(datum.outerRadius)) { + return "removed"; + } + } + if (status === "added" && node.previousDatum != null) { + return "updated"; + } + return status; +} +function prepareRadialBarSeriesAnimationFunctions(axisZeroAngle) { + const fromFn = (sect, datum, status) => { + status = fixRadialBarAnimationStatus(sect, datum, status); + let startAngle; + let endAngle; + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed" || status === "updated") { + startAngle = sect.startAngle; + endAngle = sect.endAngle; + innerRadius = sect.innerRadius; + outerRadius = sect.outerRadius; + clipSector = sect.clipSector; + } else { + startAngle = axisZeroAngle; + endAngle = axisZeroAngle; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + } + clipSector ?? (clipSector = new SectorBox3(startAngle, endAngle, innerRadius, outerRadius)); + const phase = motion9.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { startAngle, endAngle, innerRadius, outerRadius, clipSector, phase }; + }; + const toFn = (sect, datum, status) => { + let startAngle; + let endAngle; + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed") { + startAngle = axisZeroAngle; + endAngle = axisZeroAngle; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + clipSector = new SectorBox3(startAngle, endAngle, innerRadius, outerRadius); + } else { + startAngle = datum.startAngle; + endAngle = datum.endAngle; + innerRadius = Number.isNaN(datum.innerRadius) ? sect.innerRadius : datum.innerRadius; + outerRadius = Number.isNaN(datum.outerRadius) ? sect.outerRadius : datum.outerRadius; + clipSector = datum.clipSector; + } + return { startAngle, endAngle, innerRadius, outerRadius, clipSector }; + }; + return { toFn, fromFn }; +} +function resetRadialBarSelectionsFn(_node, datum) { + return { + centerX: 0, + centerY: 0, + innerRadius: datum.innerRadius, + outerRadius: datum.outerRadius, + startAngle: datum.startAngle, + endAngle: datum.endAngle, + clipSector: datum.clipSector + }; +} + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeries.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS3, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES3, + ChartAxisDirection: ChartAxisDirection31, + PolarAxis: PolarAxis3, + diff: diff7, + groupAccumulativeValueProperty: groupAccumulativeValueProperty3, + keyProperty: keyProperty10, + normaliseGroupTo: normaliseGroupTo2, + valueProperty: valueProperty18, + fixNumericExtent: fixNumericExtent10, + resetLabelFn: resetLabelFn6, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation8, + seriesLabelFadeOutAnimation: seriesLabelFadeOutAnimation2, + animationValidation: animationValidation9, + angleBetween: angleBetween3, + createDatumId: createDatumId18, + CategoryScale: CategoryScale4, + Sector: Sector5, + SectorBox: SectorBox4, + motion: motion10, + isGradientFill: isGradientFill3, + applyShapeStyle: applyShapeStyle16, + updateLabelNode: updateLabelNode8, + getItemStyles: getItemStyles4 +} = import_ag_charts_community254._ModuleSupport; +var RadialBarSeriesNodeEvent = class extends import_ag_charts_community254._ModuleSupport.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadialBarSeries = class extends import_ag_charts_community254._ModuleSupport.PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: "radiusValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS3, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES3, + canHaveAxes: true, + animationResetFns: { + item: resetRadialBarSelectionsFn, + label: resetLabelFn6 + } + }); + this.properties = new RadialBarSeriesProperties(); + this.NodeEvent = RadialBarSeriesNodeEvent; + this.groupScale = new CategoryScale4(); + this.circleCache = { r: 0, cx: 0, cy: 0 }; + } + get hasData() { + return this.getHasData("angleValue-raw"); + } + nodeFactory() { + return new Sector5(); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection31.Angle) { + const xExtent = dataModel.getDomain(this, "angleValue-end", "value", processedData); + const fixedXExtent = [Math.min(xExtent[0], 0), Math.max(xExtent[1], 0)]; + return fixNumericExtent10(fixedXExtent); + } else { + return dataModel.getDomain(this, "radiusValue", "key", processedData); + } + } + async processData(dataController) { + const { angleKey, radiusKey, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const stackGroupId = this.getStackId(); + const stackGroupTrailingId = `${stackGroupId}-trailing`; + const extraProps = []; + if ((0, import_ag_charts_core108.isDefined)(normalizedTo)) { + extraProps.push(normaliseGroupTo2([stackGroupId, stackGroupTrailingId], Math.abs(normalizedTo))); + } + if (animationEnabled) { + if (this.processedData) { + extraProps.push(diff7(this.id, this.processedData)); + } + extraProps.push(animationValidation9()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const radiusScaleType = this.axes[ChartAxisDirection31.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection31.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty10(radiusKey, radiusScaleType, { id: "radiusValue" }), + valueProperty18(angleKey, angleScaleType, { + id: "angleValue-raw", + invalidValue: null, + ...visibleProps + }), + ...groupAccumulativeValueProperty3( + angleKey, + "normal", + { + id: `angleValue-end`, + rangeId: `angleValue-range`, + invalidValue: null, + groupId: stackGroupId, + separateNegative: true, + ...visibleProps + }, + angleScaleType + ), + ...groupAccumulativeValueProperty3( + angleKey, + "trailing", + { + id: `angleValue-start`, + invalidValue: null, + groupId: stackGroupTrailingId, + separateNegative: true, + ...visibleProps + }, + angleScaleType + ), + ...extraProps + ], + groupByKeys: true, + groupByData: false + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (!(r === cache.r && cx === cache.cx && cy === cache.cy)) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + maybeRefreshNodeData() { + const circleChanged = this.didCircleChange(); + if (!circleChanged && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection31.Radius]; + return radiusAxis instanceof PolarAxis3 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + createNodeData() { + const { processedData, dataModel } = this; + if (!dataModel || !processedData || processedData.type !== "grouped") + return; + const angleAxis = this.axes[ChartAxisDirection31.Angle]; + const radiusAxis = this.axes[ChartAxisDirection31.Radius]; + const angleScale = angleAxis?.scale; + const radiusScale = radiusAxis?.scale; + if (!angleScale || !radiusScale) { + return; + } + const radiusValues = dataModel.resolveKeysById(this, "radiusValue", processedData); + const angleStartValues = dataModel.resolveColumnById(this, `angleValue-start`, processedData); + const angleEndValues = dataModel.resolveColumnById(this, `angleValue-end`, processedData); + const angleRawValues = dataModel.resolveColumnById(this, `angleValue-raw`, processedData); + const angleRangeIndex = dataModel.resolveProcessedDataIndexById(this, `angleValue-range`); + let groupPaddingInner = 0; + if (radiusAxis instanceof RadiusCategoryAxis) { + groupPaddingInner = radiusAxis.groupPaddingInner; + } + const { groupScale } = this; + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + groupScale.domain = Array.from({ length: visibleGroupCount }).map((_, i) => String(i)); + groupScale.range = [0, Math.abs(radiusScale.bandwidth ?? 0)]; + groupScale.paddingInner = visibleGroupCount > 1 ? groupPaddingInner : 0; + const barWidth = groupScale.bandwidth >= 1 ? groupScale.bandwidth : groupScale.rawBandwidth; + const angleAxisReversed = angleAxis.isReversed(); + const radiusAxisReversed = radiusAxis.isReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const axisTotalRadius = axisOuterRadius + axisInnerRadius; + const angleDomain = this.getSeriesDomain(ChartAxisDirection31.Angle); + const { angleKey, radiusKey, angleName, radiusName, legendItemName, label } = this.properties; + const getLabelNodeDatum = (datum, angleDatum, x, y) => { + const labelText = this.getLabelText( + angleDatum, + datum, + angleKey, + "angle", + angleDomain, + label, + { value: angleDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + return { x, y, text: labelText, textAlign: "center", textBaseline: "middle" }; + } + }; + const nodeData = []; + const styles = getItemStyles4( + (nodeDatum, isHighlight, highlightState) => getItemStyle(this, nodeDatum, isHighlight, highlightState) + ); + const context = { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + if (!this.visible) + return context; + const { dataSources } = processedData; + const rawData = dataSources.get(this.id)?.data ?? []; + for (const { datumIndex, group } of dataModel.forEachGroupDatum(this, processedData)) { + const datum = rawData[datumIndex]; + const radiusDatum = radiusValues[datumIndex]; + if (radiusDatum == null) + return; + const angleDatum = angleRawValues[datumIndex]; + const angleStartDatum = angleStartValues[datumIndex]; + const angleEndDatum = angleEndValues[datumIndex]; + const isPositive = angleDatum >= 0 && !Object.is(angleDatum, -0); + const angleRange = group.aggregation[angleRangeIndex][isPositive ? 1 : 0]; + const reversed = isPositive === angleAxisReversed; + let startAngle = angleScale.convert(angleStartDatum, { clamp: true }); + let endAngle = angleScale.convert(angleEndDatum, { clamp: true }); + let rangeStartAngle = angleScale.convert(0, { clamp: true }); + let rangeEndAngle = angleScale.convert(angleRange, { clamp: true }); + if (reversed) { + [rangeStartAngle, rangeEndAngle] = [rangeEndAngle, rangeStartAngle]; + [startAngle, endAngle] = [endAngle, startAngle]; + } + const dataRadius = axisTotalRadius - radiusScale.convert(radiusDatum); + const innerRadius = dataRadius + groupScale.convert(String(groupIndex)); + const outerRadius = innerRadius + barWidth; + const midRadius = (innerRadius + outerRadius) / 2; + const midAngle = startAngle + angleBetween3(startAngle, endAngle) / 2; + const x = Math.cos(midAngle) * midRadius; + const y = Math.sin(midAngle) * midRadius; + const labelNodeDatum = this.properties.label.enabled ? getLabelNodeDatum(datum, angleDatum, x, y) : void 0; + const clipSector = new SectorBox4(startAngle, endAngle, innerRadius, outerRadius); + nodeData.push({ + series: this, + datum, + datumIndex, + point: { x, y, size: 0 }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + innerRadius, + outerRadius, + startAngle: rangeStartAngle, + endAngle: rangeEndAngle, + clipSector, + reversed, + index: datumIndex + }); + } + return context; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updateSectorSelection(this.itemSelection, false); + this.updateSectorSelection(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateSectorSelection(selection, isHighlight) { + let selectionData = []; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + if (isHighlight) { + if (activeHighlight?.datum && activeHighlight.series === this) { + selectionData.push(activeHighlight); + } + } else { + selectionData = this.nodeData; + } + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const fillBBox = this.getShapeFillBBox(); + const hasItemStylers = this.hasItemStylers(); + selection.update(selectionData, void 0, (datum) => this.getDatumId(datum)).each((node, nodeDatum) => { + const datum = readDatum(nodeDatum); + if (datum == null) + return; + if (hasItemStylers) { + const highlightState = this.getHighlightState(activeHighlight, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = getItemStyle(this, nodeDatum, isHighlight, highlightState); + } + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + const cornerRadius = style.cornerRadius; + const fill = style.fill; + const fillParams = import_ag_charts_community254._ModuleSupport.isGradientFill(fill) && fill.bounds !== "item" ? { centerX: 0, centerY: 0 } : void 0; + applyShapeStyle16(node, style, fillBBox, fillParams); + node.lineJoin = "round"; + node.inset = node.stroke == null ? 0 : node.strokeWidth / 2; + node.startInnerCornerRadius = datum.reversed ? cornerRadius : 0; + node.startOuterCornerRadius = datum.reversed ? cornerRadius : 0; + node.endInnerCornerRadius = datum.reversed ? 0 : cornerRadius; + node.endOuterCornerRadius = datum.reversed ? 0 : cornerRadius; + if (isHighlight) { + node.startAngle = nodeDatum.startAngle; + node.endAngle = nodeDatum.endAngle; + node.clipSector = nodeDatum.clipSector; + node.innerRadius = nodeDatum.innerRadius; + node.outerRadius = nodeDatum.outerRadius; + } + }); + } + updateLabels() { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + const isHighlight = false; + updateLabelNode8(this, node, properties, properties.label, datum.label, isHighlight, activeHighlight); + node.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + }); + } + getBarTransitionFunctions() { + const angleScale = this.axes[ChartAxisDirection31.Angle]?.scale; + let axisZeroAngle = 0; + if (!angleScale) { + return prepareRadialBarSeriesAnimationFunctions(axisZeroAngle); + } + const d0 = Math.min(angleScale.domain[0], angleScale.domain[1]); + const d1 = Math.max(angleScale.domain[0], angleScale.domain[1]); + if (d0 <= 0 && d1 >= 0) { + axisZeroAngle = angleScale.convert(0); + } + return prepareRadialBarSeriesAnimationFunctions(axisZeroAngle); + } + animateEmptyUpdateReady() { + const { labelSelection } = this; + const fns = this.getBarTransitionFunctions(); + motion10.fromToMotion(this.id, "datums", this.ctx.animationManager, [this.itemSelection], fns); + seriesLabelFadeInAnimation8(this, "labels", this.ctx.animationManager, labelSelection); + } + animateClearingUpdateEmpty() { + const { itemSelection } = this; + const { animationManager } = this.ctx; + const fns = this.getBarTransitionFunctions(); + motion10.fromToMotion(this.id, "datums", animationManager, [itemSelection], fns); + seriesLabelFadeOutAnimation2(this, "labels", animationManager, this.labelSelection); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip } = properties; + const angleAxis = axes[ChartAxisDirection31.Angle]; + const radiusAxis = axes[ChartAxisDirection31.Radius]; + const nodeDatum = this.nodeData?.[datumIndex]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis || !nodeDatum) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const radiusValue = dataModel.resolveKeysById(this, `radiusValue`, processedData)[datumIndex]; + const angleValue = dataModel.resolveColumnById(this, `angleValue-raw`, processedData)[datumIndex]; + if (radiusValue == null) + return; + const format = getItemStyle(this, nodeDatum, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: angleName, + fallbackLabel: angleKey, + value: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + angleName, + radiusKey, + radiusName, + legendItemName, + ...format + } + ); + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.itemSelection.nodes()); + } + legendItemSymbol() { + const { fill, stroke: stroke2, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = getStyle( + this, + false, + false, + import_ag_charts_community254._ModuleSupport.HighlightState.None + ); + const markerStyle = { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke2 ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + if (isGradientFill3(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: markerStyle + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { angleKey, angleName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: angleKey, + seriesId, + enabled: visible, + label: { + text: legendItemName ?? angleName ?? angleKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getDatumId(datum) { + return createDatumId18(datum.radiusValue); + } + computeLabelsBBox() { + return null; + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `radialBar-stack-${groupIndex}-xValues`; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +RadialBarSeries.className = "RadialBarSeries"; +RadialBarSeries.type = "radial-bar"; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeriesOptionsDef.ts +var import_ag_charts_community255 = require("ag-charts-community"); +var import_ag_charts_core109 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs19, radialBarSeriesThemeableOptionsDef } = import_ag_charts_community255._ModuleSupport; +var radialBarSeriesOptionsDef = { + ...commonSeriesOptionsDefs19, + ...radialBarSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core109.required)((0, import_ag_charts_core109.constant)("radial-bar")), + angleKey: (0, import_ag_charts_core109.required)(import_ag_charts_core109.string), + radiusKey: (0, import_ag_charts_core109.required)(import_ag_charts_core109.string), + angleName: import_ag_charts_core109.string, + radiusName: import_ag_charts_core109.string, + legendItemName: import_ag_charts_core109.string, + grouped: import_ag_charts_core109.boolean, + stacked: import_ag_charts_core109.boolean, + stackGroup: import_ag_charts_core109.string, + normalizedTo: import_ag_charts_core109.number +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarThemes.ts +var import_ag_charts_community256 = require("ag-charts-community"); +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE6 }, + FILL_GRADIENT_CONIC_SERIES_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS5, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS3 +} = import_ag_charts_community256._ModuleSupport; +var RADIAL_BAR_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_CONIC_SERIES_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS5], + ["pattern", FILL_PATTERN_DEFAULTS3] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + label: { + ...import_ag_charts_community256._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + highlight: import_ag_charts_community256._ModuleSupport.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE6.RADIUS_CATEGORY]: { + innerRadiusRatio: 0.2, + groupPaddingInner: 0.2, + paddingInner: 0.2, + paddingOuter: 0.1 + } + } +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE7 } = import_ag_charts_community257._ModuleSupport.ThemeConstants; +var RadialBarModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radial-bar", + moduleFactory: (ctx) => new RadialBarSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE7.ANGLE_NUMBER }, { type: POLAR_AXIS_TYPE7.RADIUS_CATEGORY }], + themeTemplate: RADIAL_BAR_SERIES_THEME, + stackable: true, + groupable: true +}; +var RadialBarSeriesModule = { + type: "series", + name: "radial-bar", + chartType: "polar", + enterprise: true, + options: radialBarSeriesOptionsDef, + create: (ctx) => new RadialBarSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnModule.ts +var import_ag_charts_community262 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeries.ts +var import_ag_charts_community259 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesProperties.ts +var import_ag_charts_community258 = require("ag-charts-community"); +var { Property: Property80 } = import_ag_charts_community258._ModuleSupport; +var RadialColumnSeriesProperties = class extends RadialColumnSeriesBaseProperties { +}; +__decorateClass([ + Property80 +], RadialColumnSeriesProperties.prototype, "columnWidthRatio", 2); +__decorateClass([ + Property80 +], RadialColumnSeriesProperties.prototype, "maxColumnWidthRatio", 2); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeries.ts +var { ChartAxisDirection: ChartAxisDirection32, PolarAxis: PolarAxis4, RadialColumnShape, getRadialColumnWidth } = import_ag_charts_community259._ModuleSupport; +var RadialColumnSeries = class extends RadialColumnSeriesBase { + constructor(moduleCtx) { + super(moduleCtx, { + animationResetFns: { + item: resetRadialColumnSelectionFn + } + }); + this.properties = new RadialColumnSeriesProperties(); + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `radarColumn-stack-${groupIndex}-yValues`; + } + nodeFactory() { + return new RadialColumnShape(); + } + getColumnTransitionFunctions() { + const axisZeroRadius = this.isRadiusAxisReversed() ? this.radius : this.getAxisInnerRadius(); + return prepareRadialColumnAnimationFunctions(axisZeroRadius); + } + isRadiusAxisCircle() { + const radiusAxis = this.axes[ChartAxisDirection32.Radius]; + return radiusAxis instanceof PolarAxis4 ? radiusAxis.shape === "circle" : false; + } + updateItemPath(node, datum, highlight) { + node.isBeveled = this.isRadiusAxisCircle(); + node.isRadiusAxisReversed = this.isRadiusAxisReversed(); + if (highlight) { + node.innerRadius = datum.innerRadius; + node.outerRadius = datum.outerRadius; + node.startAngle = datum.startAngle; + node.endAngle = datum.endAngle; + node.columnWidth = datum.columnWidth; + node.axisInnerRadius = datum.axisInnerRadius; + node.axisOuterRadius = datum.axisOuterRadius; + } + } + getColumnWidth(startAngle, endAngle) { + const { columnWidthRatio = 0.5, maxColumnWidthRatio = 0.5 } = this.properties; + return getRadialColumnWidth(startAngle, endAngle, this.radius, columnWidthRatio, maxColumnWidthRatio); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +RadialColumnSeries.className = "RadialColumnSeries"; +RadialColumnSeries.type = "radial-column"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesOptionsDef.ts +var import_ag_charts_community260 = require("ag-charts-community"); +var import_ag_charts_core110 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs20, radialColumnSeriesThemeableOptionsDef } = import_ag_charts_community260._ModuleSupport; +var radialColumnSeriesOptionsDef = { + ...commonSeriesOptionsDefs20, + ...radialColumnSeriesThemeableOptionsDef, + type: (0, import_ag_charts_core110.required)((0, import_ag_charts_core110.constant)("radial-column")), + angleKey: (0, import_ag_charts_core110.required)(import_ag_charts_core110.string), + radiusKey: (0, import_ag_charts_core110.required)(import_ag_charts_core110.string), + angleName: import_ag_charts_core110.string, + radiusName: import_ag_charts_core110.string, + legendItemName: import_ag_charts_core110.string, + grouped: import_ag_charts_core110.boolean, + stacked: import_ag_charts_core110.boolean, + stackGroup: import_ag_charts_core110.string, + normalizedTo: import_ag_charts_core110.number +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnThemes.ts +var import_ag_charts_community261 = require("ag-charts-community"); +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE8, POLAR_AXIS_SHAPE: POLAR_AXIS_SHAPE2 }, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS: FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS6, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS4 +} = import_ag_charts_community261._ModuleSupport; +var RADIAL_COLUMN_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2], + ["image", FILL_IMAGE_DEFAULTS6], + ["pattern", FILL_PATTERN_DEFAULTS4] + ] + }, + stroke: { $palette: "stroke" }, + columnWidthRatio: 0.5, + maxColumnWidthRatio: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + label: { + ...import_ag_charts_community261._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: import_ag_charts_community261._ModuleSupport.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE8.ANGLE_CATEGORY]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE2.CIRCLE }, + groupPaddingInner: 0, + paddingInner: 0, + label: { + spacing: 10 + } + }, + [POLAR_AXIS_TYPE8.RADIUS_NUMBER]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE2.CIRCLE }, + innerRadiusRatio: 0.5 + } + } +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE9 } = import_ag_charts_community262._ModuleSupport.ThemeConstants; +var RadialColumnModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radial-column", + moduleFactory: (ctx) => new RadialColumnSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE9.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE9.RADIUS_NUMBER }], + themeTemplate: RADIAL_COLUMN_SERIES_THEME, + stackable: true, + groupable: true +}; +var RadialColumnSeriesModule = { + type: "series", + name: "radial-column", + chartType: "polar", + enterprise: true, + options: radialColumnSeriesOptionsDef, + create: (ctx) => new RadialColumnSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeModule.ts +var import_ag_charts_community267 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeries.ts +var import_ag_charts_community266 = require("ag-charts-community"); +var import_ag_charts_core112 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeNeedle.ts +var import_ag_charts_community263 = require("ag-charts-community"); +var { SvgPath, Rotatable, Translatable, Scalable: Scalable2 } = import_ag_charts_community263._ModuleSupport; +var RadialGaugeNeedle = class extends Rotatable(Scalable2(Translatable(SvgPath))) { + constructor() { + super(...arguments); + this.scalingCenterX = 0.5; + this.scalingCenterY = 0.5; + this.rotationCenterX = 0.5; + this.rotationCenterY = 0.5; + } +}; +RadialGaugeNeedle.defaultPathData = "M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeriesProperties.ts +var import_ag_charts_community264 = require("ag-charts-community"); +var { getColorStops: getColorStops2, normalizeAngle360: normalizeAngle3606, normalizeAngle360Inclusive: normalizeAngle360Inclusive2, toDegrees } = import_ag_charts_community264._ModuleSupport; +var { BaseProperties: BaseProperties28, makeSeriesTooltip: makeSeriesTooltip21, SeriesProperties: SeriesProperties12, PropertiesArray: PropertiesArray8, AxisLabel: AxisLabel6, Property: Property81, Label: Label16 } = import_ag_charts_community264._ModuleSupport; +var RadialGaugeDefaultTargetLabelProperties = class extends Label16 { +}; +__decorateClass([ + Property81 +], RadialGaugeDefaultTargetLabelProperties.prototype, "spacing", 2); +var RadialGaugeTargetProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.label = new RadialGaugeDefaultTargetLabelProperties(); + } + getStyle() { + const { + fill = "black", + fillOpacity = 1, + stroke: stroke2 = "black", + strokeWidth = 0, + strokeOpacity = 1, + lineDash = [0], + lineDashOffset = 0 + } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "text", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "value", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "shape", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "placement", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "spacing", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "size", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "rotation", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "fill", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "stroke", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "lineDash", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "label", 2); +var RadialGaugeBarProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.enabled = true; + this.fills = new PropertiesArray8(import_ag_charts_community264._ModuleSupport.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(defaultColorRange, scale) { + const { + enabled, + fill, + fills, + fillMode, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const barFill = enabled ? fill ?? createConicGradient(fills, fillMode, defaultColorRange, scale) : "none"; + return { + fill: barFill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "enabled", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "fills", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "fillMode", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "lineDashOffset", 2); +var RadialGaugeScaleIntervalProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.values = void 0; + this.step = void 0; + this.minSpacing = 0; + this.maxSpacing = 1e3; + } +}; +__decorateClass([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "maxSpacing", 2); +var RadialGaugeScaleLabelProperties = class extends AxisLabel6 { +}; +var RadialGaugeScaleProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.min = 0; + this.max = 1; + this.fills = new PropertiesArray8(import_ag_charts_community264._ModuleSupport.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.defaultFill = "black"; + this.interval = new RadialGaugeScaleIntervalProperties(); + this.label = new RadialGaugeScaleLabelProperties(); + } + getStyle(barEnabled, defaultColorRange, scale) { + const { + fill, + fills, + defaultFill, + fillMode, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const scaleFill = fill ?? (barEnabled && fills.length === 0 ? defaultFill : void 0) ?? createConicGradient(fills, fillMode, defaultColorRange, scale); + return { + fill: scaleFill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "min", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "max", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "fills", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "fillMode", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "fill", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "stroke", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "defaultFill", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "interval", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "label", 2); +var RadialGaugeNeedleProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.enabled = true; + this.spacing = 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "enabled", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "radiusRatio", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "spacing", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "fill", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "stroke", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "lineDashOffset", 2); +var RadialGaugeLabelProperties = class extends AutoSizedLabel { +}; +__decorateClass([ + Property81 +], RadialGaugeLabelProperties.prototype, "text", 2); +var RadialGaugeSecondaryLabelProperties = class extends AutoSizedSecondaryLabel { +}; +__decorateClass([ + Property81 +], RadialGaugeSecondaryLabelProperties.prototype, "text", 2); +var RadialGaugeSeriesProperties = class extends SeriesProperties12 { + constructor() { + super(...arguments); + this.startAngle = 0; + this.endAngle = 0; + this.segmentation = new GaugeSegmentationProperties(); + this.defaultColorRange = []; + this.targets = new PropertiesArray8(RadialGaugeTargetProperties); + this.defaultTarget = new RadialGaugeTargetProperties(); + this.outerRadiusRatio = 1; + this.innerRadiusRatio = 1; + this.cornerRadius = 0; + this.cornerMode = "container"; + this.spacing = 0; + this.scale = new RadialGaugeScaleProperties(); + this.bar = new RadialGaugeBarProperties(); + this.needle = new RadialGaugeNeedleProperties(); + this.label = new RadialGaugeLabelProperties(); + this.secondaryLabel = new RadialGaugeSecondaryLabelProperties(); + this.tooltip = makeSeriesTooltip21(); + } +}; +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "value", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "startAngle", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "endAngle", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "segmentation", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "targets", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "defaultTarget", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "outerRadiusRatio", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "innerRadiusRatio", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "outerRadius", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "innerRadius", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "cornerMode", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "spacing", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "scale", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "bar", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "needle", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "secondaryLabel", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "tooltip", 2); +function createConicGradient(fills, fillMode, defaultColorRange, scale) { + const { domain, range: range2 } = scale; + const [startAngle, endAngle] = range2; + const conicAngle = normalizeAngle3606((startAngle + endAngle) / 2 + Math.PI); + const sweepAngle = normalizeAngle360Inclusive2(endAngle - startAngle); + const colorStops = getColorStops2(fills, defaultColorRange, domain, fillMode).map( + ({ color: color6, stop }) => { + stop = Math.min(Math.max(stop, 0), 1); + const angle = startAngle + sweepAngle * stop; + stop = (angle - conicAngle) / (2 * Math.PI); + stop = (stop % 1 + 1) % 1; + return { stop, color: color6 }; + } + ); + return { + type: "gradient", + gradient: "conic", + colorSpace: "oklch", + colorStops, + bounds: "series", + rotation: toDegrees(conicAngle) + 90 + }; +} + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeUtil.ts +var import_ag_charts_community265 = require("ag-charts-community"); +var import_ag_charts_core111 = require("ag-charts-core"); +var { SectorBox: SectorBox5 } = import_ag_charts_community265._ModuleSupport; +function computeClipSector(datum) { + const { startAngle, endAngle, clipStartAngle, clipEndAngle, innerRadius, outerRadius } = datum; + if (clipStartAngle == null || clipEndAngle == null) + return; + return new SectorBox5( + Math.max(clipStartAngle, startAngle), + Math.min(clipEndAngle, endAngle), + innerRadius, + outerRadius + ); +} +function clipSectorVisibility(startAngle, endAngle, clipSector) { + return Math.max(startAngle, clipSector.startAngle) <= Math.min(endAngle, clipSector.endAngle); +} +function hasClipSector(datum) { + return datum.clipStartAngle != null && datum.clipEndAngle != null; +} +function datumClipSector(datum, zero) { + const { clipStartAngle, clipEndAngle, innerRadius, outerRadius } = datum; + return new SectorBox5(clipStartAngle, zero ? clipStartAngle : clipEndAngle, innerRadius, outerRadius); +} +function prepareRadialGaugeSeriesAnimationFunctions(initialLoad, initialStartAngle) { + const phase = initialLoad ? "initial" : "update"; + const node = { + fromFn(sect, datum) { + const previousDatum = sect.previousDatum; + let { startAngle, endAngle } = previousDatum ?? datum; + const previousClipSector = previousDatum != null && hasClipSector(previousDatum) ? datumClipSector(previousDatum, initialLoad) : void 0; + const nextClipSector = hasClipSector(datum) ? datumClipSector(datum, initialLoad) : void 0; + let clipSector; + if (previousClipSector != null && nextClipSector != null) { + clipSector = previousClipSector; + } else if (previousClipSector == null && nextClipSector != null) { + clipSector = nextClipSector; + startAngle = datum.startAngle; + endAngle = datum.endAngle; + } else if (previousClipSector != null && nextClipSector == null) { + clipSector = void 0; + startAngle = datum.startAngle; + endAngle = datum.endAngle; + } else if (initialLoad) { + endAngle = startAngle; + } + return { startAngle, endAngle, clipSector, phase }; + }, + toFn(_sect, datum) { + const { startAngle, endAngle } = datum; + let clipSector; + if (hasClipSector(datum)) { + clipSector = datumClipSector(datum, false); + } + return { startAngle, endAngle, clipSector }; + }, + applyFn(sect, params) { + const { startAngle, endAngle } = params; + let { clipSector } = params; + if (clipSector != null) { + clipSector = new SectorBox5( + Math.max(startAngle, clipSector.startAngle), + Math.min(endAngle, clipSector.endAngle), + clipSector.innerRadius, + clipSector.outerRadius + ); + } + const visible = clipSector == null || clipSectorVisibility(startAngle, endAngle, clipSector); + sect.startAngle = startAngle; + sect.endAngle = endAngle; + sect.clipSector = clipSector; + sect.visible = visible; + } + }; + const needle = { + fromFn(needleNode) { + let { angle: rotation } = needleNode.previousDatum ?? needleNode.datum; + if (initialLoad) { + rotation = initialStartAngle; + } + return { rotation, phase }; + }, + toFn(_needleNode, datum) { + const { angle: rotation } = datum; + return { rotation }; + } + }; + return { node, needle }; +} +function resetRadialGaugeSeriesResetSectorFunction(_node, datum) { + const { startAngle, endAngle } = datum; + const clipSector = computeClipSector(datum); + const visible = clipSector == null || clipSectorVisibility(startAngle, endAngle, clipSector); + return { startAngle, endAngle, clipSector, visible }; +} +function resetRadialGaugeSeriesResetNeedleFunction(_node, datum) { + const { angle } = datum; + return { rotation: angle }; +} +var verticalAlignFactors3 = { + top: 0, + middle: 0.5, + bottom: 1 +}; +function formatRadialGaugeLabels(series, ctx, selection, opts, innerRadius, datumOverrides) { + const { padding, textAlign, verticalAlign } = opts; + let labelDatum; + let secondaryLabelDatum; + selection.each((_node, datum) => { + if (datum.label === "primary" /* Primary */) { + labelDatum = datum; + } else if (datum.label === "secondary" /* Secondary */) { + secondaryLabelDatum = datum; + } + }); + if (labelDatum == null) + return; + const labelText = getLabelText(series.id, ctx, labelDatum, datumOverrides?.label); + if (labelText == null) + return; + const secondaryLabelText = secondaryLabelDatum == null ? void 0 : getLabelText(series.id, ctx, secondaryLabelDatum, datumOverrides?.secondaryLabel); + const params = { padding }; + const horizontalFactor = textAlign === "center" ? 2 : 1; + const verticalFactor = verticalAlign === "middle" ? 2 : 1; + const sizeFittingHeight = (height2) => ({ + width: Math.sqrt(Math.max(innerRadius ** 2 - (height2 / verticalFactor) ** 2, 0)) * horizontalFactor, + height: Math.min(height2, verticalFactor * innerRadius), + meta: null + }); + let labelLayout; + let secondaryLabelLayout; + let height; + if (secondaryLabelDatum != null && secondaryLabelText != null) { + const layout = formatStackedLabels( + (0, import_ag_charts_core111.toPlainText)(labelText), + labelDatum, + (0, import_ag_charts_core111.toPlainText)(secondaryLabelText), + secondaryLabelDatum, + params, + sizeFittingHeight + ); + labelLayout = layout?.label; + secondaryLabelLayout = layout?.secondaryLabel; + height = layout?.height ?? 0; + } else { + const layout = formatSingleLabel((0, import_ag_charts_core111.toPlainText)(labelText), labelDatum, params, sizeFittingHeight); + labelLayout = layout?.[0]; + secondaryLabelLayout = void 0; + height = layout?.[0].height ?? 0; + } + const rectYOffset = height * verticalAlignFactors3[verticalAlign]; + selection.each((label, datum) => { + let layout; + if (datum.label === "primary" /* Primary */) { + layout = labelLayout; + } else if (datum.label === "secondary" /* Secondary */) { + layout = secondaryLabelLayout; + } + if (layout == null) { + label.visible = false; + return; + } + label.visible = true; + label.text = layout.text; + label.fontSize = layout.fontSize; + label.lineHeight = layout.lineHeight; + label.textAlign = textAlign; + label.textBaseline = "middle"; + const rectOriginInLabelRect = datum.label === "primary" /* Primary */ ? layout.height / 2 : height - layout.height / 2; + label.y = datum.centerY + rectOriginInLabelRect - rectYOffset; + label.x = datum.centerX; + }); +} + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeries.ts +var { + fromToMotion: fromToMotion5, + resetMotion: resetMotion4, + SeriesNodePickMode: SeriesNodePickMode15, + StateMachine: StateMachine15, + createDatumId: createDatumId19, + normalizeAngle360: normalizeAngle3607, + normalizeAngle360Inclusive: normalizeAngle360Inclusive3, + isBetweenAngles: isBetweenAngles2, + sectorBox, + toRadians: toRadians5, + BBox: BBox24, + Group: Group19, + PointerEvents: PointerEvents12, + Selection: Selection16, + Sector: Sector6, + SectorBox: SectorBox6, + Text: Text9, + Marker: Marker6, + tickFormat: tickFormat2, + applyShapeStyle: applyShapeStyle17, + mergeDefaults: mergeDefaults19 +} = import_ag_charts_community266._ModuleSupport; +var targetPlacementRotation = { + inside: 90, + middle: 0, + outside: -90 +}; +var outsideLabelPlacements = [ + { textAlign: "left", textBaseline: "top" }, + { textAlign: "right", textBaseline: "top" }, + { textAlign: "right", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "bottom" } +]; +var insideLabelPlacements = [ + { textAlign: "right", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "top" }, + { textAlign: "right", textBaseline: "top" } +]; +var RadialGaugeSeries = class extends import_ag_charts_community266._ModuleSupport.Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode15.EXACT_SHAPE_MATCH, SeriesNodePickMode15.NEAREST_NODE] + }); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.properties = new RadialGaugeSeriesProperties(); + this.scale = new LinearAngleScale(); + this.scaleGroup = this.contentGroup.appendChild(new Group19({ name: "scaleGroup" })); + this.itemGroup = this.contentGroup.appendChild(new Group19({ name: "itemGroup" })); + this.itemNeedleGroup = this.contentGroup.appendChild(new Group19({ name: "itemNeedleGroup" })); + this.itemTargetGroup = this.contentGroup.appendChild(new Group19({ name: "itemTargetGroup" })); + this.itemTargetLabelGroup = this.contentGroup.appendChild(new Group19({ name: "itemTargetLabelGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group19({ name: "itemLabelGroup" })); + this.highlightTargetGroup = this.highlightGroup.appendChild( + new Group19({ name: "itemTargetLabelGroup" }) + ); + this.tickGroup = this.contentGroup.appendChild(new Group19({ name: "tickGroup" })); + this.scaleSelection = Selection16.select( + this.scaleGroup, + () => this.nodeFactory() + ); + this.datumSelection = Selection16.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.needleSelection = Selection16.select( + this.itemNeedleGroup, + RadialGaugeNeedle + ); + this.targetSelection = Selection16.select( + this.itemTargetGroup, + () => this.markerFactory() + ); + this.targetLabelSelection = Selection16.select(this.itemTargetLabelGroup, Text9); + this.labelSelection = Selection16.select( + this.itemLabelGroup, + Text9 + ); + this.highlightTargetSelection = Selection16.select(this.highlightTargetGroup, () => this.markerFactory()); + this.tickSelection = Selection16.select(this.tickGroup, import_ag_charts_community266._ModuleSupport.TransformableText); + this.datumUnion = new DatumUnion(); + this.animationState = new StateMachine15("empty", { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.animateReadyResize(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateWaitingUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty" + }, + reset: "empty", + skip: "ready" + } + }); + this.scaleGroup.pointerEvents = PointerEvents12.None; + this.tickGroup.pointerEvents = PointerEvents12.None; + this.itemNeedleGroup.pointerEvents = PointerEvents12.None; + this.itemLabelGroup.pointerEvents = PointerEvents12.None; + } + get hasData() { + return this.properties.value != null; + } + nodeFactory() { + return new Sector6(); + } + markerFactory() { + const marker = new Marker6(); + marker.size = 1; + return marker; + } + processData() { + this.nodeDataRefresh = true; + this.animationState.transition("updateData"); + } + formatLabel(value) { + const { min, max } = this.properties.scale; + return formatLabel(value, { min, max }); + } + layoutScale() { + const { scale, properties } = this; + const { seriesRectWidth, seriesRectHeight } = this.nodeDataDependencies; + const { scale: scaleProps, outerRadius } = this.properties; + const { min, max, label, interval } = scaleProps; + const startAngle = toRadians5(properties.startAngle - 90); + const endAngle = toRadians5(properties.endAngle - 90); + const sweepAngle = normalizeAngle360Inclusive3(endAngle - startAngle); + const largerThanHalf = sweepAngle > Math.PI; + const containsTop = largerThanHalf || isBetweenAngles2(1.5 * Math.PI, startAngle, endAngle); + const containsRight = largerThanHalf || isBetweenAngles2(0 * Math.PI, startAngle, endAngle); + const containsBottom = largerThanHalf || isBetweenAngles2(0.5 * Math.PI, startAngle, endAngle); + const containsLeft = largerThanHalf || isBetweenAngles2(1 * Math.PI, startAngle, endAngle); + let textAlign; + if (containsLeft && !containsRight) { + textAlign = "right"; + } else if (!containsLeft && containsRight) { + textAlign = "left"; + } else { + textAlign = "center"; + } + let verticalAlign; + if (containsTop && !containsBottom) { + verticalAlign = "bottom"; + } else if (!containsTop && containsBottom) { + verticalAlign = "top"; + } else { + verticalAlign = "middle"; + } + const unitBox = sectorBox({ + startAngle, + endAngle, + innerRadius: 0, + outerRadius: 0.5 + }); + const centerXOffset = -(unitBox.x + unitBox.width / 2) * 2; + const centerYOffset = -(unitBox.y + unitBox.height / 2) * 2; + const unitBoxSize = Math.min(seriesRectWidth / unitBox.width, seriesRectHeight / unitBox.height); + scale.domain = [min, max]; + scale.range = [startAngle, endAngle]; + scale.arcLength = unitBoxSize / 2; + const { maxSpacing, minSpacing } = interval; + const { arcLength } = scale; + const minTickCount = maxSpacing ? Math.floor(arcLength / maxSpacing) : 1; + const maxTickCount = minSpacing ? Math.floor(arcLength / minSpacing) : Infinity; + const preferredTickCount = Math.floor(4 / Math.PI * Math.abs(scale.range[0] - scale.range[1])); + const tickCount = Math.max(minTickCount, Math.min(maxTickCount, preferredTickCount)); + const ticks = interval.values ?? scale.ticks({ + nice: false, + interval: interval.step, + minTickCount, + maxTickCount, + tickCount + })?.ticks ?? []; + const tickFormatter = tickFormat2(ticks, typeof label.format === "string" ? label.format : void 0); + const measurer2 = (0, import_ag_charts_core112.cachedTextMeasurer)(label); + const tickData = ticks.map((value, index) => { + let text2; + if (label.formatter) { + text2 = formatWithContext(this.ctx, label.formatter, { + value, + index, + domain: scale.domain, + boundSeries: void 0 + }); + } + text2 ?? (text2 = tickFormatter?.(value)); + if (text2 == null) + return; + const { width, height } = (0, import_ag_charts_core112.isArray)(text2) ? (0, import_ag_charts_core112.measureTextSegments)(text2, label) : measurer2.measureLines(text2); + return { index, value, text: text2, width, height }; + }).filter((value) => value != null); + const maxWidth = tickData.reduce((m, t) => Math.max(m, t.width), 0); + const maxHeight = tickData.reduce((m, t) => Math.max(m, t.height), 0); + const labelInset = label.enabled ? Math.max(maxWidth, maxHeight) + label.spacing : 0; + const radiusBounds = Math.max( + 0.5 * unitBoxSize - labelInset, + // seriesRect may have negative size + 0 + ); + const radius = outerRadius ?? radiusBounds; + this.centerX = seriesRectWidth / 2 + centerXOffset * radius; + this.centerY = seriesRectHeight / 2 + centerYOffset * radius; + this.radius = radius; + this.textAlign = textAlign; + this.verticalAlign = verticalAlign; + return tickData; + } + getShapeFillBBox() { + const { centerX, centerY, radius } = this; + const bbox = new BBox24(centerX - radius, centerY - radius, 2 * radius, 2 * radius); + return { + series: bbox, + axis: bbox + }; + } + getTargets() { + const { properties } = this; + const defaultTarget = properties.defaultTarget; + return Array.from(properties.targets).map((target) => { + const { + text: text2 = defaultTarget.text, + value = defaultTarget.value ?? 0, + shape = defaultTarget.shape ?? "triangle", + rotation = defaultTarget.rotation ?? 0, + placement = defaultTarget.placement ?? "middle", + spacing = defaultTarget.spacing ?? 0, + size = defaultTarget.size ?? 0 + } = target; + const { + enabled: labelEnabled = defaultTarget.label.enabled, + color: labelColor = defaultTarget.label.color ?? "black", + fontStyle: labelFontStyle = defaultTarget.label.fontStyle ?? "normal", + fontWeight: labelFontWeight = defaultTarget.label.fontWeight ?? "normal", + fontSize: labelFontSize = defaultTarget.label.fontSize, + fontFamily: labelFontFamily = defaultTarget.label.fontFamily, + spacing: labelSpacing = defaultTarget.label.spacing ?? 0 + } = target.label; + return { + text: text2, + value, + shape, + placement, + spacing, + size, + rotation, + label: { + enabled: labelEnabled, + color: labelColor, + fontStyle: labelFontStyle, + fontWeight: labelFontWeight, + fontSize: labelFontSize, + fontFamily: labelFontFamily, + spacing: labelSpacing + }, + style: target.getStyle() + }; + }); + } + getTargetRadius(target) { + const { radius, properties } = this; + const { innerRadiusRatio, outerRadiusRatio } = properties; + const { placement, spacing, size } = target; + const outerRadius = radius * outerRadiusRatio; + const innerRadius = radius * innerRadiusRatio; + switch (placement) { + case "inside": + return Math.max(innerRadius - spacing - size / 2, 0); + case "outside": + return outerRadius + spacing + size / 2; + default: + return (innerRadius + outerRadius) / 2; + } + } + getTargetLabel(target) { + const { scale } = this; + const { value, size, placement, label } = target; + const { spacing, color: fill, fontStyle, fontWeight, fontSize, fontFamily } = label; + const lineHeight = void 0; + const angle = scale.convert(value); + const quadrant = Math.trunc(normalizeAngle3607(angle) / (Math.PI / 2)); + const offset = size / 2 + spacing; + let textAlign; + let textBaseline; + let offsetX; + let offsetY; + switch (placement) { + case "outside": + ({ textAlign, textBaseline } = outsideLabelPlacements[quadrant]); + offsetX = offset * Math.cos(angle); + offsetY = offset * Math.sin(angle); + break; + case "inside": + ({ textAlign, textBaseline } = insideLabelPlacements[quadrant]); + offsetX = -offset * Math.cos(angle); + offsetY = -offset * Math.sin(angle); + break; + default: + textAlign = "center"; + textBaseline = "bottom"; + offsetX = 0; + offsetY = -offset; + break; + } + return { + offsetX, + offsetY, + fill, + textAlign, + textBaseline, + fontStyle, + fontWeight, + fontSize, + fontFamily, + lineHeight + }; + } + createNodeData() { + const tickData = this.layoutScale(); + const { id: seriesId, scale, properties, radius, centerX, centerY } = this; + const { + value, + innerRadiusRatio, + outerRadiusRatio, + segmentation, + cornerRadius, + cornerMode, + needle, + bar, + scale: scaleProps, + label, + secondaryLabel + } = properties; + const { + outerRadius = radius * outerRadiusRatio, + innerRadius = radius * innerRadiusRatio, + defaultColorRange + } = properties; + const targets = this.getTargets(); + const nodeData = []; + const targetData = []; + const needleData = []; + const labelData = []; + const scaleData = []; + const cornersOnAllItems = cornerMode === "item"; + const containerStartAngle = scale.convert(scale.domain[0]); + const containerEndAngle = scale.convert(value); + const maxTicks = Math.ceil(normalizeAngle360Inclusive3(containerEndAngle - containerStartAngle) * radius); + let segments = segmentation.enabled ? segmentation.interval.getSegments(scale, maxTicks) : void 0; + const barStyle = bar.getStyle(defaultColorRange, scale); + const scaleStyle = scaleProps.getStyle(bar.enabled, defaultColorRange, scale); + if (segments == null && cornersOnAllItems) { + const segmentStart = Math.min(...scale.domain); + const segmentEnd = Math.max(...scale.domain); + const datum = { value, segmentStart, segmentEnd }; + const appliedCornerRadius = Math.min(cornerRadius, (outerRadius - innerRadius) / 2); + const angleInset = appliedCornerRadius / ((innerRadius + outerRadius) / 2); + nodeData.push({ + series: this, + itemId: `value`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: containerStartAngle - angleInset, + endAngle: containerEndAngle + angleInset, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornerRadius, + endCornerRadius: cornerRadius, + style: barStyle + }); + scaleData.push({ + series: this, + itemId: `scale`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: scale.range[0] - angleInset, + endAngle: scale.range[1] + angleInset, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornerRadius, + endCornerRadius: cornerRadius, + style: scaleStyle + }); + } else { + segments ?? (segments = scale.domain); + for (let i = 0; i < segments.length - 1; i++) { + const segmentStart = segments[i]; + const segmentEnd = segments[i + 1]; + const datum = { value, segmentStart, segmentEnd }; + const isStart = i === 0; + const isEnd = i === segments.length - 2; + const itemStartAngle = scale.convert(segmentStart); + const itemEndAngle = scale.convert(segmentEnd); + nodeData.push({ + series: this, + itemId: `value-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: itemStartAngle, + endAngle: itemEndAngle, + clipStartAngle: containerStartAngle, + clipEndAngle: containerEndAngle, + startCornerRadius: cornersOnAllItems || isStart ? cornerRadius : 0, + endCornerRadius: cornersOnAllItems || isEnd ? cornerRadius : 0, + style: barStyle + }); + scaleData.push({ + series: this, + itemId: `scale-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: itemStartAngle, + endAngle: itemEndAngle, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornersOnAllItems || isStart ? cornerRadius : 0, + endCornerRadius: cornersOnAllItems || isEnd ? cornerRadius : 0, + style: scaleStyle + }); + } + } + if (!needle.enabled && label.enabled) { + const { + text: text2, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter = (params) => this.formatLabel(params.value) + } = label; + labelData.push({ + label: "primary" /* Primary */, + centerX, + centerY, + text: text2, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + }); + } + if (!needle.enabled && secondaryLabel.enabled) { + const { + text: text2, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + } = secondaryLabel; + labelData.push({ + label: "secondary" /* Secondary */, + centerX, + centerY, + text: text2, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + }); + } + if (needle.enabled) { + let needleRadius = needle.radiusRatio == null ? innerRadius : radius * needle.radiusRatio; + needleRadius = Math.max(needleRadius - needle.spacing, 0); + const needleAngle = scale.convert(value); + needleData.push({ + centerX, + centerY, + radius: needleRadius, + angle: needleAngle, + series: this + }); + } + for (let i = 0; i < targets.length; i += 1) { + const target = targets[i]; + const { value: targetValue, text: text2, size, shape, style } = target; + if (targetValue < Math.min(...scale.domain) || targetValue > Math.max(...scale.domain)) { + continue; + } + const targetRadius = this.getTargetRadius(target); + const targetAngle = scale.convert(targetValue); + const targetRotation = toRadians5(target.rotation + targetPlacementRotation[target.placement]); + targetData.push({ + series: this, + itemId: `target-${i}`, + midPoint: { + x: targetRadius * Math.cos(targetAngle) + centerX, + y: targetRadius * Math.sin(targetAngle) + centerY + }, + datum: { value: targetValue }, + datumIndex: { type: 1 /* Target */, index: i }, + type: 1 /* Target */, + value: targetValue, + text: text2, + centerX, + centerY, + shape, + radius: targetRadius, + angle: targetAngle, + rotation: targetRotation, + size, + label: this.getTargetLabel(target), + style + }); + } + return { + itemId: seriesId, + nodeData, + needleData, + targetData, + labelData, + scaleData, + tickData + }; + } + updateSelections(resize) { + if (this.nodeDataRefresh || resize) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + highlightDatum(node) { + if (node != null && node.series === this && node.type === 1 /* Target */) { + return node; + } + } + update({ seriesRect }) { + const { + datumSelection, + labelSelection, + needleSelection, + targetSelection, + targetLabelSelection, + scaleSelection, + highlightTargetSelection, + tickSelection + } = this; + const resize = this.checkResize(seriesRect); + this.updateSelections(resize); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const needleData = this.contextNodeData?.needleData ?? []; + const targetData = this.contextNodeData?.targetData ?? []; + const scaleData = this.contextNodeData?.scaleData ?? []; + const tickData = this.contextNodeData?.tickData ?? []; + const highlightTargetDatum = this.highlightDatum(this.ctx.highlightManager.getActiveHighlight()); + this.scaleSelection = this.updateScaleSelection({ scaleData, scaleSelection }); + this.updateScaleNodes({ scaleSelection }); + this.needleSelection = this.updateNeedleSelection({ needleData, needleSelection }); + this.updateNeedleNodes({ needleSelection }); + this.targetSelection = this.updateTargetSelection({ targetData, targetSelection }); + this.updateTargetStyles({ targetSelection, isHighlight: false }); + this.updateTargetNodes({ targetSelection }); + this.targetLabelSelection = this.updateTargetLabelSelection({ targetData, targetLabelSelection }); + this.updateTargetLabelNodes({ targetLabelSelection }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightTargetSelection = this.updateTargetSelection({ + targetData: highlightTargetDatum == null ? [] : [highlightTargetDatum], + targetSelection: highlightTargetSelection + }); + this.updateTargetStyles({ targetSelection: highlightTargetSelection, isHighlight: true }); + this.updateTargetNodes({ targetSelection: highlightTargetSelection }); + this.tickSelection = this.updateTickSelection({ tickData, tickSelection }); + this.updateTickNodes({ tickSelection }); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => { + return createDatumId19(opts.nodeData.length, datum.itemId); + }); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + const { ctx, properties } = this; + const { segmentation } = properties; + const sectorSpacing = segmentation.spacing ?? 0; + const animationDisabled = ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((sector, datum) => { + const { centerX, centerY, innerRadius, outerRadius, startCornerRadius, endCornerRadius } = datum; + sector.centerX = centerX; + sector.centerY = centerY; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + sector.pointerEvents = this.properties.bar.enabled ? import_ag_charts_community266._ModuleSupport.PointerEvents.All : import_ag_charts_community266._ModuleSupport.PointerEvents.None; + applyShapeStyle17(sector, datum.style, fillBBox); + sector.startOuterCornerRadius = startCornerRadius; + sector.startInnerCornerRadius = startCornerRadius; + sector.endOuterCornerRadius = endCornerRadius; + sector.endInnerCornerRadius = endCornerRadius; + sector.radialEdgeInset = (sectorSpacing + sector.strokeWidth) / 2; + sector.concentricEdgeInset = sector.strokeWidth / 2; + if (animationDisabled || sector.previousDatum == null) { + sector.setProperties(resetRadialGaugeSeriesResetSectorFunction(sector, datum)); + } + }); + this.datumUnion.update(datumSelection, this.itemGroup, import_ag_charts_community266._ModuleSupport.Sector, (node, first, last) => { + node.clipSector ?? (node.clipSector = new SectorBox6(Number.NaN, Number.NaN, Number.NaN, Number.NaN)); + node.centerX = first.centerX; + node.centerY = first.centerY; + node.outerRadius = node.clipSector.outerRadius = first.outerRadius; + node.innerRadius = node.clipSector.innerRadius = first.innerRadius; + node.startAngle = node.clipSector.startAngle = first.startAngle; + node.startInnerCornerRadius = first.startInnerCornerRadius; + node.startOuterCornerRadius = first.startOuterCornerRadius; + node.endAngle = last.endAngle; + node.clipSector.endAngle = last.clipSector?.endAngle ?? last.endAngle; + node.endInnerCornerRadius = last.endInnerCornerRadius; + node.endOuterCornerRadius = last.endOuterCornerRadius; + node.pointerEvents = import_ag_charts_community266._ModuleSupport.PointerEvents.None; + }); + } + updateScaleSelection(opts) { + return opts.scaleSelection.update(opts.scaleData, void 0, (datum) => { + return createDatumId19(opts.scaleData.length, datum.itemId); + }); + } + updateScaleNodes(opts) { + const { scaleSelection } = opts; + const { segmentation } = this.properties; + const sectorSpacing = segmentation.spacing ?? 0; + const fillBBox = this.getShapeFillBBox(); + scaleSelection.each((sector, datum) => { + const { centerX, centerY, innerRadius, outerRadius, startCornerRadius, endCornerRadius } = datum; + sector.centerX = centerX; + sector.centerY = centerY; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + applyShapeStyle17(sector, datum.style, fillBBox); + sector.startOuterCornerRadius = startCornerRadius; + sector.startInnerCornerRadius = startCornerRadius; + sector.endOuterCornerRadius = endCornerRadius; + sector.endInnerCornerRadius = endCornerRadius; + sector.radialEdgeInset = (sectorSpacing + sector.strokeWidth) / 2; + sector.concentricEdgeInset = sector.strokeWidth / 2; + sector.setProperties(resetRadialGaugeSeriesResetSectorFunction(sector, datum)); + }); + } + updateNeedleSelection(opts) { + return opts.needleSelection.update(opts.needleData, void 0, () => createDatumId19(0)); + } + updateNeedleNodes(opts) { + const { needleSelection } = opts; + const { fill, fillOpacity, stroke: stroke2, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties.needle; + const animationDisabled = this.ctx.animationManager.isSkipped(); + needleSelection.each((needle, datum) => { + const { centerX, centerY, radius } = datum; + const scale = radius * 2; + needle.d = RadialGaugeNeedle.defaultPathData; + applyShapeStyle17(needle, { + fill, + fillOpacity, + stroke: stroke2, + strokeOpacity, + strokeWidth: strokeWidth / scale, + lineDash: lineDash.map((d) => d / scale), + lineDashOffset: lineDashOffset / scale + }); + needle.translationX = centerX; + needle.translationY = centerY; + needle.scalingX = scale; + needle.scalingY = scale; + if (animationDisabled) { + needle.setProperties(resetRadialGaugeSeriesResetNeedleFunction(needle, datum)); + } + }); + } + updateTargetSelection(opts) { + return opts.targetSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetStyles({ + targetSelection, + isHighlight + }) { + targetSelection.each((_, datum) => { + datum.style = this.getTargetStyle(isHighlight, datum); + }); + } + updateTargetNodes({ + targetSelection + }) { + targetSelection.each((target, datum) => { + const { centerX, centerY, angle, radius, shape, size, rotation } = datum; + applyShapeStyle17(target, datum.style); + target.size = size; + target.shape = shape === "line" ? lineMarker : shape; + target.translationX = centerX + radius * Math.cos(angle); + target.translationY = centerY + radius * Math.sin(angle); + target.rotation = angle + rotation; + }); + } + getTargetStyle(isHighlight, { datumIndex, style }) { + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + return mergeDefaults19(highlightStyle, { + ...style, + opacity: 1 + }); + } + updateTargetLabelSelection(opts) { + return opts.targetLabelSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetLabelNodes(opts) { + const { targetLabelSelection } = opts; + targetLabelSelection.each((label, target) => { + const { centerX, centerY, radius, angle, text: text2 } = target; + const { offsetX, offsetY, fill, fontStyle, fontWeight, fontSize, fontFamily, textAlign, textBaseline } = target.label; + if (text2 == null) { + label.visible = false; + return; + } + label.visible = true; + label.x = centerX + radius * Math.cos(angle) + offsetX; + label.y = centerY + radius * Math.sin(angle) + offsetY; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(opts.labelData, void 0, (datum) => datum.label); + } + updateLabelNodes(opts) { + const { labelSelection } = opts; + const animationDisabled = this.ctx.animationManager.isSkipped(); + labelSelection.each((label, datum) => { + label.fill = datum.fill; + label.fontStyle = datum.fontStyle; + label.fontWeight = datum.fontWeight; + label.fontFamily = datum.fontFamily; + }); + if (animationDisabled || this.labelsHaveExplicitText()) { + this.formatLabelText(); + } + } + updateTickSelection(opts) { + return opts.tickSelection.update(opts.tickData, void 0, (datum) => datum.index); + } + updateTickNodes(opts) { + const { scale, radius, centerX, centerY, properties } = this; + const { enabled, color: color6, fontFamily, fontSize, fontStyle, fontWeight, spacing } = properties.scale.label; + const rotation = toRadians5(properties.scale.label.rotation ?? 0); + opts.tickSelection.each((label, datum) => { + if (!enabled) { + label.visible = false; + return; + } + label.visible = true; + label.text = datum.text; + label.fill = color6; + label.fontFamily = fontFamily; + label.fontSize = fontSize; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.textAlign = "center"; + label.textBaseline = "middle"; + const angle = scale.convert(datum.value); + const { width, height } = datum; + const originX = Math.abs(radius * Math.cos(angle)); + const originY = Math.abs(radius * Math.sin(angle)); + const x0 = Math.min(Math.max(Math.abs(radius / Math.tan(angle)), originX - width / 2), originX + width / 2); + const y0 = Math.min( + Math.max(Math.abs(radius * Math.tan(angle)), originY - height / 2), + originY + height / 2 + ); + const outerR = Math.hypot(x0, y0); + const x = centerX + (outerR + spacing) * Math.cos(angle); + const y = centerY + (outerR + spacing) * Math.sin(angle); + label.x = x; + label.y = y; + label.rotationCenterX = x; + label.rotationCenterY = y; + label.rotation = rotation; + }); + } + labelsHaveExplicitText() { + for (const { datum } of this.labelSelection) { + if (datum.text == null) { + return false; + } + } + return true; + } + formatLabelText(datum) { + const { labelSelection, radius, textAlign, verticalAlign } = this; + const { spacing: padding, innerRadiusRatio } = this.properties; + formatRadialGaugeLabels( + this, + this.ctx, + labelSelection, + { padding, textAlign, verticalAlign }, + radius * innerRadiusRatio, + datum + ); + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + resetMotion4([this.datumSelection], resetRadialGaugeSeriesResetSectorFunction); + resetMotion4([this.needleSelection], resetRadialGaugeSeriesResetNeedleFunction); + this.formatLabelText(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + animateLabelText(params = {}) { + const { animationManager } = this.ctx; + let labelFrom; + let labelTo; + let secondaryLabelFrom; + let secondaryLabelTo; + this.labelSelection.each((label, datum) => { + label.opacity = 1; + if (datum.label === "primary" /* Primary */) { + labelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + labelTo = datum.value; + } else if (datum.label === "secondary" /* Secondary */) { + secondaryLabelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + secondaryLabelTo = datum.value; + } + }); + if (this.labelsHaveExplicitText()) { + } else if (labelTo == null || secondaryLabelTo == null) { + this.formatLabelText(); + } else if (labelFrom === labelTo && secondaryLabelFrom === secondaryLabelTo) { + this.formatLabelText({ label: labelTo, secondaryLabel: secondaryLabelTo }); + } else { + const animationId = `${this.id}_labels`; + animationManager.animate({ + id: animationId, + groupId: "label", + from: { label: labelFrom, secondaryLabel: secondaryLabelFrom }, + to: { label: labelTo, secondaryLabel: secondaryLabelTo }, + phase: params.phase ?? "update", + onUpdate: (datum) => this.formatLabelText(datum), + onStop: () => this.formatLabelText({ label: labelTo, secondaryLabel: secondaryLabelTo }) + }); + } + } + animateEmptyUpdateReady() { + const { animationManager } = this.ctx; + const { node, needle } = prepareRadialGaugeSeriesAnimationFunctions(true, this.scale.range[0]); + fromToMotion5(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion5(this.id, "needle", animationManager, [this.needleSelection], needle, () => "needle"); + fromToMotion5( + this.id, + "label", + animationManager, + [this.labelSelection], + fadeInFns, + (_label, datum) => datum.label + ); + this.animateLabelText({ + from: this.properties.scale.min, + phase: "initial" + }); + } + animateWaitingUpdateReady() { + const { animationManager } = this.ctx; + const { node, needle } = prepareRadialGaugeSeriesAnimationFunctions(false, this.scale.range[0]); + fromToMotion5(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion5(this.id, "needle", animationManager, [this.needleSelection], needle, () => "needle"); + this.animateLabelText(); + } + animateReadyResize() { + this.resetAllAnimation(); + } + dataCount() { + return Number.NaN; + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData() { + return []; + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties } = this; + const { tooltip } = properties; + let value; + let text2; + let fallbackLabel; + if (datumIndex.type === 0 /* Node */) { + value = properties.value; + text2 = properties.label.text; + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeValue"); + } else { + ({ value, text: text2 } = properties.targets[datumIndex.index]); + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeTarget"); + } + if (value == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + data: [{ label: text2, fallbackLabel, value: this.formatLabel(value) }] + }, + { seriesId, title: void 0, datum: void 0, value } + ); + } + pickNodeClosestDatum(point) { + return pickGaugeNearestDatum(this, point); + } + pickFocus(opts) { + return pickGaugeFocus(this, opts); + } + getCaptionText() { + const { value } = this.properties; + const description = []; + description.push(this.formatLabel(value)); + this.labelSelection.each((_label, datum) => { + const text2 = getLabelText(this.id, this.ctx, datum); + if (text2 != null) { + description.push((0, import_ag_charts_core112.toPlainText)(text2)); + } + }); + return description.join(". "); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +RadialGaugeSeries.className = "RadialGaugeSeries"; +RadialGaugeSeries.type = "radial-gauge"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeModule.ts +var { FONT_SIZE_RATIO: FONT_SIZE_RATIO2 } = import_ag_charts_community267._ModuleSupport; +var RadialGaugeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "radial-gauge", + moduleFactory: (ctx) => new RadialGaugeSeries(ctx), + themeTemplate: { + minWidth: 200, + minHeight: 200, + tooltip: { + enabled: false + }, + series: { + outerRadiusRatio: 1, + innerRadiusRatio: 0.8, + startAngle: 270, + endAngle: 270 + 180, + defaultColorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $interpolate: [{ $palette: "secondDivergingColors" }, 5] }, + import_ag_charts_community267._ModuleSupport.SAFE_RANGE2_OPERATION + ] + }, + scale: { + // @ts-expect-error undocumented option + defaultFill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + stroke: { $path: ["/2", import_ag_charts_community267._ModuleSupport.SAFE_STROKE_FILL_OPERATION, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 12 + } + }, + bar: { + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + segmentation: { + enabled: false, + interval: {}, + spacing: 2 + }, + defaultTarget: { + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + size: 10, + shape: "triangle", + placement: "outside", + spacing: 5, + label: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 5 + } + }, + needle: { + enabled: false, + fill: { $ref: "foregroundColor" }, + spacing: 10 + }, + label: { + ...import_ag_charts_community267._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: 56, + minimumFontSize: 18 / 56, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + }, + secondaryLabel: { + ...import_ag_charts_community267._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: FONT_SIZE_RATIO2.LARGE }, + minimumFontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "subtleTextColor" } + }, + tooltip: { + range: { $path: ["/tooltip/range", 10] } + } + } + } +}; +var RadialGaugeSeriesModule = { + type: "series", + name: "radial-gauge", + chartType: "standalone", + enterprise: true, + options: import_ag_charts_community267._ModuleSupport.radialGaugeSeriesOptionsDef, + create: (ctx) => new RadialGaugeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/sankey/sankeyModule.ts +var import_ag_charts_community272 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeries.ts +var import_ag_charts_community270 = require("ag-charts-community"); +var import_ag_charts_core114 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/sankey/sankeyLink.ts +var import_ag_charts_community268 = require("ag-charts-community"); +var import_ag_charts_core113 = require("ag-charts-core"); +var { BBox: BBox25, Path: Path14, Vec2: Vec220, SceneChangeDetection: SceneChangeDetection10 } = import_ag_charts_community268._ModuleSupport; +var SankeyLink = class extends Path14 { + constructor() { + super(...arguments); + this.x1 = 0; + this.x2 = 0; + this.y1 = 0; + this.y2 = 0; + this.height = 0; + this.inset = 0; + this.elbows = []; + } + computeBBox() { + const x = Math.min(this.x1, this.x2); + const width = Math.max(this.x1, this.x2) - x; + const y = Math.min(this.y1, this.y2); + const height = Math.max(this.y1, this.y2) - y + this.height; + return new BBox25(x, y, width, height); + } + updatePath() { + const { path, inset } = this; + path.clear(); + const height = this.height - 2 * this.inset; + const offset = height / 2; + let x1 = this.x1 + inset; + let y1 = this.y1 + inset; + path.moveTo(x1, y1); + for (const elbow of this.elbows) { + this.updatePathSection(x1, y1, elbow.x, elbow.y, height, -offset); + x1 = elbow.x; + y1 = elbow.y; + } + const x2 = this.x2 - inset; + const y2 = this.y2 + inset; + this.updatePathSection(x1, y1, x2, y2, height, -offset); + path.lineTo(x2, y2 + height); + x1 = x2; + y1 = y2; + for (const elbow of this.elbows.toReversed()) { + this.updatePathSection(x1, y1, elbow.x, elbow.y, height, offset); + x1 = elbow.x; + y1 = elbow.y; + } + this.updatePathSection(x1, y1, this.x1 + inset, this.y1 + inset, height, offset); + path.closePath(); + } + updatePathSection(x1, y1, x2, y2, height, yOffset) { + const { path } = this; + const start = Vec220.from(x1, y1 + yOffset + height / 2); + const end = Vec220.from(x2, y2 + yOffset + height / 2); + if (Math.abs(end.y - start.y) < 2) { + path.lineTo(end.x, end.y); + return; + } + let angle = Vec220.angle(Vec220.sub(end, start)); + if (angle < 0) + angle = 2 * Math.PI + angle; + const right = 0; + const down = Math.PI / 2; + const left = Math.PI; + const up = Math.PI * 1.5; + const innerArc = getArcValues(start, end, 0); + const outerArc = getArcValues(start, end, height); + if (innerArc.radius < height) { + path.cubicCurveTo((start.x + end.x) / 2, start.y, (start.x + end.x) / 2, end.y, end.x, end.y); + return; + } + if (angle >= up) { + path.arc(start.x, y1 - innerArc.radius, innerArc.radius, down, down + outerArc.angle, true); + path.arc(end.x, y2 + outerArc.radius, outerArc.radius, up + outerArc.angle, up); + path.lineTo(end.x, end.y); + } else if (angle > right && angle <= down) { + path.arc(start.x, y1 + outerArc.radius, outerArc.radius, up, up + outerArc.angle); + path.arc(end.x, y2 - innerArc.radius, innerArc.radius, down + innerArc.angle, down, true); + path.lineTo(end.x, end.y); + } else if (angle > down && angle <= left) { + path.arc(start.x, y1 + outerArc.radius, outerArc.radius - height, up, up + outerArc.angle, true); + path.arc(end.x, y2 - innerArc.radius, innerArc.radius + height, down + innerArc.angle, down); + path.lineTo(end.x, end.y); + } else { + path.arc(start.x, y1 - innerArc.radius, innerArc.radius + height, down, down + innerArc.angle); + path.arc(end.x, y2 + outerArc.radius, outerArc.radius - height, up + outerArc.angle, up, true); + path.lineTo(end.x, end.y); + } + } +}; +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "x1", 2); +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "x2", 2); +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "y1", 2); +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "y2", 2); +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "height", 2); +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "inset", 2); +function getArcValues(start, end, minRadius) { + const lineAngle = Vec220.angle(Vec220.sub(end, start)); + const chordLength = Vec220.distance(start, end); + const bisect = Vec220.add(start, Vec220.rotate(Vec220.from(chordLength / 2, 0), lineAngle)); + const gradient = -1 / Vec220.gradient(start, end); + const intercept = Vec220.intercept(bisect, gradient); + const offset = lerpClamp(0.1, 0.5, Math.PI / 2 - Math.abs(Vec220.gradient(start, end))); + const center = Vec220.intersectAtX(gradient, intercept, start.x); + const radius = Math.max(minRadius, Vec220.distance(start, center) * offset); + const angle = Vec220.angle(Vec220.sub(center, start), Vec220.sub(center, bisect)) / -(1.1 - offset); + return { angle, radius }; +} +function lerpClamp(a, b, ratio3) { + return (0, import_ag_charts_core113.clamp)(a, (b - a) * ratio3 + a, b); +} + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeriesProperties.ts +var import_ag_charts_community269 = require("ag-charts-community"); +var { + BaseProperties: BaseProperties29, + FillGradientDefaults: FillGradientDefaults3, + FillPatternDefaults: FillPatternDefaults3, + FillImageDefaults: FillImageDefaults3, + makeSeriesTooltip: makeSeriesTooltip22, + SeriesProperties: SeriesProperties13, + Property: Property82, + Label: Label17 +} = import_ag_charts_community269._ModuleSupport; +var SankeySeriesLabelProperties = class extends Label17 { + constructor() { + super(...arguments); + this.spacing = 1; + this.placement = void 0; + this.edgePlacement = void 0; + } +}; +__decorateClass([ + Property82 +], SankeySeriesLabelProperties.prototype, "spacing", 2); +__decorateClass([ + Property82 +], SankeySeriesLabelProperties.prototype, "placement", 2); +__decorateClass([ + Property82 +], SankeySeriesLabelProperties.prototype, "edgePlacement", 2); +var SankeySeriesLinkProperties = class extends BaseProperties29 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "fill", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "stroke", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "lineDash", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "itemStyler", 2); +var SankeySeriesNodeProperties = class extends BaseProperties29 { + constructor() { + super(...arguments); + this.spacing = 1; + this.minSpacing = 0; + this.width = 1; + this.alignment = "justify"; + this.verticalAlignment = "center"; + this.sort = "auto"; + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "spacing", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "width", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "alignment", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "verticalAlignment", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "sort", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "fill", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "stroke", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "lineDash", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "itemStyler", 2); +var SankeySeriesProperties = class extends SeriesProperties13 { + constructor() { + super(); + this.nodes = void 0; + this.idKey = ""; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.sizeKey = void 0; + this.sizeName = void 0; + this.fillGradientDefaults = new FillGradientDefaults3(); + this.fillPatternDefaults = new FillPatternDefaults3(); + this.fillImageDefaults = new FillImageDefaults3(); + this.defaultColorRange = []; + this.defaultPatternFills = []; + this.fills = []; + this.strokes = []; + this.label = new SankeySeriesLabelProperties(); + this.link = new SankeySeriesLinkProperties(); + this.node = new SankeySeriesNodeProperties(); + this.tooltip = makeSeriesTooltip22(); + this.highlightStyle.deprecated = false; + } + getStyle(isLink, fills, strokes, index) { + const { + fillOpacity, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + fill = fills[index % fills.length], + stroke: stroke2 = strokes[index % fills.length] + } = isLink ? this.link : this.node; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "nodes", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "fromKey", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "toKey", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "fillGradientDefaults", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "fillPatternDefaults", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "fillImageDefaults", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "defaultPatternFills", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "fills", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "strokes", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "label", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "link", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "node", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeries.ts +var { + Transformable: Transformable3, + applyShapeStyle: applyShapeStyle18, + SeriesNodePickMode: SeriesNodePickMode16, + createDatumId: createDatumId20, + getShapeStyle: getShapeStyle2, + getLabelStyles: getLabelStyles6, + Rect: Rect8, + BBox: BBox26, + mergeDefaults: mergeDefaults20 +} = import_ag_charts_community270._ModuleSupport; +var SankeySeries = class extends FlowProportionSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode16.NEAREST_NODE, SeriesNodePickMode16.EXACT_SHAPE_MATCH] + }); + this.properties = new SankeySeriesProperties(); + } + isLabelEnabled() { + return (this.properties.labelKey != null || this.nodes == null) && this.properties.label.enabled; + } + linkFactory() { + return new SankeyLink(); + } + nodeFactory() { + return new Rect8(); + } + createNodeData() { + const { + id: seriesId, + _nodeDataDependencies: { seriesRectWidth, seriesRectHeight } = { seriesRectWidth: 0, seriesRectHeight: 0 } + } = this; + const { + fromKey, + toKey, + sizeKey, + labelKey, + label: { spacing: labelSpacing, placement: labelPlacement, edgePlacement: edgeLabelPlacement }, + node: { width: nodeWidth, alignment } + } = this.properties; + const createNode = (node) => ({ + ...node, + x: Number.NaN, + y: Number.NaN, + width: nodeWidth, + height: Number.NaN + }); + const createLink = (link) => ({ + ...link, + x1: Number.NaN, + x2: Number.NaN, + y1: Number.NaN, + y2: Number.NaN, + height: Number.NaN, + elbows: [] + }); + const { + nodeGraph: baseNodeGraph, + links, + maxPathLength + } = this.getNodeGraph(createNode, createLink, { includeCircularReferences: false }); + const nodeGraph = baseNodeGraph; + if (nodeGraph.size === 0) + return; + const columns = []; + for (let index = 0; index < maxPathLength; index += 1) { + columns.push({ index, size: 0, nodes: [], x: 0 }); + } + for (const graphNode of nodeGraph.values()) { + const { datum: node, linksBefore, linksAfter, maxPathLengthBefore, maxPathLengthAfter } = graphNode; + const size = Math.max( + linksBefore.reduce((acc, { link }) => acc + link.size, 0), + linksAfter.reduce((acc, { link }) => acc + link.size, 0) + ); + if (linksBefore.length === 0 && linksAfter.length === 0 || size === 0) { + graphNode.columnIndex = -1; + continue; + } + let column; + switch (alignment) { + case "left": + column = columns[maxPathLengthBefore]; + break; + case "right": + column = columns[maxPathLength - 1 - maxPathLengthAfter]; + break; + case "center": { + if (linksBefore.length !== 0) { + column = columns[maxPathLengthBefore]; + } else if (linksAfter.length === 0) { + column = columns[0]; + } else { + const columnIndex = linksAfter.reduce( + (acc, link) => Math.min(acc, link.node.maxPathLengthBefore), + maxPathLength + ) - 1; + column = columns[columnIndex]; + } + break; + } + case "justify": { + column = linksAfter.length === 0 ? columns[maxPathLength - 1] : columns[maxPathLengthBefore]; + break; + } + } + node.size = size; + const { label } = this.properties; + const labelText = label.enabled ? this.getLabelText( + node.label, + node.datum, + labelKey, + "label", + [], + this.properties.label, + { datum: node.datum, value: node.label, fromKey, toKey, sizeKey, size } + ) : void 0; + node.label = (0, import_ag_charts_core114.toPlainText)(labelText); + column.nodes.push(graphNode); + column.size += size; + graphNode.columnIndex = column.index; + } + const measurer2 = (0, import_ag_charts_core114.cachedTextMeasurer)(this.properties.label); + let columnLabelInsetBefore = 0; + let columnLabelInsetAfter = 0; + if (this.isLabelEnabled()) { + if (labelPlacement == null && edgeLabelPlacement == null) { + columnLabelInsetBefore = (seriesRectWidth - nodeWidth) * (1 - maxPathLength / (maxPathLength + 1)); + columnLabelInsetAfter = columnLabelInsetBefore; + } else if (edgeLabelPlacement === "outside" || edgeLabelPlacement == null) { + const reduceLabelWidthFn = (acc, n) => { + const node = n; + if (node.datum.label == null || node.datum.label === "") + return acc; + let maxWidth = (seriesRectWidth - nodeWidth) / (maxPathLength - 1) - labelSpacing; + if (labelPlacement === "center" && edgeLabelPlacement == null) + maxWidth /= 2; + const text2 = (0, import_ag_charts_core114.wrapText)(node.datum.label, { + maxWidth, + maxHeight: node.datum.height, + font: this.properties.label, + textWrap: "never" + }); + let { width } = measurer2.measureLines(text2); + if (labelPlacement === "center" && edgeLabelPlacement == null) + width /= 2; + return Math.max(acc, width); + }; + if (labelPlacement !== "right" || edgeLabelPlacement === "outside") { + columnLabelInsetBefore = nodeWidth + columns[0].nodes.reduce(reduceLabelWidthFn, 0); + } + if (labelPlacement !== "left" || edgeLabelPlacement === "outside") { + columnLabelInsetAfter = nodeWidth + columns.at(-1).nodes.reduce(reduceLabelWidthFn, 0); + } + } + } + const columnWidth = (seriesRectWidth - nodeWidth - columnLabelInsetBefore - columnLabelInsetAfter) / (maxPathLength - 1); + for (let index = 0; index < columns.length; index++) { + const column = columns[index]; + column.x = columnLabelInsetBefore + index * columnWidth; + for (const graphNode of column.nodes) { + graphNode.datum.x = column.x; + } + } + for (const graphNode of nodeGraph.values()) { + graphNode.weight = 0; + let closestColumnDiff = Infinity; + for (const link of graphNode.linksAfter) { + const node = link.node; + closestColumnDiff = Math.min(closestColumnDiff, node.columnIndex - graphNode.columnIndex); + } + if (closestColumnDiff === Infinity) { + for (const link of graphNode.linksBefore) { + const node = link.node; + closestColumnDiff = Math.min(closestColumnDiff, graphNode.columnIndex - node.columnIndex); + } + } + graphNode.closestColumnDiff = closestColumnDiff; + for (const link of graphNode.linksAfter) { + const node = link.node; + if (node.columnIndex <= graphNode.columnIndex) + continue; + for (let i = node.columnIndex - 1; i > graphNode.columnIndex; i--) { + const size = link.link.size; + const ghostNode = { + ghost: true, + datum: { ...graphNode.datum, size, y: 0, height: 0 }, + weight: 0, + linksBefore: [{ node: { columnIndex: i - 1, datum: { size } } }], + linksAfter: [{ node: { columnIndex: i + 1, datum: { size } } }], + link: link.link, + columnIndex: graphNode.columnIndex, + size: graphNode.datum.size, + closestColumnDiff, + fromNode: { y: node.datum.y }, + toNode: { y: 0 } + }; + columns[i].size += size; + columns[i].nodes.push(ghostNode); + } + } + } + const sortedColumns = columns.toSorted((a, b) => { + const aMax = a.nodes.reduce((acc, n) => Math.max(acc, n.datum.size), 0); + const bMax = b.nodes.reduce((acc, n) => Math.max(acc, n.datum.size), 0); + return bMax - aMax; + }); + const columnWeights = {}; + for (let i = 0; i < sortedColumns.length; i++) { + columnWeights[sortedColumns[i].index] = Math.pow(10, sortedColumns.length - i - 1); + } + for (const column of columns) { + for (const node of column.nodes) { + node.weight = node.datum.size / column.size * columnWeights[column.index]; + if ("ghost" in node && node.ghost) { + node.weight = node.size / column.size * columnWeights[column.index]; + continue; + } + node.weight += node.linksBefore.reduce((acc, before) => { + if (before.node.columnIndex !== column.index - 1) + return acc; + const weight = before.node.datum.size / columns[before.node.columnIndex].size * columnWeights[before.node.columnIndex]; + return Math.max(acc, weight); + }, 0); + node.weight += node.linksAfter.reduce((acc, after) => { + if (after.node.columnIndex !== column.index + 1) + return acc; + const weight = after.node.datum.size / columns[after.node.columnIndex].size * columnWeights[after.node.columnIndex]; + return Math.max(acc, weight); + }, 0); + } + column.nodes.sort((a, b) => this.sortNodes(a, b)); + } + const minSize = 1; + const getSizeScale = (spacing) => { + return columns.reduce((acc, { size, nodes }) => { + const spacingAccomodation = seriesRectHeight - nodes.length * minSize; + const spacingOccupation = (nodes.length - 1) * spacing / spacingAccomodation; + const columnSizeScale = (1 - spacingOccupation) / size; + return Math.min(acc, columnSizeScale); + }, Infinity); + }; + let nodeSpacing = this.properties.node.spacing; + let sizeScale = getSizeScale(nodeSpacing); + while (sizeScale < 0 && nodeSpacing > this.properties.node.minSpacing) { + nodeSpacing -= 1; + sizeScale = getSizeScale(nodeSpacing); + } + if (sizeScale < 0) { + import_ag_charts_core114.Logger.warnOnce( + "There was insufficient space to display the Sankey Series. Reduce [node.spacing], [node.minSpacing], or provide a larger container." + ); + return; + } + for (const column of columns) { + let columnNodesHeight = 0; + for (const node of column.nodes) { + const height = seriesRectHeight * node.datum.size * sizeScale; + node.datum.height = Math.max(minSize, height); + columnNodesHeight += height; + } + const spacingOccupation = nodeSpacing * (column.nodes.length - 1); + let y = 0; + if (this.properties.node.verticalAlignment === "bottom") { + y = seriesRectHeight - columnNodesHeight - spacingOccupation; + } else if (this.properties.node.verticalAlignment === "center") { + y = (seriesRectHeight - columnNodesHeight - spacingOccupation) / 2; + } + for (const node of column.nodes) { + node.datum.y = y; + y += seriesRectHeight * node.datum.size * sizeScale + nodeSpacing; + if ("ghost" in node && node.ghost) { + node.link.elbows.push({ x: column.x, y: node.datum.y }); + } + } + } + for (const { datum, linksBefore, linksAfter } of nodeGraph.values()) { + let y2 = datum.y; + linksBefore.sort( + (a, b) => this.sortNodes(a.node, b.node) + ); + for (const { link } of linksBefore) { + link.y2 = y2; + y2 += link.size * seriesRectHeight * sizeScale; + } + let y1 = datum.y; + linksAfter.sort( + (a, b) => this.sortNodes(a.node, b.node, { + invertColumnSort: true + }) + ); + for (const { link } of linksAfter) { + link.y1 = y1; + y1 += link.size * seriesRectHeight * sizeScale; + } + } + const nodeData = []; + const labelData = []; + const { fontSize } = this.properties.label; + for (const [index, column] of columns.entries()) { + const leading = index === 0; + const trailing = index === columns.length - 1; + let bottom = -Infinity; + column.nodes.sort((a, b) => a.datum.y - b.datum.y); + for (const n of column.nodes) { + if ("ghost" in n && n.ghost) + continue; + const { datum: node } = n; + node.midPoint = { + x: node.x + node.width / 2, + y: node.y + node.height / 2 + }; + nodeData.push(node); + if (node.label == null) + continue; + const y = node.y + node.height / 2; + let text2; + if (!leading && !trailing) { + const lineHeight = (0, import_ag_charts_core114.calcLineHeight)(fontSize); + const y12 = y - lineHeight; + const y2 = y + lineHeight; + let maxX = seriesRectWidth; + for (const { datum } of nodeGraph.values()) { + const intersectsLabel = datum.x > node.x && Math.max(datum.y, y12) <= Math.min(datum.y + datum.height, y2); + if (intersectsLabel) { + maxX = Math.min(maxX, datum.x - labelSpacing); + } + } + const maxWidth = maxX - node.x - 2 * labelSpacing; + text2 = (0, import_ag_charts_core114.wrapText)(node.label, { + maxWidth, + maxHeight: node.height, + font: this.properties.label, + textWrap: "never", + overflow: "hide" + }); + } + if (text2 == null || text2 === "") { + const labelInset = edgeLabelPlacement == null && (leading || trailing) ? labelSpacing : labelSpacing * 2; + text2 = (0, import_ag_charts_core114.wrapText)(node.label, { + maxWidth: columnWidth - labelInset, + maxHeight: node.height, + font: this.properties.label, + textWrap: "never" + }); + } + if (text2 === "") + continue; + const { height } = measurer2.measureLines(text2); + const y0 = y - height / 2; + const y1 = y + height / 2; + let x = node.x + node.width + labelSpacing; + let textAlign = "left"; + let placement = labelPlacement; + if (leading && edgeLabelPlacement == null && labelPlacement == null) { + placement = "left"; + } + if (edgeLabelPlacement === "outside") { + if (leading) + placement = "left"; + if (trailing) + placement = "right"; + } else if (edgeLabelPlacement === "inside") { + if (leading) + placement = "right"; + if (trailing) + placement = "left"; + } + if (placement === "left") { + x = node.x - labelSpacing; + textAlign = "right"; + } else if (placement === "center") { + x = node.x + node.width / 2; + textAlign = "center"; + } + if (y0 >= bottom) { + labelData.push({ x, y, textAlign, text: text2, size: node.size }); + bottom = y1; + } + } + } + for (const link of links) { + const { fromNode, toNode, size } = link; + link.height = Math.max(minSize, seriesRectHeight * size * sizeScale); + link.x1 = fromNode.x + nodeWidth; + link.x2 = toNode.x; + link.midPoint = { + x: (link.x1 + link.x2) / 2, + y: (link.y1 + link.y2) / 2 + link.height / 2 + }; + nodeData.push(link); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + sortNodes(a, b, opts) { + const { properties } = this; + if (properties.node.sort === "ascending") { + return (a.datum.label ?? "").localeCompare(b.datum.label ?? ""); + } else if (properties.node.sort === "descending") { + return (b.datum.label ?? "").localeCompare(a.datum.label ?? ""); + } else if (properties.node.sort === "data") { + return 0; + } + if (a.columnIndex < b.columnIndex) + return opts?.invertColumnSort ? 1 : -1; + if (a.columnIndex > b.columnIndex) + return opts?.invertColumnSort ? -1 : 1; + if (a.weight === b.weight) { + return a.datum.size - b.datum.size; + } + if (a.closestColumnDiff < b.closestColumnDiff) + return 1; + if (a.closestColumnDiff > b.closestColumnDiff) + return -1; + return a.weight - b.weight; + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, datum) => { + const { x, y, textAlign, text: text2 } = datum; + const params = datum; + const style = getLabelStyles6(this, void 0, params, this.properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x; + label.y = y; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = "middle"; + label.setBoxing(style); + }); + } + updateNodeSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId20(datum.type, datum.id)); + } + getNodeStyle(nodeDatum, fromNodeDatumIndex, isHighlight) { + const { properties } = this; + const { + fills, + strokes, + defaultColorRange, + defaultPatternFills, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3 + } = properties; + const { itemStyler } = properties.node; + const defaultColorStops = defaultColorRange[fromNodeDatumIndex % defaultColorRange.length].map((color6) => ({ + color: color6 + })); + const defaultPatternFill = defaultPatternFills[fromNodeDatumIndex % defaultPatternFills.length]; + const highlightStyle = this.getHighlightStyle(isHighlight, nodeDatum.datumIndex); + const baseStyle = mergeDefaults20(highlightStyle, properties.getStyle(false, fills, strokes, fromNodeDatumIndex)); + const hasNodeFill = properties.node.fill != null; + let style = getShapeStyle2( + baseStyle, + hasNodeFill ? fillGradientDefaults3 : { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + hasNodeFill ? fillPatternDefaults3 : { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + if (itemStyler != null && nodeDatum.datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId20(nodeDatum.datumIndex.index, "node", isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults20( + overrides, + style, + { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + makeItemStylerParams({ datum, datumIndex, size = 0, label }, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + size, + label, + fill + }; + } + updateNodeNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const { datumIndex } = datum; + const style = this.getNodeStyle(datum, datumIndex.index, isHighlight); + rect.x = datum.x; + rect.y = datum.y; + rect.width = Math.max(datum.width, 0); + rect.height = Math.max(datum.height, 0); + applyShapeStyle18(rect, style, fillBBox); + }); + } + getShapeFillBBox() { + const width = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const height = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const bbox = new BBox26(0, 0, width, height); + return { series: bbox, axis: bbox }; + } + updateLinkSelection(opts) { + return opts.datumSelection.update( + opts.nodeData, + void 0, + (datum) => createDatumId20(datum.type, datum.index, datum.fromNode.id, datum.toNode.id) + ); + } + getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, isHighlight) { + const { id: seriesId, properties } = this; + const { + fills, + strokes, + defaultColorRange, + defaultPatternFills, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3 + } = properties; + const { itemStyler } = properties.link; + const defaultColorStops = defaultColorRange[fromNodeDatumIndex.index % defaultColorRange.length].map( + (color6) => ({ + color: color6 + }) + ); + const defaultPatternFill = defaultPatternFills[fromNodeDatumIndex.index % defaultPatternFills.length]; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults20( + highlightStyle, + properties.getStyle(true, fills, strokes, fromNodeDatumIndex.index) + ); + const hasLinkFill = properties.link.fill != null; + let style = getShapeStyle2( + baseStyle, + hasLinkFill ? fillGradientDefaults3 : { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + hasLinkFill ? fillPatternDefaults3 : { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId20(datumIndex.index, "link", isHighlight ? "highlight" : "node"), + () => { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }); + } + ); + if (overrides) { + style = mergeDefaults20( + overrides, + style, + { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + updateLinkNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((link, datum) => { + const fromNodeDatumIndex = datum.fromNode.datumIndex; + const style = this.getLinkStyle(datum, fromNodeDatumIndex, isHighlight); + link.x1 = datum.x1; + link.y1 = datum.y1; + link.x2 = datum.x2; + link.y2 = datum.y2; + link.height = datum.height; + link.elbows = datum.elbows; + applyShapeStyle18(link, style, fillBBox); + link.inset = link.strokeWidth / 2; + }); + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + linksProcessedData, + nodesProcessedData, + properties, + ctx: { formatManager } + } = this; + const { fromKey, toKey, sizeKey, sizeName, tooltip } = properties; + const seriesDatum = this.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + if (seriesDatum == null) + return; + const nodeIndex = seriesDatum.type === 0 /* Link */ ? seriesDatum.fromNode.index : seriesDatum.index; + const title = seriesDatum.type === 0 /* Link */ ? `${seriesDatum.fromNode.label} - ${seriesDatum.toNode.label}` : seriesDatum.label; + const datum = datumIndex.type === 0 /* Link */ ? linksProcessedData?.dataSources.get(this.id)?.data[datumIndex.index] : nodesProcessedData?.dataSources.get(this.id)?.data[datumIndex.index]; + const size = seriesDatum.size; + let format; + if (seriesDatum.type === 0 /* Link */) { + const fromNodeDatumIndex = seriesDatum.fromNode.datumIndex; + format = this.getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, false); + } else { + format = this.getNodeStyle({ datumIndex, datum }, datumIndex.index, false); + } + const data = []; + if (sizeKey != null) { + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: size, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + domain: [], + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(size) }); + } + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(seriesDatum.type, nodeIndex, format), + data + }, + { + seriesId, + datum, + title, + fromKey, + toKey, + sizeKey, + sizeName, + size, + ...format + } + ); + } + computeFocusBounds(node) { + if (node instanceof Rect8) { + const { x, y, width, height } = node; + const bbox = new BBox26(x, y, width, height); + return Transformable3.toCanvas(this.contentGroup, bbox); + } + return node; + } + hasItemStylers() { + return this.properties.node.itemStyler != null || this.properties.link.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +SankeySeries.className = "SankeySeries"; +SankeySeries.type = "sankey"; + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeriesOptionsDef.ts +var import_ag_charts_community271 = require("ag-charts-community"); +var import_ag_charts_core115 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs21, sankeySeriesThemeableOptionsDef } = import_ag_charts_community271._ModuleSupport; +var sankeySeriesOptionsDef = { + ...sankeySeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs21, + type: (0, import_ag_charts_core115.required)((0, import_ag_charts_core115.constant)("sankey")), + fromKey: (0, import_ag_charts_core115.required)(import_ag_charts_core115.string), + toKey: (0, import_ag_charts_core115.required)(import_ag_charts_core115.string), + sizeKey: import_ag_charts_core115.string, + sizeName: import_ag_charts_core115.string +}; +sankeySeriesOptionsDef.fillGradientDefaults = (0, import_ag_charts_core115.undocumented)(import_ag_charts_core115.fillGradientDefaults); +sankeySeriesOptionsDef.fillPatternDefaults = (0, import_ag_charts_core115.undocumented)(import_ag_charts_core115.fillPatternDefaults); +sankeySeriesOptionsDef.fillImageDefaults = (0, import_ag_charts_core115.undocumented)(import_ag_charts_core115.fillImageDefaults); +sankeySeriesOptionsDef.defaultColorRange = (0, import_ag_charts_core115.undocumented)((0, import_ag_charts_core115.arrayOf)((0, import_ag_charts_core115.arrayOf)(import_ag_charts_core115.color))); +sankeySeriesOptionsDef.defaultPatternFills = (0, import_ag_charts_core115.undocumented)((0, import_ag_charts_core115.arrayOf)(import_ag_charts_core115.color)); + +// packages/ag-charts-enterprise/src/series/sankey/sankeyModule.ts +var SankeyModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + solo: true, + identifier: "sankey", + moduleFactory: (ctx) => new SankeySeries(ctx), + themeTemplate: { + seriesArea: { + padding: { + top: 10, + bottom: 10 + } + }, + series: { + fills: { $palette: "fills" }, + strokes: { $palette: "strokes" }, + // @ts-expect-error undocumented option + fillGradientDefaults: import_ag_charts_community272._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS, + fillPatternDefaults: import_ag_charts_community272._ModuleSupport.FILL_PATTERN_DEFAULTS, + fillImageDefaults: import_ag_charts_community272._ModuleSupport.FILL_IMAGE_DEFAULTS, + defaultColorRange: { $palette: "gradients" }, + defaultPatternFills: import_ag_charts_community272._ModuleSupport.SAFE_FILLS_OPERATION, + highlightStyle: { + series: { + dimOpacity: 0.2 + } + }, + highlight: { + ...import_ag_charts_community272._ModuleSupport.singleSeriesHighlightStyle() + }, + label: { + ...import_ag_charts_community272._ModuleSupport.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 10 + }, + node: { + spacing: { $if: [{ $greaterThan: [{ $path: "./minSpacing" }, 20] }, { $path: "./minSpacing" }, 20] }, + minSpacing: 0, + width: 10, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + link: { + fillOpacity: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + } + }, + legend: { + enabled: false, + toggleSeries: false + } + } +}; +var SankeySeriesModule = { + type: "series", + name: "sankey", + chartType: "standalone", + enterprise: true, + options: sankeySeriesOptionsDef, + create: (ctx) => new SankeySeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstModule.ts +var import_ag_charts_community276 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeries.ts +var import_ag_charts_community274 = require("ag-charts-community"); +var import_ag_charts_core116 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeriesProperties.ts +var import_ag_charts_community273 = require("ag-charts-community"); +var { HierarchySeriesProperties, HighlightStyle, makeSeriesTooltip: makeSeriesTooltip23, Property: Property83 } = import_ag_charts_community273._ModuleSupport; +var SunburstSeriesTileHighlightStyle = class extends HighlightStyle { + constructor() { + super(false); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedLabel(); + } +}; +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "label", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "secondaryLabel", 2); +var SunburstSeriesProperties = class extends HierarchySeriesProperties { + constructor() { + super(...arguments); + this.fillOpacity = 1; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.highlightStyle = new SunburstSeriesTileHighlightStyle(); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + this.tooltip = makeSeriesTooltip23(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity } = this; + return { + fill: fills[index % fills.length], + fillOpacity, + stroke: strokes[index % strokes.length], + strokeWidth, + strokeOpacity, + opacity: 1 + }; + } +}; +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "secondaryLabelKey", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "sectorSpacing", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "padding", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "highlightStyle", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "secondaryLabel", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeries.ts +var { + fromToMotion: fromToMotion6, + normalizeAngle360: normalizeAngle3608, + createDatumId: createDatumId21, + PointerEvents: PointerEvents13, + Sector: Sector7, + Group: Group20, + ScalableGroup, + Selection: Selection17, + TransformableText: TransformableText3, + BBox: BBox27, + applyShapeStyle: applyShapeStyle19, + mergeDefaults: mergeDefaults21, + formatValue: formatValue2, + getLabelStyles: getLabelStyles7 +} = import_ag_charts_community274._ModuleSupport; +var SunburstNode = class extends import_ag_charts_community274._ModuleSupport.HierarchyNode { + constructor() { + super(...arguments); + this.label = void 0; + this.secondaryLabel = void 0; + this.contentHeight = 0; + this.bbox = void 0; + // cspell:ignore bbox + this.startAngle = 0; + this.endAngle = 0; + } +}; +function setAngleData(node, startAngle = 0, angleScale = 2 * Math.PI / node.sumSize) { + for (const child of node.children) { + const endAngle = startAngle + child.sumSize * angleScale; + child.startAngle = startAngle; + child.endAngle = endAngle; + setAngleData(child, startAngle, angleScale); + startAngle = endAngle; + } +} +var SunburstSeries = class extends import_ag_charts_community274._ModuleSupport.HierarchySeries { + constructor(moduleCtx) { + super(moduleCtx); + this.NodeClass = SunburstNode; + this.properties = new SunburstSeriesProperties(); + this.scalingGroup = this.contentGroup.appendChild(new ScalableGroup()); + this.sectorGroup = this.scalingGroup.appendChild(new Group20()); + this.sectorLabelGroup = this.scalingGroup.appendChild(new Group20()); + this.highlightSectorGroup = this.scalingGroup.appendChild(new Group20()); + this.datumSelection = Selection17.select(this.sectorGroup, Sector7); + this.labelSelection = Selection17.select( + this.sectorLabelGroup, + Group20 + ); + this.highlightSelection = Selection17.select( + this.highlightSectorGroup, + Sector7 + ); + this.sectorLabelGroup.pointerEvents = PointerEvents13.None; + } + processData() { + super.processData(); + setAngleData(this.rootNode); + } + updateSelections() { + const highlightedNode = this.ctx.highlightManager?.getActiveHighlight(); + this.highlightSelection.update( + highlightedNode == null ? [] : [highlightedNode], + void 0, + (node) => this.getDatumId(node) + ); + if (!this.nodeDataRefresh) + return; + this.nodeDataRefresh = false; + const { chart } = this; + if (chart == null) + return; + const seriesRect = chart.seriesRect; + if (seriesRect == null) + return; + const descendants = Array.from(this.rootNode); + const updateLabelGroup = (group) => { + group.append([ + new TransformableText3({ tag: 0 /* Primary */ }), + new TransformableText3({ tag: 1 /* Secondary */ }) + ]); + }; + this.datumSelection.update(descendants, void 0, (node) => this.getDatumId(node)); + this.labelSelection.update(descendants, updateLabelGroup, (node) => this.getDatumId(node)); + } + getItemStyle(nodeDatum, isHighlight) { + const { properties, colorScale } = this; + const { itemStyler } = properties; + const rootIndex = nodeDatum.datumIndex?.[0] ?? 0; + const highlightStyle = isHighlight ? properties.highlightStyle : void 0; + const baseStyle = mergeDefaults21(highlightStyle, properties.getStyle(rootIndex)); + if (!isHighlight && nodeDatum.colorValue != null) { + baseStyle.fill = colorScale.convert(nodeDatum.colorValue); + } + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId21(this.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults21(overrides, style); + } + } + return style; + } + makeItemStylerParams(nodeDatum, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + depth: nodeDatum.depth ?? 0, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateNodes() { + const { chart, data, maxDepth } = this; + if (chart == null || data == null) { + return; + } + const { width, height } = chart.seriesRect; + const { + sectorSpacing = 0, + padding = 0, + cornerRadius, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName + } = this.properties; + this.contentGroup.translationX = width / 2; + this.contentGroup.translationY = height / 2; + const baseInset = sectorSpacing * 0.5; + const radius = Math.min(width, height) / 2; + const radiusScale = radius / (maxDepth + 1); + const angleOffset = -Math.PI / 2; + const seriesFillBBox = { + series: new BBox27(-radius, -radius, 2 * radius, 2 * radius), + axis: new BBox27(-radius, -radius, 2 * radius, 2 * radius) + }; + this.rootNode?.walk((node) => { + const { startAngle, endAngle } = node; + if (node.depth != null) { + const midAngle = (startAngle + endAngle) / 2 + angleOffset; + const midRadius = (node.depth + 0.5) * radiusScale; + node.midPoint.x = Math.cos(midAngle) * midRadius; + node.midPoint.y = Math.sin(midAngle) * midRadius; + } + }); + this.rootNode?.walk((node) => { + const { datum, depth, startAngle, endAngle, parent, sumSize } = node; + node.label = void 0; + node.secondaryLabel = void 0; + node.contentHeight = 0; + let labelValue; + if (datum != null && depth != null && labelKey != null) { + const value = datum[labelKey]; + labelValue = this.getLabelText( + value, + datum, + labelKey, + "label", + [], + this.properties.label, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (labelValue === "") { + labelValue = void 0; + } + let secondaryLabelValue; + if (datum != null && depth != null && secondaryLabelKey != null) { + const value = datum[secondaryLabelKey]; + secondaryLabelValue = this.getLabelText( + value, + datum, + secondaryLabelKey, + "secondaryLabel", + [], + this.properties.secondaryLabel, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (secondaryLabelValue === "") { + secondaryLabelValue = void 0; + } + if (depth == null) + return; + const innerRadius = depth * radiusScale + baseInset; + const outerRadius = (depth + 1) * radiusScale - baseInset; + const innerAngleOffset = innerRadius > baseInset ? baseInset / innerRadius : baseInset; + const outerAngleOffset = outerRadius > baseInset ? baseInset / outerRadius : baseInset; + const innerStartAngle = startAngle + innerAngleOffset; + const innerEndAngle = endAngle + innerAngleOffset; + const deltaInnerAngle = innerEndAngle - innerStartAngle; + const outerStartAngle = startAngle + outerAngleOffset; + const outerEndAngle = endAngle + outerAngleOffset; + const deltaOuterAngle = outerEndAngle - outerStartAngle; + const sizeFittingHeight = (labelHeight2) => { + const isCenterCircle = depth === 0 && parent?.sumSize === sumSize; + if (isCenterCircle) { + const labelWidth2 = 2 * Math.sqrt(outerRadius ** 2 - (labelHeight2 * 0.5) ** 2); + return { width: labelWidth2, height: labelHeight2, meta: 0 /* CenterCircle */ }; + } + const parallelHeight = labelHeight2; + const availableWidthUntilItHitsTheOuterRadius = 2 * Math.sqrt(outerRadius ** 2 - (innerRadius + parallelHeight) ** 2); + const availableWidthUntilItHitsTheStraightEdges = deltaInnerAngle < Math.PI ? 2 * innerRadius * Math.tan(deltaInnerAngle * 0.5) : Infinity; + const parallelWidth = Math.min( + availableWidthUntilItHitsTheOuterRadius, + availableWidthUntilItHitsTheStraightEdges + ); + const maxPerpendicularAngle = Math.PI / 4; + let perpendicularHeight; + let perpendicularWidth; + if (depth === 0) { + perpendicularHeight = labelHeight2; + perpendicularWidth = Math.sqrt(outerRadius ** 2 - (perpendicularHeight / 2) ** 2) - labelHeight2 / (2 * Math.tan(deltaOuterAngle * 0.5)); + } else if (normalizeAngle3608(deltaInnerAngle) < maxPerpendicularAngle) { + perpendicularHeight = 2 * innerRadius * Math.tan(deltaInnerAngle * 0.5); + perpendicularWidth = Math.sqrt(outerRadius ** 2 - (perpendicularHeight / 2) ** 2) - innerRadius; + } else { + perpendicularWidth = 0; + perpendicularHeight = 0; + } + return parallelWidth >= perpendicularWidth ? { width: parallelWidth, height: parallelHeight, meta: 1 /* Parallel */ } : { width: perpendicularWidth, height: perpendicularHeight, meta: 2 /* Perpendicular */ }; + }; + const formatting = formatLabels( + (0, import_ag_charts_core116.toPlainText)(labelValue), + this.properties.label, + (0, import_ag_charts_core116.toPlainText)(secondaryLabelValue), + this.properties.secondaryLabel, + { padding }, + sizeFittingHeight + ); + if (formatting == null) + return; + const { width: labelWidth, height: labelHeight, meta: labelPlacement, label, secondaryLabel } = formatting; + const theta = angleOffset + (startAngle + endAngle) / 2; + const top = Math.sin(theta) >= 0; + const right = Math.cos(theta) >= 0; + const circleQuarter = (top ? 3 /* Top */ : 12 /* Bottom */) & (right ? 6 /* Right */ : 9 /* Left */); + let labelRadius; + switch (labelPlacement) { + case 0 /* CenterCircle */: + labelRadius = 0; + break; + case 1 /* Parallel */: { + const opticalCentering = 0.58; + const idealRadius = outerRadius - (radiusScale - labelHeight) * opticalCentering; + const maximumRadius = Math.sqrt((outerRadius - padding) ** 2 - (labelWidth / 2) ** 2); + labelRadius = Math.min(idealRadius, maximumRadius); + break; + } + case 2 /* Perpendicular */: + if (depth === 0) { + const minimumRadius = labelHeight / (2 * Math.tan(deltaInnerAngle * 0.5)) + labelWidth * 0.5; + const maximumRadius = Math.sqrt(outerRadius ** 2 - (labelHeight * 0.5) ** 2) - labelWidth * 0.5; + labelRadius = (minimumRadius + maximumRadius) * 0.5; + } else { + labelRadius = (innerRadius + outerRadius) * 0.5; + } + break; + } + if (label != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.label; + node.label = { + ...label, + fontStyle, + fontFamily, + fontWeight, + color: color6, + labelPlacement, + circleQuarter, + radius: labelRadius, + theta + }; + } + if (secondaryLabel != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.secondaryLabel; + node.secondaryLabel = { + ...secondaryLabel, + fontStyle, + fontFamily, + fontWeight, + color: color6, + labelPlacement, + circleQuarter, + radius: labelRadius, + theta + }; + } + node.contentHeight = formatting.height; + }); + const updateSector = (nodeDatum, sector, highlighted) => { + const { depth, startAngle, endAngle } = nodeDatum; + if (depth == null) { + sector.visible = false; + return; + } + sector.visible = true; + const style = this.getItemStyle(nodeDatum, highlighted); + const fill = style.fill; + const strokeWidth = style.strokeWidth; + const fillBBox = import_ag_charts_community274._ModuleSupport.isGradientFill(fill) && fill.bounds !== "item" ? seriesFillBBox : void 0; + applyShapeStyle19(sector, style, fillBBox); + sector.centerX = 0; + sector.centerY = 0; + sector.innerRadius = depth * radiusScale; + sector.outerRadius = (depth + 1) * radiusScale; + sector.startAngle = startAngle + angleOffset; + sector.endAngle = endAngle + angleOffset; + sector.inset = baseInset + strokeWidth * 0.5; + sector.cornerRadius = cornerRadius; + }; + this.datumSelection.each((sector, datum) => { + updateSector(datum, sector, false); + }); + this.highlightSelection.each((rect, datum) => { + updateSector(datum, rect, true); + }); + const updateText = (node, text2, tag, highlighted) => { + const { depth, contentHeight } = node; + const primary = tag === 0 /* Primary */; + const label = primary ? node.label : node.secondaryLabel; + if (depth == null || label == null) { + text2.visible = false; + return; + } + const { labelPlacement, circleQuarter, radius: textRadius, theta } = label; + let highlightedColor; + if (highlighted) { + const highlightedLabelStyle = primary ? this.properties.highlightStyle.label : this.properties.highlightStyle.secondaryLabel; + highlightedColor = highlightedLabelStyle.color; + } + const params = { + childrenKey: this.properties.childrenKey, + colorKey: this.properties.colorKey, + colorName: this.properties.colorName ?? this.properties.colorKey, + depth: node.depth ?? Number.NaN, + labelKey: this.properties.labelKey, + secondaryLabelKey: this.properties.secondaryLabelKey, + sizeKey: this.properties.sizeKey, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }; + const baseLabelStyle = primary ? this.properties.label : this.properties.secondaryLabel; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const style = getLabelStyles7(this, node, params, baseLabelStyle, highlighted, activeHighlight); + text2.text = label.text; + text2.fontSize = label.fontSize; + text2.lineHeight = label.lineHeight; + text2.fontStyle = label.fontStyle; + text2.fontFamily = label.fontFamily; + text2.fontWeight = label.fontWeight; + text2.fill = highlightedColor ?? label.color; + text2.fillOpacity = this.getHighlightStyle(highlighted, node.datumIndex)?.opacity ?? 1; + text2.setBoxing(style); + switch (labelPlacement) { + case 0 /* CenterCircle */: + text2.textAlign = "center"; + text2.textBaseline = "top"; + text2.translationX = 0; + text2.translationY = (primary ? 0 : contentHeight - label.height) - contentHeight * 0.5; + text2.rotation = 0; + break; + case 1 /* Parallel */: { + const topHalf = (circleQuarter & 3 /* Top */) !== 0; + const translationRadius = primary === !topHalf ? textRadius : textRadius - (contentHeight - label.height); + text2.textAlign = "center"; + text2.textBaseline = topHalf ? "bottom" : "top"; + text2.translationX = Math.cos(theta) * translationRadius; + text2.translationY = Math.sin(theta) * translationRadius; + text2.rotation = topHalf ? theta - Math.PI * 0.5 : theta + Math.PI * 0.5; + break; + } + case 2 /* Perpendicular */: { + const rightHalf = (circleQuarter & 6 /* Right */) !== 0; + const translation = primary === !rightHalf ? (contentHeight - label.height) * 0.5 : (label.height - contentHeight) * 0.5; + text2.textAlign = "center"; + text2.textBaseline = "middle"; + text2.translationX = Math.cos(theta) * textRadius + Math.cos(theta + Math.PI / 2) * translation; + text2.translationY = Math.sin(theta) * textRadius + Math.sin(theta + Math.PI / 2) * translation; + text2.rotation = rightHalf ? theta : theta + Math.PI; + break; + } + } + text2.visible = true; + }; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + for (const text2 of this.labelSelection.selectByClass(TransformableText3)) { + const datum = text2.closestDatum(); + updateText(datum, text2, text2.tag, datum === highlightedDatum); + } + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties, ctx } = this; + const { labelKey, secondaryLabelKey, childrenKey, sizeKey, sizeName, colorKey, colorName, tooltip } = properties; + const { formatManager } = ctx; + const nodeDatum = datumIndex.reduce((n, i) => n?.children[i], this.rootNode); + if (nodeDatum == null) + return; + const { datum, depth } = nodeDatum; + if (datum == null || depth == null) + return; + const data = []; + const datumSize = sizeKey == null ? void 0 : datum[sizeKey]; + if (datumSize != null) { + const sizeDomain = [0, this.rootNode?.sumSize ?? 0]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumSize, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain: sizeDomain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue2(datumSize) }); + } + const datumColor = colorKey == null ? void 0 : datum[colorKey]; + if (datumColor != null) { + const { colorDomain } = this; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumColor, + datum, + seriesId, + legendItemName: void 0, + key: colorKey, + source: "tooltip", + property: "color", + boundSeries: this.getFormatterContext("color"), + domain: colorDomain, + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue2(datumColor) }); + } + const format = this.getItemStyle( + { ...nodeDatum, colorValue: datumColor ?? nodeDatum.colorValue }, + false + ); + const color6 = format.fill; + const markerStyle = { + shape: "square", + fill: color6, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + }; + if (import_ag_charts_community274._ModuleSupport.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return this.formatTooltipWithContext( + tooltip, + { + title: labelKey == null ? void 0 : datum[labelKey], + symbol: { + marker: markerStyle + }, + data + }, + { + seriesId, + datum, + title: void 0, + depth, + labelKey, + secondaryLabelKey, + childrenKey, + sizeKey, + sizeName, + colorKey, + colorName, + ...format + } + ); + } + createNodeData() { + return void 0; + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.datumSelection.nodes()); + } + animateEmptyUpdateReady() { + fromToMotion6(this.id, "nodes", this.ctx.animationManager, [this.scalingGroup], { + toFn() { + return { scalingX: 1, scalingY: 1 }; + }, + fromFn() { + return { scalingX: 0, scalingY: 0 }; + } + }); + } + computeFocusBounds(node) { + return node; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +SunburstSeries.className = "SunburstSeries"; +SunburstSeries.type = "sunburst"; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeriesOptionsDef.ts +var import_ag_charts_community275 = require("ag-charts-community"); +var import_ag_charts_core117 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs22, sunburstSeriesThemeableOptionsDef, without: without8 } = import_ag_charts_community275._ModuleSupport; +var sunburstSeriesOptionsDef = { + ...sunburstSeriesThemeableOptionsDef, + ...without8(commonSeriesOptionsDefs22, ["highlightStyle", "highlight", "showInLegend"]), + type: (0, import_ag_charts_core117.required)((0, import_ag_charts_core117.constant)("sunburst")), + labelKey: import_ag_charts_core117.string, + secondaryLabelKey: import_ag_charts_core117.string, + childrenKey: import_ag_charts_core117.string, + sizeKey: import_ag_charts_core117.string, + colorKey: import_ag_charts_core117.string, + sizeName: import_ag_charts_core117.string, + colorName: import_ag_charts_core117.string +}; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstModule.ts +var { BASE_FONT_SIZE, FONT_SIZE_RATIO: FONT_SIZE_RATIO3 } = import_ag_charts_community276._ModuleSupport; +var SunburstModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "sunburst", + moduleFactory: (ctx) => new SunburstSeries(ctx), + solo: true, + themeTemplate: { + series: { + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", import_ag_charts_community276._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS], + ["pattern", import_ag_charts_community276._ModuleSupport.FILL_PATTERN_DEFAULTS], + ["image", import_ag_charts_community276._ModuleSupport.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + colorRange: { $palette: "divergingColors" }, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + label: { + ...import_ag_charts_community276._ModuleSupport.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $rem: FONT_SIZE_RATIO3.LARGE }, + minimumFontSize: { $rem: 9 / BASE_FONT_SIZE }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + overflowStrategy: "ellipsis", + wrapping: "never", + spacing: 2 + }, + secondaryLabel: { + ...import_ag_charts_community276._ModuleSupport.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $rem: FONT_SIZE_RATIO3.SMALLEST }, + minimumFontSize: { $rem: 7 / BASE_FONT_SIZE }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + overflowStrategy: "ellipsis", + wrapping: "never" + }, + sectorSpacing: 2, + padding: 3, + highlightStyle: { + label: { + color: { $ref: "chartBackgroundColor" } + }, + secondaryLabel: { + color: { $ref: "chartBackgroundColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + } + }, + gradientLegend: { + enabled: true, + ...import_ag_charts_community276._ModuleSupport.LEGEND_CONTAINER_THEME + } + } +}; +var SunburstSeriesModule = { + type: "series", + name: "sunburst", + chartType: "standalone", + enterprise: true, + options: sunburstSeriesOptionsDef, + create: (ctx) => new SunburstSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/treemap/treemapModule.ts +var import_ag_charts_community280 = require("ag-charts-community"); + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeries.ts +var import_ag_charts_community278 = require("ag-charts-community"); +var import_ag_charts_core118 = require("ag-charts-core"); + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeriesProperties.ts +var import_ag_charts_community277 = require("ag-charts-community"); +var { BaseProperties: BaseProperties30, HierarchySeriesProperties: HierarchySeriesProperties2, HighlightStyle: HighlightStyle2, makeSeriesTooltip: makeSeriesTooltip24, Property: Property84, Label: Label18 } = import_ag_charts_community277._ModuleSupport; +var TreemapGroupLabel = class extends Label18 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property84 +], TreemapGroupLabel.prototype, "spacing", 2); +var TreemapSeriesGroup = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.textAlign = "center"; + this.gap = 0; + this.padding = 0; + this.interactive = true; + this.label = new TreemapGroupLabel(); + } +}; +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "fill", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "fillOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "stroke", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "strokeWidth", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "strokeOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "cornerRadius", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "textAlign", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "gap", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "padding", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "interactive", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "label", 2); +var TreemapSeriesTile = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.gap = 0; + this.padding = 0; + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + } +}; +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "fill", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "fillOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "stroke", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "strokeWidth", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "strokeOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "cornerRadius", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "textAlign", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "verticalAlign", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "gap", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "padding", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "label", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "secondaryLabel", 2); +var TreemapSeriesGroupHighlightStyle = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.label = new AutoSizedLabel(); + } +}; +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "label", 2); +var TreemapSeriesTileHighlightStyle = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + } +}; +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "label", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "secondaryLabel", 2); +var TreemapSeriesHighlightStyle = class extends HighlightStyle2 { + constructor() { + super(false); + this.group = new TreemapSeriesGroupHighlightStyle(); + this.tile = new TreemapSeriesTileHighlightStyle(); + } + getStyle(isLeaf) { + return isLeaf ? this.tile : this.group; + } +}; +__decorateClass([ + Property84 +], TreemapSeriesHighlightStyle.prototype, "group", 2); +__decorateClass([ + Property84 +], TreemapSeriesHighlightStyle.prototype, "tile", 2); +var TreemapSeriesProperties = class extends HierarchySeriesProperties2 { + constructor() { + super(...arguments); + this.highlightStyle = new TreemapSeriesHighlightStyle(); + this.tooltip = makeSeriesTooltip24(); + this.group = new TreemapSeriesGroup(); + this.tile = new TreemapSeriesTile(); + this.undocumentedGroupFills = []; + this.undocumentedGroupStrokes = []; + } + getStyle(isLeaf, fills, strokes, index) { + const { + fillOpacity, + strokeWidth, + strokeOpacity, + fill = isLeaf ? fills[index % fills.length] : fills[Math.min(index, fills.length)], + stroke: stroke2 = isLeaf ? strokes[index % fills.length] : strokes[Math.min(index, strokes.length)] + } = isLeaf ? this.tile : this.group; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + opacity: 1 + }; + } +}; +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "secondaryLabelKey", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "highlightStyle", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "group", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "tile", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "undocumentedGroupFills", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "undocumentedGroupStrokes", 2); + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeries.ts +var { + createDatumId: createDatumId22, + Rect: Rect9, + Group: Group21, + BBox: BBox28, + Selection: Selection18, + Text: Text10, + Transformable: Transformable4, + applyShapeStyle: applyShapeStyle20, + getLabelStyles: getLabelStyles8, + mergeDefaults: mergeDefaults22, + formatValue: formatValue3 +} = import_ag_charts_community278._ModuleSupport; +var TreemapNode = class extends import_ag_charts_community278._ModuleSupport.HierarchyNode { + constructor() { + super(...arguments); + this.labelValue = void 0; + this.secondaryLabelValue = void 0; + this.label = void 0; + this.secondaryLabel = void 0; + this.bbox = void 0; + this.padding = void 0; + } +}; +function nodeSize(node) { + return node.children.length > 0 ? node.sumSize - node.sizeValue : node.sizeValue; +} +var textAlignFactors2 = { + left: 0, + center: 0.5, + right: 1 +}; +var verticalAlignFactors4 = { + top: 0, + middle: 0.5, + bottom: 1 +}; +var DistantGroup = class extends import_ag_charts_community278._ModuleSupport.Group { + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } +}; +var TreemapSeries = class extends import_ag_charts_community278._ModuleSupport.HierarchySeries { + constructor() { + super(...arguments); + this.NodeClass = TreemapNode; + this.properties = new TreemapSeriesProperties(); + this.rectGroup = this.contentGroup.appendChild(new Group21()); + this.datumSelection = Selection18.select(this.rectGroup, Rect9); + this.labelSelection = Selection18.select(this.labelGroup, Group21); + this.highlightSelection = Selection18.select( + this.rectGroup, + Rect9 + ); + } + groupTitleHeight(node, bbox) { + const { labelValue } = node; + const { label: font2 } = this.properties.group; + const heightRatioThreshold = 3; + if (labelValue == null) { + return; + } else if (font2.fontSize > bbox.width / heightRatioThreshold || font2.fontSize > bbox.height / heightRatioThreshold) { + return; + } else { + const { height: fontHeight } = (0, import_ag_charts_core118.cachedTextMeasurer)(font2).measureLines(labelValue); + return Math.max(fontHeight, font2.fontSize); + } + } + getNodePadding(node, bbox) { + if (node.parent == null) { + return { + top: 0, + right: 0, + bottom: 0, + left: 0 + }; + } else if (node.children.length === 0) { + const { padding: padding2 } = this.properties.tile; + return { + top: padding2, + right: padding2, + bottom: padding2, + left: padding2 + }; + } + const { + label: { spacing }, + padding + } = this.properties.group; + const fontHeight = this.groupTitleHeight(node, bbox); + const titleHeight = fontHeight == null ? 0 : fontHeight + spacing; + return { + top: padding + titleHeight, + right: padding, + bottom: padding, + left: padding + }; + } + sortChildren({ children }) { + const sortedChildrenIndices = Array.from(children, (_, i) => i).filter((i) => nodeSize(children[i]) > 0).sort((aIndex, bIndex) => nodeSize(children[bIndex]) - nodeSize(children[aIndex])); + const childAt = (i) => { + const sortedIndex = sortedChildrenIndices[i]; + return children[sortedIndex]; + }; + return { sortedChildrenIndices, childAt }; + } + /** + * Squarified Treemap algorithm + * https://www.win.tue.nl/~vanwijk/stm.pdf + */ + squarify(node, bbox) { + const { datum, children } = node; + if (bbox.width <= 0 || bbox.height <= 0) { + node.bbox = void 0; + node.padding = void 0; + node.midPoint.x = Number.NaN; + node.midPoint.y = Number.NaN; + return; + } + const padding = datum == null ? { top: 0, right: 0, bottom: 0, left: 0 } : this.getNodePadding(node, bbox); + if (node.parent == null) { + node.bbox = void 0; + node.padding = void 0; + node.midPoint.x = Number.NaN; + node.midPoint.y = Number.NaN; + } else { + node.bbox = bbox; + node.padding = padding; + node.midPoint.x = bbox.x + bbox.width / 2; + node.midPoint.y = bbox.y; + } + const { sortedChildrenIndices, childAt } = this.sortChildren(node); + const allLeafNodes = sortedChildrenIndices.every((sortedIndex) => children[sortedIndex].children.length === 0); + const targetTileAspectRatio = 1; + const width = bbox.width - padding.left - padding.right; + const height = bbox.height - padding.top - padding.bottom; + if (width <= 0 || height <= 0) + return; + const numChildren = sortedChildrenIndices.length; + let stackSum = 0; + let startIndex = 0; + let minRatioDiff = Infinity; + let partitionSum = sortedChildrenIndices.reduce((sum, sortedIndex) => sum + nodeSize(children[sortedIndex]), 0); + const innerBox = new BBox28(bbox.x + padding.left, bbox.y + padding.top, width, height); + const partition = innerBox.clone(); + let i = 0; + while (i < numChildren) { + const value = nodeSize(childAt(i)); + const firstValue = nodeSize(childAt(startIndex)); + const isVertical2 = partition.width < partition.height; + stackSum += value; + const partThickness = isVertical2 ? partition.height : partition.width; + const partLength = isVertical2 ? partition.width : partition.height; + const firstTileLength = partLength * firstValue / stackSum; + let stackThickness = partThickness * stackSum / partitionSum; + const ratio3 = Math.max(firstTileLength, stackThickness) / Math.min(firstTileLength, stackThickness); + const diff8 = Math.abs(targetTileAspectRatio - ratio3); + if (diff8 < minRatioDiff) { + minRatioDiff = diff8; + i++; + continue; + } + stackSum -= value; + stackThickness = partThickness * stackSum / partitionSum; + let start2 = isVertical2 ? partition.x : partition.y; + for (let j = startIndex; j < i; j++) { + const child = childAt(j); + const childSize = nodeSize(child); + const x = isVertical2 ? start2 : partition.x; + const y = isVertical2 ? partition.y : start2; + const length = partLength * childSize / stackSum; + const stackWidth = isVertical2 ? length : stackThickness; + const stackHeight = isVertical2 ? stackThickness : length; + const childBbox = new BBox28(x, y, stackWidth, stackHeight); + this.applyGap(innerBox, childBbox, allLeafNodes); + this.squarify(child, childBbox); + partitionSum -= childSize; + start2 += length; + } + if (isVertical2) { + partition.y += stackThickness; + partition.height -= stackThickness; + } else { + partition.x += stackThickness; + partition.width -= stackThickness; + } + startIndex = i; + stackSum = 0; + minRatioDiff = Infinity; + } + const isVertical = partition.width < partition.height; + let start = isVertical ? partition.x : partition.y; + for (let childIdx = startIndex; childIdx < numChildren; childIdx++) { + const child = childAt(childIdx); + const x = isVertical ? start : partition.x; + const y = isVertical ? partition.y : start; + const part = nodeSize(child) / partitionSum; + const childWidth = partition.width * (isVertical ? part : 1); + const childHeight = partition.height * (isVertical ? 1 : part); + const childBox = new BBox28(x, y, childWidth, childHeight); + this.applyGap(innerBox, childBox, allLeafNodes); + this.squarify(child, childBox); + start += isVertical ? childWidth : childHeight; + } + } + applyGap(innerBox, childBox, allLeafNodes) { + const gap = allLeafNodes ? this.properties.tile.gap * 0.5 : this.properties.group.gap * 0.5; + const getBounds = (box) => ({ + left: box.x, + top: box.y, + right: box.x + box.width, + bottom: box.y + box.height + }); + const innerBounds = getBounds(innerBox); + const childBounds = getBounds(childBox); + const sides = ["top", "right", "bottom", "left"]; + for (const side of sides) { + if (!(0, import_ag_charts_core118.isNumberEqual)(innerBounds[side], childBounds[side])) { + childBox.shrink(gap, side); + } + } + } + createNodeData() { + return void 0; + } + getItemStyle(nodeDatum, isLeaf, isHighlight) { + const { properties, colorScale } = this; + const { itemStyler } = properties; + const rootIndex = nodeDatum.datumIndex?.[0] ?? 0; + const fills = isLeaf ? properties.fills : properties.undocumentedGroupFills; + const strokes = isLeaf ? properties.strokes : properties.undocumentedGroupStrokes; + const index = isLeaf ? rootIndex : nodeDatum.depth ?? -1; + const highlightStyle = isHighlight ? properties.highlightStyle.getStyle(isLeaf) : void 0; + const baseStyle = mergeDefaults22(highlightStyle, properties.getStyle(isLeaf, fills, strokes, index)); + if (!isHighlight && isLeaf && nodeDatum.colorValue != null) { + baseStyle.fill = colorScale.convert(nodeDatum.colorValue); + } + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId22(this.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults22(overrides, style); + } + } + return style; + } + makeItemStylerParams(nodeDatum, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + depth: nodeDatum.depth ?? -1, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateSelections() { + let highlightedNode = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedNode != null && !this.properties.group.interactive && highlightedNode.children.length !== 0) { + highlightedNode = void 0; + } + this.highlightSelection.update( + highlightedNode == null ? [] : [highlightedNode], + void 0, + (node) => this.getDatumId(node) + ); + if (!this.nodeDataRefresh) { + return; + } + this.nodeDataRefresh = false; + const { seriesRect } = this.chart ?? {}; + if (!seriesRect) + return; + const descendants = Array.from(this.rootNode); + const updateLabelGroup = (group) => { + group.append([new Text10({ tag: 0 /* Primary */ }), new Text10({ tag: 1 /* Secondary */ })]); + }; + this.datumSelection.update(descendants, void 0, (node) => this.getDatumId(node)); + this.labelSelection.update(descendants, updateLabelGroup, (node) => this.getDatumId(node)); + } + updateNodes() { + const { rootNode, data } = this; + const { + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + highlightStyle, + tile, + group + } = this.properties; + const { seriesRect } = this.chart ?? {}; + if (!seriesRect || !data) + return; + this.rootNode?.walk((node) => { + const { datum, depth, children } = node; + const isLeaf = children.length === 0; + const labelStyle = isLeaf ? tile.label : group.label; + let labelValue; + if (labelStyle.enabled && datum != null && depth != null && labelKey != null) { + const value = datum[labelKey]; + labelValue = this.getLabelText( + value, + datum, + labelKey, + "label", + [], + labelStyle, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (labelValue === "") { + labelValue = void 0; + } + let secondaryLabelValue; + if (tile.secondaryLabel.enabled && isLeaf && datum != null && depth != null && secondaryLabelKey != null) { + const value = datum[secondaryLabelKey]; + secondaryLabelValue = this.getLabelText( + value, + datum, + secondaryLabelKey, + "secondaryLabel", + [], + tile.secondaryLabel, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (secondaryLabelValue === "") { + secondaryLabelValue = void 0; + } + node.labelValue = (0, import_ag_charts_core118.toPlainText)(labelValue); + node.secondaryLabelValue = (0, import_ag_charts_core118.toPlainText)(secondaryLabelValue); + }); + const { width, height } = seriesRect; + this.squarify(rootNode, new BBox28(0, 0, width, height)); + this.rootNode?.walk((node) => { + const { bbox, children, labelValue, secondaryLabelValue } = node; + node.label = void 0; + node.secondaryLabel = void 0; + if (bbox == null) + return; + if (children.length === 0) { + const layout = { + width: bbox.width, + height: bbox.height, + meta: null + }; + const formatting = formatLabels( + labelValue, + this.properties.tile.label, + secondaryLabelValue, + this.properties.tile.secondaryLabel, + { padding: tile.padding }, + () => layout + ); + if (formatting == null) { + return; + } + const { height: labelHeight, label, secondaryLabel } = formatting; + const { textAlign, verticalAlign, padding } = tile; + const textAlignFactor = textAlignFactors2[textAlign] ?? 0.5; + const labelX = bbox.x + padding + (bbox.width - 2 * padding) * textAlignFactor; + const verticalAlignFactor = verticalAlignFactors4[verticalAlign] ?? 0.5; + const labelYStart = bbox.y + padding + labelHeight * 0.5 + (bbox.height - 2 * padding - labelHeight) * verticalAlignFactor; + if (label != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.tile.label; + node.label = { + text: label.text, + fontSize: label.fontSize, + lineHeight: label.lineHeight, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: labelX, + y: labelYStart - (labelHeight - label.height) * 0.5 + }; + } + if (secondaryLabel != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.tile.secondaryLabel; + node.secondaryLabel = { + text: secondaryLabel.text, + fontSize: secondaryLabel.fontSize, + lineHeight: secondaryLabel.fontSize, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: labelX, + y: labelYStart + (labelHeight - secondaryLabel.height) * 0.5 + }; + } + } else if (labelValue == null) { + return; + } else { + const { padding, textAlign } = group; + const groupTitleHeight = this.groupTitleHeight(node, bbox); + if (groupTitleHeight == null) + return; + const innerWidth = bbox.width - 2 * padding; + const text2 = (0, import_ag_charts_core118.wrapText)(labelValue, { + maxWidth: bbox.width - 2 * padding, + font: group.label, + textWrap: "never" + }); + const textAlignFactor = textAlignFactors2[textAlign] ?? 0.5; + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.group.label; + node.label = { + text: text2, + fontSize: group.label.fontSize, + lineHeight: (0, import_ag_charts_core118.calcLineHeight)(group.label.fontSize), + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: bbox.x + padding + innerWidth * textAlignFactor, + y: bbox.y + padding + groupTitleHeight * 0.5 + }; + } + }); + const fillBBox = { + series: new BBox28(0, 0, width, height), + axis: new BBox28(0, 0, width, height) + }; + const updateRectFn = (node, rect, isHighlight) => { + const { bbox } = node; + if (bbox == null) { + rect.visible = false; + return; + } + const { depth = -1 } = node; + const isLeaf = node.children.length === 0; + const style = this.getItemStyle(node, isLeaf, isHighlight); + rect.crisp = true; + applyShapeStyle20(rect, style, fillBBox); + rect.cornerRadius = isLeaf ? tile.cornerRadius : group.cornerRadius; + rect.zIndex = [0, depth, isHighlight ? 1 : 0]; + const onlyLeaves = node.parent?.children.every((n) => n.children.length === 0); + const parentBbox = node.parent == null ? void 0 : node.parent.bbox; + const parentPadding = node.parent == null ? void 0 : node.parent.padding; + if (onlyLeaves === true && parentBbox != null && parentPadding != null) { + rect.clipBBox = bbox; + rect.x = parentBbox.x + parentPadding.left; + rect.y = parentBbox.y + parentPadding.top; + rect.width = parentBbox.width - (parentPadding.left + parentPadding.right); + rect.height = parentBbox.height - (parentPadding.top + parentPadding.bottom); + } else { + rect.clipBBox = void 0; + rect.x = bbox.x; + rect.y = bbox.y; + rect.width = bbox.width; + rect.height = bbox.height; + } + rect.visible = true; + }; + this.datumSelection.each((rect, datum) => updateRectFn(datum, rect, false)); + this.highlightSelection.each((rect, datum) => { + updateRectFn(datum, rect, true); + }); + const updateLabelFn = (node, text2, tag, highlighted) => { + const isLeaf = node.children.length === 0; + const label = tag === 0 /* Primary */ ? node.label : node.secondaryLabel; + if (label == null) { + text2.visible = false; + return; + } + const labelProps = tag === 0 /* Primary */ ? tile.label : tile.secondaryLabel; + let highlightedColor; + if (highlighted) { + const { tile: hTitle, group: hGroup } = highlightStyle; + highlightedColor = hTitle.secondaryLabel.color; + if (!isLeaf) { + highlightedColor = hGroup.label.color; + } else if (tag === 0 /* Primary */) { + highlightedColor = hTitle.label.color; + } + } + const params = { + childrenKey: this.properties.childrenKey, + colorKey: this.properties.colorKey, + colorName: this.properties.colorName ?? this.properties.colorKey, + depth: node.depth ?? Number.NaN, + labelKey: this.properties.labelKey, + secondaryLabelKey: this.properties.secondaryLabelKey, + sizeKey: this.properties.sizeKey, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const style = getLabelStyles8(this, node, params, labelProps, highlighted, activeHighlight); + text2.text = label.text; + text2.fontSize = label.fontSize; + text2.lineHeight = label.lineHeight; + text2.fontStyle = label.fontStyle; + text2.fontFamily = label.fontFamily; + text2.fontWeight = label.fontWeight; + text2.fill = highlightedColor ?? label.color; + text2.fillOpacity = this.getHighlightStyle(highlighted, node.datumIndex)?.opacity ?? 1; + text2.textAlign = label.textAlign; + text2.textBaseline = label.verticalAlign; + text2.x = label.x; + text2.y = label.y; + text2.setBoxing(style); + text2.visible = true; + text2.zIndex = 1; + }; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + for (const text2 of this.labelSelection.selectByClass(Text10)) { + const datum = text2.closestDatum(); + updateLabelFn(datum, text2, text2.tag, datum === highlightedDatum); + } + } + pickNodesExactShape(point) { + const nodes = super.pickNodesExactShape(point); + nodes.sort((a, b) => b.datumIndex.length - a.datumIndex.length); + return nodes; + } + pickNodeClosestDatum(point) { + const exactMatch = this.pickNodesExactShape(point); + if (exactMatch.length !== 0) { + return { datum: exactMatch[0], distance: 0 }; + } + return this.pickNodeNearestDistantObject(point, this.datumSelection.nodes()); + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties, ctx } = this; + const { formatManager } = ctx; + const { labelKey, secondaryLabelKey, childrenKey, sizeKey, sizeName, colorKey, colorName, tooltip } = properties; + const nodeDatum = datumIndex.reduce((n, i) => n?.children[i], this.rootNode); + if (nodeDatum == null) + return; + const { datum, depth, children } = nodeDatum; + if (datum == null || depth == null) + return; + const isLeaf = children.length === 0; + const data = []; + const datumSize = sizeKey == null ? void 0 : datum[sizeKey]; + if (datumSize != null) { + const sizeDomain = [0, this.rootNode?.sumSize ?? 0]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumSize, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain: sizeDomain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue3(datumSize) }); + } + const datumColor = colorKey == null ? void 0 : datum[colorKey]; + if (datumColor != null) { + const { colorDomain } = this; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumColor, + datum, + seriesId, + legendItemName: void 0, + key: colorKey, + source: "tooltip", + property: "color", + boundSeries: this.getFormatterContext("color"), + domain: colorDomain, + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue3(datumColor) }); + } + const format = this.getItemStyle( + { ...nodeDatum, colorValue: datumColor ?? nodeDatum.colorValue }, + isLeaf, + false + ); + const color6 = format.fill; + const markerStyle = { + shape: "square", + fill: color6, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + }; + if (import_ag_charts_community278._ModuleSupport.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + const symbol = isLeaf ? { marker: markerStyle } : void 0; + return this.formatTooltipWithContext( + tooltip, + { + title: labelKey == null ? void 0 : datum[labelKey], + symbol, + data + }, + { + seriesId, + datum, + title: void 0, + depth, + labelKey, + secondaryLabelKey, + childrenKey, + sizeKey, + sizeName, + colorKey, + colorName, + ...format + } + ); + } + computeFocusBounds(node) { + return Transformable4.toCanvas(this.contentGroup, node.getBBox()); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.tile.label.itemStyler != null || this.properties.group.label.itemStyler != null; + } +}; +TreemapSeries.className = "TreemapSeries"; +TreemapSeries.type = "treemap"; + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeriesOptionsDef.ts +var import_ag_charts_community279 = require("ag-charts-community"); +var import_ag_charts_core119 = require("ag-charts-core"); +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs23, treemapSeriesThemeableOptionsDef, without: without9 } = import_ag_charts_community279._ModuleSupport; +var treemapSeriesOptionsDef = { + ...treemapSeriesThemeableOptionsDef, + ...without9(commonSeriesOptionsDefs23, ["highlightStyle", "highlight", "showInLegend"]), + type: (0, import_ag_charts_core119.required)((0, import_ag_charts_core119.constant)("treemap")), + labelKey: import_ag_charts_core119.string, + secondaryLabelKey: import_ag_charts_core119.string, + childrenKey: import_ag_charts_core119.string, + sizeKey: import_ag_charts_core119.string, + colorKey: import_ag_charts_core119.string, + sizeName: import_ag_charts_core119.string, + colorName: import_ag_charts_core119.string +}; +treemapSeriesOptionsDef.undocumentedGroupFills = (0, import_ag_charts_core119.undocumented)((0, import_ag_charts_core119.arrayOf)(import_ag_charts_core119.color)); +treemapSeriesOptionsDef.undocumentedGroupStrokes = (0, import_ag_charts_core119.undocumented)((0, import_ag_charts_core119.arrayOf)(import_ag_charts_core119.color)); + +// packages/ag-charts-enterprise/src/series/treemap/treemapModule.ts +var { FONT_SIZE_RATIO: FONT_SIZE_RATIO4 } = import_ag_charts_community280._ModuleSupport; +var TreemapModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "treemap", + moduleFactory: (ctx) => new TreemapSeries(ctx), + solo: true, + themeTemplate: { + series: { + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", import_ag_charts_community280._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", import_ag_charts_community280._ModuleSupport.FILL_PATTERN_DEFAULTS], + ["image", import_ag_charts_community280._ModuleSupport.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + colorRange: { $palette: "divergingColors" }, + // @ts-expect-error undocumented option + undocumentedGroupFills: { $palette: "hierarchyColors" }, + undocumentedGroupStrokes: { $palette: "secondHierarchyColors" }, + group: { + label: { + ...import_ag_charts_community280._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "textColor" }, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + spacing: 4 + }, + fill: void 0, + // Override default fill + stroke: void 0, + // Override default stroke + strokeWidth: 1, + padding: 4, + gap: 2, + textAlign: "left" + }, + tile: { + label: { + ...import_ag_charts_community280._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "chartBackgroundColor" }, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: 1.5 }, + minimumFontSize: { $rem: FONT_SIZE_RATIO4.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + wrapping: "on-space", + overflowStrategy: "ellipsis", + spacing: 2 + }, + secondaryLabel: { + ...import_ag_charts_community280._ModuleSupport.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "chartBackgroundColor" }, + fontStyle: void 0, + fontWeight: void 0, + fontSize: { $ref: "fontSize" }, + minimumFontSize: { $rem: FONT_SIZE_RATIO4.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + wrapping: "never", + overflowStrategy: "ellipsis" + }, + fill: void 0, + // Override default fill + stroke: void 0, + // Override default stroke + strokeWidth: { $isUserOption: ["../strokes/0", 2, { $isUserOption: ["./stroke", 2, 0] }] }, + padding: 3, + gap: 1 + }, + // Override defaults + highlightStyle: { + group: { + label: { + color: { $ref: "textColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + }, + tile: { + label: { + color: { $ref: "chartBackgroundColor" } + }, + secondaryLabel: { + color: { $ref: "chartBackgroundColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + } + } + }, + gradientLegend: { + enabled: true, + ...import_ag_charts_community280._ModuleSupport.LEGEND_CONTAINER_THEME + } + } +}; +var TreemapSeriesModule = { + type: "series", + name: "treemap", + chartType: "standalone", + enterprise: true, + options: treemapSeriesOptionsDef, + create: (ctx) => new TreemapSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/main-modules.ts +var ModuleRegistry = import_ag_charts_community281._ModuleSupport.ModuleRegistry; +var AllCartesianEnterpriseModules = [ + OrdinalTimeAxisModule2, + BoxPlotSeriesModule, + CandlestickSeriesModule, + ConeFunnelSeriesModule, + FunnelSeriesModule, + HeatmapSeriesModule, + OhlcSeriesModule, + RangeAreaSeriesModule, + RangeBarSeriesModule, + WaterfallSeriesModule +]; +var AllPolarEnterpriseModules = [ + AngleNumberAxisModule2, + AngleCategoryAxisModule2, + RadiusNumberAxisModule2, + RadiusCategoryAxisModule2, + NightingaleSeriesModule, + RadarAreaSeriesModule, + RadarLineSeriesModule, + RadialBarSeriesModule, + RadialColumnSeriesModule +]; +var AllStandaloneEnterpriseModules = [ + StandaloneChartModule, + PyramidSeriesModule, + LinearGaugeSeriesModule, + RadialGaugeSeriesModule, + SunburstSeriesModule, + TreemapSeriesModule, + ChordSeriesModule, + SankeySeriesModule +]; +var AllTopologyEnterpriseModules = [ + TopologyChartModule, + MapLineSeriesModule, + MapLineBackgroundSeriesModule, + MapMarkerSeriesModule, + MapShapeSeriesModule, + MapShapeBackgroundSeriesModule +]; +var AllEnterpriseModules = [ + ...AllCartesianEnterpriseModules, + ...AllPolarEnterpriseModules, + ...AllStandaloneEnterpriseModules, + ...AllTopologyEnterpriseModules, + // Plugins, WIP + AnnotationsModule2, + NavigatorModule2, + InitialStateModule +]; + +// packages/ag-charts-enterprise/src/styles.css +var styles_default = `.ag-watermark{position:absolute;bottom:20px;right:25px;font-weight:700;font-family:Impact,sans-serif;font-size:19px;opacity:.7;animation:1s ease-out 3s ag-watermark-fadeout;color:#9b9b9b;pointer-events:none;&:before{content:"";display:block;height:40px;width:170px;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU4IiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgMjU4IDQwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjUuNzc5IDI4LjY1N0gxMy4zNTlMMTEuMTczIDM0LjAxMkg1LjY3Mjk3TDE3LjE4MiA3LjA1OTk5SDIxLjk1M0wzMy40NjIgMzQuMDEySDI3Ljk2MkwyNS43NzYgMjguNjU3SDI1Ljc3OVpNMjQuMDY4IDI0LjM5N0wxOS41ODggMTMuNDM0TDE1LjEwNyAyNC4zOTdIMjQuMDY4Wk02Mi4wOTIgMTguODIzSDQ5LjgxN1YyMy4wODZINTYuNzc1QzU2LjU1NSAyNS4yMjIgNTUuNzU1IDI2LjkyNyA1NC4zNzIgMjguMjAyQzUyLjk4OSAyOS40NzYgNTEuMTY2IDMwLjExNSA0OC45MDkgMzAuMTE1QzQ3LjYyMiAzMC4xMTUgNDYuNDUgMjkuODg1IDQ1LjM5MyAyOS40MjNDNDQuMzU4MyAyOC45NzgxIDQzLjQzMjYgMjguMzEzOCA0Mi42OCAyNy40NzZDNDEuOTI3IDI2LjYzOSA0MS4zNDQgMjUuNjMxIDQwLjkzMSAyNC40NTNDNDAuNTE5IDIzLjI3NSA0MC4zMTEgMjEuOTcgNDAuMzExIDIwLjUzN0M0MC4zMTEgMTkuMTA1IDQwLjUxNiAxNy44IDQwLjkzMSAxNi42MjFDNDEuMzQ0IDE1LjQ0MyA0MS45MjcgMTQuNDM2IDQyLjY4IDEzLjU5OEM0My40Mzc2IDEyLjc1NzcgNDQuMzY5NiAxMi4wOTMyIDQ1LjQxMSAxMS42NTFDNDYuNDc4IDExLjE4OSA0Ny42NTYgMTAuOTYgNDguOTQ2IDEwLjk2QzUxLjYxMiAxMC45NiA1My42MzcgMTEuNjAyIDU1LjAyIDEyLjg4NUw1OC4zIDkuNjA0OTlDNTUuODE3IDcuNjY5OTkgNTIuNjc2IDYuNjk5OTkgNDguODcyIDYuNjk5OTlDNDYuNzYgNi42OTk5OSA0NC44NTMgNy4wMzQ5OSA0My4xNTQgNy43MDA5OUM0MS40NTUgOC4zNjc5OSAzOS45OTggOS4zMDM5OSAzOC43ODMgMTAuNTA0QzM3LjU2NyAxMS43MDcgMzYuNjM0IDEzLjE1OCAzNS45NzcgMTQuODU3QzM1LjMxOSAxNi41NTYgMzQuOTk0IDE4LjQ1MSAzNC45OTQgMjAuNTRDMzQuOTk0IDIyLjYzIDM1LjMyOSAyNC40OTQgMzUuOTk1IDI2LjIwNUMzNi42NjIgMjcuOTE2IDM3LjYwNSAyOS4zNzQgMzguODE3IDMwLjU3N0M0MC4wMzIgMzEuNzggNDEuNDg2IDMyLjcxMyA0My4xODggMzMuMzgzQzQ0Ljg4OCAzNC4wNDkgNDYuNzgyIDM0LjM4NCA0OC44NzIgMzQuMzg0QzUwLjk2MSAzNC4zODQgNTIuNzUgMzQuMDQ5IDU0LjM5IDMzLjM4M0M1Ni4wMzEgMzIuNzE2IDU3LjQyNiAzMS43OCA1OC41NzkgMzAuNTc3QzU5LjczMyAyOS4zNzQgNjAuNjE5IDI3LjkxNiA2MS4yMzkgMjYuMjA1QzYxLjg2IDI0LjQ5NCA2Mi4xNyAyMi42MDUgNjIuMTcgMjAuNTRDNjIuMTY5NiAxOS45Njg4IDYyLjE0NDUgMTkuMzk4IDYyLjA5NSAxOC44MjlMNjIuMDkyIDE4LjgyM1pNMTUxLjgxIDE2Ljk4MUMxNTMuNDEgMTQuNjA5IDE1Ny40MTkgMTQuMzU4IDE1OS4wMjIgMTQuMzU4VjE4LjkxQzE1Ni45NTcgMTguOTEgMTU0Ljk4NSAxOC45OTYgMTUzLjc1NyAxOS44OTJDMTUyLjUyOSAyMC43OTIgMTUxLjkxOSAyMS45ODIgMTUxLjkxOSAyMy40NjRWMzMuOTlIMTQ2Ljk2NFYxNC4zNThIMTUxLjczNkwxNTEuODEgMTYuOTgxWk0xNDMuMDExIDE0LjM2MVYzNC4wMzFIMTM4LjI0TDEzOC4xMzEgMzEuMDQ1QzEzNy40NjYgMzIuMDc2IDEzNi41NTEgMzIuOTIxOSAxMzUuNDcxIDMzLjUwNEMxMzQuMzc2IDM0LjA5OSAxMzMuMDY4IDM0LjM5NiAxMzEuNTM2IDM0LjM5NkMxMzAuMiAzNC4zOTYgMTI4Ljk2MyAzNC4xNTIgMTI3LjgyMiAzMy42NjhDMTI2LjcgMzMuMTk2NCAxMjUuNjg5IDMyLjQ5NSAxMjQuODU1IDMxLjYwOUMxMjQuMDE4IDMwLjcyMiAxMjMuMzU0IDI5LjY2MiAxMjIuODcxIDI4LjQyMkMxMjIuMzg0IDI3LjE4NSAxMjIuMTQyIDI1LjgxMSAxMjIuMTQyIDI0LjMwNEMxMjIuMTQyIDIyLjc5OCAxMjIuMzg0IDIxLjM3OCAxMjIuODcxIDIwLjExNkMxMjMuMzU3IDE4Ljg1NCAxMjQuMDE4IDE3Ljc3MiAxMjQuODU1IDE2Ljg3M0MxMjUuNjg4IDE1Ljk3NjQgMTI2LjY5OCAxNS4yNjM2IDEyNy44MjIgMTQuNzhDMTI4Ljk2MyAxNC4yODEgMTMwLjIwMyAxNC4wMzMgMTMxLjUzNiAxNC4wMzNDMTMzLjA0MyAxNC4wMzMgMTM0LjMzIDE0LjMxOCAxMzUuMzk3IDE0Ljg4OEMxMzYuNDYyIDE1LjQ1ODkgMTM3LjM3NSAxNi4yNzggMTM4LjA1NyAxNy4yNzZWMTQuMzYxSDE0My4wMTFaTTEzMi42MzEgMzAuMTMzQzEzNC4yNTYgMzAuMTMzIDEzNS41NjcgMjkuNTk0IDEzNi41NjUgMjguNTEyQzEzNy41NjEgMjcuNDMgMTM4LjA2IDI1Ljk5MSAxMzguMDYgMjQuMTk2QzEzOC4wNiAyMi40MDEgMTM3LjU2MSAyMC45OSAxMzYuNTY1IDE5Ljg5OUMxMzUuNTcgMTguODA3IDEzNC4yNTkgMTguMjU4IDEzMi42MzEgMTguMjU4QzEzMS4wMDMgMTguMjU4IDEyOS43MjkgMTguODA0IDEyOC43MzQgMTkuODk5QzEyNy43MzggMjAuOTkzIDEyNy4yMzkgMjIuNDM4IDEyNy4yMzkgMjQuMjMzQzEyNy4yMzkgMjYuMDI4IDEyNy43MzUgMjcuNDMzIDEyOC43MzQgMjguNTE1QzEyOS43MjkgMjkuNTk0IDEzMS4wMjggMzAuMTM2IDEzMi42MzEgMzAuMTM2VjMwLjEzM1pNOTMuNjk4IDI3Ljg3NkM5My41Nzk1IDI4LjAwMjUgOTMuNDU2NCAyOC4xMjQ2IDkzLjMyOSAyOC4yNDJDOTEuOTQ3IDI5LjUxNiA5MC4xMjMgMzAuMTU1IDg3Ljg2NiAzMC4xNTVDODYuNTggMzAuMTU1IDg1LjQwOCAyOS45MjYgODQuMzUgMjkuNDY0QzgzLjMxNTUgMjkuMDE4OSA4Mi4zODk4IDI4LjM1NDYgODEuNjM3IDI3LjUxN0M4MC44ODQgMjYuNjc5IDgwLjMwMSAyNS42NzIgNzkuODg5IDI0LjQ5NEM3OS40NzYgMjMuMzE1IDc5LjI2OSAyMi4wMSA3OS4yNjkgMjAuNTc4Qzc5LjI2OSAxOS4xNDUgNzkuNDczIDE3Ljg0IDc5Ljg4OSAxNi42NjJDODAuMzAxIDE1LjQ4NCA4MC44ODQgMTQuNDc2IDgxLjYzNyAxMy42MzlDODIuMzk0OSAxMi43OTg3IDgzLjMyNzMgMTIuMTM0MiA4NC4zNjkgMTEuNjkyQzg1LjQzNiAxMS4yMyA4Ni42MTQgMTEgODcuOTAzIDExQzkwLjU3IDExIDkyLjU5NSAxMS42NDIgOTMuOTc3IDEyLjkyNkw5Ny4yNTggOS42NDQ5OUM5NC43NzQgNy43MTA5OSA5MS42MzMgNi43Mzk5OSA4Ny44MjkgNi43Mzk5OUM4NS43MTggNi43Mzk5OSA4My44MTEgNy4wNzQ5OSA4Mi4xMTIgNy43NDE5OUM4MC40MTMgOC40MDc5OSA3OC45NTYgOS4zNDQ5OSA3Ny43NCAxMC41NDVDNzYuNTI1IDExLjc0NyA3NS41OTIgMTMuMTk5IDc0LjkzNCAxNC44OThDNzQuMjc3IDE2LjU5NyA3My45NTEgMTguNDkxIDczLjk1MSAyMC41ODFDNzMuOTUxIDIyLjY3IDc0LjI4NiAyNC41MzQgNzQuOTUzIDI2LjI0NUM3NS42MTkgMjcuOTU3IDc2LjU2MiAyOS40MTQgNzcuNzc0IDMwLjYxN0M3OC45OSAzMS44MiA4MC40NDQgMzIuNzUzIDgyLjE0NiAzMy40MjNDODMuODQ1IDM0LjA5IDg1LjczOSAzNC40MjQgODcuODI5IDM0LjQyNEM4OS45MTkgMzQuNDI0IDkxLjcwOCAzNC4wOSA5My4zNDggMzMuNDIzQzk0LjcxOCAzMi44NjUgOTUuOTE4IDMyLjEyMSA5Ni45NDggMzEuMTkxQzk3LjE0OSAzMS4wMDggOTcuMzQ4IDMwLjgxNSA5Ny41MzcgMzAuNjJMOTMuNzAxIDI3Ljg4NUw5My42OTggMjcuODc2Wk0xMTAuODAyIDE0LjAxNUMxMDkuMTk5IDE0LjAxNSAxMDYuODM2IDE0LjQ3MSAxMDUuNjExIDE2LjE1OEwxMDUuNTM3IDYuMDE1OTlIMTAwLjc2NVYzMy45MzlIMTA1LjcyVjIyLjY0MUMxMDUuNzcxIDIxLjQ2MDcgMTA2LjI4OCAyMC4zNDg4IDEwNy4xNTcgMTkuNTQ4OUMxMDguMDI3IDE4Ljc0OTEgMTA5LjE3OCAxOC4zMjY2IDExMC4zNTggMTguMzc0QzExMy4zOTcgMTguMzc0IDExNC4yNjggMjEuMTU5IDExNC4yNjggMjIuNjQxVjMzLjkzOUgxMTkuMjIzVjIxLjA1OUMxMTkuMjIzIDIxLjA1OSAxMTkuMTQyIDE0LjAxNSAxMTAuODAyIDE0LjAxNVpNMTczLjc2MyAxNC4zNThIMTY5Ljk5OVY4LjcxNDk5SDE2NS4wNDhWMTQuMzU4SDE2MS4yODRWMTguOTE2SDE2NS4wNDhWMzQuMDAzSDE2OS45OTlWMTguOTE2SDE3My43NjNWMTQuMzU4Wk0xOTAuNzg3IDI1LjI2MkMxOTAuMTI5IDI0LjUwMTQgMTg5LjMwNyAyMy44OTk0IDE4OC4zODQgMjMuNTAxQzE4Ny40ODggMjMuMTE3IDE4Ni4zMzEgMjIuNzMyIDE4NC45NDggMjIuMzY0QzE4NC4xNjUgMjIuMTQzOSAxODMuMzkgMjEuODk3OCAxODIuNjIzIDIxLjYyNkMxODIuMTYzIDIxLjQ2MjEgMTgxLjc0MSAyMS4yMDY2IDE4MS4zODMgMjAuODc1QzE4MS4yMzUgMjAuNzQyMSAxODEuMTE4IDIwLjU3ODkgMTgxLjAzOSAyMC4zOTY0QzE4MC45NjEgMjAuMjE0IDE4MC45MjIgMjAuMDE2NiAxODAuOTI3IDE5LjgxOEMxODAuOTI3IDE5LjI3MiAxODEuMTU2IDE4Ljg0NCAxODEuNjI1IDE4LjUxQzE4Mi4xMjEgMTguMTU2IDE4Mi44NjIgMTcuOTc2IDE4My44MjYgMTcuOTc2QzE4NC43OSAxNy45NzYgMTg1LjU4NyAxOC4yMDkgMTg2LjE0OCAxOC42NjhDMTg2LjcwNiAxOS4xMjQgMTg3LjAwNyAxOS43MjUgMTg3LjA3MiAyMC41TDE4Ny4wOTQgMjAuNzgySDE5MS42MzNMMTkxLjYxNyAyMC40NkMxOTEuNTIxIDE4LjQ4NSAxOTAuNzcxIDE2LjkgMTg5LjM4NSAxNS43NUMxODguMDEyIDE0LjYxMiAxODYuMTg1IDE0LjAzMyAxODMuOTYyIDE0LjAzM0MxODIuNDc3IDE0LjAzMyAxODEuMTQxIDE0LjI4NyAxNzkuOTk0IDE0Ljc4NkMxNzguODMxIDE1LjI5MSAxNzcuOTI2IDE1Ljk5NSAxNzcuMjk2IDE2Ljg4MkMxNzYuNjczIDE3Ljc0NTUgMTc2LjMzOCAxOC43ODQgMTc2LjM0MSAxOS44NDlDMTc2LjM0MSAyMS4xNjcgMTc2LjY5OCAyMi4yNDkgMTc3LjM5OSAyMy4wNjRDMTc4LjA2IDIzLjg0MzIgMTc4Ljg5OCAyNC40NTM0IDE3OS44NDIgMjQuODQ0QzE4MC43NDQgMjUuMjE2IDE4MS45MjggMjUuNjA3IDE4My4zNjEgMjZDMTg0LjgwNiAyNi40MSAxODUuODcyIDI2Ljc4NSAxODYuNTMgMjcuMTIzQzE4Ny4xIDI3LjQxNCAxODcuMzc5IDI3Ljg0NSAxODcuMzc5IDI4LjQ0NEMxODcuMzc5IDI5LjA0MiAxODcuMTIyIDI5LjQ2NyAxODYuNTk1IDI5LjgzOUMxODYuMDQzIDMwLjIyNiAxODUuMjM3IDMwLjQyNSAxODQuMjAxIDMwLjQyNUMxODMuMTY2IDMwLjQyNSAxODIuMzk0IDMwLjE3NCAxODEuNzQ5IDI5LjY3NEMxODEuMTEzIDI5LjE4MSAxODAuNzcyIDI4LjU4OSAxODAuNzEgMjcuODY0TDE4MC42ODUgMjcuNTgySDE3Ni4wMTNMMTc2LjAyNSAyNy45MDFDMTc2LjA2NyAyOS4wOTU1IDE3Ni40NzIgMzAuMjQ4NyAxNzcuMTg4IDMxLjIwNkMxNzcuOTA3IDMyLjE4IDE3OC44OTMgMzIuOTU4IDE4MC4xMTggMzMuNTE5QzE4MS4zMzYgMzQuMDc3IDE4Mi43MzIgMzQuMzYyIDE4NC4yNjYgMzQuMzYyQzE4NS44MDEgMzQuMzYyIDE4Ny4xMDkgMzQuMTA4IDE4OC4yMzggMzMuNjA5QzE4OS4zNzYgMzMuMTA0IDE5MC4yNzIgMzIuMzk0IDE5MC45MDEgMzEuNDk0QzE5MS41MzQgMzAuNTkyIDE5MS44NTMgMjkuNTU0IDE5MS44NTMgMjguNDAzQzE5MS44MjggMjcuMTEgMTkxLjQ2NiAyNi4wNTMgMTkwLjc3NyAyNS4yNjJIMTkwLjc4N1oiIGZpbGw9IiM5QjlCOUIiLz4KPHBhdGggZD0iTTI0MS45ODIgMjUuNjU4MlYxNy43MTE3SDIyOC40NDFMMjIwLjQ5NCAyNS42NTgySDI0MS45ODJaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNTcuMjM5IDUuOTUwODFIMjQwLjI2NUwyMzIuMjU1IDEzLjg5NzNIMjU3LjIzOVY1Ljk1MDgxWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjEyLjYxMSAzMy42MDQ4TDIxNi42OCAyOS41MzYxSDIzMC40MTJWMzcuNDgyN0gyMTIuNjExVjMzLjYwNDhaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yMTUuNTk5IDIxLjc4MDNIMjI0LjM3MkwyMzIuMzgyIDEzLjgzMzdIMjE1LjU5OVYyMS43ODAzWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjA2IDMzLjYwNDdIMjEyLjYxMUwyMjAuNDk0IDI1LjY1ODJIMjA2VjMzLjYwNDdaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNDAuMjY1IDUuOTUwODFMMjM2LjE5NyAxMC4wMTk0SDIxMC4yNTlWMi4wNzI4OEgyNDAuMjY1VjUuOTUwODFaIiBmaWxsPSIjOUI5QjlCIi8+Cjwvc3ZnPgo=);background-repeat:no-repeat;background-size:170px 40px}>span{padding-left:.7rem}}@keyframes ag-watermark-fadeout{0%{opacity:.5}to{opacity:0}}.ag-charts-dialog{display:flex;flex-direction:column;font-size:var(--ag-charts-chrome-font-size-large)}.ag-charts-dialog__tabs{display:flex;flex-direction:column}.ag-charts-dialog__header{border-bottom:1px solid var(--ag-charts-border-color);display:flex}.ag-charts-dialog__tab-list{display:flex;gap:calc(var(--ag-charts-spacing) * 2)}.ag-charts-dialog__drag-handle{align-items:center;color:inherit;cursor:grab;display:flex;padding:1px 6px;text-align:center}.ag-charts-dialog__drag-handle--dragging{cursor:grabbing}.ag-charts-dialog__tab-button{background:none;border:0;border-bottom:2px solid transparent;border-radius:0;color:var(--ag-charts-panel-subtle-text-color);margin-bottom:-1px;padding:var(--input-padding) calc(var(--input-padding) / 2)}.ag-charts-dialog__tab-button:hover{background:none}.ag-charts-dialog__tab-button--active{border-color:var(--ag-charts-accent-color);color:inherit}.ag-charts-dialog__drag-handle+.ag-charts-dialog__tab-button{margin-left:calc(var(--ag-charts-spacing) * -2)}.ag-charts-button.ag-charts-dialog__close-button{background:none;border:0;margin-left:auto;padding:1px 6px}.ag-charts-dialog__close-button:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-dialog__tab-panel{display:none;flex-direction:column;gap:calc(var(--ag-charts-spacing) * 4);margin:0 calc(var(--ag-charts-spacing) * 4);padding:calc(var(--ag-charts-spacing) * 4) 0}.ag-charts-dialog__tab-panel--active{display:flex}.ag-charts-dialog__input-group-line{display:flex;gap:16px 18px;flex-wrap:wrap}.ag-charts-dialog__input-group{align-items:center;display:flex;font-size:var(--ag-charts-chrome-font-size)}.ag-charts-dialog__input-group-label{color:var(--ag-charts-panel-subtle-text-color);margin-right:5px}.ag-charts-dialog__input-group-label[for]{cursor:pointer}.ag-charts-dialog__button{border-radius:0;margin-right:-1px}.ag-charts-dialog__button.ag-charts-dialog__button--active{background:var(--ag-charts-button-focus-background-color);border-color:var(--ag-charts-input-focus-border-color);color:var(--ag-charts-input-focus-text-color);z-index:var(--input-layer-active)}.ag-charts-dialog__button:first-child,.ag-charts-dialog__input-group-label+.ag-charts-dialog__button{border-bottom-left-radius:var(--ag-charts-input-border-radius);border-top-left-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__button:last-child{border-bottom-right-radius:var(--ag-charts-input-border-radius);border-top-right-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__color-picker-button{--color: #000;background:var(--color);border:none;color:transparent;height:26px;width:26px}.ag-charts-dialog__color-picker-button:hover{background:var(--color)}.ag-charts-dialog__color-picker-button--multi-color,.ag-charts-dialog__color-picker-button--multi-color:hover{background:linear-gradient(135deg,red 0%,#ff0 calc(100% * 1 / 6),#0f0 calc(100% * 2 / 6),#0ff 50%,#00f calc(100% * 4 / 6),#f0f calc(100% * 5 / 6),red 100%)}.ag-charts-color-picker{width:190px;padding:8px;cursor:default;--h: 0;--s: 0;--v: 0;--a: 0;--color: #000;--color-a: #000;--thumb-size: 18px;--inner-width: 172px;--track-height: 12px;--palette-height: 136px;--checker: url('data:image/svg+xml;utf8,');--multi-color: linear-gradient( 135deg, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-color-picker__content{display:flex;flex-direction:column}.ag-charts-color-picker__palette{position:relative;width:100%;height:var(--palette-height);margin-bottom:8px;background:linear-gradient(to bottom,#0000,#000),linear-gradient(to right,#fff,#fff0) hsl(var(--h),100%,50%);border-radius:calc(var(--ag-charts-border-radius) * 1.5);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__palette:after{content:"";position:absolute;display:block;top:calc(var(--thumb-size) * -.5 + (1 - var(--v)) * 100%);left:calc(var(--thumb-size) * -.5 + var(--s) * 100%);background:var(--color);width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__palette:focus-visible:after{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),0 0 0 2px #fff8,var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-row{display:flex;gap:8px;align-items:center;margin-bottom:4px;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input,.ag-charts-color-picker__alpha-input{-webkit-appearance:none;display:block;position:relative;padding:0;margin:0 calc(var(--inset) * -1);border:0;height:var(--thumb-size);width:auto;background:transparent;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input::-moz-range-thumb,.ag-charts-color-picker__alpha-input::-moz-range-thumb{appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__hue-input::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{-webkit-appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038;transform:translateZ(0)}.ag-charts-color-picker__hue-input::-moz-range-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__hue-input::-webkit-slider-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__alpha-input::-moz-range-thumb{background:transparent}.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{background:transparent}.ag-charts-color-picker__alpha-input--opaque::-moz-range-thumb{background:var(--color)}.ag-charts-color-picker__alpha-input--opaque::-webkit-slider-thumb{background:var(--color)}.ag-charts-color-picker__hue-input:focus-visible::-moz-range-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-moz-range-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input:focus-visible::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-webkit-slider-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input::-moz-range-track,.ag-charts-color-picker__alpha-input::-moz-range-track{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__hue-input:before,.ag-charts-color-picker__alpha-input:before{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button{width:36px;margin-left:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);border:0;background:var(--multi-color);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button--hidden{display:none}.ag-charts-color-picker__multi-color-button--active{box-shadow:inset 0 0 0 1px #0003;outline-offset:1px;outline:2px solid #2196f3}.ag-charts-color-picker__hue-input{flex:1 0 0}.ag-charts-color-picker__hue-input::-moz-range-track{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__hue-input:before{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__alpha-input{margin-bottom:7px}.ag-charts-color-picker__alpha-input::-moz-range-track{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__alpha-input:before{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__color-field{display:flex;border:var(--ag-charts-border);background:var(--ag-charts-background-color);border-radius:var(--ag-charts-border-radius);overflow:hidden}.ag-charts-color-picker__color-field:has(:focus-visible){border-color:var(--ag-charts-accent-color);box-shadow:var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-label{width:16px;height:16px;margin:7px 0 7px 7px;color:transparent;background:linear-gradient(to right,var(--color-a),var(--color-a)),var(--checker) top left / 4px 4px;border-radius:calc(var(--ag-charts-border-radius) / 2);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__color-label--multi-color{background:var(--multi-color)}.ag-charts-color-picker__color-input{flex:1;min-width:0;padding:7px 7px 7px 8px;border:0;margin:0;color:inherit;background:transparent;font-variant:tabular-nums}.ag-charts-color-picker__color-input:focus-visible{border:none;outline:none}.ag-charts-annotations__line-stroke-width-menu,.ag-charts-annotations__line-style-type-menu,.ag-charts-annotations__text-size-menu{border-top-left-radius:0;border-top-right-radius:0;.ag-charts-menu__row:first-child{border-radius:0}}.ag-charts-annotations__text-size-menu{--item-padding: 4px 8px;min-width:34px;text-align:center}.ag-charts-annotations__line-stroke-width-menu{--item-padding: 6px;column-gap:6px}.ag-charts-annotations__line-style-type-menu{--item-padding: 6px;column-gap:0}.ag-charts-annotations__stroke-width-button:before{background:var(--ag-charts-foreground-color);content:"";margin-right:var(--toolbar-button-padding);height:min(var(--stroke-width),20px);width:12px}.ag-charts-annotations__stroke-width-button[aria-disabled=true]:before{filter:grayscale(1);opacity:.5}.ag-charts-annotations__color-picker-button{--emblem: var(--color)}.ag-charts-annotations__color-picker-button--multi-color{--emblem: linear-gradient( to right, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-annotations__color-picker-button:after{content:"";display:block;position:absolute;bottom:3px;left:5px;right:5px;height:4px;border-radius:99px;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ag-charts-foreground-color) 10%,transparent);background:var(--emblem)}.ag-charts-annotations__color-picker-button[aria-disabled=true]:after{filter:grayscale(1);opacity:.5}.ag-charts-annotations__toolbar-menu{min-width:200px}.ag-charts-annotations__axis-button--hidden{display:none}.ag-charts-annotations__axis-button{background-color:var(--ag-charts-crosshair-label-background-color);border-radius:calc(var(--ag-charts-border-radius) / 2);border:none;box-sizing:border-box;color:var(--ag-charts-crosshair-label-text-color);cursor:pointer;font-family:var(--ag-charts-button-font-family);font-size:var(--ag-charts-button-font-size);font-weight:var(--ag-charts-button-font-weight);left:0;line-height:16px;overflow:hidden;padding:0;position:absolute;top:0;user-select:none;white-space:nowrap;z-index:var(--ag-charts-layer-annotations)}.ag-charts-annotations__axis-button:hover{opacity:.8;color:var(--ag-charts-background-color)}.ag-charts-dialog--annotation-settings{min-height:233px;width:289px}.ag-charts-dialog--annotation-settings .ag-charts-textarea{height:calc(10px * 2 + var(--textarea-line-height) * 1em * 3 + 2px);overflow-y:auto;resize:vertical}.ag-charts-context-menu{font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);z-index:var(--ag-charts-layer-ui-overlay)}.ag-charts-context-menu__cover{position:fixed;left:0;top:0}.ag-charts-context-menu__menu{background:var(--ag-charts-menu-background-color);border-radius:var(--ag-charts-border-radius);border:var(--ag-charts-menu-border);box-shadow:var(--ag-charts-popup-shadow);color:var(--ag-charts-menu-text-color);display:flex;flex-direction:column;padding:.5em 0;transition:transform .1s ease;white-space:nowrap}.ag-charts-context-menu__menu:focus{outline:none}.ag-charts-context-menu__item{align-items:center;background:none;border:none;box-sizing:border-box;color:inherit;cursor:pointer;display:flex;font:inherit;justify-content:space-between;text-align:left;width:100%;-webkit-appearance:none;-moz-appearance:none}.ag-charts-context-menu__icon>img{width:var(--ag-charts-icon-size);height:var(--ag-charts-icon-size)}.ag-charts-context-menu__icon,.ag-charts-context-menu__cell{display:flex;align-items:center;flex-shrink:0}.ag-charts-context-menu__cell{flex-grow:1}.ag-charts-context-menu__cellpadding{padding:.5em 1em}.ag-charts-context-menu__icon{padding-right:0}.ag-charts-context-menu__item[data-focus-override=true],.ag-charts-context-menu__item:focus,.ag-charts-context-menu__item:active{background:var(--ag-charts-focus-color)}.ag-charts-context-menu__item[data-focus-override=false]{background:inherit}.ag-charts-context-menu__item[data-focus-visible-override=true]:focus,.ag-charts-context-menu__item:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-context-menu__item[data-focus-visible-override=false]{outline:inherit;box-shadow:inherit;z-index:inherit}.ag-charts-context-menu__item[aria-disabled=true]{border:none;color:color-mix(in srgb,var(--ag-charts-input-text-color) 50%,transparent)}.ag-charts-context-menu__item[aria-disabled=true]:focus{background:inherit;cursor:inherit}.ag-charts-context-menu__divider{padding:5px 0}.ag-charts-context-menu__divider:after{content:"";display:block;border-top:1px solid var(--ag-charts-border-color)}.ag-charts-crosshair-label{position:absolute;left:0;top:0;user-select:none;pointer-events:none;font-family:var(--ag-charts-font-family);font-size:var(--ag-charts-font-size);font-weight:var(--ag-charts-font-weight);overflow:hidden;white-space:nowrap;z-index:var(--ag-charts-layer-crosshair);box-sizing:border-box}.ag-charts-crosshair-label-content{padding:0 8px;border-radius:calc(var(--ag-charts-border-radius) / 2);line-height:calc(var(--ag-charts-font-size) + 8px);background-color:var(--ag-charts-crosshair-label-background-color);color:var(--ag-charts-crosshair-label-text-color)}.ag-charts-crosshair-label--hidden{visibility:hidden!important}.ag-charts-text-input{position:absolute}.ag-charts-text-input__textarea{--placeholder-text-color: var(--ag-charts-input-placeholder-text-color);display:block;height:100%;width:100%;border:0;background:none;line-height:1.38;outline:none;transform:translateY(.09em)}.ag-charts-text-input__textarea[placeholder]:empty:before{content:attr(placeholder);color:var(--placeholder-text-color);font-weight:400}.ag-charts-text-input__textarea[placeholder]:not(:empty):before{content:""}.ag-charts-chart-toolbar__menu{min-width:200px}.ag-charts-range-buttons .ag-charts-toolbar__button{padding:var(--toolbar-button-padding) calc(var(--toolbar-button-padding) * 1.5)}.ag-charts-zoom-buttons{align-items:center;display:flex;height:44px;justify-content:center;overflow:hidden;padding-bottom:10px;pointer-events:none;width:100%;.ag-charts-toolbar{--toolbar-size: 24px;--toolbar-button-padding: 1px;display:flex;font-size:var(--ag-charts-chrome-font-size);height:var(--toolbar-size);justify-content:center;opacity:1;pointer-events:auto;transition:opacity .2s ease-in-out,transform .4s ease-in-out;.ag-charts-toolbar__button--first{border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__button--last{border-bottom-right-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__label{padding-left:var(--ag-charts-spacing);padding-right:var(--ag-charts-spacing)}.ag-charts-toolbar__icon+.ag-charts-toolbar__label{padding-left:0}.ag-charts-toolbar__button--gap{margin-left:var(--toolbar-gap)}&.ag-charts-zoom-buttons__toolbar--hidden{opacity:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out}}}.ag-charts-shared-toolbar{gap:var(--toolbar-gap);.ag-charts-toolbar__button{border-radius:var(--ag-charts-border-radius);margin:0}} +`; + +// packages/ag-charts-enterprise/src/setup.ts +import_ag_charts_community282._ModuleSupport.ModuleRegistry.registerMany(AllEnterpriseModules, import_ag_charts_community282.VERSION); +function setupEnterpriseModules() { + import_ag_charts_community282._ModuleSupport.moduleRegistry.register( + AngleCategoryAxisModule, + AngleNumberAxisModule, + AnimationModule, + AnnotationsModule, + BackgroundModule, + ForegroundModule, + BoxPlotModule, + CandlestickModule, + ChordModule, + ConeFunnelModule, + FunnelModule, + OhlcModule, + ChartToolbarModule, + ContextMenuModule, + CrosshairModule, + BandHighlightModule, + DataSourceModule, + ErrorBarsModule, + LinearGaugeModule, + MapLineModule, + MapLineBackgroundModule, + MapMarkerModule, + MapShapeModule, + MapShapeBackgroundModule, + NavigatorModule, + StatusBarModule, + GradientLegendModule, + HeatmapModule, + NightingaleModule, + OrdinalTimeAxisModule, + RadarAreaModule, + RadarLineModule, + RadialBarModule, + RadialColumnModule, + RadiusCategoryAxisModule, + RadialGaugeModule, + RadiusNumberAxisModule, + RangeBarModule, + RangeAreaModule, + RangesModule, + PyramidModule, + SankeyModule, + SharedToolbarModule, + SunburstModule, + SyncModule, + TreemapModule, + WaterfallModule, + ZoomModule + ); + import_ag_charts_community282._ModuleSupport.enterpriseModule.isEnterprise = true; + import_ag_charts_community282._ModuleSupport.enterpriseModule.styles = styles_default; + import_ag_charts_community282._ModuleSupport.enterpriseModule.licenseManager = (options) => new LicenseManager( + options.container?.ownerDocument ?? (typeof document === "undefined" ? void 0 : document) + ); + import_ag_charts_community282._ModuleSupport.enterpriseModule.injectWatermark = injectWatermark; +} + +// packages/ag-charts-enterprise/src/main.ts +__reExport(main_exports, require("ag-charts-community"), module.exports); +setupEnterpriseModules(); +var LicenseManager2 = { + setLicenseKey(key) { + LicenseManager.setLicenseKey(key); + } +}; +function setupEnterpriseModules2() { + setupEnterpriseModules(); + (0, import_ag_charts_community283.setupCommunityModules)(); +} +var AgChartsEnterpriseModule = { + VERSION: import_ag_charts_community283.VERSION, + _Scene: import_ag_charts_community283._Scene, + _Theme: import_ag_charts_community283._Theme, + _Util: import_ag_charts_community283._Util, + create: import_ag_charts_community283.AgCharts.create.bind(import_ag_charts_community283.AgCharts), + createSparkline: import_ag_charts_community283.AgCharts.__createSparkline.bind(import_ag_charts_community283.AgCharts), + setup: setupEnterpriseModules2, + setGridContext: LicenseManager.setGridContext.bind(LicenseManager), + setLicenseKey: LicenseManager.setLicenseKey.bind(LicenseManager), + isEnterprise: true +}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/package/main.cjs.min.js b/yuthon_report/static/src/lib/ag-chart/dist/package/main.cjs.min.js new file mode 100644 index 000000000..992a8c56c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/package/main.cjs.min.js @@ -0,0 +1,8 @@ +"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(t,e)=>{for(var i in e)__defProp(t,i,{get:e[i],enumerable:!0})},__copyProps=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of __getOwnPropNames(e))!__hasOwnProp.call(t,s)&&s!==i&&__defProp(t,s,{get:()=>e[s],enumerable:!(o=__getOwnPropDesc(e,s))||o.enumerable});return t},__reExport=(t,e,i)=>(__copyProps(t,e,"default"),i&&__copyProps(i,e,"default")),__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),__decorateClass=(t,e,i,o)=>{for(var s=o>1?void 0:o?__getOwnPropDesc(e,i):e,a=t.length-1,r;a>=0;a--)(r=t[a])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&__defProp(e,i,s),s},main_exports={};__export(main_exports,{AgChartsEnterpriseModule:()=>AgChartsEnterpriseModule,LicenseManager:()=>LicenseManager2,setupEnterpriseModules:()=>setupEnterpriseModules2}),module.exports=__toCommonJS(main_exports);var import_ag_charts_community283=require("ag-charts-community"),MD5=class{constructor(){this.ieCompatibility=!1}init(){this.ieCompatibility=this.md5("hello")!="5d41402abc4b2a76b9719d911017c592"}md5cycle(t,e){let i=t[0],o=t[1],s=t[2],a=t[3];i=this.ff(i,o,s,a,e[0],7,-680876936),a=this.ff(a,i,o,s,e[1],12,-389564586),s=this.ff(s,a,i,o,e[2],17,606105819),o=this.ff(o,s,a,i,e[3],22,-1044525330),i=this.ff(i,o,s,a,e[4],7,-176418897),a=this.ff(a,i,o,s,e[5],12,1200080426),s=this.ff(s,a,i,o,e[6],17,-1473231341),o=this.ff(o,s,a,i,e[7],22,-45705983),i=this.ff(i,o,s,a,e[8],7,1770035416),a=this.ff(a,i,o,s,e[9],12,-1958414417),s=this.ff(s,a,i,o,e[10],17,-42063),o=this.ff(o,s,a,i,e[11],22,-1990404162),i=this.ff(i,o,s,a,e[12],7,1804603682),a=this.ff(a,i,o,s,e[13],12,-40341101),s=this.ff(s,a,i,o,e[14],17,-1502002290),o=this.ff(o,s,a,i,e[15],22,1236535329),i=this.gg(i,o,s,a,e[1],5,-165796510),a=this.gg(a,i,o,s,e[6],9,-1069501632),s=this.gg(s,a,i,o,e[11],14,643717713),o=this.gg(o,s,a,i,e[0],20,-373897302),i=this.gg(i,o,s,a,e[5],5,-701558691),a=this.gg(a,i,o,s,e[10],9,38016083),s=this.gg(s,a,i,o,e[15],14,-660478335),o=this.gg(o,s,a,i,e[4],20,-405537848),i=this.gg(i,o,s,a,e[9],5,568446438),a=this.gg(a,i,o,s,e[14],9,-1019803690),s=this.gg(s,a,i,o,e[3],14,-187363961),o=this.gg(o,s,a,i,e[8],20,1163531501),i=this.gg(i,o,s,a,e[13],5,-1444681467),a=this.gg(a,i,o,s,e[2],9,-51403784),s=this.gg(s,a,i,o,e[7],14,1735328473),o=this.gg(o,s,a,i,e[12],20,-1926607734),i=this.hh(i,o,s,a,e[5],4,-378558),a=this.hh(a,i,o,s,e[8],11,-2022574463),s=this.hh(s,a,i,o,e[11],16,1839030562),o=this.hh(o,s,a,i,e[14],23,-35309556),i=this.hh(i,o,s,a,e[1],4,-1530992060),a=this.hh(a,i,o,s,e[4],11,1272893353),s=this.hh(s,a,i,o,e[7],16,-155497632),o=this.hh(o,s,a,i,e[10],23,-1094730640),i=this.hh(i,o,s,a,e[13],4,681279174),a=this.hh(a,i,o,s,e[0],11,-358537222),s=this.hh(s,a,i,o,e[3],16,-722521979),o=this.hh(o,s,a,i,e[6],23,76029189),i=this.hh(i,o,s,a,e[9],4,-640364487),a=this.hh(a,i,o,s,e[12],11,-421815835),s=this.hh(s,a,i,o,e[15],16,530742520),o=this.hh(o,s,a,i,e[2],23,-995338651),i=this.ii(i,o,s,a,e[0],6,-198630844),a=this.ii(a,i,o,s,e[7],10,1126891415),s=this.ii(s,a,i,o,e[14],15,-1416354905),o=this.ii(o,s,a,i,e[5],21,-57434055),i=this.ii(i,o,s,a,e[12],6,1700485571),a=this.ii(a,i,o,s,e[3],10,-1894986606),s=this.ii(s,a,i,o,e[10],15,-1051523),o=this.ii(o,s,a,i,e[1],21,-2054922799),i=this.ii(i,o,s,a,e[8],6,1873313359),a=this.ii(a,i,o,s,e[15],10,-30611744),s=this.ii(s,a,i,o,e[6],15,-1560198380),o=this.ii(o,s,a,i,e[13],21,1309151649),i=this.ii(i,o,s,a,e[4],6,-145523070),a=this.ii(a,i,o,s,e[11],10,-1120210379),s=this.ii(s,a,i,o,e[2],15,718787259),o=this.ii(o,s,a,i,e[9],21,-343485551),t[0]=this.add32(i,t[0]),t[1]=this.add32(o,t[1]),t[2]=this.add32(s,t[2]),t[3]=this.add32(a,t[3])}cmn(t,e,i,o,s,a){return e=this.add32(this.add32(e,t),this.add32(o,a)),this.add32(e<>>32-s,i)}ff(t,e,i,o,s,a,r){return this.cmn(e&i|~e&o,t,e,s,a,r)}gg(t,e,i,o,s,a,r){return this.cmn(e&o|i&~o,t,e,s,a,r)}hh(t,e,i,o,s,a,r){return this.cmn(e^i^o,t,e,s,a,r)}ii(t,e,i,o,s,a,r){return this.cmn(i^(e|~o),t,e,s,a,r)}md51(t){const e=t.length,i=[1732584193,-271733879,-1732584194,271733878];let o;for(o=64;o<=t.length;o+=64)this.md5cycle(i,this.md5blk(t.substring(o-64,o)));t=t.substring(o-64);const s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(o=0;o>2]|=t.charCodeAt(o)<<(o%4<<3);if(s[o>>2]|=128<<(o%4<<3),o>55)for(this.md5cycle(i,s),o=0;o<16;o++)s[o]=0;return s[14]=e*8,this.md5cycle(i,s),i}md5blk(t){const e=[];for(let i=0;i<64;i+=4)e[i>>2]=t.charCodeAt(i)+(t.charCodeAt(i+1)<<8)+(t.charCodeAt(i+2)<<16)+(t.charCodeAt(i+3)<<24);return e}rhex(t){const e="0123456789abcdef".split("");let i="",o=0;for(;o<4;o++)i+=e[t>>o*8+4&15]+e[t>>o*8&15];return i}hex(t){for(let e=0;e>16)+(e>>16)+(i>>16)<<16|i&65535}};function missingOrEmpty(t){return t==null||t.length===0}var LICENSE_TYPES={"01":"GRID","02":"CHARTS","0102":"BOTH"},LICENSING_HELP_URL="https://www.ag-grid.com/charts/licensing/",_LicenseManager=class at{constructor(e){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=e,this.md5=new MD5,this.md5.init()}validateLicense(){const e=this.getLicenseDetails(at.licenseKey,at.gridContext),i=`AG ${e.currentLicenseType==="BOTH"?"Grid and ":""}Charts Enterprise`;let o="";if(e.suppliedLicenseType==="BOTH"?o="AG Grid and AG Charts Enterprise":e.suppliedLicenseType==="GRID"?o="AG Grid Enterprise":e.suppliedLicenseType!==void 0&&(o="AG Charts Enterprise"),e.missing)(!this.isWebsiteUrl()||this.isForceWatermark())&&this.outputMissingLicenseKey(i);else if(e.expired){const s=at.getChartsReleaseDate(),a=at.formatDate(s);this.outputExpiredKey(e.expiry,a,o)}else e.valid?e.isTrial&&e.trialExpired&&this.outputExpiredTrialKey(e.expiry,i,o):this.outputInvalidLicenseKey(!!e.incorrectLicenseType,i,o)}static extractExpiry(e){const i=e.substring(e.lastIndexOf("_")+1,e.length);return new Date(Number.parseInt(at.decode(i),10))}static extractLicenseComponents(e){let i=e.replaceAll(/[\u200B-\u200D\uFEFF]/g,"");if(i=i.replaceAll(/\r?\n|\r/g,""),e.length<=32)return{md5:null,license:e,version:null,isTrial:null};const o=i.length-32,s=i.substring(o),a=i.substring(0,o),[r,n,l]=at.extractBracketedInformation(i);return{md5:s,license:a,version:r,isTrial:n,type:l}}getLicenseDetails(e,i=!1){const o="CHARTS";if(missingOrEmpty(e))return{licenseKey:e,valid:!1,missing:!0,currentLicenseType:o};const s=at.getChartsReleaseDate(),{md5:a,license:r,version:n,isTrial:l,type:c}=at.extractLicenseComponents(e);let h=a===this.md5.md5(r)&&!e.includes("For_Trialing_ag-Grid_Only"),d,u,p=null,g=!1,y;function f(){d=pp,n){case"legacy":case"2":{h=!1;break}case"3":missingOrEmpty(c)?h=!1:(y=c,c!==LICENSE_TYPES["02"]&&c!==LICENSE_TYPES["0102"]?(h=!1,g=!0):l&&f())}return h?{licenseKey:e,valid:h,expiry:at.formatDate(p),expired:u,version:n,isTrial:l,trialExpired:d,invalidLicenseTypeForCombo:i?y!=="BOTH":void 0,incorrectLicenseType:g,currentLicenseType:o,suppliedLicenseType:y}:{licenseKey:e,valid:h,incorrectLicenseType:g,currentLicenseType:o,suppliedLicenseType:y}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isE2ETest()&&!this.isWebsiteUrl()&&!missingOrEmpty(this.watermarkMessage)}getWatermarkMessage(){return this.watermarkMessage??""}getHostname(){if(!this.document)return"localhost";const e=this.document.defaultView??globalThis;if(!e)return"localhost";const i=e.location,{hostname:o=""}=i;return o}isForceWatermark(){if(!this.document)return!1;const e=this.document?.defaultView??globalThis.window!=null?globalThis:void 0;if(!e)return!1;const{pathname:i}=e.location;return i?i.includes("forceWatermark"):!1}isWebsiteUrl(){const e=this.getHostname();return/^((?:[\w-]+\.)?ag-grid\.com)$/.exec(e)!==null}isLocalhost(){const e=this.getHostname();return/^(?:127\.0\.0\.1|localhost)$/.exec(e)!==null}isE2ETest(){const e=this.getHostname();return/^(?:172\.17\.0\.1|host\.docker\.internal)$/.exec(e)!==null}static formatDate(e){const i=["January","February","March","April","May","June","July","August","September","October","November","December"],o=e.getDate(),s=e.getMonth(),a=e.getFullYear();return o+" "+i[s]+" "+a}static getChartsReleaseDate(){return new Date(Number.parseInt(at.decode(at.RELEASE_INFORMATION),10))}static decode(e){const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let o="",s,a,r,n,l,c,h,d=0;const u=e.replaceAll(/[^A-Za-z0-9+/=]/g,"");for(;d>4,a=(l&15)<<4|c>>2,r=(c&3)<<6|h,o=o+String.fromCodePoint(s),c!=64&&(o=o+String.fromCodePoint(a)),h!=64&&(o=o+String.fromCodePoint(r));return o=at.utf8_decode(o),o}static utf8_decode(e){e=e.replaceAll("rn","n");let i="";for(let o=0;o127&&s<2048?(i+=String.fromCodePoint(s>>6|192),i+=String.fromCodePoint(s&63|128)):(i+=String.fromCodePoint(s>>12|224),i+=String.fromCodePoint(s>>6&63|128),i+=String.fromCodePoint(s&63|128))}return i}static setGridContext(e=!1){at.gridContext=e}static setLicenseKey(e){this.licenseKey&&this.licenseKey!==e&&console.warn("License Key being set multiple times with different values. This can result in an incorrect license key being used."),at.licenseKey=e}static extractBracketedInformation(e){if(!e.includes("["))return["legacy",!1,void 0];const i=e.match(/\[(.*?)\]/g).map(n=>n.replace("[","").replace("]",""));if(!i||i.length===0)return["legacy",!1,void 0];const o=i.filter(n=>n==="TRIAL").length===1,s=i.find(n=>n.startsWith("v")),a=s?s.replace("v",""):"legacy",r=LICENSE_TYPES[i.find(n=>LICENSE_TYPES[n])];return[a,o,r]}centerPadAndOutput(e){const i=this.totalMessageLength-e.length;console.error(e.padStart(i/2+e.length,"*").padEnd(this.totalMessageLength,"*"))}padAndOutput(e,i="*",o=""){console.error(e.padEnd(this.totalMessageLength-o.length,i)+o)}outputInvalidLicenseKey(e,i,o){at.gridContext||(e?(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Incompatible License Key "),this.padAndOutput(`* Your license key is for ${o} only and does not cover you for ${i}.`," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")):(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Invalid License Key "),this.padAndOutput("* Your license key is not valid."," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput(""))),this.watermarkMessage="Invalid License"}outputExpiredTrialKey(e,i,o){at.gridContext||(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Trial Period Expired. "),this.padAndOutput(`* Your trial only license for ${o} expired on ${e}.`," ","*"),this.padAndOutput("* Please email info@ag-grid.com to purchase a license."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="Trial Period Expired"}outputMissingLicenseKey(e){at.gridContext||(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${e} License `),this.centerPadAndOutput(" License Key Not Found "),this.padAndOutput(`* All ${e} features are unlocked for trial.`," ","*"),this.padAndOutput("* If you want to hide the watermark please email info@ag-grid.com for a trial license key."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="For Trial Use Only"}outputExpiredKey(e,i,o){at.gridContext||(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${o} License `),this.centerPadAndOutput(" Incompatible Software Version "),this.padAndOutput(`* Your license key works with versions of ${o} released before ${e}.`," ","*"),this.padAndOutput(`* The version you are trying to use was released on ${i}.`," ","*"),this.padAndOutput("* Please contact info@ag-grid.com to renew your license key."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="License Expired"}};_LicenseManager.RELEASE_INFORMATION="MTc2MTcyODQ5OTU1NQ==",_LicenseManager.gridContext=!1;var LicenseManager=_LicenseManager,import_ag_charts_community282=require("ag-charts-community"),import_ag_charts_community5=require("ag-charts-community"),import_ag_charts_core4=require("ag-charts-core");function loopSymmetrically(t,e,i){const o=(a,r,n,l)=>{let c=t[0];for(let h=a;n>0?h<=r:h>r;h+=n){const d=t[h];if(l(c,d))return!0;c=d}return!1},s=Math.floor(t.length/2);return o(e,s,e,i)?!0:o(t.length-e,s,-e,i)}var import_ag_charts_community=require("ag-charts-community"),{AxisInterval,Property}=import_ag_charts_community._ModuleSupport,AngleAxisInterval=class extends AxisInterval{};__decorateClass([Property],AngleAxisInterval.prototype,"minSpacing",2);var import_ag_charts_community4=require("ag-charts-community"),import_ag_charts_core3=require("ag-charts-core"),import_ag_charts_community3=require("ag-charts-community"),import_ag_charts_core2=require("ag-charts-core"),import_ag_charts_community2=require("ag-charts-community"),import_ag_charts_core=require("ag-charts-core"),{BaseProperties,ChartAxisDirection,Property:Property2,Group,FONT_SIZE}=import_ag_charts_community2._ModuleSupport,PolarCrossLineLabel=class extends BaseProperties{constructor(){super(...arguments),this.fontSize=FONT_SIZE.LARGE,this.fontFamily="Verdana, sans-serif",this.padding=5,this.color="rgba(87, 87, 87, 1)"}};__decorateClass([Property2],PolarCrossLineLabel.prototype,"enabled",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"text",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"fontStyle",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"fontWeight",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"fontSize",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"fontFamily",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"padding",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"color",2),__decorateClass([Property2],PolarCrossLineLabel.prototype,"parallel",2);var PolarCrossLine=class extends BaseProperties{constructor(){super(...arguments),this.id=(0,import_ag_charts_core.createId)(this),this.defaultColorRange=[],this.shape="polygon",this.label=new PolarCrossLineLabel,this.scale=void 0,this.clippedRange=[-1/0,1/0],this.gridLength=0,this.sideFlag=-1,this.parallelFlipRotation=0,this.regularFlipRotation=0,this.direction=ChartAxisDirection.Angle,this.axisInnerRadius=0,this.axisOuterRadius=0,this.lineGroup=new Group({name:this.id}),this.rangeGroup=new Group({name:this.id}),this.labelGroup=new Group({name:this.id}),this._isRange=void 0}assignCrossLineGroup(t,e){t!==this._isRange&&(t?this.rangeGroup.appendChild(e):this.lineGroup.appendChild(e)),this._isRange=t}setSectorNodeProps(t){t.fill=this.fill,t.fillOpacity=this.fillOpacity??1,t.stroke=this.stroke,t.strokeOpacity=this.strokeOpacity??1,t.strokeWidth=this.strokeWidth??1,t.lineDash=this.lineDash}setLabelNodeProps(t,e,i,o,s){const{label:a}=this;t.x=e,t.y=i,t.text=a.text,t.textAlign="center",t.textBaseline=o,t.rotation=s,t.rotationCenterX=e,t.rotationCenterY=i,t.fill=a.color,t.fontFamily=a.fontFamily,t.fontSize=a.fontSize,t.fontStyle=a.fontStyle,t.visible=!0}};__decorateClass([Property2],PolarCrossLine.prototype,"enabled",2),__decorateClass([Property2],PolarCrossLine.prototype,"type",2),__decorateClass([Property2],PolarCrossLine.prototype,"range",2),__decorateClass([Property2],PolarCrossLine.prototype,"value",2),__decorateClass([Property2],PolarCrossLine.prototype,"defaultColorRange",2),__decorateClass([Property2],PolarCrossLine.prototype,"fill",2),__decorateClass([Property2],PolarCrossLine.prototype,"fillOpacity",2),__decorateClass([Property2],PolarCrossLine.prototype,"stroke",2),__decorateClass([Property2],PolarCrossLine.prototype,"strokeWidth",2),__decorateClass([Property2],PolarCrossLine.prototype,"strokeOpacity",2),__decorateClass([Property2],PolarCrossLine.prototype,"lineDash",2),__decorateClass([Property2],PolarCrossLine.prototype,"shape",2),__decorateClass([Property2],PolarCrossLine.prototype,"label",2);var{ChartAxisDirection:ChartAxisDirection2,getCrossLineValue,validateCrossLineValue,normalizeAngle360,Group:Group2,Path,Sector,RotatableText,ContinuousScale}=import_ag_charts_community3._ModuleSupport,AngleCrossLine=class extends PolarCrossLine{constructor(){super(),this.direction=ChartAxisDirection2.Angle,this.polygonNode=new Path,this.sectorNode=new Sector,this.lineNode=new Path,this.crossLineRange=new Group2,this.labelNode=new RotatableText,this.ticks=[],this.crossLineRange.append(this.polygonNode),this.crossLineRange.append(this.sectorNode),this.crossLineRange.append(this.lineNode),this.labelGroup.append(this.labelNode)}visibilityCheck(){if(!ContinuousScale.is(this.scale))return!0;const[t,e]=this.scale.domain,i=getCrossLineValue(this);if(this.type==="range"){const[o,s]=i;return o>=t&&o<=e&&s>=o&&s<=e}else return i>=t&&i<=e}update(t){const{scale:e}=this;if(!e||!validateCrossLineValue(this,e)||!this.visibilityCheck()){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.rangeGroup.visible=t,this.lineGroup.visible=t,this.labelGroup.visible=t,this.updateLineNode(t),this.updatePolygonNode(t),this.updateSectorNode(t),this.updateLabelNode(t)}updateLineNode(t){const{scale:e,type:i,value:o,lineNode:s}=this;if(!t||i!=="line"||!e){s.visible=!1;return}const a=e.convert(o);if(Number.isNaN(a)){s.visible=!1;return}const{axisInnerRadius:r,axisOuterRadius:n}=this;s.visible=!0,s.stroke=this.stroke,s.strokeOpacity=this.strokeOpacity??1,s.strokeWidth=this.strokeWidth??1,s.fill=void 0,s.lineDash=this.lineDash;const l=n*Math.cos(a),c=n*Math.sin(a),h=r*Math.cos(a),d=r*Math.sin(a);s.path.clear(!0),s.path.moveTo(h,d),s.path.lineTo(l,c),this.assignCrossLineGroup(!1,this.crossLineRange)}updatePolygonNode(t){const{polygonNode:e,range:i,scale:o,shape:s,type:a,ticks:r}=this;if(!t||a!=="range"||s!=="polygon"||!o||!i){e.visible=!1;return}const{axisInnerRadius:n,axisOuterRadius:l}=this,c=r.indexOf(i[0]),h=r.indexOf(i[1]),u=(c<=h?r.slice(c,h+1):r.slice(c).concat(r.slice(0,h+1))).map(g=>o.convert(g));e.visible=!0,this.setSectorNodeProps(e);const{path:p}=e;p.clear(!0);for(const[g,y]of u.entries()){const f=l*Math.cos(y),x=l*Math.sin(y);g===0?p.moveTo(f,x):p.lineTo(f,x)}if(n===0)p.lineTo(0,0);else{const g=u.slice().reverse();for(const y of g){const f=n*Math.cos(y),x=n*Math.sin(y);p.lineTo(f,x)}}e.path.closePath(),this.assignCrossLineGroup(!0,this.crossLineRange)}updateSectorNode(t){const{sectorNode:e,range:i,scale:o,shape:s,type:a}=this;if(!t||a!=="range"||s!=="circle"||!o||!i){e.visible=!1;return}const{axisInnerRadius:r,axisOuterRadius:n}=this,l=i.map(d=>o.convert(d)),c=o.step??0,h=o instanceof import_ag_charts_community3._ModuleSupport.BandScale?c/2:0;e.visible=!0,this.setSectorNodeProps(e),e.centerX=0,e.centerY=0,e.innerRadius=r,e.outerRadius=n,e.startAngle=l[0]-h,e.endAngle=l[1]+h,this.assignCrossLineGroup(!0,this.crossLineRange)}updateLabelNode(t){const{label:e,labelNode:i,range:o,scale:s,type:a,ticks:r}=this;if(!t||e.enabled===!1||!e.text||!s||a==="range"&&!o){i.visible=!1;return}i.visible=!0;const{axisInnerRadius:n,axisOuterRadius:l}=this;let c,h,d,u;if(a==="line"){const p=normalizeAngle360(s.convert(this.value)),g=1.5*Math.PI,y=(0,import_ag_charts_core2.isNumberEqual)(p,g)||p>g||pnormalizeAngle360(s.convert(b)));let y=(p+g)/2;p>g&&(y-=Math.PI),y=normalizeAngle360(y);const f=((0,import_ag_charts_core2.isNumberEqual)(y,0)||y>0)&&yl.value),n=r.reduce((l,c)=>Math.max(typeof c=="number"?(0,import_ag_charts_core3.countFractionDigits)(c):0,l),0);return{niceDomain:s,tickDomain:s,ticks:r,rawTickCount:void 0,fractionDigits:n,timeInterval:void 0,bbox:this.getBBox()}}update(){super.update(),this.updateRadiusLine(),this.updateGridLines(),this.updateTickLines()}normalizedAngles(){const t=normalizeAngle3602(-Math.PI/2+toRadians(this.startAngle)),e=this.endAngle==null?2*Math.PI:normalizeAngle360Inclusive(toRadians(this.endAngle)-toRadians(this.startAngle)),i=t+e;return[t,i]}computeRange(){this.range=this.normalizedAngles()}updateSelections(){const t=this.tickData;this.gridLineGroupSelection.update(this.gridLength&&this.gridLine.enabled?t:[]),this.tickLineGroupSelection.update(this.tick.enabled?t:[]),this.tickLabelGroupSelection.update(this.label.enabled?t:[]),this.gridLineGroupSelection.cleanup(),this.tickLineGroupSelection.cleanup(),this.tickLabelGroupSelection.cleanup()}updatePosition(){super.updatePosition();const{translation:t,radiusLineGroup:e}=this,i=Math.floor(t.x),o=Math.floor(t.y);e.translationX=i,e.translationY=o}updateRadiusLine(){const t=this.radiusLine,{path:e}=t;e.clear(!0);const{points:i,closePath:o}=this.getAxisLinePoints();for(const{x:s,y:a,moveTo:r,arc:n,radius:l=0,startAngle:c=0,endAngle:h=0}of i)n?e.arc(s,a,l,c,h):r?e.moveTo(s,a):e.lineTo(s,a);o&&e.closePath(),t.visible=this.line.enabled,t.stroke=this.line.stroke,t.strokeWidth=this.line.width,t.fill=void 0}getAxisLinePoints(){const{scale:t,shape:e,gridLength:i}=this,[o,s]=this.range,a=(0,import_ag_charts_core3.isNumberEqual)(s-o,2*Math.PI),r=[];if(e==="circle")a?r.push({x:i,y:0,moveTo:!0},{x:0,y:0,radius:i,startAngle:0,endAngle:2*Math.PI,arc:!0,moveTo:!1}):r.push({x:i*Math.cos(o),y:i*Math.sin(o),moveTo:!0},{x:0,y:0,radius:i,startAngle:normalizeAngle3602(o),endAngle:normalizeAngle3602(s),arc:!0,moveTo:!1});else if(e==="polygon"){const n=t.ticks({nice:this.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0})?.ticks?.map(l=>t.convert(l));if(n&&n.length>2)for(const[l,c]of n.entries()){const h=i*Math.cos(c),d=i*Math.sin(c),u=l===0;r.push({x:h,y:d,moveTo:u})}}return{points:r,closePath:a}}updateGridLines(){const{scale:t,gridLength:e,gridLine:{style:i,width:o},innerRadiusRatio:s}=this;if(!(i&&e>0))return;const a=e*s,r=i.length;this.gridLineGroupSelection.each((n,l,c)=>{const{value:h}=l,{stroke:d,lineDash:u}=i[c%r],p=t.convert(h);n.x1=a*Math.cos(p),n.y1=a*Math.sin(p),n.x2=e*Math.cos(p),n.y2=e*Math.sin(p),n.stroke=d,n.strokeWidth=o,n.lineDash=u,n.fill=void 0}),this.gridLineGroupSelection.cleanup()}updateLabels(){const{label:t,tickLabelGroupSelection:e}=this;e.each((i,o,s)=>{const a=this.labelData[s];if(!a||a.hidden){i.visible=!1;return}i.text=a.text,i.setFont(t),i.fill=t.color,i.x=a.x,i.y=a.y,i.setAlign(a),i.setBoxing(t),i.visible=!0,a.rotation?(i.rotation=a.rotation,i.rotationCenterX=a.x,i.rotationCenterY=a.y):i.rotation=0})}updateTickLines(){const{scale:t,gridLength:e,tick:i,tickLineGroupSelection:o}=this;o.each((s,a)=>{const{value:r}=a,n=t.convert(r),l=Math.cos(n),c=Math.sin(n);s.x1=e*l,s.y1=e*c,s.x2=(e+i.size)*l,s.y2=(e+i.size)*c,s.stroke=i.stroke,s.strokeWidth=i.width})}createLabelNodeData(t,e,i){const{label:o,gridLength:s,scale:a,tick:r}=this;if(!o.enabled)return[];const n=new RotatableText2,l=i.x-this.translation.x,c=i.x+i.width-this.translation.x,{fractionDigits:h}=this.layout.label,d=this.tickFormatter(this.scale.domain,this.tickData,!1,h),u=t.map((p,g)=>{const{value:y}=p,f=s+o.spacing+r.size,x=a.convert(y),b=Math.cos(x),m=Math.sin(x),S=f*b,v=f*m,{textAlign:M,textBaseline:D}=this.getLabelAlign(x),k=g===t.length-1&&y!==t[0]&&(0,import_ag_charts_core3.isNumberEqual)(normalizeAngle3602(x),normalizeAngle3602(a.convert(t[0]))),_=this.getLabelRotation(x);let T=d(y,g);n.text=T,n.x=S,n.y=v,n.setFont(o),n.textAlign=M,n.textBaseline=D,n.rotation=_,_&&(n.rotationCenterX=S,n.rotationCenterY=v);let w=_?Transformable.toCanvas(n):n.getBBox();if(w&&e.hideWhenNecessary&&!_){const R=l-w.x,F=w.x+w.width-c,O=1;if(R>O||F>O){const I={maxWidth:w.width-Math.max(R,F),font:o,textWrap:"never"};T=(0,import_ag_charts_core3.wrapTextOrSegments)(T,I),n.text=T,w=n.getBBox()}}return{text:T,x:S,y:v,textAlign:M,textBaseline:D,hidden:T===""||(p.hidden??k),rotation:_,box:w}});return o.avoidCollisions&&this.avoidLabelCollisions(u),u}computeLabelsBBox(t,e){this.labelData=this.createLabelNodeData(this.tickData,t,e);const i=this.labelData.map(({box:o})=>o).filter(o=>o!=null);return!this.label.enabled||i.length===0?null:BBox.merge(i)}getLabelOrientation(){const{label:t}=this;return t instanceof AngleAxisLabel?t.orientation:"fixed"}getLabelRotation(t){let e=toRadians(this.label.rotation??0);t=normalizeAngle3602(t);const i=this.getLabelOrientation();return i==="parallel"?(e+=t,t>=0&&t=Math.PI/2&&t<1.5*Math.PI&&(e+=Math.PI)),e}getLabelAlign(t){const e=Math.cos(t),i=Math.sin(t);let o,s;const a=this.getLabelOrientation(),r=(0,import_ag_charts_core3.isNumberEqual)(e,0),n=(0,import_ag_charts_core3.isNumberEqual)(i,0),l=(0,import_ag_charts_core3.isNumberEqual)(e,1),c=(0,import_ag_charts_core3.isNumberEqual)(i,-1),h=e>0&&!r,d=i>0&&!n;return a==="parallel"?(o="center",s=l&&n||d?"top":"bottom"):a==="perpendicular"?(o=c||h?"left":"right",s="middle"):(o="right",r?o="center":h&&(o="left"),s="bottom",n?s="middle":d&&(s="top")),{textAlign:o,textBaseline:s}}updateCrossLines(){const{shape:t,gridLength:e,innerRadiusRatio:i}=this;for(const o of this.crossLines)o instanceof AngleCrossLine&&(o.ticks=this.tickData.map(s=>s.value),o.shape=t,o.axisOuterRadius=e,o.axisInnerRadius=e*i);super.updateCrossLines()}};AngleAxis.CrossLineConstructor=AngleCrossLine,__decorateClass([Property3],AngleAxis.prototype,"startAngle",2),__decorateClass([Property3],AngleAxis.prototype,"endAngle",2);var{Property:Property4,CategoryScale}=import_ag_charts_community5._ModuleSupport,AngleCategoryAxis=class extends AngleAxis{constructor(t){super(t,new CategoryScale),this.groupPaddingInner=0,this.paddingInner=0,this.interval=new AngleAxisInterval}hasDefinedDomain(){return!1}generateAngleTicks(t){const{scale:e,gridLength:i}=this,{values:o,minSpacing:s}=this.interval,a={nice:this.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0},r=o??e.ticks(a,t)?.ticks??[];if(r.length<2||s==null)return r.map(d=>({value:d,visible:!0}));const n=r[0],l=e.convert(n),c=i*Math.cos(l),h=i*Math.sin(l);for(let d=1;dMath.PI)break;const g=i*Math.cos(p),y=i*Math.sin(p);if(Math.hypot(g-c,y-h)>s){const x=new Set([n]);return loopSymmetrically(r,d,(b,m)=>{x.add(m)}),r.map(b=>{const m=x.has(b);return{value:b,visible:m}})}}return[{value:n,visible:!0}]}avoidLabelCollisions(t){const{minSpacing:e}=this.label;if(t.length<3)return;const i=(l,c)=>{if(l.hidden||c.hidden)return!1;if(e==null)return l.box.collidesBBox(c.box);const h=l.box.clone().grow(e/2),d=c.box.clone().grow(e/2);return h.collidesBBox(d)},o=t[0],s=t.at(-1),a=new Set([o]),r=(0,import_ag_charts_core4.isNumberEqual)(o.x,s.x)&&(0,import_ag_charts_core4.isNumberEqual)(o.y,s.y),n=Math.floor(t.length/2);for(let l=1;l<=n;l++){const c=r?t.slice(0,-1):t;if(!loopSymmetrically(c,l,i)){loopSymmetrically(c,l,(d,u)=>{a.add(u)});break}}for(const l of t)a.has(l)||(l.hidden=!0,l.box=void 0)}tickFormatParams(){return{type:"category"}}datumFormatParams(t,e){const{datum:i,seriesId:o,legendItemName:s,key:a,source:r,property:n,domain:l,boundSeries:c}=e;return{type:"category",value:t,datum:i,seriesId:o,legendItemName:s,key:a,source:r,property:n,domain:l,boundSeries:c}}};AngleCategoryAxis.className="AngleCategoryAxis",AngleCategoryAxis.type="angle-category",__decorateClass([Property4],AngleCategoryAxis.prototype,"groupPaddingInner",2),__decorateClass([Property4],AngleCategoryAxis.prototype,"paddingInner",2),__decorateClass([Property4],AngleCategoryAxis.prototype,"interval",2);var AngleCategoryAxisModule={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"angle-category",moduleFactory:t=>new AngleCategoryAxis(t)},import_ag_charts_community7=require("ag-charts-community"),import_ag_charts_core6=require("ag-charts-core"),import_ag_charts_community6=require("ag-charts-community"),import_ag_charts_core5=require("ag-charts-core"),{range,isDenseInterval,LinearScale}=import_ag_charts_community6._ModuleSupport,LinearAngleScale=class ft extends LinearScale{constructor(){super(...arguments),this.arcLength=0}static getNiceStepAndTickCount(e,i){const[o,s]=i;let a=LinearScale.getTickStep(o,s,e);const r=Number.isNaN(e.maxTickCount)?1/0:e.maxTickCount,n=Math.abs(s-o)/a;let l=Math.pow(2,Math.ceil(Math.log(n)/Math.log(2)));return l>r&&(l/=2,a*=2),{count:l,step:a}}ticks(e,i=this.domain){const{arcLength:o}=this;if(!i||i.length<2||i.some(c=>!Number.isFinite(c))||o<=0)return{ticks:[],count:0};const{nice:s,interval:a}=e,[r,n]=i;if(a){const c=Math.abs(a),h=this.getPixelRange();if(!isDenseInterval((n-r)/c,h))return range(r,n,c)}let l;if(s&&this.hasNiceRange()){const c=super.niceDomain(e,i);l=ft.getNiceStepAndTickCount(e,c).step}else l=LinearScale.getTickStep(r,n,e);return range(r,n,l)}hasNiceRange(){const e=this.range.slice().sort((o,s)=>o-s);return[Math.PI,2*Math.PI].some(o=>(0,import_ag_charts_core5.isNumberEqual)(o,e[1]-e[0]))}niceDomain(e,i=this.domain){const o=super.niceDomain(e,i);if(!this.hasNiceRange())return o;const s=o[0]>o[1],a=s?o[1]:o[0],{step:r,count:n}=ft.getNiceStepAndTickCount(e,o),l=1/r,c=r>=1?Math.ceil(a/r+n)*r:Math.ceil((a+n*r)*l)/l;return s?[c,a]:[a,c]}getPixelRange(){return this.arcLength}},{Property:Property5,angleBetween,normalisedExtentWithMetadata,findMinMax}=import_ag_charts_community7._ModuleSupport,AngleNumberAxis=class extends AngleAxis{constructor(t){super(t,new LinearAngleScale),this.shape="circle",this.interval=new AngleAxisInterval}hasDefinedDomain(){const{min:t,max:e}=this;return t!=null&&e!=null&&td>=c&&d<=h).sort((d,u)=>d-u)}return l.map(c=>({value:c,visible:!0}))}avoidLabelCollisions(t){const{minSpacing:e}=this.label,i=(a,r)=>{if(a.hidden||r.hidden)return!1;if(e==null)return a.box.collidesBBox(r.box);const n=a.box.clone().grow(e/2),l=r.box.clone().grow(e/2);return n.collidesBBox(l)},o=t[0],s=t.at(-1);o!==s&&(0,import_ag_charts_core6.isNumberEqual)(o.x,s.x)&&(0,import_ag_charts_core6.isNumberEqual)(o.y,s.y)&&(s.hidden=!0);for(let a=1;a0&&(l.hidden=!0,l.box=void 0);return}}for(const[a,r]of t.entries())a>0&&(r.hidden=!0,r.box=void 0)}tickFormatParams(t,e,i){return{type:"number",fractionDigits:i}}datumFormatParams(t,e,i){const{datum:o,seriesId:s,legendItemName:a,key:r,source:n,property:l,domain:c,boundSeries:h}=e;return{type:"number",value:t,datum:o,seriesId:s,legendItemName:a,key:r,source:n,property:l,domain:c,boundSeries:h,fractionDigits:i}}};AngleNumberAxis.className="AngleNumberAxis",AngleNumberAxis.type="angle-number",__decorateClass([Property5],AngleNumberAxis.prototype,"min",2),__decorateClass([Property5],AngleNumberAxis.prototype,"max",2),__decorateClass([Property5],AngleNumberAxis.prototype,"interval",2);var AngleNumberAxisModule={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"angle-number",moduleFactory:t=>new AngleNumberAxis(t)},import_ag_charts_community8=require("ag-charts-community"),{OrdinalTimeScale,Property:Property6,TimeAxisParentLevel,lowestGranularityUnitForTicks,lowestGranularityUnitForValue,minimumTimeAxisDatumGranularity,dateTruncationForDomain,intervalUnit,intervalStep,intervalEpoch,intervalMilliseconds}=import_ag_charts_community8._ModuleSupport,OrdinalTimeAxis=class extends import_ag_charts_community8._ModuleSupport.DiscreteTimeAxis{constructor(t){super(t,new OrdinalTimeScale),this.parentLevel=new TimeAxisParentLevel}get primaryLabel(){return this.parentLevel.enabled?this.parentLevel.label:void 0}get primaryTick(){return this.parentLevel.enabled?this.parentLevel.tick:void 0}processData(){super.processData();const{boundSeries:t,direction:e}=this;this.minimumTimeGranularity=minimumTimeAxisDatumGranularity(t,e,void 0,void 0)}tickFormatParams(t,e,i,o){o??(o=lowestGranularityUnitForTicks(e));const s=dateTruncationForDomain(t),a=intervalUnit(o),r=intervalStep(o),n=intervalEpoch(o);return{type:"date",unit:a,step:r,epoch:n,truncateDate:s}}datumFormatParams(t,e,i,o,s){if(typeof t=="number"&&(t=new Date(t)),o==null){const{minimumTimeGranularity:f}=this,x=lowestGranularityUnitForValue(t);f!=null&&intervalMilliseconds(f)new OrdinalTimeAxis(t)},import_ag_charts_community11=require("ag-charts-community"),import_ag_charts_community10=require("ag-charts-community"),import_ag_charts_core8=require("ag-charts-core"),import_ag_charts_community9=require("ag-charts-community"),import_ag_charts_core7=require("ag-charts-core"),{ChartAxisDirection:ChartAxisDirection4,Property:Property7,validateCrossLineValue:validateCrossLineValue2,normalizeAngle360FromDegrees,Group:Group3,Path:Path3,Sector:Sector2,RotatableText:RotatableText3}=import_ag_charts_community9._ModuleSupport,RadiusCrossLineLabel=class extends PolarCrossLineLabel{constructor(){super(...arguments),this.positionAngle=void 0}};__decorateClass([Property7],RadiusCrossLineLabel.prototype,"positionAngle",2);var RadiusCrossLine=class extends PolarCrossLine{constructor(){super(),this.direction=ChartAxisDirection4.Radius,this.label=new RadiusCrossLineLabel,this.polygonNode=new Path3,this.sectorNode=new Sector2,this.crossLineRange=new Group3,this.labelNode=new RotatableText3,this.outerRadius=0,this.innerRadius=0,this.crossLineRange.append(this.polygonNode),this.crossLineRange.append(this.sectorNode),this.labelGroup.append(this.labelNode)}update(t){const{scale:e}=this;if(!e||!validateCrossLineValue2(this,e)){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.updateRadii();const{innerRadius:i,outerRadius:o}=this;t&&(t=i>=this.axisInnerRadius&&o<=this.axisOuterRadius),this.rangeGroup.visible=t,this.lineGroup.visible=t,this.labelGroup.visible=t,this.updatePolygonNode(t),this.updateSectorNode(t),this.updateLabelNode(t),this.assignCrossLineGroup(this.type==="range",this.crossLineRange)}updateRadii(){const{range:t,scale:e,type:i,axisInnerRadius:o,axisOuterRadius:s}=this;if(!e)return{innerRadius:0,outerRadius:0};const a=l=>s+o-l;let r,n;if(i==="line")r=a(e.convert(this.value)),n=r;else{const l=Math.abs(e?.bandwidth??0),c=t.map(h=>e.convert(h));r=a(Math.max(...c)),n=a(Math.min(...c))+l}this.outerRadius=r,this.innerRadius=n}drawPolygon(t,e,i){for(const[o,s]of e.entries()){const a=t*Math.cos(s),r=t*Math.sin(s);o===0?i.path.moveTo(a,r):i.path.lineTo(a,r)}i.path.closePath()}updatePolygonNode(t){const{gridAngles:e,polygonNode:i,scale:o,shape:s,type:a,innerRadius:r,outerRadius:n}=this;if(!t||s!=="polygon"||!o||!e){i.visible=!1;return}i.visible=!0;const l=this.getPadding();i.path.clear(!0),this.drawPolygon(n-l,e,i);const c=e.slice().reverse(),h=a==="line"?n-l:r+l;this.drawPolygon(h,c,i),this.setSectorNodeProps(i)}updateSectorNode(t){const{axisInnerRadius:e,axisOuterRadius:i,scale:o,sectorNode:s,shape:a,innerRadius:r,outerRadius:n}=this;if(!t||a!=="circle"||!o){s.visible=!1;return}s.visible=!0,s.startAngle=0,s.endAngle=2*Math.PI;const l=this.getPadding(),c=(0,import_ag_charts_core7.clamp)(e,r+l,i),h=(0,import_ag_charts_core7.clamp)(e,n-l,i);s.innerRadius=Math.min(c,h),s.outerRadius=Math.max(c,h),this.setSectorNodeProps(s)}updateLabelNode(t){const{innerRadius:e,label:i,labelNode:o,scale:s,shape:a,type:r}=this;if(!t||i.enabled===!1||!i.text||!s){o.visible=!1;return}const n=normalizeAngle360FromDegrees((i.positionAngle??0)-90),l=((0,import_ag_charts_core7.isNumberEqual)(n,0)||n>0)&&nthis.tickFormatter(...b),domain:t,range:r,reverse:n,niceMode:e,visibleRange:o,defaultTickMinSpacing:l,labelOffset:a,sideFlag:s,axisRotation:0,sizeLimit:void 0,primaryTickCount:void 0}),{tickData:h}=c,{ticks:d,rawTicks:u,rawTickCount:p,tickDomain:g,fractionDigits:y,niceDomain:f=t}=h,x=d.map(b=>this.getTickLabelProps(b,c));return this.generatedTicks={ticks:d,labels:x},{ticks:u,tickDomain:g,niceDomain:f,rawTickCount:p,fractionDigits:y,timeInterval:void 0}}updateSelections(){const{generatedTicks:t}=this;if(!t)return;const{ticks:e,labels:i}=t;this.gridLineGroupSelection.update(this.gridLength?e:[]),this.tickLabelGroupSelection.update(i),this.gridPathSelection.update(this.gridLine.enabled?this.prepareGridPathTickData(e):[]),this.gridLineGroupSelection.cleanup(),this.tickLabelGroupSelection.cleanup(),this.gridPathSelection.cleanup()}updateLabels(){if(!this.label.enabled)return;const t=import_ag_charts_community10._ModuleSupport.resetAxisLabelSelectionFn();this.tickLabelGroupSelection.each((e,i)=>{e.fill=i.color,e.text=i.text,e.textBaseline=i.textBaseline,e.textAlign=i.textAlign??"center",e.setFont(i),e.setBoxing(i),e.setProperties(t(e,i))})}updateGridLines(){const{gridLine:{style:t,width:e},shape:i,generatedTicks:o}=this;if(!t||!o)return;const s=t.length,a=(u,p)=>{const{stroke:g,lineDash:y}=t[p%s];u.stroke=g,u.strokeWidth=e,u.lineDash=y,u.fill=void 0},[r,n]=this.gridRange??[0,2*Math.PI],l=(0,import_ag_charts_core8.isNumberEqual)(n-r,2*Math.PI),d=i==="circle"?(u,p)=>{const{path:g}=u;g.clear(!0);const y=this.getTickRadius(p);l?(g.moveTo(y,0),g.arc(0,0,y,0,2*Math.PI)):(g.moveTo(y*Math.cos(r),y*Math.sin(r)),g.arc(0,0,y,normalizeAngle3603(r),normalizeAngle3603(n))),l&&g.closePath()}:(u,p)=>{const{path:g}=u,y=this.gridAngles;if(g.clear(!0),!y||y.length<3)return;const f=this.getTickRadius(p);for(const[x,b]of y.entries()){const m=f*Math.cos(b),S=f*Math.sin(b);x===0?g.moveTo(m,S):g.lineTo(m,S);for(const[v,M]of y.entries()){const D=f*Math.cos(M),k=f*Math.sin(M);v===0?g.moveTo(D,k):g.lineTo(D,k)}g.closePath()}g.closePath()};this.gridPathSelection.each((u,p,g)=>{a(u,g),d(u,p)})}updateTitle(){const t=r=>r.defaultValue,{title:e,range:i}=this,{formatter:o=t}=this.title;e.caption.enabled=e.enabled,e.caption.fontFamily=e.fontFamily,e.caption.fontSize=e.fontSize,e.caption.fontStyle=e.fontStyle,e.caption.fontWeight=e.fontWeight,e.caption.color=e.color,e.caption.wrapping=e.wrapping;let s=!1;const a=e.caption.node;e.enabled&&(s=!0,a.rotation=Math.PI/2,a.x=Math.floor((i[0]+i[1])/2),a.y=-Caption.SMALL_PADDING,a.textAlign="center",a.textBaseline="bottom",a.text=this.cachedCallWithContext(o,this.getTitleFormatterParams(this.scale.domain))),a.visible=s}updateCrossLines(){for(const t of this.crossLines)if(t instanceof RadiusCrossLine){const{shape:e,gridAngles:i,range:o,innerRadiusRatio:s}=this,a=o[0];t.shape=e,t.gridAngles=i,t.axisOuterRadius=a,t.axisInnerRadius=a*s}super.updateCrossLines()}createLabel(){return new RadiusAxisLabel}getTickLabelProps(t,e){const{label:i}=this,{rotation:o,textBaseline:s,textAlign:a}=e,r=this.scale.range,n=t.tickLabel??"",c=i.getSideFlag()*(this.getTickSize()+i.spacing+this.seriesAreaPadding),h=n!==""&&n!=null,d=o;return{...this.getLabelStyles({value:t.tick,formattedValue:t.tickLabel}),tickId:t.tickId,rotation:d,text:n,textAlign:a,textBaseline:s,visible:h,x:c,y:t.translation,rotationCenterX:c,rotationCenterY:t.translation,range:r}}};RadiusAxis.CrossLineConstructor=RadiusCrossLine,__decorateClass([Property8],RadiusAxis.prototype,"positionAngle",2);var{ProxyPropertyOnWrite,Property:Property9,CategoryScale:CategoryScale2}=import_ag_charts_community11._ModuleSupport,RadiusCategoryAxis=class extends RadiusAxis{constructor(t){super(t,new CategoryScale2),this.shape="circle",this.groupPaddingInner=0,this.paddingInner=0,this.paddingOuter=0}hasDefinedDomain(){return!1}normaliseDataDomain(t){return{domain:t,clipped:!1}}prepareGridPathTickData(t){return t.slice().reverse()}getTickRadius(t){const{scale:e,innerRadiusRatio:i}=this,o=e.range[0],s=o*i;if(CategoryScale2.is(e)){const a=e.domain,r=a.length-1-a.indexOf(t.tick);return r===0?s:e.inset+e.step*(r-.5)+e.bandwidth/2}else{const a=(o-s)/e.domain.length;return o-t.translation+s-a/2}}tickFormatParams(){return{type:"category"}}datumFormatParams(t,e){const{datum:i,seriesId:o,legendItemName:s,key:a,source:r,property:n,domain:l,boundSeries:c}=e;return{type:"category",value:t,datum:i,seriesId:o,legendItemName:s,key:a,source:r,property:n,domain:l,boundSeries:c}}};RadiusCategoryAxis.className="RadiusCategoryAxis",RadiusCategoryAxis.type="radius-category",__decorateClass([Property9],RadiusCategoryAxis.prototype,"groupPaddingInner",2),__decorateClass([ProxyPropertyOnWrite("scale","paddingInner"),Property9],RadiusCategoryAxis.prototype,"paddingInner",2),__decorateClass([ProxyPropertyOnWrite("scale","paddingOuter"),Property9],RadiusCategoryAxis.prototype,"paddingOuter",2);var RadiusCategoryAxisModule={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radius-category",moduleFactory:t=>new RadiusCategoryAxis(t)},import_ag_charts_community12=require("ag-charts-community"),{Property:Property10,normalisedExtentWithMetadata:normalisedExtentWithMetadata2,LinearScale:LinearScale2}=import_ag_charts_community12._ModuleSupport,RadiusNumberAxis=class extends RadiusAxis{constructor(t){super(t,new LinearScale2),this.shape="polygon"}hasDefinedDomain(){const{min:t,max:e}=this;return t!=null&&e!=null&&to!==i).sort((o,s)=>s.tick-o.tick)}getTickRadius(t){const{scale:e}=this,i=e.range[0],o=i*this.innerRadiusRatio;return i-t.translation+o}normaliseDataDomain(t){const{min:e,max:i}=this,{extent:o,clipped:s}=normalisedExtentWithMetadata2(t,e,i);return{domain:o,clipped:s}}tickFormatParams(t,e,i){return{type:"number",fractionDigits:i}}datumFormatParams(t,e,i){const{datum:o,seriesId:s,legendItemName:a,key:r,source:n,property:l,domain:c,boundSeries:h}=e;return{type:"number",value:t,datum:o,seriesId:s,legendItemName:a,key:r,source:n,property:l,domain:c,boundSeries:h,fractionDigits:i}}};RadiusNumberAxis.className="RadiusNumberAxis",RadiusNumberAxis.type="radius-number",__decorateClass([Property10],RadiusNumberAxis.prototype,"min",2),__decorateClass([Property10],RadiusNumberAxis.prototype,"max",2);var RadiusNumberAxisModule={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radius-number",moduleFactory:t=>new RadiusNumberAxis(t)},import_ag_charts_community13=require("ag-charts-community"),{ObserveChanges,Property:Property11}=import_ag_charts_community13._ModuleSupport,Animation=class extends import_ag_charts_community13._ModuleSupport.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.enabled=!0,t.animationManager.skip(!1),this.cleanup.register(()=>{t.animationManager.skip(!0)})}};__decorateClass([ObserveChanges((t,e)=>{t.ctx.animationManager.skip(!e)}),Property11],Animation.prototype,"enabled",2),__decorateClass([ObserveChanges((t,e)=>{t.ctx.animationManager.defaultDuration=e}),Property11],Animation.prototype,"duration",2),__decorateClass([ObserveChanges((t,e)=>{t.ctx.animationManager.maxAnimatableItems=e??1/0}),Property11],Animation.prototype,"maxAnimatableItems",2);var AnimationModule={type:"root",optionsKey:"animation",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:t=>new Animation(t),themeTemplate:{animation:{enabled:!0,maxAnimatableItems:1e3}}},import_ag_charts_community88=require("ag-charts-community"),import_ag_charts_core43=require("ag-charts-core"),import_ag_charts_community14=require("ag-charts-community"),import_ag_charts_core9=require("ag-charts-core"),textInputTemplate_default='
',{focusCursorAtEnd}=import_ag_charts_community14._ModuleSupport,moduleId="text-input",canvasOverlay="canvas-overlay",TextInput=class extends import_ag_charts_community14._ModuleSupport.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.layout={getTextInputCoords:()=>({x:0,y:0}),getTextPosition:()=>"center",alignment:"center",textAlign:"center"},this.visible=!1,this.element=t.domManager.addChild(canvasOverlay,moduleId),this.element.classList.add("ag-charts-text-input"),this.cleanup.register(()=>t.domManager.removeChild(canvasOverlay,moduleId))}setKeyDownHandler(t){this.cleanup.register((0,import_ag_charts_core9.attachListener)(this.element,"keydown",t))}show(t){this.element.innerHTML=textInputTemplate_default;const e=this.element.firstElementChild;(0,import_ag_charts_core9.setAttributes)(e,{role:"textbox","data-preventdefault":!1}),e.isContentEditable||(e.contentEditable="true"),e.setAttribute("placeholder",this.ctx.localeManager.t(t.placeholderText??"inputTextareaPlaceholder")),t.styles?.placeholderColor&&e.style.setProperty("--placeholder-text-color",t.styles?.placeholderColor),e.innerText=t.text??"",e.style.color=t.styles?.color??"inherit",e.style.fontFamily=t.styles?.fontFamily??"inherit",e.style.fontSize=t.styles?.fontSize?`${t.styles.fontSize}px`:"inherit",e.style.fontStyle=t.styles?.fontStyle??"inherit",e.style.fontWeight=typeof t.styles?.fontWeight=="number"?`${t.styles.fontWeight}`:t.styles?.fontWeight??"inherit",focusCursorAtEnd(e),e.addEventListener("input",()=>{this.updatePosition(),t.onChange?.(this.getValue(),this.getBBox())}),e.addEventListener("click",i=>{i.stopPropagation()}),t.layout&&(this.layout=t.layout,this.updatePosition()),t.onChange?.(this.getValue(),this.getBBox()),this.visible=!0}hide(){this.element.innerHTML="",this.layout={getTextInputCoords:()=>({x:0,y:0}),getTextPosition:()=>"center",alignment:"center",textAlign:"center"},this.visible=!1}isVisible(){return this.visible}updateColor(t){this.element.firstElementChild&&(this.element.firstElementChild.style.color=t)}updateFontSize(t){if(this.element.firstElementChild)return this.element.firstElementChild.style.fontSize=`${t}px`,this.updatePosition(),this.getBBox()}getValue(){if(this.element.firstElementChild)return this.element.firstElementChild.innerText.trim()}updatePosition(){const{element:t}=this,e=t.firstElementChild;if(!e)return;const i=this.ctx.domManager.getBoundingClientRect(),{width:o,getTextInputCoords:s,getTextPosition:a,alignment:r,textAlign:n}=this.layout;t.style.setProperty("width",o?`${o}px`:"unset");const l=e.getBoundingClientRect(),c=s(l.height);let h=c.x;r==="center"?h-=(o??l.width)/2:r==="right"&&(h-=o??l.width);const d=a();let u=c.y;d==="center"?u-=l.height/2:d==="bottom"&&(u-=l.height),t.style.setProperty("top",`${u}px`),t.style.setProperty("left",`${h}px`),t.style.setProperty("max-width",`${i.width-h}px`),t.style.setProperty("text-align",r),e.style.setProperty("text-align",n)}getBBox(){const{left:t,top:e,width:i,height:o}=this.element.getBoundingClientRect();return new import_ag_charts_community14._ModuleSupport.BBox(t,e,i,o)}},import_ag_charts_community15=require("ag-charts-community"),{BaseProperties:BaseProperties2,Property:Property12}=import_ag_charts_community15._ModuleSupport,AxesButtons=class extends BaseProperties2{constructor(){super(...arguments),this.enabled=!1,this.axes="y"}};__decorateClass([Property12],AxesButtons.prototype,"enabled",2),__decorateClass([Property12],AxesButtons.prototype,"axes",2);var import_ag_charts_community35=require("ag-charts-community"),AnnotationType=(t=>(t.Line="line",t.HorizontalLine="horizontal-line",t.VerticalLine="vertical-line",t.DisjointChannel="disjoint-channel",t.ParallelChannel="parallel-channel",t.FibonacciRetracement="fibonacci-retracement",t.FibonacciRetracementTrendBased="fibonacci-retracement-trend-based",t.Callout="callout",t.Comment="comment",t.Note="note",t.Text="text",t.Arrow="arrow",t.ArrowUp="arrow-up",t.ArrowDown="arrow-down",t.DateRange="date-range",t.PriceRange="price-range",t.DatePriceRange="date-price-range",t.QuickDatePriceRange="quick-date-price-range",t))(AnnotationType||{}),ANNOTATION_TYPES=Object.values(AnnotationType);function stringToAnnotationType(t){for(const e of ANNOTATION_TYPES)if(e===t)return e}var import_ag_charts_core24=require("ag-charts-core"),import_ag_charts_community19=require("ag-charts-community"),import_ag_charts_core12=require("ag-charts-core"),import_ag_charts_community16=require("ag-charts-community"),import_ag_charts_core10=require("ag-charts-core"),{BaseProperties:BaseProperties3,FONT_SIZE:FONT_SIZE2,Property:Property13}=import_ag_charts_community16._ModuleSupport,PointProperties=class extends BaseProperties3{};__decorateClass([Property13],PointProperties.prototype,"x",2),__decorateClass([Property13],PointProperties.prototype,"y",2);var ChannelAnnotationMiddleProperties=class extends Stroke(LineStyle(Visible(BaseProperties3))){},AxisLabelProperties=class extends Stroke(LineStyle(Fill(Label(Font(BaseProperties3))))){constructor(){super(...arguments),this.cornerRadius=2}};__decorateClass([Property13],AxisLabelProperties.prototype,"enabled",2),__decorateClass([Property13],AxisLabelProperties.prototype,"cornerRadius",2);var BackgroundProperties=class extends Fill(BaseProperties3){},HandleProperties=class extends Stroke(LineStyle(Fill(BaseProperties3))){},LineTextProperties=class extends Font(BaseProperties3){constructor(){super(...arguments),this.label="",this.position="top",this.alignment="left"}};__decorateClass([Property13],LineTextProperties.prototype,"label",2),__decorateClass([Property13],LineTextProperties.prototype,"position",2),__decorateClass([Property13],LineTextProperties.prototype,"alignment",2);var LabelTextProperties=class extends Font(BaseProperties3){},ChannelTextProperties=class extends Font(BaseProperties3){constructor(){super(...arguments),this.label=""}};__decorateClass([Property13],ChannelTextProperties.prototype,"label",2),__decorateClass([Property13],ChannelTextProperties.prototype,"position",2),__decorateClass([Property13],ChannelTextProperties.prototype,"alignment",2);function Annotation(t){class e extends Writeable(Visible(t)){constructor(){super(...arguments),this.id=(0,import_ag_charts_core10.generateUUID)()}}return e}function Line3(t){class e extends t{constructor(){super(...arguments),this.start=new PointProperties,this.end=new PointProperties}}return __decorateClass([Property13],e.prototype,"start",2),__decorateClass([Property13],e.prototype,"end",2),e}function Point(t){class e extends t{}return __decorateClass([Property13],e.prototype,"x",2),__decorateClass([Property13],e.prototype,"y",2),e}function Value(t){class e extends t{}return __decorateClass([Property13],e.prototype,"value",2),e}function Background(t){class e extends t{constructor(){super(...arguments),this.background=new BackgroundProperties}}return __decorateClass([Property13],e.prototype,"background",2),e}function Handle(t){class e extends t{constructor(){super(...arguments),this.handle=new HandleProperties}}return __decorateClass([Property13],e.prototype,"handle",2),e}function AxisLabel(t){class e extends t{constructor(){super(...arguments),this.axisLabel=new AxisLabelProperties}}return __decorateClass([Property13],e.prototype,"axisLabel",2),e}function Label(t){class e extends t{constructor(){super(...arguments),this.padding=void 0,this.textAlign="center",this.formatter=void 0}}return __decorateClass([Property13],e.prototype,"padding",2),__decorateClass([Property13],e.prototype,"textAlign",2),__decorateClass([Property13],e.prototype,"formatter",2),e}function Cappable(t){class e extends t{}return e}function Extendable(t){class e extends t{}return __decorateClass([Property13],e.prototype,"extendStart",2),__decorateClass([Property13],e.prototype,"extendEnd",2),e}function Writeable(t){class e extends t{isWriteable(){return!this.locked&&!this.readOnly}isHoverable(){return!this.readOnly}}return __decorateClass([Property13],e.prototype,"locked",2),__decorateClass([Property13],e.prototype,"readOnly",2),e}function Localisable(t){class e extends t{setLocaleManager(o){this.localeManager??(this.localeManager=o)}}return e}function Visible(t){class e extends t{}return __decorateClass([Property13],e.prototype,"visible",2),e}function Fill(t){class e extends t{}return __decorateClass([Property13],e.prototype,"fill",2),__decorateClass([Property13],e.prototype,"fillOpacity",2),e}function Stroke(t){class e extends t{}return __decorateClass([Property13],e.prototype,"stroke",2),__decorateClass([Property13],e.prototype,"strokeOpacity",2),__decorateClass([Property13],e.prototype,"strokeWidth",2),e}function LineStyle(t){class e extends t{constructor(){super(...arguments),this.lineCap=void 0,this.computedLineDash=void 0}}return __decorateClass([Property13],e.prototype,"lineDash",2),__decorateClass([Property13],e.prototype,"lineDashOffset",2),__decorateClass([Property13],e.prototype,"lineStyle",2),e}function Font(t){class e extends t{constructor(){super(...arguments),this.fontSize=FONT_SIZE2.SMALL,this.fontFamily="Verdana, sans-serif"}}return __decorateClass([Property13],e.prototype,"fontStyle",2),__decorateClass([Property13],e.prototype,"fontWeight",2),__decorateClass([Property13],e.prototype,"fontSize",2),__decorateClass([Property13],e.prototype,"fontFamily",2),__decorateClass([Property13],e.prototype,"color",2),e}var import_ag_charts_community18=require("ag-charts-community"),import_ag_charts_core11=require("ag-charts-core");function getGrouping(t){return(0,import_ag_charts_core11.isNumber)(t)||(0,import_ag_charts_core11.isString)(t)||(0,import_ag_charts_core11.isDate)(t)?{value:t,groupPercentage:0}:t??{value:void 0,groupPercentage:0}}function getGroupingValue(t){return getGrouping(t)?.value}function convertLine(t,e){if(t.start==null||t.end==null)return;const i=convertPoint(t.start,e),o=convertPoint(t.end,e);if(!(i==null||o==null))return{x1:i.x,y1:i.y,x2:o.x,y2:o.y}}function convertPoint(t,e){const i=convert(t.x,e.xAxis),o=convert(t.y,e.yAxis);return{x:i,y:o}}function convert(t,e){if(t==null)return 0;const{value:i,groupPercentage:o}=getGrouping(t),{scale:s,snapToGroup:a}=e,r=s.bandwidth===0?s.step??0:s.bandwidth??0,n=a?r/2:r*o;return s.convert(i)+n}function invertCoords(t,e){const i=invert(t.x,e.xAxis),o=invert(t.y,e.yAxis);return{x:i,y:o}}function invert(t,e){const{scale:i}=e;if(e.continuous&&i.step==null)return e.scaleInvert(t);const o=e.scaleInvertNearest(t),s=i.bandwidth===0?i.step:i.bandwidth??0,a=i.convert(o),r=a+s,n=a===r?0:(t-a)/(r-a);return{value:o,groupPercentage:n}}var import_ag_charts_community17=require("ag-charts-community"),{BaseProperties:BaseProperties4}=import_ag_charts_community17._ModuleSupport,StartEndProperties=class extends Annotation(Line3(Handle(BaseProperties4))){constructor(){super(...arguments),this.snapToAngle=45}getDefaultColor(t){}getDefaultOpacity(t){}},{Property:Property14}=import_ag_charts_community18._ModuleSupport,TextualStartEndProperties=class extends Localisable(Label(Font(StartEndProperties))){constructor(){super(...arguments),this.text="",this.position="top",this.alignment="left",this.placement="inside",this.placeholderText="inputTextareaPlaceholder"}getDefaultColor(t){return this.color}getDefaultOpacity(t){}getPlaceholderColor(){}getPadding(){const{padding:t=0}=this;return{top:t,right:t,bottom:t,left:t}}getText(){const t=this.text.length==0;let e=this.text;return t&&(e=this.placeholderText??"",this.localeManager&&(e=this.localeManager.t(e))),{text:e,isPlaceholder:t}}getTextInputCoords(t,e){return convertPoint(this.end,t)}getTextPosition(){return this.position}};__decorateClass([Property14],TextualStartEndProperties.prototype,"text",2);var{Property:Property15,Color}=import_ag_charts_community19._ModuleSupport,DEFAULT_CALLOUT_PADDING={top:6,right:12,bottom:9,left:12},CalloutProperties=class extends Fill(Stroke(TextualStartEndProperties)){constructor(){super(...arguments),this.type="callout",this.position="bottom",this.alignment="left"}static is(t){return(0,import_ag_charts_core12.isObject)(t)&&t.type==="callout"}getDefaultColor(t){switch(t){case"fill-color":return this.fill;case"line-color":return this.stroke;case"text-color":default:return this.color}}getDefaultOpacity(t){switch(t){case"fill-color":return this.fillOpacity;case"line-color":return this.strokeOpacity;case"text-color":default:return}}getPlaceholderColor(){const{r:t,g:e,b:i}=Color.fromString(this.color??"#888888");return new Color(t,e,i,.66).toString()}getPadding(){const{padding:t}=this;return t==null?{...DEFAULT_CALLOUT_PADDING}:{top:t,right:t,bottom:t,left:t}}getTextInputCoords(t,e){const i=super.getTextInputCoords(t,e),o=this.getPadding(),s=o.left??0,a=o.bottom??0;return{x:i.x+s,y:i.y-a}}};__decorateClass([Property15],CalloutProperties.prototype,"type",2);var import_ag_charts_community21=require("ag-charts-community"),import_ag_charts_core13=require("ag-charts-core"),import_ag_charts_community20=require("ag-charts-community"),{BaseProperties:BaseProperties5,Property:Property16}=import_ag_charts_community20._ModuleSupport,TextualPointProperties=class extends Annotation(Point(Handle(Label(Font(BaseProperties5))))){constructor(){super(...arguments),this.text="",this.position="top",this.alignment="left",this.placement="inside",this.placeholderText="inputTextareaPlaceholder"}getDefaultColor(t){return this.color}getDefaultOpacity(t){}getPlaceholderColor(){}getPadding(){const{padding:t=0}=this;return{top:t,right:t,bottom:t,left:t}}getText(){const t=this.text.length==0;return{text:t?this.placeholderText??"":this.text,isPlaceholder:t}}getTextInputCoords(t,e){return convertPoint(this,t)}getTextPosition(){return this.position}};__decorateClass([Property16],TextualPointProperties.prototype,"text",2);var{Property:Property17,Color:Color2}=import_ag_charts_community21._ModuleSupport,DEFAULT_COMMENT_PADDING={top:8,right:14,bottom:8,left:14},CommentProperties=class extends Fill(Stroke(TextualPointProperties)){constructor(){super(...arguments),this.type="comment",this.position="bottom",this.alignment="left"}static is(t){return(0,import_ag_charts_core13.isObject)(t)&&t.type==="comment"}getDefaultColor(t){switch(t){case"fill-color":return this.fill;case"line-color":return this.stroke;case"text-color":default:return this.color}}getDefaultOpacity(t){switch(t){case"fill-color":return this.fillOpacity;case"line-color":return this.strokeOpacity;case"text-color":default:return}}getPlaceholderColor(){const{r:t,g:e,b:i}=Color2.fromString(this.color??"#888888");return new Color2(t,e,i,.66).toString()}getPadding(){const{padding:t,fontSize:e}=this;return t==null?{top:Math.max(e*.4,DEFAULT_COMMENT_PADDING.top),bottom:Math.max(e*.4,DEFAULT_COMMENT_PADDING.bottom),left:Math.max(e*.8,DEFAULT_COMMENT_PADDING.left),right:Math.max(e*.8,DEFAULT_COMMENT_PADDING.right)}:{top:t,right:t,bottom:t,left:t}}getTextInputCoords(t,e){const i=super.getTextInputCoords(t,e),o=this.getPadding();return{x:i.x+o.left,y:i.y-o.bottom}}};__decorateClass([Property17],CommentProperties.prototype,"type",2);var import_ag_charts_community23=require("ag-charts-community"),import_ag_charts_core14=require("ag-charts-core"),import_ag_charts_community22=require("ag-charts-community"),{Vec2}=import_ag_charts_community22._ModuleSupport;function getLineStyle(t,e){return t?"dashed":e??"solid"}function getComputedLineDash(t,e){switch(e){case"solid":return[];case"dashed":return[t*4,t*2];case"dotted":return[0,t*2]}}function getLineDash(t,e,i,o){const s=getLineStyle(t,i);return e??t??getComputedLineDash(o??1,s)}function getLineCap(t,e,i){const o=getLineStyle(e,i);return t??o==="dotted"?"round":void 0}function boundsIntersections(t,e){const[i,o]=Vec2.from(t),s=e.height,a=Vec2.gradient(o,i,s),r=Vec2.intercept(o,a,s),n=[{x:i.x,y:s??0},{x:i.x,y:s==null?e.height:s-e.height}];if(a===1/0)return n;let l=[Vec2.intersectAtY(a,r,0,s),Vec2.intersectAtY(a,r,e.height,s),Vec2.intersectAtX(a,r,0,s),Vec2.intersectAtX(a,r,e.width,s)];return l=l.filter(c=>c.x>=e.x&&c.x<=e.width&&c.y>=e.y&&c.y<=e.height).sort((c,h)=>c.x===h.x?0:c.x{},this.text=new LineTextProperties}getDefaultColor(t){switch(t){case"fill-color":return this.background.fill;case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(t){switch(t){case"fill-color":return this.background.fillOpacity;case"line-color":return this.strokeOpacity}}getLineDash(){return getLineDash(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return getLineCap(this.lineCap,this.lineDash,this.lineStyle)}};__decorateClass([Property18],MeasurerTypeProperties.prototype,"statistics",2),__decorateClass([Property18],MeasurerTypeProperties.prototype,"text",2);function DateRange(t){class e extends t{constructor(){super(...arguments),this.hasDateRange=!0}}return e}function PriceRange(t){class e extends t{constructor(){super(...arguments),this.hasPriceRange=!0}}return e}var DateRangeProperties=class extends DateRange(MeasurerTypeProperties){constructor(){super(...arguments),this.type="date-range",this.direction="horizontal"}static is(t){return(0,import_ag_charts_core14.isObject)(t)&&t.type==="date-range"}};__decorateClass([Property18],DateRangeProperties.prototype,"type",2),__decorateClass([Property18],DateRangeProperties.prototype,"extendAbove",2),__decorateClass([Property18],DateRangeProperties.prototype,"extendBelow",2);var PriceRangeProperties=class extends PriceRange(MeasurerTypeProperties){constructor(){super(...arguments),this.type="price-range",this.direction="vertical"}static is(t){return(0,import_ag_charts_core14.isObject)(t)&&t.type==="price-range"}};__decorateClass([Property18],PriceRangeProperties.prototype,"type",2),__decorateClass([Property18],PriceRangeProperties.prototype,"extendLeft",2),__decorateClass([Property18],PriceRangeProperties.prototype,"extendRight",2);var DatePriceRangeProperties=class extends DateRange(PriceRange(MeasurerTypeProperties)){constructor(){super(...arguments),this.type="date-price-range",this.direction="both"}static is(t){return(0,import_ag_charts_core14.isObject)(t)&&t.type==="date-price-range"}};__decorateClass([Property18],DatePriceRangeProperties.prototype,"type",2);var QuickDatePriceRangeProperties=class extends DateRange(PriceRange(MeasurerTypeProperties)){constructor(){super(...arguments),this.type="quick-date-price-range",this.up=new MeasurerDirectionProperties,this.down=new MeasurerDirectionProperties,this.direction="both"}static is(t){return(0,import_ag_charts_core14.isObject)(t)&&t.type==="quick-date-price-range"}};__decorateClass([Property18],QuickDatePriceRangeProperties.prototype,"type",2),__decorateClass([Property18],QuickDatePriceRangeProperties.prototype,"up",2),__decorateClass([Property18],QuickDatePriceRangeProperties.prototype,"down",2);var import_ag_charts_community25=require("ag-charts-community"),import_ag_charts_core16=require("ag-charts-core"),import_ag_charts_community24=require("ag-charts-community"),import_ag_charts_core15=require("ag-charts-core"),{BBox:BBox2}=import_ag_charts_community24._ModuleSupport,ANNOTATION_TEXT_LINE_HEIGHT=1.38;function maybeWrapText(t,e,i){return i?(0,import_ag_charts_core15.wrapText)(e,{maxWidth:i,font:t,textWrap:"always",avoidOrphans:!1}):e}function measureAnnotationText(t,e){const{lineMetrics:i,width:o}=(0,import_ag_charts_core15.cachedTextMeasurer)(t).measureLines(e),s=i.length*(0,import_ag_charts_core15.calcLineHeight)(t.fontSize,ANNOTATION_TEXT_LINE_HEIGHT);return{width:o,height:s}}function getBBox(t,e,i,o){let s=o?.width??0,a=o?.height??0;if(!o){const r=t.width==null?e:maybeWrapText(t,e,t.width);({width:s,height:a}=measureAnnotationText(t,r))}return new BBox2(i.x,i.y,s,a)}function updateTextNode(t,e,i,o,{x:s,y:a},r){const{visible:n=!0,fontFamily:l,fontSize:c=14,fontStyle:h,fontWeight:d,textAlign:u}=o,p=(0,import_ag_charts_core15.calcLineHeight)(c,ANNOTATION_TEXT_LINE_HEIGHT);r??(r=o.position=="center"?"middle":o.position);const g=i?o.getPlaceholderColor():o.color;t.setProperties({x:s,y:a,visible:n,text:e,fill:g,fontFamily:l,fontSize:c,fontStyle:h,fontWeight:d,textAlign:u,lineHeight:p,textBaseline:r})}var{BaseProperties:BaseProperties7,Property:Property19}=import_ag_charts_community25._ModuleSupport,DEFAULT_NOTE_PADDING=10,HANDLE_SIZE=11,ICON_HEIGHT=20,ICON_WIDTH=22,ICON_SPACING=10,LABEL_OFFSET=ICON_HEIGHT+ICON_SPACING,TOOLBAR_OFFSET=34,NoteBackgroundProperties=class extends Fill(Stroke(BaseProperties7)){},NoteProperties=class extends Fill(Stroke(TextualPointProperties)){constructor(){super(...arguments),this.type="note",this.background=new NoteBackgroundProperties,this.position="bottom",this.alignment="center",this.width=200}static is(t){return(0,import_ag_charts_core16.isObject)(t)&&t.type==="note"}getDefaultColor(t){switch(t){case"line-color":return this.fill;case"text-color":return this.color}}getDefaultOpacity(t){switch(t){case"line-color":return this.fillOpacity;case"text-color":return}}getPadding(){const t=this.padding??DEFAULT_NOTE_PADDING;return{top:t,right:t,bottom:t,left:t}}getTextInputCoords(t,e){const{width:i,text:o}=this,s=super.getTextInputCoords(t,e),a=this.getPadding().top,r=getBBox(this,o,s);r.x=(0,import_ag_charts_core16.clamp)(i/2,r.x,t.seriesRect.width-i/2);const n=r.y-LABEL_OFFSET-a*2,l=r.y+HANDLE_SIZE+a*2,c=Math.max(r.height,e);return n-c-TOOLBAR_OFFSET<0?(r.y=l,this.position="top"):(r.y=n+a,this.position="bottom"),{x:r.x,y:r.y}}isHoverable(){return!0}};__decorateClass([Property19],NoteProperties.prototype,"type",2),__decorateClass([Property19],NoteProperties.prototype,"background",2);var import_ag_charts_community26=require("ag-charts-community"),{BaseProperties:BaseProperties8}=import_ag_charts_community26._ModuleSupport,PointProperties2=class extends Annotation(Point(Handle(BaseProperties8))){getDefaultColor(t){}getDefaultOpacity(t){}},ShapePointProperties=class bt extends Fill(PointProperties2){constructor(){super(...arguments),this.size=32}static is(e){return e instanceof bt}getDefaultColor(e){return e==="fill-color"?this.fill:void 0}getDefaultOpacity(e){return e==="fill-color"?this.fillOpacity:void 0}},import_ag_charts_community27=require("ag-charts-community"),import_ag_charts_core17=require("ag-charts-core"),{BaseProperties:BaseProperties9,Property:Property20}=import_ag_charts_community27._ModuleSupport,HorizontalLineProperties=class extends Annotation(Value(Handle(AxisLabel(Stroke(LineStyle(BaseProperties9)))))){constructor(){super(...arguments),this.direction="horizontal",this.type="horizontal-line",this.text=new LineTextProperties}static is(t){return(0,import_ag_charts_core17.isObject)(t)&&t.type==="horizontal-line"}getDefaultColor(){return this.stroke}getDefaultOpacity(){return this.strokeOpacity}getLineDash(){return getLineDash(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return getLineCap(this.lineCap,this.lineDash,this.lineStyle)}};__decorateClass([Property20],HorizontalLineProperties.prototype,"type",2),__decorateClass([Property20],HorizontalLineProperties.prototype,"text",2);var VerticalLineProperties=class extends Annotation(Value(Handle(AxisLabel(Stroke(LineStyle(BaseProperties9)))))){constructor(){super(...arguments),this.direction="vertical",this.type="vertical-line",this.text=new LineTextProperties}static is(t){return(0,import_ag_charts_core17.isObject)(t)&&t.type==="vertical-line"}getDefaultColor(){return this.stroke}getDefaultOpacity(){return this.strokeOpacity}getLineDash(){return getLineDash(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return getLineCap(this.lineCap,this.lineDash,this.lineStyle)}};__decorateClass([Property20],VerticalLineProperties.prototype,"type",2),__decorateClass([Property20],VerticalLineProperties.prototype,"text",2);var import_ag_charts_community28=require("ag-charts-community"),import_ag_charts_core18=require("ag-charts-core"),{BaseProperties:BaseProperties10,Property:Property21}=import_ag_charts_community28._ModuleSupport,DisjointChannelProperties=class extends Annotation(Background(Line3(Handle(Extendable(Stroke(LineStyle(BaseProperties10))))))){constructor(){super(...arguments),this.type="disjoint-channel",this.text=new ChannelTextProperties,this.snapToAngle=45}static is(t){return(0,import_ag_charts_core18.isObject)(t)&&t.type==="disjoint-channel"}get bottom(){const t={start:{x:this.start.x,y:this.start.y},end:{x:this.end.x,y:this.end.y}};return typeof t.start.y=="number"&&typeof t.end.y=="number"?(t.start.y-=this.startHeight,t.end.y-=this.endHeight):import_ag_charts_core18.Logger.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`),t}getDefaultColor(t){switch(t){case"fill-color":return this.background.fill;case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(t){switch(t){case"fill-color":return this.background.fillOpacity;case"line-color":return this.strokeOpacity}}getLineDash(){return getLineDash(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return getLineCap(this.lineCap,this.lineDash,this.lineStyle)}};__decorateClass([Property21],DisjointChannelProperties.prototype,"type",2),__decorateClass([Property21],DisjointChannelProperties.prototype,"startHeight",2),__decorateClass([Property21],DisjointChannelProperties.prototype,"endHeight",2),__decorateClass([Property21],DisjointChannelProperties.prototype,"text",2);var import_ag_charts_community31=require("ag-charts-community"),import_ag_charts_core20=require("ag-charts-core"),import_ag_charts_community30=require("ag-charts-community"),import_ag_charts_community29=require("ag-charts-community"),import_ag_charts_core19=require("ag-charts-core"),{Property:Property22}=import_ag_charts_community29._ModuleSupport,LineTypeProperties=class extends Localisable(Cappable(Extendable(Stroke(LineStyle(StartEndProperties))))){constructor(){super(...arguments),this.text=new LineTextProperties}getDefaultColor(t){switch(t){case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(){return this.strokeOpacity}getLineDash(){return getLineDash(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return getLineCap(this.lineCap,this.lineDash,this.lineStyle)}};__decorateClass([Property22],LineTypeProperties.prototype,"text",2);var ArrowProperties=class extends LineTypeProperties{constructor(){super(...arguments),this.type="arrow",this.endCap="arrow"}static is(t){return(0,import_ag_charts_core19.isObject)(t)&&t.type==="arrow"}};__decorateClass([Property22],ArrowProperties.prototype,"type",2);var LineProperties=class extends LineTypeProperties{constructor(){super(...arguments),this.type="line"}static is(t){return(0,import_ag_charts_core19.isObject)(t)&&t.type==="line"}};__decorateClass([Property22],LineProperties.prototype,"type",2);var{Property:Property23}=import_ag_charts_community30._ModuleSupport,FibonacciProperties=class extends LineTypeProperties{constructor(){super(...arguments),this.label=new LabelTextProperties,this.reverse=!1,this.showFill=!0,this.isMultiColor=!0,this.strokes=[],this.bands=10}getDefaultColor(t){switch(t){case"line-color":return this.rangeStroke??this.stroke;case"text-color":return this.text.color}}};__decorateClass([Property23],FibonacciProperties.prototype,"label",2),__decorateClass([Property23],FibonacciProperties.prototype,"reverse",2),__decorateClass([Property23],FibonacciProperties.prototype,"showFill",2),__decorateClass([Property23],FibonacciProperties.prototype,"isMultiColor",2),__decorateClass([Property23],FibonacciProperties.prototype,"strokes",2),__decorateClass([Property23],FibonacciProperties.prototype,"rangeStroke",2),__decorateClass([Property23],FibonacciProperties.prototype,"bands",2);var{Property:Property24}=import_ag_charts_community31._ModuleSupport,FibonacciRetracementTrendBasedProperties=class extends FibonacciProperties{constructor(){super(...arguments),this.type="fibonacci-retracement-trend-based",this.endRetracement=new PointProperties}static is(t){return(0,import_ag_charts_core20.isObject)(t)&&t.type==="fibonacci-retracement-trend-based"}};__decorateClass([Property24],FibonacciRetracementTrendBasedProperties.prototype,"type",2),__decorateClass([Property24],FibonacciRetracementTrendBasedProperties.prototype,"endRetracement",2);var import_ag_charts_community32=require("ag-charts-community"),import_ag_charts_core21=require("ag-charts-core"),{Property:Property25}=import_ag_charts_community32._ModuleSupport,FibonacciRetracementProperties=class extends FibonacciProperties{constructor(){super(...arguments),this.type="fibonacci-retracement"}static is(t){return(0,import_ag_charts_core21.isObject)(t)&&t.type==="fibonacci-retracement"}};__decorateClass([Property25],FibonacciRetracementProperties.prototype,"type",2);var import_ag_charts_community33=require("ag-charts-community"),import_ag_charts_core22=require("ag-charts-core"),{BaseProperties:BaseProperties11,Property:Property26}=import_ag_charts_community33._ModuleSupport,ParallelChannelProperties=class extends Annotation(Background(Line3(Handle(Extendable(Stroke(LineStyle(BaseProperties11))))))){constructor(){super(...arguments),this.type="parallel-channel",this.middle=new ChannelAnnotationMiddleProperties,this.text=new ChannelTextProperties,this.snapToAngle=45}static is(t){return(0,import_ag_charts_core22.isObject)(t)&&t.type==="parallel-channel"}get bottom(){const t={start:{x:this.start.x,y:this.start.y},end:{x:this.end.x,y:this.end.y}};return typeof t.start.y=="number"&&typeof t.end.y=="number"?(t.start.y-=this.height,t.end.y-=this.height):import_ag_charts_core22.Logger.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`),t}getDefaultColor(t){switch(t){case"fill-color":return this.background.fill;case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(t){switch(t){case"fill-color":return this.background.fillOpacity;case"line-color":return this.strokeOpacity}}getLineDash(){return getLineDash(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return getLineCap(this.lineCap,this.lineDash,this.lineStyle)}};__decorateClass([Property26],ParallelChannelProperties.prototype,"type",2),__decorateClass([Property26],ParallelChannelProperties.prototype,"height",2),__decorateClass([Property26],ParallelChannelProperties.prototype,"middle",2),__decorateClass([Property26],ParallelChannelProperties.prototype,"text",2);var import_ag_charts_community34=require("ag-charts-community"),import_ag_charts_core23=require("ag-charts-core"),{Property:Property27}=import_ag_charts_community34._ModuleSupport,TextProperties=class extends TextualPointProperties{constructor(){super(...arguments),this.type="text",this.position="bottom"}static is(t){return(0,import_ag_charts_core23.isObject)(t)&&t.type==="text"}};__decorateClass([Property27],TextProperties.prototype,"type",2);function isEphemeralType(t){return QuickDatePriceRangeProperties.is(t)}function isLineType(t){return LineProperties.is(t)||HorizontalLineProperties.is(t)||VerticalLineProperties.is(t)||ArrowProperties.is(t)||isFibonacciType(t)}function isChannelType(t){return DisjointChannelProperties.is(t)||ParallelChannelProperties.is(t)}function isFibonacciType(t){return FibonacciRetracementProperties.is(t)||FibonacciRetracementTrendBasedProperties.is(t)}function isTextType(t){return CalloutProperties.is(t)||CommentProperties.is(t)||NoteProperties.is(t)||TextProperties.is(t)}function isMeasurerType(t){return DateRangeProperties.is(t)||PriceRangeProperties.is(t)||DatePriceRangeProperties.is(t)||QuickDatePriceRangeProperties.is(t)}function hasFontSize(t){return isTextType(t)&&!NoteProperties.is(t)}function hasLineStyle(t){return isLineType(t)||isChannelType(t)||isMeasurerType(t)&&!QuickDatePriceRangeProperties.is(t)}function hasLineColor(t){return isLineType(t)||isChannelType(t)||isMeasurerType(t)||CalloutProperties.is(t)||NoteProperties.is(t)}function hasIconColor(t){return NoteProperties.is(t)}function hasFillColor(t){return isChannelType(t)||isMeasurerType(t)||CalloutProperties.is(t)||CommentProperties.is(t)||ShapePointProperties.is(t)}function hasTextColor(t){return isTextType(t)&&!NoteProperties.is(t)}function hasLineText(t){return(isLineType(t)||isChannelType(t)||isMeasurerType(t))&&!isEphemeralType(t)&&(0,import_ag_charts_core24.isObject)(t.text)}function setFontSize(t,e){"fontSize"in t&&(t.fontSize=e),hasLineText(t)&&(t.text.fontSize=e)}function setLineStyle(t,e){const i=e?.strokeWidth??t.strokeWidth??1,o=e?.type??t.lineStyle,s=o??getLineStyle(t.lineDash,o),a=getComputedLineDash(i,s);t.strokeWidth=i,t.computedLineDash=a,t.lineStyle=s,t.lineCap=s==="dotted"?"round":void 0}function setColor(t,e,i,o,s,a){switch(e){case"fill-color":{"fill"in t&&(t.fill=o),"fillOpacity"in t&&(t.fillOpacity=s),"background"in t&&(t.background.fill=o,t.background.fillOpacity=s);break}case"line-color":{"axisLabel"in t&&(t.axisLabel.fill=o,t.axisLabel.fillOpacity=s,t.axisLabel.stroke=o,t.axisLabel.strokeOpacity=s),"fill"in t&&"fillOpacity"in t&&hasIconColor(t)?(t.fill=o,t.fillOpacity=s):("strokeOpacity"in t&&(t.strokeOpacity=s),"isMultiColor"in t&&"rangeStroke"in t?(t.isMultiColor=a,t.rangeStroke=o):"stroke"in t&&(t.stroke=o));break}case"text-color":{"color"in t&&(t.color=i),hasLineText(t)&&(t.text.color=o);break}}}var{deepClone}=import_ag_charts_community35._ModuleSupport,AnnotationDefaults=class{constructor(){this.mementoOriginatorKey="annotation-defaults",this.colors=new Map(Object.values(AnnotationType).map(t=>[t,new Map([["line-color",void 0],["fill-color",void 0],["text-color",void 0]])])),this.fontSizes=new Map([["callout",void 0],["comment",void 0],["text",void 0],["arrow",void 0],["line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.lineStyles=new Map([["line",void 0],["horizontal-line",void 0],["vertical-line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["arrow",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.lineTextAlignments=new Map([["line",void 0],["horizontal-line",void 0],["vertical-line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["arrow",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.lineTextPositions=new Map([["line",void 0],["horizontal-line",void 0],["vertical-line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["arrow",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.fibonacciOptions=new Map([["fibonacci-retracement",{bands:void 0,reverse:void 0,showFill:void 0}],["fibonacci-retracement-trend-based",{bands:void 0,reverse:void 0,showFill:void 0}]])}createMemento(){return{colors:deepClone(this.colors),fontSizes:deepClone(this.fontSizes),lineStyles:deepClone(this.lineStyles),lineTextAlignments:deepClone(this.lineTextAlignments),lineTextPositions:deepClone(this.lineTextPositions),fibonacciOptions:deepClone(this.fibonacciOptions)}}guardMemento(t){return!0}restoreMemento(t,e,i){this.colors=deepClone(i.colors),this.fontSizes=deepClone(i.fontSizes),this.lineStyles=deepClone(i.lineStyles),this.lineTextAlignments=deepClone(i.lineTextAlignments),this.lineTextPositions=deepClone(i.lineTextPositions),this.fibonacciOptions=deepClone(i.fibonacciOptions)}setDefaultColor(t,e,i,o,s,a){this.colors.get(t)?.set(e,[i,o,s,a])}setDefaultFontSize(t,e){this.fontSizes.set(t,e)}setDefaultLineStyleType(t,e){const i=this.lineStyles.get(t);i?i.type=e:this.lineStyles.set(t,{type:e})}setDefaultLineStyleWidth(t,e){const i=this.lineStyles.get(t);i?i.strokeWidth=e:this.lineStyles.set(t,{strokeWidth:e})}setDefaultLineTextAlignment(t,e){this.lineTextAlignments.set(t,e)}setDefaultLineTextPosition(t,e){this.lineTextPositions.set(t,e)}setDefaultFibonacciOptions(t,e,i){if(t!="fibonacci-retracement"&&t!="fibonacci-retracement-trend-based")return;const o=this.fibonacciOptions.get(t);o[e]=i,this.fibonacciOptions.set(t,o)}applyDefaults(t){for(const[e,i]of this.colors)if(t.type===e)for(const[o,[s,a,r,n]=[]]of i)s&&a&&r!=null&&n!=null&&setColor(t,o,s,a,r,n);for(const[e,i]of this.fontSizes)t.type!==e||i==null||setFontSize(t,i);for(const[e,i]of this.lineStyles)t.type!==e||i==null||setLineStyle(t,i);for(const[e,i]of this.lineTextPositions)t.type!==e||i==null||(t.text.position=i);for(const[e,i]of this.lineTextAlignments)t.type!==e||i==null||(t.text.alignment=i);for(const[e,i]of this.fibonacciOptions)if(!(t.type!==e||i==null))for(const o of Object.keys(i)){const s=i[o];s!=null&&t.set({[o]:s})}}},import_ag_charts_community38=require("ag-charts-community"),import_ag_charts_core26=require("ag-charts-core"),import_ag_charts_community36=require("ag-charts-community"),import_ag_charts_core25=require("ag-charts-core"),colorPickerTemplate_default='
',{Color:Color3}=import_ag_charts_community36._ModuleSupport,getHsva=t=>{try{const e=Color3.fromString(t),[i,o,s]=e.toHSB();return[i,o,s,e.a]}catch{return}},ColorPicker=class extends import_ag_charts_community36._ModuleSupport.AnchoredPopover{constructor(t,e){super(t,"color-picker",e),this.hasChanged=!1,this.hideFns.push(()=>{this.i18nUpdater=void 0,this.hasChanged&&this.onChangeHide?.()}),this.cleanup.register(this.ctx.eventsHub.on("locale:change",()=>this.i18nUpdater?.()))}show(t){this.hasChanged=!1,this.onChangeHide=t.onChangeHide;const{element:e,initialFocus:i}=this.createColorPicker(t),o=this.showWithChildren([e],{initialFocus:i,...t});o.classList.add("ag-charts-color-picker"),o.setAttribute("role","dialog")}createColorPicker(t){const{localeManager:e}=this.ctx;let i=t.isMultiColor??!1,[o,s,a,r]=getHsva(t.color??"#f00")??[0,1,.5,1];r=t.opacity??r;const n=(0,import_ag_charts_core25.createElement)("div","ag-charts-color-picker__content");n.innerHTML=colorPickerTemplate_default,n.ariaLabel=this.ctx.localeManager.t("ariaLabelColorPicker");const l=n.querySelector(".ag-charts-color-picker__palette"),c=n.querySelector(".ag-charts-color-picker__hue-input"),h=n.querySelector(".ag-charts-color-picker__multi-color-button"),d=n.querySelector(".ag-charts-color-picker__alpha-input"),u=n.querySelector(".ag-charts-color-picker__color-input"),p=n.querySelector(".ag-charts-color-picker__color-label"),g=m=>{const S={s:"ariaValueColorPalette",v:"ariaValueColorPaletteFirstV"}[m];l.ariaValueText=e.t(S,{s,v:a})};this.i18nUpdater=()=>{l.ariaRoleDescription=e.t("ariaRoleDescription2DSlider"),l.ariaLabel=e.t("ariaLabelColorPickerPalette"),c.ariaLabel=e.t("ariaLabelColorPickerHue"),h.ariaLabel=e.t("ariaLabelColorPickerMultiColor"),d.ariaLabel=e.t("ariaLabelColorPickerAlpha"),u.ariaLabel=e.t("ariaLabelColor"),g("s")},this.i18nUpdater(),h.classList.toggle("ag-charts-color-picker__multi-color-button--hidden",!t.hasMultiColorOption);const y=(m=!0)=>{const v=Color3.fromHSB(o,s,a,r).toHexString();if(n.style.setProperty("--h",`${o}`),n.style.setProperty("--s",`${s}`),n.style.setProperty("--v",`${a}`),n.style.setProperty("--a",`${r}`),n.style.setProperty("--color",v.slice(0,7)),n.style.setProperty("--color-a",v),c.value=`${o}`,d.value=`${r}`,d.classList.toggle("ag-charts-color-picker__alpha-input--opaque",r===1),h.classList.toggle("ag-charts-color-picker__multi-color-button--active",i),p.classList.toggle("ag-charts-color-picker__color-label--multi-color",i),document.activeElement!==u&&(h.ariaChecked=i.toString(),u.value=i?e.t("ariaLabelColorPickerMultiColor"):v.toUpperCase()),m||t.color==null){const M=Color3.fromHSB(o,s,a,1).toHexString();t.onChange?.(v,M,r,i)}m&&(this.hasChanged=!0)};y(!1);const f=m=>m.preventDefault(),x=m=>m.stopPropagation(),b=m=>{m.preventDefault();const S=m.currentTarget;S.focus();const v=S.getBoundingClientRect(),M=({clientX:k,clientY:_})=>{i=!1,s=Math.min(Math.max((k-v.left)/v.width,0),1),a=1-Math.min(Math.max((_-v.top)/v.height,0),1),y(),g("s")};M(m);const D=(0,import_ag_charts_core25.attachListener)((0,import_ag_charts_core25.getWindow)(),"pointermove",M);(0,import_ag_charts_core25.getWindow)().addEventListener("pointerup",D,{once:!0})};return n.addEventListener("mousedown",x),n.addEventListener("touchstart",x),n.addEventListener("touchmove",x),n.addEventListener("keydown",m=>{switch(m.stopPropagation(),m.key){case"Enter":case"Escape":this.hide();break;default:return}m.preventDefault()}),l.addEventListener("pointerdown",b),l.addEventListener("touchstart",f,{passive:!1}),l.addEventListener("touchmove",f,{passive:!1}),l.addEventListener("keydown",m=>{if(m.key==="ArrowLeft")s=(0,import_ag_charts_core25.clamp)(0,s-.01,1),g("s");else if(m.key==="ArrowRight")s=(0,import_ag_charts_core25.clamp)(0,s+.01,1),g("s");else if(m.key==="ArrowUp")a=(0,import_ag_charts_core25.clamp)(0,a+.01,1),g("v");else if(m.key==="ArrowDown")a=(0,import_ag_charts_core25.clamp)(0,a-.01,1),g("v");else return;m.preventDefault(),y()}),l.addEventListener("focus",()=>{g("s")}),h.addEventListener("click",()=>{i=!i,y()}),c.addEventListener("input",m=>{i=!1,o=m.currentTarget.valueAsNumber??0,y()}),d.addEventListener("input",m=>{i=!1,r=m.currentTarget.valueAsNumber??0,y()}),u.addEventListener("input",m=>{i=!1;const S=getHsva(m.currentTarget.value);S!=null&&([o,s,a,r]=S,y())}),u.addEventListener("blur",()=>y()),u.addEventListener("keydown",m=>{m.key==="Enter"&&(m.currentTarget.blur(),y())}),{element:n,initialFocus:l}}},import_ag_charts_community37=require("ag-charts-community");function channelMenuItemVisible(t){return!(t instanceof import_ag_charts_community37._ModuleSupport.LogScale)&&!(t instanceof import_ag_charts_community37._ModuleSupport.BandScale)}var LINE_ANNOTATION_ITEMS=[{label:"toolbarAnnotationsTrendLine",icon:"trend-line-drawing",value:"line"},{label:"toolbarAnnotationsHorizontalLine",icon:"horizontal-line-drawing",value:"horizontal-line"},{label:"toolbarAnnotationsVerticalLine",icon:"vertical-line-drawing",value:"vertical-line"},{label:"toolbarAnnotationsParallelChannel",icon:"parallel-channel-drawing",value:"parallel-channel",visible:channelMenuItemVisible},{label:"toolbarAnnotationsDisjointChannel",icon:"disjoint-channel-drawing",value:"disjoint-channel",visible:channelMenuItemVisible}],FIBONACCI_ANNOTATION_ITEMS=[{label:"toolbarAnnotationsFibonacciRetracement",icon:"fibonacci-retracement-drawing",value:"fibonacci-retracement"},{label:"toolbarAnnotationsFibonacciRetracementTrendBased",icon:"fibonacci-retracement-trend-based-drawing",value:"fibonacci-retracement-trend-based"}],FIBONACCI_RATIO_ITEMS=[{label:"Fibonacci - Extended",value:10},{label:"Fibonacci - 6 Band",value:6},{label:"Fibonacci - 4 Band",value:4}],TEXT_ANNOTATION_ITEMS=[{label:"toolbarAnnotationsText",icon:"text-annotation",value:"text"},{label:"toolbarAnnotationsComment",icon:"comment-annotation",value:"comment"},{label:"toolbarAnnotationsCallout",icon:"callout-annotation",value:"callout"},{label:"toolbarAnnotationsNote",icon:"note-annotation",value:"note"}],SHAPE_ANNOTATION_ITEMS=[{label:"toolbarAnnotationsArrow",icon:"arrow-drawing",value:"arrow"},{label:"toolbarAnnotationsArrowUp",icon:"arrow-up-drawing",value:"arrow-up"},{label:"toolbarAnnotationsArrowDown",icon:"arrow-down-drawing",value:"arrow-down"}],MEASURER_ANNOTATION_ITEMS=[{label:"toolbarAnnotationsQuickDatePriceRange",icon:"measurer-drawing",value:"quick-date-price-range"},{label:"toolbarAnnotationsDateRange",icon:"date-range-drawing",value:"date-range"},{label:"toolbarAnnotationsPriceRange",icon:"price-range-drawing",value:"price-range"},{label:"toolbarAnnotationsDatePriceRange",icon:"date-price-range-drawing",value:"date-price-range"}],LINE_STROKE_WIDTH_ITEMS=[{strokeWidth:1,label:"1",value:1},{strokeWidth:2,label:"2",value:2},{strokeWidth:3,label:"3",value:3},{strokeWidth:4,label:"4",value:4},{strokeWidth:8,label:"8",value:8}],LINE_STYLE_TYPE_ITEMS=[{icon:"line-style-solid",altText:"iconAltTextLineStyleSolid",value:"solid"},{icon:"line-style-dashed",altText:"iconAltTextLineStyleDashed",value:"dashed"},{icon:"line-style-dotted",altText:"iconAltTextLineStyleDotted",value:"dotted"}],TEXT_SIZE_ITEMS=[{label:"10",value:10},{label:"12",value:12},{label:"14",value:14},{label:"16",value:16},{label:"18",value:18},{label:"22",value:22},{label:"28",value:28},{label:"36",value:36},{label:"46",value:46}],{Color:Color4,FloatingToolbar,Menu,PropertiesArray,ToolbarButtonProperties,ToolbarButtonWidget,Property:Property28}=import_ag_charts_community38._ModuleSupport,AnnotationOptionsButtonProperties=class extends ToolbarButtonProperties{constructor(){super(...arguments),this.checkedOverrides=new ToolbarButtonProperties}};__decorateClass([Property28],AnnotationOptionsButtonProperties.prototype,"value",2),__decorateClass([Property28],AnnotationOptionsButtonProperties.prototype,"checkedOverrides",2),__decorateClass([Property28],AnnotationOptionsButtonProperties.prototype,"color",2),__decorateClass([Property28],AnnotationOptionsButtonProperties.prototype,"strokeWidth",2),__decorateClass([Property28],AnnotationOptionsButtonProperties.prototype,"isMultiColor",2);var AnnotationOptionsButtonWidget=class extends ToolbarButtonWidget{update(t){super.update(t),t.value==="line-stroke-width"&&this.updateLineStrokeWidth(t),(t.value==="fill-color"||t.value==="line-color"||t.value==="text-color")&&this.updateFillColor(t)}updateFillColor(t){const e=this.getElement();e.classList.add("ag-charts-annotations__color-picker-button"),e.classList.toggle("ag-charts-annotations__color-picker-button--multi-color",t.isMultiColor),e.style.setProperty("--color",t.color??null)}updateLineStrokeWidth(t){const e=this.getElement();e.classList.add("ag-charts-annotations__stroke-width-button"),e.style.setProperty("--stroke-width",`${t.strokeWidth}px`)}},FloatingAnnotationOptionsToolbar=class extends FloatingToolbar{createButtonWidget(){return new AnnotationOptionsButtonWidget(this.localeManager)}},AnnotationOptionsToolbar=class extends import_ag_charts_community38._ModuleSupport.BaseProperties{constructor(t,e){super(),this.ctx=t,this.getActiveDatum=e,this.enabled=!0,this.buttons=new PropertiesArray(AnnotationOptionsButtonProperties),this.cleanup=new import_ag_charts_core26.CleanupRegistry,this.events=new import_ag_charts_core26.EventEmitter,this.visibleButtons=[],this.toolbar=new FloatingAnnotationOptionsToolbar(this.ctx,"ariaLabelAnnotationOptionsToolbar","annotation-options"),this.colorPicker=new ColorPicker(this.ctx),this.textSizeMenu=new Menu(this.ctx,"text-size"),this.lineStyleTypeMenu=new Menu(this.ctx,"annotations-line-style-type"),this.lineStrokeWidthMenu=new Menu(this.ctx,"annotations-line-stroke-width"),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onButtonPress.bind(this)),this.toolbar.addToolbarListener("toolbar-moved",this.onToolbarMoved.bind(this)),t.widgets.seriesWidget.addListener("drag-start",this.onDragStart.bind(this)),t.widgets.seriesWidget.addListener("drag-end",this.onDragEnd.bind(this)),()=>{this.colorPicker.destroy(),this.toolbar.destroy()})}onDragStart(){this.toolbar.ignorePointerEvents()}onDragEnd(){this.toolbar.capturePointerEvents()}destroy(){this.cleanup.flush()}show(){this.enabled&&this.toolbar.show()}hide(){this.toolbar.hide()}updateButtons(t){if(!this.enabled)return;const e={"line-style-type":hasLineStyle(t),"line-stroke-width":hasLineStyle(t),"line-color":hasLineColor(t),"text-color":hasTextColor(t),"fill-color":hasFillColor(t),"text-size":hasFontSize(t),settings:hasLineText(t),lock:!0,delete:!0};this.visibleButtons=this.buttons.filter(i=>e[i.value]),this.toolbar.clearButtons(),this.toolbar.updateButtons(this.visibleButtons),this.refreshButtons(t)}setAnchorScene(t){this.toolbar.hasBeenDragged()||this.toolbar.setAnchor(t.getAnchor())}hideOverlays(){this.toolbar.clearActiveButton(),this.colorPicker.hide({lastFocus:null}),this.textSizeMenu.hide(),this.lineStyleTypeMenu.hide(),this.lineStrokeWidthMenu.hide(),this.events.emit("hid-overlays",null)}clearActiveButton(){this.toolbar.clearActiveButton()}updateColors(t){this.updateColorPickerColor("line-color",t.getDefaultColor("line-color"),t.getDefaultOpacity("line-color"),"isMultiColor"in t&&t?.isMultiColor),this.updateColorPickerColor("fill-color",t.getDefaultColor("fill-color"),t.getDefaultOpacity("fill-color"),"isMultiColor"in t&&t?.isMultiColor),this.updateColorPickerColor("text-color",t.getDefaultColor("text-color"),t.getDefaultOpacity("text-color"),"isMultiColor"in t&&t?.isMultiColor)}updateColorPickerColor(t,e,i,o){if(e!=null&&i!=null){const{r:s,g:a,b:r}=Color4.fromString(e);e=Color4.fromArray([s,a,r,i]).toHexString()}this.updateButtonByValue(t,{color:e,isMultiColor:o})}updateFontSize(t){this.updateButtonByValue("text-size",{label:t==null?void 0:String(t)})}updateLineStyleType(t){this.updateButtonByValue("line-style-type",{icon:t.icon})}updateStrokeWidth(t){this.updateButtonByValue("line-stroke-width",{label:t.label,strokeWidth:t.value})}onButtonPress({event:t,button:e,buttonWidget:i}){const o=this.getActiveDatum();if(o)switch(this.hideOverlays(),e.value){case"line-style-type":{const s=hasLineStyle(o)?getLineStyle(o.lineDash,o.lineStyle):void 0;this.lineStyleTypeMenu.show(i,{items:LINE_STYLE_TYPE_ITEMS,ariaLabel:this.ctx.localeManager.t("toolbarAnnotationsLineStyle"),value:s,onPress:a=>this.onLineStyleTypeMenuPress(a,o),class:"ag-charts-annotations__line-style-type-menu"});break}case"line-stroke-width":{const s=hasLineStyle(o)?o.strokeWidth:void 0;this.lineStrokeWidthMenu.show(i,{items:LINE_STROKE_WIDTH_ITEMS,ariaLabel:this.ctx.localeManager.t("toolbarAnnotationsLineStrokeWidth"),value:s,onPress:a=>this.onLineStrokeWidthMenuPress(a,o),class:"ag-charts-annotations__line-stroke-width-menu"});break}case"line-color":case"fill-color":case"text-color":{this.toolbar.toggleActiveButtonByIndex(e.index),this.colorPicker.show({color:o?.getDefaultColor(e.value),opacity:o?.getDefaultOpacity(e.value),sourceEvent:t.sourceEvent,hasMultiColorOption:"isMultiColor"in o,isMultiColor:"isMultiColor"in o&&o?.isMultiColor,onChange:o==null?void 0:this.onColorPickerChange.bind(this,e.value,o),onChangeHide:(s=>{this.events.emit("saved-color",{type:o.type,colorPickerType:e.value,color:o.getDefaultColor(s)})}).bind(this,e.value)});break}case"text-size":{const s=isTextType(o)?o.fontSize:void 0;this.textSizeMenu.show(i,{items:TEXT_SIZE_ITEMS,ariaLabel:this.ctx.localeManager.t("toolbarAnnotationsTextSize"),value:s,onPress:a=>this.onTextSizeMenuPress(a,o),class:"ag-charts-annotations__text-size-menu"});break}case"delete":{this.events.emit("pressed-delete",null);break}case"lock":{o.locked=!o.locked,this.refreshButtons(o),this.events.emit("pressed-lock",{locked:o.locked});break}case"settings":{this.toolbar.toggleActiveButtonByIndex(e.index),this.events.emit("pressed-settings",t);break}}}onToolbarMoved(t){const{buttonBounds:e,popoverBounds:i}=t,o={x:i.x,y:i.y+i.height+4},s={y:i.y-4};this.colorPicker.setAnchor(o,s);for(const[a,r]of e.entries()){const n=this.visibleButtons.at(a);if(!n)continue;const l={x:r.x,y:r.y+r.height-1},c={y:r.y};switch(n.value){case"line-stroke-width":this.lineStrokeWidthMenu.setAnchor(l,c);break;case"line-style-type":this.lineStyleTypeMenu.setAnchor(l,c);break;case"text-size":this.textSizeMenu.setAnchor(l,c);break}}}onColorPickerChange(t,e,i,o,s,a){this.events.emit("updated-color",{type:e.type,colorPickerType:t,colorOpacity:i,color:o,opacity:s,isMultiColor:a}),this.updateColorPickerColor(t,i,s,a)}onTextSizeMenuPress(t,e){if(!hasFontSize(e))return;const i=t.value;this.events.emit("updated-font-size",{type:e.type,fontSize:i}),this.textSizeMenu.hide(),this.updateFontSize(i)}onLineStyleTypeMenuPress(t,e){if(!hasLineStyle(e))return;const i=t.value;this.events.emit("updated-line-style",{type:e.type,lineStyleType:i}),this.lineStyleTypeMenu.hide(),this.updateLineStyleType(t)}onLineStrokeWidthMenuPress(t,e){if(!hasLineStyle(e))return;const i=t.value;this.events.emit("updated-line-width",{type:e.type,strokeWidth:i}),this.lineStrokeWidthMenu.hide(),this.updateStrokeWidth(t)}refreshButtons(t){const e=t.locked??!1;for(const[i,o]of this.visibleButtons.entries())o&&(o.value==="lock"?(this.toolbar.toggleSwitchCheckedByIndex(i,e),this.updateButtonByIndex(i,e?o.checkedOverrides.toJson():o.toJson())):this.toolbar.toggleButtonEnabledByIndex(i,!e));hasFontSize(t)&&this.updateFontSize(t.fontSize),this.updateColors(t),this.updateLineStyles(t)}updateLineStyles(t){if(!hasLineStyle(t))return;const e=t.strokeWidth??1,i=getLineStyle(t.lineDash,t.lineStyle);this.updateStrokeWidth({strokeWidth:e,value:e,label:String(e)}),this.updateLineStyleType(LINE_STYLE_TYPE_ITEMS.find(o=>o.value===i)??LINE_STYLE_TYPE_ITEMS[0])}updateButtonByValue(t,e){const i=this.visibleButtons.findIndex(o=>o.value===t);i!==-1&&this.updateButtonByIndex(i,e)}updateButtonByIndex(t,e){const i=this.visibleButtons.at(t);i&&this.toolbar.updateButtonByIndex(t,{...i.toJson(),...e,value:e.value??i.value})}};__decorateClass([Property28],AnnotationOptionsToolbar.prototype,"enabled",2),__decorateClass([Property28],AnnotationOptionsToolbar.prototype,"buttons",2);var import_ag_charts_community39=require("ag-charts-community"),{StateMachine,StateMachineProperty,Vec2:Vec22,Debug}=import_ag_charts_community39._ModuleSupport,DragStateMachine=class extends StateMachine{constructor(t){const e=({context:i})=>{this.node?.drag(this.datum,this.offset,i,this.snapping),t.update()};super("idle",{idle:{dragStart:{target:"dragging",action:({offset:i,context:o})=>{this.hasMoved=!1,this.dragStart=i,this.offset=i,this.node?.dragStart(this.datum,i,o)}}},dragging:{keyDown:e,keyUp:e,drag:({offset:i,context:o})=>{this.hasMoved=Vec22.lengthSquared(Vec22.sub(i,this.dragStart))>0,this.offset=i,this.node?.drag(this.datum,i,o,this.snapping),t.update()},dragEnd:{target:StateMachine.parent,action:()=>{this.node?.stopDragging(),this.hasMoved&&t.recordAction("Move annotation"),t.update()}}}}),this.debug=Debug.create(!0,"annotations"),this.hasMoved=!1,this.snapping=!1}};__decorateClass([StateMachineProperty()],DragStateMachine.prototype,"snapping",2),__decorateClass([StateMachineProperty()],DragStateMachine.prototype,"datum",2),__decorateClass([StateMachineProperty()],DragStateMachine.prototype,"node",2);var import_ag_charts_community40=require("ag-charts-community"),import_ag_charts_core27=require("ag-charts-core"),{Property:Property29}=import_ag_charts_community40._ModuleSupport,ArrowDownProperties=class extends ShapePointProperties{constructor(){super(...arguments),this.type="arrow-down"}static is(t){return(0,import_ag_charts_core27.isObject)(t)&&t.type==="arrow-down"}};__decorateClass([Property29],ArrowDownProperties.prototype,"type",2);var import_ag_charts_community47=require("ag-charts-community"),import_ag_charts_community46=require("ag-charts-community"),import_ag_charts_community43=require("ag-charts-community"),import_ag_charts_core28=require("ag-charts-core"),import_ag_charts_community42=require("ag-charts-community"),import_ag_charts_community41=require("ag-charts-community"),AnnotationShape=class extends import_ag_charts_community41._ModuleSupport.Marker{isPointInPath(t,e){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(t,e)}},_Handle=class vt extends import_ag_charts_community42._ModuleSupport.Group{constructor(){super(...arguments),this.active=!1,this.locked=!1,this.visible=!1,this.zIndex=1}drag(e){const{handle:i,locked:o}=this;return o?{point:{x:i.x,y:i.y},offset:{x:0,y:0}}:{point:e,offset:{x:e.x-i.x,y:e.y-i.y}}}toggleActive(e){this.active=e,e||(this.handle.strokeWidth=vt.INACTIVE_STROKE_WIDTH)}toggleHovered(e){this.glow.visible=!this.locked&&e,this.glow.dirtyPath=!0}toggleDragging(e){this.locked||(this.handle.visible=!e,this.glow.visible=this.glow.visible&&!e,this.handle.dirtyPath=!0,this.glow.dirtyPath=!0)}toggleLocked(e){this.locked=e}getCursor(){}containsPoint(e,i){return this.handle.containsPoint(e,i)}};_Handle.INACTIVE_STROKE_WIDTH=2;var Handle2=_Handle,_InvariantHandle=class kt extends Handle2{constructor(){super(),this.handle=new AnnotationShape({shape:"circle"}),this.glow=new AnnotationShape({shape:"circle"}),this.append([this.handle]),this.handle.size=kt.HANDLE_SIZE,this.handle.strokeWidth=Handle2.INACTIVE_STROKE_WIDTH,this.handle.zIndex=2}update(e){this.handle.setProperties({...e,strokeWidth:Handle2.INACTIVE_STROKE_WIDTH})}drag(e){return{point:e,offset:{x:0,y:0}}}};_InvariantHandle.HANDLE_SIZE=7,_InvariantHandle.GLOW_SIZE=9;var InvariantHandle=_InvariantHandle,_UnivariantHandle=class nt extends Handle2{constructor(){super(),this.handle=new import_ag_charts_community42._ModuleSupport.Rect,this.glow=new import_ag_charts_community42._ModuleSupport.Rect,this.gradient="horizontal",this.append([this.glow,this.handle]),this.handle.cornerRadius=nt.CORNER_RADIUS,this.handle.width=nt.HANDLE_SIZE,this.handle.height=nt.HANDLE_SIZE,this.handle.strokeWidth=Handle2.INACTIVE_STROKE_WIDTH,this.handle.zIndex=2,this.glow.cornerRadius=nt.CORNER_RADIUS,this.glow.width=nt.GLOW_SIZE,this.glow.height=nt.GLOW_SIZE,this.glow.strokeWidth=0,this.glow.fillOpacity=.2,this.glow.zIndex=1,this.glow.visible=!1}toggleLocked(e){if(super.toggleLocked(e),e){const i=(nt.HANDLE_SIZE-InvariantHandle.HANDLE_SIZE)/2;this.handle.cornerRadius=1,this.handle.fill=this.handle.stroke,this.handle.strokeWidth=0,this.handle.x+=i,this.handle.y+=i,this.handle.width=InvariantHandle.HANDLE_SIZE,this.handle.height=InvariantHandle.HANDLE_SIZE,this.glow.width=InvariantHandle.GLOW_SIZE,this.glow.height=InvariantHandle.GLOW_SIZE}else this.handle.cornerRadius=nt.CORNER_RADIUS,this.handle.width=nt.HANDLE_SIZE,this.handle.height=nt.HANDLE_SIZE,this.glow.width=nt.GLOW_SIZE,this.glow.height=nt.GLOW_SIZE,this.cachedStyles&&this.handle.setProperties(this.cachedStyles)}update(e){if(this.cachedStyles={...e},this.active||delete e.strokeWidth,this.locked){delete e.fill,delete e.strokeWidth;const i=(nt.HANDLE_SIZE-InvariantHandle.HANDLE_SIZE)/2;e.x-=i,e.y-=i,this.cachedStyles.x-=i,this.cachedStyles.y-=i}this.handle.setProperties(e),this.glow.setProperties({...e,x:(e.x??this.glow.x)-2,y:(e.y??this.glow.y)-2,strokeWidth:0,fill:e.stroke})}drag(e){return this.locked?{point:e,offset:{x:0,y:0}}:this.gradient==="vertical"?{point:{x:e.x,y:this.handle.y},offset:{x:e.x-this.handle.x,y:0}}:{point:{x:this.handle.x,y:e.y},offset:{x:0,y:e.y-this.handle.y}}}getCursor(){if(!this.locked)return this.gradient==="vertical"?"col-resize":"row-resize"}};_UnivariantHandle.HANDLE_SIZE=12,_UnivariantHandle.GLOW_SIZE=16,_UnivariantHandle.CORNER_RADIUS=4;var UnivariantHandle=_UnivariantHandle,_DivariantHandle=class gt extends Handle2{constructor(){super(),this.handle=new AnnotationShape({shape:"circle"}),this.glow=new AnnotationShape({shape:"circle"}),this.append([this.glow,this.handle]),this.handle.size=gt.HANDLE_SIZE,this.handle.strokeWidth=Handle2.INACTIVE_STROKE_WIDTH,this.handle.zIndex=2,this.glow.size=gt.GLOW_SIZE,this.glow.strokeWidth=0,this.glow.fillOpacity=.2,this.glow.zIndex=1,this.glow.visible=!1}toggleLocked(e){super.toggleLocked(e),e?(this.handle.fill=this.handle.stroke,this.handle.strokeWidth=0,this.handle.size=InvariantHandle.HANDLE_SIZE,this.glow.size=InvariantHandle.GLOW_SIZE):(this.handle.size=gt.HANDLE_SIZE,this.glow.size=gt.GLOW_SIZE,this.cachedStyles&&this.handle.setProperties(this.cachedStyles))}update(e){this.cachedStyles={...e},this.active||delete e.strokeWidth,this.locked&&(delete e.fill,delete e.strokeWidth),this.handle.setProperties(e),this.glow.setProperties({...e,strokeWidth:0,fill:e.stroke})}getCursor(){return"pointer"}};_DivariantHandle.HANDLE_SIZE=11,_DivariantHandle.GLOW_SIZE=17;var DivariantHandle=_DivariantHandle,{ZIndexMap:ZIndexMap2}=import_ag_charts_community43._ModuleSupport,AnnotationScene=class extends import_ag_charts_community43._ModuleSupport.Group{constructor(){super(...arguments),this.name="AnnotationScene",this.zIndex=ZIndexMap2.CHART_ANNOTATION}static isCheck(t,e){return(0,import_ag_charts_core28.isObject)(t)&&Object.hasOwn(t,"type")&&t.type===e}toggleHovered(t,e,i){i!==!0&&this.toggleHandles(t||e)}computeBBoxWithoutHandles(){return import_ag_charts_community43._ModuleSupport.Transformable.toCanvas(this,import_ag_charts_community43._ModuleSupport.Group.computeChildrenBBox(this.excludeChildren({instance:Handle2})))}updateNode(t,e,i){if(!i&&e){e.remove();return}return i&&e==null&&(e=new t,this.appendChild(e)),e}},import_ag_charts_community45=require("ag-charts-community"),import_ag_charts_community44=require("ag-charts-community"),import_ag_charts_core29=require("ag-charts-core"),{ContinuousScale:ContinuousScale2,Vec2:Vec23,toRadians:toRadians3}=import_ag_charts_community44._ModuleSupport;function snapPoint(t,e,i=!1,o,s=1){if(!i)return invertCoords(t,e);const a=o?convertPoint(o,e):Vec23.origin();return invertCoords(snapToAngle(t,a,s),e)}function snapToAngle(t,e,i){const o=Vec23.sub(t,e),s=toRadians3(i),a=Math.round(Vec23.angle(o)/s)*s;return Vec23.rotate(o,a,e)}function getDragStartState(t,e){const i={};for(const[o,s]of(0,import_ag_charts_core29.entries)(t))i[o]=convertPoint(s,e);return i}function translate(t,e,i,o={overflowContinuous:0,translateVectors:void 0,invertYVectors:void 0,snap:void 0}){const{xAxis:s,yAxis:a}=i,r=Object.keys(t),n=[],l=[],c=new Set(o.translateVectors??r),h=new Set(o.invertYVectors??[]),d=new Set([...c,...h]),u=Vec23.multiply(e,Vec23.from(1,-1));for(const x of r)d.has(x)&&(t[x]=Vec23.add(t[x],h.has(x)?u:e),o.snap&&(t[x]=snapToAngle(t[x],o.snap.vectors[x],o.snap.angle))),n.push(s.getRangeOverflow(t[x].x)),l.push(a.getRangeOverflow(t[x].y));const p=(x,b)=>Math.abs(x)-Math.abs(b),g=(x,b,m)=>o.overflowContinuous===0||!ContinuousScale2.is(x)?m.toSorted(p).at(-1)??0:r.length===d.size?m.toSorted(p).at(-o.overflowContinuous-1)??0:m.filter(v=>v!==0).length<=o.overflowContinuous?0:m.filter((v,M)=>v!==0&&Math.abs(v)<=Math.abs(b)&&d.has(r[M])).toSorted(p).at(-1)??0,y=Vec23.from(g(s.scale,e.x,n),g(a.scale,e.y,l));if(!Vec23.equal(y,Vec23.origin()))for(const x of r)d.has(x)&&(t[x]=Vec23.round(Vec23.sub(t[x],y),4));const f={};for(const x of r)f[x]=invertCoords(t[x],i);return f}var{Vec2:Vec24}=import_ag_charts_community45._ModuleSupport,PointScene=class extends AnnotationScene{constructor(){super(...arguments),this.handle=new DivariantHandle,this.anchor={x:0,y:0,position:"above"}}update(t,e){const i=convertPoint(t,e);this.updateHandle(t,i),this.anchor=this.updateAnchor(t,i,e)}dragStart(t,e,i){this.dragState={offset:e,...getDragStartState({handle:t},i)}}drag(t,e,i){const{dragState:o}=this;if(!t.isWriteable()||!o)return;const{point:s}=translate({point:o.handle},Vec24.sub(e,o.offset),i);t.x=s.x,t.y=s.y}translate(t,e,i){if(!t.isWriteable())return;const{point:o}=translate({point:convertPoint(t,i)},e,i);t.x=o.x,t.y=o.y}toggleHandles(t){this.handle.visible=!!t,this.handle.toggleHovered(this.activeHandle==="handle")}toggleActive(t){this.toggleHandles(t),this.handle.toggleActive(t)}stopDragging(){this.handle.toggleDragging(!1)}copy(t,e,i){const o=convertPoint(t,i),s=invertCoords({x:o.x-30,y:o.y-30},i);return e.x=s.x,e.y=s.y,e}getAnchor(){return this.anchor}getCursor(){return"pointer"}containsPoint(t,e){const{handle:i}=this;return this.activeHandle=void 0,i.containsPoint(t,e)?(this.activeHandle="handle",!0):!1}getNodeAtCoords(t,e){if(this.handle.containsPoint(t,e))return"handle"}updateHandle(t,e,i){const{x:o,y:s}=this.getHandleCoords(t,e,i),a=this.getHandleStyles(t);this.handle.update({...a,x:o,y:s}),this.handle.toggleLocked(t.locked??!1)}updateAnchor(t,e,i){const o=this.getHandleCoords(t,e);return{x:o.x+i.seriesRect.x,y:o.y+i.seriesRect.y,position:this.anchor.position}}getHandleCoords(t,e,i){return{x:e.x,y:e.y}}getHandleStyles(t){return{fill:t.handle.fill,stroke:t.handle.stroke,strokeOpacity:t.handle.strokeOpacity,strokeWidth:t.handle.strokeWidth}}},ShapePointScene=class extends PointScene{constructor(){super(),this.append([this.handle])}update(t,e){super.update(t,e);const i=convertPoint(t,e);this.updateShape(t,i)}updateShape(t,e){this.updateShapeStyles(t),this.updateShapePath(t,e)}updateShapeStyles(t){const{shape:e}=this;e.fill=t.fill,e.fillOpacity=t.fillOpacity??1}updateShapePath(t,e){const{shape:i}=this;i.x=e.x,i.y=e.y,i.size=t.size}containsPoint(t,e){return super.containsPoint(t,e)||this.shape.containsPoint(t,e)}getNodeAtCoords(t,e){return this.shape.containsPoint(t,e)?"shape":super.getNodeAtCoords(t,e)}},arrowUpPoints=[[.5,0],[1,.5],[.75,.5],[.75,1],[.25,1],[.25,.5],[0,.5]];function arrowUp(t){import_ag_charts_community46._ModuleSupport.drawMarkerUnitPolygon(t,arrowUpPoints)}arrowUp.anchor={x:.5,y:0};var ArrowUpScene=class extends ShapePointScene{constructor(){super(),this.type="arrow-up",this.shape=new AnnotationShape({shape:arrowUp}),this.append([this.shape])}static is(t){return AnnotationScene.isCheck(t,"arrow-up")}getHandleCoords(t,e){const i=DivariantHandle.HANDLE_SIZE/2,o=super.getHandleCoords(t,e);return o.y-=i,o}},arrowDownPoints=arrowUpPoints.map(([t,e])=>[t,1-e]);function arrowDown(t){import_ag_charts_community47._ModuleSupport.drawMarkerUnitPolygon(t,arrowDownPoints)}arrowDown.anchor={x:.5,y:1};var ArrowDownScene=class extends ShapePointScene{constructor(){super(),this.type="arrow-down",this.shape=new AnnotationShape({shape:arrowDown}),this.append([this.shape])}static is(t){return AnnotationScene.isCheck(t,"arrow-down")}updateAnchor(t,e,i){const o=super.updateAnchor(t,e,i);return o.y-=t.size,o}getHandleCoords(t,e){const i=DivariantHandle.HANDLE_SIZE/2,o=super.getHandleCoords(t,e);return o.y+=i,o}},import_ag_charts_community48=require("ag-charts-community"),{StateMachine:StateMachine2,StateMachineProperty:StateMachineProperty2,Debug:Debug2}=import_ag_charts_community48._ModuleSupport,PointStateMachine=class extends StateMachine2{constructor(t){const e=({point:o})=>{const s=this.createDatum();s.set({x:o.x,y:o.y}),t.create(s)},i=()=>{this.node?.toggleActive(!0),t.showAnnotationOptions(),t.update()};super("start",{start:{click:{target:"waiting-first-render",action:e},drag:{target:"waiting-first-render",action:e},cancel:StateMachine2.parent,reset:StateMachine2.parent},"waiting-first-render":{render:{target:StateMachine2.parent,action:i}}}),this.debug=Debug2.create(!0,"annotations")}};__decorateClass([StateMachineProperty2()],PointStateMachine.prototype,"node",2);var ArrowDownStateMachine=class extends PointStateMachine{createDatum(){return new ArrowDownProperties}},arrowDownConfig={type:"arrow-down",datum:ArrowDownProperties,scene:ArrowDownScene,isDatum:ArrowDownProperties.is,translate:(t,e,i,o)=>{ArrowDownProperties.is(e)&&ArrowDownScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(ArrowDownProperties.is(e)&&ArrowDownProperties.is(i)&&ArrowDownScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{ArrowDownProperties.is(e)&&ArrowDownScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new ArrowDownStateMachine({...t,create:e("arrow-down")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community49=require("ag-charts-community"),import_ag_charts_core30=require("ag-charts-core"),{Property:Property30}=import_ag_charts_community49._ModuleSupport,ArrowUpProperties=class extends ShapePointProperties{constructor(){super(...arguments),this.type="arrow-up"}static is(t){return(0,import_ag_charts_core30.isObject)(t)&&t.type==="arrow-up"}};__decorateClass([Property30],ArrowUpProperties.prototype,"type",2);var ArrowUpStateMachine=class extends PointStateMachine{createDatum(){return new ArrowUpProperties}},arrowUpConfig={type:"arrow-up",datum:ArrowUpProperties,scene:ArrowUpScene,isDatum:ArrowUpProperties.is,translate:(t,e,i,o)=>{ArrowUpProperties.is(e)&&ArrowUpScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(ArrowUpProperties.is(e)&&ArrowUpProperties.is(i)&&ArrowUpScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{ArrowUpProperties.is(e)&&ArrowUpScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new ArrowUpStateMachine({...t,create:e("arrow-up")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community53=require("ag-charts-community"),import_ag_charts_community52=require("ag-charts-community"),import_ag_charts_community51=require("ag-charts-community"),import_ag_charts_core31=require("ag-charts-core"),import_ag_charts_community50=require("ag-charts-community"),{Vec2:Vec25,Vec4}=import_ag_charts_community50._ModuleSupport,LinearScene=class extends AnnotationScene{constructor(){super(...arguments),this.overflowContinuous=0}extendLine({x1:t,y1:e,x2:i,y2:o},s,a){const r={x1:t,y1:e,x2:i,y2:o};if(!s.extendStart&&!s.extendEnd)return r;const[n,l]=boundsIntersections(r,a.yAxis.bounds),c=r.x2=r.y2,d=r.x2===r.x1;return s.extendEnd&&(d?r.y2=h?l.y:n.y:(r.x2=c?n.x:l.x,r.y2=c?n.y:l.y)),s.extendStart&&(d?r.y1=h?n.y:l.y:(r.x1=c?l.x:n.x,r.y1=c?l.y:n.y)),r}dragStart(t,e,i){this.dragState={offset:e,...getDragStartState({start:t.start,end:t.end},i)}}drag(t,e,i,o){t.isWriteable()&&(this.activeHandle?this.dragHandle(t,e,i,o):this.dragAll(t,e,i))}dragAll(t,e,i){const{dragState:o}=this;o&&this.translatePoints(t,o.start,o.end,Vec25.sub(e,o.offset),i)}translate(t,e,i){t.isWriteable()&&this.translatePoints(t,convertPoint(t.start,i),convertPoint(t.end,i),e,i)}copy(t,e,i){const o=convertLine(t,i);if(!o)return;const s=this.computeBBoxWithoutHandles(),a={x:-s.width/2,y:-s.height/2};return this.translatePoints(e,Vec4.start(o),Vec4.end(o),a,i),e}translatePoints(t,e,i,o,s){const a=this.getTranslatePointsVectors(e,i),r=translate(a,o,s,{overflowContinuous:this.overflowContinuous});t.start.x=r.start.x,t.end.x=r.end.x,t.start.y=r.start.y,t.end.y=r.end.y}getTranslatePointsVectors(t,e){return{start:t,end:e}}},{Vec2:Vec26,Vec4:Vec42}=import_ag_charts_community51._ModuleSupport,StartEndScene=class extends LinearScene{constructor(){super(...arguments),this.start=new DivariantHandle,this.end=new DivariantHandle,this.anchor={x:0,y:0,position:"above"}}update(t,e){const i=convertLine(t,e);i!=null&&(this.updateHandles(t,i),this.updateAnchor(t,i,e))}toggleHandles(t){if(typeof t=="boolean")this.start.visible=t,this.end.visible=t;else for(const[e,i]of(0,import_ag_charts_core31.entries)(t))this[e].visible=i;this.start.toggleHovered(this.activeHandle==="start"),this.end.toggleHovered(this.activeHandle==="end")}toggleActive(t){this.toggleHandles(t),this.start.toggleActive(t),this.end.toggleActive(t)}dragHandle(t,e,i,o){const{activeHandle:s,dragState:a}=this;if(!s||!a)return;this[s].toggleDragging(!0);const r=s==="start"?"end":"start",n=o?{vectors:{[s]:convertPoint(t[r],i)},angle:t.snapToAngle}:void 0,{[s]:l}=translate({[s]:a[s]},Vec26.sub(e,a.offset),i,{overflowContinuous:0,snap:n});t[s].x=l.x,t[s].y=l.y}stopDragging(){this.start.toggleDragging(!1),this.end.toggleDragging(!1)}getAnchor(){return this.anchor}getCursor(){return"pointer"}containsPoint(t,e){const{start:i,end:o}=this;return this.activeHandle=void 0,i.containsPoint(t,e)?(this.activeHandle="start",!0):o.containsPoint(t,e)?(this.activeHandle="end",!0):!1}getNodeAtCoords(t,e){if(this.start.containsPoint(t,e)||this.end.containsPoint(t,e))return"handle"}updateHandles(t,e,i){this.start.update({...this.getHandleStyles(t,"start"),...this.getHandleCoords(t,e,"start")}),this.end.update({...this.getHandleStyles(t,"end"),...this.getHandleCoords(t,e,"end",i)}),this.start.toggleLocked(t.locked??!1),this.end.toggleLocked(t.locked??!1)}updateAnchor(t,e,i,o){this.anchor={x:e.x1+i.seriesRect.x,y:e.y1+i.seriesRect.y,position:this.anchor.position}}getHandleCoords(t,e,i,o){return i==="start"?Vec42.start(e):Vec42.end(e)}getHandleStyles(t,e){return{fill:t.handle.fill,stroke:t.handle.stroke,strokeOpacity:t.handle.strokeOpacity,strokeWidth:t.handle.strokeWidth}}},{Vec4:Vec43}=import_ag_charts_community52._ModuleSupport,TextualStartEndScene=class extends StartEndScene{constructor(){super(...arguments),this.label=new import_ag_charts_community52._ModuleSupport.Text({zIndex:1}),this.anchor={x:0,y:0,position:"above-left"}}setTextInputBBox(t){this.textInputBBox=t,this.markDirty("TextualStartEndScene")}update(t,e){const i=convertLine(t,e);if(i==null)return;const o=this.getTextBBox(t,i);this.updateLabel(t,o,i),this.updateHandles(t,i,o),this.updateShape(t,o,i),this.updateAnchor(t,i,e,o)}containsPoint(t,e){return super.containsPoint(t,e)||this.label.containsPoint(t,e)}getNodeAtCoords(t,e){return this.label.containsPoint(t,e)?"text":super.getNodeAtCoords(t,e)}getTextBBox(t,e){const{text:i}=t.getText();return getBBox(t,i,Vec43.end(e),this.textInputBBox)}updateLabel(t,e,i){const{text:o,isPlaceholder:s}=t.getText();updateTextNode(this.label,o,s,t,this.getLabelCoords(t,e,i))}updateShape(t,e,i){}getLabelCoords(t,e,i){return Vec43.end(i)}getHandleStyles(t,e){return{...super.getHandleStyles(t,e),stroke:t.handle.stroke??t.color}}},{drawCorner,Path:Path5}=import_ag_charts_community53._ModuleSupport,CalloutScene=class extends TextualStartEndScene{constructor(){super(),this.type="callout",this.shape=new Path5,this.append([this.shape,this.label,this.start,this.end])}static is(t){return AnnotationScene.isCheck(t,"callout")}drag(t,e,i,o){t.isWriteable()&&(this.activeHandle==="end"?this.dragHandle(t,e,i,o):this.dragAll(t,e,i))}getLabelCoords(t,e,i){const o=t.getPadding(),{bodyBounds:s={x:0,y:0,width:0,height:0}}=this.getDimensions(t,e,i)??{};return{x:s.x+o.left,y:s.y-o.bottom}}getHandleStyles(t,e){return e==="start"?{fill:t.handle.fill,stroke:t.handle.stroke??t.stroke,strokeOpacity:t.handle.strokeOpacity,strokeWidth:t.handle.strokeWidth}:{fill:void 0,strokeWidth:0}}updateAnchor(t,e,i,o){const{bodyBounds:s}=this.getDimensions(t,o,e)??{},a=s??o;this.anchor={x:a.x+i.seriesRect.x,y:a.y+i.seriesRect.y-a.height,position:this.anchor.position}}updateShape(t,e,i){const{shape:o}=this;o.fill=t.fill,o.fillOpacity=t.fillOpacity??1,o.stroke=t.stroke,o.strokeWidth=t.strokeWidth??1,o.strokeOpacity=t.strokeOpacity??1;const{tailPoint:s,bodyBounds:a}=this.getDimensions(t,e,i)??{};!s||!a||this.updatePath(s,a)}updatePath(t,e){const{x:i,y:o}=t,{x:s,y:a,width:r,height:n}=e,l=a-n,c=s+r,h=this.calculateCalloutPlacement({x:i,y:o},e),d=8,u=[{coordinates:{x0:s,x1:s+d,y0:l+d,y1:l,cx:h==="topLeft"?i:s+d,cy:h==="topLeft"?o:l+d},type:h==="topLeft"?"calloutCorner":"corner"},{coordinates:{x0:s+d,x1:c-d,y0:l,y1:l,cx:i,cy:o},type:h==="top"?"calloutSide":"side"},{coordinates:{x0:c-d,x1:c,y0:l,y1:l+d,cx:h==="topRight"?i:c-d,cy:h==="topRight"?o:l+d},type:h==="topRight"?"calloutCorner":"corner"},{coordinates:{x0:c,x1:c,y0:l+d,y1:a-d,cx:i,cy:o},type:h==="right"?"calloutSide":"side"},{coordinates:{x0:c,x1:c-d,y0:a-d,y1:a,cx:h==="bottomRight"?i:c-d,cy:h==="bottomRight"?o:a-d},type:h==="bottomRight"?"calloutCorner":"corner"},{coordinates:{x0:c-d,x1:s+d,y0:a,y1:a,cx:i,cy:o},type:h==="bottom"?"calloutSide":"side"},{coordinates:{x0:s+d,x1:s,y0:a,y1:a-d,cx:h==="bottomLeft"?i:s+d,cy:h==="bottomLeft"?o:a-d},type:h==="bottomLeft"?"calloutCorner":"corner"},{coordinates:{x0:s,x1:s,y0:a-d,y1:l+d,cx:i,cy:o},type:h==="left"?"calloutSide":"side"}],{path:p}=this.shape;p.clear(),p.moveTo(s,l+d);for(const{coordinates:g,type:y}of u)this.drawPath(p,g,d,y);p.closePath()}drawPath(t,{x0:e,y0:i,x1:o,y1:s,cx:a,cy:r},n,l){switch(l){case"calloutCorner":{t.lineTo(a,r),t.lineTo(o,s);break}case"corner":{drawCorner(t,{x0:e,x1:o,y0:i,y1:s,cx:a,cy:r},n,!1);break}case"calloutSide":{if(e===o){const h=i>s?-1:1,d=Math.min(i,s)+Math.abs(i-s)/2;t.lineTo(e,d-6*h),t.lineTo(a,r),t.lineTo(e,d+6*h),t.lineTo(o,s)}else{const h=e>o?-1:1,d=Math.min(e,o)+Math.abs(o-e)/2;t.lineTo(d-6*h,i),t.lineTo(a,r),t.lineTo(d+6*h,i),t.lineTo(o,s)}break}case"side":default:{t.lineTo(o,s);break}}}calculateCalloutPlacement(t,e){const i=e.x+e.width,o=e.y-e.height;let s,a;return t.x>i?s="right":t.xe.y?a="bottom":t.y{const p=this.createDatum();p.set({start:u,end:u,visible:!0}),t.create(p)},i=()=>{const{node:u}=this;u?.toggleActive(!0),u?.toggleHandles({start:!0})},o=()=>{t.showTextInput(),this.datum&&(this.datum.visible=!1)},s=()=>{t.hideTextInput(),this.datum&&(this.datum.visible=!0),t.deselect()},a=u=>{this.node?.setTextInputBBox(u),t.update()},r=({point:u})=>{const{datum:p,node:g}=this;p?.set({end:u}),g?.toggleActive(!0),g?.toggleHandles({end:!1}),t.update()},n=()=>{t.showAnnotationOptions(),this.node?.toggleHandles({end:!0})},l=({colorPickerType:u,colorOpacity:p,color:g,opacity:y,isMultiColor:f})=>{const{datum:x}=this;x&&(u==="text-color"&&t.updateTextInputColor(g),setColor(x,u,p,g,y,f),t.update())},c=u=>{const{datum:p,node:g}=this;!p||!g||!isTextType(p)||(p.fontSize=u,t.updateTextInputFontSize(u),t.update())},h=()=>{t.delete()},d=({textInputValue:u,bbox:p})=>{const{datum:g}=this;if(p!=null&&u!=null&&u.length>0){if(!isTextType(g))return;const y=maybeWrapText(g,u,p.width);g?.set({text:y}),t.update(),t.recordAction(`Create ${g?.type} annotation`)}else t.delete()};super("start",{start:{click:{target:"waiting-first-render",action:e},dragStart:{target:"waiting-first-render",action:e},cancel:StateMachine3.parent,reset:StateMachine3.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:r,drag:r,click:{target:"edit",action:n},dragEnd:{target:"edit",action:n},reset:{target:StateMachine3.parent,action:h},cancel:{target:StateMachine3.parent,action:h}},edit:{onEnter:o,updateTextInputBBox:a,color:l,fontSize:c,textInput:[{guard:guardCancelAndExit,target:StateMachine3.parent,action:h},{guard:guardSaveAndExit,target:StateMachine3.parent,action:d}],click:{target:StateMachine3.parent,action:d},dragStart:{target:StateMachine3.parent,action:d},resize:{target:StateMachine3.parent,action:d},onExit:s,cancel:{target:StateMachine3.parent,action:h}}}),this.debug=Debug3.create(!0,"annotations")}};__decorateClass([StateMachineProperty3()],TextualStartEndStateMachine.prototype,"datum",2),__decorateClass([StateMachineProperty3()],TextualStartEndStateMachine.prototype,"node",2);var CalloutStateMachine=class extends TextualStartEndStateMachine{createDatum(){return new CalloutProperties}},calloutConfig={type:"callout",datum:CalloutProperties,scene:CalloutScene,isDatum:CalloutProperties.is,translate:(t,e,i,o)=>{if(CalloutProperties.is(e)&&CalloutScene.is(t))return t.translate(e,i,o)},copy:(t,e,i,o)=>{if(CalloutProperties.is(e)&&CalloutProperties.is(i)&&CalloutScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{CalloutProperties.is(e)&&CalloutScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new CalloutStateMachine({...t,create:e("callout")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community56=require("ag-charts-community"),import_ag_charts_core32=require("ag-charts-core"),import_ag_charts_community55=require("ag-charts-community"),TextualPointScene=class extends PointScene{constructor(){super(...arguments),this.label=new import_ag_charts_community55._ModuleSupport.Text({zIndex:1}),this.anchor={x:0,y:0,position:"above-left"}}setTextInputBBox(t){this.textInputBBox=t,this.markDirty("TextualPointScene")}update(t,e){const i=convertPoint(t,e),o=this.getTextBBox(t,i,e);this.updateLabel(t,o),this.updateHandle(t,i,o),this.updateShape(t,o),this.anchor=this.updateAnchor(t,o,e)}copy(t,e,i){const o=convertPoint(t,i),s=this.getTextBBox(t,o,i),a=t.getPadding(),r=a.left+a.right,n=a.top+a.bottom,l=(s.width+r)/2,c=s.height+n,h=invertCoords({x:o.x-l,y:o.y-c},i);return e.x=h.x,e.y=h.y,e}containsPoint(t,e){const{label:i}=this;return super.containsPoint(t,e)||i.visible&&i.containsPoint(t,e)}getNodeAtCoords(t,e){return this.label.visible&&this.label.containsPoint(t,e)?"text":super.getNodeAtCoords(t,e)}getTextBBox(t,e,i){const{text:o}=t.getText();return getBBox(t,o,{x:e.x,y:e.y},this.textInputBBox)}updateLabel(t,e){const{text:i,isPlaceholder:o}=t.getText();updateTextNode(this.label,i,o,t,this.getLabelCoords(t,e),this.getTextBaseline(t))}updateShape(t,e){}updateAnchor(t,e,i){return{x:e.x+i.seriesRect.x,y:e.y+i.seriesRect.y-e.height,position:this.anchor.position}}getLabelCoords(t,e){return e}getTextBaseline(t){return t.position=="center"?"middle":t.position}getHandleCoords(t,e,i){return i}getHandleStyles(t){const e=super.getHandleStyles(t);return e.stroke=t.handle.stroke??t.color,e}},{drawCorner:drawCorner2}=import_ag_charts_community56._ModuleSupport,CommentScene=class extends TextualPointScene{constructor(){super(),this.type="comment",this.shape=new import_ag_charts_community56._ModuleSupport.Path,this.append([this.shape,this.label,this.handle])}static is(t){return AnnotationScene.isCheck(t,"comment")}updateShape(t,e){const{shape:i}=this;i.fill=t.fill,i.fillOpacity=t.fillOpacity??1,i.stroke=t.stroke??"transparent",i.strokeWidth=t.strokeWidth??1,i.strokeOpacity=t.strokeOpacity??1,this.updatePath(t,e)}getLabelCoords(t,e){const i=t.getPadding();return{x:e.x+i.left,y:e.y-i.bottom}}getHandleStyles(t){return{fill:t.handle.fill,stroke:t.handle.stroke??t.stroke??t.fill,strokeOpacity:t.handle.strokeOpacity,strokeWidth:t.handle.strokeWidth}}updateAnchor(t,e,i){const o=super.updateAnchor(t,e,i),s=t.getPadding();return o.y-=s.bottom+s.top,o}updatePath(t,e){const i=t.getPadding(),{x:o,y:s}=e;let{width:a,height:r}=e;const{fontSize:n}=t,l=i.left+i.right,c=i.top+i.bottom;a=a+l,r=Math.max(r+c,n+c);const h=s-r,d=o+a,u=((0,import_ag_charts_core32.calcLineHeight)(n,ANNOTATION_TEXT_LINE_HEIGHT)+c)/2,{path:p}=this.shape;p.clear(),p.moveTo(o,s),p.lineTo(o,h+u),drawCorner2(p,{x0:o,x1:o+u,y0:h+u,y1:h,cx:o+u,cy:h+u},u,!1),p.lineTo(d-u,h),drawCorner2(p,{x0:d-u,x1:d,y0:h,y1:h+u,cx:d-u,cy:h+u},u,!1),p.lineTo(d,s-u),drawCorner2(p,{x0:d,x1:d-u,y0:s-u,y1:s,cx:d-u,cy:s-u},u,!1),p.closePath()}containsPoint(t,e){return super.containsPoint(t,e)||this.shape.containsPoint(t,e)}},import_ag_charts_community57=require("ag-charts-community"),{StateMachine:StateMachine4,StateMachineProperty:StateMachineProperty4,Debug:Debug4}=import_ag_charts_community57._ModuleSupport,TextualPointStateMachine=class extends StateMachine4{constructor(t){const e=({point:h})=>{const d=this.createDatum();d.set({x:h.x,y:h.y}),t.create(d)},i=()=>{this.node?.toggleActive(!0),t.showAnnotationOptions(),t.update()},o=()=>{t.showTextInput(),this.datum&&(this.datum.visible=!1)},s=()=>{t.hideTextInput(),this.datum&&(this.datum.visible=!0),t.deselect()},a=h=>{this.node?.setTextInputBBox(h),t.update()},r=({colorPickerType:h,colorOpacity:d,color:u,opacity:p,isMultiColor:g})=>{this.datum&&(h==="text-color"&&t.updateTextInputColor(u),setColor(this.datum,h,d,u,p,g),t.update())},n=h=>{const{datum:d,node:u}=this;!d||!u||!isTextType(d)||(d.fontSize=h,t.updateTextInputFontSize(h),t.update())},l=()=>{t.delete()},c=({textInputValue:h,bbox:d})=>{if(d!=null&&h!=null&&h.length>0){const{datum:u}=this;if(!isTextType(u))return;const p=maybeWrapText(u,h,d.width);u?.set({text:p}),t.update(),t.recordAction(`Create ${u?.type} annotation`)}else t.delete()};super("start",{start:{click:{target:"waiting-first-render",action:e},dragStart:{target:"waiting-first-render",action:e},cancel:StateMachine4.parent,reset:StateMachine4.parent},"waiting-first-render":{render:{target:"edit",action:i}},edit:{onEnter:o,updateTextInputBBox:a,color:r,fontSize:n,textInput:[{guard:guardCancelAndExit,target:StateMachine4.parent,action:l},{guard:guardSaveAndExit,target:StateMachine4.parent,action:c}],click:{target:StateMachine4.parent,action:c},dragStart:{target:StateMachine4.parent,action:c},resize:{target:StateMachine4.parent,action:c},onExit:s,cancel:{target:StateMachine4.parent,action:l}}}),this.debug=Debug4.create(!0,"annotations")}};__decorateClass([StateMachineProperty4()],TextualPointStateMachine.prototype,"datum",2),__decorateClass([StateMachineProperty4()],TextualPointStateMachine.prototype,"node",2);var CommentStateMachine=class extends TextualPointStateMachine{createDatum(){return new CommentProperties}},commentConfig={type:"comment",datum:CommentProperties,scene:CommentScene,isDatum:CommentProperties.is,translate:(t,e,i,o)=>{CommentProperties.is(e)&&CommentScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(CommentProperties.is(e)&&CommentProperties.is(i)&&CommentScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{CommentProperties.is(e)&&CommentScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new CommentStateMachine({...t,create:e("comment")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community62=require("ag-charts-community"),import_ag_charts_community58=require("ag-charts-community"),{calculateLabelTranslation}=import_ag_charts_community58._ModuleSupport,AxisLabelScene=class extends import_ag_charts_community58._ModuleSupport.Group{constructor(){super({name:"AnnotationAxisLabelGroup"}),this.label=new import_ag_charts_community58._ModuleSupport.Text({zIndex:1}),this.rect=new import_ag_charts_community58._ModuleSupport.Rect;const{label:t}=this;t.fontSize=12,t.fontFamily="Verdana, sans-serif",t.fill="black",t.textBaseline="middle",t.textAlign="center",this.append([this.rect,this.label])}update(t){this.updateLabel(t),this.updateRect(t),this.updatePosition(t)}updateLabel({value:t,styles:e,context:i}){const{fontWeight:o,fontSize:s,fontStyle:a,fontFamily:r,textAlign:n,color:l="white",formatter:c}=e,h=c?c({value:t}):i.formatScaleValue(t,"annotation-label");this.label.setProperties({fontWeight:o,fontSize:s,fontStyle:a,fontFamily:r,textAlign:n,fill:l,text:h})}updateRect({styles:t}){const{rect:e}=this,{cornerRadius:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:r}=t;e.fill=o,e.fillOpacity=s??1,e.stroke=a,e.strokeOpacity=r??1,e.cornerRadius=i??0}updatePosition({x:t,y:e,context:i,styles:{padding:o}}){const{label:s,rect:a}=this,r=s.getBBox()?.clone(),n=o??8,l=o??4,{xTranslation:c,yTranslation:h}=calculateLabelTranslation({yDirection:!0,padding:i.labelPadding,position:i.position??"left",bbox:r});r.grow(n,"horizontal"),r.grow(l,"vertical");const d=t+c,u=e+h;s.x=d,s.y=u,a.y=u-Math.round(r.height/2),a.x=d-Math.round(r.width/2),a.height=r.height,a.width=r.width}};AxisLabelScene.className="AxisLabel";var import_ag_charts_community59=require("ag-charts-community"),{Vec2:Vec27}=import_ag_charts_community59._ModuleSupport,CollidableLine=class extends import_ag_charts_community59._ModuleSupport.Line{constructor(){super(...arguments),this.growCollisionBox=9,this.clipMask=new Map}setProperties(t){return super.setProperties(t),this.updateCollisionBBox(),this}updateCollisionBBox(){const{growCollisionBox:t,strokeWidth:e,x1:i,y1:o,x2:s,y2:a}=this;let r=e+t;r%2===0&&(r+=1);const n=Vec27.from(i,o-Math.floor(r/2)),l=Vec27.from(s,a),c=Vec27.distance(n,l);this.collisionBBox=new import_ag_charts_community59._ModuleSupport.BBox(n.x,n.y,c,r)}isPointInPath(t,e){const{collisionBBox:i,x1:o,y1:s,x2:a,y2:r}=this;if(!i)return!1;const n=Vec27.from(o,s),l=Vec27.from(a,r),c=Vec27.sub(Vec27.from(t,e),n),h=Vec27.sub(l,n),d=Vec27.rotate(c,Vec27.angle(c,h),n);return i.containsPoint(d.x,d.y)??!1}render(t){const{clipMask:e}=this,{ctx:i}=t;if(e.size===0){super.render(t);return}i.save();try{for(const o of this.clipMask.values()){const{x:s,y:a,radius:r}=o;i.beginPath(),i.rect(0,0,i.canvas.width,i.canvas.height),i.ellipse(s,a,r,r,0,Math.PI*2,0,!0),i.clip()}super.render(t)}finally{i.restore()}}setClipMask(t,e){const i=this.clipMask.get(t);import_ag_charts_community59._ModuleSupport.jsonDiff(i,e)!=null&&this.markDirty("CollidableLine"),e?this.clipMask.set(t,e):this.clipMask.delete(t)}},import_ag_charts_community60=require("ag-charts-community"),CollidableText=class extends import_ag_charts_community60._ModuleSupport.TransformableText{constructor(){super(...arguments),this.growCollisionBox={top:4,right:4,bottom:4,left:4}}isPointInPath(t,e){const i=this.fromParentPoint(t,e),o=this.computeBBoxWithoutTransforms();return o?o.grow(this.growCollisionBox).containsPoint(i.x,i.y):!1}},import_ag_charts_community61=require("ag-charts-community"),{Vec2:Vec28}=import_ag_charts_community61._ModuleSupport;function updateLineText(t,e,i,o,s,a,r){if(!a||!s||!o){e.setClipMask(t);return}const{alignment:n,position:l}=o,c=getNumbers(i,o.fontSize,r),{point:h,textBaseline:d}=positionAndAlignment(c,l,n);setProperties(s,a,o,h,c.angle,d);const{x:u,y:p,width:g,height:y}=s.getBBox(),f=Vec28.length(Vec28.from(g,y)),x={x:u+g/2,y:p+y/2,radius:f/2+Vec28.length(c.offset)};return l==="center"?e.setClipMask(t,x):e.setClipMask(t),{clipMask:x,numbers:c}}function updateChannelText(t,e,i,o,s,a,r){if(!r||!a)return;const{alignment:n,position:l}=o,[c,h]=e.y1<=i.y1?[e,i]:[i,e];let d=c;l==="bottom"?d=h:l==="inside"&&(d={x1:(c.x1+h.x1)/2,y1:(c.y1+h.y1)/2,x2:(c.x2+h.x2)/2,y2:(c.y2+h.y2)/2});const u=getNumbers(d,o.fontSize,s),{point:p,textBaseline:g}=positionAndAlignment(u,l==="inside"?"center":l,n,t);setProperties(a,r,o,p,u.angle,g)}function getNumbers(t,e,i){let[o,s]=Vec28.from(t);o.x>s.x&&([o,s]=[s,o]);const a=Vec28.normalized(Vec28.sub(s,o)),r=Vec28.angle(a),n=Vec28.multiply(a,DivariantHandle.HANDLE_SIZE/2+(e??14)/2),l=Vec28.multiply(a,(i??2)/2+(e??14)/3);return{left:o,right:s,normal:a,angle:r,inset:n,offset:l}}function positionAndAlignment({left:t,right:e,normal:i,angle:o,inset:s,offset:a},r,n,l){let c;n==="right"?c=Vec28.sub(e,s):n==="center"?c=Vec28.add(t,Vec28.multiply(i,Vec28.distance(t,e)/2)):c=Vec28.add(t,s);let h="bottom";return r==="bottom"?(c=Vec28.rotate(a,o+Math.PI/2,c),h="top"):r==="center"&&!l?h="middle":c=Vec28.rotate(a,o-Math.PI/2,c),{point:c,textBaseline:h}}function setProperties(t,e,i,o,s,a){t.setProperties({text:e,x:o.x,y:o.y,rotation:s,rotationCenterX:o.x,rotationCenterY:o.y,fill:i.color,fontFamily:i.fontFamily,fontSize:i.fontSize,fontStyle:i.fontStyle,fontWeight:i.fontWeight,textAlign:i.alignment,textBaseline:a})}var{ChartAxisDirection:ChartAxisDirection6,Vec2:Vec29,Vec4:Vec44}=import_ag_charts_community62._ModuleSupport,CrossLineScene=class extends AnnotationScene{constructor(){super(),this.type="cross-line",this.line=new CollidableLine,this.middle=new UnivariantHandle,this.isHorizontal=!1,this.append([this.line,this.middle])}static is(t){return AnnotationScene.isCheck(t,"cross-line")}update(t,e){const{seriesRect:i}=e;this.seriesRect=i,this.isHorizontal=HorizontalLineProperties.is(t);const o=this.isHorizontal?e.yAxis:e.xAxis,s=this.convertCrossLine(t,o);if(s==null){this.visible=!1;return}this.visible=t.visible??!0,this.visible&&(this.updateLine(t,s),this.updateHandle(t,s),this.updateText(t,s),this.updateAxisLabel(t,o,s))}updateLine(t,e){const{line:i}=this,{lineDashOffset:o,stroke:s,strokeWidth:a,strokeOpacity:r}=t,{x1:n,y1:l,x2:c,y2:h}=e;i.setProperties({x1:n,y1:l,x2:c,y2:h,lineCap:t.getLineCap(),lineDash:t.getLineDash(),lineDashOffset:o,stroke:s,strokeWidth:a,strokeOpacity:r,fillOpacity:0})}updateHandle(t,e){const{middle:i}=this,{locked:o,stroke:s,strokeWidth:a,strokeOpacity:r}=t,n={fill:t.handle.fill,stroke:t.handle.stroke??s,strokeOpacity:t.handle.strokeOpacity??r,strokeWidth:t.handle.strokeWidth??a},l=Vec29.sub(Vec44.center(e),Vec29.from(i.handle.width/2,i.handle.height/2));i.gradient=this.isHorizontal?"horizontal":"vertical",i.update({...n,...l}),i.toggleLocked(o??!1)}updateText(t,e){this.text=this.updateNode(CollidableText,this.text,!!t.text.label),updateLineText(this.line.id,this.line,e,t.text,this.text,t.text.label,t.strokeWidth)}createAxisLabel(t){const e=new AxisLabelScene;return t.attachLabel(e),e}updateAxisLabel(t,e,i){this.axisLabel??(this.axisLabel=this.createAxisLabel(e));const{axisLabel:o,seriesRect:s}=this,{direction:a,position:r}=e;if(t.axisLabel.enabled){o.visible=this.visible;const n=r==="left"||r==="top"?Vec44.start(i):Vec44.end(i),l=a===ChartAxisDirection6.X?n.x:n.y;if(!e.inRange(l)){o.visible=!1;return}const c=getGroupingValue(t.value);o.update({...Vec29.add(n,Vec29.required(s)),value:c,styles:t.axisLabel,context:e})}else o.visible=!1}setAxisLabelOpacity(t){this.axisLabel&&(this.axisLabel.opacity=t)}setAxisLabelVisible(t){this.axisLabel&&(this.axisLabel.visible=t)}toggleHandles(t){this.middle.visible=t,this.middle.toggleHovered(this.activeHandle==="middle")}destroy(){super.destroy(),this.axisLabel?.destroy()}toggleActive(t){this.toggleHandles(t),this.middle.toggleActive(t)}dragStart(t,e,i){const o=HorizontalLineProperties.is(t)?{x:e.x,y:convert(t.value,i.yAxis)}:{x:convert(t.value,i.xAxis),y:e.y};this.dragState={offset:e,middle:o}}drag(t,e,i){const{activeHandle:o,dragState:s}=this;!t.isWriteable()||!s||(o&&this[o].toggleDragging(!0),this.translatePoint(t,s.middle,Vec29.sub(e,s.offset),i))}translate(t,e,i){if(!t.isWriteable())return;const o=HorizontalLineProperties.is(t)?Vec29.from(0,convert(t.value,i.yAxis)):Vec29.from(convert(t.value,i.xAxis),0);this.translatePoint(t,o,e,i)}translatePoint(t,e,i,o){const s=HorizontalLineProperties.is(t);s?i.x=0:i.y=0;const{point:a}=translate({point:e},i,o);t.value=s?a.y:a.x}stopDragging(){this.middle.toggleDragging(!1)}copy(t,e,i){const o=HorizontalLineProperties.is(t),s=this.isHorizontal?i.yAxis:i.xAxis,a=this.convertCrossLine(t,s);if(!a)return;const r=o?-30:0,n=o?0:-30,l=invertCoords({x:a.x1+n,y:a.y1+r},i);return e.set({value:o?l.y:l.x}),e}getCursor(){return this.activeHandle==null?"pointer":this[this.activeHandle].getCursor()}containsPoint(t,e){const{middle:i,line:o,text:s}=this;return this.activeHandle=void 0,i.containsPoint(t,e)?(this.activeHandle="middle",!0):o.isPointInPath(t,e)||!!s?.containsPoint(t,e)}getNodeAtCoords(t,e){if(this.text?.containsPoint(t,e))return"text";if(this.line.isPointInPath(t,e))return"line";if(this.middle.containsPoint(t,e))return"handle"}getAnchor(){const t=this.computeBBoxWithoutHandles();return this.isHorizontal?{x:t.x+t.width/2,y:t.y}:{x:t.x+t.width,y:t.y+t.height/2,position:"right"}}convertCrossLine(t,e){if(t.value==null)return;let i=0,o=0,s,a;const{bounds:r}=e,n=convert(t.value,e);return HorizontalLineProperties.is(t)?(s=r.width,o=n,a=n):(i=n,s=n,a=r.height),{x1:i,y1:o,x2:s,y2:a}}},import_ag_charts_community63=require("ag-charts-community"),{StateMachine:StateMachine5,StateMachineProperty:StateMachineProperty5,Debug:Debug5}=import_ag_charts_community63._ModuleSupport,CrossLineStateMachine=class extends StateMachine5{constructor(t,e){const i=({point:s})=>{const a=t==="horizontal",r=a?new HorizontalLineProperties:new VerticalLineProperties;r.set({value:a?s.y:s.x}),e.create(r),e.recordAction(`Create ${a?"horizontal-line":"vertical-line"} annotation`)},o=()=>{this.node?.toggleActive(!0),e.showAnnotationOptions(),e.update()};super("start",{start:{click:{target:"waiting-first-render",action:i},drag:{target:"waiting-first-render",action:i},reset:StateMachine5.parent,cancel:StateMachine5.parent},"waiting-first-render":{render:{target:StateMachine5.parent,action:o}}}),this.debug=Debug5.create(!0,"annotations")}};__decorateClass([StateMachineProperty5()],CrossLineStateMachine.prototype,"node",2);var horizontalLineConfig={type:"horizontal-line",datum:HorizontalLineProperties,scene:CrossLineScene,isDatum:HorizontalLineProperties.is,translate:(t,e,i,o)=>{HorizontalLineProperties.is(e)&&CrossLineScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(HorizontalLineProperties.is(e)&&HorizontalLineProperties.is(i)&&CrossLineScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{HorizontalLineProperties.is(e)&&CrossLineScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new CrossLineStateMachine("horizontal",{...t,create:e("horizontal-line")}),dragState:t=>new DragStateMachine(t)},verticalLineConfig={type:"vertical-line",datum:VerticalLineProperties,scene:CrossLineScene,isDatum:VerticalLineProperties.is,translate:(t,e,i,o)=>{VerticalLineProperties.is(e)&&CrossLineScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(VerticalLineProperties.is(e)&&VerticalLineProperties.is(i)&&CrossLineScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{VerticalLineProperties.is(e)&&CrossLineScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new CrossLineStateMachine("vertical",{...t,create:e("vertical-line")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community66=require("ag-charts-community"),import_ag_charts_community65=require("ag-charts-community"),import_ag_charts_community64=require("ag-charts-community"),{Vec4:Vec45}=import_ag_charts_community64._ModuleSupport,WithBackgroundScene=class{static updateBackground(t,e,i,o){const{background:s}=this,{seriesRect:a}=o;s.path.clear(!0);const r=Vec45.from(0,0,a.width,a.height),n=this.getBackgroundPoints(t,e,i,r);for(let c=0;ce.x2,a=e.y1>e.y2,r=a?o.y2:o.y1,n=a?o.y1:o.y2,l=Vec210.from(e);return t.extendEnd&&e.y2===n&&l.push(Vec210.from(s?o.x1:o.x2,a?o.y1:o.y2)),t.extendEnd&&i.y2===r&&l.push(Vec210.from(s?o.x1:o.x2,a?o.y2:o.y1)),l.push(...Vec210.from(i).reverse()),t.extendStart&&i.y1===n&&l.push(Vec210.from(s?o.x2:o.x1,a?o.y1:o.y2)),t.extendStart&&e.y1===r&&l.push(Vec210.from(s?o.x2:o.x1,a?o.y2:o.y1)),l}},import_ag_charts_community67=require("ag-charts-community"),import_ag_charts_core33=require("ag-charts-core"),{StateMachine:StateMachine6,StateMachineProperty:StateMachineProperty6,Debug:Debug6}=import_ag_charts_community67._ModuleSupport,DisjointChannelStateMachine=class extends StateMachine6{constructor(t){const e=({point:l})=>{const c=new DisjointChannelProperties;c.set({start:l,end:l,startHeight:0,endHeight:0}),t.create(c)},i=()=>{const{node:l}=this;l?.toggleActive(!0),l?.toggleHandles({topLeft:!0,topRight:!1,bottomLeft:!1,bottomRight:!1})},o=({offset:l,context:c})=>{const{datum:h,snapping:d}=this;h&&(h.set({end:snapPoint(l,c,d,h.start,h.snapToAngle)}),t.update())},s=()=>{this.node?.toggleHandles({topRight:!0}),t.update()},a=({point:l})=>{const{datum:c,node:h}=this,d=getGroupingValue(c?.end.y),u=getGroupingValue(c?.start.y),{y:p}=l;if(c==null||!(0,import_ag_charts_core33.isNumber)(u)||!(0,import_ag_charts_core33.isNumber)(d)||!(0,import_ag_charts_core33.isNumber)(p))return;const g=d-(p??0),y=(u-d)*2+g,f={x:c?.start.x,y:u-y},x={x:c?.end.x,y:l.y};h?.toggleHandles({bottomLeft:!0,bottomRight:!0}),!(!t.validatePoint(f,{overflowContinuous:!0})||!t.validatePoint(x,{overflowContinuous:!0}))&&(c.set({startHeight:y,endHeight:g}),t.update())},r=({point:l})=>{const{datum:c,node:h}=this,d=getGroupingValue(c?.end.y),u=getGroupingValue(c?.start.y),{y:p}=l;if(c==null||!(0,import_ag_charts_core33.isNumber)(u)||!(0,import_ag_charts_core33.isNumber)(d)||!(0,import_ag_charts_core33.isNumber)(p))return;const g=d-(p??0),y=(u-d)*2+g,f={x:c.start.x,y:u-g},x={x:c.end.x,y:l.y};h?.toggleHandles(!0),!(!t.validatePoint(f,{overflowContinuous:!0})||!t.validatePoint(x,{overflowContinuous:!0}))&&(c.set({startHeight:y,endHeight:g}),t.recordAction("Create disjoint-channel annotation"),t.showAnnotationOptions(),t.update())},n=()=>t.delete();super("start",{start:{click:{target:"waiting-first-render",action:e},drag:{target:"waiting-first-render",action:e},reset:StateMachine6.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:o,drag:o,click:{target:"height",action:s},dragEnd:{target:"height",action:s},reset:{target:StateMachine6.parent,action:n},cancel:{target:StateMachine6.parent,action:n}},height:{hover:a,click:{target:StateMachine6.parent,action:r},drag:{target:StateMachine6.parent,action:r},reset:{target:StateMachine6.parent,action:n},cancel:{target:StateMachine6.parent,action:n}}}),this.debug=Debug6.create(!0,"annotations"),this.snapping=!1}};__decorateClass([StateMachineProperty6()],DisjointChannelStateMachine.prototype,"datum",2),__decorateClass([StateMachineProperty6()],DisjointChannelStateMachine.prototype,"node",2),__decorateClass([StateMachineProperty6()],DisjointChannelStateMachine.prototype,"snapping",2);var disjointChannelConfig={type:"disjoint-channel",datum:DisjointChannelProperties,scene:DisjointChannelScene,isDatum:DisjointChannelProperties.is,translate:(t,e,i,o)=>{DisjointChannelProperties.is(e)&&DisjointChannelScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(DisjointChannelProperties.is(e)&&DisjointChannelProperties.is(i)&&DisjointChannelScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{DisjointChannelProperties.is(e)&&DisjointChannelScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new DisjointChannelStateMachine({...t,create:e("disjoint-channel")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community70=require("ag-charts-community"),import_ag_charts_core35=require("ag-charts-core"),import_ag_charts_community68=require("ag-charts-community"),FIBONACCI_RETRACEMENT_RATIOS=[0,23.6,38.2,50,61.8,78.6,100],FIBONACCI_EXTENSION_RATIOS=[161.8,261.8,361.8,423.6],FIBONACCI_RATIOS=[...FIBONACCI_RETRACEMENT_RATIOS,...FIBONACCI_EXTENSION_RATIOS],FIBONACCI_RATIOS_MAP={10:FIBONACCI_RATIOS,6:FIBONACCI_RETRACEMENT_RATIOS,4:FIBONACCI_RETRACEMENT_RATIOS.filter(t=>t!==78.6&&t!==23.6)},FIBONACCI_RANGE_LABEL_PADDING=10;function getFibonacciCoords(t,e){const{x2:i,y1:o,y2:s}=t,a=o-s;return e==null?{x1:i,x2:i,y1:s-a,y2:s}:{x1:e.x1,x2:e.x2,y1:e.y2-a,y2:e.y2}}function createFibonacciRangesData({x1:t,y1:e,x2:i,y2:o},s,a,r,n=10){const l=e-o,c=a?-1:1;let h=r;const d=[];for(const[u,p]of FIBONACCI_RATIOS_MAP[n].entries()){const g=r+l*(p/100)*c,y=s.yAxis.scaleInvert(g);d.push({id:u,x1:t,x2:i,y1:h,y2:g,tag:p==100?0:1,label:{x1:Math.min(t,i)-FIBONACCI_RANGE_LABEL_PADDING,x2:i,y1:g,y2:g,text:`${(p/100).toFixed(3)} (${y.toFixed(2)})`}}),h=g}return d}var{Vec2:Vec211,Vec4:Vec47}=import_ag_charts_community68._ModuleSupport,FibonacciScene=class extends AnnotationScene{constructor(){super(),this.trendLine=new CollidableLine,this.rangeFillsGroup=new import_ag_charts_community68._ModuleSupport.Group({name:`${this.id}-range-fills`}),this.rangeFillsGroupSelection=import_ag_charts_community68._ModuleSupport.Selection.select(this.rangeFillsGroup,import_ag_charts_community68._ModuleSupport.Range),this.rangeStrokesGroup=new import_ag_charts_community68._ModuleSupport.Group({name:`${this.id}-range-strokes`}),this.rangeStrokesGroupSelection=import_ag_charts_community68._ModuleSupport.Selection.select(this.rangeStrokesGroup,CollidableLine),this.labelsGroup=new import_ag_charts_community68._ModuleSupport.Group({name:`${this.id}-ranges-labels`}),this.labelsGroupSelection=import_ag_charts_community68._ModuleSupport.Selection.select(this.labelsGroup,CollidableText),this.anchor={x:0,y:0,position:"above"},this.append([this.trendLine,this.rangeFillsGroup,this.rangeStrokesGroup,this.labelsGroup])}update(t,e){let i=convertLine(t,e);if(i==null){this.visible=!1;return}if(i=Vec47.round(i),this.visible=t.visible??!0,!this.visible)return;this.updateLine(t,i,this.trendLine),this.updateHandles(t,i),this.updateAnchor(t,i,e);const{reverse:o}=t,s=this.extendLine(i,t,e),a=o?s.y1:s.y2,r=o?s.y2:s.y1,n=createFibonacciRangesData(s,e,t.reverse,a,t.bands);this.updateRanges(t,n,e);const l={...s,y1:r,y2:r};this.updateText(t,l)}extendLine({x1:t,y1:e,x2:i,y2:o},s,a){const r={x1:t,y1:e,x2:i,y2:o};if(!s.extendStart&&!s.extendEnd)return r;const{x:n,width:l}=a.xAxis.bounds;return s.extendEnd&&(r[t>i?"x1":"x2"]=n+l),s.extendStart&&(r[t>i?"x2":"x1"]=n),r}updateLine(t,e,i){if(!e||!i)return;const{lineDashOffset:o,strokeWidth:s,strokeOpacity:a,stroke:r}=t;i.setProperties({...e,lineCap:t.getLineCap(),lineDash:[3,4],lineDashOffset:o,strokeWidth:s,strokeOpacity:a,fillOpacity:0,stroke:r})}updateRangeStrokes(t){const{lineDashOffset:e,strokeWidth:i,strokeOpacity:o,strokes:s,rangeStroke:a,isMultiColor:r}=t;this.rangeStrokesGroupSelection.each((n,{x1:l,x2:c,y2:h,tag:d},u)=>{const p=h,g=r?s[u%s.length]:a;n.setProperties({x1:l,x2:c,y1:p,y2:p,stroke:g,strokeOpacity:o,strokeWidth:i,lineCap:t.getLineCap(),lineDash:t.getLineDash(),lineDashOffset:e,tag:d})})}updateRanges(t,e,i){const o=s=>s.id;this.rangeFillsGroupSelection.update(e,void 0,o),this.rangeStrokesGroupSelection.update(e,void 0,o),this.labelsGroupSelection.update(e,void 0,o),this.updateRangeFills(t),this.updateRangeStrokes(t),this.updateRangeLabels(t,i)}updateRangeFills(t){const{lineDashOffset:e,strokeWidth:i,strokeOpacity:o,strokes:s,rangeStroke:a,showFill:r,isMultiColor:n}=t;this.rangeFillsGroupSelection.each((l,{x1:c,x2:h,y1:d,y2:u},p)=>{const g=n?s[p%s.length]:a;if(!r){l.visible=!1;return}l.setProperties({x1:c,x2:h,y1:d,y2:u,startLine:!1,endLine:!1,stroke:g,strokeOpacity:o,fill:g,fillOpacity:(o??1)*.15,strokeWidth:i,lineCap:t.getLineCap(),lineDash:t.getLineDash(),lineDashOffset:e,visible:!0})})}updateRangeLabels(t,{xAxis:e}){const{rangeStrokesGroupSelection:i}=this,{strokes:o,strokeWidth:s,rangeStroke:a,isMultiColor:r,label:{fontFamily:n,fontSize:l,fontStyle:c,fontWeight:h,color:d}}=t,u={fontFamily:n,fontSize:l,fontStyle:c,fontWeight:h},p=this.checkWithinBounds(e,u,this.labelsGroupSelection.at(0));this.labelsGroupSelection.each((g,y,f)=>{const x=d??(r?o[f%o.length]:a),b=i.at(f);if(!b)return;const{text:m,...S}=y.label;if(p)g.setProperties({...u,text:m,x:S.x1,y:S.y1,textBaseline:"middle",textAlign:"end",fill:x}),updateLineText(g.id,b,S);else{const v={...u,label:m,position:"center",alignment:"left",color:x};updateLineText(g.id,b,S,v,g,m,s)}})}checkWithinBounds(t,e,i){if(!i)return!1;const{text:o,...s}=i.datum.label;i.setProperties({...e,text:o,x:s.x1,y:s.y1,textBaseline:"middle",textAlign:"end"});const{x:a}=i.getBBox();return a>=t.bounds.x&&a<=t.bounds.x+t.bounds.width}updateText(t,e){const i=this.rangeStrokesGroupSelection.selectByTag(0)[0];if(!i)return;const{text:o,strokeWidth:s}=t;this.text=this.updateNode(CollidableText,this.text,!!o.label),updateLineText(i.id,i,e,o,this.text,o.label,s)}updateAnchor(t,e,i,o){const s=Vec47.topCenter(e);Vec211.apply(this.anchor,import_ag_charts_community68._ModuleSupport.Transformable.toCanvasPoint(this.trendLine,s.x,s.y))}containsPoint(t,e){const{trendLine:i,rangeStrokesGroupSelection:o,text:s}=this;let a=!1;return o.each(r=>a||(a=r.isPointInPath(t,e))),a||i.isPointInPath(t,e)||!!s?.containsPoint(t,e)}getNodeAtCoords(t,e){if(this.text?.containsPoint(t,e))return"text";if(this.trendLine.isPointInPath(t,e))return"line"}getHandleStyles(t){return{fill:t.handle.fill,stroke:t.handle.stroke??t.stroke,strokeOpacity:t.handle.strokeOpacity??t.strokeOpacity,strokeWidth:t.handle.strokeWidth??t.strokeWidth}}drag(t,e,i,o){t.isWriteable()&&(this.activeHandle?this.dragHandle(t,e,i,o):this.dragAll(t,e,i))}getAnchor(){return this.anchor}getCursor(){return"pointer"}},import_ag_charts_community69=require("ag-charts-community"),import_ag_charts_core34=require("ag-charts-core"),{ContinuousScale:ContinuousScale3}=import_ag_charts_community69._ModuleSupport;function validateDatumPoint(t,e,i={overflowContinuous:!1},o){if(e.x==null||e.y==null)return o&&import_ag_charts_core34.Logger.warnOnce(`${o}requires both an [x] and [y] property, ignoring.`),!1;const{xAxis:s,yAxis:a}=t,r=i.overflowContinuous&&ContinuousScale3.is(s.scale),n=i.overflowContinuous&&ContinuousScale3.is(a.scale),l=r||validateDatumPointDirection(e.x,s),c=n||validateDatumPointDirection(e.y,a);if(l&&c)return!0;if(o){let h="x & y domains";l&&(h="y domain"),c&&(h="x domain");const d=getGroupingValue(e.x),u=getGroupingValue(e.y);import_ag_charts_core34.Logger.warnOnce(`${o}is outside the ${h}, ignoring. - x: [${d}], y: ${u}]`)}return!1}function validateDatumPointDirection(t,e){const{domain:i}=e.scale,o=getGroupingValue(t);return i&&o!=null&&e.continuous?o>=i[0]&&o<=i.at(-1):!0}var{Vec2:Vec212,Vec4:Vec48}=import_ag_charts_community70._ModuleSupport,FibonacciRetracementTrendBasedScene=class extends FibonacciScene{constructor(){super(),this.type="fibonacci-retracement-trend-based",this.endRetracementLine=new CollidableLine,this.start=new DivariantHandle,this.end=new DivariantHandle,this.endRetracement=new DivariantHandle,this.append([this.endRetracementLine,this.start,this.end,this.endRetracement])}static is(t){return AnnotationScene.isCheck(t,"fibonacci-retracement-trend-based")}update(t,e){let{coords1:i,coords2:o}=this.getCoords(t,e);if(i==null||o==null){this.visible=!1;return}if(i=Vec48.round(i),o=Vec48.round(o),this.visible=t.visible??!0,!this.visible)return;(t.endRetracement.x==null||t.endRetracement.y==null)&&(o=void 0),this.updateLine(t,i,this.trendLine),this.updateLine(t,o,this.endRetracementLine),this.updateHandles(t,i,o),this.updateAnchor(t,o??i,e);const{reverse:s,bands:a}=t,r=getFibonacciCoords(i,o),n=this.extendLine(r,t,e),l=n.y2,c=n.y1,h=o?createFibonacciRangesData(n,e,s,l,a):[];this.updateRanges(t,h,e);const d={...n,y1:c,y2:c};this.updateText(t,d)}containsPoint(t,e){const{start:i,end:o,endRetracement:s,endRetracementLine:a}=this;return this.activeHandle=void 0,i.containsPoint(t,e)?(this.activeHandle="start",!0):o.containsPoint(t,e)?(this.activeHandle="end",!0):s.containsPoint(t,e)?(this.activeHandle="endRetracement",!0):a.isPointInPath(t,e)||super.containsPoint(t,e)}getNodeAtCoords(t,e){return this.start.containsPoint(t,e)||this.end.containsPoint(t,e)||this.endRetracement.containsPoint(t,e)?"handle":this.endRetracementLine.isPointInPath(t,e)?"line":super.getNodeAtCoords(t,e)}dragStart(t,e,i){this.dragState={offset:e,...getDragStartState({start:t.start,end:t.end,endRetracement:t.endRetracement},i)}}stopDragging(){this.start.toggleDragging(!1),this.end.toggleDragging(!1),this.endRetracement.toggleDragging(!1)}dragAll(t,e,i){const{dragState:o}=this;o&&this.translatePoints({datum:t,start:o.start,end:o.end,endRetracement:o.endRetracement,translation:Vec212.sub(e,o.offset),context:i})}dragHandle(t,e,i,o){const{activeHandle:s,dragState:a}=this;if(!s||!a)return;this[s].toggleDragging(!0);const r=o?this.snapToAngle(t,e,i):invertCoords(this[s].drag(e).point,i);!r||!validateDatumPoint(i,r)||(t[s].x=r.x,t[s].y=r.y)}snapToAngle(t,e,i){const{activeHandle:o}=this,s=["start","end","endRetracement"];if(!o)return;const a=(s.indexOf(o)+1)%s.length,r=s[a];this[o].toggleDragging(!0);const n=convertPoint(t[r],i);return invertCoords(snapToAngle(e,n,t.snapToAngle),i)}translatePoints({datum:t,start:e,end:i,endRetracement:o,translation:s,context:a}){const r=translate({start:e,end:i,endRetracement:o},s,a,{overflowContinuous:2});t.start.x=r.start.x,t.end.x=r.end.x,t.endRetracement.x=r.endRetracement.x,t.start.y=r.start.y,t.end.y=r.end.y,t.endRetracement.y=r.endRetracement.y}translate(t,e,i){this.translatePoints({datum:t,start:convertPoint(t.start,i),end:convertPoint(t.end,i),endRetracement:convertPoint(t.endRetracement,i),translation:e,context:i})}copy(t,e,i){const{coords1:o,coords2:s}=this.getCoords(t,i);if(!o||!s)return;const a=this.computeBBoxWithoutHandles();return this.translatePoints({datum:e,start:Vec48.start(o),end:Vec48.end(o),endRetracement:Vec48.end(s),translation:{x:-a.width/2,y:-a.height/2},context:i}),e}getCoords(t,e){return{coords1:convertLine(t,e),coords2:convertLine({start:t.end,end:t.endRetracement},e)}}toggleHandles(t){if(typeof t=="boolean")this.start.visible=t,this.end.visible=t,this.endRetracement.visible=t;else for(const[e,i]of(0,import_ag_charts_core35.entries)(t))this[e].visible=i;this.start.toggleHovered(this.activeHandle==="start"),this.end.toggleHovered(this.activeHandle==="end"),this.endRetracement.toggleHovered(this.activeHandle==="endRetracement")}toggleActive(t){this.toggleHandles(t),this.start.toggleActive(t),this.end.toggleActive(t),this.endRetracement.toggleActive(t)}updateHandles(t,e,i,o){this.start.update({...this.getHandleStyles(t),...this.getHandleCoords(t,e,"start")}),this.end.update({...this.getHandleStyles(t),...this.getHandleCoords(t,e,"end",o)}),i&&this.endRetracement.update({...this.getHandleStyles(t),...this.getHandleCoords(t,i,"endRetracement",o)}),this.start.toggleLocked(t.locked??!1),this.end.toggleLocked(t.locked??!1),this.endRetracement.toggleLocked(t.locked??!1)}getHandleCoords(t,e,i,o){return i==="start"?Vec48.start(e):Vec48.end(e)}},import_ag_charts_community71=require("ag-charts-community"),{StateMachine:StateMachine7,StateMachineProperty:StateMachineProperty7,Debug:Debug7}=import_ag_charts_community71._ModuleSupport,FibonacciRetracementTrendBasedStateMachine=class extends StateMachine7{constructor(t){const e=({point:c})=>{const h=this.createDatum();h.set({start:c,end:c}),t.create(h)},i=()=>{const{node:c}=this;c?.toggleActive(!0),c?.toggleHandles({start:!0,end:!1,endRetracement:!1})},o=({offset:c,context:h})=>{const{datum:d,snapping:u}=this;d&&(d.set({end:snapPoint(c,h,u,d.start,d.snapToAngle)}),t.update())},s=()=>{const{datum:c}=this;c&&(c.endRetracement.x=c.end.x,c.endRetracement.y=c.end.y,this.node?.toggleHandles({end:!0}),t.update())},a=({offset:c,context:h})=>{const{datum:d,snapping:u}=this;d&&(d.set({endRetracement:snapPoint(c,h,u,d.end,d.snapToAngle)}),t.update())},r=()=>{this.node?.toggleHandles({endRetracement:!0}),t.update()},n=()=>t.delete(),l=()=>{t.showAnnotationOptions(),t.recordAction(`Create ${this.datum?.type} annotation`)};super("start",{start:{click:{target:"waiting-first-render",action:e},drag:{target:"waiting-first-render",action:e},reset:StateMachine7.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:o,click:{target:"endRetracement",action:s},drag:o,dragEnd:{target:"endRetracement",action:s},reset:{target:StateMachine7.parent,action:n},cancel:{target:StateMachine7.parent,action:n},onExit:l},endRetracement:{hover:a,click:{target:StateMachine7.parent,action:r},drag:{target:StateMachine7.parent,action:r},reset:{target:StateMachine7.parent,action:n},cancel:{target:StateMachine7.parent,action:n}}}),this.debug=Debug7.create(!0,"annotations"),this.snapping=!1}createDatum(){return new FibonacciRetracementTrendBasedProperties}};__decorateClass([StateMachineProperty7()],FibonacciRetracementTrendBasedStateMachine.prototype,"datum",2),__decorateClass([StateMachineProperty7()],FibonacciRetracementTrendBasedStateMachine.prototype,"node",2),__decorateClass([StateMachineProperty7()],FibonacciRetracementTrendBasedStateMachine.prototype,"snapping",2);var fibonacciRetracementTrendBasedConfig={type:"fibonacci-retracement-trend-based",datum:FibonacciRetracementTrendBasedProperties,scene:FibonacciRetracementTrendBasedScene,isDatum:FibonacciRetracementTrendBasedProperties.is,translate:(t,e,i,o)=>{FibonacciRetracementTrendBasedProperties.is(e)&&FibonacciRetracementTrendBasedScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(FibonacciRetracementTrendBasedProperties.is(e)&&FibonacciRetracementTrendBasedProperties.is(i)&&FibonacciRetracementTrendBasedScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{FibonacciRetracementTrendBasedProperties.is(e)&&FibonacciRetracementTrendBasedScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new FibonacciRetracementTrendBasedStateMachine({...t,create:e("fibonacci-retracement-trend-based")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community72=require("ag-charts-community"),import_ag_charts_core36=require("ag-charts-core"),{Vec2:Vec213,Vec4:Vec49}=import_ag_charts_community72._ModuleSupport,FibonacciRetracementScene=class extends FibonacciScene{constructor(){super(),this.type="fibonacci-retracement",this.start=new DivariantHandle,this.end=new DivariantHandle,this.append([this.start,this.end])}static is(t){return AnnotationScene.isCheck(t,"fibonacci-retracement")}containsPoint(t,e){const{start:i,end:o}=this;return this.activeHandle=void 0,i.containsPoint(t,e)?(this.activeHandle="start",!0):o.containsPoint(t,e)?(this.activeHandle="end",!0):super.containsPoint(t,e)}getNodeAtCoords(t,e){return this.start.containsPoint(t,e)||this.end.containsPoint(t,e)?"handle":super.getNodeAtCoords(t,e)}dragStart(t,e,i){this.dragState={offset:e,...getDragStartState({start:t.start,end:t.end},i)}}stopDragging(){this.start.toggleDragging(!1),this.end.toggleDragging(!1)}dragAll(t,e,i){const{dragState:o}=this;o&&this.translatePoints({datum:t,start:o.start,end:o.end,translation:Vec213.sub(e,o.offset),context:i})}dragHandle(t,e,i,o){const{activeHandle:s,dragState:a}=this;if(!s||!a)return;this[s].toggleDragging(!0);const r=o?this.snapToAngle(t,e,i):invertCoords(this[s].drag(e).point,i);!r||!validateDatumPoint(i,r)||(t[s].x=r.x,t[s].y=r.y)}snapToAngle(t,e,i){const{activeHandle:o}=this,a=["start","end"].find(n=>n!==o);if(!o||!a)return;this[o].toggleDragging(!0);const r=convertPoint(t[a],i);return invertCoords(snapToAngle(e,r,t.snapToAngle),i)}translatePoints({datum:t,start:e,end:i,translation:o,context:s}){const a=translate({start:e,end:i},o,s,{overflowContinuous:1});t.start.x=a.start.x,t.end.x=a.end.x,t.start.y=a.start.y,t.end.y=a.end.y}translate(t,e,i){this.translatePoints({datum:t,start:convertPoint(t.start,i),end:convertPoint(t.end,i),translation:e,context:i})}copy(t,e,i){const o=convertLine(t,i);if(!o)return;const s=this.computeBBoxWithoutHandles();return this.translatePoints({datum:e,start:{x:o.x1,y:o.y1},end:{x:o.x2,y:o.y2},translation:{x:-s.width/2,y:-s.height/2},context:i}),e}toggleHandles(t){if(typeof t=="boolean")this.start.visible=t,this.end.visible=t;else for(const[e,i]of(0,import_ag_charts_core36.entries)(t))this[e].visible=i;this.start.toggleHovered(this.activeHandle==="start"),this.end.toggleHovered(this.activeHandle==="end")}toggleActive(t){this.toggleHandles(t),this.start.toggleActive(t),this.end.toggleActive(t)}updateHandles(t,e,i,o){this.start.update({...this.getHandleStyles(t),...this.getHandleCoords(t,e,"start")}),this.end.update({...this.getHandleStyles(t),...this.getHandleCoords(t,e,"end",o)}),this.start.toggleLocked(t.locked??!1),this.end.toggleLocked(t.locked??!1)}getHandleCoords(t,e,i,o){return i==="start"?Vec49.start(e):Vec49.end(e)}},import_ag_charts_community73=require("ag-charts-community"),{StateMachine:StateMachine8,StateMachineProperty:StateMachineProperty8,Debug:Debug8}=import_ag_charts_community73._ModuleSupport,LineTypeStateMachine=class extends StateMachine8{constructor(t){const e=({point:n})=>{const l=this.createDatum();l.set({start:n,end:n}),t.create(l)},i=()=>{const{node:n}=this;n?.toggleActive(!0),n?.toggleHandles({start:!0,end:!1})},o=({offset:n,context:l})=>{const{datum:c,snapping:h}=this;c&&(c.set({end:snapPoint(n,l,h,c.start,c.snapToAngle)}),t.update())},s=()=>{this.node?.toggleHandles({end:!0}),t.update()},a=()=>t.delete(),r=()=>{t.showAnnotationOptions(),t.recordAction(`Create ${this.datum?.type} annotation`)};super("start",{start:{click:{target:"waiting-first-render",action:e},drag:{target:"waiting-first-render",action:e},reset:StateMachine8.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:o,click:{target:StateMachine8.parent,action:s},drag:o,dragEnd:{target:StateMachine8.parent,action:s},reset:{target:StateMachine8.parent,action:a},cancel:{target:StateMachine8.parent,action:a},onExit:r}}),this.debug=Debug8.create(!0,"annotations"),this.snapping=!1}};__decorateClass([StateMachineProperty8()],LineTypeStateMachine.prototype,"datum",2),__decorateClass([StateMachineProperty8()],LineTypeStateMachine.prototype,"node",2),__decorateClass([StateMachineProperty8()],LineTypeStateMachine.prototype,"snapping",2);var ArrowStateMachine=class extends LineTypeStateMachine{createDatum(){return new ArrowProperties}},LineStateMachine=class extends LineTypeStateMachine{createDatum(){return new LineProperties}},FibonacciRetracementStateMachine=class extends LineTypeStateMachine{createDatum(){return new FibonacciRetracementProperties}},fibonacciRetracementConfig={type:"fibonacci-retracement",datum:FibonacciRetracementProperties,scene:FibonacciRetracementScene,isDatum:FibonacciRetracementProperties.is,translate:(t,e,i,o)=>{FibonacciRetracementProperties.is(e)&&FibonacciRetracementScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(FibonacciRetracementProperties.is(e)&&FibonacciRetracementProperties.is(i)&&FibonacciRetracementScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{FibonacciRetracementProperties.is(e)&&FibonacciRetracementScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new FibonacciRetracementStateMachine({...t,create:e("fibonacci-retracement")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community75=require("ag-charts-community"),import_ag_charts_community74=require("ag-charts-community"),{Vec2:Vec214}=import_ag_charts_community74._ModuleSupport,CapScene=class extends import_ag_charts_community74._ModuleSupport.Group{},ArrowCapScene=class extends CapScene{constructor(){super(),this.type="arrow",this.path=new import_ag_charts_community74._ModuleSupport.Path,this.armLength=6,this.append([this.path])}update(t){const{path:e}=this,{x:i,y:o,angle:s,...a}=t,r=Vec214.from(i,o),n=3*Math.PI/4,l=this.armLength+(t.strokeWidth??0)*2,c=Vec214.rotate(Vec214.from(0,l),s+n,r),h=Vec214.rotate(Vec214.from(l,0),s-n,r);e.setProperties(a),e.fillOpacity=0,e.path.clear(),e.path.moveTo(c.x,c.y),e.path.lineTo(r.x,r.y),e.path.lineTo(h.x,h.y)}},{Vec2:Vec215,Vec4:Vec410}=import_ag_charts_community75._ModuleSupport,LineScene=class extends StartEndScene{constructor(){super(),this.type="line",this.line=new CollidableLine,this.append([this.line,this.start,this.end])}static is(t){return AnnotationScene.isCheck(t,"line")}update(t,e){let i=convertLine(t,e);if(i==null){this.visible=!1;return}i=Vec410.round(i),this.visible=t.visible??!0,this.visible&&(this.updateLine(t,i,e),this.updateHandles(t,i),this.updateText(t,i),this.updateCaps(t,i),this.updateAnchor(t,i,e))}updateLine(t,e,i){const{line:o}=this,{lineDashOffset:s,stroke:a,strokeWidth:r,strokeOpacity:n}=t,l=this.extendLine(e,t,i);o.setProperties({...l,lineCap:t.getLineCap(),lineDash:t.getLineDash(),lineDashOffset:s,stroke:a,strokeWidth:r,strokeOpacity:n,fillOpacity:0})}updateText(t,e){this.text=this.updateNode(CollidableText,this.text,!!t.text.label),updateLineText(this.line.id,this.line,e,t.text,this.text,t.text.label,t.strokeWidth)}updateCaps(t,e){if(!t.startCap&&this.startCap&&(this.startCap.remove(),this.startCap=void 0),!t.endCap&&this.endCap&&(this.endCap.remove(),this.endCap=void 0),!t.startCap&&!t.endCap)return;const{stroke:i,strokeWidth:o,strokeOpacity:s}=t,[a,r]=Vec215.from(e),n=Vec215.angle(Vec215.sub(r,a));t.startCap&&(this.startCap&&this.startCap.type!==t.startCap&&(this.startCap.remove(),this.startCap=void 0),this.startCap==null&&(this.startCap=new ArrowCapScene,this.append([this.startCap])),this.startCap.update({x:a.x,y:a.y,angle:n-Math.PI,stroke:i,strokeWidth:o,strokeOpacity:s})),t.endCap&&(this.endCap&&this.endCap.type!==t.endCap&&(this.endCap.remove(),this.endCap=void 0),this.endCap==null&&(this.endCap=new ArrowCapScene,this.append([this.endCap])),this.endCap.update({x:r.x,y:r.y,angle:n,stroke:i,strokeWidth:o,strokeOpacity:s}))}updateAnchor(t,e,i,o){const s=Vec410.topCenter(e);Vec215.apply(this.anchor,import_ag_charts_community75._ModuleSupport.Transformable.toCanvasPoint(this.line,s.x,s.y))}containsPoint(t,e){const{line:i,text:o}=this;return super.containsPoint(t,e)||i.isPointInPath(t,e)||!!o?.containsPoint(t,e)}getNodeAtCoords(t,e){return this.text?.containsPoint(t,e)?"text":this.line.isPointInPath(t,e)?"line":super.getNodeAtCoords(t,e)}getHandleCoords(t,e,i,o){const{startCap:s,endCap:a}=this;let[r,n]=Vec215.from(e);const l=Vec215.angle(Vec215.sub(n,r));return s&&(r=Vec215.rotate(Vec215.from(0,-DivariantHandle.HANDLE_SIZE/2),l,r)),a&&(n=Vec215.rotate(Vec215.from(0,DivariantHandle.HANDLE_SIZE/2),l,n)),i==="start"?r:n}getHandleStyles(t){return{fill:t.handle.fill,stroke:t.handle.stroke??t.stroke,strokeOpacity:t.handle.strokeOpacity??t.strokeOpacity,strokeWidth:t.handle.strokeWidth??t.strokeWidth}}},lineConfig={type:"line",datum:LineProperties,scene:LineScene,isDatum:LineProperties.is,translate:(t,e,i,o)=>{LineProperties.is(e)&&LineScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(LineProperties.is(e)&&LineProperties.is(i)&&LineScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{LineProperties.is(e)&&LineScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new LineStateMachine({...t,create:e("line")}),dragState:t=>new DragStateMachine(t)},arrowConfig={type:"arrow",datum:ArrowProperties,scene:LineScene,isDatum:ArrowProperties.is,translate:(t,e,i,o)=>{ArrowProperties.is(e)&&LineScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(ArrowProperties.is(e)&&ArrowProperties.is(i)&&LineScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{ArrowProperties.is(e)&&LineScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new ArrowStateMachine({...t,create:e("arrow")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community78=require("ag-charts-community"),import_ag_charts_core37=require("ag-charts-core"),import_ag_charts_community77=require("ag-charts-community"),import_ag_charts_community76=require("ag-charts-community");function layoutScenesRow(t,e=0,i=0){let o=e;for(const s of t)if(Array.isArray(s)){for(const a of s)layoutSetX(a,o);o+=import_ag_charts_community76._ModuleSupport.Group.computeChildrenBBox(s).width+i}else layoutSetX(s,o),o+=s.getBBox().width+i}function layoutScenesColumn(t,e=0,i=0){let o=e;for(const s of t)if(Array.isArray(s)){for(const a of s)layoutSetY(a,o);o+=import_ag_charts_community76._ModuleSupport.Group.computeChildrenBBox(s).height+i}else layoutSetY(s,o),o+=s.getBBox().height+i}function layoutSetX(t,e){"x1"in t?(t.x2=e+(t.x2-t.x1),t.x1=e):t.x=e}function layoutSetY(t,e){"y1"in t?(t.y2=e+(t.y2-t.y1),t.y1=e):t.y=e}function layoutAddX(t,e){"x1"in t?(t.x1+=e,t.x2+=e):t.x+=e}function layoutAddY(t,e){"y1"in t?(t.y1+=e,t.y2+=e):t.y+=e}var{Vec4:Vec411}=import_ag_charts_community77._ModuleSupport,MeasurerStatisticsScene=class extends import_ag_charts_community77._ModuleSupport.Group{constructor(){super(),this.name="MeasurerStatisticsScene",this.background=new import_ag_charts_community77._ModuleSupport.Rect,this.dateRangeBarsText=new import_ag_charts_community77._ModuleSupport.Text,this.dateRangeDivider=new import_ag_charts_community77._ModuleSupport.Line,this.dateRangeValueText=new import_ag_charts_community77._ModuleSupport.Text,this.priceRangeValueText=new import_ag_charts_community77._ModuleSupport.Text,this.priceRangeDivider=new import_ag_charts_community77._ModuleSupport.Line,this.priceRangePercentageText=new import_ag_charts_community77._ModuleSupport.Text,this.volumeText=new import_ag_charts_community77._ModuleSupport.Text,this.volumeFormatter=new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:2,maximumFractionDigits:2}),this.append([this.background,this.dateRangeBarsText,this.dateRangeDivider,this.dateRangeValueText,this.priceRangeValueText,this.priceRangeDivider,this.priceRangePercentageText,this.volumeText])}update(t,e,i,o,s,a,r){this.verticalDirection=a;const n=this.updateStatistics(t,e,i,r),l=import_ag_charts_community77._ModuleSupport.Group.computeChildrenBBox(n.flat()),c=10;l.grow(c),this.updateBackground(t,l,c),this.reposition(n,c,s),this.checkVisibility(t,s,o)}checkVisibility(t,e,i){const o=Vec411.from(new import_ag_charts_community77._ModuleSupport.BBox(0,0,e.seriesRect.width,e.seriesRect.height));Vec411.collides(i,o)?this.visible=t.visible??!0:this.visible=!1}updateStatistics(t,e,i,o){const{dateRangeBarsText:s,dateRangeDivider:a,dateRangeValueText:r,priceRangeValueText:n,priceRangeDivider:l,priceRangePercentageText:c,volumeText:h}=this,d=8,u=6,p=t.statistics.fontSize+3,g=-2,y=this.getTextStyles(t),f={...this.getDividerStyles(t),x1:0,y1:0,x2:0,y2:p},x=[s,a,r],b=[n,l,c],m=[];return e.priceRange&&(n.setProperties({...y,text:this.formatPriceRangeValue(e.priceRange.value,o)}),l.setProperties(f),c.setProperties({...y,text:this.formatPriceRangePercentage(e.priceRange.percentage,o)}),layoutScenesRow(b,i.x,d),m.push(b)),e.dateRange&&(s.setProperties({...y,text:this.formatDateRangeBars(e.dateRange.bars,o)}),a.setProperties(f),r.setProperties({...y,text:this.formatDateRangeValue(e.dateRange.value)}),layoutScenesRow(x,i.x,d),m.push(x)),e.volume==null?h.visible=!1:(h.setProperties({...y,x:i.x,text:this.formatVolume(e.volume,o),visible:!0}),m.push(h)),layoutScenesColumn(m,i.y,u),l.y1+=g,l.y2+=g,a.y1+=g,a.y2+=g,m}updateBackground(t,e,i){const o=this.getBackgroundStyles(t);this.background.setProperties({...o,...e,x:e.x-e.width/2+i,y:e.y})}reposition(t,e,i){const{width:o,height:s}=i.seriesRect,a=Vec411.from(this.background.getBBox());let r=0;a.x1<0&&(r=-a.x1),a.x2>o&&(r=o-a.x2);const n=Math.min(e,s-a.y2);for(const l of t)if(Array.isArray(l)){const c=import_ag_charts_community77._ModuleSupport.Group.computeChildrenBBox(l).width;for(const h of l)layoutAddX(h,r-c/2),layoutAddY(h,n)}else layoutAddX(l,r-l.getBBox().width/2),layoutAddY(l,n);this.background.x+=r,this.background.y+=n}getTextStyles(t){return{fill:t.statistics.color,fontFamily:t.statistics.fontFamily,fontSize:t.statistics.fontSize,fontStyle:t.statistics.fontStyle,fontWeight:t.statistics.fontWeight,textBaseline:"top"}}getDividerStyles(t){return{stroke:t.statistics.divider.stroke,strokeOpacity:t.statistics.divider.strokeOpacity,strokeWidth:t.statistics.divider.strokeWidth}}getBackgroundStyles(t){return{fill:t.statistics.fill,stroke:t.statistics.stroke,strokeOpacity:t.statistics.strokeOpacity,strokeWidth:t.statistics.strokeWidth,cornerRadius:4}}formatDateRangeBars(t,e){return e?.t("measurerDateRangeBars",{value:t})??`${t}`}formatDateRangeValue(t){const e=[],i=t>=0?"":"-";t=Math.abs(t);const o=1e3*60,s=o*60,a=s*24,r=Math.floor(t/o),n=Math.floor(t/s),l=Math.floor(t/a),c=n%(a/s),h=r%(s/o);return l>=1&&e.push(`${l}d`),n>=1&&(t=o.x-h.x&&(l={x:o.x,y:n.clipMask.y,radius:this.text.getBBox().height/2+Vec216.length(h)})}this.verticalLine.setClipMask(r,l)}updateCaps(t,e){const{horizontalEndCap:i,verticalEndCap:o}=this,{direction:s}=t,{x1:a,y1:r,x2:n,y2:l}=e,c=Vec216.round(Vec412.center(e),0),{stroke:h,strokeWidth:d,strokeOpacity:u}=this.getLineStyles(t),p={stroke:h,strokeWidth:d,strokeOpacity:u};if(s!=="vertical"){const g=a<=n?0:Math.PI;let y=n;s==="horizontal"&&(y+=a<=n?-2:2),i.update({...p,x:y,y:c.y,angle:g})}if(s!=="horizontal"){const g=r<=l?Math.PI/2:Math.PI/-2;let y=l;s==="vertical"&&(y+=r<=l?-2:2),o.update({...p,x:c.x,y,angle:g})}}updateBoundingLines(t,e){const{verticalStartLine:i,verticalEndLine:o,horizontalStartLine:s,horizontalEndLine:a}=this,{direction:r}=t,{x1:n,y1:l,x2:c,y2:h}=e,d=this.getLineStyles(t);r==="horizontal"&&(i.setProperties({...d,x1:n,y1:l,x2:n,y2:h}),o.setProperties({...d,x1:c,y1:l,x2:c,y2:h})),r==="vertical"&&(s.setProperties({...d,x1:n,y1:l,x2:c,y2:l}),a.setProperties({...d,x1:n,y1:h,x2:c,y2:h}))}updateStatistics(t,e,i){const o=Vec216.add(Vec412.bottomCenter(e),Vec216.from(0,10)),s={volume:this.getVolume(t)};t.hasPriceRange&&(s.priceRange={percentage:this.getPriceRangePercentage(t),value:this.getPriceRangeValue(t)}),t.hasDateRange&&(s.dateRange={bars:this.getDateRangeBars(e,i),value:this.getDateRangeValue(t)}),this.statistics.update(t,s,o,e,i,this.verticalDirection,t.localeManager)}updateAnchor(t,e,i,o){const s=Vec412.topCenter(e);Vec216.apply(this.anchor,import_ag_charts_community78._ModuleSupport.Transformable.toCanvasPoint(this.horizontalLine,s.x,s.y))}getBackgroundPoints(t,e,i,o){const[s,a]=Vec216.from(e),[r,n]=Vec216.from(i);return[s,a,n,r]}getLineStyles(t){const{lineDashOffset:e,stroke:i,strokeWidth:o,strokeOpacity:s}=t;return{lineCap:t.getLineCap(),lineDash:t.getLineDash(),lineDashOffset:e,stroke:i,strokeWidth:o,strokeOpacity:s,fillOpacity:0}}getBackgroundStyles(t){const{background:e}=t;return{fill:e.fill,fillOpacity:e.fillOpacity}}getHandleStyles(t){return{fill:t.handle.fill,stroke:t.handle.stroke??t.stroke,strokeOpacity:t.handle.strokeOpacity??t.strokeOpacity,strokeWidth:t.handle.strokeWidth??t.strokeWidth}}containsPoint(t,e){const{horizontalLine:i,text:o,verticalLine:s,horizontalStartLine:a,horizontalEndLine:r,verticalStartLine:n,verticalEndLine:l}=this;return super.containsPoint(t,e)||i.isPointInPath(t,e)||s.isPointInPath(t,e)||a.visible&&a.isPointInPath(t,e)||r.visible&&r.isPointInPath(t,e)||n.visible&&n.isPointInPath(t,e)||l.visible&&l.isPointInPath(t,e)||!!o?.containsPoint(t,e)}getNodeAtCoords(t,e){return this.text?.containsPoint(t,e)?"text":this.start.containsPoint(t,e)||this.end.containsPoint(t,e)?"handle":"line"}getDateRangeBars(t,e){const{step:i}=e.xAxis.scale,o=t.x1<=t.x2?1:-1;return i?Math.round(Vec412.width(t)/i)*o:0}getDateRangeValue(t){const e=getGroupingValue(t.start.x),i=getGroupingValue(t.end.x);if(!(0,import_ag_charts_core37.isDate)(e)||!(0,import_ag_charts_core37.isDate)(i))throw new Error("Can not create a date range measurement of non-date x-axis.");return i.getTime()-e.getTime()}getPriceRangePercentage(t){if(t.start.y==null||t.end.y==null)throw new Error("Can not create a price range measurement of a non-numeric y-axis");const e=getGroupingValue(t.end.y),i=getGroupingValue(t.start.y);if(!(0,import_ag_charts_core37.isNumber)(e)||!(0,import_ag_charts_core37.isNumber)(i))throw new Error("Can not create a price range measurement of a non-numeric y-axis");return(e-i)/i}getPriceRangeValue(t){if(t.start.y==null||t.end.y==null)throw new Error("Can not create a price range measurement of a non-numeric y-axis");const e=getGroupingValue(t.end.y),i=getGroupingValue(t.start.y);if(!(0,import_ag_charts_core37.isNumber)(e)||!(0,import_ag_charts_core37.isNumber)(i))throw new Error("Can not create a price range measurement of a non-numeric y-axis");return e-i}getVolume(t){return t.getVolume(t.start.x,t.end.x)}},QuickMeasurerScene=class extends MeasurerScene{constructor(){super(...arguments),this.type="quick-measurer"}static is(t){return AnnotationScene.isCheck(t,"quick-measurer")}createStatisticsScene(){return new QuickMeasurerStatisticsScene}getDirectionStyles(t){return this.verticalDirection==="down"?t.down:t.up}getLineStyles(t){const e=this.getDirectionStyles(t);return{...super.getLineStyles(t),stroke:e.stroke,strokeWidth:e.strokeWidth,strokeOpacity:e.strokeOpacity}}getBackgroundStyles(t){const e=this.getDirectionStyles(t);return{fill:e.fill,fillOpacity:e.fillOpacity}}getHandleStyles(t){const e=this.getDirectionStyles(t);return{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity??e.strokeOpacity,strokeWidth:e.handle.strokeWidth??e.strokeWidth}}},import_ag_charts_community79=require("ag-charts-community"),{StateMachine:StateMachine9,StateMachineProperty:StateMachineProperty9,Debug:Debug9}=import_ag_charts_community79._ModuleSupport,MeasurerTypeStateMachine=class extends StateMachine9{constructor(t){const e=({point:r})=>{const n=this.createDatum();n.set({start:r,end:r}),t.create(n)},i=({point:r})=>{const{datum:n,node:l}=this;n?.set({end:r}),l?.toggleActive(!0),l?.toggleHandles({end:!1}),t.update()},o=()=>{this.node?.toggleHandles({end:!0})},s=()=>t.delete(),a=()=>{t.showAnnotationOptions(),t.recordAction(`Create ${this.node?.type} annotation`)};super("start",{start:{reset:StateMachine9.parent,click:{target:"end",action:e},drag:{target:"end",action:e}},end:{hover:i,drag:i,click:{target:StateMachine9.parent,action:o},dragEnd:{target:StateMachine9.parent,action:o},reset:{target:StateMachine9.parent,action:s},cancel:{target:StateMachine9.parent,action:s},onExit:a}}),this.debug=Debug9.create(!0,"annotations")}};__decorateClass([StateMachineProperty9()],MeasurerTypeStateMachine.prototype,"datum",2),__decorateClass([StateMachineProperty9()],MeasurerTypeStateMachine.prototype,"node",2);var DateRangeStateMachine=class extends MeasurerTypeStateMachine{createDatum(){return new DateRangeProperties}},PriceRangeStateMachine=class extends MeasurerTypeStateMachine{createDatum(){return new PriceRangeProperties}},DatePriceRangeStateMachine=class extends MeasurerTypeStateMachine{createDatum(){return new DatePriceRangeProperties}},QuickDatePriceRangeStateMachine=class extends MeasurerTypeStateMachine{createDatum(){return new QuickDatePriceRangeProperties}},dateRangeConfig={type:"date-range",datum:DateRangeProperties,scene:MeasurerScene,isDatum:DateRangeProperties.is,translate:(t,e,i,o)=>{DateRangeProperties.is(e)&&MeasurerScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(DateRangeProperties.is(e)&&DateRangeProperties.is(i)&&MeasurerScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{DateRangeProperties.is(e)&&MeasurerScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new DateRangeStateMachine({...t,create:e("date-range")}),dragState:t=>new DragStateMachine(t)},priceRangeConfig={type:"price-range",datum:PriceRangeProperties,scene:MeasurerScene,isDatum:PriceRangeProperties.is,translate:(t,e,i,o)=>{PriceRangeProperties.is(e)&&MeasurerScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(PriceRangeProperties.is(e)&&PriceRangeProperties.is(i)&&MeasurerScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{PriceRangeProperties.is(e)&&MeasurerScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new PriceRangeStateMachine({...t,create:e("date-range")}),dragState:t=>new DragStateMachine(t)},datePriceRangeConfig={type:"date-price-range",datum:DatePriceRangeProperties,scene:MeasurerScene,isDatum:DatePriceRangeProperties.is,translate:(t,e,i,o)=>{DatePriceRangeProperties.is(e)&&MeasurerScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(DatePriceRangeProperties.is(e)&&DatePriceRangeProperties.is(i)&&MeasurerScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{DatePriceRangeProperties.is(e)&&MeasurerScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new DatePriceRangeStateMachine({...t,create:e("date-range")}),dragState:t=>new DragStateMachine(t)},quickDatePriceRangeConfig={type:"quick-date-price-range",datum:QuickDatePriceRangeProperties,scene:QuickMeasurerScene,isDatum:QuickDatePriceRangeProperties.is,translate:(t,e,i,o)=>{QuickDatePriceRangeProperties.is(e)&&QuickMeasurerScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(QuickDatePriceRangeProperties.is(e)&&QuickDatePriceRangeProperties.is(i)&&QuickMeasurerScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{QuickDatePriceRangeProperties.is(e)&&QuickMeasurerScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new QuickDatePriceRangeStateMachine({...t,create:e("quick-date-price-range")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community80=require("ag-charts-community"),import_ag_charts_core38=require("ag-charts-core"),{ZIndexMap:ZIndexMap3}=import_ag_charts_community80._ModuleSupport,NoteScene=class extends TextualPointScene{constructor(){super(),this.type="note",this.shape=new import_ag_charts_community80._ModuleSupport.Rect,this.iconBackground=new import_ag_charts_community80._ModuleSupport.TranslatableSvgPath("M22 1.83333C22 0.820811 21.1792 0 20.1667 0H1.83333C0.820811 0 0 0.82081 0 1.83333V13.9868C0 14.9994 0.820811 15.8202 1.83333 15.8202L5.88971 15.8202C6.44575 15.8202 6.97175 16.0725 7.31971 16.5062L9.57006 19.3112C10.304 20.2259 11.6962 20.2259 12.4301 19.3112L14.6804 16.5062C15.0284 16.0725 15.5544 15.8202 16.1104 15.8202L20.1667 15.8202C21.1792 15.8202 22 14.9994 22 13.9868V1.83333Z"),this.iconLines=new import_ag_charts_community80._ModuleSupport.TranslatableSvgPath("M17.1114 5.75C17.1114 6.16421 16.7756 6.5 16.3614 6.5H5.63916C5.22495 6.5 4.88916 6.16421 4.88916 5.75V5.75C4.88916 5.33579 5.22495 5 5.63916 5H16.3614C16.7756 5 17.1114 5.33579 17.1114 5.75V5.75ZM17.1114 9.25C17.1114 9.66421 16.7756 10 16.3614 10H5.63916C5.22495 10 4.88916 9.66421 4.88916 9.25V9.25C4.88916 8.83579 5.22495 8.5 5.63916 8.5H16.3614C16.7756 8.5 17.1114 8.83579 17.1114 9.25V9.25Z"),this.active=!1,this.shape.visible=!1,this.label.visible=!1,this.iconBackground.fillShadow=new import_ag_charts_community80._ModuleSupport.DropShadow,this.append([this.shape,this.label,this.iconBackground,this.iconLines,this.handle])}static is(t){return AnnotationScene.isCheck(t,"note")}update(t,e){this.updateIcon(t,e),super.update(t,e)}getTextBBox(t,e,i){const o=super.getTextBBox(t,e,i);o.x-=t.width/2,o.x=(0,import_ag_charts_core38.clamp)(0,o.x,i.seriesRect.width-t.width);const s=t.getPadding().top,a=o.y-LABEL_OFFSET-s*2,r=o.y+DivariantHandle.HANDLE_SIZE+s*2;return a-o.height-TOOLBAR_OFFSET<0?(o.y=r,t.position="top"):(o.y=a+s,t.position="bottom"),o}updateLabel(t,e){const i=t.visible===!1?!1:this.label.visible;super.updateLabel(t,e),this.label.visible=i,this.label.text=(0,import_ag_charts_core38.wrapText)(t.text,{maxWidth:200,font:t,textWrap:"always",avoidOrphans:!1})}updateShape(t,e){const{shape:i}=this;i.fill=t.background.fill,i.fillOpacity=t.background.fillOpacity??1,i.stroke=t.background.stroke,i.strokeOpacity=t.background.strokeOpacity??1,i.strokeWidth=t.background.strokeWidth??1,i.cornerRadius=4;const o=t.getPadding().top,s=t.position==="top";i.x=e.x-o,i.width=t.width+o*2,i.height=e.height+o*2,i.y=e.y+(s?0:-e.height)-o}updateIcon(t,e){const{active:i,iconBackground:o,iconLines:s}=this,{x:a,y:r}=convertPoint(t,e);o.translationX=a-ICON_WIDTH/2,o.translationY=r-ICON_HEIGHT,s.translationX=o.translationX,s.translationY=o.translationY,o.fill=t.fill,o.fillOpacity=t.fillOpacity??1,o.stroke=t.stroke,o.strokeOpacity=t.strokeOpacity??1,o.strokeWidth=t.strokeWidth??1,s.fill=t.stroke,i?o.fillShadow.color=t.fill??"rgba(0, 0, 0, 0.22)":o.fillShadow.color="rgba(0, 0, 0, 0.22)"}updateAnchor(t,e,i){const o=t.getPadding().top,s=t.position==="top",a=s?1:-1;return{x:e.x+i.seriesRect.x+t.width/2,y:e.y+i.seriesRect.y+a*(e.height+o),position:s?"below":"above"}}getLabelCoords(t,e){const i=t.position==="top",o=t.getPadding().top+(0,import_ag_charts_core38.calcLineHeight)(t.fontSize,ANNOTATION_TEXT_LINE_HEIGHT)/2;return{x:e.x,y:e.y+(i?o/2:0)}}getTextBaseline(t){return t.position==="top"?"middle":t.position}getHandleCoords(t,e,i){return{x:e.x,y:e.y+DivariantHandle.HANDLE_SIZE/2+4}}getHandleStyles(t){return{fill:t.handle.fill,stroke:t.handle.stroke??t.fill,strokeOpacity:t.handle.strokeOpacity,strokeWidth:t.handle.strokeWidth}}toggleHovered(t,e,i){super.toggleHovered(t,e,i);const o=t||e&&!i;this.label.visible=o,this.shape.visible=o,this.zIndex=o?ZIndexMap3.CHART_ANNOTATION_FOCUSED:ZIndexMap3.CHART_ANNOTATION}toggleActive(t){super.toggleActive(t),this.label.visible=t,this.shape.visible=t,this.active=t}containsPoint(t,e){return this.shape.visible&&this.shape.containsPoint(t,e)||this.iconBackground.containsPoint(t,e)?!0:super.containsPoint(t,e)}},NoteStateMachine=class extends TextualPointStateMachine{createDatum(){return new NoteProperties}},noteConfig={type:"note",datum:NoteProperties,scene:NoteScene,isDatum:NoteProperties.is,translate:(t,e,i,o)=>{NoteProperties.is(e)&&NoteScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(NoteProperties.is(e)&&NoteProperties.is(i)&&NoteScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{NoteProperties.is(e)&&NoteScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new NoteStateMachine({...t,create:e("note")}),dragState:t=>new DragStateMachine(t)},import_ag_charts_community81=require("ag-charts-community"),{Vec2:Vec217,Vec4:Vec413}=import_ag_charts_community81._ModuleSupport,ParallelChannelScene=class extends ChannelScene{constructor(){super(),this.type="parallel-channel",this.handles={topLeft:new DivariantHandle,topMiddle:new UnivariantHandle,topRight:new DivariantHandle,bottomLeft:new DivariantHandle,bottomMiddle:new UnivariantHandle,bottomRight:new DivariantHandle},this.middleLine=new CollidableLine,this.append([this.background,this.topLine,this.middleLine,this.bottomLine,...Object.values(this.handles)])}static is(t){return AnnotationScene.isCheck(t,"parallel-channel")}dragHandle(t,e,i,o){const{activeHandle:s,handles:a}=this;if(s==null)return;const{offset:r}=a[s].drag(e);a[s].toggleDragging(!0),(s==="topMiddle"||s==="bottomMiddle")&&(r.x=0);let n=[],l=o;switch(s){case"topLeft":case"bottomLeft":n=["topLeft","bottomLeft"];break;case"topMiddle":n=["topLeft","topRight"],r.y-=UnivariantHandle.HANDLE_SIZE/2,l=!1;break;case"topRight":case"bottomRight":n=["topRight","bottomRight"];break;case"bottomMiddle":n=["bottomLeft","bottomRight"],r.y-=UnivariantHandle.HANDLE_SIZE/2,l=!1;break}const c=convertLine(t,i),h=convertLine(t.bottom,i);if(!c||!h)return;const d={topLeft:Vec413.start(c),topRight:Vec413.end(c),bottomLeft:Vec413.start(h),bottomRight:Vec413.end(h)},u={vectors:{topLeft:d.topRight,bottomLeft:d.bottomRight,topRight:d.topLeft,bottomRight:d.bottomLeft},angle:t.snapToAngle},p=translate(d,r,i,{overflowContinuous:this.overflowContinuous,translateVectors:n,snap:l?u:void 0});t.start.x=p.topLeft.x,t.start.y=p.topLeft.y,t.end.x=p.topRight.x,t.end.y=p.topRight.y,t.height=p.topLeft.y-p.bottomLeft.y}getTranslatePointsVectors(t,e){const{bottomLeft:i,topLeft:o}=this.handles,s=i.getBBox().y-o.getBBox().y,a=Vec217.add(t,Vec217.from(0,s)),r=Vec217.add(e,Vec217.from(0,s));return{start:t,end:e,bottomStart:a,bottomEnd:r}}containsPoint(t,e){return super.containsPoint(t,e)||this.middleLine.visible&&this.middleLine.strokeWidth>0&&this.middleLine.containsPoint(t,e)}getNodeAtCoords(t,e){return this.middleLine.visible&&this.middleLine.strokeWidth>0&&this.middleLine.containsPoint(t,e)?"line":super.getNodeAtCoords(t,e)}updateLines(t,e,i,o,s,a){const{topLine:r,middleLine:n,bottomLine:l}=this,{lineDashOffset:c,stroke:h,strokeOpacity:d,strokeWidth:u}=t,p=t.getLineDash(),g={lineCap:t.getLineCap(),lineDash:p,lineDashOffset:c,stroke:h,strokeOpacity:d,strokeWidth:u};r.setProperties({...e,...g}),l.setProperties({...i,...g});const y=this.extendLine({x1:s.x1,y1:a.y1+(s.y1-a.y1)/2,x2:s.x2,y2:a.y2+(s.y2-a.y2)/2},t,o);n.setProperties({...y,lineDash:t.middle.lineDash??p,lineDashOffset:t.middle.lineDashOffset??c,stroke:t.middle.stroke??h,strokeOpacity:t.middle.strokeOpacity??d,strokeWidth:t.middle.strokeWidth??u,visible:t.middle.visible??!0})}updateHandles(t,e,i){const{handles:{topLeft:o,topMiddle:s,topRight:a,bottomLeft:r,bottomMiddle:n,bottomRight:l}}=this,c={fill:t.handle.fill,stroke:t.handle.stroke??t.stroke,strokeOpacity:t.handle.strokeOpacity??t.strokeOpacity,strokeWidth:t.handle.strokeWidth??t.strokeWidth};o.update({...c,...Vec413.start(e)}),a.update({...c,...Vec413.end(e)}),r.update({...c,...Vec413.start(i)}),l.update({...c,...Vec413.end(i)}),s.update({...c,...Vec217.sub(Vec413.center(e),Vec217.from(s.handle.width/2,s.handle.height/2))}),n.update({...c,...Vec217.sub(Vec413.center(i),Vec217.from(n.handle.width/2,n.handle.height/2))})}updateText(t,e,i){this.text=this.updateNode(CollidableText,this.text,!!t.text.label),updateChannelText(!0,e,i,t.text,t.strokeWidth,this.text,t.text.label)}getBackgroundPoints(t,e,i,o){const s=e.x1>e.x2,a=e.y1>e.y2,r=e.x1!==i.x1&&e.y1!==i.y1,n=e.x2!==i.x2&&e.y2!==i.y2,l=Vec217.from(e);return t.extendEnd&&n&&l.push(Vec217.from(s?o.x1:o.x2,a?o.y1:o.y2)),l.push(...Vec217.from(i).reverse()),t.extendStart&&r&&l.push(Vec217.from(s?o.x2:o.x1,a?o.y2:o.y1)),l}},import_ag_charts_community82=require("ag-charts-community"),import_ag_charts_core39=require("ag-charts-core"),{StateMachine:StateMachine10,StateMachineProperty:StateMachineProperty10,Debug:Debug10}=import_ag_charts_community82._ModuleSupport,ParallelChannelStateMachine=class extends StateMachine10{constructor(t){const e=({point:l})=>{const c=new ParallelChannelProperties;c.set({start:l,end:l,height:0}),t.create(c)},i=()=>{const{node:l}=this;l?.toggleActive(!0),l?.toggleHandles({topLeft:!0,topMiddle:!1,topRight:!1,bottomLeft:!1,bottomMiddle:!1,bottomRight:!1})},o=({offset:l,context:c})=>{const{datum:h,snapping:d}=this;h&&(h.set({end:snapPoint(l,c,d,h.start,h.snapToAngle)}),t.update())},s=()=>{this.node?.toggleHandles({topRight:!0}),t.update()},a=({point:l})=>{const{datum:c,node:h}=this,d=getGroupingValue(c?.end.y),u=getGroupingValue(c?.start.y),{y:p}=l;if(c==null||!(0,import_ag_charts_core39.isNumber)(u)||!(0,import_ag_charts_core39.isNumber)(d)||!(0,import_ag_charts_core39.isNumber)(p))return;const g=d-(p??0),y=u-g;h?.toggleHandles({bottomLeft:!0,bottomRight:!0}),!(!t.validatePoint({x:c.start.x,y},{overflowContinuous:!0})||!t.validatePoint({x:c.end.x,y:l.y},{overflowContinuous:!0}))&&(c.set({height:g}),t.update())},r=({point:l})=>{const{datum:c,node:h}=this,d=getGroupingValue(c?.end.y),u=getGroupingValue(c?.start.y),{y:p}=l;if(c==null||!(0,import_ag_charts_core39.isNumber)(u)||!(0,import_ag_charts_core39.isNumber)(d)||!(0,import_ag_charts_core39.isNumber)(p))return;const g=d-(p??0),y=u-g;h?.toggleHandles(!0),!(!t.validatePoint({x:c.start.x,y},{overflowContinuous:!0})||!t.validatePoint({x:c.end.x,y:l.y},{overflowContinuous:!0}))&&(c.set({height:g}),t.recordAction("Create parallel-channel annotation"),t.showAnnotationOptions(),t.update())},n=()=>t.delete();super("start",{start:{click:{target:"waiting-first-render",action:e},drag:{target:"waiting-first-render",action:e},reset:StateMachine10.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:o,drag:o,click:{target:"height",action:s},dragEnd:{target:"height",action:s},reset:{target:StateMachine10.parent,action:n},cancel:{target:StateMachine10.parent,action:n}},height:{hover:a,click:{target:StateMachine10.parent,action:r},drag:{target:StateMachine10.parent,action:r},reset:{target:StateMachine10.parent,action:n},cancel:{target:StateMachine10.parent,action:n}}}),this.debug=Debug10.create(!0,"annotations"),this.snapping=!1}};__decorateClass([StateMachineProperty10()],ParallelChannelStateMachine.prototype,"datum",2),__decorateClass([StateMachineProperty10()],ParallelChannelStateMachine.prototype,"node",2),__decorateClass([StateMachineProperty10()],ParallelChannelStateMachine.prototype,"snapping",2);var parallelChannelConfig={type:"parallel-channel",datum:ParallelChannelProperties,scene:ParallelChannelScene,isDatum:ParallelChannelProperties.is,translate:(t,e,i,o)=>{ParallelChannelProperties.is(e)&&ParallelChannelScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(ParallelChannelProperties.is(e)&&ParallelChannelProperties.is(i)&&ParallelChannelScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{ParallelChannelProperties.is(e)&&ParallelChannelScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new ParallelChannelStateMachine({...t,create:e("parallel-channel")}),dragState:t=>new DragStateMachine(t)},TextScene=class extends TextualPointScene{constructor(){super(),this.type="text",this.append([this.label,this.handle])}static is(t){return AnnotationScene.isCheck(t,"text")}getHandleCoords(t,e){const i=DivariantHandle.HANDLE_SIZE/2;return{x:e.x+i,y:e.y+2+i}}},TextStateMachine=class extends TextualPointStateMachine{createDatum(){return new TextProperties}},textConfig={type:"text",datum:TextProperties,scene:TextScene,isDatum:TextProperties.is,translate:(t,e,i,o)=>{TextProperties.is(e)&&TextScene.is(t)&&t.translate(e,i,o)},copy:(t,e,i,o)=>{if(TextProperties.is(e)&&TextProperties.is(i)&&TextScene.is(t))return t.copy(e,i,o)},update:(t,e,i)=>{TextProperties.is(e)&&TextScene.is(t)&&t.update(e,i)},createState:(t,{createDatum:e})=>new TextStateMachine({...t,create:e("text")}),dragState:t=>new DragStateMachine(t)},annotationConfigs={[lineConfig.type]:lineConfig,[horizontalLineConfig.type]:horizontalLineConfig,[verticalLineConfig.type]:verticalLineConfig,[parallelChannelConfig.type]:parallelChannelConfig,[disjointChannelConfig.type]:disjointChannelConfig,[fibonacciRetracementConfig.type]:fibonacciRetracementConfig,[fibonacciRetracementTrendBasedConfig.type]:fibonacciRetracementTrendBasedConfig,[calloutConfig.type]:calloutConfig,[commentConfig.type]:commentConfig,[noteConfig.type]:noteConfig,[textConfig.type]:textConfig,[arrowConfig.type]:arrowConfig,[arrowUpConfig.type]:arrowUpConfig,[arrowDownConfig.type]:arrowDownConfig,[dateRangeConfig.type]:dateRangeConfig,[priceRangeConfig.type]:priceRangeConfig,[datePriceRangeConfig.type]:datePriceRangeConfig,[quickDatePriceRangeConfig.type]:quickDatePriceRangeConfig};function getTypedDatum(t){for(const{isDatum:e}of Object.values(annotationConfigs))if(e(t))return t}var import_ag_charts_community83=require("ag-charts-community"),{ActionOnSet,ParallelStateMachine,StateMachine:StateMachine11,StateMachineProperty:StateMachineProperty11,Debug:Debug11}=import_ag_charts_community83._ModuleSupport,AnnotationsStateMachine=class extends ParallelStateMachine{constructor(t){super(new SnappingStateMachine(e=>{this.snapping=e}),new UpdateMachine(()=>{this.node=this.active==null?void 0:t.node(this.active)}),new AnnotationsMainStateMachine(t,e=>{this.active=e,this.datum=this.active==null?void 0:t.datum(this.active),this.node=this.active==null?void 0:t.node(this.active)})),this.snapping=!1}getActive(){return this.active}isActive(t){return t===this.active}};__decorateClass([StateMachineProperty11()],AnnotationsStateMachine.prototype,"snapping",2),__decorateClass([StateMachineProperty11()],AnnotationsStateMachine.prototype,"datum",2),__decorateClass([StateMachineProperty11()],AnnotationsStateMachine.prototype,"node",2);var SnappingStateMachine=class extends StateMachine11{constructor(t){super("idle",{idle:{hover:({shiftKey:e})=>t(e),keyDown:({shiftKey:e})=>t(e),keyUp:({shiftKey:e})=>t(e),click:({shiftKey:e})=>t(e),drag:({shiftKey:e})=>t(e)},dragging:{},translating:{},"text-input":{}})}},UpdateMachine=class extends StateMachine11{constructor(t){super("idle",{idle:{onEnter:t,render:t},dragging:{onEnter:t,render:t},translating:{onEnter:t,render:t},"text-input":{render:t}})}},AnnotationsMainStateMachine=class extends StateMachine11{constructor(t,e){const i=m=>S=>{t.create(m,S),this.active=t.selectLast()},o=()=>{this.active!=null&&t.delete(this.active),this.active=void 0,t.select()},s={createDatum:i},a={...t,delete:o,showTextInput:()=>{this.active!=null&&t.showTextInput(this.active)},deselect:()=>{const m=this.active;this.active=void 0,this.hovered=void 0,t.select(this.active,m)},showAnnotationOptions:()=>{this.active!=null&&t.showAnnotationOptions(this.active)}},r=Object.fromEntries(Object.entries(annotationConfigs).map(([m,S])=>[m,S.createState(a,s)])),n=Object.fromEntries(Object.entries(annotationConfigs).map(([m,S])=>[m,S.dragState(t,s)])),l=({colorPickerType:m,colorOpacity:S,color:v,opacity:M,isMultiColor:D})=>{this.datum&&(m==="text-color"&&t.updateTextInputColor(v),setColor(this.datum,m,S,v,M,D),t.update())},c=m=>{const{datum:S,node:v}=this;!S||!v||(isTextType(S)?(S.fontSize=m,t.updateTextInputFontSize(m)):hasLineText(S)&&(S.text.fontSize=m),t.update())},h=m=>{const{datum:S,node:v}=this;!S||!v||!hasLineStyle(S)||(setLineStyle(S,m),t.update())},d=m=>{const{node:S}=this;!S||!("setTextInputBBox"in S)||(S.setTextInputBBox(m),t.update())},u=({textInputValue:m,bbox:S})=>{const{datum:v}=this;if(S!=null&&m!=null&&m.length>0){if(!isTextType(v))return;const M=maybeWrapText(v,m,S.width);v.set({text:M}),t.update(),t.recordAction(`Change ${v.type} annotation text`)}else t.delete(this.active),t.recordAction(`Delete ${v?.type} annotation`)},p=()=>{t.updateTextInputBBox(void 0)},g=()=>this.active!=null,y=()=>this.copied!=null,f=()=>{const{active:m,datum:S}=this;return m==null||!S?!1:hasLineText(S)&&S.isWriteable()},x=()=>this.active!=null&&!isEphemeralType(this.datum),b=()=>this.hovered!=null;super("idle",{idle:{onEnter:()=>{t.select(this.active,this.active),this.hoverCoords&&(this.hovered=t.hoverAtCoords(this.hoverCoords,this.active,this.hovered))},hover:({offset:m})=>{this.hovered=t.hoverAtCoords(m,this.active,this.hovered),this.hoverCoords=m},translate:{guard:g,target:"translating",action:({translation:m})=>{t.startInteracting(),t.translate(this.active,m),t.update()}},copy:{guard:x,action:()=>{this.copied=t.copy(this.active)}},cut:{guard:x,action:()=>{this.copied=t.copy(this.active),o()}},paste:{guard:y,action:()=>{t.paste(this.copied)}},selectLast:()=>{const m=this.active;this.active=t.selectLast(),t.select(this.active,m)},click:[{guard:()=>{const{active:m,hovered:S,datum:v}=this;return m==null||S!==m||!v?!1:isTextType(v)&&v.isWriteable()},target:"text-input"},{action:()=>{const m=this.active;this.active=this.hovered,t.select(this.active,m)}}],dblclick:{guard:f,action:({offset:m})=>{const S=t.getNodeAtCoords(m,this.active)==="text"?"text":"line";t.showAnnotationSettings(this.active,void 0,S)}},dragStart:[{guard:b,target:"dragging",action:()=>{const m=this.active;this.active=this.hovered,t.select(this.active,m),t.startInteracting()}},{action:()=>{const m=this.active;this.active=this.hovered,t.select(this.active,m)}}],color:{guard:g,action:l},fontSize:{guard:g,action:c},lineProps:{guard:g,action:m=>{const S=getTypedDatum(this.datum);S?.set(m),t.update(),t.recordAction(`Change ${S?.type} ${Object.entries(m).map(([v,M])=>`${v} to ${M}`).join(", ")}`)}},lineStyle:{guard:g,action:h},lineText:{guard:g,action:m=>{const S=getTypedDatum(this.datum);hasLineText(S)&&(isChannelType(S)&&m.position==="center"&&(m.position="inside"),S.text.set(m),t.update())}},updateTextInputBBox:{guard:g,action:d},toolbarPressSettings:{guard:f,action:m=>{t.showAnnotationSettings(this.active,m)}},reset:()=>{this.active!=null&&this.node?.toggleActive(!1),this.hovered=void 0,this.active=void 0,t.select(this.active,this.active),t.resetToIdle()},delete:()=>{this.active!=null&&(t.delete(this.active),!isEphemeralType(this.datum)&&t.recordAction(`Delete ${this.datum?.type} annotation`))},deleteAll:()=>{t.deleteAll()},...r},dragging:{onEnter:(m,S)=>{if(this.active==null)return;const v=t.getAnnotationType(this.active);v&&(this.transitionRoot(v),this.transitionRoot("dragStart",S))},...n},translating:{onEnter:()=>{},translate:{guard:g,target:"translating",action:({translation:m})=>{t.startInteracting(),t.translate(this.active,m),t.update()}},translateEnd:{guard:g,target:"idle"},onExit:()=>{t.stopInteracting(),t.update(),t.recordAction("Translate annotation")}},"text-input":{onEnter:()=>{if(this.active==null)return;const m=getTypedDatum(this.datum);!m||!("getTextInputCoords"in m)||(t.startInteracting(),t.showTextInput(this.active),m.visible=!1,t.update())},updateTextInputBBox:{guard:g,action:d},resize:{target:"idle",action:u},click:{target:"idle",action:u},drag:{target:"idle",action:u},textInput:[{guard:guardCancelAndExit,target:"idle",action:p},{guard:guardSaveAndExit,target:"idle",action:u}],color:{guard:g,action:l},fontSize:{guard:g,action:c},cancel:{target:"idle",action:p},onExit:()=>{t.stopInteracting(),t.hideTextInput();const m=this.active;if(this.active=this.hovered=void 0,t.select(this.active,m),m==null)return;const S=t.datum(m),v=t.node(m);!S||!v||(S.visible=!0)}}}),this.setActive=e,this.debug=Debug11.create(!0,"annotations"),this.snapping=!1}};__decorateClass([ActionOnSet({changeValue(t){this.setActive(t)}}),StateMachineProperty11()],AnnotationsMainStateMachine.prototype,"active",2),__decorateClass([StateMachineProperty11()],AnnotationsMainStateMachine.prototype,"hovered",2),__decorateClass([StateMachineProperty11()],AnnotationsMainStateMachine.prototype,"hoverCoords",2),__decorateClass([StateMachineProperty11()],AnnotationsMainStateMachine.prototype,"copied",2),__decorateClass([StateMachineProperty11()],AnnotationsMainStateMachine.prototype,"snapping",2),__decorateClass([StateMachineProperty11()],AnnotationsMainStateMachine.prototype,"datum",2),__decorateClass([StateMachineProperty11()],AnnotationsMainStateMachine.prototype,"node",2);var import_ag_charts_community84=require("ag-charts-community"),import_ag_charts_core40=require("ag-charts-core"),{ActionOnSet:ActionOnSet2,LayoutElement,Menu:Menu2,PropertiesArray:PropertiesArray2,ToolbarButtonProperties:ToolbarButtonProperties2,Property:Property31,ChartAxisDirection:ChartAxisDirection7}=import_ag_charts_community84._ModuleSupport,AnnotationsToolbarButtonProperties=class extends ToolbarButtonProperties2{};__decorateClass([Property31],AnnotationsToolbarButtonProperties.prototype,"value",2);var AnnotationsToolbar=class extends import_ag_charts_community84._ModuleSupport.BaseProperties{constructor(t){super(),this.ctx=t,this.enabled=!0,this.padding=20,this.buttons=new PropertiesArray2(AnnotationsToolbarButtonProperties),this.events=new import_ag_charts_core40.EventEmitter,this.annotationMenu=new Menu2(this.ctx,"annotations"),this.cleanup=new import_ag_charts_core40.CleanupRegistry,this.toolbar=t.sharedToolbar.getSharedToolbar("annotations");const e=this.onKeyDown.bind(this);this.toolbar.addListener("keydown",e),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onToolbarButtonPress.bind(this)),t.layoutManager.registerElement(LayoutElement.ToolbarLeft,this.onLayoutStart.bind(this)),()=>{this.toolbar.removeListener("keydown",e),this.toolbar.destroy()})}destroy(){this.cleanup.flush()}toggleClearButtonEnabled(t){const e=this.buttons.findIndex(i=>i.value==="clear");this.toolbar.toggleButtonEnabledByIndex(e,t)}resetButtonIcons(){for(const[t,e]of this.buttons.entries())switch(e.value){case"line-menu":this.updateButtonByIndex(t,{icon:"trend-line-drawing",value:"line-menu"});break;case"fibonacci-menu":this.updateButtonByIndex(t,{icon:"fibonacci-retracement-drawing",value:"fibonacci-menu"});break;case"text-menu":this.updateButtonByIndex(t,{icon:"text-annotation",value:"text-menu"});break;case"shape-menu":this.updateButtonByIndex(t,{icon:"arrow-drawing",value:"shape-menu"});break;case"measurer-menu":this.updateButtonByIndex(t,{icon:"measurer-drawing",value:"measurer-menu"});break}}hideOverlays(){this.annotationMenu.hide()}clearActiveButton(){this.toolbar.clearActiveButton()}onLayoutStart(t){this.enabled&&(this.toolbar.updateButtons(this.buttons),this.toolbar.layout(t.layoutBox,this.padding))}refreshButtonsEnabled(t){for(const[e,i]of this.buttons.entries())i&&this.toolbar.toggleButtonEnabledByIndex(e,t)}onToolbarButtonPress({event:t,button:e,buttonBounds:i,buttonWidget:o}){const s=this.ctx.axisManager.getAxisContext(ChartAxisDirection7.Y)[0].scale;switch(e.value){case"clear":this.events.emit("pressed-clear",null);break;case"line-menu":this.onToolbarButtonPressShowMenu(t,i,o,e.value,"toolbarAnnotationsLineAnnotations",LINE_ANNOTATION_ITEMS.filter(a=>a.visible?a.visible(s):!0));break;case"fibonacci-menu":this.onToolbarButtonPressShowMenu(t,i,o,e.value,"toolbarAnnotationsFibonacciAnnotations",FIBONACCI_ANNOTATION_ITEMS);break;case"text-menu":this.onToolbarButtonPressShowMenu(t,i,o,e.value,"toolbarAnnotationsTextAnnotations",TEXT_ANNOTATION_ITEMS);break;case"shape-menu":this.onToolbarButtonPressShowMenu(t,i,o,e.value,"toolbarAnnotationsShapeAnnotations",SHAPE_ANNOTATION_ITEMS);break;case"measurer-menu":this.onToolbarButtonPressShowMenu(t,i,o,e.value,"toolbarAnnotationsMeasurerAnnotations",MEASURER_ANNOTATION_ITEMS);break}}onToolbarButtonPressShowMenu(t,e,i,o,s,a){this.events.emit("pressed-show-menu",null);const r=this.buttons.findIndex(n=>n.value===o);this.toolbar.toggleActiveButtonByIndex(r),this.annotationMenu.setAnchor({x:e.x+e.width+6,y:e.y}),this.annotationMenu.show(i,{items:a,ariaLabel:this.ctx.localeManager.t(s),class:"ag-charts-annotations__toolbar-menu",sourceEvent:t.sourceEvent,onPress:this.onButtonPressMenuCreateAnnotation.bind(this,o)})}onButtonPressMenuCreateAnnotation(t,e){const i=this.buttons.findIndex(o=>o.value===t);this.updateButtonByIndex(i,{icon:e.icon}),this.events.emit("pressed-create-annotation",{annotation:e.value}),this.annotationMenu.hide()}onKeyDown({sourceEvent:t}){t.key==="Escape"&&this.events.emit("cancel-create-annotation",null)}updateButtonByIndex(t,e){const i=this.buttons.at(t);i&&(i.set({...i.toJson(),...e,value:e.value??i.value}),this.toolbar.updateButtonByIndex(t,{...i.toJson()}))}};__decorateClass([Property31,ActionOnSet2({changeValue(t){this.toolbar?.setHidden(!t)}})],AnnotationsToolbar.prototype,"enabled",2),__decorateClass([Property31],AnnotationsToolbar.prototype,"padding",2),__decorateClass([Property31],AnnotationsToolbar.prototype,"buttons",2);var import_ag_charts_community85=require("ag-charts-community"),{BaseModuleInstance,InteractionState,Property:Property32,ChartAxisDirection:ChartAxisDirection8,getIconClassNames}=import_ag_charts_community85._ModuleSupport,DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS="ag-charts-annotations__axis-button",AxisButton=class extends BaseModuleInstance{constructor(t,e,i,o){super(),this.ctx=t,this.axisCtx=e,this.onButtonClick=i,this.seriesRect=o,this.enabled=!0,this.snap=!1,this.padding=0,this.button=this.setup(),this.toggleVisibility(!1),this.updateButtonElement(),this.snap=!!e.scale.bandwidth,t.domManager.addEventListener("focusin",({target:s})=>{const a=s instanceof HTMLElement?s:void 0;!(a&&t.domManager.contains(a,"series-area"))&&a!==this.button.getElement()&&this.hide()}),this.cleanup.register(t.widgets.seriesWidget.addListener("drag-move",s=>this.onMouseDrag(s)),t.widgets.seriesWidget.addListener("mousemove",s=>this.onMouseMove(s)),t.widgets.seriesWidget.addListener("mouseleave",()=>this.onMouseLeave()),t.widgets.seriesDragInterpreter?.events.on("click",s=>this.onClick(s)),t.eventsHub.on("series:focus-change",()=>this.onKeyPress()),t.eventsHub.on("zoom:pan-start",()=>this.hide()),t.eventsHub.on("zoom:change",()=>this.hide()),()=>this.destroyElements(),()=>this.button.destroy())}update(t,e){this.seriesRect=t,this.padding=e}setup(){const t=new import_ag_charts_community85._Widget.ButtonWidget;return t.addClass(DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS),t.setTabIndex(-1),t.setAriaLabel(this.ctx.localeManager.t("ariaLabelAddHorizontalLine")),this.ctx.widgets.seriesWidget.getElement().appendChild(t.getElement()),t}destroyElements(){this.ctx.domManager.removeChild("canvas-overlay",DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS)}onMouseMove(t){this.ctx.interactionManager.isState(InteractionState.Clickable)&&this.show(t)}onMouseDrag(t){this.ctx.interactionManager.isState(InteractionState.AnnotationsMoveable)&&this.show(t)}onMouseLeave(){this.ctx.interactionManager.isState(InteractionState.Clickable)&&this.hide()}onClick(t){this.ctx.interactionManager.isState(InteractionState.Clickable)&&t.device==="touch"&&this.show(t)}show(t){const{sourceEvent:e,currentX:i,currentY:o}=t;if(!(this.enabled&&this.ctx.widgets.seriesWidget.getElement().contains(e.target))){this.hide();return}this.toggleVisibility(!0);const s=this.getButtonCoordinates({x:i,y:o});this.coords={x:s.x+this.button.clientWidth/2,y:s.y+this.button.clientHeight/2},this.updatePosition(s)}hide(){this.toggleVisibility(!1)}onKeyPress(){this.snap&&this.ctx.interactionManager.isState(InteractionState.Default)||this.hide()}getButtonCoordinates({x:t,y:e}){const{axisCtx:{direction:i,position:o},seriesRect:s,snap:a,axisCtx:r,padding:n}=this,{clientWidth:l,clientHeight:c}=this.button,[h,d]=[0,s.height],[u,p]=[0,s.width];if(a&&(t=convert(invert(t-s.x,r),r)+s.x,e=convert(invert(e-s.y,r),r)+s.y),i===ChartAxisDirection8.X){const y=c-Math.max(0,n-5);t=t-l/2,e=o==="top"?h-c+y:d-y}else{const y=l-Math.max(0,n-9);t=o==="left"?u-l+y:p-y,e=e-c/2}return{x:t,y:e}}toggleVisibility(t){const{button:e}=this;if(e==null)return;const i=this.enabled&&t;this.toggleClass("-hidden",!i)}toggleClass(t,e){this.button.toggleClass(`${DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS}-${t}`,e)}updatePosition({x:t,y:e}){this.button.getElement().style.transform=`translate(${Math.round(t)}px, ${Math.round(e)}px)`}updateButtonElement(){const{button:t}=this;t.addListener("click",()=>this.onButtonClick(this.coords)),t.addListener("touchend",()=>this.onButtonClick(this.coords)),t.addListener("drag-start",()=>{}),t.setInnerHTML(``)}};__decorateClass([Property32],AxisButton.prototype,"enabled",2);var import_ag_charts_community87=require("ag-charts-community"),import_ag_charts_core42=require("ag-charts-core"),import_ag_charts_community86=require("ag-charts-community"),import_ag_charts_core41=require("ag-charts-core"),{Color:Color5,DraggablePopover,NativeWidget,Vec2:Vec218,createButton,createCheckbox,createSelect,createTextArea,initRovingTabIndex,getIconClassNames:getIconClassNames2,mapValues}=import_ag_charts_community86._ModuleSupport,_Dialog=class xt extends DraggablePopover{constructor(e,i){super(e,i),this.dragHandleDraggingClass="ag-charts-dialog__drag-handle--dragging",this.colorPicker=new ColorPicker(this.ctx,{detached:!0}),this.cleanup.register(e.eventsHub.on("layout:complete",this.onLayoutComplete.bind(this)))}showWithChildren(e,i){const o=super.showWithChildren(e,i);return o.classList.add("ag-charts-dialog"),o.setAttribute("role","dialog"),o.addEventListener("mousedown",s=>{s.target.classList?.contains("ag-charts-dialog__color-picker-button")||this.colorPicker.hide()}),o.addEventListener("keydown",this.onKeyDown.bind(this)),(0,import_ag_charts_core41.getWindow)().requestAnimationFrame(()=>this.reposition()),this.colorPicker.attachTo(this),o}updatePosition(e){super.updatePosition(e);const{anchor:i,fallbackAnchor:o}=this.getColorPickerAnchors()??{};i&&this.colorPicker.setAnchor(i,o)}createTabs(e,i,o){const s=(0,import_ag_charts_core41.createElement)("div","ag-charts-dialog__tabs"),a=mapValues(o,()=>(0,import_ag_charts_core41.createElementId)()),r=mapValues(o,()=>(0,import_ag_charts_core41.createElementId)());for(const[p,g]of(0,import_ag_charts_core41.entries)(o))(0,import_ag_charts_core41.setAttributes)(g.panel,{id:r[p],role:"tabpanel","aria-labelledby":a[p]});const n=p=>{for(const[g,y]of(0,import_ag_charts_core41.entries)(o))y.panel.classList.toggle("ag-charts-dialog__tab-panel--active",g===p),h[g].classList.toggle("ag-charts-dialog__tab-button--active",g===p),(0,import_ag_charts_core41.setAttribute)(h[g],"aria-selected",g===p),g===p&&y.onShow?.()},l=new NativeWidget((0,import_ag_charts_core41.createElement)("div","ag-charts-dialog__header"));l.addListener("drag-start",p=>{const{sourceEvent:g}=p;g.target instanceof Element&&g.target.classList.contains("ag-charts-dialog__header")&&this.onDragStart(p)}),l.addListener("drag-move",p=>this.onDragMove(p)),l.addListener("drag-end",()=>this.onDragEnd());const c=new DragHandleWidget;this.setDragHandle(c);const h=mapValues(o,(p,g)=>createButton({label:this.ctx.localeManager.t(p.label),onPress:()=>n(g)},{id:a[g],class:"ag-charts-dialog__tab-button",role:"tab","aria-controls":r[g]})),d=(0,import_ag_charts_core41.createElement)("div","ag-charts-dialog__tab-list");(0,import_ag_charts_core41.setAttributes)(d,{role:"tablist","aria-label":this.ctx.localeManager.t(e)}),d.append(...Object.values(h));const u=this.createHeaderCloseButton();return l.getElement().append(c.getElement(),d,u),s.append(l.getElement(),...Object.values(o).map(p=>p.panel)),n(i),initRovingTabIndex({orientation:"horizontal",buttons:Object.values(h)}),{tabs:s,initialFocus:h[i]}}createTabPanel(){return(0,import_ag_charts_core41.createElement)("div","ag-charts-dialog__tab-panel")}createInputGroupLine(){return(0,import_ag_charts_core41.createElement)("div","ag-charts-dialog__input-group-line")}createRadioGroup({label:e,options:i,value:o,onChange:s}){const a=this.createInputGroup(e);(0,import_ag_charts_core41.setAttributes)(a,{role:"radiogroup",tabindex:-1,"aria-label":this.ctx.localeManager.t(e)});const r="ag-charts-dialog__button--active",n=[];for(const l of i){const{icon:c,altText:h}=l,d=this.ctx.localeManager.t(h),u=createButton({icon:c,altText:d,onPress:()=>{for(const p of Array.from(a.children))p.classList.remove(r),p.ariaChecked="false";u.classList.add(r),u.ariaChecked="true",s(l.value)}},{"aria-checked":l.value===o,class:"ag-charts-dialog__button",role:"radio",title:d});l.value===o&&u.classList.add(r),a.appendChild(u),n.push(u)}return initRovingTabIndex({orientation:"horizontal",buttons:n}),a}createSelect({altText:e,label:i,options:o,value:s,onChange:a}){const r=this.createInputGroup(i),n=this.ctx.localeManager.t(e),l=createSelect({value:s,options:o,onChange:a},{class:"ag-charts-dialog__select","aria-label":n,title:n});return r.append(l),r}createTextArea({placeholder:e,value:i,onChange:o}){const s=e?this.ctx.localeManager.t(e):void 0;return createTextArea({value:i,onChange:o},{placeholder:s})}createCheckbox({label:e,checked:i,onChange:o}){const s=(0,import_ag_charts_core41.createElementId)(),a=this.createInputGroup(e,{for:s}),r=createCheckbox({checked:i,onChange:o},{class:"ag-charts-dialog__checkbox",role:"switch",id:s});return a.append(r),a}createColorPicker({color:e,opacity:i,label:o,altText:s,onChange:a,onChangeHide:r,isMultiColor:n,hasMultiColorOption:l}){const c=this.createInputGroup(o),h=this.ctx.localeManager.t(s),d=createButton({label:h,onPress:u=>{const{anchor:p,fallbackAnchor:g}=this.getColorPickerAnchors(d)??{};this.colorPicker.show({anchor:p,fallbackAnchor:g,color:e,opacity:i,isMultiColor:n,hasMultiColorOption:l,sourceEvent:u,onChange:(y,f,x,b)=>{d.style.setProperty("--color",y),d.classList.toggle("ag-charts-dialog__color-picker-button--multi-color",b),a(y,f,x,b)},onChangeHide:r})}},{"aria-label":h,tabindex:0,class:"ag-charts-dialog__color-picker-button",title:h});if(n)d.classList.toggle("ag-charts-dialog__color-picker-button--multi-color");else if(e){const u=Color5.fromString(e),p=new Color5(u.r,u.g,u.b,i);d.style.setProperty("--color",p.toHexString())}return c.append(d),this.hideFns.push(()=>{this.colorPicker.hide()}),c}createHeaderCloseButton(){return createButton({icon:"close",altText:this.ctx.localeManager.t("iconAltTextClose"),onPress:()=>this.hide()},{class:"ag-charts-dialog__close-button"})}createInputGroup(e,i){const o=(0,import_ag_charts_core41.createElement)("div","ag-charts-dialog__input-group"),s=(0,import_ag_charts_core41.createElement)("label","ag-charts-dialog__input-group-label");return s.innerText=this.ctx.localeManager.t(e),(0,import_ag_charts_core41.setAttribute)(s,"for",i?.for),o.appendChild(s),o}onLayoutComplete(e){this.seriesRect=e.series.paddedRect,this.reposition()}onKeyDown(e){e.altKey||e.ctrlKey||e.metaKey||e.isComposing||e.key!=="Escape"||this.hide()}reposition(){const{seriesRect:e,ctx:i}=this,o=i.domManager.getBoundingClientRect(),s=this.getPopoverElement();if(!e||!s)return;const a=Vec218.from(0,e.y),r=Vec218.from(o.width,e.height),n=Vec218.from(s),l=Vec218.from(.5,1);let c;if(e.width>1e3){const h=Vec218.sub(Vec218.add(a,Vec218.multiply(r,l)),Vec218.multiply(n,l));c=Vec218.sub(h,Vec218.from(0,xt.offset))}else{const h=Vec218.sub(Vec218.add(a,r),n);c=Vec218.sub(h,xt.offset)}this.updatePosition(c)}getColorPickerAnchors(e){if(e&&(this.colorPickerAnchorElement=e),!this.colorPickerAnchorElement)return;const i=this.colorPickerAnchorElement.getBoundingClientRect(),o=this.ctx.domManager.getBoundingClientRect(),s=Vec218.sub(Vec218.from(i.x,i.y),Vec218.from(o.left,o.top)),a=Vec218.add(s,Vec218.from(0,i.height+5)),r=Vec218.sub(s,Vec218.from(0,5));return{anchor:a,fallbackAnchor:r}}};_Dialog.offset=60;var Dialog=_Dialog,DragHandleWidget=class extends NativeWidget{constructor(){super((0,import_ag_charts_core41.createElement)("div","ag-charts-dialog__drag-handle"));const t=new NativeWidget((0,import_ag_charts_core41.createElement)("span",getIconClassNames2("drag-handle")));t.setAriaHidden(!0),this.addChild(t)}},{focusCursorAtEnd:focusCursorAtEnd2}=import_ag_charts_community87._ModuleSupport,AnnotationSettingsDialog=class extends Dialog{constructor(t){super(t,"settings"),this.events=new import_ag_charts_core42.EventEmitter,this.hideFns.push(()=>this.events.emit("hidden",null))}show(t,e){const i=this.createLinearLineTab(t,e),o=this.createLinearTextTab(t,e);let s="dialogHeaderLine";isChannelType(t)?s="dialogHeaderChannel":isFibonacciType(t)?s="dialogHeaderFibonacciRange":t.type==="date-range"?s="dialogHeaderDateRange":t.type==="price-range"?s="dialogHeaderPriceRange":t.type==="date-price-range"&&(s="dialogHeaderDatePriceRange");const{tabs:a,initialFocus:r}=this.createTabs("ariaLabelSettingsTabBar",e.initialSelectedTab,{line:{label:s,panel:i},text:{label:"dialogHeaderText",panel:o.panel,onShow:o.onShow}});e.initialFocus=r,this.showWithChildren([a],e).classList.add("ag-charts-dialog--annotation-settings")}createLinearLineTab(t,e){const i=this.createTabPanel(),o=this.createInputGroupLine(),s=this.createInputGroupLine(),a="isMultiColor"in t,r=this.createColorPickerInput("line-color",t.getDefaultColor("line-color"),t.getDefaultOpacity("line-color"),a?t.isMultiColor:!1,a,e.onChangeLineColor,e.onChangeHideLineColor),n=this.createStrokeWidthSelect(t.strokeWidth??2,e.onChangeLineStyleWidth),l=this.createLineStyleRadioGroup(t.lineStyle??"solid",e.onChangeLineStyleType);if(o.append(r),"background"in t){const c=this.createColorPickerInput("fill-color",t.getDefaultColor("fill-color"),t.getDefaultOpacity("fill-color"),!1,!1,e.onChangeFillColor,e.onChangeHideFillColor);o.append(c),s.append(n)}else"showFill"in t?(o.append(this.createCheckbox({label:"dialogInputShowFill",checked:t.showFill??!0,onChange:c=>e.onChangeLine({showFill:c})})),s.append(n)):o.append(n);return s.append(l),i.append(o,s),"bands"in t&&i.append(this.createFibonacciRatioSelect(t.bands??10,c=>e.onChangeLine({bands:c}))),"extendStart"in t&&"extendEnd"in t&&i.append(this.createCheckbox({label:isChannelType(t)?"dialogInputExtendChannelStart":"dialogInputExtendLineStart",checked:t.extendStart??!1,onChange:c=>e.onChangeLine({extendStart:c})}),this.createCheckbox({label:isChannelType(t)?"dialogInputExtendChannelEnd":"dialogInputExtendLineEnd",checked:t.extendEnd??!1,onChange:c=>e.onChangeLine({extendEnd:c})})),"extendAbove"in t&&"extendBelow"in t&&i.append(this.createCheckbox({label:"dialogInputExtendAbove",checked:t.extendAbove??!1,onChange:c=>e.onChangeLine({extendAbove:c})}),this.createCheckbox({label:"dialogInputExtendBelow",checked:t.extendBelow??!1,onChange:c=>e.onChangeLine({extendBelow:c})})),"extendLeft"in t&&"extendRight"in t&&i.append(this.createCheckbox({label:"dialogInputExtendLeft",checked:t.extendLeft??!1,onChange:c=>e.onChangeLine({extendLeft:c})}),this.createCheckbox({label:"dialogInputExtendRight",checked:t.extendRight??!1,onChange:c=>e.onChangeLine({extendRight:c})})),"reverse"in t&&"showFill"in t&&i.append(this.createCheckbox({label:"dialogInputReverse",checked:t.reverse??!1,onChange:c=>e.onChangeLine({reverse:c})})),i}createLinearTextTab(t,e){const i=this.createTabPanel(),o=this.createTextArea({placeholder:"inputTextareaPlaceholder",value:t.text.label,onChange:h=>e.onChangeText({label:h})}),s=this.createFontSizeSelect(t.text.fontSize,e.onChangeTextFontSize),a=this.createColorPickerInput("text-color",t.text.color,1,!1,!1,e.onChangeTextColor,e.onChangeHideTextColor),r=t.text.position==="inside"?"center":t.text.position,n=this.createPositionRadioGroup(r??"top",h=>e.onChangeText({position:h})),l=this.createAlignmentRadioGroup(t.text.alignment??"center",h=>e.onChangeText({alignment:h})),c=this.createInputGroupLine();return c.append(s,a,n,l),i.append(o,c),{panel:i,onShow:()=>focusCursorAtEnd2(o)}}createColorPickerInput(t,e,i,o,s,a,r){const n=t==="fill-color"?"dialogInputFillColorPicker":"dialogInputColorPicker",l=t==="fill-color"?"dialogInputFillColorPickerAltText":"dialogInputColorPickerAltText";return this.createColorPicker({label:n,altText:l,color:e,opacity:i,isMultiColor:o,hasMultiColorOption:s,onChange:a,onChangeHide:r})}createStrokeWidthSelect(t,e){return this.createSelect({label:"dialogInputStrokeWidth",altText:"dialogInputStrokeWidthAltText",options:LINE_STROKE_WIDTH_ITEMS.map(({label:i,value:o})=>({label:i,value:`${o}`})),value:String(t),onChange:i=>e(Number(i))})}createFibonacciRatioSelect(t,e){return this.createSelect({label:"dialogInputFibonacciBands",altText:"dialogInputFibonacciBandsAltText",options:FIBONACCI_RATIO_ITEMS.map(({label:i,value:o})=>({label:i,value:`${o}`})),value:String(t),onChange:i=>e(Number(i))})}createLineStyleRadioGroup(t,e){return this.createRadioGroup({label:"dialogInputLineStyle",options:[{icon:"line-style-solid",altText:"iconAltTextLineStyleSolid",value:"solid"},{icon:"line-style-dashed",altText:"iconAltTextLineStyleDashed",value:"dashed"},{icon:"line-style-dotted",altText:"iconAltTextLineStyleDotted",value:"dotted"}],value:t,onChange:e})}createFontSizeSelect(t,e){return this.createSelect({label:"dialogInputFontSize",altText:"dialogInputFontSizeAltText",options:TEXT_SIZE_ITEMS.map(({label:i,value:o})=>({label:i,value:String(o)})),value:String(t),onChange:i=>e(Number(i))})}createPositionRadioGroup(t,e){return this.createRadioGroup({label:"dialogInputPosition",options:[{icon:"position-top",altText:"iconAltTextPositionTop",value:"top"},{icon:"position-center",altText:"iconAltTextPositionCenter",value:"center"},{icon:"position-bottom",altText:"iconAltTextPositionBottom",value:"bottom"}],value:t,onChange:e})}createAlignmentRadioGroup(t,e){return this.createRadioGroup({label:"dialogInputAlign",options:[{icon:"align-left",altText:"iconAltTextAlignLeft",value:"left"},{icon:"align-center",altText:"iconAltTextAlignCenter",value:"center"},{icon:"align-right",altText:"iconAltTextAlignRight",value:"right"}],value:t,onChange:e})}};function calculateAxisLabelPadding(t){return t.gridPadding+t.seriesAreaPadding+t.tickSize+t.label.spacing}function updateAnnotation(t,e,i){for(const{update:o}of Object.values(annotationConfigs))o(t,e,i)}var{ChartUpdateType,InteractionState:InteractionState2,PropertiesArray:PropertiesArray3,Property:Property33,ChartAxisDirection:ChartAxisDirection9,keyProperty,valueProperty,Vec2:Vec219,Selection:Selection3,BBox:BBox3}=import_ag_charts_community88._ModuleSupport,_Annotations=class Dt extends import_ag_charts_community88._ModuleSupport.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!0,this.toolbar=new AnnotationsToolbar(this.ctx),this.optionsToolbar=new AnnotationOptionsToolbar(this.ctx,()=>{const i=this.state.getActive();if(i!=null)return getTypedDatum(this.annotationData.at(i))}),this.axesButtons=new AxesButtons,this.snap=!1,this.data=void 0,this.xKey=void 0,this.volumeKey=void 0,this.annotationData=new PropertiesArray3(Dt.createAnnotationDatum),this.defaults=new AnnotationDefaults,this.container=new import_ag_charts_community88._ModuleSupport.Group({name:"static-annotations"}),this.annotations=new Selection3(this.container,this.createAnnotationScene.bind(this)),this.settingsDialog=new AnnotationSettingsDialog(this.ctx),this.textInput=new TextInput(this.ctx),this.postUpdateFns=[],this.state=this.setupStateMachine(),this.setupListeners(),this.setupDOM(),this.ctx.historyManager.addMementoOriginator(e.annotationManager),this.ctx.historyManager.addMementoOriginator(this.defaults),this.textInput.setKeyDownHandler(this.onTextInput.bind(this)),this.cleanup.register(()=>{this.clear(),this.xAxis?.button?.destroy(),this.yAxis?.button?.destroy()})}setupStateMachine(){const{ctx:e}=this;return new AnnotationsStateMachine({resetToIdle:()=>{e.domManager.updateCursor("annotations"),this.popAnnotationState(InteractionState2.Annotations),this.hideOverlays(),this.optionsToolbar.hide(),this.deleteEphemeralAnnotations(),this.update()},hoverAtCoords:(i,o,s)=>{let a;return this.annotations.each((r,n,l)=>{if(!n.isHoverable())return;const c=r.containsPoint(i.x,i.y);c&&(a??(a=l)),r.toggleHovered(c,o===l,n.readOnly)}),a!=null?e.tooltipManager.suppressTooltip("annotations"):this.isAnnotationState()||e.tooltipManager.unsuppressTooltip("annotations"),(a==null||!this.annotationData.at(a)?.readOnly)&&this.ctx.domManager.updateCursor("annotations",a==null?void 0:this.annotations.at(a)?.getCursor()),a!==s&&this.update(),a},getNodeAtCoords:(i,o)=>{const s=this.annotations.at(o);if(s)return s.getNodeAtCoords(i.x,i.y)},translate:(i,o)=>{const s=this.annotations.at(i),a=getTypedDatum(this.annotationData.at(i));if(!(!s||!a))return this.translateNode(s,a,o)},copy:i=>{const o=this.annotations.at(i),s=getTypedDatum(this.annotationData.at(i));if(!(!o||!s))return this.createAnnotationDatumCopy(o,s)},paste:i=>{this.createAnnotation(i.type,i,!1),this.postUpdateFns.push(()=>{this.state.transitionAsync("selectLast"),this.state.transitionAsync("copy")})},select:(i,o)=>{const{annotations:s,optionsToolbar:a,toolbar:r}=this;this.hideOverlays(),r.clearActiveButton(),r.resetButtonIcons();const n=i==null?null:s.at(i),l=o==null?null:s.at(o),c=i==null?null:this.annotationData.at(i);l===n&&n!=null||(l?.toggleActive(!1),a.hide(),n&&!c?.readOnly?(this.pushAnnotationState(InteractionState2.AnnotationsSelected),n.toggleActive(!0),isEphemeralType(c)||(a.updateButtons(this.annotationData.at(i)),this.postUpdateFns.push(()=>{a.show(),a.setAnchorScene(n)}))):(this.popAnnotationState(InteractionState2.AnnotationsSelected),this.popAnnotationState(InteractionState2.Annotations)),isEphemeralType(c)||this.deleteEphemeralAnnotations(),this.update())},selectLast:()=>(this.pushAnnotationState(InteractionState2.AnnotationsSelected),this.annotationData.length-1),startInteracting:()=>{this.pushAnnotationState(InteractionState2.Annotations)},stopInteracting:()=>{this.popAnnotationState(InteractionState2.Annotations)},create:(i,o)=>{this.createAnnotation(i,o)},delete:i=>{this.annotationData.splice(i,1)},deleteAll:()=>{const i=this.annotationData.filter(o=>{if(o.readOnly===!0)return o});this.annotationData.splice(0,this.annotationData.length);for(const o of i)this.annotationData.push(o)},validatePoint:(i,o)=>{const s=this.getAnnotationContext();return s?validateDatumPoint(s,i,o):!0},getAnnotationType:i=>stringToAnnotationType(this.annotationData[i].type),datum:i=>this.annotationData.at(i),node:i=>this.annotations.at(i),recordAction:i=>{this.recordActionAfterNextUpdate(i)},update:()=>{this.postUpdateFns.push(()=>{const i=this.state.getActive(),o=i==null?null:this.annotations.at(i);o!=null&&this.optionsToolbar.setAnchorScene(o)}),this.update()},showTextInput:i=>{const o=getTypedDatum(this.annotationData.at(i));if(!this.annotations.at(i)||!o||!("getTextInputCoords"in o)||!("getTextPosition"in o))return;const a={color:o.color,fontFamily:o.fontFamily,fontSize:o.fontSize,fontStyle:o.fontStyle,fontWeight:o.fontWeight,placeholderColor:o.getPlaceholderColor()},r=this.getAnnotationContext(),n=c=>Vec219.add(o.getTextInputCoords(r,c),Vec219.required(this.seriesRect)),l=()=>o.getTextPosition();this.textInput.show({styles:a,layout:{getTextInputCoords:n,getTextPosition:l,alignment:o.alignment,textAlign:o.textAlign,width:o.width},text:o.text,placeholderText:o.placeholderText,onChange:(c,h)=>{this.state.transition("updateTextInputBBox",h)}}),this.ctx.domManager.updateCursor("annotations")},hideTextInput:()=>{this.textInput.hide()},updateTextInputColor:i=>{this.textInput.updateColor(i)},updateTextInputFontSize:i=>{const o=this.textInput.updateFontSize(i);this.state.transition("updateTextInputBBox",o)},updateTextInputBBox:i=>{this.state.transition("updateTextInputBBox",i)},showAnnotationOptions:i=>{const o=this.annotations.at(i);!o||isEphemeralType(this.annotationData.at(i))||(this.optionsToolbar.updateButtons(this.annotationData.at(i)),this.optionsToolbar.show(),this.optionsToolbar.setAnchorScene(o))},showAnnotationSettings:(i,o,s="line")=>{const a=this.annotationData.at(i);if(!isLineType(a)&&!isChannelType(a)&&!isMeasurerType(a)||isEphemeralType(a))return;const r=c=>(h,d,u,p)=>{this.setColorAndDefault(a.type,c,h,d,u,p),this.optionsToolbar.updateColorPickerColor(c,d,u,p)},n=c=>()=>{this.recordActionAfterNextUpdate(`Change ${a.type} ${c} to ${a.getDefaultColor(c)}`,["annotations","defaults"]),this.update()},l={initialSelectedTab:s,ariaLabel:this.ctx.localeManager.t("ariaLabelAnnotationSettingsDialog"),sourceEvent:o,onChangeLine:c=>{this.state.transition("lineProps",c),c.bands!=null&&this.defaults.setDefaultFibonacciOptions(a.type,"bands",c.bands),c.reverse!=null&&this.defaults.setDefaultFibonacciOptions(a.type,"reverse",c.reverse),c.showFill!=null&&this.defaults.setDefaultFibonacciOptions(a.type,"showFill",c.showFill)},onChangeText:c=>{this.state.transition("lineText",c),c.alignment&&this.defaults.setDefaultLineTextAlignment(a.type,c.alignment),c.position&&this.defaults.setDefaultLineTextPosition(a.type,c.position),this.recordActionAfterNextUpdate(`Change ${a.type} text ${Object.keys(c).map(h=>`${h} to ${c[h]}`).join(", ")}`)},onChangeFillColor:r("fill-color"),onChangeHideFillColor:n("fill-color"),onChangeLineColor:r("line-color"),onChangeHideLineColor:n("line-color"),onChangeLineStyleType:c=>{this.setLineStyleTypeAndDefault(a.type,c),this.optionsToolbar.updateLineStyleType(LINE_STYLE_TYPE_ITEMS.find(h=>h.value===c)??LINE_STYLE_TYPE_ITEMS[0])},onChangeLineStyleWidth:c=>{this.setLineStyleWidthAndDefault(a.type,c),this.optionsToolbar.updateStrokeWidth({strokeWidth:c,value:c,label:String(c)})},onChangeTextColor:r("text-color"),onChangeHideTextColor:n("text-color"),onChangeTextFontSize:c=>{this.setFontSizeAndDefault(a.type,c)}};this.settingsDialog.show(a,l)}})}setupListeners(){const{ctx:e,optionsToolbar:i,settingsDialog:o,toolbar:s}=this,{seriesWidget:a,seriesDragInterpreter:r,chartWidget:n}=e.widgets;r&&this.cleanup.register(r.events.on("click",this.hoverTouchPreHandler.bind(this)),r.events.on("drag-start",this.hoverTouchPreHandler.bind(this)),r.events.on("drag-move",this.dragMoveTouchPreHandler.bind(this)),r.events.on("mousemove",this.onHover.bind(this)),r.events.on("click",this.onClick.bind(this)),r.events.on("dblclick",this.onDoubleClick.bind(this)),r.events.on("drag-start",this.onDragStart.bind(this)),r.events.on("drag-move",this.onDrag.bind(this)),r.events.on("drag-end",this.onDragEnd.bind(this))),this.cleanup.register(a.addListener("keydown",this.onKeyDown.bind(this)),a.addListener("keyup",this.onKeyUp.bind(this)),n.addListener("click",this.onCancel.bind(this)),e.eventsHub.on("annotations:restore",this.onRestoreAnnotations.bind(this)),e.eventsHub.on("layout:complete",this.onLayoutComplete.bind(this)),e.updateService.addListener("pre-scene-render",this.onPreRender.bind(this)),e.eventsHub.on("zoom:change",()=>this.onResize()),e.eventsHub.on("dom:resize",()=>this.onResize()),s.events.on("cancel-create-annotation",()=>{this.cancel(),this.reset(),this.update()}),s.events.on("pressed-create-annotation",({annotation:l})=>{this.cancel(),this.pushAnnotationState(InteractionState2.Annotations),this.state.transition(l),this.update()}),s.events.on("pressed-clear",()=>{this.clear(),this.recordActionAfterNextUpdate("Clear all")}),s.events.on("pressed-show-menu",()=>{this.cancel(),this.reset()}),s.events.on("pressed-unrelated",()=>{this.reset()}),i.events.on("pressed-delete",()=>{this.cancel(),this.delete(),this.reset()}),i.events.on("pressed-settings",({sourceEvent:l})=>{this.state.transition("toolbarPressSettings",l)}),i.events.on("pressed-lock",({locked:l})=>{this.recordActionAfterNextUpdate(l?"Locked":"Unlocked"),this.update()}),i.events.on("hid-overlays",()=>{this.settingsDialog.hide()}),i.events.on("saved-color",({type:l,colorPickerType:c,color:h})=>{this.recordActionAfterNextUpdate(`Change ${l} ${c} to ${h}`,["annotations","defaults"])}),i.events.on("updated-color",({type:l,colorPickerType:c,colorOpacity:h,color:d,opacity:u,isMultiColor:p})=>{this.setColorAndDefault(l,c,h,d,u,p)}),i.events.on("updated-font-size",({type:l,fontSize:c})=>{this.setFontSizeAndDefault(l,c)}),i.events.on("updated-line-style",({type:l,lineStyleType:c})=>{this.setLineStyleTypeAndDefault(l,c)}),i.events.on("updated-line-width",({type:l,strokeWidth:c})=>{this.setLineStyleWidthAndDefault(l,c)}),o.events.on("hidden",()=>{this.optionsToolbar.clearActiveButton()}))}setupDOM(){const{ctx:e,toolbar:i,optionsToolbar:o}=this;this.cleanup.register(e.annotationManager.attachNode(this.container),()=>{e.domManager.removeStyles(DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS),i.destroy(),o.destroy()})}async processData(e){if(!this.enabled||this.data==null||this.xKey==null||this.volumeKey==null)return;const i=[keyProperty(this.xKey,void 0,{id:"date"}),valueProperty(this.volumeKey,"number",{id:"volume"})],o=import_ag_charts_community88._ModuleSupport.DataSet.wrap(this.data)??import_ag_charts_community88._ModuleSupport.DataSet.empty(),{dataModel:s,processedData:a}=await e.request("annotations",o,{props:i});this.dataModel=s,this.processedData=a}createAnnotationScene(e){if(e.type in annotationConfigs)return new annotationConfigs[e.type].scene;throw new Error(`AG Charts - Cannot create annotation scene of type [${e.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.`)}static createAnnotationDatum(e){if(e.type in annotationConfigs)return new annotationConfigs[e.type].datum().set(e);throw new Error(`AG Charts - Cannot create annotation datum of unknown type [${e.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.`)}createAnnotation(e,i,o=!0){if(this.annotationData.push(i),o){const s=this.ctx.annotationManager.getAnnotationTypeStyles(e);s&&i.set(s),this.defaults.applyDefaults(i)}this.injectDatumDependencies(i),this.update()}injectDatumDependencies(e){"setLocaleManager"in e&&e.setLocaleManager(this.ctx.localeManager),"getVolume"in e&&(e.getVolume=this.getDatumRangeVolume.bind(this))}getDatumRangeVolume(e,i){const{dataModel:o,processedData:s}=this;let a=getGroupingValue(e),r=getGroupingValue(i);if(!(0,import_ag_charts_core43.isValidDate)(a)||!(0,import_ag_charts_core43.isValidDate)(r)||!o||!s||this.volumeKey==null)return;a>r&&([a,r]=[r,a]);const n=o.resolveKeysById({id:"annotations"},"date",s),l=o.resolveColumnById({id:"annotations"},"volume",s);let c=0;for(let h=0;h=a&&d<=r&&(c+=l[h])}return c}translateNode(e,i,o){const s=this.getAnnotationConfig(i),a=this.getAnnotationContext();a&&s.translate(e,i,o,a)}createAnnotationDatumCopy(e,i){const o=this.getAnnotationConfig(i),s=new o.datum;s.set(i.toJson());const a=this.getAnnotationContext();if(a)return o.copy(e,i,s,a)}getAnnotationConfig(e){if(e.type in annotationConfigs)return annotationConfigs[e.type];throw new Error(`AG Charts - Cannot get annotation config of unknown type [${e.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.`)}onRestoreAnnotations(e){this.enabled&&(this.clear(),this.annotationData.set(e.annotations),this.postUpdateFns.push(()=>{this.ctx.annotationManager.fireChangedEvent()}),this.update())}onLayoutComplete(e){const i=e.series.paddedRect;this.seriesRect=i,this.container.setClipRect(i);for(const o of e.axes??[])o.direction===import_ag_charts_community88._ModuleSupport.ChartAxisDirection.X?this.xAxis=this.getAxis(o,i,this.xAxis?.button):this.yAxis=this.getAxis(o,i,this.yAxis?.button);this.showAnnotations()?this.animateAnnotations({from:0,to:1,phase:"trailing"}):this.animateAnnotations({from:1,to:0,phase:"remove"})}showAnnotations(){if(!this.yAxis||!this.xAxis)return!1;const e=this.ctx.chartService.series.some(s=>s.hasData),o=this.yAxis.context.seriesIds().some(s=>this.ctx.chartService.series.find(r=>r.id===s)?.visible);return e&&o}animateAnnotations({from:e,to:i,phase:o}){const{annotations:s}=this;this.ctx.animationManager?.animate({from:e,to:i,id:"chart-annotations",phase:o,groupId:"opacity",onUpdate(a){s.each(r=>{r.opacity=a,"setAxisLabelOpacity"in r&&r.setAxisLabelOpacity(a)})},onStop(){s.each(a=>{a.opacity=i,"setAxisLabelOpacity"in a&&a.setAxisLabelOpacity(i)})}})}onPreRender(){this.updateAnnotations(),this.state.transition("render")}getAxis(e,i,o){const s=this.ctx.axisManager.getAxisContext(e.direction)[0],{position:a="bottom",direction:r}=s,n=e.gridPadding+e.seriesAreaPadding,l=new BBox3(0,0,i.width,i.height).grow(n,a),c=r===ChartAxisDirection9.X?"vertical":"horizontal",{axesButtons:h,snap:d}=this;if(this.enabled&&h.enabled&&(h.axes==="xy"||h.axes===r)){o??(o=new AxisButton(this.ctx,{...s,snapToGroup:d},g=>this.onAxisButtonClick(g,c),i));const p=calculateAxisLabelPadding(e);o.update(i,p)}else o?.destroy(),o=void 0;return{layout:e,context:s,bounds:l,button:o}}recordActionAfterNextUpdate(e,i=["annotations"]){const{defaults:o,ctx:{annotationManager:s,historyManager:a}}=this,r=i.map(n=>n==="defaults"?o:s);this.postUpdateFns.push(()=>{a.record(e,...r),s.fireChangedEvent()})}setColorAndDefault(e,i,o,s,a,r){this.state.transition("color",{colorPickerType:i,colorOpacity:o,color:s,opacity:a,isMultiColor:r}),this.defaults.setDefaultColor(e,i,o,s,a,r)}setFontSizeAndDefault(e,i){this.state.transition("fontSize",i),this.defaults.setDefaultFontSize(e,i),this.recordActionAfterNextUpdate(`Change ${e} font size to ${i}`,["annotations","defaults"])}setLineStyleTypeAndDefault(e,i){this.state.transition("lineStyle",{type:i}),this.defaults.setDefaultLineStyleType(e,i),this.recordActionAfterNextUpdate(`Change ${e} line style to ${i}`,["annotations","defaults"])}setLineStyleWidthAndDefault(e,i){this.state.transition("lineStyle",{strokeWidth:i}),this.defaults.setDefaultLineStyleWidth(e,i),this.recordActionAfterNextUpdate(`Change ${e} stroke width to ${i}`,["annotations","defaults"])}updateAnnotations(){const{annotationData:e,annotations:i,seriesRect:o,ctx:{annotationManager:s}}=this,a=this.getAnnotationContext();if(!o||!a)return;s.updateData(e.toJson());const r=this.showAnnotations();this.toolbar.refreshButtonsEnabled(r),this.toolbar.toggleClearButtonEnabled(e.length>0&&r),i.update(e??[],void 0,n=>n.id).each((n,l)=>{if(!r){n.visible=!1,"setAxisLabelVisible"in n&&n.setAxisLabelVisible(!1);return}"setAxisLabelVisible"in n&&n.setAxisLabelVisible(!0),this.injectDatumDependencies(l),updateAnnotation(n,l,a)});for(const n of this.postUpdateFns)n();this.postUpdateFns=[]}getAnnotationContext(){const{seriesRect:e,xAxis:i,yAxis:o,snap:s}=this;if(e&&i&&o)return{seriesRect:e,xAxis:{...i.context,bounds:i.bounds,labelPadding:calculateAxisLabelPadding(i.layout),snapToGroup:s},yAxis:{...o.context,bounds:o.bounds,labelPadding:calculateAxisLabelPadding(i.layout),snapToGroup:s}}}onHover(e){const{state:i}=this,o=this.getAnnotationContext();if(!o)return;const s=e.sourceEvent.shiftKey,a=Vec219.from(e),r=invertCoords(a,o);i.transition("hover",{offset:a,point:r,shiftKey:s,context:o})}onClick(e){const{state:i}=this,o=this.getAnnotationContext();if(!o)return;const s=e.sourceEvent.shiftKey,a=invertCoords(Vec219.from(e),o),r=this.textInput.getValue(),n=this.textInput.getBBox();i.transition("click",{point:a,shiftKey:s,textInputValue:r,bbox:n})}onDoubleClick(e){const{state:i}=this;if(!this.getAnnotationContext())return;const s=Vec219.from(e);i.transition("dblclick",{offset:s})}onAxisButtonClick(e,i){this.cancel(),this.reset();const o=this.getAnnotationContext();if(!this.annotationData||!o)return;const{state:s}=this;this.pushAnnotationState(InteractionState2.Annotations);const a=i==="horizontal";if(s.transition(a?"horizontal-line":"vertical-line"),this.optionsToolbar.hide(),!e)return;const r=invertCoords(e,o);validateDatumPoint(o,r)&&(s.transition("click",{point:r,shiftKey:!1}),this.update())}onResize(){const e=this.textInput.getValue(),i=this.textInput.getBBox();this.state.transition("resize",{textInputValue:e,bbox:i})}hoverTouchPreHandler(e){e.device==="touch"&&this.onHover(e)}dragMoveTouchPreHandler(e){e.device==="touch"&&this.ctx.interactionManager.isState(InteractionState2.AnnotationsSelected)&&e.sourceEvent.preventDefault()}onDragStart(e){if(!this.ctx.interactionManager.isState(InteractionState2.AnnotationsDraggable))return;const i=this.getAnnotationContext();if(!i)return;const o=Vec219.from(e),s=invertCoords(o,i),a=this.textInput.getValue(),r=this.textInput.getBBox();this.state.transition("dragStart",{context:i,offset:o,point:s,textInputValue:a,bbox:r})}onDrag(e){if(!this.ctx.interactionManager.isState(InteractionState2.AnnotationsDraggable))return;const i=this.getAnnotationContext();if(!i)return;const o=Vec219.from(e),s=invertCoords(o,i),a=e.sourceEvent.shiftKey,r=this.textInput.getValue(),n=this.textInput.getBBox();this.state.transition("drag",{context:i,offset:o,point:s,shiftKey:a,textInputValue:r,bbox:n})}onDragEnd(){this.state.transition("dragEnd")}onCancel(e){const{sourceEvent:i}=e??{};i?.currentTarget===i?.target&&(this.cancel(),this.reset())}onDelete(){this.textInput.isVisible()||(this.cancel(),this.delete(),this.reset(),this.update())}onTextInput(e){const{state:i}=this,o=this.getAnnotationContext();if(!o)return;const{key:s,shiftKey:a}=e,r=this.textInput.getValue(),n=this.textInput.getBBox();i.transition("textInput",{key:s,shiftKey:a,textInputValue:r,bbox:n,context:o})}onKeyDown(e){const{state:i}=this,o=this.getAnnotationContext();if(!o)return;const{sourceEvent:s}=e,{shiftKey:a,ctrlKey:r,metaKey:n}=s,l=r||n,c=r||a;i.transition("keyDown",{shiftKey:a,context:o});const h={x:0,y:0},d=Math.max(o?.xAxis.scale.bandwidth??0,c?10:1),u=Math.max(o?.yAxis.scale.bandwidth??0,c?10:1);switch(s.key){case"ArrowDown":h.y=u;break;case"ArrowUp":h.y=-u;break;case"ArrowLeft":h.x=-d;break;case"ArrowRight":h.x=d;break;case"Escape":this.onCancel();return;case"Backspace":case"Delete":this.onDelete();return}if((h.x||h.y)&&(i.transition("translate",{translation:h}),s.stopPropagation(),s.preventDefault()),!!l)switch(s.key){case"c":i.transition("copy");return;case"x":i.transition("cut"),this.recordActionAfterNextUpdate("Cut annotation");return;case"v":i.transition("paste"),this.recordActionAfterNextUpdate("Paste annotation");return}}onKeyUp(e){const{shiftKey:i}=e.sourceEvent,o=this.getAnnotationContext();o&&(this.state.transition("keyUp",{shiftKey:i,context:o}),this.state.transition("translateEnd"))}clear(){this.cancel(),this.deleteAll(),this.reset()}reset(){this.state.transition("reset")}cancel(){this.state.transition("cancel")}delete(){this.state.transition("delete")}deleteAll(){this.state.transition("deleteAll")}deleteEphemeralAnnotations(){let e=!1;for(const[i,o]of this.annotationData.entries())isEphemeralType(o)&&(this.annotationData.splice(i,1),e=!0);e&&this.recordActionAfterNextUpdate("Delete ephemeral annotations")}hideOverlays(){this.settingsDialog.hide(),this.toolbar.hideOverlays(),this.optionsToolbar.hideOverlays()}pushAnnotationState(e){this.ctx.interactionManager.pushState(e),this.ctx.tooltipManager.suppressTooltip("annotations")}popAnnotationState(e){this.ctx.interactionManager.popState(e),this.ctx.tooltipManager.unsuppressTooltip("annotations")}isAnnotationState(){return this.ctx.interactionManager.isState(InteractionState2.Annotations)||this.ctx.interactionManager.isState(InteractionState2.AnnotationsSelected)}update(e=ChartUpdateType.PRE_SCENE_RENDER){this.ctx.updateService.update(e)}};__decorateClass([Property33],_Annotations.prototype,"enabled",2),__decorateClass([Property33],_Annotations.prototype,"toolbar",2),__decorateClass([Property33],_Annotations.prototype,"optionsToolbar",2),__decorateClass([Property33],_Annotations.prototype,"axesButtons",2),__decorateClass([Property33],_Annotations.prototype,"snap",2);var Annotations=_Annotations,import_ag_charts_community89=require("ag-charts-community"),{FONT_SIZE_RATIO,ThemeSymbols}=import_ag_charts_community89._ModuleSupport,stroke={stroke:{$ref:"foregroundColor"},strokeOpacity:1,strokeWidth:2},handle={fill:ThemeSymbols.DEFAULT_ANNOTATION_HANDLE_FILL,strokeOpacity:1,strokeWidth:2},font={color:{$ref:"chartBackgroundColor"},fontSize:{$rem:FONT_SIZE_RATIO.LARGE},fontFamily:{$ref:"fontFamily"}},axisLabel={...font,enabled:!0,fill:{$ref:"foregroundColor"},fontSize:{$ref:"fontSize"}},text={...font,textAlign:"left"},lineText={...font,position:"top",alignment:"center",color:{$ref:"textColor"}},channelText={...font,position:"top",alignment:"center",color:{$ref:"textColor"}},measurerStatistics={...font,fontSize:{$ref:"fontSize"},color:ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_COLOR,fill:ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_FILL,stroke:ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_STROKE,strokeWidth:1,divider:{stroke:ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE,strokeWidth:1,strokeOpacity:.5}},measurer={...stroke,background:{fill:{$ref:"foregroundColor"},fillOpacity:.075},handle:{...handle},text:{...lineText},statistics:{...measurerStatistics}},toolbar={buttons:{$shallowSimple:[{icon:"text-annotation",tooltip:"toolbarAnnotationsTextAnnotations",value:"text-menu"},{icon:"trend-line-drawing",tooltip:"toolbarAnnotationsLineAnnotations",value:"line-menu"},{icon:"arrow-drawing",tooltip:"toolbarAnnotationsShapeAnnotations",value:"shape-menu"},{icon:"delete",tooltip:"toolbarAnnotationsClearAll",value:"clear"}]},padding:{$ref:"chartPadding"}},optionsToolbar={buttons:{$shallowSimple:[{icon:"text-annotation",tooltip:"toolbarAnnotationsTextColor",value:"text-color"},{icon:"line-color",tooltip:"toolbarAnnotationsLineColor",value:"line-color"},{icon:"fill-color",tooltip:"toolbarAnnotationsFillColor",value:"fill-color"},{tooltip:"toolbarAnnotationsTextSize",value:"text-size"},{tooltip:"toolbarAnnotationsLineStrokeWidth",value:"line-stroke-width"},{icon:"line-style-solid",tooltip:"toolbarAnnotationsLineStyle",value:"line-style-type"},{icon:"settings",tooltip:"toolbarAnnotationsSettings",value:"settings"},{icon:"unlocked",tooltip:"toolbarAnnotationsLock",ariaLabel:"toolbarAnnotationsLock",checkedOverrides:{icon:"locked",tooltip:"toolbarAnnotationsUnlock"},value:"lock"},{icon:"delete",tooltip:"toolbarAnnotationsDelete",value:"delete"}]}},annotationsTheme={enabled:!1,line:{...stroke,handle:{...handle},text:{...lineText}},"horizontal-line":{...stroke,handle:{...handle},axisLabel:{...axisLabel},text:{...lineText}},"vertical-line":{...stroke,handle:{...handle},axisLabel:{...axisLabel},text:{...lineText}},"disjoint-channel":{...stroke,background:{fill:{$ref:"foregroundColor"},fillOpacity:.075},handle:{...handle},text:{...channelText}},"parallel-channel":{...stroke,middle:{lineDash:[6,5],strokeWidth:1},background:{fill:{$ref:"foregroundColor"},fillOpacity:.075},handle:{...handle},text:{...channelText}},"fibonacci-retracement":{...stroke,strokes:ThemeSymbols.DEFAULT_FIBONACCI_STROKES,rangeStroke:{$ref:"foregroundColor"},handle:{...handle},text:{...lineText,position:"center"},label:{...font,color:void 0,fontSize:{$rem:FONT_SIZE_RATIO.SMALLER}}},"fibonacci-retracement-trend-based":{...stroke,strokes:ThemeSymbols.DEFAULT_FIBONACCI_STROKES,rangeStroke:{$ref:"foregroundColor"},handle:{...handle},text:{...lineText,position:"center"},label:{...font,color:void 0,fontSize:{$rem:FONT_SIZE_RATIO.SMALLER}}},callout:{...stroke,...text,color:{$ref:"textColor"},handle:{...handle},fill:{$ref:"foregroundColor"},fillOpacity:.075},comment:{...text,fontWeight:700,handle:{...handle},fill:{$ref:"foregroundColor"}},note:{...text,color:ThemeSymbols.DEFAULT_TEXTBOX_COLOR,fill:ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR,stroke:{$ref:"chartBackgroundColor"},strokeWidth:1,strokeOpacity:1,handle:{...handle},background:{fill:ThemeSymbols.DEFAULT_TEXTBOX_FILL,stroke:ThemeSymbols.DEFAULT_TEXTBOX_STROKE,strokeWidth:1}},text:{...text,color:{$ref:"textColor"},handle:{...handle}},arrow:{...stroke,handle:{...handle},text:{...lineText}},"arrow-up":{fill:{$palette:"up.fill"},handle:{...handle,stroke:{$ref:"foregroundColor"}}},"arrow-down":{fill:{$palette:"down.fill"},handle:{...handle,stroke:{$ref:"foregroundColor"}}},"date-range":{...measurer},"price-range":{...measurer},"date-price-range":{...measurer},"quick-date-price-range":{up:{...stroke,fill:ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,fillOpacity:.2,handle:{...handle},statistics:{...measurerStatistics,color:"#fff",fill:ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,strokeWidth:0,divider:{stroke:"#fff",strokeWidth:1,strokeOpacity:.5}}},down:{...stroke,stroke:ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE,fill:ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL,fillOpacity:.2,handle:{...handle,stroke:ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE},statistics:{...measurerStatistics,color:"#fff",fill:ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL,strokeWidth:0,divider:{stroke:"#fff",strokeWidth:1,strokeOpacity:.5}}}},axesButtons:{},toolbar,optionsToolbar},AnnotationsModule={type:"root",optionsKey:"annotations",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:t=>new Annotations(t),themeTemplate:{annotations:annotationsTheme}},import_ag_charts_community91=require("ag-charts-community"),import_ag_charts_community90=require("ag-charts-community"),import_ag_charts_core44=require("ag-charts-core"),{BaseProperties:BaseProperties12,ObserveChanges:ObserveChanges2,ProxyProperty,Property:Property34,calculatePlacement}=import_ag_charts_community90._ModuleSupport,Image=class extends BaseProperties12{constructor(){super(),this.opacity=1,this.loadedSynchronously=!0,this.containerWidth=0,this.containerHeight=0,this.onLoad=void 0,this.onImageLoad=()=>{this.loadedSynchronously||(this.node.visible=!1,this.performLayout(this.containerWidth,this.containerHeight),this.onLoad?.())},this.imageElement=(0,import_ag_charts_core44.createElement)("img"),this.imageElement.onload=this.onImageLoad,this.node=new import_ag_charts_community90._ModuleSupport.Image(this.imageElement)}get complete(){return this.imageElement.width>0&&this.imageElement.height>0}performLayout(t,e){this.containerWidth=t,this.containerHeight=e;const i={width:t,height:e},o=calculatePlacement(this.imageElement.width,this.imageElement.height,i,this);return this.node.setProperties(this.complete?{visible:!0,opacity:this.opacity,...o}:{visible:!1}),o}};__decorateClass([Property34],Image.prototype,"top",2),__decorateClass([Property34],Image.prototype,"right",2),__decorateClass([Property34],Image.prototype,"bottom",2),__decorateClass([Property34],Image.prototype,"left",2),__decorateClass([Property34],Image.prototype,"width",2),__decorateClass([Property34],Image.prototype,"height",2),__decorateClass([Property34],Image.prototype,"opacity",2),__decorateClass([ProxyProperty("imageElement.src"),ObserveChanges2(t=>t.loadedSynchronously=t.complete)],Image.prototype,"url",2);var{ActionOnSet:ActionOnSet3,Property:Property35}=import_ag_charts_community91._ModuleSupport,Background2=class extends import_ag_charts_community91._ModuleSupport.Background{constructor(){super(...arguments),this.image=new Image}onLayoutComplete(t){if(super.onLayoutComplete(t),this.image){const{width:e,height:i}=t.chart;this.image.performLayout(e,i)}}onImageLoad(){this.ctx.updateService.update(import_ag_charts_community91._ModuleSupport.ChartUpdateType.SCENE_RENDER)}};__decorateClass([Property35,ActionOnSet3({newValue(t){this.node.appendChild(t.node),t.onLoad=()=>this.onImageLoad()},oldValue(t){t.node.remove(),t.onLoad=void 0}})],Background2.prototype,"image",2);var BackgroundModule={type:"root",optionsKey:"background",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:t=>new Background2(t)},import_ag_charts_community92=require("ag-charts-community"),import_ag_charts_core45=require("ag-charts-core"),{Range,TranslatableGroup,BBox:BBox4,Property:Property36,ZIndexMap:ZIndexMap4,ChartAxisDirection:ChartAxisDirection10,FillGradientDefaults,FillImageDefaults,FillPatternDefaults,getShapeFill,InteractionState:InteractionState3}=import_ag_charts_community92._ModuleSupport,BandHighlight=class extends import_ag_charts_community92._ModuleSupport.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.id=(0,import_ag_charts_core45.createId)(this),this.enabled=!1,this.stroke="rgb(195, 195, 195)",this.lineDash=[6,3],this.lineDashOffset=0,this.strokeWidth=1,this.strokeOpacity=1,this.fill="#c16068",this.fillOpacity=1,this.fillGradientDefaults=new FillGradientDefaults,this.fillPatternDefaults=new FillPatternDefaults,this.fillImageDefaults=new FillImageDefaults,this.bounds=new BBox4(0,0,0,0),this.bandHighlightGroup=new TranslatableGroup({name:"bandHighlight",zIndex:ZIndexMap4.AXIS_BAND_HIGHLIGHT}),this.rangeNode=this.bandHighlightGroup.appendChild(new Range),this.activeAxisHighlight=void 0,this.axisCtx=t.parent,this.hideBand(),t.domManager.addEventListener("focusin",({target:a})=>{const r=a instanceof HTMLElement&&t.domManager.contains(a,"series-area");this.bandHighlightGroup.visible&&!r&&(this.hideBand(),this.ctx.updateService.update(import_ag_charts_community92._ModuleSupport.ChartUpdateType.PERFORM_LAYOUT))});const{widgets:{seriesWidget:e,seriesDragInterpreter:i},animationManager:o,eventsHub:s}=t;this.cleanup.register(t.scene.attachNode(this.bandHighlightGroup),e.addListener("mousemove",a=>this.onHoverLikeEvent(a)),e.addListener("mouseleave",()=>this.clearAllHighlight()),o.addListener("animation-start",()=>this.clearAllHighlight()),s.on("layout:complete",a=>this.layout(a)),s.on("series:focus-change",()=>this.onKeyPress()),s.on("zoom:pan-start",()=>this.clearAllHighlight()),s.on("zoom:change",()=>this.clearAllHighlight()),s.on("dom:resize",()=>this.clearAllHighlight()),s.on("axis:change",()=>this.axisChange())),i&&this.cleanup.register(i.events.on("drag-move",a=>this.onHoverLikeEvent(a)),i.events.on("click",a=>this.onClick(a)))}axisChange(){this.onHighlightChange()}isHover(t){return t.type==="mousemove"||t.type==="click"||t.device==="touch"&&this.ctx.chartService.touch.dragAction==="hover"}onClick(t){t.device==="touch"&&this.onHoverLikeEvent(t)}clearAllHighlight(){this.ctx.interactionManager.isState(InteractionState3.Clickable)&&this.onHighlightChange()}onKeyPress(){this.ctx.interactionManager.isState(InteractionState3.Default)&&this.onHighlightChange()}onHoverLikeEvent(t){const e=this.isHover(t)?InteractionState3.Clickable:InteractionState3.AnnotationsMoveable;this.ctx.interactionManager.isState(e)&&this.handleHoverHighlight(t)}handleHoverHighlight(t){if(!t)return;const{currentX:e,currentY:i}=t;this.onHighlightChange(this.axisCtx.pickBand({x:e,y:i}))}layout({series:{rect:t,visible:e},axes:i}){if(!e||!i||!this.enabled)return;const{position:o="left",axisId:s}=this.axisCtx,a=i.find(l=>l.id===s);if(!a)return;this.axisLayout=a,this.bounds=t.clone().grow(a.gridPadding,o);const{bandHighlightGroup:r,bounds:n}=this;r.translationX=Math.round(n.x),r.translationY=Math.round(n.y),this.updateBand()}updateBand(){const{rangeNode:t,stroke:e,strokeWidth:i,strokeOpacity:o,lineDash:s,fill:a,fillOpacity:r,fillGradientDefaults:n,fillPatternDefaults:l,fillImageDefaults:c,lineDashOffset:h,axisLayout:d}=this;d&&(t.stroke=e,t.strokeWidth=i,t.strokeOpacity=o,t.lineDash=s,t.lineDashOffset=h,t.fill=getShapeFill(a,n,l,c),t.fillOpacity=r,t.startLine=!0,t.endLine=!0)}isVertical(){return this.axisCtx.direction===ChartAxisDirection10.X}onHighlightChange(t){this.enabled&&(this.activeAxisHighlight=t,this.activeAxisHighlight?this.showBand():this.hideBand(),this.ctx.updateService.update(import_ag_charts_community92._ModuleSupport.ChartUpdateType.SCENE_RENDER))}updateBandPosition(){const{rangeNode:t,bounds:e}=this,{band:i}=this.activeAxisHighlight??{};if(i==null){this.hideBand();return}let o=Math.min(...i),s=Math.max(...i);if(s-o<1){const a=(o+s)/2;o=a-.5,s=a+.5}this.isVertical()?(t.y1=0,t.y2=e.height,t.x1=o,t.x2=s,t.horizontal=!0):(t.y1=o,t.y2=s,t.x1=0,t.x2=e.width,t.horizontal=!1)}showBand(){this.updateBandPosition(),this.bandHighlightGroup.visible=!0}hideBand(){this.bandHighlightGroup.visible=!1}};__decorateClass([Property36],BandHighlight.prototype,"enabled",2),__decorateClass([Property36],BandHighlight.prototype,"stroke",2),__decorateClass([Property36],BandHighlight.prototype,"lineDash",2),__decorateClass([Property36],BandHighlight.prototype,"lineDashOffset",2),__decorateClass([Property36],BandHighlight.prototype,"strokeWidth",2),__decorateClass([Property36],BandHighlight.prototype,"strokeOpacity",2),__decorateClass([Property36],BandHighlight.prototype,"fill",2),__decorateClass([Property36],BandHighlight.prototype,"fillOpacity",2),__decorateClass([Property36],BandHighlight.prototype,"fillGradientDefaults",2),__decorateClass([Property36],BandHighlight.prototype,"fillPatternDefaults",2),__decorateClass([Property36],BandHighlight.prototype,"fillImageDefaults",2);var BandHighlightModule={type:"axis-option",optionsKey:"bandHighlight",packageType:"enterprise",chartTypes:["cartesian"],axisTypes:["category","ordinal-time","unit-time","grouped-category"],moduleFactory:t=>new BandHighlight(t),themeTemplate:{bandHighlight:{enabled:!1,strokeWidth:0,lineDash:[],fill:{$foregroundBackgroundMix:.05}}}},import_ag_charts_community93=require("ag-charts-community"),import_ag_charts_core46=require("ag-charts-core"),{ActionOnSet:ActionOnSet4,LayoutElement:LayoutElement2,Menu:Menu3,Property:Property37}=import_ag_charts_community93._ModuleSupport,menuItems=[{label:"toolbarSeriesTypeOHLC",icon:"ohlc-series",value:"ohlc"},{label:"toolbarSeriesTypeCandles",icon:"candlestick-series",value:"candlestick"},{label:"toolbarSeriesTypeHollowCandles",icon:"hollow-candlestick-series",value:"hollow-candlestick"},{label:"toolbarSeriesTypeLine",icon:"line-series",value:"line"},{label:"toolbarSeriesTypeStepLine",icon:"step-line-series",value:"step-line"},{label:"toolbarSeriesTypeHLC",icon:"hlc-series",value:"hlc"},{label:"toolbarSeriesTypeHighLow",icon:"high-low-series",value:"high-low"}],ChartToolbar=class extends import_ag_charts_community93._ModuleSupport.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.enabled=!1,this.menu=new Menu3(this.ctx,"chart-toolbar"),this.toolbar=t.sharedToolbar.getSharedToolbar("chartToolbar"),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onButtonPressed.bind(this)),t.layoutManager.registerElement(LayoutElement2.ToolbarLeft,this.onLayoutStart.bind(this)),()=>this.toolbar.destroy())}onLayoutStart(t){this.enabled&&(this.updateButton(),this.toolbar.layout(t.layoutBox))}onButtonPressed({event:t,buttonBounds:e,buttonWidget:i}){this.menu.setAnchor({x:e.x+e.width+6,y:e.y}),this.menu.show(i,{items:menuItems,menuItemRole:"menuitemradio",ariaLabel:this.ctx.localeManager.t("toolbarSeriesTypeDropdown"),class:"ag-charts-chart-toolbar__menu",value:this.getChartType(),sourceEvent:t.sourceEvent,onPress:o=>{this.setChartType(o.value),this.hidePopover()},onHide:()=>{this.toolbar.clearActiveButton()}}),this.toolbar.toggleActiveButtonByIndex(0)}updateButton(){const t=this.getChartType(),e=menuItems.find(i=>i.value===t)?.icon;e!=null&&this.toolbar.updateButtons([{icon:e,tooltip:"toolbarSeriesTypeDropdown",value:"menu"}])}hidePopover(){this.toolbar.clearActiveButton(),this.menu.hide()}setChartType(t){const e={chartType:t};this.ctx.chartService.publicApi?.updateDelta(e).catch(i=>import_ag_charts_core46.Logger.error(i))}getChartType(){const t=this.ctx.chartService.publicApi?.getOptions()?.chartType;return t==null||!menuItems.some(e=>e.value===t)?"candlestick":t}};__decorateClass([Property37,ActionOnSet4({changeValue(t){this.toolbar?.setHidden(!t)}})],ChartToolbar.prototype,"enabled",2);var ChartToolbarModule={type:"root",optionsKey:"chartToolbar",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:t=>new ChartToolbar(t)},import_ag_charts_community95=require("ag-charts-community"),import_ag_charts_community94=require("ag-charts-community"),import_ag_charts_core48=require("ag-charts-core"),import_ag_charts_core47=require("ag-charts-core");function showsFor(t,e){return t==="always"?!0:t==="series-area"?e==="series-area"||e==="series-node":t===e}function appendItem(t,e,i){let o=!0;if(e.type==="separator"){const s=i.at(-1);o=s!==void 0&&s.type!=="separator"}if(o&&(o=showsFor(e.showOn??"always",t)),o){const s=new ContextMenuItem(e);return i.push(s),s}}function appendBuiltinItem(t,e,i,o){e.isVisible(i)&&appendItem(t,e.builtins.items[i],o)}function expandBuiltin(t,e,i,o){const{builtins:s}=e;if((0,import_ag_charts_core47.isKeyOf)(i,s.lists))for(const a of s.lists[i])appendBuiltinItem(t,e,a,o);else appendBuiltinItem(t,e,i,o)}function expandItems(t,e,i,o){for(const s of i)if(typeof s=="string")expandBuiltin(t,e,s,o);else{const a=appendItem(t,s,o);s.items&&a&&s.items.length>0&&expandItems(t,e,s.items,a.items)}o.at(-1)?.type==="separator"&&o.pop()}var ContextMenuItem=class{constructor(t){this.type="action",this.showOn="always",this.label="",this.iconUrl=void 0,this.enabled=!0,this.items=[],this.action=void 0,t&&this.setOptions(t),this.items=[]}setField(t,e,i){e[t]=i}setOptions(t){let e;for(e in t)t[e]!==void 0&&this.setField(e,this,t[e])}},DEFAULT_CONTEXT_MENU_CLASS="ag-charts-context-menu",{Property:Property38,ContextMenuRegistry,callWithContext,getIconClassNames:getIconClassNames3}=import_ag_charts_community94._ModuleSupport,moduleId2="context-menu",ContextMenu=class extends import_ag_charts_community94._ModuleSupport.BaseModuleInstance{constructor(t){if(super(),this.ctx=t,this.enabled=!0,this.darkTheme=!1,this.items=["defaults"],this.pickedNode=void 0,this.showEvent=void 0,this.x=0,this.y=0,this.collapsingSubMenus=0,this.menuWidget=new import_ag_charts_community94._Widget.MenuWidget,this.interactionManager=t.interactionManager,this.element=t.domManager.addChild("canvas-overlay",moduleId2),this.element.classList.add(DEFAULT_CONTEXT_MENU_CLASS),this.element.style.display="none",this.element.addEventListener("contextmenu",e=>e.preventDefault()),this.element.addEventListener("focusout",({relatedTarget:e})=>{this.collapsingSubMenus>0||(e==null||e instanceof Node&&!this.element.contains(e))&&this.hide()}),this.cleanup.register(()=>this.element.remove(),()=>this.menuWidget.destroy(),t.eventsHub.on("dom:hidden",()=>this.hide()),this.menuWidget.addListener("collapse-widget",()=>this.onCollapse())),this.menuWidget.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__menu`),typeof MutationObserver<"u"){const e=new MutationObserver(()=>{this.element.contains(this.menuWidget.getElement())&&this.reposition()});e.observe(this.element,{childList:!0}),this.mutationObserver=e,this.cleanup.register(()=>e.disconnect())}this.ctx.contextMenuRegistry.builtins.items.download.action=()=>{const e=t.chartService.title;let i="image";e?.enabled&&(i=e.node.getPlainText().replace(/\.+/,"")),this.ctx.chartService.publicApi?.download({fileName:i}).catch(o=>{import_ag_charts_core48.Logger.error("Unable to download chart",o)})},this.cleanup.register(this.ctx.eventsHub.on("context-menu:complete",e=>this.onContext(e)))}expandItemsOptions(t){const e=[];return expandItems(t,this.ctx.contextMenuRegistry,this.items,e),e}onContext(t){if(!this.enabled)return;t.widgetEvent.sourceEvent.preventDefault(),this.showEvent=t.widgetEvent.sourceEvent,this.x=t.x,this.y=t.y,this.pickedNode=void 0,this.pickedLegendItem=void 0,ContextMenuRegistry.check("series-node",t)?this.pickedNode=t.context.pickedNode:ContextMenuRegistry.check("legend-item",t)&&(this.pickedLegendItem=t.context.legendItem);const e=this.expandItemsOptions(t.showOn);e.length!==0&&this.show(t.widgetEvent,e)}show(t,e){const{sourceEvent:i}=t;this.interactionManager.pushState(import_ag_charts_community94._ModuleSupport.InteractionState.ContextMenu),this.element.style.display="block";const o=i.pointerType==="touch"?!1:void 0;o!==void 0&&this.ctx.chartService.overrideFocusVisible(o),this.createMenu(e),this.element.appendChild(this.menuWidget.getElement()),this.menuWidget.expand({sourceEvent:i,overrideFocusVisible:o})}hide(){this.menuWidget.collapse()}onCollapse(){this.interactionManager.popState(import_ag_charts_community94._ModuleSupport.InteractionState.ContextMenu),this.menuWidget.getElement().remove(),this.element.style.display="none"}onSubMenuExpand(t,e){const i=t.getBounds();t.setFocusOverride(!0),t.getElement().insertAdjacentElement("afterend",e.getElement()),e.getElement().style.position="absolute";const o=this.ctx.domManager.getBoundingClientRect(),s=t.getBoundingClientRect(),a=o.right-s.right,r=s.left-o.left,{offsetWidth:n,offsetHeight:l}=e.getElement();let c=i.y;if(o.height>l){const h=o.bottom-s.top;h=n)e.setBounds({x:i.x+i.width,y:c});else{const h=i.x-n,d=r+h;d>=0?e.setBounds({x:h,y:c}):e.setBounds({x:h-d,y:c})}}onSubMenuCollapse(t,e){t.setFocusOverride(void 0),this.collapsingSubMenus++,e.remove(),this.collapsingSubMenus--}createMenu(t){const{menuWidget:e}=this;e.clear(),e.setTabIndex(-1),this.createMenuItems(e,t)}createMenuItems(t,e){for(const i of e)switch(i.type){case"separator":{t.addSeparator().classList.add(`${DEFAULT_CONTEXT_MENU_CLASS}__divider`);break}case"action":{if(i.items.length===0){const o=new import_ag_charts_community94._Widget.MenuItemWidget;this.initButtonElement(o,i),t.addChild(o)}else{const{subMenuButton:o,subMenu:s}=t.addSubMenu();s.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__menu`),s.addListener("expand-widget",()=>this.onSubMenuExpand(o,s)),s.addListener("collapse-widget",()=>this.onSubMenuCollapse(o,s)),this.initButtonElement(o,i),this.createMenuItems(s,i.items)}break}default:throw new Error("unhandled case")}}createButtonOnClick(t,e){return ContextMenuRegistry.checkCallback("legend-item",t,e)?i=>{const o=i.sourceEvent;if(this.pickedLegendItem){const{seriesId:s,itemId:a,label:r}=this.pickedLegendItem,{chartService:n}=this.ctx;if(typeof a!="string"){import_ag_charts_core48.Logger.error(`unexpected itemId type: [${typeof a}] (expected [string])`);return}const c=[n.series.find(d=>d.id===s)?.properties,n],h={type:"contextmenu",seriesId:s,itemId:a,text:(0,import_ag_charts_core48.toPlainText)(r.text),event:o};callWithContext(c,e,h),this.hide()}else import_ag_charts_core48.Logger.error("legend item not found")}:ContextMenuRegistry.checkCallback("series-area",t,e)?()=>{const i=this.ctx.chartService,o={type:"seriesContextMenuAction",event:this.showEvent};callWithContext(i,e,o),this.hide()}:ContextMenuRegistry.checkCallback("series-node",t,e)?()=>{const{showEvent:i}=this,{chartService:o}=this.ctx,s=this.pickedNode,a=[s?.series.properties,o],r=s?.series.createNodeContextMenuActionEvent(i,s);r?callWithContext(a,e,r):import_ag_charts_core48.Logger.error("series node not found"),this.hide()}:()=>{const i=this.ctx.chartService,o={type:"contextMenuEvent",event:this.showEvent};callWithContext(i,e,o),this.hide()}}initTableCells(t){const e=(0,import_ag_charts_core48.createElement)("div"),i=(0,import_ag_charts_core48.createElement)("div"),o=(0,import_ag_charts_core48.createElement)("div");return e.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__icon`,!0),i.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__cell`,!0),o.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__cell`,!0),e.ariaHidden="true",i.role="presentation",o.ariaHidden="true",t.append(e,i,o),{cellIcon:e,cellLabel:i,cellArrow:o}}initButtonElement(t,e){t.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__item`),t.setEnabled(e.enabled);const i=this.ctx.localeManager.t(e.label),o=`${DEFAULT_CONTEXT_MENU_CLASS}__cellpadding`,{cellIcon:s,cellLabel:a,cellArrow:r}=this.initTableCells(t.getElement());if(a.textContent=i,a.classList.add(o),e.iconUrl!=null){const c=(0,import_ag_charts_core48.createElement)("img");c.src=e.iconUrl,s.append(c),s.classList.add(o)}if(e.items.length>0){const c=(0,import_ag_charts_core48.createElement)("span",getIconClassNames3("chevron-right"));r.append(c),r.classList.add(o)}const{showOn:n,action:l}=e;l!=null&&t.addListener("click",this.createButtonOnClick(n,l)),e.items.length===0&&(t.addListener("mouseleave",()=>t.setFocusOverride(!1)),t.addListener("mouseenter",()=>t.setFocusOverride(void 0)))}reposition(){let{x:t,y:e}=this;this.element.style.top="unset",this.element.style.bottom="unset";const i=this.ctx.domManager.getBoundingClientRect(),{offsetWidth:o,offsetHeight:s}=this.element;t=(0,import_ag_charts_core48.clamp)(0,t,i.width-o),e=(0,import_ag_charts_core48.clamp)(0,e,i.height-s),this.element.style.left=`${t}px`,this.element.style.top=`calc(${e}px - 0.5em)`}destroy(){super.destroy(),this.mutationObserver?.disconnect(),this.ctx.domManager.removeStyles(moduleId2),this.ctx.domManager.removeChild("canvas-overlay",moduleId2)}};__decorateClass([Property38],ContextMenu.prototype,"enabled",2),__decorateClass([Property38],ContextMenu.prototype,"darkTheme",2),__decorateClass([Property38],ContextMenu.prototype,"items",2);var ContextMenuModule={type:"root",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],optionsKey:"contextMenu",moduleFactory:t=>new ContextMenu(t),themeTemplate:{contextMenu:{enabled:!0,darkTheme:import_ag_charts_community95._ModuleSupport.ThemeSymbols.IS_DARK_THEME}}},import_ag_charts_community97=require("ag-charts-community"),import_ag_charts_core50=require("ag-charts-core");function readDatum(t){return typeof t?.datum=="object"?t.datum:null}var import_ag_charts_community96=require("ag-charts-community"),import_ag_charts_core49=require("ag-charts-core"),{FormatManager,BaseProperties:BaseProperties13,Property:Property39}=import_ag_charts_community96._ModuleSupport,DEFAULT_LABEL_CLASS="ag-charts-crosshair-label",CrosshairLabelProperties=class extends BaseProperties13{constructor(){super(...arguments),this.enabled=!0,this.xOffset=0,this.yOffset=0,this.format=void 0,this.renderer=void 0,this._cachedFormatter=void 0}formatValue(t,e,i,o){const{formatter:s,format:a}=this,{domain:r,boundSeries:n}=o;let l;if(s!=null){const c=o.type==="number"?o.fractionDigits:void 0,h=o.type==="date"?o.unit:void 0,d=o.type==="date"?o.step:void 0;l=t(s,{value:i,domain:r,fractionDigits:c,unit:h,step:d,boundSeries:n})}if(a!=null){let c=this._cachedFormatter;(c==null||c.type!==e||c.format!==a)&&(c={type:e,format:a,formatter:FormatManager.getFormatter(e,a)},this._cachedFormatter=c),l??(l=c.formatter?.(i))}return l==null?void 0:String(l)}};__decorateClass([Property39],CrosshairLabelProperties.prototype,"enabled",2),__decorateClass([Property39],CrosshairLabelProperties.prototype,"xOffset",2),__decorateClass([Property39],CrosshairLabelProperties.prototype,"yOffset",2),__decorateClass([Property39],CrosshairLabelProperties.prototype,"formatter",2),__decorateClass([Property39],CrosshairLabelProperties.prototype,"format",2),__decorateClass([Property39],CrosshairLabelProperties.prototype,"renderer",2);var CrosshairLabel=class extends CrosshairLabelProperties{constructor(t,e,i){super(),this.domManager=t,this.id=(0,import_ag_charts_core49.createId)(this),this.element=t.addChild("canvas-overlay",`crosshair-label-${this.id}`),this.element.classList.add(DEFAULT_LABEL_CLASS),(0,import_ag_charts_core49.setAttribute)(this.element,"aria-hidden",!0),this.element.dataset.key=e,this.element.dataset.axisId=i}show(t){const{element:e}=this,i=t.x+this.xOffset,o=t.y+this.yOffset;e.style.top=`${Math.round(o)}px`,e.style.left=`${Math.round(i)}px`,this.toggle(!0)}setLabelHtml({html:t,styles:e}){if(t!==void 0&&(this.element.innerHTML=t),e!==void 0){const i=this.element.children[0]??this.element;Object.assign(i.style,e)}}getBBox(){const{element:t}=this;return new import_ag_charts_community96._ModuleSupport.BBox(t.clientLeft,t.clientTop,t.clientWidth,t.clientHeight)}toggle(t){this.element.classList.toggle("ag-charts-crosshair-label--hidden",!t)}destroy(){this.domManager.removeChild("canvas-overlay",`crosshair-label-${this.id}`)}toLabelHtml(t,e){if(typeof t=="string")return{html:t,styles:{}};e=e??{};const{text:i=e.text??"",color:o=e.color,backgroundColor:s=e.backgroundColor,opacity:a=e.opacity??1}=t,r={opacity:a,"background-color":s?.toLowerCase(),color:o};return{html:`
+ ${i} +
`,styles:r}}},{Group:Group5,TranslatableGroup:TranslatableGroup2,Line:Line4,BBox:BBox5,InteractionState:InteractionState4,Property:Property40,ZIndexMap:ZIndexMap5,ChartAxisDirection:ChartAxisDirection11}=import_ag_charts_community97._ModuleSupport,Crosshair=class extends import_ag_charts_community97._ModuleSupport.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.id=(0,import_ag_charts_core50.createId)(this),this.enabled=!1,this.stroke="rgb(195, 195, 195)",this.lineDash=[6,3],this.lineDashOffset=0,this.strokeWidth=1,this.strokeOpacity=1,this.snap=!0,this.label=new CrosshairLabelProperties,this.seriesRect=new BBox5(0,0,0,0),this.bounds=new BBox5(0,0,0,0),this.crosshairGroup=new TranslatableGroup2({name:"crosshairs",zIndex:ZIndexMap5.SERIES_CROSSHAIR}),this.lineGroup=this.crosshairGroup.appendChild(new Group5({name:`${this.id}-crosshair-lines`,zIndex:ZIndexMap5.SERIES_CROSSHAIR})),this.lineGroupSelection=import_ag_charts_community97._ModuleSupport.Selection.select(this.lineGroup,Line4,!1),this.activeHighlight=void 0,this.axisCtx=t.parent,this.labels={},this.hideCrosshairs(),t.domManager.addEventListener("focusin",({target:i})=>{const o=i instanceof HTMLElement&&t.domManager.contains(i,"series-area");this.crosshairGroup.visible&&!o&&(this.hideCrosshairs(),this.ctx.updateService.update(import_ag_charts_community97._ModuleSupport.ChartUpdateType.PERFORM_LAYOUT))});const{seriesDragInterpreter:e}=t.widgets;this.cleanup.register(t.scene.attachNode(this.crosshairGroup),t.widgets.seriesWidget.addListener("mousemove",i=>this.onMouseHoverLike(i)),t.widgets.seriesWidget.addListener("mouseleave",()=>this.onMouseOut()),t.eventsHub.on("series:focus-change",()=>this.onKeyPress()),t.eventsHub.on("zoom:pan-start",()=>this.onMouseOut()),t.eventsHub.on("zoom:change",()=>this.onMouseOut()),t.eventsHub.on("highlight:change",i=>this.onHighlightChange(i)),t.eventsHub.on("layout:complete",i=>this.layout(i)),()=>{for(const i of Object.values(this.labels))i.destroy()}),e&&this.cleanup.register(e.events.on("drag-move",i=>this.onMouseHoverLike(i)),e.events.on("click",i=>this.onClick(i)))}layout({series:{rect:t,visible:e},axes:i}){if(!e||!i||!this.enabled)return;this.seriesRect=t;const{position:o="left",axisId:s}=this.axisCtx,a=i.find(c=>c.id===s);if(!a)return;this.axisLayout=a,this.bounds=t.clone().grow(a.gridPadding+a.seriesAreaPadding,o);const{crosshairGroup:r,bounds:n}=this;r.translationX=Math.round(n.x),r.translationY=Math.round(n.y);const l=["pointer",...this.axisCtx.seriesKeyProperties()];this.updateSelections(l),this.updateLines(),this.updateLabels(l)}updateSelections(t){this.lineGroupSelection.update(t,void 0,e=>e)}updateLabels(t){const{labels:e,ctx:i}=this;for(const o of t)this.label.enabled&&(e[o]??(e[o]=new CrosshairLabel(i.domManager,o,this.axisCtx.axisId))),e[o]&&this.updateLabel(e[o])}updateLabel(t){const{enabled:e,xOffset:i,yOffset:o,format:s,renderer:a}=this.label;t.enabled=e,t.xOffset=i,t.yOffset=o,t.format=s,t.renderer=a}updateLines(){const{lineGroupSelection:t,bounds:e,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r,axisLayout:n}=this;if(!n)return;const l=this.isVertical();t.each(c=>{c.stroke=i,c.strokeWidth=o,c.strokeOpacity=s,c.lineDash=a,c.lineDashOffset=r,c.y1=0,c.y2=l?e.height:0,c.x1=0,c.x2=l?0:e.width})}isVertical(){return this.axisCtx.direction===ChartAxisDirection11.X}isHover(t){return t.type==="mousemove"||t.type==="click"||t.device==="touch"&&this.ctx.chartService.touch.dragAction==="hover"}formatValue(t){return(0,import_ag_charts_core50.toPlainText)(this.axisCtx.formatScaleValue(t,"crosshair",this.label))}onClick(t){t.device==="touch"&&this.onMouseHoverLike(t)}onMouseHoverLike(t){if(!this.enabled||this.snap)return;const e=this.isHover(t)?InteractionState4.Clickable:InteractionState4.AnnotationsMoveable;this.ctx.interactionManager.isState(e)&&(this.updatePositions(this.getData(t)),this.crosshairGroup.visible=!0,this.ctx.updateService.update(import_ag_charts_community97._ModuleSupport.ChartUpdateType.SCENE_RENDER))}onMouseOut(){this.ctx.interactionManager.isState(InteractionState4.Clickable)&&(this.hideCrosshairs(),this.ctx.updateService.update(import_ag_charts_community97._ModuleSupport.ChartUpdateType.SCENE_RENDER))}onKeyPress(){this.enabled&&!this.snap&&this.ctx.interactionManager.isState(InteractionState4.Default)&&this.hideCrosshairs()}onHighlightChange(t){if(!this.enabled)return;const{crosshairGroup:e,axisCtx:i}=this,{datum:o,series:s}=t.currentHighlight??{},a=o&&(s?.axes.x?.id===i.axisId||s?.axes.y?.id===i.axisId);if(this.activeHighlight=a?t.currentHighlight:void 0,!this.activeHighlight)this.hideCrosshairs();else if(this.snap){const r=this.getActiveHighlightData(this.activeHighlight);this.updatePositions(r),e.visible=!0}}isInRange(t){return this.axisCtx.inRange(t)}updatePositions(t){const{seriesRect:e,lineGroupSelection:i}=this;i.each((o,s)=>{const a=t[s];if(!a){o.visible=!1,this.hideLabel(s);return}o.visible=!0;const{value:r,position:n}=a;let l=0,c=0;this.isVertical()?(l=n,o.x=Math.round(l)):(c=n,o.y=Math.round(c)),this.label.enabled?this.showLabel(l+e.x,c+e.y,r,s):this.hideLabel(s)})}getData(t){const{axisCtx:e}=this,i="pointer",{xKey:o="",yKey:s=""}=this.activeHighlight??{},{currentX:a,currentY:r}=t,n=readDatum(this.activeHighlight),l=this.isVertical(),c=l?a:r;let h=n?.[l?o:s]??"";return e.continuous&&(h=e.scaleInvert(c)),{[i]:{position:c,value:h}}}getActiveHighlightData(t){const{axisCtx:e}=this,{series:i,xKey:o="",aggregatedValue:s,cumulativeValue:a,midPoint:r}=t,n=readDatum(t),l=i.getKeyProperties(e.direction),c=(e.scale.bandwidth??0)/2,h=i.axes[e.direction]?.id===e.axisId,d=l.includes("yKey")&&h,u=l.includes("xKey")&&h,p=s??a;if(d&&p!==void 0){const y=e.scale.convert(p)+c;return this.isInRange(y)?{yKey:{value:p,position:y}}:{}}if(u){const y=(this.isVertical()?r?.x:r?.y)??0,f=e.continuous?e.scaleInvert(y):n?.[o];return this.isInRange(y)?{xKey:{value:f,position:y}}:{}}const g={};for(const y of l){const f=i.properties[y],x=n?.[f],b=e.scale.convert(x)+c;this.isInRange(b)&&(g[y]={value:x,position:b})}return g}getLabelHtml(t,e){const i=this.axisLayout?.label?.fractionDigits??0,o={text:this.formatValue(t)};return this.label.renderer?e.toLabelHtml(this.label.renderer({value:t,fractionDigits:i}),o):e.toLabelHtml(o)}showLabel(t,e,i,o){if(!this.axisLayout)return;const{bounds:s}=this,a=this.labels[o],r=this.getLabelHtml(i,a);a.setLabelHtml(r);const{width:n,height:l}=a.getBBox(),c=this.axisCtx.position;let h=this.axisLayout.label.spacing+this.axisLayout.tickSize;this.axisCtx.direction===ChartAxisDirection11.X?(h-=4,a.show({x:t-n/2,y:c==="bottom"?s.y+s.height+h:s.y-l-h})):(h-=8,a.show({x:c==="right"?s.x+s.width+h:s.x-n-h,y:e-l/2}))}hideCrosshairs(){this.crosshairGroup.visible=!1;for(const t of Object.keys(this.labels))this.hideLabel(t)}hideLabel(t){this.labels[t]?.toggle(!1)}};__decorateClass([Property40],Crosshair.prototype,"enabled",2),__decorateClass([Property40],Crosshair.prototype,"stroke",2),__decorateClass([Property40],Crosshair.prototype,"lineDash",2),__decorateClass([Property40],Crosshair.prototype,"lineDashOffset",2),__decorateClass([Property40],Crosshair.prototype,"strokeWidth",2),__decorateClass([Property40],Crosshair.prototype,"strokeOpacity",2),__decorateClass([Property40],Crosshair.prototype,"snap",2),__decorateClass([Property40],Crosshair.prototype,"label",2);var CrosshairModule={type:"axis-option",optionsKey:"crosshair",packageType:"enterprise",chartTypes:["cartesian"],axisTypes:["category","time","unit-time","ordinal-time","number","log"],moduleFactory:t=>new Crosshair(t),themeTemplate:{crosshair:{snap:!0,stroke:{$ref:"subtleTextColor"},strokeWidth:1,strokeOpacity:1,lineDash:[5,6],lineDashOffset:0,label:{enabled:!0}}}},import_ag_charts_community98=require("ag-charts-community"),{ActionOnSet:ActionOnSet5,Property:Property41}=import_ag_charts_community98._ModuleSupport,DataSource=class extends import_ag_charts_community98._ModuleSupport.BaseModuleInstance{constructor(t){super(),this.enabled=!1,this.getData=()=>Promise.resolve(),this.dataService=t.dataService}updateCallback(t,e){this.dataService&&(t&&e!=null?this.dataService.updateCallback(e):this.dataService.clearCallback())}};__decorateClass([ActionOnSet5({newValue(t){this.updateCallback(t,this.getData)}}),Property41],DataSource.prototype,"enabled",2),__decorateClass([ActionOnSet5({newValue(t){this.updateCallback(this.enabled,t)}}),Property41],DataSource.prototype,"getData",2),__decorateClass([ActionOnSet5({newValue(t){this.dataService.requestThrottle=t}})],DataSource.prototype,"requestThrottle",2),__decorateClass([ActionOnSet5({newValue(t){this.dataService.dispatchThrottle=t}})],DataSource.prototype,"updateThrottle",2),__decorateClass([ActionOnSet5({newValue(t){this.dataService.dispatchOnlyLatest=!t}})],DataSource.prototype,"updateDuringInteraction",2);var DataSourceModule={type:"root",optionsKey:"dataSource",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:t=>new DataSource(t),themeTemplate:{dataSource:{enabled:!1}}},import_ag_charts_community102=require("ag-charts-community"),import_ag_charts_community101=require("ag-charts-community"),import_ag_charts_core51=require("ag-charts-core"),import_ag_charts_community99=require("ag-charts-community"),{nearestSquared,nearestSquaredInContainer,partialAssign,mergeDefaults,BBox:BBox6}=import_ag_charts_community99._ModuleSupport,HierarchicalBBox=class{constructor(t){this.components=t,this.union=BBox6.merge(t)}containsPoint(t,e){if(!this.union.containsPoint(t,e))return!1;for(const i of this.components)if(i.containsPoint(t,e))return!0;return!1}},ErrorBarNode=class extends import_ag_charts_community99._ModuleSupport.Group{constructor(){super(),this.capLength=Number.NaN,this._datum=void 0,this.whiskerPath=new import_ag_charts_community99._ModuleSupport.Path,this.capsPath=new import_ag_charts_community99._ModuleSupport.Path,this.bboxes=new HierarchicalBBox([]),this.append([this.whiskerPath,this.capsPath])}get datum(){return this._datum}set datum(t){this._datum=t}calculateCapLength(t,e){const{lengthRatio:i=1,length:o}=t,{lengthRatioMultiplier:s,lengthMax:a}=e,r=o??i*s;return Math.min(r,a)}getItemStylerParams(t,e,i,o){const{datum:s}=this;if(s==null||t.itemStyler==null)return;const{xLowerKey:a,xUpperKey:r,yLowerKey:n,yUpperKey:l}=t;return{...e,datum:s.datum,seriesId:s.series.id,xKey:s.xKey,yKey:s.yKey,xLowerKey:a,xUpperKey:r,yLowerKey:n,yUpperKey:l,highlighted:i,highlightState:o}}formatStyles(t,e,i,o,s){let{cap:a,...r}=t;const n=this.getItemStylerParams(e,t,o,s);if(n!=null&&e.itemStyler!=null){const l=i.callWithContext(e.itemStyler,n);r=mergeDefaults(l,r),a=mergeDefaults(l?.cap,l,a)}return{whiskerStyle:r,capsStyle:a}}applyStyling(t,e){partialAssign(["visible","stroke","strokeWidth","strokeOpacity","lineDash","lineDashOffset"],t,e)}update(t,e,i,o,s){if(this.datum===void 0)return;const{whiskerStyle:a,capsStyle:r}=this.formatStyles(t,e,i,o,s),{xBar:n,yBar:l,capDefaults:c}=this.datum,h=this.whiskerPath;this.applyStyling(h,a),h.path.clear(!0),l!==void 0&&(h.path.moveTo(l.lowerPoint.x,l.lowerPoint.y),h.path.lineTo(l.upperPoint.x,l.upperPoint.y)),n!==void 0&&(h.path.moveTo(n.lowerPoint.x,n.lowerPoint.y),h.path.lineTo(n.upperPoint.x,n.upperPoint.y)),h.path.closePath(),this.capLength=this.calculateCapLength(r??{},c);const d=this.capLength/2,u=this.capsPath;this.applyStyling(u,r),u.path.clear(!0),l!==void 0&&(u.path.moveTo(l.lowerPoint.x-d,l.lowerPoint.y),u.path.lineTo(l.lowerPoint.x+d,l.lowerPoint.y),u.path.moveTo(l.upperPoint.x-d,l.upperPoint.y),u.path.lineTo(l.upperPoint.x+d,l.upperPoint.y)),n!==void 0&&(u.path.moveTo(n.lowerPoint.x,n.lowerPoint.y-d),u.path.lineTo(n.lowerPoint.x,n.lowerPoint.y+d),u.path.moveTo(n.upperPoint.x,n.upperPoint.y-d),u.path.lineTo(n.upperPoint.x,n.upperPoint.y+d)),u.path.closePath()}updateBBoxes(){const{capLength:t,whiskerPath:e,capsPath:i}=this,{yBar:o,xBar:s}=this.datum??{},a=t/2,r=[];if(o!==void 0){const n=o.lowerPoint.y-o.upperPoint.y;r.push(new BBox6(o.lowerPoint.x,o.upperPoint.y,e.strokeWidth,n),new BBox6(o.lowerPoint.x-a,o.lowerPoint.y,t,i.strokeWidth),new BBox6(o.upperPoint.x-a,o.upperPoint.y,t,i.strokeWidth))}if(s!==void 0){const n=s.upperPoint.x-s.lowerPoint.x;r.push(new BBox6(s.lowerPoint.x,s.upperPoint.y,n,e.strokeWidth),new BBox6(s.lowerPoint.x,s.lowerPoint.y-a,i.strokeWidth,t),new BBox6(s.upperPoint.x,s.upperPoint.y-a,i.strokeWidth,t))}this.bboxes.components=r,this.bboxes.union=BBox6.merge(r)}containsPoint(t,e){return this.bboxes.containsPoint(t,e)}pickNode(t,e){return this.containsPoint(t,e)?this:void 0}nearestSquared(t,e,i){const{bboxes:o}=this;if(o.union.distanceSquared(t,e)>i)return{nearest:void 0,distanceSquared:1/0};const{distanceSquared:s}=nearestSquared(t,e,o.components);return{nearest:this,distanceSquared:s}}},ErrorBarGroup=class extends import_ag_charts_community99._ModuleSupport.Group{nearestSquared(t,e){const{nearest:i,distanceSquared:o}=nearestSquaredInContainer(t,e,{children:this.children()});if(i!==void 0&&!Number.isNaN(o))return{datum:i.datum,distanceSquared:o}}},import_ag_charts_community100=require("ag-charts-community"),{BaseProperties:BaseProperties14,Property:Property42}=import_ag_charts_community100._ModuleSupport,ErrorBarCap=class extends BaseProperties14{};__decorateClass([Property42],ErrorBarCap.prototype,"visible",2),__decorateClass([Property42],ErrorBarCap.prototype,"stroke",2),__decorateClass([Property42],ErrorBarCap.prototype,"strokeWidth",2),__decorateClass([Property42],ErrorBarCap.prototype,"strokeOpacity",2),__decorateClass([Property42],ErrorBarCap.prototype,"lineDash",2),__decorateClass([Property42],ErrorBarCap.prototype,"lineDashOffset",2),__decorateClass([Property42],ErrorBarCap.prototype,"length",2),__decorateClass([Property42],ErrorBarCap.prototype,"lengthRatio",2);var ErrorBarProperties=class extends BaseProperties14{constructor(){super(...arguments),this.visible=!0,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.cap=new ErrorBarCap}};__decorateClass([Property42],ErrorBarProperties.prototype,"yLowerKey",2),__decorateClass([Property42],ErrorBarProperties.prototype,"yLowerName",2),__decorateClass([Property42],ErrorBarProperties.prototype,"yUpperKey",2),__decorateClass([Property42],ErrorBarProperties.prototype,"yUpperName",2),__decorateClass([Property42],ErrorBarProperties.prototype,"xLowerKey",2),__decorateClass([Property42],ErrorBarProperties.prototype,"xLowerName",2),__decorateClass([Property42],ErrorBarProperties.prototype,"xUpperKey",2),__decorateClass([Property42],ErrorBarProperties.prototype,"xUpperName",2),__decorateClass([Property42],ErrorBarProperties.prototype,"visible",2),__decorateClass([Property42],ErrorBarProperties.prototype,"stroke",2),__decorateClass([Property42],ErrorBarProperties.prototype,"strokeWidth",2),__decorateClass([Property42],ErrorBarProperties.prototype,"strokeOpacity",2),__decorateClass([Property42],ErrorBarProperties.prototype,"lineDash",2),__decorateClass([Property42],ErrorBarProperties.prototype,"lineDashOffset",2),__decorateClass([Property42],ErrorBarProperties.prototype,"itemStyler",2),__decorateClass([Property42],ErrorBarProperties.prototype,"cap",2);var{fixNumericExtent,groupAccumulativeValueProperty,mergeDefaults:mergeDefaults2,valueProperty:valueProperty2,ChartAxisDirection:ChartAxisDirection12}=import_ag_charts_community101._ModuleSupport;function toErrorBoundCartesianSeries(t){for(const e of import_ag_charts_community101.AgErrorBarSupportedSeriesTypes)if(e===t.series.type)return t.series;throw new Error(`AG Charts - unsupported series type '${t.series.type}', error bars supported series types: ${import_ag_charts_community101.AgErrorBarSupportedSeriesTypes.join(", ")}`)}var ErrorBars=class yt extends import_ag_charts_community101._ModuleSupport.BaseModuleInstance{constructor(e){super(),this.properties=new ErrorBarProperties;const i=toErrorBoundCartesianSeries(e),{annotationGroup:o,annotationSelections:s}=i;this.cartesianSeries=i,this.groupNode=new ErrorBarGroup({name:`${o.id}-errorBars`}),o.appendChild(this.groupNode),this.selection=import_ag_charts_community101._ModuleSupport.Selection.select(this.groupNode,()=>this.errorBarFactory()),s.add(this.selection),i.addEventListener("seriesVisibilityChange",a=>this.onToggleSeriesItem(a)),this.cleanup.register(i.events.on("data-processed",a=>this.onDataProcessed(a)),i.events.on("data-update",a=>this.onDataUpdate(a)),e.eventsHub.on("highlight:change",a=>this.onHighlightChange(a)),()=>this.groupNode.remove(),()=>s.delete(this.selection))}hasErrorBars(){const{xLowerKey:e,xUpperKey:i,yLowerKey:o,yUpperKey:s}=this.properties;return(0,import_ag_charts_core51.isDefined)(e)&&(0,import_ag_charts_core51.isDefined)(i)||(0,import_ag_charts_core51.isDefined)(o)&&(0,import_ag_charts_core51.isDefined)(s)}isStacked(){const e=this.cartesianSeries.seriesGrouping?.stackCount;return e==null?!1:e>0}getUnstackPropertyDefinition(e){const i=[],{xLowerKey:o,xUpperKey:s,yLowerKey:a,yUpperKey:r,xErrorsID:n,yErrorsID:l}=this.getMaybeFlippedKeys(),{xScaleType:c,yScaleType:h}=e;return a!=null&&r!=null&&i.push(valueProperty2(a,h,{id:`${l}-lower`}),valueProperty2(r,h,{id:`${l}-upper`})),o!=null&&s!=null&&i.push(valueProperty2(o,c,{id:`${n}-lower`}),valueProperty2(s,c,{id:`${n}-upper`})),i}getStackPropertyDefinition(e){const i=[],{cartesianSeries:o}=this,{xLowerKey:s,xUpperKey:a,yLowerKey:r,yUpperKey:n,xErrorsID:l,yErrorsID:c}=this.getMaybeFlippedKeys(),{xScaleType:h,yScaleType:d}=e,u=o.seriesGrouping?.groupIndex??o.id,p={invalidValue:null,missingValue:0,separateNegative:!0,...o.visible?{}:{forceValue:0}},g=(f,x,b,m)=>groupAccumulativeValueProperty(f,"normal",{id:`${x}-${b}`,groupId:`errorGroup-${u}-${b}`,...p},m),y=(f,x,b,m)=>{i.push(...g(f,b,"lower",m),...g(x,b,"upper",m))};return r!=null&&n!=null&&y(r,n,c,d),s!=null&&a!=null&&y(s,a,l,h),i}getPropertyDefinitions(e){return this.isStacked()?this.getStackPropertyDefinition(e):this.getUnstackPropertyDefinition(e)}onDataProcessed(e){this.dataModel=e.dataModel,this.processedData=e.processedData}getDomain(e){const{xLowerKey:i,xUpperKey:o,xErrorsID:s,yLowerKey:a,yUpperKey:r,yErrorsID:n}=this.getMaybeFlippedKeys();if(e===ChartAxisDirection12.X?(0,import_ag_charts_core51.isDefined)(i)&&(0,import_ag_charts_core51.isDefined)(o):(0,import_ag_charts_core51.isDefined)(a)&&(0,import_ag_charts_core51.isDefined)(r)){const{dataModel:c,processedData:h,cartesianSeries:d}=this;if(c!=null&&h!=null){const u={x:s,y:n}[e],p=c.getDomain(d,`${u}-lower`,"value",h),g=c.getDomain(d,`${u}-upper`,"value",h),y=[Math.min(...p,...g),Math.max(...p,...g)];return fixNumericExtent(y)}}return[]}onDataUpdate(e){this.dataModel=e.dataModel,this.processedData=e.processedData,(0,import_ag_charts_core51.isDefined)(e.dataModel)&&(0,import_ag_charts_core51.isDefined)(e.processedData)&&(this.createNodeData(),this.update())}getNodeData(){return this.hasErrorBars()?this.cartesianSeries.contextNodeData?.nodeData:void 0}createNodeData(){const e=this.getNodeData(),i=this.cartesianSeries.axes[ChartAxisDirection12.X]?.scale,o=this.cartesianSeries.axes[ChartAxisDirection12.Y]?.scale;if(!(!i||!o||!e))for(let s=0;sthis.updateNode(i,o,s)))}updateNode(e,i,o){e.datum=i,e.update(this.getDefaultStyle(),this.properties,this.cartesianSeries,!1,"none"),e.updateBBoxes()}pickNodeExact(e){const{x:i,y:o}=e,s=this.groupNode.pickNode(i,o);if(s!=null)return{datum:s.datum,distanceSquared:0}}pickNodeNearest(e){return this.groupNode.nearestSquared(e.x,e.y)}pickNodeMainAxisFirst(e,i){let o,s=[1/0,1/0];const a=[e.x,e.y];i===ChartAxisDirection12.Y&&a.reverse();for(const r of this.groupNode.children()){const n=r.getBBox(),l=[n.x+n.width/2,n.y+n.height/2];i===ChartAxisDirection12.Y&&l.reverse();const c=[];for(let h=0;hnew ErrorBars(t),themeTemplate:ERROR_BARS_THEME},import_ag_charts_community103=require("ag-charts-community"),{ZIndexMap:ZIndexMap6,ActionOnSet:ActionOnSet6,Property:Property43,ProxyPropertyOnWrite:ProxyPropertyOnWrite2}=import_ag_charts_community103._ModuleSupport,Foreground=class extends import_ag_charts_community103._ModuleSupport.Background{constructor(){super(...arguments),this.image=new Image,this.fill="transparent",this.fillOpacity=void 0}createNode(){return new import_ag_charts_community103._ModuleSupport.Group({name:"foreground",zIndex:ZIndexMap6.FOREGROUND})}onLayoutComplete(t){super.onLayoutComplete(t);const{width:e,height:i}=t.chart;let o={x:0,y:0,width:e,height:i};this.image&&(o=this.image.performLayout(e,i)),this.text&&this.updateTextNode(o)}onImageLoad(){this.ctx.updateService.update(import_ag_charts_community103._ModuleSupport.ChartUpdateType.SCENE_RENDER)}updateTextNode(t){const{textNode:e}=this;e.fontWeight="bold",e.fontFamily="Impact, sans-serif",e.fontSize=19,e.opacity=.7,e.fill="#9b9b9b",e.textBaseline="top";const i=this.textNode.getBBox(),o=10;e.x=t.x+t.width/2-i.width/2,e.y=t.y+t.height+o}};__decorateClass([Property43,ActionOnSet6({newValue(t){this.node.appendChild(t.node),t.onLoad=()=>this.onImageLoad()},oldValue(t){t.node.remove(),t.onLoad=void 0}})],Foreground.prototype,"image",2),__decorateClass([Property43,ProxyPropertyOnWrite2("rectNode","fill")],Foreground.prototype,"fill",2),__decorateClass([Property43,ProxyPropertyOnWrite2("rectNode","fillOpacity")],Foreground.prototype,"fillOpacity",2);var ForegroundModule={type:"root",optionsKey:"foreground",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:t=>new Foreground(t)},import_ag_charts_community110=require("ag-charts-community"),import_ag_charts_core54=require("ag-charts-core"),import_ag_charts_community105=require("ag-charts-community"),import_ag_charts_core52=require("ag-charts-core"),import_ag_charts_community104=require("ag-charts-community"),{TranslatableGroup:TranslatableGroup3,SceneChangeDetection}=import_ag_charts_community104._ModuleSupport,MiniChartGroup=class extends TranslatableGroup3{constructor(){super(...arguments),this.inset=0,this.cornerRadius=0}applyClip(t,e){const{cornerRadius:i,inset:o}=this,{x:s,y:a,width:r,height:n}=e,l=new Path2D;l.roundRect(s+o,a+o,r-2*o,n-2*o,i),t.clip(l)}};__decorateClass([SceneChangeDetection()],MiniChartGroup.prototype,"inset",2),__decorateClass([SceneChangeDetection()],MiniChartGroup.prototype,"cornerRadius",2);var{Property:Property44,ZIndexMap:ZIndexMap7,ActionOnSet:ActionOnSet7,CategoryAxis,Padding,Group:Group6,BBox:BBox7,ProxyProperty:ProxyProperty2,stackCartesianSeries}=import_ag_charts_community105._ModuleSupport,MiniChartPadding=class{constructor(){this.top=0,this.bottom=0}};__decorateClass([Property44],MiniChartPadding.prototype,"top",2),__decorateClass([Property44],MiniChartPadding.prototype,"bottom",2);var MiniChart=class extends import_ag_charts_community105._ModuleSupport.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.enabled=!1,this.padding=new MiniChartPadding,this.root=new Group6({name:"root"}),this.seriesRoot=this.root.appendChild(new MiniChartGroup({name:"Series-root",zIndex:ZIndexMap7.SERIES_LAYER,renderToOffscreenCanvas:!0})),this.axisGridGroup=this.root.appendChild(new Group6({name:"Axes-Grids",zIndex:ZIndexMap7.AXIS_GRID})),this.axisGroup=this.root.appendChild(new Group6({name:"Axes-Grids",zIndex:ZIndexMap7.AXIS_GRID})),this.axisLabelGroup=this.root.appendChild(new Group6({name:"Axes-Labels",zIndex:ZIndexMap7.SERIES_LABEL})),this.axisCrosslineRangeGroup=this.root.appendChild(new Group6({name:"Axes-Crosslines-Range",zIndex:ZIndexMap7.SERIES_CROSSLINE_RANGE})),this.axisCrosslineLineGroup=this.root.appendChild(new Group6({name:"Axes-Crosslines-Line",zIndex:ZIndexMap7.SERIES_CROSSLINE_LINE})),this.axisCrosslineLabelGroup=this.root.appendChild(new Group6({name:"Axes-Crosslines-Label",zIndex:ZIndexMap7.SERIES_LABEL})),this.data=[],this._destroyed=!1,this.miniChartAnimationPhase="initial",this.seriesRect=void 0,this.axes=[],this.series=[]}destroy(){if(!this._destroyed){this.destroySeries(this.series);for(const t of this.axes)t.destroy();this.axes=[],this._destroyed=!0}}onSeriesChange(t,e){const i=e?.filter(o=>!t.includes(o))??[];this.destroySeries(i);for(const o of t)e?.includes(o)||(o.attachSeries(this.seriesRoot,this.seriesRoot,void 0),o.chart={},Object.defineProperty(o.chart,"mode",{get:()=>"standalone"}),Object.defineProperty(o.chart,"isMiniChart",{get:()=>!0}),Object.defineProperty(o.chart,"seriesRect",{get:()=>this.seriesRect}),o.resetAnimation(this.miniChartAnimationPhase==="initial"?"initial":"disabled"));this.seriesRect=void 0}destroySeries(t){if(t)for(const e of t)e.destroy(),e.detachSeries(this.seriesRoot,this.seriesRoot,void 0),e.chart=void 0}assignSeriesToAxes(){for(const t of this.axes)t.boundSeries=this.series.filter(e=>e.axes[t.direction]===t)}assignAxesToSeries(){const t={};for(const e of this.axes){const i=e.direction;(t[i]??(t[i]=[])).push(e)}for(const e of this.series)for(const i of e.directions){const o=t[i];if(!o){import_ag_charts_core52.Logger.warnOnce(`no available axis for direction [${i}]; check series and axes configuration.`);continue}const s=e.getKeys(i),a=this.findMatchingAxis(o,s);if(!a){import_ag_charts_core52.Logger.warnOnce(`no matching axis for direction [${i}] and keys [${s}]; check series and axes configuration.`);continue}e.axes[i]=a}}findMatchingAxis(t,e){for(const i of t){if(!i.keys.length)return i;if(e){for(const o of e)if(i.keys.includes(o))return i}}}updateData(t){for(const e of this.series)e.setChartData(t);this.miniChartAnimationPhase==="initial"&&this.ctx.animationManager.onBatchStop(()=>{this.miniChartAnimationPhase="ready";for(const e of this.series)e.resetAnimation("disabled")})}async processData(t){this.series.some(e=>e.canHaveAxes)&&(this.assignAxesToSeries(),this.assignSeriesToAxes()),await Promise.all(this.series.map(async e=>(e.resetDatumCallbackCache(),e.processData(t))));for(const e of this.axes)e.processData()}computeAxisPadding(){const t=new Padding;if(!this.enabled)return t;for(const{position:e,thickness:i,line:o,label:s}of this.axes){if(e==null)continue;let a;i?a=i:a=(o.enabled?o.width:0)+(s.enabled?(0,import_ag_charts_core52.calcLineHeight)(s.fontSize??0)+s.spacing:0),t[e]=Math.ceil(a)}return t}async layout(t,e){var i;const{padding:o}=this,s=this.seriesRect!=null,a=new BBox7(0,0,t,e-(o.top+o.bottom)),r=this.seriesRect==null||this.seriesRect.width!==t||this.seriesRect.height!==e;this.seriesRect=a,this.seriesRoot.translationY=o.top,this.seriesRoot.setClipRectCanvasSpace(new BBox7(0,-o.top,t,e));for(const n of this.axes){const{position:l="left"}=n;switch(l){case"top":case"bottom":n.range=[0,a.width],n.gridLength=a.height;break;case"right":case"left":{const c=n instanceof CategoryAxis;n.range=c?[0,a.height]:[a.height,0],n.gridLength=a.width;break}}if(n.gridPadding=0,n.translation.x=0,n.translation.y=0,l==="right"?n.translation.x=t:l==="bottom"&&(n.translation.y=e),s||n.resetAnimation("initial"),n.crossLines)for(const c of n.crossLines)c instanceof import_ag_charts_community105._ModuleSupport.CartesianCrossLine&&(c.position=n.position??"top",(i=c.label).parallel??(i.parallel=n.label?.parallel));n.calculateLayout(),n.update()}r&&stackCartesianSeries(this.series),await Promise.all(this.series.map(async n=>n.update({seriesRect:a})))}};__decorateClass([Property44],MiniChart.prototype,"enabled",2),__decorateClass([ProxyProperty2(["seriesRoot","inset"])],MiniChart.prototype,"inset",2),__decorateClass([ProxyProperty2(["seriesRoot","cornerRadius"])],MiniChart.prototype,"cornerRadius",2),__decorateClass([ActionOnSet7({changeValue(t,e=[]){const i={axisNode:this.axisGroup,gridNode:this.axisGridGroup,labelNode:this.axisLabelGroup,crossLineLineNode:this.axisCrosslineLineGroup,crossLineRangeNode:this.axisCrosslineRangeGroup,crossLineLabelNode:this.axisCrosslineLabelGroup};for(const o of e)t.includes(o)||(o.detachAxis(),o.destroy());for(const o of t)e?.includes(o)||o.attachAxis(i)}})],MiniChart.prototype,"axes",2),__decorateClass([ActionOnSet7({changeValue(t,e){this.onSeriesChange(t,e)}})],MiniChart.prototype,"series",2);var import_ag_charts_community106=require("ag-charts-community"),import_ag_charts_core53=require("ag-charts-core"),{SliderWidget}=import_ag_charts_community106._ModuleSupport,NavigatorDOMProxy=class{constructor(t,e){this.ctx=t,this.sliderHandlers=e,this._min=0,this._max=1,this.minRange=.001,this.dragStartX=0,this.ctx=t,this.toolbar=t.proxyInteractionService.createProxyContainer({type:"toolbar",domManagerId:"navigator-toolbar",classList:["ag-charts-proxy-navigator-toolbar"],orientation:"vertical",ariaLabel:{id:"ariaLabelNavigator"}}),this.sliders=[t.proxyInteractionService.createProxyElement({type:"slider",domIndex:1,ariaLabel:{id:"ariaLabelNavigatorMinimum"},parent:this.toolbar,cursor:"ew-resize"}),t.proxyInteractionService.createProxyElement({type:"slider",domIndex:-1/0,ariaLabel:{id:"ariaLabelNavigatorRange"},parent:this.toolbar,cursor:"grab"}),t.proxyInteractionService.createProxyElement({type:"slider",domIndex:2,ariaLabel:{id:"ariaLabelNavigatorMaximum"},parent:this.toolbar,cursor:"ew-resize"})];for(const[i,o]of["min","pan","max"].entries()){const s=this.sliders[i];s.step=SliderWidget.STEP_HUNDRETH,s.keyboardStep=SliderWidget.STEP_ONE,s.orientation="horizontal",s.setPreventsDefault(!1),s.addListener("drag-start",a=>this.onDragStart(i,a,o)),s.addListener("drag-move",a=>this.onDrag(s,a,o)),s.addListener("drag-end",()=>this.updateSliderRatios()),s.addListener("contextmenu",a=>this.onContextMenu(s,a))}this.sliders[0].addListener("change",()=>this.onMinSliderChange()),this.sliders[1].addListener("change",()=>this.onPanSliderChange()),this.sliders[2].addListener("change",()=>this.onMaxSliderChange()),this.updateSliderRatios(),this.updateVisibility(!1)}destroy(){this.toolbar.destroy()}updateVisibility(t){this.toolbar.setHidden(!t)}updateZoom(){const{_min:t,_max:e}=this;if(!(t==null||e==null))return this.ctx.zoomManager.updateZoom("navigator",{x:{min:t,max:e}})}updateBounds(t){this.toolbar.setBounds(t)}updateSliderBounds(t,e){this.sliders[t].setBounds(e)}updateMinMax(t,e){this._min=t,this._max=e,this.updateSliderRatios()}updateSliderRatios(){let{_min:t,_max:e}=this;t=Math.round(t*100)/100,e=Math.round(e*100)/100;const i=this.ctx.localeManager.t("ariaValuePanRange",{min:t,max:e});this.sliders[0].setValueRatio(t),this.sliders[1].setValueRatio(t,{ariaValueText:i}),this.sliders[2].setValueRatio(e)}toCanvasOffsets(t){return{offsetX:this.dragStartX+t.originDeltaX}}moveToFront(t){if(t===1)return;const e=this.sliders[t],i=this.sliders[2-t];this.toolbar.moveChild(i,e.domIndex-1)}onDragStart(t,e,i){const o=this.sliders[t],s=this.toolbar.cssLeft(),a=o.cssLeft();this.dragStartX=s+a+e.offsetX,this.moveToFront(t),e.sourceEvent.preventDefault(),this.sliderHandlers.onDragStart(i,this.toCanvasOffsets(e))}onDrag(t,e,i){e.sourceEvent.preventDefault(),this.sliderHandlers.onDrag(i,this.toCanvasOffsets(e))}onContextMenu(t,e){const{offsetX:i,offsetY:o}=e,{x:s,y:a}=this.toolbar.getBounds(),{x:r,y:n}=t.getBounds(),l=i+s+r,c=o+a+n;this.ctx.contextMenuRegistry.dispatchContext("always",{widgetEvent:e,canvasX:l,canvasY:c},void 0)}onPanSliderChange(){const t=this.sliders[1].getValueRatio(),e=this._max-this._min;this._min=(0,import_ag_charts_core53.clamp)(0,t,1-e),this._max=this._min+e,this.updateZoom()}onMinSliderChange(){this._min=this.sliders[0].clampValueRatio(0,this._max-this.minRange),this.updateZoom()}onMaxSliderChange(){this._max=this.sliders[2].clampValueRatio(this._min+this.minRange,1),this.updateZoom()}},import_ag_charts_community107=require("ag-charts-community"),{Property:Property45,SceneChangeDetection:SceneChangeDetection2,BBox:BBox8,ExtendedPath2D}=import_ag_charts_community107._ModuleSupport,RangeHandle=class extends import_ag_charts_community107._ModuleSupport.Path{constructor(){super(...arguments),this.zIndex=3,this.centerX=0,this.centerY=0,this.width=8,this.height=16,this.cornerRadius=4,this.grip=!0,this.gripPath=new ExtendedPath2D}setCenter(t,e){this.dirtyPath=!0,(this.centerX!==t||this.centerY!==e)&&(this.centerX=t,this.centerY=e,this.markDirty("center"))}static align(t,e,i,o,s,a,r,n,l){const c=t.align(i+s*r)+l,h=c+t.align(i+s*r,s*(n-r))-2*l,d=t.align(o+a/2);t.setCenter(c,d),e.setCenter(h,d)}computeBBox(){const{centerX:t,centerY:e,width:i,height:o}=this,s=t-i/2,a=e-o/2;return new BBox8(s,a,i,o)}isPointInPath(t,e){return this.getBBox().containsPoint(t,e)}updatePath(){const{centerX:t,centerY:e,path:i,gripPath:o,strokeWidth:s,cornerRadius:a,grip:r}=this,n=s/2,l=this.layerManager?.canvas?.pixelRatio??1;i.clear(),o.clear();const c=Math.floor(this.width/2*l)/l,h=Math.floor(this.height/2*l)/l;i.roundRect(t-c+n,e-h+n,2*(c-n),2*(h-n),a);const d=3;if(r)for(let u=-.5;u<=.5;u+=1)for(let p=-1;p<=1;p+=1)o.arc(t+u*d,e+p*d,1,0,2*Math.PI),o.closePath()}renderFill(t,e){const{stroke:i}=this;super.renderFill(t,e),t.fillStyle=typeof i=="string"?i:"black",t.fill(this.gripPath.getPath2D())}};RangeHandle.className="RangeHandle",__decorateClass([Property45,SceneChangeDetection2()],RangeHandle.prototype,"width",2),__decorateClass([Property45,SceneChangeDetection2()],RangeHandle.prototype,"height",2),__decorateClass([Property45,SceneChangeDetection2()],RangeHandle.prototype,"cornerRadius",2),__decorateClass([Property45,SceneChangeDetection2()],RangeHandle.prototype,"grip",2);var import_ag_charts_community108=require("ag-charts-community"),{Path:Path6,BBox:BBox9,ExtendedPath2D:ExtendedPath2D2,clippedRoundRect,Property:Property46,SceneChangeDetection:SceneChangeDetection3}=import_ag_charts_community108._ModuleSupport,RangeMask=class extends Path6{constructor(){super(...arguments),this.cornerRadius=4,this.zIndex=2,this.x=0,this.y=0,this.width=200,this.height=30,this.min=0,this.max=1,this.visiblePath=new ExtendedPath2D2}layout(t,e,i,o,s,a){s=Number.isNaN(s)?this.min:s,a=Number.isNaN(a)?this.max:a,(t!==this.x||e!==this.y||i!==this.width||this.height!==o||s!==this.min||a!==this.max)&&(this.x=t,this.y=e,this.width=i,this.height=o,this.min=s,this.max=a,this.dirtyPath=!0,this.markDirty("RangeMask.layout"))}computeBBox(){const{x:t,y:e,width:i,height:o}=this;return new BBox9(t,e,i,o)}computeVisibleRangeBBox(){const{x:t,y:e,width:i,height:o,min:s,max:a}=this,r=t+i*s,n=t+i*a;return new BBox9(r,e,n-r,o)}updatePath(){const{path:t,visiblePath:e,x:i,y:o,width:s,height:a,min:r,max:n,strokeWidth:l,cornerRadius:c}=this,h=l/2;t.clear(),e.clear();const d=this.align(i)+h,u=this.align(o)+h,p=this.align(i,s)-2*h,g=this.align(o,a)-2*h,y=this.align(i+s*r)+h,f=y+this.align(i+s*r,s*(n-r))-2*h,x={topLeft:c,topRight:c,bottomRight:c,bottomLeft:c},b=(m,S,v)=>{if(v-S<1)return;const M=new BBox9(S,u,v-S,g);clippedRoundRect(m,d,u,p,g,x,M)};b(t,d,y),b(t,f,p+d),b(e,y,f)}renderStroke(t,e){super.renderStroke(t,e),super.renderStroke(t,this.visiblePath.getPath2D())}};RangeMask.className="RangeMask",__decorateClass([Property46,SceneChangeDetection3()],RangeMask.prototype,"cornerRadius",2);var import_ag_charts_community109=require("ag-charts-community"),RangeSelector=class extends import_ag_charts_community109._ModuleSupport.Group{constructor(t){super({name:"rangeSelectorGroup",zIndex:import_ag_charts_community109._ModuleSupport.ZIndexMap.NAVIGATOR}),this.x=0,this.y=0,this.width=200,this.height=30,this.lOffset=0,this.rOffset=0,this.background=this.appendChild(new import_ag_charts_community109._ModuleSupport.TranslatableGroup({name:"navigator-background",zIndex:1})),this.append(t)}layout(t,e,i,o,s,a){this.x=t,this.y=e,this.width=i,this.height=o,this.lOffset=s,this.rOffset=a,this.background.translationX=t,this.background.translationY=e,this.markDirty("RangeSelector")}updateBackground(t,e){t?.remove(),e!=null&&this.background.appendChild(e),this.markDirty("RangeSelector")}computeBBox(){const{x:t,y:e,width:i,height:o,lOffset:s,rOffset:a}=this;return new import_ag_charts_community109._ModuleSupport.BBox(t-s,e,i+(s+a),o)}},{BaseModuleInstance:BaseModuleInstance2,ObserveChanges:ObserveChanges3,Property:Property47}=import_ag_charts_community110._ModuleSupport,Navigator=class extends BaseModuleInstance2{constructor(t){super(),this.ctx=t,this.enabled=!1,this.mask=new RangeMask,this.minHandle=new RangeHandle,this.maxHandle=new RangeHandle,this.maskVisibleRange={id:"navigator-mask-visible-range",getBBox:()=>this.mask.computeVisibleRangeBBox(),toCanvasBBox:()=>this.mask.computeVisibleRangeBBox(),fromCanvasPoint:(e,i)=>({x:e,y:i})},this.height=30,this.cornerRadius=0,this.spacing=10,this.x=0,this.y=0,this.width=0,this.rangeSelector=new RangeSelector([this.mask,this.minHandle,this.maxHandle]),this.cleanup.register(t.scene.attachNode(this.rangeSelector),t.eventsHub.on("locale:change",()=>this.updateZoom()),t.layoutManager.registerElement(import_ag_charts_community110._ModuleSupport.LayoutElement.Navigator,e=>this.onLayoutStart(e)),t.eventsHub.on("layout:complete",e=>this.onLayoutComplete(e)),t.eventsHub.on("zoom:change",e=>this.onZoomChange(e))),this.domProxy=new NavigatorDOMProxy(t,this),this.updateGroupVisibility(),this.miniChart=new MiniChart(t)}updateBackground(t,e){this.rangeSelector?.updateBackground(t,e)}updateGroupVisibility(){const{enabled:t}=this;this.rangeSelector==null||t===this.rangeSelector.visible||(this.rangeSelector.visible=t,this.domProxy.updateVisibility(t),t?this.updateZoom():this.ctx.zoomManager.updateZoom("navigator"))}onLayoutStart(t){if(this.enabled){const{layoutBox:e}=t,i=this.height+this.spacing;e.shrink(i,"bottom"),this.y=e.y+e.height+this.spacing}else this.y=0;if(this.enabled&&this.miniChart){const{top:e,bottom:i}=this.miniChart.computeAxisPadding();t.layoutBox.shrink(e+i,"bottom"),this.y-=i,this.miniChart.inset=this.mask.strokeWidth/2,this.miniChart.cornerRadius=this.mask.cornerRadius}}onLayoutComplete(t){const{x:e,width:i}=t.series.rect,{y:o,height:s}=this;if(this.domProxy.updateVisibility(this.enabled),this.enabled){const{_min:a,_max:r}=this.domProxy;this.layoutNodes(e,o,i,s,a,r),this.domProxy.updateBounds({x:e,y:o,width:i,height:s})}this.x=e,this.width=i,this.miniChart?.layout(i,s).catch(a=>import_ag_charts_core54.Logger.error(a))}canDrag(){return this.enabled&&this.ctx.interactionManager.isState(import_ag_charts_community110._ModuleSupport.InteractionState.ZoomDraggable)}onDragStart(t,{offsetX:e}){this.canDrag()&&(t==="pan"&&(this.panStart=(e-this.x)/this.width-this.domProxy._min),this.ctx.zoomManager.fireZoomPanStartEvent("navigator"))}onDrag(t,{offsetX:e}){if(!this.canDrag())return;const{panStart:i,x:o,width:s}=this,{minRange:a}=this.domProxy;let{_min:r,_max:n}=this.domProxy;const l=(e-o)/s;if(t==="min")r=(0,import_ag_charts_core54.clamp)(0,l,n-a);else if(t==="max")n=(0,import_ag_charts_core54.clamp)(r+a,l,1);else if(t==="pan"&&i!=null){const c=n-r;r=(0,import_ag_charts_core54.clamp)(0,l-i,1-c),n=r+c}this.domProxy._min=r,this.domProxy._max=n,this.updateZoom()}onZoomChange(t){const{x:e}=t;if(!e)return;const{x:i,y:o,width:s,height:a}=this,{min:r,max:n}=e;this.domProxy.updateMinMax(r,n),this.layoutNodes(i,o,s,a,r,n)}layoutNodes(t,e,i,o,s,a){const{rangeSelector:r,mask:n,minHandle:l,maxHandle:c}=this;n.layout(t,e,i,o,s,a),r.layout(t,e,i,o,l.width/2,c.width/2),RangeHandle.align(l,c,t,e,i,o,s,a,n.strokeWidth/2),s+(a-s)/2<.5?(l.zIndex=3,c.zIndex=4):(l.zIndex=4,c.zIndex=3);for(const[h,d]of[l,this.maskVisibleRange,c].entries()){const u=d.getBBox(),p={x:u.x-t,y:u.y-e,height:u.height,width:u.width};this.domProxy.updateSliderBounds(h,p)}}updateZoom(){this.enabled&&this.domProxy.updateZoom()}updateData(t){return this.miniChart?.updateData(t)}async processData(t){if(this.miniChart)return this.miniChart?.processData(t)}};__decorateClass([ObserveChanges3((t,e,i)=>{t.updateBackground(i?.root,e?.root)})],Navigator.prototype,"miniChart",2),__decorateClass([Property47,ObserveChanges3((t,e)=>{t.ctx.zoomManager.setNavigatorEnabled(!!e),t.updateGroupVisibility()})],Navigator.prototype,"enabled",2),__decorateClass([Property47],Navigator.prototype,"height",2),__decorateClass([Property47,ObserveChanges3((t,e)=>{t.mask.cornerRadius=e})],Navigator.prototype,"cornerRadius",2),__decorateClass([Property47],Navigator.prototype,"spacing",2);var import_ag_charts_community156=require("ag-charts-community"),import_ag_charts_community155=require("ag-charts-community"),import_ag_charts_core65=require("ag-charts-core"),import_ag_charts_community116=require("ag-charts-community"),import_ag_charts_community113=require("ag-charts-community");function prepareBoxPlotFromTo(t){return{from:t?{scalingX:1,scalingY:0}:{scalingX:0,scalingY:1},to:{scalingX:1,scalingY:1}}}function resetBoxPlotSelectionsScalingCenterFn(t){return(e,i)=>t?{scalingCenterY:i.scaledValues.medianValue}:{scalingCenterX:i.scaledValues.medianValue}}var import_ag_charts_community111=require("ag-charts-community"),{Path:Path7,Scalable,ExtendedPath2D:ExtendedPath2D3,SceneChangeDetection:SceneChangeDetection4,SceneArrayChangeDetection,BBox:BBox10,clippedRoundRect:baseClippedRoundRect}=import_ag_charts_community111._ModuleSupport,BoxPlotNode=class extends Scalable(Path7){constructor(){super(...arguments),this.wickPath=new ExtendedPath2D3,this.horizontal=!1,this.center=0,this.thickness=0,this.min=0,this.q1=0,this.median=0,this.q3=0,this.max=0,this.cornerRadius=0,this.crisp=!1,this.strokeAlignment=0,this.wickStroke=void 0,this.wickStrokeWidth=void 0,this.wickStrokeOpacity=void 0,this.capLengthRatio=1,this.wickStrokeAlignment=0}computeBBox(){const{horizontal:t,center:e,thickness:i,min:o,max:s}=this;return t?new BBox10(Math.min(o,s),e-i/2,Math.abs(s-o),i):new BBox10(e-i/2,Math.min(o,s),i,Math.abs(s-o))}computeDefaultGradientFillBBox(){const{horizontal:t,center:e,thickness:i,q1:o,q3:s}=this;return t?new BBox10(Math.min(o,s),e-i/2,Math.abs(s-o),i):new BBox10(e-i/2,Math.min(o,s),i,Math.abs(s-o))}isPointInPath(t,e){return this.getBBox().containsPoint(t,e)}distanceSquared(t,e){return this.getBBox().distanceSquared(t,e)}get midPoint(){return this.horizontal?{x:(this.min+this.max)/2,y:this.center}:{x:this.center,y:(this.min+this.max)/2}}alignedCoordinates(){const{thickness:t,crisp:e}=this;let{center:i,min:o,q1:s,median:a,q3:r,max:n}=this,l=i-t/2,c=i+t/2;if(e&&t>1){o=this.align(o),s=this.align(s),a=this.align(a),r=this.align(r),n=o+this.align(o,n-o);const h=this.align(t/2);i=this.align(i),l=i-h,c=i+h}return{center:i,x0:l,x1:c,min:o,max:n,q1:s,median:a,q3:r}}updatePath(){const{path:t,stroke:e,strokeWidth:i,strokeOpacity:o,lineDash:s,lineDashOffset:a,wickStroke:r,wickStrokeWidth:n,wickStrokeOpacity:l,wickLineDash:c,wickLineDashOffset:h,strokeAlignment:d,cornerRadius:u,capLengthRatio:p,horizontal:g}=this,{center:y,x0:f,x1:x,min:b,max:m,q1:S,median:v,q3:M}=this.alignedCoordinates(),D=this.layerManager?.canvas.pixelRatio??1,k=this.wickStrokeAlignment>0?D/this.wickStrokeAlignment/2%1:0;this.path.clear(),this.wickPath.clear();const T=r!=null&&r!==e||n!=null&&n!==i||l!=null&&l!==o||c!=null&&c!==s||h!=null&&h!==a?this.wickPath:t;if(Math.abs(x-f)<=3){moveTo(T,g,y,b),lineTo(T,g,y,m);return}const w=Math.min(b,m),R=Math.max(b,m),F=Math.min(S,M),O=Math.max(S,M),E=y-Math.abs((x-f)*p)/2,I=y+Math.abs((x-f)*p)/2;moveTo(T,g,E,w-k),lineTo(T,g,I,w-k),moveTo(T,g,y-k,w-k),lineTo(T,g,y-k,F+i/2),moveTo(T,g,y-k,R+k),lineTo(T,g,y-k,O-i/2),moveTo(T,g,E,R+k),lineTo(T,g,I,R+k);const C=i/2+d,L=i/2-d,A=O-F-2*L;if(A>0){const P=f+C,z=F+L,B=x-f-2*C,V={topLeft:u,topRight:u,bottomRight:u,bottomLeft:u};clippedRoundRect2(t,g,P,z,B,A,V,new BBox10(P,z,B,v-z)),clippedRoundRect2(t,g,P,z,B,A,V,new BBox10(P,v,B,z+A-v))}else{const P=(F+O)/2;moveTo(t,g,f,P),lineTo(t,g,x,P)}}drawPath(t){super.drawPath(t);const{wickPath:e}=this;if(e.isEmpty())return;const{stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r,wickStroke:n=i,wickStrokeWidth:l=o,wickStrokeOpacity:c=s,wickLineDash:h=a,wickLineDashOffset:d=r}=this;l!==0&&(t.globalAlpha*=c,typeof n=="string"&&(t.strokeStyle=n),t.lineWidth=l,h!=null&&t.setLineDash([...h]),t.lineDashOffset=d,t.stroke(e.getPath2D()))}};__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"horizontal",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"center",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"thickness",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"min",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"q1",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"median",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"q3",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"max",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"cornerRadius",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"crisp",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"strokeAlignment",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"wickStroke",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"wickStrokeWidth",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"wickStrokeOpacity",2),__decorateClass([SceneArrayChangeDetection()],BoxPlotNode.prototype,"wickLineDash",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"wickLineDashOffset",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"capLengthRatio",2),__decorateClass([SceneChangeDetection4()],BoxPlotNode.prototype,"wickStrokeAlignment",2);function moveTo(t,e,i,o){e?t.moveTo(o,i):t.moveTo(i,o)}function lineTo(t,e,i,o){e?t.lineTo(o,i):t.lineTo(i,o)}function clippedRoundRect2(t,e,i,o,s,a,r,n){e?baseClippedRoundRect(t,o,i,a,s,r,n==null?void 0:new BBox10(n.y,n.x,n.height,n.width)):baseClippedRoundRect(t,i,o,s,a,r,n)}var import_ag_charts_community112=require("ag-charts-community"),{BaseProperties:BaseProperties15,AbstractBarSeriesProperties,makeSeriesTooltip,Property:Property48,mergeDefaults:mergeDefaults3}=import_ag_charts_community112._ModuleSupport,BoxPlotSeriesCap=class extends BaseProperties15{constructor(){super(...arguments),this.lengthRatio=.5}};__decorateClass([Property48],BoxPlotSeriesCap.prototype,"lengthRatio",2);var BoxPlotSeriesWhisker=class extends BaseProperties15{};__decorateClass([Property48],BoxPlotSeriesWhisker.prototype,"stroke",2),__decorateClass([Property48],BoxPlotSeriesWhisker.prototype,"strokeWidth",2),__decorateClass([Property48],BoxPlotSeriesWhisker.prototype,"strokeOpacity",2),__decorateClass([Property48],BoxPlotSeriesWhisker.prototype,"lineDash",2),__decorateClass([Property48],BoxPlotSeriesWhisker.prototype,"lineDashOffset",2);var BoxPlotSeriesProperties=class extends AbstractBarSeriesProperties{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.cap=new BoxPlotSeriesCap,this.whisker=new BoxPlotSeriesWhisker,this.tooltip=makeSeriesTooltip()}toJson(){const{stroke:t,strokeWidth:e,strokeOpacity:i,lineDash:o,lineDashOffset:s}=this,a=super.toJson();return a.whisker=mergeDefaults3(a.whisker,{stroke:t,strokeWidth:e,strokeOpacity:i,lineDash:o,lineDashOffset:s}),a}};__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"xKey",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"minKey",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"q1Key",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"medianKey",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"q3Key",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"maxKey",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"xName",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"yName",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"minName",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"q1Name",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"medianName",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"q3Name",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"maxName",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"fill",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"stroke",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"lineDash",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"styler",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"cap",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"whisker",2),__decorateClass([Property48],BoxPlotSeriesProperties.prototype,"tooltip",2);var{fixNumericExtent:fixNumericExtent2,keyProperty:keyProperty2,mergeDefaults:mergeDefaults4,SeriesNodePickMode,SMALLEST_KEY_INTERVAL,valueProperty:valueProperty3,diff,animationValidation,computeBarFocusBounds,createDatumId,HighlightState,ContinuousScale:ContinuousScale4,ChartAxisDirection:ChartAxisDirection13,motion,getItemStyles,applyShapeFillBBox,calculateSegments,toHighlightString}=import_ag_charts_community113._ModuleSupport,BoxPlotSeriesNodeEvent=class extends import_ag_charts_community113._ModuleSupport.SeriesNodeEvent{constructor(t,e,i,o){super(t,e,i,o),this.xKey=o.properties.xKey,this.minKey=o.properties.minKey,this.q1Key=o.properties.q1Key,this.medianKey=o.properties.medianKey,this.q3Key=o.properties.q3Key,this.maxKey=o.properties.maxKey}},BoxPlotSeries=class extends import_ag_charts_community113._ModuleSupport.AbstractBarSeries{constructor(t){super({moduleCtx:t,pickModes:[SeriesNodePickMode.NEAREST_NODE,SeriesNodePickMode.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["medianKey","q1Key","q3Key","minKey","maxKey"]},propertyNames:{x:["xName"],y:["medianName","q1Name","q3Name","minName","maxName"]},categoryKey:"xValue",pathsPerSeries:[]}),this.properties=new BoxPlotSeriesProperties,this.NodeEvent=BoxPlotSeriesNodeEvent}async processData(t){if(!this.visible)return;const{xKey:e,minKey:i,q1Key:o,medianKey:s,q3Key:a,maxKey:r}=this.properties,n=!this.ctx.animationManager.isSkipped(),l=this.getCategoryAxis()?.scale,c=this.getValueAxis()?.scale,{isContinuousX:h,xScaleType:d,yScaleType:u}=this.getScaleInformation({xScale:l,yScale:c}),p=[];n&&this.processedData&&p.push(diff(this.id,this.processedData)),n&&p.push(animationValidation());const{processedData:g}=await this.requestDataModel(t,this.data,{props:[keyProperty2(e,d,{id:"xValue"}),valueProperty3(i,u,{id:"minValue"}),valueProperty3(o,u,{id:"q1Value"}),valueProperty3(s,u,{id:"medianValue"}),valueProperty3(a,u,{id:"q3Value"}),valueProperty3(r,u,{id:"maxValue"}),...h?[SMALLEST_KEY_INTERVAL]:[],...p]});this.smallestDataInterval=g.reduced?.smallestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(t){const{processedData:e,dataModel:i}=this;if(!(e&&i))return[];if(t!==this.getBarDirection()){const{index:s,def:a}=i.resolveProcessedDataDefById(this,"xValue"),r=e.domain.keys[s];return a.type==="key"&&a.valueType==="category"?r:this.padBandExtent(r)}const o=this.domainForClippedRange(t,["minValue","maxValue"],"xValue");return fixNumericExtent2(o)}getSeriesRange(t,e){return this.domainForVisibleRange(ChartAxisDirection13.Y,["maxValue","minValue"],"xValue",e)}createNodeData(){const{visible:t,dataModel:e,processedData:i}=this,o=this.getCategoryAxis(),s=this.getValueAxis();if(!(e&&i&&o&&s))return;const{xKey:a}=this.properties,r=[],n=e.resolveKeysById(this,"xValue",i),l=e.resolveColumnById(this,"minValue",i),c=e.resolveColumnById(this,"q1Value",i),h=e.resolveColumnById(this,"medianValue",i),d=e.resolveColumnById(this,"q3Value",i),u=e.resolveColumnById(this,"maxValue",i),{barWidth:p,groupIndex:g}=this.updateGroupScale(o),y=ContinuousScale4.is(o.scale)?p*-.5:0,{groupScale:f}=this,x=this.isVertical(),b=calculateSegments(this.properties.segmentation,o,s,this.chart.seriesRect,this.ctx.scene),m={itemId:a,nodeData:r,labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:getItemStyles(this.getItemStyle.bind(this)),segments:b};if(!t)return m;const S=i.dataSources.get(this.id)?.data??[];for(const[v,M]of S.entries()){const D=n[v];if(D==null)continue;const k=l[v],_=c[v],T=h[v],w=d[v],R=u[v];if([k,_,T,w,R].some(P=>typeof P!="number")||k>_||_>T||T>w||w>R)continue;const F={xValue:o.scale.convert(D),minValue:s.scale.convert(k),q1Value:s.scale.convert(_),medianValue:s.scale.convert(T),q3Value:s.scale.convert(w),maxValue:s.scale.convert(R)},O=p;F.xValue+=f.convert(String(g))+y+O/2;const E=Math.abs(F.q3Value-F.q1Value),I=F.xValue,C=Math.min(F.q3Value,F.q1Value)+E/2,L={x:x?I:C,y:x?C:I};let A;x?A={x:L.x-O/2,y:F.minValue,width:O,height:F.maxValue-F.minValue}:A={x:F.minValue,y:L.y-O/2,width:F.maxValue-F.minValue,height:O},r.push({series:this,itemId:D,datum:M,datumIndex:v,xKey:a,bandwidth:O,scaledValues:F,midPoint:L,focusRect:A})}return m}legendItemSymbol(){const{fill:t,stroke:e,strokeWidth:i,fillOpacity:o,strokeOpacity:s,lineDash:a,lineDashOffset:r}=this.getStyle(!1,!1,HighlightState.None);return{marker:{fill:import_ag_charts_community113._ModuleSupport.deepClone(t),fillOpacity:o,stroke:e,strokeOpacity:s,strokeWidth:i,lineDash:a,lineDashOffset:r}}}getLegendData(t){const{id:e,ctx:{legendManager:i},visible:o}=this,{xKey:s,yName:a,showInLegend:r,legendItemName:n}=this.properties;return!s||t!=="category"?[]:[{legendType:"category",id:e,itemId:e,seriesId:e,enabled:o&&i.getItemEnabled({seriesId:e,itemId:e}),label:{text:n??a??e},symbol:this.legendItemSymbol(),legendItemName:n,hideInLegend:!r}]}getTooltipContent(t){const{id:e,dataModel:i,processedData:o,properties:s}=this,{xKey:a,xName:r,yName:n,medianKey:l,medianName:c,q1Key:h,q1Name:d,q3Key:u,q3Name:p,minKey:g,minName:y,maxKey:f,maxName:x,legendItemName:b,tooltip:m}=s,S=this.getCategoryAxis(),v=this.getValueAxis();if(!i||!o||!S||!v)return;const M=o.dataSources.get(this.id)?.data[t],D=i.resolveKeysById(this,"xValue",o)[t],k=i.resolveColumnById(this,"minValue",o)[t],_=i.resolveColumnById(this,"q1Value",o)[t],T=i.resolveColumnById(this,"medianValue",o)[t],w=i.resolveColumnById(this,"q3Value",o)[t],R=i.resolveColumnById(this,"maxValue",o)[t];if(D==null)return;const F=this.getItemStyle(t,!1),O=[{label:y,fallbackLabel:g,value:this.getAxisValueText(v,"tooltip",k,M,g,b)},{label:d,fallbackLabel:h,value:this.getAxisValueText(v,"tooltip",_,M,h,b)},{label:c,fallbackLabel:l,value:this.getAxisValueText(v,"tooltip",T,M,l,b)},{label:p,fallbackLabel:u,value:this.getAxisValueText(v,"tooltip",w,M,u,b)},{label:x,fallbackLabel:f,value:this.getAxisValueText(v,"tooltip",R,M,f,b)}];return this.formatTooltipWithContext(m,{heading:this.getAxisValueText(S,"tooltip",D,M,a,b),title:b??n,symbol:this.legendItemSymbol(),data:O},{seriesId:e,datum:M,title:n,xKey:a,xName:r,yName:n,medianKey:l,medianName:c,q1Key:h,q1Name:d,q3Key:u,q3Name:p,minKey:g,minName:y,maxKey:f,maxName:x,...F})}animateEmptyUpdateReady({datumSelection:t}){const e=this.isVertical(),{from:i,to:o}=prepareBoxPlotFromTo(e);motion.resetMotion([t],resetBoxPlotSelectionsScalingCenterFn(e)),motion.staticFromToMotion(this.id,"datums",this.ctx.animationManager,[t],i,o,{phase:"initial"})}isLabelEnabled(){return!1}updateDatumSelection(t){const e=t.nodeData??[];return t.datumSelection.update(e)}makeStylerParams(t,e){const{id:i}=this,{cornerRadius:o,cap:{lengthRatio:s},fill:a,fillOpacity:r,lineDash:n,lineDashOffset:l,stroke:c,strokeOpacity:h,strokeWidth:d,maxKey:u,maxName:p,medianKey:g,medianName:y,minKey:f,minName:x,q1Key:b,q1Name:m,q3Key:S,q3Name:v,whisker:{lineDash:M,lineDashOffset:D,stroke:k,strokeOpacity:_,strokeWidth:T},xKey:w,xName:R,yName:F}=this.properties,O=toHighlightString(e??HighlightState.None);return{cap:{lengthRatio:s},cornerRadius:o,fill:a,fillOpacity:r,highlightState:O,highlighted:t,lineDash:n,lineDashOffset:l,maxKey:u,maxName:p??u,medianKey:g,medianName:y??g,minKey:f,minName:x??f,q1Key:b,q1Name:m??b,q3Key:S,q3Name:v??S,seriesId:i,stroke:c,strokeOpacity:h,strokeWidth:d,whisker:{lineDash:M??n,lineDashOffset:D??l,stroke:k??c,strokeOpacity:_??h,strokeWidth:T??d},xKey:w,xName:R??w,yName:F}}getStyle(t,e,i){const{cap:o,cornerRadius:s,fill:a,fillOpacity:r,lineDash:n,lineDashOffset:l,stroke:c,strokeOpacity:h,strokeWidth:d,styler:u,whisker:p}=this.properties;let g={};if(!t&&u){const y=this.makeStylerParams(e,i);g=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(u,y)??{},{pick:!1})??{}}return{cornerRadius:g.cornerRadius??s,fill:g.fill??a,fillOpacity:g.fillOpacity??r,lineDash:g.lineDash??n,lineDashOffset:g.lineDashOffset??l,opacity:1,stroke:g.stroke??c,strokeOpacity:g.strokeOpacity??h,strokeWidth:g.strokeWidth??d,cap:{lengthRatio:g.cap?.lengthRatio??o.lengthRatio},whisker:{lineDash:g.whisker?.lineDash??p.lineDash,lineDashOffset:g.whisker?.lineDashOffset??p.lineDashOffset,stroke:g.whisker?.stroke??p.stroke,strokeOpacity:g.whisker?.strokeOpacity??p.strokeOpacity,strokeWidth:g.whisker?.strokeWidth??p.strokeWidth}}}getItemStyle(t,e,i){const{properties:o}=this,{itemStyler:s}=o,a=this.getHighlightStyle(e,t,i);let r=mergeDefaults4(a,this.getStyle(t===void 0,e,i));if(s!=null&&t!=null){const u=this.cachedDatumCallback(createDatumId(t,e?"highlight":"node"),()=>{const p=this.makeItemStylerParams(t,e,r);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(s,p))});u&&(r=mergeDefaults4(u,r))}const{stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}=r;return r.whisker=mergeDefaults4(r.whisker,{stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}),r}makeItemStylerParams(t,e,i){const{id:o}=this,{xKey:s,minKey:a,q1Key:r,medianKey:n,q3Key:l,maxKey:c}=this.properties,h=this.processedData?.dataSources.get(o)?.data[t],d=this.ctx.highlightManager?.getActiveHighlight(),u=this.getHighlightStateString(d,e,t),p=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:o,datum:h,xKey:s,minKey:a,q1Key:r,medianKey:n,q3Key:l,maxKey:c,highlighted:e,highlightState:u,...i,fill:p}}updateDatumStyles({datumSelection:t,isHighlight:e}){const i=this.ctx.highlightManager.getActiveHighlight();t.each((o,s)=>{const a=this.getHighlightState(i,e,s.datumIndex);s.style=this.getItemStyle(s.datumIndex,e,a)})}updateDatumNodes({datumSelection:t,isHighlight:e}){const{contextNodeData:i,properties:o}=this;if(!i)return;const s=this.isVertical(),a=this.ctx.highlightManager.getActiveHighlight(),r=this.getShapeFillBBox(),n=this.getStyle(!1,!1,HighlightState.None).strokeWidth/2,l=o.whisker.strokeWidth??o.strokeWidth;t.each((c,h)=>{const d=h.style??i.styles[this.getHighlightState(a,e,h.datumIndex)];applyShapeFillBBox(c,d.fill,r),c.fill=d.fill,c.fillOpacity=d.fillOpacity,c.stroke=d.stroke,c.strokeWidth=d.strokeWidth,c.strokeOpacity=d.strokeOpacity,c.lineDash=d.lineDash,c.lineDashOffset=d.lineDashOffset,c.wickStroke=d.whisker.stroke,c.wickStrokeWidth=d.whisker.strokeWidth,c.wickStrokeOpacity=d.whisker.strokeOpacity,c.wickLineDash=d.whisker.lineDash,c.wickLineDashOffset=d.whisker.lineDashOffset,c.cornerRadius=d.cornerRadius,c.crisp=!0,c.horizontal=!s,c.center=h.scaledValues.xValue,c.thickness=h.bandwidth,c.min=h.scaledValues.minValue,c.q1=h.scaledValues.q1Value,c.median=h.scaledValues.medianValue,c.q3=h.scaledValues.q3Value,c.max=h.scaledValues.maxValue,c.capLengthRatio=d.cap.lengthRatio,c.strokeAlignment=n,c.wickStrokeAlignment=l})}updateLabelNodes(){}updateLabelSelection(t){const{labelData:e,labelSelection:i}=t;return i.update(e)}nodeFactory(){return new BoxPlotNode}computeFocusBounds({datumIndex:t}){return computeBarFocusBounds(this,this.contextNodeData?.nodeData[t].focusRect)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null}};BoxPlotSeries.className="BoxPlotSeries",BoxPlotSeries.type="box-plot";var import_ag_charts_community114=require("ag-charts-community"),import_ag_charts_core55=require("ag-charts-core"),{boxPlotSeriesThemeableOptionsDef,commonSeriesOptionsDefs}=import_ag_charts_community114._ModuleSupport,boxPlotSeriesOptionsDef={...commonSeriesOptionsDefs,...boxPlotSeriesThemeableOptionsDef,type:(0,import_ag_charts_core55.required)((0,import_ag_charts_core55.constant)("box-plot")),xKey:(0,import_ag_charts_core55.required)(import_ag_charts_core55.string),minKey:(0,import_ag_charts_core55.required)(import_ag_charts_core55.string),q1Key:(0,import_ag_charts_core55.required)(import_ag_charts_core55.string),medianKey:(0,import_ag_charts_core55.required)(import_ag_charts_core55.string),q3Key:(0,import_ag_charts_core55.required)(import_ag_charts_core55.string),maxKey:(0,import_ag_charts_core55.required)(import_ag_charts_core55.string),xName:import_ag_charts_core55.string,yName:import_ag_charts_core55.string,minName:import_ag_charts_core55.string,q1Name:import_ag_charts_core55.string,medianName:import_ag_charts_core55.string,q3Name:import_ag_charts_core55.string,maxName:import_ag_charts_core55.string,grouped:import_ag_charts_core55.boolean,legendItemName:import_ag_charts_core55.string,segmentation:import_ag_charts_core55.shapeSegmentation},import_ag_charts_community115=require("ag-charts-community"),{ThemeConstants:{CARTESIAN_AXIS_TYPE},multiSeriesHighlightStyle,FILL_GRADIENT_LINEAR_DEFAULTS,FILL_IMAGE_DEFAULTS,FILL_PATTERN_DEFAULTS,SAFE_FILL_OPERATION,SEGMENTATION_DEFAULTS}=import_ag_charts_community115._ModuleSupport,BOX_PLOT_SERIES_THEME={series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$if:[{$or:[{$isGradient:{$palette:"fill"}},{$isPattern:{$palette:"fill"}},{$isImage:{$palette:"fill"}}]},{$palette:"fill"},{$mix:[SAFE_FILL_OPERATION,{$ref:"chartBackgroundColor"},.7]}]},["gradient",FILL_GRADIENT_LINEAR_DEFAULTS],["image",FILL_IMAGE_DEFAULTS],["pattern",FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},strokeWidth:2,fillOpacity:1,strokeOpacity:1,lineDash:void 0,lineDashOffset:0,highlight:multiSeriesHighlightStyle(),segmentation:SEGMENTATION_DEFAULTS},axes:{[CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{snap:!1}},[CARTESIAN_AXIS_TYPE.CATEGORY]:{groupPaddingInner:.2,crosshair:{enabled:!1,snap:!1}}}},BoxPlotModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"box-plot",moduleFactory:t=>new BoxPlotSeries(t),predictAxis:import_ag_charts_community116._ModuleSupport.predictCartesianTimeAxis,defaultAxes:import_ag_charts_community116._ModuleSupport.DIRECTION_SWAP_AXES,themeTemplate:BOX_PLOT_SERIES_THEME,groupable:!0},BoxPlotSeriesModule={type:"series",name:"box-plot",chartType:"cartesian",enterprise:!0,options:boxPlotSeriesOptionsDef,create:t=>new BoxPlotSeries(t)},import_ag_charts_community126=require("ag-charts-community"),import_ag_charts_community123=require("ag-charts-community"),import_ag_charts_community118=require("ag-charts-community"),import_ag_charts_core56=require("ag-charts-core"),import_ag_charts_community117=require("ag-charts-community"),{AGGREGATION_SPAN,AGGREGATION_INDEX_X_MAX,AGGREGATION_INDEX_X_MIN,AGGREGATION_INDEX_Y_MAX,AGGREGATION_INDEX_Y_MIN,aggregationDomain,aggregationRangeFittingPoints,compactAggregationIndices,createAggregationIndices}=import_ag_charts_community117._ModuleSupport,AGGREGATION_THRESHOLD=1e3,OPEN=AGGREGATION_INDEX_X_MIN,HIGH=AGGREGATION_INDEX_Y_MAX,LOW=AGGREGATION_INDEX_Y_MIN,CLOSE=AGGREGATION_INDEX_X_MAX;function aggregateOhlcData(t,e,i,o,s,a){if(e.length64;)({indexData:c,valueData:h,maxRange:l}=compactAggregationIndices(c,h,l)),d.push({maxRange:l,indexData:c});return d.reverse(),d}var{fixNumericExtent:fixNumericExtent3,keyProperty:keyProperty3,createDatumId:createDatumId2,SeriesNodePickMode:SeriesNodePickMode2,ChartAxisDirection:ChartAxisDirection14,SMALLEST_KEY_INTERVAL:SMALLEST_KEY_INTERVAL2,valueProperty:valueProperty4,diff:diff2,animationValidation:animationValidation2,computeBarFocusBounds:computeBarFocusBounds2,visibleRangeIndices,BandScale,processedDataIsAnimatable,mergeDefaults:mergeDefaults5,simpleMemorize2,getItemStylesPerItemId}=import_ag_charts_community118._ModuleSupport,memoizedAggregateOhlcData=simpleMemorize2(aggregateOhlcData),OhlcSeriesNodeEvent=class extends import_ag_charts_community118._ModuleSupport.SeriesNodeEvent{constructor(t,e,i,o){super(t,e,i,o),this.xKey=o.properties.xKey,this.openKey=o.properties.openKey,this.closeKey=o.properties.closeKey,this.highKey=o.properties.highKey,this.lowKey=o.properties.lowKey}},OhlcSeriesBase=class extends import_ag_charts_community118._ModuleSupport.AbstractBarSeries{constructor(t){super({moduleCtx:t,pickModes:[SeriesNodePickMode2.AXIS_ALIGNED,SeriesNodePickMode2.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["lowKey","highKey","openKey","closeKey"]},propertyNames:{x:["xName"],y:["lowName","highName","openName","closeName"]},categoryKey:"xValue",pathsPerSeries:[]}),this.NodeEvent=OhlcSeriesNodeEvent,this.dataAggregationFilters=void 0}async processData(t){if(!this.visible)return;const{xKey:e,openKey:i,closeKey:o,highKey:s,lowKey:a}=this.properties,r=!this.ctx.animationManager.isSkipped(),n=this.getCategoryAxis()?.scale,l=this.getValueAxis()?.scale,{isContinuousX:c,xScaleType:h,yScaleType:d}=this.getScaleInformation({xScale:n,yScale:l}),u=[];r&&(this.processedData&&u.push(diff2(this.id,this.processedData)),u.push(animationValidation2())),i&&u.push(valueProperty4(i,d,{id:"openValue",invalidValue:void 0,missingValue:void 0}));const{dataModel:p,processedData:g}=await this.requestDataModel(t,this.data,{props:[keyProperty3(e,h,{id:"xValue"}),valueProperty4(o,d,{id:"closeValue"}),valueProperty4(s,d,{id:"highValue"}),valueProperty4(a,d,{id:"lowValue"}),...c?[SMALLEST_KEY_INTERVAL2]:[],...u]});this.smallestDataInterval=g.reduced?.smallestKeyInterval,this.dataAggregationFilters=this.aggregateData(p,g),this.animationState.transition("updateData")}aggregateData(t,e){if(e.type!=="ungrouped"||processedDataIsAnimatable(e))return;const i=this.axes[ChartAxisDirection14.X];if(i==null)return;const o=t.resolveKeysById(this,"xValue",e),s=t.resolveColumnById(this,"highValue",e),a=t.resolveColumnById(this,"lowValue",e),{index:r}=t.resolveProcessedDataDefById(this,"xValue"),n=e.domain.keys[r];return memoizedAggregateOhlcData(i.scale.type,o,s,a,n,e.reduced?.smallestKeyInterval)}getSeriesDomain(t){const{processedData:e,dataModel:i}=this;if(!(e&&i))return[];if(t!==this.getBarDirection()){const{index:s,def:a}=i.resolveProcessedDataDefById(this,"xValue"),r=e.domain.keys[s];return a.type==="key"&&a.valueType==="category"?r:this.padBandExtent(r)}const o=this.domainForClippedRange(t,["highValue","lowValue"],"xValue");return fixNumericExtent3(o)}getSeriesRange(t,e){return this.domainForVisibleRange(ChartAxisDirection14.Y,["highValue","lowValue"],"xValue",e)}getZoomRangeFittingItems(t,e,i){return this.zoomFittingVisibleItems("xValue",["highValue","lowValue"],t,e,i)}getVisibleItems(t,e,i){return this.countVisibleItems("xValue",["highValue","lowValue"],t,e,i)}createNodeData(){const{visible:t,dataModel:e,processedData:i}=this,o=this.getCategoryAxis(),s=this.getValueAxis();if(!(e&&i&&o&&s))return;const a=[],{xKey:r,highKey:n,lowKey:l}=this.properties,c=i.dataSources.get(this.id)?.data??[],h=e.resolveKeysById(this,"xValue",i),d=e.resolveColumnById(this,"openValue",i),u=e.resolveColumnById(this,"closeValue",i),p=e.resolveColumnById(this,"highValue",i),g=e.resolveColumnById(this,"lowValue",i),{groupScale:y}=this,{barWidth:f,groupIndex:x}=this.updateGroupScale(o),b=y.convert(String(x)),m=f>=1?f:y.rawBandwidth,S=BandScale.is(o.scale),v={itemId:r,nodeData:a,labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:getItemStylesPerItemId(this.getItemStyle.bind(this),"up","down")};if(!t)return v;const M=(O,E,I,C,L,A,P,z)=>{const B=c[O],V=S?P/2:0,W=o.scale.convert(E)+b+V,H=s.scale.convert(I),G=s.scale.convert(C),K=s.scale.convert(L),U=s.scale.convert(A),Y=C>I,$=Y?"up":"down",X=Math.min(K,U),Z=Math.max(K,U)-X,q={x:W,y:X+Z/2};a.push({series:this,itemId:$,datum:B,datumIndex:O,xKey:r,xValue:E,openValue:I,closeValue:C,highValue:L,lowValue:A,midPoint:q,aggregatedValue:C,isRising:Y,centerX:W,width:P,y:X,height:Z,yOpen:H,yClose:G,crisp:z})},{dataAggregationFilters:D}=this,k=o.scale,[_,T]=k.range,w=Math.abs(T-_),R=O=>k.convert(h[O])+b,F=D?.find(O=>O.maxRange>w);if(F==null){const O=i.invalidData?.get(this.id);let[E,I]=visibleRangeIndices(1,c.length,o.range,C=>{const L=S?0:-m/2,A=R(C)+L;return[A,A+m]});i.input.count<1e3&&(E=0,I=i.input.count);for(let C=E;C=A&&z>=P;if(!V){import_ag_charts_core56.Logger.warnOnce(`invalid low value for key [${l}] in data element, low value cannot be higher than datum open or close values`);continue}if(!W){import_ag_charts_core56.Logger.warnOnce(`invalid high value for key [${n}] in data element, high value cannot be lower than datum open or close values.`);continue}M(C,L,A,P,z,B,m,!0)}}else{const{maxRange:O,indexData:E}=F,[I,C]=visibleRangeIndices(1,O,o.range,L=>{const A=L*AGGREGATION_SPAN,P=E[A+OPEN],z=E[A+CLOSE];if(P===-1)return;const B=S?0:-m/2;return[R(P)+B,R(z)+B+m]});for(let L=I;L{const p=this.makeItemStylerParams(o,t,e,h);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`,"item",o],this.callWithContext(n,p))});u&&(h=mergeDefaults5(u,h))}return h}makeItemStylerParams(t,e,i,o){const{id:s,properties:a,processedData:r}=this,{xKey:n,openKey:l,closeKey:c,highKey:h,lowKey:d}=a,u=r.dataSources.get(s)?.data[e],p=this.ctx.highlightManager?.getActiveHighlight(),g=this.getHighlightStateString(p,i,e),y={seriesId:s,datum:u,itemId:t,xKey:n,openKey:l,closeKey:c,highKey:h,lowKey:d,highlighted:i,highlightState:g,...o};return"fill"in y&&"fill"in o&&(y.fill=this.filterItemStylerFillParams(o.fill)??o.fill),y}getTooltipContent(t){const{id:e,dataModel:i,processedData:o,properties:s}=this,{xKey:a,xName:r,yName:n,openKey:l,openName:c,highKey:h,highName:d,lowKey:u,lowName:p,closeKey:g,closeName:y,legendItemName:f,tooltip:x}=s,b=this.getCategoryAxis(),m=this.getValueAxis();if(!i||!o||!b||!m)return;const S=o.dataSources.get(this.id)?.data[t],v=i.resolveKeysById(this,"xValue",o)[t],M=i.resolveColumnById(this,"openValue",o)[t],D=i.resolveColumnById(this,"highValue",o)[t],k=i.resolveColumnById(this,"lowValue",o)[t],_=i.resolveColumnById(this,"closeValue",o)[t];if(v==null)return;const T=_>=M?"up":"down",w=this.properties.item[T],R=this.getItemStyle(t,!1),F={fill:w.fill??w.stroke,fillOpacity:w.fillOpacity??w.strokeOpacity??1,stroke:w.stroke,strokeWidth:w.strokeWidth??1,strokeOpacity:w.strokeOpacity??1,lineDash:w.lineDash??[0],lineDashOffset:w.lineDashOffset??0};return this.formatTooltipWithContext(x,{heading:this.getAxisValueText(b,"tooltip",v,S,a,f),title:f,symbol:{marker:F},data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(m,"tooltip",M,S,l,f)},{label:d,fallbackLabel:h,value:this.getAxisValueText(m,"tooltip",D,S,h,f)},{label:p,fallbackLabel:u,value:this.getAxisValueText(m,"tooltip",k,S,u,f)},{label:y,fallbackLabel:g,value:this.getAxisValueText(m,"tooltip",_,S,g,f)}]},{seriesId:e,datum:S,title:n,itemId:T,xKey:a,xName:r,yName:n,openKey:l,openName:c,highKey:h,highName:d,lowKey:u,lowName:p,closeKey:g,closeName:y,...R})}computeFocusBounds(t){const e=this.getNodeData()?.at(t.datumIndex);if(e==null)return;const{centerX:i,y:o,width:s,height:a}=e,r={x:i-s/2,y:o,width:s,height:a};return computeBarFocusBounds2(this,r)}},import_ag_charts_community120=require("ag-charts-community"),import_ag_charts_community119=require("ag-charts-community"),{Path:Path8,SceneChangeDetection:SceneChangeDetection5,BBox:BBox11}=import_ag_charts_community119._ModuleSupport,OhlcBaseNode=class extends Path8{constructor(){super(...arguments),this.centerX=0,this.y=0,this.width=0,this.height=0,this.yOpen=0,this.yClose=0,this.crisp=!1}computeBBox(){const{centerX:t,y:e,width:i,height:o}=this;return new BBox11(t-i/2,e,i,o)}isPointInPath(t,e){return this.getBBox().containsPoint(t,e)}distanceSquared(t,e){return this.getBBox().distanceSquared(t,e)}get midPoint(){return{x:this.centerX,y:this.y+this.height/2}}alignedCoordinates(){const{y:t,width:e,height:i,crisp:o}=this;let{centerX:s,yOpen:a,yClose:r}=this,n=s-e/2,l=s+e/2,c=t,h=t+i;if(o&&e>1){if(s=this.align(s),a<=r){const u=this.align(a,r-a);a=this.align(a),r=a+u}else{const u=this.align(r,a-r);r=this.align(r),a=r+u}const d=this.align(e/2);n=s-d,l=s+d,c=this.align(t),h=c+this.align(c,i)}return{centerX:s,x0:n,x1:l,y0:c,y1:h,yOpen:a,yClose:r}}executeStroke(t,e){const{width:i,strokeWidth:o}=this;i0?l/this.strokeAlignment/2%1:0;t.clear(),t.moveTo(e-c,s),t.lineTo(e-c,a),Math.abs(o-i)>1&&(t.moveTo(i,r-c),t.lineTo(e-c,r-c),t.moveTo(e-c,n-c),t.lineTo(o,n-c))}};__decorateClass([SceneChangeDetection5()],OhlcNode.prototype,"strokeAlignment",2);var{SceneArrayChangeDetection:SceneArrayChangeDetection2,SceneChangeDetection:SceneChangeDetection6,ExtendedPath2D:ExtendedPath2D4,BBox:BBox12}=import_ag_charts_community120._ModuleSupport,CandlestickNode=class extends OhlcBaseNode{constructor(){super(...arguments),this.wickPath=new ExtendedPath2D4,this.wickStroke=void 0,this.wickStrokeWidth=void 0,this.wickStrokeOpacity=void 0,this.wickStrokeAlignment=0}computeDefaultGradientFillBBox(){const{width:t,centerX:e,yOpen:i,yClose:o}=this,s=Math.min(i,o),r=Math.max(i,o)-s,n=e-t/2,l=e+t/2;return new BBox12(n,s,l-n,r)}updatePath(){const{path:t,stroke:e,strokeWidth:i,strokeOpacity:o,lineDash:s,lineDashOffset:a,wickStroke:r,wickStrokeWidth:n,wickStrokeOpacity:l,wickLineDash:c,wickLineDashOffset:h}=this,{centerX:d,x0:u,x1:p,y0:g,y1:y,yOpen:f,yClose:x}=this.alignedCoordinates(),b=this.layerManager?.canvas.pixelRatio??1,m=this.wickStrokeAlignment>0?b/this.wickStrokeAlignment/2%1:0;this.path.clear(),this.wickPath.clear();const v=r!=null&&r!==e||n!=null&&n!==i||l!=null&&l!==o||c!=null&&c!==s||h!=null&&h!==a?this.wickPath:t;if(Math.abs(p-u)<=3){v.moveTo(d-m,g),v.lineTo(d-m,y);return}const M=Math.min(f,x),D=Math.max(f,x),k=i/2;v.moveTo(d-m,g),v.lineTo(d-m,M+k),v.moveTo(d-m,y),v.lineTo(d-m,D-k);const _=D-M-2*k;if(_>0)t.rect(u+k,M+k,p-u-2*k,_);else{const T=(M+D)/2;t.moveTo(u,T),t.lineTo(p,T)}}drawPath(t){super.drawPath(t);const{wickPath:e}=this;if(e.isEmpty())return;const{stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r,wickStroke:n=i,wickStrokeWidth:l=o,wickStrokeOpacity:c=s,wickLineDash:h=a,wickLineDashOffset:d=r}=this;l!==0&&(t.globalAlpha*=c,typeof n=="string"&&(t.strokeStyle=n),t.lineWidth=l,h!=null&&t.setLineDash([...h]),t.lineDashOffset=d,t.stroke(e.getPath2D()))}};__decorateClass([SceneChangeDetection6()],CandlestickNode.prototype,"wickStroke",2),__decorateClass([SceneChangeDetection6()],CandlestickNode.prototype,"wickStrokeWidth",2),__decorateClass([SceneChangeDetection6()],CandlestickNode.prototype,"wickStrokeOpacity",2),__decorateClass([SceneArrayChangeDetection2()],CandlestickNode.prototype,"wickLineDash",2),__decorateClass([SceneChangeDetection6()],CandlestickNode.prototype,"wickLineDashOffset",2),__decorateClass([SceneChangeDetection6()],CandlestickNode.prototype,"wickStrokeAlignment",2);var import_ag_charts_community122=require("ag-charts-community"),import_ag_charts_community121=require("ag-charts-community"),{BaseProperties:BaseProperties16,Property:Property49,AbstractBarSeriesProperties:AbstractBarSeriesProperties2,makeSeriesTooltip:makeSeriesTooltip2}=import_ag_charts_community121._ModuleSupport,OhlcSeriesItem=class extends BaseProperties16{constructor(){super(...arguments),this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};__decorateClass([Property49],OhlcSeriesItem.prototype,"stroke",2),__decorateClass([Property49],OhlcSeriesItem.prototype,"strokeWidth",2),__decorateClass([Property49],OhlcSeriesItem.prototype,"strokeOpacity",2),__decorateClass([Property49],OhlcSeriesItem.prototype,"lineDash",2),__decorateClass([Property49],OhlcSeriesItem.prototype,"lineDashOffset",2);var OhlcSeriesItems=class extends BaseProperties16{constructor(){super(...arguments),this.up=new OhlcSeriesItem,this.down=new OhlcSeriesItem}};__decorateClass([Property49],OhlcSeriesItems.prototype,"up",2),__decorateClass([Property49],OhlcSeriesItems.prototype,"down",2);var OhlcSeriesBaseProperties=class extends AbstractBarSeriesProperties2{};__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"xKey",2),__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"openKey",2),__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"closeKey",2),__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"highKey",2),__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"lowKey",2),__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"xName",2),__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"yName",2),__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"openName",2),__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"closeName",2),__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"highName",2),__decorateClass([Property49],OhlcSeriesBaseProperties.prototype,"lowName",2);var OhlcSeriesProperties=class extends OhlcSeriesBaseProperties{constructor(){super(...arguments),this.tooltip=makeSeriesTooltip2(),this.item=new OhlcSeriesItems}getStyle(t){const{strokeWidth:e,strokeOpacity:i,stroke:o,lineDash:s,lineDashOffset:a}=this.item[t];return{stroke:o,strokeWidth:e,strokeOpacity:i,lineDash:s,lineDashOffset:a,opacity:1}}};__decorateClass([Property49],OhlcSeriesProperties.prototype,"tooltip",2),__decorateClass([Property49],OhlcSeriesProperties.prototype,"item",2),__decorateClass([Property49],OhlcSeriesProperties.prototype,"itemStyler",2);var{BaseProperties:BaseProperties17,makeSeriesTooltip:makeSeriesTooltip3,Property:Property50}=import_ag_charts_community122._ModuleSupport,CandlestickSeriesWick=class extends BaseProperties17{};__decorateClass([Property50],CandlestickSeriesWick.prototype,"stroke",2),__decorateClass([Property50],CandlestickSeriesWick.prototype,"strokeWidth",2),__decorateClass([Property50],CandlestickSeriesWick.prototype,"strokeOpacity",2),__decorateClass([Property50],CandlestickSeriesWick.prototype,"lineDash",2),__decorateClass([Property50],CandlestickSeriesWick.prototype,"lineDashOffset",2);var CandlestickSeriesItem=class extends BaseProperties17{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.wick=new CandlestickSeriesWick}};__decorateClass([Property50],CandlestickSeriesItem.prototype,"fill",2),__decorateClass([Property50],CandlestickSeriesItem.prototype,"fillOpacity",2),__decorateClass([Property50],CandlestickSeriesItem.prototype,"stroke",2),__decorateClass([Property50],CandlestickSeriesItem.prototype,"strokeWidth",2),__decorateClass([Property50],CandlestickSeriesItem.prototype,"strokeOpacity",2),__decorateClass([Property50],CandlestickSeriesItem.prototype,"lineDash",2),__decorateClass([Property50],CandlestickSeriesItem.prototype,"lineDashOffset",2),__decorateClass([Property50],CandlestickSeriesItem.prototype,"cornerRadius",2),__decorateClass([Property50],CandlestickSeriesItem.prototype,"wick",2);var CandlestickSeriesItems=class extends BaseProperties17{constructor(){super(...arguments),this.up=new CandlestickSeriesItem,this.down=new CandlestickSeriesItem}};__decorateClass([Property50],CandlestickSeriesItems.prototype,"up",2),__decorateClass([Property50],CandlestickSeriesItems.prototype,"down",2);var CandlestickSeriesProperties=class extends OhlcSeriesBaseProperties{constructor(){super(),this.item=new CandlestickSeriesItems,this.tooltip=makeSeriesTooltip3(),this.highlightStyle.deprecated=!1}getStyle(t){const{fill:e,fillOpacity:i,strokeWidth:o,strokeOpacity:s,stroke:a,lineDash:r,lineDashOffset:n,cornerRadius:l,wick:c}=this.item[t];return{fill:e,fillOpacity:i,stroke:a,strokeWidth:o,strokeOpacity:s,lineDash:r,lineDashOffset:n,cornerRadius:l,opacity:1,wick:c}}};__decorateClass([Property50],CandlestickSeriesProperties.prototype,"item",2),__decorateClass([Property50],CandlestickSeriesProperties.prototype,"tooltip",2),__decorateClass([Property50],CandlestickSeriesProperties.prototype,"itemStyler",2);var{isGradientFill,isPatternFill,isImageFill,applyShapeStyle}=import_ag_charts_community123._ModuleSupport,CandlestickSeries=class extends OhlcSeriesBase{constructor(){super(...arguments),this.properties=new CandlestickSeriesProperties}nodeFactory(){const t=new CandlestickNode;return t.lineCap="butt",t}updateDatumStyles({datumSelection:t,isHighlight:e}){t.each((i,o)=>{o.style=this.getItemStyle(o.datumIndex,e,void 0,o.itemId)})}updateDatumNodes({datumSelection:t,isHighlight:e}){const{contextNodeData:i,properties:o}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight(),{up:a,down:r}=o.item;t.each((n,l)=>{const{centerX:c,width:h,y:d,height:u,yOpen:p,yClose:g,crisp:y}=l,f=l.isRising?a:r,x=l.style??i.styles[l.itemId][this.getHighlightState(s,e,l.datumIndex)];n.centerX=c,n.width=h,n.y=d,n.height=u,n.yOpen=p,n.yClose=g,n.crisp=y,applyShapeStyle(n,x,this.getShapeFillBBox());const b=x?.wick;n.wickStroke=b?.stroke,n.wickStrokeWidth=b?.strokeWidth,n.wickStrokeOpacity=b?.strokeOpacity,n.wickLineDash=b?.lineDash,n.wickLineDashOffset=b?.lineDashOffset,n.wickStrokeAlignment=f.wick.strokeWidth??f.strokeWidth})}legendItemSymbol(){const{up:t,down:e}=this.properties.item,i=isGradientFill(t.fill)?t.fill.colorStops.map(r=>typeof r=="string"?r:{color:r.color,stop:r.stop==null?void 0:r.stop*.5}):[{color:isPatternFill(t.fill)||isImageFill(t.fill)?t.stroke:t.fill,stop:0},{color:isPatternFill(t.fill)||isImageFill(t.fill)?t.stroke:t.fill,stop:.5}],o=isGradientFill(e.fill)?e.fill.colorStops.map(r=>typeof r=="string"?r:{color:r.color,stop:r.stop==null?void 0:r.stop*.5}):[{color:isPatternFill(e.fill)||isImageFill(e.fill)?e.stroke:e.fill,stop:.5}],s={type:"gradient",gradient:"linear",rotation:90,colorStops:[...i,...o],reverse:!1},a={type:"gradient",gradient:"linear",rotation:90,colorStops:[{color:t.stroke,stop:0},{color:t.stroke,stop:.5},{color:e.stroke,stop:.5}],reverse:!1};return{marker:{fill:s,fillOpacity:t.fillOpacity,stroke:a,strokeWidth:t.strokeWidth??1,strokeOpacity:t.strokeOpacity??1,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset}}}getLegendData(t){const{id:e,data:i,visible:o,ctx:{legendManager:s}}=this,{xKey:a,yName:r,showInLegend:n,legendItemName:l}=this.properties;return!i?.data.length||!a||t!=="category"?[]:[{legendType:"category",id:e,itemId:e,seriesId:e,enabled:o&&s.getItemEnabled({seriesId:e,itemId:e}),label:{text:l??r??e},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!n}]}hasItemStylers(){return this.properties.itemStyler!=null}};CandlestickSeries.className="CandleStickSeries",CandlestickSeries.type="candlestick";var import_ag_charts_community124=require("ag-charts-community"),import_ag_charts_core57=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs2,candlestickSeriesThemeableOptionsDef}=import_ag_charts_community124._ModuleSupport,candlestickSeriesOptionsDef={...commonSeriesOptionsDefs2,...candlestickSeriesThemeableOptionsDef,type:(0,import_ag_charts_core57.required)((0,import_ag_charts_core57.constant)("candlestick")),xKey:(0,import_ag_charts_core57.required)(import_ag_charts_core57.string),openKey:(0,import_ag_charts_core57.required)(import_ag_charts_core57.string),highKey:(0,import_ag_charts_core57.required)(import_ag_charts_core57.string),lowKey:(0,import_ag_charts_core57.required)(import_ag_charts_core57.string),closeKey:(0,import_ag_charts_core57.required)(import_ag_charts_core57.string),xName:import_ag_charts_core57.string,yName:import_ag_charts_core57.string,openName:import_ag_charts_core57.string,highName:import_ag_charts_core57.string,lowName:import_ag_charts_core57.string,closeName:import_ag_charts_core57.string};candlestickSeriesOptionsDef.pickOutsideVisibleMinorAxis=(0,import_ag_charts_core57.undocumented)(import_ag_charts_core57.boolean),candlestickSeriesOptionsDef.focusPriority=(0,import_ag_charts_core57.undocumented)(import_ag_charts_core57.number);var import_ag_charts_community125=require("ag-charts-community"),{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE2},multiSeriesHighlightStyle:multiSeriesHighlightStyle2,FILL_GRADIENT_LINEAR_KEYED_DEFAULTS,FILL_IMAGE_DEFAULTS:FILL_IMAGE_DEFAULTS2,FILL_PATTERN_KEYED_DEFAULTS}=import_ag_charts_community125._ModuleSupport;function itemTheme(t){return{fill:{$applySwitch:[{$path:"type"},{$if:[{$eq:[{$palette:"type"},"user-indexed"]},t==="up"?"transparent":{$palette:"fill"},{$palette:`${t}.fill`}]},["gradient",FILL_GRADIENT_LINEAR_KEYED_DEFAULTS(t)],["image",FILL_IMAGE_DEFAULTS2],["pattern",FILL_PATTERN_KEYED_DEFAULTS(t)]]},stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:`${t}.stroke`}]}}}var CANDLESTICK_SERIES_THEME={series:{item:{up:itemTheme("up"),down:itemTheme("down")},highlightStyle:{item:{strokeWidth:3}},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:multiSeriesHighlightStyle2()},animation:{enabled:!1},axes:{[CARTESIAN_AXIS_TYPE2.NUMBER]:{crosshair:{snap:!1}},[CARTESIAN_AXIS_TYPE2.ORDINAL_TIME]:{groupPaddingInner:0,crosshair:{enabled:!0}}}},{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE3,CARTESIAN_POSITION}=import_ag_charts_community126._ModuleSupport.ThemeConstants,CandlestickModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"candlestick",moduleFactory:t=>new CandlestickSeries(t),defaultAxes:[{type:CARTESIAN_AXIS_TYPE3.NUMBER,position:CARTESIAN_POSITION.LEFT},{type:CARTESIAN_AXIS_TYPE3.ORDINAL_TIME,position:CARTESIAN_POSITION.BOTTOM}],themeTemplate:CANDLESTICK_SERIES_THEME,groupable:!1},CandlestickSeriesModule={type:"series",name:"candlestick",chartType:"cartesian",enterprise:!0,options:candlestickSeriesOptionsDef,create:t=>new CandlestickSeries(t)},import_ag_charts_community132=require("ag-charts-community"),import_ag_charts_community129=require("ag-charts-community"),import_ag_charts_core59=require("ag-charts-core"),import_ag_charts_core58=require("ag-charts-core");function generateLabelSecondaryLabelFontSizeCandidates(t,e){const{fontSize:i,minimumFontSize:o=i}=t,{fontSize:s,minimumFontSize:a=s}=e,r=i-o,n=s-a;let l=t.fontSize,c=e.fontSize;const h=[{labelFontSize:i,secondaryLabelFontSize:s}];for(;l>o||c>a;){const d=r>0?(l-o)/r:-1,u=n>0?(c-a)/n:-1;d>u?l--:c--,h.push({labelFontSize:l,secondaryLabelFontSize:c})}return h.reverse(),h}function formatStackedLabels(t,e,i,o,{padding:s},a){const{spacing:r=0}=e,n=2*s,l=2*s+r,c=(e.minimumFontSize??e.fontSize)+(o.minimumFontSize??o.fontSize);if(c>a(c+l,!1).height-l)return;const h=generateLabelSecondaryLabelFontSizeCandidates(e,o),d={fontFamily:e.fontFamily,fontStyle:e.fontStyle,fontWeight:e.fontWeight},u={fontFamily:o.fontFamily,fontStyle:o.fontStyle,fontWeight:o.fontWeight};let p,g;return(0,import_ag_charts_core58.findMaxValue)(0,h.length-1,y=>{const{labelFontSize:f,secondaryLabelFontSize:x}=h[y],b=y===0,m={...d,fontSize:f},S={...u,fontSize:x},v=(0,import_ag_charts_core58.cachedTextMeasurer)(m).lineHeight(),M=(0,import_ag_charts_core58.cachedTextMeasurer)(S).lineHeight(),D=a(v+M+l,b),k=D.width-n,_=D.height-l;if(v+M>_||((p==null||p.fontSize!==f)&&(p=wrapLabel(e,t,k,_,m,e.wrapping,b?e.overflowStrategy:"hide")),p==null||p.width>k||p.height>_)||((g==null||g.fontSize!==x)&&(g=wrapLabel(o,i,k,_,S,o.wrapping,b?o.overflowStrategy:"hide")),g==null))return;const T=p.height+g.height;if(!(g.width>k||T>_))return{width:Math.max(p.width,g.width),height:T+r,meta:D.meta,label:p,secondaryLabel:g}})}function formatSingleLabel(t,e,{padding:i},o){const s=2*i,a=Math.min(e.minimumFontSize??e.fontSize,e.fontSize),r={fontFamily:e.fontFamily,fontStyle:e.fontStyle,fontWeight:e.fontWeight};return(0,import_ag_charts_core58.findMaxValue)(a,e.fontSize,n=>{const l={...r,fontSize:n},c=(0,import_ag_charts_core58.cachedTextMeasurer)(l),h=n===a,d=e.lineHeight??c.lineHeight(),u=o(d+s,h),p=u.width-s,g=u.height-s;if(d>g||p<0)return;const y=(0,import_ag_charts_core58.wrapLines)(t,{maxWidth:p,maxHeight:g,font:l,textWrap:e.wrapping,overflow:(h?e.overflowStrategy:null)??"hide"});if(!y.length)return;const{width:f,height:x}=c.measureLines(y),b=y.join(` +`);return[{width:f,height:x,text:b,fontSize:n,lineHeight:d},u.meta]})}function hasInvalidFontSize(t){return t?.minimumFontSize!=null&&t?.fontSize!=null&&t?.minimumFontSize>t?.fontSize}function formatLabels(t,e,i,o,s,a){const r=e.enabled?t:void 0,n=o.enabled?i:void 0;(hasInvalidFontSize(e)||hasInvalidFontSize(o))&&import_ag_charts_core58.Logger.warnOnce("minimumFontSize should be set to a value less than or equal to the font size");let l;r!=null&&n!=null&&(l=formatStackedLabels(r,e,n,o,s,a));let c;if(l==null&&r!=null&&(c=formatSingleLabel(r,e,s,a)),c!=null){const[d,u]=c;l={width:d.width,height:d.height,meta:u,label:d,secondaryLabel:void 0}}let h;if(l==null&&r==null&&n!=null&&(h=formatSingleLabel(n,o,s,a)),h!=null){const[d,u]=h;l={width:d.width,height:d.height,meta:u,label:void 0,secondaryLabel:d}}return l}function wrapLabel(t,e,i,o,s,a,r){const n=(0,import_ag_charts_core58.wrapLines)(e,{maxWidth:i,maxHeight:o,font:s,textWrap:a,overflow:r});if(!n.length)return;const l=(0,import_ag_charts_core58.cachedTextMeasurer)(s),c=t.lineHeight??l.lineHeight(),{width:h}=l.measureLines(n);return{width:h,lineHeight:c,text:n.join(` +`),height:n.length*c,fontSize:s.fontSize}}var import_ag_charts_community128=require("ag-charts-community"),import_ag_charts_community127=require("ag-charts-community"),{Property:Property51}=import_ag_charts_community127._ModuleSupport,BaseAutoSizedLabel=class extends import_ag_charts_community127._ModuleSupport.Label{constructor(){super(...arguments),this.wrapping="on-space",this.overflowStrategy="ellipsis"}};__decorateClass([Property51],BaseAutoSizedLabel.prototype,"wrapping",2),__decorateClass([Property51],BaseAutoSizedLabel.prototype,"overflowStrategy",2),__decorateClass([Property51],BaseAutoSizedLabel.prototype,"lineHeight",2),__decorateClass([Property51],BaseAutoSizedLabel.prototype,"minimumFontSize",2);var AutoSizedLabel=class extends BaseAutoSizedLabel{constructor(){super(...arguments),this.spacing=0}};__decorateClass([Property51],AutoSizedLabel.prototype,"spacing",2);var AutoSizedSecondaryLabel=class extends BaseAutoSizedLabel{},{CartesianSeriesProperties,makeSeriesTooltip:makeSeriesTooltip4,Property:Property52}=import_ag_charts_community128._ModuleSupport,HeatmapSeriesProperties=class extends CartesianSeriesProperties{constructor(){super(...arguments),this.colorRange=["black","black"],this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.textAlign="center",this.verticalAlign="middle",this.itemPadding=0,this.label=new AutoSizedLabel,this.tooltip=makeSeriesTooltip4()}};__decorateClass([Property52],HeatmapSeriesProperties.prototype,"title",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"xKey",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"yKey",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"colorKey",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"xName",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"yName",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"colorName",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"colorRange",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"stroke",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"textAlign",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"verticalAlign",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"itemPadding",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"label",2),__decorateClass([Property52],HeatmapSeriesProperties.prototype,"tooltip",2);var{SeriesNodePickMode:SeriesNodePickMode3,computeBarFocusBounds:computeBarFocusBounds3,getMissCount,valueProperty:valueProperty5,ChartAxisDirection:ChartAxisDirection15,DEFAULT_CARTESIAN_DIRECTION_KEYS,DEFAULT_CARTESIAN_DIRECTION_NAMES,createDatumId:createDatumId3,ColorScale,Rect,PointerEvents,applyShapeStyle:applyShapeStyle2,mergeDefaults:mergeDefaults6,formatValue,addHitTestersToQuadtree,findQuadtreeMatch,updateLabelNode}=import_ag_charts_community129._ModuleSupport,HeatmapSeriesNodeEvent=class extends import_ag_charts_community129._ModuleSupport.CartesianSeriesNodeEvent{constructor(t,e,i,o){super(t,e,i,o),this.colorKey=o.properties.colorKey}},textAlignFactors={left:-.5,center:0,right:-.5},verticalAlignFactors={top:-.5,middle:0,bottom:-.5},HeatmapSeries=class extends import_ag_charts_community129._ModuleSupport.CartesianSeries{constructor(t){super({moduleCtx:t,propertyKeys:{...DEFAULT_CARTESIAN_DIRECTION_KEYS,color:["colorKey"]},propertyNames:{...DEFAULT_CARTESIAN_DIRECTION_NAMES,color:["colorName"]},categoryKey:void 0,pickModes:[SeriesNodePickMode3.NEAREST_NODE,SeriesNodePickMode3.EXACT_SHAPE_MATCH],pathsPerSeries:[]}),this.properties=new HeatmapSeriesProperties,this.NodeEvent=HeatmapSeriesNodeEvent,this.colorScale=new ColorScale}async processData(t){const e=this.axes[ChartAxisDirection15.X],i=this.axes[ChartAxisDirection15.Y];if(!e||!i||!this.data?.data.length)return;const{xKey:o,yKey:s,colorRange:a,colorKey:r}=this.properties,n=this.axes[ChartAxisDirection15.X]?.scale,l=this.axes[ChartAxisDirection15.Y]?.scale,{xScaleType:c,yScaleType:h}=this.getScaleInformation({xScale:n,yScale:l}),d=this.colorScale.type,{dataModel:u,processedData:p}=await this.requestDataModel(t,this.data,{props:[valueProperty5(o,c,{id:"xValue"}),valueProperty5(s,h,{id:"yValue"}),...r?[valueProperty5(r,d,{id:"colorValue",invalidValue:void 0})]:[]]});if(this.isColorScaleValid()){const g=u.resolveProcessedDataIndexById(this,"colorValue"),y=p.domain.values[g].filter(x=>x!=null),f=import_ag_charts_community129._ModuleSupport.extent(y);if(this.colorScale.domain=f??[],f?.length&&f[0]===f[1]){const x=Math.floor(a.length/2);this.colorScale.range=[a[x],a[x]]}else this.colorScale.range=a;this.colorScale.update()}}isColorScaleValid(){const{colorKey:t}=this.properties;if(!t)return!1;const{dataModel:e,processedData:i}=this;if(!e||!i)return!1;const o=e.resolveProcessedDataIndexById(this,"colorValue"),s=i.input.count,a=getMissCount(this,i.defs.values[o].missing),r=e.resolveProcessedDataIndexById(this,"colorValue"),n=i.domain.values[r].filter(c=>c!=null).length;return!(s===0||s===a||n===0)}xCoordinateRange(t,e){const i=this.axes[ChartAxisDirection15.X].scale,o=e*(i.bandwidth??0)/2,s=i.convert(t)+o,a=e*(i.bandwidth??10);return[s,s+a]}yCoordinateRange(t,e){const i=this.axes[ChartAxisDirection15.Y].scale,o=e*(i.bandwidth??0)/2,s=i.convert(t[0])+o,a=e*(i.bandwidth??10);return[s,s+a]}getSeriesDomain(t){const{dataModel:e,processedData:i}=this;return!e||!i?[]:t===ChartAxisDirection15.X?e.getDomain(this,"xValue","value",i):e.getDomain(this,"yValue","value",i)}getSeriesRange(t,e){return[Number.NaN,Number.NaN]}createNodeData(){const{data:t,visible:e,axes:i,dataModel:o,processedData:s}=this,a=i[ChartAxisDirection15.X],r=i[ChartAxisDirection15.Y];if(!(t&&o&&s&&e&&a&&r))return;if(a.type!=="category"||r.type!=="category"){import_ag_charts_core59.Logger.warnOnce(`Heatmap series expected axes to have "category" type, but received "${a.type}" and "${r.type}" instead.`);return}const{xKey:n,xName:l,yKey:c,yName:h,colorKey:d,colorName:u,textAlign:p,verticalAlign:g,itemPadding:y,label:f}=this.properties,x=o.resolveColumnById(this,"xValue",s),b=o.resolveColumnById(this,"yValue",s),m=d?o.resolveColumnById(this,"colorValue",s):void 0,S=d?o.getDomain(this,"colorValue","value",s):[],v=a.scale,M=r.scale,D=(v.bandwidth??0)/2,k=(M.bandwidth??0)/2,_=[],T=[],w=v.bandwidth??10,R=M.bandwidth??10,F=(w-2*y)*textAlignFactors[p],O=(R-2*y)*verticalAlignFactors[g],E=()=>({width:w,height:R,meta:null}),I=s.dataSources.get(this.id)?.data??[];for(const[C,L]of I.entries()){const A=x[C],P=b[C],z=v.convert(A)+D,B=M.convert(P)+k,V=m?.[C],W=f.enabled&&V!=null?this.getLabelText(V,L,d,"color",S,f,{value:V,datum:L,colorKey:d,colorName:u,xKey:n,yKey:c,xName:l,yName:h}):void 0,H=formatLabels((0,import_ag_charts_core59.toPlainText)(W),this.properties.label,void 0,this.properties.label,{padding:y},E),G={x:z,y:B,size:0},K=this.getItemStyle({datumIndex:C,datum:L,colorValue:V},!1);if(_.push({series:this,itemId:c,datumIndex:C,yKey:c,xKey:n,xValue:A,yValue:P,colorValue:V,datum:L,point:G,width:w,height:R,midPoint:{x:z,y:B},missing:m!=null&&V==null,style:K}),H?.label!=null){const{text:U,fontSize:Y,lineHeight:$,height:X}=H.label,{fontStyle:Z,fontFamily:q,fontWeight:it,color:J}=this.properties.label,j=G.x+F*(w-2*y),tt=G.y+O*(R-2*y)-(H.height-X)*.5;T.push({series:this,itemId:c,datum:L,datumIndex:C,text:U,fontSize:Y,lineHeight:$,fontStyle:Z,fontFamily:q,fontWeight:it,color:J,textAlign:p,textBaseline:g,x:j,y:tt,style:K})}}return{itemId:this.properties.yKey??this.id,nodeData:_,labelData:T,scales:this.calculateScaling(),visible:this.visible}}nodeFactory(){return new Rect}update(t){return this.ctx.animationManager.skipCurrentBatch(),super.update(t)}updateDatumSelection(t){const{nodeData:e,datumSelection:i}=t,o=e??[];return i.update(o)}getItemStyle({datumIndex:t,datum:e,colorValue:i},o){const{properties:s}=this,{itemStyler:a,stroke:r,strokeWidth:n,strokeOpacity:l}=s,c=this.getHighlightStyle(o,t),h=mergeDefaults6(c,{fill:this.isColorScaleValid()&&i!=null?this.colorScale.convert(i):"transparent",fillOpacity:1,stroke:r,strokeWidth:n,strokeOpacity:l,opacity:1});let d;return a!=null&&t!=null&&(d=this.cachedDatumCallback(createDatumId3(t,o?"highlight":"node"),()=>{const u=this.makeItemStylerParams(e,t,o,h);return this.callWithContext(a,u)})),d?mergeDefaults6(d,h):h}makeItemStylerParams(t,e,i,o){const{id:s,properties:a}=this,{xKey:r,yKey:n}=a,l=this.ctx.highlightManager?.getActiveHighlight(),c=this.getHighlightStateString(l,i,e),h=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:s,datum:t,xKey:r,yKey:n,highlighted:i,highlightState:c,...o,fill:h}}updateDatumStyles({datumSelection:t,isHighlight:e}){t.each((i,o)=>{o.style=this.getItemStyle(o,e)})}updateDatumNodes({datumSelection:t}){const e=this.axes[ChartAxisDirection15.X],[i,o]=e?.visibleRange??[],a=!(i!==0||o!==1);t.each((r,n)=>{const{point:l,width:c,height:h,style:d}=n;applyShapeStyle2(r,d),r.crisp=a,r.x=Math.floor(l.x-c/2),r.y=Math.floor(l.y-h/2),r.width=Math.ceil(c),r.height=Math.ceil(h)})}updateLabelSelection(t){const{labelData:e,labelSelection:i}=t,{enabled:o}=this.properties.label,s=o?e:[];return i.update(s)}updateLabelNodes(t){const e=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((i,o)=>{i.pointerEvents=PointerEvents.None,i.text=o.text,i.fillOpacity=this.getHighlightStyle(!1,o.datumIndex)?.opacity??1,updateLabelNode(this,i,this.properties,this.properties.label,o,!1,e)})}getTooltipContent(t){const{id:e,dataModel:i,processedData:o,axes:s,properties:a,colorScale:r,ctx:n}=this,{formatManager:l}=n,{xKey:c,xName:h,yKey:d,yName:u,colorKey:p,colorName:g,colorRange:y,title:f,legendItemName:x,tooltip:b}=a,m=s[ChartAxisDirection15.X],S=s[ChartAxisDirection15.Y];if(!i||!o||!m||!S)return;const v=o.dataSources.get(this.id)?.data[t],M=i.resolveColumnById(this,"xValue",o)[t],D=i.resolveColumnById(this,"yValue",o)[t],k=p!=null&&this.isColorScaleValid()?i.resolveColumnById(this,"colorValue",o)[t]:void 0;if(M==null)return;const _=[];let T;if(k==null)T=y[0];else{T=r.convert(k);const F=i.getDomain(this,"colorValue","value",o),O=l.format(this.callWithContext.bind(this),{type:"number",value:k,datum:v,seriesId:e,legendItemName:x,key:p,source:"tooltip",property:"color",domain:F,boundSeries:this.getFormatterContext("color"),fractionDigits:void 0});_.push({label:g,fallbackLabel:p,value:O??formatValue(k)})}_.push({label:h,fallbackLabel:c,value:this.getAxisValueText(m,"tooltip",M,v,c,x)},{label:u,fallbackLabel:d,value:this.getAxisValueText(S,"tooltip",D,v,d,x)});const w=this.getItemStyle({datumIndex:t,datum:v,colorValue:k},!1);w.fill!=null&&(T=w.fill);const R=T==null?void 0:{marker:{shape:"square",fill:T,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0}};return this.formatTooltipWithContext(b,{title:f??x,symbol:R,data:_},{seriesId:e,datum:v,title:f,xKey:c,xName:h,yKey:d,yName:u,colorKey:p,colorName:g,...w})}getLegendData(t){return t!=="gradient"||!this.isColorScaleValid()||!this.dataModel?[]:[{legendType:"gradient",enabled:this.visible,seriesId:this.id,series:this.getFormatterContext("color"),colorDomain:this.colorScale.domain,colorRange:this.colorScale.range}]}isLabelEnabled(){return this.properties.label.enabled&&!!this.properties.colorKey}getBandScalePadding(){return{inner:0,outer:0}}computeFocusBounds({datumIndex:t}){const e=this.contextNodeData?.nodeData[t];if(e===void 0)return;const{width:i,height:o,midPoint:s}=e,a={x:s.x-i/2,y:s.y-o/2,width:i,height:o};return computeBarFocusBounds3(this,a)}initQuadTree(t){addHitTestersToQuadtree(t,this.datumNodesIter())}pickNodesExactShape(t){const e=findQuadtreeMatch(this,t);return e!=null&&e.distance<=0?[e.datum]:[]}pickNodeClosestDatum(t){return findQuadtreeMatch(this,t)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};HeatmapSeries.className="HeatmapSeries",HeatmapSeries.type="heatmap";var import_ag_charts_community130=require("ag-charts-community"),import_ag_charts_core60=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs3,heatmapSeriesThemeableOptionsDef,without}=import_ag_charts_community130._ModuleSupport,heatmapSeriesOptionsDef={...without(heatmapSeriesThemeableOptionsDef,["showInLegend"]),...without(commonSeriesOptionsDefs3,["showInLegend"]),type:(0,import_ag_charts_core60.required)((0,import_ag_charts_core60.constant)("heatmap")),xKey:(0,import_ag_charts_core60.required)(import_ag_charts_core60.string),yKey:(0,import_ag_charts_core60.required)(import_ag_charts_core60.string),colorKey:import_ag_charts_core60.string,xName:import_ag_charts_core60.string,yName:import_ag_charts_core60.string,colorName:import_ag_charts_core60.string,colorRange:(0,import_ag_charts_core60.arrayOf)(import_ag_charts_core60.color)},import_ag_charts_community131=require("ag-charts-community"),HEATMAP_SERIES_THEME={series:{stroke:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$ref:"chartBackgroundColor"},{$path:["/0",{$palette:"stroke"},{$palette:"strokes"}]}]},strokeWidth:{$isUserOption:["./stroke",2,void 0]},colorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"divergingColors"},import_ag_charts_community131._ModuleSupport.SAFE_RANGE2_OPERATION]},label:{...import_ag_charts_community131._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,color:{$ref:"textColor"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},wrapping:"on-space",overflowStrategy:"ellipsis"},itemPadding:3,highlight:import_ag_charts_community131._ModuleSupport.singleSeriesHighlightStyle()},gradientLegend:{enabled:!0,...import_ag_charts_community131._ModuleSupport.LEGEND_CONTAINER_THEME}},{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE4,CARTESIAN_POSITION:CARTESIAN_POSITION2}}=import_ag_charts_community132._ModuleSupport,HeatmapModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"heatmap",moduleFactory:t=>new HeatmapSeries(t),defaultAxes:[{type:CARTESIAN_AXIS_TYPE4.CATEGORY,position:CARTESIAN_POSITION2.LEFT},{type:CARTESIAN_AXIS_TYPE4.CATEGORY,position:CARTESIAN_POSITION2.BOTTOM}],themeTemplate:HEATMAP_SERIES_THEME},HeatmapSeriesModule={type:"series",name:"heatmap",chartType:"cartesian",enterprise:!0,options:heatmapSeriesOptionsDef,create:t=>new HeatmapSeries(t)},import_ag_charts_community135=require("ag-charts-community"),import_ag_charts_community133=require("ag-charts-community"),{applyShapeStyle:applyShapeStyle3}=import_ag_charts_community133._ModuleSupport,OhlcSeries=class extends OhlcSeriesBase{constructor(){super(...arguments),this.properties=new OhlcSeriesProperties}nodeFactory(){const t=new OhlcNode;return t.lineCap="square",t}updateDatumStyles({datumSelection:t,isHighlight:e}){t.each((i,o)=>{o.style=this.getItemStyle(o.datumIndex,e,void 0,o.itemId)})}updateDatumNodes({datumSelection:t,isHighlight:e}){const{contextNodeData:i,properties:o}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight(),{up:a,down:r}=o.item;t.each((n,l)=>{const{centerX:c,width:h,y:d,height:u,yOpen:p,yClose:g,crisp:y}=l,f=l.isRising?a:r;n.centerX=c,n.width=h,n.y=d,n.height=u,n.yOpen=p,n.yClose=g,n.crisp=y;const x=l.style??i.styles[l.itemId][this.getHighlightState(s,e,l.datumIndex)];applyShapeStyle3(n,x),n.strokeAlignment=f.strokeWidth})}getLegendData(t){const{id:e,data:i,ctx:{legendManager:o},visible:s}=this,{xKey:a,yName:r,item:{up:n,down:l},showInLegend:c,legendItemName:h}=this.properties;if(!i?.data.length||!a||t!=="category")return[];const d={type:"gradient",gradient:"linear",colorSpace:"rgb",colorStops:[{color:n.stroke,stop:0},{color:n.stroke,stop:.5},{color:l.stroke,stop:.5}],rotation:90};return[{legendType:"category",id:e,itemId:e,seriesId:e,enabled:s&&o.getItemEnabled({seriesId:e,itemId:e}),label:{text:h??r??e},symbol:{marker:{fill:d,fillOpacity:n.strokeOpacity,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0}},legendItemName:h,hideInLegend:!c}]}hasItemStylers(){return this.properties.itemStyler!=null}};OhlcSeries.className="ohlc",OhlcSeries.type="ohlc";var import_ag_charts_community134=require("ag-charts-community"),import_ag_charts_core61=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs4,ohlcSeriesThemeableOptionsDef}=import_ag_charts_community134._ModuleSupport,ohlcSeriesOptionsDef={...commonSeriesOptionsDefs4,...ohlcSeriesThemeableOptionsDef,type:(0,import_ag_charts_core61.required)((0,import_ag_charts_core61.constant)("ohlc")),xKey:(0,import_ag_charts_core61.required)(import_ag_charts_core61.string),openKey:(0,import_ag_charts_core61.required)(import_ag_charts_core61.string),highKey:(0,import_ag_charts_core61.required)(import_ag_charts_core61.string),lowKey:(0,import_ag_charts_core61.required)(import_ag_charts_core61.string),closeKey:(0,import_ag_charts_core61.required)(import_ag_charts_core61.string),xName:import_ag_charts_core61.string,yName:import_ag_charts_core61.string,openName:import_ag_charts_core61.string,highName:import_ag_charts_core61.string,lowName:import_ag_charts_core61.string,closeName:import_ag_charts_core61.string};ohlcSeriesOptionsDef.pickOutsideVisibleMinorAxis=(0,import_ag_charts_core61.undocumented)(import_ag_charts_core61.boolean),ohlcSeriesOptionsDef.focusPriority=(0,import_ag_charts_core61.undocumented)(import_ag_charts_core61.number);var{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE5,CARTESIAN_POSITION:CARTESIAN_POSITION3},multiSeriesHighlightStyle:multiSeriesHighlightStyle3}=import_ag_charts_community135._ModuleSupport,OhlcModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"ohlc",moduleFactory:t=>new OhlcSeries(t),defaultAxes:[{type:CARTESIAN_AXIS_TYPE5.NUMBER,position:CARTESIAN_POSITION3.LEFT},{type:CARTESIAN_AXIS_TYPE5.ORDINAL_TIME,position:CARTESIAN_POSITION3.BOTTOM}],themeTemplate:{animation:{enabled:!1},series:{item:{up:{stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:"up.stroke"}]}},down:{stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:"down.stroke"}]}}},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:multiSeriesHighlightStyle3(!1)},axes:{[CARTESIAN_AXIS_TYPE5.NUMBER]:{crosshair:{snap:!1}},[CARTESIAN_AXIS_TYPE5.ORDINAL_TIME]:{groupPaddingInner:0,crosshair:{enabled:!0}}}},groupable:!1},OhlcSeriesModule={type:"series",name:"ohlc",chartType:"cartesian",enterprise:!0,options:ohlcSeriesOptionsDef,create:t=>new OhlcSeries(t)},import_ag_charts_community143=require("ag-charts-community"),import_ag_charts_community140=require("ag-charts-community"),import_ag_charts_community136=require("ag-charts-community"),{AGGREGATION_INDEX_Y_MAX:AGGREGATION_INDEX_Y_MAX2,AGGREGATION_INDEX_Y_MIN:AGGREGATION_INDEX_Y_MIN2,aggregationDomain:aggregationDomain2,aggregationIndexForXRatio,aggregationRangeFittingPoints:aggregationRangeFittingPoints2,aggregationXRatioForXValue,compactAggregationIndices:compactAggregationIndices2,createAggregationIndices:createAggregationIndices2}=import_ag_charts_community136._ModuleSupport,AGGREGATION_THRESHOLD2=1e3;function aggregationContainsTopIndex(t,e,i,o,s,a,r){const n=t[a];if(n==null)return!1;const l=aggregationXRatioForXValue(n,e,i,r),c=aggregationIndexForXRatio(l,s);return a===o[c+AGGREGATION_INDEX_Y_MAX2]}function aggregationContainsBottomIndex(t,e,i,o,s,a,r){const n=t[a];if(n==null)return!1;const l=aggregationXRatioForXValue(n,e,i,r),c=aggregationIndexForXRatio(l,s);return a===o[c+AGGREGATION_INDEX_Y_MIN2]}function aggregateRangeAreaData(t,e,i,o,s,a,r){if(e.length64;)({maxRange:c}=compactAggregationIndices2(h,d,c,{inPlace:!0})),u=u.filter(y=>aggregationContainsTopIndex(e,n,l,h,c,y,a)),p=p.filter(y=>aggregationContainsBottomIndex(e,n,l,h,c,y,a)),g.push({maxRange:c,topIndices:u,bottomIndices:p});return g.reverse(),g}var import_ag_charts_community137=require("ag-charts-community");function getYValueAtX({span:t},e){switch(t.type){case"linear":case"step":case"multi-line":{const i=(e-t.x0)/(t.x1-t.x0);return t.y0+i*(t.y1-t.y0)}case"cubic":{const{cp0x:i,cp0y:o,cp1x:s,cp1y:a,cp2x:r,cp2y:n,cp3x:l,cp3y:c}=t;let h=.5;const d=1e-6;for(let p=0;p<10;p++){const g=1-h,f=g*g*g*i+3*g*g*h*s+3*g*h*h*r+h*h*h*l-e;if(Math.abs(f)=a.x&&e<=r.x)return{span:s,index:o};if(el;return{intersection:o===c?null:{x:i,y:n},spanIndex:a.index,isInverted:c}}function findRangeAreaIntersections(t,e,i,o,s=!1){if(t.length===0||e.length===0)return[];const a=[];let r=s,n=0;for(let l=i;l<=o;l+=.5){const c=checkForIntersection(t,e,l,r,n);c.intersection&&a.push(c.intersection.x),n=c.spanIndex,r=c.isInverted}return a}function calculateIntersectionSegments(t,e,i,o,s={}){const a=Math.max(e.x,i.width-(e.x+e.width)),r=Math.max(e.y,i.height-(e.y+e.height)),n=[],l=(h,d)=>({x0:h,y0:-r,x1:d,y1:e.height+r});o&&n.push({clipRect:l(-a,t[0]??e.width+a),...s});const c=o?1:0;for(let h=c;h{plotInterpolatedLinePathStroke(l,c,e.removed),plotInterpolatedLinePathStroke(l,c,i.removed)},a=(l,c)=>{plotInterpolatedLinePathStroke(l,c,e.moved),plotInterpolatedLinePathStroke(l,c,i.moved)},r=(l,c)=>{plotInterpolatedLinePathStroke(l,c,e.added),plotInterpolatedLinePathStroke(l,c,i.added)},n=prepareLinePathPropertyAnimation(t,o);return{status:t,path:{addPhaseFn:r,updatePhaseFn:a,removePhaseFn:s},pathProperties:n}}function prepareRangeAreaPathAnimation(t,e,i){const o=t.scales.x?.type==="category",s=e.scales.x?.type==="category";if(o!==s||!isScaleValid(t.scales.x)||!isScaleValid(e.scales.x))return;let a="updated";e.visible&&!t.visible?a="removed":!e.visible&&t.visible&&(a="added");const r=pairUpSpans({scales:t.scales,data:t.fillData.spans},{scales:e.scales,data:e.fillData.spans},CollapseMode.Split);if(r==null)return;const n=pairUpSpans({scales:t.scales,data:t.fillData.phantomSpans},{scales:e.scales,data:e.fillData.phantomSpans},CollapseMode.Split);if(n==null)return;const l=pairUpSpans({scales:t.scales,data:t.highStrokeData.spans},{scales:e.scales,data:e.highStrokeData.spans},CollapseMode.Split);if(l==null)return;const c=pairUpSpans({scales:t.scales,data:t.lowStrokeData.spans},{scales:e.scales,data:e.lowStrokeData.spans},CollapseMode.Split);if(c==null)return;const h="fade",d=prepareAreaFillAnimationFns(a,r,n,h),u=prepareRangeAreaPathStrokeAnimationFns(a,l,c,h),p=(i?.changed??!0)||!areScalingEqual(t.scales.x,e.scales.x)||!areScalingEqual(t.scales.y,e.scales.y)||a!=="updated";return{status:a,fill:d,stroke:u,hasMotion:p}}var{valueProperty:valueProperty6,keyProperty:keyProperty4,ChartAxisDirection:ChartAxisDirection16,mergeDefaults:mergeDefaults7,updateLabelNode:updateLabelNode2,fixNumericExtent:fixNumericExtent4,buildResetPathFn,resetLabelFn,resetMarkerFn,resetMarkerPositionFn,pathSwipeInAnimation,resetMotion,markerSwipeScaleInAnimation,seriesLabelFadeInAnimation,animationValidation:animationValidation3,diff:diff3,updateClipPath,computeMarkerFocusBounds,plotAreaPathFill,plotLinePathStroke,interpolatePoints,pathFadeInAnimation,markerFadeInAnimation,fromToMotion,pathMotion,extent,applyShapeFillBBox:applyShapeFillBBox2,PointerEvents:PointerEvents2,Marker,BBox:BBox13,findMinMax:findMinMax2,applyShapeStyle:applyShapeStyle4,processedDataIsAnimatable:processedDataIsAnimatable2,simpleMemorize2:simpleMemorize22,markerEnabled,getMarkerStyles,calculateSegments:calculateSegments2,toHighlightString:toHighlightString2,HighlightState:HighlightState2}=import_ag_charts_community140._ModuleSupport,memoizedAggregateRangeAreaData=simpleMemorize22(aggregateRangeAreaData),RangeAreaSeriesNodeEvent=class extends import_ag_charts_community140._ModuleSupport.SeriesNodeEvent{constructor(t,e,i,o){super(t,e,i,o),this.xKey=o.properties.xKey,this.yLowKey=o.properties.yLowKey,this.yHighKey=o.properties.yHighKey}},BaseSeries=import_ag_charts_community140._ModuleSupport.CartesianSeries,RangeAreaSeries=class extends BaseSeries{constructor(t){super({moduleCtx:t,pathsPerSeries:["fill","lowStroke","highStroke"],pickModes:[import_ag_charts_community140._ModuleSupport.SeriesNodePickMode.AXIS_ALIGNED],propertyKeys:{[ChartAxisDirection16.X]:["xKey"],[ChartAxisDirection16.Y]:["yLowKey","yHighKey"]},propertyNames:{[ChartAxisDirection16.X]:["xName"],[ChartAxisDirection16.Y]:["yLowName","yHighName","yName"]},categoryKey:"xValue",animationResetFns:{path:buildResetPathFn({getVisible:()=>this.visible,getOpacity:()=>this.getOpacity()}),label:resetLabelFn,datum:(e,i)=>({...resetMarkerFn(e),...resetMarkerPositionFn(e,i)})},clipFocusBox:!1}),this.properties=new RangeAreaProperties,this.NodeEvent=RangeAreaSeriesNodeEvent,this.dataAggregationFilters=void 0}async processData(t){const{xKey:e,yLowKey:i,yHighKey:o}=this.properties,s=this.axes[ChartAxisDirection16.X]?.scale,a=this.axes[ChartAxisDirection16.Y]?.scale,{xScaleType:r,yScaleType:n}=this.getScaleInformation({xScale:s,yScale:a}),l=[],c=!this.ctx.animationManager.isSkipped();!this.ctx.animationManager.isSkipped()&&this.processedData&&l.push(diff3(this.id,this.processedData)),c&&l.push(animationValidation3());const{dataModel:h,processedData:d}=await this.requestDataModel(t,this.data,{props:[keyProperty4(e,r,{id:"xValue"}),valueProperty6(i,n,{id:"yLowValue"}),valueProperty6(o,n,{id:"yHighValue"}),...l]});this.dataAggregationFilters=this.aggregateData(h,d),this.animationState.transition("updateData")}aggregateData(t,e){if(e.type!=="ungrouped"||processedDataIsAnimatable2(e))return;const i=this.axes[ChartAxisDirection16.X];if(i==null)return;const o=t.resolveKeysById(this,"xValue",e),s=t.resolveColumnById(this,"yHighValue",e),a=t.resolveColumnById(this,"yLowValue",e),{index:r}=t.resolveProcessedDataDefById(this,"xValue"),n=e.domain.keys[r],l=t.resolveColumnNeedsValueOf(this,"xValue",e),c=t.resolveColumnNeedsValueOf(this,"yHighValue",e);return memoizedAggregateRangeAreaData(i.scale.type,o,s,a,n,l,c)}xCoordinateRange(t){const e=this.axes[ChartAxisDirection16.X].scale.convert(t);return[e,e]}yCoordinateRange(t){const e=this.axes[ChartAxisDirection16.Y].scale.convert(t[0]);return[e,e]}getSeriesDomain(t){const{processedData:e,dataModel:i}=this;if(!(e&&i))return[];const{domain:{keys:[o]}}=e;if(t===ChartAxisDirection16.X){const s=i.resolveProcessedDataDefById(this,"xValue");return s?.def.type==="key"&&s.def.valueType==="category"?o:fixNumericExtent4(extent(o))}else{const s=this.domainForClippedRange(ChartAxisDirection16.Y,["yHighValue","yLowValue"],"xValue"),a=findMinMax2(s);return fixNumericExtent4(a)}}getSeriesRange(t,e){return this.domainForVisibleRange(ChartAxisDirection16.Y,["yHighValue","yLowValue"],"xValue",e)}createNodeData(){const{data:t,dataModel:e,processedData:i,axes:o}=this,s=o[ChartAxisDirection16.X],a=o[ChartAxisDirection16.Y];if(!(t&&s&&a&&e&&i&&this.chart?.seriesRect))return;const r=s.scale,n=a.scale,{xKey:l,yLowKey:c,yHighKey:h,connectMissingData:d,interpolation:u,fill:p,fillOpacity:g,item:y}=this.properties,f=i.dataSources.get(this.id)?.data??[],x=(r.bandwidth??0)/2,b=e.resolveKeysById(this,"xValue",i),m=e.resolveColumnById(this,"yHighValue",i),S=e.resolveColumnById(this,"yLowValue",i),v=H=>r.convert(b[H])+x,M=[],D=[],k=[],_=(H,G,K)=>{const U=f[H],Y=b[H];if(Y==null)return;const $=k.at(-1);if(Number.isFinite(G)&&Number.isFinite(K)){const X=(tt,Q,ot)=>{const{size:et}=y[tt].marker;D.push({index:H,series:this,itemId:tt,datum:U,datumIndex:H,midPoint:{x:q,y:ot},yHighValue:G,yLowValue:K,xValue:Y,xKey:l,yLowKey:c,yHighKey:h,point:{x:q,y:ot,size:et},enabled:!0});const st=this.createLabelData({datumIndex:H,point:{x:q,y:ot},value:Q,yLowValue:K,yHighValue:G,itemId:tt,inverted:Z,datum:U,series:this});M.push(st)},Z=K>G,q=v(H),it=n.convert(G),J=n.convert(K);X("high",G,it),X("low",K,J);const j={high:{point:{x:q,y:it},xDatum:Y,yDatum:G},low:{point:{x:q,y:J},xDatum:Y,yDatum:K}};Array.isArray($)?$.push(j):$==null?k.push([j]):($.skip+=1,k.push([j]))}else d||(Array.isArray($)||$==null?k.push({skip:0}):$.skip+=1)},{dataAggregationFilters:T}=this,[w,R]=r.range,F=Math.abs(R-w),O=T?.find(H=>H.maxRange>F),E=O?.topIndices,I=O?.bottomIndices;let[C,L]=this.visibleRangeIndices("xValue",s.range,E);C=Math.max(C-1,0),L=Math.min(L+1,E?.length??b.length),i.input.count<1e3&&(C=0,L=i.input.count);for(let H=C;H{if(!Array.isArray(H))return[];const G=H.map(K=>K.high);return interpolatePoints(G,u)}),P=k.flatMap(H=>{if(!Array.isArray(H))return[];const G=H.map(K=>K.low);return interpolatePoints(G,u)}),z=calculateSegments2(this.properties.segmentation,s,a,this.chart.seriesRect,this.ctx.scene,!1);let B;if(this.properties.invertedStyle.enabled){const H=m[0]{const G=y[H],{stroke:K,strokeWidth:U,strokeOpacity:Y}=G,$={fill:p,fillOpacity:g,stroke:K,strokeWidth:U,strokeOpacity:Y};return getMarkerStyles(this,G,G.marker,$)};return{itemId:`${c}-${h}`,labelData:M,nodeData:D,fillData:{itemId:"high",spans:A,phantomSpans:P},highStrokeData:{itemId:"high",spans:A},lowStrokeData:{itemId:"low",spans:P},scales:this.calculateScaling(),visible:this.visible,styles:{low:V("low"),high:V("high")},segments:z,intersectionSegments:B}}createLabelData({datumIndex:t,point:e,value:i,itemId:o,inverted:s,datum:a,series:r}){const{xKey:n,yLowKey:l,yHighKey:c,xName:h,yName:d,yLowName:u,yHighName:p,legendItemName:g,label:y}=this.properties,{placement:f}=y,x=y.spacing+(typeof y.padding=="number"?y.padding:0);let b=o;s&&(b=o==="low"?"high":"low");const m=f==="outside"&&b==="high"||f==="inside"&&b==="low"?-1:1,S=this.getSeriesDomain(ChartAxisDirection16.Y);return{x:e.x,y:e.y+x*m,series:r,itemId:o,datum:a,datumIndex:t,text:this.getLabelText(i,a,o==="high"?c:l,"y",S,y,{value:i,datum:a,itemId:o,xKey:n,yLowKey:l,yHighKey:c,xName:h,yLowName:u,yHighName:p,yName:d,legendItemName:g}),textAlign:"center",textBaseline:m===-1?"bottom":"top"}}isPathOrSelectionDirty(){const{low:t,high:e}=this.properties.item;return t.marker.isDirty()||e.marker.isDirty()}strokewidthChange(){const t=e=>{const i=this.properties.item[e].strokeWidth??0,o=this.properties.highlight.highlightedSeries.item?.[e]?.strokeWidth??i,s=this.properties.highlight.highlightedItem.item?.[e]?.strokeWidth??i;return i>s||o>s};return t("low")||t("high")}updatePathNodes(t){const{visible:e}=t,[i,o,s]=t.paths,a=this.contextNodeData?.segments,r=this.ctx.highlightManager?.getActiveHighlight(),n=this.getHighlightState(r,!1),l=this.getHighlightStyle(),{item:c,fill:h,fillOpacity:d,opacity:u}=mergeDefaults7(l,this.getStyle(!1,n));o.setProperties({datum:a,segments:a,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:PointerEvents2.None,stroke:c.low.stroke,strokeWidth:c.low.strokeWidth,strokeOpacity:c.low.strokeOpacity,lineDash:c.low.lineDash,lineDashOffset:c.low.lineDashOffset,opacity:u,visible:e}),s.setProperties({segments:a,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:PointerEvents2.None,stroke:c.high.stroke,strokeWidth:c.high.strokeWidth,strokeOpacity:c.high.strokeOpacity,lineDash:c.high.lineDash,lineDashOffset:c.high.lineDashOffset,opacity:u,visible:e});const p=this.getShapeFillBBox();applyShapeFillBBox2(i,h,p),applyShapeStyle4(i,{stroke:void 0,fill:h,fillOpacity:d,opacity:u},p);const g=this.contextNodeData?.intersectionSegments??a;i.setProperties({segments:g,pointerEvents:PointerEvents2.None,lineJoin:"round",fillShadow:this.properties.shadow,opacity:u,visible:e}),i.datum=g,updateClipPath(this,i),updateClipPath(this,o),updateClipPath(this,s)}updatePaths(t){this.updateAreaPaths(t.paths,t.contextData)}updateAreaPaths(t,e){for(const i of t)i.visible=e.visible;if(e.visible)this.updateFillPath(t,e),this.updateStrokePath(t,e);else for(const i of t)i.path.clear(),i.markDirty("RangeArea")}updateFillPath(t,e){const[i]=t;i.path.clear(),plotAreaPathFill(i,e.fillData),i.markDirty("RangeArea")}updateStrokePath(t,e){const[,i,o]=t;i.path.clear(),o.path.clear(),plotLinePathStroke(i,e.lowStrokeData.spans),plotLinePathStroke(o,e.highStrokeData.spans),i.markDirty("RangeArea"),o.markDirty("RangeArea")}updateDatumSelection(t){const{nodeData:e,datumSelection:i}=t,{processedData:o,axes:s,properties:a}=this,r=a.styler?this.getStylerMarkerOptions().item:a.item,{low:n,high:l}=r,c=markerEnabled(o.input.count,s[ChartAxisDirection16.X].scale,{enabled:n.marker.enabled||l.marker.enabled});(a.item.low.marker.isDirty()||a.item.high.marker.isDirty())&&(i.clear(),i.cleanup());let h;if(c)if(n.marker.enabled&&l.marker.enabled)h=e;else{h=[];for(const d of e)r[d.itemId].marker.enabled&&h.push(d)}else h=[];return i.update(h)}updateDatumStyles({datumSelection:t,isHighlight:e}){const i=this.ctx.highlightManager.getActiveHighlight();t.each((o,s)=>{const a=this.getHighlightState(i,e,s.datumIndex),r=this.getStyle(e,a),{fill:n,fillOpacity:l,item:c}=r,{stroke:h,strokeWidth:d,strokeOpacity:u}=c[s.itemId],{marker:p}=this.properties.item[s.itemId],g=this.makeItemStylerParams(s.itemId);s.style=this.getMarkerStyle(p,s,g,{isHighlight:e,highlightState:a,resolveMarkerSubPath:["item",s.itemId,"marker"]},r.item[s.itemId].marker,{fill:n,fillOpacity:l,stroke:h,strokeWidth:d,strokeOpacity:u})})}updateDatumNodes(t){const{contextNodeData:e}=this;if(!e)return;const{datumSelection:i,isHighlight:o}=t,s=this.getShapeFillBBox(),a=this.ctx.highlightManager.getActiveHighlight();i.each((r,n)=>{const{itemId:l}=n,c=n.style??e.styles[l][this.getHighlightState(a,o,n.datumIndex)];this.applyMarkerStyle(c,r,n.point,s)}),o||(this.properties.item.low.marker.markClean(),this.properties.item.high.marker.markClean())}updateLabelSelection(t){const{labelData:e,labelSelection:i}=t;return i.update(e,o=>{o.pointerEvents=PointerEvents2.None})}updateLabelNodes(t){const e={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yName:this.properties.yName,yLowKey:this.properties.yLowKey,yLowName:this.properties.yLowName??this.properties.yLowKey,yHighKey:this.properties.yHighKey,yHighName:this.properties.yHighName??this.properties.yHighKey,legendItemName:this.properties.legendItemName},i=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((o,s)=>{o.fillOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1,updateLabelNode2(this,o,e,this.properties.label,s,!1,i)})}getHighlightData(t,e){const i=t.filter(o=>o.datum===e.datum);return i.length>0?i:void 0}getStyle(t,e){return this.getStylerCouple(t,e)[0]}getStylerMarkerOptions(){return this.getStylerCouple(!1)[1]}getStylerCouple(t,e){const{fill:i,fillOpacity:o,item:s,styler:a}=this.properties;let r={};if(a){const h=this.makeStylerParams(t,e);r=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(a,h)??{},{pick:!1})??{}}const n={item:{low:{marker:{enabled:!1}},high:{marker:{enabled:!1}}}},l=h=>{const d=r.item?.[h],{lineDash:u,lineDashOffset:p,marker:g,stroke:y,strokeOpacity:f,strokeWidth:x}=s[h];return n.item[h].marker.enabled=d?.marker?.enabled??g.enabled,{marker:{fill:d?.marker?.fill??g.fill??i,fillOpacity:d?.marker?.fillOpacity??g.fillOpacity,shape:d?.marker?.shape??g.shape,size:d?.marker?.size??g.size,lineDash:d?.marker?.lineDash??g.lineDash,lineDashOffset:d?.marker?.lineDashOffset??g.lineDashOffset,stroke:d?.marker?.stroke??g.stroke??y,strokeOpacity:d?.marker?.strokeOpacity??g.strokeOpacity,strokeWidth:d?.marker?.strokeWidth??g.strokeWidth},lineDash:d?.lineDash??u,lineDashOffset:d?.lineDashOffset??p,stroke:d?.stroke??y,strokeOpacity:d?.strokeOpacity??f,strokeWidth:d?.strokeWidth??x}};return[{fill:r.fill??i,fillOpacity:r.fillOpacity??o,opacity:1,topLevel:{lineDash:this.properties.lineDash,lineDashOffset:this.properties.lineDashOffset,marker:this.properties.marker,stroke:this.properties.stroke,strokeOpacity:this.properties.strokeOpacity,strokeWidth:this.properties.strokeWidth},item:{low:l("low"),high:l("high")}},n]}makeStylerParams(t,e){const{id:i}=this,{fill:o,fillOpacity:s,item:a,xKey:r,yHighKey:n,yLowKey:l}=this.properties,c=toHighlightString2(e??HighlightState2.None),h=d=>{const{lineDash:u,lineDashOffset:p,marker:g,stroke:y,strokeOpacity:f,strokeWidth:x}=a[d];return{marker:{fill:g.fill??o,fillOpacity:g.fillOpacity,size:g.size,shape:g.shape,stroke:g.stroke??y,strokeOpacity:g.strokeOpacity,strokeWidth:g.strokeWidth,lineDash:g.lineDash,lineDashOffset:g.lineDashOffset},lineDash:u,lineDashOffset:p,stroke:y,strokeOpacity:f,strokeWidth:x}};return{item:{low:h("low"),high:h("high")},fill:o,fillOpacity:s,highlightState:c,highlighted:t,seriesId:i,xKey:r,yLowKey:l,yHighKey:n}}makeItemStylerParams(t){const{xKey:e,yLowKey:i,yHighKey:o}=this.properties;return{xKey:e,yLowKey:i,yHighKey:o,itemId:t}}getTooltipContent(t,e){const i=e?.itemId??"high",{id:o,dataModel:s,processedData:a,axes:r,properties:n}=this,{xName:l,yName:c,yLowKey:h,yLowName:d,xKey:u,yHighKey:p,yHighName:g,tooltip:y,legendItemName:f}=n,x=r[ChartAxisDirection16.X],b=r[ChartAxisDirection16.Y];if(!s||!a||!x||!b)return;const m=a.dataSources.get(this.id)?.data[t],S=s.resolveKeysById(this,"xValue",a)[t],v=s.resolveColumnById(this,"yHighValue",a)[t],M=s.resolveColumnById(this,"yLowValue",a)[t];if(S==null)return;const D=this.getStyle(!1),k=this.makeItemStylerParams(i),_=this.getMarkerStyle(this.properties.item[i].marker,{datumIndex:t,datum:m},k,{isHighlight:!1,resolveMarkerSubPath:["item",i,"marker"]},D.item[i].marker),T=`${this.getAxisValueText(b,"tooltip",M,m,h,f)} - ${this.getAxisValueText(b,"tooltip",v,m,p,f)}`;return this.formatTooltipWithContext(y,{heading:this.getAxisValueText(x,"tooltip",S,m,u,f),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:`${d??h} - ${g??p}`,value:T}]},{seriesId:o,datum:m,title:c,itemId:i,xName:l,yName:c,yLowKey:h,yLowName:d,xKey:u,yHighKey:p,yHighName:g,legendItemName:f,..._})}legendItemSymbol(){const{fill:t,topLevel:e}=this.getStyle(!1),{stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,marker:r}=e;return{marker:{shape:r.shape,fill:r.fill??t,stroke:r.stroke??i,fillOpacity:r.fillOpacity,strokeOpacity:r.strokeOpacity,strokeWidth:r.strokeWidth,lineDash:r.lineDash,lineDashOffset:r.lineDashOffset},line:{stroke:i,strokeOpacity:s,strokeWidth:o,lineDash:a}}}getLegendData(t){if(t!=="category")return[];const{id:e,visible:i}=this,{yLowKey:o,yHighKey:s,yName:a,yLowName:r,yHighName:n,legendItemName:l,showInLegend:c}=this.properties,h=l??a??`${r??o} - ${n??s}`,d=`${o}-${s}`;return[{legendType:"category",id:e,itemId:d,seriesId:e,enabled:i,label:{text:`${h}`},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!c}]}isLabelEnabled(){return this.properties.label.enabled}onDataChange(){}nodeFactory(){return new Marker}animateEmptyUpdateReady(t){const{datumSelection:e,labelSelection:i,contextData:o,paths:s}=t,{animationManager:a}=this.ctx;this.updateAreaPaths(s,o),pathSwipeInAnimation(this,a,...s),resetMotion([e],resetMarkerPositionFn),markerSwipeScaleInAnimation(this,a,e),seriesLabelFadeInAnimation(this,"labels",a,i)}animateReadyResize(t){const{contextData:e,paths:i}=t;this.updateAreaPaths(i,e),super.animateReadyResize(t)}animateWaitingUpdateReady(t){const{animationManager:e}=this.ctx,{datumSelection:i,labelSelection:o,contextData:s,paths:a,previousContextData:r}=t,[n,l,c]=a;if(n==null&&l==null&&c==null)return;this.resetDatumAnimation(t),this.resetLabelAnimation(t);const h=()=>{this.resetPathAnimation(t),this.updateAreaPaths(a,s)},d=()=>{e.skipCurrentBatch(),h()};if(s==null||r==null){h(),markerFadeInAnimation(this,e,"added",i),pathFadeInAnimation(this,"fill_path_properties",e,"add",n),pathFadeInAnimation(this,"low_stroke_path_properties",e,"add",l),pathFadeInAnimation(this,"high_stroke_path_properties",e,"add",c),seriesLabelFadeInAnimation(this,"labels",e,o);return}const u=prepareRangeAreaPathAnimation(s,r,this.processedData?.reduced?.diff?.[this.id]);if(u===void 0){d();return}else if(u.status==="no-op")return;fromToMotion(this.id,"fill_path_properties",e,[n],u.fill.pathProperties),fromToMotion(this.id,"low_stroke_path_properties",e,[l],u.stroke.pathProperties),fromToMotion(this.id,"high_stroke_path_properties",e,[c],u.stroke.pathProperties),u.status==="added"?this.updateAreaPaths(a,s):u.status==="removed"?this.updateAreaPaths(a,r):(pathMotion(this.id,"fill_path_update",e,[n],u.fill.path),pathMotion(this.id,"low_stroke_path_update",e,[l],u.stroke.path),pathMotion(this.id,"high_stroke_path_update",e,[c],u.stroke.path)),u.hasMotion&&(markerFadeInAnimation(this,e,void 0,i),seriesLabelFadeInAnimation(this,"labels",e,o)),this.ctx.animationManager.animate({id:this.id,groupId:"reset_after_animation",phase:"trailing",from:{},to:{},onComplete:()=>this.updateAreaPaths(a,s)})}getFormattedMarkerStyle(t){const e=this.getStyle(!1),i=this.makeItemStylerParams(t.itemId);return this.getMarkerStyle(this.properties.item[t.itemId].marker,t,i,{isHighlight:!0,resolveMarkerSubPath:["item",t.itemId,"marker"]},void 0,e)}getMarkerStyle(t,e,i,o,s,a){return t.itemStyler=this.properties.marker.itemStyler,super.getMarkerStyle(t,e,i,o,s,a)}computeFocusBounds(t){const e=computeMarkerFocusBounds(this,t),i=computeMarkerFocusBounds(this,{...t,datumIndex:t.datumIndex+1});if(e&&i)return BBox13.merge([e,i])}isDatumEnabled(t,e){return e%2===0&&super.isDatumEnabled(t,e)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};RangeAreaSeries.className="RangeAreaSeries",RangeAreaSeries.type="range-area";var import_ag_charts_community141=require("ag-charts-community"),import_ag_charts_core62=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs5,rangeAreaSeriesThemeableOptionsDef}=import_ag_charts_community141._ModuleSupport,rangeAreaSeriesOptionsDef={...commonSeriesOptionsDefs5,...rangeAreaSeriesThemeableOptionsDef,type:(0,import_ag_charts_core62.required)((0,import_ag_charts_core62.constant)("range-area")),xKey:(0,import_ag_charts_core62.required)(import_ag_charts_core62.string),yLowKey:(0,import_ag_charts_core62.required)(import_ag_charts_core62.string),yHighKey:(0,import_ag_charts_core62.required)(import_ag_charts_core62.string),xName:import_ag_charts_core62.string,yName:import_ag_charts_core62.string,yLowName:import_ag_charts_core62.string,yHighName:import_ag_charts_core62.string,legendItemName:import_ag_charts_core62.string,segmentation:import_ag_charts_core62.shapeSegmentation,invertedStyle:{enabled:import_ag_charts_core62.boolean,...import_ag_charts_core62.fillOptionsDef}};rangeAreaSeriesOptionsDef.pickOutsideVisibleMinorAxis=(0,import_ag_charts_core62.undocumented)(import_ag_charts_core62.boolean),rangeAreaSeriesOptionsDef.focusPriority=(0,import_ag_charts_core62.undocumented)(import_ag_charts_core62.number);var import_ag_charts_community142=require("ag-charts-community"),RANGE_AREA_ITEM={lineDash:{$path:"/series/$index/lineDash"},lineDashOffset:{$path:"/series/$index/lineDashOffset"},stroke:{$path:["/series/$index/stroke",{$palette:"stroke"}]},strokeOpacity:{$path:"/series/$index/strokeOpacity"},strokeWidth:{$path:["/series/$index/strokeWidth",1]},marker:{enabled:{$path:"/series/$index/marker/enabled"},fill:{$isUserOption:["/series/$index/marker/fill",{$if:[{$or:[{$isGradient:{$path:"/series/$index/marker/fill"}},{$isImage:{$path:"/series/$index/marker/fill"}},{$isPattern:{$path:"/series/$index/marker/fill"}}]},{$merge:[{$path:"/series/$index/marker/fill"},{$applySwitch:[{$path:"type"},void 0,["gradient",import_ag_charts_community142._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",import_ag_charts_community142._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community142._ModuleSupport.FILL_PATTERN_DEFAULTS]]}]},{$isUserOption:["/series/$index/marker/fill",{$path:"/series/$index/marker/fill"},{$palette:"fill"}]}]},{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community142._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",import_ag_charts_community142._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community142._ModuleSupport.FILL_PATTERN_DEFAULTS]]}]},fillOpacity:{$path:"/series/$index/marker/fillOpacity"},lineDash:{$path:"/series/$index/marker/lineDash"},lineDashOffset:{$path:"/series/$index/marker/lineDashOffset"},shape:{$path:"/series/$index/marker/shape"},size:{$path:["/series/$index/marker/size",6]},stroke:{$path:["/series/$index/marker/stroke",{$palette:"stroke"}]},strokeOpacity:{$path:"/series/$index/marker/strokeOpacity"},strokeWidth:{$path:["/series/$index/marker/strokeWidth",2]}}},RANGE_AREA_SERIES_THEME={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community142._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["pattern",import_ag_charts_community142._ModuleSupport.FILL_PATTERN_DEFAULTS]]},fillOpacity:.7,stroke:{$palette:"stroke"},strokeWidth:1,marker:{enabled:!1,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community142._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",import_ag_charts_community142._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community142._ModuleSupport.FILL_PATTERN_DEFAULTS]]},shape:"circle",stroke:{$palette:"stroke"},size:6,strokeWidth:2},nodeClickRange:"nearest",item:{low:RANGE_AREA_ITEM,high:RANGE_AREA_ITEM},label:{...import_ag_charts_community142._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,placement:"outside",padding:{$isUserOption:["./spacing",0,10]},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},interpolation:{type:"linear"},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:import_ag_charts_community142._ModuleSupport.multiSeriesHighlightStyle(),segmentation:import_ag_charts_community142._ModuleSupport.SEGMENTATION_DEFAULTS,invertedStyle:{enabled:!1,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community142._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["image",import_ag_charts_community142._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community142._ModuleSupport.FILL_PATTERN_DEFAULTS]]},fillOpacity:{$path:"../fillOpacity"}}},axes:{[import_ag_charts_community142._ModuleSupport.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{enabled:!0}}}},{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE6,CARTESIAN_POSITION:CARTESIAN_POSITION4}}=import_ag_charts_community143._ModuleSupport,RangeAreaModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"range-area",moduleFactory:t=>new RangeAreaSeries(t),predictAxis:import_ag_charts_community143._ModuleSupport.predictCartesianTimeAxis,defaultAxes:[{type:CARTESIAN_AXIS_TYPE6.NUMBER,position:CARTESIAN_POSITION4.LEFT},{type:CARTESIAN_AXIS_TYPE6.CATEGORY,position:CARTESIAN_POSITION4.BOTTOM}],themeTemplate:RANGE_AREA_SERIES_THEME},RangeAreaSeriesModule={type:"series",name:"range-area",chartType:"cartesian",enterprise:!0,options:rangeAreaSeriesOptionsDef,create:t=>new RangeAreaSeries(t)},import_ag_charts_community149=require("ag-charts-community"),import_ag_charts_community146=require("ag-charts-community"),import_ag_charts_community144=require("ag-charts-community"),{aggregationDomain:aggregationDomain3,aggregationRangeFittingPoints:aggregationRangeFittingPoints3,compactAggregationIndices:compactAggregationIndices3,createAggregationIndices:createAggregationIndices3}=import_ag_charts_community144._ModuleSupport,AGGREGATION_THRESHOLD3=1e3;function aggregateRangeBarData(t,e,i,o,s,a){if(e.length64;)({indexData:c,valueData:h,maxRange:l}=compactAggregationIndices3(c,h,l)),d.push({maxRange:l,indexData:c});return d.reverse(),d}var import_ag_charts_community145=require("ag-charts-community"),{AbstractBarSeriesProperties:AbstractBarSeriesProperties3,makeSeriesTooltip:makeSeriesTooltip6,Property:Property54,DropShadow:DropShadow2,Label:Label3}=import_ag_charts_community145._ModuleSupport,RangeBarSeriesLabel=class extends Label3{constructor(){super(...arguments),this.placement="inside",this.spacing=0}};__decorateClass([Property54],RangeBarSeriesLabel.prototype,"placement",2),__decorateClass([Property54],RangeBarSeriesLabel.prototype,"spacing",2);var RangeBarProperties=class extends AbstractBarSeriesProperties3{constructor(){super(...arguments),this.fill="#99CCFF",this.fillOpacity=1,this.stroke="#99CCFF",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.shadow=new DropShadow2().set({enabled:!1}),this.label=new RangeBarSeriesLabel,this.tooltip=makeSeriesTooltip6()}};__decorateClass([Property54],RangeBarProperties.prototype,"xKey",2),__decorateClass([Property54],RangeBarProperties.prototype,"yLowKey",2),__decorateClass([Property54],RangeBarProperties.prototype,"yHighKey",2),__decorateClass([Property54],RangeBarProperties.prototype,"xName",2),__decorateClass([Property54],RangeBarProperties.prototype,"yName",2),__decorateClass([Property54],RangeBarProperties.prototype,"yLowName",2),__decorateClass([Property54],RangeBarProperties.prototype,"yHighName",2),__decorateClass([Property54],RangeBarProperties.prototype,"fill",2),__decorateClass([Property54],RangeBarProperties.prototype,"fillOpacity",2),__decorateClass([Property54],RangeBarProperties.prototype,"stroke",2),__decorateClass([Property54],RangeBarProperties.prototype,"strokeWidth",2),__decorateClass([Property54],RangeBarProperties.prototype,"strokeOpacity",2),__decorateClass([Property54],RangeBarProperties.prototype,"lineDash",2),__decorateClass([Property54],RangeBarProperties.prototype,"lineDashOffset",2),__decorateClass([Property54],RangeBarProperties.prototype,"cornerRadius",2),__decorateClass([Property54],RangeBarProperties.prototype,"styler",2),__decorateClass([Property54],RangeBarProperties.prototype,"itemStyler",2),__decorateClass([Property54],RangeBarProperties.prototype,"shadow",2),__decorateClass([Property54],RangeBarProperties.prototype,"label",2),__decorateClass([Property54],RangeBarProperties.prototype,"tooltip",2);var{SeriesNodePickMode:SeriesNodePickMode4,valueProperty:valueProperty7,keyProperty:keyProperty5,ChartAxisDirection:ChartAxisDirection17,checkCrisp,updateLabelNode:updateLabelNode3,SMALLEST_KEY_INTERVAL:SMALLEST_KEY_INTERVAL3,LARGEST_KEY_INTERVAL,diff:diff4,prepareBarAnimationFunctions,midpointStartingBarPosition,resetBarSelectionsFn,fixNumericExtent:fixNumericExtent5,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation2,resetLabelFn:resetLabelFn2,animationValidation:animationValidation4,computeBarFocusBounds:computeBarFocusBounds4,visibleRangeIndices:visibleRangeIndices2,createDatumId:createDatumId4,ContinuousScale:ContinuousScale5,Rect:Rect2,PointerEvents:PointerEvents3,motion:motion2,applyShapeStyle:applyShapeStyle5,findMinMax:findMinMax3,areScalingEqual:areScalingEqual2,processedDataIsAnimatable:processedDataIsAnimatable3,AGGREGATION_SPAN:AGGREGATION_SPAN2,AGGREGATION_INDEX_X_MAX:AGGREGATION_INDEX_X_MAX2,AGGREGATION_INDEX_X_MIN:AGGREGATION_INDEX_X_MIN2,AGGREGATION_INDEX_Y_MAX:AGGREGATION_INDEX_Y_MAX3,AGGREGATION_INDEX_Y_MIN:AGGREGATION_INDEX_Y_MIN3,mergeDefaults:mergeDefaults8,simpleMemorize2:simpleMemorize23,getItemStyles:getItemStyles2,calculateSegments:calculateSegments3,toHighlightString:toHighlightString3,HighlightState:HighlightState3}=import_ag_charts_community146._ModuleSupport,memoizedAggregateRangeBarData=simpleMemorize23(aggregateRangeBarData),RangeBarSeriesNodeEvent=class extends import_ag_charts_community146._ModuleSupport.SeriesNodeEvent{constructor(t,e,i,o){super(t,e,i,o),this.xKey=o.properties.xKey,this.yLowKey=o.properties.yLowKey,this.yHighKey=o.properties.yHighKey}},RangeBarSeries=class extends import_ag_charts_community146._ModuleSupport.AbstractBarSeries{constructor(t){super({moduleCtx:t,pickModes:[SeriesNodePickMode4.AXIS_ALIGNED,SeriesNodePickMode4.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["yLowKey","yHighKey"]},propertyNames:{x:["xName"],y:["yLowName","yHighName","yName"]},categoryKey:"xValue",datumSelectionGarbageCollection:!1,animationResetFns:{datum:resetBarSelectionsFn,label:resetLabelFn2}}),this.properties=new RangeBarProperties,this.dataAggregationFilters=void 0,this.NodeEvent=RangeBarSeriesNodeEvent}async processData(t){const{xKey:e,yLowKey:i,yHighKey:o}=this.properties,s=this.getCategoryAxis()?.scale,a=this.getValueAxis()?.scale,{isContinuousX:r,xScaleType:n,yScaleType:l}=this.getScaleInformation({xScale:s,yScale:a}),c=[];this.ctx.animationManager.isSkipped()||(this.processedData&&c.push(diff4(this.id,this.processedData)),c.push(animationValidation4()));const h=this.visible?{}:{forceValue:0},{dataModel:d,processedData:u}=await this.requestDataModel(t,this.data,{props:[keyProperty5(e,n,{id:"xValue"}),valueProperty7(i,l,{id:"yLowValue",invalidValue:null,...h}),valueProperty7(o,l,{id:"yHighValue",invalidValue:null,...h}),...r?[SMALLEST_KEY_INTERVAL3,LARGEST_KEY_INTERVAL]:[],...c],groupByKeys:!1});this.smallestDataInterval=u.reduced?.smallestKeyInterval,this.largestDataInterval=u.reduced?.largestKeyInterval,this.dataAggregationFilters=this.aggregateData(d,u),this.animationState.transition("updateData")}aggregateData(t,e){if(e.type!=="ungrouped"||processedDataIsAnimatable3(e))return;const i=this.axes[ChartAxisDirection17.X];if(i==null)return;const o=t.resolveKeysById(this,"xValue",e),s=t.resolveColumnById(this,"yHighValue",e),a=t.resolveColumnById(this,"yLowValue",e),{index:r}=t.resolveProcessedDataDefById(this,"xValue"),n=e.domain.keys[r];return memoizedAggregateRangeBarData(i.scale.type,o,s,a,n,e.reduced?.smallestKeyInterval)}getSeriesDomain(t){const{processedData:e,dataModel:i}=this;if(!e||!i)return[];const{keys:[o]}=e.domain;if(t===this.getCategoryDirection()){const s=i.resolveProcessedDataDefById(this,"xValue");return s?.def.type==="key"&&s?.def.valueType==="category"?o:this.padBandExtent(o)}else{const s=this.domainForClippedRange(t,["yHighValue","yLowValue"],"xValue"),a=findMinMax3(s);return fixNumericExtent5(a)}}getSeriesRange(t,e){return this.domainForVisibleRange(ChartAxisDirection17.Y,["yHighValue","yLowValue"],"xValue",e)}createNodeData(){const{data:t,dataModel:e,groupScale:i,processedData:o,visible:s}=this,a=this.getCategoryAxis(),r=this.getValueAxis();if(!(t&&a&&r&&e&&o?.dataSources&&this.chart?.seriesRect))return;const n=a.scale,l=r.scale,c=this.getBarDirection()===ChartAxisDirection17.X,{xKey:h,yLowKey:d,yHighKey:u,strokeWidth:p}=this.properties,g=`${d}-${u}`,y=calculateSegments3(this.properties.segmentation,a,r,this.chart.seriesRect,this.ctx.scene),f={itemId:g,nodeData:[],labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:getItemStyles2(this.getItemStyle.bind(this)),segments:y};if(!s)return f;const x=o.dataSources.get(this.id)?.data??[],b=e.resolveKeysById(this,"xValue",o),m=e.resolveColumnById(this,"yLowValue",o),S=e.resolveColumnById(this,"yHighValue",o),{barWidth:v,groupIndex:M}=this.updateGroupScale(a),D=ContinuousScale5.is(n)?v*-.5:0,k=i.convert(String(M)),_=checkCrisp(a?.scale,a?.visibleRange,this.smallestDataInterval,this.largestDataInterval),T=C=>Math.round(n.convert(b[C]))+k+D,w=(C,L,A,P,z,B,V)=>{const W=x[C],H=b[C];if(H==null)return;const G=m[C],K=S[C];if(!Number.isFinite(G?.valueOf())||!Number.isFinite(K?.valueOf()))return;const[U,Y]=GC.maxRange>E);if(I!=null){const{maxRange:C,indexData:L}=I,[A,P]=visibleRangeIndices2(1,C,a.range,z=>{const B=z*AGGREGATION_SPAN2,V=L[B+AGGREGATION_INDEX_X_MIN2],W=L[B+AGGREGATION_INDEX_X_MAX2];if(V===-1)return;const H=Math.trunc((V+W)/2);return[T(H),T(W)+v]});for(let z=A;zthis.getDatumId(s))}getItemStyle(t,e,i){const{properties:o,dataModel:s,processedData:a}=this,{itemStyler:r}=o,n=this.getHighlightStyle(e,t,i);let l=mergeDefaults8(n,this.getStyle(t===void 0,e,i));if(r&&s!=null&&a!=null&&t!=null){const c=s.resolveKeysById(this,"xValue",a)[t],h=this.cachedDatumCallback(createDatumId4(this.getDatumId({xValue:c}),e?"highlight":"node"),()=>{const d=this.makeItemStylerParams(t,e,l);return this.callWithContext(r,d)});h&&(l=mergeDefaults8(h,l))}return l}makeItemStylerParams(t,e,i){const{id:o,properties:s,processedData:a}=this,{xKey:r,yHighKey:n,yLowKey:l}=s,c=a.dataSources.get(o)?.data[t],h=this.ctx.highlightManager?.getActiveHighlight(),d=this.getHighlightStateString(h,e,t),u=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:o,datum:c,xKey:r,yHighKey:n,yLowKey:l,highlighted:e,highlightState:d,...i,fill:u}}updateDatumStyles(t){const e=this.ctx.highlightManager.getActiveHighlight();t.datumSelection.each((i,o)=>{if(!t.datumSelection.isGarbage(i)){const s=this.getHighlightState(e,t.isHighlight,o.datumIndex);o.style=this.getItemStyle(o.datumIndex,t.isHighlight,s)}})}updateDatumNodes({datumSelection:t,isHighlight:e}){const{contextNodeData:i}=this;if(!i)return;const o=this.ctx.highlightManager.getActiveHighlight(),s=this.getCategoryDirection()===ChartAxisDirection17.X,a=this.getShapeFillBBox();t.each((r,n)=>{const l=n.style??i.styles[this.getHighlightState(o,e,n.datumIndex)];applyShapeStyle5(r,l,a),r.cornerRadius=l.cornerRadius??0,r.visible=s?n.width>0:n.height>0,r.crisp=n.crisp})}updateLabelSelection(t){const e=this.properties.label.enabled?t.labelData:[];return t.labelSelection.update(e,i=>{i.pointerEvents=PointerEvents3.None})}updateLabelNodes(t){const e={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yName:this.properties.yName,yLowKey:this.properties.yLowKey,yLowName:this.properties.yLowName??this.properties.yLowKey,yHighKey:this.properties.yHighKey,yHighName:this.properties.yHighName??this.properties.yHighKey,legendItemName:this.properties.legendItemName},i=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((o,s)=>{o.fillOpacity=this.getHighlightStyle(!1,s?.datumIndex).opacity??1,updateLabelNode3(this,o,e,this.properties.label,s,!1,i)})}getTooltipContent(t){const{id:e,dataModel:i,processedData:o,properties:s}=this,{xKey:a,xName:r,yName:n,yLowKey:l,yHighKey:c,yLowName:h,yHighName:d,tooltip:u,legendItemName:p}=s,g=this.getCategoryAxis(),y=this.getValueAxis();if(!i||!o||!g||!y)return;const f=o.dataSources.get(this.id)?.data[t],x=i.resolveKeysById(this,"xValue",o)[t],b=i.resolveColumnById(this,"yHighValue",o)[t],m=i.resolveColumnById(this,"yLowValue",o)[t];if(x==null)return;const S=this.getItemStyle(t,!1),v=`${this.getAxisValueText(y,"tooltip",m,f,l,p)} - ${this.getAxisValueText(y,"tooltip",b,f,c,p)}`;return this.formatTooltipWithContext(u,{heading:this.getAxisValueText(g,"tooltip",x,f,a,p),symbol:this.legendItemSymbol(),data:[{label:n,fallbackLabel:`${h??l} - ${d??c}`,value:v}]},{seriesId:e,datum:f,title:n,xKey:a,xName:r,yName:n,yLowKey:l,yHighKey:c,yLowName:h,yHighName:d,legendItemName:p,...S})}legendItemSymbol(){const{fill:t,stroke:e,strokeWidth:i,fillOpacity:o,strokeOpacity:s,lineDash:a,lineDashOffset:r}=this.getStyle(!1,!1,HighlightState3.None);return{marker:{fill:t,stroke:e,fillOpacity:o,strokeOpacity:s,strokeWidth:i,lineDash:a,lineDashOffset:r}}}getLegendData(t){if(t!=="category")return[];const{id:e,visible:i}=this,{yName:o,yLowName:s,yHighName:a,yLowKey:r,yHighKey:n,legendItemName:l,showInLegend:c}=this.properties,h=l??o??`${s??r} - ${a??n}`,d=`${r}-${n}`;return[{legendType:"category",id:e,itemId:d,seriesId:e,enabled:i,label:{text:`${h}`},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!c}]}animateEmptyUpdateReady({datumSelection:t,labelSelection:e}){const i=prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(),"normal"),"unknown");motion2.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],i),seriesLabelFadeInAnimation2(this,"labels",this.ctx.animationManager,e)}animateWaitingUpdateReady(t){const{datumSelection:e,labelSelection:i,contextData:o,previousContextData:s}=t,a=import_ag_charts_community146._ModuleSupport.calculateDataDiff(this.id,e,this.getDatumId.bind(this),o,s,this.processedData,this.processedDataUpdated);this.ctx.animationManager.stopByAnimationGroupId(this.id);const r=s==null?"fade":"normal",n=prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(),r),"added");motion2.fromToMotion(this.id,"datums",this.ctx.animationManager,[e],n,(l,c)=>this.getDatumId(c),a),(a?.changed||!areScalingEqual2(o.groupScale,s?.groupScale))&&seriesLabelFadeInAnimation2(this,"labels",this.ctx.animationManager,i)}getDatumId(t){return`${t.xValue}`}isLabelEnabled(){return this.properties.label.enabled}onDataChange(){}computeFocusBounds({datumIndex:t}){return computeBarFocusBounds4(this,this.contextNodeData?.nodeData[t])}hasItemStylers(){return this.properties.styler!=null||this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};RangeBarSeries.className="RangeBarSeries",RangeBarSeries.type="range-bar";var import_ag_charts_community147=require("ag-charts-community"),import_ag_charts_core63=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs6,rangeBarSeriesThemeableOptionsDef}=import_ag_charts_community147._ModuleSupport,rangeBarSeriesOptionsDef={...commonSeriesOptionsDefs6,...rangeBarSeriesThemeableOptionsDef,type:(0,import_ag_charts_core63.required)((0,import_ag_charts_core63.constant)("range-bar")),xKey:(0,import_ag_charts_core63.required)(import_ag_charts_core63.string),yLowKey:(0,import_ag_charts_core63.required)(import_ag_charts_core63.string),yHighKey:(0,import_ag_charts_core63.required)(import_ag_charts_core63.string),xName:import_ag_charts_core63.string,yName:import_ag_charts_core63.string,yLowName:import_ag_charts_core63.string,yHighName:import_ag_charts_core63.string,legendItemName:import_ag_charts_core63.string,segmentation:import_ag_charts_core63.shapeSegmentation};rangeBarSeriesOptionsDef.pickOutsideVisibleMinorAxis=(0,import_ag_charts_core63.undocumented)(import_ag_charts_core63.boolean),rangeBarSeriesOptionsDef.focusPriority=(0,import_ag_charts_core63.undocumented)(import_ag_charts_core63.number);var import_ag_charts_community148=require("ag-charts-community"),RANGE_BAR_SERIES_THEME={series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community148._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["image",import_ag_charts_community148._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community148._ModuleSupport.FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{...import_ag_charts_community148._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},placement:"inside",padding:{$isUserOption:["./spacing",0,6]}},highlight:import_ag_charts_community148._ModuleSupport.multiSeriesHighlightStyle(),segmentation:import_ag_charts_community148._ModuleSupport.SEGMENTATION_DEFAULTS},axes:{[import_ag_charts_community148._ModuleSupport.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{enabled:!0}}}},RangeBarModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"range-bar",moduleFactory:t=>new RangeBarSeries(t),predictAxis:import_ag_charts_community149._ModuleSupport.predictCartesianTimeAxis,defaultAxes:import_ag_charts_community149._ModuleSupport.DIRECTION_SWAP_AXES,themeTemplate:RANGE_BAR_SERIES_THEME,groupable:!0},RangeBarSeriesModule={type:"series",name:"range-bar",chartType:"cartesian",enterprise:!0,options:rangeBarSeriesOptionsDef,create:t=>new RangeBarSeries(t)},import_ag_charts_community154=require("ag-charts-community"),import_ag_charts_community151=require("ag-charts-community"),import_ag_charts_community150=require("ag-charts-community"),{AbstractBarSeriesProperties:AbstractBarSeriesProperties4,BaseProperties:BaseProperties19,PropertiesArray:PropertiesArray4,makeSeriesTooltip:makeSeriesTooltip7,Property:Property55,DropShadow:DropShadow3,Label:Label4}=import_ag_charts_community150._ModuleSupport,WaterfallSeriesTotal=class extends BaseProperties19{};__decorateClass([Property55],WaterfallSeriesTotal.prototype,"totalType",2),__decorateClass([Property55],WaterfallSeriesTotal.prototype,"index",2),__decorateClass([Property55],WaterfallSeriesTotal.prototype,"axisLabel",2);var WaterfallSeriesItemTooltip=class extends BaseProperties19{};__decorateClass([Property55],WaterfallSeriesItemTooltip.prototype,"renderer",2);var WaterfallSeriesLabel=class extends Label4{constructor(){super(...arguments),this.placement="outside-end",this.spacing=0}};__decorateClass([Property55],WaterfallSeriesLabel.prototype,"placement",2),__decorateClass([Property55],WaterfallSeriesLabel.prototype,"spacing",2);var WaterfallSeriesItem=class extends BaseProperties19{constructor(){super(...arguments),this.fill="#c16068",this.stroke="#c16068",this.fillOpacity=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.strokeWidth=1,this.cornerRadius=0,this.shadow=new DropShadow3().set({enabled:!1}),this.label=new WaterfallSeriesLabel,this.tooltip=new WaterfallSeriesItemTooltip}};__decorateClass([Property55],WaterfallSeriesItem.prototype,"name",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"fill",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"stroke",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"fillOpacity",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"strokeOpacity",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"lineDash",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"lineDashOffset",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"strokeWidth",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"cornerRadius",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"itemStyler",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"shadow",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"label",2),__decorateClass([Property55],WaterfallSeriesItem.prototype,"tooltip",2);var WaterfallSeriesConnectorLine=class extends BaseProperties19{constructor(){super(...arguments),this.enabled=!0,this.stroke="black",this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.strokeWidth=2}};__decorateClass([Property55],WaterfallSeriesConnectorLine.prototype,"enabled",2),__decorateClass([Property55],WaterfallSeriesConnectorLine.prototype,"stroke",2),__decorateClass([Property55],WaterfallSeriesConnectorLine.prototype,"strokeOpacity",2),__decorateClass([Property55],WaterfallSeriesConnectorLine.prototype,"lineDash",2),__decorateClass([Property55],WaterfallSeriesConnectorLine.prototype,"lineDashOffset",2),__decorateClass([Property55],WaterfallSeriesConnectorLine.prototype,"strokeWidth",2);var WaterfallSeriesItems=class extends BaseProperties19{constructor(){super(...arguments),this.positive=new WaterfallSeriesItem,this.negative=new WaterfallSeriesItem,this.total=new WaterfallSeriesItem}};__decorateClass([Property55],WaterfallSeriesItems.prototype,"positive",2),__decorateClass([Property55],WaterfallSeriesItems.prototype,"negative",2),__decorateClass([Property55],WaterfallSeriesItems.prototype,"total",2);var WaterfallSeriesProperties=class extends AbstractBarSeriesProperties4{constructor(){super(...arguments),this.item=new WaterfallSeriesItems,this.totals=new PropertiesArray4(WaterfallSeriesTotal),this.line=new WaterfallSeriesConnectorLine,this.tooltip=makeSeriesTooltip7()}getStyle(t){const{fillOpacity:e,strokeWidth:i,strokeOpacity:o,fill:s,stroke:a,lineDash:r,lineDashOffset:n,cornerRadius:l}=this.item[t==="subtotal"?"total":t];return{fill:s,fillOpacity:e,stroke:a,strokeWidth:i,strokeOpacity:o,lineDash:r,lineDashOffset:n,cornerRadius:l,opacity:1}}};__decorateClass([Property55],WaterfallSeriesProperties.prototype,"xKey",2),__decorateClass([Property55],WaterfallSeriesProperties.prototype,"yKey",2),__decorateClass([Property55],WaterfallSeriesProperties.prototype,"xName",2),__decorateClass([Property55],WaterfallSeriesProperties.prototype,"yName",2),__decorateClass([Property55],WaterfallSeriesProperties.prototype,"item",2),__decorateClass([Property55],WaterfallSeriesProperties.prototype,"totals",2),__decorateClass([Property55],WaterfallSeriesProperties.prototype,"line",2),__decorateClass([Property55],WaterfallSeriesProperties.prototype,"tooltip",2);var{adjustLabelPlacement,SeriesNodePickMode:SeriesNodePickMode5,fixNumericExtent:fixNumericExtent6,valueProperty:valueProperty8,keyProperty:keyProperty6,accumulativeValueProperty,trailingAccumulatedValueProperty,ChartAxisDirection:ChartAxisDirection18,createDatumId:createDatumId5,checkCrisp:checkCrisp2,updateLabelNode:updateLabelNode4,prepareBarAnimationFunctions:prepareBarAnimationFunctions2,collapsedStartingBarPosition,resetBarSelectionsFn:resetBarSelectionsFn2,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation3,resetLabelFn:resetLabelFn3,animationValidation:animationValidation5,DEFAULT_CARTESIAN_DIRECTION_KEYS:DEFAULT_CARTESIAN_DIRECTION_KEYS2,DEFAULT_CARTESIAN_DIRECTION_NAMES:DEFAULT_CARTESIAN_DIRECTION_NAMES2,computeBarFocusBounds:computeBarFocusBounds5,isContinuous,Rect:Rect3,motion:motion3,applyShapeStyle:applyShapeStyle6,mergeDefaults:mergeDefaults9,getItemStylesPerItemId:getItemStylesPerItemId2,DataSet}=import_ag_charts_community151._ModuleSupport,WaterfallSeries=class extends import_ag_charts_community151._ModuleSupport.AbstractBarSeries{constructor(t){super({moduleCtx:t,propertyKeys:DEFAULT_CARTESIAN_DIRECTION_KEYS2,propertyNames:DEFAULT_CARTESIAN_DIRECTION_NAMES2,categoryKey:void 0,pickModes:[SeriesNodePickMode5.NEAREST_NODE,SeriesNodePickMode5.EXACT_SHAPE_MATCH],pathsPerSeries:["connector"],pathsZIndexSubOrderOffset:[-1,-1],animationResetFns:{datum:resetBarSelectionsFn2,label:resetLabelFn3}}),this.properties=new WaterfallSeriesProperties,this.seriesItemTypes=new Set(["positive","negative","total"])}async processData(t){const{xKey:e,yKey:i,totals:o}=this.properties,{data:s}=this;if(!this.visible)return;const a=b=>isContinuous(b)&&Number(b)>=0,r=b=>isContinuous(b)&&Number(b)>=0,n=b=>b==="total"||b==="subtotal",l={missingValue:void 0,invalidValue:void 0},c=[],h=o.reduce((b,m)=>{const S=b.get(m.index);return S?S.push(m):b.set(m.index,[m]),b},new Map);for(const[b,m]of s?.data.entries()??[]){c.push(m);const S=h.get(b);if(S)for(const v of S)c.push({...v.toJson(),[e]:v.axisLabel})}const d=[];this.ctx.animationManager.isSkipped()||d.push(animationValidation5());const u=this.getCategoryAxis()?.scale,p=this.getValueAxis()?.scale,{isContinuousX:g,xScaleType:y,yScaleType:f}=this.getScaleInformation({xScale:u,yScale:p}),{processedData:x}=await this.requestDataModel(t,DataSet.wrap(c),{props:[keyProperty6(e,y,{id:"xValue"}),accumulativeValueProperty(i,f,{...l,id:"yCurrent"}),accumulativeValueProperty(i,f,{...l,missingValue:0,id:"yCurrentTotal"}),accumulativeValueProperty(i,f,{...l,id:"yCurrentPositive",validation:a}),accumulativeValueProperty(i,f,{...l,id:"yCurrentNegative",validation:r}),trailingAccumulatedValueProperty(i,f,{...l,id:"yPrevious"}),valueProperty8(i,f,{id:"yRaw"}),valueProperty8("totalType","category",{id:"totalTypeValue",missingValue:void 0,validation:n}),...g?[import_ag_charts_community151._ModuleSupport.SMALLEST_KEY_INTERVAL,import_ag_charts_community151._ModuleSupport.LARGEST_KEY_INTERVAL]:[],...d]});this.smallestDataInterval=x.reduced?.smallestKeyInterval,this.largestDataInterval=x.reduced?.largestKeyInterval,this.updateSeriesItemTypes(),this.animationState.transition("updateData")}getSeriesDomain(t){const{processedData:e,dataModel:i}=this;if(!e||!i)return[];const{keys:[o],values:s}=e.domain;if(t===this.getCategoryDirection()){const a=i.resolveProcessedDataDefById(this,"xValue");if(a?.def.type==="key"&&a?.def.valueType==="category")return o;const r=t===ChartAxisDirection18.Y,n=this.getCategoryAxis().isReversed();return this.padBandExtent(o,n!==r)}else{const a=i.resolveProcessedDataIndexById(this,"yCurrent"),r=s[a],n=[Math.min(0,r[0]),Math.max(0,r[1])];return fixNumericExtent6(n)}}getSeriesRange(t,e){return[Number.NaN,Number.NaN]}createNodeData(){const{data:t,dataModel:e,processedData:i}=this,o=this.getCategoryAxis(),s=this.getValueAxis();if(!t||!o||!s||!e||!i)return;const{line:a}=this.properties,r=o.scale,n=s.scale,l=this.getBarDirection()===ChartAxisDirection18.X,c=this.getBandwidth(o)??10,h=o.isReversed(),d=s.isReversed();if(i.type!=="ungrouped")return;const u={itemId:this.properties.yKey,nodeData:[],labelData:[],pointData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:getItemStylesPerItemId2(this.getItemStyle.bind(this),"total","subtotal","positive","negative")};if(!this.visible)return u;const p=[],g=e.resolveKeysById(this,"xValue",i),y=e.resolveColumnById(this,"yRaw",i),f=e.resolveColumnById(this,"totalTypeValue",i),x=e.resolveColumnById(this,"yCurrent",i),b=e.resolveColumnById(this,"yPrevious",i),m=e.resolveColumnById(this,"yCurrentTotal",i),S=this.getSeriesDomain(ChartAxisDirection18.Y),v=checkCrisp2(o?.scale,o?.visibleRange,this.smallestDataInterval,this.largestDataInterval);function M(E,I,C){return E||I?{cumulativeValue:m[C],trailingValue:I?k:0}:{cumulativeValue:x[C],trailingValue:b[C]}}function D(E,I,C,L,A){return E?L:I?(L??0)-(A??0):C}let k=0;const{xKey:_,yKey:T,xName:w,yName:R}=this.properties,F=i.dataSources.get(this.id)?.data??[];for(const[E,I]of F.entries()){const C=f[E],L=this.isSubtotal(C),A=this.isTotal(C),P=A||L,z=g[E];if(z==null)continue;const B=Math.round(r.convert(z)),V=y[E],{cumulativeValue:W,trailingValue:H}=M(A,L,E);P&&(k=W??0);const G=Math.round(n.convert(W)),K=Math.round(n.convert(H)),U=D(A,L,V,W,H),Y=(U??0)>=0,$=this.getSeriesItemType(Y,C),{strokeWidth:X,label:Z}=this.getItemConfig($),q=Y?G:K,it=Y?K:G,J=Math.max(X,Math.abs(it-q)),j={x:l?Math.min(q,it):B,y:l?B:Math.min(q,it),width:l?J:c,height:l?c:J},tt={x:j.x+j.width/2,y:j.y+j.height/2},Q=P?G:K,ot=Math.floor(a.strokeWidth)%2/2,et=h?G:Q,st=h?Q:G;let rt,lt;l?(rt={x:et+ot,y:j.y},lt={x:st+ot,y:j.y+j.height}):(rt={x:j.x,y:et+ot},lt={x:j.x+j.width,y:st+ot});const dt={x:h?lt.x:rt.x,y:h?lt.y:rt.y,x2:h?rt.x:lt.x,y2:h?rt.y:lt.y,size:0};p.push(dt);const ct=$==="subtotal"?"total":$,ht=this.getLabelText(U,I,T,"y",S,Z,{itemId:ct,value:U,datum:I,xKey:_,yKey:T,xName:w,yName:R}),ut=Z.spacing+(typeof Z.padding=="number"?Z.padding:0),pt={index:E,series:this,itemId:$,datum:I,datumIndex:E,cumulativeValue:W??0,xValue:z,yValue:U,yKey:T,xKey:_,x:j.x,y:j.y,width:j.width,height:j.height,midPoint:tt,crisp:v,label:{text:ht,...adjustLabelPlacement({isUpward:(U??-1)>=0!==d,isVertical:!l,placement:Z.placement,spacing:ut,rect:j})}};u.nodeData.push(pt),u.labelData.push(pt)}const O=this.properties.line.enabled;return x!=null&&O&&(u.pointData=p),u}updateSeriesItemTypes(){const{dataModel:t,seriesItemTypes:e,processedData:i}=this;if(!t||!i)return;e.clear();const o=t.resolveProcessedDataIndexById(this,"yCurrentPositive"),s=t.resolveProcessedDataIndexById(this,"yCurrentNegative"),a=t.resolveProcessedDataIndexById(this,"totalTypeValue"),r=i.domain.values[o]??[],n=i.domain.values[s]??[];r.length>0&&e.add("positive"),n.length>0&&e.add("negative");const l=i?.domain.values[a];if(l)for(const c of l)(c==="total"||c==="subtotal")&&e.add("total")}isSubtotal(t){return t==="subtotal"}isTotal(t){return t==="total"}nodeFactory(){return new Rect3}getSeriesItemType(t,e){return e??(t?"positive":"negative")}getItemConfig(t){switch(t){case"positive":return this.properties.item.positive;case"negative":return this.properties.item.negative;case"subtotal":case"total":return this.properties.item.total}}updateDatumSelection(t){const{nodeData:e,datumSelection:i}=t,o=e??[];return i.update(o)}getItemStyle(t,e,i,o="total"){const{properties:s}=this,{datumIndex:a=0,datum:r}=t??{},n=o==="subtotal"?"total":o,l=s.item[n],c=this.getHighlightStyle(e,a,i),h=mergeDefaults9(c,s.getStyle(o)),{itemStyler:d}=l;let u=h;if(d!=null&&t!=null){const p=this.cachedDatumCallback(createDatumId5(a,e?"highlight":"node"),()=>{const g=this.makeItemStylerParams(o,a,r,e,u);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`,"item",n],this.callWithContext(d,g))});p&&(u=mergeDefaults9(p,u))}return u}makeItemStylerParams(t,e,i,o,s){const{id:a,properties:r}=this,{xKey:n,yKey:l}=r,c=this.ctx.highlightManager?.getActiveHighlight(),h=this.getHighlightStateString(c,o,e),d=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:a,itemId:t,datum:i,xKey:n,yKey:l,highlighted:o,highlightState:h,...s,fill:d}}updateDatumStyles({datumSelection:t,isHighlight:e}){t.each((i,o)=>{o.style=this.getItemStyle(o,e,void 0,o.itemId)})}updateDatumNodes({datumSelection:t,isHighlight:e}){const{contextNodeData:i}=this;if(!i)return;const o=this.ctx.highlightManager.getActiveHighlight(),s=this.getCategoryDirection()===ChartAxisDirection18.X,a=this.getShapeFillBBox();t.each((r,n)=>{const l=n.style??i.styles[n.itemId][this.getHighlightState(o,e,n.datumIndex)];applyShapeStyle6(r,l,a),r.cornerRadius=l.cornerRadius??0,r.visible=s?n.width>0:n.height>0,r.crisp=n.crisp})}updateLabelSelection(t){const{labelData:e,labelSelection:i}=t;if(e.length===0)return i.update([]);const o=e.filter(s=>{const{label:a}=this.getItemConfig(s.itemId);return a.enabled});return i.update(o)}updateLabelNodes(t){const e={itemId:"positive",xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xName,yKey:this.properties.yKey,yName:this.properties.yName??this.properties.yName},i=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((o,s)=>{e.itemId=s.itemId,o.fillOpacity=this.getHighlightStyle(!1,s.datumIndex)?.opacity??1;const a=this.getItemConfig(s.itemId).label;updateLabelNode4(this,o,e,a,s.label,!1,i)})}getTooltipContent(t){const{id:e,dataModel:i,processedData:o,properties:s}=this,{xKey:a,xName:r,yKey:n,yName:l,tooltip:c,legendItemName:h}=s,d=this.getCategoryAxis(),u=this.getValueAxis();if(!i||!o||!d||!u)return;const p=o.dataSources.get(this.id)?.data[t],g=i.resolveKeysById(this,"xValue",o)[t],y=i.resolveColumnById(this,"yRaw",o)[t],f=i.resolveColumnById(this,"yCurrentTotal",o),x=i.resolveColumnById(this,"totalTypeValue",o);if(g==null)return;const b=x[t],m=(y??0)>=0,S=this.getSeriesItemType(m,b);let v;if(this.isTotal(b))v=f[t];else if(this.isSubtotal(b)){v=f[t];for(let k=t-1;k>=0;k-=1)if(this.isSubtotal(x[k])){v=v-f[k];break}}else v=y;const M=this.contextNodeData?.nodeData?.[t],D=this.getItemStyle(M,!1,void 0,M?.itemId);return this.formatTooltipWithContext(c,{heading:this.getAxisValueText(d,"tooltip",g,p,a,h),symbol:this.legendItemSymbol(S),data:[{label:l,fallbackLabel:n,value:this.getAxisValueText(u,"tooltip",v,p,n,h)}]},{seriesId:e,datum:p,title:l,itemId:S,xKey:a,xName:r,yKey:n,yName:l,...D})}legendItemSymbol(t){const{fill:e,stroke:i,fillOpacity:o,strokeOpacity:s,strokeWidth:a,lineDash:r,lineDashOffset:n}=this.getItemConfig(t);return{marker:{fill:e,stroke:i,fillOpacity:o,strokeOpacity:s,strokeWidth:a,lineDash:r,lineDashOffset:n}}}getLegendData(t){if(t!=="category")return[];const{id:e,seriesItemTypes:i}=this,o=[],s=r=>r.charAt(0).toUpperCase()+r.substring(1),{showInLegend:a}=this.properties;for(const r of i){const{name:n}=this.getItemConfig(r);o.push({legendType:"category",id:e,itemId:r,seriesId:e,enabled:!0,label:{text:n??s(r)},symbol:this.legendItemSymbol(r),hideInLegend:!a,isFixed:!0})}return o}toggleSeriesItem(){}animateEmptyUpdateReady(t){const{datumSelection:e,labelSelection:i,contextData:o}=t,s=prepareBarAnimationFunctions2(collapsedStartingBarPosition(this.isVertical(),this.axes,"normal"),"unknown");motion3.fromToMotion(this.id,"datums",this.ctx.animationManager,[e],s),seriesLabelFadeInAnimation3(this,"labels",this.ctx.animationManager,i);const{pointData:a}=o;a&&(this.isVertical()?this.animateConnectorLinesVertical(t):this.animateConnectorLinesHorizontal(t))}animateConnectorLinesHorizontal(t){const{pointData:e=[]}=t.contextData,[i]=t.paths,{path:o}=i;this.updateLineNode(i);const s=this.getValueAxis(),a=s?.isReversed(),r=a?(h,d)=>hh>d,n=s?.scale.convert(0),l=e.reduce((h,d)=>(r(d.x,h)&&(h=d.x),h),a?1/0:0),c=(h,d,u,p,g)=>(h-d)/(u-d)*(g-p)+p;this.ctx.animationManager.animate({id:`${this.id}_connectors`,groupId:this.id,phase:"initial",from:n,to:l,ease:import_ag_charts_community151._ModuleSupport.Motion.easeOut,collapsable:!1,onUpdate(h){o.clear(!0);for(const[d,u]of e.entries()){const p=c(h,n,l,n,u.x),g=c(h,n,l,n,u.x2);d!==0&&o.lineTo(p,u.y),o.moveTo(g,u.y2)}i.checkPathDirty()},onStop:()=>this.resetConnectorLinesPath(t)})}animateConnectorLinesVertical(t){const{pointData:e=[]}=t.contextData,[i]=t.paths,{path:o}=i;this.updateLineNode(i);const s=this.getValueAxis(),a=s?.isReversed(),r=a?(h,d)=>h>d:(h,d)=>h(r(d.y,h)&&(h=d.y),h),a?0:1/0),c=(h,d,u,p,g)=>(h-d)/(u-d)*(g-p)+p;this.ctx.animationManager.animate({id:`${this.id}_connectors`,groupId:this.id,phase:"initial",from:n,to:l,ease:import_ag_charts_community151._ModuleSupport.Motion.easeOut,collapsable:!1,onUpdate(h){o.clear(!0);for(const[d,u]of e.entries()){const p=c(h,n,l,n,u.y),g=c(h,n,l,n,u.y2);d!==0&&o.lineTo(u.x,p),o.moveTo(u.x2,g)}i.checkPathDirty()},onStop:()=>this.resetConnectorLinesPath(t)})}animateReadyResize(t){super.animateReadyResize(t),this.resetConnectorLinesPath(t)}updatePaths(t){this.resetConnectorLinesPath({contextData:t.contextData,paths:t.paths})}resetConnectorLinesPath({contextData:t,paths:e}){if(e.length===0)return;const[i]=e;this.updateLineNode(i);const{path:o}=i;o.clear(!0);const{pointData:s}=t;if(s){for(const[a,r]of s.entries())a!==0&&o.lineTo(r.x,r.y),o.moveTo(r.x2,r.y2);i.checkPathDirty()}}updateLineNode(t){const{stroke:e,strokeWidth:i,strokeOpacity:o,lineDash:s,lineDashOffset:a}=this.properties.line;t.setProperties({fill:void 0,stroke:e,strokeWidth:i,strokeOpacity:o,lineDash:s,lineDashOffset:a,lineJoin:"round",pointerEvents:import_ag_charts_community151._ModuleSupport.PointerEvents.None})}isLabelEnabled(){const{positive:t,negative:e,total:i}=this.properties.item;return t.label.enabled||e.label.enabled||i.label.enabled}onDataChange(){}computeFocusBounds({datumIndex:t}){return computeBarFocusBounds5(this,this.contextNodeData?.nodeData[t])}hasItemStylers(){const{positive:t,negative:e,total:i}=this.properties.item;return t.itemStyler!=null||t.label.itemStyler!=null||e.itemStyler!=null||e.label.itemStyler!=null||i.itemStyler!=null||i.label.itemStyler!=null}};WaterfallSeries.className="WaterfallSeries",WaterfallSeries.type="waterfall";var import_ag_charts_community152=require("ag-charts-community"),import_ag_charts_core64=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs7,waterfallSeriesThemeableOptionsDef}=import_ag_charts_community152._ModuleSupport,waterfallSeriesOptionsDef={...waterfallSeriesThemeableOptionsDef,...commonSeriesOptionsDefs7,type:(0,import_ag_charts_core64.required)((0,import_ag_charts_core64.constant)("waterfall")),xKey:(0,import_ag_charts_core64.required)(import_ag_charts_core64.string),yKey:(0,import_ag_charts_core64.required)(import_ag_charts_core64.string),xName:import_ag_charts_core64.string,yName:import_ag_charts_core64.string,totals:(0,import_ag_charts_core64.arrayOfDefs)({totalType:(0,import_ag_charts_core64.required)((0,import_ag_charts_core64.union)("total","subtotal")),index:(0,import_ag_charts_core64.required)(import_ag_charts_core64.positiveNumber),axisLabel:(0,import_ag_charts_core64.required)(import_ag_charts_core64.string)},"a total definition options array")},import_ag_charts_community153=require("ag-charts-community"),{FILL_GRADIENT_LINEAR_KEYED_DEFAULTS:FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2,FILL_IMAGE_DEFAULTS:FILL_IMAGE_DEFAULTS3,FILL_PATTERN_KEYED_DEFAULTS:FILL_PATTERN_KEYED_DEFAULTS2}=import_ag_charts_community153._ModuleSupport;function itemTheme2(t,e){return{fill:{$applySwitch:[{$path:"type"},{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$path:[`/${e}`,{$palette:"fill"},{$palette:"fills"}]},{$palette:`${t}.fill`}]},["gradient",FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2(t)],["image",FILL_IMAGE_DEFAULTS3],["pattern",FILL_PATTERN_KEYED_DEFAULTS2(t)]]},stroke:{$palette:`${t}.stroke`},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{...import_ag_charts_community153._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},formatter:void 0,placement:"outside-end",padding:{$isUserOption:["./spacing",0,6]}}}}var WATERFALL_SERIES_THEME={series:{item:{positive:itemTheme2("altUp",0),negative:itemTheme2("altDown",1),total:itemTheme2("neutral",2)},line:{stroke:{$palette:"neutral.stroke"},strokeOpacity:1,lineDash:[0],lineDashOffset:0,strokeWidth:2},highlight:import_ag_charts_community153._ModuleSupport.singleSeriesHighlightStyle()},legend:{enabled:!0,toggleSeries:!1}},WaterfallModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"waterfall",solo:!0,moduleFactory:t=>new WaterfallSeries(t),defaultAxes:import_ag_charts_community154._ModuleSupport.DIRECTION_SWAP_AXES,themeTemplate:WATERFALL_SERIES_THEME},WaterfallSeriesModule={type:"series",name:"waterfall",chartType:"cartesian",enterprise:!0,options:waterfallSeriesOptionsDef,create:t=>new WaterfallSeries(t)},{NewAreaSeriesModule,NewBarSeriesModule,NewBubbleSeriesModule,NewHistogramSeriesModule,NewLineSeriesModule,NewScatterSeriesModule,numberFormatValidator,textOrSegments,without:without2}=import_ag_charts_community155._ModuleSupport,navigatorHandleOptionsDef={width:import_ag_charts_core65.positiveNumber,height:import_ag_charts_core65.positiveNumber,grip:import_ag_charts_core65.boolean,fill:import_ag_charts_core65.color,stroke:import_ag_charts_core65.color,strokeWidth:import_ag_charts_core65.positiveNumber,cornerRadius:import_ag_charts_core65.positiveNumber},commonIgnoredMiniChartProperties=["cursor","highlightStyle","listeners","nodeClickRange","showInLegend","showInMiniChart","tooltip","visible","xName","yName"],barIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"errorBar","label","legendItemName","direction"],boxPlotIngnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"direction","legendItemName","minName","q1Name","medianName","q3Name","maxName"],bubbleIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"title","label","labelKey","labelName","sizeName"],heatmapIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"title","label","colorName","textAlign","verticalAlign","itemPadding","colorRange"],histogramIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"label"],lineIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"errorBar","title","label"],rangeAreaIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"label","yLowName","yHighName"],rangeBarIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"direction","label","yLowName","yHighName"],scatterIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"errorBar","title","label","labelKey","labelName"],waterfallIgnoredMiniChartProperties=[...commonIgnoredMiniChartProperties,"direction"],navigatorOptionsDef={enabled:import_ag_charts_core65.boolean,height:import_ag_charts_core65.positiveNumber,spacing:import_ag_charts_core65.positiveNumber,cornerRadius:import_ag_charts_core65.number,mask:{fill:import_ag_charts_core65.color,fillOpacity:import_ag_charts_core65.ratio,stroke:import_ag_charts_core65.color,strokeWidth:import_ag_charts_core65.positiveNumber},minHandle:navigatorHandleOptionsDef,maxHandle:navigatorHandleOptionsDef,miniChart:{enabled:import_ag_charts_core65.boolean,padding:{top:import_ag_charts_core65.positiveNumber,bottom:import_ag_charts_core65.positiveNumber},label:{enabled:import_ag_charts_core65.boolean,avoidCollisions:import_ag_charts_core65.boolean,spacing:import_ag_charts_core65.positiveNumber,format:numberFormatValidator,formatter:(0,import_ag_charts_core65.callbackOf)(textOrSegments),interval:{minSpacing:import_ag_charts_core65.positiveNumber,maxSpacing:import_ag_charts_core65.positiveNumber,values:import_ag_charts_core65.array,step:import_ag_charts_core65.number},...import_ag_charts_core65.fontOptionsDef},series:(0,import_ag_charts_core65.arrayOfDefs)((0,import_ag_charts_core65.typeUnion)({area:without2(NewAreaSeriesModule.options,[...commonIgnoredMiniChartProperties,"type"]),bar:without2(NewBarSeriesModule.options,[...barIgnoredMiniChartProperties,"type"]),"box-plot":without2(BoxPlotSeriesModule.options,[...boxPlotIngnoredMiniChartProperties,"type"]),bubble:without2(NewBubbleSeriesModule.options,[...bubbleIgnoredMiniChartProperties,"type"]),candlestick:without2(CandlestickSeriesModule.options,[...commonIgnoredMiniChartProperties,"type"]),heatmap:without2(HeatmapSeriesModule.options,[...heatmapIgnoredMiniChartProperties,"type"]),histogram:without2(NewHistogramSeriesModule.options,[...histogramIgnoredMiniChartProperties,"type"]),line:without2(NewLineSeriesModule.options,[...lineIgnoredMiniChartProperties,"type"]),ohlc:without2(OhlcSeriesModule.options,[...commonIgnoredMiniChartProperties,"type"]),"range-area":without2(RangeAreaSeriesModule.options,[...rangeAreaIgnoredMiniChartProperties,"type"]),"range-bar":without2(RangeBarSeriesModule.options,[...rangeBarIgnoredMiniChartProperties,"type"]),scatter:without2(NewScatterSeriesModule.options,[...scatterIgnoredMiniChartProperties,"type"]),waterfall:without2(WaterfallSeriesModule.options,[...waterfallIgnoredMiniChartProperties,"type"])},"miniChart series options"))}},validMiniChartSeriesTypes=["area","bar","bubble","candlestick","heatmap","histogram","line","ohlc","range-area","range-bar","scatter","waterfall"],priceVolumePresetIgnoredMiniChartProperties=["itemStyler","direction","fill","fillGradientDefaults","fillPatternDefaults","fillImageDefaults","fillOpacity","shadow","focusPriority","highlight","lineDash","lineDashOffset","strokeWidth"];function miniChartSeriesTheme(t,e){return{$merge:[{$switch:[e,{},[["area","line","range-area"],{marker:{enabled:{$isUserOption:["/series/$index/marker/enabled",{$path:["/series/$index/marker/enabled",!1]},!1]}}}]]},{$omit:[{$switch:[e,commonIgnoredMiniChartProperties,["bar",barIgnoredMiniChartProperties],["box-plot",boxPlotIngnoredMiniChartProperties],["bubble",bubbleIgnoredMiniChartProperties],["heatmap",heatmapIgnoredMiniChartProperties],["histogram",histogramIgnoredMiniChartProperties],["line",[...lineIgnoredMiniChartProperties,...priceVolumePresetIgnoredMiniChartProperties]],["range-area",rangeAreaIgnoredMiniChartProperties],["range-bar",rangeBarIgnoredMiniChartProperties],["scatter",scatterIgnoredMiniChartProperties],["waterfall",waterfallIgnoredMiniChartProperties]]},t]}]}}var NAVIGATOR_THEME={enabled:!1,height:{$if:[{$path:"./miniChart/enabled"},40,18]},cornerRadius:4,mask:{fill:{$ref:"foregroundColor"},fillOpacity:.1,stroke:{$ref:"borderColor"},strokeWidth:1},minHandle:{fill:{$ref:"chartBackgroundColor"},stroke:{$ref:"borderColor"},strokeWidth:1,width:12,height:24,cornerRadius:4},maxHandle:{fill:{$ref:"chartBackgroundColor"},stroke:{$ref:"borderColor"},strokeWidth:1,width:12,height:24,cornerRadius:4},miniChart:{enabled:!1,label:{color:{$ref:"textColor"},fontSize:{$rem:import_ag_charts_community156._ModuleSupport.FONT_SIZE_RATIO.SMALLER},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},spacing:5},padding:{top:0,bottom:0},series:{$apply:[miniChartSeriesTheme({$path:"/series/$index"},{$path:["/navigator/miniChart/series/$index/type",{$path:["type",{$path:"/series/$index/type"}]}]}),{$if:[{$or:validMiniChartSeriesTypes.map(t=>({$eq:[{$path:"/series/0/type"},t]}))},{$map:[miniChartSeriesTheme({$value:"$1"},{$path:"/series/$index/type"}),{$path:"/series"}]},void 0]}]}}},NavigatorModule={type:"root",optionsKey:"navigator",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:t=>new Navigator(t),removable:!1,themeTemplate:{navigator:NAVIGATOR_THEME}},import_ag_charts_community158=require("ag-charts-community"),import_ag_charts_community157=require("ag-charts-community"),{ToolbarButtonProperties:ToolbarButtonProperties3,Property:Property56}=import_ag_charts_community157._ModuleSupport,RangesButtonProperties=class extends ToolbarButtonProperties3{};__decorateClass([Property56],RangesButtonProperties.prototype,"value",2);var{ChartAxisDirection:ChartAxisDirection19,LayoutElement:LayoutElement3,PropertiesArray:PropertiesArray5,Toolbar,Property:Property57}=import_ag_charts_community158._ModuleSupport,Ranges=class extends import_ag_charts_community158._ModuleSupport.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.enabled=!1,this.buttons=new PropertiesArray5(RangesButtonProperties),this.verticalSpacing=10,this.container=t.domManager.addChild("canvas-overlay","range-buttons"),this.container.role="presentation",this.toolbar=new Toolbar(this.ctx,"ariaLabelRangesToolbar","horizontal"),this.toolbar.addClass("ag-charts-range-buttons"),this.container.append(this.toolbar.getElement()),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onButtonPress.bind(this)),t.layoutManager.registerElement(LayoutElement3.ToolbarBottom,this.onLayoutStart.bind(this)),t.eventsHub.on("zoom:change",this.onZoomChanged.bind(this)),this.teardown.bind(this))}teardown(){this.toolbar.getElement().remove(),this.toolbar.destroy()}onLayoutStart(t){const{buttons:e,ctx:i,enabled:o,toolbar:s,verticalSpacing:a}=this,{layoutBox:r}=t;if(!o||!i.zoomManager.isZoomEnabled()){s.setHidden(!0);return}s.setHidden(!1),s.updateButtons(e);const n=s.getBounds().height;s.setBounds({x:r.x,y:r.y+r.height-n,width:r.width,height:n}),r.shrink({bottom:n+a})}onZoomChanged(){this.toolbar.clearActiveButton()}onButtonPress({button:{index:t}}){const{zoomManager:e}=this.ctx,i=this.buttons.at(t);if(!i)return;const{value:o}=i;o==null?e.resetZoom("zoom-buttons"):typeof o=="number"?e.extendToEnd("zoom-buttons",ChartAxisDirection19.X,o):Array.isArray(o)?e.updateWith("zoom-buttons",ChartAxisDirection19.X,()=>o):typeof o=="function"&&e.updateWith("zoom-buttons",ChartAxisDirection19.X,o),this.toolbar.toggleActiveButtonByIndex(t)}};__decorateClass([Property57],Ranges.prototype,"enabled",2),__decorateClass([Property57],Ranges.prototype,"buttons",2);var DAY=1e3*60*60*24,MONTH=DAY*30,YEAR=DAY*365,RangesModule={type:"root",optionsKey:"ranges",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:t=>new Ranges(t),themeTemplate:{ranges:{enabled:!1,buttons:{$shallowSimple:[{label:"toolbarRange1Month",ariaLabel:"toolbarRange1MonthAria",value:MONTH},{label:"toolbarRange3Months",ariaLabel:"toolbarRange3MonthsAria",value:3*MONTH},{label:"toolbarRange6Months",ariaLabel:"toolbarRange6MonthsAria",value:6*MONTH},{label:"toolbarRangeYearToDate",ariaLabel:"toolbarRangeYearToDateAria",value:(t,e)=>[new Date(`${new Date(e).getFullYear()}-01-01`).getTime(),void 0]},{label:"toolbarRange1Year",ariaLabel:"toolbarRange1YearAria",value:YEAR},{label:"toolbarRangeAll",ariaLabel:"toolbarRangeAllAria",value:void 0}]}}}},import_ag_charts_community159=require("ag-charts-community"),_SharedToolbar=class mt extends import_ag_charts_community159._ModuleSupport.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.activeSections=new Set,this.sectionButtons={annotations:[],chartToolbar:[]},this.container=this.ctx.domManager.addChild("canvas-overlay","shared-toolbar"),this.container.role="presentation"}getSharedToolbar(e){return this.sharedToolbar||this.createSharedToolbar(),e==="chartToolbar"&&this.sharedToolbar&&this.sharedToolbar.setAriaLabelId("ariaLabelFinancialCharts"),this.toolbarWithSection(e)}createSharedToolbar(){this.sharedToolbar=new import_ag_charts_community159._ModuleSupport.Toolbar(this.ctx,"ariaLabelAnnotationsToolbar","vertical"),this.sharedToolbar.addClass("ag-charts-shared-toolbar"),this.container.append(this.sharedToolbar.getElement()),this.cleanup.register(()=>{this.sharedToolbar&&(this.sharedToolbar.getElement().remove(),this.sharedToolbar.destroy(),this.sharedToolbar=void 0)})}toolbarWithSection(e){const i=this.sharedToolbar,o={layout:(s,a)=>{if(this.firstLayoutSection!=null&&this.firstLayoutSection!==e&&this.activeSections.has(this.firstLayoutSection))return;this.firstLayoutSection=e;const r=i.getBounds().width;i.setBounds({x:s.x,y:s.y,width:r}),s.shrink({left:r+i.horizontalSpacing+(a??0)})},addToolbarListener:(s,a)=>i.addToolbarListener(s,r=>{const n=this.getSectionIndex(e,r.button.index);if(n<0)return;const l={...r,button:this.sectionButtons[e][n]};a(l)}),updateButtons:s=>{this.sectionButtons[e]=s;const a=mt.SECTION_ORDER.flatMap(r=>this.sectionButtons[r]);i.updateButtons(a)},updateButtonByIndex:(s,a)=>{i.updateButtonByIndex(this.getIndex(e,s),a)},toggleActiveButtonByIndex:s=>{i.toggleActiveButtonByIndex(this.getIndex(e,s))},toggleButtonEnabledByIndex:(s,a)=>{i.toggleButtonEnabledByIndex(this.getIndex(e,s),a)},setHidden:s=>{s?this.activeSections.delete(e):this.activeSections.add(e);let a=0;for(const r of mt.SECTION_ORDER){if(r!==e){a+=this.sectionButtons[r].length;continue}for(const n of this.sectionButtons[e].keys())i.setButtonHiddenByIndex(a+n,s)}},destroy:()=>{o.setHidden(!0),this.activeSections.size===0&&this.destroy()},clearActiveButton:i.clearActiveButton.bind(i),addListener:i.addListener.bind(i),removeListener:i.removeListener.bind(i)};return o.setHidden(!1),o}getIndex(e,i){let o=0;for(const s of mt.SECTION_ORDER){if(s===e)return o+i;o+=this.sectionButtons[s].length}return-1}getSectionIndex(e,i){let o=0;for(const s of mt.SECTION_ORDER){if(s===e)return i>=o+this.sectionButtons[e].length?-1:i-o;o+=this.sectionButtons[s].length}return-1}};_SharedToolbar.SECTION_ORDER=["chartToolbar","annotations"];var SharedToolbar=_SharedToolbar,SharedToolbarModule={type:"context",contextKey:"sharedToolbar",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:t=>new SharedToolbar(t)},import_ag_charts_community161=require("ag-charts-community"),import_ag_charts_community160=require("ag-charts-community"),import_ag_charts_core66=require("ag-charts-core"),{ZIndexMap:ZIndexMap8,LayoutElement:LayoutElement4,Property:Property58,BaseProperties:BaseProperties20,valueProperty:valueProperty9,Group:Group7,Label:Label5,Rect:Rect4,Text}=import_ag_charts_community160._ModuleSupport,chartConfigurations={ohlc:62,candlestick:62,"hollow-candlestick":62,line:96,"step-line":96,hlc:184,"high-low":800},itemIdMap={up:"positive",down:"negative"},neutralColorMap={hlc:"altNeutral"},StatusBarBackground=class extends BaseProperties20{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1}};__decorateClass([Property58],StatusBarBackground.prototype,"fill",2),__decorateClass([Property58],StatusBarBackground.prototype,"fillOpacity",2);var StatusBar=class extends import_ag_charts_community160._ModuleSupport.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.enabled=!1,this.openKey=void 0,this.highKey=void 0,this.lowKey=void 0,this.closeKey=void 0,this.volumeKey=void 0,this.title=new Label5,this.positive=new Label5,this.negative=new Label5,this.neutral=new Label5,this.altNeutral=new Label5,this.background=new StatusBarBackground,this.layoutStyle="block",this.id="status-bar",this.data=void 0,this.layer=new Group7({name:"StatusBar",zIndex:ZIndexMap8.STATUS_BAR}),this.labelGroup=this.layer.appendChild(new import_ag_charts_community160._ModuleSupport.TranslatableGroup),this.backgroundNode=this.labelGroup.appendChild(new Rect4),this.labels=[{label:"O",configuration:2,title:this.labelGroup.appendChild(new Text),value:this.labelGroup.appendChild(new Text),id:"openValue",key:"openKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"H",configuration:16,title:this.labelGroup.appendChild(new Text),value:this.labelGroup.appendChild(new Text),id:"highValue",key:"highKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"H",configuration:256,title:this.labelGroup.appendChild(new Text),value:this.labelGroup.appendChild(new Text),style:"neutral",id:"highValue",key:"highKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"L",configuration:8,title:this.labelGroup.appendChild(new Text),value:this.labelGroup.appendChild(new Text),id:"lowValue",key:"lowKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"L",configuration:512,title:this.labelGroup.appendChild(new Text),value:this.labelGroup.appendChild(new Text),style:"neutral",id:"lowValue",key:"lowKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"C",configuration:4,title:this.labelGroup.appendChild(new Text),value:this.labelGroup.appendChild(new Text),id:"closeValue",key:"closeKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"C",configuration:128,title:this.labelGroup.appendChild(new Text),value:this.labelGroup.appendChild(new Text),id:"closeValue",key:"closeKey",style:"neutral",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"",configuration:64,title:this.labelGroup.appendChild(new Text),value:this.labelGroup.appendChild(new Text),style:"neutral",id:"closeValue",key:"closeKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:2,maximumFractionDigits:2})},{label:"Vol",configuration:32,title:this.labelGroup.appendChild(new Text),value:this.labelGroup.appendChild(new Text),id:"volumeValue",key:"volumeKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:2,maximumFractionDigits:2})}],this.highlightManager=t.highlightManager,this.labelGroup.visible=!1,this.cleanup.register(t.scene.attachNode(this.layer),t.layoutManager.registerElement(LayoutElement4.Overlay,e=>this.startPerformLayout(e)),t.eventsHub.on("layout:complete",e=>this.onLayoutComplete(e)),t.eventsHub.on("highlight:change",()=>this.updateHighlight()))}async processData(t){if(!this.enabled||this.data==null)return;const e=[];for(const a of this.labels){const{id:r,key:n}=a,l=this[n];l==null?a.domain=void 0:e.push(valueProperty9(l,"number",{id:r}))}if(e.length===0)return;const i=import_ag_charts_community160._ModuleSupport.DataSet.wrap(this.data)??import_ag_charts_community160._ModuleSupport.DataSet.empty(),{processedData:o,dataModel:s}=await t.request(this.id,i,{props:e});for(const a of this.labels){const{id:r,key:n}=a;this[n]!=null&&(a.domain=s.getDomain(this,r,"value",o))}}startPerformLayout(t){if(this.labelGroup.translationX=0,this.labelGroup.translationY=0,!this.enabled)return;const{layoutBox:e}=t,i=4,o=12,s=0,a=8;this.labelGroup.translationY=e.y+s;const r=Math.max(this.title.fontSize,this.positive.fontSize,this.negative.fontSize),n=(0,import_ag_charts_core66.calcLineHeight)(r),l=chartConfigurations[this.getChartType()]??0;let c=0,h,d="alphabetic";if(this.layoutStyle==="block")e.shrink(s+n+a,"top"),h=r+(n-r)/2;else{const{title:u}=this.ctx.chartService;if(d="top",h=s+u.padding,u.enabled){const p=u.node.getBBox();c=p.x+p.width+o}else c=u.padding}for(const{label:u,configuration:p,title:g,value:y,domain:f,formatter:x}of this.labels){if(f==null||!(l&p)){g.visible=!1,y.visible=!1;continue}const b=(0,import_ag_charts_core66.cachedTextMeasurer)(this.positive),m=(0,import_ag_charts_core66.cachedTextMeasurer)(this.negative),S=Math.max(b.textWidth(x.format(f[0])),b.textWidth(x.format(f[1])),m.textWidth(x.format(f[0])),m.textWidth(x.format(f[1])));g.visible=!0,y.visible=!0;const v=(0,import_ag_charts_core66.cachedTextMeasurer)(this.title).measureLines(u);g.setFont(this.title),g.fill=this.title.color,g.text=u,g.textBaseline=d,g.y=h,g.x=c,c+=v.width+i,y.textBaseline=d,y.y=h,y.x=c,c+=S+o}this.backgroundNode.x=0,this.backgroundNode.y=0,this.backgroundNode.width=c-o,this.backgroundNode.height=n+s+a,this.backgroundNode.fill=this.background.fill,this.backgroundNode.fillOpacity=this.background.fillOpacity}onLayoutComplete(t){this.labelGroup.translationX=t.series.rect.x,this.updateHighlight()}updateHighlight(){if(!this.enabled)return;const t=this.highlightManager.getActiveHighlight(),e=t?.datum??this.data?.at(-1);if(e==null){this.labelGroup.visible=!1;return}this.labelGroup.visible=!0;const i=t?.itemId;let o=i==null?void 0:itemIdMap[i];o==null&&this.openKey!=null&&this.closeKey!=null&&(e[this.openKey]new StatusBar(t),themeTemplate:{statusBar:{enabled:!1,layoutStyle:import_ag_charts_community161._ModuleSupport.ThemeSymbols.DEFAULT_CAPTION_LAYOUT_STYLE,title:{color:{$ref:"textColor"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},positive:{color:{$palette:"up.stroke"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},negative:{color:{$palette:"down.stroke"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},neutral:{color:{$palette:"neutral.stroke"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},background:{fill:{$ref:"chartBackgroundColor"},fillOpacity:.5},altNeutral:{color:"gray",fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}}}}},import_ag_charts_community162=require("ag-charts-community"),import_ag_charts_core68=require("ag-charts-core"),import_ag_charts_core67=require("ag-charts-core"),UNIT_MIN=0,UNIT_MAX=1,UNIT_SIZE=UNIT_MAX-UNIT_MIN,DEFAULT_ANCHOR_POINT_X="end",DEFAULT_ANCHOR_POINT_Y="middle",ZOOM_VALID_CHECK_DEBOUNCE=300,constrain=(t,e=UNIT_MIN,i=UNIT_MAX)=>(0,import_ag_charts_core67.clamp)(e,t,i);function unitZoomState(){return{x:{min:UNIT_MIN,max:UNIT_MAX},y:{min:UNIT_MIN,max:UNIT_MAX}}}function dx(t){return t.x.max-t.x.min}function dy(t){return t.y.max-t.y.min}function isZoomRangeEqual(t,e){return(0,import_ag_charts_core67.isNumberEqual)(t.min,e.min)&&(0,import_ag_charts_core67.isNumberEqual)(t.max,e.max)}function isZoomEqual(t,e){return isZoomRangeEqual(t.x,e.x)&&isZoomRangeEqual(t.y,e.y)}function isMaxZoom(t){return isZoomEqual(t,unitZoomState())}function definedZoomState(t){return{x:{min:t?.x?.min??UNIT_MIN,max:t?.x?.max??UNIT_MAX},y:{min:t?.y?.min??UNIT_MIN,max:t?.y?.max??UNIT_MAX}}}function pointToRatio(t,e,i){if(!t)return{x:0,y:0};const o=constrain(e-t.x,0,t.x+t.width),s=constrain(i-t.y,0,t.y+t.height),a=1/t.width*o,r=1-1/t.height*s;return{x:constrain(a),y:constrain(r)}}function translateZoom(t,e,i){return{x:{min:t.x.min+e,max:t.x.max+e},y:{min:t.y.min+i,max:t.y.max+i}}}function scaleZoom(t,e,i){return{x:{min:t.x.min,max:t.x.min+dx(t)*e},y:{min:t.y.min,max:t.y.min+dy(t)*i}}}function scaleZoomCenter(t,e,i){const o=dx(t),s=dy(t),a=t.x.min+o/2,r=t.y.min+s/2;return{x:{min:a-o*e/2,max:a+o*e/2},y:{min:r-s*i/2,max:r+s*i/2}}}function scaleZoomAxisWithAnchor(t,e,i,o){const{min:s,max:a}=e,r=s+(a-s)/2,n=t.max-t.min;switch(i){case"start":return{min:s,max:e.min+n};case"end":return{min:e.max-n,max:a};case"middle":return{min:r-n/2,max:r+n/2};case"pointer":return scaleZoomAxisWithPoint(t,e,o??r);default:return{min:s,max:a}}}function scaleZoomAxisWithPoint(t,e,i){const o=t.max-t.min,s=e.max-e.min,a=i*(1-(s-o)),r=i-a,n=t.min+r,l=t.max+r;return{min:n,max:l}}function multiplyZoom(t,e,i){return{x:{min:t.x.min*e,max:t.x.max*e},y:{min:t.y.min*i,max:t.y.max*i}}}function constrainZoom(t){return{x:constrainAxis(t.x),y:constrainAxis(t.y)}}function constrainAxis(t){const e=t.max-t.min;let i=t.max>UNIT_MAX?UNIT_MAX-e:t.min,o=t.mino?.valueOf()),i.map(o=>o?.valueOf())):!(0,import_ag_charts_core68.arraysEqual)(e,i)}var ChartSync=class extends BaseProperties21{constructor(t){super(),this.moduleContext=t,this.enabled=!1,this.axes="x",this.nodeInteraction=!0,this.zoom=!0,this.domainMode="key",this.domainSync=new import_ag_charts_core68.AsyncAwaitQueue}updateSiblings(t){const{syncManager:e}=this.moduleContext;for(const i of e.getGroupSiblings(t??this.groupId))debug("ChartSync.updateSiblings()",i.id,i),this.updateChart(i)}updateChart(t,e=ChartUpdateType2.PROCESS_DOMAIN){debug("ChartSync.updateChart()",t.id,ChartUpdateType2[e],t),e===ChartUpdateType2.PROCESS_DOMAIN?t.ctx.updateService.update(e,{forceNodeDataRefresh:!0}):t.ctx.updateService.update(e)}enabledZoomSync(){const{eventsHub:t}=this.moduleContext;this.disableZoomSync?.(),this.disableZoomSync=t.on("zoom:change",this.onZoom.bind(this))}onZoom(){const{syncManager:t}=this.moduleContext;for(const e of t.getGroupSiblings(this.groupId)){if(!e.modulesManager.getModule("sync")?.zoom)continue;const i=e.modulesManager.getModule("zoom");if(!i)continue;const o=this.prepareZoomUpdate();debug("ChartsSyncManager.enabledZoomSync()",e.id,o),i.updateSyncZoom(o)}}enabledNodeInteractionSync(){this.disableNodeInteractionSync?.(),this.disableNodeInteractionSync=this.moduleContext.eventsHub.on("highlight:change",this.onHighlightChange.bind(this))}onHighlightChange(t){const{syncManager:e}=this.moduleContext;if(t.callerId.endsWith("-sync"))return;debug("ChartSync.onHighlightChange()",t);const i=t.currentHighlight?.series,[o]=syncedDirections(this.axes),s=o===ChartAxisDirection20.X?ChartAxisDirection20.Y:ChartAxisDirection20.X,[a,r]=i?getDirectionKeys(i,o,s):[],n=readDatum(t.currentHighlight);let l=a?.[0]?n?.[a[0]]:void 0,c=!1;if((0,import_ag_charts_core68.isDate)(l)&&(c=!0,l=l.getTime()),!t.currentHighlight?.datum){for(const d of e.getGroupSiblings(this.groupId))d.modulesManager.getModule("sync")?.nodeInteraction&&(d.ctx.highlightManager.updateHighlight(`${d.id}-sync`),d.ctx.tooltipManager.removeTooltip(`${d.id}-sync`));return}const h=e.getGroupSyncMode(this.groupId)==="multi-series";this.findMatchingHighlightNodes(o,s,h?r:[],c,l,t)}findMatchingHighlightNodes(t,e,i,o,s,a){const{syncManager:r}=this.moduleContext;debug("ChartSync.findMatchingHighlightNodes()",{mainDirection:t,secondaryKeys:i});for(const n of r.getGroupSiblings(this.groupId)){if(!n.modulesManager.getModule("sync")?.nodeInteraction)continue;let l=!1;for(const c of n.axes){if(!CartesianAxis.is(c)||c.direction!==t)continue;const h=n.series.filter(d=>{if(!d.visible)return!1;if(i.length>0){const[,u]=getDirectionKeys(d,t,e);return i.every(p=>u.includes(p))}return!0}).map(this.findMatchingNodes(c,t,o,s)).filter(import_ag_charts_core68.isDefined);if(h.length===1&&h[0]?.nodeDatum!==n.ctx.highlightManager.getActiveHighlight()){this.dispatchHighlightUpdate(n,h[0].nodeDatum),l=!0;break}}l||(debug("ChartSync.findMatchingHighlightNodes() - no matching nodes",n.id,a),this.dispatchHighlightUpdate(n))}}findMatchingNodes(t,e,i,o){return s=>{const a=s.getKeys(t.direction);if(t.keys.length&&!t.keys.some(d=>a.includes(d)))return;const r=s.contextNodeData?.nodeData??[];if(!r?.length)return;const n=r[0],l=`${e}Key`;if(!isObjectWithStringProperty(n,l))return;const c=n[l],h=r.find(d=>{const u=d.datum[c];return i?u.getTime()===o:u===o});return h?{series:s,nodeDatum:h}:null}}dispatchHighlightUpdate(t,e){debug("ChartSync.dispatchHighlightUpdate()",t.id,e),t.ctx.highlightManager.updateHighlight(`${t.id}-sync`,e);const i=e?.series.tooltipEnabled??t.tooltip.enabled;if(e&&i){const o=t.seriesAreaBoundingBox,s=o.x+(e.midPoint?.x??e.point?.x??0),a=o.y+(e.midPoint?.y??e.point?.y??0),r=TooltipManager.makeTooltipMeta({type:"pointermove",canvasX:s,canvasY:a},e.series,e,void 0);t.ctx.tooltipManager.updateTooltip(`${t.id}-sync`,r,t.getTooltipContent(e.series,e.datumIndex,e,"tooltip"))}else t.ctx.tooltipManager.removeTooltip(`${t.id}-sync`);this.updateChart(t,ChartUpdateType2.SERIES_UPDATE)}async getSyncedDomain(t){if(!CartesianAxis.is(t)||this.axes!=="xy"&&this.axes!==t.direction)return;const{groupState:e,directionDomains:i,domainsByKey:o,positionDomains:s}=this.updateDomainState(t);return this.validateAxis(t,e),await this.waitForDomainsToBeReady(),this.domainMode==="position"?this.calculateDerivedDomain(t,s):this.domainMode==="direction"||t.keys.length===0?this.calculateDerivedDomain(t,i):this.calculateKeyDerivedDomain(t,o)}updateDomainState(t){var e,i,o,s,a;const{syncManager:r}=this.moduleContext,n=r.getChart().id,l=t.id,c=r.getGroupState(this.groupId);if(!c)throw new Error("AG Charts - no GroupState for groupId: "+this.groupId);const h=c.domains??(c.domains={}),d=h[e=t.direction]??(h[e]={derived:[],sources:{},dirty:!0}),u=(i=d.sources)[n]??(i[n]={});u[l]=t.dataDomain.domain,d.dirty=!0;const p=c.domainsByKey??(c.domainsByKey={});for(const x of t.keys??[]){const b=p[x]??(p[x]={derived:[],sources:{},dirty:!0}),m=(o=b.sources)[n]??(o[n]={});m[l]=t.dataDomain.domain,b.dirty=!0}const g=c.domainsByPosition??(c.domainsByPosition={}),y=g[s=t.position]??(g[s]={derived:[],sources:{},dirty:!0}),f=(a=y.sources)[n]??(a[n]={});return f[l]=t.dataDomain.domain,y.dirty=!0,{groupState:c,directionDomains:d,domainsByKey:p,positionDomains:y}}validateAxis(t,e){const i=this.moduleContext.syncManager.getGroupSyncMode(this.groupId)==="multi-series";syncedDirections(this.axes).includes(t.direction)&&(i?this.validateMultiSeries(t,e):this.validateSingleSeries(t,e))}validateMultiSeries(t,e){const{min:i,max:o,nice:s,reverse:a}=t,r=new Set(t.boundSeries.flatMap(n=>n.getKeys(t.direction)));for(const n of e.members){const{axes:l,modulesManager:c}=n,h=syncedDirections(c.getModule("sync")?.axes),d=l.filter(p=>h.includes(p.direction)).filter(p=>p.boundSeries.some(g=>g.getKeys(p.direction).some(y=>r.has(y))));if(d.length===0)continue;const[u]=d;if(u.min!==i||u.max!==o||u.nice!==s||u.reverse!==a){import_ag_charts_core68.Logger.warnOnce("To allow synchronization, ensure that all synchronized axes with matching keys have matching min, max, nice, and reverse properties."),this.enabled=!1;return}}}validateSingleSeries(t,e){const i=e.members,[{axes:o}]=i,{direction:s,min:a,max:r,nice:n,reverse:l}=t;for(const c of o)if(s===c.direction&&(n!==c.nice||l!==c.reverse||a!==c.min&&((0,import_ag_charts_core68.isFiniteNumber)(a)||(0,import_ag_charts_core68.isFiniteNumber)(c.min))||r!==c.max&&((0,import_ag_charts_core68.isFiniteNumber)(r)||(0,import_ag_charts_core68.isFiniteNumber)(c.max)))){import_ag_charts_core68.Logger.warnOnce("To allow synchronization, ensure that all charts have matching min, max, nice, and reverse properties on the synchronized axes."),this.enabled=!1;return}}calculateDerivedDomain(t,e){if(!e.dirty)return e.derived;const i=e.derived;return e.derived=(0,import_ag_charts_core68.unique)(Object.values(e.sources).map(o=>Object.values(o)).flat(2)),ContinuousScale6.is(t.scale)&&(e.derived=findMinMax4(e.derived)),e.dirty=!1,domainChanged(t.scale,i,e.derived)&&(debug(t.id,"updated",t.keys,{before:i,after:e.derived}),this.updateSiblings()),e.derived}calculateKeyDerivedDomain(t,e){let i=[],o=[],s=!1;for(const a of t.keys??[]){const r=e[a],n=r.derived;if(i.push(...n),!r.dirty){o.push(...r.derived);continue}r.derived=(0,import_ag_charts_core68.unique)(Object.values(r.sources).map(l=>Object.values(l)).flat(2)),ContinuousScale6.is(t.scale)&&(r.derived=findMinMax4(r.derived)),o.push(...r.derived),r.dirty=!1,s||(s=!(0,import_ag_charts_core68.arraysEqual)(n,r.derived))}return ContinuousScale6.is(t.scale)&&(i=findMinMax4(i),o=findMinMax4(o)),s&&domainChanged(t.scale,i,o)&&(debug(t.id,"updated",t.keys,{before:i,after:o}),this.updateSiblings()),o}removeAxis(t){if(!CartesianAxis.is(t)||this.axes!=="xy"&&this.axes!==t.direction)return;const{syncManager:e}=this.moduleContext,i=e.getGroupState(this.groupId),o=e.getChart().id,s=t.id;delete i?.domains?.[t.direction]?.sources?.[o]?.[s];for(const a of t.keys??[])delete i?.domainsByKey?.[a]?.sources?.[o]?.[s];delete i?.domainsByPosition?.[t.position]?.sources?.[o]?.[s]}async waitForDomainsToBeReady(){const{syncManager:t}=this.moduleContext;let e=0;for(;t.getGroupMembers(this.groupId).some(i=>i.syncStatus==="init");)debug("ChartSync.waitForDomainsToBeReady() - waiting for all domains to be calculated",this.groupId),await this.domainSync.await(),e++;e>0&&debug("ChartSync.waitForDomainsToBeReady() - waited for",e,"iterations"),this.domainSync.notify()}prepareZoomUpdate(){const{zoomManager:t}=this.moduleContext,e=t.getZoom();return this.axes==="x"?delete e?.y:this.axes==="y"&&delete e?.x,definedZoomState(e)}onEnabledChange(){const{syncManager:t}=this.moduleContext;this.enabled?t.subscribe(this.groupId):t.unsubscribe(this.groupId),this.updateSiblings(),this.onNodeInteractionChange(),this.onZoomChange()}onGroupIdChange(t,e){if(!this.enabled||t===e)return;const{syncManager:i}=this.moduleContext;i.unsubscribe(e),i.subscribe(t),this.updateSiblings(e),this.updateSiblings(t)}onAxesChange(){if(!this.enabled)return;const{syncManager:t}=this.moduleContext;this.updateChart(t.getChart())}onNodeInteractionChange(){this.enabled&&this.nodeInteraction?this.enabledNodeInteractionSync():this.disableNodeInteractionSync?.()}onZoomChange(){this.enabled&&this.zoom?this.enabledZoomSync():this.disableZoomSync?.()}destroy(){const{syncManager:t}=this.moduleContext;t.unsubscribe(this.groupId),this.updateSiblings(),this.disableZoomSync?.()}};ChartSync.className="Sync",__decorateClass([Property59,ObserveChanges4(t=>t.onEnabledChange())],ChartSync.prototype,"enabled",2),__decorateClass([Property59,ObserveChanges4((t,e,i)=>t.onGroupIdChange(e,i))],ChartSync.prototype,"groupId",2),__decorateClass([Property59,ObserveChanges4(t=>t.onAxesChange())],ChartSync.prototype,"axes",2),__decorateClass([Property59,ObserveChanges4(t=>t.onNodeInteractionChange())],ChartSync.prototype,"nodeInteraction",2),__decorateClass([Property59,ObserveChanges4(t=>t.onZoomChange())],ChartSync.prototype,"zoom",2),__decorateClass([Property59,ObserveChanges4(t=>t.onAxesChange())],ChartSync.prototype,"domainMode",2);var SyncModule={type:"root",optionsKey:"sync",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:t=>new ChartSync(t),themeTemplate:{sync:{enabled:!1}}},import_ag_charts_community170=require("ag-charts-community"),import_ag_charts_core74=require("ag-charts-core"),import_ag_charts_community163=require("ag-charts-community"),{Property:Property60}=import_ag_charts_community163._ModuleSupport,VALID_COLOR="#2196f3",INVALID_COLOR="#8a8a8a",ZoomRect=class extends import_ag_charts_community163._ModuleSupport.Rect{constructor(){super(...arguments),this.fill=VALID_COLOR,this.fillOpacity=.2,this.zIndex=import_ag_charts_community163._ModuleSupport.ZIndexMap.ZOOM_SELECTION}updateValid(){this.fill=VALID_COLOR}updateInvalid(){this.fill=INVALID_COLOR}};ZoomRect.className="ZoomRect",__decorateClass([Property60],ZoomRect.prototype,"fill",2),__decorateClass([Property60],ZoomRect.prototype,"fillOpacity",2);var import_ag_charts_community164=require("ag-charts-community"),ZoomAxisDragger=class{update(t,e,i,o,s,a){return this.oldZoom??(this.oldZoom=definedZoomState(e===import_ag_charts_community164._ModuleSupport.ChartAxisDirection.X?{...s,x:a}:{...s,y:a})),this.updateCoords(t.offsetX,t.offsetY),this.updateZoom(e,i,o)}stop(){this.coords=void 0,this.oldZoom=void 0}updateCoords(t,e){this.coords?(this.coords.x2=t,this.coords.y2=e):this.coords={x1:t,y1:e,x2:t,y2:e}}updateZoom(t,e,i){const{coords:o,oldZoom:s}=this;let a=definedZoomState(s);if(!o||!s)return t===import_ag_charts_community164._ModuleSupport.ChartAxisDirection.X?a.x:a.y;const r=pointToRatio(i,o.x1,o.y1),n=pointToRatio(i,o.x2,o.y2);if(t===import_ag_charts_community164._ModuleSupport.ChartAxisDirection.X){const c=(n.x-r.x)*dx(s);return a.x.max+=c,a.x=scaleZoomAxisWithAnchor(a.x,s.x,e,r.x),a=constrainZoom(a),a.x}const l=(n.y-r.y)*dy(s);return a.y.max-=l,a.y=scaleZoomAxisWithAnchor(a.y,s.y,e,r.y),a=constrainZoom(a),a.y}},ZoomContextMenu=class{constructor(t,e,i,o,s,a,r,n){this.eventsHub=t,this.contextMenuRegistry=e,this.zoomManager=i,this.getModuleProperties=o,this.canResetZoom=s,this.getRect=a,this.updateZoom=r,this.isZoomValid=n}registerActions(t){const{contextMenuRegistry:e}=this,i=t?"show":"hide";if(e.toggle("zoom-to-cursor",i),e.toggle("pan-to-cursor",i),e.toggle("reset-zoom",i),!t)return;e.builtins.items["zoom-to-cursor"].action=this.onZoomToHere.bind(this),e.builtins.items["pan-to-cursor"].action=this.onPanToHere.bind(this),e.builtins.items["reset-zoom"].action=this.onResetZoom.bind(this);const o=r=>{const n=this.getRect();if(!n)return!0;const l=pointToRatio(n,r.x,r.y);return this.iterateFindNextZoomAtPoint(l)!=null},s=()=>!isZoomEqual(definedZoomState(this.zoomManager.getZoom()),unitZoomState()),a=this.eventsHub.on("context-menu:setup",r=>{e.builtins.items["zoom-to-cursor"].enabled=o(r),e.builtins.items["pan-to-cursor"].enabled=s(),e.builtins.items["reset-zoom"].enabled=this.canResetZoom()});return()=>{a(),e.toggle("zoom-to-cursor","hide"),e.toggle("pan-to-cursor","hide"),e.toggle("reset-zoom","hide")}}computeOrigin(t){const e=this.getRect(),{enabled:i}=this.getModuleProperties();if(!i||!e||!t?.target||!(t instanceof MouseEvent))return;const o={x:0,y:0,width:e.width,height:e.height};return pointToRatio(o,t.offsetX,t.offsetY)}onZoomToHere({event:t}){const e=this.computeOrigin(t);if(!e)return;const i=this.iterateFindNextZoomAtPoint(e);i!=null&&this.updateZoom(i)}onPanToHere({event:t}){const e=this.computeOrigin(t);if(!e)return;const i=definedZoomState(this.zoomManager.getZoom()),o=dx(i),s=dy(i),a=e.x*o,r=e.y*s,n=UNIT_SIZE/2;let l={x:{min:e.x-n,max:e.x+n},y:{min:e.y-n,max:e.y+n}};l=scaleZoomCenter(l,o,s),l=translateZoom(l,i.x.min-e.x+a,i.y.min-e.y+r),this.updateZoom(constrainZoom(l))}onResetZoom(t){this.zoomManager.resetZoom("zoom")}iterateFindNextZoomAtPoint(t){const{scrollingStep:e}=this.getModuleProperties();for(let i=e;i<=1-e;i+=e){const o=this.getNextZoomAtPoint(t,i);if(this.isZoomValid(o))return o}}getNextZoomAtPoint(t,e){const{isScalingX:i,isScalingY:o}=this.getModuleProperties(),s=definedZoomState(this.zoomManager.getZoom()),a=t.x*dx(s),r=t.y*dy(s),n=UNIT_SIZE/2;let l={x:{min:t.x-n,max:t.x+n},y:{min:t.y-n,max:t.y+n}};return l=scaleZoomCenter(l,i?dx(s)*e:UNIT_SIZE,o?dy(s)*e:UNIT_SIZE),l=translateZoom(l,s.x.min-t.x+a,s.y.min-t.y+r),constrainZoom(l)}},import_ag_charts_community165=require("ag-charts-community"),import_ag_charts_core69=require("ag-charts-core"),{ChartAxisDirection:ChartAxisDirection21}=import_ag_charts_community165._ModuleSupport,ZoomDOMProxy=class{constructor(t){this.axesHandlers=t,this.axes=[],this.overlappingAxisIds=new Set}destroy(){for(const t of this.axes)t.div.destroy()}update(t,e,i,o){this.seriesRect=o;for(const c of this.axes)c.div.setHidden(!t&&!e);if(!t&&!e)return;const{X:s,Y:a}=ChartAxisDirection21,r=[...i.axisManager.getAxisContext(s),...i.axisManager.getAxisContext(a)],{removed:n,added:l}=this.diffAxisIds(r);n.length>0&&(this.axes=this.axes.filter(c=>n.includes(c.axisId)?(c.div.destroy(),this.overlappingAxisIds.delete(c.axisId),this.hoveredAxisId===c.axisId&&(this.hoveredAxisId=void 0),this.activeAxisId===c.axisId&&(this.activeAxisId=void 0),!1):!0));for(const c of l){const{axisId:h,direction:d}=c;this.axes.push(this.initAxis(i,h,this.axesHandlers,d))}for(const c of this.axes){const d=r.find(u=>u.axisId===c.axisId).getCanvasBounds();c.div.setHidden((0,import_ag_charts_core69.boxEmpty)(d)),d==null?c.bounds=void 0:(c.div.setBounds(d),c.bounds=new import_ag_charts_community165._ModuleSupport.BBox(d.x,d.y,d.width,d.height))}this.updateOverlappingAxisPointerEvents(t,e)}setAxisCursor(t){this.cursor=t;for(const e of this.axes)e.div.setCursor(this.getCursor(e.direction))}toggleAxisDraggingCursor(t,e){for(const i of this.axes)i.direction===t&&i.div.setCursor(e?this.getCursor(t):void 0)}updateOverlappingAxisPointerEvents(t,e){this.overlappingAxisIds.clear();const i=(t||e)&&this.seriesRect;for(const o of this.axes){if(!i){o.div.setPointerEvents(void 0);continue}!!o.bounds?.collidesBBox(this.seriesRect)?(this.overlappingAxisIds.add(o.axisId),o.div.setPointerEvents("none")):o.div.setPointerEvents(void 0)}this.cleanupAxisState()}cleanupAxisState(){this.hoveredAxisId&&!this.overlappingAxisIds.has(this.hoveredAxisId)&&(this.hoveredAxisId=void 0),this.activeAxisId&&!this.overlappingAxisIds.has(this.activeAxisId)&&(this.activeAxisId=void 0)}pickAxisAtPoint(t,e){for(const i of this.axes)if(this.overlappingAxisIds.has(i.axisId)&&i.bounds?.containsPoint(t,e))return{axisId:i.axisId,direction:i.direction}}setHoveredAxis(t){this.overlappingAxisIds.has(t)&&(this.hoveredAxisId=t)}clearHoveredAxis(){this.activeAxisId||(this.hoveredAxisId=void 0)}beginDelegatedAxisDrag(t){return this.overlappingAxisIds.has(t)?(this.activeAxisId=t,this.hoveredAxisId=void 0,!0):!1}endDelegatedAxisDrag(t){this.activeAxisId===t&&(this.activeAxisId=void 0),this.hoveredAxisId=void 0}hasOverlappingAxes(){return this.overlappingAxisIds.size>0}getHoveredAxis(){if(!this.hoveredAxisId)return;const t=this.axes.find(e=>e.axisId===this.hoveredAxisId);return t?{axisId:t.axisId,direction:t.direction}:void 0}getCursor(t){return this.cursor?this.cursor:t===ChartAxisDirection21.X?"ew-resize":"ns-resize"}initAxis(t,e,i,o){const s="afterend",a=t.proxyInteractionService.createProxyElement({type:"region",domManagerId:e,where:s});return a.setCursor(this.getCursor(o)),a.addListener("drag-start",r=>{r.device==="touch"&&r.sourceEvent.preventDefault(),this.activeAxisId=e,i.onAxisDragStart(o)}),a.addListener("drag-move",r=>i.onAxisDragMove(e,o,r)),a.addListener("drag-end",()=>{this.activeAxisId=void 0,this.hoveredAxisId=void 0,i.onAxisDragEnd()}),a.addListener("dblclick",()=>i.onAxisDoubleClick(e,o)),a.addListener("wheel",r=>i.onAxisWheel(e,o,r)),{axisId:e,div:a,direction:o}}diffAxisIds(t){const e=this.axes.map(a=>a.axisId),i=t.map(a=>a.axisId),o=e.filter(a=>!i.includes(a)),s=t.filter(a=>!e.includes(a.axisId));return{removed:o,added:s}}},import_ag_charts_community166=require("ag-charts-community"),import_ag_charts_core70=require("ag-charts-core"),maxZoomCoords=16,decelerationValues={off:1,short:.01,long:.002},ZoomPanner=class{constructor(){this.deceleration=1,this.zoomCoordsHistoryIndex=0,this.coordsHistory=[]}get decelerationValue(){const{deceleration:t}=this;return Math.max(typeof t=="number"?t:decelerationValues[t]??1,1e-4)}addListener(t,e){return this.onUpdate=e,()=>{this.onUpdate=void 0}}stopInteractions(){this.inertiaHandle!=null&&(cancelAnimationFrame(this.inertiaHandle),this.inertiaHandle=void 0)}update(t){this.updateCoords(t.currentX,t.currentY);const{x1:e=0,y1:i=0,x2:o=0,y2:s=0}=this.coords??{};this.onUpdate?.({type:"update",deltaX:this.isPanningX()?e-o:0,deltaY:this.isPanningY()?i-s:0})}start(t){this.direction=t,this.coordsMonitorTimeout=setInterval(this.recordCurrentZoomCoords.bind(this),16)}stop(){const{coordsHistory:t}=this;let e=0,i=0,o=0;if(t.length>0){const s=this.zoomCoordsHistoryIndex%maxZoomCoords;let a=s-1;a<0&&(a=t.length-1);let r=s;r>=t.length&&(r=0);const n=t[a],l=t[r];e=this.isPanningX()?n.x-l.x:0,i=this.isPanningY()?n.y-l.y:0,o=n.t-l.t}if(this.coords=void 0,this.direction=void 0,clearInterval(this.coordsMonitorTimeout),this.coordsMonitorTimeout=void 0,this.zoomCoordsHistoryIndex=0,this.coordsHistory.length=0,o>0&&this.decelerationValue<1){const s=e/o,a=i/o,r=Math.hypot(s,a),n=Math.atan2(a,s),l=performance.now();this.inertiaHandle=(0,import_ag_charts_core70.getWindow)().requestAnimationFrame(c=>{this.animateInertia(c,c,l,r,n)})}}recordCurrentZoomCoords(){const{coords:t,coordsHistory:e,zoomCoordsHistoryIndex:i}=this;if(!t)return;const{x2:o,y2:s}=t,a=Date.now();e[i%maxZoomCoords]={x:o,y:s,t:a},this.zoomCoordsHistoryIndex+=1}animateInertia(t,e,i,o,s){const a=1-this.decelerationValue,r=-o/Math.log(a),n=o*(a**(e-i)-1)/Math.log(a),l=o*(a**(t-i)-1)/Math.log(a);this.onUpdate?.({type:"update",deltaX:this.isPanningX()?-Math.cos(s)*(l-n):0,deltaY:this.isPanningY()?-Math.sin(s)*(l-n):0}),!(l>=r-1)&&(this.inertiaHandle=requestAnimationFrame(c=>{this.animateInertia(c,t,i,o,s)}))}updateCoords(t,e){this.coords?this.coords={x1:this.coords.x2,y1:this.coords.y2,x2:t,y2:e}:this.coords={x1:t,y1:e,x2:t,y2:e}}isPanningX(){return this.direction==null||this.direction===import_ag_charts_community166._ModuleSupport.ChartAxisDirection.X}isPanningY(){return this.direction==null||this.direction===import_ag_charts_community166._ModuleSupport.ChartAxisDirection.Y}translateZooms(t,e,i,o){const s=pointToRatio(t,t.x+Math.abs(i),t.y+t.height-Math.abs(o)),a=Math.sign(i)*s.x,r=-Math.sign(o)*s.y,n={};for(const[l,{direction:c,zoom:h}]of(0,import_ag_charts_core70.entries)(e)){if(h&&h.min===UNIT_MIN&&h.max===UNIT_MAX)continue;let d=definedZoomState({[c]:h});d=constrainZoom(translateZoom(d,a*dx(d),r*dy(d))),n[l]={direction:c,zoom:d[c]}}return n}},import_ag_charts_community167=require("ag-charts-community"),import_ag_charts_core71=require("ag-charts-core"),DELTA_SCALE=200,ZoomScrollPanner=class{update(t,e,i,o){const s=t.deltaX*e*DELTA_SCALE;return this.translateZooms(i,o,s)}translateZooms(t,e,i){const o={},s=pointToRatio(t,t.x+Math.abs(i),0),a=i<0?-s.x:s.x;for(const[r,{direction:n,zoom:l}]of(0,import_ag_charts_core71.entries)(e)){if(n!==import_ag_charts_community167._ModuleSupport.ChartAxisDirection.X)continue;let c=definedZoomState({x:l});c=constrainZoom(translateZoom(c,a*dx(c),0)),o[r]={direction:n,zoom:c.x}}return o}},import_ag_charts_community168=require("ag-charts-community"),import_ag_charts_core72=require("ag-charts-core"),ZoomScroller=class{updateAxes(t,e,i,o){const s=t.sourceEvent,a={},{anchorPointX:r,anchorPointY:n,isScalingX:l,isScalingY:c,scrollingStep:h}=e,d=pointToRatio(i,s.offsetX??s.clientX,s.offsetY??s.clientY);for(const[u,{direction:p,zoom:g}]of(0,import_ag_charts_core72.entries)(o)){if(g==null)continue;let y={...g};const f=h*t.deltaY*(g.max-g.min);if(p===import_ag_charts_community168._ModuleSupport.ChartAxisDirection.X&&l)y.max+=f,y=scaleZoomAxisWithAnchor(y,g,r,d.x);else if(p===import_ag_charts_community168._ModuleSupport.ChartAxisDirection.Y&&c)y.max+=f,y=scaleZoomAxisWithAnchor(y,g,n,d.y);else continue;y.max0&&this.rect.height>0}updateCoords(t,e,i,o){if(!this.coords){this.coords={x1:t,y1:e,x2:t,y2:e};return}const{coords:s}=this;if(s.x2=t,s.y2=e,!o)return;const{isScalingX:a,isScalingY:r,keepAspectRatio:n}=i,l=this.getNormalisedDimensions();if(n&&a&&r){const c=o.width/o.height;s.y2n&&sUNIT_MIN;break;case"pan-end":o=t.x.maxUNIT_MIN;break;case"pan-right":o=t.x.maxi.find(b=>b.identifier===n[x].identifier)),c=n[0].normalX,h=n[1].normalX,d=l[0].clientX,u=l[1].clientX,p=n[0].normalY,g=n[1].normalY,y=s+r-l[0].clientY,f=s+r-l[1].clientY;return this.twitchTolerantZoomPan4(c,h,d,u,p,g,y,f,o,s,a,r)}end(t){const e=Array.from(t.sourceEvent.targetTouches).map(i=>i.identifier);return!e.includes(this.touchStart.origins[0].identifier)||!e.includes(this.touchStart.origins[1].identifier)}twitchTolerantZoomPan4(t,e,i,o,s,a,r,n,l,c,h,d){const{initialZoom:u,previous:p}=this,g=twitchTolerantZoomPan2(t,e,i,o,p,"a1","a2",l,h,u.x),y=twitchTolerantZoomPan2(s,a,r,n,p,"b1","b2",c,d,u.y);return{x:g,y}}};function twitchTolerantZoomPan2(t,e,i,o,s,a,r,n,l,c){if(t==e){const h=clientToNormal(c,i,n,l),d=clientToNormal(c,o,n,l),u=(h+d)/2,p=(t-u)/N;return{min:c.min+p,max:c.max+p}}else{const h=s[a],d=s[r];return Math.abs(i-h)+Math.abs(o-d)<=1?(i=h,o=d):(s[a]=i,s[r]=o),solveTwoUnknowns(t,e,i,o,n,l)}}var{ActionOnSet:ActionOnSet9,ChartAxisDirection:ChartAxisDirection23,ChartUpdateType:ChartUpdateType3,Property:Property62,InteractionState:InteractionState5,ProxyProperty:ProxyProperty3}=import_ag_charts_community170._ModuleSupport,round=t=>(0,import_ag_charts_core74.roundTo)(t,10),CURSOR_ID="zoom-cursor",TOOLTIP_ID="zoom-tooltip",ZoomAutoScaling=class extends import_ag_charts_community170._ModuleSupport.BaseProperties{constructor(t){super(),this.onChange=t,this.enabled=!1,this.padding=0}};__decorateClass([Property62,ActionOnSet9({changeValue(t){this.onChange({enabled:t,padding:this.padding})}})],ZoomAutoScaling.prototype,"enabled",2),__decorateClass([Property62,ActionOnSet9({changeValue(t){this.onChange({enabled:this.enabled,padding:t})}})],ZoomAutoScaling.prototype,"padding",2);var Zoom=class extends import_ag_charts_community170._ModuleSupport.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.enabled=!1,this.enableAxisDragging=!0,this.enableAxisScrolling=!1,this.enableDoubleClickToReset=!0,this.enablePanning=!0,this.enableScrolling=!0,this.enableSelecting=!1,this.enableTwoFingerZoom=!0,this.panKey="alt",this.axes="x",this.scrollingStep=UNIT_SIZE/10,this.keepAspectRatio=!1,this.minVisibleItems=2,this.anchorPointX=DEFAULT_ANCHOR_POINT_X,this.anchorPointY=DEFAULT_ANCHOR_POINT_Y,this.autoScaling=new ZoomAutoScaling(i=>{this.ctx.zoomManager.setAutoScaleYAxis(i.enabled,i.padding)}),this.axisDraggingMode="zoom",this.canResetZoom=i=>(i??(i=this.getZoom()),!isZoomEqual(i,this.getResetZoom())),this.buttons=new ZoomToolbar(this.ctx,this.getModuleProperties.bind(this),this.canResetZoom,this.updateZoom.bind(this),this.updateAxisZoom.bind(this),this.resetZoom.bind(this),this.isZoomValid.bind(this)),this.axisDragger=new ZoomAxisDragger,this.panner=new ZoomPanner,this.scroller=new ZoomScroller,this.scrollPanner=new ZoomScrollPanner,this.twoFingers=new ZoomTwoFingers,this.deceleration="short",this.dragState=0,this.isState=i=>this.ctx.interactionManager.isState(i),this.destroyContextMenuActions=void 0,this.isFirstWheelEvent=!0,this.debouncedWheelReset=(0,import_ag_charts_core74.debounce)(()=>{this.isFirstWheelEvent=!0,this.wasFirstWheelEventZoomCapped=void 0},100),this.previousZoomValid=!0,this.previousAxisZoomValid={[import_ag_charts_community170._ModuleSupport.ChartAxisDirection.X]:!0,[import_ag_charts_community170._ModuleSupport.ChartAxisDirection.Y]:!0},this.toggleAxisDraggingCursorsDebounced=(0,import_ag_charts_core74.debounce)(this.toggleAxisDraggingCursors.bind(this),ZOOM_VALID_CHECK_DEBOUNCE,{leading:!0,trailing:!0});const e=new ZoomRect;this.selector=new ZoomSelector(e,this.getZoom.bind(this),this.isZoomValid.bind(this)),this.contextMenu=new ZoomContextMenu(t.eventsHub,t.contextMenuRegistry,t.zoomManager,this.getModuleProperties.bind(this),this.canResetZoom,()=>this.paddedRect,this.updateZoom.bind(this),this.isZoomValid.bind(this)),this.domProxy=new ZoomDOMProxy({onAxisDragStart:i=>this.onAxisDragStart(i),onAxisDragMove:(i,o,s)=>this.onAxisDragMove(i,o,s),onAxisDragEnd:()=>this.onAxisDragEnd(),onAxisDoubleClick:i=>this.onAxisDoubleClick(i),onAxisWheel:(i,o,s)=>this.onAxisWheel(i,o,s)}),t.widgets.seriesDragInterpreter&&this.cleanup.register(t.widgets.seriesDragInterpreter.events.on("dblclick",i=>this.onSeriesAreaDoubleClick(i)),t.widgets.seriesDragInterpreter.events.on("drag-move",i=>this.onSeriesAreaDragMove(i)),t.widgets.seriesDragInterpreter.events.on("drag-start",i=>this.onSeriesAreaDragStart(i)),t.widgets.seriesDragInterpreter.events.on("drag-end",()=>this.onSeriesAreaDragEnd())),this.cleanup.register(t.scene.attachNode(e),t.eventsHub.on("series-area:hover",i=>this.onSeriesAreaHoverEvent(i)),t.eventsHub.on("series-area:click",i=>this.onSeriesAreaClickEvent(i)),t.eventsHub.on("series:keynav-zoom",i=>this.onNavZoom(i)),t.widgets.seriesWidget.addListener("wheel",i=>this.onWheel(i)),t.widgets.seriesWidget.addListener("touchstart",(i,o)=>this.onTouchStart(i,o)),t.widgets.seriesWidget.addListener("touchmove",(i,o)=>this.onTouchMove(i,o)),t.widgets.seriesWidget.addListener("touchend",i=>this.onTouchEnd(i)),t.widgets.seriesWidget.addListener("touchcancel",i=>this.onTouchEnd(i)),t.updateService.addListener("process-data",i=>this.onProcessData(i)),t.eventsHub.on("layout:complete",i=>this.onLayoutComplete(i)),t.eventsHub.on("zoom:change",i=>this.onZoomChange(i)),t.eventsHub.on("zoom:pan-start",i=>this.onZoomPanStart(i)),this.panner.addListener("update",i=>this.onPanUpdate(i)),()=>this.teardown())}teardown(){this.ctx.zoomManager.setZoomModuleEnabled(!1),this.buttons.destroy(),this.destroyContextMenuActions?.(),this.domProxy.destroy()}onEnabledChange(t){this.ctx.zoomManager.setZoomModuleEnabled(t),this.contextMenu&&(this.destroyContextMenuActions?.(),this.destroyContextMenuActions=this.contextMenu.registerActions(t))}isIgnoredTouch(t){return t?.device!=="touch"?!1:this.ctx.chartService.touch.dragAction!=="drag"?!0:this.enableSelecting?!1:this.enablePanning?isMaxZoom(this.getZoom()):!0}onSeriesAreaDoubleClick(t){const{enabled:e,enableDoubleClickToReset:i}=this;!e||!i||t?.preventZoomDblClick||!this.isState(InteractionState5.ZoomClickable)||this.resetZoom()}onSeriesAreaHoverEvent(t){if(!this.shouldHandleAxisHover(t)){this.clearHoveredAxis();return}const e=this.domProxy.pickAxisAtPoint(t.x,t.y);e?(this.domProxy.setHoveredAxis(e.axisId),this.ctx.domManager.updateCursor(CURSOR_ID,this.domProxy.getCursor(e.direction))):this.clearHoveredAxis()}onSeriesAreaClickEvent(t){if(!this.shouldHandleAxisClick(t))return;const e=this.domProxy.pickAxisAtPoint(t.x,t.y);e&&t.sourceEvent?.type==="dblclick"&&this.onAxisDoubleClick(e.axisId)}shouldHandleAxisHover(t){const{enabled:e,enableAxisDragging:i,enableAxisScrolling:o,dragState:s}=this;return e&&(i||o)&&!t.consumed&&!this.activeAxis&&s===0&&this.domProxy.hasOverlappingAxes()}shouldHandleAxisClick(t){const{enabled:e,enableAxisDragging:i,enableAxisScrolling:o,enableDoubleClickToReset:s}=this;return e&&!this.activeAxis&&!t.consumed&&(i||o||s)}clearHoveredAxis(){this.activeAxis||(this.domProxy.clearHoveredAxis(),this.dragState===0&&this.ctx.domManager.updateCursor(CURSOR_ID))}tryBeginAxisDelegation(t){const e=this.domProxy.getHoveredAxis();if(!this.enabled||!this.enableAxisDragging||!e||!this.domProxy.beginDelegatedAxisDrag(e.axisId))return!1;this.activeAxis=e,this.onAxisDragStart(e.direction);const i=this.dragState===2?"grabbing":this.domProxy.getCursor(e.direction);return this.ctx.domManager.updateCursor(CURSOR_ID,i),t.device==="touch"&&t.sourceEvent.preventDefault(),!0}onSeriesAreaDragStart(t){const{enabled:e,enablePanning:i,enableSelecting:o,ctx:{domManager:s,zoomManager:a}}=this;if(!e||!this.isState(InteractionState5.ZoomDraggable)||this.dragState!==0||this.isIgnoredTouch(t)||(this.panner.stopInteractions(),this.tryBeginAxisDelegation(t)))return;let r=0;const n=this.isPanningKeyPressed(t.sourceEvent);i&&(!o||n)?(s.updateCursor(CURSOR_ID,"grabbing"),r=2,this.panner.start()):o&&!n&&(r=3),(this.dragState=r)!==0&&a.fireZoomPanStartEvent("zoom")}onSeriesAreaDragMove(t){const{dragState:e,enabled:i,paddedRect:o,panner:s,selector:a,ctx:{interactionManager:r,tooltipManager:n,updateService:l}}=this;if(this.activeAxis){this.onAxisDragMove(this.activeAxis.axisId,this.activeAxis.direction,t);return}if(!(!i||!o||!this.isState(InteractionState5.ZoomDraggable)||this.isIgnoredTouch(t))){switch(r.pushState(import_ag_charts_community170._ModuleSupport.InteractionState.ZoomDrag),t.device==="touch"&&t.sourceEvent.preventDefault(),e){case 2:s.update(t);break;case 3:a.update(t,this.getModuleProperties(),o);break;case 0:return}n.updateTooltip(TOOLTIP_ID),l.update(ChartUpdateType3.PERFORM_LAYOUT,{skipAnimations:!0})}}onSeriesAreaDragEnd(){const{ctx:{interactionManager:t}}=this;if(this.activeAxis){this.handleAxisDragEnd();return}t.popState(import_ag_charts_community170._ModuleSupport.InteractionState.ZoomDrag),!(!this.enabled||this.dragState===0)&&(this.handleRegularDragEnd(),this.resetDragState())}handleAxisDragEnd(){this.onAxisDragEnd(),this.domProxy.endDelegatedAxisDrag(this.activeAxis.axisId),this.activeAxis=void 0,this.clearHoveredAxis()}handleRegularDragEnd(){const{panner:t,selector:e}=this;switch(this.dragState){case 2:t.stop();break;case 3:if(e.didUpdate()){const i=e.stop(this.seriesRect,this.paddedRect,this.getZoom());this.updateZoom(i)}break}}resetDragState(){this.dragState=0,this.ctx.domManager.updateCursor(CURSOR_ID),this.ctx.tooltipManager.removeTooltip(TOOLTIP_ID)}onAxisDoubleClick(t){const{enabled:e,enableDoubleClickToReset:i,ctx:{zoomManager:o}}=this;!e||!i||!this.isState(InteractionState5.ZoomClickable)||(this.previousAxisZoomValid={[ChartAxisDirection23.X]:!0,[ChartAxisDirection23.Y]:!0},o.resetAxisZoom("zoom",t))}onAxisDragStart(t){const{axisDraggingMode:e,domProxy:i,enabled:o,enableAxisDragging:s,panner:a,ctx:{zoomManager:r}}=this;!o||!s||(a.stopInteractions(),e==="pan"?(i.setAxisCursor("grabbing"),this.dragState=2,this.panner.start(t),r.fireZoomPanStartEvent("zoom")):this.dragState=1)}onAxisDragMove(t,e,i){const{anchorPointX:o,anchorPointY:s,axisDragger:a,dragState:r,enabled:n,enableAxisDragging:l,seriesRect:c,shouldFlipXY:h,ctx:{interactionManager:d,tooltipManager:u,updateService:p,zoomManager:g}}=this;if(!n||!l||!c)return;d.pushState(import_ag_charts_community170._ModuleSupport.InteractionState.ZoomDrag),i.device==="touch"&&i.sourceEvent.preventDefault();const y=this.getZoom();if(r===2)this.panner.update({currentX:i.offsetX,currentY:i.offsetY});else{let f=e===ChartAxisDirection23.X?o:s;h&&(f=e===ChartAxisDirection23.X?s:o);const x=g.getAxisZoom(t),b=a.update(i,e,f,c,y,x);g.setAxisManuallyAdjusted("zoom",t),this.updateAxisZoom(t,e,b,{directional:!0})}u.updateTooltip(TOOLTIP_ID),p.update(ChartUpdateType3.PERFORM_LAYOUT,{skipAnimations:!0})}onAxisDragEnd(){const{axisDraggingMode:t,axisDragger:e,dragState:i,domProxy:o,enabled:s,enableAxisDragging:a,ctx:{domManager:r,interactionManager:n,tooltipManager:l}}=this;n.popState(import_ag_charts_community170._ModuleSupport.InteractionState.ZoomDrag),!(!s||!a||i===0)&&(this.dragState=0,t==="pan"&&(o.setAxisCursor("grab"),this.panner.stop()),e.stop(),r.updateCursor(CURSOR_ID),l.removeTooltip(TOOLTIP_ID))}onNavZoom(t){const{enabled:e,enableScrolling:i,scroller:o}=this;!this.ctx.interactionManager.isState(import_ag_charts_community170._ModuleSupport.InteractionState.Default)||!e||!i||(t.widgetEvent.sourceEvent.preventDefault(),this.updateZoom(o.updateDelta(t.delta,this.getModuleProperties(),this.getZoom())))}onWheel(t){const{enabled:e,enablePanning:i,enableScrolling:o,paddedRect:s}=this;if(!e||!o||!s||!this.isState(InteractionState5.ZoomWheelable))return;const{deltaX:a,deltaY:r}=t.sourceEvent,n=a!=null&&r!=null&&Math.abs(a)>Math.abs(r);i&&n?this.onWheelPanning(t):this.onWheelScrolling(t)}onWheelPanning(t){const{scrollingStep:e,scrollPanner:i,seriesRect:o,ctx:{zoomManager:s}}=this;if(!o)return;t.sourceEvent.preventDefault();const a=i.update(t,e,o,s.getAxisZooms());for(const[r,{direction:n,zoom:l}]of(0,import_ag_charts_core74.entries)(a))this.updateAxisZoom(r,n,l)}onWheelScrolling(t){const e=this.getZoom(),i=t.deltaY>0&&isMaxZoom(e);this.handleWheelScrolling(t,i)}onAxisWheel(t,e,i){const{enableAxisScrolling:o,ctx:{zoomManager:s}}=this;if(!o||e!==ChartAxisDirection23.X&&e!==ChartAxisDirection23.Y)return;const a=e===ChartAxisDirection23.X,r=!a,n=this.getModuleProperties({isScalingX:a,isScalingY:r}),l=this.getZoom(),c=i.deltaY>0&&l[e].min===UNIT_MIN&&l[e].max===UNIT_MAX;s.setAxisManuallyAdjusted("zoom",t),this.handleWheelScrolling(i,c,n)}handleWheelScrolling(t,e,i=this.getModuleProperties()){const{enableIndependentAxes:o,scroller:s,seriesRect:a,ctx:{zoomManager:r}}=this;if(!a)return;let n=!0;if(o===!0){const l=s.updateAxes(t,i,a,r.getAxisZooms());for(const[c,{direction:h,zoom:d}]of(0,import_ag_charts_core74.entries)(l)){const u=h===ChartAxisDirection23.X?this.constrainZoom({x:d,y:{min:UNIT_MAX,max:UNIT_MAX}}).x:d;n&&(n=this.updateAxisZoom(c,h,u))}}else{const l=s.update(t,i,a,this.getZoom());if(l==null)return;n=this.updateUnifiedZoom(l,{directional:!0})}e||(e=t.deltaY<0&&!n),this.firstWheelEventDirection!=null&&this.firstWheelEventDirection!==t.deltaY<0&&(this.isFirstWheelEvent=!0),this.isFirstWheelEvent?(this.wasFirstWheelEventZoomCapped=e,this.firstWheelEventDirection=t.deltaY<0,e||t.sourceEvent.preventDefault()):this.wasFirstWheelEventZoomCapped===!1&&t.sourceEvent.preventDefault(),this.isFirstWheelEvent=!1,this.debouncedWheelReset()}onTouchStart(t,e){!this.enableTwoFingerZoom||this.dragState!==0||this.twoFingers.start(t,e,this.getZoom())&&(this.dragState=4)}onTouchMove(t,e){if(!this.enableTwoFingerZoom||this.dragState!==4)return;const i=this.twoFingers.update(t,e);this.updateZoom(constrainZoom(i))}onTouchEnd(t){!this.enableTwoFingerZoom||this.dragState!==4||(t.sourceEvent.preventDefault(),this.twoFingers.end(t)&&(this.dragState=0))}onProcessData(t){this.shouldFlipXY=t.series.shouldFlipXY}onLayoutComplete(t){this.domProxy.update(this.enableAxisDragging,this.enableAxisScrolling,this.ctx,t.series.rect),this.enabled&&(this.seriesRect=t.series.rect,this.paddedRect=t.series.paddedRect,this.enableAxisDragging&&this.toggleAxisDraggingCursorsDebounced())}onZoomChange(t){t.callerId!=="zoom"&&this.panner.stopInteractions();const e=this.getZoom();this.buttons.toggleVisibleZoomed(isMaxZoom(e))}onZoomPanStart(t){t.callerId==="zoom"&&this.panner.stopInteractions()}onPanUpdate(t){const{panner:e,seriesRect:i,ctx:{tooltipManager:o,zoomManager:s}}=this;if(!i)return;const a=e.translateZooms(i,s.getAxisZooms(),t.deltaX,t.deltaY);for(const[r,{direction:n,zoom:l}]of(0,import_ag_charts_core74.entries)(a))this.updateAxisZoom(r,n,l);o.updateTooltip(TOOLTIP_ID)}isPanningKeyPressed(t){switch(this.panKey){case"alt":return t.altKey;case"ctrl":return t.ctrlKey;case"shift":return t.shiftKey;case"meta":return t.metaKey}}isScalingX(){return this.axes==="xy"?!0:this.shouldFlipXY?this.axes==="y":this.axes==="x"}isScalingY(){return this.axes==="xy"?!0:this.shouldFlipXY?this.axes==="x":this.axes==="y"}getAnchorPointX(){return this.shouldFlipXY?this.anchorPointY:this.anchorPointX}getAnchorPointY(){return this.shouldFlipXY?this.anchorPointX:this.anchorPointY}constrainZoom(t){const{minVisibleItems:e,ctx:{zoomManager:i}}=this;return e===0?t:i.constrainZoomToItemCount(t,e)??t}isZoomValid(t,e){const{minVisibleItems:i,ctx:{zoomManager:o}}=this;if(i===0)return this.previousZoomValid=!0,!0;const s=this.getZoom(),a=round(dx(t))=n)return this.previousAxisZoomValid[t]=!0,!0;if(!this.previousAxisZoomValid[t]&&i?.directional)return!1;const c=s.isVisibleItemsCountAtLeast(l,o);return this.previousAxisZoomValid[t]=i?.directional?c:!0,c}resetZoom(){this.previousZoomValid=!0,this.previousAxisZoomValid={[ChartAxisDirection23.X]:!0,[ChartAxisDirection23.Y]:!0},this.ctx.zoomManager.resetZoom("zoom")}updateSyncZoom(t){this.updateZoom(t)}updateZoom(t){this.enableIndependentAxes?this.updatePrimaryAxisZooms(t):this.updateUnifiedZoom(t)}updateUnifiedZoom(t,e){return t=this.constrainZoom(t),this.isZoomValid(t,e)?(this.ctx.zoomManager.updateZoom("zoom",t),!0):(this.ctx.updateService.update(ChartUpdateType3.SCENE_RENDER,{skipAnimations:!0}),!1)}updatePrimaryAxisZooms(t){this.updatePrimaryAxisZoom(t,ChartAxisDirection23.X),this.updatePrimaryAxisZoom(t,ChartAxisDirection23.Y)}updatePrimaryAxisZoom(t,e){const i=this.ctx.zoomManager.getPrimaryAxisId(e);i!=null&&this.updateAxisZoom(i,e,t[e])}updateAxisZoom(t,e,i,o){const{enableIndependentAxes:s,ctx:{zoomManager:a}}=this;if(!i)return!1;const r=this.getZoom();return s!==!0?(r[e]=i,this.updateUnifiedZoom(r,o)):this.isAxisZoomValid(e,i,o)?(a.updateAxisZoom("zoom",t,i),!0):!1}updateAxisCursor(t){if(!this.domProxy)return;const{enableAxisDragging:e=this.enableAxisDragging,enableAxisScrolling:i=this.enableAxisScrolling,axisDraggingMode:o=this.axisDraggingMode}=t;e?this.domProxy.setAxisCursor(o==="pan"?"grab":void 0):i?this.domProxy.setAxisCursor("default"):this.domProxy.setAxisCursor(void 0)}toggleAxisDraggingCursors(){const{anchorPointX:t,anchorPointY:e,domProxy:i}=this,o=this.getZoom();let s=dx(o)!==UNIT_SIZE,a=dy(o)!==UNIT_SIZE;if(!s){const r=scaleZoom(o,.999,1);r.x=scaleZoomAxisWithAnchor(r.x,o.x,t),s=this.isZoomValid(r,{includeYVisibleRange:!0})}if(!a){const r=scaleZoom(o,1,.999);r.y=scaleZoomAxisWithAnchor(r.y,o.y,e),a=this.isZoomValid(r,{includeYVisibleRange:!0})}i.toggleAxisDraggingCursor(ChartAxisDirection23.X,s),i.toggleAxisDraggingCursor(ChartAxisDirection23.Y,a)}getZoom(){return definedZoomState(this.ctx.zoomManager.getZoom())}getResetZoom(){return definedZoomState(this.ctx.zoomManager.getRestoredZoom())}getModuleProperties(t){return{anchorPointX:t?.anchorPointX??this.getAnchorPointX(),anchorPointY:t?.anchorPointY??this.getAnchorPointY(),enabled:t?.enabled??this.enabled,independentAxes:t?.independentAxes??this.enableIndependentAxes===!0,isScalingX:t?.isScalingX??this.isScalingX(),isScalingY:t?.isScalingY??this.isScalingY(),keepAspectRatio:t?.keepAspectRatio??this.keepAspectRatio,scrollingStep:t?.scrollingStep??this.scrollingStep}}};__decorateClass([ActionOnSet9({newValue(t){this.onEnabledChange(t)}}),Property62],Zoom.prototype,"enabled",2),__decorateClass([ActionOnSet9({changeValue(t){this.updateAxisCursor({enableAxisDragging:t})}}),Property62],Zoom.prototype,"enableAxisDragging",2),__decorateClass([ActionOnSet9({changeValue(t){this.updateAxisCursor({enableAxisScrolling:t})}}),Property62],Zoom.prototype,"enableAxisScrolling",2),__decorateClass([Property62],Zoom.prototype,"enableDoubleClickToReset",2),__decorateClass([ActionOnSet9({changeValue(t){this.ctx.zoomManager.setIndependentAxes(!!t)}}),Property62],Zoom.prototype,"enableIndependentAxes",2),__decorateClass([Property62],Zoom.prototype,"enablePanning",2),__decorateClass([Property62],Zoom.prototype,"enableScrolling",2),__decorateClass([Property62],Zoom.prototype,"enableSelecting",2),__decorateClass([Property62],Zoom.prototype,"enableTwoFingerZoom",2),__decorateClass([Property62],Zoom.prototype,"panKey",2),__decorateClass([Property62],Zoom.prototype,"axes",2),__decorateClass([Property62],Zoom.prototype,"scrollingStep",2),__decorateClass([Property62],Zoom.prototype,"keepAspectRatio",2),__decorateClass([Property62],Zoom.prototype,"minVisibleItems",2),__decorateClass([Property62],Zoom.prototype,"anchorPointX",2),__decorateClass([Property62],Zoom.prototype,"anchorPointY",2),__decorateClass([Property62],Zoom.prototype,"autoScaling",2),__decorateClass([ActionOnSet9({changeValue(t){this.updateAxisCursor({axisDraggingMode:t})}}),Property62],Zoom.prototype,"axisDraggingMode",2),__decorateClass([Property62],Zoom.prototype,"buttons",2),__decorateClass([ProxyProperty3("panner.deceleration"),Property62],Zoom.prototype,"deceleration",2);var buttons={enabled:!0,visible:"hover",buttons:[{icon:"zoom-out",value:"zoom-out",section:"scale"},{icon:"zoom-in",value:"zoom-in",section:"scale"},{icon:"pan-left",value:"pan-left",section:"pan"},{icon:"pan-right",value:"pan-right",section:"pan"},{icon:"reset",value:"reset",section:"reset"}]},ZoomModule={type:"root",optionsKey:"zoom",packageType:"enterprise",chartTypes:["cartesian","topology"],moduleFactory:t=>new Zoom(t),themeTemplate:{zoom:{anchorPointX:"end",anchorPointY:"middle",axes:"x",buttons,enabled:!1,enableAxisDragging:!0,enableDoubleClickToReset:!0,enablePanning:!0,enableScrolling:!0,enableSelecting:!1,enableTwoFingerZoom:!0,deceleration:"short",minVisibleItems:2,panKey:"alt",scrollingStep:.1,autoScaling:{enabled:{$eq:[{$path:"../axes"},"x"]},padding:.05}}}},import_ag_charts_community174=require("ag-charts-community"),import_ag_charts_community173=require("ag-charts-community"),import_ag_charts_core76=require("ag-charts-core"),import_ag_charts_community172=require("ag-charts-community"),import_ag_charts_core75=require("ag-charts-core"),import_ag_charts_community171=require("ag-charts-community");function formatWithContext(t,e,i){return import_ag_charts_community171._ModuleSupport.callWithContext(t.chartService,e,i)}var{AxisInterval:AxisInterval2,AxisLabel:AxisLabel2,ZIndexMap:ZIndexMap9,LinearScale:LinearScale3,BBox:BBox14,TranslatableGroup:TranslatableGroup4,Selection:Selection4,Text:Text2,createIdsGenerator,findMinMax:findMinMax5,findRangeExtent,estimateTickCount}=import_ag_charts_community172._ModuleSupport,_AxisTicks=class St{constructor(e,i){this.ctx=e,this.dataProvider=i,this.id=(0,import_ag_charts_core75.createId)(this),this.axisGroup=new TranslatableGroup4({name:`${this.id}-AxisTicks`,zIndex:ZIndexMap9.AXIS}),this.labelSelection=Selection4.select(this.axisGroup,Text2),this.interval=new AxisInterval2,this.label=new AxisLabel2,this.scale=new LinearScale3,this.placement="bottom",this.translationX=0,this.translationY=0,this.padding=0}get horizontal(){return this.placement.startsWith("top")||this.placement.startsWith("bottom")}attachAxis(e){e.appendChild(this.axisGroup)}calculateLayout(){const{placement:e,translationX:i,translationY:o,horizontal:s,label:a}=this;function r(u){}let n,l;switch(e){case"top":case"top-right":case"top-left":n="bottom",l="center",a.mirrored=!1,a.parallel=!0;break;case"bottom":case"bottom-right":case"bottom-left":n="top",l="center",a.mirrored=!1,a.parallel=!0;break;case"right":case"right-top":case"right-bottom":case"left":case"left-top":case"left-bottom":n="middle",l="left",a.mirrored=!0,a.parallel=!1;break;default:}const c=[],h=this.generateTicks(),{ticks:d}=h;return this.labelSelection.update(d,void 0,u=>u.tickId),this.axisGroup.setProperties({translationX:i,translationY:o}),this.labelSelection.each((u,p)=>{u.fontFamily=a.fontFamily,u.fontSize=a.fontSize,u.fontStyle=a.fontStyle,u.fontWeight=a.fontWeight,u.fill=a.color,u.textBaseline=n,u.textAlign=l,u.text=p.tickLabel,u.x=s?p.translation:0,u.y=s?0:p.translation,c.push(u.getBBox())}),c.length>0?BBox14.merge(c).translate(i,o):void 0}tickFormatter(e,i,o,s){const{ctx:a}=this,{formatManager:r}=a,n=this.dataProvider.data.flatMap(l=>l.series);return(l,c)=>{const h={type:"number",value:l,datum:void 0,seriesId:void 0,legendItemName:void 0,key:void 0,source:"gradient-legend",property:"color",domain:e,boundSeries:n,fractionDigits:s};return this.label.formatValue((d,u)=>formatWithContext(a,d,u),h,c)??r.format((d,u)=>formatWithContext(a,d,u),h)??r.defaultFormat(h)}}inRange(e,i=.001){const[o,s]=findMinMax5(this.scale.range);return e>=o-i&&e<=s+i}generateTicks(){const{minSpacing:e,maxSpacing:i}=this.interval,{maxTickCount:o,minTickCount:s,tickCount:a}=estimateTickCount(findRangeExtent(this.scale.range),1,e,i,St.DefaultTickCount,St.DefaultMinSpacing),r=this.getTicksData({nice:!0,interval:this.interval.step,tickCount:a,minTickCount:s,maxTickCount:o});if(this.placement==="bottom"||this.placement==="top"){const n=(0,import_ag_charts_core75.cachedTextMeasurer)(this.label),{domain:l}=this.scale,h=l[0]>l[1]?-1:1;let d=-1/0*h;r.ticks=r.ticks.filter(u=>{if(Math.sign(u.translation-d)!==h)return!1;const{width:p}=(0,import_ag_charts_core75.isArray)(u.tickLabel)?(0,import_ag_charts_core75.measureTextSegments)(u.tickLabel,this.label):n.measureLines(u.tickLabel);return d=u.translation+p*h,!0})}return r}getTicksData(e){const i=[],o=e.nice?this.scale.niceDomain(e):this.scale.domain,s=this.scale.ticks(e,o)?.ticks??[],a=s.reduce((l,c)=>Math.max(l,(0,import_ag_charts_core75.countFractionDigits)(c)),0),r=createIdsGenerator(),n=this.tickFormatter(o,s,!1,a);for(let l=0;lthis.onChartHoverChange()),t.layoutManager.registerElement(LayoutElement5.Legend,e=>this.onStartLayout(e)),()=>this.legendGroup.remove())}isVertical(){const{placement:t}=expandLegendPosition(this.position);return t.startsWith("right")||t.startsWith("left")}destroy(){this.cleanup.flush()}attachLegend(t){t.appendChild(this.legendGroup)}onStartLayout(t){const[e]=this.data;if(!this.enabled||!e?.enabled||e.legendType!=="gradient"){this.legendGroup.visible=!1;return}const{colorRange:i}=this.normalizeColorArrays(e),o=this.updateGradientRect(t.layoutBox,i),s=this.updateAxis(e,o)??new BBox15(0,0,0,0),a=BBox15.merge([o,s]),{strokeWidth:r,padding:n}=this.getContainerStyles();a.grow(n).grow(r);const{left:l,top:c}=this.getMeasurements(t.layoutBox,a);this.updateContainer(a),this.updateArrow(),this.legendGroup.visible=!0,this.legendGroup.translationX=l,this.legendGroup.translationY=c}normalizeColorArrays(t){let e=t.colorDomain.slice();const i=t.colorRange.slice();if(e.length===i.length)return{colorDomain:e,colorRange:i};e.length>i.length&&i.splice(e.length);const[o,s]=e,a=i.length;return e=i.map((r,n)=>n===0?o:n===a-1?s:o+(s-o)*n/(a-1)),{colorDomain:e,colorRange:i}}updateGradientRect(t,e){const{gradientRect:i,gradient:o}=this,{preferredLength:s,thickness:a}=o,r=new BBox15(0,0,0,0);let n;return this.isVertical()?(n=0,r.width=a,r.height=Math.min(t.height,s)):(n=90,r.width=Math.min(t.width,s),r.height=a),i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height,i.fill={type:"gradient",gradient:"linear",colorSpace:"oklch",colorStops:e.map((l,c)=>({stop:c/(e.length-1),color:l})),rotation:n},r}updateAxis(t,e){const{axisTicks:i,gradient:o,scale:s}=this,{placement:a}=expandLegendPosition(this.position),r=this.isVertical(),n=this.reverseOrder!==r;i.placement=a;const l=o.thickness+(s.padding??0);return i.translationX=r?l:e.x,i.translationY=r?e.y:l,i.scale.domain=n?t.colorDomain.slice().reverse():t.colorDomain,i.scale.range=r?[e.x,e.height]:[e.y,e.width],i.calculateLayout()}updateContainer(t){const e=this.getContainerStyles();import_ag_charts_community173._ModuleSupport.applyShapeStyle(this.containerNode,e),this.containerNode.cornerRadius=e.cornerRadius,this.containerNode.x=t.x,this.containerNode.y=t.y,this.containerNode.width=t.width,this.containerNode.height=t.height}updateArrow(){const t=this.highlightManager.getActiveHighlight(),{arrow:e}=this;if(t?.colorValue==null){e.visible=!1;return}const{scale:i,label:o}=this.axisTicks,s=o.fontSize??0,a=i.convert(t.colorValue);let{x:r,y:n}=this.gradientRect,l=Math.PI;this.isVertical()?(r-=s/2,n+=a,l/=2):(r+=a,n-=s/2),e.visible=!0,e.fill=o.color,e.rotation=l,e.size=s,e.translationX=r,e.translationY=n}getMeasurements(t,e){function i(u){}let{x:o,y:s}=t;const{width:a,height:r}=e,{placement:n,floating:l,xOffset:c,yOffset:h}=expandLegendPosition(this.position),d=this.getContainerStyles();switch(o+=d.strokeWidth+d.padding.left,s+=d.strokeWidth+d.padding.top,n){case"left":s+=t.height/2-r/2;break;case"right":o+=t.width-a,s+=t.height/2-r/2;break;case"top":o+=t.width/2-a/2;break;case"bottom":o+=t.width/2-a/2,s+=t.height-r;break;case"right-top":case"top-right":o+=t.width-a;break;case"right-bottom":case"bottom-right":o+=t.width-a,s+=t.height-r;break;case"left-bottom":case"bottom-left":s+=t.height-r;break;case"left-top":case"top-left":break;default:}if(!l)switch(n){case"left":case"left-top":case"left-bottom":t.shrink(a+this.spacing,"left");break;case"right":case"right-top":case"right-bottom":t.shrink(a+this.spacing,"right");break;case"top":case"top-left":case"top-right":t.shrink(r+this.spacing,"top");break;case"bottom":case"bottom-left":case"bottom-right":t.shrink(r+this.spacing,"bottom");break;default:}return o+=c,s+=h,{top:s,left:o}}getContainerStyles(){const{stroke:t,strokeOpacity:e,strokeWidth:i}=this.border,{cornerRadius:o,fill:s,fillOpacity:a,padding:r}=this,n=typeof r=="number";return{cornerRadius:o,fill:s,fillOpacity:a,padding:{top:n?r:r.top??0,right:n?r:r.right??0,bottom:n?r:r.bottom??0,left:n?r:r.left??0},stroke:t,strokeOpacity:e,strokeWidth:this.border.enabled?i:0}}onChartHoverChange(){this.enabled&&this.updateArrow()}};GradientLegend.className="GradientLegend",__decorateClass([Property63],GradientLegend.prototype,"enabled",2),__decorateClass([Property63],GradientLegend.prototype,"position",2),__decorateClass([Property63],GradientLegend.prototype,"reverseOrder",2),__decorateClass([Property63],GradientLegend.prototype,"gradient",2),__decorateClass([Property63],GradientLegend.prototype,"spacing",2),__decorateClass([Property63],GradientLegend.prototype,"border",2),__decorateClass([Property63],GradientLegend.prototype,"cornerRadius",2),__decorateClass([Property63],GradientLegend.prototype,"fill",2),__decorateClass([Property63],GradientLegend.prototype,"fillOpacity",2),__decorateClass([Property63],GradientLegend.prototype,"padding",2),__decorateClass([Property63],GradientLegend.prototype,"scale",2);var GradientLegendModule={type:"legend",optionsKey:"gradientLegend",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],identifier:"gradient",moduleFactory:t=>new GradientLegend(t),themeTemplate:{enabled:!1,position:"bottom",spacing:20,scale:{padding:13,label:{color:{$ref:"textColor"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},minSpacing:5},interval:{minSpacing:15}},gradient:{preferredLength:100,thickness:16},reverseOrder:!1,fill:{$applySwitch:[{$path:"type"},{$ref:"chartBackgroundColour"},["gradient",import_ag_charts_community174._ModuleSupport.FILL_GRADIENT_BLANK_DEFAULTS],["pattern",import_ag_charts_community174._ModuleSupport.FILL_PATTERN_BLANK_DEFAULTS],["image",import_ag_charts_community174._ModuleSupport.FILL_IMAGE_BLANK_DEFAULTS]]}},removable:"standalone-only"},import_ag_charts_core77=require("ag-charts-core");function injectWatermark(t,e){const i=t.addChild("canvas-overlay","watermark"),o=(0,import_ag_charts_core77.createElement)("span");o.innerText=e,i.addEventListener("animationend",()=>{t.removeChild("canvas-overlay","watermark"),t.removeStyles("watermark")}),i.classList.add("ag-watermark"),i.appendChild(o)}var import_ag_charts_community281=require("ag-charts-community"),import_ag_charts_community175=require("ag-charts-community"),{ordinalTimeAxisOptionsDefs,angleNumberAxisOptionsDefs,angleCategoryAxisOptionsDefs,radiusNumberAxisOptionsDefs,radiusCategoryAxisOptionsDefs}=import_ag_charts_community175._ModuleSupport,OrdinalTimeAxisModule2={type:"axis",name:"ordinal-time",chartType:"cartesian",enterprise:!0,options:ordinalTimeAxisOptionsDefs,create:t=>new OrdinalTimeAxis(t)},AngleNumberAxisModule2={type:"axis",name:"angle-number",chartType:"polar",enterprise:!0,options:angleNumberAxisOptionsDefs,create:t=>new AngleNumberAxis(t)},AngleCategoryAxisModule2={type:"axis",name:"angle-category",chartType:"polar",enterprise:!0,options:angleCategoryAxisOptionsDefs,create:t=>new AngleCategoryAxis(t)},RadiusNumberAxisModule2={type:"axis",name:"radius-number",chartType:"polar",enterprise:!0,options:radiusNumberAxisOptionsDefs,create:t=>new RadiusNumberAxis(t)},RadiusCategoryAxisModule2={type:"axis",name:"radius-category",chartType:"polar",enterprise:!0,options:radiusCategoryAxisOptionsDefs,create:t=>new RadiusCategoryAxis(t)},import_ag_charts_community177=require("ag-charts-community"),import_ag_charts_community176=require("ag-charts-community"),{Chart}=import_ag_charts_community176._ModuleSupport,StandaloneChart=class extends Chart{getChartType(){return"standalone"}performLayout(t){const{seriesRoot:e,annotationRoot:i}=this,{layoutBox:o}=t,s=o.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=s,this.animationRect=s;for(const a of[e,i])a.translationX=Math.floor(s.x),a.translationY=Math.floor(s.y);e.visible=this.series[0].visible,this.ctx.layoutManager.emitLayoutComplete(t,{series:{visible:!0,rect:s,paddedRect:o}})}getAriaLabel(){const t=this.series[0]?.type;if(t==null)return"";const e=this.getCaptionText();switch(t){case"radial-gauge":case"linear-gauge":{const i=[];e.length!==0&&i.push(e);for(const o of this.series)i.push(o.getCaptionText());return this.ctx.localeManager.t("ariaAnnounceGaugeChart",{caption:i.join(". ")})}case"treemap":case"sunburst":return this.ctx.localeManager.t("ariaAnnounceHierarchyChart",{caption:e});default:return this.ctx.localeManager.t("ariaAnnounceStandaloneChart",{caption:e})}}};StandaloneChart.className="StandaloneChart",StandaloneChart.type="standalone";var{isAgStandaloneChartOptions,standaloneChartOptionsDefs}=import_ag_charts_community177._ModuleSupport,StandaloneChartModule={type:"chart",name:"standalone",enterprise:!0,options:standaloneChartOptionsDefs,detect:isAgStandaloneChartOptions,create(t,e){return new StandaloneChart(t,e)}},import_ag_charts_community179=require("ag-charts-community"),import_ag_charts_community178=require("ag-charts-community"),{Chart:Chart2,MercatorScale,ChartAxisDirection:ChartAxisDirection24,Property:Property64}=import_ag_charts_community178._ModuleSupport;function isTopologySeries(t){return t.type==="map-shape"||t.type==="map-line"||t.type==="map-marker"||t.type==="map-shape-background"||t.type==="map-line-background"}var TopologyChart=class extends Chart2{constructor(t,e){super(t,e),this.ctx.zoomManager.updateAxes([ChartAxisDirection24.X,ChartAxisDirection24.Y])}getChartType(){return"topology"}async updateData(){await super.updateData();const t=this.getOptions();this.topology!==t.topology&&(this.topology=t.topology);const{topology:e}=this;for(const i of this.series)isTopologySeries(i)&&i.setChartTopology(e)}performLayout(t){const{seriesRoot:e,annotationRoot:i}=this,{layoutBox:o}=t,s=o.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=s,this.animationRect=s;const a=this.series.filter(isTopologySeries),r=a.reduce((c,h)=>{if(!h.visible)return c;const d=h.topologyBounds;return d==null?c:c==null?d:c.merge(d)},void 0);let n;if(r!=null){const{lon0:c,lat0:h,lon1:d,lat1:u}=r,p=[[c,h],[d,u]],g=MercatorScale.bounds(p),{width:y,height:f}=s,x=Math.min(y/g.width,f/g.height),b=g.width*x,m=g.height*x,S=(y-b)/2,v=(f-m)/2,M=S,D=v,k=S+b,_=v+m,T=this.ctx.zoomManager.getAxisZoom(ChartAxisDirection24.X),w=this.ctx.zoomManager.getAxisZoom(ChartAxisDirection24.Y),R=(k-M)/(T.max-T.min),F=M-R*T.min,O=(_-D)/(1-w.min-(1-w.max)),E=D-O*(1-w.max);n=new MercatorScale(p,[[F,E],[F+R,E+O]])}for(const c of a)c.scale=n;const l=this.series.some(c=>c.visible);e.visible=l;for(const c of[e,i])c.translationX=Math.floor(s.x),c.translationY=Math.floor(s.y),c.setClipRect(s.clone());this.ctx.layoutManager.emitLayoutComplete(t,{series:{visible:l,rect:s,paddedRect:o}})}};TopologyChart.className="TopologyChart",TopologyChart.type="topology",__decorateClass([Property64],TopologyChart.prototype,"topology",2);var{isAgTopologyChartOptions,topologyChartOptionsDefs}=import_ag_charts_community179._ModuleSupport,TopologyChartModule={type:"chart",name:"topology",enterprise:!0,options:topologyChartOptionsDefs,detect:isAgTopologyChartOptions,create(t,e){return new TopologyChart(t,e)}},import_ag_charts_community181=require("ag-charts-community"),import_ag_charts_community180=require("ag-charts-community"),import_ag_charts_core78=require("ag-charts-core"),{annotationCalloutStylesDefs,annotationNoteStylesDefs,annotationTextStylesDef,annotationCommentStylesDefs,annotationMeasurerStylesDefs,annotationQuickMeasurerStylesDefs,annotationShapeStylesDefs,annotationChannelTextDefs,annotationCrossLineStyleDefs,annotationFibonacciStylesDefs,annotationLineStyleDefs,annotationLineTextDefs,annotationDisjointChannelStyleDefs,annotationParallelChannelStyleDefs}=import_ag_charts_community180._ModuleSupport,serializableDate=(0,import_ag_charts_core78.optionsDefs)({__type:(0,import_ag_charts_core78.required)((0,import_ag_charts_core78.constant)("date")),value:(0,import_ag_charts_core78.or)(import_ag_charts_core78.string,import_ag_charts_core78.number)},"a serializable date object"),xValue=(0,import_ag_charts_core78.or)(import_ag_charts_core78.string,import_ag_charts_core78.number,serializableDate),annotationValue=(0,import_ag_charts_core78.or)(xValue,(0,import_ag_charts_core78.optionsDefs)({value:xValue,groupPercentage:(0,import_ag_charts_core78.numberRange)(-1,2)})),channelAnnotationTextOptionsDef={...annotationChannelTextDefs,label:import_ag_charts_core78.string},lineAnnotationTextOptionsDef={...annotationLineTextDefs,label:import_ag_charts_core78.string},annotationPointOptionsDef={x:annotationValue,y:import_ag_charts_core78.number},annotationInitialStateOptionsDef=(0,import_ag_charts_core78.typeUnion)({line:{...annotationLineStyleDefs,start:annotationPointOptionsDef,end:annotationPointOptionsDef,text:lineAnnotationTextOptionsDef},"horizontal-line":{...annotationCrossLineStyleDefs,value:annotationValue,text:lineAnnotationTextOptionsDef},"vertical-line":{...annotationCrossLineStyleDefs,value:annotationValue,text:lineAnnotationTextOptionsDef},"disjoint-channel":{...annotationDisjointChannelStyleDefs,startHeight:import_ag_charts_core78.number,endHeight:import_ag_charts_core78.number,start:annotationPointOptionsDef,end:annotationPointOptionsDef,text:channelAnnotationTextOptionsDef},"parallel-channel":{...annotationParallelChannelStyleDefs,height:import_ag_charts_core78.number,start:annotationPointOptionsDef,end:annotationPointOptionsDef,text:channelAnnotationTextOptionsDef},"fibonacci-retracement":{...annotationFibonacciStylesDefs,start:annotationPointOptionsDef,end:annotationPointOptionsDef,text:lineAnnotationTextOptionsDef,reverse:import_ag_charts_core78.boolean},"fibonacci-retracement-trend-based":{...annotationFibonacciStylesDefs,start:annotationPointOptionsDef,end:annotationPointOptionsDef,endRetracement:annotationPointOptionsDef,text:lineAnnotationTextOptionsDef,reverse:import_ag_charts_core78.boolean},callout:{...annotationCalloutStylesDefs,start:annotationPointOptionsDef,end:annotationPointOptionsDef,text:import_ag_charts_core78.string},comment:{...annotationCommentStylesDefs,...annotationPointOptionsDef,text:import_ag_charts_core78.string},note:{...annotationNoteStylesDefs,...annotationPointOptionsDef,text:import_ag_charts_core78.string},text:{...annotationTextStylesDef,...annotationPointOptionsDef,text:import_ag_charts_core78.string},arrow:{...annotationLineStyleDefs,text:lineAnnotationTextOptionsDef,start:annotationPointOptionsDef,end:annotationPointOptionsDef},"arrow-up":{...annotationShapeStylesDefs,...annotationPointOptionsDef},"arrow-down":{...annotationShapeStylesDefs,...annotationPointOptionsDef},"date-range":{...annotationMeasurerStylesDefs,extendAbove:import_ag_charts_core78.boolean,extendBelow:import_ag_charts_core78.boolean,text:lineAnnotationTextOptionsDef,start:annotationPointOptionsDef,end:annotationPointOptionsDef},"price-range":{...annotationMeasurerStylesDefs,extendLeft:import_ag_charts_core78.boolean,extendRight:import_ag_charts_core78.boolean,text:lineAnnotationTextOptionsDef,start:annotationPointOptionsDef,end:annotationPointOptionsDef},"date-price-range":{...annotationMeasurerStylesDefs,text:lineAnnotationTextOptionsDef,start:annotationPointOptionsDef,end:annotationPointOptionsDef},"quick-date-price-range":{...annotationMeasurerStylesDefs,...annotationQuickMeasurerStylesDefs,text:lineAnnotationTextOptionsDef,start:annotationPointOptionsDef,end:annotationPointOptionsDef}},"an annotation initial state object"),initialStateOptionsDef={chartType:(0,import_ag_charts_core78.union)("candlestick","hollow-candlestick","ohlc","line","step-line","hlc","high-low"),annotations:(0,import_ag_charts_core78.arrayOfDefs)(annotationInitialStateOptionsDef),legend:(0,import_ag_charts_core78.arrayOfDefs)({visible:import_ag_charts_core78.boolean,seriesId:import_ag_charts_core78.string,itemId:import_ag_charts_core78.string,legendItemName:import_ag_charts_core78.string},"legend state array"),zoom:{rangeX:{start:(0,import_ag_charts_core78.or)(import_ag_charts_core78.number,serializableDate),end:(0,import_ag_charts_core78.or)(import_ag_charts_core78.number,serializableDate)},rangeY:{start:(0,import_ag_charts_core78.or)(import_ag_charts_core78.number,serializableDate),end:(0,import_ag_charts_core78.or)(import_ag_charts_core78.number,serializableDate)},ratioX:{start:(0,import_ag_charts_core78.and)(import_ag_charts_core78.ratio,(0,import_ag_charts_core78.lessThan)("end")),end:(0,import_ag_charts_core78.and)(import_ag_charts_core78.ratio,(0,import_ag_charts_core78.greaterThan)("start"))},ratioY:{start:(0,import_ag_charts_core78.and)(import_ag_charts_core78.ratio,(0,import_ag_charts_core78.lessThan)("end")),end:(0,import_ag_charts_core78.and)(import_ag_charts_core78.ratio,(0,import_ag_charts_core78.greaterThan)("start"))},autoScaledAxes:(0,import_ag_charts_core78.arrayOf)((0,import_ag_charts_core78.constant)("y"))}},{annotationOptionsDef}=import_ag_charts_community181._ModuleSupport,AnnotationsModule2={type:"plugin",name:"annotations",chartType:"cartesian",options:annotationOptionsDef,create(){return null}},NavigatorModule2={type:"plugin",name:"navigator",chartType:"cartesian",options:navigatorOptionsDef,create(){return null}},InitialStateModule={type:"plugin",name:"initialState",options:initialStateOptionsDef,create(){return null}},import_ag_charts_community187=require("ag-charts-community"),import_ag_charts_community185=require("ag-charts-community"),import_ag_charts_core80=require("ag-charts-core"),import_ag_charts_community182=require("ag-charts-community"),import_ag_charts_core79=require("ag-charts-core");function computeNodeGraph(t,e,i){i||(e=removeCircularLinks(e));const o=new Map;for(const a of t)o.set(a.id,{datum:a,linksBefore:[],linksAfter:[],maxPathLengthBefore:-1,maxPathLengthAfter:-1});let s=0;for(const[a,r]of o.entries())s=Math.max(s,computePathLength(o,e,r,a,-1,[])+computePathLength(o,e,r,a,1,[])+1);return{links:e,nodeGraph:o,maxPathLength:s}}function findCircularLinks(t,e,i,o){const s=o.indexOf(e);if(s!==-1){for(let r=s;r!e.has(i))}function computePathLength(t,e,i,o,s,a){if(a.includes(o))return 1/0;let r=s===-1?i.maxPathLengthBefore:i.maxPathLengthAfter;if(r===-1){r=0;const n=s===-1?i.linksBefore:i.linksAfter;for(const l of e){const{fromNode:c,toNode:h}=l,d=s===-1?h.id:c.id,u=s===-1?c.id:h.id,p=o===d?t.get(u):void 0;p!=null&&(n.push({node:p,link:l}),a?.push(o),r=Math.max(r,computePathLength(t,e,p,u,s,a)+1),a?.pop())}s===-1?i.maxPathLengthBefore=r:i.maxPathLengthAfter=r}return r}var{Series,DataController,keyProperty:keyProperty7,valueProperty:valueProperty10,Selection:Selection5,Group:Group9,TransformableText}=import_ag_charts_community182._ModuleSupport,FlowProportionSeriesNodeEvent=class extends import_ag_charts_community182._ModuleSupport.SeriesNodeEvent{constructor(t,e,i,o){super(t,e,i,o);const{datumIndex:s}=i,a=o.contextNodeData?.nodeData.find(r=>r.datumIndex.type===s.type&&r.datumIndex.index===s.index);this.size=a?.size,this.label=a?.type===1?a?.label:void 0}},FlowProportionSeries=class extends Series{constructor(){super(...arguments),this.NodeEvent=FlowProportionSeriesNodeEvent,this.nodeCount=0,this.linkCount=0,this.linksDataModel=void 0,this.linksProcessedData=void 0,this.nodesDataModel=void 0,this.nodesProcessedData=void 0,this.processedNodes=new Map,this.linkGroup=this.contentGroup.appendChild(new Group9({name:"linkGroup"})),this.nodeGroup=this.contentGroup.appendChild(new Group9({name:"nodeGroup"})),this.focusLinkGroup=this.highlightGroup.appendChild(new Group9({name:"linkGroup"})),this.focusNodeGroup=this.highlightGroup.appendChild(new Group9({name:"nodeGroup"})),this.highlightLinkGroup=this.highlightGroup.appendChild(new Group9({name:"linkGroup"})),this.highlightNodeGroup=this.highlightGroup.appendChild(new Group9({name:"nodeGroup"})),this.labelSelection=Selection5.select(this.labelGroup,TransformableText),this.linkSelection=Selection5.select(this.linkGroup,()=>this.linkFactory()),this.nodeSelection=Selection5.select(this.nodeGroup,()=>this.nodeFactory()),this.focusLinkSelection=Selection5.select(this.focusLinkGroup,()=>this.linkFactory()),this.focusNodeSelection=Selection5.select(this.focusNodeGroup,()=>this.nodeFactory()),this.highlightLinkSelection=Selection5.select(this.highlightLinkGroup,()=>this.linkFactory()),this.highlightNodeSelection=Selection5.select(this.highlightNodeGroup,()=>this.nodeFactory())}get nodes(){return this.properties.nodes}async processData(t){const{data:e,nodes:i}=this;if(e==null)return;const{fromKey:o,toKey:s,sizeKey:a,idKey:r,labelKey:n}=this.properties,l=new DataController("standalone",t.suppressFieldDotNotation),c=i==null?null:l.request(this.id,import_ag_charts_community182._ModuleSupport.DataSet.wrap(i)??import_ag_charts_community182._ModuleSupport.DataSet.empty(),{props:[keyProperty7(r,void 0,{id:"idValue",includeProperty:!1}),...n==null?[]:[valueProperty10(n,void 0,{id:"labelValue",includeProperty:!1})]],groupByKeys:!0}),h=t.request(this.id,e,{props:[valueProperty10(o,void 0,{id:"fromValue",includeProperty:!1}),valueProperty10(s,void 0,{id:"toValue",includeProperty:!1}),...a==null?[]:[valueProperty10(a,void 0,{id:"sizeValue",includeProperty:!1,missingValue:0})]],groupByKeys:!1});i!=null&&l.execute();const[d,u]=await Promise.all([c??Promise.resolve(null),h]);this.nodesDataModel=d?.dataModel,this.nodesProcessedData=d?.processedData,this.linksDataModel=u?.dataModel,this.linksProcessedData=u?.processedData;const p=new Map;if(d==null){const g=u.dataModel.resolveColumnById(this,"fromValue",u.processedData),y=u.dataModel.resolveColumnById(this,"toValue",u.processedData),f=b=>{const m=p.size,S=b;return{series:this,itemId:void 0,datum:{},datumIndex:{type:1,index:m},type:1,index:m,linksBefore:[],linksAfter:[],id:b,size:0,label:S,style:this.getNodeStyle({datumIndex:{type:1,index:m},datum:{},size:0,label:S},m,!1)}},x=u.processedData.dataSources.get(this.id)?.data;if(x)for(const[b]of x.entries()){const m=g[b],S=y[b];m==null||S==null||(p.has(m)||p.set(m,f(m)),p.has(S)||p.set(S,f(S)))}}else{const g=d.dataModel.resolveColumnById(this,"idValue",d.processedData),y=n==null?void 0:d.dataModel.resolveColumnById(this,"labelValue",d.processedData),f=d.processedData.dataSources.get(this.id)?.data;if(f)for(const[x,b]of f.entries()){const m=g[x],S=y?.[x],v={type:1,index:x};p.set(m,{series:this,itemId:void 0,datum:b,datumIndex:v,type:1,index:x,linksBefore:[],linksAfter:[],id:m,size:0,label:S,style:this.getNodeStyle({datumIndex:v,datum:b,size:0,label:S},x,!1)})}}this.processedNodes=p}getNodeGraph(t,e,{includeCircularReferences:i}){const{linksDataModel:o,linksProcessedData:s}=this;if(o==null||s==null){const{links:y,nodeGraph:f,maxPathLength:x}=computeNodeGraph(new Map().values(),[],i);return this.nodeCount=0,this.linkCount=0,{nodeGraph:f,links:y,maxPathLength:x}}const{sizeKey:a}=this.properties,r=o.resolveColumnById(this,"fromValue",s),n=o.resolveColumnById(this,"toValue",s),l=a==null?void 0:o.resolveColumnById(this,"sizeValue",s),c=new Map;for(const y of this.processedNodes.values()){const f=t(y);c.set(y.id,f)}const h=[],d=s.dataSources.get(this.id)?.data;if(d)for(const[y,f]of d.entries()){const x=r[y],b=n[y],m=l==null?1:l[y],S=c.get(x),v=c.get(b);if(m<=0||S==null||v==null)continue;const M={type:0,index:y},D=e({series:this,itemId:void 0,datum:f,datumIndex:M,type:0,index:y,fromNode:S,toNode:v,size:m,style:this.getLinkStyle({datum:f,datumIndex:M},S.datumIndex,!1)});h.push(D)}const{links:u,nodeGraph:p,maxPathLength:g}=computeNodeGraph(c.values(),h,i);for(const y of p.values())y.datum.linksBefore=y.linksBefore.map(f=>f.link),y.datum.linksAfter=y.linksAfter.map(f=>f.link);return this.nodeCount=p.size,this.linkCount=u.length,{nodeGraph:p,links:u,maxPathLength:g}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(t){const{seriesRect:e}=t,i={seriesRectWidth:e?.width??0,seriesRectHeight:e?.height??0};(this._nodeDataDependencies==null||this._nodeDataDependencies.seriesRectWidth!==i.seriesRectWidth||this._nodeDataDependencies.seriesRectHeight!==i.seriesRectHeight)&&(this._nodeDataDependencies=i),this.updateSelections();const o=this.contextNodeData?.nodeData??[],s=this.contextNodeData?.labelData??[];let a=this.ctx.highlightManager?.getActiveHighlight();if(a?.series===this&&a.type==null){const{itemId:h}=a;a=h==null?void 0:o.find(d=>d.type===1&&d.id===h)}else a?.series!==this&&(a=void 0);this.contentGroup.visible=this.visible,this.contentGroup.opacity=a==null?1:this.properties.highlight.unhighlightedItem.opacity??1,this.labelSelection=this.updateLabelSelection({labelData:s,labelSelection:this.labelSelection}),this.updateLabelNodes({labelSelection:this.labelSelection}),this.linkSelection=this.updateLinkSelection({nodeData:o.filter(h=>h.type===0),datumSelection:this.linkSelection}),this.updateLinkNodes({datumSelection:this.linkSelection,isHighlight:!1}),this.nodeSelection=this.updateNodeSelection({nodeData:o.filter(h=>h.type===1),datumSelection:this.nodeSelection}),this.updateNodeNodes({datumSelection:this.nodeSelection,isHighlight:!1});let r,n,l,c;a?.type===1?(r=o.filter(h=>h.type===0&&(h.toNode===a||h.fromNode===a)),n=r.map(h=>h.fromNode===a?h.toNode:h.fromNode),n.push(a),l=[],c=[a]):a?.type===0?(r=[a],n=[a.fromNode,a.toNode],l=[a],c=[]):(r=[],n=[],l=[],c=[]),this.focusLinkSelection=this.updateLinkSelection({nodeData:r,datumSelection:this.focusLinkSelection}),this.updateLinkNodes({datumSelection:this.focusLinkSelection,isHighlight:!1}),this.focusNodeSelection=this.updateNodeSelection({nodeData:n,datumSelection:this.focusNodeSelection}),this.updateNodeNodes({datumSelection:this.focusNodeSelection,isHighlight:!1}),this.highlightLinkSelection=this.updateLinkSelection({nodeData:l,datumSelection:this.highlightLinkSelection}),this.updateLinkNodes({datumSelection:this.highlightLinkSelection,isHighlight:!0}),this.highlightNodeSelection=this.updateNodeSelection({nodeData:c,datumSelection:this.highlightNodeSelection}),this.updateNodeNodes({datumSelection:this.highlightNodeSelection,isHighlight:!0})}resetAnimation(t){}dataCount(){return Number.NaN}getSeriesDomain(t){return[]}getSeriesRange(t,e){return[Number.NaN,Number.NaN]}legendItemSymbol(t,e,i={}){const{fills:o,strokes:s}=this.properties,{fill:a=o[e%o.length],fillOpacity:r=1,stroke:n=s[e%s.length],strokeWidth:l=0,strokeOpacity:c=1,lineDash:h=[0],lineDashOffset:d=0}=i;return{marker:{fill:a,fillOpacity:r,stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}}}getLegendData(t){if(t!=="category")return[];const{showInLegend:e}=this.properties;return Array.from(this.processedNodes.values(),({id:i,label:o},s)=>({legendType:"category",id:this.id,itemId:i,seriesId:this.id,enabled:!0,label:{text:o??i},symbol:this.legendItemSymbol(1,s),hideInLegend:!e,isFixed:!0}))}pickNodeClosestDatum({x:t,y:e}){let i=1/0,o;return this.linkSelection.each((s,a)=>{const r=s.distanceSquared(t,e);r{const r=s.distanceSquared(t,e);rh.datum),c=n.indexOf(o)+e;c>=0&&c0?s=n.at(-1):s=Array.from(this.nodeSelection,d=>d.datum).at(-1)}else if(o?.type===1){const n=Array.from(this.nodeSelection,h=>h.datum),c=n.indexOf(o)+e;c>=0&&cd.datum)[0]}if(s==null)return;const a=s.type===1?Array.from(this.nodeSelection).find(n=>n.datum===s):Array.from(this.linkSelection).find(n=>n.datum===s);if(a==null)return;const r=this.computeFocusBounds(a.node);if(r!=null)return{datum:a.datum,datumIndex:this.contextNodeData?.nodeData.indexOf(a.datum)??0,otherIndex:0,bounds:r,clipFocusBox:!0}}getCategoryValue(t){}datumIndexForCategoryValue(t){}},import_ag_charts_community183=require("ag-charts-community"),{Path:Path9,SceneChangeDetection:SceneChangeDetection7}=import_ag_charts_community183._ModuleSupport;function bezierControlPoints({radius:t,startAngle:e,endAngle:i,tension:o}){const s=t*Math.cos(e),a=t*Math.sin(e),r=t*Math.cos(i),n=t*Math.sin(i),l=s*o,c=a*o,h=r*o,d=n*o;return{x:[s,l,h,r],y:[a,c,d,n]}}var ChordLink=class extends Path9{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.radius=0,this.startAngle1=0,this.endAngle1=0,this.startAngle2=0,this.endAngle2=0,this.tension=1}tensionedCurveTo(t,e,i,o,s,a,r,n){const{path:l,tension:c}=this,h=1-c;l.cubicCurveTo((i-t)*h+t,(o-e)*h+e,(s-r)*h+r,(a-n)*h+n,r,n)}updatePath(){const{path:t,centerX:e,centerY:i,radius:o}=this;let{startAngle1:s,endAngle1:a,startAngle2:r,endAngle2:n}=this;s>r&&([s,r]=[r,s],[a,n]=[n,a]),t.clear();const l=e+o*Math.cos(s),c=i+o*Math.sin(s);t.moveTo(l,c),this.tensionedCurveTo(l,c,e,i,e,i,e+o*Math.cos(n),i+o*Math.sin(n)),t.arc(e,i,o,n,r,!0),this.tensionedCurveTo(e+o*Math.cos(r),i+o*Math.sin(r),e,i,e,i,e+o*Math.cos(a),i+o*Math.sin(a)),t.arc(e,i,o,a,s,!0),t.closePath()}};__decorateClass([SceneChangeDetection7()],ChordLink.prototype,"centerX",2),__decorateClass([SceneChangeDetection7()],ChordLink.prototype,"centerY",2),__decorateClass([SceneChangeDetection7()],ChordLink.prototype,"radius",2),__decorateClass([SceneChangeDetection7()],ChordLink.prototype,"startAngle1",2),__decorateClass([SceneChangeDetection7()],ChordLink.prototype,"endAngle1",2),__decorateClass([SceneChangeDetection7()],ChordLink.prototype,"startAngle2",2),__decorateClass([SceneChangeDetection7()],ChordLink.prototype,"endAngle2",2),__decorateClass([SceneChangeDetection7()],ChordLink.prototype,"tension",2);var import_ag_charts_community184=require("ag-charts-community"),{FillGradientDefaults:FillGradientDefaults2,FillPatternDefaults:FillPatternDefaults2,FillImageDefaults:FillImageDefaults2,BaseProperties:BaseProperties24,makeSeriesTooltip:makeSeriesTooltip8,SeriesProperties,Property:Property65,Label:Label6}=import_ag_charts_community184._ModuleSupport,ChordSeriesLabelProperties=class extends Label6{constructor(){super(...arguments),this.spacing=1,this.maxWidth=1}};__decorateClass([Property65],ChordSeriesLabelProperties.prototype,"spacing",2),__decorateClass([Property65],ChordSeriesLabelProperties.prototype,"maxWidth",2);var ChordSeriesLinkProperties=class extends BaseProperties24{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0,this.tension=0}getStyle(t,e,i){const{fillOpacity:o,strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n,tension:l}=this,c=this.fill??t[i%t.length],h=this.stroke??e[i%t.length];return{fill:c,fillOpacity:o,stroke:h,strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n,tension:l}}};__decorateClass([Property65],ChordSeriesLinkProperties.prototype,"fill",2),__decorateClass([Property65],ChordSeriesLinkProperties.prototype,"fillOpacity",2),__decorateClass([Property65],ChordSeriesLinkProperties.prototype,"stroke",2),__decorateClass([Property65],ChordSeriesLinkProperties.prototype,"strokeOpacity",2),__decorateClass([Property65],ChordSeriesLinkProperties.prototype,"strokeWidth",2),__decorateClass([Property65],ChordSeriesLinkProperties.prototype,"lineDash",2),__decorateClass([Property65],ChordSeriesLinkProperties.prototype,"lineDashOffset",2),__decorateClass([Property65],ChordSeriesLinkProperties.prototype,"tension",2),__decorateClass([Property65],ChordSeriesLinkProperties.prototype,"itemStyler",2);var ChordSeriesNodeProperties=class extends BaseProperties24{constructor(){super(...arguments),this.spacing=1,this.width=1,this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(t,e,i){const{fillOpacity:o,strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n}=this,l=this.fill??t[i%t.length],c=this.stroke??e[i%t.length];return{fill:l,fillOpacity:o,stroke:c,strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n}}};__decorateClass([Property65],ChordSeriesNodeProperties.prototype,"spacing",2),__decorateClass([Property65],ChordSeriesNodeProperties.prototype,"width",2),__decorateClass([Property65],ChordSeriesNodeProperties.prototype,"fill",2),__decorateClass([Property65],ChordSeriesNodeProperties.prototype,"fillOpacity",2),__decorateClass([Property65],ChordSeriesNodeProperties.prototype,"stroke",2),__decorateClass([Property65],ChordSeriesNodeProperties.prototype,"strokeOpacity",2),__decorateClass([Property65],ChordSeriesNodeProperties.prototype,"strokeWidth",2),__decorateClass([Property65],ChordSeriesNodeProperties.prototype,"lineDash",2),__decorateClass([Property65],ChordSeriesNodeProperties.prototype,"lineDashOffset",2),__decorateClass([Property65],ChordSeriesNodeProperties.prototype,"itemStyler",2);var ChordSeriesProperties=class extends SeriesProperties{constructor(){super(),this.idKey="",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.sizeKey=void 0,this.sizeName=void 0,this.nodes=void 0,this.fillGradientDefaults=new FillGradientDefaults2,this.fillPatternDefaults=new FillPatternDefaults2,this.fillImageDefaults=new FillImageDefaults2,this.fills=[],this.strokes=[],this.label=new ChordSeriesLabelProperties,this.link=new ChordSeriesLinkProperties,this.node=new ChordSeriesNodeProperties,this.tooltip=makeSeriesTooltip8(),this.highlightStyle.deprecated=!1}};__decorateClass([Property65],ChordSeriesProperties.prototype,"fromKey",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"toKey",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"idKey",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"idName",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"labelKey",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"labelName",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"sizeKey",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"sizeName",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"nodes",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"fillGradientDefaults",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"fillPatternDefaults",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"fillImageDefaults",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"fills",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"strokes",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"label",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"link",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"node",2),__decorateClass([Property65],ChordSeriesProperties.prototype,"tooltip",2);var{SeriesNodePickMode:SeriesNodePickMode6,createDatumId:createDatumId6,angleBetween:angleBetween2,normalizeAngle360:normalizeAngle3604,isBetweenAngles,Sector:Sector3,evaluateBezier,applyShapeStyle:applyShapeStyle7,getShapeStyle,getLabelStyles,BBox:BBox16,mergeDefaults:mergeDefaults10}=import_ag_charts_community185._ModuleSupport,nodeMidAngle=t=>t.startAngle+angleBetween2(t.startAngle,t.endAngle)/2,ChordSeries=class extends FlowProportionSeries{constructor(t){super({moduleCtx:t,pickModes:[SeriesNodePickMode6.NEAREST_NODE,SeriesNodePickMode6.EXACT_SHAPE_MATCH]}),this.properties=new ChordSeriesProperties}isLabelEnabled(){return(this.properties.labelKey!=null||this.nodes==null)&&this.properties.label.enabled}linkFactory(){return new ChordLink}nodeFactory(){return new Sector3}createNodeData(){const{id:t,_nodeDataDependencies:{seriesRectWidth:e,seriesRectHeight:i}={seriesRectWidth:0,seriesRectHeight:0},properties:o}=this,{fromKey:s,toKey:a,sizeKey:r,labelKey:n,label:{spacing:l,maxWidth:c,fontSize:h},node:{width:d,spacing:u}}=o,p=e/2,g=i/2;let y=[];const{nodeGraph:f,links:x}=this.getNodeGraph(E=>({...E,centerX:p,centerY:g,innerRadius:Number.NaN,outerRadius:Number.NaN,startAngle:Number.NaN,endAngle:Number.NaN}),E=>({...E,centerX:p,centerY:g,radius:Number.NaN,startAngle1:Number.NaN,endAngle1:Number.NaN,startAngle2:Number.NaN,endAngle2:Number.NaN}),{includeCircularReferences:!0});let b=0;for(const[E,{datum:I,linksBefore:C,linksAfter:L}]of f.entries()){const A=C.reduce((P,{link:z})=>P+z.size,0)+L.reduce((P,{link:z})=>P+z.size,0);if(A===0)f.delete(E);else{const{label:P}=o;I.size=A,b+=I.size;const z=P.enabled?this.getLabelText(I.label,I.datum,n,"label",[],P,{datum:I.datum,value:I.label,fromKey:s,toKey:a,sizeKey:r,size:I.size}):void 0;I.label=(0,import_ag_charts_core80.toPlainText)(z)}}let m=0;if(this.isLabelEnabled()){const E=(0,import_ag_charts_core80.cachedTextMeasurer)(this.properties.label);let I=0;for(const{datum:C}of f.values()){const{id:L,label:A}=C;if(A==null)continue;const P=(0,import_ag_charts_core80.wrapText)(A,{maxWidth:c,font:this.properties.label,textWrap:"never"}),{width:z}=E.measureLines(P);I=Math.max(z,I),y.push({id:L,text:P,centerX:p,centerY:g,angle:Number.NaN,radius:Number.NaN,size:C.size})}m=I+l}const S=f.size;let v=Math.min(e,i)/2-d-m,M=u/v;if(m!==0&&(S*M>=1.5*Math.PI||v<=0)&&(y=[],v=Math.min(e,i)/2-d,M=u/v),S*M>=2*Math.PI||v<=0){import_ag_charts_core80.Logger.warnOnce("There was insufficient space to display the Chord Series.");return}const D=v,k=v+d,_=Math.max((2*Math.PI-S*M)/b,0);let T=0;for(const{datum:E}of f.values()){E.innerRadius=D,E.outerRadius=k,E.startAngle=T,E.endAngle=T+E.size*_,T=E.endAngle+M;const I=(E.innerRadius+E.outerRadius)/2,C=nodeMidAngle(E);E.midPoint={x:E.centerX+I*Math.cos(C),y:E.centerY+I*Math.sin(C)}}const w=[];for(const{datum:E,linksBefore:I,linksAfter:C}of f.values()){const L=nodeMidAngle(E),A=[...I.map(z=>({link:z.link,distance:angleBetween2(nodeMidAngle(z.node.datum),L),after:!1})),...C.map(z=>({link:z.link,distance:angleBetween2(nodeMidAngle(z.node.datum),L),after:!0}))];let P=E.startAngle;for(const{link:z,after:B}of A.toSorted((V,W)=>V.distance-W.distance)){const V=z.size*_;B?(z.startAngle1=P,z.endAngle1=P+V):(z.startAngle2=P,z.endAngle2=P+V),P+=z.size*_}w.push(E)}const{tension:R}=this.properties.link;for(const E of x){E.radius=v;const I=bezierControlPoints({radius:v,startAngle:E.startAngle1,endAngle:E.endAngle2,tension:R}),C=bezierControlPoints({radius:v,startAngle:E.startAngle2,endAngle:E.endAngle1,tension:R}),L=evaluateBezier(...I.x,.5),A=evaluateBezier(...I.y,.5),P=evaluateBezier(...C.x,.5),z=evaluateBezier(...C.y,.5);E.midPoint={x:E.centerX+(L+P)/2,y:E.centerY+(A+z)/2},w.push(E)}for(const E of y){const I=f.get(E.id)?.datum;I!=null&&(E.radius=k+l,E.angle=normalizeAngle3604(I.startAngle+angleBetween2(I.startAngle,I.endAngle)/2))}y.sort((E,I)=>E.angle-I.angle);let F=1/0,O=-1/0;return y=y.filter(E=>{const I=(0,import_ag_charts_core80.calcLineHeight)(h),C=Math.atan2(I/2,E.radius),L=E.angle-C,A=E.angle+C;return isBetweenAngles(F,L,A)||isBetweenAngles(O,L,A)?!1:(F=Math.min(L,F),O=Math.max(A,O),!0)}),{itemId:t,nodeData:w,labelData:y}}updateLabelSelection(t){const e=this.isLabelEnabled()?t.labelData:[];return t.labelSelection.update(e)}updateLabelNodes(t){const e={toKey:this.properties.toKey,fromKey:this.properties.fromKey,sizeKey:this.properties.sizeKey,size:Number.NaN},i=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((o,{size:s,text:a,centerX:r,centerY:n,radius:l,angle:c})=>{e.size=s;const h=getLabelStyles(this,void 0,e,this.properties.label,!1,i),{fontStyle:d,fontWeight:u,fontSize:p,fontFamily:g,color:y}=h;o.visible=!0,o.translationX=r+l*Math.cos(c),o.translationY=n+l*Math.sin(c),o.text=a,o.fill=y,o.fontStyle=d,o.fontWeight=u,o.fontSize=p,o.fontFamily=g,o.textBaseline="middle",Math.cos(c)>=0?(o.textAlign="left",o.rotation=c):(o.textAlign="right",o.rotation=c-Math.PI),o.setBoxing(h)})}updateNodeSelection(t){return t.datumSelection.update(t.nodeData,void 0,e=>createDatumId6(e.type,e.id))}getNodeStyle(t,e,i){const{properties:o}=this,{fills:s,strokes:a,fillGradientDefaults:r,fillPatternDefaults:n,fillImageDefaults:l}=o,{itemStyler:c}=o.node,h=this.getHighlightStyle(i,t.datumIndex),d=mergeDefaults10(h,o.node.getStyle(s,a,e));let u=getShapeStyle(d,r,n,l);if(c!=null&&t.datumIndex!=null){const p=this.cachedDatumCallback(createDatumId6(t.datumIndex.index,"node",i?"highlight":"node"),()=>{const g=this.makeItemStylerParams(t,i,u);return this.callWithContext(c,g)});p&&(u=getShapeStyle(mergeDefaults10(p,u),r,n,l))}return u.opacity=1,u}makeItemStylerParams({datum:t,datumIndex:e,size:i=0,label:o},s,a){const{id:r}=this,n=this.ctx.highlightManager?.getActiveHighlight(),l=this.getHighlightStateString(n,s,e),c=this.filterItemStylerFillParams(a.fill)??a.fill;return{seriesId:r,datum:t,highlighted:s,highlightState:l,...a,size:i,label:o,fill:c}}updateNodeNodes(t){const{datumSelection:e,isHighlight:i}=t,o=this.getShapeFillBBox();e.each((s,a)=>{const{datumIndex:r}=a,n=this.getNodeStyle(a,r.index,i);applyShapeStyle7(s,n,o),s.centerX=a.centerX,s.centerY=a.centerY,s.innerRadius=a.innerRadius,s.outerRadius=a.outerRadius,s.startAngle=a.startAngle,s.endAngle=a.endAngle,s.inset=s.strokeWidth/2})}updateLinkSelection(t){return t.datumSelection.update(t.nodeData,void 0,e=>createDatumId6(e.type,e.index,e.fromNode.id,e.toNode.id))}getLinkStyle({datumIndex:t,datum:e},i,o){const{id:s,properties:a}=this,{fills:r,strokes:n,fillGradientDefaults:l,fillPatternDefaults:c,fillImageDefaults:h}=a,{itemStyler:d}=a.link,u=this.getHighlightStyle(o,t),p=mergeDefaults10(u,a.link.getStyle(r,n,i.index));let g=getShapeStyle(p,l,c,h);if(d!=null&&t!=null){const y=this.ctx.highlightManager?.getActiveHighlight(),f=this.cachedDatumCallback(createDatumId6(t.index,"link",o?"highlight":"node"),()=>{const x=this.getHighlightStateString(y,o,i);return this.callWithContext(d,{seriesId:s,datum:e,highlighted:o,highlightState:x,...g})});f&&(g=getShapeStyle(mergeDefaults10(f,g),l,c,h))}return g.opacity=1,g}updateLinkNodes(t){const{datumSelection:e,isHighlight:i}=t,o=this.getShapeFillBBox();e.each((s,a)=>{const r=a.fromNode.datumIndex,n=this.getLinkStyle(a,r,i);s.centerX=a.centerX,s.centerY=a.centerY,s.radius=a.radius,s.startAngle1=a.startAngle1,s.endAngle1=a.endAngle1,s.startAngle2=a.startAngle2,s.endAngle2=a.endAngle2,s.tension=n.tension,applyShapeStyle7(s,n,o)})}getShapeFillBBox(){const t=this._nodeDataDependencies?.seriesRectWidth??0,e=this._nodeDataDependencies?.seriesRectHeight??0,i=Math.min(t,e),o=(t-i)/2,s=(e-i)/2,a=new BBox16(o,s,t,e);return{series:a,axis:a}}getTooltipContent(t){const{id:e,linksProcessedData:i,nodesProcessedData:o,properties:s,ctx:{formatManager:a}}=this,{fromKey:r,toKey:n,sizeKey:l,sizeName:c,tooltip:h}=s,d=this.contextNodeData?.nodeData.find(b=>b.datumIndex.type===t.type&&b.datumIndex.index===t.index);if(d==null)return;const u=d.type===0?d.fromNode.index:d.index,p=d.type===0?`${d.fromNode.label} - ${d.toNode.label}`:d.label,g=t.type===0?i?.dataSources.get(this.id)?.data[t.index]:o?.dataSources.get(this.id)?.data[t.index],y=d.size;let f;if(d.type===0){const b=d.fromNode.datumIndex;f=this.getLinkStyle({datumIndex:t,datum:g},b,!1)}else{const b=d.label;f=this.getNodeStyle({datumIndex:t,datum:g,size:y,label:b},t.index,!1)}const x=[];if(l!=null){const b=a.format(this.callWithContext.bind(this),{type:"number",value:y,datum:g,seriesId:e,legendItemName:void 0,key:l,source:"tooltip",property:"size",domain:[],boundSeries:this.getFormatterContext("size"),fractionDigits:void 0});x.push({label:c,fallbackLabel:l,value:b??String(y)})}return this.formatTooltipWithContext(h,{title:p,symbol:this.legendItemSymbol(d.type,u,f),data:x},{seriesId:e,datum:g,title:p,fromKey:r,toKey:n,sizeKey:l,sizeName:c,size:y,...f})}computeFocusBounds(t){return t}hasItemStylers(){return this.properties.node.itemStyler!=null||this.properties.link.itemStyler!=null||this.properties.label.itemStyler!=null}};ChordSeries.className="ChordSeries",ChordSeries.type="chord";var import_ag_charts_community186=require("ag-charts-community"),import_ag_charts_core81=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs8,chordSeriesThemeableOptionsDef}=import_ag_charts_community186._ModuleSupport,chordSeriesOptionsDef={...chordSeriesThemeableOptionsDef,...commonSeriesOptionsDefs8,type:(0,import_ag_charts_core81.required)((0,import_ag_charts_core81.constant)("chord")),fromKey:(0,import_ag_charts_core81.required)(import_ag_charts_core81.string),toKey:(0,import_ag_charts_core81.required)(import_ag_charts_core81.string),sizeKey:import_ag_charts_core81.string,sizeName:import_ag_charts_core81.string};chordSeriesOptionsDef.fillGradientDefaults=(0,import_ag_charts_core81.undocumented)(import_ag_charts_core81.fillGradientDefaults),chordSeriesOptionsDef.fillPatternDefaults=(0,import_ag_charts_core81.undocumented)(import_ag_charts_core81.fillPatternDefaults),chordSeriesOptionsDef.fillImageDefaults=(0,import_ag_charts_core81.undocumented)(import_ag_charts_core81.fillImageDefaults);var ChordModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],solo:!0,identifier:"chord",moduleFactory:t=>new ChordSeries(t),themeTemplate:{series:{fills:{$palette:"fills"},strokes:{$palette:"strokes"},fillGradientDefaults:import_ag_charts_community187._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS,fillPatternDefaults:import_ag_charts_community187._ModuleSupport.FILL_PATTERN_DEFAULTS,fillImageDefaults:import_ag_charts_community187._ModuleSupport.FILL_IMAGE_DEFAULTS,highlightStyle:{series:{dimOpacity:.2}},highlight:import_ag_charts_community187._ModuleSupport.singleSeriesHighlightStyle(),label:{...import_ag_charts_community187._ModuleSupport.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:5,maxWidth:100},node:{spacing:8,width:10,strokeWidth:{$isUserOption:["./stroke",2,0]}},link:{fillOpacity:.5,strokeWidth:{$isUserOption:["./stroke",2,0]},tension:.4}},legend:{enabled:!1,toggleSeries:!1}}},ChordSeriesModule={type:"series",name:"chord",chartType:"standalone",enterprise:!0,options:chordSeriesOptionsDef,create:t=>new ChordSeries(t)},import_ag_charts_community188=require("ag-charts-community"),{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE7,CARTESIAN_POSITION:CARTESIAN_POSITION5},ThemeSymbols:{DEFAULT_SHADOW_COLOUR}}=import_ag_charts_community188._ModuleSupport,isHorizontal={$eq:[{$path:["/series/0/direction",void 0]},"horizontal"]},labelOptions={autoRotate:{$path:"/series/0/stageLabel/autoRotate"},autoRotateAngle:{$path:"/series/0/stageLabel/autoRotateAngle"},avoidCollisions:{$path:["/series/0/stageLabel/avoidCollisions",!0]},border:{$path:["/series/0/stageLabel/border"]},color:{$path:["/series/0/stageLabel/color",{$ref:"textColor"}]},cornerRadius:{$path:["/series/0/stageLabel/cornerRadius"]},enabled:{$if:[{$eq:[{$path:"/series/0/stageLabel/enabled"},void 0]},!0,{$path:"/series/0/stageLabel/enabled"}]},fill:{$path:["/series/0/stageLabel/fill"]},fillOpacity:{$path:["/series/0/stageLabel/fillOpacity"]},fontSize:{$path:["/series/0/stageLabel/fontSize",{$ref:"fontSize"}]},fontStyle:{$path:["/series/0/stageLabel/fontStyle",{$ref:"fontStyle"}]},fontWeight:{$path:["/series/0/stageLabel/fontWeight",{$ref:"fontWeight"}]},format:{$path:"/series/0/stageLabel/format"},formatter:{$path:"/series/0/stageLabel/formatter"},itemStyler:{$path:"/series/0/stageLabel/itemStyler"},minSpacing:{$path:"/series/0/stageLabel/minSpacing"},padding:{$path:["/series/0/stageLabel/padding"]},rotation:{$path:["/series/0/stageLabel/rotation",0]}},FUNNEL_SERIES_AXES=[{type:{$if:[isHorizontal,CARTESIAN_AXIS_TYPE7.NUMBER,CARTESIAN_AXIS_TYPE7.CATEGORY]},position:{$if:[isHorizontal,CARTESIAN_POSITION5.LEFT,{$if:[{$eq:[{$path:["/series/0/stageLabel/placement",void 0]},"after"]},CARTESIAN_POSITION5.RIGHT,CARTESIAN_POSITION5.LEFT]}]},label:{$if:[isHorizontal,void 0,labelOptions]}},{type:{$if:[isHorizontal,CARTESIAN_AXIS_TYPE7.CATEGORY,CARTESIAN_AXIS_TYPE7.NUMBER]},position:{$if:[isHorizontal,{$if:[{$eq:[{$path:["/series/0/stageLabel/placement",void 0]},"before"]},CARTESIAN_POSITION5.TOP,CARTESIAN_POSITION5.BOTTOM]},CARTESIAN_POSITION5.BOTTOM]},label:{$if:[isHorizontal,labelOptions,void 0]}}],FUNNEL_SERIES_THEME={series:{direction:"vertical",strokeWidth:{$isUserOption:["./strokes/0",2,0]},spacingRatio:.25,fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},[{$path:["/0",void 0,{$palette:"fills"}]}],{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",import_ag_charts_community188._ModuleSupport.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS],["pattern",import_ag_charts_community188._ModuleSupport.FILL_PATTERN_SINGLE_DEFAULTS],["image",import_ag_charts_community188._ModuleSupport.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},[{$path:["/0",void 0,{$palette:"strokes"}]}]]},label:{...import_ag_charts_community188._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},dropOff:{enabled:!0,fillOpacity:.2,strokeWidth:{$isUserOption:["./stroke",2,0]}},shadow:{enabled:!1,color:DEFAULT_SHADOW_COLOUR,xOffset:3,yOffset:3,blur:5},highlight:import_ag_charts_community188._ModuleSupport.singleSeriesHighlightStyle()},axes:{[CARTESIAN_AXIS_TYPE7.NUMBER]:{nice:!1,gridLine:{enabled:!1},crosshair:{enabled:!1},label:{enabled:!1}},[CARTESIAN_AXIS_TYPE7.CATEGORY]:{line:{enabled:!1}}}},import_ag_charts_community193=require("ag-charts-community"),import_ag_charts_community191=require("ag-charts-community"),import_ag_charts_community189=require("ag-charts-community"),{lineDistanceSquared,BBox:BBox17,Path:Path10,SceneChangeDetection:SceneChangeDetection8}=import_ag_charts_community189._ModuleSupport,delta=1e-6;function pointsEq([t,e],[i,o]){return Math.abs(t-i)<=delta&&Math.abs(e-o)<=delta}var FunnelConnector=class extends Path10{constructor(){super(...arguments),this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0}get midPoint(){const{x0:t,y0:e,x1:i,y1:o,x2:s,y2:a,x3:r,y3:n}=this;return{x:(t+i+s+r)/4,y:(e+o+a+n)/4}}distanceSquared(t,e){if(this.containsPoint(t,e))return 0;const{x0:i,y0:o,x1:s,y1:a,x2:r,y2:n,x3:l,y3:c}=this;return Math.min(lineDistanceSquared(t,e,i,o,s,a,1/0),lineDistanceSquared(t,e,s,a,r,n,1/0),lineDistanceSquared(t,e,r,n,l,c,1/0),lineDistanceSquared(t,e,l,c,i,o,1/0))}computeBBox(){const{x0:t,y0:e,x1:i,y1:o,x2:s,y2:a,x3:r,y3:n}=this,l=Math.min(t,i,s,r),c=Math.max(t,i,s,r)-l,h=Math.min(e,o,a,n),d=Math.max(e,o,a,n)-h;return new BBox17(l,h,c,d)}updatePath(){const{path:t,x0:e,y0:i,x1:o,y1:s,x2:a,y2:r,x3:n,y3:l}=this,c=[[e,i],[o,s],[a,r],[n,l]];t.clear();let h,d;for(const u of c){if(h!=null&&pointsEq(h,u)||d!=null&&pointsEq(d,u))continue;const[p,g]=u;h==null?t.moveTo(p,g):t.lineTo(p,g),h??(h=u),d=u}t.closePath()}};__decorateClass([SceneChangeDetection8()],FunnelConnector.prototype,"x0",2),__decorateClass([SceneChangeDetection8()],FunnelConnector.prototype,"y0",2),__decorateClass([SceneChangeDetection8()],FunnelConnector.prototype,"x1",2),__decorateClass([SceneChangeDetection8()],FunnelConnector.prototype,"y1",2),__decorateClass([SceneChangeDetection8()],FunnelConnector.prototype,"x2",2),__decorateClass([SceneChangeDetection8()],FunnelConnector.prototype,"y2",2),__decorateClass([SceneChangeDetection8()],FunnelConnector.prototype,"x3",2),__decorateClass([SceneChangeDetection8()],FunnelConnector.prototype,"y3",2);var import_ag_charts_community190=require("ag-charts-community"),{NODE_UPDATE_STATE_TO_PHASE_MAPPING}=import_ag_charts_community190._ModuleSupport;function connectorStartingPosition(t,e,i,o){const{x0:s,y0:a,x1:r,y1:n,x2:l,y2:c,x3:h,y3:d,opacity:u}=t;return i?{x0:(s+h)/2,y0:(a+d)/2,x1:(r+l)/2,y1:(n+c)/2,x2:(r+l)/2,y2:(n+c)/2,x3:(s+h)/2,y3:(a+d)/2,opacity:u}:{x0:(s+r)/2,y0:(a+n)/2,x1:(s+r)/2,y1:(a+n)/2,x2:(l+h)/2,y2:(c+d)/2,x3:(l+h)/2,y3:(c+d)/2,opacity:u}}function prepareConnectorAnimationFunctions(t,e){const i=a=>a==null;return{fromFn:(a,r,n)=>{n==="updated"&&i(r)?n="removed":n==="updated"&&i(a.previousDatum)&&(n="added");let l;n==="added"&&a.previousDatum==null&&e==="fade"?l={...resetConnectorSelectionsFn(a,r),opacity:0}:n==="unknown"||n==="added"?l=connectorStartingPosition(r,a.previousDatum,t,e):l={x0:a.x0,y0:a.y0,x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2,x3:a.x3,y3:a.y3,opacity:a.opacity};const c=NODE_UPDATE_STATE_TO_PHASE_MAPPING[n];return{...l,phase:c}},toFn:(a,r,n)=>{let l;return n==="removed"&&a.datum==null&&e==="fade"?l={...resetConnectorSelectionsFn(a,r),opacity:0}:n==="removed"||i(r)?l=connectorStartingPosition(r,a.previousDatum,t,e):l=resetConnectorSelectionsFn(a,r),l}}}function resetConnectorSelectionsFn(t,e){const{x0:i,y0:o,x1:s,y1:a,x2:r,y2:n,x3:l,y3:c,opacity:h}=e;return{x0:i,y0:o,x1:s,y1:a,x2:r,y2:n,x3:l,y3:c,opacity:h}}var{SeriesNodePickMode:SeriesNodePickMode7,SeriesZIndexMap,valueProperty:valueProperty11,keyProperty:keyProperty8,ChartAxisDirection:ChartAxisDirection25,updateLabelNode:updateLabelNode5,SMALLEST_KEY_INTERVAL:SMALLEST_KEY_INTERVAL4,LARGEST_KEY_INTERVAL:LARGEST_KEY_INTERVAL2,diff:diff5,fixNumericExtent:fixNumericExtent7,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation4,resetMotion:resetMotion2,resetLabelFn:resetLabelFn4,animationValidation:animationValidation6,computeBarFocusBounds:computeBarFocusBounds6,ContinuousScale:ContinuousScale7,Group:Group10,Selection:Selection6,PointerEvents:PointerEvents4,motion:motion4,checkCrisp:checkCrisp3,createDatumId:createDatumId7,applyShapeStyle:applyShapeStyle8}=import_ag_charts_community191._ModuleSupport,FunnelSeriesNodeEvent=class extends import_ag_charts_community191._ModuleSupport.SeriesNodeEvent{constructor(t,e,i,o){super(t,e,i,o),this.xKey=o.properties.stageKey,this.yKey=o.properties.valueKey}},BaseFunnelSeries=class extends import_ag_charts_community191._ModuleSupport.AbstractBarSeries{constructor({moduleCtx:t,animationResetFns:e}){super({moduleCtx:t,pickModes:[SeriesNodePickMode7.AXIS_ALIGNED,SeriesNodePickMode7.EXACT_SHAPE_MATCH],propertyKeys:{x:["stageKey"],y:["valueKey"]},propertyNames:{x:[],y:[]},categoryKey:"xValue",datumSelectionGarbageCollection:!1,animationResetFns:{datum:e.datum,label:resetLabelFn4}}),this.NodeEvent=FunnelSeriesNodeEvent,this.connectorNodeGroup=this.contentGroup.appendChild(new Group10({name:`${this.id}-series-connectorNodes`,zIndex:SeriesZIndexMap.BACKGROUND})),this.connectorSelection=Selection6.select(this.connectorNodeGroup,()=>this.connectionFactory()),this.connectorNodeGroup.pointerEvents=PointerEvents4.None}get pickModeAxis(){return"main-category"}setZIndex(t){return super.setZIndex(t),this.connectorNodeGroup.zIndex=[SeriesZIndexMap.BACKGROUND,t],!0}isVertical(){return!super.isVertical()}connectionFactory(){return new FunnelConnector}async processData(t){const{stageKey:e,valueKey:i}=this.properties,{visible:o,id:s}=this,a=(g,y,f)=>o&&this.ctx.legendManager.getItemEnabled({seriesId:s,itemId:f}),r=this.getCategoryAxis()?.scale,n=this.getValueAxis()?.scale,{isContinuousX:l,xScaleType:c,yScaleType:h}=this.getScaleInformation({xScale:r,yScale:n}),d=[];this.ctx.animationManager.isSkipped()||(this.processedData&&d.push(diff5(this.id,this.processedData)),d.push(animationValidation6()));const u=this.visible?{}:{forceValue:0},{processedData:p}=await this.requestDataModel(t,this.data,{props:[keyProperty8(e,c,{id:"xValue"}),valueProperty11(i,h,{id:"yValue",...u,validation:a,invalidValue:0}),...l?[SMALLEST_KEY_INTERVAL4,LARGEST_KEY_INTERVAL2]:[],...d],groupByKeys:!1});this.smallestDataInterval=p.reduced?.smallestKeyInterval,this.largestDataInterval=p.reduced?.largestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(t){const{processedData:e,dataModel:i,id:o,ctx:{legendManager:s}}=this;if(!e||!i)return[];const{keys:[a]}=e.domain;if(t===this.getCategoryDirection()){const r=i.resolveProcessedDataDefById(this,"xValue");return r?.def.type==="key"&&r?.def.valueType==="category"?this.hasData?a.filter((n,l)=>s.getItemEnabled({seriesId:o,itemId:l})):[]:this.padBandExtent(a)}else{const r=this.domainForClippedRange(t,["yValue"],"xValue"),n=Math.max(...r),l=[-n,n];return fixNumericExtent7(l)}}getSeriesRange(t,e){return[Number.NaN,Number.NaN]}createNodeData(){const{hasData:t,data:e,dataModel:i,groupScale:o,processedData:s,id:a,ctx:{legendManager:r}}=this,n=this.getCategoryAxis(),l=this.getValueAxis();if(!(t&&e&&n&&l&&i&&s?.type==="ungrouped"))return;const c=n.scale,h=l.scale,d=this.getBarDirection()===ChartAxisDirection25.X,{stageKey:u,valueKey:p}=this.properties,g=`${p}`,y={itemId:g,nodeData:[],labelData:[],connectorData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible},f=this.visible;if(!f)return y;const x=i.resolveKeysById(this,"xValue",s),b=i.resolveColumnById(this,"yValue",s),{barWidth:m,groupIndex:S}=this.updateGroupScale(n),v=ContinuousScale7.is(c)?m*-.5:0,M=checkCrisp3(n?.scale,n?.visibleRange,this.smallestDataInterval,this.largestDataInterval);let D;const k=s.dataSources.get(this.id)?.data??[];for(const[_,T]of k.entries()){const w=f&&r.getItemEnabled({seriesId:a,itemId:_}),R=x[_];if(R==null)continue;const F=Math.round(c.convert(R))+o.convert(String(S))+v,O=b[_],E=Math.round(h.convert(-O)),I=Math.round(h.convert(O)),C=this.getItemStyle({datum:T,datumIndex:_},!1),L=Math.max(C.strokeWidth??0,Math.abs(I-E)),A={x:d?Math.min(I,E):F,y:d?F:Math.min(I,E),width:d?L:m,height:d?m:L},P={x:A.x+A.width/2,y:A.y+A.height/2},z=this.createLabelData({datumIndex:_,rect:A,barAlongX:d,yDatum:O,datum:T,visible:w}),B={index:_,series:this,itemId:g,datum:T,datumIndex:_,xValue:R,yValue:O,xKey:u,yKey:p,x:A.x,y:A.y,width:A.width,height:A.height,midPoint:P,crisp:M,label:z,visible:w};if(y.nodeData.push(B),z!=null&&y.labelData.push(z),D!=null){const V=D.rect,W=D.nodeDatum,H=D.datumIndex;d?y.connectorData.push({datum:W,datumIndex:H,x0:V.x,y0:V.y+V.height,x1:V.x+V.width,y1:V.y+V.height,x2:A.x+A.width,y2:A.y,x3:A.x,y3:A.y,opacity:1}):y.connectorData.push({datum:W,datumIndex:H,x0:V.x+V.width,y0:V.y,x1:A.x,y1:A.y,x2:A.x,y2:A.y+A.height,x3:V.x+V.width,y3:V.y+V.height,opacity:1})}w&&(D={itemId:g,rect:A,nodeDatum:B,datumIndex:_})}return y}updateNodes(t,e){super.updateNodes(t,e);const{connectorSelection:i}=this,o=this.contextNodeData?.connectorData??[];this.connectorSelection=this.updateConnectorSelection({connectorSelection:i,connectorData:o}),this.updateConnectorNodes({connectorSelection:i})}updateDatumSelection(t){const{nodeData:e,datumSelection:i}=t,o=e??[];return i.update(o,void 0,s=>this.getDatumId(s))}updateConnectorSelection(t){const{connectorData:e,connectorSelection:i}=t;return i.update(this.connectorEnabled()?e:[],void 0,o=>this.getDatumId(o.datum))}updateConnectorNodes(t){const e=this.getShapeFillBBox();t.connectorSelection.each((i,o)=>{const{fill:s,fillOpacity:a,stroke:r,strokeOpacity:n,strokeWidth:l,lineDash:c,lineDashOffset:h}=this.connectorStyle(o.datumIndex);i.setProperties(resetConnectorSelectionsFn(i,o)),applyShapeStyle8(i,{fill:s,stroke:r,fillOpacity:a,strokeOpacity:n,strokeWidth:l,lineDash:c,lineDashOffset:h},e)})}updateLabelSelection(t){const e=this.properties.label.enabled?t.labelData:[];return t.labelSelection.update(e,i=>{i.pointerEvents=PointerEvents4.None})}updateLabelNodes(t){const e={stageKey:this.properties.stageKey,valueKey:this.properties.valueKey},i=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((o,s)=>{o.fillOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1,updateLabelNode5(this,o,e,this.properties.label,s,!1,i)})}getTooltipContent(t){const{id:e,dataModel:i,processedData:o,properties:s}=this,{stageKey:a,valueKey:r,tooltip:n,legendItemName:l}=s,c=this.getCategoryAxis(),h=this.getValueAxis();if(!i||!o||!c||!h)return;const d=o.dataSources.get(this.id)?.data[t],u=i.resolveKeysById(this,"xValue",o)[t],p=i.resolveColumnById(this,"yValue",o)[t];if(u!=null)return this.formatTooltipWithContext(n,{symbol:this.legendItemSymbol(t),data:[{label:this.getAxisValueText(c,"tooltip",u,d,a,l),value:this.getAxisValueText(h,"tooltip",p,d,r,l)}]},{seriesId:e,datum:d,title:a,stageKey:a,valueKey:r,...this.tooltipStyle(d,t)})}resetAllAnimation(t){super.resetAllAnimation(t),resetMotion2([this.connectorSelection],resetConnectorSelectionsFn)}animateEmptyUpdateReady({labelSelection:t}){const{connectorSelection:e}=this,i=this.isVertical(),s=prepareConnectorAnimationFunctions(i,"normal");motion4.fromToMotion(this.id,"connectors",this.ctx.animationManager,[e],s),seriesLabelFadeInAnimation4(this,"labels",this.ctx.animationManager,t)}animateWaitingUpdateReady(t){const{labelSelection:e}=t;this.ctx.animationManager.stopByAnimationGroupId(this.id),seriesLabelFadeInAnimation4(this,"labels",this.ctx.animationManager,e)}getDatumId(t){return createDatumId7(t.xValue)}isLabelEnabled(){return this.properties.label.enabled}computeFocusBounds({datumIndex:t}){return computeBarFocusBounds6(this,this.contextNodeData?.nodeData[t])}legendItemSymbol(t){const{strokeWidth:e,fillOpacity:i,strokeOpacity:o,lineDash:s,lineDashOffset:a,fill:r,stroke:n}=this.properties.getStyle(t);return{marker:{fill:r,fillOpacity:i,stroke:n,strokeWidth:e,strokeOpacity:o,lineDash:s,lineDashOffset:a}}}getLegendData(t){const{id:e,processedData:i,dataModel:o,ctx:{legendManager:s},visible:a}=this;if(!o||!i||t!=="category")return[];const{showInLegend:r}=this.properties,n=o.resolveKeysById(this,"xValue",i);return(i.dataSources.get(this.id)?.data??[]).map((l,c)=>{const h=n[c];if(h!=null)return{legendType:"category",id:e,datum:l,itemId:c,seriesId:e,enabled:a&&s.getItemEnabled({seriesId:e,itemId:c}),label:{text:String(h)},symbol:this.legendItemSymbol(c),skipAnimations:!0,hideInLegend:!r}}).filter(l=>l!=null)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}},import_ag_charts_community192=require("ag-charts-community"),{Label:Label7,AbstractBarSeriesProperties:AbstractBarSeriesProperties5,makeSeriesTooltip:makeSeriesTooltip9,AxisLabel:AxisLabel3,Property:Property66}=import_ag_charts_community192._ModuleSupport,ConeFunnelSeriesLabel=class extends Label7{constructor(){super(...arguments),this.spacing=0}};__decorateClass([Property66],ConeFunnelSeriesLabel.prototype,"placement",2),__decorateClass([Property66],ConeFunnelSeriesLabel.prototype,"spacing",2);var ConeFunnelSeriesStageLabel=class extends AxisLabel3{};__decorateClass([Property66],ConeFunnelSeriesStageLabel.prototype,"placement",2);var ConeFunnelProperties=class extends AbstractBarSeriesProperties5{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.label=new ConeFunnelSeriesLabel,this.stageLabel=new ConeFunnelSeriesStageLabel,this.tooltip=makeSeriesTooltip9()}getStyle(t){const{fills:e,strokes:i,fillOpacity:o,strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n}=this;return{fill:e[t],fillOpacity:o,stroke:i[t],strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n,opacity:1}}};__decorateClass([Property66],ConeFunnelProperties.prototype,"stageKey",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"valueKey",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"fills",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"fillOpacity",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"strokes",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"strokeWidth",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"strokeOpacity",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"lineDash",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"lineDashOffset",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"label",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"stageLabel",2),__decorateClass([Property66],ConeFunnelProperties.prototype,"tooltip",2);function resetLineSelectionsFn(t,{x:e,y:i,width:o,height:s,opacity:a}){return{x1:e,y1:i,x2:e+o,y2:i+s,opacity:a??1}}var{Line:Line5,ChartAxisDirection:ChartAxisDirection26}=import_ag_charts_community193._ModuleSupport,ConeFunnelSeries=class extends BaseFunnelSeries{constructor(t){super({moduleCtx:t,animationResetFns:{datum:resetLineSelectionsFn}}),this.properties=new ConeFunnelProperties}get hasData(){const{id:t,ctx:{legendManager:e}}=this,i=this.data?.data.reduce((o,s,a)=>o+(e.getItemEnabled({seriesId:t,itemId:a})?1:0),0);return i!=null&&i>1}getBandScalePadding(){return{inner:1,outer:0}}connectorEnabled(){return!0}getItemStyle({datumIndex:t},e){return this.properties.getStyle(t)}connectorStyle(t){return this.properties.getStyle(t)}nodeFactory(){return new Line5}createLabelData({datumIndex:t,rect:e,barAlongX:i,yDatum:o,datum:s,visible:a}){const{stageKey:r,valueKey:n,label:l}=this.properties,{spacing:c,placement:h}=l;if(!l.enabled)return;let d,u,p,g;if(i)switch(d=e.x+e.width/2,p="center",h){case"before":u=e.y-c,g="bottom";break;case"after":u=e.y+e.height+c,g="top";break;default:u=e.y+e.height/2,g="middle"}else switch(u=e.y+e.height/2,g="middle",h){case"before":d=e.x-c,p="right";break;case"after":d=e.x+e.width+c,p="left";break;default:d=e.x+e.width/2,p="center"}const y=this.getSeriesDomain(ChartAxisDirection26.Y),f=this.getLabelText(o,s,n,"y",y,l,{itemId:n,value:o,datum:s,stageKey:r,valueKey:n});return{x:d,y:u,textAlign:p,textBaseline:g,text:f,itemId:n,datum:s,datumIndex:t,series:this,visible:a}}updateDatumNodes(t){const e=this.getHighlightStyle(t.isHighlight);t.datumSelection.each((i,o)=>{i.setProperties(resetLineSelectionsFn(i,o)),i.stroke=e?.stroke,i.strokeWidth=e?.strokeWidth??0,i.strokeOpacity=e?.strokeOpacity??1,i.lineDash=e?.lineDash,i.lineDashOffset=e?.lineDashOffset??0,i.opacity=e?.opacity??1})}tooltipStyle(t,e){const{fill:i,stroke:o,fillOpacity:s,strokeOpacity:a,strokeWidth:r,lineDash:n,lineDashOffset:l}=this.properties.getStyle(e);return{fill:i,fillOpacity:s,stroke:o,strokeOpacity:a,strokeWidth:r,lineDash:n,lineDashOffset:l}}hasItemStylers(){return this.properties.label.itemStyler!=null}};ConeFunnelSeries.className="ConeFunnelSeries",ConeFunnelSeries.type="cone-funnel";var import_ag_charts_community194=require("ag-charts-community"),import_ag_charts_core82=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs9,coneFunnelSeriesThemeableOptionsDef,without:without3}=import_ag_charts_community194._ModuleSupport,coneFunnelSeriesOptionsDef={...without3(commonSeriesOptionsDefs9,["showInLegend"]),...coneFunnelSeriesThemeableOptionsDef,type:(0,import_ag_charts_core82.required)((0,import_ag_charts_core82.constant)("cone-funnel")),stageKey:(0,import_ag_charts_core82.required)(import_ag_charts_core82.string),valueKey:(0,import_ag_charts_core82.required)(import_ag_charts_core82.string)},import_ag_charts_community195=require("ag-charts-community"),{ThemeConstants:{CARTESIAN_AXIS_TYPE:CARTESIAN_AXIS_TYPE8}}=import_ag_charts_community195._ModuleSupport,CONE_FUNNEL_SERIES_THEME={series:{direction:"vertical",fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"secondSequentialColors"},import_ag_charts_community195._ModuleSupport.SAFE_RANGE2_OPERATION]},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",import_ag_charts_community195._ModuleSupport.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS],["pattern",import_ag_charts_community195._ModuleSupport.FILL_PATTERN_SINGLE_DEFAULTS],["image",import_ag_charts_community195._ModuleSupport.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"secondSequentialColors"},import_ag_charts_community195._ModuleSupport.SAFE_RANGE2_OPERATION]}]},strokeWidth:{$isUserOption:["./strokes/0",2,0]},label:{...import_ag_charts_community195._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},placement:"before",spacing:4},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:import_ag_charts_community195._ModuleSupport.singleSeriesHighlightStyle(!1)},seriesArea:{padding:{top:20,bottom:20}},axes:{[CARTESIAN_AXIS_TYPE8.NUMBER]:{nice:!1,gridLine:{enabled:!1},crosshair:{enabled:!1},label:{enabled:!1}},[CARTESIAN_AXIS_TYPE8.CATEGORY]:{line:{enabled:!1}}}},ConeFunnelModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"cone-funnel",moduleFactory:t=>new ConeFunnelSeries(t),solo:!0,defaultAxes:FUNNEL_SERIES_AXES,themeTemplate:CONE_FUNNEL_SERIES_THEME},ConeFunnelSeriesModule={type:"series",name:"cone-funnel",chartType:"cartesian",enterprise:!0,options:coneFunnelSeriesOptionsDef,create:t=>new ConeFunnelSeries(t)},import_ag_charts_community197=require("ag-charts-community"),import_ag_charts_community196=require("ag-charts-community"),{Label:Label8,DropShadow:DropShadow4,AbstractBarSeriesProperties:AbstractBarSeriesProperties6,BaseProperties:BaseProperties25,makeSeriesTooltip:makeSeriesTooltip10,AxisLabel:AxisLabel4,Property:Property67}=import_ag_charts_community196._ModuleSupport,FunnelSeriesLabel=class extends Label8{},FunnelSeriesStageLabel=class extends AxisLabel4{};__decorateClass([Property67],FunnelSeriesStageLabel.prototype,"placement",2);var FunnelDropOff=class extends BaseProperties25{constructor(){super(...arguments),this.enabled=!0,this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(){const{fill:t,stroke:e,fillOpacity:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r}=this;return{fill:t,fillOpacity:i,stroke:e,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r,opacity:1}}};__decorateClass([Property67],FunnelDropOff.prototype,"enabled",2),__decorateClass([Property67],FunnelDropOff.prototype,"fill",2),__decorateClass([Property67],FunnelDropOff.prototype,"fillOpacity",2),__decorateClass([Property67],FunnelDropOff.prototype,"stroke",2),__decorateClass([Property67],FunnelDropOff.prototype,"strokeWidth",2),__decorateClass([Property67],FunnelDropOff.prototype,"strokeOpacity",2),__decorateClass([Property67],FunnelDropOff.prototype,"lineDash",2),__decorateClass([Property67],FunnelDropOff.prototype,"lineDashOffset",2);var FunnelProperties=class extends AbstractBarSeriesProperties6{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.spacingRatio=0,this.dropOff=new FunnelDropOff,this.shadow=new DropShadow4().set({enabled:!1}),this.label=new FunnelSeriesLabel,this.stageLabel=new FunnelSeriesStageLabel,this.tooltip=makeSeriesTooltip10()}getStyle(t){const{fills:e,strokes:i,fillOpacity:o,strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n}=this;return{fill:e[t],fillOpacity:o,stroke:i[t],strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n,opacity:1}}};__decorateClass([Property67],FunnelProperties.prototype,"stageKey",2),__decorateClass([Property67],FunnelProperties.prototype,"valueKey",2),__decorateClass([Property67],FunnelProperties.prototype,"fills",2),__decorateClass([Property67],FunnelProperties.prototype,"fillOpacity",2),__decorateClass([Property67],FunnelProperties.prototype,"strokes",2),__decorateClass([Property67],FunnelProperties.prototype,"strokeWidth",2),__decorateClass([Property67],FunnelProperties.prototype,"strokeOpacity",2),__decorateClass([Property67],FunnelProperties.prototype,"lineDash",2),__decorateClass([Property67],FunnelProperties.prototype,"lineDashOffset",2),__decorateClass([Property67],FunnelProperties.prototype,"spacingRatio",2),__decorateClass([Property67],FunnelProperties.prototype,"itemStyler",2),__decorateClass([Property67],FunnelProperties.prototype,"dropOff",2),__decorateClass([Property67],FunnelProperties.prototype,"shadow",2),__decorateClass([Property67],FunnelProperties.prototype,"label",2),__decorateClass([Property67],FunnelProperties.prototype,"stageLabel",2),__decorateClass([Property67],FunnelProperties.prototype,"tooltip",2);var{ChartAxisDirection:ChartAxisDirection27,resetBarSelectionsFn:resetBarSelectionsFn3,prepareBarAnimationFunctions:prepareBarAnimationFunctions3,midpointStartingBarPosition:midpointStartingBarPosition2,createDatumId:createDatumId8,Rect:Rect6,motion:motion5,applyShapeStyle:applyShapeStyle9,mergeDefaults:mergeDefaults11}=import_ag_charts_community197._ModuleSupport,FunnelSeries=class extends BaseFunnelSeries{constructor(t){super({moduleCtx:t,animationResetFns:{datum:resetBarSelectionsFn3}}),this.properties=new FunnelProperties}getBandScalePadding(){return{inner:this.properties.spacingRatio,outer:0}}connectorEnabled(){return this.properties.dropOff.enabled}connectorStyle(t){return mergeDefaults11(this.properties.dropOff.getStyle(),this.properties.getStyle(t))}nodeFactory(){return new Rect6}createLabelData({datumIndex:t,rect:e,yDatum:i,datum:o,visible:s}){const{valueKey:a,stageKey:r,label:n}=this.properties;if(!n.enabled)return;const l=this.getSeriesDomain(ChartAxisDirection27.Y),c=this.getLabelText(i,o,a,"y",l,n,{itemId:a,value:i,datum:o,stageKey:r,valueKey:a});return{x:e.x+e.width/2,y:e.y+e.height/2,textAlign:"center",textBaseline:"middle",text:c,itemId:r,datum:o,datumIndex:t,series:this,visible:s}}getItemStyle({datum:t,datumIndex:e},i){const{id:o,properties:s}=this,{stageKey:a,valueKey:r,itemStyler:n}=s,l=this.getHighlightStyle(i,e);let h=mergeDefaults11(l,s.getStyle(e));if(n!=null){const d=this.ctx.highlightManager?.getActiveHighlight(),u=this.cachedDatumCallback(createDatumId8(e,i?"highlight":"node"),()=>{const p=this.getHighlightStateString(d,i,e);return this.callWithContext(n,{seriesId:o,datum:t,highlighted:i,highlightState:p,stageKey:a,valueKey:r,...h})});u&&(h=mergeDefaults11(u,h))}return h}updateDatumNodes({datumSelection:t,isHighlight:e}){const{contextNodeData:i}=this;if(!i)return;const{shadow:o}=this.properties,s=this.getCategoryDirection()===ChartAxisDirection27.X,a=this.getShapeFillBBox();t.each((r,n)=>{const l=this.getItemStyle(n,e);applyShapeStyle9(r,l,a),r.visible=s?n.width>0:n.height>0,r.crisp=n.crisp,r.fillShadow=o})}tooltipStyle(t,e){return this.getItemStyle({datum:t,datumIndex:e},!1)}animateEmptyUpdateReady(t){super.animateEmptyUpdateReady(t);const{datumSelection:e}=t,i=this.isVertical(),s=prepareBarAnimationFunctions3(midpointStartingBarPosition2(i,"normal"),"unknown");motion5.fromToMotion(this.id,"datums",this.ctx.animationManager,[e],s)}animateWaitingUpdateReady(t){super.animateWaitingUpdateReady(t);const{datumSelection:e}=t,{processedData:i}=this,o=i?.reduced?.diff?.[this.id],s=prepareBarAnimationFunctions3(midpointStartingBarPosition2(this.isVertical(),"fade"),"added");motion5.fromToMotion(this.id,"datums",this.ctx.animationManager,[e],s,(a,r)=>r.xValue,o)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};FunnelSeries.className="FunnelSeries",FunnelSeries.type="funnel";var import_ag_charts_community198=require("ag-charts-community"),import_ag_charts_core83=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs10,funnelSeriesThemeableOptionsDef,without:without4}=import_ag_charts_community198._ModuleSupport,funnelSeriesOptionsDef={...funnelSeriesThemeableOptionsDef,...without4(commonSeriesOptionsDefs10,["showInLegend"]),type:(0,import_ag_charts_core83.required)((0,import_ag_charts_core83.constant)("funnel")),stageKey:(0,import_ag_charts_core83.required)(import_ag_charts_core83.string),valueKey:(0,import_ag_charts_core83.required)(import_ag_charts_core83.string)},FunnelModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"funnel",moduleFactory:t=>new FunnelSeries(t),solo:!0,defaultAxes:FUNNEL_SERIES_AXES,themeTemplate:FUNNEL_SERIES_THEME},FunnelSeriesModule={type:"series",name:"funnel",chartType:"cartesian",enterprise:!0,options:funnelSeriesOptionsDef,create:t=>new FunnelSeries(t)},import_ag_charts_community203=require("ag-charts-community"),import_ag_charts_community202=require("ag-charts-community"),import_ag_charts_core88=require("ag-charts-core"),DatumUnion=class{*[Symbol.iterator](){const{node:t,datum:e}=this;t&&e&&(yield{node:t,datum:e})}nodes(){return this.node?[this.node]:[]}update(t,e,i,o){const s=t.nodes();if(s.length===0)this.node?.remove(),this.node=void 0;else{this.node===void 0&&(this.node=new i,this.node.fillOpacity=0,this.node.strokeOpacity=0,e.appendChild(this.node));const a=s[0],r=s.toReversed().find(n=>n.datum.datum.value>n.datum.datum.segmentStart)??s.at(-1);this.node.datum=this.datum=a.datum,o(this.node,a,r)}}},import_ag_charts_core84=require("ag-charts-core"),fadeInFns={fromFn:()=>({opacity:0,phase:"initial"}),toFn:()=>({opacity:1})};function formatLabel(t,e){if(t==null)return"";const{min:i,max:o}=e,s=i===0?0:Math.ceil(Math.log10(Math.abs(i))),a=o===0?0:Math.ceil(Math.log10(Math.abs(o))),r=Math.max(2-Math.max(s,a),0);return t.toFixed(r)}function getLabelText(t,e,i,o){if(i.text!=null)return i.text;const s=o??i.value;let a;return i?.formatter!=null&&(a=formatWithContext(e,i.formatter,{seriesId:t,datum:void 0,value:s})),a==null||(0,import_ag_charts_core84.isArray)(a)?a:String(a)}function lineMarker({path:t,x:e,y:i,size:o}){t.moveTo(e,i-o/2),t.lineTo(e,i+o/2)}var import_ag_charts_core85=require("ag-charts-core");function pickGaugeNearestDatum(t,e){const i=(0,import_ag_charts_core85.iterate)(t.datumUnion.nodes(),t.targetSelection.nodes());return t.pickNodeNearestDistantObject(e,i)}function pickGaugeFocus(t,e){const i=[{data:t.contextNodeData?.nodeData,selection:t.datumUnion},{data:t.contextNodeData?.targetData,selection:t.targetSelection}].filter(l=>l.data&&l.data.length>0),o=(0,import_ag_charts_core85.clamp)(0,e.otherIndex+e.otherIndexDelta,i.length-1);if(i.length===0)return;const{data:s,selection:a}=i[o];if(s==null||s.length===0)return;const r=(0,import_ag_charts_core85.clamp)(0,e.datumIndex,s.length-1),n=s[r];for(const l of a)if(l.datum===n)return{bounds:l.node,clipFocusBox:!0,datum:n,datumIndex:r,otherIndex:o}}var import_ag_charts_community200=require("ag-charts-community"),import_ag_charts_community199=require("ag-charts-community"),import_ag_charts_core86=require("ag-charts-core"),{BaseProperties:BaseProperties26,Property:Property68}=import_ag_charts_community199._ModuleSupport,GaugeSegmentationIntervalProperties=class extends BaseProperties26{getSegments(t,e){const{values:i,step:o,count:s}=this,a=Math.min(...t.domain),r=Math.max(...t.domain);let n;if(i!=null){const l=i.filter(c=>c>a&&cc-h);n=[a,...l,r]}else if(o!=null){const l=[];for(let c=a;cc>a&&ch/l*(r-a)+a)}return n!=null&&n.length>e&&(import_ag_charts_core86.Logger.warnOnce("the configured segmentation results in more than 1 item per pixel, ignoring. Supply a segmentation configuration that results in larger segments or omit this configuration"),n=void 0),n??(n=[a,r]),n}};__decorateClass([Property68],GaugeSegmentationIntervalProperties.prototype,"values",2),__decorateClass([Property68],GaugeSegmentationIntervalProperties.prototype,"step",2),__decorateClass([Property68],GaugeSegmentationIntervalProperties.prototype,"count",2);var GaugeSegmentationProperties=class extends BaseProperties26{constructor(){super(...arguments),this.enabled=!1,this.interval=new GaugeSegmentationIntervalProperties,this.spacing=0}};__decorateClass([Property68],GaugeSegmentationProperties.prototype,"enabled",2),__decorateClass([Property68],GaugeSegmentationProperties.prototype,"interval",2),__decorateClass([Property68],GaugeSegmentationProperties.prototype,"spacing",2);var{BaseProperties:BaseProperties27,makeSeriesTooltip:makeSeriesTooltip11,SeriesProperties:SeriesProperties2,PropertiesArray:PropertiesArray7,Property:Property69,Label:Label9,AxisLabel:AxisLabel5,getColorStops}=import_ag_charts_community200._ModuleSupport,LinearGaugeDefaultTargetLabelProperties=class extends Label9{};__decorateClass([Property69],LinearGaugeDefaultTargetLabelProperties.prototype,"spacing",2);var LinearGaugeTargetProperties=class extends BaseProperties27{constructor(){super(...arguments),this.value=0,this.label=new LinearGaugeDefaultTargetLabelProperties}getStyle(t){const{fill:e=t.fill??"black",fillOpacity:i=t.fillOpacity??1,stroke:o=t.stroke??"black",strokeWidth:s=t.strokeWidth??0,strokeOpacity:a=t.strokeOpacity??1,lineDash:r=t.lineDash??[0],lineDashOffset:n=t.lineDashOffset??0}=this;return{fill:e,fillOpacity:i,stroke:o,strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n}}};__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"text",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"value",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"shape",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"placement",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"spacing",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"size",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"rotation",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"fill",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"fillOpacity",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"stroke",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"strokeWidth",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"strokeOpacity",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"lineDash",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"lineDashOffset",2),__decorateClass([Property69],LinearGaugeTargetProperties.prototype,"label",2);var LinearGaugeBarProperties=class extends BaseProperties27{constructor(){super(...arguments),this.enabled=!0,this.thicknessRatio=1,this.fills=new PropertiesArray7(import_ag_charts_community200._ModuleSupport.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(t,e,i){const{fill:o,fills:s,fillMode:a,fillOpacity:r,stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}=this;return{fill:o??createLinearGradient(s,a,t,i,e),fillOpacity:r,stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}}};__decorateClass([Property69],LinearGaugeBarProperties.prototype,"enabled",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"thickness",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"thicknessRatio",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"fills",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"fillMode",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"fill",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"fillOpacity",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"stroke",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"strokeWidth",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"strokeOpacity",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"lineDash",2),__decorateClass([Property69],LinearGaugeBarProperties.prototype,"lineDashOffset",2);var LinearGaugeScaleIntervalProperties=class extends BaseProperties27{constructor(){super(...arguments),this.values=void 0,this.step=void 0,this.minSpacing=0,this.maxSpacing=1e3}};__decorateClass([Property69],LinearGaugeScaleIntervalProperties.prototype,"values",2),__decorateClass([Property69],LinearGaugeScaleIntervalProperties.prototype,"step",2),__decorateClass([Property69],LinearGaugeScaleIntervalProperties.prototype,"minSpacing",2),__decorateClass([Property69],LinearGaugeScaleIntervalProperties.prototype,"maxSpacing",2);var LinearGaugeScaleLabelProperties=class extends AxisLabel5{constructor(){super(...arguments),this.placement=void 0}};__decorateClass([Property69],LinearGaugeScaleLabelProperties.prototype,"placement",2);var LinearGaugeScaleProperties=class extends BaseProperties27{constructor(){super(...arguments),this.min=0,this.max=1,this.fills=new PropertiesArray7(import_ag_charts_community200._ModuleSupport.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.defaultFill="black",this.interval=new LinearGaugeScaleIntervalProperties,this.label=new LinearGaugeScaleLabelProperties}getStyle(t,e,i,o){const{fill:s,fills:a,defaultFill:r,fillMode:n,fillOpacity:l,stroke:c,strokeWidth:h,strokeOpacity:d,lineDash:u,lineDashOffset:p}=this;return{fill:s??(t&&a.length===0?r:void 0)??createLinearGradient(a,n,e,o,i),fillOpacity:l,stroke:c,strokeWidth:h,strokeOpacity:d,lineDash:u,lineDashOffset:p}}};__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"min",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"max",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"fills",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"fillMode",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"fill",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"fillOpacity",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"stroke",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"strokeWidth",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"strokeOpacity",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"lineDash",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"lineDashOffset",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"defaultFill",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"interval",2),__decorateClass([Property69],LinearGaugeScaleProperties.prototype,"label",2);var LinearGaugeLabelProperties=class extends AutoSizedLabel{constructor(){super(...arguments),this.placement="inside-center",this.avoidCollisions=!0}};__decorateClass([Property69],LinearGaugeLabelProperties.prototype,"text",2),__decorateClass([Property69],LinearGaugeLabelProperties.prototype,"placement",2),__decorateClass([Property69],LinearGaugeLabelProperties.prototype,"avoidCollisions",2);var LinearGaugeSeriesProperties=class extends SeriesProperties2{constructor(){super(...arguments),this.value=0,this.segmentation=new GaugeSegmentationProperties,this.defaultColorRange=[],this.targets=new PropertiesArray7(LinearGaugeTargetProperties),this.defaultTarget=new LinearGaugeTargetProperties,this.defaultScale=new LinearGaugeScaleProperties,this.direction="vertical",this.thickness=1,this.cornerRadius=0,this.cornerMode="container",this.margin=0,this.scale=new LinearGaugeScaleProperties,this.bar=new LinearGaugeBarProperties,this.label=new LinearGaugeLabelProperties,this.tooltip=makeSeriesTooltip11()}};__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"value",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"segmentation",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"defaultColorRange",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"targets",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"defaultTarget",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"defaultScale",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"direction",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"thickness",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"cornerMode",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"margin",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"scale",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"bar",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"label",2),__decorateClass([Property69],LinearGaugeSeriesProperties.prototype,"tooltip",2);function createLinearGradient(t,e,i,o,s){return{type:"gradient",gradient:"linear",colorSpace:"oklch",colorStops:getColorStops(t,i,o.domain,e),rotation:s?90:0,bounds:"series"}}var import_ag_charts_community201=require("ag-charts-community"),import_ag_charts_core87=require("ag-charts-core"),{BBox:BBox18}=import_ag_charts_community201._ModuleSupport;function datumRect(t){const{x0:e,y0:i,x1:o,y1:s,horizontalInset:a,verticalInset:r}=t,n=Math.min(e,o)+a,l=Math.min(i,s)+r,c=Math.max(Math.abs(o-e)-2*a,0),h=Math.max(Math.abs(s-i)-2*r,0);return{x:n,y:l,width:c,height:h}}function clipBBoxVisibility(t,e){if(e==null)return!0;const i=datumRect(t),o=1e-6,s=i.x+o,a=i.y+o,r=i.x+i.width-o,n=i.y+i.height-o,l=e.x,c=e.x+e.width,h=e.y,d=e.y+e.height;return Math.max(s,l)<=Math.min(r,c)&&Math.max(a,h)<=Math.min(n,d)}function hasClipBBox(t){const{clipX0:e,clipX1:i,clipY0:o,clipY1:s}=t;return e!=null&&i!=null||o!=null&&s!=null}function computeClipBBox(t){if(!hasClipBBox(t))return;const{x0:e,y0:i,x1:o,y1:s}=t,{x:a,y:r,width:n,height:l}=datumRect(t);let{clipX0:c,clipX1:h,clipY0:d,clipY1:u}=t;(c==null||h==null)&&(c=e,h=o),(d==null||u==null)&&(d=i,u=s);const p=Math.min(c,h),g=Math.min(d,u),y=Math.abs(h-c),f=Math.abs(u-d);return c=Math.max(a,p),d=Math.max(r,g),h=Math.min(a+n,p+y),u=Math.min(r+l,g+f),new BBox18(Math.min(c,h),Math.min(d,u),Math.abs(h-c),Math.abs(u-d))}function prepareLinearGaugeSeriesAnimationFunctions(t,e){const i=t?"initial":"update";return{node:{fromFn(s,a){const r=s.previousDatum;let{x0:n,y0:l,x1:c,y1:h,clipX0:d,clipY0:u,clipX1:p,clipY1:g}=r??a;const{horizontalInset:y,verticalInset:f}=a,x=r!=null&&hasClipBBox(r),b=hasClipBBox(a);return x&&b||(!x&&b?({x0:n,y0:l,x1:c,y1:h,clipX0:d,clipY0:u,clipX1:p,clipY1:g}=a,t&&(e?p=a.clipX0:g=a.clipY0)):x&&!b?({x0:n,y0:l,x1:c,y1:h}=a,d=void 0,u=void 0,p=void 0,g=void 0):t&&(e?c=n:h=l)),{x0:n,y0:l,x1:c,y1:h,clipX0:d,clipY0:u,clipX1:p,clipY1:g,horizontalInset:y,verticalInset:f,phase:i}},toFn(s,a){const{x0:r,y0:n,x1:l,y1:c,clipX0:h,clipY0:d,clipX1:u,clipY1:p,horizontalInset:g,verticalInset:y}=a;return{x0:r,y0:n,x1:l,y1:c,clipX0:h,clipY0:d,clipX1:u,clipY1:p,horizontalInset:g,verticalInset:y}},applyFn(s,a){s.setProperties(resetLinearGaugeSeriesResetRectFunction(s,a))}}}}function resetLinearGaugeSeriesResetRectFunction(t,e){const{x:i,y:o,width:s,height:a}=datumRect(e),r=computeClipBBox(e),n=clipBBoxVisibility(e,r);return{x:i,y:o,width:s,height:a,clipBBox:r,visible:n}}var horizontalTextAligns={Before:"right",Center:"center",After:"left"},verticalTextBaselines={Before:"top",Center:"middle",After:"bottom"},horizontalAlignFactors={Before:-1,Center:-.5,After:0},verticalAlignFactors2={Before:0,Center:-.5,After:-1};function formatLinearGaugeLabels(t,e,i,o,s,a){const{seriesRect:r,gaugeRect:n,barRect:l}=s,{padding:c,horizontal:h}=o;i.each((d,u)=>{const p=getLabelText(t.id,e,u,a?.label);let g,y;u.placement==="outside-start"?h?(g=n.x,y=r.height):(g=r.width,y=r.height-(n.y+n.height)):u.placement==="outside-end"?h?(g=r.width-(n.x+n.width),y=r.height):(g=r.width,y=n.y):u.avoidCollisions&&(g=n.width,y=n.height);let f;if(p==null)return;if(g!=null&&y!=null){const E=()=>({width:g,height:y,meta:null});f=formatSingleLabel((0,import_ag_charts_core87.toPlainText)(p),u,{padding:c},E)?.[0]}else{const E=(0,import_ag_charts_core87.cachedTextMeasurer)(u),{width:I,height:C}=(0,import_ag_charts_core87.isArray)(p)?(0,import_ag_charts_core87.measureTextSegments)(p,u):E.measureLines(p);f={text:p,fontSize:u.fontSize,lineHeight:u.lineHeight??E.lineHeight(),width:I,height:C}}if(f==null){d.visible=!1;return}const x=h?n.x:n.y+n.height,b=h?n.x+n.width:n.y,m=h?l.x:l.y+l.height,S=h?l.x+l.width:l.y,v=u.spacing*(h?1:-1);let M,D,k,_;switch(u.placement){case"outside-start":M=-1/0,D=1/0,k=x-v,_="Before";break;case"outside-end":M=-1/0,D=1/0,k=b+v,_="After";break;case"inside-start":M=x,D=S,k=x+v,_="After";break;case"inside-end":M=S,D=b,k=b-v,_="Before";break;case"inside-center":M=x,D=b,k=(x+b)/2,_="Center";break;case"bar-inside":M=m,D=S,k=(m+S)/2,_="Center";break;case"bar-inside-end":M=m,D=S,k=S-v,_="Before";break;case"bar-outside-end":M=S,D=b,k=S+v,_="After";break;case"bar-end":M=-1/0,D=1/0,k=S,_="Center";break}const T=h?k:n.x+n.width/2,w=h?n.y+n.height/2:k;let R,F;h?(R=T+horizontalAlignFactors[_]*f.width,F=R+f.width):(R=w+verticalAlignFactors2[_]*f.height,F=R+f.height);const O=Math.min(R,F)>=Math.min(M,D)&&Math.max(R,F)<=Math.max(M,D);if(u.avoidCollisions&&!O){d.visible=!1;return}d.visible=!0,d.text=f.text,d.fontSize=f.fontSize,d.lineHeight=f.lineHeight,d.textAlign=h?horizontalTextAligns[_]:"center",d.textBaseline=h?"middle":verticalTextBaselines[_],d.x=T,d.y=w})}var{fromToMotion:fromToMotion2,resetMotion:resetMotion3,SeriesNodePickMode:SeriesNodePickMode8,StateMachine:StateMachine12,createDatumId:createDatumId9,toRadians:toRadians4,BBox:BBox19,Group:Group11,PointerEvents:PointerEvents5,Selection:Selection7,Rect:Rect7,Text:Text3,TransformableText:TransformableText2,Marker:Marker3,LinearScale:LinearScale4,generateTicks:generateTicks2,NiceMode,easing,findRangeExtent:findRangeExtent2,tickFormat,mergeDefaults:mergeDefaults12,applyShapeStyle:applyShapeStyle10}=import_ag_charts_community202._ModuleSupport,horizontalTargetPlacementRotation={before:180,middle:0,after:0},verticalTargetPlacementRotation={before:90,middle:0,after:-90},LinearGaugeSeries=class extends import_ag_charts_community202._ModuleSupport.Series{constructor(t){super({moduleCtx:t,pickModes:[SeriesNodePickMode8.EXACT_SHAPE_MATCH,SeriesNodePickMode8.NEAREST_NODE]}),this.properties=new LinearGaugeSeriesProperties,this.seriesRect=BBox19.NaN,this.gaugeRect=BBox19.NaN,this.scale=new LinearScale4,this.originX=0,this.originY=0,this.scaleGroup=this.contentGroup.appendChild(new Group11({name:"scaleGroup"})),this.itemGroup=this.contentGroup.appendChild(new Group11({name:"itemGroup"})),this.itemTargetGroup=this.contentGroup.appendChild(new Group11({name:"itemTargetGroup"})),this.itemTargetLabelGroup=this.contentGroup.appendChild(new Group11({name:"itemTargetLabelGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Group11({name:"itemLabelGroup"})),this.highlightTargetGroup=this.highlightGroup.appendChild(new Group11({name:"itemTargetLabelGroup"})),this.tickGroup=this.contentGroup.appendChild(new Group11({name:"tickGroup"})),this.scaleSelection=Selection7.select(this.scaleGroup,()=>this.nodeFactory()),this.datumSelection=Selection7.select(this.itemGroup,()=>this.nodeFactory()),this.targetSelection=Selection7.select(this.itemTargetGroup,()=>this.markerFactory()),this.targetLabelSelection=Selection7.select(this.itemTargetLabelGroup,Text3),this.labelSelection=Selection7.select(this.itemLabelGroup,Text3),this.highlightTargetSelection=Selection7.select(this.highlightTargetGroup,()=>this.markerFactory()),this.tickSelection=Selection7.select(this.tickGroup,TransformableText2),this.datumUnion=new DatumUnion,this.animationState=new StateMachine12("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.animateReadyResize(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateWaitingUpdateReady()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty"},reset:"empty",skip:"ready"}}),this.scaleGroup.pointerEvents=PointerEvents5.None,this.tickGroup.pointerEvents=PointerEvents5.None}get range(){return this.horizontal?[0,this.gaugeRect.width]:[0,this.gaugeRect.height]}get horizontal(){return this.properties.direction==="horizontal"}get hasData(){return!0}nodeFactory(){const t=new Rect7;return t.crisp=!0,t}markerFactory(){return new Marker3}processData(){this.nodeDataRefresh=!0,this.animationState.transition("updateData")}formatLabel(t){return formatLabel(t,this.properties.scale)}getShapeFillBBox(){const{properties:t,originX:e,originY:i,horizontal:o,scale:s}=this,{thickness:a}=t,r=findRangeExtent2(s.range),n=new BBox19(e,i,o?r:a,o?a:r);return{axis:n,series:n}}getTargets(){const{properties:t}=this,e=t.defaultTarget;return Array.from(t.targets).map(i=>{const{text:o=e.text,value:s=e.value??0,shape:a=e.shape??"triangle",rotation:r=e.rotation??0,placement:n=e.placement??"middle",spacing:l=e.spacing??0,size:c=e.size??0}=i,{enabled:h=e.label.enabled,color:d=e.label.color??"black",fontStyle:u=e.label.fontStyle??"normal",fontWeight:p=e.label.fontWeight??"normal",fontSize:g=e.label.fontSize,fontFamily:y=e.label.fontFamily,spacing:f=e.label.spacing??0}=i.label;return{text:o,value:s,shape:a,placement:n,spacing:l,size:c,rotation:r,label:{enabled:h,color:d,fontStyle:u,fontWeight:p,fontSize:g,fontFamily:y,spacing:f},style:i.getStyle(e)}})}getTargetPoint(t){const{properties:e,originX:i,originY:o,horizontal:s,scale:a,gaugeRect:r}=this,{thickness:n}=e,{value:l,placement:c,spacing:h,size:d}=t,u=a.convert(l);let p;switch(c){case"before":p=-(h+d/2);break;case"after":p=n+h+d/2;break;default:p=n/2;break}return{x:i+r.x+(s?u:p),y:o+r.y+(s?p:u)}}getTargetLabel(t){const{size:e,placement:i,label:o}=t,{spacing:s,color:a,fontStyle:r,fontWeight:n,fontSize:l,fontFamily:c}=o,h=void 0,d=e/2+s;let u,p,g=0,y=0;return this.horizontal?(u="center",i==="after"?(p="top",y=d):(p="bottom",y=-d)):(p="middle",i==="before"?(u="right",g=-d):(u="left",g=d)),{offsetX:g,offsetY:y,fill:a,textAlign:u,textBaseline:p,fontStyle:r,fontWeight:n,fontSize:l,fontFamily:c,lineHeight:h}}labelDatum(t,e){const{placement:i,avoidCollisions:o,spacing:s,text:a,color:r,fontSize:n,minimumFontSize:l,fontStyle:c,fontWeight:h,fontFamily:d,lineHeight:u,wrapping:p,overflowStrategy:g,formatter:y=f=>this.formatLabel(f.value)}=t;return{placement:i,avoidCollisions:o,spacing:s,text:a,value:e,fill:r,fontSize:n,minimumFontSize:l,fontStyle:c,fontWeight:h,fontFamily:d,lineHeight:u,wrapping:p,overflowStrategy:g,formatter:y}}verticalLabelInset(){const{label:t}=this.properties,e=(0,import_ag_charts_core88.cachedTextMeasurer)(t),i=t.text?.split(` +`),o=(t.lineHeight??e.lineHeight())*(i?.length??1);return t.spacing+o}horizontalLabelInset(){const{scale:t,properties:e}=this,{scale:i,label:o}=e,s=o.text?.split(` +`),a=(0,import_ag_charts_core88.cachedTextMeasurer)(o),r=i.interval.values??t.ticks({nice:!1,interval:i.interval.step,minTickCount:0,maxTickCount:6,tickCount:5})?.ticks??[],l=(s??r?.map(c=>getLabelText(this.id,this.ctx,this.labelDatum(o,c))??"")).reduce((c,h)=>{const{width:d}=(0,import_ag_charts_core88.isArray)(h)?(0,import_ag_charts_core88.measureTextSegments)(h,o):a.measureLines(h);return Math.max(c,d)},0);return o.spacing+l}tickFormatter(t,e){const{format:i,formatter:o}=this.properties.scale.label;let s;return i!=null&&(s=tickFormat(e,typeof i=="string"?i:void 0)),(a,r)=>{let n;return o&&(n??(n=formatWithContext(this.ctx,o,{value:a,index:r,domain:t,boundSeries:void 0}))),n??(n=s?.(a)),n??this.formatLabel(a)}}createNodeData(){const{id:t,properties:e,horizontal:i,scale:o,seriesRect:s}=this,{value:a,segmentation:r,thickness:n,cornerRadius:l,cornerMode:c,bar:h,scale:d,label:u,defaultColorRange:p}=e;o.domain=[d.min,d.max],o.range=i?[0,s.width]:[s.height,0];let g,y;i?(y=1,g=Math.PI/2):d.label.placement==="before"?(y=1,g=0):(y=-1,g=0);let f,x,b,m;i?(f=0,x=s.width,b=(s.height-n)/2,m=b+n,u.placement==="outside-start"?f+=this.horizontalLabelInset():u.placement==="outside-end"&&(x-=this.horizontalLabelInset())):(f=(s.width-n)/2,x=f+n,m=0,b=s.height,u.placement==="outside-start"?b-=this.verticalLabelInset():u.placement==="outside-end"&&(m+=this.verticalLabelInset())),this.gaugeRect=new BBox19(Math.min(f,x),Math.min(b,m),Math.abs(x-f),Math.abs(m-b));const S=0,v=0;o.domain=[d.min,d.max],o.range=i?[f,x]:[b,m];const{tickData:{ticks:M}}=generateTicks2({scale:o,label:this.properties.scale.label,interval:this.properties.scale.interval,tickFormatter:(X,Z)=>this.tickFormatter(X,Z),domain:o.domain,range:this.range,reverse:!1,primaryTickCount:void 0,defaultTickMinSpacing:0,visibleRange:[0,1],niceMode:NiceMode.Off,labelOffset:0,axisRotation:g,sideFlag:y}),D=!1,k=this.getTargets(),_=[],T=[],w=[],R=[],[F,O]=o.range,E=Math.abs(O-F),I=i?o.convert(a):x,C=i?m:o.convert(a),L=r.enabled?r.spacing/2:0,A=i?L:0,P=i?0:L,z=Math.min(h.thickness??Math.round(h.thicknessRatio*n),n),B=-(n-z)/2,V=i?0:B,W=i?B:0,H=c==="item",G=Math.ceil(E);let K=r.enabled?r.interval.getSegments(o,G):void 0;const U=h.getStyle(p,i,o),Y=d.getStyle(h.enabled,p,i,o);if(K==null&&H){const X=Math.min(...o.domain),Z=Math.max(...o.domain),q={value:a,segmentStart:X,segmentEnd:Z};if(h.enabled){const ot=Math.min(l,z/2,E/2)*(D?-1:1),et=i?ot:0,st=i?0:ot;_.push({series:this,itemId:"value",datum:q,datumIndex:{type:0},type:0,x0:S+f-et-V,y0:v+b-st-W,x1:S+I+et+V,y1:v+C+st+W,clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:l,topRightCornerRadius:l,bottomRightCornerRadius:l,bottomLeftCornerRadius:l,horizontalInset:A,verticalInset:P,style:U})}const J=Math.min(l,n/2,E/2)*(D?-1:1),j=i?J:0,tt=i?0:J;R.push({series:this,itemId:"scale",datum:q,datumIndex:{type:0},type:0,x0:S+f-j,y0:v+b-tt,x1:S+x+j,y1:v+m+tt,clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:l,topRightCornerRadius:l,bottomRightCornerRadius:l,bottomLeftCornerRadius:l,horizontalInset:A,verticalInset:P,style:Y})}else{K??(K=o.domain);const X=S+f-V,Z=v+b-W,q=S+I+V,it=v+C+W;for(let J=0;JcreateDatumId9(t.nodeData.length,e.itemId))}updateDatumNodes(t){const{datumSelection:e}=t,{ctx:i}=this,o=i.animationManager.isSkipped(),s=this.getShapeFillBBox();e.each((r,n)=>{const{topLeftCornerRadius:l,topRightCornerRadius:c,bottomRightCornerRadius:h,bottomLeftCornerRadius:d}=n;applyShapeStyle10(r,n.style,s),r.topLeftCornerRadius=l,r.topRightCornerRadius=c,r.bottomRightCornerRadius=h,r.bottomLeftCornerRadius=d,r.pointerEvents=this.properties.bar.enabled?import_ag_charts_community202._ModuleSupport.PointerEvents.All:import_ag_charts_community202._ModuleSupport.PointerEvents.None,(o||r.previousDatum==null)&&r.setProperties(resetLinearGaugeSeriesResetRectFunction(r,n))});const{horizontal:a}=this;this.datumUnion.update(e,this.itemGroup,import_ag_charts_community202._ModuleSupport.Rect,(r,n,l)=>{const c=Math.min(n.x,l.x),h=Math.max(n.x+n.width,l.x+l.width),d=Math.min(n.y,l.y),u=Math.max(n.y+n.height,l.y+l.height),p=h-c,g=u-d;r.pointerEvents=import_ag_charts_community202._ModuleSupport.PointerEvents.None,r.x=c,r.y=d,r.width=p,r.height=g,r.topLeftCornerRadius=a?n.topLeftCornerRadius:l.topLeftCornerRadius,r.topRightCornerRadius=l.topRightCornerRadius,r.bottomRightCornerRadius=a?l.bottomRightCornerRadius:n.bottomRightCornerRadius,r.bottomLeftCornerRadius=n.bottomLeftCornerRadius;const y=n.clipBBox,f=l.clipBBox??y;y&&f?r.clipBBox=BBox19.merge([y,f]).intersection(a?new BBox19(c,-1/0,p,1/0):new BBox19(-1/0,d,1/0,g)):r.clipBBox=void 0})}updateScaleSelection(t){return t.scaleSelection.update(t.scaleData,void 0,e=>createDatumId9(t.scaleData.length,e.itemId))}updateScaleNodes(t){const{scaleSelection:e}=t,i=this.getShapeFillBBox();e.each((o,s)=>{const{topLeftCornerRadius:a,topRightCornerRadius:r,bottomRightCornerRadius:n,bottomLeftCornerRadius:l}=s;applyShapeStyle10(o,s.style,i),o.setProperties(resetLinearGaugeSeriesResetRectFunction(o,s)),o.topLeftCornerRadius=a,o.topRightCornerRadius=r,o.bottomRightCornerRadius=n,o.bottomLeftCornerRadius=l,o.setProperties(resetLinearGaugeSeriesResetRectFunction(o,s))})}updateTargetSelection(t){return t.targetSelection.update(t.targetData,void 0,e=>e.itemId)}updateTargetNodes(t){const{targetSelection:e,isHighlight:i}=t;e.each((o,s)=>{const{x:a,y:r,shape:n,size:l,rotation:c}=s,h=this.getTargetStyle(i,s);applyShapeStyle10(o,h),o.size=l,o.shape=n==="line"?lineMarker:n,o.translationX=a,o.translationY=r,o.rotation=c})}getTargetStyle(t,{datumIndex:e,style:i}){const o=this.getHighlightStyle(t,e);return mergeDefaults12(o,{...i,opacity:1})}updateTargetLabelSelection(t){return t.targetLabelSelection.update(t.targetData)}updateTargetLabelNodes(t){const{targetLabelSelection:e}=t;e.each((i,o)=>{const{x:s,y:a,text:r}=o,{offsetX:n,offsetY:l,fill:c,fontStyle:h,fontWeight:d,fontSize:u,fontFamily:p,textAlign:g,textBaseline:y}=o.label;i.visible=!0,i.x=s+n,i.y=a+l,i.text=r,i.fill=c,i.fontStyle=h,i.fontWeight=d,i.fontSize=u,i.fontFamily=p,i.textAlign=g,i.textBaseline=y})}updateTickSelection(t){return t.tickSelection.update(t.tickData,void 0,e=>e.tickId)}updateTickNodes(t){const{gaugeRect:e,properties:i}=this,o=i.defaultScale,{enabled:s,color:a,fontFamily:r=o.label.fontFamily,fontSize:n=o.label.fontSize,fontStyle:l,fontWeight:c=o.label.fontWeight,spacing:h}=i.scale.label;let{placement:d}=i.scale.label;const u=toRadians4(i.scale.label.rotation??0);let p,g,y,f;this.horizontal?(d??(d="after"),p="center",g=d==="before"?"bottom":"top",f=this.originY+e.y+(d==="before"?-h:e.height+h)):(d??(d="before"),p=d==="before"?"end":"start",g="middle",y=this.originX+e.x+(d==="before"?-h:e.width+h)),t.tickSelection.each((x,b)=>{if(!s){x.visible=!1;return}const m=y??b.translation,S=f??b.translation;x.visible=!0,x.text=b.tickLabel,x.fill=a,x.fontFamily=r,x.fontSize=n,x.fontStyle=l,x.fontWeight=c,x.textBaseline=g,x.textAlign=p,x.x=m,x.y=S,x.rotationCenterX=m,x.rotationCenterY=S,x.rotation=u})}updateLabelSelection(t){return t.labelSelection.update(t.labelData,void 0,e=>"primary")}updateLabelNodes(t){const{labelSelection:e}=t,i=this.ctx.animationManager.isSkipped();e.each((o,s)=>{o.fill=s.fill,o.fontStyle=s.fontStyle,o.fontWeight=s.fontWeight,o.fontFamily=s.fontFamily}),(i||this.labelsHaveExplicitText())&&this.formatLabelText()}labelsHaveExplicitText(){for(const{datum:t}of this.labelSelection)if(t.text==null)return!1;return!0}formatLabelText(t){const{labelSelection:e,horizontal:i,scale:o,seriesRect:s,gaugeRect:a}=this,{x:r,y:n,width:l,height:c}=a,h=t?.label??this.properties.value;let d;if(i){const g=o.convert(h);d=new BBox19(r,n,g-r,c)}else{const g=o.convert(h);d=new BBox19(r,g,l,c-g)}const u={seriesRect:s,gaugeRect:a,barRect:d},{margin:p}=this.properties;formatLinearGaugeLabels(this,this.ctx,e,{padding:p,horizontal:i},u,t)}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),resetMotion3([this.datumSelection],resetLinearGaugeSeriesResetRectFunction),this.formatLabelText()}resetAnimation(t){t==="initial"?this.animationState.transition("reset"):t==="ready"&&this.animationState.transition("skip")}animateLabelText(t={}){const{animationManager:e}=this.ctx;let i=0,o=0;if(this.labelSelection.each((s,a)=>{s.opacity=1,i=s.previousDatum?.value??t.from??a.value,o=a.value}),!this.labelsHaveExplicitText())if(i===o)this.formatLabelText({label:o});else{const s=`${this.id}_labels`;e.animate({id:s,groupId:"label",from:{label:i},to:{label:o},phase:t.phase??"update",ease:easing.easeOut,onUpdate:a=>this.formatLabelText(a),onStop:()=>this.formatLabelText({label:o})})}}animateEmptyUpdateReady(){const{animationManager:t}=this.ctx,{node:e}=prepareLinearGaugeSeriesAnimationFunctions(!0,this.horizontal);fromToMotion2(this.id,"node",t,[this.datumSelection],e,(i,o)=>o.itemId),fromToMotion2(this.id,"label",t,[this.labelSelection],fadeInFns,()=>"primary"),this.animateLabelText({from:0,phase:"initial"})}animateWaitingUpdateReady(){const{animationManager:t}=this.ctx,{node:e}=prepareLinearGaugeSeriesAnimationFunctions(!1,this.horizontal);fromToMotion2(this.id,"node",t,[this.datumSelection],e,(i,o)=>o.itemId),this.animateLabelText()}animateReadyResize(){this.resetAllAnimation()}getSeriesDomain(){return[0,1]}dataCount(){return Number.NaN}getSeriesRange(t,e){return[Number.NaN,Number.NaN]}getLegendData(){return[]}getTooltipContent(t){const{id:e,properties:i}=this,{tooltip:o}=i;if(t==null)return;let s,a,r;if(t.type===0?(s=i.value,a=i.label.text,r=this.ctx.localeManager.t("ariaLabelGaugeValue")):({value:s,text:a}=i.targets[t.index],r=this.ctx.localeManager.t("ariaLabelGaugeTarget")),s!=null)return this.formatTooltipWithContext(o,{data:[{label:a,fallbackLabel:r,value:this.formatLabel(s)}]},{seriesId:e,title:void 0,datum:void 0,value:s})}pickNodeClosestDatum(t){return pickGaugeNearestDatum(this,t)}pickFocus(t){return pickGaugeFocus(this,t)}getCaptionText(){return this.formatLabel(this.properties.value)}getCategoryValue(t){}datumIndexForCategoryValue(t){}hasItemStylers(){return this.properties.label.itemStyler!=null}};LinearGaugeSeries.className="LinearGaugeSeries",LinearGaugeSeries.type="linear-gauge";var LinearGaugeModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"linear-gauge",moduleFactory:t=>new LinearGaugeSeries(t),themeTemplate:{minWidth:200,minHeight:200,tooltip:{enabled:!1},series:{thickness:50,defaultColorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$interpolate:[{$palette:"secondDivergingColors"},5]},import_ag_charts_community203._ModuleSupport.SAFE_RANGE2_OPERATION]},scale:{defaultFill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/2",import_ag_charts_community203._ModuleSupport.SAFE_STROKE_FILL_OPERATION,{$palette:"hierarchyColors"}]},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{spacing:11}},bar:{strokeWidth:{$isUserOption:["./stroke",2,0]}},segmentation:{enabled:!1,interval:{},spacing:1},defaultTarget:{fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},size:10,shape:"triangle",placement:"after",spacing:5,label:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:5}},defaultScale:{label:{fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}}},label:{...import_ag_charts_community203._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,placement:"inside-start",fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},fontSize:{$rem:2},minimumFontSize:import_ag_charts_community203._ModuleSupport.FONT_SIZE.SMALL,spacing:18,color:{$ref:"chartBackgroundColor"}},margin:4,tooltip:{range:{$path:["/tooltip/range",10]}}}}},LinearGaugeSeriesModule={type:"series",name:"linear-gauge",chartType:"standalone",enterprise:!0,options:import_ag_charts_community203._ModuleSupport.linearGaugeSeriesOptionsDef,create:t=>new LinearGaugeSeries(t)},import_ag_charts_community212=require("ag-charts-community"),import_ag_charts_community204=require("ag-charts-community"),MAP_THEME_DEFAULTS={zoom:{axes:"xy",anchorPointX:"pointer",anchorPointY:"pointer",buttons:{anchorPointX:"middle",anchorPointY:"middle"}},legend:{enabled:!1},gradientLegend:{enabled:!1,...import_ag_charts_community204._ModuleSupport.LEGEND_CONTAINER_THEME}};function applyMapPalette(t){const e=import_ag_charts_community204._ModuleSupport.deepClone(t);return import_ag_charts_community204._ModuleSupport.jsonWalk(e,i=>{typeof i=="object"&&"$palette"in i&&(i.$mapPalette=i.$palette,delete i.$palette)}),e}var import_ag_charts_community210=require("ag-charts-community"),import_ag_charts_core89=require("ag-charts-core"),import_ag_charts_community206=require("ag-charts-community"),delta2=1e-9;function lineSegmentDistanceToPointSquared(t,e,i,o){const[s,a]=t,[r,n]=e,l=r-s,c=n-a,h=l*l+c*c;let d,u;if(Math.abs(h)e){const h=(e-s)/l,d=[i+(r-i)*h,o+(n-o)*h],u=Math.atan2(n-o,r-i);return{point:d,angle:u}}s=c,i=r,o=n}}var import_ag_charts_community205=require("ag-charts-community"),{LonLatBBox}=import_ag_charts_community205._ModuleSupport;function polygonBbox(t,e){for(const i of t){const[o,s]=i;e=LonLatBBox.extend(e,o,s,o,s)}return e}function polygonCentroid(t){if(t.length===0)return;let e=0,i=0,o=0,[s,a]=t.at(-1);for(const[r,n]of t){const l=s*n-r*a;o+=l,e+=(s+r)*l,i+=(a+n)*l,s=r,a=n}return o*=3,[e/o,i/o]}function polygonDistance(t,e,i){let o=!1,s=1/0;for(const a of t){let r=a.at(-1),[n,l]=r;for(const c of a){const[h,d]=c;d>i!=l>i&&e<(n-h)*(i-d)/(l-d)+h&&(o=!o),s=Math.min(s,lineSegmentDistanceToPointSquared(r,c,e,i)),r=c,n=h,l=d}}return(o?-1:1)*Math.sqrt(s)}var{Path:Path11,ExtendedPath2D:ExtendedPath2D5,BBox:BBox20,SceneChangeDetection:SceneChangeDetection9,SceneObjectChangeDetection,objectsEqual}=import_ag_charts_community206._ModuleSupport,GeoGeometry=class extends Path11{constructor(){super(...arguments),this.projectedGeometry=void 0,this.renderMode=3,this.strokePath=new ExtendedPath2D5}computeBBox(){return(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1),this.bbox?.clone()}updatePath(){const{projectedGeometry:t}=this;this.strokePath.clear(),this.path.clear(),this.bbox=t==null?void 0:this.drawGeometry(t,void 0)}drawPath(t){super.drawPath(t),this.renderStroke(t,this.strokePath.getPath2D())}containsPoint(t,e){const{projectedGeometry:i}=this;return i==null||!this.getBBox().containsPoint(t,e)?!1:this.geometryDistance(i,t,e)<=0}distanceSquared(t,e){const{projectedGeometry:i}=this;if(i==null)return 1/0;const o=this.geometryDistance(i,t,e);return o>0?o*o:0}geometryDistance(t,e,i){const{renderMode:o,strokeWidth:s}=this,a=(o&1)!==0,r=(o&2)!==0,n=Math.max(s/2,1)+1;switch(t.type){case"GeometryCollection":return t.geometries.reduce((l,c)=>Math.min(l,this.geometryDistance(c,e,i)),1/0);case"MultiPolygon":return a?t.coordinates.reduce((l,c)=>Math.min(l,Math.max(polygonDistance(c,e,i),0)),1/0):1/0;case"Polygon":return a?Math.max(polygonDistance(t.coordinates,e,i),0):1/0;case"MultiLineString":return r?t.coordinates.reduce((l,c)=>Math.min(l,Math.max(lineStringDistance(c,e,i)-n,0)),1/0):1/0;case"LineString":return r?Math.max(lineStringDistance(t.coordinates,e,i)-n,0):1/0;case"MultiPoint":case"Point":default:return 1/0}}drawGeometry(t,e){const{renderMode:i,path:o,strokePath:s}=this,a=(i&1)!==0,r=(i&2)!==0;switch(t.type){case"GeometryCollection":for(const n of t.geometries)e=this.drawGeometry(n,e);break;case"MultiPolygon":if(a)for(const n of t.coordinates)e=this.drawPolygon(o,n,e);break;case"Polygon":a&&(e=this.drawPolygon(o,t.coordinates,e));break;case"LineString":r&&(e=this.drawLineString(s,t.coordinates,e,!1));break;case"MultiLineString":if(r)for(const n of t.coordinates)e=this.drawLineString(s,n,e,!1);break;case"Point":case"MultiPoint":break}return e}drawPolygon(t,e,i){if(e.length<1)return i;i=this.drawLineString(t,e[0],i,!0);for(let o=1;o0&&(e=polygonBbox(i[0],e));break;case"Polygon":t.coordinates.length>0&&(e=polygonBbox(t.coordinates[0],e));break;case"MultiLineString":for(const i of t.coordinates)e=polygonBbox(i,e);break;case"LineString":e=polygonBbox(t.coordinates,e);break;case"MultiPoint":for(const i of t.coordinates){const[o,s]=i;e=LonLatBBox2.extend(e,o,s,o,s)}break;case"Point":{const[i,o]=t.coordinates;e=LonLatBBox2.extend(e,i,o,i,o);break}}return e}function largestPolygon(t){switch(t.type){case"GeometryCollection":{let e,i;for(const o of t.geometries){const s=largestPolygon(o);if(s==null)continue;const a=polygonBbox(s[0],void 0);if(a==null)continue;const r=Math.abs(a.lat1-a.lat0)*Math.abs(a.lon1-a.lon0);(e==null||r>e)&&(e=r,i=s)}return i}case"MultiPolygon":{let e,i;for(const o of t.coordinates){const s=polygonBbox(o[0],void 0);if(s==null)continue;const a=Math.abs(s.lat1-s.lat0)*Math.abs(s.lon1-s.lon0);(e==null||a>e)&&(e=a,i=o)}return i}case"Polygon":return t.coordinates;case"MultiLineString":case"LineString":case"MultiPoint":case"Point":return}}function largestLineString(t){switch(t.type){case"GeometryCollection":{let e,i;for(const o of t.geometries){const s=largestLineString(o);if(s==null)continue;const a=lineStringLength(s);a!=null&&(e==null||a>e)&&(e=a,i=s)}return i}case"MultiLineString":{let e=0,i;for(const o of t.coordinates){const s=lineStringLength(o);s>e&&(e=s,i=o)}return i}case"LineString":return t.coordinates;case"MultiPolygon":case"Polygon":case"MultiPoint":case"Point":return}}function containsType(t,e){if(t==null)return!1;switch(t.type){case"GeometryCollection":return t.geometries.some(i=>containsType(i,e));case"MultiPolygon":case"Polygon":return(e&1)!==0;case"MultiLineString":case"LineString":return(e&2)!==0;case"MultiPoint":case"Point":return(e&4)!==0}}function projectGeometry(t,e){switch(t.type){case"GeometryCollection":return{type:"GeometryCollection",geometries:t.geometries.map(i=>projectGeometry(i,e))};case"Polygon":return{type:"Polygon",coordinates:projectPolygon(t.coordinates,e)};case"MultiPolygon":return{type:"MultiPolygon",coordinates:projectMultiPolygon(t.coordinates,e)};case"MultiLineString":return{type:"MultiLineString",coordinates:projectPolygon(t.coordinates,e)};case"LineString":return{type:"LineString",coordinates:projectLineString(t.coordinates,e)};case"MultiPoint":return{type:"MultiPoint",coordinates:projectLineString(t.coordinates,e)};case"Point":return{type:"Point",coordinates:e.convert(t.coordinates)}}}function projectMultiPolygon(t,e){return t.map(i=>projectPolygon(i,e))}function projectPolygon(t,e){return t.map(i=>projectLineString(i,e))}function projectLineString(t,e){return t.map(i=>e.convert(i))}function prepareMapMarkerAnimationFunctions(){return{fromFn:(i,o,s)=>s==="removed"?{scalingX:1,scalingY:1}:i.previousDatum==null?{scalingX:0,scalingY:0}:{scalingX:i.scalingX,scalingY:i.scalingY},toFn:(i,o,s)=>s==="removed"?{scalingX:0,scalingY:0}:{scalingX:1,scalingY:1}}}function findFocusedGeoGeometry(t,e){const i=t.contextNodeData?.nodeData[e.datumIndex];if(i!==void 0){for(const o of t.datumSelection.nodes())if(o.datum===i)return o}}var import_ag_charts_community208=require("ag-charts-community"),TopologySeriesProperties=class extends import_ag_charts_community208._ModuleSupport.SeriesProperties{},TopologySeries=class extends import_ag_charts_community208._ModuleSupport.DataModelSeries{addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",t=>{this.onLegendItemClick(t)}),this.ctx.eventsHub.on("legend:item-double-click",t=>{this.onLegendItemDoubleClick(t)}))}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(t,e){return[Number.NaN,Number.NaN]}},import_ag_charts_community209=require("ag-charts-community"),{Property:Property70,SeriesProperties:SeriesProperties3,makeSeriesTooltip:makeSeriesTooltip12,Label:Label10}=import_ag_charts_community209._ModuleSupport,MapLineSeriesProperties=class extends SeriesProperties3{constructor(){super(...arguments),this.topology=void 0,this.idKey="",this.topologyIdKey="name",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.maxStrokeWidth=void 0,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.label=new Label10,this.tooltip=makeSeriesTooltip12()}getStyle(){const{stroke:t,strokeOpacity:e,strokeWidth:i,lineDash:o,lineDashOffset:s}=this;return{stroke:t,strokeOpacity:e,strokeWidth:i,lineDash:o,lineDashOffset:s}}};__decorateClass([Property70],MapLineSeriesProperties.prototype,"topology",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"title",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"legendItemName",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"idKey",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"topologyIdKey",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"idName",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"labelKey",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"labelName",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"sizeKey",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"sizeName",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"colorKey",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"colorName",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"sizeDomain",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"colorRange",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"maxStrokeWidth",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"stroke",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"lineDash",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"label",2),__decorateClass([Property70],MapLineSeriesProperties.prototype,"tooltip",2);var{getMissCount:getMissCount2,getLabelStyles:getLabelStyles2,createDatumId:createDatumId10,SeriesNodePickMode:SeriesNodePickMode9,valueProperty:valueProperty12,ColorScale:ColorScale2,LinearScale:LinearScale5,Selection:Selection8,Text:Text4,Transformable:Transformable2,mergeDefaults:mergeDefaults13}=import_ag_charts_community210._ModuleSupport,MapLineSeries=class extends TopologySeries{constructor(t){super({moduleCtx:t,categoryKey:void 0,propertyKeys:{size:["colorKey"],color:["colorKey"],label:["labelKey"]},propertyNames:{size:["sizeName"],color:["colorName"],label:["labelName"]},pickModes:[SeriesNodePickMode9.EXACT_SHAPE_MATCH,SeriesNodePickMode9.NEAREST_NODE],usesPlacedLabels:!0}),this.properties=new MapLineSeriesProperties,this._chartTopology=void 0,this.colorScale=new ColorScale2,this.sizeScale=new LinearScale5,this.datumSelection=Selection8.select(this.contentGroup,()=>this.nodeFactory()),this.labelSelection=Selection8.select(this.labelGroup,Text4),this.highlightDatumSelection=Selection8.select(this.highlightGroup,()=>this.nodeFactory()),this._previousDatumMidPoint=void 0}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){return super.hasData&&this.topology!=null}renderToOffscreenCanvas(){return!0}setZIndex(t){return super.setZIndex(t),this.contentGroup.zIndex=[1,t],this.highlightGroup.zIndex=[2,t],!0}setChartTopology(t){this._chartTopology=t,this.topology===t&&(this.nodeDataRefresh=!0)}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}nodeFactory(){const t=new GeoGeometry;return t.renderMode=2,t.lineJoin="round",t.lineCap="round",t}async processData(t){if(this.data==null)return;const{data:e,topology:i,sizeScale:o,colorScale:s}=this,{topologyIdKey:a,idKey:r,sizeKey:n,colorKey:l,labelKey:c,sizeDomain:h,colorRange:d}=this.properties,u=new Map;for(const m of i?.features.values()??[]){const S=m.properties?.[a];S==null||!containsType(m.geometry,2)||u.set(S,m)}const p=this.sizeScale.type,g=this.colorScale.type,y=this.scale?.type,{dataModel:f,processedData:x}=await this.requestDataModel(t,e,{props:[valueProperty12(r,y,{id:"idValue",includeProperty:!1}),valueProperty12(r,y,{id:"featureValue",includeProperty:!1,processor:()=>m=>u.get(m)}),...c==null?[]:[valueProperty12(c,"category",{id:"labelValue"})],...n==null?[]:[valueProperty12(n,p,{id:"sizeValue"})],...l==null?[]:[valueProperty12(l,g,{id:"colorValue"})]]}),b=f.resolveColumnById(this,"featureValue",x);if(this.topologyBounds=b.reduce((m,S)=>{const v=S?.geometry;return v==null?m:geometryBbox(v,m)},void 0),n!=null){const m=f.resolveProcessedDataIndexById(this,"sizeValue"),S=x.domain.values[m]??[];o.domain=h??S}if(d!=null&&this.isColorScaleValid()){const m=f.resolveProcessedDataIndexById(this,"colorValue");s.domain=x.domain.values[m],s.range=d,s.update()}i==null&&import_ag_charts_core89.Logger.warnOnce("no topology was provided for [MapLineSeries]; nothing will be rendered.")}isColorScaleValid(){const{colorKey:t}=this.properties;if(!t)return!1;const{dataModel:e,processedData:i}=this;if(!e||!i)return!1;const o=e.resolveProcessedDataIndexById(this,"colorValue"),s=i.input.count,a=getMissCount2(this,i.defs.values[o].missing);return!(s===0||s===a)}getLabelDatum(t,e,i,o){if(e==null||i==null)return;const s=largestLineString(i);if(s==null)return;const{idKey:a,idName:r,sizeKey:n,sizeName:l,colorKey:c,colorName:h,labelKey:d,labelName:u,label:p}=this.properties;if(d==null||!p.enabled)return;const g=this.getLabelText(e,t,d,"label",[],p,{value:e,datum:t,idKey:a,idName:r,sizeKey:n,sizeName:l,colorKey:c,colorName:h,labelKey:d,labelName:u});if(g==null)return;const y=o.measureLines(String(g)),f=lineStringCenter(s);if(f==null)return;const[x,b]=f.point,{width:m,height:S}=y;return{point:{x,y:b,size:0},label:{width:m,height:S,text:g},anchor:void 0,placement:void 0}}createNodeData(){const{id:t,dataModel:e,processedData:i,sizeScale:o,properties:s,scale:a}=this,{idKey:r,sizeKey:n,colorKey:l,labelKey:c,label:h,legendItemName:d}=s;if(e==null||i==null)return;const u=e.resolveColumnById(this,"idValue",i),p=e.resolveColumnById(this,"featureValue",i),g=c==null?void 0:e.resolveColumnById(this,"labelValue",i),y=n==null?void 0:e.resolveColumnById(this,"sizeValue",i),f=l==null?void 0:e.resolveColumnById(this,"colorValue",i),x=s.maxStrokeWidth??s.strokeWidth;o.range=[Math.min(s.strokeWidth,x),x];const b=(0,import_ag_charts_core89.cachedTextMeasurer)(h),m=new Map;for(const[_]of i.dataSources.get(this.id)?.data.entries()??[]){const T=u[_],w=p[_]?.geometry??void 0,R=w!=null&&a!=null?projectGeometry(w,a):void 0;T!=null&&R!=null&&m.set(T,R)}const S=[],v=[],M=[],D=i.dataSources.get(this.id)?.data??[];for(const[_,T]of D.entries()){const w=u[_],R=f?.[_],F=y?.[_],O=g?.[_],E=m.get(w);E==null&&M.push(w);const I=this.getLabelDatum(T,O,E,b);I!=null&&v.push(I),S.push({series:this,itemId:r,datum:T,datumIndex:_,idValue:w,labelValue:O,colorValue:R,sizeValue:F,projectedGeometry:E,legendItemName:d,style:this.getItemStyle({datumIndex:_,datum:T,colorValue:R,sizeValue:F},!1)})}const k=10;if(M.length>k){const _=M.length-k;M.length=k,M.push(`(+${_} more)`)}return M.length>0&&import_ag_charts_core89.Logger.warnOnce("some data items do not have matches in the provided topology",M),{itemId:t,nodeData:S,labelData:v}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:t,highlightDatumSelection:e}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let i=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:o}=this.properties,s=o!=null&&i?.datum==null&&o===i?.legendItemName;i!=null&&(i.series!==this&&!s||i.datum==null)&&(i=void 0);const a=this.contextNodeData?.nodeData??[];this.datumSelection=this.updateDatumSelection({nodeData:a,datumSelection:t}),this.updateDatumStyles({datumSelection:t,isHighlight:!1}),this.updateDatumNodes({datumSelection:t,isHighlight:!1}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:i==null?[]:[i],datumSelection:e}),this.updateDatumStyles({datumSelection:e,isHighlight:!0}),this.updateDatumNodes({datumSelection:e,isHighlight:!0})}updateDatumSelection(t){return t.datumSelection.update(t.nodeData,void 0,e=>createDatumId10(e.idValue))}getItemStyle({datumIndex:t=0,datum:e,colorValue:i,sizeValue:o},s){const{properties:a,colorScale:r,sizeScale:n}=this,{colorRange:l,itemStyler:c}=a,h=this.getHighlightStyle(s,t),d=mergeDefaults13(h,a.getStyle());!s&&i!=null&&(d.stroke=this.isColorScaleValid()?r.convert(i):l?.[0]??a.stroke),o!=null&&(d.strokeWidth=n.convert(o,{clamp:!0}));let u;return c!=null&&(u=this.cachedDatumCallback(createDatumId10(t,s?"highlight":"node"),()=>{const p=this.makeItemStylerParams(e,t,s,d);return this.callWithContext(c,p)})),u?mergeDefaults13(d,u):d}makeItemStylerParams(t,e,i,o){const{id:s}=this,a=this.ctx.highlightManager?.getActiveHighlight(),r=this.getHighlightStateString(a,i,e);return{seriesId:s,datum:t,highlighted:i,highlightState:r,...o}}updateDatumStyles({datumSelection:t,isHighlight:e}){t.each((i,o)=>{o.style=this.getItemStyle(o,e)})}updateDatumNodes({datumSelection:t}){t.each((e,i)=>{const{projectedGeometry:o,style:s}=i;if(o==null){e.visible=!1,e.projectedGeometry=void 0;return}e.visible=!0,e.projectedGeometry=o,e.setProperties(s)})}updatePlacedLabelData(t){this.labelSelection=this.labelSelection.update(t,e=>{e.pointerEvents=import_ag_charts_community210._ModuleSupport.PointerEvents.None}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(t){const{properties:e}=this,i=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((o,{x:s,y:a,width:r,height:n,text:l},c)=>{const h=getLabelStyles2(this,void 0,e,e.label,!1,i),{color:d,fontStyle:u,fontWeight:p,fontSize:g,fontFamily:y}=h;o.visible=!0,o.x=s+r/2,o.y=a+n/2,o.text=l,o.fill=d,o.fontStyle=u,o.fontWeight=p,o.fontSize=g,o.fontFamily=y,o.textAlign="center",o.textBaseline="middle",o.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,o.setBoxing(h)})}resetAnimation(){}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}pickNodeClosestDatum({x:t,y:e}){let i=1/0,o;return this.datumSelection.each((s,a)=>{const r=s.distanceSquared(t,e);rnew MapLineSeries(t),themeTemplate:{...MAP_THEME_DEFAULTS,series:{stroke:applyMapPalette(import_ag_charts_community212._ModuleSupport.SAFE_STROKE_FILL_OPERATION),colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},applyMapPalette(import_ag_charts_community212._ModuleSupport.SAFE_RANGE2_OPERATION)]},strokeWidth:1,maxStrokeWidth:3,lineDash:[0],lineDashOffset:0,label:{...import_ag_charts_community212._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:applyMapPalette(import_ag_charts_community212._ModuleSupport.multiSeriesHighlightStyle(!1))},tooltip:{range:"exact"}}},MapLineSeriesModule={type:"series",name:"map-line",chartType:"topology",enterprise:!0,options:mapLineSeriesOptionsDef,create:t=>new MapLineSeries(t)},import_ag_charts_community214=require("ag-charts-community"),import_ag_charts_core91=require("ag-charts-core"),import_ag_charts_community213=require("ag-charts-community"),{Property:Property71,SeriesProperties:SeriesProperties4,makeSeriesTooltip:makeSeriesTooltip13}=import_ag_charts_community213._ModuleSupport,MapLineBackgroundSeriesProperties=class extends SeriesProperties4{constructor(){super(...arguments),this.topology=void 0,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.tooltip=makeSeriesTooltip13()}};__decorateClass([Property71],MapLineBackgroundSeriesProperties.prototype,"topology",2),__decorateClass([Property71],MapLineBackgroundSeriesProperties.prototype,"stroke",2),__decorateClass([Property71],MapLineBackgroundSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property71],MapLineBackgroundSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property71],MapLineBackgroundSeriesProperties.prototype,"lineDash",2),__decorateClass([Property71],MapLineBackgroundSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property71],MapLineBackgroundSeriesProperties.prototype,"tooltip",2);var{createDatumId:createDatumId11,Group:Group12,Selection:Selection9,PointerEvents:PointerEvents6}=import_ag_charts_community214._ModuleSupport,MapLineBackgroundSeries=class extends TopologySeries{constructor(t){super({moduleCtx:t,categoryKey:void 0,pickModes:[]}),this.properties=new MapLineBackgroundSeriesProperties,this._chartTopology=void 0,this.itemGroup=this.contentGroup.appendChild(new Group12({name:"itemGroup"})),this.datumSelection=Selection9.select(this.itemGroup,()=>this.nodeFactory()),this.itemGroup.pointerEvents=PointerEvents6.None}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get focusable(){return!1}setOptionsData(){}setChartData(){}get hasData(){return!1}renderToOffscreenCanvas(){return!0}setChartTopology(t){this._chartTopology=t,this.topology===t&&(this.nodeDataRefresh=!0)}setZIndex(t){return super.setZIndex(t),this.contentGroup.zIndex=[0,t,0],this.highlightGroup.zIndex=[0,t,1],!0}nodeFactory(){const t=new GeoGeometry;return t.renderMode=2,t.lineJoin="round",t.lineCap="round",t.pointerEvents=PointerEvents6.None,t}processData(){const{topology:t}=this;this.topologyBounds=t?.features.reduce((e,i)=>{const o=i.geometry;return o==null?e:geometryBbox(o,e)},void 0),t==null&&import_ag_charts_core91.Logger.warnOnce("no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.")}createNodeData(){const{id:t,topology:e,scale:i,properties:o}=this;if(e==null)return;const{stroke:s,strokeOpacity:a,lineDash:r,lineDashOffset:n,strokeWidth:l}=o,c=[],h=[];for(const[d,u]of e.features.entries()){const{geometry:p}=u,g=p!=null&&i!=null?projectGeometry(p,i):void 0;g!=null&&c.push({series:this,itemId:d,datum:u,datumIndex:0,index:d,projectedGeometry:g,style:{stroke:s,strokeOpacity:a,lineDash:r,lineDashOffset:n,strokeWidth:l}})}return{itemId:t,nodeData:c,labelData:h}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:t}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;const{nodeData:e=[]}=this.contextNodeData??{};this.datumSelection=this.updateDatumSelection({nodeData:e,datumSelection:t}),this.updateDatumNodes({datumSelection:t})}updateDatumSelection(t){return t.datumSelection.update(t.nodeData,void 0,e=>createDatumId11(e.index))}updateDatumNodes(t){const{datumSelection:e}=t;e.each((i,o)=>{const{projectedGeometry:s}=o;if(s==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=s,i.setProperties(o.style)})}resetAnimation(){}getLegendData(){return[]}getTooltipContent(t){}computeFocusBounds(t){}hasItemStylers(){return!1}};MapLineBackgroundSeries.className="MapLineBackgroundSeries",MapLineBackgroundSeries.type="map-line-background";var import_ag_charts_community215=require("ag-charts-community"),import_ag_charts_core92=require("ag-charts-core"),{mapLineBackgroundSeriesThemeableOptionsDef}=import_ag_charts_community215._ModuleSupport,mapLineBackgroundSeriesOptionsDef={...mapLineBackgroundSeriesThemeableOptionsDef,type:(0,import_ag_charts_core92.required)((0,import_ag_charts_core92.constant)("map-line-background")),topology:import_ag_charts_core92.geoJson},MapLineBackgroundModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-line-background",moduleFactory:t=>new MapLineBackgroundSeries(t),themeTemplate:{...MAP_THEME_DEFAULTS,series:{stroke:{$path:["/1",{$mapPalette:"stroke"},{$mapPalette:"secondHierarchyColors"}]},strokeWidth:1,lineDash:[0],lineDashOffset:0}}},MapLineBackgroundSeriesModule={type:"series",name:"map-line-background",chartType:"topology",enterprise:!0,options:mapLineBackgroundSeriesOptionsDef,create:t=>new MapLineBackgroundSeries(t)},import_ag_charts_community220=require("ag-charts-community"),import_ag_charts_core96=require("ag-charts-core"),import_ag_charts_community218=require("ag-charts-community"),import_ag_charts_core94=require("ag-charts-core"),__MINI_CHART_SERIES_OPTIONS=void 0,__VERIFY_MINI_CHART_SERIES_OPTIONS=void 0;__VERIFY_MINI_CHART_SERIES_OPTIONS=__MINI_CHART_SERIES_OPTIONS;var __THEME_OVERRIDES=void 0,__VERIFY_THEME_OVERRIDES=void 0;__VERIFY_THEME_OVERRIDES=__THEME_OVERRIDES;var __THEMEABLE_OPTIONS=void 0,__VERIFY_THEMEABLE_OPTIONS=void 0;__VERIFY_THEMEABLE_OPTIONS=__THEMEABLE_OPTIONS;var __AXIS_LABEL_OPTIONS=void 0,__VERIFY_AXIS_LABEL_OPTIONS=void 0;__VERIFY_AXIS_LABEL_OPTIONS=__AXIS_LABEL_OPTIONS;var import_ag_charts_core93=require("ag-charts-core");function polygonPointSearch(t,e,i){const o=polygonBbox(t[0],void 0);if(o==null)return;const s=(o.lon0+o.lon1)/2,a=(o.lat0+o.lat1)/2,r=Math.abs(o.lon1-o.lon0),n=Math.abs(o.lat1-o.lat0),l=polygonCentroid(t[0]),[c,h]=l,d=-polygonDistance(t,c,h);let u;const p=(v,M)=>{const k=Math.max(M-d,0);return v-.5*k},g=(v,M,D)=>{const{distance:k,maxDistance:_}=i(t,v,M,D),T=Math.hypot(c-v,h-M),w=Math.min(Math.max(c,v-D/2),v+D/2),R=Math.min(Math.max(h,M-D/2),M+D/2),F=Math.hypot(c-w,h-R),O=p(k,T),E=p(_,F);return{distance:k,maxDistance:_,value:O,maxValue:E,x:v,y:M,stride:D}},y=(v,M,D,k)=>{const _=g(M,D,k);_.maxDistance>=0&&v.push(_)},f=Math.min(r,n)/2;let x={value:g(s,a,f),next:null};for(;x!=null;){const v=x.value,{distance:M,value:D,maxValue:k,x:_,y:T,stride:w}=v;if(x=x.next,M>0&&(u==null||D>u.value)&&(u=v),u!=null&&k-u.value<=e)continue;const R=w/2,F=[];y(F,_-R,T-R,R),y(F,_+R,T-R,R),y(F,_-R,T+R,R),y(F,_+R,T+R,R),F.sort(labelPlacementCmp),x=(0,import_ag_charts_core93.insertListItemsSorted)(x,F,labelPlacementCmp)}if(u==null)return;const{distance:b,x:m,y:S}=u;return{x:m,y:S,distance:b}}var labelPlacementCmp=(t,e)=>e.maxValue-t.maxValue;function polygonMarkerCenter(t,e){const i=polygonPointSearch(t,e,(a,r,n,l)=>{const c=-polygonDistance(a,r,n),h=c+l*Math.SQRT2;return{distance:c,maxDistance:h}});if(i==null)return;const{x:o,y:s}=i;return[o,s]}function markerPositions(t,e){let i;switch(t.type){case"GeometryCollection":return t.geometries.flatMap(o=>markerPositions(o,e));case"MultiPoint":return t.coordinates;case"Point":return[t.coordinates];case"MultiPolygon":{const o=largestPolygon(t);i=o==null?void 0:polygonMarkerCenter(o,e);break}case"Polygon":{const o=t.coordinates;i=o==null?void 0:polygonMarkerCenter(o,e);break}case"MultiLineString":{const o=largestLineString(t);i=o==null?void 0:lineStringCenter(o)?.point;break}case"LineString":{const o=t.coordinates;i=lineStringCenter(o)?.point;break}}return i==null?[]:[i]}var import_ag_charts_community216=require("ag-charts-community"),{BBox:BBox21}=import_ag_charts_community216._ModuleSupport;function getTopologyShapeFillBBox(t){if(!t)return;const{range:e}=t,i=e[0][0],o=e[0][1],s=e[1][0]-i,a=e[1][1]-o,r=new BBox21(i,o,s,a);return{series:r,axis:r}}var import_ag_charts_community217=require("ag-charts-community"),{Property:Property72,SeriesProperties:SeriesProperties5,makeSeriesTooltip:makeSeriesTooltip14,Label:Label11}=import_ag_charts_community217._ModuleSupport,MapMarkerSeriesLabel=class extends Label11{constructor(){super(...arguments),this.placement="bottom"}};__decorateClass([Property72],MapMarkerSeriesLabel.prototype,"placement",2);var MapMarkerSeriesProperties=class extends SeriesProperties5{constructor(){super(...arguments),this.topology=void 0,this.idKey=void 0,this.topologyIdKey="name",this.idName=void 0,this.latitudeKey=void 0,this.latitudeName=void 0,this.longitudeKey=void 0,this.longitudeName=void 0,this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.shape="circle",this.size=6,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.label=new MapMarkerSeriesLabel,this.tooltip=makeSeriesTooltip14()}getStyle(){const{size:t,shape:e,fill:i,fillOpacity:o,stroke:s,strokeWidth:a,strokeOpacity:r,lineDash:n,lineDashOffset:l}=this;return{size:t,shape:e,fill:i,fillOpacity:o,opacity:1,stroke:s,strokeWidth:a,strokeOpacity:r,lineDash:n,lineDashOffset:l}}};__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"topology",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"title",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"legendItemName",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"idKey",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"topologyIdKey",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"idName",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"latitudeKey",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"latitudeName",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"longitudeKey",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"longitudeName",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"labelKey",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"labelName",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"sizeKey",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"sizeName",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"colorKey",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"colorName",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"colorRange",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"shape",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"size",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"maxSize",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"sizeDomain",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"fill",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"stroke",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"lineDash",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"label",2),__decorateClass([Property72],MapMarkerSeriesProperties.prototype,"tooltip",2);var{fromToMotion:fromToMotion3,StateMachine:StateMachine13,getMissCount:getMissCount3,createDatumId:createDatumId12,SeriesNodePickMode:SeriesNodePickMode10,valueProperty:valueProperty13,computeMarkerFocusBounds:computeMarkerFocusBounds2,ColorScale:ColorScale3,LinearScale:LinearScale6,Group:Group13,Selection:Selection10,Text:Text5,Marker:Marker4,applyShapeStyle:applyShapeStyle11,getLabelStyles:getLabelStyles3,LonLatBBox:LonLatBBox3,mergeDefaults:mergeDefaults14}=import_ag_charts_community218._ModuleSupport,MapMarkerSeries=class extends TopologySeries{constructor(t){super({moduleCtx:t,categoryKey:void 0,propertyKeys:{size:["colorKey"],color:["colorKey"],label:["labelKey"]},propertyNames:{size:["sizeName"],color:["colorName"],label:["labelName"]},pickModes:[SeriesNodePickMode10.EXACT_SHAPE_MATCH,SeriesNodePickMode10.NEAREST_NODE],usesPlacedLabels:!0}),this.properties=new MapMarkerSeriesProperties,this._chartTopology=void 0,this.colorScale=new ColorScale3,this.sizeScale=new LinearScale6,this.markerGroup=this.contentGroup.appendChild(new Group13({name:"markerGroup"})),this.labelSelection=Selection10.select(this.labelGroup,Text5,!1),this.markerSelection=Selection10.select(this.markerGroup,Marker4,!1),this.highlightMarkerSelection=Selection10.select(this.highlightGroup,Marker4),this.animationState=new StateMachine13("empty",{empty:{update:{target:"ready",action:()=>this.animateMarkers()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.resetAllAnimation(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateMarkers()},resize:{target:"ready",action:()=>this.resetAllAnimation()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty",action:()=>this.resetAllAnimation()},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){const t=this.properties.latitudeKey!=null&&this.properties.longitudeKey!=null;return super.hasData&&(this.topology!=null||t)}renderToOffscreenCanvas(){return!0}setChartTopology(t){this._chartTopology=t,this.topology===t&&(this.nodeDataRefresh=!0)}setZIndex(t){return super.setZIndex(t),this.contentGroup.zIndex=[3,t],this.highlightGroup.zIndex=[4,t],!0}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}async processData(t){if(this.data==null)return;const{data:e,topology:i,sizeScale:o,colorScale:s}=this,{topologyIdKey:a,idKey:r,latitudeKey:n,longitudeKey:l,sizeKey:c,colorKey:h,labelKey:d,sizeDomain:u,colorRange:p}=this.properties,g=new Map;for(const k of i?.features.values()??[]){const _=k.properties?.[a];_!=null&&g.set(_,k)}const y=this.sizeScale.type,f=this.colorScale.type,x=this.scale?.type,b=n!=null&&l!=null,{dataModel:m,processedData:S}=await this.requestDataModel(t,e,{props:[...r==null?[]:[valueProperty13(r,x,{id:"idValue",includeProperty:!1}),valueProperty13(r,x,{id:"featureValue",includeProperty:!1,processor:()=>k=>g.get(k)})],...b?[valueProperty13(n,x,{id:"latValue"}),valueProperty13(l,x,{id:"lonValue"})]:[],...d?[valueProperty13(d,"category",{id:"labelValue"})]:[],...c?[valueProperty13(c,y,{id:"sizeValue"})]:[],...h?[valueProperty13(h,f,{id:"colorValue"})]:[]]}),v=r==null?void 0:m.resolveColumnById(this,"featureValue",S),M=b?m.resolveColumnById(this,"latValue",S):void 0,D=b?m.resolveColumnById(this,"lonValue",S):void 0;if(this.topologyBounds=S.dataSources.get(this.id)?.data.reduce((k,_,T)=>{const R=v?.[T]?.geometry;if(R!=null&&(k=geometryBbox(R,k)),M!=null&&D!=null){const F=D[T],O=M[T];k=LonLatBBox3.extend(k,F,O,F,O)}return k},void 0),c!=null){const k=m.resolveProcessedDataIndexById(this,"sizeValue"),_=S.domain.values[k]??[];o.domain=u??_}if(p!=null&&this.isColorScaleValid()){const k=m.resolveProcessedDataIndexById(this,"colorValue");s.domain=S.domain.values[k],s.range=p,s.update()}this.animationState.transition("updateData")}isColorScaleValid(){const{colorKey:t}=this.properties;if(!t)return!1;const{dataModel:e,processedData:i}=this;if(!e||!i)return!1;const o=e.resolveProcessedDataIndexById(this,"colorValue"),s=i.input.count,a=getMissCount3(this,i.defs.values[o].missing);return!(s===0||s===a)}getLabelDatum(t,e,i,o,s,a){if(e==null)return;const{idKey:r,idName:n,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:d,sizeKey:u,sizeName:p,colorKey:g,colorName:y,labelKey:f,labelName:x,label:b,shape:m}=this.properties;if(f==null||!b.enabled)return;const{placement:S}=b,v=this.getLabelText(e,t,f,"label",[],b,{value:e,datum:t,idKey:r,idName:n,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:d,sizeKey:u,sizeName:p,colorKey:g,colorName:y,labelKey:f,labelName:x});if(v==null)return;const{width:M,height:D}=a.measureLines(String(v)),k=Marker4.anchor(m);return{point:{x:i,y:o,size:s},label:{width:M,height:D,text:v},anchor:k,placement:S}}createNodeData(){const{id:t,dataModel:e,processedData:i,sizeScale:o,properties:s,scale:a}=this,{idKey:r,latitudeKey:n,longitudeKey:l,sizeKey:c,colorKey:h,labelKey:d,label:u,legendItemName:p}=s;if(e==null||i==null||a==null)return;const g=n!=null&&l!=null,y=r==null?void 0:e.resolveColumnById(this,"idValue",i),f=r==null?void 0:e.resolveColumnById(this,"featureValue",i),x=g?e.resolveColumnById(this,"latValue",i):void 0,b=g?e.resolveColumnById(this,"lonValue",i):void 0,m=d==null?void 0:e.resolveColumnById(this,"labelValue",i),S=c==null?void 0:e.resolveColumnById(this,"sizeValue",i),v=h==null?void 0:e.resolveColumnById(this,"colorValue",i),M=s.maxSize??s.size;o.range=[Math.min(s.size,M),M];const D=(0,import_ag_charts_core94.cachedTextMeasurer)(u);let k;if(y!=null&&f!=null){k=new Map;for(const[O]of i.dataSources.get(this.id)?.data.entries()??[]){const E=y[O],I=f[O]?.geometry??void 0,C=I!=null&&a!=null?projectGeometry(I,a):void 0;E!=null&&C!=null&&k.set(E,C)}}const _=[],T=[],w=[],R=i.dataSources.get(this.id)?.data??[];for(const[O,E]of R.entries()){const I=y?.[O],C=b?.[O],L=x?.[O],A=v?.[O],P=S?.[O],z=m?.[O],B=P==null?s.size:o.convert(P,{clamp:!0}),V=I==null?void 0:k?.get(I);if(I!=null&&projectGeometry==null&&w.push(I),C!=null&&L!=null){const[W,H]=a.convert([C,L]),G=this.getLabelDatum(E,z,W,H,B,D);G&&T.push(G),_.push({series:this,itemId:n,datum:E,datumIndex:O,index:-1,idValue:I,lonValue:C,latValue:L,labelValue:z,sizeValue:P,colorValue:A,point:{x:W,y:H,size:B},midPoint:{x:W,y:H},legendItemName:p,style:this.getMarkerItemStyle({datumIndex:O,datum:E,colorValue:A,sizeValue:P},!1)})}else if(V!=null)for(const[W,[H,G]]of markerPositions(V,1).entries()){const K=this.getLabelDatum(E,z,H,G,B,D);K&&T.push(K),_.push({series:this,itemId:n,datum:E,datumIndex:O,index:W,idValue:I,lonValue:C,latValue:L,labelValue:z,sizeValue:P,colorValue:A,point:{x:H,y:G,size:B},midPoint:{x:H,y:G},legendItemName:p,style:this.getMarkerItemStyle({datumIndex:O,datum:E,colorValue:A,sizeValue:P},!1)})}}const F=10;if(w.length>F){const O=w.length-F;w.length=F,w.push(`(+${O} more)`)}return w.length>0&&import_ag_charts_core94.Logger.warnOnce("some data items do not have matches in the provided topology",w),{itemId:t,nodeData:_,labelData:T}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}checkScaleChange(){return this.previousScale===this.scale?!1:(this.previousScale=this.scale,!0)}update({seriesRect:t}){const e=this.checkResize(t),i=this.checkScaleChange(),{markerSelection:o,highlightMarkerSelection:s}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let a=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:r}=this.properties,n=r!=null&&a?.datum==null&&r===a?.legendItemName;a!=null&&(a.series!==this&&!n||a.datum==null)&&(a=void 0);const l=this.contextNodeData?.nodeData??[];this.markerSelection=this.updateMarkerSelection({markerData:l,markerSelection:o}),this.updateMarkerNodes({markerSelection:o,isHighlight:!1,highlightedDatum:a}),this.highlightMarkerSelection=this.updateMarkerSelection({markerData:a==null?[]:[a],markerSelection:s}),this.updateMarkerNodes({markerSelection:s,isHighlight:!0,highlightedDatum:a}),(i||e)&&this.animationState.transition("resize"),this.animationState.transition("update")}updatePlacedLabelData(t){this.labelSelection=this.labelSelection.update(t,e=>{e.pointerEvents=import_ag_charts_community218._ModuleSupport.PointerEvents.None}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(t){const{properties:e}=this,i=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((o,{x:s,y:a,width:r,height:n,text:l},c)=>{const h=getLabelStyles3(this,void 0,e,e.label,!1,i),{color:d,fontStyle:u,fontWeight:p,fontSize:g,fontFamily:y}=h;o.visible=!0,o.x=s+r/2,o.y=a+n/2,o.text=l,o.fill=d,o.fontStyle=u,o.fontWeight=p,o.fontSize=g,o.fontFamily=y,o.textAlign="center",o.textBaseline="middle",o.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,o.setBoxing(h)})}updateMarkerSelection(t){const{markerData:e,markerSelection:i}=t;return i.update(e,void 0,o=>createDatumId12(o.index,o.idValue,o.lonValue,o.latValue))}getMarkerItemStyle({datumIndex:t,datum:e,colorValue:i,sizeValue:o},s){const{properties:a,colorScale:r,sizeScale:n}=this,{colorRange:l,itemStyler:c}=a,h=this.getHighlightStyle(s,t),d=mergeDefaults14(h,a.getStyle());!s&&i!=null&&(d.fill=this.isColorScaleValid()?r.convert(i):l?.[0]??d.fill),o!=null&&(d.size=n.convert(o,{clamp:!0}));let u=d;if(c!=null&&t!=null){const p=this.cachedDatumCallback(createDatumId12(t,s?"highlight":"node"),()=>{const g=this.makeItemStylerParams(e,t,s,u);return this.callWithContext(c,g)});p&&(u=mergeDefaults14(p,d))}return u}makeItemStylerParams(t,e,i,o){const{id:s}=this,a=this.ctx.highlightManager?.getActiveHighlight(),r=this.getHighlightStateString(a,i,e),n=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:s,datum:t,highlighted:i,highlightState:r,...o,fill:n}}updateMarkerNodes(t){const{markerSelection:e,isHighlight:i,highlightedDatum:o}=t,s=getTopologyShapeFillBBox(this.scale);e.each((a,r)=>{const{datum:n,point:l}=r,c=this.getMarkerItemStyle(r,i);a.shape=c.shape,a.size=c.size,applyShapeStyle11(a,c,s),a.x=l.x,a.y=l.y,a.scalingCenterX=l.x,a.scalingCenterY=l.y,a.zIndex=!i&&o!=null&&n===o.datum?1:0})}isProcessedDataAnimatable(){return!0}resetAnimation(t){t==="initial"?this.animationState.transition("reset"):t==="ready"&&this.animationState.transition("skip")}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),this.ctx.animationManager.skipCurrentBatch(),this.labelSelection.cleanup(),this.markerSelection.cleanup(),this.highlightMarkerSelection.cleanup()}animateMarkers(){const{animationManager:t}=this.ctx,e=prepareMapMarkerAnimationFunctions();fromToMotion3(this.id,"markers",t,[this.markerSelection,this.highlightMarkerSelection],e)}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}pickNodeClosestDatum(t){const{x:e,y:i}=t;let o=1/0,s;for(const a of this.contextNodeData?.nodeData??[]){const{x:r,y:n,size:l}=a.point,c=Math.max(Math.abs(r-e)-l,0),h=Math.max(Math.abs(n-i)-l,0),d=c*c+h*h;d=0?"N":"S"}, ${Math.abs(R).toFixed(4)}\xB0 ${R>=0?"W":"E"}`}const T=this.getMarkerItemStyle({datumIndex:t,datum:v,colorValue:D,sizeValue:M},!1);return this.formatTooltipWithContext(S,{heading:_,title:b??m,symbol:this.legendItemSymbol(t),data:k},{seriesId:e,datum:v,title:b,idKey:r,idName:n,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:d,colorKey:u,colorName:p,sizeKey:g,sizeName:y,labelKey:f,labelName:x,...T})}getFormattedMarkerStyle(t){const e=this.getMarkerItemStyle(t,!1);return{size:e.size,shape:e.shape}}computeFocusBounds(t){return computeMarkerFocusBounds2(this,t)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};MapMarkerSeries.className="MapMarkerSeries",MapMarkerSeries.type="map-marker";var import_ag_charts_community219=require("ag-charts-community"),import_ag_charts_core95=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs12,mapMarkerSeriesThemeableOptionsDef,without:without6}=import_ag_charts_community219._ModuleSupport,mapMarkerSeriesOptionsDef={...without6(commonSeriesOptionsDefs12,["highlightStyle","highlight"]),...mapMarkerSeriesThemeableOptionsDef,type:(0,import_ag_charts_core95.required)((0,import_ag_charts_core95.constant)("map-marker")),idKey:import_ag_charts_core95.string,latitudeKey:import_ag_charts_core95.string,longitudeKey:import_ag_charts_core95.string,sizeKey:import_ag_charts_core95.string,colorKey:import_ag_charts_core95.string,labelKey:import_ag_charts_core95.string,idName:import_ag_charts_core95.string,latitudeName:import_ag_charts_core95.string,longitudeName:import_ag_charts_core95.string,sizeName:import_ag_charts_core95.string,colorName:import_ag_charts_core95.string,labelName:import_ag_charts_core95.string,topology:import_ag_charts_core95.geoJson,topologyIdKey:import_ag_charts_core95.string,legendItemName:import_ag_charts_core95.string,title:import_ag_charts_core95.string},MapMarkerModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-marker",moduleFactory:t=>new MapMarkerSeries(t),themeTemplate:{...MAP_THEME_DEFAULTS,series:{shape:"circle",maxSize:30,fill:applyMapPalette({$applySwitch:[{$path:"type"},{$mapPalette:"fill"},["gradient",import_ag_charts_community220._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",import_ag_charts_community220._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community220._ModuleSupport.FILL_PATTERN_DEFAULTS]]}),stroke:{$mapPalette:"stroke"},colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},applyMapPalette(import_ag_charts_community220._ModuleSupport.SAFE_RANGE2_OPERATION)]},fillOpacity:.5,label:{...import_ag_charts_community220._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:applyMapPalette(import_ag_charts_community220._ModuleSupport.multiSeriesHighlightStyle())},tooltip:{range:"exact"}}},MapMarkerSeriesModule={type:"series",name:"map-marker",chartType:"topology",enterprise:!0,options:mapMarkerSeriesOptionsDef,create:t=>new MapMarkerSeries(t),validate(t,e,i){const o=(0,import_ag_charts_core96.validate)(t,e,i),{cleared:s,invalid:a}=o;if(s?.idKey==null&&(s?.latitudeKey==null||s?.longitudeKey==null)){const r=l=>i?`${i}.${l}`:l,n=`Either \`${r("idKey")}\` or both \`${r("latitudeKey")}\` and \`${r("longitudeKey")}\` are required.`;a.push(new import_ag_charts_core96.ValidationError("required",n,null,i))}return o}},import_ag_charts_community224=require("ag-charts-community"),import_ag_charts_community222=require("ag-charts-community"),import_ag_charts_core97=require("ag-charts-core");function preferredLabelCenter(t,{aspectRatio:e,precision:i}){const o=polygonPointSearch(t,i,(l,c,h,d)=>{const u=maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(l,c,h,e),p=u+2*d*e,g=u*Math.SQRT2,y=p*Math.SQRT2;return{distance:g,maxDistance:y}});if(o==null)return;const{x:s,y:a,distance:r}=o,n=r/Math.SQRT2;return{x:s,y:a,maxWidth:n}}function maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(t,e,i,o,s){const[a,r]=t,[n,l]=e,c=1/s,h=n-a,d=l-r,[u,p]=r<=l?t:e,[g,y]=a<=n?t:e,[f,x]=r<=l?e:t,[b,m]=a<=n?e:t;let S=1/0;if(h===0)for(let T=0;T<=1;T+=1){const R=(T===0?c:-c)*(a-i)+o;if(R>=p&&R<=x){const O=Math.abs(o-R)*2*s;S=Math.min(S,O)}}else{const T=d/h;for(let w=0;w<=1;w+=1){const R=w===0?c:-c,F=(T*a-r-R*i+o)/(T-R);if(F>=g&&F<=b){const O=Math.abs(i-F)*2;S=Math.min(S,O)}}}const v=s,M=Math.abs((u-i)/(p-o)),D=Math.abs((f-i)/(x-o));if(xo&&Mi&&ki!=c>i&&e<(l-d)*(i-u)/(c-u)+d&&(s=!s);const p=maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(n,h,e,i,o);a=Math.min(a,p),n=h,l=d,c=u}}return(s?1:-1)*a}function applyX(t,e,i){i>=e&&(t.maxX=Math.min(t.maxX,i-e)),i<=e&&(t.minX=Math.max(t.minX,i-e))}function xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(t,e,i,o,s,a){const r=s-a/2,n=s+a/2,[l,c]=e,[h,d]=i,u=h-l,p=d-c,[g,y]=l<=h?e:i,[f,x]=l<=h?i:e;if(u!==0){const b=p/u;for(let m=0;m<=1;m+=1){const v=((m===0?r:n)-c)/b+l;v>=g&&v<=f&&applyX(t,o,v)}}else Math.max(r,Math.min(c,d))<=Math.min(n,Math.max(c,d))&&applyX(t,o,l);return f=r&&x<=n?applyX(t,o,f):g>o&&y>=r&&y<=n&&applyX(t,o,g),t}function maxWidthInPolygonForRectOfHeight(t,e,i,o){const s={minX:-1/0,maxX:1/0};for(const n of t){let l=n.at(-1);for(const c of n)xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(s,l,c,e,i,o),l=c}const{minX:a,maxX:r}=s;return Number.isFinite(a)&&Number.isFinite(r)?{x:e+(a+r)/2,width:r-a}:{x:e,width:0}}var import_ag_charts_community221=require("ag-charts-community"),{Property:Property73,SeriesProperties:SeriesProperties6,makeSeriesTooltip:makeSeriesTooltip15}=import_ag_charts_community221._ModuleSupport,MapShapeSeriesProperties=class extends SeriesProperties6{constructor(){super(...arguments),this.topology=void 0,this.idKey="",this.idName=void 0,this.topologyIdKey="name",this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.padding=0,this.label=new AutoSizedSecondaryLabel,this.tooltip=makeSeriesTooltip15()}getStyle(){const{fill:t,fillOpacity:e,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r}=this;return{fill:t,fillOpacity:e,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r,opacity:1}}};__decorateClass([Property73],MapShapeSeriesProperties.prototype,"topology",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"title",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"legendItemName",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"idKey",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"idName",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"topologyIdKey",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"labelKey",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"labelName",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"colorKey",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"colorName",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"colorRange",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"fill",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"stroke",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"lineDash",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"padding",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"label",2),__decorateClass([Property73],MapShapeSeriesProperties.prototype,"tooltip",2);var{getMissCount:getMissCount4,createDatumId:createDatumId13,SeriesNodePickMode:SeriesNodePickMode11,valueProperty:valueProperty14,ColorScale:ColorScale4,Group:Group14,Selection:Selection11,Text:Text6,PointerEvents:PointerEvents7,applyShapeStyle:applyShapeStyle12,getLabelStyles:getLabelStyles4,mergeDefaults:mergeDefaults15}=import_ag_charts_community222._ModuleSupport,fixedScale=import_ag_charts_community222._ModuleSupport.MercatorScale.fixedScale(),MapShapeSeries=class extends TopologySeries{constructor(t){super({moduleCtx:t,categoryKey:void 0,propertyKeys:{color:["colorKey"],label:["labelKey"]},propertyNames:{color:["colorName"],label:["labelName"]},pickModes:[SeriesNodePickMode11.EXACT_SHAPE_MATCH,SeriesNodePickMode11.NEAREST_NODE]}),this.properties=new MapShapeSeriesProperties,this._chartTopology=void 0,this.colorScale=new ColorScale4,this.itemGroup=this.contentGroup.appendChild(new Group14({name:"itemGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Group14({name:"itemLabelGroup"})),this.datumSelection=Selection11.select(this.itemGroup,()=>this.nodeFactory()),this.labelSelection=Selection11.select(this.itemLabelGroup,Text6),this.highlightDatumSelection=Selection11.select(this.highlightGroup,()=>this.nodeFactory()),this.previousLabelLayouts=void 0,this._previousDatumMidPoint=void 0,this.itemLabelGroup.pointerEvents=PointerEvents7.None}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){return super.hasData&&this.topology!=null}renderToOffscreenCanvas(){return!0}setChartTopology(t){this._chartTopology=t,this.topology===t&&(this.nodeDataRefresh=!0)}setZIndex(t){return super.setZIndex(t),this.contentGroup.zIndex=[1,t],this.highlightGroup.zIndex=[2,t],!0}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}nodeFactory(){const t=new GeoGeometry;return t.renderMode=1,t.lineJoin="round",t}async processData(t){if(this.data==null)return;const{data:e,topology:i,colorScale:o}=this,{topologyIdKey:s,idKey:a,colorKey:r,labelKey:n,colorRange:l}=this.properties,c=new Map;for(const y of i?.features.values()??[]){const f=y.properties?.[s];f==null||!containsType(y.geometry,1)||c.set(f,y)}const h=this.colorScale.type,d=this.scale?.type,{dataModel:u,processedData:p}=await this.requestDataModel(t,e,{props:[valueProperty14(a,d,{id:"idValue",includeProperty:!1}),valueProperty14(a,d,{id:"featureValue",includeProperty:!1,processor:()=>y=>c.get(y)}),...n?[valueProperty14(n,"category",{id:"labelValue"})]:[],...r?[valueProperty14(r,h,{id:"colorValue"})]:[]]}),g=u.resolveColumnById(this,"featureValue",p);if(this.topologyBounds=g.reduce((y,f)=>{const x=f?.geometry;return x==null?y:geometryBbox(x,y)},void 0),l!=null&&this.isColorScaleValid()){const y=u.resolveProcessedDataIndexById(this,"colorValue");o.domain=p.domain.values[y],o.range=l,o.update()}i==null&&import_ag_charts_core97.Logger.warnOnce("no topology was provided for [MapShapeSeries]; nothing will be rendered.")}isColorScaleValid(){const{colorKey:t}=this.properties;if(!t)return!1;const{dataModel:e,processedData:i}=this;if(!e||!i)return!1;const o=e.resolveProcessedDataIndexById(this,"colorValue"),s=i.input.count,a=getMissCount4(this,i.defs.values[o].missing);return!(s===0||s===a)}getLabelLayout(t,e,i,o,s){if(e==null||o==null)return;const{idKey:a,idName:r,colorKey:n,colorName:l,labelKey:c,labelName:h,padding:d,label:u}=this.properties;if(c==null||!u.enabled)return;const p=this.getLabelText(e,t,c,"label",[],u,{value:e,datum:t,idKey:a,idName:r,colorKey:n,colorName:l,labelKey:c,labelName:h});if(p==null)return;const g=(0,import_ag_charts_core97.isArray)(p)?(0,import_ag_charts_core97.measureTextSegments)(p,u):i.measureLines(String(p)),y=(g.width+2*d)/(g.height+2*d);if(s?.geometry===o&&s?.labelText===p&&s?.aspectRatio===y)return s;const f=projectGeometry(o,fixedScale),x=largestPolygon(f);if(x==null)return;const b=preferredLabelCenter(x,{aspectRatio:y,precision:.001});if(b==null)return;const{x:m,y:S,maxWidth:v}=b;return{geometry:o,labelText:p,aspectRatio:y,x:m,y:S,maxWidth:v,fixedPolygon:x}}getLabelDatum(t,e){const{scale:i}=this;if(i==null)return;const{padding:o,label:s}=this.properties,{labelText:a,aspectRatio:r,x:n,y:l,maxWidth:c,fixedPolygon:h}=t,d={width:Math.ceil(c*e),height:Math.ceil(c*e/r),meta:n},u=formatSingleLabel((0,import_ag_charts_core97.toPlainText)(a),s,{padding:o},(S,v)=>{if(!v)return d;const M=maxWidthInPolygonForRectOfHeight(h,n,l,S/e);return{width:M.width*e,height:S,meta:M.x}});if(u==null)return;const[{text:p,fontSize:g,lineHeight:y,width:f},x]=u,b=fM){const D=S.length-M;S.length=M,S.push(`(+${D} more)`)}return S.length>0&&import_ag_charts_core97.Logger.warnOnce("some data items do not have matches in the provided topology",S),{itemId:t,nodeData:b,labelData:m}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:t,labelSelection:e,highlightDatumSelection:i}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let o=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:s}=this.properties,a=s!=null&&o?.datum==null&&s===o?.legendItemName;o!=null&&(o.series!==this&&!a||o.datum==null)&&(o=void 0);const r=this.contextNodeData?.nodeData??[],n=this.contextNodeData?.labelData??[];this.datumSelection=this.updateDatumSelection({nodeData:r,datumSelection:t}),this.updateDatumStyles({datumSelection:t,isHighlight:!1}),this.updateDatumNodes({datumSelection:t}),this.labelSelection=this.updateLabelSelection({labelData:n,labelSelection:e}),this.updateLabelNodes({labelSelection:e}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:o==null?[]:[o],datumSelection:i}),this.updateDatumStyles({datumSelection:i,isHighlight:!0}),this.updateDatumNodes({datumSelection:i})}updateDatumSelection(t){return t.datumSelection.update(t.nodeData,void 0,e=>createDatumId13(e.idValue))}getItemStyle({datumIndex:t,datum:e,colorValue:i},o){const{properties:s,colorScale:a}=this,{colorRange:r,itemStyler:n}=s,l=this.getHighlightStyle(o,t),c=mergeDefaults15(l,s.getStyle());!o&&i!=null&&(c.fill=this.isColorScaleValid()?a.convert(i):r?.[0]??c.fill);let h=c;if(n!=null&&t!=null){const d=this.cachedDatumCallback(createDatumId13(t,o?"highlight":"node"),()=>{const u=this.makeItemStylerParams(e,t,o,h);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(n,u))});d&&(h=mergeDefaults15(d,h))}return h}makeItemStylerParams(t,e,i,o){const{id:s}=this,a=this.ctx.highlightManager?.getActiveHighlight(),r=this.getHighlightStateString(a,i,e),n=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:s,datum:t,highlighted:i,highlightState:r,...o,fill:n}}updateDatumStyles({datumSelection:t,isHighlight:e}){t.each((i,o)=>{o.style=this.getItemStyle(o,e)})}updateDatumNodes({datumSelection:t}){const e=getTopologyShapeFillBBox(this.scale);t.each((i,o)=>{const{projectedGeometry:s}=o;if(s==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=s,applyShapeStyle12(i,o.style,e)})}updateLabelSelection(t){const e=this.isLabelEnabled()?t.labelData:[];return t.labelSelection.update(e)}updateLabelNodes(t){const{properties:e}=this,i=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((o,{x:s,y:a,text:r,fontSize:n,lineHeight:l},c)=>{const h=getLabelStyles4(this,void 0,e,e.label,!1,i),{color:d,fontStyle:u,fontWeight:p,fontFamily:g}=h;o.visible=!0,o.x=s,o.y=a,o.text=r,o.fill=d,o.fontStyle=u,o.fontWeight=p,o.fontSize=n,o.lineHeight=l,o.fontFamily=g,o.textAlign="center",o.textBaseline="middle",o.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,o.setBoxing(h)})}resetAnimation(){}pickNodeClosestDatum({x:t,y:e}){let i=1/0,o;return this.datumSelection.each((s,a)=>{const r=s.distanceSquared(t,e);rnew MapShapeSeries(t),themeTemplate:{...MAP_THEME_DEFAULTS,series:{fill:applyMapPalette({$applySwitch:[{$path:"type"},{$mapPalette:"fill"},["gradient",import_ag_charts_community224._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["image",import_ag_charts_community224._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community224._ModuleSupport.FILL_PATTERN_DEFAULTS]]}),stroke:{$ref:"chartBackgroundColor"},colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},applyMapPalette(import_ag_charts_community224._ModuleSupport.SAFE_RANGE2_OPERATION)]},fillOpacity:1,strokeWidth:1,lineDash:[0],lineDashOffset:0,padding:2,label:{...import_ag_charts_community224._ModuleSupport.LABEL_BOXING_DEFAULTS,color:{$ref:"chartBackgroundColor"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:"bold",overflowStrategy:"hide"},highlight:applyMapPalette(import_ag_charts_community224._ModuleSupport.multiSeriesHighlightStyle(!0))},tooltip:{range:"exact"}}},MapShapeSeriesModule={type:"series",name:"map-shape",chartType:"topology",enterprise:!0,options:mapShapeSeriesOptionsDef,create:t=>new MapShapeSeries(t)},import_ag_charts_community228=require("ag-charts-community"),import_ag_charts_community226=require("ag-charts-community"),import_ag_charts_core99=require("ag-charts-core"),import_ag_charts_community225=require("ag-charts-community"),{Property:Property74,SeriesProperties:SeriesProperties7,makeSeriesTooltip:makeSeriesTooltip16}=import_ag_charts_community225._ModuleSupport,MapShapeBackgroundSeriesProperties=class extends SeriesProperties7{constructor(){super(...arguments),this.topology=void 0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.tooltip=makeSeriesTooltip16()}};__decorateClass([Property74],MapShapeBackgroundSeriesProperties.prototype,"topology",2),__decorateClass([Property74],MapShapeBackgroundSeriesProperties.prototype,"fill",2),__decorateClass([Property74],MapShapeBackgroundSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property74],MapShapeBackgroundSeriesProperties.prototype,"stroke",2),__decorateClass([Property74],MapShapeBackgroundSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property74],MapShapeBackgroundSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property74],MapShapeBackgroundSeriesProperties.prototype,"lineDash",2),__decorateClass([Property74],MapShapeBackgroundSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property74],MapShapeBackgroundSeriesProperties.prototype,"tooltip",2);var{createDatumId:createDatumId14,Selection:Selection12,Group:Group15,PointerEvents:PointerEvents8}=import_ag_charts_community226._ModuleSupport,MapShapeBackgroundSeries=class extends TopologySeries{constructor(t){super({moduleCtx:t,categoryKey:void 0,pickModes:[]}),this.properties=new MapShapeBackgroundSeriesProperties,this._chartTopology=void 0,this.itemGroup=this.contentGroup.appendChild(new Group15({name:"itemGroup"})),this.datumSelection=Selection12.select(this.itemGroup,()=>this.nodeFactory()),this.itemGroup.pointerEvents=PointerEvents8.None}get topology(){return this.properties.topology??this._chartTopology}get focusable(){return!1}setOptionsData(){}setChartData(){}getNodeData(){}get hasData(){return!1}renderToOffscreenCanvas(){return!0}setChartTopology(t){this._chartTopology=t,this.topology===t&&(this.nodeDataRefresh=!0)}setZIndex(t){return super.setZIndex(t),this.contentGroup.zIndex=[0,t,0],this.highlightGroup.zIndex=[0,t,1],!0}nodeFactory(){const t=new GeoGeometry;return t.renderMode=1,t.lineJoin="round",t.pointerEvents=PointerEvents8.None,t}processData(){const{topology:t}=this;this.topologyBounds=t?.features.reduce((e,i)=>{const o=i.geometry;return o==null?e:geometryBbox(o,e)},void 0),t==null&&import_ag_charts_core99.Logger.warnOnce("no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.")}createNodeData(){const{id:t,topology:e,scale:i,properties:o}=this;if(e==null)return;const{fill:s,fillOpacity:a,stroke:r,strokeWidth:n,strokeOpacity:l,lineDash:c,lineDashOffset:h}=o,d=[],u=[];for(const[p,g]of e.features.entries()){const{geometry:y}=g,f=y!=null&&i!=null?projectGeometry(y,i):void 0;f!=null&&d.push({series:this,itemId:p,datum:g,datumIndex:0,index:p,projectedGeometry:f,style:{fill:s,fillOpacity:a,stroke:r,strokeWidth:n,strokeOpacity:l,lineDash:c,lineDashOffset:h}})}return{itemId:t,nodeData:d,labelData:u}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:t}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;const{nodeData:e=[]}=this.contextNodeData??{};this.datumSelection=this.updateDatumSelection({nodeData:e,datumSelection:t}),this.updateDatumNodes({datumSelection:t})}updateDatumSelection(t){return t.datumSelection.update(t.nodeData,void 0,e=>createDatumId14(e.index))}updateDatumNodes(t){const{datumSelection:e}=t;e.each((i,o)=>{const{projectedGeometry:s}=o;if(s==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=s,i.setProperties(o.style)})}resetAnimation(){}getLegendData(){return[]}getTooltipContent(t){}pickFocus(){}computeFocusBounds(t){}hasItemStylers(){return!1}};MapShapeBackgroundSeries.className="MapShapeBackgroundSeries",MapShapeBackgroundSeries.type="map-shape-background";var import_ag_charts_community227=require("ag-charts-community"),import_ag_charts_core100=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs14,mapShapeBackgroundSeriesThemeableOptionsDef}=import_ag_charts_community227._ModuleSupport,mapShapeBackgroundSeriesOptionsDef={...mapShapeBackgroundSeriesThemeableOptionsDef,...commonSeriesOptionsDefs14,type:(0,import_ag_charts_core100.required)((0,import_ag_charts_core100.constant)("map-shape-background")),topology:import_ag_charts_core100.geoJson},MapShapeBackgroundModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-shape-background",moduleFactory:t=>new MapShapeBackgroundSeries(t),themeTemplate:{...MAP_THEME_DEFAULTS,series:{fill:applyMapPalette({$applySwitch:[{$path:"type"},{$path:["/1",{$mapPalette:"fill"},{$mapPalette:"hierarchyColors"}]},["gradient",import_ag_charts_community228._ModuleSupport.FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS],["image",import_ag_charts_community228._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community228._ModuleSupport.FILL_PATTERN_HIERARCHY_DEFAULTS]]}),stroke:{$ref:"chartBackgroundColor"},strokeWidth:1}}},MapShapeBackgroundSeriesModule={type:"series",name:"map-shape-background",chartType:"topology",enterprise:!0,options:mapShapeBackgroundSeriesOptionsDef,create:t=>new MapShapeBackgroundSeries(t)},import_ag_charts_community237=require("ag-charts-community"),import_ag_charts_community234=require("ag-charts-community"),import_ag_charts_community230=require("ag-charts-community"),import_ag_charts_core101=require("ag-charts-core"),import_ag_charts_community229=require("ag-charts-community"),{createDatumId:createDatumId15,mergeDefaults:mergeDefaults16,toHighlightString:toHighlightString4}=import_ag_charts_community229._ModuleSupport;function makeStylerParams(t,e,i){const{id:o}=t,{angleKey:s,cornerRadius:a,fill:r,fillOpacity:n,lineDash:l,lineDashOffset:c,radiusKey:h,stackGroup:d,stroke:u,strokeOpacity:p,strokeWidth:g}=t.properties,y=toHighlightString4(i??import_ag_charts_community229._ModuleSupport.HighlightState.None);return{angleKey:s,cornerRadius:a,fill:r,fillOpacity:n,highlightState:y,highlighted:e,lineDash:l,lineDashOffset:c,radiusKey:h,seriesId:o,stackGroup:d,stroke:u,strokeOpacity:p,strokeWidth:g}}function getStyle(t,e,i,o){const{styler:s}=t.properties;let a={};if(!e&&s){const r=makeStylerParams(t,i,o);a=t.ctx.optionsGraphService.resolvePartial(["series",`${t.declarationOrder}`],t.cachedCallWithContext(s,r)??{},{pick:!1})??{}}return{cornerRadius:a.cornerRadius??t.properties.cornerRadius,fill:a.fill??t.properties.fill,fillOpacity:a.fillOpacity??t.properties.fillOpacity,lineDash:a.lineDash??t.properties.lineDash,lineDashOffset:a.lineDashOffset??t.properties.lineDashOffset,stroke:a.stroke??t.properties.stroke,strokeOpacity:a.strokeOpacity??t.properties.strokeOpacity,strokeWidth:a.strokeWidth??t.properties.strokeWidth,opacity:1}}function makeItemStylerParams(t,e,i,o){const{id:s,properties:a}=t,{angleKey:r,radiusKey:n}=a,l=t.ctx.highlightManager?.getActiveHighlight(),c=t.getHighlightStateString(l,i,e.datumIndex),h=t.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:s,datum:e.datum,highlighted:i,highlightState:c,angleKey:r,radiusKey:n,...o,fill:h}}function getItemStyle(t,e,i,o){const{properties:s}=t,{itemStyler:a}=s,r=t.getHighlightStyle(i,e?.datumIndex,o);let l=mergeDefaults16(r,getStyle(t,e===void 0,i,o));if(a!=null&&e!=null){const c=t.cachedDatumCallback(createDatumId15(t.getDatumId(e),i?"highlight":"node"),()=>{const h=makeItemStylerParams(t,e,i,l);return t.callWithContext(a,h)});c&&(l=mergeDefaults16(c,l))}return l}var{DEFAULT_POLAR_DIRECTION_KEYS,DEFAULT_POLAR_DIRECTION_NAMES,ChartAxisDirection:ChartAxisDirection28,PolarAxis,diff:diff6,fixNumericExtent:fixNumericExtent8,groupAccumulativeValueProperty:groupAccumulativeValueProperty2,keyProperty:keyProperty9,normaliseGroupTo,resetLabelFn:resetLabelFn5,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation5,seriesLabelFadeOutAnimation,valueProperty:valueProperty15,animationValidation:animationValidation7,createDatumId:createDatumId16,SeriesNodePickMode:SeriesNodePickMode12,normalizeAngle360:normalizeAngle3605,CategoryScale:CategoryScale3,motion:motion6,applyShapeStyle:applyShapeStyle13,isGradientFill:isGradientFill2,updateLabelNode:updateLabelNode6,getItemStyles:getItemStyles3}=import_ag_charts_community230._ModuleSupport,RadialColumnSeriesNodeEvent=class extends import_ag_charts_community230._ModuleSupport.SeriesNodeEvent{constructor(t,e,i,o){super(t,e,i,o),this.angleKey=o.properties.angleKey,this.radiusKey=o.properties.radiusKey}},RadialColumnSeriesBase=class extends import_ag_charts_community230._ModuleSupport.PolarSeries{constructor(t,{animationResetFns:e}){super({moduleCtx:t,categoryKey:"angleValue",propertyKeys:DEFAULT_POLAR_DIRECTION_KEYS,propertyNames:DEFAULT_POLAR_DIRECTION_NAMES,canHaveAxes:!0,pickModes:[SeriesNodePickMode12.NEAREST_NODE,SeriesNodePickMode12.EXACT_SHAPE_MATCH],animationResetFns:{...e,label:resetLabelFn5}}),this.NodeEvent=RadialColumnSeriesNodeEvent,this.groupScale=new CategoryScale3,this.circleCache={r:0,cx:0,cy:0}}get hasData(){return this.getHasData("radiusValue-raw")}getSeriesDomain(t){const{dataModel:e,processedData:i}=this;if(!i||!e)return[];if(t===ChartAxisDirection28.Angle)return e.getDomain(this,"angleValue","key",i);{const o=e.getDomain(this,"radiusValue-end","value",i),s=Number.isFinite(o[1]-o[0])?[Math.min(o[0],0),Math.max(o[1],0)]:[];return fixNumericExtent8(s)}}async processData(t){const{angleKey:e,radiusKey:i,normalizedTo:o}=this.properties,s=!this.ctx.animationManager.isSkipped(),a=this.getStackId(),r=`${a}-trailing`,n=[];(0,import_ag_charts_core101.isDefined)(o)&&n.push(normaliseGroupTo([a,r],Math.abs(o))),s&&this.processedData&&n.push(diff6(this.id,this.processedData)),s&&n.push(animationValidation7());const l=this.visible?{}:{forceValue:0},c=this.axes[ChartAxisDirection28.Radius]?.scale.type,h=this.axes[ChartAxisDirection28.Angle]?.scale.type;await this.requestDataModel(t,this.data,{props:[keyProperty9(e,h,{id:"angleValue"}),valueProperty15(i,c,{id:"radiusValue-raw",invalidValue:null,...l}),...groupAccumulativeValueProperty2(i,"normal",{id:"radiusValue-end",rangeId:"radiusValue-range",invalidValue:null,groupId:a,separateNegative:!0,...l},c),...groupAccumulativeValueProperty2(i,"trailing",{id:"radiusValue-start",invalidValue:null,groupId:r,separateNegative:!0,...l},c),...n],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}didCircleChange(){const t=this.radius,e=this.centerX,i=this.centerY,o=this.circleCache;return t!==o.r||e!==o.cx||i!==o.cy?(this.circleCache={r:t,cx:e,cy:i},!0):!1}isRadiusAxisReversed(){return this.axes[ChartAxisDirection28.Radius]?.isReversed()}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}getAxisInnerRadius(){const t=this.axes[ChartAxisDirection28.Radius];return t instanceof PolarAxis?this.radius*t.innerRadiusRatio:0}createNodeData(){const{processedData:t,dataModel:e,groupScale:i}=this;if(!e||!t||t.type!=="grouped")return;const o=this.axes[ChartAxisDirection28.Angle],s=this.axes[ChartAxisDirection28.Radius],a=o?.scale,r=s?.scale;if(!a||!r)return;const n=e.resolveKeysById(this,"angleValue",t),l=e.resolveColumnById(this,"radiusValue-start",t),c=e.resolveColumnById(this,"radiusValue-end",t),h=e.resolveColumnById(this,"radiusValue-raw",t),d=e.resolveProcessedDataIndexById(this,"radiusValue-range");let u=0,p=0;o instanceof AngleCategoryAxis&&(u=o.groupPaddingInner,p=o.paddingInner);const y=(a.bandwidth??0)*(1-p),{index:f,visibleGroupCount:x}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);i.domain=Array.from({length:x}).map((A,P)=>String(P)),i.range=[-y/2,y/2],i.paddingInner=x>1?u:0;const b=this.isRadiusAxisReversed(),m=b?this.radius:this.getAxisInnerRadius(),S=b?this.getAxisInnerRadius():this.radius,v=S+m,{angleKey:M,radiusKey:D,angleName:k,radiusName:_,legendItemName:T,label:w}=this.properties,R=this.getSeriesDomain(ChartAxisDirection28.Radius),F=(A,P,z,B)=>{const V=this.getLabelText(P,A,D,"radius",R,w,{value:P,datum:A,angleKey:M,radiusKey:D,angleName:k,radiusName:_,legendItemName:T});if(V)return{x:z,y:B,text:V,textAlign:"center",textBaseline:"middle"}},O=[],E=getItemStyles3((A,P,z)=>getItemStyle(this,A,P,z)),I={itemId:D,nodeData:O,labelData:O,styles:E};if(!this.visible)return I;const{dataSources:C}=t,L=C.get(this.id)?.data??[];for(const{datumIndex:A,group:P}of e.forEachGroupDatum(this,t)){const z=L[A],B=n[A];if(B==null)return;const V=h[A],W=V>=0&&!Object.is(V,-0),H=l[A],G=c[A],K=P.aggregation[d][W?1:0]??0,U=W===b;if(H===void 0||G===void 0)return;let Y,$;if(L.length===1)Y=-.5*Math.PI,$=1.5*Math.PI;else{const st=a.convert(B);Y=normalizeAngle3605(st+i.convert(String(f))),$=normalizeAngle3605(Y+i.bandwidth)}const X=Y+i.bandwidth/2,Z=v-r.convert(H),q=v-r.convert(G),it=(Z+q)/2,J=v-r.convert(0),j=v-r.convert(K),tt=Math.cos(X)*it,Q=Math.sin(X)*it,ot=this.properties.label.enabled?F(z,V,tt,Q):void 0,et=this.getColumnWidth(Y,$);O.push({series:this,datum:z,datumIndex:A,point:{x:tt,y:Q,size:0},midPoint:{x:tt,y:Q},label:ot,angleValue:B,radiusValue:V,negative:U,innerRadius:Z,outerRadius:q,stackInnerRadius:J,stackOuterRadius:j,startAngle:Y,endAngle:$,midAngle:X,axisInnerRadius:m,axisOuterRadius:S,columnWidth:et,index:A})}return{itemId:D,nodeData:O,labelData:O,styles:E}}getColumnWidth(t,e){return Number.NaN}update({seriesRect:t}){const e=this.checkResize(t);this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updateSectorSelection(this.itemSelection,!1),this.updateSectorSelection(this.highlightSelection,!0),this.updateLabels(),e&&this.animationState.transition("resize"),this.animationState.transition("update")}updateSectorSelection(t,e){const{contextNodeData:i}=this;if(!i)return;const o=this.ctx.highlightManager.getActiveHighlight();let s=[];const a=this.ctx.highlightManager?.getActiveHighlight();e?a?.datum&&a.series===this&&s.push(a):s=this.nodeData;const r=this.isRadiusAxisReversed(),n=r?this.radius:this.getAxisInnerRadius(),l=r?this.getAxisInnerRadius():this.radius,c=this.getShapeFillBBox(),h=this.hasItemStylers();t.update(s,void 0,d=>this.getDatumId(d)).each((d,u)=>{const{midPoint:p}=u;if(h){const b=this.getHighlightState(a,e,u.datumIndex);u.style=getItemStyle(this,u,e,b)}const g=u.style??i.styles[this.getHighlightState(o,e,u.datumIndex)],y=g.fill,x=isGradientFill2(y)&&y.bounds==="item"?{centerX:p?.x??0,centerY:p?.y??0}:{centerX:0,centerY:0,innerRadius:n,outerRadius:l};this.updateItemPath(d,u,e),applyShapeStyle13(d,g,c,x),d.cornerRadius=g.cornerRadius??0,d.lineJoin="round"})}updateLabels(){const t=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((e,i)=>{updateLabelNode6(this,e,this.properties,this.properties.label,i.label,!1,t),e.fillOpacity=this.getHighlightStyle(!1,i.datumIndex).opacity??1})}animateEmptyUpdateReady(){const{labelSelection:t}=this,e=this.getColumnTransitionFunctions();motion6.fromToMotion(this.id,"datums",this.ctx.animationManager,[this.itemSelection],e),seriesLabelFadeInAnimation5(this,"labels",this.ctx.animationManager,t)}animateClearingUpdateEmpty(){const{itemSelection:t}=this,{animationManager:e}=this.ctx,i=this.getColumnTransitionFunctions();motion6.fromToMotion(this.id,"datums",e,[t],i),seriesLabelFadeOutAnimation(this,"labels",e,this.labelSelection)}getTooltipContent(t){const{id:e,dataModel:i,processedData:o,axes:s,properties:a}=this,{angleKey:r,angleName:n,radiusKey:l,radiusName:c,legendItemName:h,tooltip:d}=a,u=s[ChartAxisDirection28.Angle],p=s[ChartAxisDirection28.Radius],g=this.nodeData?.[t];if(!i||!o||!u||!p||!g)return;const y=o.dataSources.get(this.id)?.data[t],f=i.resolveKeysById(this,"angleValue",o)[t],x=i.resolveColumnById(this,"radiusValue-raw",o)[t];if(f==null)return;const b=getItemStyle(this,g,!1);return this.formatTooltipWithContext(d,{heading:this.getAxisValueText(u,"tooltip",f,y,r,void 0),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(p,"tooltip",x,y,l,void 0)}]},{seriesId:e,datum:y,title:n,angleKey:r,angleName:n,radiusKey:l,radiusName:c,legendItemName:h,...b})}pickNodeClosestDatum(t){return this.pickNodeNearestDistantObject(t,this.itemSelection.nodes())}legendItemSymbol(){const{fill:t,stroke:e,fillOpacity:i,strokeOpacity:o,strokeWidth:s,lineDash:a,lineDashOffset:r}=getStyle(this,!1,!1,import_ag_charts_community230._ModuleSupport.HighlightState.None),n={fill:t??"rgba(0, 0, 0, 0)",stroke:e??"rgba(0, 0, 0, 0)",fillOpacity:i,strokeOpacity:o,strokeWidth:s,lineDash:a,lineDashOffset:r};return import_ag_charts_community230._ModuleSupport.isGradientFill(n.fill)&&(n.fill={...n.fill,gradient:"linear",rotation:0,reverse:!1}),{marker:n}}getLegendData(t){if(t!=="category")return[];const{id:e,visible:i}=this,{radiusKey:o,radiusName:s,legendItemName:a,showInLegend:r}=this.properties;return[{legendType:"category",id:e,itemId:o,seriesId:e,enabled:i,label:{text:a??s??o},symbol:this.legendItemSymbol(),legendItemName:a,hideInLegend:!r}]}getDatumId(t){return createDatumId16(t.angleValue)}computeLabelsBBox(){return null}},import_ag_charts_community231=require("ag-charts-community"),{SeriesProperties:SeriesProperties8,makeSeriesTooltip:makeSeriesTooltip17,Property:Property75,Label:Label12}=import_ag_charts_community231._ModuleSupport,RadialColumnSeriesBaseProperties=class extends SeriesProperties8{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.label=new Label12,this.tooltip=makeSeriesTooltip17()}getStyle(){const{fill:t,fillOpacity:e,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r,cornerRadius:n}=this;return{fill:t,fillOpacity:e,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r,cornerRadius:n,opacity:1}}};__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"angleKey",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"angleName",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"radiusKey",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"radiusName",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"legendItemName",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"fill",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"fillOpacity",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"stroke",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"strokeWidth",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"strokeOpacity",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"lineDash",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"lineDashOffset",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"cornerRadius",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"styler",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"itemStyler",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"rotation",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"stackGroup",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"normalizedTo",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"label",2),__decorateClass([Property75],RadialColumnSeriesBaseProperties.prototype,"tooltip",2);var import_ag_charts_community233=require("ag-charts-community"),import_ag_charts_community232=require("ag-charts-community"),{motion:motion7}=import_ag_charts_community232._ModuleSupport;function createAngleMotionCalculator(){const t={startAngle:new Map,endAngle:new Map},e=["startAngle","endAngle"],i=(r,n,l)=>{for(const c of e){const h=t[c];let d=(l==="removed"||l==="updated"?r:n)[c],u=(l==="removed"?r:n)[c];Number.isNaN(u)&&(u=r.previousDatum?.[c]??Number.NaN);const p=d-u;Math.abs(p)>Math.PI&&(d-=Math.sign(p)*2*Math.PI),h.set(n,{from:d,to:u})}},o=(r,n)=>({startAngle:t.startAngle.get(r)[n],endAngle:t.endAngle.get(r)[n]});return{calculate:i,from:r=>o(r,"from"),to:r=>o(r,"to")}}function fixRadialColumnAnimationStatus(t,e,i){if(i==="updated"){if(t.previousDatum==null||Number.isNaN(t.previousDatum.startAngle)||Number.isNaN(t.previousDatum.endAngle))return"added";if(Number.isNaN(e.startAngle)||Number.isNaN(e.endAngle))return"removed"}return i==="added"&&t.previousDatum!=null?"updated":i}function prepareRadialColumnAnimationFunctions(t){const e=createAngleMotionCalculator();return{toFn:(s,a,r)=>{const{startAngle:n,endAngle:l}=e.to(a);let c,h,d,u,p;return r==="removed"?(c=s.innerRadius,h=s.innerRadius,d=s.columnWidth,u=s.axisInnerRadius,p=s.axisOuterRadius):(c=Number.isNaN(a.innerRadius)?t:a.innerRadius,h=Number.isNaN(a.outerRadius)?t:a.outerRadius,d=Number.isNaN(a.columnWidth)?s.columnWidth:a.columnWidth,u=a.axisInnerRadius,p=a.axisOuterRadius),{innerRadius:c,outerRadius:h,columnWidth:d,axisInnerRadius:u,axisOuterRadius:p,startAngle:n,endAngle:l}},fromFn:(s,a,r)=>{r=fixRadialColumnAnimationStatus(s,a,r),e.calculate(s,a,r);const{startAngle:n,endAngle:l}=e.from(a);let c,h,d,u,p;r==="removed"||r==="updated"?(c=s.innerRadius,h=s.outerRadius,d=s.columnWidth,u=s.axisInnerRadius,p=s.axisOuterRadius):(c=t,h=t,d=a.columnWidth,u=a.axisInnerRadius,p=a.axisOuterRadius);const g=motion7.NODE_UPDATE_STATE_TO_PHASE_MAPPING[r];return{innerRadius:c,outerRadius:h,columnWidth:d,axisInnerRadius:u,axisOuterRadius:p,startAngle:n,endAngle:l,phase:g}}}}function resetRadialColumnSelectionFn(t,{innerRadius:e,outerRadius:i,columnWidth:o,axisInnerRadius:s,axisOuterRadius:a,startAngle:r,endAngle:n}){return{innerRadius:e,outerRadius:i,columnWidth:o,axisInnerRadius:s,axisOuterRadius:a,startAngle:r,endAngle:n}}var{SectorBox,motion:motion8}=import_ag_charts_community233._ModuleSupport;function getRadii(t){const{negative:e,innerRadius:i,outerRadius:o,stackInnerRadius:s,stackOuterRadius:a}=t;return{innerRadius:e?a:s,outerRadius:e?s:a,clipInnerRadius:e?o:i,clipOuterRadius:e?i:o}}function prepareNightingaleAnimationFunctions(t){const e=createAngleMotionCalculator();return{toFn:(s,a,r)=>{const{startAngle:n,endAngle:l}=e.to(a);let c,h,d;if(r==="removed")c=t,h=t,d=new SectorBox(n,l,c,h);else{let u,p;({innerRadius:c,outerRadius:h,clipInnerRadius:u,clipOuterRadius:p}=getRadii(a)),Number.isNaN(c)&&(c=t),Number.isNaN(h)&&(h=t),Number.isNaN(u)&&(u=t),Number.isNaN(p)&&(p=t),d=new SectorBox(n,l,u,p)}return{innerRadius:c,outerRadius:h,startAngle:n,endAngle:l,clipSector:d}},fromFn:(s,a,r)=>{r=fixRadialColumnAnimationStatus(s,a,r),e.calculate(s,a,r);const{startAngle:n,endAngle:l}=e.from(a);let c,h,d;r==="removed"||r==="updated"?(c=s.innerRadius,h=s.outerRadius,d=s.clipSector):(c=t,h=t),d??(d=new SectorBox(n,l,c,h));const u=motion8.NODE_UPDATE_STATE_TO_PHASE_MAPPING[r];return{innerRadius:c,outerRadius:h,startAngle:n,endAngle:l,clipSector:d,phase:u}}}}function resetNightingaleSelectionFn(t,e){const{startAngle:i,endAngle:o}=e,{innerRadius:s,outerRadius:a,clipInnerRadius:r,clipOuterRadius:n}=getRadii(e),l=new SectorBox(i,o,r,n);return{innerRadius:s,outerRadius:a,startAngle:i,endAngle:o,clipSector:l}}var{Sector:Sector4,SectorBox:SectorBox2,PolarZIndexMap}=import_ag_charts_community234._ModuleSupport,NightingaleSeries=class extends RadialColumnSeriesBase{constructor(t){super(t,{animationResetFns:{item:resetNightingaleSelectionFn}}),this.properties=new RadialColumnSeriesBaseProperties}setZIndex(t){return super.setZIndex(t),this.contentGroup.zIndex=[0,PolarZIndexMap.FOREGROUND,t],this.highlightGroup.zIndex=[0,PolarZIndexMap.HIGHLIGHT,t],this.labelGroup.zIndex=[0,PolarZIndexMap.LABEL,t],!0}getStackId(){return`nightingale-stack-${this.seriesGrouping?.groupIndex??this.id}-yValues`}nodeFactory(){return new Sector4}updateItemPath(t,e,i){const{negative:o}=e;if(t.centerX=0,t.centerY=0,t.startOuterCornerRadius=o?0:this.properties.cornerRadius,t.endOuterCornerRadius=o?0:this.properties.cornerRadius,t.startInnerCornerRadius=o?this.properties.cornerRadius:0,t.endInnerCornerRadius=o?this.properties.cornerRadius:0,i){const{startAngle:s,endAngle:a}=e,{innerRadius:r,outerRadius:n,clipInnerRadius:l,clipOuterRadius:c}=getRadii(e);t.innerRadius=r,t.outerRadius=n,t.startAngle=s,t.endAngle=a,t.clipSector=new SectorBox2(s,a,l,c)}}getColumnTransitionFunctions(){const t=this.isRadiusAxisReversed()?this.radius:this.getAxisInnerRadius();return prepareNightingaleAnimationFunctions(t)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};NightingaleSeries.className="NightingaleSeries",NightingaleSeries.type="nightingale";var import_ag_charts_community235=require("ag-charts-community"),import_ag_charts_core102=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs15,nightingaleSeriesThemeableOptionsDef}=import_ag_charts_community235._ModuleSupport,nightingaleSeriesOptionsDef={...commonSeriesOptionsDefs15,...nightingaleSeriesThemeableOptionsDef,type:(0,import_ag_charts_core102.required)((0,import_ag_charts_core102.constant)("nightingale")),angleKey:(0,import_ag_charts_core102.required)(import_ag_charts_core102.string),radiusKey:(0,import_ag_charts_core102.required)(import_ag_charts_core102.string),angleName:import_ag_charts_core102.string,radiusName:import_ag_charts_core102.string,legendItemName:import_ag_charts_core102.string,grouped:import_ag_charts_core102.boolean,stacked:import_ag_charts_core102.boolean,stackGroup:import_ag_charts_core102.string,normalizedTo:import_ag_charts_core102.number},import_ag_charts_community236=require("ag-charts-community"),{ThemeConstants:{POLAR_AXIS_TYPE,POLAR_AXIS_SHAPE},FILL_GRADIENT_RADIAL_SERIES_DEFAULTS,FILL_IMAGE_DEFAULTS:FILL_IMAGE_DEFAULTS4,FILL_PATTERN_DEFAULTS:FILL_PATTERN_DEFAULTS2}=import_ag_charts_community236._ModuleSupport,NIGHTINGALE_SERIES_THEME={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",FILL_GRADIENT_RADIAL_SERIES_DEFAULTS],["image",FILL_IMAGE_DEFAULTS4],["pattern",FILL_PATTERN_DEFAULTS2]]},stroke:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$ref:"chartBackgroundColor"},{$palette:"stroke"}]},strokeWidth:1,label:{...import_ag_charts_community236._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:import_ag_charts_community236._ModuleSupport.multiSeriesHighlightStyle()},axes:{[POLAR_AXIS_TYPE.ANGLE_CATEGORY]:{shape:{$findFirstSiblingNotOperation:POLAR_AXIS_SHAPE.CIRCLE},groupPaddingInner:0,paddingInner:0,label:{spacing:10}},[POLAR_AXIS_TYPE.RADIUS_NUMBER]:{shape:{$findFirstSiblingNotOperation:POLAR_AXIS_SHAPE.CIRCLE}}}},{ThemeConstants:{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE2}}=import_ag_charts_community237._ModuleSupport,NightingaleModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"nightingale",moduleFactory:t=>new NightingaleSeries(t),defaultAxes:[{type:POLAR_AXIS_TYPE2.ANGLE_CATEGORY},{type:POLAR_AXIS_TYPE2.RADIUS_NUMBER}],themeTemplate:NIGHTINGALE_SERIES_THEME,stackable:!0,groupable:!0,stackedByDefault:!0},NightingaleSeriesModule={type:"series",name:"nightingale",chartType:"polar",enterprise:!0,options:nightingaleSeriesOptionsDef,create:t=>new NightingaleSeries(t)},import_ag_charts_community239=require("ag-charts-community"),import_ag_charts_core103=require("ag-charts-core"),import_ag_charts_community238=require("ag-charts-community"),{SeriesProperties:SeriesProperties9,makeSeriesTooltip:makeSeriesTooltip18,Property:Property76,Label:Label13,DropShadow:DropShadow5}=import_ag_charts_community238._ModuleSupport,PyramidSeriesLabel=class extends Label13{},PyramidSeriesStageLabel=class extends Label13{constructor(){super(...arguments),this.spacing=0}};__decorateClass([Property76],PyramidSeriesStageLabel.prototype,"spacing",2),__decorateClass([Property76],PyramidSeriesStageLabel.prototype,"placement",2);var PyramidProperties=class extends SeriesProperties9{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.direction="vertical",this.reverse=void 0,this.spacing=0,this.aspectRatio=void 0,this.shadow=new DropShadow5().set({enabled:!1}),this.label=new PyramidSeriesLabel,this.stageLabel=new PyramidSeriesStageLabel,this.tooltip=makeSeriesTooltip18()}getStyle(t=0){const{fills:e,strokes:i,fillOpacity:o,strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n}=this;return{fill:e[t%e.length],fillOpacity:o,stroke:i[t%i.length],strokeWidth:s,strokeOpacity:a,lineDash:r,lineDashOffset:n,opacity:1}}};__decorateClass([Property76],PyramidProperties.prototype,"stageKey",2),__decorateClass([Property76],PyramidProperties.prototype,"valueKey",2),__decorateClass([Property76],PyramidProperties.prototype,"fills",2),__decorateClass([Property76],PyramidProperties.prototype,"fillOpacity",2),__decorateClass([Property76],PyramidProperties.prototype,"strokes",2),__decorateClass([Property76],PyramidProperties.prototype,"strokeWidth",2),__decorateClass([Property76],PyramidProperties.prototype,"strokeOpacity",2),__decorateClass([Property76],PyramidProperties.prototype,"lineDash",2),__decorateClass([Property76],PyramidProperties.prototype,"lineDashOffset",2),__decorateClass([Property76],PyramidProperties.prototype,"direction",2),__decorateClass([Property76],PyramidProperties.prototype,"reverse",2),__decorateClass([Property76],PyramidProperties.prototype,"spacing",2),__decorateClass([Property76],PyramidProperties.prototype,"aspectRatio",2),__decorateClass([Property76],PyramidProperties.prototype,"itemStyler",2),__decorateClass([Property76],PyramidProperties.prototype,"shadow",2),__decorateClass([Property76],PyramidProperties.prototype,"label",2),__decorateClass([Property76],PyramidProperties.prototype,"stageLabel",2),__decorateClass([Property76],PyramidProperties.prototype,"tooltip",2);function applyPyramidDatum(t,{x:e,y:i,top:o,right:s,bottom:a,left:r}){t.x0=e-o/2,t.x1=e+o/2,t.x2=e+a/2,t.x3=e-a/2,t.y0=i-r/2,t.y1=i-s/2,t.y2=i+s/2,t.y3=i+r/2}function preparePyramidAnimationFunctions(t){return{fromFn:(s,a)=>{const{x:r,y:n}=a;let{top:l,right:c,bottom:h,left:d}=a;return t==="vertical"?(l=0,h=0):(d=0,c=0),{x:r,y:n,top:l,right:c,bottom:h,left:d}},toFn:(s,a)=>{const{x:r,y:n,top:l,right:c,bottom:h,left:d}=a;return{x:r,y:n,top:l,right:c,bottom:h,left:d}},applyFn:applyPyramidDatum}}var{StateMachine:StateMachine14,valueProperty:valueProperty16,SeriesNodePickMode:SeriesNodePickMode13,createDatumId:createDatumId17,BBox:BBox22,Group:Group16,Selection:Selection13,Text:Text7,PointerEvents:PointerEvents9,applyShapeStyle:applyShapeStyle14,mergeDefaults:mergeDefaults17,fromToMotion:fromToMotion4,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation6,getLabelStyles:getLabelStyles5}=import_ag_charts_community239._ModuleSupport,PyramidSeries=class extends import_ag_charts_community239._ModuleSupport.DataModelSeries{constructor(t){super({moduleCtx:t,categoryKey:void 0,pickModes:[SeriesNodePickMode13.EXACT_SHAPE_MATCH,SeriesNodePickMode13.NEAREST_NODE]}),this.properties=new PyramidProperties,this.itemGroup=this.contentGroup.appendChild(new Group16({name:"itemGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Group16({name:"itemLabelGroup"})),this.stageLabelGroup=this.contentGroup.appendChild(new Group16({name:"stageLabelGroup"})),this.datumSelection=Selection13.select(this.itemGroup,()=>this.nodeFactory()),this.labelSelection=Selection13.select(this.itemLabelGroup,Text7),this.stageLabelSelection=Selection13.select(this.stageLabelGroup,Text7),this.highlightDatumSelection=Selection13.select(this.highlightGroup,()=>this.nodeFactory()),this.animationState=new StateMachine14("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{clear:"empty",reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable()),this.itemLabelGroup.pointerEvents=PointerEvents9.None,this.stageLabelGroup.pointerEvents=PointerEvents9.None}addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",t=>this.onLegendItemClick(t)))}nodeFactory(){return new FunnelConnector}getNodeData(){return this.contextNodeData?.nodeData}resetAnimation(t){t==="initial"?this.animationState.transition("reset"):t==="ready"&&this.animationState.transition("skip")}async processData(t){if(this.data==null)return;const{id:e,visible:i,ctx:{legendManager:o}}=this,{stageKey:s,valueKey:a}=this.properties,r="category",n="number",l=(h,d,u)=>i&&o.getItemEnabled({seriesId:e,itemId:u}),c=this.visible?{}:{forceValue:0};await this.requestDataModel(t,this.data,{props:[valueProperty16(s,r,{id:"xValue"}),valueProperty16(a,n,{id:"yValue",...c,validation:l,invalidValue:0})]})}createNodeData(){const{id:t,dataModel:e,processedData:i,properties:o,visible:s,ctx:{legendManager:a}}=this,{stageKey:r,valueKey:n,direction:l,reverse:c=l==="horizontal",spacing:h,aspectRatio:d,label:u,stageLabel:p}=o;if(e==null||i==null)return;const g=l==="horizontal",y=e.resolveColumnById(this,"xValue",i),f=e.resolveColumnById(this,"yValue",i),x=e.getDomain(this,"xValue","value",i),b=e.getDomain(this,"yValue","value",i),m=(0,import_ag_charts_core103.cachedTextMeasurer)(p);let S,v;g?(S="center",v=p.placement==="before"?"bottom":"top"):(S=p.placement==="after"?"left":"right",v="middle");const M=p.enabled?[]:void 0;let D=0,k=0,_=0;const T=i.dataSources.get(this.id)?.data??[];for(const[B,V]of T.entries()){const W=y[B],H=f[B],G=s&&a.getItemEnabled({seriesId:t,itemId:B});if(_+=H,M==null)continue;const K=this.getLabelText(W,V,r,"x",x,this.properties.stageLabel,{datum:V,value:H,stageKey:r,valueKey:n}),{width:U,height:Y}=(0,import_ag_charts_core103.isArray)(K)?(0,import_ag_charts_core103.measureTextSegments)(K,u):m.measureLines(K);D=Math.max(D,U),k=Math.max(k,Y),M.push({x:Number.NaN,y:Number.NaN,text:K,textAlign:S,textBaseline:v,visible:G})}const w=this._nodeDataDependencies?.seriesRectWidth??0,R=this._nodeDataDependencies?.seriesRectHeight??0,F=h*(i.input.count-1);let O;if(g){const B=k+p.spacing;O=new BBox22(0,p.placement==="before"?B:0,w,R-B)}else{const B=D+p.spacing;O=new BBox22(p.placement==="after"?0:B,0,w-B,R)}if(d!=null&&d!==0){const B=l==="horizontal"?1/d:d,V=Math.min(O.width,O.height*B),W=V/B;O=new BBox22(O.x+(O.width-V)/2,O.y+(O.height-W)/2,V,W)}let E,I;g?I=p.placement==="before"?O.y-p.spacing:O.y+O.height+p.spacing:E=p.placement==="after"?O.x+O.width+p.spacing:O.x-p.spacing;const C=O.width-(g?F:0),L=O.height-(g?0:F);if(C<0||L<0)return;const A=[],P=[];let z=0;for(const[B,V]of T.entries()){const W=y[B],H=f[B],G=s&&a.getItemEnabled({seriesId:t,itemId:B}),K=z+H,U=(z+K)/(2*_),Y=(K-z)/_,$=g?C*U+h*B:C*.5,X=g?L*.5:L*U+h*B,Z=O.x+$,q=O.y+X;if(M!=null){const et=M[B];et.x=E??Z,et.y=I??q}let it,J,j,tt;if(g){const et=C*Y;it=et,j=et;const st=($+et/2)*(L/O.width),rt=($-et/2)*(L/O.width);J=c?O.height-st:st,tt=c?O.height-rt:rt}else{const et=L*Y;J=et,tt=et;const st=(X-et/2)*(C/O.height),rt=(X+et/2)*(C/O.height);it=c?O.width-st:st,j=c?O.width-rt:rt}const Q=this.getLabelText(H,V,n,"y",b,u,{datum:V,value:H,stageKey:r,valueKey:n}),ot={x:Z,y:q,text:Q,textAlign:"center",textBaseline:"middle",visible:G};P.push(ot),A.push({series:this,itemId:n,datum:V,datumIndex:B,index:B,xValue:W,yValue:H,x:Z,y:q,top:it,right:J,bottom:j,left:tt,label:ot,enabled:G,midPoint:{x:Z,y:q},style:this.getItemStyle({datumIndex:B,datum:V},!1)}),z=K}return{itemId:t,nodeData:A,labelData:P,stageLabelData:M,bounds:O}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update({seriesRect:t}){this.checkResize(t);const{datumSelection:e,labelSelection:i,stageLabelSelection:o,highlightDatumSelection:s}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.contentGroup.opacity=this.getOpacity();let a=this.ctx.highlightManager?.getActiveHighlight();a!=null&&(a.series!==this||a.datum==null)&&(a=void 0);const r=this.contextNodeData?.nodeData??[],n=this.contextNodeData?.labelData??[],l=this.contextNodeData?.stageLabelData??[];this.datumSelection=this.updateDatumSelection({nodeData:r,datumSelection:e}),this.updateDatumStyles({datumSelection:e,isHighlight:!1}),this.updateDatumNodes({datumSelection:e,isHighlight:!1}),this.labelSelection=this.updateLabelSelection({labelData:n,labelSelection:i}),this.updateLabelNodes({labelSelection:i,labelProperties:this.properties.label}),this.stageLabelSelection=this.updateStageLabelSelection({stageLabelData:l,stageLabelSelection:o}),this.updateLabelNodes({labelSelection:o,labelProperties:this.properties.stageLabel}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:a==null?[]:[a],datumSelection:s}),this.updateDatumStyles({datumSelection:s,isHighlight:!0}),this.updateDatumNodes({datumSelection:s,isHighlight:!0}),this.animationState.transition("update")}updateDatumSelection(t){return t.datumSelection.update(t.nodeData)}getItemStyle({datumIndex:t,datum:e},i){const{properties:o}=this,{itemStyler:s}=o,a=this.getHighlightStyle(i,t);let n=mergeDefaults17(a,o.getStyle(t));if(s!=null&&t!=null){const l=this.cachedDatumCallback(createDatumId17(t,i?"highlight":"node"),()=>{const c=this.makeItemStylerParams(e,t,i,n);return this.callWithContext(s,c)});l&&(n=mergeDefaults17(l,n))}return n}makeItemStylerParams(t,e,i,o){const{id:s,properties:a}=this,{stageKey:r,valueKey:n}=a,l=this.ctx.highlightManager?.getActiveHighlight(),c=this.getHighlightStateString(l,i,e),h=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:s,datum:t,stageKey:r,valueKey:n,highlighted:i,highlightState:c,...o,fill:h}}updateDatumStyles({datumSelection:t,isHighlight:e}){t.each((i,o)=>{o.style=this.getItemStyle(o,e)})}updateDatumNodes({datumSelection:t}){const{properties:e}=this,{shadow:i}=e,o=this.contextNodeData?.bounds,s=o?{series:o,axis:o}:void 0;t.each((a,r)=>{applyShapeStyle14(a,r.style,s),applyPyramidDatum(a,r),a.fillShadow=i})}updateLabelSelection(t){return t.labelSelection.update(this.properties.label.enabled?t.labelData:[])}updateStageLabelSelection(t){return t.stageLabelSelection.update(t.stageLabelData)}updateLabelNodes(t){const e=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((i,o,s)=>{const{visible:a,x:r,y:n,text:l,textAlign:c,textBaseline:h}=o,d=getLabelStyles5(this,void 0,this.properties,t.labelProperties,!1,e),{color:u,fontSize:p,fontStyle:g,fontWeight:y,fontFamily:f}=d;i.visible=a,i.x=r,i.y=n,i.text=l,i.fill=u,i.fillOpacity=this.getHighlightStyle(!1,s).opacity??1,i.fontStyle=g,i.fontWeight=y,i.fontSize=p,i.fontFamily=f,i.textAlign=c,i.textBaseline=h,i.setBoxing(d)})}computeFocusBounds(t){const e=this.getNodeData()?.[t.datumIndex];if(e!==void 0){for(const i of this.datumSelection)if(i.datum===e)return i.node}}getTooltipContent(t){const{id:e,dataModel:i,processedData:o,properties:s}=this,{stageKey:a,valueKey:r,tooltip:n}=s;if(!i||!o)return;const l=o.dataSources.get(this.id)?.data[t],c=i.resolveColumnById(this,"xValue",o)[t],h=i.resolveColumnById(this,"yValue",o)[t];if(c==null)return;const d=this.getLabelText(c,l,a,"x",i.getDomain(this,"xValue","value",o),this.properties.stageLabel,{datum:l,value:c,stageKey:a,valueKey:r}),u=this.getLabelText(h,l,r,"y",i.getDomain(this,"yValue","value",o),this.properties.stageLabel,{datum:l,value:h,stageKey:a,valueKey:r}),p=this.getItemStyle({datumIndex:t,datum:l},!1);return this.formatTooltipWithContext(n,{symbol:this.legendItemSymbol(t),data:[{label:(0,import_ag_charts_core103.toPlainText)(d),value:(0,import_ag_charts_core103.toPlainText)(u)}]},{seriesId:e,datum:l,title:void 0,stageKey:a,valueKey:r,...p})}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(t,e){return[Number.NaN,Number.NaN]}pickNodeClosestDatum({x:t,y:e}){let i=1/0,o;return this.datumSelection.each((s,a)=>{const r=s.distanceSquared(t,e);rnew PyramidSeries(t),solo:!0,themeTemplate:PYRAMID_SERIES_THEME},PyramidSeriesModule={type:"series",name:"pyramid",chartType:"standalone",enterprise:!0,options:pyramidSeriesOptionsDef,create:t=>new PyramidSeries(t)},import_ag_charts_community248=require("ag-charts-community"),import_ag_charts_community242=require("ag-charts-community"),{ThemeConstants:{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE3}}=import_ag_charts_community242._ModuleSupport,BASE_RADAR_SERIES_THEME={series:{stroke:{$palette:"stroke"},label:{...import_ag_charts_community242._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},marker:{enabled:!0,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community242._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",import_ag_charts_community242._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community242._ModuleSupport.FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},fillOpacity:1,shape:"circle",size:6,strokeOpacity:1,strokeWidth:{$isUserOption:["./stroke",1,0]}},highlight:import_ag_charts_community242._ModuleSupport.multiSeriesHighlightStyle(),tooltip:{range:{$path:["/tooltip/range","nearest"]}}},axes:{[POLAR_AXIS_TYPE3.ANGLE_CATEGORY]:{label:{spacing:10}}}},RADAR_LINE_SERIES_THEME=import_ag_charts_community242._ModuleSupport.mergeDefaults({series:{stroke:import_ag_charts_community242._ModuleSupport.SAFE_STROKE_FILL_OPERATION,strokeWidth:2}},BASE_RADAR_SERIES_THEME),RADAR_AREA_SERIES_THEME=import_ag_charts_community242._ModuleSupport.mergeDefaults({series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",import_ag_charts_community242._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["image",import_ag_charts_community242._ModuleSupport.FILL_IMAGE_DEFAULTS],["pattern",import_ag_charts_community242._ModuleSupport.FILL_PATTERN_DEFAULTS]]},fillOpacity:.8,strokeWidth:2,marker:{enabled:!1}}},BASE_RADAR_SERIES_THEME),import_ag_charts_community246=require("ag-charts-community"),import_ag_charts_community244=require("ag-charts-community"),import_ag_charts_core105=require("ag-charts-core"),import_ag_charts_community243=require("ag-charts-community"),{Label:Label14,SeriesMarker:SeriesMarker2,SeriesProperties:SeriesProperties10,makeSeriesTooltip:makeSeriesTooltip19,Property:Property77}=import_ag_charts_community243._ModuleSupport,RadarSeriesProperties=class extends SeriesProperties10{constructor(){super(...arguments),this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.rotation=0,this.marker=new SeriesMarker2,this.label=new Label14,this.tooltip=makeSeriesTooltip19(),this.connectMissingData=!1}};__decorateClass([Property77],RadarSeriesProperties.prototype,"angleKey",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"radiusKey",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"angleName",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"radiusName",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"legendItemName",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"stroke",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"lineDash",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"rotation",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"styler",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"marker",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"label",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"tooltip",2),__decorateClass([Property77],RadarSeriesProperties.prototype,"connectMissingData",2);var{DEFAULT_POLAR_DIRECTION_KEYS:DEFAULT_POLAR_DIRECTION_KEYS2,DEFAULT_POLAR_DIRECTION_NAMES:DEFAULT_POLAR_DIRECTION_NAMES2,ChartAxisDirection:ChartAxisDirection29,PolarAxis:PolarAxis2,SeriesNodePickMode:SeriesNodePickMode14,valueProperty:valueProperty17,fixNumericExtent:fixNumericExtent9,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation7,markerFadeInAnimation:markerFadeInAnimation2,resetMarkerFn:resetMarkerFn2,animationValidation:animationValidation8,computeMarkerFocusBounds:computeMarkerFocusBounds3,extent:extent2,BBox:BBox23,Group:Group17,Path:Path12,Selection:Selection14,Text:Text8,Marker:Marker5,updateLabelNode:updateLabelNode7,getMarkerStyles:getMarkerStyles2,mergeDefaults:mergeDefaults18}=import_ag_charts_community244._ModuleSupport,RadarSeriesNodeEvent=class extends import_ag_charts_community244._ModuleSupport.SeriesNodeEvent{constructor(t,e,i,o){super(t,e,i,o),this.angleKey=o.properties.angleKey,this.radiusKey=o.properties.radiusKey}},RadarSeries=class extends import_ag_charts_community244._ModuleSupport.PolarSeries{constructor(t){super({moduleCtx:t,categoryKey:"angleValue",propertyKeys:DEFAULT_POLAR_DIRECTION_KEYS2,propertyNames:DEFAULT_POLAR_DIRECTION_NAMES2,pickModes:[SeriesNodePickMode14.NEAREST_NODE,SeriesNodePickMode14.EXACT_SHAPE_MATCH],canHaveAxes:!0,animationResetFns:{item:resetMarkerFn2},clipFocusBox:!1}),this.NodeEvent=RadarSeriesNodeEvent,this.lineGroup=this.contentGroup.appendChild(new Group17({name:"radar-line"})),this.lineSelection=Selection14.select(this.lineGroup,Path12),this.resetInvalidToZero=!1,this.circleCache={r:0,cx:0,cy:0},this.lineGroup.zIndex=0,this.itemGroup.zIndex=1}get hasData(){return this.getHasData("angleValue")}nodeFactory(){return new Marker5}getSeriesDomain(t){const{dataModel:e,processedData:i}=this;if(!i||!e)return[];if(t===ChartAxisDirection29.Angle)return e.getDomain(this,"angleValue","value",i);{const o=e.getDomain(this,"radiusValue","value",i),s=extent2(o.length===0?o:[0].concat(o));return fixNumericExtent9(s)}}async processData(t){const{angleKey:e,radiusKey:i}=this.properties,o=[];this.ctx.animationManager.isSkipped()||o.push(animationValidation8());const s=this.axes[ChartAxisDirection29.Radius]?.scale.type,a=this.axes[ChartAxisDirection29.Angle]?.scale.type;await this.requestDataModel(t,this.data,{props:[valueProperty17(e,a,{id:"angleValue"}),valueProperty17(i,s,{id:"radiusValue",invalidValue:void 0}),...o]}),this.animationState.transition("updateData")}didCircleChange(){const t=this.radius,e=this.centerX,i=this.centerY,o=this.circleCache;return t===o.r&&e===o.cx&&i===o.cy?!1:(this.circleCache={r:t,cx:e,cy:i},!0)}getAxisInnerRadius(){const t=this.axes[ChartAxisDirection29.Radius];return t instanceof PolarAxis2?this.radius*t.innerRadiusRatio:0}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}createNodeData(){const{processedData:t,dataModel:e}=this;if(!t||!e)return;const{angleKey:i,radiusKey:o,angleName:s,radiusName:a,legendItemName:r,marker:n,label:l}=this.properties,c=this.axes[ChartAxisDirection29.Angle]?.scale,h=this.axes[ChartAxisDirection29.Radius]?.scale;if(!c||!h)return;const d=e.resolveColumnById(this,"angleValue",t),u=e.resolveColumnById(this,"radiusValue",t),p=this.getAxisInnerRadius(),g=this.getSeriesDomain(ChartAxisDirection29.Radius),f=(t.dataSources.get(this.id)?.data??[]).map((x,b)=>{const m=d[b],S=u[b],v=c.convert(m),M=this.radius+p-h.convert(S),D=Math.cos(v),k=Math.sin(v),_=D*M,T=k*M;let w;if(l.enabled){const R=this.getLabelText(S,x,o,"radius",g,l,{value:S,datum:x,angleKey:i,radiusKey:o,angleName:s,radiusName:a,legendItemName:r});if(R){let F="right";(0,import_ag_charts_core105.isNumberEqual)(D,0)?F="center":D>0&&(F="left");let O="bottom";(0,import_ag_charts_core105.isNumberEqual)(k,0)?O="middle":k>0&&(O="top"),w={x:_+D*n.size,y:T+k*n.size,text:R,textAlign:F,textBaseline:O}}}return{series:this,datum:x,datumIndex:b,index:b,point:{x:_,y:T,size:n.size},midPoint:{x:_,y:T},label:w,angleValue:m,radiusValue:S,missing:!(0,import_ag_charts_core105.isFiniteNumber)(v)||!(0,import_ag_charts_core105.isFiniteNumber)(M)}});return{itemId:o,nodeData:f,labelData:f,styles:getMarkerStyles2(this,this.properties,n)}}update({seriesRect:t}){const e=this.checkResize(t),i=!this.ctx.animationManager.isSkipped(),{series:o}=this.ctx.highlightManager?.getActiveHighlight()??{};this.highlightGroup.visible=(i||this.visible)&&o===this,this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updatePathSelections(),this.updateMarkerSelection(),this.updateHighlightSelection(),this.updatePathNodes(),this.hasItemStylers()&&(this.updateDatumStyles(this.itemSelection,!1),this.updateDatumStyles(this.highlightSelection,!0)),this.updateMarkers(this.itemSelection,!1),this.updateMarkers(this.highlightSelection,!0),this.updateLabels(),e&&this.animationState.transition("resize"),this.animationState.transition("update")}updatePathSelections(){const t=this.visible?[!0]:[];this.lineSelection.update(t)}updateMarkerSelection(){const{marker:t,styler:e}=this.properties;t.isDirty()&&(this.itemSelection.clear(),this.itemSelection.cleanup(),this.itemSelection=Selection14.select(this.itemGroup,()=>this.nodeFactory(),!1));const i=e==null?t.enabled:this.getStyle(!1).marker.enabled,o=this.visible&&t.shape&&i?this.nodeData:[];this.itemSelection.update(o)}updateHighlightSelection(){const{marker:t,styler:e}=this.properties;t.isDirty()&&(this.highlightSelection.clear(),this.highlightSelection.cleanup(),this.highlightSelection=Selection14.select(this.highlightGroup,()=>this.nodeFactory(),!1));const i=e==null?t.enabled:this.getStyle(!1).marker.enabled,o=this.ctx.highlightManager?.getActiveHighlight(),s=this.visible&&t.shape&&i&&o?.datum?[{...o}]:[];this.highlightSelection.update(s)}getMarkerFill(t){return t?.fill??this.getStyle(!1).marker.fill}getDatumStylerProperties(t){const{id:e,properties:i}=this,{angleKey:o,radiusKey:s}=i;return{seriesId:e,datum:t,angleKey:o,radiusKey:s}}updateDatumStyles(t,e){const i=this.ctx.highlightManager.getActiveHighlight();t.each((o,s)=>{const a=this.getHighlightState(i,e,s.datumIndex),r=this.getStyle(e,a),{stroke:n,strokeWidth:l,strokeOpacity:c}=r;s.style=this.getMarkerStyle(this.properties.marker,s,this.getDatumStylerProperties(s.datum),{isHighlight:e,highlightState:a},r.marker,{stroke:n,strokeWidth:l,strokeOpacity:c})})}updateMarkers(t,e){const i=this.getShapeFillBBox(),{contextNodeData:o}=this;if(!o)return;const s=this.ctx.highlightManager.getActiveHighlight();t.each((a,r)=>{const n=r.style??o.styles[this.getHighlightState(s,e,r.datumIndex)];this.applyMarkerStyle(n,a,r.point,i)})}updateLabels(){const{properties:t}=this,e=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((i,o)=>{o.label&&(i.fillOpacity=this.getHighlightStyle(!1,o.datumIndex).opacity??1,updateLabelNode7(this,i,t,t.label,o.label,!1,e))})}getTooltipContent(t){const{id:e,dataModel:i,processedData:o,axes:s,properties:a}=this,{angleKey:r,angleName:n,radiusKey:l,radiusName:c,legendItemName:h,tooltip:d,marker:u}=a,p=s[ChartAxisDirection29.Angle],g=s[ChartAxisDirection29.Radius];if(!i||!o||!p||!g)return;const y=o.dataSources.get(this.id)?.data[t],f=i.resolveColumnById(this,"angleValue",o)[t],x=i.resolveColumnById(this,"radiusValue",o)[t];if(f==null)return;const b=this.getMarkerStyle(u,{datum:y,datumIndex:t},this.getDatumStylerProperties(y),{isHighlight:!1});return this.formatTooltipWithContext(d,{heading:this.getAxisValueText(p,"tooltip",f,y,r,void 0),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(g,"tooltip",x,y,l,void 0)}]},{seriesId:e,datum:y,title:n,angleKey:r,radiusKey:l,angleName:n,radiusName:c,legendItemName:h,...b})}legendItemSymbol(){const{stroke:t,strokeWidth:e,strokeOpacity:i,lineDash:o,marker:s}=this.getStyle(!1);return{marker:{shape:s.shape,enabled:s.enabled||e<=0,fill:this.getMarkerFill()??s.stroke??t??"rgba(0, 0, 0, 0)",stroke:s.stroke??t??"rgba(0, 0, 0, 0)",fillOpacity:s.fillOpacity,strokeOpacity:s.strokeOpacity,strokeWidth:s.strokeWidth,lineDash:s.lineDash,lineDashOffset:s.lineDashOffset},line:{stroke:t,strokeOpacity:i,strokeWidth:e,lineDash:o}}}getLegendData(t){if(t!=="category")return[];const{id:e,ctx:{legendManager:i},visible:o}=this,{radiusKey:s,radiusName:a,legendItemName:r,showInLegend:n}=this.properties;return[{legendType:"category",id:e,itemId:s,seriesId:e,enabled:o&&i.getItemEnabled({seriesId:e,itemId:s}),label:{text:r??a??s},symbol:this.legendItemSymbol(),legendItemName:r,hideInLegend:!n}]}pickNodeClosestDatum(t){const{nodeData:e,centerX:i,centerY:o}=this,{x:s,y:a}=t,r=this.radius;if(Math.hypot(s-i,a-o)>r+this.properties.marker.size)return;let l=1/0,c;for(const h of e){const{point:{x:d=Number.NaN,y:u=Number.NaN}={}}=h;if(Number.isNaN(d)||Number.isNaN(u))continue;const p=Math.hypot(t.x-d-i,t.y-u-o);pthis.animatePaths(o),onStop:()=>this.animatePaths(1)}),markerFadeInAnimation2(this,i,"added",t),seriesLabelFadeInAnimation7(this,"labels",i,e)}animateWaitingUpdateReady(t){super.animateWaitingUpdateReady(t),this.resetPaths()}animateReadyResize(t){super.animateReadyResize(t),this.resetPaths()}resetPaths(){const t=this.getLineNode();if(t){const{path:e}=t,i=this.getLinePoints(),o=this.getStyle(!1);t.fill=void 0,t.stroke=o.stroke,t.strokeWidth=o.strokeWidth,t.strokeOpacity=o.strokeOpacity,t.lineDash=o.lineDash,t.lineDashOffset=o.lineDashOffset,e.clear(!0);for(const{x:s,y:a,moveTo:r}of i)r?e.moveTo(s,a):e.lineTo(s,a);return t.checkPathDirty(),o}}getStylerResult(t,e,i){const{styler:o}=this.properties;if(o){const s=this.makeStylerParams(e,i),a=this.cachedCallWithContext(o,s)??{},r=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],a,{pick:!1});r&&(t=r)}return t}getFormattedMarkerStyle(t){const{angleKey:e,radiusKey:i}=this.properties;return this.getMarkerStyle(this.properties.marker,t,{angleKey:e,radiusKey:i},{isHighlight:!0})}computeFocusBounds(t){return computeMarkerFocusBounds3(this,t)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};RadarSeries.className="RadarSeries";var import_ag_charts_community245=require("ag-charts-community"),{Property:Property78}=import_ag_charts_community245._ModuleSupport,RadarAreaSeriesProperties=class extends RadarSeriesProperties{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1}};__decorateClass([Property78],RadarAreaSeriesProperties.prototype,"fill",2),__decorateClass([Property78],RadarAreaSeriesProperties.prototype,"fillOpacity",2);var{ChartAxisDirection:ChartAxisDirection30,Group:Group18,HighlightState:HighlightState4,Path:Path13,PointerEvents:PointerEvents10,Selection:Selection15,applyShapeStyle:applyShapeStyle15,toHighlightString:toHighlightString5}=import_ag_charts_community246._ModuleSupport,RadarAreaSeries=class extends RadarSeries{constructor(t){super(t),this.properties=new RadarAreaSeriesProperties,this.areaGroup=this.contentGroup.appendChild(new Group18({name:"radar-area"})),this.areaSelection=Selection15.select(this.areaGroup,Path13),this.resetInvalidToZero=!0,this.areaGroup.zIndex=-1}updatePathSelections(){const t=this.visible?[!0]:[];this.areaSelection.update(t),super.updatePathSelections()}getAreaNode(){return this.areaSelection.at(0)}getMarkerFill(t){if(t?.fill!=null)return t.fill;const e=this.getStyle(!1);return e.marker.fill??e.fill}updatePathNodes(){const t=this.getPathNodesStyle(),{fill:e,fillOpacity:i,strokeWidth:o,stroke:s,strokeOpacity:a,lineDash:r,lineDashOffset:n,opacity:l}=t,c=this.getLineNode();c&&c.setProperties({fill:void 0,lineJoin:"round",lineCap:"round",pointerEvents:PointerEvents10.None,opacity:l,stroke:s,strokeWidth:o,strokeOpacity:a,lineDash:r,lineDashOffset:n});const h=this.getAreaNode();h&&(applyShapeStyle15(h,{fill:e,fillOpacity:i,stroke:void 0},this.getShapeFillBBox()),h.setProperties({lineJoin:"round",pointerEvents:PointerEvents10.None,opacity:l}))}animatePaths(t){super.animatePaths(t);const e=this.getAreaNode();e&&this.animateSinglePath(e,this.getAreaPoints(),t)}getAreaPoints(){const t=this.getLinePoints(),e=r=>{const n=this.axes[r];return n instanceof import_ag_charts_community246._ModuleSupport.PolarAxis?n:void 0},i=e(ChartAxisDirection30.Radius),o=e(ChartAxisDirection30.Angle);if(!i?.isReversed())return t;const a=o?.getAxisLinePoints()?.points??[];return t.concat(...a)}resetPaths(){const t=super.resetPaths(),e=this.getAreaNode();if(e){const{path:i}=e,o=this.getAreaPoints(),s=t??this.getStyle(!1),a=this.getShapeFillBBox();applyShapeStyle15(e,{fill:s.fill,stroke:void 0,fillOpacity:s.fillOpacity,lineDash:s.lineDash,lineDashOffset:s.lineDashOffset},a),e.lineJoin=e.lineCap="round",i.clear(!0);for(const{x:r,y:n,moveTo:l,arc:c,radius:h=0,startAngle:d=0,endAngle:u=0}of o)c?i.arc(r,n,h,d,u):l?i.moveTo(r,n):i.lineTo(r,n);return i.closePath(),e.checkPathDirty(),s}}makeStylerParams(t,e){const{properties:i}=this,o=toHighlightString5(e??HighlightState4.None);return{marker:{fill:i.marker.fill,fillOpacity:i.marker.fillOpacity,size:i.marker.size,shape:i.marker.shape,stroke:i.marker.stroke,strokeOpacity:i.marker.strokeOpacity,strokeWidth:i.marker.strokeWidth,lineDash:i.marker.lineDash,lineDashOffset:i.marker.lineDashOffset},highlightState:o,highlighted:t,fill:i.fill,fillOpacity:i.fillOpacity,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,seriesId:this.id,stroke:i.stroke,strokeOpacity:i.strokeOpacity,strokeWidth:i.strokeWidth,angleKey:i.angleKey,radiusKey:i.radiusKey}}getStyle(t,e){const{marker:i,fill:o,fillOpacity:s,lineDash:a,lineDashOffset:r,stroke:n,strokeOpacity:l,strokeWidth:c}=this.properties,{size:h,shape:d,fill:u="transparent",fillOpacity:p}=i,g=this.getStylerResult({},t,e);return g.marker??(g.marker={}),{fill:g.fill??o,fillOpacity:g.fillOpacity??s,lineDash:g.lineDash??a,lineDashOffset:g.lineDashOffset??r,stroke:g.stroke??n,strokeOpacity:g.strokeOpacity??l,strokeWidth:g.strokeWidth??c,marker:{enabled:g.marker.enabled??i.enabled,fill:g.marker.fill??u,fillOpacity:g.marker.fillOpacity??p,shape:g.marker.shape??d,size:g.marker.size??h,lineDash:g.marker.lineDash??i.lineDash??a,lineDashOffset:g.marker.lineDashOffset??i.lineDashOffset??r,stroke:g.marker.stroke??i.stroke??n,strokeOpacity:g.marker.strokeOpacity??i.strokeOpacity??l,strokeWidth:g.marker.strokeWidth??i.strokeWidth??c}}}};RadarAreaSeries.className="RadarAreaSeries",RadarAreaSeries.type="radar-area";var import_ag_charts_community247=require("ag-charts-community"),import_ag_charts_core106=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs17,radarAreaSeriesThemeableOptionsDef}=import_ag_charts_community247._ModuleSupport,radarAreaSeriesOptionsDef={...commonSeriesOptionsDefs17,...radarAreaSeriesThemeableOptionsDef,type:(0,import_ag_charts_core106.required)((0,import_ag_charts_core106.constant)("radar-area")),angleKey:(0,import_ag_charts_core106.required)(import_ag_charts_core106.string),radiusKey:(0,import_ag_charts_core106.required)(import_ag_charts_core106.string),angleName:import_ag_charts_core106.string,radiusName:import_ag_charts_core106.string,legendItemName:import_ag_charts_core106.string},{ThemeConstants:{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE4}}=import_ag_charts_community248._ModuleSupport,RadarAreaModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radar-area",moduleFactory:t=>new RadarAreaSeries(t),defaultAxes:[{type:POLAR_AXIS_TYPE4.ANGLE_CATEGORY},{type:POLAR_AXIS_TYPE4.RADIUS_NUMBER}],themeTemplate:RADAR_AREA_SERIES_THEME},RadarAreaSeriesModule={type:"series",name:"radar-area",chartType:"polar",enterprise:!0,options:radarAreaSeriesOptionsDef,create:t=>new RadarAreaSeries(t)},import_ag_charts_community251=require("ag-charts-community"),import_ag_charts_community249=require("ag-charts-community"),{HighlightState:HighlightState5,PointerEvents:PointerEvents11,toHighlightString:toHighlightString6}=import_ag_charts_community249._ModuleSupport,RadarLineSeries=class extends RadarSeries{constructor(){super(...arguments),this.properties=new RadarSeriesProperties}updatePathSelections(){this.lineSelection.update(this.visible?[!0]:[])}updatePathNodes(){const t=this.getLineNode();if(!t)return;const e=this.getPathNodesStyle(),{strokeWidth:i,stroke:o,strokeOpacity:s,lineDash:a,lineDashOffset:r,opacity:n}=e;t.setProperties({fill:void 0,lineJoin:"round",lineCap:"round",pointerEvents:PointerEvents11.None,opacity:n,stroke:o,strokeWidth:i,strokeOpacity:s,lineDash:a,lineDashOffset:r})}makeStylerParams(t,e){const{properties:i}=this,o=toHighlightString6(e??HighlightState5.None);return{marker:{fill:i.marker.fill,fillOpacity:i.marker.fillOpacity,size:i.marker.size,shape:i.marker.shape,stroke:i.marker.stroke,strokeOpacity:i.marker.strokeOpacity,strokeWidth:i.marker.strokeWidth,lineDash:i.marker.lineDash,lineDashOffset:i.marker.lineDashOffset},highlightState:o,highlighted:t,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,seriesId:this.id,stroke:i.stroke,strokeOpacity:i.strokeOpacity,strokeWidth:i.strokeWidth,angleKey:i.angleKey,radiusKey:i.radiusKey}}getStyle(t,e){const{marker:i,lineDash:o,lineDashOffset:s,stroke:a,strokeOpacity:r,strokeWidth:n}=this.properties,{size:l,shape:c,fill:h="transparent",fillOpacity:d}=i,u=this.getStylerResult({},t,e);return u.marker??(u.marker={}),{lineDash:u.lineDash??o,lineDashOffset:u.lineDashOffset??s,stroke:u.stroke??a,strokeOpacity:u.strokeOpacity??r,strokeWidth:u.strokeWidth??n,marker:{enabled:u.marker.enabled??i.enabled,fill:u.marker.fill??h,fillOpacity:u.marker.fillOpacity??d,shape:u.marker.shape??c,size:u.marker.size??l,lineDash:u.marker.lineDash??i.lineDash??o,lineDashOffset:u.marker.lineDashOffset??i.lineDashOffset??s,stroke:u.marker.stroke??i.stroke??a,strokeOpacity:u.marker.strokeOpacity??i.strokeOpacity??r,strokeWidth:u.marker.strokeWidth??i.strokeWidth??n}}}};RadarLineSeries.className="RadarLineSeries",RadarLineSeries.type="radar-line";var import_ag_charts_community250=require("ag-charts-community"),import_ag_charts_core107=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs18,radarLineSeriesThemeableOptionsDef}=import_ag_charts_community250._ModuleSupport,radarLineSeriesOptionsDef={...commonSeriesOptionsDefs18,...radarLineSeriesThemeableOptionsDef,type:(0,import_ag_charts_core107.required)((0,import_ag_charts_core107.constant)("radar-line")),angleKey:(0,import_ag_charts_core107.required)(import_ag_charts_core107.string),radiusKey:(0,import_ag_charts_core107.required)(import_ag_charts_core107.string),angleName:import_ag_charts_core107.string,radiusName:import_ag_charts_core107.string,legendItemName:import_ag_charts_core107.string},{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE5}=import_ag_charts_community251._ModuleSupport.ThemeConstants,RadarLineModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radar-line",moduleFactory:t=>new RadarLineSeries(t),defaultAxes:[{type:POLAR_AXIS_TYPE5.ANGLE_CATEGORY},{type:POLAR_AXIS_TYPE5.RADIUS_NUMBER}],themeTemplate:RADAR_LINE_SERIES_THEME},RadarLineSeriesModule={type:"series",name:"radar-line",chartType:"polar",enterprise:!0,options:radarLineSeriesOptionsDef,create:t=>new RadarLineSeries(t)},import_ag_charts_community257=require("ag-charts-community"),import_ag_charts_community254=require("ag-charts-community"),import_ag_charts_core108=require("ag-charts-core"),import_ag_charts_community252=require("ag-charts-community"),{SeriesProperties:SeriesProperties11,makeSeriesTooltip:makeSeriesTooltip20,Property:Property79,Label:Label15}=import_ag_charts_community252._ModuleSupport,RadialBarSeriesProperties=class extends SeriesProperties11{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.label=new Label15,this.tooltip=makeSeriesTooltip20()}getStyle(){const{fill:t,fillOpacity:e,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r,cornerRadius:n}=this;return{fill:t,fillOpacity:e,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r,cornerRadius:n,opacity:1}}};__decorateClass([Property79],RadialBarSeriesProperties.prototype,"angleKey",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"radiusKey",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"angleName",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"radiusName",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"legendItemName",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"fill",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"stroke",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"lineDash",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"styler",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"rotation",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"stackGroup",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"normalizedTo",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"label",2),__decorateClass([Property79],RadialBarSeriesProperties.prototype,"tooltip",2);var import_ag_charts_community253=require("ag-charts-community"),{SectorBox:SectorBox3,motion:motion9}=import_ag_charts_community253._ModuleSupport;function fixRadialBarAnimationStatus(t,e,i){if(i==="updated"){if(t.previousDatum==null||Number.isNaN(t.previousDatum.innerRadius)||Number.isNaN(t.previousDatum.outerRadius))return"added";if(Number.isNaN(e.innerRadius)||Number.isNaN(e.outerRadius))return"removed"}return i==="added"&&t.previousDatum!=null?"updated":i}function prepareRadialBarSeriesAnimationFunctions(t){return{toFn:(o,s,a)=>{let r,n,l,c,h;return a==="removed"?(r=t,n=t,l=s.innerRadius,c=s.outerRadius,h=new SectorBox3(r,n,l,c)):(r=s.startAngle,n=s.endAngle,l=Number.isNaN(s.innerRadius)?o.innerRadius:s.innerRadius,c=Number.isNaN(s.outerRadius)?o.outerRadius:s.outerRadius,h=s.clipSector),{startAngle:r,endAngle:n,innerRadius:l,outerRadius:c,clipSector:h}},fromFn:(o,s,a)=>{a=fixRadialBarAnimationStatus(o,s,a);let r,n,l,c,h;a==="removed"||a==="updated"?(r=o.startAngle,n=o.endAngle,l=o.innerRadius,c=o.outerRadius,h=o.clipSector):(r=t,n=t,l=s.innerRadius,c=s.outerRadius),h??(h=new SectorBox3(r,n,l,c));const d=motion9.NODE_UPDATE_STATE_TO_PHASE_MAPPING[a];return{startAngle:r,endAngle:n,innerRadius:l,outerRadius:c,clipSector:h,phase:d}}}}function resetRadialBarSelectionsFn(t,e){return{centerX:0,centerY:0,innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,clipSector:e.clipSector}}var{DEFAULT_POLAR_DIRECTION_KEYS:DEFAULT_POLAR_DIRECTION_KEYS3,DEFAULT_POLAR_DIRECTION_NAMES:DEFAULT_POLAR_DIRECTION_NAMES3,ChartAxisDirection:ChartAxisDirection31,PolarAxis:PolarAxis3,diff:diff7,groupAccumulativeValueProperty:groupAccumulativeValueProperty3,keyProperty:keyProperty10,normaliseGroupTo:normaliseGroupTo2,valueProperty:valueProperty18,fixNumericExtent:fixNumericExtent10,resetLabelFn:resetLabelFn6,seriesLabelFadeInAnimation:seriesLabelFadeInAnimation8,seriesLabelFadeOutAnimation:seriesLabelFadeOutAnimation2,animationValidation:animationValidation9,angleBetween:angleBetween3,createDatumId:createDatumId18,CategoryScale:CategoryScale4,Sector:Sector5,SectorBox:SectorBox4,motion:motion10,isGradientFill:isGradientFill3,applyShapeStyle:applyShapeStyle16,updateLabelNode:updateLabelNode8,getItemStyles:getItemStyles4}=import_ag_charts_community254._ModuleSupport,RadialBarSeriesNodeEvent=class extends import_ag_charts_community254._ModuleSupport.SeriesNodeEvent{constructor(t,e,i,o){super(t,e,i,o),this.angleKey=o.properties.angleKey,this.radiusKey=o.properties.radiusKey}},RadialBarSeries=class extends import_ag_charts_community254._ModuleSupport.PolarSeries{constructor(t){super({moduleCtx:t,categoryKey:"radiusValue",propertyKeys:DEFAULT_POLAR_DIRECTION_KEYS3,propertyNames:DEFAULT_POLAR_DIRECTION_NAMES3,canHaveAxes:!0,animationResetFns:{item:resetRadialBarSelectionsFn,label:resetLabelFn6}}),this.properties=new RadialBarSeriesProperties,this.NodeEvent=RadialBarSeriesNodeEvent,this.groupScale=new CategoryScale4,this.circleCache={r:0,cx:0,cy:0}}get hasData(){return this.getHasData("angleValue-raw")}nodeFactory(){return new Sector5}getSeriesDomain(t){const{dataModel:e,processedData:i}=this;if(!i||!e)return[];if(t===ChartAxisDirection31.Angle){const o=e.getDomain(this,"angleValue-end","value",i),s=[Math.min(o[0],0),Math.max(o[1],0)];return fixNumericExtent10(s)}else return e.getDomain(this,"radiusValue","key",i)}async processData(t){const{angleKey:e,radiusKey:i,normalizedTo:o}=this.properties,s=!this.ctx.animationManager.isSkipped(),a=this.getStackId(),r=`${a}-trailing`,n=[];(0,import_ag_charts_core108.isDefined)(o)&&n.push(normaliseGroupTo2([a,r],Math.abs(o))),s&&(this.processedData&&n.push(diff7(this.id,this.processedData)),n.push(animationValidation9()));const l=this.visible?{}:{forceValue:0},c=this.axes[ChartAxisDirection31.Radius]?.scale.type,h=this.axes[ChartAxisDirection31.Angle]?.scale.type;await this.requestDataModel(t,this.data,{props:[keyProperty10(i,c,{id:"radiusValue"}),valueProperty18(e,h,{id:"angleValue-raw",invalidValue:null,...l}),...groupAccumulativeValueProperty3(e,"normal",{id:"angleValue-end",rangeId:"angleValue-range",invalidValue:null,groupId:a,separateNegative:!0,...l},h),...groupAccumulativeValueProperty3(e,"trailing",{id:"angleValue-start",invalidValue:null,groupId:r,separateNegative:!0,...l},h),...n],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}didCircleChange(){const t=this.radius,e=this.centerX,i=this.centerY,o=this.circleCache;return t===o.r&&e===o.cx&&i===o.cy?!1:(this.circleCache={r:t,cx:e,cy:i},!0)}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}getAxisInnerRadius(){const t=this.axes[ChartAxisDirection31.Radius];return t instanceof PolarAxis3?this.radius*t.innerRadiusRatio:0}createNodeData(){const{processedData:t,dataModel:e}=this;if(!e||!t||t.type!=="grouped")return;const i=this.axes[ChartAxisDirection31.Angle],o=this.axes[ChartAxisDirection31.Radius],s=i?.scale,a=o?.scale;if(!s||!a)return;const r=e.resolveKeysById(this,"radiusValue",t),n=e.resolveColumnById(this,"angleValue-start",t),l=e.resolveColumnById(this,"angleValue-end",t),c=e.resolveColumnById(this,"angleValue-raw",t),h=e.resolveProcessedDataIndexById(this,"angleValue-range");let d=0;o instanceof RadiusCategoryAxis&&(d=o.groupPaddingInner);const{groupScale:u}=this,{index:p,visibleGroupCount:g}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);u.domain=Array.from({length:g}).map((L,A)=>String(A)),u.range=[0,Math.abs(a.bandwidth??0)],u.paddingInner=g>1?d:0;const y=u.bandwidth>=1?u.bandwidth:u.rawBandwidth,f=i.isReversed(),x=o.isReversed(),b=x?this.radius:this.getAxisInnerRadius(),S=(x?this.getAxisInnerRadius():this.radius)+b,v=this.getSeriesDomain(ChartAxisDirection31.Angle),{angleKey:M,radiusKey:D,angleName:k,radiusName:_,legendItemName:T,label:w}=this.properties,R=(L,A,P,z)=>{const B=this.getLabelText(A,L,M,"angle",v,w,{value:A,datum:L,angleKey:M,radiusKey:D,angleName:k,radiusName:_,legendItemName:T});if(B)return{x:P,y:z,text:B,textAlign:"center",textBaseline:"middle"}},F=[],O=getItemStyles4((L,A,P)=>getItemStyle(this,L,A,P)),E={itemId:D,nodeData:F,labelData:F,styles:O};if(!this.visible)return E;const{dataSources:I}=t,C=I.get(this.id)?.data??[];for(const{datumIndex:L,group:A}of e.forEachGroupDatum(this,t)){const P=C[L],z=r[L];if(z==null)return;const B=c[L],V=n[L],W=l[L],H=B>=0&&!Object.is(B,-0),G=A.aggregation[h][H?1:0],K=H===f;let U=s.convert(V,{clamp:!0}),Y=s.convert(W,{clamp:!0}),$=s.convert(0,{clamp:!0}),X=s.convert(G,{clamp:!0});K&&([$,X]=[X,$],[U,Y]=[Y,U]);const q=S-a.convert(z)+u.convert(String(p)),it=q+y,J=(q+it)/2,j=U+angleBetween3(U,Y)/2,tt=Math.cos(j)*J,Q=Math.sin(j)*J,ot=this.properties.label.enabled?R(P,B,tt,Q):void 0,et=new SectorBox4(U,Y,q,it);F.push({series:this,datum:P,datumIndex:L,point:{x:tt,y:Q,size:0},midPoint:{x:tt,y:Q},label:ot,angleValue:B,radiusValue:z,innerRadius:q,outerRadius:it,startAngle:$,endAngle:X,clipSector:et,reversed:K,index:L})}return E}update({seriesRect:t}){const e=this.checkResize(t);this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updateSectorSelection(this.itemSelection,!1),this.updateSectorSelection(this.highlightSelection,!0),this.updateLabels(),e&&this.animationState.transition("resize"),this.animationState.transition("update")}updateSectorSelection(t,e){let i=[];const o=this.ctx.highlightManager?.getActiveHighlight();e?o?.datum&&o.series===this&&i.push(o):i=this.nodeData;const{contextNodeData:s}=this;if(!s)return;const a=this.ctx.highlightManager.getActiveHighlight(),r=this.getShapeFillBBox(),n=this.hasItemStylers();t.update(i,void 0,l=>this.getDatumId(l)).each((l,c)=>{const h=readDatum(c);if(h==null)return;if(n){const y=this.getHighlightState(o,e,c.datumIndex);c.style=getItemStyle(this,c,e,y)}const d=c.style??s.styles[this.getHighlightState(a,e,c.datumIndex)],u=d.cornerRadius,p=d.fill,g=import_ag_charts_community254._ModuleSupport.isGradientFill(p)&&p.bounds!=="item"?{centerX:0,centerY:0}:void 0;applyShapeStyle16(l,d,r,g),l.lineJoin="round",l.inset=l.stroke==null?0:l.strokeWidth/2,l.startInnerCornerRadius=h.reversed?u:0,l.startOuterCornerRadius=h.reversed?u:0,l.endInnerCornerRadius=h.reversed?0:u,l.endOuterCornerRadius=h.reversed?0:u,e&&(l.startAngle=c.startAngle,l.endAngle=c.endAngle,l.clipSector=c.clipSector,l.innerRadius=c.innerRadius,l.outerRadius=c.outerRadius)})}updateLabels(){const{properties:t}=this,e=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((i,o)=>{updateLabelNode8(this,i,t,t.label,o.label,!1,e),i.fillOpacity=this.getHighlightStyle(!1,o.datumIndex).opacity??1})}getBarTransitionFunctions(){const t=this.axes[ChartAxisDirection31.Angle]?.scale;let e=0;if(!t)return prepareRadialBarSeriesAnimationFunctions(e);const i=Math.min(t.domain[0],t.domain[1]),o=Math.max(t.domain[0],t.domain[1]);return i<=0&&o>=0&&(e=t.convert(0)),prepareRadialBarSeriesAnimationFunctions(e)}animateEmptyUpdateReady(){const{labelSelection:t}=this,e=this.getBarTransitionFunctions();motion10.fromToMotion(this.id,"datums",this.ctx.animationManager,[this.itemSelection],e),seriesLabelFadeInAnimation8(this,"labels",this.ctx.animationManager,t)}animateClearingUpdateEmpty(){const{itemSelection:t}=this,{animationManager:e}=this.ctx,i=this.getBarTransitionFunctions();motion10.fromToMotion(this.id,"datums",e,[t],i),seriesLabelFadeOutAnimation2(this,"labels",e,this.labelSelection)}getTooltipContent(t){const{id:e,dataModel:i,processedData:o,axes:s,properties:a}=this,{angleKey:r,angleName:n,radiusKey:l,radiusName:c,legendItemName:h,tooltip:d}=a,u=s[ChartAxisDirection31.Angle],p=s[ChartAxisDirection31.Radius],g=this.nodeData?.[t];if(!i||!o||!u||!p||!g)return;const y=o.dataSources.get(this.id)?.data[t],f=i.resolveKeysById(this,"radiusValue",o)[t],x=i.resolveColumnById(this,"angleValue-raw",o)[t];if(f==null)return;const b=getItemStyle(this,g,!1);return this.formatTooltipWithContext(d,{heading:this.getAxisValueText(p,"tooltip",f,y,l,void 0),symbol:this.legendItemSymbol(),data:[{label:n,fallbackLabel:r,value:this.getAxisValueText(u,"tooltip",x,y,r,void 0)}]},{seriesId:e,datum:y,title:n,angleKey:r,angleName:n,radiusKey:l,radiusName:c,legendItemName:h,...b})}pickNodeClosestDatum(t){return this.pickNodeNearestDistantObject(t,this.itemSelection.nodes())}legendItemSymbol(){const{fill:t,stroke:e,fillOpacity:i,strokeOpacity:o,strokeWidth:s,lineDash:a,lineDashOffset:r}=getStyle(this,!1,!1,import_ag_charts_community254._ModuleSupport.HighlightState.None),n={fill:t??"rgba(0, 0, 0, 0)",stroke:e??"rgba(0, 0, 0, 0)",fillOpacity:i,strokeOpacity:o,strokeWidth:s,lineDash:a,lineDashOffset:r};return isGradientFill3(n.fill)&&(n.fill={...n.fill,gradient:"linear",rotation:0,reverse:!1}),{marker:n}}getLegendData(t){if(t!=="category")return[];const{id:e,visible:i}=this,{angleKey:o,angleName:s,legendItemName:a,showInLegend:r}=this.properties;return[{legendType:"category",id:e,itemId:o,seriesId:e,enabled:i,label:{text:a??s??o},symbol:this.legendItemSymbol(),legendItemName:a,hideInLegend:!r}]}getDatumId(t){return createDatumId18(t.radiusValue)}computeLabelsBBox(){return null}getStackId(){return`radialBar-stack-${this.seriesGrouping?.groupIndex??this.id}-xValues`}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};RadialBarSeries.className="RadialBarSeries",RadialBarSeries.type="radial-bar";var import_ag_charts_community255=require("ag-charts-community"),import_ag_charts_core109=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs19,radialBarSeriesThemeableOptionsDef}=import_ag_charts_community255._ModuleSupport,radialBarSeriesOptionsDef={...commonSeriesOptionsDefs19,...radialBarSeriesThemeableOptionsDef,type:(0,import_ag_charts_core109.required)((0,import_ag_charts_core109.constant)("radial-bar")),angleKey:(0,import_ag_charts_core109.required)(import_ag_charts_core109.string),radiusKey:(0,import_ag_charts_core109.required)(import_ag_charts_core109.string),angleName:import_ag_charts_core109.string,radiusName:import_ag_charts_core109.string,legendItemName:import_ag_charts_core109.string,grouped:import_ag_charts_core109.boolean,stacked:import_ag_charts_core109.boolean,stackGroup:import_ag_charts_core109.string,normalizedTo:import_ag_charts_core109.number},import_ag_charts_community256=require("ag-charts-community"),{ThemeConstants:{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE6},FILL_GRADIENT_CONIC_SERIES_DEFAULTS,FILL_IMAGE_DEFAULTS:FILL_IMAGE_DEFAULTS5,FILL_PATTERN_DEFAULTS:FILL_PATTERN_DEFAULTS3}=import_ag_charts_community256._ModuleSupport,RADIAL_BAR_SERIES_THEME={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",FILL_GRADIENT_CONIC_SERIES_DEFAULTS],["image",FILL_IMAGE_DEFAULTS5],["pattern",FILL_PATTERN_DEFAULTS3]]},stroke:{$palette:"stroke"},strokeWidth:{$isUserOption:["./stroke",1,0]},label:{...import_ag_charts_community256._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},highlight:import_ag_charts_community256._ModuleSupport.multiSeriesHighlightStyle()},axes:{[POLAR_AXIS_TYPE6.RADIUS_CATEGORY]:{innerRadiusRatio:.2,groupPaddingInner:.2,paddingInner:.2,paddingOuter:.1}}},{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE7}=import_ag_charts_community257._ModuleSupport.ThemeConstants,RadialBarModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radial-bar",moduleFactory:t=>new RadialBarSeries(t),defaultAxes:[{type:POLAR_AXIS_TYPE7.ANGLE_NUMBER},{type:POLAR_AXIS_TYPE7.RADIUS_CATEGORY}],themeTemplate:RADIAL_BAR_SERIES_THEME,stackable:!0,groupable:!0},RadialBarSeriesModule={type:"series",name:"radial-bar",chartType:"polar",enterprise:!0,options:radialBarSeriesOptionsDef,create:t=>new RadialBarSeries(t)},import_ag_charts_community262=require("ag-charts-community"),import_ag_charts_community259=require("ag-charts-community"),import_ag_charts_community258=require("ag-charts-community"),{Property:Property80}=import_ag_charts_community258._ModuleSupport,RadialColumnSeriesProperties=class extends RadialColumnSeriesBaseProperties{};__decorateClass([Property80],RadialColumnSeriesProperties.prototype,"columnWidthRatio",2),__decorateClass([Property80],RadialColumnSeriesProperties.prototype,"maxColumnWidthRatio",2);var{ChartAxisDirection:ChartAxisDirection32,PolarAxis:PolarAxis4,RadialColumnShape,getRadialColumnWidth}=import_ag_charts_community259._ModuleSupport,RadialColumnSeries=class extends RadialColumnSeriesBase{constructor(t){super(t,{animationResetFns:{item:resetRadialColumnSelectionFn}}),this.properties=new RadialColumnSeriesProperties}getStackId(){return`radarColumn-stack-${this.seriesGrouping?.groupIndex??this.id}-yValues`}nodeFactory(){return new RadialColumnShape}getColumnTransitionFunctions(){const t=this.isRadiusAxisReversed()?this.radius:this.getAxisInnerRadius();return prepareRadialColumnAnimationFunctions(t)}isRadiusAxisCircle(){const t=this.axes[ChartAxisDirection32.Radius];return t instanceof PolarAxis4?t.shape==="circle":!1}updateItemPath(t,e,i){t.isBeveled=this.isRadiusAxisCircle(),t.isRadiusAxisReversed=this.isRadiusAxisReversed(),i&&(t.innerRadius=e.innerRadius,t.outerRadius=e.outerRadius,t.startAngle=e.startAngle,t.endAngle=e.endAngle,t.columnWidth=e.columnWidth,t.axisInnerRadius=e.axisInnerRadius,t.axisOuterRadius=e.axisOuterRadius)}getColumnWidth(t,e){const{columnWidthRatio:i=.5,maxColumnWidthRatio:o=.5}=this.properties;return getRadialColumnWidth(t,e,this.radius,i,o)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};RadialColumnSeries.className="RadialColumnSeries",RadialColumnSeries.type="radial-column";var import_ag_charts_community260=require("ag-charts-community"),import_ag_charts_core110=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs20,radialColumnSeriesThemeableOptionsDef}=import_ag_charts_community260._ModuleSupport,radialColumnSeriesOptionsDef={...commonSeriesOptionsDefs20,...radialColumnSeriesThemeableOptionsDef,type:(0,import_ag_charts_core110.required)((0,import_ag_charts_core110.constant)("radial-column")),angleKey:(0,import_ag_charts_core110.required)(import_ag_charts_core110.string),radiusKey:(0,import_ag_charts_core110.required)(import_ag_charts_core110.string),angleName:import_ag_charts_core110.string,radiusName:import_ag_charts_core110.string,legendItemName:import_ag_charts_core110.string,grouped:import_ag_charts_core110.boolean,stacked:import_ag_charts_core110.boolean,stackGroup:import_ag_charts_core110.string,normalizedTo:import_ag_charts_core110.number},import_ag_charts_community261=require("ag-charts-community"),{ThemeConstants:{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE8,POLAR_AXIS_SHAPE:POLAR_AXIS_SHAPE2},FILL_GRADIENT_RADIAL_SERIES_DEFAULTS:FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2,FILL_IMAGE_DEFAULTS:FILL_IMAGE_DEFAULTS6,FILL_PATTERN_DEFAULTS:FILL_PATTERN_DEFAULTS4}=import_ag_charts_community261._ModuleSupport,RADIAL_COLUMN_SERIES_THEME={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2],["image",FILL_IMAGE_DEFAULTS6],["pattern",FILL_PATTERN_DEFAULTS4]]},stroke:{$palette:"stroke"},columnWidthRatio:.5,maxColumnWidthRatio:.5,strokeWidth:{$isUserOption:["./stroke",1,0]},label:{...import_ag_charts_community261._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:import_ag_charts_community261._ModuleSupport.multiSeriesHighlightStyle()},axes:{[POLAR_AXIS_TYPE8.ANGLE_CATEGORY]:{shape:{$findFirstSiblingNotOperation:POLAR_AXIS_SHAPE2.CIRCLE},groupPaddingInner:0,paddingInner:0,label:{spacing:10}},[POLAR_AXIS_TYPE8.RADIUS_NUMBER]:{shape:{$findFirstSiblingNotOperation:POLAR_AXIS_SHAPE2.CIRCLE},innerRadiusRatio:.5}}},{POLAR_AXIS_TYPE:POLAR_AXIS_TYPE9}=import_ag_charts_community262._ModuleSupport.ThemeConstants,RadialColumnModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radial-column",moduleFactory:t=>new RadialColumnSeries(t),defaultAxes:[{type:POLAR_AXIS_TYPE9.ANGLE_CATEGORY},{type:POLAR_AXIS_TYPE9.RADIUS_NUMBER}],themeTemplate:RADIAL_COLUMN_SERIES_THEME,stackable:!0,groupable:!0},RadialColumnSeriesModule={type:"series",name:"radial-column",chartType:"polar",enterprise:!0,options:radialColumnSeriesOptionsDef,create:t=>new RadialColumnSeries(t)},import_ag_charts_community267=require("ag-charts-community"),import_ag_charts_community266=require("ag-charts-community"),import_ag_charts_core112=require("ag-charts-core"),import_ag_charts_community263=require("ag-charts-community"),{SvgPath,Rotatable,Translatable,Scalable:Scalable2}=import_ag_charts_community263._ModuleSupport,RadialGaugeNeedle=class extends Rotatable(Scalable2(Translatable(SvgPath))){constructor(){super(...arguments),this.scalingCenterX=.5,this.scalingCenterY=.5,this.rotationCenterX=.5,this.rotationCenterY=.5}};RadialGaugeNeedle.defaultPathData="M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z";var import_ag_charts_community264=require("ag-charts-community"),{getColorStops:getColorStops2,normalizeAngle360:normalizeAngle3606,normalizeAngle360Inclusive:normalizeAngle360Inclusive2,toDegrees}=import_ag_charts_community264._ModuleSupport,{BaseProperties:BaseProperties28,makeSeriesTooltip:makeSeriesTooltip21,SeriesProperties:SeriesProperties12,PropertiesArray:PropertiesArray8,AxisLabel:AxisLabel6,Property:Property81,Label:Label16}=import_ag_charts_community264._ModuleSupport,RadialGaugeDefaultTargetLabelProperties=class extends Label16{};__decorateClass([Property81],RadialGaugeDefaultTargetLabelProperties.prototype,"spacing",2);var RadialGaugeTargetProperties=class extends BaseProperties28{constructor(){super(...arguments),this.label=new RadialGaugeDefaultTargetLabelProperties}getStyle(){const{fill:t="black",fillOpacity:e=1,stroke:i="black",strokeWidth:o=0,strokeOpacity:s=1,lineDash:a=[0],lineDashOffset:r=0}=this;return{fill:t,fillOpacity:e,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:r}}};__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"text",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"value",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"shape",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"placement",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"spacing",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"size",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"rotation",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"fill",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"fillOpacity",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"stroke",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"strokeWidth",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"strokeOpacity",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"lineDash",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"lineDashOffset",2),__decorateClass([Property81],RadialGaugeTargetProperties.prototype,"label",2);var RadialGaugeBarProperties=class extends BaseProperties28{constructor(){super(...arguments),this.enabled=!0,this.fills=new PropertiesArray8(import_ag_charts_community264._ModuleSupport.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(t,e){const{enabled:i,fill:o,fills:s,fillMode:a,fillOpacity:r,stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}=this;return{fill:i?o??createConicGradient(s,a,t,e):"none",fillOpacity:r,stroke:n,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}}};__decorateClass([Property81],RadialGaugeBarProperties.prototype,"enabled",2),__decorateClass([Property81],RadialGaugeBarProperties.prototype,"fills",2),__decorateClass([Property81],RadialGaugeBarProperties.prototype,"fillMode",2),__decorateClass([Property81],RadialGaugeBarProperties.prototype,"fill",2),__decorateClass([Property81],RadialGaugeBarProperties.prototype,"fillOpacity",2),__decorateClass([Property81],RadialGaugeBarProperties.prototype,"stroke",2),__decorateClass([Property81],RadialGaugeBarProperties.prototype,"strokeWidth",2),__decorateClass([Property81],RadialGaugeBarProperties.prototype,"strokeOpacity",2),__decorateClass([Property81],RadialGaugeBarProperties.prototype,"lineDash",2),__decorateClass([Property81],RadialGaugeBarProperties.prototype,"lineDashOffset",2);var RadialGaugeScaleIntervalProperties=class extends BaseProperties28{constructor(){super(...arguments),this.values=void 0,this.step=void 0,this.minSpacing=0,this.maxSpacing=1e3}};__decorateClass([Property81],RadialGaugeScaleIntervalProperties.prototype,"values",2),__decorateClass([Property81],RadialGaugeScaleIntervalProperties.prototype,"step",2),__decorateClass([Property81],RadialGaugeScaleIntervalProperties.prototype,"minSpacing",2),__decorateClass([Property81],RadialGaugeScaleIntervalProperties.prototype,"maxSpacing",2);var RadialGaugeScaleLabelProperties=class extends AxisLabel6{},RadialGaugeScaleProperties=class extends BaseProperties28{constructor(){super(...arguments),this.min=0,this.max=1,this.fills=new PropertiesArray8(import_ag_charts_community264._ModuleSupport.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.defaultFill="black",this.interval=new RadialGaugeScaleIntervalProperties,this.label=new RadialGaugeScaleLabelProperties}getStyle(t,e,i){const{fill:o,fills:s,defaultFill:a,fillMode:r,fillOpacity:n,stroke:l,strokeWidth:c,strokeOpacity:h,lineDash:d,lineDashOffset:u}=this;return{fill:o??(t&&s.length===0?a:void 0)??createConicGradient(s,r,e,i),fillOpacity:n,stroke:l,strokeWidth:c,strokeOpacity:h,lineDash:d,lineDashOffset:u}}};__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"min",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"max",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"fills",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"fillMode",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"fill",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"fillOpacity",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"stroke",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"strokeWidth",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"strokeOpacity",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"lineDash",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"lineDashOffset",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"defaultFill",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"interval",2),__decorateClass([Property81],RadialGaugeScaleProperties.prototype,"label",2);var RadialGaugeNeedleProperties=class extends BaseProperties28{constructor(){super(...arguments),this.enabled=!0,this.spacing=0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};__decorateClass([Property81],RadialGaugeNeedleProperties.prototype,"enabled",2),__decorateClass([Property81],RadialGaugeNeedleProperties.prototype,"radiusRatio",2),__decorateClass([Property81],RadialGaugeNeedleProperties.prototype,"spacing",2),__decorateClass([Property81],RadialGaugeNeedleProperties.prototype,"fill",2),__decorateClass([Property81],RadialGaugeNeedleProperties.prototype,"fillOpacity",2),__decorateClass([Property81],RadialGaugeNeedleProperties.prototype,"stroke",2),__decorateClass([Property81],RadialGaugeNeedleProperties.prototype,"strokeWidth",2),__decorateClass([Property81],RadialGaugeNeedleProperties.prototype,"strokeOpacity",2),__decorateClass([Property81],RadialGaugeNeedleProperties.prototype,"lineDash",2),__decorateClass([Property81],RadialGaugeNeedleProperties.prototype,"lineDashOffset",2);var RadialGaugeLabelProperties=class extends AutoSizedLabel{};__decorateClass([Property81],RadialGaugeLabelProperties.prototype,"text",2);var RadialGaugeSecondaryLabelProperties=class extends AutoSizedSecondaryLabel{};__decorateClass([Property81],RadialGaugeSecondaryLabelProperties.prototype,"text",2);var RadialGaugeSeriesProperties=class extends SeriesProperties12{constructor(){super(...arguments),this.startAngle=0,this.endAngle=0,this.segmentation=new GaugeSegmentationProperties,this.defaultColorRange=[],this.targets=new PropertiesArray8(RadialGaugeTargetProperties),this.defaultTarget=new RadialGaugeTargetProperties,this.outerRadiusRatio=1,this.innerRadiusRatio=1,this.cornerRadius=0,this.cornerMode="container",this.spacing=0,this.scale=new RadialGaugeScaleProperties,this.bar=new RadialGaugeBarProperties,this.needle=new RadialGaugeNeedleProperties,this.label=new RadialGaugeLabelProperties,this.secondaryLabel=new RadialGaugeSecondaryLabelProperties,this.tooltip=makeSeriesTooltip21()}};__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"value",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"startAngle",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"endAngle",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"segmentation",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"defaultColorRange",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"targets",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"defaultTarget",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"outerRadiusRatio",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"innerRadiusRatio",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"outerRadius",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"innerRadius",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"cornerMode",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"spacing",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"scale",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"bar",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"needle",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"label",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"secondaryLabel",2),__decorateClass([Property81],RadialGaugeSeriesProperties.prototype,"tooltip",2);function createConicGradient(t,e,i,o){const{domain:s,range:a}=o,[r,n]=a,l=normalizeAngle3606((r+n)/2+Math.PI),c=normalizeAngle360Inclusive2(n-r);return{type:"gradient",gradient:"conic",colorSpace:"oklch",colorStops:getColorStops2(t,i,s,e).map(({color:d,stop:u})=>(u=Math.min(Math.max(u,0),1),u=(r+c*u-l)/(2*Math.PI),u=(u%1+1)%1,{stop:u,color:d})),bounds:"series",rotation:toDegrees(l)+90}}var import_ag_charts_community265=require("ag-charts-community"),import_ag_charts_core111=require("ag-charts-core"),{SectorBox:SectorBox5}=import_ag_charts_community265._ModuleSupport;function computeClipSector(t){const{startAngle:e,endAngle:i,clipStartAngle:o,clipEndAngle:s,innerRadius:a,outerRadius:r}=t;if(!(o==null||s==null))return new SectorBox5(Math.max(o,e),Math.min(s,i),a,r)}function clipSectorVisibility(t,e,i){return Math.max(t,i.startAngle)<=Math.min(e,i.endAngle)}function hasClipSector(t){return t.clipStartAngle!=null&&t.clipEndAngle!=null}function datumClipSector(t,e){const{clipStartAngle:i,clipEndAngle:o,innerRadius:s,outerRadius:a}=t;return new SectorBox5(i,e?i:o,s,a)}function prepareRadialGaugeSeriesAnimationFunctions(t,e){const i=t?"initial":"update";return{node:{fromFn(a,r){const n=a.previousDatum;let{startAngle:l,endAngle:c}=n??r;const h=n!=null&&hasClipSector(n)?datumClipSector(n,t):void 0,d=hasClipSector(r)?datumClipSector(r,t):void 0;let u;return h!=null&&d!=null?u=h:h==null&&d!=null?(u=d,l=r.startAngle,c=r.endAngle):h!=null&&d==null?(u=void 0,l=r.startAngle,c=r.endAngle):t&&(c=l),{startAngle:l,endAngle:c,clipSector:u,phase:i}},toFn(a,r){const{startAngle:n,endAngle:l}=r;let c;return hasClipSector(r)&&(c=datumClipSector(r,!1)),{startAngle:n,endAngle:l,clipSector:c}},applyFn(a,r){const{startAngle:n,endAngle:l}=r;let{clipSector:c}=r;c!=null&&(c=new SectorBox5(Math.max(n,c.startAngle),Math.min(l,c.endAngle),c.innerRadius,c.outerRadius));const h=c==null||clipSectorVisibility(n,l,c);a.startAngle=n,a.endAngle=l,a.clipSector=c,a.visible=h}},needle:{fromFn(a){let{angle:r}=a.previousDatum??a.datum;return t&&(r=e),{rotation:r,phase:i}},toFn(a,r){const{angle:n}=r;return{rotation:n}}}}}function resetRadialGaugeSeriesResetSectorFunction(t,e){const{startAngle:i,endAngle:o}=e,s=computeClipSector(e),a=s==null||clipSectorVisibility(i,o,s);return{startAngle:i,endAngle:o,clipSector:s,visible:a}}function resetRadialGaugeSeriesResetNeedleFunction(t,e){const{angle:i}=e;return{rotation:i}}var verticalAlignFactors3={top:0,middle:.5,bottom:1};function formatRadialGaugeLabels(t,e,i,o,s,a){const{padding:r,textAlign:n,verticalAlign:l}=o;let c,h;if(i.each((v,M)=>{M.label==="primary"?c=M:M.label==="secondary"&&(h=M)}),c==null)return;const d=getLabelText(t.id,e,c,a?.label);if(d==null)return;const u=h==null?void 0:getLabelText(t.id,e,h,a?.secondaryLabel),p={padding:r},g=n==="center"?2:1,y=l==="middle"?2:1,f=v=>({width:Math.sqrt(Math.max(s**2-(v/y)**2,0))*g,height:Math.min(v,y*s),meta:null});let x,b,m;if(h!=null&&u!=null){const v=formatStackedLabels((0,import_ag_charts_core111.toPlainText)(d),c,(0,import_ag_charts_core111.toPlainText)(u),h,p,f);x=v?.label,b=v?.secondaryLabel,m=v?.height??0}else{const v=formatSingleLabel((0,import_ag_charts_core111.toPlainText)(d),c,p,f);x=v?.[0],b=void 0,m=v?.[0].height??0}const S=m*verticalAlignFactors3[l];i.each((v,M)=>{let D;if(M.label==="primary"?D=x:M.label==="secondary"&&(D=b),D==null){v.visible=!1;return}v.visible=!0,v.text=D.text,v.fontSize=D.fontSize,v.lineHeight=D.lineHeight,v.textAlign=n,v.textBaseline="middle";const k=M.label==="primary"?D.height/2:m-D.height/2;v.y=M.centerY+k-S,v.x=M.centerX})}var{fromToMotion:fromToMotion5,resetMotion:resetMotion4,SeriesNodePickMode:SeriesNodePickMode15,StateMachine:StateMachine15,createDatumId:createDatumId19,normalizeAngle360:normalizeAngle3607,normalizeAngle360Inclusive:normalizeAngle360Inclusive3,isBetweenAngles:isBetweenAngles2,sectorBox,toRadians:toRadians5,BBox:BBox24,Group:Group19,PointerEvents:PointerEvents12,Selection:Selection16,Sector:Sector6,SectorBox:SectorBox6,Text:Text9,Marker:Marker6,tickFormat:tickFormat2,applyShapeStyle:applyShapeStyle17,mergeDefaults:mergeDefaults19}=import_ag_charts_community266._ModuleSupport,targetPlacementRotation={inside:90,middle:0,outside:-90},outsideLabelPlacements=[{textAlign:"left",textBaseline:"top"},{textAlign:"right",textBaseline:"top"},{textAlign:"right",textBaseline:"bottom"},{textAlign:"left",textBaseline:"bottom"}],insideLabelPlacements=[{textAlign:"right",textBaseline:"bottom"},{textAlign:"left",textBaseline:"bottom"},{textAlign:"left",textBaseline:"top"},{textAlign:"right",textBaseline:"top"}],RadialGaugeSeries=class extends import_ag_charts_community266._ModuleSupport.Series{constructor(t){super({moduleCtx:t,pickModes:[SeriesNodePickMode15.EXACT_SHAPE_MATCH,SeriesNodePickMode15.NEAREST_NODE]}),this.centerX=0,this.centerY=0,this.radius=0,this.textAlign="center",this.verticalAlign="middle",this.properties=new RadialGaugeSeriesProperties,this.scale=new LinearAngleScale,this.scaleGroup=this.contentGroup.appendChild(new Group19({name:"scaleGroup"})),this.itemGroup=this.contentGroup.appendChild(new Group19({name:"itemGroup"})),this.itemNeedleGroup=this.contentGroup.appendChild(new Group19({name:"itemNeedleGroup"})),this.itemTargetGroup=this.contentGroup.appendChild(new Group19({name:"itemTargetGroup"})),this.itemTargetLabelGroup=this.contentGroup.appendChild(new Group19({name:"itemTargetLabelGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Group19({name:"itemLabelGroup"})),this.highlightTargetGroup=this.highlightGroup.appendChild(new Group19({name:"itemTargetLabelGroup"})),this.tickGroup=this.contentGroup.appendChild(new Group19({name:"tickGroup"})),this.scaleSelection=Selection16.select(this.scaleGroup,()=>this.nodeFactory()),this.datumSelection=Selection16.select(this.itemGroup,()=>this.nodeFactory()),this.needleSelection=Selection16.select(this.itemNeedleGroup,RadialGaugeNeedle),this.targetSelection=Selection16.select(this.itemTargetGroup,()=>this.markerFactory()),this.targetLabelSelection=Selection16.select(this.itemTargetLabelGroup,Text9),this.labelSelection=Selection16.select(this.itemLabelGroup,Text9),this.highlightTargetSelection=Selection16.select(this.highlightTargetGroup,()=>this.markerFactory()),this.tickSelection=Selection16.select(this.tickGroup,import_ag_charts_community266._ModuleSupport.TransformableText),this.datumUnion=new DatumUnion,this.animationState=new StateMachine15("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.animateReadyResize(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateWaitingUpdateReady()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty"},reset:"empty",skip:"ready"}}),this.scaleGroup.pointerEvents=PointerEvents12.None,this.tickGroup.pointerEvents=PointerEvents12.None,this.itemNeedleGroup.pointerEvents=PointerEvents12.None,this.itemLabelGroup.pointerEvents=PointerEvents12.None}get hasData(){return this.properties.value!=null}nodeFactory(){return new Sector6}markerFactory(){const t=new Marker6;return t.size=1,t}processData(){this.nodeDataRefresh=!0,this.animationState.transition("updateData")}formatLabel(t){const{min:e,max:i}=this.properties.scale;return formatLabel(t,{min:e,max:i})}layoutScale(){const{scale:t,properties:e}=this,{seriesRectWidth:i,seriesRectHeight:o}=this.nodeDataDependencies,{scale:s,outerRadius:a}=this.properties,{min:r,max:n,label:l,interval:c}=s,h=toRadians5(e.startAngle-90),d=toRadians5(e.endAngle-90),p=normalizeAngle360Inclusive3(d-h)>Math.PI,g=p||isBetweenAngles2(1.5*Math.PI,h,d),y=p||isBetweenAngles2(0*Math.PI,h,d),f=p||isBetweenAngles2(.5*Math.PI,h,d),x=p||isBetweenAngles2(1*Math.PI,h,d);let b;x&&!y?b="right":!x&&y?b="left":b="center";let m;g&&!f?m="bottom":!g&&f?m="top":m="middle";const S=sectorBox({startAngle:h,endAngle:d,innerRadius:0,outerRadius:.5}),v=-(S.x+S.width/2)*2,M=-(S.y+S.height/2)*2,D=Math.min(i/S.width,o/S.height);t.domain=[r,n],t.range=[h,d],t.arcLength=D/2;const{maxSpacing:k,minSpacing:_}=c,{arcLength:T}=t,w=k?Math.floor(T/k):1,R=_?Math.floor(T/_):1/0,F=Math.floor(4/Math.PI*Math.abs(t.range[0]-t.range[1])),O=Math.max(w,Math.min(R,F)),E=c.values??t.ticks({nice:!1,interval:c.step,minTickCount:w,maxTickCount:R,tickCount:O})?.ticks??[],I=tickFormat2(E,typeof l.format=="string"?l.format:void 0),C=(0,import_ag_charts_core112.cachedTextMeasurer)(l),L=E.map((W,H)=>{let G;if(l.formatter&&(G=formatWithContext(this.ctx,l.formatter,{value:W,index:H,domain:t.domain,boundSeries:void 0})),G??(G=I?.(W)),G==null)return;const{width:K,height:U}=(0,import_ag_charts_core112.isArray)(G)?(0,import_ag_charts_core112.measureTextSegments)(G,l):C.measureLines(G);return{index:H,value:W,text:G,width:K,height:U}}).filter(W=>W!=null),A=L.reduce((W,H)=>Math.max(W,H.width),0),P=L.reduce((W,H)=>Math.max(W,H.height),0),z=l.enabled?Math.max(A,P)+l.spacing:0,B=Math.max(.5*D-z,0),V=a??B;return this.centerX=i/2+v*V,this.centerY=o/2+M*V,this.radius=V,this.textAlign=b,this.verticalAlign=m,L}getShapeFillBBox(){const{centerX:t,centerY:e,radius:i}=this,o=new BBox24(t-i,e-i,2*i,2*i);return{series:o,axis:o}}getTargets(){const{properties:t}=this,e=t.defaultTarget;return Array.from(t.targets).map(i=>{const{text:o=e.text,value:s=e.value??0,shape:a=e.shape??"triangle",rotation:r=e.rotation??0,placement:n=e.placement??"middle",spacing:l=e.spacing??0,size:c=e.size??0}=i,{enabled:h=e.label.enabled,color:d=e.label.color??"black",fontStyle:u=e.label.fontStyle??"normal",fontWeight:p=e.label.fontWeight??"normal",fontSize:g=e.label.fontSize,fontFamily:y=e.label.fontFamily,spacing:f=e.label.spacing??0}=i.label;return{text:o,value:s,shape:a,placement:n,spacing:l,size:c,rotation:r,label:{enabled:h,color:d,fontStyle:u,fontWeight:p,fontSize:g,fontFamily:y,spacing:f},style:i.getStyle()}})}getTargetRadius(t){const{radius:e,properties:i}=this,{innerRadiusRatio:o,outerRadiusRatio:s}=i,{placement:a,spacing:r,size:n}=t,l=e*s,c=e*o;switch(a){case"inside":return Math.max(c-r-n/2,0);case"outside":return l+r+n/2;default:return(c+l)/2}}getTargetLabel(t){const{scale:e}=this,{value:i,size:o,placement:s,label:a}=t,{spacing:r,color:n,fontStyle:l,fontWeight:c,fontSize:h,fontFamily:d}=a,u=void 0,p=e.convert(i),g=Math.trunc(normalizeAngle3607(p)/(Math.PI/2)),y=o/2+r;let f,x,b,m;switch(s){case"outside":({textAlign:f,textBaseline:x}=outsideLabelPlacements[g]),b=y*Math.cos(p),m=y*Math.sin(p);break;case"inside":({textAlign:f,textBaseline:x}=insideLabelPlacements[g]),b=-y*Math.cos(p),m=-y*Math.sin(p);break;default:f="center",x="bottom",b=0,m=-y;break}return{offsetX:b,offsetY:m,fill:n,textAlign:f,textBaseline:x,fontStyle:l,fontWeight:c,fontSize:h,fontFamily:d,lineHeight:u}}createNodeData(){const t=this.layoutScale(),{id:e,scale:i,properties:o,radius:s,centerX:a,centerY:r}=this,{value:n,innerRadiusRatio:l,outerRadiusRatio:c,segmentation:h,cornerRadius:d,cornerMode:u,needle:p,bar:g,scale:y,label:f,secondaryLabel:x}=o,{outerRadius:b=s*c,innerRadius:m=s*l,defaultColorRange:S}=o,v=this.getTargets(),M=[],D=[],k=[],_=[],T=[],w=u==="item",R=i.convert(i.domain[0]),F=i.convert(n),O=Math.ceil(normalizeAngle360Inclusive3(F-R)*s);let E=h.enabled?h.interval.getSegments(i,O):void 0;const I=g.getStyle(S,i),C=y.getStyle(g.enabled,S,i);if(E==null&&w){const L=Math.min(...i.domain),A=Math.max(...i.domain),P={value:n,segmentStart:L,segmentEnd:A},B=Math.min(d,(b-m)/2)/((m+b)/2);M.push({series:this,itemId:"value",datum:P,datumIndex:{type:0},type:0,centerX:a,centerY:r,outerRadius:b,innerRadius:m,startAngle:R-B,endAngle:F+B,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:d,endCornerRadius:d,style:I}),T.push({series:this,itemId:"scale",datum:P,datumIndex:{type:0},type:0,centerX:a,centerY:r,outerRadius:b,innerRadius:m,startAngle:i.range[0]-B,endAngle:i.range[1]+B,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:d,endCornerRadius:d,style:C})}else{E??(E=i.domain);for(let L=0;Lthis.formatLabel(K.value)}=f;_.push({label:"primary",centerX:a,centerY:r,text:L,value:n,fill:A,fontSize:P,minimumFontSize:z,fontStyle:B,fontWeight:V,fontFamily:W,lineHeight:H,formatter:G})}if(!p.enabled&&x.enabled){const{text:L,color:A,fontSize:P,minimumFontSize:z,fontStyle:B,fontWeight:V,fontFamily:W,lineHeight:H,formatter:G}=x;_.push({label:"secondary",centerX:a,centerY:r,text:L,value:n,fill:A,fontSize:P,minimumFontSize:z,fontStyle:B,fontWeight:V,fontFamily:W,lineHeight:H,formatter:G})}if(p.enabled){let L=p.radiusRatio==null?m:s*p.radiusRatio;L=Math.max(L-p.spacing,0);const A=i.convert(n);k.push({centerX:a,centerY:r,radius:L,angle:A,series:this})}for(let L=0;LMath.max(...i.domain))continue;const H=this.getTargetRadius(A),G=i.convert(P),K=toRadians5(A.rotation+targetPlacementRotation[A.placement]);D.push({series:this,itemId:`target-${L}`,midPoint:{x:H*Math.cos(G)+a,y:H*Math.sin(G)+r},datum:{value:P},datumIndex:{type:1,index:L},type:1,value:P,text:z,centerX:a,centerY:r,shape:V,radius:H,angle:G,rotation:K,size:B,label:this.getTargetLabel(A),style:W})}return{itemId:e,nodeData:M,needleData:k,targetData:D,labelData:_,scaleData:T,tickData:t}}updateSelections(t){(this.nodeDataRefresh||t)&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}highlightDatum(t){if(t!=null&&t.series===this&&t.type===1)return t}update({seriesRect:t}){const{datumSelection:e,labelSelection:i,needleSelection:o,targetSelection:s,targetLabelSelection:a,scaleSelection:r,highlightTargetSelection:n,tickSelection:l}=this,c=this.checkResize(t);this.updateSelections(c),this.contentGroup.visible=this.visible,this.contentGroup.opacity=this.getOpacity();const h=this.contextNodeData?.nodeData??[],d=this.contextNodeData?.labelData??[],u=this.contextNodeData?.needleData??[],p=this.contextNodeData?.targetData??[],g=this.contextNodeData?.scaleData??[],y=this.contextNodeData?.tickData??[],f=this.highlightDatum(this.ctx.highlightManager.getActiveHighlight());this.scaleSelection=this.updateScaleSelection({scaleData:g,scaleSelection:r}),this.updateScaleNodes({scaleSelection:r}),this.needleSelection=this.updateNeedleSelection({needleData:u,needleSelection:o}),this.updateNeedleNodes({needleSelection:o}),this.targetSelection=this.updateTargetSelection({targetData:p,targetSelection:s}),this.updateTargetStyles({targetSelection:s,isHighlight:!1}),this.updateTargetNodes({targetSelection:s}),this.targetLabelSelection=this.updateTargetLabelSelection({targetData:p,targetLabelSelection:a}),this.updateTargetLabelNodes({targetLabelSelection:a}),this.datumSelection=this.updateDatumSelection({nodeData:h,datumSelection:e}),this.updateDatumNodes({datumSelection:e}),this.labelSelection=this.updateLabelSelection({labelData:d,labelSelection:i}),this.updateLabelNodes({labelSelection:i}),this.highlightTargetSelection=this.updateTargetSelection({targetData:f==null?[]:[f],targetSelection:n}),this.updateTargetStyles({targetSelection:n,isHighlight:!0}),this.updateTargetNodes({targetSelection:n}),this.tickSelection=this.updateTickSelection({tickData:y,tickSelection:l}),this.updateTickNodes({tickSelection:l}),c&&this.animationState.transition("resize"),this.animationState.transition("update")}updateDatumSelection(t){return t.datumSelection.update(t.nodeData,void 0,e=>createDatumId19(t.nodeData.length,e.itemId))}updateDatumNodes(t){const{datumSelection:e}=t,{ctx:i,properties:o}=this,{segmentation:s}=o,a=s.spacing??0,r=i.animationManager.isSkipped(),n=this.getShapeFillBBox();e.each((l,c)=>{const{centerX:h,centerY:d,innerRadius:u,outerRadius:p,startCornerRadius:g,endCornerRadius:y}=c;l.centerX=h,l.centerY=d,l.innerRadius=u,l.outerRadius=p,l.pointerEvents=this.properties.bar.enabled?import_ag_charts_community266._ModuleSupport.PointerEvents.All:import_ag_charts_community266._ModuleSupport.PointerEvents.None,applyShapeStyle17(l,c.style,n),l.startOuterCornerRadius=g,l.startInnerCornerRadius=g,l.endOuterCornerRadius=y,l.endInnerCornerRadius=y,l.radialEdgeInset=(a+l.strokeWidth)/2,l.concentricEdgeInset=l.strokeWidth/2,(r||l.previousDatum==null)&&l.setProperties(resetRadialGaugeSeriesResetSectorFunction(l,c))}),this.datumUnion.update(e,this.itemGroup,import_ag_charts_community266._ModuleSupport.Sector,(l,c,h)=>{l.clipSector??(l.clipSector=new SectorBox6(Number.NaN,Number.NaN,Number.NaN,Number.NaN)),l.centerX=c.centerX,l.centerY=c.centerY,l.outerRadius=l.clipSector.outerRadius=c.outerRadius,l.innerRadius=l.clipSector.innerRadius=c.innerRadius,l.startAngle=l.clipSector.startAngle=c.startAngle,l.startInnerCornerRadius=c.startInnerCornerRadius,l.startOuterCornerRadius=c.startOuterCornerRadius,l.endAngle=h.endAngle,l.clipSector.endAngle=h.clipSector?.endAngle??h.endAngle,l.endInnerCornerRadius=h.endInnerCornerRadius,l.endOuterCornerRadius=h.endOuterCornerRadius,l.pointerEvents=import_ag_charts_community266._ModuleSupport.PointerEvents.None})}updateScaleSelection(t){return t.scaleSelection.update(t.scaleData,void 0,e=>createDatumId19(t.scaleData.length,e.itemId))}updateScaleNodes(t){const{scaleSelection:e}=t,{segmentation:i}=this.properties,o=i.spacing??0,s=this.getShapeFillBBox();e.each((a,r)=>{const{centerX:n,centerY:l,innerRadius:c,outerRadius:h,startCornerRadius:d,endCornerRadius:u}=r;a.centerX=n,a.centerY=l,a.innerRadius=c,a.outerRadius=h,applyShapeStyle17(a,r.style,s),a.startOuterCornerRadius=d,a.startInnerCornerRadius=d,a.endOuterCornerRadius=u,a.endInnerCornerRadius=u,a.radialEdgeInset=(o+a.strokeWidth)/2,a.concentricEdgeInset=a.strokeWidth/2,a.setProperties(resetRadialGaugeSeriesResetSectorFunction(a,r))})}updateNeedleSelection(t){return t.needleSelection.update(t.needleData,void 0,()=>createDatumId19(0))}updateNeedleNodes(t){const{needleSelection:e}=t,{fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:r,lineDash:n,lineDashOffset:l}=this.properties.needle,c=this.ctx.animationManager.isSkipped();e.each((h,d)=>{const{centerX:u,centerY:p,radius:g}=d,y=g*2;h.d=RadialGaugeNeedle.defaultPathData,applyShapeStyle17(h,{fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:r/y,lineDash:n.map(f=>f/y),lineDashOffset:l/y}),h.translationX=u,h.translationY=p,h.scalingX=y,h.scalingY=y,c&&h.setProperties(resetRadialGaugeSeriesResetNeedleFunction(h,d))})}updateTargetSelection(t){return t.targetSelection.update(t.targetData,void 0,e=>e.itemId)}updateTargetStyles({targetSelection:t,isHighlight:e}){t.each((i,o)=>{o.style=this.getTargetStyle(e,o)})}updateTargetNodes({targetSelection:t}){t.each((e,i)=>{const{centerX:o,centerY:s,angle:a,radius:r,shape:n,size:l,rotation:c}=i;applyShapeStyle17(e,i.style),e.size=l,e.shape=n==="line"?lineMarker:n,e.translationX=o+r*Math.cos(a),e.translationY=s+r*Math.sin(a),e.rotation=a+c})}getTargetStyle(t,{datumIndex:e,style:i}){const o=this.getHighlightStyle(t,e);return mergeDefaults19(o,{...i,opacity:1})}updateTargetLabelSelection(t){return t.targetLabelSelection.update(t.targetData,void 0,e=>e.itemId)}updateTargetLabelNodes(t){const{targetLabelSelection:e}=t;e.each((i,o)=>{const{centerX:s,centerY:a,radius:r,angle:n,text:l}=o,{offsetX:c,offsetY:h,fill:d,fontStyle:u,fontWeight:p,fontSize:g,fontFamily:y,textAlign:f,textBaseline:x}=o.label;if(l==null){i.visible=!1;return}i.visible=!0,i.x=s+r*Math.cos(n)+c,i.y=a+r*Math.sin(n)+h,i.text=l,i.fill=d,i.fontStyle=u,i.fontWeight=p,i.fontSize=g,i.fontFamily=y,i.textAlign=f,i.textBaseline=x})}updateLabelSelection(t){return t.labelSelection.update(t.labelData,void 0,e=>e.label)}updateLabelNodes(t){const{labelSelection:e}=t,i=this.ctx.animationManager.isSkipped();e.each((o,s)=>{o.fill=s.fill,o.fontStyle=s.fontStyle,o.fontWeight=s.fontWeight,o.fontFamily=s.fontFamily}),(i||this.labelsHaveExplicitText())&&this.formatLabelText()}updateTickSelection(t){return t.tickSelection.update(t.tickData,void 0,e=>e.index)}updateTickNodes(t){const{scale:e,radius:i,centerX:o,centerY:s,properties:a}=this,{enabled:r,color:n,fontFamily:l,fontSize:c,fontStyle:h,fontWeight:d,spacing:u}=a.scale.label,p=toRadians5(a.scale.label.rotation??0);t.tickSelection.each((g,y)=>{if(!r){g.visible=!1;return}g.visible=!0,g.text=y.text,g.fill=n,g.fontFamily=l,g.fontSize=c,g.fontStyle=h,g.fontWeight=d,g.textAlign="center",g.textBaseline="middle";const f=e.convert(y.value),{width:x,height:b}=y,m=Math.abs(i*Math.cos(f)),S=Math.abs(i*Math.sin(f)),v=Math.min(Math.max(Math.abs(i/Math.tan(f)),m-x/2),m+x/2),M=Math.min(Math.max(Math.abs(i*Math.tan(f)),S-b/2),S+b/2),D=Math.hypot(v,M),k=o+(D+u)*Math.cos(f),_=s+(D+u)*Math.sin(f);g.x=k,g.y=_,g.rotationCenterX=k,g.rotationCenterY=_,g.rotation=p})}labelsHaveExplicitText(){for(const{datum:t}of this.labelSelection)if(t.text==null)return!1;return!0}formatLabelText(t){const{labelSelection:e,radius:i,textAlign:o,verticalAlign:s}=this,{spacing:a,innerRadiusRatio:r}=this.properties;formatRadialGaugeLabels(this,this.ctx,e,{padding:a,textAlign:o,verticalAlign:s},i*r,t)}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),resetMotion4([this.datumSelection],resetRadialGaugeSeriesResetSectorFunction),resetMotion4([this.needleSelection],resetRadialGaugeSeriesResetNeedleFunction),this.formatLabelText()}resetAnimation(t){t==="initial"?this.animationState.transition("reset"):t==="ready"&&this.animationState.transition("skip")}animateLabelText(t={}){const{animationManager:e}=this.ctx;let i,o,s,a;if(this.labelSelection.each((r,n)=>{r.opacity=1,n.label==="primary"?(i=r.previousDatum?.value??t.from??n.value,o=n.value):n.label==="secondary"&&(s=r.previousDatum?.value??t.from??n.value,a=n.value)}),!this.labelsHaveExplicitText())if(o==null||a==null)this.formatLabelText();else if(i===o&&s===a)this.formatLabelText({label:o,secondaryLabel:a});else{const r=`${this.id}_labels`;e.animate({id:r,groupId:"label",from:{label:i,secondaryLabel:s},to:{label:o,secondaryLabel:a},phase:t.phase??"update",onUpdate:n=>this.formatLabelText(n),onStop:()=>this.formatLabelText({label:o,secondaryLabel:a})})}}animateEmptyUpdateReady(){const{animationManager:t}=this.ctx,{node:e,needle:i}=prepareRadialGaugeSeriesAnimationFunctions(!0,this.scale.range[0]);fromToMotion5(this.id,"node",t,[this.datumSelection],e,(o,s)=>s.itemId),fromToMotion5(this.id,"needle",t,[this.needleSelection],i,()=>"needle"),fromToMotion5(this.id,"label",t,[this.labelSelection],fadeInFns,(o,s)=>s.label),this.animateLabelText({from:this.properties.scale.min,phase:"initial"})}animateWaitingUpdateReady(){const{animationManager:t}=this.ctx,{node:e,needle:i}=prepareRadialGaugeSeriesAnimationFunctions(!1,this.scale.range[0]);fromToMotion5(this.id,"node",t,[this.datumSelection],e,(o,s)=>s.itemId),fromToMotion5(this.id,"needle",t,[this.needleSelection],i,()=>"needle"),this.animateLabelText()}animateReadyResize(){this.resetAllAnimation()}dataCount(){return Number.NaN}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(t,e){return[Number.NaN,Number.NaN]}getLegendData(){return[]}getTooltipContent(t){const{id:e,properties:i}=this,{tooltip:o}=i;let s,a,r;if(t.type===0?(s=i.value,a=i.label.text,r=this.ctx.localeManager.t("ariaLabelGaugeValue")):({value:s,text:a}=i.targets[t.index],r=this.ctx.localeManager.t("ariaLabelGaugeTarget")),s!=null)return this.formatTooltipWithContext(o,{data:[{label:a,fallbackLabel:r,value:this.formatLabel(s)}]},{seriesId:e,title:void 0,datum:void 0,value:s})}pickNodeClosestDatum(t){return pickGaugeNearestDatum(this,t)}pickFocus(t){return pickGaugeFocus(this,t)}getCaptionText(){const{value:t}=this.properties,e=[];return e.push(this.formatLabel(t)),this.labelSelection.each((i,o)=>{const s=getLabelText(this.id,this.ctx,o);s!=null&&e.push((0,import_ag_charts_core112.toPlainText)(s))}),e.join(". ")}getCategoryValue(t){}datumIndexForCategoryValue(t){}hasItemStylers(){return this.properties.label.itemStyler!=null}};RadialGaugeSeries.className="RadialGaugeSeries",RadialGaugeSeries.type="radial-gauge";var{FONT_SIZE_RATIO:FONT_SIZE_RATIO2}=import_ag_charts_community267._ModuleSupport,RadialGaugeModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"radial-gauge",moduleFactory:t=>new RadialGaugeSeries(t),themeTemplate:{minWidth:200,minHeight:200,tooltip:{enabled:!1},series:{outerRadiusRatio:1,innerRadiusRatio:.8,startAngle:270,endAngle:450,defaultColorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$interpolate:[{$palette:"secondDivergingColors"},5]},import_ag_charts_community267._ModuleSupport.SAFE_RANGE2_OPERATION]},scale:{defaultFill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/2",import_ag_charts_community267._ModuleSupport.SAFE_STROKE_FILL_OPERATION,{$palette:"hierarchyColors"}]},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:12}},bar:{strokeWidth:{$isUserOption:["./stroke",2,0]}},segmentation:{enabled:!1,interval:{},spacing:2},defaultTarget:{fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},size:10,shape:"triangle",placement:"outside",spacing:5,label:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:5}},needle:{enabled:!1,fill:{$ref:"foregroundColor"},spacing:10},label:{...import_ag_charts_community267._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:56,minimumFontSize:18/56,fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}},secondaryLabel:{...import_ag_charts_community267._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:FONT_SIZE_RATIO2.LARGE},minimumFontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"subtleTextColor"}},tooltip:{range:{$path:["/tooltip/range",10]}}}}},RadialGaugeSeriesModule={type:"series",name:"radial-gauge",chartType:"standalone",enterprise:!0,options:import_ag_charts_community267._ModuleSupport.radialGaugeSeriesOptionsDef,create:t=>new RadialGaugeSeries(t)},import_ag_charts_community272=require("ag-charts-community"),import_ag_charts_community270=require("ag-charts-community"),import_ag_charts_core114=require("ag-charts-core"),import_ag_charts_community268=require("ag-charts-community"),import_ag_charts_core113=require("ag-charts-core"),{BBox:BBox25,Path:Path14,Vec2:Vec220,SceneChangeDetection:SceneChangeDetection10}=import_ag_charts_community268._ModuleSupport,SankeyLink=class extends Path14{constructor(){super(...arguments),this.x1=0,this.x2=0,this.y1=0,this.y2=0,this.height=0,this.inset=0,this.elbows=[]}computeBBox(){const t=Math.min(this.x1,this.x2),e=Math.max(this.x1,this.x2)-t,i=Math.min(this.y1,this.y2),o=Math.max(this.y1,this.y2)-i+this.height;return new BBox25(t,i,e,o)}updatePath(){const{path:t,inset:e}=this;t.clear();const i=this.height-2*this.inset,o=i/2;let s=this.x1+e,a=this.y1+e;t.moveTo(s,a);for(const l of this.elbows)this.updatePathSection(s,a,l.x,l.y,i,-o),s=l.x,a=l.y;const r=this.x2-e,n=this.y2+e;this.updatePathSection(s,a,r,n,i,-o),t.lineTo(r,n+i),s=r,a=n;for(const l of this.elbows.toReversed())this.updatePathSection(s,a,l.x,l.y,i,o),s=l.x,a=l.y;this.updatePathSection(s,a,this.x1+e,this.y1+e,i,o),t.closePath()}updatePathSection(t,e,i,o,s,a){const{path:r}=this,n=Vec220.from(t,e+a+s/2),l=Vec220.from(i,o+a+s/2);if(Math.abs(l.y-n.y)<2){r.lineTo(l.x,l.y);return}let c=Vec220.angle(Vec220.sub(l,n));c<0&&(c=2*Math.PI+c);const h=0,d=Math.PI/2,u=Math.PI,p=Math.PI*1.5,g=getArcValues(n,l,0),y=getArcValues(n,l,s);if(g.radius=p?(r.arc(n.x,e-g.radius,g.radius,d,d+y.angle,!0),r.arc(l.x,o+y.radius,y.radius,p+y.angle,p),r.lineTo(l.x,l.y)):c>h&&c<=d?(r.arc(n.x,e+y.radius,y.radius,p,p+y.angle),r.arc(l.x,o-g.radius,g.radius,d+g.angle,d,!0),r.lineTo(l.x,l.y)):c>d&&c<=u?(r.arc(n.x,e+y.radius,y.radius-s,p,p+y.angle,!0),r.arc(l.x,o-g.radius,g.radius+s,d+g.angle,d),r.lineTo(l.x,l.y)):(r.arc(n.x,e-g.radius,g.radius+s,d,d+g.angle),r.arc(l.x,o+y.radius,y.radius-s,p+y.angle,p,!0),r.lineTo(l.x,l.y))}};__decorateClass([SceneChangeDetection10()],SankeyLink.prototype,"x1",2),__decorateClass([SceneChangeDetection10()],SankeyLink.prototype,"x2",2),__decorateClass([SceneChangeDetection10()],SankeyLink.prototype,"y1",2),__decorateClass([SceneChangeDetection10()],SankeyLink.prototype,"y2",2),__decorateClass([SceneChangeDetection10()],SankeyLink.prototype,"height",2),__decorateClass([SceneChangeDetection10()],SankeyLink.prototype,"inset",2);function getArcValues(t,e,i){const o=Vec220.angle(Vec220.sub(e,t)),s=Vec220.distance(t,e),a=Vec220.add(t,Vec220.rotate(Vec220.from(s/2,0),o)),r=-1/Vec220.gradient(t,e),n=Vec220.intercept(a,r),l=lerpClamp(.1,.5,Math.PI/2-Math.abs(Vec220.gradient(t,e))),c=Vec220.intersectAtX(r,n,t.x),h=Math.max(i,Vec220.distance(t,c)*l);return{angle:Vec220.angle(Vec220.sub(c,t),Vec220.sub(c,a))/-(1.1-l),radius:h}}function lerpClamp(t,e,i){return(0,import_ag_charts_core113.clamp)(t,(e-t)*i+t,e)}var import_ag_charts_community269=require("ag-charts-community"),{BaseProperties:BaseProperties29,FillGradientDefaults:FillGradientDefaults3,FillPatternDefaults:FillPatternDefaults3,FillImageDefaults:FillImageDefaults3,makeSeriesTooltip:makeSeriesTooltip22,SeriesProperties:SeriesProperties13,Property:Property82,Label:Label17}=import_ag_charts_community269._ModuleSupport,SankeySeriesLabelProperties=class extends Label17{constructor(){super(...arguments),this.spacing=1,this.placement=void 0,this.edgePlacement=void 0}};__decorateClass([Property82],SankeySeriesLabelProperties.prototype,"spacing",2),__decorateClass([Property82],SankeySeriesLabelProperties.prototype,"placement",2),__decorateClass([Property82],SankeySeriesLabelProperties.prototype,"edgePlacement",2);var SankeySeriesLinkProperties=class extends BaseProperties29{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}};__decorateClass([Property82],SankeySeriesLinkProperties.prototype,"fill",2),__decorateClass([Property82],SankeySeriesLinkProperties.prototype,"fillOpacity",2),__decorateClass([Property82],SankeySeriesLinkProperties.prototype,"stroke",2),__decorateClass([Property82],SankeySeriesLinkProperties.prototype,"strokeOpacity",2),__decorateClass([Property82],SankeySeriesLinkProperties.prototype,"strokeWidth",2),__decorateClass([Property82],SankeySeriesLinkProperties.prototype,"lineDash",2),__decorateClass([Property82],SankeySeriesLinkProperties.prototype,"lineDashOffset",2),__decorateClass([Property82],SankeySeriesLinkProperties.prototype,"itemStyler",2);var SankeySeriesNodeProperties=class extends BaseProperties29{constructor(){super(...arguments),this.spacing=1,this.minSpacing=0,this.width=1,this.alignment="justify",this.verticalAlignment="center",this.sort="auto",this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}};__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"spacing",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"minSpacing",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"width",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"alignment",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"verticalAlignment",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"sort",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"fill",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"fillOpacity",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"stroke",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"strokeOpacity",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"strokeWidth",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"lineDash",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"lineDashOffset",2),__decorateClass([Property82],SankeySeriesNodeProperties.prototype,"itemStyler",2);var SankeySeriesProperties=class extends SeriesProperties13{constructor(){super(),this.nodes=void 0,this.idKey="",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.sizeKey=void 0,this.sizeName=void 0,this.fillGradientDefaults=new FillGradientDefaults3,this.fillPatternDefaults=new FillPatternDefaults3,this.fillImageDefaults=new FillImageDefaults3,this.defaultColorRange=[],this.defaultPatternFills=[],this.fills=[],this.strokes=[],this.label=new SankeySeriesLabelProperties,this.link=new SankeySeriesLinkProperties,this.node=new SankeySeriesNodeProperties,this.tooltip=makeSeriesTooltip22(),this.highlightStyle.deprecated=!1}getStyle(t,e,i,o){const{fillOpacity:s,strokeWidth:a,strokeOpacity:r,lineDash:n,lineDashOffset:l,fill:c=e[o%e.length],stroke:h=i[o%e.length]}=t?this.link:this.node;return{fill:c,fillOpacity:s,stroke:h,strokeWidth:a,strokeOpacity:r,lineDash:n,lineDashOffset:l}}};__decorateClass([Property82],SankeySeriesProperties.prototype,"nodes",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"fromKey",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"toKey",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"idKey",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"idName",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"labelKey",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"labelName",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"sizeKey",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"sizeName",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"fillGradientDefaults",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"fillPatternDefaults",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"fillImageDefaults",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"defaultColorRange",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"defaultPatternFills",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"fills",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"strokes",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"label",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"link",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"node",2),__decorateClass([Property82],SankeySeriesProperties.prototype,"tooltip",2);var{Transformable:Transformable3,applyShapeStyle:applyShapeStyle18,SeriesNodePickMode:SeriesNodePickMode16,createDatumId:createDatumId20,getShapeStyle:getShapeStyle2,getLabelStyles:getLabelStyles6,Rect:Rect8,BBox:BBox26,mergeDefaults:mergeDefaults20}=import_ag_charts_community270._ModuleSupport,SankeySeries=class extends FlowProportionSeries{constructor(t){super({moduleCtx:t,pickModes:[SeriesNodePickMode16.NEAREST_NODE,SeriesNodePickMode16.EXACT_SHAPE_MATCH]}),this.properties=new SankeySeriesProperties}isLabelEnabled(){return(this.properties.labelKey!=null||this.nodes==null)&&this.properties.label.enabled}linkFactory(){return new SankeyLink}nodeFactory(){return new Rect8}createNodeData(){const{id:t,_nodeDataDependencies:{seriesRectWidth:e,seriesRectHeight:i}={seriesRectWidth:0,seriesRectHeight:0}}=this,{fromKey:o,toKey:s,sizeKey:a,labelKey:r,label:{spacing:n,placement:l,edgePlacement:c},node:{width:h,alignment:d}}=this.properties,u=I=>({...I,x:Number.NaN,y:Number.NaN,width:h,height:Number.NaN}),p=I=>({...I,x1:Number.NaN,x2:Number.NaN,y1:Number.NaN,y2:Number.NaN,height:Number.NaN,elbows:[]}),{nodeGraph:g,links:y,maxPathLength:f}=this.getNodeGraph(u,p,{includeCircularReferences:!1}),x=g;if(x.size===0)return;const b=[];for(let I=0;IG+K.size,0),A.reduce((G,{link:K})=>G+K.size,0));if(L.length===0&&A.length===0||B===0){I.columnIndex=-1;continue}let V;switch(d){case"left":V=b[P];break;case"right":V=b[f-1-z];break;case"center":{if(L.length!==0)V=b[P];else if(A.length===0)V=b[0];else{const G=A.reduce((K,U)=>Math.min(K,U.node.maxPathLengthBefore),f)-1;V=b[G]}break}case"justify":{V=A.length===0?b[f-1]:b[P];break}}C.size=B;const{label:W}=this.properties,H=W.enabled?this.getLabelText(C.label,C.datum,r,"label",[],this.properties.label,{datum:C.datum,value:C.label,fromKey:o,toKey:s,sizeKey:a,size:B}):void 0;C.label=(0,import_ag_charts_core114.toPlainText)(H),V.nodes.push(I),V.size+=B,I.columnIndex=V.index}const m=(0,import_ag_charts_core114.cachedTextMeasurer)(this.properties.label);let S=0,v=0;if(this.isLabelEnabled()){if(l==null&&c==null)S=(e-h)*(1-f/(f+1)),v=S;else if(c==="outside"||c==null){const I=(C,L)=>{const A=L;if(A.datum.label==null||A.datum.label==="")return C;let P=(e-h)/(f-1)-n;l==="center"&&c==null&&(P/=2);const z=(0,import_ag_charts_core114.wrapText)(A.datum.label,{maxWidth:P,maxHeight:A.datum.height,font:this.properties.label,textWrap:"never"});let{width:B}=m.measureLines(z);return l==="center"&&c==null&&(B/=2),Math.max(C,B)};(l!=="right"||c==="outside")&&(S=h+b[0].nodes.reduce(I,0)),(l!=="left"||c==="outside")&&(v=h+b.at(-1).nodes.reduce(I,0))}}const M=(e-h-S-v)/(f-1);for(let I=0;II.columnIndex;P--){const z=L.link.size,B={ghost:!0,datum:{...I.datum,size:z,y:0,height:0},weight:0,linksBefore:[{node:{columnIndex:P-1,datum:{size:z}}}],linksAfter:[{node:{columnIndex:P+1,datum:{size:z}}}],link:L.link,columnIndex:I.columnIndex,size:I.datum.size,closestColumnDiff:C,fromNode:{y:A.datum.y},toNode:{y:0}};b[P].size+=z,b[P].nodes.push(B)}}}const D=b.toSorted((I,C)=>{const L=I.nodes.reduce((P,z)=>Math.max(P,z.datum.size),0);return C.nodes.reduce((P,z)=>Math.max(P,z.datum.size),0)-L}),k={};for(let I=0;I{if(A.node.columnIndex!==I.index-1)return L;const P=A.node.datum.size/b[A.node.columnIndex].size*k[A.node.columnIndex];return Math.max(L,P)},0),C.weight+=C.linksAfter.reduce((L,A)=>{if(A.node.columnIndex!==I.index+1)return L;const P=A.node.datum.size/b[A.node.columnIndex].size*k[A.node.columnIndex];return Math.max(L,P)},0)}I.nodes.sort((C,L)=>this.sortNodes(C,L))}const _=1,T=I=>b.reduce((C,{size:L,nodes:A})=>{const P=i-A.length*_,B=(1-(A.length-1)*I/P)/L;return Math.min(C,B)},1/0);let w=this.properties.node.spacing,R=T(w);for(;R<0&&w>this.properties.node.minSpacing;)w-=1,R=T(w);if(R<0){import_ag_charts_core114.Logger.warnOnce("There was insufficient space to display the Sankey Series. Reduce [node.spacing], [node.minSpacing], or provide a larger container.");return}for(const I of b){let C=0;for(const P of I.nodes){const z=i*P.datum.size*R;P.datum.height=Math.max(_,z),C+=z}const L=w*(I.nodes.length-1);let A=0;this.properties.node.verticalAlignment==="bottom"?A=i-C-L:this.properties.node.verticalAlignment==="center"&&(A=(i-C-L)/2);for(const P of I.nodes)P.datum.y=A,A+=i*P.datum.size*R+w,"ghost"in P&&P.ghost&&P.link.elbows.push({x:I.x,y:P.datum.y})}for(const{datum:I,linksBefore:C,linksAfter:L}of x.values()){let A=I.y;C.sort((z,B)=>this.sortNodes(z.node,B.node));for(const{link:z}of C)z.y2=A,A+=z.size*i*R;let P=I.y;L.sort((z,B)=>this.sortNodes(z.node,B.node,{invertColumnSort:!0}));for(const{link:z}of L)z.y1=P,P+=z.size*i*R}const F=[],O=[],{fontSize:E}=this.properties.label;for(const[I,C]of b.entries()){const L=I===0,A=I===b.length-1;let P=-1/0;C.nodes.sort((z,B)=>z.datum.y-B.datum.y);for(const z of C.nodes){if("ghost"in z&&z.ghost)continue;const{datum:B}=z;if(B.midPoint={x:B.x+B.width/2,y:B.y+B.height/2},F.push(B),B.label==null)continue;const V=B.y+B.height/2;let W;if(!L&&!A){const X=(0,import_ag_charts_core114.calcLineHeight)(E),Z=V-X,q=V+X;let it=e;for(const{datum:j}of x.values())j.x>B.x&&Math.max(j.y,Z)<=Math.min(j.y+j.height,q)&&(it=Math.min(it,j.x-n));const J=it-B.x-2*n;W=(0,import_ag_charts_core114.wrapText)(B.label,{maxWidth:J,maxHeight:B.height,font:this.properties.label,textWrap:"never",overflow:"hide"})}if(W==null||W===""){const X=c==null&&(L||A)?n:n*2;W=(0,import_ag_charts_core114.wrapText)(B.label,{maxWidth:M-X,maxHeight:B.height,font:this.properties.label,textWrap:"never"})}if(W==="")continue;const{height:H}=m.measureLines(W),G=V-H/2,K=V+H/2;let U=B.x+B.width+n,Y="left",$=l;L&&c==null&&l==null&&($="left"),c==="outside"?(L&&($="left"),A&&($="right")):c==="inside"&&(L&&($="right"),A&&($="left")),$==="left"?(U=B.x-n,Y="right"):$==="center"&&(U=B.x+B.width/2,Y="center"),G>=P&&(O.push({x:U,y:V,textAlign:Y,text:W,size:B.size}),P=K)}}for(const I of y){const{fromNode:C,toNode:L,size:A}=I;I.height=Math.max(_,i*A*R),I.x1=C.x+h,I.x2=L.x,I.midPoint={x:(I.x1+I.x2)/2,y:(I.y1+I.y2)/2+I.height/2},F.push(I)}return{itemId:t,nodeData:F,labelData:O}}sortNodes(t,e,i){const{properties:o}=this;return o.node.sort==="ascending"?(t.datum.label??"").localeCompare(e.datum.label??""):o.node.sort==="descending"?(e.datum.label??"").localeCompare(t.datum.label??""):o.node.sort==="data"?0:t.columnIndexe.columnIndex?i?.invertColumnSort?-1:1:t.weight===e.weight?t.datum.size-e.datum.size:t.closestColumnDiffe.closestColumnDiff?-1:t.weight-e.weight}updateLabelSelection(t){const e=this.isLabelEnabled()?t.labelData:[];return t.labelSelection.update(e)}updateLabelNodes(t){const e=this.ctx.highlightManager?.getActiveHighlight();t.labelSelection.each((i,o)=>{const{x:s,y:a,textAlign:r,text:n}=o,c=getLabelStyles6(this,void 0,o,this.properties.label,!1,e),{color:h,fontStyle:d,fontWeight:u,fontSize:p,fontFamily:g}=c;i.visible=!0,i.x=s,i.y=a,i.text=n,i.fill=h,i.fontStyle=d,i.fontWeight=u,i.fontSize=p,i.fontFamily=g,i.textAlign=r,i.textBaseline="middle",i.setBoxing(c)})}updateNodeSelection(t){return t.datumSelection.update(t.nodeData,void 0,e=>createDatumId20(e.type,e.id))}getNodeStyle(t,e,i){const{properties:o}=this,{fills:s,strokes:a,defaultColorRange:r,defaultPatternFills:n,fillGradientDefaults:l,fillPatternDefaults:c,fillImageDefaults:h}=o,{itemStyler:d}=o.node,u=r[e%r.length].map(b=>({color:b})),p=n[e%n.length],g=this.getHighlightStyle(i,t.datumIndex),y=mergeDefaults20(g,o.getStyle(!1,s,a,e)),f=o.node.fill!=null;let x=getShapeStyle2(y,f?l:{...l.toJson(),colorStops:u},f?c:{...c.toJson(),fill:p,stroke:p},h);if(d!=null&&t.datumIndex!=null){const b=this.cachedDatumCallback(createDatumId20(t.datumIndex.index,"node",i?"highlight":"node"),()=>{const m=this.makeItemStylerParams(t,i,x);return this.callWithContext(d,m)});b&&(x=mergeDefaults20(b,x,{...l.toJson(),colorStops:u},{...c.toJson(),fill:p,stroke:p},h))}return x.opacity=1,x}makeItemStylerParams({datum:t,datumIndex:e,size:i=0,label:o},s,a){const{id:r}=this,n=this.ctx.highlightManager?.getActiveHighlight(),l=this.getHighlightStateString(n,s,e),c=this.filterItemStylerFillParams(a.fill)??a.fill;return{seriesId:r,datum:t,highlighted:s,highlightState:l,...a,size:i,label:o,fill:c}}updateNodeNodes(t){const{datumSelection:e,isHighlight:i}=t,o=this.getShapeFillBBox();e.each((s,a)=>{const{datumIndex:r}=a,n=this.getNodeStyle(a,r.index,i);s.x=a.x,s.y=a.y,s.width=Math.max(a.width,0),s.height=Math.max(a.height,0),applyShapeStyle18(s,n,o)})}getShapeFillBBox(){const t=this._nodeDataDependencies?.seriesRectWidth??0,e=this._nodeDataDependencies?.seriesRectHeight??0,i=new BBox26(0,0,t,e);return{series:i,axis:i}}updateLinkSelection(t){return t.datumSelection.update(t.nodeData,void 0,e=>createDatumId20(e.type,e.index,e.fromNode.id,e.toNode.id))}getLinkStyle({datumIndex:t,datum:e},i,o){const{id:s,properties:a}=this,{fills:r,strokes:n,defaultColorRange:l,defaultPatternFills:c,fillGradientDefaults:h,fillPatternDefaults:d,fillImageDefaults:u}=a,{itemStyler:p}=a.link,g=l[i.index%l.length].map(S=>({color:S})),y=c[i.index%c.length],f=this.getHighlightStyle(o,t),x=mergeDefaults20(f,a.getStyle(!0,r,n,i.index)),b=a.link.fill!=null;let m=getShapeStyle2(x,b?h:{...h.toJson(),colorStops:g},b?d:{...d.toJson(),fill:y,stroke:y},u);if(p!=null&&t!=null){const S=this.cachedDatumCallback(createDatumId20(t.index,"link",o?"highlight":"node"),()=>{const v=this.ctx.highlightManager?.getActiveHighlight(),M=this.getHighlightStateString(v,o,t);return this.callWithContext(p,{seriesId:s,datum:e,highlighted:o,highlightState:M,...m})});S&&(m=mergeDefaults20(S,m,{...h.toJson(),colorStops:g},{...d.toJson(),fill:y,stroke:y},u))}return m.opacity=1,m}updateLinkNodes(t){const{datumSelection:e,isHighlight:i}=t,o=this.getShapeFillBBox();e.each((s,a)=>{const r=a.fromNode.datumIndex,n=this.getLinkStyle(a,r,i);s.x1=a.x1,s.y1=a.y1,s.x2=a.x2,s.y2=a.y2,s.height=a.height,s.elbows=a.elbows,applyShapeStyle18(s,n,o),s.inset=s.strokeWidth/2})}getTooltipContent(t){const{id:e,linksProcessedData:i,nodesProcessedData:o,properties:s,ctx:{formatManager:a}}=this,{fromKey:r,toKey:n,sizeKey:l,sizeName:c,tooltip:h}=s,d=this.contextNodeData?.nodeData.find(b=>b.datumIndex.type===t.type&&b.datumIndex.index===t.index);if(d==null)return;const u=d.type===0?d.fromNode.index:d.index,p=d.type===0?`${d.fromNode.label} - ${d.toNode.label}`:d.label,g=t.type===0?i?.dataSources.get(this.id)?.data[t.index]:o?.dataSources.get(this.id)?.data[t.index],y=d.size;let f;if(d.type===0){const b=d.fromNode.datumIndex;f=this.getLinkStyle({datumIndex:t,datum:g},b,!1)}else f=this.getNodeStyle({datumIndex:t,datum:g},t.index,!1);const x=[];if(l!=null){const b=a.format(this.callWithContext.bind(this),{type:"number",value:y,datum:g,seriesId:e,legendItemName:void 0,key:l,source:"tooltip",property:"size",domain:[],boundSeries:this.getFormatterContext("size"),fractionDigits:void 0});x.push({label:c,fallbackLabel:l,value:b??String(y)})}return this.formatTooltipWithContext(h,{title:p,symbol:this.legendItemSymbol(d.type,u,f),data:x},{seriesId:e,datum:g,title:p,fromKey:r,toKey:n,sizeKey:l,sizeName:c,size:y,...f})}computeFocusBounds(t){if(t instanceof Rect8){const{x:e,y:i,width:o,height:s}=t,a=new BBox26(e,i,o,s);return Transformable3.toCanvas(this.contentGroup,a)}return t}hasItemStylers(){return this.properties.node.itemStyler!=null||this.properties.link.itemStyler!=null||this.properties.label.itemStyler!=null}};SankeySeries.className="SankeySeries",SankeySeries.type="sankey";var import_ag_charts_community271=require("ag-charts-community"),import_ag_charts_core115=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs21,sankeySeriesThemeableOptionsDef}=import_ag_charts_community271._ModuleSupport,sankeySeriesOptionsDef={...sankeySeriesThemeableOptionsDef,...commonSeriesOptionsDefs21,type:(0,import_ag_charts_core115.required)((0,import_ag_charts_core115.constant)("sankey")),fromKey:(0,import_ag_charts_core115.required)(import_ag_charts_core115.string),toKey:(0,import_ag_charts_core115.required)(import_ag_charts_core115.string),sizeKey:import_ag_charts_core115.string,sizeName:import_ag_charts_core115.string};sankeySeriesOptionsDef.fillGradientDefaults=(0,import_ag_charts_core115.undocumented)(import_ag_charts_core115.fillGradientDefaults),sankeySeriesOptionsDef.fillPatternDefaults=(0,import_ag_charts_core115.undocumented)(import_ag_charts_core115.fillPatternDefaults),sankeySeriesOptionsDef.fillImageDefaults=(0,import_ag_charts_core115.undocumented)(import_ag_charts_core115.fillImageDefaults),sankeySeriesOptionsDef.defaultColorRange=(0,import_ag_charts_core115.undocumented)((0,import_ag_charts_core115.arrayOf)((0,import_ag_charts_core115.arrayOf)(import_ag_charts_core115.color))),sankeySeriesOptionsDef.defaultPatternFills=(0,import_ag_charts_core115.undocumented)((0,import_ag_charts_core115.arrayOf)(import_ag_charts_core115.color));var SankeyModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],solo:!0,identifier:"sankey",moduleFactory:t=>new SankeySeries(t),themeTemplate:{seriesArea:{padding:{top:10,bottom:10}},series:{fills:{$palette:"fills"},strokes:{$palette:"strokes"},fillGradientDefaults:import_ag_charts_community272._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS,fillPatternDefaults:import_ag_charts_community272._ModuleSupport.FILL_PATTERN_DEFAULTS,fillImageDefaults:import_ag_charts_community272._ModuleSupport.FILL_IMAGE_DEFAULTS,defaultColorRange:{$palette:"gradients"},defaultPatternFills:import_ag_charts_community272._ModuleSupport.SAFE_FILLS_OPERATION,highlightStyle:{series:{dimOpacity:.2}},highlight:{...import_ag_charts_community272._ModuleSupport.singleSeriesHighlightStyle()},label:{...import_ag_charts_community272._ModuleSupport.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:10},node:{spacing:{$if:[{$greaterThan:[{$path:"./minSpacing"},20]},{$path:"./minSpacing"},20]},minSpacing:0,width:10,strokeWidth:{$isUserOption:["./stroke",2,0]}},link:{fillOpacity:.5,strokeWidth:{$isUserOption:["./stroke",2,0]}}},legend:{enabled:!1,toggleSeries:!1}}},SankeySeriesModule={type:"series",name:"sankey",chartType:"standalone",enterprise:!0,options:sankeySeriesOptionsDef,create:t=>new SankeySeries(t)},import_ag_charts_community276=require("ag-charts-community"),import_ag_charts_community274=require("ag-charts-community"),import_ag_charts_core116=require("ag-charts-core"),import_ag_charts_community273=require("ag-charts-community"),{HierarchySeriesProperties,HighlightStyle,makeSeriesTooltip:makeSeriesTooltip23,Property:Property83}=import_ag_charts_community273._ModuleSupport,SunburstSeriesTileHighlightStyle=class extends HighlightStyle{constructor(){super(!1),this.label=new AutoSizedLabel,this.secondaryLabel=new AutoSizedLabel}};__decorateClass([Property83],SunburstSeriesTileHighlightStyle.prototype,"fill",2),__decorateClass([Property83],SunburstSeriesTileHighlightStyle.prototype,"fillOpacity",2),__decorateClass([Property83],SunburstSeriesTileHighlightStyle.prototype,"stroke",2),__decorateClass([Property83],SunburstSeriesTileHighlightStyle.prototype,"strokeWidth",2),__decorateClass([Property83],SunburstSeriesTileHighlightStyle.prototype,"strokeOpacity",2),__decorateClass([Property83],SunburstSeriesTileHighlightStyle.prototype,"label",2),__decorateClass([Property83],SunburstSeriesTileHighlightStyle.prototype,"secondaryLabel",2);var SunburstSeriesProperties=class extends HierarchySeriesProperties{constructor(){super(...arguments),this.fillOpacity=1,this.strokeWidth=0,this.strokeOpacity=1,this.cornerRadius=0,this.highlightStyle=new SunburstSeriesTileHighlightStyle,this.label=new AutoSizedLabel,this.secondaryLabel=new AutoSizedSecondaryLabel,this.tooltip=makeSeriesTooltip23()}getStyle(t){const{fills:e,strokes:i,fillOpacity:o,strokeWidth:s,strokeOpacity:a}=this;return{fill:e[t%e.length],fillOpacity:o,stroke:i[t%i.length],strokeWidth:s,strokeOpacity:a,opacity:1}}};__decorateClass([Property83],SunburstSeriesProperties.prototype,"sizeName",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"labelKey",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"secondaryLabelKey",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"sectorSpacing",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"padding",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"highlightStyle",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"label",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"secondaryLabel",2),__decorateClass([Property83],SunburstSeriesProperties.prototype,"tooltip",2);var{fromToMotion:fromToMotion6,normalizeAngle360:normalizeAngle3608,createDatumId:createDatumId21,PointerEvents:PointerEvents13,Sector:Sector7,Group:Group20,ScalableGroup,Selection:Selection17,TransformableText:TransformableText3,BBox:BBox27,applyShapeStyle:applyShapeStyle19,mergeDefaults:mergeDefaults21,formatValue:formatValue2,getLabelStyles:getLabelStyles7}=import_ag_charts_community274._ModuleSupport,SunburstNode=class extends import_ag_charts_community274._ModuleSupport.HierarchyNode{constructor(){super(...arguments),this.label=void 0,this.secondaryLabel=void 0,this.contentHeight=0,this.bbox=void 0,this.startAngle=0,this.endAngle=0}};function setAngleData(t,e=0,i=2*Math.PI/t.sumSize){for(const o of t.children){const s=e+o.sumSize*i;o.startAngle=e,o.endAngle=s,setAngleData(o,e,i),e=s}}var SunburstSeries=class extends import_ag_charts_community274._ModuleSupport.HierarchySeries{constructor(t){super(t),this.NodeClass=SunburstNode,this.properties=new SunburstSeriesProperties,this.scalingGroup=this.contentGroup.appendChild(new ScalableGroup),this.sectorGroup=this.scalingGroup.appendChild(new Group20),this.sectorLabelGroup=this.scalingGroup.appendChild(new Group20),this.highlightSectorGroup=this.scalingGroup.appendChild(new Group20),this.datumSelection=Selection17.select(this.sectorGroup,Sector7),this.labelSelection=Selection17.select(this.sectorLabelGroup,Group20),this.highlightSelection=Selection17.select(this.highlightSectorGroup,Sector7),this.sectorLabelGroup.pointerEvents=PointerEvents13.None}processData(){super.processData(),setAngleData(this.rootNode)}updateSelections(){const t=this.ctx.highlightManager?.getActiveHighlight();if(this.highlightSelection.update(t==null?[]:[t],void 0,a=>this.getDatumId(a)),!this.nodeDataRefresh)return;this.nodeDataRefresh=!1;const{chart:e}=this;if(e==null||e.seriesRect==null)return;const o=Array.from(this.rootNode),s=a=>{a.append([new TransformableText3({tag:0}),new TransformableText3({tag:1})])};this.datumSelection.update(o,void 0,a=>this.getDatumId(a)),this.labelSelection.update(o,s,a=>this.getDatumId(a))}getItemStyle(t,e){const{properties:i,colorScale:o}=this,{itemStyler:s}=i,a=t.datumIndex?.[0]??0,r=e?i.highlightStyle:void 0,n=mergeDefaults21(r,i.getStyle(a));!e&&t.colorValue!=null&&(n.fill=o.convert(t.colorValue));let l=n;if(s!=null&&t!=null){const c=this.cachedDatumCallback(createDatumId21(this.getDatumId(t),e?"highlight":"node"),()=>{const h=this.makeItemStylerParams(t,e,l);return this.callWithContext(s,h)});c&&(l=mergeDefaults21(c,l))}return l}makeItemStylerParams(t,e,i){const{id:o}=this,s=this.ctx.highlightManager?.getActiveHighlight(),a=this.getHighlightStateString(s,e,t.datumIndex),r=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:o,datum:t.datum,depth:t.depth??0,highlighted:e,highlightState:a,...i,fill:r}}updateNodes(){const{chart:t,data:e,maxDepth:i}=this;if(t==null||e==null)return;const{width:o,height:s}=t.seriesRect,{sectorSpacing:a=0,padding:r=0,cornerRadius:n,childrenKey:l,colorKey:c,colorName:h,labelKey:d,secondaryLabelKey:u,sizeKey:p,sizeName:g}=this.properties;this.contentGroup.translationX=o/2,this.contentGroup.translationY=s/2;const y=a*.5,f=Math.min(o,s)/2,x=f/(i+1),b=-Math.PI/2,m={series:new BBox27(-f,-f,2*f,2*f),axis:new BBox27(-f,-f,2*f,2*f)};this.rootNode?.walk(D=>{const{startAngle:k,endAngle:_}=D;if(D.depth!=null){const T=(k+_)/2+b,w=(D.depth+.5)*x;D.midPoint.x=Math.cos(T)*w,D.midPoint.y=Math.sin(T)*w}}),this.rootNode?.walk(D=>{const{datum:k,depth:_,startAngle:T,endAngle:w,parent:R,sumSize:F}=D;D.label=void 0,D.secondaryLabel=void 0,D.contentHeight=0;let O;if(k!=null&&_!=null&&d!=null){const Q=k[d];O=this.getLabelText(Q,k,d,"label",[],this.properties.label,{depth:_,datum:k,childrenKey:l,colorKey:c,colorName:h,labelKey:d,secondaryLabelKey:u,sizeKey:p,sizeName:g,value:Q})}O===""&&(O=void 0);let E;if(k!=null&&_!=null&&u!=null){const Q=k[u];E=this.getLabelText(Q,k,u,"secondaryLabel",[],this.properties.secondaryLabel,{depth:_,datum:k,childrenKey:l,colorKey:c,colorName:h,labelKey:d,secondaryLabelKey:u,sizeKey:p,sizeName:g,value:Q})}if(E===""&&(E=void 0),_==null)return;const I=_*x+y,C=(_+1)*x-y,L=I>y?y/I:y,A=C>y?y/C:y,P=T+L,B=w+L-P,V=T+A,H=w+A-V,G=Q=>{if(_===0&&R?.sumSize===F)return{width:2*Math.sqrt(C**2-(Q*.5)**2),height:Q,meta:0};const et=Q,st=2*Math.sqrt(C**2-(I+et)**2),rt=B=ht?{width:lt,height:et,meta:1}:{width:ht,height:ct,meta:2}},K=formatLabels((0,import_ag_charts_core116.toPlainText)(O),this.properties.label,(0,import_ag_charts_core116.toPlainText)(E),this.properties.secondaryLabel,{padding:r},G);if(K==null)return;const{width:U,height:Y,meta:$,label:X,secondaryLabel:Z}=K,q=b+(T+w)/2,it=Math.sin(q)>=0,J=Math.cos(q)>=0,j=(it?3:12)&(J?6:9);let tt;switch($){case 0:tt=0;break;case 1:{const ot=C-(x-Y)*.58,et=Math.sqrt((C-r)**2-(U/2)**2);tt=Math.min(ot,et);break}case 2:if(_===0){const Q=Y/(2*Math.tan(B*.5))+U*.5,ot=Math.sqrt(C**2-(Y*.5)**2)-U*.5;tt=(Q+ot)*.5}else tt=(I+C)*.5;break}if(X!=null){const{fontStyle:Q="normal",fontFamily:ot,fontWeight:et="normal",color:st="black"}=this.properties.label;D.label={...X,fontStyle:Q,fontFamily:ot,fontWeight:et,color:st,labelPlacement:$,circleQuarter:j,radius:tt,theta:q}}if(Z!=null){const{fontStyle:Q="normal",fontFamily:ot,fontWeight:et="normal",color:st="black"}=this.properties.secondaryLabel;D.secondaryLabel={...Z,fontStyle:Q,fontFamily:ot,fontWeight:et,color:st,labelPlacement:$,circleQuarter:j,radius:tt,theta:q}}D.contentHeight=K.height});const S=(D,k,_)=>{const{depth:T,startAngle:w,endAngle:R}=D;if(T==null){k.visible=!1;return}k.visible=!0;const F=this.getItemStyle(D,_),O=F.fill,E=F.strokeWidth,I=import_ag_charts_community274._ModuleSupport.isGradientFill(O)&&O.bounds!=="item"?m:void 0;applyShapeStyle19(k,F,I),k.centerX=0,k.centerY=0,k.innerRadius=T*x,k.outerRadius=(T+1)*x,k.startAngle=w+b,k.endAngle=R+b,k.inset=y+E*.5,k.cornerRadius=n};this.datumSelection.each((D,k)=>{S(k,D,!1)}),this.highlightSelection.each((D,k)=>{S(k,D,!0)});const v=(D,k,_,T)=>{const{depth:w,contentHeight:R}=D,F=_===0,O=F?D.label:D.secondaryLabel;if(w==null||O==null){k.visible=!1;return}const{labelPlacement:E,circleQuarter:I,radius:C,theta:L}=O;let A;T&&(A=(F?this.properties.highlightStyle.label:this.properties.highlightStyle.secondaryLabel).color);const P={childrenKey:this.properties.childrenKey,colorKey:this.properties.colorKey,colorName:this.properties.colorName??this.properties.colorKey,depth:D.depth??Number.NaN,labelKey:this.properties.labelKey,secondaryLabelKey:this.properties.secondaryLabelKey,sizeKey:this.properties.sizeKey,sizeName:this.properties.sizeName??this.properties.sizeKey},z=F?this.properties.label:this.properties.secondaryLabel,B=this.ctx.highlightManager?.getActiveHighlight(),V=getLabelStyles7(this,D,P,z,T,B);switch(k.text=O.text,k.fontSize=O.fontSize,k.lineHeight=O.lineHeight,k.fontStyle=O.fontStyle,k.fontFamily=O.fontFamily,k.fontWeight=O.fontWeight,k.fill=A??O.color,k.fillOpacity=this.getHighlightStyle(T,D.datumIndex)?.opacity??1,k.setBoxing(V),E){case 0:k.textAlign="center",k.textBaseline="top",k.translationX=0,k.translationY=(F?0:R-O.height)-R*.5,k.rotation=0;break;case 1:{const W=(I&3)!==0,H=F===!W?C:C-(R-O.height);k.textAlign="center",k.textBaseline=W?"bottom":"top",k.translationX=Math.cos(L)*H,k.translationY=Math.sin(L)*H,k.rotation=W?L-Math.PI*.5:L+Math.PI*.5;break}case 2:{const W=(I&6)!==0,H=F===!W?(R-O.height)*.5:(O.height-R)*.5;k.textAlign="center",k.textBaseline="middle",k.translationX=Math.cos(L)*C+Math.cos(L+Math.PI/2)*H,k.translationY=Math.sin(L)*C+Math.sin(L+Math.PI/2)*H,k.rotation=W?L:L+Math.PI;break}}k.visible=!0},M=this.ctx.highlightManager?.getActiveHighlight();for(const D of this.labelSelection.selectByClass(TransformableText3)){const k=D.closestDatum();v(k,D,D.tag,k===M)}}getTooltipContent(t){const{id:e,properties:i,ctx:o}=this,{labelKey:s,secondaryLabelKey:a,childrenKey:r,sizeKey:n,sizeName:l,colorKey:c,colorName:h,tooltip:d}=i,{formatManager:u}=o,p=t.reduce((M,D)=>M?.children[D],this.rootNode);if(p==null)return;const{datum:g,depth:y}=p;if(g==null||y==null)return;const f=[],x=n==null?void 0:g[n];if(x!=null){const M=[0,this.rootNode?.sumSize??0],D=u.format(this.callWithContext.bind(this),{type:"number",value:x,datum:g,seriesId:e,legendItemName:void 0,key:n,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:M,fractionDigits:void 0});f.push({label:l,fallbackLabel:n,value:D??formatValue2(x)})}const b=c==null?void 0:g[c];if(b!=null){const{colorDomain:M}=this,D=u.format(this.callWithContext.bind(this),{type:"number",value:b,datum:g,seriesId:e,legendItemName:void 0,key:c,source:"tooltip",property:"color",boundSeries:this.getFormatterContext("color"),domain:M,fractionDigits:void 0});f.push({label:h,fallbackLabel:c,value:D??formatValue2(b)})}const m=this.getItemStyle({...p,colorValue:b??p.colorValue},!1),v={shape:"square",fill:m.fill,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0};return import_ag_charts_community274._ModuleSupport.isGradientFill(v.fill)&&(v.fill={...v.fill,gradient:"linear",rotation:0,reverse:!1}),this.formatTooltipWithContext(d,{title:s==null?void 0:g[s],symbol:{marker:v},data:f},{seriesId:e,datum:g,title:void 0,depth:y,labelKey:s,secondaryLabelKey:a,childrenKey:r,sizeKey:n,sizeName:l,colorKey:c,colorName:h,...m})}createNodeData(){}pickNodeClosestDatum(t){return this.pickNodeNearestDistantObject(t,this.datumSelection.nodes())}animateEmptyUpdateReady(){fromToMotion6(this.id,"nodes",this.ctx.animationManager,[this.scalingGroup],{toFn(){return{scalingX:1,scalingY:1}},fromFn(){return{scalingX:0,scalingY:0}}})}computeFocusBounds(t){return t}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};SunburstSeries.className="SunburstSeries",SunburstSeries.type="sunburst";var import_ag_charts_community275=require("ag-charts-community"),import_ag_charts_core117=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs22,sunburstSeriesThemeableOptionsDef,without:without8}=import_ag_charts_community275._ModuleSupport,sunburstSeriesOptionsDef={...sunburstSeriesThemeableOptionsDef,...without8(commonSeriesOptionsDefs22,["highlightStyle","highlight","showInLegend"]),type:(0,import_ag_charts_core117.required)((0,import_ag_charts_core117.constant)("sunburst")),labelKey:import_ag_charts_core117.string,secondaryLabelKey:import_ag_charts_core117.string,childrenKey:import_ag_charts_core117.string,sizeKey:import_ag_charts_core117.string,colorKey:import_ag_charts_core117.string,sizeName:import_ag_charts_core117.string,colorName:import_ag_charts_core117.string},{BASE_FONT_SIZE,FONT_SIZE_RATIO:FONT_SIZE_RATIO3}=import_ag_charts_community276._ModuleSupport,SunburstModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"sunburst",moduleFactory:t=>new SunburstSeries(t),solo:!0,themeTemplate:{series:{fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",import_ag_charts_community276._ModuleSupport.FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS],["pattern",import_ag_charts_community276._ModuleSupport.FILL_PATTERN_DEFAULTS],["image",import_ag_charts_community276._ModuleSupport.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"strokes"}]},colorRange:{$palette:"divergingColors"},strokeWidth:{$isUserOption:["./strokes/0",2,0]},label:{...import_ag_charts_community276._ModuleSupport.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$rem:FONT_SIZE_RATIO3.LARGE},minimumFontSize:{$rem:9/BASE_FONT_SIZE},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},overflowStrategy:"ellipsis",wrapping:"never",spacing:2},secondaryLabel:{...import_ag_charts_community276._ModuleSupport.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$rem:FONT_SIZE_RATIO3.SMALLEST},minimumFontSize:{$rem:7/BASE_FONT_SIZE},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},overflowStrategy:"ellipsis",wrapping:"never"},sectorSpacing:2,padding:3,highlightStyle:{label:{color:{$ref:"chartBackgroundColor"}},secondaryLabel:{color:{$ref:"chartBackgroundColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2}},gradientLegend:{enabled:!0,...import_ag_charts_community276._ModuleSupport.LEGEND_CONTAINER_THEME}}},SunburstSeriesModule={type:"series",name:"sunburst",chartType:"standalone",enterprise:!0,options:sunburstSeriesOptionsDef,create:t=>new SunburstSeries(t)},import_ag_charts_community280=require("ag-charts-community"),import_ag_charts_community278=require("ag-charts-community"),import_ag_charts_core118=require("ag-charts-core"),import_ag_charts_community277=require("ag-charts-community"),{BaseProperties:BaseProperties30,HierarchySeriesProperties:HierarchySeriesProperties2,HighlightStyle:HighlightStyle2,makeSeriesTooltip:makeSeriesTooltip24,Property:Property84,Label:Label18}=import_ag_charts_community277._ModuleSupport,TreemapGroupLabel=class extends Label18{constructor(){super(...arguments),this.spacing=0}};__decorateClass([Property84],TreemapGroupLabel.prototype,"spacing",2);var TreemapSeriesGroup=class extends BaseProperties30{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.cornerRadius=0,this.textAlign="center",this.gap=0,this.padding=0,this.interactive=!0,this.label=new TreemapGroupLabel}};__decorateClass([Property84],TreemapSeriesGroup.prototype,"fill",2),__decorateClass([Property84],TreemapSeriesGroup.prototype,"fillOpacity",2),__decorateClass([Property84],TreemapSeriesGroup.prototype,"stroke",2),__decorateClass([Property84],TreemapSeriesGroup.prototype,"strokeWidth",2),__decorateClass([Property84],TreemapSeriesGroup.prototype,"strokeOpacity",2),__decorateClass([Property84],TreemapSeriesGroup.prototype,"cornerRadius",2),__decorateClass([Property84],TreemapSeriesGroup.prototype,"textAlign",2),__decorateClass([Property84],TreemapSeriesGroup.prototype,"gap",2),__decorateClass([Property84],TreemapSeriesGroup.prototype,"padding",2),__decorateClass([Property84],TreemapSeriesGroup.prototype,"interactive",2),__decorateClass([Property84],TreemapSeriesGroup.prototype,"label",2);var TreemapSeriesTile=class extends BaseProperties30{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.cornerRadius=0,this.textAlign="center",this.verticalAlign="middle",this.gap=0,this.padding=0,this.label=new AutoSizedLabel,this.secondaryLabel=new AutoSizedSecondaryLabel}};__decorateClass([Property84],TreemapSeriesTile.prototype,"fill",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"fillOpacity",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"stroke",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"strokeWidth",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"strokeOpacity",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"cornerRadius",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"textAlign",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"verticalAlign",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"gap",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"padding",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"label",2),__decorateClass([Property84],TreemapSeriesTile.prototype,"secondaryLabel",2);var TreemapSeriesGroupHighlightStyle=class extends BaseProperties30{constructor(){super(...arguments),this.label=new AutoSizedLabel}};__decorateClass([Property84],TreemapSeriesGroupHighlightStyle.prototype,"fill",2),__decorateClass([Property84],TreemapSeriesGroupHighlightStyle.prototype,"fillOpacity",2),__decorateClass([Property84],TreemapSeriesGroupHighlightStyle.prototype,"stroke",2),__decorateClass([Property84],TreemapSeriesGroupHighlightStyle.prototype,"strokeWidth",2),__decorateClass([Property84],TreemapSeriesGroupHighlightStyle.prototype,"strokeOpacity",2),__decorateClass([Property84],TreemapSeriesGroupHighlightStyle.prototype,"label",2);var TreemapSeriesTileHighlightStyle=class extends BaseProperties30{constructor(){super(...arguments),this.label=new AutoSizedLabel,this.secondaryLabel=new AutoSizedSecondaryLabel}};__decorateClass([Property84],TreemapSeriesTileHighlightStyle.prototype,"fill",2),__decorateClass([Property84],TreemapSeriesTileHighlightStyle.prototype,"fillOpacity",2),__decorateClass([Property84],TreemapSeriesTileHighlightStyle.prototype,"stroke",2),__decorateClass([Property84],TreemapSeriesTileHighlightStyle.prototype,"strokeWidth",2),__decorateClass([Property84],TreemapSeriesTileHighlightStyle.prototype,"strokeOpacity",2),__decorateClass([Property84],TreemapSeriesTileHighlightStyle.prototype,"label",2),__decorateClass([Property84],TreemapSeriesTileHighlightStyle.prototype,"secondaryLabel",2);var TreemapSeriesHighlightStyle=class extends HighlightStyle2{constructor(){super(!1),this.group=new TreemapSeriesGroupHighlightStyle,this.tile=new TreemapSeriesTileHighlightStyle}getStyle(t){return t?this.tile:this.group}};__decorateClass([Property84],TreemapSeriesHighlightStyle.prototype,"group",2),__decorateClass([Property84],TreemapSeriesHighlightStyle.prototype,"tile",2);var TreemapSeriesProperties=class extends HierarchySeriesProperties2{constructor(){super(...arguments),this.highlightStyle=new TreemapSeriesHighlightStyle,this.tooltip=makeSeriesTooltip24(),this.group=new TreemapSeriesGroup,this.tile=new TreemapSeriesTile,this.undocumentedGroupFills=[],this.undocumentedGroupStrokes=[]}getStyle(t,e,i,o){const{fillOpacity:s,strokeWidth:a,strokeOpacity:r,fill:n=t?e[o%e.length]:e[Math.min(o,e.length)],stroke:l=t?i[o%e.length]:i[Math.min(o,i.length)]}=t?this.tile:this.group;return{fill:n,fillOpacity:s,stroke:l,strokeWidth:a,strokeOpacity:r,opacity:1}}};__decorateClass([Property84],TreemapSeriesProperties.prototype,"sizeName",2),__decorateClass([Property84],TreemapSeriesProperties.prototype,"labelKey",2),__decorateClass([Property84],TreemapSeriesProperties.prototype,"secondaryLabelKey",2),__decorateClass([Property84],TreemapSeriesProperties.prototype,"itemStyler",2),__decorateClass([Property84],TreemapSeriesProperties.prototype,"highlightStyle",2),__decorateClass([Property84],TreemapSeriesProperties.prototype,"tooltip",2),__decorateClass([Property84],TreemapSeriesProperties.prototype,"group",2),__decorateClass([Property84],TreemapSeriesProperties.prototype,"tile",2),__decorateClass([Property84],TreemapSeriesProperties.prototype,"undocumentedGroupFills",2),__decorateClass([Property84],TreemapSeriesProperties.prototype,"undocumentedGroupStrokes",2);var{createDatumId:createDatumId22,Rect:Rect9,Group:Group21,BBox:BBox28,Selection:Selection18,Text:Text10,Transformable:Transformable4,applyShapeStyle:applyShapeStyle20,getLabelStyles:getLabelStyles8,mergeDefaults:mergeDefaults22,formatValue:formatValue3}=import_ag_charts_community278._ModuleSupport,TreemapNode=class extends import_ag_charts_community278._ModuleSupport.HierarchyNode{constructor(){super(...arguments),this.labelValue=void 0,this.secondaryLabelValue=void 0,this.label=void 0,this.secondaryLabel=void 0,this.bbox=void 0,this.padding=void 0}};function nodeSize(t){return t.children.length>0?t.sumSize-t.sizeValue:t.sizeValue}var textAlignFactors2={left:0,center:.5,right:1},verticalAlignFactors4={top:0,middle:.5,bottom:1},DistantGroup=class extends import_ag_charts_community278._ModuleSupport.Group{distanceSquared(t,e){return this.getBBox().distanceSquared(t,e)}},TreemapSeries=class extends import_ag_charts_community278._ModuleSupport.HierarchySeries{constructor(){super(...arguments),this.NodeClass=TreemapNode,this.properties=new TreemapSeriesProperties,this.rectGroup=this.contentGroup.appendChild(new Group21),this.datumSelection=Selection18.select(this.rectGroup,Rect9),this.labelSelection=Selection18.select(this.labelGroup,Group21),this.highlightSelection=Selection18.select(this.rectGroup,Rect9)}groupTitleHeight(t,e){const{labelValue:i}=t,{label:o}=this.properties.group,s=3;if(i!=null){if(o.fontSize>e.width/s||o.fontSize>e.height/s)return;{const{height:a}=(0,import_ag_charts_core118.cachedTextMeasurer)(o).measureLines(i);return Math.max(a,o.fontSize)}}}getNodePadding(t,e){if(t.parent==null)return{top:0,right:0,bottom:0,left:0};if(t.children.length===0){const{padding:r}=this.properties.tile;return{top:r,right:r,bottom:r,left:r}}const{label:{spacing:i},padding:o}=this.properties.group,s=this.groupTitleHeight(t,e),a=s==null?0:s+i;return{top:o+a,right:o,bottom:o,left:o}}sortChildren({children:t}){const e=Array.from(t,(o,s)=>s).filter(o=>nodeSize(t[o])>0).sort((o,s)=>nodeSize(t[s])-nodeSize(t[o]));return{sortedChildrenIndices:e,childAt:o=>{const s=e[o];return t[s]}}}squarify(t,e){const{datum:i,children:o}=t;if(e.width<=0||e.height<=0){t.bbox=void 0,t.padding=void 0,t.midPoint.x=Number.NaN,t.midPoint.y=Number.NaN;return}const s=i==null?{top:0,right:0,bottom:0,left:0}:this.getNodePadding(t,e);t.parent==null?(t.bbox=void 0,t.padding=void 0,t.midPoint.x=Number.NaN,t.midPoint.y=Number.NaN):(t.bbox=e,t.padding=s,t.midPoint.x=e.x+e.width/2,t.midPoint.y=e.y);const{sortedChildrenIndices:a,childAt:r}=this.sortChildren(t),n=a.every(v=>o[v].children.length===0),l=1,c=e.width-s.left-s.right,h=e.height-s.top-s.bottom;if(c<=0||h<=0)return;const d=a.length;let u=0,p=0,g=1/0,y=a.reduce((v,M)=>v+nodeSize(o[M]),0);const f=new BBox28(e.x+s.left,e.y+s.top,c,h),x=f.clone();let b=0;for(;b({left:l.x,top:l.y,right:l.x+l.width,bottom:l.y+l.height}),a=s(t),r=s(e),n=["top","right","bottom","left"];for(const l of n)(0,import_ag_charts_core118.isNumberEqual)(a[l],r[l])||e.shrink(o,l)}createNodeData(){}getItemStyle(t,e,i){const{properties:o,colorScale:s}=this,{itemStyler:a}=o,r=t.datumIndex?.[0]??0,n=e?o.fills:o.undocumentedGroupFills,l=e?o.strokes:o.undocumentedGroupStrokes,c=e?r:t.depth??-1,h=i?o.highlightStyle.getStyle(e):void 0,d=mergeDefaults22(h,o.getStyle(e,n,l,c));!i&&e&&t.colorValue!=null&&(d.fill=s.convert(t.colorValue));let u=d;if(a!=null&&t!=null){const p=this.cachedDatumCallback(createDatumId22(this.getDatumId(t),i?"highlight":"node"),()=>{const g=this.makeItemStylerParams(t,i,u);return this.callWithContext(a,g)});p&&(u=mergeDefaults22(p,u))}return u}makeItemStylerParams(t,e,i){const{id:o}=this,s=this.ctx.highlightManager?.getActiveHighlight(),a=this.getHighlightStateString(s,e,t.datumIndex),r=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:o,datum:t.datum,depth:t.depth??-1,highlighted:e,highlightState:a,...i,fill:r}}updateSelections(){let t=this.ctx.highlightManager?.getActiveHighlight();if(t!=null&&!this.properties.group.interactive&&t.children.length!==0&&(t=void 0),this.highlightSelection.update(t==null?[]:[t],void 0,s=>this.getDatumId(s)),!this.nodeDataRefresh)return;this.nodeDataRefresh=!1;const{seriesRect:e}=this.chart??{};if(!e)return;const i=Array.from(this.rootNode),o=s=>{s.append([new Text10({tag:0}),new Text10({tag:1})])};this.datumSelection.update(i,void 0,s=>this.getDatumId(s)),this.labelSelection.update(i,o,s=>this.getDatumId(s))}updateNodes(){const{rootNode:t,data:e}=this,{childrenKey:i,colorKey:o,colorName:s,labelKey:a,secondaryLabelKey:r,sizeKey:n,sizeName:l,highlightStyle:c,tile:h,group:d}=this.properties,{seriesRect:u}=this.chart??{};if(!u||!e)return;this.rootNode?.walk(m=>{const{datum:S,depth:v,children:M}=m,D=M.length===0,k=D?h.label:d.label;let _;if(k.enabled&&S!=null&&v!=null&&a!=null){const w=S[a];_=this.getLabelText(w,S,a,"label",[],k,{depth:v,datum:S,childrenKey:i,colorKey:o,colorName:s,labelKey:a,secondaryLabelKey:r,sizeKey:n,sizeName:l,value:w})}_===""&&(_=void 0);let T;if(h.secondaryLabel.enabled&&D&&S!=null&&v!=null&&r!=null){const w=S[r];T=this.getLabelText(w,S,r,"secondaryLabel",[],h.secondaryLabel,{depth:v,datum:S,childrenKey:i,colorKey:o,colorName:s,labelKey:a,secondaryLabelKey:r,sizeKey:n,sizeName:l,value:w})}T===""&&(T=void 0),m.labelValue=(0,import_ag_charts_core118.toPlainText)(_),m.secondaryLabelValue=(0,import_ag_charts_core118.toPlainText)(T)});const{width:p,height:g}=u;this.squarify(t,new BBox28(0,0,p,g)),this.rootNode?.walk(m=>{const{bbox:S,children:v,labelValue:M,secondaryLabelValue:D}=m;if(m.label=void 0,m.secondaryLabel=void 0,S!=null)if(v.length===0){const k={width:S.width,height:S.height,meta:null},_=formatLabels(M,this.properties.tile.label,D,this.properties.tile.secondaryLabel,{padding:h.padding},()=>k);if(_==null)return;const{height:T,label:w,secondaryLabel:R}=_,{textAlign:F,verticalAlign:O,padding:E}=h,I=textAlignFactors2[F]??.5,C=S.x+E+(S.width-2*E)*I,L=verticalAlignFactors4[O]??.5,A=S.y+E+T*.5+(S.height-2*E-T)*L;if(w!=null){const{fontStyle:P="normal",fontFamily:z,fontWeight:B="normal",color:V="black"}=this.properties.tile.label;m.label={text:w.text,fontSize:w.fontSize,lineHeight:w.lineHeight,fontStyle:P,fontFamily:z,fontWeight:B,color:V,textAlign:F,verticalAlign:"middle",x:C,y:A-(T-w.height)*.5}}if(R!=null){const{fontStyle:P="normal",fontFamily:z,fontWeight:B="normal",color:V="black"}=this.properties.tile.secondaryLabel;m.secondaryLabel={text:R.text,fontSize:R.fontSize,lineHeight:R.fontSize,fontStyle:P,fontFamily:z,fontWeight:B,color:V,textAlign:F,verticalAlign:"middle",x:C,y:A+(T-R.height)*.5}}}else{if(M==null)return;{const{padding:k,textAlign:_}=d,T=this.groupTitleHeight(m,S);if(T==null)return;const w=S.width-2*k,R=(0,import_ag_charts_core118.wrapText)(M,{maxWidth:S.width-2*k,font:d.label,textWrap:"never"}),F=textAlignFactors2[_]??.5,{fontStyle:O="normal",fontFamily:E,fontWeight:I="normal",color:C="black"}=this.properties.group.label;m.label={text:R,fontSize:d.label.fontSize,lineHeight:(0,import_ag_charts_core118.calcLineHeight)(d.label.fontSize),fontStyle:O,fontFamily:E,fontWeight:I,color:C,textAlign:_,verticalAlign:"middle",x:S.x+k+w*F,y:S.y+k+T*.5}}}});const y={series:new BBox28(0,0,p,g),axis:new BBox28(0,0,p,g)},f=(m,S,v)=>{const{bbox:M}=m;if(M==null){S.visible=!1;return}const{depth:D=-1}=m,k=m.children.length===0,_=this.getItemStyle(m,k,v);S.crisp=!0,applyShapeStyle20(S,_,y),S.cornerRadius=k?h.cornerRadius:d.cornerRadius,S.zIndex=[0,D,v?1:0];const T=m.parent?.children.every(F=>F.children.length===0),w=m.parent==null?void 0:m.parent.bbox,R=m.parent==null?void 0:m.parent.padding;T===!0&&w!=null&&R!=null?(S.clipBBox=M,S.x=w.x+R.left,S.y=w.y+R.top,S.width=w.width-(R.left+R.right),S.height=w.height-(R.top+R.bottom)):(S.clipBBox=void 0,S.x=M.x,S.y=M.y,S.width=M.width,S.height=M.height),S.visible=!0};this.datumSelection.each((m,S)=>f(S,m,!1)),this.highlightSelection.each((m,S)=>{f(S,m,!0)});const x=(m,S,v,M)=>{const D=m.children.length===0,k=v===0?m.label:m.secondaryLabel;if(k==null){S.visible=!1;return}const _=v===0?h.label:h.secondaryLabel;let T;if(M){const{tile:O,group:E}=c;T=O.secondaryLabel.color,D?v===0&&(T=O.label.color):T=E.label.color}const w={childrenKey:this.properties.childrenKey,colorKey:this.properties.colorKey,colorName:this.properties.colorName??this.properties.colorKey,depth:m.depth??Number.NaN,labelKey:this.properties.labelKey,secondaryLabelKey:this.properties.secondaryLabelKey,sizeKey:this.properties.sizeKey,sizeName:this.properties.sizeName??this.properties.sizeKey},R=this.ctx.highlightManager?.getActiveHighlight(),F=getLabelStyles8(this,m,w,_,M,R);S.text=k.text,S.fontSize=k.fontSize,S.lineHeight=k.lineHeight,S.fontStyle=k.fontStyle,S.fontFamily=k.fontFamily,S.fontWeight=k.fontWeight,S.fill=T??k.color,S.fillOpacity=this.getHighlightStyle(M,m.datumIndex)?.opacity??1,S.textAlign=k.textAlign,S.textBaseline=k.verticalAlign,S.x=k.x,S.y=k.y,S.setBoxing(F),S.visible=!0,S.zIndex=1},b=this.ctx.highlightManager?.getActiveHighlight();for(const m of this.labelSelection.selectByClass(Text10)){const S=m.closestDatum();x(S,m,m.tag,S===b)}}pickNodesExactShape(t){const e=super.pickNodesExactShape(t);return e.sort((i,o)=>o.datumIndex.length-i.datumIndex.length),e}pickNodeClosestDatum(t){const e=this.pickNodesExactShape(t);return e.length!==0?{datum:e[0],distance:0}:this.pickNodeNearestDistantObject(t,this.datumSelection.nodes())}getTooltipContent(t){const{id:e,properties:i,ctx:o}=this,{formatManager:s}=o,{labelKey:a,secondaryLabelKey:r,childrenKey:n,sizeKey:l,sizeName:c,colorKey:h,colorName:d,tooltip:u}=i,p=t.reduce((_,T)=>_?.children[T],this.rootNode);if(p==null)return;const{datum:g,depth:y,children:f}=p;if(g==null||y==null)return;const x=f.length===0,b=[],m=l==null?void 0:g[l];if(m!=null){const _=[0,this.rootNode?.sumSize??0],T=s.format(this.callWithContext.bind(this),{type:"number",value:m,datum:g,seriesId:e,legendItemName:void 0,key:l,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:_,fractionDigits:void 0});b.push({label:c,fallbackLabel:l,value:T??formatValue3(m)})}const S=h==null?void 0:g[h];if(S!=null){const{colorDomain:_}=this,T=s.format(this.callWithContext.bind(this),{type:"number",value:S,datum:g,seriesId:e,legendItemName:void 0,key:h,source:"tooltip",property:"color",boundSeries:this.getFormatterContext("color"),domain:_,fractionDigits:void 0});b.push({label:d,fallbackLabel:h,value:T??formatValue3(S)})}const v=this.getItemStyle({...p,colorValue:S??p.colorValue},x,!1),D={shape:"square",fill:v.fill,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0};import_ag_charts_community278._ModuleSupport.isGradientFill(D.fill)&&(D.fill={...D.fill,gradient:"linear",rotation:0,reverse:!1});const k=x?{marker:D}:void 0;return this.formatTooltipWithContext(u,{title:a==null?void 0:g[a],symbol:k,data:b},{seriesId:e,datum:g,title:void 0,depth:y,labelKey:a,secondaryLabelKey:r,childrenKey:n,sizeKey:l,sizeName:c,colorKey:h,colorName:d,...v})}computeFocusBounds(t){return Transformable4.toCanvas(this.contentGroup,t.getBBox())}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.tile.label.itemStyler!=null||this.properties.group.label.itemStyler!=null}};TreemapSeries.className="TreemapSeries",TreemapSeries.type="treemap";var import_ag_charts_community279=require("ag-charts-community"),import_ag_charts_core119=require("ag-charts-core"),{commonSeriesOptionsDefs:commonSeriesOptionsDefs23,treemapSeriesThemeableOptionsDef,without:without9}=import_ag_charts_community279._ModuleSupport,treemapSeriesOptionsDef={...treemapSeriesThemeableOptionsDef,...without9(commonSeriesOptionsDefs23,["highlightStyle","highlight","showInLegend"]),type:(0,import_ag_charts_core119.required)((0,import_ag_charts_core119.constant)("treemap")),labelKey:import_ag_charts_core119.string,secondaryLabelKey:import_ag_charts_core119.string,childrenKey:import_ag_charts_core119.string,sizeKey:import_ag_charts_core119.string,colorKey:import_ag_charts_core119.string,sizeName:import_ag_charts_core119.string,colorName:import_ag_charts_core119.string};treemapSeriesOptionsDef.undocumentedGroupFills=(0,import_ag_charts_core119.undocumented)((0,import_ag_charts_core119.arrayOf)(import_ag_charts_core119.color)),treemapSeriesOptionsDef.undocumentedGroupStrokes=(0,import_ag_charts_core119.undocumented)((0,import_ag_charts_core119.arrayOf)(import_ag_charts_core119.color));var{FONT_SIZE_RATIO:FONT_SIZE_RATIO4}=import_ag_charts_community280._ModuleSupport,TreemapModule={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"treemap",moduleFactory:t=>new TreemapSeries(t),solo:!0,themeTemplate:{series:{fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",import_ag_charts_community280._ModuleSupport.FILL_GRADIENT_LINEAR_DEFAULTS],["pattern",import_ag_charts_community280._ModuleSupport.FILL_PATTERN_DEFAULTS],["image",import_ag_charts_community280._ModuleSupport.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"strokes"}]},colorRange:{$palette:"divergingColors"},undocumentedGroupFills:{$palette:"hierarchyColors"},undocumentedGroupStrokes:{$palette:"secondHierarchyColors"},group:{label:{...import_ag_charts_community280._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"textColor"},fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},spacing:4},fill:void 0,stroke:void 0,strokeWidth:1,padding:4,gap:2,textAlign:"left"},tile:{label:{...import_ag_charts_community280._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"chartBackgroundColor"},fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:1.5},minimumFontSize:{$rem:FONT_SIZE_RATIO4.SMALLER},fontFamily:{$ref:"fontFamily"},wrapping:"on-space",overflowStrategy:"ellipsis",spacing:2},secondaryLabel:{...import_ag_charts_community280._ModuleSupport.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"chartBackgroundColor"},fontStyle:void 0,fontWeight:void 0,fontSize:{$ref:"fontSize"},minimumFontSize:{$rem:FONT_SIZE_RATIO4.SMALLER},fontFamily:{$ref:"fontFamily"},wrapping:"never",overflowStrategy:"ellipsis"},fill:void 0,stroke:void 0,strokeWidth:{$isUserOption:["../strokes/0",2,{$isUserOption:["./stroke",2,0]}]},padding:3,gap:1},highlightStyle:{group:{label:{color:{$ref:"textColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2},tile:{label:{color:{$ref:"chartBackgroundColor"}},secondaryLabel:{color:{$ref:"chartBackgroundColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2}}},gradientLegend:{enabled:!0,...import_ag_charts_community280._ModuleSupport.LEGEND_CONTAINER_THEME}}},TreemapSeriesModule={type:"series",name:"treemap",chartType:"standalone",enterprise:!0,options:treemapSeriesOptionsDef,create:t=>new TreemapSeries(t)},ModuleRegistry=import_ag_charts_community281._ModuleSupport.ModuleRegistry,AllCartesianEnterpriseModules=[OrdinalTimeAxisModule2,BoxPlotSeriesModule,CandlestickSeriesModule,ConeFunnelSeriesModule,FunnelSeriesModule,HeatmapSeriesModule,OhlcSeriesModule,RangeAreaSeriesModule,RangeBarSeriesModule,WaterfallSeriesModule],AllPolarEnterpriseModules=[AngleNumberAxisModule2,AngleCategoryAxisModule2,RadiusNumberAxisModule2,RadiusCategoryAxisModule2,NightingaleSeriesModule,RadarAreaSeriesModule,RadarLineSeriesModule,RadialBarSeriesModule,RadialColumnSeriesModule],AllStandaloneEnterpriseModules=[StandaloneChartModule,PyramidSeriesModule,LinearGaugeSeriesModule,RadialGaugeSeriesModule,SunburstSeriesModule,TreemapSeriesModule,ChordSeriesModule,SankeySeriesModule],AllTopologyEnterpriseModules=[TopologyChartModule,MapLineSeriesModule,MapLineBackgroundSeriesModule,MapMarkerSeriesModule,MapShapeSeriesModule,MapShapeBackgroundSeriesModule],AllEnterpriseModules=[...AllCartesianEnterpriseModules,...AllPolarEnterpriseModules,...AllStandaloneEnterpriseModules,...AllTopologyEnterpriseModules,AnnotationsModule2,NavigatorModule2,InitialStateModule],styles_default=`.ag-watermark{position:absolute;bottom:20px;right:25px;font-weight:700;font-family:Impact,sans-serif;font-size:19px;opacity:.7;animation:1s ease-out 3s ag-watermark-fadeout;color:#9b9b9b;pointer-events:none;&:before{content:"";display:block;height:40px;width:170px;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU4IiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgMjU4IDQwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjUuNzc5IDI4LjY1N0gxMy4zNTlMMTEuMTczIDM0LjAxMkg1LjY3Mjk3TDE3LjE4MiA3LjA1OTk5SDIxLjk1M0wzMy40NjIgMzQuMDEySDI3Ljk2MkwyNS43NzYgMjguNjU3SDI1Ljc3OVpNMjQuMDY4IDI0LjM5N0wxOS41ODggMTMuNDM0TDE1LjEwNyAyNC4zOTdIMjQuMDY4Wk02Mi4wOTIgMTguODIzSDQ5LjgxN1YyMy4wODZINTYuNzc1QzU2LjU1NSAyNS4yMjIgNTUuNzU1IDI2LjkyNyA1NC4zNzIgMjguMjAyQzUyLjk4OSAyOS40NzYgNTEuMTY2IDMwLjExNSA0OC45MDkgMzAuMTE1QzQ3LjYyMiAzMC4xMTUgNDYuNDUgMjkuODg1IDQ1LjM5MyAyOS40MjNDNDQuMzU4MyAyOC45NzgxIDQzLjQzMjYgMjguMzEzOCA0Mi42OCAyNy40NzZDNDEuOTI3IDI2LjYzOSA0MS4zNDQgMjUuNjMxIDQwLjkzMSAyNC40NTNDNDAuNTE5IDIzLjI3NSA0MC4zMTEgMjEuOTcgNDAuMzExIDIwLjUzN0M0MC4zMTEgMTkuMTA1IDQwLjUxNiAxNy44IDQwLjkzMSAxNi42MjFDNDEuMzQ0IDE1LjQ0MyA0MS45MjcgMTQuNDM2IDQyLjY4IDEzLjU5OEM0My40Mzc2IDEyLjc1NzcgNDQuMzY5NiAxMi4wOTMyIDQ1LjQxMSAxMS42NTFDNDYuNDc4IDExLjE4OSA0Ny42NTYgMTAuOTYgNDguOTQ2IDEwLjk2QzUxLjYxMiAxMC45NiA1My42MzcgMTEuNjAyIDU1LjAyIDEyLjg4NUw1OC4zIDkuNjA0OTlDNTUuODE3IDcuNjY5OTkgNTIuNjc2IDYuNjk5OTkgNDguODcyIDYuNjk5OTlDNDYuNzYgNi42OTk5OSA0NC44NTMgNy4wMzQ5OSA0My4xNTQgNy43MDA5OUM0MS40NTUgOC4zNjc5OSAzOS45OTggOS4zMDM5OSAzOC43ODMgMTAuNTA0QzM3LjU2NyAxMS43MDcgMzYuNjM0IDEzLjE1OCAzNS45NzcgMTQuODU3QzM1LjMxOSAxNi41NTYgMzQuOTk0IDE4LjQ1MSAzNC45OTQgMjAuNTRDMzQuOTk0IDIyLjYzIDM1LjMyOSAyNC40OTQgMzUuOTk1IDI2LjIwNUMzNi42NjIgMjcuOTE2IDM3LjYwNSAyOS4zNzQgMzguODE3IDMwLjU3N0M0MC4wMzIgMzEuNzggNDEuNDg2IDMyLjcxMyA0My4xODggMzMuMzgzQzQ0Ljg4OCAzNC4wNDkgNDYuNzgyIDM0LjM4NCA0OC44NzIgMzQuMzg0QzUwLjk2MSAzNC4zODQgNTIuNzUgMzQuMDQ5IDU0LjM5IDMzLjM4M0M1Ni4wMzEgMzIuNzE2IDU3LjQyNiAzMS43OCA1OC41NzkgMzAuNTc3QzU5LjczMyAyOS4zNzQgNjAuNjE5IDI3LjkxNiA2MS4yMzkgMjYuMjA1QzYxLjg2IDI0LjQ5NCA2Mi4xNyAyMi42MDUgNjIuMTcgMjAuNTRDNjIuMTY5NiAxOS45Njg4IDYyLjE0NDUgMTkuMzk4IDYyLjA5NSAxOC44MjlMNjIuMDkyIDE4LjgyM1pNMTUxLjgxIDE2Ljk4MUMxNTMuNDEgMTQuNjA5IDE1Ny40MTkgMTQuMzU4IDE1OS4wMjIgMTQuMzU4VjE4LjkxQzE1Ni45NTcgMTguOTEgMTU0Ljk4NSAxOC45OTYgMTUzLjc1NyAxOS44OTJDMTUyLjUyOSAyMC43OTIgMTUxLjkxOSAyMS45ODIgMTUxLjkxOSAyMy40NjRWMzMuOTlIMTQ2Ljk2NFYxNC4zNThIMTUxLjczNkwxNTEuODEgMTYuOTgxWk0xNDMuMDExIDE0LjM2MVYzNC4wMzFIMTM4LjI0TDEzOC4xMzEgMzEuMDQ1QzEzNy40NjYgMzIuMDc2IDEzNi41NTEgMzIuOTIxOSAxMzUuNDcxIDMzLjUwNEMxMzQuMzc2IDM0LjA5OSAxMzMuMDY4IDM0LjM5NiAxMzEuNTM2IDM0LjM5NkMxMzAuMiAzNC4zOTYgMTI4Ljk2MyAzNC4xNTIgMTI3LjgyMiAzMy42NjhDMTI2LjcgMzMuMTk2NCAxMjUuNjg5IDMyLjQ5NSAxMjQuODU1IDMxLjYwOUMxMjQuMDE4IDMwLjcyMiAxMjMuMzU0IDI5LjY2MiAxMjIuODcxIDI4LjQyMkMxMjIuMzg0IDI3LjE4NSAxMjIuMTQyIDI1LjgxMSAxMjIuMTQyIDI0LjMwNEMxMjIuMTQyIDIyLjc5OCAxMjIuMzg0IDIxLjM3OCAxMjIuODcxIDIwLjExNkMxMjMuMzU3IDE4Ljg1NCAxMjQuMDE4IDE3Ljc3MiAxMjQuODU1IDE2Ljg3M0MxMjUuNjg4IDE1Ljk3NjQgMTI2LjY5OCAxNS4yNjM2IDEyNy44MjIgMTQuNzhDMTI4Ljk2MyAxNC4yODEgMTMwLjIwMyAxNC4wMzMgMTMxLjUzNiAxNC4wMzNDMTMzLjA0MyAxNC4wMzMgMTM0LjMzIDE0LjMxOCAxMzUuMzk3IDE0Ljg4OEMxMzYuNDYyIDE1LjQ1ODkgMTM3LjM3NSAxNi4yNzggMTM4LjA1NyAxNy4yNzZWMTQuMzYxSDE0My4wMTFaTTEzMi42MzEgMzAuMTMzQzEzNC4yNTYgMzAuMTMzIDEzNS41NjcgMjkuNTk0IDEzNi41NjUgMjguNTEyQzEzNy41NjEgMjcuNDMgMTM4LjA2IDI1Ljk5MSAxMzguMDYgMjQuMTk2QzEzOC4wNiAyMi40MDEgMTM3LjU2MSAyMC45OSAxMzYuNTY1IDE5Ljg5OUMxMzUuNTcgMTguODA3IDEzNC4yNTkgMTguMjU4IDEzMi42MzEgMTguMjU4QzEzMS4wMDMgMTguMjU4IDEyOS43MjkgMTguODA0IDEyOC43MzQgMTkuODk5QzEyNy43MzggMjAuOTkzIDEyNy4yMzkgMjIuNDM4IDEyNy4yMzkgMjQuMjMzQzEyNy4yMzkgMjYuMDI4IDEyNy43MzUgMjcuNDMzIDEyOC43MzQgMjguNTE1QzEyOS43MjkgMjkuNTk0IDEzMS4wMjggMzAuMTM2IDEzMi42MzEgMzAuMTM2VjMwLjEzM1pNOTMuNjk4IDI3Ljg3NkM5My41Nzk1IDI4LjAwMjUgOTMuNDU2NCAyOC4xMjQ2IDkzLjMyOSAyOC4yNDJDOTEuOTQ3IDI5LjUxNiA5MC4xMjMgMzAuMTU1IDg3Ljg2NiAzMC4xNTVDODYuNTggMzAuMTU1IDg1LjQwOCAyOS45MjYgODQuMzUgMjkuNDY0QzgzLjMxNTUgMjkuMDE4OSA4Mi4zODk4IDI4LjM1NDYgODEuNjM3IDI3LjUxN0M4MC44ODQgMjYuNjc5IDgwLjMwMSAyNS42NzIgNzkuODg5IDI0LjQ5NEM3OS40NzYgMjMuMzE1IDc5LjI2OSAyMi4wMSA3OS4yNjkgMjAuNTc4Qzc5LjI2OSAxOS4xNDUgNzkuNDczIDE3Ljg0IDc5Ljg4OSAxNi42NjJDODAuMzAxIDE1LjQ4NCA4MC44ODQgMTQuNDc2IDgxLjYzNyAxMy42MzlDODIuMzk0OSAxMi43OTg3IDgzLjMyNzMgMTIuMTM0MiA4NC4zNjkgMTEuNjkyQzg1LjQzNiAxMS4yMyA4Ni42MTQgMTEgODcuOTAzIDExQzkwLjU3IDExIDkyLjU5NSAxMS42NDIgOTMuOTc3IDEyLjkyNkw5Ny4yNTggOS42NDQ5OUM5NC43NzQgNy43MTA5OSA5MS42MzMgNi43Mzk5OSA4Ny44MjkgNi43Mzk5OUM4NS43MTggNi43Mzk5OSA4My44MTEgNy4wNzQ5OSA4Mi4xMTIgNy43NDE5OUM4MC40MTMgOC40MDc5OSA3OC45NTYgOS4zNDQ5OSA3Ny43NCAxMC41NDVDNzYuNTI1IDExLjc0NyA3NS41OTIgMTMuMTk5IDc0LjkzNCAxNC44OThDNzQuMjc3IDE2LjU5NyA3My45NTEgMTguNDkxIDczLjk1MSAyMC41ODFDNzMuOTUxIDIyLjY3IDc0LjI4NiAyNC41MzQgNzQuOTUzIDI2LjI0NUM3NS42MTkgMjcuOTU3IDc2LjU2MiAyOS40MTQgNzcuNzc0IDMwLjYxN0M3OC45OSAzMS44MiA4MC40NDQgMzIuNzUzIDgyLjE0NiAzMy40MjNDODMuODQ1IDM0LjA5IDg1LjczOSAzNC40MjQgODcuODI5IDM0LjQyNEM4OS45MTkgMzQuNDI0IDkxLjcwOCAzNC4wOSA5My4zNDggMzMuNDIzQzk0LjcxOCAzMi44NjUgOTUuOTE4IDMyLjEyMSA5Ni45NDggMzEuMTkxQzk3LjE0OSAzMS4wMDggOTcuMzQ4IDMwLjgxNSA5Ny41MzcgMzAuNjJMOTMuNzAxIDI3Ljg4NUw5My42OTggMjcuODc2Wk0xMTAuODAyIDE0LjAxNUMxMDkuMTk5IDE0LjAxNSAxMDYuODM2IDE0LjQ3MSAxMDUuNjExIDE2LjE1OEwxMDUuNTM3IDYuMDE1OTlIMTAwLjc2NVYzMy45MzlIMTA1LjcyVjIyLjY0MUMxMDUuNzcxIDIxLjQ2MDcgMTA2LjI4OCAyMC4zNDg4IDEwNy4xNTcgMTkuNTQ4OUMxMDguMDI3IDE4Ljc0OTEgMTA5LjE3OCAxOC4zMjY2IDExMC4zNTggMTguMzc0QzExMy4zOTcgMTguMzc0IDExNC4yNjggMjEuMTU5IDExNC4yNjggMjIuNjQxVjMzLjkzOUgxMTkuMjIzVjIxLjA1OUMxMTkuMjIzIDIxLjA1OSAxMTkuMTQyIDE0LjAxNSAxMTAuODAyIDE0LjAxNVpNMTczLjc2MyAxNC4zNThIMTY5Ljk5OVY4LjcxNDk5SDE2NS4wNDhWMTQuMzU4SDE2MS4yODRWMTguOTE2SDE2NS4wNDhWMzQuMDAzSDE2OS45OTlWMTguOTE2SDE3My43NjNWMTQuMzU4Wk0xOTAuNzg3IDI1LjI2MkMxOTAuMTI5IDI0LjUwMTQgMTg5LjMwNyAyMy44OTk0IDE4OC4zODQgMjMuNTAxQzE4Ny40ODggMjMuMTE3IDE4Ni4zMzEgMjIuNzMyIDE4NC45NDggMjIuMzY0QzE4NC4xNjUgMjIuMTQzOSAxODMuMzkgMjEuODk3OCAxODIuNjIzIDIxLjYyNkMxODIuMTYzIDIxLjQ2MjEgMTgxLjc0MSAyMS4yMDY2IDE4MS4zODMgMjAuODc1QzE4MS4yMzUgMjAuNzQyMSAxODEuMTE4IDIwLjU3ODkgMTgxLjAzOSAyMC4zOTY0QzE4MC45NjEgMjAuMjE0IDE4MC45MjIgMjAuMDE2NiAxODAuOTI3IDE5LjgxOEMxODAuOTI3IDE5LjI3MiAxODEuMTU2IDE4Ljg0NCAxODEuNjI1IDE4LjUxQzE4Mi4xMjEgMTguMTU2IDE4Mi44NjIgMTcuOTc2IDE4My44MjYgMTcuOTc2QzE4NC43OSAxNy45NzYgMTg1LjU4NyAxOC4yMDkgMTg2LjE0OCAxOC42NjhDMTg2LjcwNiAxOS4xMjQgMTg3LjAwNyAxOS43MjUgMTg3LjA3MiAyMC41TDE4Ny4wOTQgMjAuNzgySDE5MS42MzNMMTkxLjYxNyAyMC40NkMxOTEuNTIxIDE4LjQ4NSAxOTAuNzcxIDE2LjkgMTg5LjM4NSAxNS43NUMxODguMDEyIDE0LjYxMiAxODYuMTg1IDE0LjAzMyAxODMuOTYyIDE0LjAzM0MxODIuNDc3IDE0LjAzMyAxODEuMTQxIDE0LjI4NyAxNzkuOTk0IDE0Ljc4NkMxNzguODMxIDE1LjI5MSAxNzcuOTI2IDE1Ljk5NSAxNzcuMjk2IDE2Ljg4MkMxNzYuNjczIDE3Ljc0NTUgMTc2LjMzOCAxOC43ODQgMTc2LjM0MSAxOS44NDlDMTc2LjM0MSAyMS4xNjcgMTc2LjY5OCAyMi4yNDkgMTc3LjM5OSAyMy4wNjRDMTc4LjA2IDIzLjg0MzIgMTc4Ljg5OCAyNC40NTM0IDE3OS44NDIgMjQuODQ0QzE4MC43NDQgMjUuMjE2IDE4MS45MjggMjUuNjA3IDE4My4zNjEgMjZDMTg0LjgwNiAyNi40MSAxODUuODcyIDI2Ljc4NSAxODYuNTMgMjcuMTIzQzE4Ny4xIDI3LjQxNCAxODcuMzc5IDI3Ljg0NSAxODcuMzc5IDI4LjQ0NEMxODcuMzc5IDI5LjA0MiAxODcuMTIyIDI5LjQ2NyAxODYuNTk1IDI5LjgzOUMxODYuMDQzIDMwLjIyNiAxODUuMjM3IDMwLjQyNSAxODQuMjAxIDMwLjQyNUMxODMuMTY2IDMwLjQyNSAxODIuMzk0IDMwLjE3NCAxODEuNzQ5IDI5LjY3NEMxODEuMTEzIDI5LjE4MSAxODAuNzcyIDI4LjU4OSAxODAuNzEgMjcuODY0TDE4MC42ODUgMjcuNTgySDE3Ni4wMTNMMTc2LjAyNSAyNy45MDFDMTc2LjA2NyAyOS4wOTU1IDE3Ni40NzIgMzAuMjQ4NyAxNzcuMTg4IDMxLjIwNkMxNzcuOTA3IDMyLjE4IDE3OC44OTMgMzIuOTU4IDE4MC4xMTggMzMuNTE5QzE4MS4zMzYgMzQuMDc3IDE4Mi43MzIgMzQuMzYyIDE4NC4yNjYgMzQuMzYyQzE4NS44MDEgMzQuMzYyIDE4Ny4xMDkgMzQuMTA4IDE4OC4yMzggMzMuNjA5QzE4OS4zNzYgMzMuMTA0IDE5MC4yNzIgMzIuMzk0IDE5MC45MDEgMzEuNDk0QzE5MS41MzQgMzAuNTkyIDE5MS44NTMgMjkuNTU0IDE5MS44NTMgMjguNDAzQzE5MS44MjggMjcuMTEgMTkxLjQ2NiAyNi4wNTMgMTkwLjc3NyAyNS4yNjJIMTkwLjc4N1oiIGZpbGw9IiM5QjlCOUIiLz4KPHBhdGggZD0iTTI0MS45ODIgMjUuNjU4MlYxNy43MTE3SDIyOC40NDFMMjIwLjQ5NCAyNS42NTgySDI0MS45ODJaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNTcuMjM5IDUuOTUwODFIMjQwLjI2NUwyMzIuMjU1IDEzLjg5NzNIMjU3LjIzOVY1Ljk1MDgxWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjEyLjYxMSAzMy42MDQ4TDIxNi42OCAyOS41MzYxSDIzMC40MTJWMzcuNDgyN0gyMTIuNjExVjMzLjYwNDhaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yMTUuNTk5IDIxLjc4MDNIMjI0LjM3MkwyMzIuMzgyIDEzLjgzMzdIMjE1LjU5OVYyMS43ODAzWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjA2IDMzLjYwNDdIMjEyLjYxMUwyMjAuNDk0IDI1LjY1ODJIMjA2VjMzLjYwNDdaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNDAuMjY1IDUuOTUwODFMMjM2LjE5NyAxMC4wMTk0SDIxMC4yNTlWMi4wNzI4OEgyNDAuMjY1VjUuOTUwODFaIiBmaWxsPSIjOUI5QjlCIi8+Cjwvc3ZnPgo=);background-repeat:no-repeat;background-size:170px 40px}>span{padding-left:.7rem}}@keyframes ag-watermark-fadeout{0%{opacity:.5}to{opacity:0}}.ag-charts-dialog{display:flex;flex-direction:column;font-size:var(--ag-charts-chrome-font-size-large)}.ag-charts-dialog__tabs{display:flex;flex-direction:column}.ag-charts-dialog__header{border-bottom:1px solid var(--ag-charts-border-color);display:flex}.ag-charts-dialog__tab-list{display:flex;gap:calc(var(--ag-charts-spacing) * 2)}.ag-charts-dialog__drag-handle{align-items:center;color:inherit;cursor:grab;display:flex;padding:1px 6px;text-align:center}.ag-charts-dialog__drag-handle--dragging{cursor:grabbing}.ag-charts-dialog__tab-button{background:none;border:0;border-bottom:2px solid transparent;border-radius:0;color:var(--ag-charts-panel-subtle-text-color);margin-bottom:-1px;padding:var(--input-padding) calc(var(--input-padding) / 2)}.ag-charts-dialog__tab-button:hover{background:none}.ag-charts-dialog__tab-button--active{border-color:var(--ag-charts-accent-color);color:inherit}.ag-charts-dialog__drag-handle+.ag-charts-dialog__tab-button{margin-left:calc(var(--ag-charts-spacing) * -2)}.ag-charts-button.ag-charts-dialog__close-button{background:none;border:0;margin-left:auto;padding:1px 6px}.ag-charts-dialog__close-button:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-dialog__tab-panel{display:none;flex-direction:column;gap:calc(var(--ag-charts-spacing) * 4);margin:0 calc(var(--ag-charts-spacing) * 4);padding:calc(var(--ag-charts-spacing) * 4) 0}.ag-charts-dialog__tab-panel--active{display:flex}.ag-charts-dialog__input-group-line{display:flex;gap:16px 18px;flex-wrap:wrap}.ag-charts-dialog__input-group{align-items:center;display:flex;font-size:var(--ag-charts-chrome-font-size)}.ag-charts-dialog__input-group-label{color:var(--ag-charts-panel-subtle-text-color);margin-right:5px}.ag-charts-dialog__input-group-label[for]{cursor:pointer}.ag-charts-dialog__button{border-radius:0;margin-right:-1px}.ag-charts-dialog__button.ag-charts-dialog__button--active{background:var(--ag-charts-button-focus-background-color);border-color:var(--ag-charts-input-focus-border-color);color:var(--ag-charts-input-focus-text-color);z-index:var(--input-layer-active)}.ag-charts-dialog__button:first-child,.ag-charts-dialog__input-group-label+.ag-charts-dialog__button{border-bottom-left-radius:var(--ag-charts-input-border-radius);border-top-left-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__button:last-child{border-bottom-right-radius:var(--ag-charts-input-border-radius);border-top-right-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__color-picker-button{--color: #000;background:var(--color);border:none;color:transparent;height:26px;width:26px}.ag-charts-dialog__color-picker-button:hover{background:var(--color)}.ag-charts-dialog__color-picker-button--multi-color,.ag-charts-dialog__color-picker-button--multi-color:hover{background:linear-gradient(135deg,red 0%,#ff0 calc(100% * 1 / 6),#0f0 calc(100% * 2 / 6),#0ff 50%,#00f calc(100% * 4 / 6),#f0f calc(100% * 5 / 6),red 100%)}.ag-charts-color-picker{width:190px;padding:8px;cursor:default;--h: 0;--s: 0;--v: 0;--a: 0;--color: #000;--color-a: #000;--thumb-size: 18px;--inner-width: 172px;--track-height: 12px;--palette-height: 136px;--checker: url('data:image/svg+xml;utf8,');--multi-color: linear-gradient( 135deg, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-color-picker__content{display:flex;flex-direction:column}.ag-charts-color-picker__palette{position:relative;width:100%;height:var(--palette-height);margin-bottom:8px;background:linear-gradient(to bottom,#0000,#000),linear-gradient(to right,#fff,#fff0) hsl(var(--h),100%,50%);border-radius:calc(var(--ag-charts-border-radius) * 1.5);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__palette:after{content:"";position:absolute;display:block;top:calc(var(--thumb-size) * -.5 + (1 - var(--v)) * 100%);left:calc(var(--thumb-size) * -.5 + var(--s) * 100%);background:var(--color);width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__palette:focus-visible:after{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),0 0 0 2px #fff8,var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-row{display:flex;gap:8px;align-items:center;margin-bottom:4px;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input,.ag-charts-color-picker__alpha-input{-webkit-appearance:none;display:block;position:relative;padding:0;margin:0 calc(var(--inset) * -1);border:0;height:var(--thumb-size);width:auto;background:transparent;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input::-moz-range-thumb,.ag-charts-color-picker__alpha-input::-moz-range-thumb{appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__hue-input::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{-webkit-appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038;transform:translateZ(0)}.ag-charts-color-picker__hue-input::-moz-range-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__hue-input::-webkit-slider-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__alpha-input::-moz-range-thumb{background:transparent}.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{background:transparent}.ag-charts-color-picker__alpha-input--opaque::-moz-range-thumb{background:var(--color)}.ag-charts-color-picker__alpha-input--opaque::-webkit-slider-thumb{background:var(--color)}.ag-charts-color-picker__hue-input:focus-visible::-moz-range-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-moz-range-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input:focus-visible::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-webkit-slider-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input::-moz-range-track,.ag-charts-color-picker__alpha-input::-moz-range-track{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__hue-input:before,.ag-charts-color-picker__alpha-input:before{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button{width:36px;margin-left:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);border:0;background:var(--multi-color);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button--hidden{display:none}.ag-charts-color-picker__multi-color-button--active{box-shadow:inset 0 0 0 1px #0003;outline-offset:1px;outline:2px solid #2196f3}.ag-charts-color-picker__hue-input{flex:1 0 0}.ag-charts-color-picker__hue-input::-moz-range-track{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__hue-input:before{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__alpha-input{margin-bottom:7px}.ag-charts-color-picker__alpha-input::-moz-range-track{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__alpha-input:before{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__color-field{display:flex;border:var(--ag-charts-border);background:var(--ag-charts-background-color);border-radius:var(--ag-charts-border-radius);overflow:hidden}.ag-charts-color-picker__color-field:has(:focus-visible){border-color:var(--ag-charts-accent-color);box-shadow:var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-label{width:16px;height:16px;margin:7px 0 7px 7px;color:transparent;background:linear-gradient(to right,var(--color-a),var(--color-a)),var(--checker) top left / 4px 4px;border-radius:calc(var(--ag-charts-border-radius) / 2);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__color-label--multi-color{background:var(--multi-color)}.ag-charts-color-picker__color-input{flex:1;min-width:0;padding:7px 7px 7px 8px;border:0;margin:0;color:inherit;background:transparent;font-variant:tabular-nums}.ag-charts-color-picker__color-input:focus-visible{border:none;outline:none}.ag-charts-annotations__line-stroke-width-menu,.ag-charts-annotations__line-style-type-menu,.ag-charts-annotations__text-size-menu{border-top-left-radius:0;border-top-right-radius:0;.ag-charts-menu__row:first-child{border-radius:0}}.ag-charts-annotations__text-size-menu{--item-padding: 4px 8px;min-width:34px;text-align:center}.ag-charts-annotations__line-stroke-width-menu{--item-padding: 6px;column-gap:6px}.ag-charts-annotations__line-style-type-menu{--item-padding: 6px;column-gap:0}.ag-charts-annotations__stroke-width-button:before{background:var(--ag-charts-foreground-color);content:"";margin-right:var(--toolbar-button-padding);height:min(var(--stroke-width),20px);width:12px}.ag-charts-annotations__stroke-width-button[aria-disabled=true]:before{filter:grayscale(1);opacity:.5}.ag-charts-annotations__color-picker-button{--emblem: var(--color)}.ag-charts-annotations__color-picker-button--multi-color{--emblem: linear-gradient( to right, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-annotations__color-picker-button:after{content:"";display:block;position:absolute;bottom:3px;left:5px;right:5px;height:4px;border-radius:99px;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ag-charts-foreground-color) 10%,transparent);background:var(--emblem)}.ag-charts-annotations__color-picker-button[aria-disabled=true]:after{filter:grayscale(1);opacity:.5}.ag-charts-annotations__toolbar-menu{min-width:200px}.ag-charts-annotations__axis-button--hidden{display:none}.ag-charts-annotations__axis-button{background-color:var(--ag-charts-crosshair-label-background-color);border-radius:calc(var(--ag-charts-border-radius) / 2);border:none;box-sizing:border-box;color:var(--ag-charts-crosshair-label-text-color);cursor:pointer;font-family:var(--ag-charts-button-font-family);font-size:var(--ag-charts-button-font-size);font-weight:var(--ag-charts-button-font-weight);left:0;line-height:16px;overflow:hidden;padding:0;position:absolute;top:0;user-select:none;white-space:nowrap;z-index:var(--ag-charts-layer-annotations)}.ag-charts-annotations__axis-button:hover{opacity:.8;color:var(--ag-charts-background-color)}.ag-charts-dialog--annotation-settings{min-height:233px;width:289px}.ag-charts-dialog--annotation-settings .ag-charts-textarea{height:calc(10px * 2 + var(--textarea-line-height) * 1em * 3 + 2px);overflow-y:auto;resize:vertical}.ag-charts-context-menu{font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);z-index:var(--ag-charts-layer-ui-overlay)}.ag-charts-context-menu__cover{position:fixed;left:0;top:0}.ag-charts-context-menu__menu{background:var(--ag-charts-menu-background-color);border-radius:var(--ag-charts-border-radius);border:var(--ag-charts-menu-border);box-shadow:var(--ag-charts-popup-shadow);color:var(--ag-charts-menu-text-color);display:flex;flex-direction:column;padding:.5em 0;transition:transform .1s ease;white-space:nowrap}.ag-charts-context-menu__menu:focus{outline:none}.ag-charts-context-menu__item{align-items:center;background:none;border:none;box-sizing:border-box;color:inherit;cursor:pointer;display:flex;font:inherit;justify-content:space-between;text-align:left;width:100%;-webkit-appearance:none;-moz-appearance:none}.ag-charts-context-menu__icon>img{width:var(--ag-charts-icon-size);height:var(--ag-charts-icon-size)}.ag-charts-context-menu__icon,.ag-charts-context-menu__cell{display:flex;align-items:center;flex-shrink:0}.ag-charts-context-menu__cell{flex-grow:1}.ag-charts-context-menu__cellpadding{padding:.5em 1em}.ag-charts-context-menu__icon{padding-right:0}.ag-charts-context-menu__item[data-focus-override=true],.ag-charts-context-menu__item:focus,.ag-charts-context-menu__item:active{background:var(--ag-charts-focus-color)}.ag-charts-context-menu__item[data-focus-override=false]{background:inherit}.ag-charts-context-menu__item[data-focus-visible-override=true]:focus,.ag-charts-context-menu__item:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-context-menu__item[data-focus-visible-override=false]{outline:inherit;box-shadow:inherit;z-index:inherit}.ag-charts-context-menu__item[aria-disabled=true]{border:none;color:color-mix(in srgb,var(--ag-charts-input-text-color) 50%,transparent)}.ag-charts-context-menu__item[aria-disabled=true]:focus{background:inherit;cursor:inherit}.ag-charts-context-menu__divider{padding:5px 0}.ag-charts-context-menu__divider:after{content:"";display:block;border-top:1px solid var(--ag-charts-border-color)}.ag-charts-crosshair-label{position:absolute;left:0;top:0;user-select:none;pointer-events:none;font-family:var(--ag-charts-font-family);font-size:var(--ag-charts-font-size);font-weight:var(--ag-charts-font-weight);overflow:hidden;white-space:nowrap;z-index:var(--ag-charts-layer-crosshair);box-sizing:border-box}.ag-charts-crosshair-label-content{padding:0 8px;border-radius:calc(var(--ag-charts-border-radius) / 2);line-height:calc(var(--ag-charts-font-size) + 8px);background-color:var(--ag-charts-crosshair-label-background-color);color:var(--ag-charts-crosshair-label-text-color)}.ag-charts-crosshair-label--hidden{visibility:hidden!important}.ag-charts-text-input{position:absolute}.ag-charts-text-input__textarea{--placeholder-text-color: var(--ag-charts-input-placeholder-text-color);display:block;height:100%;width:100%;border:0;background:none;line-height:1.38;outline:none;transform:translateY(.09em)}.ag-charts-text-input__textarea[placeholder]:empty:before{content:attr(placeholder);color:var(--placeholder-text-color);font-weight:400}.ag-charts-text-input__textarea[placeholder]:not(:empty):before{content:""}.ag-charts-chart-toolbar__menu{min-width:200px}.ag-charts-range-buttons .ag-charts-toolbar__button{padding:var(--toolbar-button-padding) calc(var(--toolbar-button-padding) * 1.5)}.ag-charts-zoom-buttons{align-items:center;display:flex;height:44px;justify-content:center;overflow:hidden;padding-bottom:10px;pointer-events:none;width:100%;.ag-charts-toolbar{--toolbar-size: 24px;--toolbar-button-padding: 1px;display:flex;font-size:var(--ag-charts-chrome-font-size);height:var(--toolbar-size);justify-content:center;opacity:1;pointer-events:auto;transition:opacity .2s ease-in-out,transform .4s ease-in-out;.ag-charts-toolbar__button--first{border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__button--last{border-bottom-right-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__label{padding-left:var(--ag-charts-spacing);padding-right:var(--ag-charts-spacing)}.ag-charts-toolbar__icon+.ag-charts-toolbar__label{padding-left:0}.ag-charts-toolbar__button--gap{margin-left:var(--toolbar-gap)}&.ag-charts-zoom-buttons__toolbar--hidden{opacity:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out}}}.ag-charts-shared-toolbar{gap:var(--toolbar-gap);.ag-charts-toolbar__button{border-radius:var(--ag-charts-border-radius);margin:0}} +`;import_ag_charts_community282._ModuleSupport.ModuleRegistry.registerMany(AllEnterpriseModules,import_ag_charts_community282.VERSION);function setupEnterpriseModules(){import_ag_charts_community282._ModuleSupport.moduleRegistry.register(AngleCategoryAxisModule,AngleNumberAxisModule,AnimationModule,AnnotationsModule,BackgroundModule,ForegroundModule,BoxPlotModule,CandlestickModule,ChordModule,ConeFunnelModule,FunnelModule,OhlcModule,ChartToolbarModule,ContextMenuModule,CrosshairModule,BandHighlightModule,DataSourceModule,ErrorBarsModule,LinearGaugeModule,MapLineModule,MapLineBackgroundModule,MapMarkerModule,MapShapeModule,MapShapeBackgroundModule,NavigatorModule,StatusBarModule,GradientLegendModule,HeatmapModule,NightingaleModule,OrdinalTimeAxisModule,RadarAreaModule,RadarLineModule,RadialBarModule,RadialColumnModule,RadiusCategoryAxisModule,RadialGaugeModule,RadiusNumberAxisModule,RangeBarModule,RangeAreaModule,RangesModule,PyramidModule,SankeyModule,SharedToolbarModule,SunburstModule,SyncModule,TreemapModule,WaterfallModule,ZoomModule),import_ag_charts_community282._ModuleSupport.enterpriseModule.isEnterprise=!0,import_ag_charts_community282._ModuleSupport.enterpriseModule.styles=styles_default,import_ag_charts_community282._ModuleSupport.enterpriseModule.licenseManager=t=>new LicenseManager(t.container?.ownerDocument??(typeof document>"u"?void 0:document)),import_ag_charts_community282._ModuleSupport.enterpriseModule.injectWatermark=injectWatermark}__reExport(main_exports,require("ag-charts-community"),module.exports),setupEnterpriseModules();var LicenseManager2={setLicenseKey(t){LicenseManager.setLicenseKey(t)}};function setupEnterpriseModules2(){setupEnterpriseModules(),(0,import_ag_charts_community283.setupCommunityModules)()}var AgChartsEnterpriseModule={VERSION:import_ag_charts_community283.VERSION,_Scene:import_ag_charts_community283._Scene,_Theme:import_ag_charts_community283._Theme,_Util:import_ag_charts_community283._Util,create:import_ag_charts_community283.AgCharts.create.bind(import_ag_charts_community283.AgCharts),createSparkline:import_ag_charts_community283.AgCharts.__createSparkline.bind(import_ag_charts_community283.AgCharts),setup:setupEnterpriseModules2,setGridContext:LicenseManager.setGridContext.bind(LicenseManager),setLicenseKey:LicenseManager.setLicenseKey.bind(LicenseManager),isEnterprise:!0}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/package/main.esm.min.mjs b/yuthon_report/static/src/lib/ag-chart/dist/package/main.esm.min.mjs new file mode 100644 index 000000000..f13d08575 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/package/main.esm.min.mjs @@ -0,0 +1,8 @@ +var Vk=Object.defineProperty,Wk=Object.getOwnPropertyDescriptor,d=(e,t,i,o)=>{for(var s=o>1?void 0:o?Wk(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(s=(o?n(t,i,s):n(s))||s);return o&&s&&Vk(t,i,s),s};import{AgCharts as Sr,VERSION as Gk,_Scene as Kk,_Theme as $k,_Util as jk,setupCommunityModules as Yk}from"ag-charts-community";var Uk=class{constructor(){this.ieCompatibility=!1}init(){this.ieCompatibility=this.md5("hello")!="5d41402abc4b2a76b9719d911017c592"}md5cycle(e,t){let i=e[0],o=e[1],s=e[2],a=e[3];i=this.ff(i,o,s,a,t[0],7,-680876936),a=this.ff(a,i,o,s,t[1],12,-389564586),s=this.ff(s,a,i,o,t[2],17,606105819),o=this.ff(o,s,a,i,t[3],22,-1044525330),i=this.ff(i,o,s,a,t[4],7,-176418897),a=this.ff(a,i,o,s,t[5],12,1200080426),s=this.ff(s,a,i,o,t[6],17,-1473231341),o=this.ff(o,s,a,i,t[7],22,-45705983),i=this.ff(i,o,s,a,t[8],7,1770035416),a=this.ff(a,i,o,s,t[9],12,-1958414417),s=this.ff(s,a,i,o,t[10],17,-42063),o=this.ff(o,s,a,i,t[11],22,-1990404162),i=this.ff(i,o,s,a,t[12],7,1804603682),a=this.ff(a,i,o,s,t[13],12,-40341101),s=this.ff(s,a,i,o,t[14],17,-1502002290),o=this.ff(o,s,a,i,t[15],22,1236535329),i=this.gg(i,o,s,a,t[1],5,-165796510),a=this.gg(a,i,o,s,t[6],9,-1069501632),s=this.gg(s,a,i,o,t[11],14,643717713),o=this.gg(o,s,a,i,t[0],20,-373897302),i=this.gg(i,o,s,a,t[5],5,-701558691),a=this.gg(a,i,o,s,t[10],9,38016083),s=this.gg(s,a,i,o,t[15],14,-660478335),o=this.gg(o,s,a,i,t[4],20,-405537848),i=this.gg(i,o,s,a,t[9],5,568446438),a=this.gg(a,i,o,s,t[14],9,-1019803690),s=this.gg(s,a,i,o,t[3],14,-187363961),o=this.gg(o,s,a,i,t[8],20,1163531501),i=this.gg(i,o,s,a,t[13],5,-1444681467),a=this.gg(a,i,o,s,t[2],9,-51403784),s=this.gg(s,a,i,o,t[7],14,1735328473),o=this.gg(o,s,a,i,t[12],20,-1926607734),i=this.hh(i,o,s,a,t[5],4,-378558),a=this.hh(a,i,o,s,t[8],11,-2022574463),s=this.hh(s,a,i,o,t[11],16,1839030562),o=this.hh(o,s,a,i,t[14],23,-35309556),i=this.hh(i,o,s,a,t[1],4,-1530992060),a=this.hh(a,i,o,s,t[4],11,1272893353),s=this.hh(s,a,i,o,t[7],16,-155497632),o=this.hh(o,s,a,i,t[10],23,-1094730640),i=this.hh(i,o,s,a,t[13],4,681279174),a=this.hh(a,i,o,s,t[0],11,-358537222),s=this.hh(s,a,i,o,t[3],16,-722521979),o=this.hh(o,s,a,i,t[6],23,76029189),i=this.hh(i,o,s,a,t[9],4,-640364487),a=this.hh(a,i,o,s,t[12],11,-421815835),s=this.hh(s,a,i,o,t[15],16,530742520),o=this.hh(o,s,a,i,t[2],23,-995338651),i=this.ii(i,o,s,a,t[0],6,-198630844),a=this.ii(a,i,o,s,t[7],10,1126891415),s=this.ii(s,a,i,o,t[14],15,-1416354905),o=this.ii(o,s,a,i,t[5],21,-57434055),i=this.ii(i,o,s,a,t[12],6,1700485571),a=this.ii(a,i,o,s,t[3],10,-1894986606),s=this.ii(s,a,i,o,t[10],15,-1051523),o=this.ii(o,s,a,i,t[1],21,-2054922799),i=this.ii(i,o,s,a,t[8],6,1873313359),a=this.ii(a,i,o,s,t[15],10,-30611744),s=this.ii(s,a,i,o,t[6],15,-1560198380),o=this.ii(o,s,a,i,t[13],21,1309151649),i=this.ii(i,o,s,a,t[4],6,-145523070),a=this.ii(a,i,o,s,t[11],10,-1120210379),s=this.ii(s,a,i,o,t[2],15,718787259),o=this.ii(o,s,a,i,t[9],21,-343485551),e[0]=this.add32(i,e[0]),e[1]=this.add32(o,e[1]),e[2]=this.add32(s,e[2]),e[3]=this.add32(a,e[3])}cmn(e,t,i,o,s,a){return t=this.add32(this.add32(t,e),this.add32(o,a)),this.add32(t<>>32-s,i)}ff(e,t,i,o,s,a,n){return this.cmn(t&i|~t&o,e,t,s,a,n)}gg(e,t,i,o,s,a,n){return this.cmn(t&o|i&~o,e,t,s,a,n)}hh(e,t,i,o,s,a,n){return this.cmn(t^i^o,e,t,s,a,n)}ii(e,t,i,o,s,a,n){return this.cmn(i^(t|~o),e,t,s,a,n)}md51(e){const t=e.length,i=[1732584193,-271733879,-1732584194,271733878];let o;for(o=64;o<=e.length;o+=64)this.md5cycle(i,this.md5blk(e.substring(o-64,o)));e=e.substring(o-64);const s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(o=0;o>2]|=e.charCodeAt(o)<<(o%4<<3);if(s[o>>2]|=128<<(o%4<<3),o>55)for(this.md5cycle(i,s),o=0;o<16;o++)s[o]=0;return s[14]=t*8,this.md5cycle(i,s),i}md5blk(e){const t=[];for(let i=0;i<64;i+=4)t[i>>2]=e.charCodeAt(i)+(e.charCodeAt(i+1)<<8)+(e.charCodeAt(i+2)<<16)+(e.charCodeAt(i+3)<<24);return t}rhex(e){const t="0123456789abcdef".split("");let i="",o=0;for(;o<4;o++)i+=t[e>>o*8+4&15]+t[e>>o*8&15];return i}hex(e){for(let t=0;t>16)+(t>>16)+(i>>16)<<16|i&65535}};function mh(e){return e==null||e.length===0}var br={"01":"GRID","02":"CHARTS","0102":"BOTH"},ag="https://www.ag-grid.com/charts/licensing/",xh=class Ke{constructor(t){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=t,this.md5=new Uk,this.md5.init()}validateLicense(){const t=this.getLicenseDetails(Ke.licenseKey,Ke.gridContext),i=`AG ${t.currentLicenseType==="BOTH"?"Grid and ":""}Charts Enterprise`;let o="";if(t.suppliedLicenseType==="BOTH"?o="AG Grid and AG Charts Enterprise":t.suppliedLicenseType==="GRID"?o="AG Grid Enterprise":t.suppliedLicenseType!==void 0&&(o="AG Charts Enterprise"),t.missing)(!this.isWebsiteUrl()||this.isForceWatermark())&&this.outputMissingLicenseKey(i);else if(t.expired){const s=Ke.getChartsReleaseDate(),a=Ke.formatDate(s);this.outputExpiredKey(t.expiry,a,o)}else t.valid?t.isTrial&&t.trialExpired&&this.outputExpiredTrialKey(t.expiry,i,o):this.outputInvalidLicenseKey(!!t.incorrectLicenseType,i,o)}static extractExpiry(t){const i=t.substring(t.lastIndexOf("_")+1,t.length);return new Date(Number.parseInt(Ke.decode(i),10))}static extractLicenseComponents(t){let i=t.replaceAll(/[\u200B-\u200D\uFEFF]/g,"");if(i=i.replaceAll(/\r?\n|\r/g,""),t.length<=32)return{md5:null,license:t,version:null,isTrial:null};const o=i.length-32,s=i.substring(o),a=i.substring(0,o),[n,r,l]=Ke.extractBracketedInformation(i);return{md5:s,license:a,version:n,isTrial:r,type:l}}getLicenseDetails(t,i=!1){const o="CHARTS";if(mh(t))return{licenseKey:t,valid:!1,missing:!0,currentLicenseType:o};const s=Ke.getChartsReleaseDate(),{md5:a,license:n,version:r,isTrial:l,type:c}=Ke.extractLicenseComponents(t);let h=a===this.md5.md5(n)&&!t.includes("For_Trialing_ag-Grid_Only"),p,u,g=null,y=!1,f;function x(){p=gg,r){case"legacy":case"2":{h=!1;break}case"3":mh(c)?h=!1:(f=c,c!==br["02"]&&c!==br["0102"]?(h=!1,y=!0):l&&x())}return h?{licenseKey:t,valid:h,expiry:Ke.formatDate(g),expired:u,version:r,isTrial:l,trialExpired:p,invalidLicenseTypeForCombo:i?f!=="BOTH":void 0,incorrectLicenseType:y,currentLicenseType:o,suppliedLicenseType:f}:{licenseKey:t,valid:h,incorrectLicenseType:y,currentLicenseType:o,suppliedLicenseType:f}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isE2ETest()&&!this.isWebsiteUrl()&&!mh(this.watermarkMessage)}getWatermarkMessage(){return this.watermarkMessage??""}getHostname(){if(!this.document)return"localhost";const t=this.document.defaultView??globalThis;if(!t)return"localhost";const i=t.location,{hostname:o=""}=i;return o}isForceWatermark(){if(!this.document)return!1;const t=this.document?.defaultView??globalThis.window!=null?globalThis:void 0;if(!t)return!1;const{pathname:i}=t.location;return i?i.includes("forceWatermark"):!1}isWebsiteUrl(){const t=this.getHostname();return/^((?:[\w-]+\.)?ag-grid\.com)$/.exec(t)!==null}isLocalhost(){const t=this.getHostname();return/^(?:127\.0\.0\.1|localhost)$/.exec(t)!==null}isE2ETest(){const t=this.getHostname();return/^(?:172\.17\.0\.1|host\.docker\.internal)$/.exec(t)!==null}static formatDate(t){const i=["January","February","March","April","May","June","July","August","September","October","November","December"],o=t.getDate(),s=t.getMonth(),a=t.getFullYear();return o+" "+i[s]+" "+a}static getChartsReleaseDate(){return new Date(Number.parseInt(Ke.decode(Ke.RELEASE_INFORMATION),10))}static decode(t){const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let o="",s,a,n,r,l,c,h,p=0;const u=t.replaceAll(/[^A-Za-z0-9+/=]/g,"");for(;p>4,a=(l&15)<<4|c>>2,n=(c&3)<<6|h,o=o+String.fromCodePoint(s),c!=64&&(o=o+String.fromCodePoint(a)),h!=64&&(o=o+String.fromCodePoint(n));return o=Ke.utf8_decode(o),o}static utf8_decode(t){t=t.replaceAll("rn","n");let i="";for(let o=0;o127&&s<2048?(i+=String.fromCodePoint(s>>6|192),i+=String.fromCodePoint(s&63|128)):(i+=String.fromCodePoint(s>>12|224),i+=String.fromCodePoint(s>>6&63|128),i+=String.fromCodePoint(s&63|128))}return i}static setGridContext(t=!1){Ke.gridContext=t}static setLicenseKey(t){this.licenseKey&&this.licenseKey!==t&&console.warn("License Key being set multiple times with different values. This can result in an incorrect license key being used."),Ke.licenseKey=t}static extractBracketedInformation(t){if(!t.includes("["))return["legacy",!1,void 0];const i=t.match(/\[(.*?)\]/g).map(r=>r.replace("[","").replace("]",""));if(!i||i.length===0)return["legacy",!1,void 0];const o=i.filter(r=>r==="TRIAL").length===1,s=i.find(r=>r.startsWith("v")),a=s?s.replace("v",""):"legacy",n=br[i.find(r=>br[r])];return[a,o,n]}centerPadAndOutput(t){const i=this.totalMessageLength-t.length;console.error(t.padStart(i/2+t.length,"*").padEnd(this.totalMessageLength,"*"))}padAndOutput(t,i="*",o=""){console.error(t.padEnd(this.totalMessageLength-o.length,i)+o)}outputInvalidLicenseKey(t,i,o){Ke.gridContext||(t?(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Incompatible License Key "),this.padAndOutput(`* Your license key is for ${o} only and does not cover you for ${i}.`," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${ag}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")):(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Invalid License Key "),this.padAndOutput("* Your license key is not valid."," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${ag}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput(""))),this.watermarkMessage="Invalid License"}outputExpiredTrialKey(t,i,o){Ke.gridContext||(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Trial Period Expired. "),this.padAndOutput(`* Your trial only license for ${o} expired on ${t}.`," ","*"),this.padAndOutput("* Please email info@ag-grid.com to purchase a license."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="Trial Period Expired"}outputMissingLicenseKey(t){Ke.gridContext||(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${t} License `),this.centerPadAndOutput(" License Key Not Found "),this.padAndOutput(`* All ${t} features are unlocked for trial.`," ","*"),this.padAndOutput("* If you want to hide the watermark please email info@ag-grid.com for a trial license key."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="For Trial Use Only"}outputExpiredKey(t,i,o){Ke.gridContext||(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${o} License `),this.centerPadAndOutput(" Incompatible Software Version "),this.padAndOutput(`* Your license key works with versions of ${o} released before ${t}.`," ","*"),this.padAndOutput(`* The version you are trying to use was released on ${i}.`," ","*"),this.padAndOutput("* Please contact info@ag-grid.com to renew your license key."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="License Expired"}};xh.RELEASE_INFORMATION="MTc2MTcyODQ5OTU1NQ==",xh.gridContext=!1;var sa=xh;import{VERSION as Xk,_ModuleSupport as aa}from"ag-charts-community";import{_ModuleSupport as Zk}from"ag-charts-community";import{isNumberEqual as ng}from"ag-charts-core";function Sh(e,t,i){const o=(a,n,r,l)=>{let c=e[0];for(let h=a;r>0?h<=n:h>n;h+=r){const p=e[h];if(l(c,p))return!0;c=p}return!1},s=Math.floor(e.length/2);return o(t,s,t,i)?!0:o(e.length-t,s,-t,i)}import{_ModuleSupport as qk}from"ag-charts-community";var{AxisInterval:Qk,Property:Jk}=qk,bh=class extends Qk{};d([Jk],bh.prototype,"minSpacing",2);import{_ModuleSupport as vr}from"ag-charts-community";import{countFractionDigits as eD,isNumberEqual as na,wrapTextOrSegments as tD}from"ag-charts-core";import{_ModuleSupport as rg}from"ag-charts-community";import{isNumberEqual as lg}from"ag-charts-core";import{_ModuleSupport as iD}from"ag-charts-community";import{createId as oD}from"ag-charts-core";var{BaseProperties:cg,ChartAxisDirection:sD,Property:Ie,Group:vh,FONT_SIZE:aD}=iD,Si=class extends cg{constructor(){super(...arguments),this.fontSize=aD.LARGE,this.fontFamily="Verdana, sans-serif",this.padding=5,this.color="rgba(87, 87, 87, 1)"}};d([Ie],Si.prototype,"enabled",2),d([Ie],Si.prototype,"text",2),d([Ie],Si.prototype,"fontStyle",2),d([Ie],Si.prototype,"fontWeight",2),d([Ie],Si.prototype,"fontSize",2),d([Ie],Si.prototype,"fontFamily",2),d([Ie],Si.prototype,"padding",2),d([Ie],Si.prototype,"color",2),d([Ie],Si.prototype,"parallel",2);var vt=class extends cg{constructor(){super(...arguments),this.id=oD(this),this.defaultColorRange=[],this.shape="polygon",this.label=new Si,this.scale=void 0,this.clippedRange=[-1/0,1/0],this.gridLength=0,this.sideFlag=-1,this.parallelFlipRotation=0,this.regularFlipRotation=0,this.direction=sD.Angle,this.axisInnerRadius=0,this.axisOuterRadius=0,this.lineGroup=new vh({name:this.id}),this.rangeGroup=new vh({name:this.id}),this.labelGroup=new vh({name:this.id}),this._isRange=void 0}assignCrossLineGroup(e,t){e!==this._isRange&&(e?this.rangeGroup.appendChild(t):this.lineGroup.appendChild(t)),this._isRange=e}setSectorNodeProps(e){e.fill=this.fill,e.fillOpacity=this.fillOpacity??1,e.stroke=this.stroke,e.strokeOpacity=this.strokeOpacity??1,e.strokeWidth=this.strokeWidth??1,e.lineDash=this.lineDash}setLabelNodeProps(e,t,i,o,s){const{label:a}=this;e.x=t,e.y=i,e.text=a.text,e.textAlign="center",e.textBaseline=o,e.rotation=s,e.rotationCenterX=t,e.rotationCenterY=i,e.fill=a.color,e.fontFamily=a.fontFamily,e.fontSize=a.fontSize,e.fontStyle=a.fontStyle,e.visible=!0}};d([Ie],vt.prototype,"enabled",2),d([Ie],vt.prototype,"type",2),d([Ie],vt.prototype,"range",2),d([Ie],vt.prototype,"value",2),d([Ie],vt.prototype,"defaultColorRange",2),d([Ie],vt.prototype,"fill",2),d([Ie],vt.prototype,"fillOpacity",2),d([Ie],vt.prototype,"stroke",2),d([Ie],vt.prototype,"strokeWidth",2),d([Ie],vt.prototype,"strokeOpacity",2),d([Ie],vt.prototype,"lineDash",2),d([Ie],vt.prototype,"shape",2),d([Ie],vt.prototype,"label",2);var{ChartAxisDirection:nD,getCrossLineValue:rD,validateCrossLineValue:lD,normalizeAngle360:kh,Group:cD,Path:hg,Sector:hD,RotatableText:dD,ContinuousScale:pD}=rg,Dh=class extends vt{constructor(){super(),this.direction=nD.Angle,this.polygonNode=new hg,this.sectorNode=new hD,this.lineNode=new hg,this.crossLineRange=new cD,this.labelNode=new dD,this.ticks=[],this.crossLineRange.append(this.polygonNode),this.crossLineRange.append(this.sectorNode),this.crossLineRange.append(this.lineNode),this.labelGroup.append(this.labelNode)}visibilityCheck(){if(!pD.is(this.scale))return!0;const[e,t]=this.scale.domain,i=rD(this);if(this.type==="range"){const[o,s]=i;return o>=e&&o<=t&&s>=o&&s<=t}else return i>=e&&i<=t}update(e){const{scale:t}=this;if(!t||!lD(this,t)||!this.visibilityCheck()){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.rangeGroup.visible=e,this.lineGroup.visible=e,this.labelGroup.visible=e,this.updateLineNode(e),this.updatePolygonNode(e),this.updateSectorNode(e),this.updateLabelNode(e)}updateLineNode(e){const{scale:t,type:i,value:o,lineNode:s}=this;if(!e||i!=="line"||!t){s.visible=!1;return}const a=t.convert(o);if(Number.isNaN(a)){s.visible=!1;return}const{axisInnerRadius:n,axisOuterRadius:r}=this;s.visible=!0,s.stroke=this.stroke,s.strokeOpacity=this.strokeOpacity??1,s.strokeWidth=this.strokeWidth??1,s.fill=void 0,s.lineDash=this.lineDash;const l=r*Math.cos(a),c=r*Math.sin(a),h=n*Math.cos(a),p=n*Math.sin(a);s.path.clear(!0),s.path.moveTo(h,p),s.path.lineTo(l,c),this.assignCrossLineGroup(!1,this.crossLineRange)}updatePolygonNode(e){const{polygonNode:t,range:i,scale:o,shape:s,type:a,ticks:n}=this;if(!e||a!=="range"||s!=="polygon"||!o||!i){t.visible=!1;return}const{axisInnerRadius:r,axisOuterRadius:l}=this,c=n.indexOf(i[0]),h=n.indexOf(i[1]),u=(c<=h?n.slice(c,h+1):n.slice(c).concat(n.slice(0,h+1))).map(y=>o.convert(y));t.visible=!0,this.setSectorNodeProps(t);const{path:g}=t;g.clear(!0);for(const[y,f]of u.entries()){const x=l*Math.cos(f),S=l*Math.sin(f);y===0?g.moveTo(x,S):g.lineTo(x,S)}if(r===0)g.lineTo(0,0);else{const y=u.slice().reverse();for(const f of y){const x=r*Math.cos(f),S=r*Math.sin(f);g.lineTo(x,S)}}t.path.closePath(),this.assignCrossLineGroup(!0,this.crossLineRange)}updateSectorNode(e){const{sectorNode:t,range:i,scale:o,shape:s,type:a}=this;if(!e||a!=="range"||s!=="circle"||!o||!i){t.visible=!1;return}const{axisInnerRadius:n,axisOuterRadius:r}=this,l=i.map(p=>o.convert(p)),c=o.step??0,h=o instanceof rg.BandScale?c/2:0;t.visible=!0,this.setSectorNodeProps(t),t.centerX=0,t.centerY=0,t.innerRadius=n,t.outerRadius=r,t.startAngle=l[0]-h,t.endAngle=l[1]+h,this.assignCrossLineGroup(!0,this.crossLineRange)}updateLabelNode(e){const{label:t,labelNode:i,range:o,scale:s,type:a,ticks:n}=this;if(!e||t.enabled===!1||!t.text||!s||a==="range"&&!o){i.visible=!1;return}i.visible=!0;const{axisInnerRadius:r,axisOuterRadius:l}=this;let c,h,p,u;if(a==="line"){const g=kh(s.convert(this.value)),y=1.5*Math.PI,f=lg(g,y)||g>y||gkh(s.convert(v)));let f=(g+y)/2;g>y&&(f-=Math.PI),f=kh(f);const x=(lg(f,0)||f>0)&&fl.value),r=n.reduce((l,c)=>Math.max(typeof c=="number"?eD(c):0,l),0);return{niceDomain:s,tickDomain:s,ticks:n,rawTickCount:void 0,fractionDigits:r,timeInterval:void 0,bbox:this.getBBox()}}update(){super.update(),this.updateRadiusLine(),this.updateGridLines(),this.updateTickLines()}normalizedAngles(){const e=Lo(-Math.PI/2+pn(this.startAngle)),t=this.endAngle==null?2*Math.PI:gD(pn(this.endAngle)-pn(this.startAngle)),i=e+t;return[e,i]}computeRange(){this.range=this.normalizedAngles()}updateSelections(){const e=this.tickData;this.gridLineGroupSelection.update(this.gridLength&&this.gridLine.enabled?e:[]),this.tickLineGroupSelection.update(this.tick.enabled?e:[]),this.tickLabelGroupSelection.update(this.label.enabled?e:[]),this.gridLineGroupSelection.cleanup(),this.tickLineGroupSelection.cleanup(),this.tickLabelGroupSelection.cleanup()}updatePosition(){super.updatePosition();const{translation:e,radiusLineGroup:t}=this,i=Math.floor(e.x),o=Math.floor(e.y);t.translationX=i,t.translationY=o}updateRadiusLine(){const e=this.radiusLine,{path:t}=e;t.clear(!0);const{points:i,closePath:o}=this.getAxisLinePoints();for(const{x:s,y:a,moveTo:n,arc:r,radius:l=0,startAngle:c=0,endAngle:h=0}of i)r?t.arc(s,a,l,c,h):n?t.moveTo(s,a):t.lineTo(s,a);o&&t.closePath(),e.visible=this.line.enabled,e.stroke=this.line.stroke,e.strokeWidth=this.line.width,e.fill=void 0}getAxisLinePoints(){const{scale:e,shape:t,gridLength:i}=this,[o,s]=this.range,a=na(s-o,2*Math.PI),n=[];if(t==="circle")a?n.push({x:i,y:0,moveTo:!0},{x:0,y:0,radius:i,startAngle:0,endAngle:2*Math.PI,arc:!0,moveTo:!1}):n.push({x:i*Math.cos(o),y:i*Math.sin(o),moveTo:!0},{x:0,y:0,radius:i,startAngle:Lo(o),endAngle:Lo(s),arc:!0,moveTo:!1});else if(t==="polygon"){const r=e.ticks({nice:this.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0})?.ticks?.map(l=>e.convert(l));if(r&&r.length>2)for(const[l,c]of r.entries()){const h=i*Math.cos(c),p=i*Math.sin(c),u=l===0;n.push({x:h,y:p,moveTo:u})}}return{points:n,closePath:a}}updateGridLines(){const{scale:e,gridLength:t,gridLine:{style:i,width:o},innerRadiusRatio:s}=this;if(!(i&&t>0))return;const a=t*s,n=i.length;this.gridLineGroupSelection.each((r,l,c)=>{const{value:h}=l,{stroke:p,lineDash:u}=i[c%n],g=e.convert(h);r.x1=a*Math.cos(g),r.y1=a*Math.sin(g),r.x2=t*Math.cos(g),r.y2=t*Math.sin(g),r.stroke=p,r.strokeWidth=o,r.lineDash=u,r.fill=void 0}),this.gridLineGroupSelection.cleanup()}updateLabels(){const{label:e,tickLabelGroupSelection:t}=this;t.each((i,o,s)=>{const a=this.labelData[s];if(!a||a.hidden){i.visible=!1;return}i.text=a.text,i.setFont(e),i.fill=e.color,i.x=a.x,i.y=a.y,i.setAlign(a),i.setBoxing(e),i.visible=!0,a.rotation?(i.rotation=a.rotation,i.rotationCenterX=a.x,i.rotationCenterY=a.y):i.rotation=0})}updateTickLines(){const{scale:e,gridLength:t,tick:i,tickLineGroupSelection:o}=this;o.each((s,a)=>{const{value:n}=a,r=e.convert(n),l=Math.cos(r),c=Math.sin(r);s.x1=t*l,s.y1=t*c,s.x2=(t+i.size)*l,s.y2=(t+i.size)*c,s.stroke=i.stroke,s.strokeWidth=i.width})}createLabelNodeData(e,t,i){const{label:o,gridLength:s,scale:a,tick:n}=this;if(!o.enabled)return[];const r=new fD,l=i.x-this.translation.x,c=i.x+i.width-this.translation.x,{fractionDigits:h}=this.layout.label,p=this.tickFormatter(this.scale.domain,this.tickData,!1,h),u=e.map((g,y)=>{const{value:f}=g,x=s+o.spacing+n.size,S=a.convert(f),v=Math.cos(S),m=Math.sin(S),b=x*v,k=x*m,{textAlign:A,textBaseline:M}=this.getLabelAlign(S),D=y===e.length-1&&f!==e[0]&&na(Lo(S),Lo(a.convert(e[0]))),L=this.getLabelRotation(S);let N=p(f,y);r.text=N,r.x=b,r.y=k,r.setFont(o),r.textAlign=A,r.textBaseline=M,r.rotation=L,L&&(r.rotationCenterX=b,r.rotationCenterY=k);let P=L?mD.toCanvas(r):r.getBBox();if(P&&t.hideWhenNecessary&&!L){const R=l-P.x,F=P.x+P.width-c,_=1;if(R>_||F>_){const T={maxWidth:P.width-Math.max(R,F),font:o,textWrap:"never"};N=tD(N,T),r.text=N,P=r.getBBox()}}return{text:N,x:b,y:k,textAlign:A,textBaseline:M,hidden:N===""||(g.hidden??D),rotation:L,box:P}});return o.avoidCollisions&&this.avoidLabelCollisions(u),u}computeLabelsBBox(e,t){this.labelData=this.createLabelNodeData(this.tickData,e,t);const i=this.labelData.map(({box:o})=>o).filter(o=>o!=null);return!this.label.enabled||i.length===0?null:xD.merge(i)}getLabelOrientation(){const{label:e}=this;return e instanceof Ah?e.orientation:"fixed"}getLabelRotation(e){let t=pn(this.label.rotation??0);e=Lo(e);const i=this.getLabelOrientation();return i==="parallel"?(t+=e,e>=0&&e=Math.PI/2&&e<1.5*Math.PI&&(t+=Math.PI)),t}getLabelAlign(e){const t=Math.cos(e),i=Math.sin(e);let o,s;const a=this.getLabelOrientation(),n=na(t,0),r=na(i,0),l=na(t,1),c=na(i,-1),h=t>0&&!n,p=i>0&&!r;return a==="parallel"?(o="center",s=l&&r||p?"top":"bottom"):a==="perpendicular"?(o=c||h?"left":"right",s="middle"):(o="right",n?o="center":h&&(o="left"),s="bottom",r?s="middle":p&&(s="top")),{textAlign:o,textBaseline:s}}updateCrossLines(){const{shape:e,gridLength:t,innerRadiusRatio:i}=this;for(const o of this.crossLines)o instanceof Dh&&(o.ticks=this.tickData.map(s=>s.value),o.shape=e,o.axisOuterRadius=t,o.axisInnerRadius=t*i);super.updateCrossLines()}};un.CrossLineConstructor=Dh,d([Mh],un.prototype,"startAngle",2),d([Mh],un.prototype,"endAngle",2);var{Property:Ih,CategoryScale:SD}=Zk,To=class extends un{constructor(e){super(e,new SD),this.groupPaddingInner=0,this.paddingInner=0,this.interval=new bh}hasDefinedDomain(){return!1}generateAngleTicks(e){const{scale:t,gridLength:i}=this,{values:o,minSpacing:s}=this.interval,a={nice:this.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0},n=o??t.ticks(a,e)?.ticks??[];if(n.length<2||s==null)return n.map(p=>({value:p,visible:!0}));const r=n[0],l=t.convert(r),c=i*Math.cos(l),h=i*Math.sin(l);for(let p=1;pMath.PI)break;const y=i*Math.cos(g),f=i*Math.sin(g);if(Math.hypot(y-c,f-h)>s){const S=new Set([r]);return Sh(n,p,(v,m)=>{S.add(m)}),n.map(v=>{const m=S.has(v);return{value:v,visible:m}})}}return[{value:r,visible:!0}]}avoidLabelCollisions(e){const{minSpacing:t}=this.label;if(e.length<3)return;const i=(l,c)=>{if(l.hidden||c.hidden)return!1;if(t==null)return l.box.collidesBBox(c.box);const h=l.box.clone().grow(t/2),p=c.box.clone().grow(t/2);return h.collidesBBox(p)},o=e[0],s=e.at(-1),a=new Set([o]),n=ng(o.x,s.x)&&ng(o.y,s.y),r=Math.floor(e.length/2);for(let l=1;l<=r;l++){const c=n?e.slice(0,-1):e;if(!Sh(c,l,i)){Sh(c,l,(p,u)=>{a.add(u)});break}}for(const l of e)a.has(l)||(l.hidden=!0,l.box=void 0)}tickFormatParams(){return{type:"category"}}datumFormatParams(e,t){const{datum:i,seriesId:o,legendItemName:s,key:a,source:n,property:r,domain:l,boundSeries:c}=t;return{type:"category",value:e,datum:i,seriesId:o,legendItemName:s,key:a,source:n,property:r,domain:l,boundSeries:c}}};To.className="AngleCategoryAxis",To.type="angle-category",d([Ih],To.prototype,"groupPaddingInner",2),d([Ih],To.prototype,"paddingInner",2),d([Ih],To.prototype,"interval",2);var bD={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"angle-category",moduleFactory:e=>new To(e)};import{_ModuleSupport as vD}from"ag-charts-community";import{isNumberEqual as ug}from"ag-charts-core";import{_ModuleSupport as kD}from"ag-charts-community";import{isNumberEqual as DD}from"ag-charts-core";var{range:gg,isDenseInterval:MD,LinearScale:Lh}=kD,yg=class ig extends Lh{constructor(){super(...arguments),this.arcLength=0}static getNiceStepAndTickCount(t,i){const[o,s]=i;let a=Lh.getTickStep(o,s,t);const n=Number.isNaN(t.maxTickCount)?1/0:t.maxTickCount,r=Math.abs(s-o)/a;let l=Math.pow(2,Math.ceil(Math.log(r)/Math.log(2)));return l>n&&(l/=2,a*=2),{count:l,step:a}}ticks(t,i=this.domain){const{arcLength:o}=this;if(!i||i.length<2||i.some(c=>!Number.isFinite(c))||o<=0)return{ticks:[],count:0};const{nice:s,interval:a}=t,[n,r]=i;if(a){const c=Math.abs(a),h=this.getPixelRange();if(!MD((r-n)/c,h))return gg(n,r,c)}let l;if(s&&this.hasNiceRange()){const c=super.niceDomain(t,i);l=ig.getNiceStepAndTickCount(t,c).step}else l=Lh.getTickStep(n,r,t);return gg(n,r,l)}hasNiceRange(){const t=this.range.slice().sort((o,s)=>o-s);return[Math.PI,2*Math.PI].some(o=>DD(o,t[1]-t[0]))}niceDomain(t,i=this.domain){const o=super.niceDomain(t,i);if(!this.hasNiceRange())return o;const s=o[0]>o[1],a=s?o[1]:o[0],{step:n,count:r}=ig.getNiceStepAndTickCount(t,o),l=1/n,c=n>=1?Math.ceil(a/n+r)*n:Math.ceil((a+r*n)*l)/l;return s?[c,a]:[a,c]}getPixelRange(){return this.arcLength}},{Property:Th,angleBetween:AD,normalisedExtentWithMetadata:ID,findMinMax:LD}=vD,ps=class extends un{constructor(e){super(e,new yg),this.shape="circle",this.interval=new bh}hasDefinedDomain(){const{min:e,max:t}=this;return e!=null&&t!=null&&ep>=c&&p<=h).sort((p,u)=>p-u)}return l.map(c=>({value:c,visible:!0}))}avoidLabelCollisions(e){const{minSpacing:t}=this.label,i=(a,n)=>{if(a.hidden||n.hidden)return!1;if(t==null)return a.box.collidesBBox(n.box);const r=a.box.clone().grow(t/2),l=n.box.clone().grow(t/2);return r.collidesBBox(l)},o=e[0],s=e.at(-1);o!==s&&ug(o.x,s.x)&&ug(o.y,s.y)&&(s.hidden=!0);for(let a=1;a0&&(l.hidden=!0,l.box=void 0);return}}for(const[a,n]of e.entries())a>0&&(n.hidden=!0,n.box=void 0)}tickFormatParams(e,t,i){return{type:"number",fractionDigits:i}}datumFormatParams(e,t,i){const{datum:o,seriesId:s,legendItemName:a,key:n,source:r,property:l,domain:c,boundSeries:h}=t;return{type:"number",value:e,datum:o,seriesId:s,legendItemName:a,key:n,source:r,property:l,domain:c,boundSeries:h,fractionDigits:i}}};ps.className="AngleNumberAxis",ps.type="angle-number",d([Th],ps.prototype,"min",2),d([Th],ps.prototype,"max",2),d([Th],ps.prototype,"interval",2);var TD={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"angle-number",moduleFactory:e=>new ps(e)};import{_ModuleSupport as fg}from"ag-charts-community";var{OrdinalTimeScale:CD,Property:ND,TimeAxisParentLevel:wD,lowestGranularityUnitForTicks:PD,lowestGranularityUnitForValue:OD,minimumTimeAxisDatumGranularity:_D,dateTruncationForDomain:RD,intervalUnit:mg,intervalStep:xg,intervalEpoch:Sg,intervalMilliseconds:bg}=fg,gn=class extends fg.DiscreteTimeAxis{constructor(e){super(e,new CD),this.parentLevel=new wD}get primaryLabel(){return this.parentLevel.enabled?this.parentLevel.label:void 0}get primaryTick(){return this.parentLevel.enabled?this.parentLevel.tick:void 0}processData(){super.processData();const{boundSeries:e,direction:t}=this;this.minimumTimeGranularity=_D(e,t,void 0,void 0)}tickFormatParams(e,t,i,o){o??(o=PD(t));const s=RD(e),a=mg(o),n=xg(o),r=Sg(o);return{type:"date",unit:a,step:n,epoch:r,truncateDate:s}}datumFormatParams(e,t,i,o,s){if(typeof e=="number"&&(e=new Date(e)),o==null){const{minimumTimeGranularity:x}=this,S=OD(e);x!=null&&bg(x)new gn(e)};import{_ModuleSupport as BD}from"ag-charts-community";import{_ModuleSupport as kr}from"ag-charts-community";import{isNumberEqual as zD}from"ag-charts-core";import{_ModuleSupport as vg}from"ag-charts-community";import{clamp as kg,isNumberEqual as FD}from"ag-charts-core";var{ChartAxisDirection:HD,Property:VD,validateCrossLineValue:WD,normalizeAngle360FromDegrees:GD,Group:KD,Path:$D,Sector:jD,RotatableText:YD}=vg,Dg=class extends Si{constructor(){super(...arguments),this.positionAngle=void 0}};d([VD],Dg.prototype,"positionAngle",2);var Ch=class extends vt{constructor(){super(),this.direction=HD.Radius,this.label=new Dg,this.polygonNode=new $D,this.sectorNode=new jD,this.crossLineRange=new KD,this.labelNode=new YD,this.outerRadius=0,this.innerRadius=0,this.crossLineRange.append(this.polygonNode),this.crossLineRange.append(this.sectorNode),this.labelGroup.append(this.labelNode)}update(e){const{scale:t}=this;if(!t||!WD(this,t)){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.updateRadii();const{innerRadius:i,outerRadius:o}=this;e&&(e=i>=this.axisInnerRadius&&o<=this.axisOuterRadius),this.rangeGroup.visible=e,this.lineGroup.visible=e,this.labelGroup.visible=e,this.updatePolygonNode(e),this.updateSectorNode(e),this.updateLabelNode(e),this.assignCrossLineGroup(this.type==="range",this.crossLineRange)}updateRadii(){const{range:e,scale:t,type:i,axisInnerRadius:o,axisOuterRadius:s}=this;if(!t)return{innerRadius:0,outerRadius:0};const a=l=>s+o-l;let n,r;if(i==="line")n=a(t.convert(this.value)),r=n;else{const l=Math.abs(t?.bandwidth??0),c=e.map(h=>t.convert(h));n=a(Math.max(...c)),r=a(Math.min(...c))+l}this.outerRadius=n,this.innerRadius=r}drawPolygon(e,t,i){for(const[o,s]of t.entries()){const a=e*Math.cos(s),n=e*Math.sin(s);o===0?i.path.moveTo(a,n):i.path.lineTo(a,n)}i.path.closePath()}updatePolygonNode(e){const{gridAngles:t,polygonNode:i,scale:o,shape:s,type:a,innerRadius:n,outerRadius:r}=this;if(!e||s!=="polygon"||!o||!t){i.visible=!1;return}i.visible=!0;const l=this.getPadding();i.path.clear(!0),this.drawPolygon(r-l,t,i);const c=t.slice().reverse(),h=a==="line"?r-l:n+l;this.drawPolygon(h,c,i),this.setSectorNodeProps(i)}updateSectorNode(e){const{axisInnerRadius:t,axisOuterRadius:i,scale:o,sectorNode:s,shape:a,innerRadius:n,outerRadius:r}=this;if(!e||a!=="circle"||!o){s.visible=!1;return}s.visible=!0,s.startAngle=0,s.endAngle=2*Math.PI;const l=this.getPadding(),c=kg(t,n+l,i),h=kg(t,r-l,i);s.innerRadius=Math.min(c,h),s.outerRadius=Math.max(c,h),this.setSectorNodeProps(s)}updateLabelNode(e){const{innerRadius:t,label:i,labelNode:o,scale:s,shape:a,type:n}=this;if(!e||i.enabled===!1||!i.text||!s){o.visible=!1;return}const r=GD((i.positionAngle??0)-90),l=(FD(r,0)||r>0)&&rthis.tickFormatter(...v),domain:e,range:n,reverse:r,niceMode:t,visibleRange:o,defaultTickMinSpacing:l,labelOffset:a,sideFlag:s,axisRotation:0,sizeLimit:void 0,primaryTickCount:void 0}),{tickData:h}=c,{ticks:p,rawTicks:u,rawTickCount:g,tickDomain:y,fractionDigits:f,niceDomain:x=e}=h,S=p.map(v=>this.getTickLabelProps(v,c));return this.generatedTicks={ticks:p,labels:S},{ticks:u,tickDomain:y,niceDomain:x,rawTickCount:g,fractionDigits:f,timeInterval:void 0}}updateSelections(){const{generatedTicks:e}=this;if(!e)return;const{ticks:t,labels:i}=e;this.gridLineGroupSelection.update(this.gridLength?t:[]),this.tickLabelGroupSelection.update(i),this.gridPathSelection.update(this.gridLine.enabled?this.prepareGridPathTickData(t):[]),this.gridLineGroupSelection.cleanup(),this.tickLabelGroupSelection.cleanup(),this.gridPathSelection.cleanup()}updateLabels(){if(!this.label.enabled)return;const e=kr.resetAxisLabelSelectionFn();this.tickLabelGroupSelection.each((t,i)=>{t.fill=i.color,t.text=i.text,t.textBaseline=i.textBaseline,t.textAlign=i.textAlign??"center",t.setFont(i),t.setBoxing(i),t.setProperties(e(t,i))})}updateGridLines(){const{gridLine:{style:e,width:t},shape:i,generatedTicks:o}=this;if(!e||!o)return;const s=e.length,a=(u,g)=>{const{stroke:y,lineDash:f}=e[g%s];u.stroke=y,u.strokeWidth=t,u.lineDash=f,u.fill=void 0},[n,r]=this.gridRange??[0,2*Math.PI],l=zD(r-n,2*Math.PI),p=i==="circle"?(u,g)=>{const{path:y}=u;y.clear(!0);const f=this.getTickRadius(g);l?(y.moveTo(f,0),y.arc(0,0,f,0,2*Math.PI)):(y.moveTo(f*Math.cos(n),f*Math.sin(n)),y.arc(0,0,f,Mg(n),Mg(r))),l&&y.closePath()}:(u,g)=>{const{path:y}=u,f=this.gridAngles;if(y.clear(!0),!f||f.length<3)return;const x=this.getTickRadius(g);for(const[S,v]of f.entries()){const m=x*Math.cos(v),b=x*Math.sin(v);S===0?y.moveTo(m,b):y.lineTo(m,b);for(const[k,A]of f.entries()){const M=x*Math.cos(A),D=x*Math.sin(A);k===0?y.moveTo(M,D):y.lineTo(M,D)}y.closePath()}y.closePath()};this.gridPathSelection.each((u,g,y)=>{a(u,y),p(u,g)})}updateTitle(){const e=n=>n.defaultValue,{title:t,range:i}=this,{formatter:o=e}=this.title;t.caption.enabled=t.enabled,t.caption.fontFamily=t.fontFamily,t.caption.fontSize=t.fontSize,t.caption.fontStyle=t.fontStyle,t.caption.fontWeight=t.fontWeight,t.caption.color=t.color,t.caption.wrapping=t.wrapping;let s=!1;const a=t.caption.node;t.enabled&&(s=!0,a.rotation=Math.PI/2,a.x=Math.floor((i[0]+i[1])/2),a.y=-qD.SMALL_PADDING,a.textAlign="center",a.textBaseline="bottom",a.text=this.cachedCallWithContext(o,this.getTitleFormatterParams(this.scale.domain))),a.visible=s}updateCrossLines(){for(const e of this.crossLines)if(e instanceof Ch){const{shape:t,gridAngles:i,range:o,innerRadiusRatio:s}=this,a=o[0];e.shape=t,e.gridAngles=i,e.axisOuterRadius=a,e.axisInnerRadius=a*s}super.updateCrossLines()}createLabel(){return new wh}getTickLabelProps(e,t){const{label:i}=this,{rotation:o,textBaseline:s,textAlign:a}=t,n=this.scale.range,r=e.tickLabel??"",c=i.getSideFlag()*(this.getTickSize()+i.spacing+this.seriesAreaPadding),h=r!==""&&r!=null,p=o;return{...this.getLabelStyles({value:e.tick,formattedValue:e.tickLabel}),tickId:e.tickId,rotation:p,text:r,textAlign:a,textBaseline:s,visible:h,x:c,y:e.translation,rotationCenterX:c,rotationCenterY:e.translation,range:n}}};Dr.CrossLineConstructor=Ch,d([Nh],Dr.prototype,"positionAngle",2);var{ProxyPropertyOnWrite:Tg,Property:Ph,CategoryScale:Cg}=BD,Co=class extends Dr{constructor(e){super(e,new Cg),this.shape="circle",this.groupPaddingInner=0,this.paddingInner=0,this.paddingOuter=0}hasDefinedDomain(){return!1}normaliseDataDomain(e){return{domain:e,clipped:!1}}prepareGridPathTickData(e){return e.slice().reverse()}getTickRadius(e){const{scale:t,innerRadiusRatio:i}=this,o=t.range[0],s=o*i;if(Cg.is(t)){const a=t.domain,n=a.length-1-a.indexOf(e.tick);return n===0?s:t.inset+t.step*(n-.5)+t.bandwidth/2}else{const a=(o-s)/t.domain.length;return o-e.translation+s-a/2}}tickFormatParams(){return{type:"category"}}datumFormatParams(e,t){const{datum:i,seriesId:o,legendItemName:s,key:a,source:n,property:r,domain:l,boundSeries:c}=t;return{type:"category",value:e,datum:i,seriesId:o,legendItemName:s,key:a,source:n,property:r,domain:l,boundSeries:c}}};Co.className="RadiusCategoryAxis",Co.type="radius-category",d([Ph],Co.prototype,"groupPaddingInner",2),d([Tg("scale","paddingInner"),Ph],Co.prototype,"paddingInner",2),d([Tg("scale","paddingOuter"),Ph],Co.prototype,"paddingOuter",2);var iM={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radius-category",moduleFactory:e=>new Co(e)};import{_ModuleSupport as oM}from"ag-charts-community";var{Property:Ng,normalisedExtentWithMetadata:sM,LinearScale:aM}=oM,ra=class extends Dr{constructor(e){super(e,new aM),this.shape="polygon"}hasDefinedDomain(){const{min:e,max:t}=this;return e!=null&&t!=null&&eo!==i).sort((o,s)=>s.tick-o.tick)}getTickRadius(e){const{scale:t}=this,i=t.range[0],o=i*this.innerRadiusRatio;return i-e.translation+o}normaliseDataDomain(e){const{min:t,max:i}=this,{extent:o,clipped:s}=sM(e,t,i);return{domain:o,clipped:s}}tickFormatParams(e,t,i){return{type:"number",fractionDigits:i}}datumFormatParams(e,t,i){const{datum:o,seriesId:s,legendItemName:a,key:n,source:r,property:l,domain:c,boundSeries:h}=t;return{type:"number",value:e,datum:o,seriesId:s,legendItemName:a,key:n,source:r,property:l,domain:c,boundSeries:h,fractionDigits:i}}};ra.className="RadiusNumberAxis",ra.type="radius-number",d([Ng],ra.prototype,"min",2),d([Ng],ra.prototype,"max",2);var nM={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radius-number",moduleFactory:e=>new ra(e)};import{_ModuleSupport as wg}from"ag-charts-community";var{ObserveChanges:Oh,Property:_h}=wg,Mr=class extends wg.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!0,e.animationManager.skip(!1),this.cleanup.register(()=>{e.animationManager.skip(!0)})}};d([Oh((e,t)=>{e.ctx.animationManager.skip(!t)}),_h],Mr.prototype,"enabled",2),d([Oh((e,t)=>{e.ctx.animationManager.defaultDuration=t}),_h],Mr.prototype,"duration",2),d([Oh((e,t)=>{e.ctx.animationManager.maxAnimatableItems=t??1/0}),_h],Mr.prototype,"maxAnimatableItems",2);var rM={type:"root",optionsKey:"animation",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new Mr(e),themeTemplate:{animation:{enabled:!0,maxAnimatableItems:1e3}}};import{_ModuleSupport as la}from"ag-charts-community";import{isValidDate as Rh}from"ag-charts-core";import{_ModuleSupport as Eh}from"ag-charts-community";import{attachListener as lM,setAttributes as cM}from"ag-charts-core";var hM='
',{focusCursorAtEnd:dM}=Eh,Pg="text-input",Og="canvas-overlay",pM=class extends Eh.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.layout={getTextInputCoords:()=>({x:0,y:0}),getTextPosition:()=>"center",alignment:"center",textAlign:"center"},this.visible=!1,this.element=e.domManager.addChild(Og,Pg),this.element.classList.add("ag-charts-text-input"),this.cleanup.register(()=>e.domManager.removeChild(Og,Pg))}setKeyDownHandler(e){this.cleanup.register(lM(this.element,"keydown",e))}show(e){this.element.innerHTML=hM;const t=this.element.firstElementChild;cM(t,{role:"textbox","data-preventdefault":!1}),t.isContentEditable||(t.contentEditable="true"),t.setAttribute("placeholder",this.ctx.localeManager.t(e.placeholderText??"inputTextareaPlaceholder")),e.styles?.placeholderColor&&t.style.setProperty("--placeholder-text-color",e.styles?.placeholderColor),t.innerText=e.text??"",t.style.color=e.styles?.color??"inherit",t.style.fontFamily=e.styles?.fontFamily??"inherit",t.style.fontSize=e.styles?.fontSize?`${e.styles.fontSize}px`:"inherit",t.style.fontStyle=e.styles?.fontStyle??"inherit",t.style.fontWeight=typeof e.styles?.fontWeight=="number"?`${e.styles.fontWeight}`:e.styles?.fontWeight??"inherit",dM(t),t.addEventListener("input",()=>{this.updatePosition(),e.onChange?.(this.getValue(),this.getBBox())}),t.addEventListener("click",i=>{i.stopPropagation()}),e.layout&&(this.layout=e.layout,this.updatePosition()),e.onChange?.(this.getValue(),this.getBBox()),this.visible=!0}hide(){this.element.innerHTML="",this.layout={getTextInputCoords:()=>({x:0,y:0}),getTextPosition:()=>"center",alignment:"center",textAlign:"center"},this.visible=!1}isVisible(){return this.visible}updateColor(e){this.element.firstElementChild&&(this.element.firstElementChild.style.color=e)}updateFontSize(e){if(this.element.firstElementChild)return this.element.firstElementChild.style.fontSize=`${e}px`,this.updatePosition(),this.getBBox()}getValue(){if(this.element.firstElementChild)return this.element.firstElementChild.innerText.trim()}updatePosition(){const{element:e}=this,t=e.firstElementChild;if(!t)return;const i=this.ctx.domManager.getBoundingClientRect(),{width:o,getTextInputCoords:s,getTextPosition:a,alignment:n,textAlign:r}=this.layout;e.style.setProperty("width",o?`${o}px`:"unset");const l=t.getBoundingClientRect(),c=s(l.height);let h=c.x;n==="center"?h-=(o??l.width)/2:n==="right"&&(h-=o??l.width);const p=a();let u=c.y;p==="center"?u-=l.height/2:p==="bottom"&&(u-=l.height),e.style.setProperty("top",`${u}px`),e.style.setProperty("left",`${h}px`),e.style.setProperty("max-width",`${i.width-h}px`),e.style.setProperty("text-align",n),t.style.setProperty("text-align",r)}getBBox(){const{left:e,top:t,width:i,height:o}=this.element.getBoundingClientRect();return new Eh.BBox(e,t,i,o)}};import{_ModuleSupport as uM}from"ag-charts-community";var{BaseProperties:gM,Property:_g}=uM,Bh=class extends gM{constructor(){super(...arguments),this.enabled=!1,this.axes="y"}};d([_g],Bh.prototype,"enabled",2),d([_g],Bh.prototype,"axes",2);import{_ModuleSupport as yM}from"ag-charts-community";var zh=(e=>(e.Line="line",e.HorizontalLine="horizontal-line",e.VerticalLine="vertical-line",e.DisjointChannel="disjoint-channel",e.ParallelChannel="parallel-channel",e.FibonacciRetracement="fibonacci-retracement",e.FibonacciRetracementTrendBased="fibonacci-retracement-trend-based",e.Callout="callout",e.Comment="comment",e.Note="note",e.Text="text",e.Arrow="arrow",e.ArrowUp="arrow-up",e.ArrowDown="arrow-down",e.DateRange="date-range",e.PriceRange="price-range",e.DatePriceRange="date-price-range",e.QuickDatePriceRange="quick-date-price-range",e))(zh||{}),fM=Object.values(zh);function mM(e){for(const t of fM)if(t===e)return t}import{isObject as xM}from"ag-charts-core";import{_ModuleSupport as SM}from"ag-charts-community";import{isObject as bM}from"ag-charts-core";import{_ModuleSupport as vM}from"ag-charts-community";import{generateUUID as kM}from"ag-charts-core";var{BaseProperties:No,FONT_SIZE:DM,Property:se}=vM,yn=class extends No{};d([se],yn.prototype,"x",2),d([se],yn.prototype,"y",2);var MM=class extends gt(io(zg(No))){},Fh=class extends gt(io(Ri(Wh(ys(No))))){constructor(){super(...arguments),this.cornerRadius=2}};d([se],Fh.prototype,"enabled",2),d([se],Fh.prototype,"cornerRadius",2);var AM=class extends Ri(No){},IM=class extends gt(io(Ri(No))){},us=class extends ys(No){constructor(){super(...arguments),this.label="",this.position="top",this.alignment="left"}};d([se],us.prototype,"label",2),d([se],us.prototype,"position",2),d([se],us.prototype,"alignment",2);var LM=class extends ys(No){},fn=class extends ys(No){constructor(){super(...arguments),this.label=""}};d([se],fn.prototype,"label",2),d([se],fn.prototype,"position",2),d([se],fn.prototype,"alignment",2);function gs(e){class t extends CM(zg(e)){constructor(){super(...arguments),this.id=kM()}}return t}function Hh(e){class t extends e{constructor(){super(...arguments),this.start=new yn,this.end=new yn}}return d([se],t.prototype,"start",2),d([se],t.prototype,"end",2),t}function Rg(e){class t extends e{}return d([se],t.prototype,"x",2),d([se],t.prototype,"y",2),t}function Eg(e){class t extends e{}return d([se],t.prototype,"value",2),t}function Vh(e){class t extends e{constructor(){super(...arguments),this.background=new AM}}return d([se],t.prototype,"background",2),t}function wo(e){class t extends e{constructor(){super(...arguments),this.handle=new IM}}return d([se],t.prototype,"handle",2),t}function Bg(e){class t extends e{constructor(){super(...arguments),this.axisLabel=new Fh}}return d([se],t.prototype,"axisLabel",2),t}function Wh(e){class t extends e{constructor(){super(...arguments),this.padding=void 0,this.textAlign="center",this.formatter=void 0}}return d([se],t.prototype,"padding",2),d([se],t.prototype,"textAlign",2),d([se],t.prototype,"formatter",2),t}function TM(e){class t extends e{}return t}function Gh(e){class t extends e{}return d([se],t.prototype,"extendStart",2),d([se],t.prototype,"extendEnd",2),t}function CM(e){class t extends e{isWriteable(){return!this.locked&&!this.readOnly}isHoverable(){return!this.readOnly}}return d([se],t.prototype,"locked",2),d([se],t.prototype,"readOnly",2),t}function Kh(e){class t extends e{setLocaleManager(o){this.localeManager??(this.localeManager=o)}}return t}function zg(e){class t extends e{}return d([se],t.prototype,"visible",2),t}function Ri(e){class t extends e{}return d([se],t.prototype,"fill",2),d([se],t.prototype,"fillOpacity",2),t}function gt(e){class t extends e{}return d([se],t.prototype,"stroke",2),d([se],t.prototype,"strokeOpacity",2),d([se],t.prototype,"strokeWidth",2),t}function io(e){class t extends e{constructor(){super(...arguments),this.lineCap=void 0,this.computedLineDash=void 0}}return d([se],t.prototype,"lineDash",2),d([se],t.prototype,"lineDashOffset",2),d([se],t.prototype,"lineStyle",2),t}function ys(e){class t extends e{constructor(){super(...arguments),this.fontSize=DM.SMALL,this.fontFamily="Verdana, sans-serif"}}return d([se],t.prototype,"fontStyle",2),d([se],t.prototype,"fontWeight",2),d([se],t.prototype,"fontSize",2),d([se],t.prototype,"fontFamily",2),d([se],t.prototype,"color",2),t}import{_ModuleSupport as NM}from"ag-charts-community";import{isDate as wM,isNumber as PM,isString as OM}from"ag-charts-core";function Fg(e){return PM(e)||OM(e)||wM(e)?{value:e,groupPercentage:0}:e??{value:void 0,groupPercentage:0}}function Fe(e){return Fg(e)?.value}function kt(e,t){if(e.start==null||e.end==null)return;const i=ke(e.start,t),o=ke(e.end,t);if(!(i==null||o==null))return{x1:i.x,y1:i.y,x2:o.x,y2:o.y}}function ke(e,t){const i=oo(e.x,t.xAxis),o=oo(e.y,t.yAxis);return{x:i,y:o}}function oo(e,t){if(e==null)return 0;const{value:i,groupPercentage:o}=Fg(e),{scale:s,snapToGroup:a}=t,n=s.bandwidth===0?s.step??0:s.bandwidth??0,r=a?n/2:n*o;return s.convert(i)+r}function Dt(e,t){const i=Ar(e.x,t.xAxis),o=Ar(e.y,t.yAxis);return{x:i,y:o}}function Ar(e,t){const{scale:i}=t;if(t.continuous&&i.step==null)return t.scaleInvert(e);const o=t.scaleInvertNearest(e),s=i.bandwidth===0?i.step:i.bandwidth??0,a=i.convert(o),n=a+s,r=a===n?0:(e-a)/(n-a);return{value:o,groupPercentage:r}}import{_ModuleSupport as _M}from"ag-charts-community";var{BaseProperties:RM}=_M,$h=class extends gs(Hh(wo(RM))){constructor(){super(...arguments),this.snapToAngle=45}getDefaultColor(e){}getDefaultOpacity(e){}},{Property:EM}=NM,Hg=class extends Kh(Wh(ys($h))){constructor(){super(...arguments),this.text="",this.position="top",this.alignment="left",this.placement="inside",this.placeholderText="inputTextareaPlaceholder"}getDefaultColor(e){return this.color}getDefaultOpacity(e){}getPlaceholderColor(){}getPadding(){const{padding:e=0}=this;return{top:e,right:e,bottom:e,left:e}}getText(){const e=this.text.length==0;let t=this.text;return e&&(t=this.placeholderText??"",this.localeManager&&(t=this.localeManager.t(t))),{text:t,isPlaceholder:e}}getTextInputCoords(e,t){return ke(this.end,e)}getTextPosition(){return this.position}};d([EM],Hg.prototype,"text",2);var{Property:BM,Color:Vg}=SM,zM={top:6,right:12,bottom:9,left:12},bi=class extends Ri(gt(Hg)){constructor(){super(...arguments),this.type="callout",this.position="bottom",this.alignment="left"}static is(e){return bM(e)&&e.type==="callout"}getDefaultColor(e){switch(e){case"fill-color":return this.fill;case"line-color":return this.stroke;case"text-color":default:return this.color}}getDefaultOpacity(e){switch(e){case"fill-color":return this.fillOpacity;case"line-color":return this.strokeOpacity;case"text-color":default:return}}getPlaceholderColor(){const{r:e,g:t,b:i}=Vg.fromString(this.color??"#888888");return new Vg(e,t,i,.66).toString()}getPadding(){const{padding:e}=this;return e==null?{...zM}:{top:e,right:e,bottom:e,left:e}}getTextInputCoords(e,t){const i=super.getTextInputCoords(e,t),o=this.getPadding(),s=o.left??0,a=o.bottom??0;return{x:i.x+s,y:i.y-a}}};d([BM],bi.prototype,"type",2);import{_ModuleSupport as FM}from"ag-charts-community";import{isObject as HM}from"ag-charts-core";import{_ModuleSupport as VM}from"ag-charts-community";var{BaseProperties:WM,Property:GM}=VM,Ir=class extends gs(Rg(wo(Wh(ys(WM))))){constructor(){super(...arguments),this.text="",this.position="top",this.alignment="left",this.placement="inside",this.placeholderText="inputTextareaPlaceholder"}getDefaultColor(e){return this.color}getDefaultOpacity(e){}getPlaceholderColor(){}getPadding(){const{padding:e=0}=this;return{top:e,right:e,bottom:e,left:e}}getText(){const e=this.text.length==0;return{text:e?this.placeholderText??"":this.text,isPlaceholder:e}}getTextInputCoords(e,t){return ke(this,e)}getTextPosition(){return this.position}};d([GM],Ir.prototype,"text",2);var{Property:KM,Color:Wg}=FM,Lr={top:8,right:14,bottom:8,left:14},Ei=class extends Ri(gt(Ir)){constructor(){super(...arguments),this.type="comment",this.position="bottom",this.alignment="left"}static is(e){return HM(e)&&e.type==="comment"}getDefaultColor(e){switch(e){case"fill-color":return this.fill;case"line-color":return this.stroke;case"text-color":default:return this.color}}getDefaultOpacity(e){switch(e){case"fill-color":return this.fillOpacity;case"line-color":return this.strokeOpacity;case"text-color":default:return}}getPlaceholderColor(){const{r:e,g:t,b:i}=Wg.fromString(this.color??"#888888");return new Wg(e,t,i,.66).toString()}getPadding(){const{padding:e,fontSize:t}=this;return e==null?{top:Math.max(t*.4,Lr.top),bottom:Math.max(t*.4,Lr.bottom),left:Math.max(t*.8,Lr.left),right:Math.max(t*.8,Lr.right)}:{top:e,right:e,bottom:e,left:e}}getTextInputCoords(e,t){const i=super.getTextInputCoords(e,t),o=this.getPadding();return{x:i.x+o.left,y:i.y-o.bottom}}};d([KM],Ei.prototype,"type",2);import{_ModuleSupport as $M}from"ag-charts-community";import{isObject as Tr}from"ag-charts-core";import{_ModuleSupport as jM}from"ag-charts-community";var{Vec2:fs}=jM;function mn(e,t){return e?"dashed":t??"solid"}function Gg(e,t){switch(t){case"solid":return[];case"dashed":return[e*4,e*2];case"dotted":return[0,e*2]}}function ca(e,t,i,o){const s=mn(e,i);return t??e??Gg(o??1,s)}function ha(e,t,i){const o=mn(t,i);return e??o==="dotted"?"round":void 0}function YM(e,t){const[i,o]=fs.from(e),s=t.height,a=fs.gradient(o,i,s),n=fs.intercept(o,a,s),r=[{x:i.x,y:s??0},{x:i.x,y:s==null?t.height:s-t.height}];if(a===1/0)return r;let l=[fs.intersectAtY(a,n,0,s),fs.intersectAtY(a,n,t.height,s),fs.intersectAtX(a,n,0,s),fs.intersectAtX(a,n,t.width,s)];return l=l.filter(c=>c.x>=t.x&&c.x<=t.width&&c.y>=t.y&&c.y<=t.height).sort((c,h)=>c.x===h.x?0:c.x{},this.text=new us}getDefaultColor(e){switch(e){case"fill-color":return this.background.fill;case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(e){switch(e){case"fill-color":return this.background.fillOpacity;case"line-color":return this.strokeOpacity}}getLineDash(){return ca(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ha(this.lineCap,this.lineDash,this.lineStyle)}};d([Nt],da.prototype,"statistics",2),d([Nt],da.prototype,"text",2);function Xh(e){class t extends e{constructor(){super(...arguments),this.hasDateRange=!0}}return t}function Zh(e){class t extends e{constructor(){super(...arguments),this.hasPriceRange=!0}}return t}var ei=class extends Xh(da){constructor(){super(...arguments),this.type="date-range",this.direction="horizontal"}static is(e){return Tr(e)&&e.type==="date-range"}};d([Nt],ei.prototype,"type",2),d([Nt],ei.prototype,"extendAbove",2),d([Nt],ei.prototype,"extendBelow",2);var ti=class extends Zh(da){constructor(){super(...arguments),this.type="price-range",this.direction="vertical"}static is(e){return Tr(e)&&e.type==="price-range"}};d([Nt],ti.prototype,"type",2),d([Nt],ti.prototype,"extendLeft",2),d([Nt],ti.prototype,"extendRight",2);var so=class extends Xh(Zh(da)){constructor(){super(...arguments),this.type="date-price-range",this.direction="both"}static is(e){return Tr(e)&&e.type==="date-price-range"}};d([Nt],so.prototype,"type",2);var Vt=class extends Xh(Zh(da)){constructor(){super(...arguments),this.type="quick-date-price-range",this.up=new Uh,this.down=new Uh,this.direction="both"}static is(e){return Tr(e)&&e.type==="quick-date-price-range"}};d([Nt],Vt.prototype,"type",2),d([Nt],Vt.prototype,"up",2),d([Nt],Vt.prototype,"down",2);import{_ModuleSupport as XM}from"ag-charts-community";import{clamp as ZM,isObject as qM}from"ag-charts-core";import{_ModuleSupport as QM}from"ag-charts-community";import{cachedTextMeasurer as JM,calcLineHeight as Kg,wrapText as e0}from"ag-charts-core";var{BBox:t0}=QM,Cr=1.38;function Nr(e,t,i){return i?e0(t,{maxWidth:i,font:e,textWrap:"always",avoidOrphans:!1}):t}function i0(e,t){const{lineMetrics:i,width:o}=JM(e).measureLines(t),s=i.length*Kg(e.fontSize,Cr);return{width:o,height:s}}function qh(e,t,i,o){let s=o?.width??0,a=o?.height??0;if(!o){const n=e.width==null?t:Nr(e,t,e.width);({width:s,height:a}=i0(e,n))}return new t0(i.x,i.y,s,a)}function $g(e,t,i,o,{x:s,y:a},n){const{visible:r=!0,fontFamily:l,fontSize:c=14,fontStyle:h,fontWeight:p,textAlign:u}=o,g=Kg(c,Cr);n??(n=o.position=="center"?"middle":o.position);const y=i?o.getPlaceholderColor():o.color;e.setProperties({x:s,y:a,visible:r,text:t,fill:y,fontFamily:l,fontSize:c,fontStyle:h,fontWeight:p,textAlign:u,lineHeight:g,textBaseline:n})}var{BaseProperties:o0,Property:jg}=XM,s0=10,a0=11,Yg=20,n0=22,r0=10,Ug=Yg+r0,Xg=34,l0=class extends Ri(gt(o0)){},wt=class extends Ri(gt(Ir)){constructor(){super(...arguments),this.type="note",this.background=new l0,this.position="bottom",this.alignment="center",this.width=200}static is(e){return qM(e)&&e.type==="note"}getDefaultColor(e){switch(e){case"line-color":return this.fill;case"text-color":return this.color}}getDefaultOpacity(e){switch(e){case"line-color":return this.fillOpacity;case"text-color":return}}getPadding(){const e=this.padding??s0;return{top:e,right:e,bottom:e,left:e}}getTextInputCoords(e,t){const{width:i,text:o}=this,s=super.getTextInputCoords(e,t),a=this.getPadding().top,n=qh(this,o,s);n.x=ZM(i/2,n.x,e.seriesRect.width-i/2);const r=n.y-Ug-a*2,l=n.y+a0+a*2,c=Math.max(n.height,t);return r-c-Xg<0?(n.y=l,this.position="top"):(n.y=r+a,this.position="bottom"),{x:n.x,y:n.y}}isHoverable(){return!0}};d([jg],wt.prototype,"type",2),d([jg],wt.prototype,"background",2);import{_ModuleSupport as c0}from"ag-charts-community";var{BaseProperties:h0}=c0,d0=class extends gs(Rg(wo(h0))){getDefaultColor(e){}getDefaultOpacity(e){}},Qh=class Bk extends Ri(d0){constructor(){super(...arguments),this.size=32}static is(t){return t instanceof Bk}getDefaultColor(t){return t==="fill-color"?this.fill:void 0}getDefaultOpacity(t){return t==="fill-color"?this.fillOpacity:void 0}};import{_ModuleSupport as p0}from"ag-charts-community";import{isObject as Zg}from"ag-charts-core";var{BaseProperties:qg,Property:wr}=p0,yt=class extends gs(Eg(wo(Bg(gt(io(qg)))))){constructor(){super(...arguments),this.direction="horizontal",this.type="horizontal-line",this.text=new us}static is(e){return Zg(e)&&e.type==="horizontal-line"}getDefaultColor(){return this.stroke}getDefaultOpacity(){return this.strokeOpacity}getLineDash(){return ca(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ha(this.lineCap,this.lineDash,this.lineStyle)}};d([wr],yt.prototype,"type",2),d([wr],yt.prototype,"text",2);var Bi=class extends gs(Eg(wo(Bg(gt(io(qg)))))){constructor(){super(...arguments),this.direction="vertical",this.type="vertical-line",this.text=new us}static is(e){return Zg(e)&&e.type==="vertical-line"}getDefaultColor(){return this.stroke}getDefaultOpacity(){return this.strokeOpacity}getLineDash(){return ca(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ha(this.lineCap,this.lineDash,this.lineStyle)}};d([wr],Bi.prototype,"type",2),d([wr],Bi.prototype,"text",2);import{_ModuleSupport as u0}from"ag-charts-community";import{Logger as g0,isObject as y0}from"ag-charts-core";var{BaseProperties:f0,Property:Pr}=u0,ii=class extends gs(Vh(Hh(wo(Gh(gt(io(f0))))))){constructor(){super(...arguments),this.type="disjoint-channel",this.text=new fn,this.snapToAngle=45}static is(e){return y0(e)&&e.type==="disjoint-channel"}get bottom(){const e={start:{x:this.start.x,y:this.start.y},end:{x:this.end.x,y:this.end.y}};return typeof e.start.y=="number"&&typeof e.end.y=="number"?(e.start.y-=this.startHeight,e.end.y-=this.endHeight):g0.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`),e}getDefaultColor(e){switch(e){case"fill-color":return this.background.fill;case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(e){switch(e){case"fill-color":return this.background.fillOpacity;case"line-color":return this.strokeOpacity}}getLineDash(){return ca(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ha(this.lineCap,this.lineDash,this.lineStyle)}};d([Pr],ii.prototype,"type",2),d([Pr],ii.prototype,"startHeight",2),d([Pr],ii.prototype,"endHeight",2),d([Pr],ii.prototype,"text",2);import{_ModuleSupport as m0}from"ag-charts-community";import{isObject as x0}from"ag-charts-core";import{_ModuleSupport as S0}from"ag-charts-community";import{_ModuleSupport as b0}from"ag-charts-community";import{isObject as Qg}from"ag-charts-core";var{Property:Jh}=b0,Or=class extends Kh(TM(Gh(gt(io($h))))){constructor(){super(...arguments),this.text=new us}getDefaultColor(e){switch(e){case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(){return this.strokeOpacity}getLineDash(){return ca(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ha(this.lineCap,this.lineDash,this.lineStyle)}};d([Jh],Or.prototype,"text",2);var ao=class extends Or{constructor(){super(...arguments),this.type="arrow",this.endCap="arrow"}static is(e){return Qg(e)&&e.type==="arrow"}};d([Jh],ao.prototype,"type",2);var no=class extends Or{constructor(){super(...arguments),this.type="line"}static is(e){return Qg(e)&&e.type==="line"}};d([Jh],no.prototype,"type",2);var{Property:ms}=S0,ro=class extends Or{constructor(){super(...arguments),this.label=new LM,this.reverse=!1,this.showFill=!0,this.isMultiColor=!0,this.strokes=[],this.bands=10}getDefaultColor(e){switch(e){case"line-color":return this.rangeStroke??this.stroke;case"text-color":return this.text.color}}};d([ms],ro.prototype,"label",2),d([ms],ro.prototype,"reverse",2),d([ms],ro.prototype,"showFill",2),d([ms],ro.prototype,"isMultiColor",2),d([ms],ro.prototype,"strokes",2),d([ms],ro.prototype,"rangeStroke",2),d([ms],ro.prototype,"bands",2);var{Property:Jg}=m0,zi=class extends ro{constructor(){super(...arguments),this.type="fibonacci-retracement-trend-based",this.endRetracement=new yn}static is(e){return x0(e)&&e.type==="fibonacci-retracement-trend-based"}};d([Jg],zi.prototype,"type",2),d([Jg],zi.prototype,"endRetracement",2);import{_ModuleSupport as v0}from"ag-charts-community";import{isObject as k0}from"ag-charts-core";var{Property:D0}=v0,lo=class extends ro{constructor(){super(...arguments),this.type="fibonacci-retracement"}static is(e){return k0(e)&&e.type==="fibonacci-retracement"}};d([D0],lo.prototype,"type",2);import{_ModuleSupport as M0}from"ag-charts-community";import{Logger as A0,isObject as I0}from"ag-charts-core";var{BaseProperties:L0,Property:_r}=M0,oi=class extends gs(Vh(Hh(wo(Gh(gt(io(L0))))))){constructor(){super(...arguments),this.type="parallel-channel",this.middle=new MM,this.text=new fn,this.snapToAngle=45}static is(e){return I0(e)&&e.type==="parallel-channel"}get bottom(){const e={start:{x:this.start.x,y:this.start.y},end:{x:this.end.x,y:this.end.y}};return typeof e.start.y=="number"&&typeof e.end.y=="number"?(e.start.y-=this.height,e.end.y-=this.height):A0.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`),e}getDefaultColor(e){switch(e){case"fill-color":return this.background.fill;case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(e){switch(e){case"fill-color":return this.background.fillOpacity;case"line-color":return this.strokeOpacity}}getLineDash(){return ca(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ha(this.lineCap,this.lineDash,this.lineStyle)}};d([_r],oi.prototype,"type",2),d([_r],oi.prototype,"height",2),d([_r],oi.prototype,"middle",2),d([_r],oi.prototype,"text",2);import{_ModuleSupport as T0}from"ag-charts-community";import{isObject as C0}from"ag-charts-core";var{Property:N0}=T0,co=class extends Ir{constructor(){super(...arguments),this.type="text",this.position="bottom"}static is(e){return C0(e)&&e.type==="text"}};d([N0],co.prototype,"type",2);function Po(e){return Vt.is(e)}function Rr(e){return no.is(e)||yt.is(e)||Bi.is(e)||ao.is(e)||ey(e)}function ho(e){return ii.is(e)||oi.is(e)}function ey(e){return lo.is(e)||zi.is(e)}function Fi(e){return bi.is(e)||Ei.is(e)||wt.is(e)||co.is(e)}function xn(e){return ei.is(e)||ti.is(e)||so.is(e)||Vt.is(e)}function ed(e){return Fi(e)&&!wt.is(e)}function Oo(e){return Rr(e)||ho(e)||xn(e)&&!Vt.is(e)}function w0(e){return Rr(e)||ho(e)||xn(e)||bi.is(e)||wt.is(e)}function P0(e){return wt.is(e)}function O0(e){return ho(e)||xn(e)||bi.is(e)||Ei.is(e)||Qh.is(e)}function _0(e){return Fi(e)&&!wt.is(e)}function pa(e){return(Rr(e)||ho(e)||xn(e))&&!Po(e)&&xM(e.text)}function R0(e,t){"fontSize"in e&&(e.fontSize=t),pa(e)&&(e.text.fontSize=t)}function ty(e,t){const i=t?.strokeWidth??e.strokeWidth??1,o=t?.type??e.lineStyle,s=o??mn(e.lineDash,o),a=Gg(i,s);e.strokeWidth=i,e.computedLineDash=a,e.lineStyle=s,e.lineCap=s==="dotted"?"round":void 0}function Er(e,t,i,o,s,a){switch(t){case"fill-color":{"fill"in e&&(e.fill=o),"fillOpacity"in e&&(e.fillOpacity=s),"background"in e&&(e.background.fill=o,e.background.fillOpacity=s);break}case"line-color":{"axisLabel"in e&&(e.axisLabel.fill=o,e.axisLabel.fillOpacity=s,e.axisLabel.stroke=o,e.axisLabel.strokeOpacity=s),"fill"in e&&"fillOpacity"in e&&P0(e)?(e.fill=o,e.fillOpacity=s):("strokeOpacity"in e&&(e.strokeOpacity=s),"isMultiColor"in e&&"rangeStroke"in e?(e.isMultiColor=a,e.rangeStroke=o):"stroke"in e&&(e.stroke=o));break}case"text-color":{"color"in e&&(e.color=i),pa(e)&&(e.text.color=o);break}}}var{deepClone:si}=yM,E0=class{constructor(){this.mementoOriginatorKey="annotation-defaults",this.colors=new Map(Object.values(zh).map(e=>[e,new Map([["line-color",void 0],["fill-color",void 0],["text-color",void 0]])])),this.fontSizes=new Map([["callout",void 0],["comment",void 0],["text",void 0],["arrow",void 0],["line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.lineStyles=new Map([["line",void 0],["horizontal-line",void 0],["vertical-line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["arrow",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.lineTextAlignments=new Map([["line",void 0],["horizontal-line",void 0],["vertical-line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["arrow",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.lineTextPositions=new Map([["line",void 0],["horizontal-line",void 0],["vertical-line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["arrow",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.fibonacciOptions=new Map([["fibonacci-retracement",{bands:void 0,reverse:void 0,showFill:void 0}],["fibonacci-retracement-trend-based",{bands:void 0,reverse:void 0,showFill:void 0}]])}createMemento(){return{colors:si(this.colors),fontSizes:si(this.fontSizes),lineStyles:si(this.lineStyles),lineTextAlignments:si(this.lineTextAlignments),lineTextPositions:si(this.lineTextPositions),fibonacciOptions:si(this.fibonacciOptions)}}guardMemento(e){return!0}restoreMemento(e,t,i){this.colors=si(i.colors),this.fontSizes=si(i.fontSizes),this.lineStyles=si(i.lineStyles),this.lineTextAlignments=si(i.lineTextAlignments),this.lineTextPositions=si(i.lineTextPositions),this.fibonacciOptions=si(i.fibonacciOptions)}setDefaultColor(e,t,i,o,s,a){this.colors.get(e)?.set(t,[i,o,s,a])}setDefaultFontSize(e,t){this.fontSizes.set(e,t)}setDefaultLineStyleType(e,t){const i=this.lineStyles.get(e);i?i.type=t:this.lineStyles.set(e,{type:t})}setDefaultLineStyleWidth(e,t){const i=this.lineStyles.get(e);i?i.strokeWidth=t:this.lineStyles.set(e,{strokeWidth:t})}setDefaultLineTextAlignment(e,t){this.lineTextAlignments.set(e,t)}setDefaultLineTextPosition(e,t){this.lineTextPositions.set(e,t)}setDefaultFibonacciOptions(e,t,i){if(e!="fibonacci-retracement"&&e!="fibonacci-retracement-trend-based")return;const o=this.fibonacciOptions.get(e);o[t]=i,this.fibonacciOptions.set(e,o)}applyDefaults(e){for(const[t,i]of this.colors)if(e.type===t)for(const[o,[s,a,n,r]=[]]of i)s&&a&&n!=null&&r!=null&&Er(e,o,s,a,n,r);for(const[t,i]of this.fontSizes)e.type!==t||i==null||R0(e,i);for(const[t,i]of this.lineStyles)e.type!==t||i==null||ty(e,i);for(const[t,i]of this.lineTextPositions)e.type!==t||i==null||(e.text.position=i);for(const[t,i]of this.lineTextAlignments)e.type!==t||i==null||(e.text.alignment=i);for(const[t,i]of this.fibonacciOptions)if(!(e.type!==t||i==null))for(const o of Object.keys(i)){const s=i[o];s!=null&&e.set({[o]:s})}}};import{_ModuleSupport as iy}from"ag-charts-community";import{CleanupRegistry as B0,EventEmitter as z0}from"ag-charts-core";import{_ModuleSupport as oy}from"ag-charts-community";import{attachListener as F0,clamp as Br,createElement as H0,getWindow as sy}from"ag-charts-core";var V0='
',{Color:td}=oy,ay=e=>{try{const t=td.fromString(e),[i,o,s]=t.toHSB();return[i,o,s,t.a]}catch{return}},ny=class extends oy.AnchoredPopover{constructor(e,t){super(e,"color-picker",t),this.hasChanged=!1,this.hideFns.push(()=>{this.i18nUpdater=void 0,this.hasChanged&&this.onChangeHide?.()}),this.cleanup.register(this.ctx.eventsHub.on("locale:change",()=>this.i18nUpdater?.()))}show(e){this.hasChanged=!1,this.onChangeHide=e.onChangeHide;const{element:t,initialFocus:i}=this.createColorPicker(e),o=this.showWithChildren([t],{initialFocus:i,...e});o.classList.add("ag-charts-color-picker"),o.setAttribute("role","dialog")}createColorPicker(e){const{localeManager:t}=this.ctx;let i=e.isMultiColor??!1,[o,s,a,n]=ay(e.color??"#f00")??[0,1,.5,1];n=e.opacity??n;const r=H0("div","ag-charts-color-picker__content");r.innerHTML=V0,r.ariaLabel=this.ctx.localeManager.t("ariaLabelColorPicker");const l=r.querySelector(".ag-charts-color-picker__palette"),c=r.querySelector(".ag-charts-color-picker__hue-input"),h=r.querySelector(".ag-charts-color-picker__multi-color-button"),p=r.querySelector(".ag-charts-color-picker__alpha-input"),u=r.querySelector(".ag-charts-color-picker__color-input"),g=r.querySelector(".ag-charts-color-picker__color-label"),y=m=>{const b={s:"ariaValueColorPalette",v:"ariaValueColorPaletteFirstV"}[m];l.ariaValueText=t.t(b,{s,v:a})};this.i18nUpdater=()=>{l.ariaRoleDescription=t.t("ariaRoleDescription2DSlider"),l.ariaLabel=t.t("ariaLabelColorPickerPalette"),c.ariaLabel=t.t("ariaLabelColorPickerHue"),h.ariaLabel=t.t("ariaLabelColorPickerMultiColor"),p.ariaLabel=t.t("ariaLabelColorPickerAlpha"),u.ariaLabel=t.t("ariaLabelColor"),y("s")},this.i18nUpdater(),h.classList.toggle("ag-charts-color-picker__multi-color-button--hidden",!e.hasMultiColorOption);const f=(m=!0)=>{const k=td.fromHSB(o,s,a,n).toHexString();if(r.style.setProperty("--h",`${o}`),r.style.setProperty("--s",`${s}`),r.style.setProperty("--v",`${a}`),r.style.setProperty("--a",`${n}`),r.style.setProperty("--color",k.slice(0,7)),r.style.setProperty("--color-a",k),c.value=`${o}`,p.value=`${n}`,p.classList.toggle("ag-charts-color-picker__alpha-input--opaque",n===1),h.classList.toggle("ag-charts-color-picker__multi-color-button--active",i),g.classList.toggle("ag-charts-color-picker__color-label--multi-color",i),document.activeElement!==u&&(h.ariaChecked=i.toString(),u.value=i?t.t("ariaLabelColorPickerMultiColor"):k.toUpperCase()),m||e.color==null){const A=td.fromHSB(o,s,a,1).toHexString();e.onChange?.(k,A,n,i)}m&&(this.hasChanged=!0)};f(!1);const x=m=>m.preventDefault(),S=m=>m.stopPropagation(),v=m=>{m.preventDefault();const b=m.currentTarget;b.focus();const k=b.getBoundingClientRect(),A=({clientX:D,clientY:L})=>{i=!1,s=Math.min(Math.max((D-k.left)/k.width,0),1),a=1-Math.min(Math.max((L-k.top)/k.height,0),1),f(),y("s")};A(m);const M=F0(sy(),"pointermove",A);sy().addEventListener("pointerup",M,{once:!0})};return r.addEventListener("mousedown",S),r.addEventListener("touchstart",S),r.addEventListener("touchmove",S),r.addEventListener("keydown",m=>{switch(m.stopPropagation(),m.key){case"Enter":case"Escape":this.hide();break;default:return}m.preventDefault()}),l.addEventListener("pointerdown",v),l.addEventListener("touchstart",x,{passive:!1}),l.addEventListener("touchmove",x,{passive:!1}),l.addEventListener("keydown",m=>{if(m.key==="ArrowLeft")s=Br(0,s-.01,1),y("s");else if(m.key==="ArrowRight")s=Br(0,s+.01,1),y("s");else if(m.key==="ArrowUp")a=Br(0,a+.01,1),y("v");else if(m.key==="ArrowDown")a=Br(0,a-.01,1),y("v");else return;m.preventDefault(),f()}),l.addEventListener("focus",()=>{y("s")}),h.addEventListener("click",()=>{i=!i,f()}),c.addEventListener("input",m=>{i=!1,o=m.currentTarget.valueAsNumber??0,f()}),p.addEventListener("input",m=>{i=!1,n=m.currentTarget.valueAsNumber??0,f()}),u.addEventListener("input",m=>{i=!1;const b=ay(m.currentTarget.value);b!=null&&([o,s,a,n]=b,f())}),u.addEventListener("blur",()=>f()),u.addEventListener("keydown",m=>{m.key==="Enter"&&(m.currentTarget.blur(),f())}),{element:r,initialFocus:l}}};import{_ModuleSupport as ry}from"ag-charts-community";function ly(e){return!(e instanceof ry.LogScale)&&!(e instanceof ry.BandScale)}var W0=[{label:"toolbarAnnotationsTrendLine",icon:"trend-line-drawing",value:"line"},{label:"toolbarAnnotationsHorizontalLine",icon:"horizontal-line-drawing",value:"horizontal-line"},{label:"toolbarAnnotationsVerticalLine",icon:"vertical-line-drawing",value:"vertical-line"},{label:"toolbarAnnotationsParallelChannel",icon:"parallel-channel-drawing",value:"parallel-channel",visible:ly},{label:"toolbarAnnotationsDisjointChannel",icon:"disjoint-channel-drawing",value:"disjoint-channel",visible:ly}],G0=[{label:"toolbarAnnotationsFibonacciRetracement",icon:"fibonacci-retracement-drawing",value:"fibonacci-retracement"},{label:"toolbarAnnotationsFibonacciRetracementTrendBased",icon:"fibonacci-retracement-trend-based-drawing",value:"fibonacci-retracement-trend-based"}],K0=[{label:"Fibonacci - Extended",value:10},{label:"Fibonacci - 6 Band",value:6},{label:"Fibonacci - 4 Band",value:4}],$0=[{label:"toolbarAnnotationsText",icon:"text-annotation",value:"text"},{label:"toolbarAnnotationsComment",icon:"comment-annotation",value:"comment"},{label:"toolbarAnnotationsCallout",icon:"callout-annotation",value:"callout"},{label:"toolbarAnnotationsNote",icon:"note-annotation",value:"note"}],j0=[{label:"toolbarAnnotationsArrow",icon:"arrow-drawing",value:"arrow"},{label:"toolbarAnnotationsArrowUp",icon:"arrow-up-drawing",value:"arrow-up"},{label:"toolbarAnnotationsArrowDown",icon:"arrow-down-drawing",value:"arrow-down"}],Y0=[{label:"toolbarAnnotationsQuickDatePriceRange",icon:"measurer-drawing",value:"quick-date-price-range"},{label:"toolbarAnnotationsDateRange",icon:"date-range-drawing",value:"date-range"},{label:"toolbarAnnotationsPriceRange",icon:"price-range-drawing",value:"price-range"},{label:"toolbarAnnotationsDatePriceRange",icon:"date-price-range-drawing",value:"date-price-range"}],cy=[{strokeWidth:1,label:"1",value:1},{strokeWidth:2,label:"2",value:2},{strokeWidth:3,label:"3",value:3},{strokeWidth:4,label:"4",value:4},{strokeWidth:8,label:"8",value:8}],Sn=[{icon:"line-style-solid",altText:"iconAltTextLineStyleSolid",value:"solid"},{icon:"line-style-dashed",altText:"iconAltTextLineStyleDashed",value:"dashed"},{icon:"line-style-dotted",altText:"iconAltTextLineStyleDotted",value:"dotted"}],hy=[{label:"10",value:10},{label:"12",value:12},{label:"14",value:14},{label:"16",value:16},{label:"18",value:18},{label:"22",value:22},{label:"28",value:28},{label:"36",value:36},{label:"46",value:46}],{Color:dy,FloatingToolbar:U0,Menu:id,PropertiesArray:X0,ToolbarButtonProperties:py,ToolbarButtonWidget:Z0,Property:xs}=iy,ua=class extends py{constructor(){super(...arguments),this.checkedOverrides=new py}};d([xs],ua.prototype,"value",2),d([xs],ua.prototype,"checkedOverrides",2),d([xs],ua.prototype,"color",2),d([xs],ua.prototype,"strokeWidth",2),d([xs],ua.prototype,"isMultiColor",2);var q0=class extends Z0{update(e){super.update(e),e.value==="line-stroke-width"&&this.updateLineStrokeWidth(e),(e.value==="fill-color"||e.value==="line-color"||e.value==="text-color")&&this.updateFillColor(e)}updateFillColor(e){const t=this.getElement();t.classList.add("ag-charts-annotations__color-picker-button"),t.classList.toggle("ag-charts-annotations__color-picker-button--multi-color",e.isMultiColor),t.style.setProperty("--color",e.color??null)}updateLineStrokeWidth(e){const t=this.getElement();t.classList.add("ag-charts-annotations__stroke-width-button"),t.style.setProperty("--stroke-width",`${e.strokeWidth}px`)}},Q0=class extends U0{createButtonWidget(){return new q0(this.localeManager)}},od=class extends iy.BaseProperties{constructor(e,t){super(),this.ctx=e,this.getActiveDatum=t,this.enabled=!0,this.buttons=new X0(ua),this.cleanup=new B0,this.events=new z0,this.visibleButtons=[],this.toolbar=new Q0(this.ctx,"ariaLabelAnnotationOptionsToolbar","annotation-options"),this.colorPicker=new ny(this.ctx),this.textSizeMenu=new id(this.ctx,"text-size"),this.lineStyleTypeMenu=new id(this.ctx,"annotations-line-style-type"),this.lineStrokeWidthMenu=new id(this.ctx,"annotations-line-stroke-width"),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onButtonPress.bind(this)),this.toolbar.addToolbarListener("toolbar-moved",this.onToolbarMoved.bind(this)),e.widgets.seriesWidget.addListener("drag-start",this.onDragStart.bind(this)),e.widgets.seriesWidget.addListener("drag-end",this.onDragEnd.bind(this)),()=>{this.colorPicker.destroy(),this.toolbar.destroy()})}onDragStart(){this.toolbar.ignorePointerEvents()}onDragEnd(){this.toolbar.capturePointerEvents()}destroy(){this.cleanup.flush()}show(){this.enabled&&this.toolbar.show()}hide(){this.toolbar.hide()}updateButtons(e){if(!this.enabled)return;const t={"line-style-type":Oo(e),"line-stroke-width":Oo(e),"line-color":w0(e),"text-color":_0(e),"fill-color":O0(e),"text-size":ed(e),settings:pa(e),lock:!0,delete:!0};this.visibleButtons=this.buttons.filter(i=>t[i.value]),this.toolbar.clearButtons(),this.toolbar.updateButtons(this.visibleButtons),this.refreshButtons(e)}setAnchorScene(e){this.toolbar.hasBeenDragged()||this.toolbar.setAnchor(e.getAnchor())}hideOverlays(){this.toolbar.clearActiveButton(),this.colorPicker.hide({lastFocus:null}),this.textSizeMenu.hide(),this.lineStyleTypeMenu.hide(),this.lineStrokeWidthMenu.hide(),this.events.emit("hid-overlays",null)}clearActiveButton(){this.toolbar.clearActiveButton()}updateColors(e){this.updateColorPickerColor("line-color",e.getDefaultColor("line-color"),e.getDefaultOpacity("line-color"),"isMultiColor"in e&&e?.isMultiColor),this.updateColorPickerColor("fill-color",e.getDefaultColor("fill-color"),e.getDefaultOpacity("fill-color"),"isMultiColor"in e&&e?.isMultiColor),this.updateColorPickerColor("text-color",e.getDefaultColor("text-color"),e.getDefaultOpacity("text-color"),"isMultiColor"in e&&e?.isMultiColor)}updateColorPickerColor(e,t,i,o){if(t!=null&&i!=null){const{r:s,g:a,b:n}=dy.fromString(t);t=dy.fromArray([s,a,n,i]).toHexString()}this.updateButtonByValue(e,{color:t,isMultiColor:o})}updateFontSize(e){this.updateButtonByValue("text-size",{label:e==null?void 0:String(e)})}updateLineStyleType(e){this.updateButtonByValue("line-style-type",{icon:e.icon})}updateStrokeWidth(e){this.updateButtonByValue("line-stroke-width",{label:e.label,strokeWidth:e.value})}onButtonPress({event:e,button:t,buttonWidget:i}){const o=this.getActiveDatum();if(o)switch(this.hideOverlays(),t.value){case"line-style-type":{const s=Oo(o)?mn(o.lineDash,o.lineStyle):void 0;this.lineStyleTypeMenu.show(i,{items:Sn,ariaLabel:this.ctx.localeManager.t("toolbarAnnotationsLineStyle"),value:s,onPress:a=>this.onLineStyleTypeMenuPress(a,o),class:"ag-charts-annotations__line-style-type-menu"});break}case"line-stroke-width":{const s=Oo(o)?o.strokeWidth:void 0;this.lineStrokeWidthMenu.show(i,{items:cy,ariaLabel:this.ctx.localeManager.t("toolbarAnnotationsLineStrokeWidth"),value:s,onPress:a=>this.onLineStrokeWidthMenuPress(a,o),class:"ag-charts-annotations__line-stroke-width-menu"});break}case"line-color":case"fill-color":case"text-color":{this.toolbar.toggleActiveButtonByIndex(t.index),this.colorPicker.show({color:o?.getDefaultColor(t.value),opacity:o?.getDefaultOpacity(t.value),sourceEvent:e.sourceEvent,hasMultiColorOption:"isMultiColor"in o,isMultiColor:"isMultiColor"in o&&o?.isMultiColor,onChange:o==null?void 0:this.onColorPickerChange.bind(this,t.value,o),onChangeHide:(s=>{this.events.emit("saved-color",{type:o.type,colorPickerType:t.value,color:o.getDefaultColor(s)})}).bind(this,t.value)});break}case"text-size":{const s=Fi(o)?o.fontSize:void 0;this.textSizeMenu.show(i,{items:hy,ariaLabel:this.ctx.localeManager.t("toolbarAnnotationsTextSize"),value:s,onPress:a=>this.onTextSizeMenuPress(a,o),class:"ag-charts-annotations__text-size-menu"});break}case"delete":{this.events.emit("pressed-delete",null);break}case"lock":{o.locked=!o.locked,this.refreshButtons(o),this.events.emit("pressed-lock",{locked:o.locked});break}case"settings":{this.toolbar.toggleActiveButtonByIndex(t.index),this.events.emit("pressed-settings",e);break}}}onToolbarMoved(e){const{buttonBounds:t,popoverBounds:i}=e,o={x:i.x,y:i.y+i.height+4},s={y:i.y-4};this.colorPicker.setAnchor(o,s);for(const[a,n]of t.entries()){const r=this.visibleButtons.at(a);if(!r)continue;const l={x:n.x,y:n.y+n.height-1},c={y:n.y};switch(r.value){case"line-stroke-width":this.lineStrokeWidthMenu.setAnchor(l,c);break;case"line-style-type":this.lineStyleTypeMenu.setAnchor(l,c);break;case"text-size":this.textSizeMenu.setAnchor(l,c);break}}}onColorPickerChange(e,t,i,o,s,a){this.events.emit("updated-color",{type:t.type,colorPickerType:e,colorOpacity:i,color:o,opacity:s,isMultiColor:a}),this.updateColorPickerColor(e,i,s,a)}onTextSizeMenuPress(e,t){if(!ed(t))return;const i=e.value;this.events.emit("updated-font-size",{type:t.type,fontSize:i}),this.textSizeMenu.hide(),this.updateFontSize(i)}onLineStyleTypeMenuPress(e,t){if(!Oo(t))return;const i=e.value;this.events.emit("updated-line-style",{type:t.type,lineStyleType:i}),this.lineStyleTypeMenu.hide(),this.updateLineStyleType(e)}onLineStrokeWidthMenuPress(e,t){if(!Oo(t))return;const i=e.value;this.events.emit("updated-line-width",{type:t.type,strokeWidth:i}),this.lineStrokeWidthMenu.hide(),this.updateStrokeWidth(e)}refreshButtons(e){const t=e.locked??!1;for(const[i,o]of this.visibleButtons.entries())o&&(o.value==="lock"?(this.toolbar.toggleSwitchCheckedByIndex(i,t),this.updateButtonByIndex(i,t?o.checkedOverrides.toJson():o.toJson())):this.toolbar.toggleButtonEnabledByIndex(i,!t));ed(e)&&this.updateFontSize(e.fontSize),this.updateColors(e),this.updateLineStyles(e)}updateLineStyles(e){if(!Oo(e))return;const t=e.strokeWidth??1,i=mn(e.lineDash,e.lineStyle);this.updateStrokeWidth({strokeWidth:t,value:t,label:String(t)}),this.updateLineStyleType(Sn.find(o=>o.value===i)??Sn[0])}updateButtonByValue(e,t){const i=this.visibleButtons.findIndex(o=>o.value===e);i!==-1&&this.updateButtonByIndex(i,t)}updateButtonByIndex(e,t){const i=this.visibleButtons.at(e);i&&this.toolbar.updateButtonByIndex(e,{...i.toJson(),...t,value:t.value??i.value})}};d([xs],od.prototype,"enabled",2),d([xs],od.prototype,"buttons",2);import{_ModuleSupport as J0}from"ag-charts-community";var{StateMachine:uy,StateMachineProperty:sd,Vec2:gy,Debug:eA}=J0,we=class extends uy{constructor(e){const t=({context:i})=>{this.node?.drag(this.datum,this.offset,i,this.snapping),e.update()};super("idle",{idle:{dragStart:{target:"dragging",action:({offset:i,context:o})=>{this.hasMoved=!1,this.dragStart=i,this.offset=i,this.node?.dragStart(this.datum,i,o)}}},dragging:{keyDown:t,keyUp:t,drag:({offset:i,context:o})=>{this.hasMoved=gy.lengthSquared(gy.sub(i,this.dragStart))>0,this.offset=i,this.node?.drag(this.datum,i,o,this.snapping),e.update()},dragEnd:{target:uy.parent,action:()=>{this.node?.stopDragging(),this.hasMoved&&e.recordAction("Move annotation"),e.update()}}}}),this.debug=eA.create(!0,"annotations"),this.hasMoved=!1,this.snapping=!1}};d([sd()],we.prototype,"snapping",2),d([sd()],we.prototype,"datum",2),d([sd()],we.prototype,"node",2);import{_ModuleSupport as tA}from"ag-charts-community";import{isObject as iA}from"ag-charts-core";var{Property:oA}=tA,_o=class extends Qh{constructor(){super(...arguments),this.type="arrow-down"}static is(e){return iA(e)&&e.type==="arrow-down"}};d([oA],_o.prototype,"type",2);import{_ModuleSupport as sA}from"ag-charts-community";import{_ModuleSupport as aA}from"ag-charts-community";import{_ModuleSupport as zr}from"ag-charts-community";import{isObject as nA}from"ag-charts-core";import{_ModuleSupport as ad}from"ag-charts-community";import{_ModuleSupport as rA}from"ag-charts-community";var ga=class extends rA.Marker{isPointInPath(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)}},yy=class zk extends ad.Group{constructor(){super(...arguments),this.active=!1,this.locked=!1,this.visible=!1,this.zIndex=1}drag(t){const{handle:i,locked:o}=this;return o?{point:{x:i.x,y:i.y},offset:{x:0,y:0}}:{point:t,offset:{x:t.x-i.x,y:t.y-i.y}}}toggleActive(t){this.active=t,t||(this.handle.strokeWidth=zk.INACTIVE_STROKE_WIDTH)}toggleHovered(t){this.glow.visible=!this.locked&&t,this.glow.dirtyPath=!0}toggleDragging(t){this.locked||(this.handle.visible=!t,this.glow.visible=this.glow.visible&&!t,this.handle.dirtyPath=!0,this.glow.dirtyPath=!0)}toggleLocked(t){this.locked=t}getCursor(){}containsPoint(t,i){return this.handle.containsPoint(t,i)}};yy.INACTIVE_STROKE_WIDTH=2;var Ro=yy,nd=class Fk extends Ro{constructor(){super(),this.handle=new ga({shape:"circle"}),this.glow=new ga({shape:"circle"}),this.append([this.handle]),this.handle.size=Fk.HANDLE_SIZE,this.handle.strokeWidth=Ro.INACTIVE_STROKE_WIDTH,this.handle.zIndex=2}update(t){this.handle.setProperties({...t,strokeWidth:Ro.INACTIVE_STROKE_WIDTH})}drag(t){return{point:t,offset:{x:0,y:0}}}};nd.HANDLE_SIZE=7,nd.GLOW_SIZE=9;var Eo=nd,Fr=class Ft extends Ro{constructor(){super(),this.handle=new ad.Rect,this.glow=new ad.Rect,this.gradient="horizontal",this.append([this.glow,this.handle]),this.handle.cornerRadius=Ft.CORNER_RADIUS,this.handle.width=Ft.HANDLE_SIZE,this.handle.height=Ft.HANDLE_SIZE,this.handle.strokeWidth=Ro.INACTIVE_STROKE_WIDTH,this.handle.zIndex=2,this.glow.cornerRadius=Ft.CORNER_RADIUS,this.glow.width=Ft.GLOW_SIZE,this.glow.height=Ft.GLOW_SIZE,this.glow.strokeWidth=0,this.glow.fillOpacity=.2,this.glow.zIndex=1,this.glow.visible=!1}toggleLocked(t){if(super.toggleLocked(t),t){const i=(Ft.HANDLE_SIZE-Eo.HANDLE_SIZE)/2;this.handle.cornerRadius=1,this.handle.fill=this.handle.stroke,this.handle.strokeWidth=0,this.handle.x+=i,this.handle.y+=i,this.handle.width=Eo.HANDLE_SIZE,this.handle.height=Eo.HANDLE_SIZE,this.glow.width=Eo.GLOW_SIZE,this.glow.height=Eo.GLOW_SIZE}else this.handle.cornerRadius=Ft.CORNER_RADIUS,this.handle.width=Ft.HANDLE_SIZE,this.handle.height=Ft.HANDLE_SIZE,this.glow.width=Ft.GLOW_SIZE,this.glow.height=Ft.GLOW_SIZE,this.cachedStyles&&this.handle.setProperties(this.cachedStyles)}update(t){if(this.cachedStyles={...t},this.active||delete t.strokeWidth,this.locked){delete t.fill,delete t.strokeWidth;const i=(Ft.HANDLE_SIZE-Eo.HANDLE_SIZE)/2;t.x-=i,t.y-=i,this.cachedStyles.x-=i,this.cachedStyles.y-=i}this.handle.setProperties(t),this.glow.setProperties({...t,x:(t.x??this.glow.x)-2,y:(t.y??this.glow.y)-2,strokeWidth:0,fill:t.stroke})}drag(t){return this.locked?{point:t,offset:{x:0,y:0}}:this.gradient==="vertical"?{point:{x:t.x,y:this.handle.y},offset:{x:t.x-this.handle.x,y:0}}:{point:{x:this.handle.x,y:t.y},offset:{x:0,y:t.y-this.handle.y}}}getCursor(){if(!this.locked)return this.gradient==="vertical"?"col-resize":"row-resize"}};Fr.HANDLE_SIZE=12,Fr.GLOW_SIZE=16,Fr.CORNER_RADIUS=4;var ya=Fr,rd=class fr extends Ro{constructor(){super(),this.handle=new ga({shape:"circle"}),this.glow=new ga({shape:"circle"}),this.append([this.glow,this.handle]),this.handle.size=fr.HANDLE_SIZE,this.handle.strokeWidth=Ro.INACTIVE_STROKE_WIDTH,this.handle.zIndex=2,this.glow.size=fr.GLOW_SIZE,this.glow.strokeWidth=0,this.glow.fillOpacity=.2,this.glow.zIndex=1,this.glow.visible=!1}toggleLocked(t){super.toggleLocked(t),t?(this.handle.fill=this.handle.stroke,this.handle.strokeWidth=0,this.handle.size=Eo.HANDLE_SIZE,this.glow.size=Eo.GLOW_SIZE):(this.handle.size=fr.HANDLE_SIZE,this.glow.size=fr.GLOW_SIZE,this.cachedStyles&&this.handle.setProperties(this.cachedStyles))}update(t){this.cachedStyles={...t},this.active||delete t.strokeWidth,this.locked&&(delete t.fill,delete t.strokeWidth),this.handle.setProperties(t),this.glow.setProperties({...t,strokeWidth:0,fill:t.stroke})}getCursor(){return"pointer"}};rd.HANDLE_SIZE=11,rd.GLOW_SIZE=17;var De=rd,{ZIndexMap:lA}=zr,Ze=class extends zr.Group{constructor(){super(...arguments),this.name="AnnotationScene",this.zIndex=lA.CHART_ANNOTATION}static isCheck(e,t){return nA(e)&&Object.hasOwn(e,"type")&&e.type===t}toggleHovered(e,t,i){i!==!0&&this.toggleHandles(e||t)}computeBBoxWithoutHandles(){return zr.Transformable.toCanvas(this,zr.Group.computeChildrenBBox(this.excludeChildren({instance:Ro})))}updateNode(e,t,i){if(!i&&t){t.remove();return}return i&&t==null&&(t=new e,this.appendChild(t)),t}};import{_ModuleSupport as cA}from"ag-charts-community";import{_ModuleSupport as hA}from"ag-charts-community";import{entries as dA}from"ag-charts-core";var{ContinuousScale:pA,Vec2:ai,toRadians:uA}=hA;function bn(e,t,i=!1,o,s=1){if(!i)return Dt(e,t);const a=o?ke(o,t):ai.origin();return Dt(Hr(e,a,s),t)}function Hr(e,t,i){const o=ai.sub(e,t),s=uA(i),a=Math.round(ai.angle(o)/s)*s;return ai.rotate(o,a,t)}function Vr(e,t){const i={};for(const[o,s]of dA(e))i[o]=ke(s,t);return i}function po(e,t,i,o={overflowContinuous:0,translateVectors:void 0,invertYVectors:void 0,snap:void 0}){const{xAxis:s,yAxis:a}=i,n=Object.keys(e),r=[],l=[],c=new Set(o.translateVectors??n),h=new Set(o.invertYVectors??[]),p=new Set([...c,...h]),u=ai.multiply(t,ai.from(1,-1));for(const S of n)p.has(S)&&(e[S]=ai.add(e[S],h.has(S)?u:t),o.snap&&(e[S]=Hr(e[S],o.snap.vectors[S],o.snap.angle))),r.push(s.getRangeOverflow(e[S].x)),l.push(a.getRangeOverflow(e[S].y));const g=(S,v)=>Math.abs(S)-Math.abs(v),y=(S,v,m)=>o.overflowContinuous===0||!pA.is(S)?m.toSorted(g).at(-1)??0:n.length===p.size?m.toSorted(g).at(-o.overflowContinuous-1)??0:m.filter(k=>k!==0).length<=o.overflowContinuous?0:m.filter((k,A)=>k!==0&&Math.abs(k)<=Math.abs(v)&&p.has(n[A])).toSorted(g).at(-1)??0,f=ai.from(y(s.scale,t.x,r),y(a.scale,t.y,l));if(!ai.equal(f,ai.origin()))for(const S of n)p.has(S)&&(e[S]=ai.round(ai.sub(e[S],f),4));const x={};for(const S of n)x[S]=Dt(e[S],i);return x}var{Vec2:gA}=cA,fy=class extends Ze{constructor(){super(...arguments),this.handle=new De,this.anchor={x:0,y:0,position:"above"}}update(e,t){const i=ke(e,t);this.updateHandle(e,i),this.anchor=this.updateAnchor(e,i,t)}dragStart(e,t,i){this.dragState={offset:t,...Vr({handle:e},i)}}drag(e,t,i){const{dragState:o}=this;if(!e.isWriteable()||!o)return;const{point:s}=po({point:o.handle},gA.sub(t,o.offset),i);e.x=s.x,e.y=s.y}translate(e,t,i){if(!e.isWriteable())return;const{point:o}=po({point:ke(e,i)},t,i);e.x=o.x,e.y=o.y}toggleHandles(e){this.handle.visible=!!e,this.handle.toggleHovered(this.activeHandle==="handle")}toggleActive(e){this.toggleHandles(e),this.handle.toggleActive(e)}stopDragging(){this.handle.toggleDragging(!1)}copy(e,t,i){const o=ke(e,i),s=Dt({x:o.x-30,y:o.y-30},i);return t.x=s.x,t.y=s.y,t}getAnchor(){return this.anchor}getCursor(){return"pointer"}containsPoint(e,t){const{handle:i}=this;return this.activeHandle=void 0,i.containsPoint(e,t)?(this.activeHandle="handle",!0):!1}getNodeAtCoords(e,t){if(this.handle.containsPoint(e,t))return"handle"}updateHandle(e,t,i){const{x:o,y:s}=this.getHandleCoords(e,t,i),a=this.getHandleStyles(e);this.handle.update({...a,x:o,y:s}),this.handle.toggleLocked(e.locked??!1)}updateAnchor(e,t,i){const o=this.getHandleCoords(e,t);return{x:o.x+i.seriesRect.x,y:o.y+i.seriesRect.y,position:this.anchor.position}}getHandleCoords(e,t,i){return{x:t.x,y:t.y}}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke,strokeOpacity:e.handle.strokeOpacity,strokeWidth:e.handle.strokeWidth}}},my=class extends fy{constructor(){super(),this.append([this.handle])}update(e,t){super.update(e,t);const i=ke(e,t);this.updateShape(e,i)}updateShape(e,t){this.updateShapeStyles(e),this.updateShapePath(e,t)}updateShapeStyles(e){const{shape:t}=this;t.fill=e.fill,t.fillOpacity=e.fillOpacity??1}updateShapePath(e,t){const{shape:i}=this;i.x=t.x,i.y=t.y,i.size=e.size}containsPoint(e,t){return super.containsPoint(e,t)||this.shape.containsPoint(e,t)}getNodeAtCoords(e,t){return this.shape.containsPoint(e,t)?"shape":super.getNodeAtCoords(e,t)}},xy=[[.5,0],[1,.5],[.75,.5],[.75,1],[.25,1],[.25,.5],[0,.5]];function Sy(e){aA.drawMarkerUnitPolygon(e,xy)}Sy.anchor={x:.5,y:0};var Wr=class extends my{constructor(){super(),this.type="arrow-up",this.shape=new ga({shape:Sy}),this.append([this.shape])}static is(e){return Ze.isCheck(e,"arrow-up")}getHandleCoords(e,t){const i=De.HANDLE_SIZE/2,o=super.getHandleCoords(e,t);return o.y-=i,o}},yA=xy.map(([e,t])=>[e,1-t]);function by(e){sA.drawMarkerUnitPolygon(e,yA)}by.anchor={x:.5,y:1};var Gr=class extends my{constructor(){super(),this.type="arrow-down",this.shape=new ga({shape:by}),this.append([this.shape])}static is(e){return Ze.isCheck(e,"arrow-down")}updateAnchor(e,t,i){const o=super.updateAnchor(e,t,i);return o.y-=e.size,o}getHandleCoords(e,t){const i=De.HANDLE_SIZE/2,o=super.getHandleCoords(e,t);return o.y+=i,o}};import{_ModuleSupport as fA}from"ag-charts-community";var{StateMachine:Kr,StateMachineProperty:mA,Debug:xA}=fA,ld=class extends Kr{constructor(e){const t=({point:o})=>{const s=this.createDatum();s.set({x:o.x,y:o.y}),e.create(s)},i=()=>{this.node?.toggleActive(!0),e.showAnnotationOptions(),e.update()};super("start",{start:{click:{target:"waiting-first-render",action:t},drag:{target:"waiting-first-render",action:t},cancel:Kr.parent,reset:Kr.parent},"waiting-first-render":{render:{target:Kr.parent,action:i}}}),this.debug=xA.create(!0,"annotations")}};d([mA()],ld.prototype,"node",2);var SA=class extends ld{createDatum(){return new _o}},vy={type:"arrow-down",datum:_o,scene:Gr,isDatum:_o.is,translate:(e,t,i,o)=>{_o.is(t)&&Gr.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(_o.is(t)&&_o.is(i)&&Gr.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{_o.is(t)&&Gr.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new SA({...e,create:t("arrow-down")}),dragState:e=>new we(e)};import{_ModuleSupport as bA}from"ag-charts-community";import{isObject as vA}from"ag-charts-core";var{Property:kA}=bA,Bo=class extends Qh{constructor(){super(...arguments),this.type="arrow-up"}static is(e){return vA(e)&&e.type==="arrow-up"}};d([kA],Bo.prototype,"type",2);var DA=class extends ld{createDatum(){return new Bo}},ky={type:"arrow-up",datum:Bo,scene:Wr,isDatum:Bo.is,translate:(e,t,i,o)=>{Bo.is(t)&&Wr.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(Bo.is(t)&&Bo.is(i)&&Wr.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{Bo.is(t)&&Wr.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new DA({...e,create:t("arrow-up")}),dragState:e=>new we(e)};import{_ModuleSupport as MA}from"ag-charts-community";import{_ModuleSupport as Dy}from"ag-charts-community";import{_ModuleSupport as AA}from"ag-charts-community";import{entries as IA}from"ag-charts-core";import{_ModuleSupport as LA}from"ag-charts-community";var{Vec2:TA,Vec4:My}=LA,Ay=class extends Ze{constructor(){super(...arguments),this.overflowContinuous=0}extendLine({x1:e,y1:t,x2:i,y2:o},s,a){const n={x1:e,y1:t,x2:i,y2:o};if(!s.extendStart&&!s.extendEnd)return n;const[r,l]=YM(n,a.yAxis.bounds),c=n.x2=n.y2,p=n.x2===n.x1;return s.extendEnd&&(p?n.y2=h?l.y:r.y:(n.x2=c?r.x:l.x,n.y2=c?r.y:l.y)),s.extendStart&&(p?n.y1=h?r.y:l.y:(n.x1=c?l.x:r.x,n.y1=c?l.y:r.y)),n}dragStart(e,t,i){this.dragState={offset:t,...Vr({start:e.start,end:e.end},i)}}drag(e,t,i,o){e.isWriteable()&&(this.activeHandle?this.dragHandle(e,t,i,o):this.dragAll(e,t,i))}dragAll(e,t,i){const{dragState:o}=this;o&&this.translatePoints(e,o.start,o.end,TA.sub(t,o.offset),i)}translate(e,t,i){e.isWriteable()&&this.translatePoints(e,ke(e.start,i),ke(e.end,i),t,i)}copy(e,t,i){const o=kt(e,i);if(!o)return;const s=this.computeBBoxWithoutHandles(),a={x:-s.width/2,y:-s.height/2};return this.translatePoints(t,My.start(o),My.end(o),a,i),t}translatePoints(e,t,i,o,s){const a=this.getTranslatePointsVectors(t,i),n=po(a,o,s,{overflowContinuous:this.overflowContinuous});e.start.x=n.start.x,e.end.x=n.end.x,e.start.y=n.start.y,e.end.y=n.end.y}getTranslatePointsVectors(e,t){return{start:e,end:t}}},{Vec2:CA,Vec4:Iy}=AA,cd=class extends Ay{constructor(){super(...arguments),this.start=new De,this.end=new De,this.anchor={x:0,y:0,position:"above"}}update(e,t){const i=kt(e,t);i!=null&&(this.updateHandles(e,i),this.updateAnchor(e,i,t))}toggleHandles(e){if(typeof e=="boolean")this.start.visible=e,this.end.visible=e;else for(const[t,i]of IA(e))this[t].visible=i;this.start.toggleHovered(this.activeHandle==="start"),this.end.toggleHovered(this.activeHandle==="end")}toggleActive(e){this.toggleHandles(e),this.start.toggleActive(e),this.end.toggleActive(e)}dragHandle(e,t,i,o){const{activeHandle:s,dragState:a}=this;if(!s||!a)return;this[s].toggleDragging(!0);const n=s==="start"?"end":"start",r=o?{vectors:{[s]:ke(e[n],i)},angle:e.snapToAngle}:void 0,{[s]:l}=po({[s]:a[s]},CA.sub(t,a.offset),i,{overflowContinuous:0,snap:r});e[s].x=l.x,e[s].y=l.y}stopDragging(){this.start.toggleDragging(!1),this.end.toggleDragging(!1)}getAnchor(){return this.anchor}getCursor(){return"pointer"}containsPoint(e,t){const{start:i,end:o}=this;return this.activeHandle=void 0,i.containsPoint(e,t)?(this.activeHandle="start",!0):o.containsPoint(e,t)?(this.activeHandle="end",!0):!1}getNodeAtCoords(e,t){if(this.start.containsPoint(e,t)||this.end.containsPoint(e,t))return"handle"}updateHandles(e,t,i){this.start.update({...this.getHandleStyles(e,"start"),...this.getHandleCoords(e,t,"start")}),this.end.update({...this.getHandleStyles(e,"end"),...this.getHandleCoords(e,t,"end",i)}),this.start.toggleLocked(e.locked??!1),this.end.toggleLocked(e.locked??!1)}updateAnchor(e,t,i,o){this.anchor={x:t.x1+i.seriesRect.x,y:t.y1+i.seriesRect.y,position:this.anchor.position}}getHandleCoords(e,t,i,o){return i==="start"?Iy.start(t):Iy.end(t)}getHandleStyles(e,t){return{fill:e.handle.fill,stroke:e.handle.stroke,strokeOpacity:e.handle.strokeOpacity,strokeWidth:e.handle.strokeWidth}}},{Vec4:Ly}=Dy,NA=class extends cd{constructor(){super(...arguments),this.label=new Dy.Text({zIndex:1}),this.anchor={x:0,y:0,position:"above-left"}}setTextInputBBox(e){this.textInputBBox=e,this.markDirty("TextualStartEndScene")}update(e,t){const i=kt(e,t);if(i==null)return;const o=this.getTextBBox(e,i);this.updateLabel(e,o,i),this.updateHandles(e,i,o),this.updateShape(e,o,i),this.updateAnchor(e,i,t,o)}containsPoint(e,t){return super.containsPoint(e,t)||this.label.containsPoint(e,t)}getNodeAtCoords(e,t){return this.label.containsPoint(e,t)?"text":super.getNodeAtCoords(e,t)}getTextBBox(e,t){const{text:i}=e.getText();return qh(e,i,Ly.end(t),this.textInputBBox)}updateLabel(e,t,i){const{text:o,isPlaceholder:s}=e.getText();$g(this.label,o,s,e,this.getLabelCoords(e,t,i))}updateShape(e,t,i){}getLabelCoords(e,t,i){return Ly.end(i)}getHandleStyles(e,t){return{...super.getHandleStyles(e,t),stroke:e.handle.stroke??e.color}}},{drawCorner:wA,Path:PA}=MA,$r=class extends NA{constructor(){super(),this.type="callout",this.shape=new PA,this.append([this.shape,this.label,this.start,this.end])}static is(e){return Ze.isCheck(e,"callout")}drag(e,t,i,o){e.isWriteable()&&(this.activeHandle==="end"?this.dragHandle(e,t,i,o):this.dragAll(e,t,i))}getLabelCoords(e,t,i){const o=e.getPadding(),{bodyBounds:s={x:0,y:0,width:0,height:0}}=this.getDimensions(e,t,i)??{};return{x:s.x+o.left,y:s.y-o.bottom}}getHandleStyles(e,t){return t==="start"?{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity,strokeWidth:e.handle.strokeWidth}:{fill:void 0,strokeWidth:0}}updateAnchor(e,t,i,o){const{bodyBounds:s}=this.getDimensions(e,o,t)??{},a=s??o;this.anchor={x:a.x+i.seriesRect.x,y:a.y+i.seriesRect.y-a.height,position:this.anchor.position}}updateShape(e,t,i){const{shape:o}=this;o.fill=e.fill,o.fillOpacity=e.fillOpacity??1,o.stroke=e.stroke,o.strokeWidth=e.strokeWidth??1,o.strokeOpacity=e.strokeOpacity??1;const{tailPoint:s,bodyBounds:a}=this.getDimensions(e,t,i)??{};!s||!a||this.updatePath(s,a)}updatePath(e,t){const{x:i,y:o}=e,{x:s,y:a,width:n,height:r}=t,l=a-r,c=s+n,h=this.calculateCalloutPlacement({x:i,y:o},t),p=8,u=[{coordinates:{x0:s,x1:s+p,y0:l+p,y1:l,cx:h==="topLeft"?i:s+p,cy:h==="topLeft"?o:l+p},type:h==="topLeft"?"calloutCorner":"corner"},{coordinates:{x0:s+p,x1:c-p,y0:l,y1:l,cx:i,cy:o},type:h==="top"?"calloutSide":"side"},{coordinates:{x0:c-p,x1:c,y0:l,y1:l+p,cx:h==="topRight"?i:c-p,cy:h==="topRight"?o:l+p},type:h==="topRight"?"calloutCorner":"corner"},{coordinates:{x0:c,x1:c,y0:l+p,y1:a-p,cx:i,cy:o},type:h==="right"?"calloutSide":"side"},{coordinates:{x0:c,x1:c-p,y0:a-p,y1:a,cx:h==="bottomRight"?i:c-p,cy:h==="bottomRight"?o:a-p},type:h==="bottomRight"?"calloutCorner":"corner"},{coordinates:{x0:c-p,x1:s+p,y0:a,y1:a,cx:i,cy:o},type:h==="bottom"?"calloutSide":"side"},{coordinates:{x0:s+p,x1:s,y0:a,y1:a-p,cx:h==="bottomLeft"?i:s+p,cy:h==="bottomLeft"?o:a-p},type:h==="bottomLeft"?"calloutCorner":"corner"},{coordinates:{x0:s,x1:s,y0:a-p,y1:l+p,cx:i,cy:o},type:h==="left"?"calloutSide":"side"}],{path:g}=this.shape;g.clear(),g.moveTo(s,l+p);for(const{coordinates:y,type:f}of u)this.drawPath(g,y,p,f);g.closePath()}drawPath(e,{x0:t,y0:i,x1:o,y1:s,cx:a,cy:n},r,l){switch(l){case"calloutCorner":{e.lineTo(a,n),e.lineTo(o,s);break}case"corner":{wA(e,{x0:t,x1:o,y0:i,y1:s,cx:a,cy:n},r,!1);break}case"calloutSide":{if(t===o){const h=i>s?-1:1,p=Math.min(i,s)+Math.abs(i-s)/2;e.lineTo(t,p-6*h),e.lineTo(a,n),e.lineTo(t,p+6*h),e.lineTo(o,s)}else{const h=t>o?-1:1,p=Math.min(t,o)+Math.abs(o-t)/2;e.lineTo(p-6*h,i),e.lineTo(a,n),e.lineTo(p+6*h,i),e.lineTo(o,s)}break}case"side":default:{e.lineTo(o,s);break}}}calculateCalloutPlacement(e,t){const i=t.x+t.width,o=t.y-t.height;let s,a;return e.x>i?s="right":e.xt.y?a="bottom":e.y{const g=this.createDatum();g.set({start:u,end:u,visible:!0}),e.create(g)},i=()=>{const{node:u}=this;u?.toggleActive(!0),u?.toggleHandles({start:!0})},o=()=>{e.showTextInput(),this.datum&&(this.datum.visible=!1)},s=()=>{e.hideTextInput(),this.datum&&(this.datum.visible=!0),e.deselect()},a=u=>{this.node?.setTextInputBBox(u),e.update()},n=({point:u})=>{const{datum:g,node:y}=this;g?.set({end:u}),y?.toggleActive(!0),y?.toggleHandles({end:!1}),e.update()},r=()=>{e.showAnnotationOptions(),this.node?.toggleHandles({end:!0})},l=({colorPickerType:u,colorOpacity:g,color:y,opacity:f,isMultiColor:x})=>{const{datum:S}=this;S&&(u==="text-color"&&e.updateTextInputColor(y),Er(S,u,g,y,f,x),e.update())},c=u=>{const{datum:g,node:y}=this;!g||!y||!Fi(g)||(g.fontSize=u,e.updateTextInputFontSize(u),e.update())},h=()=>{e.delete()},p=({textInputValue:u,bbox:g})=>{const{datum:y}=this;if(g!=null&&u!=null&&u.length>0){if(!Fi(y))return;const f=Nr(y,u,g.width);y?.set({text:f}),e.update(),e.recordAction(`Create ${y?.type} annotation`)}else e.delete()};super("start",{start:{click:{target:"waiting-first-render",action:t},dragStart:{target:"waiting-first-render",action:t},cancel:vi.parent,reset:vi.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:n,drag:n,click:{target:"edit",action:r},dragEnd:{target:"edit",action:r},reset:{target:vi.parent,action:h},cancel:{target:vi.parent,action:h}},edit:{onEnter:o,updateTextInputBBox:a,color:l,fontSize:c,textInput:[{guard:hd,target:vi.parent,action:h},{guard:dd,target:vi.parent,action:p}],click:{target:vi.parent,action:p},dragStart:{target:vi.parent,action:p},resize:{target:vi.parent,action:p},onExit:s,cancel:{target:vi.parent,action:h}}}),this.debug=_A.create(!0,"annotations")}};d([Ty()],pd.prototype,"datum",2),d([Ty()],pd.prototype,"node",2);var RA=class extends pd{createDatum(){return new bi}},Cy={type:"callout",datum:bi,scene:$r,isDatum:bi.is,translate:(e,t,i,o)=>{if(bi.is(t)&&$r.is(e))return e.translate(t,i,o)},copy:(e,t,i,o)=>{if(bi.is(t)&&bi.is(i)&&$r.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{bi.is(t)&&$r.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new RA({...e,create:t("callout")}),dragState:e=>new we(e)};import{_ModuleSupport as Ny}from"ag-charts-community";import{calcLineHeight as EA}from"ag-charts-core";import{_ModuleSupport as BA}from"ag-charts-community";var ud=class extends fy{constructor(){super(...arguments),this.label=new BA.Text({zIndex:1}),this.anchor={x:0,y:0,position:"above-left"}}setTextInputBBox(e){this.textInputBBox=e,this.markDirty("TextualPointScene")}update(e,t){const i=ke(e,t),o=this.getTextBBox(e,i,t);this.updateLabel(e,o),this.updateHandle(e,i,o),this.updateShape(e,o),this.anchor=this.updateAnchor(e,o,t)}copy(e,t,i){const o=ke(e,i),s=this.getTextBBox(e,o,i),a=e.getPadding(),n=a.left+a.right,r=a.top+a.bottom,l=(s.width+n)/2,c=s.height+r,h=Dt({x:o.x-l,y:o.y-c},i);return t.x=h.x,t.y=h.y,t}containsPoint(e,t){const{label:i}=this;return super.containsPoint(e,t)||i.visible&&i.containsPoint(e,t)}getNodeAtCoords(e,t){return this.label.visible&&this.label.containsPoint(e,t)?"text":super.getNodeAtCoords(e,t)}getTextBBox(e,t,i){const{text:o}=e.getText();return qh(e,o,{x:t.x,y:t.y},this.textInputBBox)}updateLabel(e,t){const{text:i,isPlaceholder:o}=e.getText();$g(this.label,i,o,e,this.getLabelCoords(e,t),this.getTextBaseline(e))}updateShape(e,t){}updateAnchor(e,t,i){return{x:t.x+i.seriesRect.x,y:t.y+i.seriesRect.y-t.height,position:this.anchor.position}}getLabelCoords(e,t){return t}getTextBaseline(e){return e.position=="center"?"middle":e.position}getHandleCoords(e,t,i){return i}getHandleStyles(e){const t=super.getHandleStyles(e);return t.stroke=e.handle.stroke??e.color,t}},{drawCorner:gd}=Ny,jr=class extends ud{constructor(){super(),this.type="comment",this.shape=new Ny.Path,this.append([this.shape,this.label,this.handle])}static is(e){return Ze.isCheck(e,"comment")}updateShape(e,t){const{shape:i}=this;i.fill=e.fill,i.fillOpacity=e.fillOpacity??1,i.stroke=e.stroke??"transparent",i.strokeWidth=e.strokeWidth??1,i.strokeOpacity=e.strokeOpacity??1,this.updatePath(e,t)}getLabelCoords(e,t){const i=e.getPadding();return{x:t.x+i.left,y:t.y-i.bottom}}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke??e.fill,strokeOpacity:e.handle.strokeOpacity,strokeWidth:e.handle.strokeWidth}}updateAnchor(e,t,i){const o=super.updateAnchor(e,t,i),s=e.getPadding();return o.y-=s.bottom+s.top,o}updatePath(e,t){const i=e.getPadding(),{x:o,y:s}=t;let{width:a,height:n}=t;const{fontSize:r}=e,l=i.left+i.right,c=i.top+i.bottom;a=a+l,n=Math.max(n+c,r+c);const h=s-n,p=o+a,u=(EA(r,Cr)+c)/2,{path:g}=this.shape;g.clear(),g.moveTo(o,s),g.lineTo(o,h+u),gd(g,{x0:o,x1:o+u,y0:h+u,y1:h,cx:o+u,cy:h+u},u,!1),g.lineTo(p-u,h),gd(g,{x0:p-u,x1:p,y0:h,y1:h+u,cx:p-u,cy:h+u},u,!1),g.lineTo(p,s-u),gd(g,{x0:p,x1:p-u,y0:s-u,y1:s,cx:p-u,cy:s-u},u,!1),g.closePath()}containsPoint(e,t){return super.containsPoint(e,t)||this.shape.containsPoint(e,t)}};import{_ModuleSupport as zA}from"ag-charts-community";var{StateMachine:uo,StateMachineProperty:wy,Debug:FA}=zA,vn=class extends uo{constructor(e){const t=({point:h})=>{const p=this.createDatum();p.set({x:h.x,y:h.y}),e.create(p)},i=()=>{this.node?.toggleActive(!0),e.showAnnotationOptions(),e.update()},o=()=>{e.showTextInput(),this.datum&&(this.datum.visible=!1)},s=()=>{e.hideTextInput(),this.datum&&(this.datum.visible=!0),e.deselect()},a=h=>{this.node?.setTextInputBBox(h),e.update()},n=({colorPickerType:h,colorOpacity:p,color:u,opacity:g,isMultiColor:y})=>{this.datum&&(h==="text-color"&&e.updateTextInputColor(u),Er(this.datum,h,p,u,g,y),e.update())},r=h=>{const{datum:p,node:u}=this;!p||!u||!Fi(p)||(p.fontSize=h,e.updateTextInputFontSize(h),e.update())},l=()=>{e.delete()},c=({textInputValue:h,bbox:p})=>{if(p!=null&&h!=null&&h.length>0){const{datum:u}=this;if(!Fi(u))return;const g=Nr(u,h,p.width);u?.set({text:g}),e.update(),e.recordAction(`Create ${u?.type} annotation`)}else e.delete()};super("start",{start:{click:{target:"waiting-first-render",action:t},dragStart:{target:"waiting-first-render",action:t},cancel:uo.parent,reset:uo.parent},"waiting-first-render":{render:{target:"edit",action:i}},edit:{onEnter:o,updateTextInputBBox:a,color:n,fontSize:r,textInput:[{guard:hd,target:uo.parent,action:l},{guard:dd,target:uo.parent,action:c}],click:{target:uo.parent,action:c},dragStart:{target:uo.parent,action:c},resize:{target:uo.parent,action:c},onExit:s,cancel:{target:uo.parent,action:l}}}),this.debug=FA.create(!0,"annotations")}};d([wy()],vn.prototype,"datum",2),d([wy()],vn.prototype,"node",2);var HA=class extends vn{createDatum(){return new Ei}},Py={type:"comment",datum:Ei,scene:jr,isDatum:Ei.is,translate:(e,t,i,o)=>{Ei.is(t)&&jr.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(Ei.is(t)&&Ei.is(i)&&jr.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{Ei.is(t)&&jr.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new HA({...e,create:t("comment")}),dragState:e=>new we(e)};import{_ModuleSupport as VA}from"ag-charts-community";import{_ModuleSupport as Yr}from"ag-charts-community";var{calculateLabelTranslation:WA}=Yr,Oy=class extends Yr.Group{constructor(){super({name:"AnnotationAxisLabelGroup"}),this.label=new Yr.Text({zIndex:1}),this.rect=new Yr.Rect;const{label:e}=this;e.fontSize=12,e.fontFamily="Verdana, sans-serif",e.fill="black",e.textBaseline="middle",e.textAlign="center",this.append([this.rect,this.label])}update(e){this.updateLabel(e),this.updateRect(e),this.updatePosition(e)}updateLabel({value:e,styles:t,context:i}){const{fontWeight:o,fontSize:s,fontStyle:a,fontFamily:n,textAlign:r,color:l="white",formatter:c}=t,h=c?c({value:e}):i.formatScaleValue(e,"annotation-label");this.label.setProperties({fontWeight:o,fontSize:s,fontStyle:a,fontFamily:n,textAlign:r,fill:l,text:h})}updateRect({styles:e}){const{rect:t}=this,{cornerRadius:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:n}=e;t.fill=o,t.fillOpacity=s??1,t.stroke=a,t.strokeOpacity=n??1,t.cornerRadius=i??0}updatePosition({x:e,y:t,context:i,styles:{padding:o}}){const{label:s,rect:a}=this,n=s.getBBox()?.clone(),r=o??8,l=o??4,{xTranslation:c,yTranslation:h}=WA({yDirection:!0,padding:i.labelPadding,position:i.position??"left",bbox:n});n.grow(r,"horizontal"),n.grow(l,"vertical");const p=e+c,u=t+h;s.x=p,s.y=u,a.y=u-Math.round(n.height/2),a.x=p-Math.round(n.width/2),a.height=n.height,a.width=n.width}};Oy.className="AxisLabel";import{_ModuleSupport as Ur}from"ag-charts-community";var{Vec2:Hi}=Ur,Pt=class extends Ur.Line{constructor(){super(...arguments),this.growCollisionBox=9,this.clipMask=new Map}setProperties(e){return super.setProperties(e),this.updateCollisionBBox(),this}updateCollisionBBox(){const{growCollisionBox:e,strokeWidth:t,x1:i,y1:o,x2:s,y2:a}=this;let n=t+e;n%2===0&&(n+=1);const r=Hi.from(i,o-Math.floor(n/2)),l=Hi.from(s,a),c=Hi.distance(r,l);this.collisionBBox=new Ur.BBox(r.x,r.y,c,n)}isPointInPath(e,t){const{collisionBBox:i,x1:o,y1:s,x2:a,y2:n}=this;if(!i)return!1;const r=Hi.from(o,s),l=Hi.from(a,n),c=Hi.sub(Hi.from(e,t),r),h=Hi.sub(l,r),p=Hi.rotate(c,Hi.angle(c,h),r);return i.containsPoint(p.x,p.y)??!1}render(e){const{clipMask:t}=this,{ctx:i}=e;if(t.size===0){super.render(e);return}i.save();try{for(const o of this.clipMask.values()){const{x:s,y:a,radius:n}=o;i.beginPath(),i.rect(0,0,i.canvas.width,i.canvas.height),i.ellipse(s,a,n,n,0,Math.PI*2,0,!0),i.clip()}super.render(e)}finally{i.restore()}}setClipMask(e,t){const i=this.clipMask.get(e);Ur.jsonDiff(i,t)!=null&&this.markDirty("CollidableLine"),t?this.clipMask.set(e,t):this.clipMask.delete(e)}};import{_ModuleSupport as GA}from"ag-charts-community";var Ss=class extends GA.TransformableText{constructor(){super(...arguments),this.growCollisionBox={top:4,right:4,bottom:4,left:4}}isPointInPath(e,t){const i=this.fromParentPoint(e,t),o=this.computeBBoxWithoutTransforms();return o?o.grow(this.growCollisionBox).containsPoint(i.x,i.y):!1}};import{_ModuleSupport as KA}from"ag-charts-community";var{Vec2:ft}=KA;function fa(e,t,i,o,s,a,n){if(!a||!s||!o){t.setClipMask(e);return}const{alignment:r,position:l}=o,c=Ry(i,o.fontSize,n),{point:h,textBaseline:p}=Ey(c,l,r);By(s,a,o,h,c.angle,p);const{x:u,y:g,width:y,height:f}=s.getBBox(),x=ft.length(ft.from(y,f)),S={x:u+y/2,y:g+f/2,radius:x/2+ft.length(c.offset)};return l==="center"?t.setClipMask(e,S):t.setClipMask(e),{clipMask:S,numbers:c}}function _y(e,t,i,o,s,a,n){if(!n||!a)return;const{alignment:r,position:l}=o,[c,h]=t.y1<=i.y1?[t,i]:[i,t];let p=c;l==="bottom"?p=h:l==="inside"&&(p={x1:(c.x1+h.x1)/2,y1:(c.y1+h.y1)/2,x2:(c.x2+h.x2)/2,y2:(c.y2+h.y2)/2});const u=Ry(p,o.fontSize,s),{point:g,textBaseline:y}=Ey(u,l==="inside"?"center":l,r,e);By(a,n,o,g,u.angle,y)}function Ry(e,t,i){let[o,s]=ft.from(e);o.x>s.x&&([o,s]=[s,o]);const a=ft.normalized(ft.sub(s,o)),n=ft.angle(a),r=ft.multiply(a,De.HANDLE_SIZE/2+(t??14)/2),l=ft.multiply(a,(i??2)/2+(t??14)/3);return{left:o,right:s,normal:a,angle:n,inset:r,offset:l}}function Ey({left:e,right:t,normal:i,angle:o,inset:s,offset:a},n,r,l){let c;r==="right"?c=ft.sub(t,s):r==="center"?c=ft.add(e,ft.multiply(i,ft.distance(e,t)/2)):c=ft.add(e,s);let h="bottom";return n==="bottom"?(c=ft.rotate(a,o+Math.PI/2,c),h="top"):n==="center"&&!l?h="middle":c=ft.rotate(a,o-Math.PI/2,c),{point:c,textBaseline:h}}function By(e,t,i,o,s,a){e.setProperties({text:t,x:o.x,y:o.y,rotation:s,rotationCenterX:o.x,rotationCenterY:o.y,fill:i.color,fontFamily:i.fontFamily,fontSize:i.fontSize,fontStyle:i.fontStyle,fontWeight:i.fontWeight,textAlign:i.alignment,textBaseline:a})}var{ChartAxisDirection:$A,Vec2:bs,Vec4:yd}=VA,zo=class extends Ze{constructor(){super(),this.type="cross-line",this.line=new Pt,this.middle=new ya,this.isHorizontal=!1,this.append([this.line,this.middle])}static is(e){return Ze.isCheck(e,"cross-line")}update(e,t){const{seriesRect:i}=t;this.seriesRect=i,this.isHorizontal=yt.is(e);const o=this.isHorizontal?t.yAxis:t.xAxis,s=this.convertCrossLine(e,o);if(s==null){this.visible=!1;return}this.visible=e.visible??!0,this.visible&&(this.updateLine(e,s),this.updateHandle(e,s),this.updateText(e,s),this.updateAxisLabel(e,o,s))}updateLine(e,t){const{line:i}=this,{lineDashOffset:o,stroke:s,strokeWidth:a,strokeOpacity:n}=e,{x1:r,y1:l,x2:c,y2:h}=t;i.setProperties({x1:r,y1:l,x2:c,y2:h,lineCap:e.getLineCap(),lineDash:e.getLineDash(),lineDashOffset:o,stroke:s,strokeWidth:a,strokeOpacity:n,fillOpacity:0})}updateHandle(e,t){const{middle:i}=this,{locked:o,stroke:s,strokeWidth:a,strokeOpacity:n}=e,r={fill:e.handle.fill,stroke:e.handle.stroke??s,strokeOpacity:e.handle.strokeOpacity??n,strokeWidth:e.handle.strokeWidth??a},l=bs.sub(yd.center(t),bs.from(i.handle.width/2,i.handle.height/2));i.gradient=this.isHorizontal?"horizontal":"vertical",i.update({...r,...l}),i.toggleLocked(o??!1)}updateText(e,t){this.text=this.updateNode(Ss,this.text,!!e.text.label),fa(this.line.id,this.line,t,e.text,this.text,e.text.label,e.strokeWidth)}createAxisLabel(e){const t=new Oy;return e.attachLabel(t),t}updateAxisLabel(e,t,i){this.axisLabel??(this.axisLabel=this.createAxisLabel(t));const{axisLabel:o,seriesRect:s}=this,{direction:a,position:n}=t;if(e.axisLabel.enabled){o.visible=this.visible;const r=n==="left"||n==="top"?yd.start(i):yd.end(i),l=a===$A.X?r.x:r.y;if(!t.inRange(l)){o.visible=!1;return}const c=Fe(e.value);o.update({...bs.add(r,bs.required(s)),value:c,styles:e.axisLabel,context:t})}else o.visible=!1}setAxisLabelOpacity(e){this.axisLabel&&(this.axisLabel.opacity=e)}setAxisLabelVisible(e){this.axisLabel&&(this.axisLabel.visible=e)}toggleHandles(e){this.middle.visible=e,this.middle.toggleHovered(this.activeHandle==="middle")}destroy(){super.destroy(),this.axisLabel?.destroy()}toggleActive(e){this.toggleHandles(e),this.middle.toggleActive(e)}dragStart(e,t,i){const o=yt.is(e)?{x:t.x,y:oo(e.value,i.yAxis)}:{x:oo(e.value,i.xAxis),y:t.y};this.dragState={offset:t,middle:o}}drag(e,t,i){const{activeHandle:o,dragState:s}=this;!e.isWriteable()||!s||(o&&this[o].toggleDragging(!0),this.translatePoint(e,s.middle,bs.sub(t,s.offset),i))}translate(e,t,i){if(!e.isWriteable())return;const o=yt.is(e)?bs.from(0,oo(e.value,i.yAxis)):bs.from(oo(e.value,i.xAxis),0);this.translatePoint(e,o,t,i)}translatePoint(e,t,i,o){const s=yt.is(e);s?i.x=0:i.y=0;const{point:a}=po({point:t},i,o);e.value=s?a.y:a.x}stopDragging(){this.middle.toggleDragging(!1)}copy(e,t,i){const o=yt.is(e),s=this.isHorizontal?i.yAxis:i.xAxis,a=this.convertCrossLine(e,s);if(!a)return;const n=o?-30:0,r=o?0:-30,l=Dt({x:a.x1+r,y:a.y1+n},i);return t.set({value:o?l.y:l.x}),t}getCursor(){return this.activeHandle==null?"pointer":this[this.activeHandle].getCursor()}containsPoint(e,t){const{middle:i,line:o,text:s}=this;return this.activeHandle=void 0,i.containsPoint(e,t)?(this.activeHandle="middle",!0):o.isPointInPath(e,t)||!!s?.containsPoint(e,t)}getNodeAtCoords(e,t){if(this.text?.containsPoint(e,t))return"text";if(this.line.isPointInPath(e,t))return"line";if(this.middle.containsPoint(e,t))return"handle"}getAnchor(){const e=this.computeBBoxWithoutHandles();return this.isHorizontal?{x:e.x+e.width/2,y:e.y}:{x:e.x+e.width,y:e.y+e.height/2,position:"right"}}convertCrossLine(e,t){if(e.value==null)return;let i=0,o=0,s,a;const{bounds:n}=t,r=oo(e.value,t);return yt.is(e)?(s=n.width,o=r,a=r):(i=r,s=r,a=n.height),{x1:i,y1:o,x2:s,y2:a}}};import{_ModuleSupport as jA}from"ag-charts-community";var{StateMachine:Xr,StateMachineProperty:YA,Debug:UA}=jA,fd=class extends Xr{constructor(e,t){const i=({point:s})=>{const a=e==="horizontal",n=a?new yt:new Bi;n.set({value:a?s.y:s.x}),t.create(n),t.recordAction(`Create ${a?"horizontal-line":"vertical-line"} annotation`)},o=()=>{this.node?.toggleActive(!0),t.showAnnotationOptions(),t.update()};super("start",{start:{click:{target:"waiting-first-render",action:i},drag:{target:"waiting-first-render",action:i},reset:Xr.parent,cancel:Xr.parent},"waiting-first-render":{render:{target:Xr.parent,action:o}}}),this.debug=UA.create(!0,"annotations")}};d([YA()],fd.prototype,"node",2);var zy={type:"horizontal-line",datum:yt,scene:zo,isDatum:yt.is,translate:(e,t,i,o)=>{yt.is(t)&&zo.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(yt.is(t)&&yt.is(i)&&zo.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{yt.is(t)&&zo.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new fd("horizontal",{...e,create:t("horizontal-line")}),dragState:e=>new we(e)},Fy={type:"vertical-line",datum:Bi,scene:zo,isDatum:Bi.is,translate:(e,t,i,o)=>{Bi.is(t)&&zo.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(Bi.is(t)&&Bi.is(i)&&zo.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{Bi.is(t)&&zo.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new fd("vertical",{...e,create:t("vertical-line")}),dragState:e=>new we(e)};import{_ModuleSupport as XA}from"ag-charts-community";import{_ModuleSupport as Hy}from"ag-charts-community";import{_ModuleSupport as ZA}from"ag-charts-community";var{Vec4:qA}=ZA,Vy=class{static updateBackground(e,t,i,o){const{background:s}=this,{seriesRect:a}=o;s.path.clear(!0);const n=qA.from(0,0,a.width,a.height),r=this.getBackgroundPoints(e,t,i,n);for(let c=0;ct.x2,a=t.y1>t.y2,n=a?o.y2:o.y1,r=a?o.y1:o.y2,l=ni.from(t);return e.extendEnd&&t.y2===r&&l.push(ni.from(s?o.x1:o.x2,a?o.y1:o.y2)),e.extendEnd&&i.y2===n&&l.push(ni.from(s?o.x1:o.x2,a?o.y2:o.y1)),l.push(...ni.from(i).reverse()),e.extendStart&&i.y1===r&&l.push(ni.from(s?o.x2:o.x1,a?o.y1:o.y2)),e.extendStart&&t.y1===n&&l.push(ni.from(s?o.x2:o.x1,a?o.y2:o.y1)),l}};import{_ModuleSupport as QA}from"ag-charts-community";import{isNumber as ma}from"ag-charts-core";var{StateMachine:Ho,StateMachineProperty:md,Debug:JA}=QA,qr=class extends Ho{constructor(e){const t=({point:l})=>{const c=new ii;c.set({start:l,end:l,startHeight:0,endHeight:0}),e.create(c)},i=()=>{const{node:l}=this;l?.toggleActive(!0),l?.toggleHandles({topLeft:!0,topRight:!1,bottomLeft:!1,bottomRight:!1})},o=({offset:l,context:c})=>{const{datum:h,snapping:p}=this;h&&(h.set({end:bn(l,c,p,h.start,h.snapToAngle)}),e.update())},s=()=>{this.node?.toggleHandles({topRight:!0}),e.update()},a=({point:l})=>{const{datum:c,node:h}=this,p=Fe(c?.end.y),u=Fe(c?.start.y),{y:g}=l;if(c==null||!ma(u)||!ma(p)||!ma(g))return;const y=p-(g??0),f=(u-p)*2+y,x={x:c?.start.x,y:u-f},S={x:c?.end.x,y:l.y};h?.toggleHandles({bottomLeft:!0,bottomRight:!0}),!(!e.validatePoint(x,{overflowContinuous:!0})||!e.validatePoint(S,{overflowContinuous:!0}))&&(c.set({startHeight:f,endHeight:y}),e.update())},n=({point:l})=>{const{datum:c,node:h}=this,p=Fe(c?.end.y),u=Fe(c?.start.y),{y:g}=l;if(c==null||!ma(u)||!ma(p)||!ma(g))return;const y=p-(g??0),f=(u-p)*2+y,x={x:c.start.x,y:u-y},S={x:c.end.x,y:l.y};h?.toggleHandles(!0),!(!e.validatePoint(x,{overflowContinuous:!0})||!e.validatePoint(S,{overflowContinuous:!0}))&&(c.set({startHeight:f,endHeight:y}),e.recordAction("Create disjoint-channel annotation"),e.showAnnotationOptions(),e.update())},r=()=>e.delete();super("start",{start:{click:{target:"waiting-first-render",action:t},drag:{target:"waiting-first-render",action:t},reset:Ho.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:o,drag:o,click:{target:"height",action:s},dragEnd:{target:"height",action:s},reset:{target:Ho.parent,action:r},cancel:{target:Ho.parent,action:r}},height:{hover:a,click:{target:Ho.parent,action:n},drag:{target:Ho.parent,action:n},reset:{target:Ho.parent,action:r},cancel:{target:Ho.parent,action:r}}}),this.debug=JA.create(!0,"annotations"),this.snapping=!1}};d([md()],qr.prototype,"datum",2),d([md()],qr.prototype,"node",2),d([md()],qr.prototype,"snapping",2);var Gy={type:"disjoint-channel",datum:ii,scene:Zr,isDatum:ii.is,translate:(e,t,i,o)=>{ii.is(t)&&Zr.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(ii.is(t)&&ii.is(i)&&Zr.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{ii.is(t)&&Zr.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new qr({...e,create:t("disjoint-channel")}),dragState:e=>new we(e)};import{_ModuleSupport as eI}from"ag-charts-community";import{entries as tI}from"ag-charts-core";import{_ModuleSupport as go}from"ag-charts-community";var xd=[0,23.6,38.2,50,61.8,78.6,100],iI=[161.8,261.8,361.8,423.6],oI=[...xd,...iI],sI={10:oI,6:xd,4:xd.filter(e=>e!==78.6&&e!==23.6)},aI=10;function nI(e,t){const{x2:i,y1:o,y2:s}=e,a=o-s;return t==null?{x1:i,x2:i,y1:s-a,y2:s}:{x1:t.x1,x2:t.x2,y1:t.y2-a,y2:t.y2}}function Ky({x1:e,y1:t,x2:i,y2:o},s,a,n,r=10){const l=t-o,c=a?-1:1;let h=n;const p=[];for(const[u,g]of sI[r].entries()){const y=n+l*(g/100)*c,f=s.yAxis.scaleInvert(y);p.push({id:u,x1:e,x2:i,y1:h,y2:y,tag:g==100?0:1,label:{x1:Math.min(e,i)-aI,x2:i,y1:y,y2:y,text:`${(g/100).toFixed(3)} (${f.toFixed(2)})`}}),h=y}return p}var{Vec2:rI,Vec4:$y}=go,jy=class extends Ze{constructor(){super(),this.trendLine=new Pt,this.rangeFillsGroup=new go.Group({name:`${this.id}-range-fills`}),this.rangeFillsGroupSelection=go.Selection.select(this.rangeFillsGroup,go.Range),this.rangeStrokesGroup=new go.Group({name:`${this.id}-range-strokes`}),this.rangeStrokesGroupSelection=go.Selection.select(this.rangeStrokesGroup,Pt),this.labelsGroup=new go.Group({name:`${this.id}-ranges-labels`}),this.labelsGroupSelection=go.Selection.select(this.labelsGroup,Ss),this.anchor={x:0,y:0,position:"above"},this.append([this.trendLine,this.rangeFillsGroup,this.rangeStrokesGroup,this.labelsGroup])}update(e,t){let i=kt(e,t);if(i==null){this.visible=!1;return}if(i=$y.round(i),this.visible=e.visible??!0,!this.visible)return;this.updateLine(e,i,this.trendLine),this.updateHandles(e,i),this.updateAnchor(e,i,t);const{reverse:o}=e,s=this.extendLine(i,e,t),a=o?s.y1:s.y2,n=o?s.y2:s.y1,r=Ky(s,t,e.reverse,a,e.bands);this.updateRanges(e,r,t);const l={...s,y1:n,y2:n};this.updateText(e,l)}extendLine({x1:e,y1:t,x2:i,y2:o},s,a){const n={x1:e,y1:t,x2:i,y2:o};if(!s.extendStart&&!s.extendEnd)return n;const{x:r,width:l}=a.xAxis.bounds;return s.extendEnd&&(n[e>i?"x1":"x2"]=r+l),s.extendStart&&(n[e>i?"x2":"x1"]=r),n}updateLine(e,t,i){if(!t||!i)return;const{lineDashOffset:o,strokeWidth:s,strokeOpacity:a,stroke:n}=e;i.setProperties({...t,lineCap:e.getLineCap(),lineDash:[3,4],lineDashOffset:o,strokeWidth:s,strokeOpacity:a,fillOpacity:0,stroke:n})}updateRangeStrokes(e){const{lineDashOffset:t,strokeWidth:i,strokeOpacity:o,strokes:s,rangeStroke:a,isMultiColor:n}=e;this.rangeStrokesGroupSelection.each((r,{x1:l,x2:c,y2:h,tag:p},u)=>{const g=h,y=n?s[u%s.length]:a;r.setProperties({x1:l,x2:c,y1:g,y2:g,stroke:y,strokeOpacity:o,strokeWidth:i,lineCap:e.getLineCap(),lineDash:e.getLineDash(),lineDashOffset:t,tag:p})})}updateRanges(e,t,i){const o=s=>s.id;this.rangeFillsGroupSelection.update(t,void 0,o),this.rangeStrokesGroupSelection.update(t,void 0,o),this.labelsGroupSelection.update(t,void 0,o),this.updateRangeFills(e),this.updateRangeStrokes(e),this.updateRangeLabels(e,i)}updateRangeFills(e){const{lineDashOffset:t,strokeWidth:i,strokeOpacity:o,strokes:s,rangeStroke:a,showFill:n,isMultiColor:r}=e;this.rangeFillsGroupSelection.each((l,{x1:c,x2:h,y1:p,y2:u},g)=>{const y=r?s[g%s.length]:a;if(!n){l.visible=!1;return}l.setProperties({x1:c,x2:h,y1:p,y2:u,startLine:!1,endLine:!1,stroke:y,strokeOpacity:o,fill:y,fillOpacity:(o??1)*.15,strokeWidth:i,lineCap:e.getLineCap(),lineDash:e.getLineDash(),lineDashOffset:t,visible:!0})})}updateRangeLabels(e,{xAxis:t}){const{rangeStrokesGroupSelection:i}=this,{strokes:o,strokeWidth:s,rangeStroke:a,isMultiColor:n,label:{fontFamily:r,fontSize:l,fontStyle:c,fontWeight:h,color:p}}=e,u={fontFamily:r,fontSize:l,fontStyle:c,fontWeight:h},g=this.checkWithinBounds(t,u,this.labelsGroupSelection.at(0));this.labelsGroupSelection.each((y,f,x)=>{const S=p??(n?o[x%o.length]:a),v=i.at(x);if(!v)return;const{text:m,...b}=f.label;if(g)y.setProperties({...u,text:m,x:b.x1,y:b.y1,textBaseline:"middle",textAlign:"end",fill:S}),fa(y.id,v,b);else{const k={...u,label:m,position:"center",alignment:"left",color:S};fa(y.id,v,b,k,y,m,s)}})}checkWithinBounds(e,t,i){if(!i)return!1;const{text:o,...s}=i.datum.label;i.setProperties({...t,text:o,x:s.x1,y:s.y1,textBaseline:"middle",textAlign:"end"});const{x:a}=i.getBBox();return a>=e.bounds.x&&a<=e.bounds.x+e.bounds.width}updateText(e,t){const i=this.rangeStrokesGroupSelection.selectByTag(0)[0];if(!i)return;const{text:o,strokeWidth:s}=e;this.text=this.updateNode(Ss,this.text,!!o.label),fa(i.id,i,t,o,this.text,o.label,s)}updateAnchor(e,t,i,o){const s=$y.topCenter(t);rI.apply(this.anchor,go.Transformable.toCanvasPoint(this.trendLine,s.x,s.y))}containsPoint(e,t){const{trendLine:i,rangeStrokesGroupSelection:o,text:s}=this;let a=!1;return o.each(n=>a||(a=n.isPointInPath(e,t))),a||i.isPointInPath(e,t)||!!s?.containsPoint(e,t)}getNodeAtCoords(e,t){if(this.text?.containsPoint(e,t))return"text";if(this.trendLine.isPointInPath(e,t))return"line"}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity??e.strokeOpacity,strokeWidth:e.handle.strokeWidth??e.strokeWidth}}drag(e,t,i,o){e.isWriteable()&&(this.activeHandle?this.dragHandle(e,t,i,o):this.dragAll(e,t,i))}getAnchor(){return this.anchor}getCursor(){return"pointer"}};import{_ModuleSupport as lI}from"ag-charts-community";import{Logger as Yy}from"ag-charts-core";var{ContinuousScale:Uy}=lI;function Qr(e,t,i={overflowContinuous:!1},o){if(t.x==null||t.y==null)return o&&Yy.warnOnce(`${o}requires both an [x] and [y] property, ignoring.`),!1;const{xAxis:s,yAxis:a}=e,n=i.overflowContinuous&&Uy.is(s.scale),r=i.overflowContinuous&&Uy.is(a.scale),l=n||Xy(t.x,s),c=r||Xy(t.y,a);if(l&&c)return!0;if(o){let h="x & y domains";l&&(h="y domain"),c&&(h="x domain");const p=Fe(t.x),u=Fe(t.y);Yy.warnOnce(`${o}is outside the ${h}, ignoring. - x: [${p}], y: ${u}]`)}return!1}function Xy(e,t){const{domain:i}=t.scale,o=Fe(e);return i&&o!=null&&t.continuous?o>=i[0]&&o<=i.at(-1):!0}var{Vec2:cI,Vec4:vs}=eI,Jr=class extends jy{constructor(){super(),this.type="fibonacci-retracement-trend-based",this.endRetracementLine=new Pt,this.start=new De,this.end=new De,this.endRetracement=new De,this.append([this.endRetracementLine,this.start,this.end,this.endRetracement])}static is(e){return Ze.isCheck(e,"fibonacci-retracement-trend-based")}update(e,t){let{coords1:i,coords2:o}=this.getCoords(e,t);if(i==null||o==null){this.visible=!1;return}if(i=vs.round(i),o=vs.round(o),this.visible=e.visible??!0,!this.visible)return;(e.endRetracement.x==null||e.endRetracement.y==null)&&(o=void 0),this.updateLine(e,i,this.trendLine),this.updateLine(e,o,this.endRetracementLine),this.updateHandles(e,i,o),this.updateAnchor(e,o??i,t);const{reverse:s,bands:a}=e,n=nI(i,o),r=this.extendLine(n,e,t),l=r.y2,c=r.y1,h=o?Ky(r,t,s,l,a):[];this.updateRanges(e,h,t);const p={...r,y1:c,y2:c};this.updateText(e,p)}containsPoint(e,t){const{start:i,end:o,endRetracement:s,endRetracementLine:a}=this;return this.activeHandle=void 0,i.containsPoint(e,t)?(this.activeHandle="start",!0):o.containsPoint(e,t)?(this.activeHandle="end",!0):s.containsPoint(e,t)?(this.activeHandle="endRetracement",!0):a.isPointInPath(e,t)||super.containsPoint(e,t)}getNodeAtCoords(e,t){return this.start.containsPoint(e,t)||this.end.containsPoint(e,t)||this.endRetracement.containsPoint(e,t)?"handle":this.endRetracementLine.isPointInPath(e,t)?"line":super.getNodeAtCoords(e,t)}dragStart(e,t,i){this.dragState={offset:t,...Vr({start:e.start,end:e.end,endRetracement:e.endRetracement},i)}}stopDragging(){this.start.toggleDragging(!1),this.end.toggleDragging(!1),this.endRetracement.toggleDragging(!1)}dragAll(e,t,i){const{dragState:o}=this;o&&this.translatePoints({datum:e,start:o.start,end:o.end,endRetracement:o.endRetracement,translation:cI.sub(t,o.offset),context:i})}dragHandle(e,t,i,o){const{activeHandle:s,dragState:a}=this;if(!s||!a)return;this[s].toggleDragging(!0);const n=o?this.snapToAngle(e,t,i):Dt(this[s].drag(t).point,i);!n||!Qr(i,n)||(e[s].x=n.x,e[s].y=n.y)}snapToAngle(e,t,i){const{activeHandle:o}=this,s=["start","end","endRetracement"];if(!o)return;const a=(s.indexOf(o)+1)%s.length,n=s[a];this[o].toggleDragging(!0);const r=ke(e[n],i);return Dt(Hr(t,r,e.snapToAngle),i)}translatePoints({datum:e,start:t,end:i,endRetracement:o,translation:s,context:a}){const n=po({start:t,end:i,endRetracement:o},s,a,{overflowContinuous:2});e.start.x=n.start.x,e.end.x=n.end.x,e.endRetracement.x=n.endRetracement.x,e.start.y=n.start.y,e.end.y=n.end.y,e.endRetracement.y=n.endRetracement.y}translate(e,t,i){this.translatePoints({datum:e,start:ke(e.start,i),end:ke(e.end,i),endRetracement:ke(e.endRetracement,i),translation:t,context:i})}copy(e,t,i){const{coords1:o,coords2:s}=this.getCoords(e,i);if(!o||!s)return;const a=this.computeBBoxWithoutHandles();return this.translatePoints({datum:t,start:vs.start(o),end:vs.end(o),endRetracement:vs.end(s),translation:{x:-a.width/2,y:-a.height/2},context:i}),t}getCoords(e,t){return{coords1:kt(e,t),coords2:kt({start:e.end,end:e.endRetracement},t)}}toggleHandles(e){if(typeof e=="boolean")this.start.visible=e,this.end.visible=e,this.endRetracement.visible=e;else for(const[t,i]of tI(e))this[t].visible=i;this.start.toggleHovered(this.activeHandle==="start"),this.end.toggleHovered(this.activeHandle==="end"),this.endRetracement.toggleHovered(this.activeHandle==="endRetracement")}toggleActive(e){this.toggleHandles(e),this.start.toggleActive(e),this.end.toggleActive(e),this.endRetracement.toggleActive(e)}updateHandles(e,t,i,o){this.start.update({...this.getHandleStyles(e),...this.getHandleCoords(e,t,"start")}),this.end.update({...this.getHandleStyles(e),...this.getHandleCoords(e,t,"end",o)}),i&&this.endRetracement.update({...this.getHandleStyles(e),...this.getHandleCoords(e,i,"endRetracement",o)}),this.start.toggleLocked(e.locked??!1),this.end.toggleLocked(e.locked??!1),this.endRetracement.toggleLocked(e.locked??!1)}getHandleCoords(e,t,i,o){return i==="start"?vs.start(t):vs.end(t)}};import{_ModuleSupport as hI}from"ag-charts-community";var{StateMachine:Vo,StateMachineProperty:Sd,Debug:dI}=hI,el=class extends Vo{constructor(e){const t=({point:c})=>{const h=this.createDatum();h.set({start:c,end:c}),e.create(h)},i=()=>{const{node:c}=this;c?.toggleActive(!0),c?.toggleHandles({start:!0,end:!1,endRetracement:!1})},o=({offset:c,context:h})=>{const{datum:p,snapping:u}=this;p&&(p.set({end:bn(c,h,u,p.start,p.snapToAngle)}),e.update())},s=()=>{const{datum:c}=this;c&&(c.endRetracement.x=c.end.x,c.endRetracement.y=c.end.y,this.node?.toggleHandles({end:!0}),e.update())},a=({offset:c,context:h})=>{const{datum:p,snapping:u}=this;p&&(p.set({endRetracement:bn(c,h,u,p.end,p.snapToAngle)}),e.update())},n=()=>{this.node?.toggleHandles({endRetracement:!0}),e.update()},r=()=>e.delete(),l=()=>{e.showAnnotationOptions(),e.recordAction(`Create ${this.datum?.type} annotation`)};super("start",{start:{click:{target:"waiting-first-render",action:t},drag:{target:"waiting-first-render",action:t},reset:Vo.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:o,click:{target:"endRetracement",action:s},drag:o,dragEnd:{target:"endRetracement",action:s},reset:{target:Vo.parent,action:r},cancel:{target:Vo.parent,action:r},onExit:l},endRetracement:{hover:a,click:{target:Vo.parent,action:n},drag:{target:Vo.parent,action:n},reset:{target:Vo.parent,action:r},cancel:{target:Vo.parent,action:r}}}),this.debug=dI.create(!0,"annotations"),this.snapping=!1}createDatum(){return new zi}};d([Sd()],el.prototype,"datum",2),d([Sd()],el.prototype,"node",2),d([Sd()],el.prototype,"snapping",2);var Zy={type:"fibonacci-retracement-trend-based",datum:zi,scene:Jr,isDatum:zi.is,translate:(e,t,i,o)=>{zi.is(t)&&Jr.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(zi.is(t)&&zi.is(i)&&Jr.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{zi.is(t)&&Jr.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new el({...e,create:t("fibonacci-retracement-trend-based")}),dragState:e=>new we(e)};import{_ModuleSupport as pI}from"ag-charts-community";import{entries as uI}from"ag-charts-core";var{Vec2:gI,Vec4:qy}=pI,tl=class extends jy{constructor(){super(),this.type="fibonacci-retracement",this.start=new De,this.end=new De,this.append([this.start,this.end])}static is(e){return Ze.isCheck(e,"fibonacci-retracement")}containsPoint(e,t){const{start:i,end:o}=this;return this.activeHandle=void 0,i.containsPoint(e,t)?(this.activeHandle="start",!0):o.containsPoint(e,t)?(this.activeHandle="end",!0):super.containsPoint(e,t)}getNodeAtCoords(e,t){return this.start.containsPoint(e,t)||this.end.containsPoint(e,t)?"handle":super.getNodeAtCoords(e,t)}dragStart(e,t,i){this.dragState={offset:t,...Vr({start:e.start,end:e.end},i)}}stopDragging(){this.start.toggleDragging(!1),this.end.toggleDragging(!1)}dragAll(e,t,i){const{dragState:o}=this;o&&this.translatePoints({datum:e,start:o.start,end:o.end,translation:gI.sub(t,o.offset),context:i})}dragHandle(e,t,i,o){const{activeHandle:s,dragState:a}=this;if(!s||!a)return;this[s].toggleDragging(!0);const n=o?this.snapToAngle(e,t,i):Dt(this[s].drag(t).point,i);!n||!Qr(i,n)||(e[s].x=n.x,e[s].y=n.y)}snapToAngle(e,t,i){const{activeHandle:o}=this,a=["start","end"].find(r=>r!==o);if(!o||!a)return;this[o].toggleDragging(!0);const n=ke(e[a],i);return Dt(Hr(t,n,e.snapToAngle),i)}translatePoints({datum:e,start:t,end:i,translation:o,context:s}){const a=po({start:t,end:i},o,s,{overflowContinuous:1});e.start.x=a.start.x,e.end.x=a.end.x,e.start.y=a.start.y,e.end.y=a.end.y}translate(e,t,i){this.translatePoints({datum:e,start:ke(e.start,i),end:ke(e.end,i),translation:t,context:i})}copy(e,t,i){const o=kt(e,i);if(!o)return;const s=this.computeBBoxWithoutHandles();return this.translatePoints({datum:t,start:{x:o.x1,y:o.y1},end:{x:o.x2,y:o.y2},translation:{x:-s.width/2,y:-s.height/2},context:i}),t}toggleHandles(e){if(typeof e=="boolean")this.start.visible=e,this.end.visible=e;else for(const[t,i]of uI(e))this[t].visible=i;this.start.toggleHovered(this.activeHandle==="start"),this.end.toggleHovered(this.activeHandle==="end")}toggleActive(e){this.toggleHandles(e),this.start.toggleActive(e),this.end.toggleActive(e)}updateHandles(e,t,i,o){this.start.update({...this.getHandleStyles(e),...this.getHandleCoords(e,t,"start")}),this.end.update({...this.getHandleStyles(e),...this.getHandleCoords(e,t,"end",o)}),this.start.toggleLocked(e.locked??!1),this.end.toggleLocked(e.locked??!1)}getHandleCoords(e,t,i,o){return i==="start"?qy.start(t):qy.end(t)}};import{_ModuleSupport as yI}from"ag-charts-community";var{StateMachine:xa,StateMachineProperty:bd,Debug:fI}=yI,Sa=class extends xa{constructor(e){const t=({point:r})=>{const l=this.createDatum();l.set({start:r,end:r}),e.create(l)},i=()=>{const{node:r}=this;r?.toggleActive(!0),r?.toggleHandles({start:!0,end:!1})},o=({offset:r,context:l})=>{const{datum:c,snapping:h}=this;c&&(c.set({end:bn(r,l,h,c.start,c.snapToAngle)}),e.update())},s=()=>{this.node?.toggleHandles({end:!0}),e.update()},a=()=>e.delete(),n=()=>{e.showAnnotationOptions(),e.recordAction(`Create ${this.datum?.type} annotation`)};super("start",{start:{click:{target:"waiting-first-render",action:t},drag:{target:"waiting-first-render",action:t},reset:xa.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:o,click:{target:xa.parent,action:s},drag:o,dragEnd:{target:xa.parent,action:s},reset:{target:xa.parent,action:a},cancel:{target:xa.parent,action:a},onExit:n}}),this.debug=fI.create(!0,"annotations"),this.snapping=!1}};d([bd()],Sa.prototype,"datum",2),d([bd()],Sa.prototype,"node",2),d([bd()],Sa.prototype,"snapping",2);var mI=class extends Sa{createDatum(){return new ao}},xI=class extends Sa{createDatum(){return new no}},SI=class extends Sa{createDatum(){return new lo}},Qy={type:"fibonacci-retracement",datum:lo,scene:tl,isDatum:lo.is,translate:(e,t,i,o)=>{lo.is(t)&&tl.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(lo.is(t)&&lo.is(i)&&tl.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{lo.is(t)&&tl.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new SI({...e,create:t("fibonacci-retracement")}),dragState:e=>new we(e)};import{_ModuleSupport as Jy}from"ag-charts-community";import{_ModuleSupport as vd}from"ag-charts-community";var{Vec2:kn}=vd,bI=class extends vd.Group{},il=class extends bI{constructor(){super(),this.type="arrow",this.path=new vd.Path,this.armLength=6,this.append([this.path])}update(e){const{path:t}=this,{x:i,y:o,angle:s,...a}=e,n=kn.from(i,o),r=3*Math.PI/4,l=this.armLength+(e.strokeWidth??0)*2,c=kn.rotate(kn.from(0,l),s+r,n),h=kn.rotate(kn.from(l,0),s-r,n);t.setProperties(a),t.fillOpacity=0,t.path.clear(),t.path.moveTo(c.x,c.y),t.path.lineTo(n.x,n.y),t.path.lineTo(h.x,h.y)}},{Vec2:ki,Vec4:ef}=Jy,Wo=class extends cd{constructor(){super(),this.type="line",this.line=new Pt,this.append([this.line,this.start,this.end])}static is(e){return Ze.isCheck(e,"line")}update(e,t){let i=kt(e,t);if(i==null){this.visible=!1;return}i=ef.round(i),this.visible=e.visible??!0,this.visible&&(this.updateLine(e,i,t),this.updateHandles(e,i),this.updateText(e,i),this.updateCaps(e,i),this.updateAnchor(e,i,t))}updateLine(e,t,i){const{line:o}=this,{lineDashOffset:s,stroke:a,strokeWidth:n,strokeOpacity:r}=e,l=this.extendLine(t,e,i);o.setProperties({...l,lineCap:e.getLineCap(),lineDash:e.getLineDash(),lineDashOffset:s,stroke:a,strokeWidth:n,strokeOpacity:r,fillOpacity:0})}updateText(e,t){this.text=this.updateNode(Ss,this.text,!!e.text.label),fa(this.line.id,this.line,t,e.text,this.text,e.text.label,e.strokeWidth)}updateCaps(e,t){if(!e.startCap&&this.startCap&&(this.startCap.remove(),this.startCap=void 0),!e.endCap&&this.endCap&&(this.endCap.remove(),this.endCap=void 0),!e.startCap&&!e.endCap)return;const{stroke:i,strokeWidth:o,strokeOpacity:s}=e,[a,n]=ki.from(t),r=ki.angle(ki.sub(n,a));e.startCap&&(this.startCap&&this.startCap.type!==e.startCap&&(this.startCap.remove(),this.startCap=void 0),this.startCap==null&&(this.startCap=new il,this.append([this.startCap])),this.startCap.update({x:a.x,y:a.y,angle:r-Math.PI,stroke:i,strokeWidth:o,strokeOpacity:s})),e.endCap&&(this.endCap&&this.endCap.type!==e.endCap&&(this.endCap.remove(),this.endCap=void 0),this.endCap==null&&(this.endCap=new il,this.append([this.endCap])),this.endCap.update({x:n.x,y:n.y,angle:r,stroke:i,strokeWidth:o,strokeOpacity:s}))}updateAnchor(e,t,i,o){const s=ef.topCenter(t);ki.apply(this.anchor,Jy.Transformable.toCanvasPoint(this.line,s.x,s.y))}containsPoint(e,t){const{line:i,text:o}=this;return super.containsPoint(e,t)||i.isPointInPath(e,t)||!!o?.containsPoint(e,t)}getNodeAtCoords(e,t){return this.text?.containsPoint(e,t)?"text":this.line.isPointInPath(e,t)?"line":super.getNodeAtCoords(e,t)}getHandleCoords(e,t,i,o){const{startCap:s,endCap:a}=this;let[n,r]=ki.from(t);const l=ki.angle(ki.sub(r,n));return s&&(n=ki.rotate(ki.from(0,-De.HANDLE_SIZE/2),l,n)),a&&(r=ki.rotate(ki.from(0,De.HANDLE_SIZE/2),l,r)),i==="start"?n:r}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity??e.strokeOpacity,strokeWidth:e.handle.strokeWidth??e.strokeWidth}}},tf={type:"line",datum:no,scene:Wo,isDatum:no.is,translate:(e,t,i,o)=>{no.is(t)&&Wo.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(no.is(t)&&no.is(i)&&Wo.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{no.is(t)&&Wo.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new xI({...e,create:t("line")}),dragState:e=>new we(e)},of={type:"arrow",datum:ao,scene:Wo,isDatum:ao.is,translate:(e,t,i,o)=>{ao.is(t)&&Wo.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(ao.is(t)&&ao.is(i)&&Wo.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{ao.is(t)&&Wo.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new mI({...e,create:t("arrow")}),dragState:e=>new we(e)};import{_ModuleSupport as kd}from"ag-charts-community";import{isDate as sf,isNumber as ol}from"ag-charts-core";import{_ModuleSupport as Wt}from"ag-charts-community";import{_ModuleSupport as af}from"ag-charts-community";function nf(e,t=0,i=0){let o=t;for(const s of e)if(Array.isArray(s)){for(const a of s)rf(a,o);o+=af.Group.computeChildrenBBox(s).width+i}else rf(s,o),o+=s.getBBox().width+i}function vI(e,t=0,i=0){let o=t;for(const s of e)if(Array.isArray(s)){for(const a of s)lf(a,o);o+=af.Group.computeChildrenBBox(s).height+i}else lf(s,o),o+=s.getBBox().height+i}function rf(e,t){"x1"in e?(e.x2=t+(e.x2-e.x1),e.x1=t):e.x=t}function lf(e,t){"y1"in e?(e.y2=t+(e.y2-e.y1),e.y1=t):e.y=t}function cf(e,t){"x1"in e?(e.x1+=t,e.x2+=t):e.x+=t}function hf(e,t){"y1"in e?(e.y1+=t,e.y2+=t):e.y+=t}var{Vec4:Dd}=Wt,df=class extends Wt.Group{constructor(){super(),this.name="MeasurerStatisticsScene",this.background=new Wt.Rect,this.dateRangeBarsText=new Wt.Text,this.dateRangeDivider=new Wt.Line,this.dateRangeValueText=new Wt.Text,this.priceRangeValueText=new Wt.Text,this.priceRangeDivider=new Wt.Line,this.priceRangePercentageText=new Wt.Text,this.volumeText=new Wt.Text,this.volumeFormatter=new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:2,maximumFractionDigits:2}),this.append([this.background,this.dateRangeBarsText,this.dateRangeDivider,this.dateRangeValueText,this.priceRangeValueText,this.priceRangeDivider,this.priceRangePercentageText,this.volumeText])}update(e,t,i,o,s,a,n){this.verticalDirection=a;const r=this.updateStatistics(e,t,i,n),l=Wt.Group.computeChildrenBBox(r.flat()),c=10;l.grow(c),this.updateBackground(e,l,c),this.reposition(r,c,s),this.checkVisibility(e,s,o)}checkVisibility(e,t,i){const o=Dd.from(new Wt.BBox(0,0,t.seriesRect.width,t.seriesRect.height));Dd.collides(i,o)?this.visible=e.visible??!0:this.visible=!1}updateStatistics(e,t,i,o){const{dateRangeBarsText:s,dateRangeDivider:a,dateRangeValueText:n,priceRangeValueText:r,priceRangeDivider:l,priceRangePercentageText:c,volumeText:h}=this,p=8,u=6,g=e.statistics.fontSize+3,y=-2,f=this.getTextStyles(e),x={...this.getDividerStyles(e),x1:0,y1:0,x2:0,y2:g},S=[s,a,n],v=[r,l,c],m=[];return t.priceRange&&(r.setProperties({...f,text:this.formatPriceRangeValue(t.priceRange.value,o)}),l.setProperties(x),c.setProperties({...f,text:this.formatPriceRangePercentage(t.priceRange.percentage,o)}),nf(v,i.x,p),m.push(v)),t.dateRange&&(s.setProperties({...f,text:this.formatDateRangeBars(t.dateRange.bars,o)}),a.setProperties(x),n.setProperties({...f,text:this.formatDateRangeValue(t.dateRange.value)}),nf(S,i.x,p),m.push(S)),t.volume==null?h.visible=!1:(h.setProperties({...f,x:i.x,text:this.formatVolume(t.volume,o),visible:!0}),m.push(h)),vI(m,i.y,u),l.y1+=y,l.y2+=y,a.y1+=y,a.y2+=y,m}updateBackground(e,t,i){const o=this.getBackgroundStyles(e);this.background.setProperties({...o,...t,x:t.x-t.width/2+i,y:t.y})}reposition(e,t,i){const{width:o,height:s}=i.seriesRect,a=Dd.from(this.background.getBBox());let n=0;a.x1<0&&(n=-a.x1),a.x2>o&&(n=o-a.x2);const r=Math.min(t,s-a.y2);for(const l of e)if(Array.isArray(l)){const c=Wt.Group.computeChildrenBBox(l).width;for(const h of l)cf(h,n-c/2),hf(h,r)}else cf(l,n-l.getBBox().width/2),hf(l,r);this.background.x+=n,this.background.y+=r}getTextStyles(e){return{fill:e.statistics.color,fontFamily:e.statistics.fontFamily,fontSize:e.statistics.fontSize,fontStyle:e.statistics.fontStyle,fontWeight:e.statistics.fontWeight,textBaseline:"top"}}getDividerStyles(e){return{stroke:e.statistics.divider.stroke,strokeOpacity:e.statistics.divider.strokeOpacity,strokeWidth:e.statistics.divider.strokeWidth}}getBackgroundStyles(e){return{fill:e.statistics.fill,stroke:e.statistics.stroke,strokeOpacity:e.statistics.strokeOpacity,strokeWidth:e.statistics.strokeWidth,cornerRadius:4}}formatDateRangeBars(e,t){return t?.t("measurerDateRangeBars",{value:e})??`${e}`}formatDateRangeValue(e){const t=[],i=e>=0?"":"-";e=Math.abs(e);const o=1e3*60,s=o*60,a=s*24,n=Math.floor(e/o),r=Math.floor(e/s),l=Math.floor(e/a),c=r%(a/s),h=n%(s/o);return l>=1&&t.push(`${l}d`),r>=1&&(e=o.x-h.x&&(l={x:o.x,y:r.clipMask.y,radius:this.text.getBBox().height/2+Vi.length(h)})}this.verticalLine.setClipMask(n,l)}updateCaps(e,t){const{horizontalEndCap:i,verticalEndCap:o}=this,{direction:s}=e,{x1:a,y1:n,x2:r,y2:l}=t,c=Vi.round(ks.center(t),0),{stroke:h,strokeWidth:p,strokeOpacity:u}=this.getLineStyles(e),g={stroke:h,strokeWidth:p,strokeOpacity:u};if(s!=="vertical"){const y=a<=r?0:Math.PI;let f=r;s==="horizontal"&&(f+=a<=r?-2:2),i.update({...g,x:f,y:c.y,angle:y})}if(s!=="horizontal"){const y=n<=l?Math.PI/2:Math.PI/-2;let f=l;s==="vertical"&&(f+=n<=l?-2:2),o.update({...g,x:c.x,y:f,angle:y})}}updateBoundingLines(e,t){const{verticalStartLine:i,verticalEndLine:o,horizontalStartLine:s,horizontalEndLine:a}=this,{direction:n}=e,{x1:r,y1:l,x2:c,y2:h}=t,p=this.getLineStyles(e);n==="horizontal"&&(i.setProperties({...p,x1:r,y1:l,x2:r,y2:h}),o.setProperties({...p,x1:c,y1:l,x2:c,y2:h})),n==="vertical"&&(s.setProperties({...p,x1:r,y1:l,x2:c,y2:l}),a.setProperties({...p,x1:r,y1:h,x2:c,y2:h}))}updateStatistics(e,t,i){const o=Vi.add(ks.bottomCenter(t),Vi.from(0,10)),s={volume:this.getVolume(e)};e.hasPriceRange&&(s.priceRange={percentage:this.getPriceRangePercentage(e),value:this.getPriceRangeValue(e)}),e.hasDateRange&&(s.dateRange={bars:this.getDateRangeBars(t,i),value:this.getDateRangeValue(e)}),this.statistics.update(e,s,o,t,i,this.verticalDirection,e.localeManager)}updateAnchor(e,t,i,o){const s=ks.topCenter(t);Vi.apply(this.anchor,kd.Transformable.toCanvasPoint(this.horizontalLine,s.x,s.y))}getBackgroundPoints(e,t,i,o){const[s,a]=Vi.from(t),[n,r]=Vi.from(i);return[s,a,r,n]}getLineStyles(e){const{lineDashOffset:t,stroke:i,strokeWidth:o,strokeOpacity:s}=e;return{lineCap:e.getLineCap(),lineDash:e.getLineDash(),lineDashOffset:t,stroke:i,strokeWidth:o,strokeOpacity:s,fillOpacity:0}}getBackgroundStyles(e){const{background:t}=e;return{fill:t.fill,fillOpacity:t.fillOpacity}}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity??e.strokeOpacity,strokeWidth:e.handle.strokeWidth??e.strokeWidth}}containsPoint(e,t){const{horizontalLine:i,text:o,verticalLine:s,horizontalStartLine:a,horizontalEndLine:n,verticalStartLine:r,verticalEndLine:l}=this;return super.containsPoint(e,t)||i.isPointInPath(e,t)||s.isPointInPath(e,t)||a.visible&&a.isPointInPath(e,t)||n.visible&&n.isPointInPath(e,t)||r.visible&&r.isPointInPath(e,t)||l.visible&&l.isPointInPath(e,t)||!!o?.containsPoint(e,t)}getNodeAtCoords(e,t){return this.text?.containsPoint(e,t)?"text":this.start.containsPoint(e,t)||this.end.containsPoint(e,t)?"handle":"line"}getDateRangeBars(e,t){const{step:i}=t.xAxis.scale,o=e.x1<=e.x2?1:-1;return i?Math.round(ks.width(e)/i)*o:0}getDateRangeValue(e){const t=Fe(e.start.x),i=Fe(e.end.x);if(!sf(t)||!sf(i))throw new Error("Can not create a date range measurement of non-date x-axis.");return i.getTime()-t.getTime()}getPriceRangePercentage(e){if(e.start.y==null||e.end.y==null)throw new Error("Can not create a price range measurement of a non-numeric y-axis");const t=Fe(e.end.y),i=Fe(e.start.y);if(!ol(t)||!ol(i))throw new Error("Can not create a price range measurement of a non-numeric y-axis");return(t-i)/i}getPriceRangeValue(e){if(e.start.y==null||e.end.y==null)throw new Error("Can not create a price range measurement of a non-numeric y-axis");const t=Fe(e.end.y),i=Fe(e.start.y);if(!ol(t)||!ol(i))throw new Error("Can not create a price range measurement of a non-numeric y-axis");return t-i}getVolume(e){return e.getVolume(e.start.x,e.end.x)}},sl=class extends Gt{constructor(){super(...arguments),this.type="quick-measurer"}static is(e){return Ze.isCheck(e,"quick-measurer")}createStatisticsScene(){return new kI}getDirectionStyles(e){return this.verticalDirection==="down"?e.down:e.up}getLineStyles(e){const t=this.getDirectionStyles(e);return{...super.getLineStyles(e),stroke:t.stroke,strokeWidth:t.strokeWidth,strokeOpacity:t.strokeOpacity}}getBackgroundStyles(e){const t=this.getDirectionStyles(e);return{fill:t.fill,fillOpacity:t.fillOpacity}}getHandleStyles(e){const t=this.getDirectionStyles(e);return{fill:t.handle.fill,stroke:t.handle.stroke??t.stroke,strokeOpacity:t.handle.strokeOpacity??t.strokeOpacity,strokeWidth:t.handle.strokeWidth??t.strokeWidth}}};import{_ModuleSupport as DI}from"ag-charts-community";var{StateMachine:ba,StateMachineProperty:pf,Debug:MI}=DI,va=class extends ba{constructor(e){const t=({point:n})=>{const r=this.createDatum();r.set({start:n,end:n}),e.create(r)},i=({point:n})=>{const{datum:r,node:l}=this;r?.set({end:n}),l?.toggleActive(!0),l?.toggleHandles({end:!1}),e.update()},o=()=>{this.node?.toggleHandles({end:!0})},s=()=>e.delete(),a=()=>{e.showAnnotationOptions(),e.recordAction(`Create ${this.node?.type} annotation`)};super("start",{start:{reset:ba.parent,click:{target:"end",action:t},drag:{target:"end",action:t}},end:{hover:i,drag:i,click:{target:ba.parent,action:o},dragEnd:{target:ba.parent,action:o},reset:{target:ba.parent,action:s},cancel:{target:ba.parent,action:s},onExit:a}}),this.debug=MI.create(!0,"annotations")}};d([pf()],va.prototype,"datum",2),d([pf()],va.prototype,"node",2);var AI=class extends va{createDatum(){return new ei}},II=class extends va{createDatum(){return new ti}},LI=class extends va{createDatum(){return new so}},TI=class extends va{createDatum(){return new Vt}},uf={type:"date-range",datum:ei,scene:Gt,isDatum:ei.is,translate:(e,t,i,o)=>{ei.is(t)&&Gt.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(ei.is(t)&&ei.is(i)&&Gt.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{ei.is(t)&&Gt.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new AI({...e,create:t("date-range")}),dragState:e=>new we(e)},gf={type:"price-range",datum:ti,scene:Gt,isDatum:ti.is,translate:(e,t,i,o)=>{ti.is(t)&&Gt.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(ti.is(t)&&ti.is(i)&&Gt.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{ti.is(t)&&Gt.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new II({...e,create:t("date-range")}),dragState:e=>new we(e)},yf={type:"date-price-range",datum:so,scene:Gt,isDatum:so.is,translate:(e,t,i,o)=>{so.is(t)&&Gt.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(so.is(t)&&so.is(i)&&Gt.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{so.is(t)&&Gt.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new LI({...e,create:t("date-range")}),dragState:e=>new we(e)},ff={type:"quick-date-price-range",datum:Vt,scene:sl,isDatum:Vt.is,translate:(e,t,i,o)=>{Vt.is(t)&&sl.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(Vt.is(t)&&Vt.is(i)&&sl.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{Vt.is(t)&&sl.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new TI({...e,create:t("quick-date-price-range")}),dragState:e=>new we(e)};import{_ModuleSupport as Dn}from"ag-charts-community";import{calcLineHeight as CI,clamp as NI,wrapText as wI}from"ag-charts-core";var{ZIndexMap:mf}=Dn,al=class extends ud{constructor(){super(),this.type="note",this.shape=new Dn.Rect,this.iconBackground=new Dn.TranslatableSvgPath("M22 1.83333C22 0.820811 21.1792 0 20.1667 0H1.83333C0.820811 0 0 0.82081 0 1.83333V13.9868C0 14.9994 0.820811 15.8202 1.83333 15.8202L5.88971 15.8202C6.44575 15.8202 6.97175 16.0725 7.31971 16.5062L9.57006 19.3112C10.304 20.2259 11.6962 20.2259 12.4301 19.3112L14.6804 16.5062C15.0284 16.0725 15.5544 15.8202 16.1104 15.8202L20.1667 15.8202C21.1792 15.8202 22 14.9994 22 13.9868V1.83333Z"),this.iconLines=new Dn.TranslatableSvgPath("M17.1114 5.75C17.1114 6.16421 16.7756 6.5 16.3614 6.5H5.63916C5.22495 6.5 4.88916 6.16421 4.88916 5.75V5.75C4.88916 5.33579 5.22495 5 5.63916 5H16.3614C16.7756 5 17.1114 5.33579 17.1114 5.75V5.75ZM17.1114 9.25C17.1114 9.66421 16.7756 10 16.3614 10H5.63916C5.22495 10 4.88916 9.66421 4.88916 9.25V9.25C4.88916 8.83579 5.22495 8.5 5.63916 8.5H16.3614C16.7756 8.5 17.1114 8.83579 17.1114 9.25V9.25Z"),this.active=!1,this.shape.visible=!1,this.label.visible=!1,this.iconBackground.fillShadow=new Dn.DropShadow,this.append([this.shape,this.label,this.iconBackground,this.iconLines,this.handle])}static is(e){return Ze.isCheck(e,"note")}update(e,t){this.updateIcon(e,t),super.update(e,t)}getTextBBox(e,t,i){const o=super.getTextBBox(e,t,i);o.x-=e.width/2,o.x=NI(0,o.x,i.seriesRect.width-e.width);const s=e.getPadding().top,a=o.y-Ug-s*2,n=o.y+De.HANDLE_SIZE+s*2;return a-o.height-Xg<0?(o.y=n,e.position="top"):(o.y=a+s,e.position="bottom"),o}updateLabel(e,t){const i=e.visible===!1?!1:this.label.visible;super.updateLabel(e,t),this.label.visible=i,this.label.text=wI(e.text,{maxWidth:200,font:e,textWrap:"always",avoidOrphans:!1})}updateShape(e,t){const{shape:i}=this;i.fill=e.background.fill,i.fillOpacity=e.background.fillOpacity??1,i.stroke=e.background.stroke,i.strokeOpacity=e.background.strokeOpacity??1,i.strokeWidth=e.background.strokeWidth??1,i.cornerRadius=4;const o=e.getPadding().top,s=e.position==="top";i.x=t.x-o,i.width=e.width+o*2,i.height=t.height+o*2,i.y=t.y+(s?0:-t.height)-o}updateIcon(e,t){const{active:i,iconBackground:o,iconLines:s}=this,{x:a,y:n}=ke(e,t);o.translationX=a-n0/2,o.translationY=n-Yg,s.translationX=o.translationX,s.translationY=o.translationY,o.fill=e.fill,o.fillOpacity=e.fillOpacity??1,o.stroke=e.stroke,o.strokeOpacity=e.strokeOpacity??1,o.strokeWidth=e.strokeWidth??1,s.fill=e.stroke,i?o.fillShadow.color=e.fill??"rgba(0, 0, 0, 0.22)":o.fillShadow.color="rgba(0, 0, 0, 0.22)"}updateAnchor(e,t,i){const o=e.getPadding().top,s=e.position==="top",a=s?1:-1;return{x:t.x+i.seriesRect.x+e.width/2,y:t.y+i.seriesRect.y+a*(t.height+o),position:s?"below":"above"}}getLabelCoords(e,t){const i=e.position==="top",o=e.getPadding().top+CI(e.fontSize,Cr)/2;return{x:t.x,y:t.y+(i?o/2:0)}}getTextBaseline(e){return e.position==="top"?"middle":e.position}getHandleCoords(e,t,i){return{x:t.x,y:t.y+De.HANDLE_SIZE/2+4}}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke??e.fill,strokeOpacity:e.handle.strokeOpacity,strokeWidth:e.handle.strokeWidth}}toggleHovered(e,t,i){super.toggleHovered(e,t,i);const o=e||t&&!i;this.label.visible=o,this.shape.visible=o,this.zIndex=o?mf.CHART_ANNOTATION_FOCUSED:mf.CHART_ANNOTATION}toggleActive(e){super.toggleActive(e),this.label.visible=e,this.shape.visible=e,this.active=e}containsPoint(e,t){return this.shape.visible&&this.shape.containsPoint(e,t)||this.iconBackground.containsPoint(e,t)?!0:super.containsPoint(e,t)}},PI=class extends vn{createDatum(){return new wt}},xf={type:"note",datum:wt,scene:al,isDatum:wt.is,translate:(e,t,i,o)=>{wt.is(t)&&al.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(wt.is(t)&&wt.is(i)&&al.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{wt.is(t)&&al.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new PI({...e,create:t("note")}),dragState:e=>new we(e)};import{_ModuleSupport as OI}from"ag-charts-community";var{Vec2:ri,Vec4:Wi}=OI,nl=class extends Wy{constructor(){super(),this.type="parallel-channel",this.handles={topLeft:new De,topMiddle:new ya,topRight:new De,bottomLeft:new De,bottomMiddle:new ya,bottomRight:new De},this.middleLine=new Pt,this.append([this.background,this.topLine,this.middleLine,this.bottomLine,...Object.values(this.handles)])}static is(e){return Ze.isCheck(e,"parallel-channel")}dragHandle(e,t,i,o){const{activeHandle:s,handles:a}=this;if(s==null)return;const{offset:n}=a[s].drag(t);a[s].toggleDragging(!0),(s==="topMiddle"||s==="bottomMiddle")&&(n.x=0);let r=[],l=o;switch(s){case"topLeft":case"bottomLeft":r=["topLeft","bottomLeft"];break;case"topMiddle":r=["topLeft","topRight"],n.y-=ya.HANDLE_SIZE/2,l=!1;break;case"topRight":case"bottomRight":r=["topRight","bottomRight"];break;case"bottomMiddle":r=["bottomLeft","bottomRight"],n.y-=ya.HANDLE_SIZE/2,l=!1;break}const c=kt(e,i),h=kt(e.bottom,i);if(!c||!h)return;const p={topLeft:Wi.start(c),topRight:Wi.end(c),bottomLeft:Wi.start(h),bottomRight:Wi.end(h)},u={vectors:{topLeft:p.topRight,bottomLeft:p.bottomRight,topRight:p.topLeft,bottomRight:p.bottomLeft},angle:e.snapToAngle},g=po(p,n,i,{overflowContinuous:this.overflowContinuous,translateVectors:r,snap:l?u:void 0});e.start.x=g.topLeft.x,e.start.y=g.topLeft.y,e.end.x=g.topRight.x,e.end.y=g.topRight.y,e.height=g.topLeft.y-g.bottomLeft.y}getTranslatePointsVectors(e,t){const{bottomLeft:i,topLeft:o}=this.handles,s=i.getBBox().y-o.getBBox().y,a=ri.add(e,ri.from(0,s)),n=ri.add(t,ri.from(0,s));return{start:e,end:t,bottomStart:a,bottomEnd:n}}containsPoint(e,t){return super.containsPoint(e,t)||this.middleLine.visible&&this.middleLine.strokeWidth>0&&this.middleLine.containsPoint(e,t)}getNodeAtCoords(e,t){return this.middleLine.visible&&this.middleLine.strokeWidth>0&&this.middleLine.containsPoint(e,t)?"line":super.getNodeAtCoords(e,t)}updateLines(e,t,i,o,s,a){const{topLine:n,middleLine:r,bottomLine:l}=this,{lineDashOffset:c,stroke:h,strokeOpacity:p,strokeWidth:u}=e,g=e.getLineDash(),y={lineCap:e.getLineCap(),lineDash:g,lineDashOffset:c,stroke:h,strokeOpacity:p,strokeWidth:u};n.setProperties({...t,...y}),l.setProperties({...i,...y});const f=this.extendLine({x1:s.x1,y1:a.y1+(s.y1-a.y1)/2,x2:s.x2,y2:a.y2+(s.y2-a.y2)/2},e,o);r.setProperties({...f,lineDash:e.middle.lineDash??g,lineDashOffset:e.middle.lineDashOffset??c,stroke:e.middle.stroke??h,strokeOpacity:e.middle.strokeOpacity??p,strokeWidth:e.middle.strokeWidth??u,visible:e.middle.visible??!0})}updateHandles(e,t,i){const{handles:{topLeft:o,topMiddle:s,topRight:a,bottomLeft:n,bottomMiddle:r,bottomRight:l}}=this,c={fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity??e.strokeOpacity,strokeWidth:e.handle.strokeWidth??e.strokeWidth};o.update({...c,...Wi.start(t)}),a.update({...c,...Wi.end(t)}),n.update({...c,...Wi.start(i)}),l.update({...c,...Wi.end(i)}),s.update({...c,...ri.sub(Wi.center(t),ri.from(s.handle.width/2,s.handle.height/2))}),r.update({...c,...ri.sub(Wi.center(i),ri.from(r.handle.width/2,r.handle.height/2))})}updateText(e,t,i){this.text=this.updateNode(Ss,this.text,!!e.text.label),_y(!0,t,i,e.text,e.strokeWidth,this.text,e.text.label)}getBackgroundPoints(e,t,i,o){const s=t.x1>t.x2,a=t.y1>t.y2,n=t.x1!==i.x1&&t.y1!==i.y1,r=t.x2!==i.x2&&t.y2!==i.y2,l=ri.from(t);return e.extendEnd&&r&&l.push(ri.from(s?o.x1:o.x2,a?o.y1:o.y2)),l.push(...ri.from(i).reverse()),e.extendStart&&n&&l.push(ri.from(s?o.x2:o.x1,a?o.y2:o.y1)),l}};import{_ModuleSupport as _I}from"ag-charts-community";import{isNumber as ka}from"ag-charts-core";var{StateMachine:Go,StateMachineProperty:Md,Debug:RI}=_I,rl=class extends Go{constructor(e){const t=({point:l})=>{const c=new oi;c.set({start:l,end:l,height:0}),e.create(c)},i=()=>{const{node:l}=this;l?.toggleActive(!0),l?.toggleHandles({topLeft:!0,topMiddle:!1,topRight:!1,bottomLeft:!1,bottomMiddle:!1,bottomRight:!1})},o=({offset:l,context:c})=>{const{datum:h,snapping:p}=this;h&&(h.set({end:bn(l,c,p,h.start,h.snapToAngle)}),e.update())},s=()=>{this.node?.toggleHandles({topRight:!0}),e.update()},a=({point:l})=>{const{datum:c,node:h}=this,p=Fe(c?.end.y),u=Fe(c?.start.y),{y:g}=l;if(c==null||!ka(u)||!ka(p)||!ka(g))return;const y=p-(g??0),f=u-y;h?.toggleHandles({bottomLeft:!0,bottomRight:!0}),!(!e.validatePoint({x:c.start.x,y:f},{overflowContinuous:!0})||!e.validatePoint({x:c.end.x,y:l.y},{overflowContinuous:!0}))&&(c.set({height:y}),e.update())},n=({point:l})=>{const{datum:c,node:h}=this,p=Fe(c?.end.y),u=Fe(c?.start.y),{y:g}=l;if(c==null||!ka(u)||!ka(p)||!ka(g))return;const y=p-(g??0),f=u-y;h?.toggleHandles(!0),!(!e.validatePoint({x:c.start.x,y:f},{overflowContinuous:!0})||!e.validatePoint({x:c.end.x,y:l.y},{overflowContinuous:!0}))&&(c.set({height:y}),e.recordAction("Create parallel-channel annotation"),e.showAnnotationOptions(),e.update())},r=()=>e.delete();super("start",{start:{click:{target:"waiting-first-render",action:t},drag:{target:"waiting-first-render",action:t},reset:Go.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:o,drag:o,click:{target:"height",action:s},dragEnd:{target:"height",action:s},reset:{target:Go.parent,action:r},cancel:{target:Go.parent,action:r}},height:{hover:a,click:{target:Go.parent,action:n},drag:{target:Go.parent,action:n},reset:{target:Go.parent,action:r},cancel:{target:Go.parent,action:r}}}),this.debug=RI.create(!0,"annotations"),this.snapping=!1}};d([Md()],rl.prototype,"datum",2),d([Md()],rl.prototype,"node",2),d([Md()],rl.prototype,"snapping",2);var Sf={type:"parallel-channel",datum:oi,scene:nl,isDatum:oi.is,translate:(e,t,i,o)=>{oi.is(t)&&nl.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(oi.is(t)&&oi.is(i)&&nl.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{oi.is(t)&&nl.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new rl({...e,create:t("parallel-channel")}),dragState:e=>new we(e)},ll=class extends ud{constructor(){super(),this.type="text",this.append([this.label,this.handle])}static is(e){return Ze.isCheck(e,"text")}getHandleCoords(e,t){const i=De.HANDLE_SIZE/2;return{x:t.x+i,y:t.y+2+i}}},EI=class extends vn{createDatum(){return new co}},bf={type:"text",datum:co,scene:ll,isDatum:co.is,translate:(e,t,i,o)=>{co.is(t)&&ll.is(e)&&e.translate(t,i,o)},copy:(e,t,i,o)=>{if(co.is(t)&&co.is(i)&&ll.is(e))return e.copy(t,i,o)},update:(e,t,i)=>{co.is(t)&&ll.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new EI({...e,create:t("text")}),dragState:e=>new we(e)},Kt={[tf.type]:tf,[zy.type]:zy,[Fy.type]:Fy,[Sf.type]:Sf,[Gy.type]:Gy,[Qy.type]:Qy,[Zy.type]:Zy,[Cy.type]:Cy,[Py.type]:Py,[xf.type]:xf,[bf.type]:bf,[of.type]:of,[ky.type]:ky,[vy.type]:vy,[uf.type]:uf,[gf.type]:gf,[yf.type]:yf,[ff.type]:ff};function Ds(e){for(const{isDatum:t}of Object.values(Kt))if(t(e))return e}import{_ModuleSupport as BI}from"ag-charts-community";var{ActionOnSet:zI,ParallelStateMachine:FI,StateMachine:Ad,StateMachineProperty:Gi,Debug:HI}=BI,cl=class extends FI{constructor(e){super(new VI(t=>{this.snapping=t}),new WI(()=>{this.node=this.active==null?void 0:e.node(this.active)}),new Ko(e,t=>{this.active=t,this.datum=this.active==null?void 0:e.datum(this.active),this.node=this.active==null?void 0:e.node(this.active)})),this.snapping=!1}getActive(){return this.active}isActive(e){return e===this.active}};d([Gi()],cl.prototype,"snapping",2),d([Gi()],cl.prototype,"datum",2),d([Gi()],cl.prototype,"node",2);var VI=class extends Ad{constructor(e){super("idle",{idle:{hover:({shiftKey:t})=>e(t),keyDown:({shiftKey:t})=>e(t),keyUp:({shiftKey:t})=>e(t),click:({shiftKey:t})=>e(t),drag:({shiftKey:t})=>e(t)},dragging:{},translating:{},"text-input":{}})}},WI=class extends Ad{constructor(e){super("idle",{idle:{onEnter:e,render:e},dragging:{onEnter:e,render:e},translating:{onEnter:e,render:e},"text-input":{render:e}})}},Ko=class extends Ad{constructor(e,t){const i=m=>b=>{e.create(m,b),this.active=e.selectLast()},o=()=>{this.active!=null&&e.delete(this.active),this.active=void 0,e.select()},s={createDatum:i},a={...e,delete:o,showTextInput:()=>{this.active!=null&&e.showTextInput(this.active)},deselect:()=>{const m=this.active;this.active=void 0,this.hovered=void 0,e.select(this.active,m)},showAnnotationOptions:()=>{this.active!=null&&e.showAnnotationOptions(this.active)}},n=Object.fromEntries(Object.entries(Kt).map(([m,b])=>[m,b.createState(a,s)])),r=Object.fromEntries(Object.entries(Kt).map(([m,b])=>[m,b.dragState(e,s)])),l=({colorPickerType:m,colorOpacity:b,color:k,opacity:A,isMultiColor:M})=>{this.datum&&(m==="text-color"&&e.updateTextInputColor(k),Er(this.datum,m,b,k,A,M),e.update())},c=m=>{const{datum:b,node:k}=this;!b||!k||(Fi(b)?(b.fontSize=m,e.updateTextInputFontSize(m)):pa(b)&&(b.text.fontSize=m),e.update())},h=m=>{const{datum:b,node:k}=this;!b||!k||!Oo(b)||(ty(b,m),e.update())},p=m=>{const{node:b}=this;!b||!("setTextInputBBox"in b)||(b.setTextInputBBox(m),e.update())},u=({textInputValue:m,bbox:b})=>{const{datum:k}=this;if(b!=null&&m!=null&&m.length>0){if(!Fi(k))return;const A=Nr(k,m,b.width);k.set({text:A}),e.update(),e.recordAction(`Change ${k.type} annotation text`)}else e.delete(this.active),e.recordAction(`Delete ${k?.type} annotation`)},g=()=>{e.updateTextInputBBox(void 0)},y=()=>this.active!=null,f=()=>this.copied!=null,x=()=>{const{active:m,datum:b}=this;return m==null||!b?!1:pa(b)&&b.isWriteable()},S=()=>this.active!=null&&!Po(this.datum),v=()=>this.hovered!=null;super("idle",{idle:{onEnter:()=>{e.select(this.active,this.active),this.hoverCoords&&(this.hovered=e.hoverAtCoords(this.hoverCoords,this.active,this.hovered))},hover:({offset:m})=>{this.hovered=e.hoverAtCoords(m,this.active,this.hovered),this.hoverCoords=m},translate:{guard:y,target:"translating",action:({translation:m})=>{e.startInteracting(),e.translate(this.active,m),e.update()}},copy:{guard:S,action:()=>{this.copied=e.copy(this.active)}},cut:{guard:S,action:()=>{this.copied=e.copy(this.active),o()}},paste:{guard:f,action:()=>{e.paste(this.copied)}},selectLast:()=>{const m=this.active;this.active=e.selectLast(),e.select(this.active,m)},click:[{guard:()=>{const{active:m,hovered:b,datum:k}=this;return m==null||b!==m||!k?!1:Fi(k)&&k.isWriteable()},target:"text-input"},{action:()=>{const m=this.active;this.active=this.hovered,e.select(this.active,m)}}],dblclick:{guard:x,action:({offset:m})=>{const b=e.getNodeAtCoords(m,this.active)==="text"?"text":"line";e.showAnnotationSettings(this.active,void 0,b)}},dragStart:[{guard:v,target:"dragging",action:()=>{const m=this.active;this.active=this.hovered,e.select(this.active,m),e.startInteracting()}},{action:()=>{const m=this.active;this.active=this.hovered,e.select(this.active,m)}}],color:{guard:y,action:l},fontSize:{guard:y,action:c},lineProps:{guard:y,action:m=>{const b=Ds(this.datum);b?.set(m),e.update(),e.recordAction(`Change ${b?.type} ${Object.entries(m).map(([k,A])=>`${k} to ${A}`).join(", ")}`)}},lineStyle:{guard:y,action:h},lineText:{guard:y,action:m=>{const b=Ds(this.datum);pa(b)&&(ho(b)&&m.position==="center"&&(m.position="inside"),b.text.set(m),e.update())}},updateTextInputBBox:{guard:y,action:p},toolbarPressSettings:{guard:x,action:m=>{e.showAnnotationSettings(this.active,m)}},reset:()=>{this.active!=null&&this.node?.toggleActive(!1),this.hovered=void 0,this.active=void 0,e.select(this.active,this.active),e.resetToIdle()},delete:()=>{this.active!=null&&(e.delete(this.active),!Po(this.datum)&&e.recordAction(`Delete ${this.datum?.type} annotation`))},deleteAll:()=>{e.deleteAll()},...n},dragging:{onEnter:(m,b)=>{if(this.active==null)return;const k=e.getAnnotationType(this.active);k&&(this.transitionRoot(k),this.transitionRoot("dragStart",b))},...r},translating:{onEnter:()=>{},translate:{guard:y,target:"translating",action:({translation:m})=>{e.startInteracting(),e.translate(this.active,m),e.update()}},translateEnd:{guard:y,target:"idle"},onExit:()=>{e.stopInteracting(),e.update(),e.recordAction("Translate annotation")}},"text-input":{onEnter:()=>{if(this.active==null)return;const m=Ds(this.datum);!m||!("getTextInputCoords"in m)||(e.startInteracting(),e.showTextInput(this.active),m.visible=!1,e.update())},updateTextInputBBox:{guard:y,action:p},resize:{target:"idle",action:u},click:{target:"idle",action:u},drag:{target:"idle",action:u},textInput:[{guard:hd,target:"idle",action:g},{guard:dd,target:"idle",action:u}],color:{guard:y,action:l},fontSize:{guard:y,action:c},cancel:{target:"idle",action:g},onExit:()=>{e.stopInteracting(),e.hideTextInput();const m=this.active;if(this.active=this.hovered=void 0,e.select(this.active,m),m==null)return;const b=e.datum(m),k=e.node(m);!b||!k||(b.visible=!0)}}}),this.setActive=t,this.debug=HI.create(!0,"annotations"),this.snapping=!1}};d([zI({changeValue(e){this.setActive(e)}}),Gi()],Ko.prototype,"active",2),d([Gi()],Ko.prototype,"hovered",2),d([Gi()],Ko.prototype,"hoverCoords",2),d([Gi()],Ko.prototype,"copied",2),d([Gi()],Ko.prototype,"snapping",2),d([Gi()],Ko.prototype,"datum",2),d([Gi()],Ko.prototype,"node",2);import{_ModuleSupport as vf}from"ag-charts-community";import{CleanupRegistry as GI,EventEmitter as KI}from"ag-charts-core";var{ActionOnSet:$I,LayoutElement:jI,Menu:YI,PropertiesArray:UI,ToolbarButtonProperties:XI,Property:hl,ChartAxisDirection:ZI}=vf,kf=class extends XI{};d([hl],kf.prototype,"value",2);var dl=class extends vf.BaseProperties{constructor(e){super(),this.ctx=e,this.enabled=!0,this.padding=20,this.buttons=new UI(kf),this.events=new KI,this.annotationMenu=new YI(this.ctx,"annotations"),this.cleanup=new GI,this.toolbar=e.sharedToolbar.getSharedToolbar("annotations");const t=this.onKeyDown.bind(this);this.toolbar.addListener("keydown",t),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onToolbarButtonPress.bind(this)),e.layoutManager.registerElement(jI.ToolbarLeft,this.onLayoutStart.bind(this)),()=>{this.toolbar.removeListener("keydown",t),this.toolbar.destroy()})}destroy(){this.cleanup.flush()}toggleClearButtonEnabled(e){const t=this.buttons.findIndex(i=>i.value==="clear");this.toolbar.toggleButtonEnabledByIndex(t,e)}resetButtonIcons(){for(const[e,t]of this.buttons.entries())switch(t.value){case"line-menu":this.updateButtonByIndex(e,{icon:"trend-line-drawing",value:"line-menu"});break;case"fibonacci-menu":this.updateButtonByIndex(e,{icon:"fibonacci-retracement-drawing",value:"fibonacci-menu"});break;case"text-menu":this.updateButtonByIndex(e,{icon:"text-annotation",value:"text-menu"});break;case"shape-menu":this.updateButtonByIndex(e,{icon:"arrow-drawing",value:"shape-menu"});break;case"measurer-menu":this.updateButtonByIndex(e,{icon:"measurer-drawing",value:"measurer-menu"});break}}hideOverlays(){this.annotationMenu.hide()}clearActiveButton(){this.toolbar.clearActiveButton()}onLayoutStart(e){this.enabled&&(this.toolbar.updateButtons(this.buttons),this.toolbar.layout(e.layoutBox,this.padding))}refreshButtonsEnabled(e){for(const[t,i]of this.buttons.entries())i&&this.toolbar.toggleButtonEnabledByIndex(t,e)}onToolbarButtonPress({event:e,button:t,buttonBounds:i,buttonWidget:o}){const s=this.ctx.axisManager.getAxisContext(ZI.Y)[0].scale;switch(t.value){case"clear":this.events.emit("pressed-clear",null);break;case"line-menu":this.onToolbarButtonPressShowMenu(e,i,o,t.value,"toolbarAnnotationsLineAnnotations",W0.filter(a=>a.visible?a.visible(s):!0));break;case"fibonacci-menu":this.onToolbarButtonPressShowMenu(e,i,o,t.value,"toolbarAnnotationsFibonacciAnnotations",G0);break;case"text-menu":this.onToolbarButtonPressShowMenu(e,i,o,t.value,"toolbarAnnotationsTextAnnotations",$0);break;case"shape-menu":this.onToolbarButtonPressShowMenu(e,i,o,t.value,"toolbarAnnotationsShapeAnnotations",j0);break;case"measurer-menu":this.onToolbarButtonPressShowMenu(e,i,o,t.value,"toolbarAnnotationsMeasurerAnnotations",Y0);break}}onToolbarButtonPressShowMenu(e,t,i,o,s,a){this.events.emit("pressed-show-menu",null);const n=this.buttons.findIndex(r=>r.value===o);this.toolbar.toggleActiveButtonByIndex(n),this.annotationMenu.setAnchor({x:t.x+t.width+6,y:t.y}),this.annotationMenu.show(i,{items:a,ariaLabel:this.ctx.localeManager.t(s),class:"ag-charts-annotations__toolbar-menu",sourceEvent:e.sourceEvent,onPress:this.onButtonPressMenuCreateAnnotation.bind(this,o)})}onButtonPressMenuCreateAnnotation(e,t){const i=this.buttons.findIndex(o=>o.value===e);this.updateButtonByIndex(i,{icon:t.icon}),this.events.emit("pressed-create-annotation",{annotation:t.value}),this.annotationMenu.hide()}onKeyDown({sourceEvent:e}){e.key==="Escape"&&this.events.emit("cancel-create-annotation",null)}updateButtonByIndex(e,t){const i=this.buttons.at(e);i&&(i.set({...i.toJson(),...t,value:t.value??i.value}),this.toolbar.updateButtonByIndex(e,{...i.toJson()}))}};d([hl,$I({changeValue(e){this.toolbar?.setHidden(!e)}})],dl.prototype,"enabled",2),d([hl],dl.prototype,"padding",2),d([hl],dl.prototype,"buttons",2);import{_ModuleSupport as qI,_Widget as QI}from"ag-charts-community";var{BaseModuleInstance:JI,InteractionState:Mn,Property:e2,ChartAxisDirection:t2,getIconClassNames:i2}=qI,An="ag-charts-annotations__axis-button",Df=class extends JI{constructor(e,t,i,o){super(),this.ctx=e,this.axisCtx=t,this.onButtonClick=i,this.seriesRect=o,this.enabled=!0,this.snap=!1,this.padding=0,this.button=this.setup(),this.toggleVisibility(!1),this.updateButtonElement(),this.snap=!!t.scale.bandwidth,e.domManager.addEventListener("focusin",({target:s})=>{const a=s instanceof HTMLElement?s:void 0;!(a&&e.domManager.contains(a,"series-area"))&&a!==this.button.getElement()&&this.hide()}),this.cleanup.register(e.widgets.seriesWidget.addListener("drag-move",s=>this.onMouseDrag(s)),e.widgets.seriesWidget.addListener("mousemove",s=>this.onMouseMove(s)),e.widgets.seriesWidget.addListener("mouseleave",()=>this.onMouseLeave()),e.widgets.seriesDragInterpreter?.events.on("click",s=>this.onClick(s)),e.eventsHub.on("series:focus-change",()=>this.onKeyPress()),e.eventsHub.on("zoom:pan-start",()=>this.hide()),e.eventsHub.on("zoom:change",()=>this.hide()),()=>this.destroyElements(),()=>this.button.destroy())}update(e,t){this.seriesRect=e,this.padding=t}setup(){const e=new QI.ButtonWidget;return e.addClass(An),e.setTabIndex(-1),e.setAriaLabel(this.ctx.localeManager.t("ariaLabelAddHorizontalLine")),this.ctx.widgets.seriesWidget.getElement().appendChild(e.getElement()),e}destroyElements(){this.ctx.domManager.removeChild("canvas-overlay",An)}onMouseMove(e){this.ctx.interactionManager.isState(Mn.Clickable)&&this.show(e)}onMouseDrag(e){this.ctx.interactionManager.isState(Mn.AnnotationsMoveable)&&this.show(e)}onMouseLeave(){this.ctx.interactionManager.isState(Mn.Clickable)&&this.hide()}onClick(e){this.ctx.interactionManager.isState(Mn.Clickable)&&e.device==="touch"&&this.show(e)}show(e){const{sourceEvent:t,currentX:i,currentY:o}=e;if(!(this.enabled&&this.ctx.widgets.seriesWidget.getElement().contains(t.target))){this.hide();return}this.toggleVisibility(!0);const s=this.getButtonCoordinates({x:i,y:o});this.coords={x:s.x+this.button.clientWidth/2,y:s.y+this.button.clientHeight/2},this.updatePosition(s)}hide(){this.toggleVisibility(!1)}onKeyPress(){this.snap&&this.ctx.interactionManager.isState(Mn.Default)||this.hide()}getButtonCoordinates({x:e,y:t}){const{axisCtx:{direction:i,position:o},seriesRect:s,snap:a,axisCtx:n,padding:r}=this,{clientWidth:l,clientHeight:c}=this.button,[h,p]=[0,s.height],[u,g]=[0,s.width];if(a&&(e=oo(Ar(e-s.x,n),n)+s.x,t=oo(Ar(t-s.y,n),n)+s.y),i===t2.X){const f=c-Math.max(0,r-5);e=e-l/2,t=o==="top"?h-c+f:p-f}else{const f=l-Math.max(0,r-9);e=o==="left"?u-l+f:g-f,t=t-c/2}return{x:e,y:t}}toggleVisibility(e){const{button:t}=this;if(t==null)return;const i=this.enabled&&e;this.toggleClass("-hidden",!i)}toggleClass(e,t){this.button.toggleClass(`${An}-${e}`,t)}updatePosition({x:e,y:t}){this.button.getElement().style.transform=`translate(${Math.round(e)}px, ${Math.round(t)}px)`}updateButtonElement(){const{button:e}=this;e.addListener("click",()=>this.onButtonClick(this.coords)),e.addListener("touchend",()=>this.onButtonClick(this.coords)),e.addListener("drag-start",()=>{}),e.setInnerHTML(``)}};d([e2],Df.prototype,"enabled",2);import{_ModuleSupport as o2}from"ag-charts-community";import{EventEmitter as s2}from"ag-charts-core";import{_ModuleSupport as a2}from"ag-charts-community";import{createElement as yo,createElementId as Id,entries as Mf,getWindow as n2,setAttribute as Af,setAttributes as Ld}from"ag-charts-core";var{Color:If,DraggablePopover:r2,NativeWidget:Td,Vec2:He,createButton:pl,createCheckbox:l2,createSelect:c2,createTextArea:h2,initRovingTabIndex:Lf,getIconClassNames:d2,mapValues:Cd}=a2,Tf=class og extends r2{constructor(t,i){super(t,i),this.dragHandleDraggingClass="ag-charts-dialog__drag-handle--dragging",this.colorPicker=new ny(this.ctx,{detached:!0}),this.cleanup.register(t.eventsHub.on("layout:complete",this.onLayoutComplete.bind(this)))}showWithChildren(t,i){const o=super.showWithChildren(t,i);return o.classList.add("ag-charts-dialog"),o.setAttribute("role","dialog"),o.addEventListener("mousedown",s=>{s.target.classList?.contains("ag-charts-dialog__color-picker-button")||this.colorPicker.hide()}),o.addEventListener("keydown",this.onKeyDown.bind(this)),n2().requestAnimationFrame(()=>this.reposition()),this.colorPicker.attachTo(this),o}updatePosition(t){super.updatePosition(t);const{anchor:i,fallbackAnchor:o}=this.getColorPickerAnchors()??{};i&&this.colorPicker.setAnchor(i,o)}createTabs(t,i,o){const s=yo("div","ag-charts-dialog__tabs"),a=Cd(o,()=>Id()),n=Cd(o,()=>Id());for(const[g,y]of Mf(o))Ld(y.panel,{id:n[g],role:"tabpanel","aria-labelledby":a[g]});const r=g=>{for(const[y,f]of Mf(o))f.panel.classList.toggle("ag-charts-dialog__tab-panel--active",y===g),h[y].classList.toggle("ag-charts-dialog__tab-button--active",y===g),Af(h[y],"aria-selected",y===g),y===g&&f.onShow?.()},l=new Td(yo("div","ag-charts-dialog__header"));l.addListener("drag-start",g=>{const{sourceEvent:y}=g;y.target instanceof Element&&y.target.classList.contains("ag-charts-dialog__header")&&this.onDragStart(g)}),l.addListener("drag-move",g=>this.onDragMove(g)),l.addListener("drag-end",()=>this.onDragEnd());const c=new u2;this.setDragHandle(c);const h=Cd(o,(g,y)=>pl({label:this.ctx.localeManager.t(g.label),onPress:()=>r(y)},{id:a[y],class:"ag-charts-dialog__tab-button",role:"tab","aria-controls":n[y]})),p=yo("div","ag-charts-dialog__tab-list");Ld(p,{role:"tablist","aria-label":this.ctx.localeManager.t(t)}),p.append(...Object.values(h));const u=this.createHeaderCloseButton();return l.getElement().append(c.getElement(),p,u),s.append(l.getElement(),...Object.values(o).map(g=>g.panel)),r(i),Lf({orientation:"horizontal",buttons:Object.values(h)}),{tabs:s,initialFocus:h[i]}}createTabPanel(){return yo("div","ag-charts-dialog__tab-panel")}createInputGroupLine(){return yo("div","ag-charts-dialog__input-group-line")}createRadioGroup({label:t,options:i,value:o,onChange:s}){const a=this.createInputGroup(t);Ld(a,{role:"radiogroup",tabindex:-1,"aria-label":this.ctx.localeManager.t(t)});const n="ag-charts-dialog__button--active",r=[];for(const l of i){const{icon:c,altText:h}=l,p=this.ctx.localeManager.t(h),u=pl({icon:c,altText:p,onPress:()=>{for(const g of Array.from(a.children))g.classList.remove(n),g.ariaChecked="false";u.classList.add(n),u.ariaChecked="true",s(l.value)}},{"aria-checked":l.value===o,class:"ag-charts-dialog__button",role:"radio",title:p});l.value===o&&u.classList.add(n),a.appendChild(u),r.push(u)}return Lf({orientation:"horizontal",buttons:r}),a}createSelect({altText:t,label:i,options:o,value:s,onChange:a}){const n=this.createInputGroup(i),r=this.ctx.localeManager.t(t),l=c2({value:s,options:o,onChange:a},{class:"ag-charts-dialog__select","aria-label":r,title:r});return n.append(l),n}createTextArea({placeholder:t,value:i,onChange:o}){const s=t?this.ctx.localeManager.t(t):void 0;return h2({value:i,onChange:o},{placeholder:s})}createCheckbox({label:t,checked:i,onChange:o}){const s=Id(),a=this.createInputGroup(t,{for:s}),n=l2({checked:i,onChange:o},{class:"ag-charts-dialog__checkbox",role:"switch",id:s});return a.append(n),a}createColorPicker({color:t,opacity:i,label:o,altText:s,onChange:a,onChangeHide:n,isMultiColor:r,hasMultiColorOption:l}){const c=this.createInputGroup(o),h=this.ctx.localeManager.t(s),p=pl({label:h,onPress:u=>{const{anchor:g,fallbackAnchor:y}=this.getColorPickerAnchors(p)??{};this.colorPicker.show({anchor:g,fallbackAnchor:y,color:t,opacity:i,isMultiColor:r,hasMultiColorOption:l,sourceEvent:u,onChange:(f,x,S,v)=>{p.style.setProperty("--color",f),p.classList.toggle("ag-charts-dialog__color-picker-button--multi-color",v),a(f,x,S,v)},onChangeHide:n})}},{"aria-label":h,tabindex:0,class:"ag-charts-dialog__color-picker-button",title:h});if(r)p.classList.toggle("ag-charts-dialog__color-picker-button--multi-color");else if(t){const u=If.fromString(t),g=new If(u.r,u.g,u.b,i);p.style.setProperty("--color",g.toHexString())}return c.append(p),this.hideFns.push(()=>{this.colorPicker.hide()}),c}createHeaderCloseButton(){return pl({icon:"close",altText:this.ctx.localeManager.t("iconAltTextClose"),onPress:()=>this.hide()},{class:"ag-charts-dialog__close-button"})}createInputGroup(t,i){const o=yo("div","ag-charts-dialog__input-group"),s=yo("label","ag-charts-dialog__input-group-label");return s.innerText=this.ctx.localeManager.t(t),Af(s,"for",i?.for),o.appendChild(s),o}onLayoutComplete(t){this.seriesRect=t.series.paddedRect,this.reposition()}onKeyDown(t){t.altKey||t.ctrlKey||t.metaKey||t.isComposing||t.key!=="Escape"||this.hide()}reposition(){const{seriesRect:t,ctx:i}=this,o=i.domManager.getBoundingClientRect(),s=this.getPopoverElement();if(!t||!s)return;const a=He.from(0,t.y),n=He.from(o.width,t.height),r=He.from(s),l=He.from(.5,1);let c;if(t.width>1e3){const h=He.sub(He.add(a,He.multiply(n,l)),He.multiply(r,l));c=He.sub(h,He.from(0,og.offset))}else{const h=He.sub(He.add(a,n),r);c=He.sub(h,og.offset)}this.updatePosition(c)}getColorPickerAnchors(t){if(t&&(this.colorPickerAnchorElement=t),!this.colorPickerAnchorElement)return;const i=this.colorPickerAnchorElement.getBoundingClientRect(),o=this.ctx.domManager.getBoundingClientRect(),s=He.sub(He.from(i.x,i.y),He.from(o.left,o.top)),a=He.add(s,He.from(0,i.height+5)),n=He.sub(s,He.from(0,5));return{anchor:a,fallbackAnchor:n}}};Tf.offset=60;var p2=Tf,u2=class extends Td{constructor(){super(yo("div","ag-charts-dialog__drag-handle"));const e=new Td(yo("span",d2("drag-handle")));e.setAriaHidden(!0),this.addChild(e)}},{focusCursorAtEnd:g2}=o2,y2=class extends p2{constructor(e){super(e,"settings"),this.events=new s2,this.hideFns.push(()=>this.events.emit("hidden",null))}show(e,t){const i=this.createLinearLineTab(e,t),o=this.createLinearTextTab(e,t);let s="dialogHeaderLine";ho(e)?s="dialogHeaderChannel":ey(e)?s="dialogHeaderFibonacciRange":e.type==="date-range"?s="dialogHeaderDateRange":e.type==="price-range"?s="dialogHeaderPriceRange":e.type==="date-price-range"&&(s="dialogHeaderDatePriceRange");const{tabs:a,initialFocus:n}=this.createTabs("ariaLabelSettingsTabBar",t.initialSelectedTab,{line:{label:s,panel:i},text:{label:"dialogHeaderText",panel:o.panel,onShow:o.onShow}});t.initialFocus=n,this.showWithChildren([a],t).classList.add("ag-charts-dialog--annotation-settings")}createLinearLineTab(e,t){const i=this.createTabPanel(),o=this.createInputGroupLine(),s=this.createInputGroupLine(),a="isMultiColor"in e,n=this.createColorPickerInput("line-color",e.getDefaultColor("line-color"),e.getDefaultOpacity("line-color"),a?e.isMultiColor:!1,a,t.onChangeLineColor,t.onChangeHideLineColor),r=this.createStrokeWidthSelect(e.strokeWidth??2,t.onChangeLineStyleWidth),l=this.createLineStyleRadioGroup(e.lineStyle??"solid",t.onChangeLineStyleType);if(o.append(n),"background"in e){const c=this.createColorPickerInput("fill-color",e.getDefaultColor("fill-color"),e.getDefaultOpacity("fill-color"),!1,!1,t.onChangeFillColor,t.onChangeHideFillColor);o.append(c),s.append(r)}else"showFill"in e?(o.append(this.createCheckbox({label:"dialogInputShowFill",checked:e.showFill??!0,onChange:c=>t.onChangeLine({showFill:c})})),s.append(r)):o.append(r);return s.append(l),i.append(o,s),"bands"in e&&i.append(this.createFibonacciRatioSelect(e.bands??10,c=>t.onChangeLine({bands:c}))),"extendStart"in e&&"extendEnd"in e&&i.append(this.createCheckbox({label:ho(e)?"dialogInputExtendChannelStart":"dialogInputExtendLineStart",checked:e.extendStart??!1,onChange:c=>t.onChangeLine({extendStart:c})}),this.createCheckbox({label:ho(e)?"dialogInputExtendChannelEnd":"dialogInputExtendLineEnd",checked:e.extendEnd??!1,onChange:c=>t.onChangeLine({extendEnd:c})})),"extendAbove"in e&&"extendBelow"in e&&i.append(this.createCheckbox({label:"dialogInputExtendAbove",checked:e.extendAbove??!1,onChange:c=>t.onChangeLine({extendAbove:c})}),this.createCheckbox({label:"dialogInputExtendBelow",checked:e.extendBelow??!1,onChange:c=>t.onChangeLine({extendBelow:c})})),"extendLeft"in e&&"extendRight"in e&&i.append(this.createCheckbox({label:"dialogInputExtendLeft",checked:e.extendLeft??!1,onChange:c=>t.onChangeLine({extendLeft:c})}),this.createCheckbox({label:"dialogInputExtendRight",checked:e.extendRight??!1,onChange:c=>t.onChangeLine({extendRight:c})})),"reverse"in e&&"showFill"in e&&i.append(this.createCheckbox({label:"dialogInputReverse",checked:e.reverse??!1,onChange:c=>t.onChangeLine({reverse:c})})),i}createLinearTextTab(e,t){const i=this.createTabPanel(),o=this.createTextArea({placeholder:"inputTextareaPlaceholder",value:e.text.label,onChange:h=>t.onChangeText({label:h})}),s=this.createFontSizeSelect(e.text.fontSize,t.onChangeTextFontSize),a=this.createColorPickerInput("text-color",e.text.color,1,!1,!1,t.onChangeTextColor,t.onChangeHideTextColor),n=e.text.position==="inside"?"center":e.text.position,r=this.createPositionRadioGroup(n??"top",h=>t.onChangeText({position:h})),l=this.createAlignmentRadioGroup(e.text.alignment??"center",h=>t.onChangeText({alignment:h})),c=this.createInputGroupLine();return c.append(s,a,r,l),i.append(o,c),{panel:i,onShow:()=>g2(o)}}createColorPickerInput(e,t,i,o,s,a,n){const r=e==="fill-color"?"dialogInputFillColorPicker":"dialogInputColorPicker",l=e==="fill-color"?"dialogInputFillColorPickerAltText":"dialogInputColorPickerAltText";return this.createColorPicker({label:r,altText:l,color:t,opacity:i,isMultiColor:o,hasMultiColorOption:s,onChange:a,onChangeHide:n})}createStrokeWidthSelect(e,t){return this.createSelect({label:"dialogInputStrokeWidth",altText:"dialogInputStrokeWidthAltText",options:cy.map(({label:i,value:o})=>({label:i,value:`${o}`})),value:String(e),onChange:i=>t(Number(i))})}createFibonacciRatioSelect(e,t){return this.createSelect({label:"dialogInputFibonacciBands",altText:"dialogInputFibonacciBandsAltText",options:K0.map(({label:i,value:o})=>({label:i,value:`${o}`})),value:String(e),onChange:i=>t(Number(i))})}createLineStyleRadioGroup(e,t){return this.createRadioGroup({label:"dialogInputLineStyle",options:[{icon:"line-style-solid",altText:"iconAltTextLineStyleSolid",value:"solid"},{icon:"line-style-dashed",altText:"iconAltTextLineStyleDashed",value:"dashed"},{icon:"line-style-dotted",altText:"iconAltTextLineStyleDotted",value:"dotted"}],value:e,onChange:t})}createFontSizeSelect(e,t){return this.createSelect({label:"dialogInputFontSize",altText:"dialogInputFontSizeAltText",options:hy.map(({label:i,value:o})=>({label:i,value:String(o)})),value:String(e),onChange:i=>t(Number(i))})}createPositionRadioGroup(e,t){return this.createRadioGroup({label:"dialogInputPosition",options:[{icon:"position-top",altText:"iconAltTextPositionTop",value:"top"},{icon:"position-center",altText:"iconAltTextPositionCenter",value:"center"},{icon:"position-bottom",altText:"iconAltTextPositionBottom",value:"bottom"}],value:e,onChange:t})}createAlignmentRadioGroup(e,t){return this.createRadioGroup({label:"dialogInputAlign",options:[{icon:"align-left",altText:"iconAltTextAlignLeft",value:"left"},{icon:"align-center",altText:"iconAltTextAlignCenter",value:"center"},{icon:"align-right",altText:"iconAltTextAlignRight",value:"right"}],value:e,onChange:t})}};function Nd(e){return e.gridPadding+e.seriesAreaPadding+e.tickSize+e.label.spacing}function f2(e,t,i){for(const{update:o}of Object.values(Kt))o(e,t,i)}var{ChartUpdateType:m2,InteractionState:Ot,PropertiesArray:x2,Property:In,ChartAxisDirection:S2,keyProperty:b2,valueProperty:v2,Vec2:Ms,Selection:k2,BBox:D2}=la,Da=class Hk extends la.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.enabled=!0,this.toolbar=new dl(this.ctx),this.optionsToolbar=new od(this.ctx,()=>{const i=this.state.getActive();if(i!=null)return Ds(this.annotationData.at(i))}),this.axesButtons=new Bh,this.snap=!1,this.data=void 0,this.xKey=void 0,this.volumeKey=void 0,this.annotationData=new x2(Hk.createAnnotationDatum),this.defaults=new E0,this.container=new la.Group({name:"static-annotations"}),this.annotations=new k2(this.container,this.createAnnotationScene.bind(this)),this.settingsDialog=new y2(this.ctx),this.textInput=new pM(this.ctx),this.postUpdateFns=[],this.state=this.setupStateMachine(),this.setupListeners(),this.setupDOM(),this.ctx.historyManager.addMementoOriginator(t.annotationManager),this.ctx.historyManager.addMementoOriginator(this.defaults),this.textInput.setKeyDownHandler(this.onTextInput.bind(this)),this.cleanup.register(()=>{this.clear(),this.xAxis?.button?.destroy(),this.yAxis?.button?.destroy()})}setupStateMachine(){const{ctx:t}=this;return new cl({resetToIdle:()=>{t.domManager.updateCursor("annotations"),this.popAnnotationState(Ot.Annotations),this.hideOverlays(),this.optionsToolbar.hide(),this.deleteEphemeralAnnotations(),this.update()},hoverAtCoords:(i,o,s)=>{let a;return this.annotations.each((n,r,l)=>{if(!r.isHoverable())return;const c=n.containsPoint(i.x,i.y);c&&(a??(a=l)),n.toggleHovered(c,o===l,r.readOnly)}),a!=null?t.tooltipManager.suppressTooltip("annotations"):this.isAnnotationState()||t.tooltipManager.unsuppressTooltip("annotations"),(a==null||!this.annotationData.at(a)?.readOnly)&&this.ctx.domManager.updateCursor("annotations",a==null?void 0:this.annotations.at(a)?.getCursor()),a!==s&&this.update(),a},getNodeAtCoords:(i,o)=>{const s=this.annotations.at(o);if(s)return s.getNodeAtCoords(i.x,i.y)},translate:(i,o)=>{const s=this.annotations.at(i),a=Ds(this.annotationData.at(i));if(!(!s||!a))return this.translateNode(s,a,o)},copy:i=>{const o=this.annotations.at(i),s=Ds(this.annotationData.at(i));if(!(!o||!s))return this.createAnnotationDatumCopy(o,s)},paste:i=>{this.createAnnotation(i.type,i,!1),this.postUpdateFns.push(()=>{this.state.transitionAsync("selectLast"),this.state.transitionAsync("copy")})},select:(i,o)=>{const{annotations:s,optionsToolbar:a,toolbar:n}=this;this.hideOverlays(),n.clearActiveButton(),n.resetButtonIcons();const r=i==null?null:s.at(i),l=o==null?null:s.at(o),c=i==null?null:this.annotationData.at(i);l===r&&r!=null||(l?.toggleActive(!1),a.hide(),r&&!c?.readOnly?(this.pushAnnotationState(Ot.AnnotationsSelected),r.toggleActive(!0),Po(c)||(a.updateButtons(this.annotationData.at(i)),this.postUpdateFns.push(()=>{a.show(),a.setAnchorScene(r)}))):(this.popAnnotationState(Ot.AnnotationsSelected),this.popAnnotationState(Ot.Annotations)),Po(c)||this.deleteEphemeralAnnotations(),this.update())},selectLast:()=>(this.pushAnnotationState(Ot.AnnotationsSelected),this.annotationData.length-1),startInteracting:()=>{this.pushAnnotationState(Ot.Annotations)},stopInteracting:()=>{this.popAnnotationState(Ot.Annotations)},create:(i,o)=>{this.createAnnotation(i,o)},delete:i=>{this.annotationData.splice(i,1)},deleteAll:()=>{const i=this.annotationData.filter(o=>{if(o.readOnly===!0)return o});this.annotationData.splice(0,this.annotationData.length);for(const o of i)this.annotationData.push(o)},validatePoint:(i,o)=>{const s=this.getAnnotationContext();return s?Qr(s,i,o):!0},getAnnotationType:i=>mM(this.annotationData[i].type),datum:i=>this.annotationData.at(i),node:i=>this.annotations.at(i),recordAction:i=>{this.recordActionAfterNextUpdate(i)},update:()=>{this.postUpdateFns.push(()=>{const i=this.state.getActive(),o=i==null?null:this.annotations.at(i);o!=null&&this.optionsToolbar.setAnchorScene(o)}),this.update()},showTextInput:i=>{const o=Ds(this.annotationData.at(i));if(!this.annotations.at(i)||!o||!("getTextInputCoords"in o)||!("getTextPosition"in o))return;const a={color:o.color,fontFamily:o.fontFamily,fontSize:o.fontSize,fontStyle:o.fontStyle,fontWeight:o.fontWeight,placeholderColor:o.getPlaceholderColor()},n=this.getAnnotationContext(),r=c=>Ms.add(o.getTextInputCoords(n,c),Ms.required(this.seriesRect)),l=()=>o.getTextPosition();this.textInput.show({styles:a,layout:{getTextInputCoords:r,getTextPosition:l,alignment:o.alignment,textAlign:o.textAlign,width:o.width},text:o.text,placeholderText:o.placeholderText,onChange:(c,h)=>{this.state.transition("updateTextInputBBox",h)}}),this.ctx.domManager.updateCursor("annotations")},hideTextInput:()=>{this.textInput.hide()},updateTextInputColor:i=>{this.textInput.updateColor(i)},updateTextInputFontSize:i=>{const o=this.textInput.updateFontSize(i);this.state.transition("updateTextInputBBox",o)},updateTextInputBBox:i=>{this.state.transition("updateTextInputBBox",i)},showAnnotationOptions:i=>{const o=this.annotations.at(i);!o||Po(this.annotationData.at(i))||(this.optionsToolbar.updateButtons(this.annotationData.at(i)),this.optionsToolbar.show(),this.optionsToolbar.setAnchorScene(o))},showAnnotationSettings:(i,o,s="line")=>{const a=this.annotationData.at(i);if(!Rr(a)&&!ho(a)&&!xn(a)||Po(a))return;const n=c=>(h,p,u,g)=>{this.setColorAndDefault(a.type,c,h,p,u,g),this.optionsToolbar.updateColorPickerColor(c,p,u,g)},r=c=>()=>{this.recordActionAfterNextUpdate(`Change ${a.type} ${c} to ${a.getDefaultColor(c)}`,["annotations","defaults"]),this.update()},l={initialSelectedTab:s,ariaLabel:this.ctx.localeManager.t("ariaLabelAnnotationSettingsDialog"),sourceEvent:o,onChangeLine:c=>{this.state.transition("lineProps",c),c.bands!=null&&this.defaults.setDefaultFibonacciOptions(a.type,"bands",c.bands),c.reverse!=null&&this.defaults.setDefaultFibonacciOptions(a.type,"reverse",c.reverse),c.showFill!=null&&this.defaults.setDefaultFibonacciOptions(a.type,"showFill",c.showFill)},onChangeText:c=>{this.state.transition("lineText",c),c.alignment&&this.defaults.setDefaultLineTextAlignment(a.type,c.alignment),c.position&&this.defaults.setDefaultLineTextPosition(a.type,c.position),this.recordActionAfterNextUpdate(`Change ${a.type} text ${Object.keys(c).map(h=>`${h} to ${c[h]}`).join(", ")}`)},onChangeFillColor:n("fill-color"),onChangeHideFillColor:r("fill-color"),onChangeLineColor:n("line-color"),onChangeHideLineColor:r("line-color"),onChangeLineStyleType:c=>{this.setLineStyleTypeAndDefault(a.type,c),this.optionsToolbar.updateLineStyleType(Sn.find(h=>h.value===c)??Sn[0])},onChangeLineStyleWidth:c=>{this.setLineStyleWidthAndDefault(a.type,c),this.optionsToolbar.updateStrokeWidth({strokeWidth:c,value:c,label:String(c)})},onChangeTextColor:n("text-color"),onChangeHideTextColor:r("text-color"),onChangeTextFontSize:c=>{this.setFontSizeAndDefault(a.type,c)}};this.settingsDialog.show(a,l)}})}setupListeners(){const{ctx:t,optionsToolbar:i,settingsDialog:o,toolbar:s}=this,{seriesWidget:a,seriesDragInterpreter:n,chartWidget:r}=t.widgets;n&&this.cleanup.register(n.events.on("click",this.hoverTouchPreHandler.bind(this)),n.events.on("drag-start",this.hoverTouchPreHandler.bind(this)),n.events.on("drag-move",this.dragMoveTouchPreHandler.bind(this)),n.events.on("mousemove",this.onHover.bind(this)),n.events.on("click",this.onClick.bind(this)),n.events.on("dblclick",this.onDoubleClick.bind(this)),n.events.on("drag-start",this.onDragStart.bind(this)),n.events.on("drag-move",this.onDrag.bind(this)),n.events.on("drag-end",this.onDragEnd.bind(this))),this.cleanup.register(a.addListener("keydown",this.onKeyDown.bind(this)),a.addListener("keyup",this.onKeyUp.bind(this)),r.addListener("click",this.onCancel.bind(this)),t.eventsHub.on("annotations:restore",this.onRestoreAnnotations.bind(this)),t.eventsHub.on("layout:complete",this.onLayoutComplete.bind(this)),t.updateService.addListener("pre-scene-render",this.onPreRender.bind(this)),t.eventsHub.on("zoom:change",()=>this.onResize()),t.eventsHub.on("dom:resize",()=>this.onResize()),s.events.on("cancel-create-annotation",()=>{this.cancel(),this.reset(),this.update()}),s.events.on("pressed-create-annotation",({annotation:l})=>{this.cancel(),this.pushAnnotationState(Ot.Annotations),this.state.transition(l),this.update()}),s.events.on("pressed-clear",()=>{this.clear(),this.recordActionAfterNextUpdate("Clear all")}),s.events.on("pressed-show-menu",()=>{this.cancel(),this.reset()}),s.events.on("pressed-unrelated",()=>{this.reset()}),i.events.on("pressed-delete",()=>{this.cancel(),this.delete(),this.reset()}),i.events.on("pressed-settings",({sourceEvent:l})=>{this.state.transition("toolbarPressSettings",l)}),i.events.on("pressed-lock",({locked:l})=>{this.recordActionAfterNextUpdate(l?"Locked":"Unlocked"),this.update()}),i.events.on("hid-overlays",()=>{this.settingsDialog.hide()}),i.events.on("saved-color",({type:l,colorPickerType:c,color:h})=>{this.recordActionAfterNextUpdate(`Change ${l} ${c} to ${h}`,["annotations","defaults"])}),i.events.on("updated-color",({type:l,colorPickerType:c,colorOpacity:h,color:p,opacity:u,isMultiColor:g})=>{this.setColorAndDefault(l,c,h,p,u,g)}),i.events.on("updated-font-size",({type:l,fontSize:c})=>{this.setFontSizeAndDefault(l,c)}),i.events.on("updated-line-style",({type:l,lineStyleType:c})=>{this.setLineStyleTypeAndDefault(l,c)}),i.events.on("updated-line-width",({type:l,strokeWidth:c})=>{this.setLineStyleWidthAndDefault(l,c)}),o.events.on("hidden",()=>{this.optionsToolbar.clearActiveButton()}))}setupDOM(){const{ctx:t,toolbar:i,optionsToolbar:o}=this;this.cleanup.register(t.annotationManager.attachNode(this.container),()=>{t.domManager.removeStyles(An),i.destroy(),o.destroy()})}async processData(t){if(!this.enabled||this.data==null||this.xKey==null||this.volumeKey==null)return;const i=[b2(this.xKey,void 0,{id:"date"}),v2(this.volumeKey,"number",{id:"volume"})],o=la.DataSet.wrap(this.data)??la.DataSet.empty(),{dataModel:s,processedData:a}=await t.request("annotations",o,{props:i});this.dataModel=s,this.processedData=a}createAnnotationScene(t){if(t.type in Kt)return new Kt[t.type].scene;throw new Error(`AG Charts - Cannot create annotation scene of type [${t.type}], expected one of [${Object.keys(Kt)}], ignoring.`)}static createAnnotationDatum(t){if(t.type in Kt)return new Kt[t.type].datum().set(t);throw new Error(`AG Charts - Cannot create annotation datum of unknown type [${t.type}], expected one of [${Object.keys(Kt)}], ignoring.`)}createAnnotation(t,i,o=!0){if(this.annotationData.push(i),o){const s=this.ctx.annotationManager.getAnnotationTypeStyles(t);s&&i.set(s),this.defaults.applyDefaults(i)}this.injectDatumDependencies(i),this.update()}injectDatumDependencies(t){"setLocaleManager"in t&&t.setLocaleManager(this.ctx.localeManager),"getVolume"in t&&(t.getVolume=this.getDatumRangeVolume.bind(this))}getDatumRangeVolume(t,i){const{dataModel:o,processedData:s}=this;let a=Fe(t),n=Fe(i);if(!Rh(a)||!Rh(n)||!o||!s||this.volumeKey==null)return;a>n&&([a,n]=[n,a]);const r=o.resolveKeysById({id:"annotations"},"date",s),l=o.resolveColumnById({id:"annotations"},"volume",s);let c=0;for(let h=0;h=a&&p<=n&&(c+=l[h])}return c}translateNode(t,i,o){const s=this.getAnnotationConfig(i),a=this.getAnnotationContext();a&&s.translate(t,i,o,a)}createAnnotationDatumCopy(t,i){const o=this.getAnnotationConfig(i),s=new o.datum;s.set(i.toJson());const a=this.getAnnotationContext();if(a)return o.copy(t,i,s,a)}getAnnotationConfig(t){if(t.type in Kt)return Kt[t.type];throw new Error(`AG Charts - Cannot get annotation config of unknown type [${t.type}], expected one of [${Object.keys(Kt)}], ignoring.`)}onRestoreAnnotations(t){this.enabled&&(this.clear(),this.annotationData.set(t.annotations),this.postUpdateFns.push(()=>{this.ctx.annotationManager.fireChangedEvent()}),this.update())}onLayoutComplete(t){const i=t.series.paddedRect;this.seriesRect=i,this.container.setClipRect(i);for(const o of t.axes??[])o.direction===la.ChartAxisDirection.X?this.xAxis=this.getAxis(o,i,this.xAxis?.button):this.yAxis=this.getAxis(o,i,this.yAxis?.button);this.showAnnotations()?this.animateAnnotations({from:0,to:1,phase:"trailing"}):this.animateAnnotations({from:1,to:0,phase:"remove"})}showAnnotations(){if(!this.yAxis||!this.xAxis)return!1;const t=this.ctx.chartService.series.some(s=>s.hasData),o=this.yAxis.context.seriesIds().some(s=>this.ctx.chartService.series.find(n=>n.id===s)?.visible);return t&&o}animateAnnotations({from:t,to:i,phase:o}){const{annotations:s}=this;this.ctx.animationManager?.animate({from:t,to:i,id:"chart-annotations",phase:o,groupId:"opacity",onUpdate(a){s.each(n=>{n.opacity=a,"setAxisLabelOpacity"in n&&n.setAxisLabelOpacity(a)})},onStop(){s.each(a=>{a.opacity=i,"setAxisLabelOpacity"in a&&a.setAxisLabelOpacity(i)})}})}onPreRender(){this.updateAnnotations(),this.state.transition("render")}getAxis(t,i,o){const s=this.ctx.axisManager.getAxisContext(t.direction)[0],{position:a="bottom",direction:n}=s,r=t.gridPadding+t.seriesAreaPadding,l=new D2(0,0,i.width,i.height).grow(r,a),c=n===S2.X?"vertical":"horizontal",{axesButtons:h,snap:p}=this;if(this.enabled&&h.enabled&&(h.axes==="xy"||h.axes===n)){o??(o=new Df(this.ctx,{...s,snapToGroup:p},y=>this.onAxisButtonClick(y,c),i));const g=Nd(t);o.update(i,g)}else o?.destroy(),o=void 0;return{layout:t,context:s,bounds:l,button:o}}recordActionAfterNextUpdate(t,i=["annotations"]){const{defaults:o,ctx:{annotationManager:s,historyManager:a}}=this,n=i.map(r=>r==="defaults"?o:s);this.postUpdateFns.push(()=>{a.record(t,...n),s.fireChangedEvent()})}setColorAndDefault(t,i,o,s,a,n){this.state.transition("color",{colorPickerType:i,colorOpacity:o,color:s,opacity:a,isMultiColor:n}),this.defaults.setDefaultColor(t,i,o,s,a,n)}setFontSizeAndDefault(t,i){this.state.transition("fontSize",i),this.defaults.setDefaultFontSize(t,i),this.recordActionAfterNextUpdate(`Change ${t} font size to ${i}`,["annotations","defaults"])}setLineStyleTypeAndDefault(t,i){this.state.transition("lineStyle",{type:i}),this.defaults.setDefaultLineStyleType(t,i),this.recordActionAfterNextUpdate(`Change ${t} line style to ${i}`,["annotations","defaults"])}setLineStyleWidthAndDefault(t,i){this.state.transition("lineStyle",{strokeWidth:i}),this.defaults.setDefaultLineStyleWidth(t,i),this.recordActionAfterNextUpdate(`Change ${t} stroke width to ${i}`,["annotations","defaults"])}updateAnnotations(){const{annotationData:t,annotations:i,seriesRect:o,ctx:{annotationManager:s}}=this,a=this.getAnnotationContext();if(!o||!a)return;s.updateData(t.toJson());const n=this.showAnnotations();this.toolbar.refreshButtonsEnabled(n),this.toolbar.toggleClearButtonEnabled(t.length>0&&n),i.update(t??[],void 0,r=>r.id).each((r,l)=>{if(!n){r.visible=!1,"setAxisLabelVisible"in r&&r.setAxisLabelVisible(!1);return}"setAxisLabelVisible"in r&&r.setAxisLabelVisible(!0),this.injectDatumDependencies(l),f2(r,l,a)});for(const r of this.postUpdateFns)r();this.postUpdateFns=[]}getAnnotationContext(){const{seriesRect:t,xAxis:i,yAxis:o,snap:s}=this;if(t&&i&&o)return{seriesRect:t,xAxis:{...i.context,bounds:i.bounds,labelPadding:Nd(i.layout),snapToGroup:s},yAxis:{...o.context,bounds:o.bounds,labelPadding:Nd(i.layout),snapToGroup:s}}}onHover(t){const{state:i}=this,o=this.getAnnotationContext();if(!o)return;const s=t.sourceEvent.shiftKey,a=Ms.from(t),n=Dt(a,o);i.transition("hover",{offset:a,point:n,shiftKey:s,context:o})}onClick(t){const{state:i}=this,o=this.getAnnotationContext();if(!o)return;const s=t.sourceEvent.shiftKey,a=Dt(Ms.from(t),o),n=this.textInput.getValue(),r=this.textInput.getBBox();i.transition("click",{point:a,shiftKey:s,textInputValue:n,bbox:r})}onDoubleClick(t){const{state:i}=this;if(!this.getAnnotationContext())return;const s=Ms.from(t);i.transition("dblclick",{offset:s})}onAxisButtonClick(t,i){this.cancel(),this.reset();const o=this.getAnnotationContext();if(!this.annotationData||!o)return;const{state:s}=this;this.pushAnnotationState(Ot.Annotations);const a=i==="horizontal";if(s.transition(a?"horizontal-line":"vertical-line"),this.optionsToolbar.hide(),!t)return;const n=Dt(t,o);Qr(o,n)&&(s.transition("click",{point:n,shiftKey:!1}),this.update())}onResize(){const t=this.textInput.getValue(),i=this.textInput.getBBox();this.state.transition("resize",{textInputValue:t,bbox:i})}hoverTouchPreHandler(t){t.device==="touch"&&this.onHover(t)}dragMoveTouchPreHandler(t){t.device==="touch"&&this.ctx.interactionManager.isState(Ot.AnnotationsSelected)&&t.sourceEvent.preventDefault()}onDragStart(t){if(!this.ctx.interactionManager.isState(Ot.AnnotationsDraggable))return;const i=this.getAnnotationContext();if(!i)return;const o=Ms.from(t),s=Dt(o,i),a=this.textInput.getValue(),n=this.textInput.getBBox();this.state.transition("dragStart",{context:i,offset:o,point:s,textInputValue:a,bbox:n})}onDrag(t){if(!this.ctx.interactionManager.isState(Ot.AnnotationsDraggable))return;const i=this.getAnnotationContext();if(!i)return;const o=Ms.from(t),s=Dt(o,i),a=t.sourceEvent.shiftKey,n=this.textInput.getValue(),r=this.textInput.getBBox();this.state.transition("drag",{context:i,offset:o,point:s,shiftKey:a,textInputValue:n,bbox:r})}onDragEnd(){this.state.transition("dragEnd")}onCancel(t){const{sourceEvent:i}=t??{};i?.currentTarget===i?.target&&(this.cancel(),this.reset())}onDelete(){this.textInput.isVisible()||(this.cancel(),this.delete(),this.reset(),this.update())}onTextInput(t){const{state:i}=this,o=this.getAnnotationContext();if(!o)return;const{key:s,shiftKey:a}=t,n=this.textInput.getValue(),r=this.textInput.getBBox();i.transition("textInput",{key:s,shiftKey:a,textInputValue:n,bbox:r,context:o})}onKeyDown(t){const{state:i}=this,o=this.getAnnotationContext();if(!o)return;const{sourceEvent:s}=t,{shiftKey:a,ctrlKey:n,metaKey:r}=s,l=n||r,c=n||a;i.transition("keyDown",{shiftKey:a,context:o});const h={x:0,y:0},p=Math.max(o?.xAxis.scale.bandwidth??0,c?10:1),u=Math.max(o?.yAxis.scale.bandwidth??0,c?10:1);switch(s.key){case"ArrowDown":h.y=u;break;case"ArrowUp":h.y=-u;break;case"ArrowLeft":h.x=-p;break;case"ArrowRight":h.x=p;break;case"Escape":this.onCancel();return;case"Backspace":case"Delete":this.onDelete();return}if((h.x||h.y)&&(i.transition("translate",{translation:h}),s.stopPropagation(),s.preventDefault()),!!l)switch(s.key){case"c":i.transition("copy");return;case"x":i.transition("cut"),this.recordActionAfterNextUpdate("Cut annotation");return;case"v":i.transition("paste"),this.recordActionAfterNextUpdate("Paste annotation");return}}onKeyUp(t){const{shiftKey:i}=t.sourceEvent,o=this.getAnnotationContext();o&&(this.state.transition("keyUp",{shiftKey:i,context:o}),this.state.transition("translateEnd"))}clear(){this.cancel(),this.deleteAll(),this.reset()}reset(){this.state.transition("reset")}cancel(){this.state.transition("cancel")}delete(){this.state.transition("delete")}deleteAll(){this.state.transition("deleteAll")}deleteEphemeralAnnotations(){let t=!1;for(const[i,o]of this.annotationData.entries())Po(o)&&(this.annotationData.splice(i,1),t=!0);t&&this.recordActionAfterNextUpdate("Delete ephemeral annotations")}hideOverlays(){this.settingsDialog.hide(),this.toolbar.hideOverlays(),this.optionsToolbar.hideOverlays()}pushAnnotationState(t){this.ctx.interactionManager.pushState(t),this.ctx.tooltipManager.suppressTooltip("annotations")}popAnnotationState(t){this.ctx.interactionManager.popState(t),this.ctx.tooltipManager.unsuppressTooltip("annotations")}isAnnotationState(){return this.ctx.interactionManager.isState(Ot.Annotations)||this.ctx.interactionManager.isState(Ot.AnnotationsSelected)}update(t=m2.PRE_SCENE_RENDER){this.ctx.updateService.update(t)}};d([In],Da.prototype,"enabled",2),d([In],Da.prototype,"toolbar",2),d([In],Da.prototype,"optionsToolbar",2),d([In],Da.prototype,"axesButtons",2),d([In],Da.prototype,"snap",2);var M2=Da;import{_ModuleSupport as A2}from"ag-charts-community";var{FONT_SIZE_RATIO:wd,ThemeSymbols:at}=A2,li={stroke:{$ref:"foregroundColor"},strokeOpacity:1,strokeWidth:2},nt={fill:at.DEFAULT_ANNOTATION_HANDLE_FILL,strokeOpacity:1,strokeWidth:2},As={color:{$ref:"chartBackgroundColor"},fontSize:{$rem:wd.LARGE},fontFamily:{$ref:"fontFamily"}},Cf={...As,enabled:!0,fill:{$ref:"foregroundColor"},fontSize:{$ref:"fontSize"}},ul={...As,textAlign:"left"},Is={...As,position:"top",alignment:"center",color:{$ref:"textColor"}},Nf={...As,position:"top",alignment:"center",color:{$ref:"textColor"}},Pd={...As,fontSize:{$ref:"fontSize"},color:at.DEFAULT_ANNOTATION_STATISTICS_COLOR,fill:at.DEFAULT_ANNOTATION_STATISTICS_FILL,stroke:at.DEFAULT_ANNOTATION_STATISTICS_STROKE,strokeWidth:1,divider:{stroke:at.DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE,strokeWidth:1,strokeOpacity:.5}},Od={...li,background:{fill:{$ref:"foregroundColor"},fillOpacity:.075},handle:{...nt},text:{...Is},statistics:{...Pd}},I2={buttons:{$shallowSimple:[{icon:"text-annotation",tooltip:"toolbarAnnotationsTextAnnotations",value:"text-menu"},{icon:"trend-line-drawing",tooltip:"toolbarAnnotationsLineAnnotations",value:"line-menu"},{icon:"arrow-drawing",tooltip:"toolbarAnnotationsShapeAnnotations",value:"shape-menu"},{icon:"delete",tooltip:"toolbarAnnotationsClearAll",value:"clear"}]},padding:{$ref:"chartPadding"}},L2={buttons:{$shallowSimple:[{icon:"text-annotation",tooltip:"toolbarAnnotationsTextColor",value:"text-color"},{icon:"line-color",tooltip:"toolbarAnnotationsLineColor",value:"line-color"},{icon:"fill-color",tooltip:"toolbarAnnotationsFillColor",value:"fill-color"},{tooltip:"toolbarAnnotationsTextSize",value:"text-size"},{tooltip:"toolbarAnnotationsLineStrokeWidth",value:"line-stroke-width"},{icon:"line-style-solid",tooltip:"toolbarAnnotationsLineStyle",value:"line-style-type"},{icon:"settings",tooltip:"toolbarAnnotationsSettings",value:"settings"},{icon:"unlocked",tooltip:"toolbarAnnotationsLock",ariaLabel:"toolbarAnnotationsLock",checkedOverrides:{icon:"locked",tooltip:"toolbarAnnotationsUnlock"},value:"lock"},{icon:"delete",tooltip:"toolbarAnnotationsDelete",value:"delete"}]}},T2={enabled:!1,line:{...li,handle:{...nt},text:{...Is}},"horizontal-line":{...li,handle:{...nt},axisLabel:{...Cf},text:{...Is}},"vertical-line":{...li,handle:{...nt},axisLabel:{...Cf},text:{...Is}},"disjoint-channel":{...li,background:{fill:{$ref:"foregroundColor"},fillOpacity:.075},handle:{...nt},text:{...Nf}},"parallel-channel":{...li,middle:{lineDash:[6,5],strokeWidth:1},background:{fill:{$ref:"foregroundColor"},fillOpacity:.075},handle:{...nt},text:{...Nf}},"fibonacci-retracement":{...li,strokes:at.DEFAULT_FIBONACCI_STROKES,rangeStroke:{$ref:"foregroundColor"},handle:{...nt},text:{...Is,position:"center"},label:{...As,color:void 0,fontSize:{$rem:wd.SMALLER}}},"fibonacci-retracement-trend-based":{...li,strokes:at.DEFAULT_FIBONACCI_STROKES,rangeStroke:{$ref:"foregroundColor"},handle:{...nt},text:{...Is,position:"center"},label:{...As,color:void 0,fontSize:{$rem:wd.SMALLER}}},callout:{...li,...ul,color:{$ref:"textColor"},handle:{...nt},fill:{$ref:"foregroundColor"},fillOpacity:.075},comment:{...ul,fontWeight:700,handle:{...nt},fill:{$ref:"foregroundColor"}},note:{...ul,color:at.DEFAULT_TEXTBOX_COLOR,fill:at.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR,stroke:{$ref:"chartBackgroundColor"},strokeWidth:1,strokeOpacity:1,handle:{...nt},background:{fill:at.DEFAULT_TEXTBOX_FILL,stroke:at.DEFAULT_TEXTBOX_STROKE,strokeWidth:1}},text:{...ul,color:{$ref:"textColor"},handle:{...nt}},arrow:{...li,handle:{...nt},text:{...Is}},"arrow-up":{fill:{$palette:"up.fill"},handle:{...nt,stroke:{$ref:"foregroundColor"}}},"arrow-down":{fill:{$palette:"down.fill"},handle:{...nt,stroke:{$ref:"foregroundColor"}}},"date-range":{...Od},"price-range":{...Od},"date-price-range":{...Od},"quick-date-price-range":{up:{...li,fill:at.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,fillOpacity:.2,handle:{...nt},statistics:{...Pd,color:"#fff",fill:at.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,strokeWidth:0,divider:{stroke:"#fff",strokeWidth:1,strokeOpacity:.5}}},down:{...li,stroke:at.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE,fill:at.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL,fillOpacity:.2,handle:{...nt,stroke:at.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE},statistics:{...Pd,color:"#fff",fill:at.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL,strokeWidth:0,divider:{stroke:"#fff",strokeWidth:1,strokeOpacity:.5}}}},axesButtons:{},toolbar:I2,optionsToolbar:L2},C2={type:"root",optionsKey:"annotations",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new M2(e),themeTemplate:{annotations:T2}};import{_ModuleSupport as _d}from"ag-charts-community";import{_ModuleSupport as wf}from"ag-charts-community";import{createElement as N2}from"ag-charts-core";var{BaseProperties:w2,ObserveChanges:P2,ProxyProperty:O2,Property:Ls,calculatePlacement:_2}=wf,Ki=class extends w2{constructor(){super(),this.opacity=1,this.loadedSynchronously=!0,this.containerWidth=0,this.containerHeight=0,this.onLoad=void 0,this.onImageLoad=()=>{this.loadedSynchronously||(this.node.visible=!1,this.performLayout(this.containerWidth,this.containerHeight),this.onLoad?.())},this.imageElement=N2("img"),this.imageElement.onload=this.onImageLoad,this.node=new wf.Image(this.imageElement)}get complete(){return this.imageElement.width>0&&this.imageElement.height>0}performLayout(e,t){this.containerWidth=e,this.containerHeight=t;const i={width:e,height:t},o=_2(this.imageElement.width,this.imageElement.height,i,this);return this.node.setProperties(this.complete?{visible:!0,opacity:this.opacity,...o}:{visible:!1}),o}};d([Ls],Ki.prototype,"top",2),d([Ls],Ki.prototype,"right",2),d([Ls],Ki.prototype,"bottom",2),d([Ls],Ki.prototype,"left",2),d([Ls],Ki.prototype,"width",2),d([Ls],Ki.prototype,"height",2),d([Ls],Ki.prototype,"opacity",2),d([O2("imageElement.src"),P2(e=>e.loadedSynchronously=e.complete)],Ki.prototype,"url",2);var{ActionOnSet:R2,Property:E2}=_d,Pf=class extends _d.Background{constructor(){super(...arguments),this.image=new Ki}onLayoutComplete(e){if(super.onLayoutComplete(e),this.image){const{width:t,height:i}=e.chart;this.image.performLayout(t,i)}}onImageLoad(){this.ctx.updateService.update(_d.ChartUpdateType.SCENE_RENDER)}};d([E2,R2({newValue(e){this.node.appendChild(e.node),e.onLoad=()=>this.onImageLoad()},oldValue(e){e.node.remove(),e.onLoad=void 0}})],Pf.prototype,"image",2);var B2={type:"root",optionsKey:"background",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new Pf(e)};import{_ModuleSupport as gl}from"ag-charts-community";import{createId as z2}from"ag-charts-core";var{Range:F2,TranslatableGroup:H2,BBox:V2,Property:Di,ZIndexMap:W2,ChartAxisDirection:G2,FillGradientDefaults:K2,FillImageDefaults:$2,FillPatternDefaults:j2,getShapeFill:Y2,InteractionState:yl}=gl,ci=class extends gl.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.id=z2(this),this.enabled=!1,this.stroke="rgb(195, 195, 195)",this.lineDash=[6,3],this.lineDashOffset=0,this.strokeWidth=1,this.strokeOpacity=1,this.fill="#c16068",this.fillOpacity=1,this.fillGradientDefaults=new K2,this.fillPatternDefaults=new j2,this.fillImageDefaults=new $2,this.bounds=new V2(0,0,0,0),this.bandHighlightGroup=new H2({name:"bandHighlight",zIndex:W2.AXIS_BAND_HIGHLIGHT}),this.rangeNode=this.bandHighlightGroup.appendChild(new F2),this.activeAxisHighlight=void 0,this.axisCtx=e.parent,this.hideBand(),e.domManager.addEventListener("focusin",({target:a})=>{const n=a instanceof HTMLElement&&e.domManager.contains(a,"series-area");this.bandHighlightGroup.visible&&!n&&(this.hideBand(),this.ctx.updateService.update(gl.ChartUpdateType.PERFORM_LAYOUT))});const{widgets:{seriesWidget:t,seriesDragInterpreter:i},animationManager:o,eventsHub:s}=e;this.cleanup.register(e.scene.attachNode(this.bandHighlightGroup),t.addListener("mousemove",a=>this.onHoverLikeEvent(a)),t.addListener("mouseleave",()=>this.clearAllHighlight()),o.addListener("animation-start",()=>this.clearAllHighlight()),s.on("layout:complete",a=>this.layout(a)),s.on("series:focus-change",()=>this.onKeyPress()),s.on("zoom:pan-start",()=>this.clearAllHighlight()),s.on("zoom:change",()=>this.clearAllHighlight()),s.on("dom:resize",()=>this.clearAllHighlight()),s.on("axis:change",()=>this.axisChange())),i&&this.cleanup.register(i.events.on("drag-move",a=>this.onHoverLikeEvent(a)),i.events.on("click",a=>this.onClick(a)))}axisChange(){this.onHighlightChange()}isHover(e){return e.type==="mousemove"||e.type==="click"||e.device==="touch"&&this.ctx.chartService.touch.dragAction==="hover"}onClick(e){e.device==="touch"&&this.onHoverLikeEvent(e)}clearAllHighlight(){this.ctx.interactionManager.isState(yl.Clickable)&&this.onHighlightChange()}onKeyPress(){this.ctx.interactionManager.isState(yl.Default)&&this.onHighlightChange()}onHoverLikeEvent(e){const t=this.isHover(e)?yl.Clickable:yl.AnnotationsMoveable;this.ctx.interactionManager.isState(t)&&this.handleHoverHighlight(e)}handleHoverHighlight(e){if(!e)return;const{currentX:t,currentY:i}=e;this.onHighlightChange(this.axisCtx.pickBand({x:t,y:i}))}layout({series:{rect:e,visible:t},axes:i}){if(!t||!i||!this.enabled)return;const{position:o="left",axisId:s}=this.axisCtx,a=i.find(l=>l.id===s);if(!a)return;this.axisLayout=a,this.bounds=e.clone().grow(a.gridPadding,o);const{bandHighlightGroup:n,bounds:r}=this;n.translationX=Math.round(r.x),n.translationY=Math.round(r.y),this.updateBand()}updateBand(){const{rangeNode:e,stroke:t,strokeWidth:i,strokeOpacity:o,lineDash:s,fill:a,fillOpacity:n,fillGradientDefaults:r,fillPatternDefaults:l,fillImageDefaults:c,lineDashOffset:h,axisLayout:p}=this;p&&(e.stroke=t,e.strokeWidth=i,e.strokeOpacity=o,e.lineDash=s,e.lineDashOffset=h,e.fill=Y2(a,r,l,c),e.fillOpacity=n,e.startLine=!0,e.endLine=!0)}isVertical(){return this.axisCtx.direction===G2.X}onHighlightChange(e){this.enabled&&(this.activeAxisHighlight=e,this.activeAxisHighlight?this.showBand():this.hideBand(),this.ctx.updateService.update(gl.ChartUpdateType.SCENE_RENDER))}updateBandPosition(){const{rangeNode:e,bounds:t}=this,{band:i}=this.activeAxisHighlight??{};if(i==null){this.hideBand();return}let o=Math.min(...i),s=Math.max(...i);if(s-o<1){const a=(o+s)/2;o=a-.5,s=a+.5}this.isVertical()?(e.y1=0,e.y2=t.height,e.x1=o,e.x2=s,e.horizontal=!0):(e.y1=o,e.y2=s,e.x1=0,e.x2=t.width,e.horizontal=!1)}showBand(){this.updateBandPosition(),this.bandHighlightGroup.visible=!0}hideBand(){this.bandHighlightGroup.visible=!1}};d([Di],ci.prototype,"enabled",2),d([Di],ci.prototype,"stroke",2),d([Di],ci.prototype,"lineDash",2),d([Di],ci.prototype,"lineDashOffset",2),d([Di],ci.prototype,"strokeWidth",2),d([Di],ci.prototype,"strokeOpacity",2),d([Di],ci.prototype,"fill",2),d([Di],ci.prototype,"fillOpacity",2),d([Di],ci.prototype,"fillGradientDefaults",2),d([Di],ci.prototype,"fillPatternDefaults",2),d([Di],ci.prototype,"fillImageDefaults",2);var U2={type:"axis-option",optionsKey:"bandHighlight",packageType:"enterprise",chartTypes:["cartesian"],axisTypes:["category","ordinal-time","unit-time","grouped-category"],moduleFactory:e=>new ci(e),themeTemplate:{bandHighlight:{enabled:!1,strokeWidth:0,lineDash:[],fill:{$foregroundBackgroundMix:.05}}}};import{_ModuleSupport as Of}from"ag-charts-community";import{Logger as X2}from"ag-charts-core";var{ActionOnSet:Z2,LayoutElement:q2,Menu:Q2,Property:J2}=Of,Rd=[{label:"toolbarSeriesTypeOHLC",icon:"ohlc-series",value:"ohlc"},{label:"toolbarSeriesTypeCandles",icon:"candlestick-series",value:"candlestick"},{label:"toolbarSeriesTypeHollowCandles",icon:"hollow-candlestick-series",value:"hollow-candlestick"},{label:"toolbarSeriesTypeLine",icon:"line-series",value:"line"},{label:"toolbarSeriesTypeStepLine",icon:"step-line-series",value:"step-line"},{label:"toolbarSeriesTypeHLC",icon:"hlc-series",value:"hlc"},{label:"toolbarSeriesTypeHighLow",icon:"high-low-series",value:"high-low"}],_f=class extends Of.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!1,this.menu=new Q2(this.ctx,"chart-toolbar"),this.toolbar=e.sharedToolbar.getSharedToolbar("chartToolbar"),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onButtonPressed.bind(this)),e.layoutManager.registerElement(q2.ToolbarLeft,this.onLayoutStart.bind(this)),()=>this.toolbar.destroy())}onLayoutStart(e){this.enabled&&(this.updateButton(),this.toolbar.layout(e.layoutBox))}onButtonPressed({event:e,buttonBounds:t,buttonWidget:i}){this.menu.setAnchor({x:t.x+t.width+6,y:t.y}),this.menu.show(i,{items:Rd,menuItemRole:"menuitemradio",ariaLabel:this.ctx.localeManager.t("toolbarSeriesTypeDropdown"),class:"ag-charts-chart-toolbar__menu",value:this.getChartType(),sourceEvent:e.sourceEvent,onPress:o=>{this.setChartType(o.value),this.hidePopover()},onHide:()=>{this.toolbar.clearActiveButton()}}),this.toolbar.toggleActiveButtonByIndex(0)}updateButton(){const e=this.getChartType(),t=Rd.find(i=>i.value===e)?.icon;t!=null&&this.toolbar.updateButtons([{icon:t,tooltip:"toolbarSeriesTypeDropdown",value:"menu"}])}hidePopover(){this.toolbar.clearActiveButton(),this.menu.hide()}setChartType(e){const t={chartType:e};this.ctx.chartService.publicApi?.updateDelta(t).catch(i=>X2.error(i))}getChartType(){const e=this.ctx.chartService.publicApi?.getOptions()?.chartType;return e==null||!Rd.some(t=>t.value===e)?"candlestick":e}};d([J2,Z2({changeValue(e){this.toolbar?.setHidden(!e)}})],_f.prototype,"enabled",2);var eL={type:"root",optionsKey:"chartToolbar",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new _f(e)};import{_ModuleSupport as tL}from"ag-charts-community";import{_ModuleSupport as fl,_Widget as Rf}from"ag-charts-community";import{Logger as ml,clamp as Ef,createElement as Ln,toPlainText as iL}from"ag-charts-core";import{isKeyOf as oL}from"ag-charts-core";function sL(e,t){return e==="always"?!0:e==="series-area"?t==="series-area"||t==="series-node":e===t}function Bf(e,t,i){let o=!0;if(t.type==="separator"){const s=i.at(-1);o=s!==void 0&&s.type!=="separator"}if(o&&(o=sL(t.showOn??"always",e)),o){const s=new nL(t);return i.push(s),s}}function zf(e,t,i,o){t.isVisible(i)&&Bf(e,t.builtins.items[i],o)}function aL(e,t,i,o){const{builtins:s}=t;if(oL(i,s.lists))for(const a of s.lists[i])zf(e,t,a,o);else zf(e,t,i,o)}function Ff(e,t,i,o){for(const s of i)if(typeof s=="string")aL(e,t,s,o);else{const a=Bf(e,s,o);s.items&&a&&s.items.length>0&&Ff(e,t,s.items,a.items)}o.at(-1)?.type==="separator"&&o.pop()}var nL=class{constructor(e){this.type="action",this.showOn="always",this.label="",this.iconUrl=void 0,this.enabled=!0,this.items=[],this.action=void 0,e&&this.setOptions(e),this.items=[]}setField(e,t,i){t[e]=i}setOptions(e){let t;for(t in e)e[t]!==void 0&&this.setField(t,this,e[t])}},fo="ag-charts-context-menu",{Property:Ed,ContextMenuRegistry:Tn,callWithContext:xl,getIconClassNames:rL}=fl,Bd="context-menu",Sl=class extends fl.BaseModuleInstance{constructor(e){if(super(),this.ctx=e,this.enabled=!0,this.darkTheme=!1,this.items=["defaults"],this.pickedNode=void 0,this.showEvent=void 0,this.x=0,this.y=0,this.collapsingSubMenus=0,this.menuWidget=new Rf.MenuWidget,this.interactionManager=e.interactionManager,this.element=e.domManager.addChild("canvas-overlay",Bd),this.element.classList.add(fo),this.element.style.display="none",this.element.addEventListener("contextmenu",t=>t.preventDefault()),this.element.addEventListener("focusout",({relatedTarget:t})=>{this.collapsingSubMenus>0||(t==null||t instanceof Node&&!this.element.contains(t))&&this.hide()}),this.cleanup.register(()=>this.element.remove(),()=>this.menuWidget.destroy(),e.eventsHub.on("dom:hidden",()=>this.hide()),this.menuWidget.addListener("collapse-widget",()=>this.onCollapse())),this.menuWidget.addClass(`${fo}__menu`),typeof MutationObserver<"u"){const t=new MutationObserver(()=>{this.element.contains(this.menuWidget.getElement())&&this.reposition()});t.observe(this.element,{childList:!0}),this.mutationObserver=t,this.cleanup.register(()=>t.disconnect())}this.ctx.contextMenuRegistry.builtins.items.download.action=()=>{const t=e.chartService.title;let i="image";t?.enabled&&(i=t.node.getPlainText().replace(/\.+/,"")),this.ctx.chartService.publicApi?.download({fileName:i}).catch(o=>{ml.error("Unable to download chart",o)})},this.cleanup.register(this.ctx.eventsHub.on("context-menu:complete",t=>this.onContext(t)))}expandItemsOptions(e){const t=[];return Ff(e,this.ctx.contextMenuRegistry,this.items,t),t}onContext(e){if(!this.enabled)return;e.widgetEvent.sourceEvent.preventDefault(),this.showEvent=e.widgetEvent.sourceEvent,this.x=e.x,this.y=e.y,this.pickedNode=void 0,this.pickedLegendItem=void 0,Tn.check("series-node",e)?this.pickedNode=e.context.pickedNode:Tn.check("legend-item",e)&&(this.pickedLegendItem=e.context.legendItem);const t=this.expandItemsOptions(e.showOn);t.length!==0&&this.show(e.widgetEvent,t)}show(e,t){const{sourceEvent:i}=e;this.interactionManager.pushState(fl.InteractionState.ContextMenu),this.element.style.display="block";const o=i.pointerType==="touch"?!1:void 0;o!==void 0&&this.ctx.chartService.overrideFocusVisible(o),this.createMenu(t),this.element.appendChild(this.menuWidget.getElement()),this.menuWidget.expand({sourceEvent:i,overrideFocusVisible:o})}hide(){this.menuWidget.collapse()}onCollapse(){this.interactionManager.popState(fl.InteractionState.ContextMenu),this.menuWidget.getElement().remove(),this.element.style.display="none"}onSubMenuExpand(e,t){const i=e.getBounds();e.setFocusOverride(!0),e.getElement().insertAdjacentElement("afterend",t.getElement()),t.getElement().style.position="absolute";const o=this.ctx.domManager.getBoundingClientRect(),s=e.getBoundingClientRect(),a=o.right-s.right,n=s.left-o.left,{offsetWidth:r,offsetHeight:l}=t.getElement();let c=i.y;if(o.height>l){const h=o.bottom-s.top;h=r)t.setBounds({x:i.x+i.width,y:c});else{const h=i.x-r,p=n+h;p>=0?t.setBounds({x:h,y:c}):t.setBounds({x:h-p,y:c})}}onSubMenuCollapse(e,t){e.setFocusOverride(void 0),this.collapsingSubMenus++,t.remove(),this.collapsingSubMenus--}createMenu(e){const{menuWidget:t}=this;t.clear(),t.setTabIndex(-1),this.createMenuItems(t,e)}createMenuItems(e,t){for(const i of t)switch(i.type){case"separator":{e.addSeparator().classList.add(`${fo}__divider`);break}case"action":{if(i.items.length===0){const o=new Rf.MenuItemWidget;this.initButtonElement(o,i),e.addChild(o)}else{const{subMenuButton:o,subMenu:s}=e.addSubMenu();s.addClass(`${fo}__menu`),s.addListener("expand-widget",()=>this.onSubMenuExpand(o,s)),s.addListener("collapse-widget",()=>this.onSubMenuCollapse(o,s)),this.initButtonElement(o,i),this.createMenuItems(s,i.items)}break}default:throw new Error("unhandled case")}}createButtonOnClick(e,t){return Tn.checkCallback("legend-item",e,t)?i=>{const o=i.sourceEvent;if(this.pickedLegendItem){const{seriesId:s,itemId:a,label:n}=this.pickedLegendItem,{chartService:r}=this.ctx;if(typeof a!="string"){ml.error(`unexpected itemId type: [${typeof a}] (expected [string])`);return}const c=[r.series.find(p=>p.id===s)?.properties,r],h={type:"contextmenu",seriesId:s,itemId:a,text:iL(n.text),event:o};xl(c,t,h),this.hide()}else ml.error("legend item not found")}:Tn.checkCallback("series-area",e,t)?()=>{const i=this.ctx.chartService,o={type:"seriesContextMenuAction",event:this.showEvent};xl(i,t,o),this.hide()}:Tn.checkCallback("series-node",e,t)?()=>{const{showEvent:i}=this,{chartService:o}=this.ctx,s=this.pickedNode,a=[s?.series.properties,o],n=s?.series.createNodeContextMenuActionEvent(i,s);n?xl(a,t,n):ml.error("series node not found"),this.hide()}:()=>{const i=this.ctx.chartService,o={type:"contextMenuEvent",event:this.showEvent};xl(i,t,o),this.hide()}}initTableCells(e){const t=Ln("div"),i=Ln("div"),o=Ln("div");return t.classList.toggle(`${fo}__icon`,!0),i.classList.toggle(`${fo}__cell`,!0),o.classList.toggle(`${fo}__cell`,!0),t.ariaHidden="true",i.role="presentation",o.ariaHidden="true",e.append(t,i,o),{cellIcon:t,cellLabel:i,cellArrow:o}}initButtonElement(e,t){e.addClass(`${fo}__item`),e.setEnabled(t.enabled);const i=this.ctx.localeManager.t(t.label),o=`${fo}__cellpadding`,{cellIcon:s,cellLabel:a,cellArrow:n}=this.initTableCells(e.getElement());if(a.textContent=i,a.classList.add(o),t.iconUrl!=null){const c=Ln("img");c.src=t.iconUrl,s.append(c),s.classList.add(o)}if(t.items.length>0){const c=Ln("span",rL("chevron-right"));n.append(c),n.classList.add(o)}const{showOn:r,action:l}=t;l!=null&&e.addListener("click",this.createButtonOnClick(r,l)),t.items.length===0&&(e.addListener("mouseleave",()=>e.setFocusOverride(!1)),e.addListener("mouseenter",()=>e.setFocusOverride(void 0)))}reposition(){let{x:e,y:t}=this;this.element.style.top="unset",this.element.style.bottom="unset";const i=this.ctx.domManager.getBoundingClientRect(),{offsetWidth:o,offsetHeight:s}=this.element;e=Ef(0,e,i.width-o),t=Ef(0,t,i.height-s),this.element.style.left=`${e}px`,this.element.style.top=`calc(${t}px - 0.5em)`}destroy(){super.destroy(),this.mutationObserver?.disconnect(),this.ctx.domManager.removeStyles(Bd),this.ctx.domManager.removeChild("canvas-overlay",Bd)}};d([Ed],Sl.prototype,"enabled",2),d([Ed],Sl.prototype,"darkTheme",2),d([Ed],Sl.prototype,"items",2);var lL={type:"root",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],optionsKey:"contextMenu",moduleFactory:e=>new Sl(e),themeTemplate:{contextMenu:{enabled:!0,darkTheme:tL.ThemeSymbols.IS_DARK_THEME}}};import{_ModuleSupport as Ma}from"ag-charts-community";import{createId as cL,toPlainText as hL}from"ag-charts-core";function Cn(e){return typeof e?.datum=="object"?e.datum:null}import{_ModuleSupport as Hf}from"ag-charts-community";import{createId as dL,setAttribute as pL}from"ag-charts-core";var{FormatManager:uL,BaseProperties:gL,Property:Aa}=Hf,yL="ag-charts-crosshair-label",$o=class extends gL{constructor(){super(...arguments),this.enabled=!0,this.xOffset=0,this.yOffset=0,this.format=void 0,this.renderer=void 0,this._cachedFormatter=void 0}formatValue(e,t,i,o){const{formatter:s,format:a}=this,{domain:n,boundSeries:r}=o;let l;if(s!=null){const c=o.type==="number"?o.fractionDigits:void 0,h=o.type==="date"?o.unit:void 0,p=o.type==="date"?o.step:void 0;l=e(s,{value:i,domain:n,fractionDigits:c,unit:h,step:p,boundSeries:r})}if(a!=null){let c=this._cachedFormatter;(c==null||c.type!==t||c.format!==a)&&(c={type:t,format:a,formatter:uL.getFormatter(t,a)},this._cachedFormatter=c),l??(l=c.formatter?.(i))}return l==null?void 0:String(l)}};d([Aa],$o.prototype,"enabled",2),d([Aa],$o.prototype,"xOffset",2),d([Aa],$o.prototype,"yOffset",2),d([Aa],$o.prototype,"formatter",2),d([Aa],$o.prototype,"format",2),d([Aa],$o.prototype,"renderer",2);var fL=class extends $o{constructor(e,t,i){super(),this.domManager=e,this.id=dL(this),this.element=e.addChild("canvas-overlay",`crosshair-label-${this.id}`),this.element.classList.add(yL),pL(this.element,"aria-hidden",!0),this.element.dataset.key=t,this.element.dataset.axisId=i}show(e){const{element:t}=this,i=e.x+this.xOffset,o=e.y+this.yOffset;t.style.top=`${Math.round(o)}px`,t.style.left=`${Math.round(i)}px`,this.toggle(!0)}setLabelHtml({html:e,styles:t}){if(e!==void 0&&(this.element.innerHTML=e),t!==void 0){const i=this.element.children[0]??this.element;Object.assign(i.style,t)}}getBBox(){const{element:e}=this;return new Hf.BBox(e.clientLeft,e.clientTop,e.clientWidth,e.clientHeight)}toggle(e){this.element.classList.toggle("ag-charts-crosshair-label--hidden",!e)}destroy(){this.domManager.removeChild("canvas-overlay",`crosshair-label-${this.id}`)}toLabelHtml(e,t){if(typeof e=="string")return{html:e,styles:{}};t=t??{};const{text:i=t.text??"",color:o=t.color,backgroundColor:s=t.backgroundColor,opacity:a=t.opacity??1}=e,n={opacity:a,"background-color":s?.toLowerCase(),color:o};return{html:`
+ ${i} +
`,styles:n}}},{Group:mL,TranslatableGroup:xL,Line:SL,BBox:Vf,InteractionState:bl,Property:jo,ZIndexMap:Wf,ChartAxisDirection:Gf}=Ma,mo=class extends Ma.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.id=cL(this),this.enabled=!1,this.stroke="rgb(195, 195, 195)",this.lineDash=[6,3],this.lineDashOffset=0,this.strokeWidth=1,this.strokeOpacity=1,this.snap=!0,this.label=new $o,this.seriesRect=new Vf(0,0,0,0),this.bounds=new Vf(0,0,0,0),this.crosshairGroup=new xL({name:"crosshairs",zIndex:Wf.SERIES_CROSSHAIR}),this.lineGroup=this.crosshairGroup.appendChild(new mL({name:`${this.id}-crosshair-lines`,zIndex:Wf.SERIES_CROSSHAIR})),this.lineGroupSelection=Ma.Selection.select(this.lineGroup,SL,!1),this.activeHighlight=void 0,this.axisCtx=e.parent,this.labels={},this.hideCrosshairs(),e.domManager.addEventListener("focusin",({target:i})=>{const o=i instanceof HTMLElement&&e.domManager.contains(i,"series-area");this.crosshairGroup.visible&&!o&&(this.hideCrosshairs(),this.ctx.updateService.update(Ma.ChartUpdateType.PERFORM_LAYOUT))});const{seriesDragInterpreter:t}=e.widgets;this.cleanup.register(e.scene.attachNode(this.crosshairGroup),e.widgets.seriesWidget.addListener("mousemove",i=>this.onMouseHoverLike(i)),e.widgets.seriesWidget.addListener("mouseleave",()=>this.onMouseOut()),e.eventsHub.on("series:focus-change",()=>this.onKeyPress()),e.eventsHub.on("zoom:pan-start",()=>this.onMouseOut()),e.eventsHub.on("zoom:change",()=>this.onMouseOut()),e.eventsHub.on("highlight:change",i=>this.onHighlightChange(i)),e.eventsHub.on("layout:complete",i=>this.layout(i)),()=>{for(const i of Object.values(this.labels))i.destroy()}),t&&this.cleanup.register(t.events.on("drag-move",i=>this.onMouseHoverLike(i)),t.events.on("click",i=>this.onClick(i)))}layout({series:{rect:e,visible:t},axes:i}){if(!t||!i||!this.enabled)return;this.seriesRect=e;const{position:o="left",axisId:s}=this.axisCtx,a=i.find(c=>c.id===s);if(!a)return;this.axisLayout=a,this.bounds=e.clone().grow(a.gridPadding+a.seriesAreaPadding,o);const{crosshairGroup:n,bounds:r}=this;n.translationX=Math.round(r.x),n.translationY=Math.round(r.y);const l=["pointer",...this.axisCtx.seriesKeyProperties()];this.updateSelections(l),this.updateLines(),this.updateLabels(l)}updateSelections(e){this.lineGroupSelection.update(e,void 0,t=>t)}updateLabels(e){const{labels:t,ctx:i}=this;for(const o of e)this.label.enabled&&(t[o]??(t[o]=new fL(i.domManager,o,this.axisCtx.axisId))),t[o]&&this.updateLabel(t[o])}updateLabel(e){const{enabled:t,xOffset:i,yOffset:o,format:s,renderer:a}=this.label;e.enabled=t,e.xOffset=i,e.yOffset=o,e.format=s,e.renderer=a}updateLines(){const{lineGroupSelection:e,bounds:t,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n,axisLayout:r}=this;if(!r)return;const l=this.isVertical();e.each(c=>{c.stroke=i,c.strokeWidth=o,c.strokeOpacity=s,c.lineDash=a,c.lineDashOffset=n,c.y1=0,c.y2=l?t.height:0,c.x1=0,c.x2=l?0:t.width})}isVertical(){return this.axisCtx.direction===Gf.X}isHover(e){return e.type==="mousemove"||e.type==="click"||e.device==="touch"&&this.ctx.chartService.touch.dragAction==="hover"}formatValue(e){return hL(this.axisCtx.formatScaleValue(e,"crosshair",this.label))}onClick(e){e.device==="touch"&&this.onMouseHoverLike(e)}onMouseHoverLike(e){if(!this.enabled||this.snap)return;const t=this.isHover(e)?bl.Clickable:bl.AnnotationsMoveable;this.ctx.interactionManager.isState(t)&&(this.updatePositions(this.getData(e)),this.crosshairGroup.visible=!0,this.ctx.updateService.update(Ma.ChartUpdateType.SCENE_RENDER))}onMouseOut(){this.ctx.interactionManager.isState(bl.Clickable)&&(this.hideCrosshairs(),this.ctx.updateService.update(Ma.ChartUpdateType.SCENE_RENDER))}onKeyPress(){this.enabled&&!this.snap&&this.ctx.interactionManager.isState(bl.Default)&&this.hideCrosshairs()}onHighlightChange(e){if(!this.enabled)return;const{crosshairGroup:t,axisCtx:i}=this,{datum:o,series:s}=e.currentHighlight??{},a=o&&(s?.axes.x?.id===i.axisId||s?.axes.y?.id===i.axisId);if(this.activeHighlight=a?e.currentHighlight:void 0,!this.activeHighlight)this.hideCrosshairs();else if(this.snap){const n=this.getActiveHighlightData(this.activeHighlight);this.updatePositions(n),t.visible=!0}}isInRange(e){return this.axisCtx.inRange(e)}updatePositions(e){const{seriesRect:t,lineGroupSelection:i}=this;i.each((o,s)=>{const a=e[s];if(!a){o.visible=!1,this.hideLabel(s);return}o.visible=!0;const{value:n,position:r}=a;let l=0,c=0;this.isVertical()?(l=r,o.x=Math.round(l)):(c=r,o.y=Math.round(c)),this.label.enabled?this.showLabel(l+t.x,c+t.y,n,s):this.hideLabel(s)})}getData(e){const{axisCtx:t}=this,i="pointer",{xKey:o="",yKey:s=""}=this.activeHighlight??{},{currentX:a,currentY:n}=e,r=Cn(this.activeHighlight),l=this.isVertical(),c=l?a:n;let h=r?.[l?o:s]??"";return t.continuous&&(h=t.scaleInvert(c)),{[i]:{position:c,value:h}}}getActiveHighlightData(e){const{axisCtx:t}=this,{series:i,xKey:o="",aggregatedValue:s,cumulativeValue:a,midPoint:n}=e,r=Cn(e),l=i.getKeyProperties(t.direction),c=(t.scale.bandwidth??0)/2,h=i.axes[t.direction]?.id===t.axisId,p=l.includes("yKey")&&h,u=l.includes("xKey")&&h,g=s??a;if(p&&g!==void 0){const f=t.scale.convert(g)+c;return this.isInRange(f)?{yKey:{value:g,position:f}}:{}}if(u){const f=(this.isVertical()?n?.x:n?.y)??0,x=t.continuous?t.scaleInvert(f):r?.[o];return this.isInRange(f)?{xKey:{value:x,position:f}}:{}}const y={};for(const f of l){const x=i.properties[f],S=r?.[x],v=t.scale.convert(S)+c;this.isInRange(v)&&(y[f]={value:S,position:v})}return y}getLabelHtml(e,t){const i=this.axisLayout?.label?.fractionDigits??0,o={text:this.formatValue(e)};return this.label.renderer?t.toLabelHtml(this.label.renderer({value:e,fractionDigits:i}),o):t.toLabelHtml(o)}showLabel(e,t,i,o){if(!this.axisLayout)return;const{bounds:s}=this,a=this.labels[o],n=this.getLabelHtml(i,a);a.setLabelHtml(n);const{width:r,height:l}=a.getBBox(),c=this.axisCtx.position;let h=this.axisLayout.label.spacing+this.axisLayout.tickSize;this.axisCtx.direction===Gf.X?(h-=4,a.show({x:e-r/2,y:c==="bottom"?s.y+s.height+h:s.y-l-h})):(h-=8,a.show({x:c==="right"?s.x+s.width+h:s.x-r-h,y:t-l/2}))}hideCrosshairs(){this.crosshairGroup.visible=!1;for(const e of Object.keys(this.labels))this.hideLabel(e)}hideLabel(e){this.labels[e]?.toggle(!1)}};d([jo],mo.prototype,"enabled",2),d([jo],mo.prototype,"stroke",2),d([jo],mo.prototype,"lineDash",2),d([jo],mo.prototype,"lineDashOffset",2),d([jo],mo.prototype,"strokeWidth",2),d([jo],mo.prototype,"strokeOpacity",2),d([jo],mo.prototype,"snap",2),d([jo],mo.prototype,"label",2);var bL={type:"axis-option",optionsKey:"crosshair",packageType:"enterprise",chartTypes:["cartesian"],axisTypes:["category","time","unit-time","ordinal-time","number","log"],moduleFactory:e=>new mo(e),themeTemplate:{crosshair:{snap:!0,stroke:{$ref:"subtleTextColor"},strokeWidth:1,strokeOpacity:1,lineDash:[5,6],lineDashOffset:0,label:{enabled:!0}}}};import{_ModuleSupport as Kf}from"ag-charts-community";var{ActionOnSet:Nn,Property:$f}=Kf,Ia=class extends Kf.BaseModuleInstance{constructor(e){super(),this.enabled=!1,this.getData=()=>Promise.resolve(),this.dataService=e.dataService}updateCallback(e,t){this.dataService&&(e&&t!=null?this.dataService.updateCallback(t):this.dataService.clearCallback())}};d([Nn({newValue(e){this.updateCallback(e,this.getData)}}),$f],Ia.prototype,"enabled",2),d([Nn({newValue(e){this.updateCallback(this.enabled,e)}}),$f],Ia.prototype,"getData",2),d([Nn({newValue(e){this.dataService.requestThrottle=e}})],Ia.prototype,"requestThrottle",2),d([Nn({newValue(e){this.dataService.dispatchThrottle=e}})],Ia.prototype,"updateThrottle",2),d([Nn({newValue(e){this.dataService.dispatchOnlyLatest=!e}})],Ia.prototype,"updateDuringInteraction",2);var vL={type:"root",optionsKey:"dataSource",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new Ia(e),themeTemplate:{dataSource:{enabled:!1}}};import{AgErrorBarSupportedSeriesTypes as kL}from"ag-charts-community";import{AgErrorBarSupportedSeriesTypes as jf,_ModuleSupport as zd}from"ag-charts-community";import{Logger as DL,isDefined as _t}from"ag-charts-core";import{_ModuleSupport as wn}from"ag-charts-community";var{nearestSquared:ML,nearestSquaredInContainer:AL,partialAssign:IL,mergeDefaults:Yf,BBox:Yo}=wn,LL=class{constructor(e){this.components=e,this.union=Yo.merge(e)}containsPoint(e,t){if(!this.union.containsPoint(e,t))return!1;for(const i of this.components)if(i.containsPoint(e,t))return!0;return!1}},TL=class extends wn.Group{constructor(){super(),this.capLength=Number.NaN,this._datum=void 0,this.whiskerPath=new wn.Path,this.capsPath=new wn.Path,this.bboxes=new LL([]),this.append([this.whiskerPath,this.capsPath])}get datum(){return this._datum}set datum(e){this._datum=e}calculateCapLength(e,t){const{lengthRatio:i=1,length:o}=e,{lengthRatioMultiplier:s,lengthMax:a}=t,n=o??i*s;return Math.min(n,a)}getItemStylerParams(e,t,i,o){const{datum:s}=this;if(s==null||e.itemStyler==null)return;const{xLowerKey:a,xUpperKey:n,yLowerKey:r,yUpperKey:l}=e;return{...t,datum:s.datum,seriesId:s.series.id,xKey:s.xKey,yKey:s.yKey,xLowerKey:a,xUpperKey:n,yLowerKey:r,yUpperKey:l,highlighted:i,highlightState:o}}formatStyles(e,t,i,o,s){let{cap:a,...n}=e;const r=this.getItemStylerParams(t,e,o,s);if(r!=null&&t.itemStyler!=null){const l=i.callWithContext(t.itemStyler,r);n=Yf(l,n),a=Yf(l?.cap,l,a)}return{whiskerStyle:n,capsStyle:a}}applyStyling(e,t){IL(["visible","stroke","strokeWidth","strokeOpacity","lineDash","lineDashOffset"],e,t)}update(e,t,i,o,s){if(this.datum===void 0)return;const{whiskerStyle:a,capsStyle:n}=this.formatStyles(e,t,i,o,s),{xBar:r,yBar:l,capDefaults:c}=this.datum,h=this.whiskerPath;this.applyStyling(h,a),h.path.clear(!0),l!==void 0&&(h.path.moveTo(l.lowerPoint.x,l.lowerPoint.y),h.path.lineTo(l.upperPoint.x,l.upperPoint.y)),r!==void 0&&(h.path.moveTo(r.lowerPoint.x,r.lowerPoint.y),h.path.lineTo(r.upperPoint.x,r.upperPoint.y)),h.path.closePath(),this.capLength=this.calculateCapLength(n??{},c);const p=this.capLength/2,u=this.capsPath;this.applyStyling(u,n),u.path.clear(!0),l!==void 0&&(u.path.moveTo(l.lowerPoint.x-p,l.lowerPoint.y),u.path.lineTo(l.lowerPoint.x+p,l.lowerPoint.y),u.path.moveTo(l.upperPoint.x-p,l.upperPoint.y),u.path.lineTo(l.upperPoint.x+p,l.upperPoint.y)),r!==void 0&&(u.path.moveTo(r.lowerPoint.x,r.lowerPoint.y-p),u.path.lineTo(r.lowerPoint.x,r.lowerPoint.y+p),u.path.moveTo(r.upperPoint.x,r.upperPoint.y-p),u.path.lineTo(r.upperPoint.x,r.upperPoint.y+p)),u.path.closePath()}updateBBoxes(){const{capLength:e,whiskerPath:t,capsPath:i}=this,{yBar:o,xBar:s}=this.datum??{},a=e/2,n=[];if(o!==void 0){const r=o.lowerPoint.y-o.upperPoint.y;n.push(new Yo(o.lowerPoint.x,o.upperPoint.y,t.strokeWidth,r),new Yo(o.lowerPoint.x-a,o.lowerPoint.y,e,i.strokeWidth),new Yo(o.upperPoint.x-a,o.upperPoint.y,e,i.strokeWidth))}if(s!==void 0){const r=s.upperPoint.x-s.lowerPoint.x;n.push(new Yo(s.lowerPoint.x,s.upperPoint.y,r,t.strokeWidth),new Yo(s.lowerPoint.x,s.lowerPoint.y-a,i.strokeWidth,e),new Yo(s.upperPoint.x,s.upperPoint.y-a,i.strokeWidth,e))}this.bboxes.components=n,this.bboxes.union=Yo.merge(n)}containsPoint(e,t){return this.bboxes.containsPoint(e,t)}pickNode(e,t){return this.containsPoint(e,t)?this:void 0}nearestSquared(e,t,i){const{bboxes:o}=this;if(o.union.distanceSquared(e,t)>i)return{nearest:void 0,distanceSquared:1/0};const{distanceSquared:s}=ML(e,t,o.components);return{nearest:this,distanceSquared:s}}},CL=class extends wn.Group{nearestSquared(e,t){const{nearest:i,distanceSquared:o}=AL(e,t,{children:this.children()});if(i!==void 0&&!Number.isNaN(o))return{datum:i.datum,distanceSquared:o}}};import{_ModuleSupport as NL}from"ag-charts-community";var{BaseProperties:Uf,Property:Se}=NL,xo=class extends Uf{};d([Se],xo.prototype,"visible",2),d([Se],xo.prototype,"stroke",2),d([Se],xo.prototype,"strokeWidth",2),d([Se],xo.prototype,"strokeOpacity",2),d([Se],xo.prototype,"lineDash",2),d([Se],xo.prototype,"lineDashOffset",2),d([Se],xo.prototype,"length",2),d([Se],xo.prototype,"lengthRatio",2);var rt=class extends Uf{constructor(){super(...arguments),this.visible=!0,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.cap=new xo}};d([Se],rt.prototype,"yLowerKey",2),d([Se],rt.prototype,"yLowerName",2),d([Se],rt.prototype,"yUpperKey",2),d([Se],rt.prototype,"yUpperName",2),d([Se],rt.prototype,"xLowerKey",2),d([Se],rt.prototype,"xLowerName",2),d([Se],rt.prototype,"xUpperKey",2),d([Se],rt.prototype,"xUpperName",2),d([Se],rt.prototype,"visible",2),d([Se],rt.prototype,"stroke",2),d([Se],rt.prototype,"strokeWidth",2),d([Se],rt.prototype,"strokeOpacity",2),d([Se],rt.prototype,"lineDash",2),d([Se],rt.prototype,"lineDashOffset",2),d([Se],rt.prototype,"itemStyler",2),d([Se],rt.prototype,"cap",2);var{fixNumericExtent:wL,groupAccumulativeValueProperty:PL,mergeDefaults:OL,valueProperty:vl,ChartAxisDirection:Pn}=zd;function _L(e){for(const t of jf)if(t===e.series.type)return e.series;throw new Error(`AG Charts - unsupported series type '${e.series.type}', error bars supported series types: ${jf.join(", ")}`)}var RL=class mr extends zd.BaseModuleInstance{constructor(t){super(),this.properties=new rt;const i=_L(t),{annotationGroup:o,annotationSelections:s}=i;this.cartesianSeries=i,this.groupNode=new CL({name:`${o.id}-errorBars`}),o.appendChild(this.groupNode),this.selection=zd.Selection.select(this.groupNode,()=>this.errorBarFactory()),s.add(this.selection),i.addEventListener("seriesVisibilityChange",a=>this.onToggleSeriesItem(a)),this.cleanup.register(i.events.on("data-processed",a=>this.onDataProcessed(a)),i.events.on("data-update",a=>this.onDataUpdate(a)),t.eventsHub.on("highlight:change",a=>this.onHighlightChange(a)),()=>this.groupNode.remove(),()=>s.delete(this.selection))}hasErrorBars(){const{xLowerKey:t,xUpperKey:i,yLowerKey:o,yUpperKey:s}=this.properties;return _t(t)&&_t(i)||_t(o)&&_t(s)}isStacked(){const t=this.cartesianSeries.seriesGrouping?.stackCount;return t==null?!1:t>0}getUnstackPropertyDefinition(t){const i=[],{xLowerKey:o,xUpperKey:s,yLowerKey:a,yUpperKey:n,xErrorsID:r,yErrorsID:l}=this.getMaybeFlippedKeys(),{xScaleType:c,yScaleType:h}=t;return a!=null&&n!=null&&i.push(vl(a,h,{id:`${l}-lower`}),vl(n,h,{id:`${l}-upper`})),o!=null&&s!=null&&i.push(vl(o,c,{id:`${r}-lower`}),vl(s,c,{id:`${r}-upper`})),i}getStackPropertyDefinition(t){const i=[],{cartesianSeries:o}=this,{xLowerKey:s,xUpperKey:a,yLowerKey:n,yUpperKey:r,xErrorsID:l,yErrorsID:c}=this.getMaybeFlippedKeys(),{xScaleType:h,yScaleType:p}=t,u=o.seriesGrouping?.groupIndex??o.id,g={invalidValue:null,missingValue:0,separateNegative:!0,...o.visible?{}:{forceValue:0}},y=(x,S,v,m)=>PL(x,"normal",{id:`${S}-${v}`,groupId:`errorGroup-${u}-${v}`,...g},m),f=(x,S,v,m)=>{i.push(...y(x,v,"lower",m),...y(S,v,"upper",m))};return n!=null&&r!=null&&f(n,r,c,p),s!=null&&a!=null&&f(s,a,l,h),i}getPropertyDefinitions(t){return this.isStacked()?this.getStackPropertyDefinition(t):this.getUnstackPropertyDefinition(t)}onDataProcessed(t){this.dataModel=t.dataModel,this.processedData=t.processedData}getDomain(t){const{xLowerKey:i,xUpperKey:o,xErrorsID:s,yLowerKey:a,yUpperKey:n,yErrorsID:r}=this.getMaybeFlippedKeys();if(t===Pn.X?_t(i)&&_t(o):_t(a)&&_t(n)){const{dataModel:c,processedData:h,cartesianSeries:p}=this;if(c!=null&&h!=null){const u={x:s,y:r}[t],g=c.getDomain(p,`${u}-lower`,"value",h),y=c.getDomain(p,`${u}-upper`,"value",h),f=[Math.min(...g,...y),Math.max(...g,...y)];return wL(f)}}return[]}onDataUpdate(t){this.dataModel=t.dataModel,this.processedData=t.processedData,_t(t.dataModel)&&_t(t.processedData)&&(this.createNodeData(),this.update())}getNodeData(){return this.hasErrorBars()?this.cartesianSeries.contextNodeData?.nodeData:void 0}createNodeData(){const t=this.getNodeData(),i=this.cartesianSeries.axes[Pn.X]?.scale,o=this.cartesianSeries.axes[Pn.Y]?.scale;if(!(!i||!o||!t))for(let s=0;sthis.updateNode(i,o,s)))}updateNode(t,i,o){t.datum=i,t.update(this.getDefaultStyle(),this.properties,this.cartesianSeries,!1,"none"),t.updateBBoxes()}pickNodeExact(t){const{x:i,y:o}=t,s=this.groupNode.pickNode(i,o);if(s!=null)return{datum:s.datum,distanceSquared:0}}pickNodeNearest(t){return this.groupNode.nearestSquared(t.x,t.y)}pickNodeMainAxisFirst(t,i){let o,s=[1/0,1/0];const a=[t.x,t.y];i===Pn.Y&&a.reverse();for(const n of this.groupNode.children()){const r=n.getBBox(),l=[r.x+r.width/2,r.y+r.height/2];i===Pn.Y&&l.reverse();const c=[];for(let h=0;hnew RL(e),themeTemplate:EL};import{_ModuleSupport as kl}from"ag-charts-community";var{ZIndexMap:zL,ActionOnSet:FL,Property:Fd,ProxyPropertyOnWrite:Xf}=kl,Dl=class extends kl.Background{constructor(){super(...arguments),this.image=new Ki,this.fill="transparent",this.fillOpacity=void 0}createNode(){return new kl.Group({name:"foreground",zIndex:zL.FOREGROUND})}onLayoutComplete(e){super.onLayoutComplete(e);const{width:t,height:i}=e.chart;let o={x:0,y:0,width:t,height:i};this.image&&(o=this.image.performLayout(t,i)),this.text&&this.updateTextNode(o)}onImageLoad(){this.ctx.updateService.update(kl.ChartUpdateType.SCENE_RENDER)}updateTextNode(e){const{textNode:t}=this;t.fontWeight="bold",t.fontFamily="Impact, sans-serif",t.fontSize=19,t.opacity=.7,t.fill="#9b9b9b",t.textBaseline="top";const i=this.textNode.getBBox(),o=10;t.x=e.x+e.width/2-i.width/2,t.y=e.y+e.height+o}};d([Fd,FL({newValue(e){this.node.appendChild(e.node),e.onLoad=()=>this.onImageLoad()},oldValue(e){e.node.remove(),e.onLoad=void 0}})],Dl.prototype,"image",2),d([Fd,Xf("rectNode","fill")],Dl.prototype,"fill",2),d([Fd,Xf("rectNode","fillOpacity")],Dl.prototype,"fillOpacity",2);var HL={type:"root",optionsKey:"foreground",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new Dl(e)};import{_ModuleSupport as Hd}from"ag-charts-community";import{Logger as VL,clamp as Vd}from"ag-charts-core";import{_ModuleSupport as Wd}from"ag-charts-community";import{Logger as Zf,calcLineHeight as WL}from"ag-charts-core";import{_ModuleSupport as GL}from"ag-charts-community";var{TranslatableGroup:KL,SceneChangeDetection:qf}=GL,Gd=class extends KL{constructor(){super(...arguments),this.inset=0,this.cornerRadius=0}applyClip(e,t){const{cornerRadius:i,inset:o}=this,{x:s,y:a,width:n,height:r}=t,l=new Path2D;l.roundRect(s+o,a+o,n-2*o,r-2*o,i),e.clip(l)}};d([qf()],Gd.prototype,"inset",2),d([qf()],Gd.prototype,"cornerRadius",2);var{Property:Kd,ZIndexMap:Ts,ActionOnSet:Qf,CategoryAxis:$L,Padding:jL,Group:Cs,BBox:Jf,ProxyProperty:em,stackCartesianSeries:YL}=Wd,$d=class{constructor(){this.top=0,this.bottom=0}};d([Kd],$d.prototype,"top",2),d([Kd],$d.prototype,"bottom",2);var La=class extends Wd.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!1,this.padding=new $d,this.root=new Cs({name:"root"}),this.seriesRoot=this.root.appendChild(new Gd({name:"Series-root",zIndex:Ts.SERIES_LAYER,renderToOffscreenCanvas:!0})),this.axisGridGroup=this.root.appendChild(new Cs({name:"Axes-Grids",zIndex:Ts.AXIS_GRID})),this.axisGroup=this.root.appendChild(new Cs({name:"Axes-Grids",zIndex:Ts.AXIS_GRID})),this.axisLabelGroup=this.root.appendChild(new Cs({name:"Axes-Labels",zIndex:Ts.SERIES_LABEL})),this.axisCrosslineRangeGroup=this.root.appendChild(new Cs({name:"Axes-Crosslines-Range",zIndex:Ts.SERIES_CROSSLINE_RANGE})),this.axisCrosslineLineGroup=this.root.appendChild(new Cs({name:"Axes-Crosslines-Line",zIndex:Ts.SERIES_CROSSLINE_LINE})),this.axisCrosslineLabelGroup=this.root.appendChild(new Cs({name:"Axes-Crosslines-Label",zIndex:Ts.SERIES_LABEL})),this.data=[],this._destroyed=!1,this.miniChartAnimationPhase="initial",this.seriesRect=void 0,this.axes=[],this.series=[]}destroy(){if(!this._destroyed){this.destroySeries(this.series);for(const e of this.axes)e.destroy();this.axes=[],this._destroyed=!0}}onSeriesChange(e,t){const i=t?.filter(o=>!e.includes(o))??[];this.destroySeries(i);for(const o of e)t?.includes(o)||(o.attachSeries(this.seriesRoot,this.seriesRoot,void 0),o.chart={},Object.defineProperty(o.chart,"mode",{get:()=>"standalone"}),Object.defineProperty(o.chart,"isMiniChart",{get:()=>!0}),Object.defineProperty(o.chart,"seriesRect",{get:()=>this.seriesRect}),o.resetAnimation(this.miniChartAnimationPhase==="initial"?"initial":"disabled"));this.seriesRect=void 0}destroySeries(e){if(e)for(const t of e)t.destroy(),t.detachSeries(this.seriesRoot,this.seriesRoot,void 0),t.chart=void 0}assignSeriesToAxes(){for(const e of this.axes)e.boundSeries=this.series.filter(t=>t.axes[e.direction]===e)}assignAxesToSeries(){const e={};for(const t of this.axes){const i=t.direction;(e[i]??(e[i]=[])).push(t)}for(const t of this.series)for(const i of t.directions){const o=e[i];if(!o){Zf.warnOnce(`no available axis for direction [${i}]; check series and axes configuration.`);continue}const s=t.getKeys(i),a=this.findMatchingAxis(o,s);if(!a){Zf.warnOnce(`no matching axis for direction [${i}] and keys [${s}]; check series and axes configuration.`);continue}t.axes[i]=a}}findMatchingAxis(e,t){for(const i of e){if(!i.keys.length)return i;if(t){for(const o of t)if(i.keys.includes(o))return i}}}updateData(e){for(const t of this.series)t.setChartData(e);this.miniChartAnimationPhase==="initial"&&this.ctx.animationManager.onBatchStop(()=>{this.miniChartAnimationPhase="ready";for(const t of this.series)t.resetAnimation("disabled")})}async processData(e){this.series.some(t=>t.canHaveAxes)&&(this.assignAxesToSeries(),this.assignSeriesToAxes()),await Promise.all(this.series.map(async t=>(t.resetDatumCallbackCache(),t.processData(e))));for(const t of this.axes)t.processData()}computeAxisPadding(){const e=new jL;if(!this.enabled)return e;for(const{position:t,thickness:i,line:o,label:s}of this.axes){if(t==null)continue;let a;i?a=i:a=(o.enabled?o.width:0)+(s.enabled?WL(s.fontSize??0)+s.spacing:0),e[t]=Math.ceil(a)}return e}async layout(e,t){var i;const{padding:o}=this,s=this.seriesRect!=null,a=new Jf(0,0,e,t-(o.top+o.bottom)),n=this.seriesRect==null||this.seriesRect.width!==e||this.seriesRect.height!==t;this.seriesRect=a,this.seriesRoot.translationY=o.top,this.seriesRoot.setClipRectCanvasSpace(new Jf(0,-o.top,e,t));for(const r of this.axes){const{position:l="left"}=r;switch(l){case"top":case"bottom":r.range=[0,a.width],r.gridLength=a.height;break;case"right":case"left":{const c=r instanceof $L;r.range=c?[0,a.height]:[a.height,0],r.gridLength=a.width;break}}if(r.gridPadding=0,r.translation.x=0,r.translation.y=0,l==="right"?r.translation.x=e:l==="bottom"&&(r.translation.y=t),s||r.resetAnimation("initial"),r.crossLines)for(const c of r.crossLines)c instanceof Wd.CartesianCrossLine&&(c.position=r.position??"top",(i=c.label).parallel??(i.parallel=r.label?.parallel));r.calculateLayout(),r.update()}n&&YL(this.series),await Promise.all(this.series.map(async r=>r.update({seriesRect:a})))}};d([Kd],La.prototype,"enabled",2),d([em(["seriesRoot","inset"])],La.prototype,"inset",2),d([em(["seriesRoot","cornerRadius"])],La.prototype,"cornerRadius",2),d([Qf({changeValue(e,t=[]){const i={axisNode:this.axisGroup,gridNode:this.axisGridGroup,labelNode:this.axisLabelGroup,crossLineLineNode:this.axisCrosslineLineGroup,crossLineRangeNode:this.axisCrosslineRangeGroup,crossLineLabelNode:this.axisCrosslineLabelGroup};for(const o of t)e.includes(o)||(o.detachAxis(),o.destroy());for(const o of e)t?.includes(o)||o.attachAxis(i)}})],La.prototype,"axes",2),d([Qf({changeValue(e,t){this.onSeriesChange(e,t)}})],La.prototype,"series",2);import{_ModuleSupport as UL}from"ag-charts-community";import{clamp as XL}from"ag-charts-core";var{SliderWidget:tm}=UL,ZL=class{constructor(e,t){this.ctx=e,this.sliderHandlers=t,this._min=0,this._max=1,this.minRange=.001,this.dragStartX=0,this.ctx=e,this.toolbar=e.proxyInteractionService.createProxyContainer({type:"toolbar",domManagerId:"navigator-toolbar",classList:["ag-charts-proxy-navigator-toolbar"],orientation:"vertical",ariaLabel:{id:"ariaLabelNavigator"}}),this.sliders=[e.proxyInteractionService.createProxyElement({type:"slider",domIndex:1,ariaLabel:{id:"ariaLabelNavigatorMinimum"},parent:this.toolbar,cursor:"ew-resize"}),e.proxyInteractionService.createProxyElement({type:"slider",domIndex:-1/0,ariaLabel:{id:"ariaLabelNavigatorRange"},parent:this.toolbar,cursor:"grab"}),e.proxyInteractionService.createProxyElement({type:"slider",domIndex:2,ariaLabel:{id:"ariaLabelNavigatorMaximum"},parent:this.toolbar,cursor:"ew-resize"})];for(const[i,o]of["min","pan","max"].entries()){const s=this.sliders[i];s.step=tm.STEP_HUNDRETH,s.keyboardStep=tm.STEP_ONE,s.orientation="horizontal",s.setPreventsDefault(!1),s.addListener("drag-start",a=>this.onDragStart(i,a,o)),s.addListener("drag-move",a=>this.onDrag(s,a,o)),s.addListener("drag-end",()=>this.updateSliderRatios()),s.addListener("contextmenu",a=>this.onContextMenu(s,a))}this.sliders[0].addListener("change",()=>this.onMinSliderChange()),this.sliders[1].addListener("change",()=>this.onPanSliderChange()),this.sliders[2].addListener("change",()=>this.onMaxSliderChange()),this.updateSliderRatios(),this.updateVisibility(!1)}destroy(){this.toolbar.destroy()}updateVisibility(e){this.toolbar.setHidden(!e)}updateZoom(){const{_min:e,_max:t}=this;if(!(e==null||t==null))return this.ctx.zoomManager.updateZoom("navigator",{x:{min:e,max:t}})}updateBounds(e){this.toolbar.setBounds(e)}updateSliderBounds(e,t){this.sliders[e].setBounds(t)}updateMinMax(e,t){this._min=e,this._max=t,this.updateSliderRatios()}updateSliderRatios(){let{_min:e,_max:t}=this;e=Math.round(e*100)/100,t=Math.round(t*100)/100;const i=this.ctx.localeManager.t("ariaValuePanRange",{min:e,max:t});this.sliders[0].setValueRatio(e),this.sliders[1].setValueRatio(e,{ariaValueText:i}),this.sliders[2].setValueRatio(t)}toCanvasOffsets(e){return{offsetX:this.dragStartX+e.originDeltaX}}moveToFront(e){if(e===1)return;const t=this.sliders[e],i=this.sliders[2-e];this.toolbar.moveChild(i,t.domIndex-1)}onDragStart(e,t,i){const o=this.sliders[e],s=this.toolbar.cssLeft(),a=o.cssLeft();this.dragStartX=s+a+t.offsetX,this.moveToFront(e),t.sourceEvent.preventDefault(),this.sliderHandlers.onDragStart(i,this.toCanvasOffsets(t))}onDrag(e,t,i){t.sourceEvent.preventDefault(),this.sliderHandlers.onDrag(i,this.toCanvasOffsets(t))}onContextMenu(e,t){const{offsetX:i,offsetY:o}=t,{x:s,y:a}=this.toolbar.getBounds(),{x:n,y:r}=e.getBounds(),l=i+s+n,c=o+a+r;this.ctx.contextMenuRegistry.dispatchContext("always",{widgetEvent:t,canvasX:l,canvasY:c},void 0)}onPanSliderChange(){const e=this.sliders[1].getValueRatio(),t=this._max-this._min;this._min=XL(0,e,1-t),this._max=this._min+t,this.updateZoom()}onMinSliderChange(){this._min=this.sliders[0].clampValueRatio(0,this._max-this.minRange),this.updateZoom()}onMaxSliderChange(){this._max=this.sliders[2].clampValueRatio(this._min+this.minRange,1),this.updateZoom()}};import{_ModuleSupport as im}from"ag-charts-community";var{Property:Ml,SceneChangeDetection:Al,BBox:qL,ExtendedPath2D:QL}=im,Uo=class extends im.Path{constructor(){super(...arguments),this.zIndex=3,this.centerX=0,this.centerY=0,this.width=8,this.height=16,this.cornerRadius=4,this.grip=!0,this.gripPath=new QL}setCenter(e,t){this.dirtyPath=!0,(this.centerX!==e||this.centerY!==t)&&(this.centerX=e,this.centerY=t,this.markDirty("center"))}static align(e,t,i,o,s,a,n,r,l){const c=e.align(i+s*n)+l,h=c+e.align(i+s*n,s*(r-n))-2*l,p=e.align(o+a/2);e.setCenter(c,p),t.setCenter(h,p)}computeBBox(){const{centerX:e,centerY:t,width:i,height:o}=this,s=e-i/2,a=t-o/2;return new qL(s,a,i,o)}isPointInPath(e,t){return this.getBBox().containsPoint(e,t)}updatePath(){const{centerX:e,centerY:t,path:i,gripPath:o,strokeWidth:s,cornerRadius:a,grip:n}=this,r=s/2,l=this.layerManager?.canvas?.pixelRatio??1;i.clear(),o.clear();const c=Math.floor(this.width/2*l)/l,h=Math.floor(this.height/2*l)/l;i.roundRect(e-c+r,t-h+r,2*(c-r),2*(h-r),a);const p=3;if(n)for(let u=-.5;u<=.5;u+=1)for(let g=-1;g<=1;g+=1)o.arc(e+u*p,t+g*p,1,0,2*Math.PI),o.closePath()}renderFill(e,t){const{stroke:i}=this;super.renderFill(e,t),e.fillStyle=typeof i=="string"?i:"black",e.fill(this.gripPath.getPath2D())}};Uo.className="RangeHandle",d([Ml,Al()],Uo.prototype,"width",2),d([Ml,Al()],Uo.prototype,"height",2),d([Ml,Al()],Uo.prototype,"cornerRadius",2),d([Ml,Al()],Uo.prototype,"grip",2);import{_ModuleSupport as JL}from"ag-charts-community";var{Path:eT,BBox:jd,ExtendedPath2D:tT,clippedRoundRect:iT,Property:oT,SceneChangeDetection:sT}=JL,Yd=class extends eT{constructor(){super(...arguments),this.cornerRadius=4,this.zIndex=2,this.x=0,this.y=0,this.width=200,this.height=30,this.min=0,this.max=1,this.visiblePath=new tT}layout(e,t,i,o,s,a){s=Number.isNaN(s)?this.min:s,a=Number.isNaN(a)?this.max:a,(e!==this.x||t!==this.y||i!==this.width||this.height!==o||s!==this.min||a!==this.max)&&(this.x=e,this.y=t,this.width=i,this.height=o,this.min=s,this.max=a,this.dirtyPath=!0,this.markDirty("RangeMask.layout"))}computeBBox(){const{x:e,y:t,width:i,height:o}=this;return new jd(e,t,i,o)}computeVisibleRangeBBox(){const{x:e,y:t,width:i,height:o,min:s,max:a}=this,n=e+i*s,r=e+i*a;return new jd(n,t,r-n,o)}updatePath(){const{path:e,visiblePath:t,x:i,y:o,width:s,height:a,min:n,max:r,strokeWidth:l,cornerRadius:c}=this,h=l/2;e.clear(),t.clear();const p=this.align(i)+h,u=this.align(o)+h,g=this.align(i,s)-2*h,y=this.align(o,a)-2*h,f=this.align(i+s*n)+h,x=f+this.align(i+s*n,s*(r-n))-2*h,S={topLeft:c,topRight:c,bottomRight:c,bottomLeft:c},v=(m,b,k)=>{if(k-b<1)return;const A=new jd(b,u,k-b,y);iT(m,p,u,g,y,S,A)};v(e,p,f),v(e,x,g+p),v(t,f,x)}renderStroke(e,t){super.renderStroke(e,t),super.renderStroke(e,this.visiblePath.getPath2D())}};Yd.className="RangeMask",d([oT,sT()],Yd.prototype,"cornerRadius",2);import{_ModuleSupport as Il}from"ag-charts-community";var aT=class extends Il.Group{constructor(e){super({name:"rangeSelectorGroup",zIndex:Il.ZIndexMap.NAVIGATOR}),this.x=0,this.y=0,this.width=200,this.height=30,this.lOffset=0,this.rOffset=0,this.background=this.appendChild(new Il.TranslatableGroup({name:"navigator-background",zIndex:1})),this.append(e)}layout(e,t,i,o,s,a){this.x=e,this.y=t,this.width=i,this.height=o,this.lOffset=s,this.rOffset=a,this.background.translationX=e,this.background.translationY=t,this.markDirty("RangeSelector")}updateBackground(e,t){e?.remove(),t!=null&&this.background.appendChild(t),this.markDirty("RangeSelector")}computeBBox(){const{x:e,y:t,width:i,height:o,lOffset:s,rOffset:a}=this;return new Il.BBox(e-s,t,i+(s+a),o)}},{BaseModuleInstance:nT,ObserveChanges:Ud,Property:Ll}=Hd,Ta=class extends nT{constructor(e){super(),this.ctx=e,this.enabled=!1,this.mask=new Yd,this.minHandle=new Uo,this.maxHandle=new Uo,this.maskVisibleRange={id:"navigator-mask-visible-range",getBBox:()=>this.mask.computeVisibleRangeBBox(),toCanvasBBox:()=>this.mask.computeVisibleRangeBBox(),fromCanvasPoint:(t,i)=>({x:t,y:i})},this.height=30,this.cornerRadius=0,this.spacing=10,this.x=0,this.y=0,this.width=0,this.rangeSelector=new aT([this.mask,this.minHandle,this.maxHandle]),this.cleanup.register(e.scene.attachNode(this.rangeSelector),e.eventsHub.on("locale:change",()=>this.updateZoom()),e.layoutManager.registerElement(Hd.LayoutElement.Navigator,t=>this.onLayoutStart(t)),e.eventsHub.on("layout:complete",t=>this.onLayoutComplete(t)),e.eventsHub.on("zoom:change",t=>this.onZoomChange(t))),this.domProxy=new ZL(e,this),this.updateGroupVisibility(),this.miniChart=new La(e)}updateBackground(e,t){this.rangeSelector?.updateBackground(e,t)}updateGroupVisibility(){const{enabled:e}=this;this.rangeSelector==null||e===this.rangeSelector.visible||(this.rangeSelector.visible=e,this.domProxy.updateVisibility(e),e?this.updateZoom():this.ctx.zoomManager.updateZoom("navigator"))}onLayoutStart(e){if(this.enabled){const{layoutBox:t}=e,i=this.height+this.spacing;t.shrink(i,"bottom"),this.y=t.y+t.height+this.spacing}else this.y=0;if(this.enabled&&this.miniChart){const{top:t,bottom:i}=this.miniChart.computeAxisPadding();e.layoutBox.shrink(t+i,"bottom"),this.y-=i,this.miniChart.inset=this.mask.strokeWidth/2,this.miniChart.cornerRadius=this.mask.cornerRadius}}onLayoutComplete(e){const{x:t,width:i}=e.series.rect,{y:o,height:s}=this;if(this.domProxy.updateVisibility(this.enabled),this.enabled){const{_min:a,_max:n}=this.domProxy;this.layoutNodes(t,o,i,s,a,n),this.domProxy.updateBounds({x:t,y:o,width:i,height:s})}this.x=t,this.width=i,this.miniChart?.layout(i,s).catch(a=>VL.error(a))}canDrag(){return this.enabled&&this.ctx.interactionManager.isState(Hd.InteractionState.ZoomDraggable)}onDragStart(e,{offsetX:t}){this.canDrag()&&(e==="pan"&&(this.panStart=(t-this.x)/this.width-this.domProxy._min),this.ctx.zoomManager.fireZoomPanStartEvent("navigator"))}onDrag(e,{offsetX:t}){if(!this.canDrag())return;const{panStart:i,x:o,width:s}=this,{minRange:a}=this.domProxy;let{_min:n,_max:r}=this.domProxy;const l=(t-o)/s;if(e==="min")n=Vd(0,l,r-a);else if(e==="max")r=Vd(n+a,l,1);else if(e==="pan"&&i!=null){const c=r-n;n=Vd(0,l-i,1-c),r=n+c}this.domProxy._min=n,this.domProxy._max=r,this.updateZoom()}onZoomChange(e){const{x:t}=e;if(!t)return;const{x:i,y:o,width:s,height:a}=this,{min:n,max:r}=t;this.domProxy.updateMinMax(n,r),this.layoutNodes(i,o,s,a,n,r)}layoutNodes(e,t,i,o,s,a){const{rangeSelector:n,mask:r,minHandle:l,maxHandle:c}=this;r.layout(e,t,i,o,s,a),n.layout(e,t,i,o,l.width/2,c.width/2),Uo.align(l,c,e,t,i,o,s,a,r.strokeWidth/2),s+(a-s)/2<.5?(l.zIndex=3,c.zIndex=4):(l.zIndex=4,c.zIndex=3);for(const[h,p]of[l,this.maskVisibleRange,c].entries()){const u=p.getBBox(),g={x:u.x-e,y:u.y-t,height:u.height,width:u.width};this.domProxy.updateSliderBounds(h,g)}}updateZoom(){this.enabled&&this.domProxy.updateZoom()}updateData(e){return this.miniChart?.updateData(e)}async processData(e){if(this.miniChart)return this.miniChart?.processData(e)}};d([Ud((e,t,i)=>{e.updateBackground(i?.root,t?.root)})],Ta.prototype,"miniChart",2),d([Ll,Ud((e,t)=>{e.ctx.zoomManager.setNavigatorEnabled(!!t),e.updateGroupVisibility()})],Ta.prototype,"enabled",2),d([Ll],Ta.prototype,"height",2),d([Ll,Ud((e,t)=>{e.mask.cornerRadius=t})],Ta.prototype,"cornerRadius",2),d([Ll],Ta.prototype,"spacing",2);import{_ModuleSupport as rT}from"ag-charts-community";import{_ModuleSupport as lT}from"ag-charts-community";import{array as cT,arrayOfDefs as hT,boolean as On,callbackOf as dT,color as Tl,fontOptionsDef as pT,number as om,positiveNumber as hi,ratio as uT,typeUnion as gT}from"ag-charts-core";import{_ModuleSupport as sm}from"ag-charts-community";import{_ModuleSupport as Cl}from"ag-charts-community";function yT(e){return{from:e?{scalingX:1,scalingY:0}:{scalingX:0,scalingY:1},to:{scalingX:1,scalingY:1}}}function fT(e){return(t,i)=>e?{scalingCenterY:i.scaledValues.medianValue}:{scalingCenterX:i.scaledValues.medianValue}}import{_ModuleSupport as mT}from"ag-charts-community";var{Path:xT,Scalable:ST,ExtendedPath2D:bT,SceneChangeDetection:lt,SceneArrayChangeDetection:vT,BBox:Ns,clippedRoundRect:am}=mT,je=class extends ST(xT){constructor(){super(...arguments),this.wickPath=new bT,this.horizontal=!1,this.center=0,this.thickness=0,this.min=0,this.q1=0,this.median=0,this.q3=0,this.max=0,this.cornerRadius=0,this.crisp=!1,this.strokeAlignment=0,this.wickStroke=void 0,this.wickStrokeWidth=void 0,this.wickStrokeOpacity=void 0,this.capLengthRatio=1,this.wickStrokeAlignment=0}computeBBox(){const{horizontal:e,center:t,thickness:i,min:o,max:s}=this;return e?new Ns(Math.min(o,s),t-i/2,Math.abs(s-o),i):new Ns(t-i/2,Math.min(o,s),i,Math.abs(s-o))}computeDefaultGradientFillBBox(){const{horizontal:e,center:t,thickness:i,q1:o,q3:s}=this;return e?new Ns(Math.min(o,s),t-i/2,Math.abs(s-o),i):new Ns(t-i/2,Math.min(o,s),i,Math.abs(s-o))}isPointInPath(e,t){return this.getBBox().containsPoint(e,t)}distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}get midPoint(){return this.horizontal?{x:(this.min+this.max)/2,y:this.center}:{x:this.center,y:(this.min+this.max)/2}}alignedCoordinates(){const{thickness:e,crisp:t}=this;let{center:i,min:o,q1:s,median:a,q3:n,max:r}=this,l=i-e/2,c=i+e/2;if(t&&e>1){o=this.align(o),s=this.align(s),a=this.align(a),n=this.align(n),r=o+this.align(o,r-o);const h=this.align(e/2);i=this.align(i),l=i-h,c=i+h}return{center:i,x0:l,x1:c,min:o,max:r,q1:s,median:a,q3:n}}updatePath(){const{path:e,stroke:t,strokeWidth:i,strokeOpacity:o,lineDash:s,lineDashOffset:a,wickStroke:n,wickStrokeWidth:r,wickStrokeOpacity:l,wickLineDash:c,wickLineDashOffset:h,strokeAlignment:p,cornerRadius:u,capLengthRatio:g,horizontal:y}=this,{center:f,x0:x,x1:S,min:v,max:m,q1:b,median:k,q3:A}=this.alignedCoordinates(),M=this.layerManager?.canvas.pixelRatio??1,D=this.wickStrokeAlignment>0?M/this.wickStrokeAlignment/2%1:0;this.path.clear(),this.wickPath.clear();const N=n!=null&&n!==t||r!=null&&r!==i||l!=null&&l!==o||c!=null&&c!==s||h!=null&&h!==a?this.wickPath:e;if(Math.abs(S-x)<=3){Ca(N,y,f,v),Na(N,y,f,m);return}const P=Math.min(v,m),R=Math.max(v,m),F=Math.min(b,A),_=Math.max(b,A),E=f-Math.abs((S-x)*g)/2,T=f+Math.abs((S-x)*g)/2;Ca(N,y,E,P-D),Na(N,y,T,P-D),Ca(N,y,f-D,P-D),Na(N,y,f-D,F+i/2),Ca(N,y,f-D,R+D),Na(N,y,f-D,_-i/2),Ca(N,y,E,R+D),Na(N,y,T,R+D);const w=i/2+p,C=i/2-p,I=_-F-2*C;if(I>0){const O=x+w,z=F+C,B=S-x-2*w,H={topLeft:u,topRight:u,bottomRight:u,bottomLeft:u};nm(e,y,O,z,B,I,H,new Ns(O,z,B,k-z)),nm(e,y,O,z,B,I,H,new Ns(O,k,B,z+I-k))}else{const O=(F+_)/2;Ca(e,y,x,O),Na(e,y,S,O)}}drawPath(e){super.drawPath(e);const{wickPath:t}=this;if(t.isEmpty())return;const{stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n,wickStroke:r=i,wickStrokeWidth:l=o,wickStrokeOpacity:c=s,wickLineDash:h=a,wickLineDashOffset:p=n}=this;l!==0&&(e.globalAlpha*=c,typeof r=="string"&&(e.strokeStyle=r),e.lineWidth=l,h!=null&&e.setLineDash([...h]),e.lineDashOffset=p,e.stroke(t.getPath2D()))}};d([lt()],je.prototype,"horizontal",2),d([lt()],je.prototype,"center",2),d([lt()],je.prototype,"thickness",2),d([lt()],je.prototype,"min",2),d([lt()],je.prototype,"q1",2),d([lt()],je.prototype,"median",2),d([lt()],je.prototype,"q3",2),d([lt()],je.prototype,"max",2),d([lt()],je.prototype,"cornerRadius",2),d([lt()],je.prototype,"crisp",2),d([lt()],je.prototype,"strokeAlignment",2),d([lt()],je.prototype,"wickStroke",2),d([lt()],je.prototype,"wickStrokeWidth",2),d([lt()],je.prototype,"wickStrokeOpacity",2),d([vT()],je.prototype,"wickLineDash",2),d([lt()],je.prototype,"wickLineDashOffset",2),d([lt()],je.prototype,"capLengthRatio",2),d([lt()],je.prototype,"wickStrokeAlignment",2);function Ca(e,t,i,o){t?e.moveTo(o,i):e.moveTo(i,o)}function Na(e,t,i,o){t?e.lineTo(o,i):e.lineTo(i,o)}function nm(e,t,i,o,s,a,n,r){t?am(e,o,i,a,s,n,r==null?void 0:new Ns(r.y,r.x,r.height,r.width)):am(e,i,o,s,a,n,r)}import{_ModuleSupport as kT}from"ag-charts-community";var{BaseProperties:rm,AbstractBarSeriesProperties:DT,makeSeriesTooltip:MT,Property:de,mergeDefaults:AT}=kT,lm=class extends rm{constructor(){super(...arguments),this.lengthRatio=.5}};d([de],lm.prototype,"lengthRatio",2);var wa=class extends rm{};d([de],wa.prototype,"stroke",2),d([de],wa.prototype,"strokeWidth",2),d([de],wa.prototype,"strokeOpacity",2),d([de],wa.prototype,"lineDash",2),d([de],wa.prototype,"lineDashOffset",2);var fe=class extends DT{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.cap=new lm,this.whisker=new wa,this.tooltip=MT()}toJson(){const{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:o,lineDashOffset:s}=this,a=super.toJson();return a.whisker=AT(a.whisker,{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:o,lineDashOffset:s}),a}};d([de],fe.prototype,"xKey",2),d([de],fe.prototype,"minKey",2),d([de],fe.prototype,"q1Key",2),d([de],fe.prototype,"medianKey",2),d([de],fe.prototype,"q3Key",2),d([de],fe.prototype,"maxKey",2),d([de],fe.prototype,"xName",2),d([de],fe.prototype,"yName",2),d([de],fe.prototype,"minName",2),d([de],fe.prototype,"q1Name",2),d([de],fe.prototype,"medianName",2),d([de],fe.prototype,"q3Name",2),d([de],fe.prototype,"maxName",2),d([de],fe.prototype,"fill",2),d([de],fe.prototype,"fillOpacity",2),d([de],fe.prototype,"stroke",2),d([de],fe.prototype,"strokeWidth",2),d([de],fe.prototype,"strokeOpacity",2),d([de],fe.prototype,"lineDash",2),d([de],fe.prototype,"lineDashOffset",2),d([de],fe.prototype,"cornerRadius",2),d([de],fe.prototype,"styler",2),d([de],fe.prototype,"itemStyler",2),d([de],fe.prototype,"cap",2),d([de],fe.prototype,"whisker",2),d([de],fe.prototype,"tooltip",2);var{fixNumericExtent:IT,keyProperty:LT,mergeDefaults:Xd,SeriesNodePickMode:cm,SMALLEST_KEY_INTERVAL:TT,valueProperty:_n,diff:CT,animationValidation:NT,computeBarFocusBounds:wT,createDatumId:PT,HighlightState:Zd,ContinuousScale:OT,ChartAxisDirection:_T,motion:hm,getItemStyles:RT,applyShapeFillBBox:ET,calculateSegments:BT,toHighlightString:zT}=Cl,FT=class extends Cl.SeriesNodeEvent{constructor(e,t,i,o){super(e,t,i,o),this.xKey=o.properties.xKey,this.minKey=o.properties.minKey,this.q1Key=o.properties.q1Key,this.medianKey=o.properties.medianKey,this.q3Key=o.properties.q3Key,this.maxKey=o.properties.maxKey}},Nl=class extends Cl.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[cm.NEAREST_NODE,cm.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["medianKey","q1Key","q3Key","minKey","maxKey"]},propertyNames:{x:["xName"],y:["medianName","q1Name","q3Name","minName","maxName"]},categoryKey:"xValue",pathsPerSeries:[]}),this.properties=new fe,this.NodeEvent=FT}async processData(e){if(!this.visible)return;const{xKey:t,minKey:i,q1Key:o,medianKey:s,q3Key:a,maxKey:n}=this.properties,r=!this.ctx.animationManager.isSkipped(),l=this.getCategoryAxis()?.scale,c=this.getValueAxis()?.scale,{isContinuousX:h,xScaleType:p,yScaleType:u}=this.getScaleInformation({xScale:l,yScale:c}),g=[];r&&this.processedData&&g.push(CT(this.id,this.processedData)),r&&g.push(NT());const{processedData:y}=await this.requestDataModel(e,this.data,{props:[LT(t,p,{id:"xValue"}),_n(i,u,{id:"minValue"}),_n(o,u,{id:"q1Value"}),_n(s,u,{id:"medianValue"}),_n(a,u,{id:"q3Value"}),_n(n,u,{id:"maxValue"}),...h?[TT]:[],...g]});this.smallestDataInterval=y.reduced?.smallestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];if(e!==this.getBarDirection()){const{index:s,def:a}=i.resolveProcessedDataDefById(this,"xValue"),n=t.domain.keys[s];return a.type==="key"&&a.valueType==="category"?n:this.padBandExtent(n)}const o=this.domainForClippedRange(e,["minValue","maxValue"],"xValue");return IT(o)}getSeriesRange(e,t){return this.domainForVisibleRange(_T.Y,["maxValue","minValue"],"xValue",t)}createNodeData(){const{visible:e,dataModel:t,processedData:i}=this,o=this.getCategoryAxis(),s=this.getValueAxis();if(!(t&&i&&o&&s))return;const{xKey:a}=this.properties,n=[],r=t.resolveKeysById(this,"xValue",i),l=t.resolveColumnById(this,"minValue",i),c=t.resolveColumnById(this,"q1Value",i),h=t.resolveColumnById(this,"medianValue",i),p=t.resolveColumnById(this,"q3Value",i),u=t.resolveColumnById(this,"maxValue",i),{barWidth:g,groupIndex:y}=this.updateGroupScale(o),f=OT.is(o.scale)?g*-.5:0,{groupScale:x}=this,S=this.isVertical(),v=BT(this.properties.segmentation,o,s,this.chart.seriesRect,this.ctx.scene),m={itemId:a,nodeData:n,labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:RT(this.getItemStyle.bind(this)),segments:v};if(!e)return m;const b=i.dataSources.get(this.id)?.data??[];for(const[k,A]of b.entries()){const M=r[k];if(M==null)continue;const D=l[k],L=c[k],N=h[k],P=p[k],R=u[k];if([D,L,N,P,R].some(O=>typeof O!="number")||D>L||L>N||N>P||P>R)continue;const F={xValue:o.scale.convert(M),minValue:s.scale.convert(D),q1Value:s.scale.convert(L),medianValue:s.scale.convert(N),q3Value:s.scale.convert(P),maxValue:s.scale.convert(R)},_=g;F.xValue+=x.convert(String(y))+f+_/2;const E=Math.abs(F.q3Value-F.q1Value),T=F.xValue,w=Math.min(F.q3Value,F.q1Value)+E/2,C={x:S?T:w,y:S?w:T};let I;S?I={x:C.x-_/2,y:F.minValue,width:_,height:F.maxValue-F.minValue}:I={x:F.minValue,y:C.y-_/2,width:F.maxValue-F.minValue,height:_},n.push({series:this,itemId:M,datum:A,datumIndex:k,xKey:a,bandwidth:_,scaledValues:F,midPoint:C,focusRect:I})}return m}legendItemSymbol(){const{fill:e,stroke:t,strokeWidth:i,fillOpacity:o,strokeOpacity:s,lineDash:a,lineDashOffset:n}=this.getStyle(!1,!1,Zd.None);return{marker:{fill:Cl.deepClone(e),fillOpacity:o,stroke:t,strokeOpacity:s,strokeWidth:i,lineDash:a,lineDashOffset:n}}}getLegendData(e){const{id:t,ctx:{legendManager:i},visible:o}=this,{xKey:s,yName:a,showInLegend:n,legendItemName:r}=this.properties;return!s||e!=="category"?[]:[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:o&&i.getItemEnabled({seriesId:t,itemId:t}),label:{text:r??a??t},symbol:this.legendItemSymbol(),legendItemName:r,hideInLegend:!n}]}getTooltipContent(e){const{id:t,dataModel:i,processedData:o,properties:s}=this,{xKey:a,xName:n,yName:r,medianKey:l,medianName:c,q1Key:h,q1Name:p,q3Key:u,q3Name:g,minKey:y,minName:f,maxKey:x,maxName:S,legendItemName:v,tooltip:m}=s,b=this.getCategoryAxis(),k=this.getValueAxis();if(!i||!o||!b||!k)return;const A=o.dataSources.get(this.id)?.data[e],M=i.resolveKeysById(this,"xValue",o)[e],D=i.resolveColumnById(this,"minValue",o)[e],L=i.resolveColumnById(this,"q1Value",o)[e],N=i.resolveColumnById(this,"medianValue",o)[e],P=i.resolveColumnById(this,"q3Value",o)[e],R=i.resolveColumnById(this,"maxValue",o)[e];if(M==null)return;const F=this.getItemStyle(e,!1),_=[{label:f,fallbackLabel:y,value:this.getAxisValueText(k,"tooltip",D,A,y,v)},{label:p,fallbackLabel:h,value:this.getAxisValueText(k,"tooltip",L,A,h,v)},{label:c,fallbackLabel:l,value:this.getAxisValueText(k,"tooltip",N,A,l,v)},{label:g,fallbackLabel:u,value:this.getAxisValueText(k,"tooltip",P,A,u,v)},{label:S,fallbackLabel:x,value:this.getAxisValueText(k,"tooltip",R,A,x,v)}];return this.formatTooltipWithContext(m,{heading:this.getAxisValueText(b,"tooltip",M,A,a,v),title:v??r,symbol:this.legendItemSymbol(),data:_},{seriesId:t,datum:A,title:r,xKey:a,xName:n,yName:r,medianKey:l,medianName:c,q1Key:h,q1Name:p,q3Key:u,q3Name:g,minKey:y,minName:f,maxKey:x,maxName:S,...F})}animateEmptyUpdateReady({datumSelection:e}){const t=this.isVertical(),{from:i,to:o}=yT(t);hm.resetMotion([e],fT(t)),hm.staticFromToMotion(this.id,"datums",this.ctx.animationManager,[e],i,o,{phase:"initial"})}isLabelEnabled(){return!1}updateDatumSelection(e){const t=e.nodeData??[];return e.datumSelection.update(t)}makeStylerParams(e,t){const{id:i}=this,{cornerRadius:o,cap:{lengthRatio:s},fill:a,fillOpacity:n,lineDash:r,lineDashOffset:l,stroke:c,strokeOpacity:h,strokeWidth:p,maxKey:u,maxName:g,medianKey:y,medianName:f,minKey:x,minName:S,q1Key:v,q1Name:m,q3Key:b,q3Name:k,whisker:{lineDash:A,lineDashOffset:M,stroke:D,strokeOpacity:L,strokeWidth:N},xKey:P,xName:R,yName:F}=this.properties,_=zT(t??Zd.None);return{cap:{lengthRatio:s},cornerRadius:o,fill:a,fillOpacity:n,highlightState:_,highlighted:e,lineDash:r,lineDashOffset:l,maxKey:u,maxName:g??u,medianKey:y,medianName:f??y,minKey:x,minName:S??x,q1Key:v,q1Name:m??v,q3Key:b,q3Name:k??b,seriesId:i,stroke:c,strokeOpacity:h,strokeWidth:p,whisker:{lineDash:A??r,lineDashOffset:M??l,stroke:D??c,strokeOpacity:L??h,strokeWidth:N??p},xKey:P,xName:R??P,yName:F}}getStyle(e,t,i){const{cap:o,cornerRadius:s,fill:a,fillOpacity:n,lineDash:r,lineDashOffset:l,stroke:c,strokeOpacity:h,strokeWidth:p,styler:u,whisker:g}=this.properties;let y={};if(!e&&u){const f=this.makeStylerParams(t,i);y=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(u,f)??{},{pick:!1})??{}}return{cornerRadius:y.cornerRadius??s,fill:y.fill??a,fillOpacity:y.fillOpacity??n,lineDash:y.lineDash??r,lineDashOffset:y.lineDashOffset??l,opacity:1,stroke:y.stroke??c,strokeOpacity:y.strokeOpacity??h,strokeWidth:y.strokeWidth??p,cap:{lengthRatio:y.cap?.lengthRatio??o.lengthRatio},whisker:{lineDash:y.whisker?.lineDash??g.lineDash,lineDashOffset:y.whisker?.lineDashOffset??g.lineDashOffset,stroke:y.whisker?.stroke??g.stroke,strokeOpacity:y.whisker?.strokeOpacity??g.strokeOpacity,strokeWidth:y.whisker?.strokeWidth??g.strokeWidth}}}getItemStyle(e,t,i){const{properties:o}=this,{itemStyler:s}=o,a=this.getHighlightStyle(t,e,i);let n=Xd(a,this.getStyle(e===void 0,t,i));if(s!=null&&e!=null){const u=this.cachedDatumCallback(PT(e,t?"highlight":"node"),()=>{const g=this.makeItemStylerParams(e,t,n);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(s,g))});u&&(n=Xd(u,n))}const{stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}=n;return n.whisker=Xd(n.whisker,{stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}),n}makeItemStylerParams(e,t,i){const{id:o}=this,{xKey:s,minKey:a,q1Key:n,medianKey:r,q3Key:l,maxKey:c}=this.properties,h=this.processedData?.dataSources.get(o)?.data[e],p=this.ctx.highlightManager?.getActiveHighlight(),u=this.getHighlightStateString(p,t,e),g=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:o,datum:h,xKey:s,minKey:a,q1Key:n,medianKey:r,q3Key:l,maxKey:c,highlighted:t,highlightState:u,...i,fill:g}}updateDatumStyles({datumSelection:e,isHighlight:t}){const i=this.ctx.highlightManager.getActiveHighlight();e.each((o,s)=>{const a=this.getHighlightState(i,t,s.datumIndex);s.style=this.getItemStyle(s.datumIndex,t,a)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:o}=this;if(!i)return;const s=this.isVertical(),a=this.ctx.highlightManager.getActiveHighlight(),n=this.getShapeFillBBox(),r=this.getStyle(!1,!1,Zd.None).strokeWidth/2,l=o.whisker.strokeWidth??o.strokeWidth;e.each((c,h)=>{const p=h.style??i.styles[this.getHighlightState(a,t,h.datumIndex)];ET(c,p.fill,n),c.fill=p.fill,c.fillOpacity=p.fillOpacity,c.stroke=p.stroke,c.strokeWidth=p.strokeWidth,c.strokeOpacity=p.strokeOpacity,c.lineDash=p.lineDash,c.lineDashOffset=p.lineDashOffset,c.wickStroke=p.whisker.stroke,c.wickStrokeWidth=p.whisker.strokeWidth,c.wickStrokeOpacity=p.whisker.strokeOpacity,c.wickLineDash=p.whisker.lineDash,c.wickLineDashOffset=p.whisker.lineDashOffset,c.cornerRadius=p.cornerRadius,c.crisp=!0,c.horizontal=!s,c.center=h.scaledValues.xValue,c.thickness=h.bandwidth,c.min=h.scaledValues.minValue,c.q1=h.scaledValues.q1Value,c.median=h.scaledValues.medianValue,c.q3=h.scaledValues.q3Value,c.max=h.scaledValues.maxValue,c.capLengthRatio=p.cap.lengthRatio,c.strokeAlignment=r,c.wickStrokeAlignment=l})}updateLabelNodes(){}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;return i.update(t)}nodeFactory(){return new je}computeFocusBounds({datumIndex:e}){return wT(this,this.contextNodeData?.nodeData[e].focusRect)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null}};Nl.className="BoxPlotSeries",Nl.type="box-plot";import{_ModuleSupport as HT}from"ag-charts-community";import{boolean as VT,constant as WT,required as ws,shapeSegmentation as GT,string as Rt}from"ag-charts-core";var{boxPlotSeriesThemeableOptionsDef:KT,commonSeriesOptionsDefs:$T}=HT,jT={...$T,...KT,type:ws(WT("box-plot")),xKey:ws(Rt),minKey:ws(Rt),q1Key:ws(Rt),medianKey:ws(Rt),q3Key:ws(Rt),maxKey:ws(Rt),xName:Rt,yName:Rt,minName:Rt,q1Name:Rt,medianName:Rt,q3Name:Rt,maxName:Rt,grouped:VT,legendItemName:Rt,segmentation:GT};import{_ModuleSupport as YT}from"ag-charts-community";var{ThemeConstants:{CARTESIAN_AXIS_TYPE:dm},multiSeriesHighlightStyle:UT,FILL_GRADIENT_LINEAR_DEFAULTS:XT,FILL_IMAGE_DEFAULTS:ZT,FILL_PATTERN_DEFAULTS:qT,SAFE_FILL_OPERATION:QT,SEGMENTATION_DEFAULTS:JT}=YT,eC={series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$if:[{$or:[{$isGradient:{$palette:"fill"}},{$isPattern:{$palette:"fill"}},{$isImage:{$palette:"fill"}}]},{$palette:"fill"},{$mix:[QT,{$ref:"chartBackgroundColor"},.7]}]},["gradient",XT],["image",ZT],["pattern",qT]]},stroke:{$palette:"stroke"},strokeWidth:2,fillOpacity:1,strokeOpacity:1,lineDash:void 0,lineDashOffset:0,highlight:UT(),segmentation:JT},axes:{[dm.NUMBER]:{crosshair:{snap:!1}},[dm.CATEGORY]:{groupPaddingInner:.2,crosshair:{enabled:!1,snap:!1}}}},tC={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"box-plot",moduleFactory:e=>new Nl(e),predictAxis:sm.predictCartesianTimeAxis,defaultAxes:sm.DIRECTION_SWAP_AXES,themeTemplate:eC,groupable:!0},pm={type:"series",name:"box-plot",chartType:"cartesian",enterprise:!0,options:jT,create:e=>new Nl(e)};import{_ModuleSupport as iC}from"ag-charts-community";import{_ModuleSupport as oC}from"ag-charts-community";import{_ModuleSupport as qd}from"ag-charts-community";import{Logger as um}from"ag-charts-core";import{_ModuleSupport as sC}from"ag-charts-community";var{AGGREGATION_SPAN:gm,AGGREGATION_INDEX_X_MAX:aC,AGGREGATION_INDEX_X_MIN:nC,AGGREGATION_INDEX_Y_MAX:rC,AGGREGATION_INDEX_Y_MIN:lC,aggregationDomain:cC,aggregationRangeFittingPoints:hC,compactAggregationIndices:dC,createAggregationIndices:pC}=sC,uC=1e3,ym=nC,gC=rC,yC=lC,fm=aC;function fC(e,t,i,o,s,a){if(t.length64;)({indexData:c,valueData:h,maxRange:l}=dC(c,h,l)),p.push({maxRange:l,indexData:c});return p.reverse(),p}var{fixNumericExtent:mC,keyProperty:xC,createDatumId:mm,SeriesNodePickMode:xm,ChartAxisDirection:Sm,SMALLEST_KEY_INTERVAL:SC,valueProperty:wl,diff:bC,animationValidation:vC,computeBarFocusBounds:kC,visibleRangeIndices:bm,BandScale:DC,processedDataIsAnimatable:MC,mergeDefaults:vm,simpleMemorize2:AC,getItemStylesPerItemId:IC}=qd,LC=AC(fC),TC=class extends qd.SeriesNodeEvent{constructor(e,t,i,o){super(e,t,i,o),this.xKey=o.properties.xKey,this.openKey=o.properties.openKey,this.closeKey=o.properties.closeKey,this.highKey=o.properties.highKey,this.lowKey=o.properties.lowKey}},km=class extends qd.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[xm.AXIS_ALIGNED,xm.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["lowKey","highKey","openKey","closeKey"]},propertyNames:{x:["xName"],y:["lowName","highName","openName","closeName"]},categoryKey:"xValue",pathsPerSeries:[]}),this.NodeEvent=TC,this.dataAggregationFilters=void 0}async processData(e){if(!this.visible)return;const{xKey:t,openKey:i,closeKey:o,highKey:s,lowKey:a}=this.properties,n=!this.ctx.animationManager.isSkipped(),r=this.getCategoryAxis()?.scale,l=this.getValueAxis()?.scale,{isContinuousX:c,xScaleType:h,yScaleType:p}=this.getScaleInformation({xScale:r,yScale:l}),u=[];n&&(this.processedData&&u.push(bC(this.id,this.processedData)),u.push(vC())),i&&u.push(wl(i,p,{id:"openValue",invalidValue:void 0,missingValue:void 0}));const{dataModel:g,processedData:y}=await this.requestDataModel(e,this.data,{props:[xC(t,h,{id:"xValue"}),wl(o,p,{id:"closeValue"}),wl(s,p,{id:"highValue"}),wl(a,p,{id:"lowValue"}),...c?[SC]:[],...u]});this.smallestDataInterval=y.reduced?.smallestKeyInterval,this.dataAggregationFilters=this.aggregateData(g,y),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||MC(t))return;const i=this.axes[Sm.X];if(i==null)return;const o=e.resolveKeysById(this,"xValue",t),s=e.resolveColumnById(this,"highValue",t),a=e.resolveColumnById(this,"lowValue",t),{index:n}=e.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[n];return LC(i.scale.type,o,s,a,r,t.reduced?.smallestKeyInterval)}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];if(e!==this.getBarDirection()){const{index:s,def:a}=i.resolveProcessedDataDefById(this,"xValue"),n=t.domain.keys[s];return a.type==="key"&&a.valueType==="category"?n:this.padBandExtent(n)}const o=this.domainForClippedRange(e,["highValue","lowValue"],"xValue");return mC(o)}getSeriesRange(e,t){return this.domainForVisibleRange(Sm.Y,["highValue","lowValue"],"xValue",t)}getZoomRangeFittingItems(e,t,i){return this.zoomFittingVisibleItems("xValue",["highValue","lowValue"],e,t,i)}getVisibleItems(e,t,i){return this.countVisibleItems("xValue",["highValue","lowValue"],e,t,i)}createNodeData(){const{visible:e,dataModel:t,processedData:i}=this,o=this.getCategoryAxis(),s=this.getValueAxis();if(!(t&&i&&o&&s))return;const a=[],{xKey:n,highKey:r,lowKey:l}=this.properties,c=i.dataSources.get(this.id)?.data??[],h=t.resolveKeysById(this,"xValue",i),p=t.resolveColumnById(this,"openValue",i),u=t.resolveColumnById(this,"closeValue",i),g=t.resolveColumnById(this,"highValue",i),y=t.resolveColumnById(this,"lowValue",i),{groupScale:f}=this,{barWidth:x,groupIndex:S}=this.updateGroupScale(o),v=f.convert(String(S)),m=x>=1?x:f.rawBandwidth,b=DC.is(o.scale),k={itemId:n,nodeData:a,labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:IC(this.getItemStyle.bind(this),"up","down")};if(!e)return k;const A=(_,E,T,w,C,I,O,z)=>{const B=c[_],H=b?O/2:0,W=o.scale.convert(E)+v+H,V=s.scale.convert(T),G=s.scale.convert(w),K=s.scale.convert(C),Q=s.scale.convert(I),X=w>T,Y=X?"up":"down",J=Math.min(K,Q),ie=Math.max(K,Q)-J,U={x:W,y:J+ie/2};a.push({series:this,itemId:Y,datum:B,datumIndex:_,xKey:n,xValue:E,openValue:T,closeValue:w,highValue:C,lowValue:I,midPoint:U,aggregatedValue:w,isRising:X,centerX:W,width:O,y:J,height:ie,yOpen:V,yClose:G,crisp:z})},{dataAggregationFilters:M}=this,D=o.scale,[L,N]=D.range,P=Math.abs(N-L),R=_=>D.convert(h[_])+v,F=M?.find(_=>_.maxRange>P);if(F==null){const _=i.invalidData?.get(this.id);let[E,T]=bm(1,c.length,o.range,w=>{const C=b?0:-m/2,I=R(w)+C;return[I,I+m]});i.input.count<1e3&&(E=0,T=i.input.count);for(let w=E;w=I&&z>=O;if(!H){um.warnOnce(`invalid low value for key [${l}] in data element, low value cannot be higher than datum open or close values`);continue}if(!W){um.warnOnce(`invalid high value for key [${r}] in data element, high value cannot be lower than datum open or close values.`);continue}A(w,C,I,O,z,B,m,!0)}}else{const{maxRange:_,indexData:E}=F,[T,w]=bm(1,_,o.range,C=>{const I=C*gm,O=E[I+ym],z=E[I+fm];if(O===-1)return;const B=b?0:-m/2;return[R(O)+B,R(z)+B+m]});for(let C=T;C{const g=this.makeItemStylerParams(o,e,t,h);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`,"item",o],this.callWithContext(r,g))});u&&(h=vm(u,h))}return h}makeItemStylerParams(e,t,i,o){const{id:s,properties:a,processedData:n}=this,{xKey:r,openKey:l,closeKey:c,highKey:h,lowKey:p}=a,u=n.dataSources.get(s)?.data[t],g=this.ctx.highlightManager?.getActiveHighlight(),y=this.getHighlightStateString(g,i,t),f={seriesId:s,datum:u,itemId:e,xKey:r,openKey:l,closeKey:c,highKey:h,lowKey:p,highlighted:i,highlightState:y,...o};return"fill"in f&&"fill"in o&&(f.fill=this.filterItemStylerFillParams(o.fill)??o.fill),f}getTooltipContent(e){const{id:t,dataModel:i,processedData:o,properties:s}=this,{xKey:a,xName:n,yName:r,openKey:l,openName:c,highKey:h,highName:p,lowKey:u,lowName:g,closeKey:y,closeName:f,legendItemName:x,tooltip:S}=s,v=this.getCategoryAxis(),m=this.getValueAxis();if(!i||!o||!v||!m)return;const b=o.dataSources.get(this.id)?.data[e],k=i.resolveKeysById(this,"xValue",o)[e],A=i.resolveColumnById(this,"openValue",o)[e],M=i.resolveColumnById(this,"highValue",o)[e],D=i.resolveColumnById(this,"lowValue",o)[e],L=i.resolveColumnById(this,"closeValue",o)[e];if(k==null)return;const N=L>=A?"up":"down",P=this.properties.item[N],R=this.getItemStyle(e,!1),F={fill:P.fill??P.stroke,fillOpacity:P.fillOpacity??P.strokeOpacity??1,stroke:P.stroke,strokeWidth:P.strokeWidth??1,strokeOpacity:P.strokeOpacity??1,lineDash:P.lineDash??[0],lineDashOffset:P.lineDashOffset??0};return this.formatTooltipWithContext(S,{heading:this.getAxisValueText(v,"tooltip",k,b,a,x),title:x,symbol:{marker:F},data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(m,"tooltip",A,b,l,x)},{label:p,fallbackLabel:h,value:this.getAxisValueText(m,"tooltip",M,b,h,x)},{label:g,fallbackLabel:u,value:this.getAxisValueText(m,"tooltip",D,b,u,x)},{label:f,fallbackLabel:y,value:this.getAxisValueText(m,"tooltip",L,b,y,x)}]},{seriesId:t,datum:b,title:r,itemId:N,xKey:a,xName:n,yName:r,openKey:l,openName:c,highKey:h,highName:p,lowKey:u,lowName:g,closeKey:y,closeName:f,...R})}computeFocusBounds(e){const t=this.getNodeData()?.at(e.datumIndex);if(t==null)return;const{centerX:i,y:o,width:s,height:a}=t,n={x:i-s/2,y:o,width:s,height:a};return kC(this,n)}};import{_ModuleSupport as CC}from"ag-charts-community";import{_ModuleSupport as NC}from"ag-charts-community";var{Path:wC,SceneChangeDetection:Xo,BBox:PC}=NC,So=class extends wC{constructor(){super(...arguments),this.centerX=0,this.y=0,this.width=0,this.height=0,this.yOpen=0,this.yClose=0,this.crisp=!1}computeBBox(){const{centerX:e,y:t,width:i,height:o}=this;return new PC(e-i/2,t,i,o)}isPointInPath(e,t){return this.getBBox().containsPoint(e,t)}distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}get midPoint(){return{x:this.centerX,y:this.y+this.height/2}}alignedCoordinates(){const{y:e,width:t,height:i,crisp:o}=this;let{centerX:s,yOpen:a,yClose:n}=this,r=s-t/2,l=s+t/2,c=e,h=e+i;if(o&&t>1){if(s=this.align(s),a<=n){const u=this.align(a,n-a);a=this.align(a),n=a+u}else{const u=this.align(n,a-n);n=this.align(n),a=n+u}const p=this.align(t/2);r=s-p,l=s+p,c=this.align(e),h=c+this.align(c,i)}return{centerX:s,x0:r,x1:l,y0:c,y1:h,yOpen:a,yClose:n}}executeStroke(e,t){const{width:i,strokeWidth:o}=this;i0?l/this.strokeAlignment/2%1:0;e.clear(),e.moveTo(t-c,s),e.lineTo(t-c,a),Math.abs(o-i)>1&&(e.moveTo(i,n-c),e.lineTo(t-c,n-c),e.moveTo(t-c,r-c),e.lineTo(o,r-c))}};d([Xo()],Dm.prototype,"strokeAlignment",2);var{SceneArrayChangeDetection:OC,SceneChangeDetection:Rn,ExtendedPath2D:_C,BBox:RC}=CC,Ps=class extends So{constructor(){super(...arguments),this.wickPath=new _C,this.wickStroke=void 0,this.wickStrokeWidth=void 0,this.wickStrokeOpacity=void 0,this.wickStrokeAlignment=0}computeDefaultGradientFillBBox(){const{width:e,centerX:t,yOpen:i,yClose:o}=this,s=Math.min(i,o),n=Math.max(i,o)-s,r=t-e/2,l=t+e/2;return new RC(r,s,l-r,n)}updatePath(){const{path:e,stroke:t,strokeWidth:i,strokeOpacity:o,lineDash:s,lineDashOffset:a,wickStroke:n,wickStrokeWidth:r,wickStrokeOpacity:l,wickLineDash:c,wickLineDashOffset:h}=this,{centerX:p,x0:u,x1:g,y0:y,y1:f,yOpen:x,yClose:S}=this.alignedCoordinates(),v=this.layerManager?.canvas.pixelRatio??1,m=this.wickStrokeAlignment>0?v/this.wickStrokeAlignment/2%1:0;this.path.clear(),this.wickPath.clear();const k=n!=null&&n!==t||r!=null&&r!==i||l!=null&&l!==o||c!=null&&c!==s||h!=null&&h!==a?this.wickPath:e;if(Math.abs(g-u)<=3){k.moveTo(p-m,y),k.lineTo(p-m,f);return}const A=Math.min(x,S),M=Math.max(x,S),D=i/2;k.moveTo(p-m,y),k.lineTo(p-m,A+D),k.moveTo(p-m,f),k.lineTo(p-m,M-D);const L=M-A-2*D;if(L>0)e.rect(u+D,A+D,g-u-2*D,L);else{const N=(A+M)/2;e.moveTo(u,N),e.lineTo(g,N)}}drawPath(e){super.drawPath(e);const{wickPath:t}=this;if(t.isEmpty())return;const{stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n,wickStroke:r=i,wickStrokeWidth:l=o,wickStrokeOpacity:c=s,wickLineDash:h=a,wickLineDashOffset:p=n}=this;l!==0&&(e.globalAlpha*=c,typeof r=="string"&&(e.strokeStyle=r),e.lineWidth=l,h!=null&&e.setLineDash([...h]),e.lineDashOffset=p,e.stroke(t.getPath2D()))}};d([Rn()],Ps.prototype,"wickStroke",2),d([Rn()],Ps.prototype,"wickStrokeWidth",2),d([Rn()],Ps.prototype,"wickStrokeOpacity",2),d([OC()],Ps.prototype,"wickLineDash",2),d([Rn()],Ps.prototype,"wickLineDashOffset",2),d([Rn()],Ps.prototype,"wickStrokeAlignment",2);import{_ModuleSupport as EC}from"ag-charts-community";import{_ModuleSupport as BC}from"ag-charts-community";var{BaseProperties:Mm,Property:Pe,AbstractBarSeriesProperties:zC,makeSeriesTooltip:FC}=BC,Os=class extends Mm{constructor(){super(...arguments),this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};d([Pe],Os.prototype,"stroke",2),d([Pe],Os.prototype,"strokeWidth",2),d([Pe],Os.prototype,"strokeOpacity",2),d([Pe],Os.prototype,"lineDash",2),d([Pe],Os.prototype,"lineDashOffset",2);var Qd=class extends Mm{constructor(){super(...arguments),this.up=new Os,this.down=new Os}};d([Pe],Qd.prototype,"up",2),d([Pe],Qd.prototype,"down",2);var $t=class extends zC{};d([Pe],$t.prototype,"xKey",2),d([Pe],$t.prototype,"openKey",2),d([Pe],$t.prototype,"closeKey",2),d([Pe],$t.prototype,"highKey",2),d([Pe],$t.prototype,"lowKey",2),d([Pe],$t.prototype,"xName",2),d([Pe],$t.prototype,"yName",2),d([Pe],$t.prototype,"openName",2),d([Pe],$t.prototype,"closeName",2),d([Pe],$t.prototype,"highName",2),d([Pe],$t.prototype,"lowName",2);var Pl=class extends $t{constructor(){super(...arguments),this.tooltip=FC(),this.item=new Qd}getStyle(e){const{strokeWidth:t,strokeOpacity:i,stroke:o,lineDash:s,lineDashOffset:a}=this.item[e];return{stroke:o,strokeWidth:t,strokeOpacity:i,lineDash:s,lineDashOffset:a,opacity:1}}};d([Pe],Pl.prototype,"tooltip",2),d([Pe],Pl.prototype,"item",2),d([Pe],Pl.prototype,"itemStyler",2);var{BaseProperties:Jd,makeSeriesTooltip:HC,Property:Ye}=EC,Pa=class extends Jd{};d([Ye],Pa.prototype,"stroke",2),d([Ye],Pa.prototype,"strokeWidth",2),d([Ye],Pa.prototype,"strokeOpacity",2),d([Ye],Pa.prototype,"lineDash",2),d([Ye],Pa.prototype,"lineDashOffset",2);var Mi=class extends Jd{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.wick=new Pa}};d([Ye],Mi.prototype,"fill",2),d([Ye],Mi.prototype,"fillOpacity",2),d([Ye],Mi.prototype,"stroke",2),d([Ye],Mi.prototype,"strokeWidth",2),d([Ye],Mi.prototype,"strokeOpacity",2),d([Ye],Mi.prototype,"lineDash",2),d([Ye],Mi.prototype,"lineDashOffset",2),d([Ye],Mi.prototype,"cornerRadius",2),d([Ye],Mi.prototype,"wick",2);var ep=class extends Jd{constructor(){super(...arguments),this.up=new Mi,this.down=new Mi}};d([Ye],ep.prototype,"up",2),d([Ye],ep.prototype,"down",2);var Ol=class extends $t{constructor(){super(),this.item=new ep,this.tooltip=HC(),this.highlightStyle.deprecated=!1}getStyle(e){const{fill:t,fillOpacity:i,strokeWidth:o,strokeOpacity:s,stroke:a,lineDash:n,lineDashOffset:r,cornerRadius:l,wick:c}=this.item[e];return{fill:t,fillOpacity:i,stroke:a,strokeWidth:o,strokeOpacity:s,lineDash:n,lineDashOffset:r,cornerRadius:l,opacity:1,wick:c}}};d([Ye],Ol.prototype,"item",2),d([Ye],Ol.prototype,"tooltip",2),d([Ye],Ol.prototype,"itemStyler",2);var{isGradientFill:Am,isPatternFill:tp,isImageFill:ip,applyShapeStyle:VC}=oC,_l=class extends km{constructor(){super(...arguments),this.properties=new Ol}nodeFactory(){const e=new Ps;return e.lineCap="butt",e}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,o)=>{o.style=this.getItemStyle(o.datumIndex,t,void 0,o.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:o}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight(),{up:a,down:n}=o.item;e.each((r,l)=>{const{centerX:c,width:h,y:p,height:u,yOpen:g,yClose:y,crisp:f}=l,x=l.isRising?a:n,S=l.style??i.styles[l.itemId][this.getHighlightState(s,t,l.datumIndex)];r.centerX=c,r.width=h,r.y=p,r.height=u,r.yOpen=g,r.yClose=y,r.crisp=f,VC(r,S,this.getShapeFillBBox());const v=S?.wick;r.wickStroke=v?.stroke,r.wickStrokeWidth=v?.strokeWidth,r.wickStrokeOpacity=v?.strokeOpacity,r.wickLineDash=v?.lineDash,r.wickLineDashOffset=v?.lineDashOffset,r.wickStrokeAlignment=x.wick.strokeWidth??x.strokeWidth})}legendItemSymbol(){const{up:e,down:t}=this.properties.item,i=Am(e.fill)?e.fill.colorStops.map(n=>typeof n=="string"?n:{color:n.color,stop:n.stop==null?void 0:n.stop*.5}):[{color:tp(e.fill)||ip(e.fill)?e.stroke:e.fill,stop:0},{color:tp(e.fill)||ip(e.fill)?e.stroke:e.fill,stop:.5}],o=Am(t.fill)?t.fill.colorStops.map(n=>typeof n=="string"?n:{color:n.color,stop:n.stop==null?void 0:n.stop*.5}):[{color:tp(t.fill)||ip(t.fill)?t.stroke:t.fill,stop:.5}],s={type:"gradient",gradient:"linear",rotation:90,colorStops:[...i,...o],reverse:!1},a={type:"gradient",gradient:"linear",rotation:90,colorStops:[{color:e.stroke,stop:0},{color:e.stroke,stop:.5},{color:t.stroke,stop:.5}],reverse:!1};return{marker:{fill:s,fillOpacity:e.fillOpacity,stroke:a,strokeWidth:e.strokeWidth??1,strokeOpacity:e.strokeOpacity??1,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset}}}getLegendData(e){const{id:t,data:i,visible:o,ctx:{legendManager:s}}=this,{xKey:a,yName:n,showInLegend:r,legendItemName:l}=this.properties;return!i?.data.length||!a||e!=="category"?[]:[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:o&&s.getItemEnabled({seriesId:t,itemId:t}),label:{text:l??n??t},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!r}]}hasItemStylers(){return this.properties.itemStyler!=null}};_l.className="CandleStickSeries",_l.type="candlestick";import{_ModuleSupport as WC}from"ag-charts-community";import{boolean as GC,constant as KC,number as $C,required as Oa,string as Ai,undocumented as Im}from"ag-charts-core";var{commonSeriesOptionsDefs:jC,candlestickSeriesThemeableOptionsDef:YC}=WC,op={...jC,...YC,type:Oa(KC("candlestick")),xKey:Oa(Ai),openKey:Oa(Ai),highKey:Oa(Ai),lowKey:Oa(Ai),closeKey:Oa(Ai),xName:Ai,yName:Ai,openName:Ai,highName:Ai,lowName:Ai,closeName:Ai};op.pickOutsideVisibleMinorAxis=Im(GC),op.focusPriority=Im($C);import{_ModuleSupport as UC}from"ag-charts-community";var{ThemeConstants:{CARTESIAN_AXIS_TYPE:Lm},multiSeriesHighlightStyle:XC,FILL_GRADIENT_LINEAR_KEYED_DEFAULTS:ZC,FILL_IMAGE_DEFAULTS:qC,FILL_PATTERN_KEYED_DEFAULTS:QC}=UC;function Tm(e){return{fill:{$applySwitch:[{$path:"type"},{$if:[{$eq:[{$palette:"type"},"user-indexed"]},e==="up"?"transparent":{$palette:"fill"},{$palette:`${e}.fill`}]},["gradient",ZC(e)],["image",qC],["pattern",QC(e)]]},stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:`${e}.stroke`}]}}}var JC={series:{item:{up:Tm("up"),down:Tm("down")},highlightStyle:{item:{strokeWidth:3}},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:XC()},animation:{enabled:!1},axes:{[Lm.NUMBER]:{crosshair:{snap:!1}},[Lm.ORDINAL_TIME]:{groupPaddingInner:0,crosshair:{enabled:!0}}}},{CARTESIAN_AXIS_TYPE:Cm,CARTESIAN_POSITION:Nm}=iC.ThemeConstants,eN={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"candlestick",moduleFactory:e=>new _l(e),defaultAxes:[{type:Cm.NUMBER,position:Nm.LEFT},{type:Cm.ORDINAL_TIME,position:Nm.BOTTOM}],themeTemplate:JC,groupable:!1},wm={type:"series",name:"candlestick",chartType:"cartesian",enterprise:!0,options:op,create:e=>new _l(e)};import{_ModuleSupport as tN}from"ag-charts-community";import{_ModuleSupport as Rl}from"ag-charts-community";import{Logger as iN,toPlainText as oN}from"ag-charts-core";import{Logger as sN,cachedTextMeasurer as El,findMaxValue as Pm,wrapLines as Om}from"ag-charts-core";function aN(e,t){const{fontSize:i,minimumFontSize:o=i}=e,{fontSize:s,minimumFontSize:a=s}=t,n=i-o,r=s-a;let l=e.fontSize,c=t.fontSize;const h=[{labelFontSize:i,secondaryLabelFontSize:s}];for(;l>o||c>a;){const p=n>0?(l-o)/n:-1,u=r>0?(c-a)/r:-1;p>u?l--:c--,h.push({labelFontSize:l,secondaryLabelFontSize:c})}return h.reverse(),h}function _m(e,t,i,o,{padding:s},a){const{spacing:n=0}=t,r=2*s,l=2*s+n,c=(t.minimumFontSize??t.fontSize)+(o.minimumFontSize??o.fontSize);if(c>a(c+l,!1).height-l)return;const h=aN(t,o),p={fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight},u={fontFamily:o.fontFamily,fontStyle:o.fontStyle,fontWeight:o.fontWeight};let g,y;return Pm(0,h.length-1,f=>{const{labelFontSize:x,secondaryLabelFontSize:S}=h[f],v=f===0,m={...p,fontSize:x},b={...u,fontSize:S},k=El(m).lineHeight(),A=El(b).lineHeight(),M=a(k+A+l,v),D=M.width-r,L=M.height-l;if(k+A>L||((g==null||g.fontSize!==x)&&(g=Em(t,e,D,L,m,t.wrapping,v?t.overflowStrategy:"hide")),g==null||g.width>D||g.height>L)||((y==null||y.fontSize!==S)&&(y=Em(o,i,D,L,b,o.wrapping,v?o.overflowStrategy:"hide")),y==null))return;const N=g.height+y.height;if(!(y.width>D||N>L))return{width:Math.max(g.width,y.width),height:N+n,meta:M.meta,label:g,secondaryLabel:y}})}function En(e,t,{padding:i},o){const s=2*i,a=Math.min(t.minimumFontSize??t.fontSize,t.fontSize),n={fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight};return Pm(a,t.fontSize,r=>{const l={...n,fontSize:r},c=El(l),h=r===a,p=t.lineHeight??c.lineHeight(),u=o(p+s,h),g=u.width-s,y=u.height-s;if(p>y||g<0)return;const f=Om(e,{maxWidth:g,maxHeight:y,font:l,textWrap:t.wrapping,overflow:(h?t.overflowStrategy:null)??"hide"});if(!f.length)return;const{width:x,height:S}=c.measureLines(f),v=f.join(` +`);return[{width:x,height:S,text:v,fontSize:r,lineHeight:p},u.meta]})}function Rm(e){return e?.minimumFontSize!=null&&e?.fontSize!=null&&e?.minimumFontSize>e?.fontSize}function sp(e,t,i,o,s,a){const n=t.enabled?e:void 0,r=o.enabled?i:void 0;(Rm(t)||Rm(o))&&sN.warnOnce("minimumFontSize should be set to a value less than or equal to the font size");let l;n!=null&&r!=null&&(l=_m(n,t,r,o,s,a));let c;if(l==null&&n!=null&&(c=En(n,t,s,a)),c!=null){const[p,u]=c;l={width:p.width,height:p.height,meta:u,label:p,secondaryLabel:void 0}}let h;if(l==null&&n==null&&r!=null&&(h=En(r,o,s,a)),h!=null){const[p,u]=h;l={width:p.width,height:p.height,meta:u,label:void 0,secondaryLabel:p}}return l}function Em(e,t,i,o,s,a,n){const r=Om(t,{maxWidth:i,maxHeight:o,font:s,textWrap:a,overflow:n});if(!r.length)return;const l=El(s),c=e.lineHeight??l.lineHeight(),{width:h}=l.measureLines(r);return{width:h,lineHeight:c,text:r.join(` +`),height:r.length*c,fontSize:s.fontSize}}import{_ModuleSupport as nN}from"ag-charts-community";import{_ModuleSupport as Bm}from"ag-charts-community";var{Property:Bn}=Bm,_a=class extends Bm.Label{constructor(){super(...arguments),this.wrapping="on-space",this.overflowStrategy="ellipsis"}};d([Bn],_a.prototype,"wrapping",2),d([Bn],_a.prototype,"overflowStrategy",2),d([Bn],_a.prototype,"lineHeight",2),d([Bn],_a.prototype,"minimumFontSize",2);var $i=class extends _a{constructor(){super(...arguments),this.spacing=0}};d([Bn],$i.prototype,"spacing",2);var zn=class extends _a{},{CartesianSeriesProperties:rN,makeSeriesTooltip:lN,Property:ct}=nN,qe=class extends rN{constructor(){super(...arguments),this.colorRange=["black","black"],this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.textAlign="center",this.verticalAlign="middle",this.itemPadding=0,this.label=new $i,this.tooltip=lN()}};d([ct],qe.prototype,"title",2),d([ct],qe.prototype,"xKey",2),d([ct],qe.prototype,"yKey",2),d([ct],qe.prototype,"colorKey",2),d([ct],qe.prototype,"xName",2),d([ct],qe.prototype,"yName",2),d([ct],qe.prototype,"colorName",2),d([ct],qe.prototype,"colorRange",2),d([ct],qe.prototype,"stroke",2),d([ct],qe.prototype,"strokeOpacity",2),d([ct],qe.prototype,"strokeWidth",2),d([ct],qe.prototype,"textAlign",2),d([ct],qe.prototype,"verticalAlign",2),d([ct],qe.prototype,"itemPadding",2),d([ct],qe.prototype,"itemStyler",2),d([ct],qe.prototype,"label",2),d([ct],qe.prototype,"tooltip",2);var{SeriesNodePickMode:zm,computeBarFocusBounds:cN,getMissCount:hN,valueProperty:ap,ChartAxisDirection:di,DEFAULT_CARTESIAN_DIRECTION_KEYS:dN,DEFAULT_CARTESIAN_DIRECTION_NAMES:pN,createDatumId:uN,ColorScale:gN,Rect:yN,PointerEvents:fN,applyShapeStyle:mN,mergeDefaults:Fm,formatValue:xN,addHitTestersToQuadtree:SN,findQuadtreeMatch:Hm,updateLabelNode:bN}=Rl,vN=class extends Rl.CartesianSeriesNodeEvent{constructor(e,t,i,o){super(e,t,i,o),this.colorKey=o.properties.colorKey}},kN={left:-.5,center:0,right:-.5},DN={top:-.5,middle:0,bottom:-.5},Bl=class extends Rl.CartesianSeries{constructor(e){super({moduleCtx:e,propertyKeys:{...dN,color:["colorKey"]},propertyNames:{...pN,color:["colorName"]},categoryKey:void 0,pickModes:[zm.NEAREST_NODE,zm.EXACT_SHAPE_MATCH],pathsPerSeries:[]}),this.properties=new qe,this.NodeEvent=vN,this.colorScale=new gN}async processData(e){const t=this.axes[di.X],i=this.axes[di.Y];if(!t||!i||!this.data?.data.length)return;const{xKey:o,yKey:s,colorRange:a,colorKey:n}=this.properties,r=this.axes[di.X]?.scale,l=this.axes[di.Y]?.scale,{xScaleType:c,yScaleType:h}=this.getScaleInformation({xScale:r,yScale:l}),p=this.colorScale.type,{dataModel:u,processedData:g}=await this.requestDataModel(e,this.data,{props:[ap(o,c,{id:"xValue"}),ap(s,h,{id:"yValue"}),...n?[ap(n,p,{id:"colorValue",invalidValue:void 0})]:[]]});if(this.isColorScaleValid()){const y=u.resolveProcessedDataIndexById(this,"colorValue"),f=g.domain.values[y].filter(S=>S!=null),x=Rl.extent(f);if(this.colorScale.domain=x??[],x?.length&&x[0]===x[1]){const S=Math.floor(a.length/2);this.colorScale.range=[a[S],a[S]]}else this.colorScale.range=a;this.colorScale.update()}}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const o=t.resolveProcessedDataIndexById(this,"colorValue"),s=i.input.count,a=hN(this,i.defs.values[o].missing),n=t.resolveProcessedDataIndexById(this,"colorValue"),r=i.domain.values[n].filter(c=>c!=null).length;return!(s===0||s===a||r===0)}xCoordinateRange(e,t){const i=this.axes[di.X].scale,o=t*(i.bandwidth??0)/2,s=i.convert(e)+o,a=t*(i.bandwidth??10);return[s,s+a]}yCoordinateRange(e,t){const i=this.axes[di.Y].scale,o=t*(i.bandwidth??0)/2,s=i.convert(e[0])+o,a=t*(i.bandwidth??10);return[s,s+a]}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;return!t||!i?[]:e===di.X?t.getDomain(this,"xValue","value",i):t.getDomain(this,"yValue","value",i)}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{data:e,visible:t,axes:i,dataModel:o,processedData:s}=this,a=i[di.X],n=i[di.Y];if(!(e&&o&&s&&t&&a&&n))return;if(a.type!=="category"||n.type!=="category"){iN.warnOnce(`Heatmap series expected axes to have "category" type, but received "${a.type}" and "${n.type}" instead.`);return}const{xKey:r,xName:l,yKey:c,yName:h,colorKey:p,colorName:u,textAlign:g,verticalAlign:y,itemPadding:f,label:x}=this.properties,S=o.resolveColumnById(this,"xValue",s),v=o.resolveColumnById(this,"yValue",s),m=p?o.resolveColumnById(this,"colorValue",s):void 0,b=p?o.getDomain(this,"colorValue","value",s):[],k=a.scale,A=n.scale,M=(k.bandwidth??0)/2,D=(A.bandwidth??0)/2,L=[],N=[],P=k.bandwidth??10,R=A.bandwidth??10,F=(P-2*f)*kN[g],_=(R-2*f)*DN[y],E=()=>({width:P,height:R,meta:null}),T=s.dataSources.get(this.id)?.data??[];for(const[w,C]of T.entries()){const I=S[w],O=v[w],z=k.convert(I)+M,B=A.convert(O)+D,H=m?.[w],W=x.enabled&&H!=null?this.getLabelText(H,C,p,"color",b,x,{value:H,datum:C,colorKey:p,colorName:u,xKey:r,yKey:c,xName:l,yName:h}):void 0,V=sp(oN(W),this.properties.label,void 0,this.properties.label,{padding:f},E),G={x:z,y:B,size:0},K=this.getItemStyle({datumIndex:w,datum:C,colorValue:H},!1);if(L.push({series:this,itemId:c,datumIndex:w,yKey:c,xKey:r,xValue:I,yValue:O,colorValue:H,datum:C,point:G,width:P,height:R,midPoint:{x:z,y:B},missing:m!=null&&H==null,style:K}),V?.label!=null){const{text:Q,fontSize:X,lineHeight:Y,height:J}=V.label,{fontStyle:ie,fontFamily:U,fontWeight:he,color:ne}=this.properties.label,Z=G.x+F*(P-2*f),le=G.y+_*(R-2*f)-(V.height-J)*.5;N.push({series:this,itemId:c,datum:C,datumIndex:w,text:Q,fontSize:X,lineHeight:Y,fontStyle:ie,fontFamily:U,fontWeight:he,color:ne,textAlign:g,textBaseline:y,x:Z,y:le,style:K})}}return{itemId:this.properties.yKey??this.id,nodeData:L,labelData:N,scales:this.calculateScaling(),visible:this.visible}}nodeFactory(){return new yN}update(e){return this.ctx.animationManager.skipCurrentBatch(),super.update(e)}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,o=t??[];return i.update(o)}getItemStyle({datumIndex:e,datum:t,colorValue:i},o){const{properties:s}=this,{itemStyler:a,stroke:n,strokeWidth:r,strokeOpacity:l}=s,c=this.getHighlightStyle(o,e),h=Fm(c,{fill:this.isColorScaleValid()&&i!=null?this.colorScale.convert(i):"transparent",fillOpacity:1,stroke:n,strokeWidth:r,strokeOpacity:l,opacity:1});let p;return a!=null&&e!=null&&(p=this.cachedDatumCallback(uN(e,o?"highlight":"node"),()=>{const u=this.makeItemStylerParams(t,e,o,h);return this.callWithContext(a,u)})),p?Fm(p,h):h}makeItemStylerParams(e,t,i,o){const{id:s,properties:a}=this,{xKey:n,yKey:r}=a,l=this.ctx.highlightManager?.getActiveHighlight(),c=this.getHighlightStateString(l,i,t),h=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:s,datum:e,xKey:n,yKey:r,highlighted:i,highlightState:c,...o,fill:h}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,o)=>{o.style=this.getItemStyle(o,t)})}updateDatumNodes({datumSelection:e}){const t=this.axes[di.X],[i,o]=t?.visibleRange??[],a=!(i!==0||o!==1);e.each((n,r)=>{const{point:l,width:c,height:h,style:p}=r;mN(n,p),n.crisp=a,n.x=Math.floor(l.x-c/2),n.y=Math.floor(l.y-h/2),n.width=Math.ceil(c),n.height=Math.ceil(h)})}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e,{enabled:o}=this.properties.label,s=o?t:[];return i.update(s)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,o)=>{i.pointerEvents=fN.None,i.text=o.text,i.fillOpacity=this.getHighlightStyle(!1,o.datumIndex)?.opacity??1,bN(this,i,this.properties,this.properties.label,o,!1,t)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:o,axes:s,properties:a,colorScale:n,ctx:r}=this,{formatManager:l}=r,{xKey:c,xName:h,yKey:p,yName:u,colorKey:g,colorName:y,colorRange:f,title:x,legendItemName:S,tooltip:v}=a,m=s[di.X],b=s[di.Y];if(!i||!o||!m||!b)return;const k=o.dataSources.get(this.id)?.data[e],A=i.resolveColumnById(this,"xValue",o)[e],M=i.resolveColumnById(this,"yValue",o)[e],D=g!=null&&this.isColorScaleValid()?i.resolveColumnById(this,"colorValue",o)[e]:void 0;if(A==null)return;const L=[];let N;if(D==null)N=f[0];else{N=n.convert(D);const F=i.getDomain(this,"colorValue","value",o),_=l.format(this.callWithContext.bind(this),{type:"number",value:D,datum:k,seriesId:t,legendItemName:S,key:g,source:"tooltip",property:"color",domain:F,boundSeries:this.getFormatterContext("color"),fractionDigits:void 0});L.push({label:y,fallbackLabel:g,value:_??xN(D)})}L.push({label:h,fallbackLabel:c,value:this.getAxisValueText(m,"tooltip",A,k,c,S)},{label:u,fallbackLabel:p,value:this.getAxisValueText(b,"tooltip",M,k,p,S)});const P=this.getItemStyle({datumIndex:e,datum:k,colorValue:D},!1);P.fill!=null&&(N=P.fill);const R=N==null?void 0:{marker:{shape:"square",fill:N,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0}};return this.formatTooltipWithContext(v,{title:x??S,symbol:R,data:L},{seriesId:t,datum:k,title:x,xKey:c,xName:h,yKey:p,yName:u,colorKey:g,colorName:y,...P})}getLegendData(e){return e!=="gradient"||!this.isColorScaleValid()||!this.dataModel?[]:[{legendType:"gradient",enabled:this.visible,seriesId:this.id,series:this.getFormatterContext("color"),colorDomain:this.colorScale.domain,colorRange:this.colorScale.range}]}isLabelEnabled(){return this.properties.label.enabled&&!!this.properties.colorKey}getBandScalePadding(){return{inner:0,outer:0}}computeFocusBounds({datumIndex:e}){const t=this.contextNodeData?.nodeData[e];if(t===void 0)return;const{width:i,height:o,midPoint:s}=t,a={x:s.x-i/2,y:s.y-o/2,width:i,height:o};return cN(this,a)}initQuadTree(e){SN(e,this.datumNodesIter())}pickNodesExactShape(e){const t=Hm(this,e);return t!=null&&t.distance<=0?[t.datum]:[]}pickNodeClosestDatum(e){return Hm(this,e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};Bl.className="HeatmapSeries",Bl.type="heatmap";import{_ModuleSupport as MN}from"ag-charts-community";import{arrayOf as AN,color as IN,constant as LN,required as np,string as Ra}from"ag-charts-core";var{commonSeriesOptionsDefs:TN,heatmapSeriesThemeableOptionsDef:CN,without:Vm}=MN,NN={...Vm(CN,["showInLegend"]),...Vm(TN,["showInLegend"]),type:np(LN("heatmap")),xKey:np(Ra),yKey:np(Ra),colorKey:Ra,xName:Ra,yName:Ra,colorName:Ra,colorRange:AN(IN)};import{_ModuleSupport as zl}from"ag-charts-community";var wN={series:{stroke:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$ref:"chartBackgroundColor"},{$path:["/0",{$palette:"stroke"},{$palette:"strokes"}]}]},strokeWidth:{$isUserOption:["./stroke",2,void 0]},colorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"divergingColors"},zl.SAFE_RANGE2_OPERATION]},label:{...zl.LABEL_BOXING_DEFAULTS,enabled:!1,color:{$ref:"textColor"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},wrapping:"on-space",overflowStrategy:"ellipsis"},itemPadding:3,highlight:zl.singleSeriesHighlightStyle()},gradientLegend:{enabled:!0,...zl.LEGEND_CONTAINER_THEME}},{ThemeConstants:{CARTESIAN_AXIS_TYPE:Wm,CARTESIAN_POSITION:Gm}}=tN,PN={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"heatmap",moduleFactory:e=>new Bl(e),defaultAxes:[{type:Wm.CATEGORY,position:Gm.LEFT},{type:Wm.CATEGORY,position:Gm.BOTTOM}],themeTemplate:wN},Km={type:"series",name:"heatmap",chartType:"cartesian",enterprise:!0,options:NN,create:e=>new Bl(e)};import{_ModuleSupport as ON}from"ag-charts-community";import{_ModuleSupport as _N}from"ag-charts-community";var{applyShapeStyle:RN}=_N,Fl=class extends km{constructor(){super(...arguments),this.properties=new Pl}nodeFactory(){const e=new Dm;return e.lineCap="square",e}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,o)=>{o.style=this.getItemStyle(o.datumIndex,t,void 0,o.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:o}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight(),{up:a,down:n}=o.item;e.each((r,l)=>{const{centerX:c,width:h,y:p,height:u,yOpen:g,yClose:y,crisp:f}=l,x=l.isRising?a:n;r.centerX=c,r.width=h,r.y=p,r.height=u,r.yOpen=g,r.yClose=y,r.crisp=f;const S=l.style??i.styles[l.itemId][this.getHighlightState(s,t,l.datumIndex)];RN(r,S),r.strokeAlignment=x.strokeWidth})}getLegendData(e){const{id:t,data:i,ctx:{legendManager:o},visible:s}=this,{xKey:a,yName:n,item:{up:r,down:l},showInLegend:c,legendItemName:h}=this.properties;if(!i?.data.length||!a||e!=="category")return[];const p={type:"gradient",gradient:"linear",colorSpace:"rgb",colorStops:[{color:r.stroke,stop:0},{color:r.stroke,stop:.5},{color:l.stroke,stop:.5}],rotation:90};return[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:s&&o.getItemEnabled({seriesId:t,itemId:t}),label:{text:h??n??t},symbol:{marker:{fill:p,fillOpacity:r.strokeOpacity,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0}},legendItemName:h,hideInLegend:!c}]}hasItemStylers(){return this.properties.itemStyler!=null}};Fl.className="ohlc",Fl.type="ohlc";import{_ModuleSupport as EN}from"ag-charts-community";import{boolean as BN,constant as zN,number as FN,required as Ea,string as Ii,undocumented as $m}from"ag-charts-core";var{commonSeriesOptionsDefs:HN,ohlcSeriesThemeableOptionsDef:VN}=EN,rp={...HN,...VN,type:Ea(zN("ohlc")),xKey:Ea(Ii),openKey:Ea(Ii),highKey:Ea(Ii),lowKey:Ea(Ii),closeKey:Ea(Ii),xName:Ii,yName:Ii,openName:Ii,highName:Ii,lowName:Ii,closeName:Ii};rp.pickOutsideVisibleMinorAxis=$m(BN),rp.focusPriority=$m(FN);var{ThemeConstants:{CARTESIAN_AXIS_TYPE:Hl,CARTESIAN_POSITION:jm},multiSeriesHighlightStyle:WN}=ON,GN={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"ohlc",moduleFactory:e=>new Fl(e),defaultAxes:[{type:Hl.NUMBER,position:jm.LEFT},{type:Hl.ORDINAL_TIME,position:jm.BOTTOM}],themeTemplate:{animation:{enabled:!1},series:{item:{up:{stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:"up.stroke"}]}},down:{stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:"down.stroke"}]}}},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:WN(!1)},axes:{[Hl.NUMBER]:{crosshair:{snap:!1}},[Hl.ORDINAL_TIME]:{groupPaddingInner:0,crosshair:{enabled:!0}}}},groupable:!1},Ym={type:"series",name:"ohlc",chartType:"cartesian",enterprise:!0,options:rp,create:e=>new Fl(e)};import{_ModuleSupport as Um}from"ag-charts-community";import{_ModuleSupport as Vl}from"ag-charts-community";import{_ModuleSupport as KN}from"ag-charts-community";var{AGGREGATION_INDEX_Y_MAX:$N,AGGREGATION_INDEX_Y_MIN:jN,aggregationDomain:YN,aggregationIndexForXRatio:Xm,aggregationRangeFittingPoints:UN,aggregationXRatioForXValue:Zm,compactAggregationIndices:XN,createAggregationIndices:ZN}=KN,qN=1e3;function qm(e,t,i,o,s,a,n){const r=e[a];if(r==null)return!1;const l=Zm(r,t,i,n),c=Xm(l,s);return a===o[c+$N]}function Qm(e,t,i,o,s,a,n){const r=e[a];if(r==null)return!1;const l=Zm(r,t,i,n),c=Xm(l,s);return a===o[c+jN]}function QN(e,t,i,o,s,a,n){if(t.length64;)({maxRange:c}=XN(h,p,c,{inPlace:!0})),u=u.filter(f=>qm(t,r,l,h,c,f,a)),g=g.filter(f=>Qm(t,r,l,h,c,f,a)),y.push({maxRange:c,topIndices:u,bottomIndices:g});return y.reverse(),y}import{_ModuleSupport as JN}from"ag-charts-community";function Jm({span:e},t){switch(e.type){case"linear":case"step":case"multi-line":{const i=(t-e.x0)/(e.x1-e.x0);return e.y0+i*(e.y1-e.y0)}case"cubic":{const{cp0x:i,cp0y:o,cp1x:s,cp1y:a,cp2x:n,cp2y:r,cp3x:l,cp3y:c}=e;let h=.5;const p=1e-6;for(let g=0;g<10;g++){const y=1-h,x=y*y*y*i+3*y*y*h*s+3*y*h*h*n+h*h*h*l-t;if(Math.abs(x)=a.x&&t<=n.x)return{span:s,index:o};if(tl;return{intersection:o===c?null:{x:i,y:r},spanIndex:a.index,isInverted:c}}function tw(e,t,i,o,s=!1){if(e.length===0||t.length===0)return[];const a=[];let n=s,r=0;for(let l=i;l<=o;l+=.5){const c=ew(e,t,l,n,r);c.intersection&&a.push(c.intersection.x),r=c.spanIndex,n=c.isInverted}return a}function iw(e,t,i,o,s={}){const a=Math.max(t.x,i.width-(t.x+t.width)),n=Math.max(t.y,i.height-(t.y+t.height)),r=[],l=(h,p)=>({x0:h,y0:-n,x1:p,y1:t.height+n});o&&r.push({clipRect:l(-a,e[0]??t.width+a),...s});const c=o?1:0;for(let h=c;h{Ba(l,c,t.removed),Ba(l,c,i.removed)},a=(l,c)=>{Ba(l,c,t.moved),Ba(l,c,i.moved)},n=(l,c)=>{Ba(l,c,t.added),Ba(l,c,i.added)},r=pw(e,o);return{status:e,path:{addPhaseFn:n,updatePhaseFn:a,removePhaseFn:s},pathProperties:r}}function gw(e,t,i){const o=e.scales.x?.type==="category",s=t.scales.x?.type==="category";if(o!==s||!tx(e.scales.x)||!tx(t.scales.x))return;let a="updated";t.visible&&!e.visible?a="removed":!t.visible&&e.visible&&(a="added");const n=Kl({scales:e.scales,data:e.fillData.spans},{scales:t.scales,data:t.fillData.spans},Gl.Split);if(n==null)return;const r=Kl({scales:e.scales,data:e.fillData.phantomSpans},{scales:t.scales,data:t.fillData.phantomSpans},Gl.Split);if(r==null)return;const l=Kl({scales:e.scales,data:e.highStrokeData.spans},{scales:t.scales,data:t.highStrokeData.spans},Gl.Split);if(l==null)return;const c=Kl({scales:e.scales,data:e.lowStrokeData.spans},{scales:t.scales,data:t.lowStrokeData.spans},Gl.Split);if(c==null)return;const h="fade",p=dw(a,n,r,h),u=uw(a,l,c,h),g=(i?.changed??!0)||!ix(e.scales.x,t.scales.x)||!ix(e.scales.y,t.scales.y)||a!=="updated";return{status:a,fill:p,stroke:u,hasMotion:g}}var{valueProperty:ox,keyProperty:yw,ChartAxisDirection:Qe,mergeDefaults:fw,updateLabelNode:mw,fixNumericExtent:sx,buildResetPathFn:xw,resetLabelFn:Sw,resetMarkerFn:bw,resetMarkerPositionFn:ax,pathSwipeInAnimation:vw,resetMotion:kw,markerSwipeScaleInAnimation:Dw,seriesLabelFadeInAnimation:dp,animationValidation:Mw,diff:Aw,updateClipPath:pp,computeMarkerFocusBounds:nx,plotAreaPathFill:Iw,plotLinePathStroke:rx,interpolatePoints:lx,pathFadeInAnimation:up,markerFadeInAnimation:cx,fromToMotion:gp,pathMotion:yp,extent:Lw,applyShapeFillBBox:Tw,PointerEvents:$l,Marker:Cw,BBox:Nw,findMinMax:ww,applyShapeStyle:Pw,processedDataIsAnimatable:Ow,simpleMemorize2:_w,markerEnabled:Rw,getMarkerStyles:Ew,calculateSegments:Bw,toHighlightString:zw,HighlightState:Fw}=Vl,Hw=_w(QN),Vw=class extends Vl.SeriesNodeEvent{constructor(e,t,i,o){super(e,t,i,o),this.xKey=o.properties.xKey,this.yLowKey=o.properties.yLowKey,this.yHighKey=o.properties.yHighKey}},Ww=Vl.CartesianSeries,jl=class extends Ww{constructor(e){super({moduleCtx:e,pathsPerSeries:["fill","lowStroke","highStroke"],pickModes:[Vl.SeriesNodePickMode.AXIS_ALIGNED],propertyKeys:{[Qe.X]:["xKey"],[Qe.Y]:["yLowKey","yHighKey"]},propertyNames:{[Qe.X]:["xName"],[Qe.Y]:["yLowName","yHighName","yName"]},categoryKey:"xValue",animationResetFns:{path:xw({getVisible:()=>this.visible,getOpacity:()=>this.getOpacity()}),label:Sw,datum:(t,i)=>({...bw(t),...ax(t,i)})},clipFocusBox:!1}),this.properties=new be,this.NodeEvent=Vw,this.dataAggregationFilters=void 0}async processData(e){const{xKey:t,yLowKey:i,yHighKey:o}=this.properties,s=this.axes[Qe.X]?.scale,a=this.axes[Qe.Y]?.scale,{xScaleType:n,yScaleType:r}=this.getScaleInformation({xScale:s,yScale:a}),l=[],c=!this.ctx.animationManager.isSkipped();!this.ctx.animationManager.isSkipped()&&this.processedData&&l.push(Aw(this.id,this.processedData)),c&&l.push(Mw());const{dataModel:h,processedData:p}=await this.requestDataModel(e,this.data,{props:[yw(t,n,{id:"xValue"}),ox(i,r,{id:"yLowValue"}),ox(o,r,{id:"yHighValue"}),...l]});this.dataAggregationFilters=this.aggregateData(h,p),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||Ow(t))return;const i=this.axes[Qe.X];if(i==null)return;const o=e.resolveKeysById(this,"xValue",t),s=e.resolveColumnById(this,"yHighValue",t),a=e.resolveColumnById(this,"yLowValue",t),{index:n}=e.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[n],l=e.resolveColumnNeedsValueOf(this,"xValue",t),c=e.resolveColumnNeedsValueOf(this,"yHighValue",t);return Hw(i.scale.type,o,s,a,r,l,c)}xCoordinateRange(e){const t=this.axes[Qe.X].scale.convert(e);return[t,t]}yCoordinateRange(e){const t=this.axes[Qe.Y].scale.convert(e[0]);return[t,t]}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];const{domain:{keys:[o]}}=t;if(e===Qe.X){const s=i.resolveProcessedDataDefById(this,"xValue");return s?.def.type==="key"&&s.def.valueType==="category"?o:sx(Lw(o))}else{const s=this.domainForClippedRange(Qe.Y,["yHighValue","yLowValue"],"xValue"),a=ww(s);return sx(a)}}getSeriesRange(e,t){return this.domainForVisibleRange(Qe.Y,["yHighValue","yLowValue"],"xValue",t)}createNodeData(){const{data:e,dataModel:t,processedData:i,axes:o}=this,s=o[Qe.X],a=o[Qe.Y];if(!(e&&s&&a&&t&&i&&this.chart?.seriesRect))return;const n=s.scale,r=a.scale,{xKey:l,yLowKey:c,yHighKey:h,connectMissingData:p,interpolation:u,fill:g,fillOpacity:y,item:f}=this.properties,x=i.dataSources.get(this.id)?.data??[],S=(n.bandwidth??0)/2,v=t.resolveKeysById(this,"xValue",i),m=t.resolveColumnById(this,"yHighValue",i),b=t.resolveColumnById(this,"yLowValue",i),k=V=>n.convert(v[V])+S,A=[],M=[],D=[],L=(V,G,K)=>{const Q=x[V],X=v[V];if(X==null)return;const Y=D.at(-1);if(Number.isFinite(G)&&Number.isFinite(K)){const J=(le,oe,ge)=>{const{size:ce}=f[le].marker;M.push({index:V,series:this,itemId:le,datum:Q,datumIndex:V,midPoint:{x:U,y:ge},yHighValue:G,yLowValue:K,xValue:X,xKey:l,yLowKey:c,yHighKey:h,point:{x:U,y:ge,size:ce},enabled:!0});const me=this.createLabelData({datumIndex:V,point:{x:U,y:ge},value:oe,yLowValue:K,yHighValue:G,itemId:le,inverted:ie,datum:Q,series:this});A.push(me)},ie=K>G,U=k(V),he=r.convert(G),ne=r.convert(K);J("high",G,he),J("low",K,ne);const Z={high:{point:{x:U,y:he},xDatum:X,yDatum:G},low:{point:{x:U,y:ne},xDatum:X,yDatum:K}};Array.isArray(Y)?Y.push(Z):Y==null?D.push([Z]):(Y.skip+=1,D.push([Z]))}else p||(Array.isArray(Y)||Y==null?D.push({skip:0}):Y.skip+=1)},{dataAggregationFilters:N}=this,[P,R]=n.range,F=Math.abs(R-P),_=N?.find(V=>V.maxRange>F),E=_?.topIndices,T=_?.bottomIndices;let[w,C]=this.visibleRangeIndices("xValue",s.range,E);w=Math.max(w-1,0),C=Math.min(C+1,E?.length??v.length),i.input.count<1e3&&(w=0,C=i.input.count);for(let V=w;V{if(!Array.isArray(V))return[];const G=V.map(K=>K.high);return lx(G,u)}),O=D.flatMap(V=>{if(!Array.isArray(V))return[];const G=V.map(K=>K.low);return lx(G,u)}),z=Bw(this.properties.segmentation,s,a,this.chart.seriesRect,this.ctx.scene,!1);let B;if(this.properties.invertedStyle.enabled){const V=m[0]{const G=f[V],{stroke:K,strokeWidth:Q,strokeOpacity:X}=G,Y={fill:g,fillOpacity:y,stroke:K,strokeWidth:Q,strokeOpacity:X};return Ew(this,G,G.marker,Y)};return{itemId:`${c}-${h}`,labelData:A,nodeData:M,fillData:{itemId:"high",spans:I,phantomSpans:O},highStrokeData:{itemId:"high",spans:I},lowStrokeData:{itemId:"low",spans:O},scales:this.calculateScaling(),visible:this.visible,styles:{low:H("low"),high:H("high")},segments:z,intersectionSegments:B}}createLabelData({datumIndex:e,point:t,value:i,itemId:o,inverted:s,datum:a,series:n}){const{xKey:r,yLowKey:l,yHighKey:c,xName:h,yName:p,yLowName:u,yHighName:g,legendItemName:y,label:f}=this.properties,{placement:x}=f,S=f.spacing+(typeof f.padding=="number"?f.padding:0);let v=o;s&&(v=o==="low"?"high":"low");const m=x==="outside"&&v==="high"||x==="inside"&&v==="low"?-1:1,b=this.getSeriesDomain(Qe.Y);return{x:t.x,y:t.y+S*m,series:n,itemId:o,datum:a,datumIndex:e,text:this.getLabelText(i,a,o==="high"?c:l,"y",b,f,{value:i,datum:a,itemId:o,xKey:r,yLowKey:l,yHighKey:c,xName:h,yLowName:u,yHighName:g,yName:p,legendItemName:y}),textAlign:"center",textBaseline:m===-1?"bottom":"top"}}isPathOrSelectionDirty(){const{low:e,high:t}=this.properties.item;return e.marker.isDirty()||t.marker.isDirty()}strokewidthChange(){const e=t=>{const i=this.properties.item[t].strokeWidth??0,o=this.properties.highlight.highlightedSeries.item?.[t]?.strokeWidth??i,s=this.properties.highlight.highlightedItem.item?.[t]?.strokeWidth??i;return i>s||o>s};return e("low")||e("high")}updatePathNodes(e){const{visible:t}=e,[i,o,s]=e.paths,a=this.contextNodeData?.segments,n=this.ctx.highlightManager?.getActiveHighlight(),r=this.getHighlightState(n,!1),l=this.getHighlightStyle(),{item:c,fill:h,fillOpacity:p,opacity:u}=fw(l,this.getStyle(!1,r));o.setProperties({datum:a,segments:a,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:$l.None,stroke:c.low.stroke,strokeWidth:c.low.strokeWidth,strokeOpacity:c.low.strokeOpacity,lineDash:c.low.lineDash,lineDashOffset:c.low.lineDashOffset,opacity:u,visible:t}),s.setProperties({segments:a,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:$l.None,stroke:c.high.stroke,strokeWidth:c.high.strokeWidth,strokeOpacity:c.high.strokeOpacity,lineDash:c.high.lineDash,lineDashOffset:c.high.lineDashOffset,opacity:u,visible:t});const g=this.getShapeFillBBox();Tw(i,h,g),Pw(i,{stroke:void 0,fill:h,fillOpacity:p,opacity:u},g);const y=this.contextNodeData?.intersectionSegments??a;i.setProperties({segments:y,pointerEvents:$l.None,lineJoin:"round",fillShadow:this.properties.shadow,opacity:u,visible:t}),i.datum=y,pp(this,i),pp(this,o),pp(this,s)}updatePaths(e){this.updateAreaPaths(e.paths,e.contextData)}updateAreaPaths(e,t){for(const i of e)i.visible=t.visible;if(t.visible)this.updateFillPath(e,t),this.updateStrokePath(e,t);else for(const i of e)i.path.clear(),i.markDirty("RangeArea")}updateFillPath(e,t){const[i]=e;i.path.clear(),Iw(i,t.fillData),i.markDirty("RangeArea")}updateStrokePath(e,t){const[,i,o]=e;i.path.clear(),o.path.clear(),rx(i,t.lowStrokeData.spans),rx(o,t.highStrokeData.spans),i.markDirty("RangeArea"),o.markDirty("RangeArea")}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,{processedData:o,axes:s,properties:a}=this,n=a.styler?this.getStylerMarkerOptions().item:a.item,{low:r,high:l}=n,c=Rw(o.input.count,s[Qe.X].scale,{enabled:r.marker.enabled||l.marker.enabled});(a.item.low.marker.isDirty()||a.item.high.marker.isDirty())&&(i.clear(),i.cleanup());let h;if(c)if(r.marker.enabled&&l.marker.enabled)h=t;else{h=[];for(const p of t)n[p.itemId].marker.enabled&&h.push(p)}else h=[];return i.update(h)}updateDatumStyles({datumSelection:e,isHighlight:t}){const i=this.ctx.highlightManager.getActiveHighlight();e.each((o,s)=>{const a=this.getHighlightState(i,t,s.datumIndex),n=this.getStyle(t,a),{fill:r,fillOpacity:l,item:c}=n,{stroke:h,strokeWidth:p,strokeOpacity:u}=c[s.itemId],{marker:g}=this.properties.item[s.itemId],y=this.makeItemStylerParams(s.itemId);s.style=this.getMarkerStyle(g,s,y,{isHighlight:t,highlightState:a,resolveMarkerSubPath:["item",s.itemId,"marker"]},n.item[s.itemId].marker,{fill:r,fillOpacity:l,stroke:h,strokeWidth:p,strokeOpacity:u})})}updateDatumNodes(e){const{contextNodeData:t}=this;if(!t)return;const{datumSelection:i,isHighlight:o}=e,s=this.getShapeFillBBox(),a=this.ctx.highlightManager.getActiveHighlight();i.each((n,r)=>{const{itemId:l}=r,c=r.style??t.styles[l][this.getHighlightState(a,o,r.datumIndex)];this.applyMarkerStyle(c,n,r.point,s)}),o||(this.properties.item.low.marker.markClean(),this.properties.item.high.marker.markClean())}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;return i.update(t,o=>{o.pointerEvents=$l.None})}updateLabelNodes(e){const t={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yName:this.properties.yName,yLowKey:this.properties.yLowKey,yLowName:this.properties.yLowName??this.properties.yLowKey,yHighKey:this.properties.yHighKey,yHighName:this.properties.yHighName??this.properties.yHighKey,legendItemName:this.properties.legendItemName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((o,s)=>{o.fillOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1,mw(this,o,t,this.properties.label,s,!1,i)})}getHighlightData(e,t){const i=e.filter(o=>o.datum===t.datum);return i.length>0?i:void 0}getStyle(e,t){return this.getStylerCouple(e,t)[0]}getStylerMarkerOptions(){return this.getStylerCouple(!1)[1]}getStylerCouple(e,t){const{fill:i,fillOpacity:o,item:s,styler:a}=this.properties;let n={};if(a){const h=this.makeStylerParams(e,t);n=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(a,h)??{},{pick:!1})??{}}const r={item:{low:{marker:{enabled:!1}},high:{marker:{enabled:!1}}}},l=h=>{const p=n.item?.[h],{lineDash:u,lineDashOffset:g,marker:y,stroke:f,strokeOpacity:x,strokeWidth:S}=s[h];return r.item[h].marker.enabled=p?.marker?.enabled??y.enabled,{marker:{fill:p?.marker?.fill??y.fill??i,fillOpacity:p?.marker?.fillOpacity??y.fillOpacity,shape:p?.marker?.shape??y.shape,size:p?.marker?.size??y.size,lineDash:p?.marker?.lineDash??y.lineDash,lineDashOffset:p?.marker?.lineDashOffset??y.lineDashOffset,stroke:p?.marker?.stroke??y.stroke??f,strokeOpacity:p?.marker?.strokeOpacity??y.strokeOpacity,strokeWidth:p?.marker?.strokeWidth??y.strokeWidth},lineDash:p?.lineDash??u,lineDashOffset:p?.lineDashOffset??g,stroke:p?.stroke??f,strokeOpacity:p?.strokeOpacity??x,strokeWidth:p?.strokeWidth??S}};return[{fill:n.fill??i,fillOpacity:n.fillOpacity??o,opacity:1,topLevel:{lineDash:this.properties.lineDash,lineDashOffset:this.properties.lineDashOffset,marker:this.properties.marker,stroke:this.properties.stroke,strokeOpacity:this.properties.strokeOpacity,strokeWidth:this.properties.strokeWidth},item:{low:l("low"),high:l("high")}},r]}makeStylerParams(e,t){const{id:i}=this,{fill:o,fillOpacity:s,item:a,xKey:n,yHighKey:r,yLowKey:l}=this.properties,c=zw(t??Fw.None),h=p=>{const{lineDash:u,lineDashOffset:g,marker:y,stroke:f,strokeOpacity:x,strokeWidth:S}=a[p];return{marker:{fill:y.fill??o,fillOpacity:y.fillOpacity,size:y.size,shape:y.shape,stroke:y.stroke??f,strokeOpacity:y.strokeOpacity,strokeWidth:y.strokeWidth,lineDash:y.lineDash,lineDashOffset:y.lineDashOffset},lineDash:u,lineDashOffset:g,stroke:f,strokeOpacity:x,strokeWidth:S}};return{item:{low:h("low"),high:h("high")},fill:o,fillOpacity:s,highlightState:c,highlighted:e,seriesId:i,xKey:n,yLowKey:l,yHighKey:r}}makeItemStylerParams(e){const{xKey:t,yLowKey:i,yHighKey:o}=this.properties;return{xKey:t,yLowKey:i,yHighKey:o,itemId:e}}getTooltipContent(e,t){const i=t?.itemId??"high",{id:o,dataModel:s,processedData:a,axes:n,properties:r}=this,{xName:l,yName:c,yLowKey:h,yLowName:p,xKey:u,yHighKey:g,yHighName:y,tooltip:f,legendItemName:x}=r,S=n[Qe.X],v=n[Qe.Y];if(!s||!a||!S||!v)return;const m=a.dataSources.get(this.id)?.data[e],b=s.resolveKeysById(this,"xValue",a)[e],k=s.resolveColumnById(this,"yHighValue",a)[e],A=s.resolveColumnById(this,"yLowValue",a)[e];if(b==null)return;const M=this.getStyle(!1),D=this.makeItemStylerParams(i),L=this.getMarkerStyle(this.properties.item[i].marker,{datumIndex:e,datum:m},D,{isHighlight:!1,resolveMarkerSubPath:["item",i,"marker"]},M.item[i].marker),N=`${this.getAxisValueText(v,"tooltip",A,m,h,x)} - ${this.getAxisValueText(v,"tooltip",k,m,g,x)}`;return this.formatTooltipWithContext(f,{heading:this.getAxisValueText(S,"tooltip",b,m,u,x),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:`${p??h} - ${y??g}`,value:N}]},{seriesId:o,datum:m,title:c,itemId:i,xName:l,yName:c,yLowKey:h,yLowName:p,xKey:u,yHighKey:g,yHighName:y,legendItemName:x,...L})}legendItemSymbol(){const{fill:e,topLevel:t}=this.getStyle(!1),{stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,marker:n}=t;return{marker:{shape:n.shape,fill:n.fill??e,stroke:n.stroke??i,fillOpacity:n.fillOpacity,strokeOpacity:n.strokeOpacity,strokeWidth:n.strokeWidth,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset},line:{stroke:i,strokeOpacity:s,strokeWidth:o,lineDash:a}}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{yLowKey:o,yHighKey:s,yName:a,yLowName:n,yHighName:r,legendItemName:l,showInLegend:c}=this.properties,h=l??a??`${n??o} - ${r??s}`,p=`${o}-${s}`;return[{legendType:"category",id:t,itemId:p,seriesId:t,enabled:i,label:{text:`${h}`},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!c}]}isLabelEnabled(){return this.properties.label.enabled}onDataChange(){}nodeFactory(){return new Cw}animateEmptyUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:o,paths:s}=e,{animationManager:a}=this.ctx;this.updateAreaPaths(s,o),vw(this,a,...s),kw([t],ax),Dw(this,a,t),dp(this,"labels",a,i)}animateReadyResize(e){const{contextData:t,paths:i}=e;this.updateAreaPaths(i,t),super.animateReadyResize(e)}animateWaitingUpdateReady(e){const{animationManager:t}=this.ctx,{datumSelection:i,labelSelection:o,contextData:s,paths:a,previousContextData:n}=e,[r,l,c]=a;if(r==null&&l==null&&c==null)return;this.resetDatumAnimation(e),this.resetLabelAnimation(e);const h=()=>{this.resetPathAnimation(e),this.updateAreaPaths(a,s)},p=()=>{t.skipCurrentBatch(),h()};if(s==null||n==null){h(),cx(this,t,"added",i),up(this,"fill_path_properties",t,"add",r),up(this,"low_stroke_path_properties",t,"add",l),up(this,"high_stroke_path_properties",t,"add",c),dp(this,"labels",t,o);return}const u=gw(s,n,this.processedData?.reduced?.diff?.[this.id]);if(u===void 0){p();return}else if(u.status==="no-op")return;gp(this.id,"fill_path_properties",t,[r],u.fill.pathProperties),gp(this.id,"low_stroke_path_properties",t,[l],u.stroke.pathProperties),gp(this.id,"high_stroke_path_properties",t,[c],u.stroke.pathProperties),u.status==="added"?this.updateAreaPaths(a,s):u.status==="removed"?this.updateAreaPaths(a,n):(yp(this.id,"fill_path_update",t,[r],u.fill.path),yp(this.id,"low_stroke_path_update",t,[l],u.stroke.path),yp(this.id,"high_stroke_path_update",t,[c],u.stroke.path)),u.hasMotion&&(cx(this,t,void 0,i),dp(this,"labels",t,o)),this.ctx.animationManager.animate({id:this.id,groupId:"reset_after_animation",phase:"trailing",from:{},to:{},onComplete:()=>this.updateAreaPaths(a,s)})}getFormattedMarkerStyle(e){const t=this.getStyle(!1),i=this.makeItemStylerParams(e.itemId);return this.getMarkerStyle(this.properties.item[e.itemId].marker,e,i,{isHighlight:!0,resolveMarkerSubPath:["item",e.itemId,"marker"]},void 0,t)}getMarkerStyle(e,t,i,o,s,a){return e.itemStyler=this.properties.marker.itemStyler,super.getMarkerStyle(e,t,i,o,s,a)}computeFocusBounds(e){const t=nx(this,e),i=nx(this,{...e,datumIndex:e.datumIndex+1});if(t&&i)return Nw.merge([t,i])}isDatumEnabled(e,t){return t%2===0&&super.isDatumEnabled(e,t)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};jl.className="RangeAreaSeries",jl.type="range-area";import{_ModuleSupport as Gw}from"ag-charts-community";import{boolean as hx,constant as Kw,fillOptionsDef as $w,number as jw,required as Yl,shapeSegmentation as Yw,string as qo,undocumented as dx}from"ag-charts-core";var{commonSeriesOptionsDefs:Uw,rangeAreaSeriesThemeableOptionsDef:Xw}=Gw,fp={...Uw,...Xw,type:Yl(Kw("range-area")),xKey:Yl(qo),yLowKey:Yl(qo),yHighKey:Yl(qo),xName:qo,yName:qo,yLowName:qo,yHighName:qo,legendItemName:qo,segmentation:Yw,invertedStyle:{enabled:hx,...$w}};fp.pickOutsideVisibleMinorAxis=dx(hx),fp.focusPriority=dx(jw);import{_ModuleSupport as Je}from"ag-charts-community";var px={lineDash:{$path:"/series/$index/lineDash"},lineDashOffset:{$path:"/series/$index/lineDashOffset"},stroke:{$path:["/series/$index/stroke",{$palette:"stroke"}]},strokeOpacity:{$path:"/series/$index/strokeOpacity"},strokeWidth:{$path:["/series/$index/strokeWidth",1]},marker:{enabled:{$path:"/series/$index/marker/enabled"},fill:{$isUserOption:["/series/$index/marker/fill",{$if:[{$or:[{$isGradient:{$path:"/series/$index/marker/fill"}},{$isImage:{$path:"/series/$index/marker/fill"}},{$isPattern:{$path:"/series/$index/marker/fill"}}]},{$merge:[{$path:"/series/$index/marker/fill"},{$applySwitch:[{$path:"type"},void 0,["gradient",Je.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",Je.FILL_IMAGE_DEFAULTS],["pattern",Je.FILL_PATTERN_DEFAULTS]]}]},{$isUserOption:["/series/$index/marker/fill",{$path:"/series/$index/marker/fill"},{$palette:"fill"}]}]},{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",Je.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",Je.FILL_IMAGE_DEFAULTS],["pattern",Je.FILL_PATTERN_DEFAULTS]]}]},fillOpacity:{$path:"/series/$index/marker/fillOpacity"},lineDash:{$path:"/series/$index/marker/lineDash"},lineDashOffset:{$path:"/series/$index/marker/lineDashOffset"},shape:{$path:"/series/$index/marker/shape"},size:{$path:["/series/$index/marker/size",6]},stroke:{$path:["/series/$index/marker/stroke",{$palette:"stroke"}]},strokeOpacity:{$path:"/series/$index/marker/strokeOpacity"},strokeWidth:{$path:["/series/$index/marker/strokeWidth",2]}}},Zw={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",Je.FILL_GRADIENT_LINEAR_DEFAULTS],["pattern",Je.FILL_PATTERN_DEFAULTS]]},fillOpacity:.7,stroke:{$palette:"stroke"},strokeWidth:1,marker:{enabled:!1,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",Je.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",Je.FILL_IMAGE_DEFAULTS],["pattern",Je.FILL_PATTERN_DEFAULTS]]},shape:"circle",stroke:{$palette:"stroke"},size:6,strokeWidth:2},nodeClickRange:"nearest",item:{low:px,high:px},label:{...Je.LABEL_BOXING_DEFAULTS,enabled:!1,placement:"outside",padding:{$isUserOption:["./spacing",0,10]},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},interpolation:{type:"linear"},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:Je.multiSeriesHighlightStyle(),segmentation:Je.SEGMENTATION_DEFAULTS,invertedStyle:{enabled:!1,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",Je.FILL_GRADIENT_LINEAR_DEFAULTS],["image",Je.FILL_IMAGE_DEFAULTS],["pattern",Je.FILL_PATTERN_DEFAULTS]]},fillOpacity:{$path:"../fillOpacity"}}},axes:{[Je.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{enabled:!0}}}},{ThemeConstants:{CARTESIAN_AXIS_TYPE:ux,CARTESIAN_POSITION:gx}}=Um,qw={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"range-area",moduleFactory:e=>new jl(e),predictAxis:Um.predictCartesianTimeAxis,defaultAxes:[{type:ux.NUMBER,position:gx.LEFT},{type:ux.CATEGORY,position:gx.BOTTOM}],themeTemplate:Zw},yx={type:"series",name:"range-area",chartType:"cartesian",enterprise:!0,options:fp,create:e=>new jl(e)};import{_ModuleSupport as fx}from"ag-charts-community";import{_ModuleSupport as Ul}from"ag-charts-community";import{_ModuleSupport as Qw}from"ag-charts-community";var{aggregationDomain:Jw,aggregationRangeFittingPoints:eP,compactAggregationIndices:tP,createAggregationIndices:iP}=Qw,oP=1e3;function sP(e,t,i,o,s,a){if(t.length64;)({indexData:c,valueData:h,maxRange:l}=tP(c,h,l)),p.push({maxRange:l,indexData:c});return p.reverse(),p}import{_ModuleSupport as aP}from"ag-charts-community";var{AbstractBarSeriesProperties:nP,makeSeriesTooltip:rP,Property:Le,DropShadow:lP,Label:cP}=aP,mp=class extends cP{constructor(){super(...arguments),this.placement="inside",this.spacing=0}};d([Le],mp.prototype,"placement",2),d([Le],mp.prototype,"spacing",2);var Oe=class extends nP{constructor(){super(...arguments),this.fill="#99CCFF",this.fillOpacity=1,this.stroke="#99CCFF",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.shadow=new lP().set({enabled:!1}),this.label=new mp,this.tooltip=rP()}};d([Le],Oe.prototype,"xKey",2),d([Le],Oe.prototype,"yLowKey",2),d([Le],Oe.prototype,"yHighKey",2),d([Le],Oe.prototype,"xName",2),d([Le],Oe.prototype,"yName",2),d([Le],Oe.prototype,"yLowName",2),d([Le],Oe.prototype,"yHighName",2),d([Le],Oe.prototype,"fill",2),d([Le],Oe.prototype,"fillOpacity",2),d([Le],Oe.prototype,"stroke",2),d([Le],Oe.prototype,"strokeWidth",2),d([Le],Oe.prototype,"strokeOpacity",2),d([Le],Oe.prototype,"lineDash",2),d([Le],Oe.prototype,"lineDashOffset",2),d([Le],Oe.prototype,"cornerRadius",2),d([Le],Oe.prototype,"styler",2),d([Le],Oe.prototype,"itemStyler",2),d([Le],Oe.prototype,"shadow",2),d([Le],Oe.prototype,"label",2),d([Le],Oe.prototype,"tooltip",2);var{SeriesNodePickMode:mx,valueProperty:xx,keyProperty:hP,ChartAxisDirection:Fn,checkCrisp:dP,updateLabelNode:pP,SMALLEST_KEY_INTERVAL:uP,LARGEST_KEY_INTERVAL:gP,diff:yP,prepareBarAnimationFunctions:Sx,midpointStartingBarPosition:bx,resetBarSelectionsFn:fP,fixNumericExtent:mP,seriesLabelFadeInAnimation:vx,resetLabelFn:xP,animationValidation:SP,computeBarFocusBounds:bP,visibleRangeIndices:vP,createDatumId:kP,ContinuousScale:DP,Rect:MP,PointerEvents:AP,motion:kx,applyShapeStyle:IP,findMinMax:LP,areScalingEqual:TP,processedDataIsAnimatable:CP,AGGREGATION_SPAN:Dx,AGGREGATION_INDEX_X_MAX:Mx,AGGREGATION_INDEX_X_MIN:Ax,AGGREGATION_INDEX_Y_MAX:NP,AGGREGATION_INDEX_Y_MIN:wP,mergeDefaults:Ix,simpleMemorize2:PP,getItemStyles:OP,calculateSegments:_P,toHighlightString:RP,HighlightState:Lx}=Ul,EP=PP(sP),BP=class extends Ul.SeriesNodeEvent{constructor(e,t,i,o){super(e,t,i,o),this.xKey=o.properties.xKey,this.yLowKey=o.properties.yLowKey,this.yHighKey=o.properties.yHighKey}},Xl=class extends Ul.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[mx.AXIS_ALIGNED,mx.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["yLowKey","yHighKey"]},propertyNames:{x:["xName"],y:["yLowName","yHighName","yName"]},categoryKey:"xValue",datumSelectionGarbageCollection:!1,animationResetFns:{datum:fP,label:xP}}),this.properties=new Oe,this.dataAggregationFilters=void 0,this.NodeEvent=BP}async processData(e){const{xKey:t,yLowKey:i,yHighKey:o}=this.properties,s=this.getCategoryAxis()?.scale,a=this.getValueAxis()?.scale,{isContinuousX:n,xScaleType:r,yScaleType:l}=this.getScaleInformation({xScale:s,yScale:a}),c=[];this.ctx.animationManager.isSkipped()||(this.processedData&&c.push(yP(this.id,this.processedData)),c.push(SP()));const h=this.visible?{}:{forceValue:0},{dataModel:p,processedData:u}=await this.requestDataModel(e,this.data,{props:[hP(t,r,{id:"xValue"}),xx(i,l,{id:"yLowValue",invalidValue:null,...h}),xx(o,l,{id:"yHighValue",invalidValue:null,...h}),...n?[uP,gP]:[],...c],groupByKeys:!1});this.smallestDataInterval=u.reduced?.smallestKeyInterval,this.largestDataInterval=u.reduced?.largestKeyInterval,this.dataAggregationFilters=this.aggregateData(p,u),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||CP(t))return;const i=this.axes[Fn.X];if(i==null)return;const o=e.resolveKeysById(this,"xValue",t),s=e.resolveColumnById(this,"yHighValue",t),a=e.resolveColumnById(this,"yLowValue",t),{index:n}=e.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[n];return EP(i.scale.type,o,s,a,r,t.reduced?.smallestKeyInterval)}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!t||!i)return[];const{keys:[o]}=t.domain;if(e===this.getCategoryDirection()){const s=i.resolveProcessedDataDefById(this,"xValue");return s?.def.type==="key"&&s?.def.valueType==="category"?o:this.padBandExtent(o)}else{const s=this.domainForClippedRange(e,["yHighValue","yLowValue"],"xValue"),a=LP(s);return mP(a)}}getSeriesRange(e,t){return this.domainForVisibleRange(Fn.Y,["yHighValue","yLowValue"],"xValue",t)}createNodeData(){const{data:e,dataModel:t,groupScale:i,processedData:o,visible:s}=this,a=this.getCategoryAxis(),n=this.getValueAxis();if(!(e&&a&&n&&t&&o?.dataSources&&this.chart?.seriesRect))return;const r=a.scale,l=n.scale,c=this.getBarDirection()===Fn.X,{xKey:h,yLowKey:p,yHighKey:u,strokeWidth:g}=this.properties,y=`${p}-${u}`,f=_P(this.properties.segmentation,a,n,this.chart.seriesRect,this.ctx.scene),x={itemId:y,nodeData:[],labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:OP(this.getItemStyle.bind(this)),segments:f};if(!s)return x;const S=o.dataSources.get(this.id)?.data??[],v=t.resolveKeysById(this,"xValue",o),m=t.resolveColumnById(this,"yLowValue",o),b=t.resolveColumnById(this,"yHighValue",o),{barWidth:k,groupIndex:A}=this.updateGroupScale(a),M=DP.is(r)?k*-.5:0,D=i.convert(String(A)),L=dP(a?.scale,a?.visibleRange,this.smallestDataInterval,this.largestDataInterval),N=w=>Math.round(r.convert(v[w]))+D+M,P=(w,C,I,O,z,B,H)=>{const W=S[w],V=v[w];if(V==null)return;const G=m[w],K=b[w];if(!Number.isFinite(G?.valueOf())||!Number.isFinite(K?.valueOf()))return;const[Q,X]=Gw.maxRange>E);if(T!=null){const{maxRange:w,indexData:C}=T,[I,O]=vP(1,w,a.range,z=>{const B=z*Dx,H=C[B+Ax],W=C[B+Mx];if(H===-1)return;const V=Math.trunc((H+W)/2);return[N(V),N(W)+k]});for(let z=I;zthis.getDatumId(s))}getItemStyle(e,t,i){const{properties:o,dataModel:s,processedData:a}=this,{itemStyler:n}=o,r=this.getHighlightStyle(t,e,i);let l=Ix(r,this.getStyle(e===void 0,t,i));if(n&&s!=null&&a!=null&&e!=null){const c=s.resolveKeysById(this,"xValue",a)[e],h=this.cachedDatumCallback(kP(this.getDatumId({xValue:c}),t?"highlight":"node"),()=>{const p=this.makeItemStylerParams(e,t,l);return this.callWithContext(n,p)});h&&(l=Ix(h,l))}return l}makeItemStylerParams(e,t,i){const{id:o,properties:s,processedData:a}=this,{xKey:n,yHighKey:r,yLowKey:l}=s,c=a.dataSources.get(o)?.data[e],h=this.ctx.highlightManager?.getActiveHighlight(),p=this.getHighlightStateString(h,t,e),u=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:o,datum:c,xKey:n,yHighKey:r,yLowKey:l,highlighted:t,highlightState:p,...i,fill:u}}updateDatumStyles(e){const t=this.ctx.highlightManager.getActiveHighlight();e.datumSelection.each((i,o)=>{if(!e.datumSelection.isGarbage(i)){const s=this.getHighlightState(t,e.isHighlight,o.datumIndex);o.style=this.getItemStyle(o.datumIndex,e.isHighlight,s)}})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const o=this.ctx.highlightManager.getActiveHighlight(),s=this.getCategoryDirection()===Fn.X,a=this.getShapeFillBBox();e.each((n,r)=>{const l=r.style??i.styles[this.getHighlightState(o,t,r.datumIndex)];IP(n,l,a),n.cornerRadius=l.cornerRadius??0,n.visible=s?r.width>0:r.height>0,n.crisp=r.crisp})}updateLabelSelection(e){const t=this.properties.label.enabled?e.labelData:[];return e.labelSelection.update(t,i=>{i.pointerEvents=AP.None})}updateLabelNodes(e){const t={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yName:this.properties.yName,yLowKey:this.properties.yLowKey,yLowName:this.properties.yLowName??this.properties.yLowKey,yHighKey:this.properties.yHighKey,yHighName:this.properties.yHighName??this.properties.yHighKey,legendItemName:this.properties.legendItemName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((o,s)=>{o.fillOpacity=this.getHighlightStyle(!1,s?.datumIndex).opacity??1,pP(this,o,t,this.properties.label,s,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:o,properties:s}=this,{xKey:a,xName:n,yName:r,yLowKey:l,yHighKey:c,yLowName:h,yHighName:p,tooltip:u,legendItemName:g}=s,y=this.getCategoryAxis(),f=this.getValueAxis();if(!i||!o||!y||!f)return;const x=o.dataSources.get(this.id)?.data[e],S=i.resolveKeysById(this,"xValue",o)[e],v=i.resolveColumnById(this,"yHighValue",o)[e],m=i.resolveColumnById(this,"yLowValue",o)[e];if(S==null)return;const b=this.getItemStyle(e,!1),k=`${this.getAxisValueText(f,"tooltip",m,x,l,g)} - ${this.getAxisValueText(f,"tooltip",v,x,c,g)}`;return this.formatTooltipWithContext(u,{heading:this.getAxisValueText(y,"tooltip",S,x,a,g),symbol:this.legendItemSymbol(),data:[{label:r,fallbackLabel:`${h??l} - ${p??c}`,value:k}]},{seriesId:t,datum:x,title:r,xKey:a,xName:n,yName:r,yLowKey:l,yHighKey:c,yLowName:h,yHighName:p,legendItemName:g,...b})}legendItemSymbol(){const{fill:e,stroke:t,strokeWidth:i,fillOpacity:o,strokeOpacity:s,lineDash:a,lineDashOffset:n}=this.getStyle(!1,!1,Lx.None);return{marker:{fill:e,stroke:t,fillOpacity:o,strokeOpacity:s,strokeWidth:i,lineDash:a,lineDashOffset:n}}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{yName:o,yLowName:s,yHighName:a,yLowKey:n,yHighKey:r,legendItemName:l,showInLegend:c}=this.properties,h=l??o??`${s??n} - ${a??r}`,p=`${n}-${r}`;return[{legendType:"category",id:t,itemId:p,seriesId:t,enabled:i,label:{text:`${h}`},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!c}]}animateEmptyUpdateReady({datumSelection:e,labelSelection:t}){const i=Sx(bx(this.isVertical(),"normal"),"unknown");kx.fromToMotion(this.id,"datums",this.ctx.animationManager,[e],i),vx(this,"labels",this.ctx.animationManager,t)}animateWaitingUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:o,previousContextData:s}=e,a=Ul.calculateDataDiff(this.id,t,this.getDatumId.bind(this),o,s,this.processedData,this.processedDataUpdated);this.ctx.animationManager.stopByAnimationGroupId(this.id);const n=s==null?"fade":"normal",r=Sx(bx(this.isVertical(),n),"added");kx.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],r,(l,c)=>this.getDatumId(c),a),(a?.changed||!TP(o.groupScale,s?.groupScale))&&vx(this,"labels",this.ctx.animationManager,i)}getDatumId(e){return`${e.xValue}`}isLabelEnabled(){return this.properties.label.enabled}onDataChange(){}computeFocusBounds({datumIndex:e}){return bP(this,this.contextNodeData?.nodeData[e])}hasItemStylers(){return this.properties.styler!=null||this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};Xl.className="RangeBarSeries",Xl.type="range-bar";import{_ModuleSupport as zP}from"ag-charts-community";import{boolean as FP,constant as HP,number as VP,required as Zl,shapeSegmentation as WP,string as Qo,undocumented as Tx}from"ag-charts-core";var{commonSeriesOptionsDefs:GP,rangeBarSeriesThemeableOptionsDef:KP}=zP,xp={...GP,...KP,type:Zl(HP("range-bar")),xKey:Zl(Qo),yLowKey:Zl(Qo),yHighKey:Zl(Qo),xName:Qo,yName:Qo,yLowName:Qo,yHighName:Qo,legendItemName:Qo,segmentation:WP};xp.pickOutsideVisibleMinorAxis=Tx(FP),xp.focusPriority=Tx(VP);import{_ModuleSupport as _s}from"ag-charts-community";var $P={series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",_s.FILL_GRADIENT_LINEAR_DEFAULTS],["image",_s.FILL_IMAGE_DEFAULTS],["pattern",_s.FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{..._s.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},placement:"inside",padding:{$isUserOption:["./spacing",0,6]}},highlight:_s.multiSeriesHighlightStyle(),segmentation:_s.SEGMENTATION_DEFAULTS},axes:{[_s.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{enabled:!0}}}},jP={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"range-bar",moduleFactory:e=>new Xl(e),predictAxis:fx.predictCartesianTimeAxis,defaultAxes:fx.DIRECTION_SWAP_AXES,themeTemplate:$P,groupable:!0},Cx={type:"series",name:"range-bar",chartType:"cartesian",enterprise:!0,options:xp,create:e=>new Xl(e)};import{_ModuleSupport as YP}from"ag-charts-community";import{_ModuleSupport as Rs}from"ag-charts-community";import{_ModuleSupport as UP}from"ag-charts-community";var{AbstractBarSeriesProperties:XP,BaseProperties:Hn,PropertiesArray:ZP,makeSeriesTooltip:qP,Property:re,DropShadow:QP,Label:JP}=UP,ql=class extends Hn{};d([re],ql.prototype,"totalType",2),d([re],ql.prototype,"index",2),d([re],ql.prototype,"axisLabel",2);var Nx=class extends Hn{};d([re],Nx.prototype,"renderer",2);var Sp=class extends JP{constructor(){super(...arguments),this.placement="outside-end",this.spacing=0}};d([re],Sp.prototype,"placement",2),d([re],Sp.prototype,"spacing",2);var mt=class extends Hn{constructor(){super(...arguments),this.fill="#c16068",this.stroke="#c16068",this.fillOpacity=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.strokeWidth=1,this.cornerRadius=0,this.shadow=new QP().set({enabled:!1}),this.label=new Sp,this.tooltip=new Nx}};d([re],mt.prototype,"name",2),d([re],mt.prototype,"fill",2),d([re],mt.prototype,"stroke",2),d([re],mt.prototype,"fillOpacity",2),d([re],mt.prototype,"strokeOpacity",2),d([re],mt.prototype,"lineDash",2),d([re],mt.prototype,"lineDashOffset",2),d([re],mt.prototype,"strokeWidth",2),d([re],mt.prototype,"cornerRadius",2),d([re],mt.prototype,"itemStyler",2),d([re],mt.prototype,"shadow",2),d([re],mt.prototype,"label",2),d([re],mt.prototype,"tooltip",2);var Es=class extends Hn{constructor(){super(...arguments),this.enabled=!0,this.stroke="black",this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.strokeWidth=2}};d([re],Es.prototype,"enabled",2),d([re],Es.prototype,"stroke",2),d([re],Es.prototype,"strokeOpacity",2),d([re],Es.prototype,"lineDash",2),d([re],Es.prototype,"lineDashOffset",2),d([re],Es.prototype,"strokeWidth",2);var Ql=class extends Hn{constructor(){super(...arguments),this.positive=new mt,this.negative=new mt,this.total=new mt}};d([re],Ql.prototype,"positive",2),d([re],Ql.prototype,"negative",2),d([re],Ql.prototype,"total",2);var bo=class extends XP{constructor(){super(...arguments),this.item=new Ql,this.totals=new ZP(ql),this.line=new Es,this.tooltip=qP()}getStyle(e){const{fillOpacity:t,strokeWidth:i,strokeOpacity:o,fill:s,stroke:a,lineDash:n,lineDashOffset:r,cornerRadius:l}=this.item[e==="subtotal"?"total":e];return{fill:s,fillOpacity:t,stroke:a,strokeWidth:i,strokeOpacity:o,lineDash:n,lineDashOffset:r,cornerRadius:l,opacity:1}}};d([re],bo.prototype,"xKey",2),d([re],bo.prototype,"yKey",2),d([re],bo.prototype,"xName",2),d([re],bo.prototype,"yName",2),d([re],bo.prototype,"item",2),d([re],bo.prototype,"totals",2),d([re],bo.prototype,"line",2),d([re],bo.prototype,"tooltip",2);var{adjustLabelPlacement:eO,SeriesNodePickMode:wx,fixNumericExtent:tO,valueProperty:Px,keyProperty:iO,accumulativeValueProperty:Jl,trailingAccumulatedValueProperty:oO,ChartAxisDirection:ec,createDatumId:sO,checkCrisp:aO,updateLabelNode:nO,prepareBarAnimationFunctions:rO,collapsedStartingBarPosition:lO,resetBarSelectionsFn:cO,seriesLabelFadeInAnimation:hO,resetLabelFn:dO,animationValidation:pO,DEFAULT_CARTESIAN_DIRECTION_KEYS:uO,DEFAULT_CARTESIAN_DIRECTION_NAMES:gO,computeBarFocusBounds:yO,isContinuous:Ox,Rect:fO,motion:mO,applyShapeStyle:xO,mergeDefaults:_x,getItemStylesPerItemId:SO,DataSet:bO}=Rs,tc=class extends Rs.AbstractBarSeries{constructor(e){super({moduleCtx:e,propertyKeys:uO,propertyNames:gO,categoryKey:void 0,pickModes:[wx.NEAREST_NODE,wx.EXACT_SHAPE_MATCH],pathsPerSeries:["connector"],pathsZIndexSubOrderOffset:[-1,-1],animationResetFns:{datum:cO,label:dO}}),this.properties=new bo,this.seriesItemTypes=new Set(["positive","negative","total"])}async processData(e){const{xKey:t,yKey:i,totals:o}=this.properties,{data:s}=this;if(!this.visible)return;const a=v=>Ox(v)&&Number(v)>=0,n=v=>Ox(v)&&Number(v)>=0,r=v=>v==="total"||v==="subtotal",l={missingValue:void 0,invalidValue:void 0},c=[],h=o.reduce((v,m)=>{const b=v.get(m.index);return b?b.push(m):v.set(m.index,[m]),v},new Map);for(const[v,m]of s?.data.entries()??[]){c.push(m);const b=h.get(v);if(b)for(const k of b)c.push({...k.toJson(),[t]:k.axisLabel})}const p=[];this.ctx.animationManager.isSkipped()||p.push(pO());const u=this.getCategoryAxis()?.scale,g=this.getValueAxis()?.scale,{isContinuousX:y,xScaleType:f,yScaleType:x}=this.getScaleInformation({xScale:u,yScale:g}),{processedData:S}=await this.requestDataModel(e,bO.wrap(c),{props:[iO(t,f,{id:"xValue"}),Jl(i,x,{...l,id:"yCurrent"}),Jl(i,x,{...l,missingValue:0,id:"yCurrentTotal"}),Jl(i,x,{...l,id:"yCurrentPositive",validation:a}),Jl(i,x,{...l,id:"yCurrentNegative",validation:n}),oO(i,x,{...l,id:"yPrevious"}),Px(i,x,{id:"yRaw"}),Px("totalType","category",{id:"totalTypeValue",missingValue:void 0,validation:r}),...y?[Rs.SMALLEST_KEY_INTERVAL,Rs.LARGEST_KEY_INTERVAL]:[],...p]});this.smallestDataInterval=S.reduced?.smallestKeyInterval,this.largestDataInterval=S.reduced?.largestKeyInterval,this.updateSeriesItemTypes(),this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!t||!i)return[];const{keys:[o],values:s}=t.domain;if(e===this.getCategoryDirection()){const a=i.resolveProcessedDataDefById(this,"xValue");if(a?.def.type==="key"&&a?.def.valueType==="category")return o;const n=e===ec.Y,r=this.getCategoryAxis().isReversed();return this.padBandExtent(o,r!==n)}else{const a=i.resolveProcessedDataIndexById(this,"yCurrent"),n=s[a],r=[Math.min(0,n[0]),Math.max(0,n[1])];return tO(r)}}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{data:e,dataModel:t,processedData:i}=this,o=this.getCategoryAxis(),s=this.getValueAxis();if(!e||!o||!s||!t||!i)return;const{line:a}=this.properties,n=o.scale,r=s.scale,l=this.getBarDirection()===ec.X,c=this.getBandwidth(o)??10,h=o.isReversed(),p=s.isReversed();if(i.type!=="ungrouped")return;const u={itemId:this.properties.yKey,nodeData:[],labelData:[],pointData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:SO(this.getItemStyle.bind(this),"total","subtotal","positive","negative")};if(!this.visible)return u;const g=[],y=t.resolveKeysById(this,"xValue",i),f=t.resolveColumnById(this,"yRaw",i),x=t.resolveColumnById(this,"totalTypeValue",i),S=t.resolveColumnById(this,"yCurrent",i),v=t.resolveColumnById(this,"yPrevious",i),m=t.resolveColumnById(this,"yCurrentTotal",i),b=this.getSeriesDomain(ec.Y),k=aO(o?.scale,o?.visibleRange,this.smallestDataInterval,this.largestDataInterval);function A(E,T,w){return E||T?{cumulativeValue:m[w],trailingValue:T?D:0}:{cumulativeValue:S[w],trailingValue:v[w]}}function M(E,T,w,C,I){return E?C:T?(C??0)-(I??0):w}let D=0;const{xKey:L,yKey:N,xName:P,yName:R}=this.properties,F=i.dataSources.get(this.id)?.data??[];for(const[E,T]of F.entries()){const w=x[E],C=this.isSubtotal(w),I=this.isTotal(w),O=I||C,z=y[E];if(z==null)continue;const B=Math.round(n.convert(z)),H=f[E],{cumulativeValue:W,trailingValue:V}=A(I,C,E);O&&(D=W??0);const G=Math.round(r.convert(W)),K=Math.round(r.convert(V)),Q=M(I,C,H,W,V),X=(Q??0)>=0,Y=this.getSeriesItemType(X,w),{strokeWidth:J,label:ie}=this.getItemConfig(Y),U=X?G:K,he=X?K:G,ne=Math.max(J,Math.abs(he-U)),Z={x:l?Math.min(U,he):B,y:l?B:Math.min(U,he),width:l?ne:c,height:l?c:ne},le={x:Z.x+Z.width/2,y:Z.y+Z.height/2},oe=O?G:K,ge=Math.floor(a.strokeWidth)%2/2,ce=h?G:oe,me=h?oe:G;let $e,Ht;l?($e={x:ce+ge,y:Z.y},Ht={x:me+ge,y:Z.y+Z.height}):($e={x:Z.x,y:ce+ge},Ht={x:Z.x+Z.width,y:me+ge});const ds={x:h?Ht.x:$e.x,y:h?Ht.y:$e.y,x2:h?$e.x:Ht.x,y2:h?$e.y:Ht.y,size:0};g.push(ds);const xi=Y==="subtotal"?"total":Y,_i=this.getLabelText(Q,T,N,"y",b,ie,{itemId:xi,value:Q,datum:T,xKey:L,yKey:N,xName:P,yName:R}),hn=ie.spacing+(typeof ie.padding=="number"?ie.padding:0),dn={index:E,series:this,itemId:Y,datum:T,datumIndex:E,cumulativeValue:W??0,xValue:z,yValue:Q,yKey:N,xKey:L,x:Z.x,y:Z.y,width:Z.width,height:Z.height,midPoint:le,crisp:k,label:{text:_i,...eO({isUpward:(Q??-1)>=0!==p,isVertical:!l,placement:ie.placement,spacing:hn,rect:Z})}};u.nodeData.push(dn),u.labelData.push(dn)}const _=this.properties.line.enabled;return S!=null&&_&&(u.pointData=g),u}updateSeriesItemTypes(){const{dataModel:e,seriesItemTypes:t,processedData:i}=this;if(!e||!i)return;t.clear();const o=e.resolveProcessedDataIndexById(this,"yCurrentPositive"),s=e.resolveProcessedDataIndexById(this,"yCurrentNegative"),a=e.resolveProcessedDataIndexById(this,"totalTypeValue"),n=i.domain.values[o]??[],r=i.domain.values[s]??[];n.length>0&&t.add("positive"),r.length>0&&t.add("negative");const l=i?.domain.values[a];if(l)for(const c of l)(c==="total"||c==="subtotal")&&t.add("total")}isSubtotal(e){return e==="subtotal"}isTotal(e){return e==="total"}nodeFactory(){return new fO}getSeriesItemType(e,t){return t??(e?"positive":"negative")}getItemConfig(e){switch(e){case"positive":return this.properties.item.positive;case"negative":return this.properties.item.negative;case"subtotal":case"total":return this.properties.item.total}}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,o=t??[];return i.update(o)}getItemStyle(e,t,i,o="total"){const{properties:s}=this,{datumIndex:a=0,datum:n}=e??{},r=o==="subtotal"?"total":o,l=s.item[r],c=this.getHighlightStyle(t,a,i),h=_x(c,s.getStyle(o)),{itemStyler:p}=l;let u=h;if(p!=null&&e!=null){const g=this.cachedDatumCallback(sO(a,t?"highlight":"node"),()=>{const y=this.makeItemStylerParams(o,a,n,t,u);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`,"item",r],this.callWithContext(p,y))});g&&(u=_x(g,u))}return u}makeItemStylerParams(e,t,i,o,s){const{id:a,properties:n}=this,{xKey:r,yKey:l}=n,c=this.ctx.highlightManager?.getActiveHighlight(),h=this.getHighlightStateString(c,o,t),p=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:a,itemId:e,datum:i,xKey:r,yKey:l,highlighted:o,highlightState:h,...s,fill:p}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,o)=>{o.style=this.getItemStyle(o,t,void 0,o.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const o=this.ctx.highlightManager.getActiveHighlight(),s=this.getCategoryDirection()===ec.X,a=this.getShapeFillBBox();e.each((n,r)=>{const l=r.style??i.styles[r.itemId][this.getHighlightState(o,t,r.datumIndex)];xO(n,l,a),n.cornerRadius=l.cornerRadius??0,n.visible=s?r.width>0:r.height>0,n.crisp=r.crisp})}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;if(t.length===0)return i.update([]);const o=t.filter(s=>{const{label:a}=this.getItemConfig(s.itemId);return a.enabled});return i.update(o)}updateLabelNodes(e){const t={itemId:"positive",xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xName,yKey:this.properties.yKey,yName:this.properties.yName??this.properties.yName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((o,s)=>{t.itemId=s.itemId,o.fillOpacity=this.getHighlightStyle(!1,s.datumIndex)?.opacity??1;const a=this.getItemConfig(s.itemId).label;nO(this,o,t,a,s.label,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:o,properties:s}=this,{xKey:a,xName:n,yKey:r,yName:l,tooltip:c,legendItemName:h}=s,p=this.getCategoryAxis(),u=this.getValueAxis();if(!i||!o||!p||!u)return;const g=o.dataSources.get(this.id)?.data[e],y=i.resolveKeysById(this,"xValue",o)[e],f=i.resolveColumnById(this,"yRaw",o)[e],x=i.resolveColumnById(this,"yCurrentTotal",o),S=i.resolveColumnById(this,"totalTypeValue",o);if(y==null)return;const v=S[e],m=(f??0)>=0,b=this.getSeriesItemType(m,v);let k;if(this.isTotal(v))k=x[e];else if(this.isSubtotal(v)){k=x[e];for(let D=e-1;D>=0;D-=1)if(this.isSubtotal(S[D])){k=k-x[D];break}}else k=f;const A=this.contextNodeData?.nodeData?.[e],M=this.getItemStyle(A,!1,void 0,A?.itemId);return this.formatTooltipWithContext(c,{heading:this.getAxisValueText(p,"tooltip",y,g,a,h),symbol:this.legendItemSymbol(b),data:[{label:l,fallbackLabel:r,value:this.getAxisValueText(u,"tooltip",k,g,r,h)}]},{seriesId:t,datum:g,title:l,itemId:b,xKey:a,xName:n,yKey:r,yName:l,...M})}legendItemSymbol(e){const{fill:t,stroke:i,fillOpacity:o,strokeOpacity:s,strokeWidth:a,lineDash:n,lineDashOffset:r}=this.getItemConfig(e);return{marker:{fill:t,stroke:i,fillOpacity:o,strokeOpacity:s,strokeWidth:a,lineDash:n,lineDashOffset:r}}}getLegendData(e){if(e!=="category")return[];const{id:t,seriesItemTypes:i}=this,o=[],s=n=>n.charAt(0).toUpperCase()+n.substring(1),{showInLegend:a}=this.properties;for(const n of i){const{name:r}=this.getItemConfig(n);o.push({legendType:"category",id:t,itemId:n,seriesId:t,enabled:!0,label:{text:r??s(n)},symbol:this.legendItemSymbol(n),hideInLegend:!a,isFixed:!0})}return o}toggleSeriesItem(){}animateEmptyUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:o}=e,s=rO(lO(this.isVertical(),this.axes,"normal"),"unknown");mO.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],s),hO(this,"labels",this.ctx.animationManager,i);const{pointData:a}=o;a&&(this.isVertical()?this.animateConnectorLinesVertical(e):this.animateConnectorLinesHorizontal(e))}animateConnectorLinesHorizontal(e){const{pointData:t=[]}=e.contextData,[i]=e.paths,{path:o}=i;this.updateLineNode(i);const s=this.getValueAxis(),a=s?.isReversed(),n=a?(h,p)=>hh>p,r=s?.scale.convert(0),l=t.reduce((h,p)=>(n(p.x,h)&&(h=p.x),h),a?1/0:0),c=(h,p,u,g,y)=>(h-p)/(u-p)*(y-g)+g;this.ctx.animationManager.animate({id:`${this.id}_connectors`,groupId:this.id,phase:"initial",from:r,to:l,ease:Rs.Motion.easeOut,collapsable:!1,onUpdate(h){o.clear(!0);for(const[p,u]of t.entries()){const g=c(h,r,l,r,u.x),y=c(h,r,l,r,u.x2);p!==0&&o.lineTo(g,u.y),o.moveTo(y,u.y2)}i.checkPathDirty()},onStop:()=>this.resetConnectorLinesPath(e)})}animateConnectorLinesVertical(e){const{pointData:t=[]}=e.contextData,[i]=e.paths,{path:o}=i;this.updateLineNode(i);const s=this.getValueAxis(),a=s?.isReversed(),n=a?(h,p)=>h>p:(h,p)=>h(n(p.y,h)&&(h=p.y),h),a?0:1/0),c=(h,p,u,g,y)=>(h-p)/(u-p)*(y-g)+g;this.ctx.animationManager.animate({id:`${this.id}_connectors`,groupId:this.id,phase:"initial",from:r,to:l,ease:Rs.Motion.easeOut,collapsable:!1,onUpdate(h){o.clear(!0);for(const[p,u]of t.entries()){const g=c(h,r,l,r,u.y),y=c(h,r,l,r,u.y2);p!==0&&o.lineTo(u.x,g),o.moveTo(u.x2,y)}i.checkPathDirty()},onStop:()=>this.resetConnectorLinesPath(e)})}animateReadyResize(e){super.animateReadyResize(e),this.resetConnectorLinesPath(e)}updatePaths(e){this.resetConnectorLinesPath({contextData:e.contextData,paths:e.paths})}resetConnectorLinesPath({contextData:e,paths:t}){if(t.length===0)return;const[i]=t;this.updateLineNode(i);const{path:o}=i;o.clear(!0);const{pointData:s}=e;if(s){for(const[a,n]of s.entries())a!==0&&o.lineTo(n.x,n.y),o.moveTo(n.x2,n.y2);i.checkPathDirty()}}updateLineNode(e){const{stroke:t,strokeWidth:i,strokeOpacity:o,lineDash:s,lineDashOffset:a}=this.properties.line;e.setProperties({fill:void 0,stroke:t,strokeWidth:i,strokeOpacity:o,lineDash:s,lineDashOffset:a,lineJoin:"round",pointerEvents:Rs.PointerEvents.None})}isLabelEnabled(){const{positive:e,negative:t,total:i}=this.properties.item;return e.label.enabled||t.label.enabled||i.label.enabled}onDataChange(){}computeFocusBounds({datumIndex:e}){return yO(this,this.contextNodeData?.nodeData[e])}hasItemStylers(){const{positive:e,negative:t,total:i}=this.properties.item;return e.itemStyler!=null||e.label.itemStyler!=null||t.itemStyler!=null||t.label.itemStyler!=null||i.itemStyler!=null||i.label.itemStyler!=null}};tc.className="WaterfallSeries",tc.type="waterfall";import{_ModuleSupport as vO}from"ag-charts-community";import{arrayOfDefs as kO,constant as DO,positiveNumber as MO,required as za,string as Vn,union as AO}from"ag-charts-core";var{commonSeriesOptionsDefs:IO,waterfallSeriesThemeableOptionsDef:LO}=vO,TO={...LO,...IO,type:za(DO("waterfall")),xKey:za(Vn),yKey:za(Vn),xName:Vn,yName:Vn,totals:kO({totalType:za(AO("total","subtotal")),index:za(MO),axisLabel:za(Vn)},"a total definition options array")};import{_ModuleSupport as bp}from"ag-charts-community";var{FILL_GRADIENT_LINEAR_KEYED_DEFAULTS:CO,FILL_IMAGE_DEFAULTS:NO,FILL_PATTERN_KEYED_DEFAULTS:wO}=bp;function vp(e,t){return{fill:{$applySwitch:[{$path:"type"},{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$path:[`/${t}`,{$palette:"fill"},{$palette:"fills"}]},{$palette:`${e}.fill`}]},["gradient",CO(e)],["image",NO],["pattern",wO(e)]]},stroke:{$palette:`${e}.stroke`},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{...bp.LABEL_BOXING_DEFAULTS,enabled:!1,fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},formatter:void 0,placement:"outside-end",padding:{$isUserOption:["./spacing",0,6]}}}}var PO={series:{item:{positive:vp("altUp",0),negative:vp("altDown",1),total:vp("neutral",2)},line:{stroke:{$palette:"neutral.stroke"},strokeOpacity:1,lineDash:[0],lineDashOffset:0,strokeWidth:2},highlight:bp.singleSeriesHighlightStyle()},legend:{enabled:!0,toggleSeries:!1}},OO={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"waterfall",solo:!0,moduleFactory:e=>new tc(e),defaultAxes:YP.DIRECTION_SWAP_AXES,themeTemplate:PO},Rx={type:"series",name:"waterfall",chartType:"cartesian",enterprise:!0,options:TO,create:e=>new tc(e)},{NewAreaSeriesModule:_O,NewBarSeriesModule:RO,NewBubbleSeriesModule:EO,NewHistogramSeriesModule:BO,NewLineSeriesModule:zO,NewScatterSeriesModule:FO,numberFormatValidator:HO,textOrSegments:VO,without:jt}=lT,Ex={width:hi,height:hi,grip:On,fill:Tl,stroke:Tl,strokeWidth:hi,cornerRadius:hi},Et=["cursor","highlightStyle","listeners","nodeClickRange","showInLegend","showInMiniChart","tooltip","visible","xName","yName"],Bx=[...Et,"errorBar","label","legendItemName","direction"],zx=[...Et,"direction","legendItemName","minName","q1Name","medianName","q3Name","maxName"],Fx=[...Et,"title","label","labelKey","labelName","sizeName"],Hx=[...Et,"title","label","colorName","textAlign","verticalAlign","itemPadding","colorRange"],Vx=[...Et,"label"],Wx=[...Et,"errorBar","title","label"],Gx=[...Et,"label","yLowName","yHighName"],Kx=[...Et,"direction","label","yLowName","yHighName"],$x=[...Et,"errorBar","title","label","labelKey","labelName"],jx=[...Et,"direction"],WO={enabled:On,height:hi,spacing:hi,cornerRadius:om,mask:{fill:Tl,fillOpacity:uT,stroke:Tl,strokeWidth:hi},minHandle:Ex,maxHandle:Ex,miniChart:{enabled:On,padding:{top:hi,bottom:hi},label:{enabled:On,avoidCollisions:On,spacing:hi,format:HO,formatter:dT(VO),interval:{minSpacing:hi,maxSpacing:hi,values:cT,step:om},...pT},series:hT(gT({area:jt(_O.options,[...Et,"type"]),bar:jt(RO.options,[...Bx,"type"]),"box-plot":jt(pm.options,[...zx,"type"]),bubble:jt(EO.options,[...Fx,"type"]),candlestick:jt(wm.options,[...Et,"type"]),heatmap:jt(Km.options,[...Hx,"type"]),histogram:jt(BO.options,[...Vx,"type"]),line:jt(zO.options,[...Wx,"type"]),ohlc:jt(Ym.options,[...Et,"type"]),"range-area":jt(yx.options,[...Gx,"type"]),"range-bar":jt(Cx.options,[...Kx,"type"]),scatter:jt(FO.options,[...$x,"type"]),waterfall:jt(Rx.options,[...jx,"type"])},"miniChart series options"))}},GO=["area","bar","bubble","candlestick","heatmap","histogram","line","ohlc","range-area","range-bar","scatter","waterfall"],KO=["itemStyler","direction","fill","fillGradientDefaults","fillPatternDefaults","fillImageDefaults","fillOpacity","shadow","focusPriority","highlight","lineDash","lineDashOffset","strokeWidth"];function Yx(e,t){return{$merge:[{$switch:[t,{},[["area","line","range-area"],{marker:{enabled:{$isUserOption:["/series/$index/marker/enabled",{$path:["/series/$index/marker/enabled",!1]},!1]}}}]]},{$omit:[{$switch:[t,Et,["bar",Bx],["box-plot",zx],["bubble",Fx],["heatmap",Hx],["histogram",Vx],["line",[...Wx,...KO]],["range-area",Gx],["range-bar",Kx],["scatter",$x],["waterfall",jx]]},e]}]}}var $O={enabled:!1,height:{$if:[{$path:"./miniChart/enabled"},40,18]},cornerRadius:4,mask:{fill:{$ref:"foregroundColor"},fillOpacity:.1,stroke:{$ref:"borderColor"},strokeWidth:1},minHandle:{fill:{$ref:"chartBackgroundColor"},stroke:{$ref:"borderColor"},strokeWidth:1,width:12,height:24,cornerRadius:4},maxHandle:{fill:{$ref:"chartBackgroundColor"},stroke:{$ref:"borderColor"},strokeWidth:1,width:12,height:24,cornerRadius:4},miniChart:{enabled:!1,label:{color:{$ref:"textColor"},fontSize:{$rem:rT.FONT_SIZE_RATIO.SMALLER},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},spacing:5},padding:{top:0,bottom:0},series:{$apply:[Yx({$path:"/series/$index"},{$path:["/navigator/miniChart/series/$index/type",{$path:["type",{$path:"/series/$index/type"}]}]}),{$if:[{$or:GO.map(e=>({$eq:[{$path:"/series/0/type"},e]}))},{$map:[Yx({$value:"$1"},{$path:"/series/$index/type"}),{$path:"/series"}]},void 0]}]}}},jO={type:"root",optionsKey:"navigator",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new Ta(e),removable:!1,themeTemplate:{navigator:$O}};import{_ModuleSupport as Ux}from"ag-charts-community";import{_ModuleSupport as YO}from"ag-charts-community";var{ToolbarButtonProperties:UO,Property:XO}=YO,Xx=class extends UO{};d([XO],Xx.prototype,"value",2);var{ChartAxisDirection:kp,LayoutElement:ZO,PropertiesArray:qO,Toolbar:QO,Property:Zx}=Ux,Dp=class extends Ux.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!1,this.buttons=new qO(Xx),this.verticalSpacing=10,this.container=e.domManager.addChild("canvas-overlay","range-buttons"),this.container.role="presentation",this.toolbar=new QO(this.ctx,"ariaLabelRangesToolbar","horizontal"),this.toolbar.addClass("ag-charts-range-buttons"),this.container.append(this.toolbar.getElement()),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onButtonPress.bind(this)),e.layoutManager.registerElement(ZO.ToolbarBottom,this.onLayoutStart.bind(this)),e.eventsHub.on("zoom:change",this.onZoomChanged.bind(this)),this.teardown.bind(this))}teardown(){this.toolbar.getElement().remove(),this.toolbar.destroy()}onLayoutStart(e){const{buttons:t,ctx:i,enabled:o,toolbar:s,verticalSpacing:a}=this,{layoutBox:n}=e;if(!o||!i.zoomManager.isZoomEnabled()){s.setHidden(!0);return}s.setHidden(!1),s.updateButtons(t);const r=s.getBounds().height;s.setBounds({x:n.x,y:n.y+n.height-r,width:n.width,height:r}),n.shrink({bottom:r+a})}onZoomChanged(){this.toolbar.clearActiveButton()}onButtonPress({button:{index:e}}){const{zoomManager:t}=this.ctx,i=this.buttons.at(e);if(!i)return;const{value:o}=i;o==null?t.resetZoom("zoom-buttons"):typeof o=="number"?t.extendToEnd("zoom-buttons",kp.X,o):Array.isArray(o)?t.updateWith("zoom-buttons",kp.X,()=>o):typeof o=="function"&&t.updateWith("zoom-buttons",kp.X,o),this.toolbar.toggleActiveButtonByIndex(e)}};d([Zx],Dp.prototype,"enabled",2),d([Zx],Dp.prototype,"buttons",2);var qx=1e3*60*60*24,Mp=qx*30,JO=qx*365,e1={type:"root",optionsKey:"ranges",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new Dp(e),themeTemplate:{ranges:{enabled:!1,buttons:{$shallowSimple:[{label:"toolbarRange1Month",ariaLabel:"toolbarRange1MonthAria",value:Mp},{label:"toolbarRange3Months",ariaLabel:"toolbarRange3MonthsAria",value:3*Mp},{label:"toolbarRange6Months",ariaLabel:"toolbarRange6MonthsAria",value:6*Mp},{label:"toolbarRangeYearToDate",ariaLabel:"toolbarRangeYearToDateAria",value:(e,t)=>[new Date(`${new Date(t).getFullYear()}-01-01`).getTime(),void 0]},{label:"toolbarRange1Year",ariaLabel:"toolbarRange1YearAria",value:JO},{label:"toolbarRangeAll",ariaLabel:"toolbarRangeAllAria",value:void 0}]}}}};import{_ModuleSupport as Qx}from"ag-charts-community";var Jx=class xr extends Qx.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.activeSections=new Set,this.sectionButtons={annotations:[],chartToolbar:[]},this.container=this.ctx.domManager.addChild("canvas-overlay","shared-toolbar"),this.container.role="presentation"}getSharedToolbar(t){return this.sharedToolbar||this.createSharedToolbar(),t==="chartToolbar"&&this.sharedToolbar&&this.sharedToolbar.setAriaLabelId("ariaLabelFinancialCharts"),this.toolbarWithSection(t)}createSharedToolbar(){this.sharedToolbar=new Qx.Toolbar(this.ctx,"ariaLabelAnnotationsToolbar","vertical"),this.sharedToolbar.addClass("ag-charts-shared-toolbar"),this.container.append(this.sharedToolbar.getElement()),this.cleanup.register(()=>{this.sharedToolbar&&(this.sharedToolbar.getElement().remove(),this.sharedToolbar.destroy(),this.sharedToolbar=void 0)})}toolbarWithSection(t){const i=this.sharedToolbar,o={layout:(s,a)=>{if(this.firstLayoutSection!=null&&this.firstLayoutSection!==t&&this.activeSections.has(this.firstLayoutSection))return;this.firstLayoutSection=t;const n=i.getBounds().width;i.setBounds({x:s.x,y:s.y,width:n}),s.shrink({left:n+i.horizontalSpacing+(a??0)})},addToolbarListener:(s,a)=>i.addToolbarListener(s,n=>{const r=this.getSectionIndex(t,n.button.index);if(r<0)return;const l={...n,button:this.sectionButtons[t][r]};a(l)}),updateButtons:s=>{this.sectionButtons[t]=s;const a=xr.SECTION_ORDER.flatMap(n=>this.sectionButtons[n]);i.updateButtons(a)},updateButtonByIndex:(s,a)=>{i.updateButtonByIndex(this.getIndex(t,s),a)},toggleActiveButtonByIndex:s=>{i.toggleActiveButtonByIndex(this.getIndex(t,s))},toggleButtonEnabledByIndex:(s,a)=>{i.toggleButtonEnabledByIndex(this.getIndex(t,s),a)},setHidden:s=>{s?this.activeSections.delete(t):this.activeSections.add(t);let a=0;for(const n of xr.SECTION_ORDER){if(n!==t){a+=this.sectionButtons[n].length;continue}for(const r of this.sectionButtons[t].keys())i.setButtonHiddenByIndex(a+r,s)}},destroy:()=>{o.setHidden(!0),this.activeSections.size===0&&this.destroy()},clearActiveButton:i.clearActiveButton.bind(i),addListener:i.addListener.bind(i),removeListener:i.removeListener.bind(i)};return o.setHidden(!1),o}getIndex(t,i){let o=0;for(const s of xr.SECTION_ORDER){if(s===t)return o+i;o+=this.sectionButtons[s].length}return-1}getSectionIndex(t,i){let o=0;for(const s of xr.SECTION_ORDER){if(s===t)return i>=o+this.sectionButtons[t].length?-1:i-o;o+=this.sectionButtons[s].length}return-1}};Jx.SECTION_ORDER=["chartToolbar","annotations"];var t1=Jx,i1={type:"context",contextKey:"sharedToolbar",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new t1(e)};import{_ModuleSupport as o1}from"ag-charts-community";import{_ModuleSupport as Wn}from"ag-charts-community";import{cachedTextMeasurer as Ap,calcLineHeight as s1}from"ag-charts-core";var{ZIndexMap:a1,LayoutElement:n1,Property:Mt,BaseProperties:r1,valueProperty:l1,Group:c1,Label:Gn,Rect:h1,Text:et}=Wn,eS={ohlc:62,candlestick:62,"hollow-candlestick":62,line:96,"step-line":96,hlc:184,"high-low":800},d1={up:"positive",down:"negative"},p1={hlc:"altNeutral"},Ip=class extends r1{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1}};d([Mt],Ip.prototype,"fill",2),d([Mt],Ip.prototype,"fillOpacity",2);var Bt=class extends Wn.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!1,this.openKey=void 0,this.highKey=void 0,this.lowKey=void 0,this.closeKey=void 0,this.volumeKey=void 0,this.title=new Gn,this.positive=new Gn,this.negative=new Gn,this.neutral=new Gn,this.altNeutral=new Gn,this.background=new Ip,this.layoutStyle="block",this.id="status-bar",this.data=void 0,this.layer=new c1({name:"StatusBar",zIndex:a1.STATUS_BAR}),this.labelGroup=this.layer.appendChild(new Wn.TranslatableGroup),this.backgroundNode=this.labelGroup.appendChild(new h1),this.labels=[{label:"O",configuration:2,title:this.labelGroup.appendChild(new et),value:this.labelGroup.appendChild(new et),id:"openValue",key:"openKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"H",configuration:16,title:this.labelGroup.appendChild(new et),value:this.labelGroup.appendChild(new et),id:"highValue",key:"highKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"H",configuration:256,title:this.labelGroup.appendChild(new et),value:this.labelGroup.appendChild(new et),style:"neutral",id:"highValue",key:"highKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"L",configuration:8,title:this.labelGroup.appendChild(new et),value:this.labelGroup.appendChild(new et),id:"lowValue",key:"lowKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"L",configuration:512,title:this.labelGroup.appendChild(new et),value:this.labelGroup.appendChild(new et),style:"neutral",id:"lowValue",key:"lowKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"C",configuration:4,title:this.labelGroup.appendChild(new et),value:this.labelGroup.appendChild(new et),id:"closeValue",key:"closeKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"C",configuration:128,title:this.labelGroup.appendChild(new et),value:this.labelGroup.appendChild(new et),id:"closeValue",key:"closeKey",style:"neutral",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"",configuration:64,title:this.labelGroup.appendChild(new et),value:this.labelGroup.appendChild(new et),style:"neutral",id:"closeValue",key:"closeKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:2,maximumFractionDigits:2})},{label:"Vol",configuration:32,title:this.labelGroup.appendChild(new et),value:this.labelGroup.appendChild(new et),id:"volumeValue",key:"volumeKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:2,maximumFractionDigits:2})}],this.highlightManager=e.highlightManager,this.labelGroup.visible=!1,this.cleanup.register(e.scene.attachNode(this.layer),e.layoutManager.registerElement(n1.Overlay,t=>this.startPerformLayout(t)),e.eventsHub.on("layout:complete",t=>this.onLayoutComplete(t)),e.eventsHub.on("highlight:change",()=>this.updateHighlight()))}async processData(e){if(!this.enabled||this.data==null)return;const t=[];for(const a of this.labels){const{id:n,key:r}=a,l=this[r];l==null?a.domain=void 0:t.push(l1(l,"number",{id:n}))}if(t.length===0)return;const i=Wn.DataSet.wrap(this.data)??Wn.DataSet.empty(),{processedData:o,dataModel:s}=await e.request(this.id,i,{props:t});for(const a of this.labels){const{id:n,key:r}=a;this[r]!=null&&(a.domain=s.getDomain(this,n,"value",o))}}startPerformLayout(e){if(this.labelGroup.translationX=0,this.labelGroup.translationY=0,!this.enabled)return;const{layoutBox:t}=e,i=4,o=12,s=0,a=8;this.labelGroup.translationY=t.y+s;const n=Math.max(this.title.fontSize,this.positive.fontSize,this.negative.fontSize),r=s1(n),l=eS[this.getChartType()]??0;let c=0,h,p="alphabetic";if(this.layoutStyle==="block")t.shrink(s+r+a,"top"),h=n+(r-n)/2;else{const{title:u}=this.ctx.chartService;if(p="top",h=s+u.padding,u.enabled){const g=u.node.getBBox();c=g.x+g.width+o}else c=u.padding}for(const{label:u,configuration:g,title:y,value:f,domain:x,formatter:S}of this.labels){if(x==null||!(l&g)){y.visible=!1,f.visible=!1;continue}const v=Ap(this.positive),m=Ap(this.negative),b=Math.max(v.textWidth(S.format(x[0])),v.textWidth(S.format(x[1])),m.textWidth(S.format(x[0])),m.textWidth(S.format(x[1])));y.visible=!0,f.visible=!0;const k=Ap(this.title).measureLines(u);y.setFont(this.title),y.fill=this.title.color,y.text=u,y.textBaseline=p,y.y=h,y.x=c,c+=k.width+i,f.textBaseline=p,f.y=h,f.x=c,c+=b+o}this.backgroundNode.x=0,this.backgroundNode.y=0,this.backgroundNode.width=c-o,this.backgroundNode.height=r+s+a,this.backgroundNode.fill=this.background.fill,this.backgroundNode.fillOpacity=this.background.fillOpacity}onLayoutComplete(e){this.labelGroup.translationX=e.series.rect.x,this.updateHighlight()}updateHighlight(){if(!this.enabled)return;const e=this.highlightManager.getActiveHighlight(),t=e?.datum??this.data?.at(-1);if(t==null){this.labelGroup.visible=!1;return}this.labelGroup.visible=!0;const i=e?.itemId;let o=i==null?void 0:d1[i];o==null&&this.openKey!=null&&this.closeKey!=null&&(t[this.openKey]new Bt(e),themeTemplate:{statusBar:{enabled:!1,layoutStyle:o1.ThemeSymbols.DEFAULT_CAPTION_LAYOUT_STYLE,title:{color:{$ref:"textColor"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},positive:{color:{$palette:"up.stroke"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},negative:{color:{$palette:"down.stroke"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},neutral:{color:{$palette:"neutral.stroke"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},background:{fill:{$ref:"chartBackgroundColor"},fillOpacity:.5},altNeutral:{color:"gray",fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}}}}};import{_ModuleSupport as tS}from"ag-charts-community";import{AsyncAwaitQueue as g1,Logger as iS,arraysEqual as Lp,isDate as y1,isDefined as f1,isFiniteNumber as ic,unique as oS}from"ag-charts-core";import{clamp as m1,isNumberEqual as sS}from"ag-charts-core";var ui=0,tt=1,Bs=tt-ui,aS="end",nS="middle",rS=300,oc=(e,t=ui,i=tt)=>m1(t,e,i);function Tp(){return{x:{min:ui,max:tt},y:{min:ui,max:tt}}}function it(e){return e.x.max-e.x.min}function Yt(e){return e.y.max-e.y.min}function lS(e,t){return sS(e.min,t.min)&&sS(e.max,t.max)}function Kn(e,t){return lS(e.x,t.x)&&lS(e.y,t.y)}function sc(e){return Kn(e,Tp())}function ht(e){return{x:{min:e?.x?.min??ui,max:e?.x?.max??tt},y:{min:e?.y?.min??ui,max:e?.y?.max??tt}}}function vo(e,t,i){if(!e)return{x:0,y:0};const o=oc(t-e.x,0,e.x+e.width),s=oc(i-e.y,0,e.y+e.height),a=1/e.width*o,n=1-1/e.height*s;return{x:oc(a),y:oc(n)}}function zs(e,t,i){return{x:{min:e.x.min+t,max:e.x.max+t},y:{min:e.y.min+i,max:e.y.max+i}}}function ac(e,t,i){return{x:{min:e.x.min,max:e.x.min+it(e)*t},y:{min:e.y.min,max:e.y.min+Yt(e)*i}}}function cS(e,t,i){const o=it(e),s=Yt(e),a=e.x.min+o/2,n=e.y.min+s/2;return{x:{min:a-o*t/2,max:a+o*t/2},y:{min:n-s*i/2,max:n+s*i/2}}}function Ut(e,t,i,o){const{min:s,max:a}=t,n=s+(a-s)/2,r=e.max-e.min;switch(i){case"start":return{min:s,max:t.min+r};case"end":return{min:t.max-r,max:a};case"middle":return{min:n-r/2,max:n+r/2};case"pointer":return x1(e,t,o??n);default:return{min:s,max:a}}}function x1(e,t,i){const o=e.max-e.min,s=t.max-t.min,a=i*(1-(s-o)),n=i-a,r=e.min+n,l=e.max+n;return{min:r,max:l}}function S1(e,t,i){return{x:{min:e.x.min*t,max:e.x.max*t},y:{min:e.y.min*i,max:e.y.max*i}}}function gi(e){return{x:nc(e.x),y:nc(e.y)}}function nc(e){const t=e.max-e.min;let i=e.max>tt?tt-t:e.min,o=e.mino?.valueOf()),i.map(o=>o?.valueOf())):!Lp(t,i)}var Jo=class extends b1{constructor(e){super(),this.moduleContext=e,this.enabled=!1,this.axes="x",this.nodeInteraction=!0,this.zoom=!0,this.domainMode="key",this.domainSync=new g1}updateSiblings(e){const{syncManager:t}=this.moduleContext;for(const i of t.getGroupSiblings(e??this.groupId))Li("ChartSync.updateSiblings()",i.id,i),this.updateChart(i)}updateChart(e,t=rc.PROCESS_DOMAIN){Li("ChartSync.updateChart()",e.id,rc[t],e),t===rc.PROCESS_DOMAIN?e.ctx.updateService.update(t,{forceNodeDataRefresh:!0}):e.ctx.updateService.update(t)}enabledZoomSync(){const{eventsHub:e}=this.moduleContext;this.disableZoomSync?.(),this.disableZoomSync=e.on("zoom:change",this.onZoom.bind(this))}onZoom(){const{syncManager:e}=this.moduleContext;for(const t of e.getGroupSiblings(this.groupId)){if(!t.modulesManager.getModule("sync")?.zoom)continue;const i=t.modulesManager.getModule("zoom");if(!i)continue;const o=this.prepareZoomUpdate();Li("ChartsSyncManager.enabledZoomSync()",t.id,o),i.updateSyncZoom(o)}}enabledNodeInteractionSync(){this.disableNodeInteractionSync?.(),this.disableNodeInteractionSync=this.moduleContext.eventsHub.on("highlight:change",this.onHighlightChange.bind(this))}onHighlightChange(e){const{syncManager:t}=this.moduleContext;if(e.callerId.endsWith("-sync"))return;Li("ChartSync.onHighlightChange()",e);const i=e.currentHighlight?.series,[o]=wp(this.axes),s=o===Fs.X?Fs.Y:Fs.X,[a,n]=i?hS(i,o,s):[],r=Cn(e.currentHighlight);let l=a?.[0]?r?.[a[0]]:void 0,c=!1;if(y1(l)&&(c=!0,l=l.getTime()),!e.currentHighlight?.datum){for(const p of t.getGroupSiblings(this.groupId))p.modulesManager.getModule("sync")?.nodeInteraction&&(p.ctx.highlightManager.updateHighlight(`${p.id}-sync`),p.ctx.tooltipManager.removeTooltip(`${p.id}-sync`));return}const h=t.getGroupSyncMode(this.groupId)==="multi-series";this.findMatchingHighlightNodes(o,s,h?n:[],c,l,e)}findMatchingHighlightNodes(e,t,i,o,s,a){const{syncManager:n}=this.moduleContext;Li("ChartSync.findMatchingHighlightNodes()",{mainDirection:e,secondaryKeys:i});for(const r of n.getGroupSiblings(this.groupId)){if(!r.modulesManager.getModule("sync")?.nodeInteraction)continue;let l=!1;for(const c of r.axes){if(!Cp.is(c)||c.direction!==e)continue;const h=r.series.filter(p=>{if(!p.visible)return!1;if(i.length>0){const[,u]=hS(p,e,t);return i.every(g=>u.includes(g))}return!0}).map(this.findMatchingNodes(c,e,o,s)).filter(f1);if(h.length===1&&h[0]?.nodeDatum!==r.ctx.highlightManager.getActiveHighlight()){this.dispatchHighlightUpdate(r,h[0].nodeDatum),l=!0;break}}l||(Li("ChartSync.findMatchingHighlightNodes() - no matching nodes",r.id,a),this.dispatchHighlightUpdate(r))}}findMatchingNodes(e,t,i,o){return s=>{const a=s.getKeys(e.direction);if(e.keys.length&&!e.keys.some(p=>a.includes(p)))return;const n=s.contextNodeData?.nodeData??[];if(!n?.length)return;const r=n[0],l=`${t}Key`;if(!M1(r,l))return;const c=r[l],h=n.find(p=>{const u=p.datum[c];return i?u.getTime()===o:u===o});return h?{series:s,nodeDatum:h}:null}}dispatchHighlightUpdate(e,t){Li("ChartSync.dispatchHighlightUpdate()",e.id,t),e.ctx.highlightManager.updateHighlight(`${e.id}-sync`,t);const i=t?.series.tooltipEnabled??e.tooltip.enabled;if(t&&i){const o=e.seriesAreaBoundingBox,s=o.x+(t.midPoint?.x??t.point?.x??0),a=o.y+(t.midPoint?.y??t.point?.y??0),n=D1.makeTooltipMeta({type:"pointermove",canvasX:s,canvasY:a},t.series,t,void 0);e.ctx.tooltipManager.updateTooltip(`${e.id}-sync`,n,e.getTooltipContent(t.series,t.datumIndex,t,"tooltip"))}else e.ctx.tooltipManager.removeTooltip(`${e.id}-sync`);this.updateChart(e,rc.SERIES_UPDATE)}async getSyncedDomain(e){if(!Cp.is(e)||this.axes!=="xy"&&this.axes!==e.direction)return;const{groupState:t,directionDomains:i,domainsByKey:o,positionDomains:s}=this.updateDomainState(e);return this.validateAxis(e,t),await this.waitForDomainsToBeReady(),this.domainMode==="position"?this.calculateDerivedDomain(e,s):this.domainMode==="direction"||e.keys.length===0?this.calculateDerivedDomain(e,i):this.calculateKeyDerivedDomain(e,o)}updateDomainState(e){var t,i,o,s,a;const{syncManager:n}=this.moduleContext,r=n.getChart().id,l=e.id,c=n.getGroupState(this.groupId);if(!c)throw new Error("AG Charts - no GroupState for groupId: "+this.groupId);const h=c.domains??(c.domains={}),p=h[t=e.direction]??(h[t]={derived:[],sources:{},dirty:!0}),u=(i=p.sources)[r]??(i[r]={});u[l]=e.dataDomain.domain,p.dirty=!0;const g=c.domainsByKey??(c.domainsByKey={});for(const S of e.keys??[]){const v=g[S]??(g[S]={derived:[],sources:{},dirty:!0}),m=(o=v.sources)[r]??(o[r]={});m[l]=e.dataDomain.domain,v.dirty=!0}const y=c.domainsByPosition??(c.domainsByPosition={}),f=y[s=e.position]??(y[s]={derived:[],sources:{},dirty:!0}),x=(a=f.sources)[r]??(a[r]={});return x[l]=e.dataDomain.domain,f.dirty=!0,{groupState:c,directionDomains:p,domainsByKey:g,positionDomains:f}}validateAxis(e,t){const i=this.moduleContext.syncManager.getGroupSyncMode(this.groupId)==="multi-series";wp(this.axes).includes(e.direction)&&(i?this.validateMultiSeries(e,t):this.validateSingleSeries(e,t))}validateMultiSeries(e,t){const{min:i,max:o,nice:s,reverse:a}=e,n=new Set(e.boundSeries.flatMap(r=>r.getKeys(e.direction)));for(const r of t.members){const{axes:l,modulesManager:c}=r,h=wp(c.getModule("sync")?.axes),p=l.filter(g=>h.includes(g.direction)).filter(g=>g.boundSeries.some(y=>y.getKeys(g.direction).some(f=>n.has(f))));if(p.length===0)continue;const[u]=p;if(u.min!==i||u.max!==o||u.nice!==s||u.reverse!==a){iS.warnOnce("To allow synchronization, ensure that all synchronized axes with matching keys have matching min, max, nice, and reverse properties."),this.enabled=!1;return}}}validateSingleSeries(e,t){const i=t.members,[{axes:o}]=i,{direction:s,min:a,max:n,nice:r,reverse:l}=e;for(const c of o)if(s===c.direction&&(r!==c.nice||l!==c.reverse||a!==c.min&&(ic(a)||ic(c.min))||n!==c.max&&(ic(n)||ic(c.max)))){iS.warnOnce("To allow synchronization, ensure that all charts have matching min, max, nice, and reverse properties on the synchronized axes."),this.enabled=!1;return}}calculateDerivedDomain(e,t){if(!t.dirty)return t.derived;const i=t.derived;return t.derived=oS(Object.values(t.sources).map(o=>Object.values(o)).flat(2)),Np.is(e.scale)&&(t.derived=lc(t.derived)),t.dirty=!1,dS(e.scale,i,t.derived)&&(Li(e.id,"updated",e.keys,{before:i,after:t.derived}),this.updateSiblings()),t.derived}calculateKeyDerivedDomain(e,t){let i=[],o=[],s=!1;for(const a of e.keys??[]){const n=t[a],r=n.derived;if(i.push(...r),!n.dirty){o.push(...n.derived);continue}n.derived=oS(Object.values(n.sources).map(l=>Object.values(l)).flat(2)),Np.is(e.scale)&&(n.derived=lc(n.derived)),o.push(...n.derived),n.dirty=!1,s||(s=!Lp(r,n.derived))}return Np.is(e.scale)&&(i=lc(i),o=lc(o)),s&&dS(e.scale,i,o)&&(Li(e.id,"updated",e.keys,{before:i,after:o}),this.updateSiblings()),o}removeAxis(e){if(!Cp.is(e)||this.axes!=="xy"&&this.axes!==e.direction)return;const{syncManager:t}=this.moduleContext,i=t.getGroupState(this.groupId),o=t.getChart().id,s=e.id;delete i?.domains?.[e.direction]?.sources?.[o]?.[s];for(const a of e.keys??[])delete i?.domainsByKey?.[a]?.sources?.[o]?.[s];delete i?.domainsByPosition?.[e.position]?.sources?.[o]?.[s]}async waitForDomainsToBeReady(){const{syncManager:e}=this.moduleContext;let t=0;for(;e.getGroupMembers(this.groupId).some(i=>i.syncStatus==="init");)Li("ChartSync.waitForDomainsToBeReady() - waiting for all domains to be calculated",this.groupId),await this.domainSync.await(),t++;t>0&&Li("ChartSync.waitForDomainsToBeReady() - waited for",t,"iterations"),this.domainSync.notify()}prepareZoomUpdate(){const{zoomManager:e}=this.moduleContext,t=e.getZoom();return this.axes==="x"?delete t?.y:this.axes==="y"&&delete t?.x,ht(t)}onEnabledChange(){const{syncManager:e}=this.moduleContext;this.enabled?e.subscribe(this.groupId):e.unsubscribe(this.groupId),this.updateSiblings(),this.onNodeInteractionChange(),this.onZoomChange()}onGroupIdChange(e,t){if(!this.enabled||e===t)return;const{syncManager:i}=this.moduleContext;i.unsubscribe(t),i.subscribe(e),this.updateSiblings(t),this.updateSiblings(e)}onAxesChange(){if(!this.enabled)return;const{syncManager:e}=this.moduleContext;this.updateChart(e.getChart())}onNodeInteractionChange(){this.enabled&&this.nodeInteraction?this.enabledNodeInteractionSync():this.disableNodeInteractionSync?.()}onZoomChange(){this.enabled&&this.zoom?this.enabledZoomSync():this.disableZoomSync?.()}destroy(){const{syncManager:e}=this.moduleContext;e.unsubscribe(this.groupId),this.updateSiblings(),this.disableZoomSync?.()}};Jo.className="Sync",d([Ha,Fa(e=>e.onEnabledChange())],Jo.prototype,"enabled",2),d([Ha,Fa((e,t,i)=>e.onGroupIdChange(t,i))],Jo.prototype,"groupId",2),d([Ha,Fa(e=>e.onAxesChange())],Jo.prototype,"axes",2),d([Ha,Fa(e=>e.onNodeInteractionChange())],Jo.prototype,"nodeInteraction",2),d([Ha,Fa(e=>e.onZoomChange())],Jo.prototype,"zoom",2),d([Ha,Fa(e=>e.onAxesChange())],Jo.prototype,"domainMode",2);var A1={type:"root",optionsKey:"sync",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new Jo(e),themeTemplate:{sync:{enabled:!1}}};import{_ModuleSupport as ji}from"ag-charts-community";import{debounce as pS,entries as Pp,roundTo as I1}from"ag-charts-core";import{_ModuleSupport as Op}from"ag-charts-community";var{Property:uS}=Op,gS="#2196f3",L1="#8a8a8a",cc=class extends Op.Rect{constructor(){super(...arguments),this.fill=gS,this.fillOpacity=.2,this.zIndex=Op.ZIndexMap.ZOOM_SELECTION}updateValid(){this.fill=gS}updateInvalid(){this.fill=L1}};cc.className="ZoomRect",d([uS],cc.prototype,"fill",2),d([uS],cc.prototype,"fillOpacity",2);import{_ModuleSupport as _p}from"ag-charts-community";var T1=class{update(e,t,i,o,s,a){return this.oldZoom??(this.oldZoom=ht(t===_p.ChartAxisDirection.X?{...s,x:a}:{...s,y:a})),this.updateCoords(e.offsetX,e.offsetY),this.updateZoom(t,i,o)}stop(){this.coords=void 0,this.oldZoom=void 0}updateCoords(e,t){this.coords?(this.coords.x2=e,this.coords.y2=t):this.coords={x1:e,y1:t,x2:e,y2:t}}updateZoom(e,t,i){const{coords:o,oldZoom:s}=this;let a=ht(s);if(!o||!s)return e===_p.ChartAxisDirection.X?a.x:a.y;const n=vo(i,o.x1,o.y1),r=vo(i,o.x2,o.y2);if(e===_p.ChartAxisDirection.X){const c=(r.x-n.x)*it(s);return a.x.max+=c,a.x=Ut(a.x,s.x,t,n.x),a=gi(a),a.x}const l=(r.y-n.y)*Yt(s);return a.y.max-=l,a.y=Ut(a.y,s.y,t,n.y),a=gi(a),a.y}},C1=class{constructor(e,t,i,o,s,a,n,r){this.eventsHub=e,this.contextMenuRegistry=t,this.zoomManager=i,this.getModuleProperties=o,this.canResetZoom=s,this.getRect=a,this.updateZoom=n,this.isZoomValid=r}registerActions(e){const{contextMenuRegistry:t}=this,i=e?"show":"hide";if(t.toggle("zoom-to-cursor",i),t.toggle("pan-to-cursor",i),t.toggle("reset-zoom",i),!e)return;t.builtins.items["zoom-to-cursor"].action=this.onZoomToHere.bind(this),t.builtins.items["pan-to-cursor"].action=this.onPanToHere.bind(this),t.builtins.items["reset-zoom"].action=this.onResetZoom.bind(this);const o=n=>{const r=this.getRect();if(!r)return!0;const l=vo(r,n.x,n.y);return this.iterateFindNextZoomAtPoint(l)!=null},s=()=>!Kn(ht(this.zoomManager.getZoom()),Tp()),a=this.eventsHub.on("context-menu:setup",n=>{t.builtins.items["zoom-to-cursor"].enabled=o(n),t.builtins.items["pan-to-cursor"].enabled=s(),t.builtins.items["reset-zoom"].enabled=this.canResetZoom()});return()=>{a(),t.toggle("zoom-to-cursor","hide"),t.toggle("pan-to-cursor","hide"),t.toggle("reset-zoom","hide")}}computeOrigin(e){const t=this.getRect(),{enabled:i}=this.getModuleProperties();if(!i||!t||!e?.target||!(e instanceof MouseEvent))return;const o={x:0,y:0,width:t.width,height:t.height};return vo(o,e.offsetX,e.offsetY)}onZoomToHere({event:e}){const t=this.computeOrigin(e);if(!t)return;const i=this.iterateFindNextZoomAtPoint(t);i!=null&&this.updateZoom(i)}onPanToHere({event:e}){const t=this.computeOrigin(e);if(!t)return;const i=ht(this.zoomManager.getZoom()),o=it(i),s=Yt(i),a=t.x*o,n=t.y*s,r=Bs/2;let l={x:{min:t.x-r,max:t.x+r},y:{min:t.y-r,max:t.y+r}};l=cS(l,o,s),l=zs(l,i.x.min-t.x+a,i.y.min-t.y+n),this.updateZoom(gi(l))}onResetZoom(e){this.zoomManager.resetZoom("zoom")}iterateFindNextZoomAtPoint(e){const{scrollingStep:t}=this.getModuleProperties();for(let i=t;i<=1-t;i+=t){const o=this.getNextZoomAtPoint(e,i);if(this.isZoomValid(o))return o}}getNextZoomAtPoint(e,t){const{isScalingX:i,isScalingY:o}=this.getModuleProperties(),s=ht(this.zoomManager.getZoom()),a=e.x*it(s),n=e.y*Yt(s),r=Bs/2;let l={x:{min:e.x-r,max:e.x+r},y:{min:e.y-r,max:e.y+r}};return l=cS(l,i?it(s)*t:Bs,o?Yt(s)*t:Bs),l=zs(l,s.x.min-e.x+a,s.y.min-e.y+n),gi(l)}};import{_ModuleSupport as yS}from"ag-charts-community";import{boxEmpty as N1}from"ag-charts-core";var{ChartAxisDirection:fS}=yS,w1=class{constructor(e){this.axesHandlers=e,this.axes=[],this.overlappingAxisIds=new Set}destroy(){for(const e of this.axes)e.div.destroy()}update(e,t,i,o){this.seriesRect=o;for(const c of this.axes)c.div.setHidden(!e&&!t);if(!e&&!t)return;const{X:s,Y:a}=fS,n=[...i.axisManager.getAxisContext(s),...i.axisManager.getAxisContext(a)],{removed:r,added:l}=this.diffAxisIds(n);r.length>0&&(this.axes=this.axes.filter(c=>r.includes(c.axisId)?(c.div.destroy(),this.overlappingAxisIds.delete(c.axisId),this.hoveredAxisId===c.axisId&&(this.hoveredAxisId=void 0),this.activeAxisId===c.axisId&&(this.activeAxisId=void 0),!1):!0));for(const c of l){const{axisId:h,direction:p}=c;this.axes.push(this.initAxis(i,h,this.axesHandlers,p))}for(const c of this.axes){const p=n.find(u=>u.axisId===c.axisId).getCanvasBounds();c.div.setHidden(N1(p)),p==null?c.bounds=void 0:(c.div.setBounds(p),c.bounds=new yS.BBox(p.x,p.y,p.width,p.height))}this.updateOverlappingAxisPointerEvents(e,t)}setAxisCursor(e){this.cursor=e;for(const t of this.axes)t.div.setCursor(this.getCursor(t.direction))}toggleAxisDraggingCursor(e,t){for(const i of this.axes)i.direction===e&&i.div.setCursor(t?this.getCursor(e):void 0)}updateOverlappingAxisPointerEvents(e,t){this.overlappingAxisIds.clear();const i=(e||t)&&this.seriesRect;for(const o of this.axes){if(!i){o.div.setPointerEvents(void 0);continue}!!o.bounds?.collidesBBox(this.seriesRect)?(this.overlappingAxisIds.add(o.axisId),o.div.setPointerEvents("none")):o.div.setPointerEvents(void 0)}this.cleanupAxisState()}cleanupAxisState(){this.hoveredAxisId&&!this.overlappingAxisIds.has(this.hoveredAxisId)&&(this.hoveredAxisId=void 0),this.activeAxisId&&!this.overlappingAxisIds.has(this.activeAxisId)&&(this.activeAxisId=void 0)}pickAxisAtPoint(e,t){for(const i of this.axes)if(this.overlappingAxisIds.has(i.axisId)&&i.bounds?.containsPoint(e,t))return{axisId:i.axisId,direction:i.direction}}setHoveredAxis(e){this.overlappingAxisIds.has(e)&&(this.hoveredAxisId=e)}clearHoveredAxis(){this.activeAxisId||(this.hoveredAxisId=void 0)}beginDelegatedAxisDrag(e){return this.overlappingAxisIds.has(e)?(this.activeAxisId=e,this.hoveredAxisId=void 0,!0):!1}endDelegatedAxisDrag(e){this.activeAxisId===e&&(this.activeAxisId=void 0),this.hoveredAxisId=void 0}hasOverlappingAxes(){return this.overlappingAxisIds.size>0}getHoveredAxis(){if(!this.hoveredAxisId)return;const e=this.axes.find(t=>t.axisId===this.hoveredAxisId);return e?{axisId:e.axisId,direction:e.direction}:void 0}getCursor(e){return this.cursor?this.cursor:e===fS.X?"ew-resize":"ns-resize"}initAxis(e,t,i,o){const s="afterend",a=e.proxyInteractionService.createProxyElement({type:"region",domManagerId:t,where:s});return a.setCursor(this.getCursor(o)),a.addListener("drag-start",n=>{n.device==="touch"&&n.sourceEvent.preventDefault(),this.activeAxisId=t,i.onAxisDragStart(o)}),a.addListener("drag-move",n=>i.onAxisDragMove(t,o,n)),a.addListener("drag-end",()=>{this.activeAxisId=void 0,this.hoveredAxisId=void 0,i.onAxisDragEnd()}),a.addListener("dblclick",()=>i.onAxisDoubleClick(t,o)),a.addListener("wheel",n=>i.onAxisWheel(t,o,n)),{axisId:t,div:a,direction:o}}diffAxisIds(e){const t=this.axes.map(a=>a.axisId),i=e.map(a=>a.axisId),o=t.filter(a=>!i.includes(a)),s=e.filter(a=>!t.includes(a.axisId));return{removed:o,added:s}}};import{_ModuleSupport as mS}from"ag-charts-community";import{entries as P1,getWindow as O1}from"ag-charts-core";var xS=16,_1={off:1,short:.01,long:.002},R1=class{constructor(){this.deceleration=1,this.zoomCoordsHistoryIndex=0,this.coordsHistory=[]}get decelerationValue(){const{deceleration:e}=this;return Math.max(typeof e=="number"?e:_1[e]??1,1e-4)}addListener(e,t){return this.onUpdate=t,()=>{this.onUpdate=void 0}}stopInteractions(){this.inertiaHandle!=null&&(cancelAnimationFrame(this.inertiaHandle),this.inertiaHandle=void 0)}update(e){this.updateCoords(e.currentX,e.currentY);const{x1:t=0,y1:i=0,x2:o=0,y2:s=0}=this.coords??{};this.onUpdate?.({type:"update",deltaX:this.isPanningX()?t-o:0,deltaY:this.isPanningY()?i-s:0})}start(e){this.direction=e,this.coordsMonitorTimeout=setInterval(this.recordCurrentZoomCoords.bind(this),16)}stop(){const{coordsHistory:e}=this;let t=0,i=0,o=0;if(e.length>0){const s=this.zoomCoordsHistoryIndex%xS;let a=s-1;a<0&&(a=e.length-1);let n=s;n>=e.length&&(n=0);const r=e[a],l=e[n];t=this.isPanningX()?r.x-l.x:0,i=this.isPanningY()?r.y-l.y:0,o=r.t-l.t}if(this.coords=void 0,this.direction=void 0,clearInterval(this.coordsMonitorTimeout),this.coordsMonitorTimeout=void 0,this.zoomCoordsHistoryIndex=0,this.coordsHistory.length=0,o>0&&this.decelerationValue<1){const s=t/o,a=i/o,n=Math.hypot(s,a),r=Math.atan2(a,s),l=performance.now();this.inertiaHandle=O1().requestAnimationFrame(c=>{this.animateInertia(c,c,l,n,r)})}}recordCurrentZoomCoords(){const{coords:e,coordsHistory:t,zoomCoordsHistoryIndex:i}=this;if(!e)return;const{x2:o,y2:s}=e,a=Date.now();t[i%xS]={x:o,y:s,t:a},this.zoomCoordsHistoryIndex+=1}animateInertia(e,t,i,o,s){const a=1-this.decelerationValue,n=-o/Math.log(a),r=o*(a**(t-i)-1)/Math.log(a),l=o*(a**(e-i)-1)/Math.log(a);this.onUpdate?.({type:"update",deltaX:this.isPanningX()?-Math.cos(s)*(l-r):0,deltaY:this.isPanningY()?-Math.sin(s)*(l-r):0}),!(l>=n-1)&&(this.inertiaHandle=requestAnimationFrame(c=>{this.animateInertia(c,e,i,o,s)}))}updateCoords(e,t){this.coords?this.coords={x1:this.coords.x2,y1:this.coords.y2,x2:e,y2:t}:this.coords={x1:e,y1:t,x2:e,y2:t}}isPanningX(){return this.direction==null||this.direction===mS.ChartAxisDirection.X}isPanningY(){return this.direction==null||this.direction===mS.ChartAxisDirection.Y}translateZooms(e,t,i,o){const s=vo(e,e.x+Math.abs(i),e.y+e.height-Math.abs(o)),a=Math.sign(i)*s.x,n=-Math.sign(o)*s.y,r={};for(const[l,{direction:c,zoom:h}]of P1(t)){if(h&&h.min===ui&&h.max===tt)continue;let p=ht({[c]:h});p=gi(zs(p,a*it(p),n*Yt(p))),r[l]={direction:c,zoom:p[c]}}return r}};import{_ModuleSupport as E1}from"ag-charts-community";import{entries as B1}from"ag-charts-core";var z1=200,F1=class{update(e,t,i,o){const s=e.deltaX*t*z1;return this.translateZooms(i,o,s)}translateZooms(e,t,i){const o={},s=vo(e,e.x+Math.abs(i),0),a=i<0?-s.x:s.x;for(const[n,{direction:r,zoom:l}]of B1(t)){if(r!==E1.ChartAxisDirection.X)continue;let c=ht({x:l});c=gi(zs(c,a*it(c),0)),o[n]={direction:r,zoom:c.x}}return o}};import{_ModuleSupport as SS}from"ag-charts-community";import{entries as H1}from"ag-charts-core";var V1=class{updateAxes(e,t,i,o){const s=e.sourceEvent,a={},{anchorPointX:n,anchorPointY:r,isScalingX:l,isScalingY:c,scrollingStep:h}=t,p=vo(i,s.offsetX??s.clientX,s.offsetY??s.clientY);for(const[u,{direction:g,zoom:y}]of H1(o)){if(y==null)continue;let f={...y};const x=h*e.deltaY*(y.max-y.min);if(g===SS.ChartAxisDirection.X&&l)f.max+=x,f=Ut(f,y,n,p.x);else if(g===SS.ChartAxisDirection.Y&&c)f.max+=x,f=Ut(f,y,r,p.y);else continue;f.max0&&this.rect.height>0}updateCoords(e,t,i,o){if(!this.coords){this.coords={x1:e,y1:t,x2:e,y2:t};return}const{coords:s}=this;if(s.x2=e,s.y2=t,!o)return;const{isScalingX:a,isScalingY:n,keepAspectRatio:r}=i,l=this.getNormalisedDimensions();if(r&&a&&n){const c=o.width/o.height;s.y2r&&sui;break;case"pan-end":o=e.x.maxui;break;case"pan-right":o=e.x.maxi.find(v=>v.identifier===r[S].identifier)),c=r[0].normalX,h=r[1].normalX,p=l[0].clientX,u=l[1].clientX,g=r[0].normalY,y=r[1].normalY,f=s+n-l[0].clientY,x=s+n-l[1].clientY;return this.twitchTolerantZoomPan4(c,h,p,u,g,y,f,x,o,s,a,n)}end(e){const t=Array.from(e.sourceEvent.targetTouches).map(i=>i.identifier);return!t.includes(this.touchStart.origins[0].identifier)||!t.includes(this.touchStart.origins[1].identifier)}twitchTolerantZoomPan4(e,t,i,o,s,a,n,r,l,c,h,p){const{initialZoom:u,previous:g}=this,y=kS(e,t,i,o,g,"a1","a2",l,h,u.x),f=kS(s,a,n,r,g,"b1","b2",c,p,u.y);return{x:y,y:f}}};function kS(e,t,i,o,s,a,n,r,l,c){if(e==t){const h=hc(c,i,r,l),p=hc(c,o,r,l),u=(h+p)/2,g=(e-u)/Vs;return{min:c.min+g,max:c.max+g}}else{const h=s[a],p=s[n];return Math.abs(i-h)+Math.abs(o-p)<=1?(i=h,o=p):(s[a]=i,s[n]=o),e_(e,t,i,o,r,l)}}var{ActionOnSet:Ws,ChartAxisDirection:zt,ChartUpdateType:Ep,Property:Te,InteractionState:$n,ProxyProperty:i_}=ji,dc=e=>I1(e,10),Wa="zoom-cursor",jn="zoom-tooltip",Bp=class extends ji.BaseProperties{constructor(e){super(),this.onChange=e,this.enabled=!1,this.padding=0}};d([Te,Ws({changeValue(e){this.onChange({enabled:e,padding:this.padding})}})],Bp.prototype,"enabled",2),d([Te,Ws({changeValue(e){this.onChange({enabled:this.enabled,padding:e})}})],Bp.prototype,"padding",2);var _e=class extends ji.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!1,this.enableAxisDragging=!0,this.enableAxisScrolling=!1,this.enableDoubleClickToReset=!0,this.enablePanning=!0,this.enableScrolling=!0,this.enableSelecting=!1,this.enableTwoFingerZoom=!0,this.panKey="alt",this.axes="x",this.scrollingStep=Bs/10,this.keepAspectRatio=!1,this.minVisibleItems=2,this.anchorPointX=aS,this.anchorPointY=nS,this.autoScaling=new Bp(i=>{this.ctx.zoomManager.setAutoScaleYAxis(i.enabled,i.padding)}),this.axisDraggingMode="zoom",this.canResetZoom=i=>(i??(i=this.getZoom()),!Kn(i,this.getResetZoom())),this.buttons=new Va(this.ctx,this.getModuleProperties.bind(this),this.canResetZoom,this.updateZoom.bind(this),this.updateAxisZoom.bind(this),this.resetZoom.bind(this),this.isZoomValid.bind(this)),this.axisDragger=new T1,this.panner=new R1,this.scroller=new V1,this.scrollPanner=new F1,this.twoFingers=new t_,this.deceleration="short",this.dragState=0,this.isState=i=>this.ctx.interactionManager.isState(i),this.destroyContextMenuActions=void 0,this.isFirstWheelEvent=!0,this.debouncedWheelReset=pS(()=>{this.isFirstWheelEvent=!0,this.wasFirstWheelEventZoomCapped=void 0},100),this.previousZoomValid=!0,this.previousAxisZoomValid={[ji.ChartAxisDirection.X]:!0,[ji.ChartAxisDirection.Y]:!0},this.toggleAxisDraggingCursorsDebounced=pS(this.toggleAxisDraggingCursors.bind(this),rS,{leading:!0,trailing:!0});const t=new cc;this.selector=new W1(t,this.getZoom.bind(this),this.isZoomValid.bind(this)),this.contextMenu=new C1(e.eventsHub,e.contextMenuRegistry,e.zoomManager,this.getModuleProperties.bind(this),this.canResetZoom,()=>this.paddedRect,this.updateZoom.bind(this),this.isZoomValid.bind(this)),this.domProxy=new w1({onAxisDragStart:i=>this.onAxisDragStart(i),onAxisDragMove:(i,o,s)=>this.onAxisDragMove(i,o,s),onAxisDragEnd:()=>this.onAxisDragEnd(),onAxisDoubleClick:i=>this.onAxisDoubleClick(i),onAxisWheel:(i,o,s)=>this.onAxisWheel(i,o,s)}),e.widgets.seriesDragInterpreter&&this.cleanup.register(e.widgets.seriesDragInterpreter.events.on("dblclick",i=>this.onSeriesAreaDoubleClick(i)),e.widgets.seriesDragInterpreter.events.on("drag-move",i=>this.onSeriesAreaDragMove(i)),e.widgets.seriesDragInterpreter.events.on("drag-start",i=>this.onSeriesAreaDragStart(i)),e.widgets.seriesDragInterpreter.events.on("drag-end",()=>this.onSeriesAreaDragEnd())),this.cleanup.register(e.scene.attachNode(t),e.eventsHub.on("series-area:hover",i=>this.onSeriesAreaHoverEvent(i)),e.eventsHub.on("series-area:click",i=>this.onSeriesAreaClickEvent(i)),e.eventsHub.on("series:keynav-zoom",i=>this.onNavZoom(i)),e.widgets.seriesWidget.addListener("wheel",i=>this.onWheel(i)),e.widgets.seriesWidget.addListener("touchstart",(i,o)=>this.onTouchStart(i,o)),e.widgets.seriesWidget.addListener("touchmove",(i,o)=>this.onTouchMove(i,o)),e.widgets.seriesWidget.addListener("touchend",i=>this.onTouchEnd(i)),e.widgets.seriesWidget.addListener("touchcancel",i=>this.onTouchEnd(i)),e.updateService.addListener("process-data",i=>this.onProcessData(i)),e.eventsHub.on("layout:complete",i=>this.onLayoutComplete(i)),e.eventsHub.on("zoom:change",i=>this.onZoomChange(i)),e.eventsHub.on("zoom:pan-start",i=>this.onZoomPanStart(i)),this.panner.addListener("update",i=>this.onPanUpdate(i)),()=>this.teardown())}teardown(){this.ctx.zoomManager.setZoomModuleEnabled(!1),this.buttons.destroy(),this.destroyContextMenuActions?.(),this.domProxy.destroy()}onEnabledChange(e){this.ctx.zoomManager.setZoomModuleEnabled(e),this.contextMenu&&(this.destroyContextMenuActions?.(),this.destroyContextMenuActions=this.contextMenu.registerActions(e))}isIgnoredTouch(e){return e?.device!=="touch"?!1:this.ctx.chartService.touch.dragAction!=="drag"?!0:this.enableSelecting?!1:this.enablePanning?sc(this.getZoom()):!0}onSeriesAreaDoubleClick(e){const{enabled:t,enableDoubleClickToReset:i}=this;!t||!i||e?.preventZoomDblClick||!this.isState($n.ZoomClickable)||this.resetZoom()}onSeriesAreaHoverEvent(e){if(!this.shouldHandleAxisHover(e)){this.clearHoveredAxis();return}const t=this.domProxy.pickAxisAtPoint(e.x,e.y);t?(this.domProxy.setHoveredAxis(t.axisId),this.ctx.domManager.updateCursor(Wa,this.domProxy.getCursor(t.direction))):this.clearHoveredAxis()}onSeriesAreaClickEvent(e){if(!this.shouldHandleAxisClick(e))return;const t=this.domProxy.pickAxisAtPoint(e.x,e.y);t&&e.sourceEvent?.type==="dblclick"&&this.onAxisDoubleClick(t.axisId)}shouldHandleAxisHover(e){const{enabled:t,enableAxisDragging:i,enableAxisScrolling:o,dragState:s}=this;return t&&(i||o)&&!e.consumed&&!this.activeAxis&&s===0&&this.domProxy.hasOverlappingAxes()}shouldHandleAxisClick(e){const{enabled:t,enableAxisDragging:i,enableAxisScrolling:o,enableDoubleClickToReset:s}=this;return t&&!this.activeAxis&&!e.consumed&&(i||o||s)}clearHoveredAxis(){this.activeAxis||(this.domProxy.clearHoveredAxis(),this.dragState===0&&this.ctx.domManager.updateCursor(Wa))}tryBeginAxisDelegation(e){const t=this.domProxy.getHoveredAxis();if(!this.enabled||!this.enableAxisDragging||!t||!this.domProxy.beginDelegatedAxisDrag(t.axisId))return!1;this.activeAxis=t,this.onAxisDragStart(t.direction);const i=this.dragState===2?"grabbing":this.domProxy.getCursor(t.direction);return this.ctx.domManager.updateCursor(Wa,i),e.device==="touch"&&e.sourceEvent.preventDefault(),!0}onSeriesAreaDragStart(e){const{enabled:t,enablePanning:i,enableSelecting:o,ctx:{domManager:s,zoomManager:a}}=this;if(!t||!this.isState($n.ZoomDraggable)||this.dragState!==0||this.isIgnoredTouch(e)||(this.panner.stopInteractions(),this.tryBeginAxisDelegation(e)))return;let n=0;const r=this.isPanningKeyPressed(e.sourceEvent);i&&(!o||r)?(s.updateCursor(Wa,"grabbing"),n=2,this.panner.start()):o&&!r&&(n=3),(this.dragState=n)!==0&&a.fireZoomPanStartEvent("zoom")}onSeriesAreaDragMove(e){const{dragState:t,enabled:i,paddedRect:o,panner:s,selector:a,ctx:{interactionManager:n,tooltipManager:r,updateService:l}}=this;if(this.activeAxis){this.onAxisDragMove(this.activeAxis.axisId,this.activeAxis.direction,e);return}if(!(!i||!o||!this.isState($n.ZoomDraggable)||this.isIgnoredTouch(e))){switch(n.pushState(ji.InteractionState.ZoomDrag),e.device==="touch"&&e.sourceEvent.preventDefault(),t){case 2:s.update(e);break;case 3:a.update(e,this.getModuleProperties(),o);break;case 0:return}r.updateTooltip(jn),l.update(Ep.PERFORM_LAYOUT,{skipAnimations:!0})}}onSeriesAreaDragEnd(){const{ctx:{interactionManager:e}}=this;if(this.activeAxis){this.handleAxisDragEnd();return}e.popState(ji.InteractionState.ZoomDrag),!(!this.enabled||this.dragState===0)&&(this.handleRegularDragEnd(),this.resetDragState())}handleAxisDragEnd(){this.onAxisDragEnd(),this.domProxy.endDelegatedAxisDrag(this.activeAxis.axisId),this.activeAxis=void 0,this.clearHoveredAxis()}handleRegularDragEnd(){const{panner:e,selector:t}=this;switch(this.dragState){case 2:e.stop();break;case 3:if(t.didUpdate()){const i=t.stop(this.seriesRect,this.paddedRect,this.getZoom());this.updateZoom(i)}break}}resetDragState(){this.dragState=0,this.ctx.domManager.updateCursor(Wa),this.ctx.tooltipManager.removeTooltip(jn)}onAxisDoubleClick(e){const{enabled:t,enableDoubleClickToReset:i,ctx:{zoomManager:o}}=this;!t||!i||!this.isState($n.ZoomClickable)||(this.previousAxisZoomValid={[zt.X]:!0,[zt.Y]:!0},o.resetAxisZoom("zoom",e))}onAxisDragStart(e){const{axisDraggingMode:t,domProxy:i,enabled:o,enableAxisDragging:s,panner:a,ctx:{zoomManager:n}}=this;!o||!s||(a.stopInteractions(),t==="pan"?(i.setAxisCursor("grabbing"),this.dragState=2,this.panner.start(e),n.fireZoomPanStartEvent("zoom")):this.dragState=1)}onAxisDragMove(e,t,i){const{anchorPointX:o,anchorPointY:s,axisDragger:a,dragState:n,enabled:r,enableAxisDragging:l,seriesRect:c,shouldFlipXY:h,ctx:{interactionManager:p,tooltipManager:u,updateService:g,zoomManager:y}}=this;if(!r||!l||!c)return;p.pushState(ji.InteractionState.ZoomDrag),i.device==="touch"&&i.sourceEvent.preventDefault();const f=this.getZoom();if(n===2)this.panner.update({currentX:i.offsetX,currentY:i.offsetY});else{let x=t===zt.X?o:s;h&&(x=t===zt.X?s:o);const S=y.getAxisZoom(e),v=a.update(i,t,x,c,f,S);y.setAxisManuallyAdjusted("zoom",e),this.updateAxisZoom(e,t,v,{directional:!0})}u.updateTooltip(jn),g.update(Ep.PERFORM_LAYOUT,{skipAnimations:!0})}onAxisDragEnd(){const{axisDraggingMode:e,axisDragger:t,dragState:i,domProxy:o,enabled:s,enableAxisDragging:a,ctx:{domManager:n,interactionManager:r,tooltipManager:l}}=this;r.popState(ji.InteractionState.ZoomDrag),!(!s||!a||i===0)&&(this.dragState=0,e==="pan"&&(o.setAxisCursor("grab"),this.panner.stop()),t.stop(),n.updateCursor(Wa),l.removeTooltip(jn))}onNavZoom(e){const{enabled:t,enableScrolling:i,scroller:o}=this;!this.ctx.interactionManager.isState(ji.InteractionState.Default)||!t||!i||(e.widgetEvent.sourceEvent.preventDefault(),this.updateZoom(o.updateDelta(e.delta,this.getModuleProperties(),this.getZoom())))}onWheel(e){const{enabled:t,enablePanning:i,enableScrolling:o,paddedRect:s}=this;if(!t||!o||!s||!this.isState($n.ZoomWheelable))return;const{deltaX:a,deltaY:n}=e.sourceEvent,r=a!=null&&n!=null&&Math.abs(a)>Math.abs(n);i&&r?this.onWheelPanning(e):this.onWheelScrolling(e)}onWheelPanning(e){const{scrollingStep:t,scrollPanner:i,seriesRect:o,ctx:{zoomManager:s}}=this;if(!o)return;e.sourceEvent.preventDefault();const a=i.update(e,t,o,s.getAxisZooms());for(const[n,{direction:r,zoom:l}]of Pp(a))this.updateAxisZoom(n,r,l)}onWheelScrolling(e){const t=this.getZoom(),i=e.deltaY>0&&sc(t);this.handleWheelScrolling(e,i)}onAxisWheel(e,t,i){const{enableAxisScrolling:o,ctx:{zoomManager:s}}=this;if(!o||t!==zt.X&&t!==zt.Y)return;const a=t===zt.X,n=!a,r=this.getModuleProperties({isScalingX:a,isScalingY:n}),l=this.getZoom(),c=i.deltaY>0&&l[t].min===ui&&l[t].max===tt;s.setAxisManuallyAdjusted("zoom",e),this.handleWheelScrolling(i,c,r)}handleWheelScrolling(e,t,i=this.getModuleProperties()){const{enableIndependentAxes:o,scroller:s,seriesRect:a,ctx:{zoomManager:n}}=this;if(!a)return;let r=!0;if(o===!0){const l=s.updateAxes(e,i,a,n.getAxisZooms());for(const[c,{direction:h,zoom:p}]of Pp(l)){const u=h===zt.X?this.constrainZoom({x:p,y:{min:tt,max:tt}}).x:p;r&&(r=this.updateAxisZoom(c,h,u))}}else{const l=s.update(e,i,a,this.getZoom());if(l==null)return;r=this.updateUnifiedZoom(l,{directional:!0})}t||(t=e.deltaY<0&&!r),this.firstWheelEventDirection!=null&&this.firstWheelEventDirection!==e.deltaY<0&&(this.isFirstWheelEvent=!0),this.isFirstWheelEvent?(this.wasFirstWheelEventZoomCapped=t,this.firstWheelEventDirection=e.deltaY<0,t||e.sourceEvent.preventDefault()):this.wasFirstWheelEventZoomCapped===!1&&e.sourceEvent.preventDefault(),this.isFirstWheelEvent=!1,this.debouncedWheelReset()}onTouchStart(e,t){!this.enableTwoFingerZoom||this.dragState!==0||this.twoFingers.start(e,t,this.getZoom())&&(this.dragState=4)}onTouchMove(e,t){if(!this.enableTwoFingerZoom||this.dragState!==4)return;const i=this.twoFingers.update(e,t);this.updateZoom(gi(i))}onTouchEnd(e){!this.enableTwoFingerZoom||this.dragState!==4||(e.sourceEvent.preventDefault(),this.twoFingers.end(e)&&(this.dragState=0))}onProcessData(e){this.shouldFlipXY=e.series.shouldFlipXY}onLayoutComplete(e){this.domProxy.update(this.enableAxisDragging,this.enableAxisScrolling,this.ctx,e.series.rect),this.enabled&&(this.seriesRect=e.series.rect,this.paddedRect=e.series.paddedRect,this.enableAxisDragging&&this.toggleAxisDraggingCursorsDebounced())}onZoomChange(e){e.callerId!=="zoom"&&this.panner.stopInteractions();const t=this.getZoom();this.buttons.toggleVisibleZoomed(sc(t))}onZoomPanStart(e){e.callerId==="zoom"&&this.panner.stopInteractions()}onPanUpdate(e){const{panner:t,seriesRect:i,ctx:{tooltipManager:o,zoomManager:s}}=this;if(!i)return;const a=t.translateZooms(i,s.getAxisZooms(),e.deltaX,e.deltaY);for(const[n,{direction:r,zoom:l}]of Pp(a))this.updateAxisZoom(n,r,l);o.updateTooltip(jn)}isPanningKeyPressed(e){switch(this.panKey){case"alt":return e.altKey;case"ctrl":return e.ctrlKey;case"shift":return e.shiftKey;case"meta":return e.metaKey}}isScalingX(){return this.axes==="xy"?!0:this.shouldFlipXY?this.axes==="y":this.axes==="x"}isScalingY(){return this.axes==="xy"?!0:this.shouldFlipXY?this.axes==="x":this.axes==="y"}getAnchorPointX(){return this.shouldFlipXY?this.anchorPointY:this.anchorPointX}getAnchorPointY(){return this.shouldFlipXY?this.anchorPointX:this.anchorPointY}constrainZoom(e){const{minVisibleItems:t,ctx:{zoomManager:i}}=this;return t===0?e:i.constrainZoomToItemCount(e,t)??e}isZoomValid(e,t){const{minVisibleItems:i,ctx:{zoomManager:o}}=this;if(i===0)return this.previousZoomValid=!0,!0;const s=this.getZoom(),a=dc(it(e))=r)return this.previousAxisZoomValid[e]=!0,!0;if(!this.previousAxisZoomValid[e]&&i?.directional)return!1;const c=s.isVisibleItemsCountAtLeast(l,o);return this.previousAxisZoomValid[e]=i?.directional?c:!0,c}resetZoom(){this.previousZoomValid=!0,this.previousAxisZoomValid={[zt.X]:!0,[zt.Y]:!0},this.ctx.zoomManager.resetZoom("zoom")}updateSyncZoom(e){this.updateZoom(e)}updateZoom(e){this.enableIndependentAxes?this.updatePrimaryAxisZooms(e):this.updateUnifiedZoom(e)}updateUnifiedZoom(e,t){return e=this.constrainZoom(e),this.isZoomValid(e,t)?(this.ctx.zoomManager.updateZoom("zoom",e),!0):(this.ctx.updateService.update(Ep.SCENE_RENDER,{skipAnimations:!0}),!1)}updatePrimaryAxisZooms(e){this.updatePrimaryAxisZoom(e,zt.X),this.updatePrimaryAxisZoom(e,zt.Y)}updatePrimaryAxisZoom(e,t){const i=this.ctx.zoomManager.getPrimaryAxisId(t);i!=null&&this.updateAxisZoom(i,t,e[t])}updateAxisZoom(e,t,i,o){const{enableIndependentAxes:s,ctx:{zoomManager:a}}=this;if(!i)return!1;const n=this.getZoom();return s!==!0?(n[t]=i,this.updateUnifiedZoom(n,o)):this.isAxisZoomValid(t,i,o)?(a.updateAxisZoom("zoom",e,i),!0):!1}updateAxisCursor(e){if(!this.domProxy)return;const{enableAxisDragging:t=this.enableAxisDragging,enableAxisScrolling:i=this.enableAxisScrolling,axisDraggingMode:o=this.axisDraggingMode}=e;t?this.domProxy.setAxisCursor(o==="pan"?"grab":void 0):i?this.domProxy.setAxisCursor("default"):this.domProxy.setAxisCursor(void 0)}toggleAxisDraggingCursors(){const{anchorPointX:e,anchorPointY:t,domProxy:i}=this,o=this.getZoom();let s=it(o)!==Bs,a=Yt(o)!==Bs;if(!s){const n=ac(o,.999,1);n.x=Ut(n.x,o.x,e),s=this.isZoomValid(n,{includeYVisibleRange:!0})}if(!a){const n=ac(o,1,.999);n.y=Ut(n.y,o.y,t),a=this.isZoomValid(n,{includeYVisibleRange:!0})}i.toggleAxisDraggingCursor(zt.X,s),i.toggleAxisDraggingCursor(zt.Y,a)}getZoom(){return ht(this.ctx.zoomManager.getZoom())}getResetZoom(){return ht(this.ctx.zoomManager.getRestoredZoom())}getModuleProperties(e){return{anchorPointX:e?.anchorPointX??this.getAnchorPointX(),anchorPointY:e?.anchorPointY??this.getAnchorPointY(),enabled:e?.enabled??this.enabled,independentAxes:e?.independentAxes??this.enableIndependentAxes===!0,isScalingX:e?.isScalingX??this.isScalingX(),isScalingY:e?.isScalingY??this.isScalingY(),keepAspectRatio:e?.keepAspectRatio??this.keepAspectRatio,scrollingStep:e?.scrollingStep??this.scrollingStep}}};d([Ws({newValue(e){this.onEnabledChange(e)}}),Te],_e.prototype,"enabled",2),d([Ws({changeValue(e){this.updateAxisCursor({enableAxisDragging:e})}}),Te],_e.prototype,"enableAxisDragging",2),d([Ws({changeValue(e){this.updateAxisCursor({enableAxisScrolling:e})}}),Te],_e.prototype,"enableAxisScrolling",2),d([Te],_e.prototype,"enableDoubleClickToReset",2),d([Ws({changeValue(e){this.ctx.zoomManager.setIndependentAxes(!!e)}}),Te],_e.prototype,"enableIndependentAxes",2),d([Te],_e.prototype,"enablePanning",2),d([Te],_e.prototype,"enableScrolling",2),d([Te],_e.prototype,"enableSelecting",2),d([Te],_e.prototype,"enableTwoFingerZoom",2),d([Te],_e.prototype,"panKey",2),d([Te],_e.prototype,"axes",2),d([Te],_e.prototype,"scrollingStep",2),d([Te],_e.prototype,"keepAspectRatio",2),d([Te],_e.prototype,"minVisibleItems",2),d([Te],_e.prototype,"anchorPointX",2),d([Te],_e.prototype,"anchorPointY",2),d([Te],_e.prototype,"autoScaling",2),d([Ws({changeValue(e){this.updateAxisCursor({axisDraggingMode:e})}}),Te],_e.prototype,"axisDraggingMode",2),d([Te],_e.prototype,"buttons",2),d([i_("panner.deceleration"),Te],_e.prototype,"deceleration",2);var o_={enabled:!0,visible:"hover",buttons:[{icon:"zoom-out",value:"zoom-out",section:"scale"},{icon:"zoom-in",value:"zoom-in",section:"scale"},{icon:"pan-left",value:"pan-left",section:"pan"},{icon:"pan-right",value:"pan-right",section:"pan"},{icon:"reset",value:"reset",section:"reset"}]},s_={type:"root",optionsKey:"zoom",packageType:"enterprise",chartTypes:["cartesian","topology"],moduleFactory:e=>new _e(e),themeTemplate:{zoom:{anchorPointX:"end",anchorPointY:"middle",axes:"x",buttons:o_,enabled:!1,enableAxisDragging:!0,enableDoubleClickToReset:!0,enablePanning:!0,enableScrolling:!0,enableSelecting:!1,enableTwoFingerZoom:!0,deceleration:"short",minVisibleItems:2,panKey:"alt",scrollingStep:.1,autoScaling:{enabled:{$eq:[{$path:"../axes"},"x"]},padding:.05}}}};import{_ModuleSupport as zp}from"ag-charts-community";import{_ModuleSupport as Yn}from"ag-charts-community";import{CleanupRegistry as a_,createId as n_}from"ag-charts-core";import{_ModuleSupport as r_}from"ag-charts-community";import{cachedTextMeasurer as l_,countFractionDigits as c_,createId as h_,isArray as d_,measureTextSegments as p_,toPlainText as u_}from"ag-charts-core";import{_ModuleSupport as g_}from"ag-charts-community";function Un(e,t,i){return g_.callWithContext(e.chartService,t,i)}var{AxisInterval:y_,AxisLabel:f_,ZIndexMap:m_,LinearScale:x_,BBox:S_,TranslatableGroup:b_,Selection:v_,Text:k_,createIdsGenerator:D_,findMinMax:M_,findRangeExtent:A_,estimateTickCount:I_}=r_,Fp=class sg{constructor(t,i){this.ctx=t,this.dataProvider=i,this.id=h_(this),this.axisGroup=new b_({name:`${this.id}-AxisTicks`,zIndex:m_.AXIS}),this.labelSelection=v_.select(this.axisGroup,k_),this.interval=new y_,this.label=new f_,this.scale=new x_,this.placement="bottom",this.translationX=0,this.translationY=0,this.padding=0}get horizontal(){return this.placement.startsWith("top")||this.placement.startsWith("bottom")}attachAxis(t){t.appendChild(this.axisGroup)}calculateLayout(){const{placement:t,translationX:i,translationY:o,horizontal:s,label:a}=this;function n(u){}let r,l;switch(t){case"top":case"top-right":case"top-left":r="bottom",l="center",a.mirrored=!1,a.parallel=!0;break;case"bottom":case"bottom-right":case"bottom-left":r="top",l="center",a.mirrored=!1,a.parallel=!0;break;case"right":case"right-top":case"right-bottom":case"left":case"left-top":case"left-bottom":r="middle",l="left",a.mirrored=!0,a.parallel=!1;break;default:}const c=[],h=this.generateTicks(),{ticks:p}=h;return this.labelSelection.update(p,void 0,u=>u.tickId),this.axisGroup.setProperties({translationX:i,translationY:o}),this.labelSelection.each((u,g)=>{u.fontFamily=a.fontFamily,u.fontSize=a.fontSize,u.fontStyle=a.fontStyle,u.fontWeight=a.fontWeight,u.fill=a.color,u.textBaseline=r,u.textAlign=l,u.text=g.tickLabel,u.x=s?g.translation:0,u.y=s?0:g.translation,c.push(u.getBBox())}),c.length>0?S_.merge(c).translate(i,o):void 0}tickFormatter(t,i,o,s){const{ctx:a}=this,{formatManager:n}=a,r=this.dataProvider.data.flatMap(l=>l.series);return(l,c)=>{const h={type:"number",value:l,datum:void 0,seriesId:void 0,legendItemName:void 0,key:void 0,source:"gradient-legend",property:"color",domain:t,boundSeries:r,fractionDigits:s};return this.label.formatValue((p,u)=>Un(a,p,u),h,c)??n.format((p,u)=>Un(a,p,u),h)??n.defaultFormat(h)}}inRange(t,i=.001){const[o,s]=M_(this.scale.range);return t>=o-i&&t<=s+i}generateTicks(){const{minSpacing:t,maxSpacing:i}=this.interval,{maxTickCount:o,minTickCount:s,tickCount:a}=I_(A_(this.scale.range),1,t,i,sg.DefaultTickCount,sg.DefaultMinSpacing),n=this.getTicksData({nice:!0,interval:this.interval.step,tickCount:a,minTickCount:s,maxTickCount:o});if(this.placement==="bottom"||this.placement==="top"){const r=l_(this.label),{domain:l}=this.scale,h=l[0]>l[1]?-1:1;let p=-1/0*h;n.ticks=n.ticks.filter(u=>{if(Math.sign(u.translation-p)!==h)return!1;const{width:g}=d_(u.tickLabel)?p_(u.tickLabel,this.label):r.measureLines(u.tickLabel);return p=u.translation+g*h,!0})}return n}getTicksData(t){const i=[],o=t.nice?this.scale.niceDomain(t):this.scale.domain,s=this.scale.ticks(t,o)?.ticks??[],a=s.reduce((l,c)=>Math.max(l,c_(c)),0),n=D_(),r=this.tickFormatter(o,s,!1,a);for(let l=0;lthis.onChartHoverChange()),e.layoutManager.registerElement(N_.Legend,t=>this.onStartLayout(t)),()=>this.legendGroup.remove())}isVertical(){const{placement:e}=Wp(this.position);return e.startsWith("right")||e.startsWith("left")}destroy(){this.cleanup.flush()}attachLegend(e){e.appendChild(this.legendGroup)}onStartLayout(e){const[t]=this.data;if(!this.enabled||!t?.enabled||t.legendType!=="gradient"){this.legendGroup.visible=!1;return}const{colorRange:i}=this.normalizeColorArrays(t),o=this.updateGradientRect(e.layoutBox,i),s=this.updateAxis(t,o)??new Vp(0,0,0,0),a=Vp.merge([o,s]),{strokeWidth:n,padding:r}=this.getContainerStyles();a.grow(r).grow(n);const{left:l,top:c}=this.getMeasurements(e.layoutBox,a);this.updateContainer(a),this.updateArrow(),this.legendGroup.visible=!0,this.legendGroup.translationX=l,this.legendGroup.translationY=c}normalizeColorArrays(e){let t=e.colorDomain.slice();const i=e.colorRange.slice();if(t.length===i.length)return{colorDomain:t,colorRange:i};t.length>i.length&&i.splice(t.length);const[o,s]=t,a=i.length;return t=i.map((n,r)=>r===0?o:r===a-1?s:o+(s-o)*r/(a-1)),{colorDomain:t,colorRange:i}}updateGradientRect(e,t){const{gradientRect:i,gradient:o}=this,{preferredLength:s,thickness:a}=o,n=new Vp(0,0,0,0);let r;return this.isVertical()?(r=0,n.width=a,n.height=Math.min(e.height,s)):(r=90,n.width=Math.min(e.width,s),n.height=a),i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height,i.fill={type:"gradient",gradient:"linear",colorSpace:"oklch",colorStops:t.map((l,c)=>({stop:c/(t.length-1),color:l})),rotation:r},n}updateAxis(e,t){const{axisTicks:i,gradient:o,scale:s}=this,{placement:a}=Wp(this.position),n=this.isVertical(),r=this.reverseOrder!==n;i.placement=a;const l=o.thickness+(s.padding??0);return i.translationX=n?l:t.x,i.translationY=n?t.y:l,i.scale.domain=r?e.colorDomain.slice().reverse():e.colorDomain,i.scale.range=n?[t.x,t.height]:[t.y,t.width],i.calculateLayout()}updateContainer(e){const t=this.getContainerStyles();Yn.applyShapeStyle(this.containerNode,t),this.containerNode.cornerRadius=t.cornerRadius,this.containerNode.x=e.x,this.containerNode.y=e.y,this.containerNode.width=e.width,this.containerNode.height=e.height}updateArrow(){const e=this.highlightManager.getActiveHighlight(),{arrow:t}=this;if(e?.colorValue==null){t.visible=!1;return}const{scale:i,label:o}=this.axisTicks,s=o.fontSize??0,a=i.convert(e.colorValue);let{x:n,y:r}=this.gradientRect,l=Math.PI;this.isVertical()?(n-=s/2,r+=a,l/=2):(n+=a,r-=s/2),t.visible=!0,t.fill=o.color,t.rotation=l,t.size=s,t.translationX=n,t.translationY=r}getMeasurements(e,t){function i(u){}let{x:o,y:s}=e;const{width:a,height:n}=t,{placement:r,floating:l,xOffset:c,yOffset:h}=Wp(this.position),p=this.getContainerStyles();switch(o+=p.strokeWidth+p.padding.left,s+=p.strokeWidth+p.padding.top,r){case"left":s+=e.height/2-n/2;break;case"right":o+=e.width-a,s+=e.height/2-n/2;break;case"top":o+=e.width/2-a/2;break;case"bottom":o+=e.width/2-a/2,s+=e.height-n;break;case"right-top":case"top-right":o+=e.width-a;break;case"right-bottom":case"bottom-right":o+=e.width-a,s+=e.height-n;break;case"left-bottom":case"bottom-left":s+=e.height-n;break;case"left-top":case"top-left":break;default:}if(!l)switch(r){case"left":case"left-top":case"left-bottom":e.shrink(a+this.spacing,"left");break;case"right":case"right-top":case"right-bottom":e.shrink(a+this.spacing,"right");break;case"top":case"top-left":case"top-right":e.shrink(n+this.spacing,"top");break;case"bottom":case"bottom-left":case"bottom-right":e.shrink(n+this.spacing,"bottom");break;default:}return o+=c,s+=h,{top:s,left:o}}getContainerStyles(){const{stroke:e,strokeOpacity:t,strokeWidth:i}=this.border,{cornerRadius:o,fill:s,fillOpacity:a,padding:n}=this,r=typeof n=="number";return{cornerRadius:o,fill:s,fillOpacity:a,padding:{top:r?n:n.top??0,right:r?n:n.right??0,bottom:r?n:n.bottom??0,left:r?n:n.left??0},stroke:e,strokeOpacity:t,strokeWidth:this.border.enabled?i:0}}onChartHoverChange(){this.enabled&&this.updateArrow()}};Zt.className="GradientLegend",d([Xt],Zt.prototype,"enabled",2),d([Xt],Zt.prototype,"position",2),d([Xt],Zt.prototype,"reverseOrder",2),d([Xt],Zt.prototype,"gradient",2),d([Xt],Zt.prototype,"spacing",2),d([Xt],Zt.prototype,"border",2),d([Xt],Zt.prototype,"cornerRadius",2),d([Xt],Zt.prototype,"fill",2),d([Xt],Zt.prototype,"fillOpacity",2),d([Xt],Zt.prototype,"padding",2),d([Xt],Zt.prototype,"scale",2);var __={type:"legend",optionsKey:"gradientLegend",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],identifier:"gradient",moduleFactory:e=>new Zt(e),themeTemplate:{enabled:!1,position:"bottom",spacing:20,scale:{padding:13,label:{color:{$ref:"textColor"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},minSpacing:5},interval:{minSpacing:15}},gradient:{preferredLength:100,thickness:16},reverseOrder:!1,fill:{$applySwitch:[{$path:"type"},{$ref:"chartBackgroundColour"},["gradient",zp.FILL_GRADIENT_BLANK_DEFAULTS],["pattern",zp.FILL_PATTERN_BLANK_DEFAULTS],["image",zp.FILL_IMAGE_BLANK_DEFAULTS]]}},removable:"standalone-only"};import{createElement as R_}from"ag-charts-core";function E_(e,t){const i=e.addChild("canvas-overlay","watermark"),o=R_("span");o.innerText=t,i.addEventListener("animationend",()=>{e.removeChild("canvas-overlay","watermark"),e.removeStyles("watermark")}),i.classList.add("ag-watermark"),i.appendChild(o)}import{_ModuleSupport as B_}from"ag-charts-community";import{_ModuleSupport as z_}from"ag-charts-community";var{ordinalTimeAxisOptionsDefs:F_,angleNumberAxisOptionsDefs:H_,angleCategoryAxisOptionsDefs:V_,radiusNumberAxisOptionsDefs:W_,radiusCategoryAxisOptionsDefs:G_}=z_,K_={type:"axis",name:"ordinal-time",chartType:"cartesian",enterprise:!0,options:F_,create:e=>new gn(e)},$_={type:"axis",name:"angle-number",chartType:"polar",enterprise:!0,options:H_,create:e=>new ps(e)},j_={type:"axis",name:"angle-category",chartType:"polar",enterprise:!0,options:V_,create:e=>new To(e)},Y_={type:"axis",name:"radius-number",chartType:"polar",enterprise:!0,options:W_,create:e=>new ra(e)},U_={type:"axis",name:"radius-category",chartType:"polar",enterprise:!0,options:G_,create:e=>new Co(e)};import{_ModuleSupport as X_}from"ag-charts-community";import{_ModuleSupport as Z_}from"ag-charts-community";var{Chart:q_}=Z_,Kp=class extends q_{getChartType(){return"standalone"}performLayout(e){const{seriesRoot:t,annotationRoot:i}=this,{layoutBox:o}=e,s=o.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=s,this.animationRect=s;for(const a of[t,i])a.translationX=Math.floor(s.x),a.translationY=Math.floor(s.y);t.visible=this.series[0].visible,this.ctx.layoutManager.emitLayoutComplete(e,{series:{visible:!0,rect:s,paddedRect:o}})}getAriaLabel(){const e=this.series[0]?.type;if(e==null)return"";const t=this.getCaptionText();switch(e){case"radial-gauge":case"linear-gauge":{const i=[];t.length!==0&&i.push(t);for(const o of this.series)i.push(o.getCaptionText());return this.ctx.localeManager.t("ariaAnnounceGaugeChart",{caption:i.join(". ")})}case"treemap":case"sunburst":return this.ctx.localeManager.t("ariaAnnounceHierarchyChart",{caption:t});default:return this.ctx.localeManager.t("ariaAnnounceStandaloneChart",{caption:t})}}};Kp.className="StandaloneChart",Kp.type="standalone";var{isAgStandaloneChartOptions:Q_,standaloneChartOptionsDefs:J_}=X_,eR={type:"chart",name:"standalone",enterprise:!0,options:J_,detect:Q_,create(e,t){return new Kp(e,t)}};import{_ModuleSupport as tR}from"ag-charts-community";import{_ModuleSupport as iR}from"ag-charts-community";var{Chart:oR,MercatorScale:MS,ChartAxisDirection:uc,Property:sR}=iR;function AS(e){return e.type==="map-shape"||e.type==="map-line"||e.type==="map-marker"||e.type==="map-shape-background"||e.type==="map-line-background"}var gc=class extends oR{constructor(e,t){super(e,t),this.ctx.zoomManager.updateAxes([uc.X,uc.Y])}getChartType(){return"topology"}async updateData(){await super.updateData();const e=this.getOptions();this.topology!==e.topology&&(this.topology=e.topology);const{topology:t}=this;for(const i of this.series)AS(i)&&i.setChartTopology(t)}performLayout(e){const{seriesRoot:t,annotationRoot:i}=this,{layoutBox:o}=e,s=o.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=s,this.animationRect=s;const a=this.series.filter(AS),n=a.reduce((c,h)=>{if(!h.visible)return c;const p=h.topologyBounds;return p==null?c:c==null?p:c.merge(p)},void 0);let r;if(n!=null){const{lon0:c,lat0:h,lon1:p,lat1:u}=n,g=[[c,h],[p,u]],y=MS.bounds(g),{width:f,height:x}=s,S=Math.min(f/y.width,x/y.height),v=y.width*S,m=y.height*S,b=(f-v)/2,k=(x-m)/2,A=b,M=k,D=b+v,L=k+m,N=this.ctx.zoomManager.getAxisZoom(uc.X),P=this.ctx.zoomManager.getAxisZoom(uc.Y),R=(D-A)/(N.max-N.min),F=A-R*N.min,_=(L-M)/(1-P.min-(1-P.max)),E=M-_*(1-P.max);r=new MS(g,[[F,E],[F+R,E+_]])}for(const c of a)c.scale=r;const l=this.series.some(c=>c.visible);t.visible=l;for(const c of[t,i])c.translationX=Math.floor(s.x),c.translationY=Math.floor(s.y),c.setClipRect(s.clone());this.ctx.layoutManager.emitLayoutComplete(e,{series:{visible:l,rect:s,paddedRect:o}})}};gc.className="TopologyChart",gc.type="topology",d([sR],gc.prototype,"topology",2);var{isAgTopologyChartOptions:aR,topologyChartOptionsDefs:nR}=tR,rR={type:"chart",name:"topology",enterprise:!0,options:nR,detect:aR,create(e,t){return new gc(e,t)}};import{_ModuleSupport as lR}from"ag-charts-community";import{_ModuleSupport as cR}from"ag-charts-community";import{and as yc,arrayOf as hR,arrayOfDefs as IS,boolean as Gs,constant as LS,greaterThan as TS,lessThan as CS,number as Yi,numberRange as dR,optionsDefs as NS,or as Ks,ratio as fc,required as pR,string as Ti,typeUnion as uR,union as gR}from"ag-charts-core";var{annotationCalloutStylesDefs:yR,annotationNoteStylesDefs:fR,annotationTextStylesDef:mR,annotationCommentStylesDefs:xR,annotationMeasurerStylesDefs:mc,annotationQuickMeasurerStylesDefs:SR,annotationShapeStylesDefs:wS,annotationChannelTextDefs:bR,annotationCrossLineStyleDefs:PS,annotationFibonacciStylesDefs:OS,annotationLineStyleDefs:_S,annotationLineTextDefs:vR,annotationDisjointChannelStyleDefs:kR,annotationParallelChannelStyleDefs:DR}=cR,Xn=NS({__type:pR(LS("date")),value:Ks(Ti,Yi)},"a serializable date object"),RS=Ks(Ti,Yi,Xn),$p=Ks(RS,NS({value:RS,groupPercentage:dR(-1,2)})),ES={...bR,label:Ti},Ui={...vR,label:Ti},ye={x:$p,y:Yi},MR=uR({line:{..._S,start:ye,end:ye,text:Ui},"horizontal-line":{...PS,value:$p,text:Ui},"vertical-line":{...PS,value:$p,text:Ui},"disjoint-channel":{...kR,startHeight:Yi,endHeight:Yi,start:ye,end:ye,text:ES},"parallel-channel":{...DR,height:Yi,start:ye,end:ye,text:ES},"fibonacci-retracement":{...OS,start:ye,end:ye,text:Ui,reverse:Gs},"fibonacci-retracement-trend-based":{...OS,start:ye,end:ye,endRetracement:ye,text:Ui,reverse:Gs},callout:{...yR,start:ye,end:ye,text:Ti},comment:{...xR,...ye,text:Ti},note:{...fR,...ye,text:Ti},text:{...mR,...ye,text:Ti},arrow:{..._S,text:Ui,start:ye,end:ye},"arrow-up":{...wS,...ye},"arrow-down":{...wS,...ye},"date-range":{...mc,extendAbove:Gs,extendBelow:Gs,text:Ui,start:ye,end:ye},"price-range":{...mc,extendLeft:Gs,extendRight:Gs,text:Ui,start:ye,end:ye},"date-price-range":{...mc,text:Ui,start:ye,end:ye},"quick-date-price-range":{...mc,...SR,text:Ui,start:ye,end:ye}},"an annotation initial state object"),AR={chartType:gR("candlestick","hollow-candlestick","ohlc","line","step-line","hlc","high-low"),annotations:IS(MR),legend:IS({visible:Gs,seriesId:Ti,itemId:Ti,legendItemName:Ti},"legend state array"),zoom:{rangeX:{start:Ks(Yi,Xn),end:Ks(Yi,Xn)},rangeY:{start:Ks(Yi,Xn),end:Ks(Yi,Xn)},ratioX:{start:yc(fc,CS("end")),end:yc(fc,TS("start"))},ratioY:{start:yc(fc,CS("end")),end:yc(fc,TS("start"))},autoScaledAxes:hR(LS("y"))}},{annotationOptionsDef:IR}=lR,LR={type:"plugin",name:"annotations",chartType:"cartesian",options:IR,create(){return null}},TR={type:"plugin",name:"navigator",chartType:"cartesian",options:WO,create(){return null}},CR={type:"plugin",name:"initialState",options:AR,create(){return null}};import{_ModuleSupport as Zn}from"ag-charts-community";import{_ModuleSupport as NR}from"ag-charts-community";import{Logger as wR,cachedTextMeasurer as PR,calcLineHeight as OR,toPlainText as _R,wrapText as RR}from"ag-charts-core";import{_ModuleSupport as xc}from"ag-charts-community";import{Logger as ER}from"ag-charts-core";function BS(e,t,i){i||(t=BR(t));const o=new Map;for(const a of e)o.set(a.id,{datum:a,linksBefore:[],linksAfter:[],maxPathLengthBefore:-1,maxPathLengthAfter:-1});let s=0;for(const[a,n]of o.entries())s=Math.max(s,jp(o,t,n,a,-1,[])+jp(o,t,n,a,1,[])+1);return{links:t,nodeGraph:o,maxPathLength:s}}function zS(e,t,i,o){const s=o.indexOf(t);if(s!==-1){for(let n=s;n!t.has(i))}function jp(e,t,i,o,s,a){if(a.includes(o))return 1/0;let n=s===-1?i.maxPathLengthBefore:i.maxPathLengthAfter;if(n===-1){n=0;const r=s===-1?i.linksBefore:i.linksAfter;for(const l of t){const{fromNode:c,toNode:h}=l,p=s===-1?h.id:c.id,u=s===-1?c.id:h.id,g=o===p?e.get(u):void 0;g!=null&&(r.push({node:g,link:l}),a?.push(o),n=Math.max(n,jp(e,t,g,u,s,a)+1),a?.pop())}s===-1?i.maxPathLengthBefore=n:i.maxPathLengthAfter=n}return n}var{Series:zR,DataController:FR,keyProperty:HR,valueProperty:Sc,Selection:$s,Group:Ga,TransformableText:VR}=xc,WR=class extends xc.SeriesNodeEvent{constructor(e,t,i,o){super(e,t,i,o);const{datumIndex:s}=i,a=o.contextNodeData?.nodeData.find(n=>n.datumIndex.type===s.type&&n.datumIndex.index===s.index);this.size=a?.size,this.label=a?.type===1?a?.label:void 0}},FS=class extends zR{constructor(){super(...arguments),this.NodeEvent=WR,this.nodeCount=0,this.linkCount=0,this.linksDataModel=void 0,this.linksProcessedData=void 0,this.nodesDataModel=void 0,this.nodesProcessedData=void 0,this.processedNodes=new Map,this.linkGroup=this.contentGroup.appendChild(new Ga({name:"linkGroup"})),this.nodeGroup=this.contentGroup.appendChild(new Ga({name:"nodeGroup"})),this.focusLinkGroup=this.highlightGroup.appendChild(new Ga({name:"linkGroup"})),this.focusNodeGroup=this.highlightGroup.appendChild(new Ga({name:"nodeGroup"})),this.highlightLinkGroup=this.highlightGroup.appendChild(new Ga({name:"linkGroup"})),this.highlightNodeGroup=this.highlightGroup.appendChild(new Ga({name:"nodeGroup"})),this.labelSelection=$s.select(this.labelGroup,VR),this.linkSelection=$s.select(this.linkGroup,()=>this.linkFactory()),this.nodeSelection=$s.select(this.nodeGroup,()=>this.nodeFactory()),this.focusLinkSelection=$s.select(this.focusLinkGroup,()=>this.linkFactory()),this.focusNodeSelection=$s.select(this.focusNodeGroup,()=>this.nodeFactory()),this.highlightLinkSelection=$s.select(this.highlightLinkGroup,()=>this.linkFactory()),this.highlightNodeSelection=$s.select(this.highlightNodeGroup,()=>this.nodeFactory())}get nodes(){return this.properties.nodes}async processData(e){const{data:t,nodes:i}=this;if(t==null)return;const{fromKey:o,toKey:s,sizeKey:a,idKey:n,labelKey:r}=this.properties,l=new FR("standalone",e.suppressFieldDotNotation),c=i==null?null:l.request(this.id,xc.DataSet.wrap(i)??xc.DataSet.empty(),{props:[HR(n,void 0,{id:"idValue",includeProperty:!1}),...r==null?[]:[Sc(r,void 0,{id:"labelValue",includeProperty:!1})]],groupByKeys:!0}),h=e.request(this.id,t,{props:[Sc(o,void 0,{id:"fromValue",includeProperty:!1}),Sc(s,void 0,{id:"toValue",includeProperty:!1}),...a==null?[]:[Sc(a,void 0,{id:"sizeValue",includeProperty:!1,missingValue:0})]],groupByKeys:!1});i!=null&&l.execute();const[p,u]=await Promise.all([c??Promise.resolve(null),h]);this.nodesDataModel=p?.dataModel,this.nodesProcessedData=p?.processedData,this.linksDataModel=u?.dataModel,this.linksProcessedData=u?.processedData;const g=new Map;if(p==null){const y=u.dataModel.resolveColumnById(this,"fromValue",u.processedData),f=u.dataModel.resolveColumnById(this,"toValue",u.processedData),x=v=>{const m=g.size,b=v;return{series:this,itemId:void 0,datum:{},datumIndex:{type:1,index:m},type:1,index:m,linksBefore:[],linksAfter:[],id:v,size:0,label:b,style:this.getNodeStyle({datumIndex:{type:1,index:m},datum:{},size:0,label:b},m,!1)}},S=u.processedData.dataSources.get(this.id)?.data;if(S)for(const[v]of S.entries()){const m=y[v],b=f[v];m==null||b==null||(g.has(m)||g.set(m,x(m)),g.has(b)||g.set(b,x(b)))}}else{const y=p.dataModel.resolveColumnById(this,"idValue",p.processedData),f=r==null?void 0:p.dataModel.resolveColumnById(this,"labelValue",p.processedData),x=p.processedData.dataSources.get(this.id)?.data;if(x)for(const[S,v]of x.entries()){const m=y[S],b=f?.[S],k={type:1,index:S};g.set(m,{series:this,itemId:void 0,datum:v,datumIndex:k,type:1,index:S,linksBefore:[],linksAfter:[],id:m,size:0,label:b,style:this.getNodeStyle({datumIndex:k,datum:v,size:0,label:b},S,!1)})}}this.processedNodes=g}getNodeGraph(e,t,{includeCircularReferences:i}){const{linksDataModel:o,linksProcessedData:s}=this;if(o==null||s==null){const{links:f,nodeGraph:x,maxPathLength:S}=BS(new Map().values(),[],i);return this.nodeCount=0,this.linkCount=0,{nodeGraph:x,links:f,maxPathLength:S}}const{sizeKey:a}=this.properties,n=o.resolveColumnById(this,"fromValue",s),r=o.resolveColumnById(this,"toValue",s),l=a==null?void 0:o.resolveColumnById(this,"sizeValue",s),c=new Map;for(const f of this.processedNodes.values()){const x=e(f);c.set(f.id,x)}const h=[],p=s.dataSources.get(this.id)?.data;if(p)for(const[f,x]of p.entries()){const S=n[f],v=r[f],m=l==null?1:l[f],b=c.get(S),k=c.get(v);if(m<=0||b==null||k==null)continue;const A={type:0,index:f},M=t({series:this,itemId:void 0,datum:x,datumIndex:A,type:0,index:f,fromNode:b,toNode:k,size:m,style:this.getLinkStyle({datum:x,datumIndex:A},b.datumIndex,!1)});h.push(M)}const{links:u,nodeGraph:g,maxPathLength:y}=BS(c.values(),h,i);for(const f of g.values())f.datum.linksBefore=f.linksBefore.map(x=>x.link),f.datum.linksAfter=f.linksAfter.map(x=>x.link);return this.nodeCount=g.size,this.linkCount=u.length,{nodeGraph:g,links:u,maxPathLength:y}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(e){const{seriesRect:t}=e,i={seriesRectWidth:t?.width??0,seriesRectHeight:t?.height??0};(this._nodeDataDependencies==null||this._nodeDataDependencies.seriesRectWidth!==i.seriesRectWidth||this._nodeDataDependencies.seriesRectHeight!==i.seriesRectHeight)&&(this._nodeDataDependencies=i),this.updateSelections();const o=this.contextNodeData?.nodeData??[],s=this.contextNodeData?.labelData??[];let a=this.ctx.highlightManager?.getActiveHighlight();if(a?.series===this&&a.type==null){const{itemId:h}=a;a=h==null?void 0:o.find(p=>p.type===1&&p.id===h)}else a?.series!==this&&(a=void 0);this.contentGroup.visible=this.visible,this.contentGroup.opacity=a==null?1:this.properties.highlight.unhighlightedItem.opacity??1,this.labelSelection=this.updateLabelSelection({labelData:s,labelSelection:this.labelSelection}),this.updateLabelNodes({labelSelection:this.labelSelection}),this.linkSelection=this.updateLinkSelection({nodeData:o.filter(h=>h.type===0),datumSelection:this.linkSelection}),this.updateLinkNodes({datumSelection:this.linkSelection,isHighlight:!1}),this.nodeSelection=this.updateNodeSelection({nodeData:o.filter(h=>h.type===1),datumSelection:this.nodeSelection}),this.updateNodeNodes({datumSelection:this.nodeSelection,isHighlight:!1});let n,r,l,c;a?.type===1?(n=o.filter(h=>h.type===0&&(h.toNode===a||h.fromNode===a)),r=n.map(h=>h.fromNode===a?h.toNode:h.fromNode),r.push(a),l=[],c=[a]):a?.type===0?(n=[a],r=[a.fromNode,a.toNode],l=[a],c=[]):(n=[],r=[],l=[],c=[]),this.focusLinkSelection=this.updateLinkSelection({nodeData:n,datumSelection:this.focusLinkSelection}),this.updateLinkNodes({datumSelection:this.focusLinkSelection,isHighlight:!1}),this.focusNodeSelection=this.updateNodeSelection({nodeData:r,datumSelection:this.focusNodeSelection}),this.updateNodeNodes({datumSelection:this.focusNodeSelection,isHighlight:!1}),this.highlightLinkSelection=this.updateLinkSelection({nodeData:l,datumSelection:this.highlightLinkSelection}),this.updateLinkNodes({datumSelection:this.highlightLinkSelection,isHighlight:!0}),this.highlightNodeSelection=this.updateNodeSelection({nodeData:c,datumSelection:this.highlightNodeSelection}),this.updateNodeNodes({datumSelection:this.highlightNodeSelection,isHighlight:!0})}resetAnimation(e){}dataCount(){return Number.NaN}getSeriesDomain(e){return[]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}legendItemSymbol(e,t,i={}){const{fills:o,strokes:s}=this.properties,{fill:a=o[t%o.length],fillOpacity:n=1,stroke:r=s[t%s.length],strokeWidth:l=0,strokeOpacity:c=1,lineDash:h=[0],lineDashOffset:p=0}=i;return{marker:{fill:a,fillOpacity:n,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}}}getLegendData(e){if(e!=="category")return[];const{showInLegend:t}=this.properties;return Array.from(this.processedNodes.values(),({id:i,label:o},s)=>({legendType:"category",id:this.id,itemId:i,seriesId:this.id,enabled:!0,label:{text:o??i},symbol:this.legendItemSymbol(1,s),hideInLegend:!t,isFixed:!0}))}pickNodeClosestDatum({x:e,y:t}){let i=1/0,o;return this.linkSelection.each((s,a)=>{const n=s.distanceSquared(e,t);n{const n=s.distanceSquared(e,t);nh.datum),c=r.indexOf(o)+t;c>=0&&c0?s=r.at(-1):s=Array.from(this.nodeSelection,p=>p.datum).at(-1)}else if(o?.type===1){const r=Array.from(this.nodeSelection,h=>h.datum),c=r.indexOf(o)+t;c>=0&&cp.datum)[0]}if(s==null)return;const a=s.type===1?Array.from(this.nodeSelection).find(r=>r.datum===s):Array.from(this.linkSelection).find(r=>r.datum===s);if(a==null)return;const n=this.computeFocusBounds(a.node);if(n!=null)return{datum:a.datum,datumIndex:this.contextNodeData?.nodeData.indexOf(a.datum)??0,otherIndex:0,bounds:n,clipFocusBox:!0}}getCategoryValue(e){}datumIndexForCategoryValue(e){}};import{_ModuleSupport as GR}from"ag-charts-community";var{Path:KR,SceneChangeDetection:es}=GR;function HS({radius:e,startAngle:t,endAngle:i,tension:o}){const s=e*Math.cos(t),a=e*Math.sin(t),n=e*Math.cos(i),r=e*Math.sin(i),l=s*o,c=a*o,h=n*o,p=r*o;return{x:[s,l,h,n],y:[a,c,p,r]}}var ko=class extends KR{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.radius=0,this.startAngle1=0,this.endAngle1=0,this.startAngle2=0,this.endAngle2=0,this.tension=1}tensionedCurveTo(e,t,i,o,s,a,n,r){const{path:l,tension:c}=this,h=1-c;l.cubicCurveTo((i-e)*h+e,(o-t)*h+t,(s-n)*h+n,(a-r)*h+r,n,r)}updatePath(){const{path:e,centerX:t,centerY:i,radius:o}=this;let{startAngle1:s,endAngle1:a,startAngle2:n,endAngle2:r}=this;s>n&&([s,n]=[n,s],[a,r]=[r,a]),e.clear();const l=t+o*Math.cos(s),c=i+o*Math.sin(s);e.moveTo(l,c),this.tensionedCurveTo(l,c,t,i,t,i,t+o*Math.cos(r),i+o*Math.sin(r)),e.arc(t,i,o,r,n,!0),this.tensionedCurveTo(t+o*Math.cos(n),i+o*Math.sin(n),t,i,t,i,t+o*Math.cos(a),i+o*Math.sin(a)),e.arc(t,i,o,a,s,!0),e.closePath()}};d([es()],ko.prototype,"centerX",2),d([es()],ko.prototype,"centerY",2),d([es()],ko.prototype,"radius",2),d([es()],ko.prototype,"startAngle1",2),d([es()],ko.prototype,"endAngle1",2),d([es()],ko.prototype,"startAngle2",2),d([es()],ko.prototype,"endAngle2",2),d([es()],ko.prototype,"tension",2);import{_ModuleSupport as $R}from"ag-charts-community";var{FillGradientDefaults:jR,FillPatternDefaults:YR,FillImageDefaults:UR,BaseProperties:VS,makeSeriesTooltip:XR,SeriesProperties:ZR,Property:ae,Label:qR}=$R,Yp=class extends qR{constructor(){super(...arguments),this.spacing=1,this.maxWidth=1}};d([ae],Yp.prototype,"spacing",2),d([ae],Yp.prototype,"maxWidth",2);var Xi=class extends VS{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0,this.tension=0}getStyle(e,t,i){const{fillOpacity:o,strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r,tension:l}=this,c=this.fill??e[i%e.length],h=this.stroke??t[i%e.length];return{fill:c,fillOpacity:o,stroke:h,strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r,tension:l}}};d([ae],Xi.prototype,"fill",2),d([ae],Xi.prototype,"fillOpacity",2),d([ae],Xi.prototype,"stroke",2),d([ae],Xi.prototype,"strokeOpacity",2),d([ae],Xi.prototype,"strokeWidth",2),d([ae],Xi.prototype,"lineDash",2),d([ae],Xi.prototype,"lineDashOffset",2),d([ae],Xi.prototype,"tension",2),d([ae],Xi.prototype,"itemStyler",2);var Ci=class extends VS{constructor(){super(...arguments),this.spacing=1,this.width=1,this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t,i){const{fillOpacity:o,strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r}=this,l=this.fill??e[i%e.length],c=this.stroke??t[i%e.length];return{fill:l,fillOpacity:o,stroke:c,strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r}}};d([ae],Ci.prototype,"spacing",2),d([ae],Ci.prototype,"width",2),d([ae],Ci.prototype,"fill",2),d([ae],Ci.prototype,"fillOpacity",2),d([ae],Ci.prototype,"stroke",2),d([ae],Ci.prototype,"strokeOpacity",2),d([ae],Ci.prototype,"strokeWidth",2),d([ae],Ci.prototype,"lineDash",2),d([ae],Ci.prototype,"lineDashOffset",2),d([ae],Ci.prototype,"itemStyler",2);var Ue=class extends ZR{constructor(){super(),this.idKey="",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.sizeKey=void 0,this.sizeName=void 0,this.nodes=void 0,this.fillGradientDefaults=new jR,this.fillPatternDefaults=new YR,this.fillImageDefaults=new UR,this.fills=[],this.strokes=[],this.label=new Yp,this.link=new Xi,this.node=new Ci,this.tooltip=XR(),this.highlightStyle.deprecated=!1}};d([ae],Ue.prototype,"fromKey",2),d([ae],Ue.prototype,"toKey",2),d([ae],Ue.prototype,"idKey",2),d([ae],Ue.prototype,"idName",2),d([ae],Ue.prototype,"labelKey",2),d([ae],Ue.prototype,"labelName",2),d([ae],Ue.prototype,"sizeKey",2),d([ae],Ue.prototype,"sizeName",2),d([ae],Ue.prototype,"nodes",2),d([ae],Ue.prototype,"fillGradientDefaults",2),d([ae],Ue.prototype,"fillPatternDefaults",2),d([ae],Ue.prototype,"fillImageDefaults",2),d([ae],Ue.prototype,"fills",2),d([ae],Ue.prototype,"strokes",2),d([ae],Ue.prototype,"label",2),d([ae],Ue.prototype,"link",2),d([ae],Ue.prototype,"node",2),d([ae],Ue.prototype,"tooltip",2);var{SeriesNodePickMode:WS,createDatumId:bc,angleBetween:vc,normalizeAngle360:QR,isBetweenAngles:GS,Sector:JR,evaluateBezier:kc,applyShapeStyle:KS,getShapeStyle:Dc,getLabelStyles:eE,BBox:tE,mergeDefaults:Mc}=NR,Ac=e=>e.startAngle+vc(e.startAngle,e.endAngle)/2,Ic=class extends FS{constructor(e){super({moduleCtx:e,pickModes:[WS.NEAREST_NODE,WS.EXACT_SHAPE_MATCH]}),this.properties=new Ue}isLabelEnabled(){return(this.properties.labelKey!=null||this.nodes==null)&&this.properties.label.enabled}linkFactory(){return new ko}nodeFactory(){return new JR}createNodeData(){const{id:e,_nodeDataDependencies:{seriesRectWidth:t,seriesRectHeight:i}={seriesRectWidth:0,seriesRectHeight:0},properties:o}=this,{fromKey:s,toKey:a,sizeKey:n,labelKey:r,label:{spacing:l,maxWidth:c,fontSize:h},node:{width:p,spacing:u}}=o,g=t/2,y=i/2;let f=[];const{nodeGraph:x,links:S}=this.getNodeGraph(E=>({...E,centerX:g,centerY:y,innerRadius:Number.NaN,outerRadius:Number.NaN,startAngle:Number.NaN,endAngle:Number.NaN}),E=>({...E,centerX:g,centerY:y,radius:Number.NaN,startAngle1:Number.NaN,endAngle1:Number.NaN,startAngle2:Number.NaN,endAngle2:Number.NaN}),{includeCircularReferences:!0});let v=0;for(const[E,{datum:T,linksBefore:w,linksAfter:C}]of x.entries()){const I=w.reduce((O,{link:z})=>O+z.size,0)+C.reduce((O,{link:z})=>O+z.size,0);if(I===0)x.delete(E);else{const{label:O}=o;T.size=I,v+=T.size;const z=O.enabled?this.getLabelText(T.label,T.datum,r,"label",[],O,{datum:T.datum,value:T.label,fromKey:s,toKey:a,sizeKey:n,size:T.size}):void 0;T.label=_R(z)}}let m=0;if(this.isLabelEnabled()){const E=PR(this.properties.label);let T=0;for(const{datum:w}of x.values()){const{id:C,label:I}=w;if(I==null)continue;const O=RR(I,{maxWidth:c,font:this.properties.label,textWrap:"never"}),{width:z}=E.measureLines(O);T=Math.max(z,T),f.push({id:C,text:O,centerX:g,centerY:y,angle:Number.NaN,radius:Number.NaN,size:w.size})}m=T+l}const b=x.size;let k=Math.min(t,i)/2-p-m,A=u/k;if(m!==0&&(b*A>=1.5*Math.PI||k<=0)&&(f=[],k=Math.min(t,i)/2-p,A=u/k),b*A>=2*Math.PI||k<=0){wR.warnOnce("There was insufficient space to display the Chord Series.");return}const M=k,D=k+p,L=Math.max((2*Math.PI-b*A)/v,0);let N=0;for(const{datum:E}of x.values()){E.innerRadius=M,E.outerRadius=D,E.startAngle=N,E.endAngle=N+E.size*L,N=E.endAngle+A;const T=(E.innerRadius+E.outerRadius)/2,w=Ac(E);E.midPoint={x:E.centerX+T*Math.cos(w),y:E.centerY+T*Math.sin(w)}}const P=[];for(const{datum:E,linksBefore:T,linksAfter:w}of x.values()){const C=Ac(E),I=[...T.map(z=>({link:z.link,distance:vc(Ac(z.node.datum),C),after:!1})),...w.map(z=>({link:z.link,distance:vc(Ac(z.node.datum),C),after:!0}))];let O=E.startAngle;for(const{link:z,after:B}of I.toSorted((H,W)=>H.distance-W.distance)){const H=z.size*L;B?(z.startAngle1=O,z.endAngle1=O+H):(z.startAngle2=O,z.endAngle2=O+H),O+=z.size*L}P.push(E)}const{tension:R}=this.properties.link;for(const E of S){E.radius=k;const T=HS({radius:k,startAngle:E.startAngle1,endAngle:E.endAngle2,tension:R}),w=HS({radius:k,startAngle:E.startAngle2,endAngle:E.endAngle1,tension:R}),C=kc(...T.x,.5),I=kc(...T.y,.5),O=kc(...w.x,.5),z=kc(...w.y,.5);E.midPoint={x:E.centerX+(C+O)/2,y:E.centerY+(I+z)/2},P.push(E)}for(const E of f){const T=x.get(E.id)?.datum;T!=null&&(E.radius=D+l,E.angle=QR(T.startAngle+vc(T.startAngle,T.endAngle)/2))}f.sort((E,T)=>E.angle-T.angle);let F=1/0,_=-1/0;return f=f.filter(E=>{const T=OR(h),w=Math.atan2(T/2,E.radius),C=E.angle-w,I=E.angle+w;return GS(F,C,I)||GS(_,C,I)?!1:(F=Math.min(C,F),_=Math.max(I,_),!0)}),{itemId:e,nodeData:P,labelData:f}}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const t={toKey:this.properties.toKey,fromKey:this.properties.fromKey,sizeKey:this.properties.sizeKey,size:Number.NaN},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((o,{size:s,text:a,centerX:n,centerY:r,radius:l,angle:c})=>{t.size=s;const h=eE(this,void 0,t,this.properties.label,!1,i),{fontStyle:p,fontWeight:u,fontSize:g,fontFamily:y,color:f}=h;o.visible=!0,o.translationX=n+l*Math.cos(c),o.translationY=r+l*Math.sin(c),o.text=a,o.fill=f,o.fontStyle=p,o.fontWeight=u,o.fontSize=g,o.fontFamily=y,o.textBaseline="middle",Math.cos(c)>=0?(o.textAlign="left",o.rotation=c):(o.textAlign="right",o.rotation=c-Math.PI),o.setBoxing(h)})}updateNodeSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>bc(t.type,t.id))}getNodeStyle(e,t,i){const{properties:o}=this,{fills:s,strokes:a,fillGradientDefaults:n,fillPatternDefaults:r,fillImageDefaults:l}=o,{itemStyler:c}=o.node,h=this.getHighlightStyle(i,e.datumIndex),p=Mc(h,o.node.getStyle(s,a,t));let u=Dc(p,n,r,l);if(c!=null&&e.datumIndex!=null){const g=this.cachedDatumCallback(bc(e.datumIndex.index,"node",i?"highlight":"node"),()=>{const y=this.makeItemStylerParams(e,i,u);return this.callWithContext(c,y)});g&&(u=Dc(Mc(g,u),n,r,l))}return u.opacity=1,u}makeItemStylerParams({datum:e,datumIndex:t,size:i=0,label:o},s,a){const{id:n}=this,r=this.ctx.highlightManager?.getActiveHighlight(),l=this.getHighlightStateString(r,s,t),c=this.filterItemStylerFillParams(a.fill)??a.fill;return{seriesId:n,datum:e,highlighted:s,highlightState:l,...a,size:i,label:o,fill:c}}updateNodeNodes(e){const{datumSelection:t,isHighlight:i}=e,o=this.getShapeFillBBox();t.each((s,a)=>{const{datumIndex:n}=a,r=this.getNodeStyle(a,n.index,i);KS(s,r,o),s.centerX=a.centerX,s.centerY=a.centerY,s.innerRadius=a.innerRadius,s.outerRadius=a.outerRadius,s.startAngle=a.startAngle,s.endAngle=a.endAngle,s.inset=s.strokeWidth/2})}updateLinkSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>bc(t.type,t.index,t.fromNode.id,t.toNode.id))}getLinkStyle({datumIndex:e,datum:t},i,o){const{id:s,properties:a}=this,{fills:n,strokes:r,fillGradientDefaults:l,fillPatternDefaults:c,fillImageDefaults:h}=a,{itemStyler:p}=a.link,u=this.getHighlightStyle(o,e),g=Mc(u,a.link.getStyle(n,r,i.index));let y=Dc(g,l,c,h);if(p!=null&&e!=null){const f=this.ctx.highlightManager?.getActiveHighlight(),x=this.cachedDatumCallback(bc(e.index,"link",o?"highlight":"node"),()=>{const S=this.getHighlightStateString(f,o,i);return this.callWithContext(p,{seriesId:s,datum:t,highlighted:o,highlightState:S,...y})});x&&(y=Dc(Mc(x,y),l,c,h))}return y.opacity=1,y}updateLinkNodes(e){const{datumSelection:t,isHighlight:i}=e,o=this.getShapeFillBBox();t.each((s,a)=>{const n=a.fromNode.datumIndex,r=this.getLinkStyle(a,n,i);s.centerX=a.centerX,s.centerY=a.centerY,s.radius=a.radius,s.startAngle1=a.startAngle1,s.endAngle1=a.endAngle1,s.startAngle2=a.startAngle2,s.endAngle2=a.endAngle2,s.tension=r.tension,KS(s,r,o)})}getShapeFillBBox(){const e=this._nodeDataDependencies?.seriesRectWidth??0,t=this._nodeDataDependencies?.seriesRectHeight??0,i=Math.min(e,t),o=(e-i)/2,s=(t-i)/2,a=new tE(o,s,e,t);return{series:a,axis:a}}getTooltipContent(e){const{id:t,linksProcessedData:i,nodesProcessedData:o,properties:s,ctx:{formatManager:a}}=this,{fromKey:n,toKey:r,sizeKey:l,sizeName:c,tooltip:h}=s,p=this.contextNodeData?.nodeData.find(v=>v.datumIndex.type===e.type&&v.datumIndex.index===e.index);if(p==null)return;const u=p.type===0?p.fromNode.index:p.index,g=p.type===0?`${p.fromNode.label} - ${p.toNode.label}`:p.label,y=e.type===0?i?.dataSources.get(this.id)?.data[e.index]:o?.dataSources.get(this.id)?.data[e.index],f=p.size;let x;if(p.type===0){const v=p.fromNode.datumIndex;x=this.getLinkStyle({datumIndex:e,datum:y},v,!1)}else{const v=p.label;x=this.getNodeStyle({datumIndex:e,datum:y,size:f,label:v},e.index,!1)}const S=[];if(l!=null){const v=a.format(this.callWithContext.bind(this),{type:"number",value:f,datum:y,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",domain:[],boundSeries:this.getFormatterContext("size"),fractionDigits:void 0});S.push({label:c,fallbackLabel:l,value:v??String(f)})}return this.formatTooltipWithContext(h,{title:g,symbol:this.legendItemSymbol(p.type,u,x),data:S},{seriesId:t,datum:y,title:g,fromKey:n,toKey:r,sizeKey:l,sizeName:c,size:f,...x})}computeFocusBounds(e){return e}hasItemStylers(){return this.properties.node.itemStyler!=null||this.properties.link.itemStyler!=null||this.properties.label.itemStyler!=null}};Ic.className="ChordSeries",Ic.type="chord";import{_ModuleSupport as iE}from"ag-charts-community";import{constant as oE,fillGradientDefaults as sE,fillImageDefaults as aE,fillPatternDefaults as nE,required as Up,string as Lc,undocumented as Xp}from"ag-charts-core";var{commonSeriesOptionsDefs:rE,chordSeriesThemeableOptionsDef:lE}=iE,Tc={...lE,...rE,type:Up(oE("chord")),fromKey:Up(Lc),toKey:Up(Lc),sizeKey:Lc,sizeName:Lc};Tc.fillGradientDefaults=Xp(sE),Tc.fillPatternDefaults=Xp(nE),Tc.fillImageDefaults=Xp(aE);var cE={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],solo:!0,identifier:"chord",moduleFactory:e=>new Ic(e),themeTemplate:{series:{fills:{$palette:"fills"},strokes:{$palette:"strokes"},fillGradientDefaults:Zn.FILL_GRADIENT_LINEAR_DEFAULTS,fillPatternDefaults:Zn.FILL_PATTERN_DEFAULTS,fillImageDefaults:Zn.FILL_IMAGE_DEFAULTS,highlightStyle:{series:{dimOpacity:.2}},highlight:Zn.singleSeriesHighlightStyle(),label:{...Zn.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:5,maxWidth:100},node:{spacing:8,width:10,strokeWidth:{$isUserOption:["./stroke",2,0]}},link:{fillOpacity:.5,strokeWidth:{$isUserOption:["./stroke",2,0]},tension:.4}},legend:{enabled:!1,toggleSeries:!1}}},hE={type:"series",name:"chord",chartType:"standalone",enterprise:!0,options:Tc,create:e=>new Ic(e)};import{_ModuleSupport as Ka}from"ag-charts-community";var{ThemeConstants:{CARTESIAN_AXIS_TYPE:$a,CARTESIAN_POSITION:ja},ThemeSymbols:{DEFAULT_SHADOW_COLOUR:dE}}=Ka,Ya={$eq:[{$path:["/series/0/direction",void 0]},"horizontal"]},$S={autoRotate:{$path:"/series/0/stageLabel/autoRotate"},autoRotateAngle:{$path:"/series/0/stageLabel/autoRotateAngle"},avoidCollisions:{$path:["/series/0/stageLabel/avoidCollisions",!0]},border:{$path:["/series/0/stageLabel/border"]},color:{$path:["/series/0/stageLabel/color",{$ref:"textColor"}]},cornerRadius:{$path:["/series/0/stageLabel/cornerRadius"]},enabled:{$if:[{$eq:[{$path:"/series/0/stageLabel/enabled"},void 0]},!0,{$path:"/series/0/stageLabel/enabled"}]},fill:{$path:["/series/0/stageLabel/fill"]},fillOpacity:{$path:["/series/0/stageLabel/fillOpacity"]},fontSize:{$path:["/series/0/stageLabel/fontSize",{$ref:"fontSize"}]},fontStyle:{$path:["/series/0/stageLabel/fontStyle",{$ref:"fontStyle"}]},fontWeight:{$path:["/series/0/stageLabel/fontWeight",{$ref:"fontWeight"}]},format:{$path:"/series/0/stageLabel/format"},formatter:{$path:"/series/0/stageLabel/formatter"},itemStyler:{$path:"/series/0/stageLabel/itemStyler"},minSpacing:{$path:"/series/0/stageLabel/minSpacing"},padding:{$path:["/series/0/stageLabel/padding"]},rotation:{$path:["/series/0/stageLabel/rotation",0]}},jS=[{type:{$if:[Ya,$a.NUMBER,$a.CATEGORY]},position:{$if:[Ya,ja.LEFT,{$if:[{$eq:[{$path:["/series/0/stageLabel/placement",void 0]},"after"]},ja.RIGHT,ja.LEFT]}]},label:{$if:[Ya,void 0,$S]}},{type:{$if:[Ya,$a.CATEGORY,$a.NUMBER]},position:{$if:[Ya,{$if:[{$eq:[{$path:["/series/0/stageLabel/placement",void 0]},"before"]},ja.TOP,ja.BOTTOM]},ja.BOTTOM]},label:{$if:[Ya,$S,void 0]}}],pE={series:{direction:"vertical",strokeWidth:{$isUserOption:["./strokes/0",2,0]},spacingRatio:.25,fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},[{$path:["/0",void 0,{$palette:"fills"}]}],{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",Ka.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS],["pattern",Ka.FILL_PATTERN_SINGLE_DEFAULTS],["image",Ka.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},[{$path:["/0",void 0,{$palette:"strokes"}]}]]},label:{...Ka.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},dropOff:{enabled:!0,fillOpacity:.2,strokeWidth:{$isUserOption:["./stroke",2,0]}},shadow:{enabled:!1,color:dE,xOffset:3,yOffset:3,blur:5},highlight:Ka.singleSeriesHighlightStyle()},axes:{[$a.NUMBER]:{nice:!1,gridLine:{enabled:!1},crosshair:{enabled:!1},label:{enabled:!1}},[$a.CATEGORY]:{line:{enabled:!1}}}};import{_ModuleSupport as uE}from"ag-charts-community";import{_ModuleSupport as Zp}from"ag-charts-community";import{_ModuleSupport as gE}from"ag-charts-community";var{lineDistanceSquared:Cc,BBox:yE,Path:fE,SceneChangeDetection:ts}=gE,YS=1e-6;function US([e,t],[i,o]){return Math.abs(e-i)<=YS&&Math.abs(t-o)<=YS}var Zi=class extends fE{constructor(){super(...arguments),this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0}get midPoint(){const{x0:e,y0:t,x1:i,y1:o,x2:s,y2:a,x3:n,y3:r}=this;return{x:(e+i+s+n)/4,y:(t+o+a+r)/4}}distanceSquared(e,t){if(this.containsPoint(e,t))return 0;const{x0:i,y0:o,x1:s,y1:a,x2:n,y2:r,x3:l,y3:c}=this;return Math.min(Cc(e,t,i,o,s,a,1/0),Cc(e,t,s,a,n,r,1/0),Cc(e,t,n,r,l,c,1/0),Cc(e,t,l,c,i,o,1/0))}computeBBox(){const{x0:e,y0:t,x1:i,y1:o,x2:s,y2:a,x3:n,y3:r}=this,l=Math.min(e,i,s,n),c=Math.max(e,i,s,n)-l,h=Math.min(t,o,a,r),p=Math.max(t,o,a,r)-h;return new yE(l,h,c,p)}updatePath(){const{path:e,x0:t,y0:i,x1:o,y1:s,x2:a,y2:n,x3:r,y3:l}=this,c=[[t,i],[o,s],[a,n],[r,l]];e.clear();let h,p;for(const u of c){if(h!=null&&US(h,u)||p!=null&&US(p,u))continue;const[g,y]=u;h==null?e.moveTo(g,y):e.lineTo(g,y),h??(h=u),p=u}e.closePath()}};d([ts()],Zi.prototype,"x0",2),d([ts()],Zi.prototype,"y0",2),d([ts()],Zi.prototype,"x1",2),d([ts()],Zi.prototype,"y1",2),d([ts()],Zi.prototype,"x2",2),d([ts()],Zi.prototype,"y2",2),d([ts()],Zi.prototype,"x3",2),d([ts()],Zi.prototype,"y3",2);import{_ModuleSupport as mE}from"ag-charts-community";var{NODE_UPDATE_STATE_TO_PHASE_MAPPING:xE}=mE;function XS(e,t,i,o){const{x0:s,y0:a,x1:n,y1:r,x2:l,y2:c,x3:h,y3:p,opacity:u}=e;return i?{x0:(s+h)/2,y0:(a+p)/2,x1:(n+l)/2,y1:(r+c)/2,x2:(n+l)/2,y2:(r+c)/2,x3:(s+h)/2,y3:(a+p)/2,opacity:u}:{x0:(s+n)/2,y0:(a+r)/2,x1:(s+n)/2,y1:(a+r)/2,x2:(l+h)/2,y2:(c+p)/2,x3:(l+h)/2,y3:(c+p)/2,opacity:u}}function SE(e,t){const i=a=>a==null;return{fromFn:(a,n,r)=>{r==="updated"&&i(n)?r="removed":r==="updated"&&i(a.previousDatum)&&(r="added");let l;r==="added"&&a.previousDatum==null&&t==="fade"?l={...qn(a,n),opacity:0}:r==="unknown"||r==="added"?l=XS(n,a.previousDatum,e,t):l={x0:a.x0,y0:a.y0,x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2,x3:a.x3,y3:a.y3,opacity:a.opacity};const c=xE[r];return{...l,phase:c}},toFn:(a,n,r)=>{let l;return r==="removed"&&a.datum==null&&t==="fade"?l={...qn(a,n),opacity:0}:r==="removed"||i(n)?l=XS(n,a.previousDatum,e,t):l=qn(a,n),l}}}function qn(e,t){const{x0:i,y0:o,x1:s,y1:a,x2:n,y2:r,x3:l,y3:c,opacity:h}=t;return{x0:i,y0:o,x1:s,y1:a,x2:n,y2:r,x3:l,y3:c,opacity:h}}var{SeriesNodePickMode:ZS,SeriesZIndexMap:qS,valueProperty:bE,keyProperty:vE,ChartAxisDirection:kE,updateLabelNode:DE,SMALLEST_KEY_INTERVAL:ME,LARGEST_KEY_INTERVAL:AE,diff:IE,fixNumericExtent:LE,seriesLabelFadeInAnimation:QS,resetMotion:TE,resetLabelFn:CE,animationValidation:NE,computeBarFocusBounds:wE,ContinuousScale:PE,Group:OE,Selection:_E,PointerEvents:JS,motion:RE,checkCrisp:EE,createDatumId:BE,applyShapeStyle:zE}=Zp,FE=class extends Zp.SeriesNodeEvent{constructor(e,t,i,o){super(e,t,i,o),this.xKey=o.properties.stageKey,this.yKey=o.properties.valueKey}},eb=class extends Zp.AbstractBarSeries{constructor({moduleCtx:e,animationResetFns:t}){super({moduleCtx:e,pickModes:[ZS.AXIS_ALIGNED,ZS.EXACT_SHAPE_MATCH],propertyKeys:{x:["stageKey"],y:["valueKey"]},propertyNames:{x:[],y:[]},categoryKey:"xValue",datumSelectionGarbageCollection:!1,animationResetFns:{datum:t.datum,label:CE}}),this.NodeEvent=FE,this.connectorNodeGroup=this.contentGroup.appendChild(new OE({name:`${this.id}-series-connectorNodes`,zIndex:qS.BACKGROUND})),this.connectorSelection=_E.select(this.connectorNodeGroup,()=>this.connectionFactory()),this.connectorNodeGroup.pointerEvents=JS.None}get pickModeAxis(){return"main-category"}setZIndex(e){return super.setZIndex(e),this.connectorNodeGroup.zIndex=[qS.BACKGROUND,e],!0}isVertical(){return!super.isVertical()}connectionFactory(){return new Zi}async processData(e){const{stageKey:t,valueKey:i}=this.properties,{visible:o,id:s}=this,a=(y,f,x)=>o&&this.ctx.legendManager.getItemEnabled({seriesId:s,itemId:x}),n=this.getCategoryAxis()?.scale,r=this.getValueAxis()?.scale,{isContinuousX:l,xScaleType:c,yScaleType:h}=this.getScaleInformation({xScale:n,yScale:r}),p=[];this.ctx.animationManager.isSkipped()||(this.processedData&&p.push(IE(this.id,this.processedData)),p.push(NE()));const u=this.visible?{}:{forceValue:0},{processedData:g}=await this.requestDataModel(e,this.data,{props:[vE(t,c,{id:"xValue"}),bE(i,h,{id:"yValue",...u,validation:a,invalidValue:0}),...l?[ME,AE]:[],...p],groupByKeys:!1});this.smallestDataInterval=g.reduced?.smallestKeyInterval,this.largestDataInterval=g.reduced?.largestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i,id:o,ctx:{legendManager:s}}=this;if(!t||!i)return[];const{keys:[a]}=t.domain;if(e===this.getCategoryDirection()){const n=i.resolveProcessedDataDefById(this,"xValue");return n?.def.type==="key"&&n?.def.valueType==="category"?this.hasData?a.filter((r,l)=>s.getItemEnabled({seriesId:o,itemId:l})):[]:this.padBandExtent(a)}else{const n=this.domainForClippedRange(e,["yValue"],"xValue"),r=Math.max(...n),l=[-r,r];return LE(l)}}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{hasData:e,data:t,dataModel:i,groupScale:o,processedData:s,id:a,ctx:{legendManager:n}}=this,r=this.getCategoryAxis(),l=this.getValueAxis();if(!(e&&t&&r&&l&&i&&s?.type==="ungrouped"))return;const c=r.scale,h=l.scale,p=this.getBarDirection()===kE.X,{stageKey:u,valueKey:g}=this.properties,y=`${g}`,f={itemId:y,nodeData:[],labelData:[],connectorData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible},x=this.visible;if(!x)return f;const S=i.resolveKeysById(this,"xValue",s),v=i.resolveColumnById(this,"yValue",s),{barWidth:m,groupIndex:b}=this.updateGroupScale(r),k=PE.is(c)?m*-.5:0,A=EE(r?.scale,r?.visibleRange,this.smallestDataInterval,this.largestDataInterval);let M;const D=s.dataSources.get(this.id)?.data??[];for(const[L,N]of D.entries()){const P=x&&n.getItemEnabled({seriesId:a,itemId:L}),R=S[L];if(R==null)continue;const F=Math.round(c.convert(R))+o.convert(String(b))+k,_=v[L],E=Math.round(h.convert(-_)),T=Math.round(h.convert(_)),w=this.getItemStyle({datum:N,datumIndex:L},!1),C=Math.max(w.strokeWidth??0,Math.abs(T-E)),I={x:p?Math.min(T,E):F,y:p?F:Math.min(T,E),width:p?C:m,height:p?m:C},O={x:I.x+I.width/2,y:I.y+I.height/2},z=this.createLabelData({datumIndex:L,rect:I,barAlongX:p,yDatum:_,datum:N,visible:P}),B={index:L,series:this,itemId:y,datum:N,datumIndex:L,xValue:R,yValue:_,xKey:u,yKey:g,x:I.x,y:I.y,width:I.width,height:I.height,midPoint:O,crisp:A,label:z,visible:P};if(f.nodeData.push(B),z!=null&&f.labelData.push(z),M!=null){const H=M.rect,W=M.nodeDatum,V=M.datumIndex;p?f.connectorData.push({datum:W,datumIndex:V,x0:H.x,y0:H.y+H.height,x1:H.x+H.width,y1:H.y+H.height,x2:I.x+I.width,y2:I.y,x3:I.x,y3:I.y,opacity:1}):f.connectorData.push({datum:W,datumIndex:V,x0:H.x+H.width,y0:H.y,x1:I.x,y1:I.y,x2:I.x,y2:I.y+I.height,x3:H.x+H.width,y3:H.y+H.height,opacity:1})}P&&(M={itemId:y,rect:I,nodeDatum:B,datumIndex:L})}return f}updateNodes(e,t){super.updateNodes(e,t);const{connectorSelection:i}=this,o=this.contextNodeData?.connectorData??[];this.connectorSelection=this.updateConnectorSelection({connectorSelection:i,connectorData:o}),this.updateConnectorNodes({connectorSelection:i})}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,o=t??[];return i.update(o,void 0,s=>this.getDatumId(s))}updateConnectorSelection(e){const{connectorData:t,connectorSelection:i}=e;return i.update(this.connectorEnabled()?t:[],void 0,o=>this.getDatumId(o.datum))}updateConnectorNodes(e){const t=this.getShapeFillBBox();e.connectorSelection.each((i,o)=>{const{fill:s,fillOpacity:a,stroke:n,strokeOpacity:r,strokeWidth:l,lineDash:c,lineDashOffset:h}=this.connectorStyle(o.datumIndex);i.setProperties(qn(i,o)),zE(i,{fill:s,stroke:n,fillOpacity:a,strokeOpacity:r,strokeWidth:l,lineDash:c,lineDashOffset:h},t)})}updateLabelSelection(e){const t=this.properties.label.enabled?e.labelData:[];return e.labelSelection.update(t,i=>{i.pointerEvents=JS.None})}updateLabelNodes(e){const t={stageKey:this.properties.stageKey,valueKey:this.properties.valueKey},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((o,s)=>{o.fillOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1,DE(this,o,t,this.properties.label,s,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:o,properties:s}=this,{stageKey:a,valueKey:n,tooltip:r,legendItemName:l}=s,c=this.getCategoryAxis(),h=this.getValueAxis();if(!i||!o||!c||!h)return;const p=o.dataSources.get(this.id)?.data[e],u=i.resolveKeysById(this,"xValue",o)[e],g=i.resolveColumnById(this,"yValue",o)[e];if(u!=null)return this.formatTooltipWithContext(r,{symbol:this.legendItemSymbol(e),data:[{label:this.getAxisValueText(c,"tooltip",u,p,a,l),value:this.getAxisValueText(h,"tooltip",g,p,n,l)}]},{seriesId:t,datum:p,title:a,stageKey:a,valueKey:n,...this.tooltipStyle(p,e)})}resetAllAnimation(e){super.resetAllAnimation(e),TE([this.connectorSelection],qn)}animateEmptyUpdateReady({labelSelection:e}){const{connectorSelection:t}=this,i=this.isVertical(),s=SE(i,"normal");RE.fromToMotion(this.id,"connectors",this.ctx.animationManager,[t],s),QS(this,"labels",this.ctx.animationManager,e)}animateWaitingUpdateReady(e){const{labelSelection:t}=e;this.ctx.animationManager.stopByAnimationGroupId(this.id),QS(this,"labels",this.ctx.animationManager,t)}getDatumId(e){return BE(e.xValue)}isLabelEnabled(){return this.properties.label.enabled}computeFocusBounds({datumIndex:e}){return wE(this,this.contextNodeData?.nodeData[e])}legendItemSymbol(e){const{strokeWidth:t,fillOpacity:i,strokeOpacity:o,lineDash:s,lineDashOffset:a,fill:n,stroke:r}=this.properties.getStyle(e);return{marker:{fill:n,fillOpacity:i,stroke:r,strokeWidth:t,strokeOpacity:o,lineDash:s,lineDashOffset:a}}}getLegendData(e){const{id:t,processedData:i,dataModel:o,ctx:{legendManager:s},visible:a}=this;if(!o||!i||e!=="category")return[];const{showInLegend:n}=this.properties,r=o.resolveKeysById(this,"xValue",i);return(i.dataSources.get(this.id)?.data??[]).map((l,c)=>{const h=r[c];if(h!=null)return{legendType:"category",id:t,datum:l,itemId:c,seriesId:t,enabled:a&&s.getItemEnabled({seriesId:t,itemId:c}),label:{text:String(h)},symbol:this.legendItemSymbol(c),skipAnimations:!0,hideInLegend:!n}}).filter(l=>l!=null)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};import{_ModuleSupport as HE}from"ag-charts-community";var{Label:VE,AbstractBarSeriesProperties:WE,makeSeriesTooltip:GE,AxisLabel:KE,Property:At}=HE,qp=class extends VE{constructor(){super(...arguments),this.spacing=0}};d([At],qp.prototype,"placement",2),d([At],qp.prototype,"spacing",2);var tb=class extends KE{};d([At],tb.prototype,"placement",2);var qt=class extends WE{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.label=new qp,this.stageLabel=new tb,this.tooltip=GE()}getStyle(e){const{fills:t,strokes:i,fillOpacity:o,strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r}=this;return{fill:t[e],fillOpacity:o,stroke:i[e],strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r,opacity:1}}};d([At],qt.prototype,"stageKey",2),d([At],qt.prototype,"valueKey",2),d([At],qt.prototype,"fills",2),d([At],qt.prototype,"fillOpacity",2),d([At],qt.prototype,"strokes",2),d([At],qt.prototype,"strokeWidth",2),d([At],qt.prototype,"strokeOpacity",2),d([At],qt.prototype,"lineDash",2),d([At],qt.prototype,"lineDashOffset",2),d([At],qt.prototype,"label",2),d([At],qt.prototype,"stageLabel",2),d([At],qt.prototype,"tooltip",2);function ib(e,{x:t,y:i,width:o,height:s,opacity:a}){return{x1:t,y1:i,x2:t+o,y2:i+s,opacity:a??1}}var{Line:$E,ChartAxisDirection:jE}=uE,Nc=class extends eb{constructor(e){super({moduleCtx:e,animationResetFns:{datum:ib}}),this.properties=new qt}get hasData(){const{id:e,ctx:{legendManager:t}}=this,i=this.data?.data.reduce((o,s,a)=>o+(t.getItemEnabled({seriesId:e,itemId:a})?1:0),0);return i!=null&&i>1}getBandScalePadding(){return{inner:1,outer:0}}connectorEnabled(){return!0}getItemStyle({datumIndex:e},t){return this.properties.getStyle(e)}connectorStyle(e){return this.properties.getStyle(e)}nodeFactory(){return new $E}createLabelData({datumIndex:e,rect:t,barAlongX:i,yDatum:o,datum:s,visible:a}){const{stageKey:n,valueKey:r,label:l}=this.properties,{spacing:c,placement:h}=l;if(!l.enabled)return;let p,u,g,y;if(i)switch(p=t.x+t.width/2,g="center",h){case"before":u=t.y-c,y="bottom";break;case"after":u=t.y+t.height+c,y="top";break;default:u=t.y+t.height/2,y="middle"}else switch(u=t.y+t.height/2,y="middle",h){case"before":p=t.x-c,g="right";break;case"after":p=t.x+t.width+c,g="left";break;default:p=t.x+t.width/2,g="center"}const f=this.getSeriesDomain(jE.Y),x=this.getLabelText(o,s,r,"y",f,l,{itemId:r,value:o,datum:s,stageKey:n,valueKey:r});return{x:p,y:u,textAlign:g,textBaseline:y,text:x,itemId:r,datum:s,datumIndex:e,series:this,visible:a}}updateDatumNodes(e){const t=this.getHighlightStyle(e.isHighlight);e.datumSelection.each((i,o)=>{i.setProperties(ib(i,o)),i.stroke=t?.stroke,i.strokeWidth=t?.strokeWidth??0,i.strokeOpacity=t?.strokeOpacity??1,i.lineDash=t?.lineDash,i.lineDashOffset=t?.lineDashOffset??0,i.opacity=t?.opacity??1})}tooltipStyle(e,t){const{fill:i,stroke:o,fillOpacity:s,strokeOpacity:a,strokeWidth:n,lineDash:r,lineDashOffset:l}=this.properties.getStyle(t);return{fill:i,fillOpacity:s,stroke:o,strokeOpacity:a,strokeWidth:n,lineDash:r,lineDashOffset:l}}hasItemStylers(){return this.properties.label.itemStyler!=null}};Nc.className="ConeFunnelSeries",Nc.type="cone-funnel";import{_ModuleSupport as YE}from"ag-charts-community";import{constant as UE,required as Qp,string as ob}from"ag-charts-core";var{commonSeriesOptionsDefs:XE,coneFunnelSeriesThemeableOptionsDef:ZE,without:qE}=YE,QE={...qE(XE,["showInLegend"]),...ZE,type:Qp(UE("cone-funnel")),stageKey:Qp(ob),valueKey:Qp(ob)};import{_ModuleSupport as is}from"ag-charts-community";var{ThemeConstants:{CARTESIAN_AXIS_TYPE:sb}}=is,JE={series:{direction:"vertical",fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"secondSequentialColors"},is.SAFE_RANGE2_OPERATION]},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",is.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS],["pattern",is.FILL_PATTERN_SINGLE_DEFAULTS],["image",is.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"secondSequentialColors"},is.SAFE_RANGE2_OPERATION]}]},strokeWidth:{$isUserOption:["./strokes/0",2,0]},label:{...is.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},placement:"before",spacing:4},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:is.singleSeriesHighlightStyle(!1)},seriesArea:{padding:{top:20,bottom:20}},axes:{[sb.NUMBER]:{nice:!1,gridLine:{enabled:!1},crosshair:{enabled:!1},label:{enabled:!1}},[sb.CATEGORY]:{line:{enabled:!1}}}},eB={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"cone-funnel",moduleFactory:e=>new Nc(e),solo:!0,defaultAxes:jS,themeTemplate:JE},tB={type:"series",name:"cone-funnel",chartType:"cartesian",enterprise:!0,options:QE,create:e=>new Nc(e)};import{_ModuleSupport as iB}from"ag-charts-community";import{_ModuleSupport as oB}from"ag-charts-community";var{Label:sB,DropShadow:aB,AbstractBarSeriesProperties:nB,BaseProperties:rB,makeSeriesTooltip:lB,AxisLabel:cB,Property:xe}=oB,hB=class extends sB{},ab=class extends cB{};d([xe],ab.prototype,"placement",2);var Do=class extends rB{constructor(){super(...arguments),this.enabled=!0,this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(){const{fill:e,stroke:t,fillOpacity:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n}=this;return{fill:e,fillOpacity:i,stroke:t,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n,opacity:1}}};d([xe],Do.prototype,"enabled",2),d([xe],Do.prototype,"fill",2),d([xe],Do.prototype,"fillOpacity",2),d([xe],Do.prototype,"stroke",2),d([xe],Do.prototype,"strokeWidth",2),d([xe],Do.prototype,"strokeOpacity",2),d([xe],Do.prototype,"lineDash",2),d([xe],Do.prototype,"lineDashOffset",2);var dt=class extends nB{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.spacingRatio=0,this.dropOff=new Do,this.shadow=new aB().set({enabled:!1}),this.label=new hB,this.stageLabel=new ab,this.tooltip=lB()}getStyle(e){const{fills:t,strokes:i,fillOpacity:o,strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r}=this;return{fill:t[e],fillOpacity:o,stroke:i[e],strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r,opacity:1}}};d([xe],dt.prototype,"stageKey",2),d([xe],dt.prototype,"valueKey",2),d([xe],dt.prototype,"fills",2),d([xe],dt.prototype,"fillOpacity",2),d([xe],dt.prototype,"strokes",2),d([xe],dt.prototype,"strokeWidth",2),d([xe],dt.prototype,"strokeOpacity",2),d([xe],dt.prototype,"lineDash",2),d([xe],dt.prototype,"lineDashOffset",2),d([xe],dt.prototype,"spacingRatio",2),d([xe],dt.prototype,"itemStyler",2),d([xe],dt.prototype,"dropOff",2),d([xe],dt.prototype,"shadow",2),d([xe],dt.prototype,"label",2),d([xe],dt.prototype,"stageLabel",2),d([xe],dt.prototype,"tooltip",2);var{ChartAxisDirection:nb,resetBarSelectionsFn:dB,prepareBarAnimationFunctions:rb,midpointStartingBarPosition:lb,createDatumId:pB,Rect:uB,motion:cb,applyShapeStyle:gB,mergeDefaults:Jp}=iB,wc=class extends eb{constructor(e){super({moduleCtx:e,animationResetFns:{datum:dB}}),this.properties=new dt}getBandScalePadding(){return{inner:this.properties.spacingRatio,outer:0}}connectorEnabled(){return this.properties.dropOff.enabled}connectorStyle(e){return Jp(this.properties.dropOff.getStyle(),this.properties.getStyle(e))}nodeFactory(){return new uB}createLabelData({datumIndex:e,rect:t,yDatum:i,datum:o,visible:s}){const{valueKey:a,stageKey:n,label:r}=this.properties;if(!r.enabled)return;const l=this.getSeriesDomain(nb.Y),c=this.getLabelText(i,o,a,"y",l,r,{itemId:a,value:i,datum:o,stageKey:n,valueKey:a});return{x:t.x+t.width/2,y:t.y+t.height/2,textAlign:"center",textBaseline:"middle",text:c,itemId:n,datum:o,datumIndex:e,series:this,visible:s}}getItemStyle({datum:e,datumIndex:t},i){const{id:o,properties:s}=this,{stageKey:a,valueKey:n,itemStyler:r}=s,l=this.getHighlightStyle(i,t);let h=Jp(l,s.getStyle(t));if(r!=null){const p=this.ctx.highlightManager?.getActiveHighlight(),u=this.cachedDatumCallback(pB(t,i?"highlight":"node"),()=>{const g=this.getHighlightStateString(p,i,t);return this.callWithContext(r,{seriesId:o,datum:e,highlighted:i,highlightState:g,stageKey:a,valueKey:n,...h})});u&&(h=Jp(u,h))}return h}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const{shadow:o}=this.properties,s=this.getCategoryDirection()===nb.X,a=this.getShapeFillBBox();e.each((n,r)=>{const l=this.getItemStyle(r,t);gB(n,l,a),n.visible=s?r.width>0:r.height>0,n.crisp=r.crisp,n.fillShadow=o})}tooltipStyle(e,t){return this.getItemStyle({datum:e,datumIndex:t},!1)}animateEmptyUpdateReady(e){super.animateEmptyUpdateReady(e);const{datumSelection:t}=e,i=this.isVertical(),s=rb(lb(i,"normal"),"unknown");cb.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],s)}animateWaitingUpdateReady(e){super.animateWaitingUpdateReady(e);const{datumSelection:t}=e,{processedData:i}=this,o=i?.reduced?.diff?.[this.id],s=rb(lb(this.isVertical(),"fade"),"added");cb.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],s,(a,n)=>n.xValue,o)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};wc.className="FunnelSeries",wc.type="funnel";import{_ModuleSupport as yB}from"ag-charts-community";import{constant as fB,required as eu,string as hb}from"ag-charts-core";var{commonSeriesOptionsDefs:mB,funnelSeriesThemeableOptionsDef:xB,without:SB}=yB,bB={...xB,...SB(mB,["showInLegend"]),type:eu(fB("funnel")),stageKey:eu(hb),valueKey:eu(hb)},vB={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"funnel",moduleFactory:e=>new wc(e),solo:!0,defaultAxes:jS,themeTemplate:pE},kB={type:"series",name:"funnel",chartType:"cartesian",enterprise:!0,options:bB,create:e=>new wc(e)};import{_ModuleSupport as Qn}from"ag-charts-community";import{_ModuleSupport as Ua}from"ag-charts-community";import{cachedTextMeasurer as db,isArray as DB,measureTextSegments as MB}from"ag-charts-core";var pb=class{*[Symbol.iterator](){const{node:e,datum:t}=this;e&&t&&(yield{node:e,datum:t})}nodes(){return this.node?[this.node]:[]}update(e,t,i,o){const s=e.nodes();if(s.length===0)this.node?.remove(),this.node=void 0;else{this.node===void 0&&(this.node=new i,this.node.fillOpacity=0,this.node.strokeOpacity=0,t.appendChild(this.node));const a=s[0],n=s.toReversed().find(r=>r.datum.datum.value>r.datum.datum.segmentStart)??s.at(-1);this.node.datum=this.datum=a.datum,o(this.node,a,n)}}};import{isArray as AB}from"ag-charts-core";var ub={fromFn:()=>({opacity:0,phase:"initial"}),toFn:()=>({opacity:1})};function gb(e,t){if(e==null)return"";const{min:i,max:o}=t,s=i===0?0:Math.ceil(Math.log10(Math.abs(i))),a=o===0?0:Math.ceil(Math.log10(Math.abs(o))),n=Math.max(2-Math.max(s,a),0);return e.toFixed(n)}function Jn(e,t,i,o){if(i.text!=null)return i.text;const s=o??i.value;let a;return i?.formatter!=null&&(a=Un(t,i.formatter,{seriesId:e,datum:void 0,value:s})),a==null||AB(a)?a:String(a)}function yb({path:e,x:t,y:i,size:o}){e.moveTo(t,i-o/2),e.lineTo(t,i+o/2)}import{clamp as fb,iterate as IB}from"ag-charts-core";function mb(e,t){const i=IB(e.datumUnion.nodes(),e.targetSelection.nodes());return e.pickNodeNearestDistantObject(t,i)}function xb(e,t){const i=[{data:e.contextNodeData?.nodeData,selection:e.datumUnion},{data:e.contextNodeData?.targetData,selection:e.targetSelection}].filter(l=>l.data&&l.data.length>0),o=fb(0,t.otherIndex+t.otherIndexDelta,i.length-1);if(i.length===0)return;const{data:s,selection:a}=i[o];if(s==null||s.length===0)return;const n=fb(0,t.datumIndex,s.length-1),r=s[n];for(const l of a)if(l.datum===r)return{bounds:l.node,clipFocusBox:!0,datum:r,datumIndex:n,otherIndex:o}}import{_ModuleSupport as tu}from"ag-charts-community";import{_ModuleSupport as LB}from"ag-charts-community";import{Logger as TB}from"ag-charts-core";var{BaseProperties:Sb,Property:Xa}=LB,Pc=class extends Sb{getSegments(e,t){const{values:i,step:o,count:s}=this,a=Math.min(...e.domain),n=Math.max(...e.domain);let r;if(i!=null){const l=i.filter(c=>c>a&&cc-h);r=[a,...l,n]}else if(o!=null){const l=[];for(let c=a;cc>a&&ch/l*(n-a)+a)}return r!=null&&r.length>t&&(TB.warnOnce("the configured segmentation results in more than 1 item per pixel, ignoring. Supply a segmentation configuration that results in larger segments or omit this configuration"),r=void 0),r??(r=[a,n]),r}};d([Xa],Pc.prototype,"values",2),d([Xa],Pc.prototype,"step",2),d([Xa],Pc.prototype,"count",2);var er=class extends Sb{constructor(){super(...arguments),this.enabled=!1,this.interval=new Pc,this.spacing=0}};d([Xa],er.prototype,"enabled",2),d([Xa],er.prototype,"interval",2),d([Xa],er.prototype,"spacing",2);var{BaseProperties:Oc,makeSeriesTooltip:CB,SeriesProperties:NB,PropertiesArray:iu,Property:j,Label:wB,AxisLabel:PB,getColorStops:OB}=tu,bb=class extends wB{};d([j],bb.prototype,"spacing",2);var pt=class extends Oc{constructor(){super(...arguments),this.value=0,this.label=new bb}getStyle(e){const{fill:t=e.fill??"black",fillOpacity:i=e.fillOpacity??1,stroke:o=e.stroke??"black",strokeWidth:s=e.strokeWidth??0,strokeOpacity:a=e.strokeOpacity??1,lineDash:n=e.lineDash??[0],lineDashOffset:r=e.lineDashOffset??0}=this;return{fill:t,fillOpacity:i,stroke:o,strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r}}};d([j],pt.prototype,"text",2),d([j],pt.prototype,"value",2),d([j],pt.prototype,"shape",2),d([j],pt.prototype,"placement",2),d([j],pt.prototype,"spacing",2),d([j],pt.prototype,"size",2),d([j],pt.prototype,"rotation",2),d([j],pt.prototype,"fill",2),d([j],pt.prototype,"fillOpacity",2),d([j],pt.prototype,"stroke",2),d([j],pt.prototype,"strokeWidth",2),d([j],pt.prototype,"strokeOpacity",2),d([j],pt.prototype,"lineDash",2),d([j],pt.prototype,"lineDashOffset",2),d([j],pt.prototype,"label",2);var Qt=class extends Oc{constructor(){super(...arguments),this.enabled=!0,this.thicknessRatio=1,this.fills=new iu(tu.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t,i){const{fill:o,fills:s,fillMode:a,fillOpacity:n,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}=this;return{fill:o??kb(s,a,e,i,t),fillOpacity:n,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}}};d([j],Qt.prototype,"enabled",2),d([j],Qt.prototype,"thickness",2),d([j],Qt.prototype,"thicknessRatio",2),d([j],Qt.prototype,"fills",2),d([j],Qt.prototype,"fillMode",2),d([j],Qt.prototype,"fill",2),d([j],Qt.prototype,"fillOpacity",2),d([j],Qt.prototype,"stroke",2),d([j],Qt.prototype,"strokeWidth",2),d([j],Qt.prototype,"strokeOpacity",2),d([j],Qt.prototype,"lineDash",2),d([j],Qt.prototype,"lineDashOffset",2);var tr=class extends Oc{constructor(){super(...arguments),this.values=void 0,this.step=void 0,this.minSpacing=0,this.maxSpacing=1e3}};d([j],tr.prototype,"values",2),d([j],tr.prototype,"step",2),d([j],tr.prototype,"minSpacing",2),d([j],tr.prototype,"maxSpacing",2);var vb=class extends PB{constructor(){super(...arguments),this.placement=void 0}};d([j],vb.prototype,"placement",2);var xt=class extends Oc{constructor(){super(...arguments),this.min=0,this.max=1,this.fills=new iu(tu.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.defaultFill="black",this.interval=new tr,this.label=new vb}getStyle(e,t,i,o){const{fill:s,fills:a,defaultFill:n,fillMode:r,fillOpacity:l,stroke:c,strokeWidth:h,strokeOpacity:p,lineDash:u,lineDashOffset:g}=this;return{fill:s??(e&&a.length===0?n:void 0)??kb(a,r,t,o,i),fillOpacity:l,stroke:c,strokeWidth:h,strokeOpacity:p,lineDash:u,lineDashOffset:g}}};d([j],xt.prototype,"min",2),d([j],xt.prototype,"max",2),d([j],xt.prototype,"fills",2),d([j],xt.prototype,"fillMode",2),d([j],xt.prototype,"fill",2),d([j],xt.prototype,"fillOpacity",2),d([j],xt.prototype,"stroke",2),d([j],xt.prototype,"strokeWidth",2),d([j],xt.prototype,"strokeOpacity",2),d([j],xt.prototype,"lineDash",2),d([j],xt.prototype,"lineDashOffset",2),d([j],xt.prototype,"defaultFill",2),d([j],xt.prototype,"interval",2),d([j],xt.prototype,"label",2);var _c=class extends $i{constructor(){super(...arguments),this.placement="inside-center",this.avoidCollisions=!0}};d([j],_c.prototype,"text",2),d([j],_c.prototype,"placement",2),d([j],_c.prototype,"avoidCollisions",2);var St=class extends NB{constructor(){super(...arguments),this.value=0,this.segmentation=new er,this.defaultColorRange=[],this.targets=new iu(pt),this.defaultTarget=new pt,this.defaultScale=new xt,this.direction="vertical",this.thickness=1,this.cornerRadius=0,this.cornerMode="container",this.margin=0,this.scale=new xt,this.bar=new Qt,this.label=new _c,this.tooltip=CB()}};d([j],St.prototype,"value",2),d([j],St.prototype,"segmentation",2),d([j],St.prototype,"defaultColorRange",2),d([j],St.prototype,"targets",2),d([j],St.prototype,"defaultTarget",2),d([j],St.prototype,"defaultScale",2),d([j],St.prototype,"direction",2),d([j],St.prototype,"thickness",2),d([j],St.prototype,"cornerRadius",2),d([j],St.prototype,"cornerMode",2),d([j],St.prototype,"margin",2),d([j],St.prototype,"scale",2),d([j],St.prototype,"bar",2),d([j],St.prototype,"label",2),d([j],St.prototype,"tooltip",2);function kb(e,t,i,o,s){return{type:"gradient",gradient:"linear",colorSpace:"oklch",colorStops:OB(e,i,o.domain,t),rotation:s?90:0,bounds:"series"}}import{_ModuleSupport as _B}from"ag-charts-community";import{cachedTextMeasurer as RB,isArray as EB,measureTextSegments as BB,toPlainText as zB}from"ag-charts-core";var{BBox:FB}=_B;function ou(e){const{x0:t,y0:i,x1:o,y1:s,horizontalInset:a,verticalInset:n}=e,r=Math.min(t,o)+a,l=Math.min(i,s)+n,c=Math.max(Math.abs(o-t)-2*a,0),h=Math.max(Math.abs(s-i)-2*n,0);return{x:r,y:l,width:c,height:h}}function HB(e,t){if(t==null)return!0;const i=ou(e),o=1e-6,s=i.x+o,a=i.y+o,n=i.x+i.width-o,r=i.y+i.height-o,l=t.x,c=t.x+t.width,h=t.y,p=t.y+t.height;return Math.max(s,l)<=Math.min(n,c)&&Math.max(a,h)<=Math.min(r,p)}function su(e){const{clipX0:t,clipX1:i,clipY0:o,clipY1:s}=e;return t!=null&&i!=null||o!=null&&s!=null}function VB(e){if(!su(e))return;const{x0:t,y0:i,x1:o,y1:s}=e,{x:a,y:n,width:r,height:l}=ou(e);let{clipX0:c,clipX1:h,clipY0:p,clipY1:u}=e;(c==null||h==null)&&(c=t,h=o),(p==null||u==null)&&(p=i,u=s);const g=Math.min(c,h),y=Math.min(p,u),f=Math.abs(h-c),x=Math.abs(u-p);return c=Math.max(a,g),p=Math.max(n,y),h=Math.min(a+r,g+f),u=Math.min(n+l,y+x),new FB(Math.min(c,h),Math.min(p,u),Math.abs(h-c),Math.abs(u-p))}function Db(e,t){const i=e?"initial":"update";return{node:{fromFn(s,a){const n=s.previousDatum;let{x0:r,y0:l,x1:c,y1:h,clipX0:p,clipY0:u,clipX1:g,clipY1:y}=n??a;const{horizontalInset:f,verticalInset:x}=a,S=n!=null&&su(n),v=su(a);return S&&v||(!S&&v?({x0:r,y0:l,x1:c,y1:h,clipX0:p,clipY0:u,clipX1:g,clipY1:y}=a,e&&(t?g=a.clipX0:y=a.clipY0)):S&&!v?({x0:r,y0:l,x1:c,y1:h}=a,p=void 0,u=void 0,g=void 0,y=void 0):e&&(t?c=r:h=l)),{x0:r,y0:l,x1:c,y1:h,clipX0:p,clipY0:u,clipX1:g,clipY1:y,horizontalInset:f,verticalInset:x,phase:i}},toFn(s,a){const{x0:n,y0:r,x1:l,y1:c,clipX0:h,clipY0:p,clipX1:u,clipY1:g,horizontalInset:y,verticalInset:f}=a;return{x0:n,y0:r,x1:l,y1:c,clipX0:h,clipY0:p,clipX1:u,clipY1:g,horizontalInset:y,verticalInset:f}},applyFn(s,a){s.setProperties(ir(s,a))}}}}function ir(e,t){const{x:i,y:o,width:s,height:a}=ou(t),n=VB(t),r=HB(t,n);return{x:i,y:o,width:s,height:a,clipBBox:n,visible:r}}var WB={Before:"right",Center:"center",After:"left"},GB={Before:"top",Center:"middle",After:"bottom"},KB={Before:-1,Center:-.5,After:0},$B={Before:0,Center:-.5,After:-1};function jB(e,t,i,o,s,a){const{seriesRect:n,gaugeRect:r,barRect:l}=s,{padding:c,horizontal:h}=o;i.each((p,u)=>{const g=Jn(e.id,t,u,a?.label);let y,f;u.placement==="outside-start"?h?(y=r.x,f=n.height):(y=n.width,f=n.height-(r.y+r.height)):u.placement==="outside-end"?h?(y=n.width-(r.x+r.width),f=n.height):(y=n.width,f=r.y):u.avoidCollisions&&(y=r.width,f=r.height);let x;if(g==null)return;if(y!=null&&f!=null){const E=()=>({width:y,height:f,meta:null});x=En(zB(g),u,{padding:c},E)?.[0]}else{const E=RB(u),{width:T,height:w}=EB(g)?BB(g,u):E.measureLines(g);x={text:g,fontSize:u.fontSize,lineHeight:u.lineHeight??E.lineHeight(),width:T,height:w}}if(x==null){p.visible=!1;return}const S=h?r.x:r.y+r.height,v=h?r.x+r.width:r.y,m=h?l.x:l.y+l.height,b=h?l.x+l.width:l.y,k=u.spacing*(h?1:-1);let A,M,D,L;switch(u.placement){case"outside-start":A=-1/0,M=1/0,D=S-k,L="Before";break;case"outside-end":A=-1/0,M=1/0,D=v+k,L="After";break;case"inside-start":A=S,M=b,D=S+k,L="After";break;case"inside-end":A=b,M=v,D=v-k,L="Before";break;case"inside-center":A=S,M=v,D=(S+v)/2,L="Center";break;case"bar-inside":A=m,M=b,D=(m+b)/2,L="Center";break;case"bar-inside-end":A=m,M=b,D=b-k,L="Before";break;case"bar-outside-end":A=b,M=v,D=b+k,L="After";break;case"bar-end":A=-1/0,M=1/0,D=b,L="Center";break}const N=h?D:r.x+r.width/2,P=h?r.y+r.height/2:D;let R,F;h?(R=N+KB[L]*x.width,F=R+x.width):(R=P+$B[L]*x.height,F=R+x.height);const _=Math.min(R,F)>=Math.min(A,M)&&Math.max(R,F)<=Math.max(A,M);if(u.avoidCollisions&&!_){p.visible=!1;return}p.visible=!0,p.text=x.text,p.fontSize=x.fontSize,p.lineHeight=x.lineHeight,p.textAlign=h?WB[L]:"center",p.textBaseline=h?"middle":GB[L],p.x=N,p.y=P})}var{fromToMotion:au,resetMotion:YB,SeriesNodePickMode:Mb,StateMachine:UB,createDatumId:Ab,toRadians:Ib,BBox:qi,Group:js,PointerEvents:Lb,Selection:Ys,Rect:XB,Text:Tb,TransformableText:ZB,Marker:qB,LinearScale:QB,generateTicks:JB,NiceMode:ez,easing:tz,findRangeExtent:iz,tickFormat:oz,mergeDefaults:sz,applyShapeStyle:nu}=Ua,az={before:180,middle:0,after:0},nz={before:90,middle:0,after:-90},Rc=class extends Ua.Series{constructor(e){super({moduleCtx:e,pickModes:[Mb.EXACT_SHAPE_MATCH,Mb.NEAREST_NODE]}),this.properties=new St,this.seriesRect=qi.NaN,this.gaugeRect=qi.NaN,this.scale=new QB,this.originX=0,this.originY=0,this.scaleGroup=this.contentGroup.appendChild(new js({name:"scaleGroup"})),this.itemGroup=this.contentGroup.appendChild(new js({name:"itemGroup"})),this.itemTargetGroup=this.contentGroup.appendChild(new js({name:"itemTargetGroup"})),this.itemTargetLabelGroup=this.contentGroup.appendChild(new js({name:"itemTargetLabelGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new js({name:"itemLabelGroup"})),this.highlightTargetGroup=this.highlightGroup.appendChild(new js({name:"itemTargetLabelGroup"})),this.tickGroup=this.contentGroup.appendChild(new js({name:"tickGroup"})),this.scaleSelection=Ys.select(this.scaleGroup,()=>this.nodeFactory()),this.datumSelection=Ys.select(this.itemGroup,()=>this.nodeFactory()),this.targetSelection=Ys.select(this.itemTargetGroup,()=>this.markerFactory()),this.targetLabelSelection=Ys.select(this.itemTargetLabelGroup,Tb),this.labelSelection=Ys.select(this.itemLabelGroup,Tb),this.highlightTargetSelection=Ys.select(this.highlightTargetGroup,()=>this.markerFactory()),this.tickSelection=Ys.select(this.tickGroup,ZB),this.datumUnion=new pb,this.animationState=new UB("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.animateReadyResize(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateWaitingUpdateReady()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty"},reset:"empty",skip:"ready"}}),this.scaleGroup.pointerEvents=Lb.None,this.tickGroup.pointerEvents=Lb.None}get range(){return this.horizontal?[0,this.gaugeRect.width]:[0,this.gaugeRect.height]}get horizontal(){return this.properties.direction==="horizontal"}get hasData(){return!0}nodeFactory(){const e=new XB;return e.crisp=!0,e}markerFactory(){return new qB}processData(){this.nodeDataRefresh=!0,this.animationState.transition("updateData")}formatLabel(e){return gb(e,this.properties.scale)}getShapeFillBBox(){const{properties:e,originX:t,originY:i,horizontal:o,scale:s}=this,{thickness:a}=e,n=iz(s.range),r=new qi(t,i,o?n:a,o?a:n);return{axis:r,series:r}}getTargets(){const{properties:e}=this,t=e.defaultTarget;return Array.from(e.targets).map(i=>{const{text:o=t.text,value:s=t.value??0,shape:a=t.shape??"triangle",rotation:n=t.rotation??0,placement:r=t.placement??"middle",spacing:l=t.spacing??0,size:c=t.size??0}=i,{enabled:h=t.label.enabled,color:p=t.label.color??"black",fontStyle:u=t.label.fontStyle??"normal",fontWeight:g=t.label.fontWeight??"normal",fontSize:y=t.label.fontSize,fontFamily:f=t.label.fontFamily,spacing:x=t.label.spacing??0}=i.label;return{text:o,value:s,shape:a,placement:r,spacing:l,size:c,rotation:n,label:{enabled:h,color:p,fontStyle:u,fontWeight:g,fontSize:y,fontFamily:f,spacing:x},style:i.getStyle(t)}})}getTargetPoint(e){const{properties:t,originX:i,originY:o,horizontal:s,scale:a,gaugeRect:n}=this,{thickness:r}=t,{value:l,placement:c,spacing:h,size:p}=e,u=a.convert(l);let g;switch(c){case"before":g=-(h+p/2);break;case"after":g=r+h+p/2;break;default:g=r/2;break}return{x:i+n.x+(s?u:g),y:o+n.y+(s?g:u)}}getTargetLabel(e){const{size:t,placement:i,label:o}=e,{spacing:s,color:a,fontStyle:n,fontWeight:r,fontSize:l,fontFamily:c}=o,h=void 0,p=t/2+s;let u,g,y=0,f=0;return this.horizontal?(u="center",i==="after"?(g="top",f=p):(g="bottom",f=-p)):(g="middle",i==="before"?(u="right",y=-p):(u="left",y=p)),{offsetX:y,offsetY:f,fill:a,textAlign:u,textBaseline:g,fontStyle:n,fontWeight:r,fontSize:l,fontFamily:c,lineHeight:h}}labelDatum(e,t){const{placement:i,avoidCollisions:o,spacing:s,text:a,color:n,fontSize:r,minimumFontSize:l,fontStyle:c,fontWeight:h,fontFamily:p,lineHeight:u,wrapping:g,overflowStrategy:y,formatter:f=x=>this.formatLabel(x.value)}=e;return{placement:i,avoidCollisions:o,spacing:s,text:a,value:t,fill:n,fontSize:r,minimumFontSize:l,fontStyle:c,fontWeight:h,fontFamily:p,lineHeight:u,wrapping:g,overflowStrategy:y,formatter:f}}verticalLabelInset(){const{label:e}=this.properties,t=db(e),i=e.text?.split(` +`),o=(e.lineHeight??t.lineHeight())*(i?.length??1);return e.spacing+o}horizontalLabelInset(){const{scale:e,properties:t}=this,{scale:i,label:o}=t,s=o.text?.split(` +`),a=db(o),n=i.interval.values??e.ticks({nice:!1,interval:i.interval.step,minTickCount:0,maxTickCount:6,tickCount:5})?.ticks??[],l=(s??n?.map(c=>Jn(this.id,this.ctx,this.labelDatum(o,c))??"")).reduce((c,h)=>{const{width:p}=DB(h)?MB(h,o):a.measureLines(h);return Math.max(c,p)},0);return o.spacing+l}tickFormatter(e,t){const{format:i,formatter:o}=this.properties.scale.label;let s;return i!=null&&(s=oz(t,typeof i=="string"?i:void 0)),(a,n)=>{let r;return o&&(r??(r=Un(this.ctx,o,{value:a,index:n,domain:e,boundSeries:void 0}))),r??(r=s?.(a)),r??this.formatLabel(a)}}createNodeData(){const{id:e,properties:t,horizontal:i,scale:o,seriesRect:s}=this,{value:a,segmentation:n,thickness:r,cornerRadius:l,cornerMode:c,bar:h,scale:p,label:u,defaultColorRange:g}=t;o.domain=[p.min,p.max],o.range=i?[0,s.width]:[s.height,0];let y,f;i?(f=1,y=Math.PI/2):p.label.placement==="before"?(f=1,y=0):(f=-1,y=0);let x,S,v,m;i?(x=0,S=s.width,v=(s.height-r)/2,m=v+r,u.placement==="outside-start"?x+=this.horizontalLabelInset():u.placement==="outside-end"&&(S-=this.horizontalLabelInset())):(x=(s.width-r)/2,S=x+r,m=0,v=s.height,u.placement==="outside-start"?v-=this.verticalLabelInset():u.placement==="outside-end"&&(m+=this.verticalLabelInset())),this.gaugeRect=new qi(Math.min(x,S),Math.min(v,m),Math.abs(S-x),Math.abs(m-v));const b=0,k=0;o.domain=[p.min,p.max],o.range=i?[x,S]:[v,m];const{tickData:{ticks:A}}=JB({scale:o,label:this.properties.scale.label,interval:this.properties.scale.interval,tickFormatter:(J,ie)=>this.tickFormatter(J,ie),domain:o.domain,range:this.range,reverse:!1,primaryTickCount:void 0,defaultTickMinSpacing:0,visibleRange:[0,1],niceMode:ez.Off,labelOffset:0,axisRotation:y,sideFlag:f}),M=!1,D=this.getTargets(),L=[],N=[],P=[],R=[],[F,_]=o.range,E=Math.abs(_-F),T=i?o.convert(a):S,w=i?m:o.convert(a),C=n.enabled?n.spacing/2:0,I=i?C:0,O=i?0:C,z=Math.min(h.thickness??Math.round(h.thicknessRatio*r),r),B=-(r-z)/2,H=i?0:B,W=i?B:0,V=c==="item",G=Math.ceil(E);let K=n.enabled?n.interval.getSegments(o,G):void 0;const Q=h.getStyle(g,i,o),X=p.getStyle(h.enabled,g,i,o);if(K==null&&V){const J=Math.min(...o.domain),ie=Math.max(...o.domain),U={value:a,segmentStart:J,segmentEnd:ie};if(h.enabled){const ge=Math.min(l,z/2,E/2)*(M?-1:1),ce=i?ge:0,me=i?0:ge;L.push({series:this,itemId:"value",datum:U,datumIndex:{type:0},type:0,x0:b+x-ce-H,y0:k+v-me-W,x1:b+T+ce+H,y1:k+w+me+W,clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:l,topRightCornerRadius:l,bottomRightCornerRadius:l,bottomLeftCornerRadius:l,horizontalInset:I,verticalInset:O,style:Q})}const ne=Math.min(l,r/2,E/2)*(M?-1:1),Z=i?ne:0,le=i?0:ne;R.push({series:this,itemId:"scale",datum:U,datumIndex:{type:0},type:0,x0:b+x-Z,y0:k+v-le,x1:b+S+Z,y1:k+m+le,clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:l,topRightCornerRadius:l,bottomRightCornerRadius:l,bottomLeftCornerRadius:l,horizontalInset:I,verticalInset:O,style:X})}else{K??(K=o.domain);const J=b+x-H,ie=k+v-W,U=b+T+H,he=k+w+W;for(let ne=0;neAb(e.nodeData.length,t.itemId))}updateDatumNodes(e){const{datumSelection:t}=e,{ctx:i}=this,o=i.animationManager.isSkipped(),s=this.getShapeFillBBox();t.each((n,r)=>{const{topLeftCornerRadius:l,topRightCornerRadius:c,bottomRightCornerRadius:h,bottomLeftCornerRadius:p}=r;nu(n,r.style,s),n.topLeftCornerRadius=l,n.topRightCornerRadius=c,n.bottomRightCornerRadius=h,n.bottomLeftCornerRadius=p,n.pointerEvents=this.properties.bar.enabled?Ua.PointerEvents.All:Ua.PointerEvents.None,(o||n.previousDatum==null)&&n.setProperties(ir(n,r))});const{horizontal:a}=this;this.datumUnion.update(t,this.itemGroup,Ua.Rect,(n,r,l)=>{const c=Math.min(r.x,l.x),h=Math.max(r.x+r.width,l.x+l.width),p=Math.min(r.y,l.y),u=Math.max(r.y+r.height,l.y+l.height),g=h-c,y=u-p;n.pointerEvents=Ua.PointerEvents.None,n.x=c,n.y=p,n.width=g,n.height=y,n.topLeftCornerRadius=a?r.topLeftCornerRadius:l.topLeftCornerRadius,n.topRightCornerRadius=l.topRightCornerRadius,n.bottomRightCornerRadius=a?l.bottomRightCornerRadius:r.bottomRightCornerRadius,n.bottomLeftCornerRadius=r.bottomLeftCornerRadius;const f=r.clipBBox,x=l.clipBBox??f;f&&x?n.clipBBox=qi.merge([f,x]).intersection(a?new qi(c,-1/0,g,1/0):new qi(-1/0,p,1/0,y)):n.clipBBox=void 0})}updateScaleSelection(e){return e.scaleSelection.update(e.scaleData,void 0,t=>Ab(e.scaleData.length,t.itemId))}updateScaleNodes(e){const{scaleSelection:t}=e,i=this.getShapeFillBBox();t.each((o,s)=>{const{topLeftCornerRadius:a,topRightCornerRadius:n,bottomRightCornerRadius:r,bottomLeftCornerRadius:l}=s;nu(o,s.style,i),o.setProperties(ir(o,s)),o.topLeftCornerRadius=a,o.topRightCornerRadius=n,o.bottomRightCornerRadius=r,o.bottomLeftCornerRadius=l,o.setProperties(ir(o,s))})}updateTargetSelection(e){return e.targetSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetNodes(e){const{targetSelection:t,isHighlight:i}=e;t.each((o,s)=>{const{x:a,y:n,shape:r,size:l,rotation:c}=s,h=this.getTargetStyle(i,s);nu(o,h),o.size=l,o.shape=r==="line"?yb:r,o.translationX=a,o.translationY=n,o.rotation=c})}getTargetStyle(e,{datumIndex:t,style:i}){const o=this.getHighlightStyle(e,t);return sz(o,{...i,opacity:1})}updateTargetLabelSelection(e){return e.targetLabelSelection.update(e.targetData)}updateTargetLabelNodes(e){const{targetLabelSelection:t}=e;t.each((i,o)=>{const{x:s,y:a,text:n}=o,{offsetX:r,offsetY:l,fill:c,fontStyle:h,fontWeight:p,fontSize:u,fontFamily:g,textAlign:y,textBaseline:f}=o.label;i.visible=!0,i.x=s+r,i.y=a+l,i.text=n,i.fill=c,i.fontStyle=h,i.fontWeight=p,i.fontSize=u,i.fontFamily=g,i.textAlign=y,i.textBaseline=f})}updateTickSelection(e){return e.tickSelection.update(e.tickData,void 0,t=>t.tickId)}updateTickNodes(e){const{gaugeRect:t,properties:i}=this,o=i.defaultScale,{enabled:s,color:a,fontFamily:n=o.label.fontFamily,fontSize:r=o.label.fontSize,fontStyle:l,fontWeight:c=o.label.fontWeight,spacing:h}=i.scale.label;let{placement:p}=i.scale.label;const u=Ib(i.scale.label.rotation??0);let g,y,f,x;this.horizontal?(p??(p="after"),g="center",y=p==="before"?"bottom":"top",x=this.originY+t.y+(p==="before"?-h:t.height+h)):(p??(p="before"),g=p==="before"?"end":"start",y="middle",f=this.originX+t.x+(p==="before"?-h:t.width+h)),e.tickSelection.each((S,v)=>{if(!s){S.visible=!1;return}const m=f??v.translation,b=x??v.translation;S.visible=!0,S.text=v.tickLabel,S.fill=a,S.fontFamily=n,S.fontSize=r,S.fontStyle=l,S.fontWeight=c,S.textBaseline=y,S.textAlign=g,S.x=m,S.y=b,S.rotationCenterX=m,S.rotationCenterY=b,S.rotation=u})}updateLabelSelection(e){return e.labelSelection.update(e.labelData,void 0,t=>"primary")}updateLabelNodes(e){const{labelSelection:t}=e,i=this.ctx.animationManager.isSkipped();t.each((o,s)=>{o.fill=s.fill,o.fontStyle=s.fontStyle,o.fontWeight=s.fontWeight,o.fontFamily=s.fontFamily}),(i||this.labelsHaveExplicitText())&&this.formatLabelText()}labelsHaveExplicitText(){for(const{datum:e}of this.labelSelection)if(e.text==null)return!1;return!0}formatLabelText(e){const{labelSelection:t,horizontal:i,scale:o,seriesRect:s,gaugeRect:a}=this,{x:n,y:r,width:l,height:c}=a,h=e?.label??this.properties.value;let p;if(i){const y=o.convert(h);p=new qi(n,r,y-n,c)}else{const y=o.convert(h);p=new qi(n,y,l,c-y)}const u={seriesRect:s,gaugeRect:a,barRect:p},{margin:g}=this.properties;jB(this,this.ctx,t,{padding:g,horizontal:i},u,e)}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),YB([this.datumSelection],ir),this.formatLabelText()}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}animateLabelText(e={}){const{animationManager:t}=this.ctx;let i=0,o=0;if(this.labelSelection.each((s,a)=>{s.opacity=1,i=s.previousDatum?.value??e.from??a.value,o=a.value}),!this.labelsHaveExplicitText())if(i===o)this.formatLabelText({label:o});else{const s=`${this.id}_labels`;t.animate({id:s,groupId:"label",from:{label:i},to:{label:o},phase:e.phase??"update",ease:tz.easeOut,onUpdate:a=>this.formatLabelText(a),onStop:()=>this.formatLabelText({label:o})})}}animateEmptyUpdateReady(){const{animationManager:e}=this.ctx,{node:t}=Db(!0,this.horizontal);au(this.id,"node",e,[this.datumSelection],t,(i,o)=>o.itemId),au(this.id,"label",e,[this.labelSelection],ub,()=>"primary"),this.animateLabelText({from:0,phase:"initial"})}animateWaitingUpdateReady(){const{animationManager:e}=this.ctx,{node:t}=Db(!1,this.horizontal);au(this.id,"node",e,[this.datumSelection],t,(i,o)=>o.itemId),this.animateLabelText()}animateReadyResize(){this.resetAllAnimation()}getSeriesDomain(){return[0,1]}dataCount(){return Number.NaN}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}getLegendData(){return[]}getTooltipContent(e){const{id:t,properties:i}=this,{tooltip:o}=i;if(e==null)return;let s,a,n;if(e.type===0?(s=i.value,a=i.label.text,n=this.ctx.localeManager.t("ariaLabelGaugeValue")):({value:s,text:a}=i.targets[e.index],n=this.ctx.localeManager.t("ariaLabelGaugeTarget")),s!=null)return this.formatTooltipWithContext(o,{data:[{label:a,fallbackLabel:n,value:this.formatLabel(s)}]},{seriesId:t,title:void 0,datum:void 0,value:s})}pickNodeClosestDatum(e){return mb(this,e)}pickFocus(e){return xb(this,e)}getCaptionText(){return this.formatLabel(this.properties.value)}getCategoryValue(e){}datumIndexForCategoryValue(e){}hasItemStylers(){return this.properties.label.itemStyler!=null}};Rc.className="LinearGaugeSeries",Rc.type="linear-gauge";var rz={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"linear-gauge",moduleFactory:e=>new Rc(e),themeTemplate:{minWidth:200,minHeight:200,tooltip:{enabled:!1},series:{thickness:50,defaultColorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$interpolate:[{$palette:"secondDivergingColors"},5]},Qn.SAFE_RANGE2_OPERATION]},scale:{defaultFill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/2",Qn.SAFE_STROKE_FILL_OPERATION,{$palette:"hierarchyColors"}]},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{spacing:11}},bar:{strokeWidth:{$isUserOption:["./stroke",2,0]}},segmentation:{enabled:!1,interval:{},spacing:1},defaultTarget:{fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},size:10,shape:"triangle",placement:"after",spacing:5,label:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:5}},defaultScale:{label:{fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}}},label:{...Qn.LABEL_BOXING_DEFAULTS,enabled:!1,placement:"inside-start",fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},fontSize:{$rem:2},minimumFontSize:Qn.FONT_SIZE.SMALL,spacing:18,color:{$ref:"chartBackgroundColor"}},margin:4,tooltip:{range:{$path:["/tooltip/range",10]}}}}},lz={type:"series",name:"linear-gauge",chartType:"standalone",enterprise:!0,options:Qn.linearGaugeSeriesOptionsDef,create:e=>new Rc(e)};import{_ModuleSupport as Ec}from"ag-charts-community";import{_ModuleSupport as ru}from"ag-charts-community";var or={zoom:{axes:"xy",anchorPointX:"pointer",anchorPointY:"pointer",buttons:{anchorPointX:"middle",anchorPointY:"middle"}},legend:{enabled:!1},gradientLegend:{enabled:!1,...ru.LEGEND_CONTAINER_THEME}};function Qi(e){const t=ru.deepClone(e);return ru.jsonWalk(t,i=>{typeof i=="object"&&"$palette"in i&&(i.$mapPalette=i.$palette,delete i.$palette)}),t}import{_ModuleSupport as Cb}from"ag-charts-community";import{Logger as Nb,cachedTextMeasurer as cz}from"ag-charts-core";import{_ModuleSupport as hz}from"ag-charts-community";var dz=1e-9;function wb(e,t,i,o){const[s,a]=e,[n,r]=t,l=n-s,c=r-a,h=l*l+c*c;let p,u;if(Math.abs(h)t){const h=(t-s)/l,p=[i+(n-i)*h,o+(r-o)*h],u=Math.atan2(r-o,n-i);return{point:p,angle:u}}s=c,i=n,o=r}}import{_ModuleSupport as pz}from"ag-charts-community";var{LonLatBBox:uz}=pz;function Us(e,t){for(const i of e){const[o,s]=i;t=uz.extend(t,o,s,o,s)}return t}function gz(e){if(e.length===0)return;let t=0,i=0,o=0,[s,a]=e.at(-1);for(const[n,r]of e){const l=s*r-n*a;o+=l,t+=(s+n)*l,i+=(a+r)*l,s=n,a=r}return o*=3,[t/o,i/o]}function zc(e,t,i){let o=!1,s=1/0;for(const a of e){let n=a.at(-1),[r,l]=n;for(const c of a){const[h,p]=c;p>i!=l>i&&t<(r-h)*(i-p)/(l-p)+h&&(o=!o),s=Math.min(s,wb(n,c,t,i)),n=c,r=h,l=p}}return(o?-1:1)*Math.sqrt(s)}var{Path:yz,ExtendedPath2D:fz,BBox:mz,SceneChangeDetection:xz,SceneObjectChangeDetection:Sz,objectsEqual:bz}=hz,Za=class extends yz{constructor(){super(...arguments),this.projectedGeometry=void 0,this.renderMode=3,this.strokePath=new fz}computeBBox(){return(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1),this.bbox?.clone()}updatePath(){const{projectedGeometry:e}=this;this.strokePath.clear(),this.path.clear(),this.bbox=e==null?void 0:this.drawGeometry(e,void 0)}drawPath(e){super.drawPath(e),this.renderStroke(e,this.strokePath.getPath2D())}containsPoint(e,t){const{projectedGeometry:i}=this;return i==null||!this.getBBox().containsPoint(e,t)?!1:this.geometryDistance(i,e,t)<=0}distanceSquared(e,t){const{projectedGeometry:i}=this;if(i==null)return 1/0;const o=this.geometryDistance(i,e,t);return o>0?o*o:0}geometryDistance(e,t,i){const{renderMode:o,strokeWidth:s}=this,a=(o&1)!==0,n=(o&2)!==0,r=Math.max(s/2,1)+1;switch(e.type){case"GeometryCollection":return e.geometries.reduce((l,c)=>Math.min(l,this.geometryDistance(c,t,i)),1/0);case"MultiPolygon":return a?e.coordinates.reduce((l,c)=>Math.min(l,Math.max(zc(c,t,i),0)),1/0):1/0;case"Polygon":return a?Math.max(zc(e.coordinates,t,i),0):1/0;case"MultiLineString":return n?e.coordinates.reduce((l,c)=>Math.min(l,Math.max(Pb(c,t,i)-r,0)),1/0):1/0;case"LineString":return n?Math.max(Pb(e.coordinates,t,i)-r,0):1/0;case"MultiPoint":case"Point":default:return 1/0}}drawGeometry(e,t){const{renderMode:i,path:o,strokePath:s}=this,a=(i&1)!==0,n=(i&2)!==0;switch(e.type){case"GeometryCollection":for(const r of e.geometries)t=this.drawGeometry(r,t);break;case"MultiPolygon":if(a)for(const r of e.coordinates)t=this.drawPolygon(o,r,t);break;case"Polygon":a&&(t=this.drawPolygon(o,e.coordinates,t));break;case"LineString":n&&(t=this.drawLineString(s,e.coordinates,t,!1));break;case"MultiLineString":if(n)for(const r of e.coordinates)t=this.drawLineString(s,r,t,!1);break;case"Point":case"MultiPoint":break}return t}drawPolygon(e,t,i){if(t.length<1)return i;i=this.drawLineString(e,t[0],i,!0);for(let o=1;o0&&(t=Us(i[0],t));break;case"Polygon":e.coordinates.length>0&&(t=Us(e.coordinates[0],t));break;case"MultiLineString":for(const i of e.coordinates)t=Us(i,t);break;case"LineString":t=Us(e.coordinates,t);break;case"MultiPoint":for(const i of e.coordinates){const[o,s]=i;t=cu.extend(t,o,s,o,s)}break;case"Point":{const[i,o]=e.coordinates;t=cu.extend(t,i,o,i,o);break}}return t}function Fc(e){switch(e.type){case"GeometryCollection":{let t,i;for(const o of e.geometries){const s=Fc(o);if(s==null)continue;const a=Us(s[0],void 0);if(a==null)continue;const n=Math.abs(a.lat1-a.lat0)*Math.abs(a.lon1-a.lon0);(t==null||n>t)&&(t=n,i=s)}return i}case"MultiPolygon":{let t,i;for(const o of e.coordinates){const s=Us(o[0],void 0);if(s==null)continue;const a=Math.abs(s.lat1-s.lat0)*Math.abs(s.lon1-s.lon0);(t==null||a>t)&&(t=a,i=o)}return i}case"Polygon":return e.coordinates;case"MultiLineString":case"LineString":case"MultiPoint":case"Point":return}}function Hc(e){switch(e.type){case"GeometryCollection":{let t,i;for(const o of e.geometries){const s=Hc(o);if(s==null)continue;const a=lu(s);a!=null&&(t==null||a>t)&&(t=a,i=s)}return i}case"MultiLineString":{let t=0,i;for(const o of e.coordinates){const s=lu(o);s>t&&(t=s,i=o)}return i}case"LineString":return e.coordinates;case"MultiPolygon":case"Polygon":case"MultiPoint":case"Point":return}}function hu(e,t){if(e==null)return!1;switch(e.type){case"GeometryCollection":return e.geometries.some(i=>hu(i,t));case"MultiPolygon":case"Polygon":return(t&1)!==0;case"MultiLineString":case"LineString":return(t&2)!==0;case"MultiPoint":case"Point":return(t&4)!==0}}function os(e,t){switch(e.type){case"GeometryCollection":return{type:"GeometryCollection",geometries:e.geometries.map(i=>os(i,t))};case"Polygon":return{type:"Polygon",coordinates:du(e.coordinates,t)};case"MultiPolygon":return{type:"MultiPolygon",coordinates:kz(e.coordinates,t)};case"MultiLineString":return{type:"MultiLineString",coordinates:du(e.coordinates,t)};case"LineString":return{type:"LineString",coordinates:pu(e.coordinates,t)};case"MultiPoint":return{type:"MultiPoint",coordinates:pu(e.coordinates,t)};case"Point":return{type:"Point",coordinates:t.convert(e.coordinates)}}}function kz(e,t){return e.map(i=>du(i,t))}function du(e,t){return e.map(i=>pu(i,t))}function pu(e,t){return e.map(i=>t.convert(i))}function Dz(){return{fromFn:(i,o,s)=>s==="removed"?{scalingX:1,scalingY:1}:i.previousDatum==null?{scalingX:0,scalingY:0}:{scalingX:i.scalingX,scalingY:i.scalingY},toFn:(i,o,s)=>s==="removed"?{scalingX:0,scalingY:0}:{scalingX:1,scalingY:1}}}function Ob(e,t){const i=e.contextNodeData?.nodeData[t.datumIndex];if(i!==void 0){for(const o of e.datumSelection.nodes())if(o.datum===i)return o}}import{_ModuleSupport as _b}from"ag-charts-community";var oX=class extends _b.SeriesProperties{},sr=class extends _b.DataModelSeries{addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",e=>{this.onLegendItemClick(e)}),this.ctx.eventsHub.on("legend:item-double-click",e=>{this.onLegendItemDoubleClick(e)}))}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}};import{_ModuleSupport as Mz}from"ag-charts-community";var{Property:Me,SeriesProperties:Az,makeSeriesTooltip:Iz,Label:Lz}=Mz,ve=class extends Az{constructor(){super(...arguments),this.topology=void 0,this.idKey="",this.topologyIdKey="name",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.maxStrokeWidth=void 0,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.label=new Lz,this.tooltip=Iz()}getStyle(){const{stroke:e,strokeOpacity:t,strokeWidth:i,lineDash:o,lineDashOffset:s}=this;return{stroke:e,strokeOpacity:t,strokeWidth:i,lineDash:o,lineDashOffset:s}}};d([Me],ve.prototype,"topology",2),d([Me],ve.prototype,"title",2),d([Me],ve.prototype,"legendItemName",2),d([Me],ve.prototype,"idKey",2),d([Me],ve.prototype,"topologyIdKey",2),d([Me],ve.prototype,"idName",2),d([Me],ve.prototype,"labelKey",2),d([Me],ve.prototype,"labelName",2),d([Me],ve.prototype,"sizeKey",2),d([Me],ve.prototype,"sizeName",2),d([Me],ve.prototype,"colorKey",2),d([Me],ve.prototype,"colorName",2),d([Me],ve.prototype,"sizeDomain",2),d([Me],ve.prototype,"colorRange",2),d([Me],ve.prototype,"maxStrokeWidth",2),d([Me],ve.prototype,"stroke",2),d([Me],ve.prototype,"strokeOpacity",2),d([Me],ve.prototype,"strokeWidth",2),d([Me],ve.prototype,"lineDash",2),d([Me],ve.prototype,"lineDashOffset",2),d([Me],ve.prototype,"itemStyler",2),d([Me],ve.prototype,"label",2),d([Me],ve.prototype,"tooltip",2);var{getMissCount:Tz,getLabelStyles:Cz,createDatumId:Rb,SeriesNodePickMode:Eb,valueProperty:ar,ColorScale:Nz,LinearScale:wz,Selection:uu,Text:Pz,Transformable:Oz,mergeDefaults:Bb}=Cb,Vc=class extends sr{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{size:["colorKey"],color:["colorKey"],label:["labelKey"]},propertyNames:{size:["sizeName"],color:["colorName"],label:["labelName"]},pickModes:[Eb.EXACT_SHAPE_MATCH,Eb.NEAREST_NODE],usesPlacedLabels:!0}),this.properties=new ve,this._chartTopology=void 0,this.colorScale=new Nz,this.sizeScale=new wz,this.datumSelection=uu.select(this.contentGroup,()=>this.nodeFactory()),this.labelSelection=uu.select(this.labelGroup,Pz),this.highlightDatumSelection=uu.select(this.highlightGroup,()=>this.nodeFactory()),this._previousDatumMidPoint=void 0}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){return super.hasData&&this.topology!=null}renderToOffscreenCanvas(){return!0}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[1,e],this.highlightGroup.zIndex=[2,e],!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}nodeFactory(){const e=new Za;return e.renderMode=2,e.lineJoin="round",e.lineCap="round",e}async processData(e){if(this.data==null)return;const{data:t,topology:i,sizeScale:o,colorScale:s}=this,{topologyIdKey:a,idKey:n,sizeKey:r,colorKey:l,labelKey:c,sizeDomain:h,colorRange:p}=this.properties,u=new Map;for(const m of i?.features.values()??[]){const b=m.properties?.[a];b==null||!hu(m.geometry,2)||u.set(b,m)}const g=this.sizeScale.type,y=this.colorScale.type,f=this.scale?.type,{dataModel:x,processedData:S}=await this.requestDataModel(e,t,{props:[ar(n,f,{id:"idValue",includeProperty:!1}),ar(n,f,{id:"featureValue",includeProperty:!1,processor:()=>m=>u.get(m)}),...c==null?[]:[ar(c,"category",{id:"labelValue"})],...r==null?[]:[ar(r,g,{id:"sizeValue"})],...l==null?[]:[ar(l,y,{id:"colorValue"})]]}),v=x.resolveColumnById(this,"featureValue",S);if(this.topologyBounds=v.reduce((m,b)=>{const k=b?.geometry;return k==null?m:qa(k,m)},void 0),r!=null){const m=x.resolveProcessedDataIndexById(this,"sizeValue"),b=S.domain.values[m]??[];o.domain=h??b}if(p!=null&&this.isColorScaleValid()){const m=x.resolveProcessedDataIndexById(this,"colorValue");s.domain=S.domain.values[m],s.range=p,s.update()}i==null&&Nb.warnOnce("no topology was provided for [MapLineSeries]; nothing will be rendered.")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const o=t.resolveProcessedDataIndexById(this,"colorValue"),s=i.input.count,a=Tz(this,i.defs.values[o].missing);return!(s===0||s===a)}getLabelDatum(e,t,i,o){if(t==null||i==null)return;const s=Hc(i);if(s==null)return;const{idKey:a,idName:n,sizeKey:r,sizeName:l,colorKey:c,colorName:h,labelKey:p,labelName:u,label:g}=this.properties;if(p==null||!g.enabled)return;const y=this.getLabelText(t,e,p,"label",[],g,{value:t,datum:e,idKey:a,idName:n,sizeKey:r,sizeName:l,colorKey:c,colorName:h,labelKey:p,labelName:u});if(y==null)return;const f=o.measureLines(String(y)),x=Bc(s);if(x==null)return;const[S,v]=x.point,{width:m,height:b}=f;return{point:{x:S,y:v,size:0},label:{width:m,height:b,text:y},anchor:void 0,placement:void 0}}createNodeData(){const{id:e,dataModel:t,processedData:i,sizeScale:o,properties:s,scale:a}=this,{idKey:n,sizeKey:r,colorKey:l,labelKey:c,label:h,legendItemName:p}=s;if(t==null||i==null)return;const u=t.resolveColumnById(this,"idValue",i),g=t.resolveColumnById(this,"featureValue",i),y=c==null?void 0:t.resolveColumnById(this,"labelValue",i),f=r==null?void 0:t.resolveColumnById(this,"sizeValue",i),x=l==null?void 0:t.resolveColumnById(this,"colorValue",i),S=s.maxStrokeWidth??s.strokeWidth;o.range=[Math.min(s.strokeWidth,S),S];const v=cz(h),m=new Map;for(const[L]of i.dataSources.get(this.id)?.data.entries()??[]){const N=u[L],P=g[L]?.geometry??void 0,R=P!=null&&a!=null?os(P,a):void 0;N!=null&&R!=null&&m.set(N,R)}const b=[],k=[],A=[],M=i.dataSources.get(this.id)?.data??[];for(const[L,N]of M.entries()){const P=u[L],R=x?.[L],F=f?.[L],_=y?.[L],E=m.get(P);E==null&&A.push(P);const T=this.getLabelDatum(N,_,E,v);T!=null&&k.push(T),b.push({series:this,itemId:n,datum:N,datumIndex:L,idValue:P,labelValue:_,colorValue:R,sizeValue:F,projectedGeometry:E,legendItemName:p,style:this.getItemStyle({datumIndex:L,datum:N,colorValue:R,sizeValue:F},!1)})}const D=10;if(A.length>D){const L=A.length-D;A.length=D,A.push(`(+${L} more)`)}return A.length>0&&Nb.warnOnce("some data items do not have matches in the provided topology",A),{itemId:e,nodeData:b,labelData:k}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e,highlightDatumSelection:t}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let i=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:o}=this.properties,s=o!=null&&i?.datum==null&&o===i?.legendItemName;i!=null&&(i.series!==this&&!s||i.datum==null)&&(i=void 0);const a=this.contextNodeData?.nodeData??[];this.datumSelection=this.updateDatumSelection({nodeData:a,datumSelection:e}),this.updateDatumStyles({datumSelection:e,isHighlight:!1}),this.updateDatumNodes({datumSelection:e,isHighlight:!1}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:i==null?[]:[i],datumSelection:t}),this.updateDatumStyles({datumSelection:t,isHighlight:!0}),this.updateDatumNodes({datumSelection:t,isHighlight:!0})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>Rb(t.idValue))}getItemStyle({datumIndex:e=0,datum:t,colorValue:i,sizeValue:o},s){const{properties:a,colorScale:n,sizeScale:r}=this,{colorRange:l,itemStyler:c}=a,h=this.getHighlightStyle(s,e),p=Bb(h,a.getStyle());!s&&i!=null&&(p.stroke=this.isColorScaleValid()?n.convert(i):l?.[0]??a.stroke),o!=null&&(p.strokeWidth=r.convert(o,{clamp:!0}));let u;return c!=null&&(u=this.cachedDatumCallback(Rb(e,s?"highlight":"node"),()=>{const g=this.makeItemStylerParams(t,e,s,p);return this.callWithContext(c,g)})),u?Bb(p,u):p}makeItemStylerParams(e,t,i,o){const{id:s}=this,a=this.ctx.highlightManager?.getActiveHighlight(),n=this.getHighlightStateString(a,i,t);return{seriesId:s,datum:e,highlighted:i,highlightState:n,...o}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,o)=>{o.style=this.getItemStyle(o,t)})}updateDatumNodes({datumSelection:e}){e.each((t,i)=>{const{projectedGeometry:o,style:s}=i;if(o==null){t.visible=!1,t.projectedGeometry=void 0;return}t.visible=!0,t.projectedGeometry=o,t.setProperties(s)})}updatePlacedLabelData(e){this.labelSelection=this.labelSelection.update(e,t=>{t.pointerEvents=Cb.PointerEvents.None}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((o,{x:s,y:a,width:n,height:r,text:l},c)=>{const h=Cz(this,void 0,t,t.label,!1,i),{color:p,fontStyle:u,fontWeight:g,fontSize:y,fontFamily:f}=h;o.visible=!0,o.x=s+n/2,o.y=a+r/2,o.text=l,o.fill=p,o.fontStyle=u,o.fontWeight=g,o.fontSize=y,o.fontFamily=f,o.textAlign="center",o.textBaseline="middle",o.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,o.setBoxing(h)})}resetAnimation(){}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}pickNodeClosestDatum({x:e,y:t}){let i=1/0,o;return this.datumSelection.each((s,a)=>{const n=s.distanceSquared(e,t);nnew Vc(e),themeTemplate:{...or,series:{stroke:Qi(Ec.SAFE_STROKE_FILL_OPERATION),colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},Qi(Ec.SAFE_RANGE2_OPERATION)]},strokeWidth:1,maxStrokeWidth:3,lineDash:[0],lineDashOffset:0,label:{...Ec.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:Qi(Ec.multiSeriesHighlightStyle(!1))},tooltip:{range:"exact"}}},jz={type:"series",name:"map-line",chartType:"topology",enterprise:!0,options:Fb,create:e=>new Vc(e)};import{_ModuleSupport as Yz}from"ag-charts-community";import{Logger as Uz}from"ag-charts-core";import{_ModuleSupport as Xz}from"ag-charts-community";var{Property:Xs,SeriesProperties:Zz,makeSeriesTooltip:qz}=Xz,ss=class extends Zz{constructor(){super(...arguments),this.topology=void 0,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.tooltip=qz()}};d([Xs],ss.prototype,"topology",2),d([Xs],ss.prototype,"stroke",2),d([Xs],ss.prototype,"strokeOpacity",2),d([Xs],ss.prototype,"strokeWidth",2),d([Xs],ss.prototype,"lineDash",2),d([Xs],ss.prototype,"lineDashOffset",2),d([Xs],ss.prototype,"tooltip",2);var{createDatumId:Qz,Group:Jz,Selection:eF,PointerEvents:Hb}=Yz,Wc=class extends sr{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[]}),this.properties=new ss,this._chartTopology=void 0,this.itemGroup=this.contentGroup.appendChild(new Jz({name:"itemGroup"})),this.datumSelection=eF.select(this.itemGroup,()=>this.nodeFactory()),this.itemGroup.pointerEvents=Hb.None}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get focusable(){return!1}setOptionsData(){}setChartData(){}get hasData(){return!1}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,e,0],this.highlightGroup.zIndex=[0,e,1],!0}nodeFactory(){const e=new Za;return e.renderMode=2,e.lineJoin="round",e.lineCap="round",e.pointerEvents=Hb.None,e}processData(){const{topology:e}=this;this.topologyBounds=e?.features.reduce((t,i)=>{const o=i.geometry;return o==null?t:qa(o,t)},void 0),e==null&&Uz.warnOnce("no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.")}createNodeData(){const{id:e,topology:t,scale:i,properties:o}=this;if(t==null)return;const{stroke:s,strokeOpacity:a,lineDash:n,lineDashOffset:r,strokeWidth:l}=o,c=[],h=[];for(const[p,u]of t.features.entries()){const{geometry:g}=u,y=g!=null&&i!=null?os(g,i):void 0;y!=null&&c.push({series:this,itemId:p,datum:u,datumIndex:0,index:p,projectedGeometry:y,style:{stroke:s,strokeOpacity:a,lineDash:n,lineDashOffset:r,strokeWidth:l}})}return{itemId:e,nodeData:c,labelData:h}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;const{nodeData:t=[]}=this.contextNodeData??{};this.datumSelection=this.updateDatumSelection({nodeData:t,datumSelection:e}),this.updateDatumNodes({datumSelection:e})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>Qz(t.index))}updateDatumNodes(e){const{datumSelection:t}=e;t.each((i,o)=>{const{projectedGeometry:s}=o;if(s==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=s,i.setProperties(o.style)})}resetAnimation(){}getLegendData(){return[]}getTooltipContent(e){}computeFocusBounds(e){}hasItemStylers(){return!1}};Wc.className="MapLineBackgroundSeries",Wc.type="map-line-background";import{_ModuleSupport as tF}from"ag-charts-community";import{constant as iF,geoJson as oF,required as sF}from"ag-charts-core";var{mapLineBackgroundSeriesThemeableOptionsDef:aF}=tF,nF={...aF,type:sF(iF("map-line-background")),topology:oF},rF={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-line-background",moduleFactory:e=>new Wc(e),themeTemplate:{...or,series:{stroke:{$path:["/1",{$mapPalette:"stroke"},{$mapPalette:"secondHierarchyColors"}]},strokeWidth:1,lineDash:[0],lineDashOffset:0}}},lF={type:"series",name:"map-line-background",chartType:"topology",enterprise:!0,options:nF,create:e=>new Wc(e)};import{_ModuleSupport as Qa}from"ag-charts-community";import{ValidationError as cF,validate as hF}from"ag-charts-core";import{_ModuleSupport as Vb}from"ag-charts-community";import{Logger as dF,cachedTextMeasurer as pF}from"ag-charts-core";var uF=void 0,gF=void 0;gF=uF;var yF=void 0,fF=void 0;fF=yF;var mF=void 0,xF=void 0;xF=mF;var SF=void 0,bF=void 0;bF=SF;import{insertListItemsSorted as vF}from"ag-charts-core";function Wb(e,t,i){const o=Us(e[0],void 0);if(o==null)return;const s=(o.lon0+o.lon1)/2,a=(o.lat0+o.lat1)/2,n=Math.abs(o.lon1-o.lon0),r=Math.abs(o.lat1-o.lat0),l=gz(e[0]),[c,h]=l,p=-zc(e,c,h);let u;const g=(k,A)=>{const D=Math.max(A-p,0);return k-.5*D},y=(k,A,M)=>{const{distance:D,maxDistance:L}=i(e,k,A,M),N=Math.hypot(c-k,h-A),P=Math.min(Math.max(c,k-M/2),k+M/2),R=Math.min(Math.max(h,A-M/2),A+M/2),F=Math.hypot(c-P,h-R),_=g(D,N),E=g(L,F);return{distance:D,maxDistance:L,value:_,maxValue:E,x:k,y:A,stride:M}},f=(k,A,M,D)=>{const L=y(A,M,D);L.maxDistance>=0&&k.push(L)},x=Math.min(n,r)/2;let S={value:y(s,a,x),next:null};for(;S!=null;){const k=S.value,{distance:A,value:M,maxValue:D,x:L,y:N,stride:P}=k;if(S=S.next,A>0&&(u==null||M>u.value)&&(u=k),u!=null&&D-u.value<=t)continue;const R=P/2,F=[];f(F,L-R,N-R,R),f(F,L+R,N-R,R),f(F,L-R,N+R,R),f(F,L+R,N+R,R),F.sort(Gb),S=vF(S,F,Gb)}if(u==null)return;const{distance:v,x:m,y:b}=u;return{x:m,y:b,distance:v}}var Gb=(e,t)=>t.maxValue-e.maxValue;function gu(e,t){const i=Wb(e,t,(a,n,r,l)=>{const c=-zc(a,n,r),h=c+l*Math.SQRT2;return{distance:c,maxDistance:h}});if(i==null)return;const{x:o,y:s}=i;return[o,s]}function Kb(e,t){let i;switch(e.type){case"GeometryCollection":return e.geometries.flatMap(o=>Kb(o,t));case"MultiPoint":return e.coordinates;case"Point":return[e.coordinates];case"MultiPolygon":{const o=Fc(e);i=o==null?void 0:gu(o,t);break}case"Polygon":{const o=e.coordinates;i=o==null?void 0:gu(o,t);break}case"MultiLineString":{const o=Hc(e);i=o==null?void 0:Bc(o)?.point;break}case"LineString":{const o=e.coordinates;i=Bc(o)?.point;break}}return i==null?[]:[i]}import{_ModuleSupport as kF}from"ag-charts-community";var{BBox:DF}=kF;function $b(e){if(!e)return;const{range:t}=e,i=t[0][0],o=t[0][1],s=t[1][0]-i,a=t[1][1]-o,n=new DF(i,o,s,a);return{series:n,axis:n}}import{_ModuleSupport as MF}from"ag-charts-community";var{Property:pe,SeriesProperties:AF,makeSeriesTooltip:IF,Label:LF}=MF,jb=class extends LF{constructor(){super(...arguments),this.placement="bottom"}};d([pe],jb.prototype,"placement",2);var ue=class extends AF{constructor(){super(...arguments),this.topology=void 0,this.idKey=void 0,this.topologyIdKey="name",this.idName=void 0,this.latitudeKey=void 0,this.latitudeName=void 0,this.longitudeKey=void 0,this.longitudeName=void 0,this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.shape="circle",this.size=6,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.label=new jb,this.tooltip=IF()}getStyle(){const{size:e,shape:t,fill:i,fillOpacity:o,stroke:s,strokeWidth:a,strokeOpacity:n,lineDash:r,lineDashOffset:l}=this;return{size:e,shape:t,fill:i,fillOpacity:o,opacity:1,stroke:s,strokeWidth:a,strokeOpacity:n,lineDash:r,lineDashOffset:l}}};d([pe],ue.prototype,"topology",2),d([pe],ue.prototype,"title",2),d([pe],ue.prototype,"legendItemName",2),d([pe],ue.prototype,"idKey",2),d([pe],ue.prototype,"topologyIdKey",2),d([pe],ue.prototype,"idName",2),d([pe],ue.prototype,"latitudeKey",2),d([pe],ue.prototype,"latitudeName",2),d([pe],ue.prototype,"longitudeKey",2),d([pe],ue.prototype,"longitudeName",2),d([pe],ue.prototype,"labelKey",2),d([pe],ue.prototype,"labelName",2),d([pe],ue.prototype,"sizeKey",2),d([pe],ue.prototype,"sizeName",2),d([pe],ue.prototype,"colorKey",2),d([pe],ue.prototype,"colorName",2),d([pe],ue.prototype,"colorRange",2),d([pe],ue.prototype,"shape",2),d([pe],ue.prototype,"size",2),d([pe],ue.prototype,"maxSize",2),d([pe],ue.prototype,"sizeDomain",2),d([pe],ue.prototype,"fill",2),d([pe],ue.prototype,"fillOpacity",2),d([pe],ue.prototype,"stroke",2),d([pe],ue.prototype,"strokeWidth",2),d([pe],ue.prototype,"strokeOpacity",2),d([pe],ue.prototype,"lineDash",2),d([pe],ue.prototype,"lineDashOffset",2),d([pe],ue.prototype,"itemStyler",2),d([pe],ue.prototype,"label",2),d([pe],ue.prototype,"tooltip",2);var{fromToMotion:TF,StateMachine:CF,getMissCount:NF,createDatumId:Yb,SeriesNodePickMode:Ub,valueProperty:Zs,computeMarkerFocusBounds:wF,ColorScale:PF,LinearScale:OF,Group:_F,Selection:yu,Text:RF,Marker:fu,applyShapeStyle:EF,getLabelStyles:BF,LonLatBBox:zF,mergeDefaults:Xb}=Vb,Gc=class extends sr{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{size:["colorKey"],color:["colorKey"],label:["labelKey"]},propertyNames:{size:["sizeName"],color:["colorName"],label:["labelName"]},pickModes:[Ub.EXACT_SHAPE_MATCH,Ub.NEAREST_NODE],usesPlacedLabels:!0}),this.properties=new ue,this._chartTopology=void 0,this.colorScale=new PF,this.sizeScale=new OF,this.markerGroup=this.contentGroup.appendChild(new _F({name:"markerGroup"})),this.labelSelection=yu.select(this.labelGroup,RF,!1),this.markerSelection=yu.select(this.markerGroup,fu,!1),this.highlightMarkerSelection=yu.select(this.highlightGroup,fu),this.animationState=new CF("empty",{empty:{update:{target:"ready",action:()=>this.animateMarkers()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.resetAllAnimation(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateMarkers()},resize:{target:"ready",action:()=>this.resetAllAnimation()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty",action:()=>this.resetAllAnimation()},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){const e=this.properties.latitudeKey!=null&&this.properties.longitudeKey!=null;return super.hasData&&(this.topology!=null||e)}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[3,e],this.highlightGroup.zIndex=[4,e],!0}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}async processData(e){if(this.data==null)return;const{data:t,topology:i,sizeScale:o,colorScale:s}=this,{topologyIdKey:a,idKey:n,latitudeKey:r,longitudeKey:l,sizeKey:c,colorKey:h,labelKey:p,sizeDomain:u,colorRange:g}=this.properties,y=new Map;for(const D of i?.features.values()??[]){const L=D.properties?.[a];L!=null&&y.set(L,D)}const f=this.sizeScale.type,x=this.colorScale.type,S=this.scale?.type,v=r!=null&&l!=null,{dataModel:m,processedData:b}=await this.requestDataModel(e,t,{props:[...n==null?[]:[Zs(n,S,{id:"idValue",includeProperty:!1}),Zs(n,S,{id:"featureValue",includeProperty:!1,processor:()=>D=>y.get(D)})],...v?[Zs(r,S,{id:"latValue"}),Zs(l,S,{id:"lonValue"})]:[],...p?[Zs(p,"category",{id:"labelValue"})]:[],...c?[Zs(c,f,{id:"sizeValue"})]:[],...h?[Zs(h,x,{id:"colorValue"})]:[]]}),k=n==null?void 0:m.resolveColumnById(this,"featureValue",b),A=v?m.resolveColumnById(this,"latValue",b):void 0,M=v?m.resolveColumnById(this,"lonValue",b):void 0;if(this.topologyBounds=b.dataSources.get(this.id)?.data.reduce((D,L,N)=>{const R=k?.[N]?.geometry;if(R!=null&&(D=qa(R,D)),A!=null&&M!=null){const F=M[N],_=A[N];D=zF.extend(D,F,_,F,_)}return D},void 0),c!=null){const D=m.resolveProcessedDataIndexById(this,"sizeValue"),L=b.domain.values[D]??[];o.domain=u??L}if(g!=null&&this.isColorScaleValid()){const D=m.resolveProcessedDataIndexById(this,"colorValue");s.domain=b.domain.values[D],s.range=g,s.update()}this.animationState.transition("updateData")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const o=t.resolveProcessedDataIndexById(this,"colorValue"),s=i.input.count,a=NF(this,i.defs.values[o].missing);return!(s===0||s===a)}getLabelDatum(e,t,i,o,s,a){if(t==null)return;const{idKey:n,idName:r,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:p,sizeKey:u,sizeName:g,colorKey:y,colorName:f,labelKey:x,labelName:S,label:v,shape:m}=this.properties;if(x==null||!v.enabled)return;const{placement:b}=v,k=this.getLabelText(t,e,x,"label",[],v,{value:t,datum:e,idKey:n,idName:r,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:p,sizeKey:u,sizeName:g,colorKey:y,colorName:f,labelKey:x,labelName:S});if(k==null)return;const{width:A,height:M}=a.measureLines(String(k)),D=fu.anchor(m);return{point:{x:i,y:o,size:s},label:{width:A,height:M,text:k},anchor:D,placement:b}}createNodeData(){const{id:e,dataModel:t,processedData:i,sizeScale:o,properties:s,scale:a}=this,{idKey:n,latitudeKey:r,longitudeKey:l,sizeKey:c,colorKey:h,labelKey:p,label:u,legendItemName:g}=s;if(t==null||i==null||a==null)return;const y=r!=null&&l!=null,f=n==null?void 0:t.resolveColumnById(this,"idValue",i),x=n==null?void 0:t.resolveColumnById(this,"featureValue",i),S=y?t.resolveColumnById(this,"latValue",i):void 0,v=y?t.resolveColumnById(this,"lonValue",i):void 0,m=p==null?void 0:t.resolveColumnById(this,"labelValue",i),b=c==null?void 0:t.resolveColumnById(this,"sizeValue",i),k=h==null?void 0:t.resolveColumnById(this,"colorValue",i),A=s.maxSize??s.size;o.range=[Math.min(s.size,A),A];const M=pF(u);let D;if(f!=null&&x!=null){D=new Map;for(const[_]of i.dataSources.get(this.id)?.data.entries()??[]){const E=f[_],T=x[_]?.geometry??void 0,w=T!=null&&a!=null?os(T,a):void 0;E!=null&&w!=null&&D.set(E,w)}}const L=[],N=[],P=[],R=i.dataSources.get(this.id)?.data??[];for(const[_,E]of R.entries()){const T=f?.[_],w=v?.[_],C=S?.[_],I=k?.[_],O=b?.[_],z=m?.[_],B=O==null?s.size:o.convert(O,{clamp:!0}),H=T==null?void 0:D?.get(T);if(T!=null&&os==null&&P.push(T),w!=null&&C!=null){const[W,V]=a.convert([w,C]),G=this.getLabelDatum(E,z,W,V,B,M);G&&N.push(G),L.push({series:this,itemId:r,datum:E,datumIndex:_,index:-1,idValue:T,lonValue:w,latValue:C,labelValue:z,sizeValue:O,colorValue:I,point:{x:W,y:V,size:B},midPoint:{x:W,y:V},legendItemName:g,style:this.getMarkerItemStyle({datumIndex:_,datum:E,colorValue:I,sizeValue:O},!1)})}else if(H!=null)for(const[W,[V,G]]of Kb(H,1).entries()){const K=this.getLabelDatum(E,z,V,G,B,M);K&&N.push(K),L.push({series:this,itemId:r,datum:E,datumIndex:_,index:W,idValue:T,lonValue:w,latValue:C,labelValue:z,sizeValue:O,colorValue:I,point:{x:V,y:G,size:B},midPoint:{x:V,y:G},legendItemName:g,style:this.getMarkerItemStyle({datumIndex:_,datum:E,colorValue:I,sizeValue:O},!1)})}}const F=10;if(P.length>F){const _=P.length-F;P.length=F,P.push(`(+${_} more)`)}return P.length>0&&dF.warnOnce("some data items do not have matches in the provided topology",P),{itemId:e,nodeData:L,labelData:N}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}checkScaleChange(){return this.previousScale===this.scale?!1:(this.previousScale=this.scale,!0)}update({seriesRect:e}){const t=this.checkResize(e),i=this.checkScaleChange(),{markerSelection:o,highlightMarkerSelection:s}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let a=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:n}=this.properties,r=n!=null&&a?.datum==null&&n===a?.legendItemName;a!=null&&(a.series!==this&&!r||a.datum==null)&&(a=void 0);const l=this.contextNodeData?.nodeData??[];this.markerSelection=this.updateMarkerSelection({markerData:l,markerSelection:o}),this.updateMarkerNodes({markerSelection:o,isHighlight:!1,highlightedDatum:a}),this.highlightMarkerSelection=this.updateMarkerSelection({markerData:a==null?[]:[a],markerSelection:s}),this.updateMarkerNodes({markerSelection:s,isHighlight:!0,highlightedDatum:a}),(i||t)&&this.animationState.transition("resize"),this.animationState.transition("update")}updatePlacedLabelData(e){this.labelSelection=this.labelSelection.update(e,t=>{t.pointerEvents=Vb.PointerEvents.None}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((o,{x:s,y:a,width:n,height:r,text:l},c)=>{const h=BF(this,void 0,t,t.label,!1,i),{color:p,fontStyle:u,fontWeight:g,fontSize:y,fontFamily:f}=h;o.visible=!0,o.x=s+n/2,o.y=a+r/2,o.text=l,o.fill=p,o.fontStyle=u,o.fontWeight=g,o.fontSize=y,o.fontFamily=f,o.textAlign="center",o.textBaseline="middle",o.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,o.setBoxing(h)})}updateMarkerSelection(e){const{markerData:t,markerSelection:i}=e;return i.update(t,void 0,o=>Yb(o.index,o.idValue,o.lonValue,o.latValue))}getMarkerItemStyle({datumIndex:e,datum:t,colorValue:i,sizeValue:o},s){const{properties:a,colorScale:n,sizeScale:r}=this,{colorRange:l,itemStyler:c}=a,h=this.getHighlightStyle(s,e),p=Xb(h,a.getStyle());!s&&i!=null&&(p.fill=this.isColorScaleValid()?n.convert(i):l?.[0]??p.fill),o!=null&&(p.size=r.convert(o,{clamp:!0}));let u=p;if(c!=null&&e!=null){const g=this.cachedDatumCallback(Yb(e,s?"highlight":"node"),()=>{const y=this.makeItemStylerParams(t,e,s,u);return this.callWithContext(c,y)});g&&(u=Xb(g,p))}return u}makeItemStylerParams(e,t,i,o){const{id:s}=this,a=this.ctx.highlightManager?.getActiveHighlight(),n=this.getHighlightStateString(a,i,t),r=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:s,datum:e,highlighted:i,highlightState:n,...o,fill:r}}updateMarkerNodes(e){const{markerSelection:t,isHighlight:i,highlightedDatum:o}=e,s=$b(this.scale);t.each((a,n)=>{const{datum:r,point:l}=n,c=this.getMarkerItemStyle(n,i);a.shape=c.shape,a.size=c.size,EF(a,c,s),a.x=l.x,a.y=l.y,a.scalingCenterX=l.x,a.scalingCenterY=l.y,a.zIndex=!i&&o!=null&&r===o.datum?1:0})}isProcessedDataAnimatable(){return!0}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),this.ctx.animationManager.skipCurrentBatch(),this.labelSelection.cleanup(),this.markerSelection.cleanup(),this.highlightMarkerSelection.cleanup()}animateMarkers(){const{animationManager:e}=this.ctx,t=Dz();TF(this.id,"markers",e,[this.markerSelection,this.highlightMarkerSelection],t)}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}pickNodeClosestDatum(e){const{x:t,y:i}=e;let o=1/0,s;for(const a of this.contextNodeData?.nodeData??[]){const{x:n,y:r,size:l}=a.point,c=Math.max(Math.abs(n-t)-l,0),h=Math.max(Math.abs(r-i)-l,0),p=c*c+h*h;p=0?"N":"S"}, ${Math.abs(R).toFixed(4)}\xB0 ${R>=0?"W":"E"}`}const N=this.getMarkerItemStyle({datumIndex:e,datum:k,colorValue:M,sizeValue:A},!1);return this.formatTooltipWithContext(b,{heading:L,title:v??m,symbol:this.legendItemSymbol(e),data:D},{seriesId:t,datum:k,title:v,idKey:n,idName:r,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:p,colorKey:u,colorName:g,sizeKey:y,sizeName:f,labelKey:x,labelName:S,...N})}getFormattedMarkerStyle(e){const t=this.getMarkerItemStyle(e,!1);return{size:t.size,shape:t.shape}}computeFocusBounds(e){return wF(this,e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};Gc.className="MapMarkerSeries",Gc.type="map-marker";import{_ModuleSupport as FF}from"ag-charts-community";import{constant as HF,geoJson as VF,required as WF,string as It}from"ag-charts-core";var{commonSeriesOptionsDefs:GF,mapMarkerSeriesThemeableOptionsDef:KF,without:$F}=FF,jF={...$F(GF,["highlightStyle","highlight"]),...KF,type:WF(HF("map-marker")),idKey:It,latitudeKey:It,longitudeKey:It,sizeKey:It,colorKey:It,labelKey:It,idName:It,latitudeName:It,longitudeName:It,sizeName:It,colorName:It,labelName:It,topology:VF,topologyIdKey:It,legendItemName:It,title:It},YF={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-marker",moduleFactory:e=>new Gc(e),themeTemplate:{...or,series:{shape:"circle",maxSize:30,fill:Qi({$applySwitch:[{$path:"type"},{$mapPalette:"fill"},["gradient",Qa.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",Qa.FILL_IMAGE_DEFAULTS],["pattern",Qa.FILL_PATTERN_DEFAULTS]]}),stroke:{$mapPalette:"stroke"},colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},Qi(Qa.SAFE_RANGE2_OPERATION)]},fillOpacity:.5,label:{...Qa.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:Qi(Qa.multiSeriesHighlightStyle())},tooltip:{range:"exact"}}},UF={type:"series",name:"map-marker",chartType:"topology",enterprise:!0,options:jF,create:e=>new Gc(e),validate(e,t,i){const o=hF(e,t,i),{cleared:s,invalid:a}=o;if(s?.idKey==null&&(s?.latitudeKey==null||s?.longitudeKey==null)){const n=l=>i?`${i}.${l}`:l,r=`Either \`${n("idKey")}\` or both \`${n("latitudeKey")}\` and \`${n("longitudeKey")}\` are required.`;a.push(new cF("required",r,null,i))}return o}};import{_ModuleSupport as Ja}from"ag-charts-community";import{_ModuleSupport as Zb}from"ag-charts-community";import{Logger as qb,cachedTextMeasurer as XF,isArray as ZF,measureTextSegments as qF,toPlainText as QF}from"ag-charts-core";function JF(e,{aspectRatio:t,precision:i}){const o=Wb(e,i,(l,c,h,p)=>{const u=tH(l,c,h,t),g=u+2*p*t,y=u*Math.SQRT2,f=g*Math.SQRT2;return{distance:y,maxDistance:f}});if(o==null)return;const{x:s,y:a,distance:n}=o,r=n/Math.SQRT2;return{x:s,y:a,maxWidth:r}}function eH(e,t,i,o,s){const[a,n]=e,[r,l]=t,c=1/s,h=r-a,p=l-n,[u,g]=n<=l?e:t,[y,f]=a<=r?e:t,[x,S]=n<=l?t:e,[v,m]=a<=r?t:e;let b=1/0;if(h===0)for(let N=0;N<=1;N+=1){const R=(N===0?c:-c)*(a-i)+o;if(R>=g&&R<=S){const _=Math.abs(o-R)*2*s;b=Math.min(b,_)}}else{const N=p/h;for(let P=0;P<=1;P+=1){const R=P===0?c:-c,F=(N*a-n-R*i+o)/(N-R);if(F>=y&&F<=v){const _=Math.abs(i-F)*2;b=Math.min(b,_)}}}const k=s,A=Math.abs((u-i)/(g-o)),M=Math.abs((x-i)/(S-o));if(So&&Ai&&Di!=c>i&&t<(l-p)*(i-u)/(c-u)+p&&(s=!s);const g=eH(r,h,t,i,o);a=Math.min(a,g),r=h,l=p,c=u}}return(s?1:-1)*a}function Kc(e,t,i){i>=t&&(e.maxX=Math.min(e.maxX,i-t)),i<=t&&(e.minX=Math.max(e.minX,i-t))}function iH(e,t,i,o,s,a){const n=s-a/2,r=s+a/2,[l,c]=t,[h,p]=i,u=h-l,g=p-c,[y,f]=l<=h?t:i,[x,S]=l<=h?i:t;if(u!==0){const v=g/u;for(let m=0;m<=1;m+=1){const k=((m===0?n:r)-c)/v+l;k>=y&&k<=x&&Kc(e,o,k)}}else Math.max(n,Math.min(c,p))<=Math.min(r,Math.max(c,p))&&Kc(e,o,l);return x=n&&S<=r?Kc(e,o,x):y>o&&f>=n&&f<=r&&Kc(e,o,y),e}function oH(e,t,i,o){const s={minX:-1/0,maxX:1/0};for(const r of e){let l=r.at(-1);for(const c of r)iH(s,l,c,t,i,o),l=c}const{minX:a,maxX:n}=s;return Number.isFinite(a)&&Number.isFinite(n)?{x:t+(a+n)/2,width:n-a}:{x:t,width:0}}import{_ModuleSupport as sH}from"ag-charts-community";var{Property:Ce,SeriesProperties:aH,makeSeriesTooltip:nH}=sH,Ae=class extends aH{constructor(){super(...arguments),this.topology=void 0,this.idKey="",this.idName=void 0,this.topologyIdKey="name",this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.padding=0,this.label=new zn,this.tooltip=nH()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n,opacity:1}}};d([Ce],Ae.prototype,"topology",2),d([Ce],Ae.prototype,"title",2),d([Ce],Ae.prototype,"legendItemName",2),d([Ce],Ae.prototype,"idKey",2),d([Ce],Ae.prototype,"idName",2),d([Ce],Ae.prototype,"topologyIdKey",2),d([Ce],Ae.prototype,"labelKey",2),d([Ce],Ae.prototype,"labelName",2),d([Ce],Ae.prototype,"colorKey",2),d([Ce],Ae.prototype,"colorName",2),d([Ce],Ae.prototype,"colorRange",2),d([Ce],Ae.prototype,"fill",2),d([Ce],Ae.prototype,"fillOpacity",2),d([Ce],Ae.prototype,"stroke",2),d([Ce],Ae.prototype,"strokeOpacity",2),d([Ce],Ae.prototype,"strokeWidth",2),d([Ce],Ae.prototype,"lineDash",2),d([Ce],Ae.prototype,"lineDashOffset",2),d([Ce],Ae.prototype,"padding",2),d([Ce],Ae.prototype,"itemStyler",2),d([Ce],Ae.prototype,"label",2),d([Ce],Ae.prototype,"tooltip",2);var{getMissCount:rH,createDatumId:Qb,SeriesNodePickMode:Jb,valueProperty:$c,ColorScale:lH,Group:ev,Selection:mu,Text:cH,PointerEvents:hH,applyShapeStyle:dH,getLabelStyles:pH,mergeDefaults:tv}=Zb,iv=Zb.MercatorScale.fixedScale(),jc=class extends sr{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{color:["colorKey"],label:["labelKey"]},propertyNames:{color:["colorName"],label:["labelName"]},pickModes:[Jb.EXACT_SHAPE_MATCH,Jb.NEAREST_NODE]}),this.properties=new Ae,this._chartTopology=void 0,this.colorScale=new lH,this.itemGroup=this.contentGroup.appendChild(new ev({name:"itemGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new ev({name:"itemLabelGroup"})),this.datumSelection=mu.select(this.itemGroup,()=>this.nodeFactory()),this.labelSelection=mu.select(this.itemLabelGroup,cH),this.highlightDatumSelection=mu.select(this.highlightGroup,()=>this.nodeFactory()),this.previousLabelLayouts=void 0,this._previousDatumMidPoint=void 0,this.itemLabelGroup.pointerEvents=hH.None}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){return super.hasData&&this.topology!=null}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[1,e],this.highlightGroup.zIndex=[2,e],!0}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}nodeFactory(){const e=new Za;return e.renderMode=1,e.lineJoin="round",e}async processData(e){if(this.data==null)return;const{data:t,topology:i,colorScale:o}=this,{topologyIdKey:s,idKey:a,colorKey:n,labelKey:r,colorRange:l}=this.properties,c=new Map;for(const f of i?.features.values()??[]){const x=f.properties?.[s];x==null||!hu(f.geometry,1)||c.set(x,f)}const h=this.colorScale.type,p=this.scale?.type,{dataModel:u,processedData:g}=await this.requestDataModel(e,t,{props:[$c(a,p,{id:"idValue",includeProperty:!1}),$c(a,p,{id:"featureValue",includeProperty:!1,processor:()=>f=>c.get(f)}),...r?[$c(r,"category",{id:"labelValue"})]:[],...n?[$c(n,h,{id:"colorValue"})]:[]]}),y=u.resolveColumnById(this,"featureValue",g);if(this.topologyBounds=y.reduce((f,x)=>{const S=x?.geometry;return S==null?f:qa(S,f)},void 0),l!=null&&this.isColorScaleValid()){const f=u.resolveProcessedDataIndexById(this,"colorValue");o.domain=g.domain.values[f],o.range=l,o.update()}i==null&&qb.warnOnce("no topology was provided for [MapShapeSeries]; nothing will be rendered.")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const o=t.resolveProcessedDataIndexById(this,"colorValue"),s=i.input.count,a=rH(this,i.defs.values[o].missing);return!(s===0||s===a)}getLabelLayout(e,t,i,o,s){if(t==null||o==null)return;const{idKey:a,idName:n,colorKey:r,colorName:l,labelKey:c,labelName:h,padding:p,label:u}=this.properties;if(c==null||!u.enabled)return;const g=this.getLabelText(t,e,c,"label",[],u,{value:t,datum:e,idKey:a,idName:n,colorKey:r,colorName:l,labelKey:c,labelName:h});if(g==null)return;const y=ZF(g)?qF(g,u):i.measureLines(String(g)),f=(y.width+2*p)/(y.height+2*p);if(s?.geometry===o&&s?.labelText===g&&s?.aspectRatio===f)return s;const x=os(o,iv),S=Fc(x);if(S==null)return;const v=JF(S,{aspectRatio:f,precision:.001});if(v==null)return;const{x:m,y:b,maxWidth:k}=v;return{geometry:o,labelText:g,aspectRatio:f,x:m,y:b,maxWidth:k,fixedPolygon:S}}getLabelDatum(e,t){const{scale:i}=this;if(i==null)return;const{padding:o,label:s}=this.properties,{labelText:a,aspectRatio:n,x:r,y:l,maxWidth:c,fixedPolygon:h}=e,p={width:Math.ceil(c*t),height:Math.ceil(c*t/n),meta:r},u=En(QF(a),s,{padding:o},(b,k)=>{if(!k)return p;const A=oH(h,r,l,b/t);return{width:A.width*t,height:b,meta:A.x}});if(u==null)return;const[{text:g,fontSize:y,lineHeight:f,width:x},S]=u,v=xA){const M=b.length-A;b.length=A,b.push(`(+${M} more)`)}return b.length>0&&qb.warnOnce("some data items do not have matches in the provided topology",b),{itemId:e,nodeData:v,labelData:m}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e,labelSelection:t,highlightDatumSelection:i}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let o=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:s}=this.properties,a=s!=null&&o?.datum==null&&s===o?.legendItemName;o!=null&&(o.series!==this&&!a||o.datum==null)&&(o=void 0);const n=this.contextNodeData?.nodeData??[],r=this.contextNodeData?.labelData??[];this.datumSelection=this.updateDatumSelection({nodeData:n,datumSelection:e}),this.updateDatumStyles({datumSelection:e,isHighlight:!1}),this.updateDatumNodes({datumSelection:e}),this.labelSelection=this.updateLabelSelection({labelData:r,labelSelection:t}),this.updateLabelNodes({labelSelection:t}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:o==null?[]:[o],datumSelection:i}),this.updateDatumStyles({datumSelection:i,isHighlight:!0}),this.updateDatumNodes({datumSelection:i})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>Qb(t.idValue))}getItemStyle({datumIndex:e,datum:t,colorValue:i},o){const{properties:s,colorScale:a}=this,{colorRange:n,itemStyler:r}=s,l=this.getHighlightStyle(o,e),c=tv(l,s.getStyle());!o&&i!=null&&(c.fill=this.isColorScaleValid()?a.convert(i):n?.[0]??c.fill);let h=c;if(r!=null&&e!=null){const p=this.cachedDatumCallback(Qb(e,o?"highlight":"node"),()=>{const u=this.makeItemStylerParams(t,e,o,h);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(r,u))});p&&(h=tv(p,h))}return h}makeItemStylerParams(e,t,i,o){const{id:s}=this,a=this.ctx.highlightManager?.getActiveHighlight(),n=this.getHighlightStateString(a,i,t),r=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:s,datum:e,highlighted:i,highlightState:n,...o,fill:r}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,o)=>{o.style=this.getItemStyle(o,t)})}updateDatumNodes({datumSelection:e}){const t=$b(this.scale);e.each((i,o)=>{const{projectedGeometry:s}=o;if(s==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=s,dH(i,o.style,t)})}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((o,{x:s,y:a,text:n,fontSize:r,lineHeight:l},c)=>{const h=pH(this,void 0,t,t.label,!1,i),{color:p,fontStyle:u,fontWeight:g,fontFamily:y}=h;o.visible=!0,o.x=s,o.y=a,o.text=n,o.fill=p,o.fontStyle=u,o.fontWeight=g,o.fontSize=r,o.lineHeight=l,o.fontFamily=y,o.textAlign="center",o.textBaseline="middle",o.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,o.setBoxing(h)})}resetAnimation(){}pickNodeClosestDatum({x:e,y:t}){let i=1/0,o;return this.datumSelection.each((s,a)=>{const n=s.distanceSquared(e,t);nnew jc(e),themeTemplate:{...or,series:{fill:Qi({$applySwitch:[{$path:"type"},{$mapPalette:"fill"},["gradient",Ja.FILL_GRADIENT_LINEAR_DEFAULTS],["image",Ja.FILL_IMAGE_DEFAULTS],["pattern",Ja.FILL_PATTERN_DEFAULTS]]}),stroke:{$ref:"chartBackgroundColor"},colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},Qi(Ja.SAFE_RANGE2_OPERATION)]},fillOpacity:1,strokeWidth:1,lineDash:[0],lineDashOffset:0,padding:2,label:{...Ja.LABEL_BOXING_DEFAULTS,color:{$ref:"chartBackgroundColor"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:"bold",overflowStrategy:"hide"},highlight:Qi(Ja.multiSeriesHighlightStyle(!0))},tooltip:{range:"exact"}}},vH={type:"series",name:"map-shape",chartType:"topology",enterprise:!0,options:SH,create:e=>new jc(e)};import{_ModuleSupport as xu}from"ag-charts-community";import{_ModuleSupport as kH}from"ag-charts-community";import{Logger as DH}from"ag-charts-core";import{_ModuleSupport as MH}from"ag-charts-community";var{Property:Ao,SeriesProperties:AH,makeSeriesTooltip:IH}=MH,Ji=class extends AH{constructor(){super(...arguments),this.topology=void 0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.tooltip=IH()}};d([Ao],Ji.prototype,"topology",2),d([Ao],Ji.prototype,"fill",2),d([Ao],Ji.prototype,"fillOpacity",2),d([Ao],Ji.prototype,"stroke",2),d([Ao],Ji.prototype,"strokeOpacity",2),d([Ao],Ji.prototype,"strokeWidth",2),d([Ao],Ji.prototype,"lineDash",2),d([Ao],Ji.prototype,"lineDashOffset",2),d([Ao],Ji.prototype,"tooltip",2);var{createDatumId:LH,Selection:TH,Group:CH,PointerEvents:sv}=kH,Yc=class extends sr{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[]}),this.properties=new Ji,this._chartTopology=void 0,this.itemGroup=this.contentGroup.appendChild(new CH({name:"itemGroup"})),this.datumSelection=TH.select(this.itemGroup,()=>this.nodeFactory()),this.itemGroup.pointerEvents=sv.None}get topology(){return this.properties.topology??this._chartTopology}get focusable(){return!1}setOptionsData(){}setChartData(){}getNodeData(){}get hasData(){return!1}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,e,0],this.highlightGroup.zIndex=[0,e,1],!0}nodeFactory(){const e=new Za;return e.renderMode=1,e.lineJoin="round",e.pointerEvents=sv.None,e}processData(){const{topology:e}=this;this.topologyBounds=e?.features.reduce((t,i)=>{const o=i.geometry;return o==null?t:qa(o,t)},void 0),e==null&&DH.warnOnce("no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.")}createNodeData(){const{id:e,topology:t,scale:i,properties:o}=this;if(t==null)return;const{fill:s,fillOpacity:a,stroke:n,strokeWidth:r,strokeOpacity:l,lineDash:c,lineDashOffset:h}=o,p=[],u=[];for(const[g,y]of t.features.entries()){const{geometry:f}=y,x=f!=null&&i!=null?os(f,i):void 0;x!=null&&p.push({series:this,itemId:g,datum:y,datumIndex:0,index:g,projectedGeometry:x,style:{fill:s,fillOpacity:a,stroke:n,strokeWidth:r,strokeOpacity:l,lineDash:c,lineDashOffset:h}})}return{itemId:e,nodeData:p,labelData:u}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;const{nodeData:t=[]}=this.contextNodeData??{};this.datumSelection=this.updateDatumSelection({nodeData:t,datumSelection:e}),this.updateDatumNodes({datumSelection:e})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>LH(t.index))}updateDatumNodes(e){const{datumSelection:t}=e;t.each((i,o)=>{const{projectedGeometry:s}=o;if(s==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=s,i.setProperties(o.style)})}resetAnimation(){}getLegendData(){return[]}getTooltipContent(e){}pickFocus(){}computeFocusBounds(e){}hasItemStylers(){return!1}};Yc.className="MapShapeBackgroundSeries",Yc.type="map-shape-background";import{_ModuleSupport as NH}from"ag-charts-community";import{constant as wH,geoJson as PH,required as OH}from"ag-charts-core";var{commonSeriesOptionsDefs:_H,mapShapeBackgroundSeriesThemeableOptionsDef:RH}=NH,EH={...RH,..._H,type:OH(wH("map-shape-background")),topology:PH},BH={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-shape-background",moduleFactory:e=>new Yc(e),themeTemplate:{...or,series:{fill:Qi({$applySwitch:[{$path:"type"},{$path:["/1",{$mapPalette:"fill"},{$mapPalette:"hierarchyColors"}]},["gradient",xu.FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS],["image",xu.FILL_IMAGE_DEFAULTS],["pattern",xu.FILL_PATTERN_HIERARCHY_DEFAULTS]]}),stroke:{$ref:"chartBackgroundColor"},strokeWidth:1}}},zH={type:"series",name:"map-shape-background",chartType:"topology",enterprise:!0,options:EH,create:e=>new Yc(e)};import{_ModuleSupport as FH}from"ag-charts-community";import{_ModuleSupport as HH}from"ag-charts-community";import{_ModuleSupport as nr}from"ag-charts-community";import{isDefined as VH}from"ag-charts-core";import{_ModuleSupport as av}from"ag-charts-community";var{createDatumId:WH,mergeDefaults:nv,toHighlightString:GH}=av;function KH(e,t,i){const{id:o}=e,{angleKey:s,cornerRadius:a,fill:n,fillOpacity:r,lineDash:l,lineDashOffset:c,radiusKey:h,stackGroup:p,stroke:u,strokeOpacity:g,strokeWidth:y}=e.properties,f=GH(i??av.HighlightState.None);return{angleKey:s,cornerRadius:a,fill:n,fillOpacity:r,highlightState:f,highlighted:t,lineDash:l,lineDashOffset:c,radiusKey:h,seriesId:o,stackGroup:p,stroke:u,strokeOpacity:g,strokeWidth:y}}function Su(e,t,i,o){const{styler:s}=e.properties;let a={};if(!t&&s){const n=KH(e,i,o);a=e.ctx.optionsGraphService.resolvePartial(["series",`${e.declarationOrder}`],e.cachedCallWithContext(s,n)??{},{pick:!1})??{}}return{cornerRadius:a.cornerRadius??e.properties.cornerRadius,fill:a.fill??e.properties.fill,fillOpacity:a.fillOpacity??e.properties.fillOpacity,lineDash:a.lineDash??e.properties.lineDash,lineDashOffset:a.lineDashOffset??e.properties.lineDashOffset,stroke:a.stroke??e.properties.stroke,strokeOpacity:a.strokeOpacity??e.properties.strokeOpacity,strokeWidth:a.strokeWidth??e.properties.strokeWidth,opacity:1}}function $H(e,t,i,o){const{id:s,properties:a}=e,{angleKey:n,radiusKey:r}=a,l=e.ctx.highlightManager?.getActiveHighlight(),c=e.getHighlightStateString(l,i,t.datumIndex),h=e.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:s,datum:t.datum,highlighted:i,highlightState:c,angleKey:n,radiusKey:r,...o,fill:h}}function en(e,t,i,o){const{properties:s}=e,{itemStyler:a}=s,n=e.getHighlightStyle(i,t?.datumIndex,o);let l=nv(n,Su(e,t===void 0,i,o));if(a!=null&&t!=null){const c=e.cachedDatumCallback(WH(e.getDatumId(t),i?"highlight":"node"),()=>{const h=$H(e,t,i,l);return e.callWithContext(a,h)});c&&(l=nv(c,l))}return l}var{DEFAULT_POLAR_DIRECTION_KEYS:jH,DEFAULT_POLAR_DIRECTION_NAMES:YH,ChartAxisDirection:eo,PolarAxis:UH,diff:XH,fixNumericExtent:ZH,groupAccumulativeValueProperty:rv,keyProperty:qH,normaliseGroupTo:QH,resetLabelFn:JH,seriesLabelFadeInAnimation:eV,seriesLabelFadeOutAnimation:tV,valueProperty:iV,animationValidation:oV,createDatumId:sV,SeriesNodePickMode:lv,normalizeAngle360:cv,CategoryScale:aV,motion:hv,applyShapeStyle:nV,isGradientFill:rV,updateLabelNode:lV,getItemStyles:cV}=nr,hV=class extends nr.SeriesNodeEvent{constructor(e,t,i,o){super(e,t,i,o),this.angleKey=o.properties.angleKey,this.radiusKey=o.properties.radiusKey}},dv=class extends nr.PolarSeries{constructor(e,{animationResetFns:t}){super({moduleCtx:e,categoryKey:"angleValue",propertyKeys:jH,propertyNames:YH,canHaveAxes:!0,pickModes:[lv.NEAREST_NODE,lv.EXACT_SHAPE_MATCH],animationResetFns:{...t,label:JH}}),this.NodeEvent=hV,this.groupScale=new aV,this.circleCache={r:0,cx:0,cy:0}}get hasData(){return this.getHasData("radiusValue-raw")}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===eo.Angle)return t.getDomain(this,"angleValue","key",i);{const o=t.getDomain(this,"radiusValue-end","value",i),s=Number.isFinite(o[1]-o[0])?[Math.min(o[0],0),Math.max(o[1],0)]:[];return ZH(s)}}async processData(e){const{angleKey:t,radiusKey:i,normalizedTo:o}=this.properties,s=!this.ctx.animationManager.isSkipped(),a=this.getStackId(),n=`${a}-trailing`,r=[];VH(o)&&r.push(QH([a,n],Math.abs(o))),s&&this.processedData&&r.push(XH(this.id,this.processedData)),s&&r.push(oV());const l=this.visible?{}:{forceValue:0},c=this.axes[eo.Radius]?.scale.type,h=this.axes[eo.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[qH(t,h,{id:"angleValue"}),iV(i,c,{id:"radiusValue-raw",invalidValue:null,...l}),...rv(i,"normal",{id:"radiusValue-end",rangeId:"radiusValue-range",invalidValue:null,groupId:a,separateNegative:!0,...l},c),...rv(i,"trailing",{id:"radiusValue-start",invalidValue:null,groupId:n,separateNegative:!0,...l},c),...r],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,o=this.circleCache;return e!==o.r||t!==o.cx||i!==o.cy?(this.circleCache={r:e,cx:t,cy:i},!0):!1}isRadiusAxisReversed(){return this.axes[eo.Radius]?.isReversed()}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}getAxisInnerRadius(){const e=this.axes[eo.Radius];return e instanceof UH?this.radius*e.innerRadiusRatio:0}createNodeData(){const{processedData:e,dataModel:t,groupScale:i}=this;if(!t||!e||e.type!=="grouped")return;const o=this.axes[eo.Angle],s=this.axes[eo.Radius],a=o?.scale,n=s?.scale;if(!a||!n)return;const r=t.resolveKeysById(this,"angleValue",e),l=t.resolveColumnById(this,"radiusValue-start",e),c=t.resolveColumnById(this,"radiusValue-end",e),h=t.resolveColumnById(this,"radiusValue-raw",e),p=t.resolveProcessedDataIndexById(this,"radiusValue-range");let u=0,g=0;o instanceof To&&(u=o.groupPaddingInner,g=o.paddingInner);const f=(a.bandwidth??0)*(1-g),{index:x,visibleGroupCount:S}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);i.domain=Array.from({length:S}).map((I,O)=>String(O)),i.range=[-f/2,f/2],i.paddingInner=S>1?u:0;const v=this.isRadiusAxisReversed(),m=v?this.radius:this.getAxisInnerRadius(),b=v?this.getAxisInnerRadius():this.radius,k=b+m,{angleKey:A,radiusKey:M,angleName:D,radiusName:L,legendItemName:N,label:P}=this.properties,R=this.getSeriesDomain(eo.Radius),F=(I,O,z,B)=>{const H=this.getLabelText(O,I,M,"radius",R,P,{value:O,datum:I,angleKey:A,radiusKey:M,angleName:D,radiusName:L,legendItemName:N});if(H)return{x:z,y:B,text:H,textAlign:"center",textBaseline:"middle"}},_=[],E=cV((I,O,z)=>en(this,I,O,z)),T={itemId:M,nodeData:_,labelData:_,styles:E};if(!this.visible)return T;const{dataSources:w}=e,C=w.get(this.id)?.data??[];for(const{datumIndex:I,group:O}of t.forEachGroupDatum(this,e)){const z=C[I],B=r[I];if(B==null)return;const H=h[I],W=H>=0&&!Object.is(H,-0),V=l[I],G=c[I],K=O.aggregation[p][W?1:0]??0,Q=W===v;if(V===void 0||G===void 0)return;let X,Y;if(C.length===1)X=-.5*Math.PI,Y=1.5*Math.PI;else{const me=a.convert(B);X=cv(me+i.convert(String(x))),Y=cv(X+i.bandwidth)}const J=X+i.bandwidth/2,ie=k-n.convert(V),U=k-n.convert(G),he=(ie+U)/2,ne=k-n.convert(0),Z=k-n.convert(K),le=Math.cos(J)*he,oe=Math.sin(J)*he,ge=this.properties.label.enabled?F(z,H,le,oe):void 0,ce=this.getColumnWidth(X,Y);_.push({series:this,datum:z,datumIndex:I,point:{x:le,y:oe,size:0},midPoint:{x:le,y:oe},label:ge,angleValue:B,radiusValue:H,negative:Q,innerRadius:ie,outerRadius:U,stackInnerRadius:ne,stackOuterRadius:Z,startAngle:X,endAngle:Y,midAngle:J,axisInnerRadius:m,axisOuterRadius:b,columnWidth:ce,index:I})}return{itemId:M,nodeData:_,labelData:_,styles:E}}getColumnWidth(e,t){return Number.NaN}update({seriesRect:e}){const t=this.checkResize(e);this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updateSectorSelection(this.itemSelection,!1),this.updateSectorSelection(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updateSectorSelection(e,t){const{contextNodeData:i}=this;if(!i)return;const o=this.ctx.highlightManager.getActiveHighlight();let s=[];const a=this.ctx.highlightManager?.getActiveHighlight();t?a?.datum&&a.series===this&&s.push(a):s=this.nodeData;const n=this.isRadiusAxisReversed(),r=n?this.radius:this.getAxisInnerRadius(),l=n?this.getAxisInnerRadius():this.radius,c=this.getShapeFillBBox(),h=this.hasItemStylers();e.update(s,void 0,p=>this.getDatumId(p)).each((p,u)=>{const{midPoint:g}=u;if(h){const v=this.getHighlightState(a,t,u.datumIndex);u.style=en(this,u,t,v)}const y=u.style??i.styles[this.getHighlightState(o,t,u.datumIndex)],f=y.fill,S=rV(f)&&f.bounds==="item"?{centerX:g?.x??0,centerY:g?.y??0}:{centerX:0,centerY:0,innerRadius:r,outerRadius:l};this.updateItemPath(p,u,t),nV(p,y,c,S),p.cornerRadius=y.cornerRadius??0,p.lineJoin="round"})}updateLabels(){const e=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((t,i)=>{lV(this,t,this.properties,this.properties.label,i.label,!1,e),t.fillOpacity=this.getHighlightStyle(!1,i.datumIndex).opacity??1})}animateEmptyUpdateReady(){const{labelSelection:e}=this,t=this.getColumnTransitionFunctions();hv.fromToMotion(this.id,"datums",this.ctx.animationManager,[this.itemSelection],t),eV(this,"labels",this.ctx.animationManager,e)}animateClearingUpdateEmpty(){const{itemSelection:e}=this,{animationManager:t}=this.ctx,i=this.getColumnTransitionFunctions();hv.fromToMotion(this.id,"datums",t,[e],i),tV(this,"labels",t,this.labelSelection)}getTooltipContent(e){const{id:t,dataModel:i,processedData:o,axes:s,properties:a}=this,{angleKey:n,angleName:r,radiusKey:l,radiusName:c,legendItemName:h,tooltip:p}=a,u=s[eo.Angle],g=s[eo.Radius],y=this.nodeData?.[e];if(!i||!o||!u||!g||!y)return;const f=o.dataSources.get(this.id)?.data[e],x=i.resolveKeysById(this,"angleValue",o)[e],S=i.resolveColumnById(this,"radiusValue-raw",o)[e];if(x==null)return;const v=en(this,y,!1);return this.formatTooltipWithContext(p,{heading:this.getAxisValueText(u,"tooltip",x,f,n,void 0),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(g,"tooltip",S,f,l,void 0)}]},{seriesId:t,datum:f,title:r,angleKey:n,angleName:r,radiusKey:l,radiusName:c,legendItemName:h,...v})}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.itemSelection.nodes())}legendItemSymbol(){const{fill:e,stroke:t,fillOpacity:i,strokeOpacity:o,strokeWidth:s,lineDash:a,lineDashOffset:n}=Su(this,!1,!1,nr.HighlightState.None),r={fill:e??"rgba(0, 0, 0, 0)",stroke:t??"rgba(0, 0, 0, 0)",fillOpacity:i,strokeOpacity:o,strokeWidth:s,lineDash:a,lineDashOffset:n};return nr.isGradientFill(r.fill)&&(r.fill={...r.fill,gradient:"linear",rotation:0,reverse:!1}),{marker:r}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{radiusKey:o,radiusName:s,legendItemName:a,showInLegend:n}=this.properties;return[{legendType:"category",id:t,itemId:o,seriesId:t,enabled:i,label:{text:a??s??o},symbol:this.legendItemSymbol(),legendItemName:a,hideInLegend:!n}]}getDatumId(e){return sV(e.angleValue)}computeLabelsBBox(){return null}};import{_ModuleSupport as dV}from"ag-charts-community";var{SeriesProperties:pV,makeSeriesTooltip:uV,Property:Ve,Label:gV}=dV,Ne=class extends pV{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.label=new gV,this.tooltip=uV()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n,cornerRadius:r}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n,cornerRadius:r,opacity:1}}};d([Ve],Ne.prototype,"angleKey",2),d([Ve],Ne.prototype,"angleName",2),d([Ve],Ne.prototype,"radiusKey",2),d([Ve],Ne.prototype,"radiusName",2),d([Ve],Ne.prototype,"legendItemName",2),d([Ve],Ne.prototype,"fill",2),d([Ve],Ne.prototype,"fillOpacity",2),d([Ve],Ne.prototype,"stroke",2),d([Ve],Ne.prototype,"strokeWidth",2),d([Ve],Ne.prototype,"strokeOpacity",2),d([Ve],Ne.prototype,"lineDash",2),d([Ve],Ne.prototype,"lineDashOffset",2),d([Ve],Ne.prototype,"cornerRadius",2),d([Ve],Ne.prototype,"styler",2),d([Ve],Ne.prototype,"itemStyler",2),d([Ve],Ne.prototype,"rotation",2),d([Ve],Ne.prototype,"stackGroup",2),d([Ve],Ne.prototype,"normalizedTo",2),d([Ve],Ne.prototype,"label",2),d([Ve],Ne.prototype,"tooltip",2);import{_ModuleSupport as yV}from"ag-charts-community";import{_ModuleSupport as fV}from"ag-charts-community";var{motion:mV}=fV;function pv(){const e={startAngle:new Map,endAngle:new Map},t=["startAngle","endAngle"],i=(n,r,l)=>{for(const c of t){const h=e[c];let p=(l==="removed"||l==="updated"?n:r)[c],u=(l==="removed"?n:r)[c];Number.isNaN(u)&&(u=n.previousDatum?.[c]??Number.NaN);const g=p-u;Math.abs(g)>Math.PI&&(p-=Math.sign(g)*2*Math.PI),h.set(r,{from:p,to:u})}},o=(n,r)=>({startAngle:e.startAngle.get(n)[r],endAngle:e.endAngle.get(n)[r]});return{calculate:i,from:n=>o(n,"from"),to:n=>o(n,"to")}}function uv(e,t,i){if(i==="updated"){if(e.previousDatum==null||Number.isNaN(e.previousDatum.startAngle)||Number.isNaN(e.previousDatum.endAngle))return"added";if(Number.isNaN(t.startAngle)||Number.isNaN(t.endAngle))return"removed"}return i==="added"&&e.previousDatum!=null?"updated":i}function xV(e){const t=pv();return{toFn:(s,a,n)=>{const{startAngle:r,endAngle:l}=t.to(a);let c,h,p,u,g;return n==="removed"?(c=s.innerRadius,h=s.innerRadius,p=s.columnWidth,u=s.axisInnerRadius,g=s.axisOuterRadius):(c=Number.isNaN(a.innerRadius)?e:a.innerRadius,h=Number.isNaN(a.outerRadius)?e:a.outerRadius,p=Number.isNaN(a.columnWidth)?s.columnWidth:a.columnWidth,u=a.axisInnerRadius,g=a.axisOuterRadius),{innerRadius:c,outerRadius:h,columnWidth:p,axisInnerRadius:u,axisOuterRadius:g,startAngle:r,endAngle:l}},fromFn:(s,a,n)=>{n=uv(s,a,n),t.calculate(s,a,n);const{startAngle:r,endAngle:l}=t.from(a);let c,h,p,u,g;n==="removed"||n==="updated"?(c=s.innerRadius,h=s.outerRadius,p=s.columnWidth,u=s.axisInnerRadius,g=s.axisOuterRadius):(c=e,h=e,p=a.columnWidth,u=a.axisInnerRadius,g=a.axisOuterRadius);const y=mV.NODE_UPDATE_STATE_TO_PHASE_MAPPING[n];return{innerRadius:c,outerRadius:h,columnWidth:p,axisInnerRadius:u,axisOuterRadius:g,startAngle:r,endAngle:l,phase:y}}}}function SV(e,{innerRadius:t,outerRadius:i,columnWidth:o,axisInnerRadius:s,axisOuterRadius:a,startAngle:n,endAngle:r}){return{innerRadius:t,outerRadius:i,columnWidth:o,axisInnerRadius:s,axisOuterRadius:a,startAngle:n,endAngle:r}}var{SectorBox:Uc,motion:bV}=yV;function bu(e){const{negative:t,innerRadius:i,outerRadius:o,stackInnerRadius:s,stackOuterRadius:a}=e;return{innerRadius:t?a:s,outerRadius:t?s:a,clipInnerRadius:t?o:i,clipOuterRadius:t?i:o}}function vV(e){const t=pv();return{toFn:(s,a,n)=>{const{startAngle:r,endAngle:l}=t.to(a);let c,h,p;if(n==="removed")c=e,h=e,p=new Uc(r,l,c,h);else{let u,g;({innerRadius:c,outerRadius:h,clipInnerRadius:u,clipOuterRadius:g}=bu(a)),Number.isNaN(c)&&(c=e),Number.isNaN(h)&&(h=e),Number.isNaN(u)&&(u=e),Number.isNaN(g)&&(g=e),p=new Uc(r,l,u,g)}return{innerRadius:c,outerRadius:h,startAngle:r,endAngle:l,clipSector:p}},fromFn:(s,a,n)=>{n=uv(s,a,n),t.calculate(s,a,n);const{startAngle:r,endAngle:l}=t.from(a);let c,h,p;n==="removed"||n==="updated"?(c=s.innerRadius,h=s.outerRadius,p=s.clipSector):(c=e,h=e),p??(p=new Uc(r,l,c,h));const u=bV.NODE_UPDATE_STATE_TO_PHASE_MAPPING[n];return{innerRadius:c,outerRadius:h,startAngle:r,endAngle:l,clipSector:p,phase:u}}}}function kV(e,t){const{startAngle:i,endAngle:o}=t,{innerRadius:s,outerRadius:a,clipInnerRadius:n,clipOuterRadius:r}=bu(t),l=new Uc(i,o,n,r);return{innerRadius:s,outerRadius:a,startAngle:i,endAngle:o,clipSector:l}}var{Sector:DV,SectorBox:MV,PolarZIndexMap:vu}=HH,Xc=class extends dv{constructor(e){super(e,{animationResetFns:{item:kV}}),this.properties=new Ne}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,vu.FOREGROUND,e],this.highlightGroup.zIndex=[0,vu.HIGHLIGHT,e],this.labelGroup.zIndex=[0,vu.LABEL,e],!0}getStackId(){return`nightingale-stack-${this.seriesGrouping?.groupIndex??this.id}-yValues`}nodeFactory(){return new DV}updateItemPath(e,t,i){const{negative:o}=t;if(e.centerX=0,e.centerY=0,e.startOuterCornerRadius=o?0:this.properties.cornerRadius,e.endOuterCornerRadius=o?0:this.properties.cornerRadius,e.startInnerCornerRadius=o?this.properties.cornerRadius:0,e.endInnerCornerRadius=o?this.properties.cornerRadius:0,i){const{startAngle:s,endAngle:a}=t,{innerRadius:n,outerRadius:r,clipInnerRadius:l,clipOuterRadius:c}=bu(t);e.innerRadius=n,e.outerRadius=r,e.startAngle=s,e.endAngle=a,e.clipSector=new MV(s,a,l,c)}}getColumnTransitionFunctions(){const e=this.isRadiusAxisReversed()?this.radius:this.getAxisInnerRadius();return vV(e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};Xc.className="NightingaleSeries",Xc.type="nightingale";import{_ModuleSupport as AV}from"ag-charts-community";import{boolean as gv,constant as IV,number as LV,required as ku,string as tn}from"ag-charts-core";var{commonSeriesOptionsDefs:TV,nightingaleSeriesThemeableOptionsDef:CV}=AV,NV={...TV,...CV,type:ku(IV("nightingale")),angleKey:ku(tn),radiusKey:ku(tn),angleName:tn,radiusName:tn,legendItemName:tn,grouped:gv,stacked:gv,stackGroup:tn,normalizedTo:LV};import{_ModuleSupport as Du}from"ag-charts-community";var{ThemeConstants:{POLAR_AXIS_TYPE:yv,POLAR_AXIS_SHAPE:fv},FILL_GRADIENT_RADIAL_SERIES_DEFAULTS:wV,FILL_IMAGE_DEFAULTS:PV,FILL_PATTERN_DEFAULTS:OV}=Du,_V={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",wV],["image",PV],["pattern",OV]]},stroke:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$ref:"chartBackgroundColor"},{$palette:"stroke"}]},strokeWidth:1,label:{...Du.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:Du.multiSeriesHighlightStyle()},axes:{[yv.ANGLE_CATEGORY]:{shape:{$findFirstSiblingNotOperation:fv.CIRCLE},groupPaddingInner:0,paddingInner:0,label:{spacing:10}},[yv.RADIUS_NUMBER]:{shape:{$findFirstSiblingNotOperation:fv.CIRCLE}}}},{ThemeConstants:{POLAR_AXIS_TYPE:mv}}=FH,RV={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"nightingale",moduleFactory:e=>new Xc(e),defaultAxes:[{type:mv.ANGLE_CATEGORY},{type:mv.RADIUS_NUMBER}],themeTemplate:_V,stackable:!0,groupable:!0,stackedByDefault:!0},EV={type:"series",name:"nightingale",chartType:"polar",enterprise:!0,options:NV,create:e=>new Xc(e)};import{_ModuleSupport as xv}from"ag-charts-community";import{cachedTextMeasurer as BV,isArray as zV,measureTextSegments as FV,toPlainText as Sv}from"ag-charts-core";import{_ModuleSupport as HV}from"ag-charts-community";var{SeriesProperties:VV,makeSeriesTooltip:WV,Property:We,Label:bv,DropShadow:GV}=HV,KV=class extends bv{},Mu=class extends bv{constructor(){super(...arguments),this.spacing=0}};d([We],Mu.prototype,"spacing",2),d([We],Mu.prototype,"placement",2);var Xe=class extends VV{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.direction="vertical",this.reverse=void 0,this.spacing=0,this.aspectRatio=void 0,this.shadow=new GV().set({enabled:!1}),this.label=new KV,this.stageLabel=new Mu,this.tooltip=WV()}getStyle(e=0){const{fills:t,strokes:i,fillOpacity:o,strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r}=this;return{fill:t[e%t.length],fillOpacity:o,stroke:i[e%i.length],strokeWidth:s,strokeOpacity:a,lineDash:n,lineDashOffset:r,opacity:1}}};d([We],Xe.prototype,"stageKey",2),d([We],Xe.prototype,"valueKey",2),d([We],Xe.prototype,"fills",2),d([We],Xe.prototype,"fillOpacity",2),d([We],Xe.prototype,"strokes",2),d([We],Xe.prototype,"strokeWidth",2),d([We],Xe.prototype,"strokeOpacity",2),d([We],Xe.prototype,"lineDash",2),d([We],Xe.prototype,"lineDashOffset",2),d([We],Xe.prototype,"direction",2),d([We],Xe.prototype,"reverse",2),d([We],Xe.prototype,"spacing",2),d([We],Xe.prototype,"aspectRatio",2),d([We],Xe.prototype,"itemStyler",2),d([We],Xe.prototype,"shadow",2),d([We],Xe.prototype,"label",2),d([We],Xe.prototype,"stageLabel",2),d([We],Xe.prototype,"tooltip",2);function vv(e,{x:t,y:i,top:o,right:s,bottom:a,left:n}){e.x0=t-o/2,e.x1=t+o/2,e.x2=t+a/2,e.x3=t-a/2,e.y0=i-n/2,e.y1=i-s/2,e.y2=i+s/2,e.y3=i+n/2}function $V(e){return{fromFn:(s,a)=>{const{x:n,y:r}=a;let{top:l,right:c,bottom:h,left:p}=a;return e==="vertical"?(l=0,h=0):(p=0,c=0),{x:n,y:r,top:l,right:c,bottom:h,left:p}},toFn:(s,a)=>{const{x:n,y:r,top:l,right:c,bottom:h,left:p}=a;return{x:n,y:r,top:l,right:c,bottom:h,left:p}},applyFn:vv}}var{StateMachine:jV,valueProperty:kv,SeriesNodePickMode:Dv,createDatumId:YV,BBox:Au,Group:Iu,Selection:Zc,Text:Mv,PointerEvents:Av,applyShapeStyle:UV,mergeDefaults:Iv,fromToMotion:XV,seriesLabelFadeInAnimation:ZV,getLabelStyles:qV}=xv,qc=class extends xv.DataModelSeries{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[Dv.EXACT_SHAPE_MATCH,Dv.NEAREST_NODE]}),this.properties=new Xe,this.itemGroup=this.contentGroup.appendChild(new Iu({name:"itemGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Iu({name:"itemLabelGroup"})),this.stageLabelGroup=this.contentGroup.appendChild(new Iu({name:"stageLabelGroup"})),this.datumSelection=Zc.select(this.itemGroup,()=>this.nodeFactory()),this.labelSelection=Zc.select(this.itemLabelGroup,Mv),this.stageLabelSelection=Zc.select(this.stageLabelGroup,Mv),this.highlightDatumSelection=Zc.select(this.highlightGroup,()=>this.nodeFactory()),this.animationState=new jV("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{clear:"empty",reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable()),this.itemLabelGroup.pointerEvents=Av.None,this.stageLabelGroup.pointerEvents=Av.None}addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",e=>this.onLegendItemClick(e)))}nodeFactory(){return new Zi}getNodeData(){return this.contextNodeData?.nodeData}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}async processData(e){if(this.data==null)return;const{id:t,visible:i,ctx:{legendManager:o}}=this,{stageKey:s,valueKey:a}=this.properties,n="category",r="number",l=(h,p,u)=>i&&o.getItemEnabled({seriesId:t,itemId:u}),c=this.visible?{}:{forceValue:0};await this.requestDataModel(e,this.data,{props:[kv(s,n,{id:"xValue"}),kv(a,r,{id:"yValue",...c,validation:l,invalidValue:0})]})}createNodeData(){const{id:e,dataModel:t,processedData:i,properties:o,visible:s,ctx:{legendManager:a}}=this,{stageKey:n,valueKey:r,direction:l,reverse:c=l==="horizontal",spacing:h,aspectRatio:p,label:u,stageLabel:g}=o;if(t==null||i==null)return;const y=l==="horizontal",f=t.resolveColumnById(this,"xValue",i),x=t.resolveColumnById(this,"yValue",i),S=t.getDomain(this,"xValue","value",i),v=t.getDomain(this,"yValue","value",i),m=BV(g);let b,k;y?(b="center",k=g.placement==="before"?"bottom":"top"):(b=g.placement==="after"?"left":"right",k="middle");const A=g.enabled?[]:void 0;let M=0,D=0,L=0;const N=i.dataSources.get(this.id)?.data??[];for(const[B,H]of N.entries()){const W=f[B],V=x[B],G=s&&a.getItemEnabled({seriesId:e,itemId:B});if(L+=V,A==null)continue;const K=this.getLabelText(W,H,n,"x",S,this.properties.stageLabel,{datum:H,value:V,stageKey:n,valueKey:r}),{width:Q,height:X}=zV(K)?FV(K,u):m.measureLines(K);M=Math.max(M,Q),D=Math.max(D,X),A.push({x:Number.NaN,y:Number.NaN,text:K,textAlign:b,textBaseline:k,visible:G})}const P=this._nodeDataDependencies?.seriesRectWidth??0,R=this._nodeDataDependencies?.seriesRectHeight??0,F=h*(i.input.count-1);let _;if(y){const B=D+g.spacing;_=new Au(0,g.placement==="before"?B:0,P,R-B)}else{const B=M+g.spacing;_=new Au(g.placement==="after"?0:B,0,P-B,R)}if(p!=null&&p!==0){const B=l==="horizontal"?1/p:p,H=Math.min(_.width,_.height*B),W=H/B;_=new Au(_.x+(_.width-H)/2,_.y+(_.height-W)/2,H,W)}let E,T;y?T=g.placement==="before"?_.y-g.spacing:_.y+_.height+g.spacing:E=g.placement==="after"?_.x+_.width+g.spacing:_.x-g.spacing;const w=_.width-(y?F:0),C=_.height-(y?0:F);if(w<0||C<0)return;const I=[],O=[];let z=0;for(const[B,H]of N.entries()){const W=f[B],V=x[B],G=s&&a.getItemEnabled({seriesId:e,itemId:B}),K=z+V,Q=(z+K)/(2*L),X=(K-z)/L,Y=y?w*Q+h*B:w*.5,J=y?C*.5:C*Q+h*B,ie=_.x+Y,U=_.y+J;if(A!=null){const ce=A[B];ce.x=E??ie,ce.y=T??U}let he,ne,Z,le;if(y){const ce=w*X;he=ce,Z=ce;const me=(Y+ce/2)*(C/_.width),$e=(Y-ce/2)*(C/_.width);ne=c?_.height-me:me,le=c?_.height-$e:$e}else{const ce=C*X;ne=ce,le=ce;const me=(J-ce/2)*(w/_.height),$e=(J+ce/2)*(w/_.height);he=c?_.width-me:me,Z=c?_.width-$e:$e}const oe=this.getLabelText(V,H,r,"y",v,u,{datum:H,value:V,stageKey:n,valueKey:r}),ge={x:ie,y:U,text:oe,textAlign:"center",textBaseline:"middle",visible:G};O.push(ge),I.push({series:this,itemId:r,datum:H,datumIndex:B,index:B,xValue:W,yValue:V,x:ie,y:U,top:he,right:ne,bottom:Z,left:le,label:ge,enabled:G,midPoint:{x:ie,y:U},style:this.getItemStyle({datumIndex:B,datum:H},!1)}),z=K}return{itemId:e,nodeData:I,labelData:O,stageLabelData:A,bounds:_}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update({seriesRect:e}){this.checkResize(e);const{datumSelection:t,labelSelection:i,stageLabelSelection:o,highlightDatumSelection:s}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.contentGroup.opacity=this.getOpacity();let a=this.ctx.highlightManager?.getActiveHighlight();a!=null&&(a.series!==this||a.datum==null)&&(a=void 0);const n=this.contextNodeData?.nodeData??[],r=this.contextNodeData?.labelData??[],l=this.contextNodeData?.stageLabelData??[];this.datumSelection=this.updateDatumSelection({nodeData:n,datumSelection:t}),this.updateDatumStyles({datumSelection:t,isHighlight:!1}),this.updateDatumNodes({datumSelection:t,isHighlight:!1}),this.labelSelection=this.updateLabelSelection({labelData:r,labelSelection:i}),this.updateLabelNodes({labelSelection:i,labelProperties:this.properties.label}),this.stageLabelSelection=this.updateStageLabelSelection({stageLabelData:l,stageLabelSelection:o}),this.updateLabelNodes({labelSelection:o,labelProperties:this.properties.stageLabel}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:a==null?[]:[a],datumSelection:s}),this.updateDatumStyles({datumSelection:s,isHighlight:!0}),this.updateDatumNodes({datumSelection:s,isHighlight:!0}),this.animationState.transition("update")}updateDatumSelection(e){return e.datumSelection.update(e.nodeData)}getItemStyle({datumIndex:e,datum:t},i){const{properties:o}=this,{itemStyler:s}=o,a=this.getHighlightStyle(i,e);let r=Iv(a,o.getStyle(e));if(s!=null&&e!=null){const l=this.cachedDatumCallback(YV(e,i?"highlight":"node"),()=>{const c=this.makeItemStylerParams(t,e,i,r);return this.callWithContext(s,c)});l&&(r=Iv(l,r))}return r}makeItemStylerParams(e,t,i,o){const{id:s,properties:a}=this,{stageKey:n,valueKey:r}=a,l=this.ctx.highlightManager?.getActiveHighlight(),c=this.getHighlightStateString(l,i,t),h=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:s,datum:e,stageKey:n,valueKey:r,highlighted:i,highlightState:c,...o,fill:h}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,o)=>{o.style=this.getItemStyle(o,t)})}updateDatumNodes({datumSelection:e}){const{properties:t}=this,{shadow:i}=t,o=this.contextNodeData?.bounds,s=o?{series:o,axis:o}:void 0;e.each((a,n)=>{UV(a,n.style,s),vv(a,n),a.fillShadow=i})}updateLabelSelection(e){return e.labelSelection.update(this.properties.label.enabled?e.labelData:[])}updateStageLabelSelection(e){return e.stageLabelSelection.update(e.stageLabelData)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,o,s)=>{const{visible:a,x:n,y:r,text:l,textAlign:c,textBaseline:h}=o,p=qV(this,void 0,this.properties,e.labelProperties,!1,t),{color:u,fontSize:g,fontStyle:y,fontWeight:f,fontFamily:x}=p;i.visible=a,i.x=n,i.y=r,i.text=l,i.fill=u,i.fillOpacity=this.getHighlightStyle(!1,s).opacity??1,i.fontStyle=y,i.fontWeight=f,i.fontSize=g,i.fontFamily=x,i.textAlign=c,i.textBaseline=h,i.setBoxing(p)})}computeFocusBounds(e){const t=this.getNodeData()?.[e.datumIndex];if(t!==void 0){for(const i of this.datumSelection)if(i.datum===t)return i.node}}getTooltipContent(e){const{id:t,dataModel:i,processedData:o,properties:s}=this,{stageKey:a,valueKey:n,tooltip:r}=s;if(!i||!o)return;const l=o.dataSources.get(this.id)?.data[e],c=i.resolveColumnById(this,"xValue",o)[e],h=i.resolveColumnById(this,"yValue",o)[e];if(c==null)return;const p=this.getLabelText(c,l,a,"x",i.getDomain(this,"xValue","value",o),this.properties.stageLabel,{datum:l,value:c,stageKey:a,valueKey:n}),u=this.getLabelText(h,l,n,"y",i.getDomain(this,"yValue","value",o),this.properties.stageLabel,{datum:l,value:h,stageKey:a,valueKey:n}),g=this.getItemStyle({datumIndex:e,datum:l},!1);return this.formatTooltipWithContext(r,{symbol:this.legendItemSymbol(e),data:[{label:Sv(p),value:Sv(u)}]},{seriesId:t,datum:l,title:void 0,stageKey:a,valueKey:n,...g})}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}pickNodeClosestDatum({x:e,y:t}){let i=1/0,o;return this.datumSelection.each((s,a)=>{const n=s.distanceSquared(e,t);nnew qc(e),solo:!0,themeTemplate:sW},nW={type:"series",name:"pyramid",chartType:"standalone",enterprise:!0,options:iW,create:e=>new qc(e)};import{_ModuleSupport as rW}from"ag-charts-community";import{_ModuleSupport as yi}from"ag-charts-community";var{ThemeConstants:{POLAR_AXIS_TYPE:lW}}=yi,Tv={series:{stroke:{$palette:"stroke"},label:{...yi.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},marker:{enabled:!0,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",yi.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",yi.FILL_IMAGE_DEFAULTS],["pattern",yi.FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},fillOpacity:1,shape:"circle",size:6,strokeOpacity:1,strokeWidth:{$isUserOption:["./stroke",1,0]}},highlight:yi.multiSeriesHighlightStyle(),tooltip:{range:{$path:["/tooltip/range","nearest"]}}},axes:{[lW.ANGLE_CATEGORY]:{label:{spacing:10}}}},cW=yi.mergeDefaults({series:{stroke:yi.SAFE_STROKE_FILL_OPERATION,strokeWidth:2}},Tv),hW=yi.mergeDefaults({series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",yi.FILL_GRADIENT_LINEAR_DEFAULTS],["image",yi.FILL_IMAGE_DEFAULTS],["pattern",yi.FILL_PATTERN_DEFAULTS]]},fillOpacity:.8,strokeWidth:2,marker:{enabled:!1}}},Tv);import{_ModuleSupport as Cv}from"ag-charts-community";import{_ModuleSupport as Tu}from"ag-charts-community";import{isFiniteNumber as Nv,isNumberEqual as wv}from"ag-charts-core";import{_ModuleSupport as dW}from"ag-charts-community";var{Label:pW,SeriesMarker:uW,SeriesProperties:gW,makeSeriesTooltip:yW,Property:bt}=dW,ot=class extends gW{constructor(){super(...arguments),this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.rotation=0,this.marker=new uW,this.label=new pW,this.tooltip=yW(),this.connectMissingData=!1}};d([bt],ot.prototype,"angleKey",2),d([bt],ot.prototype,"radiusKey",2),d([bt],ot.prototype,"angleName",2),d([bt],ot.prototype,"radiusName",2),d([bt],ot.prototype,"legendItemName",2),d([bt],ot.prototype,"stroke",2),d([bt],ot.prototype,"strokeWidth",2),d([bt],ot.prototype,"strokeOpacity",2),d([bt],ot.prototype,"lineDash",2),d([bt],ot.prototype,"lineDashOffset",2),d([bt],ot.prototype,"rotation",2),d([bt],ot.prototype,"styler",2),d([bt],ot.prototype,"marker",2),d([bt],ot.prototype,"label",2),d([bt],ot.prototype,"tooltip",2),d([bt],ot.prototype,"connectMissingData",2);var{DEFAULT_POLAR_DIRECTION_KEYS:fW,DEFAULT_POLAR_DIRECTION_NAMES:mW,ChartAxisDirection:fi,PolarAxis:xW,SeriesNodePickMode:Pv,valueProperty:Ov,fixNumericExtent:SW,seriesLabelFadeInAnimation:bW,markerFadeInAnimation:vW,resetMarkerFn:kW,animationValidation:DW,computeMarkerFocusBounds:MW,extent:AW,BBox:IW,Group:LW,Path:TW,Selection:Cu,Text:CW,Marker:NW,updateLabelNode:wW,getMarkerStyles:PW,mergeDefaults:OW}=Tu,_W=class extends Tu.SeriesNodeEvent{constructor(e,t,i,o){super(e,t,i,o),this.angleKey=o.properties.angleKey,this.radiusKey=o.properties.radiusKey}},Nu=class extends Tu.PolarSeries{constructor(e){super({moduleCtx:e,categoryKey:"angleValue",propertyKeys:fW,propertyNames:mW,pickModes:[Pv.NEAREST_NODE,Pv.EXACT_SHAPE_MATCH],canHaveAxes:!0,animationResetFns:{item:kW},clipFocusBox:!1}),this.NodeEvent=_W,this.lineGroup=this.contentGroup.appendChild(new LW({name:"radar-line"})),this.lineSelection=Cu.select(this.lineGroup,TW),this.resetInvalidToZero=!1,this.circleCache={r:0,cx:0,cy:0},this.lineGroup.zIndex=0,this.itemGroup.zIndex=1}get hasData(){return this.getHasData("angleValue")}nodeFactory(){return new NW}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===fi.Angle)return t.getDomain(this,"angleValue","value",i);{const o=t.getDomain(this,"radiusValue","value",i),s=AW(o.length===0?o:[0].concat(o));return SW(s)}}async processData(e){const{angleKey:t,radiusKey:i}=this.properties,o=[];this.ctx.animationManager.isSkipped()||o.push(DW());const s=this.axes[fi.Radius]?.scale.type,a=this.axes[fi.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[Ov(t,a,{id:"angleValue"}),Ov(i,s,{id:"radiusValue",invalidValue:void 0}),...o]}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,o=this.circleCache;return e===o.r&&t===o.cx&&i===o.cy?!1:(this.circleCache={r:e,cx:t,cy:i},!0)}getAxisInnerRadius(){const e=this.axes[fi.Radius];return e instanceof xW?this.radius*e.innerRadiusRatio:0}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}createNodeData(){const{processedData:e,dataModel:t}=this;if(!e||!t)return;const{angleKey:i,radiusKey:o,angleName:s,radiusName:a,legendItemName:n,marker:r,label:l}=this.properties,c=this.axes[fi.Angle]?.scale,h=this.axes[fi.Radius]?.scale;if(!c||!h)return;const p=t.resolveColumnById(this,"angleValue",e),u=t.resolveColumnById(this,"radiusValue",e),g=this.getAxisInnerRadius(),y=this.getSeriesDomain(fi.Radius),x=(e.dataSources.get(this.id)?.data??[]).map((S,v)=>{const m=p[v],b=u[v],k=c.convert(m),A=this.radius+g-h.convert(b),M=Math.cos(k),D=Math.sin(k),L=M*A,N=D*A;let P;if(l.enabled){const R=this.getLabelText(b,S,o,"radius",y,l,{value:b,datum:S,angleKey:i,radiusKey:o,angleName:s,radiusName:a,legendItemName:n});if(R){let F="right";wv(M,0)?F="center":M>0&&(F="left");let _="bottom";wv(D,0)?_="middle":D>0&&(_="top"),P={x:L+M*r.size,y:N+D*r.size,text:R,textAlign:F,textBaseline:_}}}return{series:this,datum:S,datumIndex:v,index:v,point:{x:L,y:N,size:r.size},midPoint:{x:L,y:N},label:P,angleValue:m,radiusValue:b,missing:!Nv(k)||!Nv(A)}});return{itemId:o,nodeData:x,labelData:x,styles:PW(this,this.properties,r)}}update({seriesRect:e}){const t=this.checkResize(e),i=!this.ctx.animationManager.isSkipped(),{series:o}=this.ctx.highlightManager?.getActiveHighlight()??{};this.highlightGroup.visible=(i||this.visible)&&o===this,this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updatePathSelections(),this.updateMarkerSelection(),this.updateHighlightSelection(),this.updatePathNodes(),this.hasItemStylers()&&(this.updateDatumStyles(this.itemSelection,!1),this.updateDatumStyles(this.highlightSelection,!0)),this.updateMarkers(this.itemSelection,!1),this.updateMarkers(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updatePathSelections(){const e=this.visible?[!0]:[];this.lineSelection.update(e)}updateMarkerSelection(){const{marker:e,styler:t}=this.properties;e.isDirty()&&(this.itemSelection.clear(),this.itemSelection.cleanup(),this.itemSelection=Cu.select(this.itemGroup,()=>this.nodeFactory(),!1));const i=t==null?e.enabled:this.getStyle(!1).marker.enabled,o=this.visible&&e.shape&&i?this.nodeData:[];this.itemSelection.update(o)}updateHighlightSelection(){const{marker:e,styler:t}=this.properties;e.isDirty()&&(this.highlightSelection.clear(),this.highlightSelection.cleanup(),this.highlightSelection=Cu.select(this.highlightGroup,()=>this.nodeFactory(),!1));const i=t==null?e.enabled:this.getStyle(!1).marker.enabled,o=this.ctx.highlightManager?.getActiveHighlight(),s=this.visible&&e.shape&&i&&o?.datum?[{...o}]:[];this.highlightSelection.update(s)}getMarkerFill(e){return e?.fill??this.getStyle(!1).marker.fill}getDatumStylerProperties(e){const{id:t,properties:i}=this,{angleKey:o,radiusKey:s}=i;return{seriesId:t,datum:e,angleKey:o,radiusKey:s}}updateDatumStyles(e,t){const i=this.ctx.highlightManager.getActiveHighlight();e.each((o,s)=>{const a=this.getHighlightState(i,t,s.datumIndex),n=this.getStyle(t,a),{stroke:r,strokeWidth:l,strokeOpacity:c}=n;s.style=this.getMarkerStyle(this.properties.marker,s,this.getDatumStylerProperties(s.datum),{isHighlight:t,highlightState:a},n.marker,{stroke:r,strokeWidth:l,strokeOpacity:c})})}updateMarkers(e,t){const i=this.getShapeFillBBox(),{contextNodeData:o}=this;if(!o)return;const s=this.ctx.highlightManager.getActiveHighlight();e.each((a,n)=>{const r=n.style??o.styles[this.getHighlightState(s,t,n.datumIndex)];this.applyMarkerStyle(r,a,n.point,i)})}updateLabels(){const{properties:e}=this,t=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((i,o)=>{o.label&&(i.fillOpacity=this.getHighlightStyle(!1,o.datumIndex).opacity??1,wW(this,i,e,e.label,o.label,!1,t))})}getTooltipContent(e){const{id:t,dataModel:i,processedData:o,axes:s,properties:a}=this,{angleKey:n,angleName:r,radiusKey:l,radiusName:c,legendItemName:h,tooltip:p,marker:u}=a,g=s[fi.Angle],y=s[fi.Radius];if(!i||!o||!g||!y)return;const f=o.dataSources.get(this.id)?.data[e],x=i.resolveColumnById(this,"angleValue",o)[e],S=i.resolveColumnById(this,"radiusValue",o)[e];if(x==null)return;const v=this.getMarkerStyle(u,{datum:f,datumIndex:e},this.getDatumStylerProperties(f),{isHighlight:!1});return this.formatTooltipWithContext(p,{heading:this.getAxisValueText(g,"tooltip",x,f,n,void 0),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(y,"tooltip",S,f,l,void 0)}]},{seriesId:t,datum:f,title:r,angleKey:n,radiusKey:l,angleName:r,radiusName:c,legendItemName:h,...v})}legendItemSymbol(){const{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:o,marker:s}=this.getStyle(!1);return{marker:{shape:s.shape,enabled:s.enabled||t<=0,fill:this.getMarkerFill()??s.stroke??e??"rgba(0, 0, 0, 0)",stroke:s.stroke??e??"rgba(0, 0, 0, 0)",fillOpacity:s.fillOpacity,strokeOpacity:s.strokeOpacity,strokeWidth:s.strokeWidth,lineDash:s.lineDash,lineDashOffset:s.lineDashOffset},line:{stroke:e,strokeOpacity:i,strokeWidth:t,lineDash:o}}}getLegendData(e){if(e!=="category")return[];const{id:t,ctx:{legendManager:i},visible:o}=this,{radiusKey:s,radiusName:a,legendItemName:n,showInLegend:r}=this.properties;return[{legendType:"category",id:t,itemId:s,seriesId:t,enabled:o&&i.getItemEnabled({seriesId:t,itemId:s}),label:{text:n??a??s},symbol:this.legendItemSymbol(),legendItemName:n,hideInLegend:!r}]}pickNodeClosestDatum(e){const{nodeData:t,centerX:i,centerY:o}=this,{x:s,y:a}=e,n=this.radius;if(Math.hypot(s-i,a-o)>n+this.properties.marker.size)return;let l=1/0,c;for(const h of t){const{point:{x:p=Number.NaN,y:u=Number.NaN}={}}=h;if(Number.isNaN(p)||Number.isNaN(u))continue;const g=Math.hypot(e.x-p-i,e.y-u-o);gthis.animatePaths(o),onStop:()=>this.animatePaths(1)}),vW(this,i,"added",e),bW(this,"labels",i,t)}animateWaitingUpdateReady(e){super.animateWaitingUpdateReady(e),this.resetPaths()}animateReadyResize(e){super.animateReadyResize(e),this.resetPaths()}resetPaths(){const e=this.getLineNode();if(e){const{path:t}=e,i=this.getLinePoints(),o=this.getStyle(!1);e.fill=void 0,e.stroke=o.stroke,e.strokeWidth=o.strokeWidth,e.strokeOpacity=o.strokeOpacity,e.lineDash=o.lineDash,e.lineDashOffset=o.lineDashOffset,t.clear(!0);for(const{x:s,y:a,moveTo:n}of i)n?t.moveTo(s,a):t.lineTo(s,a);return e.checkPathDirty(),o}}getStylerResult(e,t,i){const{styler:o}=this.properties;if(o){const s=this.makeStylerParams(t,i),a=this.cachedCallWithContext(o,s)??{},n=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],a,{pick:!1});n&&(e=n)}return e}getFormattedMarkerStyle(e){const{angleKey:t,radiusKey:i}=this.properties;return this.getMarkerStyle(this.properties.marker,e,{angleKey:t,radiusKey:i},{isHighlight:!0})}computeFocusBounds(e){return MW(this,e)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};Nu.className="RadarSeries";import{_ModuleSupport as RW}from"ag-charts-community";var{Property:_v}=RW,wu=class extends ot{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1}};d([_v],wu.prototype,"fill",2),d([_v],wu.prototype,"fillOpacity",2);var{ChartAxisDirection:Rv,Group:EW,HighlightState:BW,Path:zW,PointerEvents:Ev,Selection:FW,applyShapeStyle:Bv,toHighlightString:HW}=Cv,Qc=class extends Nu{constructor(e){super(e),this.properties=new wu,this.areaGroup=this.contentGroup.appendChild(new EW({name:"radar-area"})),this.areaSelection=FW.select(this.areaGroup,zW),this.resetInvalidToZero=!0,this.areaGroup.zIndex=-1}updatePathSelections(){const e=this.visible?[!0]:[];this.areaSelection.update(e),super.updatePathSelections()}getAreaNode(){return this.areaSelection.at(0)}getMarkerFill(e){if(e?.fill!=null)return e.fill;const t=this.getStyle(!1);return t.marker.fill??t.fill}updatePathNodes(){const e=this.getPathNodesStyle(),{fill:t,fillOpacity:i,strokeWidth:o,stroke:s,strokeOpacity:a,lineDash:n,lineDashOffset:r,opacity:l}=e,c=this.getLineNode();c&&c.setProperties({fill:void 0,lineJoin:"round",lineCap:"round",pointerEvents:Ev.None,opacity:l,stroke:s,strokeWidth:o,strokeOpacity:a,lineDash:n,lineDashOffset:r});const h=this.getAreaNode();h&&(Bv(h,{fill:t,fillOpacity:i,stroke:void 0},this.getShapeFillBBox()),h.setProperties({lineJoin:"round",pointerEvents:Ev.None,opacity:l}))}animatePaths(e){super.animatePaths(e);const t=this.getAreaNode();t&&this.animateSinglePath(t,this.getAreaPoints(),e)}getAreaPoints(){const e=this.getLinePoints(),t=n=>{const r=this.axes[n];return r instanceof Cv.PolarAxis?r:void 0},i=t(Rv.Radius),o=t(Rv.Angle);if(!i?.isReversed())return e;const a=o?.getAxisLinePoints()?.points??[];return e.concat(...a)}resetPaths(){const e=super.resetPaths(),t=this.getAreaNode();if(t){const{path:i}=t,o=this.getAreaPoints(),s=e??this.getStyle(!1),a=this.getShapeFillBBox();Bv(t,{fill:s.fill,stroke:void 0,fillOpacity:s.fillOpacity,lineDash:s.lineDash,lineDashOffset:s.lineDashOffset},a),t.lineJoin=t.lineCap="round",i.clear(!0);for(const{x:n,y:r,moveTo:l,arc:c,radius:h=0,startAngle:p=0,endAngle:u=0}of o)c?i.arc(n,r,h,p,u):l?i.moveTo(n,r):i.lineTo(n,r);return i.closePath(),t.checkPathDirty(),s}}makeStylerParams(e,t){const{properties:i}=this,o=HW(t??BW.None);return{marker:{fill:i.marker.fill,fillOpacity:i.marker.fillOpacity,size:i.marker.size,shape:i.marker.shape,stroke:i.marker.stroke,strokeOpacity:i.marker.strokeOpacity,strokeWidth:i.marker.strokeWidth,lineDash:i.marker.lineDash,lineDashOffset:i.marker.lineDashOffset},highlightState:o,highlighted:e,fill:i.fill,fillOpacity:i.fillOpacity,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,seriesId:this.id,stroke:i.stroke,strokeOpacity:i.strokeOpacity,strokeWidth:i.strokeWidth,angleKey:i.angleKey,radiusKey:i.radiusKey}}getStyle(e,t){const{marker:i,fill:o,fillOpacity:s,lineDash:a,lineDashOffset:n,stroke:r,strokeOpacity:l,strokeWidth:c}=this.properties,{size:h,shape:p,fill:u="transparent",fillOpacity:g}=i,y=this.getStylerResult({},e,t);return y.marker??(y.marker={}),{fill:y.fill??o,fillOpacity:y.fillOpacity??s,lineDash:y.lineDash??a,lineDashOffset:y.lineDashOffset??n,stroke:y.stroke??r,strokeOpacity:y.strokeOpacity??l,strokeWidth:y.strokeWidth??c,marker:{enabled:y.marker.enabled??i.enabled,fill:y.marker.fill??u,fillOpacity:y.marker.fillOpacity??g,shape:y.marker.shape??p,size:y.marker.size??h,lineDash:y.marker.lineDash??i.lineDash??a,lineDashOffset:y.marker.lineDashOffset??i.lineDashOffset??n,stroke:y.marker.stroke??i.stroke??r,strokeOpacity:y.marker.strokeOpacity??i.strokeOpacity??l,strokeWidth:y.marker.strokeWidth??i.strokeWidth??c}}}};Qc.className="RadarAreaSeries",Qc.type="radar-area";import{_ModuleSupport as VW}from"ag-charts-community";import{constant as WW,required as Pu,string as rr}from"ag-charts-core";var{commonSeriesOptionsDefs:GW,radarAreaSeriesThemeableOptionsDef:KW}=VW,$W={...GW,...KW,type:Pu(WW("radar-area")),angleKey:Pu(rr),radiusKey:Pu(rr),angleName:rr,radiusName:rr,legendItemName:rr},{ThemeConstants:{POLAR_AXIS_TYPE:zv}}=rW,jW={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radar-area",moduleFactory:e=>new Qc(e),defaultAxes:[{type:zv.ANGLE_CATEGORY},{type:zv.RADIUS_NUMBER}],themeTemplate:hW},YW={type:"series",name:"radar-area",chartType:"polar",enterprise:!0,options:$W,create:e=>new Qc(e)};import{_ModuleSupport as UW}from"ag-charts-community";import{_ModuleSupport as XW}from"ag-charts-community";var{HighlightState:ZW,PointerEvents:qW,toHighlightString:QW}=XW,Jc=class extends Nu{constructor(){super(...arguments),this.properties=new ot}updatePathSelections(){this.lineSelection.update(this.visible?[!0]:[])}updatePathNodes(){const e=this.getLineNode();if(!e)return;const t=this.getPathNodesStyle(),{strokeWidth:i,stroke:o,strokeOpacity:s,lineDash:a,lineDashOffset:n,opacity:r}=t;e.setProperties({fill:void 0,lineJoin:"round",lineCap:"round",pointerEvents:qW.None,opacity:r,stroke:o,strokeWidth:i,strokeOpacity:s,lineDash:a,lineDashOffset:n})}makeStylerParams(e,t){const{properties:i}=this,o=QW(t??ZW.None);return{marker:{fill:i.marker.fill,fillOpacity:i.marker.fillOpacity,size:i.marker.size,shape:i.marker.shape,stroke:i.marker.stroke,strokeOpacity:i.marker.strokeOpacity,strokeWidth:i.marker.strokeWidth,lineDash:i.marker.lineDash,lineDashOffset:i.marker.lineDashOffset},highlightState:o,highlighted:e,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,seriesId:this.id,stroke:i.stroke,strokeOpacity:i.strokeOpacity,strokeWidth:i.strokeWidth,angleKey:i.angleKey,radiusKey:i.radiusKey}}getStyle(e,t){const{marker:i,lineDash:o,lineDashOffset:s,stroke:a,strokeOpacity:n,strokeWidth:r}=this.properties,{size:l,shape:c,fill:h="transparent",fillOpacity:p}=i,u=this.getStylerResult({},e,t);return u.marker??(u.marker={}),{lineDash:u.lineDash??o,lineDashOffset:u.lineDashOffset??s,stroke:u.stroke??a,strokeOpacity:u.strokeOpacity??n,strokeWidth:u.strokeWidth??r,marker:{enabled:u.marker.enabled??i.enabled,fill:u.marker.fill??h,fillOpacity:u.marker.fillOpacity??p,shape:u.marker.shape??c,size:u.marker.size??l,lineDash:u.marker.lineDash??i.lineDash??o,lineDashOffset:u.marker.lineDashOffset??i.lineDashOffset??s,stroke:u.marker.stroke??i.stroke??a,strokeOpacity:u.marker.strokeOpacity??i.strokeOpacity??n,strokeWidth:u.marker.strokeWidth??i.strokeWidth??r}}}};Jc.className="RadarLineSeries",Jc.type="radar-line";import{_ModuleSupport as JW}from"ag-charts-community";import{constant as eG,required as Ou,string as lr}from"ag-charts-core";var{commonSeriesOptionsDefs:tG,radarLineSeriesThemeableOptionsDef:iG}=JW,oG={...tG,...iG,type:Ou(eG("radar-line")),angleKey:Ou(lr),radiusKey:Ou(lr),angleName:lr,radiusName:lr,legendItemName:lr},{POLAR_AXIS_TYPE:Fv}=UW.ThemeConstants,sG={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radar-line",moduleFactory:e=>new Jc(e),defaultAxes:[{type:Fv.ANGLE_CATEGORY},{type:Fv.RADIUS_NUMBER}],themeTemplate:cW},aG={type:"series",name:"radar-line",chartType:"polar",enterprise:!0,options:oG,create:e=>new Jc(e)};import{_ModuleSupport as nG}from"ag-charts-community";import{_ModuleSupport as cr}from"ag-charts-community";import{isDefined as rG}from"ag-charts-core";import{_ModuleSupport as lG}from"ag-charts-community";var{SeriesProperties:cG,makeSeriesTooltip:hG,Property:Ge,Label:dG}=lG,Re=class extends cG{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.label=new dG,this.tooltip=hG()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n,cornerRadius:r}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n,cornerRadius:r,opacity:1}}};d([Ge],Re.prototype,"angleKey",2),d([Ge],Re.prototype,"radiusKey",2),d([Ge],Re.prototype,"angleName",2),d([Ge],Re.prototype,"radiusName",2),d([Ge],Re.prototype,"legendItemName",2),d([Ge],Re.prototype,"fill",2),d([Ge],Re.prototype,"fillOpacity",2),d([Ge],Re.prototype,"stroke",2),d([Ge],Re.prototype,"strokeWidth",2),d([Ge],Re.prototype,"strokeOpacity",2),d([Ge],Re.prototype,"lineDash",2),d([Ge],Re.prototype,"lineDashOffset",2),d([Ge],Re.prototype,"cornerRadius",2),d([Ge],Re.prototype,"styler",2),d([Ge],Re.prototype,"itemStyler",2),d([Ge],Re.prototype,"rotation",2),d([Ge],Re.prototype,"stackGroup",2),d([Ge],Re.prototype,"normalizedTo",2),d([Ge],Re.prototype,"label",2),d([Ge],Re.prototype,"tooltip",2);import{_ModuleSupport as pG}from"ag-charts-community";var{SectorBox:Hv,motion:uG}=pG;function gG(e,t,i){if(i==="updated"){if(e.previousDatum==null||Number.isNaN(e.previousDatum.innerRadius)||Number.isNaN(e.previousDatum.outerRadius))return"added";if(Number.isNaN(t.innerRadius)||Number.isNaN(t.outerRadius))return"removed"}return i==="added"&&e.previousDatum!=null?"updated":i}function Vv(e){return{toFn:(o,s,a)=>{let n,r,l,c,h;return a==="removed"?(n=e,r=e,l=s.innerRadius,c=s.outerRadius,h=new Hv(n,r,l,c)):(n=s.startAngle,r=s.endAngle,l=Number.isNaN(s.innerRadius)?o.innerRadius:s.innerRadius,c=Number.isNaN(s.outerRadius)?o.outerRadius:s.outerRadius,h=s.clipSector),{startAngle:n,endAngle:r,innerRadius:l,outerRadius:c,clipSector:h}},fromFn:(o,s,a)=>{a=gG(o,s,a);let n,r,l,c,h;a==="removed"||a==="updated"?(n=o.startAngle,r=o.endAngle,l=o.innerRadius,c=o.outerRadius,h=o.clipSector):(n=e,r=e,l=s.innerRadius,c=s.outerRadius),h??(h=new Hv(n,r,l,c));const p=uG.NODE_UPDATE_STATE_TO_PHASE_MAPPING[a];return{startAngle:n,endAngle:r,innerRadius:l,outerRadius:c,clipSector:h,phase:p}}}}function yG(e,t){return{centerX:0,centerY:0,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,clipSector:t.clipSector}}var{DEFAULT_POLAR_DIRECTION_KEYS:fG,DEFAULT_POLAR_DIRECTION_NAMES:mG,ChartAxisDirection:to,PolarAxis:xG,diff:SG,groupAccumulativeValueProperty:Wv,keyProperty:bG,normaliseGroupTo:vG,valueProperty:kG,fixNumericExtent:DG,resetLabelFn:MG,seriesLabelFadeInAnimation:AG,seriesLabelFadeOutAnimation:IG,animationValidation:LG,angleBetween:TG,createDatumId:CG,CategoryScale:NG,Sector:wG,SectorBox:PG,motion:Gv,isGradientFill:OG,applyShapeStyle:_G,updateLabelNode:RG,getItemStyles:EG}=cr,BG=class extends cr.SeriesNodeEvent{constructor(e,t,i,o){super(e,t,i,o),this.angleKey=o.properties.angleKey,this.radiusKey=o.properties.radiusKey}},eh=class extends cr.PolarSeries{constructor(e){super({moduleCtx:e,categoryKey:"radiusValue",propertyKeys:fG,propertyNames:mG,canHaveAxes:!0,animationResetFns:{item:yG,label:MG}}),this.properties=new Re,this.NodeEvent=BG,this.groupScale=new NG,this.circleCache={r:0,cx:0,cy:0}}get hasData(){return this.getHasData("angleValue-raw")}nodeFactory(){return new wG}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===to.Angle){const o=t.getDomain(this,"angleValue-end","value",i),s=[Math.min(o[0],0),Math.max(o[1],0)];return DG(s)}else return t.getDomain(this,"radiusValue","key",i)}async processData(e){const{angleKey:t,radiusKey:i,normalizedTo:o}=this.properties,s=!this.ctx.animationManager.isSkipped(),a=this.getStackId(),n=`${a}-trailing`,r=[];rG(o)&&r.push(vG([a,n],Math.abs(o))),s&&(this.processedData&&r.push(SG(this.id,this.processedData)),r.push(LG()));const l=this.visible?{}:{forceValue:0},c=this.axes[to.Radius]?.scale.type,h=this.axes[to.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[bG(i,c,{id:"radiusValue"}),kG(t,h,{id:"angleValue-raw",invalidValue:null,...l}),...Wv(t,"normal",{id:"angleValue-end",rangeId:"angleValue-range",invalidValue:null,groupId:a,separateNegative:!0,...l},h),...Wv(t,"trailing",{id:"angleValue-start",invalidValue:null,groupId:n,separateNegative:!0,...l},h),...r],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,o=this.circleCache;return e===o.r&&t===o.cx&&i===o.cy?!1:(this.circleCache={r:e,cx:t,cy:i},!0)}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}getAxisInnerRadius(){const e=this.axes[to.Radius];return e instanceof xG?this.radius*e.innerRadiusRatio:0}createNodeData(){const{processedData:e,dataModel:t}=this;if(!t||!e||e.type!=="grouped")return;const i=this.axes[to.Angle],o=this.axes[to.Radius],s=i?.scale,a=o?.scale;if(!s||!a)return;const n=t.resolveKeysById(this,"radiusValue",e),r=t.resolveColumnById(this,"angleValue-start",e),l=t.resolveColumnById(this,"angleValue-end",e),c=t.resolveColumnById(this,"angleValue-raw",e),h=t.resolveProcessedDataIndexById(this,"angleValue-range");let p=0;o instanceof Co&&(p=o.groupPaddingInner);const{groupScale:u}=this,{index:g,visibleGroupCount:y}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);u.domain=Array.from({length:y}).map((C,I)=>String(I)),u.range=[0,Math.abs(a.bandwidth??0)],u.paddingInner=y>1?p:0;const f=u.bandwidth>=1?u.bandwidth:u.rawBandwidth,x=i.isReversed(),S=o.isReversed(),v=S?this.radius:this.getAxisInnerRadius(),b=(S?this.getAxisInnerRadius():this.radius)+v,k=this.getSeriesDomain(to.Angle),{angleKey:A,radiusKey:M,angleName:D,radiusName:L,legendItemName:N,label:P}=this.properties,R=(C,I,O,z)=>{const B=this.getLabelText(I,C,A,"angle",k,P,{value:I,datum:C,angleKey:A,radiusKey:M,angleName:D,radiusName:L,legendItemName:N});if(B)return{x:O,y:z,text:B,textAlign:"center",textBaseline:"middle"}},F=[],_=EG((C,I,O)=>en(this,C,I,O)),E={itemId:M,nodeData:F,labelData:F,styles:_};if(!this.visible)return E;const{dataSources:T}=e,w=T.get(this.id)?.data??[];for(const{datumIndex:C,group:I}of t.forEachGroupDatum(this,e)){const O=w[C],z=n[C];if(z==null)return;const B=c[C],H=r[C],W=l[C],V=B>=0&&!Object.is(B,-0),G=I.aggregation[h][V?1:0],K=V===x;let Q=s.convert(H,{clamp:!0}),X=s.convert(W,{clamp:!0}),Y=s.convert(0,{clamp:!0}),J=s.convert(G,{clamp:!0});K&&([Y,J]=[J,Y],[Q,X]=[X,Q]);const U=b-a.convert(z)+u.convert(String(g)),he=U+f,ne=(U+he)/2,Z=Q+TG(Q,X)/2,le=Math.cos(Z)*ne,oe=Math.sin(Z)*ne,ge=this.properties.label.enabled?R(O,B,le,oe):void 0,ce=new PG(Q,X,U,he);F.push({series:this,datum:O,datumIndex:C,point:{x:le,y:oe,size:0},midPoint:{x:le,y:oe},label:ge,angleValue:B,radiusValue:z,innerRadius:U,outerRadius:he,startAngle:Y,endAngle:J,clipSector:ce,reversed:K,index:C})}return E}update({seriesRect:e}){const t=this.checkResize(e);this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updateSectorSelection(this.itemSelection,!1),this.updateSectorSelection(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updateSectorSelection(e,t){let i=[];const o=this.ctx.highlightManager?.getActiveHighlight();t?o?.datum&&o.series===this&&i.push(o):i=this.nodeData;const{contextNodeData:s}=this;if(!s)return;const a=this.ctx.highlightManager.getActiveHighlight(),n=this.getShapeFillBBox(),r=this.hasItemStylers();e.update(i,void 0,l=>this.getDatumId(l)).each((l,c)=>{const h=Cn(c);if(h==null)return;if(r){const f=this.getHighlightState(o,t,c.datumIndex);c.style=en(this,c,t,f)}const p=c.style??s.styles[this.getHighlightState(a,t,c.datumIndex)],u=p.cornerRadius,g=p.fill,y=cr.isGradientFill(g)&&g.bounds!=="item"?{centerX:0,centerY:0}:void 0;_G(l,p,n,y),l.lineJoin="round",l.inset=l.stroke==null?0:l.strokeWidth/2,l.startInnerCornerRadius=h.reversed?u:0,l.startOuterCornerRadius=h.reversed?u:0,l.endInnerCornerRadius=h.reversed?0:u,l.endOuterCornerRadius=h.reversed?0:u,t&&(l.startAngle=c.startAngle,l.endAngle=c.endAngle,l.clipSector=c.clipSector,l.innerRadius=c.innerRadius,l.outerRadius=c.outerRadius)})}updateLabels(){const{properties:e}=this,t=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((i,o)=>{RG(this,i,e,e.label,o.label,!1,t),i.fillOpacity=this.getHighlightStyle(!1,o.datumIndex).opacity??1})}getBarTransitionFunctions(){const e=this.axes[to.Angle]?.scale;let t=0;if(!e)return Vv(t);const i=Math.min(e.domain[0],e.domain[1]),o=Math.max(e.domain[0],e.domain[1]);return i<=0&&o>=0&&(t=e.convert(0)),Vv(t)}animateEmptyUpdateReady(){const{labelSelection:e}=this,t=this.getBarTransitionFunctions();Gv.fromToMotion(this.id,"datums",this.ctx.animationManager,[this.itemSelection],t),AG(this,"labels",this.ctx.animationManager,e)}animateClearingUpdateEmpty(){const{itemSelection:e}=this,{animationManager:t}=this.ctx,i=this.getBarTransitionFunctions();Gv.fromToMotion(this.id,"datums",t,[e],i),IG(this,"labels",t,this.labelSelection)}getTooltipContent(e){const{id:t,dataModel:i,processedData:o,axes:s,properties:a}=this,{angleKey:n,angleName:r,radiusKey:l,radiusName:c,legendItemName:h,tooltip:p}=a,u=s[to.Angle],g=s[to.Radius],y=this.nodeData?.[e];if(!i||!o||!u||!g||!y)return;const f=o.dataSources.get(this.id)?.data[e],x=i.resolveKeysById(this,"radiusValue",o)[e],S=i.resolveColumnById(this,"angleValue-raw",o)[e];if(x==null)return;const v=en(this,y,!1);return this.formatTooltipWithContext(p,{heading:this.getAxisValueText(g,"tooltip",x,f,l,void 0),symbol:this.legendItemSymbol(),data:[{label:r,fallbackLabel:n,value:this.getAxisValueText(u,"tooltip",S,f,n,void 0)}]},{seriesId:t,datum:f,title:r,angleKey:n,angleName:r,radiusKey:l,radiusName:c,legendItemName:h,...v})}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.itemSelection.nodes())}legendItemSymbol(){const{fill:e,stroke:t,fillOpacity:i,strokeOpacity:o,strokeWidth:s,lineDash:a,lineDashOffset:n}=Su(this,!1,!1,cr.HighlightState.None),r={fill:e??"rgba(0, 0, 0, 0)",stroke:t??"rgba(0, 0, 0, 0)",fillOpacity:i,strokeOpacity:o,strokeWidth:s,lineDash:a,lineDashOffset:n};return OG(r.fill)&&(r.fill={...r.fill,gradient:"linear",rotation:0,reverse:!1}),{marker:r}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{angleKey:o,angleName:s,legendItemName:a,showInLegend:n}=this.properties;return[{legendType:"category",id:t,itemId:o,seriesId:t,enabled:i,label:{text:a??s??o},symbol:this.legendItemSymbol(),legendItemName:a,hideInLegend:!n}]}getDatumId(e){return CG(e.radiusValue)}computeLabelsBBox(){return null}getStackId(){return`radialBar-stack-${this.seriesGrouping?.groupIndex??this.id}-xValues`}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};eh.className="RadialBarSeries",eh.type="radial-bar";import{_ModuleSupport as zG}from"ag-charts-community";import{boolean as Kv,constant as FG,number as HG,required as _u,string as on}from"ag-charts-core";var{commonSeriesOptionsDefs:VG,radialBarSeriesThemeableOptionsDef:WG}=zG,GG={...VG,...WG,type:_u(FG("radial-bar")),angleKey:_u(on),radiusKey:_u(on),angleName:on,radiusName:on,legendItemName:on,grouped:Kv,stacked:Kv,stackGroup:on,normalizedTo:HG};import{_ModuleSupport as Ru}from"ag-charts-community";var{ThemeConstants:{POLAR_AXIS_TYPE:KG},FILL_GRADIENT_CONIC_SERIES_DEFAULTS:$G,FILL_IMAGE_DEFAULTS:jG,FILL_PATTERN_DEFAULTS:YG}=Ru,UG={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",$G],["image",jG],["pattern",YG]]},stroke:{$palette:"stroke"},strokeWidth:{$isUserOption:["./stroke",1,0]},label:{...Ru.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},highlight:Ru.multiSeriesHighlightStyle()},axes:{[KG.RADIUS_CATEGORY]:{innerRadiusRatio:.2,groupPaddingInner:.2,paddingInner:.2,paddingOuter:.1}}},{POLAR_AXIS_TYPE:$v}=nG.ThemeConstants,XG={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radial-bar",moduleFactory:e=>new eh(e),defaultAxes:[{type:$v.ANGLE_NUMBER},{type:$v.RADIUS_CATEGORY}],themeTemplate:UG,stackable:!0,groupable:!0},ZG={type:"series",name:"radial-bar",chartType:"polar",enterprise:!0,options:GG,create:e=>new eh(e)};import{_ModuleSupport as qG}from"ag-charts-community";import{_ModuleSupport as QG}from"ag-charts-community";import{_ModuleSupport as JG}from"ag-charts-community";var{Property:jv}=JG,Eu=class extends Ne{};d([jv],Eu.prototype,"columnWidthRatio",2),d([jv],Eu.prototype,"maxColumnWidthRatio",2);var{ChartAxisDirection:eK,PolarAxis:tK,RadialColumnShape:iK,getRadialColumnWidth:oK}=QG,th=class extends dv{constructor(e){super(e,{animationResetFns:{item:SV}}),this.properties=new Eu}getStackId(){return`radarColumn-stack-${this.seriesGrouping?.groupIndex??this.id}-yValues`}nodeFactory(){return new iK}getColumnTransitionFunctions(){const e=this.isRadiusAxisReversed()?this.radius:this.getAxisInnerRadius();return xV(e)}isRadiusAxisCircle(){const e=this.axes[eK.Radius];return e instanceof tK?e.shape==="circle":!1}updateItemPath(e,t,i){e.isBeveled=this.isRadiusAxisCircle(),e.isRadiusAxisReversed=this.isRadiusAxisReversed(),i&&(e.innerRadius=t.innerRadius,e.outerRadius=t.outerRadius,e.startAngle=t.startAngle,e.endAngle=t.endAngle,e.columnWidth=t.columnWidth,e.axisInnerRadius=t.axisInnerRadius,e.axisOuterRadius=t.axisOuterRadius)}getColumnWidth(e,t){const{columnWidthRatio:i=.5,maxColumnWidthRatio:o=.5}=this.properties;return oK(e,t,this.radius,i,o)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};th.className="RadialColumnSeries",th.type="radial-column";import{_ModuleSupport as sK}from"ag-charts-community";import{boolean as Yv,constant as aK,number as nK,required as Bu,string as sn}from"ag-charts-core";var{commonSeriesOptionsDefs:rK,radialColumnSeriesThemeableOptionsDef:lK}=sK,cK={...rK,...lK,type:Bu(aK("radial-column")),angleKey:Bu(sn),radiusKey:Bu(sn),angleName:sn,radiusName:sn,legendItemName:sn,grouped:Yv,stacked:Yv,stackGroup:sn,normalizedTo:nK};import{_ModuleSupport as zu}from"ag-charts-community";var{ThemeConstants:{POLAR_AXIS_TYPE:Uv,POLAR_AXIS_SHAPE:Xv},FILL_GRADIENT_RADIAL_SERIES_DEFAULTS:hK,FILL_IMAGE_DEFAULTS:dK,FILL_PATTERN_DEFAULTS:pK}=zu,uK={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",hK],["image",dK],["pattern",pK]]},stroke:{$palette:"stroke"},columnWidthRatio:.5,maxColumnWidthRatio:.5,strokeWidth:{$isUserOption:["./stroke",1,0]},label:{...zu.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:zu.multiSeriesHighlightStyle()},axes:{[Uv.ANGLE_CATEGORY]:{shape:{$findFirstSiblingNotOperation:Xv.CIRCLE},groupPaddingInner:0,paddingInner:0,label:{spacing:10}},[Uv.RADIUS_NUMBER]:{shape:{$findFirstSiblingNotOperation:Xv.CIRCLE},innerRadiusRatio:.5}}},{POLAR_AXIS_TYPE:Zv}=qG.ThemeConstants,gK={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radial-column",moduleFactory:e=>new th(e),defaultAxes:[{type:Zv.ANGLE_CATEGORY},{type:Zv.RADIUS_NUMBER}],themeTemplate:uK,stackable:!0,groupable:!0},yK={type:"series",name:"radial-column",chartType:"polar",enterprise:!0,options:cK,create:e=>new th(e)};import{_ModuleSupport as an}from"ag-charts-community";import{_ModuleSupport as Qs}from"ag-charts-community";import{cachedTextMeasurer as fK,isArray as mK,measureTextSegments as xK,toPlainText as SK}from"ag-charts-core";import{_ModuleSupport as bK}from"ag-charts-community";var{SvgPath:vK,Rotatable:kK,Translatable:DK,Scalable:MK}=bK,Fu=class extends kK(MK(DK(vK))){constructor(){super(...arguments),this.scalingCenterX=.5,this.scalingCenterY=.5,this.rotationCenterX=.5,this.rotationCenterY=.5}};Fu.defaultPathData="M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z";import{_ModuleSupport as ih}from"ag-charts-community";var{getColorStops:AK,normalizeAngle360:IK,normalizeAngle360Inclusive:LK,toDegrees:TK}=ih,{BaseProperties:hr,makeSeriesTooltip:CK,SeriesProperties:NK,PropertiesArray:Hu,AxisLabel:wK,Property:$,Label:PK}=ih,qv=class extends PK{};d([$],qv.prototype,"spacing",2);var ut=class extends hr{constructor(){super(...arguments),this.label=new qv}getStyle(){const{fill:e="black",fillOpacity:t=1,stroke:i="black",strokeWidth:o=0,strokeOpacity:s=1,lineDash:a=[0],lineDashOffset:n=0}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:o,strokeOpacity:s,lineDash:a,lineDashOffset:n}}};d([$],ut.prototype,"text",2),d([$],ut.prototype,"value",2),d([$],ut.prototype,"shape",2),d([$],ut.prototype,"placement",2),d([$],ut.prototype,"spacing",2),d([$],ut.prototype,"size",2),d([$],ut.prototype,"rotation",2),d([$],ut.prototype,"fill",2),d([$],ut.prototype,"fillOpacity",2),d([$],ut.prototype,"stroke",2),d([$],ut.prototype,"strokeWidth",2),d([$],ut.prototype,"strokeOpacity",2),d([$],ut.prototype,"lineDash",2),d([$],ut.prototype,"lineDashOffset",2),d([$],ut.prototype,"label",2);var wi=class extends hr{constructor(){super(...arguments),this.enabled=!0,this.fills=new Hu(ih.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t){const{enabled:i,fill:o,fills:s,fillMode:a,fillOpacity:n,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}=this;return{fill:i?o??ek(s,a,e,t):"none",fillOpacity:n,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:p}}};d([$],wi.prototype,"enabled",2),d([$],wi.prototype,"fills",2),d([$],wi.prototype,"fillMode",2),d([$],wi.prototype,"fill",2),d([$],wi.prototype,"fillOpacity",2),d([$],wi.prototype,"stroke",2),d([$],wi.prototype,"strokeWidth",2),d([$],wi.prototype,"strokeOpacity",2),d([$],wi.prototype,"lineDash",2),d([$],wi.prototype,"lineDashOffset",2);var dr=class extends hr{constructor(){super(...arguments),this.values=void 0,this.step=void 0,this.minSpacing=0,this.maxSpacing=1e3}};d([$],dr.prototype,"values",2),d([$],dr.prototype,"step",2),d([$],dr.prototype,"minSpacing",2),d([$],dr.prototype,"maxSpacing",2);var OK=class extends wK{},Lt=class extends hr{constructor(){super(...arguments),this.min=0,this.max=1,this.fills=new Hu(ih.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.defaultFill="black",this.interval=new dr,this.label=new OK}getStyle(e,t,i){const{fill:o,fills:s,defaultFill:a,fillMode:n,fillOpacity:r,stroke:l,strokeWidth:c,strokeOpacity:h,lineDash:p,lineDashOffset:u}=this;return{fill:o??(e&&s.length===0?a:void 0)??ek(s,n,t,i),fillOpacity:r,stroke:l,strokeWidth:c,strokeOpacity:h,lineDash:p,lineDashOffset:u}}};d([$],Lt.prototype,"min",2),d([$],Lt.prototype,"max",2),d([$],Lt.prototype,"fills",2),d([$],Lt.prototype,"fillMode",2),d([$],Lt.prototype,"fill",2),d([$],Lt.prototype,"fillOpacity",2),d([$],Lt.prototype,"stroke",2),d([$],Lt.prototype,"strokeWidth",2),d([$],Lt.prototype,"strokeOpacity",2),d([$],Lt.prototype,"lineDash",2),d([$],Lt.prototype,"lineDashOffset",2),d([$],Lt.prototype,"defaultFill",2),d([$],Lt.prototype,"interval",2),d([$],Lt.prototype,"label",2);var Pi=class extends hr{constructor(){super(...arguments),this.enabled=!0,this.spacing=0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};d([$],Pi.prototype,"enabled",2),d([$],Pi.prototype,"radiusRatio",2),d([$],Pi.prototype,"spacing",2),d([$],Pi.prototype,"fill",2),d([$],Pi.prototype,"fillOpacity",2),d([$],Pi.prototype,"stroke",2),d([$],Pi.prototype,"strokeWidth",2),d([$],Pi.prototype,"strokeOpacity",2),d([$],Pi.prototype,"lineDash",2),d([$],Pi.prototype,"lineDashOffset",2);var Qv=class extends $i{};d([$],Qv.prototype,"text",2);var Jv=class extends zn{};d([$],Jv.prototype,"text",2);var Ee=class extends NK{constructor(){super(...arguments),this.startAngle=0,this.endAngle=0,this.segmentation=new er,this.defaultColorRange=[],this.targets=new Hu(ut),this.defaultTarget=new ut,this.outerRadiusRatio=1,this.innerRadiusRatio=1,this.cornerRadius=0,this.cornerMode="container",this.spacing=0,this.scale=new Lt,this.bar=new wi,this.needle=new Pi,this.label=new Qv,this.secondaryLabel=new Jv,this.tooltip=CK()}};d([$],Ee.prototype,"value",2),d([$],Ee.prototype,"startAngle",2),d([$],Ee.prototype,"endAngle",2),d([$],Ee.prototype,"segmentation",2),d([$],Ee.prototype,"defaultColorRange",2),d([$],Ee.prototype,"targets",2),d([$],Ee.prototype,"defaultTarget",2),d([$],Ee.prototype,"outerRadiusRatio",2),d([$],Ee.prototype,"innerRadiusRatio",2),d([$],Ee.prototype,"outerRadius",2),d([$],Ee.prototype,"innerRadius",2),d([$],Ee.prototype,"cornerRadius",2),d([$],Ee.prototype,"cornerMode",2),d([$],Ee.prototype,"spacing",2),d([$],Ee.prototype,"scale",2),d([$],Ee.prototype,"bar",2),d([$],Ee.prototype,"needle",2),d([$],Ee.prototype,"label",2),d([$],Ee.prototype,"secondaryLabel",2),d([$],Ee.prototype,"tooltip",2);function ek(e,t,i,o){const{domain:s,range:a}=o,[n,r]=a,l=IK((n+r)/2+Math.PI),c=LK(r-n);return{type:"gradient",gradient:"conic",colorSpace:"oklch",colorStops:AK(e,i,s,t).map(({color:p,stop:u})=>(u=Math.min(Math.max(u,0),1),u=(n+c*u-l)/(2*Math.PI),u=(u%1+1)%1,{stop:u,color:p})),bounds:"series",rotation:TK(l)+90}}import{_ModuleSupport as _K}from"ag-charts-community";import{toPlainText as Vu}from"ag-charts-core";var{SectorBox:Wu}=_K;function RK(e){const{startAngle:t,endAngle:i,clipStartAngle:o,clipEndAngle:s,innerRadius:a,outerRadius:n}=e;if(!(o==null||s==null))return new Wu(Math.max(o,t),Math.min(s,i),a,n)}function tk(e,t,i){return Math.max(e,i.startAngle)<=Math.min(t,i.endAngle)}function Gu(e){return e.clipStartAngle!=null&&e.clipEndAngle!=null}function Ku(e,t){const{clipStartAngle:i,clipEndAngle:o,innerRadius:s,outerRadius:a}=e;return new Wu(i,t?i:o,s,a)}function ik(e,t){const i=e?"initial":"update";return{node:{fromFn(a,n){const r=a.previousDatum;let{startAngle:l,endAngle:c}=r??n;const h=r!=null&&Gu(r)?Ku(r,e):void 0,p=Gu(n)?Ku(n,e):void 0;let u;return h!=null&&p!=null?u=h:h==null&&p!=null?(u=p,l=n.startAngle,c=n.endAngle):h!=null&&p==null?(u=void 0,l=n.startAngle,c=n.endAngle):e&&(c=l),{startAngle:l,endAngle:c,clipSector:u,phase:i}},toFn(a,n){const{startAngle:r,endAngle:l}=n;let c;return Gu(n)&&(c=Ku(n,!1)),{startAngle:r,endAngle:l,clipSector:c}},applyFn(a,n){const{startAngle:r,endAngle:l}=n;let{clipSector:c}=n;c!=null&&(c=new Wu(Math.max(r,c.startAngle),Math.min(l,c.endAngle),c.innerRadius,c.outerRadius));const h=c==null||tk(r,l,c);a.startAngle=r,a.endAngle=l,a.clipSector=c,a.visible=h}},needle:{fromFn(a){let{angle:n}=a.previousDatum??a.datum;return e&&(n=t),{rotation:n,phase:i}},toFn(a,n){const{angle:r}=n;return{rotation:r}}}}}function $u(e,t){const{startAngle:i,endAngle:o}=t,s=RK(t),a=s==null||tk(i,o,s);return{startAngle:i,endAngle:o,clipSector:s,visible:a}}function ok(e,t){const{angle:i}=t;return{rotation:i}}var EK={top:0,middle:.5,bottom:1};function BK(e,t,i,o,s,a){const{padding:n,textAlign:r,verticalAlign:l}=o;let c,h;if(i.each((k,A)=>{A.label==="primary"?c=A:A.label==="secondary"&&(h=A)}),c==null)return;const p=Jn(e.id,t,c,a?.label);if(p==null)return;const u=h==null?void 0:Jn(e.id,t,h,a?.secondaryLabel),g={padding:n},y=r==="center"?2:1,f=l==="middle"?2:1,x=k=>({width:Math.sqrt(Math.max(s**2-(k/f)**2,0))*y,height:Math.min(k,f*s),meta:null});let S,v,m;if(h!=null&&u!=null){const k=_m(Vu(p),c,Vu(u),h,g,x);S=k?.label,v=k?.secondaryLabel,m=k?.height??0}else{const k=En(Vu(p),c,g,x);S=k?.[0],v=void 0,m=k?.[0].height??0}const b=m*EK[l];i.each((k,A)=>{let M;if(A.label==="primary"?M=S:A.label==="secondary"&&(M=v),M==null){k.visible=!1;return}k.visible=!0,k.text=M.text,k.fontSize=M.fontSize,k.lineHeight=M.lineHeight,k.textAlign=r,k.textBaseline="middle";const D=A.label==="primary"?M.height/2:m-M.height/2;k.y=A.centerY+D-b,k.x=A.centerX})}var{fromToMotion:pr,resetMotion:sk,SeriesNodePickMode:ak,StateMachine:zK,createDatumId:ju,normalizeAngle360:FK,normalizeAngle360Inclusive:nk,isBetweenAngles:oh,sectorBox:HK,toRadians:sh,BBox:VK,Group:as,PointerEvents:ah,Selection:ns,Sector:WK,SectorBox:GK,Text:rk,Marker:KK,tickFormat:$K,applyShapeStyle:nh,mergeDefaults:jK}=Qs,YK={inside:90,middle:0,outside:-90},UK=[{textAlign:"left",textBaseline:"top"},{textAlign:"right",textBaseline:"top"},{textAlign:"right",textBaseline:"bottom"},{textAlign:"left",textBaseline:"bottom"}],XK=[{textAlign:"right",textBaseline:"bottom"},{textAlign:"left",textBaseline:"bottom"},{textAlign:"left",textBaseline:"top"},{textAlign:"right",textBaseline:"top"}],rh=class extends Qs.Series{constructor(e){super({moduleCtx:e,pickModes:[ak.EXACT_SHAPE_MATCH,ak.NEAREST_NODE]}),this.centerX=0,this.centerY=0,this.radius=0,this.textAlign="center",this.verticalAlign="middle",this.properties=new Ee,this.scale=new yg,this.scaleGroup=this.contentGroup.appendChild(new as({name:"scaleGroup"})),this.itemGroup=this.contentGroup.appendChild(new as({name:"itemGroup"})),this.itemNeedleGroup=this.contentGroup.appendChild(new as({name:"itemNeedleGroup"})),this.itemTargetGroup=this.contentGroup.appendChild(new as({name:"itemTargetGroup"})),this.itemTargetLabelGroup=this.contentGroup.appendChild(new as({name:"itemTargetLabelGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new as({name:"itemLabelGroup"})),this.highlightTargetGroup=this.highlightGroup.appendChild(new as({name:"itemTargetLabelGroup"})),this.tickGroup=this.contentGroup.appendChild(new as({name:"tickGroup"})),this.scaleSelection=ns.select(this.scaleGroup,()=>this.nodeFactory()),this.datumSelection=ns.select(this.itemGroup,()=>this.nodeFactory()),this.needleSelection=ns.select(this.itemNeedleGroup,Fu),this.targetSelection=ns.select(this.itemTargetGroup,()=>this.markerFactory()),this.targetLabelSelection=ns.select(this.itemTargetLabelGroup,rk),this.labelSelection=ns.select(this.itemLabelGroup,rk),this.highlightTargetSelection=ns.select(this.highlightTargetGroup,()=>this.markerFactory()),this.tickSelection=ns.select(this.tickGroup,Qs.TransformableText),this.datumUnion=new pb,this.animationState=new zK("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.animateReadyResize(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateWaitingUpdateReady()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty"},reset:"empty",skip:"ready"}}),this.scaleGroup.pointerEvents=ah.None,this.tickGroup.pointerEvents=ah.None,this.itemNeedleGroup.pointerEvents=ah.None,this.itemLabelGroup.pointerEvents=ah.None}get hasData(){return this.properties.value!=null}nodeFactory(){return new WK}markerFactory(){const e=new KK;return e.size=1,e}processData(){this.nodeDataRefresh=!0,this.animationState.transition("updateData")}formatLabel(e){const{min:t,max:i}=this.properties.scale;return gb(e,{min:t,max:i})}layoutScale(){const{scale:e,properties:t}=this,{seriesRectWidth:i,seriesRectHeight:o}=this.nodeDataDependencies,{scale:s,outerRadius:a}=this.properties,{min:n,max:r,label:l,interval:c}=s,h=sh(t.startAngle-90),p=sh(t.endAngle-90),g=nk(p-h)>Math.PI,y=g||oh(1.5*Math.PI,h,p),f=g||oh(0*Math.PI,h,p),x=g||oh(.5*Math.PI,h,p),S=g||oh(1*Math.PI,h,p);let v;S&&!f?v="right":!S&&f?v="left":v="center";let m;y&&!x?m="bottom":!y&&x?m="top":m="middle";const b=HK({startAngle:h,endAngle:p,innerRadius:0,outerRadius:.5}),k=-(b.x+b.width/2)*2,A=-(b.y+b.height/2)*2,M=Math.min(i/b.width,o/b.height);e.domain=[n,r],e.range=[h,p],e.arcLength=M/2;const{maxSpacing:D,minSpacing:L}=c,{arcLength:N}=e,P=D?Math.floor(N/D):1,R=L?Math.floor(N/L):1/0,F=Math.floor(4/Math.PI*Math.abs(e.range[0]-e.range[1])),_=Math.max(P,Math.min(R,F)),E=c.values??e.ticks({nice:!1,interval:c.step,minTickCount:P,maxTickCount:R,tickCount:_})?.ticks??[],T=$K(E,typeof l.format=="string"?l.format:void 0),w=fK(l),C=E.map((W,V)=>{let G;if(l.formatter&&(G=Un(this.ctx,l.formatter,{value:W,index:V,domain:e.domain,boundSeries:void 0})),G??(G=T?.(W)),G==null)return;const{width:K,height:Q}=mK(G)?xK(G,l):w.measureLines(G);return{index:V,value:W,text:G,width:K,height:Q}}).filter(W=>W!=null),I=C.reduce((W,V)=>Math.max(W,V.width),0),O=C.reduce((W,V)=>Math.max(W,V.height),0),z=l.enabled?Math.max(I,O)+l.spacing:0,B=Math.max(.5*M-z,0),H=a??B;return this.centerX=i/2+k*H,this.centerY=o/2+A*H,this.radius=H,this.textAlign=v,this.verticalAlign=m,C}getShapeFillBBox(){const{centerX:e,centerY:t,radius:i}=this,o=new VK(e-i,t-i,2*i,2*i);return{series:o,axis:o}}getTargets(){const{properties:e}=this,t=e.defaultTarget;return Array.from(e.targets).map(i=>{const{text:o=t.text,value:s=t.value??0,shape:a=t.shape??"triangle",rotation:n=t.rotation??0,placement:r=t.placement??"middle",spacing:l=t.spacing??0,size:c=t.size??0}=i,{enabled:h=t.label.enabled,color:p=t.label.color??"black",fontStyle:u=t.label.fontStyle??"normal",fontWeight:g=t.label.fontWeight??"normal",fontSize:y=t.label.fontSize,fontFamily:f=t.label.fontFamily,spacing:x=t.label.spacing??0}=i.label;return{text:o,value:s,shape:a,placement:r,spacing:l,size:c,rotation:n,label:{enabled:h,color:p,fontStyle:u,fontWeight:g,fontSize:y,fontFamily:f,spacing:x},style:i.getStyle()}})}getTargetRadius(e){const{radius:t,properties:i}=this,{innerRadiusRatio:o,outerRadiusRatio:s}=i,{placement:a,spacing:n,size:r}=e,l=t*s,c=t*o;switch(a){case"inside":return Math.max(c-n-r/2,0);case"outside":return l+n+r/2;default:return(c+l)/2}}getTargetLabel(e){const{scale:t}=this,{value:i,size:o,placement:s,label:a}=e,{spacing:n,color:r,fontStyle:l,fontWeight:c,fontSize:h,fontFamily:p}=a,u=void 0,g=t.convert(i),y=Math.trunc(FK(g)/(Math.PI/2)),f=o/2+n;let x,S,v,m;switch(s){case"outside":({textAlign:x,textBaseline:S}=UK[y]),v=f*Math.cos(g),m=f*Math.sin(g);break;case"inside":({textAlign:x,textBaseline:S}=XK[y]),v=-f*Math.cos(g),m=-f*Math.sin(g);break;default:x="center",S="bottom",v=0,m=-f;break}return{offsetX:v,offsetY:m,fill:r,textAlign:x,textBaseline:S,fontStyle:l,fontWeight:c,fontSize:h,fontFamily:p,lineHeight:u}}createNodeData(){const e=this.layoutScale(),{id:t,scale:i,properties:o,radius:s,centerX:a,centerY:n}=this,{value:r,innerRadiusRatio:l,outerRadiusRatio:c,segmentation:h,cornerRadius:p,cornerMode:u,needle:g,bar:y,scale:f,label:x,secondaryLabel:S}=o,{outerRadius:v=s*c,innerRadius:m=s*l,defaultColorRange:b}=o,k=this.getTargets(),A=[],M=[],D=[],L=[],N=[],P=u==="item",R=i.convert(i.domain[0]),F=i.convert(r),_=Math.ceil(nk(F-R)*s);let E=h.enabled?h.interval.getSegments(i,_):void 0;const T=y.getStyle(b,i),w=f.getStyle(y.enabled,b,i);if(E==null&&P){const C=Math.min(...i.domain),I=Math.max(...i.domain),O={value:r,segmentStart:C,segmentEnd:I},B=Math.min(p,(v-m)/2)/((m+v)/2);A.push({series:this,itemId:"value",datum:O,datumIndex:{type:0},type:0,centerX:a,centerY:n,outerRadius:v,innerRadius:m,startAngle:R-B,endAngle:F+B,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:p,endCornerRadius:p,style:T}),N.push({series:this,itemId:"scale",datum:O,datumIndex:{type:0},type:0,centerX:a,centerY:n,outerRadius:v,innerRadius:m,startAngle:i.range[0]-B,endAngle:i.range[1]+B,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:p,endCornerRadius:p,style:w})}else{E??(E=i.domain);for(let C=0;Cthis.formatLabel(K.value)}=x;L.push({label:"primary",centerX:a,centerY:n,text:C,value:r,fill:I,fontSize:O,minimumFontSize:z,fontStyle:B,fontWeight:H,fontFamily:W,lineHeight:V,formatter:G})}if(!g.enabled&&S.enabled){const{text:C,color:I,fontSize:O,minimumFontSize:z,fontStyle:B,fontWeight:H,fontFamily:W,lineHeight:V,formatter:G}=S;L.push({label:"secondary",centerX:a,centerY:n,text:C,value:r,fill:I,fontSize:O,minimumFontSize:z,fontStyle:B,fontWeight:H,fontFamily:W,lineHeight:V,formatter:G})}if(g.enabled){let C=g.radiusRatio==null?m:s*g.radiusRatio;C=Math.max(C-g.spacing,0);const I=i.convert(r);D.push({centerX:a,centerY:n,radius:C,angle:I,series:this})}for(let C=0;CMath.max(...i.domain))continue;const V=this.getTargetRadius(I),G=i.convert(O),K=sh(I.rotation+YK[I.placement]);M.push({series:this,itemId:`target-${C}`,midPoint:{x:V*Math.cos(G)+a,y:V*Math.sin(G)+n},datum:{value:O},datumIndex:{type:1,index:C},type:1,value:O,text:z,centerX:a,centerY:n,shape:H,radius:V,angle:G,rotation:K,size:B,label:this.getTargetLabel(I),style:W})}return{itemId:t,nodeData:A,needleData:D,targetData:M,labelData:L,scaleData:N,tickData:e}}updateSelections(e){(this.nodeDataRefresh||e)&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}highlightDatum(e){if(e!=null&&e.series===this&&e.type===1)return e}update({seriesRect:e}){const{datumSelection:t,labelSelection:i,needleSelection:o,targetSelection:s,targetLabelSelection:a,scaleSelection:n,highlightTargetSelection:r,tickSelection:l}=this,c=this.checkResize(e);this.updateSelections(c),this.contentGroup.visible=this.visible,this.contentGroup.opacity=this.getOpacity();const h=this.contextNodeData?.nodeData??[],p=this.contextNodeData?.labelData??[],u=this.contextNodeData?.needleData??[],g=this.contextNodeData?.targetData??[],y=this.contextNodeData?.scaleData??[],f=this.contextNodeData?.tickData??[],x=this.highlightDatum(this.ctx.highlightManager.getActiveHighlight());this.scaleSelection=this.updateScaleSelection({scaleData:y,scaleSelection:n}),this.updateScaleNodes({scaleSelection:n}),this.needleSelection=this.updateNeedleSelection({needleData:u,needleSelection:o}),this.updateNeedleNodes({needleSelection:o}),this.targetSelection=this.updateTargetSelection({targetData:g,targetSelection:s}),this.updateTargetStyles({targetSelection:s,isHighlight:!1}),this.updateTargetNodes({targetSelection:s}),this.targetLabelSelection=this.updateTargetLabelSelection({targetData:g,targetLabelSelection:a}),this.updateTargetLabelNodes({targetLabelSelection:a}),this.datumSelection=this.updateDatumSelection({nodeData:h,datumSelection:t}),this.updateDatumNodes({datumSelection:t}),this.labelSelection=this.updateLabelSelection({labelData:p,labelSelection:i}),this.updateLabelNodes({labelSelection:i}),this.highlightTargetSelection=this.updateTargetSelection({targetData:x==null?[]:[x],targetSelection:r}),this.updateTargetStyles({targetSelection:r,isHighlight:!0}),this.updateTargetNodes({targetSelection:r}),this.tickSelection=this.updateTickSelection({tickData:f,tickSelection:l}),this.updateTickNodes({tickSelection:l}),c&&this.animationState.transition("resize"),this.animationState.transition("update")}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>ju(e.nodeData.length,t.itemId))}updateDatumNodes(e){const{datumSelection:t}=e,{ctx:i,properties:o}=this,{segmentation:s}=o,a=s.spacing??0,n=i.animationManager.isSkipped(),r=this.getShapeFillBBox();t.each((l,c)=>{const{centerX:h,centerY:p,innerRadius:u,outerRadius:g,startCornerRadius:y,endCornerRadius:f}=c;l.centerX=h,l.centerY=p,l.innerRadius=u,l.outerRadius=g,l.pointerEvents=this.properties.bar.enabled?Qs.PointerEvents.All:Qs.PointerEvents.None,nh(l,c.style,r),l.startOuterCornerRadius=y,l.startInnerCornerRadius=y,l.endOuterCornerRadius=f,l.endInnerCornerRadius=f,l.radialEdgeInset=(a+l.strokeWidth)/2,l.concentricEdgeInset=l.strokeWidth/2,(n||l.previousDatum==null)&&l.setProperties($u(l,c))}),this.datumUnion.update(t,this.itemGroup,Qs.Sector,(l,c,h)=>{l.clipSector??(l.clipSector=new GK(Number.NaN,Number.NaN,Number.NaN,Number.NaN)),l.centerX=c.centerX,l.centerY=c.centerY,l.outerRadius=l.clipSector.outerRadius=c.outerRadius,l.innerRadius=l.clipSector.innerRadius=c.innerRadius,l.startAngle=l.clipSector.startAngle=c.startAngle,l.startInnerCornerRadius=c.startInnerCornerRadius,l.startOuterCornerRadius=c.startOuterCornerRadius,l.endAngle=h.endAngle,l.clipSector.endAngle=h.clipSector?.endAngle??h.endAngle,l.endInnerCornerRadius=h.endInnerCornerRadius,l.endOuterCornerRadius=h.endOuterCornerRadius,l.pointerEvents=Qs.PointerEvents.None})}updateScaleSelection(e){return e.scaleSelection.update(e.scaleData,void 0,t=>ju(e.scaleData.length,t.itemId))}updateScaleNodes(e){const{scaleSelection:t}=e,{segmentation:i}=this.properties,o=i.spacing??0,s=this.getShapeFillBBox();t.each((a,n)=>{const{centerX:r,centerY:l,innerRadius:c,outerRadius:h,startCornerRadius:p,endCornerRadius:u}=n;a.centerX=r,a.centerY=l,a.innerRadius=c,a.outerRadius=h,nh(a,n.style,s),a.startOuterCornerRadius=p,a.startInnerCornerRadius=p,a.endOuterCornerRadius=u,a.endInnerCornerRadius=u,a.radialEdgeInset=(o+a.strokeWidth)/2,a.concentricEdgeInset=a.strokeWidth/2,a.setProperties($u(a,n))})}updateNeedleSelection(e){return e.needleSelection.update(e.needleData,void 0,()=>ju(0))}updateNeedleNodes(e){const{needleSelection:t}=e,{fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:n,lineDash:r,lineDashOffset:l}=this.properties.needle,c=this.ctx.animationManager.isSkipped();t.each((h,p)=>{const{centerX:u,centerY:g,radius:y}=p,f=y*2;h.d=Fu.defaultPathData,nh(h,{fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:n/f,lineDash:r.map(x=>x/f),lineDashOffset:l/f}),h.translationX=u,h.translationY=g,h.scalingX=f,h.scalingY=f,c&&h.setProperties(ok(h,p))})}updateTargetSelection(e){return e.targetSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetStyles({targetSelection:e,isHighlight:t}){e.each((i,o)=>{o.style=this.getTargetStyle(t,o)})}updateTargetNodes({targetSelection:e}){e.each((t,i)=>{const{centerX:o,centerY:s,angle:a,radius:n,shape:r,size:l,rotation:c}=i;nh(t,i.style),t.size=l,t.shape=r==="line"?yb:r,t.translationX=o+n*Math.cos(a),t.translationY=s+n*Math.sin(a),t.rotation=a+c})}getTargetStyle(e,{datumIndex:t,style:i}){const o=this.getHighlightStyle(e,t);return jK(o,{...i,opacity:1})}updateTargetLabelSelection(e){return e.targetLabelSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetLabelNodes(e){const{targetLabelSelection:t}=e;t.each((i,o)=>{const{centerX:s,centerY:a,radius:n,angle:r,text:l}=o,{offsetX:c,offsetY:h,fill:p,fontStyle:u,fontWeight:g,fontSize:y,fontFamily:f,textAlign:x,textBaseline:S}=o.label;if(l==null){i.visible=!1;return}i.visible=!0,i.x=s+n*Math.cos(r)+c,i.y=a+n*Math.sin(r)+h,i.text=l,i.fill=p,i.fontStyle=u,i.fontWeight=g,i.fontSize=y,i.fontFamily=f,i.textAlign=x,i.textBaseline=S})}updateLabelSelection(e){return e.labelSelection.update(e.labelData,void 0,t=>t.label)}updateLabelNodes(e){const{labelSelection:t}=e,i=this.ctx.animationManager.isSkipped();t.each((o,s)=>{o.fill=s.fill,o.fontStyle=s.fontStyle,o.fontWeight=s.fontWeight,o.fontFamily=s.fontFamily}),(i||this.labelsHaveExplicitText())&&this.formatLabelText()}updateTickSelection(e){return e.tickSelection.update(e.tickData,void 0,t=>t.index)}updateTickNodes(e){const{scale:t,radius:i,centerX:o,centerY:s,properties:a}=this,{enabled:n,color:r,fontFamily:l,fontSize:c,fontStyle:h,fontWeight:p,spacing:u}=a.scale.label,g=sh(a.scale.label.rotation??0);e.tickSelection.each((y,f)=>{if(!n){y.visible=!1;return}y.visible=!0,y.text=f.text,y.fill=r,y.fontFamily=l,y.fontSize=c,y.fontStyle=h,y.fontWeight=p,y.textAlign="center",y.textBaseline="middle";const x=t.convert(f.value),{width:S,height:v}=f,m=Math.abs(i*Math.cos(x)),b=Math.abs(i*Math.sin(x)),k=Math.min(Math.max(Math.abs(i/Math.tan(x)),m-S/2),m+S/2),A=Math.min(Math.max(Math.abs(i*Math.tan(x)),b-v/2),b+v/2),M=Math.hypot(k,A),D=o+(M+u)*Math.cos(x),L=s+(M+u)*Math.sin(x);y.x=D,y.y=L,y.rotationCenterX=D,y.rotationCenterY=L,y.rotation=g})}labelsHaveExplicitText(){for(const{datum:e}of this.labelSelection)if(e.text==null)return!1;return!0}formatLabelText(e){const{labelSelection:t,radius:i,textAlign:o,verticalAlign:s}=this,{spacing:a,innerRadiusRatio:n}=this.properties;BK(this,this.ctx,t,{padding:a,textAlign:o,verticalAlign:s},i*n,e)}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),sk([this.datumSelection],$u),sk([this.needleSelection],ok),this.formatLabelText()}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}animateLabelText(e={}){const{animationManager:t}=this.ctx;let i,o,s,a;if(this.labelSelection.each((n,r)=>{n.opacity=1,r.label==="primary"?(i=n.previousDatum?.value??e.from??r.value,o=r.value):r.label==="secondary"&&(s=n.previousDatum?.value??e.from??r.value,a=r.value)}),!this.labelsHaveExplicitText())if(o==null||a==null)this.formatLabelText();else if(i===o&&s===a)this.formatLabelText({label:o,secondaryLabel:a});else{const n=`${this.id}_labels`;t.animate({id:n,groupId:"label",from:{label:i,secondaryLabel:s},to:{label:o,secondaryLabel:a},phase:e.phase??"update",onUpdate:r=>this.formatLabelText(r),onStop:()=>this.formatLabelText({label:o,secondaryLabel:a})})}}animateEmptyUpdateReady(){const{animationManager:e}=this.ctx,{node:t,needle:i}=ik(!0,this.scale.range[0]);pr(this.id,"node",e,[this.datumSelection],t,(o,s)=>s.itemId),pr(this.id,"needle",e,[this.needleSelection],i,()=>"needle"),pr(this.id,"label",e,[this.labelSelection],ub,(o,s)=>s.label),this.animateLabelText({from:this.properties.scale.min,phase:"initial"})}animateWaitingUpdateReady(){const{animationManager:e}=this.ctx,{node:t,needle:i}=ik(!1,this.scale.range[0]);pr(this.id,"node",e,[this.datumSelection],t,(o,s)=>s.itemId),pr(this.id,"needle",e,[this.needleSelection],i,()=>"needle"),this.animateLabelText()}animateReadyResize(){this.resetAllAnimation()}dataCount(){return Number.NaN}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}getLegendData(){return[]}getTooltipContent(e){const{id:t,properties:i}=this,{tooltip:o}=i;let s,a,n;if(e.type===0?(s=i.value,a=i.label.text,n=this.ctx.localeManager.t("ariaLabelGaugeValue")):({value:s,text:a}=i.targets[e.index],n=this.ctx.localeManager.t("ariaLabelGaugeTarget")),s!=null)return this.formatTooltipWithContext(o,{data:[{label:a,fallbackLabel:n,value:this.formatLabel(s)}]},{seriesId:t,title:void 0,datum:void 0,value:s})}pickNodeClosestDatum(e){return mb(this,e)}pickFocus(e){return xb(this,e)}getCaptionText(){const{value:e}=this.properties,t=[];return t.push(this.formatLabel(e)),this.labelSelection.each((i,o)=>{const s=Jn(this.id,this.ctx,o);s!=null&&t.push(SK(s))}),t.join(". ")}getCategoryValue(e){}datumIndexForCategoryValue(e){}hasItemStylers(){return this.properties.label.itemStyler!=null}};rh.className="RadialGaugeSeries",rh.type="radial-gauge";var{FONT_SIZE_RATIO:ZK}=an,qK={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"radial-gauge",moduleFactory:e=>new rh(e),themeTemplate:{minWidth:200,minHeight:200,tooltip:{enabled:!1},series:{outerRadiusRatio:1,innerRadiusRatio:.8,startAngle:270,endAngle:450,defaultColorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$interpolate:[{$palette:"secondDivergingColors"},5]},an.SAFE_RANGE2_OPERATION]},scale:{defaultFill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/2",an.SAFE_STROKE_FILL_OPERATION,{$palette:"hierarchyColors"}]},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:12}},bar:{strokeWidth:{$isUserOption:["./stroke",2,0]}},segmentation:{enabled:!1,interval:{},spacing:2},defaultTarget:{fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},size:10,shape:"triangle",placement:"outside",spacing:5,label:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:5}},needle:{enabled:!1,fill:{$ref:"foregroundColor"},spacing:10},label:{...an.LABEL_BOXING_DEFAULTS,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:56,minimumFontSize:18/56,fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}},secondaryLabel:{...an.LABEL_BOXING_DEFAULTS,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:ZK.LARGE},minimumFontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"subtleTextColor"}},tooltip:{range:{$path:["/tooltip/range",10]}}}}},QK={type:"series",name:"radial-gauge",chartType:"standalone",enterprise:!0,options:an.radialGaugeSeriesOptionsDef,create:e=>new rh(e)};import{_ModuleSupport as nn}from"ag-charts-community";import{_ModuleSupport as JK}from"ag-charts-community";import{Logger as e4,cachedTextMeasurer as t4,calcLineHeight as i4,toPlainText as o4,wrapText as Yu}from"ag-charts-core";import{_ModuleSupport as s4}from"ag-charts-community";import{clamp as a4}from"ag-charts-core";var{BBox:n4,Path:r4,Vec2:st,SceneChangeDetection:rn}=s4,Js=class extends r4{constructor(){super(...arguments),this.x1=0,this.x2=0,this.y1=0,this.y2=0,this.height=0,this.inset=0,this.elbows=[]}computeBBox(){const e=Math.min(this.x1,this.x2),t=Math.max(this.x1,this.x2)-e,i=Math.min(this.y1,this.y2),o=Math.max(this.y1,this.y2)-i+this.height;return new n4(e,i,t,o)}updatePath(){const{path:e,inset:t}=this;e.clear();const i=this.height-2*this.inset,o=i/2;let s=this.x1+t,a=this.y1+t;e.moveTo(s,a);for(const l of this.elbows)this.updatePathSection(s,a,l.x,l.y,i,-o),s=l.x,a=l.y;const n=this.x2-t,r=this.y2+t;this.updatePathSection(s,a,n,r,i,-o),e.lineTo(n,r+i),s=n,a=r;for(const l of this.elbows.toReversed())this.updatePathSection(s,a,l.x,l.y,i,o),s=l.x,a=l.y;this.updatePathSection(s,a,this.x1+t,this.y1+t,i,o),e.closePath()}updatePathSection(e,t,i,o,s,a){const{path:n}=this,r=st.from(e,t+a+s/2),l=st.from(i,o+a+s/2);if(Math.abs(l.y-r.y)<2){n.lineTo(l.x,l.y);return}let c=st.angle(st.sub(l,r));c<0&&(c=2*Math.PI+c);const h=0,p=Math.PI/2,u=Math.PI,g=Math.PI*1.5,y=lk(r,l,0),f=lk(r,l,s);if(y.radius=g?(n.arc(r.x,t-y.radius,y.radius,p,p+f.angle,!0),n.arc(l.x,o+f.radius,f.radius,g+f.angle,g),n.lineTo(l.x,l.y)):c>h&&c<=p?(n.arc(r.x,t+f.radius,f.radius,g,g+f.angle),n.arc(l.x,o-y.radius,y.radius,p+y.angle,p,!0),n.lineTo(l.x,l.y)):c>p&&c<=u?(n.arc(r.x,t+f.radius,f.radius-s,g,g+f.angle,!0),n.arc(l.x,o-y.radius,y.radius+s,p+y.angle,p),n.lineTo(l.x,l.y)):(n.arc(r.x,t-y.radius,y.radius+s,p,p+y.angle),n.arc(l.x,o+f.radius,f.radius-s,g+f.angle,g,!0),n.lineTo(l.x,l.y))}};d([rn()],Js.prototype,"x1",2),d([rn()],Js.prototype,"x2",2),d([rn()],Js.prototype,"y1",2),d([rn()],Js.prototype,"y2",2),d([rn()],Js.prototype,"height",2),d([rn()],Js.prototype,"inset",2);function lk(e,t,i){const o=st.angle(st.sub(t,e)),s=st.distance(e,t),a=st.add(e,st.rotate(st.from(s/2,0),o)),n=-1/st.gradient(e,t),r=st.intercept(a,n),l=l4(.1,.5,Math.PI/2-Math.abs(st.gradient(e,t))),c=st.intersectAtX(n,r,e.x),h=Math.max(i,st.distance(e,c)*l);return{angle:st.angle(st.sub(c,e),st.sub(c,a))/-(1.1-l),radius:h}}function l4(e,t,i){return a4(e,(t-e)*i+e,t)}import{_ModuleSupport as c4}from"ag-charts-community";var{BaseProperties:ck,FillGradientDefaults:h4,FillPatternDefaults:d4,FillImageDefaults:p4,makeSeriesTooltip:u4,SeriesProperties:g4,Property:te,Label:y4}=c4,lh=class extends y4{constructor(){super(...arguments),this.spacing=1,this.placement=void 0,this.edgePlacement=void 0}};d([te],lh.prototype,"spacing",2),d([te],lh.prototype,"placement",2),d([te],lh.prototype,"edgePlacement",2);var Io=class extends ck{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}};d([te],Io.prototype,"fill",2),d([te],Io.prototype,"fillOpacity",2),d([te],Io.prototype,"stroke",2),d([te],Io.prototype,"strokeOpacity",2),d([te],Io.prototype,"strokeWidth",2),d([te],Io.prototype,"lineDash",2),d([te],Io.prototype,"lineDashOffset",2),d([te],Io.prototype,"itemStyler",2);var Tt=class extends ck{constructor(){super(...arguments),this.spacing=1,this.minSpacing=0,this.width=1,this.alignment="justify",this.verticalAlignment="center",this.sort="auto",this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}};d([te],Tt.prototype,"spacing",2),d([te],Tt.prototype,"minSpacing",2),d([te],Tt.prototype,"width",2),d([te],Tt.prototype,"alignment",2),d([te],Tt.prototype,"verticalAlignment",2),d([te],Tt.prototype,"sort",2),d([te],Tt.prototype,"fill",2),d([te],Tt.prototype,"fillOpacity",2),d([te],Tt.prototype,"stroke",2),d([te],Tt.prototype,"strokeOpacity",2),d([te],Tt.prototype,"strokeWidth",2),d([te],Tt.prototype,"lineDash",2),d([te],Tt.prototype,"lineDashOffset",2),d([te],Tt.prototype,"itemStyler",2);var Be=class extends g4{constructor(){super(),this.nodes=void 0,this.idKey="",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.sizeKey=void 0,this.sizeName=void 0,this.fillGradientDefaults=new h4,this.fillPatternDefaults=new d4,this.fillImageDefaults=new p4,this.defaultColorRange=[],this.defaultPatternFills=[],this.fills=[],this.strokes=[],this.label=new lh,this.link=new Io,this.node=new Tt,this.tooltip=u4(),this.highlightStyle.deprecated=!1}getStyle(e,t,i,o){const{fillOpacity:s,strokeWidth:a,strokeOpacity:n,lineDash:r,lineDashOffset:l,fill:c=t[o%t.length],stroke:h=i[o%t.length]}=e?this.link:this.node;return{fill:c,fillOpacity:s,stroke:h,strokeWidth:a,strokeOpacity:n,lineDash:r,lineDashOffset:l}}};d([te],Be.prototype,"nodes",2),d([te],Be.prototype,"fromKey",2),d([te],Be.prototype,"toKey",2),d([te],Be.prototype,"idKey",2),d([te],Be.prototype,"idName",2),d([te],Be.prototype,"labelKey",2),d([te],Be.prototype,"labelName",2),d([te],Be.prototype,"sizeKey",2),d([te],Be.prototype,"sizeName",2),d([te],Be.prototype,"fillGradientDefaults",2),d([te],Be.prototype,"fillPatternDefaults",2),d([te],Be.prototype,"fillImageDefaults",2),d([te],Be.prototype,"defaultColorRange",2),d([te],Be.prototype,"defaultPatternFills",2),d([te],Be.prototype,"fills",2),d([te],Be.prototype,"strokes",2),d([te],Be.prototype,"label",2),d([te],Be.prototype,"link",2),d([te],Be.prototype,"node",2),d([te],Be.prototype,"tooltip",2);var{Transformable:f4,applyShapeStyle:hk,SeriesNodePickMode:dk,createDatumId:ch,getShapeStyle:pk,getLabelStyles:m4,Rect:uk,BBox:gk,mergeDefaults:hh}=JK,dh=class extends FS{constructor(e){super({moduleCtx:e,pickModes:[dk.NEAREST_NODE,dk.EXACT_SHAPE_MATCH]}),this.properties=new Be}isLabelEnabled(){return(this.properties.labelKey!=null||this.nodes==null)&&this.properties.label.enabled}linkFactory(){return new Js}nodeFactory(){return new uk}createNodeData(){const{id:e,_nodeDataDependencies:{seriesRectWidth:t,seriesRectHeight:i}={seriesRectWidth:0,seriesRectHeight:0}}=this,{fromKey:o,toKey:s,sizeKey:a,labelKey:n,label:{spacing:r,placement:l,edgePlacement:c},node:{width:h,alignment:p}}=this.properties,u=T=>({...T,x:Number.NaN,y:Number.NaN,width:h,height:Number.NaN}),g=T=>({...T,x1:Number.NaN,x2:Number.NaN,y1:Number.NaN,y2:Number.NaN,height:Number.NaN,elbows:[]}),{nodeGraph:y,links:f,maxPathLength:x}=this.getNodeGraph(u,g,{includeCircularReferences:!1}),S=y;if(S.size===0)return;const v=[];for(let T=0;TG+K.size,0),I.reduce((G,{link:K})=>G+K.size,0));if(C.length===0&&I.length===0||B===0){T.columnIndex=-1;continue}let H;switch(p){case"left":H=v[O];break;case"right":H=v[x-1-z];break;case"center":{if(C.length!==0)H=v[O];else if(I.length===0)H=v[0];else{const G=I.reduce((K,Q)=>Math.min(K,Q.node.maxPathLengthBefore),x)-1;H=v[G]}break}case"justify":{H=I.length===0?v[x-1]:v[O];break}}w.size=B;const{label:W}=this.properties,V=W.enabled?this.getLabelText(w.label,w.datum,n,"label",[],this.properties.label,{datum:w.datum,value:w.label,fromKey:o,toKey:s,sizeKey:a,size:B}):void 0;w.label=o4(V),H.nodes.push(T),H.size+=B,T.columnIndex=H.index}const m=t4(this.properties.label);let b=0,k=0;if(this.isLabelEnabled()){if(l==null&&c==null)b=(t-h)*(1-x/(x+1)),k=b;else if(c==="outside"||c==null){const T=(w,C)=>{const I=C;if(I.datum.label==null||I.datum.label==="")return w;let O=(t-h)/(x-1)-r;l==="center"&&c==null&&(O/=2);const z=Yu(I.datum.label,{maxWidth:O,maxHeight:I.datum.height,font:this.properties.label,textWrap:"never"});let{width:B}=m.measureLines(z);return l==="center"&&c==null&&(B/=2),Math.max(w,B)};(l!=="right"||c==="outside")&&(b=h+v[0].nodes.reduce(T,0)),(l!=="left"||c==="outside")&&(k=h+v.at(-1).nodes.reduce(T,0))}}const A=(t-h-b-k)/(x-1);for(let T=0;TT.columnIndex;O--){const z=C.link.size,B={ghost:!0,datum:{...T.datum,size:z,y:0,height:0},weight:0,linksBefore:[{node:{columnIndex:O-1,datum:{size:z}}}],linksAfter:[{node:{columnIndex:O+1,datum:{size:z}}}],link:C.link,columnIndex:T.columnIndex,size:T.datum.size,closestColumnDiff:w,fromNode:{y:I.datum.y},toNode:{y:0}};v[O].size+=z,v[O].nodes.push(B)}}}const M=v.toSorted((T,w)=>{const C=T.nodes.reduce((O,z)=>Math.max(O,z.datum.size),0);return w.nodes.reduce((O,z)=>Math.max(O,z.datum.size),0)-C}),D={};for(let T=0;T{if(I.node.columnIndex!==T.index-1)return C;const O=I.node.datum.size/v[I.node.columnIndex].size*D[I.node.columnIndex];return Math.max(C,O)},0),w.weight+=w.linksAfter.reduce((C,I)=>{if(I.node.columnIndex!==T.index+1)return C;const O=I.node.datum.size/v[I.node.columnIndex].size*D[I.node.columnIndex];return Math.max(C,O)},0)}T.nodes.sort((w,C)=>this.sortNodes(w,C))}const L=1,N=T=>v.reduce((w,{size:C,nodes:I})=>{const O=i-I.length*L,B=(1-(I.length-1)*T/O)/C;return Math.min(w,B)},1/0);let P=this.properties.node.spacing,R=N(P);for(;R<0&&P>this.properties.node.minSpacing;)P-=1,R=N(P);if(R<0){e4.warnOnce("There was insufficient space to display the Sankey Series. Reduce [node.spacing], [node.minSpacing], or provide a larger container.");return}for(const T of v){let w=0;for(const O of T.nodes){const z=i*O.datum.size*R;O.datum.height=Math.max(L,z),w+=z}const C=P*(T.nodes.length-1);let I=0;this.properties.node.verticalAlignment==="bottom"?I=i-w-C:this.properties.node.verticalAlignment==="center"&&(I=(i-w-C)/2);for(const O of T.nodes)O.datum.y=I,I+=i*O.datum.size*R+P,"ghost"in O&&O.ghost&&O.link.elbows.push({x:T.x,y:O.datum.y})}for(const{datum:T,linksBefore:w,linksAfter:C}of S.values()){let I=T.y;w.sort((z,B)=>this.sortNodes(z.node,B.node));for(const{link:z}of w)z.y2=I,I+=z.size*i*R;let O=T.y;C.sort((z,B)=>this.sortNodes(z.node,B.node,{invertColumnSort:!0}));for(const{link:z}of C)z.y1=O,O+=z.size*i*R}const F=[],_=[],{fontSize:E}=this.properties.label;for(const[T,w]of v.entries()){const C=T===0,I=T===v.length-1;let O=-1/0;w.nodes.sort((z,B)=>z.datum.y-B.datum.y);for(const z of w.nodes){if("ghost"in z&&z.ghost)continue;const{datum:B}=z;if(B.midPoint={x:B.x+B.width/2,y:B.y+B.height/2},F.push(B),B.label==null)continue;const H=B.y+B.height/2;let W;if(!C&&!I){const J=i4(E),ie=H-J,U=H+J;let he=t;for(const{datum:Z}of S.values())Z.x>B.x&&Math.max(Z.y,ie)<=Math.min(Z.y+Z.height,U)&&(he=Math.min(he,Z.x-r));const ne=he-B.x-2*r;W=Yu(B.label,{maxWidth:ne,maxHeight:B.height,font:this.properties.label,textWrap:"never",overflow:"hide"})}if(W==null||W===""){const J=c==null&&(C||I)?r:r*2;W=Yu(B.label,{maxWidth:A-J,maxHeight:B.height,font:this.properties.label,textWrap:"never"})}if(W==="")continue;const{height:V}=m.measureLines(W),G=H-V/2,K=H+V/2;let Q=B.x+B.width+r,X="left",Y=l;C&&c==null&&l==null&&(Y="left"),c==="outside"?(C&&(Y="left"),I&&(Y="right")):c==="inside"&&(C&&(Y="right"),I&&(Y="left")),Y==="left"?(Q=B.x-r,X="right"):Y==="center"&&(Q=B.x+B.width/2,X="center"),G>=O&&(_.push({x:Q,y:H,textAlign:X,text:W,size:B.size}),O=K)}}for(const T of f){const{fromNode:w,toNode:C,size:I}=T;T.height=Math.max(L,i*I*R),T.x1=w.x+h,T.x2=C.x,T.midPoint={x:(T.x1+T.x2)/2,y:(T.y1+T.y2)/2+T.height/2},F.push(T)}return{itemId:e,nodeData:F,labelData:_}}sortNodes(e,t,i){const{properties:o}=this;return o.node.sort==="ascending"?(e.datum.label??"").localeCompare(t.datum.label??""):o.node.sort==="descending"?(t.datum.label??"").localeCompare(e.datum.label??""):o.node.sort==="data"?0:e.columnIndext.columnIndex?i?.invertColumnSort?-1:1:e.weight===t.weight?e.datum.size-t.datum.size:e.closestColumnDifft.closestColumnDiff?-1:e.weight-t.weight}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,o)=>{const{x:s,y:a,textAlign:n,text:r}=o,c=m4(this,void 0,o,this.properties.label,!1,t),{color:h,fontStyle:p,fontWeight:u,fontSize:g,fontFamily:y}=c;i.visible=!0,i.x=s,i.y=a,i.text=r,i.fill=h,i.fontStyle=p,i.fontWeight=u,i.fontSize=g,i.fontFamily=y,i.textAlign=n,i.textBaseline="middle",i.setBoxing(c)})}updateNodeSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>ch(t.type,t.id))}getNodeStyle(e,t,i){const{properties:o}=this,{fills:s,strokes:a,defaultColorRange:n,defaultPatternFills:r,fillGradientDefaults:l,fillPatternDefaults:c,fillImageDefaults:h}=o,{itemStyler:p}=o.node,u=n[t%n.length].map(v=>({color:v})),g=r[t%r.length],y=this.getHighlightStyle(i,e.datumIndex),f=hh(y,o.getStyle(!1,s,a,t)),x=o.node.fill!=null;let S=pk(f,x?l:{...l.toJson(),colorStops:u},x?c:{...c.toJson(),fill:g,stroke:g},h);if(p!=null&&e.datumIndex!=null){const v=this.cachedDatumCallback(ch(e.datumIndex.index,"node",i?"highlight":"node"),()=>{const m=this.makeItemStylerParams(e,i,S);return this.callWithContext(p,m)});v&&(S=hh(v,S,{...l.toJson(),colorStops:u},{...c.toJson(),fill:g,stroke:g},h))}return S.opacity=1,S}makeItemStylerParams({datum:e,datumIndex:t,size:i=0,label:o},s,a){const{id:n}=this,r=this.ctx.highlightManager?.getActiveHighlight(),l=this.getHighlightStateString(r,s,t),c=this.filterItemStylerFillParams(a.fill)??a.fill;return{seriesId:n,datum:e,highlighted:s,highlightState:l,...a,size:i,label:o,fill:c}}updateNodeNodes(e){const{datumSelection:t,isHighlight:i}=e,o=this.getShapeFillBBox();t.each((s,a)=>{const{datumIndex:n}=a,r=this.getNodeStyle(a,n.index,i);s.x=a.x,s.y=a.y,s.width=Math.max(a.width,0),s.height=Math.max(a.height,0),hk(s,r,o)})}getShapeFillBBox(){const e=this._nodeDataDependencies?.seriesRectWidth??0,t=this._nodeDataDependencies?.seriesRectHeight??0,i=new gk(0,0,e,t);return{series:i,axis:i}}updateLinkSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>ch(t.type,t.index,t.fromNode.id,t.toNode.id))}getLinkStyle({datumIndex:e,datum:t},i,o){const{id:s,properties:a}=this,{fills:n,strokes:r,defaultColorRange:l,defaultPatternFills:c,fillGradientDefaults:h,fillPatternDefaults:p,fillImageDefaults:u}=a,{itemStyler:g}=a.link,y=l[i.index%l.length].map(b=>({color:b})),f=c[i.index%c.length],x=this.getHighlightStyle(o,e),S=hh(x,a.getStyle(!0,n,r,i.index)),v=a.link.fill!=null;let m=pk(S,v?h:{...h.toJson(),colorStops:y},v?p:{...p.toJson(),fill:f,stroke:f},u);if(g!=null&&e!=null){const b=this.cachedDatumCallback(ch(e.index,"link",o?"highlight":"node"),()=>{const k=this.ctx.highlightManager?.getActiveHighlight(),A=this.getHighlightStateString(k,o,e);return this.callWithContext(g,{seriesId:s,datum:t,highlighted:o,highlightState:A,...m})});b&&(m=hh(b,m,{...h.toJson(),colorStops:y},{...p.toJson(),fill:f,stroke:f},u))}return m.opacity=1,m}updateLinkNodes(e){const{datumSelection:t,isHighlight:i}=e,o=this.getShapeFillBBox();t.each((s,a)=>{const n=a.fromNode.datumIndex,r=this.getLinkStyle(a,n,i);s.x1=a.x1,s.y1=a.y1,s.x2=a.x2,s.y2=a.y2,s.height=a.height,s.elbows=a.elbows,hk(s,r,o),s.inset=s.strokeWidth/2})}getTooltipContent(e){const{id:t,linksProcessedData:i,nodesProcessedData:o,properties:s,ctx:{formatManager:a}}=this,{fromKey:n,toKey:r,sizeKey:l,sizeName:c,tooltip:h}=s,p=this.contextNodeData?.nodeData.find(v=>v.datumIndex.type===e.type&&v.datumIndex.index===e.index);if(p==null)return;const u=p.type===0?p.fromNode.index:p.index,g=p.type===0?`${p.fromNode.label} - ${p.toNode.label}`:p.label,y=e.type===0?i?.dataSources.get(this.id)?.data[e.index]:o?.dataSources.get(this.id)?.data[e.index],f=p.size;let x;if(p.type===0){const v=p.fromNode.datumIndex;x=this.getLinkStyle({datumIndex:e,datum:y},v,!1)}else x=this.getNodeStyle({datumIndex:e,datum:y},e.index,!1);const S=[];if(l!=null){const v=a.format(this.callWithContext.bind(this),{type:"number",value:f,datum:y,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",domain:[],boundSeries:this.getFormatterContext("size"),fractionDigits:void 0});S.push({label:c,fallbackLabel:l,value:v??String(f)})}return this.formatTooltipWithContext(h,{title:g,symbol:this.legendItemSymbol(p.type,u,x),data:S},{seriesId:t,datum:y,title:g,fromKey:n,toKey:r,sizeKey:l,sizeName:c,size:f,...x})}computeFocusBounds(e){if(e instanceof uk){const{x:t,y:i,width:o,height:s}=e,a=new gk(t,i,o,s);return f4.toCanvas(this.contentGroup,a)}return e}hasItemStylers(){return this.properties.node.itemStyler!=null||this.properties.link.itemStyler!=null||this.properties.label.itemStyler!=null}};dh.className="SankeySeries",dh.type="sankey";import{_ModuleSupport as x4}from"ag-charts-community";import{arrayOf as Uu,color as yk,constant as S4,fillGradientDefaults as b4,fillImageDefaults as v4,fillPatternDefaults as k4,required as Xu,string as ph,undocumented as ur}from"ag-charts-core";var{commonSeriesOptionsDefs:D4,sankeySeriesThemeableOptionsDef:M4}=x4,ln={...M4,...D4,type:Xu(S4("sankey")),fromKey:Xu(ph),toKey:Xu(ph),sizeKey:ph,sizeName:ph};ln.fillGradientDefaults=ur(b4),ln.fillPatternDefaults=ur(k4),ln.fillImageDefaults=ur(v4),ln.defaultColorRange=ur(Uu(Uu(yk))),ln.defaultPatternFills=ur(Uu(yk));var A4={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],solo:!0,identifier:"sankey",moduleFactory:e=>new dh(e),themeTemplate:{seriesArea:{padding:{top:10,bottom:10}},series:{fills:{$palette:"fills"},strokes:{$palette:"strokes"},fillGradientDefaults:nn.FILL_GRADIENT_LINEAR_DEFAULTS,fillPatternDefaults:nn.FILL_PATTERN_DEFAULTS,fillImageDefaults:nn.FILL_IMAGE_DEFAULTS,defaultColorRange:{$palette:"gradients"},defaultPatternFills:nn.SAFE_FILLS_OPERATION,highlightStyle:{series:{dimOpacity:.2}},highlight:{...nn.singleSeriesHighlightStyle()},label:{...nn.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:10},node:{spacing:{$if:[{$greaterThan:[{$path:"./minSpacing"},20]},{$path:"./minSpacing"},20]},minSpacing:0,width:10,strokeWidth:{$isUserOption:["./stroke",2,0]}},link:{fillOpacity:.5,strokeWidth:{$isUserOption:["./stroke",2,0]}}},legend:{enabled:!1,toggleSeries:!1}}},I4={type:"series",name:"sankey",chartType:"standalone",enterprise:!0,options:ln,create:e=>new dh(e)};import{_ModuleSupport as ea}from"ag-charts-community";import{_ModuleSupport as gr}from"ag-charts-community";import{toPlainText as fk}from"ag-charts-core";import{_ModuleSupport as L4}from"ag-charts-community";var{HierarchySeriesProperties:T4,HighlightStyle:C4,makeSeriesTooltip:N4,Property:ze}=L4,rs=class extends C4{constructor(){super(!1),this.label=new $i,this.secondaryLabel=new $i}};d([ze],rs.prototype,"fill",2),d([ze],rs.prototype,"fillOpacity",2),d([ze],rs.prototype,"stroke",2),d([ze],rs.prototype,"strokeWidth",2),d([ze],rs.prototype,"strokeOpacity",2),d([ze],rs.prototype,"label",2),d([ze],rs.prototype,"secondaryLabel",2);var Ct=class extends T4{constructor(){super(...arguments),this.fillOpacity=1,this.strokeWidth=0,this.strokeOpacity=1,this.cornerRadius=0,this.highlightStyle=new rs,this.label=new $i,this.secondaryLabel=new zn,this.tooltip=N4()}getStyle(e){const{fills:t,strokes:i,fillOpacity:o,strokeWidth:s,strokeOpacity:a}=this;return{fill:t[e%t.length],fillOpacity:o,stroke:i[e%i.length],strokeWidth:s,strokeOpacity:a,opacity:1}}};d([ze],Ct.prototype,"sizeName",2),d([ze],Ct.prototype,"labelKey",2),d([ze],Ct.prototype,"secondaryLabelKey",2),d([ze],Ct.prototype,"fillOpacity",2),d([ze],Ct.prototype,"strokeWidth",2),d([ze],Ct.prototype,"strokeOpacity",2),d([ze],Ct.prototype,"cornerRadius",2),d([ze],Ct.prototype,"sectorSpacing",2),d([ze],Ct.prototype,"padding",2),d([ze],Ct.prototype,"itemStyler",2),d([ze],Ct.prototype,"highlightStyle",2),d([ze],Ct.prototype,"label",2),d([ze],Ct.prototype,"secondaryLabel",2),d([ze],Ct.prototype,"tooltip",2);var{fromToMotion:w4,normalizeAngle360:P4,createDatumId:O4,PointerEvents:_4,Sector:mk,Group:uh,ScalableGroup:R4,Selection:Zu,TransformableText:qu,BBox:xk,applyShapeStyle:E4,mergeDefaults:Sk,formatValue:bk,getLabelStyles:B4}=gr,z4=class extends gr.HierarchyNode{constructor(){super(...arguments),this.label=void 0,this.secondaryLabel=void 0,this.contentHeight=0,this.bbox=void 0,this.startAngle=0,this.endAngle=0}};function vk(e,t=0,i=2*Math.PI/e.sumSize){for(const o of e.children){const s=t+o.sumSize*i;o.startAngle=t,o.endAngle=s,vk(o,t,i),t=s}}var gh=class extends gr.HierarchySeries{constructor(e){super(e),this.NodeClass=z4,this.properties=new Ct,this.scalingGroup=this.contentGroup.appendChild(new R4),this.sectorGroup=this.scalingGroup.appendChild(new uh),this.sectorLabelGroup=this.scalingGroup.appendChild(new uh),this.highlightSectorGroup=this.scalingGroup.appendChild(new uh),this.datumSelection=Zu.select(this.sectorGroup,mk),this.labelSelection=Zu.select(this.sectorLabelGroup,uh),this.highlightSelection=Zu.select(this.highlightSectorGroup,mk),this.sectorLabelGroup.pointerEvents=_4.None}processData(){super.processData(),vk(this.rootNode)}updateSelections(){const e=this.ctx.highlightManager?.getActiveHighlight();if(this.highlightSelection.update(e==null?[]:[e],void 0,a=>this.getDatumId(a)),!this.nodeDataRefresh)return;this.nodeDataRefresh=!1;const{chart:t}=this;if(t==null||t.seriesRect==null)return;const o=Array.from(this.rootNode),s=a=>{a.append([new qu({tag:0}),new qu({tag:1})])};this.datumSelection.update(o,void 0,a=>this.getDatumId(a)),this.labelSelection.update(o,s,a=>this.getDatumId(a))}getItemStyle(e,t){const{properties:i,colorScale:o}=this,{itemStyler:s}=i,a=e.datumIndex?.[0]??0,n=t?i.highlightStyle:void 0,r=Sk(n,i.getStyle(a));!t&&e.colorValue!=null&&(r.fill=o.convert(e.colorValue));let l=r;if(s!=null&&e!=null){const c=this.cachedDatumCallback(O4(this.getDatumId(e),t?"highlight":"node"),()=>{const h=this.makeItemStylerParams(e,t,l);return this.callWithContext(s,h)});c&&(l=Sk(c,l))}return l}makeItemStylerParams(e,t,i){const{id:o}=this,s=this.ctx.highlightManager?.getActiveHighlight(),a=this.getHighlightStateString(s,t,e.datumIndex),n=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:o,datum:e.datum,depth:e.depth??0,highlighted:t,highlightState:a,...i,fill:n}}updateNodes(){const{chart:e,data:t,maxDepth:i}=this;if(e==null||t==null)return;const{width:o,height:s}=e.seriesRect,{sectorSpacing:a=0,padding:n=0,cornerRadius:r,childrenKey:l,colorKey:c,colorName:h,labelKey:p,secondaryLabelKey:u,sizeKey:g,sizeName:y}=this.properties;this.contentGroup.translationX=o/2,this.contentGroup.translationY=s/2;const f=a*.5,x=Math.min(o,s)/2,S=x/(i+1),v=-Math.PI/2,m={series:new xk(-x,-x,2*x,2*x),axis:new xk(-x,-x,2*x,2*x)};this.rootNode?.walk(M=>{const{startAngle:D,endAngle:L}=M;if(M.depth!=null){const N=(D+L)/2+v,P=(M.depth+.5)*S;M.midPoint.x=Math.cos(N)*P,M.midPoint.y=Math.sin(N)*P}}),this.rootNode?.walk(M=>{const{datum:D,depth:L,startAngle:N,endAngle:P,parent:R,sumSize:F}=M;M.label=void 0,M.secondaryLabel=void 0,M.contentHeight=0;let _;if(D!=null&&L!=null&&p!=null){const oe=D[p];_=this.getLabelText(oe,D,p,"label",[],this.properties.label,{depth:L,datum:D,childrenKey:l,colorKey:c,colorName:h,labelKey:p,secondaryLabelKey:u,sizeKey:g,sizeName:y,value:oe})}_===""&&(_=void 0);let E;if(D!=null&&L!=null&&u!=null){const oe=D[u];E=this.getLabelText(oe,D,u,"secondaryLabel",[],this.properties.secondaryLabel,{depth:L,datum:D,childrenKey:l,colorKey:c,colorName:h,labelKey:p,secondaryLabelKey:u,sizeKey:g,sizeName:y,value:oe})}if(E===""&&(E=void 0),L==null)return;const T=L*S+f,w=(L+1)*S-f,C=T>f?f/T:f,I=w>f?f/w:f,O=N+C,B=P+C-O,H=N+I,V=P+I-H,G=oe=>{if(L===0&&R?.sumSize===F)return{width:2*Math.sqrt(w**2-(oe*.5)**2),height:oe,meta:0};const ce=oe,me=2*Math.sqrt(w**2-(T+ce)**2),$e=B=_i?{width:Ht,height:ce,meta:1}:{width:_i,height:xi,meta:2}},K=sp(fk(_),this.properties.label,fk(E),this.properties.secondaryLabel,{padding:n},G);if(K==null)return;const{width:Q,height:X,meta:Y,label:J,secondaryLabel:ie}=K,U=v+(N+P)/2,he=Math.sin(U)>=0,ne=Math.cos(U)>=0,Z=(he?3:12)&(ne?6:9);let le;switch(Y){case 0:le=0;break;case 1:{const ge=w-(S-X)*.58,ce=Math.sqrt((w-n)**2-(Q/2)**2);le=Math.min(ge,ce);break}case 2:if(L===0){const oe=X/(2*Math.tan(B*.5))+Q*.5,ge=Math.sqrt(w**2-(X*.5)**2)-Q*.5;le=(oe+ge)*.5}else le=(T+w)*.5;break}if(J!=null){const{fontStyle:oe="normal",fontFamily:ge,fontWeight:ce="normal",color:me="black"}=this.properties.label;M.label={...J,fontStyle:oe,fontFamily:ge,fontWeight:ce,color:me,labelPlacement:Y,circleQuarter:Z,radius:le,theta:U}}if(ie!=null){const{fontStyle:oe="normal",fontFamily:ge,fontWeight:ce="normal",color:me="black"}=this.properties.secondaryLabel;M.secondaryLabel={...ie,fontStyle:oe,fontFamily:ge,fontWeight:ce,color:me,labelPlacement:Y,circleQuarter:Z,radius:le,theta:U}}M.contentHeight=K.height});const b=(M,D,L)=>{const{depth:N,startAngle:P,endAngle:R}=M;if(N==null){D.visible=!1;return}D.visible=!0;const F=this.getItemStyle(M,L),_=F.fill,E=F.strokeWidth,T=gr.isGradientFill(_)&&_.bounds!=="item"?m:void 0;E4(D,F,T),D.centerX=0,D.centerY=0,D.innerRadius=N*S,D.outerRadius=(N+1)*S,D.startAngle=P+v,D.endAngle=R+v,D.inset=f+E*.5,D.cornerRadius=r};this.datumSelection.each((M,D)=>{b(D,M,!1)}),this.highlightSelection.each((M,D)=>{b(D,M,!0)});const k=(M,D,L,N)=>{const{depth:P,contentHeight:R}=M,F=L===0,_=F?M.label:M.secondaryLabel;if(P==null||_==null){D.visible=!1;return}const{labelPlacement:E,circleQuarter:T,radius:w,theta:C}=_;let I;N&&(I=(F?this.properties.highlightStyle.label:this.properties.highlightStyle.secondaryLabel).color);const O={childrenKey:this.properties.childrenKey,colorKey:this.properties.colorKey,colorName:this.properties.colorName??this.properties.colorKey,depth:M.depth??Number.NaN,labelKey:this.properties.labelKey,secondaryLabelKey:this.properties.secondaryLabelKey,sizeKey:this.properties.sizeKey,sizeName:this.properties.sizeName??this.properties.sizeKey},z=F?this.properties.label:this.properties.secondaryLabel,B=this.ctx.highlightManager?.getActiveHighlight(),H=B4(this,M,O,z,N,B);switch(D.text=_.text,D.fontSize=_.fontSize,D.lineHeight=_.lineHeight,D.fontStyle=_.fontStyle,D.fontFamily=_.fontFamily,D.fontWeight=_.fontWeight,D.fill=I??_.color,D.fillOpacity=this.getHighlightStyle(N,M.datumIndex)?.opacity??1,D.setBoxing(H),E){case 0:D.textAlign="center",D.textBaseline="top",D.translationX=0,D.translationY=(F?0:R-_.height)-R*.5,D.rotation=0;break;case 1:{const W=(T&3)!==0,V=F===!W?w:w-(R-_.height);D.textAlign="center",D.textBaseline=W?"bottom":"top",D.translationX=Math.cos(C)*V,D.translationY=Math.sin(C)*V,D.rotation=W?C-Math.PI*.5:C+Math.PI*.5;break}case 2:{const W=(T&6)!==0,V=F===!W?(R-_.height)*.5:(_.height-R)*.5;D.textAlign="center",D.textBaseline="middle",D.translationX=Math.cos(C)*w+Math.cos(C+Math.PI/2)*V,D.translationY=Math.sin(C)*w+Math.sin(C+Math.PI/2)*V,D.rotation=W?C:C+Math.PI;break}}D.visible=!0},A=this.ctx.highlightManager?.getActiveHighlight();for(const M of this.labelSelection.selectByClass(qu)){const D=M.closestDatum();k(D,M,M.tag,D===A)}}getTooltipContent(e){const{id:t,properties:i,ctx:o}=this,{labelKey:s,secondaryLabelKey:a,childrenKey:n,sizeKey:r,sizeName:l,colorKey:c,colorName:h,tooltip:p}=i,{formatManager:u}=o,g=e.reduce((A,M)=>A?.children[M],this.rootNode);if(g==null)return;const{datum:y,depth:f}=g;if(y==null||f==null)return;const x=[],S=r==null?void 0:y[r];if(S!=null){const A=[0,this.rootNode?.sumSize??0],M=u.format(this.callWithContext.bind(this),{type:"number",value:S,datum:y,seriesId:t,legendItemName:void 0,key:r,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:A,fractionDigits:void 0});x.push({label:l,fallbackLabel:r,value:M??bk(S)})}const v=c==null?void 0:y[c];if(v!=null){const{colorDomain:A}=this,M=u.format(this.callWithContext.bind(this),{type:"number",value:v,datum:y,seriesId:t,legendItemName:void 0,key:c,source:"tooltip",property:"color",boundSeries:this.getFormatterContext("color"),domain:A,fractionDigits:void 0});x.push({label:h,fallbackLabel:c,value:M??bk(v)})}const m=this.getItemStyle({...g,colorValue:v??g.colorValue},!1),k={shape:"square",fill:m.fill,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0};return gr.isGradientFill(k.fill)&&(k.fill={...k.fill,gradient:"linear",rotation:0,reverse:!1}),this.formatTooltipWithContext(p,{title:s==null?void 0:y[s],symbol:{marker:k},data:x},{seriesId:t,datum:y,title:void 0,depth:f,labelKey:s,secondaryLabelKey:a,childrenKey:n,sizeKey:r,sizeName:l,colorKey:c,colorName:h,...m})}createNodeData(){}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.datumSelection.nodes())}animateEmptyUpdateReady(){w4(this.id,"nodes",this.ctx.animationManager,[this.scalingGroup],{toFn(){return{scalingX:1,scalingY:1}},fromFn(){return{scalingX:0,scalingY:0}}})}computeFocusBounds(e){return e}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};gh.className="SunburstSeries",gh.type="sunburst";import{_ModuleSupport as F4}from"ag-charts-community";import{constant as H4,required as V4,string as ta}from"ag-charts-core";var{commonSeriesOptionsDefs:W4,sunburstSeriesThemeableOptionsDef:G4,without:K4}=F4,$4={...G4,...K4(W4,["highlightStyle","highlight","showInLegend"]),type:V4(H4("sunburst")),labelKey:ta,secondaryLabelKey:ta,childrenKey:ta,sizeKey:ta,colorKey:ta,sizeName:ta,colorName:ta},{BASE_FONT_SIZE:kk,FONT_SIZE_RATIO:Dk}=ea,j4={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"sunburst",moduleFactory:e=>new gh(e),solo:!0,themeTemplate:{series:{fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",ea.FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS],["pattern",ea.FILL_PATTERN_DEFAULTS],["image",ea.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"strokes"}]},colorRange:{$palette:"divergingColors"},strokeWidth:{$isUserOption:["./strokes/0",2,0]},label:{...ea.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$rem:Dk.LARGE},minimumFontSize:{$rem:9/kk},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},overflowStrategy:"ellipsis",wrapping:"never",spacing:2},secondaryLabel:{...ea.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$rem:Dk.SMALLEST},minimumFontSize:{$rem:7/kk},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},overflowStrategy:"ellipsis",wrapping:"never"},sectorSpacing:2,padding:3,highlightStyle:{label:{color:{$ref:"chartBackgroundColor"}},secondaryLabel:{color:{$ref:"chartBackgroundColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2}},gradientLegend:{enabled:!0,...ea.LEGEND_CONTAINER_THEME}}},Y4={type:"series",name:"sunburst",chartType:"standalone",enterprise:!0,options:$4,create:e=>new gh(e)};import{_ModuleSupport as ls}from"ag-charts-community";import{_ModuleSupport as yr}from"ag-charts-community";import{cachedTextMeasurer as U4,calcLineHeight as X4,isNumberEqual as Z4,toPlainText as Mk,wrapText as q4}from"ag-charts-core";import{_ModuleSupport as Q4}from"ag-charts-community";var{BaseProperties:yh,HierarchySeriesProperties:J4,HighlightStyle:e$,makeSeriesTooltip:t$,Property:q,Label:i$}=Q4,Ak=class extends i${constructor(){super(...arguments),this.spacing=0}};d([q],Ak.prototype,"spacing",2);var mi=class extends yh{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.cornerRadius=0,this.textAlign="center",this.gap=0,this.padding=0,this.interactive=!0,this.label=new Ak}};d([q],mi.prototype,"fill",2),d([q],mi.prototype,"fillOpacity",2),d([q],mi.prototype,"stroke",2),d([q],mi.prototype,"strokeWidth",2),d([q],mi.prototype,"strokeOpacity",2),d([q],mi.prototype,"cornerRadius",2),d([q],mi.prototype,"textAlign",2),d([q],mi.prototype,"gap",2),d([q],mi.prototype,"padding",2),d([q],mi.prototype,"interactive",2),d([q],mi.prototype,"label",2);var Jt=class extends yh{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.cornerRadius=0,this.textAlign="center",this.verticalAlign="middle",this.gap=0,this.padding=0,this.label=new $i,this.secondaryLabel=new zn}};d([q],Jt.prototype,"fill",2),d([q],Jt.prototype,"fillOpacity",2),d([q],Jt.prototype,"stroke",2),d([q],Jt.prototype,"strokeWidth",2),d([q],Jt.prototype,"strokeOpacity",2),d([q],Jt.prototype,"cornerRadius",2),d([q],Jt.prototype,"textAlign",2),d([q],Jt.prototype,"verticalAlign",2),d([q],Jt.prototype,"gap",2),d([q],Jt.prototype,"padding",2),d([q],Jt.prototype,"label",2),d([q],Jt.prototype,"secondaryLabel",2);var ia=class extends yh{constructor(){super(...arguments),this.label=new $i}};d([q],ia.prototype,"fill",2),d([q],ia.prototype,"fillOpacity",2),d([q],ia.prototype,"stroke",2),d([q],ia.prototype,"strokeWidth",2),d([q],ia.prototype,"strokeOpacity",2),d([q],ia.prototype,"label",2);var cs=class extends yh{constructor(){super(...arguments),this.label=new $i,this.secondaryLabel=new zn}};d([q],cs.prototype,"fill",2),d([q],cs.prototype,"fillOpacity",2),d([q],cs.prototype,"stroke",2),d([q],cs.prototype,"strokeWidth",2),d([q],cs.prototype,"strokeOpacity",2),d([q],cs.prototype,"label",2),d([q],cs.prototype,"secondaryLabel",2);var Qu=class extends e${constructor(){super(!1),this.group=new ia,this.tile=new cs}getStyle(e){return e?this.tile:this.group}};d([q],Qu.prototype,"group",2),d([q],Qu.prototype,"tile",2);var Oi=class extends J4{constructor(){super(...arguments),this.highlightStyle=new Qu,this.tooltip=t$(),this.group=new mi,this.tile=new Jt,this.undocumentedGroupFills=[],this.undocumentedGroupStrokes=[]}getStyle(e,t,i,o){const{fillOpacity:s,strokeWidth:a,strokeOpacity:n,fill:r=e?t[o%t.length]:t[Math.min(o,t.length)],stroke:l=e?i[o%t.length]:i[Math.min(o,i.length)]}=e?this.tile:this.group;return{fill:r,fillOpacity:s,stroke:l,strokeWidth:a,strokeOpacity:n,opacity:1}}};d([q],Oi.prototype,"sizeName",2),d([q],Oi.prototype,"labelKey",2),d([q],Oi.prototype,"secondaryLabelKey",2),d([q],Oi.prototype,"itemStyler",2),d([q],Oi.prototype,"highlightStyle",2),d([q],Oi.prototype,"tooltip",2),d([q],Oi.prototype,"group",2),d([q],Oi.prototype,"tile",2),d([q],Oi.prototype,"undocumentedGroupFills",2),d([q],Oi.prototype,"undocumentedGroupStrokes",2);var{createDatumId:o$,Rect:Ik,Group:Lk,BBox:cn,Selection:Ju,Text:eg,Transformable:s$,applyShapeStyle:a$,getLabelStyles:n$,mergeDefaults:Tk,formatValue:Ck}=yr,r$=class extends yr.HierarchyNode{constructor(){super(...arguments),this.labelValue=void 0,this.secondaryLabelValue=void 0,this.label=void 0,this.secondaryLabel=void 0,this.bbox=void 0,this.padding=void 0}};function hs(e){return e.children.length>0?e.sumSize-e.sizeValue:e.sizeValue}var Nk={left:0,center:.5,right:1},l$={top:0,middle:.5,bottom:1},U6=class extends yr.Group{distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}},fh=class extends yr.HierarchySeries{constructor(){super(...arguments),this.NodeClass=r$,this.properties=new Oi,this.rectGroup=this.contentGroup.appendChild(new Lk),this.datumSelection=Ju.select(this.rectGroup,Ik),this.labelSelection=Ju.select(this.labelGroup,Lk),this.highlightSelection=Ju.select(this.rectGroup,Ik)}groupTitleHeight(e,t){const{labelValue:i}=e,{label:o}=this.properties.group,s=3;if(i!=null){if(o.fontSize>t.width/s||o.fontSize>t.height/s)return;{const{height:a}=U4(o).measureLines(i);return Math.max(a,o.fontSize)}}}getNodePadding(e,t){if(e.parent==null)return{top:0,right:0,bottom:0,left:0};if(e.children.length===0){const{padding:n}=this.properties.tile;return{top:n,right:n,bottom:n,left:n}}const{label:{spacing:i},padding:o}=this.properties.group,s=this.groupTitleHeight(e,t),a=s==null?0:s+i;return{top:o+a,right:o,bottom:o,left:o}}sortChildren({children:e}){const t=Array.from(e,(o,s)=>s).filter(o=>hs(e[o])>0).sort((o,s)=>hs(e[s])-hs(e[o]));return{sortedChildrenIndices:t,childAt:o=>{const s=t[o];return e[s]}}}squarify(e,t){const{datum:i,children:o}=e;if(t.width<=0||t.height<=0){e.bbox=void 0,e.padding=void 0,e.midPoint.x=Number.NaN,e.midPoint.y=Number.NaN;return}const s=i==null?{top:0,right:0,bottom:0,left:0}:this.getNodePadding(e,t);e.parent==null?(e.bbox=void 0,e.padding=void 0,e.midPoint.x=Number.NaN,e.midPoint.y=Number.NaN):(e.bbox=t,e.padding=s,e.midPoint.x=t.x+t.width/2,e.midPoint.y=t.y);const{sortedChildrenIndices:a,childAt:n}=this.sortChildren(e),r=a.every(k=>o[k].children.length===0),l=1,c=t.width-s.left-s.right,h=t.height-s.top-s.bottom;if(c<=0||h<=0)return;const p=a.length;let u=0,g=0,y=1/0,f=a.reduce((k,A)=>k+hs(o[A]),0);const x=new cn(t.x+s.left,t.y+s.top,c,h),S=x.clone();let v=0;for(;v({left:l.x,top:l.y,right:l.x+l.width,bottom:l.y+l.height}),a=s(e),n=s(t),r=["top","right","bottom","left"];for(const l of r)Z4(a[l],n[l])||t.shrink(o,l)}createNodeData(){}getItemStyle(e,t,i){const{properties:o,colorScale:s}=this,{itemStyler:a}=o,n=e.datumIndex?.[0]??0,r=t?o.fills:o.undocumentedGroupFills,l=t?o.strokes:o.undocumentedGroupStrokes,c=t?n:e.depth??-1,h=i?o.highlightStyle.getStyle(t):void 0,p=Tk(h,o.getStyle(t,r,l,c));!i&&t&&e.colorValue!=null&&(p.fill=s.convert(e.colorValue));let u=p;if(a!=null&&e!=null){const g=this.cachedDatumCallback(o$(this.getDatumId(e),i?"highlight":"node"),()=>{const y=this.makeItemStylerParams(e,i,u);return this.callWithContext(a,y)});g&&(u=Tk(g,u))}return u}makeItemStylerParams(e,t,i){const{id:o}=this,s=this.ctx.highlightManager?.getActiveHighlight(),a=this.getHighlightStateString(s,t,e.datumIndex),n=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:o,datum:e.datum,depth:e.depth??-1,highlighted:t,highlightState:a,...i,fill:n}}updateSelections(){let e=this.ctx.highlightManager?.getActiveHighlight();if(e!=null&&!this.properties.group.interactive&&e.children.length!==0&&(e=void 0),this.highlightSelection.update(e==null?[]:[e],void 0,s=>this.getDatumId(s)),!this.nodeDataRefresh)return;this.nodeDataRefresh=!1;const{seriesRect:t}=this.chart??{};if(!t)return;const i=Array.from(this.rootNode),o=s=>{s.append([new eg({tag:0}),new eg({tag:1})])};this.datumSelection.update(i,void 0,s=>this.getDatumId(s)),this.labelSelection.update(i,o,s=>this.getDatumId(s))}updateNodes(){const{rootNode:e,data:t}=this,{childrenKey:i,colorKey:o,colorName:s,labelKey:a,secondaryLabelKey:n,sizeKey:r,sizeName:l,highlightStyle:c,tile:h,group:p}=this.properties,{seriesRect:u}=this.chart??{};if(!u||!t)return;this.rootNode?.walk(m=>{const{datum:b,depth:k,children:A}=m,M=A.length===0,D=M?h.label:p.label;let L;if(D.enabled&&b!=null&&k!=null&&a!=null){const P=b[a];L=this.getLabelText(P,b,a,"label",[],D,{depth:k,datum:b,childrenKey:i,colorKey:o,colorName:s,labelKey:a,secondaryLabelKey:n,sizeKey:r,sizeName:l,value:P})}L===""&&(L=void 0);let N;if(h.secondaryLabel.enabled&&M&&b!=null&&k!=null&&n!=null){const P=b[n];N=this.getLabelText(P,b,n,"secondaryLabel",[],h.secondaryLabel,{depth:k,datum:b,childrenKey:i,colorKey:o,colorName:s,labelKey:a,secondaryLabelKey:n,sizeKey:r,sizeName:l,value:P})}N===""&&(N=void 0),m.labelValue=Mk(L),m.secondaryLabelValue=Mk(N)});const{width:g,height:y}=u;this.squarify(e,new cn(0,0,g,y)),this.rootNode?.walk(m=>{const{bbox:b,children:k,labelValue:A,secondaryLabelValue:M}=m;if(m.label=void 0,m.secondaryLabel=void 0,b!=null)if(k.length===0){const D={width:b.width,height:b.height,meta:null},L=sp(A,this.properties.tile.label,M,this.properties.tile.secondaryLabel,{padding:h.padding},()=>D);if(L==null)return;const{height:N,label:P,secondaryLabel:R}=L,{textAlign:F,verticalAlign:_,padding:E}=h,T=Nk[F]??.5,w=b.x+E+(b.width-2*E)*T,C=l$[_]??.5,I=b.y+E+N*.5+(b.height-2*E-N)*C;if(P!=null){const{fontStyle:O="normal",fontFamily:z,fontWeight:B="normal",color:H="black"}=this.properties.tile.label;m.label={text:P.text,fontSize:P.fontSize,lineHeight:P.lineHeight,fontStyle:O,fontFamily:z,fontWeight:B,color:H,textAlign:F,verticalAlign:"middle",x:w,y:I-(N-P.height)*.5}}if(R!=null){const{fontStyle:O="normal",fontFamily:z,fontWeight:B="normal",color:H="black"}=this.properties.tile.secondaryLabel;m.secondaryLabel={text:R.text,fontSize:R.fontSize,lineHeight:R.fontSize,fontStyle:O,fontFamily:z,fontWeight:B,color:H,textAlign:F,verticalAlign:"middle",x:w,y:I+(N-R.height)*.5}}}else{if(A==null)return;{const{padding:D,textAlign:L}=p,N=this.groupTitleHeight(m,b);if(N==null)return;const P=b.width-2*D,R=q4(A,{maxWidth:b.width-2*D,font:p.label,textWrap:"never"}),F=Nk[L]??.5,{fontStyle:_="normal",fontFamily:E,fontWeight:T="normal",color:w="black"}=this.properties.group.label;m.label={text:R,fontSize:p.label.fontSize,lineHeight:X4(p.label.fontSize),fontStyle:_,fontFamily:E,fontWeight:T,color:w,textAlign:L,verticalAlign:"middle",x:b.x+D+P*F,y:b.y+D+N*.5}}}});const f={series:new cn(0,0,g,y),axis:new cn(0,0,g,y)},x=(m,b,k)=>{const{bbox:A}=m;if(A==null){b.visible=!1;return}const{depth:M=-1}=m,D=m.children.length===0,L=this.getItemStyle(m,D,k);b.crisp=!0,a$(b,L,f),b.cornerRadius=D?h.cornerRadius:p.cornerRadius,b.zIndex=[0,M,k?1:0];const N=m.parent?.children.every(F=>F.children.length===0),P=m.parent==null?void 0:m.parent.bbox,R=m.parent==null?void 0:m.parent.padding;N===!0&&P!=null&&R!=null?(b.clipBBox=A,b.x=P.x+R.left,b.y=P.y+R.top,b.width=P.width-(R.left+R.right),b.height=P.height-(R.top+R.bottom)):(b.clipBBox=void 0,b.x=A.x,b.y=A.y,b.width=A.width,b.height=A.height),b.visible=!0};this.datumSelection.each((m,b)=>x(b,m,!1)),this.highlightSelection.each((m,b)=>{x(b,m,!0)});const S=(m,b,k,A)=>{const M=m.children.length===0,D=k===0?m.label:m.secondaryLabel;if(D==null){b.visible=!1;return}const L=k===0?h.label:h.secondaryLabel;let N;if(A){const{tile:_,group:E}=c;N=_.secondaryLabel.color,M?k===0&&(N=_.label.color):N=E.label.color}const P={childrenKey:this.properties.childrenKey,colorKey:this.properties.colorKey,colorName:this.properties.colorName??this.properties.colorKey,depth:m.depth??Number.NaN,labelKey:this.properties.labelKey,secondaryLabelKey:this.properties.secondaryLabelKey,sizeKey:this.properties.sizeKey,sizeName:this.properties.sizeName??this.properties.sizeKey},R=this.ctx.highlightManager?.getActiveHighlight(),F=n$(this,m,P,L,A,R);b.text=D.text,b.fontSize=D.fontSize,b.lineHeight=D.lineHeight,b.fontStyle=D.fontStyle,b.fontFamily=D.fontFamily,b.fontWeight=D.fontWeight,b.fill=N??D.color,b.fillOpacity=this.getHighlightStyle(A,m.datumIndex)?.opacity??1,b.textAlign=D.textAlign,b.textBaseline=D.verticalAlign,b.x=D.x,b.y=D.y,b.setBoxing(F),b.visible=!0,b.zIndex=1},v=this.ctx.highlightManager?.getActiveHighlight();for(const m of this.labelSelection.selectByClass(eg)){const b=m.closestDatum();S(b,m,m.tag,b===v)}}pickNodesExactShape(e){const t=super.pickNodesExactShape(e);return t.sort((i,o)=>o.datumIndex.length-i.datumIndex.length),t}pickNodeClosestDatum(e){const t=this.pickNodesExactShape(e);return t.length!==0?{datum:t[0],distance:0}:this.pickNodeNearestDistantObject(e,this.datumSelection.nodes())}getTooltipContent(e){const{id:t,properties:i,ctx:o}=this,{formatManager:s}=o,{labelKey:a,secondaryLabelKey:n,childrenKey:r,sizeKey:l,sizeName:c,colorKey:h,colorName:p,tooltip:u}=i,g=e.reduce((L,N)=>L?.children[N],this.rootNode);if(g==null)return;const{datum:y,depth:f,children:x}=g;if(y==null||f==null)return;const S=x.length===0,v=[],m=l==null?void 0:y[l];if(m!=null){const L=[0,this.rootNode?.sumSize??0],N=s.format(this.callWithContext.bind(this),{type:"number",value:m,datum:y,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:L,fractionDigits:void 0});v.push({label:c,fallbackLabel:l,value:N??Ck(m)})}const b=h==null?void 0:y[h];if(b!=null){const{colorDomain:L}=this,N=s.format(this.callWithContext.bind(this),{type:"number",value:b,datum:y,seriesId:t,legendItemName:void 0,key:h,source:"tooltip",property:"color",boundSeries:this.getFormatterContext("color"),domain:L,fractionDigits:void 0});v.push({label:p,fallbackLabel:h,value:N??Ck(b)})}const k=this.getItemStyle({...g,colorValue:b??g.colorValue},S,!1),M={shape:"square",fill:k.fill,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0};yr.isGradientFill(M.fill)&&(M.fill={...M.fill,gradient:"linear",rotation:0,reverse:!1});const D=S?{marker:M}:void 0;return this.formatTooltipWithContext(u,{title:a==null?void 0:y[a],symbol:D,data:v},{seriesId:t,datum:y,title:void 0,depth:f,labelKey:a,secondaryLabelKey:n,childrenKey:r,sizeKey:l,sizeName:c,colorKey:h,colorName:p,...k})}computeFocusBounds(e){return s$.toCanvas(this.contentGroup,e.getBBox())}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.tile.label.itemStyler!=null||this.properties.group.label.itemStyler!=null}};fh.className="TreemapSeries",fh.type="treemap";import{_ModuleSupport as c$}from"ag-charts-community";import{arrayOf as wk,color as Pk,constant as h$,required as d$,string as oa,undocumented as Ok}from"ag-charts-core";var{commonSeriesOptionsDefs:p$,treemapSeriesThemeableOptionsDef:u$,without:g$}=c$,tg={...u$,...g$(p$,["highlightStyle","highlight","showInLegend"]),type:d$(h$("treemap")),labelKey:oa,secondaryLabelKey:oa,childrenKey:oa,sizeKey:oa,colorKey:oa,sizeName:oa,colorName:oa};tg.undocumentedGroupFills=Ok(wk(Pk)),tg.undocumentedGroupStrokes=Ok(wk(Pk));var{FONT_SIZE_RATIO:_k}=ls,y$={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"treemap",moduleFactory:e=>new fh(e),solo:!0,themeTemplate:{series:{fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",ls.FILL_GRADIENT_LINEAR_DEFAULTS],["pattern",ls.FILL_PATTERN_DEFAULTS],["image",ls.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"strokes"}]},colorRange:{$palette:"divergingColors"},undocumentedGroupFills:{$palette:"hierarchyColors"},undocumentedGroupStrokes:{$palette:"secondHierarchyColors"},group:{label:{...ls.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"textColor"},fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},spacing:4},fill:void 0,stroke:void 0,strokeWidth:1,padding:4,gap:2,textAlign:"left"},tile:{label:{...ls.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"chartBackgroundColor"},fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:1.5},minimumFontSize:{$rem:_k.SMALLER},fontFamily:{$ref:"fontFamily"},wrapping:"on-space",overflowStrategy:"ellipsis",spacing:2},secondaryLabel:{...ls.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"chartBackgroundColor"},fontStyle:void 0,fontWeight:void 0,fontSize:{$ref:"fontSize"},minimumFontSize:{$rem:_k.SMALLER},fontFamily:{$ref:"fontFamily"},wrapping:"never",overflowStrategy:"ellipsis"},fill:void 0,stroke:void 0,strokeWidth:{$isUserOption:["../strokes/0",2,{$isUserOption:["./stroke",2,0]}]},padding:3,gap:1},highlightStyle:{group:{label:{color:{$ref:"textColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2},tile:{label:{color:{$ref:"chartBackgroundColor"}},secondaryLabel:{color:{$ref:"chartBackgroundColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2}}},gradientLegend:{enabled:!0,...ls.LEGEND_CONTAINER_THEME}}},f$={type:"series",name:"treemap",chartType:"standalone",enterprise:!0,options:tg,create:e=>new fh(e)},q6=B_.ModuleRegistry,m$=[K_,pm,wm,tB,kB,Km,Ym,yx,Cx,Rx],x$=[$_,j_,Y_,U_,EV,YW,aG,ZG,yK],S$=[eR,nW,lz,QK,Y4,f$,hE,I4],b$=[rR,jz,lF,UF,vH,zH],v$=[...m$,...x$,...S$,...b$,LR,TR,CR],k$=`.ag-watermark{position:absolute;bottom:20px;right:25px;font-weight:700;font-family:Impact,sans-serif;font-size:19px;opacity:.7;animation:1s ease-out 3s ag-watermark-fadeout;color:#9b9b9b;pointer-events:none;&:before{content:"";display:block;height:40px;width:170px;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU4IiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgMjU4IDQwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjUuNzc5IDI4LjY1N0gxMy4zNTlMMTEuMTczIDM0LjAxMkg1LjY3Mjk3TDE3LjE4MiA3LjA1OTk5SDIxLjk1M0wzMy40NjIgMzQuMDEySDI3Ljk2MkwyNS43NzYgMjguNjU3SDI1Ljc3OVpNMjQuMDY4IDI0LjM5N0wxOS41ODggMTMuNDM0TDE1LjEwNyAyNC4zOTdIMjQuMDY4Wk02Mi4wOTIgMTguODIzSDQ5LjgxN1YyMy4wODZINTYuNzc1QzU2LjU1NSAyNS4yMjIgNTUuNzU1IDI2LjkyNyA1NC4zNzIgMjguMjAyQzUyLjk4OSAyOS40NzYgNTEuMTY2IDMwLjExNSA0OC45MDkgMzAuMTE1QzQ3LjYyMiAzMC4xMTUgNDYuNDUgMjkuODg1IDQ1LjM5MyAyOS40MjNDNDQuMzU4MyAyOC45NzgxIDQzLjQzMjYgMjguMzEzOCA0Mi42OCAyNy40NzZDNDEuOTI3IDI2LjYzOSA0MS4zNDQgMjUuNjMxIDQwLjkzMSAyNC40NTNDNDAuNTE5IDIzLjI3NSA0MC4zMTEgMjEuOTcgNDAuMzExIDIwLjUzN0M0MC4zMTEgMTkuMTA1IDQwLjUxNiAxNy44IDQwLjkzMSAxNi42MjFDNDEuMzQ0IDE1LjQ0MyA0MS45MjcgMTQuNDM2IDQyLjY4IDEzLjU5OEM0My40Mzc2IDEyLjc1NzcgNDQuMzY5NiAxMi4wOTMyIDQ1LjQxMSAxMS42NTFDNDYuNDc4IDExLjE4OSA0Ny42NTYgMTAuOTYgNDguOTQ2IDEwLjk2QzUxLjYxMiAxMC45NiA1My42MzcgMTEuNjAyIDU1LjAyIDEyLjg4NUw1OC4zIDkuNjA0OTlDNTUuODE3IDcuNjY5OTkgNTIuNjc2IDYuNjk5OTkgNDguODcyIDYuNjk5OTlDNDYuNzYgNi42OTk5OSA0NC44NTMgNy4wMzQ5OSA0My4xNTQgNy43MDA5OUM0MS40NTUgOC4zNjc5OSAzOS45OTggOS4zMDM5OSAzOC43ODMgMTAuNTA0QzM3LjU2NyAxMS43MDcgMzYuNjM0IDEzLjE1OCAzNS45NzcgMTQuODU3QzM1LjMxOSAxNi41NTYgMzQuOTk0IDE4LjQ1MSAzNC45OTQgMjAuNTRDMzQuOTk0IDIyLjYzIDM1LjMyOSAyNC40OTQgMzUuOTk1IDI2LjIwNUMzNi42NjIgMjcuOTE2IDM3LjYwNSAyOS4zNzQgMzguODE3IDMwLjU3N0M0MC4wMzIgMzEuNzggNDEuNDg2IDMyLjcxMyA0My4xODggMzMuMzgzQzQ0Ljg4OCAzNC4wNDkgNDYuNzgyIDM0LjM4NCA0OC44NzIgMzQuMzg0QzUwLjk2MSAzNC4zODQgNTIuNzUgMzQuMDQ5IDU0LjM5IDMzLjM4M0M1Ni4wMzEgMzIuNzE2IDU3LjQyNiAzMS43OCA1OC41NzkgMzAuNTc3QzU5LjczMyAyOS4zNzQgNjAuNjE5IDI3LjkxNiA2MS4yMzkgMjYuMjA1QzYxLjg2IDI0LjQ5NCA2Mi4xNyAyMi42MDUgNjIuMTcgMjAuNTRDNjIuMTY5NiAxOS45Njg4IDYyLjE0NDUgMTkuMzk4IDYyLjA5NSAxOC44MjlMNjIuMDkyIDE4LjgyM1pNMTUxLjgxIDE2Ljk4MUMxNTMuNDEgMTQuNjA5IDE1Ny40MTkgMTQuMzU4IDE1OS4wMjIgMTQuMzU4VjE4LjkxQzE1Ni45NTcgMTguOTEgMTU0Ljk4NSAxOC45OTYgMTUzLjc1NyAxOS44OTJDMTUyLjUyOSAyMC43OTIgMTUxLjkxOSAyMS45ODIgMTUxLjkxOSAyMy40NjRWMzMuOTlIMTQ2Ljk2NFYxNC4zNThIMTUxLjczNkwxNTEuODEgMTYuOTgxWk0xNDMuMDExIDE0LjM2MVYzNC4wMzFIMTM4LjI0TDEzOC4xMzEgMzEuMDQ1QzEzNy40NjYgMzIuMDc2IDEzNi41NTEgMzIuOTIxOSAxMzUuNDcxIDMzLjUwNEMxMzQuMzc2IDM0LjA5OSAxMzMuMDY4IDM0LjM5NiAxMzEuNTM2IDM0LjM5NkMxMzAuMiAzNC4zOTYgMTI4Ljk2MyAzNC4xNTIgMTI3LjgyMiAzMy42NjhDMTI2LjcgMzMuMTk2NCAxMjUuNjg5IDMyLjQ5NSAxMjQuODU1IDMxLjYwOUMxMjQuMDE4IDMwLjcyMiAxMjMuMzU0IDI5LjY2MiAxMjIuODcxIDI4LjQyMkMxMjIuMzg0IDI3LjE4NSAxMjIuMTQyIDI1LjgxMSAxMjIuMTQyIDI0LjMwNEMxMjIuMTQyIDIyLjc5OCAxMjIuMzg0IDIxLjM3OCAxMjIuODcxIDIwLjExNkMxMjMuMzU3IDE4Ljg1NCAxMjQuMDE4IDE3Ljc3MiAxMjQuODU1IDE2Ljg3M0MxMjUuNjg4IDE1Ljk3NjQgMTI2LjY5OCAxNS4yNjM2IDEyNy44MjIgMTQuNzhDMTI4Ljk2MyAxNC4yODEgMTMwLjIwMyAxNC4wMzMgMTMxLjUzNiAxNC4wMzNDMTMzLjA0MyAxNC4wMzMgMTM0LjMzIDE0LjMxOCAxMzUuMzk3IDE0Ljg4OEMxMzYuNDYyIDE1LjQ1ODkgMTM3LjM3NSAxNi4yNzggMTM4LjA1NyAxNy4yNzZWMTQuMzYxSDE0My4wMTFaTTEzMi42MzEgMzAuMTMzQzEzNC4yNTYgMzAuMTMzIDEzNS41NjcgMjkuNTk0IDEzNi41NjUgMjguNTEyQzEzNy41NjEgMjcuNDMgMTM4LjA2IDI1Ljk5MSAxMzguMDYgMjQuMTk2QzEzOC4wNiAyMi40MDEgMTM3LjU2MSAyMC45OSAxMzYuNTY1IDE5Ljg5OUMxMzUuNTcgMTguODA3IDEzNC4yNTkgMTguMjU4IDEzMi42MzEgMTguMjU4QzEzMS4wMDMgMTguMjU4IDEyOS43MjkgMTguODA0IDEyOC43MzQgMTkuODk5QzEyNy43MzggMjAuOTkzIDEyNy4yMzkgMjIuNDM4IDEyNy4yMzkgMjQuMjMzQzEyNy4yMzkgMjYuMDI4IDEyNy43MzUgMjcuNDMzIDEyOC43MzQgMjguNTE1QzEyOS43MjkgMjkuNTk0IDEzMS4wMjggMzAuMTM2IDEzMi42MzEgMzAuMTM2VjMwLjEzM1pNOTMuNjk4IDI3Ljg3NkM5My41Nzk1IDI4LjAwMjUgOTMuNDU2NCAyOC4xMjQ2IDkzLjMyOSAyOC4yNDJDOTEuOTQ3IDI5LjUxNiA5MC4xMjMgMzAuMTU1IDg3Ljg2NiAzMC4xNTVDODYuNTggMzAuMTU1IDg1LjQwOCAyOS45MjYgODQuMzUgMjkuNDY0QzgzLjMxNTUgMjkuMDE4OSA4Mi4zODk4IDI4LjM1NDYgODEuNjM3IDI3LjUxN0M4MC44ODQgMjYuNjc5IDgwLjMwMSAyNS42NzIgNzkuODg5IDI0LjQ5NEM3OS40NzYgMjMuMzE1IDc5LjI2OSAyMi4wMSA3OS4yNjkgMjAuNTc4Qzc5LjI2OSAxOS4xNDUgNzkuNDczIDE3Ljg0IDc5Ljg4OSAxNi42NjJDODAuMzAxIDE1LjQ4NCA4MC44ODQgMTQuNDc2IDgxLjYzNyAxMy42MzlDODIuMzk0OSAxMi43OTg3IDgzLjMyNzMgMTIuMTM0MiA4NC4zNjkgMTEuNjkyQzg1LjQzNiAxMS4yMyA4Ni42MTQgMTEgODcuOTAzIDExQzkwLjU3IDExIDkyLjU5NSAxMS42NDIgOTMuOTc3IDEyLjkyNkw5Ny4yNTggOS42NDQ5OUM5NC43NzQgNy43MTA5OSA5MS42MzMgNi43Mzk5OSA4Ny44MjkgNi43Mzk5OUM4NS43MTggNi43Mzk5OSA4My44MTEgNy4wNzQ5OSA4Mi4xMTIgNy43NDE5OUM4MC40MTMgOC40MDc5OSA3OC45NTYgOS4zNDQ5OSA3Ny43NCAxMC41NDVDNzYuNTI1IDExLjc0NyA3NS41OTIgMTMuMTk5IDc0LjkzNCAxNC44OThDNzQuMjc3IDE2LjU5NyA3My45NTEgMTguNDkxIDczLjk1MSAyMC41ODFDNzMuOTUxIDIyLjY3IDc0LjI4NiAyNC41MzQgNzQuOTUzIDI2LjI0NUM3NS42MTkgMjcuOTU3IDc2LjU2MiAyOS40MTQgNzcuNzc0IDMwLjYxN0M3OC45OSAzMS44MiA4MC40NDQgMzIuNzUzIDgyLjE0NiAzMy40MjNDODMuODQ1IDM0LjA5IDg1LjczOSAzNC40MjQgODcuODI5IDM0LjQyNEM4OS45MTkgMzQuNDI0IDkxLjcwOCAzNC4wOSA5My4zNDggMzMuNDIzQzk0LjcxOCAzMi44NjUgOTUuOTE4IDMyLjEyMSA5Ni45NDggMzEuMTkxQzk3LjE0OSAzMS4wMDggOTcuMzQ4IDMwLjgxNSA5Ny41MzcgMzAuNjJMOTMuNzAxIDI3Ljg4NUw5My42OTggMjcuODc2Wk0xMTAuODAyIDE0LjAxNUMxMDkuMTk5IDE0LjAxNSAxMDYuODM2IDE0LjQ3MSAxMDUuNjExIDE2LjE1OEwxMDUuNTM3IDYuMDE1OTlIMTAwLjc2NVYzMy45MzlIMTA1LjcyVjIyLjY0MUMxMDUuNzcxIDIxLjQ2MDcgMTA2LjI4OCAyMC4zNDg4IDEwNy4xNTcgMTkuNTQ4OUMxMDguMDI3IDE4Ljc0OTEgMTA5LjE3OCAxOC4zMjY2IDExMC4zNTggMTguMzc0QzExMy4zOTcgMTguMzc0IDExNC4yNjggMjEuMTU5IDExNC4yNjggMjIuNjQxVjMzLjkzOUgxMTkuMjIzVjIxLjA1OUMxMTkuMjIzIDIxLjA1OSAxMTkuMTQyIDE0LjAxNSAxMTAuODAyIDE0LjAxNVpNMTczLjc2MyAxNC4zNThIMTY5Ljk5OVY4LjcxNDk5SDE2NS4wNDhWMTQuMzU4SDE2MS4yODRWMTguOTE2SDE2NS4wNDhWMzQuMDAzSDE2OS45OTlWMTguOTE2SDE3My43NjNWMTQuMzU4Wk0xOTAuNzg3IDI1LjI2MkMxOTAuMTI5IDI0LjUwMTQgMTg5LjMwNyAyMy44OTk0IDE4OC4zODQgMjMuNTAxQzE4Ny40ODggMjMuMTE3IDE4Ni4zMzEgMjIuNzMyIDE4NC45NDggMjIuMzY0QzE4NC4xNjUgMjIuMTQzOSAxODMuMzkgMjEuODk3OCAxODIuNjIzIDIxLjYyNkMxODIuMTYzIDIxLjQ2MjEgMTgxLjc0MSAyMS4yMDY2IDE4MS4zODMgMjAuODc1QzE4MS4yMzUgMjAuNzQyMSAxODEuMTE4IDIwLjU3ODkgMTgxLjAzOSAyMC4zOTY0QzE4MC45NjEgMjAuMjE0IDE4MC45MjIgMjAuMDE2NiAxODAuOTI3IDE5LjgxOEMxODAuOTI3IDE5LjI3MiAxODEuMTU2IDE4Ljg0NCAxODEuNjI1IDE4LjUxQzE4Mi4xMjEgMTguMTU2IDE4Mi44NjIgMTcuOTc2IDE4My44MjYgMTcuOTc2QzE4NC43OSAxNy45NzYgMTg1LjU4NyAxOC4yMDkgMTg2LjE0OCAxOC42NjhDMTg2LjcwNiAxOS4xMjQgMTg3LjAwNyAxOS43MjUgMTg3LjA3MiAyMC41TDE4Ny4wOTQgMjAuNzgySDE5MS42MzNMMTkxLjYxNyAyMC40NkMxOTEuNTIxIDE4LjQ4NSAxOTAuNzcxIDE2LjkgMTg5LjM4NSAxNS43NUMxODguMDEyIDE0LjYxMiAxODYuMTg1IDE0LjAzMyAxODMuOTYyIDE0LjAzM0MxODIuNDc3IDE0LjAzMyAxODEuMTQxIDE0LjI4NyAxNzkuOTk0IDE0Ljc4NkMxNzguODMxIDE1LjI5MSAxNzcuOTI2IDE1Ljk5NSAxNzcuMjk2IDE2Ljg4MkMxNzYuNjczIDE3Ljc0NTUgMTc2LjMzOCAxOC43ODQgMTc2LjM0MSAxOS44NDlDMTc2LjM0MSAyMS4xNjcgMTc2LjY5OCAyMi4yNDkgMTc3LjM5OSAyMy4wNjRDMTc4LjA2IDIzLjg0MzIgMTc4Ljg5OCAyNC40NTM0IDE3OS44NDIgMjQuODQ0QzE4MC43NDQgMjUuMjE2IDE4MS45MjggMjUuNjA3IDE4My4zNjEgMjZDMTg0LjgwNiAyNi40MSAxODUuODcyIDI2Ljc4NSAxODYuNTMgMjcuMTIzQzE4Ny4xIDI3LjQxNCAxODcuMzc5IDI3Ljg0NSAxODcuMzc5IDI4LjQ0NEMxODcuMzc5IDI5LjA0MiAxODcuMTIyIDI5LjQ2NyAxODYuNTk1IDI5LjgzOUMxODYuMDQzIDMwLjIyNiAxODUuMjM3IDMwLjQyNSAxODQuMjAxIDMwLjQyNUMxODMuMTY2IDMwLjQyNSAxODIuMzk0IDMwLjE3NCAxODEuNzQ5IDI5LjY3NEMxODEuMTEzIDI5LjE4MSAxODAuNzcyIDI4LjU4OSAxODAuNzEgMjcuODY0TDE4MC42ODUgMjcuNTgySDE3Ni4wMTNMMTc2LjAyNSAyNy45MDFDMTc2LjA2NyAyOS4wOTU1IDE3Ni40NzIgMzAuMjQ4NyAxNzcuMTg4IDMxLjIwNkMxNzcuOTA3IDMyLjE4IDE3OC44OTMgMzIuOTU4IDE4MC4xMTggMzMuNTE5QzE4MS4zMzYgMzQuMDc3IDE4Mi43MzIgMzQuMzYyIDE4NC4yNjYgMzQuMzYyQzE4NS44MDEgMzQuMzYyIDE4Ny4xMDkgMzQuMTA4IDE4OC4yMzggMzMuNjA5QzE4OS4zNzYgMzMuMTA0IDE5MC4yNzIgMzIuMzk0IDE5MC45MDEgMzEuNDk0QzE5MS41MzQgMzAuNTkyIDE5MS44NTMgMjkuNTU0IDE5MS44NTMgMjguNDAzQzE5MS44MjggMjcuMTEgMTkxLjQ2NiAyNi4wNTMgMTkwLjc3NyAyNS4yNjJIMTkwLjc4N1oiIGZpbGw9IiM5QjlCOUIiLz4KPHBhdGggZD0iTTI0MS45ODIgMjUuNjU4MlYxNy43MTE3SDIyOC40NDFMMjIwLjQ5NCAyNS42NTgySDI0MS45ODJaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNTcuMjM5IDUuOTUwODFIMjQwLjI2NUwyMzIuMjU1IDEzLjg5NzNIMjU3LjIzOVY1Ljk1MDgxWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjEyLjYxMSAzMy42MDQ4TDIxNi42OCAyOS41MzYxSDIzMC40MTJWMzcuNDgyN0gyMTIuNjExVjMzLjYwNDhaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yMTUuNTk5IDIxLjc4MDNIMjI0LjM3MkwyMzIuMzgyIDEzLjgzMzdIMjE1LjU5OVYyMS43ODAzWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjA2IDMzLjYwNDdIMjEyLjYxMUwyMjAuNDk0IDI1LjY1ODJIMjA2VjMzLjYwNDdaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNDAuMjY1IDUuOTUwODFMMjM2LjE5NyAxMC4wMTk0SDIxMC4yNTlWMi4wNzI4OEgyNDAuMjY1VjUuOTUwODFaIiBmaWxsPSIjOUI5QjlCIi8+Cjwvc3ZnPgo=);background-repeat:no-repeat;background-size:170px 40px}>span{padding-left:.7rem}}@keyframes ag-watermark-fadeout{0%{opacity:.5}to{opacity:0}}.ag-charts-dialog{display:flex;flex-direction:column;font-size:var(--ag-charts-chrome-font-size-large)}.ag-charts-dialog__tabs{display:flex;flex-direction:column}.ag-charts-dialog__header{border-bottom:1px solid var(--ag-charts-border-color);display:flex}.ag-charts-dialog__tab-list{display:flex;gap:calc(var(--ag-charts-spacing) * 2)}.ag-charts-dialog__drag-handle{align-items:center;color:inherit;cursor:grab;display:flex;padding:1px 6px;text-align:center}.ag-charts-dialog__drag-handle--dragging{cursor:grabbing}.ag-charts-dialog__tab-button{background:none;border:0;border-bottom:2px solid transparent;border-radius:0;color:var(--ag-charts-panel-subtle-text-color);margin-bottom:-1px;padding:var(--input-padding) calc(var(--input-padding) / 2)}.ag-charts-dialog__tab-button:hover{background:none}.ag-charts-dialog__tab-button--active{border-color:var(--ag-charts-accent-color);color:inherit}.ag-charts-dialog__drag-handle+.ag-charts-dialog__tab-button{margin-left:calc(var(--ag-charts-spacing) * -2)}.ag-charts-button.ag-charts-dialog__close-button{background:none;border:0;margin-left:auto;padding:1px 6px}.ag-charts-dialog__close-button:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-dialog__tab-panel{display:none;flex-direction:column;gap:calc(var(--ag-charts-spacing) * 4);margin:0 calc(var(--ag-charts-spacing) * 4);padding:calc(var(--ag-charts-spacing) * 4) 0}.ag-charts-dialog__tab-panel--active{display:flex}.ag-charts-dialog__input-group-line{display:flex;gap:16px 18px;flex-wrap:wrap}.ag-charts-dialog__input-group{align-items:center;display:flex;font-size:var(--ag-charts-chrome-font-size)}.ag-charts-dialog__input-group-label{color:var(--ag-charts-panel-subtle-text-color);margin-right:5px}.ag-charts-dialog__input-group-label[for]{cursor:pointer}.ag-charts-dialog__button{border-radius:0;margin-right:-1px}.ag-charts-dialog__button.ag-charts-dialog__button--active{background:var(--ag-charts-button-focus-background-color);border-color:var(--ag-charts-input-focus-border-color);color:var(--ag-charts-input-focus-text-color);z-index:var(--input-layer-active)}.ag-charts-dialog__button:first-child,.ag-charts-dialog__input-group-label+.ag-charts-dialog__button{border-bottom-left-radius:var(--ag-charts-input-border-radius);border-top-left-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__button:last-child{border-bottom-right-radius:var(--ag-charts-input-border-radius);border-top-right-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__color-picker-button{--color: #000;background:var(--color);border:none;color:transparent;height:26px;width:26px}.ag-charts-dialog__color-picker-button:hover{background:var(--color)}.ag-charts-dialog__color-picker-button--multi-color,.ag-charts-dialog__color-picker-button--multi-color:hover{background:linear-gradient(135deg,red 0%,#ff0 calc(100% * 1 / 6),#0f0 calc(100% * 2 / 6),#0ff 50%,#00f calc(100% * 4 / 6),#f0f calc(100% * 5 / 6),red 100%)}.ag-charts-color-picker{width:190px;padding:8px;cursor:default;--h: 0;--s: 0;--v: 0;--a: 0;--color: #000;--color-a: #000;--thumb-size: 18px;--inner-width: 172px;--track-height: 12px;--palette-height: 136px;--checker: url('data:image/svg+xml;utf8,');--multi-color: linear-gradient( 135deg, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-color-picker__content{display:flex;flex-direction:column}.ag-charts-color-picker__palette{position:relative;width:100%;height:var(--palette-height);margin-bottom:8px;background:linear-gradient(to bottom,#0000,#000),linear-gradient(to right,#fff,#fff0) hsl(var(--h),100%,50%);border-radius:calc(var(--ag-charts-border-radius) * 1.5);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__palette:after{content:"";position:absolute;display:block;top:calc(var(--thumb-size) * -.5 + (1 - var(--v)) * 100%);left:calc(var(--thumb-size) * -.5 + var(--s) * 100%);background:var(--color);width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__palette:focus-visible:after{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),0 0 0 2px #fff8,var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-row{display:flex;gap:8px;align-items:center;margin-bottom:4px;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input,.ag-charts-color-picker__alpha-input{-webkit-appearance:none;display:block;position:relative;padding:0;margin:0 calc(var(--inset) * -1);border:0;height:var(--thumb-size);width:auto;background:transparent;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input::-moz-range-thumb,.ag-charts-color-picker__alpha-input::-moz-range-thumb{appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__hue-input::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{-webkit-appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038;transform:translateZ(0)}.ag-charts-color-picker__hue-input::-moz-range-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__hue-input::-webkit-slider-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__alpha-input::-moz-range-thumb{background:transparent}.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{background:transparent}.ag-charts-color-picker__alpha-input--opaque::-moz-range-thumb{background:var(--color)}.ag-charts-color-picker__alpha-input--opaque::-webkit-slider-thumb{background:var(--color)}.ag-charts-color-picker__hue-input:focus-visible::-moz-range-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-moz-range-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input:focus-visible::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-webkit-slider-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input::-moz-range-track,.ag-charts-color-picker__alpha-input::-moz-range-track{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__hue-input:before,.ag-charts-color-picker__alpha-input:before{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button{width:36px;margin-left:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);border:0;background:var(--multi-color);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button--hidden{display:none}.ag-charts-color-picker__multi-color-button--active{box-shadow:inset 0 0 0 1px #0003;outline-offset:1px;outline:2px solid #2196f3}.ag-charts-color-picker__hue-input{flex:1 0 0}.ag-charts-color-picker__hue-input::-moz-range-track{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__hue-input:before{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__alpha-input{margin-bottom:7px}.ag-charts-color-picker__alpha-input::-moz-range-track{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__alpha-input:before{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__color-field{display:flex;border:var(--ag-charts-border);background:var(--ag-charts-background-color);border-radius:var(--ag-charts-border-radius);overflow:hidden}.ag-charts-color-picker__color-field:has(:focus-visible){border-color:var(--ag-charts-accent-color);box-shadow:var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-label{width:16px;height:16px;margin:7px 0 7px 7px;color:transparent;background:linear-gradient(to right,var(--color-a),var(--color-a)),var(--checker) top left / 4px 4px;border-radius:calc(var(--ag-charts-border-radius) / 2);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__color-label--multi-color{background:var(--multi-color)}.ag-charts-color-picker__color-input{flex:1;min-width:0;padding:7px 7px 7px 8px;border:0;margin:0;color:inherit;background:transparent;font-variant:tabular-nums}.ag-charts-color-picker__color-input:focus-visible{border:none;outline:none}.ag-charts-annotations__line-stroke-width-menu,.ag-charts-annotations__line-style-type-menu,.ag-charts-annotations__text-size-menu{border-top-left-radius:0;border-top-right-radius:0;.ag-charts-menu__row:first-child{border-radius:0}}.ag-charts-annotations__text-size-menu{--item-padding: 4px 8px;min-width:34px;text-align:center}.ag-charts-annotations__line-stroke-width-menu{--item-padding: 6px;column-gap:6px}.ag-charts-annotations__line-style-type-menu{--item-padding: 6px;column-gap:0}.ag-charts-annotations__stroke-width-button:before{background:var(--ag-charts-foreground-color);content:"";margin-right:var(--toolbar-button-padding);height:min(var(--stroke-width),20px);width:12px}.ag-charts-annotations__stroke-width-button[aria-disabled=true]:before{filter:grayscale(1);opacity:.5}.ag-charts-annotations__color-picker-button{--emblem: var(--color)}.ag-charts-annotations__color-picker-button--multi-color{--emblem: linear-gradient( to right, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-annotations__color-picker-button:after{content:"";display:block;position:absolute;bottom:3px;left:5px;right:5px;height:4px;border-radius:99px;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ag-charts-foreground-color) 10%,transparent);background:var(--emblem)}.ag-charts-annotations__color-picker-button[aria-disabled=true]:after{filter:grayscale(1);opacity:.5}.ag-charts-annotations__toolbar-menu{min-width:200px}.ag-charts-annotations__axis-button--hidden{display:none}.ag-charts-annotations__axis-button{background-color:var(--ag-charts-crosshair-label-background-color);border-radius:calc(var(--ag-charts-border-radius) / 2);border:none;box-sizing:border-box;color:var(--ag-charts-crosshair-label-text-color);cursor:pointer;font-family:var(--ag-charts-button-font-family);font-size:var(--ag-charts-button-font-size);font-weight:var(--ag-charts-button-font-weight);left:0;line-height:16px;overflow:hidden;padding:0;position:absolute;top:0;user-select:none;white-space:nowrap;z-index:var(--ag-charts-layer-annotations)}.ag-charts-annotations__axis-button:hover{opacity:.8;color:var(--ag-charts-background-color)}.ag-charts-dialog--annotation-settings{min-height:233px;width:289px}.ag-charts-dialog--annotation-settings .ag-charts-textarea{height:calc(10px * 2 + var(--textarea-line-height) * 1em * 3 + 2px);overflow-y:auto;resize:vertical}.ag-charts-context-menu{font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);z-index:var(--ag-charts-layer-ui-overlay)}.ag-charts-context-menu__cover{position:fixed;left:0;top:0}.ag-charts-context-menu__menu{background:var(--ag-charts-menu-background-color);border-radius:var(--ag-charts-border-radius);border:var(--ag-charts-menu-border);box-shadow:var(--ag-charts-popup-shadow);color:var(--ag-charts-menu-text-color);display:flex;flex-direction:column;padding:.5em 0;transition:transform .1s ease;white-space:nowrap}.ag-charts-context-menu__menu:focus{outline:none}.ag-charts-context-menu__item{align-items:center;background:none;border:none;box-sizing:border-box;color:inherit;cursor:pointer;display:flex;font:inherit;justify-content:space-between;text-align:left;width:100%;-webkit-appearance:none;-moz-appearance:none}.ag-charts-context-menu__icon>img{width:var(--ag-charts-icon-size);height:var(--ag-charts-icon-size)}.ag-charts-context-menu__icon,.ag-charts-context-menu__cell{display:flex;align-items:center;flex-shrink:0}.ag-charts-context-menu__cell{flex-grow:1}.ag-charts-context-menu__cellpadding{padding:.5em 1em}.ag-charts-context-menu__icon{padding-right:0}.ag-charts-context-menu__item[data-focus-override=true],.ag-charts-context-menu__item:focus,.ag-charts-context-menu__item:active{background:var(--ag-charts-focus-color)}.ag-charts-context-menu__item[data-focus-override=false]{background:inherit}.ag-charts-context-menu__item[data-focus-visible-override=true]:focus,.ag-charts-context-menu__item:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-context-menu__item[data-focus-visible-override=false]{outline:inherit;box-shadow:inherit;z-index:inherit}.ag-charts-context-menu__item[aria-disabled=true]{border:none;color:color-mix(in srgb,var(--ag-charts-input-text-color) 50%,transparent)}.ag-charts-context-menu__item[aria-disabled=true]:focus{background:inherit;cursor:inherit}.ag-charts-context-menu__divider{padding:5px 0}.ag-charts-context-menu__divider:after{content:"";display:block;border-top:1px solid var(--ag-charts-border-color)}.ag-charts-crosshair-label{position:absolute;left:0;top:0;user-select:none;pointer-events:none;font-family:var(--ag-charts-font-family);font-size:var(--ag-charts-font-size);font-weight:var(--ag-charts-font-weight);overflow:hidden;white-space:nowrap;z-index:var(--ag-charts-layer-crosshair);box-sizing:border-box}.ag-charts-crosshair-label-content{padding:0 8px;border-radius:calc(var(--ag-charts-border-radius) / 2);line-height:calc(var(--ag-charts-font-size) + 8px);background-color:var(--ag-charts-crosshair-label-background-color);color:var(--ag-charts-crosshair-label-text-color)}.ag-charts-crosshair-label--hidden{visibility:hidden!important}.ag-charts-text-input{position:absolute}.ag-charts-text-input__textarea{--placeholder-text-color: var(--ag-charts-input-placeholder-text-color);display:block;height:100%;width:100%;border:0;background:none;line-height:1.38;outline:none;transform:translateY(.09em)}.ag-charts-text-input__textarea[placeholder]:empty:before{content:attr(placeholder);color:var(--placeholder-text-color);font-weight:400}.ag-charts-text-input__textarea[placeholder]:not(:empty):before{content:""}.ag-charts-chart-toolbar__menu{min-width:200px}.ag-charts-range-buttons .ag-charts-toolbar__button{padding:var(--toolbar-button-padding) calc(var(--toolbar-button-padding) * 1.5)}.ag-charts-zoom-buttons{align-items:center;display:flex;height:44px;justify-content:center;overflow:hidden;padding-bottom:10px;pointer-events:none;width:100%;.ag-charts-toolbar{--toolbar-size: 24px;--toolbar-button-padding: 1px;display:flex;font-size:var(--ag-charts-chrome-font-size);height:var(--toolbar-size);justify-content:center;opacity:1;pointer-events:auto;transition:opacity .2s ease-in-out,transform .4s ease-in-out;.ag-charts-toolbar__button--first{border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__button--last{border-bottom-right-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__label{padding-left:var(--ag-charts-spacing);padding-right:var(--ag-charts-spacing)}.ag-charts-toolbar__icon+.ag-charts-toolbar__label{padding-left:0}.ag-charts-toolbar__button--gap{margin-left:var(--toolbar-gap)}&.ag-charts-zoom-buttons__toolbar--hidden{opacity:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out}}}.ag-charts-shared-toolbar{gap:var(--toolbar-gap);.ag-charts-toolbar__button{border-radius:var(--ag-charts-border-radius);margin:0}} +`;aa.ModuleRegistry.registerMany(v$,Xk);function Rk(){aa.moduleRegistry.register(bD,TD,rM,C2,B2,HL,tC,eN,cE,eB,vB,GN,eL,lL,bL,U2,vL,BL,rz,$z,rF,YF,bH,BH,jO,u1,__,PN,RV,ED,jW,sG,XG,gK,iM,qK,nM,jP,qw,e1,aW,A4,i1,j4,A1,y$,OO,s_),aa.enterpriseModule.isEnterprise=!0,aa.enterpriseModule.styles=k$,aa.enterpriseModule.licenseManager=e=>new sa(e.container?.ownerDocument??(typeof document>"u"?void 0:document)),aa.enterpriseModule.injectWatermark=E_}export*from"ag-charts-community";Rk();var D$={setLicenseKey(e){sa.setLicenseKey(e)}};function Ek(){Rk(),Yk()}var M$={VERSION:Gk,_Scene:Kk,_Theme:$k,_Util:jk,create:Sr.create.bind(Sr),createSparkline:Sr.__createSparkline.bind(Sr),setup:Ek,setGridContext:sa.setGridContext.bind(sa),setLicenseKey:sa.setLicenseKey.bind(sa),isEnterprise:!0};export{M$ as AgChartsEnterpriseModule,D$ as LicenseManager,Ek as setupEnterpriseModules}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/package/main.esm.mjs b/yuthon_report/static/src/lib/ag-chart/dist/package/main.esm.mjs new file mode 100644 index 000000000..5bc091d6d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/package/main.esm.mjs @@ -0,0 +1,44958 @@ +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __decorateClass = (decorators, target, key, kind) => { + var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; + for (var i = decorators.length - 1, decorator; i >= 0; i--) + if (decorator = decorators[i]) + result = (kind ? decorator(target, key, result) : decorator(result)) || result; + if (kind && result) + __defProp(target, key, result); + return result; +}; + +// packages/ag-charts-enterprise/src/main.ts +import { AgCharts, VERSION as VERSION2, _Scene, _Theme, _Util, setupCommunityModules } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/license/md5.ts +var MD5 = class { + constructor() { + this.ieCompatibility = false; + } + init() { + this.ieCompatibility = this.md5("hello") != "5d41402abc4b2a76b9719d911017c592"; + } + md5cycle(x, k) { + let a = x[0], b = x[1], c = x[2], d = x[3]; + a = this.ff(a, b, c, d, k[0], 7, -680876936); + d = this.ff(d, a, b, c, k[1], 12, -389564586); + c = this.ff(c, d, a, b, k[2], 17, 606105819); + b = this.ff(b, c, d, a, k[3], 22, -1044525330); + a = this.ff(a, b, c, d, k[4], 7, -176418897); + d = this.ff(d, a, b, c, k[5], 12, 1200080426); + c = this.ff(c, d, a, b, k[6], 17, -1473231341); + b = this.ff(b, c, d, a, k[7], 22, -45705983); + a = this.ff(a, b, c, d, k[8], 7, 1770035416); + d = this.ff(d, a, b, c, k[9], 12, -1958414417); + c = this.ff(c, d, a, b, k[10], 17, -42063); + b = this.ff(b, c, d, a, k[11], 22, -1990404162); + a = this.ff(a, b, c, d, k[12], 7, 1804603682); + d = this.ff(d, a, b, c, k[13], 12, -40341101); + c = this.ff(c, d, a, b, k[14], 17, -1502002290); + b = this.ff(b, c, d, a, k[15], 22, 1236535329); + a = this.gg(a, b, c, d, k[1], 5, -165796510); + d = this.gg(d, a, b, c, k[6], 9, -1069501632); + c = this.gg(c, d, a, b, k[11], 14, 643717713); + b = this.gg(b, c, d, a, k[0], 20, -373897302); + a = this.gg(a, b, c, d, k[5], 5, -701558691); + d = this.gg(d, a, b, c, k[10], 9, 38016083); + c = this.gg(c, d, a, b, k[15], 14, -660478335); + b = this.gg(b, c, d, a, k[4], 20, -405537848); + a = this.gg(a, b, c, d, k[9], 5, 568446438); + d = this.gg(d, a, b, c, k[14], 9, -1019803690); + c = this.gg(c, d, a, b, k[3], 14, -187363961); + b = this.gg(b, c, d, a, k[8], 20, 1163531501); + a = this.gg(a, b, c, d, k[13], 5, -1444681467); + d = this.gg(d, a, b, c, k[2], 9, -51403784); + c = this.gg(c, d, a, b, k[7], 14, 1735328473); + b = this.gg(b, c, d, a, k[12], 20, -1926607734); + a = this.hh(a, b, c, d, k[5], 4, -378558); + d = this.hh(d, a, b, c, k[8], 11, -2022574463); + c = this.hh(c, d, a, b, k[11], 16, 1839030562); + b = this.hh(b, c, d, a, k[14], 23, -35309556); + a = this.hh(a, b, c, d, k[1], 4, -1530992060); + d = this.hh(d, a, b, c, k[4], 11, 1272893353); + c = this.hh(c, d, a, b, k[7], 16, -155497632); + b = this.hh(b, c, d, a, k[10], 23, -1094730640); + a = this.hh(a, b, c, d, k[13], 4, 681279174); + d = this.hh(d, a, b, c, k[0], 11, -358537222); + c = this.hh(c, d, a, b, k[3], 16, -722521979); + b = this.hh(b, c, d, a, k[6], 23, 76029189); + a = this.hh(a, b, c, d, k[9], 4, -640364487); + d = this.hh(d, a, b, c, k[12], 11, -421815835); + c = this.hh(c, d, a, b, k[15], 16, 530742520); + b = this.hh(b, c, d, a, k[2], 23, -995338651); + a = this.ii(a, b, c, d, k[0], 6, -198630844); + d = this.ii(d, a, b, c, k[7], 10, 1126891415); + c = this.ii(c, d, a, b, k[14], 15, -1416354905); + b = this.ii(b, c, d, a, k[5], 21, -57434055); + a = this.ii(a, b, c, d, k[12], 6, 1700485571); + d = this.ii(d, a, b, c, k[3], 10, -1894986606); + c = this.ii(c, d, a, b, k[10], 15, -1051523); + b = this.ii(b, c, d, a, k[1], 21, -2054922799); + a = this.ii(a, b, c, d, k[8], 6, 1873313359); + d = this.ii(d, a, b, c, k[15], 10, -30611744); + c = this.ii(c, d, a, b, k[6], 15, -1560198380); + b = this.ii(b, c, d, a, k[13], 21, 1309151649); + a = this.ii(a, b, c, d, k[4], 6, -145523070); + d = this.ii(d, a, b, c, k[11], 10, -1120210379); + c = this.ii(c, d, a, b, k[2], 15, 718787259); + b = this.ii(b, c, d, a, k[9], 21, -343485551); + x[0] = this.add32(a, x[0]); + x[1] = this.add32(b, x[1]); + x[2] = this.add32(c, x[2]); + x[3] = this.add32(d, x[3]); + } + cmn(q, a, b, x, s, t) { + a = this.add32(this.add32(a, q), this.add32(x, t)); + return this.add32(a << s | a >>> 32 - s, b); + } + ff(a, b, c, d, x, s, t) { + return this.cmn(b & c | ~b & d, a, b, x, s, t); + } + gg(a, b, c, d, x, s, t) { + return this.cmn(b & d | c & ~d, a, b, x, s, t); + } + hh(a, b, c, d, x, s, t) { + return this.cmn(b ^ c ^ d, a, b, x, s, t); + } + ii(a, b, c, d, x, s, t) { + return this.cmn(c ^ (b | ~d), a, b, x, s, t); + } + md51(s) { + const n = s.length; + const state = [1732584193, -271733879, -1732584194, 271733878]; + let i; + for (i = 64; i <= s.length; i += 64) { + this.md5cycle(state, this.md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + const tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < s.length; i++) { + tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3); + } + tail[i >> 2] |= 128 << (i % 4 << 3); + if (i > 55) { + this.md5cycle(state, tail); + for (i = 0; i < 16; i++) { + tail[i] = 0; + } + } + tail[14] = n * 8; + this.md5cycle(state, tail); + return state; + } + /* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5 + * algorithm for multi-byte characters (perhaps by adding every four 16-bit characters and + * shortening the sum to 32 bits). Otherwise I suthis.ggest performing MD-5 as if every character + * was two bytes--e.g., 0040 0025 = @%--but then how will an ordinary MD-5 sum be matched? + * There is no way to standardize text to something like UTF-8 before transformation; speed cost is + * utterly prohibitive. The JavaScript standard itself needs to look at this: it should start + * providing access to strings as preformed UTF-8 8-bit unsigned value arrays. + */ + md5blk(s) { + const md5blks = []; + for (let i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + } + rhex(n) { + const hex_chr = "0123456789abcdef".split(""); + let s = "", j = 0; + for (; j < 4; j++) { + s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15]; + } + return s; + } + hex(x) { + for (let i = 0; i < x.length; i++) { + x[i] = this.rhex(x[i]); + } + return x.join(""); + } + md5(s) { + return this.hex(this.md51(s)); + } + add32(a, b) { + return this.ieCompatibility ? this.add32Compat(a, b) : this.add32Std(a, b); + } + /* this function is much faster, so if possible we use it. Some IEs are the only ones I know of that + need the idiotic second function, generated by an if clause. */ + add32Std(a, b) { + return a + b & 4294967295; + } + add32Compat(x, y) { + const lsw = (x & 65535) + (y & 65535), msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 65535; + } +}; + +// packages/ag-charts-enterprise/src/license/licenseManager.ts +function missingOrEmpty(value) { + return value == null || value.length === 0; +} +var LICENSE_TYPES = { + "01": "GRID", + "02": "CHARTS", + "0102": "BOTH" +}; +var LICENSING_HELP_URL = "https://www.ag-grid.com/charts/licensing/"; +var _LicenseManager = class _LicenseManager { + constructor(document2) { + this.watermarkMessage = void 0; + this.totalMessageLength = 124; + this.document = document2; + this.md5 = new MD5(); + this.md5.init(); + } + validateLicense() { + const licenseDetails = this.getLicenseDetails(_LicenseManager.licenseKey, _LicenseManager.gridContext); + const currentLicenseName = `AG ${licenseDetails.currentLicenseType === "BOTH" ? "Grid and " : ""}Charts Enterprise`; + let suppliedLicenseName = ""; + if (licenseDetails.suppliedLicenseType === "BOTH") { + suppliedLicenseName = "AG Grid and AG Charts Enterprise"; + } else if (licenseDetails.suppliedLicenseType === "GRID") { + suppliedLicenseName = "AG Grid Enterprise"; + } else if (licenseDetails.suppliedLicenseType !== void 0) { + suppliedLicenseName = "AG Charts Enterprise"; + } + if (licenseDetails.missing) { + if (!this.isWebsiteUrl() || this.isForceWatermark()) { + this.outputMissingLicenseKey(currentLicenseName); + } + } else if (licenseDetails.expired) { + const gridReleaseDate = _LicenseManager.getChartsReleaseDate(); + const formattedReleaseDate = _LicenseManager.formatDate(gridReleaseDate); + this.outputExpiredKey(licenseDetails.expiry, formattedReleaseDate, suppliedLicenseName); + } else if (!licenseDetails.valid) { + this.outputInvalidLicenseKey( + !!licenseDetails.incorrectLicenseType, + currentLicenseName, + suppliedLicenseName + ); + } else if (licenseDetails.isTrial && licenseDetails.trialExpired) { + this.outputExpiredTrialKey(licenseDetails.expiry, currentLicenseName, suppliedLicenseName); + } + } + static extractExpiry(license) { + const restrictionHashed = license.substring(license.lastIndexOf("_") + 1, license.length); + return new Date(Number.parseInt(_LicenseManager.decode(restrictionHashed), 10)); + } + static extractLicenseComponents(licenseKey) { + let cleanedLicenseKey = licenseKey.replaceAll(/[\u200B-\u200D\uFEFF]/g, ""); + cleanedLicenseKey = cleanedLicenseKey.replaceAll(/\r?\n|\r/g, ""); + if (licenseKey.length <= 32) { + return { md5: null, license: licenseKey, version: null, isTrial: null }; + } + const hashStart = cleanedLicenseKey.length - 32; + const md5 = cleanedLicenseKey.substring(hashStart); + const license = cleanedLicenseKey.substring(0, hashStart); + const [version, isTrial, type] = _LicenseManager.extractBracketedInformation(cleanedLicenseKey); + return { md5, license, version, isTrial, type }; + } + getLicenseDetails(licenseKey, gridContext = false) { + const currentLicenseType = "CHARTS"; + if (missingOrEmpty(licenseKey)) { + return { + licenseKey, + valid: false, + missing: true, + currentLicenseType + }; + } + const chartsReleaseDate = _LicenseManager.getChartsReleaseDate(); + const { md5, license, version, isTrial, type } = _LicenseManager.extractLicenseComponents(licenseKey); + let valid = md5 === this.md5.md5(license) && !licenseKey.includes("For_Trialing_ag-Grid_Only"); + let trialExpired = void 0; + let expired = void 0; + let expiry = null; + let incorrectLicenseType = false; + let suppliedLicenseType = void 0; + function handleTrial() { + const now = /* @__PURE__ */ new Date(); + trialExpired = expiry < now; + expired = void 0; + } + if (valid) { + expiry = _LicenseManager.extractExpiry(license); + valid = !Number.isNaN(expiry.getTime()); + if (valid) { + expired = chartsReleaseDate > expiry; + switch (version) { + case "legacy": + case "2": { + valid = false; + break; + } + case "3": { + if (missingOrEmpty(type)) { + valid = false; + } else { + suppliedLicenseType = type; + if (type !== LICENSE_TYPES["02"] && type !== LICENSE_TYPES["0102"]) { + valid = false; + incorrectLicenseType = true; + } else if (isTrial) { + handleTrial(); + } + } + } + } + } + } + if (!valid) { + return { + licenseKey, + valid, + incorrectLicenseType, + currentLicenseType, + suppliedLicenseType + }; + } + return { + licenseKey, + valid, + expiry: _LicenseManager.formatDate(expiry), + expired, + version, + isTrial, + trialExpired, + invalidLicenseTypeForCombo: gridContext ? suppliedLicenseType !== "BOTH" : void 0, + incorrectLicenseType, + currentLicenseType, + suppliedLicenseType + }; + } + isDisplayWatermark() { + return this.isForceWatermark() || !this.isLocalhost() && !this.isE2ETest() && !this.isWebsiteUrl() && !missingOrEmpty(this.watermarkMessage); + } + getWatermarkMessage() { + return this.watermarkMessage ?? ""; + } + getHostname() { + if (!this.document) { + return "localhost"; + } + const win = this.document.defaultView ?? globalThis; + if (!win) { + return "localhost"; + } + const loc = win.location; + const { hostname = "" } = loc; + return hostname; + } + isForceWatermark() { + if (!this.document) { + return false; + } + const win = this.document?.defaultView ?? globalThis.window != void 0 ? globalThis : void 0; + if (!win) { + return false; + } + const { pathname } = win.location; + return pathname ? pathname.includes("forceWatermark") : false; + } + isWebsiteUrl() { + const hostname = this.getHostname(); + return /^((?:[\w-]+\.)?ag-grid\.com)$/.exec(hostname) !== null; + } + isLocalhost() { + const hostname = this.getHostname(); + return /^(?:127\.0\.0\.1|localhost)$/.exec(hostname) !== null; + } + isE2ETest() { + const hostname = this.getHostname(); + return /^(?:172\.17\.0\.1|host\.docker\.internal)$/.exec(hostname) !== null; + } + static formatDate(date) { + const monthNames = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ]; + const day = date.getDate(); + const monthIndex = date.getMonth(); + const year = date.getFullYear(); + return day + " " + monthNames[monthIndex] + " " + year; + } + static getChartsReleaseDate() { + return new Date(Number.parseInt(_LicenseManager.decode(_LicenseManager.RELEASE_INFORMATION), 10)); + } + static decode(input) { + const keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + let t = ""; + let n, r, i; + let s, o, u, a; + let f = 0; + const e = input.replaceAll(/[^A-Za-z0-9+/=]/g, ""); + while (f < e.length) { + s = keystr.indexOf(e.charAt(f++)); + o = keystr.indexOf(e.charAt(f++)); + u = keystr.indexOf(e.charAt(f++)); + a = keystr.indexOf(e.charAt(f++)); + n = s << 2 | o >> 4; + r = (o & 15) << 4 | u >> 2; + i = (u & 3) << 6 | a; + t = t + String.fromCodePoint(n); + if (u != 64) { + t = t + String.fromCodePoint(r); + } + if (a != 64) { + t = t + String.fromCodePoint(i); + } + } + t = _LicenseManager.utf8_decode(t); + return t; + } + static utf8_decode(input) { + input = input.replaceAll("rn", "n"); + let t = ""; + for (let n = 0; n < input.length; n++) { + const r = input.codePointAt(n); + if (r < 128) { + t += String.fromCodePoint(r); + } else if (r > 127 && r < 2048) { + t += String.fromCodePoint(r >> 6 | 192); + t += String.fromCodePoint(r & 63 | 128); + } else { + t += String.fromCodePoint(r >> 12 | 224); + t += String.fromCodePoint(r >> 6 & 63 | 128); + t += String.fromCodePoint(r & 63 | 128); + } + } + return t; + } + static setGridContext(gridContext = false) { + _LicenseManager.gridContext = gridContext; + } + static setLicenseKey(licenseKey) { + if (this.licenseKey && this.licenseKey !== licenseKey) { + console.warn( + `License Key being set multiple times with different values. This can result in an incorrect license key being used.` + ); + } + _LicenseManager.licenseKey = licenseKey; + } + static extractBracketedInformation(licenseKey) { + if (!licenseKey.includes("[")) { + return ["legacy", false, void 0]; + } + const matches = licenseKey.match(/\[(.*?)\]/g).map((match) => match.replace("[", "").replace("]", "")); + if (!matches || matches.length === 0) { + return ["legacy", false, void 0]; + } + const isTrial = matches.filter((match) => match === "TRIAL").length === 1; + const rawVersion = matches.find((match) => match.startsWith("v")); + const version = rawVersion ? rawVersion.replace("v", "") : "legacy"; + const type = LICENSE_TYPES[matches.find((match) => LICENSE_TYPES[match])]; + return [version, isTrial, type]; + } + centerPadAndOutput(input) { + const paddingRequired = this.totalMessageLength - input.length; + console.error(input.padStart(paddingRequired / 2 + input.length, "*").padEnd(this.totalMessageLength, "*")); + } + padAndOutput(input, padding = "*", terminateWithPadding = "") { + console.error( + input.padEnd(this.totalMessageLength - terminateWithPadding.length, padding) + terminateWithPadding + ); + } + outputInvalidLicenseKey(incorrectLicenseType, currentLicenseName, suppliedLicenseName) { + if (!_LicenseManager.gridContext) { + if (incorrectLicenseType) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Incompatible License Key "); + this.padAndOutput( + `* Your license key is for ${suppliedLicenseName} only and does not cover you for ${currentLicenseName}.`, + " ", + "*" + ); + this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } else { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Invalid License Key "); + this.padAndOutput(`* Your license key is not valid.`, " ", "*"); + this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + } + this.watermarkMessage = "Invalid License"; + } + outputExpiredTrialKey(formattedExpiryDate, currentLicenseName, suppliedLicenseName) { + if (!_LicenseManager.gridContext) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Trial Period Expired. "); + this.padAndOutput( + `* Your trial only license for ${suppliedLicenseName} expired on ${formattedExpiryDate}.`, + " ", + "*" + ); + this.padAndOutput("* Please email info@ag-grid.com to purchase a license.", " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + this.watermarkMessage = "Trial Period Expired"; + } + outputMissingLicenseKey(currentLicenseName) { + if (!_LicenseManager.gridContext) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" License Key Not Found "); + this.padAndOutput(`* All ${currentLicenseName} features are unlocked for trial.`, " ", "*"); + this.padAndOutput( + "* If you want to hide the watermark please email info@ag-grid.com for a trial license key.", + " ", + "*" + ); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + this.watermarkMessage = "For Trial Use Only"; + } + outputExpiredKey(formattedExpiryDate, formattedReleaseDate, currentLicenseName) { + if (!_LicenseManager.gridContext) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Incompatible Software Version "); + this.padAndOutput( + `* Your license key works with versions of ${currentLicenseName} released before ${formattedExpiryDate}.`, + " ", + "*" + ); + this.padAndOutput(`* The version you are trying to use was released on ${formattedReleaseDate}.`, " ", "*"); + this.padAndOutput("* Please contact info@ag-grid.com to renew your license key.", " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + this.watermarkMessage = "License Expired"; + } +}; +_LicenseManager.RELEASE_INFORMATION = "MTc2MTcyODQ5OTU1NQ=="; +_LicenseManager.gridContext = false; +var LicenseManager = _LicenseManager; + +// packages/ag-charts-enterprise/src/setup.ts +import { VERSION, _ModuleSupport as _ModuleSupport281 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxis.ts +import { _ModuleSupport as _ModuleSupport5 } from "ag-charts-community"; +import { isNumberEqual as isNumberEqual3 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/utils/polar.ts +function loopSymmetrically(items, step, iterator) { + const loop = (start, end, loopStep, loopIterator) => { + let prev = items[0]; + for (let i = start; loopStep > 0 ? i <= end : i > end; i += loopStep) { + const curr = items[i]; + if (loopIterator(prev, curr)) + return true; + prev = curr; + } + return false; + }; + const midIndex = Math.floor(items.length / 2); + if (loop(step, midIndex, step, iterator)) + return true; + return loop(items.length - step, midIndex, -step, iterator); +} + +// packages/ag-charts-enterprise/src/axes/angle-number/angleAxisInterval.ts +import { _ModuleSupport } from "ag-charts-community"; +var { AxisInterval, Property } = _ModuleSupport; +var AngleAxisInterval = class extends AxisInterval { +}; +__decorateClass([ + Property +], AngleAxisInterval.prototype, "minSpacing", 2); + +// packages/ag-charts-enterprise/src/axes/angle/angleAxis.ts +import { _ModuleSupport as _ModuleSupport4 } from "ag-charts-community"; +import { countFractionDigits, isNumberEqual as isNumberEqual2, wrapTextOrSegments } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/angleCrossLine.ts +import { _ModuleSupport as _ModuleSupport3 } from "ag-charts-community"; +import { isNumberEqual } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/polarCrossLine.ts +import { _ModuleSupport as _ModuleSupport2 } from "ag-charts-community"; +import { createId } from "ag-charts-core"; +var { BaseProperties, ChartAxisDirection, Property: Property2, Group, FONT_SIZE } = _ModuleSupport2; +var PolarCrossLineLabel = class extends BaseProperties { + constructor() { + super(...arguments); + this.fontSize = FONT_SIZE.LARGE; + this.fontFamily = "Verdana, sans-serif"; + this.padding = 5; + this.color = "rgba(87, 87, 87, 1)"; + } +}; +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "enabled", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "text", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontStyle", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontWeight", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontSize", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "fontFamily", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "padding", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "color", 2); +__decorateClass([ + Property2 +], PolarCrossLineLabel.prototype, "parallel", 2); +var PolarCrossLine = class extends BaseProperties { + constructor() { + super(...arguments); + this.id = createId(this); + this.defaultColorRange = []; + this.shape = "polygon"; + this.label = new PolarCrossLineLabel(); + this.scale = void 0; + this.clippedRange = [-Infinity, Infinity]; + this.gridLength = 0; + this.sideFlag = -1; + this.parallelFlipRotation = 0; + this.regularFlipRotation = 0; + this.direction = ChartAxisDirection.Angle; + this.axisInnerRadius = 0; + this.axisOuterRadius = 0; + this.lineGroup = new Group({ name: this.id }); + this.rangeGroup = new Group({ name: this.id }); + this.labelGroup = new Group({ name: this.id }); + this._isRange = void 0; + } + assignCrossLineGroup(isRange, crossLineRange) { + if (isRange !== this._isRange) { + if (isRange) { + this.rangeGroup.appendChild(crossLineRange); + } else { + this.lineGroup.appendChild(crossLineRange); + } + } + this._isRange = isRange; + } + setSectorNodeProps(node) { + node.fill = this.fill; + node.fillOpacity = this.fillOpacity ?? 1; + node.stroke = this.stroke; + node.strokeOpacity = this.strokeOpacity ?? 1; + node.strokeWidth = this.strokeWidth ?? 1; + node.lineDash = this.lineDash; + } + setLabelNodeProps(node, x, y, baseline, rotation) { + const { label } = this; + node.x = x; + node.y = y; + node.text = label.text; + node.textAlign = "center"; + node.textBaseline = baseline; + node.rotation = rotation; + node.rotationCenterX = x; + node.rotationCenterY = y; + node.fill = label.color; + node.fontFamily = label.fontFamily; + node.fontSize = label.fontSize; + node.fontStyle = label.fontStyle; + node.visible = true; + } +}; +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "enabled", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "type", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "range", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "value", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "defaultColorRange", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "fill", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "fillOpacity", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "stroke", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "strokeWidth", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "strokeOpacity", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "lineDash", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "shape", 2); +__decorateClass([ + Property2 +], PolarCrossLine.prototype, "label", 2); + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/angleCrossLine.ts +var { + ChartAxisDirection: ChartAxisDirection2, + getCrossLineValue, + validateCrossLineValue, + normalizeAngle360, + Group: Group2, + Path, + Sector, + RotatableText, + ContinuousScale +} = _ModuleSupport3; +var AngleCrossLine = class extends PolarCrossLine { + constructor() { + super(); + this.direction = ChartAxisDirection2.Angle; + this.polygonNode = new Path(); + this.sectorNode = new Sector(); + this.lineNode = new Path(); + this.crossLineRange = new Group2(); + this.labelNode = new RotatableText(); + this.ticks = []; + this.crossLineRange.append(this.polygonNode); + this.crossLineRange.append(this.sectorNode); + this.crossLineRange.append(this.lineNode); + this.labelGroup.append(this.labelNode); + } + visibilityCheck() { + if (!ContinuousScale.is(this.scale)) { + return true; + } + const [d0, d1] = this.scale.domain; + const value = getCrossLineValue(this); + if (this.type === "range") { + const [start, end] = value; + return start >= d0 && start <= d1 && end >= start && end <= d1; + } else { + return value >= d0 && value <= d1; + } + } + update(visible) { + const { scale } = this; + if (!scale || !validateCrossLineValue(this, scale) || !this.visibilityCheck()) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updateLineNode(visible); + this.updatePolygonNode(visible); + this.updateSectorNode(visible); + this.updateLabelNode(visible); + } + updateLineNode(visible) { + const { scale, type, value, lineNode: line } = this; + if (!visible || type !== "line" || !scale) { + line.visible = false; + return; + } + const angle = scale.convert(value); + if (Number.isNaN(angle)) { + line.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + line.visible = true; + line.stroke = this.stroke; + line.strokeOpacity = this.strokeOpacity ?? 1; + line.strokeWidth = this.strokeWidth ?? 1; + line.fill = void 0; + line.lineDash = this.lineDash; + const x = axisOuterRadius * Math.cos(angle); + const y = axisOuterRadius * Math.sin(angle); + const x0 = axisInnerRadius * Math.cos(angle); + const y0 = axisInnerRadius * Math.sin(angle); + line.path.clear(true); + line.path.moveTo(x0, y0); + line.path.lineTo(x, y); + this.assignCrossLineGroup(false, this.crossLineRange); + } + updatePolygonNode(visible) { + const { polygonNode: polygon, range: range2, scale, shape, type, ticks } = this; + if (!visible || type !== "range" || shape !== "polygon" || !scale || !range2) { + polygon.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + const startIndex = ticks.indexOf(range2[0]); + const endIndex = ticks.indexOf(range2[1]); + const stops = startIndex <= endIndex ? ticks.slice(startIndex, endIndex + 1) : ticks.slice(startIndex).concat(ticks.slice(0, endIndex + 1)); + const angles = stops.map((value) => scale.convert(value)); + polygon.visible = true; + this.setSectorNodeProps(polygon); + const { path } = polygon; + path.clear(true); + for (const [index, angle] of angles.entries()) { + const x = axisOuterRadius * Math.cos(angle); + const y = axisOuterRadius * Math.sin(angle); + if (index === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + if (axisInnerRadius === 0) { + path.lineTo(0, 0); + } else { + const reversedAngles = angles.slice().reverse(); + for (const angle of reversedAngles) { + const x = axisInnerRadius * Math.cos(angle); + const y = axisInnerRadius * Math.sin(angle); + path.lineTo(x, y); + } + } + polygon.path.closePath(); + this.assignCrossLineGroup(true, this.crossLineRange); + } + updateSectorNode(visible) { + const { sectorNode: sector, range: range2, scale, shape, type } = this; + if (!visible || type !== "range" || shape !== "circle" || !scale || !range2) { + sector.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + const angles = range2.map((value) => scale.convert(value)); + const step = scale.step ?? 0; + const padding = scale instanceof _ModuleSupport3.BandScale ? step / 2 : 0; + sector.visible = true; + this.setSectorNodeProps(sector); + sector.centerX = 0; + sector.centerY = 0; + sector.innerRadius = axisInnerRadius; + sector.outerRadius = axisOuterRadius; + sector.startAngle = angles[0] - padding; + sector.endAngle = angles[1] + padding; + this.assignCrossLineGroup(true, this.crossLineRange); + } + updateLabelNode(visible) { + const { label, labelNode: node, range: range2, scale, type, ticks } = this; + if (!visible || label.enabled === false || !label.text || !scale || type === "range" && !range2) { + node.visible = false; + return; + } + node.visible = true; + const { axisInnerRadius, axisOuterRadius } = this; + let labelX; + let labelY; + let rotation; + let textBaseline; + if (type === "line") { + const angle = normalizeAngle360(scale.convert(this.value)); + const angle270 = 1.5 * Math.PI; + const isRightSide = isNumberEqual(angle, angle270) || angle > angle270 || angle < Math.PI / 2; + const midX = (axisInnerRadius + axisOuterRadius) / 2 * Math.cos(angle); + const midY = (axisInnerRadius + axisOuterRadius) / 2 * Math.sin(angle); + labelX = midX + label.padding * Math.cos(angle + Math.PI / 2); + labelY = midY + label.padding * Math.sin(angle + Math.PI / 2); + textBaseline = isRightSide ? "top" : "bottom"; + rotation = isRightSide ? angle : angle - Math.PI; + } else { + const [startAngle, endAngle] = range2.map((value) => normalizeAngle360(scale.convert(value))); + let angle = (startAngle + endAngle) / 2; + if (startAngle > endAngle) { + angle -= Math.PI; + } + angle = normalizeAngle360(angle); + const isBottomSide = (isNumberEqual(angle, 0) || angle > 0) && angle < Math.PI; + let distance; + if (this.shape === "circle" || ticks.length < 3) { + distance = axisOuterRadius - label.padding; + } else { + distance = axisOuterRadius * Math.cos(Math.PI / ticks.length) - label.padding; + } + labelX = distance * Math.cos(angle); + labelY = distance * Math.sin(angle); + textBaseline = isBottomSide ? "bottom" : "top"; + rotation = isBottomSide ? angle - Math.PI / 2 : angle + Math.PI / 2; + } + this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation); + } +}; +AngleCrossLine.className = "AngleCrossLine"; + +// packages/ag-charts-enterprise/src/axes/angle/angleAxis.ts +var { + ChartAxisDirection: ChartAxisDirection3, + Property: Property3, + toRadians, + normalizeAngle360: normalizeAngle3602, + normalizeAngle360Inclusive, + Path: Path2, + RotatableText: RotatableText2, + Transformable, + BBox, + Selection, + Line +} = _ModuleSupport4; +var AngleAxisLabel = class extends _ModuleSupport4.AxisLabel { + constructor() { + super(...arguments); + this.orientation = "fixed"; + } +}; +__decorateClass([ + Property3 +], AngleAxisLabel.prototype, "orientation", 2); +var AngleAxis = class extends _ModuleSupport4.PolarAxis { + constructor(moduleCtx, scale) { + super(moduleCtx, scale); + this.startAngle = 0; + this.endAngle = void 0; + this.tickLineGroupSelection = Selection.select( + this.tickLineGroup, + Line, + false + ); + this.gridLineGroupSelection = Selection.select( + this.gridLineGroup, + Line, + false + ); + this.labelData = []; + this.tickData = []; + this.radiusLineGroup = this.axisGroup.appendChild(new _ModuleSupport4.TransformableGroup()); + this.radiusLine = this.radiusLineGroup.appendChild(new Path2()); + this.includeInvisibleDomains = true; + } + get direction() { + return ChartAxisDirection3.Angle; + } + createLabel() { + return new AngleAxisLabel(); + } + calculateRotations() { + const rotation = toRadians(this.startAngle); + const parallelFlipRotation = normalizeAngle3602(rotation); + const regularFlipRotation = normalizeAngle3602(rotation - Math.PI / 2); + return { rotation, parallelFlipRotation, regularFlipRotation }; + } + calculateTickLayout(domain) { + const { nice, scale } = this; + const ticksParams = { + nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + const niceDomain = nice ? scale.niceDomain(ticksParams, domain) : domain; + const tickData = this.generateAngleTicks(niceDomain); + this.tickData = tickData; + const ticks = tickData.map((t) => t.value); + const fractionDigits = ticks.reduce( + (f, t) => Math.max(typeof t === "number" ? countFractionDigits(t) : 0, f), + 0 + ); + return { + niceDomain, + tickDomain: niceDomain, + ticks, + rawTickCount: void 0, + fractionDigits, + timeInterval: void 0, + bbox: this.getBBox() + }; + } + update() { + super.update(); + this.updateRadiusLine(); + this.updateGridLines(); + this.updateTickLines(); + } + normalizedAngles() { + const startAngle = normalizeAngle3602(-Math.PI / 2 + toRadians(this.startAngle)); + const sweep = this.endAngle == null ? 2 * Math.PI : normalizeAngle360Inclusive(toRadians(this.endAngle) - toRadians(this.startAngle)); + const endAngle = startAngle + sweep; + return [startAngle, endAngle]; + } + computeRange() { + this.range = this.normalizedAngles(); + } + updateSelections() { + const data = this.tickData; + this.gridLineGroupSelection.update(this.gridLength && this.gridLine.enabled ? data : []); + this.tickLineGroupSelection.update(this.tick.enabled ? data : []); + this.tickLabelGroupSelection.update(this.label.enabled ? data : []); + this.gridLineGroupSelection.cleanup(); + this.tickLineGroupSelection.cleanup(); + this.tickLabelGroupSelection.cleanup(); + } + updatePosition() { + super.updatePosition(); + const { translation, radiusLineGroup } = this; + const translationX = Math.floor(translation.x); + const translationY = Math.floor(translation.y); + radiusLineGroup.translationX = translationX; + radiusLineGroup.translationY = translationY; + } + updateRadiusLine() { + const node = this.radiusLine; + const { path } = node; + path.clear(true); + const { points, closePath } = this.getAxisLinePoints(); + for (const { x, y, moveTo: moveTo2, arc, radius = 0, startAngle = 0, endAngle = 0 } of points) { + if (arc) { + path.arc(x, y, radius, startAngle, endAngle); + } else if (moveTo2) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + if (closePath) { + path.closePath(); + } + node.visible = this.line.enabled; + node.stroke = this.line.stroke; + node.strokeWidth = this.line.width; + node.fill = void 0; + } + getAxisLinePoints() { + const { scale, shape, gridLength: radius } = this; + const [startAngle, endAngle] = this.range; + const isFullCircle = isNumberEqual2(endAngle - startAngle, 2 * Math.PI); + const points = []; + if (shape === "circle") { + if (isFullCircle) { + points.push( + { x: radius, y: 0, moveTo: true }, + { + x: 0, + y: 0, + radius, + startAngle: 0, + endAngle: 2 * Math.PI, + arc: true, + moveTo: false + } + ); + } else { + points.push( + { + x: radius * Math.cos(startAngle), + y: radius * Math.sin(startAngle), + moveTo: true + }, + { + x: 0, + y: 0, + radius, + startAngle: normalizeAngle3602(startAngle), + endAngle: normalizeAngle3602(endAngle), + arc: true, + moveTo: false + } + ); + } + } else if (shape === "polygon") { + const angles = scale.ticks({ + nice: this.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.map((value) => scale.convert(value)); + if (angles && angles.length > 2) { + for (const [i, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + const moveTo2 = i === 0; + points.push({ x, y, moveTo: moveTo2 }); + } + } + } + return { points, closePath: isFullCircle }; + } + updateGridLines() { + const { + scale, + gridLength: radius, + gridLine: { style, width }, + innerRadiusRatio + } = this; + if (!(style && radius > 0)) { + return; + } + const innerRadius = radius * innerRadiusRatio; + const styleCount = style.length; + this.gridLineGroupSelection.each((line, datum, index) => { + const { value } = datum; + const { stroke: stroke2, lineDash } = style[index % styleCount]; + const angle = scale.convert(value); + line.x1 = innerRadius * Math.cos(angle); + line.y1 = innerRadius * Math.sin(angle); + line.x2 = radius * Math.cos(angle); + line.y2 = radius * Math.sin(angle); + line.stroke = stroke2; + line.strokeWidth = width; + line.lineDash = lineDash; + line.fill = void 0; + }); + this.gridLineGroupSelection.cleanup(); + } + updateLabels() { + const { label, tickLabelGroupSelection } = this; + tickLabelGroupSelection.each((node, _, index) => { + const labelDatum = this.labelData[index]; + if (!labelDatum || labelDatum.hidden) { + node.visible = false; + return; + } + node.text = labelDatum.text; + node.setFont(label); + node.fill = label.color; + node.x = labelDatum.x; + node.y = labelDatum.y; + node.setAlign(labelDatum); + node.setBoxing(label); + node.visible = true; + if (labelDatum.rotation) { + node.rotation = labelDatum.rotation; + node.rotationCenterX = labelDatum.x; + node.rotationCenterY = labelDatum.y; + } else { + node.rotation = 0; + } + }); + } + updateTickLines() { + const { scale, gridLength: radius, tick, tickLineGroupSelection } = this; + tickLineGroupSelection.each((line, datum) => { + const { value } = datum; + const angle = scale.convert(value); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + line.x1 = radius * cos; + line.y1 = radius * sin; + line.x2 = (radius + tick.size) * cos; + line.y2 = (radius + tick.size) * sin; + line.stroke = tick.stroke; + line.strokeWidth = tick.width; + }); + } + createLabelNodeData(ticks, options, seriesRect) { + const { label, gridLength: radius, scale, tick } = this; + if (!label.enabled) { + return []; + } + const tempText = new RotatableText2(); + const seriesLeft = seriesRect.x - this.translation.x; + const seriesRight = seriesRect.x + seriesRect.width - this.translation.x; + const { fractionDigits } = this.layout.label; + const axisTickFormatter = this.tickFormatter(this.scale.domain, this.tickData, false, fractionDigits); + const labelData = ticks.map((datum, index) => { + const { value } = datum; + const distance = radius + label.spacing + tick.size; + const angle = scale.convert(value); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + const x = distance * cos; + const y = distance * sin; + const { textAlign, textBaseline } = this.getLabelAlign(angle); + const isLastTickOverFirst = index === ticks.length - 1 && value !== ticks[0] && isNumberEqual2(normalizeAngle3602(angle), normalizeAngle3602(scale.convert(ticks[0]))); + const rotation = this.getLabelRotation(angle); + let text2 = axisTickFormatter(value, index); + tempText.text = text2; + tempText.x = x; + tempText.y = y; + tempText.setFont(label); + tempText.textAlign = textAlign; + tempText.textBaseline = textBaseline; + tempText.rotation = rotation; + if (rotation) { + tempText.rotationCenterX = x; + tempText.rotationCenterY = y; + } + let box = rotation ? Transformable.toCanvas(tempText) : tempText.getBBox(); + if (box && options.hideWhenNecessary && !rotation) { + const overflowLeft = seriesLeft - box.x; + const overflowRight = box.x + box.width - seriesRight; + const pixelError = 1; + if (overflowLeft > pixelError || overflowRight > pixelError) { + const availWidth = box.width - Math.max(overflowLeft, overflowRight); + const wrapOptions = { maxWidth: availWidth, font: label, textWrap: "never" }; + text2 = wrapTextOrSegments(text2, wrapOptions); + tempText.text = text2; + box = tempText.getBBox(); + } + } + return { + text: text2, + x, + y, + textAlign, + textBaseline, + hidden: text2 === "" || (datum.hidden ?? isLastTickOverFirst), + rotation, + box + }; + }); + if (label.avoidCollisions) { + this.avoidLabelCollisions(labelData); + } + return labelData; + } + computeLabelsBBox(options, seriesRect) { + this.labelData = this.createLabelNodeData(this.tickData, options, seriesRect); + const textBoxes = this.labelData.map(({ box }) => box).filter((box) => box != null); + if (!this.label.enabled || textBoxes.length === 0) { + return null; + } + return BBox.merge(textBoxes); + } + getLabelOrientation() { + const { label } = this; + return label instanceof AngleAxisLabel ? label.orientation : "fixed"; + } + getLabelRotation(tickAngle) { + let rotation = toRadians(this.label.rotation ?? 0); + tickAngle = normalizeAngle3602(tickAngle); + const orientation = this.getLabelOrientation(); + if (orientation === "parallel") { + rotation += tickAngle; + if (tickAngle >= 0 && tickAngle < Math.PI) { + rotation -= Math.PI / 2; + } else { + rotation += Math.PI / 2; + } + } else if (orientation === "perpendicular") { + rotation += tickAngle; + if (tickAngle >= Math.PI / 2 && tickAngle < 1.5 * Math.PI) { + rotation += Math.PI; + } + } + return rotation; + } + getLabelAlign(tickAngle) { + const cos = Math.cos(tickAngle); + const sin = Math.sin(tickAngle); + let textAlign; + let textBaseline; + const orientation = this.getLabelOrientation(); + const isCos0 = isNumberEqual2(cos, 0); + const isSin0 = isNumberEqual2(sin, 0); + const isCos1 = isNumberEqual2(cos, 1); + const isSinMinus1 = isNumberEqual2(sin, -1); + const isCosPositive = cos > 0 && !isCos0; + const isSinPositive = sin > 0 && !isSin0; + if (orientation === "parallel") { + textAlign = "center"; + textBaseline = isCos1 && isSin0 || isSinPositive ? "top" : "bottom"; + } else if (orientation === "perpendicular") { + textAlign = isSinMinus1 || isCosPositive ? "left" : "right"; + textBaseline = "middle"; + } else { + textAlign = "right"; + if (isCos0) { + textAlign = "center"; + } else if (isCosPositive) { + textAlign = "left"; + } + textBaseline = "bottom"; + if (isSin0) { + textBaseline = "middle"; + } else if (isSinPositive) { + textBaseline = "top"; + } + } + return { textAlign, textBaseline }; + } + updateCrossLines() { + const { shape, gridLength: radius, innerRadiusRatio } = this; + for (const crossLine of this.crossLines) { + if (crossLine instanceof AngleCrossLine) { + crossLine.ticks = this.tickData.map((t) => t.value); + crossLine.shape = shape; + crossLine.axisOuterRadius = radius; + crossLine.axisInnerRadius = radius * innerRadiusRatio; + } + } + super.updateCrossLines(); + } +}; +AngleAxis.CrossLineConstructor = AngleCrossLine; +__decorateClass([ + Property3 +], AngleAxis.prototype, "startAngle", 2); +__decorateClass([ + Property3 +], AngleAxis.prototype, "endAngle", 2); + +// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxis.ts +var { Property: Property4, CategoryScale } = _ModuleSupport5; +var AngleCategoryAxis = class extends AngleAxis { + constructor(moduleCtx) { + super(moduleCtx, new CategoryScale()); + this.groupPaddingInner = 0; + this.paddingInner = 0; + this.interval = new AngleAxisInterval(); + } + hasDefinedDomain() { + return false; + } + generateAngleTicks(domain) { + const { scale, gridLength: radius } = this; + const { values, minSpacing } = this.interval; + const tickParams = { + nice: this.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + const ticks = values ?? scale.ticks(tickParams, domain)?.ticks ?? []; + if (ticks.length < 2 || minSpacing == null) { + return ticks.map((value) => { + return { value, visible: true }; + }); + } + const startTick = ticks[0]; + const startAngle = scale.convert(startTick); + const startX = radius * Math.cos(startAngle); + const startY = radius * Math.sin(startAngle); + for (let step = 1; step < ticks.length - 1; step++) { + const nextTick = ticks[step]; + const nextAngle = scale.convert(nextTick); + if (nextAngle - startAngle > Math.PI) { + break; + } + const nextX = radius * Math.cos(nextAngle); + const nextY = radius * Math.sin(nextAngle); + const spacing = Math.hypot(nextX - startX, nextY - startY); + if (spacing > minSpacing) { + const visibleTicks = /* @__PURE__ */ new Set([startTick]); + loopSymmetrically(ticks, step, (_, next) => { + visibleTicks.add(next); + }); + return ticks.map((value) => { + const visible = visibleTicks.has(value); + return { value, visible }; + }); + } + } + return [{ value: startTick, visible: true }]; + } + avoidLabelCollisions(labelData) { + const { minSpacing } = this.label; + if (labelData.length < 3) + return; + const labelsCollide = (prev, next) => { + if (prev.hidden || next.hidden) { + return false; + } else if (minSpacing == null) { + return prev.box.collidesBBox(next.box); + } + const prevBox = prev.box.clone().grow(minSpacing / 2); + const nextBox = next.box.clone().grow(minSpacing / 2); + return prevBox.collidesBBox(nextBox); + }; + const firstLabel = labelData[0]; + const lastLabel = labelData.at(-1); + const visibleLabels = /* @__PURE__ */ new Set([firstLabel]); + const lastLabelIsOverFirst = isNumberEqual3(firstLabel.x, lastLabel.x) && isNumberEqual3(firstLabel.y, lastLabel.y); + const maxStep = Math.floor(labelData.length / 2); + for (let step = 1; step <= maxStep; step++) { + const labels = lastLabelIsOverFirst ? labelData.slice(0, -1) : labelData; + const collisionDetected = loopSymmetrically(labels, step, labelsCollide); + if (!collisionDetected) { + loopSymmetrically(labels, step, (_, next) => { + visibleLabels.add(next); + }); + break; + } + } + for (const datum of labelData) { + if (!visibleLabels.has(datum)) { + datum.hidden = true; + datum.box = void 0; + } + } + } + tickFormatParams() { + return { type: "category" }; + } + datumFormatParams(value, params) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +AngleCategoryAxis.className = "AngleCategoryAxis"; +AngleCategoryAxis.type = "angle-category"; +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "paddingInner", 2); +__decorateClass([ + Property4 +], AngleCategoryAxis.prototype, "interval", 2); + +// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxisModule.ts +var AngleCategoryAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "angle-category", + moduleFactory: (ctx) => new AngleCategoryAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/axes/angle-number/angleNumberAxis.ts +import { _ModuleSupport as _ModuleSupport7 } from "ag-charts-community"; +import { isNumberEqual as isNumberEqual5 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/axes/angle-number/linearAngleScale.ts +import { _ModuleSupport as _ModuleSupport6 } from "ag-charts-community"; +import { isNumberEqual as isNumberEqual4 } from "ag-charts-core"; +var { range, isDenseInterval, LinearScale } = _ModuleSupport6; +var LinearAngleScale = class _LinearAngleScale extends LinearScale { + constructor() { + super(...arguments); + this.arcLength = 0; + } + static getNiceStepAndTickCount(ticks, domain) { + const [start, stop] = domain; + let step = LinearScale.getTickStep(start, stop, ticks); + const maxTickCount = Number.isNaN(ticks.maxTickCount) ? Infinity : ticks.maxTickCount; + const expectedTickCount = Math.abs(stop - start) / step; + let niceTickCount = Math.pow(2, Math.ceil(Math.log(expectedTickCount) / Math.log(2))); + if (niceTickCount > maxTickCount) { + niceTickCount /= 2; + step *= 2; + } + return { count: niceTickCount, step }; + } + ticks(ticks, domain = this.domain) { + const { arcLength } = this; + if (!domain || domain.length < 2 || domain.some((d) => !Number.isFinite(d)) || arcLength <= 0) { + return { ticks: [], count: 0 }; + } + const { nice, interval } = ticks; + const [d0, d1] = domain; + if (interval) { + const step2 = Math.abs(interval); + const availableRange = this.getPixelRange(); + if (!isDenseInterval((d1 - d0) / step2, availableRange)) { + return range(d0, d1, step2); + } + } + let step; + if (nice && this.hasNiceRange()) { + const linearNiceDomain = super.niceDomain(ticks, domain); + step = _LinearAngleScale.getNiceStepAndTickCount(ticks, linearNiceDomain).step; + } else { + step = LinearScale.getTickStep(d0, d1, ticks); + } + return range(d0, d1, step); + } + hasNiceRange() { + const sortedRange = this.range.slice().sort((a, b) => a - b); + const niceRanges = [Math.PI, 2 * Math.PI]; + return niceRanges.some((r) => isNumberEqual4(r, sortedRange[1] - sortedRange[0])); + } + niceDomain(ticks, domain = this.domain) { + const linearNiceDomain = super.niceDomain(ticks, domain); + if (!this.hasNiceRange()) + return linearNiceDomain; + const reversed = linearNiceDomain[0] > linearNiceDomain[1]; + const start = reversed ? linearNiceDomain[1] : linearNiceDomain[0]; + const { step, count } = _LinearAngleScale.getNiceStepAndTickCount(ticks, linearNiceDomain); + const s = 1 / step; + const stop = step >= 1 ? Math.ceil(start / step + count) * step : Math.ceil((start + count * step) * s) / s; + return reversed ? [stop, start] : [start, stop]; + } + getPixelRange() { + return this.arcLength; + } +}; + +// packages/ag-charts-enterprise/src/axes/angle-number/angleNumberAxis.ts +var { Property: Property5, angleBetween, normalisedExtentWithMetadata, findMinMax } = _ModuleSupport7; +var AngleNumberAxis = class extends AngleAxis { + constructor(moduleCtx) { + super(moduleCtx, new LinearAngleScale()); + this.shape = "circle"; + this.interval = new AngleAxisInterval(); + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata(d, min, max); + return { domain: extent3, clipped }; + } + updateScale() { + super.updateScale(); + this.scale.arcLength = this.getRangeArcLength(); + } + getRangeArcLength() { + const { range: requestedRange } = this; + const min = Math.min(...requestedRange); + const max = Math.max(...requestedRange); + const rotation = angleBetween(min, max) || 2 * Math.PI; + const radius = this.gridLength; + return rotation * radius; + } + generateAngleTicks(domain) { + const { scale, range: requestedRange, nice } = this; + const { values, step, minSpacing, maxSpacing } = this.interval; + let rawTicks; + if (values == null) { + const { arcLength } = scale; + const minTickCount = maxSpacing ? Math.floor(arcLength / maxSpacing) : 1; + const maxTickCount = minSpacing ? Math.floor(arcLength / minSpacing) : Infinity; + const preferredTickCount = Math.floor(4 / Math.PI * Math.abs(requestedRange[0] - requestedRange[1])); + const tickCount = Math.max(minTickCount, Math.min(maxTickCount, preferredTickCount)); + const tickParams = { + nice, + interval: step, + tickCount, + minTickCount, + maxTickCount + }; + rawTicks = scale.ticks(tickParams, domain)?.ticks ?? []; + } else { + const [d0, d1] = findMinMax(domain.map(Number)); + rawTicks = values.filter((value) => value >= d0 && value <= d1).sort((a, b) => a - b); + } + return rawTicks.map((value) => ({ value, visible: true })); + } + avoidLabelCollisions(labelData) { + const { minSpacing } = this.label; + const labelsCollide = (prev, next) => { + if (prev.hidden || next.hidden) { + return false; + } else if (minSpacing == null) { + return prev.box.collidesBBox(next.box); + } + const prevBox = prev.box.clone().grow(minSpacing / 2); + const nextBox = next.box.clone().grow(minSpacing / 2); + return prevBox.collidesBBox(nextBox); + }; + const firstLabel = labelData[0]; + const lastLabel = labelData.at(-1); + if (firstLabel !== lastLabel && isNumberEqual5(firstLabel.x, lastLabel.x) && isNumberEqual5(firstLabel.y, lastLabel.y)) { + lastLabel.hidden = true; + } + for (let step = 1; step < labelData.length; step *= 2) { + let collisionDetected = false; + for (let i = step; i < labelData.length; i += step) { + const next = labelData[i]; + const prev = labelData[i - step]; + if (labelsCollide(prev, next)) { + collisionDetected = true; + break; + } + } + if (!collisionDetected) { + for (const [i, datum] of labelData.entries()) { + if (i % step > 0) { + datum.hidden = true; + datum.box = void 0; + } + } + return; + } + } + for (const [i, datum] of labelData.entries()) { + if (i > 0) { + datum.hidden = true; + datum.box = void 0; + } + } + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +AngleNumberAxis.className = "AngleNumberAxis"; +AngleNumberAxis.type = "angle-number"; +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "min", 2); +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "max", 2); +__decorateClass([ + Property5 +], AngleNumberAxis.prototype, "interval", 2); + +// packages/ag-charts-enterprise/src/axes/angle-number/angleNumberAxisModule.ts +var AngleNumberAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "angle-number", + moduleFactory: (ctx) => new AngleNumberAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/axes/ordinal/ordinalTimeAxis.ts +import { + _ModuleSupport as _ModuleSupport8 +} from "ag-charts-community"; +var { + OrdinalTimeScale, + Property: Property6, + TimeAxisParentLevel, + lowestGranularityUnitForTicks, + lowestGranularityUnitForValue, + minimumTimeAxisDatumGranularity, + dateTruncationForDomain, + intervalUnit, + intervalStep, + intervalEpoch, + intervalMilliseconds +} = _ModuleSupport8; +var OrdinalTimeAxis = class extends _ModuleSupport8.DiscreteTimeAxis { + constructor(moduleCtx) { + super(moduleCtx, new OrdinalTimeScale()); + this.parentLevel = new TimeAxisParentLevel(); + } + get primaryLabel() { + return this.parentLevel.enabled ? this.parentLevel.label : void 0; + } + get primaryTick() { + return this.parentLevel.enabled ? this.parentLevel.tick : void 0; + } + processData() { + super.processData(); + const { boundSeries, direction } = this; + this.minimumTimeGranularity = minimumTimeAxisDatumGranularity(boundSeries, direction, void 0, void 0); + } + tickFormatParams(domain, ticks, _fractionDigits, timeInterval) { + timeInterval ?? (timeInterval = lowestGranularityUnitForTicks(ticks)); + const truncateDate = dateTruncationForDomain(domain); + const unit = intervalUnit(timeInterval); + const step = intervalStep(timeInterval); + const epoch = intervalEpoch(timeInterval); + return { type: "date", unit, step, epoch, truncateDate }; + } + datumFormatParams(value, params, _fractionDigits, timeInterval, style) { + if (typeof value === "number") + value = new Date(value); + if (timeInterval == null) { + const { minimumTimeGranularity } = this; + const datumGranularity = lowestGranularityUnitForValue(value); + if (minimumTimeGranularity != null && intervalMilliseconds(minimumTimeGranularity) < intervalMilliseconds(datumGranularity)) { + timeInterval = minimumTimeGranularity; + } else { + timeInterval = datumGranularity; + } + } + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + const unit = intervalUnit(timeInterval); + const step = intervalStep(timeInterval); + const epoch = intervalEpoch(timeInterval); + return { + type: "date", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + unit, + step, + epoch, + style + }; + } +}; +OrdinalTimeAxis.className = "OrdinalTimeAxis"; +OrdinalTimeAxis.type = "ordinal-time"; +__decorateClass([ + Property6 +], OrdinalTimeAxis.prototype, "parentLevel", 2); + +// packages/ag-charts-enterprise/src/axes/ordinal/ordinalTimeAxisModule.ts +var OrdinalTimeAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "ordinal-time", + moduleFactory: (ctx) => new OrdinalTimeAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/axes/radius-category/radiusCategoryAxis.ts +import { _ModuleSupport as _ModuleSupport11 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/axes/radius/radiusAxis.ts +import { _ModuleSupport as _ModuleSupport10 } from "ag-charts-community"; +import { isNumberEqual as isNumberEqual7 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/axes/polar-crosslines/radiusCrossLine.ts +import { _ModuleSupport as _ModuleSupport9 } from "ag-charts-community"; +import { clamp, isNumberEqual as isNumberEqual6 } from "ag-charts-core"; +var { + ChartAxisDirection: ChartAxisDirection4, + Property: Property7, + validateCrossLineValue: validateCrossLineValue2, + normalizeAngle360FromDegrees, + Group: Group3, + Path: Path3, + Sector: Sector2, + RotatableText: RotatableText3 +} = _ModuleSupport9; +var RadiusCrossLineLabel = class extends PolarCrossLineLabel { + constructor() { + super(...arguments); + this.positionAngle = void 0; + } +}; +__decorateClass([ + Property7 +], RadiusCrossLineLabel.prototype, "positionAngle", 2); +var RadiusCrossLine = class extends PolarCrossLine { + constructor() { + super(); + this.direction = ChartAxisDirection4.Radius; + this.label = new RadiusCrossLineLabel(); + this.polygonNode = new Path3(); + this.sectorNode = new Sector2(); + this.crossLineRange = new Group3(); + this.labelNode = new RotatableText3(); + this.outerRadius = 0; + this.innerRadius = 0; + this.crossLineRange.append(this.polygonNode); + this.crossLineRange.append(this.sectorNode); + this.labelGroup.append(this.labelNode); + } + update(visible) { + const { scale } = this; + if (!scale || !validateCrossLineValue2(this, scale)) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.updateRadii(); + const { innerRadius, outerRadius } = this; + visible && (visible = innerRadius >= this.axisInnerRadius && outerRadius <= this.axisOuterRadius); + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updatePolygonNode(visible); + this.updateSectorNode(visible); + this.updateLabelNode(visible); + this.assignCrossLineGroup(this.type === "range", this.crossLineRange); + } + updateRadii() { + const { range: range2, scale, type, axisInnerRadius, axisOuterRadius } = this; + if (!scale) + return { innerRadius: 0, outerRadius: 0 }; + const getRadius = (value) => axisOuterRadius + axisInnerRadius - value; + let outerRadius, innerRadius; + if (type === "line") { + outerRadius = getRadius(scale.convert(this.value)); + innerRadius = outerRadius; + } else { + const bandwidth = Math.abs(scale?.bandwidth ?? 0); + const convertedRange = range2.map((r) => scale.convert(r)); + outerRadius = getRadius(Math.max(...convertedRange)); + innerRadius = getRadius(Math.min(...convertedRange)) + bandwidth; + } + this.outerRadius = outerRadius; + this.innerRadius = innerRadius; + } + drawPolygon(radius, angles, polygon) { + for (const [index, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + if (index === 0) { + polygon.path.moveTo(x, y); + } else { + polygon.path.lineTo(x, y); + } + } + polygon.path.closePath(); + } + updatePolygonNode(visible) { + const { gridAngles, polygonNode: polygon, scale, shape, type, innerRadius, outerRadius } = this; + if (!visible || shape !== "polygon" || !scale || !gridAngles) { + polygon.visible = false; + return; + } + polygon.visible = true; + const padding = this.getPadding(); + polygon.path.clear(true); + this.drawPolygon(outerRadius - padding, gridAngles, polygon); + const reversedAngles = gridAngles.slice().reverse(); + const innerPolygonRadius = type === "line" ? outerRadius - padding : innerRadius + padding; + this.drawPolygon(innerPolygonRadius, reversedAngles, polygon); + this.setSectorNodeProps(polygon); + } + updateSectorNode(visible) { + const { axisInnerRadius, axisOuterRadius, scale, sectorNode: sector, shape, innerRadius, outerRadius } = this; + if (!visible || shape !== "circle" || !scale) { + sector.visible = false; + return; + } + sector.visible = true; + sector.startAngle = 0; + sector.endAngle = 2 * Math.PI; + const padding = this.getPadding(); + const r0 = clamp(axisInnerRadius, innerRadius + padding, axisOuterRadius); + const r1 = clamp(axisInnerRadius, outerRadius - padding, axisOuterRadius); + sector.innerRadius = Math.min(r0, r1); + sector.outerRadius = Math.max(r0, r1); + this.setSectorNodeProps(sector); + } + updateLabelNode(visible) { + const { innerRadius, label, labelNode: node, scale, shape, type } = this; + if (!visible || label.enabled === false || !label.text || !scale) { + node.visible = false; + return; + } + const angle = normalizeAngle360FromDegrees((label.positionAngle ?? 0) - 90); + const isBottomSide = (isNumberEqual6(angle, 0) || angle > 0) && angle < Math.PI; + const rotation = isBottomSide ? angle - Math.PI / 2 : angle + Math.PI / 2; + let distance; + const angles = this.gridAngles ?? []; + if (type === "line") { + distance = innerRadius + label.padding; + } else if (shape === "circle" || angles.length < 3) { + distance = innerRadius - label.padding; + } else { + distance = innerRadius * Math.cos(Math.PI / angles.length) - label.padding; + } + const labelX = distance * Math.cos(angle); + const labelY = distance * Math.sin(angle); + let textBaseline; + if (type === "line") { + textBaseline = isBottomSide ? "top" : "bottom"; + } else { + textBaseline = isBottomSide ? "bottom" : "top"; + } + this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation); + } + getPadding() { + const { scale } = this; + if (!scale) + return 0; + const bandwidth = Math.abs(scale.bandwidth ?? 0); + const step = Math.abs(scale.step ?? 0); + return scale instanceof _ModuleSupport9.BandScale ? (step - bandwidth) / 2 : 0; + } +}; +RadiusCrossLine.className = "RadiusCrossLine"; + +// packages/ag-charts-enterprise/src/axes/radius/radiusAxis.ts +var { + ChartAxisDirection: ChartAxisDirection5, + ZIndexMap, + Property: Property8, + normalizeAngle360: normalizeAngle3603, + toRadians: toRadians2, + Caption, + Group: Group4, + TransformableGroup, + Path: Path4, + Line: Line2, + Selection: Selection2, + generateTicks, + AxisGroupZIndexMap +} = _ModuleSupport10; +var RadiusAxisLabel = class extends _ModuleSupport10.AxisLabel { + constructor() { + super(...arguments); + this.autoRotateAngle = 335; + } +}; +__decorateClass([ + Property8 +], RadiusAxisLabel.prototype, "autoRotate", 2); +__decorateClass([ + Property8 +], RadiusAxisLabel.prototype, "autoRotateAngle", 2); +var RadiusAxis = class extends _ModuleSupport10.PolarAxis { + constructor(moduleCtx, scale) { + super(moduleCtx, scale); + this.positionAngle = 0; + this.gridLineGroupSelection = Selection2.select( + this.gridLineGroup, + Line2, + false + ); + this.generatedTicks = void 0; + this.headingLabelGroup = this.axisGroup.appendChild( + new TransformableGroup({ name: `${this.id}-Axis-heading` }) + ); + this.lineNodeGroup = this.axisGroup.appendChild( + new TransformableGroup({ name: `${this.id}-Axis-line` }) + ); + this.lineNode = this.lineNodeGroup.appendChild( + new Line2({ + name: `${this.id}-Axis-line`, + zIndex: AxisGroupZIndexMap.AxisLine + }) + ); + this.gridPathGroup = this.gridGroup.appendChild( + new Group4({ + name: `${this.id}-gridPaths`, + zIndex: ZIndexMap.AXIS_GRID + }) + ); + this.gridPathSelection = Selection2.select(this.gridPathGroup, Path4); + this.headingLabelGroup.appendChild(this.title.caption.node); + this.cleanup.register(this.title.caption.registerInteraction(this.moduleCtx, "afterend")); + } + get direction() { + return ChartAxisDirection5.Radius; + } + getAxisTransform() { + const maxRadius = this.scale.range[0]; + const { translation, positionAngle, innerRadiusRatio } = this; + const innerRadius = maxRadius * innerRadiusRatio; + const rotation = toRadians2(positionAngle); + return { + translationX: translation.x, + translationY: translation.y - maxRadius - innerRadius, + rotation, + rotationCenterX: 0, + rotationCenterY: maxRadius + innerRadius + }; + } + update() { + super.update(); + this.updateTitle(); + this.updateGridLines(); + const { enabled, stroke: stroke2, width } = this.line; + this.lineNode.setProperties({ + stroke: stroke2, + strokeWidth: enabled ? width : 0, + x1: 0, + y1: this.range[0], + x2: 0, + y2: this.range[1] + }); + } + updatePosition() { + super.updatePosition(); + const axisTransform = this.getAxisTransform(); + this.tickLineGroup.setProperties(axisTransform); + this.tickLabelGroup.setProperties(axisTransform); + this.lineNodeGroup.setProperties(axisTransform); + this.headingLabelGroup.setProperties(axisTransform); + } + calculateRotations() { + const rotation = 0; + const parallelFlipRotation = 0; + const regularFlipRotation = -Math.PI / 2; + return { rotation, parallelFlipRotation, regularFlipRotation }; + } + calculateTickLayout(domain, niceMode, _visibleRange) { + const visibleRange = [0, 1]; + const sideFlag = this.label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + this.label.spacing + this.seriesAreaPadding); + const { range: range2, reverse, defaultTickMinSpacing } = this; + const tickGenerationResult = generateTicks({ + scale: this.scale, + label: this.label, + interval: this.interval, + tickFormatter: (...args) => this.tickFormatter(...args), + domain, + range: range2, + reverse, + niceMode, + visibleRange, + defaultTickMinSpacing, + labelOffset: labelX, + sideFlag, + axisRotation: 0, + sizeLimit: void 0, + primaryTickCount: void 0 + }); + const { tickData } = tickGenerationResult; + const { ticks, rawTicks, rawTickCount, tickDomain, fractionDigits, niceDomain = domain } = tickData; + const labels = ticks.map((d) => this.getTickLabelProps(d, tickGenerationResult)); + this.generatedTicks = { ticks, labels }; + return { ticks: rawTicks, tickDomain, niceDomain, rawTickCount, fractionDigits, timeInterval: void 0 }; + } + updateSelections() { + const { generatedTicks } = this; + if (!generatedTicks) + return; + const { ticks, labels } = generatedTicks; + this.gridLineGroupSelection.update(this.gridLength ? ticks : []); + this.tickLabelGroupSelection.update(labels); + this.gridPathSelection.update(this.gridLine.enabled ? this.prepareGridPathTickData(ticks) : []); + this.gridLineGroupSelection.cleanup(); + this.tickLabelGroupSelection.cleanup(); + this.gridPathSelection.cleanup(); + } + // TODO - abstract out + updateLabels() { + if (!this.label.enabled) + return; + const axisLabelPositionFn = _ModuleSupport10.resetAxisLabelSelectionFn(); + this.tickLabelGroupSelection.each((node, datum) => { + node.fill = datum.color; + node.text = datum.text; + node.textBaseline = datum.textBaseline; + node.textAlign = datum.textAlign ?? "center"; + node.setFont(datum); + node.setBoxing(datum); + node.setProperties(axisLabelPositionFn(node, datum)); + }); + } + updateGridLines() { + const { + gridLine: { style, width }, + shape, + generatedTicks + } = this; + if (!style || !generatedTicks) { + return; + } + const styleCount = style.length; + const setStyle = (node, index) => { + const { stroke: stroke2, lineDash } = style[index % styleCount]; + node.stroke = stroke2; + node.strokeWidth = width; + node.lineDash = lineDash; + node.fill = void 0; + }; + const [startAngle, endAngle] = this.gridRange ?? [0, 2 * Math.PI]; + const isFullCircle = isNumberEqual7(endAngle - startAngle, 2 * Math.PI); + const drawCircleShape = (node, value) => { + const { path } = node; + path.clear(true); + const radius = this.getTickRadius(value); + if (isFullCircle) { + path.moveTo(radius, 0); + path.arc(0, 0, radius, 0, 2 * Math.PI); + } else { + path.moveTo(radius * Math.cos(startAngle), radius * Math.sin(startAngle)); + path.arc(0, 0, radius, normalizeAngle3603(startAngle), normalizeAngle3603(endAngle)); + } + if (isFullCircle) { + path.closePath(); + } + }; + const drawPolygonShape = (node, value) => { + const { path } = node; + const angles = this.gridAngles; + path.clear(true); + if (!angles || angles.length < 3) { + return; + } + const radius = this.getTickRadius(value); + for (const [idx, angle] of angles.entries()) { + const x = radius * Math.cos(angle); + const y = radius * Math.sin(angle); + if (idx === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + for (const [innerIdx, innerAngle] of angles.entries()) { + const x2 = radius * Math.cos(innerAngle); + const y2 = radius * Math.sin(innerAngle); + if (innerIdx === 0) { + path.moveTo(x2, y2); + } else { + path.lineTo(x2, y2); + } + } + path.closePath(); + } + path.closePath(); + }; + const drawFn = shape === "circle" ? drawCircleShape : drawPolygonShape; + this.gridPathSelection.each((node, value, index) => { + setStyle(node, index); + drawFn(node, value); + }); + } + updateTitle() { + const identityFormatter = (params) => params.defaultValue; + const { title, range: requestedRange } = this; + const { formatter = identityFormatter } = this.title; + title.caption.enabled = title.enabled; + title.caption.fontFamily = title.fontFamily; + title.caption.fontSize = title.fontSize; + title.caption.fontStyle = title.fontStyle; + title.caption.fontWeight = title.fontWeight; + title.caption.color = title.color; + title.caption.wrapping = title.wrapping; + let titleVisible = false; + const titleNode = title.caption.node; + if (title.enabled) { + titleVisible = true; + titleNode.rotation = Math.PI / 2; + titleNode.x = Math.floor((requestedRange[0] + requestedRange[1]) / 2); + titleNode.y = -Caption.SMALL_PADDING; + titleNode.textAlign = "center"; + titleNode.textBaseline = "bottom"; + titleNode.text = this.cachedCallWithContext(formatter, this.getTitleFormatterParams(this.scale.domain)); + } + titleNode.visible = titleVisible; + } + updateCrossLines() { + for (const crossLine of this.crossLines) { + if (crossLine instanceof RadiusCrossLine) { + const { shape, gridAngles, range: range2, innerRadiusRatio } = this; + const radius = range2[0]; + crossLine.shape = shape; + crossLine.gridAngles = gridAngles; + crossLine.axisOuterRadius = radius; + crossLine.axisInnerRadius = radius * innerRadiusRatio; + } + } + super.updateCrossLines(); + } + createLabel() { + return new RadiusAxisLabel(); + } + // TODO - abstract out (shared with cartesian axis) + getTickLabelProps(datum, tickGenerationResult) { + const { label } = this; + const { rotation, textBaseline, textAlign } = tickGenerationResult; + const range2 = this.scale.range; + const text2 = datum.tickLabel ?? ""; + const sideFlag = label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + label.spacing + this.seriesAreaPadding); + const visible = text2 !== "" && text2 != null; + const combinedRotation = rotation; + return { + ...this.getLabelStyles({ value: datum.tick, formattedValue: datum.tickLabel }), + tickId: datum.tickId, + rotation: combinedRotation, + text: text2, + textAlign, + textBaseline, + visible, + x: labelX, + y: datum.translation, + rotationCenterX: labelX, + rotationCenterY: datum.translation, + range: range2 + }; + } +}; +RadiusAxis.CrossLineConstructor = RadiusCrossLine; +__decorateClass([ + Property8 +], RadiusAxis.prototype, "positionAngle", 2); + +// packages/ag-charts-enterprise/src/axes/radius-category/radiusCategoryAxis.ts +var { ProxyPropertyOnWrite, Property: Property9, CategoryScale: CategoryScale2 } = _ModuleSupport11; +var RadiusCategoryAxis = class extends RadiusAxis { + constructor(moduleCtx) { + super(moduleCtx, new CategoryScale2()); + this.shape = "circle"; + this.groupPaddingInner = 0; + this.paddingInner = 0; + this.paddingOuter = 0; + } + hasDefinedDomain() { + return false; + } + normaliseDataDomain(domain) { + return { domain, clipped: false }; + } + prepareGridPathTickData(data) { + return data.slice().reverse(); + } + getTickRadius(tickDatum) { + const { scale, innerRadiusRatio } = this; + const maxRadius = scale.range[0]; + const minRadius = maxRadius * innerRadiusRatio; + if (CategoryScale2.is(scale)) { + const ticks = scale.domain; + const index = ticks.length - 1 - ticks.indexOf(tickDatum.tick); + return index === 0 ? minRadius : scale.inset + scale.step * (index - 0.5) + scale.bandwidth / 2; + } else { + const tickRange = (maxRadius - minRadius) / scale.domain.length; + return maxRadius - tickDatum.translation + minRadius - tickRange / 2; + } + } + tickFormatParams() { + return { type: "category" }; + } + datumFormatParams(value, params) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +RadiusCategoryAxis.className = "RadiusCategoryAxis"; +RadiusCategoryAxis.type = "radius-category"; +__decorateClass([ + Property9 +], RadiusCategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass([ + ProxyPropertyOnWrite("scale", "paddingInner"), + Property9 +], RadiusCategoryAxis.prototype, "paddingInner", 2); +__decorateClass([ + ProxyPropertyOnWrite("scale", "paddingOuter"), + Property9 +], RadiusCategoryAxis.prototype, "paddingOuter", 2); + +// packages/ag-charts-enterprise/src/axes/radius-category/radiusCategoryAxisModule.ts +var RadiusCategoryAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radius-category", + moduleFactory: (ctx) => new RadiusCategoryAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/axes/radius-number/radiusNumberAxis.ts +import { _ModuleSupport as _ModuleSupport12 } from "ag-charts-community"; +var { Property: Property10, normalisedExtentWithMetadata: normalisedExtentWithMetadata2, LinearScale: LinearScale2 } = _ModuleSupport12; +var RadiusNumberAxis = class extends RadiusAxis { + constructor(moduleCtx) { + super(moduleCtx, new LinearScale2()); + this.shape = "polygon"; + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + prepareGridPathTickData(data) { + const { scale } = this; + const domainTop = scale.domain[1]; + return data.filter(({ tick }) => tick !== domainTop).sort((a, b) => b.tick - a.tick); + } + getTickRadius(tickDatum) { + const { scale } = this; + const maxRadius = scale.range[0]; + const minRadius = maxRadius * this.innerRadiusRatio; + return maxRadius - tickDatum.translation + minRadius; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata2(d, min, max); + return { domain: extent3, clipped }; + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +RadiusNumberAxis.className = "RadiusNumberAxis"; +RadiusNumberAxis.type = "radius-number"; +__decorateClass([ + Property10 +], RadiusNumberAxis.prototype, "min", 2); +__decorateClass([ + Property10 +], RadiusNumberAxis.prototype, "max", 2); + +// packages/ag-charts-enterprise/src/axes/radius-number/radiusNumberAxisModule.ts +var RadiusNumberAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radius-number", + moduleFactory: (ctx) => new RadiusNumberAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/features/animation/animation.ts +import { _ModuleSupport as _ModuleSupport13 } from "ag-charts-community"; +var { ObserveChanges, Property: Property11 } = _ModuleSupport13; +var Animation = class extends _ModuleSupport13.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + ctx.animationManager.skip(false); + this.cleanup.register(() => { + ctx.animationManager.skip(true); + }); + } +}; +__decorateClass([ + ObserveChanges((target, newValue) => { + target.ctx.animationManager.skip(!newValue); + }), + Property11 +], Animation.prototype, "enabled", 2); +__decorateClass([ + ObserveChanges((target, newValue) => { + target.ctx.animationManager.defaultDuration = newValue; + }), + Property11 +], Animation.prototype, "duration", 2); +__decorateClass([ + ObserveChanges((target, newValue) => { + target.ctx.animationManager.maxAnimatableItems = newValue ?? Infinity; + }), + Property11 +], Animation.prototype, "maxAnimatableItems", 2); + +// packages/ag-charts-enterprise/src/features/animation/animationModule.ts +var AnimationModule = { + type: "root", + optionsKey: "animation", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Animation(ctx), + themeTemplate: { + animation: { + enabled: true, + maxAnimatableItems: 1e3 + } + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotations.ts +import { + _ModuleSupport as _ModuleSupport88 +} from "ag-charts-community"; +import { isValidDate } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/text-input/textInput.ts +import { _ModuleSupport as _ModuleSupport14 } from "ag-charts-community"; +import { attachListener, setAttributes } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/text-input/textInputTemplate.html +var textInputTemplate_default = '
'; + +// packages/ag-charts-enterprise/src/features/text-input/textInput.ts +var { focusCursorAtEnd } = _ModuleSupport14; +var moduleId = "text-input"; +var canvasOverlay = "canvas-overlay"; +var TextInput = class extends _ModuleSupport14.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.layout = { + getTextInputCoords: () => ({ x: 0, y: 0 }), + getTextPosition: () => "center", + alignment: "center", + textAlign: "center" + }; + this.visible = false; + this.element = ctx.domManager.addChild(canvasOverlay, moduleId); + this.element.classList.add("ag-charts-text-input"); + this.cleanup.register(() => ctx.domManager.removeChild(canvasOverlay, moduleId)); + } + setKeyDownHandler(handler) { + this.cleanup.register(attachListener(this.element, "keydown", handler)); + } + show(opts) { + this.element.innerHTML = textInputTemplate_default; + const textArea = this.element.firstElementChild; + setAttributes(textArea, { + role: "textbox", + // AG-15233 + "data-preventdefault": false + // AG-13715 + }); + if (!textArea.isContentEditable) { + textArea.contentEditable = "true"; + } + textArea.setAttribute( + "placeholder", + this.ctx.localeManager.t(opts.placeholderText ?? "inputTextareaPlaceholder") + ); + if (opts.styles?.placeholderColor) { + textArea.style.setProperty("--placeholder-text-color", opts.styles?.placeholderColor); + } + textArea.innerText = opts.text ?? ""; + textArea.style.color = opts.styles?.color ?? "inherit"; + textArea.style.fontFamily = opts.styles?.fontFamily ?? "inherit"; + textArea.style.fontSize = opts.styles?.fontSize ? `${opts.styles.fontSize}px` : "inherit"; + textArea.style.fontStyle = opts.styles?.fontStyle ?? "inherit"; + textArea.style.fontWeight = typeof opts.styles?.fontWeight === "number" ? `${opts.styles.fontWeight}` : opts.styles?.fontWeight ?? "inherit"; + focusCursorAtEnd(textArea); + textArea.addEventListener("input", () => { + this.updatePosition(); + opts.onChange?.(this.getValue(), this.getBBox()); + }); + textArea.addEventListener("click", (event) => { + event.stopPropagation(); + }); + if (opts.layout) { + this.layout = opts.layout; + this.updatePosition(); + } + opts.onChange?.(this.getValue(), this.getBBox()); + this.visible = true; + } + hide() { + this.element.innerHTML = ""; + this.layout = { + getTextInputCoords: () => ({ x: 0, y: 0 }), + getTextPosition: () => "center", + alignment: "center", + textAlign: "center" + }; + this.visible = false; + } + isVisible() { + return this.visible; + } + updateColor(color6) { + if (!this.element.firstElementChild) + return; + this.element.firstElementChild.style.color = color6; + } + updateFontSize(fontSize) { + if (!this.element.firstElementChild) + return; + this.element.firstElementChild.style.fontSize = `${fontSize}px`; + this.updatePosition(); + return this.getBBox(); + } + getValue() { + if (!this.element.firstElementChild) + return; + return this.element.firstElementChild.innerText.trim(); + } + updatePosition() { + const { element } = this; + const textArea = element.firstElementChild; + if (!textArea) + return; + const sceneRect = this.ctx.domManager.getBoundingClientRect(); + const { width, getTextInputCoords, getTextPosition, alignment, textAlign } = this.layout; + element.style.setProperty("width", width ? `${width}px` : "unset"); + const textRect = textArea.getBoundingClientRect(); + const point = getTextInputCoords(textRect.height); + let horizontalPosition = point.x; + if (alignment === "center") { + horizontalPosition -= (width ?? textRect.width) / 2; + } else if (alignment === "right") { + horizontalPosition -= width ?? textRect.width; + } + const position = getTextPosition(); + let verticalPosition = point.y; + if (position === "center") { + verticalPosition -= textRect.height / 2; + } else if (position === "bottom") { + verticalPosition -= textRect.height; + } + element.style.setProperty("top", `${verticalPosition}px`); + element.style.setProperty("left", `${horizontalPosition}px`); + element.style.setProperty("max-width", `${sceneRect.width - horizontalPosition}px`); + element.style.setProperty("text-align", alignment); + textArea.style.setProperty("text-align", textAlign); + } + getBBox() { + const { left, top, width, height } = this.element.getBoundingClientRect(); + return new _ModuleSupport14.BBox(left, top, width, height); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotationAxesButtons.ts +import { _ModuleSupport as _ModuleSupport15 } from "ag-charts-community"; +var { BaseProperties: BaseProperties2, Property: Property12 } = _ModuleSupport15; +var AxesButtons = class extends BaseProperties2 { + constructor() { + super(...arguments); + this.enabled = false; + this.axes = "y"; + } +}; +__decorateClass([ + Property12 +], AxesButtons.prototype, "enabled", 2); +__decorateClass([ + Property12 +], AxesButtons.prototype, "axes", 2); + +// packages/ag-charts-enterprise/src/features/annotations/annotationDefaults.ts +import { _ModuleSupport as _ModuleSupport35 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/annotationTypes.ts +var AnnotationType = /* @__PURE__ */ ((AnnotationType3) => { + AnnotationType3["Line"] = "line"; + AnnotationType3["HorizontalLine"] = "horizontal-line"; + AnnotationType3["VerticalLine"] = "vertical-line"; + AnnotationType3["DisjointChannel"] = "disjoint-channel"; + AnnotationType3["ParallelChannel"] = "parallel-channel"; + AnnotationType3["FibonacciRetracement"] = "fibonacci-retracement"; + AnnotationType3["FibonacciRetracementTrendBased"] = "fibonacci-retracement-trend-based"; + AnnotationType3["Callout"] = "callout"; + AnnotationType3["Comment"] = "comment"; + AnnotationType3["Note"] = "note"; + AnnotationType3["Text"] = "text"; + AnnotationType3["Arrow"] = "arrow"; + AnnotationType3["ArrowUp"] = "arrow-up"; + AnnotationType3["ArrowDown"] = "arrow-down"; + AnnotationType3["DateRange"] = "date-range"; + AnnotationType3["PriceRange"] = "price-range"; + AnnotationType3["DatePriceRange"] = "date-price-range"; + AnnotationType3["QuickDatePriceRange"] = "quick-date-price-range"; + return AnnotationType3; +})(AnnotationType || {}); +var ANNOTATION_TYPES = Object.values(AnnotationType); +function stringToAnnotationType(value) { + for (const t of ANNOTATION_TYPES) { + if (t === value) + return t; + } +} + +// packages/ag-charts-enterprise/src/features/annotations/utils/has.ts +import { isObject as isObject12 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutProperties.ts +import { _ModuleSupport as _ModuleSupport19 } from "ag-charts-community"; +import { isObject } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/annotationProperties.ts +import { _ModuleSupport as _ModuleSupport16 } from "ag-charts-community"; +import { generateUUID } from "ag-charts-core"; +var { BaseProperties: BaseProperties3, FONT_SIZE: FONT_SIZE2, Property: Property13 } = _ModuleSupport16; +var PointProperties = class extends BaseProperties3 { +}; +__decorateClass([ + Property13 +], PointProperties.prototype, "x", 2); +__decorateClass([ + Property13 +], PointProperties.prototype, "y", 2); +var ChannelAnnotationMiddleProperties = class extends Stroke(LineStyle(Visible(BaseProperties3))) { +}; +var AxisLabelProperties = class extends Stroke(LineStyle(Fill(Label(Font(BaseProperties3))))) { + constructor() { + super(...arguments); + this.cornerRadius = 2; + } +}; +__decorateClass([ + Property13 +], AxisLabelProperties.prototype, "enabled", 2); +__decorateClass([ + Property13 +], AxisLabelProperties.prototype, "cornerRadius", 2); +var BackgroundProperties = class extends Fill(BaseProperties3) { +}; +var HandleProperties = class extends Stroke(LineStyle(Fill(BaseProperties3))) { +}; +var LineTextProperties = class extends Font(BaseProperties3) { + constructor() { + super(...arguments); + this.label = ""; + this.position = "top"; + this.alignment = "left"; + } +}; +__decorateClass([ + Property13 +], LineTextProperties.prototype, "label", 2); +__decorateClass([ + Property13 +], LineTextProperties.prototype, "position", 2); +__decorateClass([ + Property13 +], LineTextProperties.prototype, "alignment", 2); +var LabelTextProperties = class extends Font(BaseProperties3) { +}; +var ChannelTextProperties = class extends Font(BaseProperties3) { + constructor() { + super(...arguments); + this.label = ""; + } +}; +__decorateClass([ + Property13 +], ChannelTextProperties.prototype, "label", 2); +__decorateClass([ + Property13 +], ChannelTextProperties.prototype, "position", 2); +__decorateClass([ + Property13 +], ChannelTextProperties.prototype, "alignment", 2); +function Annotation(Parent) { + class AnnotationInternal extends Writeable(Visible(Parent)) { + constructor() { + super(...arguments); + // A uuid is required, over the usual incrementing index, as annotations can be restored from external databases + this.id = generateUUID(); + } + } + return AnnotationInternal; +} +function Line3(Parent) { + class LineInternal extends Parent { + constructor() { + super(...arguments); + this.start = new PointProperties(); + this.end = new PointProperties(); + } + } + __decorateClass([ + Property13 + ], LineInternal.prototype, "start", 2); + __decorateClass([ + Property13 + ], LineInternal.prototype, "end", 2); + return LineInternal; +} +function Point(Parent) { + class PointInternal extends Parent { + } + __decorateClass([ + Property13 + ], PointInternal.prototype, "x", 2); + __decorateClass([ + Property13 + ], PointInternal.prototype, "y", 2); + return PointInternal; +} +function Value(Parent) { + class ValueInternal extends Parent { + } + __decorateClass([ + Property13 + ], ValueInternal.prototype, "value", 2); + return ValueInternal; +} +function Background(Parent) { + class BackgroundInternal extends Parent { + constructor() { + super(...arguments); + this.background = new BackgroundProperties(); + } + } + __decorateClass([ + Property13 + ], BackgroundInternal.prototype, "background", 2); + return BackgroundInternal; +} +function Handle(Parent) { + class HandleInternal extends Parent { + constructor() { + super(...arguments); + this.handle = new HandleProperties(); + } + } + __decorateClass([ + Property13 + ], HandleInternal.prototype, "handle", 2); + return HandleInternal; +} +function AxisLabel(Parent) { + class AxisLabelInternal extends Parent { + constructor() { + super(...arguments); + this.axisLabel = new AxisLabelProperties(); + } + } + __decorateClass([ + Property13 + ], AxisLabelInternal.prototype, "axisLabel", 2); + return AxisLabelInternal; +} +function Label(Parent) { + class LabelInternal extends Parent { + constructor() { + super(...arguments); + this.padding = void 0; + this.textAlign = "center"; + this.formatter = void 0; + } + // TODO: making this generic causes issues with mixins sequence + } + __decorateClass([ + Property13 + ], LabelInternal.prototype, "padding", 2); + __decorateClass([ + Property13 + ], LabelInternal.prototype, "textAlign", 2); + __decorateClass([ + Property13 + ], LabelInternal.prototype, "formatter", 2); + return LabelInternal; +} +function Cappable(Parent) { + class CappableInternal extends Parent { + } + return CappableInternal; +} +function Extendable(Parent) { + class ExtendableInternal extends Parent { + } + __decorateClass([ + Property13 + ], ExtendableInternal.prototype, "extendStart", 2); + __decorateClass([ + Property13 + ], ExtendableInternal.prototype, "extendEnd", 2); + return ExtendableInternal; +} +function Writeable(Parent) { + class WriteableInternal extends Parent { + isWriteable() { + return !this.locked && !this.readOnly; + } + isHoverable() { + return !this.readOnly; + } + } + __decorateClass([ + Property13 + ], WriteableInternal.prototype, "locked", 2); + __decorateClass([ + Property13 + ], WriteableInternal.prototype, "readOnly", 2); + return WriteableInternal; +} +function Localisable(Parent) { + class LocalisableInternal extends Parent { + setLocaleManager(localeManager) { + this.localeManager ?? (this.localeManager = localeManager); + } + } + return LocalisableInternal; +} +function Visible(Parent) { + class VisibleInternal extends Parent { + } + __decorateClass([ + Property13 + ], VisibleInternal.prototype, "visible", 2); + return VisibleInternal; +} +function Fill(Parent) { + class FillInternal extends Parent { + } + __decorateClass([ + Property13 + ], FillInternal.prototype, "fill", 2); + __decorateClass([ + Property13 + ], FillInternal.prototype, "fillOpacity", 2); + return FillInternal; +} +function Stroke(Parent) { + class StrokeInternal extends Parent { + } + __decorateClass([ + Property13 + ], StrokeInternal.prototype, "stroke", 2); + __decorateClass([ + Property13 + ], StrokeInternal.prototype, "strokeOpacity", 2); + __decorateClass([ + Property13 + ], StrokeInternal.prototype, "strokeWidth", 2); + return StrokeInternal; +} +function LineStyle(Parent) { + class LineDashInternal extends Parent { + constructor() { + super(...arguments); + this.lineCap = void 0; + this.computedLineDash = void 0; + } + } + __decorateClass([ + Property13 + ], LineDashInternal.prototype, "lineDash", 2); + __decorateClass([ + Property13 + ], LineDashInternal.prototype, "lineDashOffset", 2); + __decorateClass([ + Property13 + ], LineDashInternal.prototype, "lineStyle", 2); + return LineDashInternal; +} +function Font(Parent) { + class FontInternal extends Parent { + constructor() { + super(...arguments); + this.fontSize = FONT_SIZE2.SMALL; + this.fontFamily = "Verdana, sans-serif"; + } + } + __decorateClass([ + Property13 + ], FontInternal.prototype, "fontStyle", 2); + __decorateClass([ + Property13 + ], FontInternal.prototype, "fontWeight", 2); + __decorateClass([ + Property13 + ], FontInternal.prototype, "fontSize", 2); + __decorateClass([ + Property13 + ], FontInternal.prototype, "fontFamily", 2); + __decorateClass([ + Property13 + ], FontInternal.prototype, "color", 2); + return FontInternal; +} + +// packages/ag-charts-enterprise/src/features/annotations/properties/textualStartEndProperties.ts +import { _ModuleSupport as _ModuleSupport18 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/utils/scale.ts +import { isDate, isNumber, isString } from "ag-charts-core"; +function getGrouping(d) { + if (isNumber(d) || isString(d) || isDate(d)) { + return { value: d, groupPercentage: 0 }; + } + return d ?? { value: void 0, groupPercentage: 0 }; +} +function getGroupingValue(d) { + return getGrouping(d)?.value; +} + +// packages/ag-charts-enterprise/src/features/annotations/utils/values.ts +function convertLine(datum, context) { + if (datum.start == null || datum.end == null) + return; + const start = convertPoint(datum.start, context); + const end = convertPoint(datum.end, context); + if (start == null || end == null) + return; + return { x1: start.x, y1: start.y, x2: end.x, y2: end.y }; +} +function convertPoint(point, context) { + const x = convert(point.x, context.xAxis); + const y = convert(point.y, context.yAxis); + return { x, y }; +} +function convert(p, context) { + if (p == null) + return 0; + const { value, groupPercentage } = getGrouping(p); + const { scale, snapToGroup } = context; + const width = scale.bandwidth === 0 ? scale.step ?? 0 : scale.bandwidth ?? 0; + const offset = snapToGroup ? width / 2 : width * groupPercentage; + return scale.convert(value) + offset; +} +function invertCoords(coords, context) { + const x = invert(coords.x, context.xAxis); + const y = invert(coords.y, context.yAxis); + return { x, y }; +} +function invert(n, context) { + const { scale } = context; + if (context.continuous && scale.step == null) { + return context.scaleInvert(n); + } + const value = context.scaleInvertNearest(n); + const width = scale.bandwidth === 0 ? scale.step : scale.bandwidth ?? 0; + const bandStart = scale.convert(value); + const bandEnd = bandStart + width; + const groupPercentage = bandStart === bandEnd ? 0 : (n - bandStart) / (bandEnd - bandStart); + return { value, groupPercentage }; +} + +// packages/ag-charts-enterprise/src/features/annotations/properties/startEndProperties.ts +import { _ModuleSupport as _ModuleSupport17 } from "ag-charts-community"; +var { BaseProperties: BaseProperties4 } = _ModuleSupport17; +var StartEndProperties = class extends Annotation(Line3(Handle(BaseProperties4))) { + constructor() { + super(...arguments); + this.snapToAngle = 45; + } + getDefaultColor(_colorPickerType) { + return void 0; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/properties/textualStartEndProperties.ts +var { Property: Property14 } = _ModuleSupport18; +var TextualStartEndProperties = class extends Localisable(Label(Font(StartEndProperties))) { + constructor() { + super(...arguments); + this.text = ""; + this.position = "top"; + this.alignment = "left"; + this.placement = "inside"; + this.placeholderText = "inputTextareaPlaceholder"; + } + getDefaultColor(_colorPickerType) { + return this.color; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } + getPlaceholderColor() { + return void 0; + } + getPadding() { + const { padding = 0 } = this; + return { + top: padding, + right: padding, + bottom: padding, + left: padding + }; + } + getText() { + const isPlaceholder = this.text.length == 0; + let text2 = this.text; + if (isPlaceholder) { + text2 = this.placeholderText ?? ""; + if (this.localeManager) + text2 = this.localeManager.t(text2); + } + return { + text: text2, + isPlaceholder + }; + } + getTextInputCoords(context, _height) { + return convertPoint(this.end, context); + } + getTextPosition() { + return this.position; + } +}; +__decorateClass([ + Property14 +], TextualStartEndProperties.prototype, "text", 2); + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutProperties.ts +var { Property: Property15, Color } = _ModuleSupport19; +var DEFAULT_CALLOUT_PADDING = { + top: 6, + right: 12, + bottom: 9, + left: 12 +}; +var CalloutProperties = class extends Fill(Stroke(TextualStartEndProperties)) { + constructor() { + super(...arguments); + this.type = "callout" /* Callout */; + this.position = "bottom"; + this.alignment = "left"; + } + static is(value) { + return isObject(value) && value.type === "callout" /* Callout */; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fill; + case `line-color`: + return this.stroke; + case `text-color`: + default: + return this.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fillOpacity; + case `line-color`: + return this.strokeOpacity; + case `text-color`: + default: + return void 0; + } + } + getPlaceholderColor() { + const { r, g, b } = Color.fromString(this.color ?? "#888888"); + return new Color(r, g, b, 0.66).toString(); + } + getPadding() { + const { padding } = this; + if (padding == null) { + return { ...DEFAULT_CALLOUT_PADDING }; + } + return { + top: padding, + right: padding, + bottom: padding, + left: padding + }; + } + getTextInputCoords(context, height) { + const coords = super.getTextInputCoords(context, height); + const padding = this.getPadding(); + const paddingLeft = padding.left ?? 0; + const paddingBottom = padding.bottom ?? 0; + return { + x: coords.x + paddingLeft, + y: coords.y - paddingBottom + }; + } +}; +__decorateClass([ + Property15 +], CalloutProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentProperties.ts +import { _ModuleSupport as _ModuleSupport21 } from "ag-charts-community"; +import { isObject as isObject2 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/properties/textualPointProperties.ts +import { _ModuleSupport as _ModuleSupport20 } from "ag-charts-community"; +var { BaseProperties: BaseProperties5, Property: Property16 } = _ModuleSupport20; +var TextualPointProperties = class extends Annotation(Point(Handle(Label(Font(BaseProperties5))))) { + constructor() { + super(...arguments); + this.text = ""; + this.position = "top"; + this.alignment = "left"; + this.placement = "inside"; + this.placeholderText = "inputTextareaPlaceholder"; + } + getDefaultColor(_colorPickerType) { + return this.color; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } + getPlaceholderColor() { + return void 0; + } + getPadding() { + const { padding = 0 } = this; + return { + top: padding, + right: padding, + bottom: padding, + left: padding + }; + } + getText() { + const isPlaceholder = this.text.length == 0; + const text2 = isPlaceholder ? this.placeholderText ?? "" : this.text; + return { + text: text2, + isPlaceholder + }; + } + getTextInputCoords(context, _height) { + return convertPoint(this, context); + } + getTextPosition() { + return this.position; + } +}; +__decorateClass([ + Property16 +], TextualPointProperties.prototype, "text", 2); + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentProperties.ts +var { Property: Property17, Color: Color2 } = _ModuleSupport21; +var DEFAULT_COMMENT_PADDING = { + top: 8, + right: 14, + bottom: 8, + left: 14 +}; +var CommentProperties = class extends Fill(Stroke(TextualPointProperties)) { + constructor() { + super(...arguments); + this.type = "comment" /* Comment */; + this.position = "bottom"; + this.alignment = "left"; + } + static is(value) { + return isObject2(value) && value.type === "comment" /* Comment */; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fill; + case `line-color`: + return this.stroke; + case `text-color`: + default: + return this.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fillOpacity; + case `line-color`: + return this.strokeOpacity; + case `text-color`: + default: + return void 0; + } + } + getPlaceholderColor() { + const { r, g, b } = Color2.fromString(this.color ?? "#888888"); + return new Color2(r, g, b, 0.66).toString(); + } + getPadding() { + const { padding, fontSize } = this; + if (padding == null) { + return { + top: Math.max(fontSize * 0.4, DEFAULT_COMMENT_PADDING.top), + bottom: Math.max(fontSize * 0.4, DEFAULT_COMMENT_PADDING.bottom), + left: Math.max(fontSize * 0.8, DEFAULT_COMMENT_PADDING.left), + right: Math.max(fontSize * 0.8, DEFAULT_COMMENT_PADDING.right) + }; + } + return { + top: padding, + right: padding, + bottom: padding, + left: padding + }; + } + getTextInputCoords(context, height) { + const coords = super.getTextInputCoords(context, height); + const padding = this.getPadding(); + return { + x: coords.x + padding.left, + y: coords.y - padding.bottom + }; + } +}; +__decorateClass([ + Property17 +], CommentProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerProperties.ts +import { _ModuleSupport as _ModuleSupport23 } from "ag-charts-community"; +import { isObject as isObject3 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/utils/line.ts +import { _ModuleSupport as _ModuleSupport22 } from "ag-charts-community"; +var { Vec2 } = _ModuleSupport22; +function getLineStyle(lineDash, lineStyle) { + return lineDash ? "dashed" : lineStyle ?? "solid"; +} +function getComputedLineDash(strokeWidth, styleType) { + switch (styleType) { + case "solid": + return []; + case "dashed": + return [strokeWidth * 4, strokeWidth * 2]; + case "dotted": + return [0, strokeWidth * 2]; + } +} +function getLineDash(lineDash, computedLineDash, lineStyle, strokeWidth) { + const styleType = getLineStyle(lineDash, lineStyle); + return computedLineDash ?? lineDash ?? getComputedLineDash(strokeWidth ?? 1, styleType); +} +function getLineCap(lineCap, lineDash, lineStyle) { + const styleType = getLineStyle(lineDash, lineStyle); + return lineCap ?? styleType === "dotted" ? "round" : void 0; +} +function boundsIntersections(coords, bounds) { + const [p1, p2] = Vec2.from(coords); + const reflection = bounds.height; + const gradient = Vec2.gradient(p2, p1, reflection); + const intercept = Vec2.intercept(p2, gradient, reflection); + const fallback = [ + { x: p1.x, y: reflection ?? 0 }, + { x: p1.x, y: reflection == null ? bounds.height : reflection - bounds.height } + ]; + if (gradient === Infinity) { + return fallback; + } + let points = [ + Vec2.intersectAtY(gradient, intercept, 0, reflection), + Vec2.intersectAtY(gradient, intercept, bounds.height, reflection), + Vec2.intersectAtX(gradient, intercept, 0, reflection), + Vec2.intersectAtX(gradient, intercept, bounds.width, reflection) + ]; + points = points.filter((p) => p.x >= bounds.x && p.x <= bounds.width && p.y >= bounds.y && p.y <= bounds.height).sort((a, b) => { + if (a.x === b.x) + return 0; + return a.x < b.x ? -1 : 1; + }); + if (points.length !== 2) { + return fallback; + } + return points; +} + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerProperties.ts +var { BaseProperties: BaseProperties6, Property: Property18 } = _ModuleSupport23; +var MeasurerStatisticsDivider = class extends Stroke(BaseProperties6) { +}; +var MeasurerStatistics = class extends Font(Fill(Stroke(BaseProperties6))) { + constructor() { + super(...arguments); + this.divider = new MeasurerStatisticsDivider(); + } +}; +__decorateClass([ + Property18 +], MeasurerStatistics.prototype, "divider", 2); +var MeasurerDirectionProperties = class extends Fill(Stroke(Handle(BaseProperties6))) { + constructor() { + super(...arguments); + this.statistics = new MeasurerStatistics(); + } +}; +__decorateClass([ + Property18 +], MeasurerDirectionProperties.prototype, "statistics", 2); +var MeasurerTypeProperties = class extends Localisable(Background(Stroke(LineStyle(StartEndProperties)))) { + constructor() { + super(...arguments); + this.direction = "both"; + this.hasDateRange = false; + this.hasPriceRange = false; + this.statistics = new MeasurerStatistics(); + this.getVolume = () => void 0; + this.text = new LineTextProperties(); + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fill; + case `line-color`: + return this.stroke; + case `text-color`: + return this.text.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fillOpacity; + case `line-color`: + return this.strokeOpacity; + } + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property18 +], MeasurerTypeProperties.prototype, "statistics", 2); +__decorateClass([ + Property18 +], MeasurerTypeProperties.prototype, "text", 2); +function DateRange(Parent) { + class DateRangeInternal extends Parent { + constructor() { + super(...arguments); + this.hasDateRange = true; + } + } + return DateRangeInternal; +} +function PriceRange(Parent) { + class PriceRangeInternal extends Parent { + constructor() { + super(...arguments); + this.hasPriceRange = true; + } + } + return PriceRangeInternal; +} +var DateRangeProperties = class extends DateRange(MeasurerTypeProperties) { + constructor() { + super(...arguments); + this.type = "date-range" /* DateRange */; + this.direction = "horizontal"; + } + static is(value) { + return isObject3(value) && value.type === "date-range" /* DateRange */; + } +}; +__decorateClass([ + Property18 +], DateRangeProperties.prototype, "type", 2); +__decorateClass([ + Property18 +], DateRangeProperties.prototype, "extendAbove", 2); +__decorateClass([ + Property18 +], DateRangeProperties.prototype, "extendBelow", 2); +var PriceRangeProperties = class extends PriceRange(MeasurerTypeProperties) { + constructor() { + super(...arguments); + this.type = "price-range" /* PriceRange */; + this.direction = "vertical"; + } + static is(value) { + return isObject3(value) && value.type === "price-range" /* PriceRange */; + } +}; +__decorateClass([ + Property18 +], PriceRangeProperties.prototype, "type", 2); +__decorateClass([ + Property18 +], PriceRangeProperties.prototype, "extendLeft", 2); +__decorateClass([ + Property18 +], PriceRangeProperties.prototype, "extendRight", 2); +var DatePriceRangeProperties = class extends DateRange(PriceRange(MeasurerTypeProperties)) { + constructor() { + super(...arguments); + this.type = "date-price-range" /* DatePriceRange */; + this.direction = "both"; + } + static is(value) { + return isObject3(value) && value.type === "date-price-range" /* DatePriceRange */; + } +}; +__decorateClass([ + Property18 +], DatePriceRangeProperties.prototype, "type", 2); +var QuickDatePriceRangeProperties = class extends DateRange(PriceRange(MeasurerTypeProperties)) { + constructor() { + super(...arguments); + this.type = "quick-date-price-range" /* QuickDatePriceRange */; + this.up = new MeasurerDirectionProperties(); + this.down = new MeasurerDirectionProperties(); + this.direction = "both"; + } + static is(value) { + return isObject3(value) && value.type === "quick-date-price-range" /* QuickDatePriceRange */; + } +}; +__decorateClass([ + Property18 +], QuickDatePriceRangeProperties.prototype, "type", 2); +__decorateClass([ + Property18 +], QuickDatePriceRangeProperties.prototype, "up", 2); +__decorateClass([ + Property18 +], QuickDatePriceRangeProperties.prototype, "down", 2); + +// packages/ag-charts-enterprise/src/features/annotations/note/noteProperties.ts +import { _ModuleSupport as _ModuleSupport25 } from "ag-charts-community"; +import { clamp as clamp2, isObject as isObject4 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/text/util.ts +import { _ModuleSupport as _ModuleSupport24 } from "ag-charts-community"; +import { cachedTextMeasurer, calcLineHeight, wrapText } from "ag-charts-core"; +var { BBox: BBox2 } = _ModuleSupport24; +var ANNOTATION_TEXT_LINE_HEIGHT = 1.38; +function maybeWrapText(options, text2, maxWidth) { + return maxWidth ? wrapText(text2, { maxWidth, font: options, textWrap: "always", avoidOrphans: false }) : text2; +} +function measureAnnotationText(options, text2) { + const { lineMetrics, width } = cachedTextMeasurer(options).measureLines(text2); + const height = lineMetrics.length * calcLineHeight(options.fontSize, ANNOTATION_TEXT_LINE_HEIGHT); + return { width, height }; +} +function getBBox(options, text2, coords, bbox) { + let width = bbox?.width ?? 0; + let height = bbox?.height ?? 0; + if (!bbox) { + const wrappedText = options.width == null ? text2 : maybeWrapText(options, text2, options.width); + ({ width, height } = measureAnnotationText(options, wrappedText)); + } + return new BBox2(coords.x, coords.y, width, height); +} +function updateTextNode(node, text2, isPlaceholder, config, { x, y }, textBaseline) { + const { visible = true, fontFamily, fontSize = 14, fontStyle, fontWeight, textAlign } = config; + const lineHeight = calcLineHeight(fontSize, ANNOTATION_TEXT_LINE_HEIGHT); + textBaseline ?? (textBaseline = config.position == "center" ? "middle" : config.position); + const fill = isPlaceholder ? config.getPlaceholderColor() : config.color; + node.setProperties({ + x, + y, + visible, + text: text2, + fill, + fontFamily, + fontSize, + fontStyle, + fontWeight, + textAlign, + lineHeight, + textBaseline + }); +} + +// packages/ag-charts-enterprise/src/features/annotations/note/noteProperties.ts +var { BaseProperties: BaseProperties7, Property: Property19 } = _ModuleSupport25; +var DEFAULT_NOTE_PADDING = 10; +var HANDLE_SIZE = 11; +var ICON_HEIGHT = 20; +var ICON_WIDTH = 22; +var ICON_SPACING = 10; +var LABEL_OFFSET = ICON_HEIGHT + ICON_SPACING; +var TOOLBAR_OFFSET = 34; +var NoteBackgroundProperties = class extends Fill(Stroke(BaseProperties7)) { +}; +var NoteProperties = class extends Fill(Stroke(TextualPointProperties)) { + constructor() { + super(...arguments); + this.type = "note" /* Note */; + this.background = new NoteBackgroundProperties(); + this.position = "bottom"; + this.alignment = "center"; + this.width = 200; + } + static is(value) { + return isObject4(value) && value.type === "note" /* Note */; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `line-color`: + return this.fill; + case `text-color`: + return this.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `line-color`: + return this.fillOpacity; + case `text-color`: + return void 0; + } + } + getPadding() { + const padding = this.padding ?? DEFAULT_NOTE_PADDING; + return { + top: padding, + right: padding, + bottom: padding, + left: padding + }; + } + getTextInputCoords(context, height) { + const { width, text: text2 } = this; + const textInputCoords = super.getTextInputCoords(context, height); + const padding = this.getPadding().top; + const bbox = getBBox(this, text2, textInputCoords); + bbox.x = clamp2(width / 2, bbox.x, context.seriesRect.width - width / 2); + const topY = bbox.y - LABEL_OFFSET - padding * 2; + const bottomY = bbox.y + HANDLE_SIZE + padding * 2; + const textHeight = Math.max(bbox.height, height); + if (topY - textHeight - TOOLBAR_OFFSET < 0) { + bbox.y = bottomY; + this.position = "top"; + } else { + bbox.y = topY + padding; + this.position = "bottom"; + } + return { + x: bbox.x, + y: bbox.y + }; + } + isHoverable() { + return true; + } +}; +__decorateClass([ + Property19 +], NoteProperties.prototype, "type", 2); +__decorateClass([ + Property19 +], NoteProperties.prototype, "background", 2); + +// packages/ag-charts-enterprise/src/features/annotations/properties/pointProperties.ts +import { _ModuleSupport as _ModuleSupport26 } from "ag-charts-community"; +var { BaseProperties: BaseProperties8 } = _ModuleSupport26; +var PointProperties2 = class extends Annotation(Point(Handle(BaseProperties8))) { + getDefaultColor(_colorPickerType) { + return void 0; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/properties/shapePointProperties.ts +var ShapePointProperties = class _ShapePointProperties extends Fill(PointProperties2) { + constructor() { + super(...arguments); + this.size = 32; + } + static is(value) { + return value instanceof _ShapePointProperties; + } + getDefaultColor(colorPickerType) { + return colorPickerType === `fill-color` ? this.fill : void 0; + } + getDefaultOpacity(colorPickerType) { + return colorPickerType === `fill-color` ? this.fillOpacity : void 0; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/cross-line/crossLineProperties.ts +import { _ModuleSupport as _ModuleSupport27 } from "ag-charts-community"; +import { isObject as isObject5 } from "ag-charts-core"; +var { BaseProperties: BaseProperties9, Property: Property20 } = _ModuleSupport27; +var HorizontalLineProperties = class extends Annotation(Value(Handle(AxisLabel(Stroke(LineStyle(BaseProperties9)))))) { + constructor() { + super(...arguments); + this.direction = "horizontal"; + this.type = "horizontal-line" /* HorizontalLine */; + this.text = new LineTextProperties(); + } + static is(value) { + return isObject5(value) && value.type === "horizontal-line" /* HorizontalLine */; + } + getDefaultColor() { + return this.stroke; + } + getDefaultOpacity() { + return this.strokeOpacity; + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property20 +], HorizontalLineProperties.prototype, "type", 2); +__decorateClass([ + Property20 +], HorizontalLineProperties.prototype, "text", 2); +var VerticalLineProperties = class extends Annotation(Value(Handle(AxisLabel(Stroke(LineStyle(BaseProperties9)))))) { + constructor() { + super(...arguments); + this.direction = "vertical"; + this.type = "vertical-line" /* VerticalLine */; + this.text = new LineTextProperties(); + } + static is(value) { + return isObject5(value) && value.type === "vertical-line" /* VerticalLine */; + } + getDefaultColor() { + return this.stroke; + } + getDefaultOpacity() { + return this.strokeOpacity; + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property20 +], VerticalLineProperties.prototype, "type", 2); +__decorateClass([ + Property20 +], VerticalLineProperties.prototype, "text", 2); + +// packages/ag-charts-enterprise/src/features/annotations/disjoint-channel/disjointChannelProperties.ts +import { _ModuleSupport as _ModuleSupport28 } from "ag-charts-community"; +import { Logger, isObject as isObject6 } from "ag-charts-core"; +var { BaseProperties: BaseProperties10, Property: Property21 } = _ModuleSupport28; +var DisjointChannelProperties = class extends Annotation( + Background(Line3(Handle(Extendable(Stroke(LineStyle(BaseProperties10)))))) +) { + constructor() { + super(...arguments); + this.type = "disjoint-channel" /* DisjointChannel */; + this.text = new ChannelTextProperties(); + this.snapToAngle = 45; + } + static is(value) { + return isObject6(value) && value.type === "disjoint-channel" /* DisjointChannel */; + } + get bottom() { + const bottom = { + start: { x: this.start.x, y: this.start.y }, + end: { x: this.end.x, y: this.end.y } + }; + if (typeof bottom.start.y === "number" && typeof bottom.end.y === "number") { + bottom.start.y -= this.startHeight; + bottom.end.y -= this.endHeight; + } else { + Logger.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`); + } + return bottom; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fill; + case `line-color`: + return this.stroke; + case "text-color": + return this.text.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fillOpacity; + case `line-color`: + return this.strokeOpacity; + } + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property21 +], DisjointChannelProperties.prototype, "type", 2); +__decorateClass([ + Property21 +], DisjointChannelProperties.prototype, "startHeight", 2); +__decorateClass([ + Property21 +], DisjointChannelProperties.prototype, "endHeight", 2); +__decorateClass([ + Property21 +], DisjointChannelProperties.prototype, "text", 2); + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedProperties.ts +import { _ModuleSupport as _ModuleSupport31 } from "ag-charts-community"; +import { isObject as isObject8 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/properties/fibonacciProperties.ts +import { _ModuleSupport as _ModuleSupport30 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/line/lineProperties.ts +import { _ModuleSupport as _ModuleSupport29 } from "ag-charts-community"; +import { isObject as isObject7 } from "ag-charts-core"; +var { Property: Property22 } = _ModuleSupport29; +var LineTypeProperties = class extends Localisable( + Cappable(Extendable(Stroke(LineStyle(StartEndProperties)))) +) { + constructor() { + super(...arguments); + this.text = new LineTextProperties(); + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case "line-color": + return this.stroke; + case "text-color": + return this.text.color; + } + } + getDefaultOpacity() { + return this.strokeOpacity; + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property22 +], LineTypeProperties.prototype, "text", 2); +var ArrowProperties = class extends LineTypeProperties { + constructor() { + super(...arguments); + this.type = "arrow" /* Arrow */; + this.endCap = "arrow"; + } + static is(value) { + return isObject7(value) && value.type === "arrow" /* Arrow */; + } +}; +__decorateClass([ + Property22 +], ArrowProperties.prototype, "type", 2); +var LineProperties = class extends LineTypeProperties { + constructor() { + super(...arguments); + this.type = "line" /* Line */; + } + static is(value) { + return isObject7(value) && value.type === "line" /* Line */; + } +}; +__decorateClass([ + Property22 +], LineProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/properties/fibonacciProperties.ts +var { Property: Property23 } = _ModuleSupport30; +var FibonacciProperties = class extends LineTypeProperties { + constructor() { + super(...arguments); + this.label = new LabelTextProperties(); + this.reverse = false; + this.showFill = true; + this.isMultiColor = true; + this.strokes = []; + this.bands = 10; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case "line-color": + return this.rangeStroke ?? this.stroke; + case "text-color": + return this.text.color; + } + } +}; +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "label", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "reverse", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "showFill", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "isMultiColor", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "strokes", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "rangeStroke", 2); +__decorateClass([ + Property23 +], FibonacciProperties.prototype, "bands", 2); + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedProperties.ts +var { Property: Property24 } = _ModuleSupport31; +var FibonacciRetracementTrendBasedProperties = class extends FibonacciProperties { + constructor() { + super(...arguments); + this.type = "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */; + this.endRetracement = new PointProperties(); + } + static is(value) { + return isObject8(value) && value.type === "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */; + } +}; +__decorateClass([ + Property24 +], FibonacciRetracementTrendBasedProperties.prototype, "type", 2); +__decorateClass([ + Property24 +], FibonacciRetracementTrendBasedProperties.prototype, "endRetracement", 2); + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement/fibonacciRetracementProperties.ts +import { _ModuleSupport as _ModuleSupport32 } from "ag-charts-community"; +import { isObject as isObject9 } from "ag-charts-core"; +var { Property: Property25 } = _ModuleSupport32; +var FibonacciRetracementProperties = class extends FibonacciProperties { + constructor() { + super(...arguments); + this.type = "fibonacci-retracement" /* FibonacciRetracement */; + } + static is(value) { + return isObject9(value) && value.type === "fibonacci-retracement" /* FibonacciRetracement */; + } +}; +__decorateClass([ + Property25 +], FibonacciRetracementProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/parallel-channel/parallelChannelProperties.ts +import { _ModuleSupport as _ModuleSupport33 } from "ag-charts-community"; +import { Logger as Logger2, isObject as isObject10 } from "ag-charts-core"; +var { BaseProperties: BaseProperties11, Property: Property26 } = _ModuleSupport33; +var ParallelChannelProperties = class extends Annotation( + Background(Line3(Handle(Extendable(Stroke(LineStyle(BaseProperties11)))))) +) { + constructor() { + super(...arguments); + this.type = "parallel-channel" /* ParallelChannel */; + this.middle = new ChannelAnnotationMiddleProperties(); + this.text = new ChannelTextProperties(); + this.snapToAngle = 45; + } + static is(value) { + return isObject10(value) && value.type === "parallel-channel" /* ParallelChannel */; + } + get bottom() { + const bottom = { + start: { x: this.start.x, y: this.start.y }, + end: { x: this.end.x, y: this.end.y } + }; + if (typeof bottom.start.y === "number" && typeof bottom.end.y === "number") { + bottom.start.y -= this.height; + bottom.end.y -= this.height; + } else { + Logger2.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`); + } + return bottom; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fill; + case `line-color`: + return this.stroke; + case "text-color": + return this.text.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fillOpacity; + case `line-color`: + return this.strokeOpacity; + } + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass([ + Property26 +], ParallelChannelProperties.prototype, "type", 2); +__decorateClass([ + Property26 +], ParallelChannelProperties.prototype, "height", 2); +__decorateClass([ + Property26 +], ParallelChannelProperties.prototype, "middle", 2); +__decorateClass([ + Property26 +], ParallelChannelProperties.prototype, "text", 2); + +// packages/ag-charts-enterprise/src/features/annotations/text/textProperties.ts +import { _ModuleSupport as _ModuleSupport34 } from "ag-charts-community"; +import { isObject as isObject11 } from "ag-charts-core"; +var { Property: Property27 } = _ModuleSupport34; +var TextProperties = class extends TextualPointProperties { + constructor() { + super(...arguments); + this.type = "text" /* Text */; + this.position = "bottom"; + } + static is(value) { + return isObject11(value) && value.type === "text" /* Text */; + } +}; +__decorateClass([ + Property27 +], TextProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/utils/types.ts +function isEphemeralType(datum) { + return QuickDatePriceRangeProperties.is(datum); +} +function isLineType(datum) { + return LineProperties.is(datum) || HorizontalLineProperties.is(datum) || VerticalLineProperties.is(datum) || ArrowProperties.is(datum) || isFibonacciType(datum); +} +function isChannelType(datum) { + return DisjointChannelProperties.is(datum) || ParallelChannelProperties.is(datum); +} +function isFibonacciType(datum) { + return FibonacciRetracementProperties.is(datum) || FibonacciRetracementTrendBasedProperties.is(datum); +} +function isTextType(datum) { + return CalloutProperties.is(datum) || CommentProperties.is(datum) || NoteProperties.is(datum) || TextProperties.is(datum); +} +function isMeasurerType(datum) { + return DateRangeProperties.is(datum) || PriceRangeProperties.is(datum) || DatePriceRangeProperties.is(datum) || QuickDatePriceRangeProperties.is(datum); +} + +// packages/ag-charts-enterprise/src/features/annotations/utils/has.ts +function hasFontSize(datum) { + return isTextType(datum) && !NoteProperties.is(datum); +} +function hasLineStyle(datum) { + return isLineType(datum) || isChannelType(datum) || isMeasurerType(datum) && !QuickDatePriceRangeProperties.is(datum); +} +function hasLineColor(datum) { + return isLineType(datum) || isChannelType(datum) || isMeasurerType(datum) || CalloutProperties.is(datum) || NoteProperties.is(datum); +} +function hasIconColor(datum) { + return NoteProperties.is(datum); +} +function hasFillColor(datum) { + return isChannelType(datum) || isMeasurerType(datum) || CalloutProperties.is(datum) || CommentProperties.is(datum) || ShapePointProperties.is(datum); +} +function hasTextColor(datum) { + return isTextType(datum) && !NoteProperties.is(datum); +} +function hasLineText(datum) { + return (isLineType(datum) || isChannelType(datum) || isMeasurerType(datum)) && !isEphemeralType(datum) && isObject12(datum.text); +} + +// packages/ag-charts-enterprise/src/features/annotations/utils/styles.ts +function setFontSize(datum, fontSize) { + if ("fontSize" in datum) + datum.fontSize = fontSize; + if (hasLineText(datum)) + datum.text.fontSize = fontSize; +} +function setLineStyle(datum, style) { + const strokeWidth = style?.strokeWidth ?? datum.strokeWidth ?? 1; + const lineType = style?.type ?? datum.lineStyle; + const lineStyle = lineType ?? getLineStyle(datum.lineDash, lineType); + const computedLineDash = getComputedLineDash(strokeWidth, lineStyle); + datum.strokeWidth = strokeWidth; + datum.computedLineDash = computedLineDash; + datum.lineStyle = lineStyle; + datum.lineCap = lineStyle === "dotted" ? "round" : void 0; +} +function setColor(datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor) { + switch (colorPickerType) { + case `fill-color`: { + if ("fill" in datum) + datum.fill = color6; + if ("fillOpacity" in datum) + datum.fillOpacity = opacity; + if ("background" in datum) { + datum.background.fill = color6; + datum.background.fillOpacity = opacity; + } + break; + } + case `line-color`: { + if ("axisLabel" in datum) { + datum.axisLabel.fill = color6; + datum.axisLabel.fillOpacity = opacity; + datum.axisLabel.stroke = color6; + datum.axisLabel.strokeOpacity = opacity; + } + if ("fill" in datum && "fillOpacity" in datum && hasIconColor(datum)) { + datum.fill = color6; + datum.fillOpacity = opacity; + } else { + if ("strokeOpacity" in datum) + datum.strokeOpacity = opacity; + if ("isMultiColor" in datum && "rangeStroke" in datum) { + datum.isMultiColor = isMultiColor; + datum.rangeStroke = color6; + } else if ("stroke" in datum) { + datum.stroke = color6; + } + } + break; + } + case `text-color`: { + if ("color" in datum) + datum.color = colorOpacity; + if (hasLineText(datum)) + datum.text.color = color6; + break; + } + } +} + +// packages/ag-charts-enterprise/src/features/annotations/annotationDefaults.ts +var { deepClone } = _ModuleSupport35; +var AnnotationDefaults = class { + constructor() { + this.mementoOriginatorKey = "annotation-defaults"; + this.colors = new Map( + Object.values(AnnotationType).map((type) => [ + type, + /* @__PURE__ */ new Map([ + ["line-color", void 0], + ["fill-color", void 0], + ["text-color", void 0] + ]) + ]) + ); + this.fontSizes = /* @__PURE__ */ new Map([ + ["callout" /* Callout */, void 0], + ["comment" /* Comment */, void 0], + ["text" /* Text */, void 0], + ["arrow" /* Arrow */, void 0], + ["line" /* Line */, void 0], + ["disjoint-channel" /* DisjointChannel */, void 0], + ["parallel-channel" /* ParallelChannel */, void 0], + ["date-range" /* DateRange */, void 0], + ["price-range" /* PriceRange */, void 0], + ["date-price-range" /* DatePriceRange */, void 0] + ]); + this.lineStyles = /* @__PURE__ */ new Map([ + ["line" /* Line */, void 0], + ["horizontal-line" /* HorizontalLine */, void 0], + ["vertical-line" /* VerticalLine */, void 0], + ["disjoint-channel" /* DisjointChannel */, void 0], + ["parallel-channel" /* ParallelChannel */, void 0], + ["arrow" /* Arrow */, void 0], + ["date-range" /* DateRange */, void 0], + ["price-range" /* PriceRange */, void 0], + ["date-price-range" /* DatePriceRange */, void 0] + ]); + this.lineTextAlignments = /* @__PURE__ */ new Map([ + ["line" /* Line */, void 0], + ["horizontal-line" /* HorizontalLine */, void 0], + ["vertical-line" /* VerticalLine */, void 0], + ["disjoint-channel" /* DisjointChannel */, void 0], + ["parallel-channel" /* ParallelChannel */, void 0], + ["arrow" /* Arrow */, void 0], + ["date-range" /* DateRange */, void 0], + ["price-range" /* PriceRange */, void 0], + ["date-price-range" /* DatePriceRange */, void 0] + ]); + this.lineTextPositions = /* @__PURE__ */ new Map([ + ["line" /* Line */, void 0], + ["horizontal-line" /* HorizontalLine */, void 0], + ["vertical-line" /* VerticalLine */, void 0], + ["disjoint-channel" /* DisjointChannel */, void 0], + ["parallel-channel" /* ParallelChannel */, void 0], + ["arrow" /* Arrow */, void 0], + ["date-range" /* DateRange */, void 0], + ["price-range" /* PriceRange */, void 0], + ["date-price-range" /* DatePriceRange */, void 0] + ]); + this.fibonacciOptions = /* @__PURE__ */ new Map([ + [ + "fibonacci-retracement" /* FibonacciRetracement */, + { + bands: void 0, + reverse: void 0, + showFill: void 0 + } + ], + [ + "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */, + { + bands: void 0, + reverse: void 0, + showFill: void 0 + } + ] + ]); + } + createMemento() { + return { + colors: deepClone(this.colors), + fontSizes: deepClone(this.fontSizes), + lineStyles: deepClone(this.lineStyles), + lineTextAlignments: deepClone(this.lineTextAlignments), + lineTextPositions: deepClone(this.lineTextPositions), + fibonacciOptions: deepClone(this.fibonacciOptions) + }; + } + guardMemento(_blob) { + return true; + } + restoreMemento(_version, _mementoVersion, blob) { + this.colors = deepClone(blob.colors); + this.fontSizes = deepClone(blob.fontSizes); + this.lineStyles = deepClone(blob.lineStyles); + this.lineTextAlignments = deepClone(blob.lineTextAlignments); + this.lineTextPositions = deepClone(blob.lineTextPositions); + this.fibonacciOptions = deepClone(blob.fibonacciOptions); + } + setDefaultColor(type, colorType, colorOpacity, color6, opacity, isMultiColor) { + this.colors.get(type)?.set(colorType, [colorOpacity, color6, opacity, isMultiColor]); + } + setDefaultFontSize(type, fontSize) { + this.fontSizes.set(type, fontSize); + } + setDefaultLineStyleType(type, lineStyleType) { + const defaultStyle = this.lineStyles.get(type); + if (defaultStyle) { + defaultStyle.type = lineStyleType; + } else { + this.lineStyles.set(type, { type: lineStyleType }); + } + } + setDefaultLineStyleWidth(type, strokeWidth) { + const defaultStyle = this.lineStyles.get(type); + if (defaultStyle) { + defaultStyle.strokeWidth = strokeWidth; + } else { + this.lineStyles.set(type, { strokeWidth }); + } + } + setDefaultLineTextAlignment(type, alignment) { + this.lineTextAlignments.set(type, alignment); + } + setDefaultLineTextPosition(type, position) { + this.lineTextPositions.set(type, position); + } + setDefaultFibonacciOptions(type, key, value) { + if (type != "fibonacci-retracement" /* FibonacciRetracement */ && type != "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */) + return; + const options = this.fibonacciOptions.get(type); + options[key] = value; + this.fibonacciOptions.set(type, options); + } + applyDefaults(datum) { + for (const [annotationType, colors] of this.colors) { + if (datum.type !== annotationType) + continue; + for (const [colorPickerType, [colorOpacity, color6, opacity, isMultiColor] = []] of colors) { + if (colorOpacity && color6 && opacity != null && isMultiColor != null) { + setColor(datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + } + } + } + for (const [annotationType, size] of this.fontSizes) { + if (datum.type !== annotationType || size == null) + continue; + setFontSize(datum, size); + } + for (const [annotationType, style] of this.lineStyles) { + if (datum.type !== annotationType || style == null) + continue; + setLineStyle(datum, style); + } + for (const [annotationType, position] of this.lineTextPositions) { + if (datum.type !== annotationType || position == null) + continue; + datum.text.position = position; + } + for (const [annotationType, alignment] of this.lineTextAlignments) { + if (datum.type !== annotationType || alignment == null) + continue; + datum.text.alignment = alignment; + } + for (const [annotationType, options] of this.fibonacciOptions) { + if (datum.type !== annotationType || options == null) + continue; + for (const option of Object.keys(options)) { + const value = options[option]; + if (value == null) { + continue; + } + datum.set({ [option]: value }); + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotationOptionsToolbar.ts +import { _ModuleSupport as _ModuleSupport38 } from "ag-charts-community"; +import { CleanupRegistry, EventEmitter } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/components/color-picker/colorPicker.ts +import { _ModuleSupport as _ModuleSupport36 } from "ag-charts-community"; +import { attachListener as attachListener2, clamp as clamp3, createElement, getWindow } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/components/color-picker/colorPickerTemplate.html +var colorPickerTemplate_default = '
'; + +// packages/ag-charts-enterprise/src/components/color-picker/colorPicker.ts +var { Color: Color3 } = _ModuleSupport36; +var getHsva = (input) => { + try { + const color6 = Color3.fromString(input); + const [h, s, v] = color6.toHSB(); + return [h, s, v, color6.a]; + } catch { + return; + } +}; +var ColorPicker = class extends _ModuleSupport36.AnchoredPopover { + constructor(ctx, options) { + super(ctx, "color-picker", options); + this.hasChanged = false; + this.hideFns.push(() => { + this.i18nUpdater = void 0; + if (this.hasChanged) + this.onChangeHide?.(); + }); + this.cleanup.register(this.ctx.eventsHub.on("locale:change", () => this.i18nUpdater?.())); + } + show(options) { + this.hasChanged = false; + this.onChangeHide = options.onChangeHide; + const { element, initialFocus } = this.createColorPicker(options); + const popover = this.showWithChildren([element], { initialFocus, ...options }); + popover.classList.add("ag-charts-color-picker"); + popover.setAttribute("role", "dialog"); + } + createColorPicker(opts) { + const { localeManager } = this.ctx; + let isMultiColor = opts.isMultiColor ?? false; + let [h, s, v, a] = getHsva(opts.color ?? "#f00") ?? [0, 1, 0.5, 1]; + a = opts.opacity ?? a; + const colorPicker = createElement("div", "ag-charts-color-picker__content"); + colorPicker.innerHTML = colorPickerTemplate_default; + colorPicker.ariaLabel = this.ctx.localeManager.t("ariaLabelColorPicker"); + const paletteInput = colorPicker.querySelector(".ag-charts-color-picker__palette"); + const hueInput = colorPicker.querySelector(".ag-charts-color-picker__hue-input"); + const multiColorButton = colorPicker.querySelector( + ".ag-charts-color-picker__multi-color-button" + ); + const alphaInput = colorPicker.querySelector(".ag-charts-color-picker__alpha-input"); + const colorInput = colorPicker.querySelector(".ag-charts-color-picker__color-input"); + const colorInputLabel = colorPicker.querySelector(".ag-charts-color-picker__color-label"); + const updatePaletteInputAriaValue = (first) => { + const key = { s: "ariaValueColorPalette", v: "ariaValueColorPaletteFirstV" }[first]; + paletteInput.ariaValueText = localeManager.t(key, { s, v }); + }; + this.i18nUpdater = () => { + paletteInput.ariaRoleDescription = localeManager.t("ariaRoleDescription2DSlider"); + paletteInput.ariaLabel = localeManager.t("ariaLabelColorPickerPalette"); + hueInput.ariaLabel = localeManager.t("ariaLabelColorPickerHue"); + multiColorButton.ariaLabel = localeManager.t("ariaLabelColorPickerMultiColor"); + alphaInput.ariaLabel = localeManager.t("ariaLabelColorPickerAlpha"); + colorInput.ariaLabel = localeManager.t("ariaLabelColor"); + updatePaletteInputAriaValue("s"); + }; + this.i18nUpdater(); + multiColorButton.classList.toggle( + "ag-charts-color-picker__multi-color-button--hidden", + !opts.hasMultiColorOption + ); + const update = (trackChange = true) => { + const color6 = Color3.fromHSB(h, s, v, a); + const colorString = color6.toHexString(); + colorPicker.style.setProperty("--h", `${h}`); + colorPicker.style.setProperty("--s", `${s}`); + colorPicker.style.setProperty("--v", `${v}`); + colorPicker.style.setProperty("--a", `${a}`); + colorPicker.style.setProperty("--color", colorString.slice(0, 7)); + colorPicker.style.setProperty("--color-a", colorString); + hueInput.value = `${h}`; + alphaInput.value = `${a}`; + alphaInput.classList.toggle("ag-charts-color-picker__alpha-input--opaque", a === 1); + multiColorButton.classList.toggle("ag-charts-color-picker__multi-color-button--active", isMultiColor); + colorInputLabel.classList.toggle("ag-charts-color-picker__color-label--multi-color", isMultiColor); + if (document.activeElement !== colorInput) { + multiColorButton.ariaChecked = isMultiColor.toString(); + colorInput.value = isMultiColor ? localeManager.t("ariaLabelColorPickerMultiColor") : colorString.toUpperCase(); + } + if (trackChange || opts.color == null) { + const plainColor = Color3.fromHSB(h, s, v, 1).toHexString(); + opts.onChange?.(colorString, plainColor, a, isMultiColor); + } + if (trackChange) + this.hasChanged = true; + }; + update(false); + const preventDefault = (event) => event.preventDefault(); + const stopPropagation = (event) => event.stopPropagation(); + const beginPaletteInteraction = (e) => { + e.preventDefault(); + const currentTarget = e.currentTarget; + currentTarget.focus(); + const rect = currentTarget.getBoundingClientRect(); + const pointerMove = ({ clientX, clientY }) => { + isMultiColor = false; + s = Math.min(Math.max((clientX - rect.left) / rect.width, 0), 1); + v = 1 - Math.min(Math.max((clientY - rect.top) / rect.height, 0), 1); + update(); + updatePaletteInputAriaValue("s"); + }; + pointerMove(e); + const pointerUp = attachListener2(getWindow(), "pointermove", pointerMove); + getWindow().addEventListener("pointerup", pointerUp, { once: true }); + }; + colorPicker.addEventListener("mousedown", stopPropagation); + colorPicker.addEventListener("touchstart", stopPropagation); + colorPicker.addEventListener("touchmove", stopPropagation); + colorPicker.addEventListener("keydown", (e) => { + e.stopPropagation(); + switch (e.key) { + case "Enter": + case "Escape": + this.hide(); + break; + default: + return; + } + e.preventDefault(); + }); + paletteInput.addEventListener("pointerdown", beginPaletteInteraction); + paletteInput.addEventListener("touchstart", preventDefault, { passive: false }); + paletteInput.addEventListener("touchmove", preventDefault, { passive: false }); + paletteInput.addEventListener("keydown", (e) => { + if (e.key === "ArrowLeft") { + s = clamp3(0, s - 0.01, 1); + updatePaletteInputAriaValue("s"); + } else if (e.key === "ArrowRight") { + s = clamp3(0, s + 0.01, 1); + updatePaletteInputAriaValue("s"); + } else if (e.key === "ArrowUp") { + v = clamp3(0, v + 0.01, 1); + updatePaletteInputAriaValue("v"); + } else if (e.key === "ArrowDown") { + v = clamp3(0, v - 0.01, 1); + updatePaletteInputAriaValue("v"); + } else { + return; + } + e.preventDefault(); + update(); + }); + paletteInput.addEventListener("focus", () => { + updatePaletteInputAriaValue("s"); + }); + multiColorButton.addEventListener("click", () => { + isMultiColor = !isMultiColor; + update(); + }); + hueInput.addEventListener("input", (e) => { + isMultiColor = false; + h = e.currentTarget.valueAsNumber ?? 0; + update(); + }); + alphaInput.addEventListener("input", (e) => { + isMultiColor = false; + a = e.currentTarget.valueAsNumber ?? 0; + update(); + }); + colorInput.addEventListener("input", (e) => { + isMultiColor = false; + const hsva = getHsva(e.currentTarget.value); + if (hsva == null) + return; + [h, s, v, a] = hsva; + update(); + }); + colorInput.addEventListener("blur", () => update()); + colorInput.addEventListener("keydown", (e) => { + if (e.key === "Enter") { + e.currentTarget.blur(); + update(); + } + }); + return { element: colorPicker, initialFocus: paletteInput }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotationsMenuOptions.ts +import { _ModuleSupport as _ModuleSupport37 } from "ag-charts-community"; +function channelMenuItemVisible(scale) { + return !(scale instanceof _ModuleSupport37.LogScale) && !(scale instanceof _ModuleSupport37.BandScale); +} +var LINE_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsTrendLine", + icon: "trend-line-drawing", + value: "line" /* Line */ + }, + { + label: "toolbarAnnotationsHorizontalLine", + icon: "horizontal-line-drawing", + value: "horizontal-line" /* HorizontalLine */ + }, + { + label: "toolbarAnnotationsVerticalLine", + icon: "vertical-line-drawing", + value: "vertical-line" /* VerticalLine */ + }, + { + label: "toolbarAnnotationsParallelChannel", + icon: "parallel-channel-drawing", + value: "parallel-channel" /* ParallelChannel */, + visible: channelMenuItemVisible + }, + { + label: "toolbarAnnotationsDisjointChannel", + icon: "disjoint-channel-drawing", + value: "disjoint-channel" /* DisjointChannel */, + visible: channelMenuItemVisible + } +]; +var FIBONACCI_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsFibonacciRetracement", + icon: "fibonacci-retracement-drawing", + value: "fibonacci-retracement" /* FibonacciRetracement */ + }, + { + label: "toolbarAnnotationsFibonacciRetracementTrendBased", + icon: "fibonacci-retracement-trend-based-drawing", + value: "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */ + } +]; +var FIBONACCI_RATIO_ITEMS = [ + { label: "Fibonacci - Extended", value: 10 }, + { label: "Fibonacci - 6 Band", value: 6 }, + { label: "Fibonacci - 4 Band", value: 4 } +]; +var TEXT_ANNOTATION_ITEMS = [ + { label: "toolbarAnnotationsText", icon: "text-annotation", value: "text" /* Text */ }, + { label: "toolbarAnnotationsComment", icon: "comment-annotation", value: "comment" /* Comment */ }, + { label: "toolbarAnnotationsCallout", icon: "callout-annotation", value: "callout" /* Callout */ }, + { label: "toolbarAnnotationsNote", icon: "note-annotation", value: "note" /* Note */ } +]; +var SHAPE_ANNOTATION_ITEMS = [ + { label: "toolbarAnnotationsArrow", icon: "arrow-drawing", value: "arrow" /* Arrow */ }, + { label: "toolbarAnnotationsArrowUp", icon: "arrow-up-drawing", value: "arrow-up" /* ArrowUp */ }, + { label: "toolbarAnnotationsArrowDown", icon: "arrow-down-drawing", value: "arrow-down" /* ArrowDown */ } +]; +var MEASURER_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsQuickDatePriceRange", + icon: "measurer-drawing", + value: "quick-date-price-range" /* QuickDatePriceRange */ + }, + { label: "toolbarAnnotationsDateRange", icon: "date-range-drawing", value: "date-range" /* DateRange */ }, + { label: "toolbarAnnotationsPriceRange", icon: "price-range-drawing", value: "price-range" /* PriceRange */ }, + { + label: "toolbarAnnotationsDatePriceRange", + icon: "date-price-range-drawing", + value: "date-price-range" /* DatePriceRange */ + } +]; +var LINE_STROKE_WIDTH_ITEMS = [ + { strokeWidth: 1, label: "1", value: 1 }, + { strokeWidth: 2, label: "2", value: 2 }, + { strokeWidth: 3, label: "3", value: 3 }, + { strokeWidth: 4, label: "4", value: 4 }, + { strokeWidth: 8, label: "8", value: 8 } +]; +var LINE_STYLE_TYPE_ITEMS = [ + { icon: "line-style-solid", altText: "iconAltTextLineStyleSolid", value: "solid" }, + { icon: "line-style-dashed", altText: "iconAltTextLineStyleDashed", value: "dashed" }, + { icon: "line-style-dotted", altText: "iconAltTextLineStyleDotted", value: "dotted" } +]; +var TEXT_SIZE_ITEMS = [ + { label: "10", value: 10 }, + { label: "12", value: 12 }, + { label: "14", value: 14 }, + { label: "16", value: 16 }, + { label: "18", value: 18 }, + { label: "22", value: 22 }, + { label: "28", value: 28 }, + { label: "36", value: 36 }, + { label: "46", value: 46 } +]; + +// packages/ag-charts-enterprise/src/features/annotations/annotationOptionsToolbar.ts +var { Color: Color4, FloatingToolbar, Menu, PropertiesArray, ToolbarButtonProperties, ToolbarButtonWidget, Property: Property28 } = _ModuleSupport38; +var AnnotationOptionsButtonProperties = class extends ToolbarButtonProperties { + constructor() { + super(...arguments); + this.checkedOverrides = new ToolbarButtonProperties(); + } +}; +__decorateClass([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "value", 2); +__decorateClass([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "checkedOverrides", 2); +__decorateClass([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "color", 2); +__decorateClass([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "isMultiColor", 2); +var AnnotationOptionsButtonWidget = class extends ToolbarButtonWidget { + update(options) { + super.update(options); + if (options.value === "line-stroke-width" /* LineStrokeWidth */) { + this.updateLineStrokeWidth(options); + } + if (options.value === "fill-color" /* FillColor */ || options.value === "line-color" /* LineColor */ || options.value === "text-color" /* TextColor */) { + this.updateFillColor(options); + } + } + updateFillColor(options) { + const element = this.getElement(); + element.classList.add("ag-charts-annotations__color-picker-button"); + element.classList.toggle("ag-charts-annotations__color-picker-button--multi-color", options.isMultiColor); + element.style.setProperty("--color", options.color ?? null); + } + updateLineStrokeWidth(options) { + const element = this.getElement(); + element.classList.add("ag-charts-annotations__stroke-width-button"); + element.style.setProperty("--stroke-width", `${options.strokeWidth}px`); + } +}; +var FloatingAnnotationOptionsToolbar = class extends FloatingToolbar { + createButtonWidget() { + return new AnnotationOptionsButtonWidget(this.localeManager); + } +}; +var AnnotationOptionsToolbar = class extends _ModuleSupport38.BaseProperties { + constructor(ctx, getActiveDatum) { + super(); + this.ctx = ctx; + this.getActiveDatum = getActiveDatum; + this.enabled = true; + this.buttons = new PropertiesArray(AnnotationOptionsButtonProperties); + this.cleanup = new CleanupRegistry(); + this.events = new EventEmitter(); + this.visibleButtons = []; + this.toolbar = new FloatingAnnotationOptionsToolbar( + this.ctx, + "ariaLabelAnnotationOptionsToolbar", + "annotation-options" + ); + this.colorPicker = new ColorPicker(this.ctx); + this.textSizeMenu = new Menu(this.ctx, "text-size"); + this.lineStyleTypeMenu = new Menu(this.ctx, "annotations-line-style-type"); + this.lineStrokeWidthMenu = new Menu(this.ctx, "annotations-line-stroke-width"); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPress.bind(this)), + this.toolbar.addToolbarListener("toolbar-moved", this.onToolbarMoved.bind(this)), + ctx.widgets.seriesWidget.addListener("drag-start", this.onDragStart.bind(this)), + ctx.widgets.seriesWidget.addListener("drag-end", this.onDragEnd.bind(this)), + () => { + this.colorPicker.destroy(); + this.toolbar.destroy(); + } + ); + } + onDragStart() { + this.toolbar.ignorePointerEvents(); + } + onDragEnd() { + this.toolbar.capturePointerEvents(); + } + destroy() { + this.cleanup.flush(); + } + show() { + if (!this.enabled) + return; + this.toolbar.show(); + } + hide() { + this.toolbar.hide(); + } + updateButtons(datum) { + if (!this.enabled) + return; + const visible = { + ["line-style-type" /* LineStyleType */]: hasLineStyle(datum), + ["line-stroke-width" /* LineStrokeWidth */]: hasLineStyle(datum), + ["line-color" /* LineColor */]: hasLineColor(datum), + ["text-color" /* TextColor */]: hasTextColor(datum), + ["fill-color" /* FillColor */]: hasFillColor(datum), + ["text-size" /* TextSize */]: hasFontSize(datum), + ["settings" /* Settings */]: hasLineText(datum), + ["lock" /* Lock */]: true, + ["delete" /* Delete */]: true + }; + this.visibleButtons = this.buttons.filter((button) => visible[button.value]); + this.toolbar.clearButtons(); + this.toolbar.updateButtons(this.visibleButtons); + this.refreshButtons(datum); + } + setAnchorScene(scene) { + if (this.toolbar.hasBeenDragged()) + return; + this.toolbar.setAnchor(scene.getAnchor()); + } + hideOverlays() { + this.toolbar.clearActiveButton(); + this.colorPicker.hide({ lastFocus: null }); + this.textSizeMenu.hide(); + this.lineStyleTypeMenu.hide(); + this.lineStrokeWidthMenu.hide(); + this.events.emit("hid-overlays", null); + } + clearActiveButton() { + this.toolbar.clearActiveButton(); + } + updateColors(datum) { + this.updateColorPickerColor( + "line-color" /* LineColor */, + datum.getDefaultColor("line-color" /* LineColor */), + datum.getDefaultOpacity("line-color" /* LineColor */), + "isMultiColor" in datum && datum?.isMultiColor + ); + this.updateColorPickerColor( + "fill-color" /* FillColor */, + datum.getDefaultColor("fill-color" /* FillColor */), + datum.getDefaultOpacity("fill-color" /* FillColor */), + "isMultiColor" in datum && datum?.isMultiColor + ); + this.updateColorPickerColor( + "text-color" /* TextColor */, + datum.getDefaultColor("text-color" /* TextColor */), + datum.getDefaultOpacity("text-color" /* TextColor */), + "isMultiColor" in datum && datum?.isMultiColor + ); + } + updateColorPickerColor(colorPickerType, color6, opacity, isMultiColor) { + if (color6 != null && opacity != null) { + const { r, g, b } = Color4.fromString(color6); + color6 = Color4.fromArray([r, g, b, opacity]).toHexString(); + } + this.updateButtonByValue(colorPickerType, { color: color6, isMultiColor }); + } + updateFontSize(fontSize) { + this.updateButtonByValue("text-size" /* TextSize */, { + label: fontSize == null ? void 0 : String(fontSize) + }); + } + updateLineStyleType(item) { + this.updateButtonByValue("line-style-type" /* LineStyleType */, { + icon: item.icon + }); + } + updateStrokeWidth(item) { + this.updateButtonByValue("line-stroke-width" /* LineStrokeWidth */, { + label: item.label, + strokeWidth: item.value + }); + } + onButtonPress({ + event, + button, + buttonWidget + }) { + const datum = this.getActiveDatum(); + if (!datum) + return; + this.hideOverlays(); + switch (button.value) { + case "line-style-type" /* LineStyleType */: { + const lineStyle = hasLineStyle(datum) ? getLineStyle(datum.lineDash, datum.lineStyle) : void 0; + this.lineStyleTypeMenu.show(buttonWidget, { + items: LINE_STYLE_TYPE_ITEMS, + ariaLabel: this.ctx.localeManager.t("toolbarAnnotationsLineStyle"), + value: lineStyle, + onPress: (item) => this.onLineStyleTypeMenuPress(item, datum), + class: "ag-charts-annotations__line-style-type-menu" + }); + break; + } + case "line-stroke-width" /* LineStrokeWidth */: { + const strokeWidth = hasLineStyle(datum) ? datum.strokeWidth : void 0; + this.lineStrokeWidthMenu.show(buttonWidget, { + items: LINE_STROKE_WIDTH_ITEMS, + ariaLabel: this.ctx.localeManager.t("toolbarAnnotationsLineStrokeWidth"), + value: strokeWidth, + onPress: (item) => this.onLineStrokeWidthMenuPress(item, datum), + class: "ag-charts-annotations__line-stroke-width-menu" + }); + break; + } + case "line-color" /* LineColor */: + case "fill-color" /* FillColor */: + case "text-color" /* TextColor */: { + this.toolbar.toggleActiveButtonByIndex(button.index); + this.colorPicker.show({ + color: datum?.getDefaultColor(button.value), + opacity: datum?.getDefaultOpacity(button.value), + sourceEvent: event.sourceEvent, + hasMultiColorOption: "isMultiColor" in datum, + isMultiColor: "isMultiColor" in datum && datum?.isMultiColor, + onChange: datum == null ? void 0 : this.onColorPickerChange.bind(this, button.value, datum), + onChangeHide: ((type) => { + this.events.emit("saved-color", { + type: datum.type, + colorPickerType: button.value, + color: datum.getDefaultColor(type) + }); + }).bind(this, button.value) + }); + break; + } + case "text-size" /* TextSize */: { + const fontSize = isTextType(datum) ? datum.fontSize : void 0; + this.textSizeMenu.show(buttonWidget, { + items: TEXT_SIZE_ITEMS, + ariaLabel: this.ctx.localeManager.t("toolbarAnnotationsTextSize"), + value: fontSize, + onPress: (item) => this.onTextSizeMenuPress(item, datum), + class: "ag-charts-annotations__text-size-menu" + }); + break; + } + case "delete" /* Delete */: { + this.events.emit("pressed-delete", null); + break; + } + case "lock" /* Lock */: { + datum.locked = !datum.locked; + this.refreshButtons(datum); + this.events.emit("pressed-lock", { locked: datum.locked }); + break; + } + case "settings" /* Settings */: { + this.toolbar.toggleActiveButtonByIndex(button.index); + this.events.emit("pressed-settings", event); + break; + } + } + } + onToolbarMoved(event) { + const { buttonBounds, popoverBounds } = event; + const colorPickerAnchor = { x: popoverBounds.x, y: popoverBounds.y + popoverBounds.height + 4 }; + const colorPickerFallbackAnchor = { y: popoverBounds.y - 4 }; + this.colorPicker.setAnchor(colorPickerAnchor, colorPickerFallbackAnchor); + for (const [index, bounds] of buttonBounds.entries()) { + const button = this.visibleButtons.at(index); + if (!button) + continue; + const anchor = { x: bounds.x, y: bounds.y + bounds.height - 1 }; + const fallbackAnchor = { y: bounds.y }; + switch (button.value) { + case "line-stroke-width" /* LineStrokeWidth */: + this.lineStrokeWidthMenu.setAnchor(anchor, fallbackAnchor); + break; + case "line-style-type" /* LineStyleType */: + this.lineStyleTypeMenu.setAnchor(anchor, fallbackAnchor); + break; + case "text-size" /* TextSize */: + this.textSizeMenu.setAnchor(anchor, fallbackAnchor); + break; + } + } + } + onColorPickerChange(colorPickerType, datum, colorOpacity, color6, opacity, isMultiColor) { + this.events.emit("updated-color", { + type: datum.type, + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }); + this.updateColorPickerColor(colorPickerType, colorOpacity, opacity, isMultiColor); + } + onTextSizeMenuPress(item, datum) { + if (!hasFontSize(datum)) + return; + const fontSize = item.value; + this.events.emit("updated-font-size", { type: datum.type, fontSize }); + this.textSizeMenu.hide(); + this.updateFontSize(fontSize); + } + onLineStyleTypeMenuPress(item, datum) { + if (!hasLineStyle(datum)) + return; + const type = item.value; + this.events.emit("updated-line-style", { type: datum.type, lineStyleType: type }); + this.lineStyleTypeMenu.hide(); + this.updateLineStyleType(item); + } + onLineStrokeWidthMenuPress(item, datum) { + if (!hasLineStyle(datum)) { + return; + } + const strokeWidth = item.value; + this.events.emit("updated-line-width", { type: datum.type, strokeWidth }); + this.lineStrokeWidthMenu.hide(); + this.updateStrokeWidth(item); + } + refreshButtons(datum) { + const locked = datum.locked ?? false; + for (const [index, button] of this.visibleButtons.entries()) { + if (!button) + continue; + if (button.value === "lock" /* Lock */) { + this.toolbar.toggleSwitchCheckedByIndex(index, locked); + this.updateButtonByIndex(index, locked ? button.checkedOverrides.toJson() : button.toJson()); + } else { + this.toolbar.toggleButtonEnabledByIndex(index, !locked); + } + } + if (hasFontSize(datum)) + this.updateFontSize(datum.fontSize); + this.updateColors(datum); + this.updateLineStyles(datum); + } + updateLineStyles(datum) { + if (!hasLineStyle(datum)) + return; + const strokeWidth = datum.strokeWidth ?? 1; + const lineStyleType = getLineStyle(datum.lineDash, datum.lineStyle); + this.updateStrokeWidth({ + strokeWidth, + value: strokeWidth, + label: String(strokeWidth) + }); + this.updateLineStyleType( + LINE_STYLE_TYPE_ITEMS.find((item) => item.value === lineStyleType) ?? LINE_STYLE_TYPE_ITEMS[0] + ); + } + updateButtonByValue(value, change) { + const index = this.visibleButtons.findIndex((button) => button.value === value); + if (index === -1) + return; + this.updateButtonByIndex(index, change); + } + updateButtonByIndex(index, change) { + const button = this.visibleButtons.at(index); + if (!button) + return; + this.toolbar.updateButtonByIndex(index, { ...button.toJson(), ...change, value: change.value ?? button.value }); + } +}; +__decorateClass([ + Property28 +], AnnotationOptionsToolbar.prototype, "enabled", 2); +__decorateClass([ + Property28 +], AnnotationOptionsToolbar.prototype, "buttons", 2); + +// packages/ag-charts-enterprise/src/features/annotations/states/dragState.ts +import { _ModuleSupport as _ModuleSupport39 } from "ag-charts-community"; +var { StateMachine, StateMachineProperty, Vec2: Vec22, Debug } = _ModuleSupport39; +var DragStateMachine = class extends StateMachine { + constructor(ctx) { + const actionKeyChange = ({ context }) => { + this.node?.drag(this.datum, this.offset, context, this.snapping); + ctx.update(); + }; + super("idle", { + idle: { + dragStart: { + target: "dragging", + action: ({ offset, context }) => { + this.hasMoved = false; + this.dragStart = offset; + this.offset = offset; + this.node?.dragStart(this.datum, offset, context); + } + } + }, + dragging: { + keyDown: actionKeyChange, + keyUp: actionKeyChange, + drag: ({ offset, context }) => { + this.hasMoved = Vec22.lengthSquared(Vec22.sub(offset, this.dragStart)) > 0; + this.offset = offset; + this.node?.drag(this.datum, offset, context, this.snapping); + ctx.update(); + }, + dragEnd: { + target: StateMachine.parent, + action: () => { + this.node?.stopDragging(); + if (this.hasMoved) + ctx.recordAction("Move annotation"); + ctx.update(); + } + } + } + }); + this.debug = Debug.create(true, "annotations"); + this.hasMoved = false; + this.snapping = false; + } +}; +__decorateClass([ + StateMachineProperty() +], DragStateMachine.prototype, "snapping", 2); +__decorateClass([ + StateMachineProperty() +], DragStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty() +], DragStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/arrow-down/arrowDownProperties.ts +import { _ModuleSupport as _ModuleSupport40 } from "ag-charts-community"; +import { isObject as isObject13 } from "ag-charts-core"; +var { Property: Property29 } = _ModuleSupport40; +var ArrowDownProperties = class extends ShapePointProperties { + constructor() { + super(...arguments); + this.type = "arrow-down" /* ArrowDown */; + } + static is(value) { + return isObject13(value) && value.type === "arrow-down" /* ArrowDown */; + } +}; +__decorateClass([ + Property29 +], ArrowDownProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/arrow-down/arrowDownScene.ts +import { _ModuleSupport as _ModuleSupport47 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-up/arrowUpScene.ts +import { _ModuleSupport as _ModuleSupport46 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/annotationScene.ts +import { _ModuleSupport as _ModuleSupport43 } from "ag-charts-community"; +import { isObject as isObject14 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/handle.ts +import { _ModuleSupport as _ModuleSupport42 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/annotationShape.ts +import { _ModuleSupport as _ModuleSupport41 } from "ag-charts-community"; +var AnnotationShape = class extends _ModuleSupport41.Marker { + // Use exact method for this, rather than the Marker's high performance approximation. + isPointInPath(x, y) { + this.updatePathIfDirty(); + return this.path.closedPath && this.path.isPointInPath(x, y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/handle.ts +var _Handle = class _Handle extends _ModuleSupport42.Group { + constructor() { + super(...arguments); + this.active = false; + this.locked = false; + this.visible = false; + this.zIndex = 1; + } + drag(target) { + const { handle: handle2, locked } = this; + if (locked) { + return { point: { x: handle2.x, y: handle2.y }, offset: { x: 0, y: 0 } }; + } + return { + point: target, + offset: { x: target.x - handle2.x, y: target.y - handle2.y } + }; + } + toggleActive(active) { + this.active = active; + if (!active) { + this.handle.strokeWidth = _Handle.INACTIVE_STROKE_WIDTH; + } + } + toggleHovered(hovered) { + this.glow.visible = !this.locked && hovered; + this.glow.dirtyPath = true; + } + toggleDragging(dragging) { + if (this.locked) + return; + this.handle.visible = !dragging; + this.glow.visible = this.glow.visible && !dragging; + this.handle.dirtyPath = true; + this.glow.dirtyPath = true; + } + toggleLocked(locked) { + this.locked = locked; + } + getCursor() { + return void 0; + } + containsPoint(x, y) { + return this.handle.containsPoint(x, y); + } +}; +_Handle.INACTIVE_STROKE_WIDTH = 2; +var Handle2 = _Handle; +var _InvariantHandle = class _InvariantHandle extends Handle2 { + constructor() { + super(); + this.handle = new AnnotationShape({ shape: "circle" }); + this.glow = new AnnotationShape({ shape: "circle" }); + this.append([this.handle]); + this.handle.size = _InvariantHandle.HANDLE_SIZE; + this.handle.strokeWidth = Handle2.INACTIVE_STROKE_WIDTH; + this.handle.zIndex = 2; + } + update(styles) { + this.handle.setProperties({ ...styles, strokeWidth: Handle2.INACTIVE_STROKE_WIDTH }); + } + drag(target) { + return { point: target, offset: { x: 0, y: 0 } }; + } +}; +_InvariantHandle.HANDLE_SIZE = 7; +_InvariantHandle.GLOW_SIZE = 9; +var InvariantHandle = _InvariantHandle; +var _UnivariantHandle = class _UnivariantHandle extends Handle2 { + constructor() { + super(); + this.handle = new _ModuleSupport42.Rect(); + this.glow = new _ModuleSupport42.Rect(); + this.gradient = "horizontal"; + this.append([this.glow, this.handle]); + this.handle.cornerRadius = _UnivariantHandle.CORNER_RADIUS; + this.handle.width = _UnivariantHandle.HANDLE_SIZE; + this.handle.height = _UnivariantHandle.HANDLE_SIZE; + this.handle.strokeWidth = Handle2.INACTIVE_STROKE_WIDTH; + this.handle.zIndex = 2; + this.glow.cornerRadius = _UnivariantHandle.CORNER_RADIUS; + this.glow.width = _UnivariantHandle.GLOW_SIZE; + this.glow.height = _UnivariantHandle.GLOW_SIZE; + this.glow.strokeWidth = 0; + this.glow.fillOpacity = 0.2; + this.glow.zIndex = 1; + this.glow.visible = false; + } + toggleLocked(locked) { + super.toggleLocked(locked); + if (locked) { + const offset = (_UnivariantHandle.HANDLE_SIZE - InvariantHandle.HANDLE_SIZE) / 2; + this.handle.cornerRadius = 1; + this.handle.fill = this.handle.stroke; + this.handle.strokeWidth = 0; + this.handle.x += offset; + this.handle.y += offset; + this.handle.width = InvariantHandle.HANDLE_SIZE; + this.handle.height = InvariantHandle.HANDLE_SIZE; + this.glow.width = InvariantHandle.GLOW_SIZE; + this.glow.height = InvariantHandle.GLOW_SIZE; + } else { + this.handle.cornerRadius = _UnivariantHandle.CORNER_RADIUS; + this.handle.width = _UnivariantHandle.HANDLE_SIZE; + this.handle.height = _UnivariantHandle.HANDLE_SIZE; + this.glow.width = _UnivariantHandle.GLOW_SIZE; + this.glow.height = _UnivariantHandle.GLOW_SIZE; + if (this.cachedStyles) { + this.handle.setProperties(this.cachedStyles); + } + } + } + update(styles) { + this.cachedStyles = { ...styles }; + if (!this.active) { + delete styles.strokeWidth; + } + if (this.locked) { + delete styles.fill; + delete styles.strokeWidth; + const offset = (_UnivariantHandle.HANDLE_SIZE - InvariantHandle.HANDLE_SIZE) / 2; + styles.x -= offset; + styles.y -= offset; + this.cachedStyles.x -= offset; + this.cachedStyles.y -= offset; + } + this.handle.setProperties(styles); + this.glow.setProperties({ + ...styles, + x: (styles.x ?? this.glow.x) - 2, + y: (styles.y ?? this.glow.y) - 2, + strokeWidth: 0, + fill: styles.stroke + }); + } + drag(target) { + if (this.locked) { + return { point: target, offset: { x: 0, y: 0 } }; + } + if (this.gradient === "vertical") { + return { + point: { x: target.x, y: this.handle.y }, + offset: { x: target.x - this.handle.x, y: 0 } + }; + } + return { + point: { x: this.handle.x, y: target.y }, + offset: { x: 0, y: target.y - this.handle.y } + }; + } + getCursor() { + if (this.locked) + return; + return this.gradient === "vertical" ? "col-resize" : "row-resize"; + } +}; +_UnivariantHandle.HANDLE_SIZE = 12; +_UnivariantHandle.GLOW_SIZE = 16; +_UnivariantHandle.CORNER_RADIUS = 4; +var UnivariantHandle = _UnivariantHandle; +var _DivariantHandle = class _DivariantHandle extends Handle2 { + constructor() { + super(); + this.handle = new AnnotationShape({ shape: "circle" }); + this.glow = new AnnotationShape({ shape: "circle" }); + this.append([this.glow, this.handle]); + this.handle.size = _DivariantHandle.HANDLE_SIZE; + this.handle.strokeWidth = Handle2.INACTIVE_STROKE_WIDTH; + this.handle.zIndex = 2; + this.glow.size = _DivariantHandle.GLOW_SIZE; + this.glow.strokeWidth = 0; + this.glow.fillOpacity = 0.2; + this.glow.zIndex = 1; + this.glow.visible = false; + } + toggleLocked(locked) { + super.toggleLocked(locked); + if (locked) { + this.handle.fill = this.handle.stroke; + this.handle.strokeWidth = 0; + this.handle.size = InvariantHandle.HANDLE_SIZE; + this.glow.size = InvariantHandle.GLOW_SIZE; + } else { + this.handle.size = _DivariantHandle.HANDLE_SIZE; + this.glow.size = _DivariantHandle.GLOW_SIZE; + if (this.cachedStyles) { + this.handle.setProperties(this.cachedStyles); + } + } + } + update(styles) { + this.cachedStyles = { ...styles }; + if (!this.active) { + delete styles.strokeWidth; + } + if (this.locked) { + delete styles.fill; + delete styles.strokeWidth; + } + this.handle.setProperties(styles); + this.glow.setProperties({ ...styles, strokeWidth: 0, fill: styles.stroke }); + } + getCursor() { + return "pointer"; + } +}; +_DivariantHandle.HANDLE_SIZE = 11; +_DivariantHandle.GLOW_SIZE = 17; +var DivariantHandle = _DivariantHandle; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/annotationScene.ts +var { ZIndexMap: ZIndexMap2 } = _ModuleSupport43; +var AnnotationScene = class extends _ModuleSupport43.Group { + constructor() { + super(...arguments); + this.name = "AnnotationScene"; + this.zIndex = ZIndexMap2.CHART_ANNOTATION; + } + static isCheck(value, type) { + return isObject14(value) && Object.hasOwn(value, "type") && value.type === type; + } + toggleHovered(hovered, active, readOnly) { + if (readOnly === true) + return; + this.toggleHandles(hovered || active); + } + computeBBoxWithoutHandles() { + return _ModuleSupport43.Transformable.toCanvas( + this, + _ModuleSupport43.Group.computeChildrenBBox(this.excludeChildren({ instance: Handle2 })) + ); + } + updateNode(constructor, node, isConfigured) { + if (!isConfigured && node) { + node.remove(); + return; + } + if (isConfigured && node == null) { + node = new constructor(); + this.appendChild(node); + } + return node; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/pointScene.ts +import { _ModuleSupport as _ModuleSupport45 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/utils/coords.ts +import { _ModuleSupport as _ModuleSupport44 } from "ag-charts-community"; +import { entries } from "ag-charts-core"; +var { ContinuousScale: ContinuousScale2, Vec2: Vec23, toRadians: toRadians3 } = _ModuleSupport44; +function snapPoint(offset, context, snapping = false, origin, angleStep = 1) { + if (!snapping) + return invertCoords(offset, context); + const center = origin ? convertPoint(origin, context) : Vec23.origin(); + return invertCoords(snapToAngle(offset, center, angleStep), context); +} +function snapToAngle(vector, center, step) { + const radial = Vec23.sub(vector, center); + const stepRadians = toRadians3(step); + const theta = Math.round(Vec23.angle(radial) / stepRadians) * stepRadians; + return Vec23.rotate(radial, theta, center); +} +function getDragStartState(points, context) { + const dragState = {}; + for (const [name, point] of entries(points)) { + dragState[name] = convertPoint(point, context); + } + return dragState; +} +function translate(vectors, translation, context, options = { + overflowContinuous: 0, + translateVectors: void 0, + invertYVectors: void 0, + snap: void 0 +}) { + const { xAxis, yAxis } = context; + const vectorNames = Object.keys(vectors); + const overflowsX = []; + const overflowsY = []; + const translateVectors = new Set(options.translateVectors ?? vectorNames); + const invertYVectors = new Set(options.invertYVectors ?? []); + const movingVectors = /* @__PURE__ */ new Set([...translateVectors, ...invertYVectors]); + const invertYTranslation = Vec23.multiply(translation, Vec23.from(1, -1)); + for (const name of vectorNames) { + if (movingVectors.has(name)) { + vectors[name] = Vec23.add(vectors[name], invertYVectors.has(name) ? invertYTranslation : translation); + if (options.snap) { + vectors[name] = snapToAngle(vectors[name], options.snap.vectors[name], options.snap.angle); + } + } + overflowsX.push(xAxis.getRangeOverflow(vectors[name].x)); + overflowsY.push(yAxis.getRangeOverflow(vectors[name].y)); + } + const sortNumbersAbs = (a, b) => Math.abs(a) - Math.abs(b); + const overflowDirection = (scale, directionTranslation, overflows) => { + if (options.overflowContinuous === 0 || !ContinuousScale2.is(scale)) { + return overflows.toSorted(sortNumbersAbs).at(-1) ?? 0; + } + if (vectorNames.length === movingVectors.size) { + return overflows.toSorted(sortNumbersAbs).at(-options.overflowContinuous - 1) ?? 0; + } + if (overflows.filter((value) => value !== 0).length <= options.overflowContinuous) { + return 0; + } + const newTranslatedOverflows = overflows.filter( + (value, index) => value !== 0 && Math.abs(value) <= Math.abs(directionTranslation) && movingVectors.has(vectorNames[index]) + ); + return newTranslatedOverflows.toSorted(sortNumbersAbs).at(-1) ?? 0; + }; + const overflow = Vec23.from( + overflowDirection(xAxis.scale, translation.x, overflowsX), + overflowDirection(yAxis.scale, translation.y, overflowsY) + ); + if (!Vec23.equal(overflow, Vec23.origin())) { + for (const name of vectorNames) { + if (!movingVectors.has(name)) + continue; + vectors[name] = Vec23.round(Vec23.sub(vectors[name], overflow), 4); + } + } + const result = {}; + for (const name of vectorNames) { + result[name] = invertCoords(vectors[name], context); + } + return result; +} + +// packages/ag-charts-enterprise/src/features/annotations/scenes/pointScene.ts +var { Vec2: Vec24 } = _ModuleSupport45; +var PointScene = class extends AnnotationScene { + constructor() { + super(...arguments); + this.handle = new DivariantHandle(); + this.anchor = { + x: 0, + y: 0, + position: "above" + }; + } + update(datum, context) { + const coords = convertPoint(datum, context); + this.updateHandle(datum, coords); + this.anchor = this.updateAnchor(datum, coords, context); + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ handle: datum }, context) + }; + } + drag(datum, target, context) { + const { dragState } = this; + if (!datum.isWriteable() || !dragState) + return; + const { point } = translate({ point: dragState.handle }, Vec24.sub(target, dragState.offset), context); + datum.x = point.x; + datum.y = point.y; + } + translate(datum, translation, context) { + if (!datum.isWriteable()) + return; + const { point } = translate({ point: convertPoint(datum, context) }, translation, context); + datum.x = point.x; + datum.y = point.y; + } + toggleHandles(show) { + this.handle.visible = Boolean(show); + this.handle.toggleHovered(this.activeHandle === "handle"); + } + toggleActive(active) { + this.toggleHandles(active); + this.handle.toggleActive(active); + } + stopDragging() { + this.handle.toggleDragging(false); + } + copy(datum, copiedDatum, context) { + const coords = convertPoint(datum, context); + const point = invertCoords({ x: coords.x - 30, y: coords.y - 30 }, context); + copiedDatum.x = point.x; + copiedDatum.y = point.y; + return copiedDatum; + } + getAnchor() { + return this.anchor; + } + getCursor() { + return "pointer"; + } + containsPoint(x, y) { + const { handle: handle2 } = this; + this.activeHandle = void 0; + if (handle2.containsPoint(x, y)) { + this.activeHandle = "handle"; + return true; + } + return false; + } + getNodeAtCoords(x, y) { + if (this.handle.containsPoint(x, y)) + return "handle"; + } + updateHandle(datum, point, bbox) { + const { x, y } = this.getHandleCoords(datum, point, bbox); + const styles = this.getHandleStyles(datum); + this.handle.update({ ...styles, x, y }); + this.handle.toggleLocked(datum.locked ?? false); + } + updateAnchor(datum, point, context) { + const coords = this.getHandleCoords(datum, point); + return { + x: coords.x + context.seriesRect.x, + y: coords.y + context.seriesRect.y, + position: this.anchor.position + }; + } + getHandleCoords(_datum, point, _bbox) { + return { + x: point.x, + y: point.y + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/shapePointScene.ts +var ShapePointScene = class extends PointScene { + constructor() { + super(); + this.append([this.handle]); + } + update(datum, context) { + super.update(datum, context); + const coords = convertPoint(datum, context); + this.updateShape(datum, coords); + } + updateShape(datum, point) { + this.updateShapeStyles(datum); + this.updateShapePath(datum, point); + } + updateShapeStyles(datum) { + const { shape } = this; + shape.fill = datum.fill; + shape.fillOpacity = datum.fillOpacity ?? 1; + } + updateShapePath(datum, point) { + const { shape } = this; + shape.x = point.x; + shape.y = point.y; + shape.size = datum.size; + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.shape.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.shape.containsPoint(x, y)) + return "shape"; + return super.getNodeAtCoords(x, y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-up/arrowUpScene.ts +var arrowUpPoints = [ + [0.5, 0], + [1, 0.5], + [0.75, 0.5], + [0.75, 1], + [0.25, 1], + [0.25, 0.5], + [0, 0.5] +]; +function arrowUp(params) { + _ModuleSupport46.drawMarkerUnitPolygon(params, arrowUpPoints); +} +arrowUp.anchor = { x: 0.5, y: 0 }; +var ArrowUpScene = class extends ShapePointScene { + constructor() { + super(); + this.type = "arrow-up" /* ArrowUp */; + this.shape = new AnnotationShape({ shape: arrowUp }); + this.append([this.shape]); + } + static is(value) { + return AnnotationScene.isCheck(value, "arrow-up" /* ArrowUp */); + } + getHandleCoords(datum, point) { + const halfSize = DivariantHandle.HANDLE_SIZE / 2; + const handleCoords = super.getHandleCoords(datum, point); + handleCoords.y -= halfSize; + return handleCoords; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-down/arrowDownScene.ts +var arrowDownPoints = arrowUpPoints.map(([x, y]) => [x, 1 - y]); +function arrowDown(params) { + _ModuleSupport47.drawMarkerUnitPolygon(params, arrowDownPoints); +} +arrowDown.anchor = { x: 0.5, y: 1 }; +var ArrowDownScene = class extends ShapePointScene { + constructor() { + super(); + this.type = "arrow-down" /* ArrowDown */; + this.shape = new AnnotationShape({ shape: arrowDown }); + this.append([this.shape]); + } + static is(value) { + return AnnotationScene.isCheck(value, "arrow-down" /* ArrowDown */); + } + updateAnchor(datum, point, context) { + const anchor = super.updateAnchor(datum, point, context); + anchor.y -= datum.size; + return anchor; + } + getHandleCoords(datum, point) { + const halfSize = DivariantHandle.HANDLE_SIZE / 2; + const handleCoords = super.getHandleCoords(datum, point); + handleCoords.y += halfSize; + return handleCoords; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/states/pointState.ts +import { _ModuleSupport as _ModuleSupport48 } from "ag-charts-community"; +var { StateMachine: StateMachine2, StateMachineProperty: StateMachineProperty2, Debug: Debug2 } = _ModuleSupport48; +var PointStateMachine = class extends StateMachine2 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ x: point.x, y: point.y }); + ctx.create(datum); + }; + const actionFirstRender = () => { + this.node?.toggleActive(true); + ctx.showAnnotationOptions(); + ctx.update(); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + cancel: StateMachine2.parent, + reset: StateMachine2.parent + }, + "waiting-first-render": { + render: { + target: StateMachine2.parent, + action: actionFirstRender + } + } + }); + this.debug = Debug2.create(true, "annotations"); + } +}; +__decorateClass([ + StateMachineProperty2() +], PointStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/arrow-down/arrowDownState.ts +var ArrowDownStateMachine = class extends PointStateMachine { + createDatum() { + return new ArrowDownProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-down/arrowDownConfig.ts +var arrowDownConfig = { + type: "arrow-down" /* ArrowDown */, + datum: ArrowDownProperties, + scene: ArrowDownScene, + isDatum: ArrowDownProperties.is, + translate: (node, datum, translation, context) => { + if (ArrowDownProperties.is(datum) && ArrowDownScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (ArrowDownProperties.is(datum) && ArrowDownProperties.is(copiedDatum) && ArrowDownScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ArrowDownProperties.is(datum) && ArrowDownScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ArrowDownStateMachine({ + ...ctx, + create: createDatum("arrow-down" /* ArrowDown */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-up/arrowUpProperties.ts +import { _ModuleSupport as _ModuleSupport49 } from "ag-charts-community"; +import { isObject as isObject15 } from "ag-charts-core"; +var { Property: Property30 } = _ModuleSupport49; +var ArrowUpProperties = class extends ShapePointProperties { + constructor() { + super(...arguments); + this.type = "arrow-up" /* ArrowUp */; + } + static is(value) { + return isObject15(value) && value.type === "arrow-up" /* ArrowUp */; + } +}; +__decorateClass([ + Property30 +], ArrowUpProperties.prototype, "type", 2); + +// packages/ag-charts-enterprise/src/features/annotations/arrow-up/arrowUpState.ts +var ArrowUpStateMachine = class extends PointStateMachine { + createDatum() { + return new ArrowUpProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/arrow-up/arrowUpConfig.ts +var arrowUpConfig = { + type: "arrow-up" /* ArrowUp */, + datum: ArrowUpProperties, + scene: ArrowUpScene, + isDatum: ArrowUpProperties.is, + translate: (node, datum, translation, context) => { + if (ArrowUpProperties.is(datum) && ArrowUpScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (ArrowUpProperties.is(datum) && ArrowUpProperties.is(copiedDatum) && ArrowUpScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ArrowUpProperties.is(datum) && ArrowUpScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ArrowUpStateMachine({ + ...ctx, + create: createDatum("arrow-up" /* ArrowUp */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutScene.ts +import { _ModuleSupport as _ModuleSupport53 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/textualStartEndScene.ts +import { _ModuleSupport as _ModuleSupport52 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/startEndScene.ts +import { _ModuleSupport as _ModuleSupport51 } from "ag-charts-community"; +import { entries as entries2 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/linearScene.ts +import { _ModuleSupport as _ModuleSupport50 } from "ag-charts-community"; +var { Vec2: Vec25, Vec4 } = _ModuleSupport50; +var LinearScene = class extends AnnotationScene { + constructor() { + super(...arguments); + this.overflowContinuous = 0; + } + extendLine({ x1, y1, x2, y2 }, datum, context) { + const linePoints = { x1, y1, x2, y2 }; + if (!datum.extendStart && !datum.extendEnd) { + return linePoints; + } + const [left, right] = boundsIntersections(linePoints, context.yAxis.bounds); + const isFlippedX = linePoints.x2 < linePoints.x1; + const isFlippedY = linePoints.y1 >= linePoints.y2; + const isVertical = linePoints.x2 === linePoints.x1; + if (datum.extendEnd) { + if (isVertical) { + linePoints.y2 = isFlippedY ? right.y : left.y; + } else { + linePoints.x2 = isFlippedX ? left.x : right.x; + linePoints.y2 = isFlippedX ? left.y : right.y; + } + } + if (datum.extendStart) { + if (isVertical) { + linePoints.y1 = isFlippedY ? left.y : right.y; + } else { + linePoints.x1 = isFlippedX ? right.x : left.x; + linePoints.y1 = isFlippedX ? right.y : left.y; + } + } + return linePoints; + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ start: datum.start, end: datum.end }, context) + }; + } + drag(datum, target, context, snapping) { + if (!datum.isWriteable()) + return; + if (this.activeHandle) { + this.dragHandle(datum, target, context, snapping); + } else { + this.dragAll(datum, target, context); + } + } + dragAll(datum, target, context) { + const { dragState } = this; + if (!dragState) + return; + this.translatePoints(datum, dragState.start, dragState.end, Vec25.sub(target, dragState.offset), context); + } + translate(datum, translation, context) { + if (!datum.isWriteable()) + return; + this.translatePoints( + datum, + convertPoint(datum.start, context), + convertPoint(datum.end, context), + translation, + context + ); + } + copy(datum, copiedDatum, context) { + const coords = convertLine(datum, context); + if (!coords) { + return; + } + const bbox = this.computeBBoxWithoutHandles(); + const translation = { x: -bbox.width / 2, y: -bbox.height / 2 }; + this.translatePoints(copiedDatum, Vec4.start(coords), Vec4.end(coords), translation, context); + return copiedDatum; + } + translatePoints(datum, start, end, translation, context) { + const vectors = this.getTranslatePointsVectors(start, end); + const points = translate(vectors, translation, context, { + overflowContinuous: this.overflowContinuous + }); + datum.start.x = points.start.x; + datum.end.x = points.end.x; + datum.start.y = points.start.y; + datum.end.y = points.end.y; + } + getTranslatePointsVectors(start, end) { + return { start, end }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/startEndScene.ts +var { Vec2: Vec26, Vec4: Vec42 } = _ModuleSupport51; +var StartEndScene = class extends LinearScene { + constructor() { + super(...arguments); + this.start = new DivariantHandle(); + this.end = new DivariantHandle(); + this.anchor = { + x: 0, + y: 0, + position: "above" + }; + } + update(datum, context) { + const coords = convertLine(datum, context); + if (coords == null) { + return; + } + this.updateHandles(datum, coords); + this.updateAnchor(datum, coords, context); + } + toggleHandles(show) { + if (typeof show === "boolean") { + this.start.visible = show; + this.end.visible = show; + } else { + for (const [handle2, visible] of entries2(show)) { + this[handle2].visible = visible; + } + } + this.start.toggleHovered(this.activeHandle === "start"); + this.end.toggleHovered(this.activeHandle === "end"); + } + toggleActive(active) { + this.toggleHandles(active); + this.start.toggleActive(active); + this.end.toggleActive(active); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, dragState } = this; + if (!activeHandle || !dragState) + return; + this[activeHandle].toggleDragging(true); + const snapHandle = activeHandle === "start" ? "end" : "start"; + const snap = snapping ? { vectors: { [activeHandle]: convertPoint(datum[snapHandle], context) }, angle: datum.snapToAngle } : void 0; + const { [activeHandle]: point } = translate( + { [activeHandle]: dragState[activeHandle] }, + Vec26.sub(target, dragState.offset), + context, + { overflowContinuous: 0, snap } + ); + datum[activeHandle].x = point.x; + datum[activeHandle].y = point.y; + } + stopDragging() { + this.start.toggleDragging(false); + this.end.toggleDragging(false); + } + getAnchor() { + return this.anchor; + } + getCursor() { + return "pointer"; + } + containsPoint(x, y) { + const { start, end } = this; + this.activeHandle = void 0; + if (start.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + if (end.containsPoint(x, y)) { + this.activeHandle = "end"; + return true; + } + return false; + } + getNodeAtCoords(x, y) { + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y)) + return "handle"; + } + updateHandles(datum, coords, bbox) { + this.start.update({ + ...this.getHandleStyles(datum, "start"), + ...this.getHandleCoords(datum, coords, "start") + }); + this.end.update({ + ...this.getHandleStyles(datum, "end"), + ...this.getHandleCoords(datum, coords, "end", bbox) + }); + this.start.toggleLocked(datum.locked ?? false); + this.end.toggleLocked(datum.locked ?? false); + } + updateAnchor(_datum, coords, context, _bbox) { + this.anchor = { + x: coords.x1 + context.seriesRect.x, + y: coords.y1 + context.seriesRect.y, + position: this.anchor.position + }; + } + getHandleCoords(_datum, coords, handle2, _bbox) { + return handle2 === "start" ? Vec42.start(coords) : Vec42.end(coords); + } + getHandleStyles(datum, _handle) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/textualStartEndScene.ts +var { Vec4: Vec43 } = _ModuleSupport52; +var TextualStartEndScene = class extends StartEndScene { + constructor() { + super(...arguments); + this.label = new _ModuleSupport52.Text({ zIndex: 1 }); + this.anchor = { + x: 0, + y: 0, + position: "above-left" + }; + } + setTextInputBBox(bbox) { + this.textInputBBox = bbox; + this.markDirty("TextualStartEndScene"); + } + update(datum, context) { + const coords = convertLine(datum, context); + if (coords == null) { + return; + } + const bbox = this.getTextBBox(datum, coords); + this.updateLabel(datum, bbox, coords); + this.updateHandles(datum, coords, bbox); + this.updateShape(datum, bbox, coords); + this.updateAnchor(datum, coords, context, bbox); + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.label.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.label.containsPoint(x, y)) + return "text"; + return super.getNodeAtCoords(x, y); + } + getTextBBox(datum, coords) { + const { text: text2 } = datum.getText(); + return getBBox(datum, text2, Vec43.end(coords), this.textInputBBox); + } + updateLabel(datum, bbox, coords) { + const { text: text2, isPlaceholder } = datum.getText(); + updateTextNode(this.label, text2, isPlaceholder, datum, this.getLabelCoords(datum, bbox, coords)); + } + updateShape(_datum, _textBBox, _coords) { + } + getLabelCoords(_datum, _bbox, coords) { + return Vec43.end(coords); + } + getHandleStyles(datum, handle2) { + return { + ...super.getHandleStyles(datum, handle2), + stroke: datum.handle.stroke ?? datum.color + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutScene.ts +var { drawCorner, Path: Path5 } = _ModuleSupport53; +var CalloutScene = class extends TextualStartEndScene { + constructor() { + super(); + this.type = "callout" /* Callout */; + this.shape = new Path5(); + this.append([this.shape, this.label, this.start, this.end]); + } + static is(value) { + return AnnotationScene.isCheck(value, "callout" /* Callout */); + } + drag(datum, target, context, snapping) { + if (!datum.isWriteable()) + return; + if (this.activeHandle === "end") { + this.dragHandle(datum, target, context, snapping); + } else { + this.dragAll(datum, target, context); + } + } + getLabelCoords(datum, bbox, coords) { + const padding = datum.getPadding(); + const { + bodyBounds = { + x: 0, + y: 0, + width: 0, + height: 0 + } + } = this.getDimensions(datum, bbox, coords) ?? {}; + return { + x: bodyBounds.x + padding.left, + y: bodyBounds.y - padding.bottom + }; + } + getHandleStyles(datum, handle2) { + return handle2 === "start" ? { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + } : { fill: void 0, strokeWidth: 0 }; + } + updateAnchor(datum, coords, context, bbox) { + const { bodyBounds } = this.getDimensions(datum, bbox, coords) ?? {}; + const bounds = bodyBounds ?? bbox; + this.anchor = { + x: bounds.x + context.seriesRect.x, + y: bounds.y + context.seriesRect.y - bounds.height, + position: this.anchor.position + }; + } + updateShape(datum, textBBox, coords) { + const { shape } = this; + shape.fill = datum.fill; + shape.fillOpacity = datum.fillOpacity ?? 1; + shape.stroke = datum.stroke; + shape.strokeWidth = datum.strokeWidth ?? 1; + shape.strokeOpacity = datum.strokeOpacity ?? 1; + const { tailPoint, bodyBounds } = this.getDimensions(datum, textBBox, coords) ?? {}; + if (!tailPoint || !bodyBounds) { + return; + } + this.updatePath(tailPoint, bodyBounds); + } + updatePath(tailPoint, bodyBounds) { + const { x: tailX, y: tailY } = tailPoint; + const { x, y, width, height } = bodyBounds; + const top = y - height; + const right = x + width; + const placement = this.calculateCalloutPlacement({ x: tailX, y: tailY }, bodyBounds); + const cornerRadius = 8; + const pathParams = [ + { + coordinates: { + x0: x, + x1: x + cornerRadius, + y0: top + cornerRadius, + y1: top, + cx: placement === `topLeft` ? tailX : x + cornerRadius, + cy: placement === `topLeft` ? tailY : top + cornerRadius + }, + type: placement === `topLeft` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: x + cornerRadius, + x1: right - cornerRadius, + y0: top, + y1: top, + cx: tailX, + cy: tailY + }, + type: placement === `top` ? "calloutSide" : "side" + }, + { + coordinates: { + x0: right - cornerRadius, + x1: right, + y0: top, + y1: top + cornerRadius, + cx: placement === `topRight` ? tailX : right - cornerRadius, + cy: placement === `topRight` ? tailY : top + cornerRadius + }, + type: placement === `topRight` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: right, + x1: right, + y0: top + cornerRadius, + y1: y - cornerRadius, + cx: tailX, + cy: tailY + }, + type: placement === `right` ? "calloutSide" : "side" + }, + { + coordinates: { + x0: right, + x1: right - cornerRadius, + y0: y - cornerRadius, + y1: y, + cx: placement === `bottomRight` ? tailX : right - cornerRadius, + cy: placement === `bottomRight` ? tailY : y - cornerRadius + }, + type: placement === `bottomRight` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: right - cornerRadius, + x1: x + cornerRadius, + y0: y, + y1: y, + cx: tailX, + cy: tailY + }, + type: placement === `bottom` ? "calloutSide" : "side" + }, + { + coordinates: { + x0: x + cornerRadius, + x1: x, + y0: y, + y1: y - cornerRadius, + cx: placement === `bottomLeft` ? tailX : x + cornerRadius, + cy: placement === `bottomLeft` ? tailY : y - cornerRadius + }, + type: placement === `bottomLeft` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: x, + x1: x, + y0: y - cornerRadius, + y1: top + cornerRadius, + cx: tailX, + cy: tailY + }, + type: placement === `left` ? "calloutSide" : "side" + } + ]; + const { path } = this.shape; + path.clear(); + path.moveTo(x, top + cornerRadius); + for (const { coordinates, type } of pathParams) { + this.drawPath(path, coordinates, cornerRadius, type); + } + path.closePath(); + } + drawPath(path, { x0, y0, x1, y1, cx, cy }, cornerRadius, type) { + const sideTailRadius = 6; + switch (type) { + case "calloutCorner": { + path.lineTo(cx, cy); + path.lineTo(x1, y1); + break; + } + case "corner": { + drawCorner( + path, + { + x0, + x1, + y0, + y1, + cx, + cy + }, + cornerRadius, + false + ); + break; + } + case "calloutSide": { + if (x0 === x1) { + const direction = y0 > y1 ? -1 : 1; + const midY = Math.min(y0, y1) + Math.abs(y0 - y1) / 2; + path.lineTo(x0, midY - sideTailRadius * direction); + path.lineTo(cx, cy); + path.lineTo(x0, midY + sideTailRadius * direction); + path.lineTo(x1, y1); + } else { + const direction = x0 > x1 ? -1 : 1; + const midX = Math.min(x0, x1) + Math.abs(x1 - x0) / 2; + path.lineTo(midX - sideTailRadius * direction, y0); + path.lineTo(cx, cy); + path.lineTo(midX + sideTailRadius * direction, y0); + path.lineTo(x1, y1); + } + break; + } + case "side": + default: { + path.lineTo(x1, y1); + break; + } + } + } + calculateCalloutPlacement(placement, bounds) { + const right = bounds.x + bounds.width; + const top = bounds.y - bounds.height; + let xPlacement; + let yPlacement; + if (placement.x > right) { + xPlacement = "right"; + } else if (placement.x < bounds.x) { + xPlacement = "left"; + } + if (placement.y > bounds.y) { + yPlacement = "bottom"; + } else if (placement.y < top) { + yPlacement = "top"; + } + if (xPlacement && yPlacement) { + return `${yPlacement}${xPlacement[0].toUpperCase()}${xPlacement.substring(1)}`; + } else { + return yPlacement ?? xPlacement; + } + } + getDimensions(datum, textBBox, coords) { + const { fontSize } = datum; + const padding = datum.getPadding(); + const horizontalPadding = padding.left + padding.right; + const verticalPadding = padding.top + padding.bottom; + const width = textBBox.width + horizontalPadding; + const height = Math.max(textBBox.height + verticalPadding, fontSize + verticalPadding); + return { + tailPoint: { + x: coords.x1, + y: coords.y1 + }, + bodyBounds: { + x: textBBox.x, + y: textBBox.y, + width, + height + } + }; + } + containsPoint(x, y) { + const { start, end, shape } = this; + this.activeHandle = void 0; + if (start.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + const bodyContainsPoint = end.containsPoint(x, y) || shape.containsPoint(x, y); + if (bodyContainsPoint) { + this.activeHandle = "end"; + } + return bodyContainsPoint; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/states/textualStartEndState.ts +import { _ModuleSupport as _ModuleSupport54 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/states/textualStateUtils.ts +function guardCancelAndExit({ key }) { + return key === "Escape"; +} +function guardSaveAndExit({ key, shiftKey }) { + return !shiftKey && key === "Enter"; +} + +// packages/ag-charts-enterprise/src/features/annotations/states/textualStartEndState.ts +var { StateMachine: StateMachine3, StateMachineProperty: StateMachineProperty3, Debug: Debug3 } = _ModuleSupport54; +var TextualStartEndStateMachine = class extends StateMachine3 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point, visible: true }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ start: true }); + }; + const onStartEditing = () => { + ctx.showTextInput(); + if (this.datum) + this.datum.visible = false; + }; + const onStopEditing = () => { + ctx.hideTextInput(); + if (this.datum) + this.datum.visible = true; + ctx.deselect(); + }; + const actionUpdateTextInputBBox = (bbox) => { + this.node?.setTextInputBBox(bbox); + ctx.update(); + }; + const onEndHover = ({ point }) => { + const { datum, node } = this; + datum?.set({ end: point }); + node?.toggleActive(true); + node?.toggleHandles({ end: false }); + ctx.update(); + }; + const onEndClick = () => { + ctx.showAnnotationOptions(); + this.node?.toggleHandles({ end: true }); + }; + const actionColor = ({ + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }) => { + const { datum } = this; + if (!datum) + return; + if (colorPickerType === "text-color") { + ctx.updateTextInputColor(color6); + } + setColor(datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + ctx.update(); + }; + const actionFontSize = (fontSize) => { + const { datum, node } = this; + if (!datum || !node || !isTextType(datum)) + return; + datum.fontSize = fontSize; + ctx.updateTextInputFontSize(fontSize); + ctx.update(); + }; + const actionCancel = () => { + ctx.delete(); + }; + const actionSave = ({ textInputValue, bbox }) => { + const { datum } = this; + if (bbox != null && textInputValue != null && textInputValue.length > 0) { + if (!isTextType(datum)) { + return; + } + const wrappedText = maybeWrapText(datum, textInputValue, bbox.width); + datum?.set({ text: wrappedText }); + ctx.update(); + ctx.recordAction(`Create ${datum?.type} annotation`); + } else { + ctx.delete(); + } + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + dragStart: { + target: "waiting-first-render", + action: actionCreate + }, + cancel: StateMachine3.parent, + reset: StateMachine3.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: onEndHover, + drag: onEndHover, + click: { + target: "edit", + action: onEndClick + }, + dragEnd: { + target: "edit", + action: onEndClick + }, + reset: { + target: StateMachine3.parent, + action: actionCancel + }, + cancel: { + target: StateMachine3.parent, + action: actionCancel + } + }, + edit: { + onEnter: onStartEditing, + updateTextInputBBox: actionUpdateTextInputBBox, + color: actionColor, + fontSize: actionFontSize, + textInput: [ + { + guard: guardCancelAndExit, + target: StateMachine3.parent, + action: actionCancel + }, + { + guard: guardSaveAndExit, + target: StateMachine3.parent, + action: actionSave + } + ], + click: { + target: StateMachine3.parent, + action: actionSave + }, + dragStart: { + target: StateMachine3.parent, + action: actionSave + }, + resize: { + target: StateMachine3.parent, + action: actionSave + }, + onExit: onStopEditing, + cancel: { + target: StateMachine3.parent, + action: actionCancel + } + } + }); + this.debug = Debug3.create(true, "annotations"); + } +}; +__decorateClass([ + StateMachineProperty3() +], TextualStartEndStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty3() +], TextualStartEndStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutState.ts +var CalloutStateMachine = class extends TextualStartEndStateMachine { + createDatum() { + return new CalloutProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/callout/calloutConfig.ts +var calloutConfig = { + type: "callout" /* Callout */, + datum: CalloutProperties, + scene: CalloutScene, + isDatum: CalloutProperties.is, + translate: (node, datum, transition, context) => { + if (CalloutProperties.is(datum) && CalloutScene.is(node)) + return node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (CalloutProperties.is(datum) && CalloutProperties.is(copiedDatum) && CalloutScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (CalloutProperties.is(datum) && CalloutScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CalloutStateMachine({ + ...ctx, + create: createDatum("callout" /* Callout */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentScene.ts +import { _ModuleSupport as _ModuleSupport56 } from "ag-charts-community"; +import { calcLineHeight as calcLineHeight2 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/textualPointScene.ts +import { _ModuleSupport as _ModuleSupport55 } from "ag-charts-community"; +var TextualPointScene = class extends PointScene { + constructor() { + super(...arguments); + this.label = new _ModuleSupport55.Text({ zIndex: 1 }); + this.anchor = { + x: 0, + y: 0, + position: "above-left" + }; + } + setTextInputBBox(bbox) { + this.textInputBBox = bbox; + this.markDirty("TextualPointScene"); + } + update(datum, context) { + const coords = convertPoint(datum, context); + const bbox = this.getTextBBox(datum, coords, context); + this.updateLabel(datum, bbox); + this.updateHandle(datum, coords, bbox); + this.updateShape(datum, bbox); + this.anchor = this.updateAnchor(datum, bbox, context); + } + copy(datum, copiedDatum, context) { + const coords = convertPoint(datum, context); + const bbox = this.getTextBBox(datum, coords, context); + const padding = datum.getPadding(); + const horizontalPadding = padding.left + padding.right; + const verticalPadding = padding.top + padding.bottom; + const xOffset = (bbox.width + horizontalPadding) / 2; + const yOffset = bbox.height + verticalPadding; + const point = invertCoords({ x: coords.x - xOffset, y: coords.y - yOffset }, context); + copiedDatum.x = point.x; + copiedDatum.y = point.y; + return copiedDatum; + } + containsPoint(x, y) { + const { label } = this; + return super.containsPoint(x, y) || label.visible && label.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.label.visible && this.label.containsPoint(x, y)) + return "text"; + return super.getNodeAtCoords(x, y); + } + getTextBBox(datum, coords, _context) { + const { text: text2 } = datum.getText(); + return getBBox(datum, text2, { x: coords.x, y: coords.y }, this.textInputBBox); + } + updateLabel(datum, bbox) { + const { text: text2, isPlaceholder } = datum.getText(); + updateTextNode( + this.label, + text2, + isPlaceholder, + datum, + this.getLabelCoords(datum, bbox), + this.getTextBaseline(datum) + ); + } + updateShape(_datum, _bbox) { + } + updateAnchor(_datum, bbox, context) { + return { + x: bbox.x + context.seriesRect.x, + y: bbox.y + context.seriesRect.y - bbox.height, + position: this.anchor.position + }; + } + getLabelCoords(_datum, bbox) { + return bbox; + } + getTextBaseline(datum) { + return datum.position == "center" ? "middle" : datum.position; + } + getHandleCoords(_datum, _coords, bbox) { + return bbox; + } + getHandleStyles(datum) { + const styles = super.getHandleStyles(datum); + styles.stroke = datum.handle.stroke ?? datum.color; + return styles; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentScene.ts +var { drawCorner: drawCorner2 } = _ModuleSupport56; +var CommentScene = class extends TextualPointScene { + constructor() { + super(); + this.type = "comment" /* Comment */; + this.shape = new _ModuleSupport56.Path(); + this.append([this.shape, this.label, this.handle]); + } + static is(value) { + return AnnotationScene.isCheck(value, "comment" /* Comment */); + } + updateShape(datum, bbox) { + const { shape } = this; + shape.fill = datum.fill; + shape.fillOpacity = datum.fillOpacity ?? 1; + shape.stroke = datum.stroke ?? "transparent"; + shape.strokeWidth = datum.strokeWidth ?? 1; + shape.strokeOpacity = datum.strokeOpacity ?? 1; + this.updatePath(datum, bbox); + } + getLabelCoords(datum, point) { + const padding = datum.getPadding(); + return { + x: point.x + padding.left, + y: point.y - padding.bottom + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke ?? datum.fill, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } + updateAnchor(datum, bbox, context) { + const anchor = super.updateAnchor(datum, bbox, context); + const padding = datum.getPadding(); + anchor.y -= padding.bottom + padding.top; + return anchor; + } + updatePath(datum, bbox) { + const padding = datum.getPadding(); + const { x, y } = bbox; + let { width, height } = bbox; + const { fontSize } = datum; + const horizontalPadding = padding.left + padding.right; + const verticalPadding = padding.top + padding.bottom; + width = width + horizontalPadding; + height = Math.max(height + verticalPadding, fontSize + verticalPadding); + const top = y - height; + const right = x + width; + const cornerRadius = (calcLineHeight2(fontSize, ANNOTATION_TEXT_LINE_HEIGHT) + verticalPadding) / 2; + const { path } = this.shape; + path.clear(); + path.moveTo(x, y); + path.lineTo(x, top + cornerRadius); + drawCorner2( + path, + { + x0: x, + x1: x + cornerRadius, + y0: top + cornerRadius, + y1: top, + cx: x + cornerRadius, + cy: top + cornerRadius + }, + cornerRadius, + false + ); + path.lineTo(right - cornerRadius, top); + drawCorner2( + path, + { + x0: right - cornerRadius, + x1: right, + y0: top, + y1: top + cornerRadius, + cx: right - cornerRadius, + cy: top + cornerRadius + }, + cornerRadius, + false + ); + path.lineTo(right, y - cornerRadius); + drawCorner2( + path, + { + x0: right, + x1: right - cornerRadius, + y0: y - cornerRadius, + y1: y, + cx: right - cornerRadius, + cy: y - cornerRadius + }, + cornerRadius, + false + ); + path.closePath(); + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.shape.containsPoint(x, y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/states/textualPointState.ts +import { _ModuleSupport as _ModuleSupport57 } from "ag-charts-community"; +var { StateMachine: StateMachine4, StateMachineProperty: StateMachineProperty4, Debug: Debug4 } = _ModuleSupport57; +var TextualPointStateMachine = class extends StateMachine4 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ x: point.x, y: point.y }); + ctx.create(datum); + }; + const actionFirstRender = () => { + this.node?.toggleActive(true); + ctx.showAnnotationOptions(); + ctx.update(); + }; + const onStartEditing = () => { + ctx.showTextInput(); + if (this.datum) { + this.datum.visible = false; + } + }; + const onStopEditing = () => { + ctx.hideTextInput(); + if (this.datum) + this.datum.visible = true; + ctx.deselect(); + }; + const actionUpdateTextInputBBox = (bbox) => { + this.node?.setTextInputBBox(bbox); + ctx.update(); + }; + const actionColor = ({ + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }) => { + if (!this.datum) + return; + if (colorPickerType === "text-color") { + ctx.updateTextInputColor(color6); + } + setColor(this.datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + ctx.update(); + }; + const actionFontSize = (fontSize) => { + const { datum, node } = this; + if (!datum || !node || !isTextType(datum)) + return; + datum.fontSize = fontSize; + ctx.updateTextInputFontSize(fontSize); + ctx.update(); + }; + const actionCancel = () => { + ctx.delete(); + }; + const actionSave = ({ textInputValue, bbox }) => { + if (bbox != null && textInputValue != null && textInputValue.length > 0) { + const { datum } = this; + if (!isTextType(datum)) { + return; + } + const wrappedText = maybeWrapText(datum, textInputValue, bbox.width); + datum?.set({ text: wrappedText }); + ctx.update(); + ctx.recordAction(`Create ${datum?.type} annotation`); + } else { + ctx.delete(); + } + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + dragStart: { + target: "waiting-first-render", + action: actionCreate + }, + cancel: StateMachine4.parent, + reset: StateMachine4.parent + }, + "waiting-first-render": { + render: { + target: "edit", + action: actionFirstRender + } + }, + edit: { + onEnter: onStartEditing, + updateTextInputBBox: actionUpdateTextInputBBox, + color: actionColor, + fontSize: actionFontSize, + textInput: [ + { + guard: guardCancelAndExit, + target: StateMachine4.parent, + action: actionCancel + }, + { + guard: guardSaveAndExit, + target: StateMachine4.parent, + action: actionSave + } + ], + click: { + target: StateMachine4.parent, + action: actionSave + }, + dragStart: { + target: StateMachine4.parent, + action: actionSave + }, + resize: { + target: StateMachine4.parent, + action: actionSave + }, + onExit: onStopEditing, + cancel: { + target: StateMachine4.parent, + action: actionCancel + } + } + }); + this.debug = Debug4.create(true, "annotations"); + } +}; +__decorateClass([ + StateMachineProperty4() +], TextualPointStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty4() +], TextualPointStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentState.ts +var CommentStateMachine = class extends TextualPointStateMachine { + createDatum() { + return new CommentProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/comment/commentConfig.ts +var commentConfig = { + type: "comment" /* Comment */, + datum: CommentProperties, + scene: CommentScene, + isDatum: CommentProperties.is, + translate: (node, datum, translation, context) => { + if (CommentProperties.is(datum) && CommentScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (CommentProperties.is(datum) && CommentProperties.is(copiedDatum) && CommentScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (CommentProperties.is(datum) && CommentScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CommentStateMachine({ + ...ctx, + create: createDatum("comment" /* Comment */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/cross-line/crossLineScene.ts +import { _ModuleSupport as _ModuleSupport62 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/axisLabelScene.ts +import { _ModuleSupport as _ModuleSupport58 } from "ag-charts-community"; +var { calculateLabelTranslation } = _ModuleSupport58; +var AxisLabelScene = class extends _ModuleSupport58.Group { + constructor() { + super({ name: "AnnotationAxisLabelGroup" }); + this.label = new _ModuleSupport58.Text({ zIndex: 1 }); + this.rect = new _ModuleSupport58.Rect(); + const { label } = this; + label.fontSize = 12; + label.fontFamily = "Verdana, sans-serif"; + label.fill = "black"; + label.textBaseline = "middle"; + label.textAlign = "center"; + this.append([this.rect, this.label]); + } + update(opts) { + this.updateLabel(opts); + this.updateRect(opts); + this.updatePosition(opts); + } + updateLabel({ value, styles, context }) { + const { fontWeight, fontSize, fontStyle, fontFamily, textAlign, color: color6 = "white", formatter } = styles; + const text2 = formatter ? formatter({ value }) : context.formatScaleValue(value, "annotation-label"); + this.label.setProperties({ + fontWeight, + fontSize, + fontStyle, + fontFamily, + textAlign, + fill: color6, + text: text2 + }); + } + updateRect({ styles }) { + const { rect } = this; + const { cornerRadius, fill, fillOpacity, stroke: stroke2, strokeOpacity } = styles; + rect.fill = fill; + rect.fillOpacity = fillOpacity ?? 1; + rect.stroke = stroke2; + rect.strokeOpacity = strokeOpacity ?? 1; + rect.cornerRadius = cornerRadius ?? 0; + } + updatePosition({ x, y, context, styles: { padding } }) { + const { label, rect } = this; + const labelBBox = label.getBBox()?.clone(); + const horizontalPadding = padding ?? 8; + const verticalPadding = padding ?? 4; + const { xTranslation, yTranslation } = calculateLabelTranslation({ + yDirection: true, + padding: context.labelPadding, + position: context.position ?? "left", + bbox: labelBBox + }); + labelBBox.grow(horizontalPadding, "horizontal"); + labelBBox.grow(verticalPadding, "vertical"); + const translationX = x + xTranslation; + const translationY = y + yTranslation; + label.x = translationX; + label.y = translationY; + rect.y = translationY - Math.round(labelBBox.height / 2); + rect.x = translationX - Math.round(labelBBox.width / 2); + rect.height = labelBBox.height; + rect.width = labelBBox.width; + } +}; +AxisLabelScene.className = "AxisLabel"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/collidableLineScene.ts +import { _ModuleSupport as _ModuleSupport59 } from "ag-charts-community"; +var { Vec2: Vec27 } = _ModuleSupport59; +var CollidableLine = class extends _ModuleSupport59.Line { + constructor() { + super(...arguments); + this.growCollisionBox = 9; + this.clipMask = /* @__PURE__ */ new Map(); + } + setProperties(styles) { + super.setProperties(styles); + this.updateCollisionBBox(); + return this; + } + updateCollisionBBox() { + const { growCollisionBox, strokeWidth, x1, y1, x2, y2 } = this; + let height = strokeWidth + growCollisionBox; + if (height % 2 === 0) + height += 1; + const topLeft = Vec27.from(x1, y1 - Math.floor(height / 2)); + const bottomRight = Vec27.from(x2, y2); + const width = Vec27.distance(topLeft, bottomRight); + this.collisionBBox = new _ModuleSupport59.BBox(topLeft.x, topLeft.y, width, height); + } + isPointInPath(pointX, pointY) { + const { collisionBBox, x1, y1, x2, y2 } = this; + if (!collisionBBox) + return false; + const v1 = Vec27.from(x1, y1); + const v2 = Vec27.from(x2, y2); + const point = Vec27.sub(Vec27.from(pointX, pointY), v1); + const end = Vec27.sub(v2, v1); + const rotated = Vec27.rotate(point, Vec27.angle(point, end), v1); + return collisionBBox.containsPoint(rotated.x, rotated.y) ?? false; + } + render(renderCtx) { + const { clipMask } = this; + const { ctx } = renderCtx; + if (clipMask.size === 0) { + super.render(renderCtx); + return; + } + ctx.save(); + try { + for (const mask of this.clipMask.values()) { + const { x, y, radius } = mask; + ctx.beginPath(); + ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height); + ctx.ellipse(x, y, radius, radius, 0, Math.PI * 2, 0, true); + ctx.clip(); + } + super.render(renderCtx); + } finally { + ctx.restore(); + } + } + setClipMask(id, mask) { + const cm = this.clipMask.get(id); + if (_ModuleSupport59.jsonDiff(cm, mask) != null) { + this.markDirty("CollidableLine"); + } + if (mask) { + this.clipMask.set(id, mask); + } else { + this.clipMask.delete(id); + } + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/collidableTextScene.ts +import { _ModuleSupport as _ModuleSupport60 } from "ag-charts-community"; +var CollidableText = class extends _ModuleSupport60.TransformableText { + constructor() { + super(...arguments); + this.growCollisionBox = { + top: 4, + right: 4, + bottom: 4, + left: 4 + }; + } + isPointInPath(pointX, pointY) { + const localPoint = this.fromParentPoint(pointX, pointY); + const uBBox = this.computeBBoxWithoutTransforms(); + if (!uBBox) + return false; + return uBBox.grow(this.growCollisionBox).containsPoint(localPoint.x, localPoint.y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/utils/lineWithText.ts +import { _ModuleSupport as _ModuleSupport61 } from "ag-charts-community"; +var { Vec2: Vec28 } = _ModuleSupport61; +function updateLineText(id, line, coords, textProperties, textNode, text2, lineWidth) { + if (!text2 || !textNode || !textProperties) { + line.setClipMask(id); + return; + } + const { alignment, position } = textProperties; + const numbers = getNumbers(coords, textProperties.fontSize, lineWidth); + const { point, textBaseline } = positionAndAlignment(numbers, position, alignment); + setProperties(textNode, text2, textProperties, point, numbers.angle, textBaseline); + const { x, y, width, height } = textNode.getBBox(); + const diameter = Vec28.length(Vec28.from(width, height)); + const clipMask = { + x: x + width / 2, + y: y + height / 2, + radius: diameter / 2 + Vec28.length(numbers.offset) + }; + if (position === "center") { + line.setClipMask(id, clipMask); + } else { + line.setClipMask(id); + } + return { clipMask, numbers }; +} +function updateChannelText(offsetInsideTextLabel, top, bottom, textProperties, lineWidth, textNode, text2) { + if (!text2 || !textNode) + return; + const { alignment, position } = textProperties; + const [actualTop, actualBottom] = top.y1 <= bottom.y1 ? [top, bottom] : [bottom, top]; + let relativeLine = actualTop; + if (position === "bottom") { + relativeLine = actualBottom; + } else if (position === "inside") { + relativeLine = { + x1: (actualTop.x1 + actualBottom.x1) / 2, + y1: (actualTop.y1 + actualBottom.y1) / 2, + x2: (actualTop.x2 + actualBottom.x2) / 2, + y2: (actualTop.y2 + actualBottom.y2) / 2 + }; + } + const numbers = getNumbers(relativeLine, textProperties.fontSize, lineWidth); + const { point, textBaseline } = positionAndAlignment( + numbers, + position === "inside" ? "center" : position, + alignment, + offsetInsideTextLabel + ); + setProperties(textNode, text2, textProperties, point, numbers.angle, textBaseline); +} +function getNumbers(coords, fontSize, strokeWidth) { + let [left, right] = Vec28.from(coords); + if (left.x > right.x) + [left, right] = [right, left]; + const normal = Vec28.normalized(Vec28.sub(right, left)); + const angle = Vec28.angle(normal); + const inset = Vec28.multiply(normal, DivariantHandle.HANDLE_SIZE / 2 + (fontSize ?? 14) / 2); + const offset = Vec28.multiply(normal, (strokeWidth ?? 2) / 2 + (fontSize ?? 14) / 3); + return { left, right, normal, angle, inset, offset }; +} +function positionAndAlignment({ left, right, normal, angle, inset, offset }, position, alignment, offsetInsideTextLabel) { + let point; + if (alignment === "right") { + point = Vec28.sub(right, inset); + } else if (alignment === "center") { + point = Vec28.add(left, Vec28.multiply(normal, Vec28.distance(left, right) / 2)); + } else { + point = Vec28.add(left, inset); + } + let textBaseline = "bottom"; + if (position === "bottom") { + point = Vec28.rotate(offset, angle + Math.PI / 2, point); + textBaseline = "top"; + } else if (position === "center" && !offsetInsideTextLabel) { + textBaseline = "middle"; + } else { + point = Vec28.rotate(offset, angle - Math.PI / 2, point); + } + return { point, textBaseline }; +} +function setProperties(scene, text2, textProperties, point, angle, textBaseline) { + scene.setProperties({ + text: text2, + x: point.x, + y: point.y, + rotation: angle, + rotationCenterX: point.x, + rotationCenterY: point.y, + fill: textProperties.color, + fontFamily: textProperties.fontFamily, + fontSize: textProperties.fontSize, + fontStyle: textProperties.fontStyle, + fontWeight: textProperties.fontWeight, + textAlign: textProperties.alignment, + textBaseline + }); +} + +// packages/ag-charts-enterprise/src/features/annotations/cross-line/crossLineScene.ts +var { ChartAxisDirection: ChartAxisDirection6, Vec2: Vec29, Vec4: Vec44 } = _ModuleSupport62; +var CrossLineScene = class extends AnnotationScene { + constructor() { + super(); + this.type = "cross-line"; + this.line = new CollidableLine(); + this.middle = new UnivariantHandle(); + this.isHorizontal = false; + this.append([this.line, this.middle]); + } + static is(value) { + return AnnotationScene.isCheck(value, "cross-line"); + } + update(datum, context) { + const { seriesRect } = context; + this.seriesRect = seriesRect; + this.isHorizontal = HorizontalLineProperties.is(datum); + const axisContext = this.isHorizontal ? context.yAxis : context.xAxis; + const coords = this.convertCrossLine(datum, axisContext); + if (coords == null) { + this.visible = false; + return; + } + this.visible = datum.visible ?? true; + if (!this.visible) + return; + this.updateLine(datum, coords); + this.updateHandle(datum, coords); + this.updateText(datum, coords); + this.updateAxisLabel(datum, axisContext, coords); + } + updateLine(datum, coords) { + const { line } = this; + const { lineDashOffset, stroke: stroke2, strokeWidth, strokeOpacity } = datum; + const { x1, y1, x2, y2 } = coords; + line.setProperties({ + x1, + y1, + x2, + y2, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke2, + strokeWidth, + strokeOpacity, + fillOpacity: 0 + }); + } + updateHandle(datum, coords) { + const { middle } = this; + const { locked, stroke: stroke2, strokeWidth, strokeOpacity } = datum; + const handleStyles = { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? stroke2, + strokeOpacity: datum.handle.strokeOpacity ?? strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? strokeWidth + }; + const handlePosition = Vec29.sub( + Vec44.center(coords), + Vec29.from(middle.handle.width / 2, middle.handle.height / 2) + ); + middle.gradient = this.isHorizontal ? "horizontal" : "vertical"; + middle.update({ ...handleStyles, ...handlePosition }); + middle.toggleLocked(locked ?? false); + } + updateText(datum, coords) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateLineText(this.line.id, this.line, coords, datum.text, this.text, datum.text.label, datum.strokeWidth); + } + createAxisLabel(context) { + const axisLabel2 = new AxisLabelScene(); + context.attachLabel(axisLabel2); + return axisLabel2; + } + updateAxisLabel(datum, axisContext, coords) { + this.axisLabel ?? (this.axisLabel = this.createAxisLabel(axisContext)); + const { axisLabel: axisLabel2, seriesRect } = this; + const { direction, position } = axisContext; + if (datum.axisLabel.enabled) { + axisLabel2.visible = this.visible; + const labelCorner = position === "left" || position === "top" ? Vec44.start(coords) : Vec44.end(coords); + const labelPosition = direction === ChartAxisDirection6.X ? labelCorner.x : labelCorner.y; + if (!axisContext.inRange(labelPosition)) { + axisLabel2.visible = false; + return; + } + const value = getGroupingValue(datum.value); + axisLabel2.update({ + ...Vec29.add(labelCorner, Vec29.required(seriesRect)), + value, + styles: datum.axisLabel, + context: axisContext + }); + } else { + axisLabel2.visible = false; + } + } + setAxisLabelOpacity(opacity) { + if (!this.axisLabel) + return; + this.axisLabel.opacity = opacity; + } + setAxisLabelVisible(visible) { + if (!this.axisLabel) + return; + this.axisLabel.visible = visible; + } + toggleHandles(show) { + this.middle.visible = show; + this.middle.toggleHovered(this.activeHandle === "middle"); + } + destroy() { + super.destroy(); + this.axisLabel?.destroy(); + } + toggleActive(active) { + this.toggleHandles(active); + this.middle.toggleActive(active); + } + dragStart(datum, target, context) { + const middle = HorizontalLineProperties.is(datum) ? { x: target.x, y: convert(datum.value, context.yAxis) } : { x: convert(datum.value, context.xAxis), y: target.y }; + this.dragState = { + offset: target, + middle + }; + } + drag(datum, target, context) { + const { activeHandle, dragState } = this; + if (!datum.isWriteable() || !dragState) + return; + if (activeHandle) { + this[activeHandle].toggleDragging(true); + } + this.translatePoint(datum, dragState.middle, Vec29.sub(target, dragState.offset), context); + } + translate(datum, translation, context) { + if (!datum.isWriteable()) + return; + const vector = HorizontalLineProperties.is(datum) ? Vec29.from(0, convert(datum.value, context.yAxis)) : Vec29.from(convert(datum.value, context.xAxis), 0); + this.translatePoint(datum, vector, translation, context); + } + translatePoint(datum, value, translation, context) { + const isHorizontal2 = HorizontalLineProperties.is(datum); + if (isHorizontal2) { + translation.x = 0; + } else { + translation.y = 0; + } + const { point } = translate({ point: value }, translation, context); + datum.value = isHorizontal2 ? point.y : point.x; + } + stopDragging() { + this.middle.toggleDragging(false); + } + copy(datum, copiedDatum, context) { + const isHorizontal2 = HorizontalLineProperties.is(datum); + const axisContext = this.isHorizontal ? context.yAxis : context.xAxis; + const coords = this.convertCrossLine(datum, axisContext); + if (!coords) { + return; + } + const yOffset = isHorizontal2 ? -30 : 0; + const xOffset = isHorizontal2 ? 0 : -30; + const point = invertCoords({ x: coords.x1 + xOffset, y: coords.y1 + yOffset }, context); + copiedDatum.set({ value: isHorizontal2 ? point.y : point.x }); + return copiedDatum; + } + getCursor() { + if (this.activeHandle == null) + return "pointer"; + return this[this.activeHandle].getCursor(); + } + containsPoint(x, y) { + const { middle, line, text: text2 } = this; + this.activeHandle = void 0; + if (middle.containsPoint(x, y)) { + this.activeHandle = "middle"; + return true; + } + return line.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.line.isPointInPath(x, y)) + return "line"; + if (this.middle.containsPoint(x, y)) + return "handle"; + } + getAnchor() { + const bbox = this.computeBBoxWithoutHandles(); + if (this.isHorizontal) { + return { x: bbox.x + bbox.width / 2, y: bbox.y }; + } + return { x: bbox.x + bbox.width, y: bbox.y + bbox.height / 2, position: "right" }; + } + convertCrossLine(datum, context) { + if (datum.value == null) + return; + let x1 = 0; + let y1 = 0; + let x2, y2; + const { bounds } = context; + const scaledValue = convert(datum.value, context); + if (HorizontalLineProperties.is(datum)) { + x2 = bounds.width; + y1 = scaledValue; + y2 = scaledValue; + } else { + x1 = scaledValue; + x2 = scaledValue; + y2 = bounds.height; + } + return { x1, y1, x2, y2 }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/cross-line/crossLineState.ts +import { _ModuleSupport as _ModuleSupport63 } from "ag-charts-community"; +var { StateMachine: StateMachine5, StateMachineProperty: StateMachineProperty5, Debug: Debug5 } = _ModuleSupport63; +var CrossLineStateMachine = class extends StateMachine5 { + constructor(direction, ctx) { + const onClick = ({ point }) => { + const isHorizontal2 = direction === "horizontal"; + const datum = isHorizontal2 ? new HorizontalLineProperties() : new VerticalLineProperties(); + datum.set({ value: isHorizontal2 ? point.y : point.x }); + ctx.create(datum); + ctx.recordAction( + `Create ${isHorizontal2 ? "horizontal-line" /* HorizontalLine */ : "vertical-line" /* VerticalLine */} annotation` + ); + }; + const actionFirstRender = () => { + this.node?.toggleActive(true); + ctx.showAnnotationOptions(); + ctx.update(); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: onClick + }, + drag: { + target: "waiting-first-render", + action: onClick + }, + reset: StateMachine5.parent, + cancel: StateMachine5.parent + }, + "waiting-first-render": { + render: { + target: StateMachine5.parent, + action: actionFirstRender + } + } + }); + this.debug = Debug5.create(true, "annotations"); + } +}; +__decorateClass([ + StateMachineProperty5() +], CrossLineStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/cross-line/crossLineConfig.ts +var horizontalLineConfig = { + type: "horizontal-line" /* HorizontalLine */, + datum: HorizontalLineProperties, + scene: CrossLineScene, + isDatum: HorizontalLineProperties.is, + translate: (node, datum, translation, context) => { + if (HorizontalLineProperties.is(datum) && CrossLineScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (HorizontalLineProperties.is(datum) && HorizontalLineProperties.is(copiedDatum) && CrossLineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (HorizontalLineProperties.is(datum) && CrossLineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CrossLineStateMachine("horizontal", { + ...ctx, + create: createDatum("horizontal-line" /* HorizontalLine */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var verticalLineConfig = { + type: "vertical-line" /* VerticalLine */, + datum: VerticalLineProperties, + scene: CrossLineScene, + isDatum: VerticalLineProperties.is, + translate: (node, datum, translation, context) => { + if (VerticalLineProperties.is(datum) && CrossLineScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (VerticalLineProperties.is(datum) && VerticalLineProperties.is(copiedDatum) && CrossLineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (VerticalLineProperties.is(datum) && CrossLineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CrossLineStateMachine("vertical", { + ...ctx, + create: createDatum("vertical-line" /* VerticalLine */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/disjoint-channel/disjointChannelScene.ts +import { _ModuleSupport as _ModuleSupport66 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/channelScene.ts +import { _ModuleSupport as _ModuleSupport65 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/withBackgroundScene.ts +import { _ModuleSupport as _ModuleSupport64 } from "ag-charts-community"; +var { Vec4: Vec45 } = _ModuleSupport64; +var WithBackgroundScene = class { + static updateBackground(datum, top, bottom, context) { + const { background } = this; + const { seriesRect } = context; + background.path.clear(true); + const bounds = Vec45.from(0, 0, seriesRect.width, seriesRect.height); + const points = this.getBackgroundPoints(datum, top, bottom, bounds); + for (let i = 0; i < points.length; i++) { + const point = points[i]; + if (i === 0) { + background.path.moveTo(point.x, point.y); + } else { + background.path.lineTo(point.x, point.y); + } + } + background.path.closePath(); + background.checkPathDirty(); + const backgroundStyles = this.getBackgroundStyles?.(datum) ?? datum.background; + background.fill = backgroundStyles.fill; + background.fillOpacity = backgroundStyles.fillOpacity ?? 1; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/channelScene.ts +var ChannelScene = class extends LinearScene { + constructor() { + super(...arguments); + this.handles = {}; + this.overflowContinuous = 2; + this.topLine = new CollidableLine(); + this.bottomLine = new CollidableLine(); + this.background = new _ModuleSupport65.Path({ zIndex: -1 }); + this.anchor = { x: 0, y: 0 }; + this.updateBackground = WithBackgroundScene.updateBackground.bind(this); + } + update(datum, context) { + const { locked, visible } = datum; + const top = convertLine(datum, context); + const bottom = convertLine(datum.bottom, context); + if (top == null || bottom == null) { + this.visible = false; + return; + } else { + this.visible = visible ?? true; + } + const topLine = this.extendLine(top, datum, context); + const bottomLine = this.extendLine(bottom, datum, context); + this.updateLines(datum, topLine, bottomLine, context, top, bottom); + this.updateHandles(datum, top, bottom); + this.updateText(datum, top, bottom); + this.updateBackground(datum, topLine, bottomLine, context); + this.updateAnchor(top, bottom); + for (const handle2 of Object.values(this.handles)) { + handle2.toggleLocked(locked ?? false); + } + } + toggleHandles(show) { + const { handles } = this; + if (typeof show === "boolean") { + for (const [handle2, node] of Object.entries(handles)) { + node.visible = show; + node.toggleHovered(this.activeHandle === handle2); + } + return; + } + for (const [handle2, visible] of Object.entries(show)) { + const node = handles[handle2]; + node.visible = visible ?? true; + node.toggleHovered(this.activeHandle === handle2); + } + } + toggleActive(active) { + this.toggleHandles(active); + for (const node of Object.values(this.handles)) { + node.toggleActive(active); + } + } + stopDragging() { + const { activeHandle, handles } = this; + if (activeHandle == null) + return; + handles[activeHandle].toggleDragging(false); + } + getAnchor() { + return this.anchor; + } + getCursor() { + if (this.activeHandle == null) + return "pointer"; + return this.handles[this.activeHandle].getCursor(); + } + containsPoint(x, y) { + const { handles, topLine, bottomLine, text: text2 } = this; + this.activeHandle = void 0; + for (const [handle2, child] of Object.entries(handles)) { + if (child.containsPoint(x, y)) { + this.activeHandle = handle2; + return true; + } + } + return topLine.containsPoint(x, y) || bottomLine.containsPoint(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.topLine.containsPoint(x, y) || this.bottomLine.containsPoint(x, y)) + return "line"; + for (const [, child] of Object.entries(this.handles)) { + if (child.containsPoint(x, y)) + return "handle"; + } + } + updateAnchor(top, bottom) { + const { x, y } = _ModuleSupport65.Transformable.toCanvasPoint( + this.topLine, + (top.x1 + top.x2) / 2, + Math.min(top.y1, top.y2, bottom.y1, bottom.y2) + ); + this.anchor.x = x; + this.anchor.y = y; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/disjoint-channel/disjointChannelScene.ts +var { Vec2: Vec210, Vec4: Vec46 } = _ModuleSupport66; +var DisjointChannelScene = class extends ChannelScene { + constructor() { + super(); + this.type = "disjoint-channel"; + this.handles = { + topLeft: new DivariantHandle(), + topRight: new DivariantHandle(), + bottomLeft: new DivariantHandle(), + bottomRight: new UnivariantHandle() + }; + this.append([this.background, this.topLine, this.bottomLine, ...Object.values(this.handles)]); + } + static is(value) { + return AnnotationScene.isCheck(value, "disjoint-channel"); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, handles } = this; + if (activeHandle == null) + return; + const { offset } = handles[activeHandle].drag(target); + handles[activeHandle].toggleDragging(true); + if (activeHandle === "bottomRight") { + offset.x = 0; + } + let translateVectors = []; + let invertYVectors = []; + let allowSnapping = snapping; + switch (activeHandle) { + case "topLeft": + translateVectors = ["topLeft"]; + invertYVectors = ["bottomLeft"]; + break; + case "bottomLeft": + translateVectors = ["bottomLeft"]; + invertYVectors = ["topLeft"]; + break; + case "topRight": + translateVectors = ["topRight"]; + invertYVectors = ["bottomRight"]; + break; + case "bottomRight": + translateVectors = ["bottomLeft", "bottomRight"]; + allowSnapping = false; + break; + } + const top = convertLine(datum, context); + const bottom = convertLine(datum.bottom, context); + if (!top || !bottom) + return; + const vectors = { + topLeft: Vec46.start(top), + topRight: Vec46.end(top), + bottomLeft: Vec46.start(bottom), + bottomRight: Vec46.end(bottom) + }; + const snap = { + vectors: { + topLeft: vectors.topRight, + bottomLeft: vectors.bottomRight, + topRight: vectors.topLeft, + bottomRight: vectors.bottomLeft + }, + angle: datum.snapToAngle + }; + const points = translate(vectors, offset, context, { + overflowContinuous: this.overflowContinuous, + translateVectors, + invertYVectors, + snap: allowSnapping ? snap : void 0 + }); + datum.start.x = points.topLeft.x; + datum.start.y = points.topLeft.y; + datum.end.x = points.topRight.x; + datum.end.y = points.topRight.y; + datum.startHeight = points.topLeft.y - points.bottomLeft.y; + datum.endHeight = points.topRight.y - points.bottomRight.y; + } + getTranslatePointsVectors(start, end) { + const { bottomLeft, bottomRight, topLeft, topRight } = this.handles; + const startHeight = bottomLeft.getBBox().y - topLeft.getBBox().y; + const endHeight = bottomRight.getBBox().y - topRight.getBBox().y; + const bottomStart = Vec210.add(start, Vec210.from(0, startHeight)); + const bottomEnd = Vec210.add(end, Vec210.from(0, endHeight)); + return { start, end, bottomStart, bottomEnd }; + } + updateLines(datum, top, bottom) { + const { topLine, bottomLine } = this; + const { lineDashOffset, stroke: stroke2, strokeOpacity, strokeWidth } = datum; + const lineStyles = { + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth + }; + topLine.setProperties({ ...top, ...lineStyles }); + bottomLine.setProperties({ ...bottom, ...lineStyles }); + } + updateHandles(datum, top, bottom) { + const { + handles: { topLeft, topRight, bottomLeft, bottomRight } + } = this; + const handleStyles = { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + topLeft.update({ ...handleStyles, ...Vec46.start(top) }); + topRight.update({ ...handleStyles, ...Vec46.end(top) }); + bottomLeft.update({ ...handleStyles, ...Vec46.start(bottom) }); + bottomRight.update({ + ...handleStyles, + ...Vec210.sub(Vec46.end(bottom), Vec210.from(bottomRight.handle.width / 2, bottomRight.handle.height / 2)) + }); + } + updateText(datum, top, bottom) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateChannelText(false, top, bottom, datum.text, datum.strokeWidth, this.text, datum.text.label); + } + getBackgroundPoints(datum, top, bottom, bounds) { + const isFlippedX = top.x1 > top.x2; + const isFlippedY = top.y1 > top.y2; + const topY = isFlippedY ? bounds.y2 : bounds.y1; + const bottomY = isFlippedY ? bounds.y1 : bounds.y2; + const points = Vec210.from(top); + if (datum.extendEnd && top.y2 === bottomY) { + points.push(Vec210.from(isFlippedX ? bounds.x1 : bounds.x2, isFlippedY ? bounds.y1 : bounds.y2)); + } + if (datum.extendEnd && bottom.y2 === topY) { + points.push(Vec210.from(isFlippedX ? bounds.x1 : bounds.x2, isFlippedY ? bounds.y2 : bounds.y1)); + } + points.push(...Vec210.from(bottom).reverse()); + if (datum.extendStart && bottom.y1 === bottomY) { + points.push(Vec210.from(isFlippedX ? bounds.x2 : bounds.x1, isFlippedY ? bounds.y1 : bounds.y2)); + } + if (datum.extendStart && top.y1 === topY) { + points.push(Vec210.from(isFlippedX ? bounds.x2 : bounds.x1, isFlippedY ? bounds.y2 : bounds.y1)); + } + return points; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/disjoint-channel/disjointChannelState.ts +import { _ModuleSupport as _ModuleSupport67 } from "ag-charts-community"; +import { isNumber as isNumber2 } from "ag-charts-core"; +var { StateMachine: StateMachine6, StateMachineProperty: StateMachineProperty6, Debug: Debug6 } = _ModuleSupport67; +var DisjointChannelStateMachine = class extends StateMachine6 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = new DisjointChannelProperties(); + datum.set({ start: point, end: point, startHeight: 0, endHeight: 0 }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ topLeft: true, topRight: false, bottomLeft: false, bottomRight: false }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ topRight: true }); + ctx.update(); + }; + const actionHeightUpdate = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !isNumber2(startY) || !isNumber2(endY) || !isNumber2(pointY)) + return; + const endHeight = endY - (pointY ?? 0); + const startHeight = (startY - endY) * 2 + endHeight; + const bottomStart = { x: datum?.start.x, y: startY - startHeight }; + const bottomEnd = { x: datum?.end.x, y: point.y }; + node?.toggleHandles({ bottomLeft: true, bottomRight: true }); + if (!ctx.validatePoint(bottomStart, { overflowContinuous: true }) || !ctx.validatePoint(bottomEnd, { overflowContinuous: true })) { + return; + } + datum.set({ startHeight, endHeight }); + ctx.update(); + }; + const actionHeightFinish = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !isNumber2(startY) || !isNumber2(endY) || !isNumber2(pointY)) + return; + const endHeight = endY - (pointY ?? 0); + const startHeight = (startY - endY) * 2 + endHeight; + const bottomStart = { x: datum.start.x, y: startY - endHeight }; + const bottomEnd = { x: datum.end.x, y: point.y }; + node?.toggleHandles(true); + if (!ctx.validatePoint(bottomStart, { overflowContinuous: true }) || !ctx.validatePoint(bottomEnd, { overflowContinuous: true })) { + return; + } + datum.set({ startHeight, endHeight }); + ctx.recordAction(`Create ${"disjoint-channel" /* DisjointChannel */} annotation`); + ctx.showAnnotationOptions(); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine6.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + drag: actionEndUpdate, + click: { + target: "height", + action: actionEndFinish + }, + dragEnd: { + target: "height", + action: actionEndFinish + }, + reset: { + target: StateMachine6.parent, + action: actionCancel + }, + cancel: { + target: StateMachine6.parent, + action: actionCancel + } + }, + height: { + hover: actionHeightUpdate, + click: { + target: StateMachine6.parent, + action: actionHeightFinish + }, + drag: { + target: StateMachine6.parent, + action: actionHeightFinish + }, + reset: { + target: StateMachine6.parent, + action: actionCancel + }, + cancel: { + target: StateMachine6.parent, + action: actionCancel + } + } + }); + this.debug = Debug6.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass([ + StateMachineProperty6() +], DisjointChannelStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty6() +], DisjointChannelStateMachine.prototype, "node", 2); +__decorateClass([ + StateMachineProperty6() +], DisjointChannelStateMachine.prototype, "snapping", 2); + +// packages/ag-charts-enterprise/src/features/annotations/disjoint-channel/disjointChannelConfig.ts +var disjointChannelConfig = { + type: "disjoint-channel" /* DisjointChannel */, + datum: DisjointChannelProperties, + scene: DisjointChannelScene, + isDatum: DisjointChannelProperties.is, + translate: (node, datum, transition, context) => { + if (DisjointChannelProperties.is(datum) && DisjointChannelScene.is(node)) { + node.translate(datum, transition, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (DisjointChannelProperties.is(datum) && DisjointChannelProperties.is(copiedDatum) && DisjointChannelScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (DisjointChannelProperties.is(datum) && DisjointChannelScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new DisjointChannelStateMachine({ + ...ctx, + create: createDatum("disjoint-channel" /* DisjointChannel */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedScene.ts +import { _ModuleSupport as _ModuleSupport70 } from "ag-charts-community"; +import { entries as entries3 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/fibonacciScene.ts +import { _ModuleSupport as _ModuleSupport68 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/utils/fibonacci.ts +var FIBONACCI_RETRACEMENT_RATIOS = [0, 23.6, 38.2, 50, 61.8, 78.6, 100]; +var FIBONACCI_EXTENSION_RATIOS = [161.8, 261.8, 361.8, 423.6]; +var FIBONACCI_RATIOS = [...FIBONACCI_RETRACEMENT_RATIOS, ...FIBONACCI_EXTENSION_RATIOS]; +var FIBONACCI_RATIOS_MAP = { + 10: FIBONACCI_RATIOS, + 6: FIBONACCI_RETRACEMENT_RATIOS, + 4: FIBONACCI_RETRACEMENT_RATIOS.filter((r) => r !== 78.6 && r !== 23.6) +}; +var FIBONACCI_RANGE_LABEL_PADDING = 10; +function getFibonacciCoords(coords1, coords2) { + const { x2, y1, y2 } = coords1; + const trendLineVerticalDistance = y1 - y2; + if (coords2 == null) { + return { + x1: x2, + x2, + y1: y2 - trendLineVerticalDistance, + y2 + }; + } + return { + x1: coords2.x1, + x2: coords2.x2, + y1: coords2.y2 - trendLineVerticalDistance, + y2: coords2.y2 + }; +} +function createFibonacciRangesData({ x1, y1, x2, y2 }, context, reverse, yZero, bands = 10) { + const verticalDistance = y1 - y2; + const direction = reverse ? -1 : 1; + let startY = yZero; + const data = []; + for (const [index, ratio3] of FIBONACCI_RATIOS_MAP[bands].entries()) { + const endY = yZero + verticalDistance * (ratio3 / 100) * direction; + const yDatumVal = context.yAxis.scaleInvert(endY); + data.push({ + id: index, + x1, + x2, + y1: startY, + y2: endY, + tag: ratio3 == 100 ? 0 /* OneLine */ : 1 /* HorizontalLine */, + label: { + x1: Math.min(x1, x2) - FIBONACCI_RANGE_LABEL_PADDING, + x2, + y1: endY, + y2: endY, + text: `${(ratio3 / 100).toFixed(3)} (${yDatumVal.toFixed(2)})` + } + }); + startY = endY; + } + return data; +} + +// packages/ag-charts-enterprise/src/features/annotations/scenes/fibonacciScene.ts +var { Vec2: Vec211, Vec4: Vec47 } = _ModuleSupport68; +var FibonacciScene = class extends AnnotationScene { + constructor() { + super(); + this.trendLine = new CollidableLine(); + this.rangeFillsGroup = new _ModuleSupport68.Group({ + name: `${this.id}-range-fills` + }); + this.rangeFillsGroupSelection = _ModuleSupport68.Selection.select(this.rangeFillsGroup, _ModuleSupport68.Range); + this.rangeStrokesGroup = new _ModuleSupport68.Group({ + name: `${this.id}-range-strokes` + }); + this.rangeStrokesGroupSelection = _ModuleSupport68.Selection.select(this.rangeStrokesGroup, CollidableLine); + this.labelsGroup = new _ModuleSupport68.Group({ + name: `${this.id}-ranges-labels` + }); + this.labelsGroupSelection = _ModuleSupport68.Selection.select(this.labelsGroup, CollidableText); + this.anchor = { + x: 0, + y: 0, + position: "above" + }; + this.append([this.trendLine, this.rangeFillsGroup, this.rangeStrokesGroup, this.labelsGroup]); + } + update(datum, context) { + let coords = convertLine(datum, context); + if (coords == null) { + this.visible = false; + return; + } + coords = Vec47.round(coords); + this.visible = datum.visible ?? true; + if (!this.visible) + return; + this.updateLine(datum, coords, this.trendLine); + this.updateHandles(datum, coords); + this.updateAnchor(datum, coords, context); + const { reverse } = datum; + const extendedCoords = this.extendLine(coords, datum, context); + const yZero = reverse ? extendedCoords.y1 : extendedCoords.y2; + const yOne = reverse ? extendedCoords.y2 : extendedCoords.y1; + const data = createFibonacciRangesData(extendedCoords, context, datum.reverse, yZero, datum.bands); + this.updateRanges(datum, data, context); + const oneLinePoints = { ...extendedCoords, y1: yOne, y2: yOne }; + this.updateText(datum, oneLinePoints); + } + extendLine({ x1, y1, x2, y2 }, datum, context) { + const linePoints = { x1, y1, x2, y2 }; + if (!datum.extendStart && !datum.extendEnd) { + return linePoints; + } + const { x, width } = context.xAxis.bounds; + if (datum.extendEnd) { + linePoints[x1 > x2 ? "x1" : "x2"] = x + width; + } + if (datum.extendStart) { + linePoints[x1 > x2 ? "x2" : "x1"] = x; + } + return linePoints; + } + updateLine(datum, coords, line) { + if (!coords || !line) { + return; + } + const { lineDashOffset, strokeWidth, strokeOpacity, stroke: stroke2 } = datum; + line.setProperties({ + ...coords, + lineCap: datum.getLineCap(), + lineDash: [3, 4], + lineDashOffset, + strokeWidth, + strokeOpacity, + fillOpacity: 0, + stroke: stroke2 + }); + } + updateRangeStrokes(datum) { + const { lineDashOffset, strokeWidth, strokeOpacity, strokes, rangeStroke, isMultiColor } = datum; + this.rangeStrokesGroupSelection.each((line, { x1, x2, y2, tag }, index) => { + const y = y2; + const color6 = isMultiColor ? strokes[index % strokes.length] : rangeStroke; + line.setProperties({ + x1, + x2, + y1: y, + y2: y, + stroke: color6, + strokeOpacity, + strokeWidth, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + tag + }); + }); + } + updateRanges(datum, data, context) { + const getDatumId = (d) => d.id; + this.rangeFillsGroupSelection.update(data, void 0, getDatumId); + this.rangeStrokesGroupSelection.update(data, void 0, getDatumId); + this.labelsGroupSelection.update(data, void 0, getDatumId); + this.updateRangeFills(datum); + this.updateRangeStrokes(datum); + this.updateRangeLabels(datum, context); + } + updateRangeFills(datum) { + const { + lineDashOffset, + strokeWidth, + strokeOpacity, + strokes: colors, + rangeStroke, + showFill, + isMultiColor + } = datum; + this.rangeFillsGroupSelection.each((range2, { x1, x2, y1, y2 }, index) => { + const color6 = isMultiColor ? colors[index % colors.length] : rangeStroke; + if (!showFill) { + range2.visible = false; + return; + } + range2.setProperties({ + x1, + x2, + y1, + y2, + startLine: false, + endLine: false, + stroke: color6, + strokeOpacity, + fill: color6, + fillOpacity: (strokeOpacity ?? 1) * 0.15, + strokeWidth, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + visible: true + }); + }); + } + updateRangeLabels(trendLineProperties, { xAxis }) { + const { rangeStrokesGroupSelection } = this; + const { + strokes: colors, + strokeWidth, + rangeStroke, + isMultiColor, + label: { fontFamily, fontSize, fontStyle, fontWeight, color: color6 } + } = trendLineProperties; + const labelProperties = { + fontFamily, + fontSize, + fontStyle, + fontWeight + }; + const withinBounds = this.checkWithinBounds(xAxis, labelProperties, this.labelsGroupSelection.at(0)); + this.labelsGroupSelection.each((textNode, datum, index) => { + const textColor = color6 ?? (isMultiColor ? colors[index % colors.length] : rangeStroke); + const line = rangeStrokesGroupSelection.at(index); + if (!line) { + return; + } + const { text: text2, ...coords } = datum.label; + if (withinBounds) { + textNode.setProperties({ + ...labelProperties, + text: text2, + x: coords.x1, + y: coords.y1, + textBaseline: "middle", + textAlign: "end", + fill: textColor + }); + updateLineText(textNode.id, line, coords); + } else { + const textProperties = { + ...labelProperties, + label: text2, + position: "center", + alignment: "left", + color: textColor + }; + updateLineText(textNode.id, line, coords, textProperties, textNode, text2, strokeWidth); + } + }); + } + checkWithinBounds(xAxis, fontOptions, textNode) { + if (!textNode) { + return false; + } + const { text: text2, ...coords } = textNode.datum.label; + textNode.setProperties({ + ...fontOptions, + text: text2, + x: coords.x1, + y: coords.y1, + textBaseline: "middle", + textAlign: "end" + }); + const { x } = textNode.getBBox(); + return x >= xAxis.bounds.x && x <= xAxis.bounds.x + xAxis.bounds.width; + } + updateText(datum, coords) { + const oneLine = this.rangeStrokesGroupSelection.selectByTag(0 /* OneLine */)[0]; + if (!oneLine) { + return; + } + const { text: textProperties, strokeWidth } = datum; + this.text = this.updateNode(CollidableText, this.text, !!textProperties.label); + updateLineText(oneLine.id, oneLine, coords, textProperties, this.text, textProperties.label, strokeWidth); + } + updateAnchor(_datum, coords, _context, _bbox) { + const point = Vec47.topCenter(coords); + Vec211.apply(this.anchor, _ModuleSupport68.Transformable.toCanvasPoint(this.trendLine, point.x, point.y)); + } + containsPoint(x, y) { + const { trendLine, rangeStrokesGroupSelection, text: text2 } = this; + let isInStrokePath = false; + rangeStrokesGroupSelection.each((line) => isInStrokePath || (isInStrokePath = line.isPointInPath(x, y))); + return isInStrokePath || trendLine.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.trendLine.isPointInPath(x, y)) + return "line"; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + } + drag(datum, target, context, snapping) { + if (!datum.isWriteable()) + return; + if (this.activeHandle) { + this.dragHandle(datum, target, context, snapping); + } else { + this.dragAll(datum, target, context); + } + } + getAnchor() { + return this.anchor; + } + getCursor() { + return "pointer"; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/utils/validation.ts +import { _ModuleSupport as _ModuleSupport69 } from "ag-charts-community"; +import { Logger as Logger3 } from "ag-charts-core"; +var { ContinuousScale: ContinuousScale3 } = _ModuleSupport69; +function validateDatumPoint(context, point, options = { overflowContinuous: false }, warningPrefix) { + if (point.x == null || point.y == null) { + if (warningPrefix) { + Logger3.warnOnce(`${warningPrefix}requires both an [x] and [y] property, ignoring.`); + } + return false; + } + const { xAxis, yAxis } = context; + const continuousX = options.overflowContinuous && ContinuousScale3.is(xAxis.scale); + const continuousY = options.overflowContinuous && ContinuousScale3.is(yAxis.scale); + const validX = continuousX || validateDatumPointDirection(point.x, xAxis); + const validY = continuousY || validateDatumPointDirection(point.y, yAxis); + if (validX && validY) + return true; + if (warningPrefix) { + let text2 = "x & y domains"; + if (validX) + text2 = "y domain"; + if (validY) + text2 = "x domain"; + const xValue2 = getGroupingValue(point.x); + const yValue = getGroupingValue(point.y); + Logger3.warnOnce(`${warningPrefix}is outside the ${text2}, ignoring. - x: [${xValue2}], y: ${yValue}]`); + } + return false; +} +function validateDatumPointDirection(d, context) { + const { domain } = context.scale; + const value = getGroupingValue(d); + if (domain && value != null && context.continuous) { + return value >= domain[0] && value <= domain.at(-1); + } + return true; +} + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedScene.ts +var { Vec2: Vec212, Vec4: Vec48 } = _ModuleSupport70; +var FibonacciRetracementTrendBasedScene = class extends FibonacciScene { + constructor() { + super(); + this.type = "fibonacci-retracement-trend-based"; + this.endRetracementLine = new CollidableLine(); + this.start = new DivariantHandle(); + this.end = new DivariantHandle(); + this.endRetracement = new DivariantHandle(); + this.append([this.endRetracementLine, this.start, this.end, this.endRetracement]); + } + static is(value) { + return AnnotationScene.isCheck(value, "fibonacci-retracement-trend-based"); + } + update(datum, context) { + let { coords1, coords2 } = this.getCoords(datum, context); + if (coords1 == null || coords2 == null) { + this.visible = false; + return; + } + coords1 = Vec48.round(coords1); + coords2 = Vec48.round(coords2); + this.visible = datum.visible ?? true; + if (!this.visible) + return; + if (datum.endRetracement.x == void 0 || datum.endRetracement.y == void 0) { + coords2 = void 0; + } + this.updateLine(datum, coords1, this.trendLine); + this.updateLine(datum, coords2, this.endRetracementLine); + this.updateHandles(datum, coords1, coords2); + this.updateAnchor(datum, coords2 ?? coords1, context); + const { reverse, bands } = datum; + const coords = getFibonacciCoords(coords1, coords2); + const extendedCoords = this.extendLine(coords, datum, context); + const yZero = extendedCoords.y2; + const yOne = extendedCoords.y1; + const data = coords2 ? createFibonacciRangesData(extendedCoords, context, reverse, yZero, bands) : []; + this.updateRanges(datum, data, context); + const oneLinePoints = { ...extendedCoords, y1: yOne, y2: yOne }; + this.updateText(datum, oneLinePoints); + } + containsPoint(x, y) { + const { start, end, endRetracement, endRetracementLine } = this; + this.activeHandle = void 0; + if (start.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + if (end.containsPoint(x, y)) { + this.activeHandle = "end"; + return true; + } + if (endRetracement.containsPoint(x, y)) { + this.activeHandle = "endRetracement"; + return true; + } + return endRetracementLine.isPointInPath(x, y) || super.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y) || this.endRetracement.containsPoint(x, y)) + return "handle"; + if (this.endRetracementLine.isPointInPath(x, y)) + return "line"; + return super.getNodeAtCoords(x, y); + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ start: datum.start, end: datum.end, endRetracement: datum.endRetracement }, context) + }; + } + stopDragging() { + this.start.toggleDragging(false); + this.end.toggleDragging(false); + this.endRetracement.toggleDragging(false); + } + dragAll(datum, target, context) { + const { dragState } = this; + if (!dragState) + return; + this.translatePoints({ + datum, + start: dragState.start, + end: dragState.end, + endRetracement: dragState.endRetracement, + translation: Vec212.sub(target, dragState.offset), + context + }); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, dragState } = this; + if (!activeHandle || !dragState) + return; + this[activeHandle].toggleDragging(true); + const point = snapping ? this.snapToAngle(datum, target, context) : invertCoords(this[activeHandle].drag(target).point, context); + if (!point || !validateDatumPoint(context, point)) + return; + datum[activeHandle].x = point.x; + datum[activeHandle].y = point.y; + } + snapToAngle(datum, coords, context) { + const { activeHandle } = this; + const handles = ["start", "end", "endRetracement"]; + if (!activeHandle) + return; + const index = (handles.indexOf(activeHandle) + 1) % handles.length; + const fixedHandle = handles[index]; + this[activeHandle].toggleDragging(true); + const fixed = convertPoint(datum[fixedHandle], context); + return invertCoords(snapToAngle(coords, fixed, datum.snapToAngle), context); + } + translatePoints({ + datum, + start, + end, + endRetracement, + translation, + context + }) { + const points = translate({ start, end, endRetracement }, translation, context, { overflowContinuous: 2 }); + datum.start.x = points.start.x; + datum.end.x = points.end.x; + datum.endRetracement.x = points.endRetracement.x; + datum.start.y = points.start.y; + datum.end.y = points.end.y; + datum.endRetracement.y = points.endRetracement.y; + } + translate(datum, translation, context) { + this.translatePoints({ + datum, + start: convertPoint(datum.start, context), + end: convertPoint(datum.end, context), + endRetracement: convertPoint(datum.endRetracement, context), + translation, + context + }); + } + copy(datum, copiedDatum, context) { + const { coords1, coords2 } = this.getCoords(datum, context); + if (!coords1 || !coords2) { + return; + } + const bbox = this.computeBBoxWithoutHandles(); + this.translatePoints({ + datum: copiedDatum, + start: Vec48.start(coords1), + end: Vec48.end(coords1), + endRetracement: Vec48.end(coords2), + translation: { x: -bbox.width / 2, y: -bbox.height / 2 }, + context + }); + return copiedDatum; + } + getCoords(datum, context) { + return { + coords1: convertLine(datum, context), + coords2: convertLine({ start: datum.end, end: datum.endRetracement }, context) + }; + } + toggleHandles(show) { + if (typeof show === "boolean") { + this.start.visible = show; + this.end.visible = show; + this.endRetracement.visible = show; + } else { + for (const [handle2, visible] of entries3(show)) { + this[handle2].visible = visible; + } + } + this.start.toggleHovered(this.activeHandle === "start"); + this.end.toggleHovered(this.activeHandle === "end"); + this.endRetracement.toggleHovered(this.activeHandle === "endRetracement"); + } + toggleActive(active) { + this.toggleHandles(active); + this.start.toggleActive(active); + this.end.toggleActive(active); + this.endRetracement.toggleActive(active); + } + updateHandles(datum, coords1, coords2, bbox) { + this.start.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords1, "start") + }); + this.end.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords1, "end", bbox) + }); + if (coords2) { + this.endRetracement.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords2, "endRetracement", bbox) + }); + } + this.start.toggleLocked(datum.locked ?? false); + this.end.toggleLocked(datum.locked ?? false); + this.endRetracement.toggleLocked(datum.locked ?? false); + } + getHandleCoords(_datum, coords, handle2, _bbox) { + return handle2 === "start" ? Vec48.start(coords) : Vec48.end(coords); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedState.ts +import { _ModuleSupport as _ModuleSupport71 } from "ag-charts-community"; +var { StateMachine: StateMachine7, StateMachineProperty: StateMachineProperty7, Debug: Debug7 } = _ModuleSupport71; +var FibonacciRetracementTrendBasedStateMachine = class extends StateMachine7 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ start: true, end: false, endRetracement: false }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + const { datum } = this; + if (!datum) + return; + datum.endRetracement.x = datum.end.x; + datum.endRetracement.y = datum.end.y; + this.node?.toggleHandles({ end: true }); + ctx.update(); + }; + const actionEndRetracementUpdate = ({ + offset, + context + }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ endRetracement: snapPoint(offset, context, snapping, datum.end, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndRetracementFinish = () => { + this.node?.toggleHandles({ endRetracement: true }); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + const onExitEnd = () => { + ctx.showAnnotationOptions(); + ctx.recordAction(`Create ${this.datum?.type} annotation`); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine7.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + click: { + target: "endRetracement", + action: actionEndFinish + }, + drag: actionEndUpdate, + dragEnd: { + target: "endRetracement", + action: actionEndFinish + }, + reset: { + target: StateMachine7.parent, + action: actionCancel + }, + cancel: { + target: StateMachine7.parent, + action: actionCancel + }, + onExit: onExitEnd + }, + endRetracement: { + hover: actionEndRetracementUpdate, + click: { + target: StateMachine7.parent, + action: actionEndRetracementFinish + }, + drag: { + target: StateMachine7.parent, + action: actionEndRetracementFinish + }, + reset: { + target: StateMachine7.parent, + action: actionCancel + }, + cancel: { + target: StateMachine7.parent, + action: actionCancel + } + } + }); + this.debug = Debug7.create(true, "annotations"); + this.snapping = false; + } + createDatum() { + return new FibonacciRetracementTrendBasedProperties(); + } +}; +__decorateClass([ + StateMachineProperty7() +], FibonacciRetracementTrendBasedStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty7() +], FibonacciRetracementTrendBasedStateMachine.prototype, "node", 2); +__decorateClass([ + StateMachineProperty7() +], FibonacciRetracementTrendBasedStateMachine.prototype, "snapping", 2); + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedConfig.ts +var fibonacciRetracementTrendBasedConfig = { + type: "fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */, + datum: FibonacciRetracementTrendBasedProperties, + scene: FibonacciRetracementTrendBasedScene, + isDatum: FibonacciRetracementTrendBasedProperties.is, + translate: (node, datum, transition, context) => { + if (FibonacciRetracementTrendBasedProperties.is(datum) && FibonacciRetracementTrendBasedScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (FibonacciRetracementTrendBasedProperties.is(datum) && FibonacciRetracementTrendBasedProperties.is(copiedDatum) && FibonacciRetracementTrendBasedScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (FibonacciRetracementTrendBasedProperties.is(datum) && FibonacciRetracementTrendBasedScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new FibonacciRetracementTrendBasedStateMachine({ + ...ctx, + create: createDatum("fibonacci-retracement-trend-based" /* FibonacciRetracementTrendBased */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement/fibonacciRetracementScene.ts +import { _ModuleSupport as _ModuleSupport72 } from "ag-charts-community"; +import { entries as entries4 } from "ag-charts-core"; +var { Vec2: Vec213, Vec4: Vec49 } = _ModuleSupport72; +var FibonacciRetracementScene = class extends FibonacciScene { + constructor() { + super(); + this.type = "fibonacci-retracement"; + this.start = new DivariantHandle(); + this.end = new DivariantHandle(); + this.append([this.start, this.end]); + } + static is(value) { + return AnnotationScene.isCheck(value, "fibonacci-retracement"); + } + containsPoint(x, y) { + const { start, end } = this; + this.activeHandle = void 0; + if (start.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + if (end.containsPoint(x, y)) { + this.activeHandle = "end"; + return true; + } + return super.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y)) + return "handle"; + return super.getNodeAtCoords(x, y); + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ start: datum.start, end: datum.end }, context) + }; + } + stopDragging() { + this.start.toggleDragging(false); + this.end.toggleDragging(false); + } + dragAll(datum, target, context) { + const { dragState } = this; + if (!dragState) + return; + this.translatePoints({ + datum, + start: dragState.start, + end: dragState.end, + translation: Vec213.sub(target, dragState.offset), + context + }); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, dragState } = this; + if (!activeHandle || !dragState) + return; + this[activeHandle].toggleDragging(true); + const point = snapping ? this.snapToAngle(datum, target, context) : invertCoords(this[activeHandle].drag(target).point, context); + if (!point || !validateDatumPoint(context, point)) + return; + datum[activeHandle].x = point.x; + datum[activeHandle].y = point.y; + } + snapToAngle(datum, coords, context) { + const { activeHandle } = this; + const handles = ["start", "end"]; + const fixedHandle = handles.find((handle2) => handle2 !== activeHandle); + if (!activeHandle || !fixedHandle) + return; + this[activeHandle].toggleDragging(true); + const fixed = convertPoint(datum[fixedHandle], context); + return invertCoords(snapToAngle(coords, fixed, datum.snapToAngle), context); + } + translatePoints({ + datum, + start, + end, + translation, + context + }) { + const points = translate({ start, end }, translation, context, { overflowContinuous: 1 }); + datum.start.x = points.start.x; + datum.end.x = points.end.x; + datum.start.y = points.start.y; + datum.end.y = points.end.y; + } + translate(datum, translation, context) { + this.translatePoints({ + datum, + start: convertPoint(datum.start, context), + end: convertPoint(datum.end, context), + translation, + context + }); + } + copy(datum, copiedDatum, context) { + const coords = convertLine(datum, context); + if (!coords) { + return; + } + const bbox = this.computeBBoxWithoutHandles(); + this.translatePoints({ + datum: copiedDatum, + start: { x: coords.x1, y: coords.y1 }, + end: { x: coords.x2, y: coords.y2 }, + translation: { x: -bbox.width / 2, y: -bbox.height / 2 }, + context + }); + return copiedDatum; + } + toggleHandles(show) { + if (typeof show === "boolean") { + this.start.visible = show; + this.end.visible = show; + } else { + for (const [handle2, visible] of entries4(show)) { + this[handle2].visible = visible; + } + } + this.start.toggleHovered(this.activeHandle === "start"); + this.end.toggleHovered(this.activeHandle === "end"); + } + toggleActive(active) { + this.toggleHandles(active); + this.start.toggleActive(active); + this.end.toggleActive(active); + } + updateHandles(datum, coords, _coords2, bbox) { + this.start.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords, "start") + }); + this.end.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords, "end", bbox) + }); + this.start.toggleLocked(datum.locked ?? false); + this.end.toggleLocked(datum.locked ?? false); + } + getHandleCoords(_datum, coords, handle2, _bbox) { + return handle2 === "start" ? Vec49.start(coords) : Vec49.end(coords); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/line/lineState.ts +import { _ModuleSupport as _ModuleSupport73 } from "ag-charts-community"; +var { StateMachine: StateMachine8, StateMachineProperty: StateMachineProperty8, Debug: Debug8 } = _ModuleSupport73; +var LineTypeStateMachine = class extends StateMachine8 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ start: true, end: false }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ end: true }); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + const onExitEnd = () => { + ctx.showAnnotationOptions(); + ctx.recordAction(`Create ${this.datum?.type} annotation`); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine8.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + click: { + target: StateMachine8.parent, + action: actionEndFinish + }, + drag: actionEndUpdate, + dragEnd: { + target: StateMachine8.parent, + action: actionEndFinish + }, + reset: { + target: StateMachine8.parent, + action: actionCancel + }, + cancel: { + target: StateMachine8.parent, + action: actionCancel + }, + onExit: onExitEnd + } + }); + this.debug = Debug8.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass([ + StateMachineProperty8() +], LineTypeStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty8() +], LineTypeStateMachine.prototype, "node", 2); +__decorateClass([ + StateMachineProperty8() +], LineTypeStateMachine.prototype, "snapping", 2); +var ArrowStateMachine = class extends LineTypeStateMachine { + createDatum() { + return new ArrowProperties(); + } +}; +var LineStateMachine = class extends LineTypeStateMachine { + createDatum() { + return new LineProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement/fibonacciRetracementState.ts +var FibonacciRetracementStateMachine = class extends LineTypeStateMachine { + createDatum() { + return new FibonacciRetracementProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/fibonacci-retracement/fibonacciRetracementConfig.ts +var fibonacciRetracementConfig = { + type: "fibonacci-retracement" /* FibonacciRetracement */, + datum: FibonacciRetracementProperties, + scene: FibonacciRetracementScene, + isDatum: FibonacciRetracementProperties.is, + translate: (node, datum, transition, context) => { + if (FibonacciRetracementProperties.is(datum) && FibonacciRetracementScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (FibonacciRetracementProperties.is(datum) && FibonacciRetracementProperties.is(copiedDatum) && FibonacciRetracementScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (FibonacciRetracementProperties.is(datum) && FibonacciRetracementScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new FibonacciRetracementStateMachine({ + ...ctx, + create: createDatum("fibonacci-retracement" /* FibonacciRetracement */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/line/lineScene.ts +import { _ModuleSupport as _ModuleSupport75 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/scenes/capScene.ts +import { _ModuleSupport as _ModuleSupport74 } from "ag-charts-community"; +var { Vec2: Vec214 } = _ModuleSupport74; +var CapScene = class extends _ModuleSupport74.Group { +}; +var ArrowCapScene = class extends CapScene { + constructor() { + super(); + this.type = "arrow"; + this.path = new _ModuleSupport74.Path(); + this.armLength = 6; + this.append([this.path]); + } + update(options) { + const { path } = this; + const { x, y, angle, ...rest } = options; + const origin = Vec214.from(x, y); + const offsetAngle = 3 * Math.PI / 4; + const armLength = this.armLength + (options.strokeWidth ?? 0) * 2; + const leftEnd = Vec214.rotate(Vec214.from(0, armLength), angle + offsetAngle, origin); + const rightEnd = Vec214.rotate(Vec214.from(armLength, 0), angle - offsetAngle, origin); + path.setProperties(rest); + path.fillOpacity = 0; + path.path.clear(); + path.path.moveTo(leftEnd.x, leftEnd.y); + path.path.lineTo(origin.x, origin.y); + path.path.lineTo(rightEnd.x, rightEnd.y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/line/lineScene.ts +var { Vec2: Vec215, Vec4: Vec410 } = _ModuleSupport75; +var LineScene = class extends StartEndScene { + constructor() { + super(); + this.type = "line"; + this.line = new CollidableLine(); + this.append([this.line, this.start, this.end]); + } + static is(value) { + return AnnotationScene.isCheck(value, "line"); + } + update(datum, context) { + let coords = convertLine(datum, context); + if (coords == null) { + this.visible = false; + return; + } + coords = Vec410.round(coords); + this.visible = datum.visible ?? true; + if (!this.visible) + return; + this.updateLine(datum, coords, context); + this.updateHandles(datum, coords); + this.updateText(datum, coords); + this.updateCaps(datum, coords); + this.updateAnchor(datum, coords, context); + } + updateLine(datum, coords, context) { + const { line } = this; + const { lineDashOffset, stroke: stroke2, strokeWidth, strokeOpacity } = datum; + const linePoints = this.extendLine(coords, datum, context); + line.setProperties({ + ...linePoints, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke2, + strokeWidth, + strokeOpacity, + fillOpacity: 0 + }); + } + updateText(datum, coords) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateLineText(this.line.id, this.line, coords, datum.text, this.text, datum.text.label, datum.strokeWidth); + } + updateCaps(datum, coords) { + if (!datum.startCap && this.startCap) { + this.startCap.remove(); + this.startCap = void 0; + } + if (!datum.endCap && this.endCap) { + this.endCap.remove(); + this.endCap = void 0; + } + if (!datum.startCap && !datum.endCap) + return; + const { stroke: stroke2, strokeWidth, strokeOpacity } = datum; + const [start, end] = Vec215.from(coords); + const angle = Vec215.angle(Vec215.sub(end, start)); + if (datum.startCap) { + if (this.startCap && this.startCap.type !== datum.startCap) { + this.startCap.remove(); + this.startCap = void 0; + } + if (this.startCap == null) { + this.startCap = new ArrowCapScene(); + this.append([this.startCap]); + } + this.startCap.update({ + x: start.x, + y: start.y, + angle: angle - Math.PI, + stroke: stroke2, + strokeWidth, + strokeOpacity + }); + } + if (datum.endCap) { + if (this.endCap && this.endCap.type !== datum.endCap) { + this.endCap.remove(); + this.endCap = void 0; + } + if (this.endCap == null) { + this.endCap = new ArrowCapScene(); + this.append([this.endCap]); + } + this.endCap.update({ + x: end.x, + y: end.y, + angle, + stroke: stroke2, + strokeWidth, + strokeOpacity + }); + } + } + updateAnchor(_datum, coords, _context, _bbox) { + const point = Vec410.topCenter(coords); + Vec215.apply(this.anchor, _ModuleSupport75.Transformable.toCanvasPoint(this.line, point.x, point.y)); + } + containsPoint(x, y) { + const { line, text: text2 } = this; + return super.containsPoint(x, y) || line.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.line.isPointInPath(x, y)) + return "line"; + return super.getNodeAtCoords(x, y); + } + getHandleCoords(_datum, coords, handle2, _bbox) { + const { startCap, endCap } = this; + let [startPoint, endPoint] = Vec215.from(coords); + const angle = Vec215.angle(Vec215.sub(endPoint, startPoint)); + if (startCap) { + startPoint = Vec215.rotate(Vec215.from(0, -DivariantHandle.HANDLE_SIZE / 2), angle, startPoint); + } + if (endCap) { + endPoint = Vec215.rotate(Vec215.from(0, DivariantHandle.HANDLE_SIZE / 2), angle, endPoint); + } + return handle2 === "start" ? startPoint : endPoint; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/line/lineConfig.ts +var lineConfig = { + type: "line" /* Line */, + datum: LineProperties, + scene: LineScene, + isDatum: LineProperties.is, + translate: (node, datum, transition, context) => { + if (LineProperties.is(datum) && LineScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (LineProperties.is(datum) && LineProperties.is(copiedDatum) && LineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (LineProperties.is(datum) && LineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new LineStateMachine({ + ...ctx, + create: createDatum("line" /* Line */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var arrowConfig = { + type: "arrow" /* Arrow */, + datum: ArrowProperties, + scene: LineScene, + isDatum: ArrowProperties.is, + translate: (node, datum, transition, context) => { + if (ArrowProperties.is(datum) && LineScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (ArrowProperties.is(datum) && ArrowProperties.is(copiedDatum) && LineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ArrowProperties.is(datum) && LineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ArrowStateMachine({ + ...ctx, + create: createDatum("arrow" /* Arrow */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerScene.ts +import { _ModuleSupport as _ModuleSupport78 } from "ag-charts-community"; +import { isDate as isDate2, isNumber as isNumber3 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerStatisticsScene.ts +import { _ModuleSupport as _ModuleSupport77 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/utils/layout.ts +import { _ModuleSupport as _ModuleSupport76 } from "ag-charts-community"; +function layoutScenesRow(scenes, startX = 0, gap = 0) { + let x = startX; + for (const scene of scenes) { + if (Array.isArray(scene)) { + for (const scene_ of scene) { + layoutSetX(scene_, x); + } + x += _ModuleSupport76.Group.computeChildrenBBox(scene).width + gap; + } else { + layoutSetX(scene, x); + x += scene.getBBox().width + gap; + } + } +} +function layoutScenesColumn(scenes, startY = 0, gap = 0) { + let y = startY; + for (const scene of scenes) { + if (Array.isArray(scene)) { + for (const scene_ of scene) { + layoutSetY(scene_, y); + } + y += _ModuleSupport76.Group.computeChildrenBBox(scene).height + gap; + } else { + layoutSetY(scene, y); + y += scene.getBBox().height + gap; + } + } +} +function layoutSetX(scene, x) { + if ("x1" in scene) { + scene.x2 = x + (scene.x2 - scene.x1); + scene.x1 = x; + } else { + scene.x = x; + } +} +function layoutSetY(scene, y) { + if ("y1" in scene) { + scene.y2 = y + (scene.y2 - scene.y1); + scene.y1 = y; + } else { + scene.y = y; + } +} +function layoutAddX(scene, x) { + if ("x1" in scene) { + scene.x1 += x; + scene.x2 += x; + } else { + scene.x += x; + } +} +function layoutAddY(scene, y) { + if ("y1" in scene) { + scene.y1 += y; + scene.y2 += y; + } else { + scene.y += y; + } +} + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerStatisticsScene.ts +var { Vec4: Vec411 } = _ModuleSupport77; +var MeasurerStatisticsScene = class extends _ModuleSupport77.Group { + constructor() { + super(); + this.name = "MeasurerStatisticsScene"; + this.background = new _ModuleSupport77.Rect(); + this.dateRangeBarsText = new _ModuleSupport77.Text(); + this.dateRangeDivider = new _ModuleSupport77.Line(); + this.dateRangeValueText = new _ModuleSupport77.Text(); + this.priceRangeValueText = new _ModuleSupport77.Text(); + this.priceRangeDivider = new _ModuleSupport77.Line(); + this.priceRangePercentageText = new _ModuleSupport77.Text(); + this.volumeText = new _ModuleSupport77.Text(); + this.volumeFormatter = new Intl.NumberFormat("en-US", { + notation: "compact", + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }); + this.append([ + this.background, + this.dateRangeBarsText, + this.dateRangeDivider, + this.dateRangeValueText, + this.priceRangeValueText, + this.priceRangeDivider, + this.priceRangePercentageText, + this.volumeText + ]); + } + update(datum, stats, anchor, coords, context, verticalDirection, localeManager) { + this.verticalDirection = verticalDirection; + const scenes = this.updateStatistics(datum, stats, anchor, localeManager); + const bbox = _ModuleSupport77.Group.computeChildrenBBox(scenes.flat()); + const padding = 10; + bbox.grow(padding); + this.updateBackground(datum, bbox, padding); + this.reposition(scenes, padding, context); + this.checkVisibility(datum, context, coords); + } + checkVisibility(datum, context, coords) { + const bounds = Vec411.from(new _ModuleSupport77.BBox(0, 0, context.seriesRect.width, context.seriesRect.height)); + if (Vec411.collides(coords, bounds)) { + this.visible = datum.visible ?? true; + } else { + this.visible = false; + } + } + updateStatistics(datum, stats, anchor, localeManager) { + const { + dateRangeBarsText, + dateRangeDivider, + dateRangeValueText, + priceRangeValueText, + priceRangeDivider, + priceRangePercentageText, + volumeText + } = this; + const horizontalGap = 8; + const verticalGap = 6; + const dividerLineHeight = datum.statistics.fontSize + 3; + const dividerLineOffset = -2; + const textStyles = this.getTextStyles(datum); + const dividerLineStyles = { + ...this.getDividerStyles(datum), + x1: 0, + y1: 0, + x2: 0, + y2: dividerLineHeight + }; + const dateScenes = [dateRangeBarsText, dateRangeDivider, dateRangeValueText]; + const priceScenes = [priceRangeValueText, priceRangeDivider, priceRangePercentageText]; + const scenes = []; + if (stats.priceRange) { + priceRangeValueText.setProperties({ + ...textStyles, + text: this.formatPriceRangeValue(stats.priceRange.value, localeManager) + }); + priceRangeDivider.setProperties(dividerLineStyles); + priceRangePercentageText.setProperties({ + ...textStyles, + text: this.formatPriceRangePercentage(stats.priceRange.percentage, localeManager) + }); + layoutScenesRow(priceScenes, anchor.x, horizontalGap); + scenes.push(priceScenes); + } + if (stats.dateRange) { + dateRangeBarsText.setProperties({ + ...textStyles, + text: this.formatDateRangeBars(stats.dateRange.bars, localeManager) + }); + dateRangeDivider.setProperties(dividerLineStyles); + dateRangeValueText.setProperties({ + ...textStyles, + text: this.formatDateRangeValue(stats.dateRange.value) + }); + layoutScenesRow(dateScenes, anchor.x, horizontalGap); + scenes.push(dateScenes); + } + if (stats.volume == null) { + volumeText.visible = false; + } else { + volumeText.setProperties({ + ...textStyles, + x: anchor.x, + text: this.formatVolume(stats.volume, localeManager), + visible: true + }); + scenes.push(volumeText); + } + layoutScenesColumn(scenes, anchor.y, verticalGap); + priceRangeDivider.y1 += dividerLineOffset; + priceRangeDivider.y2 += dividerLineOffset; + dateRangeDivider.y1 += dividerLineOffset; + dateRangeDivider.y2 += dividerLineOffset; + return scenes; + } + updateBackground(datum, bbox, padding) { + const styles = this.getBackgroundStyles(datum); + this.background.setProperties({ + ...styles, + ...bbox, + x: bbox.x - bbox.width / 2 + padding, + y: bbox.y + }); + } + reposition(scenes, padding, context) { + const { width, height } = context.seriesRect; + const background = Vec411.from(this.background.getBBox()); + let offsetX = 0; + if (background.x1 < 0) + offsetX = -background.x1; + if (background.x2 > width) + offsetX = width - background.x2; + const offsetY = Math.min(padding, height - background.y2); + for (const scene of scenes) { + if (Array.isArray(scene)) { + const rowWidth = _ModuleSupport77.Group.computeChildrenBBox(scene).width; + for (const scene_ of scene) { + layoutAddX(scene_, offsetX - rowWidth / 2); + layoutAddY(scene_, offsetY); + } + } else { + layoutAddX(scene, offsetX - scene.getBBox().width / 2); + layoutAddY(scene, offsetY); + } + } + this.background.x += offsetX; + this.background.y += offsetY; + } + getTextStyles(datum) { + return { + fill: datum.statistics.color, + fontFamily: datum.statistics.fontFamily, + fontSize: datum.statistics.fontSize, + fontStyle: datum.statistics.fontStyle, + fontWeight: datum.statistics.fontWeight, + textBaseline: "top" + }; + } + getDividerStyles(datum) { + return { + stroke: datum.statistics.divider.stroke, + strokeOpacity: datum.statistics.divider.strokeOpacity, + strokeWidth: datum.statistics.divider.strokeWidth + }; + } + getBackgroundStyles(datum) { + return { + fill: datum.statistics.fill, + stroke: datum.statistics.stroke, + strokeOpacity: datum.statistics.strokeOpacity, + strokeWidth: datum.statistics.strokeWidth, + cornerRadius: 4 + }; + } + formatDateRangeBars(bars, localeManager) { + return localeManager?.t("measurerDateRangeBars", { value: bars }) ?? `${bars}`; + } + formatDateRangeValue(time) { + const range2 = []; + const sign = time >= 0 ? "" : "-"; + time = Math.abs(time); + const MINUTE = 1e3 * 60; + const HOUR = MINUTE * 60; + const DAY2 = HOUR * 24; + const minutes = Math.floor(time / MINUTE); + const hours = Math.floor(time / HOUR); + const days = Math.floor(time / DAY2); + const remainderHours = hours % (DAY2 / HOUR); + const remainderMinutes = minutes % (HOUR / MINUTE); + if (days >= 1) + range2.push(`${days}d`); + if (hours >= 1 && (time < DAY2 || remainderHours !== 0)) + range2.push(`${remainderHours}h`); + if (time < HOUR || remainderMinutes !== 0) + range2.push(`${remainderMinutes}m`); + range2[0] = `${sign}${range2[0]}`; + return range2.join(" "); + } + formatPriceRangeValue(value, localeManager) { + return localeManager?.t("measurerPriceRangeValue", { value: Number(value.toFixed(2)) }) ?? `${value}`; + } + formatPriceRangePercentage(percentage, localeManager) { + return localeManager?.t("measurerPriceRangePercent", { value: percentage }) ?? `${percentage}`; + } + formatVolume(volume, localeManager) { + const volumeString = Number.isNaN(volume) ? "" : this.volumeFormatter.format(volume); + return localeManager?.t("measurerVolume", { value: volumeString }) ?? volumeString; + } +}; +var QuickMeasurerStatisticsScene = class extends MeasurerStatisticsScene { + getDirectionStyles(datum) { + return this.verticalDirection === "down" ? datum.down.statistics : datum.up.statistics; + } + getTextStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + ...super.getTextStyles(datum), + fill: styles.color, + fontFamily: styles.fontFamily, + fontSize: styles.fontSize, + fontStyle: styles.fontStyle, + fontWeight: styles.fontWeight + }; + } + getDividerStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + stroke: styles.divider.stroke, + strokeOpacity: styles.divider.strokeOpacity, + strokeWidth: styles.divider.strokeWidth + }; + } + getBackgroundStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + ...super.getBackgroundStyles(datum), + fill: styles.fill, + stroke: styles.stroke, + strokeOpacity: styles.strokeOpacity, + strokeWidth: styles.strokeWidth + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerScene.ts +var { Vec2: Vec216, Vec4: Vec412 } = _ModuleSupport78; +var MeasurerScene = class extends StartEndScene { + constructor() { + super(); + this.type = "measurer"; + this.horizontalLine = new CollidableLine(); + this.verticalLine = new CollidableLine(); + // These four bounding lines are named after the way they are drawn, e.g. the horizontalStartLine is a horizontal + // line that is only shown when the measurer has the 'vertical' direction. + this.horizontalStartLine = new CollidableLine(); + this.horizontalEndLine = new CollidableLine(); + this.verticalStartLine = new CollidableLine(); + this.verticalEndLine = new CollidableLine(); + this.horizontalEndCap = new ArrowCapScene(); + this.verticalEndCap = new ArrowCapScene(); + this.background = new _ModuleSupport78.Path({ zIndex: -1 }); + this.updateBackground = WithBackgroundScene.updateBackground.bind(this); + this.statistics = this.createStatisticsScene(); + this.statistics.zIndex = 1; + this.append([ + this.background, + this.verticalStartLine, + this.verticalEndLine, + this.horizontalStartLine, + this.horizontalEndLine, + this.horizontalLine, + this.verticalLine, + this.horizontalEndCap, + this.verticalEndCap, + this.start, + this.end, + this.statistics + ]); + } + static is(value) { + return AnnotationScene.isCheck(value, "measurer"); + } + createStatisticsScene() { + return new MeasurerStatisticsScene(); + } + update(datum, context) { + const coords = convertLine(datum, context); + if (coords == null) { + this.visible = false; + return; + } + this.visible = datum.visible ?? true; + if (!this.visible) + return; + const extended = this.extendPerpendicular(coords, datum, context); + const verticalStart = { ...extended, y2: extended.y1 }; + const verticalEnd = { ...extended, y1: extended.y2 }; + this.verticalDirection = coords.y1 < coords.y2 ? "down" : "up"; + this.updateVisibilities(datum); + this.updateLines(datum, coords); + this.updateHandles(datum, coords); + this.updateText(datum, coords); + this.updateCaps(datum, coords); + this.updateBoundingLines(datum, extended); + this.updateBackground(datum, verticalStart, verticalEnd, context); + this.updateStatistics(datum, coords, context); + this.updateAnchor(datum, coords, context); + } + extendPerpendicular(coords, datum, context) { + const extended = { + x1: Math.min(coords.x1, coords.x2), + x2: Math.max(coords.x1, coords.x2), + y1: Math.min(coords.y1, coords.y2), + y2: Math.max(coords.y1, coords.y2) + }; + const [start, end] = Vec216.from(context.yAxis.bounds); + if (DateRangeProperties.is(datum)) { + if (datum.extendAbove) + extended.y1 = start.y; + if (datum.extendBelow) + extended.y2 = end.y; + } else if (PriceRangeProperties.is(datum)) { + if (datum.extendLeft) + extended.x1 = start.x; + if (datum.extendRight) + extended.x2 = end.x; + } + return extended; + } + updateVisibilities(datum) { + const { + horizontalStartLine, + horizontalEndLine, + horizontalEndCap, + verticalStartLine, + verticalEndLine, + verticalEndCap + } = this; + const { direction } = datum; + verticalStartLine.visible = direction !== "vertical"; + verticalEndLine.visible = direction !== "vertical"; + horizontalEndCap.visible = direction !== "vertical"; + horizontalStartLine.visible = direction !== "horizontal"; + horizontalEndLine.visible = direction !== "horizontal"; + verticalEndCap.visible = direction !== "horizontal"; + } + updateLines(datum, coords) { + const { horizontalLine, verticalLine } = this; + const { direction } = datum; + const { x1, y1, x2, y2 } = coords; + const center = Vec216.round(Vec412.center(coords), 0); + const lineStyles = this.getLineStyles(datum); + if (direction !== "vertical") { + horizontalLine.setProperties({ + ...lineStyles, + x1, + x2, + y1: center.y, + y2: center.y + }); + } + if (direction !== "horizontal") { + verticalLine.setProperties({ + ...lineStyles, + x1: center.x, + x2: center.x, + y1, + y2 + }); + } + } + updateText(datum, coords) { + const { direction } = datum; + const center = Vec216.round(Vec412.center(coords), 0); + let line; + const textCoords = { ...coords }; + if (direction === "vertical") { + line = this.verticalLine; + textCoords.x1 = center.x; + textCoords.x2 = center.x; + } else { + line = this.horizontalLine; + textCoords.y1 = center.y; + textCoords.y2 = center.y; + } + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + const { id } = line; + const clip = updateLineText(id, line, textCoords, datum.text, this.text, datum.text.label, datum.strokeWidth); + let verticalClipMask; + if (direction === "both" && clip && this.text) { + const textBBox = Vec412.from(this.text.getBBox()); + const { offset } = clip.numbers; + const crossesVerticalLine = textBBox.x1 <= center.x + offset.x && textBBox.x2 >= center.x - offset.x; + if (crossesVerticalLine) { + verticalClipMask = { + x: center.x, + y: clip.clipMask.y, + radius: this.text.getBBox().height / 2 + Vec216.length(offset) + }; + } + } + this.verticalLine.setClipMask(id, verticalClipMask); + } + updateCaps(datum, coords) { + const { horizontalEndCap, verticalEndCap } = this; + const { direction } = datum; + const { x1, y1, x2, y2 } = coords; + const center = Vec216.round(Vec412.center(coords), 0); + const { stroke: stroke2, strokeWidth, strokeOpacity } = this.getLineStyles(datum); + const capStyles = { stroke: stroke2, strokeWidth, strokeOpacity }; + if (direction !== "vertical") { + const angle = x1 <= x2 ? 0 : Math.PI; + let x = x2; + if (direction === "horizontal") { + x += x1 <= x2 ? -2 : 2; + } + horizontalEndCap.update({ ...capStyles, x, y: center.y, angle }); + } + if (direction !== "horizontal") { + const angle = y1 <= y2 ? Math.PI / 2 : Math.PI / -2; + let y = y2; + if (direction === "vertical") { + y += y1 <= y2 ? -2 : 2; + } + verticalEndCap.update({ ...capStyles, x: center.x, y, angle }); + } + } + updateBoundingLines(datum, extendedCoords) { + const { verticalStartLine, verticalEndLine, horizontalStartLine, horizontalEndLine } = this; + const { direction } = datum; + const { x1, y1, x2, y2 } = extendedCoords; + const lineStyles = this.getLineStyles(datum); + if (direction === "horizontal") { + verticalStartLine.setProperties({ ...lineStyles, x1, y1, x2: x1, y2 }); + verticalEndLine.setProperties({ ...lineStyles, x1: x2, y1, x2, y2 }); + } + if (direction === "vertical") { + horizontalStartLine.setProperties({ ...lineStyles, x1, y1, x2, y2: y1 }); + horizontalEndLine.setProperties({ ...lineStyles, x1, y1: y2, x2, y2 }); + } + } + updateStatistics(datum, coords, context) { + const point = Vec216.add(Vec412.bottomCenter(coords), Vec216.from(0, 10)); + const statistics = { volume: this.getVolume(datum) }; + if (datum.hasPriceRange) { + statistics.priceRange = { + percentage: this.getPriceRangePercentage(datum), + value: this.getPriceRangeValue(datum) + }; + } + if (datum.hasDateRange) { + statistics.dateRange = { + bars: this.getDateRangeBars(coords, context), + value: this.getDateRangeValue(datum) + }; + } + this.statistics.update(datum, statistics, point, coords, context, this.verticalDirection, datum.localeManager); + } + updateAnchor(_datum, coords, _context, _bbox) { + const point = Vec412.topCenter(coords); + Vec216.apply(this.anchor, _ModuleSupport78.Transformable.toCanvasPoint(this.horizontalLine, point.x, point.y)); + } + getBackgroundPoints(_datum, verticalStart, verticalEnd, _bounds) { + const [startStart, startEnd] = Vec216.from(verticalStart); + const [endStart, endEnd] = Vec216.from(verticalEnd); + return [startStart, startEnd, endEnd, endStart]; + } + getLineStyles(datum) { + const { lineDashOffset, stroke: stroke2, strokeWidth, strokeOpacity } = datum; + return { + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke2, + strokeWidth, + strokeOpacity, + fillOpacity: 0 + }; + } + getBackgroundStyles(datum) { + const { background } = datum; + return { + fill: background.fill, + fillOpacity: background.fillOpacity + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + } + containsPoint(x, y) { + const { + horizontalLine, + text: text2, + verticalLine, + horizontalStartLine, + horizontalEndLine, + verticalStartLine, + verticalEndLine + } = this; + return super.containsPoint(x, y) || horizontalLine.isPointInPath(x, y) || verticalLine.isPointInPath(x, y) || horizontalStartLine.visible && horizontalStartLine.isPointInPath(x, y) || horizontalEndLine.visible && horizontalEndLine.isPointInPath(x, y) || verticalStartLine.visible && verticalStartLine.isPointInPath(x, y) || verticalEndLine.visible && verticalEndLine.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y)) + return "handle"; + return "line"; + } + getDateRangeBars(coords, context) { + const { step } = context.xAxis.scale; + const sign = coords.x1 <= coords.x2 ? 1 : -1; + return step ? Math.round(Vec412.width(coords) / step) * sign : 0; + } + getDateRangeValue(datum) { + const start = getGroupingValue(datum.start.x); + const end = getGroupingValue(datum.end.x); + if (!isDate2(start) || !isDate2(end)) { + throw new Error("Can not create a date range measurement of non-date x-axis."); + } + return end.getTime() - start.getTime(); + } + getPriceRangePercentage(datum) { + if (datum.start.y == null || datum.end.y == null) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + const endY = getGroupingValue(datum.end.y); + const startY = getGroupingValue(datum.start.y); + if (!isNumber3(endY) || !isNumber3(startY)) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + return (endY - startY) / startY; + } + getPriceRangeValue(datum) { + if (datum.start.y == null || datum.end.y == null) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + const endY = getGroupingValue(datum.end.y); + const startY = getGroupingValue(datum.start.y); + if (!isNumber3(endY) || !isNumber3(startY)) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + return endY - startY; + } + getVolume(datum) { + return datum.getVolume(datum.start.x, datum.end.x); + } +}; +var QuickMeasurerScene = class extends MeasurerScene { + constructor() { + super(...arguments); + this.type = "quick-measurer"; + } + static is(value) { + return AnnotationScene.isCheck(value, "quick-measurer"); + } + createStatisticsScene() { + return new QuickMeasurerStatisticsScene(); + } + getDirectionStyles(datum) { + return this.verticalDirection === "down" ? datum.down : datum.up; + } + getLineStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + ...super.getLineStyles(datum), + stroke: styles.stroke, + strokeWidth: styles.strokeWidth, + strokeOpacity: styles.strokeOpacity + }; + } + getBackgroundStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + fill: styles.fill, + fillOpacity: styles.fillOpacity + }; + } + getHandleStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + fill: styles.handle.fill, + stroke: styles.handle.stroke ?? styles.stroke, + strokeOpacity: styles.handle.strokeOpacity ?? styles.strokeOpacity, + strokeWidth: styles.handle.strokeWidth ?? styles.strokeWidth + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerState.ts +import { _ModuleSupport as _ModuleSupport79 } from "ag-charts-community"; +var { StateMachine: StateMachine9, StateMachineProperty: StateMachineProperty9, Debug: Debug9 } = _ModuleSupport79; +var MeasurerTypeStateMachine = class extends StateMachine9 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point }); + ctx.create(datum); + }; + const actionEndUpdate = ({ point }) => { + const { datum, node } = this; + datum?.set({ end: point }); + node?.toggleActive(true); + node?.toggleHandles({ end: false }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ end: true }); + }; + const actionCancel = () => ctx.delete(); + const onExitEnd = () => { + ctx.showAnnotationOptions(); + ctx.recordAction(`Create ${this.node?.type} annotation`); + }; + super("start", { + start: { + reset: StateMachine9.parent, + click: { + target: "end", + action: actionCreate + }, + drag: { + target: "end", + action: actionCreate + } + }, + end: { + hover: actionEndUpdate, + drag: actionEndUpdate, + click: { + target: StateMachine9.parent, + action: actionEndFinish + }, + dragEnd: { + target: StateMachine9.parent, + action: actionEndFinish + }, + reset: { + target: StateMachine9.parent, + action: actionCancel + }, + cancel: { + target: StateMachine9.parent, + action: actionCancel + }, + onExit: onExitEnd + } + }); + this.debug = Debug9.create(true, "annotations"); + } +}; +__decorateClass([ + StateMachineProperty9() +], MeasurerTypeStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty9() +], MeasurerTypeStateMachine.prototype, "node", 2); +var DateRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new DateRangeProperties(); + } +}; +var PriceRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new PriceRangeProperties(); + } +}; +var DatePriceRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new DatePriceRangeProperties(); + } +}; +var QuickDatePriceRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new QuickDatePriceRangeProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/measurer/measurerConfig.ts +var dateRangeConfig = { + type: "date-range" /* DateRange */, + datum: DateRangeProperties, + scene: MeasurerScene, + isDatum: DateRangeProperties.is, + translate: (node, datum, translation, context) => { + if (DateRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (DateRangeProperties.is(datum) && DateRangeProperties.is(copiedDatum) && MeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (DateRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new DateRangeStateMachine({ + ...ctx, + create: createDatum("date-range" /* DateRange */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var priceRangeConfig = { + type: "price-range" /* PriceRange */, + datum: PriceRangeProperties, + scene: MeasurerScene, + isDatum: PriceRangeProperties.is, + translate: (node, datum, translation, context) => { + if (PriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (PriceRangeProperties.is(datum) && PriceRangeProperties.is(copiedDatum) && MeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (PriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new PriceRangeStateMachine({ + ...ctx, + create: createDatum("date-range" /* DateRange */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var datePriceRangeConfig = { + type: "date-price-range" /* DatePriceRange */, + datum: DatePriceRangeProperties, + scene: MeasurerScene, + isDatum: DatePriceRangeProperties.is, + translate: (node, datum, translation, context) => { + if (DatePriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (DatePriceRangeProperties.is(datum) && DatePriceRangeProperties.is(copiedDatum) && MeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (DatePriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new DatePriceRangeStateMachine({ + ...ctx, + create: createDatum("date-range" /* DateRange */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var quickDatePriceRangeConfig = { + type: "quick-date-price-range" /* QuickDatePriceRange */, + datum: QuickDatePriceRangeProperties, + scene: QuickMeasurerScene, + isDatum: QuickDatePriceRangeProperties.is, + translate: (node, datum, translation, context) => { + if (QuickDatePriceRangeProperties.is(datum) && QuickMeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (QuickDatePriceRangeProperties.is(datum) && QuickDatePriceRangeProperties.is(copiedDatum) && QuickMeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (QuickDatePriceRangeProperties.is(datum) && QuickMeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new QuickDatePriceRangeStateMachine({ + ...ctx, + create: createDatum("quick-date-price-range" /* QuickDatePriceRange */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/note/noteScene.ts +import { _ModuleSupport as _ModuleSupport80 } from "ag-charts-community"; +import { calcLineHeight as calcLineHeight3, clamp as clamp4, wrapText as wrapText2 } from "ag-charts-core"; +var { ZIndexMap: ZIndexMap3 } = _ModuleSupport80; +var NoteScene = class extends TextualPointScene { + constructor() { + super(); + this.type = "note" /* Note */; + this.shape = new _ModuleSupport80.Rect(); + this.iconBackground = new _ModuleSupport80.TranslatableSvgPath( + "M22 1.83333C22 0.820811 21.1792 0 20.1667 0H1.83333C0.820811 0 0 0.82081 0 1.83333V13.9868C0 14.9994 0.820811 15.8202 1.83333 15.8202L5.88971 15.8202C6.44575 15.8202 6.97175 16.0725 7.31971 16.5062L9.57006 19.3112C10.304 20.2259 11.6962 20.2259 12.4301 19.3112L14.6804 16.5062C15.0284 16.0725 15.5544 15.8202 16.1104 15.8202L20.1667 15.8202C21.1792 15.8202 22 14.9994 22 13.9868V1.83333Z" + ); + this.iconLines = new _ModuleSupport80.TranslatableSvgPath( + "M17.1114 5.75C17.1114 6.16421 16.7756 6.5 16.3614 6.5H5.63916C5.22495 6.5 4.88916 6.16421 4.88916 5.75V5.75C4.88916 5.33579 5.22495 5 5.63916 5H16.3614C16.7756 5 17.1114 5.33579 17.1114 5.75V5.75ZM17.1114 9.25C17.1114 9.66421 16.7756 10 16.3614 10H5.63916C5.22495 10 4.88916 9.66421 4.88916 9.25V9.25C4.88916 8.83579 5.22495 8.5 5.63916 8.5H16.3614C16.7756 8.5 17.1114 8.83579 17.1114 9.25V9.25Z" + ); + this.active = false; + this.shape.visible = false; + this.label.visible = false; + this.iconBackground.fillShadow = new _ModuleSupport80.DropShadow(); + this.append([this.shape, this.label, this.iconBackground, this.iconLines, this.handle]); + } + static is(value) { + return AnnotationScene.isCheck(value, "note" /* Note */); + } + update(datum, context) { + this.updateIcon(datum, context); + super.update(datum, context); + } + getTextBBox(datum, coords, context) { + const bbox = super.getTextBBox(datum, coords, context); + bbox.x -= datum.width / 2; + bbox.x = clamp4(0, bbox.x, context.seriesRect.width - datum.width); + const padding = datum.getPadding().top; + const topY = bbox.y - LABEL_OFFSET - padding * 2; + const bottomY = bbox.y + DivariantHandle.HANDLE_SIZE + padding * 2; + if (topY - bbox.height - TOOLBAR_OFFSET < 0) { + bbox.y = bottomY; + datum.position = "top"; + } else { + bbox.y = topY + padding; + datum.position = "bottom"; + } + return bbox; + } + updateLabel(datum, bbox) { + const labelVisibility = datum.visible === false ? false : this.label.visible; + super.updateLabel(datum, bbox); + this.label.visible = labelVisibility; + this.label.text = wrapText2(datum.text, { + maxWidth: 200, + font: datum, + textWrap: "always", + avoidOrphans: false + }); + } + updateShape(datum, bbox) { + const { shape } = this; + shape.fill = datum.background.fill; + shape.fillOpacity = datum.background.fillOpacity ?? 1; + shape.stroke = datum.background.stroke; + shape.strokeOpacity = datum.background.strokeOpacity ?? 1; + shape.strokeWidth = datum.background.strokeWidth ?? 1; + shape.cornerRadius = 4; + const padding = datum.getPadding().top; + const isPositionTop = datum.position === "top"; + shape.x = bbox.x - padding; + shape.width = datum.width + padding * 2; + shape.height = bbox.height + padding * 2; + shape.y = bbox.y + (isPositionTop ? 0 : -bbox.height) - padding; + } + updateIcon(datum, context) { + const { active, iconBackground, iconLines } = this; + const { x, y } = convertPoint(datum, context); + iconBackground.translationX = x - ICON_WIDTH / 2; + iconBackground.translationY = y - ICON_HEIGHT; + iconLines.translationX = iconBackground.translationX; + iconLines.translationY = iconBackground.translationY; + iconBackground.fill = datum.fill; + iconBackground.fillOpacity = datum.fillOpacity ?? 1; + iconBackground.stroke = datum.stroke; + iconBackground.strokeOpacity = datum.strokeOpacity ?? 1; + iconBackground.strokeWidth = datum.strokeWidth ?? 1; + iconLines.fill = datum.stroke; + if (active) { + iconBackground.fillShadow.color = datum.fill ?? "rgba(0, 0, 0, 0.22)"; + } else { + iconBackground.fillShadow.color = "rgba(0, 0, 0, 0.22)"; + } + } + updateAnchor(datum, bbox, context) { + const padding = datum.getPadding().top; + const isPositionTop = datum.position === "top"; + const direction = isPositionTop ? 1 : -1; + return { + x: bbox.x + context.seriesRect.x + datum.width / 2, + y: bbox.y + context.seriesRect.y + direction * (bbox.height + padding), + position: isPositionTop ? "below" : "above" + }; + } + getLabelCoords(datum, bbox) { + const isPositionTop = datum.position === "top"; + const padding = datum.getPadding().top + calcLineHeight3(datum.fontSize, ANNOTATION_TEXT_LINE_HEIGHT) / 2; + return { x: bbox.x, y: bbox.y + (isPositionTop ? padding / 2 : 0) }; + } + getTextBaseline(datum) { + return datum.position === "top" ? "middle" : datum.position; + } + getHandleCoords(_datum, coords, _bbox) { + return { + x: coords.x, + y: coords.y + DivariantHandle.HANDLE_SIZE / 2 + 4 + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.fill, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } + toggleHovered(hovered, active, readOnly) { + super.toggleHovered(hovered, active, readOnly); + const visible = hovered || active && !readOnly; + this.label.visible = visible; + this.shape.visible = visible; + this.zIndex = visible ? ZIndexMap3.CHART_ANNOTATION_FOCUSED : ZIndexMap3.CHART_ANNOTATION; + } + toggleActive(active) { + super.toggleActive(active); + this.label.visible = active; + this.shape.visible = active; + this.active = active; + } + containsPoint(x, y) { + if (this.shape.visible && this.shape.containsPoint(x, y)) + return true; + if (this.iconBackground.containsPoint(x, y)) + return true; + return super.containsPoint(x, y); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/note/noteState.ts +var NoteStateMachine = class extends TextualPointStateMachine { + createDatum() { + return new NoteProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/note/noteConfig.ts +var noteConfig = { + type: "note" /* Note */, + datum: NoteProperties, + scene: NoteScene, + isDatum: NoteProperties.is, + translate: (node, datum, transition, context) => { + if (NoteProperties.is(datum) && NoteScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (NoteProperties.is(datum) && NoteProperties.is(copiedDatum) && NoteScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (NoteProperties.is(datum) && NoteScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new NoteStateMachine({ + ...ctx, + create: createDatum("note" /* Note */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/parallel-channel/parallelChannelScene.ts +import { _ModuleSupport as _ModuleSupport81 } from "ag-charts-community"; +var { Vec2: Vec217, Vec4: Vec413 } = _ModuleSupport81; +var ParallelChannelScene = class extends ChannelScene { + constructor() { + super(); + this.type = "parallel-channel"; + this.handles = { + topLeft: new DivariantHandle(), + topMiddle: new UnivariantHandle(), + topRight: new DivariantHandle(), + bottomLeft: new DivariantHandle(), + bottomMiddle: new UnivariantHandle(), + bottomRight: new DivariantHandle() + }; + this.middleLine = new CollidableLine(); + this.append([this.background, this.topLine, this.middleLine, this.bottomLine, ...Object.values(this.handles)]); + } + static is(value) { + return AnnotationScene.isCheck(value, "parallel-channel"); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, handles } = this; + if (activeHandle == null) + return; + const { offset } = handles[activeHandle].drag(target); + handles[activeHandle].toggleDragging(true); + if (activeHandle === "topMiddle" || activeHandle === "bottomMiddle") { + offset.x = 0; + } + let translateVectors = []; + let allowSnapping = snapping; + switch (activeHandle) { + case "topLeft": + case "bottomLeft": + translateVectors = ["topLeft", "bottomLeft"]; + break; + case "topMiddle": + translateVectors = ["topLeft", "topRight"]; + offset.y -= UnivariantHandle.HANDLE_SIZE / 2; + allowSnapping = false; + break; + case "topRight": + case "bottomRight": + translateVectors = ["topRight", "bottomRight"]; + break; + case "bottomMiddle": + translateVectors = ["bottomLeft", "bottomRight"]; + offset.y -= UnivariantHandle.HANDLE_SIZE / 2; + allowSnapping = false; + break; + } + const top = convertLine(datum, context); + const bottom = convertLine(datum.bottom, context); + if (!top || !bottom) + return; + const vectors = { + topLeft: Vec413.start(top), + topRight: Vec413.end(top), + bottomLeft: Vec413.start(bottom), + bottomRight: Vec413.end(bottom) + }; + const snap = { + vectors: { + topLeft: vectors.topRight, + bottomLeft: vectors.bottomRight, + topRight: vectors.topLeft, + bottomRight: vectors.bottomLeft + }, + angle: datum.snapToAngle + }; + const points = translate(vectors, offset, context, { + overflowContinuous: this.overflowContinuous, + translateVectors, + snap: allowSnapping ? snap : void 0 + }); + datum.start.x = points.topLeft.x; + datum.start.y = points.topLeft.y; + datum.end.x = points.topRight.x; + datum.end.y = points.topRight.y; + datum.height = points.topLeft.y - points.bottomLeft.y; + } + getTranslatePointsVectors(start, end) { + const { bottomLeft, topLeft } = this.handles; + const height = bottomLeft.getBBox().y - topLeft.getBBox().y; + const bottomStart = Vec217.add(start, Vec217.from(0, height)); + const bottomEnd = Vec217.add(end, Vec217.from(0, height)); + return { start, end, bottomStart, bottomEnd }; + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.middleLine.visible && this.middleLine.strokeWidth > 0 && this.middleLine.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.middleLine.visible && this.middleLine.strokeWidth > 0 && this.middleLine.containsPoint(x, y)) + return "line"; + return super.getNodeAtCoords(x, y); + } + updateLines(datum, top, bottom, context, naturalTop, naturalBottom) { + const { topLine, middleLine, bottomLine } = this; + const { lineDashOffset, stroke: stroke2, strokeOpacity, strokeWidth } = datum; + const lineDash = datum.getLineDash(); + const lineStyles = { + lineCap: datum.getLineCap(), + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth + }; + topLine.setProperties({ ...top, ...lineStyles }); + bottomLine.setProperties({ ...bottom, ...lineStyles }); + const middlePoints = this.extendLine( + { + x1: naturalTop.x1, + y1: naturalBottom.y1 + (naturalTop.y1 - naturalBottom.y1) / 2, + x2: naturalTop.x2, + y2: naturalBottom.y2 + (naturalTop.y2 - naturalBottom.y2) / 2 + }, + datum, + context + ); + middleLine.setProperties({ + ...middlePoints, + lineDash: datum.middle.lineDash ?? lineDash, + lineDashOffset: datum.middle.lineDashOffset ?? lineDashOffset, + stroke: datum.middle.stroke ?? stroke2, + strokeOpacity: datum.middle.strokeOpacity ?? strokeOpacity, + strokeWidth: datum.middle.strokeWidth ?? strokeWidth, + visible: datum.middle.visible ?? true + }); + } + updateHandles(datum, top, bottom) { + const { + handles: { topLeft, topMiddle, topRight, bottomLeft, bottomMiddle, bottomRight } + } = this; + const handleStyles = { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + topLeft.update({ ...handleStyles, ...Vec413.start(top) }); + topRight.update({ ...handleStyles, ...Vec413.end(top) }); + bottomLeft.update({ ...handleStyles, ...Vec413.start(bottom) }); + bottomRight.update({ ...handleStyles, ...Vec413.end(bottom) }); + topMiddle.update({ + ...handleStyles, + ...Vec217.sub(Vec413.center(top), Vec217.from(topMiddle.handle.width / 2, topMiddle.handle.height / 2)) + }); + bottomMiddle.update({ + ...handleStyles, + ...Vec217.sub(Vec413.center(bottom), Vec217.from(bottomMiddle.handle.width / 2, bottomMiddle.handle.height / 2)) + }); + } + updateText(datum, top, bottom) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateChannelText(true, top, bottom, datum.text, datum.strokeWidth, this.text, datum.text.label); + } + getBackgroundPoints(datum, top, bottom, bounds) { + const isFlippedX = top.x1 > top.x2; + const isFlippedY = top.y1 > top.y2; + const outOfBoundsStart = top.x1 !== bottom.x1 && top.y1 !== bottom.y1; + const outOfBoundsEnd = top.x2 !== bottom.x2 && top.y2 !== bottom.y2; + const points = Vec217.from(top); + if (datum.extendEnd && outOfBoundsEnd) { + points.push(Vec217.from(isFlippedX ? bounds.x1 : bounds.x2, isFlippedY ? bounds.y1 : bounds.y2)); + } + points.push(...Vec217.from(bottom).reverse()); + if (datum.extendStart && outOfBoundsStart) { + points.push(Vec217.from(isFlippedX ? bounds.x2 : bounds.x1, isFlippedY ? bounds.y2 : bounds.y1)); + } + return points; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/parallel-channel/parallelChannelState.ts +import { _ModuleSupport as _ModuleSupport82 } from "ag-charts-community"; +import { isNumber as isNumber4 } from "ag-charts-core"; +var { StateMachine: StateMachine10, StateMachineProperty: StateMachineProperty10, Debug: Debug10 } = _ModuleSupport82; +var ParallelChannelStateMachine = class extends StateMachine10 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = new ParallelChannelProperties(); + datum.set({ start: point, end: point, height: 0 }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ + topLeft: true, + topMiddle: false, + topRight: false, + bottomLeft: false, + bottomMiddle: false, + bottomRight: false + }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ + topRight: true + }); + ctx.update(); + }; + const actionHeightUpdate = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !isNumber4(startY) || !isNumber4(endY) || !isNumber4(pointY)) + return; + const height = endY - (pointY ?? 0); + const bottomStartY = startY - height; + node?.toggleHandles({ bottomLeft: true, bottomRight: true }); + if (!ctx.validatePoint({ x: datum.start.x, y: bottomStartY }, { overflowContinuous: true }) || !ctx.validatePoint({ x: datum.end.x, y: point.y }, { overflowContinuous: true })) { + return; + } + datum.set({ height }); + ctx.update(); + }; + const actionHeightFinish = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !isNumber4(startY) || !isNumber4(endY) || !isNumber4(pointY)) + return; + const height = endY - (pointY ?? 0); + const bottomStartY = startY - height; + node?.toggleHandles(true); + if (!ctx.validatePoint({ x: datum.start.x, y: bottomStartY }, { overflowContinuous: true }) || !ctx.validatePoint({ x: datum.end.x, y: point.y }, { overflowContinuous: true })) { + return; + } + datum.set({ height }); + ctx.recordAction(`Create ${"parallel-channel" /* ParallelChannel */} annotation`); + ctx.showAnnotationOptions(); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine10.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + drag: actionEndUpdate, + click: { + target: "height", + action: actionEndFinish + }, + dragEnd: { + target: "height", + action: actionEndFinish + }, + reset: { + target: StateMachine10.parent, + action: actionCancel + }, + cancel: { + target: StateMachine10.parent, + action: actionCancel + } + }, + height: { + hover: actionHeightUpdate, + click: { + target: StateMachine10.parent, + action: actionHeightFinish + }, + drag: { + target: StateMachine10.parent, + action: actionHeightFinish + }, + reset: { + target: StateMachine10.parent, + action: actionCancel + }, + cancel: { + target: StateMachine10.parent, + action: actionCancel + } + } + }); + this.debug = Debug10.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass([ + StateMachineProperty10() +], ParallelChannelStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty10() +], ParallelChannelStateMachine.prototype, "node", 2); +__decorateClass([ + StateMachineProperty10() +], ParallelChannelStateMachine.prototype, "snapping", 2); + +// packages/ag-charts-enterprise/src/features/annotations/parallel-channel/parallelChannelConfig.ts +var parallelChannelConfig = { + type: "parallel-channel" /* ParallelChannel */, + datum: ParallelChannelProperties, + scene: ParallelChannelScene, + isDatum: ParallelChannelProperties.is, + translate: (node, datum, transition, context) => { + if (ParallelChannelProperties.is(datum) && ParallelChannelScene.is(node)) { + node.translate(datum, transition, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (ParallelChannelProperties.is(datum) && ParallelChannelProperties.is(copiedDatum) && ParallelChannelScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ParallelChannelProperties.is(datum) && ParallelChannelScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ParallelChannelStateMachine({ + ...ctx, + create: createDatum("parallel-channel" /* ParallelChannel */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/text/textScene.ts +var TextScene = class extends TextualPointScene { + constructor() { + super(); + this.type = "text" /* Text */; + this.append([this.label, this.handle]); + } + static is(value) { + return AnnotationScene.isCheck(value, "text" /* Text */); + } + getHandleCoords(_datum, point) { + const halfSize = DivariantHandle.HANDLE_SIZE / 2; + return { + x: point.x + halfSize, + y: point.y + 2 + halfSize + }; + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/text/textState.ts +var TextStateMachine = class extends TextualPointStateMachine { + createDatum() { + return new TextProperties(); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/text/textConfig.ts +var textConfig = { + type: "text" /* Text */, + datum: TextProperties, + scene: TextScene, + isDatum: TextProperties.is, + translate: (node, datum, transition, context) => { + if (TextProperties.is(datum) && TextScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (TextProperties.is(datum) && TextProperties.is(copiedDatum) && TextScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (TextProperties.is(datum) && TextScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new TextStateMachine({ + ...ctx, + create: createDatum("text" /* Text */) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotationsConfig.ts +var annotationConfigs = { + // Lines + [lineConfig.type]: lineConfig, + [horizontalLineConfig.type]: horizontalLineConfig, + [verticalLineConfig.type]: verticalLineConfig, + // Channels + [parallelChannelConfig.type]: parallelChannelConfig, + [disjointChannelConfig.type]: disjointChannelConfig, + // Fibonaccis + [fibonacciRetracementConfig.type]: fibonacciRetracementConfig, + [fibonacciRetracementTrendBasedConfig.type]: fibonacciRetracementTrendBasedConfig, + // Texts + [calloutConfig.type]: calloutConfig, + [commentConfig.type]: commentConfig, + [noteConfig.type]: noteConfig, + [textConfig.type]: textConfig, + // Shapes + [arrowConfig.type]: arrowConfig, + [arrowUpConfig.type]: arrowUpConfig, + [arrowDownConfig.type]: arrowDownConfig, + // Measurers + [dateRangeConfig.type]: dateRangeConfig, + [priceRangeConfig.type]: priceRangeConfig, + [datePriceRangeConfig.type]: datePriceRangeConfig, + [quickDatePriceRangeConfig.type]: quickDatePriceRangeConfig +}; +function getTypedDatum(datum) { + for (const { isDatum } of Object.values(annotationConfigs)) { + if (isDatum(datum)) { + return datum; + } + } +} + +// packages/ag-charts-enterprise/src/features/annotations/annotationsStateMachine.ts +import { _ModuleSupport as _ModuleSupport83 } from "ag-charts-community"; +var { ActionOnSet, ParallelStateMachine, StateMachine: StateMachine11, StateMachineProperty: StateMachineProperty11, Debug: Debug11 } = _ModuleSupport83; +var AnnotationsStateMachine = class extends ParallelStateMachine { + constructor(ctx) { + super( + new SnappingStateMachine((snapping) => { + this.snapping = snapping; + }), + new UpdateMachine(() => { + this.node = this.active == null ? void 0 : ctx.node(this.active); + }), + new AnnotationsMainStateMachine(ctx, (index) => { + this.active = index; + this.datum = this.active == null ? void 0 : ctx.datum(this.active); + this.node = this.active == null ? void 0 : ctx.node(this.active); + }) + ); + this.snapping = false; + } + // TODO: remove this leak + getActive() { + return this.active; + } + // TODO: remove this leak + isActive(index) { + return index === this.active; + } +}; +__decorateClass([ + StateMachineProperty11() +], AnnotationsStateMachine.prototype, "snapping", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsStateMachine.prototype, "node", 2); +var SnappingStateMachine = class extends StateMachine11 { + constructor(setSnapping) { + super("idle" /* Idle */, { + ["idle" /* Idle */]: { + hover: ({ shiftKey }) => setSnapping(shiftKey), + keyDown: ({ shiftKey }) => setSnapping(shiftKey), + keyUp: ({ shiftKey }) => setSnapping(shiftKey), + click: ({ shiftKey }) => setSnapping(shiftKey), + drag: ({ shiftKey }) => setSnapping(shiftKey) + }, + ["dragging" /* Dragging */]: {}, + ["translating" /* Translating */]: {}, + ["text-input" /* TextInput */]: {} + }); + } +}; +var UpdateMachine = class extends StateMachine11 { + constructor(update) { + super("idle" /* Idle */, { + ["idle" /* Idle */]: { + onEnter: update, + render: update + }, + ["dragging" /* Dragging */]: { + onEnter: update, + render: update + }, + ["translating" /* Translating */]: { + onEnter: update, + render: update + }, + ["text-input" /* TextInput */]: { + render: update + } + }); + } +}; +var AnnotationsMainStateMachine = class extends StateMachine11 { + constructor(ctx, setActive) { + const createDatum = (type) => (datum) => { + ctx.create(type, datum); + this.active = ctx.selectLast(); + }; + const deleteDatum = () => { + if (this.active != null) + ctx.delete(this.active); + this.active = void 0; + ctx.select(); + }; + const stateMachineHelpers = { + createDatum + }; + const createStateMachineContext = { + ...ctx, + delete: deleteDatum, + showTextInput: () => { + if (this.active != null) + ctx.showTextInput(this.active); + }, + deselect: () => { + const prevActive = this.active; + this.active = void 0; + this.hovered = void 0; + ctx.select(this.active, prevActive); + }, + showAnnotationOptions: () => { + if (this.active != null) + ctx.showAnnotationOptions(this.active); + } + }; + const createStateMachines = Object.fromEntries( + Object.entries(annotationConfigs).map(([type, config]) => [ + type, + config.createState(createStateMachineContext, stateMachineHelpers) + ]) + ); + const dragStateMachines = Object.fromEntries( + Object.entries(annotationConfigs).map(([type, config]) => [ + type, + config.dragState(ctx, stateMachineHelpers) + ]) + ); + const actionColor = ({ + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }) => { + if (!this.datum) + return; + if (colorPickerType === "text-color") { + ctx.updateTextInputColor(color6); + } + setColor(this.datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + ctx.update(); + }; + const actionFontSize = (fontSize) => { + const { datum, node } = this; + if (!datum || !node) + return; + if (isTextType(datum)) { + datum.fontSize = fontSize; + ctx.updateTextInputFontSize(fontSize); + } else if (hasLineText(datum)) { + datum.text.fontSize = fontSize; + } + ctx.update(); + }; + const actionLineStyle = (lineStyle) => { + const { datum, node } = this; + if (!datum || !node || !hasLineStyle(datum)) + return; + setLineStyle(datum, lineStyle); + ctx.update(); + }; + const actionUpdateTextInputBBox = (bbox) => { + const { node } = this; + if (!node || !("setTextInputBBox" in node)) + return; + node.setTextInputBBox(bbox); + ctx.update(); + }; + const actionSaveText = ({ textInputValue, bbox }) => { + const { datum } = this; + if (bbox != null && textInputValue != null && textInputValue.length > 0) { + if (!isTextType(datum)) { + return; + } + const wrappedText = maybeWrapText(datum, textInputValue, bbox.width); + datum.set({ text: wrappedText }); + ctx.update(); + ctx.recordAction(`Change ${datum.type} annotation text`); + } else { + ctx.delete(this.active); + ctx.recordAction(`Delete ${datum?.type} annotation`); + } + }; + const actionCancel = () => { + ctx.updateTextInputBBox(void 0); + }; + const guardActive = () => this.active != null; + const guardCopied = () => this.copied != null; + const guardActiveHasLineText = () => { + const { active, datum } = this; + if (active == null) + return false; + if (!datum) + return false; + return hasLineText(datum) && datum.isWriteable(); + }; + const guardActiveNotEphemeral = () => this.active != null && !isEphemeralType(this.datum); + const guardHovered = () => this.hovered != null; + super("idle" /* Idle */, { + ["idle" /* Idle */]: { + onEnter: () => { + ctx.select(this.active, this.active); + if (this.hoverCoords) { + this.hovered = ctx.hoverAtCoords(this.hoverCoords, this.active, this.hovered); + } + }, + hover: ({ offset }) => { + this.hovered = ctx.hoverAtCoords(offset, this.active, this.hovered); + this.hoverCoords = offset; + }, + translate: { + guard: guardActive, + target: "translating" /* Translating */, + action: ({ translation }) => { + ctx.startInteracting(); + ctx.translate(this.active, translation); + ctx.update(); + } + }, + copy: { + guard: guardActiveNotEphemeral, + action: () => { + this.copied = ctx.copy(this.active); + } + }, + cut: { + guard: guardActiveNotEphemeral, + action: () => { + this.copied = ctx.copy(this.active); + deleteDatum(); + } + }, + paste: { + guard: guardCopied, + action: () => { + ctx.paste(this.copied); + } + }, + selectLast: () => { + const previousActive = this.active; + this.active = ctx.selectLast(); + ctx.select(this.active, previousActive); + }, + click: [ + { + guard: () => { + const { active, hovered, datum } = this; + if (active == null || hovered !== active) + return false; + if (!datum) + return false; + return isTextType(datum) && datum.isWriteable(); + }, + target: "text-input" /* TextInput */ + }, + { + action: () => { + const prevActive = this.active; + this.active = this.hovered; + ctx.select(this.active, prevActive); + } + } + ], + dblclick: { + guard: guardActiveHasLineText, + action: ({ offset }) => { + const nodeAtCoords = ctx.getNodeAtCoords(offset, this.active) === "text" ? "text" : "line"; + ctx.showAnnotationSettings(this.active, void 0, nodeAtCoords); + } + }, + dragStart: [ + { + guard: guardHovered, + target: "dragging" /* Dragging */, + action: () => { + const prevActive = this.active; + this.active = this.hovered; + ctx.select(this.active, prevActive); + ctx.startInteracting(); + } + }, + { + action: () => { + const prevActive = this.active; + this.active = this.hovered; + ctx.select(this.active, prevActive); + } + } + ], + color: { + guard: guardActive, + action: actionColor + }, + fontSize: { + guard: guardActive, + action: actionFontSize + }, + lineProps: { + guard: guardActive, + action: (props) => { + const datum = getTypedDatum(this.datum); + datum?.set(props); + ctx.update(); + ctx.recordAction( + `Change ${datum?.type} ${Object.entries(props).map(([key, value]) => `${key} to ${value}`).join(", ")}` + ); + } + }, + lineStyle: { + guard: guardActive, + action: actionLineStyle + }, + lineText: { + guard: guardActive, + action: (props) => { + const datum = getTypedDatum(this.datum); + if (!hasLineText(datum)) + return; + if (isChannelType(datum) && props.position === "center") { + props.position = "inside"; + } + datum.text.set(props); + ctx.update(); + } + }, + updateTextInputBBox: { + guard: guardActive, + action: actionUpdateTextInputBBox + }, + toolbarPressSettings: { + guard: guardActiveHasLineText, + action: (sourceEvent) => { + ctx.showAnnotationSettings(this.active, sourceEvent); + } + }, + reset: () => { + if (this.active != null) { + this.node?.toggleActive(false); + } + this.hovered = void 0; + this.active = void 0; + ctx.select(this.active, this.active); + ctx.resetToIdle(); + }, + delete: () => { + if (this.active == null) + return; + ctx.delete(this.active); + if (isEphemeralType(this.datum)) + return; + ctx.recordAction(`Delete ${this.datum?.type} annotation`); + }, + deleteAll: () => { + ctx.deleteAll(); + }, + ...createStateMachines + }, + ["dragging" /* Dragging */]: { + onEnter: (_, data) => { + if (this.active == null) + return; + const type = ctx.getAnnotationType(this.active); + if (!type) + return; + this.transitionRoot(type); + this.transitionRoot("dragStart", data); + }, + ...dragStateMachines + }, + ["translating" /* Translating */]: { + onEnter: () => { + }, + translate: { + guard: guardActive, + target: "translating" /* Translating */, + action: ({ translation }) => { + ctx.startInteracting(); + ctx.translate(this.active, translation); + ctx.update(); + } + }, + translateEnd: { + guard: guardActive, + target: "idle" /* Idle */ + }, + onExit: () => { + ctx.stopInteracting(); + ctx.update(); + ctx.recordAction("Translate annotation"); + } + }, + ["text-input" /* TextInput */]: { + onEnter: () => { + if (this.active == null) + return; + const datum = getTypedDatum(this.datum); + if (!datum || !("getTextInputCoords" in datum)) + return; + ctx.startInteracting(); + ctx.showTextInput(this.active); + datum.visible = false; + ctx.update(); + }, + updateTextInputBBox: { + guard: guardActive, + action: actionUpdateTextInputBBox + }, + resize: { + target: "idle" /* Idle */, + action: actionSaveText + }, + click: { + target: "idle" /* Idle */, + action: actionSaveText + }, + drag: { + target: "idle" /* Idle */, + action: actionSaveText + }, + textInput: [ + { + guard: guardCancelAndExit, + target: "idle" /* Idle */, + action: actionCancel + }, + { + guard: guardSaveAndExit, + target: "idle" /* Idle */, + action: actionSaveText + } + ], + color: { + guard: guardActive, + action: actionColor + }, + fontSize: { + guard: guardActive, + action: actionFontSize + }, + cancel: { + target: "idle" /* Idle */, + action: actionCancel + }, + onExit: () => { + ctx.stopInteracting(); + ctx.hideTextInput(); + const wasActive = this.active; + this.active = this.hovered = void 0; + ctx.select(this.active, wasActive); + if (wasActive == null) + return; + const datum = ctx.datum(wasActive); + const node = ctx.node(wasActive); + if (!datum || !node) + return; + datum.visible = true; + } + } + }); + this.setActive = setActive; + this.debug = Debug11.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass([ + ActionOnSet({ + changeValue(newValue) { + this.setActive(newValue); + } + }), + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "active", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "hovered", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "hoverCoords", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "copied", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "snapping", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "datum", 2); +__decorateClass([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "node", 2); + +// packages/ag-charts-enterprise/src/features/annotations/annotationsToolbar.ts +import { _ModuleSupport as _ModuleSupport84 } from "ag-charts-community"; +import { CleanupRegistry as CleanupRegistry2, EventEmitter as EventEmitter2 } from "ag-charts-core"; +var { ActionOnSet: ActionOnSet2, LayoutElement, Menu: Menu2, PropertiesArray: PropertiesArray2, ToolbarButtonProperties: ToolbarButtonProperties2, Property: Property31, ChartAxisDirection: ChartAxisDirection7 } = _ModuleSupport84; +var AnnotationsToolbarButtonProperties = class extends ToolbarButtonProperties2 { +}; +__decorateClass([ + Property31 +], AnnotationsToolbarButtonProperties.prototype, "value", 2); +var AnnotationsToolbar = class extends _ModuleSupport84.BaseProperties { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + this.padding = 20; + this.buttons = new PropertiesArray2(AnnotationsToolbarButtonProperties); + this.events = new EventEmitter2(); + this.annotationMenu = new Menu2(this.ctx, "annotations"); + this.cleanup = new CleanupRegistry2(); + this.toolbar = ctx.sharedToolbar.getSharedToolbar("annotations"); + const onKeyDown = this.onKeyDown.bind(this); + this.toolbar.addListener("keydown", onKeyDown); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onToolbarButtonPress.bind(this)), + ctx.layoutManager.registerElement(LayoutElement.ToolbarLeft, this.onLayoutStart.bind(this)), + () => { + this.toolbar.removeListener("keydown", onKeyDown); + this.toolbar.destroy(); + } + ); + } + destroy() { + this.cleanup.flush(); + } + toggleClearButtonEnabled(enabled) { + const index = this.buttons.findIndex((button) => button.value === "clear"); + this.toolbar.toggleButtonEnabledByIndex(index, enabled); + } + resetButtonIcons() { + for (const [index, button] of this.buttons.entries()) { + switch (button.value) { + case "line-menu": + this.updateButtonByIndex(index, { icon: "trend-line-drawing", value: "line-menu" }); + break; + case "fibonacci-menu": + this.updateButtonByIndex(index, { icon: "fibonacci-retracement-drawing", value: "fibonacci-menu" }); + break; + case "text-menu": + this.updateButtonByIndex(index, { icon: "text-annotation", value: "text-menu" }); + break; + case "shape-menu": + this.updateButtonByIndex(index, { icon: "arrow-drawing", value: "shape-menu" }); + break; + case "measurer-menu": + this.updateButtonByIndex(index, { icon: "measurer-drawing", value: "measurer-menu" }); + break; + } + } + } + hideOverlays() { + this.annotationMenu.hide(); + } + clearActiveButton() { + this.toolbar.clearActiveButton(); + } + onLayoutStart(event) { + if (!this.enabled) + return; + this.toolbar.updateButtons(this.buttons); + this.toolbar.layout(event.layoutBox, this.padding); + } + refreshButtonsEnabled(enabled) { + for (const [index, button] of this.buttons.entries()) { + if (!button) + continue; + this.toolbar.toggleButtonEnabledByIndex(index, enabled); + } + } + onToolbarButtonPress({ + event, + button, + buttonBounds, + buttonWidget + }) { + const axisScale = this.ctx.axisManager.getAxisContext(ChartAxisDirection7.Y)[0].scale; + switch (button.value) { + case "clear": + this.events.emit("pressed-clear", null); + break; + case "line-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsLineAnnotations", + LINE_ANNOTATION_ITEMS.filter((item) => item.visible ? item.visible(axisScale) : true) + ); + break; + case "fibonacci-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsFibonacciAnnotations", + FIBONACCI_ANNOTATION_ITEMS + ); + break; + case "text-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsTextAnnotations", + TEXT_ANNOTATION_ITEMS + ); + break; + case "shape-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsShapeAnnotations", + SHAPE_ANNOTATION_ITEMS + ); + break; + case "measurer-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsMeasurerAnnotations", + MEASURER_ANNOTATION_ITEMS + ); + break; + } + } + onToolbarButtonPressShowMenu(event, buttonBounds, controller, menu, ariaLabel, items) { + this.events.emit("pressed-show-menu", null); + const index = this.buttons.findIndex((button) => button.value === menu); + this.toolbar.toggleActiveButtonByIndex(index); + this.annotationMenu.setAnchor({ x: buttonBounds.x + buttonBounds.width + 6, y: buttonBounds.y }); + this.annotationMenu.show(controller, { + items, + ariaLabel: this.ctx.localeManager.t(ariaLabel), + class: "ag-charts-annotations__toolbar-menu", + sourceEvent: event.sourceEvent, + onPress: this.onButtonPressMenuCreateAnnotation.bind(this, menu) + }); + } + onButtonPressMenuCreateAnnotation(menu, item) { + const index = this.buttons.findIndex((button) => button.value === menu); + this.updateButtonByIndex(index, { icon: item.icon }); + this.events.emit("pressed-create-annotation", { annotation: item.value }); + this.annotationMenu.hide(); + } + onKeyDown({ sourceEvent }) { + if (sourceEvent.key === "Escape") { + this.events.emit("cancel-create-annotation", null); + } + } + updateButtonByIndex(index, change) { + const button = this.buttons.at(index); + if (!button) + return; + button.set({ ...button.toJson(), ...change, value: change.value ?? button.value }); + this.toolbar.updateButtonByIndex(index, { ...button.toJson() }); + } +}; +__decorateClass([ + Property31, + ActionOnSet2({ + changeValue(enabled) { + this.toolbar?.setHidden(!enabled); + } + }) +], AnnotationsToolbar.prototype, "enabled", 2); +__decorateClass([ + Property31 +], AnnotationsToolbar.prototype, "padding", 2); +__decorateClass([ + Property31 +], AnnotationsToolbar.prototype, "buttons", 2); + +// packages/ag-charts-enterprise/src/features/annotations/axisButton.ts +import { _ModuleSupport as _ModuleSupport85, _Widget as _Widget2 } from "ag-charts-community"; +var { BaseModuleInstance, InteractionState, Property: Property32, ChartAxisDirection: ChartAxisDirection8, getIconClassNames } = _ModuleSupport85; +var DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS = `ag-charts-annotations__axis-button`; +var AxisButton = class extends BaseModuleInstance { + constructor(ctx, axisCtx, onButtonClick, seriesRect) { + super(); + this.ctx = ctx; + this.axisCtx = axisCtx; + this.onButtonClick = onButtonClick; + this.seriesRect = seriesRect; + this.enabled = true; + this.snap = false; + this.padding = 0; + this.button = this.setup(); + this.toggleVisibility(false); + this.updateButtonElement(); + this.snap = Boolean(axisCtx.scale.bandwidth); + ctx.domManager.addEventListener("focusin", ({ target }) => { + const htmlTarget = target instanceof HTMLElement ? target : void 0; + const isSeriesAreaChild = htmlTarget && ctx.domManager.contains(htmlTarget, "series-area"); + if (!isSeriesAreaChild && htmlTarget !== this.button.getElement()) + this.hide(); + }); + this.cleanup.register( + ctx.widgets.seriesWidget.addListener("drag-move", (e) => this.onMouseDrag(e)), + ctx.widgets.seriesWidget.addListener("mousemove", (e) => this.onMouseMove(e)), + ctx.widgets.seriesWidget.addListener("mouseleave", () => this.onMouseLeave()), + ctx.widgets.seriesDragInterpreter?.events.on("click", (e) => this.onClick(e)), + ctx.eventsHub.on("series:focus-change", () => this.onKeyPress()), + ctx.eventsHub.on("zoom:pan-start", () => this.hide()), + ctx.eventsHub.on("zoom:change", () => this.hide()), + () => this.destroyElements(), + () => this.button.destroy() + ); + } + update(seriesRect, padding) { + this.seriesRect = seriesRect; + this.padding = padding; + } + setup() { + const button = new _Widget2.ButtonWidget(); + button.addClass(DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS); + button.setTabIndex(-1); + button.setAriaLabel(this.ctx.localeManager.t("ariaLabelAddHorizontalLine")); + this.ctx.widgets.seriesWidget.getElement().appendChild(button.getElement()); + return button; + } + destroyElements() { + this.ctx.domManager.removeChild("canvas-overlay", DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS); + } + onMouseMove(e) { + if (this.ctx.interactionManager.isState(InteractionState.Clickable)) + this.show(e); + } + onMouseDrag(e) { + if (this.ctx.interactionManager.isState(InteractionState.AnnotationsMoveable)) + this.show(e); + } + onMouseLeave() { + if (this.ctx.interactionManager.isState(InteractionState.Clickable)) + this.hide(); + } + onClick(e) { + if (this.ctx.interactionManager.isState(InteractionState.Clickable) && e.device === "touch") + this.show(e); + } + show(event) { + const { sourceEvent, currentX: x, currentY: y } = event; + if (!(this.enabled && this.ctx.widgets.seriesWidget.getElement().contains(sourceEvent.target))) { + this.hide(); + return; + } + this.toggleVisibility(true); + const buttonCoords = this.getButtonCoordinates({ x, y }); + this.coords = { + x: buttonCoords.x + this.button.clientWidth / 2, + y: buttonCoords.y + this.button.clientHeight / 2 + }; + this.updatePosition(buttonCoords); + } + hide() { + this.toggleVisibility(false); + } + onKeyPress() { + if (this.snap && this.ctx.interactionManager.isState(InteractionState.Default)) + return; + this.hide(); + } + getButtonCoordinates({ x, y }) { + const { + axisCtx: { direction, position }, + seriesRect, + snap, + axisCtx, + padding + } = this; + const { clientWidth: buttonWidth, clientHeight: buttonHeight } = this.button; + const [minY, maxY] = [0, seriesRect.height]; + const [minX, maxX] = [0, seriesRect.width]; + if (snap) { + x = convert(invert(x - seriesRect.x, axisCtx), axisCtx) + seriesRect.x; + y = convert(invert(y - seriesRect.y, axisCtx), axisCtx) + seriesRect.y; + } + if (direction === ChartAxisDirection8.X) { + const crosshairLabelPadding = 5; + const offset = buttonHeight - Math.max(0, padding - crosshairLabelPadding); + x = x - buttonWidth / 2; + y = position === "top" ? minY - buttonHeight + offset : maxY - offset; + } else { + const crosshairLabelPadding = 9; + const offset = buttonWidth - Math.max(0, padding - crosshairLabelPadding); + x = position === "left" ? minX - buttonWidth + offset : maxX - offset; + y = y - buttonHeight / 2; + } + return { x, y }; + } + toggleVisibility(visible) { + const { button } = this; + if (button == null) + return; + const isVisible = this.enabled && visible; + this.toggleClass("-hidden", !isVisible); + } + toggleClass(name, include) { + this.button.toggleClass(`${DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS}-${name}`, include); + } + updatePosition({ x, y }) { + this.button.getElement().style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`; + } + updateButtonElement() { + const { button } = this; + button.addListener("click", () => this.onButtonClick(this.coords)); + button.addListener("touchend", () => this.onButtonClick(this.coords)); + button.addListener("drag-start", () => { + }); + button.setInnerHTML( + `` + ); + } +}; +__decorateClass([ + Property32 +], AxisButton.prototype, "enabled", 2); + +// packages/ag-charts-enterprise/src/features/annotations/settings-dialog/settingsDialog.ts +import { _ModuleSupport as _ModuleSupport87 } from "ag-charts-community"; +import { EventEmitter as EventEmitter3 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/components/dialog/dialog.ts +import { _ModuleSupport as _ModuleSupport86 } from "ag-charts-community"; +import { + createElement as createElement2, + createElementId, + entries as entries5, + getWindow as getWindow2, + setAttribute, + setAttributes as setAttributes2 +} from "ag-charts-core"; +var { + Color: Color5, + DraggablePopover, + NativeWidget, + Vec2: Vec218, + createButton, + createCheckbox, + createSelect, + createTextArea, + initRovingTabIndex, + getIconClassNames: getIconClassNames2, + mapValues +} = _ModuleSupport86; +var _Dialog = class _Dialog extends DraggablePopover { + constructor(ctx, id) { + super(ctx, id); + this.dragHandleDraggingClass = "ag-charts-dialog__drag-handle--dragging"; + this.colorPicker = new ColorPicker(this.ctx, { detached: true }); + this.cleanup.register(ctx.eventsHub.on("layout:complete", this.onLayoutComplete.bind(this))); + } + showWithChildren(children, options) { + const popover = super.showWithChildren(children, options); + popover.classList.add("ag-charts-dialog"); + popover.setAttribute("role", "dialog"); + popover.addEventListener("mousedown", (event) => { + if (event.target.classList?.contains("ag-charts-dialog__color-picker-button")) + return; + this.colorPicker.hide(); + }); + popover.addEventListener("keydown", this.onKeyDown.bind(this)); + getWindow2().requestAnimationFrame(() => this.reposition()); + this.colorPicker.attachTo(this); + return popover; + } + updatePosition(position) { + super.updatePosition(position); + const { anchor, fallbackAnchor } = this.getColorPickerAnchors() ?? {}; + if (!anchor) + return; + this.colorPicker.setAnchor(anchor, fallbackAnchor); + } + /************** + * Containers * + **************/ + createTabs(tablistLabel, initial, tabs) { + const element = createElement2("div", "ag-charts-dialog__tabs"); + const tabButtonIds = mapValues(tabs, () => createElementId()); + const tabPanelIds = mapValues(tabs, () => createElementId()); + for (const [key, tab] of entries5(tabs)) { + setAttributes2(tab.panel, { + id: tabPanelIds[key], + role: "tabpanel", + "aria-labelledby": tabButtonIds[key] + }); + } + const onPressTab = (active) => { + for (const [key, tab] of entries5(tabs)) { + tab.panel.classList.toggle("ag-charts-dialog__tab-panel--active", key === active); + tabButtons[key].classList.toggle("ag-charts-dialog__tab-button--active", key === active); + setAttribute(tabButtons[key], "aria-selected", key === active); + if (key === active) + tab.onShow?.(); + } + }; + const header = new NativeWidget(createElement2("div", "ag-charts-dialog__header")); + header.addListener("drag-start", (event) => { + const { sourceEvent } = event; + if (sourceEvent.target instanceof Element && sourceEvent.target.classList.contains("ag-charts-dialog__header")) { + this.onDragStart(event); + } + }); + header.addListener("drag-move", (event) => this.onDragMove(event)); + header.addListener("drag-end", () => this.onDragEnd()); + const dragHandle = new DragHandleWidget(); + this.setDragHandle(dragHandle); + const tabButtons = mapValues( + tabs, + (tab, key) => createButton( + { + label: this.ctx.localeManager.t(tab.label), + onPress: () => onPressTab(key) + }, + { + id: tabButtonIds[key], + class: "ag-charts-dialog__tab-button", + role: "tab", + "aria-controls": tabPanelIds[key] + } + ) + ); + const tabList = createElement2("div", "ag-charts-dialog__tab-list"); + setAttributes2(tabList, { role: "tablist", "aria-label": this.ctx.localeManager.t(tablistLabel) }); + tabList.append(...Object.values(tabButtons)); + const closeButton = this.createHeaderCloseButton(); + header.getElement().append(dragHandle.getElement(), tabList, closeButton); + element.append(header.getElement(), ...Object.values(tabs).map((t) => t.panel)); + onPressTab(initial); + initRovingTabIndex({ orientation: "horizontal", buttons: Object.values(tabButtons) }); + return { tabs: element, initialFocus: tabButtons[initial] }; + } + createTabPanel() { + return createElement2("div", "ag-charts-dialog__tab-panel"); + } + /********** + * Inputs * + **********/ + createInputGroupLine() { + return createElement2("div", "ag-charts-dialog__input-group-line"); + } + createRadioGroup({ label, options, value, onChange }) { + const group = this.createInputGroup(label); + setAttributes2(group, { + role: "radiogroup", + tabindex: -1, + "aria-label": this.ctx.localeManager.t(label) + }); + const activeClass = "ag-charts-dialog__button--active"; + const buttons2 = []; + for (const button of options) { + const { icon, altText: altTextKey } = button; + const altText = this.ctx.localeManager.t(altTextKey); + const buttonEl = createButton( + { + icon, + altText, + onPress: () => { + for (const b of Array.from(group.children)) { + b.classList.remove(activeClass); + b.ariaChecked = "false"; + } + buttonEl.classList.add(activeClass); + buttonEl.ariaChecked = "true"; + onChange(button.value); + } + }, + { + "aria-checked": button.value === value, + class: "ag-charts-dialog__button", + role: "radio", + title: altText + } + ); + if (button.value === value) { + buttonEl.classList.add(activeClass); + } + group.appendChild(buttonEl); + buttons2.push(buttonEl); + } + initRovingTabIndex({ orientation: "horizontal", buttons: buttons2 }); + return group; + } + createSelect({ altText, label, options, value, onChange }) { + const group = this.createInputGroup(label); + const altTextT = this.ctx.localeManager.t(altText); + const select = createSelect( + { value, options, onChange }, + { class: "ag-charts-dialog__select", "aria-label": altTextT, title: altTextT } + ); + group.append(select); + return group; + } + createTextArea({ placeholder, value, onChange }) { + const placeholderT = placeholder ? this.ctx.localeManager.t(placeholder) : void 0; + return createTextArea({ value, onChange }, { placeholder: placeholderT }); + } + createCheckbox({ label, checked, onChange }) { + const id = createElementId(); + const group = this.createInputGroup(label, { for: id }); + const checkbox = createCheckbox( + { checked, onChange }, + { class: "ag-charts-dialog__checkbox", role: "switch", id } + ); + group.append(checkbox); + return group; + } + createColorPicker({ + color: color6, + opacity, + label, + altText, + onChange, + onChangeHide, + isMultiColor, + hasMultiColorOption + }) { + const group = this.createInputGroup(label); + const altTextT = this.ctx.localeManager.t(altText); + const colorEl = createButton( + { + label: altTextT, + onPress: (event) => { + const { anchor, fallbackAnchor } = this.getColorPickerAnchors(colorEl) ?? {}; + this.colorPicker.show({ + anchor, + fallbackAnchor, + color: color6, + opacity, + isMultiColor, + hasMultiColorOption, + sourceEvent: event, + onChange: (newColorOpacity, newColor, newOpacity, newIsMultiColor) => { + colorEl.style.setProperty("--color", newColorOpacity); + colorEl.classList.toggle( + "ag-charts-dialog__color-picker-button--multi-color", + newIsMultiColor + ); + onChange(newColorOpacity, newColor, newOpacity, newIsMultiColor); + }, + onChangeHide + }); + } + }, + { + "aria-label": altTextT, + tabindex: 0, + class: "ag-charts-dialog__color-picker-button", + title: altTextT + } + ); + if (isMultiColor) { + colorEl.classList.toggle("ag-charts-dialog__color-picker-button--multi-color"); + } else if (color6) { + const hex = Color5.fromString(color6); + const hexWithOpacity = new Color5(hex.r, hex.g, hex.b, opacity); + colorEl.style.setProperty("--color", hexWithOpacity.toHexString()); + } + group.append(colorEl); + this.hideFns.push(() => { + this.colorPicker.hide(); + }); + return group; + } + /*********** + * Private * + ***********/ + createHeaderCloseButton() { + return createButton( + { icon: "close", altText: this.ctx.localeManager.t("iconAltTextClose"), onPress: () => this.hide() }, + { class: "ag-charts-dialog__close-button" } + ); + } + createInputGroup(label, options) { + const group = createElement2("div", "ag-charts-dialog__input-group"); + const labelEl = createElement2("label", "ag-charts-dialog__input-group-label"); + labelEl.innerText = this.ctx.localeManager.t(label); + setAttribute(labelEl, "for", options?.for); + group.appendChild(labelEl); + return group; + } + onLayoutComplete(event) { + this.seriesRect = event.series.paddedRect; + this.reposition(); + } + onKeyDown(event) { + if (event.altKey || event.ctrlKey || event.metaKey || event.isComposing || event.key !== "Escape") + return; + this.hide(); + } + reposition() { + const { seriesRect, ctx } = this; + const clientRect = ctx.domManager.getBoundingClientRect(); + const popover = this.getPopoverElement(); + if (!seriesRect || !popover) + return; + const outerOffset = Vec218.from(0, seriesRect.y); + const outerSize = Vec218.from(clientRect.width, seriesRect.height); + const popoverSize = Vec218.from(popover); + const halfWidth = Vec218.from(0.5, 1); + let position; + if (seriesRect.width > 1e3) { + const bottomCenter = Vec218.sub( + Vec218.add(outerOffset, Vec218.multiply(outerSize, halfWidth)), + Vec218.multiply(popoverSize, halfWidth) + ); + position = Vec218.sub(bottomCenter, Vec218.from(0, _Dialog.offset)); + } else { + const bottomRight = Vec218.sub(Vec218.add(outerOffset, outerSize), popoverSize); + position = Vec218.sub(bottomRight, _Dialog.offset); + } + this.updatePosition(position); + } + getColorPickerAnchors(element) { + if (element) + this.colorPickerAnchorElement = element; + if (!this.colorPickerAnchorElement) + return; + const rect = this.colorPickerAnchorElement.getBoundingClientRect(); + const canvasRect = this.ctx.domManager.getBoundingClientRect(); + const topLeft = Vec218.sub(Vec218.from(rect.x, rect.y), Vec218.from(canvasRect.left, canvasRect.top)); + const anchor = Vec218.add(topLeft, Vec218.from(0, rect.height + 5)); + const fallbackAnchor = Vec218.sub(topLeft, Vec218.from(0, 5)); + return { anchor, fallbackAnchor }; + } +}; +_Dialog.offset = 60; +var Dialog = _Dialog; +var DragHandleWidget = class extends NativeWidget { + constructor() { + super(createElement2("div", "ag-charts-dialog__drag-handle")); + const icon = new NativeWidget(createElement2("span", getIconClassNames2("drag-handle"))); + icon.setAriaHidden(true); + this.addChild(icon); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/settings-dialog/settingsDialog.ts +var { focusCursorAtEnd: focusCursorAtEnd2 } = _ModuleSupport87; +var AnnotationSettingsDialog = class extends Dialog { + constructor(ctx) { + super(ctx, "settings"); + this.events = new EventEmitter3(); + this.hideFns.push(() => this.events.emit("hidden", null)); + } + show(datum, options) { + const lineTab = this.createLinearLineTab(datum, options); + const textTab = this.createLinearTextTab(datum, options); + let lineLabel = "dialogHeaderLine"; + if (isChannelType(datum)) { + lineLabel = "dialogHeaderChannel"; + } else if (isFibonacciType(datum)) { + lineLabel = "dialogHeaderFibonacciRange"; + } else if (datum.type === "date-range" /* DateRange */) { + lineLabel = "dialogHeaderDateRange"; + } else if (datum.type === "price-range" /* PriceRange */) { + lineLabel = "dialogHeaderPriceRange"; + } else if (datum.type === "date-price-range" /* DatePriceRange */) { + lineLabel = "dialogHeaderDatePriceRange"; + } + const { tabs, initialFocus } = this.createTabs("ariaLabelSettingsTabBar", options.initialSelectedTab, { + line: { + label: lineLabel, + panel: lineTab + }, + text: { + label: "dialogHeaderText", + panel: textTab.panel, + onShow: textTab.onShow + } + }); + options.initialFocus = initialFocus; + const popover = this.showWithChildren([tabs], options); + popover.classList.add("ag-charts-dialog--annotation-settings"); + } + createLinearLineTab(datum, options) { + const panel = this.createTabPanel(); + const groupOne = this.createInputGroupLine(); + const groupTwo = this.createInputGroupLine(); + const hasMultiColorOption = "isMultiColor" in datum; + const lineColorPicker = this.createColorPickerInput( + "line-color", + datum.getDefaultColor("line-color"), + datum.getDefaultOpacity("line-color"), + hasMultiColorOption ? datum.isMultiColor : false, + hasMultiColorOption, + options.onChangeLineColor, + options.onChangeHideLineColor + ); + const strokeWidth = this.createStrokeWidthSelect(datum.strokeWidth ?? 2, options.onChangeLineStyleWidth); + const lineStyle = this.createLineStyleRadioGroup(datum.lineStyle ?? "solid", options.onChangeLineStyleType); + groupOne.append(lineColorPicker); + if ("background" in datum) { + const fillColorPicker = this.createColorPickerInput( + "fill-color", + datum.getDefaultColor("fill-color"), + datum.getDefaultOpacity("fill-color"), + false, + false, + options.onChangeFillColor, + options.onChangeHideFillColor + ); + groupOne.append(fillColorPicker); + groupTwo.append(strokeWidth); + } else if ("showFill" in datum) { + groupOne.append( + this.createCheckbox({ + label: "dialogInputShowFill", + checked: datum.showFill ?? true, + onChange: (showFill) => options.onChangeLine({ showFill }) + }) + ); + groupTwo.append(strokeWidth); + } else { + groupOne.append(strokeWidth); + } + groupTwo.append(lineStyle); + panel.append(groupOne, groupTwo); + if ("bands" in datum) { + panel.append( + this.createFibonacciRatioSelect(datum.bands ?? 10, (bands) => options.onChangeLine({ bands })) + ); + } + if ("extendStart" in datum && "extendEnd" in datum) { + panel.append( + this.createCheckbox({ + label: isChannelType(datum) ? "dialogInputExtendChannelStart" : "dialogInputExtendLineStart", + checked: datum.extendStart ?? false, + onChange: (extendStart) => options.onChangeLine({ extendStart }) + }), + this.createCheckbox({ + label: isChannelType(datum) ? "dialogInputExtendChannelEnd" : "dialogInputExtendLineEnd", + checked: datum.extendEnd ?? false, + onChange: (extendEnd) => options.onChangeLine({ extendEnd }) + }) + ); + } + if ("extendAbove" in datum && "extendBelow" in datum) { + panel.append( + this.createCheckbox({ + label: "dialogInputExtendAbove", + checked: datum.extendAbove ?? false, + onChange: (extendAbove) => options.onChangeLine({ extendAbove }) + }), + this.createCheckbox({ + label: "dialogInputExtendBelow", + checked: datum.extendBelow ?? false, + onChange: (extendBelow) => options.onChangeLine({ extendBelow }) + }) + ); + } + if ("extendLeft" in datum && "extendRight" in datum) { + panel.append( + this.createCheckbox({ + label: "dialogInputExtendLeft", + checked: datum.extendLeft ?? false, + onChange: (extendLeft) => options.onChangeLine({ extendLeft }) + }), + this.createCheckbox({ + label: "dialogInputExtendRight", + checked: datum.extendRight ?? false, + onChange: (extendRight) => options.onChangeLine({ extendRight }) + }) + ); + } + if ("reverse" in datum && "showFill" in datum) { + panel.append( + this.createCheckbox({ + label: "dialogInputReverse", + checked: datum.reverse ?? false, + onChange: (reverse) => options.onChangeLine({ reverse }) + }) + ); + } + return panel; + } + createLinearTextTab(datum, options) { + const panel = this.createTabPanel(); + const textArea = this.createTextArea({ + placeholder: "inputTextareaPlaceholder", + value: datum.text.label, + onChange: (value) => options.onChangeText({ label: value }) + }); + const fontSize = this.createFontSizeSelect(datum.text.fontSize, options.onChangeTextFontSize); + const colorPicker = this.createColorPickerInput( + "text-color", + datum.text.color, + 1, + false, + false, + options.onChangeTextColor, + options.onChangeHideTextColor + ); + const textPosition = datum.text.position === "inside" ? "center" : datum.text.position; + const position = this.createPositionRadioGroup( + textPosition ?? "top", + (value) => options.onChangeText({ position: value }) + ); + const alignment = this.createAlignmentRadioGroup( + datum.text.alignment ?? "center", + (value) => options.onChangeText({ alignment: value }) + ); + const inputGroupLine = this.createInputGroupLine(); + inputGroupLine.append(fontSize, colorPicker, position, alignment); + panel.append(textArea, inputGroupLine); + return { panel, onShow: () => focusCursorAtEnd2(textArea) }; + } + createColorPickerInput(colorType, color6, opacity, isMultiColor, hasMultiColorOption, onChange, onChangeHide) { + const label = colorType === "fill-color" ? "dialogInputFillColorPicker" : "dialogInputColorPicker"; + const altText = colorType === "fill-color" ? "dialogInputFillColorPickerAltText" : "dialogInputColorPickerAltText"; + return this.createColorPicker({ + label, + altText, + color: color6, + opacity, + isMultiColor, + hasMultiColorOption, + onChange, + onChangeHide + }); + } + createStrokeWidthSelect(strokeWidth, onChange) { + return this.createSelect({ + label: "dialogInputStrokeWidth", + altText: "dialogInputStrokeWidthAltText", + options: LINE_STROKE_WIDTH_ITEMS.map(({ label, value }) => ({ label, value: `${value}` })), + value: String(strokeWidth), + onChange: (value) => onChange(Number(value)) + }); + } + createFibonacciRatioSelect(bands, onChange) { + return this.createSelect({ + label: "dialogInputFibonacciBands", + altText: "dialogInputFibonacciBandsAltText", + options: FIBONACCI_RATIO_ITEMS.map(({ label, value }) => ({ label, value: `${value}` })), + value: String(bands), + onChange: (value) => onChange(Number(value)) + }); + } + createLineStyleRadioGroup(lineStyle, onChange) { + return this.createRadioGroup({ + label: "dialogInputLineStyle", + options: [ + { icon: "line-style-solid", altText: "iconAltTextLineStyleSolid", value: "solid" }, + { icon: "line-style-dashed", altText: "iconAltTextLineStyleDashed", value: "dashed" }, + { icon: "line-style-dotted", altText: "iconAltTextLineStyleDotted", value: "dotted" } + ], + value: lineStyle, + onChange + }); + } + createFontSizeSelect(fontSize, onChange) { + return this.createSelect({ + label: "dialogInputFontSize", + altText: "dialogInputFontSizeAltText", + options: TEXT_SIZE_ITEMS.map(({ label, value }) => ({ label, value: String(value) })), + value: String(fontSize), + onChange: (value) => onChange(Number(value)) + }); + } + createPositionRadioGroup(position, onChange) { + return this.createRadioGroup({ + label: "dialogInputPosition", + options: [ + { icon: "position-top", altText: "iconAltTextPositionTop", value: "top" }, + { icon: "position-center", altText: "iconAltTextPositionCenter", value: "center" }, + { icon: "position-bottom", altText: "iconAltTextPositionBottom", value: "bottom" } + ], + value: position, + onChange + }); + } + createAlignmentRadioGroup(alignment, onChange) { + return this.createRadioGroup({ + label: "dialogInputAlign", + options: [ + { icon: "align-left", altText: "iconAltTextAlignLeft", value: "left" }, + { icon: "align-center", altText: "iconAltTextAlignCenter", value: "center" }, + { icon: "align-right", altText: "iconAltTextAlignRight", value: "right" } + ], + value: alignment, + onChange + }); + } +}; + +// packages/ag-charts-enterprise/src/features/annotations/utils/axis.ts +function calculateAxisLabelPadding(axisLayout) { + return axisLayout.gridPadding + axisLayout.seriesAreaPadding + axisLayout.tickSize + axisLayout.label.spacing; +} + +// packages/ag-charts-enterprise/src/features/annotations/utils/update.ts +function updateAnnotation(node, datum, context) { + for (const { update } of Object.values(annotationConfigs)) { + update(node, datum, context); + } +} + +// packages/ag-charts-enterprise/src/features/annotations/annotations.ts +var { + ChartUpdateType, + InteractionState: InteractionState2, + PropertiesArray: PropertiesArray3, + Property: Property33, + ChartAxisDirection: ChartAxisDirection9, + keyProperty, + valueProperty, + Vec2: Vec219, + Selection: Selection3, + BBox: BBox3 +} = _ModuleSupport88; +var _Annotations = class _Annotations extends _ModuleSupport88.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + this.toolbar = new AnnotationsToolbar(this.ctx); + this.optionsToolbar = new AnnotationOptionsToolbar(this.ctx, () => { + const active = this.state.getActive(); + if (active == null) + return; + return getTypedDatum(this.annotationData.at(active)); + }); + this.axesButtons = new AxesButtons(); + this.snap = false; + // Hidden options for use with measurer statistics + this.data = void 0; + this.xKey = void 0; + this.volumeKey = void 0; + this.annotationData = new PropertiesArray3( + _Annotations.createAnnotationDatum + ); + this.defaults = new AnnotationDefaults(); + this.container = new _ModuleSupport88.Group({ name: "static-annotations" }); + this.annotations = new Selection3( + this.container, + this.createAnnotationScene.bind(this) + ); + this.settingsDialog = new AnnotationSettingsDialog(this.ctx); + this.textInput = new TextInput(this.ctx); + this.postUpdateFns = []; + this.state = this.setupStateMachine(); + this.setupListeners(); + this.setupDOM(); + this.ctx.historyManager.addMementoOriginator(ctx.annotationManager); + this.ctx.historyManager.addMementoOriginator(this.defaults); + this.textInput.setKeyDownHandler(this.onTextInput.bind(this)); + this.cleanup.register(() => { + this.clear(); + this.xAxis?.button?.destroy(); + this.yAxis?.button?.destroy(); + }); + } + setupStateMachine() { + const { ctx } = this; + return new AnnotationsStateMachine({ + resetToIdle: () => { + ctx.domManager.updateCursor("annotations"); + this.popAnnotationState(InteractionState2.Annotations); + this.hideOverlays(); + this.optionsToolbar.hide(); + this.deleteEphemeralAnnotations(); + this.update(); + }, + hoverAtCoords: (coords, active, previousHovered) => { + let hovered; + this.annotations.each((annotation, datum, index) => { + if (!datum.isHoverable()) + return; + const contains = annotation.containsPoint(coords.x, coords.y); + if (contains) + hovered ?? (hovered = index); + annotation.toggleHovered(contains, active === index, datum.readOnly); + }); + if (hovered != null) { + ctx.tooltipManager.suppressTooltip("annotations"); + } else if (!this.isAnnotationState()) { + ctx.tooltipManager.unsuppressTooltip("annotations"); + } + if (hovered == null || !this.annotationData.at(hovered)?.readOnly) { + this.ctx.domManager.updateCursor( + "annotations", + hovered == null ? void 0 : this.annotations.at(hovered)?.getCursor() + ); + } + if (hovered !== previousHovered) { + this.update(); + } + return hovered; + }, + getNodeAtCoords: (coords, active) => { + const node = this.annotations.at(active); + if (!node) { + return; + } + return node.getNodeAtCoords(coords.x, coords.y); + }, + translate: (index, translation) => { + const node = this.annotations.at(index); + const datum = getTypedDatum(this.annotationData.at(index)); + if (!node || !datum) { + return; + } + return this.translateNode(node, datum, translation); + }, + copy: (index) => { + const node = this.annotations.at(index); + const datum = getTypedDatum(this.annotationData.at(index)); + if (!node || !datum) { + return; + } + return this.createAnnotationDatumCopy(node, datum); + }, + paste: (datum) => { + this.createAnnotation(datum.type, datum, false); + this.postUpdateFns.push(() => { + this.state.transitionAsync("selectLast"); + this.state.transitionAsync("copy"); + }); + }, + select: (index, previous) => { + const { annotations, optionsToolbar: optionsToolbar2, toolbar: toolbar2 } = this; + this.hideOverlays(); + toolbar2.clearActiveButton(); + toolbar2.resetButtonIcons(); + const selectedNode = index == null ? null : annotations.at(index); + const previousNode = previous == null ? null : annotations.at(previous); + const selectedDatum = index == null ? null : this.annotationData.at(index); + if (previousNode === selectedNode && selectedNode != null) { + return; + } + previousNode?.toggleActive(false); + optionsToolbar2.hide(); + if (selectedNode && !selectedDatum?.readOnly) { + this.pushAnnotationState(InteractionState2.AnnotationsSelected); + selectedNode.toggleActive(true); + if (!isEphemeralType(selectedDatum)) { + optionsToolbar2.updateButtons(this.annotationData.at(index)); + this.postUpdateFns.push(() => { + optionsToolbar2.show(); + optionsToolbar2.setAnchorScene(selectedNode); + }); + } + } else { + this.popAnnotationState(InteractionState2.AnnotationsSelected); + this.popAnnotationState(InteractionState2.Annotations); + } + if (!isEphemeralType(selectedDatum)) { + this.deleteEphemeralAnnotations(); + } + this.update(); + }, + selectLast: () => { + this.pushAnnotationState(InteractionState2.AnnotationsSelected); + return this.annotationData.length - 1; + }, + startInteracting: () => { + this.pushAnnotationState(InteractionState2.Annotations); + }, + stopInteracting: () => { + this.popAnnotationState(InteractionState2.Annotations); + }, + create: (type, datum) => { + this.createAnnotation(type, datum); + }, + delete: (index) => { + this.annotationData.splice(index, 1); + }, + deleteAll: () => { + const readOnly = this.annotationData.filter((datum) => { + if (datum.readOnly === true) + return datum; + }); + this.annotationData.splice(0, this.annotationData.length); + for (const datum of readOnly) { + this.annotationData.push(datum); + } + }, + validatePoint: (point, options) => { + const context = this.getAnnotationContext(); + return context ? validateDatumPoint(context, point, options) : true; + }, + getAnnotationType: (index) => { + return stringToAnnotationType(this.annotationData[index].type); + }, + datum: (index) => { + return this.annotationData.at(index); + }, + node: (index) => { + return this.annotations.at(index); + }, + recordAction: (label) => { + this.recordActionAfterNextUpdate(label); + }, + update: () => { + this.postUpdateFns.push(() => { + const active = this.state.getActive(); + const node = active == null ? null : this.annotations.at(active); + if (node == null) + return; + this.optionsToolbar.setAnchorScene(node); + }); + this.update(); + }, + showTextInput: (active) => { + const datum = getTypedDatum(this.annotationData.at(active)); + const node = this.annotations.at(active); + if (!node || !datum || !("getTextInputCoords" in datum) || !("getTextPosition" in datum)) + return; + const styles = { + color: datum.color, + fontFamily: datum.fontFamily, + fontSize: datum.fontSize, + fontStyle: datum.fontStyle, + fontWeight: datum.fontWeight, + placeholderColor: datum.getPlaceholderColor() + }; + const context = this.getAnnotationContext(); + const getTextInputCoords = (height) => Vec219.add(datum.getTextInputCoords(context, height), Vec219.required(this.seriesRect)); + const getTextPosition = () => datum.getTextPosition(); + this.textInput.show({ + styles, + layout: { + getTextInputCoords, + getTextPosition, + alignment: datum.alignment, + textAlign: datum.textAlign, + width: datum.width + }, + text: datum.text, + placeholderText: datum.placeholderText, + onChange: (_text, bbox) => { + this.state.transition("updateTextInputBBox", bbox); + } + }); + this.ctx.domManager.updateCursor("annotations"); + }, + hideTextInput: () => { + this.textInput.hide(); + }, + updateTextInputColor: (color6) => { + this.textInput.updateColor(color6); + }, + updateTextInputFontSize: (fontSize) => { + const bbox = this.textInput.updateFontSize(fontSize); + this.state.transition("updateTextInputBBox", bbox); + }, + updateTextInputBBox: (bbox) => { + this.state.transition("updateTextInputBBox", bbox); + }, + showAnnotationOptions: (active) => { + const node = this.annotations.at(active); + if (!node || isEphemeralType(this.annotationData.at(active))) + return; + this.optionsToolbar.updateButtons(this.annotationData.at(active)); + this.optionsToolbar.show(); + this.optionsToolbar.setAnchorScene(node); + }, + showAnnotationSettings: (active, sourceEvent, initialTab = "line") => { + const datum = this.annotationData.at(active); + if (!isLineType(datum) && !isChannelType(datum) && !isMeasurerType(datum)) + return; + if (isEphemeralType(datum)) + return; + const onChangeColor = (colorType) => (colorOpacity, color6, opacity, isMultiColor) => { + this.setColorAndDefault(datum.type, colorType, colorOpacity, color6, opacity, isMultiColor); + this.optionsToolbar.updateColorPickerColor(colorType, color6, opacity, isMultiColor); + }; + const onChangeHideColor = (colorType) => () => { + this.recordActionAfterNextUpdate( + `Change ${datum.type} ${colorType} to ${datum.getDefaultColor(colorType)}`, + ["annotations", "defaults"] + ); + this.update(); + }; + const options = { + initialSelectedTab: initialTab, + ariaLabel: this.ctx.localeManager.t("ariaLabelAnnotationSettingsDialog"), + sourceEvent, + onChangeLine: (props) => { + this.state.transition("lineProps", props); + if (props.bands != null) + this.defaults.setDefaultFibonacciOptions(datum.type, "bands", props.bands); + if (props.reverse != null) + this.defaults.setDefaultFibonacciOptions(datum.type, "reverse", props.reverse); + if (props.showFill != null) + this.defaults.setDefaultFibonacciOptions(datum.type, "showFill", props.showFill); + }, + onChangeText: (props) => { + this.state.transition("lineText", props); + if (props.alignment) + this.defaults.setDefaultLineTextAlignment(datum.type, props.alignment); + if (props.position) + this.defaults.setDefaultLineTextPosition(datum.type, props.position); + this.recordActionAfterNextUpdate( + `Change ${datum.type} text ${Object.keys(props).map((key) => `${key} to ${props[key]}`).join(", ")}` + ); + }, + onChangeFillColor: onChangeColor("fill-color"), + onChangeHideFillColor: onChangeHideColor("fill-color"), + onChangeLineColor: onChangeColor("line-color"), + onChangeHideLineColor: onChangeHideColor("line-color"), + onChangeLineStyleType: (lineStyleType) => { + this.setLineStyleTypeAndDefault(datum.type, lineStyleType); + this.optionsToolbar.updateLineStyleType( + LINE_STYLE_TYPE_ITEMS.find((item) => item.value === lineStyleType) ?? LINE_STYLE_TYPE_ITEMS[0] + ); + }, + onChangeLineStyleWidth: (strokeWidth) => { + this.setLineStyleWidthAndDefault(datum.type, strokeWidth); + this.optionsToolbar.updateStrokeWidth({ + strokeWidth, + value: strokeWidth, + label: String(strokeWidth) + }); + }, + onChangeTextColor: onChangeColor("text-color"), + onChangeHideTextColor: onChangeHideColor("text-color"), + onChangeTextFontSize: (fontSize) => { + this.setFontSizeAndDefault(datum.type, fontSize); + } + }; + this.settingsDialog.show(datum, options); + } + }); + } + setupListeners() { + const { ctx, optionsToolbar: optionsToolbar2, settingsDialog, toolbar: toolbar2 } = this; + const { seriesWidget, seriesDragInterpreter, chartWidget } = ctx.widgets; + if (seriesDragInterpreter) { + this.cleanup.register( + // Interactions + seriesDragInterpreter.events.on("click", this.hoverTouchPreHandler.bind(this)), + seriesDragInterpreter.events.on("drag-start", this.hoverTouchPreHandler.bind(this)), + seriesDragInterpreter.events.on("drag-move", this.dragMoveTouchPreHandler.bind(this)), + seriesDragInterpreter.events.on("mousemove", this.onHover.bind(this)), + seriesDragInterpreter.events.on("click", this.onClick.bind(this)), + seriesDragInterpreter.events.on("dblclick", this.onDoubleClick.bind(this)), + seriesDragInterpreter.events.on("drag-start", this.onDragStart.bind(this)), + seriesDragInterpreter.events.on("drag-move", this.onDrag.bind(this)), + seriesDragInterpreter.events.on("drag-end", this.onDragEnd.bind(this)) + ); + } + this.cleanup.register( + // Interactions + seriesWidget.addListener("keydown", this.onKeyDown.bind(this)), + seriesWidget.addListener("keyup", this.onKeyUp.bind(this)), + chartWidget.addListener("click", this.onCancel.bind(this)), + // Services + ctx.eventsHub.on("annotations:restore", this.onRestoreAnnotations.bind(this)), + ctx.eventsHub.on("layout:complete", this.onLayoutComplete.bind(this)), + ctx.updateService.addListener("pre-scene-render", this.onPreRender.bind(this)), + ctx.eventsHub.on("zoom:change", () => this.onResize()), + ctx.eventsHub.on("dom:resize", () => this.onResize()), + // Toolbar + toolbar2.events.on("cancel-create-annotation", () => { + this.cancel(); + this.reset(); + this.update(); + }), + toolbar2.events.on("pressed-create-annotation", ({ annotation }) => { + this.cancel(); + this.pushAnnotationState(InteractionState2.Annotations); + this.state.transition(annotation); + this.update(); + }), + toolbar2.events.on("pressed-clear", () => { + this.clear(); + this.recordActionAfterNextUpdate("Clear all"); + }), + toolbar2.events.on("pressed-show-menu", () => { + this.cancel(); + this.reset(); + }), + toolbar2.events.on("pressed-unrelated", () => { + this.reset(); + }), + // Annotation Options Toolbar + optionsToolbar2.events.on("pressed-delete", () => { + this.cancel(); + this.delete(); + this.reset(); + }), + optionsToolbar2.events.on("pressed-settings", ({ sourceEvent }) => { + this.state.transition("toolbarPressSettings", sourceEvent); + }), + optionsToolbar2.events.on("pressed-lock", ({ locked }) => { + this.recordActionAfterNextUpdate(locked ? "Locked" : "Unlocked"); + this.update(); + }), + optionsToolbar2.events.on("hid-overlays", () => { + this.settingsDialog.hide(); + }), + optionsToolbar2.events.on("saved-color", ({ type, colorPickerType, color: color6 }) => { + this.recordActionAfterNextUpdate(`Change ${type} ${colorPickerType} to ${color6}`, [ + "annotations", + "defaults" + ]); + }), + optionsToolbar2.events.on( + "updated-color", + ({ type, colorPickerType, colorOpacity, color: color6, opacity, isMultiColor }) => { + this.setColorAndDefault(type, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + } + ), + optionsToolbar2.events.on("updated-font-size", ({ type, fontSize }) => { + this.setFontSizeAndDefault(type, fontSize); + }), + optionsToolbar2.events.on("updated-line-style", ({ type, lineStyleType }) => { + this.setLineStyleTypeAndDefault(type, lineStyleType); + }), + optionsToolbar2.events.on("updated-line-width", ({ type, strokeWidth }) => { + this.setLineStyleWidthAndDefault(type, strokeWidth); + }), + // Settings Dialog + settingsDialog.events.on("hidden", () => { + this.optionsToolbar.clearActiveButton(); + }) + ); + } + setupDOM() { + const { ctx, toolbar: toolbar2, optionsToolbar: optionsToolbar2 } = this; + this.cleanup.register(ctx.annotationManager.attachNode(this.container), () => { + ctx.domManager.removeStyles(DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS); + toolbar2.destroy(); + optionsToolbar2.destroy(); + }); + } + async processData(dataController) { + if (!this.enabled || this.data == null || this.xKey == null || this.volumeKey == null) + return; + const props = [ + keyProperty(this.xKey, void 0, { id: "date" }), + valueProperty(this.volumeKey, "number", { id: "volume" }) + ]; + const dataSet = _ModuleSupport88.DataSet.wrap(this.data) ?? _ModuleSupport88.DataSet.empty(); + const { dataModel, processedData } = await dataController.request("annotations", dataSet, { + props + }); + this.dataModel = dataModel; + this.processedData = processedData; + } + /** + * Create an annotation scene within the `this.annotations` scene selection. This method is automatically called by + * the selection when a new scene is required. + */ + createAnnotationScene(datum) { + if (datum.type in annotationConfigs) { + return new annotationConfigs[datum.type].scene(); + } + throw new Error( + `AG Charts - Cannot create annotation scene of type [${datum.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.` + ); + } + /** + * Create an annotation datum within the `this.annotationData` properties array. It is created as an instance + * of `AnnotationProperties` from the given config for its type. This method is only called when annotations + * are added from the initial state. + */ + static createAnnotationDatum(params) { + if (params.type in annotationConfigs) { + return new annotationConfigs[params.type].datum().set(params); + } + throw new Error( + `AG Charts - Cannot create annotation datum of unknown type [${params.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.` + ); + } + /** + * Append an annotation datum to `this.annotationData`, applying default styles. This method is called when a user + * interacts with the chart to draw their own annotations. + */ + createAnnotation(type, datum, applyDefaults = true) { + this.annotationData.push(datum); + if (applyDefaults) { + const styles = this.ctx.annotationManager.getAnnotationTypeStyles(type); + if (styles) + datum.set(styles); + this.defaults.applyDefaults(datum); + } + this.injectDatumDependencies(datum); + this.update(); + } + injectDatumDependencies(datum) { + if ("setLocaleManager" in datum) { + datum.setLocaleManager(this.ctx.localeManager); + } + if ("getVolume" in datum) { + datum.getVolume = this.getDatumRangeVolume.bind(this); + } + } + getDatumRangeVolume(fromPoint, toPoint) { + const { dataModel, processedData } = this; + let from = getGroupingValue(fromPoint); + let to = getGroupingValue(toPoint); + if (!isValidDate(from) || !isValidDate(to) || !dataModel || !processedData || this.volumeKey == null) + return; + if (from > to) { + [from, to] = [to, from]; + } + const dateValues = dataModel.resolveKeysById({ id: "annotations" }, "date", processedData); + const volumeValues = dataModel.resolveColumnById({ id: "annotations" }, "volume", processedData); + let sum = 0; + for (let datumIndex = 0; datumIndex < processedData.input.count; datumIndex++) { + const key = dateValues[datumIndex]; + if (isValidDate(key) && key >= from && key <= to) { + sum += volumeValues[datumIndex]; + } + } + return sum; + } + translateNode(node, datum, translation) { + const config = this.getAnnotationConfig(datum); + const context = this.getAnnotationContext(); + if (!context) { + return; + } + config.translate(node, datum, translation, context); + } + createAnnotationDatumCopy(node, datum) { + const config = this.getAnnotationConfig(datum); + const newDatum = new config.datum(); + newDatum.set(datum.toJson()); + const context = this.getAnnotationContext(); + if (!context) { + return; + } + return config.copy(node, datum, newDatum, context); + } + getAnnotationConfig(datum) { + if (datum.type in annotationConfigs) { + return annotationConfigs[datum.type]; + } + throw new Error( + `AG Charts - Cannot get annotation config of unknown type [${datum.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.` + ); + } + onRestoreAnnotations(event) { + if (!this.enabled) + return; + this.clear(); + this.annotationData.set(event.annotations); + this.postUpdateFns.push(() => { + this.ctx.annotationManager.fireChangedEvent(); + }); + this.update(); + } + onLayoutComplete(event) { + const seriesRect = event.series.paddedRect; + this.seriesRect = seriesRect; + this.container.setClipRect(seriesRect); + for (const axisLayout of event.axes ?? []) { + if (axisLayout.direction === _ModuleSupport88.ChartAxisDirection.X) { + this.xAxis = this.getAxis(axisLayout, seriesRect, this.xAxis?.button); + } else { + this.yAxis = this.getAxis(axisLayout, seriesRect, this.yAxis?.button); + } + } + if (this.showAnnotations()) { + this.animateAnnotations({ from: 0, to: 1, phase: "trailing" }); + } else { + this.animateAnnotations({ from: 1, to: 0, phase: "remove" }); + } + } + showAnnotations() { + if (!this.yAxis || !this.xAxis) { + return false; + } + const hasData = this.ctx.chartService.series.some((s) => s.hasData); + const seriesIds = this.yAxis.context.seriesIds(); + const anyBoundSeriesVisible = seriesIds.some((id) => { + const series = this.ctx.chartService.series.find((s) => s.id === id); + return series?.visible; + }); + return hasData && anyBoundSeriesVisible; + } + animateAnnotations({ from, to, phase }) { + const { annotations } = this; + this.ctx.animationManager?.animate({ + from, + to, + id: "chart-annotations", + phase, + groupId: "opacity", + onUpdate(value) { + annotations.each((node) => { + node.opacity = value; + if ("setAxisLabelOpacity" in node) { + node.setAxisLabelOpacity(value); + } + }); + }, + onStop() { + annotations.each((node) => { + node.opacity = to; + if ("setAxisLabelOpacity" in node) { + node.setAxisLabelOpacity(to); + } + }); + } + }); + } + onPreRender() { + this.updateAnnotations(); + this.state.transition("render"); + } + getAxis(axisLayout, seriesRect, button) { + const axisCtx = this.ctx.axisManager.getAxisContext(axisLayout.direction)[0]; + const { position: axisPosition = "bottom", direction } = axisCtx; + const padding = axisLayout.gridPadding + axisLayout.seriesAreaPadding; + const bounds = new BBox3(0, 0, seriesRect.width, seriesRect.height).grow(padding, axisPosition); + const lineDirection = direction === ChartAxisDirection9.X ? "vertical" : "horizontal"; + const { axesButtons, snap } = this; + const buttonEnabled = this.enabled && axesButtons.enabled && (axesButtons.axes === "xy" || axesButtons.axes === direction); + if (buttonEnabled) { + button ?? (button = new AxisButton( + this.ctx, + { ...axisCtx, snapToGroup: snap }, + (coords) => this.onAxisButtonClick(coords, lineDirection), + seriesRect + )); + const axisLabelPadding = calculateAxisLabelPadding(axisLayout); + button.update(seriesRect, axisLabelPadding); + } else { + button?.destroy(); + button = void 0; + } + return { layout: axisLayout, context: axisCtx, bounds, button }; + } + recordActionAfterNextUpdate(label, types = ["annotations"]) { + const { + defaults, + ctx: { annotationManager, historyManager } + } = this; + const originators = types.map((type) => type === "defaults" ? defaults : annotationManager); + this.postUpdateFns.push(() => { + historyManager.record(label, ...originators); + annotationManager.fireChangedEvent(); + }); + } + setColorAndDefault(datumType, colorPickerType, colorOpacity, color6, opacity, isMultiColor) { + this.state.transition("color", { colorPickerType, colorOpacity, color: color6, opacity, isMultiColor }); + this.defaults.setDefaultColor(datumType, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + } + setFontSizeAndDefault(datumType, fontSize) { + this.state.transition("fontSize", fontSize); + this.defaults.setDefaultFontSize(datumType, fontSize); + this.recordActionAfterNextUpdate(`Change ${datumType} font size to ${fontSize}`, ["annotations", "defaults"]); + } + setLineStyleTypeAndDefault(datumType, styleType) { + this.state.transition("lineStyle", { type: styleType }); + this.defaults.setDefaultLineStyleType(datumType, styleType); + this.recordActionAfterNextUpdate(`Change ${datumType} line style to ${styleType}`, ["annotations", "defaults"]); + } + setLineStyleWidthAndDefault(datumType, strokeWidth) { + this.state.transition("lineStyle", { strokeWidth }); + this.defaults.setDefaultLineStyleWidth(datumType, strokeWidth); + this.recordActionAfterNextUpdate(`Change ${datumType} stroke width to ${strokeWidth}`, [ + "annotations", + "defaults" + ]); + } + updateAnnotations() { + const { + annotationData, + annotations, + seriesRect, + ctx: { annotationManager } + } = this; + const context = this.getAnnotationContext(); + if (!seriesRect || !context) + return; + annotationManager.updateData(annotationData.toJson()); + const showAnnotations = this.showAnnotations(); + this.toolbar.refreshButtonsEnabled(showAnnotations); + this.toolbar.toggleClearButtonEnabled(annotationData.length > 0 && showAnnotations); + annotations.update(annotationData ?? [], void 0, (datum) => datum.id).each((node, datum) => { + if (!showAnnotations) { + node.visible = false; + if ("setAxisLabelVisible" in node) { + node.setAxisLabelVisible(false); + } + return; + } + if ("setAxisLabelVisible" in node) { + node.setAxisLabelVisible(true); + } + this.injectDatumDependencies(datum); + updateAnnotation(node, datum, context); + }); + for (const fn of this.postUpdateFns) { + fn(); + } + this.postUpdateFns = []; + } + getAnnotationContext() { + const { seriesRect, xAxis, yAxis, snap } = this; + if (!(seriesRect && xAxis && yAxis)) { + return; + } + return { + seriesRect, + xAxis: { + ...xAxis.context, + bounds: xAxis.bounds, + labelPadding: calculateAxisLabelPadding(xAxis.layout), + snapToGroup: snap + }, + yAxis: { + ...yAxis.context, + bounds: yAxis.bounds, + labelPadding: calculateAxisLabelPadding(xAxis.layout), + snapToGroup: snap + } + }; + } + onHover(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const shiftKey = event.sourceEvent.shiftKey; + const offset = Vec219.from(event); + const point = invertCoords(offset, context); + state.transition("hover", { offset, point, shiftKey, context }); + } + onClick(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const shiftKey = event.sourceEvent.shiftKey; + const point = invertCoords(Vec219.from(event), context); + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + state.transition("click", { point, shiftKey, textInputValue, bbox }); + } + onDoubleClick(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const offset = Vec219.from(event); + state.transition("dblclick", { offset }); + } + onAxisButtonClick(coords, direction) { + this.cancel(); + this.reset(); + const context = this.getAnnotationContext(); + if (!this.annotationData || !context) + return; + const { state } = this; + this.pushAnnotationState(InteractionState2.Annotations); + const isHorizontal2 = direction === "horizontal"; + state.transition(isHorizontal2 ? "horizontal-line" /* HorizontalLine */ : "vertical-line" /* VerticalLine */); + this.optionsToolbar.hide(); + if (!coords) { + return; + } + const point = invertCoords(coords, context); + if (!validateDatumPoint(context, point)) { + return; + } + state.transition("click", { point, shiftKey: false }); + this.update(); + } + onResize() { + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + this.state.transition("resize", { textInputValue, bbox }); + } + hoverTouchPreHandler(event) { + if (event.device === "touch") { + this.onHover(event); + } + } + dragMoveTouchPreHandler(event) { + if (event.device === "touch" && this.ctx.interactionManager.isState(InteractionState2.AnnotationsSelected)) { + event.sourceEvent.preventDefault(); + } + } + onDragStart(event) { + if (!this.ctx.interactionManager.isState(InteractionState2.AnnotationsDraggable)) + return; + const context = this.getAnnotationContext(); + if (!context) + return; + const offset = Vec219.from(event); + const point = invertCoords(offset, context); + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + this.state.transition("dragStart", { context, offset, point, textInputValue, bbox }); + } + onDrag(event) { + if (!this.ctx.interactionManager.isState(InteractionState2.AnnotationsDraggable)) + return; + const context = this.getAnnotationContext(); + if (!context) + return; + const offset = Vec219.from(event); + const point = invertCoords(offset, context); + const shiftKey = event.sourceEvent.shiftKey; + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + this.state.transition("drag", { context, offset, point, shiftKey, textInputValue, bbox }); + } + onDragEnd() { + this.state.transition("dragEnd"); + } + onCancel(widgetEvent) { + const { sourceEvent } = widgetEvent ?? {}; + if (sourceEvent?.currentTarget !== sourceEvent?.target) + return; + this.cancel(); + this.reset(); + } + onDelete() { + if (this.textInput.isVisible()) + return; + this.cancel(); + this.delete(); + this.reset(); + this.update(); + } + onTextInput(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const { key, shiftKey } = event; + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + state.transition("textInput", { key, shiftKey, textInputValue, bbox, context }); + } + onKeyDown(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) { + return; + } + const { sourceEvent } = event; + const { shiftKey, ctrlKey, metaKey } = sourceEvent; + const ctrlMeta = ctrlKey || metaKey; + const ctrlShift = ctrlKey || shiftKey; + state.transition("keyDown", { shiftKey, context }); + const translation = { x: 0, y: 0 }; + const xStep = Math.max(context?.xAxis.scale.bandwidth ?? 0, ctrlShift ? 10 : 1); + const yStep = Math.max(context?.yAxis.scale.bandwidth ?? 0, ctrlShift ? 10 : 1); + switch (sourceEvent.key) { + case "ArrowDown": + translation.y = yStep; + break; + case "ArrowUp": + translation.y = -yStep; + break; + case "ArrowLeft": + translation.x = -xStep; + break; + case "ArrowRight": + translation.x = xStep; + break; + case "Escape": + this.onCancel(); + return; + case "Backspace": + case "Delete": + this.onDelete(); + return; + } + if (translation.x || translation.y) { + state.transition("translate", { translation }); + sourceEvent.stopPropagation(); + sourceEvent.preventDefault(); + } + if (!ctrlMeta) { + return; + } + switch (sourceEvent.key) { + case "c": + state.transition("copy"); + return; + case "x": + state.transition("cut"); + this.recordActionAfterNextUpdate("Cut annotation"); + return; + case "v": + state.transition("paste"); + this.recordActionAfterNextUpdate("Paste annotation"); + return; + } + } + onKeyUp(event) { + const { shiftKey } = event.sourceEvent; + const context = this.getAnnotationContext(); + if (!context) { + return; + } + this.state.transition("keyUp", { shiftKey, context }); + this.state.transition("translateEnd"); + } + clear() { + this.cancel(); + this.deleteAll(); + this.reset(); + } + reset() { + this.state.transition("reset"); + } + cancel() { + this.state.transition("cancel"); + } + delete() { + this.state.transition("delete"); + } + deleteAll() { + this.state.transition("deleteAll"); + } + deleteEphemeralAnnotations() { + let deletedEphemeral = false; + for (const [index, datum] of this.annotationData.entries()) { + if (isEphemeralType(datum)) { + this.annotationData.splice(index, 1); + deletedEphemeral = true; + } + } + if (deletedEphemeral) { + this.recordActionAfterNextUpdate("Delete ephemeral annotations"); + } + } + hideOverlays() { + this.settingsDialog.hide(); + this.toolbar.hideOverlays(); + this.optionsToolbar.hideOverlays(); + } + pushAnnotationState(state) { + this.ctx.interactionManager.pushState(state); + this.ctx.tooltipManager.suppressTooltip("annotations"); + } + popAnnotationState(state) { + this.ctx.interactionManager.popState(state); + this.ctx.tooltipManager.unsuppressTooltip("annotations"); + } + isAnnotationState() { + return this.ctx.interactionManager.isState(InteractionState2.Annotations) || this.ctx.interactionManager.isState(InteractionState2.AnnotationsSelected); + } + update(status = ChartUpdateType.PRE_SCENE_RENDER) { + this.ctx.updateService.update(status); + } +}; +__decorateClass([ + Property33 +], _Annotations.prototype, "enabled", 2); +__decorateClass([ + Property33 +], _Annotations.prototype, "toolbar", 2); +__decorateClass([ + Property33 +], _Annotations.prototype, "optionsToolbar", 2); +__decorateClass([ + Property33 +], _Annotations.prototype, "axesButtons", 2); +__decorateClass([ + Property33 +], _Annotations.prototype, "snap", 2); +var Annotations = _Annotations; + +// packages/ag-charts-enterprise/src/features/annotations/annotationsTheme.ts +import { + _ModuleSupport as _ModuleSupport89 +} from "ag-charts-community"; +var { FONT_SIZE_RATIO, ThemeSymbols } = _ModuleSupport89; +var stroke = { + stroke: { $ref: "foregroundColor" }, + strokeOpacity: 1, + strokeWidth: 2 +}; +var handle = { + fill: ThemeSymbols.DEFAULT_ANNOTATION_HANDLE_FILL, + strokeOpacity: 1, + strokeWidth: 2 +}; +var font = { + color: { $ref: "chartBackgroundColor" }, + fontSize: { $rem: FONT_SIZE_RATIO.LARGE }, + fontFamily: { $ref: "fontFamily" } +}; +var axisLabel = { + ...font, + enabled: true, + fill: { $ref: "foregroundColor" }, + fontSize: { $ref: "fontSize" } +}; +var text = { + ...font, + textAlign: "left" +}; +var lineText = { + ...font, + position: "top", + alignment: "center", + color: { $ref: "textColor" } +}; +var channelText = { + ...font, + position: "top", + alignment: "center", + color: { $ref: "textColor" } +}; +var measurerStatistics = { + ...font, + fontSize: { $ref: "fontSize" }, + color: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_COLOR, + fill: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_FILL, + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_STROKE, + strokeWidth: 1, + divider: { + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE, + strokeWidth: 1, + strokeOpacity: 0.5 + } +}; +var measurer = { + ...stroke, + background: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + handle: { ...handle }, + text: { ...lineText }, + statistics: { ...measurerStatistics } +}; +var toolbar = { + buttons: { + $shallowSimple: [ + { + icon: "text-annotation", + tooltip: "toolbarAnnotationsTextAnnotations", + value: "text-menu" + }, + { + icon: "trend-line-drawing", + tooltip: "toolbarAnnotationsLineAnnotations", + value: "line-menu" + }, + { + icon: "arrow-drawing", + tooltip: "toolbarAnnotationsShapeAnnotations", + value: "shape-menu" + }, + { + icon: "delete", + tooltip: "toolbarAnnotationsClearAll", + value: "clear" + } + ] + }, + padding: { $ref: "chartPadding" } +}; +var optionsToolbar = { + buttons: { + $shallowSimple: [ + { + icon: "text-annotation", + tooltip: "toolbarAnnotationsTextColor", + value: "text-color" + }, + { + icon: "line-color", + tooltip: "toolbarAnnotationsLineColor", + value: "line-color" + }, + { + icon: "fill-color", + tooltip: "toolbarAnnotationsFillColor", + value: "fill-color" + }, + { + tooltip: "toolbarAnnotationsTextSize", + value: "text-size" + }, + { + tooltip: "toolbarAnnotationsLineStrokeWidth", + value: "line-stroke-width" + }, + { + icon: "line-style-solid", + tooltip: "toolbarAnnotationsLineStyle", + value: "line-style-type" + }, + { + icon: "settings", + tooltip: "toolbarAnnotationsSettings", + value: "settings" + }, + { + icon: "unlocked", + tooltip: "toolbarAnnotationsLock", + ariaLabel: "toolbarAnnotationsLock", + checkedOverrides: { + icon: "locked", + tooltip: "toolbarAnnotationsUnlock" + }, + value: "lock" + }, + { + icon: "delete", + tooltip: "toolbarAnnotationsDelete", + value: "delete" + } + ] + } +}; +var annotationsTheme = { + enabled: false, + // Lines + line: { + ...stroke, + handle: { ...handle }, + text: { ...lineText } + }, + "horizontal-line": { + ...stroke, + handle: { ...handle }, + axisLabel: { ...axisLabel }, + text: { ...lineText } + }, + "vertical-line": { + ...stroke, + handle: { ...handle }, + axisLabel: { ...axisLabel }, + text: { ...lineText } + }, + // Channels + "disjoint-channel": { + ...stroke, + background: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + handle: { ...handle }, + text: { ...channelText } + }, + "parallel-channel": { + ...stroke, + middle: { + lineDash: [6, 5], + strokeWidth: 1 + }, + background: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + handle: { ...handle }, + text: { ...channelText } + }, + // Fibonnaccis + "fibonacci-retracement": { + ...stroke, + strokes: ThemeSymbols.DEFAULT_FIBONACCI_STROKES, + rangeStroke: { $ref: "foregroundColor" }, + handle: { ...handle }, + text: { ...lineText, position: "center" }, + label: { + ...font, + color: void 0, + fontSize: { $rem: FONT_SIZE_RATIO.SMALLER } + } + }, + "fibonacci-retracement-trend-based": { + ...stroke, + strokes: ThemeSymbols.DEFAULT_FIBONACCI_STROKES, + rangeStroke: { $ref: "foregroundColor" }, + handle: { ...handle }, + text: { ...lineText, position: "center" }, + label: { + ...font, + color: void 0, + fontSize: { $rem: FONT_SIZE_RATIO.SMALLER } + } + }, + // Texts + callout: { + ...stroke, + ...text, + color: { $ref: "textColor" }, + handle: { ...handle }, + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + comment: { + ...text, + fontWeight: 700, + handle: { ...handle }, + fill: { $ref: "foregroundColor" } + }, + note: { + ...text, + color: ThemeSymbols.DEFAULT_TEXTBOX_COLOR, + fill: ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, + stroke: { $ref: "chartBackgroundColor" }, + strokeWidth: 1, + strokeOpacity: 1, + handle: { ...handle }, + background: { + fill: ThemeSymbols.DEFAULT_TEXTBOX_FILL, + stroke: ThemeSymbols.DEFAULT_TEXTBOX_STROKE, + strokeWidth: 1 + } + }, + text: { + ...text, + color: { $ref: "textColor" }, + handle: { ...handle } + }, + // Shapes + arrow: { + ...stroke, + handle: { ...handle }, + text: { ...lineText } + }, + "arrow-up": { + fill: { $palette: "up.fill" }, + handle: { ...handle, stroke: { $ref: "foregroundColor" } } + }, + "arrow-down": { + fill: { $palette: "down.fill" }, + handle: { ...handle, stroke: { $ref: "foregroundColor" } } + }, + // Measurers + "date-range": { + ...measurer + }, + "price-range": { + ...measurer + }, + "date-price-range": { + ...measurer + }, + "quick-date-price-range": { + up: { + ...stroke, + fill: ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + fillOpacity: 0.2, + handle: { ...handle }, + statistics: { + ...measurerStatistics, + color: "#fff", + fill: ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + strokeWidth: 0, + divider: { + stroke: "#fff", + strokeWidth: 1, + strokeOpacity: 0.5 + } + } + }, + down: { + ...stroke, + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE, + fill: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, + fillOpacity: 0.2, + handle: { + ...handle, + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE + }, + statistics: { + ...measurerStatistics, + color: "#fff", + fill: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, + strokeWidth: 0, + divider: { + stroke: "#fff", + strokeWidth: 1, + strokeOpacity: 0.5 + } + } + } + }, + axesButtons: {}, + // Toolbars + toolbar, + optionsToolbar +}; + +// packages/ag-charts-enterprise/src/features/annotations/annotationsModule.ts +var AnnotationsModule = { + type: "root", + optionsKey: "annotations", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new Annotations(ctx), + themeTemplate: { + annotations: annotationsTheme + } +}; + +// packages/ag-charts-enterprise/src/features/background/background.ts +import { _ModuleSupport as _ModuleSupport91 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/image/image.ts +import { _ModuleSupport as _ModuleSupport90 } from "ag-charts-community"; +import { createElement as createElement3 } from "ag-charts-core"; +var { BaseProperties: BaseProperties12, ObserveChanges: ObserveChanges2, ProxyProperty, Property: Property34, calculatePlacement } = _ModuleSupport90; +var Image = class extends BaseProperties12 { + constructor() { + super(); + this.opacity = 1; + this.loadedSynchronously = true; + this.containerWidth = 0; + this.containerHeight = 0; + this.onLoad = void 0; + this.onImageLoad = () => { + if (this.loadedSynchronously) { + return; + } + this.node.visible = false; + this.performLayout(this.containerWidth, this.containerHeight); + this.onLoad?.(); + }; + this.imageElement = createElement3("img"); + this.imageElement.onload = this.onImageLoad; + this.node = new _ModuleSupport90.Image(this.imageElement); + } + get complete() { + return this.imageElement.width > 0 && this.imageElement.height > 0; + } + performLayout(containerWidth, containerHeight) { + this.containerWidth = containerWidth; + this.containerHeight = containerHeight; + const container = { width: containerWidth, height: containerHeight }; + const placement = calculatePlacement(this.imageElement.width, this.imageElement.height, container, this); + this.node.setProperties( + this.complete ? { + visible: true, + opacity: this.opacity, + ...placement + } : { visible: false } + ); + return placement; + } +}; +__decorateClass([ + Property34 +], Image.prototype, "top", 2); +__decorateClass([ + Property34 +], Image.prototype, "right", 2); +__decorateClass([ + Property34 +], Image.prototype, "bottom", 2); +__decorateClass([ + Property34 +], Image.prototype, "left", 2); +__decorateClass([ + Property34 +], Image.prototype, "width", 2); +__decorateClass([ + Property34 +], Image.prototype, "height", 2); +__decorateClass([ + Property34 +], Image.prototype, "opacity", 2); +__decorateClass([ + ProxyProperty("imageElement.src"), + ObserveChanges2((target) => target.loadedSynchronously = target.complete) +], Image.prototype, "url", 2); + +// packages/ag-charts-enterprise/src/features/background/background.ts +var { ActionOnSet: ActionOnSet3, Property: Property35 } = _ModuleSupport91; +var Background2 = class extends _ModuleSupport91.Background { + constructor() { + super(...arguments); + this.image = new Image(); + } + onLayoutComplete(event) { + super.onLayoutComplete(event); + if (this.image) { + const { width, height } = event.chart; + this.image.performLayout(width, height); + } + } + onImageLoad() { + this.ctx.updateService.update(_ModuleSupport91.ChartUpdateType.SCENE_RENDER); + } +}; +__decorateClass([ + Property35, + ActionOnSet3({ + newValue(image) { + this.node.appendChild(image.node); + image.onLoad = () => this.onImageLoad(); + }, + oldValue(image) { + image.node.remove(); + image.onLoad = void 0; + } + }) +], Background2.prototype, "image", 2); + +// packages/ag-charts-enterprise/src/features/background/backgroundModule.ts +var BackgroundModule = { + type: "root", + optionsKey: "background", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Background2(ctx) +}; + +// packages/ag-charts-enterprise/src/features/band-highlight/bandHighlight.ts +import { _ModuleSupport as _ModuleSupport92 } from "ag-charts-community"; +import { createId as createId2 } from "ag-charts-core"; +var { + Range, + TranslatableGroup, + BBox: BBox4, + Property: Property36, + ZIndexMap: ZIndexMap4, + ChartAxisDirection: ChartAxisDirection10, + FillGradientDefaults, + FillImageDefaults, + FillPatternDefaults, + getShapeFill, + InteractionState: InteractionState3 +} = _ModuleSupport92; +var BandHighlight = class extends _ModuleSupport92.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.id = createId2(this); + this.enabled = false; + this.stroke = "rgb(195, 195, 195)"; + this.lineDash = [6, 3]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.fill = "#c16068"; + this.fillOpacity = 1; + this.fillGradientDefaults = new FillGradientDefaults(); + this.fillPatternDefaults = new FillPatternDefaults(); + this.fillImageDefaults = new FillImageDefaults(); + this.bounds = new BBox4(0, 0, 0, 0); + this.bandHighlightGroup = new TranslatableGroup({ + name: "bandHighlight", + zIndex: ZIndexMap4.AXIS_BAND_HIGHLIGHT + }); + this.rangeNode = this.bandHighlightGroup.appendChild(new Range()); + this.activeAxisHighlight = void 0; + this.axisCtx = ctx.parent; + this.hideBand(); + ctx.domManager.addEventListener("focusin", ({ target }) => { + const isSeriesAreaChild = target instanceof HTMLElement && ctx.domManager.contains(target, "series-area"); + if (this.bandHighlightGroup.visible && !isSeriesAreaChild) { + this.hideBand(); + this.ctx.updateService.update(_ModuleSupport92.ChartUpdateType.PERFORM_LAYOUT); + } + }); + const { + widgets: { seriesWidget, seriesDragInterpreter }, + animationManager, + eventsHub + } = ctx; + this.cleanup.register( + ctx.scene.attachNode(this.bandHighlightGroup), + seriesWidget.addListener("mousemove", (event) => this.onHoverLikeEvent(event)), + seriesWidget.addListener("mouseleave", () => this.clearAllHighlight()), + animationManager.addListener("animation-start", () => this.clearAllHighlight()), + eventsHub.on("layout:complete", (event) => this.layout(event)), + eventsHub.on("series:focus-change", () => this.onKeyPress()), + eventsHub.on("zoom:pan-start", () => this.clearAllHighlight()), + eventsHub.on("zoom:change", () => this.clearAllHighlight()), + eventsHub.on("dom:resize", () => this.clearAllHighlight()), + eventsHub.on("axis:change", () => this.axisChange()) + ); + if (seriesDragInterpreter) { + this.cleanup.register( + seriesDragInterpreter.events.on("drag-move", (event) => this.onHoverLikeEvent(event)), + seriesDragInterpreter.events.on("click", (event) => this.onClick(event)) + ); + } + } + axisChange() { + this.onHighlightChange(); + } + isHover(event) { + return event.type === "mousemove" || event.type === "click" || event.device === "touch" && this.ctx.chartService.touch.dragAction === "hover"; + } + onClick(event) { + if (event.device === "touch") { + this.onHoverLikeEvent(event); + } + } + clearAllHighlight() { + if (!this.ctx.interactionManager.isState(InteractionState3.Clickable)) + return; + this.onHighlightChange(); + } + onKeyPress() { + if (this.ctx.interactionManager.isState(InteractionState3.Default)) { + this.onHighlightChange(); + } + } + onHoverLikeEvent(event) { + const requiredState = this.isHover(event) ? InteractionState3.Clickable : InteractionState3.AnnotationsMoveable; + if (!this.ctx.interactionManager.isState(requiredState)) + return; + this.handleHoverHighlight(event); + } + handleHoverHighlight(event) { + if (!event) + return; + const { currentX: x, currentY: y } = event; + this.onHighlightChange(this.axisCtx.pickBand({ x, y })); + } + layout({ series: { rect, visible }, axes }) { + if (!visible || !axes || !this.enabled) + return; + const { position: axisPosition = "left", axisId } = this.axisCtx; + const axisLayout = axes.find((a) => a.id === axisId); + if (!axisLayout) + return; + this.axisLayout = axisLayout; + this.bounds = rect.clone().grow(axisLayout.gridPadding, axisPosition); + const { bandHighlightGroup, bounds } = this; + bandHighlightGroup.translationX = Math.round(bounds.x); + bandHighlightGroup.translationY = Math.round(bounds.y); + this.updateBand(); + } + updateBand() { + const { + rangeNode: node, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + fill, + fillOpacity, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3, + lineDashOffset, + axisLayout + } = this; + if (!axisLayout) + return; + node.stroke = stroke2; + node.strokeWidth = strokeWidth; + node.strokeOpacity = strokeOpacity; + node.lineDash = lineDash; + node.lineDashOffset = lineDashOffset; + node.fill = getShapeFill(fill, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + node.fillOpacity = fillOpacity; + node.startLine = true; + node.endLine = true; + } + isVertical() { + return this.axisCtx.direction === ChartAxisDirection10.X; + } + onHighlightChange(axisBandDatum) { + if (!this.enabled) + return; + this.activeAxisHighlight = axisBandDatum; + if (this.activeAxisHighlight) { + this.showBand(); + } else { + this.hideBand(); + } + this.ctx.updateService.update(_ModuleSupport92.ChartUpdateType.SCENE_RENDER); + } + updateBandPosition() { + const { rangeNode, bounds } = this; + const { band } = this.activeAxisHighlight ?? {}; + if (band == void 0) { + this.hideBand(); + return; + } + let r0 = Math.min(...band); + let r1 = Math.max(...band); + if (r1 - r0 < 1) { + const mid = (r0 + r1) / 2; + r0 = mid - 0.5; + r1 = mid + 0.5; + } + if (this.isVertical()) { + rangeNode.y1 = 0; + rangeNode.y2 = bounds.height; + rangeNode.x1 = r0; + rangeNode.x2 = r1; + rangeNode.horizontal = true; + } else { + rangeNode.y1 = r0; + rangeNode.y2 = r1; + rangeNode.x1 = 0; + rangeNode.x2 = bounds.width; + rangeNode.horizontal = false; + } + } + showBand() { + this.updateBandPosition(); + this.bandHighlightGroup.visible = true; + } + hideBand() { + this.bandHighlightGroup.visible = false; + } +}; +__decorateClass([ + Property36 +], BandHighlight.prototype, "enabled", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "stroke", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "lineDash", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "lineDashOffset", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "strokeWidth", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "strokeOpacity", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "fill", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "fillOpacity", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "fillGradientDefaults", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "fillPatternDefaults", 2); +__decorateClass([ + Property36 +], BandHighlight.prototype, "fillImageDefaults", 2); + +// packages/ag-charts-enterprise/src/features/band-highlight/bandHighlightModule.ts +var BandHighlightModule = { + type: "axis-option", + optionsKey: "bandHighlight", + packageType: "enterprise", + chartTypes: ["cartesian"], + axisTypes: ["category", "ordinal-time", "unit-time", "grouped-category"], + moduleFactory: (ctx) => new BandHighlight(ctx), + themeTemplate: { + bandHighlight: { + enabled: false, + strokeWidth: 0, + lineDash: [], + fill: { $foregroundBackgroundMix: 0.05 } + } + } +}; + +// packages/ag-charts-enterprise/src/features/chart-toolbar/chartToolbar.ts +import { _ModuleSupport as _ModuleSupport93 } from "ag-charts-community"; +import { Logger as Logger4 } from "ag-charts-core"; +var { ActionOnSet: ActionOnSet4, LayoutElement: LayoutElement2, Menu: Menu3, Property: Property37 } = _ModuleSupport93; +var menuItems = [ + { label: "toolbarSeriesTypeOHLC", icon: "ohlc-series", value: "ohlc" }, + { label: "toolbarSeriesTypeCandles", icon: "candlestick-series", value: "candlestick" }, + { label: "toolbarSeriesTypeHollowCandles", icon: "hollow-candlestick-series", value: "hollow-candlestick" }, + { label: "toolbarSeriesTypeLine", icon: "line-series", value: "line" }, + { label: "toolbarSeriesTypeStepLine", icon: "step-line-series", value: "step-line" }, + { label: "toolbarSeriesTypeHLC", icon: "hlc-series", value: "hlc" }, + { label: "toolbarSeriesTypeHighLow", icon: "high-low-series", value: "high-low" } +]; +var ChartToolbar = class extends _ModuleSupport93.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.menu = new Menu3(this.ctx, "chart-toolbar"); + this.toolbar = ctx.sharedToolbar.getSharedToolbar("chartToolbar"); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPressed.bind(this)), + ctx.layoutManager.registerElement(LayoutElement2.ToolbarLeft, this.onLayoutStart.bind(this)), + () => this.toolbar.destroy() + ); + } + onLayoutStart(event) { + if (!this.enabled) + return; + this.updateButton(); + this.toolbar.layout(event.layoutBox); + } + onButtonPressed({ event, buttonBounds, buttonWidget }) { + this.menu.setAnchor({ x: buttonBounds.x + buttonBounds.width + 6, y: buttonBounds.y }); + this.menu.show(buttonWidget, { + items: menuItems, + menuItemRole: "menuitemradio", + ariaLabel: this.ctx.localeManager.t("toolbarSeriesTypeDropdown"), + class: "ag-charts-chart-toolbar__menu", + value: this.getChartType(), + sourceEvent: event.sourceEvent, + onPress: (item) => { + this.setChartType(item.value); + this.hidePopover(); + }, + onHide: () => { + this.toolbar.clearActiveButton(); + } + }); + this.toolbar.toggleActiveButtonByIndex(0); + } + updateButton() { + const chartType = this.getChartType(); + const icon = menuItems.find((item) => item.value === chartType)?.icon; + if (icon != null) { + this.toolbar.updateButtons([{ icon, tooltip: "toolbarSeriesTypeDropdown", value: "menu" }]); + } + } + hidePopover() { + this.toolbar.clearActiveButton(); + this.menu.hide(); + } + setChartType(chartType) { + const options = { chartType }; + this.ctx.chartService.publicApi?.updateDelta(options).catch((e) => Logger4.error(e)); + } + getChartType() { + const chartType = this.ctx.chartService.publicApi?.getOptions()?.chartType; + if (chartType == null || !menuItems.some((item) => item.value === chartType)) { + return "candlestick"; + } + return chartType; + } +}; +__decorateClass([ + Property37, + ActionOnSet4({ + changeValue(enabled) { + this.toolbar?.setHidden(!enabled); + } + }) +], ChartToolbar.prototype, "enabled", 2); + +// packages/ag-charts-enterprise/src/features/chart-toolbar/chartToolbarModule.ts +var ChartToolbarModule = { + type: "root", + optionsKey: "chartToolbar", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new ChartToolbar(ctx) +}; + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenuModule.ts +import { _ModuleSupport as _ModuleSupport95 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenu.ts +import { _ModuleSupport as _ModuleSupport94, _Widget as _Widget4 } from "ag-charts-community"; +import { Logger as Logger5, clamp as clamp5, createElement as createElement4, toPlainText } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenuItem.ts +import { isKeyOf } from "ag-charts-core"; +function showsFor(showOn, showing) { + if (showOn === "always") + return true; + if (showOn === "series-area") + return showing === "series-area" || showing === "series-node"; + return showOn === showing; +} +function appendItem(showing, item, result) { + let mustShow = true; + if (item.type === "separator") { + const last = result.at(-1); + mustShow = last !== void 0 && last.type !== "separator"; + } + mustShow && (mustShow = showsFor(item.showOn ?? "always", showing)); + if (mustShow) { + const menuItem = new ContextMenuItem(item); + result.push(menuItem); + return menuItem; + } +} +function appendBuiltinItem(showing, registry, keyword, result) { + if (registry.isVisible(keyword)) { + appendItem(showing, registry.builtins.items[keyword], result); + } +} +function expandBuiltin(showing, registry, keyword, result) { + const { builtins } = registry; + if (isKeyOf(keyword, builtins.lists)) { + for (const childKeyword of builtins.lists[keyword]) { + appendBuiltinItem(showing, registry, childKeyword, result); + } + } else { + appendBuiltinItem(showing, registry, keyword, result); + } +} +function expandItems(showing, registry, items, result) { + for (const item of items) { + if (typeof item === "string") { + expandBuiltin(showing, registry, item, result); + } else { + const menuItem = appendItem(showing, item, result); + if (item.items && menuItem && item.items.length > 0) { + expandItems(showing, registry, item.items, menuItem.items); + } + } + } + if (result.at(-1)?.type === "separator") { + result.pop(); + } +} +var ContextMenuItem = class { + constructor(options) { + this.type = "action"; + this.showOn = "always"; + this.label = ""; + this.iconUrl = void 0; + this.enabled = true; + this.items = []; + this.action = void 0; + if (options) + this.setOptions(options); + this.items = []; + } + setField(key, that, value) { + that[key] = value; + } + setOptions(options) { + let key; + for (key in options) { + if (options[key] !== void 0) { + this.setField(key, this, options[key]); + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenuStyles.ts +var DEFAULT_CONTEXT_MENU_CLASS = "ag-charts-context-menu"; + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenu.ts +var { Property: Property38, ContextMenuRegistry, callWithContext, getIconClassNames: getIconClassNames3 } = _ModuleSupport94; +var moduleId2 = "context-menu"; +var ContextMenu = class extends _ModuleSupport94.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + this.darkTheme = false; + this.items = ["defaults"]; + // State + this.pickedNode = void 0; + this.showEvent = void 0; + this.x = 0; + this.y = 0; + this.collapsingSubMenus = 0; + this.menuWidget = new _Widget4.MenuWidget(); + this.interactionManager = ctx.interactionManager; + this.element = ctx.domManager.addChild("canvas-overlay", moduleId2); + this.element.classList.add(DEFAULT_CONTEXT_MENU_CLASS); + this.element.style.display = "none"; + this.element.addEventListener("contextmenu", (event) => event.preventDefault()); + this.element.addEventListener("focusout", ({ relatedTarget }) => { + if (this.collapsingSubMenus > 0) + return; + if (relatedTarget == null || relatedTarget instanceof Node && !this.element.contains(relatedTarget)) { + this.hide(); + } + }); + this.cleanup.register( + () => this.element.remove(), + () => this.menuWidget.destroy(), + ctx.eventsHub.on("dom:hidden", () => this.hide()), + this.menuWidget.addListener("collapse-widget", () => this.onCollapse()) + ); + this.menuWidget.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__menu`); + if (typeof MutationObserver !== "undefined") { + const observer = new MutationObserver(() => { + if (this.element.contains(this.menuWidget.getElement())) { + this.reposition(); + } + }); + observer.observe(this.element, { childList: true }); + this.mutationObserver = observer; + this.cleanup.register(() => observer.disconnect()); + } + this.ctx.contextMenuRegistry.builtins.items["download"].action = () => { + const title = ctx.chartService.title; + let fileName = "image"; + if (title?.enabled) { + fileName = title.node.getPlainText().replace(/\.+/, ""); + } + this.ctx.chartService.publicApi?.download({ fileName }).catch((e) => { + Logger5.error("Unable to download chart", e); + }); + }; + this.cleanup.register(this.ctx.eventsHub.on("context-menu:complete", (e) => this.onContext(e))); + } + expandItemsOptions(showing) { + const result = []; + expandItems(showing, this.ctx.contextMenuRegistry, this.items, result); + return result; + } + onContext(event) { + if (!this.enabled) + return; + event.widgetEvent.sourceEvent.preventDefault(); + this.showEvent = event.widgetEvent.sourceEvent; + this.x = event.x; + this.y = event.y; + this.pickedNode = void 0; + this.pickedLegendItem = void 0; + if (ContextMenuRegistry.check("series-node", event)) { + this.pickedNode = event.context.pickedNode; + } else if (ContextMenuRegistry.check("legend-item", event)) { + this.pickedLegendItem = event.context.legendItem; + } + const expandedItems = this.expandItemsOptions(event.showOn); + if (expandedItems.length === 0) + return; + this.show(event.widgetEvent, expandedItems); + } + show(widgetEvent, expandedItems) { + const { sourceEvent } = widgetEvent; + this.interactionManager.pushState(_ModuleSupport94.InteractionState.ContextMenu); + this.element.style.display = "block"; + const overrideFocusVisible = sourceEvent.pointerType === "touch" ? false : void 0; + if (overrideFocusVisible !== void 0) { + this.ctx.chartService.overrideFocusVisible(overrideFocusVisible); + } + this.createMenu(expandedItems); + this.element.appendChild(this.menuWidget.getElement()); + this.menuWidget.expand({ sourceEvent, overrideFocusVisible }); + } + hide() { + this.menuWidget.collapse(); + } + onCollapse() { + this.interactionManager.popState(_ModuleSupport94.InteractionState.ContextMenu); + this.menuWidget.getElement().remove(); + this.element.style.display = "none"; + } + onSubMenuExpand(button, menu) { + const bounds = button.getBounds(); + button.setFocusOverride(true); + button.getElement().insertAdjacentElement("afterend", menu.getElement()); + menu.getElement().style.position = "absolute"; + const canvasRect = this.ctx.domManager.getBoundingClientRect(); + const buttonClientRect = button.getBoundingClientRect(); + const remainingSpaceOnRight = canvasRect.right - buttonClientRect.right; + const remainingSpaceOnLeft = buttonClientRect.left - canvasRect.left; + const { offsetWidth: menuOffsetWidth, offsetHeight: menuOffsetHeight } = menu.getElement(); + let y = bounds.y; + if (canvasRect.height > menuOffsetHeight) { + const remainingSpaceOnBottom = canvasRect.bottom - buttonClientRect.top; + if (remainingSpaceOnBottom < menuOffsetHeight) { + y -= menuOffsetHeight - remainingSpaceOnBottom; + } + } + if (remainingSpaceOnRight >= menuOffsetWidth) { + menu.setBounds({ x: bounds.x + bounds.width, y }); + } else { + const x = bounds.x - menuOffsetWidth; + const leftDelta = remainingSpaceOnLeft + x; + if (leftDelta >= 0) { + menu.setBounds({ x, y }); + } else { + menu.setBounds({ x: x - leftDelta, y }); + } + } + } + onSubMenuCollapse(button, menu) { + button.setFocusOverride(void 0); + this.collapsingSubMenus++; + menu.remove(); + this.collapsingSubMenus--; + } + createMenu(expandedItems) { + const { menuWidget } = this; + menuWidget.clear(); + menuWidget.setTabIndex(-1); + this.createMenuItems(menuWidget, expandedItems); + } + createMenuItems(menuWidget, expandedItems) { + for (const item of expandedItems) { + switch (item.type) { + case "separator": { + const sep = menuWidget.addSeparator(); + sep.classList.add(`${DEFAULT_CONTEXT_MENU_CLASS}__divider`); + break; + } + case "action": { + if (item.items.length === 0) { + const btn = new _Widget4.MenuItemWidget(); + this.initButtonElement(btn, item); + menuWidget.addChild(btn); + } else { + const { subMenuButton, subMenu } = menuWidget.addSubMenu(); + subMenu.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__menu`); + subMenu.addListener("expand-widget", () => this.onSubMenuExpand(subMenuButton, subMenu)); + subMenu.addListener("collapse-widget", () => this.onSubMenuCollapse(subMenuButton, subMenu)); + this.initButtonElement(subMenuButton, item); + this.createMenuItems(subMenu, item.items); + } + break; + } + default: + throw new Error("unhandled case"); + } + } + } + createButtonOnClick(showOn, callback) { + if (ContextMenuRegistry.checkCallback("legend-item", showOn, callback)) { + return (widgetEvent) => { + const event = widgetEvent.sourceEvent; + if (this.pickedLegendItem) { + const { seriesId, itemId, label } = this.pickedLegendItem; + const { chartService: chart } = this.ctx; + if (typeof itemId !== "string") { + Logger5.error(`unexpected itemId type: [${typeof itemId}] (expected [string])`); + return; + } + const series = chart.series.find((s) => s.id === seriesId); + const callers = [series?.properties, chart]; + const apiEvent = { + type: "contextmenu", + seriesId, + itemId, + text: toPlainText(label.text), + event + }; + callWithContext(callers, callback, apiEvent); + this.hide(); + } else { + Logger5.error("legend item not found"); + } + }; + } else if (ContextMenuRegistry.checkCallback("series-area", showOn, callback)) { + return () => { + const caller = this.ctx.chartService; + const apiEvent = { type: "seriesContextMenuAction", event: this.showEvent }; + callWithContext(caller, callback, apiEvent); + this.hide(); + }; + } else if (ContextMenuRegistry.checkCallback("series-node", showOn, callback)) { + return () => { + const { showEvent } = this; + const { chartService: chart } = this.ctx; + const pickedNode = this.pickedNode; + const callers = [pickedNode?.series.properties, chart]; + const apiEvent = pickedNode?.series.createNodeContextMenuActionEvent(showEvent, pickedNode); + if (apiEvent) { + callWithContext(callers, callback, apiEvent); + } else { + Logger5.error("series node not found"); + } + this.hide(); + }; + } + return () => { + const caller = this.ctx.chartService; + const apiEvent = { type: "contextMenuEvent", event: this.showEvent }; + callWithContext(caller, callback, apiEvent); + this.hide(); + }; + } + initTableCells(elem) { + const cellIcon = createElement4("div"); + const cellLabel = createElement4("div"); + const cellArrow = createElement4("div"); + cellIcon.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__icon`, true); + cellLabel.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__cell`, true); + cellArrow.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__cell`, true); + cellIcon.ariaHidden = "true"; + cellLabel.role = "presentation"; + cellArrow.ariaHidden = "true"; + elem.append(cellIcon, cellLabel, cellArrow); + return { cellIcon, cellLabel, cellArrow }; + } + initButtonElement(button, item) { + button.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__item`); + button.setEnabled(item.enabled); + const label = this.ctx.localeManager.t(item.label); + const cellPaddingClass = `${DEFAULT_CONTEXT_MENU_CLASS}__cellpadding`; + const { cellIcon, cellLabel, cellArrow } = this.initTableCells(button.getElement()); + cellLabel.textContent = label; + cellLabel.classList.add(cellPaddingClass); + if (item.iconUrl != null) { + const img = createElement4("img"); + img.src = item.iconUrl; + cellIcon.append(img); + cellIcon.classList.add(cellPaddingClass); + } + if (item.items.length > 0) { + const span = createElement4("span", getIconClassNames3("chevron-right")); + cellArrow.append(span); + cellArrow.classList.add(cellPaddingClass); + } + const { showOn, action } = item; + if (action != null) { + button.addListener("click", this.createButtonOnClick(showOn, action)); + } + if (item.items.length === 0) { + button.addListener("mouseleave", () => button.setFocusOverride(false)); + button.addListener("mouseenter", () => button.setFocusOverride(void 0)); + } + } + reposition() { + let { x, y } = this; + this.element.style.top = "unset"; + this.element.style.bottom = "unset"; + const canvasRect = this.ctx.domManager.getBoundingClientRect(); + const { offsetWidth: width, offsetHeight: height } = this.element; + x = clamp5(0, x, canvasRect.width - width); + y = clamp5(0, y, canvasRect.height - height); + this.element.style.left = `${x}px`; + this.element.style.top = `calc(${y}px - 0.5em)`; + } + destroy() { + super.destroy(); + this.mutationObserver?.disconnect(); + this.ctx.domManager.removeStyles(moduleId2); + this.ctx.domManager.removeChild("canvas-overlay", moduleId2); + } +}; +__decorateClass([ + Property38 +], ContextMenu.prototype, "enabled", 2); +__decorateClass([ + Property38 +], ContextMenu.prototype, "darkTheme", 2); +__decorateClass([ + Property38 +], ContextMenu.prototype, "items", 2); + +// packages/ag-charts-enterprise/src/features/context-menu/contextMenuModule.ts +var ContextMenuModule = { + type: "root", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + optionsKey: "contextMenu", + moduleFactory: (ctx) => new ContextMenu(ctx), + themeTemplate: { + contextMenu: { + enabled: true, + darkTheme: _ModuleSupport95.ThemeSymbols.IS_DARK_THEME + } + } +}; + +// packages/ag-charts-enterprise/src/features/crosshair/crosshair.ts +import { _ModuleSupport as _ModuleSupport97 } from "ag-charts-community"; +import { createId as createId4, toPlainText as toPlainText2 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/utils/datum.ts +function readDatum(nodeDatum) { + if (typeof nodeDatum?.datum === "object") { + return nodeDatum.datum; + } + return null; +} + +// packages/ag-charts-enterprise/src/features/crosshair/crosshairLabel.ts +import { _ModuleSupport as _ModuleSupport96 } from "ag-charts-community"; +import { createId as createId3, setAttribute as setAttribute2 } from "ag-charts-core"; +var { FormatManager, BaseProperties: BaseProperties13, Property: Property39 } = _ModuleSupport96; +var DEFAULT_LABEL_CLASS = "ag-charts-crosshair-label"; +var CrosshairLabelProperties = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.enabled = true; + this.xOffset = 0; + this.yOffset = 0; + this.format = void 0; + this.renderer = void 0; + this._cachedFormatter = void 0; + } + formatValue(callWithContext2, type, value, params) { + const { formatter, format } = this; + const { domain, boundSeries } = params; + let result; + if (formatter != null) { + const fractionDigits = params.type === "number" ? params.fractionDigits : void 0; + const unit = params.type === "date" ? params.unit : void 0; + const step = params.type === "date" ? params.step : void 0; + result = callWithContext2(formatter, { value, domain, fractionDigits, unit, step, boundSeries }); + } + if (format != null) { + let cachedFormatter = this._cachedFormatter; + if (cachedFormatter == null || cachedFormatter.type !== type || cachedFormatter.format !== format) { + cachedFormatter = { + type, + format, + formatter: FormatManager.getFormatter(type, format) + }; + this._cachedFormatter = cachedFormatter; + } + result ?? (result = cachedFormatter.formatter?.(value)); + } + return result == null ? void 0 : String(result); + } +}; +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "enabled", 2); +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "xOffset", 2); +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "yOffset", 2); +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "formatter", 2); +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "format", 2); +__decorateClass([ + Property39 +], CrosshairLabelProperties.prototype, "renderer", 2); +var CrosshairLabel = class extends CrosshairLabelProperties { + constructor(domManager, key, axisId) { + super(); + this.domManager = domManager; + this.id = createId3(this); + this.element = domManager.addChild("canvas-overlay", `crosshair-label-${this.id}`); + this.element.classList.add(DEFAULT_LABEL_CLASS); + setAttribute2(this.element, "aria-hidden", true); + this.element.dataset.key = key; + this.element.dataset.axisId = axisId; + } + show(meta) { + const { element } = this; + const left = meta.x + this.xOffset; + const top = meta.y + this.yOffset; + element.style.top = `${Math.round(top)}px`; + element.style.left = `${Math.round(left)}px`; + this.toggle(true); + } + setLabelHtml({ html, styles }) { + if (html !== void 0) { + this.element.innerHTML = html; + } + if (styles !== void 0) { + const styleElement = this.element.children[0] ?? this.element; + Object.assign(styleElement.style, styles); + } + } + getBBox() { + const { element } = this; + return new _ModuleSupport96.BBox( + element.clientLeft, + element.clientTop, + element.clientWidth, + element.clientHeight + ); + } + toggle(visible) { + this.element.classList.toggle(`ag-charts-crosshair-label--hidden`, !visible); + } + destroy() { + this.domManager.removeChild("canvas-overlay", `crosshair-label-${this.id}`); + } + toLabelHtml(input, defaults) { + if (typeof input === "string") { + return { html: input, styles: {} }; + } + defaults = defaults ?? {}; + const { + text: text2 = defaults.text ?? "", + color: color6 = defaults.color, + backgroundColor = defaults.backgroundColor, + opacity = defaults.opacity ?? 1 + } = input; + const styles = { + opacity, + "background-color": backgroundColor?.toLowerCase(), + color: color6 + }; + return { + html: `
+ ${text2} +
`, + styles + }; + } +}; + +// packages/ag-charts-enterprise/src/features/crosshair/crosshair.ts +var { Group: Group5, TranslatableGroup: TranslatableGroup2, Line: Line4, BBox: BBox5, InteractionState: InteractionState4, Property: Property40, ZIndexMap: ZIndexMap5, ChartAxisDirection: ChartAxisDirection11 } = _ModuleSupport97; +var Crosshair = class extends _ModuleSupport97.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.id = createId4(this); + this.enabled = false; + this.stroke = "rgb(195, 195, 195)"; + this.lineDash = [6, 3]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.snap = true; + this.label = new CrosshairLabelProperties(); + this.seriesRect = new BBox5(0, 0, 0, 0); + this.bounds = new BBox5(0, 0, 0, 0); + this.crosshairGroup = new TranslatableGroup2({ + name: "crosshairs", + zIndex: ZIndexMap5.SERIES_CROSSHAIR + }); + this.lineGroup = this.crosshairGroup.appendChild( + new Group5({ + name: `${this.id}-crosshair-lines`, + zIndex: ZIndexMap5.SERIES_CROSSHAIR + }) + ); + this.lineGroupSelection = _ModuleSupport97.Selection.select(this.lineGroup, Line4, false); + this.activeHighlight = void 0; + this.axisCtx = ctx.parent; + this.labels = {}; + this.hideCrosshairs(); + ctx.domManager.addEventListener("focusin", ({ target }) => { + const isSeriesAreaChild = target instanceof HTMLElement && ctx.domManager.contains(target, "series-area"); + if (this.crosshairGroup.visible && !isSeriesAreaChild) { + this.hideCrosshairs(); + this.ctx.updateService.update(_ModuleSupport97.ChartUpdateType.PERFORM_LAYOUT); + } + }); + const { seriesDragInterpreter } = ctx.widgets; + this.cleanup.register( + ctx.scene.attachNode(this.crosshairGroup), + ctx.widgets.seriesWidget.addListener("mousemove", (event) => this.onMouseHoverLike(event)), + ctx.widgets.seriesWidget.addListener("mouseleave", () => this.onMouseOut()), + ctx.eventsHub.on("series:focus-change", () => this.onKeyPress()), + ctx.eventsHub.on("zoom:pan-start", () => this.onMouseOut()), + ctx.eventsHub.on("zoom:change", () => this.onMouseOut()), + ctx.eventsHub.on("highlight:change", (event) => this.onHighlightChange(event)), + ctx.eventsHub.on("layout:complete", (event) => this.layout(event)), + () => { + for (const label of Object.values(this.labels)) { + label.destroy(); + } + } + ); + if (seriesDragInterpreter) { + this.cleanup.register( + seriesDragInterpreter.events.on("drag-move", (event) => this.onMouseHoverLike(event)), + seriesDragInterpreter.events.on("click", (event) => this.onClick(event)) + ); + } + } + layout({ series: { rect, visible }, axes }) { + if (!visible || !axes || !this.enabled) + return; + this.seriesRect = rect; + const { position: axisPosition = "left", axisId } = this.axisCtx; + const axisLayout = axes.find((a) => a.id === axisId); + if (!axisLayout) + return; + this.axisLayout = axisLayout; + this.bounds = rect.clone().grow(axisLayout.gridPadding + axisLayout.seriesAreaPadding, axisPosition); + const { crosshairGroup, bounds } = this; + crosshairGroup.translationX = Math.round(bounds.x); + crosshairGroup.translationY = Math.round(bounds.y); + const crosshairKeys = ["pointer", ...this.axisCtx.seriesKeyProperties()]; + this.updateSelections(crosshairKeys); + this.updateLines(); + this.updateLabels(crosshairKeys); + } + updateSelections(data) { + this.lineGroupSelection.update(data, void 0, (key) => key); + } + updateLabels(keys) { + const { labels, ctx } = this; + for (const key of keys) { + if (this.label.enabled) { + labels[key] ?? (labels[key] = new CrosshairLabel(ctx.domManager, key, this.axisCtx.axisId)); + } + if (labels[key]) { + this.updateLabel(labels[key]); + } + } + } + updateLabel(label) { + const { enabled, xOffset, yOffset, format, renderer } = this.label; + label.enabled = enabled; + label.xOffset = xOffset; + label.yOffset = yOffset; + label.format = format; + label.renderer = renderer; + } + updateLines() { + const { lineGroupSelection, bounds, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset, axisLayout } = this; + if (!axisLayout) + return; + const isVertical = this.isVertical(); + lineGroupSelection.each((line) => { + line.stroke = stroke2; + line.strokeWidth = strokeWidth; + line.strokeOpacity = strokeOpacity; + line.lineDash = lineDash; + line.lineDashOffset = lineDashOffset; + line.y1 = 0; + line.y2 = isVertical ? bounds.height : 0; + line.x1 = 0; + line.x2 = isVertical ? 0 : bounds.width; + }); + } + isVertical() { + return this.axisCtx.direction === ChartAxisDirection11.X; + } + isHover(event) { + return event.type === "mousemove" || event.type === "click" || event.device === "touch" && this.ctx.chartService.touch.dragAction === "hover"; + } + formatValue(value) { + return toPlainText2(this.axisCtx.formatScaleValue(value, "crosshair", this.label)); + } + onClick(event) { + if (event.device === "touch") { + this.onMouseHoverLike(event); + } + } + onMouseHoverLike(event) { + if (!this.enabled || this.snap) + return; + const requiredState = this.isHover(event) ? InteractionState4.Clickable : InteractionState4.AnnotationsMoveable; + if (!this.ctx.interactionManager.isState(requiredState)) + return; + this.updatePositions(this.getData(event)); + this.crosshairGroup.visible = true; + this.ctx.updateService.update(_ModuleSupport97.ChartUpdateType.SCENE_RENDER); + } + onMouseOut() { + if (!this.ctx.interactionManager.isState(InteractionState4.Clickable)) + return; + this.hideCrosshairs(); + this.ctx.updateService.update(_ModuleSupport97.ChartUpdateType.SCENE_RENDER); + } + onKeyPress() { + if (this.enabled && !this.snap && this.ctx.interactionManager.isState(InteractionState4.Default)) { + this.hideCrosshairs(); + } + } + onHighlightChange(event) { + if (!this.enabled) + return; + const { crosshairGroup, axisCtx } = this; + const { datum, series } = event.currentHighlight ?? {}; + const hasCrosshair = datum && (series?.axes.x?.id === axisCtx.axisId || series?.axes.y?.id === axisCtx.axisId); + this.activeHighlight = hasCrosshair ? event.currentHighlight : void 0; + if (!this.activeHighlight) { + this.hideCrosshairs(); + } else if (this.snap) { + const activeHighlightData = this.getActiveHighlightData(this.activeHighlight); + this.updatePositions(activeHighlightData); + crosshairGroup.visible = true; + } + } + isInRange(value) { + return this.axisCtx.inRange(value); + } + updatePositions(data) { + const { seriesRect, lineGroupSelection } = this; + lineGroupSelection.each((line, key) => { + const lineData = data[key]; + if (!lineData) { + line.visible = false; + this.hideLabel(key); + return; + } + line.visible = true; + const { value, position } = lineData; + let x = 0; + let y = 0; + if (this.isVertical()) { + x = position; + line.x = Math.round(x); + } else { + y = position; + line.y = Math.round(y); + } + if (this.label.enabled) { + this.showLabel(x + seriesRect.x, y + seriesRect.y, value, key); + } else { + this.hideLabel(key); + } + }); + } + getData(event) { + const { axisCtx } = this; + const key = "pointer"; + const { xKey = "", yKey = "" } = this.activeHighlight ?? {}; + const { currentX, currentY } = event; + const datum = readDatum(this.activeHighlight); + const isVertical = this.isVertical(); + const position = isVertical ? currentX : currentY; + let value = datum?.[isVertical ? xKey : yKey] ?? ""; + if (axisCtx.continuous) { + value = axisCtx.scaleInvert(position); + } + return { [key]: { position, value } }; + } + getActiveHighlightData(activeHighlight) { + const { axisCtx } = this; + const { series, xKey = "", aggregatedValue, cumulativeValue, midPoint } = activeHighlight; + const datum = readDatum(activeHighlight); + const seriesKeyProperties = series.getKeyProperties(axisCtx.direction); + const halfBandwidth = (axisCtx.scale.bandwidth ?? 0) / 2; + const matchingAxisId = series.axes[axisCtx.direction]?.id === axisCtx.axisId; + const isYKey = seriesKeyProperties.includes("yKey") && matchingAxisId; + const isXKey = seriesKeyProperties.includes("xKey") && matchingAxisId; + const datumValue = aggregatedValue ?? cumulativeValue; + if (isYKey && datumValue !== void 0) { + const position = axisCtx.scale.convert(datumValue) + halfBandwidth; + const isInRange = this.isInRange(position); + return isInRange ? { + yKey: { value: datumValue, position } + } : {}; + } + if (isXKey) { + const position = (this.isVertical() ? midPoint?.x : midPoint?.y) ?? 0; + const value = axisCtx.continuous ? axisCtx.scaleInvert(position) : datum?.[xKey]; + return this.isInRange(position) ? { xKey: { value, position } } : {}; + } + const activeHighlightData = {}; + for (const key of seriesKeyProperties) { + const keyValue = series.properties[key]; + const value = datum?.[keyValue]; + const position = axisCtx.scale.convert(value) + halfBandwidth; + const isInRange = this.isInRange(position); + if (isInRange) { + activeHighlightData[key] = { value, position }; + } + } + return activeHighlightData; + } + getLabelHtml(value, label) { + const fractionDigits = this.axisLayout?.label?.fractionDigits ?? 0; + const defaults = { text: this.formatValue(value) }; + if (this.label.renderer) { + return label.toLabelHtml(this.label.renderer({ value, fractionDigits }), defaults); + } + return label.toLabelHtml(defaults); + } + showLabel(x, y, value, key) { + if (!this.axisLayout) + return; + const { bounds } = this; + const label = this.labels[key]; + const html = this.getLabelHtml(value, label); + label.setLabelHtml(html); + const { width, height } = label.getBBox(); + const axisPosition = this.axisCtx.position; + let padding = this.axisLayout.label.spacing + this.axisLayout.tickSize; + if (this.axisCtx.direction === ChartAxisDirection11.X) { + padding -= 4; + label.show({ + x: x - width / 2, + y: axisPosition === "bottom" ? bounds.y + bounds.height + padding : bounds.y - height - padding + }); + } else { + padding -= 8; + label.show({ + x: axisPosition === "right" ? bounds.x + bounds.width + padding : bounds.x - width - padding, + y: y - height / 2 + }); + } + } + hideCrosshairs() { + this.crosshairGroup.visible = false; + for (const key of Object.keys(this.labels)) { + this.hideLabel(key); + } + } + hideLabel(key) { + this.labels[key]?.toggle(false); + } +}; +__decorateClass([ + Property40 +], Crosshair.prototype, "enabled", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "stroke", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "lineDash", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "lineDashOffset", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "strokeWidth", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "strokeOpacity", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "snap", 2); +__decorateClass([ + Property40 +], Crosshair.prototype, "label", 2); + +// packages/ag-charts-enterprise/src/features/crosshair/crosshairModule.ts +var CrosshairModule = { + type: "axis-option", + optionsKey: "crosshair", + packageType: "enterprise", + chartTypes: ["cartesian"], + axisTypes: ["category", "time", "unit-time", "ordinal-time", "number", "log"], + moduleFactory: (ctx) => new Crosshair(ctx), + themeTemplate: { + crosshair: { + snap: true, + stroke: { $ref: "subtleTextColor" }, + strokeWidth: 1, + strokeOpacity: 1, + lineDash: [5, 6], + lineDashOffset: 0, + label: { + enabled: true + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/data-source/dataSource.ts +import { _ModuleSupport as _ModuleSupport98 } from "ag-charts-community"; +var { ActionOnSet: ActionOnSet5, Property: Property41 } = _ModuleSupport98; +var DataSource = class extends _ModuleSupport98.BaseModuleInstance { + constructor(ctx) { + super(); + this.enabled = false; + this.getData = () => Promise.resolve(); + this.dataService = ctx.dataService; + } + updateCallback(enabled, getData) { + if (!this.dataService) + return; + if (enabled && getData != null) { + this.dataService.updateCallback(getData); + } else { + this.dataService.clearCallback(); + } + } +}; +__decorateClass([ + ActionOnSet5({ + newValue(enabled) { + this.updateCallback(enabled, this.getData); + } + }), + Property41 +], DataSource.prototype, "enabled", 2); +__decorateClass([ + ActionOnSet5({ + newValue(getData) { + this.updateCallback(this.enabled, getData); + } + }), + Property41 +], DataSource.prototype, "getData", 2); +__decorateClass([ + ActionOnSet5({ + newValue(requestThrottle) { + this.dataService.requestThrottle = requestThrottle; + } + }) +], DataSource.prototype, "requestThrottle", 2); +__decorateClass([ + ActionOnSet5({ + newValue(updateThrottle) { + this.dataService.dispatchThrottle = updateThrottle; + } + }) +], DataSource.prototype, "updateThrottle", 2); +__decorateClass([ + ActionOnSet5({ + newValue(updateDuringInteraction) { + this.dataService.dispatchOnlyLatest = !updateDuringInteraction; + } + }) +], DataSource.prototype, "updateDuringInteraction", 2); + +// packages/ag-charts-enterprise/src/features/data-source/dataSourceModule.ts +var DataSourceModule = { + type: "root", + optionsKey: "dataSource", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new DataSource(ctx), + themeTemplate: { + dataSource: { enabled: false } + } +}; + +// packages/ag-charts-enterprise/src/features/error-bar/errorBarModule.ts +import { AgErrorBarSupportedSeriesTypes as AgErrorBarSupportedSeriesTypes2 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/error-bar/errorBar.ts +import { AgErrorBarSupportedSeriesTypes, _ModuleSupport as _ModuleSupport101 } from "ag-charts-community"; +import { Logger as Logger6, isDefined } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/error-bar/errorBarNode.ts +import { _ModuleSupport as _ModuleSupport99 } from "ag-charts-community"; +var { nearestSquared, nearestSquaredInContainer, partialAssign, mergeDefaults, BBox: BBox6 } = _ModuleSupport99; +var HierarchicalBBox = class { + constructor(components) { + this.components = components; + this.union = BBox6.merge(components); + } + containsPoint(x, y) { + if (!this.union.containsPoint(x, y)) { + return false; + } + for (const bbox of this.components) { + if (bbox.containsPoint(x, y)) { + return true; + } + } + return false; + } +}; +var ErrorBarNode = class extends _ModuleSupport99.Group { + constructor() { + super(); + this.capLength = Number.NaN; + this._datum = void 0; + this.whiskerPath = new _ModuleSupport99.Path(); + this.capsPath = new _ModuleSupport99.Path(); + this.bboxes = new HierarchicalBBox([]); + this.append([this.whiskerPath, this.capsPath]); + } + get datum() { + return this._datum; + } + set datum(datum) { + this._datum = datum; + } + calculateCapLength(capsTheme, capDefaults) { + const { lengthRatio = 1, length } = capsTheme; + const { lengthRatioMultiplier, lengthMax } = capDefaults; + const desiredLength = length ?? lengthRatio * lengthRatioMultiplier; + return Math.min(desiredLength, lengthMax); + } + getItemStylerParams(options, style, highlighted, highlightState) { + const { datum } = this; + if (datum == null || options.itemStyler == null) + return; + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = options; + return { + ...style, + datum: datum.datum, + seriesId: datum.series.id, + xKey: datum.xKey, + yKey: datum.yKey, + xLowerKey, + xUpperKey, + yLowerKey, + yUpperKey, + highlighted, + highlightState + }; + } + formatStyles(style, options, caller, highlighted, highlightState) { + let { cap: capsStyle, ...whiskerStyle } = style; + const params = this.getItemStylerParams(options, style, highlighted, highlightState); + if (params != null && options.itemStyler != null) { + const result = caller.callWithContext(options.itemStyler, params); + whiskerStyle = mergeDefaults(result, whiskerStyle); + capsStyle = mergeDefaults(result?.cap, result, capsStyle); + } + return { whiskerStyle, capsStyle }; + } + applyStyling(target, source) { + partialAssign( + ["visible", "stroke", "strokeWidth", "strokeOpacity", "lineDash", "lineDashOffset"], + target, + source + ); + } + update(style, formatters, caller, highlighted, highlightState) { + if (this.datum === void 0) { + return; + } + const { whiskerStyle, capsStyle } = this.formatStyles(style, formatters, caller, highlighted, highlightState); + const { xBar, yBar, capDefaults } = this.datum; + const whisker = this.whiskerPath; + this.applyStyling(whisker, whiskerStyle); + whisker.path.clear(true); + if (yBar !== void 0) { + whisker.path.moveTo(yBar.lowerPoint.x, yBar.lowerPoint.y); + whisker.path.lineTo(yBar.upperPoint.x, yBar.upperPoint.y); + } + if (xBar !== void 0) { + whisker.path.moveTo(xBar.lowerPoint.x, xBar.lowerPoint.y); + whisker.path.lineTo(xBar.upperPoint.x, xBar.upperPoint.y); + } + whisker.path.closePath(); + this.capLength = this.calculateCapLength(capsStyle ?? {}, capDefaults); + const capOffset = this.capLength / 2; + const caps = this.capsPath; + this.applyStyling(caps, capsStyle); + caps.path.clear(true); + if (yBar !== void 0) { + caps.path.moveTo(yBar.lowerPoint.x - capOffset, yBar.lowerPoint.y); + caps.path.lineTo(yBar.lowerPoint.x + capOffset, yBar.lowerPoint.y); + caps.path.moveTo(yBar.upperPoint.x - capOffset, yBar.upperPoint.y); + caps.path.lineTo(yBar.upperPoint.x + capOffset, yBar.upperPoint.y); + } + if (xBar !== void 0) { + caps.path.moveTo(xBar.lowerPoint.x, xBar.lowerPoint.y - capOffset); + caps.path.lineTo(xBar.lowerPoint.x, xBar.lowerPoint.y + capOffset); + caps.path.moveTo(xBar.upperPoint.x, xBar.upperPoint.y - capOffset); + caps.path.lineTo(xBar.upperPoint.x, xBar.upperPoint.y + capOffset); + } + caps.path.closePath(); + } + updateBBoxes() { + const { capLength, whiskerPath: whisker, capsPath: caps } = this; + const { yBar, xBar } = this.datum ?? {}; + const capOffset = capLength / 2; + const components = []; + if (yBar !== void 0) { + const whiskerHeight = yBar.lowerPoint.y - yBar.upperPoint.y; + components.push( + new BBox6(yBar.lowerPoint.x, yBar.upperPoint.y, whisker.strokeWidth, whiskerHeight), + new BBox6(yBar.lowerPoint.x - capOffset, yBar.lowerPoint.y, capLength, caps.strokeWidth), + new BBox6(yBar.upperPoint.x - capOffset, yBar.upperPoint.y, capLength, caps.strokeWidth) + ); + } + if (xBar !== void 0) { + const whiskerWidth = xBar.upperPoint.x - xBar.lowerPoint.x; + components.push( + new BBox6(xBar.lowerPoint.x, xBar.upperPoint.y, whiskerWidth, whisker.strokeWidth), + new BBox6(xBar.lowerPoint.x, xBar.lowerPoint.y - capOffset, caps.strokeWidth, capLength), + new BBox6(xBar.upperPoint.x, xBar.upperPoint.y - capOffset, caps.strokeWidth, capLength) + ); + } + this.bboxes.components = components; + this.bboxes.union = BBox6.merge(components); + } + containsPoint(x, y) { + return this.bboxes.containsPoint(x, y); + } + pickNode(x, y) { + return this.containsPoint(x, y) ? this : void 0; + } + nearestSquared(x, y, maxDistance) { + const { bboxes } = this; + if (bboxes.union.distanceSquared(x, y) > maxDistance) { + return { nearest: void 0, distanceSquared: Infinity }; + } + const { distanceSquared } = nearestSquared(x, y, bboxes.components); + return { nearest: this, distanceSquared }; + } +}; +var ErrorBarGroup = class extends _ModuleSupport99.Group { + nearestSquared(x, y) { + const { nearest, distanceSquared } = nearestSquaredInContainer(x, y, { + children: this.children() + }); + if (nearest !== void 0 && !Number.isNaN(distanceSquared)) { + return { datum: nearest.datum, distanceSquared }; + } + } +}; + +// packages/ag-charts-enterprise/src/features/error-bar/errorBarProperties.ts +import { + _ModuleSupport as _ModuleSupport100 +} from "ag-charts-community"; +var { BaseProperties: BaseProperties14, Property: Property42 } = _ModuleSupport100; +var ErrorBarCap = class extends BaseProperties14 { +}; +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "visible", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "stroke", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "strokeWidth", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "strokeOpacity", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "lineDash", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "lineDashOffset", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "length", 2); +__decorateClass([ + Property42 +], ErrorBarCap.prototype, "lengthRatio", 2); +var ErrorBarProperties = class extends BaseProperties14 { + constructor() { + super(...arguments); + this.visible = true; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cap = new ErrorBarCap(); + } +}; +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "yLowerKey", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "yLowerName", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "yUpperKey", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "yUpperName", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "xLowerKey", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "xLowerName", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "xUpperKey", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "xUpperName", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "visible", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property42 +], ErrorBarProperties.prototype, "cap", 2); + +// packages/ag-charts-enterprise/src/features/error-bar/errorBar.ts +var { fixNumericExtent, groupAccumulativeValueProperty, mergeDefaults: mergeDefaults2, valueProperty: valueProperty2, ChartAxisDirection: ChartAxisDirection12 } = _ModuleSupport101; +function toErrorBoundCartesianSeries(ctx) { + for (const supportedType of AgErrorBarSupportedSeriesTypes) { + if (supportedType === ctx.series.type) { + return ctx.series; + } + } + throw new Error( + `AG Charts - unsupported series type '${ctx.series.type}', error bars supported series types: ${AgErrorBarSupportedSeriesTypes.join(", ")}` + ); +} +var ErrorBars = class _ErrorBars extends _ModuleSupport101.BaseModuleInstance { + constructor(ctx) { + super(); + this.properties = new ErrorBarProperties(); + const series = toErrorBoundCartesianSeries(ctx); + const { annotationGroup, annotationSelections } = series; + this.cartesianSeries = series; + this.groupNode = new ErrorBarGroup({ + name: `${annotationGroup.id}-errorBars` + }); + annotationGroup.appendChild(this.groupNode); + this.selection = _ModuleSupport101.Selection.select(this.groupNode, () => this.errorBarFactory()); + annotationSelections.add(this.selection); + series.addEventListener("seriesVisibilityChange", (e) => this.onToggleSeriesItem(e)); + this.cleanup.register( + series.events.on("data-processed", (e) => this.onDataProcessed(e)), + series.events.on("data-update", (e) => this.onDataUpdate(e)), + ctx.eventsHub.on("highlight:change", (event) => this.onHighlightChange(event)), + () => this.groupNode.remove(), + () => annotationSelections.delete(this.selection) + ); + } + hasErrorBars() { + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = this.properties; + return isDefined(xLowerKey) && isDefined(xUpperKey) || isDefined(yLowerKey) && isDefined(yUpperKey); + } + isStacked() { + const stackCount = this.cartesianSeries.seriesGrouping?.stackCount; + return stackCount == null ? false : stackCount > 0; + } + getUnstackPropertyDefinition(opts) { + const props = []; + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey, xErrorsID, yErrorsID } = this.getMaybeFlippedKeys(); + const { xScaleType, yScaleType } = opts; + if (yLowerKey != null && yUpperKey != null) { + props.push( + valueProperty2(yLowerKey, yScaleType, { id: `${yErrorsID}-lower` }), + valueProperty2(yUpperKey, yScaleType, { id: `${yErrorsID}-upper` }) + ); + } + if (xLowerKey != null && xUpperKey != null) { + props.push( + valueProperty2(xLowerKey, xScaleType, { id: `${xErrorsID}-lower` }), + valueProperty2(xUpperKey, xScaleType, { id: `${xErrorsID}-upper` }) + ); + } + return props; + } + getStackPropertyDefinition(opts) { + const props = []; + const { cartesianSeries } = this; + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey, xErrorsID, yErrorsID } = this.getMaybeFlippedKeys(); + const { xScaleType, yScaleType } = opts; + const groupIndex = cartesianSeries.seriesGrouping?.groupIndex ?? cartesianSeries.id; + const groupOpts = { + invalidValue: null, + missingValue: 0, + separateNegative: true, + ...cartesianSeries.visible ? {} : { forceValue: 0 } + }; + const makeErrorProperty = (key, id, type, scaleType) => { + return groupAccumulativeValueProperty( + key, + "normal", + { + id: `${id}-${type}`, + groupId: `errorGroup-${groupIndex}-${type}`, + ...groupOpts + }, + scaleType + ); + }; + const pushErrorProperties = (lowerKey, upperKey, id, scaleType) => { + props.push( + ...makeErrorProperty(lowerKey, id, "lower", scaleType), + ...makeErrorProperty(upperKey, id, "upper", scaleType) + ); + }; + if (yLowerKey != null && yUpperKey != null) { + pushErrorProperties(yLowerKey, yUpperKey, yErrorsID, yScaleType); + } + if (xLowerKey != null && xUpperKey != null) { + pushErrorProperties(xLowerKey, xUpperKey, xErrorsID, xScaleType); + } + return props; + } + getPropertyDefinitions(opts) { + if (this.isStacked()) { + return this.getStackPropertyDefinition(opts); + } else { + return this.getUnstackPropertyDefinition(opts); + } + } + onDataProcessed(event) { + this.dataModel = event.dataModel; + this.processedData = event.processedData; + } + getDomain(direction) { + const { xLowerKey, xUpperKey, xErrorsID, yLowerKey, yUpperKey, yErrorsID } = this.getMaybeFlippedKeys(); + const hasAxisErrors = direction === ChartAxisDirection12.X ? isDefined(xLowerKey) && isDefined(xUpperKey) : isDefined(yLowerKey) && isDefined(yUpperKey); + if (hasAxisErrors) { + const { dataModel, processedData, cartesianSeries: series } = this; + if (dataModel != null && processedData != null) { + const id = { x: xErrorsID, y: yErrorsID }[direction]; + const lowerDomain = dataModel.getDomain(series, `${id}-lower`, "value", processedData); + const upperDomain = dataModel.getDomain(series, `${id}-upper`, "value", processedData); + const domain = [Math.min(...lowerDomain, ...upperDomain), Math.max(...lowerDomain, ...upperDomain)]; + return fixNumericExtent(domain); + } + } + return []; + } + onDataUpdate(event) { + this.dataModel = event.dataModel; + this.processedData = event.processedData; + if (isDefined(event.dataModel) && isDefined(event.processedData)) { + this.createNodeData(); + this.update(); + } + } + getNodeData() { + return this.hasErrorBars() ? this.cartesianSeries.contextNodeData?.nodeData : void 0; + } + createNodeData() { + const nodeData = this.getNodeData(); + const xScale = this.cartesianSeries.axes[ChartAxisDirection12.X]?.scale; + const yScale = this.cartesianSeries.axes[ChartAxisDirection12.Y]?.scale; + if (!xScale || !yScale || !nodeData) { + return; + } + for (let i = 0; i < nodeData.length; i++) { + const { midPoint, xLower, xUpper, yLower, yUpper } = this.getDatum(nodeData, i); + if (midPoint != null) { + let xBar, yBar; + if (isDefined(xLower) && isDefined(xUpper)) { + xBar = { + lowerPoint: { x: this.convert(xScale, xLower), y: midPoint.y }, + upperPoint: { x: this.convert(xScale, xUpper), y: midPoint.y } + }; + } + if (isDefined(yLower) && isDefined(yUpper)) { + yBar = { + lowerPoint: { x: midPoint.x, y: this.convert(yScale, yLower) }, + upperPoint: { x: midPoint.x, y: this.convert(yScale, yUpper) } + }; + } + nodeData[i].xBar = xBar; + nodeData[i].yBar = yBar; + } + } + } + getMaybeFlippedKeys() { + let { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = this.properties; + let [xErrorsID, yErrorsID] = ["xValue-errors", "yValue-errors"]; + if (this.cartesianSeries.shouldFlipXY()) { + [xLowerKey, yLowerKey] = [yLowerKey, xLowerKey]; + [xUpperKey, yUpperKey] = [yUpperKey, xUpperKey]; + [xErrorsID, yErrorsID] = [yErrorsID, xErrorsID]; + } + return { xLowerKey, xUpperKey, xErrorsID, yLowerKey, yUpperKey, yErrorsID }; + } + static getDatumKey(nodeDatum, key, offset) { + if (key == null) { + return; + } + const datum = readDatum(nodeDatum); + const value = datum?.[key]; + if (value == null) { + return; + } + if (typeof value !== "number") { + Logger6.warnOnce(`Found [${key}] error value of type ${typeof value}. Expected number type`); + return; + } + return value + offset; + } + getDatum(nodeData, datumIndex) { + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = this.getMaybeFlippedKeys(); + const datum = nodeData[datumIndex]; + const d = datum.cumulativeValue == null || !this.isStacked() ? 0 : datum.cumulativeValue - datum.yValue; + const [xOffset, yOffset] = this.cartesianSeries.shouldFlipXY() ? [d, 0] : [0, d]; + return { + midPoint: datum.midPoint, + xLower: _ErrorBars.getDatumKey(datum, xLowerKey, xOffset), + xUpper: _ErrorBars.getDatumKey(datum, xUpperKey, xOffset), + yLower: _ErrorBars.getDatumKey(datum, yLowerKey, yOffset), + yUpper: _ErrorBars.getDatumKey(datum, yUpperKey, yOffset) + }; + } + convert(scale, value) { + const offset = (scale.bandwidth ?? 0) / 2; + return scale.convert(value) + offset; + } + update() { + const nodeData = this.getNodeData(); + if (nodeData != null) { + this.selection.update(nodeData); + this.selection.each((node, datum, i) => this.updateNode(node, datum, i)); + } + } + updateNode(node, datum, _index) { + node.datum = datum; + node.update(this.getDefaultStyle(), this.properties, this.cartesianSeries, false, "none"); + node.updateBBoxes(); + } + pickNodeExact(point) { + const { x, y } = point; + const node = this.groupNode.pickNode(x, y); + if (node != null) { + return { datum: node.datum, distanceSquared: 0 }; + } + } + pickNodeNearest(point) { + return this.groupNode.nearestSquared(point.x, point.y); + } + pickNodeMainAxisFirst(point, majorDirection) { + let closestDatum; + let closestDistance = [Infinity, Infinity]; + const referencePoints = [point.x, point.y]; + if (majorDirection === ChartAxisDirection12.Y) { + referencePoints.reverse(); + } + for (const child of this.groupNode.children()) { + const childBBox = child.getBBox(); + const childReferencePoints = [childBBox.x + childBBox.width / 2, childBBox.y + childBBox.height / 2]; + if (majorDirection === ChartAxisDirection12.Y) { + childReferencePoints.reverse(); + } + const childDistances = []; + for (let i = 0; i < referencePoints.length; i++) { + childDistances.push(Math.abs(referencePoints[i] - childReferencePoints[i])); + } + if (childDistances[0] < closestDistance[0] || childDistances[0] == closestDistance[0] && childDistances[1] < closestDistance[1]) { + closestDatum = child.datum; + closestDistance = childDistances; + } + } + if (closestDatum) { + return { + datum: closestDatum, + distanceSquared: Math.pow(closestDistance[0], 2) + Math.pow(closestDistance[1], 2) + }; + } + } + getTooltipParams() { + const { + xLowerKey, + xUpperKey, + yLowerKey, + yUpperKey, + xLowerName = xLowerKey, + xUpperName = xUpperKey, + yLowerName = yLowerKey, + yUpperName = yUpperKey + } = this.properties; + return { xLowerKey, xLowerName, xUpperKey, xUpperName, yLowerKey, yLowerName, yUpperKey, yUpperName }; + } + onToggleSeriesItem(event) { + this.groupNode.visible = event.visible; + } + makeStyle(baseStyle) { + return { + visible: baseStyle.visible, + lineDash: baseStyle.lineDash, + lineDashOffset: baseStyle.lineDashOffset, + stroke: baseStyle.stroke, + strokeWidth: baseStyle.strokeWidth, + strokeOpacity: baseStyle.strokeOpacity, + cap: mergeDefaults2(this.properties.cap, baseStyle) + }; + } + getDefaultStyle() { + return this.makeStyle(this.getWhiskerProperties()); + } + getHighlightStyle() { + return this.makeStyle(this.getWhiskerProperties()); + } + restyleHighlightChange(highlightChange, style, highlighted) { + const nodeData = this.getNodeData(); + if (nodeData == null) + return; + for (let i = 0; i < nodeData.length; i++) { + if (highlightChange === nodeData[i]) { + this.selection.at(i)?.update( + style, + this.properties, + this.cartesianSeries, + highlighted, + highlighted ? "highlighted-item" : "unhighlighted-item" + ); + break; + } + } + } + onHighlightChange(event) { + const { previousHighlight, currentHighlight } = event; + if (currentHighlight?.series === this.cartesianSeries) { + this.restyleHighlightChange(currentHighlight, this.getHighlightStyle(), true); + } + if (previousHighlight?.series === this.cartesianSeries) { + this.restyleHighlightChange(previousHighlight, this.getDefaultStyle(), false); + } + this.groupNode.opacity = this.cartesianSeries.getOpacity(); + } + errorBarFactory() { + return new ErrorBarNode(); + } + getWhiskerProperties() { + const { stroke: stroke2, strokeWidth, visible, strokeOpacity, lineDash, lineDashOffset } = this.properties; + return { stroke: stroke2, strokeWidth, visible, strokeOpacity, lineDash, lineDashOffset }; + } +}; + +// packages/ag-charts-enterprise/src/features/error-bar/errorBarTheme.ts +var ERROR_BARS_THEME = { + series: { + errorBar: { + visible: true, + stroke: { $ref: "foregroundColor" }, + strokeWidth: 1, + strokeOpacity: 1, + cap: { + length: void 0, + lengthRatio: void 0 + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/error-bar/errorBarModule.ts +var ErrorBarsModule = { + type: "series-option", + identifier: "error-bars", + optionsKey: "errorBar", + packageType: "enterprise", + chartTypes: ["cartesian"], + seriesTypes: AgErrorBarSupportedSeriesTypes2, + moduleFactory: (ctx) => new ErrorBars(ctx), + themeTemplate: ERROR_BARS_THEME +}; + +// packages/ag-charts-enterprise/src/features/foreground/foreground.ts +import { _ModuleSupport as _ModuleSupport102 } from "ag-charts-community"; +var { ZIndexMap: ZIndexMap6, ActionOnSet: ActionOnSet6, Property: Property43, ProxyPropertyOnWrite: ProxyPropertyOnWrite2 } = _ModuleSupport102; +var Foreground = class extends _ModuleSupport102.Background { + constructor() { + super(...arguments); + this.image = new Image(); + this.fill = "transparent"; + this.fillOpacity = void 0; + } + createNode() { + return new _ModuleSupport102.Group({ name: "foreground", zIndex: ZIndexMap6.FOREGROUND }); + } + onLayoutComplete(event) { + super.onLayoutComplete(event); + const { width, height } = event.chart; + let placement = { + x: 0, + y: 0, + width, + height + }; + if (this.image) { + placement = this.image.performLayout(width, height); + } + if (this.text) { + this.updateTextNode(placement); + } + } + onImageLoad() { + this.ctx.updateService.update(_ModuleSupport102.ChartUpdateType.SCENE_RENDER); + } + updateTextNode(placement) { + const { textNode } = this; + textNode.fontWeight = "bold"; + textNode.fontFamily = "Impact, sans-serif"; + textNode.fontSize = 19; + textNode.opacity = 0.7; + textNode.fill = "#9b9b9b"; + textNode.textBaseline = "top"; + const textBBox = this.textNode.getBBox(); + const textPadding = 10; + textNode.x = placement.x + placement.width / 2 - textBBox.width / 2; + textNode.y = placement.y + placement.height + textPadding; + } +}; +__decorateClass([ + Property43, + ActionOnSet6({ + newValue(image) { + this.node.appendChild(image.node); + image.onLoad = () => this.onImageLoad(); + }, + oldValue(image) { + image.node.remove(); + image.onLoad = void 0; + } + }) +], Foreground.prototype, "image", 2); +__decorateClass([ + Property43, + ProxyPropertyOnWrite2("rectNode", "fill") +], Foreground.prototype, "fill", 2); +__decorateClass([ + Property43, + ProxyPropertyOnWrite2("rectNode", "fillOpacity") +], Foreground.prototype, "fillOpacity", 2); + +// packages/ag-charts-enterprise/src/features/foreground/foregroundModule.ts +var ForegroundModule = { + type: "root", + optionsKey: "foreground", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Foreground(ctx) +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigator.ts +import { _ModuleSupport as _ModuleSupport109 } from "ag-charts-community"; +import { Logger as Logger8, clamp as clamp7 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/navigator/miniChart.ts +import { _ModuleSupport as _ModuleSupport104 } from "ag-charts-community"; +import { Logger as Logger7, calcLineHeight as calcLineHeight4 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/navigator/shapes/miniChartGroup.ts +import { _ModuleSupport as _ModuleSupport103 } from "ag-charts-community"; +var { TranslatableGroup: TranslatableGroup3, SceneChangeDetection } = _ModuleSupport103; +var MiniChartGroup = class extends TranslatableGroup3 { + constructor() { + super(...arguments); + this.inset = 0; + this.cornerRadius = 0; + } + applyClip(ctx, clipRect) { + const { cornerRadius, inset } = this; + const { x, y, width, height } = clipRect; + const path = new Path2D(); + path.roundRect(x + inset, y + inset, width - 2 * inset, height - 2 * inset, cornerRadius); + ctx.clip(path); + } +}; +__decorateClass([ + SceneChangeDetection() +], MiniChartGroup.prototype, "inset", 2); +__decorateClass([ + SceneChangeDetection() +], MiniChartGroup.prototype, "cornerRadius", 2); + +// packages/ag-charts-enterprise/src/features/navigator/miniChart.ts +var { Property: Property44, ZIndexMap: ZIndexMap7, ActionOnSet: ActionOnSet7, CategoryAxis, Padding, Group: Group6, BBox: BBox7, ProxyProperty: ProxyProperty2, stackCartesianSeries } = _ModuleSupport104; +var MiniChartPadding = class { + constructor() { + this.top = 0; + this.bottom = 0; + } +}; +__decorateClass([ + Property44 +], MiniChartPadding.prototype, "top", 2); +__decorateClass([ + Property44 +], MiniChartPadding.prototype, "bottom", 2); +var MiniChart = class extends _ModuleSupport104.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.padding = new MiniChartPadding(); + this.root = new Group6({ name: "root" }); + this.seriesRoot = this.root.appendChild( + new MiniChartGroup({ name: "Series-root", zIndex: ZIndexMap7.SERIES_LAYER, renderToOffscreenCanvas: true }) + ); + this.axisGridGroup = this.root.appendChild(new Group6({ name: "Axes-Grids", zIndex: ZIndexMap7.AXIS_GRID })); + this.axisGroup = this.root.appendChild(new Group6({ name: "Axes-Grids", zIndex: ZIndexMap7.AXIS_GRID })); + this.axisLabelGroup = this.root.appendChild(new Group6({ name: "Axes-Labels", zIndex: ZIndexMap7.SERIES_LABEL })); + this.axisCrosslineRangeGroup = this.root.appendChild( + new Group6({ name: "Axes-Crosslines-Range", zIndex: ZIndexMap7.SERIES_CROSSLINE_RANGE }) + ); + this.axisCrosslineLineGroup = this.root.appendChild( + new Group6({ name: "Axes-Crosslines-Line", zIndex: ZIndexMap7.SERIES_CROSSLINE_LINE }) + ); + this.axisCrosslineLabelGroup = this.root.appendChild( + new Group6({ name: "Axes-Crosslines-Label", zIndex: ZIndexMap7.SERIES_LABEL }) + ); + this.data = []; + this._destroyed = false; + this.miniChartAnimationPhase = "initial"; + // Should be available after the first layout. + this.seriesRect = void 0; + this.axes = []; + this.series = []; + } + destroy() { + if (this._destroyed) { + return; + } + this.destroySeries(this.series); + for (const a of this.axes) { + a.destroy(); + } + this.axes = []; + this._destroyed = true; + } + onSeriesChange(newValue, oldValue) { + const seriesToDestroy = oldValue?.filter((series) => !newValue.includes(series)) ?? []; + this.destroySeries(seriesToDestroy); + for (const series of newValue) { + if (oldValue?.includes(series)) + continue; + series.attachSeries(this.seriesRoot, this.seriesRoot, void 0); + series.chart = {}; + Object.defineProperty(series.chart, "mode", { + get: () => "standalone" + }); + Object.defineProperty(series.chart, "isMiniChart", { + get: () => true + }); + Object.defineProperty(series.chart, "seriesRect", { + get: () => this.seriesRect + }); + series.resetAnimation(this.miniChartAnimationPhase === "initial" ? "initial" : "disabled"); + } + this.seriesRect = void 0; + } + destroySeries(allSeries) { + if (allSeries) { + for (const series of allSeries) { + series.destroy(); + series.detachSeries(this.seriesRoot, this.seriesRoot, void 0); + series.chart = void 0; + } + } + } + assignSeriesToAxes() { + for (const axis of this.axes) { + axis.boundSeries = this.series.filter((s) => { + const seriesAxis = s.axes[axis.direction]; + return seriesAxis === axis; + }); + } + } + assignAxesToSeries() { + const directionToAxesMap = {}; + for (const axis of this.axes) { + const direction = axis.direction; + const directionAxes = directionToAxesMap[direction] ?? (directionToAxesMap[direction] = []); + directionAxes.push(axis); + } + for (const series of this.series) { + for (const direction of series.directions) { + const directionAxes = directionToAxesMap[direction]; + if (!directionAxes) { + Logger7.warnOnce( + `no available axis for direction [${direction}]; check series and axes configuration.` + ); + continue; + } + const seriesKeys = series.getKeys(direction); + const newAxis = this.findMatchingAxis(directionAxes, seriesKeys); + if (!newAxis) { + Logger7.warnOnce( + `no matching axis for direction [${direction}] and keys [${seriesKeys}]; check series and axes configuration.` + ); + continue; + } + series.axes[direction] = newAxis; + } + } + } + findMatchingAxis(directionAxes, directionKeys) { + for (const axis of directionAxes) { + if (!axis.keys.length) { + return axis; + } + if (!directionKeys) { + continue; + } + for (const directionKey of directionKeys) { + if (axis.keys.includes(directionKey)) { + return axis; + } + } + } + } + updateData(data) { + for (const s of this.series) { + s.setChartData(data); + } + if (this.miniChartAnimationPhase === "initial") { + this.ctx.animationManager.onBatchStop(() => { + this.miniChartAnimationPhase = "ready"; + for (const s of this.series) { + s.resetAnimation("disabled"); + } + }); + } + } + async processData(dataController) { + if (this.series.some((s) => s.canHaveAxes)) { + this.assignAxesToSeries(); + this.assignSeriesToAxes(); + } + await Promise.all( + this.series.map(async (s) => { + s.resetDatumCallbackCache(); + return s.processData(dataController); + }) + ); + for (const axis of this.axes) { + axis.processData(); + } + } + computeAxisPadding() { + const padding = new Padding(); + if (!this.enabled) { + return padding; + } + for (const { position, thickness, line, label } of this.axes) { + if (position == null) + continue; + let size; + if (thickness) { + size = thickness; + } else { + size = (line.enabled ? line.width : 0) + (label.enabled ? calcLineHeight4(label.fontSize ?? 0) + label.spacing : 0); + } + padding[position] = Math.ceil(size); + } + return padding; + } + async layout(width, height) { + var _a; + const { padding } = this; + const animated = this.seriesRect != null; + const seriesRect = new BBox7(0, 0, width, height - (padding.top + padding.bottom)); + const resized = this.seriesRect == null || this.seriesRect.width !== width || this.seriesRect.height !== height; + this.seriesRect = seriesRect; + this.seriesRoot.translationY = padding.top; + this.seriesRoot.setClipRectCanvasSpace(new BBox7(0, -padding.top, width, height)); + for (const axis of this.axes) { + const { position = "left" } = axis; + switch (position) { + case "top": + case "bottom": + axis.range = [0, seriesRect.width]; + axis.gridLength = seriesRect.height; + break; + case "right": + case "left": { + const isCategoryAxis = axis instanceof CategoryAxis; + axis.range = isCategoryAxis ? [0, seriesRect.height] : [seriesRect.height, 0]; + axis.gridLength = seriesRect.width; + break; + } + } + axis.gridPadding = 0; + axis.translation.x = 0; + axis.translation.y = 0; + if (position === "right") { + axis.translation.x = width; + } else if (position === "bottom") { + axis.translation.y = height; + } + if (!animated) { + axis.resetAnimation("initial"); + } + if (axis.crossLines) { + for (const crossLine of axis.crossLines) { + if (crossLine instanceof _ModuleSupport104.CartesianCrossLine) { + crossLine.position = axis.position ?? "top"; + (_a = crossLine.label).parallel ?? (_a.parallel = axis.label?.parallel); + } + } + } + axis.calculateLayout(); + axis.update(); + } + if (resized) { + stackCartesianSeries(this.series); + } + await Promise.all(this.series.map(async (series) => series.update({ seriesRect }))); + } +}; +__decorateClass([ + Property44 +], MiniChart.prototype, "enabled", 2); +__decorateClass([ + ProxyProperty2(["seriesRoot", "inset"]) +], MiniChart.prototype, "inset", 2); +__decorateClass([ + ProxyProperty2(["seriesRoot", "cornerRadius"]) +], MiniChart.prototype, "cornerRadius", 2); +__decorateClass([ + ActionOnSet7({ + changeValue(newValue, oldValue = []) { + const axisNodes = { + axisNode: this.axisGroup, + gridNode: this.axisGridGroup, + labelNode: this.axisLabelGroup, + crossLineLineNode: this.axisCrosslineLineGroup, + crossLineRangeNode: this.axisCrosslineRangeGroup, + crossLineLabelNode: this.axisCrosslineLabelGroup + }; + for (const axis of oldValue) { + if (newValue.includes(axis)) + continue; + axis.detachAxis(); + axis.destroy(); + } + for (const axis of newValue) { + if (oldValue?.includes(axis)) + continue; + axis.attachAxis(axisNodes); + } + } + }) +], MiniChart.prototype, "axes", 2); +__decorateClass([ + ActionOnSet7({ + changeValue(newValue, oldValue) { + this.onSeriesChange(newValue, oldValue); + } + }) +], MiniChart.prototype, "series", 2); + +// packages/ag-charts-enterprise/src/features/navigator/navigatorDOMProxy.ts +import { _ModuleSupport as _ModuleSupport105 } from "ag-charts-community"; +import { clamp as clamp6 } from "ag-charts-core"; +var { SliderWidget } = _ModuleSupport105; +var NavigatorDOMProxy = class { + constructor(ctx, sliderHandlers) { + this.ctx = ctx; + this.sliderHandlers = sliderHandlers; + this._min = 0; + this._max = 1; + this.minRange = 1e-3; + this.dragStartX = 0; + this.ctx = ctx; + this.toolbar = ctx.proxyInteractionService.createProxyContainer({ + type: "toolbar", + domManagerId: `navigator-toolbar`, + classList: ["ag-charts-proxy-navigator-toolbar"], + orientation: "vertical", + ariaLabel: { id: "ariaLabelNavigator" } + }); + this.sliders = [ + ctx.proxyInteractionService.createProxyElement({ + type: "slider", + domIndex: 1, + ariaLabel: { id: "ariaLabelNavigatorMinimum" }, + parent: this.toolbar, + cursor: "ew-resize" + }), + ctx.proxyInteractionService.createProxyElement({ + type: "slider", + domIndex: -Infinity, + ariaLabel: { id: "ariaLabelNavigatorRange" }, + parent: this.toolbar, + cursor: "grab" + }), + ctx.proxyInteractionService.createProxyElement({ + type: "slider", + domIndex: 2, + ariaLabel: { id: "ariaLabelNavigatorMaximum" }, + parent: this.toolbar, + cursor: "ew-resize" + }) + ]; + for (const [index, key] of ["min", "pan", "max"].entries()) { + const slider = this.sliders[index]; + slider.step = SliderWidget.STEP_HUNDRETH; + slider.keyboardStep = SliderWidget.STEP_ONE; + slider.orientation = "horizontal"; + slider.setPreventsDefault(false); + slider.addListener("drag-start", (ev) => this.onDragStart(index, ev, key)); + slider.addListener("drag-move", (ev) => this.onDrag(slider, ev, key)); + slider.addListener("drag-end", () => this.updateSliderRatios()); + slider.addListener("contextmenu", (ev) => this.onContextMenu(slider, ev)); + } + this.sliders[0].addListener("change", () => this.onMinSliderChange()); + this.sliders[1].addListener("change", () => this.onPanSliderChange()); + this.sliders[2].addListener("change", () => this.onMaxSliderChange()); + this.updateSliderRatios(); + this.updateVisibility(false); + } + destroy() { + this.toolbar.destroy(); + } + updateVisibility(visible) { + this.toolbar.setHidden(!visible); + } + updateZoom() { + const { _min: min, _max: max } = this; + if (min == null || max == null) + return; + return this.ctx.zoomManager.updateZoom("navigator", { x: { min, max } }); + } + updateBounds(bounds) { + this.toolbar.setBounds(bounds); + } + updateSliderBounds(sliderIndex, bounds) { + this.sliders[sliderIndex].setBounds(bounds); + } + updateMinMax(min, max) { + this._min = min; + this._max = max; + this.updateSliderRatios(); + } + updateSliderRatios() { + let { _min: min, _max: max } = this; + min = Math.round(min * 100) / 100; + max = Math.round(max * 100) / 100; + const panAria = this.ctx.localeManager.t("ariaValuePanRange", { min, max }); + this.sliders[0].setValueRatio(min); + this.sliders[1].setValueRatio(min, { ariaValueText: panAria }); + this.sliders[2].setValueRatio(max); + } + toCanvasOffsets(event) { + return { offsetX: this.dragStartX + event.originDeltaX }; + } + moveToFront(index) { + if (index === 1) + return; + const frontSlider = this.sliders[index]; + const otherSlider = this.sliders[2 - index]; + this.toolbar.moveChild(otherSlider, frontSlider.domIndex - 1); + } + onDragStart(index, event, key) { + const slider = this.sliders[index]; + const toolbarLeft = this.toolbar.cssLeft(); + const sliderLeft = slider.cssLeft(); + this.dragStartX = toolbarLeft + sliderLeft + event.offsetX; + this.moveToFront(index); + event.sourceEvent.preventDefault(); + this.sliderHandlers.onDragStart(key, this.toCanvasOffsets(event)); + } + onDrag(_slider, event, key) { + event.sourceEvent.preventDefault(); + this.sliderHandlers.onDrag(key, this.toCanvasOffsets(event)); + } + onContextMenu(slider, widgetEvent) { + const { offsetX, offsetY } = widgetEvent; + const { x: toolbarX, y: toolbarY } = this.toolbar.getBounds(); + const { x: sliderX, y: sliderY } = slider.getBounds(); + const canvasX = offsetX + toolbarX + sliderX; + const canvasY = offsetY + toolbarY + sliderY; + this.ctx.contextMenuRegistry.dispatchContext("always", { widgetEvent, canvasX, canvasY }, void 0); + } + onPanSliderChange() { + const ratio3 = this.sliders[1].getValueRatio(); + const span = this._max - this._min; + this._min = clamp6(0, ratio3, 1 - span); + this._max = this._min + span; + this.updateZoom(); + } + onMinSliderChange() { + this._min = this.sliders[0].clampValueRatio(0, this._max - this.minRange); + this.updateZoom(); + } + onMaxSliderChange() { + this._max = this.sliders[2].clampValueRatio(this._min + this.minRange, 1); + this.updateZoom(); + } +}; + +// packages/ag-charts-enterprise/src/features/navigator/shapes/rangeHandle.ts +import { _ModuleSupport as _ModuleSupport106 } from "ag-charts-community"; +var { Property: Property45, SceneChangeDetection: SceneChangeDetection2, BBox: BBox8, ExtendedPath2D } = _ModuleSupport106; +var RangeHandle = class extends _ModuleSupport106.Path { + constructor() { + super(...arguments); + this.zIndex = 3; + this.centerX = 0; + this.centerY = 0; + this.width = 8; + this.height = 16; + this.cornerRadius = 4; + this.grip = true; + this.gripPath = new ExtendedPath2D(); + } + setCenter(x, y) { + this.dirtyPath = true; + if (this.centerX !== x || this.centerY !== y) { + this.centerX = x; + this.centerY = y; + this.markDirty("center"); + } + } + static align(minHandle, maxHandle, x, y, width, height, min, max, pixelAlign) { + const minHandleX = minHandle.align(x + width * min) + pixelAlign; + const maxHandleX = minHandleX + minHandle.align(x + width * min, width * (max - min)) - 2 * pixelAlign; + const handleY = minHandle.align(y + height / 2); + minHandle.setCenter(minHandleX, handleY); + maxHandle.setCenter(maxHandleX, handleY); + } + computeBBox() { + const { centerX, centerY, width, height } = this; + const x = centerX - width / 2; + const y = centerY - height / 2; + return new BBox8(x, y, width, height); + } + isPointInPath(x, y) { + const bbox = this.getBBox(); + return bbox.containsPoint(x, y); + } + updatePath() { + const { centerX, centerY, path, gripPath, strokeWidth, cornerRadius, grip } = this; + const pixelAlign = strokeWidth / 2; + const pixelRatio = this.layerManager?.canvas?.pixelRatio ?? 1; + path.clear(); + gripPath.clear(); + const halfWidth = Math.floor(this.width / 2 * pixelRatio) / pixelRatio; + const halfHeight = Math.floor(this.height / 2 * pixelRatio) / pixelRatio; + path.roundRect( + centerX - halfWidth + pixelAlign, + centerY - halfHeight + pixelAlign, + 2 * (halfWidth - pixelAlign), + 2 * (halfHeight - pixelAlign), + cornerRadius + ); + const gripSpacing = 3; + if (grip) { + for (let x = -0.5; x <= 0.5; x += 1) { + for (let y = -1; y <= 1; y += 1) { + gripPath.arc(centerX + x * gripSpacing, centerY + y * gripSpacing, 1, 0, 2 * Math.PI); + gripPath.closePath(); + } + } + } + } + renderFill(ctx, path) { + const { stroke: stroke2 } = this; + super.renderFill(ctx, path); + ctx.fillStyle = typeof stroke2 === "string" ? stroke2 : "black"; + ctx.fill(this.gripPath.getPath2D()); + } +}; +RangeHandle.className = "RangeHandle"; +__decorateClass([ + Property45, + SceneChangeDetection2() +], RangeHandle.prototype, "width", 2); +__decorateClass([ + Property45, + SceneChangeDetection2() +], RangeHandle.prototype, "height", 2); +__decorateClass([ + Property45, + SceneChangeDetection2() +], RangeHandle.prototype, "cornerRadius", 2); +__decorateClass([ + Property45, + SceneChangeDetection2() +], RangeHandle.prototype, "grip", 2); + +// packages/ag-charts-enterprise/src/features/navigator/shapes/rangeMask.ts +import { _ModuleSupport as _ModuleSupport107 } from "ag-charts-community"; +var { Path: Path6, BBox: BBox9, ExtendedPath2D: ExtendedPath2D2, clippedRoundRect, Property: Property46, SceneChangeDetection: SceneChangeDetection3 } = _ModuleSupport107; +var RangeMask = class extends Path6 { + constructor() { + super(...arguments); + this.cornerRadius = 4; + this.zIndex = 2; + this.x = 0; + this.y = 0; + this.width = 200; + this.height = 30; + this.min = 0; + this.max = 1; + this.visiblePath = new ExtendedPath2D2(); + } + layout(x, y, width, height, min, max) { + min = Number.isNaN(min) ? this.min : min; + max = Number.isNaN(max) ? this.max : max; + if (x !== this.x || y !== this.y || width !== this.width || this.height !== height || min !== this.min || max !== this.max) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.min = min; + this.max = max; + this.dirtyPath = true; + this.markDirty("RangeMask.layout"); + } + } + computeBBox() { + const { x, y, width, height } = this; + return new BBox9(x, y, width, height); + } + computeVisibleRangeBBox() { + const { x, y, width, height, min, max } = this; + const minX = x + width * min; + const maxX = x + width * max; + return new BBox9(minX, y, maxX - minX, height); + } + updatePath() { + const { path, visiblePath, x, y, width, height, min, max, strokeWidth, cornerRadius } = this; + const pixelAlign = strokeWidth / 2; + path.clear(); + visiblePath.clear(); + const ax = this.align(x) + pixelAlign; + const ay = this.align(y) + pixelAlign; + const aw = this.align(x, width) - 2 * pixelAlign; + const ah = this.align(y, height) - 2 * pixelAlign; + const minX = this.align(x + width * min) + pixelAlign; + const maxX = minX + this.align(x + width * min, width * (max - min)) - 2 * pixelAlign; + const cornerRadiusParams = { + topLeft: cornerRadius, + topRight: cornerRadius, + bottomRight: cornerRadius, + bottomLeft: cornerRadius + }; + const drawRect = (p, x0, x1) => { + if (x1 - x0 < 1) + return; + const bbox = new BBox9(x0, ay, x1 - x0, ah); + clippedRoundRect(p, ax, ay, aw, ah, cornerRadiusParams, bbox); + }; + drawRect(path, ax, minX); + drawRect(path, maxX, aw + ax); + drawRect(visiblePath, minX, maxX); + } + renderStroke(ctx, path) { + super.renderStroke(ctx, path); + super.renderStroke(ctx, this.visiblePath.getPath2D()); + } +}; +RangeMask.className = "RangeMask"; +__decorateClass([ + Property46, + SceneChangeDetection3() +], RangeMask.prototype, "cornerRadius", 2); + +// packages/ag-charts-enterprise/src/features/navigator/shapes/rangeSelector.ts +import { _ModuleSupport as _ModuleSupport108 } from "ag-charts-community"; +var RangeSelector = class extends _ModuleSupport108.Group { + constructor(children) { + super({ name: "rangeSelectorGroup", zIndex: _ModuleSupport108.ZIndexMap.NAVIGATOR }); + this.x = 0; + this.y = 0; + this.width = 200; + this.height = 30; + this.lOffset = 0; + this.rOffset = 0; + this.background = this.appendChild( + new _ModuleSupport108.TranslatableGroup({ name: "navigator-background", zIndex: 1 }) + ); + this.append(children); + } + layout(x, y, width, height, lOffset, rOffset) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.lOffset = lOffset; + this.rOffset = rOffset; + this.background.translationX = x; + this.background.translationY = y; + this.markDirty("RangeSelector"); + } + updateBackground(oldGroup, newGroup) { + if (oldGroup != null) { + oldGroup.remove(); + } + if (newGroup != null) { + this.background.appendChild(newGroup); + } + this.markDirty("RangeSelector"); + } + computeBBox() { + const { x, y, width, height, lOffset, rOffset } = this; + return new _ModuleSupport108.BBox(x - lOffset, y, width + (lOffset + rOffset), height); + } +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigator.ts +var { BaseModuleInstance: BaseModuleInstance2, ObserveChanges: ObserveChanges3, Property: Property47 } = _ModuleSupport109; +var Navigator = class extends BaseModuleInstance2 { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.mask = new RangeMask(); + this.minHandle = new RangeHandle(); + this.maxHandle = new RangeHandle(); + this.maskVisibleRange = { + id: "navigator-mask-visible-range", + getBBox: () => this.mask.computeVisibleRangeBBox(), + toCanvasBBox: () => this.mask.computeVisibleRangeBBox(), + fromCanvasPoint: (x, y) => ({ x, y }) + }; + this.height = 30; + this.cornerRadius = 0; + this.spacing = 10; + this.x = 0; + this.y = 0; + this.width = 0; + this.rangeSelector = new RangeSelector([this.mask, this.minHandle, this.maxHandle]); + this.cleanup.register( + ctx.scene.attachNode(this.rangeSelector), + ctx.eventsHub.on("locale:change", () => this.updateZoom()), + ctx.layoutManager.registerElement(_ModuleSupport109.LayoutElement.Navigator, (e) => this.onLayoutStart(e)), + ctx.eventsHub.on("layout:complete", (e) => this.onLayoutComplete(e)), + ctx.eventsHub.on("zoom:change", (event) => this.onZoomChange(event)) + ); + this.domProxy = new NavigatorDOMProxy(ctx, this); + this.updateGroupVisibility(); + this.miniChart = new MiniChart(ctx); + } + updateBackground(oldGroup, newGroup) { + this.rangeSelector?.updateBackground(oldGroup, newGroup); + } + updateGroupVisibility() { + const { enabled } = this; + if (this.rangeSelector == null || enabled === this.rangeSelector.visible) + return; + this.rangeSelector.visible = enabled; + this.domProxy.updateVisibility(enabled); + if (enabled) { + this.updateZoom(); + } else { + this.ctx.zoomManager.updateZoom("navigator"); + } + } + onLayoutStart(ctx) { + if (this.enabled) { + const { layoutBox } = ctx; + const navigatorTotalHeight = this.height + this.spacing; + layoutBox.shrink(navigatorTotalHeight, "bottom"); + this.y = layoutBox.y + layoutBox.height + this.spacing; + } else { + this.y = 0; + } + if (this.enabled && this.miniChart) { + const { top, bottom } = this.miniChart.computeAxisPadding(); + ctx.layoutBox.shrink(top + bottom, "bottom"); + this.y -= bottom; + this.miniChart.inset = this.mask.strokeWidth / 2; + this.miniChart.cornerRadius = this.mask.cornerRadius; + } + } + onLayoutComplete(opts) { + const { x, width } = opts.series.rect; + const { y, height } = this; + this.domProxy.updateVisibility(this.enabled); + if (this.enabled) { + const { _min: min, _max: max } = this.domProxy; + this.layoutNodes(x, y, width, height, min, max); + this.domProxy.updateBounds({ x, y, width, height }); + } + this.x = x; + this.width = width; + this.miniChart?.layout(width, height).catch((e) => Logger8.error(e)); + } + canDrag() { + return this.enabled && this.ctx.interactionManager.isState(_ModuleSupport109.InteractionState.ZoomDraggable); + } + onDragStart(dragging, { offsetX }) { + if (!this.canDrag()) + return; + if (dragging === "pan") { + this.panStart = (offsetX - this.x) / this.width - this.domProxy._min; + } + this.ctx.zoomManager.fireZoomPanStartEvent("navigator"); + } + onDrag(dragging, { offsetX }) { + if (!this.canDrag()) + return; + const { panStart, x, width } = this; + const { minRange } = this.domProxy; + let { _min: min, _max: max } = this.domProxy; + const ratio3 = (offsetX - x) / width; + if (dragging === "min") { + min = clamp7(0, ratio3, max - minRange); + } else if (dragging === "max") { + max = clamp7(min + minRange, ratio3, 1); + } else if (dragging === "pan" && panStart != null) { + const span = max - min; + min = clamp7(0, ratio3 - panStart, 1 - span); + max = min + span; + } + this.domProxy._min = min; + this.domProxy._max = max; + this.updateZoom(); + } + onZoomChange(event) { + const { x: xZoom } = event; + if (!xZoom) + return; + const { x, y, width, height } = this; + const { min, max } = xZoom; + this.domProxy.updateMinMax(min, max); + this.layoutNodes(x, y, width, height, min, max); + } + layoutNodes(x, y, width, height, min, max) { + const { rangeSelector, mask, minHandle, maxHandle } = this; + mask.layout(x, y, width, height, min, max); + rangeSelector.layout(x, y, width, height, minHandle.width / 2, maxHandle.width / 2); + RangeHandle.align(minHandle, maxHandle, x, y, width, height, min, max, mask.strokeWidth / 2); + if (min + (max - min) / 2 < 0.5) { + minHandle.zIndex = 3; + maxHandle.zIndex = 4; + } else { + minHandle.zIndex = 4; + maxHandle.zIndex = 3; + } + for (const [index, node] of [minHandle, this.maskVisibleRange, maxHandle].entries()) { + const bbox = node.getBBox(); + const tbox = { x: bbox.x - x, y: bbox.y - y, height: bbox.height, width: bbox.width }; + this.domProxy.updateSliderBounds(index, tbox); + } + } + updateZoom() { + if (!this.enabled) + return; + this.domProxy.updateZoom(); + } + updateData(data) { + return this.miniChart?.updateData(data); + } + async processData(dataController) { + if (this.miniChart) { + return this.miniChart?.processData(dataController); + } + } +}; +__decorateClass([ + ObserveChanges3((target, value, oldValue) => { + target.updateBackground(oldValue?.root, value?.root); + }) +], Navigator.prototype, "miniChart", 2); +__decorateClass([ + Property47, + ObserveChanges3((target, value) => { + target.ctx.zoomManager.setNavigatorEnabled(Boolean(value)); + target.updateGroupVisibility(); + }) +], Navigator.prototype, "enabled", 2); +__decorateClass([ + Property47 +], Navigator.prototype, "height", 2); +__decorateClass([ + Property47, + ObserveChanges3((target, value) => { + target.mask.cornerRadius = value; + }) +], Navigator.prototype, "cornerRadius", 2); +__decorateClass([ + Property47 +], Navigator.prototype, "spacing", 2); + +// packages/ag-charts-enterprise/src/features/navigator/navigatorTheme.ts +import { + _ModuleSupport as _ModuleSupport155 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorOptionsDefs.ts +import { _ModuleSupport as _ModuleSupport154 } from "ag-charts-community"; +import { + array, + arrayOfDefs as arrayOfDefs2, + boolean as boolean6, + callbackOf, + color as color2, + fontOptionsDef, + number as number5, + positiveNumber as positiveNumber2, + ratio, + typeUnion +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotModule.ts +import { _ModuleSupport as _ModuleSupport115 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeries.ts +import { + _ModuleSupport as _ModuleSupport112 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/box-plot/blotPlotUtil.ts +function prepareBoxPlotFromTo(isVertical) { + const from = isVertical ? { scalingX: 1, scalingY: 0 } : { scalingX: 0, scalingY: 1 }; + const to = { scalingX: 1, scalingY: 1 }; + return { from, to }; +} +function resetBoxPlotSelectionsScalingCenterFn(isVertical) { + return (_node, datum) => { + if (isVertical) { + return { scalingCenterY: datum.scaledValues.medianValue }; + } + return { scalingCenterX: datum.scaledValues.medianValue }; + }; +} + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotNode.ts +import { _ModuleSupport as _ModuleSupport110 } from "ag-charts-community"; +var { + Path: Path7, + Scalable, + ExtendedPath2D: ExtendedPath2D3, + SceneChangeDetection: SceneChangeDetection4, + SceneArrayChangeDetection, + BBox: BBox10, + clippedRoundRect: baseClippedRoundRect +} = _ModuleSupport110; +var BoxPlotNode = class extends Scalable(Path7) { + constructor() { + super(...arguments); + this.wickPath = new ExtendedPath2D3(); + this.horizontal = false; + this.center = 0; + this.thickness = 0; + this.min = 0; + this.q1 = 0; + this.median = 0; + this.q3 = 0; + this.max = 0; + this.cornerRadius = 0; + this.crisp = false; + this.strokeAlignment = 0; + this.wickStroke = void 0; + this.wickStrokeWidth = void 0; + this.wickStrokeOpacity = void 0; + this.capLengthRatio = 1; + this.wickStrokeAlignment = 0; + } + computeBBox() { + const { horizontal, center, thickness, min, max } = this; + return horizontal ? new BBox10(Math.min(min, max), center - thickness / 2, Math.abs(max - min), thickness) : new BBox10(center - thickness / 2, Math.min(min, max), thickness, Math.abs(max - min)); + } + computeDefaultGradientFillBBox() { + const { horizontal, center, thickness, q1, q3 } = this; + return horizontal ? new BBox10(Math.min(q1, q3), center - thickness / 2, Math.abs(q3 - q1), thickness) : new BBox10(center - thickness / 2, Math.min(q1, q3), thickness, Math.abs(q3 - q1)); + } + isPointInPath(x, y) { + return this.getBBox().containsPoint(x, y); + } + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } + get midPoint() { + return this.horizontal ? { x: (this.min + this.max) / 2, y: this.center } : { x: this.center, y: (this.min + this.max) / 2 }; + } + alignedCoordinates() { + const { thickness, crisp } = this; + let { center, min, q1, median, q3, max } = this; + let x0 = center - thickness / 2; + let x1 = center + thickness / 2; + if (crisp && thickness > 1) { + min = this.align(min); + q1 = this.align(q1); + median = this.align(median); + q3 = this.align(q3); + max = min + this.align(min, max - min); + const halfWidth = this.align(thickness / 2); + center = this.align(center); + x0 = center - halfWidth; + x1 = center + halfWidth; + } + return { center, x0, x1, min, max, q1, median, q3 }; + } + updatePath() { + const { + path, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke, + wickStrokeWidth, + wickStrokeOpacity, + wickLineDash, + wickLineDashOffset, + strokeAlignment, + cornerRadius, + capLengthRatio, + horizontal + } = this; + const { center, x0, x1, min, max, q1, median, q3 } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const wickStrokeAlignment = this.wickStrokeAlignment > 0 ? pixelRatio / this.wickStrokeAlignment / 2 % 1 : 0; + this.path.clear(); + this.wickPath.clear(); + const needsWickPath = wickStroke != null && wickStroke !== stroke2 || wickStrokeWidth != null && wickStrokeWidth !== strokeWidth || wickStrokeOpacity != null && wickStrokeOpacity !== strokeOpacity || wickLineDash != null && wickLineDash !== lineDash || wickLineDashOffset != null && wickLineDashOffset !== lineDashOffset; + const wickPath = needsWickPath ? this.wickPath : path; + if (Math.abs(x1 - x0) <= 3) { + moveTo(wickPath, horizontal, center, min); + lineTo(wickPath, horizontal, center, max); + return; + } + const wickTop = Math.min(min, max); + const wickBottom = Math.max(min, max); + const boxTop = Math.min(q1, q3); + const boxBottom = Math.max(q1, q3); + const capX0 = center - Math.abs((x1 - x0) * capLengthRatio) / 2; + const capX1 = center + Math.abs((x1 - x0) * capLengthRatio) / 2; + moveTo(wickPath, horizontal, capX0, wickTop - wickStrokeAlignment); + lineTo(wickPath, horizontal, capX1, wickTop - wickStrokeAlignment); + moveTo(wickPath, horizontal, center - wickStrokeAlignment, wickTop - wickStrokeAlignment); + lineTo(wickPath, horizontal, center - wickStrokeAlignment, boxTop + strokeWidth / 2); + moveTo(wickPath, horizontal, center - wickStrokeAlignment, wickBottom + wickStrokeAlignment); + lineTo(wickPath, horizontal, center - wickStrokeAlignment, boxBottom - strokeWidth / 2); + moveTo(wickPath, horizontal, capX0, wickBottom + wickStrokeAlignment); + lineTo(wickPath, horizontal, capX1, wickBottom + wickStrokeAlignment); + const horizontalBoxStrokeAdjustment = strokeWidth / 2 + strokeAlignment; + const verticalBoxStrokeAdjustment = strokeWidth / 2 - strokeAlignment; + const rectHeight = boxBottom - boxTop - 2 * verticalBoxStrokeAdjustment; + if (rectHeight > 0) { + const rectX = x0 + horizontalBoxStrokeAdjustment; + const rectY = boxTop + verticalBoxStrokeAdjustment; + const rectWidth = x1 - x0 - 2 * horizontalBoxStrokeAdjustment; + const cornerRadii = { + topLeft: cornerRadius, + topRight: cornerRadius, + bottomRight: cornerRadius, + bottomLeft: cornerRadius + }; + clippedRoundRect2( + path, + horizontal, + rectX, + rectY, + rectWidth, + rectHeight, + cornerRadii, + new BBox10(rectX, rectY, rectWidth, median - rectY) + ); + clippedRoundRect2( + path, + horizontal, + rectX, + rectY, + rectWidth, + rectHeight, + cornerRadii, + new BBox10(rectX, median, rectWidth, rectY + rectHeight - median) + ); + } else { + const boxMid = (boxTop + boxBottom) / 2; + moveTo(path, horizontal, x0, boxMid); + lineTo(path, horizontal, x1, boxMid); + } + } + drawPath(ctx) { + super.drawPath(ctx); + const { wickPath } = this; + if (wickPath.isEmpty()) + return; + const { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke = stroke2, + wickStrokeWidth = strokeWidth, + wickStrokeOpacity = strokeOpacity, + wickLineDash = lineDash, + wickLineDashOffset = lineDashOffset + } = this; + if (wickStrokeWidth === 0) + return; + ctx.globalAlpha *= wickStrokeOpacity; + if (typeof wickStroke === "string") { + ctx.strokeStyle = wickStroke; + } + ctx.lineWidth = wickStrokeWidth; + if (wickLineDash != null) { + ctx.setLineDash([...wickLineDash]); + } + ctx.lineDashOffset = wickLineDashOffset; + ctx.stroke(wickPath.getPath2D()); + } +}; +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "horizontal", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "center", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "thickness", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "min", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "q1", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "median", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "q3", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "max", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "cornerRadius", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "crisp", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "strokeAlignment", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStroke", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStrokeWidth", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStrokeOpacity", 2); +__decorateClass([ + SceneArrayChangeDetection() +], BoxPlotNode.prototype, "wickLineDash", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickLineDashOffset", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "capLengthRatio", 2); +__decorateClass([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStrokeAlignment", 2); +function moveTo(path, horizontal, x, y) { + if (horizontal) { + path.moveTo(y, x); + } else { + path.moveTo(x, y); + } +} +function lineTo(path, horizontal, x, y) { + if (horizontal) { + path.lineTo(y, x); + } else { + path.lineTo(x, y); + } +} +function clippedRoundRect2(path, horizontal, x, y, width, height, cornerRadii, clipBBox) { + if (horizontal) { + baseClippedRoundRect( + // eslint-disable-next-line sonarjs/arguments-order + path, + y, + x, + height, + width, + cornerRadii, + clipBBox == null ? void 0 : new BBox10(clipBBox.y, clipBBox.x, clipBBox.height, clipBBox.width) + ); + } else { + baseClippedRoundRect(path, x, y, width, height, cornerRadii, clipBBox); + } +} + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport111 } from "ag-charts-community"; +var { BaseProperties: BaseProperties15, AbstractBarSeriesProperties, makeSeriesTooltip, Property: Property48, mergeDefaults: mergeDefaults3 } = _ModuleSupport111; +var BoxPlotSeriesCap = class extends BaseProperties15 { + constructor() { + super(...arguments); + this.lengthRatio = 0.5; + } +}; +__decorateClass([ + Property48 +], BoxPlotSeriesCap.prototype, "lengthRatio", 2); +var BoxPlotSeriesWhisker = class extends BaseProperties15 { +}; +__decorateClass([ + Property48 +], BoxPlotSeriesWhisker.prototype, "stroke", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesWhisker.prototype, "strokeWidth", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesWhisker.prototype, "strokeOpacity", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesWhisker.prototype, "lineDash", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesWhisker.prototype, "lineDashOffset", 2); +var BoxPlotSeriesProperties = class extends AbstractBarSeriesProperties { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.cap = new BoxPlotSeriesCap(); + this.whisker = new BoxPlotSeriesWhisker(); + this.tooltip = makeSeriesTooltip(); + } + toJson() { + const { stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const properties = super.toJson(); + properties.whisker = mergeDefaults3(properties.whisker, { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + return properties; + } +}; +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "minKey", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "q1Key", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "medianKey", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "q3Key", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "maxKey", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "minName", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "q1Name", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "medianName", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "q3Name", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "maxName", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "cap", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "whisker", 2); +__decorateClass([ + Property48 +], BoxPlotSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeries.ts +var { + fixNumericExtent: fixNumericExtent2, + keyProperty: keyProperty2, + mergeDefaults: mergeDefaults4, + SeriesNodePickMode, + SMALLEST_KEY_INTERVAL, + valueProperty: valueProperty3, + diff, + animationValidation, + computeBarFocusBounds, + createDatumId, + HighlightState, + ContinuousScale: ContinuousScale4, + ChartAxisDirection: ChartAxisDirection13, + motion, + getItemStyles, + applyShapeFillBBox, + calculateSegments, + toHighlightString +} = _ModuleSupport112; +var BoxPlotSeriesNodeEvent = class extends _ModuleSupport112.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.minKey = series.properties.minKey; + this.q1Key = series.properties.q1Key; + this.medianKey = series.properties.medianKey; + this.q3Key = series.properties.q3Key; + this.maxKey = series.properties.maxKey; + } +}; +var BoxPlotSeries = class extends _ModuleSupport112.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode.NEAREST_NODE, SeriesNodePickMode.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["medianKey", "q1Key", "q3Key", "minKey", "maxKey"] + }, + propertyNames: { + x: ["xName"], + y: ["medianName", "q1Name", "q3Name", "minName", "maxName"] + }, + categoryKey: "xValue", + pathsPerSeries: [] + }); + this.properties = new BoxPlotSeriesProperties(); + this.NodeEvent = BoxPlotSeriesNodeEvent; + } + async processData(dataController) { + if (!this.visible) + return; + const { xKey, minKey, q1Key, medianKey, q3Key, maxKey } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (animationEnabled && this.processedData) { + extraProps.push(diff(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation()); + } + const { processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty2(xKey, xScaleType, { id: `xValue` }), + valueProperty3(minKey, yScaleType, { id: `minValue` }), + valueProperty3(q1Key, yScaleType, { id: `q1Value` }), + valueProperty3(medianKey, yScaleType, { id: `medianValue` }), + valueProperty3(q3Key, yScaleType, { id: `q3Value` }), + valueProperty3(maxKey, yScaleType, { id: `maxValue` }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL] : [], + ...extraProps + ] + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + if (direction !== this.getBarDirection()) { + const { index, def } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = processedData.domain.keys[index]; + if (def.type === "key" && def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yExtent = this.domainForClippedRange(direction, ["minValue", "maxValue"], "xValue"); + return fixNumericExtent2(yExtent); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection13.Y, ["maxValue", "minValue"], "xValue", visibleRange); + } + createNodeData() { + const { visible, dataModel, processedData } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const { xKey } = this.properties; + const nodeData = []; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const minValues = dataModel.resolveColumnById(this, "minValue", processedData); + const q1Values = dataModel.resolveColumnById(this, "q1Value", processedData); + const medianValues = dataModel.resolveColumnById(this, "medianValue", processedData); + const q3Values = dataModel.resolveColumnById(this, "q3Value", processedData); + const maxValues = dataModel.resolveColumnById(this, "maxValue", processedData); + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale4.is(xAxis.scale) ? barWidth * -0.5 : 0; + const { groupScale } = this; + const isVertical = this.isVertical(); + const segments = calculateSegments( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + const context = { + itemId: xKey, + nodeData, + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStyles(this.getItemStyle.bind(this)), + segments + }; + if (!visible) + return context; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const minValue = minValues[datumIndex]; + const q1Value = q1Values[datumIndex]; + const medianValue = medianValues[datumIndex]; + const q3Value = q3Values[datumIndex]; + const maxValue = maxValues[datumIndex]; + if ([minValue, q1Value, medianValue, q3Value, maxValue].some((value) => typeof value !== "number") || minValue > q1Value || q1Value > medianValue || medianValue > q3Value || q3Value > maxValue) { + continue; + } + const scaledValues = { + xValue: xAxis.scale.convert(xValue2), + minValue: yAxis.scale.convert(minValue), + q1Value: yAxis.scale.convert(q1Value), + medianValue: yAxis.scale.convert(medianValue), + q3Value: yAxis.scale.convert(q3Value), + maxValue: yAxis.scale.convert(maxValue) + }; + const bandwidth = barWidth; + scaledValues.xValue += groupScale.convert(String(groupIndex)) + barOffset + bandwidth / 2; + const height = Math.abs(scaledValues.q3Value - scaledValues.q1Value); + const midX = scaledValues.xValue; + const midY = Math.min(scaledValues.q3Value, scaledValues.q1Value) + height / 2; + const midPoint = { + x: isVertical ? midX : midY, + y: isVertical ? midY : midX + }; + let focusRect; + if (isVertical) { + focusRect = { + x: midPoint.x - bandwidth / 2, + y: scaledValues.minValue, + width: bandwidth, + height: scaledValues.maxValue - scaledValues.minValue + }; + } else { + focusRect = { + x: scaledValues.minValue, + y: midPoint.y - bandwidth / 2, + width: scaledValues.maxValue - scaledValues.minValue, + height: bandwidth + }; + } + nodeData.push({ + series: this, + itemId: xValue2, + datum, + datumIndex, + xKey, + bandwidth, + scaledValues, + midPoint, + focusRect + }); + } + return context; + } + legendItemSymbol() { + const { fill, stroke: stroke2, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + HighlightState.None + ); + return { + marker: { + fill: _ModuleSupport112.deepClone(fill), + fillOpacity, + stroke: stroke2, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { xKey, yName, showInLegend, legendItemName } = this.properties; + if (!xKey || legendType !== "category") { + return []; + } + return [ + { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: seriesId }), + label: { + text: legendItemName ?? yName ?? seriesId + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { + xKey, + xName, + yName, + medianKey, + medianName, + q1Key, + q1Name, + q3Key, + q3Name, + minKey, + minName, + maxKey, + maxName, + legendItemName, + tooltip + } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const minValue = dataModel.resolveColumnById(this, `minValue`, processedData)[datumIndex]; + const q1Value = dataModel.resolveColumnById(this, `q1Value`, processedData)[datumIndex]; + const medianValue = dataModel.resolveColumnById(this, `medianValue`, processedData)[datumIndex]; + const q3Value = dataModel.resolveColumnById(this, `q3Value`, processedData)[datumIndex]; + const maxValue = dataModel.resolveColumnById(this, `maxValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + const data = [ + { + label: minName, + fallbackLabel: minKey, + value: this.getAxisValueText(yAxis, "tooltip", minValue, datum, minKey, legendItemName) + }, + { + label: q1Name, + fallbackLabel: q1Key, + value: this.getAxisValueText(yAxis, "tooltip", q1Value, datum, q1Key, legendItemName) + }, + { + label: medianName, + fallbackLabel: medianKey, + value: this.getAxisValueText(yAxis, "tooltip", medianValue, datum, medianKey, legendItemName) + }, + { + label: q3Name, + fallbackLabel: q3Key, + value: this.getAxisValueText(yAxis, "tooltip", q3Value, datum, q3Key, legendItemName) + }, + { + label: maxName, + fallbackLabel: maxKey, + value: this.getAxisValueText(yAxis, "tooltip", maxValue, datum, maxKey, legendItemName) + } + ]; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + title: legendItemName ?? yName, + symbol: this.legendItemSymbol(), + data + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yName, + medianKey, + medianName, + q1Key, + q1Name, + q3Key, + q3Name, + minKey, + minName, + maxKey, + maxName, + ...format + } + ); + } + animateEmptyUpdateReady({ + datumSelection + }) { + const isVertical = this.isVertical(); + const { from, to } = prepareBoxPlotFromTo(isVertical); + motion.resetMotion([datumSelection], resetBoxPlotSelectionsScalingCenterFn(isVertical)); + motion.staticFromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], from, to, { + phase: "initial" + }); + } + isLabelEnabled() { + return false; + } + updateDatumSelection(opts) { + const data = opts.nodeData ?? []; + return opts.datumSelection.update(data); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + cap: { lengthRatio }, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth, + maxKey, + maxName, + medianKey, + medianName, + minKey, + minName, + q1Key, + q1Name, + q3Key, + q3Name, + whisker: { + lineDash: whiskerLineDash, + lineDashOffset: whiskerLineDashOffset, + stroke: whiskerStroke, + strokeOpacity: whiskerStrokeOpacity, + strokeWidth: whiskerStrokeWidth + }, + xKey, + xName, + yName + } = this.properties; + const highlightState = toHighlightString(highlightStateEnum ?? HighlightState.None); + return { + cap: { lengthRatio }, + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + maxKey, + maxName: maxName ?? maxKey, + medianKey, + medianName: medianName ?? medianKey, + minKey, + minName: minName ?? minKey, + q1Key, + q1Name: q1Name ?? q1Key, + q3Key, + q3Name: q3Name ?? q3Key, + seriesId, + stroke: stroke2, + strokeOpacity, + strokeWidth, + whisker: { + lineDash: whiskerLineDash ?? lineDash, + lineDashOffset: whiskerLineDashOffset ?? lineDashOffset, + stroke: whiskerStroke ?? stroke2, + strokeOpacity: whiskerStrokeOpacity ?? strokeOpacity, + strokeWidth: whiskerStrokeWidth ?? strokeWidth + }, + xKey, + xName: xName ?? xKey, + yName + }; + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cap, + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth, + styler, + whisker + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke2, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + cap: { lengthRatio: stylerResult.cap?.lengthRatio ?? cap.lengthRatio }, + whisker: { + lineDash: stylerResult.whisker?.lineDash ?? whisker.lineDash, + lineDashOffset: stylerResult.whisker?.lineDashOffset ?? whisker.lineDashOffset, + stroke: stylerResult.whisker?.stroke ?? whisker.stroke, + strokeOpacity: stylerResult.whisker?.strokeOpacity ?? whisker.strokeOpacity, + strokeWidth: stylerResult.whisker?.strokeWidth ?? whisker.strokeWidth + } + }; + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style = mergeDefaults4(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults4(overrides, style); + } + } + const { stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = style; + style.whisker = mergeDefaults4(style.whisker, { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + return style; + } + makeItemStylerParams(datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const { xKey, minKey, q1Key, medianKey, q3Key, maxKey } = this.properties; + const datum = this.processedData?.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + minKey, + q1Key, + medianKey, + q3Key, + maxKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((_, nodeDatum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = this.getItemStyle(nodeDatum.datumIndex, isHighlight, highlightState); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const isVertical = this.isVertical(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const fillBBox = this.getShapeFillBBox(); + const strokeAlignment = this.getStyle(false, false, HighlightState.None).strokeWidth / 2; + const wickStrokeAlignment = properties.whisker.strokeWidth ?? properties.strokeWidth; + datumSelection.each((boxPlotNode, nodeDatum) => { + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + applyShapeFillBBox(boxPlotNode, style.fill, fillBBox); + boxPlotNode.fill = style.fill; + boxPlotNode.fillOpacity = style.fillOpacity; + boxPlotNode.stroke = style.stroke; + boxPlotNode.strokeWidth = style.strokeWidth; + boxPlotNode.strokeOpacity = style.strokeOpacity; + boxPlotNode.lineDash = style.lineDash; + boxPlotNode.lineDashOffset = style.lineDashOffset; + boxPlotNode.wickStroke = style.whisker.stroke; + boxPlotNode.wickStrokeWidth = style.whisker.strokeWidth; + boxPlotNode.wickStrokeOpacity = style.whisker.strokeOpacity; + boxPlotNode.wickLineDash = style.whisker.lineDash; + boxPlotNode.wickLineDashOffset = style.whisker.lineDashOffset; + boxPlotNode.cornerRadius = style.cornerRadius; + boxPlotNode.crisp = true; + boxPlotNode.horizontal = !isVertical; + boxPlotNode.center = nodeDatum.scaledValues.xValue; + boxPlotNode.thickness = nodeDatum.bandwidth; + boxPlotNode.min = nodeDatum.scaledValues.minValue; + boxPlotNode.q1 = nodeDatum.scaledValues.q1Value; + boxPlotNode.median = nodeDatum.scaledValues.medianValue; + boxPlotNode.q3 = nodeDatum.scaledValues.q3Value; + boxPlotNode.max = nodeDatum.scaledValues.maxValue; + boxPlotNode.capLengthRatio = style.cap.lengthRatio; + boxPlotNode.strokeAlignment = strokeAlignment; + boxPlotNode.wickStrokeAlignment = wickStrokeAlignment; + }); + } + updateLabelNodes() { + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData); + } + nodeFactory() { + return new BoxPlotNode(); + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds(this, this.contextNodeData?.nodeData[datumIndex].focusRect); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null; + } +}; +BoxPlotSeries.className = "BoxPlotSeries"; +BoxPlotSeries.type = "box-plot"; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport113 } from "ag-charts-community"; +import { boolean, constant, required, shapeSegmentation, string } from "ag-charts-core"; +var { boxPlotSeriesThemeableOptionsDef, commonSeriesOptionsDefs } = _ModuleSupport113; +var boxPlotSeriesOptionsDef = { + ...commonSeriesOptionsDefs, + ...boxPlotSeriesThemeableOptionsDef, + type: required(constant("box-plot")), + xKey: required(string), + minKey: required(string), + q1Key: required(string), + medianKey: required(string), + q3Key: required(string), + maxKey: required(string), + xName: string, + yName: string, + minName: string, + q1Name: string, + medianName: string, + q3Name: string, + maxName: string, + grouped: boolean, + legendItemName: string, + segmentation: shapeSegmentation +}; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotThemes.ts +import { _ModuleSupport as _ModuleSupport114 } from "ag-charts-community"; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE }, + multiSeriesHighlightStyle, + FILL_GRADIENT_LINEAR_DEFAULTS, + FILL_IMAGE_DEFAULTS, + FILL_PATTERN_DEFAULTS, + SAFE_FILL_OPERATION, + SEGMENTATION_DEFAULTS +} = _ModuleSupport114; +var BOX_PLOT_SERIES_THEME = { + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { + $or: [ + { $isGradient: { $palette: "fill" } }, + { $isPattern: { $palette: "fill" } }, + { $isImage: { $palette: "fill" } } + ] + }, + { $palette: "fill" }, + { $mix: [SAFE_FILL_OPERATION, { $ref: "chartBackgroundColor" }, 0.7] } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: 2, + fillOpacity: 1, + strokeOpacity: 1, + lineDash: void 0, + lineDashOffset: 0, + highlight: multiSeriesHighlightStyle(), + segmentation: SEGMENTATION_DEFAULTS + }, + axes: { + [CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE.CATEGORY]: { + groupPaddingInner: 0.2, + crosshair: { + enabled: false, + snap: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/box-plot/boxPlotModule.ts +var BoxPlotModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "box-plot", + moduleFactory: (ctx) => new BoxPlotSeries(ctx), + predictAxis: _ModuleSupport115.predictCartesianTimeAxis, + defaultAxes: _ModuleSupport115.DIRECTION_SWAP_AXES, + themeTemplate: BOX_PLOT_SERIES_THEME, + groupable: true +}; +var BoxPlotSeriesModule = { + type: "series", + name: "box-plot", + chartType: "cartesian", + enterprise: true, + options: boxPlotSeriesOptionsDef, + create: (ctx) => new BoxPlotSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickModule.ts +import { _ModuleSupport as _ModuleSupport125 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeries.ts +import { _ModuleSupport as _ModuleSupport122 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesBase.ts +import { + _ModuleSupport as _ModuleSupport117 +} from "ag-charts-community"; +import { Logger as Logger9 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcAggregation.ts +import { _ModuleSupport as _ModuleSupport116 } from "ag-charts-community"; +var { + AGGREGATION_SPAN, + AGGREGATION_INDEX_X_MAX, + AGGREGATION_INDEX_X_MIN, + AGGREGATION_INDEX_Y_MAX, + AGGREGATION_INDEX_Y_MIN, + aggregationDomain, + aggregationRangeFittingPoints, + compactAggregationIndices, + createAggregationIndices +} = _ModuleSupport116; +var AGGREGATION_THRESHOLD = 1e3; +var OPEN = AGGREGATION_INDEX_X_MIN; +var HIGH = AGGREGATION_INDEX_Y_MAX; +var LOW = AGGREGATION_INDEX_Y_MIN; +var CLOSE = AGGREGATION_INDEX_X_MAX; +function aggregateOhlcData(scale, xValues, highValues, lowValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD) + return; + const [d0, d1] = aggregationDomain(scale, domain); + let maxRange = aggregationRangeFittingPoints(xValues, d0, d1, { smallestKeyInterval }); + let { indexData, valueData } = createAggregationIndices(xValues, highValues, lowValues, d0, d1, maxRange); + const filters = [{ maxRange, indexData }]; + while (maxRange > 64) { + ({ indexData, valueData, maxRange } = compactAggregationIndices(indexData, valueData, maxRange)); + filters.push({ maxRange, indexData }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesBase.ts +var { + fixNumericExtent: fixNumericExtent3, + keyProperty: keyProperty3, + createDatumId: createDatumId2, + SeriesNodePickMode: SeriesNodePickMode2, + ChartAxisDirection: ChartAxisDirection14, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL2, + valueProperty: valueProperty4, + diff: diff2, + animationValidation: animationValidation2, + computeBarFocusBounds: computeBarFocusBounds2, + visibleRangeIndices, + BandScale, + processedDataIsAnimatable, + mergeDefaults: mergeDefaults5, + simpleMemorize2, + getItemStylesPerItemId +} = _ModuleSupport117; +var memoizedAggregateOhlcData = simpleMemorize2(aggregateOhlcData); +var OhlcSeriesNodeEvent = class extends _ModuleSupport117.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.openKey = series.properties.openKey; + this.closeKey = series.properties.closeKey; + this.highKey = series.properties.highKey; + this.lowKey = series.properties.lowKey; + } +}; +var OhlcSeriesBase = class extends _ModuleSupport117.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode2.AXIS_ALIGNED, SeriesNodePickMode2.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["lowKey", "highKey", "openKey", "closeKey"] + }, + propertyNames: { + x: ["xName"], + y: ["lowName", "highName", "openName", "closeName"] + }, + categoryKey: "xValue", + pathsPerSeries: [] + }); + this.NodeEvent = OhlcSeriesNodeEvent; + this.dataAggregationFilters = void 0; + } + async processData(dataController) { + if (!this.visible) + return; + const { xKey, openKey, closeKey, highKey, lowKey } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (animationEnabled) { + if (this.processedData) { + extraProps.push(diff2(this.id, this.processedData)); + } + extraProps.push(animationValidation2()); + } + if (openKey) { + extraProps.push( + valueProperty4(openKey, yScaleType, { + id: `openValue`, + invalidValue: void 0, + missingValue: void 0 + }) + ); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty3(xKey, xScaleType, { id: `xValue` }), + valueProperty4(closeKey, yScaleType, { id: `closeValue` }), + valueProperty4(highKey, yScaleType, { id: `highValue` }), + valueProperty4(lowKey, yScaleType, { id: `lowValue` }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL2] : [], + ...extraProps + ] + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.dataAggregationFilters = this.aggregateData( + dataModel, + processedData + ); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection14.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const highValues = dataModel.resolveColumnById(this, `highValue`, processedData); + const lowValues = dataModel.resolveColumnById(this, `lowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateOhlcData( + xAxis.scale.type, + xValues, + highValues, + lowValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + if (direction !== this.getBarDirection()) { + const { index, def } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = processedData.domain.keys[index]; + if (def.type === "key" && def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yExtent = this.domainForClippedRange(direction, ["highValue", "lowValue"], "xValue"); + return fixNumericExtent3(yExtent); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection14.Y, ["highValue", "lowValue"], "xValue", visibleRange); + } + getZoomRangeFittingItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.zoomFittingVisibleItems( + "xValue", + ["highValue", "lowValue"], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + getVisibleItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.countVisibleItems( + "xValue", + ["highValue", "lowValue"], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + createNodeData() { + const { visible, dataModel, processedData } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const nodeData = []; + const { xKey, highKey, lowKey } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const openValues = dataModel.resolveColumnById(this, "openValue", processedData); + const closeValues = dataModel.resolveColumnById(this, "closeValue", processedData); + const highValues = dataModel.resolveColumnById(this, "highValue", processedData); + const lowValues = dataModel.resolveColumnById(this, "lowValue", processedData); + const { groupScale } = this; + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const groupOffset = groupScale.convert(String(groupIndex)); + const effectiveBarWidth = barWidth >= 1 ? barWidth : groupScale.rawBandwidth; + const applyWidthOffset = BandScale.is(xAxis.scale); + const context = { + itemId: xKey, + nodeData, + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStylesPerItemId(this.getItemStyle.bind(this), "up", "down") + }; + if (!visible) + return context; + const handleDatum = (datumIndex, xValue2, openValue, closeValue, highValue, lowValue, width, crisp) => { + const datum = rawData[datumIndex]; + const xOffset = applyWidthOffset ? width / 2 : 0; + const centerX = xAxis.scale.convert(xValue2) + groupOffset + xOffset; + const yOpen = yAxis.scale.convert(openValue); + const yClose = yAxis.scale.convert(closeValue); + const yHigh = yAxis.scale.convert(highValue); + const yLow = yAxis.scale.convert(lowValue); + const isRising = closeValue > openValue; + const itemId = isRising ? "up" : "down"; + const y = Math.min(yHigh, yLow); + const height = Math.max(yHigh, yLow) - y; + const midPoint = { + x: centerX, + y: y + height / 2 + }; + nodeData.push({ + series: this, + itemId, + datum, + datumIndex, + xKey, + xValue: xValue2, + openValue, + closeValue, + highValue, + lowValue, + midPoint, + aggregatedValue: closeValue, + isRising, + centerX, + width, + y, + height, + yOpen, + yClose, + crisp + }); + }; + const { dataAggregationFilters } = this; + const xScale = xAxis.scale; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const xPosition = (index) => xScale.convert(xValues[index]) + groupOffset; + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + if (dataAggregationFilter == null) { + const invalidData = processedData.invalidData?.get(this.id); + let [start, end] = visibleRangeIndices(1, rawData.length, xAxis.range, (index) => { + const xOffset = applyWidthOffset ? 0 : -effectiveBarWidth / 2; + const x = xPosition(index) + xOffset; + return [x, x + effectiveBarWidth]; + }); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let datumIndex = start; datumIndex < end; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const openValue = openValues[datumIndex]; + const closeValue = closeValues[datumIndex]; + const highValue = highValues[datumIndex]; + const lowValue = lowValues[datumIndex]; + const validLowValue = lowValue != null && lowValue <= openValue && lowValue <= closeValue; + const validHighValue = highValue != null && highValue >= openValue && highValue >= closeValue; + if (!validLowValue) { + Logger9.warnOnce( + `invalid low value for key [${lowKey}] in data element, low value cannot be higher than datum open or close values` + ); + continue; + } + if (!validHighValue) { + Logger9.warnOnce( + `invalid high value for key [${highKey}] in data element, high value cannot be lower than datum open or close values.` + ); + continue; + } + handleDatum(datumIndex, xValue2, openValue, closeValue, highValue, lowValue, effectiveBarWidth, true); + } + } else { + const { maxRange, indexData } = dataAggregationFilter; + const [start, end] = visibleRangeIndices(1, maxRange, xAxis.range, (index) => { + const aggIndex = index * AGGREGATION_SPAN; + const openIndex = indexData[aggIndex + OPEN]; + const closeIndex = indexData[aggIndex + CLOSE]; + if (openIndex === -1) + return; + const xOffset = applyWidthOffset ? 0 : -effectiveBarWidth / 2; + return [xPosition(openIndex) + xOffset, xPosition(closeIndex) + xOffset + effectiveBarWidth]; + }); + for (let i = start; i < end; i += 1) { + const aggIndex = i * AGGREGATION_SPAN; + const openIndex = indexData[aggIndex + OPEN]; + const closeIndex = indexData[aggIndex + CLOSE]; + const highIndex = indexData[aggIndex + HIGH]; + const lowIndex = indexData[aggIndex + LOW]; + if (openIndex === -1) + continue; + const midDatumIndex = Math.trunc((openIndex + closeIndex) / 2); + const xValue2 = xValues[midDatumIndex]; + if (xValue2 == null) + continue; + const openValue = openValues[openIndex]; + const closeValue = closeValues[closeIndex]; + const highValue = highValues[highIndex]; + const lowValue = lowValues[lowIndex]; + const width = Math.abs(xPosition(closeIndex) - xPosition(openIndex)) + effectiveBarWidth; + handleDatum(midDatumIndex, xValue2, openValue, closeValue, highValue, lowValue, width, false); + } + } + return context; + } + isVertical() { + return true; + } + isLabelEnabled() { + return false; + } + updateDatumSelection(opts) { + const data = opts.nodeData ?? []; + return opts.datumSelection.update(data); + } + updateLabelNodes(_opts) { + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData); + } + getItemStyle(datumIndex, isHighlight, highlightState, itemId = "up") { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + const baseStyle = mergeDefaults5(highlightStyle, properties.getStyle(itemId)); + let style = baseStyle; + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId2(createDatumId2(xValue2), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(itemId, datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`, "item", itemId], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults5(overrides, style); + } + } + return style; + } + makeItemStylerParams(itemId, datumIndex, isHighlight, style) { + const { id: seriesId, properties, processedData } = this; + const { xKey, openKey, closeKey, highKey, lowKey } = properties; + const datum = processedData.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const params = { + seriesId, + datum, + itemId, + xKey, + openKey, + closeKey, + highKey, + lowKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style + }; + if ("fill" in params && "fill" in style) { + params.fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + } + return params; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { + xKey, + xName, + yName, + openKey, + openName, + highKey, + highName, + lowKey, + lowName, + closeKey, + closeName, + legendItemName, + tooltip + } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const openValue = dataModel.resolveColumnById(this, `openValue`, processedData)[datumIndex]; + const highValue = dataModel.resolveColumnById(this, `highValue`, processedData)[datumIndex]; + const lowValue = dataModel.resolveColumnById(this, `lowValue`, processedData)[datumIndex]; + const closeValue = dataModel.resolveColumnById(this, `closeValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const itemId = closeValue >= openValue ? "up" : "down"; + const item = this.properties.item[itemId]; + const format = this.getItemStyle(datumIndex, false); + const marker = { + fill: item.fill ?? item.stroke, + fillOpacity: item.fillOpacity ?? item.strokeOpacity ?? 1, + stroke: item.stroke, + strokeWidth: item.strokeWidth ?? 1, + strokeOpacity: item.strokeOpacity ?? 1, + lineDash: item.lineDash ?? [0], + lineDashOffset: item.lineDashOffset ?? 0 + }; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + title: legendItemName, + symbol: { + marker + }, + data: [ + { + label: openName, + fallbackLabel: openKey, + value: this.getAxisValueText(yAxis, "tooltip", openValue, datum, openKey, legendItemName) + }, + { + label: highName, + fallbackLabel: highKey, + value: this.getAxisValueText(yAxis, "tooltip", highValue, datum, highKey, legendItemName) + }, + { + label: lowName, + fallbackLabel: lowKey, + value: this.getAxisValueText(yAxis, "tooltip", lowValue, datum, lowKey, legendItemName) + }, + { + label: closeName, + fallbackLabel: closeKey, + value: this.getAxisValueText(yAxis, "tooltip", closeValue, datum, closeKey, legendItemName) + } + ] + }, + { + seriesId, + datum, + title: yName, + itemId, + xKey, + xName, + yName, + openKey, + openName, + highKey, + highName, + lowKey, + lowName, + closeKey, + closeName, + ...format + } + ); + } + computeFocusBounds(opts) { + const nodeDatum = this.getNodeData()?.at(opts.datumIndex); + if (nodeDatum == null) + return; + const { centerX, y, width, height } = nodeDatum; + const datum = { + x: centerX - width / 2, + y, + width, + height + }; + return computeBarFocusBounds2(this, datum); + } +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickNode.ts +import { _ModuleSupport as _ModuleSupport119 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcNode.ts +import { _ModuleSupport as _ModuleSupport118 } from "ag-charts-community"; +var { Path: Path8, SceneChangeDetection: SceneChangeDetection5, BBox: BBox11 } = _ModuleSupport118; +var OhlcBaseNode = class extends Path8 { + constructor() { + super(...arguments); + this.centerX = 0; + this.y = 0; + this.width = 0; + this.height = 0; + this.yOpen = 0; + this.yClose = 0; + this.crisp = false; + } + computeBBox() { + const { centerX, y, width, height } = this; + return new BBox11(centerX - width / 2, y, width, height); + } + isPointInPath(x, y) { + return this.getBBox().containsPoint(x, y); + } + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } + get midPoint() { + return { x: this.centerX, y: this.y + this.height / 2 }; + } + alignedCoordinates() { + const { y, width, height, crisp } = this; + let { centerX, yOpen, yClose } = this; + let x0 = centerX - width / 2; + let x1 = centerX + width / 2; + let y0 = y; + let y1 = y + height; + if (crisp && width > 1) { + centerX = this.align(centerX); + if (yOpen <= yClose) { + const h = this.align(yOpen, yClose - yOpen); + yOpen = this.align(yOpen); + yClose = yOpen + h; + } else { + const h = this.align(yClose, yOpen - yClose); + yClose = this.align(yClose); + yOpen = yClose + h; + } + const halfWidth = this.align(width / 2); + x0 = centerX - halfWidth; + x1 = centerX + halfWidth; + y0 = this.align(y); + y1 = y0 + this.align(y0, height); + } + return { centerX, x0, x1, y0, y1, yOpen, yClose }; + } + executeStroke(ctx, path) { + const { width, strokeWidth } = this; + if (width < strokeWidth) { + ctx.lineWidth = width; + } + super.executeStroke(ctx, path); + } +}; +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "centerX", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "y", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "width", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "height", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "yOpen", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "yClose", 2); +__decorateClass([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "crisp", 2); +var OhlcNode = class extends OhlcBaseNode { + constructor() { + super(...arguments); + this.strokeAlignment = 0; + } + updatePath() { + const { path } = this; + const { centerX, x0, x1, y0, y1, yOpen, yClose } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const strokeAlignment = this.strokeAlignment > 0 ? pixelRatio / this.strokeAlignment / 2 % 1 : 0; + path.clear(); + path.moveTo(centerX - strokeAlignment, y0); + path.lineTo(centerX - strokeAlignment, y1); + if (Math.abs(x1 - x0) > 1) { + path.moveTo(x0, yOpen - strokeAlignment); + path.lineTo(centerX - strokeAlignment, yOpen - strokeAlignment); + path.moveTo(centerX - strokeAlignment, yClose - strokeAlignment); + path.lineTo(x1, yClose - strokeAlignment); + } + } +}; +__decorateClass([ + SceneChangeDetection5() +], OhlcNode.prototype, "strokeAlignment", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickNode.ts +var { SceneArrayChangeDetection: SceneArrayChangeDetection2, SceneChangeDetection: SceneChangeDetection6, ExtendedPath2D: ExtendedPath2D4, BBox: BBox12 } = _ModuleSupport119; +var CandlestickNode = class extends OhlcBaseNode { + constructor() { + super(...arguments); + this.wickPath = new ExtendedPath2D4(); + this.wickStroke = void 0; + this.wickStrokeWidth = void 0; + this.wickStrokeOpacity = void 0; + this.wickStrokeAlignment = 0; + } + computeDefaultGradientFillBBox() { + const { width, centerX, yOpen, yClose } = this; + const boxTop = Math.min(yOpen, yClose); + const boxBottom = Math.max(yOpen, yClose); + const rectHeight = boxBottom - boxTop; + const x0 = centerX - width / 2; + const x1 = centerX + width / 2; + return new BBox12(x0, boxTop, x1 - x0, rectHeight); + } + updatePath() { + const { + path, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke, + wickStrokeWidth, + wickStrokeOpacity, + wickLineDash, + wickLineDashOffset + } = this; + const { centerX, x0, x1, y0, y1, yOpen, yClose } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const wickStrokeAlignment = this.wickStrokeAlignment > 0 ? pixelRatio / this.wickStrokeAlignment / 2 % 1 : 0; + this.path.clear(); + this.wickPath.clear(); + const needsWickPath = wickStroke != null && wickStroke !== stroke2 || wickStrokeWidth != null && wickStrokeWidth !== strokeWidth || wickStrokeOpacity != null && wickStrokeOpacity !== strokeOpacity || wickLineDash != null && wickLineDash !== lineDash || wickLineDashOffset != null && wickLineDashOffset !== lineDashOffset; + const wickPath = needsWickPath ? this.wickPath : path; + if (Math.abs(x1 - x0) <= 3) { + wickPath.moveTo(centerX - wickStrokeAlignment, y0); + wickPath.lineTo(centerX - wickStrokeAlignment, y1); + return; + } + const boxTop = Math.min(yOpen, yClose); + const boxBottom = Math.max(yOpen, yClose); + const boxStrokeAdjustment = strokeWidth / 2; + wickPath.moveTo(centerX - wickStrokeAlignment, y0); + wickPath.lineTo(centerX - wickStrokeAlignment, boxTop + boxStrokeAdjustment); + wickPath.moveTo(centerX - wickStrokeAlignment, y1); + wickPath.lineTo(centerX - wickStrokeAlignment, boxBottom - boxStrokeAdjustment); + const rectHeight = boxBottom - boxTop - 2 * boxStrokeAdjustment; + if (rectHeight > 0) { + path.rect( + x0 + boxStrokeAdjustment, + boxTop + boxStrokeAdjustment, + x1 - x0 - 2 * boxStrokeAdjustment, + rectHeight + ); + } else { + const boxMid = (boxTop + boxBottom) / 2; + path.moveTo(x0, boxMid); + path.lineTo(x1, boxMid); + } + } + drawPath(ctx) { + super.drawPath(ctx); + const { wickPath } = this; + if (wickPath.isEmpty()) + return; + const { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke = stroke2, + wickStrokeWidth = strokeWidth, + wickStrokeOpacity = strokeOpacity, + wickLineDash = lineDash, + wickLineDashOffset = lineDashOffset + } = this; + if (wickStrokeWidth === 0) + return; + ctx.globalAlpha *= wickStrokeOpacity; + if (typeof wickStroke === "string") { + ctx.strokeStyle = wickStroke; + } + ctx.lineWidth = wickStrokeWidth; + if (wickLineDash != null) { + ctx.setLineDash([...wickLineDash]); + } + ctx.lineDashOffset = wickLineDashOffset; + ctx.stroke(wickPath.getPath2D()); + } +}; +__decorateClass([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStroke", 2); +__decorateClass([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStrokeWidth", 2); +__decorateClass([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStrokeOpacity", 2); +__decorateClass([ + SceneArrayChangeDetection2() +], CandlestickNode.prototype, "wickLineDash", 2); +__decorateClass([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickLineDashOffset", 2); +__decorateClass([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStrokeAlignment", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport121 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport120 } from "ag-charts-community"; +var { BaseProperties: BaseProperties16, Property: Property49, AbstractBarSeriesProperties: AbstractBarSeriesProperties2, makeSeriesTooltip: makeSeriesTooltip2 } = _ModuleSupport120; +var OhlcSeriesItem = class extends BaseProperties16 { + constructor() { + super(...arguments); + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property49 +], OhlcSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property49 +], OhlcSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property49 +], OhlcSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property49 +], OhlcSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property49 +], OhlcSeriesItem.prototype, "lineDashOffset", 2); +var OhlcSeriesItems = class extends BaseProperties16 { + constructor() { + super(...arguments); + this.up = new OhlcSeriesItem(); + this.down = new OhlcSeriesItem(); + } +}; +__decorateClass([ + Property49 +], OhlcSeriesItems.prototype, "up", 2); +__decorateClass([ + Property49 +], OhlcSeriesItems.prototype, "down", 2); +var OhlcSeriesBaseProperties = class extends AbstractBarSeriesProperties2 { +}; +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "xKey", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "openKey", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "closeKey", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "highKey", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "lowKey", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "xName", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "yName", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "openName", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "closeName", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "highName", 2); +__decorateClass([ + Property49 +], OhlcSeriesBaseProperties.prototype, "lowName", 2); +var OhlcSeriesProperties = class extends OhlcSeriesBaseProperties { + constructor() { + super(...arguments); + this.tooltip = makeSeriesTooltip2(); + this.item = new OhlcSeriesItems(); + } + getStyle(itemId) { + const { strokeWidth, strokeOpacity, stroke: stroke2, lineDash, lineDashOffset } = this.item[itemId]; + return { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property49 +], OhlcSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property49 +], OhlcSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property49 +], OhlcSeriesProperties.prototype, "itemStyler", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesProperties.ts +var { BaseProperties: BaseProperties17, makeSeriesTooltip: makeSeriesTooltip3, Property: Property50 } = _ModuleSupport121; +var CandlestickSeriesWick = class extends BaseProperties17 { +}; +__decorateClass([ + Property50 +], CandlestickSeriesWick.prototype, "stroke", 2); +__decorateClass([ + Property50 +], CandlestickSeriesWick.prototype, "strokeWidth", 2); +__decorateClass([ + Property50 +], CandlestickSeriesWick.prototype, "strokeOpacity", 2); +__decorateClass([ + Property50 +], CandlestickSeriesWick.prototype, "lineDash", 2); +__decorateClass([ + Property50 +], CandlestickSeriesWick.prototype, "lineDashOffset", 2); +var CandlestickSeriesItem = class extends BaseProperties17 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.wick = new CandlestickSeriesWick(); + } +}; +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "fill", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "fillOpacity", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "lineDashOffset", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "cornerRadius", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItem.prototype, "wick", 2); +var CandlestickSeriesItems = class extends BaseProperties17 { + constructor() { + super(...arguments); + this.up = new CandlestickSeriesItem(); + this.down = new CandlestickSeriesItem(); + } +}; +__decorateClass([ + Property50 +], CandlestickSeriesItems.prototype, "up", 2); +__decorateClass([ + Property50 +], CandlestickSeriesItems.prototype, "down", 2); +var CandlestickSeriesProperties = class extends OhlcSeriesBaseProperties { + constructor() { + super(); + this.item = new CandlestickSeriesItems(); + this.tooltip = makeSeriesTooltip3(); + this.highlightStyle.deprecated = false; + } + getStyle(itemId) { + const { fill, fillOpacity, strokeWidth, strokeOpacity, stroke: stroke2, lineDash, lineDashOffset, cornerRadius, wick } = this.item[itemId]; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1, + wick + }; + } +}; +__decorateClass([ + Property50 +], CandlestickSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property50 +], CandlestickSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property50 +], CandlestickSeriesProperties.prototype, "itemStyler", 2); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeries.ts +var { isGradientFill, isPatternFill, isImageFill, applyShapeStyle } = _ModuleSupport122; +var CandlestickSeries = class extends OhlcSeriesBase { + constructor() { + super(...arguments); + this.properties = new CandlestickSeriesProperties(); + } + nodeFactory() { + const node = new CandlestickNode(); + node.lineCap = "butt"; + return node; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { up, down } = properties.item; + datumSelection.each((node, datum) => { + const { centerX, width, y, height, yOpen, yClose, crisp } = datum; + const baseStyle = datum.isRising ? up : down; + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + node.centerX = centerX; + node.width = width; + node.y = y; + node.height = height; + node.yOpen = yOpen; + node.yClose = yClose; + node.crisp = crisp; + applyShapeStyle(node, style, this.getShapeFillBBox()); + const styleWick = style?.wick; + node.wickStroke = styleWick?.stroke; + node.wickStrokeWidth = styleWick?.strokeWidth; + node.wickStrokeOpacity = styleWick?.strokeOpacity; + node.wickLineDash = styleWick?.lineDash; + node.wickLineDashOffset = styleWick?.lineDashOffset; + node.wickStrokeAlignment = baseStyle.wick.strokeWidth ?? baseStyle.strokeWidth; + }); + } + legendItemSymbol() { + const { up, down } = this.properties.item; + const upColorStops = isGradientFill(up.fill) ? up.fill.colorStops.map( + (c) => typeof c === "string" ? c : { color: c.color, stop: c.stop == null ? void 0 : c.stop * 0.5 } + ) : [ + { color: isPatternFill(up.fill) || isImageFill(up.fill) ? up.stroke : up.fill, stop: 0 }, + { color: isPatternFill(up.fill) || isImageFill(up.fill) ? up.stroke : up.fill, stop: 0.5 } + ]; + const downColorStops = isGradientFill(down.fill) ? down.fill.colorStops.map( + (c) => typeof c === "string" ? c : { color: c.color, stop: c.stop == null ? void 0 : c.stop * 0.5 } + ) : [{ color: isPatternFill(down.fill) || isImageFill(down.fill) ? down.stroke : down.fill, stop: 0.5 }]; + const fill = { + type: "gradient", + gradient: "linear", + rotation: 90, + colorStops: [...upColorStops, ...downColorStops], + reverse: false + }; + const stroke2 = { + type: "gradient", + gradient: "linear", + rotation: 90, + colorStops: [ + { color: up.stroke, stop: 0 }, + { color: up.stroke, stop: 0.5 }, + { color: down.stroke, stop: 0.5 } + ], + reverse: false + }; + return { + marker: { + fill, + fillOpacity: up.fillOpacity, + stroke: stroke2, + strokeWidth: up.strokeWidth ?? 1, + strokeOpacity: up.strokeOpacity ?? 1, + lineDash: up.lineDash, + lineDashOffset: up.lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id, + data, + visible, + ctx: { legendManager } + } = this; + const { xKey, yName, showInLegend, legendItemName } = this.properties; + if (!data?.data.length || !xKey || legendType !== "category") { + return []; + } + return [ + { + legendType: "category", + id, + itemId: id, + seriesId: id, + enabled: visible && legendManager.getItemEnabled({ seriesId: id, itemId: id }), + label: { + text: legendItemName ?? yName ?? id + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + hasItemStylers() { + return this.properties.itemStyler != null; + } +}; +CandlestickSeries.className = "CandleStickSeries"; +CandlestickSeries.type = "candlestick"; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport123 } from "ag-charts-community"; +import { boolean as boolean2, constant as constant2, number, required as required2, string as string2, undocumented } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs2, candlestickSeriesThemeableOptionsDef } = _ModuleSupport123; +var candlestickSeriesOptionsDef = { + ...commonSeriesOptionsDefs2, + ...candlestickSeriesThemeableOptionsDef, + type: required2(constant2("candlestick")), + xKey: required2(string2), + openKey: required2(string2), + highKey: required2(string2), + lowKey: required2(string2), + closeKey: required2(string2), + xName: string2, + yName: string2, + openName: string2, + highName: string2, + lowName: string2, + closeName: string2 +}; +candlestickSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented(boolean2); +candlestickSeriesOptionsDef.focusPriority = undocumented(number); + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickThemes.ts +import { _ModuleSupport as _ModuleSupport124 } from "ag-charts-community"; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE2 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle2, + FILL_GRADIENT_LINEAR_KEYED_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS2, + FILL_PATTERN_KEYED_DEFAULTS +} = _ModuleSupport124; +function itemTheme(key) { + return { + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + key === "up" ? "transparent" : { $palette: "fill" }, + { $palette: `${key}.fill` } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_KEYED_DEFAULTS(key)], + ["image", FILL_IMAGE_DEFAULTS2], + ["pattern", FILL_PATTERN_KEYED_DEFAULTS(key)] + ] + }, + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: `${key}.stroke` } + ] + } + }; +} +var CANDLESTICK_SERIES_THEME = { + series: { + item: { + up: itemTheme("up"), + down: itemTheme("down") + }, + highlightStyle: { + item: { strokeWidth: 3 } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: multiSeriesHighlightStyle2() + }, + animation: { enabled: false }, + axes: { + [CARTESIAN_AXIS_TYPE2.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE2.ORDINAL_TIME]: { + groupPaddingInner: 0, + crosshair: { + enabled: true + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/candlestick/candlestickModule.ts +var { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE3, CARTESIAN_POSITION } = _ModuleSupport125.ThemeConstants; +var CandlestickModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "candlestick", + moduleFactory: (ctx) => new CandlestickSeries(ctx), + defaultAxes: [ + { + type: CARTESIAN_AXIS_TYPE3.NUMBER, + position: CARTESIAN_POSITION.LEFT + }, + { + type: CARTESIAN_AXIS_TYPE3.ORDINAL_TIME, + position: CARTESIAN_POSITION.BOTTOM + } + ], + themeTemplate: CANDLESTICK_SERIES_THEME, + groupable: false +}; +var CandlestickSeriesModule = { + type: "series", + name: "candlestick", + chartType: "cartesian", + enterprise: true, + options: candlestickSeriesOptionsDef, + create: (ctx) => new CandlestickSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapModule.ts +import { _ModuleSupport as _ModuleSupport131 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeries.ts +import { _ModuleSupport as _ModuleSupport128 } from "ag-charts-community"; +import { Logger as Logger11, toPlainText as toPlainText3 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/util/labelFormatter.ts +import { Logger as Logger10, cachedTextMeasurer as cachedTextMeasurer2, findMaxValue, wrapLines } from "ag-charts-core"; +function generateLabelSecondaryLabelFontSizeCandidates(label, secondaryLabel) { + const { fontSize: labelFontSize, minimumFontSize: labelMinimumFontSize = labelFontSize } = label; + const { + fontSize: secondaryLabelFontSize, + minimumFontSize: secondaryLabelMinimumFontSize = secondaryLabelFontSize + } = secondaryLabel; + const labelTracks = labelFontSize - labelMinimumFontSize; + const secondaryLabelTracks = secondaryLabelFontSize - secondaryLabelMinimumFontSize; + let currentLabelFontSize = label.fontSize; + let currentSecondaryLabelFontSize = secondaryLabel.fontSize; + const out = [{ labelFontSize, secondaryLabelFontSize }]; + while (currentLabelFontSize > labelMinimumFontSize || currentSecondaryLabelFontSize > secondaryLabelMinimumFontSize) { + const labelProgress = labelTracks > 0 ? (currentLabelFontSize - labelMinimumFontSize) / labelTracks : -1; + const secondaryLabelProgress = secondaryLabelTracks > 0 ? (currentSecondaryLabelFontSize - secondaryLabelMinimumFontSize) / secondaryLabelTracks : -1; + if (labelProgress > secondaryLabelProgress) { + currentLabelFontSize--; + } else { + currentSecondaryLabelFontSize--; + } + out.push({ + labelFontSize: currentLabelFontSize, + secondaryLabelFontSize: currentSecondaryLabelFontSize + }); + } + out.reverse(); + return out; +} +function formatStackedLabels(labelValue, labelProps, secondaryLabelValue, secondaryLabelProps, { padding }, sizeFittingHeight) { + const { spacing = 0 } = labelProps; + const widthAdjust = 2 * padding; + const heightAdjust = 2 * padding + spacing; + const minimumHeight = (labelProps.minimumFontSize ?? labelProps.fontSize) + (secondaryLabelProps.minimumFontSize ?? secondaryLabelProps.fontSize); + if (minimumHeight > sizeFittingHeight(minimumHeight + heightAdjust, false).height - heightAdjust) + return; + const fontSizeCandidates = generateLabelSecondaryLabelFontSizeCandidates(labelProps, secondaryLabelProps); + const labelTextSizeProps = { + fontFamily: labelProps.fontFamily, + fontStyle: labelProps.fontStyle, + fontWeight: labelProps.fontWeight + }; + const secondaryLabelTextSizeProps = { + fontFamily: secondaryLabelProps.fontFamily, + fontStyle: secondaryLabelProps.fontStyle, + fontWeight: secondaryLabelProps.fontWeight + }; + let label; + let secondaryLabel; + return findMaxValue(0, fontSizeCandidates.length - 1, (index) => { + const { labelFontSize, secondaryLabelFontSize } = fontSizeCandidates[index]; + const allowTruncation = index === 0; + const labelFont = { ...labelTextSizeProps, fontSize: labelFontSize }; + const secondaryLabelFont = { ...secondaryLabelTextSizeProps, fontSize: secondaryLabelFontSize }; + const labelLineHeight = cachedTextMeasurer2(labelFont).lineHeight(); + const secondaryLabelLineHeight = cachedTextMeasurer2(secondaryLabelFont).lineHeight(); + const sizeFitting = sizeFittingHeight( + labelLineHeight + secondaryLabelLineHeight + heightAdjust, + allowTruncation + ); + const availableWidth = sizeFitting.width - widthAdjust; + const availableHeight = sizeFitting.height - heightAdjust; + if (labelLineHeight + secondaryLabelLineHeight > availableHeight) + return; + if (label == null || label.fontSize !== labelFontSize) { + label = wrapLabel( + labelProps, + labelValue, + availableWidth, + availableHeight, + labelFont, + labelProps.wrapping, + allowTruncation ? labelProps.overflowStrategy : "hide" + ); + } + if (label == null || label.width > availableWidth || label.height > availableHeight) + return; + if (secondaryLabel == null || secondaryLabel.fontSize !== secondaryLabelFontSize) { + secondaryLabel = wrapLabel( + secondaryLabelProps, + secondaryLabelValue, + availableWidth, + availableHeight, + secondaryLabelFont, + secondaryLabelProps.wrapping, + allowTruncation ? secondaryLabelProps.overflowStrategy : "hide" + ); + } + if (secondaryLabel == null) + return; + const totalLabelHeight = label.height + secondaryLabel.height; + if (secondaryLabel.width > availableWidth || totalLabelHeight > availableHeight) + return; + return { + width: Math.max(label.width, secondaryLabel.width), + height: totalLabelHeight + spacing, + meta: sizeFitting.meta, + label, + secondaryLabel + }; + }); +} +function formatSingleLabel(value, props, { padding }, sizeFittingHeight) { + const sizeAdjust = 2 * padding; + const minimumFontSize = Math.min(props.minimumFontSize ?? props.fontSize, props.fontSize); + const textSizeProps = { + fontFamily: props.fontFamily, + fontStyle: props.fontStyle, + fontWeight: props.fontWeight + }; + return findMaxValue(minimumFontSize, props.fontSize, (fontSize) => { + const currentFont = { ...textSizeProps, fontSize }; + const measurer2 = cachedTextMeasurer2(currentFont); + const allowTruncation = fontSize === minimumFontSize; + const lineHeight = props.lineHeight ?? measurer2.lineHeight(); + const sizeFitting = sizeFittingHeight(lineHeight + sizeAdjust, allowTruncation); + const availableWidth = sizeFitting.width - sizeAdjust; + const availableHeight = sizeFitting.height - sizeAdjust; + if (lineHeight > availableHeight || availableWidth < 0) + return; + const lines = wrapLines(value, { + maxWidth: availableWidth, + maxHeight: availableHeight, + font: currentFont, + textWrap: props.wrapping, + overflow: (allowTruncation ? props.overflowStrategy : null) ?? "hide" + }); + if (!lines.length) + return; + const { width, height } = measurer2.measureLines(lines); + const text2 = lines.join("\n"); + return [{ width, height, text: text2, fontSize, lineHeight }, sizeFitting.meta]; + }); +} +function hasInvalidFontSize(label) { + return label?.minimumFontSize != null && label?.fontSize != null && label?.minimumFontSize > label?.fontSize; +} +function formatLabels(baseLabelValue, labelProps, baseSecondaryLabelValue, secondaryLabelProps, layoutParams, sizeFittingHeight) { + const labelValue = labelProps.enabled ? baseLabelValue : void 0; + const secondaryLabelValue = secondaryLabelProps.enabled ? baseSecondaryLabelValue : void 0; + if (hasInvalidFontSize(labelProps) || hasInvalidFontSize(secondaryLabelProps)) { + Logger10.warnOnce(`minimumFontSize should be set to a value less than or equal to the font size`); + } + let value; + if (labelValue != null && secondaryLabelValue != null) { + value = formatStackedLabels( + labelValue, + labelProps, + secondaryLabelValue, + secondaryLabelProps, + layoutParams, + sizeFittingHeight + ); + } + let labelMeta; + if (value == null && labelValue != null) { + labelMeta = formatSingleLabel(labelValue, labelProps, layoutParams, sizeFittingHeight); + } + if (labelMeta != null) { + const [label, meta] = labelMeta; + value = { + width: label.width, + height: label.height, + meta, + label, + secondaryLabel: void 0 + }; + } + let secondaryLabelMeta; + if (value == null && labelValue == null && secondaryLabelValue != null) { + secondaryLabelMeta = formatSingleLabel( + secondaryLabelValue, + secondaryLabelProps, + layoutParams, + sizeFittingHeight + ); + } + if (secondaryLabelMeta != null) { + const [secondaryLabel, meta] = secondaryLabelMeta; + value = { + width: secondaryLabel.width, + height: secondaryLabel.height, + meta, + label: void 0, + secondaryLabel + }; + } + return value; +} +function wrapLabel(props, text2, maxWidth, maxHeight, font2, textWrap, overflow) { + const lines = wrapLines(text2, { maxWidth, maxHeight, font: font2, textWrap, overflow }); + if (!lines.length) + return; + const measurer2 = cachedTextMeasurer2(font2); + const lineHeight = props.lineHeight ?? measurer2.lineHeight(); + const { width } = measurer2.measureLines(lines); + return { + width, + lineHeight, + text: lines.join("\n"), + height: lines.length * lineHeight, + fontSize: font2.fontSize + }; +} + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport127 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/util/autoSizedLabel.ts +import { _ModuleSupport as _ModuleSupport126 } from "ag-charts-community"; +var { Property: Property51 } = _ModuleSupport126; +var BaseAutoSizedLabel = class extends _ModuleSupport126.Label { + constructor() { + super(...arguments); + this.wrapping = "on-space"; + this.overflowStrategy = "ellipsis"; + } +}; +__decorateClass([ + Property51 +], BaseAutoSizedLabel.prototype, "wrapping", 2); +__decorateClass([ + Property51 +], BaseAutoSizedLabel.prototype, "overflowStrategy", 2); +__decorateClass([ + Property51 +], BaseAutoSizedLabel.prototype, "lineHeight", 2); +__decorateClass([ + Property51 +], BaseAutoSizedLabel.prototype, "minimumFontSize", 2); +var AutoSizedLabel = class extends BaseAutoSizedLabel { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property51 +], AutoSizedLabel.prototype, "spacing", 2); +var AutoSizedSecondaryLabel = class extends BaseAutoSizedLabel { +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesProperties.ts +var { CartesianSeriesProperties, makeSeriesTooltip: makeSeriesTooltip4, Property: Property52 } = _ModuleSupport127; +var HeatmapSeriesProperties = class extends CartesianSeriesProperties { + constructor() { + super(...arguments); + this.colorRange = ["black", "black"]; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.itemPadding = 0; + this.label = new AutoSizedLabel(); + this.tooltip = makeSeriesTooltip4(); + } +}; +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "textAlign", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "verticalAlign", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "itemPadding", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property52 +], HeatmapSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode3, + computeBarFocusBounds: computeBarFocusBounds3, + getMissCount, + valueProperty: valueProperty5, + ChartAxisDirection: ChartAxisDirection15, + DEFAULT_CARTESIAN_DIRECTION_KEYS, + DEFAULT_CARTESIAN_DIRECTION_NAMES, + createDatumId: createDatumId3, + ColorScale, + Rect, + PointerEvents, + applyShapeStyle: applyShapeStyle2, + mergeDefaults: mergeDefaults6, + formatValue, + addHitTestersToQuadtree, + findQuadtreeMatch, + updateLabelNode +} = _ModuleSupport128; +var HeatmapSeriesNodeEvent = class extends _ModuleSupport128.CartesianSeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.colorKey = series.properties.colorKey; + } +}; +var textAlignFactors = { + left: -0.5, + center: 0, + right: -0.5 +}; +var verticalAlignFactors = { + top: -0.5, + middle: 0, + bottom: -0.5 +}; +var HeatmapSeries = class extends _ModuleSupport128.CartesianSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: { + ...DEFAULT_CARTESIAN_DIRECTION_KEYS, + color: ["colorKey"] + }, + propertyNames: { + ...DEFAULT_CARTESIAN_DIRECTION_NAMES, + color: ["colorName"] + }, + categoryKey: void 0, + pickModes: [SeriesNodePickMode3.NEAREST_NODE, SeriesNodePickMode3.EXACT_SHAPE_MATCH], + pathsPerSeries: [] + }); + this.properties = new HeatmapSeriesProperties(); + this.NodeEvent = HeatmapSeriesNodeEvent; + this.colorScale = new ColorScale(); + } + async processData(dataController) { + const xAxis = this.axes[ChartAxisDirection15.X]; + const yAxis = this.axes[ChartAxisDirection15.Y]; + if (!xAxis || !yAxis || !this.data?.data.length) { + return; + } + const { xKey, yKey, colorRange, colorKey } = this.properties; + const xScale = this.axes[ChartAxisDirection15.X]?.scale; + const yScale = this.axes[ChartAxisDirection15.Y]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const colorScaleType = this.colorScale.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty5(xKey, xScaleType, { id: "xValue" }), + valueProperty5(yKey, yScaleType, { id: "yValue" }), + ...colorKey ? [valueProperty5(colorKey, colorScaleType, { id: "colorValue", invalidValue: void 0 })] : [] + ] + }); + if (this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const rawDomain = processedData.domain.values[colorKeyIdx].filter((v) => v != null); + const domain = _ModuleSupport128.extent(rawDomain); + this.colorScale.domain = domain ?? []; + if (domain?.length && domain[0] === domain[1]) { + const midIndex = Math.floor(colorRange.length / 2); + this.colorScale.range = [colorRange[midIndex], colorRange[midIndex]]; + } else { + this.colorScale.range = colorRange; + } + this.colorScale.update(); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorDataIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount(this, processedData.defs.values[colorDataIdx].missing); + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const actualCount = processedData.domain.values[colorKeyIdx].filter((v) => v != null).length; + const colorDataMissing = dataCount === 0 || dataCount === missCount || actualCount === 0; + return !colorDataMissing; + } + xCoordinateRange(xValue2, pixelSize) { + const xScale = this.axes[ChartAxisDirection15.X].scale; + const xOffset = pixelSize * (xScale.bandwidth ?? 0) / 2; + const x = xScale.convert(xValue2) + xOffset; + const width = pixelSize * (xScale.bandwidth ?? 10); + return [x, x + width]; + } + yCoordinateRange(yValues, pixelSize) { + const yScale = this.axes[ChartAxisDirection15.Y].scale; + const yOffset = pixelSize * (yScale.bandwidth ?? 0) / 2; + const y = yScale.convert(yValues[0]) + yOffset; + const height = pixelSize * (yScale.bandwidth ?? 10); + return [y, y + height]; + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) + return []; + if (direction === ChartAxisDirection15.X) { + return dataModel.getDomain(this, `xValue`, "value", processedData); + } else { + return dataModel.getDomain(this, `yValue`, "value", processedData); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { data, visible, axes, dataModel, processedData } = this; + const xAxis = axes[ChartAxisDirection15.X]; + const yAxis = axes[ChartAxisDirection15.Y]; + if (!(data && dataModel && processedData && visible && xAxis && yAxis)) + return; + if (xAxis.type !== "category" || yAxis.type !== "category") { + Logger11.warnOnce( + `Heatmap series expected axes to have "category" type, but received "${xAxis.type}" and "${yAxis.type}" instead.` + ); + return; + } + const { xKey, xName, yKey, yName, colorKey, colorName, textAlign, verticalAlign, itemPadding, label } = this.properties; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const colorValues = colorKey ? dataModel.resolveColumnById(this, `colorValue`, processedData) : void 0; + const colorDomain = colorKey ? dataModel.getDomain(this, "colorValue", "value", processedData) : []; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const yOffset = (yScale.bandwidth ?? 0) / 2; + const nodeData = []; + const labelData = []; + const width = xScale.bandwidth ?? 10; + const height = yScale.bandwidth ?? 10; + const textAlignFactor = (width - 2 * itemPadding) * textAlignFactors[textAlign]; + const verticalAlignFactor = (height - 2 * itemPadding) * verticalAlignFactors[verticalAlign]; + const sizeFittingHeight = () => ({ width, height, meta: null }); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xDatum = xValues[datumIndex]; + const yDatum = yValues[datumIndex]; + const x = xScale.convert(xDatum) + xOffset; + const y = yScale.convert(yDatum) + yOffset; + const colorValue = colorValues?.[datumIndex]; + const labelText = label.enabled && colorValue != null ? this.getLabelText( + colorValue, + datum, + colorKey, + "color", + colorDomain, + label, + { value: colorValue, datum, colorKey, colorName, xKey, yKey, xName, yName } + ) : void 0; + const labels = formatLabels( + toPlainText3(labelText), + this.properties.label, + void 0, + this.properties.label, + { padding: itemPadding }, + sizeFittingHeight + ); + const point = { x, y, size: 0 }; + const style = this.getItemStyle({ datumIndex, datum, colorValue }, false); + nodeData.push({ + series: this, + itemId: yKey, + datumIndex, + yKey, + xKey, + xValue: xDatum, + yValue: yDatum, + colorValue, + datum, + point, + width, + height, + midPoint: { x, y }, + missing: colorValues != null && colorValue == null, + style + }); + if (labels?.label != null) { + const { text: text2, fontSize, lineHeight, height: labelHeight } = labels.label; + const { fontStyle, fontFamily, fontWeight, color: color6 } = this.properties.label; + const lx = point.x + textAlignFactor * (width - 2 * itemPadding); + const ly = point.y + verticalAlignFactor * (height - 2 * itemPadding) - (labels.height - labelHeight) * 0.5; + labelData.push({ + series: this, + itemId: yKey, + datum, + datumIndex, + text: text2, + fontSize, + lineHeight, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + textBaseline: verticalAlign, + x: lx, + y: ly, + style + }); + } + } + return { + itemId: this.properties.yKey ?? this.id, + nodeData, + labelData, + scales: this.calculateScaling(), + visible: this.visible + }; + } + nodeFactory() { + return new Rect(); + } + update(params) { + this.ctx.animationManager.skipCurrentBatch(); + return super.update(params); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data); + } + getItemStyle({ datumIndex, datum, colorValue }, isHighlight) { + const { properties } = this; + const { itemStyler, stroke: stroke2, strokeWidth, strokeOpacity } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const style = mergeDefaults6(highlightStyle, { + fill: this.isColorScaleValid() && colorValue != null ? this.colorScale.convert(colorValue) : "transparent", + fillOpacity: 1, + stroke: stroke2, + strokeWidth, + strokeOpacity, + opacity: 1 + }); + let overrides; + if (itemStyler != null && datumIndex != null) { + overrides = this.cachedDatumCallback(createDatumId3(datumIndex, isHighlight ? "highlight" : "node"), () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + }); + } + return overrides ? mergeDefaults6(overrides, style) : style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId, properties } = this; + const { xKey, yKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + yKey, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const xAxis = this.axes[ChartAxisDirection15.X]; + const [visibleMin, visibleMax] = xAxis?.visibleRange ?? []; + const isZoomed = visibleMin !== 0 || visibleMax !== 1; + const crisp = !isZoomed; + datumSelection.each((rect, nodeDatum) => { + const { point, width, height, style } = nodeDatum; + applyShapeStyle2(rect, style); + rect.crisp = crisp; + rect.x = Math.floor(point.x - width / 2); + rect.y = Math.floor(point.y - height / 2); + rect.width = Math.ceil(width); + rect.height = Math.ceil(height); + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + const { enabled } = this.properties.label; + const data = enabled ? labelData : []; + return labelSelection.update(data); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((text2, datum) => { + text2.pointerEvents = PointerEvents.None; + text2.text = datum.text; + text2.fillOpacity = this.getHighlightStyle(false, datum.datumIndex)?.opacity ?? 1; + updateLabelNode(this, text2, this.properties, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties, colorScale, ctx } = this; + const { formatManager } = ctx; + const { xKey, xName, yKey, yName, colorKey, colorName, colorRange, title, legendItemName, tooltip } = properties; + const xAxis = axes[ChartAxisDirection15.X]; + const yAxis = axes[ChartAxisDirection15.Y]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + const colorValue = colorKey != null && this.isColorScaleValid() ? dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex] : void 0; + if (xValue2 == null) + return; + const data = []; + let fill; + if (colorValue == null) { + fill = colorRange[0]; + } else { + fill = colorScale.convert(colorValue); + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue(colorValue) }); + } + data.push( + { + label: xName, + fallbackLabel: xKey, + value: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName) + }, + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, yKey, legendItemName) + } + ); + const format = this.getItemStyle({ datumIndex, datum, colorValue }, false); + if (format.fill != null) { + fill = format.fill; + } + const symbol = fill == null ? void 0 : { + marker: { + shape: "square", + fill, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + } + }; + return this.formatTooltipWithContext( + tooltip, + { title: title ?? legendItemName, symbol, data }, + { + seriesId, + datum, + title, + xKey, + xName, + yKey, + yName, + colorKey, + colorName, + ...format + } + ); + } + getLegendData(legendType) { + if (legendType !== "gradient" || !this.isColorScaleValid() || !this.dataModel) { + return []; + } + return [ + { + legendType: "gradient", + enabled: this.visible, + seriesId: this.id, + series: this.getFormatterContext("color"), + colorDomain: this.colorScale.domain, + colorRange: this.colorScale.range + } + ]; + } + isLabelEnabled() { + return this.properties.label.enabled && Boolean(this.properties.colorKey); + } + getBandScalePadding() { + return { inner: 0, outer: 0 }; + } + computeFocusBounds({ datumIndex }) { + const datum = this.contextNodeData?.nodeData[datumIndex]; + if (datum === void 0) + return void 0; + const { width, height, midPoint } = datum; + const focusRect = { x: midPoint.x - width / 2, y: midPoint.y - height / 2, width, height }; + return computeBarFocusBounds3(this, focusRect); + } + initQuadTree(quadtree) { + addHitTestersToQuadtree(quadtree, this.datumNodesIter()); + } + pickNodesExactShape(point) { + const item = findQuadtreeMatch(this, point); + return item != null && item.distance <= 0 ? [item.datum] : []; + } + pickNodeClosestDatum(point) { + return findQuadtreeMatch(this, point); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +HeatmapSeries.className = "HeatmapSeries"; +HeatmapSeries.type = "heatmap"; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport129 } from "ag-charts-community"; +import { arrayOf, color, constant as constant3, required as required3, string as string3 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs3, heatmapSeriesThemeableOptionsDef, without } = _ModuleSupport129; +var heatmapSeriesOptionsDef = { + ...without(heatmapSeriesThemeableOptionsDef, ["showInLegend"]), + ...without(commonSeriesOptionsDefs3, ["showInLegend"]), + type: required3(constant3("heatmap")), + xKey: required3(string3), + yKey: required3(string3), + colorKey: string3, + xName: string3, + yName: string3, + colorName: string3, + colorRange: arrayOf(color) +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapThemes.ts +import { _ModuleSupport as _ModuleSupport130 } from "ag-charts-community"; +var HEATMAP_SERIES_THEME = { + series: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $ref: "chartBackgroundColor" }, + { $path: ["/0", { $palette: "stroke" }, { $palette: "strokes" }] } + ] + }, + strokeWidth: { $isUserOption: ["./stroke", 2, void 0] }, + // @ts-expect-error undocumented option + colorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "divergingColors" }, + _ModuleSupport130.SAFE_RANGE2_OPERATION + ] + }, + label: { + ..._ModuleSupport130.LABEL_BOXING_DEFAULTS, + enabled: false, + color: { $ref: "textColor" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + wrapping: "on-space", + overflowStrategy: "ellipsis" + }, + itemPadding: 3, + highlight: _ModuleSupport130.singleSeriesHighlightStyle() + }, + gradientLegend: { + enabled: true, + ..._ModuleSupport130.LEGEND_CONTAINER_THEME + } +}; + +// packages/ag-charts-enterprise/src/series/heatmap/heatmapModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE4, CARTESIAN_POSITION: CARTESIAN_POSITION2 } +} = _ModuleSupport131; +var HeatmapModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "heatmap", + moduleFactory: (ctx) => new HeatmapSeries(ctx), + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE4.CATEGORY, position: CARTESIAN_POSITION2.LEFT }, + { type: CARTESIAN_AXIS_TYPE4.CATEGORY, position: CARTESIAN_POSITION2.BOTTOM } + ], + themeTemplate: HEATMAP_SERIES_THEME +}; +var HeatmapSeriesModule = { + type: "series", + name: "heatmap", + chartType: "cartesian", + enterprise: true, + options: heatmapSeriesOptionsDef, + create: (ctx) => new HeatmapSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcModule.ts +import { _ModuleSupport as _ModuleSupport134 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeries.ts +import { _ModuleSupport as _ModuleSupport132 } from "ag-charts-community"; +var { applyShapeStyle: applyShapeStyle3 } = _ModuleSupport132; +var OhlcSeries = class extends OhlcSeriesBase { + constructor() { + super(...arguments); + this.properties = new OhlcSeriesProperties(); + } + nodeFactory() { + const node = new OhlcNode(); + node.lineCap = "square"; + return node; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { up, down } = properties.item; + datumSelection.each((node, datum) => { + const { centerX, width, y, height, yOpen, yClose, crisp } = datum; + const baseStyle = datum.isRising ? up : down; + node.centerX = centerX; + node.width = width; + node.y = y; + node.height = height; + node.yOpen = yOpen; + node.yClose = yClose; + node.crisp = crisp; + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle3(node, style); + node.strokeAlignment = baseStyle.strokeWidth; + }); + } + getLegendData(legendType) { + const { + id, + data, + ctx: { legendManager }, + visible + } = this; + const { + xKey, + yName, + item: { up, down }, + showInLegend, + legendItemName + } = this.properties; + if (!data?.data.length || !xKey || legendType !== "category") { + return []; + } + const fill = { + type: "gradient", + gradient: "linear", + colorSpace: "rgb", + colorStops: [ + { color: up.stroke, stop: 0 }, + { color: up.stroke, stop: 0.5 }, + { color: down.stroke, stop: 0.5 } + ], + rotation: 90 + }; + return [ + { + legendType: "category", + id, + itemId: id, + seriesId: id, + enabled: visible && legendManager.getItemEnabled({ seriesId: id, itemId: id }), + label: { + text: legendItemName ?? yName ?? id + }, + symbol: { + marker: { + fill, + fillOpacity: up.strokeOpacity, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + } + }, + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + hasItemStylers() { + return this.properties.itemStyler != null; + } +}; +OhlcSeries.className = "ohlc"; +OhlcSeries.type = "ohlc"; + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport133 } from "ag-charts-community"; +import { boolean as boolean3, constant as constant4, number as number2, required as required4, string as string4, undocumented as undocumented2 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs4, ohlcSeriesThemeableOptionsDef } = _ModuleSupport133; +var ohlcSeriesOptionsDef = { + ...commonSeriesOptionsDefs4, + ...ohlcSeriesThemeableOptionsDef, + type: required4(constant4("ohlc")), + xKey: required4(string4), + openKey: required4(string4), + highKey: required4(string4), + lowKey: required4(string4), + closeKey: required4(string4), + xName: string4, + yName: string4, + openName: string4, + highName: string4, + lowName: string4, + closeName: string4 +}; +ohlcSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented2(boolean3); +ohlcSeriesOptionsDef.focusPriority = undocumented2(number2); + +// packages/ag-charts-enterprise/src/series/ohlc/ohlcModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE5, CARTESIAN_POSITION: CARTESIAN_POSITION3 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle3 +} = _ModuleSupport134; +var OhlcModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "ohlc", + moduleFactory: (ctx) => new OhlcSeries(ctx), + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE5.NUMBER, position: CARTESIAN_POSITION3.LEFT }, + { type: CARTESIAN_AXIS_TYPE5.ORDINAL_TIME, position: CARTESIAN_POSITION3.BOTTOM } + ], + themeTemplate: { + animation: { enabled: false }, + series: { + item: { + up: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: "up.stroke" } + ] + } + }, + down: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: "down.stroke" } + ] + } + } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: multiSeriesHighlightStyle3(false) + }, + axes: { + [CARTESIAN_AXIS_TYPE5.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE5.ORDINAL_TIME]: { + groupPaddingInner: 0, + crosshair: { + enabled: true + } + } + } + }, + groupable: false +}; +var OhlcSeriesModule = { + type: "series", + name: "ohlc", + chartType: "cartesian", + enterprise: true, + options: ohlcSeriesOptionsDef, + create: (ctx) => new OhlcSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaModule.ts +import { _ModuleSupport as _ModuleSupport142 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/range-area/rangeArea.ts +import { + _ModuleSupport as _ModuleSupport139 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaAggregation.ts +import { _ModuleSupport as _ModuleSupport135 } from "ag-charts-community"; +var { + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX2, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN2, + aggregationDomain: aggregationDomain2, + aggregationIndexForXRatio, + aggregationRangeFittingPoints: aggregationRangeFittingPoints2, + aggregationXRatioForXValue, + compactAggregationIndices: compactAggregationIndices2, + createAggregationIndices: createAggregationIndices2 +} = _ModuleSupport135; +var AGGREGATION_THRESHOLD2 = 1e3; +function aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf); + const aggIndex = aggregationIndexForXRatio(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MAX2]; +} +function aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf); + const aggIndex = aggregationIndexForXRatio(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MIN2]; +} +function aggregateRangeAreaData(scale, xValues, highValues, lowValues, domain, xNeedsValueOf, yNeedsValueOf) { + if (xValues.length < AGGREGATION_THRESHOLD2) + return; + const [d0, d1] = aggregationDomain2(scale, domain); + let maxRange = aggregationRangeFittingPoints2(xValues, d0, d1, { xNeedsValueOf }); + const { indexData, valueData } = createAggregationIndices2(xValues, highValues, lowValues, d0, d1, maxRange, { + xNeedsValueOf, + yNeedsValueOf + }); + let topIndices = []; + let bottomIndices = []; + for (let datumIndex = 0; datumIndex < xValues.length; datumIndex += 1) { + if (aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf)) { + topIndices.push(datumIndex); + } + if (aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf)) { + bottomIndices.push(datumIndex); + } + } + const filters = [{ maxRange, topIndices, bottomIndices }]; + while (maxRange > 64) { + ({ maxRange } = compactAggregationIndices2(indexData, valueData, maxRange, { inPlace: true })); + topIndices = topIndices.filter( + (datumIndex) => aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) + ); + bottomIndices = bottomIndices.filter( + (datumIndex) => aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) + ); + filters.push({ maxRange, topIndices, bottomIndices }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaIntersection.ts +import { _ModuleSupport as _ModuleSupport136 } from "ag-charts-community"; +function getYValueAtX({ span }, x) { + switch (span.type) { + case "linear": + case "step": + case "multi-line": { + const t = (x - span.x0) / (span.x1 - span.x0); + return span.y0 + t * (span.y1 - span.y0); + } + case "cubic": { + const { cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y } = span; + let t = 0.5; + const tolerance = 1e-6; + for (let i = 0; i < 10; i++) { + const mt2 = 1 - t; + const xt = mt2 * mt2 * mt2 * cp0x + 3 * mt2 * mt2 * t * cp1x + 3 * mt2 * t * t * cp2x + t * t * t * cp3x; + const fx = xt - x; + if (Math.abs(fx) < tolerance) + break; + const dxdt = 3 * mt2 * mt2 * (cp1x - cp0x) + 6 * mt2 * t * (cp2x - cp1x) + 3 * t * t * (cp3x - cp2x); + if (Math.abs(dxdt) < 1e-12) + break; + t = t - fx / dxdt; + t = Math.max(0, Math.min(1, t)); + } + const mt = 1 - t; + return mt * mt * mt * cp0y + 3 * mt * mt * t * cp1y + 3 * mt * t * t * cp2y + t * t * t * cp3y; + } + } +} +function findSpanForX(spans, x, startIndex = 0) { + for (let i = startIndex; i < spans.length; i++) { + const span = spans[i]; + const [start, end] = _ModuleSupport136.spanRange(span.span); + if (x >= start.x && x <= end.x) { + return { span, index: i }; + } + if (x < start.x) { + break; + } + } + return { span: null, index: startIndex }; +} +function checkForIntersection(highSpans, lowSpans, x, wasInverted, spanIndex) { + const high = findSpanForX(highSpans, x, spanIndex); + const low = findSpanForX(lowSpans, x, spanIndex); + if (!high.span || !low.span) { + return { intersection: null, spanIndex: high.index, isInverted: wasInverted }; + } + const highY = getYValueAtX(high.span, x); + const lowY = getYValueAtX(low.span, x); + const isInverted = highY > lowY; + const intersection = wasInverted === isInverted ? null : { x, y: highY }; + return { intersection, spanIndex: high.index, isInverted }; +} +function findRangeAreaIntersections(highSpans, lowSpans, minX, maxX, initiallyInverted = false) { + if (highSpans.length === 0 || lowSpans.length === 0) + return []; + const intersections = []; + let wasInverted = initiallyInverted; + let spanIndex = 0; + for (let x = minX; x <= maxX; x += 0.5) { + const result = checkForIntersection(highSpans, lowSpans, x, wasInverted, spanIndex); + if (result.intersection) { + intersections.push(result.intersection.x); + } + spanIndex = result.spanIndex; + wasInverted = result.isInverted; + } + return intersections; +} +function calculateIntersectionSegments(intersections, seriesRect, chartSize, startsInverted, style = {}) { + const horizontalMargin = Math.max(seriesRect.x, chartSize.width - (seriesRect.x + seriesRect.width)); + const verticalMargin = Math.max(seriesRect.y, chartSize.height - (seriesRect.y + seriesRect.height)); + const result = []; + const createClipRect = (x0, x1) => ({ + x0, + y0: -verticalMargin, + x1, + y1: seriesRect.height + verticalMargin + }); + if (startsInverted) { + result.push({ + clipRect: createClipRect(-horizontalMargin, intersections[0] ?? seriesRect.width + horizontalMargin), + ...style + }); + } + const startIndex = startsInverted ? 1 : 0; + for (let i = startIndex; i < intersections.length; i += 2) { + result.push({ + clipRect: createClipRect(intersections[i], intersections[i + 1] ?? seriesRect.width + horizontalMargin), + ...style + }); + } + return result; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaProperties.ts +import { _ModuleSupport as _ModuleSupport137 } from "ag-charts-community"; +var { + BaseProperties: BaseProperties18, + CartesianSeriesProperties: CartesianSeriesProperties2, + InterpolationProperties, + SeriesMarker, + makeSeriesTooltip: makeSeriesTooltip5, + Property: Property53, + DropShadow, + Label: Label2 +} = _ModuleSupport137; +var RangeAreaSeriesLabel = class extends Label2 { + constructor() { + super(...arguments); + this.placement = "outside"; + this.spacing = 0; + } +}; +__decorateClass([ + Property53 +], RangeAreaSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property53 +], RangeAreaSeriesLabel.prototype, "spacing", 2); +var RangeAreaInvertedStyle = class { + constructor() { + this.enabled = false; + this.fillOpacity = 1; + } +}; +__decorateClass([ + Property53 +], RangeAreaInvertedStyle.prototype, "enabled", 2); +__decorateClass([ + Property53 +], RangeAreaInvertedStyle.prototype, "fill", 2); +__decorateClass([ + Property53 +], RangeAreaInvertedStyle.prototype, "fillOpacity", 2); +var RangeAreaLineStyle = class extends BaseProperties18 { + constructor() { + super(...arguments); + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.marker = new SeriesMarker(); + } +}; +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "stroke", 2); +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "lineDash", 2); +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "lineDashOffset", 2); +__decorateClass([ + Property53 +], RangeAreaLineStyle.prototype, "marker", 2); +var RangeAreaItemProperties = class extends BaseProperties18 { + constructor() { + super(...arguments); + this.low = new RangeAreaLineStyle(); + this.high = new RangeAreaLineStyle(); + } +}; +__decorateClass([ + Property53 +], RangeAreaItemProperties.prototype, "low", 2); +__decorateClass([ + Property53 +], RangeAreaItemProperties.prototype, "high", 2); +var SharedRangeAreaMarker = class extends BaseProperties18 { +}; +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "enabled", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "shape", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "size", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "fill", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "fillOpacity", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "stroke", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "strokeWidth", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "strokeOpacity", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "lineDash", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "lineDashOffset", 2); +__decorateClass([ + Property53 +], SharedRangeAreaMarker.prototype, "itemStyler", 2); +var RangeAreaProperties = class extends CartesianSeriesProperties2 { + constructor() { + super(...arguments); + this.fill = "#99CCFF"; + this.fillOpacity = 1; + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.interpolation = new InterpolationProperties(); + this.item = new RangeAreaItemProperties(); + this.invertedStyle = new RangeAreaInvertedStyle(); + this.shadow = new DropShadow().set({ enabled: false }); + this.marker = new SharedRangeAreaMarker(); + this.label = new RangeAreaSeriesLabel(); + this.tooltip = makeSeriesTooltip5(); + this.connectMissingData = false; + } +}; +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "xKey", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "yLowKey", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "yHighKey", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "xName", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "yName", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "yLowName", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "yHighName", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "fill", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "stroke", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "lineDash", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "interpolation", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "styler", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "item", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "invertedStyle", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "shadow", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "marker", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "label", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "tooltip", 2); +__decorateClass([ + Property53 +], RangeAreaProperties.prototype, "connectMissingData", 2); + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaUtil.ts +import { + _ModuleSupport as _ModuleSupport138 +} from "ag-charts-community"; +var { + CollapseMode, + isScaleValid, + pairUpSpans, + prepareAreaFillAnimationFns, + plotInterpolatedLinePathStroke, + prepareLinePathPropertyAnimation, + areScalingEqual +} = _ModuleSupport138; +function prepareRangeAreaPathStrokeAnimationFns(status, highSpans, lowSpans, visibleToggleMode) { + const removePhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.removed); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.removed); + }; + const updatePhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.moved); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.moved); + }; + const addPhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke(ratio3, path, highSpans.added); + plotInterpolatedLinePathStroke(ratio3, path, lowSpans.added); + }; + const pathProperties = prepareLinePathPropertyAnimation(status, visibleToggleMode); + return { status, path: { addPhaseFn, updatePhaseFn, removePhaseFn }, pathProperties }; +} +function prepareRangeAreaPathAnimation(newData, oldData, diff8) { + const isCategoryBased = newData.scales.x?.type === "category"; + const wasCategoryBased = oldData.scales.x?.type === "category"; + if (isCategoryBased !== wasCategoryBased || !isScaleValid(newData.scales.x) || !isScaleValid(oldData.scales.x)) { + return; + } + let status = "updated"; + if (oldData.visible && !newData.visible) { + status = "removed"; + } else if (!oldData.visible && newData.visible) { + status = "added"; + } + const fillSpans = pairUpSpans( + { scales: newData.scales, data: newData.fillData.spans }, + { scales: oldData.scales, data: oldData.fillData.spans }, + CollapseMode.Split + ); + if (fillSpans == null) + return; + const fillPhantomSpans = pairUpSpans( + { scales: newData.scales, data: newData.fillData.phantomSpans }, + { scales: oldData.scales, data: oldData.fillData.phantomSpans }, + CollapseMode.Split + ); + if (fillPhantomSpans == null) + return; + const highStrokeSpans = pairUpSpans( + { scales: newData.scales, data: newData.highStrokeData.spans }, + { scales: oldData.scales, data: oldData.highStrokeData.spans }, + CollapseMode.Split + ); + if (highStrokeSpans == null) + return; + const lowStrokeSpans = pairUpSpans( + { scales: newData.scales, data: newData.lowStrokeData.spans }, + { scales: oldData.scales, data: oldData.lowStrokeData.spans }, + CollapseMode.Split + ); + if (lowStrokeSpans == null) + return; + const fadeMode = "fade"; + const fill = prepareAreaFillAnimationFns(status, fillSpans, fillPhantomSpans, fadeMode); + const stroke2 = prepareRangeAreaPathStrokeAnimationFns(status, highStrokeSpans, lowStrokeSpans, fadeMode); + const hasMotion = (diff8?.changed ?? true) || !areScalingEqual(newData.scales.x, oldData.scales.x) || !areScalingEqual(newData.scales.y, oldData.scales.y) || status !== "updated"; + return { status, fill, stroke: stroke2, hasMotion }; +} + +// packages/ag-charts-enterprise/src/series/range-area/rangeArea.ts +var { + valueProperty: valueProperty6, + keyProperty: keyProperty4, + ChartAxisDirection: ChartAxisDirection16, + mergeDefaults: mergeDefaults7, + updateLabelNode: updateLabelNode2, + fixNumericExtent: fixNumericExtent4, + buildResetPathFn, + resetLabelFn, + resetMarkerFn, + resetMarkerPositionFn, + pathSwipeInAnimation, + resetMotion, + markerSwipeScaleInAnimation, + seriesLabelFadeInAnimation, + animationValidation: animationValidation3, + diff: diff3, + updateClipPath, + computeMarkerFocusBounds, + plotAreaPathFill, + plotLinePathStroke, + interpolatePoints, + pathFadeInAnimation, + markerFadeInAnimation, + fromToMotion, + pathMotion, + extent, + applyShapeFillBBox: applyShapeFillBBox2, + PointerEvents: PointerEvents2, + Marker, + BBox: BBox13, + findMinMax: findMinMax2, + applyShapeStyle: applyShapeStyle4, + processedDataIsAnimatable: processedDataIsAnimatable2, + simpleMemorize2: simpleMemorize22, + markerEnabled, + getMarkerStyles, + calculateSegments: calculateSegments2, + toHighlightString: toHighlightString2, + HighlightState: HighlightState2 +} = _ModuleSupport139; +var memoizedAggregateRangeAreaData = simpleMemorize22(aggregateRangeAreaData); +var RangeAreaSeriesNodeEvent = class extends _ModuleSupport139.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yLowKey = series.properties.yLowKey; + this.yHighKey = series.properties.yHighKey; + } +}; +var BaseSeries = _ModuleSupport139.CartesianSeries; +var RangeAreaSeries = class extends BaseSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pathsPerSeries: ["fill", "lowStroke", "highStroke"], + pickModes: [_ModuleSupport139.SeriesNodePickMode.AXIS_ALIGNED], + propertyKeys: { + [ChartAxisDirection16.X]: ["xKey"], + [ChartAxisDirection16.Y]: ["yLowKey", "yHighKey"] + }, + propertyNames: { + [ChartAxisDirection16.X]: ["xName"], + [ChartAxisDirection16.Y]: ["yLowName", "yHighName", "yName"] + }, + categoryKey: "xValue", + animationResetFns: { + path: buildResetPathFn({ getVisible: () => this.visible, getOpacity: () => this.getOpacity() }), + label: resetLabelFn, + datum: (node, datum) => ({ ...resetMarkerFn(node), ...resetMarkerPositionFn(node, datum) }) + }, + clipFocusBox: false + }); + this.properties = new RangeAreaProperties(); + this.NodeEvent = RangeAreaSeriesNodeEvent; + this.dataAggregationFilters = void 0; + } + async processData(dataController) { + const { xKey, yLowKey, yHighKey } = this.properties; + const xScale = this.axes[ChartAxisDirection16.X]?.scale; + const yScale = this.axes[ChartAxisDirection16.Y]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + if (!this.ctx.animationManager.isSkipped() && this.processedData) { + extraProps.push(diff3(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation3()); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty4(xKey, xScaleType, { id: `xValue` }), + valueProperty6(yLowKey, yScaleType, { id: `yLowValue` }), + valueProperty6(yHighKey, yScaleType, { id: `yHighValue` }), + ...extraProps + ] + }); + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable2(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection16.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + const xNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `xValue`, processedData); + const yNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `yHighValue`, processedData); + return memoizedAggregateRangeAreaData( + xAxis.scale.type, + xValues, + yHighValues, + yLowValues, + domain, + xNeedsValueOf, + yNeedsValueOf + ); + } + xCoordinateRange(xValue2) { + const x = this.axes[ChartAxisDirection16.X].scale.convert(xValue2); + return [x, x]; + } + yCoordinateRange(yValues) { + const y = this.axes[ChartAxisDirection16.Y].scale.convert(yValues[0]); + return [y, y]; + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + const { + domain: { + keys: [keys] + } + } = processedData; + if (direction === ChartAxisDirection16.X) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef.def.valueType === "category") { + return keys; + } + return fixNumericExtent4(extent(keys)); + } else { + const yExtent = this.domainForClippedRange(ChartAxisDirection16.Y, ["yHighValue", "yLowValue"], "xValue"); + const fixedYExtent = findMinMax2(yExtent); + return fixNumericExtent4(fixedYExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection16.Y, ["yHighValue", "yLowValue"], "xValue", visibleRange); + } + createNodeData() { + const { data, dataModel, processedData, axes } = this; + const xAxis = axes[ChartAxisDirection16.X]; + const yAxis = axes[ChartAxisDirection16.Y]; + if (!(data && xAxis && yAxis && dataModel && processedData && this.chart?.seriesRect)) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const { xKey, yLowKey, yHighKey, connectMissingData, interpolation, fill, fillOpacity, item } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yHighValues = dataModel.resolveColumnById(this, "yHighValue", processedData); + const yLowValues = dataModel.resolveColumnById(this, "yLowValue", processedData); + const xPosition = (index) => xScale.convert(xValues[index]) + xOffset; + const labelData = []; + const markerData = []; + const spanPoints = []; + const handleDatumPoint = (datumIndex, yHighValue, yLowValue) => { + const datum = rawData[datumIndex]; + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return; + const currentSpanPoints = spanPoints.at(-1); + if (Number.isFinite(yHighValue) && Number.isFinite(yLowValue)) { + const appendMarker = (id, yValue, y) => { + const { size } = item[id].marker; + markerData.push({ + index: datumIndex, + series: this, + itemId: id, + datum, + datumIndex, + midPoint: { x, y }, + yHighValue, + yLowValue, + xValue: xValue2, + xKey, + yLowKey, + yHighKey, + point: { x, y, size }, + enabled: true + }); + const highLabelDatum = this.createLabelData({ + datumIndex, + point: { x, y }, + value: yValue, + yLowValue, + yHighValue, + itemId: id, + inverted, + datum, + series: this + }); + labelData.push(highLabelDatum); + }; + const inverted = yLowValue > yHighValue; + const x = xPosition(datumIndex); + const yHighCoordinate = yScale.convert(yHighValue); + const yLowCoordinate = yScale.convert(yLowValue); + appendMarker("high", yHighValue, yHighCoordinate); + appendMarker("low", yLowValue, yLowCoordinate); + const spanPoint = { + high: { + point: { x, y: yHighCoordinate }, + xDatum: xValue2, + yDatum: yHighValue + }, + low: { + point: { x, y: yLowCoordinate }, + xDatum: xValue2, + yDatum: yLowValue + } + }; + if (Array.isArray(currentSpanPoints)) { + currentSpanPoints.push(spanPoint); + } else if (currentSpanPoints == null) { + spanPoints.push([spanPoint]); + } else { + currentSpanPoints.skip += 1; + spanPoints.push([spanPoint]); + } + } else if (!connectMissingData) { + if (Array.isArray(currentSpanPoints) || currentSpanPoints == null) { + spanPoints.push({ skip: 0 }); + } else { + currentSpanPoints.skip += 1; + } + } + }; + const { dataAggregationFilters } = this; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + const topIndices = dataAggregationFilter?.topIndices; + const bottomIndices = dataAggregationFilter?.bottomIndices; + let [start, end] = this.visibleRangeIndices("xValue", xAxis.range, topIndices); + start = Math.max(start - 1, 0); + end = Math.min(end + 1, topIndices?.length ?? xValues.length); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let i = start; i < end; i += 1) { + const topDatumIndex = topIndices?.[i] ?? i; + const bottomDatumIndex = bottomIndices?.[i] ?? i; + handleDatumPoint(topDatumIndex, yHighValues[topDatumIndex], yLowValues[bottomDatumIndex]); + } + const highSpans = spanPoints.flatMap((p) => { + if (!Array.isArray(p)) + return []; + const highPoints = p.map((d) => d.high); + return interpolatePoints(highPoints, interpolation); + }); + const lowSpans = spanPoints.flatMap((p) => { + if (!Array.isArray(p)) + return []; + const lowPoints = p.map((d) => d.low); + return interpolatePoints(lowPoints, interpolation); + }); + const segments = calculateSegments2( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene, + false + ); + let intersectionSegments = void 0; + if (this.properties.invertedStyle.enabled) { + const startsInverted = yHighValues[0] < yLowValues[0]; + const intersectionXValues = findRangeAreaIntersections( + highSpans, + lowSpans, + xScale.range[0], + xScale.range[1], + startsInverted + ); + intersectionSegments = calculateIntersectionSegments( + intersectionXValues, + this.chart.seriesRect, + this.ctx.scene, + startsInverted, + this.properties.invertedStyle + ); + } + const getLowOrHighMarkerStyles = (lowOrHigh) => { + const line = item[lowOrHigh]; + const { stroke: stroke2, strokeWidth, strokeOpacity } = line; + const inheritedStyles = { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity }; + return getMarkerStyles(this, line, line.marker, inheritedStyles); + }; + const context = { + itemId: `${yLowKey}-${yHighKey}`, + labelData, + nodeData: markerData, + fillData: { itemId: "high", spans: highSpans, phantomSpans: lowSpans }, + highStrokeData: { itemId: "high", spans: highSpans }, + lowStrokeData: { itemId: "low", spans: lowSpans }, + scales: this.calculateScaling(), + visible: this.visible, + styles: { + low: getLowOrHighMarkerStyles("low"), + high: getLowOrHighMarkerStyles("high") + }, + segments, + intersectionSegments + }; + return context; + } + createLabelData({ + datumIndex, + point, + value, + itemId, + inverted, + datum, + series + }) { + const { xKey, yLowKey, yHighKey, xName, yName, yLowName, yHighName, legendItemName, label } = this.properties; + const { placement } = label; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + let actualItemId = itemId; + if (inverted) { + actualItemId = itemId === "low" ? "high" : "low"; + } + const direction = placement === "outside" && actualItemId === "high" || placement === "inside" && actualItemId === "low" ? -1 : 1; + const yDomain = this.getSeriesDomain(ChartAxisDirection16.Y); + return { + x: point.x, + y: point.y + spacing * direction, + series, + itemId, + datum, + datumIndex, + text: this.getLabelText( + value, + datum, + itemId === "high" ? yHighKey : yLowKey, + "y", + yDomain, + label, + { value, datum, itemId, xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName } + ), + textAlign: "center", + textBaseline: direction === -1 ? "bottom" : "top" + }; + } + isPathOrSelectionDirty() { + const { low, high } = this.properties.item; + return low.marker.isDirty() || high.marker.isDirty(); + } + strokewidthChange() { + const itemStrokeWidthChange = (lowOrHigh) => { + const unhighlightedStrokeWidth = this.properties.item[lowOrHigh].strokeWidth ?? 0; + const highlightedSeriesStrokeWidth = this.properties.highlight.highlightedSeries.item?.[lowOrHigh]?.strokeWidth ?? unhighlightedStrokeWidth; + const highlightedItemStrokeWidth = this.properties.highlight.highlightedItem.item?.[lowOrHigh]?.strokeWidth ?? unhighlightedStrokeWidth; + return unhighlightedStrokeWidth > highlightedItemStrokeWidth || highlightedSeriesStrokeWidth > highlightedItemStrokeWidth; + }; + return itemStrokeWidthChange("low") || itemStrokeWidthChange("high"); + } + updatePathNodes(opts) { + const { visible } = opts; + const [fillPath, lowStrokePath, highStrokePath] = opts.paths; + const segments = this.contextNodeData?.segments; + const highlightDatum = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightState(highlightDatum, false); + const highlightStyle = this.getHighlightStyle(); + const { item, fill, fillOpacity, opacity } = mergeDefaults7( + highlightStyle, + this.getStyle(false, highlightState) + ); + lowStrokePath.setProperties({ + datum: segments, + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: PointerEvents2.None, + stroke: item.low.stroke, + strokeWidth: item.low.strokeWidth, + strokeOpacity: item.low.strokeOpacity, + lineDash: item.low.lineDash, + lineDashOffset: item.low.lineDashOffset, + opacity, + visible + }); + highStrokePath.setProperties({ + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: PointerEvents2.None, + stroke: item.high.stroke, + strokeWidth: item.high.strokeWidth, + strokeOpacity: item.high.strokeOpacity, + lineDash: item.high.lineDash, + lineDashOffset: item.high.lineDashOffset, + opacity, + visible + }); + const fillBBox = this.getShapeFillBBox(); + applyShapeFillBBox2(fillPath, fill, fillBBox); + applyShapeStyle4(fillPath, { stroke: void 0, fill, fillOpacity, opacity }, fillBBox); + const fillSegments = this.contextNodeData?.intersectionSegments ?? segments; + fillPath.setProperties({ + segments: fillSegments, + pointerEvents: PointerEvents2.None, + lineJoin: "round", + fillShadow: this.properties.shadow, + opacity, + visible + }); + fillPath.datum = fillSegments; + updateClipPath(this, fillPath); + updateClipPath(this, lowStrokePath); + updateClipPath(this, highStrokePath); + } + updatePaths(opts) { + this.updateAreaPaths(opts.paths, opts.contextData); + } + updateAreaPaths(paths, contextData) { + for (const path of paths) { + path.visible = contextData.visible; + } + if (contextData.visible) { + this.updateFillPath(paths, contextData); + this.updateStrokePath(paths, contextData); + } else { + for (const path of paths) { + path.path.clear(); + path.markDirty("RangeArea"); + } + } + } + updateFillPath(paths, contextData) { + const [fill] = paths; + fill.path.clear(); + plotAreaPathFill(fill, contextData.fillData); + fill.markDirty("RangeArea"); + } + updateStrokePath(paths, contextData) { + const [, lowStroke, highStroke] = paths; + lowStroke.path.clear(); + highStroke.path.clear(); + plotLinePathStroke(lowStroke, contextData.lowStrokeData.spans); + plotLinePathStroke(highStroke, contextData.highStrokeData.spans); + lowStroke.markDirty("RangeArea"); + highStroke.markDirty("RangeArea"); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const { processedData, axes, properties } = this; + const rules = properties.styler ? this.getStylerMarkerOptions().item : properties.item; + const { low, high } = rules; + const markersEnabled = markerEnabled(processedData.input.count, axes[ChartAxisDirection16.X].scale, { + enabled: low.marker.enabled || high.marker.enabled + }); + if (properties.item.low.marker.isDirty() || properties.item.high.marker.isDirty()) { + datumSelection.clear(); + datumSelection.cleanup(); + } + let resolvedNodeData; + if (markersEnabled) { + if (low.marker.enabled && high.marker.enabled) { + resolvedNodeData = nodeData; + } else { + resolvedNodeData = []; + for (const datum of nodeData) { + if (rules[datum.itemId].marker.enabled) { + resolvedNodeData.push(datum); + } + } + } + } else { + resolvedNodeData = []; + } + return datumSelection.update(resolvedNodeData); + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((_, datum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { fill, fillOpacity, item } = stylerStyle; + const { stroke: stroke2, strokeWidth, strokeOpacity } = item[datum.itemId]; + const { marker } = this.properties.item[datum.itemId]; + const params = this.makeItemStylerParams(datum.itemId); + datum.style = this.getMarkerStyle( + marker, + datum, + params, + { isHighlight, highlightState, resolveMarkerSubPath: ["item", datum.itemId, "marker"] }, + stylerStyle.item[datum.itemId].marker, + { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity + } + ); + }); + } + updateDatumNodes(opts) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum) => { + const { itemId } = datum; + const style = datum.style ?? contextNodeData.styles[itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style, node, datum.point, fillBBox); + }); + if (!isHighlight) { + this.properties.item.low.marker.markClean(); + this.properties.item.high.marker.markClean(); + } + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData, (text2) => { + text2.pointerEvents = PointerEvents2.None; + }); + } + updateLabelNodes(opts) { + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yName: this.properties.yName, + yLowKey: this.properties.yLowKey, + yLowName: this.properties.yLowName ?? this.properties.yLowKey, + yHighKey: this.properties.yHighKey, + yHighName: this.properties.yHighName ?? this.properties.yHighKey, + legendItemName: this.properties.legendItemName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + updateLabelNode2(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getHighlightData(nodeData, highlightedItem) { + const highlightItems = nodeData.filter((nodeDatum) => nodeDatum.datum === highlightedItem.datum); + return highlightItems.length > 0 ? highlightItems : void 0; + } + getStyle(highlighted, highlightState) { + return this.getStylerCouple(highlighted, highlightState)[0]; + } + getStylerMarkerOptions() { + return this.getStylerCouple(false)[1]; + } + getStylerCouple(highlighted, highlightState) { + const { fill, fillOpacity, item, styler } = this.properties; + let stylerResult = {}; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + const markerOpts = { + item: { low: { marker: { enabled: false } }, high: { marker: { enabled: false } } } + }; + const makeItemResult = (lowOrHigh) => { + const stylerItem = stylerResult.item?.[lowOrHigh]; + const { lineDash, lineDashOffset, marker, stroke: stroke2, strokeOpacity, strokeWidth } = item[lowOrHigh]; + markerOpts.item[lowOrHigh].marker.enabled = stylerItem?.marker?.enabled ?? marker.enabled; + return { + marker: { + fill: stylerItem?.marker?.fill ?? marker.fill ?? fill, + fillOpacity: stylerItem?.marker?.fillOpacity ?? marker.fillOpacity, + shape: stylerItem?.marker?.shape ?? marker.shape, + size: stylerItem?.marker?.size ?? marker.size, + lineDash: stylerItem?.marker?.lineDash ?? marker.lineDash, + lineDashOffset: stylerItem?.marker?.lineDashOffset ?? marker.lineDashOffset, + stroke: stylerItem?.marker?.stroke ?? marker.stroke ?? stroke2, + strokeOpacity: stylerItem?.marker?.strokeOpacity ?? marker.strokeOpacity, + strokeWidth: stylerItem?.marker?.strokeWidth ?? marker.strokeWidth + }, + lineDash: stylerItem?.lineDash ?? lineDash, + lineDashOffset: stylerItem?.lineDashOffset ?? lineDashOffset, + stroke: stylerItem?.stroke ?? stroke2, + strokeOpacity: stylerItem?.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerItem?.strokeWidth ?? strokeWidth + }; + }; + const style = { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + opacity: 1, + topLevel: { + lineDash: this.properties.lineDash, + lineDashOffset: this.properties.lineDashOffset, + marker: this.properties.marker, + stroke: this.properties.stroke, + strokeOpacity: this.properties.strokeOpacity, + strokeWidth: this.properties.strokeWidth + }, + item: { + low: makeItemResult("low"), + high: makeItemResult("high") + } + }; + return [style, markerOpts]; + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { fill, fillOpacity, item, xKey, yHighKey, yLowKey } = this.properties; + const highlightState = toHighlightString2(highlightStateEnum ?? HighlightState2.None); + const makeItemParam = (lowOrHigh) => { + const { lineDash, lineDashOffset, marker, stroke: stroke2, strokeOpacity, strokeWidth } = item[lowOrHigh]; + return { + marker: { + fill: marker.fill ?? fill, + fillOpacity: marker.fillOpacity, + size: marker.size, + shape: marker.shape, + stroke: marker.stroke ?? stroke2, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }, + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth + }; + }; + return { + item: { + low: makeItemParam("low"), + high: makeItemParam("high") + }, + fill, + fillOpacity, + highlightState, + highlighted, + seriesId, + xKey, + yLowKey, + yHighKey + }; + } + makeItemStylerParams(itemId) { + const { xKey, yLowKey, yHighKey } = this.properties; + return { xKey, yLowKey, yHighKey, itemId }; + } + getTooltipContent(datumIndex, removeThisDatum) { + const itemId = removeThisDatum?.itemId ?? "high"; + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { xName, yName, yLowKey, yLowName, xKey, yHighKey, yHighName, tooltip, legendItemName } = properties; + const xAxis = axes[ChartAxisDirection16.X]; + const yAxis = axes[ChartAxisDirection16.Y]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yHighValue = dataModel.resolveColumnById(this, `yHighValue`, processedData)[datumIndex]; + const yLowValue = dataModel.resolveColumnById(this, `yLowValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(itemId); + const format = this.getMarkerStyle( + this.properties.item[itemId].marker, + { datumIndex, datum }, + params, + { isHighlight: false, resolveMarkerSubPath: ["item", itemId, "marker"] }, + stylerStyle.item[itemId].marker + ); + const value = `${this.getAxisValueText(yAxis, "tooltip", yLowValue, datum, yLowKey, legendItemName)} - ${this.getAxisValueText(yAxis, "tooltip", yHighValue, datum, yHighKey, legendItemName)}`; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [{ label: yName, fallbackLabel: `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`, value }] + }, + { + seriesId, + datum, + title: yName, + itemId, + xName, + yName, + yLowKey, + yLowName, + xKey, + yHighKey, + yHighName, + legendItemName, + ...format + } + ); + } + legendItemSymbol() { + const { fill, topLevel } = this.getStyle(false); + const { stroke: stroke2, strokeWidth, strokeOpacity, lineDash, marker } = topLevel; + const markerStyle = { + shape: marker.shape, + fill: marker.fill ?? fill, + stroke: marker.stroke ?? stroke2, + fillOpacity: marker.fillOpacity, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }; + return { + marker: markerStyle, + line: { + stroke: stroke2, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { yLowKey, yHighKey, yName, yLowName, yHighName, legendItemName, showInLegend } = this.properties; + const legendItemText = legendItemName ?? yName ?? `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`; + const itemId = `${yLowKey}-${yHighKey}`; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible, + label: { text: `${legendItemText}` }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + isLabelEnabled() { + return this.properties.label.enabled; + } + onDataChange() { + } + nodeFactory() { + return new Marker(); + } + animateEmptyUpdateReady(animationData) { + const { datumSelection, labelSelection, contextData, paths } = animationData; + const { animationManager } = this.ctx; + this.updateAreaPaths(paths, contextData); + pathSwipeInAnimation(this, animationManager, ...paths); + resetMotion([datumSelection], resetMarkerPositionFn); + markerSwipeScaleInAnimation(this, animationManager, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + } + animateReadyResize(animationData) { + const { contextData, paths } = animationData; + this.updateAreaPaths(paths, contextData); + super.animateReadyResize(animationData); + } + animateWaitingUpdateReady(animationData) { + const { animationManager } = this.ctx; + const { datumSelection, labelSelection, contextData, paths, previousContextData } = animationData; + const [fill, lowStroke, highStroke] = paths; + if (fill == null && lowStroke == null && highStroke == null) + return; + this.resetDatumAnimation(animationData); + this.resetLabelAnimation(animationData); + const update = () => { + this.resetPathAnimation(animationData); + this.updateAreaPaths(paths, contextData); + }; + const skip = () => { + animationManager.skipCurrentBatch(); + update(); + }; + if (contextData == null || previousContextData == null) { + update(); + markerFadeInAnimation(this, animationManager, "added", datumSelection); + pathFadeInAnimation(this, "fill_path_properties", animationManager, "add", fill); + pathFadeInAnimation(this, "low_stroke_path_properties", animationManager, "add", lowStroke); + pathFadeInAnimation(this, "high_stroke_path_properties", animationManager, "add", highStroke); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + return; + } + const fns = prepareRangeAreaPathAnimation( + contextData, + previousContextData, + this.processedData?.reduced?.diff?.[this.id] + ); + if (fns === void 0) { + skip(); + return; + } else if (fns.status === "no-op") { + return; + } + fromToMotion(this.id, "fill_path_properties", animationManager, [fill], fns.fill.pathProperties); + fromToMotion(this.id, "low_stroke_path_properties", animationManager, [lowStroke], fns.stroke.pathProperties); + fromToMotion(this.id, "high_stroke_path_properties", animationManager, [highStroke], fns.stroke.pathProperties); + if (fns.status === "added") { + this.updateAreaPaths(paths, contextData); + } else if (fns.status === "removed") { + this.updateAreaPaths(paths, previousContextData); + } else { + pathMotion(this.id, "fill_path_update", animationManager, [fill], fns.fill.path); + pathMotion(this.id, "low_stroke_path_update", animationManager, [lowStroke], fns.stroke.path); + pathMotion(this.id, "high_stroke_path_update", animationManager, [highStroke], fns.stroke.path); + } + if (fns.hasMotion) { + markerFadeInAnimation(this, animationManager, void 0, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + } + this.ctx.animationManager.animate({ + id: this.id, + groupId: "reset_after_animation", + phase: "trailing", + from: {}, + to: {}, + onComplete: () => this.updateAreaPaths(paths, contextData) + }); + } + getFormattedMarkerStyle(datum) { + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(datum.itemId); + return this.getMarkerStyle( + this.properties.item[datum.itemId].marker, + datum, + params, + { isHighlight: true, resolveMarkerSubPath: ["item", datum.itemId, "marker"] }, + void 0, + stylerStyle + ); + } + getMarkerStyle(marker, datum, params, opts, defaultOverrideStyle, inheritedStyle) { + true; + marker.itemStyler = this.properties.marker.itemStyler; + return super.getMarkerStyle(marker, datum, params, opts, defaultOverrideStyle, inheritedStyle); + } + computeFocusBounds(opts) { + const hiBox = computeMarkerFocusBounds(this, opts); + const loBox = computeMarkerFocusBounds(this, { ...opts, datumIndex: opts.datumIndex + 1 }); + if (hiBox && loBox) { + return BBox13.merge([hiBox, loBox]); + } + return void 0; + } + isDatumEnabled(nodeData, datumIndex) { + return datumIndex % 2 === 0 && super.isDatumEnabled(nodeData, datumIndex); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RangeAreaSeries.className = "RangeAreaSeries"; +RangeAreaSeries.type = "range-area"; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport140 } from "ag-charts-community"; +import { + boolean as boolean4, + constant as constant5, + fillOptionsDef, + number as number3, + required as required5, + shapeSegmentation as shapeSegmentation2, + string as string5, + undocumented as undocumented3 +} from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs5, rangeAreaSeriesThemeableOptionsDef } = _ModuleSupport140; +var rangeAreaSeriesOptionsDef = { + ...commonSeriesOptionsDefs5, + ...rangeAreaSeriesThemeableOptionsDef, + type: required5(constant5("range-area")), + xKey: required5(string5), + yLowKey: required5(string5), + yHighKey: required5(string5), + xName: string5, + yName: string5, + yLowName: string5, + yHighName: string5, + legendItemName: string5, + segmentation: shapeSegmentation2, + invertedStyle: { + enabled: boolean4, + ...fillOptionsDef + } +}; +rangeAreaSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented3(boolean4); +rangeAreaSeriesOptionsDef.focusPriority = undocumented3(number3); + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaThemes.ts +import { _ModuleSupport as _ModuleSupport141 } from "ag-charts-community"; +var RANGE_AREA_ITEM = { + lineDash: { + $path: "/series/$index/lineDash" + }, + lineDashOffset: { + $path: "/series/$index/lineDashOffset" + }, + stroke: { + $path: ["/series/$index/stroke", { $palette: "stroke" }] + }, + strokeOpacity: { + $path: "/series/$index/strokeOpacity" + }, + strokeWidth: { + $path: ["/series/$index/strokeWidth", 1] + }, + marker: { + enabled: { + $path: "/series/$index/marker/enabled" + }, + fill: { + $isUserOption: [ + "/series/$index/marker/fill", + { + $if: [ + { + $or: [ + { $isGradient: { $path: "/series/$index/marker/fill" } }, + { $isImage: { $path: "/series/$index/marker/fill" } }, + { $isPattern: { $path: "/series/$index/marker/fill" } } + ] + }, + { + $merge: [ + { $path: "/series/$index/marker/fill" }, + { + $applySwitch: [ + { $path: "type" }, + void 0, + // default case shouldn't be hit because of $if + ["gradient", _ModuleSupport141.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", _ModuleSupport141.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport141.FILL_PATTERN_DEFAULTS] + ] + } + ] + }, + { + $isUserOption: [ + "/series/$index/marker/fill", + { $path: "/series/$index/marker/fill" }, + { $palette: "fill" } + ] + } + ] + }, + { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport141.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", _ModuleSupport141.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport141.FILL_PATTERN_DEFAULTS] + ] + } + ] + }, + fillOpacity: { + $path: "/series/$index/marker/fillOpacity" + }, + lineDash: { + $path: "/series/$index/marker/lineDash" + }, + lineDashOffset: { + $path: "/series/$index/marker/lineDashOffset" + }, + shape: { + $path: "/series/$index/marker/shape" + }, + size: { + $path: ["/series/$index/marker/size", 6] + }, + stroke: { + $path: ["/series/$index/marker/stroke", { $palette: "stroke" }] + }, + strokeOpacity: { + $path: "/series/$index/marker/strokeOpacity" + }, + strokeWidth: { + $path: ["/series/$index/marker/strokeWidth", 2] + } + } +}; +var RANGE_AREA_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport141.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", _ModuleSupport141.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: 0.7, + stroke: { $palette: "stroke" }, + strokeWidth: 1, + marker: { + enabled: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport141.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", _ModuleSupport141.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport141.FILL_PATTERN_DEFAULTS] + ] + }, + shape: "circle", + stroke: { $palette: "stroke" }, + size: 6, + strokeWidth: 2 + }, + nodeClickRange: "nearest", + item: { + low: RANGE_AREA_ITEM, + high: RANGE_AREA_ITEM + }, + label: { + ..._ModuleSupport141.LABEL_BOXING_DEFAULTS, + enabled: false, + placement: "outside", + padding: { $isUserOption: ["./spacing", 0, 10] }, + // compatibility with old `padding` property (now named `spacing`). + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + interpolation: { + type: "linear" + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: _ModuleSupport141.multiSeriesHighlightStyle(), + segmentation: _ModuleSupport141.SEGMENTATION_DEFAULTS, + invertedStyle: { + enabled: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + // @todo(AG-14792) should be { $path: '../fill' } to inherit from series.fill + ["gradient", _ModuleSupport141.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", _ModuleSupport141.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport141.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: { $path: "../fillOpacity" } + } + }, + axes: { + [_ModuleSupport141.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { enabled: true } + } + } +}; + +// packages/ag-charts-enterprise/src/series/range-area/rangeAreaModule.ts +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE6, CARTESIAN_POSITION: CARTESIAN_POSITION4 } +} = _ModuleSupport142; +var RangeAreaModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "range-area", + moduleFactory: (ctx) => new RangeAreaSeries(ctx), + predictAxis: _ModuleSupport142.predictCartesianTimeAxis, + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE6.NUMBER, position: CARTESIAN_POSITION4.LEFT }, + { type: CARTESIAN_AXIS_TYPE6.CATEGORY, position: CARTESIAN_POSITION4.BOTTOM } + ], + themeTemplate: RANGE_AREA_SERIES_THEME +}; +var RangeAreaSeriesModule = { + type: "series", + name: "range-area", + chartType: "cartesian", + enterprise: true, + options: rangeAreaSeriesOptionsDef, + create: (ctx) => new RangeAreaSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarModule.ts +import { _ModuleSupport as _ModuleSupport148 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeries.ts +import { + _ModuleSupport as _ModuleSupport145 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarAggregation.ts +import { _ModuleSupport as _ModuleSupport143 } from "ag-charts-community"; +var { aggregationDomain: aggregationDomain3, aggregationRangeFittingPoints: aggregationRangeFittingPoints3, compactAggregationIndices: compactAggregationIndices3, createAggregationIndices: createAggregationIndices3 } = _ModuleSupport143; +var AGGREGATION_THRESHOLD3 = 1e3; +function aggregateRangeBarData(scale, xValues, highValues, lowValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD3) + return; + const [d0, d1] = aggregationDomain3(scale, domain); + let maxRange = aggregationRangeFittingPoints3(xValues, d0, d1, { smallestKeyInterval }); + let { indexData, valueData } = createAggregationIndices3(xValues, highValues, lowValues, d0, d1, maxRange); + const filters = [{ maxRange, indexData }]; + while (maxRange > 64) { + ({ indexData, valueData, maxRange } = compactAggregationIndices3(indexData, valueData, maxRange)); + filters.push({ maxRange, indexData }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarProperties.ts +import { _ModuleSupport as _ModuleSupport144 } from "ag-charts-community"; +var { AbstractBarSeriesProperties: AbstractBarSeriesProperties3, makeSeriesTooltip: makeSeriesTooltip6, Property: Property54, DropShadow: DropShadow2, Label: Label3 } = _ModuleSupport144; +var RangeBarSeriesLabel = class extends Label3 { + constructor() { + super(...arguments); + this.placement = "inside"; + this.spacing = 0; + } +}; +__decorateClass([ + Property54 +], RangeBarSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property54 +], RangeBarSeriesLabel.prototype, "spacing", 2); +var RangeBarProperties = class extends AbstractBarSeriesProperties3 { + constructor() { + super(...arguments); + this.fill = "#99CCFF"; + this.fillOpacity = 1; + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.shadow = new DropShadow2().set({ enabled: false }); + this.label = new RangeBarSeriesLabel(); + this.tooltip = makeSeriesTooltip6(); + } +}; +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "xKey", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "yLowKey", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "yHighKey", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "xName", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "yName", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "yLowName", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "yHighName", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "styler", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "shadow", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "label", 2); +__decorateClass([ + Property54 +], RangeBarProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode4, + valueProperty: valueProperty7, + keyProperty: keyProperty5, + ChartAxisDirection: ChartAxisDirection17, + checkCrisp, + updateLabelNode: updateLabelNode3, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL3, + LARGEST_KEY_INTERVAL, + diff: diff4, + prepareBarAnimationFunctions, + midpointStartingBarPosition, + resetBarSelectionsFn, + fixNumericExtent: fixNumericExtent5, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation2, + resetLabelFn: resetLabelFn2, + animationValidation: animationValidation4, + computeBarFocusBounds: computeBarFocusBounds4, + visibleRangeIndices: visibleRangeIndices2, + createDatumId: createDatumId4, + ContinuousScale: ContinuousScale5, + Rect: Rect2, + PointerEvents: PointerEvents3, + motion: motion2, + applyShapeStyle: applyShapeStyle5, + findMinMax: findMinMax3, + areScalingEqual: areScalingEqual2, + processedDataIsAnimatable: processedDataIsAnimatable3, + AGGREGATION_SPAN: AGGREGATION_SPAN2, + AGGREGATION_INDEX_X_MAX: AGGREGATION_INDEX_X_MAX2, + AGGREGATION_INDEX_X_MIN: AGGREGATION_INDEX_X_MIN2, + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX3, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN3, + mergeDefaults: mergeDefaults8, + simpleMemorize2: simpleMemorize23, + getItemStyles: getItemStyles2, + calculateSegments: calculateSegments3, + toHighlightString: toHighlightString3, + HighlightState: HighlightState3 +} = _ModuleSupport145; +var memoizedAggregateRangeBarData = simpleMemorize23(aggregateRangeBarData); +var RangeBarSeriesNodeEvent = class extends _ModuleSupport145.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yLowKey = series.properties.yLowKey; + this.yHighKey = series.properties.yHighKey; + } +}; +var RangeBarSeries = class extends _ModuleSupport145.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode4.AXIS_ALIGNED, SeriesNodePickMode4.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["yLowKey", "yHighKey"] + }, + propertyNames: { + x: ["xName"], + y: ["yLowName", "yHighName", "yName"] + }, + categoryKey: "xValue", + datumSelectionGarbageCollection: false, + animationResetFns: { + datum: resetBarSelectionsFn, + label: resetLabelFn2 + } + }); + this.properties = new RangeBarProperties(); + this.dataAggregationFilters = void 0; + this.NodeEvent = RangeBarSeriesNodeEvent; + } + async processData(dataController) { + const { xKey, yLowKey, yHighKey } = this.properties; + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + if (this.processedData) { + extraProps.push(diff4(this.id, this.processedData)); + } + extraProps.push(animationValidation4()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty5(xKey, xScaleType, { id: "xValue" }), + valueProperty7(yLowKey, yScaleType, { id: `yLowValue`, invalidValue: null, ...visibleProps }), + valueProperty7(yHighKey, yScaleType, { id: `yHighValue`, invalidValue: null, ...visibleProps }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL3, LARGEST_KEY_INTERVAL] : [], + ...extraProps + ], + groupByKeys: false + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable3(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection17.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateRangeBarData( + xAxis.scale.type, + xValues, + yHighValues, + yLowValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys] + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } else { + const yExtent = this.domainForClippedRange(direction, ["yHighValue", "yLowValue"], "xValue"); + const fixedYExtent = findMinMax3(yExtent); + return fixNumericExtent5(fixedYExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection17.Y, ["yHighValue", "yLowValue"], "xValue", visibleRange); + } + createNodeData() { + const { data, dataModel, groupScale, processedData, visible } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(data && xAxis && yAxis && dataModel && processedData?.dataSources && this.chart?.seriesRect)) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection17.X; + const { xKey, yLowKey, yHighKey, strokeWidth } = this.properties; + const itemId = `${yLowKey}-${yHighKey}`; + const segments = calculateSegments3( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + const context = { + itemId, + nodeData: [], + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStyles2(this.getItemStyle.bind(this)), + segments + }; + if (!visible) + return context; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const { barWidth: effectiveBarWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale5.is(xScale) ? effectiveBarWidth * -0.5 : 0; + const groupOffset = groupScale.convert(String(groupIndex)); + const defaultCrisp = checkCrisp( + xAxis?.scale, + xAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + const xPosition = (datumIndex) => Math.round(xScale.convert(xValues[datumIndex])) + groupOffset + barOffset; + const handleDatum = (datumIndex, groupedDataIndex, x, width, yLow, yHigh, crisp) => { + const datum = rawData[datumIndex]; + const xDatum = xValues[datumIndex]; + if (xDatum == null) + return; + const rawLowValue = yLowValues[datumIndex]; + const rawHighValue = yHighValues[datumIndex]; + if (!Number.isFinite(rawLowValue?.valueOf()) || !Number.isFinite(rawHighValue?.valueOf())) + return; + const [yLowValue, yHighValue] = rawLowValue < rawHighValue ? [rawLowValue, rawHighValue] : [rawHighValue, rawLowValue]; + const y = Math.round(yScale.convert(yHigh)); + const bottomY = Math.round(yScale.convert(yLow)); + const height = Math.max(strokeWidth, Math.abs(bottomY - y)); + const rect = { + x: barAlongX ? Math.min(y, bottomY) : x, + y: barAlongX ? x : Math.min(y, bottomY), + width: barAlongX ? height : width, + height: barAlongX ? width : height + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const labelData = this.createLabelData({ + datumIndex, + rect, + barAlongX, + yLowValue, + yHighValue, + datum, + series: this + }); + const nodeDatum = { + index: groupedDataIndex, + series: this, + itemId, + datum, + datumIndex, + xValue: xDatum, + yLowValue: rawLowValue, + yHighValue: rawHighValue, + yLowKey, + yHighKey, + xKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + labels: labelData + }; + context.nodeData.push(nodeDatum); + context.labelData.push(...labelData); + }; + const { dataAggregationFilters } = this; + const [r0, r1] = xScale.range; + const range2 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range2); + if (dataAggregationFilter != null) { + const { maxRange, indexData } = dataAggregationFilter; + const [start, end] = visibleRangeIndices2(1, maxRange, xAxis.range, (index) => { + const aggIndex = index * AGGREGATION_SPAN2; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN2]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX2]; + if (xMinIndex === -1) + return; + const midDatumIndex = Math.trunc((xMinIndex + xMaxIndex) / 2); + return [xPosition(midDatumIndex), xPosition(xMaxIndex) + effectiveBarWidth]; + }); + for (let i = start; i < end; i += 1) { + const aggIndex = i * AGGREGATION_SPAN2; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN2]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX2]; + const yMinIndex = indexData[aggIndex + AGGREGATION_INDEX_Y_MIN3]; + const yMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_Y_MAX3]; + if (xMinIndex === -1) + continue; + const midDatumIndex = Math.trunc((xMinIndex + xMaxIndex) / 2); + const xValue2 = xValues[midDatumIndex]; + if (xValue2 == null) + continue; + const x = xPosition(midDatumIndex); + const width = Math.abs(xPosition(xMinIndex) - xPosition(xMaxIndex)) + effectiveBarWidth; + const yLow = yLowValues[yMinIndex]; + const yHigh = yHighValues[yMaxIndex]; + handleDatum(midDatumIndex, 0, x, width, yLow, yHigh, false); + } + } else if (processedData.type === "ungrouped") { + const invalidData = processedData.invalidData?.get(this.id); + let [start, end] = this.visibleRangeIndices("xValue", xAxis.range); + if (processedData.input.count < 1e3) { + start = 0; + end = processedData.input.count; + } + for (let datumIndex = start; datumIndex < end; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const x = xPosition(datumIndex); + const width = effectiveBarWidth; + const yLow = yLowValues[datumIndex]; + const yHigh = yHighValues[datumIndex]; + handleDatum(datumIndex, 0, x, width, yLow, yHigh, defaultCrisp); + } + } else { + for (const { datumIndex, groupIndex: groupDataIndex } of dataModel.forEachGroupDatum(this, processedData)) { + const x = xPosition(datumIndex); + const width = effectiveBarWidth; + const yLow = yLowValues[datumIndex]; + const yHigh = yHighValues[datumIndex]; + handleDatum(datumIndex, groupDataIndex, x, width, yLow, yHigh, defaultCrisp); + } + } + return context; + } + createLabelData({ + datumIndex, + rect, + barAlongX, + yLowValue, + yHighValue, + datum, + series + }) { + const { xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName, label } = this.properties; + const labelParams = { datum, xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName }; + const { placement } = label; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + const paddingDirection = placement === "outside" ? 1 : -1; + const labelPadding = spacing * paddingDirection; + const yDomain = this.getSeriesDomain(ChartAxisDirection17.Y); + const yLowLabel = { + datumIndex, + x: rect.x + (barAlongX ? -labelPadding : rect.width / 2), + y: rect.y + (barAlongX ? rect.height / 2 : rect.height + labelPadding), + textAlign: barAlongX ? "left" : "center", + textBaseline: barAlongX ? "middle" : "bottom", + text: this.getLabelText( + yLowValue, + datum, + yLowKey, + "y", + yDomain, + label, + { itemId: "low", value: yLowValue, ...labelParams } + ), + itemId: "low", + datum, + series + }; + const yHighLabel = { + datumIndex, + x: rect.x + (barAlongX ? rect.width + labelPadding : rect.width / 2), + y: rect.y + (barAlongX ? rect.height / 2 : -labelPadding), + textAlign: barAlongX ? "right" : "center", + textBaseline: barAlongX ? "middle" : "top", + text: this.getLabelText( + yHighValue, + datum, + yHighKey, + "y", + yDomain, + label, + { itemId: "high", value: yHighValue, ...labelParams } + ), + itemId: "high", + datum, + series + }; + if (placement === "outside") { + yLowLabel.textAlign = barAlongX ? "right" : "center"; + yLowLabel.textBaseline = barAlongX ? "middle" : "top"; + yHighLabel.textAlign = barAlongX ? "left" : "center"; + yHighLabel.textBaseline = barAlongX ? "middle" : "bottom"; + } + return [yLowLabel, yHighLabel]; + } + nodeFactory() { + return new Rect2(); + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth, + styler + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke2, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth + }; + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke2, + strokeOpacity, + strokeWidth, + xKey, + yLowKey, + yHighKey + } = this.properties; + const highlightState = toHighlightString3(highlightStateEnum ?? HighlightState3.None); + return { + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + seriesId, + stroke: stroke2, + strokeOpacity, + strokeWidth, + xKey, + yLowKey, + yHighKey + }; + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data, void 0, (datum) => this.getDatumId(datum)); + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style = mergeDefaults8(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId4(this.getDatumId({ xValue: xValue2 }), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults8(overrides, style); + } + } + return style; + } + makeItemStylerParams(datumIndex, isHighlight, style) { + const { id: seriesId, properties, processedData } = this; + const { xKey, yHighKey, yLowKey } = properties; + const datum = processedData.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + xKey, + yHighKey, + yLowKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles(opts) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + opts.datumSelection.each((node, datum) => { + if (!opts.datumSelection.isGarbage(node)) { + const highlightState = this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex); + datum.style = this.getItemStyle(datum.datumIndex, opts.isHighlight, highlightState); + } + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection17.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle5(rect, style, fillBBox); + rect.cornerRadius = style.cornerRadius ?? 0; + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + }); + } + updateLabelSelection(opts) { + const labelData = this.properties.label.enabled ? opts.labelData : []; + return opts.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = PointerEvents3.None; + }); + } + updateLabelNodes(opts) { + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yName: this.properties.yName, + yLowKey: this.properties.yLowKey, + yLowName: this.properties.yLowName ?? this.properties.yLowKey, + yHighKey: this.properties.yHighKey, + yHighName: this.properties.yHighName ?? this.properties.yHighKey, + legendItemName: this.properties.legendItemName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum?.datumIndex).opacity ?? 1; + updateLabelNode3(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yName, yLowKey, yHighKey, yLowName, yHighName, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yHighValue = dataModel.resolveColumnById(this, `yHighValue`, processedData)[datumIndex]; + const yLowValue = dataModel.resolveColumnById(this, `yLowValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + const value = `${this.getAxisValueText(yAxis, "tooltip", yLowValue, datum, yLowKey, legendItemName)} - ${this.getAxisValueText(yAxis, "tooltip", yHighValue, datum, yHighKey, legendItemName)}`; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [{ label: yName, fallbackLabel: `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`, value }] + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yName, + yLowKey, + yHighKey, + yLowName, + yHighName, + legendItemName, + ...format + } + ); + } + legendItemSymbol() { + const { fill, stroke: stroke2, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + HighlightState3.None + ); + return { + marker: { + fill, + stroke: stroke2, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { yName, yLowName, yHighName, yLowKey, yHighKey, legendItemName, showInLegend } = this.properties; + const legendItemText = legendItemName ?? yName ?? `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`; + const itemId = `${yLowKey}-${yHighKey}`; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible, + label: { text: `${legendItemText}` }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + animateEmptyUpdateReady({ datumSelection, labelSelection }) { + const fns = prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(), "normal"), "unknown"); + motion2.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation2(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const { datumSelection: datumSelections, labelSelection, contextData, previousContextData } = data; + const dataDiff = _ModuleSupport145.calculateDataDiff( + this.id, + datumSelections, + this.getDatumId.bind(this), + contextData, + previousContextData, + this.processedData, + this.processedDataUpdated + ); + this.ctx.animationManager.stopByAnimationGroupId(this.id); + const mode = previousContextData == null ? "fade" : "normal"; + const fns = prepareBarAnimationFunctions(midpointStartingBarPosition(this.isVertical(), mode), "added"); + motion2.fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [datumSelections], + fns, + (_, datum) => this.getDatumId(datum), + dataDiff + ); + if (dataDiff?.changed || !areScalingEqual2(contextData.groupScale, previousContextData?.groupScale)) { + seriesLabelFadeInAnimation2(this, "labels", this.ctx.animationManager, labelSelection); + } + } + getDatumId(datum) { + return `${datum.xValue}`; + } + isLabelEnabled() { + return this.properties.label.enabled; + } + onDataChange() { + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds4(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RangeBarSeries.className = "RangeBarSeries"; +RangeBarSeries.type = "range-bar"; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport146 } from "ag-charts-community"; +import { + boolean as boolean5, + constant as constant6, + number as number4, + required as required6, + shapeSegmentation as shapeSegmentation3, + string as string6, + undocumented as undocumented4 +} from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs6, rangeBarSeriesThemeableOptionsDef } = _ModuleSupport146; +var rangeBarSeriesOptionsDef = { + ...commonSeriesOptionsDefs6, + ...rangeBarSeriesThemeableOptionsDef, + type: required6(constant6("range-bar")), + xKey: required6(string6), + yLowKey: required6(string6), + yHighKey: required6(string6), + xName: string6, + yName: string6, + yLowName: string6, + yHighName: string6, + legendItemName: string6, + segmentation: shapeSegmentation3 +}; +rangeBarSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented4(boolean5); +rangeBarSeriesOptionsDef.focusPriority = undocumented4(number4); + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarThemes.ts +import { _ModuleSupport as _ModuleSupport147 } from "ag-charts-community"; +var RANGE_BAR_SERIES_THEME = { + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport147.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", _ModuleSupport147.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport147.FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + ..._ModuleSupport147.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + placement: "inside", + padding: { $isUserOption: ["./spacing", 0, 6] } + // compatibility with old `padding` property (now named `spacing`). + }, + highlight: _ModuleSupport147.multiSeriesHighlightStyle(), + segmentation: _ModuleSupport147.SEGMENTATION_DEFAULTS + }, + axes: { + [_ModuleSupport147.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { enabled: true } + } + } +}; + +// packages/ag-charts-enterprise/src/series/range-bar/rangeBarModule.ts +var RangeBarModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "range-bar", + moduleFactory: (ctx) => new RangeBarSeries(ctx), + predictAxis: _ModuleSupport148.predictCartesianTimeAxis, + defaultAxes: _ModuleSupport148.DIRECTION_SWAP_AXES, + themeTemplate: RANGE_BAR_SERIES_THEME, + groupable: true +}; +var RangeBarSeriesModule = { + type: "series", + name: "range-bar", + chartType: "cartesian", + enterprise: true, + options: rangeBarSeriesOptionsDef, + create: (ctx) => new RangeBarSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallModule.ts +import { _ModuleSupport as _ModuleSupport153 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeries.ts +import { _ModuleSupport as _ModuleSupport150 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport149 } from "ag-charts-community"; +var { AbstractBarSeriesProperties: AbstractBarSeriesProperties4, BaseProperties: BaseProperties19, PropertiesArray: PropertiesArray4, makeSeriesTooltip: makeSeriesTooltip7, Property: Property55, DropShadow: DropShadow3, Label: Label4 } = _ModuleSupport149; +var WaterfallSeriesTotal = class extends BaseProperties19 { +}; +__decorateClass([ + Property55 +], WaterfallSeriesTotal.prototype, "totalType", 2); +__decorateClass([ + Property55 +], WaterfallSeriesTotal.prototype, "index", 2); +__decorateClass([ + Property55 +], WaterfallSeriesTotal.prototype, "axisLabel", 2); +var WaterfallSeriesItemTooltip = class extends BaseProperties19 { +}; +__decorateClass([ + Property55 +], WaterfallSeriesItemTooltip.prototype, "renderer", 2); +var WaterfallSeriesLabel = class extends Label4 { + constructor() { + super(...arguments); + this.placement = "outside-end"; + this.spacing = 0; + } +}; +__decorateClass([ + Property55 +], WaterfallSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property55 +], WaterfallSeriesLabel.prototype, "spacing", 2); +var WaterfallSeriesItem = class extends BaseProperties19 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.stroke = "#c16068"; + this.fillOpacity = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.cornerRadius = 0; + this.shadow = new DropShadow3().set({ enabled: false }); + this.label = new WaterfallSeriesLabel(); + this.tooltip = new WaterfallSeriesItemTooltip(); + } +}; +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "name", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "fill", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "stroke", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "fillOpacity", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "lineDash", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "lineDashOffset", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "strokeWidth", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "cornerRadius", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "itemStyler", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "shadow", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "label", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItem.prototype, "tooltip", 2); +var WaterfallSeriesConnectorLine = class extends BaseProperties19 { + constructor() { + super(...arguments); + this.enabled = true; + this.stroke = "black"; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.strokeWidth = 2; + } +}; +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "enabled", 2); +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "stroke", 2); +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "strokeOpacity", 2); +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "lineDash", 2); +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "lineDashOffset", 2); +__decorateClass([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "strokeWidth", 2); +var WaterfallSeriesItems = class extends BaseProperties19 { + constructor() { + super(...arguments); + this.positive = new WaterfallSeriesItem(); + this.negative = new WaterfallSeriesItem(); + this.total = new WaterfallSeriesItem(); + } +}; +__decorateClass([ + Property55 +], WaterfallSeriesItems.prototype, "positive", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItems.prototype, "negative", 2); +__decorateClass([ + Property55 +], WaterfallSeriesItems.prototype, "total", 2); +var WaterfallSeriesProperties = class extends AbstractBarSeriesProperties4 { + constructor() { + super(...arguments); + this.item = new WaterfallSeriesItems(); + this.totals = new PropertiesArray4(WaterfallSeriesTotal); + this.line = new WaterfallSeriesConnectorLine(); + this.tooltip = makeSeriesTooltip7(); + } + getStyle(itemId) { + const { fillOpacity, strokeWidth, strokeOpacity, fill, stroke: stroke2, lineDash, lineDashOffset, cornerRadius } = this.item[itemId === "subtotal" ? "total" : itemId]; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "xName", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "yName", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "item", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "totals", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "line", 2); +__decorateClass([ + Property55 +], WaterfallSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeries.ts +var { + adjustLabelPlacement, + SeriesNodePickMode: SeriesNodePickMode5, + fixNumericExtent: fixNumericExtent6, + valueProperty: valueProperty8, + keyProperty: keyProperty6, + accumulativeValueProperty, + trailingAccumulatedValueProperty, + ChartAxisDirection: ChartAxisDirection18, + createDatumId: createDatumId5, + checkCrisp: checkCrisp2, + updateLabelNode: updateLabelNode4, + prepareBarAnimationFunctions: prepareBarAnimationFunctions2, + collapsedStartingBarPosition, + resetBarSelectionsFn: resetBarSelectionsFn2, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation3, + resetLabelFn: resetLabelFn3, + animationValidation: animationValidation5, + DEFAULT_CARTESIAN_DIRECTION_KEYS: DEFAULT_CARTESIAN_DIRECTION_KEYS2, + DEFAULT_CARTESIAN_DIRECTION_NAMES: DEFAULT_CARTESIAN_DIRECTION_NAMES2, + computeBarFocusBounds: computeBarFocusBounds5, + isContinuous, + Rect: Rect3, + motion: motion3, + applyShapeStyle: applyShapeStyle6, + mergeDefaults: mergeDefaults9, + getItemStylesPerItemId: getItemStylesPerItemId2, + DataSet +} = _ModuleSupport150; +var WaterfallSeries = class extends _ModuleSupport150.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: DEFAULT_CARTESIAN_DIRECTION_KEYS2, + propertyNames: DEFAULT_CARTESIAN_DIRECTION_NAMES2, + categoryKey: void 0, + pickModes: [SeriesNodePickMode5.NEAREST_NODE, SeriesNodePickMode5.EXACT_SHAPE_MATCH], + pathsPerSeries: ["connector"], + pathsZIndexSubOrderOffset: [-1, -1], + animationResetFns: { + datum: resetBarSelectionsFn2, + label: resetLabelFn3 + } + }); + this.properties = new WaterfallSeriesProperties(); + this.seriesItemTypes = /* @__PURE__ */ new Set(["positive", "negative", "total"]); + } + async processData(dataController) { + const { xKey, yKey, totals } = this.properties; + const { data } = this; + if (!this.visible) + return; + const positiveNumber3 = (v) => isContinuous(v) && Number(v) >= 0; + const negativeNumber = (v) => isContinuous(v) && Number(v) >= 0; + const totalTypeValue = (v) => v === "total" || v === "subtotal"; + const propertyDefinition = { missingValue: void 0, invalidValue: void 0 }; + const dataWithTotals = []; + const totalsMap = totals.reduce((result, total) => { + const totalsAtIndex = result.get(total.index); + if (totalsAtIndex) { + totalsAtIndex.push(total); + } else { + result.set(total.index, [total]); + } + return result; + }, /* @__PURE__ */ new Map()); + for (const [i, datum] of data?.data.entries() ?? []) { + dataWithTotals.push(datum); + const totalsAtIndex = totalsMap.get(i); + if (totalsAtIndex) { + for (const total of totalsAtIndex) { + dataWithTotals.push({ ...total.toJson(), [xKey]: total.axisLabel }); + } + } + } + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + extraProps.push(animationValidation5()); + } + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const { processedData } = await this.requestDataModel( + dataController, + DataSet.wrap(dataWithTotals), + { + props: [ + keyProperty6(xKey, xScaleType, { id: `xValue` }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrent` + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + missingValue: 0, + id: `yCurrentTotal` + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrentPositive`, + validation: positiveNumber3 + }), + accumulativeValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrentNegative`, + validation: negativeNumber + }), + trailingAccumulatedValueProperty(yKey, yScaleType, { + ...propertyDefinition, + id: `yPrevious` + }), + valueProperty8(yKey, yScaleType, { id: `yRaw` }), + // Raw value pass-through. + valueProperty8("totalType", "category", { + id: `totalTypeValue`, + missingValue: void 0, + validation: totalTypeValue + }), + ...isContinuousX ? [_ModuleSupport150.SMALLEST_KEY_INTERVAL, _ModuleSupport150.LARGEST_KEY_INTERVAL] : [], + ...extraProps + ] + } + ); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.updateSeriesItemTypes(); + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys], + values + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + return keys; + } + const isDirectionY = direction === ChartAxisDirection18.Y; + const isReversed = this.getCategoryAxis().isReversed(); + return this.padBandExtent(keys, isReversed !== isDirectionY); + } else { + const yCurrIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrent"); + const yExtent = values[yCurrIndex]; + const fixedYExtent = [Math.min(0, yExtent[0]), Math.max(0, yExtent[1])]; + return fixNumericExtent6(fixedYExtent); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { data, dataModel, processedData } = this; + const categoryAxis = this.getCategoryAxis(); + const valueAxis = this.getValueAxis(); + if (!data || !categoryAxis || !valueAxis || !dataModel || !processedData) { + return; + } + const { line } = this.properties; + const xScale = categoryAxis.scale; + const yScale = valueAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection18.X; + const barWidth = this.getBandwidth(categoryAxis) ?? 10; + const categoryAxisReversed = categoryAxis.isReversed(); + const valueAxisReversed = valueAxis.isReversed(); + if (processedData.type !== "ungrouped") + return; + const context = { + itemId: this.properties.yKey, + nodeData: [], + labelData: [], + pointData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStylesPerItemId2(this.getItemStyle.bind(this), "total", "subtotal", "positive", "negative") + }; + if (!this.visible) + return context; + const pointData = []; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yRawValues = dataModel.resolveColumnById(this, `yRaw`, processedData); + const totalTypeValues = dataModel.resolveColumnById( + this, + `totalTypeValue`, + processedData + ); + const yCurrValues = dataModel.resolveColumnById(this, "yCurrent", processedData); + const yPrevValues = dataModel.resolveColumnById(this, "yPrevious", processedData); + const yCurrTotalValues = dataModel.resolveColumnById(this, "yCurrentTotal", processedData); + const yDomain = this.getSeriesDomain(ChartAxisDirection18.Y); + const crisp = checkCrisp2( + categoryAxis?.scale, + categoryAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + function getValues(isTotal, isSubtotal, datumIndex) { + if (isTotal || isSubtotal) { + return { + cumulativeValue: yCurrTotalValues[datumIndex], + trailingValue: isSubtotal ? trailingSubtotal : 0 + }; + } + return { + cumulativeValue: yCurrValues[datumIndex], + trailingValue: yPrevValues[datumIndex] + }; + } + function getValue(isTotal, isSubtotal, rawValue, cumulativeValue, trailingValue) { + if (isTotal) { + return cumulativeValue; + } + if (isSubtotal) { + return (cumulativeValue ?? 0) - (trailingValue ?? 0); + } + return rawValue; + } + let trailingSubtotal = 0; + const { xKey, yKey, xName, yName } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const datumType = totalTypeValues[datumIndex]; + const isSubtotal = this.isSubtotal(datumType); + const isTotal = this.isTotal(datumType); + const isTotalOrSubtotal = isTotal || isSubtotal; + const xDatum = xValues[datumIndex]; + if (xDatum == null) + continue; + const x = Math.round(xScale.convert(xDatum)); + const rawValue = yRawValues[datumIndex]; + const { cumulativeValue, trailingValue } = getValues(isTotal, isSubtotal, datumIndex); + if (isTotalOrSubtotal) { + trailingSubtotal = cumulativeValue ?? 0; + } + const currY = Math.round(yScale.convert(cumulativeValue)); + const trailY = Math.round(yScale.convert(trailingValue)); + const value = getValue(isTotal, isSubtotal, rawValue, cumulativeValue, trailingValue); + const isPositive = (value ?? 0) >= 0; + const seriesItemType = this.getSeriesItemType(isPositive, datumType); + const { strokeWidth, label } = this.getItemConfig(seriesItemType); + const y = isPositive ? currY : trailY; + const bottomY = isPositive ? trailY : currY; + const barHeight = Math.max(strokeWidth, Math.abs(bottomY - y)); + const rect = { + x: barAlongX ? Math.min(y, bottomY) : x, + y: barAlongX ? x : Math.min(y, bottomY), + width: barAlongX ? barHeight : barWidth, + height: barAlongX ? barWidth : barHeight + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const pointY = isTotalOrSubtotal ? currY : trailY; + const pixelAlignmentOffset = Math.floor(line.strokeWidth) % 2 / 2; + const startY = categoryAxisReversed ? currY : pointY; + const stopY = categoryAxisReversed ? pointY : currY; + let startCoordinates; + let stopCoordinates; + if (barAlongX) { + startCoordinates = { + x: startY + pixelAlignmentOffset, + y: rect.y + }; + stopCoordinates = { + x: stopY + pixelAlignmentOffset, + y: rect.y + rect.height + }; + } else { + startCoordinates = { + x: rect.x, + y: startY + pixelAlignmentOffset + }; + stopCoordinates = { + x: rect.x + rect.width, + y: stopY + pixelAlignmentOffset + }; + } + const pathPoint = { + // lineTo + x: categoryAxisReversed ? stopCoordinates.x : startCoordinates.x, + y: categoryAxisReversed ? stopCoordinates.y : startCoordinates.y, + // moveTo + x2: categoryAxisReversed ? startCoordinates.x : stopCoordinates.x, + y2: categoryAxisReversed ? startCoordinates.y : stopCoordinates.y, + size: 0 + }; + pointData.push(pathPoint); + const itemId = seriesItemType === "subtotal" ? "total" : seriesItemType; + const labelText = this.getLabelText( + value, + datum, + yKey, + "y", + yDomain, + label, + { + itemId, + value, + datum, + xKey, + yKey, + xName, + yName + } + ); + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + const nodeDatum = { + index: datumIndex, + series: this, + itemId: seriesItemType, + datum, + datumIndex, + cumulativeValue: cumulativeValue ?? 0, + xValue: xDatum, + yValue: value, + yKey, + xKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + label: { + text: labelText, + ...adjustLabelPlacement({ + isUpward: (value ?? -1) >= 0 !== valueAxisReversed, + isVertical: !barAlongX, + placement: label.placement, + spacing, + rect + }) + } + }; + context.nodeData.push(nodeDatum); + context.labelData.push(nodeDatum); + } + const connectorLinesEnabled = this.properties.line.enabled; + if (yCurrValues != null && connectorLinesEnabled) { + context.pointData = pointData; + } + return context; + } + updateSeriesItemTypes() { + const { dataModel, seriesItemTypes, processedData } = this; + if (!dataModel || !processedData) { + return; + } + seriesItemTypes.clear(); + const yPositiveIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrentPositive"); + const yNegativeIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrentNegative"); + const totalTypeIndex = dataModel.resolveProcessedDataIndexById(this, `totalTypeValue`); + const positiveDomain = processedData.domain.values[yPositiveIndex] ?? []; + const negativeDomain = processedData.domain.values[yNegativeIndex] ?? []; + if (positiveDomain.length > 0) { + seriesItemTypes.add("positive"); + } + if (negativeDomain.length > 0) { + seriesItemTypes.add("negative"); + } + const itemTypes = processedData?.domain.values[totalTypeIndex]; + if (!itemTypes) { + return; + } + for (const type of itemTypes) { + if (type === "total" || type === "subtotal") { + seriesItemTypes.add("total"); + } + } + } + isSubtotal(datumType) { + return datumType === "subtotal"; + } + isTotal(datumType) { + return datumType === "total"; + } + nodeFactory() { + return new Rect3(); + } + getSeriesItemType(isPositive, datumType) { + return datumType ?? (isPositive ? "positive" : "negative"); + } + getItemConfig(seriesItemType) { + switch (seriesItemType) { + case "positive": { + return this.properties.item.positive; + } + case "negative": { + return this.properties.item.negative; + } + case "subtotal": + case "total": { + return this.properties.item.total; + } + } + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data); + } + getItemStyle(nodeDatum, isHighlight, highlightState, itemId = "total") { + const { properties } = this; + const { datumIndex = 0, datum } = nodeDatum ?? {}; + const propertyItemId = itemId === "subtotal" ? "total" : itemId; + const item = properties.item[propertyItemId]; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + const baseStyle = mergeDefaults9(highlightStyle, properties.getStyle(itemId)); + const { itemStyler } = item; + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId5(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(itemId, datumIndex, datum, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`, "item", propertyItemId], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults9(overrides, style); + } + } + return style; + } + makeItemStylerParams(itemId, datumIndex, datum, isHighlight, style) { + const { id: seriesId, properties } = this; + const { xKey, yKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + itemId, + datum, + xKey, + yKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection18.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle6(rect, style, fillBBox); + rect.cornerRadius = style.cornerRadius ?? 0; + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + if (labelData.length === 0) { + return labelSelection.update([]); + } + const data = labelData.filter((labelDatum) => { + const { label } = this.getItemConfig(labelDatum.itemId); + return label.enabled; + }); + return labelSelection.update(data); + } + updateLabelNodes(opts) { + const params = { + itemId: "positive", + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xName, + yKey: this.properties.yKey, + yName: this.properties.yName ?? this.properties.yName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + params.itemId = datum.itemId; + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex)?.opacity ?? 1; + const label = this.getItemConfig(datum.itemId).label; + updateLabelNode4(this, textNode, params, label, datum.label, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yKey, yName, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yRaw`, processedData)[datumIndex]; + const yCurrTotalValues = dataModel.resolveColumnById(this, "yCurrentTotal", processedData); + const totalTypeValues = dataModel.resolveColumnById( + this, + `totalTypeValue`, + processedData + ); + if (xValue2 == null) + return; + const datumType = totalTypeValues[datumIndex]; + const isPositive = (yValue ?? 0) >= 0; + const seriesItemType = this.getSeriesItemType(isPositive, datumType); + let total; + if (this.isTotal(datumType)) { + total = yCurrTotalValues[datumIndex]; + } else if (this.isSubtotal(datumType)) { + total = yCurrTotalValues[datumIndex]; + for (let previousIndex = datumIndex - 1; previousIndex >= 0; previousIndex -= 1) { + if (this.isSubtotal(totalTypeValues[previousIndex])) { + total = total - yCurrTotalValues[previousIndex]; + break; + } + } + } else { + total = yValue; + } + const nodeDatum = this.contextNodeData?.nodeData?.[datumIndex]; + const format = this.getItemStyle(nodeDatum, false, void 0, nodeDatum?.itemId); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(seriesItemType), + data: [ + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", total, datum, yKey, legendItemName) + } + ] + }, + { seriesId, datum, title: yName, itemId: seriesItemType, xKey, xName, yKey, yName, ...format } + ); + } + legendItemSymbol(item) { + const { fill, stroke: stroke2, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.getItemConfig(item); + return { + marker: { + fill, + stroke: stroke2, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id, seriesItemTypes } = this; + const legendData = []; + const capitalise = (text2) => text2.charAt(0).toUpperCase() + text2.substring(1); + const { showInLegend } = this.properties; + for (const item of seriesItemTypes) { + const { name } = this.getItemConfig(item); + legendData.push({ + legendType: "category", + id, + itemId: item, + seriesId: id, + enabled: true, + label: { text: name ?? capitalise(item) }, + symbol: this.legendItemSymbol(item), + hideInLegend: !showInLegend, + isFixed: true + }); + } + return legendData; + } + toggleSeriesItem() { + } + animateEmptyUpdateReady(opts) { + const { datumSelection, labelSelection, contextData } = opts; + const fns = prepareBarAnimationFunctions2( + collapsedStartingBarPosition(this.isVertical(), this.axes, "normal"), + "unknown" + ); + motion3.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation3(this, "labels", this.ctx.animationManager, labelSelection); + const { pointData } = contextData; + if (!pointData) + return; + if (this.isVertical()) { + this.animateConnectorLinesVertical(opts); + } else { + this.animateConnectorLinesHorizontal(opts); + } + } + animateConnectorLinesHorizontal(opts) { + const { pointData = [] } = opts.contextData; + const [lineNode] = opts.paths; + const { path: linePath } = lineNode; + this.updateLineNode(lineNode); + const valueAxis = this.getValueAxis(); + const valueAxisReversed = valueAxis?.isReversed(); + const compare = valueAxisReversed ? (v, v2) => v < v2 : (v, v2) => v > v2; + const startX = valueAxis?.scale.convert(0); + const endX = pointData.reduce( + (end, point) => { + if (compare(point.x, end)) { + end = point.x; + } + return end; + }, + valueAxisReversed ? Infinity : 0 + ); + const scale = (value, start1, end1, start2, end2) => { + return (value - start1) / (end1 - start1) * (end2 - start2) + start2; + }; + this.ctx.animationManager.animate({ + id: `${this.id}_connectors`, + groupId: this.id, + phase: "initial", + from: startX, + to: endX, + ease: _ModuleSupport150.Motion.easeOut, + collapsable: false, + onUpdate(pointX) { + linePath.clear(true); + for (const [index, point] of pointData.entries()) { + const x = scale(pointX, startX, endX, startX, point.x); + const x2 = scale(pointX, startX, endX, startX, point.x2); + if (index !== 0) { + linePath.lineTo(x, point.y); + } + linePath.moveTo(x2, point.y2); + } + lineNode.checkPathDirty(); + }, + onStop: () => this.resetConnectorLinesPath(opts) + }); + } + animateConnectorLinesVertical(opts) { + const { pointData = [] } = opts.contextData; + const [lineNode] = opts.paths; + const { path: linePath } = lineNode; + this.updateLineNode(lineNode); + const valueAxis = this.getValueAxis(); + const valueAxisReversed = valueAxis?.isReversed(); + const compare = valueAxisReversed ? (v, v2) => v > v2 : (v, v2) => v < v2; + const startY = valueAxis?.scale.convert(0); + const endY = pointData.reduce( + (end, point) => { + if (compare(point.y, end)) { + end = point.y; + } + return end; + }, + valueAxisReversed ? 0 : Infinity + ); + const scale = (value, start1, end1, start2, end2) => { + return (value - start1) / (end1 - start1) * (end2 - start2) + start2; + }; + this.ctx.animationManager.animate({ + id: `${this.id}_connectors`, + groupId: this.id, + phase: "initial", + from: startY, + to: endY, + ease: _ModuleSupport150.Motion.easeOut, + collapsable: false, + onUpdate(pointY) { + linePath.clear(true); + for (const [index, point] of pointData.entries()) { + const y = scale(pointY, startY, endY, startY, point.y); + const y2 = scale(pointY, startY, endY, startY, point.y2); + if (index !== 0) { + linePath.lineTo(point.x, y); + } + linePath.moveTo(point.x2, y2); + } + lineNode.checkPathDirty(); + }, + onStop: () => this.resetConnectorLinesPath(opts) + }); + } + animateReadyResize(data) { + super.animateReadyResize(data); + this.resetConnectorLinesPath(data); + } + updatePaths(opts) { + this.resetConnectorLinesPath({ contextData: opts.contextData, paths: opts.paths }); + } + resetConnectorLinesPath({ + contextData, + paths + }) { + if (paths.length === 0) { + return; + } + const [lineNode] = paths; + this.updateLineNode(lineNode); + const { path: linePath } = lineNode; + linePath.clear(true); + const { pointData } = contextData; + if (!pointData) { + return; + } + for (const [index, point] of pointData.entries()) { + if (index !== 0) { + linePath.lineTo(point.x, point.y); + } + linePath.moveTo(point.x2, point.y2); + } + lineNode.checkPathDirty(); + } + updateLineNode(lineNode) { + const { stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this.properties.line; + lineNode.setProperties({ + fill: void 0, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + lineJoin: "round", + pointerEvents: _ModuleSupport150.PointerEvents.None + }); + } + isLabelEnabled() { + const { positive, negative, total } = this.properties.item; + return positive.label.enabled || negative.label.enabled || total.label.enabled; + } + onDataChange() { + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds5(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + const { positive, negative, total } = this.properties.item; + return positive.itemStyler != null || positive.label.itemStyler != null || negative.itemStyler != null || negative.label.itemStyler != null || total.itemStyler != null || total.label.itemStyler != null; + } +}; +WaterfallSeries.className = "WaterfallSeries"; +WaterfallSeries.type = "waterfall"; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport151 } from "ag-charts-community"; +import { arrayOfDefs, constant as constant7, positiveNumber, required as required7, string as string7, union } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs7, waterfallSeriesThemeableOptionsDef } = _ModuleSupport151; +var waterfallSeriesOptionsDef = { + ...waterfallSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs7, + type: required7(constant7("waterfall")), + xKey: required7(string7), + yKey: required7(string7), + xName: string7, + yName: string7, + totals: arrayOfDefs( + { + totalType: required7(union("total", "subtotal")), + index: required7(positiveNumber), + axisLabel: required7(string7) + }, + "a total definition options array" + ) +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallThemes.ts +import { _ModuleSupport as _ModuleSupport152 } from "ag-charts-community"; +var { FILL_GRADIENT_LINEAR_KEYED_DEFAULTS: FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2, FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS3, FILL_PATTERN_KEYED_DEFAULTS: FILL_PATTERN_KEYED_DEFAULTS2 } = _ModuleSupport152; +function itemTheme2(key, index) { + return { + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $path: [`/${index}`, { $palette: "fill" }, { $palette: "fills" }] }, + { $palette: `${key}.fill` } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2(key)], + ["image", FILL_IMAGE_DEFAULTS3], + ["pattern", FILL_PATTERN_KEYED_DEFAULTS2(key)] + ] + }, + stroke: { $palette: `${key}.stroke` }, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + ..._ModuleSupport152.LABEL_BOXING_DEFAULTS, + enabled: false, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + formatter: void 0, + placement: "outside-end", + padding: { $isUserOption: ["./spacing", 0, 6] } + // compatibility with old `padding` property (now named `spacing`). + } + }; +} +var WATERFALL_SERIES_THEME = { + series: { + item: { + positive: itemTheme2("altUp", 0), + negative: itemTheme2("altDown", 1), + total: itemTheme2("neutral", 2) + }, + line: { + stroke: { $palette: "neutral.stroke" }, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0, + strokeWidth: 2 + }, + highlight: _ModuleSupport152.singleSeriesHighlightStyle() + }, + legend: { + enabled: true, + toggleSeries: false + } +}; + +// packages/ag-charts-enterprise/src/series/waterfall/waterfallModule.ts +var WaterfallModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "waterfall", + solo: true, + moduleFactory: (ctx) => new WaterfallSeries(ctx), + defaultAxes: _ModuleSupport153.DIRECTION_SWAP_AXES, + themeTemplate: WATERFALL_SERIES_THEME +}; +var WaterfallSeriesModule = { + type: "series", + name: "waterfall", + chartType: "cartesian", + enterprise: true, + options: waterfallSeriesOptionsDef, + create: (ctx) => new WaterfallSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorOptionsDefs.ts +var { + NewAreaSeriesModule, + NewBarSeriesModule, + NewBubbleSeriesModule, + NewHistogramSeriesModule, + NewLineSeriesModule, + NewScatterSeriesModule, + numberFormatValidator, + textOrSegments, + without: without2 +} = _ModuleSupport154; +var navigatorHandleOptionsDef = { + width: positiveNumber2, + height: positiveNumber2, + grip: boolean6, + fill: color2, + stroke: color2, + strokeWidth: positiveNumber2, + cornerRadius: positiveNumber2 +}; +var commonIgnoredMiniChartProperties = [ + "cursor", + "highlightStyle", + "listeners", + "nodeClickRange", + "showInLegend", + "showInMiniChart", + "tooltip", + "visible", + "xName", + "yName" +]; +var barIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "label", + "legendItemName", + "direction" +]; +var boxPlotIngnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction", + "legendItemName", + "minName", + "q1Name", + "medianName", + "q3Name", + "maxName" +]; +var bubbleIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "title", + "label", + "labelKey", + "labelName", + "sizeName" +]; +var heatmapIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "title", + "label", + "colorName", + "textAlign", + "verticalAlign", + "itemPadding", + "colorRange" +]; +var histogramIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "label" +]; +var lineIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "title", + "label" +]; +var rangeAreaIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "label", + "yLowName", + "yHighName" +]; +var rangeBarIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction", + "label", + "yLowName", + "yHighName" +]; +var scatterIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "title", + "label", + "labelKey", + "labelName" +]; +var waterfallIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction" +]; +var navigatorOptionsDef = { + enabled: boolean6, + height: positiveNumber2, + spacing: positiveNumber2, + cornerRadius: number5, + mask: { + fill: color2, + fillOpacity: ratio, + stroke: color2, + strokeWidth: positiveNumber2 + }, + minHandle: navigatorHandleOptionsDef, + maxHandle: navigatorHandleOptionsDef, + miniChart: { + enabled: boolean6, + padding: { + top: positiveNumber2, + bottom: positiveNumber2 + }, + label: { + enabled: boolean6, + avoidCollisions: boolean6, + spacing: positiveNumber2, + format: numberFormatValidator, + formatter: callbackOf(textOrSegments), + interval: { + minSpacing: positiveNumber2, + maxSpacing: positiveNumber2, + values: array, + step: number5 + }, + ...fontOptionsDef + }, + series: arrayOfDefs2( + typeUnion( + { + area: without2(NewAreaSeriesModule.options, [...commonIgnoredMiniChartProperties, "type"]), + bar: without2(NewBarSeriesModule.options, [...barIgnoredMiniChartProperties, "type"]), + "box-plot": without2(BoxPlotSeriesModule.options, [...boxPlotIngnoredMiniChartProperties, "type"]), + bubble: without2(NewBubbleSeriesModule.options, [...bubbleIgnoredMiniChartProperties, "type"]), + candlestick: without2(CandlestickSeriesModule.options, [ + ...commonIgnoredMiniChartProperties, + "type" + ]), + heatmap: without2(HeatmapSeriesModule.options, [...heatmapIgnoredMiniChartProperties, "type"]), + histogram: without2(NewHistogramSeriesModule.options, [ + ...histogramIgnoredMiniChartProperties, + "type" + ]), + line: without2(NewLineSeriesModule.options, [...lineIgnoredMiniChartProperties, "type"]), + ohlc: without2(OhlcSeriesModule.options, [...commonIgnoredMiniChartProperties, "type"]), + "range-area": without2(RangeAreaSeriesModule.options, [ + ...rangeAreaIgnoredMiniChartProperties, + "type" + ]), + "range-bar": without2(RangeBarSeriesModule.options, [...rangeBarIgnoredMiniChartProperties, "type"]), + scatter: without2(NewScatterSeriesModule.options, [...scatterIgnoredMiniChartProperties, "type"]), + waterfall: without2(WaterfallSeriesModule.options, [...waterfallIgnoredMiniChartProperties, "type"]) + }, + "miniChart series options" + ) + ) + } +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorTheme.ts +var validMiniChartSeriesTypes = [ + "area", + "bar", + "bubble", + "candlestick", + "heatmap", + "histogram", + "line", + "ohlc", + "range-area", + "range-bar", + "scatter", + "waterfall" +]; +var priceVolumePresetIgnoredMiniChartProperties = [ + "itemStyler", + "direction", + "fill", + "fillGradientDefaults", + "fillPatternDefaults", + "fillImageDefaults", + "fillOpacity", + "shadow", + "focusPriority", + "highlight", + "lineDash", + "lineDashOffset", + "strokeWidth" +]; +function miniChartSeriesTheme(seriesPath, typePath) { + return { + $merge: [ + { + $switch: [ + typePath, + {}, + [ + ["area", "line", "range-area"], + { + marker: { + enabled: { + $isUserOption: [ + "/series/$index/marker/enabled", + { $path: ["/series/$index/marker/enabled", false] }, + false + ] + } + } + } + ] + ] + }, + { + $omit: [ + { + $switch: [ + typePath, + commonIgnoredMiniChartProperties, + ["bar", barIgnoredMiniChartProperties], + ["box-plot", boxPlotIngnoredMiniChartProperties], + ["bubble", bubbleIgnoredMiniChartProperties], + ["heatmap", heatmapIgnoredMiniChartProperties], + ["histogram", histogramIgnoredMiniChartProperties], + [ + "line", + [...lineIgnoredMiniChartProperties, ...priceVolumePresetIgnoredMiniChartProperties] + ], + ["range-area", rangeAreaIgnoredMiniChartProperties], + ["range-bar", rangeBarIgnoredMiniChartProperties], + ["scatter", scatterIgnoredMiniChartProperties], + ["waterfall", waterfallIgnoredMiniChartProperties] + ] + }, + seriesPath + ] + } + ] + }; +} +var NAVIGATOR_THEME = { + enabled: false, + height: { $if: [{ $path: "./miniChart/enabled" }, 40, 18] }, + cornerRadius: 4, + mask: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.1, + stroke: { $ref: "borderColor" }, + strokeWidth: 1 + }, + minHandle: { + fill: { $ref: "chartBackgroundColor" }, + stroke: { $ref: "borderColor" }, + strokeWidth: 1, + width: 12, + height: 24, + cornerRadius: 4 + }, + maxHandle: { + fill: { $ref: "chartBackgroundColor" }, + stroke: { $ref: "borderColor" }, + strokeWidth: 1, + width: 12, + height: 24, + cornerRadius: 4 + }, + miniChart: { + enabled: false, + label: { + color: { $ref: "textColor" }, + fontSize: { $rem: _ModuleSupport155.FONT_SIZE_RATIO.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + spacing: 5 + }, + padding: { + top: 0, + bottom: 0 + }, + series: { + $apply: [ + miniChartSeriesTheme( + { $path: "/series/$index" }, + { + $path: [ + "/navigator/miniChart/series/$index/type", + { $path: ["type", { $path: "/series/$index/type" }] } + ] + } + ), + { + // TODO: this should be a $switch but switches can not resolve the case value yet + $if: [ + { + $or: validMiniChartSeriesTypes.map((type) => ({ + $eq: [{ $path: "/series/0/type" }, type] + })) + }, + { + $map: [ + miniChartSeriesTheme({ $value: "$1" }, { $path: "/series/$index/type" }), + { $path: "/series" } + ] + }, + void 0 + ] + } + ] + } + } +}; + +// packages/ag-charts-enterprise/src/features/navigator/navigatorModule.ts +var NavigatorModule = { + type: "root", + optionsKey: "navigator", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new Navigator(ctx), + removable: false, + // Toggling this module causes zoom state flakiness. + themeTemplate: { + navigator: NAVIGATOR_THEME + } +}; + +// packages/ag-charts-enterprise/src/features/ranges/ranges.ts +import { _ModuleSupport as _ModuleSupport157 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/ranges/rangesButtonProperties.ts +import { _ModuleSupport as _ModuleSupport156 } from "ag-charts-community"; +var { ToolbarButtonProperties: ToolbarButtonProperties3, Property: Property56 } = _ModuleSupport156; +var RangesButtonProperties = class extends ToolbarButtonProperties3 { +}; +__decorateClass([ + Property56 +], RangesButtonProperties.prototype, "value", 2); + +// packages/ag-charts-enterprise/src/features/ranges/ranges.ts +var { ChartAxisDirection: ChartAxisDirection19, LayoutElement: LayoutElement3, PropertiesArray: PropertiesArray5, Toolbar, Property: Property57 } = _ModuleSupport157; +var Ranges = class extends _ModuleSupport157.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.buttons = new PropertiesArray5(RangesButtonProperties); + this.verticalSpacing = 10; + this.container = ctx.domManager.addChild("canvas-overlay", "range-buttons"); + this.container.role = "presentation"; + this.toolbar = new Toolbar(this.ctx, "ariaLabelRangesToolbar", "horizontal"); + this.toolbar.addClass("ag-charts-range-buttons"); + this.container.append(this.toolbar.getElement()); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPress.bind(this)), + ctx.layoutManager.registerElement(LayoutElement3.ToolbarBottom, this.onLayoutStart.bind(this)), + ctx.eventsHub.on("zoom:change", this.onZoomChanged.bind(this)), + this.teardown.bind(this) + ); + } + teardown() { + this.toolbar.getElement().remove(); + this.toolbar.destroy(); + } + onLayoutStart(event) { + const { buttons: buttons2, ctx, enabled, toolbar: toolbar2, verticalSpacing } = this; + const { layoutBox } = event; + if (!enabled || !ctx.zoomManager.isZoomEnabled()) { + toolbar2.setHidden(true); + return; + } + toolbar2.setHidden(false); + toolbar2.updateButtons(buttons2); + const height = toolbar2.getBounds().height; + toolbar2.setBounds({ + x: layoutBox.x, + y: layoutBox.y + layoutBox.height - height, + width: layoutBox.width, + height + }); + layoutBox.shrink({ bottom: height + verticalSpacing }); + } + onZoomChanged() { + this.toolbar.clearActiveButton(); + } + onButtonPress({ button: { index } }) { + const { zoomManager } = this.ctx; + const button = this.buttons.at(index); + if (!button) + return; + const { value } = button; + if (value == null) { + zoomManager.resetZoom("zoom-buttons"); + } else if (typeof value === "number") { + zoomManager.extendToEnd("zoom-buttons", ChartAxisDirection19.X, value); + } else if (Array.isArray(value)) { + zoomManager.updateWith("zoom-buttons", ChartAxisDirection19.X, () => value); + } else if (typeof value === "function") { + zoomManager.updateWith("zoom-buttons", ChartAxisDirection19.X, value); + } + this.toolbar.toggleActiveButtonByIndex(index); + } +}; +__decorateClass([ + Property57 +], Ranges.prototype, "enabled", 2); +__decorateClass([ + Property57 +], Ranges.prototype, "buttons", 2); + +// packages/ag-charts-enterprise/src/features/ranges/rangesModule.ts +var DAY = 1e3 * 60 * 60 * 24; +var MONTH = DAY * 30; +var YEAR = DAY * 365; +var RangesModule = { + type: "root", + optionsKey: "ranges", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new Ranges(ctx), + themeTemplate: { + ranges: { + enabled: false, + buttons: { + $shallowSimple: [ + { + label: "toolbarRange1Month", + ariaLabel: "toolbarRange1MonthAria", + value: MONTH + }, + { + label: "toolbarRange3Months", + ariaLabel: "toolbarRange3MonthsAria", + value: 3 * MONTH + }, + { + label: "toolbarRange6Months", + ariaLabel: "toolbarRange6MonthsAria", + value: 6 * MONTH + }, + { + label: "toolbarRangeYearToDate", + ariaLabel: "toolbarRangeYearToDateAria", + value: (_start, end) => [ + (/* @__PURE__ */ new Date(`${new Date(end).getFullYear()}-01-01`)).getTime(), + void 0 + ] + }, + { + label: "toolbarRange1Year", + ariaLabel: "toolbarRange1YearAria", + value: YEAR + }, + { + label: "toolbarRangeAll", + ariaLabel: "toolbarRangeAllAria", + value: void 0 + // Reset zoom + } + ] + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/shared-toolbar/sharedToolbar.ts +import { _ModuleSupport as _ModuleSupport158 } from "ag-charts-community"; +var _SharedToolbar = class _SharedToolbar extends _ModuleSupport158.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.activeSections = /* @__PURE__ */ new Set(); + this.sectionButtons = { + annotations: [], + chartToolbar: [] + }; + this.container = this.ctx.domManager.addChild("canvas-overlay", "shared-toolbar"); + this.container.role = "presentation"; + } + getSharedToolbar(section) { + if (!this.sharedToolbar) { + this.createSharedToolbar(); + } + if (section === "chartToolbar" && this.sharedToolbar) { + this.sharedToolbar.setAriaLabelId("ariaLabelFinancialCharts"); + } + return this.toolbarWithSection(section); + } + createSharedToolbar() { + this.sharedToolbar = new _ModuleSupport158.Toolbar(this.ctx, "ariaLabelAnnotationsToolbar", "vertical"); + this.sharedToolbar.addClass("ag-charts-shared-toolbar"); + this.container.append(this.sharedToolbar.getElement()); + this.cleanup.register(() => { + if (!this.sharedToolbar) + return; + this.sharedToolbar.getElement().remove(); + this.sharedToolbar.destroy(); + this.sharedToolbar = void 0; + }); + } + toolbarWithSection(section) { + const sharedToolbar = this.sharedToolbar; + const withSection = { + layout: (layoutBox, padding) => { + if (this.firstLayoutSection != null && this.firstLayoutSection !== section && this.activeSections.has(this.firstLayoutSection)) { + return; + } + this.firstLayoutSection = section; + const width = sharedToolbar.getBounds().width; + sharedToolbar.setBounds({ + x: layoutBox.x, + y: layoutBox.y, + width + }); + layoutBox.shrink({ left: width + sharedToolbar.horizontalSpacing + (padding ?? 0) }); + }, + addToolbarListener: (eventType, handler) => { + return sharedToolbar.addToolbarListener(eventType, (sharedEvent) => { + const sectionIndex = this.getSectionIndex(section, sharedEvent.button.index); + if (sectionIndex < 0) + return; + const event = { + ...sharedEvent, + button: this.sectionButtons[section][sectionIndex] + }; + handler(event); + }); + }, + updateButtons: (buttons2) => { + this.sectionButtons[section] = buttons2; + const sharedButtons = _SharedToolbar.SECTION_ORDER.flatMap((order) => this.sectionButtons[order]); + sharedToolbar.updateButtons(sharedButtons); + }, + updateButtonByIndex: (index, button) => { + sharedToolbar.updateButtonByIndex(this.getIndex(section, index), button); + }, + toggleActiveButtonByIndex: (index) => { + sharedToolbar.toggleActiveButtonByIndex(this.getIndex(section, index)); + }, + toggleButtonEnabledByIndex: (index, enabled) => { + sharedToolbar.toggleButtonEnabledByIndex(this.getIndex(section, index), enabled); + }, + setHidden: (hidden) => { + if (hidden) { + this.activeSections.delete(section); + } else { + this.activeSections.add(section); + } + let sum = 0; + for (const order of _SharedToolbar.SECTION_ORDER) { + if (order !== section) { + sum += this.sectionButtons[order].length; + continue; + } + for (const index of this.sectionButtons[section].keys()) { + sharedToolbar.setButtonHiddenByIndex(sum + index, hidden); + } + } + }, + destroy: () => { + withSection.setHidden(true); + if (this.activeSections.size === 0) { + this.destroy(); + } + }, + clearActiveButton: sharedToolbar.clearActiveButton.bind(sharedToolbar), + addListener: sharedToolbar.addListener.bind(sharedToolbar), + removeListener: sharedToolbar.removeListener.bind(sharedToolbar) + }; + withSection.setHidden(false); + return withSection; + } + getIndex(section, index) { + let sum = 0; + for (const order of _SharedToolbar.SECTION_ORDER) { + if (order === section) + return sum + index; + sum += this.sectionButtons[order].length; + } + return -1; + } + getSectionIndex(section, index) { + let sum = 0; + for (const order of _SharedToolbar.SECTION_ORDER) { + if (order === section) { + if (index >= sum + this.sectionButtons[section].length) + return -1; + return index - sum; + } + sum += this.sectionButtons[order].length; + } + return -1; + } +}; +_SharedToolbar.SECTION_ORDER = ["chartToolbar", "annotations"]; +var SharedToolbar = _SharedToolbar; + +// packages/ag-charts-enterprise/src/features/shared-toolbar/sharedToolbarModule.ts +var SharedToolbarModule = { + type: "context", + contextKey: "sharedToolbar", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new SharedToolbar(ctx) +}; + +// packages/ag-charts-enterprise/src/features/status-bar/statusBarModule.ts +import { _ModuleSupport as _ModuleSupport160 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/status-bar/statusBar.ts +import { _ModuleSupport as _ModuleSupport159 } from "ag-charts-community"; +import { cachedTextMeasurer as cachedTextMeasurer3, calcLineHeight as calcLineHeight5 } from "ag-charts-core"; +var { ZIndexMap: ZIndexMap8, LayoutElement: LayoutElement4, Property: Property58, BaseProperties: BaseProperties20, valueProperty: valueProperty9, Group: Group7, Label: Label5, Rect: Rect4, Text } = _ModuleSupport159; +var chartConfigurations = { + ohlc: 2 /* Open */ | 4 /* Close */ | 8 /* Low */ | 16 /* High */ | 32 /* Volume */, + candlestick: 2 /* Open */ | 4 /* Close */ | 8 /* Low */ | 16 /* High */ | 32 /* Volume */, + "hollow-candlestick": 2 /* Open */ | 4 /* Close */ | 8 /* Low */ | 16 /* High */ | 32 /* Volume */, + line: 64 /* UnlabelledClose */ | 32 /* Volume */, + "step-line": 64 /* UnlabelledClose */ | 32 /* Volume */, + hlc: 128 /* NeutralClose */ | 8 /* Low */ | 16 /* High */ | 32 /* Volume */, + "high-low": 512 /* NeutralLow */ | 256 /* NeutralHigh */ | 32 /* Volume */ +}; +var itemIdMap = { + up: "positive", + down: "negative" +}; +var neutralColorMap = { + hlc: "altNeutral" +}; +var StatusBarBackground = class extends BaseProperties20 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + } +}; +__decorateClass([ + Property58 +], StatusBarBackground.prototype, "fill", 2); +__decorateClass([ + Property58 +], StatusBarBackground.prototype, "fillOpacity", 2); +var StatusBar = class extends _ModuleSupport159.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.openKey = void 0; + this.highKey = void 0; + this.lowKey = void 0; + this.closeKey = void 0; + this.volumeKey = void 0; + this.title = new Label5(); + this.positive = new Label5(); + this.negative = new Label5(); + this.neutral = new Label5(); + this.altNeutral = new Label5(); + this.background = new StatusBarBackground(); + this.layoutStyle = "block"; + this.id = "status-bar"; + this.data = void 0; + this.layer = new Group7({ + name: "StatusBar", + zIndex: ZIndexMap8.STATUS_BAR + }); + this.labelGroup = this.layer.appendChild(new _ModuleSupport159.TranslatableGroup()); + this.backgroundNode = this.labelGroup.appendChild(new Rect4()); + this.labels = [ + { + label: "O", + configuration: 2 /* Open */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "openValue", + key: "openKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "H", + configuration: 16 /* High */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "highValue", + key: "highKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "H", + configuration: 256 /* NeutralHigh */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + style: "neutral", + id: "highValue", + key: "highKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "L", + configuration: 8 /* Low */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "lowValue", + key: "lowKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "L", + configuration: 512 /* NeutralLow */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + style: "neutral", + id: "lowValue", + key: "lowKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "C", + configuration: 4 /* Close */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "closeValue", + key: "closeKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "C", + configuration: 128 /* NeutralClose */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "closeValue", + key: "closeKey", + style: "neutral", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "", + configuration: 64 /* UnlabelledClose */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + style: "neutral", + id: "closeValue", + key: "closeKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + notation: "compact", + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "Vol", + configuration: 32 /* Volume */, + title: this.labelGroup.appendChild(new Text()), + value: this.labelGroup.appendChild(new Text()), + id: "volumeValue", + key: "volumeKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + notation: "compact", + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + } + ]; + this.highlightManager = ctx.highlightManager; + this.labelGroup.visible = false; + this.cleanup.register( + ctx.scene.attachNode(this.layer), + ctx.layoutManager.registerElement(LayoutElement4.Overlay, (e) => this.startPerformLayout(e)), + ctx.eventsHub.on("layout:complete", (e) => this.onLayoutComplete(e)), + ctx.eventsHub.on("highlight:change", () => this.updateHighlight()) + ); + } + async processData(dataController) { + if (!this.enabled || this.data == null) + return; + const props = []; + for (const label of this.labels) { + const { id, key } = label; + const datumKey = this[key]; + if (datumKey == null) { + label.domain = void 0; + } else { + props.push(valueProperty9(datumKey, "number", { id })); + } + } + if (props.length === 0) + return; + const dataSet = _ModuleSupport159.DataSet.wrap(this.data) ?? _ModuleSupport159.DataSet.empty(); + const { processedData, dataModel } = await dataController.request(this.id, dataSet, { + props + }); + for (const label of this.labels) { + const { id, key } = label; + const datumKey = this[key]; + if (datumKey != null) { + label.domain = dataModel.getDomain(this, id, "value", processedData); + } + } + } + startPerformLayout(opts) { + this.labelGroup.translationX = 0; + this.labelGroup.translationY = 0; + if (!this.enabled) + return; + const { layoutBox } = opts; + const innerSpacing = 4; + const outerSpacing = 12; + const spacingAbove = 0; + const spacingBelow = 8; + this.labelGroup.translationY = layoutBox.y + spacingAbove; + const maxFontSize = Math.max(this.title.fontSize, this.positive.fontSize, this.negative.fontSize); + const lineHeight = calcLineHeight5(maxFontSize); + const labelConfigurations = chartConfigurations[this.getChartType()] ?? 0; + let left = 0; + let offsetTop; + let textVAlign = "alphabetic"; + if (this.layoutStyle === "block") { + layoutBox.shrink(spacingAbove + lineHeight + spacingBelow, "top"); + offsetTop = maxFontSize + (lineHeight - maxFontSize) / 2; + } else { + const { title } = this.ctx.chartService; + textVAlign = "top"; + offsetTop = spacingAbove + title.padding; + if (title.enabled) { + const titleBox = title.node.getBBox(); + left = titleBox.x + titleBox.width + outerSpacing; + } else { + left = title.padding; + } + } + for (const { label, configuration, title, value, domain, formatter } of this.labels) { + if (domain == null || (labelConfigurations & configuration) === 0) { + title.visible = false; + value.visible = false; + continue; + } + const positiveTextMeasurer = cachedTextMeasurer3(this.positive); + const negativeTextMeasurer = cachedTextMeasurer3(this.negative); + const maxValueWidth = Math.max( + positiveTextMeasurer.textWidth(formatter.format(domain[0])), + positiveTextMeasurer.textWidth(formatter.format(domain[1])), + negativeTextMeasurer.textWidth(formatter.format(domain[0])), + negativeTextMeasurer.textWidth(formatter.format(domain[1])) + ); + title.visible = true; + value.visible = true; + const titleMetrics = cachedTextMeasurer3(this.title).measureLines(label); + title.setFont(this.title); + title.fill = this.title.color; + title.text = label; + title.textBaseline = textVAlign; + title.y = offsetTop; + title.x = left; + left += titleMetrics.width + innerSpacing; + value.textBaseline = textVAlign; + value.y = offsetTop; + value.x = left; + left += maxValueWidth + outerSpacing; + } + this.backgroundNode.x = 0; + this.backgroundNode.y = 0; + this.backgroundNode.width = left - outerSpacing; + this.backgroundNode.height = lineHeight + spacingAbove + spacingBelow; + this.backgroundNode.fill = this.background.fill; + this.backgroundNode.fillOpacity = this.background.fillOpacity; + } + onLayoutComplete(opts) { + this.labelGroup.translationX = opts.series.rect.x; + this.updateHighlight(); + } + updateHighlight() { + if (!this.enabled) + return; + const activeHighlight = this.highlightManager.getActiveHighlight(); + const datum = activeHighlight?.datum ?? this.data?.at(-1); + if (datum == null) { + this.labelGroup.visible = false; + return; + } + this.labelGroup.visible = true; + const itemId = activeHighlight?.itemId; + let baseStyle = itemId == null ? void 0 : itemIdMap[itemId]; + if (baseStyle == null && this.openKey != null && this.closeKey != null) { + if (datum[this.openKey] < datum[this.closeKey]) { + baseStyle = "positive"; + } else { + baseStyle = "negative"; + } + } + for (const { domain, value, key, formatter, style } of this.labels) { + if (domain == null) + continue; + let labelStyle = style ?? baseStyle ?? "neutral"; + if (labelStyle === "neutral") { + labelStyle = neutralColorMap[this.getChartType()] ?? labelStyle; + } + const datumKey = this[key]; + const datumValue = datumKey == null ? void 0 : datum?.[datumKey]; + value.setFont(this[labelStyle]); + value.fill = this[labelStyle].color; + value.text = typeof datumValue === "number" ? formatter.format(datumValue) : ""; + } + } + getChartType() { + let chartType = this.ctx.chartService.publicApi?.getOptions()?.chartType; + if (chartType == null || chartConfigurations[chartType] == null) { + chartType = "candlestick"; + } + return chartType; + } +}; +__decorateClass([ + Property58 +], StatusBar.prototype, "enabled", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "openKey", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "highKey", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "lowKey", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "closeKey", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "volumeKey", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "title", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "positive", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "negative", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "neutral", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "altNeutral", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "background", 2); +__decorateClass([ + Property58 +], StatusBar.prototype, "layoutStyle", 2); + +// packages/ag-charts-enterprise/src/features/status-bar/statusBarModule.ts +var StatusBarModule = { + type: "root", + identifier: "status-bar", + optionsKey: "statusBar", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new StatusBar(ctx), + themeTemplate: { + statusBar: { + enabled: false, + layoutStyle: _ModuleSupport160.ThemeSymbols.DEFAULT_CAPTION_LAYOUT_STYLE, + title: { + color: { $ref: "textColor" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + positive: { + color: { $palette: "up.stroke" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + negative: { + color: { $palette: "down.stroke" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + neutral: { + color: { $palette: "neutral.stroke" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + background: { + fill: { $ref: "chartBackgroundColor" }, + fillOpacity: 0.5 + }, + altNeutral: { + color: "gray", + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + } + } + } +}; + +// packages/ag-charts-enterprise/src/features/sync/chartSync.ts +import { _ModuleSupport as _ModuleSupport161 } from "ag-charts-community"; +import { AsyncAwaitQueue, Logger as Logger12, arraysEqual, isDate as isDate3, isDefined as isDefined2, isFiniteNumber, unique } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/zoom/zoomUtils.ts +import { clamp as clamp8, isNumberEqual as isNumberEqual8 } from "ag-charts-core"; +var UNIT_MIN = 0; +var UNIT_MAX = 1; +var UNIT_SIZE = UNIT_MAX - UNIT_MIN; +var DEFAULT_ANCHOR_POINT_X = "end"; +var DEFAULT_ANCHOR_POINT_Y = "middle"; +var ZOOM_VALID_CHECK_DEBOUNCE = 300; +var constrain = (value, min = UNIT_MIN, max = UNIT_MAX) => clamp8(min, value, max); +function unitZoomState() { + return { x: { min: UNIT_MIN, max: UNIT_MAX }, y: { min: UNIT_MIN, max: UNIT_MAX } }; +} +function dx(zoom) { + return zoom.x.max - zoom.x.min; +} +function dy(zoom) { + return zoom.y.max - zoom.y.min; +} +function isZoomRangeEqual(left, right) { + return isNumberEqual8(left.min, right.min) && isNumberEqual8(left.max, right.max); +} +function isZoomEqual(left, right) { + return isZoomRangeEqual(left.x, right.x) && isZoomRangeEqual(left.y, right.y); +} +function isMaxZoom(zoom) { + return isZoomEqual(zoom, unitZoomState()); +} +function definedZoomState(zoom) { + return { + x: { min: zoom?.x?.min ?? UNIT_MIN, max: zoom?.x?.max ?? UNIT_MAX }, + y: { min: zoom?.y?.min ?? UNIT_MIN, max: zoom?.y?.max ?? UNIT_MAX } + }; +} +function pointToRatio(bbox, x, y) { + if (!bbox) + return { x: 0, y: 0 }; + const constrainedX = constrain(x - bbox.x, 0, bbox.x + bbox.width); + const constrainedY = constrain(y - bbox.y, 0, bbox.y + bbox.height); + const rx = 1 / bbox.width * constrainedX; + const ry = 1 - 1 / bbox.height * constrainedY; + return { x: constrain(rx), y: constrain(ry) }; +} +function translateZoom(zoom, x, y) { + return { + x: { min: zoom.x.min + x, max: zoom.x.max + x }, + y: { min: zoom.y.min + y, max: zoom.y.max + y } + }; +} +function scaleZoom(zoom, sx, sy) { + return { + x: { min: zoom.x.min, max: zoom.x.min + dx(zoom) * sx }, + y: { min: zoom.y.min, max: zoom.y.min + dy(zoom) * sy } + }; +} +function scaleZoomCenter(zoom, sx, sy) { + const dx_ = dx(zoom); + const dy_ = dy(zoom); + const cx = zoom.x.min + dx_ / 2; + const cy = zoom.y.min + dy_ / 2; + return { + x: { min: cx - dx_ * sx / 2, max: cx + dx_ * sx / 2 }, + y: { min: cy - dy_ * sy / 2, max: cy + dy_ * sy / 2 } + }; +} +function scaleZoomAxisWithAnchor(newState, oldState, anchor, origin) { + const { min, max } = oldState; + const center = min + (max - min) / 2; + const diff8 = newState.max - newState.min; + switch (anchor) { + case "start": + return { min, max: oldState.min + diff8 }; + case "end": + return { min: oldState.max - diff8, max }; + case "middle": + return { min: center - diff8 / 2, max: center + diff8 / 2 }; + case "pointer": + return scaleZoomAxisWithPoint(newState, oldState, origin ?? center); + default: + return { min, max }; + } +} +function scaleZoomAxisWithPoint(newState, oldState, origin) { + const newDelta = newState.max - newState.min; + const oldDelta = oldState.max - oldState.min; + const scaledOrigin = origin * (1 - (oldDelta - newDelta)); + const translation = origin - scaledOrigin; + const min = newState.min + translation; + const max = newState.max + translation; + return { min, max }; +} +function multiplyZoom(zoom, nx, ny) { + return { + x: { min: zoom.x.min * nx, max: zoom.x.max * nx }, + y: { min: zoom.y.min * ny, max: zoom.y.max * ny } + }; +} +function constrainZoom(zoom) { + return { + x: constrainAxis(zoom.x), + y: constrainAxis(zoom.y) + }; +} +function constrainAxis(axis) { + const size = axis.max - axis.min; + let min = axis.max > UNIT_MAX ? UNIT_MAX - size : axis.min; + let max = axis.min < UNIT_MIN ? size : axis.max; + min = Math.max(UNIT_MIN, min); + max = Math.min(UNIT_MAX, max); + return { min, max }; +} + +// packages/ag-charts-enterprise/src/features/sync/chartSync.ts +var { + BaseProperties: BaseProperties21, + CartesianAxis, + ChartAxisDirection: ChartAxisDirection20, + ContinuousScale: ContinuousScale6, + TimeScale, + UnitTimeScale, + ChartUpdateType: ChartUpdateType2, + ObserveChanges: ObserveChanges4, + TooltipManager, + Property: Property59, + findMinMax: findMinMax4, + isObjectWithStringProperty +} = _ModuleSupport161; +var debug = _ModuleSupport161.Debug.create("sync"); +function getDirectionKeys(series, primary, secondary) { + const primaryKeys = series.getKeys(primary); + const secondaryKeys = series.getKeys(secondary); + if (series.shouldFlipXY?.()) { + return [secondaryKeys, primaryKeys]; + } + return [primaryKeys, secondaryKeys]; +} +function syncedDirections(axes = "x") { + switch (axes) { + case "x": + return [ChartAxisDirection20.X]; + case "y": + return [ChartAxisDirection20.Y]; + case "xy": + return [ChartAxisDirection20.X, ChartAxisDirection20.Y]; + } +} +function domainChanged(scale, a, b) { + if (TimeScale.is(scale) || UnitTimeScale.is(scale)) { + return !arraysEqual( + a.map((x) => x?.valueOf()), + b.map((x) => x?.valueOf()) + ); + } else { + return !arraysEqual(a, b); + } +} +var ChartSync = class extends BaseProperties21 { + constructor(moduleContext) { + super(); + this.moduleContext = moduleContext; + this.enabled = false; + this.axes = "x"; + this.nodeInteraction = true; + this.zoom = true; + this.domainMode = "key"; + this.domainSync = new AsyncAwaitQueue(); + } + updateSiblings(groupId) { + const { syncManager } = this.moduleContext; + for (const chart of syncManager.getGroupSiblings(groupId ?? this.groupId)) { + debug("ChartSync.updateSiblings()", chart.id, chart); + this.updateChart(chart); + } + } + updateChart(chart, updateType = ChartUpdateType2.PROCESS_DOMAIN) { + debug("ChartSync.updateChart()", chart.id, ChartUpdateType2[updateType], chart); + if (updateType === ChartUpdateType2.PROCESS_DOMAIN) { + chart.ctx.updateService.update(updateType, { forceNodeDataRefresh: true }); + } else { + chart.ctx.updateService.update(updateType); + } + } + enabledZoomSync() { + const { eventsHub } = this.moduleContext; + this.disableZoomSync?.(); + this.disableZoomSync = eventsHub.on("zoom:change", this.onZoom.bind(this)); + } + onZoom() { + const { syncManager } = this.moduleContext; + for (const chart of syncManager.getGroupSiblings(this.groupId)) { + if (!chart.modulesManager.getModule("sync")?.zoom) + continue; + const zoomModule = chart.modulesManager.getModule("zoom"); + if (!zoomModule) + continue; + const zoom = this.prepareZoomUpdate(); + debug("ChartsSyncManager.enabledZoomSync()", chart.id, zoom); + zoomModule.updateSyncZoom(zoom); + } + } + enabledNodeInteractionSync() { + this.disableNodeInteractionSync?.(); + this.disableNodeInteractionSync = this.moduleContext.eventsHub.on( + "highlight:change", + this.onHighlightChange.bind(this) + ); + } + onHighlightChange(event) { + const { syncManager } = this.moduleContext; + if (event.callerId.endsWith("-sync")) + return; + debug("ChartSync.onHighlightChange()", event); + const series = event.currentHighlight?.series; + const [mainDirection] = syncedDirections(this.axes); + const secondaryDirection = mainDirection === ChartAxisDirection20.X ? ChartAxisDirection20.Y : ChartAxisDirection20.X; + const [primaryKeys, secondaryKeys] = series ? getDirectionKeys(series, mainDirection, secondaryDirection) : []; + const datum = readDatum(event.currentHighlight); + let eventValue = primaryKeys?.[0] ? datum?.[primaryKeys[0]] : void 0; + let valueIsDate = false; + if (isDate3(eventValue)) { + valueIsDate = true; + eventValue = eventValue.getTime(); + } + if (!event.currentHighlight?.datum) { + for (const chart of syncManager.getGroupSiblings(this.groupId)) { + if (!chart.modulesManager.getModule("sync")?.nodeInteraction) + continue; + chart.ctx.highlightManager.updateHighlight(`${chart.id}-sync`); + chart.ctx.tooltipManager.removeTooltip(`${chart.id}-sync`); + } + return; + } + const useSecondaryDirectionKey = syncManager.getGroupSyncMode(this.groupId) === "multi-series"; + this.findMatchingHighlightNodes( + mainDirection, + secondaryDirection, + useSecondaryDirectionKey ? secondaryKeys : [], + valueIsDate, + eventValue, + event + ); + } + findMatchingHighlightNodes(primaryDirection, secondaryDirection, secondaryKeys, valueIsDate, eventValue, event) { + const { syncManager } = this.moduleContext; + debug("ChartSync.findMatchingHighlightNodes()", { + mainDirection: primaryDirection, + secondaryKeys + }); + for (const chart of syncManager.getGroupSiblings(this.groupId)) { + if (!chart.modulesManager.getModule("sync")?.nodeInteraction) + continue; + let dispatched = false; + for (const axis of chart.axes) { + if (!CartesianAxis.is(axis) || axis.direction !== primaryDirection) + continue; + const matchingNodes = chart.series.filter((s) => { + if (!s.visible) + return false; + if (secondaryKeys.length > 0) { + const [, seriesKeys] = getDirectionKeys(s, primaryDirection, secondaryDirection); + return secondaryKeys.every((key) => seriesKeys.includes(key)); + } + return true; + }).map(this.findMatchingNodes(axis, primaryDirection, valueIsDate, eventValue)).filter(isDefined2); + if (matchingNodes.length === 1 && matchingNodes[0]?.nodeDatum !== chart.ctx.highlightManager.getActiveHighlight()) { + this.dispatchHighlightUpdate(chart, matchingNodes[0].nodeDatum); + dispatched = true; + break; + } + } + if (!dispatched) { + debug("ChartSync.findMatchingHighlightNodes() - no matching nodes", chart.id, event); + this.dispatchHighlightUpdate(chart); + } + } + } + findMatchingNodes(axis, mainDirection, valueIsDate, eventValue) { + return (series) => { + const seriesKeys = series.getKeys(axis.direction); + if (axis.keys.length && !axis.keys.some((key) => seriesKeys.includes(key))) + return; + const nodeData = series.contextNodeData?.nodeData ?? []; + if (!nodeData?.length) + return; + const firstNode = nodeData[0]; + const mainDirectionKey = `${mainDirection}Key`; + if (!isObjectWithStringProperty(firstNode, mainDirectionKey)) + return; + const valueKey = firstNode[mainDirectionKey]; + const nodeDatum = nodeData.find((datum) => { + const nodeValue = datum.datum[valueKey]; + return valueIsDate ? nodeValue.getTime() === eventValue : nodeValue === eventValue; + }); + return nodeDatum ? { series, nodeDatum } : null; + }; + } + dispatchHighlightUpdate(chart, nodeDatum) { + debug("ChartSync.dispatchHighlightUpdate()", chart.id, nodeDatum); + chart.ctx.highlightManager.updateHighlight(`${chart.id}-sync`, nodeDatum); + const tooltipEnabled = nodeDatum?.series.tooltipEnabled ?? chart.tooltip.enabled; + if (nodeDatum && tooltipEnabled) { + const bbox = chart.seriesAreaBoundingBox; + const canvasX = bbox.x + (nodeDatum.midPoint?.x ?? nodeDatum.point?.x ?? 0); + const canvasY = bbox.y + (nodeDatum.midPoint?.y ?? nodeDatum.point?.y ?? 0); + const tooltipMeta = TooltipManager.makeTooltipMeta( + { type: "pointermove", canvasX, canvasY }, + nodeDatum.series, + nodeDatum, + void 0 + ); + chart.ctx.tooltipManager.updateTooltip( + `${chart.id}-sync`, + tooltipMeta, + chart.getTooltipContent(nodeDatum.series, nodeDatum.datumIndex, nodeDatum, "tooltip") + ); + } else { + chart.ctx.tooltipManager.removeTooltip(`${chart.id}-sync`); + } + this.updateChart(chart, ChartUpdateType2.SERIES_UPDATE); + } + async getSyncedDomain(axis) { + if (!CartesianAxis.is(axis) || this.axes !== "xy" && this.axes !== axis.direction) { + return; + } + const { groupState, directionDomains, domainsByKey, positionDomains } = this.updateDomainState(axis); + this.validateAxis(axis, groupState); + await this.waitForDomainsToBeReady(); + if (this.domainMode === "position") { + return this.calculateDerivedDomain(axis, positionDomains); + } + if (this.domainMode === "direction" || axis.keys.length === 0) { + return this.calculateDerivedDomain(axis, directionDomains); + } + return this.calculateKeyDerivedDomain(axis, domainsByKey); + } + updateDomainState(axis) { + var _a, _b, _c, _d, _e; + const { syncManager } = this.moduleContext; + const chartId = syncManager.getChart().id; + const axisId = axis.id; + const groupState = syncManager.getGroupState(this.groupId); + if (!groupState) + throw new Error("AG Charts - no GroupState for groupId: " + this.groupId); + const domainsByDirection = groupState.domains ?? (groupState.domains = {}); + const directionDomains = domainsByDirection[_a = axis.direction] ?? (domainsByDirection[_a] = { derived: [], sources: {}, dirty: true }); + const chartDirectionDomains = (_b = directionDomains.sources)[chartId] ?? (_b[chartId] = {}); + chartDirectionDomains[axisId] = axis.dataDomain.domain; + directionDomains.dirty = true; + const domainsByKey = groupState.domainsByKey ?? (groupState.domainsByKey = {}); + for (const key of axis.keys ?? []) { + const keyDomains = domainsByKey[key] ?? (domainsByKey[key] = { derived: [], sources: {}, dirty: true }); + const chartKeyDomains = (_c = keyDomains.sources)[chartId] ?? (_c[chartId] = {}); + chartKeyDomains[axisId] = axis.dataDomain.domain; + keyDomains.dirty = true; + } + const domainsByPosition = groupState.domainsByPosition ?? (groupState.domainsByPosition = {}); + const positionDomains = domainsByPosition[_d = axis.position] ?? (domainsByPosition[_d] = { derived: [], sources: {}, dirty: true }); + const chartPositionDomains = (_e = positionDomains.sources)[chartId] ?? (_e[chartId] = {}); + chartPositionDomains[axisId] = axis.dataDomain.domain; + positionDomains.dirty = true; + return { groupState, directionDomains, domainsByKey, positionDomains }; + } + validateAxis(axis, groupState) { + const multiSeries = this.moduleContext.syncManager.getGroupSyncMode(this.groupId) === "multi-series"; + if (!syncedDirections(this.axes).includes(axis.direction)) + return; + if (multiSeries) { + this.validateMultiSeries(axis, groupState); + } else { + this.validateSingleSeries(axis, groupState); + } + } + validateMultiSeries(axis, groupState) { + const { min, max, nice, reverse } = axis; + const matchingKeys = new Set(axis.boundSeries.flatMap((s) => s.getKeys(axis.direction))); + for (const member of groupState.members) { + const { axes, modulesManager } = member; + const memberSyncDirections = syncedDirections(modulesManager.getModule("sync")?.axes); + const keyMatchedAxes = axes.filter((a) => memberSyncDirections.includes(a.direction)).filter((a) => a.boundSeries.some((s) => s.getKeys(a.direction).some((k) => matchingKeys.has(k)))); + if (keyMatchedAxes.length === 0) + continue; + const [firstAxis] = keyMatchedAxes; + if (firstAxis.min !== min || firstAxis.max !== max || firstAxis.nice !== nice || firstAxis.reverse !== reverse) { + Logger12.warnOnce( + "To allow synchronization, ensure that all synchronized axes with matching keys have matching min, max, nice, and reverse properties." + ); + this.enabled = false; + return; + } + } + } + validateSingleSeries(axis, groupState) { + const members = groupState.members; + const [{ axes: syncAxes }] = members; + const { direction, min, max, nice, reverse } = axis; + for (const nextAxis of syncAxes) { + if (direction !== nextAxis.direction) + continue; + if (nice !== nextAxis.nice || reverse !== nextAxis.reverse || min !== nextAxis.min && (isFiniteNumber(min) || isFiniteNumber(nextAxis.min)) || max !== nextAxis.max && (isFiniteNumber(max) || isFiniteNumber(nextAxis.max))) { + Logger12.warnOnce( + "To allow synchronization, ensure that all charts have matching min, max, nice, and reverse properties on the synchronized axes." + ); + this.enabled = false; + return; + } + } + } + calculateDerivedDomain(axis, directionDomains) { + if (!directionDomains.dirty) + return directionDomains.derived; + const previousDerived = directionDomains.derived; + directionDomains.derived = unique( + Object.values(directionDomains.sources).map((d) => Object.values(d)).flat(2) + ); + if (ContinuousScale6.is(axis.scale)) { + directionDomains.derived = findMinMax4(directionDomains.derived); + } + directionDomains.dirty = false; + if (domainChanged(axis.scale, previousDerived, directionDomains.derived)) { + debug(axis.id, "updated", axis.keys, { before: previousDerived, after: directionDomains.derived }); + this.updateSiblings(); + } + return directionDomains.derived; + } + calculateKeyDerivedDomain(axis, domainsByKey) { + let previousDerived = []; + let newDerived = []; + let updated = false; + for (const key of axis.keys ?? []) { + const keyDomains = domainsByKey[key]; + const previousDerivedForKey = keyDomains.derived; + previousDerived.push(...previousDerivedForKey); + if (!keyDomains.dirty) { + newDerived.push(...keyDomains.derived); + continue; + } + keyDomains.derived = unique( + Object.values(keyDomains.sources).map((d) => Object.values(d)).flat(2) + ); + if (ContinuousScale6.is(axis.scale)) { + keyDomains.derived = findMinMax4(keyDomains.derived); + } + newDerived.push(...keyDomains.derived); + keyDomains.dirty = false; + updated || (updated = !arraysEqual(previousDerivedForKey, keyDomains.derived)); + } + if (ContinuousScale6.is(axis.scale)) { + previousDerived = findMinMax4(previousDerived); + newDerived = findMinMax4(newDerived); + } + if (updated && domainChanged(axis.scale, previousDerived, newDerived)) { + debug(axis.id, "updated", axis.keys, { before: previousDerived, after: newDerived }); + this.updateSiblings(); + } + return newDerived; + } + removeAxis(axis) { + if (!CartesianAxis.is(axis) || this.axes !== "xy" && this.axes !== axis.direction) { + return; + } + const { syncManager } = this.moduleContext; + const syncGroup = syncManager.getGroupState(this.groupId); + const chartId = syncManager.getChart().id; + const axisId = axis.id; + delete syncGroup?.domains?.[axis.direction]?.sources?.[chartId]?.[axisId]; + for (const key of axis.keys ?? []) { + delete syncGroup?.domainsByKey?.[key]?.sources?.[chartId]?.[axisId]; + } + delete syncGroup?.domainsByPosition?.[axis.position]?.sources?.[chartId]?.[axisId]; + } + async waitForDomainsToBeReady() { + const { syncManager } = this.moduleContext; + let count = 0; + while (syncManager.getGroupMembers(this.groupId).some((c) => c.syncStatus === "init")) { + debug("ChartSync.waitForDomainsToBeReady() - waiting for all domains to be calculated", this.groupId); + await this.domainSync.await(); + count++; + } + if (count > 0) { + debug("ChartSync.waitForDomainsToBeReady() - waited for", count, "iterations"); + } + this.domainSync.notify(); + } + prepareZoomUpdate() { + const { zoomManager } = this.moduleContext; + const zoom = zoomManager.getZoom(); + if (this.axes === "x") { + delete zoom?.y; + } else if (this.axes === "y") { + delete zoom?.x; + } + return definedZoomState(zoom); + } + onEnabledChange() { + const { syncManager } = this.moduleContext; + if (this.enabled) { + syncManager.subscribe(this.groupId); + } else { + syncManager.unsubscribe(this.groupId); + } + this.updateSiblings(); + this.onNodeInteractionChange(); + this.onZoomChange(); + } + onGroupIdChange(newValue, oldValue) { + if (!this.enabled || newValue === oldValue) + return; + const { syncManager } = this.moduleContext; + syncManager.unsubscribe(oldValue); + syncManager.subscribe(newValue); + this.updateSiblings(oldValue); + this.updateSiblings(newValue); + } + onAxesChange() { + if (!this.enabled) + return; + const { syncManager } = this.moduleContext; + this.updateChart(syncManager.getChart()); + } + onNodeInteractionChange() { + if (this.enabled && this.nodeInteraction) { + this.enabledNodeInteractionSync(); + } else { + this.disableNodeInteractionSync?.(); + } + } + onZoomChange() { + if (this.enabled && this.zoom) { + this.enabledZoomSync(); + } else { + this.disableZoomSync?.(); + } + } + destroy() { + const { syncManager } = this.moduleContext; + syncManager.unsubscribe(this.groupId); + this.updateSiblings(); + this.disableZoomSync?.(); + } +}; +ChartSync.className = "Sync"; +__decorateClass([ + Property59, + ObserveChanges4((target) => target.onEnabledChange()) +], ChartSync.prototype, "enabled", 2); +__decorateClass([ + Property59, + ObserveChanges4((target, newValue, oldValue) => target.onGroupIdChange(newValue, oldValue)) +], ChartSync.prototype, "groupId", 2); +__decorateClass([ + Property59, + ObserveChanges4((target) => target.onAxesChange()) +], ChartSync.prototype, "axes", 2); +__decorateClass([ + Property59, + ObserveChanges4((target) => target.onNodeInteractionChange()) +], ChartSync.prototype, "nodeInteraction", 2); +__decorateClass([ + Property59, + ObserveChanges4((target) => target.onZoomChange()) +], ChartSync.prototype, "zoom", 2); +__decorateClass([ + Property59, + ObserveChanges4((target) => target.onAxesChange()) +], ChartSync.prototype, "domainMode", 2); + +// packages/ag-charts-enterprise/src/features/sync/syncModule.ts +var SyncModule = { + type: "root", + optionsKey: "sync", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new ChartSync(ctx), + themeTemplate: { + sync: { enabled: false } + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoom.ts +import { _ModuleSupport as _ModuleSupport169 } from "ag-charts-community"; +import { debounce as debounce2, entries as entries10, roundTo } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/features/zoom/scenes/zoomRect.ts +import { _ModuleSupport as _ModuleSupport162 } from "ag-charts-community"; +var { Property: Property60 } = _ModuleSupport162; +var VALID_COLOR = "#2196f3"; +var INVALID_COLOR = "#8a8a8a"; +var ZoomRect = class extends _ModuleSupport162.Rect { + constructor() { + super(...arguments); + this.fill = VALID_COLOR; + this.fillOpacity = 0.2; + this.zIndex = _ModuleSupport162.ZIndexMap.ZOOM_SELECTION; + } + updateValid() { + this.fill = VALID_COLOR; + } + updateInvalid() { + this.fill = INVALID_COLOR; + } +}; +ZoomRect.className = "ZoomRect"; +__decorateClass([ + Property60 +], ZoomRect.prototype, "fill", 2); +__decorateClass([ + Property60 +], ZoomRect.prototype, "fillOpacity", 2); + +// packages/ag-charts-enterprise/src/features/zoom/zoomAxisDragger.ts +import { _ModuleSupport as _ModuleSupport163 } from "ag-charts-community"; +var ZoomAxisDragger = class { + update(event, direction, anchor, bbox, zoom, axisZoom) { + this.oldZoom ?? (this.oldZoom = definedZoomState( + direction === _ModuleSupport163.ChartAxisDirection.X ? { ...zoom, x: axisZoom } : { ...zoom, y: axisZoom } + )); + this.updateCoords(event.offsetX, event.offsetY); + return this.updateZoom(direction, anchor, bbox); + } + stop() { + this.coords = void 0; + this.oldZoom = void 0; + } + updateCoords(x, y) { + if (this.coords) { + this.coords.x2 = x; + this.coords.y2 = y; + } else { + this.coords = { x1: x, y1: y, x2: x, y2: y }; + } + } + updateZoom(direction, anchor, bbox) { + const { coords, oldZoom } = this; + let newZoom = definedZoomState(oldZoom); + if (!coords || !oldZoom) { + if (direction === _ModuleSupport163.ChartAxisDirection.X) + return newZoom.x; + return newZoom.y; + } + const origin = pointToRatio(bbox, coords.x1, coords.y1); + const target = pointToRatio(bbox, coords.x2, coords.y2); + if (direction === _ModuleSupport163.ChartAxisDirection.X) { + const scaleX = (target.x - origin.x) * dx(oldZoom); + newZoom.x.max += scaleX; + newZoom.x = scaleZoomAxisWithAnchor(newZoom.x, oldZoom.x, anchor, origin.x); + newZoom = constrainZoom(newZoom); + return newZoom.x; + } + const scaleY = (target.y - origin.y) * dy(oldZoom); + newZoom.y.max -= scaleY; + newZoom.y = scaleZoomAxisWithAnchor(newZoom.y, oldZoom.y, anchor, origin.y); + newZoom = constrainZoom(newZoom); + return newZoom.y; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomContextMenu.ts +var ZoomContextMenu = class { + constructor(eventsHub, contextMenuRegistry, zoomManager, getModuleProperties, canResetZoom, getRect, updateZoom, isZoomValid) { + this.eventsHub = eventsHub; + this.contextMenuRegistry = contextMenuRegistry; + this.zoomManager = zoomManager; + this.getModuleProperties = getModuleProperties; + this.canResetZoom = canResetZoom; + this.getRect = getRect; + this.updateZoom = updateZoom; + this.isZoomValid = isZoomValid; + } + registerActions(enabled) { + const { contextMenuRegistry } = this; + const action = enabled ? "show" : "hide"; + contextMenuRegistry.toggle("zoom-to-cursor", action); + contextMenuRegistry.toggle("pan-to-cursor", action); + contextMenuRegistry.toggle("reset-zoom", action); + if (!enabled) { + return; + } + contextMenuRegistry.builtins.items["zoom-to-cursor"].action = this.onZoomToHere.bind(this); + contextMenuRegistry.builtins.items["pan-to-cursor"].action = this.onPanToHere.bind(this); + contextMenuRegistry.builtins.items["reset-zoom"].action = this.onResetZoom.bind(this); + const shouldEnableZoomToHere = (event) => { + const rect = this.getRect(); + if (!rect) + return true; + const origin = pointToRatio(rect, event.x, event.y); + return this.iterateFindNextZoomAtPoint(origin) != null; + }; + const shouldEnablePanToHere = () => { + return !isZoomEqual(definedZoomState(this.zoomManager.getZoom()), unitZoomState()); + }; + const removeListener = this.eventsHub.on("context-menu:setup", (event) => { + contextMenuRegistry.builtins.items["zoom-to-cursor"].enabled = shouldEnableZoomToHere(event); + contextMenuRegistry.builtins.items["pan-to-cursor"].enabled = shouldEnablePanToHere(); + contextMenuRegistry.builtins.items["reset-zoom"].enabled = this.canResetZoom(); + }); + return () => { + removeListener(); + contextMenuRegistry.toggle("zoom-to-cursor", "hide"); + contextMenuRegistry.toggle("pan-to-cursor", "hide"); + contextMenuRegistry.toggle("reset-zoom", "hide"); + }; + } + computeOrigin(event) { + const rect = this.getRect(); + const { enabled } = this.getModuleProperties(); + if (!enabled || !rect || !event?.target || !(event instanceof MouseEvent)) + return; + const relativeRect = { x: 0, y: 0, width: rect.width, height: rect.height }; + return pointToRatio(relativeRect, event.offsetX, event.offsetY); + } + onZoomToHere({ event }) { + const origin = this.computeOrigin(event); + if (!origin) + return; + const zoom = this.iterateFindNextZoomAtPoint(origin); + if (zoom == null) + return; + this.updateZoom(zoom); + } + onPanToHere({ event }) { + const origin = this.computeOrigin(event); + if (!origin) + return; + const zoom = definedZoomState(this.zoomManager.getZoom()); + const scaleX = dx(zoom); + const scaleY = dy(zoom); + const scaledOriginX = origin.x * scaleX; + const scaledOriginY = origin.y * scaleY; + const halfSize = UNIT_SIZE / 2; + let newZoom = { + x: { min: origin.x - halfSize, max: origin.x + halfSize }, + y: { min: origin.y - halfSize, max: origin.y + halfSize } + }; + newZoom = scaleZoomCenter(newZoom, scaleX, scaleY); + newZoom = translateZoom(newZoom, zoom.x.min - origin.x + scaledOriginX, zoom.y.min - origin.y + scaledOriginY); + this.updateZoom(constrainZoom(newZoom)); + } + onResetZoom(_actionEvent) { + this.zoomManager.resetZoom("zoom"); + } + iterateFindNextZoomAtPoint(origin) { + const { scrollingStep } = this.getModuleProperties(); + for (let i = scrollingStep; i <= 1 - scrollingStep; i += scrollingStep) { + const zoom = this.getNextZoomAtPoint(origin, i); + if (this.isZoomValid(zoom)) { + return zoom; + } + } + } + getNextZoomAtPoint(origin, step) { + const { isScalingX, isScalingY } = this.getModuleProperties(); + const zoom = definedZoomState(this.zoomManager.getZoom()); + const scaledOriginX = origin.x * dx(zoom); + const scaledOriginY = origin.y * dy(zoom); + const halfSize = UNIT_SIZE / 2; + let newZoom = { + x: { min: origin.x - halfSize, max: origin.x + halfSize }, + y: { min: origin.y - halfSize, max: origin.y + halfSize } + }; + newZoom = scaleZoomCenter( + newZoom, + isScalingX ? dx(zoom) * step : UNIT_SIZE, + isScalingY ? dy(zoom) * step : UNIT_SIZE + ); + newZoom = translateZoom(newZoom, zoom.x.min - origin.x + scaledOriginX, zoom.y.min - origin.y + scaledOriginY); + return constrainZoom(newZoom); + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomDOMProxy.ts +import { _ModuleSupport as _ModuleSupport164 } from "ag-charts-community"; +import { boxEmpty } from "ag-charts-core"; +var { ChartAxisDirection: ChartAxisDirection21 } = _ModuleSupport164; +var ZoomDOMProxy = class { + constructor(axesHandlers) { + this.axesHandlers = axesHandlers; + this.axes = []; + this.overlappingAxisIds = /* @__PURE__ */ new Set(); + } + destroy() { + for (const a of this.axes) { + a.div.destroy(); + } + } + update(enableAxisDragging, enableAxisScrolling, ctx, seriesRect) { + this.seriesRect = seriesRect; + for (const ax of this.axes) { + ax.div.setHidden(!enableAxisDragging && !enableAxisScrolling); + } + if (!enableAxisDragging && !enableAxisScrolling) + return; + const { X, Y } = ChartAxisDirection21; + const axesCtx = [...ctx.axisManager.getAxisContext(X), ...ctx.axisManager.getAxisContext(Y)]; + const { removed, added } = this.diffAxisIds(axesCtx); + if (removed.length > 0) { + this.axes = this.axes.filter((entry) => { + if (removed.includes(entry.axisId)) { + entry.div.destroy(); + this.overlappingAxisIds.delete(entry.axisId); + if (this.hoveredAxisId === entry.axisId) + this.hoveredAxisId = void 0; + if (this.activeAxisId === entry.axisId) + this.activeAxisId = void 0; + return false; + } + return true; + }); + } + for (const newAxisCtx of added) { + const { axisId, direction } = newAxisCtx; + this.axes.push(this.initAxis(ctx, axisId, this.axesHandlers, direction)); + } + for (const axis of this.axes) { + const axisCtx = axesCtx.find((ac) => ac.axisId === axis.axisId); + const bbox = axisCtx.getCanvasBounds(); + axis.div.setHidden(boxEmpty(bbox)); + if (bbox == void 0) { + axis.bounds = void 0; + } else { + axis.div.setBounds(bbox); + axis.bounds = new _ModuleSupport164.BBox(bbox.x, bbox.y, bbox.width, bbox.height); + } + } + this.updateOverlappingAxisPointerEvents(enableAxisDragging, enableAxisScrolling); + } + setAxisCursor(cursor) { + this.cursor = cursor; + for (const axis of this.axes) { + axis.div.setCursor(this.getCursor(axis.direction)); + } + } + toggleAxisDraggingCursor(direction, enabled) { + for (const axis of this.axes) { + if (axis.direction !== direction) + continue; + axis.div.setCursor(enabled ? this.getCursor(direction) : void 0); + } + } + updateOverlappingAxisPointerEvents(enableAxisDragging, enableAxisScrolling) { + this.overlappingAxisIds.clear(); + const shouldEnableInteraction = (enableAxisDragging || enableAxisScrolling) && this.seriesRect; + for (const axis of this.axes) { + if (!shouldEnableInteraction) { + axis.div.setPointerEvents(void 0); + continue; + } + const isOverlapping = Boolean(axis.bounds?.collidesBBox(this.seriesRect)); + if (isOverlapping) { + this.overlappingAxisIds.add(axis.axisId); + axis.div.setPointerEvents("none"); + } else { + axis.div.setPointerEvents(void 0); + } + } + this.cleanupAxisState(); + } + cleanupAxisState() { + if (this.hoveredAxisId && !this.overlappingAxisIds.has(this.hoveredAxisId)) { + this.hoveredAxisId = void 0; + } + if (this.activeAxisId && !this.overlappingAxisIds.has(this.activeAxisId)) { + this.activeAxisId = void 0; + } + } + pickAxisAtPoint(x, y) { + for (const axis of this.axes) { + if (!this.overlappingAxisIds.has(axis.axisId)) + continue; + if (axis.bounds?.containsPoint(x, y)) { + return { axisId: axis.axisId, direction: axis.direction }; + } + } + return void 0; + } + setHoveredAxis(axisId) { + if (this.overlappingAxisIds.has(axisId)) { + this.hoveredAxisId = axisId; + } + } + clearHoveredAxis() { + if (!this.activeAxisId) { + this.hoveredAxisId = void 0; + } + } + beginDelegatedAxisDrag(axisId) { + if (!this.overlappingAxisIds.has(axisId)) + return false; + this.activeAxisId = axisId; + this.hoveredAxisId = void 0; + return true; + } + endDelegatedAxisDrag(axisId) { + if (this.activeAxisId === axisId) { + this.activeAxisId = void 0; + } + this.hoveredAxisId = void 0; + } + hasOverlappingAxes() { + return this.overlappingAxisIds.size > 0; + } + getHoveredAxis() { + if (!this.hoveredAxisId) + return void 0; + const axis = this.axes.find((a) => a.axisId === this.hoveredAxisId); + return axis ? { axisId: axis.axisId, direction: axis.direction } : void 0; + } + getCursor(direction) { + if (this.cursor) + return this.cursor; + return direction === ChartAxisDirection21.X ? "ew-resize" : "ns-resize"; + } + initAxis(ctx, axisId, handlers, direction) { + const where = "afterend"; + const div = ctx.proxyInteractionService.createProxyElement({ type: "region", domManagerId: axisId, where }); + div.setCursor(this.getCursor(direction)); + div.addListener("drag-start", (e) => { + if (e.device === "touch") { + e.sourceEvent.preventDefault(); + } + this.activeAxisId = axisId; + handlers.onAxisDragStart(direction); + }); + div.addListener("drag-move", (event) => handlers.onAxisDragMove(axisId, direction, event)); + div.addListener("drag-end", () => { + this.activeAxisId = void 0; + this.hoveredAxisId = void 0; + handlers.onAxisDragEnd(); + }); + div.addListener("dblclick", () => handlers.onAxisDoubleClick(axisId, direction)); + div.addListener("wheel", (event) => handlers.onAxisWheel(axisId, direction, event)); + return { axisId, div, direction }; + } + diffAxisIds(axesCtx) { + const myIds = this.axes.map((entry) => entry.axisId); + const ctxIds = axesCtx.map((ctx) => ctx.axisId); + const removed = myIds.filter((id) => !ctxIds.includes(id)); + const added = axesCtx.filter((ac) => !myIds.includes(ac.axisId)); + return { removed, added }; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomPanner.ts +import { _ModuleSupport as _ModuleSupport165 } from "ag-charts-community"; +import { entries as entries6, getWindow as getWindow3 } from "ag-charts-core"; +var maxZoomCoords = 16; +var decelerationValues = { + off: 1, + short: 0.01, + long: 2e-3 +}; +var ZoomPanner = class { + constructor() { + this.deceleration = 1; + this.zoomCoordsHistoryIndex = 0; + this.coordsHistory = []; + } + get decelerationValue() { + const { deceleration } = this; + return Math.max( + typeof deceleration === "number" ? deceleration : decelerationValues[deceleration] ?? 1, + 1e-4 + ); + } + addListener(_type, fn) { + this.onUpdate = fn; + return () => { + this.onUpdate = void 0; + }; + } + stopInteractions() { + if (this.inertiaHandle != null) { + cancelAnimationFrame(this.inertiaHandle); + this.inertiaHandle = void 0; + } + } + update(event) { + this.updateCoords(event.currentX, event.currentY); + const { x1 = 0, y1 = 0, x2 = 0, y2 = 0 } = this.coords ?? {}; + this.onUpdate?.({ + type: "update", + deltaX: this.isPanningX() ? x1 - x2 : 0, + deltaY: this.isPanningY() ? y1 - y2 : 0 + }); + } + start(direction) { + this.direction = direction; + this.coordsMonitorTimeout = setInterval(this.recordCurrentZoomCoords.bind(this), 16); + } + stop() { + const { coordsHistory } = this; + let deltaX = 0; + let deltaY = 0; + let deltaT = 0; + if (coordsHistory.length > 0) { + const arrayIndex = this.zoomCoordsHistoryIndex % maxZoomCoords; + let index1 = arrayIndex - 1; + if (index1 < 0) + index1 = coordsHistory.length - 1; + let index0 = arrayIndex; + if (index0 >= coordsHistory.length) + index0 = 0; + const coords1 = coordsHistory[index1]; + const coords0 = coordsHistory[index0]; + deltaX = this.isPanningX() ? coords1.x - coords0.x : 0; + deltaY = this.isPanningY() ? coords1.y - coords0.y : 0; + deltaT = coords1.t - coords0.t; + } + this.coords = void 0; + this.direction = void 0; + clearInterval(this.coordsMonitorTimeout); + this.coordsMonitorTimeout = void 0; + this.zoomCoordsHistoryIndex = 0; + this.coordsHistory.length = 0; + if (deltaT > 0 && this.decelerationValue < 1) { + const xVelocity = deltaX / deltaT; + const yVelocity = deltaY / deltaT; + const velocity = Math.hypot(xVelocity, yVelocity); + const angle = Math.atan2(yVelocity, xVelocity); + const t0 = performance.now(); + this.inertiaHandle = getWindow3().requestAnimationFrame((t) => { + this.animateInertia(t, t, t0, velocity, angle); + }); + } + } + recordCurrentZoomCoords() { + const { coords, coordsHistory, zoomCoordsHistoryIndex } = this; + if (!coords) + return; + const { x2: x, y2: y } = coords; + const t = Date.now(); + coordsHistory[zoomCoordsHistoryIndex % maxZoomCoords] = { x, y, t }; + this.zoomCoordsHistoryIndex += 1; + } + animateInertia(t, prevT, t0, velocity, angle) { + const friction = 1 - this.decelerationValue; + const maxS = -velocity / Math.log(friction); + const s0 = velocity * (friction ** (prevT - t0) - 1) / Math.log(friction); + const s1 = velocity * (friction ** (t - t0) - 1) / Math.log(friction); + this.onUpdate?.({ + type: "update", + deltaX: this.isPanningX() ? -Math.cos(angle) * (s1 - s0) : 0, + deltaY: this.isPanningY() ? -Math.sin(angle) * (s1 - s0) : 0 + }); + if (s1 >= maxS - 1) + return; + this.inertiaHandle = requestAnimationFrame((nextT) => { + this.animateInertia(nextT, t, t0, velocity, angle); + }); + } + updateCoords(x, y) { + if (this.coords) { + this.coords = { x1: this.coords.x2, y1: this.coords.y2, x2: x, y2: y }; + } else { + this.coords = { x1: x, y1: y, x2: x, y2: y }; + } + } + isPanningX() { + return this.direction == null || this.direction === _ModuleSupport165.ChartAxisDirection.X; + } + isPanningY() { + return this.direction == null || this.direction === _ModuleSupport165.ChartAxisDirection.Y; + } + translateZooms(bbox, currentZooms, deltaX, deltaY) { + const offset = pointToRatio(bbox, bbox.x + Math.abs(deltaX), bbox.y + bbox.height - Math.abs(deltaY)); + const offsetX = Math.sign(deltaX) * offset.x; + const offsetY = -Math.sign(deltaY) * offset.y; + const newZooms = {}; + for (const [axisId, { direction, zoom: currentZoom }] of entries6(currentZooms)) { + if (currentZoom && currentZoom.min === UNIT_MIN && currentZoom.max === UNIT_MAX) { + continue; + } + let zoom = definedZoomState({ [direction]: currentZoom }); + zoom = constrainZoom(translateZoom(zoom, offsetX * dx(zoom), offsetY * dy(zoom))); + newZooms[axisId] = { direction, zoom: zoom[direction] }; + } + return newZooms; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomScrollPanner.ts +import { _ModuleSupport as _ModuleSupport166 } from "ag-charts-community"; +import { entries as entries7 } from "ag-charts-core"; +var DELTA_SCALE = 200; +var ZoomScrollPanner = class { + update(event, step, bbox, zooms) { + const deltaX = event.deltaX * step * DELTA_SCALE; + return this.translateZooms(bbox, zooms, deltaX); + } + translateZooms(bbox, currentZooms, deltaX) { + const newZooms = {}; + const offset = pointToRatio(bbox, bbox.x + Math.abs(deltaX), 0); + const offsetX = deltaX < 0 ? -offset.x : offset.x; + for (const [axisId, { direction, zoom: currentZoom }] of entries7(currentZooms)) { + if (direction !== _ModuleSupport166.ChartAxisDirection.X) + continue; + let zoom = definedZoomState({ x: currentZoom }); + zoom = constrainZoom(translateZoom(zoom, offsetX * dx(zoom), 0)); + newZooms[axisId] = { direction, zoom: zoom.x }; + } + return newZooms; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomScroller.ts +import { _ModuleSupport as _ModuleSupport167 } from "ag-charts-community"; +import { entries as entries8 } from "ag-charts-core"; +var ZoomScroller = class { + updateAxes(event, props, bbox, zooms) { + const sourceEvent = event.sourceEvent; + const newZooms = {}; + const { anchorPointX, anchorPointY, isScalingX, isScalingY, scrollingStep } = props; + const origin = pointToRatio( + bbox, + sourceEvent.offsetX ?? sourceEvent.clientX, + sourceEvent.offsetY ?? sourceEvent.clientY + ); + for (const [axisId, { direction, zoom }] of entries8(zooms)) { + if (zoom == null) + continue; + let newZoom = { ...zoom }; + const delta3 = scrollingStep * event.deltaY * (zoom.max - zoom.min); + if (direction === _ModuleSupport167.ChartAxisDirection.X && isScalingX) { + newZoom.max += delta3; + newZoom = scaleZoomAxisWithAnchor(newZoom, zoom, anchorPointX, origin.x); + } else if (direction === _ModuleSupport167.ChartAxisDirection.Y && isScalingY) { + newZoom.max += delta3; + newZoom = scaleZoomAxisWithAnchor(newZoom, zoom, anchorPointY, origin.y); + } else { + continue; + } + if (newZoom.max < newZoom.min) + continue; + newZooms[axisId] = { direction, zoom: constrainAxis(newZoom) }; + } + return newZooms; + } + update(event, props, bbox, oldZoom) { + const { anchorPointX, anchorPointY, isScalingX, isScalingY, scrollingStep } = props; + const canvasX = event.offsetX + bbox.x; + const canvasY = event.offsetY + bbox.y; + const origin = pointToRatio(bbox, canvasX, canvasY); + const dir = event.deltaY; + let newZoom = definedZoomState(oldZoom); + newZoom.x.max += isScalingX ? scrollingStep * dir * dx(oldZoom) : 0; + newZoom.y.max += isScalingY ? scrollingStep * dir * dy(oldZoom) : 0; + if (newZoom.x.max < newZoom.x.min || newZoom.y.max < newZoom.y.min) + return; + if (isScalingX) { + newZoom.x = scaleZoomAxisWithAnchor(newZoom.x, oldZoom.x, anchorPointX, origin.x); + } + if (isScalingY) { + newZoom.y = scaleZoomAxisWithAnchor(newZoom.y, oldZoom.y, anchorPointY, origin.y); + } + newZoom = constrainZoom(newZoom); + return newZoom; + } + updateDelta(delta3, props, oldZoom) { + const { anchorPointX, anchorPointY, isScalingX, isScalingY, scrollingStep } = props; + let newZoom = definedZoomState(oldZoom); + newZoom.x.max += isScalingX ? scrollingStep * -delta3 * dx(oldZoom) : 0; + newZoom.y.max += isScalingY ? scrollingStep * -delta3 * dy(oldZoom) : 0; + if (isScalingX) { + newZoom.x = scaleZoomAxisWithAnchor(newZoom.x, oldZoom.x, anchorPointX); + } + if (isScalingY) { + newZoom.y = scaleZoomAxisWithAnchor(newZoom.y, oldZoom.y, anchorPointY); + } + newZoom = constrainZoom(newZoom); + return newZoom; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomSelector.ts +var ZoomSelector = class { + constructor(rect, getZoom, isZoomValid) { + this.rect = rect; + this.getZoom = getZoom; + this.isZoomValid = isZoomValid; + this.rect.visible = false; + } + update(event, props, bbox) { + const canvasX = event.currentX + (bbox?.x ?? 0); + const canvasY = event.currentY + (bbox?.y ?? 0); + this.rect.visible = true; + this.updateCoords(canvasX, canvasY, props, bbox); + this.updateRect(bbox); + } + stop(innerBBox, bbox, currentZoom) { + let zoom = definedZoomState(); + if (!innerBBox || !bbox) + return zoom; + if (this.coords) { + zoom = this.createZoomFromCoords(bbox, currentZoom); + } + const multiplyX = bbox.width / innerBBox.width; + const multiplyY = bbox.height / innerBBox.height; + zoom = constrainZoom(multiplyZoom(zoom, multiplyX, multiplyY)); + this.reset(); + return zoom; + } + reset() { + this.coords = void 0; + this.rect.visible = false; + } + didUpdate() { + return this.rect.visible && this.rect.width > 0 && this.rect.height > 0; + } + updateCoords(x, y, props, bbox) { + if (!this.coords) { + this.coords = { x1: x, y1: y, x2: x, y2: y }; + return; + } + const { coords } = this; + coords.x2 = x; + coords.y2 = y; + if (!bbox) + return; + const { isScalingX, isScalingY, keepAspectRatio } = props; + const normal = this.getNormalisedDimensions(); + if (keepAspectRatio && isScalingX && isScalingY) { + const aspectRatio = bbox.width / bbox.height; + if (coords.y2 < coords.y1) { + coords.y2 = Math.min(coords.y1 - normal.width / aspectRatio, coords.y1); + } else { + coords.y2 = Math.max(coords.y1 + normal.width / aspectRatio, coords.y1); + } + } + if (!isScalingX) { + coords.x1 = bbox.x; + coords.x2 = bbox.x + bbox.width; + } + if (!isScalingY) { + coords.y1 = bbox.y; + coords.y2 = bbox.y + bbox.height; + } + } + updateRect(bbox) { + if (!bbox) + return; + const { rect } = this; + const normal = this.getNormalisedDimensions(); + const { width, height } = normal; + let { x, y } = normal; + x = Math.max(x, bbox.x); + x -= Math.max(0, x + width - (bbox.x + bbox.width)); + y = Math.max(y, bbox.y); + y -= Math.max(0, y + height - (bbox.y + bbox.height)); + rect.x = x; + rect.y = y; + rect.width = width; + rect.height = height; + const zoom = this.createZoomFromCoords(bbox, this.getZoom()); + if (this.isZoomValid(zoom)) { + rect.updateValid(); + } else { + rect.updateInvalid(); + } + } + createZoomFromCoords(bbox, currentZoom) { + const oldZoom = definedZoomState(currentZoom); + const normal = this.getNormalisedDimensions(); + const origin = pointToRatio(bbox, normal.x, normal.y + normal.height); + const xFactor = normal.width / bbox.width; + const yFactor = normal.height / bbox.height; + let newZoom = scaleZoom(oldZoom, xFactor, yFactor); + const translateX = origin.x * dx(oldZoom); + const translateY = origin.y * dy(oldZoom); + newZoom = translateZoom(newZoom, translateX, translateY); + newZoom = constrainZoom(newZoom); + return newZoom; + } + getNormalisedDimensions() { + const { x1 = 0, y1 = 0, x2 = 0, y2 = 0 } = this.coords ?? {}; + const x = Math.min(x1, x2); + const y = Math.min(y1, y2); + const width = x1 <= x2 ? x2 - x1 : x1 - x2; + const height = y1 <= y2 ? y2 - y1 : y1 - y2; + return { x, y, width, height }; + } +}; + +// packages/ag-charts-enterprise/src/features/zoom/zoomToolbar.ts +import { _ModuleSupport as _ModuleSupport168 } from "ag-charts-community"; +import { CleanupRegistry as CleanupRegistry3, createElement as createElement5, debounce, entries as entries9 } from "ag-charts-core"; +var { + ActionOnSet: ActionOnSet8, + BaseProperties: BaseProperties22, + ChartAxisDirection: ChartAxisDirection22, + NativeWidget: NativeWidget2, + PropertiesArray: PropertiesArray6, + Toolbar: Toolbar2, + ToolbarButtonProperties: ToolbarButtonProperties4, + Property: Property61 +} = _ModuleSupport168; +var ZoomButtonProperties = class extends ToolbarButtonProperties4 { +}; +__decorateClass([ + Property61 +], ZoomButtonProperties.prototype, "value", 2); +__decorateClass([ + Property61 +], ZoomButtonProperties.prototype, "section", 2); +var ZoomToolbar = class extends BaseProperties22 { + constructor(ctx, getModuleProperties, canResetZoom, updateZoom, updateAxisZoom, resetZoom, isZoomValid) { + super(); + this.ctx = ctx; + this.getModuleProperties = getModuleProperties; + this.canResetZoom = canResetZoom; + this.updateZoom = updateZoom; + this.updateAxisZoom = updateAxisZoom; + this.resetZoom = resetZoom; + this.isZoomValid = isZoomValid; + this.enabled = false; + this.buttons = new PropertiesArray6(ZoomButtonProperties); + this.visible = "hover"; + this.verticalSpacing = 10; + this.detectionRange = 38; + this.cleanup = new CleanupRegistry3(); + this.toggleButtonsDebounced = debounce(this.toggleButtons.bind(this), ZOOM_VALID_CHECK_DEBOUNCE, { + leading: true, + trailing: true + }); + this.container = new NativeWidget2(createElement5("div")); + this.container.addClass("ag-charts-zoom-buttons"); + ctx.domManager.addChild("canvas-overlay", "zoom-buttons", this.container.getElement()); + this.toolbar = new Toolbar2(ctx, "ariaLabelZoomToolbar", "horizontal"); + this.container.addChild(this.toolbar); + this.toolbar.getElement().style.transform = `translateY(54px)`; + this.toggleVisibility(this.visible === "always"); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPress.bind(this)), + this.toolbar.addToolbarListener("button-focused", this.onButtonFocus.bind(this)), + ctx.widgets.containerWidget.addListener("mousemove", this.onHover.bind(this)), + ctx.widgets.containerWidget.addListener("mouseleave", this.onLeave.bind(this)), + ctx.eventsHub.on("layout:complete", this.onLayoutComplete.bind(this)), + this.teardown.bind(this) + ); + } + destroy() { + this.cleanup.flush(); + } + toggleVisibleZoomed(maxZoom) { + if (this.visible !== "zoomed") + return; + this.toggleVisibility(!maxZoom); + } + teardown() { + this.ctx.domManager.removeChild("canvas-overlay", "zoom-buttons"); + this.container.destroy(); + } + onLayoutComplete(event) { + const { buttons: buttons2, container } = this; + const { rect } = event.series; + for (const b of buttons2) { + if (b.tooltip == null && b.label == null) { + const map = { + "pan-end": "toolbarZoomPanEnd", + "pan-left": "toolbarZoomPanLeft", + "pan-right": "toolbarZoomPanRight", + "pan-start": "toolbarZoomPanStart", + "zoom-in": "toolbarZoomZoomIn", + "zoom-out": "toolbarZoomZoomOut", + reset: "toolbarZoomReset" + }; + b.tooltip = map[b.value]; + } + } + this.toolbar.updateButtons(buttons2); + this.toggleButtonsDebounced(); + const height = container.getBounds().height; + container.setBounds({ y: rect.y + rect.height - height }); + } + onHover(event) { + if (!this.enabled || this.visible !== "hover" || this.toolbar.isHidden()) + return; + const { + container, + detectionRange, + ctx: { scene } + } = this; + const { + currentY, + sourceEvent: { target } + } = event; + const element = container.getElement(); + const detectionY = element.offsetTop - detectionRange; + const visible = currentY > detectionY && currentY < scene.canvas.element.offsetHeight || target === element; + this.toggleVisibility(visible); + } + onLeave() { + if (this.visible !== "hover") + return; + this.toggleVisibility(false); + } + toggleVisibility(visible, immediate = false) { + const { container, toolbar: toolbar2, verticalSpacing } = this; + toolbar2.toggleClass("ag-charts-zoom-buttons__toolbar--hidden", !visible); + const element = toolbar2.getElement(); + element.style.transitionDuration = immediate ? "0s" : ""; + element.style.transform = visible ? "translateY(0)" : `translateY(${container.getBounds().height + verticalSpacing}px)`; + } + toggleButtons() { + const zoom = definedZoomState(this.ctx.zoomManager.getZoom()); + if (this.previousZoom && isZoomEqual(this.previousZoom, zoom)) + return; + this.previousZoom = zoom; + for (const [index, button] of this.buttons.entries()) { + let enabled = true; + switch (button?.value) { + case "pan-start": + enabled = zoom.x.min > UNIT_MIN; + break; + case "pan-end": + enabled = zoom.x.max < UNIT_MAX; + break; + case "pan-left": + enabled = zoom.x.min > UNIT_MIN; + break; + case "pan-right": + enabled = zoom.x.max < UNIT_MAX; + break; + case "zoom-out": + enabled = !isZoomEqual(zoom, unitZoomState()); + break; + case "zoom-in": + enabled = this.isZoomValid( + this.getNextZoomStateUnified("zoom-in", zoom, this.getModuleProperties()) + ); + break; + case "reset": + enabled = this.canResetZoom(zoom); + break; + } + this.toolbar.toggleButtonEnabledByIndex(index, enabled); + } + } + onButtonPress({ button }) { + if (!this.enabled || this.toolbar.isHidden()) + return; + const props = this.getModuleProperties(); + if (props.independentAxes && button.value !== "reset") { + const axisZooms = this.ctx.zoomManager.getAxisZooms(); + for (const [axisId, { direction, zoom }] of entries9(axisZooms)) { + if (zoom == null) + continue; + this.onButtonPressAxis(button, props, axisId, direction, zoom); + } + } else { + this.onButtonPressUnified(button, props); + } + } + onButtonFocus(_event) { + this.toggleVisibility(true, true); + } + onButtonPressAxis(event, props, axisId, direction, zoom) { + const { isScalingX, isScalingY, scrollingStep } = props; + let newZoom = { ...zoom }; + const delta3 = zoom.max - zoom.min; + switch (event.value) { + case "pan-start": + newZoom.max = delta3; + newZoom.min = 0; + break; + case "pan-end": + newZoom.min = newZoom.max - delta3; + newZoom.max = UNIT_MAX; + break; + case "pan-left": + newZoom.min -= delta3 * scrollingStep; + newZoom.max -= delta3 * scrollingStep; + break; + case "pan-right": + newZoom.min += delta3 * scrollingStep; + newZoom.max += delta3 * scrollingStep; + break; + case "zoom-in": + case "zoom-out": { + const isDirectionX = direction === ChartAxisDirection22.X; + const isScalingDirection = isDirectionX && isScalingX || !isDirectionX && isScalingY; + let scale = event.value === "zoom-in" ? 1 - scrollingStep : 1 + scrollingStep; + if (!isScalingDirection) + scale = 1; + const placement = isDirectionX ? this.getAnchorPointX(props) : this.getAnchorPointY(props); + newZoom.max = newZoom.min + (newZoom.max - newZoom.min) * scale; + newZoom = scaleZoomAxisWithAnchor(newZoom, zoom, placement); + break; + } + } + this.updateAxisZoom(axisId, direction, constrainAxis(newZoom)); + } + onButtonPressUnified(event, props) { + const { scrollingStep } = props; + const oldZoom = definedZoomState(this.ctx.zoomManager.getZoom()); + let zoom = definedZoomState(oldZoom); + switch (event.value) { + case "reset": + this.resetZoom(); + return; + case "pan-start": + zoom.x.max = dx(zoom); + zoom.x.min = 0; + break; + case "pan-end": + zoom.x.min = UNIT_MAX - dx(zoom); + zoom.x.max = UNIT_MAX; + break; + case "pan-left": + zoom = translateZoom(zoom, -dx(zoom) * scrollingStep, 0); + break; + case "pan-right": + zoom = translateZoom(zoom, dx(zoom) * scrollingStep, 0); + break; + case "zoom-in": + case "zoom-out": { + zoom = this.getNextZoomStateUnified(event.value, oldZoom, props); + break; + } + } + this.updateZoom(constrainZoom(zoom)); + } + getNextZoomStateUnified(button, oldZoom, props) { + const { isScalingX, isScalingY, scrollingStep } = props; + const scale = button === "zoom-in" ? 1 - scrollingStep : 1 + scrollingStep; + const zoom = scaleZoom(oldZoom, isScalingX ? scale : 1, isScalingY ? scale : 1); + zoom.x = scaleZoomAxisWithAnchor(zoom.x, oldZoom.x, this.getAnchorPointX(props)); + zoom.y = scaleZoomAxisWithAnchor(zoom.y, oldZoom.y, this.getAnchorPointY(props)); + return zoom; + } + getAnchorPointX(props) { + const anchorPointX = this.anchorPointX ?? props.anchorPointX; + return anchorPointX === "pointer" ? DEFAULT_ANCHOR_POINT_X : anchorPointX; + } + getAnchorPointY(props) { + const anchorPointY = this.anchorPointY ?? props.anchorPointY; + return anchorPointY === "pointer" ? DEFAULT_ANCHOR_POINT_Y : anchorPointY; + } +}; +__decorateClass([ + Property61, + ActionOnSet8({ + changeValue(enabled) { + this.toolbar?.setHidden(!enabled); + } + }) +], ZoomToolbar.prototype, "enabled", 2); +__decorateClass([ + Property61 +], ZoomToolbar.prototype, "buttons", 2); +__decorateClass([ + Property61, + ActionOnSet8({ + changeValue(visible, oldValue) { + if (oldValue == null) + return; + const always = visible === "always"; + const zoomed = visible === "zoomed" && this.previousZoom != null && !isMaxZoom(this.previousZoom); + this.toggleVisibility(always || zoomed); + } + }) +], ZoomToolbar.prototype, "visible", 2); +__decorateClass([ + Property61 +], ZoomToolbar.prototype, "anchorPointX", 2); +__decorateClass([ + Property61 +], ZoomToolbar.prototype, "anchorPointY", 2); + +// packages/ag-charts-enterprise/src/features/zoom/zoomTwoFingers.ts +var N = 1e6; +function clientToNormal({ min, max }, a, Rx, Rw) { + if (Rw === 0) + return 0; + return N * ((a - Rx) / Rw * (max - min) + min); +} +function solveTwoUnknowns(x1, x2, a1, a2, Rx, Rw) { + [x1, x2] = [Math.min(x1, x2), Math.max(x1, x2)]; + [a1, a2] = [Math.min(a1, a2), Math.max(a1, a2)]; + const t1 = N * (a1 - Rx) / Rw; + const t2 = N * (a2 - Rx) / Rw; + const c = (a1 - Rx) / (a2 - Rx); + const min = (x1 - c * x2) / (N - t1 + c * (t2 - N)); + const max = (x2 + (t2 - N) * min) / t2; + return { min, max }; +} +function isRangeOverlapping(centerA, radiusA, centerB, radiusB) { + if (radiusA === 0) + radiusA = 30; + if (radiusB === 0) + radiusB = 30; + const minA = centerA - radiusA; + const maxA = centerA + radiusA; + const minB = centerB - radiusB; + const maxB = centerB + radiusB; + return !(maxA < minB || maxB < minA); +} +var ZoomTwoFingers = class { + constructor() { + this.touchStart = { + origins: [ + { identifier: 0, normalX: Number.NaN, normalY: Number.NaN }, + { identifier: 0, normalX: Number.NaN, normalY: Number.NaN } + ] + }; + this.initialZoom = { x: { min: 0, max: 1 }, y: { min: 0, max: 1 } }; + this.previous = { a1: Number.NaN, a2: Number.NaN, b1: Number.NaN, b2: Number.NaN }; + } + start(event, target, zoom) { + if (event.sourceEvent.targetTouches.length !== 2) + return false; + event.sourceEvent.preventDefault(); + const targetTouches = Array.from(event.sourceEvent.targetTouches); + const { x: Rx, y: Ry, width: Rw, height: Rh } = target.getBoundingClientRect(); + this.initialZoom.x.min = zoom.x?.min ?? 0; + this.initialZoom.x.max = zoom.x?.max ?? 1; + this.initialZoom.y.min = zoom.y?.min ?? 0; + this.initialZoom.y.max = zoom.y?.max ?? 1; + for (const t of this.touchStart.origins) { + t.identifier = 0; + } + this.previous.a1 = Number.NaN; + this.previous.a2 = Number.NaN; + this.previous.b1 = Number.NaN; + this.previous.b2 = Number.NaN; + for (const i of [0, 1]) { + const a = targetTouches[i].clientX; + const b = Ry + Rh - targetTouches[i].clientY; + this.touchStart.origins[i].identifier = targetTouches[i].identifier; + this.touchStart.origins[i].normalX = clientToNormal(this.initialZoom.x, a, Rx, Rw); + this.touchStart.origins[i].normalY = clientToNormal(this.initialZoom.y, b, Ry, Rh); + } + const [tA, tB] = targetTouches; + const [oA, oB] = this.touchStart.origins; + const xOverlap = isRangeOverlapping(tA.clientX, tA.radiusX, tB.clientX, tB.radiusX); + const yOverlap = isRangeOverlapping(tA.clientY, tA.radiusY, tB.clientY, tB.radiusY); + if (yOverlap) + oA.normalY = oB.normalY = (oA.normalY + oB.normalY) / 2; + if (xOverlap) + oA.normalX = oB.normalX = (oA.normalX + oB.normalX) / 2; + return true; + } + update(event, target) { + event.sourceEvent.preventDefault(); + const targetTouches = Array.from(event.sourceEvent.targetTouches); + const { x: Rx, y: Ry, width: Rw, height: Rh } = target.getBoundingClientRect(); + const { origins } = this.touchStart; + const touches = [0, 1].map((i) => targetTouches.find((t) => t.identifier === origins[i].identifier)); + const x1 = origins[0].normalX; + const x2 = origins[1].normalX; + const a1 = touches[0].clientX; + const a2 = touches[1].clientX; + const y1 = origins[0].normalY; + const y2 = origins[1].normalY; + const b1 = Ry + Rh - touches[0].clientY; + const b2 = Ry + Rh - touches[1].clientY; + return this.twitchTolerantZoomPan4(x1, x2, a1, a2, y1, y2, b1, b2, Rx, Ry, Rw, Rh); + } + end(event) { + const identifiers = Array.from(event.sourceEvent.targetTouches).map((t) => t.identifier); + return !identifiers.includes(this.touchStart.origins[0].identifier) || !identifiers.includes(this.touchStart.origins[1].identifier); + } + // Small touch deltas on an axis, which can defined as one fingers moving ±1 pixel and the other not moving, can + // cause the canvas to flicker between two zoompan views. + // + // For example, consider two fingers moving upwards slowly on the Y-axis with the following events (Y=0 is the top + // of the screen): + // + // [0]: { finger1: { clientY: 101 }, finger2: { clientY: 201 } } + // [1]: { finger1: { clientY: 101 }, finger2: { clientY: 200 } } + // [2]: { finger1: { clientY: 100 }, finger2: { clientY: 200 } } + // + // The following transitions cause these changes to the zoompan respectively. + // + // [0] => [1] : yMin decreases, yMax increases + // [1] => [2] : yMin increases, yMax decreases + // + // At highly-zoomed views, this sudden shift in yMin/yMax in the [1] => [2] transition is very noticeable. When many + // of these kind of a transitions occur, the chart flickers between pan states instead of smoothly panning. Note + // however that, if we didn't receive event [1], our transition would like this: + // + // [0] => [2] : yMin increases, yMax increases + // + // ... which is a smooth panning transition. Therefore to prevent flickering, we skip event [1]. + twitchTolerantZoomPan4(x1, x2, a1, a2, y1, y2, b1, b2, Rx, Ry, Rw, Rh) { + const { initialZoom, previous } = this; + const x = twitchTolerantZoomPan2(x1, x2, a1, a2, previous, "a1", "a2", Rx, Rw, initialZoom.x); + const y = twitchTolerantZoomPan2(y1, y2, b1, b2, previous, "b1", "b2", Ry, Rh, initialZoom.y); + return { x, y }; + } +}; +function twitchTolerantZoomPan2(x1, x2, a1, a2, previous, previousKey1, previousKey2, Rx, Rw, initialZoom) { + if (x1 == x2) { + const xn1 = clientToNormal(initialZoom, a1, Rx, Rw); + const xn2 = clientToNormal(initialZoom, a2, Rx, Rw); + const xavg = (xn1 + xn2) / 2; + const dzoom = (x1 - xavg) / N; + return { min: initialZoom.min + dzoom, max: initialZoom.max + dzoom }; + } else { + const a1prev = previous[previousKey1]; + const a2prev = previous[previousKey2]; + const dx2 = Math.abs(a1 - a1prev) + Math.abs(a2 - a2prev); + if (dx2 <= 1) { + a1 = a1prev; + a2 = a2prev; + } else { + previous[previousKey1] = a1; + previous[previousKey2] = a2; + } + return solveTwoUnknowns(x1, x2, a1, a2, Rx, Rw); + } +} + +// packages/ag-charts-enterprise/src/features/zoom/zoom.ts +var { ActionOnSet: ActionOnSet9, ChartAxisDirection: ChartAxisDirection23, ChartUpdateType: ChartUpdateType3, Property: Property62, InteractionState: InteractionState5, ProxyProperty: ProxyProperty3 } = _ModuleSupport169; +var round = (value) => roundTo(value, 10); +var CURSOR_ID = "zoom-cursor"; +var TOOLTIP_ID = "zoom-tooltip"; +var ZoomAutoScaling = class extends _ModuleSupport169.BaseProperties { + constructor(onChange) { + super(); + this.onChange = onChange; + this.enabled = false; + this.padding = 0; + } +}; +__decorateClass([ + Property62, + ActionOnSet9({ + changeValue(enabled) { + this.onChange({ enabled, padding: this.padding }); + } + }) +], ZoomAutoScaling.prototype, "enabled", 2); +__decorateClass([ + Property62, + ActionOnSet9({ + changeValue(padding) { + this.onChange({ enabled: this.enabled, padding }); + } + }) +], ZoomAutoScaling.prototype, "padding", 2); +var Zoom = class extends _ModuleSupport169.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.enableAxisDragging = true; + this.enableAxisScrolling = false; + this.enableDoubleClickToReset = true; + this.enablePanning = true; + this.enableScrolling = true; + this.enableSelecting = false; + this.enableTwoFingerZoom = true; + this.panKey = "alt"; + this.axes = "x"; + this.scrollingStep = UNIT_SIZE / 10; + this.keepAspectRatio = false; + this.minVisibleItems = 2; + this.anchorPointX = DEFAULT_ANCHOR_POINT_X; + this.anchorPointY = DEFAULT_ANCHOR_POINT_Y; + this.autoScaling = new ZoomAutoScaling((newValue) => { + this.ctx.zoomManager.setAutoScaleYAxis(newValue.enabled, newValue.padding); + }); + this.axisDraggingMode = "zoom"; + this.canResetZoom = (zoom) => { + zoom ?? (zoom = this.getZoom()); + return !isZoomEqual(zoom, this.getResetZoom()); + }; + this.buttons = new ZoomToolbar( + this.ctx, + this.getModuleProperties.bind(this), + this.canResetZoom, + this.updateZoom.bind(this), + this.updateAxisZoom.bind(this), + this.resetZoom.bind(this), + this.isZoomValid.bind(this) + ); + // Zoom methods + this.axisDragger = new ZoomAxisDragger(); + this.panner = new ZoomPanner(); + this.scroller = new ZoomScroller(); + this.scrollPanner = new ZoomScrollPanner(); + this.twoFingers = new ZoomTwoFingers(); + this.deceleration = "short"; + // State + this.dragState = 0 /* None */; + this.isState = (state) => this.ctx.interactionManager.isState(state); + this.destroyContextMenuActions = void 0; + this.isFirstWheelEvent = true; + this.debouncedWheelReset = debounce2(() => { + this.isFirstWheelEvent = true; + this.wasFirstWheelEventZoomCapped = void 0; + }, 100); + this.previousZoomValid = true; + this.previousAxisZoomValid = { + [_ModuleSupport169.ChartAxisDirection.X]: true, + [_ModuleSupport169.ChartAxisDirection.Y]: true + }; + this.toggleAxisDraggingCursorsDebounced = debounce2( + this.toggleAxisDraggingCursors.bind(this), + ZOOM_VALID_CHECK_DEBOUNCE, + { + leading: true, + trailing: true + } + ); + const selectionRect = new ZoomRect(); + this.selector = new ZoomSelector(selectionRect, this.getZoom.bind(this), this.isZoomValid.bind(this)); + this.contextMenu = new ZoomContextMenu( + ctx.eventsHub, + ctx.contextMenuRegistry, + ctx.zoomManager, + this.getModuleProperties.bind(this), + this.canResetZoom, + () => this.paddedRect, + this.updateZoom.bind(this), + this.isZoomValid.bind(this) + ); + this.domProxy = new ZoomDOMProxy({ + onAxisDragStart: (direction) => this.onAxisDragStart(direction), + onAxisDragMove: (id, direction, event) => this.onAxisDragMove(id, direction, event), + onAxisDragEnd: () => this.onAxisDragEnd(), + onAxisDoubleClick: (id) => this.onAxisDoubleClick(id), + onAxisWheel: (id, direction, event) => this.onAxisWheel(id, direction, event) + }); + if (ctx.widgets.seriesDragInterpreter) { + this.cleanup.register( + ctx.widgets.seriesDragInterpreter.events.on("dblclick", (event) => this.onSeriesAreaDoubleClick(event)), + ctx.widgets.seriesDragInterpreter.events.on("drag-move", (event) => this.onSeriesAreaDragMove(event)), + ctx.widgets.seriesDragInterpreter.events.on("drag-start", (event) => this.onSeriesAreaDragStart(event)), + ctx.widgets.seriesDragInterpreter.events.on("drag-end", () => this.onSeriesAreaDragEnd()) + ); + } + this.cleanup.register( + ctx.scene.attachNode(selectionRect), + ctx.eventsHub.on("series-area:hover", (event) => this.onSeriesAreaHoverEvent(event)), + ctx.eventsHub.on("series-area:click", (event) => this.onSeriesAreaClickEvent(event)), + ctx.eventsHub.on("series:keynav-zoom", (event) => this.onNavZoom(event)), + ctx.widgets.seriesWidget.addListener("wheel", (event) => this.onWheel(event)), + ctx.widgets.seriesWidget.addListener("touchstart", (event, current) => this.onTouchStart(event, current)), + ctx.widgets.seriesWidget.addListener("touchmove", (event, current) => this.onTouchMove(event, current)), + ctx.widgets.seriesWidget.addListener("touchend", (event) => this.onTouchEnd(event)), + ctx.widgets.seriesWidget.addListener("touchcancel", (event) => this.onTouchEnd(event)), + ctx.updateService.addListener("process-data", (event) => this.onProcessData(event)), + ctx.eventsHub.on("layout:complete", (event) => this.onLayoutComplete(event)), + ctx.eventsHub.on("zoom:change", (event) => this.onZoomChange(event)), + ctx.eventsHub.on("zoom:pan-start", (event) => this.onZoomPanStart(event)), + this.panner.addListener("update", (event) => this.onPanUpdate(event)), + () => this.teardown() + ); + } + teardown() { + this.ctx.zoomManager.setZoomModuleEnabled(false); + this.buttons.destroy(); + this.destroyContextMenuActions?.(); + this.domProxy.destroy(); + } + onEnabledChange(enabled) { + this.ctx.zoomManager.setZoomModuleEnabled(enabled); + if (this.contextMenu) { + this.destroyContextMenuActions?.(); + this.destroyContextMenuActions = this.contextMenu.registerActions(enabled); + } + } + isIgnoredTouch(event) { + if (event?.device !== "touch") { + return false; + } + if (this.ctx.chartService.touch.dragAction !== "drag") { + return true; + } + if (this.enableSelecting) { + return false; + } + if (!this.enablePanning) { + return true; + } + return isMaxZoom(this.getZoom()); + } + onSeriesAreaDoubleClick(event) { + const { enabled, enableDoubleClickToReset } = this; + if (!enabled || !enableDoubleClickToReset) + return; + if (event?.preventZoomDblClick || !this.isState(InteractionState5.ZoomClickable)) + return; + this.resetZoom(); + } + onSeriesAreaHoverEvent(event) { + if (!this.shouldHandleAxisHover(event)) { + this.clearHoveredAxis(); + return; + } + const axis = this.domProxy.pickAxisAtPoint(event.x, event.y); + if (axis) { + this.domProxy.setHoveredAxis(axis.axisId); + this.ctx.domManager.updateCursor(CURSOR_ID, this.domProxy.getCursor(axis.direction)); + } else { + this.clearHoveredAxis(); + } + } + onSeriesAreaClickEvent(event) { + if (!this.shouldHandleAxisClick(event)) + return; + const axis = this.domProxy.pickAxisAtPoint(event.x, event.y); + if (axis && event.sourceEvent?.type === "dblclick") { + this.onAxisDoubleClick(axis.axisId); + } + } + shouldHandleAxisHover(event) { + const { enabled, enableAxisDragging, enableAxisScrolling, dragState } = this; + return enabled && (enableAxisDragging || enableAxisScrolling) && !event.consumed && !this.activeAxis && dragState === 0 /* None */ && this.domProxy.hasOverlappingAxes(); + } + shouldHandleAxisClick(event) { + const { enabled, enableAxisDragging, enableAxisScrolling, enableDoubleClickToReset } = this; + return enabled && !this.activeAxis && !event.consumed && (enableAxisDragging || enableAxisScrolling || enableDoubleClickToReset); + } + clearHoveredAxis() { + if (this.activeAxis) + return; + this.domProxy.clearHoveredAxis(); + if (this.dragState === 0 /* None */) { + this.ctx.domManager.updateCursor(CURSOR_ID); + } + } + tryBeginAxisDelegation(event) { + const hoveredAxis = this.domProxy.getHoveredAxis(); + if (!this.enabled || !this.enableAxisDragging || !hoveredAxis) { + return false; + } + if (!this.domProxy.beginDelegatedAxisDrag(hoveredAxis.axisId)) { + return false; + } + this.activeAxis = hoveredAxis; + this.onAxisDragStart(hoveredAxis.direction); + const cursor = this.dragState === 2 /* Pan */ ? "grabbing" : this.domProxy.getCursor(hoveredAxis.direction); + this.ctx.domManager.updateCursor(CURSOR_ID, cursor); + if (event.device === "touch") { + event.sourceEvent.preventDefault(); + } + return true; + } + onSeriesAreaDragStart(event) { + const { + enabled, + enablePanning, + enableSelecting, + ctx: { domManager, zoomManager } + } = this; + if (!enabled || !this.isState(InteractionState5.ZoomDraggable) || this.dragState !== 0 /* None */ || this.isIgnoredTouch(event)) { + return; + } + this.panner.stopInteractions(); + if (this.tryBeginAxisDelegation(event)) { + return; + } + let newDragState = 0 /* None */; + const panKeyPressed = this.isPanningKeyPressed(event.sourceEvent); + if (enablePanning && (!enableSelecting || panKeyPressed)) { + domManager.updateCursor(CURSOR_ID, "grabbing"); + newDragState = 2 /* Pan */; + this.panner.start(); + } else if (enableSelecting && !panKeyPressed) { + newDragState = 3 /* Select */; + } + if ((this.dragState = newDragState) !== 0 /* None */) { + zoomManager.fireZoomPanStartEvent("zoom"); + } + } + onSeriesAreaDragMove(event) { + const { + dragState, + enabled, + paddedRect, + panner, + selector, + ctx: { interactionManager, tooltipManager, updateService } + } = this; + if (this.activeAxis) { + this.onAxisDragMove(this.activeAxis.axisId, this.activeAxis.direction, event); + return; + } + if (!enabled || !paddedRect || !this.isState(InteractionState5.ZoomDraggable) || this.isIgnoredTouch(event)) { + return; + } + interactionManager.pushState(_ModuleSupport169.InteractionState.ZoomDrag); + if (event.device === "touch") { + event.sourceEvent.preventDefault(); + } + switch (dragState) { + case 2 /* Pan */: + panner.update(event); + break; + case 3 /* Select */: + selector.update(event, this.getModuleProperties(), paddedRect); + break; + case 0 /* None */: + return; + } + tooltipManager.updateTooltip(TOOLTIP_ID); + updateService.update(ChartUpdateType3.PERFORM_LAYOUT, { skipAnimations: true }); + } + onSeriesAreaDragEnd() { + const { + ctx: { interactionManager } + } = this; + if (this.activeAxis) { + this.handleAxisDragEnd(); + return; + } + interactionManager.popState(_ModuleSupport169.InteractionState.ZoomDrag); + if (!this.enabled || this.dragState === 0 /* None */) + return; + this.handleRegularDragEnd(); + this.resetDragState(); + } + handleAxisDragEnd() { + this.onAxisDragEnd(); + this.domProxy.endDelegatedAxisDrag(this.activeAxis.axisId); + this.activeAxis = void 0; + this.clearHoveredAxis(); + } + handleRegularDragEnd() { + const { panner, selector } = this; + switch (this.dragState) { + case 2 /* Pan */: + panner.stop(); + break; + case 3 /* Select */: + if (selector.didUpdate()) { + const newZoom = selector.stop(this.seriesRect, this.paddedRect, this.getZoom()); + this.updateZoom(newZoom); + } + break; + } + } + resetDragState() { + this.dragState = 0 /* None */; + this.ctx.domManager.updateCursor(CURSOR_ID); + this.ctx.tooltipManager.removeTooltip(TOOLTIP_ID); + } + onAxisDoubleClick(id) { + const { + enabled, + enableDoubleClickToReset, + ctx: { zoomManager } + } = this; + if (!enabled || !enableDoubleClickToReset || !this.isState(InteractionState5.ZoomClickable)) + return; + this.previousAxisZoomValid = { [ChartAxisDirection23.X]: true, [ChartAxisDirection23.Y]: true }; + zoomManager.resetAxisZoom("zoom", id); + } + onAxisDragStart(direction) { + const { + axisDraggingMode, + domProxy, + enabled, + enableAxisDragging, + panner, + ctx: { zoomManager } + } = this; + if (!enabled || !enableAxisDragging) + return; + panner.stopInteractions(); + if (axisDraggingMode === "pan") { + domProxy.setAxisCursor("grabbing"); + this.dragState = 2 /* Pan */; + this.panner.start(direction); + zoomManager.fireZoomPanStartEvent("zoom"); + } else { + this.dragState = 1 /* Axis */; + } + } + onAxisDragMove(axisId, direction, event) { + const { + anchorPointX, + anchorPointY, + axisDragger, + dragState, + enabled, + enableAxisDragging, + seriesRect, + shouldFlipXY, + ctx: { interactionManager, tooltipManager, updateService, zoomManager } + } = this; + if (!enabled || !enableAxisDragging || !seriesRect) + return; + interactionManager.pushState(_ModuleSupport169.InteractionState.ZoomDrag); + if (event.device === "touch") { + event.sourceEvent.preventDefault(); + } + const zoom = this.getZoom(); + if (dragState === 2 /* Pan */) { + this.panner.update({ currentX: event.offsetX, currentY: event.offsetY }); + } else { + let anchor = direction === ChartAxisDirection23.X ? anchorPointX : anchorPointY; + if (shouldFlipXY) + anchor = direction === ChartAxisDirection23.X ? anchorPointY : anchorPointX; + const axisZoom = zoomManager.getAxisZoom(axisId); + const newZoom = axisDragger.update(event, direction, anchor, seriesRect, zoom, axisZoom); + zoomManager.setAxisManuallyAdjusted("zoom", axisId); + this.updateAxisZoom(axisId, direction, newZoom, { + directional: true + }); + } + tooltipManager.updateTooltip(TOOLTIP_ID); + updateService.update(ChartUpdateType3.PERFORM_LAYOUT, { skipAnimations: true }); + } + onAxisDragEnd() { + const { + axisDraggingMode, + axisDragger, + dragState, + domProxy, + enabled, + enableAxisDragging, + ctx: { domManager, interactionManager, tooltipManager } + } = this; + interactionManager.popState(_ModuleSupport169.InteractionState.ZoomDrag); + if (!enabled || !enableAxisDragging || dragState === 0 /* None */) + return; + this.dragState = 0 /* None */; + if (axisDraggingMode === "pan") { + domProxy.setAxisCursor("grab"); + this.panner.stop(); + } + axisDragger.stop(); + domManager.updateCursor(CURSOR_ID); + tooltipManager.removeTooltip(TOOLTIP_ID); + } + onNavZoom(event) { + const { enabled, enableScrolling, scroller } = this; + const isDefaultState = this.ctx.interactionManager.isState(_ModuleSupport169.InteractionState.Default); + if (!isDefaultState || !enabled || !enableScrolling) + return; + event.widgetEvent.sourceEvent.preventDefault(); + this.updateZoom(scroller.updateDelta(event.delta, this.getModuleProperties(), this.getZoom())); + } + onWheel(event) { + const { enabled, enablePanning, enableScrolling, paddedRect } = this; + if (!enabled || !enableScrolling || !paddedRect || !this.isState(InteractionState5.ZoomWheelable)) + return; + const { deltaX, deltaY } = event.sourceEvent; + const isHorizontalScrolling = deltaX != null && deltaY != null && Math.abs(deltaX) > Math.abs(deltaY); + if (enablePanning && isHorizontalScrolling) { + this.onWheelPanning(event); + } else { + this.onWheelScrolling(event); + } + } + onWheelPanning(event) { + const { + scrollingStep, + scrollPanner, + seriesRect, + ctx: { zoomManager } + } = this; + if (!seriesRect) + return; + event.sourceEvent.preventDefault(); + const newZooms = scrollPanner.update(event, scrollingStep, seriesRect, zoomManager.getAxisZooms()); + for (const [axisId, { direction, zoom }] of entries10(newZooms)) { + this.updateAxisZoom(axisId, direction, zoom); + } + } + onWheelScrolling(event) { + const zoom = this.getZoom(); + const isZoomCapped = event.deltaY > 0 && isMaxZoom(zoom); + this.handleWheelScrolling(event, isZoomCapped); + } + onAxisWheel(axisId, axisDirection, event) { + const { + enableAxisScrolling, + ctx: { zoomManager } + } = this; + if (!enableAxisScrolling) + return; + if (axisDirection !== ChartAxisDirection23.X && axisDirection !== ChartAxisDirection23.Y) { + return; + } + const isScalingX = axisDirection === ChartAxisDirection23.X; + const isScalingY = !isScalingX; + const props = this.getModuleProperties({ isScalingX, isScalingY }); + const zoom = this.getZoom(); + const isZoomCapped = event.deltaY > 0 && zoom[axisDirection].min === UNIT_MIN && zoom[axisDirection].max === UNIT_MAX; + zoomManager.setAxisManuallyAdjusted("zoom", axisId); + this.handleWheelScrolling(event, isZoomCapped, props); + } + handleWheelScrolling(event, isZoomCapped, props = this.getModuleProperties()) { + const { + enableIndependentAxes, + scroller, + seriesRect, + ctx: { zoomManager } + } = this; + if (!seriesRect) + return; + let updated = true; + if (enableIndependentAxes === true) { + const newZooms = scroller.updateAxes(event, props, seriesRect, zoomManager.getAxisZooms()); + for (const [axisId, { direction, zoom: axisZoom }] of entries10(newZooms)) { + const constrainedZoom = direction === ChartAxisDirection23.X ? this.constrainZoom({ x: axisZoom, y: { min: UNIT_MAX, max: UNIT_MAX } }).x : axisZoom; + updated && (updated = this.updateAxisZoom( + axisId, + direction, + constrainedZoom + )); + } + } else { + const newZoom = scroller.update(event, props, seriesRect, this.getZoom()); + if (newZoom == null) + return; + updated = this.updateUnifiedZoom(newZoom, { directional: true }); + } + isZoomCapped || (isZoomCapped = event.deltaY < 0 && !updated); + if (this.firstWheelEventDirection != null && this.firstWheelEventDirection !== event.deltaY < 0) { + this.isFirstWheelEvent = true; + } + if (this.isFirstWheelEvent) { + this.wasFirstWheelEventZoomCapped = isZoomCapped; + this.firstWheelEventDirection = event.deltaY < 0; + if (!isZoomCapped) { + event.sourceEvent.preventDefault(); + } + } else if (this.wasFirstWheelEventZoomCapped === false) { + event.sourceEvent.preventDefault(); + } + this.isFirstWheelEvent = false; + this.debouncedWheelReset(); + } + onTouchStart(event, current) { + if (!this.enableTwoFingerZoom || this.dragState !== 0 /* None */) + return; + if (this.twoFingers.start(event, current, this.getZoom())) { + this.dragState = 4 /* TwoFingers */; + } + } + onTouchMove(event, current) { + if (!this.enableTwoFingerZoom || this.dragState !== 4 /* TwoFingers */) + return; + const newZoom = this.twoFingers.update(event, current); + this.updateZoom(constrainZoom(newZoom)); + } + onTouchEnd(event) { + if (!this.enableTwoFingerZoom || this.dragState !== 4 /* TwoFingers */) + return; + event.sourceEvent.preventDefault(); + if (this.twoFingers.end(event)) { + this.dragState = 0 /* None */; + } + } + onProcessData(event) { + this.shouldFlipXY = event.series.shouldFlipXY; + } + onLayoutComplete(event) { + this.domProxy.update(this.enableAxisDragging, this.enableAxisScrolling, this.ctx, event.series.rect); + if (!this.enabled) + return; + this.seriesRect = event.series.rect; + this.paddedRect = event.series.paddedRect; + if (this.enableAxisDragging) { + this.toggleAxisDraggingCursorsDebounced(); + } + } + onZoomChange(event) { + if (event.callerId !== "zoom") { + this.panner.stopInteractions(); + } + const zoom = this.getZoom(); + this.buttons.toggleVisibleZoomed(isMaxZoom(zoom)); + } + onZoomPanStart(event) { + if (event.callerId === "zoom") { + this.panner.stopInteractions(); + } + } + onPanUpdate(event) { + const { + panner, + seriesRect, + ctx: { tooltipManager, zoomManager } + } = this; + if (!seriesRect) + return; + const newZooms = panner.translateZooms(seriesRect, zoomManager.getAxisZooms(), event.deltaX, event.deltaY); + for (const [axisId, { direction, zoom }] of entries10(newZooms)) { + this.updateAxisZoom(axisId, direction, zoom); + } + tooltipManager.updateTooltip(TOOLTIP_ID); + } + isPanningKeyPressed(event) { + switch (this.panKey) { + case "alt": + return event.altKey; + case "ctrl": + return event.ctrlKey; + case "shift": + return event.shiftKey; + case "meta": + return event.metaKey; + } + } + isScalingX() { + if (this.axes === "xy") + return true; + return this.shouldFlipXY ? this.axes === "y" : this.axes === "x"; + } + isScalingY() { + if (this.axes === "xy") + return true; + return this.shouldFlipXY ? this.axes === "x" : this.axes === "y"; + } + getAnchorPointX() { + return this.shouldFlipXY ? this.anchorPointY : this.anchorPointX; + } + getAnchorPointY() { + return this.shouldFlipXY ? this.anchorPointX : this.anchorPointY; + } + constrainZoom(newZoom) { + const { + minVisibleItems, + ctx: { zoomManager } + } = this; + if (minVisibleItems === 0) + return newZoom; + const constrainedZoom = zoomManager.constrainZoomToItemCount(newZoom, minVisibleItems); + return constrainedZoom ?? newZoom; + } + isZoomValid(newZoom, options) { + const { + minVisibleItems, + ctx: { zoomManager } + } = this; + if (minVisibleItems === 0) { + this.previousZoomValid = true; + return true; + } + const zoom = this.getZoom(); + const zoomedInX = round(dx(newZoom)) < round(dx(zoom)); + const zoomedInY = round(dy(newZoom)) < round(dy(zoom)); + if (!zoomedInX && !zoomedInY) { + this.previousZoomValid = true; + return true; + } + if (!this.previousZoomValid && options?.directional) { + return false; + } + const valid = zoomManager.isVisibleItemsCountAtLeast(newZoom, minVisibleItems, options?.includeYVisibleRange); + this.previousZoomValid = options?.directional ? valid : true; + return valid; + } + isAxisZoomValid(direction, axisZoom, options) { + const { + minVisibleItems, + ctx: { zoomManager } + } = this; + const zoom = this.getZoom(); + const deltaAxis = axisZoom.max - axisZoom.min; + const deltaOld = zoom[direction].max - zoom[direction].min; + const newZoom = { ...zoom, [direction]: axisZoom }; + if (deltaAxis >= deltaOld) { + this.previousAxisZoomValid[direction] = true; + return true; + } + if (!this.previousAxisZoomValid[direction] && options?.directional) { + return false; + } + const valid = zoomManager.isVisibleItemsCountAtLeast(newZoom, minVisibleItems); + this.previousAxisZoomValid[direction] = options?.directional ? valid : true; + return valid; + } + resetZoom() { + this.previousZoomValid = true; + this.previousAxisZoomValid = { [ChartAxisDirection23.X]: true, [ChartAxisDirection23.Y]: true }; + this.ctx.zoomManager.resetZoom("zoom"); + } + updateSyncZoom(zoom) { + this.updateZoom(zoom); + } + updateZoom(zoom) { + if (this.enableIndependentAxes) { + this.updatePrimaryAxisZooms(zoom); + } else { + this.updateUnifiedZoom(zoom); + } + } + updateUnifiedZoom(zoom, validOptions) { + zoom = this.constrainZoom(zoom); + if (!this.isZoomValid(zoom, validOptions)) { + this.ctx.updateService.update(ChartUpdateType3.SCENE_RENDER, { skipAnimations: true }); + return false; + } + this.ctx.zoomManager.updateZoom("zoom", zoom); + return true; + } + updatePrimaryAxisZooms(zoom) { + this.updatePrimaryAxisZoom(zoom, ChartAxisDirection23.X); + this.updatePrimaryAxisZoom(zoom, ChartAxisDirection23.Y); + } + updatePrimaryAxisZoom(zoom, direction) { + const axisId = this.ctx.zoomManager.getPrimaryAxisId(direction); + if (axisId == null) + return; + this.updateAxisZoom(axisId, direction, zoom[direction]); + } + updateAxisZoom(axisId, direction, axisZoom, validOptions) { + const { + enableIndependentAxes, + ctx: { zoomManager } + } = this; + if (!axisZoom) + return false; + const zoom = this.getZoom(); + if (enableIndependentAxes !== true) { + zoom[direction] = axisZoom; + return this.updateUnifiedZoom(zoom, validOptions); + } + if (!this.isAxisZoomValid(direction, axisZoom, validOptions)) + return false; + zoomManager.updateAxisZoom("zoom", axisId, axisZoom); + return true; + } + updateAxisCursor(opts) { + if (!this.domProxy) + return; + const { + enableAxisDragging = this.enableAxisDragging, + enableAxisScrolling = this.enableAxisScrolling, + axisDraggingMode = this.axisDraggingMode + } = opts; + if (enableAxisDragging) { + this.domProxy.setAxisCursor(axisDraggingMode === "pan" ? "grab" : void 0); + } else if (enableAxisScrolling) { + this.domProxy.setAxisCursor("default"); + } else { + this.domProxy.setAxisCursor(void 0); + } + } + toggleAxisDraggingCursors() { + const { anchorPointX, anchorPointY, domProxy } = this; + const zoom = this.getZoom(); + let showCursorX = dx(zoom) !== UNIT_SIZE; + let showCursorY = dy(zoom) !== UNIT_SIZE; + if (!showCursorX) { + const checkZoomX = scaleZoom(zoom, 0.999, 1); + checkZoomX.x = scaleZoomAxisWithAnchor(checkZoomX.x, zoom.x, anchorPointX); + showCursorX = this.isZoomValid(checkZoomX, { includeYVisibleRange: true }); + } + if (!showCursorY) { + const checkZoomY = scaleZoom(zoom, 1, 0.999); + checkZoomY.y = scaleZoomAxisWithAnchor(checkZoomY.y, zoom.y, anchorPointY); + showCursorY = this.isZoomValid(checkZoomY, { includeYVisibleRange: true }); + } + domProxy.toggleAxisDraggingCursor(ChartAxisDirection23.X, showCursorX); + domProxy.toggleAxisDraggingCursor(ChartAxisDirection23.Y, showCursorY); + } + getZoom() { + return definedZoomState(this.ctx.zoomManager.getZoom()); + } + getResetZoom() { + return definedZoomState(this.ctx.zoomManager.getRestoredZoom()); + } + getModuleProperties(overrides) { + return { + anchorPointX: overrides?.anchorPointX ?? this.getAnchorPointX(), + anchorPointY: overrides?.anchorPointY ?? this.getAnchorPointY(), + enabled: overrides?.enabled ?? this.enabled, + independentAxes: overrides?.independentAxes ?? this.enableIndependentAxes === true, + isScalingX: overrides?.isScalingX ?? this.isScalingX(), + isScalingY: overrides?.isScalingY ?? this.isScalingY(), + keepAspectRatio: overrides?.keepAspectRatio ?? this.keepAspectRatio, + scrollingStep: overrides?.scrollingStep ?? this.scrollingStep + }; + } +}; +__decorateClass([ + ActionOnSet9({ + newValue(enabled) { + this.onEnabledChange(enabled); + } + }), + Property62 +], Zoom.prototype, "enabled", 2); +__decorateClass([ + ActionOnSet9({ + changeValue(newValue) { + this.updateAxisCursor({ enableAxisDragging: newValue }); + } + }), + Property62 +], Zoom.prototype, "enableAxisDragging", 2); +__decorateClass([ + ActionOnSet9({ + changeValue(newValue) { + this.updateAxisCursor({ enableAxisScrolling: newValue }); + } + }), + Property62 +], Zoom.prototype, "enableAxisScrolling", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "enableDoubleClickToReset", 2); +__decorateClass([ + ActionOnSet9({ + changeValue(newValue) { + this.ctx.zoomManager.setIndependentAxes(Boolean(newValue)); + } + }), + Property62 +], Zoom.prototype, "enableIndependentAxes", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "enablePanning", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "enableScrolling", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "enableSelecting", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "enableTwoFingerZoom", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "panKey", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "axes", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "scrollingStep", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "keepAspectRatio", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "minVisibleItems", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "anchorPointX", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "anchorPointY", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "autoScaling", 2); +__decorateClass([ + ActionOnSet9({ + changeValue(newValue) { + this.updateAxisCursor({ axisDraggingMode: newValue }); + } + }), + Property62 +], Zoom.prototype, "axisDraggingMode", 2); +__decorateClass([ + Property62 +], Zoom.prototype, "buttons", 2); +__decorateClass([ + ProxyProperty3("panner.deceleration"), + Property62 +], Zoom.prototype, "deceleration", 2); + +// packages/ag-charts-enterprise/src/features/zoom/zoomModule.ts +var buttons = { + enabled: true, + visible: "hover", + buttons: [ + { + icon: "zoom-out", + value: "zoom-out", + section: "scale" + }, + { + icon: "zoom-in", + value: "zoom-in", + section: "scale" + }, + { + icon: "pan-left", + value: "pan-left", + section: "pan" + }, + { + icon: "pan-right", + value: "pan-right", + section: "pan" + }, + { + icon: "reset", + value: "reset", + section: "reset" + } + ] +}; +var ZoomModule = { + type: "root", + optionsKey: "zoom", + packageType: "enterprise", + chartTypes: ["cartesian", "topology"], + moduleFactory: (ctx) => new Zoom(ctx), + themeTemplate: { + zoom: { + anchorPointX: "end", + anchorPointY: "middle", + axes: "x", + buttons, + enabled: false, + enableAxisDragging: true, + enableDoubleClickToReset: true, + enablePanning: true, + enableScrolling: true, + enableSelecting: false, + enableTwoFingerZoom: true, + deceleration: "short", + minVisibleItems: 2, + panKey: "alt", + scrollingStep: 0.1, + autoScaling: { + enabled: { $eq: [{ $path: "../axes" }, "x"] }, + padding: 0.05 + } + } + } +}; + +// packages/ag-charts-enterprise/src/gradient-legend/gradientLegendModule.ts +import { _ModuleSupport as _ModuleSupport173 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/gradient-legend/gradientLegend.ts +import { + _ModuleSupport as _ModuleSupport172 +} from "ag-charts-community"; +import { CleanupRegistry as CleanupRegistry4, createId as createId6 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/gradient-legend/axisTicks.ts +import { _ModuleSupport as _ModuleSupport171 } from "ag-charts-community"; +import { + cachedTextMeasurer as cachedTextMeasurer4, + countFractionDigits as countFractionDigits2, + createId as createId5, + isArray, + measureTextSegments, + toPlainText as toPlainText4 +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/utils/formatter.ts +import { _ModuleSupport as _ModuleSupport170 } from "ag-charts-community"; +function formatWithContext(ctx, formatter, params) { + return _ModuleSupport170.callWithContext(ctx.chartService, formatter, params); +} + +// packages/ag-charts-enterprise/src/gradient-legend/axisTicks.ts +var { + AxisInterval: AxisInterval2, + AxisLabel: AxisLabel2, + ZIndexMap: ZIndexMap9, + LinearScale: LinearScale3, + BBox: BBox14, + TranslatableGroup: TranslatableGroup4, + Selection: Selection4, + Text: Text2, + createIdsGenerator, + findMinMax: findMinMax5, + findRangeExtent, + estimateTickCount +} = _ModuleSupport171; +var _AxisTicks = class _AxisTicks { + constructor(ctx, dataProvider) { + this.ctx = ctx; + this.dataProvider = dataProvider; + this.id = createId5(this); + this.axisGroup = new TranslatableGroup4({ name: `${this.id}-AxisTicks`, zIndex: ZIndexMap9.AXIS }); + this.labelSelection = Selection4.select(this.axisGroup, Text2); + this.interval = new AxisInterval2(); + this.label = new AxisLabel2(); + this.scale = new LinearScale3(); + this.placement = "bottom"; + this.translationX = 0; + this.translationY = 0; + this.padding = 0; + } + get horizontal() { + return this.placement.startsWith("top") || this.placement.startsWith("bottom"); + } + attachAxis(axisNode) { + axisNode.appendChild(this.axisGroup); + } + calculateLayout() { + const { placement, translationX, translationY, horizontal, label } = this; + function unreachable(_a) { + return void 0; + } + let textBaseline; + let textAlign; + switch (placement) { + case "top": + case "top-right": + case "top-left": + textBaseline = "bottom"; + textAlign = "center"; + label.mirrored = false; + label.parallel = true; + break; + case "bottom": + case "bottom-right": + case "bottom-left": + textBaseline = "top"; + textAlign = "center"; + label.mirrored = false; + label.parallel = true; + break; + case "right": + case "right-top": + case "right-bottom": + case "left": + case "left-top": + case "left-bottom": + textBaseline = "middle"; + textAlign = "left"; + label.mirrored = true; + label.parallel = false; + break; + default: + unreachable(placement); + } + const boxes = []; + const tickGenerationResult = this.generateTicks(); + const { ticks } = tickGenerationResult; + this.labelSelection.update(ticks, void 0, (datum) => datum.tickId); + this.axisGroup.setProperties({ translationX, translationY }); + this.labelSelection.each((node, datum) => { + node.fontFamily = label.fontFamily; + node.fontSize = label.fontSize; + node.fontStyle = label.fontStyle; + node.fontWeight = label.fontWeight; + node.fill = label.color; + node.textBaseline = textBaseline; + node.textAlign = textAlign; + node.text = datum.tickLabel; + node.x = horizontal ? datum.translation : 0; + node.y = horizontal ? 0 : datum.translation; + boxes.push(node.getBBox()); + }); + return boxes.length > 0 ? BBox14.merge(boxes).translate(translationX, translationY) : void 0; + } + tickFormatter(domain, _ticks, _primary, fractionDigits) { + const { ctx } = this; + const { formatManager } = ctx; + const boundSeries = this.dataProvider.data.flatMap((d) => d.series); + return (value, index) => { + const formatParams = { + type: "number", + value, + datum: void 0, + seriesId: void 0, + legendItemName: void 0, + key: void 0, + source: "gradient-legend", + property: "color", + domain, + boundSeries, + fractionDigits + }; + return this.label.formatValue((fn, params) => formatWithContext(ctx, fn, params), formatParams, index) ?? formatManager.format((fn, params) => formatWithContext(ctx, fn, params), formatParams) ?? formatManager.defaultFormat(formatParams); + }; + } + inRange(x, tolerance = 1e-3) { + const [min, max] = findMinMax5(this.scale.range); + return x >= min - tolerance && x <= max + tolerance; + } + generateTicks() { + const { minSpacing, maxSpacing } = this.interval; + const { maxTickCount, minTickCount, tickCount } = estimateTickCount( + findRangeExtent(this.scale.range), + 1, + minSpacing, + maxSpacing, + _AxisTicks.DefaultTickCount, + _AxisTicks.DefaultMinSpacing + ); + const tickData = this.getTicksData({ + nice: true, + interval: this.interval.step, + tickCount, + minTickCount, + maxTickCount + }); + if (this.placement === "bottom" || this.placement === "top") { + const measurer2 = cachedTextMeasurer4(this.label); + const { domain } = this.scale; + const reversed = domain[0] > domain[1]; + const direction = reversed ? -1 : 1; + let lastTickPosition = -Infinity * direction; + tickData.ticks = tickData.ticks.filter((data) => { + if (Math.sign(data.translation - lastTickPosition) !== direction) + return false; + const { width: labelWidth } = isArray(data.tickLabel) ? measureTextSegments(data.tickLabel, this.label) : measurer2.measureLines(data.tickLabel); + lastTickPosition = data.translation + labelWidth * direction; + return true; + }); + } + return tickData; + } + getTicksData(tickParams) { + const ticks = []; + const domain = tickParams.nice ? this.scale.niceDomain(tickParams) : this.scale.domain; + const rawTicks = this.scale.ticks(tickParams, domain)?.ticks ?? []; + const fractionDigits = rawTicks.reduce((max, tick) => Math.max(max, countFractionDigits2(tick)), 0); + const idGenerator = createIdsGenerator(); + const tickFormatter = this.tickFormatter(domain, rawTicks, false, fractionDigits); + for (let index = 0; index < rawTicks.length; index++) { + const tick = rawTicks[index]; + const translation = this.scale.convert(tick); + if (!this.inRange(translation)) + continue; + const tickLabel = tickFormatter(tick, index); + if (tickLabel == null || tickLabel === "") + continue; + const tickId = idGenerator(toPlainText4(tickLabel)); + ticks.push({ tick, tickId, tickLabel, translation }); + } + return { rawTicks, fractionDigits, ticks }; + } +}; +_AxisTicks.DefaultTickCount = 5; +_AxisTicks.DefaultMinSpacing = 10; +var AxisTicks = _AxisTicks; + +// packages/ag-charts-enterprise/src/gradient-legend/gradientLegend.ts +var { + BaseProperties: BaseProperties23, + ZIndexMap: ZIndexMap10, + ProxyProperty: ProxyProperty4, + Property: Property63, + LayoutElement: LayoutElement5, + Group: Group8, + Rect: Rect5, + Marker: Marker2, + TranslatableGroup: TranslatableGroup5, + BBox: BBox15, + expandLegendPosition +} = _ModuleSupport172; +var GradientBar = class extends BaseProperties23 { + constructor() { + super(...arguments); + this.thickness = 16; + this.preferredLength = 100; + } +}; +__decorateClass([ + Property63 +], GradientBar.prototype, "thickness", 2); +__decorateClass([ + Property63 +], GradientBar.prototype, "preferredLength", 2); +var GradientLegendScale = class extends _ModuleSupport172.BaseProperties { + constructor(axisTicks) { + super(); + this.axisTicks = axisTicks; + } +}; +__decorateClass([ + ProxyProperty4("axisTicks.label") +], GradientLegendScale.prototype, "label", 2); +__decorateClass([ + ProxyProperty4("axisTicks.interval") +], GradientLegendScale.prototype, "interval", 2); +__decorateClass([ + ProxyProperty4("axisTicks.padding") +], GradientLegendScale.prototype, "padding", 2); +var GradientLegend = class extends _ModuleSupport172.BaseProperties { + constructor(ctx) { + super(); + this.ctx = ctx; + this.id = createId6(this); + this.legendGroup = new TranslatableGroup5({ name: "legend", zIndex: ZIndexMap10.LEGEND }); + this.containerNode = this.legendGroup.appendChild(new Rect5({ name: "legend-container" })); + this.gradientRect = new Rect5(); + this.arrow = new Marker2({ shape: "triangle" }); + this.ticksGroup = new Group8({ name: "legend-axis-group" }); + this.cleanup = new CleanupRegistry4(); + this.enabled = false; + this.position = "bottom"; + this.reverseOrder = false; + this.gradient = new GradientBar(); + this.spacing = 20; + this.border = new _ModuleSupport172.Border(this.containerNode); + this.cornerRadius = 0; + this.fillOpacity = 1; + this.padding = 4; + this.data = []; + this.highlightManager = ctx.highlightManager; + this.axisTicks = new AxisTicks(ctx, this); + this.axisTicks.attachAxis(this.ticksGroup); + this.scale = new GradientLegendScale(this.axisTicks); + this.legendGroup.append([this.gradientRect, this.arrow, this.ticksGroup]); + this.cleanup.register( + ctx.eventsHub.on("highlight:change", () => this.onChartHoverChange()), + ctx.layoutManager.registerElement(LayoutElement5.Legend, (e) => this.onStartLayout(e)), + () => this.legendGroup.remove() + ); + } + isVertical() { + const { placement } = expandLegendPosition(this.position); + return placement.startsWith("right") || placement.startsWith("left"); + } + destroy() { + this.cleanup.flush(); + } + attachLegend(scene) { + scene.appendChild(this.legendGroup); + } + onStartLayout(ctx) { + const [data] = this.data; + if (!this.enabled || !data?.enabled || data.legendType !== "gradient") { + this.legendGroup.visible = false; + return; + } + const { colorRange } = this.normalizeColorArrays(data); + const gradientRectBBox = this.updateGradientRect(ctx.layoutBox, colorRange); + const axisBBox = this.updateAxis(data, gradientRectBBox) ?? new BBox15(0, 0, 0, 0); + const legendBBox = BBox15.merge([gradientRectBBox, axisBBox]); + const { strokeWidth, padding } = this.getContainerStyles(); + legendBBox.grow(padding).grow(strokeWidth); + const { left, top } = this.getMeasurements(ctx.layoutBox, legendBBox); + this.updateContainer(legendBBox); + this.updateArrow(); + this.legendGroup.visible = true; + this.legendGroup.translationX = left; + this.legendGroup.translationY = top; + } + normalizeColorArrays(data) { + let colorDomain = data.colorDomain.slice(); + const colorRange = data.colorRange.slice(); + if (colorDomain.length === colorRange.length) { + return { colorDomain, colorRange }; + } + if (colorDomain.length > colorRange.length) { + colorRange.splice(colorDomain.length); + } + const [d0, d1] = colorDomain; + const count = colorRange.length; + colorDomain = colorRange.map((_, i) => { + if (i === 0) { + return d0; + } else if (i === count - 1) { + return d1; + } + return d0 + (d1 - d0) * i / (count - 1); + }); + return { colorDomain, colorRange }; + } + updateGradientRect(shrinkRect, colorRange) { + const { gradientRect, gradient } = this; + const { preferredLength, thickness } = gradient; + const gradientRectBBox = new BBox15(0, 0, 0, 0); + let angle; + if (this.isVertical()) { + angle = 0; + gradientRectBBox.width = thickness; + gradientRectBBox.height = Math.min(shrinkRect.height, preferredLength); + } else { + angle = 90; + gradientRectBBox.width = Math.min(shrinkRect.width, preferredLength); + gradientRectBBox.height = thickness; + } + gradientRect.x = gradientRectBBox.x; + gradientRect.y = gradientRectBBox.y; + gradientRect.width = gradientRectBBox.width; + gradientRect.height = gradientRectBBox.height; + gradientRect.fill = { + type: "gradient", + gradient: "linear", + colorSpace: "oklch", + colorStops: colorRange.map((color6, i) => ({ + stop: i / (colorRange.length - 1), + color: color6 + })), + rotation: angle + }; + return gradientRectBBox; + } + updateAxis(data, gradientRectBBox) { + const { axisTicks, gradient, scale } = this; + const { placement } = expandLegendPosition(this.position); + const vertical = this.isVertical(); + const positiveAxis = this.reverseOrder !== vertical; + axisTicks.placement = placement; + const offset = gradient.thickness + (scale.padding ?? 0); + axisTicks.translationX = vertical ? offset : gradientRectBBox.x; + axisTicks.translationY = vertical ? gradientRectBBox.y : offset; + axisTicks.scale.domain = positiveAxis ? data.colorDomain.slice().reverse() : data.colorDomain; + axisTicks.scale.range = vertical ? [gradientRectBBox.x, gradientRectBBox.height] : [gradientRectBBox.y, gradientRectBBox.width]; + return axisTicks.calculateLayout(); + } + updateContainer(bbox) { + const containerStyles = this.getContainerStyles(); + _ModuleSupport172.applyShapeStyle(this.containerNode, containerStyles); + this.containerNode.cornerRadius = containerStyles.cornerRadius; + this.containerNode.x = bbox.x; + this.containerNode.y = bbox.y; + this.containerNode.width = bbox.width; + this.containerNode.height = bbox.height; + } + updateArrow() { + const highlighted = this.highlightManager.getActiveHighlight(); + const { arrow } = this; + if (highlighted?.colorValue == null) { + arrow.visible = false; + return; + } + const { scale, label } = this.axisTicks; + const size = label.fontSize ?? 0; + const t = scale.convert(highlighted.colorValue); + let { x, y } = this.gradientRect; + let rotation = Math.PI; + if (this.isVertical()) { + x -= size / 2; + y += t; + rotation /= 2; + } else { + x += t; + y -= size / 2; + } + arrow.visible = true; + arrow.fill = label.color; + arrow.rotation = rotation; + arrow.size = size; + arrow.translationX = x; + arrow.translationY = y; + } + getMeasurements(shrinkRect, legendBBox) { + function unreachable(_a) { + return void 0; + } + let { x: left, y: top } = shrinkRect; + const { width, height } = legendBBox; + const { placement, floating, xOffset, yOffset } = expandLegendPosition(this.position); + const containerStyles = this.getContainerStyles(); + left += containerStyles.strokeWidth + containerStyles.padding.left; + top += containerStyles.strokeWidth + containerStyles.padding.top; + switch (placement) { + case "left": + top += shrinkRect.height / 2 - height / 2; + break; + case "right": + left += shrinkRect.width - width; + top += shrinkRect.height / 2 - height / 2; + break; + case "top": + left += shrinkRect.width / 2 - width / 2; + break; + case "bottom": + left += shrinkRect.width / 2 - width / 2; + top += shrinkRect.height - height; + break; + case "right-top": + case "top-right": + left += shrinkRect.width - width; + break; + case "right-bottom": + case "bottom-right": + left += shrinkRect.width - width; + top += shrinkRect.height - height; + break; + case "left-bottom": + case "bottom-left": + top += shrinkRect.height - height; + break; + case "left-top": + case "top-left": + break; + default: + unreachable(placement); + } + if (!floating) { + switch (placement) { + case "left": + case "left-top": + case "left-bottom": + shrinkRect.shrink(width + this.spacing, "left"); + break; + case "right": + case "right-top": + case "right-bottom": + shrinkRect.shrink(width + this.spacing, "right"); + break; + case "top": + case "top-left": + case "top-right": + shrinkRect.shrink(height + this.spacing, "top"); + break; + case "bottom": + case "bottom-left": + case "bottom-right": + shrinkRect.shrink(height + this.spacing, "bottom"); + break; + default: + unreachable(placement); + } + } + left += xOffset; + top += yOffset; + return { top, left }; + } + getContainerStyles() { + const { stroke: stroke2, strokeOpacity, strokeWidth } = this.border; + const { cornerRadius, fill, fillOpacity, padding } = this; + const isPaddingNumber = typeof padding === "number"; + return { + cornerRadius, + fill, + fillOpacity, + padding: { + top: isPaddingNumber ? padding : padding.top ?? 0, + right: isPaddingNumber ? padding : padding.right ?? 0, + bottom: isPaddingNumber ? padding : padding.bottom ?? 0, + left: isPaddingNumber ? padding : padding.left ?? 0 + }, + stroke: stroke2, + strokeOpacity, + strokeWidth: this.border.enabled ? strokeWidth : 0 + }; + } + onChartHoverChange() { + if (!this.enabled) + return; + this.updateArrow(); + } +}; +GradientLegend.className = "GradientLegend"; +__decorateClass([ + Property63 +], GradientLegend.prototype, "enabled", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "position", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "reverseOrder", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "gradient", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "spacing", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "border", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "cornerRadius", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "fill", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "fillOpacity", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "padding", 2); +__decorateClass([ + Property63 +], GradientLegend.prototype, "scale", 2); + +// packages/ag-charts-enterprise/src/gradient-legend/gradientLegendModule.ts +var GradientLegendModule = { + type: "legend", + optionsKey: "gradientLegend", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + identifier: "gradient", + moduleFactory: (ctx) => new GradientLegend(ctx), + themeTemplate: { + enabled: false, + position: "bottom", + spacing: 20, + scale: { + padding: 13, + label: { + color: { $ref: "textColor" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + minSpacing: 5 + }, + interval: { + minSpacing: 15 + } + }, + gradient: { + preferredLength: 100, + thickness: 16 + }, + reverseOrder: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $ref: "chartBackgroundColour" }, + ["gradient", _ModuleSupport173.FILL_GRADIENT_BLANK_DEFAULTS], + ["pattern", _ModuleSupport173.FILL_PATTERN_BLANK_DEFAULTS], + ["image", _ModuleSupport173.FILL_IMAGE_BLANK_DEFAULTS] + ] + } + }, + removable: "standalone-only" +}; + +// packages/ag-charts-enterprise/src/license/watermark.ts +import { createElement as createElement6 } from "ag-charts-core"; +function injectWatermark(domManager, text2) { + const element = domManager.addChild("canvas-overlay", "watermark"); + const textElement = createElement6("span"); + textElement.innerText = text2; + element.addEventListener("animationend", () => { + domManager.removeChild("canvas-overlay", "watermark"); + domManager.removeStyles("watermark"); + }); + element.classList.add("ag-watermark"); + element.appendChild(textElement); +} + +// packages/ag-charts-enterprise/src/main-modules.ts +import { _ModuleSupport as _ModuleSupport280 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/axes/axisModules.ts +import { _ModuleSupport as _ModuleSupport174 } from "ag-charts-community"; +var { + ordinalTimeAxisOptionsDefs, + angleNumberAxisOptionsDefs, + angleCategoryAxisOptionsDefs, + radiusNumberAxisOptionsDefs, + radiusCategoryAxisOptionsDefs +} = _ModuleSupport174; +var OrdinalTimeAxisModule2 = { + type: "axis", + name: "ordinal-time", + chartType: "cartesian", + enterprise: true, + options: ordinalTimeAxisOptionsDefs, + create: (ctx) => new OrdinalTimeAxis(ctx) +}; +var AngleNumberAxisModule2 = { + type: "axis", + name: "angle-number", + chartType: "polar", + enterprise: true, + options: angleNumberAxisOptionsDefs, + create: (ctx) => new AngleNumberAxis(ctx) +}; +var AngleCategoryAxisModule2 = { + type: "axis", + name: "angle-category", + chartType: "polar", + enterprise: true, + options: angleCategoryAxisOptionsDefs, + create: (ctx) => new AngleCategoryAxis(ctx) +}; +var RadiusNumberAxisModule2 = { + type: "axis", + name: "radius-number", + chartType: "polar", + enterprise: true, + options: radiusNumberAxisOptionsDefs, + create: (ctx) => new RadiusNumberAxis(ctx) +}; +var RadiusCategoryAxisModule2 = { + type: "axis", + name: "radius-category", + chartType: "polar", + enterprise: true, + options: radiusCategoryAxisOptionsDefs, + create: (ctx) => new RadiusCategoryAxis(ctx) +}; + +// packages/ag-charts-enterprise/src/charts/standaloneChartModule.ts +import { _ModuleSupport as _ModuleSupport176 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/charts/standaloneChart.ts +import { _ModuleSupport as _ModuleSupport175 } from "ag-charts-community"; +var { Chart } = _ModuleSupport175; +var StandaloneChart = class extends Chart { + getChartType() { + return "standalone"; + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(seriesRect.x); + group.translationY = Math.floor(seriesRect.y); + } + seriesRoot.visible = this.series[0].visible; + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: true, rect: seriesRect, paddedRect: layoutBox } + }); + } + getAriaLabel() { + const seriesType = this.series[0]?.type; + if (seriesType == null) + return ""; + const caption = this.getCaptionText(); + switch (seriesType) { + case "radial-gauge": + case "linear-gauge": { + const captions = []; + if (caption.length !== 0) { + captions.push(caption); + } + for (const series of this.series) { + captions.push(series.getCaptionText()); + } + return this.ctx.localeManager.t("ariaAnnounceGaugeChart", { caption: captions.join(". ") }); + } + case "treemap": + case "sunburst": + return this.ctx.localeManager.t("ariaAnnounceHierarchyChart", { caption }); + default: { + return this.ctx.localeManager.t("ariaAnnounceStandaloneChart", { caption }); + } + } + } +}; +StandaloneChart.className = "StandaloneChart"; +StandaloneChart.type = "standalone"; + +// packages/ag-charts-enterprise/src/charts/standaloneChartModule.ts +var { isAgStandaloneChartOptions, standaloneChartOptionsDefs } = _ModuleSupport176; +var StandaloneChartModule = { + type: "chart", + name: "standalone", + enterprise: true, + options: standaloneChartOptionsDefs, + detect: isAgStandaloneChartOptions, + create(options, resources) { + return new StandaloneChart(options, resources); + } +}; + +// packages/ag-charts-enterprise/src/charts/topologyChartModule.ts +import { _ModuleSupport as _ModuleSupport178 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/charts/topologyChart.ts +import { _ModuleSupport as _ModuleSupport177 } from "ag-charts-community"; +var { Chart: Chart2, MercatorScale, ChartAxisDirection: ChartAxisDirection24, Property: Property64 } = _ModuleSupport177; +function isTopologySeries(series) { + return series.type === "map-shape" || series.type === "map-line" || series.type === "map-marker" || series.type === "map-shape-background" || series.type === "map-line-background"; +} +var TopologyChart = class extends Chart2 { + constructor(options, resources) { + super(options, resources); + this.ctx.zoomManager.updateAxes([ChartAxisDirection24.X, ChartAxisDirection24.Y]); + } + getChartType() { + return "topology"; + } + async updateData() { + await super.updateData(); + const options = this.getOptions(); + if (this.topology !== options.topology) { + this.topology = options.topology; + } + const { topology } = this; + for (const series of this.series) { + if (isTopologySeries(series)) { + series.setChartTopology(topology); + } + } + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + const mapSeries = this.series.filter(isTopologySeries); + const combinedBbox = mapSeries.reduce((combined, series) => { + if (!series.visible) + return combined; + const bbox = series.topologyBounds; + if (bbox == null) + return combined; + if (combined == null) + return bbox; + return combined.merge(bbox); + }, void 0); + let scale; + if (combinedBbox != null) { + const { lon0, lat0, lon1, lat1 } = combinedBbox; + const domain = [ + [lon0, lat0], + [lon1, lat1] + ]; + const bounds = MercatorScale.bounds(domain); + const { width, height } = seriesRect; + const viewBoxScale = Math.min(width / bounds.width, height / bounds.height); + const viewBoxWidth = bounds.width * viewBoxScale; + const viewBoxHeight = bounds.height * viewBoxScale; + const viewBoxOriginX = (width - viewBoxWidth) / 2; + const viewBoxOriginY = (height - viewBoxHeight) / 2; + const x0 = viewBoxOriginX; + const y0 = viewBoxOriginY; + const x1 = viewBoxOriginX + viewBoxWidth; + const y1 = viewBoxOriginY + viewBoxHeight; + const xZoom = this.ctx.zoomManager.getAxisZoom(ChartAxisDirection24.X); + const yZoom = this.ctx.zoomManager.getAxisZoom(ChartAxisDirection24.Y); + const xSpan = (x1 - x0) / (xZoom.max - xZoom.min); + const xStart = x0 - xSpan * xZoom.min; + const ySpan = (y1 - y0) / (1 - yZoom.min - (1 - yZoom.max)); + const yStart = y0 - ySpan * (1 - yZoom.max); + scale = new MercatorScale(domain, [ + [xStart, yStart], + [xStart + xSpan, yStart + ySpan] + ]); + } + for (const series of mapSeries) { + series.scale = scale; + } + const seriesVisible = this.series.some((s) => s.visible); + seriesRoot.visible = seriesVisible; + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(seriesRect.x); + group.translationY = Math.floor(seriesRect.y); + group.setClipRect(seriesRect.clone()); + } + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: seriesVisible, rect: seriesRect, paddedRect: layoutBox } + }); + } +}; +TopologyChart.className = "TopologyChart"; +TopologyChart.type = "topology"; +__decorateClass([ + Property64 +], TopologyChart.prototype, "topology", 2); + +// packages/ag-charts-enterprise/src/charts/topologyChartModule.ts +var { isAgTopologyChartOptions, topologyChartOptionsDefs } = _ModuleSupport178; +var TopologyChartModule = { + type: "chart", + name: "topology", + enterprise: true, + options: topologyChartOptionsDefs, + detect: isAgTopologyChartOptions, + create(options, resources) { + return new TopologyChart(options, resources); + } +}; + +// packages/ag-charts-enterprise/src/features/sync/pluginModules.ts +import { _ModuleSupport as _ModuleSupport180 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/features/annotations/annotationOptionsDef.ts +import { + _ModuleSupport as _ModuleSupport179 +} from "ag-charts-community"; +import { + and, + arrayOf as arrayOf2, + arrayOfDefs as arrayOfDefs3, + boolean as boolean7, + constant as constant8, + greaterThan, + lessThan, + number as number6, + numberRange, + optionsDefs, + or, + ratio as ratio2, + required as required8, + string as string8, + typeUnion as typeUnion2, + union as union2 +} from "ag-charts-core"; +var { + annotationCalloutStylesDefs, + annotationNoteStylesDefs, + annotationTextStylesDef, + annotationCommentStylesDefs, + annotationMeasurerStylesDefs, + annotationQuickMeasurerStylesDefs, + annotationShapeStylesDefs, + annotationChannelTextDefs, + annotationCrossLineStyleDefs, + annotationFibonacciStylesDefs, + annotationLineStyleDefs, + annotationLineTextDefs, + annotationDisjointChannelStyleDefs, + annotationParallelChannelStyleDefs +} = _ModuleSupport179; +var serializableDate = optionsDefs( + { + __type: required8(constant8("date")), + value: or(string8, number6) + }, + "a serializable date object" +); +var xValue = or(string8, number6, serializableDate); +var annotationValue = or( + xValue, + optionsDefs({ + value: xValue, + groupPercentage: numberRange(-1, 2) + }) +); +var channelAnnotationTextOptionsDef = { + ...annotationChannelTextDefs, + label: string8 +}; +var lineAnnotationTextOptionsDef = { + ...annotationLineTextDefs, + label: string8 +}; +var annotationPointOptionsDef = { + x: annotationValue, + y: number6 +}; +var annotationInitialStateOptionsDef = typeUnion2( + { + line: { + ...annotationLineStyleDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef + }, + "horizontal-line": { + ...annotationCrossLineStyleDefs, + value: annotationValue, + text: lineAnnotationTextOptionsDef + }, + "vertical-line": { + ...annotationCrossLineStyleDefs, + value: annotationValue, + text: lineAnnotationTextOptionsDef + }, + "disjoint-channel": { + ...annotationDisjointChannelStyleDefs, + startHeight: number6, + endHeight: number6, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: channelAnnotationTextOptionsDef + }, + "parallel-channel": { + ...annotationParallelChannelStyleDefs, + height: number6, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: channelAnnotationTextOptionsDef + }, + "fibonacci-retracement": { + ...annotationFibonacciStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef, + reverse: boolean7 + }, + "fibonacci-retracement-trend-based": { + ...annotationFibonacciStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + endRetracement: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef, + reverse: boolean7 + }, + callout: { + ...annotationCalloutStylesDefs, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: string8 + }, + comment: { + ...annotationCommentStylesDefs, + ...annotationPointOptionsDef, + text: string8 + }, + note: { + ...annotationNoteStylesDefs, + ...annotationPointOptionsDef, + text: string8 + }, + text: { + ...annotationTextStylesDef, + ...annotationPointOptionsDef, + text: string8 + }, + arrow: { + ...annotationLineStyleDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "arrow-up": { + ...annotationShapeStylesDefs, + ...annotationPointOptionsDef + }, + "arrow-down": { + ...annotationShapeStylesDefs, + ...annotationPointOptionsDef + }, + "date-range": { + ...annotationMeasurerStylesDefs, + extendAbove: boolean7, + extendBelow: boolean7, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "price-range": { + ...annotationMeasurerStylesDefs, + extendLeft: boolean7, + extendRight: boolean7, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "date-price-range": { + ...annotationMeasurerStylesDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "quick-date-price-range": { + ...annotationMeasurerStylesDefs, + ...annotationQuickMeasurerStylesDefs, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + } + }, + "an annotation initial state object" +); +var initialStateOptionsDef = { + chartType: union2("candlestick", "hollow-candlestick", "ohlc", "line", "step-line", "hlc", "high-low"), + annotations: arrayOfDefs3(annotationInitialStateOptionsDef), + legend: arrayOfDefs3( + { + visible: boolean7, + seriesId: string8, + itemId: string8, + legendItemName: string8 + }, + "legend state array" + ), + zoom: { + rangeX: { + start: or(number6, serializableDate), + end: or(number6, serializableDate) + }, + rangeY: { + start: or(number6, serializableDate), + end: or(number6, serializableDate) + }, + ratioX: { + start: and(ratio2, lessThan("end")), + end: and(ratio2, greaterThan("start")) + }, + ratioY: { + start: and(ratio2, lessThan("end")), + end: and(ratio2, greaterThan("start")) + }, + autoScaledAxes: arrayOf2(constant8("y")) + } +}; + +// packages/ag-charts-enterprise/src/features/sync/pluginModules.ts +var { annotationOptionsDef } = _ModuleSupport180; +var AnnotationsModule2 = { + type: "plugin", + name: "annotations", + chartType: "cartesian", + options: annotationOptionsDef, + create() { + return null; + } +}; +var NavigatorModule2 = { + type: "plugin", + name: "navigator", + chartType: "cartesian", + options: navigatorOptionsDef, + create() { + return null; + } +}; +var InitialStateModule = { + type: "plugin", + name: "initialState", + options: initialStateOptionsDef, + create() { + return null; + } +}; + +// packages/ag-charts-enterprise/src/series/chord/chordModule.ts +import { _ModuleSupport as _ModuleSupport186 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/chord/chordSeries.ts +import { _ModuleSupport as _ModuleSupport184 } from "ag-charts-community"; +import { + Logger as Logger14, + cachedTextMeasurer as cachedTextMeasurer5, + calcLineHeight as calcLineHeight6, + toPlainText as toPlainText5, + wrapText as wrapText3 +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionSeries.ts +import { _ModuleSupport as _ModuleSupport181 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionUtil.ts +import { Logger as Logger13 } from "ag-charts-core"; +function computeNodeGraph(nodes, links, includeCircularReferences) { + if (!includeCircularReferences) { + links = removeCircularLinks(links); + } + const nodeGraph = /* @__PURE__ */ new Map(); + for (const datum of nodes) { + nodeGraph.set(datum.id, { + datum, + linksBefore: [], + linksAfter: [], + maxPathLengthBefore: -1, + maxPathLengthAfter: -1 + }); + } + let maxPathLength = 0; + for (const [id, node] of nodeGraph.entries()) { + maxPathLength = Math.max( + maxPathLength, + computePathLength(nodeGraph, links, node, id, -1, []) + computePathLength(nodeGraph, links, node, id, 1, []) + 1 + ); + } + return { links, nodeGraph, maxPathLength }; +} +function findCircularLinks(links, link, into, stack) { + const stackIndex = stack.indexOf(link); + if (stackIndex !== -1) { + for (let i = stackIndex; i < stack.length; i += 1) { + into.add(stack[i]); + } + return; + } + stack.push(link); + const { toNode } = link; + for (const next of links) { + if (next.fromNode === toNode) { + findCircularLinks(links, next, into, stack); + } + } + stack.pop(); +} +function removeCircularLinks(links) { + const circularLinks = /* @__PURE__ */ new Set(); + for (const link of links) { + findCircularLinks(links, link, circularLinks, []); + } + if (circularLinks.size !== 0) { + Logger13.warnOnce("Some links formed circular references. These will be removed from the output."); + } + return circularLinks.size === 0 ? links : links.filter((link) => !circularLinks.has(link)); +} +function computePathLength(nodeGraph, links, node, id, direction, stack) { + if (stack.includes(id)) { + return Infinity; + } + let maxPathLength = direction === -1 ? node.maxPathLengthBefore : node.maxPathLengthAfter; + if (maxPathLength === -1) { + maxPathLength = 0; + const connectedLinks = direction === -1 ? node.linksBefore : node.linksAfter; + for (const link of links) { + const { fromNode, toNode } = link; + const linkId = direction === -1 ? toNode.id : fromNode.id; + const nextNodeId = direction === -1 ? fromNode.id : toNode.id; + const nextNode = id === linkId ? nodeGraph.get(nextNodeId) : void 0; + if (nextNode == null) + continue; + connectedLinks.push({ node: nextNode, link }); + stack?.push(id); + maxPathLength = Math.max( + maxPathLength, + computePathLength(nodeGraph, links, nextNode, nextNodeId, direction, stack) + 1 + ); + stack?.pop(); + } + if (direction === -1) { + node.maxPathLengthBefore = maxPathLength; + } else { + node.maxPathLengthAfter = maxPathLength; + } + } + return maxPathLength; +} + +// packages/ag-charts-enterprise/src/series/flow-proportion/flowProportionSeries.ts +var { Series, DataController, keyProperty: keyProperty7, valueProperty: valueProperty10, Selection: Selection5, Group: Group9, TransformableText } = _ModuleSupport181; +var FlowProportionSeriesNodeEvent = class extends _ModuleSupport181.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + const { datumIndex } = datum; + const nodeDatum = series.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + this.size = nodeDatum?.size; + this.label = nodeDatum?.type === 1 /* Node */ ? nodeDatum?.label : void 0; + } +}; +var FlowProportionSeries = class extends Series { + constructor() { + super(...arguments); + this.NodeEvent = FlowProportionSeriesNodeEvent; + this.nodeCount = 0; + this.linkCount = 0; + this.linksDataModel = void 0; + this.linksProcessedData = void 0; + this.nodesDataModel = void 0; + this.nodesProcessedData = void 0; + this.processedNodes = /* @__PURE__ */ new Map(); + this.linkGroup = this.contentGroup.appendChild(new Group9({ name: "linkGroup" })); + this.nodeGroup = this.contentGroup.appendChild(new Group9({ name: "nodeGroup" })); + this.focusLinkGroup = this.highlightGroup.appendChild(new Group9({ name: "linkGroup" })); + this.focusNodeGroup = this.highlightGroup.appendChild(new Group9({ name: "nodeGroup" })); + this.highlightLinkGroup = this.highlightGroup.appendChild(new Group9({ name: "linkGroup" })); + this.highlightNodeGroup = this.highlightGroup.appendChild(new Group9({ name: "nodeGroup" })); + this.labelSelection = Selection5.select( + this.labelGroup, + TransformableText + ); + this.linkSelection = Selection5.select( + this.linkGroup, + () => this.linkFactory() + ); + this.nodeSelection = Selection5.select( + this.nodeGroup, + () => this.nodeFactory() + ); + this.focusLinkSelection = Selection5.select( + this.focusLinkGroup, + () => this.linkFactory() + ); + this.focusNodeSelection = Selection5.select( + this.focusNodeGroup, + () => this.nodeFactory() + ); + this.highlightLinkSelection = Selection5.select( + this.highlightLinkGroup, + () => this.linkFactory() + ); + this.highlightNodeSelection = Selection5.select( + this.highlightNodeGroup, + () => this.nodeFactory() + ); + } + get nodes() { + return this.properties.nodes; + } + async processData(dataController) { + const { data, nodes } = this; + if (data == null) + return; + const { fromKey, toKey, sizeKey, idKey, labelKey } = this.properties; + const nodesDataController = new DataController("standalone", dataController.suppressFieldDotNotation); + const nodesDataModelPromise = nodes == null ? null : nodesDataController.request( + this.id, + _ModuleSupport181.DataSet.wrap(nodes) ?? _ModuleSupport181.DataSet.empty(), + { + props: [ + keyProperty7(idKey, void 0, { id: "idValue", includeProperty: false }), + ...labelKey == null ? [] : [valueProperty10(labelKey, void 0, { id: "labelValue", includeProperty: false })] + ], + groupByKeys: true + } + ); + const linksDataModelPromise = dataController.request(this.id, data, { + props: [ + valueProperty10(fromKey, void 0, { id: "fromValue", includeProperty: false }), + valueProperty10(toKey, void 0, { id: "toValue", includeProperty: false }), + ...sizeKey == null ? [] : [ + valueProperty10(sizeKey, void 0, { + id: "sizeValue", + includeProperty: false, + missingValue: 0 + }) + ] + ], + groupByKeys: false + }); + if (nodes != null) { + nodesDataController.execute(); + } + const [nodesDataModel, linksDataModel] = await Promise.all([ + nodesDataModelPromise ?? Promise.resolve(null), + linksDataModelPromise + ]); + this.nodesDataModel = nodesDataModel?.dataModel; + this.nodesProcessedData = nodesDataModel?.processedData; + this.linksDataModel = linksDataModel?.dataModel; + this.linksProcessedData = linksDataModel?.processedData; + const processedNodes = /* @__PURE__ */ new Map(); + if (nodesDataModel == null) { + const fromIdValues = linksDataModel.dataModel.resolveColumnById( + this, + "fromValue", + linksDataModel.processedData + ); + const toIdValues = linksDataModel.dataModel.resolveColumnById( + this, + "toValue", + linksDataModel.processedData + ); + const createImplicitNode = (id) => { + const datumIndex = processedNodes.size; + const label = id; + return { + series: this, + itemId: void 0, + datum: {}, + // Must be a referential object for tooltips + datumIndex: { type: 1 /* Node */, index: datumIndex }, + type: 1 /* Node */, + index: datumIndex, + linksBefore: [], + linksAfter: [], + id, + size: 0, + label, + style: this.getNodeStyle( + { + datumIndex: { type: 1 /* Node */, index: datumIndex }, + datum: {}, + size: 0, + label + }, + datumIndex, + false + ) + }; + }; + const linkData = linksDataModel.processedData.dataSources.get(this.id)?.data; + if (linkData) { + for (const [datumIndex] of linkData.entries()) { + const fromId = fromIdValues[datumIndex]; + const toId = toIdValues[datumIndex]; + if (fromId == null || toId == null) + continue; + if (!processedNodes.has(fromId)) { + processedNodes.set(fromId, createImplicitNode(fromId)); + } + if (!processedNodes.has(toId)) { + processedNodes.set(toId, createImplicitNode(toId)); + } + } + } + } else { + const nodeIdValues = nodesDataModel.dataModel.resolveColumnById( + this, + "idValue", + nodesDataModel.processedData + ); + const labelValues = labelKey == null ? void 0 : nodesDataModel.dataModel.resolveColumnById( + this, + "labelValue", + nodesDataModel.processedData + ); + const nodeData = nodesDataModel.processedData.dataSources.get(this.id)?.data; + if (nodeData) { + for (const [datumIndex, datum] of nodeData.entries()) { + const id = nodeIdValues[datumIndex]; + const label = labelValues?.[datumIndex]; + const nodeDatumIndex = { type: 1 /* Node */, index: datumIndex }; + processedNodes.set(id, { + series: this, + itemId: void 0, + datum, + datumIndex: nodeDatumIndex, + type: 1 /* Node */, + index: datumIndex, + linksBefore: [], + linksAfter: [], + id, + size: 0, + label, + style: this.getNodeStyle( + { datumIndex: nodeDatumIndex, datum, size: 0, label }, + datumIndex, + false + ) + }); + } + } + } + this.processedNodes = processedNodes; + } + getNodeGraph(createNode, createLink, { includeCircularReferences }) { + const { linksDataModel, linksProcessedData } = this; + if (linksDataModel == null || linksProcessedData == null) { + const { links: links2, nodeGraph: nodeGraph2, maxPathLength: maxPathLength2 } = computeNodeGraph( + (/* @__PURE__ */ new Map()).values(), + [], + includeCircularReferences + ); + this.nodeCount = 0; + this.linkCount = 0; + return { nodeGraph: nodeGraph2, links: links2, maxPathLength: maxPathLength2 }; + } + const { sizeKey } = this.properties; + const fromIdValues = linksDataModel.resolveColumnById(this, "fromValue", linksProcessedData); + const toIdValues = linksDataModel.resolveColumnById(this, "toValue", linksProcessedData); + const sizeValues = sizeKey == null ? void 0 : linksDataModel.resolveColumnById(this, "sizeValue", linksProcessedData); + const nodesById = /* @__PURE__ */ new Map(); + for (const datum of this.processedNodes.values()) { + const node = createNode(datum); + nodesById.set(datum.id, node); + } + const baseLinks = []; + const linkData = linksProcessedData.dataSources.get(this.id)?.data; + if (linkData) { + for (const [datumIndex, datum] of linkData.entries()) { + const fromId = fromIdValues[datumIndex]; + const toId = toIdValues[datumIndex]; + const size = sizeValues == null ? 1 : sizeValues[datumIndex]; + const fromNode = nodesById.get(fromId); + const toNode = nodesById.get(toId); + if (size <= 0 || fromNode == null || toNode == null) + continue; + const linkNodeDatumIndex = { type: 0 /* Link */, index: datumIndex }; + const link = createLink({ + series: this, + itemId: void 0, + datum, + datumIndex: linkNodeDatumIndex, + type: 0 /* Link */, + index: datumIndex, + fromNode, + toNode, + size, + style: this.getLinkStyle( + { datum, datumIndex: linkNodeDatumIndex }, + fromNode.datumIndex, + false + ) + }); + baseLinks.push(link); + } + } + const { links, nodeGraph, maxPathLength } = computeNodeGraph( + nodesById.values(), + baseLinks, + includeCircularReferences + ); + for (const node of nodeGraph.values()) { + node.datum.linksBefore = node.linksBefore.map((linkedNode) => linkedNode.link); + node.datum.linksAfter = node.linksAfter.map((linkedNode) => linkedNode.link); + } + this.nodeCount = nodeGraph.size; + this.linkCount = links.length; + return { nodeGraph, links, maxPathLength }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update(opts) { + const { seriesRect } = opts; + const newNodeDataDependencies = { + seriesRectWidth: seriesRect?.width ?? 0, + seriesRectHeight: seriesRect?.height ?? 0 + }; + if (this._nodeDataDependencies == null || this._nodeDataDependencies.seriesRectWidth !== newNodeDataDependencies.seriesRectWidth || this._nodeDataDependencies.seriesRectHeight !== newNodeDataDependencies.seriesRectHeight) { + this._nodeDataDependencies = newNodeDataDependencies; + } + this.updateSelections(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedDatum?.series === this && highlightedDatum.type == null) { + const { itemId } = highlightedDatum; + highlightedDatum = itemId == null ? void 0 : nodeData.find((node) => node.type === 1 /* Node */ && node.id === itemId); + } else if (highlightedDatum?.series !== this) { + highlightedDatum = void 0; + } + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = highlightedDatum == null ? 1 : this.properties.highlight.unhighlightedItem.opacity ?? 1; + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection: this.labelSelection }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + this.linkSelection = this.updateLinkSelection({ + nodeData: nodeData.filter((d) => d.type === 0 /* Link */), + datumSelection: this.linkSelection + }); + this.updateLinkNodes({ datumSelection: this.linkSelection, isHighlight: false }); + this.nodeSelection = this.updateNodeSelection({ + nodeData: nodeData.filter((d) => d.type === 1 /* Node */), + datumSelection: this.nodeSelection + }); + this.updateNodeNodes({ datumSelection: this.nodeSelection, isHighlight: false }); + let focusLinkSelection; + let focusNodeSelection; + let highlightLinkSelection; + let highlightNodeSelection; + if (highlightedDatum?.type === 1 /* Node */) { + focusLinkSelection = nodeData.filter((node) => { + return node.type === 0 /* Link */ && (node.toNode === highlightedDatum || node.fromNode === highlightedDatum); + }); + focusNodeSelection = focusLinkSelection.map((link) => { + return link.fromNode === highlightedDatum ? link.toNode : link.fromNode; + }); + focusNodeSelection.push(highlightedDatum); + highlightLinkSelection = []; + highlightNodeSelection = [highlightedDatum]; + } else if (highlightedDatum?.type === 0 /* Link */) { + focusLinkSelection = [highlightedDatum]; + focusNodeSelection = [highlightedDatum.fromNode, highlightedDatum.toNode]; + highlightLinkSelection = [highlightedDatum]; + highlightNodeSelection = []; + } else { + focusLinkSelection = []; + focusNodeSelection = []; + highlightLinkSelection = []; + highlightNodeSelection = []; + } + this.focusLinkSelection = this.updateLinkSelection({ + nodeData: focusLinkSelection, + datumSelection: this.focusLinkSelection + }); + this.updateLinkNodes({ datumSelection: this.focusLinkSelection, isHighlight: false }); + this.focusNodeSelection = this.updateNodeSelection({ + nodeData: focusNodeSelection, + datumSelection: this.focusNodeSelection + }); + this.updateNodeNodes({ datumSelection: this.focusNodeSelection, isHighlight: false }); + this.highlightLinkSelection = this.updateLinkSelection({ + nodeData: highlightLinkSelection, + datumSelection: this.highlightLinkSelection + }); + this.updateLinkNodes({ datumSelection: this.highlightLinkSelection, isHighlight: true }); + this.highlightNodeSelection = this.updateNodeSelection({ + nodeData: highlightNodeSelection, + datumSelection: this.highlightNodeSelection + }); + this.updateNodeNodes({ datumSelection: this.highlightNodeSelection, isHighlight: true }); + } + resetAnimation(_chartAnimationPhase) { + } + dataCount() { + return Number.NaN; + } + getSeriesDomain(_direction) { + return []; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + legendItemSymbol(_type, nodeIndex, format = {}) { + const { fills, strokes } = this.properties; + const { + fill = fills[nodeIndex % fills.length], + fillOpacity = 1, + stroke: stroke2 = strokes[nodeIndex % strokes.length], + strokeWidth = 0, + strokeOpacity = 1, + lineDash = [0], + lineDashOffset = 0 + } = format; + return { + marker: { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") + return []; + const { showInLegend } = this.properties; + return Array.from( + this.processedNodes.values(), + ({ id, label }, nodeIndex) => ({ + legendType: "category", + id: this.id, + itemId: id, + seriesId: this.id, + enabled: true, + label: { text: label ?? id }, + symbol: this.legendItemSymbol(1 /* Node */, nodeIndex), + hideInLegend: !showInLegend, + isFixed: true + }) + ); + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.linkSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + this.nodeSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + getDatumAriaText(datum, description) { + if (datum.type === 0 /* Link */) { + return this.ctx.localeManager.t("ariaAnnounceFlowProportionLink", { + index: datum.index + 1, + count: this.linkCount, + from: datum.fromNode.id, + to: datum.toNode.id, + size: datum.size, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }); + } else if (datum.type === 1 /* Node */) { + return this.ctx.localeManager.t("ariaAnnounceFlowProportionNode", { + index: datum.index + 1, + count: this.nodeCount, + description + }); + } + } + pickFocus(opts) { + const { datumIndexDelta: childDelta, otherIndexDelta: depthDelta } = opts; + const currentNodeDatum = this.contextNodeData?.nodeData[opts.datumIndex - opts.datumIndexDelta]; + let nextNodeDatum = currentNodeDatum; + if (depthDelta !== 0 || childDelta === 0) + return; + if (currentNodeDatum?.type === 0 /* Link */) { + const allLinks = Array.from(this.linkSelection, (link) => link.datum); + const selfIndex = allLinks.indexOf(currentNodeDatum); + const nextIndex = selfIndex + childDelta; + if (nextIndex >= 0 && nextIndex < allLinks.length) { + nextNodeDatum = allLinks[nextIndex]; + } else if (nextIndex > 0) { + nextNodeDatum = allLinks.at(-1); + } else { + const allNodes = Array.from(this.nodeSelection, (node) => node.datum); + nextNodeDatum = allNodes.at(-1); + } + } else if (currentNodeDatum?.type === 1 /* Node */) { + const allNodes = Array.from(this.nodeSelection, (node) => node.datum); + const selfIndex = allNodes.indexOf(currentNodeDatum); + const nextIndex = selfIndex + childDelta; + if (nextIndex >= 0 && nextIndex < allNodes.length) { + nextNodeDatum = allNodes[nextIndex]; + } else if (nextIndex < 0) { + nextNodeDatum = allNodes[0]; + } else { + const allLinks = Array.from(this.linkSelection, (link) => link.datum); + nextNodeDatum = allLinks[0]; + } + } + if (nextNodeDatum == null) + return; + const nodeDatum = nextNodeDatum.type === 1 /* Node */ ? Array.from(this.nodeSelection).find((n) => n.datum === nextNodeDatum) : Array.from(this.linkSelection).find((n) => n.datum === nextNodeDatum); + if (nodeDatum == null) + return; + const bounds = this.computeFocusBounds(nodeDatum.node); + if (bounds == null) + return; + return { + datum: nodeDatum.datum, + datumIndex: this.contextNodeData?.nodeData.indexOf(nodeDatum.datum) ?? 0, + otherIndex: 0, + bounds, + clipFocusBox: true + }; + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } +}; + +// packages/ag-charts-enterprise/src/series/chord/chordLink.ts +import { _ModuleSupport as _ModuleSupport182 } from "ag-charts-community"; +var { Path: Path9, SceneChangeDetection: SceneChangeDetection7 } = _ModuleSupport182; +function bezierControlPoints({ + radius, + startAngle, + endAngle, + tension +}) { + const cp0x = radius * Math.cos(startAngle); + const cp0y = radius * Math.sin(startAngle); + const cp3x = radius * Math.cos(endAngle); + const cp3y = radius * Math.sin(endAngle); + const cp1x = cp0x * tension; + const cp1y = cp0y * tension; + const cp2x = cp3x * tension; + const cp2y = cp3y * tension; + return { + x: [cp0x, cp1x, cp2x, cp3x], + y: [cp0y, cp1y, cp2y, cp3y] + }; +} +var ChordLink = class extends Path9 { + constructor() { + super(...arguments); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.startAngle1 = 0; + this.endAngle1 = 0; + this.startAngle2 = 0; + this.endAngle2 = 0; + this.tension = 1; + } + tensionedCurveTo(cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y) { + const { path, tension } = this; + const scale = 1 - tension; + path.cubicCurveTo( + (cp1x - cp0x) * scale + cp0x, + (cp1y - cp0y) * scale + cp0y, + (cp2x - cp3x) * scale + cp3x, + (cp2y - cp3y) * scale + cp3y, + cp3x, + cp3y + ); + } + updatePath() { + const { path, centerX, centerY, radius } = this; + let { startAngle1, endAngle1, startAngle2, endAngle2 } = this; + if (startAngle1 > startAngle2) { + [startAngle1, startAngle2] = [startAngle2, startAngle1]; + [endAngle1, endAngle2] = [endAngle2, endAngle1]; + } + path.clear(); + const startX = centerX + radius * Math.cos(startAngle1); + const startY = centerY + radius * Math.sin(startAngle1); + path.moveTo(startX, startY); + this.tensionedCurveTo( + startX, + startY, + centerX, + centerY, + centerX, + centerY, + centerX + radius * Math.cos(endAngle2), + centerY + radius * Math.sin(endAngle2) + ); + path.arc(centerX, centerY, radius, endAngle2, startAngle2, true); + this.tensionedCurveTo( + centerX + radius * Math.cos(startAngle2), + centerY + radius * Math.sin(startAngle2), + centerX, + centerY, + centerX, + centerY, + centerX + radius * Math.cos(endAngle1), + centerY + radius * Math.sin(endAngle1) + ); + path.arc(centerX, centerY, radius, endAngle1, startAngle1, true); + path.closePath(); + } +}; +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "centerX", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "centerY", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "radius", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "startAngle1", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "endAngle1", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "startAngle2", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "endAngle2", 2); +__decorateClass([ + SceneChangeDetection7() +], ChordLink.prototype, "tension", 2); + +// packages/ag-charts-enterprise/src/series/chord/chordSeriesProperties.ts +import { + _ModuleSupport as _ModuleSupport183 +} from "ag-charts-community"; +var { + FillGradientDefaults: FillGradientDefaults2, + FillPatternDefaults: FillPatternDefaults2, + FillImageDefaults: FillImageDefaults2, + BaseProperties: BaseProperties24, + makeSeriesTooltip: makeSeriesTooltip8, + SeriesProperties, + Property: Property65, + Label: Label6 +} = _ModuleSupport183; +var ChordSeriesLabelProperties = class extends Label6 { + constructor() { + super(...arguments); + this.spacing = 1; + this.maxWidth = 1; + } +}; +__decorateClass([ + Property65 +], ChordSeriesLabelProperties.prototype, "spacing", 2); +__decorateClass([ + Property65 +], ChordSeriesLabelProperties.prototype, "maxWidth", 2); +var ChordSeriesLinkProperties = class extends BaseProperties24 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tension = 0; + } + getStyle(fills, strokes, index) { + const { fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset, tension } = this; + const fill = this.fill ?? fills[index % fills.length]; + const stroke2 = this.stroke ?? strokes[index % fills.length]; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + tension + }; + } +}; +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "fill", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "stroke", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "lineDash", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "tension", 2); +__decorateClass([ + Property65 +], ChordSeriesLinkProperties.prototype, "itemStyler", 2); +var ChordSeriesNodeProperties = class extends BaseProperties24 { + constructor() { + super(...arguments); + this.spacing = 1; + this.width = 1; + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(fills, strokes, index) { + const { fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const fill = this.fill ?? fills[index % fills.length]; + const stroke2 = this.stroke ?? strokes[index % fills.length]; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "spacing", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "width", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "fill", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "stroke", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "lineDash", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property65 +], ChordSeriesNodeProperties.prototype, "itemStyler", 2); +var ChordSeriesProperties = class extends SeriesProperties { + constructor() { + super(); + this.idKey = ""; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.sizeKey = void 0; + this.sizeName = void 0; + this.nodes = void 0; + this.fillGradientDefaults = new FillGradientDefaults2(); + this.fillPatternDefaults = new FillPatternDefaults2(); + this.fillImageDefaults = new FillImageDefaults2(); + this.fills = []; + this.strokes = []; + this.label = new ChordSeriesLabelProperties(); + this.link = new ChordSeriesLinkProperties(); + this.node = new ChordSeriesNodeProperties(); + this.tooltip = makeSeriesTooltip8(); + this.highlightStyle.deprecated = false; + } +}; +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "fromKey", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "toKey", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "nodes", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "fillGradientDefaults", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "fillPatternDefaults", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "fillImageDefaults", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "fills", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "strokes", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "link", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "node", 2); +__decorateClass([ + Property65 +], ChordSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/chord/chordSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode6, + createDatumId: createDatumId6, + angleBetween: angleBetween2, + normalizeAngle360: normalizeAngle3604, + isBetweenAngles, + Sector: Sector3, + evaluateBezier, + applyShapeStyle: applyShapeStyle7, + getShapeStyle, + getLabelStyles, + BBox: BBox16, + mergeDefaults: mergeDefaults10 +} = _ModuleSupport184; +var nodeMidAngle = (node) => node.startAngle + angleBetween2(node.startAngle, node.endAngle) / 2; +var ChordSeries = class extends FlowProportionSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode6.NEAREST_NODE, SeriesNodePickMode6.EXACT_SHAPE_MATCH] + }); + this.properties = new ChordSeriesProperties(); + } + isLabelEnabled() { + return (this.properties.labelKey != null || this.nodes == null) && this.properties.label.enabled; + } + linkFactory() { + return new ChordLink(); + } + nodeFactory() { + return new Sector3(); + } + createNodeData() { + const { + id: seriesId, + _nodeDataDependencies: { seriesRectWidth, seriesRectHeight } = { seriesRectWidth: 0, seriesRectHeight: 0 }, + properties + } = this; + const { + fromKey, + toKey, + sizeKey, + labelKey, + label: { spacing: labelSpacing, maxWidth: labelMaxWidth, fontSize }, + node: { width: nodeWidth, spacing: nodeSpacing } + } = properties; + const centerX = seriesRectWidth / 2; + const centerY = seriesRectHeight / 2; + let labelData = []; + const { nodeGraph, links } = this.getNodeGraph( + (node) => ({ + ...node, + centerX, + centerY, + innerRadius: Number.NaN, + outerRadius: Number.NaN, + startAngle: Number.NaN, + endAngle: Number.NaN + }), + (link) => ({ + ...link, + centerX, + centerY, + radius: Number.NaN, + startAngle1: Number.NaN, + endAngle1: Number.NaN, + startAngle2: Number.NaN, + endAngle2: Number.NaN + }), + { includeCircularReferences: true } + ); + let totalSize = 0; + for (const [id, { datum: node, linksBefore, linksAfter }] of nodeGraph.entries()) { + const size = linksBefore.reduce((acc, { link }) => acc + link.size, 0) + linksAfter.reduce((acc, { link }) => acc + link.size, 0); + if (size === 0) { + nodeGraph.delete(id); + } else { + const { label } = properties; + node.size = size; + totalSize += node.size; + const labelText = label.enabled ? this.getLabelText( + node.label, + node.datum, + labelKey, + "label", + [], + label, + { datum: node.datum, value: node.label, fromKey, toKey, sizeKey, size: node.size } + ) : void 0; + node.label = toPlainText5(labelText); + } + } + let labelInset = 0; + if (this.isLabelEnabled()) { + const measurer2 = cachedTextMeasurer5(this.properties.label); + let maxMeasuredLabelWidth = 0; + for (const { datum: node } of nodeGraph.values()) { + const { id, label } = node; + if (label == null) + continue; + const text2 = wrapText3(label, { + maxWidth: labelMaxWidth, + font: this.properties.label, + textWrap: "never" + }); + const { width } = measurer2.measureLines(text2); + maxMeasuredLabelWidth = Math.max(width, maxMeasuredLabelWidth); + labelData.push({ + id, + text: text2, + centerX, + centerY, + angle: Number.NaN, + radius: Number.NaN, + size: node.size + }); + } + labelInset = maxMeasuredLabelWidth + labelSpacing; + } + const nodeCount = nodeGraph.size; + let radius = Math.min(seriesRectWidth, seriesRectHeight) / 2 - nodeWidth - labelInset; + let spacingSweep = nodeSpacing / radius; + if (labelInset !== 0 && (nodeCount * spacingSweep >= 1.5 * Math.PI || radius <= 0)) { + labelData = []; + radius = Math.min(seriesRectWidth, seriesRectHeight) / 2 - nodeWidth; + spacingSweep = nodeSpacing / radius; + } + if (nodeCount * spacingSweep >= 2 * Math.PI || radius <= 0) { + Logger14.warnOnce("There was insufficient space to display the Chord Series."); + return; + } + const innerRadius = radius; + const outerRadius = radius + nodeWidth; + const sizeScale = Math.max((2 * Math.PI - nodeCount * spacingSweep) / totalSize, 0); + let nodeAngle = 0; + for (const { datum: node } of nodeGraph.values()) { + node.innerRadius = innerRadius; + node.outerRadius = outerRadius; + node.startAngle = nodeAngle; + node.endAngle = nodeAngle + node.size * sizeScale; + nodeAngle = node.endAngle + spacingSweep; + const midR = (node.innerRadius + node.outerRadius) / 2; + const midAngle = nodeMidAngle(node); + node.midPoint = { + x: node.centerX + midR * Math.cos(midAngle), + y: node.centerY + midR * Math.sin(midAngle) + }; + } + const nodeData = []; + for (const { datum: node, linksBefore, linksAfter } of nodeGraph.values()) { + const midAngle = nodeMidAngle(node); + const combinedLinks = [ + ...linksBefore.map((l) => ({ + link: l.link, + distance: angleBetween2(nodeMidAngle(l.node.datum), midAngle), + after: false + })), + ...linksAfter.map((l) => ({ + link: l.link, + distance: angleBetween2(nodeMidAngle(l.node.datum), midAngle), + after: true + })) + ]; + let linkAngle = node.startAngle; + for (const { link, after } of combinedLinks.toSorted((a, b) => a.distance - b.distance)) { + const linkSweep = link.size * sizeScale; + if (after) { + link.startAngle1 = linkAngle; + link.endAngle1 = linkAngle + linkSweep; + } else { + link.startAngle2 = linkAngle; + link.endAngle2 = linkAngle + linkSweep; + } + linkAngle += link.size * sizeScale; + } + nodeData.push(node); + } + const { tension } = this.properties.link; + for (const link of links) { + link.radius = radius; + const outer = bezierControlPoints({ + radius, + startAngle: link.startAngle1, + endAngle: link.endAngle2, + tension + }); + const inner = bezierControlPoints({ + radius, + startAngle: link.startAngle2, + endAngle: link.endAngle1, + tension + }); + const outerX = evaluateBezier(...outer.x, 0.5); + const outerY = evaluateBezier(...outer.y, 0.5); + const innerX = evaluateBezier(...inner.x, 0.5); + const innerY = evaluateBezier(...inner.y, 0.5); + link.midPoint = { + x: link.centerX + (outerX + innerX) / 2, + y: link.centerY + (outerY + innerY) / 2 + }; + nodeData.push(link); + } + for (const label of labelData) { + const node = nodeGraph.get(label.id)?.datum; + if (node == null) + continue; + label.radius = outerRadius + labelSpacing; + label.angle = normalizeAngle3604(node.startAngle + angleBetween2(node.startAngle, node.endAngle) / 2); + } + labelData.sort((a, b) => a.angle - b.angle); + let minAngle = Infinity; + let maxAngle = -Infinity; + labelData = labelData.filter((label) => { + const labelHeight = calcLineHeight6(fontSize); + const da = Math.atan2(labelHeight / 2, label.radius); + const a0 = label.angle - da; + const a1 = label.angle + da; + if (isBetweenAngles(minAngle, a0, a1)) + return false; + if (isBetweenAngles(maxAngle, a0, a1)) + return false; + minAngle = Math.min(a0, minAngle); + maxAngle = Math.max(a1, maxAngle); + return true; + }); + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const params = { + toKey: this.properties.toKey, + fromKey: this.properties.fromKey, + sizeKey: this.properties.sizeKey, + size: Number.NaN + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { size, text: text2, centerX, centerY, radius, angle }) => { + params.size = size; + const style = getLabelStyles(this, void 0, params, this.properties.label, false, activeHighlight); + const { fontStyle, fontWeight, fontSize, fontFamily, color: fill } = style; + label.visible = true; + label.translationX = centerX + radius * Math.cos(angle); + label.translationY = centerY + radius * Math.sin(angle); + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textBaseline = "middle"; + if (Math.cos(angle) >= 0) { + label.textAlign = "left"; + label.rotation = angle; + } else { + label.textAlign = "right"; + label.rotation = angle - Math.PI; + } + label.setBoxing(style); + }); + } + updateNodeSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId6(datum.type, datum.id)); + } + getNodeStyle(nodeDatum, fromNodeDatumIndex, isHighlight) { + const { properties } = this; + const { fills, strokes, fillGradientDefaults: fillGradientDefaults3, fillPatternDefaults: fillPatternDefaults3, fillImageDefaults: fillImageDefaults3 } = properties; + const { itemStyler } = properties.node; + const highlightStyle = this.getHighlightStyle(isHighlight, nodeDatum.datumIndex); + const baseStyle = mergeDefaults10(highlightStyle, properties.node.getStyle(fills, strokes, fromNodeDatumIndex)); + let style = getShapeStyle(baseStyle, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + if (itemStyler != null && nodeDatum.datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId6(nodeDatum.datumIndex.index, "node", isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = getShapeStyle( + mergeDefaults10(overrides, style), + fillGradientDefaults3, + fillPatternDefaults3, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + makeItemStylerParams({ datum, datumIndex, size = 0, label }, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + size, + label, + fill + }; + } + updateNodeNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((sector, datum) => { + const { datumIndex } = datum; + const style = this.getNodeStyle(datum, datumIndex.index, isHighlight); + applyShapeStyle7(sector, style, fillBBox); + sector.centerX = datum.centerX; + sector.centerY = datum.centerY; + sector.innerRadius = datum.innerRadius; + sector.outerRadius = datum.outerRadius; + sector.startAngle = datum.startAngle; + sector.endAngle = datum.endAngle; + sector.inset = sector.strokeWidth / 2; + }); + } + updateLinkSelection(opts) { + return opts.datumSelection.update( + opts.nodeData, + void 0, + (datum) => createDatumId6(datum.type, datum.index, datum.fromNode.id, datum.toNode.id) + ); + } + getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, isHighlight) { + const { id: seriesId, properties } = this; + const { fills, strokes, fillGradientDefaults: fillGradientDefaults3, fillPatternDefaults: fillPatternDefaults3, fillImageDefaults: fillImageDefaults3 } = properties; + const { itemStyler } = properties.link; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults10( + highlightStyle, + properties.link.getStyle(fills, strokes, fromNodeDatumIndex.index) + ); + let style = getShapeStyle(baseStyle, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + if (itemStyler != null && datumIndex != null) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const overrides = this.cachedDatumCallback( + createDatumId6(datumIndex.index, "link", isHighlight ? "highlight" : "node"), + () => { + const highlightState = this.getHighlightStateString( + activeHighlight, + isHighlight, + fromNodeDatumIndex + ); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }); + } + ); + if (overrides) { + style = getShapeStyle( + mergeDefaults10(overrides, style), + fillGradientDefaults3, + fillPatternDefaults3, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + updateLinkNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((link, datum) => { + const fromNodeDatumIndex = datum.fromNode.datumIndex; + const style = this.getLinkStyle(datum, fromNodeDatumIndex, isHighlight); + link.centerX = datum.centerX; + link.centerY = datum.centerY; + link.radius = datum.radius; + link.startAngle1 = datum.startAngle1; + link.endAngle1 = datum.endAngle1; + link.startAngle2 = datum.startAngle2; + link.endAngle2 = datum.endAngle2; + link.tension = style.tension; + applyShapeStyle7(link, style, fillBBox); + }); + } + getShapeFillBBox() { + const width = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const height = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const size = Math.min(width, height); + const x = (width - size) / 2; + const y = (height - size) / 2; + const bbox = new BBox16(x, y, width, height); + return { series: bbox, axis: bbox }; + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + linksProcessedData, + nodesProcessedData, + properties, + ctx: { formatManager } + } = this; + const { fromKey, toKey, sizeKey, sizeName, tooltip } = properties; + const seriesDatum = this.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + if (seriesDatum == null) + return; + const nodeIndex = seriesDatum.type === 0 /* Link */ ? seriesDatum.fromNode.index : seriesDatum.index; + const title = seriesDatum.type === 0 /* Link */ ? `${seriesDatum.fromNode.label} - ${seriesDatum.toNode.label}` : seriesDatum.label; + const datum = datumIndex.type === 0 /* Link */ ? linksProcessedData?.dataSources.get(this.id)?.data[datumIndex.index] : nodesProcessedData?.dataSources.get(this.id)?.data[datumIndex.index]; + const size = seriesDatum.size; + let format; + if (seriesDatum.type === 0 /* Link */) { + const fromNodeDatumIndex = seriesDatum.fromNode.datumIndex; + format = this.getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, false); + } else { + const label = seriesDatum.label; + format = this.getNodeStyle({ datumIndex, datum, size, label }, datumIndex.index, false); + } + const data = []; + if (sizeKey != null) { + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: size, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + domain: [], + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(size) }); + } + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(seriesDatum.type, nodeIndex, format), + data + }, + { + seriesId, + datum, + title, + fromKey, + toKey, + sizeKey, + sizeName, + size, + ...format + } + ); + } + computeFocusBounds(node) { + return node; + } + hasItemStylers() { + return this.properties.node.itemStyler != null || this.properties.link.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +ChordSeries.className = "ChordSeries"; +ChordSeries.type = "chord"; + +// packages/ag-charts-enterprise/src/series/chord/chordSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport185 } from "ag-charts-community"; +import { + constant as constant9, + fillGradientDefaults, + fillImageDefaults, + fillPatternDefaults, + required as required9, + string as string9, + undocumented as undocumented5 +} from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs8, chordSeriesThemeableOptionsDef } = _ModuleSupport185; +var chordSeriesOptionsDef = { + ...chordSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs8, + type: required9(constant9("chord")), + fromKey: required9(string9), + toKey: required9(string9), + sizeKey: string9, + sizeName: string9 +}; +chordSeriesOptionsDef.fillGradientDefaults = undocumented5(fillGradientDefaults); +chordSeriesOptionsDef.fillPatternDefaults = undocumented5(fillPatternDefaults); +chordSeriesOptionsDef.fillImageDefaults = undocumented5(fillImageDefaults); + +// packages/ag-charts-enterprise/src/series/chord/chordModule.ts +var ChordModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + solo: true, + identifier: "chord", + moduleFactory: (ctx) => new ChordSeries(ctx), + themeTemplate: { + series: { + fills: { $palette: "fills" }, + strokes: { $palette: "strokes" }, + // @ts-expect-error undocumented option + fillGradientDefaults: _ModuleSupport186.FILL_GRADIENT_LINEAR_DEFAULTS, + fillPatternDefaults: _ModuleSupport186.FILL_PATTERN_DEFAULTS, + fillImageDefaults: _ModuleSupport186.FILL_IMAGE_DEFAULTS, + highlightStyle: { + series: { + dimOpacity: 0.2 + } + }, + highlight: _ModuleSupport186.singleSeriesHighlightStyle(), + label: { + ..._ModuleSupport186.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 5, + maxWidth: 100 + }, + node: { + spacing: 8, + width: 10, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + link: { + fillOpacity: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + tension: 0.4 + } + }, + legend: { + enabled: false, + toggleSeries: false + } + } +}; +var ChordSeriesModule = { + type: "series", + name: "chord", + chartType: "standalone", + enterprise: true, + options: chordSeriesOptionsDef, + create: (ctx) => new ChordSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelThemes.ts +import { _ModuleSupport as _ModuleSupport187 } from "ag-charts-community"; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE7, CARTESIAN_POSITION: CARTESIAN_POSITION5 }, + ThemeSymbols: { DEFAULT_SHADOW_COLOUR } +} = _ModuleSupport187; +var isHorizontal = { $eq: [{ $path: ["/series/0/direction", void 0] }, "horizontal"] }; +var labelOptions = { + autoRotate: { $path: "/series/0/stageLabel/autoRotate" }, + autoRotateAngle: { $path: "/series/0/stageLabel/autoRotateAngle" }, + avoidCollisions: { $path: ["/series/0/stageLabel/avoidCollisions", true] }, + border: { $path: ["/series/0/stageLabel/border"] }, + color: { $path: ["/series/0/stageLabel/color", { $ref: "textColor" }] }, + cornerRadius: { $path: ["/series/0/stageLabel/cornerRadius"] }, + enabled: { + $if: [ + { $eq: [{ $path: "/series/0/stageLabel/enabled" }, void 0] }, + true, + { $path: "/series/0/stageLabel/enabled" } + ] + }, + fill: { $path: ["/series/0/stageLabel/fill"] }, + fillOpacity: { $path: ["/series/0/stageLabel/fillOpacity"] }, + fontSize: { $path: ["/series/0/stageLabel/fontSize", { $ref: "fontSize" }] }, + fontStyle: { $path: ["/series/0/stageLabel/fontStyle", { $ref: "fontStyle" }] }, + fontWeight: { $path: ["/series/0/stageLabel/fontWeight", { $ref: "fontWeight" }] }, + format: { $path: "/series/0/stageLabel/format" }, + formatter: { $path: "/series/0/stageLabel/formatter" }, + itemStyler: { $path: "/series/0/stageLabel/itemStyler" }, + minSpacing: { $path: "/series/0/stageLabel/minSpacing" }, + padding: { $path: ["/series/0/stageLabel/padding"] }, + rotation: { $path: ["/series/0/stageLabel/rotation", 0] } +}; +var FUNNEL_SERIES_AXES = [ + { + type: { + $if: [isHorizontal, CARTESIAN_AXIS_TYPE7.NUMBER, CARTESIAN_AXIS_TYPE7.CATEGORY] + }, + position: { + $if: [ + isHorizontal, + CARTESIAN_POSITION5.LEFT, + { + $if: [ + { $eq: [{ $path: ["/series/0/stageLabel/placement", void 0] }, "after"] }, + CARTESIAN_POSITION5.RIGHT, + CARTESIAN_POSITION5.LEFT + ] + } + ] + }, + label: { + $if: [isHorizontal, void 0, labelOptions] + } + }, + { + type: { + $if: [isHorizontal, CARTESIAN_AXIS_TYPE7.CATEGORY, CARTESIAN_AXIS_TYPE7.NUMBER] + }, + position: { + $if: [ + isHorizontal, + { + $if: [ + { $eq: [{ $path: ["/series/0/stageLabel/placement", void 0] }, "before"] }, + CARTESIAN_POSITION5.TOP, + CARTESIAN_POSITION5.BOTTOM + ] + }, + CARTESIAN_POSITION5.BOTTOM + ] + }, + label: { + $if: [isHorizontal, labelOptions, void 0] + } + } +]; +var FUNNEL_SERIES_THEME = { + series: { + direction: "vertical", + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + spacingRatio: 0.25, + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + [{ $path: ["/0", void 0, { $palette: "fills" }] }], + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", _ModuleSupport187.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS], + ["pattern", _ModuleSupport187.FILL_PATTERN_SINGLE_DEFAULTS], + ["image", _ModuleSupport187.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + [{ $path: ["/0", void 0, { $palette: "strokes" }] }] + ] + }, + label: { + ..._ModuleSupport187.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + dropOff: { + enabled: true, + fillOpacity: 0.2, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + highlight: _ModuleSupport187.singleSeriesHighlightStyle() + }, + axes: { + [CARTESIAN_AXIS_TYPE7.NUMBER]: { + nice: false, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false + }, + label: { + enabled: false + } + }, + [CARTESIAN_AXIS_TYPE7.CATEGORY]: { + line: { + enabled: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeries.ts +import { + _ModuleSupport as _ModuleSupport192 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/funnel/baseFunnelSeries.ts +import { + _ModuleSupport as _ModuleSupport190 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/funnel/funnelConnector.ts +import { _ModuleSupport as _ModuleSupport188 } from "ag-charts-community"; +var { lineDistanceSquared, BBox: BBox17, Path: Path10, SceneChangeDetection: SceneChangeDetection8 } = _ModuleSupport188; +var delta = 1e-6; +function pointsEq([ax, ay], [bx, by]) { + return Math.abs(ax - bx) <= delta && Math.abs(ay - by) <= delta; +} +var FunnelConnector = class extends Path10 { + constructor() { + super(...arguments); + this.x0 = 0; + this.y0 = 0; + this.x1 = 0; + this.y1 = 0; + this.x2 = 0; + this.y2 = 0; + this.x3 = 0; + this.y3 = 0; + } + get midPoint() { + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + return { + x: (x0 + x1 + x2 + x3) / 4, + y: (y0 + y1 + y2 + y3) / 4 + }; + } + distanceSquared(x, y) { + if (this.containsPoint(x, y)) + return 0; + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + return Math.min( + lineDistanceSquared(x, y, x0, y0, x1, y1, Infinity), + lineDistanceSquared(x, y, x1, y1, x2, y2, Infinity), + lineDistanceSquared(x, y, x2, y2, x3, y3, Infinity), + lineDistanceSquared(x, y, x3, y3, x0, y0, Infinity) + ); + } + computeBBox() { + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + const x = Math.min(x0, x1, x2, x3); + const width = Math.max(x0, x1, x2, x3) - x; + const y = Math.min(y0, y1, y2, y3); + const height = Math.max(y0, y1, y2, y3) - y; + return new BBox17(x, y, width, height); + } + updatePath() { + const { path, x0, y0, x1, y1, x2, y2, x3, y3 } = this; + const points = [ + [x0, y0], + [x1, y1], + [x2, y2], + [x3, y3] + ]; + path.clear(); + let start; + let current; + for (const p of points) { + if (start != null && pointsEq(start, p) || current != null && pointsEq(current, p)) { + continue; + } + const [x, y] = p; + if (start == null) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + start ?? (start = p); + current = p; + } + path.closePath(); + } +}; +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x0", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y0", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x1", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y1", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x2", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y2", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x3", 2); +__decorateClass([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y3", 2); + +// packages/ag-charts-enterprise/src/series/funnel/funnelUtil.ts +import { _ModuleSupport as _ModuleSupport189 } from "ag-charts-community"; +var { NODE_UPDATE_STATE_TO_PHASE_MAPPING } = _ModuleSupport189; +function connectorStartingPosition(datum, _prevDatum, isVertical, _mode) { + const { x0, y0, x1, y1, x2, y2, x3, y3, opacity } = datum; + if (isVertical) { + return { + x0: (x0 + x3) / 2, + y0: (y0 + y3) / 2, + x1: (x1 + x2) / 2, + y1: (y1 + y2) / 2, + x2: (x1 + x2) / 2, + y2: (y1 + y2) / 2, + x3: (x0 + x3) / 2, + y3: (y0 + y3) / 2, + opacity + }; + } else { + return { + x0: (x0 + x1) / 2, + y0: (y0 + y1) / 2, + x1: (x0 + x1) / 2, + y1: (y0 + y1) / 2, + x2: (x2 + x3) / 2, + y2: (y2 + y3) / 2, + x3: (x2 + x3) / 2, + y3: (y2 + y3) / 2, + opacity + }; + } +} +function prepareConnectorAnimationFunctions(isVertical, mode) { + const isRemoved = (datum) => datum == null; + const fromFn = (connector, datum, status) => { + if (status === "updated" && isRemoved(datum)) { + status = "removed"; + } else if (status === "updated" && isRemoved(connector.previousDatum)) { + status = "added"; + } + let source; + if (status === "added" && connector.previousDatum == null && mode === "fade") { + source = { ...resetConnectorSelectionsFn(connector, datum), opacity: 0 }; + } else if (status === "unknown" || status === "added") { + source = connectorStartingPosition(datum, connector.previousDatum, isVertical, mode); + } else { + source = { + x0: connector.x0, + y0: connector.y0, + x1: connector.x1, + y1: connector.y1, + x2: connector.x2, + y2: connector.y2, + x3: connector.x3, + y3: connector.y3, + opacity: connector.opacity + }; + } + const phase = NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { ...source, phase }; + }; + const toFn = (connector, datum, status) => { + let source; + if (status === "removed" && connector.datum == null && mode === "fade") { + source = { ...resetConnectorSelectionsFn(connector, datum), opacity: 0 }; + } else if (status === "removed" || isRemoved(datum)) { + source = connectorStartingPosition(datum, connector.previousDatum, isVertical, mode); + } else { + source = resetConnectorSelectionsFn(connector, datum); + } + return source; + }; + return { fromFn, toFn }; +} +function resetConnectorSelectionsFn(_node, datum) { + const { x0, y0, x1, y1, x2, y2, x3, y3, opacity } = datum; + return { x0, y0, x1, y1, x2, y2, x3, y3, opacity }; +} + +// packages/ag-charts-enterprise/src/series/funnel/baseFunnelSeries.ts +var { + SeriesNodePickMode: SeriesNodePickMode7, + SeriesZIndexMap, + valueProperty: valueProperty11, + keyProperty: keyProperty8, + ChartAxisDirection: ChartAxisDirection25, + updateLabelNode: updateLabelNode5, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL4, + LARGEST_KEY_INTERVAL: LARGEST_KEY_INTERVAL2, + diff: diff5, + fixNumericExtent: fixNumericExtent7, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation4, + resetMotion: resetMotion2, + resetLabelFn: resetLabelFn4, + animationValidation: animationValidation6, + computeBarFocusBounds: computeBarFocusBounds6, + ContinuousScale: ContinuousScale7, + Group: Group10, + Selection: Selection6, + PointerEvents: PointerEvents4, + motion: motion4, + checkCrisp: checkCrisp3, + createDatumId: createDatumId7, + applyShapeStyle: applyShapeStyle8 +} = _ModuleSupport190; +var FunnelSeriesNodeEvent = class extends _ModuleSupport190.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.stageKey; + this.yKey = series.properties.valueKey; + } +}; +var BaseFunnelSeries = class extends _ModuleSupport190.AbstractBarSeries { + constructor({ + moduleCtx, + animationResetFns + }) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode7.AXIS_ALIGNED, SeriesNodePickMode7.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["stageKey"], + y: ["valueKey"] + }, + propertyNames: { + x: [], + y: [] + }, + categoryKey: "xValue", + datumSelectionGarbageCollection: false, + animationResetFns: { + datum: animationResetFns.datum, + label: resetLabelFn4 + } + }); + // @ts-expect-error xKey/yKey renamed + this.NodeEvent = FunnelSeriesNodeEvent; + this.connectorNodeGroup = this.contentGroup.appendChild( + new Group10({ + name: `${this.id}-series-connectorNodes`, + zIndex: SeriesZIndexMap.BACKGROUND + }) + ); + this.connectorSelection = Selection6.select( + this.connectorNodeGroup, + () => this.connectionFactory() + ); + this.connectorNodeGroup.pointerEvents = PointerEvents4.None; + } + get pickModeAxis() { + return "main-category"; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.connectorNodeGroup.zIndex = [SeriesZIndexMap.BACKGROUND, zIndex]; + return true; + } + isVertical() { + return !super.isVertical(); + } + connectionFactory() { + return new FunnelConnector(); + } + async processData(dataController) { + const { stageKey, valueKey } = this.properties; + const { visible, id: seriesId } = this; + const validation = (_value, _datum, index) => visible && this.ctx.legendManager.getItemEnabled({ seriesId, itemId: index }); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + if (this.processedData) { + extraProps.push(diff5(this.id, this.processedData)); + } + extraProps.push(animationValidation6()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const { processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty8(stageKey, xScaleType, { id: "xValue" }), + valueProperty11(valueKey, yScaleType, { id: `yValue`, ...visibleProps, validation, invalidValue: 0 }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL4, LARGEST_KEY_INTERVAL2] : [], + ...extraProps + ], + groupByKeys: false + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { + processedData, + dataModel, + id: seriesId, + ctx: { legendManager } + } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys] + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + if (!this.hasData) + return []; + return keys.filter((_key, index) => legendManager.getItemEnabled({ seriesId, itemId: index })); + } + return this.padBandExtent(keys); + } else { + const yExtent = this.domainForClippedRange(direction, ["yValue"], "xValue"); + const maxExtent = Math.max(...yExtent); + const fixedYExtent = [-maxExtent, maxExtent]; + return fixNumericExtent7(fixedYExtent); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { + hasData, + data, + dataModel, + groupScale, + processedData, + id: seriesId, + ctx: { legendManager } + } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(hasData && data && xAxis && yAxis && dataModel && processedData?.type === "ungrouped")) { + return; + } + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection25.X; + const { stageKey, valueKey } = this.properties; + const itemId = `${valueKey}`; + const context = { + itemId, + nodeData: [], + labelData: [], + connectorData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible + }; + const isVisible = this.visible; + if (!isVisible) + return context; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale7.is(xScale) ? barWidth * -0.5 : 0; + const crisp = checkCrisp3( + xAxis?.scale, + xAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + let previousConnection; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const visible = isVisible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + const xDatum = xValues[datumIndex]; + if (xDatum == null) + continue; + const x = Math.round(xScale.convert(xDatum)) + groupScale.convert(String(groupIndex)) + barOffset; + const yDatum = yValues[datumIndex]; + const yNegative = Math.round(yScale.convert(-yDatum)); + const yPositive = Math.round(yScale.convert(yDatum)); + const style = this.getItemStyle({ datum, datumIndex }, false); + const barHeight = Math.max(style.strokeWidth ?? 0, Math.abs(yPositive - yNegative)); + const rect = { + x: barAlongX ? Math.min(yPositive, yNegative) : x, + y: barAlongX ? x : Math.min(yPositive, yNegative), + width: barAlongX ? barHeight : barWidth, + height: barAlongX ? barWidth : barHeight + }; + const nodeMidPoint = { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + const labelData = this.createLabelData({ + datumIndex, + rect, + barAlongX, + yDatum, + datum, + visible + }); + const nodeDatum = { + index: datumIndex, + series: this, + itemId, + datum, + datumIndex, + xValue: xDatum, + yValue: yDatum, + xKey: stageKey, + yKey: valueKey, + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height, + midPoint: nodeMidPoint, + crisp, + label: labelData, + visible + }; + context.nodeData.push(nodeDatum); + if (labelData != null) { + context.labelData.push(labelData); + } + if (previousConnection != null) { + const prevRect = previousConnection.rect; + const startNodeDatum = previousConnection.nodeDatum; + const startDatumIndex = previousConnection.datumIndex; + if (barAlongX) { + context.connectorData.push({ + datum: startNodeDatum, + datumIndex: startDatumIndex, + x0: prevRect.x, + y0: prevRect.y + prevRect.height, + x1: prevRect.x + prevRect.width, + y1: prevRect.y + prevRect.height, + x2: rect.x + rect.width, + y2: rect.y, + x3: rect.x, + y3: rect.y, + opacity: 1 + }); + } else { + context.connectorData.push({ + datum: startNodeDatum, + datumIndex: startDatumIndex, + x0: prevRect.x + prevRect.width, + y0: prevRect.y, + x1: rect.x, + y1: rect.y, + x2: rect.x, + y2: rect.y + rect.height, + x3: prevRect.x + prevRect.width, + y3: prevRect.y + prevRect.height, + opacity: 1 + }); + } + } + if (visible) { + previousConnection = { + itemId, + rect, + nodeDatum, + datumIndex + }; + } + } + return context; + } + updateNodes(seriesHighlighted, nodeRefresh) { + super.updateNodes(seriesHighlighted, nodeRefresh); + const { connectorSelection } = this; + const connectorData = this.contextNodeData?.connectorData ?? []; + this.connectorSelection = this.updateConnectorSelection({ connectorSelection, connectorData }); + this.updateConnectorNodes({ connectorSelection }); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data, void 0, (datum) => this.getDatumId(datum)); + } + updateConnectorSelection(opts) { + const { connectorData, connectorSelection } = opts; + return connectorSelection.update( + this.connectorEnabled() ? connectorData : [], + void 0, + (connector) => this.getDatumId(connector.datum) + ); + } + updateConnectorNodes(opts) { + const fillBBox = this.getShapeFillBBox(); + opts.connectorSelection.each((connector, datum) => { + const { fill, fillOpacity, stroke: stroke2, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.connectorStyle(datum.datumIndex); + connector.setProperties(resetConnectorSelectionsFn(connector, datum)); + applyShapeStyle8( + connector, + { + fill, + stroke: stroke2, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }, + fillBBox + ); + }); + } + updateLabelSelection(opts) { + const labelData = this.properties.label.enabled ? opts.labelData : []; + return opts.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = PointerEvents4.None; + }); + } + updateLabelNodes(opts) { + const params = { + stageKey: this.properties.stageKey, + valueKey: this.properties.valueKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + updateLabelNode5(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { stageKey, valueKey, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, "xValue", processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(datumIndex), + data: [ + { + label: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, stageKey, legendItemName), + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, valueKey, legendItemName) + } + ] + }, + { seriesId, datum, title: stageKey, stageKey, valueKey, ...this.tooltipStyle(datum, datumIndex) } + ); + } + resetAllAnimation(data) { + super.resetAllAnimation(data); + resetMotion2([this.connectorSelection], resetConnectorSelectionsFn); + } + animateEmptyUpdateReady({ labelSelection }) { + const { connectorSelection } = this; + const isVertical = this.isVertical(); + const mode = "normal"; + const connectorFns = prepareConnectorAnimationFunctions(isVertical, mode); + motion4.fromToMotion(this.id, "connectors", this.ctx.animationManager, [connectorSelection], connectorFns); + seriesLabelFadeInAnimation4(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const { labelSelection: labelSelections } = data; + this.ctx.animationManager.stopByAnimationGroupId(this.id); + seriesLabelFadeInAnimation4(this, "labels", this.ctx.animationManager, labelSelections); + } + getDatumId(datum) { + return createDatumId7(datum.xValue); + } + isLabelEnabled() { + return this.properties.label.enabled; + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds6(this, this.contextNodeData?.nodeData[datumIndex]); + } + legendItemSymbol(datumIndex) { + const { strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset, fill, stroke: stroke2 } = this.properties.getStyle(datumIndex); + return { + marker: { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id: seriesId, + processedData, + dataModel, + ctx: { legendManager }, + visible + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { showInLegend } = this.properties; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + return (processedData.dataSources.get(this.id)?.data ?? []).map((datum, datumIndex) => { + const stageValue = xValues[datumIndex]; + if (stageValue == null) + return; + return { + legendType: "category", + id: seriesId, + datum, + itemId: datumIndex, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { text: String(stageValue) }, + symbol: this.legendItemSymbol(datumIndex), + skipAnimations: true, + hideInLegend: !showInLegend + }; + }).filter((datum) => datum != null); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelProperties.ts +import { _ModuleSupport as _ModuleSupport191 } from "ag-charts-community"; +var { Label: Label7, AbstractBarSeriesProperties: AbstractBarSeriesProperties5, makeSeriesTooltip: makeSeriesTooltip9, AxisLabel: AxisLabel3, Property: Property66 } = _ModuleSupport191; +var ConeFunnelSeriesLabel = class extends Label7 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property66 +], ConeFunnelSeriesLabel.prototype, "placement", 2); +__decorateClass([ + Property66 +], ConeFunnelSeriesLabel.prototype, "spacing", 2); +var ConeFunnelSeriesStageLabel = class extends AxisLabel3 { +}; +__decorateClass([ + Property66 +], ConeFunnelSeriesStageLabel.prototype, "placement", 2); +var ConeFunnelProperties = class extends AbstractBarSeriesProperties5 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new ConeFunnelSeriesLabel(); + this.stageLabel = new ConeFunnelSeriesStageLabel(); + this.tooltip = makeSeriesTooltip9(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index], + fillOpacity, + stroke: strokes[index], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "stageKey", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "valueKey", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "fills", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "strokes", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "lineDash", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "label", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property66 +], ConeFunnelProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelUtil.ts +function resetLineSelectionsFn(_node, { x, y, width, height, opacity }) { + return { x1: x, y1: y, x2: x + width, y2: y + height, opacity: opacity ?? 1 }; +} + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeries.ts +var { Line: Line5, ChartAxisDirection: ChartAxisDirection26 } = _ModuleSupport192; +var ConeFunnelSeries = class extends BaseFunnelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + animationResetFns: { + datum: resetLineSelectionsFn + } + }); + this.properties = new ConeFunnelProperties(); + } + get hasData() { + const { + id: seriesId, + ctx: { legendManager } + } = this; + const visibleItems = this.data?.data.reduce( + (accum, _, datumIndex) => accum + (legendManager.getItemEnabled({ seriesId, itemId: datumIndex }) ? 1 : 0), + 0 + ); + return visibleItems != null && visibleItems > 1; + } + getBandScalePadding() { + return { inner: 1, outer: 0 }; + } + connectorEnabled() { + return true; + } + getItemStyle({ datumIndex }, _isHighlight) { + return this.properties.getStyle(datumIndex); + } + connectorStyle(index) { + return this.properties.getStyle(index); + } + nodeFactory() { + return new Line5(); + } + createLabelData({ + datumIndex, + rect, + barAlongX, + yDatum, + datum, + visible + }) { + const { stageKey, valueKey, label } = this.properties; + const { spacing, placement } = label; + if (!label.enabled) + return; + let x; + let y; + let textAlign; + let textBaseline; + if (barAlongX) { + x = rect.x + rect.width / 2; + textAlign = "center"; + switch (placement) { + case "before": + y = rect.y - spacing; + textBaseline = "bottom"; + break; + case "after": + y = rect.y + rect.height + spacing; + textBaseline = "top"; + break; + default: + y = rect.y + rect.height / 2; + textBaseline = "middle"; + } + } else { + y = rect.y + rect.height / 2; + textBaseline = "middle"; + switch (placement) { + case "before": + x = rect.x - spacing; + textAlign = "right"; + break; + case "after": + x = rect.x + rect.width + spacing; + textAlign = "left"; + break; + default: + x = rect.x + rect.width / 2; + textAlign = "center"; + } + } + const yDomain = this.getSeriesDomain(ChartAxisDirection26.Y); + const text2 = this.getLabelText( + yDatum, + datum, + valueKey, + "y", + yDomain, + label, + { itemId: valueKey, value: yDatum, datum, stageKey, valueKey } + ); + return { + x, + y, + textAlign, + textBaseline, + text: text2, + itemId: valueKey, + datum, + datumIndex, + series: this, + visible + }; + } + updateDatumNodes(opts) { + const highlightStyle = this.getHighlightStyle(opts.isHighlight); + opts.datumSelection.each((line, datum) => { + line.setProperties(resetLineSelectionsFn(line, datum)); + line.stroke = highlightStyle?.stroke; + line.strokeWidth = highlightStyle?.strokeWidth ?? 0; + line.strokeOpacity = highlightStyle?.strokeOpacity ?? 1; + line.lineDash = highlightStyle?.lineDash; + line.lineDashOffset = highlightStyle?.lineDashOffset ?? 0; + line.opacity = highlightStyle?.opacity ?? 1; + }); + } + tooltipStyle(_datum, datumIndex) { + const { fill, stroke: stroke2, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties.getStyle(datumIndex); + return { + fill, + fillOpacity, + stroke: stroke2, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +ConeFunnelSeries.className = "ConeFunnelSeries"; +ConeFunnelSeries.type = "cone-funnel"; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport193 } from "ag-charts-community"; +import { constant as constant10, required as required10, string as string10 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs9, coneFunnelSeriesThemeableOptionsDef, without: without3 } = _ModuleSupport193; +var coneFunnelSeriesOptionsDef = { + ...without3(commonSeriesOptionsDefs9, ["showInLegend"]), + ...coneFunnelSeriesThemeableOptionsDef, + type: required10(constant10("cone-funnel")), + stageKey: required10(string10), + valueKey: required10(string10) +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelThemes.ts +import { _ModuleSupport as _ModuleSupport194 } from "ag-charts-community"; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE8 } +} = _ModuleSupport194; +var CONE_FUNNEL_SERIES_THEME = { + series: { + direction: "vertical", + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "secondSequentialColors" }, + _ModuleSupport194.SAFE_RANGE2_OPERATION + ] + }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", _ModuleSupport194.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS], + ["pattern", _ModuleSupport194.FILL_PATTERN_SINGLE_DEFAULTS], + ["image", _ModuleSupport194.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "secondSequentialColors" }, + _ModuleSupport194.SAFE_RANGE2_OPERATION + ] + } + ] + }, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + label: { + ..._ModuleSupport194.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + placement: "before", + spacing: 4 + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: _ModuleSupport194.singleSeriesHighlightStyle(false) + }, + seriesArea: { + padding: { + top: 20, + bottom: 20 + } + }, + axes: { + [CARTESIAN_AXIS_TYPE8.NUMBER]: { + nice: false, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false + }, + label: { + enabled: false + } + }, + [CARTESIAN_AXIS_TYPE8.CATEGORY]: { + line: { + enabled: false + } + } + } +}; + +// packages/ag-charts-enterprise/src/series/cone-funnel/coneFunnelModule.ts +var ConeFunnelModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "cone-funnel", + moduleFactory: (ctx) => new ConeFunnelSeries(ctx), + solo: true, + defaultAxes: FUNNEL_SERIES_AXES, + themeTemplate: CONE_FUNNEL_SERIES_THEME +}; +var ConeFunnelSeriesModule = { + type: "series", + name: "cone-funnel", + chartType: "cartesian", + enterprise: true, + options: coneFunnelSeriesOptionsDef, + create: (ctx) => new ConeFunnelSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeries.ts +import { + _ModuleSupport as _ModuleSupport196 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/funnel/funnelProperties.ts +import { _ModuleSupport as _ModuleSupport195 } from "ag-charts-community"; +var { Label: Label8, DropShadow: DropShadow4, AbstractBarSeriesProperties: AbstractBarSeriesProperties6, BaseProperties: BaseProperties25, makeSeriesTooltip: makeSeriesTooltip10, AxisLabel: AxisLabel4, Property: Property67 } = _ModuleSupport195; +var FunnelSeriesLabel = class extends Label8 { +}; +var FunnelSeriesStageLabel = class extends AxisLabel4 { +}; +__decorateClass([ + Property67 +], FunnelSeriesStageLabel.prototype, "placement", 2); +var FunnelDropOff = class extends BaseProperties25 { + constructor() { + super(...arguments); + this.enabled = true; + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle() { + const { fill, stroke: stroke2, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "enabled", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "fill", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "fillOpacity", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "stroke", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "strokeWidth", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "strokeOpacity", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "lineDash", 2); +__decorateClass([ + Property67 +], FunnelDropOff.prototype, "lineDashOffset", 2); +var FunnelProperties = class extends AbstractBarSeriesProperties6 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.spacingRatio = 0; + this.dropOff = new FunnelDropOff(); + this.shadow = new DropShadow4().set({ enabled: false }); + this.label = new FunnelSeriesLabel(); + this.stageLabel = new FunnelSeriesStageLabel(); + this.tooltip = makeSeriesTooltip10(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index], + fillOpacity, + stroke: strokes[index], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property67 +], FunnelProperties.prototype, "stageKey", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "valueKey", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "fills", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "strokes", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "lineDash", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "spacingRatio", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "dropOff", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "shadow", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "label", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property67 +], FunnelProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeries.ts +var { + ChartAxisDirection: ChartAxisDirection27, + resetBarSelectionsFn: resetBarSelectionsFn3, + prepareBarAnimationFunctions: prepareBarAnimationFunctions3, + midpointStartingBarPosition: midpointStartingBarPosition2, + createDatumId: createDatumId8, + Rect: Rect6, + motion: motion5, + applyShapeStyle: applyShapeStyle9, + mergeDefaults: mergeDefaults11 +} = _ModuleSupport196; +var FunnelSeries = class extends BaseFunnelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + animationResetFns: { + datum: resetBarSelectionsFn3 + } + }); + this.properties = new FunnelProperties(); + } + getBandScalePadding() { + return { inner: this.properties.spacingRatio, outer: 0 }; + } + connectorEnabled() { + return this.properties.dropOff.enabled; + } + connectorStyle(index) { + return mergeDefaults11(this.properties.dropOff.getStyle(), this.properties.getStyle(index)); + } + nodeFactory() { + return new Rect6(); + } + createLabelData({ + datumIndex, + rect, + yDatum, + datum, + visible + }) { + const { valueKey, stageKey, label } = this.properties; + if (!label.enabled) + return; + const yDomain = this.getSeriesDomain(ChartAxisDirection27.Y); + const text2 = this.getLabelText( + yDatum, + datum, + valueKey, + "y", + yDomain, + label, + { itemId: valueKey, value: yDatum, datum, stageKey, valueKey } + ); + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2, + textAlign: "center", + textBaseline: "middle", + text: text2, + itemId: stageKey, + datum, + datumIndex, + series: this, + visible + }; + } + getItemStyle({ datum, datumIndex }, isHighlight) { + const { id: seriesId, properties } = this; + const { stageKey, valueKey, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults11(highlightStyle, properties.getStyle(datumIndex)); + let style = baseStyle; + if (itemStyler != null) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const overrides = this.cachedDatumCallback( + createDatumId8(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState: highlightStateString, + stageKey, + valueKey, + ...style + }); + } + ); + if (overrides) { + style = mergeDefaults11(overrides, style); + } + } + return style; + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { shadow } = this.properties; + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection27.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const style = this.getItemStyle(datum, isHighlight); + applyShapeStyle9(rect, style, fillBBox); + rect.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect.crisp = datum.crisp; + rect.fillShadow = shadow; + }); + } + tooltipStyle(datum, datumIndex) { + return this.getItemStyle({ datum, datumIndex }, false); + } + animateEmptyUpdateReady(params) { + super.animateEmptyUpdateReady(params); + const { datumSelection } = params; + const isVertical = this.isVertical(); + const mode = "normal"; + const barFns = prepareBarAnimationFunctions3(midpointStartingBarPosition2(isVertical, mode), "unknown"); + motion5.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], barFns); + } + animateWaitingUpdateReady(data) { + super.animateWaitingUpdateReady(data); + const { datumSelection: datumSelections } = data; + const { processedData } = this; + const dataDiff = processedData?.reduced?.diff?.[this.id]; + const fns = prepareBarAnimationFunctions3(midpointStartingBarPosition2(this.isVertical(), "fade"), "added"); + motion5.fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [datumSelections], + fns, + (_, datum) => datum.xValue, + dataDiff + ); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +FunnelSeries.className = "FunnelSeries"; +FunnelSeries.type = "funnel"; + +// packages/ag-charts-enterprise/src/series/funnel/funnelSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport197 } from "ag-charts-community"; +import { constant as constant11, required as required11, string as string11 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs10, funnelSeriesThemeableOptionsDef, without: without4 } = _ModuleSupport197; +var funnelSeriesOptionsDef = { + ...funnelSeriesThemeableOptionsDef, + ...without4(commonSeriesOptionsDefs10, ["showInLegend"]), + type: required11(constant11("funnel")), + stageKey: required11(string11), + valueKey: required11(string11) +}; + +// packages/ag-charts-enterprise/src/series/funnel/funnelModule.ts +var FunnelModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "funnel", + moduleFactory: (ctx) => new FunnelSeries(ctx), + solo: true, + defaultAxes: FUNNEL_SERIES_AXES, + themeTemplate: FUNNEL_SERIES_THEME +}; +var FunnelSeriesModule = { + type: "series", + name: "funnel", + chartType: "cartesian", + enterprise: true, + options: funnelSeriesOptionsDef, + create: (ctx) => new FunnelSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeModule.ts +import { _ModuleSupport as _ModuleSupport202 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeries.ts +import { + _ModuleSupport as _ModuleSupport201 +} from "ag-charts-community"; +import { cachedTextMeasurer as cachedTextMeasurer7, isArray as isArray4, measureTextSegments as measureTextSegments3 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/gauge-util/datumUnion.ts +var DatumUnion = class { + *[Symbol.iterator]() { + const { node, datum } = this; + if (node && datum) + yield { node, datum }; + } + nodes() { + return this.node ? [this.node] : []; + } + update(datumSelection, group, ctor, nodeUpdater) { + const nodes = datumSelection.nodes(); + if (nodes.length === 0) { + this.node?.remove(); + this.node = void 0; + } else { + if (this.node === void 0) { + this.node = new ctor(); + this.node.fillOpacity = 0; + this.node.strokeOpacity = 0; + group.appendChild(this.node); + } + const first = nodes[0]; + const last = nodes.toReversed().find((n) => n.datum.datum.value > n.datum.datum.segmentStart) ?? nodes.at(-1); + this.node.datum = this.datum = first.datum; + nodeUpdater(this.node, first, last); + } + } +}; + +// packages/ag-charts-enterprise/src/series/gauge-util/label.ts +import { isArray as isArray2 } from "ag-charts-core"; +var fadeInFns = { + fromFn: () => ({ opacity: 0, phase: "initial" }), + toFn: () => ({ opacity: 1 }) +}; +function formatLabel(value, scale) { + if (value == null) + return ""; + const { min, max } = scale; + const minLog10 = min === 0 ? 0 : Math.ceil(Math.log10(Math.abs(min))); + const maxLog10 = max === 0 ? 0 : Math.ceil(Math.log10(Math.abs(max))); + const dp = Math.max(2 - Math.max(minLog10, maxLog10), 0); + return value.toFixed(dp); +} +function getLabelText(seriesId, ctx, datum, valueOverride) { + if (datum.text != null) + return datum.text; + const value = valueOverride ?? datum.value; + let labelFormat; + if (datum?.formatter != null) { + labelFormat = formatWithContext(ctx, datum.formatter, { seriesId, datum: void 0, value }); + } + return labelFormat == null || isArray2(labelFormat) ? labelFormat : String(labelFormat); +} + +// packages/ag-charts-enterprise/src/series/gauge-util/lineMarker.ts +function lineMarker({ path, x, y, size }) { + path.moveTo(x, y - size / 2); + path.lineTo(x, y + size / 2); +} + +// packages/ag-charts-enterprise/src/series/gauge-util/pick.ts +import { clamp as clamp9, iterate } from "ag-charts-core"; +function pickGaugeNearestDatum(self, point) { + const it = iterate(self.datumUnion.nodes(), self.targetSelection.nodes()); + return self.pickNodeNearestDistantObject(point, it); +} +function pickGaugeFocus(self, opts) { + const others = [ + { data: self.contextNodeData?.nodeData, selection: self.datumUnion }, + { data: self.contextNodeData?.targetData, selection: self.targetSelection } + ].filter((v) => v.data && v.data.length > 0); + const otherIndex = clamp9(0, opts.otherIndex + opts.otherIndexDelta, others.length - 1); + if (others.length === 0) + return; + const { data, selection } = others[otherIndex]; + if (data == null || data.length === 0) + return; + const datumIndex = clamp9(0, opts.datumIndex, data.length - 1); + const datum = data[datumIndex]; + for (const node of selection) { + if (node.datum === datum) { + const bounds = node.node; + return { bounds, clipFocusBox: true, datum, datumIndex, otherIndex }; + } + } +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport199 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/gauge-util/segmentation.ts +import { _ModuleSupport as _ModuleSupport198 } from "ag-charts-community"; +import { Logger as Logger15 } from "ag-charts-core"; +var { BaseProperties: BaseProperties26, Property: Property68 } = _ModuleSupport198; +var GaugeSegmentationIntervalProperties = class extends BaseProperties26 { + getSegments(scale, maxTicks) { + const { values, step, count } = this; + const d0 = Math.min(...scale.domain); + const d1 = Math.max(...scale.domain); + let ticks; + if (values != null) { + const segments = values.filter((v) => v > d0 && v < d1).sort((a, b) => a - b); + ticks = [d0, ...segments, d1]; + } else if (step != null) { + const segments = []; + for (let i = d0; i < d1; i += step) { + segments.push(i); + } + segments.push(d1); + ticks = segments; + } else if (count == null) { + const segments = scale.ticks({ + nice: true, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.filter((v) => v > d0 && v < d1); + ticks = segments == null ? void 0 : [d0, ...segments, d1]; + } else { + const segments = count + 1; + ticks = Array.from({ length: segments + 1 }, (_, i) => i / segments * (d1 - d0) + d0); + } + if (ticks != null && ticks.length > maxTicks) { + Logger15.warnOnce( + `the configured segmentation results in more than 1 item per pixel, ignoring. Supply a segmentation configuration that results in larger segments or omit this configuration` + ); + ticks = void 0; + } + ticks ?? (ticks = [d0, d1]); + return ticks; + } +}; +__decorateClass([ + Property68 +], GaugeSegmentationIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property68 +], GaugeSegmentationIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property68 +], GaugeSegmentationIntervalProperties.prototype, "count", 2); +var GaugeSegmentationProperties = class extends BaseProperties26 { + constructor() { + super(...arguments); + this.enabled = false; + this.interval = new GaugeSegmentationIntervalProperties(); + this.spacing = 0; + } +}; +__decorateClass([ + Property68 +], GaugeSegmentationProperties.prototype, "enabled", 2); +__decorateClass([ + Property68 +], GaugeSegmentationProperties.prototype, "interval", 2); +__decorateClass([ + Property68 +], GaugeSegmentationProperties.prototype, "spacing", 2); + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeriesProperties.ts +var { + BaseProperties: BaseProperties27, + makeSeriesTooltip: makeSeriesTooltip11, + SeriesProperties: SeriesProperties2, + PropertiesArray: PropertiesArray7, + Property: Property69, + Label: Label9, + AxisLabel: AxisLabel5, + getColorStops +} = _ModuleSupport199; +var LinearGaugeDefaultTargetLabelProperties = class extends Label9 { +}; +__decorateClass([ + Property69 +], LinearGaugeDefaultTargetLabelProperties.prototype, "spacing", 2); +var LinearGaugeTargetProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.value = 0; + this.label = new LinearGaugeDefaultTargetLabelProperties(); + } + getStyle(defaultTarget) { + const { + fill = defaultTarget.fill ?? "black", + fillOpacity = defaultTarget.fillOpacity ?? 1, + stroke: stroke2 = defaultTarget.stroke ?? "black", + strokeWidth = defaultTarget.strokeWidth ?? 0, + strokeOpacity = defaultTarget.strokeOpacity ?? 1, + lineDash = defaultTarget.lineDash ?? [0], + lineDashOffset = defaultTarget.lineDashOffset ?? 0 + } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "text", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "value", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "shape", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "placement", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "spacing", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "size", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "rotation", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "fill", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "stroke", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "lineDash", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property69 +], LinearGaugeTargetProperties.prototype, "label", 2); +var LinearGaugeBarProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.enabled = true; + this.thicknessRatio = 1; + this.fills = new PropertiesArray7(_ModuleSupport199.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(defaultColorRange, horizontal, scale) { + const { fill, fills, fillMode, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const barFill = fill ?? createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal); + return { + fill: barFill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "enabled", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "thickness", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "thicknessRatio", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "fills", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "fillMode", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property69 +], LinearGaugeBarProperties.prototype, "lineDashOffset", 2); +var LinearGaugeScaleIntervalProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.values = void 0; + this.step = void 0; + this.minSpacing = 0; + this.maxSpacing = 1e3; + } +}; +__decorateClass([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "maxSpacing", 2); +var LinearGaugeScaleLabelProperties = class extends AxisLabel5 { + constructor() { + super(...arguments); + this.placement = void 0; + } +}; +__decorateClass([ + Property69 +], LinearGaugeScaleLabelProperties.prototype, "placement", 2); +var LinearGaugeScaleProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.min = 0; + this.max = 1; + this.fills = new PropertiesArray7(_ModuleSupport199.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.defaultFill = "black"; + this.interval = new LinearGaugeScaleIntervalProperties(); + this.label = new LinearGaugeScaleLabelProperties(); + } + getStyle(barEnabled, defaultColorRange, horizontal, scale) { + const { + fill, + fills, + defaultFill, + fillMode, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const scaleFill = fill ?? (barEnabled && fills.length === 0 ? defaultFill : void 0) ?? createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal); + return { + fill: scaleFill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "min", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "max", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "fills", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "fillMode", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "fill", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "stroke", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "defaultFill", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "interval", 2); +__decorateClass([ + Property69 +], LinearGaugeScaleProperties.prototype, "label", 2); +var LinearGaugeLabelProperties = class extends AutoSizedLabel { + constructor() { + super(...arguments); + this.placement = "inside-center"; + this.avoidCollisions = true; + } +}; +__decorateClass([ + Property69 +], LinearGaugeLabelProperties.prototype, "text", 2); +__decorateClass([ + Property69 +], LinearGaugeLabelProperties.prototype, "placement", 2); +__decorateClass([ + Property69 +], LinearGaugeLabelProperties.prototype, "avoidCollisions", 2); +var LinearGaugeSeriesProperties = class extends SeriesProperties2 { + constructor() { + super(...arguments); + this.value = 0; + this.segmentation = new GaugeSegmentationProperties(); + this.defaultColorRange = []; + this.targets = new PropertiesArray7(LinearGaugeTargetProperties); + this.defaultTarget = new LinearGaugeTargetProperties(); + this.defaultScale = new LinearGaugeScaleProperties(); + this.direction = "vertical"; + this.thickness = 1; + this.cornerRadius = 0; + this.cornerMode = "container"; + this.margin = 0; + this.scale = new LinearGaugeScaleProperties(); + this.bar = new LinearGaugeBarProperties(); + this.label = new LinearGaugeLabelProperties(); + this.tooltip = makeSeriesTooltip11(); + } +}; +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "value", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "segmentation", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "targets", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "defaultTarget", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "defaultScale", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "direction", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "thickness", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "cornerMode", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "margin", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "scale", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "bar", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property69 +], LinearGaugeSeriesProperties.prototype, "tooltip", 2); +function createLinearGradient(fills, fillMode, defaultColorRange, scale, horizontal) { + const colorStops = getColorStops(fills, defaultColorRange, scale.domain, fillMode); + return { + type: "gradient", + gradient: "linear", + colorSpace: "oklch", + colorStops, + rotation: horizontal ? 90 : 0, + bounds: "series" + }; +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeUtil.ts +import { _ModuleSupport as _ModuleSupport200 } from "ag-charts-community"; +import { cachedTextMeasurer as cachedTextMeasurer6, isArray as isArray3, measureTextSegments as measureTextSegments2, toPlainText as toPlainText6 } from "ag-charts-core"; +var { BBox: BBox18 } = _ModuleSupport200; +function datumRect(datum) { + const { x0, y0, x1, y1, horizontalInset, verticalInset } = datum; + const x = Math.min(x0, x1) + horizontalInset; + const y = Math.min(y0, y1) + verticalInset; + const width = Math.max(Math.abs(x1 - x0) - 2 * horizontalInset, 0); + const height = Math.max(Math.abs(y1 - y0) - 2 * verticalInset, 0); + return { x, y, width, height }; +} +function clipBBoxVisibility(datum, clipBBox) { + if (clipBBox == null) + return true; + const rect = datumRect(datum); + const delta3 = 1e-6; + const x0 = rect.x + delta3; + const y0 = rect.y + delta3; + const x1 = rect.x + rect.width - delta3; + const y1 = rect.y + rect.height - delta3; + const clipX0 = clipBBox.x; + const clipX1 = clipBBox.x + clipBBox.width; + const clipY0 = clipBBox.y; + const clipY1 = clipBBox.y + clipBBox.height; + return Math.max(x0, clipX0) <= Math.min(x1, clipX1) && Math.max(y0, clipY0) <= Math.min(y1, clipY1); +} +function hasClipBBox(datum) { + const { clipX0, clipX1, clipY0, clipY1 } = datum; + return clipX0 != null && clipX1 != null || clipY0 != null && clipY1 != null; +} +function computeClipBBox(datum) { + if (!hasClipBBox(datum)) + return; + const { x0, y0, x1, y1 } = datum; + const { x, y, width, height } = datumRect(datum); + let { clipX0, clipX1, clipY0, clipY1 } = datum; + if (clipX0 == null || clipX1 == null) { + clipX0 = x0; + clipX1 = x1; + } + if (clipY0 == null || clipY1 == null) { + clipY0 = y0; + clipY1 = y1; + } + const clipX = Math.min(clipX0, clipX1); + const clipY = Math.min(clipY0, clipY1); + const clipWidth = Math.abs(clipX1 - clipX0); + const clipHeight = Math.abs(clipY1 - clipY0); + clipX0 = Math.max(x, clipX); + clipY0 = Math.max(y, clipY); + clipX1 = Math.min(x + width, clipX + clipWidth); + clipY1 = Math.min(y + height, clipY + clipHeight); + return new BBox18( + Math.min(clipX0, clipX1), + Math.min(clipY0, clipY1), + Math.abs(clipX1 - clipX0), + Math.abs(clipY1 - clipY0) + ); +} +function prepareLinearGaugeSeriesAnimationFunctions(initialLoad, horizontal) { + const phase = initialLoad ? "initial" : "update"; + const node = { + fromFn(sect, datum) { + const previousDatum = sect.previousDatum; + let { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1 } = previousDatum ?? datum; + const { horizontalInset, verticalInset } = datum; + const previousHadClipBBox = previousDatum != null && hasClipBBox(previousDatum); + const nextHasClipBBox = hasClipBBox(datum); + if (previousHadClipBBox && nextHasClipBBox) { + } else if (!previousHadClipBBox && nextHasClipBBox) { + ({ x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1 } = datum); + if (initialLoad) { + if (horizontal) { + clipX1 = datum.clipX0; + } else { + clipY1 = datum.clipY0; + } + } + } else if (previousHadClipBBox && !nextHasClipBBox) { + ({ x0, y0, x1, y1 } = datum); + clipX0 = void 0; + clipY0 = void 0; + clipX1 = void 0; + clipY1 = void 0; + } else if (initialLoad) { + if (horizontal) { + x1 = x0; + } else { + y1 = y0; + } + } + return { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset, phase }; + }, + toFn(_sect, datum) { + const { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset } = datum; + return { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset }; + }, + applyFn(rect, params) { + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, params)); + } + }; + return { node }; +} +function resetLinearGaugeSeriesResetRectFunction(_node, datum) { + const { x, y, width, height } = datumRect(datum); + const clipBBox = computeClipBBox(datum); + const visible = clipBBoxVisibility(datum, clipBBox); + return { x, y, width, height, clipBBox, visible }; +} +var horizontalTextAligns = { + ["Before" /* Before */]: "right", + ["Center" /* Center */]: "center", + ["After" /* After */]: "left" +}; +var verticalTextBaselines = { + ["Before" /* Before */]: "top", + ["Center" /* Center */]: "middle", + ["After" /* After */]: "bottom" +}; +var horizontalAlignFactors = { + ["Before" /* Before */]: -1, + ["Center" /* Center */]: -0.5, + ["After" /* After */]: 0 +}; +var verticalAlignFactors2 = { + ["Before" /* Before */]: 0, + ["Center" /* Center */]: -0.5, + ["After" /* After */]: -1 +}; +function formatLinearGaugeLabels(series, ctx, selection, opts, bboxes, datumOverrides) { + const { seriesRect, gaugeRect, barRect } = bboxes; + const { padding, horizontal } = opts; + selection.each((label, labelDatum) => { + const labelText = getLabelText(series.id, ctx, labelDatum, datumOverrides?.label); + let boundingWidth; + let boundingHeight; + if (labelDatum.placement === "outside-start") { + if (horizontal) { + boundingWidth = gaugeRect.x; + boundingHeight = seriesRect.height; + } else { + boundingWidth = seriesRect.width; + boundingHeight = seriesRect.height - (gaugeRect.y + gaugeRect.height); + } + } else if (labelDatum.placement === "outside-end") { + if (horizontal) { + boundingWidth = seriesRect.width - (gaugeRect.x + gaugeRect.width); + boundingHeight = seriesRect.height; + } else { + boundingWidth = seriesRect.width; + boundingHeight = gaugeRect.y; + } + } else if (labelDatum.avoidCollisions) { + boundingWidth = gaugeRect.width; + boundingHeight = gaugeRect.height; + } + let layout; + if (labelText == null) { + return; + } else if (boundingWidth != null && boundingHeight != null) { + const sizeFittingHeight = () => ({ + width: boundingWidth, + height: boundingHeight, + meta: null + }); + const labelMeta = formatSingleLabel(toPlainText6(labelText), labelDatum, { padding }, sizeFittingHeight); + layout = labelMeta?.[0]; + } else { + const measurer2 = cachedTextMeasurer6(labelDatum); + const { width, height } = isArray3(labelText) ? measureTextSegments2(labelText, labelDatum) : measurer2.measureLines(labelText); + layout = { + text: labelText, + fontSize: labelDatum.fontSize, + lineHeight: labelDatum.lineHeight ?? measurer2.lineHeight(), + width, + height + }; + } + if (layout == null) { + label.visible = false; + return; + } + const scale0 = horizontal ? gaugeRect.x : gaugeRect.y + gaugeRect.height; + const scale1 = horizontal ? gaugeRect.x + gaugeRect.width : gaugeRect.y; + const bar0 = horizontal ? barRect.x : barRect.y + barRect.height; + const bar1 = horizontal ? barRect.x + barRect.width : barRect.y; + const offset = labelDatum.spacing * (horizontal ? 1 : -1); + let bounds0; + let bounds1; + let s; + let align; + switch (labelDatum.placement) { + case "outside-start": + bounds0 = -Infinity; + bounds1 = Infinity; + s = scale0 - offset; + align = "Before" /* Before */; + break; + case "outside-end": + bounds0 = -Infinity; + bounds1 = Infinity; + s = scale1 + offset; + align = "After" /* After */; + break; + case "inside-start": + bounds0 = scale0; + bounds1 = bar1; + s = scale0 + offset; + align = "After" /* After */; + break; + case "inside-end": + bounds0 = bar1; + bounds1 = scale1; + s = scale1 - offset; + align = "Before" /* Before */; + break; + case "inside-center": + bounds0 = scale0; + bounds1 = scale1; + s = (scale0 + scale1) / 2; + align = "Center" /* Center */; + break; + case "bar-inside": + bounds0 = bar0; + bounds1 = bar1; + s = (bar0 + bar1) / 2; + align = "Center" /* Center */; + break; + case "bar-inside-end": + bounds0 = bar0; + bounds1 = bar1; + s = bar1 - offset; + align = "Before" /* Before */; + break; + case "bar-outside-end": + bounds0 = bar1; + bounds1 = scale1; + s = bar1 + offset; + align = "After" /* After */; + break; + case "bar-end": + bounds0 = -Infinity; + bounds1 = Infinity; + s = bar1; + align = "Center" /* Center */; + break; + } + const x = horizontal ? s : gaugeRect.x + gaugeRect.width / 2; + const y = horizontal ? gaugeRect.y + gaugeRect.height / 2 : s; + let s0; + let s1; + if (horizontal) { + s0 = x + horizontalAlignFactors[align] * layout.width; + s1 = s0 + layout.width; + } else { + s0 = y + verticalAlignFactors2[align] * layout.height; + s1 = s0 + layout.height; + } + const inside = Math.min(s0, s1) >= Math.min(bounds0, bounds1) && Math.max(s0, s1) <= Math.max(bounds0, bounds1); + if (labelDatum.avoidCollisions && !inside) { + label.visible = false; + return; + } + label.visible = true; + label.text = layout.text; + label.fontSize = layout.fontSize; + label.lineHeight = layout.lineHeight; + label.textAlign = horizontal ? horizontalTextAligns[align] : "center"; + label.textBaseline = horizontal ? "middle" : verticalTextBaselines[align]; + label.x = x; + label.y = y; + }); +} + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeSeries.ts +var { + fromToMotion: fromToMotion2, + resetMotion: resetMotion3, + SeriesNodePickMode: SeriesNodePickMode8, + StateMachine: StateMachine12, + createDatumId: createDatumId9, + toRadians: toRadians4, + BBox: BBox19, + Group: Group11, + PointerEvents: PointerEvents5, + Selection: Selection7, + Rect: Rect7, + Text: Text3, + TransformableText: TransformableText2, + Marker: Marker3, + LinearScale: LinearScale4, + generateTicks: generateTicks2, + NiceMode, + easing, + findRangeExtent: findRangeExtent2, + tickFormat, + mergeDefaults: mergeDefaults12, + applyShapeStyle: applyShapeStyle10 +} = _ModuleSupport201; +var horizontalTargetPlacementRotation = { + before: 180, + middle: 0, + after: 0 +}; +var verticalTargetPlacementRotation = { + before: 90, + middle: 0, + after: -90 +}; +var LinearGaugeSeries = class extends _ModuleSupport201.Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode8.EXACT_SHAPE_MATCH, SeriesNodePickMode8.NEAREST_NODE] + }); + this.properties = new LinearGaugeSeriesProperties(); + this.seriesRect = BBox19.NaN; + this.gaugeRect = BBox19.NaN; + this.scale = new LinearScale4(); + this.originX = 0; + this.originY = 0; + this.scaleGroup = this.contentGroup.appendChild(new Group11({ name: "scaleGroup" })); + this.itemGroup = this.contentGroup.appendChild(new Group11({ name: "itemGroup" })); + this.itemTargetGroup = this.contentGroup.appendChild(new Group11({ name: "itemTargetGroup" })); + this.itemTargetLabelGroup = this.contentGroup.appendChild(new Group11({ name: "itemTargetLabelGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group11({ name: "itemLabelGroup" })); + this.highlightTargetGroup = this.highlightGroup.appendChild( + new Group11({ name: "itemTargetLabelGroup" }) + ); + this.tickGroup = this.contentGroup.appendChild(new Group11({ name: "tickGroup" })); + this.scaleSelection = Selection7.select( + this.scaleGroup, + () => this.nodeFactory() + ); + this.datumSelection = Selection7.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.targetSelection = Selection7.select( + this.itemTargetGroup, + () => this.markerFactory() + ); + this.targetLabelSelection = Selection7.select(this.itemTargetLabelGroup, Text3); + this.labelSelection = Selection7.select( + this.itemLabelGroup, + Text3 + ); + this.highlightTargetSelection = Selection7.select(this.highlightTargetGroup, () => this.markerFactory()); + this.tickSelection = Selection7.select(this.tickGroup, TransformableText2); + this.datumUnion = new DatumUnion(); + this.animationState = new StateMachine12("empty", { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.animateReadyResize(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateWaitingUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty" + }, + reset: "empty", + skip: "ready" + } + }); + this.scaleGroup.pointerEvents = PointerEvents5.None; + this.tickGroup.pointerEvents = PointerEvents5.None; + } + get range() { + return this.horizontal ? [0, this.gaugeRect.width] : [0, this.gaugeRect.height]; + } + get horizontal() { + return this.properties.direction === "horizontal"; + } + get hasData() { + return true; + } + nodeFactory() { + const rect = new Rect7(); + rect.crisp = true; + return rect; + } + markerFactory() { + return new Marker3(); + } + processData() { + this.nodeDataRefresh = true; + this.animationState.transition("updateData"); + } + formatLabel(value) { + return formatLabel(value, this.properties.scale); + } + getShapeFillBBox() { + const { properties, originX, originY, horizontal, scale } = this; + const { thickness } = properties; + const length = findRangeExtent2(scale.range); + const bbox = new BBox19(originX, originY, horizontal ? length : thickness, horizontal ? thickness : length); + return { + axis: bbox, + series: bbox + }; + } + getTargets() { + const { properties } = this; + const defaultTarget = properties.defaultTarget; + return Array.from(properties.targets).map((target) => { + const { + text: text2 = defaultTarget.text, + value = defaultTarget.value ?? 0, + shape = defaultTarget.shape ?? "triangle", + rotation = defaultTarget.rotation ?? 0, + placement = defaultTarget.placement ?? "middle", + spacing = defaultTarget.spacing ?? 0, + size = defaultTarget.size ?? 0 + } = target; + const { + enabled: labelEnabled = defaultTarget.label.enabled, + color: labelColor = defaultTarget.label.color ?? "black", + fontStyle: labelFontStyle = defaultTarget.label.fontStyle ?? "normal", + fontWeight: labelFontWeight = defaultTarget.label.fontWeight ?? "normal", + fontSize: labelFontSize = defaultTarget.label.fontSize, + fontFamily: labelFontFamily = defaultTarget.label.fontFamily, + spacing: labelSpacing = defaultTarget.label.spacing ?? 0 + } = target.label; + return { + text: text2, + value, + shape, + placement, + spacing, + size, + rotation, + label: { + enabled: labelEnabled, + color: labelColor, + fontStyle: labelFontStyle, + fontWeight: labelFontWeight, + fontSize: labelFontSize, + fontFamily: labelFontFamily, + spacing: labelSpacing + }, + style: target.getStyle(defaultTarget) + }; + }); + } + getTargetPoint(target) { + const { properties, originX, originY, horizontal, scale, gaugeRect } = this; + const { thickness } = properties; + const { value, placement, spacing, size } = target; + const mainOffset = scale.convert(value); + let crossOffset; + switch (placement) { + case "before": + crossOffset = -(spacing + size / 2); + break; + case "after": + crossOffset = thickness + spacing + size / 2; + break; + default: + crossOffset = thickness / 2; + break; + } + return { + x: originX + gaugeRect.x + (horizontal ? mainOffset : crossOffset), + y: originY + gaugeRect.y + (horizontal ? crossOffset : mainOffset) + }; + } + getTargetLabel(target) { + const { size, placement, label } = target; + const { spacing, color: fill, fontStyle, fontWeight, fontSize, fontFamily } = label; + const lineHeight = void 0; + const offset = size / 2 + spacing; + let textAlign; + let textBaseline; + let offsetX = 0; + let offsetY = 0; + if (this.horizontal) { + textAlign = "center"; + if (placement === "after") { + textBaseline = "top"; + offsetY = offset; + } else { + textBaseline = "bottom"; + offsetY = -offset; + } + } else { + textBaseline = "middle"; + if (placement === "before") { + textAlign = "right"; + offsetX = -offset; + } else { + textAlign = "left"; + offsetX = offset; + } + } + return { + offsetX, + offsetY, + fill, + textAlign, + textBaseline, + fontStyle, + fontWeight, + fontSize, + fontFamily, + lineHeight + }; + } + labelDatum(label, value) { + const { + placement, + avoidCollisions, + spacing, + text: text2, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + wrapping, + overflowStrategy, + formatter = (params) => this.formatLabel(params.value) + } = label; + return { + placement, + avoidCollisions, + spacing, + text: text2, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + wrapping, + overflowStrategy, + formatter + }; + } + verticalLabelInset() { + const { label } = this.properties; + const measurer2 = cachedTextMeasurer7(label); + const lines = label.text?.split("\n"); + const labelSize = (label.lineHeight ?? measurer2.lineHeight()) * (lines?.length ?? 1); + return label.spacing + labelSize; + } + horizontalLabelInset() { + const { scale, properties } = this; + const { scale: scaleProps, label } = properties; + const lines = label.text?.split("\n"); + const measurer2 = cachedTextMeasurer7(label); + const ticks = scaleProps.interval.values ?? scale.ticks({ + nice: false, + interval: scaleProps.interval.step, + minTickCount: 0, + maxTickCount: 6, + tickCount: 5 + })?.ticks ?? []; + const linesOrTicks = lines ?? ticks?.map((tick) => getLabelText(this.id, this.ctx, this.labelDatum(label, tick)) ?? ""); + const labelSize = linesOrTicks.reduce((accum, text2) => { + const { width } = isArray4(text2) ? measureTextSegments3(text2, label) : measurer2.measureLines(text2); + return Math.max(accum, width); + }, 0); + return label.spacing + labelSize; + } + tickFormatter(domain, ticks) { + const { format, formatter } = this.properties.scale.label; + let tickFormatter; + if (format != null) { + tickFormatter = tickFormat(ticks, typeof format === "string" ? format : void 0); + } + return (value, index) => { + let r = void 0; + if (formatter) { + r ?? (r = formatWithContext(this.ctx, formatter, { value, index, domain, boundSeries: void 0 })); + } + r ?? (r = tickFormatter?.(value)); + return r ?? this.formatLabel(value); + }; + } + createNodeData() { + const { id: seriesId, properties, horizontal, scale, seriesRect } = this; + const { + value, + segmentation, + thickness, + cornerRadius, + cornerMode, + bar, + scale: scaleProps, + label, + defaultColorRange + } = properties; + scale.domain = [scaleProps.min, scaleProps.max]; + scale.range = horizontal ? [0, seriesRect.width] : [seriesRect.height, 0]; + let axisRotation; + let sideFlag; + if (horizontal) { + sideFlag = 1; + axisRotation = Math.PI / 2; + } else if (scaleProps.label.placement === "before") { + sideFlag = 1; + axisRotation = 0; + } else { + sideFlag = -1; + axisRotation = 0; + } + let x0; + let x1; + let y0; + let y1; + if (horizontal) { + x0 = 0; + x1 = seriesRect.width; + y0 = (seriesRect.height - thickness) / 2; + y1 = y0 + thickness; + if (label.placement === "outside-start") { + x0 += this.horizontalLabelInset(); + } else if (label.placement === "outside-end") { + x1 -= this.horizontalLabelInset(); + } + } else { + x0 = (seriesRect.width - thickness) / 2; + x1 = x0 + thickness; + y1 = 0; + y0 = seriesRect.height; + if (label.placement === "outside-start") { + y0 -= this.verticalLabelInset(); + } else if (label.placement === "outside-end") { + y1 += this.verticalLabelInset(); + } + } + this.gaugeRect = new BBox19(Math.min(x0, x1), Math.min(y0, y1), Math.abs(x1 - x0), Math.abs(y1 - y0)); + const originX = 0; + const originY = 0; + scale.domain = [scaleProps.min, scaleProps.max]; + scale.range = horizontal ? [x0, x1] : [y0, y1]; + const { + tickData: { ticks: tickData } + } = generateTicks2({ + scale, + label: this.properties.scale.label, + interval: this.properties.scale.interval, + tickFormatter: (domain, ticks) => this.tickFormatter(domain, ticks), + domain: scale.domain, + range: this.range, + reverse: false, + primaryTickCount: void 0, + defaultTickMinSpacing: 0, + visibleRange: [0, 1], + niceMode: NiceMode.Off, + labelOffset: 0, + axisRotation, + sideFlag + }); + const isReversed = false; + const targets = this.getTargets(); + const nodeData = []; + const targetData = []; + const labelData = []; + const scaleData = []; + const [m0, m1] = scale.range; + const mainAxisSize = Math.abs(m1 - m0); + const containerX = horizontal ? scale.convert(value) : x1; + const containerY = horizontal ? y1 : scale.convert(value); + const inset = segmentation.enabled ? segmentation.spacing / 2 : 0; + const horizontalInset = horizontal ? inset : 0; + const verticalInset = horizontal ? 0 : inset; + const barThickness = Math.min(bar.thickness ?? Math.round(bar.thicknessRatio * thickness), thickness); + const barInset = -(thickness - barThickness) / 2; + const barXInset = horizontal ? 0 : barInset; + const barYInset = horizontal ? barInset : 0; + const cornersOnAllItems = cornerMode === "item"; + const maxTicks = Math.ceil(mainAxisSize); + let segments = segmentation.enabled ? segmentation.interval.getSegments(scale, maxTicks) : void 0; + const barStyle = bar.getStyle(defaultColorRange, horizontal, scale); + const scaleStyle = scaleProps.getStyle(bar.enabled, defaultColorRange, horizontal, scale); + if (segments == null && cornersOnAllItems) { + const segmentStart = Math.min(...scale.domain); + const segmentEnd = Math.max(...scale.domain); + const datum = { value, segmentStart, segmentEnd }; + if (bar.enabled) { + const barAppliedCornerRadius = Math.min(cornerRadius, barThickness / 2, mainAxisSize / 2); + const barCornerInset = barAppliedCornerRadius * (isReversed ? -1 : 1); + const barCornerXInset = horizontal ? barCornerInset : 0; + const barCornerYInset = horizontal ? 0 : barCornerInset; + nodeData.push({ + series: this, + itemId: `value`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + x0 - barCornerXInset - barXInset, + y0: originY + y0 - barCornerYInset - barYInset, + x1: originX + containerX + barCornerXInset + barXInset, + y1: originY + containerY + barCornerYInset + barYInset, + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius: cornerRadius, + topRightCornerRadius: cornerRadius, + bottomRightCornerRadius: cornerRadius, + bottomLeftCornerRadius: cornerRadius, + horizontalInset, + verticalInset, + style: barStyle + }); + } + const scaleAppliedCornerRadius = Math.min(cornerRadius, thickness / 2, mainAxisSize / 2); + const scaleCornerInset = scaleAppliedCornerRadius * (isReversed ? -1 : 1); + const scaleCornerXInset = horizontal ? scaleCornerInset : 0; + const scaleCornerYInset = horizontal ? 0 : scaleCornerInset; + scaleData.push({ + series: this, + itemId: `scale`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + x0 - scaleCornerXInset, + y0: originY + y0 - scaleCornerYInset, + x1: originX + x1 + scaleCornerXInset, + y1: originY + y1 + scaleCornerYInset, + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius: cornerRadius, + topRightCornerRadius: cornerRadius, + bottomRightCornerRadius: cornerRadius, + bottomLeftCornerRadius: cornerRadius, + horizontalInset, + verticalInset, + style: scaleStyle + }); + } else { + segments ?? (segments = scale.domain); + const clipX0 = originX + x0 - barXInset; + const clipY0 = originY + y0 - barYInset; + const clipX1 = originX + containerX + barXInset; + const clipY1 = originY + containerY + barYInset; + for (let i = 0; i < segments.length - 1; i += 1) { + const segmentStart = segments[i + 0]; + const segmentEnd = segments[i + 1]; + const datum = { value, segmentStart, segmentEnd }; + const isStart = i === 0; + const isEnd = i === segments.length - 2; + const itemStart = scale.convert(segmentStart); + const itemEnd = scale.convert(segmentEnd); + const startCornerRadius = cornersOnAllItems || isStart ? cornerRadius : 0; + const endCornerRadius = cornersOnAllItems || isEnd ? cornerRadius : 0; + const topLeftCornerRadius = horizontal ? startCornerRadius : endCornerRadius; + const topRightCornerRadius = endCornerRadius; + const bottomRightCornerRadius = horizontal ? endCornerRadius : startCornerRadius; + const bottomLeftCornerRadius = startCornerRadius; + if (bar.enabled) { + nodeData.push({ + series: this, + itemId: `value-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + (horizontal ? itemStart : x0), + y0: originY + (horizontal ? y0 : itemStart), + x1: originX + (horizontal ? itemEnd : x1), + y1: originY + (horizontal ? y1 : itemEnd), + clipX0, + clipY0, + clipX1, + clipY1, + topLeftCornerRadius, + topRightCornerRadius, + bottomRightCornerRadius, + bottomLeftCornerRadius, + horizontalInset, + verticalInset, + style: barStyle + }); + } + scaleData.push({ + series: this, + itemId: `scale-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + x0: originX + (horizontal ? itemStart : x0), + y0: originY + (horizontal ? y0 : itemStart), + x1: originX + (horizontal ? itemEnd : x1), + y1: originY + (horizontal ? y1 : itemEnd), + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius, + topRightCornerRadius, + bottomRightCornerRadius, + bottomLeftCornerRadius, + horizontalInset, + verticalInset, + style: scaleStyle + }); + } + } + if (label.enabled) { + labelData.push(this.labelDatum(label, value)); + } + const targetPlacementRotation2 = horizontal ? horizontalTargetPlacementRotation : verticalTargetPlacementRotation; + for (let i = 0; i < targets.length; i += 1) { + const target = targets[i]; + const { value: targetValue, text: text2, shape, size, style } = target; + const targetPoint = this.getTargetPoint(target); + const targetRotation = toRadians4(target.rotation + targetPlacementRotation2[target.placement]); + targetData.push({ + series: this, + itemId: `target-${i}`, + midPoint: targetPoint, + datum: { value: targetValue }, + datumIndex: { type: 1 /* Target */, index: i }, + type: 1 /* Target */, + value: targetValue, + text: text2, + x: targetPoint.x, + y: targetPoint.y, + shape, + size, + rotation: targetRotation, + label: this.getTargetLabel(target), + style + }); + } + return { + itemId: seriesId, + nodeData, + tickData, + targetData, + labelData, + scaleData + }; + } + updateSelections(resize) { + if (this.nodeDataRefresh || resize) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + highlightDatum(node) { + if (node != null && node.series === this && node.type === 1 /* Target */) { + return node; + } + } + update({ seriesRect }) { + const { + datumSelection, + labelSelection, + targetSelection, + targetLabelSelection, + scaleSelection, + highlightTargetSelection, + tickSelection + } = this; + this.seriesRect = seriesRect ?? BBox19.NaN; + const resize = this.checkResize(seriesRect); + this.updateSelections(resize); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const targetData = this.contextNodeData?.targetData ?? []; + const scaleData = this.contextNodeData?.scaleData ?? []; + const tickData = this.contextNodeData?.tickData ?? []; + const highlightTargetDatum = this.highlightDatum(this.ctx.highlightManager.getActiveHighlight()); + this.scaleSelection = this.updateScaleSelection({ scaleData, scaleSelection }); + this.updateScaleNodes({ scaleSelection }); + this.targetSelection = this.updateTargetSelection({ targetData, targetSelection }); + this.updateTargetNodes({ targetSelection, isHighlight: false }); + this.targetLabelSelection = this.updateTargetLabelSelection({ targetData, targetLabelSelection }); + this.updateTargetLabelNodes({ targetLabelSelection }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightTargetSelection = this.updateTargetSelection({ + targetData: highlightTargetDatum == null ? [] : [highlightTargetDatum], + targetSelection: highlightTargetSelection + }); + this.updateTargetNodes({ targetSelection: highlightTargetSelection, isHighlight: true }); + this.tickSelection = this.updateTickSelection({ tickData, tickSelection }); + this.updateTickNodes({ tickSelection }); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => { + return createDatumId9(opts.nodeData.length, datum.itemId); + }); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + const { ctx } = this; + const animationDisabled = ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle10(rect, datum.style, fillBBox); + rect.topLeftCornerRadius = topLeftCornerRadius; + rect.topRightCornerRadius = topRightCornerRadius; + rect.bottomRightCornerRadius = bottomRightCornerRadius; + rect.bottomLeftCornerRadius = bottomLeftCornerRadius; + rect.pointerEvents = this.properties.bar.enabled ? _ModuleSupport201.PointerEvents.All : _ModuleSupport201.PointerEvents.None; + if (animationDisabled || rect.previousDatum == null) { + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + } + }); + const { horizontal } = this; + this.datumUnion.update(datumSelection, this.itemGroup, _ModuleSupport201.Rect, (node, first, last) => { + const left = Math.min(first.x, last.x); + const right = Math.max(first.x + first.width, last.x + last.width); + const top = Math.min(first.y, last.y); + const bottom = Math.max(first.y + first.height, last.y + last.height); + const width = right - left; + const height = bottom - top; + node.pointerEvents = _ModuleSupport201.PointerEvents.None; + node.x = left; + node.y = top; + node.width = width; + node.height = height; + node.topLeftCornerRadius = horizontal ? first.topLeftCornerRadius : last.topLeftCornerRadius; + node.topRightCornerRadius = last.topRightCornerRadius; + node.bottomRightCornerRadius = horizontal ? last.bottomRightCornerRadius : first.bottomRightCornerRadius; + node.bottomLeftCornerRadius = first.bottomLeftCornerRadius; + const firstClipBBox = first.clipBBox; + const lastClipBBox = last.clipBBox ?? firstClipBBox; + if (firstClipBBox && lastClipBBox) { + node.clipBBox = BBox19.merge([firstClipBBox, lastClipBBox]).intersection( + horizontal ? new BBox19(left, -Infinity, width, Infinity) : new BBox19(-Infinity, top, Infinity, height) + ); + } else { + node.clipBBox = void 0; + } + }); + } + updateScaleSelection(opts) { + return opts.scaleSelection.update(opts.scaleData, void 0, (datum) => { + return createDatumId9(opts.scaleData.length, datum.itemId); + }); + } + updateScaleNodes(opts) { + const { scaleSelection } = opts; + const fillBBox = this.getShapeFillBBox(); + scaleSelection.each((rect, datum) => { + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle10(rect, datum.style, fillBBox); + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + rect.topLeftCornerRadius = topLeftCornerRadius; + rect.topRightCornerRadius = topRightCornerRadius; + rect.bottomRightCornerRadius = bottomRightCornerRadius; + rect.bottomLeftCornerRadius = bottomLeftCornerRadius; + rect.setProperties(resetLinearGaugeSeriesResetRectFunction(rect, datum)); + }); + } + updateTargetSelection(opts) { + return opts.targetSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetNodes(opts) { + const { targetSelection, isHighlight } = opts; + targetSelection.each((target, datum) => { + const { x, y, shape, size, rotation } = datum; + const style = this.getTargetStyle(isHighlight, datum); + applyShapeStyle10(target, style); + target.size = size; + target.shape = shape === "line" ? lineMarker : shape; + target.translationX = x; + target.translationY = y; + target.rotation = rotation; + }); + } + getTargetStyle(isHighlight, { datumIndex, style }) { + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + return mergeDefaults12(highlightStyle, { + ...style, + opacity: 1 + }); + } + updateTargetLabelSelection(opts) { + return opts.targetLabelSelection.update(opts.targetData); + } + updateTargetLabelNodes(opts) { + const { targetLabelSelection } = opts; + targetLabelSelection.each((label, target) => { + const { x, y, text: text2 } = target; + const { offsetX, offsetY, fill, fontStyle, fontWeight, fontSize, fontFamily, textAlign, textBaseline } = target.label; + label.visible = true; + label.x = x + offsetX; + label.y = y + offsetY; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + }); + } + updateTickSelection(opts) { + return opts.tickSelection.update(opts.tickData, void 0, (datum) => datum.tickId); + } + updateTickNodes(opts) { + const { gaugeRect, properties } = this; + const defaultScale = properties.defaultScale; + const { + enabled, + color: color6, + fontFamily = defaultScale.label.fontFamily, + fontSize = defaultScale.label.fontSize, + fontStyle, + fontWeight = defaultScale.label.fontWeight, + spacing + } = properties.scale.label; + let { placement } = properties.scale.label; + const rotation = toRadians4(properties.scale.label.rotation ?? 0); + let textAlign; + let textBaseline; + let textX; + let textY; + if (this.horizontal) { + placement ?? (placement = "after"); + textAlign = "center"; + textBaseline = placement === "before" ? "bottom" : "top"; + textY = this.originY + gaugeRect.y + (placement === "before" ? -spacing : gaugeRect.height + spacing); + } else { + placement ?? (placement = "before"); + textAlign = placement === "before" ? "end" : "start"; + textBaseline = "middle"; + textX = this.originX + gaugeRect.x + (placement === "before" ? -spacing : gaugeRect.width + spacing); + } + opts.tickSelection.each((label, datum) => { + if (!enabled) { + label.visible = false; + return; + } + const x = textX ?? datum.translation; + const y = textY ?? datum.translation; + label.visible = true; + label.text = datum.tickLabel; + label.fill = color6; + label.fontFamily = fontFamily; + label.fontSize = fontSize; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.textBaseline = textBaseline; + label.textAlign = textAlign; + label.x = x; + label.y = y; + label.rotationCenterX = x; + label.rotationCenterY = y; + label.rotation = rotation; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(opts.labelData, void 0, (_datum) => "primary"); + } + updateLabelNodes(opts) { + const { labelSelection } = opts; + const animationDisabled = this.ctx.animationManager.isSkipped(); + labelSelection.each((label, datum) => { + label.fill = datum.fill; + label.fontStyle = datum.fontStyle; + label.fontWeight = datum.fontWeight; + label.fontFamily = datum.fontFamily; + }); + if (animationDisabled || this.labelsHaveExplicitText()) { + this.formatLabelText(); + } + } + labelsHaveExplicitText() { + for (const { datum } of this.labelSelection) { + if (datum.text == null) { + return false; + } + } + return true; + } + formatLabelText(datum) { + const { labelSelection, horizontal, scale, seriesRect, gaugeRect } = this; + const { x, y, width, height } = gaugeRect; + const value = datum?.label ?? this.properties.value; + let barRect; + if (horizontal) { + const xValue2 = scale.convert(value); + barRect = new BBox19(x, y, xValue2 - x, height); + } else { + const yValue = scale.convert(value); + barRect = new BBox19(x, yValue, width, height - yValue); + } + const bboxes = { seriesRect, gaugeRect, barRect }; + const { margin: padding } = this.properties; + formatLinearGaugeLabels(this, this.ctx, labelSelection, { padding, horizontal }, bboxes, datum); + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + resetMotion3([this.datumSelection], resetLinearGaugeSeriesResetRectFunction); + this.formatLabelText(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + animateLabelText(params = {}) { + const { animationManager } = this.ctx; + let labelFrom = 0; + let labelTo = 0; + this.labelSelection.each((label, datum) => { + label.opacity = 1; + labelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + labelTo = datum.value; + }); + if (this.labelsHaveExplicitText()) { + } else if (labelFrom === labelTo) { + this.formatLabelText({ label: labelTo }); + } else { + const animationId = `${this.id}_labels`; + animationManager.animate({ + id: animationId, + groupId: "label", + from: { label: labelFrom }, + to: { label: labelTo }, + phase: params.phase ?? "update", + ease: easing.easeOut, + onUpdate: (datum) => this.formatLabelText(datum), + onStop: () => this.formatLabelText({ label: labelTo }) + }); + } + } + animateEmptyUpdateReady() { + const { animationManager } = this.ctx; + const { node } = prepareLinearGaugeSeriesAnimationFunctions(true, this.horizontal); + fromToMotion2(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion2(this.id, "label", animationManager, [this.labelSelection], fadeInFns, () => "primary"); + this.animateLabelText({ from: 0, phase: "initial" }); + } + animateWaitingUpdateReady() { + const { animationManager } = this.ctx; + const { node } = prepareLinearGaugeSeriesAnimationFunctions(false, this.horizontal); + fromToMotion2(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + this.animateLabelText(); + } + animateReadyResize() { + this.resetAllAnimation(); + } + getSeriesDomain() { + return [0, 1]; + } + dataCount() { + return Number.NaN; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData() { + return []; + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties } = this; + const { tooltip } = properties; + if (datumIndex == null) + return; + let value; + let text2; + let fallbackLabel; + if (datumIndex.type === 0 /* Node */) { + value = properties.value; + text2 = properties.label.text; + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeValue"); + } else { + ({ value, text: text2 } = properties.targets[datumIndex.index]); + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeTarget"); + } + if (value == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + data: [{ label: text2, fallbackLabel, value: this.formatLabel(value) }] + }, + { seriesId, title: void 0, datum: void 0, value } + ); + } + pickNodeClosestDatum(point) { + return pickGaugeNearestDatum(this, point); + } + pickFocus(opts) { + return pickGaugeFocus(this, opts); + } + getCaptionText() { + return this.formatLabel(this.properties.value); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +LinearGaugeSeries.className = "LinearGaugeSeries"; +LinearGaugeSeries.type = "linear-gauge"; + +// packages/ag-charts-enterprise/src/series/linear-gauge/linearGaugeModule.ts +var LinearGaugeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "linear-gauge", + moduleFactory: (ctx) => new LinearGaugeSeries(ctx), + themeTemplate: { + minWidth: 200, + minHeight: 200, + tooltip: { + enabled: false + }, + series: { + thickness: 50, + defaultColorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $interpolate: [{ $palette: "secondDivergingColors" }, 5] }, + _ModuleSupport202.SAFE_RANGE2_OPERATION + ] + }, + scale: { + // @ts-expect-error undocumented option + defaultFill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + stroke: { $path: ["/2", _ModuleSupport202.SAFE_STROKE_FILL_OPERATION, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + spacing: 11 + } + }, + bar: { + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + segmentation: { + enabled: false, + interval: {}, + spacing: 1 + }, + defaultTarget: { + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + size: 10, + shape: "triangle", + placement: "after", + spacing: 5, + label: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 5 + } + }, + defaultScale: { + label: { + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + } + }, + label: { + ..._ModuleSupport202.LABEL_BOXING_DEFAULTS, + enabled: false, + placement: "inside-start", + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: 2 }, + minimumFontSize: _ModuleSupport202.FONT_SIZE.SMALL, + spacing: 18, + color: { $ref: "chartBackgroundColor" } + }, + margin: 4, + tooltip: { + range: { $path: ["/tooltip/range", 10] } + } + } + } +}; +var LinearGaugeSeriesModule = { + type: "series", + name: "linear-gauge", + chartType: "standalone", + enterprise: true, + options: _ModuleSupport202.linearGaugeSeriesOptionsDef, + create: (ctx) => new LinearGaugeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineModule.ts +import { _ModuleSupport as _ModuleSupport211 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/map-util/mapThemeDefaults.ts +import { _ModuleSupport as _ModuleSupport203 } from "ag-charts-community"; +var MAP_THEME_DEFAULTS = { + zoom: { + axes: "xy", + anchorPointX: "pointer", + anchorPointY: "pointer", + buttons: { + // @ts-expect-error undocumented options + anchorPointX: "middle", + anchorPointY: "middle" + } + }, + legend: { + enabled: false + }, + gradientLegend: { + enabled: false, + ..._ModuleSupport203.LEGEND_CONTAINER_THEME + } +}; +function applyMapPalette(object) { + const clone = _ModuleSupport203.deepClone(object); + _ModuleSupport203.jsonWalk(clone, (value) => { + if (typeof value === "object" && "$palette" in value) { + value["$mapPalette"] = value["$palette"]; + delete value["$palette"]; + } + }); + return clone; +} + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeries.ts +import { _ModuleSupport as _ModuleSupport209 } from "ag-charts-community"; +import { Logger as Logger16, cachedTextMeasurer as cachedTextMeasurer8 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/map-util/geoGeometry.ts +import { _ModuleSupport as _ModuleSupport205 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/map-util/lineStringUtil.ts +var delta2 = 1e-9; +function lineSegmentDistanceToPointSquared(a, b, x, y) { + const [ax, ay] = a; + const [bx, by] = b; + const abx = bx - ax; + const aby = by - ay; + const l = abx * abx + aby * aby; + let x0; + let y0; + if (Math.abs(l) < delta2) { + x0 = ax; + y0 = ay; + } else { + let t = ((x - ax) * abx + (y - ay) * aby) / l; + t = Math.max(0, Math.min(1, t)); + x0 = ax + t * (bx - ax); + y0 = ay + t * (by - ay); + } + const dx2 = x - x0; + const dy2 = y - y0; + return dx2 * dx2 + dy2 * dy2; +} +function lineStringDistance(lineString, x, y) { + let minDistanceSquared = Infinity; + let p0 = lineString.at(-1); + for (const p1 of lineString) { + minDistanceSquared = Math.min(minDistanceSquared, lineSegmentDistanceToPointSquared(p0, p1, x, y)); + p0 = p1; + } + return Math.sqrt(minDistanceSquared); +} +function lineStringLength(lineSegment) { + let [x0, y0] = lineSegment[0]; + let totalDistance = 0; + for (let i = 1; i < lineSegment.length; i += 1) { + const [x1, y1] = lineSegment[i]; + const distance = Math.hypot(x1 - x0, y1 - y0); + totalDistance += distance; + x0 = x1; + y0 = y1; + } + return totalDistance; +} +function lineStringCenter(lineSegment) { + if (lineSegment.length === 0) + return; + const targetDistance = lineStringLength(lineSegment) / 2; + let [x0, y0] = lineSegment[0]; + let totalDistance = 0; + for (let i = 1; i < lineSegment.length; i += 1) { + const [x1, y1] = lineSegment[i]; + const segmentDistance = Math.hypot(x1 - x0, y1 - y0); + const nextDistance = totalDistance + segmentDistance; + if (nextDistance > targetDistance) { + const ratio3 = (targetDistance - totalDistance) / segmentDistance; + const point = [x0 + (x1 - x0) * ratio3, y0 + (y1 - y0) * ratio3]; + const angle = Math.atan2(y1 - y0, x1 - x0); + return { point, angle }; + } + totalDistance = nextDistance; + x0 = x1; + y0 = y1; + } +} + +// packages/ag-charts-enterprise/src/series/map-util/polygonUtil.ts +import { _ModuleSupport as _ModuleSupport204 } from "ag-charts-community"; +var { LonLatBBox } = _ModuleSupport204; +function polygonBbox(polygon, into) { + for (const coordinates of polygon) { + const [lon, lat] = coordinates; + into = LonLatBBox.extend(into, lon, lat, lon, lat); + } + return into; +} +function polygonCentroid(polygon) { + if (polygon.length === 0) + return; + let x = 0; + let y = 0; + let k = 0; + let [x0, y0] = polygon.at(-1); + for (const [x1, y1] of polygon) { + const c = x0 * y1 - x1 * y0; + k += c; + x += (x0 + x1) * c; + y += (y0 + y1) * c; + x0 = x1; + y0 = y1; + } + k *= 3; + return [x / k, y / k]; +} +function polygonDistance(polygons, x, y) { + let inside = false; + let minDistanceSquared = Infinity; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + let [x0, y0] = p0; + for (const p1 of polygon) { + const [x1, y1] = p1; + if (y1 > y !== y0 > y && x < (x0 - x1) * (y - y1) / (y0 - y1) + x1) { + inside = !inside; + } + minDistanceSquared = Math.min(minDistanceSquared, lineSegmentDistanceToPointSquared(p0, p1, x, y)); + p0 = p1; + x0 = x1; + y0 = y1; + } + } + return (inside ? -1 : 1) * Math.sqrt(minDistanceSquared); +} + +// packages/ag-charts-enterprise/src/series/map-util/geoGeometry.ts +var { Path: Path11, ExtendedPath2D: ExtendedPath2D5, BBox: BBox20, SceneChangeDetection: SceneChangeDetection9, SceneObjectChangeDetection, objectsEqual } = _ModuleSupport205; +var GeoGeometry = class extends Path11 { + constructor() { + super(...arguments); + this.projectedGeometry = void 0; + this.renderMode = 3 /* All */; + // Keep non-filled shapes separate so we don't fill them + this.strokePath = new ExtendedPath2D5(); + } + computeBBox() { + if (this.dirtyPath || this.isDirtyPath()) { + this.updatePath(); + this.dirtyPath = false; + } + return this.bbox?.clone(); + } + updatePath() { + const { projectedGeometry } = this; + this.strokePath.clear(); + this.path.clear(); + this.bbox = projectedGeometry == null ? void 0 : this.drawGeometry(projectedGeometry, void 0); + } + drawPath(ctx) { + super.drawPath(ctx); + this.renderStroke(ctx, this.strokePath.getPath2D()); + } + containsPoint(x, y) { + const { projectedGeometry } = this; + if (projectedGeometry == null) + return false; + if (!this.getBBox().containsPoint(x, y)) + return false; + return this.geometryDistance(projectedGeometry, x, y) <= 0; + } + distanceSquared(x, y) { + const { projectedGeometry } = this; + if (projectedGeometry == null) + return Infinity; + const distance = this.geometryDistance(projectedGeometry, x, y); + return distance > 0 ? distance * distance : 0; + } + geometryDistance(geometry, x, y) { + const { renderMode, strokeWidth } = this; + const drawPolygons = (renderMode & 1 /* Polygons */) !== 0; + const drawLines = (renderMode & 2 /* Lines */) !== 0; + const minStrokeDistance = Math.max(strokeWidth / 2, 1) + 1; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.reduce( + (minDistance, g) => Math.min(minDistance, this.geometryDistance(g, x, y)), + Infinity + ); + case "MultiPolygon": + return drawPolygons ? geometry.coordinates.reduce( + (minDistance, polygon) => Math.min(minDistance, Math.max(polygonDistance(polygon, x, y), 0)), + Infinity + ) : Infinity; + case "Polygon": + return drawPolygons ? Math.max(polygonDistance(geometry.coordinates, x, y), 0) : Infinity; + case "MultiLineString": + return drawLines ? geometry.coordinates.reduce((minDistance, lineString) => { + return Math.min( + minDistance, + Math.max(lineStringDistance(lineString, x, y) - minStrokeDistance, 0) + ); + }, Infinity) : Infinity; + case "LineString": + return drawLines ? Math.max(lineStringDistance(geometry.coordinates, x, y) - minStrokeDistance, 0) : Infinity; + case "MultiPoint": + case "Point": + default: + return Infinity; + } + } + drawGeometry(geometry, bbox) { + const { renderMode, path, strokePath } = this; + const drawPolygons = (renderMode & 1 /* Polygons */) !== 0; + const drawLines = (renderMode & 2 /* Lines */) !== 0; + switch (geometry.type) { + case "GeometryCollection": + for (const g of geometry.geometries) { + bbox = this.drawGeometry(g, bbox); + } + break; + case "MultiPolygon": + if (drawPolygons) { + for (const coordinates of geometry.coordinates) { + bbox = this.drawPolygon(path, coordinates, bbox); + } + } + break; + case "Polygon": + if (drawPolygons) { + bbox = this.drawPolygon(path, geometry.coordinates, bbox); + } + break; + case "LineString": + if (drawLines) { + bbox = this.drawLineString(strokePath, geometry.coordinates, bbox, false); + } + break; + case "MultiLineString": + if (drawLines) { + for (const coordinates of geometry.coordinates) { + bbox = this.drawLineString(strokePath, coordinates, bbox, false); + } + } + break; + case "Point": + case "MultiPoint": + break; + } + return bbox; + } + drawPolygon(path, polygons, bbox) { + if (polygons.length < 1) + return bbox; + bbox = this.drawLineString(path, polygons[0], bbox, true); + for (let i = 1; i < polygons.length; i += 1) { + const enclave = polygons[i]; + this.drawLineString(path, enclave, void 0, true); + } + return bbox; + } + drawLineString(path, coordinates, bbox, isClosed) { + if (coordinates.length < 2) + return bbox; + const end = isClosed ? coordinates.length - 1 : coordinates.length; + for (let i = 0; i < end; i += 1) { + const [x, y] = coordinates[i]; + if (i === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + if (bbox == null) { + bbox = new BBox20(x, y, 0, 0); + } else { + const { x: x0, y: y0 } = bbox; + const x1 = x0 + bbox.width; + const y1 = y0 + bbox.height; + bbox.x = Math.min(x0, x); + bbox.y = Math.min(y0, y); + bbox.width = Math.max(x1, x) - bbox.x; + bbox.height = Math.max(y1, y) - bbox.y; + } + } + if (isClosed) { + path.closePath(); + } + return bbox; + } +}; +__decorateClass([ + SceneObjectChangeDetection({ equals: objectsEqual }) +], GeoGeometry.prototype, "projectedGeometry", 2); +__decorateClass([ + SceneChangeDetection9() +], GeoGeometry.prototype, "renderMode", 2); + +// packages/ag-charts-enterprise/src/series/map-util/geometryUtil.ts +import { _ModuleSupport as _ModuleSupport206 } from "ag-charts-community"; +var { LonLatBBox: LonLatBBox2 } = _ModuleSupport206; +function geometryBbox(geometry, into) { + if (geometry.bbox != null) { + const [lon0, lat0, lon1, lat1] = geometry.bbox; + into = LonLatBBox2.extend(into, lon0, lat0, lon1, lat1); + return into; + } + switch (geometry.type) { + case "GeometryCollection": + for (const g of geometry.geometries) { + into = geometryBbox(g, into); + } + break; + case "MultiPolygon": + for (const c of geometry.coordinates) { + if (c.length > 0) { + into = polygonBbox(c[0], into); + } + } + break; + case "Polygon": + if (geometry.coordinates.length > 0) { + into = polygonBbox(geometry.coordinates[0], into); + } + break; + case "MultiLineString": + for (const c of geometry.coordinates) { + into = polygonBbox(c, into); + } + break; + case "LineString": + into = polygonBbox(geometry.coordinates, into); + break; + case "MultiPoint": + for (const p of geometry.coordinates) { + const [lon, lat] = p; + into = LonLatBBox2.extend(into, lon, lat, lon, lat); + } + break; + case "Point": { + const [lon, lat] = geometry.coordinates; + into = LonLatBBox2.extend(into, lon, lat, lon, lat); + break; + } + } + return into; +} +function largestPolygon(geometry) { + switch (geometry.type) { + case "GeometryCollection": { + let maxArea; + let maxPolygon; + for (const g of geometry.geometries) { + const polygon = largestPolygon(g); + if (polygon == null) + continue; + const bbox = polygonBbox(polygon[0], void 0); + if (bbox == null) + continue; + const area = Math.abs(bbox.lat1 - bbox.lat0) * Math.abs(bbox.lon1 - bbox.lon0); + if (maxArea == null || area > maxArea) { + maxArea = area; + maxPolygon = polygon; + } + } + return maxPolygon; + } + case "MultiPolygon": { + let maxArea; + let maxPolygon; + for (const polygon of geometry.coordinates) { + const bbox = polygonBbox(polygon[0], void 0); + if (bbox == null) + continue; + const area = Math.abs(bbox.lat1 - bbox.lat0) * Math.abs(bbox.lon1 - bbox.lon0); + if (maxArea == null || area > maxArea) { + maxArea = area; + maxPolygon = polygon; + } + } + return maxPolygon; + } + case "Polygon": + return geometry.coordinates; + case "MultiLineString": + case "LineString": + case "MultiPoint": + case "Point": + return; + } +} +function largestLineString(geometry) { + switch (geometry.type) { + case "GeometryCollection": { + let maxLength; + let maxLineString; + for (const g of geometry.geometries) { + const lineString = largestLineString(g); + if (lineString == null) + continue; + const length = lineStringLength(lineString); + if (length == null) + continue; + if (maxLength == null || length > maxLength) { + maxLength = length; + maxLineString = lineString; + } + } + return maxLineString; + } + case "MultiLineString": { + let maxLength = 0; + let maxLineString; + for (const lineString of geometry.coordinates) { + const length = lineStringLength(lineString); + if (length > maxLength) { + maxLength = length; + maxLineString = lineString; + } + } + return maxLineString; + } + case "LineString": + return geometry.coordinates; + case "MultiPolygon": + case "Polygon": + case "MultiPoint": + case "Point": + return; + } +} +function containsType(geometry, type) { + if (geometry == null) + return false; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.some((g) => containsType(g, type)); + case "MultiPolygon": + case "Polygon": + return (type & 1 /* Polygon */) !== 0; + case "MultiLineString": + case "LineString": + return (type & 2 /* LineString */) !== 0; + case "MultiPoint": + case "Point": + return (type & 4 /* Point */) !== 0; + } +} +function projectGeometry(geometry, scale) { + switch (geometry.type) { + case "GeometryCollection": + return { + type: "GeometryCollection", + geometries: geometry.geometries.map((g) => projectGeometry(g, scale)) + }; + case "Polygon": + return { + type: "Polygon", + coordinates: projectPolygon(geometry.coordinates, scale) + }; + case "MultiPolygon": + return { + type: "MultiPolygon", + coordinates: projectMultiPolygon(geometry.coordinates, scale) + }; + case "MultiLineString": + return { + type: "MultiLineString", + coordinates: projectPolygon(geometry.coordinates, scale) + }; + case "LineString": + return { + type: "LineString", + coordinates: projectLineString(geometry.coordinates, scale) + }; + case "MultiPoint": + return { + type: "MultiPoint", + coordinates: projectLineString(geometry.coordinates, scale) + }; + case "Point": + return { + type: "Point", + coordinates: scale.convert(geometry.coordinates) + }; + } +} +function projectMultiPolygon(multiPolygon, scale) { + return multiPolygon.map((polygon) => projectPolygon(polygon, scale)); +} +function projectPolygon(polygon, scale) { + return polygon.map((lineString) => projectLineString(lineString, scale)); +} +function projectLineString(lineString, scale) { + return lineString.map((lonLat) => scale.convert(lonLat)); +} + +// packages/ag-charts-enterprise/src/series/map-util/mapUtil.ts +function prepareMapMarkerAnimationFunctions() { + const fromFn = (marker, _datum, status) => { + if (status === "removed") { + return { scalingX: 1, scalingY: 1 }; + } else if (marker.previousDatum == null) { + return { scalingX: 0, scalingY: 0 }; + } + return { scalingX: marker.scalingX, scalingY: marker.scalingY }; + }; + const toFn = (_marker, _datum, status) => { + if (status === "removed") { + return { scalingX: 0, scalingY: 0 }; + } + return { scalingX: 1, scalingY: 1 }; + }; + return { fromFn, toFn }; +} +function findFocusedGeoGeometry(series, opts) { + const datum = series.contextNodeData?.nodeData[opts.datumIndex]; + if (datum === void 0) + return void 0; + for (const node of series.datumSelection.nodes()) { + if (node.datum === datum) { + return node; + } + } + return void 0; +} + +// packages/ag-charts-enterprise/src/series/map-util/topologySeries.ts +import { _ModuleSupport as _ModuleSupport207 } from "ag-charts-community"; +var TopologySeriesProperties = class extends _ModuleSupport207.SeriesProperties { +}; +var TopologySeries = class extends _ModuleSupport207.DataModelSeries { + addChartEventListeners() { + this.cleanup.register( + this.ctx.eventsHub.on("legend:item-click", (event) => { + this.onLegendItemClick(event); + }), + this.ctx.eventsHub.on("legend:item-double-click", (event) => { + this.onLegendItemDoubleClick(event); + }) + ); + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } +}; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport208 } from "ag-charts-community"; +var { Property: Property70, SeriesProperties: SeriesProperties3, makeSeriesTooltip: makeSeriesTooltip12, Label: Label10 } = _ModuleSupport208; +var MapLineSeriesProperties = class extends SeriesProperties3 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = ""; + this.topologyIdKey = "name"; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.maxStrokeWidth = void 0; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new Label10(); + this.tooltip = makeSeriesTooltip12(); + } + getStyle() { + const { stroke: stroke2, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this; + return { + stroke: stroke2, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "sizeDomain", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "maxStrokeWidth", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property70 +], MapLineSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeries.ts +var { + getMissCount: getMissCount2, + getLabelStyles: getLabelStyles2, + createDatumId: createDatumId10, + SeriesNodePickMode: SeriesNodePickMode9, + valueProperty: valueProperty12, + ColorScale: ColorScale2, + LinearScale: LinearScale5, + Selection: Selection8, + Text: Text4, + Transformable: Transformable2, + mergeDefaults: mergeDefaults13 +} = _ModuleSupport209; +var MapLineSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + size: ["colorKey"], + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + size: ["sizeName"], + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode9.EXACT_SHAPE_MATCH, SeriesNodePickMode9.NEAREST_NODE], + usesPlacedLabels: true + }); + this.properties = new MapLineSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale2(); + this.sizeScale = new LinearScale5(); + this.datumSelection = Selection8.select( + this.contentGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection8.select(this.labelGroup, Text4); + this.highlightDatumSelection = Selection8.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this._previousDatumMidPoint = void 0; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + return super.hasData && this.topology != null; + } + renderToOffscreenCanvas() { + return true; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [1 /* ShapeLine */, zIndex]; + this.highlightGroup.zIndex = [2 /* ShapeLineHighlight */, zIndex]; + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 2 /* Lines */; + geoGeometry.lineJoin = "round"; + geoGeometry.lineCap = "round"; + return geoGeometry; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, sizeScale, colorScale } = this; + const { topologyIdKey, idKey, sizeKey, colorKey, labelKey, sizeDomain, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null || !containsType(feature.geometry, 2 /* LineString */)) + continue; + featureById.set(property, feature); + } + const sizeScaleType = this.sizeScale.type; + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + valueProperty12(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty12(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }), + ...labelKey == null ? [] : [valueProperty12(labelKey, "category", { id: "labelValue" })], + ...sizeKey == null ? [] : [valueProperty12(sizeKey, sizeScaleType, { id: "sizeValue" })], + ...colorKey == null ? [] : [valueProperty12(colorKey, colorScaleType, { id: "colorValue" })] + ] + }); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + this.topologyBounds = featureValues.reduce((current, feature) => { + const geometry = feature?.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (sizeKey != null) { + const sizeIdx = dataModel.resolveProcessedDataIndexById(this, `sizeValue`); + const processedSize = processedData.domain.values[sizeIdx] ?? []; + sizeScale.domain = sizeDomain ?? processedSize; + } + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + if (topology == null) { + Logger16.warnOnce(`no topology was provided for [MapLineSeries]; nothing will be rendered.`); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount2(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelDatum(datum, labelValue, projectedGeometry, measurer2) { + if (labelValue == null || projectedGeometry == null) + return; + const lineString = largestLineString(projectedGeometry); + if (lineString == null) + return; + const { idKey, idName, sizeKey, sizeName, colorKey, colorName, labelKey, labelName, label } = this.properties; + if (labelKey == null || !label.enabled) + return; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const labelSize = measurer2.measureLines(String(labelText)); + const labelCenter = lineStringCenter(lineString); + if (labelCenter == null) + return; + const [x, y] = labelCenter.point; + const { width, height } = labelSize; + return { + point: { x, y, size: 0 }, + label: { width, height, text: labelText }, + anchor: void 0, + placement: void 0 + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, sizeScale, properties, scale } = this; + const { idKey, sizeKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null) + return; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const sizeValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const maxStrokeWidth = properties.maxStrokeWidth ?? properties.strokeWidth; + sizeScale.range = [Math.min(properties.strokeWidth, maxStrokeWidth), maxStrokeWidth]; + const measurer2 = cachedTextMeasurer8(label); + const projectedGeometries = /* @__PURE__ */ new Map(); + for (const [datumIndex] of processedData.dataSources.get(this.id)?.data.entries() ?? []) { + const id = idValues[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (id != null && projectedGeometry != null) { + projectedGeometries.set(id, projectedGeometry); + } + } + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const sizeValue = sizeValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const projectedGeometry = projectedGeometries.get(idValue); + if (projectedGeometry == null) { + missingGeometries.push(idValue); + } + const labelDatum = this.getLabelDatum(datum, labelValue, projectedGeometry, measurer2); + if (labelDatum != null) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: idKey, + datum, + datumIndex, + idValue, + labelValue, + colorValue, + sizeValue, + projectedGeometry, + legendItemName, + style: this.getItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + Logger16.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection, isHighlight: false }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection, isHighlight: true }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId10(datum.idValue)); + } + getItemStyle({ datumIndex = 0, datum, colorValue, sizeValue }, isHighlight) { + const { properties, colorScale, sizeScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const style = mergeDefaults13(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + style.stroke = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? properties.stroke; + } + if (sizeValue != null) { + style.strokeWidth = sizeScale.convert(sizeValue, { clamp: true }); + } + let overrides; + if (itemStyler != null) { + overrides = this.cachedDatumCallback(createDatumId10(datumIndex, isHighlight ? "highlight" : "node"), () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + }); + } + return overrides ? mergeDefaults13(style, overrides) : style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + datumSelection.each((geoGeometry, nodeDatum) => { + const { projectedGeometry, style } = nodeDatum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(style); + }); + } + updatePlacedLabelData(labelData) { + this.labelSelection = this.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = _ModuleSupport209.PointerEvents.None; + }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, width, height, text: text2 }, datumIndex) => { + const style = getLabelStyles2(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x + width / 2; + label.y = y + height / 2; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + resetAnimation() { + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + datumMidPoint(datum) { + const { _previousDatumMidPoint } = this; + if (_previousDatumMidPoint?.datum === datum) { + return _previousDatumMidPoint.point; + } + const projectedGeometry = datum.projectedGeometry; + const lineString = projectedGeometry == null ? void 0 : largestLineString(projectedGeometry); + const center = lineString == null ? void 0 : lineStringCenter(lineString)?.point; + const point = center == null ? void 0 : { x: center[0], y: center[1] }; + this._previousDatumMidPoint = { datum, point }; + return point; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { strokeWidth, strokeOpacity, lineDash } = properties; + let { stroke: stroke2 } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + stroke2 = this.colorScale.convert(colorValue); + } + return { + marker: { + fill: void 0, + fillOpacity: 0, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 0, + lineDash: [0], + lineDashOffset: 0, + enabled: false + }, + line: { + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idKey, idName, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + idKey, + idName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + legendItemName, + tooltip + } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const sizeValue = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (sizeValue != null && sizeKey != null) { + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: sizeValue, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + domain, + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(sizeValue) }); + } + if (colorValue != null && colorKey != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + const format = this.getItemStyle({ datumIndex, datum, colorValue, sizeValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: idValues[datumIndex], + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { + seriesId, + datum, + title, + idKey, + idName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + ...format + } + ); + } + computeFocusBounds(opts) { + const geometry = findFocusedGeoGeometry(this, opts); + return geometry ? Transformable2.toCanvas(this.contentGroup, geometry.getBBox()) : void 0; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapLineSeries.className = "MapLineSeries"; +MapLineSeries.type = "map-line"; + +// packages/ag-charts-enterprise/src/series/map-line/mapLineSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport210 } from "ag-charts-community"; +import { + and as and2, + arrayLength, + arrayOf as arrayOf3, + color as color3, + constant as constant12, + geoJson, + required as required12, + string as string12, + undocumented as undocumented6 +} from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs11, mapLineSeriesThemeableOptionsDef, without: without5 } = _ModuleSupport210; +var mapLineSeriesOptionsDef = { + ...without5(commonSeriesOptionsDefs11, ["highlightStyle", "highlight"]), + ...mapLineSeriesThemeableOptionsDef, + type: required12(constant12("map-line")), + idKey: required12(string12), + sizeKey: string12, + colorKey: string12, + labelKey: string12, + idName: string12, + sizeName: string12, + colorName: string12, + labelName: string12, + topology: geoJson, + topologyIdKey: string12, + legendItemName: string12, + title: string12 +}; +mapLineSeriesOptionsDef.colorRange = undocumented6(and2(arrayOf3(color3), arrayLength(1))); + +// packages/ag-charts-enterprise/src/series/map-line/mapLineModule.ts +var MapLineModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-line", + moduleFactory: (ctx) => new MapLineSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + stroke: applyMapPalette(_ModuleSupport211.SAFE_STROKE_FILL_OPERATION), + // @ts-expect-error undocumented option + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(_ModuleSupport211.SAFE_RANGE2_OPERATION) + ] + }, + strokeWidth: 1, + maxStrokeWidth: 3, + lineDash: [0], + lineDashOffset: 0, + label: { + ..._ModuleSupport211.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: applyMapPalette(_ModuleSupport211.multiSeriesHighlightStyle(false)) + }, + tooltip: { + range: "exact" + } + } +}; +var MapLineSeriesModule = { + type: "series", + name: "map-line", + chartType: "topology", + enterprise: true, + options: mapLineSeriesOptionsDef, + create: (ctx) => new MapLineSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeries.ts +import { _ModuleSupport as _ModuleSupport213 } from "ag-charts-community"; +import { Logger as Logger17 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport212 } from "ag-charts-community"; +var { Property: Property71, SeriesProperties: SeriesProperties4, makeSeriesTooltip: makeSeriesTooltip13 } = _ModuleSupport212; +var MapLineBackgroundSeriesProperties = class extends SeriesProperties4 { + constructor() { + super(...arguments); + this.topology = void 0; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tooltip = makeSeriesTooltip13(); + } +}; +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeries.ts +var { createDatumId: createDatumId11, Group: Group12, Selection: Selection9, PointerEvents: PointerEvents6 } = _ModuleSupport213; +var MapLineBackgroundSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [] + }); + this.properties = new MapLineBackgroundSeriesProperties(); + this._chartTopology = void 0; + this.itemGroup = this.contentGroup.appendChild(new Group12({ name: "itemGroup" })); + this.datumSelection = Selection9.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.itemGroup.pointerEvents = PointerEvents6.None; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get focusable() { + return false; + } + setOptionsData() { + } + setChartData() { + } + get hasData() { + return false; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 0]; + this.highlightGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 1]; + return true; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 2 /* Lines */; + geoGeometry.lineJoin = "round"; + geoGeometry.lineCap = "round"; + geoGeometry.pointerEvents = PointerEvents6.None; + return geoGeometry; + } + processData() { + const { topology } = this; + this.topologyBounds = topology?.features.reduce((current, feature) => { + const geometry = feature.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (topology == null) { + Logger17.warnOnce(`no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.`); + } + } + createNodeData() { + const { id: seriesId, topology, scale, properties } = this; + if (topology == null) + return; + const { stroke: stroke2, strokeOpacity, lineDash, lineDashOffset, strokeWidth } = properties; + const nodeData = []; + const labelData = []; + for (const [index, feature] of topology.features.entries()) { + const { geometry } = feature; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (projectedGeometry == null) + continue; + nodeData.push({ + series: this, + itemId: index, + datum: feature, + datumIndex: 0, + index, + projectedGeometry, + style: { stroke: stroke2, strokeOpacity, lineDash, lineDashOffset, strokeWidth } + }); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + const { nodeData = [] } = this.contextNodeData ?? {}; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId11(datum.index)); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + datumSelection.each((geoGeometry, datum) => { + const { projectedGeometry } = datum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(datum.style); + }); + } + resetAnimation() { + } + getLegendData() { + return []; + } + getTooltipContent(_seriesDatum) { + return; + } + computeFocusBounds(_opts) { + return void 0; + } + hasItemStylers() { + return false; + } +}; +MapLineBackgroundSeries.className = "MapLineBackgroundSeries"; +MapLineBackgroundSeries.type = "map-line-background"; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport214 } from "ag-charts-community"; +import { constant as constant13, geoJson as geoJson2, required as required13 } from "ag-charts-core"; +var { mapLineBackgroundSeriesThemeableOptionsDef } = _ModuleSupport214; +var mapLineBackgroundSeriesOptionsDef = { + ...mapLineBackgroundSeriesThemeableOptionsDef, + type: required13(constant13("map-line-background")), + topology: geoJson2 +}; + +// packages/ag-charts-enterprise/src/series/map-line-background/mapLineBackgroundModule.ts +var MapLineBackgroundModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-line-background", + moduleFactory: (ctx) => new MapLineBackgroundSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + stroke: { $path: ["/1", { $mapPalette: "stroke" }, { $mapPalette: "secondHierarchyColors" }] }, + strokeWidth: 1, + lineDash: [0], + lineDashOffset: 0 + } + } +}; +var MapLineBackgroundSeriesModule = { + type: "series", + name: "map-line-background", + chartType: "topology", + enterprise: true, + options: mapLineBackgroundSeriesOptionsDef, + create: (ctx) => new MapLineBackgroundSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerModule.ts +import { _ModuleSupport as _ModuleSupport219 } from "ag-charts-community"; +import { ValidationError, validate } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeries.ts +import { _ModuleSupport as _ModuleSupport217 } from "ag-charts-community"; +import { Logger as Logger18, cachedTextMeasurer as cachedTextMeasurer9 } from "ag-charts-core"; + +// packages/ag-charts-types/src/chart/navigatorOptions.ts +var __MINI_CHART_SERIES_OPTIONS = void 0; +var __VERIFY_MINI_CHART_SERIES_OPTIONS = void 0; +__VERIFY_MINI_CHART_SERIES_OPTIONS = __MINI_CHART_SERIES_OPTIONS; + +// packages/ag-charts-types/src/chart/themeOptions.ts +var __THEME_OVERRIDES = void 0; +var __VERIFY_THEME_OVERRIDES = void 0; +__VERIFY_THEME_OVERRIDES = __THEME_OVERRIDES; + +// packages/ag-charts-types/src/presets/gauge/commonOptions.ts +var __THEMEABLE_OPTIONS = void 0; +var __VERIFY_THEMEABLE_OPTIONS = void 0; +__VERIFY_THEMEABLE_OPTIONS = __THEMEABLE_OPTIONS; +var __AXIS_LABEL_OPTIONS = void 0; +var __VERIFY_AXIS_LABEL_OPTIONS = void 0; +__VERIFY_AXIS_LABEL_OPTIONS = __AXIS_LABEL_OPTIONS; + +// packages/ag-charts-enterprise/src/series/map-util/polygonPointSearch.ts +import { insertListItemsSorted } from "ag-charts-core"; +function polygonPointSearch(polygons, precision, valueFn) { + const bbox = polygonBbox(polygons[0], void 0); + if (bbox == null) + return; + const boundingXCenter = (bbox.lon0 + bbox.lon1) / 2; + const boundingYCenter = (bbox.lat0 + bbox.lat1) / 2; + const boundingWidth = Math.abs(bbox.lon1 - bbox.lon0); + const boundingHeight = Math.abs(bbox.lat1 - bbox.lat0); + const centroid = polygonCentroid(polygons[0]); + const [cx, cy] = centroid; + const centroidDistanceToPolygon = -polygonDistance(polygons, cx, cy); + let bestResult; + const cellValue = (distanceToPolygon, distanceToCentroid) => { + const centroidDriftFactor = 0.5; + const centroidDrift = Math.max(distanceToCentroid - centroidDistanceToPolygon, 0); + return distanceToPolygon - centroidDriftFactor * centroidDrift; + }; + const createLabelPlacement = (x2, y2, stride) => { + const { distance: distance2, maxDistance } = valueFn(polygons, x2, y2, stride); + const distanceToCentroid = Math.hypot(cx - x2, cy - y2); + const maxXTowardsCentroid = Math.min(Math.max(cx, x2 - stride / 2), x2 + stride / 2); + const maxYTowardsCentroid = Math.min(Math.max(cy, y2 - stride / 2), y2 + stride / 2); + const minDistanceToCentroid = Math.hypot(cx - maxXTowardsCentroid, cy - maxYTowardsCentroid); + const value = cellValue(distance2, distanceToCentroid); + const maxValue = cellValue(maxDistance, minDistanceToCentroid); + return { distance: distance2, maxDistance, value, maxValue, x: x2, y: y2, stride }; + }; + const appendLabelPlacement = (into, x2, y2, stride) => { + const labelPlacement = createLabelPlacement(x2, y2, stride); + if (labelPlacement.maxDistance >= 0) { + into.push(labelPlacement); + } + }; + const initialStride = Math.min(boundingWidth, boundingHeight) / 2; + let queue = { + value: createLabelPlacement(boundingXCenter, boundingYCenter, initialStride), + next: null + }; + while (queue != null) { + const item = queue.value; + const { distance: distance2, value, maxValue, x: x2, y: y2, stride } = item; + queue = queue.next; + if (distance2 > 0 && (bestResult == null || value > bestResult.value)) { + bestResult = item; + } + if (bestResult != null && maxValue - bestResult.value <= precision) { + continue; + } + const nextStride = stride / 2; + const newLabelPlacements = []; + appendLabelPlacement(newLabelPlacements, x2 - nextStride, y2 - nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 + nextStride, y2 - nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 - nextStride, y2 + nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 + nextStride, y2 + nextStride, nextStride); + newLabelPlacements.sort(labelPlacementCmp); + queue = insertListItemsSorted(queue, newLabelPlacements, labelPlacementCmp); + } + if (bestResult == null) + return; + const { distance, x, y } = bestResult; + return { x, y, distance }; +} +var labelPlacementCmp = (a, b) => b.maxValue - a.maxValue; + +// packages/ag-charts-enterprise/src/series/map-util/markerUtil.ts +function polygonMarkerCenter(polygons, precision) { + const result = polygonPointSearch(polygons, precision, (p, x2, y2, stride) => { + const distance = -polygonDistance(p, x2, y2); + const maxDistance = distance + stride * Math.SQRT2; + return { distance, maxDistance }; + }); + if (result == null) + return; + const { x, y } = result; + return [x, y]; +} +function markerPositions(geometry, precision) { + let center; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.flatMap((g) => markerPositions(g, precision)); + case "MultiPoint": + return geometry.coordinates; + case "Point": + return [geometry.coordinates]; + case "MultiPolygon": { + const polygon = largestPolygon(geometry); + center = polygon == null ? void 0 : polygonMarkerCenter(polygon, precision); + break; + } + case "Polygon": { + const polygon = geometry.coordinates; + center = polygon == null ? void 0 : polygonMarkerCenter(polygon, precision); + break; + } + case "MultiLineString": { + const lineString = largestLineString(geometry); + center = lineString == null ? void 0 : lineStringCenter(lineString)?.point; + break; + } + case "LineString": { + const lineString = geometry.coordinates; + center = lineStringCenter(lineString)?.point; + break; + } + } + return center == null ? [] : [center]; +} + +// packages/ag-charts-enterprise/src/series/map-util/shapeFillBBox.ts +import { _ModuleSupport as _ModuleSupport215 } from "ag-charts-community"; +var { BBox: BBox21 } = _ModuleSupport215; +function getTopologyShapeFillBBox(scale) { + if (!scale) + return; + const { range: range2 } = scale; + const x = range2[0][0]; + const y = range2[0][1]; + const width = range2[1][0] - x; + const height = range2[1][1] - y; + const bbox = new BBox21(x, y, width, height); + return { + series: bbox, + axis: bbox + }; +} + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport216 } from "ag-charts-community"; +var { Property: Property72, SeriesProperties: SeriesProperties5, makeSeriesTooltip: makeSeriesTooltip14, Label: Label11 } = _ModuleSupport216; +var MapMarkerSeriesLabel = class extends Label11 { + constructor() { + super(...arguments); + this.placement = "bottom"; + } +}; +__decorateClass([ + Property72 +], MapMarkerSeriesLabel.prototype, "placement", 2); +var MapMarkerSeriesProperties = class extends SeriesProperties5 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = void 0; + this.topologyIdKey = "name"; + this.idName = void 0; + this.latitudeKey = void 0; + this.latitudeName = void 0; + this.longitudeKey = void 0; + this.longitudeName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.shape = "circle"; + this.size = 6; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new MapMarkerSeriesLabel(); + this.tooltip = makeSeriesTooltip14(); + } + getStyle() { + const { size, shape, fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + size, + shape, + fill, + fillOpacity, + opacity: 1, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "latitudeKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "latitudeName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "longitudeKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "longitudeName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "shape", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "size", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "maxSize", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "sizeDomain", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property72 +], MapMarkerSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeries.ts +var { + fromToMotion: fromToMotion3, + StateMachine: StateMachine13, + getMissCount: getMissCount3, + createDatumId: createDatumId12, + SeriesNodePickMode: SeriesNodePickMode10, + valueProperty: valueProperty13, + computeMarkerFocusBounds: computeMarkerFocusBounds2, + ColorScale: ColorScale3, + LinearScale: LinearScale6, + Group: Group13, + Selection: Selection10, + Text: Text5, + Marker: Marker4, + applyShapeStyle: applyShapeStyle11, + getLabelStyles: getLabelStyles3, + LonLatBBox: LonLatBBox3, + mergeDefaults: mergeDefaults14 +} = _ModuleSupport217; +var MapMarkerSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + size: ["colorKey"], + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + size: ["sizeName"], + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode10.EXACT_SHAPE_MATCH, SeriesNodePickMode10.NEAREST_NODE], + usesPlacedLabels: true + }); + this.properties = new MapMarkerSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale3(); + this.sizeScale = new LinearScale6(); + this.markerGroup = this.contentGroup.appendChild(new Group13({ name: "markerGroup" })); + this.labelSelection = Selection10.select(this.labelGroup, Text5, false); + this.markerSelection = Selection10.select( + this.markerGroup, + Marker4, + false + ); + this.highlightMarkerSelection = Selection10.select(this.highlightGroup, Marker4); + this.animationState = new StateMachine13( + "empty", + { + empty: { + update: { + target: "ready", + action: () => this.animateMarkers() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.resetAllAnimation(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateMarkers() + }, + // chart.ts transitions to updateData on zoom change + resize: { + target: "ready", + action: () => this.resetAllAnimation() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty", + action: () => this.resetAllAnimation() + }, + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + const hasLatLon = this.properties.latitudeKey != null && this.properties.longitudeKey != null; + return super.hasData && (this.topology != null || hasLatLon); + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [3 /* Marker */, zIndex]; + this.highlightGroup.zIndex = [4 /* MarkerHighlight */, zIndex]; + return true; + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, sizeScale, colorScale } = this; + const { topologyIdKey, idKey, latitudeKey, longitudeKey, sizeKey, colorKey, labelKey, sizeDomain, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null) + continue; + featureById.set(property, feature); + } + const sizeScaleType = this.sizeScale.type; + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const hasLatLon = latitudeKey != null && longitudeKey != null; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + ...idKey == null ? [] : [ + valueProperty13(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty13(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }) + ], + ...hasLatLon ? [ + valueProperty13(latitudeKey, mercatorScaleType, { id: "latValue" }), + valueProperty13(longitudeKey, mercatorScaleType, { id: "lonValue" }) + ] : [], + ...labelKey ? [valueProperty13(labelKey, "category", { id: "labelValue" })] : [], + ...sizeKey ? [valueProperty13(sizeKey, sizeScaleType, { id: "sizeValue" })] : [], + ...colorKey ? [valueProperty13(colorKey, colorScaleType, { id: "colorValue" })] : [] + ] + }); + const featureValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `featureValue`, processedData); + const latValues = hasLatLon ? dataModel.resolveColumnById(this, `latValue`, processedData) : void 0; + const lonValues = hasLatLon ? dataModel.resolveColumnById(this, `lonValue`, processedData) : void 0; + this.topologyBounds = processedData.dataSources.get(this.id)?.data.reduce((current, _datum, datumIndex) => { + const feature = featureValues?.[datumIndex]; + const geometry = feature?.geometry; + if (geometry != null) { + current = geometryBbox(geometry, current); + } + if (latValues != null && lonValues != null) { + const lon = lonValues[datumIndex]; + const lat = latValues[datumIndex]; + current = LonLatBBox3.extend(current, lon, lat, lon, lat); + } + return current; + }, void 0); + if (sizeKey != null) { + const sizeIdx = dataModel.resolveProcessedDataIndexById(this, `sizeValue`); + const processedSize = processedData.domain.values[sizeIdx] ?? []; + sizeScale.domain = sizeDomain ?? processedSize; + } + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + this.animationState.transition("updateData"); + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount3(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelDatum(datum, labelValue, x, y, size, measurer2) { + if (labelValue == null) + return; + const { + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName, + label, + shape + } = this.properties; + if (labelKey == null || !label.enabled) + return; + const { placement } = label; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const { width, height } = measurer2.measureLines(String(labelText)); + const anchor = Marker4.anchor(shape); + return { + point: { x, y, size }, + label: { width, height, text: labelText }, + anchor, + placement + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, sizeScale, properties, scale } = this; + const { idKey, latitudeKey, longitudeKey, sizeKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null || scale == null) + return; + const hasLatLon = latitudeKey != null && longitudeKey != null; + const idValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `featureValue`, processedData); + const latValues = hasLatLon ? dataModel.resolveColumnById(this, `latValue`, processedData) : void 0; + const lonValues = hasLatLon ? dataModel.resolveColumnById(this, `lonValue`, processedData) : void 0; + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const sizeValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const markerMaxSize = properties.maxSize ?? properties.size; + sizeScale.range = [Math.min(properties.size, markerMaxSize), markerMaxSize]; + const measurer2 = cachedTextMeasurer9(label); + let projectedGeometries; + if (idValues != null && featureValues != null) { + projectedGeometries = /* @__PURE__ */ new Map(); + for (const [datumIndex] of processedData.dataSources.get(this.id)?.data.entries() ?? []) { + const id = idValues[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (id != null && projectedGeometry != null) { + projectedGeometries.set(id, projectedGeometry); + } + } + } + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues?.[datumIndex]; + const lonValue = lonValues?.[datumIndex]; + const latValue = latValues?.[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const sizeValue = sizeValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const size = sizeValue == null ? properties.size : sizeScale.convert(sizeValue, { clamp: true }); + const projectedGeometry = idValue == null ? void 0 : projectedGeometries?.get(idValue); + if (idValue != null && projectGeometry == null) { + missingGeometries.push(idValue); + } + if (lonValue != null && latValue != null) { + const [x, y] = scale.convert([lonValue, latValue]); + const labelDatum = this.getLabelDatum(datum, labelValue, x, y, size, measurer2); + if (labelDatum) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: latitudeKey, + datum, + datumIndex, + index: -1, + idValue, + lonValue, + latValue, + labelValue, + sizeValue, + colorValue, + point: { x, y, size }, + midPoint: { x, y }, + legendItemName, + style: this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } else if (projectedGeometry != null) { + for (const [index, [x, y]] of markerPositions(projectedGeometry, 1).entries()) { + const labelDatum = this.getLabelDatum(datum, labelValue, x, y, size, measurer2); + if (labelDatum) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: latitudeKey, + datum, + datumIndex, + index, + idValue, + lonValue, + latValue, + labelValue, + sizeValue, + colorValue, + point: { x, y, size }, + midPoint: { x, y }, + legendItemName, + style: this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } + } + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + Logger18.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + checkScaleChange() { + if (this.previousScale === this.scale) + return false; + this.previousScale = this.scale; + return true; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + const scaleChange = this.checkScaleChange(); + const { markerSelection, highlightMarkerSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + this.markerSelection = this.updateMarkerSelection({ markerData: nodeData, markerSelection }); + this.updateMarkerNodes({ markerSelection, isHighlight: false, highlightedDatum }); + this.highlightMarkerSelection = this.updateMarkerSelection({ + markerData: highlightedDatum == null ? [] : [highlightedDatum], + markerSelection: highlightMarkerSelection + }); + this.updateMarkerNodes({ + markerSelection: highlightMarkerSelection, + isHighlight: true, + highlightedDatum + }); + if (scaleChange || resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updatePlacedLabelData(labelData) { + this.labelSelection = this.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = _ModuleSupport217.PointerEvents.None; + }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, width, height, text: text2 }, datumIndex) => { + const style = getLabelStyles3(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x + width / 2; + label.y = y + height / 2; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + updateMarkerSelection(opts) { + const { markerData, markerSelection } = opts; + return markerSelection.update( + markerData, + void 0, + (datum) => createDatumId12(datum.index, datum.idValue, datum.lonValue, datum.latValue) + ); + } + getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, isHighlight) { + const { properties, colorScale, sizeScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults14(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + baseStyle.fill = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? baseStyle.fill; + } + if (sizeValue != null) { + baseStyle.size = sizeScale.convert(sizeValue, { clamp: true }); + } + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId12(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults14(overrides, baseStyle); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateMarkerNodes(opts) { + const { markerSelection, isHighlight, highlightedDatum } = opts; + const fillBBox = getTopologyShapeFillBBox(this.scale); + markerSelection.each((marker, markerDatum) => { + const { datum, point } = markerDatum; + const style = this.getMarkerItemStyle(markerDatum, isHighlight); + marker.shape = style.shape; + marker.size = style.size; + applyShapeStyle11(marker, style, fillBBox); + marker.x = point.x; + marker.y = point.y; + marker.scalingCenterX = point.x; + marker.scalingCenterY = point.y; + marker.zIndex = !isHighlight && highlightedDatum != null && datum === highlightedDatum.datum ? 1 : 0; + }); + } + isProcessedDataAnimatable() { + return true; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + this.ctx.animationManager.skipCurrentBatch(); + this.labelSelection.cleanup(); + this.markerSelection.cleanup(); + this.highlightMarkerSelection.cleanup(); + } + animateMarkers() { + const { animationManager } = this.ctx; + const fns = prepareMapMarkerAnimationFunctions(); + fromToMotion3(this.id, "markers", animationManager, [this.markerSelection, this.highlightMarkerSelection], fns); + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + pickNodeClosestDatum(p) { + const { x: x0, y: y0 } = p; + let minDistanceSquared = Infinity; + let minDatum; + for (const datum of this.contextNodeData?.nodeData ?? []) { + const { x, y, size } = datum.point; + const dx2 = Math.max(Math.abs(x - x0) - size, 0); + const dy2 = Math.max(Math.abs(y - y0) - size, 0); + const distanceSquared = dx2 * dx2 + dy2 * dy2; + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + } + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { shape, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + let { fill } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + fill = this.colorScale.convert(colorValue); + } + return { + marker: { + shape, + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idName, idKey, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey ?? seriesId }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + legendItemName, + tooltip + } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const sizeValue = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (sizeKey != null && sizeValue != null) { + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: sizeValue, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + domain, + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(sizeValue) }); + } + if (colorKey != null && colorValue != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + let heading; + if (idKey != null) { + heading = dataModel.resolveColumnById(this, `idValue`, processedData)[datumIndex]; + } else if (latitudeKey != null && longitudeKey != null) { + const latValue = dataModel.resolveColumnById(this, `latValue`, processedData)[datumIndex]; + const lonValue = dataModel.resolveColumnById(this, `lonValue`, processedData)[datumIndex]; + heading = `${Math.abs(latValue).toFixed(4)}\xB0 ${latValue >= 0 ? "N" : "S"}, ${Math.abs(lonValue).toFixed(4)}\xB0 ${lonValue >= 0 ? "W" : "E"}`; + } + const format = this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading, + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { + seriesId, + datum, + title, + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + ...format + } + ); + } + getFormattedMarkerStyle(markerDatum) { + const format = this.getMarkerItemStyle(markerDatum, false); + return { size: format.size, shape: format.shape }; + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds2(this, opts); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapMarkerSeries.className = "MapMarkerSeries"; +MapMarkerSeries.type = "map-marker"; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport218 } from "ag-charts-community"; +import { constant as constant14, geoJson as geoJson3, required as required14, string as string13 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs12, mapMarkerSeriesThemeableOptionsDef, without: without6 } = _ModuleSupport218; +var mapMarkerSeriesOptionsDef = { + ...without6(commonSeriesOptionsDefs12, ["highlightStyle", "highlight"]), + ...mapMarkerSeriesThemeableOptionsDef, + type: required14(constant14("map-marker")), + idKey: string13, + latitudeKey: string13, + longitudeKey: string13, + sizeKey: string13, + colorKey: string13, + labelKey: string13, + idName: string13, + latitudeName: string13, + longitudeName: string13, + sizeName: string13, + colorName: string13, + labelName: string13, + topology: geoJson3, + topologyIdKey: string13, + legendItemName: string13, + title: string13 +}; + +// packages/ag-charts-enterprise/src/series/map-marker/mapMarkerModule.ts +var MapMarkerModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-marker", + moduleFactory: (ctx) => new MapMarkerSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + shape: "circle", + maxSize: 30, + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $mapPalette: "fill" }, + ["gradient", _ModuleSupport219.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", _ModuleSupport219.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport219.FILL_PATTERN_DEFAULTS] + ] + }), + stroke: { $mapPalette: "stroke" }, + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(_ModuleSupport219.SAFE_RANGE2_OPERATION) + ] + }, + fillOpacity: 0.5, + label: { + ..._ModuleSupport219.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: applyMapPalette(_ModuleSupport219.multiSeriesHighlightStyle()) + }, + tooltip: { + range: "exact" + } + } +}; +var MapMarkerSeriesModule = { + type: "series", + name: "map-marker", + chartType: "topology", + enterprise: true, + options: mapMarkerSeriesOptionsDef, + create: (ctx) => new MapMarkerSeries(ctx), + validate(options, optionsDefs2, path) { + const result = validate(options, optionsDefs2, path); + const { cleared, invalid } = result; + if (cleared?.idKey == null && (cleared?.latitudeKey == null || cleared?.longitudeKey == null)) { + const extendPath = (key) => path ? `${path}.${key}` : key; + const message = `Either \`${extendPath("idKey")}\` or both \`${extendPath("latitudeKey")}\` and \`${extendPath("longitudeKey")}\` are required.`; + invalid.push(new ValidationError("required", message, null, path)); + } + return result; + } +}; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeModule.ts +import { _ModuleSupport as _ModuleSupport223 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeries.ts +import { _ModuleSupport as _ModuleSupport221 } from "ag-charts-community"; +import { + Logger as Logger19, + cachedTextMeasurer as cachedTextMeasurer10, + isArray as isArray5, + measureTextSegments as measureTextSegments4, + toPlainText as toPlainText7 +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/map-util/polygonLabelUtil.ts +function preferredLabelCenter(polygons, { aspectRatio, precision }) { + const result = polygonPointSearch(polygons, precision, (p, cx, cy, stride) => { + const width = maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(p, cx, cy, aspectRatio); + const maxWidth2 = width + 2 * stride * aspectRatio; + const distance2 = width * Math.SQRT2; + const maxDistance = maxWidth2 * Math.SQRT2; + return { distance: distance2, maxDistance }; + }); + if (result == null) + return; + const { x, y, distance } = result; + const maxWidth = distance / Math.SQRT2; + return { x, y, maxWidth }; +} +function maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(a, b, cx, cy, aspectRatio) { + const [ax, ay] = a; + const [bx, by] = b; + const positiveM = 1 / aspectRatio; + const abx = bx - ax; + const aby = by - ay; + const [topPointX, topPointY] = ay <= by ? a : b; + const [leftPointX, leftPointY] = ax <= bx ? a : b; + const [bottomPointX, bottomPointY] = ay <= by ? b : a; + const [rightPointX, rightPointY] = ax <= bx ? b : a; + let maxWidth = Infinity; + if (abx === 0) { + for (let i = 0; i <= 1; i += 1) { + const m = i === 0 ? positiveM : -positiveM; + const y = m * (ax - cx) + cy; + if (y >= topPointY && y <= bottomPointY) { + const height = Math.abs(cy - y) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } + } + } else { + const abm = aby / abx; + for (let i = 0; i <= 1; i += 1) { + const m = i === 0 ? positiveM : -positiveM; + const x = (abm * ax - ay - m * cx + cy) / (abm - m); + if (x >= leftPointX && x <= rightPointX) { + const width = Math.abs(cx - x) * 2; + maxWidth = Math.min(maxWidth, width); + } + } + } + const positiveMRecip = aspectRatio; + const centerToTopMRecip = Math.abs((topPointX - cx) / (topPointY - cy)); + const centerToBottomMRecip = Math.abs((bottomPointX - cx) / (bottomPointY - cy)); + if (bottomPointY < cy && centerToBottomMRecip < positiveMRecip) { + const height = Math.abs(cy - bottomPointY) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } else if (topPointY > cy && centerToTopMRecip < positiveMRecip) { + const height = Math.abs(cy - topPointY) * 2; + const width = height * aspectRatio; + maxWidth = Math.min(maxWidth, width); + } + const centerToLeftM = Math.abs((leftPointY - cy) / (leftPointX - cx)); + const centerToRightM = Math.abs((rightPointY - cy) / (rightPointX - cx)); + if (rightPointX < cx && centerToRightM < positiveM) { + const width = Math.abs(cx - rightPointX) * 2; + maxWidth = Math.min(maxWidth, width); + } else if (leftPointX > cx && centerToLeftM < positiveM) { + const width = Math.abs(cx - leftPointX) * 2; + maxWidth = Math.min(maxWidth, width); + } + return maxWidth; +} +function maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(polygons, cx, cy, aspectRatio) { + let inside = false; + let minWidth = Infinity; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + let [x0, y0] = p0; + for (const p1 of polygon) { + const [x1, y1] = p1; + if (y1 > cy !== y0 > cy && cx < (x0 - x1) * (cy - y1) / (y0 - y1) + x1) { + inside = !inside; + } + const width = maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(p0, p1, cx, cy, aspectRatio); + minWidth = Math.min(minWidth, width); + p0 = p1; + x0 = x1; + y0 = y1; + } + } + return (inside ? 1 : -1) * minWidth; +} +function applyX(into, cx, x) { + if (x >= cx) { + into.maxX = Math.min(into.maxX, x - cx); + } + if (x <= cx) { + into.minX = Math.max(into.minX, x - cx); + } +} +function xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(into, a, b, cx, cy, height) { + const ry0 = cy - height / 2; + const ry1 = cy + height / 2; + const [ax, ay] = a; + const [bx, by] = b; + const abx = bx - ax; + const aby = by - ay; + const [leftPointX, leftPointY] = ax <= bx ? a : b; + const [rightPointX, rightPointY] = ax <= bx ? b : a; + if (abx !== 0) { + const abm = aby / abx; + for (let i = 0; i <= 1; i += 1) { + const y = i === 0 ? ry0 : ry1; + const x = (y - ay) / abm + ax; + if (x >= leftPointX && x <= rightPointX) { + applyX(into, cx, x); + } + } + } else if (Math.max(ry0, Math.min(ay, by)) <= Math.min(ry1, Math.max(ay, by))) { + applyX(into, cx, ax); + } + if (rightPointX < cx && rightPointY >= ry0 && rightPointY <= ry1) { + applyX(into, cx, rightPointX); + } else if (leftPointX > cx && leftPointY >= ry0 && leftPointY <= ry1) { + applyX(into, cx, leftPointX); + } + return into; +} +function maxWidthInPolygonForRectOfHeight(polygons, cx, cy, height) { + const result = { + minX: -Infinity, + maxX: Infinity + }; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + for (const p1 of polygon) { + xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(result, p0, p1, cx, cy, height); + p0 = p1; + } + } + const { minX, maxX } = result; + if (Number.isFinite(minX) && Number.isFinite(maxX)) { + return { x: cx + (minX + maxX) / 2, width: maxX - minX }; + } else { + return { x: cx, width: 0 }; + } +} + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport220 } from "ag-charts-community"; +var { Property: Property73, SeriesProperties: SeriesProperties6, makeSeriesTooltip: makeSeriesTooltip15 } = _ModuleSupport220; +var MapShapeSeriesProperties = class extends SeriesProperties6 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = ""; + this.idName = void 0; + this.topologyIdKey = "name"; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.padding = 0; + this.label = new AutoSizedSecondaryLabel(); + this.tooltip = makeSeriesTooltip15(); + } + getStyle() { + const { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "title", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "colorName", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "colorRange", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "padding", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property73 +], MapShapeSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeries.ts +var { + getMissCount: getMissCount4, + createDatumId: createDatumId13, + SeriesNodePickMode: SeriesNodePickMode11, + valueProperty: valueProperty14, + ColorScale: ColorScale4, + Group: Group14, + Selection: Selection11, + Text: Text6, + PointerEvents: PointerEvents7, + applyShapeStyle: applyShapeStyle12, + getLabelStyles: getLabelStyles4, + mergeDefaults: mergeDefaults15 +} = _ModuleSupport221; +var fixedScale = _ModuleSupport221.MercatorScale.fixedScale(); +var MapShapeSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode11.EXACT_SHAPE_MATCH, SeriesNodePickMode11.NEAREST_NODE] + }); + this.properties = new MapShapeSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale4(); + this.itemGroup = this.contentGroup.appendChild(new Group14({ name: "itemGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group14({ name: "itemLabelGroup" })); + this.datumSelection = Selection11.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection11.select( + this.itemLabelGroup, + Text6 + ); + this.highlightDatumSelection = Selection11.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this.previousLabelLayouts = void 0; + this._previousDatumMidPoint = void 0; + this.itemLabelGroup.pointerEvents = PointerEvents7.None; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + return super.hasData && this.topology != null; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [1 /* ShapeLine */, zIndex]; + this.highlightGroup.zIndex = [2 /* ShapeLineHighlight */, zIndex]; + return true; + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 1 /* Polygons */; + geoGeometry.lineJoin = "round"; + return geoGeometry; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, colorScale } = this; + const { topologyIdKey, idKey, colorKey, labelKey, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null || !containsType(feature.geometry, 1 /* Polygon */)) + continue; + featureById.set(property, feature); + } + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + valueProperty14(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty14(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }), + ...labelKey ? [valueProperty14(labelKey, "category", { id: "labelValue" })] : [], + ...colorKey ? [valueProperty14(colorKey, colorScaleType, { id: "colorValue" })] : [] + ] + }); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + this.topologyBounds = featureValues.reduce((current, feature) => { + const geometry = feature?.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + if (topology == null) { + Logger19.warnOnce(`no topology was provided for [MapShapeSeries]; nothing will be rendered.`); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount4(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelLayout(datum, labelValue, measurer2, geometry, previousLabelLayout) { + if (labelValue == null || geometry == null) + return; + const { idKey, idName, colorKey, colorName, labelKey, labelName, padding, label } = this.properties; + if (labelKey == null || !label.enabled) + return; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const baseSize = isArray5(labelText) ? measureTextSegments4(labelText, label) : measurer2.measureLines(String(labelText)); + const aspectRatio = (baseSize.width + 2 * padding) / (baseSize.height + 2 * padding); + if (previousLabelLayout?.geometry === geometry && previousLabelLayout?.labelText === labelText && previousLabelLayout?.aspectRatio === aspectRatio) { + return previousLabelLayout; + } + const fixedGeometry = projectGeometry(geometry, fixedScale); + const fixedPolygon = largestPolygon(fixedGeometry); + if (fixedPolygon == null) + return; + const labelPlacement = preferredLabelCenter(fixedPolygon, { + aspectRatio, + precision: 1e-3 + }); + if (labelPlacement == null) + return; + const { x, y, maxWidth } = labelPlacement; + return { geometry, labelText, aspectRatio, x, y, maxWidth, fixedPolygon }; + } + getLabelDatum(labelLayout, scaling) { + const { scale } = this; + if (scale == null) + return; + const { padding, label } = this.properties; + const { labelText, aspectRatio, x: untruncatedX, y, maxWidth, fixedPolygon } = labelLayout; + const maxSizeWithoutTruncation = { + width: Math.ceil(maxWidth * scaling), + height: Math.ceil(maxWidth * scaling / aspectRatio), + meta: untruncatedX + }; + const labelFormatting = formatSingleLabel( + toPlainText7(labelText), + label, + { padding }, + (height, allowTruncation) => { + if (!allowTruncation) { + return maxSizeWithoutTruncation; + } + const result = maxWidthInPolygonForRectOfHeight(fixedPolygon, untruncatedX, y, height / scaling); + return { + width: result.width * scaling, + height, + meta: result.x + }; + } + ); + if (labelFormatting == null) + return; + const [{ text: text2, fontSize, lineHeight, width }, formattingX] = labelFormatting; + const x = width < maxSizeWithoutTruncation.width ? untruncatedX : formattingX; + const position = this.scale.convert(fixedScale.invert([x, y])); + return { + x: position[0], + y: position[1], + text: text2, + fontSize, + lineHeight + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, properties, scale, previousLabelLayouts } = this; + const { idKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null) + return; + const scaling = scale == null ? Number.NaN : (scale.range[1][0] - scale.range[0][0]) / scale.bounds.width; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const measurer2 = cachedTextMeasurer10(label); + const labelLayouts = /* @__PURE__ */ new Map(); + this.previousLabelLayouts = labelLayouts; + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + if (geometry == null) { + missingGeometries.push(idValue); + } + const labelLayout = this.getLabelLayout( + datum, + labelValue, + measurer2, + geometry, + previousLabelLayouts?.get(idValue) + ); + if (labelLayout != null) { + labelLayouts.set(idValue, labelLayout); + } + const labelDatum = labelLayout != null && scale != null ? this.getLabelDatum(labelLayout, scaling) : void 0; + if (labelDatum != null) { + labelData.push(labelDatum); + } + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + nodeData.push({ + series: this, + itemId: idKey, + datum, + datumIndex, + idValue, + colorValue, + labelValue, + projectedGeometry, + legendItemName, + style: this.getItemStyle({ datum, datumIndex, colorValue }, false) + }); + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + Logger19.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection, labelSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId13(datum.idValue)); + } + getItemStyle({ datumIndex, datum, colorValue }, isHighlight) { + const { properties, colorScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults15(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + baseStyle.fill = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? baseStyle.fill; + } + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId13(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style = mergeDefaults15(overrides, style); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const fillBBox = getTopologyShapeFillBBox(this.scale); + datumSelection.each((geoGeometry, nodeDatum) => { + const { projectedGeometry } = nodeDatum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + applyShapeStyle12(geoGeometry, nodeDatum.style, fillBBox); + }); + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, text: text2, fontSize, lineHeight }, datumIndex) => { + const style = getLabelStyles4(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontFamily } = style; + label.visible = true; + label.x = x; + label.y = y; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.lineHeight = lineHeight; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style); + }); + } + resetAnimation() { + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + datumMidPoint(datum) { + const { _previousDatumMidPoint } = this; + if (_previousDatumMidPoint?.datum === datum) { + return _previousDatumMidPoint.point; + } + const projectedGeometry = datum.projectedGeometry; + const polygon = projectedGeometry == null ? void 0 : largestPolygon(projectedGeometry); + const center = polygon == null ? void 0 : polygonMarkerCenter(polygon, 2); + const point = center == null ? void 0 : { x: center[0], y: center[1] }; + this._previousDatumMidPoint = { datum, point }; + return point; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + let { fill } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + fill = this.colorScale.convert(colorValue); + } + return { + marker: { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idKey, idName, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { idKey, idName, colorKey, colorName, labelKey, labelName, legendItemName, title, tooltip } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const idValue = dataModel.resolveColumnById(this, `idValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (colorValue != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + const format = this.getItemStyle({ datum, datumIndex, colorValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: idValue, + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { seriesId, datum, title, idKey, idName, colorKey, colorName, labelKey, labelName, ...format } + ); + } + computeFocusBounds(opts) { + return findFocusedGeoGeometry(this, opts); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapShapeSeries.className = "MapShapeSeries"; +MapShapeSeries.type = "map-shape"; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport222 } from "ag-charts-community"; +import { constant as constant15, geoJson as geoJson4, required as required15, string as string14 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs13, mapShapeSeriesThemeableOptionsDef, without: without7 } = _ModuleSupport222; +var mapShapeSeriesOptionsDef = { + ...without7(commonSeriesOptionsDefs13, ["highlightStyle", "highlight"]), + ...mapShapeSeriesThemeableOptionsDef, + type: required15(constant15("map-shape")), + idKey: required15(string14), + colorKey: string14, + labelKey: string14, + idName: string14, + colorName: string14, + labelName: string14, + topology: geoJson4, + topologyIdKey: string14, + legendItemName: string14, + title: string14 +}; + +// packages/ag-charts-enterprise/src/series/map-shape/mapShapeModule.ts +var MapShapeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-shape", + moduleFactory: (ctx) => new MapShapeSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $mapPalette: "fill" }, + ["gradient", _ModuleSupport223.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", _ModuleSupport223.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport223.FILL_PATTERN_DEFAULTS] + ] + }), + stroke: { $ref: "chartBackgroundColor" }, + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(_ModuleSupport223.SAFE_RANGE2_OPERATION) + ] + }, + fillOpacity: 1, + strokeWidth: 1, + lineDash: [0], + lineDashOffset: 0, + padding: 2, + label: { + ..._ModuleSupport223.LABEL_BOXING_DEFAULTS, + color: { $ref: "chartBackgroundColor" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: "bold", + overflowStrategy: "hide" + }, + highlight: applyMapPalette(_ModuleSupport223.multiSeriesHighlightStyle(true)) + }, + tooltip: { + range: "exact" + } + } +}; +var MapShapeSeriesModule = { + type: "series", + name: "map-shape", + chartType: "topology", + enterprise: true, + options: mapShapeSeriesOptionsDef, + create: (ctx) => new MapShapeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundModule.ts +import { _ModuleSupport as _ModuleSupport227 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeries.ts +import { _ModuleSupport as _ModuleSupport225 } from "ag-charts-community"; +import { Logger as Logger20 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport224 } from "ag-charts-community"; +var { Property: Property74, SeriesProperties: SeriesProperties7, makeSeriesTooltip: makeSeriesTooltip16 } = _ModuleSupport224; +var MapShapeBackgroundSeriesProperties = class extends SeriesProperties7 { + constructor() { + super(...arguments); + this.topology = void 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tooltip = makeSeriesTooltip16(); + } +}; +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "topology", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeries.ts +var { createDatumId: createDatumId14, Selection: Selection12, Group: Group15, PointerEvents: PointerEvents8 } = _ModuleSupport225; +var MapShapeBackgroundSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [] + }); + this.properties = new MapShapeBackgroundSeriesProperties(); + this._chartTopology = void 0; + this.itemGroup = this.contentGroup.appendChild(new Group15({ name: "itemGroup" })); + this.datumSelection = Selection12.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.itemGroup.pointerEvents = PointerEvents8.None; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get focusable() { + return false; + } + setOptionsData() { + } + setChartData() { + } + getNodeData() { + return; + } + get hasData() { + return false; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 0]; + this.highlightGroup.zIndex = [0 /* ShapeLineBackground */, zIndex, 1]; + return true; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 1 /* Polygons */; + geoGeometry.lineJoin = "round"; + geoGeometry.pointerEvents = PointerEvents8.None; + return geoGeometry; + } + processData() { + const { topology } = this; + this.topologyBounds = topology?.features.reduce((current, feature) => { + const geometry = feature.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (topology == null) { + Logger20.warnOnce(`no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.`); + } + } + createNodeData() { + const { id: seriesId, topology, scale, properties } = this; + if (topology == null) + return; + const { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + const nodeData = []; + const labelData = []; + for (const [index, feature] of topology.features.entries()) { + const { geometry } = feature; + const projectedGeometry = geometry != null && scale != null ? projectGeometry(geometry, scale) : void 0; + if (projectedGeometry == null) + continue; + nodeData.push({ + series: this, + itemId: index, + datum: feature, + datumIndex: 0, + index, + projectedGeometry, + style: { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset } + }); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + const { nodeData = [] } = this.contextNodeData ?? {}; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId14(datum.index)); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + datumSelection.each((geoGeometry, datum) => { + const { projectedGeometry } = datum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(datum.style); + }); + } + resetAnimation() { + } + getLegendData() { + return []; + } + getTooltipContent(_seriesDatum) { + return; + } + pickFocus() { + return void 0; + } + computeFocusBounds(_opts) { + return void 0; + } + hasItemStylers() { + return false; + } +}; +MapShapeBackgroundSeries.className = "MapShapeBackgroundSeries"; +MapShapeBackgroundSeries.type = "map-shape-background"; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport226 } from "ag-charts-community"; +import { constant as constant16, geoJson as geoJson5, required as required16 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs14, mapShapeBackgroundSeriesThemeableOptionsDef } = _ModuleSupport226; +var mapShapeBackgroundSeriesOptionsDef = { + ...mapShapeBackgroundSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs14, + type: required16(constant16("map-shape-background")), + topology: geoJson5 +}; + +// packages/ag-charts-enterprise/src/series/map-shape-background/mapShapeBackgroundModule.ts +var MapShapeBackgroundModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-shape-background", + moduleFactory: (ctx) => new MapShapeBackgroundSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $path: ["/1", { $mapPalette: "fill" }, { $mapPalette: "hierarchyColors" }] }, + ["gradient", _ModuleSupport227.FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS], + ["image", _ModuleSupport227.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport227.FILL_PATTERN_HIERARCHY_DEFAULTS] + ] + }), + stroke: { $ref: "chartBackgroundColor" }, + strokeWidth: 1 + } + } +}; +var MapShapeBackgroundSeriesModule = { + type: "series", + name: "map-shape-background", + chartType: "topology", + enterprise: true, + options: mapShapeBackgroundSeriesOptionsDef, + create: (ctx) => new MapShapeBackgroundSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleModule.ts +import { _ModuleSupport as _ModuleSupport236 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeries.ts +import { _ModuleSupport as _ModuleSupport233 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBase.ts +import { _ModuleSupport as _ModuleSupport229 } from "ag-charts-community"; +import { isDefined as isDefined3 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/util/radialUtil.ts +import { _ModuleSupport as _ModuleSupport228 } from "ag-charts-community"; +var { createDatumId: createDatumId15, mergeDefaults: mergeDefaults16, toHighlightString: toHighlightString4 } = _ModuleSupport228; +function makeStylerParams(series, highlighted, highlightStateEnum) { + const { id: seriesId } = series; + const { + angleKey, + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + radiusKey, + stackGroup, + stroke: stroke2, + strokeOpacity, + strokeWidth + } = series.properties; + const highlightState = toHighlightString4(highlightStateEnum ?? _ModuleSupport228.HighlightState.None); + return { + angleKey, + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + radiusKey, + seriesId, + stackGroup, + stroke: stroke2, + strokeOpacity, + strokeWidth + }; +} +function getStyle(series, ignoreStylerCallback, highlighted, highlightState) { + const { styler } = series.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = makeStylerParams(series, highlighted, highlightState); + stylerResult = series.ctx.optionsGraphService.resolvePartial( + ["series", `${series.declarationOrder}`], + series.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? series.properties.cornerRadius, + fill: stylerResult.fill ?? series.properties.fill, + fillOpacity: stylerResult.fillOpacity ?? series.properties.fillOpacity, + lineDash: stylerResult.lineDash ?? series.properties.lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? series.properties.lineDashOffset, + stroke: stylerResult.stroke ?? series.properties.stroke, + strokeOpacity: stylerResult.strokeOpacity ?? series.properties.strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? series.properties.strokeWidth, + opacity: 1 + }; +} +function makeItemStylerParams(series, nodeDatum, isHighlight, style) { + const { id: seriesId, properties } = series; + const { angleKey, radiusKey } = properties; + const activeHighlight = series.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = series.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = series.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + highlighted: isHighlight, + highlightState: highlightStateString, + angleKey, + radiusKey, + ...style, + fill + }; +} +function getItemStyle(series, nodeDatum, isHighlight, highlightState) { + const { properties } = series; + const { itemStyler } = properties; + const highlightStyle = series.getHighlightStyle(isHighlight, nodeDatum?.datumIndex, highlightState); + const baseStyle = mergeDefaults16( + highlightStyle, + getStyle(series, nodeDatum === void 0, isHighlight, highlightState) + ); + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = series.cachedDatumCallback( + createDatumId15(series.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = makeItemStylerParams(series, nodeDatum, isHighlight, style); + return series.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults16(overrides, style); + } + } + return style; +} + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBase.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS, + DEFAULT_POLAR_DIRECTION_NAMES, + ChartAxisDirection: ChartAxisDirection28, + PolarAxis, + diff: diff6, + fixNumericExtent: fixNumericExtent8, + groupAccumulativeValueProperty: groupAccumulativeValueProperty2, + keyProperty: keyProperty9, + normaliseGroupTo, + resetLabelFn: resetLabelFn5, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation5, + seriesLabelFadeOutAnimation, + valueProperty: valueProperty15, + animationValidation: animationValidation7, + createDatumId: createDatumId16, + SeriesNodePickMode: SeriesNodePickMode12, + normalizeAngle360: normalizeAngle3605, + CategoryScale: CategoryScale3, + motion: motion6, + applyShapeStyle: applyShapeStyle13, + isGradientFill: isGradientFill2, + updateLabelNode: updateLabelNode6, + getItemStyles: getItemStyles3 +} = _ModuleSupport229; +var RadialColumnSeriesNodeEvent = class extends _ModuleSupport229.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadialColumnSeriesBase = class extends _ModuleSupport229.PolarSeries { + constructor(moduleCtx, { + animationResetFns + }) { + super({ + moduleCtx, + categoryKey: "angleValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES, + canHaveAxes: true, + pickModes: [SeriesNodePickMode12.NEAREST_NODE, SeriesNodePickMode12.EXACT_SHAPE_MATCH], + animationResetFns: { + ...animationResetFns, + label: resetLabelFn5 + } + }); + this.NodeEvent = RadialColumnSeriesNodeEvent; + this.groupScale = new CategoryScale3(); + this.circleCache = { r: 0, cx: 0, cy: 0 }; + } + get hasData() { + return this.getHasData("radiusValue-raw"); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection28.Angle) { + return dataModel.getDomain(this, "angleValue", "key", processedData); + } else { + const yExtent = dataModel.getDomain(this, "radiusValue-end", "value", processedData); + const fixedYExtent = Number.isFinite(yExtent[1] - yExtent[0]) ? [Math.min(yExtent[0], 0), Math.max(yExtent[1], 0)] : []; + return fixNumericExtent8(fixedYExtent); + } + } + async processData(dataController) { + const { angleKey, radiusKey, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const stackGroupId = this.getStackId(); + const stackGroupTrailingId = `${stackGroupId}-trailing`; + const extraProps = []; + if (isDefined3(normalizedTo)) { + extraProps.push(normaliseGroupTo([stackGroupId, stackGroupTrailingId], Math.abs(normalizedTo))); + } + if (animationEnabled && this.processedData) { + extraProps.push(diff6(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation7()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const radiusScaleType = this.axes[ChartAxisDirection28.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection28.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty9(angleKey, angleScaleType, { id: "angleValue" }), + valueProperty15(radiusKey, radiusScaleType, { + id: "radiusValue-raw", + invalidValue: null, + ...visibleProps + }), + ...groupAccumulativeValueProperty2( + radiusKey, + "normal", + { + id: `radiusValue-end`, + rangeId: `radiusValue-range`, + invalidValue: null, + groupId: stackGroupId, + separateNegative: true, + ...visibleProps + }, + radiusScaleType + ), + ...groupAccumulativeValueProperty2( + radiusKey, + "trailing", + { + id: `radiusValue-start`, + invalidValue: null, + groupId: stackGroupTrailingId, + separateNegative: true, + ...visibleProps + }, + radiusScaleType + ), + ...extraProps + ], + groupByKeys: true, + groupByData: false + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (r !== cache.r || cx !== cache.cx || cy !== cache.cy) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + isRadiusAxisReversed() { + return this.axes[ChartAxisDirection28.Radius]?.isReversed(); + } + maybeRefreshNodeData() { + const circleChanged = this.didCircleChange(); + if (!circleChanged && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection28.Radius]; + return radiusAxis instanceof PolarAxis ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + createNodeData() { + const { processedData, dataModel, groupScale } = this; + if (!dataModel || !processedData || processedData.type !== "grouped") + return; + const angleAxis = this.axes[ChartAxisDirection28.Angle]; + const radiusAxis = this.axes[ChartAxisDirection28.Radius]; + const angleScale = angleAxis?.scale; + const radiusScale = radiusAxis?.scale; + if (!angleScale || !radiusScale) { + return; + } + const angleValues = dataModel.resolveKeysById(this, `angleValue`, processedData); + const radiusStartValues = dataModel.resolveColumnById(this, `radiusValue-start`, processedData); + const radiusEndValues = dataModel.resolveColumnById(this, `radiusValue-end`, processedData); + const radiusRawValues = dataModel.resolveColumnById(this, `radiusValue-raw`, processedData); + const radiusRangeIndex = dataModel.resolveProcessedDataIndexById(this, `radiusValue-range`); + let groupPaddingInner = 0; + let groupPaddingOuter = 0; + if (angleAxis instanceof AngleCategoryAxis) { + groupPaddingInner = angleAxis.groupPaddingInner; + groupPaddingOuter = angleAxis.paddingInner; + } + const groupAngleStep = angleScale.bandwidth ?? 0; + const paddedGroupAngleStep = groupAngleStep * (1 - groupPaddingOuter); + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + groupScale.domain = Array.from({ length: visibleGroupCount }).map((_, i) => String(i)); + groupScale.range = [-paddedGroupAngleStep / 2, paddedGroupAngleStep / 2]; + groupScale.paddingInner = visibleGroupCount > 1 ? groupPaddingInner : 0; + const radiusAxisReversed = this.isRadiusAxisReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const axisTotalRadius = axisOuterRadius + axisInnerRadius; + const { angleKey, radiusKey, angleName, radiusName, legendItemName, label } = this.properties; + const radiusDomain = this.getSeriesDomain(ChartAxisDirection28.Radius); + const getLabelNodeDatum = (datum, radiusDatum, x, y) => { + const labelText = this.getLabelText( + radiusDatum, + datum, + radiusKey, + "radius", + radiusDomain, + label, + { value: radiusDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + return { x, y, text: labelText, textAlign: "center", textBaseline: "middle" }; + } + }; + const nodeData = []; + const styles = getItemStyles3( + (nodeDatum, isHighlight, highlightState) => getItemStyle(this, nodeDatum, isHighlight, highlightState) + ); + const context = { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + if (!this.visible) + return context; + const { dataSources } = processedData; + const rawData = dataSources.get(this.id)?.data ?? []; + for (const { datumIndex, group } of dataModel.forEachGroupDatum(this, processedData)) { + const datum = rawData[datumIndex]; + const angleDatum = angleValues[datumIndex]; + if (angleDatum == null) + return; + const radiusDatum = radiusRawValues[datumIndex]; + const isPositive = radiusDatum >= 0 && !Object.is(radiusDatum, -0); + const innerRadiusDatum = radiusStartValues[datumIndex]; + const outerRadiusDatum = radiusEndValues[datumIndex]; + const radiusRange = group.aggregation[radiusRangeIndex][isPositive ? 1 : 0] ?? 0; + const negative = isPositive === radiusAxisReversed; + if (innerRadiusDatum === void 0 || outerRadiusDatum === void 0) + return; + let startAngle; + let endAngle; + if (rawData.length === 1) { + startAngle = -0.5 * Math.PI; + endAngle = 1.5 * Math.PI; + } else { + const groupAngle = angleScale.convert(angleDatum); + startAngle = normalizeAngle3605(groupAngle + groupScale.convert(String(groupIndex))); + endAngle = normalizeAngle3605(startAngle + groupScale.bandwidth); + } + const angle = startAngle + groupScale.bandwidth / 2; + const innerRadius = axisTotalRadius - radiusScale.convert(innerRadiusDatum); + const outerRadius = axisTotalRadius - radiusScale.convert(outerRadiusDatum); + const midRadius = (innerRadius + outerRadius) / 2; + const stackInnerRadius = axisTotalRadius - radiusScale.convert(0); + const stackOuterRadius = axisTotalRadius - radiusScale.convert(radiusRange); + const x = Math.cos(angle) * midRadius; + const y = Math.sin(angle) * midRadius; + const labelNodeDatum = this.properties.label.enabled ? getLabelNodeDatum(datum, radiusDatum, x, y) : void 0; + const columnWidth = this.getColumnWidth(startAngle, endAngle); + nodeData.push({ + series: this, + datum, + datumIndex, + point: { x, y, size: 0 }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + negative, + innerRadius, + outerRadius, + stackInnerRadius, + stackOuterRadius, + startAngle, + endAngle, + midAngle: angle, + axisInnerRadius, + axisOuterRadius, + columnWidth, + index: datumIndex + }); + } + return { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + } + getColumnWidth(_startAngle, _endAngle) { + return Number.NaN; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updateSectorSelection(this.itemSelection, false); + this.updateSectorSelection(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateSectorSelection(selection, isHighlight) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + let selectionData = []; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + if (isHighlight) { + if (activeHighlight?.datum && activeHighlight.series === this) { + selectionData.push(activeHighlight); + } + } else { + selectionData = this.nodeData; + } + const radiusAxisReversed = this.isRadiusAxisReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const fillBBox = this.getShapeFillBBox(); + const hasItemStylers = this.hasItemStylers(); + selection.update(selectionData, void 0, (datum) => this.getDatumId(datum)).each((node, nodeDatum) => { + const { midPoint } = nodeDatum; + if (hasItemStylers) { + const highlightState = this.getHighlightState(activeHighlight, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = getItemStyle(this, nodeDatum, isHighlight, highlightState); + } + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + const fill = style.fill; + const itemBounds = isGradientFill2(fill) && fill.bounds === "item"; + const fillParams = itemBounds ? { centerX: midPoint?.x ?? 0, centerY: midPoint?.y ?? 0 } : { centerX: 0, centerY: 0, innerRadius: axisInnerRadius, outerRadius: axisOuterRadius }; + this.updateItemPath(node, nodeDatum, isHighlight); + applyShapeStyle13(node, style, fillBBox, fillParams); + node.cornerRadius = style.cornerRadius ?? 0; + node.lineJoin = "round"; + }); + } + updateLabels() { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + updateLabelNode6(this, node, this.properties, this.properties.label, datum.label, false, activeHighlight); + node.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + }); + } + animateEmptyUpdateReady() { + const { labelSelection } = this; + const fns = this.getColumnTransitionFunctions(); + motion6.fromToMotion(this.id, "datums", this.ctx.animationManager, [this.itemSelection], fns); + seriesLabelFadeInAnimation5(this, "labels", this.ctx.animationManager, labelSelection); + } + animateClearingUpdateEmpty() { + const { itemSelection } = this; + const { animationManager } = this.ctx; + const fns = this.getColumnTransitionFunctions(); + motion6.fromToMotion(this.id, "datums", animationManager, [itemSelection], fns); + seriesLabelFadeOutAnimation(this, "labels", animationManager, this.labelSelection); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip } = properties; + const angleAxis = axes[ChartAxisDirection28.Angle]; + const radiusAxis = axes[ChartAxisDirection28.Radius]; + const nodeDatum = this.nodeData?.[datumIndex]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis || !nodeDatum) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const angleValue = dataModel.resolveKeysById(this, `angleValue`, processedData)[datumIndex]; + const radiusValue = dataModel.resolveColumnById(this, `radiusValue-raw`, processedData)[datumIndex]; + if (angleValue == null) + return; + const format = getItemStyle(this, nodeDatum, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: radiusName, + fallbackLabel: radiusKey, + value: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + angleName, + radiusKey, + radiusName, + legendItemName, + ...format + } + ); + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.itemSelection.nodes()); + } + legendItemSymbol() { + const { fill, stroke: stroke2, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = getStyle( + this, + false, + false, + _ModuleSupport229.HighlightState.None + ); + const markerStyle = { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke2 ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + if (_ModuleSupport229.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: markerStyle + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { radiusKey, radiusName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: radiusKey, + seriesId, + enabled: visible, + label: { + text: legendItemName ?? radiusName ?? radiusKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getDatumId(datum) { + return createDatumId16(datum.angleValue); + } + computeLabelsBBox() { + return null; + } +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesBaseProperties.ts +import { _ModuleSupport as _ModuleSupport230 } from "ag-charts-community"; +var { SeriesProperties: SeriesProperties8, makeSeriesTooltip: makeSeriesTooltip17, Property: Property75, Label: Label12 } = _ModuleSupport230; +var RadialColumnSeriesBaseProperties = class extends SeriesProperties8 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.label = new Label12(); + this.tooltip = makeSeriesTooltip17(); + } + getStyle() { + const { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "angleKey", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "angleName", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "radiusName", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "fill", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "stroke", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "lineDash", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "styler", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "rotation", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "stackGroup", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "normalizedTo", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "label", 2); +__decorateClass([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleUtil.ts +import { _ModuleSupport as _ModuleSupport232 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnUtil.ts +import { _ModuleSupport as _ModuleSupport231 } from "ag-charts-community"; +var { motion: motion7 } = _ModuleSupport231; +function createAngleMotionCalculator() { + const angles = { + startAngle: /* @__PURE__ */ new Map(), + endAngle: /* @__PURE__ */ new Map() + }; + const angleKeys = ["startAngle", "endAngle"]; + const calculate = (node, datum, status) => { + for (const key of angleKeys) { + const map = angles[key]; + let from2 = (status === "removed" || status === "updated" ? node : datum)[key]; + let to2 = (status === "removed" ? node : datum)[key]; + if (Number.isNaN(to2)) { + to2 = node.previousDatum?.[key] ?? Number.NaN; + } + const diff8 = from2 - to2; + if (Math.abs(diff8) > Math.PI) { + from2 -= Math.sign(diff8) * 2 * Math.PI; + } + map.set(datum, { from: from2, to: to2 }); + } + }; + const getAngles = (datum, fromToKey) => { + return { + startAngle: angles.startAngle.get(datum)[fromToKey], + endAngle: angles.endAngle.get(datum)[fromToKey] + }; + }; + const from = (datum) => getAngles(datum, "from"); + const to = (datum) => getAngles(datum, "to"); + return { calculate, from, to }; +} +function fixRadialColumnAnimationStatus(node, datum, status) { + if (status === "updated") { + if (node.previousDatum == null || Number.isNaN(node.previousDatum.startAngle) || Number.isNaN(node.previousDatum.endAngle)) { + return "added"; + } + if (Number.isNaN(datum.startAngle) || Number.isNaN(datum.endAngle)) { + return "removed"; + } + } + if (status === "added" && node.previousDatum != null) { + return "updated"; + } + return status; +} +function prepareRadialColumnAnimationFunctions(axisZeroRadius) { + const angles = createAngleMotionCalculator(); + const fromFn = (node, datum, status) => { + status = fixRadialColumnAnimationStatus(node, datum, status); + angles.calculate(node, datum, status); + const { startAngle, endAngle } = angles.from(datum); + let innerRadius; + let outerRadius; + let columnWidth; + let axisInnerRadius; + let axisOuterRadius; + if (status === "removed" || status === "updated") { + innerRadius = node.innerRadius; + outerRadius = node.outerRadius; + columnWidth = node.columnWidth; + axisInnerRadius = node.axisInnerRadius; + axisOuterRadius = node.axisOuterRadius; + } else { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + columnWidth = datum.columnWidth; + axisInnerRadius = datum.axisInnerRadius; + axisOuterRadius = datum.axisOuterRadius; + } + const phase = motion7.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { + innerRadius, + outerRadius, + columnWidth, + axisInnerRadius, + axisOuterRadius, + startAngle, + endAngle, + phase + }; + }; + const toFn = (node, datum, status) => { + const { startAngle, endAngle } = angles.to(datum); + let innerRadius; + let outerRadius; + let columnWidth; + let axisInnerRadius; + let axisOuterRadius; + if (status === "removed") { + innerRadius = node.innerRadius; + outerRadius = node.innerRadius; + columnWidth = node.columnWidth; + axisInnerRadius = node.axisInnerRadius; + axisOuterRadius = node.axisOuterRadius; + } else { + innerRadius = Number.isNaN(datum.innerRadius) ? axisZeroRadius : datum.innerRadius; + outerRadius = Number.isNaN(datum.outerRadius) ? axisZeroRadius : datum.outerRadius; + columnWidth = Number.isNaN(datum.columnWidth) ? node.columnWidth : datum.columnWidth; + axisInnerRadius = datum.axisInnerRadius; + axisOuterRadius = datum.axisOuterRadius; + } + return { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle }; + }; + return { toFn, fromFn }; +} +function resetRadialColumnSelectionFn(_node, { + innerRadius, + outerRadius, + columnWidth, + axisInnerRadius, + axisOuterRadius, + startAngle, + endAngle +}) { + return { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle }; +} + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleUtil.ts +var { SectorBox, motion: motion8 } = _ModuleSupport232; +function getRadii(datum) { + const { negative, innerRadius, outerRadius, stackInnerRadius, stackOuterRadius } = datum; + return { + innerRadius: negative ? stackOuterRadius : stackInnerRadius, + outerRadius: negative ? stackInnerRadius : stackOuterRadius, + clipInnerRadius: negative ? outerRadius : innerRadius, + clipOuterRadius: negative ? innerRadius : outerRadius + }; +} +function prepareNightingaleAnimationFunctions(axisZeroRadius) { + const angles = createAngleMotionCalculator(); + const fromFn = (sect, datum, status) => { + status = fixRadialColumnAnimationStatus(sect, datum, status); + angles.calculate(sect, datum, status); + const { startAngle, endAngle } = angles.from(datum); + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed" || status === "updated") { + innerRadius = sect.innerRadius; + outerRadius = sect.outerRadius; + clipSector = sect.clipSector; + } else { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + } + clipSector ?? (clipSector = new SectorBox(startAngle, endAngle, innerRadius, outerRadius)); + const phase = motion8.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { innerRadius, outerRadius, startAngle, endAngle, clipSector, phase }; + }; + const toFn = (_sect, datum, status) => { + const { startAngle, endAngle } = angles.to(datum); + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed") { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + clipSector = new SectorBox(startAngle, endAngle, innerRadius, outerRadius); + } else { + let clipInnerRadius, clipOuterRadius; + ({ innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum)); + if (Number.isNaN(innerRadius)) + innerRadius = axisZeroRadius; + if (Number.isNaN(outerRadius)) + outerRadius = axisZeroRadius; + if (Number.isNaN(clipInnerRadius)) + clipInnerRadius = axisZeroRadius; + if (Number.isNaN(clipOuterRadius)) + clipOuterRadius = axisZeroRadius; + clipSector = new SectorBox(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + } + return { innerRadius, outerRadius, startAngle, endAngle, clipSector }; + }; + return { toFn, fromFn }; +} +function resetNightingaleSelectionFn(_sect, datum) { + const { startAngle, endAngle } = datum; + const { innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum); + const clipSector = new SectorBox(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + return { innerRadius, outerRadius, startAngle, endAngle, clipSector }; +} + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeries.ts +var { Sector: Sector4, SectorBox: SectorBox2, PolarZIndexMap } = _ModuleSupport233; +var NightingaleSeries = class extends RadialColumnSeriesBase { + // TODO: Enable once the options contract has been revisited + // @TempValidate + // sectorSpacing = 1; + constructor(moduleCtx) { + super(moduleCtx, { animationResetFns: { item: resetNightingaleSelectionFn } }); + this.properties = new RadialColumnSeriesBaseProperties(); + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0, PolarZIndexMap.FOREGROUND, zIndex]; + this.highlightGroup.zIndex = [0, PolarZIndexMap.HIGHLIGHT, zIndex]; + this.labelGroup.zIndex = [0, PolarZIndexMap.LABEL, zIndex]; + return true; + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `nightingale-stack-${groupIndex}-yValues`; + } + nodeFactory() { + return new Sector4(); + } + updateItemPath(node, datum, highlight) { + const { negative } = datum; + node.centerX = 0; + node.centerY = 0; + node.startOuterCornerRadius = negative ? 0 : this.properties.cornerRadius; + node.endOuterCornerRadius = negative ? 0 : this.properties.cornerRadius; + node.startInnerCornerRadius = negative ? this.properties.cornerRadius : 0; + node.endInnerCornerRadius = negative ? this.properties.cornerRadius : 0; + if (highlight) { + const { startAngle, endAngle } = datum; + const { innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum); + node.innerRadius = innerRadius; + node.outerRadius = outerRadius; + node.startAngle = startAngle; + node.endAngle = endAngle; + node.clipSector = new SectorBox2(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + } + } + getColumnTransitionFunctions() { + const axisZeroRadius = this.isRadiusAxisReversed() ? this.radius : this.getAxisInnerRadius(); + return prepareNightingaleAnimationFunctions(axisZeroRadius); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +NightingaleSeries.className = "NightingaleSeries"; +NightingaleSeries.type = "nightingale"; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport234 } from "ag-charts-community"; +import { boolean as boolean8, constant as constant17, number as number7, required as required17, string as string15 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs15, nightingaleSeriesThemeableOptionsDef } = _ModuleSupport234; +var nightingaleSeriesOptionsDef = { + ...commonSeriesOptionsDefs15, + ...nightingaleSeriesThemeableOptionsDef, + type: required17(constant17("nightingale")), + angleKey: required17(string15), + radiusKey: required17(string15), + angleName: string15, + radiusName: string15, + legendItemName: string15, + grouped: boolean8, + stacked: boolean8, + stackGroup: string15, + normalizedTo: number7 +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleThemes.ts +import { _ModuleSupport as _ModuleSupport235 } from "ag-charts-community"; +var { + ThemeConstants: { POLAR_AXIS_TYPE, POLAR_AXIS_SHAPE }, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS4, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS2 +} = _ModuleSupport235; +var NIGHTINGALE_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_SERIES_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS4], + ["pattern", FILL_PATTERN_DEFAULTS2] + ] + }, + stroke: { + $if: [{ $eq: [{ $palette: "type" }, "inbuilt"] }, { $ref: "chartBackgroundColor" }, { $palette: "stroke" }] + }, + strokeWidth: 1, + label: { + ..._ModuleSupport235.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: _ModuleSupport235.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE.ANGLE_CATEGORY]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE.CIRCLE }, + groupPaddingInner: 0, + paddingInner: 0, + label: { + spacing: 10 + } + }, + [POLAR_AXIS_TYPE.RADIUS_NUMBER]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE.CIRCLE } + } + } +}; + +// packages/ag-charts-enterprise/src/series/nightingale/nightingaleModule.ts +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE2 } +} = _ModuleSupport236; +var NightingaleModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "nightingale", + moduleFactory: (ctx) => new NightingaleSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE2.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE2.RADIUS_NUMBER }], + themeTemplate: NIGHTINGALE_SERIES_THEME, + stackable: true, + groupable: true, + stackedByDefault: true +}; +var NightingaleSeriesModule = { + type: "series", + name: "nightingale", + chartType: "polar", + enterprise: true, + options: nightingaleSeriesOptionsDef, + create: (ctx) => new NightingaleSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeries.ts +import { + _ModuleSupport as _ModuleSupport238 +} from "ag-charts-community"; +import { + cachedTextMeasurer as cachedTextMeasurer11, + isArray as isArray6, + measureTextSegments as measureTextSegments5, + toPlainText as toPlainText8 +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidProperties.ts +import { _ModuleSupport as _ModuleSupport237 } from "ag-charts-community"; +var { SeriesProperties: SeriesProperties9, makeSeriesTooltip: makeSeriesTooltip18, Property: Property76, Label: Label13, DropShadow: DropShadow5 } = _ModuleSupport237; +var PyramidSeriesLabel = class extends Label13 { +}; +var PyramidSeriesStageLabel = class extends Label13 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property76 +], PyramidSeriesStageLabel.prototype, "spacing", 2); +__decorateClass([ + Property76 +], PyramidSeriesStageLabel.prototype, "placement", 2); +var PyramidProperties = class extends SeriesProperties9 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.direction = "vertical"; + this.reverse = void 0; + this.spacing = 0; + this.aspectRatio = void 0; + this.shadow = new DropShadow5().set({ enabled: false }); + this.label = new PyramidSeriesLabel(); + this.stageLabel = new PyramidSeriesStageLabel(); + this.tooltip = makeSeriesTooltip18(); + } + getStyle(index = 0) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index % fills.length], + fillOpacity, + stroke: strokes[index % strokes.length], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass([ + Property76 +], PyramidProperties.prototype, "stageKey", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "valueKey", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "fills", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "strokes", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "lineDash", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "direction", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "reverse", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "spacing", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "aspectRatio", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "shadow", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "label", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "stageLabel", 2); +__decorateClass([ + Property76 +], PyramidProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidUtil.ts +function applyPyramidDatum(connector, { x, y, top, right, bottom, left }) { + connector.x0 = x - top / 2; + connector.x1 = x + top / 2; + connector.x2 = x + bottom / 2; + connector.x3 = x - bottom / 2; + connector.y0 = y - left / 2; + connector.y1 = y - right / 2; + connector.y2 = y + right / 2; + connector.y3 = y + left / 2; +} +function preparePyramidAnimationFunctions(direction) { + const fromFn = (_connector, datum) => { + const { x, y } = datum; + let { top, right, bottom, left } = datum; + if (direction === "vertical") { + top = 0; + bottom = 0; + } else { + left = 0; + right = 0; + } + return { x, y, top, right, bottom, left }; + }; + const toFn = (_connector, datum) => { + const { x, y, top, right, bottom, left } = datum; + return { x, y, top, right, bottom, left }; + }; + const applyFn = applyPyramidDatum; + return { fromFn, toFn, applyFn }; +} + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeries.ts +var { + StateMachine: StateMachine14, + valueProperty: valueProperty16, + SeriesNodePickMode: SeriesNodePickMode13, + createDatumId: createDatumId17, + BBox: BBox22, + Group: Group16, + Selection: Selection13, + Text: Text7, + PointerEvents: PointerEvents9, + applyShapeStyle: applyShapeStyle14, + mergeDefaults: mergeDefaults17, + fromToMotion: fromToMotion4, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation6, + getLabelStyles: getLabelStyles5 +} = _ModuleSupport238; +var PyramidSeries = class extends _ModuleSupport238.DataModelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [SeriesNodePickMode13.EXACT_SHAPE_MATCH, SeriesNodePickMode13.NEAREST_NODE] + }); + this.properties = new PyramidProperties(); + this.itemGroup = this.contentGroup.appendChild(new Group16({ name: "itemGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group16({ name: "itemLabelGroup" })); + this.stageLabelGroup = this.contentGroup.appendChild(new Group16({ name: "stageLabelGroup" })); + this.datumSelection = Selection13.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection13.select( + this.itemLabelGroup, + Text7 + ); + this.stageLabelSelection = Selection13.select(this.stageLabelGroup, Text7); + this.highlightDatumSelection = Selection13.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this.animationState = new StateMachine14( + "empty", + { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + clear: "empty", + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + this.itemLabelGroup.pointerEvents = PointerEvents9.None; + this.stageLabelGroup.pointerEvents = PointerEvents9.None; + } + addChartEventListeners() { + this.cleanup.register(this.ctx.eventsHub.on("legend:item-click", (event) => this.onLegendItemClick(event))); + } + nodeFactory() { + return new FunnelConnector(); + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + async processData(dataController) { + if (this.data == null) + return; + const { + id: seriesId, + visible, + ctx: { legendManager } + } = this; + const { stageKey, valueKey } = this.properties; + const xScaleType = "category"; + const yScaleType = "number"; + const validation = (_value, _datum, index) => visible && legendManager.getItemEnabled({ seriesId, itemId: index }); + const visibleProps = this.visible ? {} : { forceValue: 0 }; + await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty16(stageKey, xScaleType, { id: "xValue" }), + valueProperty16(valueKey, yScaleType, { id: `yValue`, ...visibleProps, validation, invalidValue: 0 }) + ] + }); + } + createNodeData() { + const { + id: seriesId, + dataModel, + processedData, + properties, + visible, + ctx: { legendManager } + } = this; + const { + stageKey, + valueKey, + direction, + reverse = direction === "horizontal", + spacing, + aspectRatio, + label, + stageLabel + } = properties; + if (dataModel == null || processedData == null) + return; + const horizontal = direction === "horizontal"; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const xDomain = dataModel.getDomain(this, "xValue", "value", processedData); + const yDomain = dataModel.getDomain(this, "yValue", "value", processedData); + const textMeasurer = cachedTextMeasurer11(stageLabel); + let textAlign; + let textBaseline; + if (horizontal) { + textAlign = "center"; + textBaseline = stageLabel.placement === "before" ? "bottom" : "top"; + } else { + textAlign = stageLabel.placement === "after" ? "left" : "right"; + textBaseline = "middle"; + } + const stageLabelData = stageLabel.enabled ? [] : void 0; + let maxLabelWidth = 0; + let maxLabelHeight = 0; + let yTotal = 0; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + const enabled = visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + yTotal += yValue; + if (stageLabelData == null) + continue; + const text2 = this.getLabelText( + xValue2, + datum, + stageKey, + "x", + xDomain, + this.properties.stageLabel, + { datum, value: yValue, stageKey, valueKey } + ); + const { width, height } = isArray6(text2) ? measureTextSegments5(text2, label) : textMeasurer.measureLines(text2); + maxLabelWidth = Math.max(maxLabelWidth, width); + maxLabelHeight = Math.max(maxLabelHeight, height); + stageLabelData.push({ + x: Number.NaN, + y: Number.NaN, + text: text2, + textAlign, + textBaseline, + visible: enabled + }); + } + const seriesRectWidth = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const seriesRectHeight = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const totalSpacing = spacing * (processedData.input.count - 1); + let bounds; + if (horizontal) { + const verticalInset = maxLabelHeight + stageLabel.spacing; + bounds = new BBox22( + 0, + stageLabel.placement === "before" ? verticalInset : 0, + seriesRectWidth, + seriesRectHeight - verticalInset + ); + } else { + const horizontalInset = maxLabelWidth + stageLabel.spacing; + bounds = new BBox22( + stageLabel.placement === "after" ? 0 : horizontalInset, + 0, + seriesRectWidth - horizontalInset, + seriesRectHeight + ); + } + if (aspectRatio != null && aspectRatio !== 0) { + const directionalAspectRatio = direction === "horizontal" ? 1 / aspectRatio : aspectRatio; + const constrainedWidth = Math.min(bounds.width, bounds.height * directionalAspectRatio); + const constrainedHeight = constrainedWidth / directionalAspectRatio; + bounds = new BBox22( + bounds.x + (bounds.width - constrainedWidth) / 2, + bounds.y + (bounds.height - constrainedHeight) / 2, + constrainedWidth, + constrainedHeight + ); + } + let labelX; + let labelY; + if (horizontal) { + labelY = stageLabel.placement === "before" ? bounds.y - stageLabel.spacing : bounds.y + bounds.height + stageLabel.spacing; + } else { + labelX = stageLabel.placement === "after" ? bounds.x + bounds.width + stageLabel.spacing : bounds.x - stageLabel.spacing; + } + const availableWidth = bounds.width - (horizontal ? totalSpacing : 0); + const availableHeight = bounds.height - (horizontal ? 0 : totalSpacing); + if (availableWidth < 0 || availableHeight < 0) + return; + const nodeData = []; + const labelData = []; + let yStart = 0; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + const enabled = visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + const yEnd = yStart + yValue; + const yMidRatio = (yStart + yEnd) / (2 * yTotal); + const yRangeRatio = (yEnd - yStart) / yTotal; + const xOffset = horizontal ? availableWidth * yMidRatio + spacing * datumIndex : availableWidth * 0.5; + const yOffset = horizontal ? availableHeight * 0.5 : availableHeight * yMidRatio + spacing * datumIndex; + const x = bounds.x + xOffset; + const y = bounds.y + yOffset; + if (stageLabelData != null) { + const stageLabelDatum = stageLabelData[datumIndex]; + stageLabelDatum.x = labelX ?? x; + stageLabelDatum.y = labelY ?? y; + } + let top; + let right; + let bottom; + let left; + if (horizontal) { + const barWidth = availableWidth * yRangeRatio; + top = barWidth; + bottom = barWidth; + const y0 = (xOffset + barWidth / 2) * (availableHeight / bounds.width); + const y1 = (xOffset - barWidth / 2) * (availableHeight / bounds.width); + right = reverse ? bounds.height - y0 : y0; + left = reverse ? bounds.height - y1 : y1; + } else { + const barHeight = availableHeight * yRangeRatio; + right = barHeight; + left = barHeight; + const x0 = (yOffset - barHeight / 2) * (availableWidth / bounds.height); + const x1 = (yOffset + barHeight / 2) * (availableWidth / bounds.height); + top = reverse ? bounds.width - x0 : x0; + bottom = reverse ? bounds.width - x1 : x1; + } + const text2 = this.getLabelText( + yValue, + datum, + valueKey, + "y", + yDomain, + label, + { + datum, + value: yValue, + stageKey, + valueKey + } + ); + const labelDatum = { + x, + y, + text: text2, + textAlign: "center", + textBaseline: "middle", + visible: enabled + }; + labelData.push(labelDatum); + nodeData.push({ + series: this, + itemId: valueKey, + datum, + datumIndex, + index: datumIndex, + xValue: xValue2, + yValue, + x, + y, + top, + right, + bottom, + left, + label: labelDatum, + enabled, + midPoint: { + x, + y + }, + style: this.getItemStyle({ datumIndex, datum }, false) + }); + yStart = yEnd; + } + return { + itemId: seriesId, + nodeData, + labelData, + stageLabelData, + bounds + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update({ seriesRect }) { + this.checkResize(seriesRect); + const { datumSelection, labelSelection, stageLabelSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedDatum != null && (highlightedDatum.series !== this || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const stageLabelData = this.contextNodeData?.stageLabelData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection, isHighlight: false }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection, labelProperties: this.properties.label }); + this.stageLabelSelection = this.updateStageLabelSelection({ stageLabelData, stageLabelSelection }); + this.updateLabelNodes({ + labelSelection: stageLabelSelection, + labelProperties: this.properties.stageLabel + }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData); + } + getItemStyle({ datumIndex, datum }, isHighlight) { + const { properties } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults17(highlightStyle, properties.getStyle(datumIndex)); + let style = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId17(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults17(overrides, style); + } + } + return style; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style) { + const { id: seriesId, properties } = this; + const { stageKey, valueKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + stageKey, + valueKey, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const { properties } = this; + const { shadow } = properties; + const bounds = this.contextNodeData?.bounds; + const fillBBox = bounds ? { series: bounds, axis: bounds } : void 0; + datumSelection.each((connector, nodeDatum) => { + applyShapeStyle14(connector, nodeDatum.style, fillBBox); + applyPyramidDatum(connector, nodeDatum); + connector.fillShadow = shadow; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(this.properties.label.enabled ? opts.labelData : []); + } + updateStageLabelSelection(opts) { + return opts.stageLabelSelection.update(opts.stageLabelData); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, nodeDatum, datumIndex) => { + const { visible, x, y, text: text2, textAlign, textBaseline } = nodeDatum; + const style = getLabelStyles5( + this, + void 0, + this.properties, + opts.labelProperties, + false, + activeHighlight + ); + const { color: fill, fontSize, fontStyle, fontWeight, fontFamily } = style; + label.visible = visible; + label.x = x; + label.y = y; + label.text = text2; + label.fill = fill; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + label.setBoxing(style); + }); + } + computeFocusBounds(opts) { + const datum = this.getNodeData()?.[opts.datumIndex]; + if (datum === void 0) + return; + for (const node of this.datumSelection) { + if (node.datum === datum) { + return node.node; + } + } + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { stageKey, valueKey, tooltip } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, "xValue", processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const label = this.getLabelText( + xValue2, + datum, + stageKey, + "x", + dataModel.getDomain(this, "xValue", "value", processedData), + this.properties.stageLabel, + { datum, value: xValue2, stageKey, valueKey } + ); + const value = this.getLabelText( + yValue, + datum, + valueKey, + "y", + dataModel.getDomain(this, "yValue", "value", processedData), + this.properties.stageLabel, + { datum, value: yValue, stageKey, valueKey } + ); + const format = this.getItemStyle({ datumIndex, datum }, false); + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(datumIndex), + data: [{ label: toPlainText8(label), value: toPlainText8(value) }] + }, + { + seriesId, + datum, + title: void 0, + stageKey, + valueKey, + ...format + } + ); + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared = node.distanceSquared(x, y); + if (distanceSquared < minDistanceSquared) { + minDistanceSquared = distanceSquared; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + legendItemSymbol(datumIndex) { + const { fills, strokes, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.properties; + const fill = fills[datumIndex] ?? "black"; + const stroke2 = strokes[datumIndex] ?? "black"; + return { + marker: { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + processedData, + dataModel, + id: seriesId, + ctx: { legendManager }, + visible + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { showInLegend } = this.properties; + const legendData = []; + const stageValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex] of rawData.entries()) { + const stageValue = stageValues[datumIndex]; + legendData.push({ + legendType: "category", + id: seriesId, + itemId: datumIndex, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { text: stageValue }, + symbol: this.legendItemSymbol(datumIndex), + hideInLegend: !showInLegend + }); + } + return legendData; + } + animateReset() { + this.ctx.animationManager.skipCurrentBatch(); + this.ctx.animationManager.stopByAnimationGroupId(this.id); + } + animateEmptyUpdateReady() { + const { datumSelection, labelSelection, properties } = this; + const fns = preparePyramidAnimationFunctions(properties.direction); + fromToMotion4(this.id, "nodes", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation6(this, "labels", this.ctx.animationManager, labelSelection); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +PyramidSeries.className = "PyramidSeries"; +PyramidSeries.type = "pyramid"; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport239 } from "ag-charts-community"; +import { constant as constant18, required as required18, string as string16 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs16, pyramidSeriesThemeableOptionsDef } = _ModuleSupport239; +var pyramidSeriesOptionsDef = { + ...pyramidSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs16, + type: required18(constant18("pyramid")), + stageKey: required18(string16), + valueKey: required18(string16) +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidThemes.ts +import { _ModuleSupport as _ModuleSupport240 } from "ag-charts-community"; +var { + ThemeSymbols: { DEFAULT_SHADOW_COLOUR: DEFAULT_SHADOW_COLOUR2 } +} = _ModuleSupport240; +var PYRAMID_SERIES_THEME = { + series: { + direction: "vertical", + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + spacing: 2, + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", _ModuleSupport240.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", _ModuleSupport240.FILL_PATTERN_DEFAULTS], + ["image", _ModuleSupport240.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + label: { + ..._ModuleSupport240.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + stageLabel: { + ..._ModuleSupport240.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 12 + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR2, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + // @ts-expect-error undocumented option + highlight: _ModuleSupport240.singleSeriesHighlightStyle() + } +}; + +// packages/ag-charts-enterprise/src/series/pyramid/pyramidModule.ts +var PyramidModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "pyramid", + moduleFactory: (ctx) => new PyramidSeries(ctx), + solo: true, + themeTemplate: PYRAMID_SERIES_THEME +}; +var PyramidSeriesModule = { + type: "series", + name: "pyramid", + chartType: "standalone", + enterprise: true, + options: pyramidSeriesOptionsDef, + create: (ctx) => new PyramidSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaModule.ts +import { _ModuleSupport as _ModuleSupport247 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radar/radarThemes.ts +import { _ModuleSupport as _ModuleSupport241 } from "ag-charts-community"; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE3 } +} = _ModuleSupport241; +var BASE_RADAR_SERIES_THEME = { + series: { + stroke: { $palette: "stroke" }, + label: { + ..._ModuleSupport241.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + marker: { + enabled: true, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport241.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", _ModuleSupport241.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport241.FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + fillOpacity: 1, + shape: "circle", + size: 6, + strokeOpacity: 1, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] } + }, + highlight: _ModuleSupport241.multiSeriesHighlightStyle(), + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + } + }, + axes: { + [POLAR_AXIS_TYPE3.ANGLE_CATEGORY]: { + label: { + spacing: 10 + } + } + } +}; +var RADAR_LINE_SERIES_THEME = _ModuleSupport241.mergeDefaults( + { + series: { + stroke: _ModuleSupport241.SAFE_STROKE_FILL_OPERATION, + strokeWidth: 2 + } + }, + BASE_RADAR_SERIES_THEME +); +var RADAR_AREA_SERIES_THEME = _ModuleSupport241.mergeDefaults( + { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", _ModuleSupport241.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", _ModuleSupport241.FILL_IMAGE_DEFAULTS], + ["pattern", _ModuleSupport241.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: 0.8, + strokeWidth: 2, + marker: { + enabled: false + } + } + }, + BASE_RADAR_SERIES_THEME +); + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeries.ts +import { + _ModuleSupport as _ModuleSupport245 +} from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radar/radarSeries.ts +import { + _ModuleSupport as _ModuleSupport243 +} from "ag-charts-community"; +import { isFiniteNumber as isFiniteNumber2, isNumberEqual as isNumberEqual9 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/radar/radarSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport242 } from "ag-charts-community"; +var { Label: Label14, SeriesMarker: SeriesMarker2, SeriesProperties: SeriesProperties10, makeSeriesTooltip: makeSeriesTooltip19, Property: Property77 } = _ModuleSupport242; +var RadarSeriesProperties = class extends SeriesProperties10 { + constructor() { + super(...arguments); + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.rotation = 0; + this.marker = new SeriesMarker2(); + this.label = new Label14(); + this.tooltip = makeSeriesTooltip19(); + this.connectMissingData = false; + } +}; +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "angleKey", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "angleName", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "radiusName", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "rotation", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "marker", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property77 +], RadarSeriesProperties.prototype, "connectMissingData", 2); + +// packages/ag-charts-enterprise/src/series/radar/radarSeries.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS2, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES2, + ChartAxisDirection: ChartAxisDirection29, + PolarAxis: PolarAxis2, + SeriesNodePickMode: SeriesNodePickMode14, + valueProperty: valueProperty17, + fixNumericExtent: fixNumericExtent9, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation7, + markerFadeInAnimation: markerFadeInAnimation2, + resetMarkerFn: resetMarkerFn2, + animationValidation: animationValidation8, + computeMarkerFocusBounds: computeMarkerFocusBounds3, + extent: extent2, + BBox: BBox23, + Group: Group17, + Path: Path12, + Selection: Selection14, + Text: Text8, + Marker: Marker5, + updateLabelNode: updateLabelNode7, + getMarkerStyles: getMarkerStyles2, + mergeDefaults: mergeDefaults18 +} = _ModuleSupport243; +var RadarSeriesNodeEvent = class extends _ModuleSupport243.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadarSeries = class extends _ModuleSupport243.PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: "angleValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS2, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES2, + pickModes: [SeriesNodePickMode14.NEAREST_NODE, SeriesNodePickMode14.EXACT_SHAPE_MATCH], + canHaveAxes: true, + animationResetFns: { + item: resetMarkerFn2 + }, + clipFocusBox: false + }); + this.NodeEvent = RadarSeriesNodeEvent; + this.lineGroup = this.contentGroup.appendChild(new Group17({ name: "radar-line" })); + this.lineSelection = Selection14.select( + this.lineGroup, + Path12 + ); + this.resetInvalidToZero = false; + this.circleCache = { r: 0, cx: 0, cy: 0 }; + this.lineGroup.zIndex = 0; + this.itemGroup.zIndex = 1; + } + get hasData() { + return this.getHasData("angleValue"); + } + nodeFactory() { + return new Marker5(); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection29.Angle) { + return dataModel.getDomain(this, `angleValue`, "value", processedData); + } else { + const domain = dataModel.getDomain(this, `radiusValue`, "value", processedData); + const ext = extent2(domain.length === 0 ? domain : [0].concat(domain)); + return fixNumericExtent9(ext); + } + } + async processData(dataController) { + const { angleKey, radiusKey } = this.properties; + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + extraProps.push(animationValidation8()); + } + const radiusScaleType = this.axes[ChartAxisDirection29.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection29.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty17(angleKey, angleScaleType, { id: "angleValue" }), + valueProperty17(radiusKey, radiusScaleType, { id: "radiusValue", invalidValue: void 0 }), + ...extraProps + ] + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (!(r === cache.r && cx === cache.cx && cy === cache.cy)) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection29.Radius]; + return radiusAxis instanceof PolarAxis2 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + maybeRefreshNodeData() { + const didCircleChange = this.didCircleChange(); + if (!didCircleChange && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + createNodeData() { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return; + const { angleKey, radiusKey, angleName, radiusName, legendItemName, marker, label } = this.properties; + const angleScale = this.axes[ChartAxisDirection29.Angle]?.scale; + const radiusScale = this.axes[ChartAxisDirection29.Radius]?.scale; + if (!angleScale || !radiusScale) { + return; + } + const angleValues = dataModel.resolveColumnById(this, `angleValue`, processedData); + const radiusValues = dataModel.resolveColumnById(this, `radiusValue`, processedData); + const axisInnerRadius = this.getAxisInnerRadius(); + const radiusDomain = this.getSeriesDomain(ChartAxisDirection29.Radius); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const nodeData = rawData.map((datum, datumIndex) => { + const angleDatum = angleValues[datumIndex]; + const radiusDatum = radiusValues[datumIndex]; + const angle = angleScale.convert(angleDatum); + const radius = this.radius + axisInnerRadius - radiusScale.convert(radiusDatum); + const cos = Math.cos(angle); + const sin = Math.sin(angle); + const x = cos * radius; + const y = sin * radius; + let labelNodeDatum; + if (label.enabled) { + const labelText = this.getLabelText( + radiusDatum, + datum, + radiusKey, + "radius", + radiusDomain, + label, + { value: radiusDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + let textAlign = "right"; + if (isNumberEqual9(cos, 0)) { + textAlign = "center"; + } else if (cos > 0) { + textAlign = "left"; + } + let textBaseline = "bottom"; + if (isNumberEqual9(sin, 0)) { + textBaseline = "middle"; + } else if (sin > 0) { + textBaseline = "top"; + } + labelNodeDatum = { + x: x + cos * marker.size, + y: y + sin * marker.size, + text: labelText, + textAlign, + textBaseline + }; + } + } + return { + series: this, + datum, + datumIndex, + index: datumIndex, + point: { x, y, size: marker.size }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + missing: !isFiniteNumber2(angle) || !isFiniteNumber2(radius) + }; + }); + return { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles: getMarkerStyles2(this, this.properties, marker) + }; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const { series } = this.ctx.highlightManager?.getActiveHighlight() ?? {}; + this.highlightGroup.visible = (animationEnabled || this.visible) && series === this; + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updatePathSelections(); + this.updateMarkerSelection(); + this.updateHighlightSelection(); + this.updatePathNodes(); + if (this.hasItemStylers()) { + this.updateDatumStyles(this.itemSelection, false); + this.updateDatumStyles(this.highlightSelection, true); + } + this.updateMarkers(this.itemSelection, false); + this.updateMarkers(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updatePathSelections() { + const pathData = this.visible ? [true] : []; + this.lineSelection.update(pathData); + } + updateMarkerSelection() { + const { marker, styler } = this.properties; + if (marker.isDirty()) { + this.itemSelection.clear(); + this.itemSelection.cleanup(); + this.itemSelection = Selection14.select(this.itemGroup, () => this.nodeFactory(), false); + } + const markersEnabled = styler == null ? marker.enabled : this.getStyle(false).marker.enabled; + const data = this.visible && marker.shape && markersEnabled ? this.nodeData : []; + this.itemSelection.update(data); + } + updateHighlightSelection() { + const { marker, styler } = this.properties; + if (marker.isDirty()) { + this.highlightSelection.clear(); + this.highlightSelection.cleanup(); + this.highlightSelection = Selection14.select(this.highlightGroup, () => this.nodeFactory(), false); + } + const markersEnabled = styler == null ? marker.enabled : this.getStyle(false).marker.enabled; + const highlighted = this.ctx.highlightManager?.getActiveHighlight(); + const data = this.visible && marker.shape && markersEnabled && highlighted?.datum ? [{ ...highlighted }] : []; + this.highlightSelection.update(data); + } + getMarkerFill(highlightedStyle) { + return highlightedStyle?.fill ?? this.getStyle(false).marker.fill; + } + getDatumStylerProperties(datum) { + const { id: seriesId, properties } = this; + const { angleKey, radiusKey } = properties; + return { + seriesId, + datum, + angleKey, + radiusKey + }; + } + updateDatumStyles(selection, isHighlight) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + selection.each((_, datum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { stroke: stroke2, strokeWidth, strokeOpacity } = stylerStyle; + datum.style = this.getMarkerStyle( + this.properties.marker, + datum, + this.getDatumStylerProperties(datum.datum), + { isHighlight, highlightState }, + stylerStyle.marker, + { + stroke: stroke2, + strokeWidth, + strokeOpacity + } + ); + }); + } + updateMarkers(selection, isHighlight) { + const fillBBox = this.getShapeFillBBox(); + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + selection.each((node, datum) => { + const style = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style, node, datum.point, fillBBox); + }); + } + updateLabels() { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + if (datum.label) { + const isHighlight = false; + node.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + updateLabelNode7(this, node, properties, properties.label, datum.label, isHighlight, activeHighlight); + } + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip, marker } = properties; + const angleAxis = axes[ChartAxisDirection29.Angle]; + const radiusAxis = axes[ChartAxisDirection29.Radius]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const angleValue = dataModel.resolveColumnById(this, `angleValue`, processedData)[datumIndex]; + const radiusValue = dataModel.resolveColumnById(this, `radiusValue`, processedData)[datumIndex]; + if (angleValue == null) + return; + const activeStyle = this.getMarkerStyle(marker, { datum, datumIndex }, this.getDatumStylerProperties(datum), { + isHighlight: false + }); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: radiusName, + fallbackLabel: radiusKey, + value: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + radiusKey, + angleName, + radiusName, + legendItemName, + ...activeStyle + } + ); + } + legendItemSymbol() { + const { stroke: stroke2, strokeWidth, strokeOpacity, lineDash, marker } = this.getStyle(false); + const markerStyle = { + shape: marker.shape, + enabled: marker.enabled || strokeWidth <= 0, + fill: this.getMarkerFill() ?? marker.stroke ?? stroke2 ?? "rgba(0, 0, 0, 0)", + stroke: marker.stroke ?? stroke2 ?? "rgba(0, 0, 0, 0)", + fillOpacity: marker.fillOpacity, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }; + return { + marker: markerStyle, + line: { + stroke: stroke2, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { radiusKey, radiusName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: radiusKey, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: radiusKey }), + label: { + text: legendItemName ?? radiusName ?? radiusKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + pickNodeClosestDatum(hitPoint) { + const { nodeData, centerX: cx, centerY: cy } = this; + const { x, y } = hitPoint; + const radius = this.radius; + const distanceFromCenter = Math.hypot(x - cx, y - cy); + if (distanceFromCenter > radius + this.properties.marker.size) { + return; + } + let minDistance = Infinity; + let closestDatum; + for (const datum of nodeData) { + const { point: { x: datumX = Number.NaN, y: datumY = Number.NaN } = {} } = datum; + if (Number.isNaN(datumX) || Number.isNaN(datumY)) { + continue; + } + const distance = Math.hypot(hitPoint.x - datumX - cx, hitPoint.y - datumY - cy); + if (distance < minDistance) { + minDistance = distance; + closestDatum = datum; + } + } + if (closestDatum) { + const distance = Math.max(minDistance - (closestDatum.point?.size ?? 0), 0); + return { datum: closestDatum, distance }; + } + } + computeLabelsBBox() { + const { label } = this.properties; + this.maybeRefreshNodeData(); + const textBoxes = []; + const tempText = new Text8(); + for (const nodeDatum of this.nodeData) { + if (!label.enabled || !nodeDatum.label) { + continue; + } + tempText.text = nodeDatum.label.text; + tempText.x = nodeDatum.label.x; + tempText.y = nodeDatum.label.y; + tempText.setFont(label); + tempText.setAlign(nodeDatum.label); + const box = tempText.getBBox(); + textBoxes.push(box); + } + if (textBoxes.length === 0) { + return null; + } + return BBox23.merge(textBoxes); + } + getLineNode() { + return this.lineSelection?.at(0); + } + beforePathAnimation() { + this.updatePathNodes(); + } + getPathNodesStyle() { + const highlightDatum = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightState(highlightDatum); + const highlightStyle = this.getHighlightStyle(void 0, void 0, highlightState); + const stylerStyle = this.getStyle(false, highlightState); + return mergeDefaults18(highlightStyle, stylerStyle); + } + getLinePoints() { + const { nodeData, resetInvalidToZero } = this; + const { connectMissingData } = this.properties; + if (nodeData.length === 0) { + return []; + } + const radiusAxis = this.axes[ChartAxisDirection29.Radius]; + const angleAxis = this.axes[ChartAxisDirection29.Angle]; + const reversedAngleAxis = angleAxis?.isReversed(); + const reversedRadiusAxis = radiusAxis?.isReversed(); + const data = reversedRadiusAxis && !reversedAngleAxis ? [...nodeData].reverse() : nodeData; + const points = []; + let prevPointInvalid = false; + let firstValid; + for (const [index, datum] of data.entries()) { + let { x, y } = datum.point; + const isPointInvalid = Number.isNaN(x) || Number.isNaN(y); + if (!isPointInvalid) { + firstValid ?? (firstValid = datum); + } + if (isPointInvalid && !connectMissingData) { + x = 0; + y = 0; + } + const moveTo2 = index === 0 || !resetInvalidToZero && !connectMissingData && (isPointInvalid || prevPointInvalid); + points.push({ x, y, moveTo: moveTo2 }); + prevPointInvalid = isPointInvalid; + } + if (firstValid !== void 0) { + points.push({ x: firstValid.point.x, y: firstValid.point.y, moveTo: false }); + } + return points; + } + animateSinglePath(pathNode, points, ratio3) { + const { path } = pathNode; + path.clear(true); + const axisInnerRadius = this.getAxisInnerRadius(); + const radiusAxis = this.axes[ChartAxisDirection29.Radius]; + const reversedRadiusAxis = radiusAxis?.isReversed(); + const radiusZero = reversedRadiusAxis ? this.radius + axisInnerRadius - radiusAxis?.scale.convert(0) : axisInnerRadius; + for (const point of points) { + const { x: x1, y: y1, arc, radius = 0, startAngle = 0, endAngle = 0, moveTo: moveTo2 } = point; + const angle = Math.atan2(y1, x1); + const x0 = radiusZero * Math.cos(angle); + const y0 = radiusZero * Math.sin(angle); + const t = ratio3; + const x = x0 * (1 - t) + x1 * t; + const y = y0 * (1 - t) + y1 * t; + if (arc) { + path.arc(x1, y1, radius, startAngle, endAngle); + } else if (moveTo2) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + pathNode.checkPathDirty(); + } + animatePaths(ratio3) { + const linePoints = this.getLinePoints(); + const lineNode = this.getLineNode(); + if (!lineNode) + return; + this.animateSinglePath(lineNode, linePoints, ratio3); + } + animateEmptyUpdateReady() { + const { itemSelection, labelSelection } = this; + const { animationManager } = this.ctx; + this.beforePathAnimation(); + animationManager.animate({ + id: `${this.id}_'path`, + groupId: this.id, + from: 0, + to: 1, + phase: "initial", + collapsable: false, + onUpdate: (ratio3) => this.animatePaths(ratio3), + onStop: () => this.animatePaths(1) + }); + markerFadeInAnimation2(this, animationManager, "added", itemSelection); + seriesLabelFadeInAnimation7(this, "labels", animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + super.animateWaitingUpdateReady(data); + this.resetPaths(); + } + animateReadyResize(data) { + super.animateReadyResize(data); + this.resetPaths(); + } + resetPaths() { + const lineNode = this.getLineNode(); + if (lineNode) { + const { path: linePath } = lineNode; + const linePoints = this.getLinePoints(); + const stylerStyle = this.getStyle(false); + lineNode.fill = void 0; + lineNode.stroke = stylerStyle.stroke; + lineNode.strokeWidth = stylerStyle.strokeWidth; + lineNode.strokeOpacity = stylerStyle.strokeOpacity; + lineNode.lineDash = stylerStyle.lineDash; + lineNode.lineDashOffset = stylerStyle.lineDashOffset; + linePath.clear(true); + for (const { x, y, moveTo: moveTo2 } of linePoints) { + if (moveTo2) { + linePath.moveTo(x, y); + } else { + linePath.lineTo(x, y); + } + } + lineNode.checkPathDirty(); + return stylerStyle; + } + } + getStylerResult(stylerResult, highlighted, highlightState) { + const { styler } = this.properties; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + const cbResult = this.cachedCallWithContext(styler, stylerParams) ?? {}; + const resolved = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + cbResult, + { pick: false } + ); + if (resolved) { + stylerResult = resolved; + } + } + return stylerResult; + } + getFormattedMarkerStyle(datum) { + const { angleKey, radiusKey } = this.properties; + return this.getMarkerStyle(this.properties.marker, datum, { angleKey, radiusKey }, { isHighlight: true }); + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds3(this, opts); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RadarSeries.className = "RadarSeries"; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeriesProperties.ts +import { + _ModuleSupport as _ModuleSupport244 +} from "ag-charts-community"; +var { Property: Property78 } = _ModuleSupport244; +var RadarAreaSeriesProperties = class extends RadarSeriesProperties { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + } +}; +__decorateClass([ + Property78 +], RadarAreaSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property78 +], RadarAreaSeriesProperties.prototype, "fillOpacity", 2); + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeries.ts +var { + ChartAxisDirection: ChartAxisDirection30, + Group: Group18, + HighlightState: HighlightState4, + Path: Path13, + PointerEvents: PointerEvents10, + Selection: Selection15, + applyShapeStyle: applyShapeStyle15, + toHighlightString: toHighlightString5 +} = _ModuleSupport245; +var RadarAreaSeries = class extends RadarSeries { + constructor(moduleCtx) { + super(moduleCtx); + this.properties = new RadarAreaSeriesProperties(); + this.areaGroup = this.contentGroup.appendChild(new Group18({ name: "radar-area" })); + this.areaSelection = Selection15.select( + this.areaGroup, + Path13 + ); + this.resetInvalidToZero = true; + this.areaGroup.zIndex = -1; + } + updatePathSelections() { + const pathData = this.visible ? [true] : []; + this.areaSelection.update(pathData); + super.updatePathSelections(); + } + getAreaNode() { + return this.areaSelection.at(0); + } + getMarkerFill(highlightedStyle) { + if (highlightedStyle?.fill != null) + return highlightedStyle.fill; + const stylerStyle = this.getStyle(false); + return stylerStyle.marker.fill ?? stylerStyle.fill; + } + updatePathNodes() { + const styles = this.getPathNodesStyle(); + const { fill, fillOpacity, strokeWidth, stroke: stroke2, strokeOpacity, lineDash, lineDashOffset, opacity } = styles; + const lineNode = this.getLineNode(); + if (lineNode) { + lineNode.setProperties({ + fill: void 0, + lineJoin: "round", + lineCap: "round", + pointerEvents: PointerEvents10.None, + opacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + } + const areaNode = this.getAreaNode(); + if (areaNode) { + applyShapeStyle15(areaNode, { fill, fillOpacity, stroke: void 0 }, this.getShapeFillBBox()); + areaNode.setProperties({ + lineJoin: "round", + pointerEvents: PointerEvents10.None, + opacity + }); + } + } + animatePaths(ratio3) { + super.animatePaths(ratio3); + const areaNode = this.getAreaNode(); + if (areaNode) { + this.animateSinglePath(areaNode, this.getAreaPoints(), ratio3); + } + } + getAreaPoints() { + const points = this.getLinePoints(); + const getPolarAxis = (direction) => { + const axis = this.axes[direction]; + return axis instanceof _ModuleSupport245.PolarAxis ? axis : void 0; + }; + const radiusAxis = getPolarAxis(ChartAxisDirection30.Radius); + const angleAxis = getPolarAxis(ChartAxisDirection30.Angle); + const reversedRadiusAxis = radiusAxis?.isReversed(); + if (!reversedRadiusAxis) { + return points; + } + const zeroLinePoints = angleAxis?.getAxisLinePoints()?.points ?? []; + return points.concat(...zeroLinePoints); + } + resetPaths() { + const superStyle = super.resetPaths(); + const areaNode = this.getAreaNode(); + if (areaNode) { + const { path: areaPath } = areaNode; + const areaPoints = this.getAreaPoints(); + const stylerStyle = superStyle ?? this.getStyle(false); + const fillBBox = this.getShapeFillBBox(); + applyShapeStyle15( + areaNode, + { + fill: stylerStyle.fill, + stroke: void 0, + fillOpacity: stylerStyle.fillOpacity, + lineDash: stylerStyle.lineDash, + lineDashOffset: stylerStyle.lineDashOffset + }, + fillBBox + ); + areaNode.lineJoin = areaNode.lineCap = "round"; + areaPath.clear(true); + for (const { x, y, moveTo: moveTo2, arc, radius = 0, startAngle = 0, endAngle = 0 } of areaPoints) { + if (arc) { + areaPath.arc(x, y, radius, startAngle, endAngle); + } else if (moveTo2) { + areaPath.moveTo(x, y); + } else { + areaPath.lineTo(x, y); + } + } + areaPath.closePath(); + areaNode.checkPathDirty(); + return stylerStyle; + } + } + makeStylerParams(highlighted, highlightStateEnum) { + const { properties } = this; + const highlightState = toHighlightString5(highlightStateEnum ?? HighlightState4.None); + return { + marker: { + fill: properties.marker.fill, + fillOpacity: properties.marker.fillOpacity, + size: properties.marker.size, + shape: properties.marker.shape, + stroke: properties.marker.stroke, + strokeOpacity: properties.marker.strokeOpacity, + strokeWidth: properties.marker.strokeWidth, + lineDash: properties.marker.lineDash, + lineDashOffset: properties.marker.lineDashOffset + }, + highlightState, + highlighted, + fill: properties.fill, + fillOpacity: properties.fillOpacity, + lineDash: properties.lineDash, + lineDashOffset: properties.lineDashOffset, + seriesId: this.id, + stroke: properties.stroke, + strokeOpacity: properties.strokeOpacity, + strokeWidth: properties.strokeWidth, + angleKey: properties.angleKey, + radiusKey: properties.radiusKey + }; + } + getStyle(highlighted, highlightState) { + const { marker, fill, fillOpacity, lineDash, lineDashOffset, stroke: stroke2, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill: markerFill = "transparent", fillOpacity: markerFillOpacity } = marker; + const stylerResult = this.getStylerResult({}, highlighted, highlightState); + stylerResult.marker ?? (stylerResult.marker = {}); + return { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke2, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? markerFill, + fillOpacity: stylerResult.marker.fillOpacity ?? markerFillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke2, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } +}; +RadarAreaSeries.className = "RadarAreaSeries"; +RadarAreaSeries.type = "radar-area"; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport246 } from "ag-charts-community"; +import { constant as constant19, required as required19, string as string17 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs17, radarAreaSeriesThemeableOptionsDef } = _ModuleSupport246; +var radarAreaSeriesOptionsDef = { + ...commonSeriesOptionsDefs17, + ...radarAreaSeriesThemeableOptionsDef, + type: required19(constant19("radar-area")), + angleKey: required19(string17), + radiusKey: required19(string17), + angleName: string17, + radiusName: string17, + legendItemName: string17 +}; + +// packages/ag-charts-enterprise/src/series/radar-area/radarAreaModule.ts +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE4 } +} = _ModuleSupport247; +var RadarAreaModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radar-area", + moduleFactory: (ctx) => new RadarAreaSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE4.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE4.RADIUS_NUMBER }], + themeTemplate: RADAR_AREA_SERIES_THEME +}; +var RadarAreaSeriesModule = { + type: "series", + name: "radar-area", + chartType: "polar", + enterprise: true, + options: radarAreaSeriesOptionsDef, + create: (ctx) => new RadarAreaSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineModule.ts +import { _ModuleSupport as _ModuleSupport250 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineSeries.ts +import { + _ModuleSupport as _ModuleSupport248 +} from "ag-charts-community"; +var { HighlightState: HighlightState5, PointerEvents: PointerEvents11, toHighlightString: toHighlightString6 } = _ModuleSupport248; +var RadarLineSeries = class extends RadarSeries { + constructor() { + super(...arguments); + this.properties = new RadarSeriesProperties(); + } + updatePathSelections() { + this.lineSelection.update(this.visible ? [true] : []); + } + updatePathNodes() { + const lineNode = this.getLineNode(); + if (!lineNode) + return; + const style = this.getPathNodesStyle(); + const { strokeWidth, stroke: stroke2, strokeOpacity, lineDash, lineDashOffset, opacity } = style; + lineNode.setProperties({ + fill: void 0, + lineJoin: "round", + lineCap: "round", + pointerEvents: PointerEvents11.None, + opacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { properties } = this; + const highlightState = toHighlightString6(highlightStateEnum ?? HighlightState5.None); + return { + marker: { + fill: properties.marker.fill, + fillOpacity: properties.marker.fillOpacity, + size: properties.marker.size, + shape: properties.marker.shape, + stroke: properties.marker.stroke, + strokeOpacity: properties.marker.strokeOpacity, + strokeWidth: properties.marker.strokeWidth, + lineDash: properties.marker.lineDash, + lineDashOffset: properties.marker.lineDashOffset + }, + highlightState, + highlighted, + lineDash: properties.lineDash, + lineDashOffset: properties.lineDashOffset, + seriesId: this.id, + stroke: properties.stroke, + strokeOpacity: properties.strokeOpacity, + strokeWidth: properties.strokeWidth, + angleKey: properties.angleKey, + radiusKey: properties.radiusKey + }; + } + getStyle(highlighted, highlightState) { + const { marker, lineDash, lineDashOffset, stroke: stroke2, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill = "transparent", fillOpacity } = marker; + const stylerResult = this.getStylerResult({}, highlighted, highlightState); + stylerResult.marker ?? (stylerResult.marker = {}); + return { + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke2, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? fill, + fillOpacity: stylerResult.marker.fillOpacity ?? fillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke2, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } +}; +RadarLineSeries.className = "RadarLineSeries"; +RadarLineSeries.type = "radar-line"; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport249 } from "ag-charts-community"; +import { constant as constant20, required as required20, string as string18 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs18, radarLineSeriesThemeableOptionsDef } = _ModuleSupport249; +var radarLineSeriesOptionsDef = { + ...commonSeriesOptionsDefs18, + ...radarLineSeriesThemeableOptionsDef, + type: required20(constant20("radar-line")), + angleKey: required20(string18), + radiusKey: required20(string18), + angleName: string18, + radiusName: string18, + legendItemName: string18 +}; + +// packages/ag-charts-enterprise/src/series/radar-line/radarLineModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE5 } = _ModuleSupport250.ThemeConstants; +var RadarLineModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radar-line", + moduleFactory: (ctx) => new RadarLineSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE5.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE5.RADIUS_NUMBER }], + themeTemplate: RADAR_LINE_SERIES_THEME +}; +var RadarLineSeriesModule = { + type: "series", + name: "radar-line", + chartType: "polar", + enterprise: true, + options: radarLineSeriesOptionsDef, + create: (ctx) => new RadarLineSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarModule.ts +import { _ModuleSupport as _ModuleSupport256 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeries.ts +import { + _ModuleSupport as _ModuleSupport253 +} from "ag-charts-community"; +import { isDefined as isDefined4 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport251 } from "ag-charts-community"; +var { SeriesProperties: SeriesProperties11, makeSeriesTooltip: makeSeriesTooltip20, Property: Property79, Label: Label15 } = _ModuleSupport251; +var RadialBarSeriesProperties = class extends SeriesProperties11 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.label = new Label15(); + this.tooltip = makeSeriesTooltip20(); + } + getStyle() { + const { fill, fillOpacity, stroke: stroke2, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "angleKey", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "radiusKey", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "angleName", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "radiusName", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "fill", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "styler", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "rotation", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "stackGroup", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "normalizedTo", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property79 +], RadialBarSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarUtil.ts +import { _ModuleSupport as _ModuleSupport252 } from "ag-charts-community"; +var { SectorBox: SectorBox3, motion: motion9 } = _ModuleSupport252; +function fixRadialBarAnimationStatus(node, datum, status) { + if (status === "updated") { + if (node.previousDatum == null || Number.isNaN(node.previousDatum.innerRadius) || Number.isNaN(node.previousDatum.outerRadius)) { + return "added"; + } + if (Number.isNaN(datum.innerRadius) || Number.isNaN(datum.outerRadius)) { + return "removed"; + } + } + if (status === "added" && node.previousDatum != null) { + return "updated"; + } + return status; +} +function prepareRadialBarSeriesAnimationFunctions(axisZeroAngle) { + const fromFn = (sect, datum, status) => { + status = fixRadialBarAnimationStatus(sect, datum, status); + let startAngle; + let endAngle; + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed" || status === "updated") { + startAngle = sect.startAngle; + endAngle = sect.endAngle; + innerRadius = sect.innerRadius; + outerRadius = sect.outerRadius; + clipSector = sect.clipSector; + } else { + startAngle = axisZeroAngle; + endAngle = axisZeroAngle; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + } + clipSector ?? (clipSector = new SectorBox3(startAngle, endAngle, innerRadius, outerRadius)); + const phase = motion9.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { startAngle, endAngle, innerRadius, outerRadius, clipSector, phase }; + }; + const toFn = (sect, datum, status) => { + let startAngle; + let endAngle; + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed") { + startAngle = axisZeroAngle; + endAngle = axisZeroAngle; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + clipSector = new SectorBox3(startAngle, endAngle, innerRadius, outerRadius); + } else { + startAngle = datum.startAngle; + endAngle = datum.endAngle; + innerRadius = Number.isNaN(datum.innerRadius) ? sect.innerRadius : datum.innerRadius; + outerRadius = Number.isNaN(datum.outerRadius) ? sect.outerRadius : datum.outerRadius; + clipSector = datum.clipSector; + } + return { startAngle, endAngle, innerRadius, outerRadius, clipSector }; + }; + return { toFn, fromFn }; +} +function resetRadialBarSelectionsFn(_node, datum) { + return { + centerX: 0, + centerY: 0, + innerRadius: datum.innerRadius, + outerRadius: datum.outerRadius, + startAngle: datum.startAngle, + endAngle: datum.endAngle, + clipSector: datum.clipSector + }; +} + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeries.ts +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS3, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES3, + ChartAxisDirection: ChartAxisDirection31, + PolarAxis: PolarAxis3, + diff: diff7, + groupAccumulativeValueProperty: groupAccumulativeValueProperty3, + keyProperty: keyProperty10, + normaliseGroupTo: normaliseGroupTo2, + valueProperty: valueProperty18, + fixNumericExtent: fixNumericExtent10, + resetLabelFn: resetLabelFn6, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation8, + seriesLabelFadeOutAnimation: seriesLabelFadeOutAnimation2, + animationValidation: animationValidation9, + angleBetween: angleBetween3, + createDatumId: createDatumId18, + CategoryScale: CategoryScale4, + Sector: Sector5, + SectorBox: SectorBox4, + motion: motion10, + isGradientFill: isGradientFill3, + applyShapeStyle: applyShapeStyle16, + updateLabelNode: updateLabelNode8, + getItemStyles: getItemStyles4 +} = _ModuleSupport253; +var RadialBarSeriesNodeEvent = class extends _ModuleSupport253.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadialBarSeries = class extends _ModuleSupport253.PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: "radiusValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS3, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES3, + canHaveAxes: true, + animationResetFns: { + item: resetRadialBarSelectionsFn, + label: resetLabelFn6 + } + }); + this.properties = new RadialBarSeriesProperties(); + this.NodeEvent = RadialBarSeriesNodeEvent; + this.groupScale = new CategoryScale4(); + this.circleCache = { r: 0, cx: 0, cy: 0 }; + } + get hasData() { + return this.getHasData("angleValue-raw"); + } + nodeFactory() { + return new Sector5(); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection31.Angle) { + const xExtent = dataModel.getDomain(this, "angleValue-end", "value", processedData); + const fixedXExtent = [Math.min(xExtent[0], 0), Math.max(xExtent[1], 0)]; + return fixNumericExtent10(fixedXExtent); + } else { + return dataModel.getDomain(this, "radiusValue", "key", processedData); + } + } + async processData(dataController) { + const { angleKey, radiusKey, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const stackGroupId = this.getStackId(); + const stackGroupTrailingId = `${stackGroupId}-trailing`; + const extraProps = []; + if (isDefined4(normalizedTo)) { + extraProps.push(normaliseGroupTo2([stackGroupId, stackGroupTrailingId], Math.abs(normalizedTo))); + } + if (animationEnabled) { + if (this.processedData) { + extraProps.push(diff7(this.id, this.processedData)); + } + extraProps.push(animationValidation9()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const radiusScaleType = this.axes[ChartAxisDirection31.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection31.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty10(radiusKey, radiusScaleType, { id: "radiusValue" }), + valueProperty18(angleKey, angleScaleType, { + id: "angleValue-raw", + invalidValue: null, + ...visibleProps + }), + ...groupAccumulativeValueProperty3( + angleKey, + "normal", + { + id: `angleValue-end`, + rangeId: `angleValue-range`, + invalidValue: null, + groupId: stackGroupId, + separateNegative: true, + ...visibleProps + }, + angleScaleType + ), + ...groupAccumulativeValueProperty3( + angleKey, + "trailing", + { + id: `angleValue-start`, + invalidValue: null, + groupId: stackGroupTrailingId, + separateNegative: true, + ...visibleProps + }, + angleScaleType + ), + ...extraProps + ], + groupByKeys: true, + groupByData: false + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (!(r === cache.r && cx === cache.cx && cy === cache.cy)) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + maybeRefreshNodeData() { + const circleChanged = this.didCircleChange(); + if (!circleChanged && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection31.Radius]; + return radiusAxis instanceof PolarAxis3 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + createNodeData() { + const { processedData, dataModel } = this; + if (!dataModel || !processedData || processedData.type !== "grouped") + return; + const angleAxis = this.axes[ChartAxisDirection31.Angle]; + const radiusAxis = this.axes[ChartAxisDirection31.Radius]; + const angleScale = angleAxis?.scale; + const radiusScale = radiusAxis?.scale; + if (!angleScale || !radiusScale) { + return; + } + const radiusValues = dataModel.resolveKeysById(this, "radiusValue", processedData); + const angleStartValues = dataModel.resolveColumnById(this, `angleValue-start`, processedData); + const angleEndValues = dataModel.resolveColumnById(this, `angleValue-end`, processedData); + const angleRawValues = dataModel.resolveColumnById(this, `angleValue-raw`, processedData); + const angleRangeIndex = dataModel.resolveProcessedDataIndexById(this, `angleValue-range`); + let groupPaddingInner = 0; + if (radiusAxis instanceof RadiusCategoryAxis) { + groupPaddingInner = radiusAxis.groupPaddingInner; + } + const { groupScale } = this; + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + groupScale.domain = Array.from({ length: visibleGroupCount }).map((_, i) => String(i)); + groupScale.range = [0, Math.abs(radiusScale.bandwidth ?? 0)]; + groupScale.paddingInner = visibleGroupCount > 1 ? groupPaddingInner : 0; + const barWidth = groupScale.bandwidth >= 1 ? groupScale.bandwidth : groupScale.rawBandwidth; + const angleAxisReversed = angleAxis.isReversed(); + const radiusAxisReversed = radiusAxis.isReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const axisTotalRadius = axisOuterRadius + axisInnerRadius; + const angleDomain = this.getSeriesDomain(ChartAxisDirection31.Angle); + const { angleKey, radiusKey, angleName, radiusName, legendItemName, label } = this.properties; + const getLabelNodeDatum = (datum, angleDatum, x, y) => { + const labelText = this.getLabelText( + angleDatum, + datum, + angleKey, + "angle", + angleDomain, + label, + { value: angleDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + return { x, y, text: labelText, textAlign: "center", textBaseline: "middle" }; + } + }; + const nodeData = []; + const styles = getItemStyles4( + (nodeDatum, isHighlight, highlightState) => getItemStyle(this, nodeDatum, isHighlight, highlightState) + ); + const context = { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + if (!this.visible) + return context; + const { dataSources } = processedData; + const rawData = dataSources.get(this.id)?.data ?? []; + for (const { datumIndex, group } of dataModel.forEachGroupDatum(this, processedData)) { + const datum = rawData[datumIndex]; + const radiusDatum = radiusValues[datumIndex]; + if (radiusDatum == null) + return; + const angleDatum = angleRawValues[datumIndex]; + const angleStartDatum = angleStartValues[datumIndex]; + const angleEndDatum = angleEndValues[datumIndex]; + const isPositive = angleDatum >= 0 && !Object.is(angleDatum, -0); + const angleRange = group.aggregation[angleRangeIndex][isPositive ? 1 : 0]; + const reversed = isPositive === angleAxisReversed; + let startAngle = angleScale.convert(angleStartDatum, { clamp: true }); + let endAngle = angleScale.convert(angleEndDatum, { clamp: true }); + let rangeStartAngle = angleScale.convert(0, { clamp: true }); + let rangeEndAngle = angleScale.convert(angleRange, { clamp: true }); + if (reversed) { + [rangeStartAngle, rangeEndAngle] = [rangeEndAngle, rangeStartAngle]; + [startAngle, endAngle] = [endAngle, startAngle]; + } + const dataRadius = axisTotalRadius - radiusScale.convert(radiusDatum); + const innerRadius = dataRadius + groupScale.convert(String(groupIndex)); + const outerRadius = innerRadius + barWidth; + const midRadius = (innerRadius + outerRadius) / 2; + const midAngle = startAngle + angleBetween3(startAngle, endAngle) / 2; + const x = Math.cos(midAngle) * midRadius; + const y = Math.sin(midAngle) * midRadius; + const labelNodeDatum = this.properties.label.enabled ? getLabelNodeDatum(datum, angleDatum, x, y) : void 0; + const clipSector = new SectorBox4(startAngle, endAngle, innerRadius, outerRadius); + nodeData.push({ + series: this, + datum, + datumIndex, + point: { x, y, size: 0 }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + innerRadius, + outerRadius, + startAngle: rangeStartAngle, + endAngle: rangeEndAngle, + clipSector, + reversed, + index: datumIndex + }); + } + return context; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updateSectorSelection(this.itemSelection, false); + this.updateSectorSelection(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateSectorSelection(selection, isHighlight) { + let selectionData = []; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + if (isHighlight) { + if (activeHighlight?.datum && activeHighlight.series === this) { + selectionData.push(activeHighlight); + } + } else { + selectionData = this.nodeData; + } + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const fillBBox = this.getShapeFillBBox(); + const hasItemStylers = this.hasItemStylers(); + selection.update(selectionData, void 0, (datum) => this.getDatumId(datum)).each((node, nodeDatum) => { + const datum = readDatum(nodeDatum); + if (datum == null) + return; + if (hasItemStylers) { + const highlightState = this.getHighlightState(activeHighlight, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = getItemStyle(this, nodeDatum, isHighlight, highlightState); + } + const style = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + const cornerRadius = style.cornerRadius; + const fill = style.fill; + const fillParams = _ModuleSupport253.isGradientFill(fill) && fill.bounds !== "item" ? { centerX: 0, centerY: 0 } : void 0; + applyShapeStyle16(node, style, fillBBox, fillParams); + node.lineJoin = "round"; + node.inset = node.stroke == null ? 0 : node.strokeWidth / 2; + node.startInnerCornerRadius = datum.reversed ? cornerRadius : 0; + node.startOuterCornerRadius = datum.reversed ? cornerRadius : 0; + node.endInnerCornerRadius = datum.reversed ? 0 : cornerRadius; + node.endOuterCornerRadius = datum.reversed ? 0 : cornerRadius; + if (isHighlight) { + node.startAngle = nodeDatum.startAngle; + node.endAngle = nodeDatum.endAngle; + node.clipSector = nodeDatum.clipSector; + node.innerRadius = nodeDatum.innerRadius; + node.outerRadius = nodeDatum.outerRadius; + } + }); + } + updateLabels() { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + const isHighlight = false; + updateLabelNode8(this, node, properties, properties.label, datum.label, isHighlight, activeHighlight); + node.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + }); + } + getBarTransitionFunctions() { + const angleScale = this.axes[ChartAxisDirection31.Angle]?.scale; + let axisZeroAngle = 0; + if (!angleScale) { + return prepareRadialBarSeriesAnimationFunctions(axisZeroAngle); + } + const d0 = Math.min(angleScale.domain[0], angleScale.domain[1]); + const d1 = Math.max(angleScale.domain[0], angleScale.domain[1]); + if (d0 <= 0 && d1 >= 0) { + axisZeroAngle = angleScale.convert(0); + } + return prepareRadialBarSeriesAnimationFunctions(axisZeroAngle); + } + animateEmptyUpdateReady() { + const { labelSelection } = this; + const fns = this.getBarTransitionFunctions(); + motion10.fromToMotion(this.id, "datums", this.ctx.animationManager, [this.itemSelection], fns); + seriesLabelFadeInAnimation8(this, "labels", this.ctx.animationManager, labelSelection); + } + animateClearingUpdateEmpty() { + const { itemSelection } = this; + const { animationManager } = this.ctx; + const fns = this.getBarTransitionFunctions(); + motion10.fromToMotion(this.id, "datums", animationManager, [itemSelection], fns); + seriesLabelFadeOutAnimation2(this, "labels", animationManager, this.labelSelection); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip } = properties; + const angleAxis = axes[ChartAxisDirection31.Angle]; + const radiusAxis = axes[ChartAxisDirection31.Radius]; + const nodeDatum = this.nodeData?.[datumIndex]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis || !nodeDatum) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const radiusValue = dataModel.resolveKeysById(this, `radiusValue`, processedData)[datumIndex]; + const angleValue = dataModel.resolveColumnById(this, `angleValue-raw`, processedData)[datumIndex]; + if (radiusValue == null) + return; + const format = getItemStyle(this, nodeDatum, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: angleName, + fallbackLabel: angleKey, + value: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + angleName, + radiusKey, + radiusName, + legendItemName, + ...format + } + ); + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.itemSelection.nodes()); + } + legendItemSymbol() { + const { fill, stroke: stroke2, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = getStyle( + this, + false, + false, + _ModuleSupport253.HighlightState.None + ); + const markerStyle = { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke2 ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + if (isGradientFill3(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: markerStyle + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { angleKey, angleName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: angleKey, + seriesId, + enabled: visible, + label: { + text: legendItemName ?? angleName ?? angleKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getDatumId(datum) { + return createDatumId18(datum.radiusValue); + } + computeLabelsBBox() { + return null; + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `radialBar-stack-${groupIndex}-xValues`; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +RadialBarSeries.className = "RadialBarSeries"; +RadialBarSeries.type = "radial-bar"; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport254 } from "ag-charts-community"; +import { boolean as boolean9, constant as constant21, number as number8, required as required21, string as string19 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs19, radialBarSeriesThemeableOptionsDef } = _ModuleSupport254; +var radialBarSeriesOptionsDef = { + ...commonSeriesOptionsDefs19, + ...radialBarSeriesThemeableOptionsDef, + type: required21(constant21("radial-bar")), + angleKey: required21(string19), + radiusKey: required21(string19), + angleName: string19, + radiusName: string19, + legendItemName: string19, + grouped: boolean9, + stacked: boolean9, + stackGroup: string19, + normalizedTo: number8 +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarThemes.ts +import { _ModuleSupport as _ModuleSupport255 } from "ag-charts-community"; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE6 }, + FILL_GRADIENT_CONIC_SERIES_DEFAULTS, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS5, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS3 +} = _ModuleSupport255; +var RADIAL_BAR_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_CONIC_SERIES_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS5], + ["pattern", FILL_PATTERN_DEFAULTS3] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + label: { + ..._ModuleSupport255.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + highlight: _ModuleSupport255.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE6.RADIUS_CATEGORY]: { + innerRadiusRatio: 0.2, + groupPaddingInner: 0.2, + paddingInner: 0.2, + paddingOuter: 0.1 + } + } +}; + +// packages/ag-charts-enterprise/src/series/radial-bar/radialBarModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE7 } = _ModuleSupport256.ThemeConstants; +var RadialBarModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radial-bar", + moduleFactory: (ctx) => new RadialBarSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE7.ANGLE_NUMBER }, { type: POLAR_AXIS_TYPE7.RADIUS_CATEGORY }], + themeTemplate: RADIAL_BAR_SERIES_THEME, + stackable: true, + groupable: true +}; +var RadialBarSeriesModule = { + type: "series", + name: "radial-bar", + chartType: "polar", + enterprise: true, + options: radialBarSeriesOptionsDef, + create: (ctx) => new RadialBarSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnModule.ts +import { _ModuleSupport as _ModuleSupport261 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeries.ts +import { _ModuleSupport as _ModuleSupport258 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport257 } from "ag-charts-community"; +var { Property: Property80 } = _ModuleSupport257; +var RadialColumnSeriesProperties = class extends RadialColumnSeriesBaseProperties { +}; +__decorateClass([ + Property80 +], RadialColumnSeriesProperties.prototype, "columnWidthRatio", 2); +__decorateClass([ + Property80 +], RadialColumnSeriesProperties.prototype, "maxColumnWidthRatio", 2); + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeries.ts +var { ChartAxisDirection: ChartAxisDirection32, PolarAxis: PolarAxis4, RadialColumnShape, getRadialColumnWidth } = _ModuleSupport258; +var RadialColumnSeries = class extends RadialColumnSeriesBase { + constructor(moduleCtx) { + super(moduleCtx, { + animationResetFns: { + item: resetRadialColumnSelectionFn + } + }); + this.properties = new RadialColumnSeriesProperties(); + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `radarColumn-stack-${groupIndex}-yValues`; + } + nodeFactory() { + return new RadialColumnShape(); + } + getColumnTransitionFunctions() { + const axisZeroRadius = this.isRadiusAxisReversed() ? this.radius : this.getAxisInnerRadius(); + return prepareRadialColumnAnimationFunctions(axisZeroRadius); + } + isRadiusAxisCircle() { + const radiusAxis = this.axes[ChartAxisDirection32.Radius]; + return radiusAxis instanceof PolarAxis4 ? radiusAxis.shape === "circle" : false; + } + updateItemPath(node, datum, highlight) { + node.isBeveled = this.isRadiusAxisCircle(); + node.isRadiusAxisReversed = this.isRadiusAxisReversed(); + if (highlight) { + node.innerRadius = datum.innerRadius; + node.outerRadius = datum.outerRadius; + node.startAngle = datum.startAngle; + node.endAngle = datum.endAngle; + node.columnWidth = datum.columnWidth; + node.axisInnerRadius = datum.axisInnerRadius; + node.axisOuterRadius = datum.axisOuterRadius; + } + } + getColumnWidth(startAngle, endAngle) { + const { columnWidthRatio = 0.5, maxColumnWidthRatio = 0.5 } = this.properties; + return getRadialColumnWidth(startAngle, endAngle, this.radius, columnWidthRatio, maxColumnWidthRatio); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +RadialColumnSeries.className = "RadialColumnSeries"; +RadialColumnSeries.type = "radial-column"; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport259 } from "ag-charts-community"; +import { boolean as boolean10, constant as constant22, number as number9, required as required22, string as string20 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs20, radialColumnSeriesThemeableOptionsDef } = _ModuleSupport259; +var radialColumnSeriesOptionsDef = { + ...commonSeriesOptionsDefs20, + ...radialColumnSeriesThemeableOptionsDef, + type: required22(constant22("radial-column")), + angleKey: required22(string20), + radiusKey: required22(string20), + angleName: string20, + radiusName: string20, + legendItemName: string20, + grouped: boolean10, + stacked: boolean10, + stackGroup: string20, + normalizedTo: number9 +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnThemes.ts +import { _ModuleSupport as _ModuleSupport260 } from "ag-charts-community"; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE8, POLAR_AXIS_SHAPE: POLAR_AXIS_SHAPE2 }, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS: FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS6, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS4 +} = _ModuleSupport260; +var RADIAL_COLUMN_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2], + ["image", FILL_IMAGE_DEFAULTS6], + ["pattern", FILL_PATTERN_DEFAULTS4] + ] + }, + stroke: { $palette: "stroke" }, + columnWidthRatio: 0.5, + maxColumnWidthRatio: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + label: { + ..._ModuleSupport260.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: _ModuleSupport260.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE8.ANGLE_CATEGORY]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE2.CIRCLE }, + groupPaddingInner: 0, + paddingInner: 0, + label: { + spacing: 10 + } + }, + [POLAR_AXIS_TYPE8.RADIUS_NUMBER]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE2.CIRCLE }, + innerRadiusRatio: 0.5 + } + } +}; + +// packages/ag-charts-enterprise/src/series/radial-column/radialColumnModule.ts +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE9 } = _ModuleSupport261.ThemeConstants; +var RadialColumnModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radial-column", + moduleFactory: (ctx) => new RadialColumnSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE9.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE9.RADIUS_NUMBER }], + themeTemplate: RADIAL_COLUMN_SERIES_THEME, + stackable: true, + groupable: true +}; +var RadialColumnSeriesModule = { + type: "series", + name: "radial-column", + chartType: "polar", + enterprise: true, + options: radialColumnSeriesOptionsDef, + create: (ctx) => new RadialColumnSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeModule.ts +import { _ModuleSupport as _ModuleSupport266 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeries.ts +import { + _ModuleSupport as _ModuleSupport265 +} from "ag-charts-community"; +import { cachedTextMeasurer as cachedTextMeasurer12, isArray as isArray7, measureTextSegments as measureTextSegments6, toPlainText as toPlainText10 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeNeedle.ts +import { _ModuleSupport as _ModuleSupport262 } from "ag-charts-community"; +var { SvgPath, Rotatable, Translatable, Scalable: Scalable2 } = _ModuleSupport262; +var RadialGaugeNeedle = class extends Rotatable(Scalable2(Translatable(SvgPath))) { + constructor() { + super(...arguments); + this.scalingCenterX = 0.5; + this.scalingCenterY = 0.5; + this.rotationCenterX = 0.5; + this.rotationCenterY = 0.5; + } +}; +RadialGaugeNeedle.defaultPathData = "M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport263 } from "ag-charts-community"; +var { getColorStops: getColorStops2, normalizeAngle360: normalizeAngle3606, normalizeAngle360Inclusive: normalizeAngle360Inclusive2, toDegrees } = _ModuleSupport263; +var { BaseProperties: BaseProperties28, makeSeriesTooltip: makeSeriesTooltip21, SeriesProperties: SeriesProperties12, PropertiesArray: PropertiesArray8, AxisLabel: AxisLabel6, Property: Property81, Label: Label16 } = _ModuleSupport263; +var RadialGaugeDefaultTargetLabelProperties = class extends Label16 { +}; +__decorateClass([ + Property81 +], RadialGaugeDefaultTargetLabelProperties.prototype, "spacing", 2); +var RadialGaugeTargetProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.label = new RadialGaugeDefaultTargetLabelProperties(); + } + getStyle() { + const { + fill = "black", + fillOpacity = 1, + stroke: stroke2 = "black", + strokeWidth = 0, + strokeOpacity = 1, + lineDash = [0], + lineDashOffset = 0 + } = this; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "text", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "value", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "shape", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "placement", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "spacing", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "size", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "rotation", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "fill", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "stroke", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "lineDash", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property81 +], RadialGaugeTargetProperties.prototype, "label", 2); +var RadialGaugeBarProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.enabled = true; + this.fills = new PropertiesArray8(_ModuleSupport263.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(defaultColorRange, scale) { + const { + enabled, + fill, + fills, + fillMode, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const barFill = enabled ? fill ?? createConicGradient(fills, fillMode, defaultColorRange, scale) : "none"; + return { + fill: barFill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "enabled", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "fills", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "fillMode", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "fill", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "stroke", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "lineDash", 2); +__decorateClass([ + Property81 +], RadialGaugeBarProperties.prototype, "lineDashOffset", 2); +var RadialGaugeScaleIntervalProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.values = void 0; + this.step = void 0; + this.minSpacing = 0; + this.maxSpacing = 1e3; + } +}; +__decorateClass([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "values", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "step", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "maxSpacing", 2); +var RadialGaugeScaleLabelProperties = class extends AxisLabel6 { +}; +var RadialGaugeScaleProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.min = 0; + this.max = 1; + this.fills = new PropertiesArray8(_ModuleSupport263.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.defaultFill = "black"; + this.interval = new RadialGaugeScaleIntervalProperties(); + this.label = new RadialGaugeScaleLabelProperties(); + } + getStyle(barEnabled, defaultColorRange, scale) { + const { + fill, + fills, + defaultFill, + fillMode, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const scaleFill = fill ?? (barEnabled && fills.length === 0 ? defaultFill : void 0) ?? createConicGradient(fills, fillMode, defaultColorRange, scale); + return { + fill: scaleFill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "min", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "max", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "fills", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "fillMode", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "fill", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "stroke", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "defaultFill", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "interval", 2); +__decorateClass([ + Property81 +], RadialGaugeScaleProperties.prototype, "label", 2); +var RadialGaugeNeedleProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.enabled = true; + this.spacing = 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "enabled", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "radiusRatio", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "spacing", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "fill", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "stroke", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "lineDash", 2); +__decorateClass([ + Property81 +], RadialGaugeNeedleProperties.prototype, "lineDashOffset", 2); +var RadialGaugeLabelProperties = class extends AutoSizedLabel { +}; +__decorateClass([ + Property81 +], RadialGaugeLabelProperties.prototype, "text", 2); +var RadialGaugeSecondaryLabelProperties = class extends AutoSizedSecondaryLabel { +}; +__decorateClass([ + Property81 +], RadialGaugeSecondaryLabelProperties.prototype, "text", 2); +var RadialGaugeSeriesProperties = class extends SeriesProperties12 { + constructor() { + super(...arguments); + this.startAngle = 0; + this.endAngle = 0; + this.segmentation = new GaugeSegmentationProperties(); + this.defaultColorRange = []; + this.targets = new PropertiesArray8(RadialGaugeTargetProperties); + this.defaultTarget = new RadialGaugeTargetProperties(); + this.outerRadiusRatio = 1; + this.innerRadiusRatio = 1; + this.cornerRadius = 0; + this.cornerMode = "container"; + this.spacing = 0; + this.scale = new RadialGaugeScaleProperties(); + this.bar = new RadialGaugeBarProperties(); + this.needle = new RadialGaugeNeedleProperties(); + this.label = new RadialGaugeLabelProperties(); + this.secondaryLabel = new RadialGaugeSecondaryLabelProperties(); + this.tooltip = makeSeriesTooltip21(); + } +}; +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "value", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "startAngle", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "endAngle", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "segmentation", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "targets", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "defaultTarget", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "outerRadiusRatio", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "innerRadiusRatio", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "outerRadius", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "innerRadius", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "cornerMode", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "spacing", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "scale", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "bar", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "needle", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "secondaryLabel", 2); +__decorateClass([ + Property81 +], RadialGaugeSeriesProperties.prototype, "tooltip", 2); +function createConicGradient(fills, fillMode, defaultColorRange, scale) { + const { domain, range: range2 } = scale; + const [startAngle, endAngle] = range2; + const conicAngle = normalizeAngle3606((startAngle + endAngle) / 2 + Math.PI); + const sweepAngle = normalizeAngle360Inclusive2(endAngle - startAngle); + const colorStops = getColorStops2(fills, defaultColorRange, domain, fillMode).map( + ({ color: color6, stop }) => { + stop = Math.min(Math.max(stop, 0), 1); + const angle = startAngle + sweepAngle * stop; + stop = (angle - conicAngle) / (2 * Math.PI); + stop = (stop % 1 + 1) % 1; + return { stop, color: color6 }; + } + ); + return { + type: "gradient", + gradient: "conic", + colorSpace: "oklch", + colorStops, + bounds: "series", + rotation: toDegrees(conicAngle) + 90 + }; +} + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeUtil.ts +import { _ModuleSupport as _ModuleSupport264 } from "ag-charts-community"; +import { toPlainText as toPlainText9 } from "ag-charts-core"; +var { SectorBox: SectorBox5 } = _ModuleSupport264; +function computeClipSector(datum) { + const { startAngle, endAngle, clipStartAngle, clipEndAngle, innerRadius, outerRadius } = datum; + if (clipStartAngle == null || clipEndAngle == null) + return; + return new SectorBox5( + Math.max(clipStartAngle, startAngle), + Math.min(clipEndAngle, endAngle), + innerRadius, + outerRadius + ); +} +function clipSectorVisibility(startAngle, endAngle, clipSector) { + return Math.max(startAngle, clipSector.startAngle) <= Math.min(endAngle, clipSector.endAngle); +} +function hasClipSector(datum) { + return datum.clipStartAngle != null && datum.clipEndAngle != null; +} +function datumClipSector(datum, zero) { + const { clipStartAngle, clipEndAngle, innerRadius, outerRadius } = datum; + return new SectorBox5(clipStartAngle, zero ? clipStartAngle : clipEndAngle, innerRadius, outerRadius); +} +function prepareRadialGaugeSeriesAnimationFunctions(initialLoad, initialStartAngle) { + const phase = initialLoad ? "initial" : "update"; + const node = { + fromFn(sect, datum) { + const previousDatum = sect.previousDatum; + let { startAngle, endAngle } = previousDatum ?? datum; + const previousClipSector = previousDatum != null && hasClipSector(previousDatum) ? datumClipSector(previousDatum, initialLoad) : void 0; + const nextClipSector = hasClipSector(datum) ? datumClipSector(datum, initialLoad) : void 0; + let clipSector; + if (previousClipSector != null && nextClipSector != null) { + clipSector = previousClipSector; + } else if (previousClipSector == null && nextClipSector != null) { + clipSector = nextClipSector; + startAngle = datum.startAngle; + endAngle = datum.endAngle; + } else if (previousClipSector != null && nextClipSector == null) { + clipSector = void 0; + startAngle = datum.startAngle; + endAngle = datum.endAngle; + } else if (initialLoad) { + endAngle = startAngle; + } + return { startAngle, endAngle, clipSector, phase }; + }, + toFn(_sect, datum) { + const { startAngle, endAngle } = datum; + let clipSector; + if (hasClipSector(datum)) { + clipSector = datumClipSector(datum, false); + } + return { startAngle, endAngle, clipSector }; + }, + applyFn(sect, params) { + const { startAngle, endAngle } = params; + let { clipSector } = params; + if (clipSector != null) { + clipSector = new SectorBox5( + Math.max(startAngle, clipSector.startAngle), + Math.min(endAngle, clipSector.endAngle), + clipSector.innerRadius, + clipSector.outerRadius + ); + } + const visible = clipSector == null || clipSectorVisibility(startAngle, endAngle, clipSector); + sect.startAngle = startAngle; + sect.endAngle = endAngle; + sect.clipSector = clipSector; + sect.visible = visible; + } + }; + const needle = { + fromFn(needleNode) { + let { angle: rotation } = needleNode.previousDatum ?? needleNode.datum; + if (initialLoad) { + rotation = initialStartAngle; + } + return { rotation, phase }; + }, + toFn(_needleNode, datum) { + const { angle: rotation } = datum; + return { rotation }; + } + }; + return { node, needle }; +} +function resetRadialGaugeSeriesResetSectorFunction(_node, datum) { + const { startAngle, endAngle } = datum; + const clipSector = computeClipSector(datum); + const visible = clipSector == null || clipSectorVisibility(startAngle, endAngle, clipSector); + return { startAngle, endAngle, clipSector, visible }; +} +function resetRadialGaugeSeriesResetNeedleFunction(_node, datum) { + const { angle } = datum; + return { rotation: angle }; +} +var verticalAlignFactors3 = { + top: 0, + middle: 0.5, + bottom: 1 +}; +function formatRadialGaugeLabels(series, ctx, selection, opts, innerRadius, datumOverrides) { + const { padding, textAlign, verticalAlign } = opts; + let labelDatum; + let secondaryLabelDatum; + selection.each((_node, datum) => { + if (datum.label === "primary" /* Primary */) { + labelDatum = datum; + } else if (datum.label === "secondary" /* Secondary */) { + secondaryLabelDatum = datum; + } + }); + if (labelDatum == null) + return; + const labelText = getLabelText(series.id, ctx, labelDatum, datumOverrides?.label); + if (labelText == null) + return; + const secondaryLabelText = secondaryLabelDatum == null ? void 0 : getLabelText(series.id, ctx, secondaryLabelDatum, datumOverrides?.secondaryLabel); + const params = { padding }; + const horizontalFactor = textAlign === "center" ? 2 : 1; + const verticalFactor = verticalAlign === "middle" ? 2 : 1; + const sizeFittingHeight = (height2) => ({ + width: Math.sqrt(Math.max(innerRadius ** 2 - (height2 / verticalFactor) ** 2, 0)) * horizontalFactor, + height: Math.min(height2, verticalFactor * innerRadius), + meta: null + }); + let labelLayout; + let secondaryLabelLayout; + let height; + if (secondaryLabelDatum != null && secondaryLabelText != null) { + const layout = formatStackedLabels( + toPlainText9(labelText), + labelDatum, + toPlainText9(secondaryLabelText), + secondaryLabelDatum, + params, + sizeFittingHeight + ); + labelLayout = layout?.label; + secondaryLabelLayout = layout?.secondaryLabel; + height = layout?.height ?? 0; + } else { + const layout = formatSingleLabel(toPlainText9(labelText), labelDatum, params, sizeFittingHeight); + labelLayout = layout?.[0]; + secondaryLabelLayout = void 0; + height = layout?.[0].height ?? 0; + } + const rectYOffset = height * verticalAlignFactors3[verticalAlign]; + selection.each((label, datum) => { + let layout; + if (datum.label === "primary" /* Primary */) { + layout = labelLayout; + } else if (datum.label === "secondary" /* Secondary */) { + layout = secondaryLabelLayout; + } + if (layout == null) { + label.visible = false; + return; + } + label.visible = true; + label.text = layout.text; + label.fontSize = layout.fontSize; + label.lineHeight = layout.lineHeight; + label.textAlign = textAlign; + label.textBaseline = "middle"; + const rectOriginInLabelRect = datum.label === "primary" /* Primary */ ? layout.height / 2 : height - layout.height / 2; + label.y = datum.centerY + rectOriginInLabelRect - rectYOffset; + label.x = datum.centerX; + }); +} + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeSeries.ts +var { + fromToMotion: fromToMotion5, + resetMotion: resetMotion4, + SeriesNodePickMode: SeriesNodePickMode15, + StateMachine: StateMachine15, + createDatumId: createDatumId19, + normalizeAngle360: normalizeAngle3607, + normalizeAngle360Inclusive: normalizeAngle360Inclusive3, + isBetweenAngles: isBetweenAngles2, + sectorBox, + toRadians: toRadians5, + BBox: BBox24, + Group: Group19, + PointerEvents: PointerEvents12, + Selection: Selection16, + Sector: Sector6, + SectorBox: SectorBox6, + Text: Text9, + Marker: Marker6, + tickFormat: tickFormat2, + applyShapeStyle: applyShapeStyle17, + mergeDefaults: mergeDefaults19 +} = _ModuleSupport265; +var targetPlacementRotation = { + inside: 90, + middle: 0, + outside: -90 +}; +var outsideLabelPlacements = [ + { textAlign: "left", textBaseline: "top" }, + { textAlign: "right", textBaseline: "top" }, + { textAlign: "right", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "bottom" } +]; +var insideLabelPlacements = [ + { textAlign: "right", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "top" }, + { textAlign: "right", textBaseline: "top" } +]; +var RadialGaugeSeries = class extends _ModuleSupport265.Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode15.EXACT_SHAPE_MATCH, SeriesNodePickMode15.NEAREST_NODE] + }); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.properties = new RadialGaugeSeriesProperties(); + this.scale = new LinearAngleScale(); + this.scaleGroup = this.contentGroup.appendChild(new Group19({ name: "scaleGroup" })); + this.itemGroup = this.contentGroup.appendChild(new Group19({ name: "itemGroup" })); + this.itemNeedleGroup = this.contentGroup.appendChild(new Group19({ name: "itemNeedleGroup" })); + this.itemTargetGroup = this.contentGroup.appendChild(new Group19({ name: "itemTargetGroup" })); + this.itemTargetLabelGroup = this.contentGroup.appendChild(new Group19({ name: "itemTargetLabelGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group19({ name: "itemLabelGroup" })); + this.highlightTargetGroup = this.highlightGroup.appendChild( + new Group19({ name: "itemTargetLabelGroup" }) + ); + this.tickGroup = this.contentGroup.appendChild(new Group19({ name: "tickGroup" })); + this.scaleSelection = Selection16.select( + this.scaleGroup, + () => this.nodeFactory() + ); + this.datumSelection = Selection16.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.needleSelection = Selection16.select( + this.itemNeedleGroup, + RadialGaugeNeedle + ); + this.targetSelection = Selection16.select( + this.itemTargetGroup, + () => this.markerFactory() + ); + this.targetLabelSelection = Selection16.select(this.itemTargetLabelGroup, Text9); + this.labelSelection = Selection16.select( + this.itemLabelGroup, + Text9 + ); + this.highlightTargetSelection = Selection16.select(this.highlightTargetGroup, () => this.markerFactory()); + this.tickSelection = Selection16.select(this.tickGroup, _ModuleSupport265.TransformableText); + this.datumUnion = new DatumUnion(); + this.animationState = new StateMachine15("empty", { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.animateReadyResize(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateWaitingUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty" + }, + reset: "empty", + skip: "ready" + } + }); + this.scaleGroup.pointerEvents = PointerEvents12.None; + this.tickGroup.pointerEvents = PointerEvents12.None; + this.itemNeedleGroup.pointerEvents = PointerEvents12.None; + this.itemLabelGroup.pointerEvents = PointerEvents12.None; + } + get hasData() { + return this.properties.value != null; + } + nodeFactory() { + return new Sector6(); + } + markerFactory() { + const marker = new Marker6(); + marker.size = 1; + return marker; + } + processData() { + this.nodeDataRefresh = true; + this.animationState.transition("updateData"); + } + formatLabel(value) { + const { min, max } = this.properties.scale; + return formatLabel(value, { min, max }); + } + layoutScale() { + const { scale, properties } = this; + const { seriesRectWidth, seriesRectHeight } = this.nodeDataDependencies; + const { scale: scaleProps, outerRadius } = this.properties; + const { min, max, label, interval } = scaleProps; + const startAngle = toRadians5(properties.startAngle - 90); + const endAngle = toRadians5(properties.endAngle - 90); + const sweepAngle = normalizeAngle360Inclusive3(endAngle - startAngle); + const largerThanHalf = sweepAngle > Math.PI; + const containsTop = largerThanHalf || isBetweenAngles2(1.5 * Math.PI, startAngle, endAngle); + const containsRight = largerThanHalf || isBetweenAngles2(0 * Math.PI, startAngle, endAngle); + const containsBottom = largerThanHalf || isBetweenAngles2(0.5 * Math.PI, startAngle, endAngle); + const containsLeft = largerThanHalf || isBetweenAngles2(1 * Math.PI, startAngle, endAngle); + let textAlign; + if (containsLeft && !containsRight) { + textAlign = "right"; + } else if (!containsLeft && containsRight) { + textAlign = "left"; + } else { + textAlign = "center"; + } + let verticalAlign; + if (containsTop && !containsBottom) { + verticalAlign = "bottom"; + } else if (!containsTop && containsBottom) { + verticalAlign = "top"; + } else { + verticalAlign = "middle"; + } + const unitBox = sectorBox({ + startAngle, + endAngle, + innerRadius: 0, + outerRadius: 0.5 + }); + const centerXOffset = -(unitBox.x + unitBox.width / 2) * 2; + const centerYOffset = -(unitBox.y + unitBox.height / 2) * 2; + const unitBoxSize = Math.min(seriesRectWidth / unitBox.width, seriesRectHeight / unitBox.height); + scale.domain = [min, max]; + scale.range = [startAngle, endAngle]; + scale.arcLength = unitBoxSize / 2; + const { maxSpacing, minSpacing } = interval; + const { arcLength } = scale; + const minTickCount = maxSpacing ? Math.floor(arcLength / maxSpacing) : 1; + const maxTickCount = minSpacing ? Math.floor(arcLength / minSpacing) : Infinity; + const preferredTickCount = Math.floor(4 / Math.PI * Math.abs(scale.range[0] - scale.range[1])); + const tickCount = Math.max(minTickCount, Math.min(maxTickCount, preferredTickCount)); + const ticks = interval.values ?? scale.ticks({ + nice: false, + interval: interval.step, + minTickCount, + maxTickCount, + tickCount + })?.ticks ?? []; + const tickFormatter = tickFormat2(ticks, typeof label.format === "string" ? label.format : void 0); + const measurer2 = cachedTextMeasurer12(label); + const tickData = ticks.map((value, index) => { + let text2; + if (label.formatter) { + text2 = formatWithContext(this.ctx, label.formatter, { + value, + index, + domain: scale.domain, + boundSeries: void 0 + }); + } + text2 ?? (text2 = tickFormatter?.(value)); + if (text2 == null) + return; + const { width, height } = isArray7(text2) ? measureTextSegments6(text2, label) : measurer2.measureLines(text2); + return { index, value, text: text2, width, height }; + }).filter((value) => value != null); + const maxWidth = tickData.reduce((m, t) => Math.max(m, t.width), 0); + const maxHeight = tickData.reduce((m, t) => Math.max(m, t.height), 0); + const labelInset = label.enabled ? Math.max(maxWidth, maxHeight) + label.spacing : 0; + const radiusBounds = Math.max( + 0.5 * unitBoxSize - labelInset, + // seriesRect may have negative size + 0 + ); + const radius = outerRadius ?? radiusBounds; + this.centerX = seriesRectWidth / 2 + centerXOffset * radius; + this.centerY = seriesRectHeight / 2 + centerYOffset * radius; + this.radius = radius; + this.textAlign = textAlign; + this.verticalAlign = verticalAlign; + return tickData; + } + getShapeFillBBox() { + const { centerX, centerY, radius } = this; + const bbox = new BBox24(centerX - radius, centerY - radius, 2 * radius, 2 * radius); + return { + series: bbox, + axis: bbox + }; + } + getTargets() { + const { properties } = this; + const defaultTarget = properties.defaultTarget; + return Array.from(properties.targets).map((target) => { + const { + text: text2 = defaultTarget.text, + value = defaultTarget.value ?? 0, + shape = defaultTarget.shape ?? "triangle", + rotation = defaultTarget.rotation ?? 0, + placement = defaultTarget.placement ?? "middle", + spacing = defaultTarget.spacing ?? 0, + size = defaultTarget.size ?? 0 + } = target; + const { + enabled: labelEnabled = defaultTarget.label.enabled, + color: labelColor = defaultTarget.label.color ?? "black", + fontStyle: labelFontStyle = defaultTarget.label.fontStyle ?? "normal", + fontWeight: labelFontWeight = defaultTarget.label.fontWeight ?? "normal", + fontSize: labelFontSize = defaultTarget.label.fontSize, + fontFamily: labelFontFamily = defaultTarget.label.fontFamily, + spacing: labelSpacing = defaultTarget.label.spacing ?? 0 + } = target.label; + return { + text: text2, + value, + shape, + placement, + spacing, + size, + rotation, + label: { + enabled: labelEnabled, + color: labelColor, + fontStyle: labelFontStyle, + fontWeight: labelFontWeight, + fontSize: labelFontSize, + fontFamily: labelFontFamily, + spacing: labelSpacing + }, + style: target.getStyle() + }; + }); + } + getTargetRadius(target) { + const { radius, properties } = this; + const { innerRadiusRatio, outerRadiusRatio } = properties; + const { placement, spacing, size } = target; + const outerRadius = radius * outerRadiusRatio; + const innerRadius = radius * innerRadiusRatio; + switch (placement) { + case "inside": + return Math.max(innerRadius - spacing - size / 2, 0); + case "outside": + return outerRadius + spacing + size / 2; + default: + return (innerRadius + outerRadius) / 2; + } + } + getTargetLabel(target) { + const { scale } = this; + const { value, size, placement, label } = target; + const { spacing, color: fill, fontStyle, fontWeight, fontSize, fontFamily } = label; + const lineHeight = void 0; + const angle = scale.convert(value); + const quadrant = Math.trunc(normalizeAngle3607(angle) / (Math.PI / 2)); + const offset = size / 2 + spacing; + let textAlign; + let textBaseline; + let offsetX; + let offsetY; + switch (placement) { + case "outside": + ({ textAlign, textBaseline } = outsideLabelPlacements[quadrant]); + offsetX = offset * Math.cos(angle); + offsetY = offset * Math.sin(angle); + break; + case "inside": + ({ textAlign, textBaseline } = insideLabelPlacements[quadrant]); + offsetX = -offset * Math.cos(angle); + offsetY = -offset * Math.sin(angle); + break; + default: + textAlign = "center"; + textBaseline = "bottom"; + offsetX = 0; + offsetY = -offset; + break; + } + return { + offsetX, + offsetY, + fill, + textAlign, + textBaseline, + fontStyle, + fontWeight, + fontSize, + fontFamily, + lineHeight + }; + } + createNodeData() { + const tickData = this.layoutScale(); + const { id: seriesId, scale, properties, radius, centerX, centerY } = this; + const { + value, + innerRadiusRatio, + outerRadiusRatio, + segmentation, + cornerRadius, + cornerMode, + needle, + bar, + scale: scaleProps, + label, + secondaryLabel + } = properties; + const { + outerRadius = radius * outerRadiusRatio, + innerRadius = radius * innerRadiusRatio, + defaultColorRange + } = properties; + const targets = this.getTargets(); + const nodeData = []; + const targetData = []; + const needleData = []; + const labelData = []; + const scaleData = []; + const cornersOnAllItems = cornerMode === "item"; + const containerStartAngle = scale.convert(scale.domain[0]); + const containerEndAngle = scale.convert(value); + const maxTicks = Math.ceil(normalizeAngle360Inclusive3(containerEndAngle - containerStartAngle) * radius); + let segments = segmentation.enabled ? segmentation.interval.getSegments(scale, maxTicks) : void 0; + const barStyle = bar.getStyle(defaultColorRange, scale); + const scaleStyle = scaleProps.getStyle(bar.enabled, defaultColorRange, scale); + if (segments == null && cornersOnAllItems) { + const segmentStart = Math.min(...scale.domain); + const segmentEnd = Math.max(...scale.domain); + const datum = { value, segmentStart, segmentEnd }; + const appliedCornerRadius = Math.min(cornerRadius, (outerRadius - innerRadius) / 2); + const angleInset = appliedCornerRadius / ((innerRadius + outerRadius) / 2); + nodeData.push({ + series: this, + itemId: `value`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: containerStartAngle - angleInset, + endAngle: containerEndAngle + angleInset, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornerRadius, + endCornerRadius: cornerRadius, + style: barStyle + }); + scaleData.push({ + series: this, + itemId: `scale`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: scale.range[0] - angleInset, + endAngle: scale.range[1] + angleInset, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornerRadius, + endCornerRadius: cornerRadius, + style: scaleStyle + }); + } else { + segments ?? (segments = scale.domain); + for (let i = 0; i < segments.length - 1; i++) { + const segmentStart = segments[i]; + const segmentEnd = segments[i + 1]; + const datum = { value, segmentStart, segmentEnd }; + const isStart = i === 0; + const isEnd = i === segments.length - 2; + const itemStartAngle = scale.convert(segmentStart); + const itemEndAngle = scale.convert(segmentEnd); + nodeData.push({ + series: this, + itemId: `value-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: itemStartAngle, + endAngle: itemEndAngle, + clipStartAngle: containerStartAngle, + clipEndAngle: containerEndAngle, + startCornerRadius: cornersOnAllItems || isStart ? cornerRadius : 0, + endCornerRadius: cornersOnAllItems || isEnd ? cornerRadius : 0, + style: barStyle + }); + scaleData.push({ + series: this, + itemId: `scale-${i}`, + datum, + datumIndex: { type: 0 /* Node */ }, + type: 0 /* Node */, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: itemStartAngle, + endAngle: itemEndAngle, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornersOnAllItems || isStart ? cornerRadius : 0, + endCornerRadius: cornersOnAllItems || isEnd ? cornerRadius : 0, + style: scaleStyle + }); + } + } + if (!needle.enabled && label.enabled) { + const { + text: text2, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter = (params) => this.formatLabel(params.value) + } = label; + labelData.push({ + label: "primary" /* Primary */, + centerX, + centerY, + text: text2, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + }); + } + if (!needle.enabled && secondaryLabel.enabled) { + const { + text: text2, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + } = secondaryLabel; + labelData.push({ + label: "secondary" /* Secondary */, + centerX, + centerY, + text: text2, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter + }); + } + if (needle.enabled) { + let needleRadius = needle.radiusRatio == null ? innerRadius : radius * needle.radiusRatio; + needleRadius = Math.max(needleRadius - needle.spacing, 0); + const needleAngle = scale.convert(value); + needleData.push({ + centerX, + centerY, + radius: needleRadius, + angle: needleAngle, + series: this + }); + } + for (let i = 0; i < targets.length; i += 1) { + const target = targets[i]; + const { value: targetValue, text: text2, size, shape, style } = target; + if (targetValue < Math.min(...scale.domain) || targetValue > Math.max(...scale.domain)) { + continue; + } + const targetRadius = this.getTargetRadius(target); + const targetAngle = scale.convert(targetValue); + const targetRotation = toRadians5(target.rotation + targetPlacementRotation[target.placement]); + targetData.push({ + series: this, + itemId: `target-${i}`, + midPoint: { + x: targetRadius * Math.cos(targetAngle) + centerX, + y: targetRadius * Math.sin(targetAngle) + centerY + }, + datum: { value: targetValue }, + datumIndex: { type: 1 /* Target */, index: i }, + type: 1 /* Target */, + value: targetValue, + text: text2, + centerX, + centerY, + shape, + radius: targetRadius, + angle: targetAngle, + rotation: targetRotation, + size, + label: this.getTargetLabel(target), + style + }); + } + return { + itemId: seriesId, + nodeData, + needleData, + targetData, + labelData, + scaleData, + tickData + }; + } + updateSelections(resize) { + if (this.nodeDataRefresh || resize) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + highlightDatum(node) { + if (node != null && node.series === this && node.type === 1 /* Target */) { + return node; + } + } + update({ seriesRect }) { + const { + datumSelection, + labelSelection, + needleSelection, + targetSelection, + targetLabelSelection, + scaleSelection, + highlightTargetSelection, + tickSelection + } = this; + const resize = this.checkResize(seriesRect); + this.updateSelections(resize); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const needleData = this.contextNodeData?.needleData ?? []; + const targetData = this.contextNodeData?.targetData ?? []; + const scaleData = this.contextNodeData?.scaleData ?? []; + const tickData = this.contextNodeData?.tickData ?? []; + const highlightTargetDatum = this.highlightDatum(this.ctx.highlightManager.getActiveHighlight()); + this.scaleSelection = this.updateScaleSelection({ scaleData, scaleSelection }); + this.updateScaleNodes({ scaleSelection }); + this.needleSelection = this.updateNeedleSelection({ needleData, needleSelection }); + this.updateNeedleNodes({ needleSelection }); + this.targetSelection = this.updateTargetSelection({ targetData, targetSelection }); + this.updateTargetStyles({ targetSelection, isHighlight: false }); + this.updateTargetNodes({ targetSelection }); + this.targetLabelSelection = this.updateTargetLabelSelection({ targetData, targetLabelSelection }); + this.updateTargetLabelNodes({ targetLabelSelection }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightTargetSelection = this.updateTargetSelection({ + targetData: highlightTargetDatum == null ? [] : [highlightTargetDatum], + targetSelection: highlightTargetSelection + }); + this.updateTargetStyles({ targetSelection: highlightTargetSelection, isHighlight: true }); + this.updateTargetNodes({ targetSelection: highlightTargetSelection }); + this.tickSelection = this.updateTickSelection({ tickData, tickSelection }); + this.updateTickNodes({ tickSelection }); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => { + return createDatumId19(opts.nodeData.length, datum.itemId); + }); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + const { ctx, properties } = this; + const { segmentation } = properties; + const sectorSpacing = segmentation.spacing ?? 0; + const animationDisabled = ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((sector, datum) => { + const { centerX, centerY, innerRadius, outerRadius, startCornerRadius, endCornerRadius } = datum; + sector.centerX = centerX; + sector.centerY = centerY; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + sector.pointerEvents = this.properties.bar.enabled ? _ModuleSupport265.PointerEvents.All : _ModuleSupport265.PointerEvents.None; + applyShapeStyle17(sector, datum.style, fillBBox); + sector.startOuterCornerRadius = startCornerRadius; + sector.startInnerCornerRadius = startCornerRadius; + sector.endOuterCornerRadius = endCornerRadius; + sector.endInnerCornerRadius = endCornerRadius; + sector.radialEdgeInset = (sectorSpacing + sector.strokeWidth) / 2; + sector.concentricEdgeInset = sector.strokeWidth / 2; + if (animationDisabled || sector.previousDatum == null) { + sector.setProperties(resetRadialGaugeSeriesResetSectorFunction(sector, datum)); + } + }); + this.datumUnion.update(datumSelection, this.itemGroup, _ModuleSupport265.Sector, (node, first, last) => { + node.clipSector ?? (node.clipSector = new SectorBox6(Number.NaN, Number.NaN, Number.NaN, Number.NaN)); + node.centerX = first.centerX; + node.centerY = first.centerY; + node.outerRadius = node.clipSector.outerRadius = first.outerRadius; + node.innerRadius = node.clipSector.innerRadius = first.innerRadius; + node.startAngle = node.clipSector.startAngle = first.startAngle; + node.startInnerCornerRadius = first.startInnerCornerRadius; + node.startOuterCornerRadius = first.startOuterCornerRadius; + node.endAngle = last.endAngle; + node.clipSector.endAngle = last.clipSector?.endAngle ?? last.endAngle; + node.endInnerCornerRadius = last.endInnerCornerRadius; + node.endOuterCornerRadius = last.endOuterCornerRadius; + node.pointerEvents = _ModuleSupport265.PointerEvents.None; + }); + } + updateScaleSelection(opts) { + return opts.scaleSelection.update(opts.scaleData, void 0, (datum) => { + return createDatumId19(opts.scaleData.length, datum.itemId); + }); + } + updateScaleNodes(opts) { + const { scaleSelection } = opts; + const { segmentation } = this.properties; + const sectorSpacing = segmentation.spacing ?? 0; + const fillBBox = this.getShapeFillBBox(); + scaleSelection.each((sector, datum) => { + const { centerX, centerY, innerRadius, outerRadius, startCornerRadius, endCornerRadius } = datum; + sector.centerX = centerX; + sector.centerY = centerY; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + applyShapeStyle17(sector, datum.style, fillBBox); + sector.startOuterCornerRadius = startCornerRadius; + sector.startInnerCornerRadius = startCornerRadius; + sector.endOuterCornerRadius = endCornerRadius; + sector.endInnerCornerRadius = endCornerRadius; + sector.radialEdgeInset = (sectorSpacing + sector.strokeWidth) / 2; + sector.concentricEdgeInset = sector.strokeWidth / 2; + sector.setProperties(resetRadialGaugeSeriesResetSectorFunction(sector, datum)); + }); + } + updateNeedleSelection(opts) { + return opts.needleSelection.update(opts.needleData, void 0, () => createDatumId19(0)); + } + updateNeedleNodes(opts) { + const { needleSelection } = opts; + const { fill, fillOpacity, stroke: stroke2, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties.needle; + const animationDisabled = this.ctx.animationManager.isSkipped(); + needleSelection.each((needle, datum) => { + const { centerX, centerY, radius } = datum; + const scale = radius * 2; + needle.d = RadialGaugeNeedle.defaultPathData; + applyShapeStyle17(needle, { + fill, + fillOpacity, + stroke: stroke2, + strokeOpacity, + strokeWidth: strokeWidth / scale, + lineDash: lineDash.map((d) => d / scale), + lineDashOffset: lineDashOffset / scale + }); + needle.translationX = centerX; + needle.translationY = centerY; + needle.scalingX = scale; + needle.scalingY = scale; + if (animationDisabled) { + needle.setProperties(resetRadialGaugeSeriesResetNeedleFunction(needle, datum)); + } + }); + } + updateTargetSelection(opts) { + return opts.targetSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetStyles({ + targetSelection, + isHighlight + }) { + targetSelection.each((_, datum) => { + datum.style = this.getTargetStyle(isHighlight, datum); + }); + } + updateTargetNodes({ + targetSelection + }) { + targetSelection.each((target, datum) => { + const { centerX, centerY, angle, radius, shape, size, rotation } = datum; + applyShapeStyle17(target, datum.style); + target.size = size; + target.shape = shape === "line" ? lineMarker : shape; + target.translationX = centerX + radius * Math.cos(angle); + target.translationY = centerY + radius * Math.sin(angle); + target.rotation = angle + rotation; + }); + } + getTargetStyle(isHighlight, { datumIndex, style }) { + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + return mergeDefaults19(highlightStyle, { + ...style, + opacity: 1 + }); + } + updateTargetLabelSelection(opts) { + return opts.targetLabelSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetLabelNodes(opts) { + const { targetLabelSelection } = opts; + targetLabelSelection.each((label, target) => { + const { centerX, centerY, radius, angle, text: text2 } = target; + const { offsetX, offsetY, fill, fontStyle, fontWeight, fontSize, fontFamily, textAlign, textBaseline } = target.label; + if (text2 == null) { + label.visible = false; + return; + } + label.visible = true; + label.x = centerX + radius * Math.cos(angle) + offsetX; + label.y = centerY + radius * Math.sin(angle) + offsetY; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(opts.labelData, void 0, (datum) => datum.label); + } + updateLabelNodes(opts) { + const { labelSelection } = opts; + const animationDisabled = this.ctx.animationManager.isSkipped(); + labelSelection.each((label, datum) => { + label.fill = datum.fill; + label.fontStyle = datum.fontStyle; + label.fontWeight = datum.fontWeight; + label.fontFamily = datum.fontFamily; + }); + if (animationDisabled || this.labelsHaveExplicitText()) { + this.formatLabelText(); + } + } + updateTickSelection(opts) { + return opts.tickSelection.update(opts.tickData, void 0, (datum) => datum.index); + } + updateTickNodes(opts) { + const { scale, radius, centerX, centerY, properties } = this; + const { enabled, color: color6, fontFamily, fontSize, fontStyle, fontWeight, spacing } = properties.scale.label; + const rotation = toRadians5(properties.scale.label.rotation ?? 0); + opts.tickSelection.each((label, datum) => { + if (!enabled) { + label.visible = false; + return; + } + label.visible = true; + label.text = datum.text; + label.fill = color6; + label.fontFamily = fontFamily; + label.fontSize = fontSize; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.textAlign = "center"; + label.textBaseline = "middle"; + const angle = scale.convert(datum.value); + const { width, height } = datum; + const originX = Math.abs(radius * Math.cos(angle)); + const originY = Math.abs(radius * Math.sin(angle)); + const x0 = Math.min(Math.max(Math.abs(radius / Math.tan(angle)), originX - width / 2), originX + width / 2); + const y0 = Math.min( + Math.max(Math.abs(radius * Math.tan(angle)), originY - height / 2), + originY + height / 2 + ); + const outerR = Math.hypot(x0, y0); + const x = centerX + (outerR + spacing) * Math.cos(angle); + const y = centerY + (outerR + spacing) * Math.sin(angle); + label.x = x; + label.y = y; + label.rotationCenterX = x; + label.rotationCenterY = y; + label.rotation = rotation; + }); + } + labelsHaveExplicitText() { + for (const { datum } of this.labelSelection) { + if (datum.text == null) { + return false; + } + } + return true; + } + formatLabelText(datum) { + const { labelSelection, radius, textAlign, verticalAlign } = this; + const { spacing: padding, innerRadiusRatio } = this.properties; + formatRadialGaugeLabels( + this, + this.ctx, + labelSelection, + { padding, textAlign, verticalAlign }, + radius * innerRadiusRatio, + datum + ); + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + resetMotion4([this.datumSelection], resetRadialGaugeSeriesResetSectorFunction); + resetMotion4([this.needleSelection], resetRadialGaugeSeriesResetNeedleFunction); + this.formatLabelText(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + animateLabelText(params = {}) { + const { animationManager } = this.ctx; + let labelFrom; + let labelTo; + let secondaryLabelFrom; + let secondaryLabelTo; + this.labelSelection.each((label, datum) => { + label.opacity = 1; + if (datum.label === "primary" /* Primary */) { + labelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + labelTo = datum.value; + } else if (datum.label === "secondary" /* Secondary */) { + secondaryLabelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + secondaryLabelTo = datum.value; + } + }); + if (this.labelsHaveExplicitText()) { + } else if (labelTo == null || secondaryLabelTo == null) { + this.formatLabelText(); + } else if (labelFrom === labelTo && secondaryLabelFrom === secondaryLabelTo) { + this.formatLabelText({ label: labelTo, secondaryLabel: secondaryLabelTo }); + } else { + const animationId = `${this.id}_labels`; + animationManager.animate({ + id: animationId, + groupId: "label", + from: { label: labelFrom, secondaryLabel: secondaryLabelFrom }, + to: { label: labelTo, secondaryLabel: secondaryLabelTo }, + phase: params.phase ?? "update", + onUpdate: (datum) => this.formatLabelText(datum), + onStop: () => this.formatLabelText({ label: labelTo, secondaryLabel: secondaryLabelTo }) + }); + } + } + animateEmptyUpdateReady() { + const { animationManager } = this.ctx; + const { node, needle } = prepareRadialGaugeSeriesAnimationFunctions(true, this.scale.range[0]); + fromToMotion5(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion5(this.id, "needle", animationManager, [this.needleSelection], needle, () => "needle"); + fromToMotion5( + this.id, + "label", + animationManager, + [this.labelSelection], + fadeInFns, + (_label, datum) => datum.label + ); + this.animateLabelText({ + from: this.properties.scale.min, + phase: "initial" + }); + } + animateWaitingUpdateReady() { + const { animationManager } = this.ctx; + const { node, needle } = prepareRadialGaugeSeriesAnimationFunctions(false, this.scale.range[0]); + fromToMotion5(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion5(this.id, "needle", animationManager, [this.needleSelection], needle, () => "needle"); + this.animateLabelText(); + } + animateReadyResize() { + this.resetAllAnimation(); + } + dataCount() { + return Number.NaN; + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData() { + return []; + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties } = this; + const { tooltip } = properties; + let value; + let text2; + let fallbackLabel; + if (datumIndex.type === 0 /* Node */) { + value = properties.value; + text2 = properties.label.text; + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeValue"); + } else { + ({ value, text: text2 } = properties.targets[datumIndex.index]); + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeTarget"); + } + if (value == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + data: [{ label: text2, fallbackLabel, value: this.formatLabel(value) }] + }, + { seriesId, title: void 0, datum: void 0, value } + ); + } + pickNodeClosestDatum(point) { + return pickGaugeNearestDatum(this, point); + } + pickFocus(opts) { + return pickGaugeFocus(this, opts); + } + getCaptionText() { + const { value } = this.properties; + const description = []; + description.push(this.formatLabel(value)); + this.labelSelection.each((_label, datum) => { + const text2 = getLabelText(this.id, this.ctx, datum); + if (text2 != null) { + description.push(toPlainText10(text2)); + } + }); + return description.join(". "); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +RadialGaugeSeries.className = "RadialGaugeSeries"; +RadialGaugeSeries.type = "radial-gauge"; + +// packages/ag-charts-enterprise/src/series/radial-gauge/radialGaugeModule.ts +var { FONT_SIZE_RATIO: FONT_SIZE_RATIO2 } = _ModuleSupport266; +var RadialGaugeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "radial-gauge", + moduleFactory: (ctx) => new RadialGaugeSeries(ctx), + themeTemplate: { + minWidth: 200, + minHeight: 200, + tooltip: { + enabled: false + }, + series: { + outerRadiusRatio: 1, + innerRadiusRatio: 0.8, + startAngle: 270, + endAngle: 270 + 180, + defaultColorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $interpolate: [{ $palette: "secondDivergingColors" }, 5] }, + _ModuleSupport266.SAFE_RANGE2_OPERATION + ] + }, + scale: { + // @ts-expect-error undocumented option + defaultFill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + stroke: { $path: ["/2", _ModuleSupport266.SAFE_STROKE_FILL_OPERATION, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 12 + } + }, + bar: { + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + segmentation: { + enabled: false, + interval: {}, + spacing: 2 + }, + defaultTarget: { + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + size: 10, + shape: "triangle", + placement: "outside", + spacing: 5, + label: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 5 + } + }, + needle: { + enabled: false, + fill: { $ref: "foregroundColor" }, + spacing: 10 + }, + label: { + ..._ModuleSupport266.LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: 56, + minimumFontSize: 18 / 56, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + }, + secondaryLabel: { + ..._ModuleSupport266.LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: FONT_SIZE_RATIO2.LARGE }, + minimumFontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "subtleTextColor" } + }, + tooltip: { + range: { $path: ["/tooltip/range", 10] } + } + } + } +}; +var RadialGaugeSeriesModule = { + type: "series", + name: "radial-gauge", + chartType: "standalone", + enterprise: true, + options: _ModuleSupport266.radialGaugeSeriesOptionsDef, + create: (ctx) => new RadialGaugeSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/sankey/sankeyModule.ts +import { _ModuleSupport as _ModuleSupport271 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeries.ts +import { + _ModuleSupport as _ModuleSupport269 +} from "ag-charts-community"; +import { Logger as Logger21, cachedTextMeasurer as cachedTextMeasurer13, calcLineHeight as calcLineHeight7, toPlainText as toPlainText11, wrapText as wrapText4 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/sankey/sankeyLink.ts +import { _ModuleSupport as _ModuleSupport267 } from "ag-charts-community"; +import { clamp as clamp10 } from "ag-charts-core"; +var { BBox: BBox25, Path: Path14, Vec2: Vec220, SceneChangeDetection: SceneChangeDetection10 } = _ModuleSupport267; +var SankeyLink = class extends Path14 { + constructor() { + super(...arguments); + this.x1 = 0; + this.x2 = 0; + this.y1 = 0; + this.y2 = 0; + this.height = 0; + this.inset = 0; + this.elbows = []; + } + computeBBox() { + const x = Math.min(this.x1, this.x2); + const width = Math.max(this.x1, this.x2) - x; + const y = Math.min(this.y1, this.y2); + const height = Math.max(this.y1, this.y2) - y + this.height; + return new BBox25(x, y, width, height); + } + updatePath() { + const { path, inset } = this; + path.clear(); + const height = this.height - 2 * this.inset; + const offset = height / 2; + let x1 = this.x1 + inset; + let y1 = this.y1 + inset; + path.moveTo(x1, y1); + for (const elbow of this.elbows) { + this.updatePathSection(x1, y1, elbow.x, elbow.y, height, -offset); + x1 = elbow.x; + y1 = elbow.y; + } + const x2 = this.x2 - inset; + const y2 = this.y2 + inset; + this.updatePathSection(x1, y1, x2, y2, height, -offset); + path.lineTo(x2, y2 + height); + x1 = x2; + y1 = y2; + for (const elbow of this.elbows.toReversed()) { + this.updatePathSection(x1, y1, elbow.x, elbow.y, height, offset); + x1 = elbow.x; + y1 = elbow.y; + } + this.updatePathSection(x1, y1, this.x1 + inset, this.y1 + inset, height, offset); + path.closePath(); + } + updatePathSection(x1, y1, x2, y2, height, yOffset) { + const { path } = this; + const start = Vec220.from(x1, y1 + yOffset + height / 2); + const end = Vec220.from(x2, y2 + yOffset + height / 2); + if (Math.abs(end.y - start.y) < 2) { + path.lineTo(end.x, end.y); + return; + } + let angle = Vec220.angle(Vec220.sub(end, start)); + if (angle < 0) + angle = 2 * Math.PI + angle; + const right = 0; + const down = Math.PI / 2; + const left = Math.PI; + const up = Math.PI * 1.5; + const innerArc = getArcValues(start, end, 0); + const outerArc = getArcValues(start, end, height); + if (innerArc.radius < height) { + path.cubicCurveTo((start.x + end.x) / 2, start.y, (start.x + end.x) / 2, end.y, end.x, end.y); + return; + } + if (angle >= up) { + path.arc(start.x, y1 - innerArc.radius, innerArc.radius, down, down + outerArc.angle, true); + path.arc(end.x, y2 + outerArc.radius, outerArc.radius, up + outerArc.angle, up); + path.lineTo(end.x, end.y); + } else if (angle > right && angle <= down) { + path.arc(start.x, y1 + outerArc.radius, outerArc.radius, up, up + outerArc.angle); + path.arc(end.x, y2 - innerArc.radius, innerArc.radius, down + innerArc.angle, down, true); + path.lineTo(end.x, end.y); + } else if (angle > down && angle <= left) { + path.arc(start.x, y1 + outerArc.radius, outerArc.radius - height, up, up + outerArc.angle, true); + path.arc(end.x, y2 - innerArc.radius, innerArc.radius + height, down + innerArc.angle, down); + path.lineTo(end.x, end.y); + } else { + path.arc(start.x, y1 - innerArc.radius, innerArc.radius + height, down, down + innerArc.angle); + path.arc(end.x, y2 + outerArc.radius, outerArc.radius - height, up + outerArc.angle, up, true); + path.lineTo(end.x, end.y); + } + } +}; +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "x1", 2); +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "x2", 2); +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "y1", 2); +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "y2", 2); +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "height", 2); +__decorateClass([ + SceneChangeDetection10() +], SankeyLink.prototype, "inset", 2); +function getArcValues(start, end, minRadius) { + const lineAngle = Vec220.angle(Vec220.sub(end, start)); + const chordLength = Vec220.distance(start, end); + const bisect = Vec220.add(start, Vec220.rotate(Vec220.from(chordLength / 2, 0), lineAngle)); + const gradient = -1 / Vec220.gradient(start, end); + const intercept = Vec220.intercept(bisect, gradient); + const offset = lerpClamp(0.1, 0.5, Math.PI / 2 - Math.abs(Vec220.gradient(start, end))); + const center = Vec220.intersectAtX(gradient, intercept, start.x); + const radius = Math.max(minRadius, Vec220.distance(start, center) * offset); + const angle = Vec220.angle(Vec220.sub(center, start), Vec220.sub(center, bisect)) / -(1.1 - offset); + return { angle, radius }; +} +function lerpClamp(a, b, ratio3) { + return clamp10(a, (b - a) * ratio3 + a, b); +} + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeriesProperties.ts +import { + _ModuleSupport as _ModuleSupport268 +} from "ag-charts-community"; +var { + BaseProperties: BaseProperties29, + FillGradientDefaults: FillGradientDefaults3, + FillPatternDefaults: FillPatternDefaults3, + FillImageDefaults: FillImageDefaults3, + makeSeriesTooltip: makeSeriesTooltip22, + SeriesProperties: SeriesProperties13, + Property: Property82, + Label: Label17 +} = _ModuleSupport268; +var SankeySeriesLabelProperties = class extends Label17 { + constructor() { + super(...arguments); + this.spacing = 1; + this.placement = void 0; + this.edgePlacement = void 0; + } +}; +__decorateClass([ + Property82 +], SankeySeriesLabelProperties.prototype, "spacing", 2); +__decorateClass([ + Property82 +], SankeySeriesLabelProperties.prototype, "placement", 2); +__decorateClass([ + Property82 +], SankeySeriesLabelProperties.prototype, "edgePlacement", 2); +var SankeySeriesLinkProperties = class extends BaseProperties29 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "fill", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "stroke", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "lineDash", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property82 +], SankeySeriesLinkProperties.prototype, "itemStyler", 2); +var SankeySeriesNodeProperties = class extends BaseProperties29 { + constructor() { + super(...arguments); + this.spacing = 1; + this.minSpacing = 0; + this.width = 1; + this.alignment = "justify"; + this.verticalAlignment = "center"; + this.sort = "auto"; + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "spacing", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "minSpacing", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "width", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "alignment", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "verticalAlignment", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "sort", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "fill", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "stroke", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "lineDash", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + Property82 +], SankeySeriesNodeProperties.prototype, "itemStyler", 2); +var SankeySeriesProperties = class extends SeriesProperties13 { + constructor() { + super(); + this.nodes = void 0; + this.idKey = ""; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.sizeKey = void 0; + this.sizeName = void 0; + this.fillGradientDefaults = new FillGradientDefaults3(); + this.fillPatternDefaults = new FillPatternDefaults3(); + this.fillImageDefaults = new FillImageDefaults3(); + this.defaultColorRange = []; + this.defaultPatternFills = []; + this.fills = []; + this.strokes = []; + this.label = new SankeySeriesLabelProperties(); + this.link = new SankeySeriesLinkProperties(); + this.node = new SankeySeriesNodeProperties(); + this.tooltip = makeSeriesTooltip22(); + this.highlightStyle.deprecated = false; + } + getStyle(isLink, fills, strokes, index) { + const { + fillOpacity, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + fill = fills[index % fills.length], + stroke: stroke2 = strokes[index % fills.length] + } = isLink ? this.link : this.node; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "nodes", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "fromKey", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "toKey", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "idKey", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "idName", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "labelName", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "fillGradientDefaults", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "fillPatternDefaults", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "fillImageDefaults", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "defaultPatternFills", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "fills", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "strokes", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "label", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "link", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "node", 2); +__decorateClass([ + Property82 +], SankeySeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeries.ts +var { + Transformable: Transformable3, + applyShapeStyle: applyShapeStyle18, + SeriesNodePickMode: SeriesNodePickMode16, + createDatumId: createDatumId20, + getShapeStyle: getShapeStyle2, + getLabelStyles: getLabelStyles6, + Rect: Rect8, + BBox: BBox26, + mergeDefaults: mergeDefaults20 +} = _ModuleSupport269; +var SankeySeries = class extends FlowProportionSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode16.NEAREST_NODE, SeriesNodePickMode16.EXACT_SHAPE_MATCH] + }); + this.properties = new SankeySeriesProperties(); + } + isLabelEnabled() { + return (this.properties.labelKey != null || this.nodes == null) && this.properties.label.enabled; + } + linkFactory() { + return new SankeyLink(); + } + nodeFactory() { + return new Rect8(); + } + createNodeData() { + const { + id: seriesId, + _nodeDataDependencies: { seriesRectWidth, seriesRectHeight } = { seriesRectWidth: 0, seriesRectHeight: 0 } + } = this; + const { + fromKey, + toKey, + sizeKey, + labelKey, + label: { spacing: labelSpacing, placement: labelPlacement, edgePlacement: edgeLabelPlacement }, + node: { width: nodeWidth, alignment } + } = this.properties; + const createNode = (node) => ({ + ...node, + x: Number.NaN, + y: Number.NaN, + width: nodeWidth, + height: Number.NaN + }); + const createLink = (link) => ({ + ...link, + x1: Number.NaN, + x2: Number.NaN, + y1: Number.NaN, + y2: Number.NaN, + height: Number.NaN, + elbows: [] + }); + const { + nodeGraph: baseNodeGraph, + links, + maxPathLength + } = this.getNodeGraph(createNode, createLink, { includeCircularReferences: false }); + const nodeGraph = baseNodeGraph; + if (nodeGraph.size === 0) + return; + const columns = []; + for (let index = 0; index < maxPathLength; index += 1) { + columns.push({ index, size: 0, nodes: [], x: 0 }); + } + for (const graphNode of nodeGraph.values()) { + const { datum: node, linksBefore, linksAfter, maxPathLengthBefore, maxPathLengthAfter } = graphNode; + const size = Math.max( + linksBefore.reduce((acc, { link }) => acc + link.size, 0), + linksAfter.reduce((acc, { link }) => acc + link.size, 0) + ); + if (linksBefore.length === 0 && linksAfter.length === 0 || size === 0) { + graphNode.columnIndex = -1; + continue; + } + let column; + switch (alignment) { + case "left": + column = columns[maxPathLengthBefore]; + break; + case "right": + column = columns[maxPathLength - 1 - maxPathLengthAfter]; + break; + case "center": { + if (linksBefore.length !== 0) { + column = columns[maxPathLengthBefore]; + } else if (linksAfter.length === 0) { + column = columns[0]; + } else { + const columnIndex = linksAfter.reduce( + (acc, link) => Math.min(acc, link.node.maxPathLengthBefore), + maxPathLength + ) - 1; + column = columns[columnIndex]; + } + break; + } + case "justify": { + column = linksAfter.length === 0 ? columns[maxPathLength - 1] : columns[maxPathLengthBefore]; + break; + } + } + node.size = size; + const { label } = this.properties; + const labelText = label.enabled ? this.getLabelText( + node.label, + node.datum, + labelKey, + "label", + [], + this.properties.label, + { datum: node.datum, value: node.label, fromKey, toKey, sizeKey, size } + ) : void 0; + node.label = toPlainText11(labelText); + column.nodes.push(graphNode); + column.size += size; + graphNode.columnIndex = column.index; + } + const measurer2 = cachedTextMeasurer13(this.properties.label); + let columnLabelInsetBefore = 0; + let columnLabelInsetAfter = 0; + if (this.isLabelEnabled()) { + if (labelPlacement == null && edgeLabelPlacement == null) { + columnLabelInsetBefore = (seriesRectWidth - nodeWidth) * (1 - maxPathLength / (maxPathLength + 1)); + columnLabelInsetAfter = columnLabelInsetBefore; + } else if (edgeLabelPlacement === "outside" || edgeLabelPlacement == null) { + const reduceLabelWidthFn = (acc, n) => { + const node = n; + if (node.datum.label == null || node.datum.label === "") + return acc; + let maxWidth = (seriesRectWidth - nodeWidth) / (maxPathLength - 1) - labelSpacing; + if (labelPlacement === "center" && edgeLabelPlacement == null) + maxWidth /= 2; + const text2 = wrapText4(node.datum.label, { + maxWidth, + maxHeight: node.datum.height, + font: this.properties.label, + textWrap: "never" + }); + let { width } = measurer2.measureLines(text2); + if (labelPlacement === "center" && edgeLabelPlacement == null) + width /= 2; + return Math.max(acc, width); + }; + if (labelPlacement !== "right" || edgeLabelPlacement === "outside") { + columnLabelInsetBefore = nodeWidth + columns[0].nodes.reduce(reduceLabelWidthFn, 0); + } + if (labelPlacement !== "left" || edgeLabelPlacement === "outside") { + columnLabelInsetAfter = nodeWidth + columns.at(-1).nodes.reduce(reduceLabelWidthFn, 0); + } + } + } + const columnWidth = (seriesRectWidth - nodeWidth - columnLabelInsetBefore - columnLabelInsetAfter) / (maxPathLength - 1); + for (let index = 0; index < columns.length; index++) { + const column = columns[index]; + column.x = columnLabelInsetBefore + index * columnWidth; + for (const graphNode of column.nodes) { + graphNode.datum.x = column.x; + } + } + for (const graphNode of nodeGraph.values()) { + graphNode.weight = 0; + let closestColumnDiff = Infinity; + for (const link of graphNode.linksAfter) { + const node = link.node; + closestColumnDiff = Math.min(closestColumnDiff, node.columnIndex - graphNode.columnIndex); + } + if (closestColumnDiff === Infinity) { + for (const link of graphNode.linksBefore) { + const node = link.node; + closestColumnDiff = Math.min(closestColumnDiff, graphNode.columnIndex - node.columnIndex); + } + } + graphNode.closestColumnDiff = closestColumnDiff; + for (const link of graphNode.linksAfter) { + const node = link.node; + if (node.columnIndex <= graphNode.columnIndex) + continue; + for (let i = node.columnIndex - 1; i > graphNode.columnIndex; i--) { + const size = link.link.size; + const ghostNode = { + ghost: true, + datum: { ...graphNode.datum, size, y: 0, height: 0 }, + weight: 0, + linksBefore: [{ node: { columnIndex: i - 1, datum: { size } } }], + linksAfter: [{ node: { columnIndex: i + 1, datum: { size } } }], + link: link.link, + columnIndex: graphNode.columnIndex, + size: graphNode.datum.size, + closestColumnDiff, + fromNode: { y: node.datum.y }, + toNode: { y: 0 } + }; + columns[i].size += size; + columns[i].nodes.push(ghostNode); + } + } + } + const sortedColumns = columns.toSorted((a, b) => { + const aMax = a.nodes.reduce((acc, n) => Math.max(acc, n.datum.size), 0); + const bMax = b.nodes.reduce((acc, n) => Math.max(acc, n.datum.size), 0); + return bMax - aMax; + }); + const columnWeights = {}; + for (let i = 0; i < sortedColumns.length; i++) { + columnWeights[sortedColumns[i].index] = Math.pow(10, sortedColumns.length - i - 1); + } + for (const column of columns) { + for (const node of column.nodes) { + node.weight = node.datum.size / column.size * columnWeights[column.index]; + if ("ghost" in node && node.ghost) { + node.weight = node.size / column.size * columnWeights[column.index]; + continue; + } + node.weight += node.linksBefore.reduce((acc, before) => { + if (before.node.columnIndex !== column.index - 1) + return acc; + const weight = before.node.datum.size / columns[before.node.columnIndex].size * columnWeights[before.node.columnIndex]; + return Math.max(acc, weight); + }, 0); + node.weight += node.linksAfter.reduce((acc, after) => { + if (after.node.columnIndex !== column.index + 1) + return acc; + const weight = after.node.datum.size / columns[after.node.columnIndex].size * columnWeights[after.node.columnIndex]; + return Math.max(acc, weight); + }, 0); + } + column.nodes.sort((a, b) => this.sortNodes(a, b)); + } + const minSize = 1; + const getSizeScale = (spacing) => { + return columns.reduce((acc, { size, nodes }) => { + const spacingAccomodation = seriesRectHeight - nodes.length * minSize; + const spacingOccupation = (nodes.length - 1) * spacing / spacingAccomodation; + const columnSizeScale = (1 - spacingOccupation) / size; + return Math.min(acc, columnSizeScale); + }, Infinity); + }; + let nodeSpacing = this.properties.node.spacing; + let sizeScale = getSizeScale(nodeSpacing); + while (sizeScale < 0 && nodeSpacing > this.properties.node.minSpacing) { + nodeSpacing -= 1; + sizeScale = getSizeScale(nodeSpacing); + } + if (sizeScale < 0) { + Logger21.warnOnce( + "There was insufficient space to display the Sankey Series. Reduce [node.spacing], [node.minSpacing], or provide a larger container." + ); + return; + } + for (const column of columns) { + let columnNodesHeight = 0; + for (const node of column.nodes) { + const height = seriesRectHeight * node.datum.size * sizeScale; + node.datum.height = Math.max(minSize, height); + columnNodesHeight += height; + } + const spacingOccupation = nodeSpacing * (column.nodes.length - 1); + let y = 0; + if (this.properties.node.verticalAlignment === "bottom") { + y = seriesRectHeight - columnNodesHeight - spacingOccupation; + } else if (this.properties.node.verticalAlignment === "center") { + y = (seriesRectHeight - columnNodesHeight - spacingOccupation) / 2; + } + for (const node of column.nodes) { + node.datum.y = y; + y += seriesRectHeight * node.datum.size * sizeScale + nodeSpacing; + if ("ghost" in node && node.ghost) { + node.link.elbows.push({ x: column.x, y: node.datum.y }); + } + } + } + for (const { datum, linksBefore, linksAfter } of nodeGraph.values()) { + let y2 = datum.y; + linksBefore.sort( + (a, b) => this.sortNodes(a.node, b.node) + ); + for (const { link } of linksBefore) { + link.y2 = y2; + y2 += link.size * seriesRectHeight * sizeScale; + } + let y1 = datum.y; + linksAfter.sort( + (a, b) => this.sortNodes(a.node, b.node, { + invertColumnSort: true + }) + ); + for (const { link } of linksAfter) { + link.y1 = y1; + y1 += link.size * seriesRectHeight * sizeScale; + } + } + const nodeData = []; + const labelData = []; + const { fontSize } = this.properties.label; + for (const [index, column] of columns.entries()) { + const leading = index === 0; + const trailing = index === columns.length - 1; + let bottom = -Infinity; + column.nodes.sort((a, b) => a.datum.y - b.datum.y); + for (const n of column.nodes) { + if ("ghost" in n && n.ghost) + continue; + const { datum: node } = n; + node.midPoint = { + x: node.x + node.width / 2, + y: node.y + node.height / 2 + }; + nodeData.push(node); + if (node.label == null) + continue; + const y = node.y + node.height / 2; + let text2; + if (!leading && !trailing) { + const lineHeight = calcLineHeight7(fontSize); + const y12 = y - lineHeight; + const y2 = y + lineHeight; + let maxX = seriesRectWidth; + for (const { datum } of nodeGraph.values()) { + const intersectsLabel = datum.x > node.x && Math.max(datum.y, y12) <= Math.min(datum.y + datum.height, y2); + if (intersectsLabel) { + maxX = Math.min(maxX, datum.x - labelSpacing); + } + } + const maxWidth = maxX - node.x - 2 * labelSpacing; + text2 = wrapText4(node.label, { + maxWidth, + maxHeight: node.height, + font: this.properties.label, + textWrap: "never", + overflow: "hide" + }); + } + if (text2 == null || text2 === "") { + const labelInset = edgeLabelPlacement == null && (leading || trailing) ? labelSpacing : labelSpacing * 2; + text2 = wrapText4(node.label, { + maxWidth: columnWidth - labelInset, + maxHeight: node.height, + font: this.properties.label, + textWrap: "never" + }); + } + if (text2 === "") + continue; + const { height } = measurer2.measureLines(text2); + const y0 = y - height / 2; + const y1 = y + height / 2; + let x = node.x + node.width + labelSpacing; + let textAlign = "left"; + let placement = labelPlacement; + if (leading && edgeLabelPlacement == null && labelPlacement == null) { + placement = "left"; + } + if (edgeLabelPlacement === "outside") { + if (leading) + placement = "left"; + if (trailing) + placement = "right"; + } else if (edgeLabelPlacement === "inside") { + if (leading) + placement = "right"; + if (trailing) + placement = "left"; + } + if (placement === "left") { + x = node.x - labelSpacing; + textAlign = "right"; + } else if (placement === "center") { + x = node.x + node.width / 2; + textAlign = "center"; + } + if (y0 >= bottom) { + labelData.push({ x, y, textAlign, text: text2, size: node.size }); + bottom = y1; + } + } + } + for (const link of links) { + const { fromNode, toNode, size } = link; + link.height = Math.max(minSize, seriesRectHeight * size * sizeScale); + link.x1 = fromNode.x + nodeWidth; + link.x2 = toNode.x; + link.midPoint = { + x: (link.x1 + link.x2) / 2, + y: (link.y1 + link.y2) / 2 + link.height / 2 + }; + nodeData.push(link); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + sortNodes(a, b, opts) { + const { properties } = this; + if (properties.node.sort === "ascending") { + return (a.datum.label ?? "").localeCompare(b.datum.label ?? ""); + } else if (properties.node.sort === "descending") { + return (b.datum.label ?? "").localeCompare(a.datum.label ?? ""); + } else if (properties.node.sort === "data") { + return 0; + } + if (a.columnIndex < b.columnIndex) + return opts?.invertColumnSort ? 1 : -1; + if (a.columnIndex > b.columnIndex) + return opts?.invertColumnSort ? -1 : 1; + if (a.weight === b.weight) { + return a.datum.size - b.datum.size; + } + if (a.closestColumnDiff < b.closestColumnDiff) + return 1; + if (a.closestColumnDiff > b.closestColumnDiff) + return -1; + return a.weight - b.weight; + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, datum) => { + const { x, y, textAlign, text: text2 } = datum; + const params = datum; + const style = getLabelStyles6(this, void 0, params, this.properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style; + label.visible = true; + label.x = x; + label.y = y; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = "middle"; + label.setBoxing(style); + }); + } + updateNodeSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId20(datum.type, datum.id)); + } + getNodeStyle(nodeDatum, fromNodeDatumIndex, isHighlight) { + const { properties } = this; + const { + fills, + strokes, + defaultColorRange, + defaultPatternFills, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3 + } = properties; + const { itemStyler } = properties.node; + const defaultColorStops = defaultColorRange[fromNodeDatumIndex % defaultColorRange.length].map((color6) => ({ + color: color6 + })); + const defaultPatternFill = defaultPatternFills[fromNodeDatumIndex % defaultPatternFills.length]; + const highlightStyle = this.getHighlightStyle(isHighlight, nodeDatum.datumIndex); + const baseStyle = mergeDefaults20(highlightStyle, properties.getStyle(false, fills, strokes, fromNodeDatumIndex)); + const hasNodeFill = properties.node.fill != null; + let style = getShapeStyle2( + baseStyle, + hasNodeFill ? fillGradientDefaults3 : { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + hasNodeFill ? fillPatternDefaults3 : { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + if (itemStyler != null && nodeDatum.datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId20(nodeDatum.datumIndex.index, "node", isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults20( + overrides, + style, + { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + makeItemStylerParams({ datum, datumIndex, size = 0, label }, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style, + size, + label, + fill + }; + } + updateNodeNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect, datum) => { + const { datumIndex } = datum; + const style = this.getNodeStyle(datum, datumIndex.index, isHighlight); + rect.x = datum.x; + rect.y = datum.y; + rect.width = Math.max(datum.width, 0); + rect.height = Math.max(datum.height, 0); + applyShapeStyle18(rect, style, fillBBox); + }); + } + getShapeFillBBox() { + const width = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const height = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const bbox = new BBox26(0, 0, width, height); + return { series: bbox, axis: bbox }; + } + updateLinkSelection(opts) { + return opts.datumSelection.update( + opts.nodeData, + void 0, + (datum) => createDatumId20(datum.type, datum.index, datum.fromNode.id, datum.toNode.id) + ); + } + getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, isHighlight) { + const { id: seriesId, properties } = this; + const { + fills, + strokes, + defaultColorRange, + defaultPatternFills, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3 + } = properties; + const { itemStyler } = properties.link; + const defaultColorStops = defaultColorRange[fromNodeDatumIndex.index % defaultColorRange.length].map( + (color6) => ({ + color: color6 + }) + ); + const defaultPatternFill = defaultPatternFills[fromNodeDatumIndex.index % defaultPatternFills.length]; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults20( + highlightStyle, + properties.getStyle(true, fills, strokes, fromNodeDatumIndex.index) + ); + const hasLinkFill = properties.link.fill != null; + let style = getShapeStyle2( + baseStyle, + hasLinkFill ? fillGradientDefaults3 : { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + hasLinkFill ? fillPatternDefaults3 : { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId20(datumIndex.index, "link", isHighlight ? "highlight" : "node"), + () => { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style + }); + } + ); + if (overrides) { + style = mergeDefaults20( + overrides, + style, + { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + } + } + style.opacity = 1; + return style; + } + updateLinkNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((link, datum) => { + const fromNodeDatumIndex = datum.fromNode.datumIndex; + const style = this.getLinkStyle(datum, fromNodeDatumIndex, isHighlight); + link.x1 = datum.x1; + link.y1 = datum.y1; + link.x2 = datum.x2; + link.y2 = datum.y2; + link.height = datum.height; + link.elbows = datum.elbows; + applyShapeStyle18(link, style, fillBBox); + link.inset = link.strokeWidth / 2; + }); + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + linksProcessedData, + nodesProcessedData, + properties, + ctx: { formatManager } + } = this; + const { fromKey, toKey, sizeKey, sizeName, tooltip } = properties; + const seriesDatum = this.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + if (seriesDatum == null) + return; + const nodeIndex = seriesDatum.type === 0 /* Link */ ? seriesDatum.fromNode.index : seriesDatum.index; + const title = seriesDatum.type === 0 /* Link */ ? `${seriesDatum.fromNode.label} - ${seriesDatum.toNode.label}` : seriesDatum.label; + const datum = datumIndex.type === 0 /* Link */ ? linksProcessedData?.dataSources.get(this.id)?.data[datumIndex.index] : nodesProcessedData?.dataSources.get(this.id)?.data[datumIndex.index]; + const size = seriesDatum.size; + let format; + if (seriesDatum.type === 0 /* Link */) { + const fromNodeDatumIndex = seriesDatum.fromNode.datumIndex; + format = this.getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, false); + } else { + format = this.getNodeStyle({ datumIndex, datum }, datumIndex.index, false); + } + const data = []; + if (sizeKey != null) { + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: size, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + domain: [], + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(size) }); + } + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(seriesDatum.type, nodeIndex, format), + data + }, + { + seriesId, + datum, + title, + fromKey, + toKey, + sizeKey, + sizeName, + size, + ...format + } + ); + } + computeFocusBounds(node) { + if (node instanceof Rect8) { + const { x, y, width, height } = node; + const bbox = new BBox26(x, y, width, height); + return Transformable3.toCanvas(this.contentGroup, bbox); + } + return node; + } + hasItemStylers() { + return this.properties.node.itemStyler != null || this.properties.link.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +SankeySeries.className = "SankeySeries"; +SankeySeries.type = "sankey"; + +// packages/ag-charts-enterprise/src/series/sankey/sankeySeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport270 } from "ag-charts-community"; +import { + arrayOf as arrayOf4, + color as color4, + constant as constant23, + fillGradientDefaults as fillGradientDefaults2, + fillImageDefaults as fillImageDefaults2, + fillPatternDefaults as fillPatternDefaults2, + required as required23, + string as string21, + undocumented as undocumented7 +} from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs21, sankeySeriesThemeableOptionsDef } = _ModuleSupport270; +var sankeySeriesOptionsDef = { + ...sankeySeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs21, + type: required23(constant23("sankey")), + fromKey: required23(string21), + toKey: required23(string21), + sizeKey: string21, + sizeName: string21 +}; +sankeySeriesOptionsDef.fillGradientDefaults = undocumented7(fillGradientDefaults2); +sankeySeriesOptionsDef.fillPatternDefaults = undocumented7(fillPatternDefaults2); +sankeySeriesOptionsDef.fillImageDefaults = undocumented7(fillImageDefaults2); +sankeySeriesOptionsDef.defaultColorRange = undocumented7(arrayOf4(arrayOf4(color4))); +sankeySeriesOptionsDef.defaultPatternFills = undocumented7(arrayOf4(color4)); + +// packages/ag-charts-enterprise/src/series/sankey/sankeyModule.ts +var SankeyModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + solo: true, + identifier: "sankey", + moduleFactory: (ctx) => new SankeySeries(ctx), + themeTemplate: { + seriesArea: { + padding: { + top: 10, + bottom: 10 + } + }, + series: { + fills: { $palette: "fills" }, + strokes: { $palette: "strokes" }, + // @ts-expect-error undocumented option + fillGradientDefaults: _ModuleSupport271.FILL_GRADIENT_LINEAR_DEFAULTS, + fillPatternDefaults: _ModuleSupport271.FILL_PATTERN_DEFAULTS, + fillImageDefaults: _ModuleSupport271.FILL_IMAGE_DEFAULTS, + defaultColorRange: { $palette: "gradients" }, + defaultPatternFills: _ModuleSupport271.SAFE_FILLS_OPERATION, + highlightStyle: { + series: { + dimOpacity: 0.2 + } + }, + highlight: { + ..._ModuleSupport271.singleSeriesHighlightStyle() + }, + label: { + ..._ModuleSupport271.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 10 + }, + node: { + spacing: { $if: [{ $greaterThan: [{ $path: "./minSpacing" }, 20] }, { $path: "./minSpacing" }, 20] }, + minSpacing: 0, + width: 10, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + link: { + fillOpacity: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + } + }, + legend: { + enabled: false, + toggleSeries: false + } + } +}; +var SankeySeriesModule = { + type: "series", + name: "sankey", + chartType: "standalone", + enterprise: true, + options: sankeySeriesOptionsDef, + create: (ctx) => new SankeySeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstModule.ts +import { _ModuleSupport as _ModuleSupport275 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeries.ts +import { _ModuleSupport as _ModuleSupport273 } from "ag-charts-community"; +import { toPlainText as toPlainText12 } from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport272 } from "ag-charts-community"; +var { HierarchySeriesProperties, HighlightStyle, makeSeriesTooltip: makeSeriesTooltip23, Property: Property83 } = _ModuleSupport272; +var SunburstSeriesTileHighlightStyle = class extends HighlightStyle { + constructor() { + super(false); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedLabel(); + } +}; +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "label", 2); +__decorateClass([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "secondaryLabel", 2); +var SunburstSeriesProperties = class extends HierarchySeriesProperties { + constructor() { + super(...arguments); + this.fillOpacity = 1; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.highlightStyle = new SunburstSeriesTileHighlightStyle(); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + this.tooltip = makeSeriesTooltip23(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity } = this; + return { + fill: fills[index % fills.length], + fillOpacity, + stroke: strokes[index % strokes.length], + strokeWidth, + strokeOpacity, + opacity: 1 + }; + } +}; +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "secondaryLabelKey", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "sectorSpacing", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "padding", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "highlightStyle", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "label", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "secondaryLabel", 2); +__decorateClass([ + Property83 +], SunburstSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeries.ts +var { + fromToMotion: fromToMotion6, + normalizeAngle360: normalizeAngle3608, + createDatumId: createDatumId21, + PointerEvents: PointerEvents13, + Sector: Sector7, + Group: Group20, + ScalableGroup, + Selection: Selection17, + TransformableText: TransformableText3, + BBox: BBox27, + applyShapeStyle: applyShapeStyle19, + mergeDefaults: mergeDefaults21, + formatValue: formatValue2, + getLabelStyles: getLabelStyles7 +} = _ModuleSupport273; +var SunburstNode = class extends _ModuleSupport273.HierarchyNode { + constructor() { + super(...arguments); + this.label = void 0; + this.secondaryLabel = void 0; + this.contentHeight = 0; + this.bbox = void 0; + // cspell:ignore bbox + this.startAngle = 0; + this.endAngle = 0; + } +}; +function setAngleData(node, startAngle = 0, angleScale = 2 * Math.PI / node.sumSize) { + for (const child of node.children) { + const endAngle = startAngle + child.sumSize * angleScale; + child.startAngle = startAngle; + child.endAngle = endAngle; + setAngleData(child, startAngle, angleScale); + startAngle = endAngle; + } +} +var SunburstSeries = class extends _ModuleSupport273.HierarchySeries { + constructor(moduleCtx) { + super(moduleCtx); + this.NodeClass = SunburstNode; + this.properties = new SunburstSeriesProperties(); + this.scalingGroup = this.contentGroup.appendChild(new ScalableGroup()); + this.sectorGroup = this.scalingGroup.appendChild(new Group20()); + this.sectorLabelGroup = this.scalingGroup.appendChild(new Group20()); + this.highlightSectorGroup = this.scalingGroup.appendChild(new Group20()); + this.datumSelection = Selection17.select(this.sectorGroup, Sector7); + this.labelSelection = Selection17.select( + this.sectorLabelGroup, + Group20 + ); + this.highlightSelection = Selection17.select( + this.highlightSectorGroup, + Sector7 + ); + this.sectorLabelGroup.pointerEvents = PointerEvents13.None; + } + processData() { + super.processData(); + setAngleData(this.rootNode); + } + updateSelections() { + const highlightedNode = this.ctx.highlightManager?.getActiveHighlight(); + this.highlightSelection.update( + highlightedNode == null ? [] : [highlightedNode], + void 0, + (node) => this.getDatumId(node) + ); + if (!this.nodeDataRefresh) + return; + this.nodeDataRefresh = false; + const { chart } = this; + if (chart == null) + return; + const seriesRect = chart.seriesRect; + if (seriesRect == null) + return; + const descendants = Array.from(this.rootNode); + const updateLabelGroup = (group) => { + group.append([ + new TransformableText3({ tag: 0 /* Primary */ }), + new TransformableText3({ tag: 1 /* Secondary */ }) + ]); + }; + this.datumSelection.update(descendants, void 0, (node) => this.getDatumId(node)); + this.labelSelection.update(descendants, updateLabelGroup, (node) => this.getDatumId(node)); + } + getItemStyle(nodeDatum, isHighlight) { + const { properties, colorScale } = this; + const { itemStyler } = properties; + const rootIndex = nodeDatum.datumIndex?.[0] ?? 0; + const highlightStyle = isHighlight ? properties.highlightStyle : void 0; + const baseStyle = mergeDefaults21(highlightStyle, properties.getStyle(rootIndex)); + if (!isHighlight && nodeDatum.colorValue != null) { + baseStyle.fill = colorScale.convert(nodeDatum.colorValue); + } + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId21(this.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults21(overrides, style); + } + } + return style; + } + makeItemStylerParams(nodeDatum, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + depth: nodeDatum.depth ?? 0, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateNodes() { + const { chart, data, maxDepth } = this; + if (chart == null || data == null) { + return; + } + const { width, height } = chart.seriesRect; + const { + sectorSpacing = 0, + padding = 0, + cornerRadius, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName + } = this.properties; + this.contentGroup.translationX = width / 2; + this.contentGroup.translationY = height / 2; + const baseInset = sectorSpacing * 0.5; + const radius = Math.min(width, height) / 2; + const radiusScale = radius / (maxDepth + 1); + const angleOffset = -Math.PI / 2; + const seriesFillBBox = { + series: new BBox27(-radius, -radius, 2 * radius, 2 * radius), + axis: new BBox27(-radius, -radius, 2 * radius, 2 * radius) + }; + this.rootNode?.walk((node) => { + const { startAngle, endAngle } = node; + if (node.depth != null) { + const midAngle = (startAngle + endAngle) / 2 + angleOffset; + const midRadius = (node.depth + 0.5) * radiusScale; + node.midPoint.x = Math.cos(midAngle) * midRadius; + node.midPoint.y = Math.sin(midAngle) * midRadius; + } + }); + this.rootNode?.walk((node) => { + const { datum, depth, startAngle, endAngle, parent, sumSize } = node; + node.label = void 0; + node.secondaryLabel = void 0; + node.contentHeight = 0; + let labelValue; + if (datum != null && depth != null && labelKey != null) { + const value = datum[labelKey]; + labelValue = this.getLabelText( + value, + datum, + labelKey, + "label", + [], + this.properties.label, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (labelValue === "") { + labelValue = void 0; + } + let secondaryLabelValue; + if (datum != null && depth != null && secondaryLabelKey != null) { + const value = datum[secondaryLabelKey]; + secondaryLabelValue = this.getLabelText( + value, + datum, + secondaryLabelKey, + "secondaryLabel", + [], + this.properties.secondaryLabel, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (secondaryLabelValue === "") { + secondaryLabelValue = void 0; + } + if (depth == null) + return; + const innerRadius = depth * radiusScale + baseInset; + const outerRadius = (depth + 1) * radiusScale - baseInset; + const innerAngleOffset = innerRadius > baseInset ? baseInset / innerRadius : baseInset; + const outerAngleOffset = outerRadius > baseInset ? baseInset / outerRadius : baseInset; + const innerStartAngle = startAngle + innerAngleOffset; + const innerEndAngle = endAngle + innerAngleOffset; + const deltaInnerAngle = innerEndAngle - innerStartAngle; + const outerStartAngle = startAngle + outerAngleOffset; + const outerEndAngle = endAngle + outerAngleOffset; + const deltaOuterAngle = outerEndAngle - outerStartAngle; + const sizeFittingHeight = (labelHeight2) => { + const isCenterCircle = depth === 0 && parent?.sumSize === sumSize; + if (isCenterCircle) { + const labelWidth2 = 2 * Math.sqrt(outerRadius ** 2 - (labelHeight2 * 0.5) ** 2); + return { width: labelWidth2, height: labelHeight2, meta: 0 /* CenterCircle */ }; + } + const parallelHeight = labelHeight2; + const availableWidthUntilItHitsTheOuterRadius = 2 * Math.sqrt(outerRadius ** 2 - (innerRadius + parallelHeight) ** 2); + const availableWidthUntilItHitsTheStraightEdges = deltaInnerAngle < Math.PI ? 2 * innerRadius * Math.tan(deltaInnerAngle * 0.5) : Infinity; + const parallelWidth = Math.min( + availableWidthUntilItHitsTheOuterRadius, + availableWidthUntilItHitsTheStraightEdges + ); + const maxPerpendicularAngle = Math.PI / 4; + let perpendicularHeight; + let perpendicularWidth; + if (depth === 0) { + perpendicularHeight = labelHeight2; + perpendicularWidth = Math.sqrt(outerRadius ** 2 - (perpendicularHeight / 2) ** 2) - labelHeight2 / (2 * Math.tan(deltaOuterAngle * 0.5)); + } else if (normalizeAngle3608(deltaInnerAngle) < maxPerpendicularAngle) { + perpendicularHeight = 2 * innerRadius * Math.tan(deltaInnerAngle * 0.5); + perpendicularWidth = Math.sqrt(outerRadius ** 2 - (perpendicularHeight / 2) ** 2) - innerRadius; + } else { + perpendicularWidth = 0; + perpendicularHeight = 0; + } + return parallelWidth >= perpendicularWidth ? { width: parallelWidth, height: parallelHeight, meta: 1 /* Parallel */ } : { width: perpendicularWidth, height: perpendicularHeight, meta: 2 /* Perpendicular */ }; + }; + const formatting = formatLabels( + toPlainText12(labelValue), + this.properties.label, + toPlainText12(secondaryLabelValue), + this.properties.secondaryLabel, + { padding }, + sizeFittingHeight + ); + if (formatting == null) + return; + const { width: labelWidth, height: labelHeight, meta: labelPlacement, label, secondaryLabel } = formatting; + const theta = angleOffset + (startAngle + endAngle) / 2; + const top = Math.sin(theta) >= 0; + const right = Math.cos(theta) >= 0; + const circleQuarter = (top ? 3 /* Top */ : 12 /* Bottom */) & (right ? 6 /* Right */ : 9 /* Left */); + let labelRadius; + switch (labelPlacement) { + case 0 /* CenterCircle */: + labelRadius = 0; + break; + case 1 /* Parallel */: { + const opticalCentering = 0.58; + const idealRadius = outerRadius - (radiusScale - labelHeight) * opticalCentering; + const maximumRadius = Math.sqrt((outerRadius - padding) ** 2 - (labelWidth / 2) ** 2); + labelRadius = Math.min(idealRadius, maximumRadius); + break; + } + case 2 /* Perpendicular */: + if (depth === 0) { + const minimumRadius = labelHeight / (2 * Math.tan(deltaInnerAngle * 0.5)) + labelWidth * 0.5; + const maximumRadius = Math.sqrt(outerRadius ** 2 - (labelHeight * 0.5) ** 2) - labelWidth * 0.5; + labelRadius = (minimumRadius + maximumRadius) * 0.5; + } else { + labelRadius = (innerRadius + outerRadius) * 0.5; + } + break; + } + if (label != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.label; + node.label = { + ...label, + fontStyle, + fontFamily, + fontWeight, + color: color6, + labelPlacement, + circleQuarter, + radius: labelRadius, + theta + }; + } + if (secondaryLabel != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.secondaryLabel; + node.secondaryLabel = { + ...secondaryLabel, + fontStyle, + fontFamily, + fontWeight, + color: color6, + labelPlacement, + circleQuarter, + radius: labelRadius, + theta + }; + } + node.contentHeight = formatting.height; + }); + const updateSector = (nodeDatum, sector, highlighted) => { + const { depth, startAngle, endAngle } = nodeDatum; + if (depth == null) { + sector.visible = false; + return; + } + sector.visible = true; + const style = this.getItemStyle(nodeDatum, highlighted); + const fill = style.fill; + const strokeWidth = style.strokeWidth; + const fillBBox = _ModuleSupport273.isGradientFill(fill) && fill.bounds !== "item" ? seriesFillBBox : void 0; + applyShapeStyle19(sector, style, fillBBox); + sector.centerX = 0; + sector.centerY = 0; + sector.innerRadius = depth * radiusScale; + sector.outerRadius = (depth + 1) * radiusScale; + sector.startAngle = startAngle + angleOffset; + sector.endAngle = endAngle + angleOffset; + sector.inset = baseInset + strokeWidth * 0.5; + sector.cornerRadius = cornerRadius; + }; + this.datumSelection.each((sector, datum) => { + updateSector(datum, sector, false); + }); + this.highlightSelection.each((rect, datum) => { + updateSector(datum, rect, true); + }); + const updateText = (node, text2, tag, highlighted) => { + const { depth, contentHeight } = node; + const primary = tag === 0 /* Primary */; + const label = primary ? node.label : node.secondaryLabel; + if (depth == null || label == null) { + text2.visible = false; + return; + } + const { labelPlacement, circleQuarter, radius: textRadius, theta } = label; + let highlightedColor; + if (highlighted) { + const highlightedLabelStyle = primary ? this.properties.highlightStyle.label : this.properties.highlightStyle.secondaryLabel; + highlightedColor = highlightedLabelStyle.color; + } + const params = { + childrenKey: this.properties.childrenKey, + colorKey: this.properties.colorKey, + colorName: this.properties.colorName ?? this.properties.colorKey, + depth: node.depth ?? Number.NaN, + labelKey: this.properties.labelKey, + secondaryLabelKey: this.properties.secondaryLabelKey, + sizeKey: this.properties.sizeKey, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }; + const baseLabelStyle = primary ? this.properties.label : this.properties.secondaryLabel; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const style = getLabelStyles7(this, node, params, baseLabelStyle, highlighted, activeHighlight); + text2.text = label.text; + text2.fontSize = label.fontSize; + text2.lineHeight = label.lineHeight; + text2.fontStyle = label.fontStyle; + text2.fontFamily = label.fontFamily; + text2.fontWeight = label.fontWeight; + text2.fill = highlightedColor ?? label.color; + text2.fillOpacity = this.getHighlightStyle(highlighted, node.datumIndex)?.opacity ?? 1; + text2.setBoxing(style); + switch (labelPlacement) { + case 0 /* CenterCircle */: + text2.textAlign = "center"; + text2.textBaseline = "top"; + text2.translationX = 0; + text2.translationY = (primary ? 0 : contentHeight - label.height) - contentHeight * 0.5; + text2.rotation = 0; + break; + case 1 /* Parallel */: { + const topHalf = (circleQuarter & 3 /* Top */) !== 0; + const translationRadius = primary === !topHalf ? textRadius : textRadius - (contentHeight - label.height); + text2.textAlign = "center"; + text2.textBaseline = topHalf ? "bottom" : "top"; + text2.translationX = Math.cos(theta) * translationRadius; + text2.translationY = Math.sin(theta) * translationRadius; + text2.rotation = topHalf ? theta - Math.PI * 0.5 : theta + Math.PI * 0.5; + break; + } + case 2 /* Perpendicular */: { + const rightHalf = (circleQuarter & 6 /* Right */) !== 0; + const translation = primary === !rightHalf ? (contentHeight - label.height) * 0.5 : (label.height - contentHeight) * 0.5; + text2.textAlign = "center"; + text2.textBaseline = "middle"; + text2.translationX = Math.cos(theta) * textRadius + Math.cos(theta + Math.PI / 2) * translation; + text2.translationY = Math.sin(theta) * textRadius + Math.sin(theta + Math.PI / 2) * translation; + text2.rotation = rightHalf ? theta : theta + Math.PI; + break; + } + } + text2.visible = true; + }; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + for (const text2 of this.labelSelection.selectByClass(TransformableText3)) { + const datum = text2.closestDatum(); + updateText(datum, text2, text2.tag, datum === highlightedDatum); + } + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties, ctx } = this; + const { labelKey, secondaryLabelKey, childrenKey, sizeKey, sizeName, colorKey, colorName, tooltip } = properties; + const { formatManager } = ctx; + const nodeDatum = datumIndex.reduce((n, i) => n?.children[i], this.rootNode); + if (nodeDatum == null) + return; + const { datum, depth } = nodeDatum; + if (datum == null || depth == null) + return; + const data = []; + const datumSize = sizeKey == null ? void 0 : datum[sizeKey]; + if (datumSize != null) { + const sizeDomain = [0, this.rootNode?.sumSize ?? 0]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumSize, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain: sizeDomain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue2(datumSize) }); + } + const datumColor = colorKey == null ? void 0 : datum[colorKey]; + if (datumColor != null) { + const { colorDomain } = this; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumColor, + datum, + seriesId, + legendItemName: void 0, + key: colorKey, + source: "tooltip", + property: "color", + boundSeries: this.getFormatterContext("color"), + domain: colorDomain, + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue2(datumColor) }); + } + const format = this.getItemStyle( + { ...nodeDatum, colorValue: datumColor ?? nodeDatum.colorValue }, + false + ); + const color6 = format.fill; + const markerStyle = { + shape: "square", + fill: color6, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + }; + if (_ModuleSupport273.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return this.formatTooltipWithContext( + tooltip, + { + title: labelKey == null ? void 0 : datum[labelKey], + symbol: { + marker: markerStyle + }, + data + }, + { + seriesId, + datum, + title: void 0, + depth, + labelKey, + secondaryLabelKey, + childrenKey, + sizeKey, + sizeName, + colorKey, + colorName, + ...format + } + ); + } + createNodeData() { + return void 0; + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.datumSelection.nodes()); + } + animateEmptyUpdateReady() { + fromToMotion6(this.id, "nodes", this.ctx.animationManager, [this.scalingGroup], { + toFn() { + return { scalingX: 1, scalingY: 1 }; + }, + fromFn() { + return { scalingX: 0, scalingY: 0 }; + } + }); + } + computeFocusBounds(node) { + return node; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +SunburstSeries.className = "SunburstSeries"; +SunburstSeries.type = "sunburst"; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport274 } from "ag-charts-community"; +import { constant as constant24, required as required24, string as string22 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs22, sunburstSeriesThemeableOptionsDef, without: without8 } = _ModuleSupport274; +var sunburstSeriesOptionsDef = { + ...sunburstSeriesThemeableOptionsDef, + ...without8(commonSeriesOptionsDefs22, ["highlightStyle", "highlight", "showInLegend"]), + type: required24(constant24("sunburst")), + labelKey: string22, + secondaryLabelKey: string22, + childrenKey: string22, + sizeKey: string22, + colorKey: string22, + sizeName: string22, + colorName: string22 +}; + +// packages/ag-charts-enterprise/src/series/sunburst/sunburstModule.ts +var { BASE_FONT_SIZE, FONT_SIZE_RATIO: FONT_SIZE_RATIO3 } = _ModuleSupport275; +var SunburstModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "sunburst", + moduleFactory: (ctx) => new SunburstSeries(ctx), + solo: true, + themeTemplate: { + series: { + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", _ModuleSupport275.FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS], + ["pattern", _ModuleSupport275.FILL_PATTERN_DEFAULTS], + ["image", _ModuleSupport275.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + colorRange: { $palette: "divergingColors" }, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + label: { + ..._ModuleSupport275.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $rem: FONT_SIZE_RATIO3.LARGE }, + minimumFontSize: { $rem: 9 / BASE_FONT_SIZE }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + overflowStrategy: "ellipsis", + wrapping: "never", + spacing: 2 + }, + secondaryLabel: { + ..._ModuleSupport275.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $rem: FONT_SIZE_RATIO3.SMALLEST }, + minimumFontSize: { $rem: 7 / BASE_FONT_SIZE }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + overflowStrategy: "ellipsis", + wrapping: "never" + }, + sectorSpacing: 2, + padding: 3, + highlightStyle: { + label: { + color: { $ref: "chartBackgroundColor" } + }, + secondaryLabel: { + color: { $ref: "chartBackgroundColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + } + }, + gradientLegend: { + enabled: true, + ..._ModuleSupport275.LEGEND_CONTAINER_THEME + } + } +}; +var SunburstSeriesModule = { + type: "series", + name: "sunburst", + chartType: "standalone", + enterprise: true, + options: sunburstSeriesOptionsDef, + create: (ctx) => new SunburstSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/series/treemap/treemapModule.ts +import { _ModuleSupport as _ModuleSupport279 } from "ag-charts-community"; + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeries.ts +import { + _ModuleSupport as _ModuleSupport277 +} from "ag-charts-community"; +import { + cachedTextMeasurer as cachedTextMeasurer14, + calcLineHeight as calcLineHeight8, + isNumberEqual as isNumberEqual10, + toPlainText as toPlainText13, + wrapText as wrapText5 +} from "ag-charts-core"; + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeriesProperties.ts +import { _ModuleSupport as _ModuleSupport276 } from "ag-charts-community"; +var { BaseProperties: BaseProperties30, HierarchySeriesProperties: HierarchySeriesProperties2, HighlightStyle: HighlightStyle2, makeSeriesTooltip: makeSeriesTooltip24, Property: Property84, Label: Label18 } = _ModuleSupport276; +var TreemapGroupLabel = class extends Label18 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass([ + Property84 +], TreemapGroupLabel.prototype, "spacing", 2); +var TreemapSeriesGroup = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.textAlign = "center"; + this.gap = 0; + this.padding = 0; + this.interactive = true; + this.label = new TreemapGroupLabel(); + } +}; +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "fill", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "fillOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "stroke", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "strokeWidth", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "strokeOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "cornerRadius", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "textAlign", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "gap", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "padding", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "interactive", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroup.prototype, "label", 2); +var TreemapSeriesTile = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.gap = 0; + this.padding = 0; + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + } +}; +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "fill", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "fillOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "stroke", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "strokeWidth", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "strokeOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "cornerRadius", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "textAlign", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "verticalAlign", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "gap", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "padding", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "label", 2); +__decorateClass([ + Property84 +], TreemapSeriesTile.prototype, "secondaryLabel", 2); +var TreemapSeriesGroupHighlightStyle = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.label = new AutoSizedLabel(); + } +}; +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "label", 2); +var TreemapSeriesTileHighlightStyle = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + } +}; +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "fill", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "label", 2); +__decorateClass([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "secondaryLabel", 2); +var TreemapSeriesHighlightStyle = class extends HighlightStyle2 { + constructor() { + super(false); + this.group = new TreemapSeriesGroupHighlightStyle(); + this.tile = new TreemapSeriesTileHighlightStyle(); + } + getStyle(isLeaf) { + return isLeaf ? this.tile : this.group; + } +}; +__decorateClass([ + Property84 +], TreemapSeriesHighlightStyle.prototype, "group", 2); +__decorateClass([ + Property84 +], TreemapSeriesHighlightStyle.prototype, "tile", 2); +var TreemapSeriesProperties = class extends HierarchySeriesProperties2 { + constructor() { + super(...arguments); + this.highlightStyle = new TreemapSeriesHighlightStyle(); + this.tooltip = makeSeriesTooltip24(); + this.group = new TreemapSeriesGroup(); + this.tile = new TreemapSeriesTile(); + this.undocumentedGroupFills = []; + this.undocumentedGroupStrokes = []; + } + getStyle(isLeaf, fills, strokes, index) { + const { + fillOpacity, + strokeWidth, + strokeOpacity, + fill = isLeaf ? fills[index % fills.length] : fills[Math.min(index, fills.length)], + stroke: stroke2 = isLeaf ? strokes[index % fills.length] : strokes[Math.min(index, strokes.length)] + } = isLeaf ? this.tile : this.group; + return { + fill, + fillOpacity, + stroke: stroke2, + strokeWidth, + strokeOpacity, + opacity: 1 + }; + } +}; +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "secondaryLabelKey", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "highlightStyle", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "group", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "tile", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "undocumentedGroupFills", 2); +__decorateClass([ + Property84 +], TreemapSeriesProperties.prototype, "undocumentedGroupStrokes", 2); + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeries.ts +var { + createDatumId: createDatumId22, + Rect: Rect9, + Group: Group21, + BBox: BBox28, + Selection: Selection18, + Text: Text10, + Transformable: Transformable4, + applyShapeStyle: applyShapeStyle20, + getLabelStyles: getLabelStyles8, + mergeDefaults: mergeDefaults22, + formatValue: formatValue3 +} = _ModuleSupport277; +var TreemapNode = class extends _ModuleSupport277.HierarchyNode { + constructor() { + super(...arguments); + this.labelValue = void 0; + this.secondaryLabelValue = void 0; + this.label = void 0; + this.secondaryLabel = void 0; + this.bbox = void 0; + this.padding = void 0; + } +}; +function nodeSize(node) { + return node.children.length > 0 ? node.sumSize - node.sizeValue : node.sizeValue; +} +var textAlignFactors2 = { + left: 0, + center: 0.5, + right: 1 +}; +var verticalAlignFactors4 = { + top: 0, + middle: 0.5, + bottom: 1 +}; +var DistantGroup = class extends _ModuleSupport277.Group { + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } +}; +var TreemapSeries = class extends _ModuleSupport277.HierarchySeries { + constructor() { + super(...arguments); + this.NodeClass = TreemapNode; + this.properties = new TreemapSeriesProperties(); + this.rectGroup = this.contentGroup.appendChild(new Group21()); + this.datumSelection = Selection18.select(this.rectGroup, Rect9); + this.labelSelection = Selection18.select(this.labelGroup, Group21); + this.highlightSelection = Selection18.select( + this.rectGroup, + Rect9 + ); + } + groupTitleHeight(node, bbox) { + const { labelValue } = node; + const { label: font2 } = this.properties.group; + const heightRatioThreshold = 3; + if (labelValue == null) { + return; + } else if (font2.fontSize > bbox.width / heightRatioThreshold || font2.fontSize > bbox.height / heightRatioThreshold) { + return; + } else { + const { height: fontHeight } = cachedTextMeasurer14(font2).measureLines(labelValue); + return Math.max(fontHeight, font2.fontSize); + } + } + getNodePadding(node, bbox) { + if (node.parent == null) { + return { + top: 0, + right: 0, + bottom: 0, + left: 0 + }; + } else if (node.children.length === 0) { + const { padding: padding2 } = this.properties.tile; + return { + top: padding2, + right: padding2, + bottom: padding2, + left: padding2 + }; + } + const { + label: { spacing }, + padding + } = this.properties.group; + const fontHeight = this.groupTitleHeight(node, bbox); + const titleHeight = fontHeight == null ? 0 : fontHeight + spacing; + return { + top: padding + titleHeight, + right: padding, + bottom: padding, + left: padding + }; + } + sortChildren({ children }) { + const sortedChildrenIndices = Array.from(children, (_, i) => i).filter((i) => nodeSize(children[i]) > 0).sort((aIndex, bIndex) => nodeSize(children[bIndex]) - nodeSize(children[aIndex])); + const childAt = (i) => { + const sortedIndex = sortedChildrenIndices[i]; + return children[sortedIndex]; + }; + return { sortedChildrenIndices, childAt }; + } + /** + * Squarified Treemap algorithm + * https://www.win.tue.nl/~vanwijk/stm.pdf + */ + squarify(node, bbox) { + const { datum, children } = node; + if (bbox.width <= 0 || bbox.height <= 0) { + node.bbox = void 0; + node.padding = void 0; + node.midPoint.x = Number.NaN; + node.midPoint.y = Number.NaN; + return; + } + const padding = datum == null ? { top: 0, right: 0, bottom: 0, left: 0 } : this.getNodePadding(node, bbox); + if (node.parent == null) { + node.bbox = void 0; + node.padding = void 0; + node.midPoint.x = Number.NaN; + node.midPoint.y = Number.NaN; + } else { + node.bbox = bbox; + node.padding = padding; + node.midPoint.x = bbox.x + bbox.width / 2; + node.midPoint.y = bbox.y; + } + const { sortedChildrenIndices, childAt } = this.sortChildren(node); + const allLeafNodes = sortedChildrenIndices.every((sortedIndex) => children[sortedIndex].children.length === 0); + const targetTileAspectRatio = 1; + const width = bbox.width - padding.left - padding.right; + const height = bbox.height - padding.top - padding.bottom; + if (width <= 0 || height <= 0) + return; + const numChildren = sortedChildrenIndices.length; + let stackSum = 0; + let startIndex = 0; + let minRatioDiff = Infinity; + let partitionSum = sortedChildrenIndices.reduce((sum, sortedIndex) => sum + nodeSize(children[sortedIndex]), 0); + const innerBox = new BBox28(bbox.x + padding.left, bbox.y + padding.top, width, height); + const partition = innerBox.clone(); + let i = 0; + while (i < numChildren) { + const value = nodeSize(childAt(i)); + const firstValue = nodeSize(childAt(startIndex)); + const isVertical2 = partition.width < partition.height; + stackSum += value; + const partThickness = isVertical2 ? partition.height : partition.width; + const partLength = isVertical2 ? partition.width : partition.height; + const firstTileLength = partLength * firstValue / stackSum; + let stackThickness = partThickness * stackSum / partitionSum; + const ratio3 = Math.max(firstTileLength, stackThickness) / Math.min(firstTileLength, stackThickness); + const diff8 = Math.abs(targetTileAspectRatio - ratio3); + if (diff8 < minRatioDiff) { + minRatioDiff = diff8; + i++; + continue; + } + stackSum -= value; + stackThickness = partThickness * stackSum / partitionSum; + let start2 = isVertical2 ? partition.x : partition.y; + for (let j = startIndex; j < i; j++) { + const child = childAt(j); + const childSize = nodeSize(child); + const x = isVertical2 ? start2 : partition.x; + const y = isVertical2 ? partition.y : start2; + const length = partLength * childSize / stackSum; + const stackWidth = isVertical2 ? length : stackThickness; + const stackHeight = isVertical2 ? stackThickness : length; + const childBbox = new BBox28(x, y, stackWidth, stackHeight); + this.applyGap(innerBox, childBbox, allLeafNodes); + this.squarify(child, childBbox); + partitionSum -= childSize; + start2 += length; + } + if (isVertical2) { + partition.y += stackThickness; + partition.height -= stackThickness; + } else { + partition.x += stackThickness; + partition.width -= stackThickness; + } + startIndex = i; + stackSum = 0; + minRatioDiff = Infinity; + } + const isVertical = partition.width < partition.height; + let start = isVertical ? partition.x : partition.y; + for (let childIdx = startIndex; childIdx < numChildren; childIdx++) { + const child = childAt(childIdx); + const x = isVertical ? start : partition.x; + const y = isVertical ? partition.y : start; + const part = nodeSize(child) / partitionSum; + const childWidth = partition.width * (isVertical ? part : 1); + const childHeight = partition.height * (isVertical ? 1 : part); + const childBox = new BBox28(x, y, childWidth, childHeight); + this.applyGap(innerBox, childBox, allLeafNodes); + this.squarify(child, childBox); + start += isVertical ? childWidth : childHeight; + } + } + applyGap(innerBox, childBox, allLeafNodes) { + const gap = allLeafNodes ? this.properties.tile.gap * 0.5 : this.properties.group.gap * 0.5; + const getBounds = (box) => ({ + left: box.x, + top: box.y, + right: box.x + box.width, + bottom: box.y + box.height + }); + const innerBounds = getBounds(innerBox); + const childBounds = getBounds(childBox); + const sides = ["top", "right", "bottom", "left"]; + for (const side of sides) { + if (!isNumberEqual10(innerBounds[side], childBounds[side])) { + childBox.shrink(gap, side); + } + } + } + createNodeData() { + return void 0; + } + getItemStyle(nodeDatum, isLeaf, isHighlight) { + const { properties, colorScale } = this; + const { itemStyler } = properties; + const rootIndex = nodeDatum.datumIndex?.[0] ?? 0; + const fills = isLeaf ? properties.fills : properties.undocumentedGroupFills; + const strokes = isLeaf ? properties.strokes : properties.undocumentedGroupStrokes; + const index = isLeaf ? rootIndex : nodeDatum.depth ?? -1; + const highlightStyle = isHighlight ? properties.highlightStyle.getStyle(isLeaf) : void 0; + const baseStyle = mergeDefaults22(highlightStyle, properties.getStyle(isLeaf, fills, strokes, index)); + if (!isHighlight && isLeaf && nodeDatum.colorValue != null) { + baseStyle.fill = colorScale.convert(nodeDatum.colorValue); + } + let style = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId22(this.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style = mergeDefaults22(overrides, style); + } + } + return style; + } + makeItemStylerParams(nodeDatum, isHighlight, style) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = this.filterItemStylerFillParams(style.fill) ?? style.fill; + return { + seriesId, + datum: nodeDatum.datum, + depth: nodeDatum.depth ?? -1, + highlighted: isHighlight, + highlightState, + ...style, + fill + }; + } + updateSelections() { + let highlightedNode = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedNode != null && !this.properties.group.interactive && highlightedNode.children.length !== 0) { + highlightedNode = void 0; + } + this.highlightSelection.update( + highlightedNode == null ? [] : [highlightedNode], + void 0, + (node) => this.getDatumId(node) + ); + if (!this.nodeDataRefresh) { + return; + } + this.nodeDataRefresh = false; + const { seriesRect } = this.chart ?? {}; + if (!seriesRect) + return; + const descendants = Array.from(this.rootNode); + const updateLabelGroup = (group) => { + group.append([new Text10({ tag: 0 /* Primary */ }), new Text10({ tag: 1 /* Secondary */ })]); + }; + this.datumSelection.update(descendants, void 0, (node) => this.getDatumId(node)); + this.labelSelection.update(descendants, updateLabelGroup, (node) => this.getDatumId(node)); + } + updateNodes() { + const { rootNode, data } = this; + const { + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + highlightStyle, + tile, + group + } = this.properties; + const { seriesRect } = this.chart ?? {}; + if (!seriesRect || !data) + return; + this.rootNode?.walk((node) => { + const { datum, depth, children } = node; + const isLeaf = children.length === 0; + const labelStyle = isLeaf ? tile.label : group.label; + let labelValue; + if (labelStyle.enabled && datum != null && depth != null && labelKey != null) { + const value = datum[labelKey]; + labelValue = this.getLabelText( + value, + datum, + labelKey, + "label", + [], + labelStyle, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (labelValue === "") { + labelValue = void 0; + } + let secondaryLabelValue; + if (tile.secondaryLabel.enabled && isLeaf && datum != null && depth != null && secondaryLabelKey != null) { + const value = datum[secondaryLabelKey]; + secondaryLabelValue = this.getLabelText( + value, + datum, + secondaryLabelKey, + "secondaryLabel", + [], + tile.secondaryLabel, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (secondaryLabelValue === "") { + secondaryLabelValue = void 0; + } + node.labelValue = toPlainText13(labelValue); + node.secondaryLabelValue = toPlainText13(secondaryLabelValue); + }); + const { width, height } = seriesRect; + this.squarify(rootNode, new BBox28(0, 0, width, height)); + this.rootNode?.walk((node) => { + const { bbox, children, labelValue, secondaryLabelValue } = node; + node.label = void 0; + node.secondaryLabel = void 0; + if (bbox == null) + return; + if (children.length === 0) { + const layout = { + width: bbox.width, + height: bbox.height, + meta: null + }; + const formatting = formatLabels( + labelValue, + this.properties.tile.label, + secondaryLabelValue, + this.properties.tile.secondaryLabel, + { padding: tile.padding }, + () => layout + ); + if (formatting == null) { + return; + } + const { height: labelHeight, label, secondaryLabel } = formatting; + const { textAlign, verticalAlign, padding } = tile; + const textAlignFactor = textAlignFactors2[textAlign] ?? 0.5; + const labelX = bbox.x + padding + (bbox.width - 2 * padding) * textAlignFactor; + const verticalAlignFactor = verticalAlignFactors4[verticalAlign] ?? 0.5; + const labelYStart = bbox.y + padding + labelHeight * 0.5 + (bbox.height - 2 * padding - labelHeight) * verticalAlignFactor; + if (label != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.tile.label; + node.label = { + text: label.text, + fontSize: label.fontSize, + lineHeight: label.lineHeight, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: labelX, + y: labelYStart - (labelHeight - label.height) * 0.5 + }; + } + if (secondaryLabel != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.tile.secondaryLabel; + node.secondaryLabel = { + text: secondaryLabel.text, + fontSize: secondaryLabel.fontSize, + lineHeight: secondaryLabel.fontSize, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: labelX, + y: labelYStart + (labelHeight - secondaryLabel.height) * 0.5 + }; + } + } else if (labelValue == null) { + return; + } else { + const { padding, textAlign } = group; + const groupTitleHeight = this.groupTitleHeight(node, bbox); + if (groupTitleHeight == null) + return; + const innerWidth = bbox.width - 2 * padding; + const text2 = wrapText5(labelValue, { + maxWidth: bbox.width - 2 * padding, + font: group.label, + textWrap: "never" + }); + const textAlignFactor = textAlignFactors2[textAlign] ?? 0.5; + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.group.label; + node.label = { + text: text2, + fontSize: group.label.fontSize, + lineHeight: calcLineHeight8(group.label.fontSize), + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: bbox.x + padding + innerWidth * textAlignFactor, + y: bbox.y + padding + groupTitleHeight * 0.5 + }; + } + }); + const fillBBox = { + series: new BBox28(0, 0, width, height), + axis: new BBox28(0, 0, width, height) + }; + const updateRectFn = (node, rect, isHighlight) => { + const { bbox } = node; + if (bbox == null) { + rect.visible = false; + return; + } + const { depth = -1 } = node; + const isLeaf = node.children.length === 0; + const style = this.getItemStyle(node, isLeaf, isHighlight); + rect.crisp = true; + applyShapeStyle20(rect, style, fillBBox); + rect.cornerRadius = isLeaf ? tile.cornerRadius : group.cornerRadius; + rect.zIndex = [0, depth, isHighlight ? 1 : 0]; + const onlyLeaves = node.parent?.children.every((n) => n.children.length === 0); + const parentBbox = node.parent == null ? void 0 : node.parent.bbox; + const parentPadding = node.parent == null ? void 0 : node.parent.padding; + if (onlyLeaves === true && parentBbox != null && parentPadding != null) { + rect.clipBBox = bbox; + rect.x = parentBbox.x + parentPadding.left; + rect.y = parentBbox.y + parentPadding.top; + rect.width = parentBbox.width - (parentPadding.left + parentPadding.right); + rect.height = parentBbox.height - (parentPadding.top + parentPadding.bottom); + } else { + rect.clipBBox = void 0; + rect.x = bbox.x; + rect.y = bbox.y; + rect.width = bbox.width; + rect.height = bbox.height; + } + rect.visible = true; + }; + this.datumSelection.each((rect, datum) => updateRectFn(datum, rect, false)); + this.highlightSelection.each((rect, datum) => { + updateRectFn(datum, rect, true); + }); + const updateLabelFn = (node, text2, tag, highlighted) => { + const isLeaf = node.children.length === 0; + const label = tag === 0 /* Primary */ ? node.label : node.secondaryLabel; + if (label == null) { + text2.visible = false; + return; + } + const labelProps = tag === 0 /* Primary */ ? tile.label : tile.secondaryLabel; + let highlightedColor; + if (highlighted) { + const { tile: hTitle, group: hGroup } = highlightStyle; + highlightedColor = hTitle.secondaryLabel.color; + if (!isLeaf) { + highlightedColor = hGroup.label.color; + } else if (tag === 0 /* Primary */) { + highlightedColor = hTitle.label.color; + } + } + const params = { + childrenKey: this.properties.childrenKey, + colorKey: this.properties.colorKey, + colorName: this.properties.colorName ?? this.properties.colorKey, + depth: node.depth ?? Number.NaN, + labelKey: this.properties.labelKey, + secondaryLabelKey: this.properties.secondaryLabelKey, + sizeKey: this.properties.sizeKey, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const style = getLabelStyles8(this, node, params, labelProps, highlighted, activeHighlight); + text2.text = label.text; + text2.fontSize = label.fontSize; + text2.lineHeight = label.lineHeight; + text2.fontStyle = label.fontStyle; + text2.fontFamily = label.fontFamily; + text2.fontWeight = label.fontWeight; + text2.fill = highlightedColor ?? label.color; + text2.fillOpacity = this.getHighlightStyle(highlighted, node.datumIndex)?.opacity ?? 1; + text2.textAlign = label.textAlign; + text2.textBaseline = label.verticalAlign; + text2.x = label.x; + text2.y = label.y; + text2.setBoxing(style); + text2.visible = true; + text2.zIndex = 1; + }; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + for (const text2 of this.labelSelection.selectByClass(Text10)) { + const datum = text2.closestDatum(); + updateLabelFn(datum, text2, text2.tag, datum === highlightedDatum); + } + } + pickNodesExactShape(point) { + const nodes = super.pickNodesExactShape(point); + nodes.sort((a, b) => b.datumIndex.length - a.datumIndex.length); + return nodes; + } + pickNodeClosestDatum(point) { + const exactMatch = this.pickNodesExactShape(point); + if (exactMatch.length !== 0) { + return { datum: exactMatch[0], distance: 0 }; + } + return this.pickNodeNearestDistantObject(point, this.datumSelection.nodes()); + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties, ctx } = this; + const { formatManager } = ctx; + const { labelKey, secondaryLabelKey, childrenKey, sizeKey, sizeName, colorKey, colorName, tooltip } = properties; + const nodeDatum = datumIndex.reduce((n, i) => n?.children[i], this.rootNode); + if (nodeDatum == null) + return; + const { datum, depth, children } = nodeDatum; + if (datum == null || depth == null) + return; + const isLeaf = children.length === 0; + const data = []; + const datumSize = sizeKey == null ? void 0 : datum[sizeKey]; + if (datumSize != null) { + const sizeDomain = [0, this.rootNode?.sumSize ?? 0]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumSize, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain: sizeDomain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue3(datumSize) }); + } + const datumColor = colorKey == null ? void 0 : datum[colorKey]; + if (datumColor != null) { + const { colorDomain } = this; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumColor, + datum, + seriesId, + legendItemName: void 0, + key: colorKey, + source: "tooltip", + property: "color", + boundSeries: this.getFormatterContext("color"), + domain: colorDomain, + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue3(datumColor) }); + } + const format = this.getItemStyle( + { ...nodeDatum, colorValue: datumColor ?? nodeDatum.colorValue }, + isLeaf, + false + ); + const color6 = format.fill; + const markerStyle = { + shape: "square", + fill: color6, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + }; + if (_ModuleSupport277.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + const symbol = isLeaf ? { marker: markerStyle } : void 0; + return this.formatTooltipWithContext( + tooltip, + { + title: labelKey == null ? void 0 : datum[labelKey], + symbol, + data + }, + { + seriesId, + datum, + title: void 0, + depth, + labelKey, + secondaryLabelKey, + childrenKey, + sizeKey, + sizeName, + colorKey, + colorName, + ...format + } + ); + } + computeFocusBounds(node) { + return Transformable4.toCanvas(this.contentGroup, node.getBBox()); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.tile.label.itemStyler != null || this.properties.group.label.itemStyler != null; + } +}; +TreemapSeries.className = "TreemapSeries"; +TreemapSeries.type = "treemap"; + +// packages/ag-charts-enterprise/src/series/treemap/treemapSeriesOptionsDef.ts +import { _ModuleSupport as _ModuleSupport278 } from "ag-charts-community"; +import { arrayOf as arrayOf5, color as color5, constant as constant25, required as required25, string as string23, undocumented as undocumented8 } from "ag-charts-core"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs23, treemapSeriesThemeableOptionsDef, without: without9 } = _ModuleSupport278; +var treemapSeriesOptionsDef = { + ...treemapSeriesThemeableOptionsDef, + ...without9(commonSeriesOptionsDefs23, ["highlightStyle", "highlight", "showInLegend"]), + type: required25(constant25("treemap")), + labelKey: string23, + secondaryLabelKey: string23, + childrenKey: string23, + sizeKey: string23, + colorKey: string23, + sizeName: string23, + colorName: string23 +}; +treemapSeriesOptionsDef.undocumentedGroupFills = undocumented8(arrayOf5(color5)); +treemapSeriesOptionsDef.undocumentedGroupStrokes = undocumented8(arrayOf5(color5)); + +// packages/ag-charts-enterprise/src/series/treemap/treemapModule.ts +var { FONT_SIZE_RATIO: FONT_SIZE_RATIO4 } = _ModuleSupport279; +var TreemapModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "treemap", + moduleFactory: (ctx) => new TreemapSeries(ctx), + solo: true, + themeTemplate: { + series: { + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", _ModuleSupport279.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", _ModuleSupport279.FILL_PATTERN_DEFAULTS], + ["image", _ModuleSupport279.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + colorRange: { $palette: "divergingColors" }, + // @ts-expect-error undocumented option + undocumentedGroupFills: { $palette: "hierarchyColors" }, + undocumentedGroupStrokes: { $palette: "secondHierarchyColors" }, + group: { + label: { + ..._ModuleSupport279.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "textColor" }, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + spacing: 4 + }, + fill: void 0, + // Override default fill + stroke: void 0, + // Override default stroke + strokeWidth: 1, + padding: 4, + gap: 2, + textAlign: "left" + }, + tile: { + label: { + ..._ModuleSupport279.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "chartBackgroundColor" }, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: 1.5 }, + minimumFontSize: { $rem: FONT_SIZE_RATIO4.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + wrapping: "on-space", + overflowStrategy: "ellipsis", + spacing: 2 + }, + secondaryLabel: { + ..._ModuleSupport279.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "chartBackgroundColor" }, + fontStyle: void 0, + fontWeight: void 0, + fontSize: { $ref: "fontSize" }, + minimumFontSize: { $rem: FONT_SIZE_RATIO4.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + wrapping: "never", + overflowStrategy: "ellipsis" + }, + fill: void 0, + // Override default fill + stroke: void 0, + // Override default stroke + strokeWidth: { $isUserOption: ["../strokes/0", 2, { $isUserOption: ["./stroke", 2, 0] }] }, + padding: 3, + gap: 1 + }, + // Override defaults + highlightStyle: { + group: { + label: { + color: { $ref: "textColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + }, + tile: { + label: { + color: { $ref: "chartBackgroundColor" } + }, + secondaryLabel: { + color: { $ref: "chartBackgroundColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + } + } + }, + gradientLegend: { + enabled: true, + ..._ModuleSupport279.LEGEND_CONTAINER_THEME + } + } +}; +var TreemapSeriesModule = { + type: "series", + name: "treemap", + chartType: "standalone", + enterprise: true, + options: treemapSeriesOptionsDef, + create: (ctx) => new TreemapSeries(ctx) +}; + +// packages/ag-charts-enterprise/src/main-modules.ts +var ModuleRegistry = _ModuleSupport280.ModuleRegistry; +var AllCartesianEnterpriseModules = [ + OrdinalTimeAxisModule2, + BoxPlotSeriesModule, + CandlestickSeriesModule, + ConeFunnelSeriesModule, + FunnelSeriesModule, + HeatmapSeriesModule, + OhlcSeriesModule, + RangeAreaSeriesModule, + RangeBarSeriesModule, + WaterfallSeriesModule +]; +var AllPolarEnterpriseModules = [ + AngleNumberAxisModule2, + AngleCategoryAxisModule2, + RadiusNumberAxisModule2, + RadiusCategoryAxisModule2, + NightingaleSeriesModule, + RadarAreaSeriesModule, + RadarLineSeriesModule, + RadialBarSeriesModule, + RadialColumnSeriesModule +]; +var AllStandaloneEnterpriseModules = [ + StandaloneChartModule, + PyramidSeriesModule, + LinearGaugeSeriesModule, + RadialGaugeSeriesModule, + SunburstSeriesModule, + TreemapSeriesModule, + ChordSeriesModule, + SankeySeriesModule +]; +var AllTopologyEnterpriseModules = [ + TopologyChartModule, + MapLineSeriesModule, + MapLineBackgroundSeriesModule, + MapMarkerSeriesModule, + MapShapeSeriesModule, + MapShapeBackgroundSeriesModule +]; +var AllEnterpriseModules = [ + ...AllCartesianEnterpriseModules, + ...AllPolarEnterpriseModules, + ...AllStandaloneEnterpriseModules, + ...AllTopologyEnterpriseModules, + // Plugins, WIP + AnnotationsModule2, + NavigatorModule2, + InitialStateModule +]; + +// packages/ag-charts-enterprise/src/styles.css +var styles_default = `.ag-watermark{position:absolute;bottom:20px;right:25px;font-weight:700;font-family:Impact,sans-serif;font-size:19px;opacity:.7;animation:1s ease-out 3s ag-watermark-fadeout;color:#9b9b9b;pointer-events:none;&:before{content:"";display:block;height:40px;width:170px;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU4IiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgMjU4IDQwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjUuNzc5IDI4LjY1N0gxMy4zNTlMMTEuMTczIDM0LjAxMkg1LjY3Mjk3TDE3LjE4MiA3LjA1OTk5SDIxLjk1M0wzMy40NjIgMzQuMDEySDI3Ljk2MkwyNS43NzYgMjguNjU3SDI1Ljc3OVpNMjQuMDY4IDI0LjM5N0wxOS41ODggMTMuNDM0TDE1LjEwNyAyNC4zOTdIMjQuMDY4Wk02Mi4wOTIgMTguODIzSDQ5LjgxN1YyMy4wODZINTYuNzc1QzU2LjU1NSAyNS4yMjIgNTUuNzU1IDI2LjkyNyA1NC4zNzIgMjguMjAyQzUyLjk4OSAyOS40NzYgNTEuMTY2IDMwLjExNSA0OC45MDkgMzAuMTE1QzQ3LjYyMiAzMC4xMTUgNDYuNDUgMjkuODg1IDQ1LjM5MyAyOS40MjNDNDQuMzU4MyAyOC45NzgxIDQzLjQzMjYgMjguMzEzOCA0Mi42OCAyNy40NzZDNDEuOTI3IDI2LjYzOSA0MS4zNDQgMjUuNjMxIDQwLjkzMSAyNC40NTNDNDAuNTE5IDIzLjI3NSA0MC4zMTEgMjEuOTcgNDAuMzExIDIwLjUzN0M0MC4zMTEgMTkuMTA1IDQwLjUxNiAxNy44IDQwLjkzMSAxNi42MjFDNDEuMzQ0IDE1LjQ0MyA0MS45MjcgMTQuNDM2IDQyLjY4IDEzLjU5OEM0My40Mzc2IDEyLjc1NzcgNDQuMzY5NiAxMi4wOTMyIDQ1LjQxMSAxMS42NTFDNDYuNDc4IDExLjE4OSA0Ny42NTYgMTAuOTYgNDguOTQ2IDEwLjk2QzUxLjYxMiAxMC45NiA1My42MzcgMTEuNjAyIDU1LjAyIDEyLjg4NUw1OC4zIDkuNjA0OTlDNTUuODE3IDcuNjY5OTkgNTIuNjc2IDYuNjk5OTkgNDguODcyIDYuNjk5OTlDNDYuNzYgNi42OTk5OSA0NC44NTMgNy4wMzQ5OSA0My4xNTQgNy43MDA5OUM0MS40NTUgOC4zNjc5OSAzOS45OTggOS4zMDM5OSAzOC43ODMgMTAuNTA0QzM3LjU2NyAxMS43MDcgMzYuNjM0IDEzLjE1OCAzNS45NzcgMTQuODU3QzM1LjMxOSAxNi41NTYgMzQuOTk0IDE4LjQ1MSAzNC45OTQgMjAuNTRDMzQuOTk0IDIyLjYzIDM1LjMyOSAyNC40OTQgMzUuOTk1IDI2LjIwNUMzNi42NjIgMjcuOTE2IDM3LjYwNSAyOS4zNzQgMzguODE3IDMwLjU3N0M0MC4wMzIgMzEuNzggNDEuNDg2IDMyLjcxMyA0My4xODggMzMuMzgzQzQ0Ljg4OCAzNC4wNDkgNDYuNzgyIDM0LjM4NCA0OC44NzIgMzQuMzg0QzUwLjk2MSAzNC4zODQgNTIuNzUgMzQuMDQ5IDU0LjM5IDMzLjM4M0M1Ni4wMzEgMzIuNzE2IDU3LjQyNiAzMS43OCA1OC41NzkgMzAuNTc3QzU5LjczMyAyOS4zNzQgNjAuNjE5IDI3LjkxNiA2MS4yMzkgMjYuMjA1QzYxLjg2IDI0LjQ5NCA2Mi4xNyAyMi42MDUgNjIuMTcgMjAuNTRDNjIuMTY5NiAxOS45Njg4IDYyLjE0NDUgMTkuMzk4IDYyLjA5NSAxOC44MjlMNjIuMDkyIDE4LjgyM1pNMTUxLjgxIDE2Ljk4MUMxNTMuNDEgMTQuNjA5IDE1Ny40MTkgMTQuMzU4IDE1OS4wMjIgMTQuMzU4VjE4LjkxQzE1Ni45NTcgMTguOTEgMTU0Ljk4NSAxOC45OTYgMTUzLjc1NyAxOS44OTJDMTUyLjUyOSAyMC43OTIgMTUxLjkxOSAyMS45ODIgMTUxLjkxOSAyMy40NjRWMzMuOTlIMTQ2Ljk2NFYxNC4zNThIMTUxLjczNkwxNTEuODEgMTYuOTgxWk0xNDMuMDExIDE0LjM2MVYzNC4wMzFIMTM4LjI0TDEzOC4xMzEgMzEuMDQ1QzEzNy40NjYgMzIuMDc2IDEzNi41NTEgMzIuOTIxOSAxMzUuNDcxIDMzLjUwNEMxMzQuMzc2IDM0LjA5OSAxMzMuMDY4IDM0LjM5NiAxMzEuNTM2IDM0LjM5NkMxMzAuMiAzNC4zOTYgMTI4Ljk2MyAzNC4xNTIgMTI3LjgyMiAzMy42NjhDMTI2LjcgMzMuMTk2NCAxMjUuNjg5IDMyLjQ5NSAxMjQuODU1IDMxLjYwOUMxMjQuMDE4IDMwLjcyMiAxMjMuMzU0IDI5LjY2MiAxMjIuODcxIDI4LjQyMkMxMjIuMzg0IDI3LjE4NSAxMjIuMTQyIDI1LjgxMSAxMjIuMTQyIDI0LjMwNEMxMjIuMTQyIDIyLjc5OCAxMjIuMzg0IDIxLjM3OCAxMjIuODcxIDIwLjExNkMxMjMuMzU3IDE4Ljg1NCAxMjQuMDE4IDE3Ljc3MiAxMjQuODU1IDE2Ljg3M0MxMjUuNjg4IDE1Ljk3NjQgMTI2LjY5OCAxNS4yNjM2IDEyNy44MjIgMTQuNzhDMTI4Ljk2MyAxNC4yODEgMTMwLjIwMyAxNC4wMzMgMTMxLjUzNiAxNC4wMzNDMTMzLjA0MyAxNC4wMzMgMTM0LjMzIDE0LjMxOCAxMzUuMzk3IDE0Ljg4OEMxMzYuNDYyIDE1LjQ1ODkgMTM3LjM3NSAxNi4yNzggMTM4LjA1NyAxNy4yNzZWMTQuMzYxSDE0My4wMTFaTTEzMi42MzEgMzAuMTMzQzEzNC4yNTYgMzAuMTMzIDEzNS41NjcgMjkuNTk0IDEzNi41NjUgMjguNTEyQzEzNy41NjEgMjcuNDMgMTM4LjA2IDI1Ljk5MSAxMzguMDYgMjQuMTk2QzEzOC4wNiAyMi40MDEgMTM3LjU2MSAyMC45OSAxMzYuNTY1IDE5Ljg5OUMxMzUuNTcgMTguODA3IDEzNC4yNTkgMTguMjU4IDEzMi42MzEgMTguMjU4QzEzMS4wMDMgMTguMjU4IDEyOS43MjkgMTguODA0IDEyOC43MzQgMTkuODk5QzEyNy43MzggMjAuOTkzIDEyNy4yMzkgMjIuNDM4IDEyNy4yMzkgMjQuMjMzQzEyNy4yMzkgMjYuMDI4IDEyNy43MzUgMjcuNDMzIDEyOC43MzQgMjguNTE1QzEyOS43MjkgMjkuNTk0IDEzMS4wMjggMzAuMTM2IDEzMi42MzEgMzAuMTM2VjMwLjEzM1pNOTMuNjk4IDI3Ljg3NkM5My41Nzk1IDI4LjAwMjUgOTMuNDU2NCAyOC4xMjQ2IDkzLjMyOSAyOC4yNDJDOTEuOTQ3IDI5LjUxNiA5MC4xMjMgMzAuMTU1IDg3Ljg2NiAzMC4xNTVDODYuNTggMzAuMTU1IDg1LjQwOCAyOS45MjYgODQuMzUgMjkuNDY0QzgzLjMxNTUgMjkuMDE4OSA4Mi4zODk4IDI4LjM1NDYgODEuNjM3IDI3LjUxN0M4MC44ODQgMjYuNjc5IDgwLjMwMSAyNS42NzIgNzkuODg5IDI0LjQ5NEM3OS40NzYgMjMuMzE1IDc5LjI2OSAyMi4wMSA3OS4yNjkgMjAuNTc4Qzc5LjI2OSAxOS4xNDUgNzkuNDczIDE3Ljg0IDc5Ljg4OSAxNi42NjJDODAuMzAxIDE1LjQ4NCA4MC44ODQgMTQuNDc2IDgxLjYzNyAxMy42MzlDODIuMzk0OSAxMi43OTg3IDgzLjMyNzMgMTIuMTM0MiA4NC4zNjkgMTEuNjkyQzg1LjQzNiAxMS4yMyA4Ni42MTQgMTEgODcuOTAzIDExQzkwLjU3IDExIDkyLjU5NSAxMS42NDIgOTMuOTc3IDEyLjkyNkw5Ny4yNTggOS42NDQ5OUM5NC43NzQgNy43MTA5OSA5MS42MzMgNi43Mzk5OSA4Ny44MjkgNi43Mzk5OUM4NS43MTggNi43Mzk5OSA4My44MTEgNy4wNzQ5OSA4Mi4xMTIgNy43NDE5OUM4MC40MTMgOC40MDc5OSA3OC45NTYgOS4zNDQ5OSA3Ny43NCAxMC41NDVDNzYuNTI1IDExLjc0NyA3NS41OTIgMTMuMTk5IDc0LjkzNCAxNC44OThDNzQuMjc3IDE2LjU5NyA3My45NTEgMTguNDkxIDczLjk1MSAyMC41ODFDNzMuOTUxIDIyLjY3IDc0LjI4NiAyNC41MzQgNzQuOTUzIDI2LjI0NUM3NS42MTkgMjcuOTU3IDc2LjU2MiAyOS40MTQgNzcuNzc0IDMwLjYxN0M3OC45OSAzMS44MiA4MC40NDQgMzIuNzUzIDgyLjE0NiAzMy40MjNDODMuODQ1IDM0LjA5IDg1LjczOSAzNC40MjQgODcuODI5IDM0LjQyNEM4OS45MTkgMzQuNDI0IDkxLjcwOCAzNC4wOSA5My4zNDggMzMuNDIzQzk0LjcxOCAzMi44NjUgOTUuOTE4IDMyLjEyMSA5Ni45NDggMzEuMTkxQzk3LjE0OSAzMS4wMDggOTcuMzQ4IDMwLjgxNSA5Ny41MzcgMzAuNjJMOTMuNzAxIDI3Ljg4NUw5My42OTggMjcuODc2Wk0xMTAuODAyIDE0LjAxNUMxMDkuMTk5IDE0LjAxNSAxMDYuODM2IDE0LjQ3MSAxMDUuNjExIDE2LjE1OEwxMDUuNTM3IDYuMDE1OTlIMTAwLjc2NVYzMy45MzlIMTA1LjcyVjIyLjY0MUMxMDUuNzcxIDIxLjQ2MDcgMTA2LjI4OCAyMC4zNDg4IDEwNy4xNTcgMTkuNTQ4OUMxMDguMDI3IDE4Ljc0OTEgMTA5LjE3OCAxOC4zMjY2IDExMC4zNTggMTguMzc0QzExMy4zOTcgMTguMzc0IDExNC4yNjggMjEuMTU5IDExNC4yNjggMjIuNjQxVjMzLjkzOUgxMTkuMjIzVjIxLjA1OUMxMTkuMjIzIDIxLjA1OSAxMTkuMTQyIDE0LjAxNSAxMTAuODAyIDE0LjAxNVpNMTczLjc2MyAxNC4zNThIMTY5Ljk5OVY4LjcxNDk5SDE2NS4wNDhWMTQuMzU4SDE2MS4yODRWMTguOTE2SDE2NS4wNDhWMzQuMDAzSDE2OS45OTlWMTguOTE2SDE3My43NjNWMTQuMzU4Wk0xOTAuNzg3IDI1LjI2MkMxOTAuMTI5IDI0LjUwMTQgMTg5LjMwNyAyMy44OTk0IDE4OC4zODQgMjMuNTAxQzE4Ny40ODggMjMuMTE3IDE4Ni4zMzEgMjIuNzMyIDE4NC45NDggMjIuMzY0QzE4NC4xNjUgMjIuMTQzOSAxODMuMzkgMjEuODk3OCAxODIuNjIzIDIxLjYyNkMxODIuMTYzIDIxLjQ2MjEgMTgxLjc0MSAyMS4yMDY2IDE4MS4zODMgMjAuODc1QzE4MS4yMzUgMjAuNzQyMSAxODEuMTE4IDIwLjU3ODkgMTgxLjAzOSAyMC4zOTY0QzE4MC45NjEgMjAuMjE0IDE4MC45MjIgMjAuMDE2NiAxODAuOTI3IDE5LjgxOEMxODAuOTI3IDE5LjI3MiAxODEuMTU2IDE4Ljg0NCAxODEuNjI1IDE4LjUxQzE4Mi4xMjEgMTguMTU2IDE4Mi44NjIgMTcuOTc2IDE4My44MjYgMTcuOTc2QzE4NC43OSAxNy45NzYgMTg1LjU4NyAxOC4yMDkgMTg2LjE0OCAxOC42NjhDMTg2LjcwNiAxOS4xMjQgMTg3LjAwNyAxOS43MjUgMTg3LjA3MiAyMC41TDE4Ny4wOTQgMjAuNzgySDE5MS42MzNMMTkxLjYxNyAyMC40NkMxOTEuNTIxIDE4LjQ4NSAxOTAuNzcxIDE2LjkgMTg5LjM4NSAxNS43NUMxODguMDEyIDE0LjYxMiAxODYuMTg1IDE0LjAzMyAxODMuOTYyIDE0LjAzM0MxODIuNDc3IDE0LjAzMyAxODEuMTQxIDE0LjI4NyAxNzkuOTk0IDE0Ljc4NkMxNzguODMxIDE1LjI5MSAxNzcuOTI2IDE1Ljk5NSAxNzcuMjk2IDE2Ljg4MkMxNzYuNjczIDE3Ljc0NTUgMTc2LjMzOCAxOC43ODQgMTc2LjM0MSAxOS44NDlDMTc2LjM0MSAyMS4xNjcgMTc2LjY5OCAyMi4yNDkgMTc3LjM5OSAyMy4wNjRDMTc4LjA2IDIzLjg0MzIgMTc4Ljg5OCAyNC40NTM0IDE3OS44NDIgMjQuODQ0QzE4MC43NDQgMjUuMjE2IDE4MS45MjggMjUuNjA3IDE4My4zNjEgMjZDMTg0LjgwNiAyNi40MSAxODUuODcyIDI2Ljc4NSAxODYuNTMgMjcuMTIzQzE4Ny4xIDI3LjQxNCAxODcuMzc5IDI3Ljg0NSAxODcuMzc5IDI4LjQ0NEMxODcuMzc5IDI5LjA0MiAxODcuMTIyIDI5LjQ2NyAxODYuNTk1IDI5LjgzOUMxODYuMDQzIDMwLjIyNiAxODUuMjM3IDMwLjQyNSAxODQuMjAxIDMwLjQyNUMxODMuMTY2IDMwLjQyNSAxODIuMzk0IDMwLjE3NCAxODEuNzQ5IDI5LjY3NEMxODEuMTEzIDI5LjE4MSAxODAuNzcyIDI4LjU4OSAxODAuNzEgMjcuODY0TDE4MC42ODUgMjcuNTgySDE3Ni4wMTNMMTc2LjAyNSAyNy45MDFDMTc2LjA2NyAyOS4wOTU1IDE3Ni40NzIgMzAuMjQ4NyAxNzcuMTg4IDMxLjIwNkMxNzcuOTA3IDMyLjE4IDE3OC44OTMgMzIuOTU4IDE4MC4xMTggMzMuNTE5QzE4MS4zMzYgMzQuMDc3IDE4Mi43MzIgMzQuMzYyIDE4NC4yNjYgMzQuMzYyQzE4NS44MDEgMzQuMzYyIDE4Ny4xMDkgMzQuMTA4IDE4OC4yMzggMzMuNjA5QzE4OS4zNzYgMzMuMTA0IDE5MC4yNzIgMzIuMzk0IDE5MC45MDEgMzEuNDk0QzE5MS41MzQgMzAuNTkyIDE5MS44NTMgMjkuNTU0IDE5MS44NTMgMjguNDAzQzE5MS44MjggMjcuMTEgMTkxLjQ2NiAyNi4wNTMgMTkwLjc3NyAyNS4yNjJIMTkwLjc4N1oiIGZpbGw9IiM5QjlCOUIiLz4KPHBhdGggZD0iTTI0MS45ODIgMjUuNjU4MlYxNy43MTE3SDIyOC40NDFMMjIwLjQ5NCAyNS42NTgySDI0MS45ODJaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNTcuMjM5IDUuOTUwODFIMjQwLjI2NUwyMzIuMjU1IDEzLjg5NzNIMjU3LjIzOVY1Ljk1MDgxWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjEyLjYxMSAzMy42MDQ4TDIxNi42OCAyOS41MzYxSDIzMC40MTJWMzcuNDgyN0gyMTIuNjExVjMzLjYwNDhaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yMTUuNTk5IDIxLjc4MDNIMjI0LjM3MkwyMzIuMzgyIDEzLjgzMzdIMjE1LjU5OVYyMS43ODAzWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjA2IDMzLjYwNDdIMjEyLjYxMUwyMjAuNDk0IDI1LjY1ODJIMjA2VjMzLjYwNDdaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNDAuMjY1IDUuOTUwODFMMjM2LjE5NyAxMC4wMTk0SDIxMC4yNTlWMi4wNzI4OEgyNDAuMjY1VjUuOTUwODFaIiBmaWxsPSIjOUI5QjlCIi8+Cjwvc3ZnPgo=);background-repeat:no-repeat;background-size:170px 40px}>span{padding-left:.7rem}}@keyframes ag-watermark-fadeout{0%{opacity:.5}to{opacity:0}}.ag-charts-dialog{display:flex;flex-direction:column;font-size:var(--ag-charts-chrome-font-size-large)}.ag-charts-dialog__tabs{display:flex;flex-direction:column}.ag-charts-dialog__header{border-bottom:1px solid var(--ag-charts-border-color);display:flex}.ag-charts-dialog__tab-list{display:flex;gap:calc(var(--ag-charts-spacing) * 2)}.ag-charts-dialog__drag-handle{align-items:center;color:inherit;cursor:grab;display:flex;padding:1px 6px;text-align:center}.ag-charts-dialog__drag-handle--dragging{cursor:grabbing}.ag-charts-dialog__tab-button{background:none;border:0;border-bottom:2px solid transparent;border-radius:0;color:var(--ag-charts-panel-subtle-text-color);margin-bottom:-1px;padding:var(--input-padding) calc(var(--input-padding) / 2)}.ag-charts-dialog__tab-button:hover{background:none}.ag-charts-dialog__tab-button--active{border-color:var(--ag-charts-accent-color);color:inherit}.ag-charts-dialog__drag-handle+.ag-charts-dialog__tab-button{margin-left:calc(var(--ag-charts-spacing) * -2)}.ag-charts-button.ag-charts-dialog__close-button{background:none;border:0;margin-left:auto;padding:1px 6px}.ag-charts-dialog__close-button:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-dialog__tab-panel{display:none;flex-direction:column;gap:calc(var(--ag-charts-spacing) * 4);margin:0 calc(var(--ag-charts-spacing) * 4);padding:calc(var(--ag-charts-spacing) * 4) 0}.ag-charts-dialog__tab-panel--active{display:flex}.ag-charts-dialog__input-group-line{display:flex;gap:16px 18px;flex-wrap:wrap}.ag-charts-dialog__input-group{align-items:center;display:flex;font-size:var(--ag-charts-chrome-font-size)}.ag-charts-dialog__input-group-label{color:var(--ag-charts-panel-subtle-text-color);margin-right:5px}.ag-charts-dialog__input-group-label[for]{cursor:pointer}.ag-charts-dialog__button{border-radius:0;margin-right:-1px}.ag-charts-dialog__button.ag-charts-dialog__button--active{background:var(--ag-charts-button-focus-background-color);border-color:var(--ag-charts-input-focus-border-color);color:var(--ag-charts-input-focus-text-color);z-index:var(--input-layer-active)}.ag-charts-dialog__button:first-child,.ag-charts-dialog__input-group-label+.ag-charts-dialog__button{border-bottom-left-radius:var(--ag-charts-input-border-radius);border-top-left-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__button:last-child{border-bottom-right-radius:var(--ag-charts-input-border-radius);border-top-right-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__color-picker-button{--color: #000;background:var(--color);border:none;color:transparent;height:26px;width:26px}.ag-charts-dialog__color-picker-button:hover{background:var(--color)}.ag-charts-dialog__color-picker-button--multi-color,.ag-charts-dialog__color-picker-button--multi-color:hover{background:linear-gradient(135deg,red 0%,#ff0 calc(100% * 1 / 6),#0f0 calc(100% * 2 / 6),#0ff 50%,#00f calc(100% * 4 / 6),#f0f calc(100% * 5 / 6),red 100%)}.ag-charts-color-picker{width:190px;padding:8px;cursor:default;--h: 0;--s: 0;--v: 0;--a: 0;--color: #000;--color-a: #000;--thumb-size: 18px;--inner-width: 172px;--track-height: 12px;--palette-height: 136px;--checker: url('data:image/svg+xml;utf8,');--multi-color: linear-gradient( 135deg, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-color-picker__content{display:flex;flex-direction:column}.ag-charts-color-picker__palette{position:relative;width:100%;height:var(--palette-height);margin-bottom:8px;background:linear-gradient(to bottom,#0000,#000),linear-gradient(to right,#fff,#fff0) hsl(var(--h),100%,50%);border-radius:calc(var(--ag-charts-border-radius) * 1.5);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__palette:after{content:"";position:absolute;display:block;top:calc(var(--thumb-size) * -.5 + (1 - var(--v)) * 100%);left:calc(var(--thumb-size) * -.5 + var(--s) * 100%);background:var(--color);width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__palette:focus-visible:after{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),0 0 0 2px #fff8,var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-row{display:flex;gap:8px;align-items:center;margin-bottom:4px;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input,.ag-charts-color-picker__alpha-input{-webkit-appearance:none;display:block;position:relative;padding:0;margin:0 calc(var(--inset) * -1);border:0;height:var(--thumb-size);width:auto;background:transparent;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input::-moz-range-thumb,.ag-charts-color-picker__alpha-input::-moz-range-thumb{appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__hue-input::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{-webkit-appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038;transform:translateZ(0)}.ag-charts-color-picker__hue-input::-moz-range-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__hue-input::-webkit-slider-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__alpha-input::-moz-range-thumb{background:transparent}.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{background:transparent}.ag-charts-color-picker__alpha-input--opaque::-moz-range-thumb{background:var(--color)}.ag-charts-color-picker__alpha-input--opaque::-webkit-slider-thumb{background:var(--color)}.ag-charts-color-picker__hue-input:focus-visible::-moz-range-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-moz-range-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input:focus-visible::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-webkit-slider-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input::-moz-range-track,.ag-charts-color-picker__alpha-input::-moz-range-track{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__hue-input:before,.ag-charts-color-picker__alpha-input:before{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button{width:36px;margin-left:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);border:0;background:var(--multi-color);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button--hidden{display:none}.ag-charts-color-picker__multi-color-button--active{box-shadow:inset 0 0 0 1px #0003;outline-offset:1px;outline:2px solid #2196f3}.ag-charts-color-picker__hue-input{flex:1 0 0}.ag-charts-color-picker__hue-input::-moz-range-track{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__hue-input:before{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__alpha-input{margin-bottom:7px}.ag-charts-color-picker__alpha-input::-moz-range-track{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__alpha-input:before{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__color-field{display:flex;border:var(--ag-charts-border);background:var(--ag-charts-background-color);border-radius:var(--ag-charts-border-radius);overflow:hidden}.ag-charts-color-picker__color-field:has(:focus-visible){border-color:var(--ag-charts-accent-color);box-shadow:var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-label{width:16px;height:16px;margin:7px 0 7px 7px;color:transparent;background:linear-gradient(to right,var(--color-a),var(--color-a)),var(--checker) top left / 4px 4px;border-radius:calc(var(--ag-charts-border-radius) / 2);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__color-label--multi-color{background:var(--multi-color)}.ag-charts-color-picker__color-input{flex:1;min-width:0;padding:7px 7px 7px 8px;border:0;margin:0;color:inherit;background:transparent;font-variant:tabular-nums}.ag-charts-color-picker__color-input:focus-visible{border:none;outline:none}.ag-charts-annotations__line-stroke-width-menu,.ag-charts-annotations__line-style-type-menu,.ag-charts-annotations__text-size-menu{border-top-left-radius:0;border-top-right-radius:0;.ag-charts-menu__row:first-child{border-radius:0}}.ag-charts-annotations__text-size-menu{--item-padding: 4px 8px;min-width:34px;text-align:center}.ag-charts-annotations__line-stroke-width-menu{--item-padding: 6px;column-gap:6px}.ag-charts-annotations__line-style-type-menu{--item-padding: 6px;column-gap:0}.ag-charts-annotations__stroke-width-button:before{background:var(--ag-charts-foreground-color);content:"";margin-right:var(--toolbar-button-padding);height:min(var(--stroke-width),20px);width:12px}.ag-charts-annotations__stroke-width-button[aria-disabled=true]:before{filter:grayscale(1);opacity:.5}.ag-charts-annotations__color-picker-button{--emblem: var(--color)}.ag-charts-annotations__color-picker-button--multi-color{--emblem: linear-gradient( to right, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-annotations__color-picker-button:after{content:"";display:block;position:absolute;bottom:3px;left:5px;right:5px;height:4px;border-radius:99px;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ag-charts-foreground-color) 10%,transparent);background:var(--emblem)}.ag-charts-annotations__color-picker-button[aria-disabled=true]:after{filter:grayscale(1);opacity:.5}.ag-charts-annotations__toolbar-menu{min-width:200px}.ag-charts-annotations__axis-button--hidden{display:none}.ag-charts-annotations__axis-button{background-color:var(--ag-charts-crosshair-label-background-color);border-radius:calc(var(--ag-charts-border-radius) / 2);border:none;box-sizing:border-box;color:var(--ag-charts-crosshair-label-text-color);cursor:pointer;font-family:var(--ag-charts-button-font-family);font-size:var(--ag-charts-button-font-size);font-weight:var(--ag-charts-button-font-weight);left:0;line-height:16px;overflow:hidden;padding:0;position:absolute;top:0;user-select:none;white-space:nowrap;z-index:var(--ag-charts-layer-annotations)}.ag-charts-annotations__axis-button:hover{opacity:.8;color:var(--ag-charts-background-color)}.ag-charts-dialog--annotation-settings{min-height:233px;width:289px}.ag-charts-dialog--annotation-settings .ag-charts-textarea{height:calc(10px * 2 + var(--textarea-line-height) * 1em * 3 + 2px);overflow-y:auto;resize:vertical}.ag-charts-context-menu{font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);z-index:var(--ag-charts-layer-ui-overlay)}.ag-charts-context-menu__cover{position:fixed;left:0;top:0}.ag-charts-context-menu__menu{background:var(--ag-charts-menu-background-color);border-radius:var(--ag-charts-border-radius);border:var(--ag-charts-menu-border);box-shadow:var(--ag-charts-popup-shadow);color:var(--ag-charts-menu-text-color);display:flex;flex-direction:column;padding:.5em 0;transition:transform .1s ease;white-space:nowrap}.ag-charts-context-menu__menu:focus{outline:none}.ag-charts-context-menu__item{align-items:center;background:none;border:none;box-sizing:border-box;color:inherit;cursor:pointer;display:flex;font:inherit;justify-content:space-between;text-align:left;width:100%;-webkit-appearance:none;-moz-appearance:none}.ag-charts-context-menu__icon>img{width:var(--ag-charts-icon-size);height:var(--ag-charts-icon-size)}.ag-charts-context-menu__icon,.ag-charts-context-menu__cell{display:flex;align-items:center;flex-shrink:0}.ag-charts-context-menu__cell{flex-grow:1}.ag-charts-context-menu__cellpadding{padding:.5em 1em}.ag-charts-context-menu__icon{padding-right:0}.ag-charts-context-menu__item[data-focus-override=true],.ag-charts-context-menu__item:focus,.ag-charts-context-menu__item:active{background:var(--ag-charts-focus-color)}.ag-charts-context-menu__item[data-focus-override=false]{background:inherit}.ag-charts-context-menu__item[data-focus-visible-override=true]:focus,.ag-charts-context-menu__item:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-context-menu__item[data-focus-visible-override=false]{outline:inherit;box-shadow:inherit;z-index:inherit}.ag-charts-context-menu__item[aria-disabled=true]{border:none;color:color-mix(in srgb,var(--ag-charts-input-text-color) 50%,transparent)}.ag-charts-context-menu__item[aria-disabled=true]:focus{background:inherit;cursor:inherit}.ag-charts-context-menu__divider{padding:5px 0}.ag-charts-context-menu__divider:after{content:"";display:block;border-top:1px solid var(--ag-charts-border-color)}.ag-charts-crosshair-label{position:absolute;left:0;top:0;user-select:none;pointer-events:none;font-family:var(--ag-charts-font-family);font-size:var(--ag-charts-font-size);font-weight:var(--ag-charts-font-weight);overflow:hidden;white-space:nowrap;z-index:var(--ag-charts-layer-crosshair);box-sizing:border-box}.ag-charts-crosshair-label-content{padding:0 8px;border-radius:calc(var(--ag-charts-border-radius) / 2);line-height:calc(var(--ag-charts-font-size) + 8px);background-color:var(--ag-charts-crosshair-label-background-color);color:var(--ag-charts-crosshair-label-text-color)}.ag-charts-crosshair-label--hidden{visibility:hidden!important}.ag-charts-text-input{position:absolute}.ag-charts-text-input__textarea{--placeholder-text-color: var(--ag-charts-input-placeholder-text-color);display:block;height:100%;width:100%;border:0;background:none;line-height:1.38;outline:none;transform:translateY(.09em)}.ag-charts-text-input__textarea[placeholder]:empty:before{content:attr(placeholder);color:var(--placeholder-text-color);font-weight:400}.ag-charts-text-input__textarea[placeholder]:not(:empty):before{content:""}.ag-charts-chart-toolbar__menu{min-width:200px}.ag-charts-range-buttons .ag-charts-toolbar__button{padding:var(--toolbar-button-padding) calc(var(--toolbar-button-padding) * 1.5)}.ag-charts-zoom-buttons{align-items:center;display:flex;height:44px;justify-content:center;overflow:hidden;padding-bottom:10px;pointer-events:none;width:100%;.ag-charts-toolbar{--toolbar-size: 24px;--toolbar-button-padding: 1px;display:flex;font-size:var(--ag-charts-chrome-font-size);height:var(--toolbar-size);justify-content:center;opacity:1;pointer-events:auto;transition:opacity .2s ease-in-out,transform .4s ease-in-out;.ag-charts-toolbar__button--first{border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__button--last{border-bottom-right-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__label{padding-left:var(--ag-charts-spacing);padding-right:var(--ag-charts-spacing)}.ag-charts-toolbar__icon+.ag-charts-toolbar__label{padding-left:0}.ag-charts-toolbar__button--gap{margin-left:var(--toolbar-gap)}&.ag-charts-zoom-buttons__toolbar--hidden{opacity:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out}}}.ag-charts-shared-toolbar{gap:var(--toolbar-gap);.ag-charts-toolbar__button{border-radius:var(--ag-charts-border-radius);margin:0}} +`; + +// packages/ag-charts-enterprise/src/setup.ts +_ModuleSupport281.ModuleRegistry.registerMany(AllEnterpriseModules, VERSION); +function setupEnterpriseModules() { + _ModuleSupport281.moduleRegistry.register( + AngleCategoryAxisModule, + AngleNumberAxisModule, + AnimationModule, + AnnotationsModule, + BackgroundModule, + ForegroundModule, + BoxPlotModule, + CandlestickModule, + ChordModule, + ConeFunnelModule, + FunnelModule, + OhlcModule, + ChartToolbarModule, + ContextMenuModule, + CrosshairModule, + BandHighlightModule, + DataSourceModule, + ErrorBarsModule, + LinearGaugeModule, + MapLineModule, + MapLineBackgroundModule, + MapMarkerModule, + MapShapeModule, + MapShapeBackgroundModule, + NavigatorModule, + StatusBarModule, + GradientLegendModule, + HeatmapModule, + NightingaleModule, + OrdinalTimeAxisModule, + RadarAreaModule, + RadarLineModule, + RadialBarModule, + RadialColumnModule, + RadiusCategoryAxisModule, + RadialGaugeModule, + RadiusNumberAxisModule, + RangeBarModule, + RangeAreaModule, + RangesModule, + PyramidModule, + SankeyModule, + SharedToolbarModule, + SunburstModule, + SyncModule, + TreemapModule, + WaterfallModule, + ZoomModule + ); + _ModuleSupport281.enterpriseModule.isEnterprise = true; + _ModuleSupport281.enterpriseModule.styles = styles_default; + _ModuleSupport281.enterpriseModule.licenseManager = (options) => new LicenseManager( + options.container?.ownerDocument ?? (typeof document === "undefined" ? void 0 : document) + ); + _ModuleSupport281.enterpriseModule.injectWatermark = injectWatermark; +} + +// packages/ag-charts-enterprise/src/main.ts +export * from "ag-charts-community"; +setupEnterpriseModules(); +var LicenseManager2 = { + setLicenseKey(key) { + LicenseManager.setLicenseKey(key); + } +}; +function setupEnterpriseModules2() { + setupEnterpriseModules(); + setupCommunityModules(); +} +var AgChartsEnterpriseModule = { + VERSION: VERSION2, + _Scene, + _Theme, + _Util, + create: AgCharts.create.bind(AgCharts), + createSparkline: AgCharts.__createSparkline.bind(AgCharts), + setup: setupEnterpriseModules2, + setGridContext: LicenseManager.setGridContext.bind(LicenseManager), + setLicenseKey: LicenseManager.setLicenseKey.bind(LicenseManager), + isEnterprise: true +}; +export { + AgChartsEnterpriseModule, + LicenseManager2 as LicenseManager, + setupEnterpriseModules2 as setupEnterpriseModules +}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-category/angleCategoryAxis.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-category/angleCategoryAxis.d.ts new file mode 100644 index 000000000..36d6d549e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-category/angleCategoryAxis.d.ts @@ -0,0 +1,20 @@ +import { type FormatterParams, _ModuleSupport } from 'ag-charts-community'; +import { AngleAxisInterval } from '../angle-number/angleAxisInterval'; +import type { AngleAxisLabelDatum } from '../angle/angleAxis'; +import { AngleAxis } from '../angle/angleAxis'; +export declare class AngleCategoryAxis extends AngleAxis> { + static readonly className = "AngleCategoryAxis"; + static readonly type: "angle-category"; + groupPaddingInner: number; + paddingInner: number; + interval: AngleAxisInterval; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + hasDefinedDomain(): boolean; + protected generateAngleTicks(domain: string[]): { + value: any; + visible: boolean; + }[]; + protected avoidLabelCollisions(labelData: AngleAxisLabelDatum[]): void; + tickFormatParams(): _ModuleSupport.AxisTickFormatParams; + datumFormatParams(value: any, params: _ModuleSupport.FormatDatumParams): FormatterParams; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-category/angleCategoryAxisModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-category/angleCategoryAxisModule.d.ts new file mode 100644 index 000000000..e4e9e3556 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-category/angleCategoryAxisModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const AngleCategoryAxisModule: _ModuleSupport.AxisModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-category/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-category/main.d.ts new file mode 100644 index 000000000..0c349f24a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-category/main.d.ts @@ -0,0 +1 @@ +export { AngleCategoryAxisModule } from './angleCategoryAxisModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/angleAxisInterval.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/angleAxisInterval.d.ts new file mode 100644 index 000000000..3d668e913 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/angleAxisInterval.d.ts @@ -0,0 +1,6 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const AxisInterval: typeof _ModuleSupport.AxisInterval; +export declare class AngleAxisInterval extends AxisInterval { + minSpacing?: number; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/angleNumberAxis.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/angleNumberAxis.d.ts new file mode 100644 index 000000000..f50d880b9 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/angleNumberAxis.d.ts @@ -0,0 +1,28 @@ +import { type FormatterParams, _ModuleSupport } from 'ag-charts-community'; +import type { AngleAxisLabelDatum } from '../angle/angleAxis'; +import { AngleAxis } from '../angle/angleAxis'; +import { AngleAxisInterval } from './angleAxisInterval'; +import { LinearAngleScale } from './linearAngleScale'; +export declare class AngleNumberAxis extends AngleAxis { + static readonly className = "AngleNumberAxis"; + static readonly type: "angle-number"; + shape: "circle"; + min?: number; + max?: number; + interval: AngleAxisInterval; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + hasDefinedDomain(): boolean; + normaliseDataDomain(d: number[]): { + domain: number[]; + clipped: boolean; + }; + updateScale(): void; + protected getRangeArcLength(): number; + protected generateAngleTicks(domain: number[]): { + value: number; + visible: boolean; + }[]; + protected avoidLabelCollisions(labelData: AngleAxisLabelDatum[]): void; + tickFormatParams(_domain: number[], _ticks: number[], fractionDigits?: number): _ModuleSupport.AxisTickFormatParams; + datumFormatParams(value: any, params: _ModuleSupport.FormatDatumParams, fractionDigits?: number): FormatterParams; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/angleNumberAxisModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/angleNumberAxisModule.d.ts new file mode 100644 index 000000000..a8fbfa82e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/angleNumberAxisModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const AngleNumberAxisModule: _ModuleSupport.AxisModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/linearAngleScale.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/linearAngleScale.d.ts new file mode 100644 index 000000000..93512832c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/linearAngleScale.d.ts @@ -0,0 +1,17 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const LinearScale: typeof _ModuleSupport.LinearScale; +export declare class LinearAngleScale extends LinearScale { + static getNiceStepAndTickCount(ticks: _ModuleSupport.ScaleTickParams, domain: number[]): { + count: number; + step: number; + }; + arcLength: number; + ticks(ticks: _ModuleSupport.ScaleTickParams, domain?: number[]): { + ticks: number[]; + count: number; + }; + private hasNiceRange; + niceDomain(ticks: _ModuleSupport.ScaleTickParams, domain?: number[]): number[]; + protected getPixelRange(): number; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/main.d.ts new file mode 100644 index 000000000..519060535 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle-number/main.d.ts @@ -0,0 +1 @@ +export { AngleNumberAxisModule } from './angleNumberAxisModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle/angleAxis.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle/angleAxis.d.ts new file mode 100644 index 000000000..f2d222a5b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/angle/angleAxis.d.ts @@ -0,0 +1,92 @@ +import type { AgAngleAxisLabelOrientation, TextOrSegments } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +export interface AngleAxisLabelDatum { + text: TextOrSegments; + x: number; + y: number; + hidden: boolean; + rotation: number; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; + box: _ModuleSupport.BBox | undefined; +} +interface AngleAxisTickDatum { + value: TDatum; + visible: boolean; +} +declare class AngleAxisLabel extends _ModuleSupport.AxisLabel { + orientation: AgAngleAxisLabelOrientation; +} +export declare abstract class AngleAxis> extends _ModuleSupport.PolarAxis { + protected static CrossLineConstructor: new () => _ModuleSupport.CrossLine; + startAngle: number; + endAngle: number | undefined; + protected tickLineGroupSelection: _ModuleSupport.Selection<_ModuleSupport.Line, AngleAxisTickDatum>; + protected gridLineGroupSelection: _ModuleSupport.Selection<_ModuleSupport.Line, AngleAxisTickDatum>; + protected labelData: AngleAxisLabelDatum[]; + protected tickData: AngleAxisTickDatum[]; + protected radiusLineGroup: _ModuleSupport.TransformableGroup; + protected radiusLine: _ModuleSupport.Path; + constructor(moduleCtx: _ModuleSupport.ModuleContext, scale: TScale); + get direction(): _ModuleSupport.ChartAxisDirection; + protected createLabel(): AngleAxisLabel; + calculateRotations(): { + rotation: number; + parallelFlipRotation: number; + regularFlipRotation: number; + }; + calculateTickLayout(domain: TDomain[]): { + niceDomain: any[]; + tickDomain: TDomain[]; + ticks: TDomain[]; + rawTickCount: number | undefined; + fractionDigits: number; + timeInterval: undefined; + bbox: _ModuleSupport.BBox; + }; + update(): void; + private normalizedAngles; + computeRange(): void; + protected abstract generateAngleTicks(domain: TDomain[]): AngleAxisTickDatum[]; + protected updateSelections(): void; + updatePosition(): void; + protected updateRadiusLine(): void; + getAxisLinePoints(): { + points: ({ + x: number; + y: number; + moveTo: boolean; + radius?: undefined; + startAngle?: undefined; + endAngle?: undefined; + arc?: undefined; + } | { + x: number; + y: number; + radius: number; + startAngle: number; + endAngle: number; + arc: boolean; + moveTo: boolean; + })[]; + closePath: boolean; + }; + private updateGridLines; + protected updateLabels(): void; + private updateTickLines; + protected createLabelNodeData(ticks: any[], options: { + hideWhenNecessary: boolean; + }, seriesRect: _ModuleSupport.BBox): AngleAxisLabelDatum[]; + protected abstract avoidLabelCollisions(labelData: AngleAxisLabelDatum[]): void; + computeLabelsBBox(options: { + hideWhenNecessary: boolean; + }, seriesRect: _ModuleSupport.BBox): _ModuleSupport.BBox | null; + protected getLabelOrientation(): AgAngleAxisLabelOrientation; + protected getLabelRotation(tickAngle: number): number; + protected getLabelAlign(tickAngle: number): { + textAlign: "center" | "left" | "right"; + textBaseline: "bottom" | "middle" | "top"; + }; + protected updateCrossLines(): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/axisModules.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/axisModules.d.ts new file mode 100644 index 000000000..fd47c2bc7 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/axisModules.d.ts @@ -0,0 +1,7 @@ +import type { AxisModuleDefinition } from 'ag-charts-core'; +import type { AgAngleCategoryAxisOptions, AgAngleNumberAxisOptions, AgOrdinalTimeAxisOptions, AgRadiusCategoryAxisOptions, AgRadiusNumberAxisOptions } from 'ag-charts-types'; +export declare const OrdinalTimeAxisModule: AxisModuleDefinition; +export declare const AngleNumberAxisModule: AxisModuleDefinition; +export declare const AngleCategoryAxisModule: AxisModuleDefinition; +export declare const RadiusNumberAxisModule: AxisModuleDefinition; +export declare const RadiusCategoryAxisModule: AxisModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/ordinal/ordinalTimeAxis.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/ordinal/ordinalTimeAxis.d.ts new file mode 100644 index 000000000..7fa119f0b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/ordinal/ordinalTimeAxis.d.ts @@ -0,0 +1,12 @@ +import { type AgTimeInterval, type AgTimeIntervalUnit, type DateFormatterStyle, type FormatterParams, _ModuleSupport } from 'ag-charts-community'; +export declare class OrdinalTimeAxis extends _ModuleSupport.DiscreteTimeAxis<_ModuleSupport.OrdinalTimeScale> { + static readonly className: "OrdinalTimeAxis"; + static readonly type: "ordinal-time"; + readonly parentLevel: _ModuleSupport.TimeAxisParentLevel; + get primaryLabel(): _ModuleSupport.AxisLabel | undefined; + get primaryTick(): _ModuleSupport.AxisTick | undefined; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + processData(): void; + tickFormatParams(domain: (number | Date)[], ticks: (number | Date)[], _fractionDigits?: number, timeInterval?: AgTimeInterval | AgTimeIntervalUnit): _ModuleSupport.AxisTickFormatParams; + datumFormatParams(value: Date | number, params: _ModuleSupport.FormatDatumParams, _fractionDigits: number | undefined, timeInterval: AgTimeInterval | AgTimeIntervalUnit | undefined, style: DateFormatterStyle): FormatterParams; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/ordinal/ordinalTimeAxisModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/ordinal/ordinalTimeAxisModule.d.ts new file mode 100644 index 000000000..df513e34e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/ordinal/ordinalTimeAxisModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const OrdinalTimeAxisModule: _ModuleSupport.AxisModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/polar-crosslines/angleCrossLine.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/polar-crosslines/angleCrossLine.d.ts new file mode 100644 index 000000000..33c20553e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/polar-crosslines/angleCrossLine.d.ts @@ -0,0 +1,19 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { PolarCrossLine } from './polarCrossLine'; +export declare class AngleCrossLine extends PolarCrossLine { + static readonly className = "AngleCrossLine"; + direction: _ModuleSupport.ChartAxisDirection; + private readonly polygonNode; + private readonly sectorNode; + private readonly lineNode; + private readonly crossLineRange; + private readonly labelNode; + ticks: any[]; + constructor(); + visibilityCheck(): boolean; + update(visible: boolean): void; + private updateLineNode; + private updatePolygonNode; + private updateSectorNode; + private updateLabelNode; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/polar-crosslines/polarCrossLine.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/polar-crosslines/polarCrossLine.d.ts new file mode 100644 index 000000000..2c8da3b70 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/polar-crosslines/polarCrossLine.d.ts @@ -0,0 +1,54 @@ +import type { AgBaseCrossLineLabelOptions, FontStyle, FontWeight } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +export declare class PolarCrossLineLabel extends BaseProperties implements AgBaseCrossLineLabelOptions { + enabled?: boolean; + text?: string; + fontStyle?: FontStyle; + fontWeight?: FontWeight; + fontSize: number; + fontFamily: string; + /** + * The padding between the label and the line. + */ + padding: number; + /** + * The color of the labels. + */ + color?: string; + parallel?: boolean; +} +export declare abstract class PolarCrossLine extends BaseProperties implements _ModuleSupport.PolarCrossLine { + readonly id: string; + enabled?: boolean; + type: _ModuleSupport.CrossLineType; + range?: [unknown, unknown]; + value?: unknown; + defaultColorRange: string[]; + fill?: string; + fillOpacity?: number; + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + lineDash?: []; + shape: 'polygon' | 'circle'; + label: PolarCrossLineLabel; + scale?: _ModuleSupport.Scale; + clippedRange: [number, number]; + gridLength: number; + sideFlag: 1 | -1; + parallelFlipRotation: number; + regularFlipRotation: number; + direction: _ModuleSupport.ChartAxisDirection; + axisInnerRadius: number; + axisOuterRadius: number; + readonly lineGroup: _ModuleSupport.Group; + readonly rangeGroup: _ModuleSupport.Group; + readonly labelGroup: _ModuleSupport.Group; + private _isRange; + protected assignCrossLineGroup(isRange: boolean, crossLineRange: _ModuleSupport.Node): void; + abstract update(visible: boolean): void; + protected setSectorNodeProps(node: _ModuleSupport.Path | _ModuleSupport.Sector): void; + protected setLabelNodeProps(node: _ModuleSupport.RotatableText, x: number, y: number, baseline: CanvasTextBaseline, rotation: number): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/polar-crosslines/radiusCrossLine.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/polar-crosslines/radiusCrossLine.d.ts new file mode 100644 index 000000000..76f4aa61e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/polar-crosslines/radiusCrossLine.d.ts @@ -0,0 +1,26 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { PolarCrossLine, PolarCrossLineLabel } from './polarCrossLine'; +declare class RadiusCrossLineLabel extends PolarCrossLineLabel { + positionAngle?: number; +} +export declare class RadiusCrossLine extends PolarCrossLine { + static readonly className = "RadiusCrossLine"; + direction: _ModuleSupport.ChartAxisDirection; + gridAngles?: number[]; + label: RadiusCrossLineLabel; + private readonly polygonNode; + private readonly sectorNode; + private readonly crossLineRange; + private readonly labelNode; + private outerRadius; + private innerRadius; + constructor(); + update(visible: boolean): void; + private updateRadii; + private drawPolygon; + private updatePolygonNode; + private updateSectorNode; + private updateLabelNode; + private getPadding; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-category/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-category/main.d.ts new file mode 100644 index 000000000..8b5fa18f8 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-category/main.d.ts @@ -0,0 +1 @@ +export { RadiusCategoryAxisModule } from './radiusCategoryAxisModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-category/radiusCategoryAxis.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-category/radiusCategoryAxis.d.ts new file mode 100644 index 000000000..54a2f1300 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-category/radiusCategoryAxis.d.ts @@ -0,0 +1,20 @@ +import { type FormatterParams, _ModuleSupport } from 'ag-charts-community'; +import { RadiusAxis } from '../radius/radiusAxis'; +export declare class RadiusCategoryAxis extends RadiusAxis { + static readonly className = "RadiusCategoryAxis"; + static readonly type: "radius-category"; + shape: "circle"; + groupPaddingInner: number; + paddingInner: number; + paddingOuter: number; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + hasDefinedDomain(): boolean; + normaliseDataDomain(domain: Array): { + domain: (string | object)[]; + clipped: boolean; + }; + protected prepareGridPathTickData(data: _ModuleSupport.TickDatum[]): _ModuleSupport.TickDatum[]; + protected getTickRadius(tickDatum: _ModuleSupport.TickDatum): number; + tickFormatParams(): _ModuleSupport.AxisTickFormatParams; + datumFormatParams(value: any, params: _ModuleSupport.FormatDatumParams): FormatterParams; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-category/radiusCategoryAxisModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-category/radiusCategoryAxisModule.d.ts new file mode 100644 index 000000000..5fd20c7c7 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-category/radiusCategoryAxisModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const RadiusCategoryAxisModule: _ModuleSupport.AxisModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-number/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-number/main.d.ts new file mode 100644 index 000000000..c16feb1b6 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-number/main.d.ts @@ -0,0 +1 @@ +export { RadiusNumberAxisModule } from './radiusNumberAxisModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-number/radiusNumberAxis.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-number/radiusNumberAxis.d.ts new file mode 100644 index 000000000..0799b0d5d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-number/radiusNumberAxis.d.ts @@ -0,0 +1,26 @@ +import { type FormatterParams, type TextOrSegments, _ModuleSupport } from 'ag-charts-community'; +import { RadiusAxis } from '../radius/radiusAxis'; +interface TickDatum { + tick: any; + tickId: string; + tickLabel: TextOrSegments | undefined; + translation: number; +} +export declare class RadiusNumberAxis extends RadiusAxis { + static readonly className = "RadiusNumberAxis"; + static readonly type: "radius-number"; + shape: 'polygon' | 'circle'; + min?: number; + max?: number; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + hasDefinedDomain(): boolean; + protected prepareGridPathTickData(data: _ModuleSupport.TickDatum[]): _ModuleSupport.TickDatum[]; + protected getTickRadius(tickDatum: TickDatum): number; + normaliseDataDomain(d: number[]): { + domain: number[]; + clipped: boolean; + }; + tickFormatParams(_domain: number[], _ticks: number[], fractionDigits?: number): _ModuleSupport.AxisTickFormatParams; + datumFormatParams(value: any, params: _ModuleSupport.FormatDatumParams, fractionDigits?: number): FormatterParams; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-number/radiusNumberAxisModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-number/radiusNumberAxisModule.d.ts new file mode 100644 index 000000000..134161878 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius-number/radiusNumberAxisModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const RadiusNumberAxisModule: _ModuleSupport.AxisModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius/radiusAxis.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius/radiusAxis.d.ts new file mode 100644 index 000000000..c82903216 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/axes/radius/radiusAxis.d.ts @@ -0,0 +1,44 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare class RadiusAxisLabel extends _ModuleSupport.AxisLabel { + autoRotate?: boolean; + autoRotateAngle: number; +} +export declare abstract class RadiusAxis> = _ModuleSupport.Scale, D = any> extends _ModuleSupport.PolarAxis { + protected static CrossLineConstructor: new () => _ModuleSupport.CrossLine; + positionAngle: number; + protected gridLineGroupSelection: _ModuleSupport.Selection<_ModuleSupport.Line, _ModuleSupport.TickDatum>; + private generatedTicks; + protected readonly headingLabelGroup: _ModuleSupport.TransformableGroup; + protected readonly lineNodeGroup: _ModuleSupport.TransformableGroup; + protected readonly lineNode: _ModuleSupport.Line; + protected readonly gridPathGroup: _ModuleSupport.Group; + protected gridPathSelection: _ModuleSupport.Selection<_ModuleSupport.Path, any>; + get direction(): _ModuleSupport.ChartAxisDirection; + constructor(moduleCtx: _ModuleSupport.ModuleContext, scale: S); + private getAxisTransform; + update(): void; + updatePosition(): void; + calculateRotations(): { + rotation: number; + parallelFlipRotation: number; + regularFlipRotation: number; + }; + calculateTickLayout(domain: D[], niceMode: _ModuleSupport.NiceMode, _visibleRange: [number, number]): { + niceDomain: D[]; + tickDomain: D[]; + ticks: D[]; + rawTickCount: number | undefined; + fractionDigits: number; + timeInterval: undefined; + }; + protected abstract prepareGridPathTickData(tickData: _ModuleSupport.TickDatum[]): _ModuleSupport.TickDatum[]; + protected abstract getTickRadius(tickDatum: _ModuleSupport.TickDatum): number; + protected updateSelections(): void; + protected updateLabels(): void; + private updateGridLines; + private updateTitle; + protected updateCrossLines(): void; + protected createLabel(): RadiusAxisLabel; + private getTickLabelProps; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/standaloneChart.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/standaloneChart.d.ts new file mode 100644 index 000000000..75a246256 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/standaloneChart.d.ts @@ -0,0 +1,10 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const Chart: typeof _ModuleSupport.Chart; +export declare class StandaloneChart extends Chart { + static readonly className = "StandaloneChart"; + static readonly type: "standalone"; + getChartType(): "standalone"; + protected performLayout(ctx: _ModuleSupport.LayoutContext): void; + protected getAriaLabel(): string; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/standaloneChartModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/standaloneChartModule.d.ts new file mode 100644 index 000000000..0b15cefde --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/standaloneChartModule.d.ts @@ -0,0 +1,3 @@ +import { type AgStandaloneChartOptions } from 'ag-charts-community'; +import type { ChartModuleDefinition } from 'ag-charts-core'; +export declare const StandaloneChartModule: ChartModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/topologyChart.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/topologyChart.d.ts new file mode 100644 index 000000000..f71c1b6e9 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/topologyChart.d.ts @@ -0,0 +1,12 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const Chart: typeof _ModuleSupport.Chart; +export declare class TopologyChart extends Chart { + static readonly className = "TopologyChart"; + static readonly type: "topology"; + topology?: _ModuleSupport.FeatureCollection; + constructor(options: _ModuleSupport.ChartOptions, resources?: _ModuleSupport.TransferableResources); + getChartType(): "topology"; + updateData(): Promise; + protected performLayout(ctx: _ModuleSupport.LayoutContext): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/topologyChartModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/topologyChartModule.d.ts new file mode 100644 index 000000000..5d5eee07b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/charts/topologyChartModule.d.ts @@ -0,0 +1,3 @@ +import { type AgTopologyChartOptions } from 'ag-charts-community'; +import type { ChartModuleDefinition } from 'ag-charts-core'; +export declare const TopologyChartModule: ChartModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/components/color-picker/colorPicker.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/components/color-picker/colorPicker.d.ts new file mode 100644 index 000000000..544012739 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/components/color-picker/colorPicker.d.ts @@ -0,0 +1,18 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export interface ColorPickerOptions extends _ModuleSupport.AnchoredPopoverOptions { + color?: string; + opacity?: number; + isMultiColor?: boolean; + hasMultiColorOption: boolean; + sourceEvent: Event; + onChange?: (colorOpacity: string, color: string, opacity: number, isMultiColor: boolean) => void; + onChangeHide?: () => void; +} +export declare class ColorPicker extends _ModuleSupport.AnchoredPopover { + private hasChanged; + private onChangeHide?; + private i18nUpdater?; + constructor(ctx: _ModuleSupport.ModuleContext, options?: _ModuleSupport.PopoverConstructorOptions); + show(options: ColorPickerOptions): void; + private createColorPicker; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/components/dialog/dialog.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/components/dialog/dialog.d.ts new file mode 100644 index 000000000..1598d8898 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/components/dialog/dialog.d.ts @@ -0,0 +1,102 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type ElementID } from 'ag-charts-core'; +import type { AgIconName } from 'ag-charts-types'; +declare const DraggablePopover: typeof _ModuleSupport.DraggablePopover; +export interface DialogOptions extends _ModuleSupport.PopoverOptions { +} +interface RadioGroupOptions { + label: string; + options: Array<{ + icon: AgIconName; + altText: string; + value: T; + }>; + value: T; + onChange: (value: T) => void; +} +interface SelectOptions extends _ModuleSupport.SelectOptions { + altText: string; + label: string; +} +interface TextAreaOptions extends _ModuleSupport.TextAreaOptions { + placeholder: string; +} +interface CheckboxOptions extends _ModuleSupport.CheckboxOptions { + label: string; +} +interface ColorPickerOptions { + altText: string; + label: string; + color?: string; + opacity?: number; + isMultiColor?: boolean; + hasMultiColorOption: boolean; + onChange: (colorOpacity: string, color: string, opacity: number, isMultiColor: boolean) => void; + onChangeHide: () => void; +} +/** + * A popover that opens at a given position but can be moved by the user. By default, it opens at the bottom right or + * bottom middle of the chart on charts thinner or wider than 1000px respectively. It will reposition to be + * constrained within the boundaries of the chart. + * + * Dialogs may also contain tabs, inputs and nested color pickers. + */ +export declare abstract class Dialog extends DraggablePopover { + private static readonly offset; + dragHandleDraggingClass: string; + private readonly colorPicker; + private colorPickerAnchorElement?; + private seriesRect?; + constructor(ctx: _ModuleSupport.ModuleContext, id: string); + protected showWithChildren(children: Array, options: Options): HTMLElement; + protected updatePosition(position: _ModuleSupport.Vec2): void; + /************** + * Containers * + **************/ + protected createTabs void; + }>>(tablistLabel: string, initial: keyof T, tabs: T): { + tabs: HTMLDivElement & HTMLElement & { + id: ElementID; + }; + initialFocus: Record[keyof T]; + }; + protected createTabPanel(): HTMLDivElement & HTMLElement & { + id: ElementID; + }; + /********** + * Inputs * + **********/ + protected createInputGroupLine(): HTMLDivElement & HTMLElement & { + id: ElementID; + }; + protected createRadioGroup({ label, options, value, onChange }: RadioGroupOptions): HTMLDivElement & HTMLElement & { + id: ElementID; + }; + protected createSelect({ altText, label, options, value, onChange }: SelectOptions): HTMLDivElement & HTMLElement & { + id: ElementID; + }; + protected createTextArea({ placeholder, value, onChange }: TextAreaOptions): HTMLTextAreaElement & HTMLElement & { + id: ElementID; + }; + protected createCheckbox({ label, checked, onChange }: CheckboxOptions): HTMLDivElement & HTMLElement & { + id: ElementID; + }; + protected createColorPicker({ color, opacity, label, altText, onChange, onChangeHide, isMultiColor, hasMultiColorOption, }: ColorPickerOptions): HTMLDivElement & HTMLElement & { + id: ElementID; + }; + /*********** + * Private * + ***********/ + private createHeaderCloseButton; + private createInputGroup; + private onLayoutComplete; + private onKeyDown; + private reposition; + private getColorPickerAnchors; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/animation/animation.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/animation/animation.d.ts new file mode 100644 index 000000000..746aca260 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/animation/animation.d.ts @@ -0,0 +1,8 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare class Animation extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + protected readonly ctx: _ModuleSupport.ModuleContext; + enabled: boolean; + duration?: number; + maxAnimatableItems?: number; + constructor(ctx: _ModuleSupport.ModuleContext); +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/animation/animationModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/animation/animationModule.d.ts new file mode 100644 index 000000000..b9e3881d5 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/animation/animationModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const AnimationModule: _ModuleSupport.Module; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/animation/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/animation/main.d.ts new file mode 100644 index 000000000..e69b3091e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/animation/main.d.ts @@ -0,0 +1 @@ +export * from './animationModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationAxesButtons.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationAxesButtons.d.ts new file mode 100644 index 000000000..9c81df7fe --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationAxesButtons.d.ts @@ -0,0 +1,7 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +export declare class AxesButtons extends BaseProperties { + enabled: boolean; + axes?: 'x' | 'y' | 'xy'; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationDefaults.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationDefaults.d.ts new file mode 100644 index 000000000..921cb90a1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationDefaults.d.ts @@ -0,0 +1,45 @@ +import { type AgAnnotationLineStyleType, _ModuleSupport } from 'ag-charts-community'; +import { type AnnotationLineStyle, type AnnotationOptionsColorPickerType, AnnotationType, type ChannelTextPosition, type FibonacciAnnotationToolbarOptionsType, type FibonacciAnnotationType, type HasColorAnnotationType, type HasFontSizeAnnotationType, type HasLineStyleAnnotationType, type HasLineTextAnnotationType, type LineTextAlignment, type LineTextPosition } from './annotationTypes'; +import type { AnnotationProperties } from './annotationsSuperTypes'; +interface DefaultsMemento { + colors: DefaultColors; + fontSizes: DefaultFontSizes; + lineStyles: DefaultLineStyles; + lineTextAlignments: DefaultLineTextAlignments; + lineTextPositions: DefaultLineTextPositions; + fibonacciOptions: DefaultFibonacciOptions; +} +type DefaultColors = Map>; +type DefaultFontSizes = Map; +type DefaultLineStyles = Map; +type DefaultLineTextAlignments = Map; +type DefaultLineTextPositions = Map; +type DefaultFibonacciOptions = Map; +export declare class AnnotationDefaults implements _ModuleSupport.MementoOriginator { + mementoOriginatorKey: "annotation-defaults"; + private colors; + private fontSizes; + private lineStyles; + private lineTextAlignments; + private lineTextPositions; + private fibonacciOptions; + createMemento(): { + colors: DefaultColors; + fontSizes: DefaultFontSizes; + lineStyles: DefaultLineStyles; + lineTextAlignments: DefaultLineTextAlignments; + lineTextPositions: DefaultLineTextPositions; + fibonacciOptions: DefaultFibonacciOptions; + }; + guardMemento(_blob: unknown): _blob is DefaultsMemento; + restoreMemento(_version: string, _mementoVersion: string, blob: DefaultsMemento): void; + setDefaultColor(type: HasColorAnnotationType, colorType: AnnotationOptionsColorPickerType, colorOpacity: string, color: string, opacity: number, isMultiColor: boolean): void; + setDefaultFontSize(type: HasFontSizeAnnotationType, fontSize: number): void; + setDefaultLineStyleType(type: HasLineStyleAnnotationType, lineStyleType: AgAnnotationLineStyleType | undefined): void; + setDefaultLineStyleWidth(type: HasLineStyleAnnotationType, strokeWidth: number): void; + setDefaultLineTextAlignment(type: HasLineTextAnnotationType, alignment: LineTextAlignment): void; + setDefaultLineTextPosition(type: HasLineTextAnnotationType, position: LineTextPosition | ChannelTextPosition): void; + setDefaultFibonacciOptions(type: FibonacciAnnotationType | HasLineStyleAnnotationType, key: K, value: FibonacciAnnotationToolbarOptionsType[K]): void; + applyDefaults(datum: AnnotationProperties): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationOptionsDef.d.ts new file mode 100644 index 000000000..fb03c0a4e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationOptionsDef.d.ts @@ -0,0 +1,5 @@ +import { type AgInitialStateOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +import type { AgAnnotation } from 'ag-charts-types'; +export declare const annotationInitialStateOptionsDef: OptionsDefs; +export declare const initialStateOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationOptionsToolbar.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationOptionsToolbar.d.ts new file mode 100644 index 000000000..aefc1eb18 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationOptionsToolbar.d.ts @@ -0,0 +1,88 @@ +import { type AgAnnotationLineStyleType, _ModuleSupport } from 'ag-charts-community'; +import { EventEmitter } from 'ag-charts-core'; +import { type AnnotationOptionsColorPickerType, type HasColorAnnotationType, type HasFontSizeAnnotationType, type HasLineStyleAnnotationType } from './annotationTypes'; +import { AnnotationOptions } from './annotationsMenuOptions'; +import type { AnnotationProperties, AnnotationScene } from './annotationsSuperTypes'; +declare const ToolbarButtonProperties: typeof _ModuleSupport.ToolbarButtonProperties; +interface EventMap { + 'pressed-delete': null; + 'pressed-settings': { + sourceEvent: Event; + }; + 'pressed-lock': { + locked: boolean; + }; + 'hid-overlays': null; + 'saved-color': { + type: HasColorAnnotationType; + colorPickerType: AnnotationOptionsColorPickerType; + color: string | undefined; + }; + 'updated-color': { + type: HasColorAnnotationType; + colorPickerType: AnnotationOptionsColorPickerType; + colorOpacity: string; + color: string; + opacity: number; + isMultiColor: boolean; + }; + 'updated-font-size': { + type: HasFontSizeAnnotationType; + fontSize: number; + }; + 'updated-line-style': { + type: HasLineStyleAnnotationType; + lineStyleType: AgAnnotationLineStyleType; + }; + 'updated-line-width': { + type: HasLineStyleAnnotationType; + strokeWidth: number; + }; +} +declare class AnnotationOptionsButtonProperties extends ToolbarButtonProperties { + value: AnnotationOptions; + checkedOverrides: _ModuleSupport.ToolbarButtonProperties; + color?: string; + strokeWidth?: number; + isMultiColor?: boolean; +} +export declare class AnnotationOptionsToolbar extends _ModuleSupport.BaseProperties { + private readonly ctx; + private readonly getActiveDatum; + enabled?: boolean; + buttons: _ModuleSupport.PropertiesArray; + private readonly cleanup; + readonly events: EventEmitter; + private visibleButtons; + private readonly toolbar; + private readonly colorPicker; + private readonly textSizeMenu; + private readonly lineStyleTypeMenu; + private readonly lineStrokeWidthMenu; + constructor(ctx: _ModuleSupport.ModuleContext, getActiveDatum: () => AnnotationProperties | undefined); + private onDragStart; + private onDragEnd; + destroy(): void; + show(): void; + hide(): void; + updateButtons(datum: AnnotationProperties): void; + setAnchorScene(scene: AnnotationScene): void; + hideOverlays(): void; + clearActiveButton(): void; + private updateColors; + updateColorPickerColor(colorPickerType: AnnotationOptionsColorPickerType, color?: string, opacity?: number, isMultiColor?: boolean): void; + private updateFontSize; + updateLineStyleType(item: _ModuleSupport.MenuItem): void; + updateStrokeWidth(item: _ModuleSupport.MenuItem): void; + private onButtonPress; + private onToolbarMoved; + private onColorPickerChange; + private onTextSizeMenuPress; + private onLineStyleTypeMenuPress; + private onLineStrokeWidthMenuPress; + private refreshButtons; + private updateLineStyles; + private updateButtonByValue; + private updateButtonByIndex; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationProperties.d.ts new file mode 100644 index 000000000..cc7d6ebab --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationProperties.d.ts @@ -0,0 +1,248 @@ +import type { AgAnnotationLineStyleType, FontStyle, FontWeight, Formatter, TextAlign } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationOptionsColorPickerType, ChannelTextPosition, Constructor, LineTextAlignment, LineTextPosition } from './annotationTypes'; +import type { PointType } from './utils/scale'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +/************** + * Components * + **************/ +export declare class PointProperties extends BaseProperties { + x?: PointType; + y?: PointType; +} +declare const ChannelAnnotationMiddleProperties_base: { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & { + new (...args: any[]): { + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: AgAnnotationLineStyleType | undefined; + }; +} & { + new (...args: any[]): { + visible?: boolean | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class ChannelAnnotationMiddleProperties extends ChannelAnnotationMiddleProperties_base { +} +declare const AxisLabelProperties_base: { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & { + new (...args: any[]): { + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: AgAnnotationLineStyleType | undefined; + }; +} & { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & { + new (...args: any[]): { + padding?: number | undefined; + textAlign: TextAlign; + formatter?: Formatter | undefined; + }; +} & { + new (...args: any[]): { + fontStyle?: FontStyle | undefined; + fontWeight?: FontWeight | undefined; + fontSize: number; + fontFamily: string; + color?: string | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class AxisLabelProperties extends AxisLabelProperties_base { + enabled?: boolean; + cornerRadius: number; +} +declare const BackgroundProperties_base: { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +declare class BackgroundProperties extends BackgroundProperties_base { +} +declare const HandleProperties_base: { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & { + new (...args: any[]): { + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: AgAnnotationLineStyleType | undefined; + }; +} & { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +declare class HandleProperties extends HandleProperties_base { +} +declare const LineTextProperties_base: { + new (...args: any[]): { + fontStyle?: FontStyle | undefined; + fontWeight?: FontWeight | undefined; + fontSize: number; + fontFamily: string; + color?: string | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class LineTextProperties extends LineTextProperties_base { + label: string; + position?: LineTextPosition; + alignment?: LineTextAlignment; +} +declare const LabelTextProperties_base: { + new (...args: any[]): { + fontStyle?: FontStyle | undefined; + fontWeight?: FontWeight | undefined; + fontSize: number; + fontFamily: string; + color?: string | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class LabelTextProperties extends LabelTextProperties_base { +} +declare const ChannelTextProperties_base: { + new (...args: any[]): { + fontStyle?: FontStyle | undefined; + fontWeight?: FontWeight | undefined; + fontSize: number; + fontFamily: string; + color?: string | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class ChannelTextProperties extends ChannelTextProperties_base { + label: string; + position?: ChannelTextPosition; + alignment?: LineTextAlignment; +} +export interface AxisLabelFormatterParams { + readonly value: any; +} +/******************************* + * Annotations specific mixins * + *******************************/ +export declare function Annotation>(Parent: U): (abstract new (...args: any[]) => { + id: string; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType, isMultiColor?: boolean): string | undefined; + locked?: boolean | undefined; + readOnly?: boolean | undefined; + isWriteable(): boolean; + isHoverable(): boolean; + visible?: boolean | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; +}) & U; +export declare function Line(Parent: T): { + new (...args: any[]): { + start: PointProperties; + end: PointProperties; + }; +} & T; +export declare function Point(Parent: T): { + new (...args: any[]): { + x?: PointType; + y?: PointType; + }; +} & T; +export declare function Value(Parent: T): { + new (...args: any[]): { + value?: PointType; + }; +} & T; +export declare function Background(Parent: T): { + new (...args: any[]): { + background: BackgroundProperties; + }; +} & T; +export declare function Handle(Parent: T): { + new (...args: any[]): { + handle: HandleProperties; + }; +} & T; +export declare function AxisLabel(Parent: T): { + new (...args: any[]): { + axisLabel: AxisLabelProperties; + }; +} & T; +export declare function Label(Parent: T): { + new (...args: any[]): { + padding?: number | undefined; + textAlign: TextAlign; + formatter?: Formatter | undefined; + }; +} & T; +export declare function Cappable(Parent: T): { + new (...args: any[]): { + startCap?: "arrow" | undefined; + endCap?: "arrow" | undefined; + }; +} & T; +export declare function Extendable(Parent: T): { + new (...args: any[]): { + extendStart?: boolean | undefined; + extendEnd?: boolean | undefined; + }; +} & T; +export declare function Localisable(Parent: T): { + new (...args: any[]): { + localeManager?: import("packages/ag-charts-community/dist/types/src/locale/localeManager").LocaleManager | undefined; + setLocaleManager(localeManager: _ModuleSupport.ModuleContext['localeManager']): void; + }; +} & T; +export declare function Fill(Parent: T): { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & T; +export declare function Stroke(Parent: T): { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & T; +export declare function LineStyle(Parent: T): { + new (...args: any[]): { + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: AgAnnotationLineStyleType | undefined; + }; +} & T; +export declare function Font(Parent: T): { + new (...args: any[]): { + fontStyle?: FontStyle | undefined; + fontWeight?: FontWeight | undefined; + fontSize: number; + fontFamily: string; + color?: string | undefined; + }; +} & T; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationTypes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationTypes.d.ts new file mode 100644 index 000000000..6e01869fa --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationTypes.d.ts @@ -0,0 +1,75 @@ +import type { AgAnnotationLineStyleType, _ModuleSupport } from 'ag-charts-community'; +import type { PointType } from './utils/scale'; +export type Constructor = new (...args: any[]) => T; +export declare enum AnnotationType { + Line = "line", + HorizontalLine = "horizontal-line", + VerticalLine = "vertical-line", + DisjointChannel = "disjoint-channel", + ParallelChannel = "parallel-channel", + FibonacciRetracement = "fibonacci-retracement", + FibonacciRetracementTrendBased = "fibonacci-retracement-trend-based", + Callout = "callout", + Comment = "comment", + Note = "note", + Text = "text", + Arrow = "arrow", + ArrowUp = "arrow-up", + ArrowDown = "arrow-down", + DateRange = "date-range", + PriceRange = "price-range", + DatePriceRange = "date-price-range", + QuickDatePriceRange = "quick-date-price-range" +} +type TextualAnnotationType = AnnotationType.Callout | AnnotationType.Comment | AnnotationType.Note | AnnotationType.Text; +type LineAnnotationType = AnnotationType.Line | AnnotationType.HorizontalLine | AnnotationType.VerticalLine | AnnotationType.Arrow; +type ChannelAnnotationType = AnnotationType.DisjointChannel | AnnotationType.ParallelChannel; +type MeasurerAnnotationType = AnnotationType.DateRange | AnnotationType.PriceRange | AnnotationType.DatePriceRange | AnnotationType.QuickDatePriceRange; +type EphemeralAnnotationType = AnnotationType.QuickDatePriceRange; +export type FibonacciAnnotationType = AnnotationType.FibonacciRetracement | AnnotationType.FibonacciRetracementTrendBased; +export type HasColorAnnotationType = AnnotationType; +export type HasLineStyleAnnotationType = Exclude; +export type HasLineTextAnnotationType = Exclude; +export type HasFontSizeAnnotationType = Exclude | LineAnnotationType | ChannelAnnotationType | MeasurerAnnotationType, EphemeralAnnotationType>; +export declare function stringToAnnotationType(value: unknown): AnnotationType | undefined; +export interface Bounds { + x: number; + y: number; + width: number; + height: number; +} +export interface Point { + x?: PointType; + y?: PointType; +} +export interface Padding { + top: number; + right: number; + bottom: number; + left: number; +} +export type FibonacciBands = 10 | 6 | 4; +export interface AnnotationAxisContext extends Pick<_ModuleSupport.AxisContext, 'continuous' | 'direction' | 'position' | 'scale' | 'scaleInvert' | 'scaleInvertNearest' | 'formatScaleValue' | 'attachLabel' | 'inRange' | 'getRangeOverflow'> { + bounds: _ModuleSupport.BBox; + labelPadding: number; + snapToGroup: boolean; +} +export type AnnotationContext = { + seriesRect: _ModuleSupport.BBox; + xAxis: AnnotationAxisContext; + yAxis: AnnotationAxisContext; +}; +export type AnnotationOptionsColorPickerType = 'line-color' | 'fill-color' | 'text-color'; +export type FibonacciAnnotationToolbarOptionsType = { + bands?: FibonacciBands; + reverse?: boolean; + showFill?: boolean; +}; +export type AnnotationLineStyle = { + type?: AgAnnotationLineStyleType; + strokeWidth?: number; +}; +export type LineTextAlignment = 'left' | 'center' | 'right'; +export type LineTextPosition = 'top' | 'center' | 'bottom'; +export type ChannelTextPosition = 'top' | 'inside' | 'bottom'; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotations.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotations.d.ts new file mode 100644 index 000000000..cf34b8211 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotations.d.ts @@ -0,0 +1,93 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { AxesButtons } from './annotationAxesButtons'; +import { AnnotationOptionsToolbar } from './annotationOptionsToolbar'; +import { AnnotationsToolbar } from './annotationsToolbar'; +export declare class Annotations extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + private readonly ctx; + enabled: boolean; + readonly toolbar: AnnotationsToolbar; + optionsToolbar: AnnotationOptionsToolbar; + axesButtons: AxesButtons; + snap: boolean; + data?: any[]; + xKey?: string; + volumeKey?: string; + private readonly state; + private readonly annotationData; + private readonly defaults; + private dataModel?; + private processedData?; + private seriesRect?; + private readonly container; + private readonly annotations; + private readonly settingsDialog; + private readonly textInput; + private xAxis?; + private yAxis?; + private postUpdateFns; + constructor(ctx: _ModuleSupport.ModuleContext); + private setupStateMachine; + private setupListeners; + private setupDOM; + processData(dataController: _ModuleSupport.DataController): Promise; + /** + * Create an annotation scene within the `this.annotations` scene selection. This method is automatically called by + * the selection when a new scene is required. + */ + private createAnnotationScene; + /** + * Create an annotation datum within the `this.annotationData` properties array. It is created as an instance + * of `AnnotationProperties` from the given config for its type. This method is only called when annotations + * are added from the initial state. + */ + private static createAnnotationDatum; + /** + * Append an annotation datum to `this.annotationData`, applying default styles. This method is called when a user + * interacts with the chart to draw their own annotations. + */ + private createAnnotation; + private injectDatumDependencies; + private getDatumRangeVolume; + private translateNode; + private createAnnotationDatumCopy; + private getAnnotationConfig; + private onRestoreAnnotations; + private onLayoutComplete; + private showAnnotations; + private animateAnnotations; + private onPreRender; + private getAxis; + private recordActionAfterNextUpdate; + private setColorAndDefault; + private setFontSizeAndDefault; + private setLineStyleTypeAndDefault; + private setLineStyleWidthAndDefault; + private updateAnnotations; + private getAnnotationContext; + private onHover; + private onClick; + private onDoubleClick; + private onAxisButtonClick; + private onResize; + private hoverTouchPreHandler; + private dragMoveTouchPreHandler; + private onDragStart; + private onDrag; + private onDragEnd; + private onCancel; + private onDelete; + private onTextInput; + private onKeyDown; + private onKeyUp; + private clear; + private reset; + private cancel; + private delete; + private deleteAll; + private deleteEphemeralAnnotations; + private hideOverlays; + private pushAnnotationState; + private popAnnotationState; + private isAnnotationState; + private update; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsConfig.d.ts new file mode 100644 index 000000000..8b4f83305 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsConfig.d.ts @@ -0,0 +1,4 @@ +export declare const annotationConfigs: { + [x: string]: import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig | import("./annotationsSuperTypes").AnnotationTypeConfig; +}; +export declare function getTypedDatum(datum: unknown): import("./arrow-down/arrowDownProperties").ArrowDownProperties | import("./arrow-up/arrowUpProperties").ArrowUpProperties | import("./callout/calloutProperties").CalloutProperties | import("./comment/commentProperties").CommentProperties | import("./cross-line/crossLineProperties").HorizontalLineProperties | import("./cross-line/crossLineProperties").VerticalLineProperties | import("./disjoint-channel/disjointChannelProperties").DisjointChannelProperties | import("./line/lineProperties").ArrowProperties | import("./line/lineProperties").LineProperties | import("./fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedProperties").FibonacciRetracementTrendBasedProperties | import("./fibonacci-retracement/fibonacciRetracementProperties").FibonacciRetracementProperties | import("./measurer/measurerProperties").DateRangeProperties | import("./measurer/measurerProperties").PriceRangeProperties | import("./measurer/measurerProperties").DatePriceRangeProperties | import("./measurer/measurerProperties").QuickDatePriceRangeProperties | import("./note/noteProperties").NoteProperties | import("./parallel-channel/parallelChannelProperties").ParallelChannelProperties | import("./text/textProperties").TextProperties | undefined; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsMenuOptions.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsMenuOptions.d.ts new file mode 100644 index 000000000..2faeeb15d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsMenuOptions.d.ts @@ -0,0 +1,24 @@ +import { type AgAnnotationLineStyleType, _ModuleSupport } from 'ag-charts-community'; +import { AnnotationType } from './annotationTypes'; +export declare enum AnnotationOptions { + Delete = "delete", + LineStrokeWidth = "line-stroke-width", + LineStyleType = "line-style-type", + LineColor = "line-color", + FillColor = "fill-color", + Lock = "lock", + TextColor = "text-color", + TextSize = "text-size", + Settings = "settings" +} +export declare const LINE_ANNOTATION_ITEMS: (_ModuleSupport.MenuItem & { + visible?: (axisScale: _ModuleSupport.Scale) => boolean; +})[]; +export declare const FIBONACCI_ANNOTATION_ITEMS: _ModuleSupport.MenuItem[]; +export declare const FIBONACCI_RATIO_ITEMS: _ModuleSupport.MenuItem[]; +export declare const TEXT_ANNOTATION_ITEMS: _ModuleSupport.MenuItem[]; +export declare const SHAPE_ANNOTATION_ITEMS: _ModuleSupport.MenuItem[]; +export declare const MEASURER_ANNOTATION_ITEMS: _ModuleSupport.MenuItem[]; +export declare const LINE_STROKE_WIDTH_ITEMS: _ModuleSupport.MenuItem[]; +export declare const LINE_STYLE_TYPE_ITEMS: _ModuleSupport.MenuItem[]; +export declare const TEXT_SIZE_ITEMS: _ModuleSupport.MenuItem[]; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsModule.d.ts new file mode 100644 index 000000000..6dd651f65 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const AnnotationsModule: _ModuleSupport.Module; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsStateMachine.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsStateMachine.d.ts new file mode 100644 index 000000000..bf2a72873 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsStateMachine.d.ts @@ -0,0 +1,29 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationProperties, AnnotationScene, AnnotationsStateMachineContext } from './annotationsSuperTypes'; +import type { AnnotationStateEvents } from './states/stateTypes'; +declare const ParallelStateMachine: typeof _ModuleSupport.ParallelStateMachine; +declare enum States { + Idle = "idle", + Dragging = "dragging", + Translating = "translating", + TextInput = "text-input" +} +/** + * - AnnotationsStateMachine (runs children in parallel, distributes properties across children) + * - SnappingStateMachine (changes `snapping` property with shift key) + * - UpdateStateMachine (ensures the active `node` is set after renders) + * - AnnotationsMainStateMachine + * - Idle (most interactions, with child machine per annotation type for creating annotations) + * - Dragging (entered on `dragStart`, dragging interactions with child machine per annotation type) + * - TextInput (entered on `click` of active text node, text input interactions) + */ +export declare class AnnotationsStateMachine extends ParallelStateMachine { + private active?; + protected snapping: boolean; + protected datum?: AnnotationProperties; + protected node?: AnnotationScene; + constructor(ctx: AnnotationsStateMachineContext); + getActive(): number | undefined; + isActive(index: number): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsSuperTypes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsSuperTypes.d.ts new file mode 100644 index 000000000..e6a9efbd4 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsSuperTypes.d.ts @@ -0,0 +1,89 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext, AnnotationType, Constructor, Point } from './annotationTypes'; +import type { ArrowDownProperties } from './arrow-down/arrowDownProperties'; +import type { ArrowDownScene } from './arrow-down/arrowDownScene'; +import type { ArrowUpProperties } from './arrow-up/arrowUpProperties'; +import type { ArrowUpScene } from './arrow-up/arrowUpScene'; +import type { CalloutProperties } from './callout/calloutProperties'; +import type { CalloutScene } from './callout/calloutScene'; +import type { CommentProperties } from './comment/commentProperties'; +import type { CommentScene } from './comment/commentScene'; +import type { HorizontalLineProperties, VerticalLineProperties } from './cross-line/crossLineProperties'; +import type { CrossLineScene } from './cross-line/crossLineScene'; +import type { DisjointChannelProperties } from './disjoint-channel/disjointChannelProperties'; +import type { DisjointChannelScene } from './disjoint-channel/disjointChannelScene'; +import type { FibonacciRetracementTrendBasedProperties } from './fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedProperties'; +import type { FibonacciRetracementTrendBasedScene } from './fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedScene'; +import type { FibonacciRetracementProperties } from './fibonacci-retracement/fibonacciRetracementProperties'; +import type { FibonacciRetracementScene } from './fibonacci-retracement/fibonacciRetracementScene'; +import type { ArrowProperties, LineProperties } from './line/lineProperties'; +import type { LineScene } from './line/lineScene'; +import type { DatePriceRangeProperties, DateRangeProperties, PriceRangeProperties, QuickDatePriceRangeProperties } from './measurer/measurerProperties'; +import type { MeasurerScene } from './measurer/measurerScene'; +import type { NoteProperties } from './note/noteProperties'; +import type { NoteScene } from './note/noteScene'; +import type { ParallelChannelProperties } from './parallel-channel/parallelChannelProperties'; +import type { ParallelChannelScene } from './parallel-channel/parallelChannelScene'; +import type { AnnotationScene as AnnotationSceneNode } from './scenes/annotationScene'; +import type { TextProperties } from './text/textProperties'; +import type { TextScene } from './text/textScene'; +type ShapePropertiesType = ArrowUpProperties | ArrowDownProperties; +export type TextualPropertiesType = CalloutProperties | CommentProperties | NoteProperties | TextProperties; +export type LinePropertiesType = LineProperties | HorizontalLineProperties | VerticalLineProperties | ArrowProperties; +export type FibonacciPropertiesType = FibonacciRetracementProperties | FibonacciRetracementTrendBasedProperties; +export type ChannelPropertiesType = ParallelChannelProperties | DisjointChannelProperties; +export type MeasurerPropertiesType = DateRangeProperties | PriceRangeProperties | DatePriceRangeProperties | QuickDatePriceRangeProperties; +export type AnnotationProperties = LinePropertiesType | ChannelPropertiesType | FibonacciPropertiesType | TextualPropertiesType | ShapePropertiesType | MeasurerPropertiesType; +export type EphemeralPropertiesType = QuickDatePriceRangeProperties; +export type AnnotationScene = LineScene | CrossLineScene | ParallelChannelScene | DisjointChannelScene | FibonacciRetracementScene | FibonacciRetracementTrendBasedScene | ArrowUpScene | ArrowDownScene | CalloutScene | CommentScene | NoteScene | TextScene | MeasurerScene; +export interface AnnotationsStateMachineContext { + resetToIdle: () => void; + hoverAtCoords: (coords: _ModuleSupport.Vec2, active?: number, hovered?: number) => number | undefined; + getNodeAtCoords: (coords: _ModuleSupport.Vec2, active: number) => string | undefined; + select: (index?: number, previous?: number) => void; + selectLast: () => number; + startInteracting: () => void; + stopInteracting: () => void; + translate: (index: number, translation: _ModuleSupport.Vec2) => void; + copy: (index: number) => AnnotationProperties | undefined; + paste: (datum: AnnotationProperties) => void; + create: (type: AnnotationType, datum: AnnotationProperties) => void; + delete: (index: number) => void; + deleteAll: () => void; + validatePoint: (point: Point, options?: { + overflowContinuous: boolean; + }) => boolean; + getAnnotationType: (index: number) => AnnotationType | undefined; + datum: (index: number) => AnnotationProperties | undefined; + node: (index: number) => AnnotationScene | undefined; + showTextInput: (index: number) => void; + hideTextInput: () => void; + updateTextInputColor: (color: string) => void; + updateTextInputFontSize: (fontSize: number) => void; + updateTextInputBBox: (bbox?: _ModuleSupport.BBox) => void; + showAnnotationOptions: (index: number) => void; + showAnnotationSettings: (index: number, sourceEvent?: Event, initialTab?: 'line' | 'text') => void; + recordAction: (label: string) => void; + update: () => void; +} +export interface AnnotationTypeConfig { + type: AnnotationType; + isDatum: (value: unknown) => value is Datum; + datum: Constructor; + scene: Constructor; + update: (node: AnnotationSceneNode, datum: _ModuleSupport.BaseProperties, context: AnnotationContext) => void; + translate: (node: AnnotationSceneNode, datum: _ModuleSupport.BaseProperties, translation: _ModuleSupport.Vec2, context: AnnotationContext) => void; + copy: (node: AnnotationSceneNode, datum: _ModuleSupport.BaseProperties, copiedDatum: _ModuleSupport.BaseProperties, context: AnnotationContext) => Datum | undefined; + createState: (ctx: AnnotationsCreateStateMachineContext, helpers: AnnotationsStateMachineHelperFns) => _ModuleSupport.StateMachine; + dragState: (ctx: AnnotationsStateMachineContext, helpers: AnnotationsStateMachineHelperFns) => _ModuleSupport.StateMachine; +} +export interface AnnotationsStateMachineHelperFns { + createDatum: (type: AnnotationType) => (datum: T) => void; +} +export type AnnotationsCreateStateMachineContext = AnnotationsStateMachineContext & { + delete: () => void; + deselect: () => void; + showAnnotationOptions: () => void; + showTextInput: () => void; +}; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsTheme.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsTheme.d.ts new file mode 100644 index 000000000..d6cab4cb1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsTheme.d.ts @@ -0,0 +1,2 @@ +import { type AgAnnotationsThemeableOptions, type WithThemeParams } from 'ag-charts-community'; +export declare const annotationsTheme: WithThemeParams; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsToolbar.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsToolbar.d.ts new file mode 100644 index 000000000..8a2d7e349 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/annotationsToolbar.d.ts @@ -0,0 +1,44 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { EventEmitter } from 'ag-charts-core'; +import { type AnnotationType } from './annotationTypes'; +declare const ToolbarButtonProperties: typeof _ModuleSupport.ToolbarButtonProperties; +interface EventMap { + 'cancel-create-annotation': null; + 'pressed-create-annotation': { + annotation: AnnotationType; + }; + 'pressed-clear': null; + 'pressed-show-menu': null; + 'pressed-unrelated': null; +} +type AnnotationsToolbarButtonValue = 'line-menu' | 'fibonacci-menu' | 'text-menu' | 'shape-menu' | 'measurer-menu' | 'clear'; +declare class AnnotationsToolbarButtonProperties extends ToolbarButtonProperties { + value: AnnotationsToolbarButtonValue; +} +export declare class AnnotationsToolbar extends _ModuleSupport.BaseProperties { + private readonly ctx; + enabled?: boolean; + /** + * The padding between the toolbar and the chart area. + */ + padding: number; + buttons: _ModuleSupport.PropertiesArray; + readonly events: EventEmitter; + private readonly toolbar; + private readonly annotationMenu; + private readonly cleanup; + constructor(ctx: _ModuleSupport.ModuleContext); + destroy(): void; + toggleClearButtonEnabled(enabled: boolean): void; + resetButtonIcons(): void; + hideOverlays(): void; + clearActiveButton(): void; + private onLayoutStart; + refreshButtonsEnabled(enabled: boolean): void; + private onToolbarButtonPress; + private onToolbarButtonPressShowMenu; + private onButtonPressMenuCreateAnnotation; + private onKeyDown; + private updateButtonByIndex; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownConfig.d.ts new file mode 100644 index 000000000..eabe6ef1e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownConfig.d.ts @@ -0,0 +1,4 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { ArrowDownProperties } from './arrowDownProperties'; +import { ArrowDownScene } from './arrowDownScene'; +export declare const arrowDownConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownProperties.d.ts new file mode 100644 index 000000000..e8fa43c0b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownProperties.d.ts @@ -0,0 +1,6 @@ +import { AnnotationType } from '../annotationTypes'; +import { ShapePointProperties } from '../properties/shapePointProperties'; +export declare class ArrowDownProperties extends ShapePointProperties { + static is(this: void, value: unknown): value is ArrowDownProperties; + type: AnnotationType.ArrowDown; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownScene.d.ts new file mode 100644 index 000000000..a5e8c8c34 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownScene.d.ts @@ -0,0 +1,17 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type AnnotationContext, AnnotationType } from '../annotationTypes'; +import { AnnotationShape } from '../scenes/annotationShape'; +import { ShapePointScene } from '../scenes/shapePointScene'; +import type { ArrowDownProperties } from './arrowDownProperties'; +export declare class ArrowDownScene extends ShapePointScene { + static is(value: unknown): value is ArrowDownScene; + type: AnnotationType; + protected readonly shape: AnnotationShape; + constructor(); + updateAnchor(datum: ArrowDownProperties, point: _ModuleSupport.Vec2, context: AnnotationContext): { + x: number; + y: number; + position: "right" | "above" | "above-left" | "below" | undefined; + }; + protected getHandleCoords(datum: ArrowDownProperties, point: _ModuleSupport.Vec2): _ModuleSupport.Vec2; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownState.d.ts new file mode 100644 index 000000000..f3370fa99 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-down/arrowDownState.d.ts @@ -0,0 +1,6 @@ +import { PointStateMachine } from '../states/pointState'; +import { ArrowDownProperties } from './arrowDownProperties'; +import type { ArrowDownScene } from './arrowDownScene'; +export declare class ArrowDownStateMachine extends PointStateMachine { + protected createDatum(): ArrowDownProperties; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpConfig.d.ts new file mode 100644 index 000000000..3a7a9b397 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpConfig.d.ts @@ -0,0 +1,4 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { ArrowUpProperties } from './arrowUpProperties'; +import { ArrowUpScene } from './arrowUpScene'; +export declare const arrowUpConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpProperties.d.ts new file mode 100644 index 000000000..a5cbb8a10 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpProperties.d.ts @@ -0,0 +1,6 @@ +import { AnnotationType } from '../annotationTypes'; +import { ShapePointProperties } from '../properties/shapePointProperties'; +export declare class ArrowUpProperties extends ShapePointProperties { + static is(this: void, value: unknown): value is ArrowUpProperties; + type: AnnotationType.ArrowUp; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpScene.d.ts new file mode 100644 index 000000000..a6e4084bd --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpScene.d.ts @@ -0,0 +1,13 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { AnnotationType } from '../annotationTypes'; +import { AnnotationShape } from '../scenes/annotationShape'; +import { ShapePointScene } from '../scenes/shapePointScene'; +import type { ArrowUpProperties } from './arrowUpProperties'; +export declare const arrowUpPoints: Array<[number, number]>; +export declare class ArrowUpScene extends ShapePointScene { + static is(value: unknown): value is ArrowUpScene; + type: AnnotationType; + protected readonly shape: AnnotationShape; + constructor(); + protected getHandleCoords(datum: ArrowUpProperties, point: _ModuleSupport.Vec2): _ModuleSupport.Vec2; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpState.d.ts new file mode 100644 index 000000000..1f18c70e6 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/arrow-up/arrowUpState.d.ts @@ -0,0 +1,6 @@ +import { PointStateMachine } from '../states/pointState'; +import { ArrowUpProperties } from './arrowUpProperties'; +import type { ArrowUpScene } from './arrowUpScene'; +export declare class ArrowUpStateMachine extends PointStateMachine { + protected createDatum(): ArrowUpProperties; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/axisButton.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/axisButton.d.ts new file mode 100644 index 000000000..0b3ccdbe2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/axisButton.d.ts @@ -0,0 +1,33 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const BaseModuleInstance: typeof _ModuleSupport.BaseModuleInstance; +export declare const DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS = "ag-charts-annotations__axis-button"; +export declare class AxisButton extends BaseModuleInstance implements _ModuleSupport.ModuleInstance { + private readonly ctx; + private readonly axisCtx; + private readonly onButtonClick; + private seriesRect; + enabled: boolean; + private readonly button; + private readonly snap; + private padding; + private coords?; + constructor(ctx: _ModuleSupport.ModuleContext, axisCtx: _ModuleSupport.AxisContext & { + snapToGroup: boolean; + }, onButtonClick: (coords?: _ModuleSupport.Vec2) => void, seriesRect: _ModuleSupport.BBox); + update(seriesRect: _ModuleSupport.BBox, padding: number): void; + private setup; + private destroyElements; + private onMouseMove; + private onMouseDrag; + private onMouseLeave; + private onClick; + private show; + private hide; + private onKeyPress; + private getButtonCoordinates; + private toggleVisibility; + private toggleClass; + private updatePosition; + private updateButtonElement; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutConfig.d.ts new file mode 100644 index 000000000..b65859d1b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutConfig.d.ts @@ -0,0 +1,4 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { CalloutProperties } from './calloutProperties'; +import { CalloutScene } from './calloutScene'; +export declare const calloutConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutProperties.d.ts new file mode 100644 index 000000000..d68a97186 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutProperties.d.ts @@ -0,0 +1,29 @@ +import { type AnnotationContext, type AnnotationOptionsColorPickerType, AnnotationType, type Padding } from '../annotationTypes'; +import { TextualStartEndProperties } from '../properties/textualStartEndProperties'; +declare const CalloutProperties_base: { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & typeof TextualStartEndProperties; +export declare class CalloutProperties extends CalloutProperties_base { + static is(this: void, value: unknown): value is CalloutProperties; + type: AnnotationType.Callout; + position: "bottom"; + alignment: "left"; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(colorPickerType: AnnotationOptionsColorPickerType): number | undefined; + getPlaceholderColor(): string; + getPadding(): Padding; + getTextInputCoords(context: AnnotationContext, height: number): { + x: number; + y: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutScene.d.ts new file mode 100644 index 000000000..393bd7e8a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutScene.d.ts @@ -0,0 +1,44 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type AnnotationContext, AnnotationType } from '../annotationTypes'; +import { TextualStartEndScene } from '../scenes/textualStartEndScene'; +import type { CalloutProperties } from './calloutProperties'; +interface CalloutDimensions { + tailPoint: { + x: number; + y: number; + }; + bodyBounds: { + x: number; + y: number; + width: number; + height: number; + }; +} +type PathType = 'corner' | 'side' | 'calloutCorner' | 'calloutSide'; +export declare class CalloutScene extends TextualStartEndScene { + static is(value: unknown): value is CalloutScene; + type: AnnotationType; + private readonly shape; + constructor(); + drag(datum: CalloutProperties, target: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean): void; + protected getLabelCoords(datum: CalloutProperties, bbox: _ModuleSupport.BBox, coords: _ModuleSupport.Vec4): _ModuleSupport.Vec2; + protected getHandleStyles(datum: CalloutProperties, handle: 'start' | 'end'): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + } | { + fill: undefined; + strokeWidth: number; + stroke?: undefined; + strokeOpacity?: undefined; + }; + protected updateAnchor(datum: CalloutProperties, coords: _ModuleSupport.Vec4, context: AnnotationContext, bbox: _ModuleSupport.BBox): void; + protected updateShape(datum: CalloutProperties, textBBox: _ModuleSupport.BBox, coords: _ModuleSupport.Vec4): void; + private updatePath; + drawPath(path: _ModuleSupport.ExtendedPath2D, { x0, y0, x1, y1, cx, cy }: _ModuleSupport.Corner, cornerRadius: number, type: PathType): void; + private calculateCalloutPlacement; + getDimensions(datum: CalloutProperties, textBBox: _ModuleSupport.BBox, coords: _ModuleSupport.Vec4): CalloutDimensions | undefined; + containsPoint(x: number, y: number): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutState.d.ts new file mode 100644 index 000000000..45e82b827 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/callout/calloutState.d.ts @@ -0,0 +1,6 @@ +import { TextualStartEndStateMachine } from '../states/textualStartEndState'; +import { CalloutProperties } from './calloutProperties'; +import type { CalloutScene } from './calloutScene'; +export declare class CalloutStateMachine extends TextualStartEndStateMachine { + protected createDatum(): CalloutProperties; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentConfig.d.ts new file mode 100644 index 000000000..6cd2a7d7f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentConfig.d.ts @@ -0,0 +1,4 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { CommentProperties } from './commentProperties'; +import { CommentScene } from './commentScene'; +export declare const commentConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentProperties.d.ts new file mode 100644 index 000000000..c7264609f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentProperties.d.ts @@ -0,0 +1,29 @@ +import { type AnnotationContext, type AnnotationOptionsColorPickerType, AnnotationType, type Padding } from '../annotationTypes'; +import { TextualPointProperties } from '../properties/textualPointProperties'; +declare const CommentProperties_base: { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & typeof TextualPointProperties; +export declare class CommentProperties extends CommentProperties_base { + static is(this: void, value: unknown): value is CommentProperties; + type: AnnotationType.Comment; + position: "bottom"; + alignment: "left"; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(colorPickerType: AnnotationOptionsColorPickerType): number | undefined; + getPlaceholderColor(): string; + getPadding(): Padding; + getTextInputCoords(context: AnnotationContext, height: number): { + x: number; + y: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentScene.d.ts new file mode 100644 index 000000000..ce9ec5fc8 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentScene.d.ts @@ -0,0 +1,25 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type AnnotationContext, AnnotationType } from '../annotationTypes'; +import { TextualPointScene } from '../scenes/textualPointScene'; +import type { CommentProperties } from './commentProperties'; +export declare class CommentScene extends TextualPointScene { + static is(value: unknown): value is CommentScene; + type: AnnotationType; + private readonly shape; + constructor(); + protected updateShape(datum: CommentProperties, bbox: _ModuleSupport.BBox): void; + protected getLabelCoords(datum: CommentProperties, point: _ModuleSupport.Vec2): _ModuleSupport.Vec2; + protected getHandleStyles(datum: CommentProperties): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + }; + protected updateAnchor(datum: CommentProperties, bbox: _ModuleSupport.BBox, context: AnnotationContext): { + x: number; + y: number; + position: "right" | "above" | "above-left" | "below" | undefined; + }; + private updatePath; + containsPoint(x: number, y: number): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentState.d.ts new file mode 100644 index 000000000..b2dc76c23 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/comment/commentState.d.ts @@ -0,0 +1,6 @@ +import { TextualPointStateMachine } from '../states/textualPointState'; +import { CommentProperties } from './commentProperties'; +import type { CommentScene } from './commentScene'; +export declare class CommentStateMachine extends TextualPointStateMachine { + protected createDatum(): CommentProperties; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineConfig.d.ts new file mode 100644 index 000000000..0c35ce3ac --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineConfig.d.ts @@ -0,0 +1,5 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { HorizontalLineProperties, VerticalLineProperties } from './crossLineProperties'; +import { CrossLineScene } from './crossLineScene'; +export declare const horizontalLineConfig: AnnotationTypeConfig; +export declare const verticalLineConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineProperties.d.ts new file mode 100644 index 000000000..1f92e4bb3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineProperties.d.ts @@ -0,0 +1,133 @@ +import { type PixelSize, _ModuleSupport } from 'ag-charts-community'; +import { LineTextProperties } from '../annotationProperties'; +import { AnnotationType } from '../annotationTypes'; +declare const HorizontalLineProperties_base: (abstract new (...args: any[]) => { + id: string; + getDefaultColor(colorPickerType: import("../annotationTypes").AnnotationOptionsColorPickerType, isMultiColor?: boolean | undefined): string | undefined; + locked?: boolean | undefined; + readOnly?: boolean | undefined; + isWriteable(): boolean; + isHoverable(): boolean; + visible?: boolean | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; +}) & { + new (...args: any[]): { + value?: import("../utils/scale").PointType; + }; +} & { + new (...args: any[]): { + handle: { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & { + new (...args: any[]): { + axisLabel: import("../annotationProperties").AxisLabelProperties; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & { + new (...args: any[]): { + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class HorizontalLineProperties extends HorizontalLineProperties_base { + readonly direction = "horizontal"; + static is(this: void, value: unknown): value is HorizontalLineProperties; + type: AnnotationType.HorizontalLine; + text: LineTextProperties; + getDefaultColor(): string | undefined; + getDefaultOpacity(): number | undefined; + getLineDash(): PixelSize[] | undefined; + getLineCap(): _ModuleSupport.ShapeLineCap | undefined; +} +declare const VerticalLineProperties_base: (abstract new (...args: any[]) => { + id: string; + getDefaultColor(colorPickerType: import("../annotationTypes").AnnotationOptionsColorPickerType, isMultiColor?: boolean | undefined): string | undefined; + locked?: boolean | undefined; + readOnly?: boolean | undefined; + isWriteable(): boolean; + isHoverable(): boolean; + visible?: boolean | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; +}) & { + new (...args: any[]): { + value?: import("../utils/scale").PointType; + }; +} & { + new (...args: any[]): { + handle: { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & { + new (...args: any[]): { + axisLabel: import("../annotationProperties").AxisLabelProperties; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & { + new (...args: any[]): { + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class VerticalLineProperties extends VerticalLineProperties_base { + readonly direction = "vertical"; + static is(this: void, value: unknown): value is VerticalLineProperties; + type: AnnotationType.VerticalLine; + text: LineTextProperties; + getDefaultColor(): string | undefined; + getDefaultOpacity(): number | undefined; + getLineDash(): PixelSize[] | undefined; + getLineCap(): _ModuleSupport.ShapeLineCap | undefined; +} +export type CrossLineProperties = HorizontalLineProperties | VerticalLineProperties; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineScene.d.ts new file mode 100644 index 000000000..29d9388f8 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineScene.d.ts @@ -0,0 +1,48 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import { AnnotationScene } from '../scenes/annotationScene'; +import { CollidableText } from '../scenes/collidableTextScene'; +import { type CrossLineProperties } from './crossLineProperties'; +export declare class CrossLineScene extends AnnotationScene { + static is(value: unknown): value is CrossLineScene; + type: string; + activeHandle?: 'middle'; + private readonly line; + private readonly middle; + private axisLabel?; + text?: CollidableText; + private seriesRect?; + private dragState?; + private isHorizontal; + constructor(); + update(datum: CrossLineProperties, context: AnnotationContext): void; + private updateLine; + private updateHandle; + private updateText; + private createAxisLabel; + private updateAxisLabel; + setAxisLabelOpacity(opacity: number): void; + setAxisLabelVisible(visible: boolean): void; + toggleHandles(show: boolean): void; + destroy(): void; + toggleActive(active: boolean): void; + dragStart(datum: CrossLineProperties, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + drag(datum: CrossLineProperties, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + translate(datum: CrossLineProperties, translation: _ModuleSupport.Vec2, context: AnnotationContext): void; + protected translatePoint(datum: CrossLineProperties, value: _ModuleSupport.Vec2, translation: _ModuleSupport.Vec2, context: AnnotationContext): void; + stopDragging(): void; + copy(datum: CrossLineProperties, copiedDatum: CrossLineProperties, context: AnnotationContext): CrossLineProperties | undefined; + getCursor(): "pointer" | "col-resize" | "row-resize" | undefined; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): "line" | "text" | "handle" | undefined; + getAnchor(): { + x: number; + y: number; + position?: undefined; + } | { + x: number; + y: number; + position: "right"; + }; + private convertCrossLine; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineState.d.ts new file mode 100644 index 000000000..9e607578e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/cross-line/crossLineState.d.ts @@ -0,0 +1,15 @@ +import { type Direction, _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationsCreateStateMachineContext } from '../annotationsSuperTypes'; +import type { AnnotationStateEvents } from '../states/stateTypes'; +import { type CrossLineProperties } from './crossLineProperties'; +import type { CrossLineScene } from './crossLineScene'; +declare const StateMachine: typeof _ModuleSupport.StateMachine; +interface CrossLineStateMachineContext extends Omit { + create: (datum: CrossLineProperties) => void; +} +export declare class CrossLineStateMachine extends StateMachine<'start' | 'waiting-first-render', Pick> { + debug: import("packages/ag-charts-community/dist/types/src/util/debug").DebugLogger; + protected node?: CrossLineScene; + constructor(direction: Direction, ctx: CrossLineStateMachineContext); +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelConfig.d.ts new file mode 100644 index 000000000..89322c34c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelConfig.d.ts @@ -0,0 +1,4 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { DisjointChannelProperties } from './disjointChannelProperties'; +import { DisjointChannelScene } from './disjointChannelScene'; +export declare const disjointChannelConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelProperties.d.ts new file mode 100644 index 000000000..c872acaeb --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelProperties.d.ts @@ -0,0 +1,93 @@ +import { type PixelSize, _ModuleSupport } from 'ag-charts-community'; +import { ChannelTextProperties } from '../annotationProperties'; +import { type AnnotationOptionsColorPickerType, AnnotationType } from '../annotationTypes'; +declare const DisjointChannelProperties_base: (abstract new (...args: any[]) => { + id: string; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType, isMultiColor?: boolean | undefined): string | undefined; + locked?: boolean | undefined; + readOnly?: boolean | undefined; + isWriteable(): boolean; + isHoverable(): boolean; + visible?: boolean | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; +}) & { + new (...args: any[]): { + background: { + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & { + new (...args: any[]): { + start: import("../annotationProperties").PointProperties; + end: import("../annotationProperties").PointProperties; + }; +} & { + new (...args: any[]): { + handle: { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & { + new (...args: any[]): { + extendStart?: boolean | undefined; + extendEnd?: boolean | undefined; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & { + new (...args: any[]): { + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class DisjointChannelProperties extends DisjointChannelProperties_base { + static is(this: void, value: unknown): value is DisjointChannelProperties; + type: AnnotationType.DisjointChannel; + startHeight: number; + endHeight: number; + text: ChannelTextProperties; + snapToAngle: number; + get bottom(): { + start: { + x: import("../utils/scale").PointType; + y: import("../utils/scale").PointType; + }; + end: { + x: import("../utils/scale").PointType; + y: import("../utils/scale").PointType; + }; + }; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(colorPickerType: AnnotationOptionsColorPickerType): number | undefined; + getLineDash(): PixelSize[] | undefined; + getLineCap(): _ModuleSupport.ShapeLineCap | undefined; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelScene.d.ts new file mode 100644 index 000000000..74fa278d0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelScene.d.ts @@ -0,0 +1,30 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import { ChannelScene } from '../scenes/channelScene'; +import { DivariantHandle, UnivariantHandle } from '../scenes/handle'; +import type { DisjointChannelProperties } from './disjointChannelProperties'; +type ChannelHandle = keyof DisjointChannelScene['handles']; +export declare class DisjointChannelScene extends ChannelScene { + static is(value: unknown): value is DisjointChannelScene; + type: string; + activeHandle?: ChannelHandle; + handles: { + topLeft: DivariantHandle; + topRight: DivariantHandle; + bottomLeft: DivariantHandle; + bottomRight: UnivariantHandle; + }; + constructor(); + dragHandle(datum: DisjointChannelProperties, target: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean): void; + protected getTranslatePointsVectors(start: _ModuleSupport.Vec2, end: _ModuleSupport.Vec2): { + start: _ModuleSupport.Vec2; + end: _ModuleSupport.Vec2; + bottomStart: _ModuleSupport.Vec2; + bottomEnd: _ModuleSupport.Vec2; + }; + updateLines(datum: DisjointChannelProperties, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4): void; + updateHandles(datum: DisjointChannelProperties, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4): void; + updateText(datum: DisjointChannelProperties, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4): void; + getBackgroundPoints(datum: DisjointChannelProperties, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4, bounds: _ModuleSupport.Vec4): [_ModuleSupport.Vec2, _ModuleSupport.Vec2]; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelState.d.ts new file mode 100644 index 000000000..52b919941 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/disjoint-channel/disjointChannelState.d.ts @@ -0,0 +1,17 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationsCreateStateMachineContext } from '../annotationsSuperTypes'; +import type { AnnotationStateEvents } from '../states/stateTypes'; +import { DisjointChannelProperties } from './disjointChannelProperties'; +import type { DisjointChannelScene } from './disjointChannelScene'; +declare const StateMachine: typeof _ModuleSupport.StateMachine; +interface DisjointChannelStateMachineContext extends Omit { + create: (datum: DisjointChannelProperties) => void; +} +export declare class DisjointChannelStateMachine extends StateMachine<'start' | 'waiting-first-render' | 'end' | 'height', Pick> { + debug: import("packages/ag-charts-community/dist/types/src/util/debug").DebugLogger; + protected datum?: DisjointChannelProperties; + protected node?: DisjointChannelScene; + protected snapping: boolean; + constructor(ctx: DisjointChannelStateMachineContext); +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedConfig.d.ts new file mode 100644 index 000000000..59d6e2d6c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedConfig.d.ts @@ -0,0 +1,4 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { FibonacciRetracementTrendBasedProperties } from './fibonacciRetracementTrendBasedProperties'; +import { FibonacciRetracementTrendBasedScene } from './fibonacciRetracementTrendBasedScene'; +export declare const fibonacciRetracementTrendBasedConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedProperties.d.ts new file mode 100644 index 000000000..c586e9c8c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedProperties.d.ts @@ -0,0 +1,8 @@ +import { PointProperties } from '../annotationProperties'; +import { AnnotationType } from '../annotationTypes'; +import { FibonacciProperties } from '../properties/fibonacciProperties'; +export declare class FibonacciRetracementTrendBasedProperties extends FibonacciProperties { + static is(this: void, value: unknown): value is FibonacciRetracementTrendBasedProperties; + type: AnnotationType.FibonacciRetracementTrendBased; + endRetracement: PointProperties; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedScene.d.ts new file mode 100644 index 000000000..2ad39689b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedScene.d.ts @@ -0,0 +1,49 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { PointProperties } from '../annotationProperties'; +import type { AnnotationContext } from '../annotationTypes'; +import { FibonacciScene } from '../scenes/fibonacciScene'; +import { DivariantHandle } from '../scenes/handle'; +import type { StartEndHandle } from '../scenes/startEndScene'; +import type { FibonacciRetracementTrendBasedProperties } from './fibonacciRetracementTrendBasedProperties'; +type ActiveHandle = StartEndHandle | 'endRetracement'; +export declare class FibonacciRetracementTrendBasedScene extends FibonacciScene { + static is(value: unknown): value is FibonacciRetracementTrendBasedScene; + type: string; + activeHandle?: ActiveHandle; + private readonly endRetracementLine; + protected readonly start: DivariantHandle; + protected readonly end: DivariantHandle; + protected readonly endRetracement: DivariantHandle; + protected readonly ignoreYBounds?: boolean; + protected dragState?: { + offset: _ModuleSupport.Vec2; + start: _ModuleSupport.Vec2; + end: _ModuleSupport.Vec2; + endRetracement: _ModuleSupport.Vec2; + }; + constructor(); + update(datum: FibonacciRetracementTrendBasedProperties, context: AnnotationContext): void; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + dragStart(datum: FibonacciRetracementTrendBasedProperties, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + stopDragging(): void; + protected dragAll(datum: FibonacciRetracementTrendBasedProperties, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + dragHandle(datum: FibonacciRetracementTrendBasedProperties, target: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean): void; + snapToAngle(datum: FibonacciRetracementTrendBasedProperties, coords: _ModuleSupport.Vec2, context: AnnotationContext): Pick | undefined; + translatePoints({ datum, start, end, endRetracement, translation, context, }: { + datum: FibonacciRetracementTrendBasedProperties; + start: _ModuleSupport.Vec2; + end: _ModuleSupport.Vec2; + endRetracement: _ModuleSupport.Vec2; + translation: _ModuleSupport.Vec2; + context: AnnotationContext; + }): void; + translate(datum: FibonacciRetracementTrendBasedProperties, translation: _ModuleSupport.Vec2, context: AnnotationContext): void; + copy(datum: FibonacciRetracementTrendBasedProperties, copiedDatum: FibonacciRetracementTrendBasedProperties, context: AnnotationContext): FibonacciRetracementTrendBasedProperties | undefined; + private getCoords; + toggleHandles(show: boolean | Partial>): void; + toggleActive(active: boolean): void; + protected updateHandles(datum: FibonacciRetracementTrendBasedProperties, coords1: _ModuleSupport.Vec4, coords2?: _ModuleSupport.Vec4, bbox?: _ModuleSupport.BBox): void; + protected getHandleCoords(_datum: FibonacciRetracementTrendBasedProperties, coords: _ModuleSupport.Vec4, handle: ActiveHandle, _bbox?: _ModuleSupport.BBox): _ModuleSupport.Vec2; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedState.d.ts new file mode 100644 index 000000000..3885be704 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement-trend-based/fibonacciRetracementTrendBasedState.d.ts @@ -0,0 +1,18 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationsCreateStateMachineContext } from '../annotationsSuperTypes'; +import type { AnnotationStateEvents } from '../states/stateTypes'; +import { FibonacciRetracementTrendBasedProperties } from './fibonacciRetracementTrendBasedProperties'; +import type { FibonacciRetracementTrendBasedScene } from './fibonacciRetracementTrendBasedScene'; +declare const StateMachine: typeof _ModuleSupport.StateMachine; +interface FibonacciRetracementTrendBasedStateMachineContext extends Omit { + create: (datum: FibonacciRetracementTrendBasedProperties) => void; +} +export declare class FibonacciRetracementTrendBasedStateMachine extends StateMachine<'start' | 'waiting-first-render' | 'end' | 'endRetracement', Pick> { + debug: import("packages/ag-charts-community/dist/types/src/util/debug").DebugLogger; + protected datum?: FibonacciRetracementTrendBasedProperties; + protected node?: FibonacciRetracementTrendBasedScene; + protected snapping: boolean; + constructor(ctx: FibonacciRetracementTrendBasedStateMachineContext); + createDatum(): FibonacciRetracementTrendBasedProperties; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementConfig.d.ts new file mode 100644 index 000000000..83d7940bc --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementConfig.d.ts @@ -0,0 +1,4 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { FibonacciRetracementProperties } from './fibonacciRetracementProperties'; +import { FibonacciRetracementScene } from './fibonacciRetracementScene'; +export declare const fibonacciRetracementConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementProperties.d.ts new file mode 100644 index 000000000..ab0e11ad3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementProperties.d.ts @@ -0,0 +1,6 @@ +import { AnnotationType } from '../annotationTypes'; +import { FibonacciProperties } from '../properties/fibonacciProperties'; +export declare class FibonacciRetracementProperties extends FibonacciProperties { + static is(this: void, value: unknown): value is FibonacciRetracementProperties; + type: AnnotationType.FibonacciRetracement; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementScene.d.ts new file mode 100644 index 000000000..9133b5bbb --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementScene.d.ts @@ -0,0 +1,41 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { PointProperties } from '../annotationProperties'; +import type { AnnotationContext } from '../annotationTypes'; +import { FibonacciScene } from '../scenes/fibonacciScene'; +import { DivariantHandle } from '../scenes/handle'; +import type { StartEndHandle } from '../scenes/startEndScene'; +import type { FibonacciRetracementProperties } from './fibonacciRetracementProperties'; +export declare class FibonacciRetracementScene extends FibonacciScene { + static is(value: unknown): value is FibonacciRetracementScene; + type: string; + activeHandle?: StartEndHandle; + protected readonly start: DivariantHandle; + protected readonly end: DivariantHandle; + protected readonly ignoreYBounds?: boolean; + protected dragState?: { + offset: _ModuleSupport.Vec2; + start: _ModuleSupport.Vec2; + end: _ModuleSupport.Vec2; + }; + constructor(); + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + dragStart(datum: FibonacciRetracementProperties, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + stopDragging(): void; + protected dragAll(datum: FibonacciRetracementProperties, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + dragHandle(datum: FibonacciRetracementProperties, target: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean): void; + snapToAngle(datum: FibonacciRetracementProperties, coords: _ModuleSupport.Vec2, context: AnnotationContext): Pick | undefined; + translatePoints({ datum, start, end, translation, context, }: { + datum: FibonacciRetracementProperties; + start: _ModuleSupport.Vec2; + end: _ModuleSupport.Vec2; + translation: _ModuleSupport.Vec2; + context: AnnotationContext; + }): void; + translate(datum: FibonacciRetracementProperties, translation: _ModuleSupport.Vec2, context: AnnotationContext): void; + copy(datum: FibonacciRetracementProperties, copiedDatum: FibonacciRetracementProperties, context: AnnotationContext): FibonacciRetracementProperties | undefined; + toggleHandles(show: boolean | Partial>): void; + toggleActive(active: boolean): void; + protected updateHandles(datum: FibonacciRetracementProperties, coords: _ModuleSupport.Vec4, _coords2: _ModuleSupport.Vec4, bbox?: _ModuleSupport.BBox): void; + protected getHandleCoords(_datum: FibonacciRetracementProperties, coords: _ModuleSupport.Vec4, handle: StartEndHandle, _bbox?: _ModuleSupport.BBox): _ModuleSupport.Vec2; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementState.d.ts new file mode 100644 index 000000000..778164731 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/fibonacci-retracement/fibonacciRetracementState.d.ts @@ -0,0 +1,5 @@ +import { LineTypeStateMachine } from '../line/lineState'; +import { FibonacciRetracementProperties } from './fibonacciRetracementProperties'; +export declare class FibonacciRetracementStateMachine extends LineTypeStateMachine { + createDatum(): FibonacciRetracementProperties; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineConfig.d.ts new file mode 100644 index 000000000..7b849a0ea --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineConfig.d.ts @@ -0,0 +1,5 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { ArrowProperties, LineProperties } from './lineProperties'; +import { LineScene } from './lineScene'; +export declare const lineConfig: AnnotationTypeConfig; +export declare const arrowConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineProperties.d.ts new file mode 100644 index 000000000..be257c962 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineProperties.d.ts @@ -0,0 +1,51 @@ +import { type PixelSize, _ModuleSupport } from 'ag-charts-community'; +import { LineTextProperties } from '../annotationProperties'; +import { type AnnotationOptionsColorPickerType, AnnotationType } from '../annotationTypes'; +import { StartEndProperties } from '../properties/startEndProperties'; +declare const LineTypeProperties_base: { + new (...args: any[]): { + localeManager?: import("packages/ag-charts-community/dist/types/src/locale/localeManager").LocaleManager | undefined; + setLocaleManager(localeManager: import("packages/ag-charts-community/dist/types/src/locale/localeManager").LocaleManager): void; + }; +} & { + new (...args: any[]): { + startCap?: "arrow" | undefined; + endCap?: "arrow" | undefined; + }; +} & { + new (...args: any[]): { + extendStart?: boolean | undefined; + extendEnd?: boolean | undefined; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & { + new (...args: any[]): { + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + }; +} & typeof StartEndProperties; +export declare abstract class LineTypeProperties extends LineTypeProperties_base { + text: LineTextProperties; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(): number | undefined; + getLineDash(): PixelSize[] | undefined; + getLineCap(): _ModuleSupport.ShapeLineCap | undefined; +} +export declare class ArrowProperties extends LineTypeProperties { + static is(this: void, value: unknown): value is ArrowProperties; + type: AnnotationType.Arrow; + endCap: "arrow"; +} +export declare class LineProperties extends LineTypeProperties { + static is(this: void, value: unknown): value is LineProperties; + type: AnnotationType.Line; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineScene.d.ts new file mode 100644 index 000000000..3adbe1417 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineScene.d.ts @@ -0,0 +1,28 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import { CollidableText } from '../scenes/collidableTextScene'; +import { StartEndScene } from '../scenes/startEndScene'; +import type { LineTypeProperties } from './lineProperties'; +export declare class LineScene extends StartEndScene { + static is(value: unknown): value is LineScene; + type: string; + private readonly line; + text?: CollidableText; + private startCap?; + private endCap?; + constructor(); + update(datum: LineTypeProperties, context: AnnotationContext): void; + private updateLine; + private updateText; + private updateCaps; + updateAnchor(_datum: LineTypeProperties, coords: _ModuleSupport.Vec4, _context: AnnotationContext, _bbox?: _ModuleSupport.BBox): void; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + protected getHandleCoords(_datum: LineTypeProperties, coords: _ModuleSupport.Vec4, handle: 'start' | 'end', _bbox?: _ModuleSupport.BBox): _ModuleSupport.Vec2; + protected getHandleStyles(datum: LineTypeProperties): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + }; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineState.d.ts new file mode 100644 index 000000000..9d1e41e2f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/line/lineState.d.ts @@ -0,0 +1,24 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationsCreateStateMachineContext } from '../annotationsSuperTypes'; +import type { AnnotationStateEvents } from '../states/stateTypes'; +import { ArrowProperties, LineProperties, LineTypeProperties } from './lineProperties'; +import type { LineScene } from './lineScene'; +declare const StateMachine: typeof _ModuleSupport.StateMachine; +interface LineStateMachineContext extends Omit { + create: (datum: Datum) => void; +} +export declare abstract class LineTypeStateMachine extends StateMachine<'start' | 'waiting-first-render' | 'end', Pick> { + debug: import("packages/ag-charts-community/dist/types/src/util/debug").DebugLogger; + protected datum?: Datum; + protected node?: LineScene; + protected snapping: boolean; + constructor(ctx: LineStateMachineContext); + abstract createDatum(): Datum; +} +export declare class ArrowStateMachine extends LineTypeStateMachine { + createDatum(): ArrowProperties; +} +export declare class LineStateMachine extends LineTypeStateMachine { + createDatum(): LineProperties; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerConfig.d.ts new file mode 100644 index 000000000..7563c5262 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerConfig.d.ts @@ -0,0 +1,7 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { DatePriceRangeProperties, DateRangeProperties, PriceRangeProperties, QuickDatePriceRangeProperties } from './measurerProperties'; +import { MeasurerScene, QuickMeasurerScene } from './measurerScene'; +export declare const dateRangeConfig: AnnotationTypeConfig; +export declare const priceRangeConfig: AnnotationTypeConfig; +export declare const datePriceRangeConfig: AnnotationTypeConfig; +export declare const quickDatePriceRangeConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerProperties.d.ts new file mode 100644 index 000000000..a85302427 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerProperties.d.ts @@ -0,0 +1,168 @@ +import { type PixelSize, _ModuleSupport } from 'ag-charts-community'; +import { LineTextProperties } from '../annotationProperties'; +import { type AnnotationOptionsColorPickerType, AnnotationType, type Point } from '../annotationTypes'; +import { StartEndProperties } from '../properties/startEndProperties'; +declare const MeasurerStatisticsDivider_base: { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +declare class MeasurerStatisticsDivider extends MeasurerStatisticsDivider_base { +} +declare const MeasurerStatistics_base: { + new (...args: any[]): { + fontStyle?: import("ag-charts-community").FontStyle | undefined; + fontWeight?: import("ag-charts-community").FontWeight | undefined; + fontSize: number; + fontFamily: string; + color?: string | undefined; + }; +} & { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +declare class MeasurerStatistics extends MeasurerStatistics_base { + divider: MeasurerStatisticsDivider; +} +declare const MeasurerDirectionProperties_base: { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & { + new (...args: any[]): { + handle: { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & typeof _ModuleSupport.BaseProperties; +declare class MeasurerDirectionProperties extends MeasurerDirectionProperties_base { + statistics: MeasurerStatistics; +} +declare const MeasurerTypeProperties_base: { + new (...args: any[]): { + localeManager?: import("packages/ag-charts-community/dist/types/src/locale/localeManager").LocaleManager | undefined; + setLocaleManager(localeManager: import("packages/ag-charts-community/dist/types/src/locale/localeManager").LocaleManager): void; + }; +} & { + new (...args: any[]): { + background: { + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & { + new (...args: any[]): { + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + }; +} & typeof StartEndProperties; +export declare class MeasurerTypeProperties extends MeasurerTypeProperties_base { + direction: 'both' | 'horizontal' | 'vertical'; + hasDateRange: boolean; + hasPriceRange: boolean; + statistics: MeasurerStatistics; + getVolume: (from: Point['x'], to: Point['x']) => number | undefined; + text: LineTextProperties; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(colorPickerType: AnnotationOptionsColorPickerType): number | undefined; + getLineDash(): PixelSize[] | undefined; + getLineCap(): _ModuleSupport.ShapeLineCap | undefined; +} +declare const DateRangeProperties_base: { + new (...args: any[]): { + hasDateRange: boolean; + }; +} & typeof MeasurerTypeProperties; +export declare class DateRangeProperties extends DateRangeProperties_base { + static is(this: void, value: unknown): value is DateRangeProperties; + type: AnnotationType.DateRange; + extendAbove?: boolean; + extendBelow?: boolean; + direction: "horizontal"; +} +declare const PriceRangeProperties_base: { + new (...args: any[]): { + hasPriceRange: boolean; + }; +} & typeof MeasurerTypeProperties; +export declare class PriceRangeProperties extends PriceRangeProperties_base { + static is(this: void, value: unknown): value is PriceRangeProperties; + type: AnnotationType.PriceRange; + extendLeft?: boolean; + extendRight?: boolean; + direction: "vertical"; +} +declare const DatePriceRangeProperties_base: { + new (...args: any[]): { + hasDateRange: boolean; + }; +} & { + new (...args: any[]): { + hasPriceRange: boolean; + }; +} & typeof MeasurerTypeProperties; +export declare class DatePriceRangeProperties extends DatePriceRangeProperties_base { + static is(this: void, value: unknown): value is DatePriceRangeProperties; + type: AnnotationType.DatePriceRange; + direction: "both"; +} +declare const QuickDatePriceRangeProperties_base: { + new (...args: any[]): { + hasDateRange: boolean; + }; +} & { + new (...args: any[]): { + hasPriceRange: boolean; + }; +} & typeof MeasurerTypeProperties; +export declare class QuickDatePriceRangeProperties extends QuickDatePriceRangeProperties_base { + static is(this: void, value: unknown): value is QuickDatePriceRangeProperties; + type: AnnotationType.QuickDatePriceRange; + up: MeasurerDirectionProperties; + down: MeasurerDirectionProperties; + direction: "both"; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerScene.d.ts new file mode 100644 index 000000000..a1e2d7f17 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerScene.d.ts @@ -0,0 +1,86 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import { CollidableText } from '../scenes/collidableTextScene'; +import { StartEndScene } from '../scenes/startEndScene'; +import { type MeasurerTypeProperties, QuickDatePriceRangeProperties } from './measurerProperties'; +import { MeasurerStatisticsScene, QuickMeasurerStatisticsScene } from './measurerStatisticsScene'; +export declare class MeasurerScene extends StartEndScene { + static is(value: unknown): value is MeasurerScene; + type: string; + private readonly horizontalLine; + private readonly verticalLine; + text?: CollidableText; + private readonly horizontalStartLine; + private readonly horizontalEndLine; + private readonly verticalStartLine; + private readonly verticalEndLine; + private readonly horizontalEndCap; + private readonly verticalEndCap; + readonly background: _ModuleSupport.Path; + private readonly statistics; + protected verticalDirection?: 'up' | 'down'; + constructor(); + protected createStatisticsScene(): MeasurerStatisticsScene; + update(datum: MeasurerTypeProperties, context: AnnotationContext): void; + private extendPerpendicular; + private updateVisibilities; + private updateLines; + private updateText; + private updateCaps; + private updateBoundingLines; + private readonly updateBackground; + private updateStatistics; + updateAnchor(_datum: MeasurerTypeProperties, coords: _ModuleSupport.Vec4, _context: AnnotationContext, _bbox?: _ModuleSupport.BBox): void; + getBackgroundPoints(_datum: MeasurerTypeProperties, verticalStart: _ModuleSupport.Vec4, verticalEnd: _ModuleSupport.Vec4, _bounds: _ModuleSupport.Vec4): _ModuleSupport.Vec2[]; + protected getLineStyles(datum: MeasurerTypeProperties): { + lineCap: _ModuleSupport.ShapeLineCap | undefined; + lineDash: number[] | undefined; + lineDashOffset: number | undefined; + stroke: string | undefined; + strokeWidth: number | undefined; + strokeOpacity: number | undefined; + fillOpacity: number; + }; + getBackgroundStyles(datum: MeasurerTypeProperties): { + fill: string | undefined; + fillOpacity: number | undefined; + }; + getHandleStyles(datum: MeasurerTypeProperties): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + }; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + private getDateRangeBars; + private getDateRangeValue; + private getPriceRangePercentage; + private getPriceRangeValue; + private getVolume; +} +export declare class QuickMeasurerScene extends MeasurerScene { + static is(value: unknown): value is QuickMeasurerScene; + type: string; + createStatisticsScene(): QuickMeasurerStatisticsScene; + private getDirectionStyles; + getLineStyles(datum: QuickDatePriceRangeProperties): { + stroke: string | undefined; + strokeWidth: number | undefined; + strokeOpacity: number | undefined; + lineCap: _ModuleSupport.ShapeLineCap | undefined; + lineDash: number[] | undefined; + lineDashOffset: number | undefined; + fillOpacity: number; + }; + getBackgroundStyles(datum: QuickDatePriceRangeProperties): { + fill: string | undefined; + fillOpacity: number | undefined; + }; + getHandleStyles(datum: QuickDatePriceRangeProperties): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + }; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerState.d.ts new file mode 100644 index 000000000..d86687d44 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerState.d.ts @@ -0,0 +1,29 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationsCreateStateMachineContext, MeasurerPropertiesType } from '../annotationsSuperTypes'; +import type { AnnotationStateEvents } from '../states/stateTypes'; +import { DatePriceRangeProperties, DateRangeProperties, PriceRangeProperties, QuickDatePriceRangeProperties } from './measurerProperties'; +import type { MeasurerScene } from './measurerScene'; +declare const StateMachine: typeof _ModuleSupport.StateMachine; +interface MeasurerStateMachineContext extends Omit { + create: (datum: Datum) => void; +} +declare abstract class MeasurerTypeStateMachine extends StateMachine<'start' | 'end', Pick> { + debug: import("packages/ag-charts-community/dist/types/src/util/debug").DebugLogger; + protected datum?: Datum; + protected node?: MeasurerScene; + constructor(ctx: MeasurerStateMachineContext); + abstract createDatum(): Datum; +} +export declare class DateRangeStateMachine extends MeasurerTypeStateMachine { + createDatum(): DateRangeProperties; +} +export declare class PriceRangeStateMachine extends MeasurerTypeStateMachine { + createDatum(): PriceRangeProperties; +} +export declare class DatePriceRangeStateMachine extends MeasurerTypeStateMachine { + createDatum(): DatePriceRangeProperties; +} +export declare class QuickDatePriceRangeStateMachine extends MeasurerTypeStateMachine { + createDatum(): QuickDatePriceRangeProperties; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerStatisticsScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerStatisticsScene.d.ts new file mode 100644 index 000000000..f52d345ab --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/measurer/measurerStatisticsScene.d.ts @@ -0,0 +1,81 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import type { MeasurerTypeProperties, QuickDatePriceRangeProperties } from './measurerProperties'; +export interface Statistics { + dateRange?: { + bars: number; + value: number; + }; + priceRange?: { + percentage: number; + value: number; + }; + volume?: number; +} +export declare class MeasurerStatisticsScene extends _ModuleSupport.Group { + name: string; + private readonly background; + private readonly dateRangeBarsText; + private readonly dateRangeDivider; + private readonly dateRangeValueText; + private readonly priceRangeValueText; + private readonly priceRangeDivider; + private readonly priceRangePercentageText; + private readonly volumeText; + private readonly volumeFormatter; + protected verticalDirection?: 'up' | 'down'; + constructor(); + update(datum: MeasurerTypeProperties, stats: Statistics, anchor: _ModuleSupport.Vec2, coords: _ModuleSupport.Vec4, context: AnnotationContext, verticalDirection?: 'up' | 'down', localeManager?: _ModuleSupport.ModuleContext['localeManager']): void; + private checkVisibility; + private updateStatistics; + private updateBackground; + private reposition; + protected getTextStyles(datum: MeasurerTypeProperties): { + fill: string | undefined; + fontFamily: string; + fontSize: number; + fontStyle: import("ag-charts-community").FontStyle | undefined; + fontWeight: import("ag-charts-community").FontWeight | undefined; + textBaseline: "top"; + }; + protected getDividerStyles(datum: MeasurerTypeProperties): { + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + }; + protected getBackgroundStyles(datum: MeasurerTypeProperties): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + cornerRadius: number; + }; + private formatDateRangeBars; + private formatDateRangeValue; + private formatPriceRangeValue; + private formatPriceRangePercentage; + private formatVolume; +} +export declare class QuickMeasurerStatisticsScene extends MeasurerStatisticsScene { + private getDirectionStyles; + getTextStyles(datum: QuickDatePriceRangeProperties): { + fill: string | undefined; + fontFamily: string; + fontSize: number; + fontStyle: import("ag-charts-community").FontStyle | undefined; + fontWeight: import("ag-charts-community").FontWeight | undefined; + textBaseline: "top"; + }; + getDividerStyles(datum: QuickDatePriceRangeProperties): { + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + }; + getBackgroundStyles(datum: QuickDatePriceRangeProperties): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + cornerRadius: number; + }; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteConfig.d.ts new file mode 100644 index 000000000..5622037be --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteConfig.d.ts @@ -0,0 +1,4 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { NoteProperties } from './noteProperties'; +import { NoteScene } from './noteScene'; +export declare const noteConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteProperties.d.ts new file mode 100644 index 000000000..848c6c7d4 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteProperties.d.ts @@ -0,0 +1,50 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type AnnotationContext, type AnnotationOptionsColorPickerType, AnnotationType, type Padding } from '../annotationTypes'; +import { TextualPointProperties } from '../properties/textualPointProperties'; +export declare const ICON_HEIGHT = 20; +export declare const ICON_WIDTH = 22; +export declare const LABEL_OFFSET: number; +export declare const TOOLBAR_OFFSET = 34; +declare const NoteBackgroundProperties_base: { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +declare class NoteBackgroundProperties extends NoteBackgroundProperties_base { +} +declare const NoteProperties_base: { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & typeof TextualPointProperties; +export declare class NoteProperties extends NoteProperties_base { + static is(this: void, value: unknown): value is NoteProperties; + type: AnnotationType.Note; + background: NoteBackgroundProperties; + position: 'bottom' | 'top'; + alignment: "center"; + width: number; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(colorPickerType: AnnotationOptionsColorPickerType): number | undefined; + getPadding(): Padding; + getTextInputCoords(context: AnnotationContext, height: number): { + x: number; + y: number; + }; + isHoverable(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteScene.d.ts new file mode 100644 index 000000000..07405277d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteScene.d.ts @@ -0,0 +1,35 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type AnnotationContext, AnnotationType } from '../annotationTypes'; +import { TextualPointScene } from '../scenes/textualPointScene'; +import { type NoteProperties } from './noteProperties'; +export declare class NoteScene extends TextualPointScene { + static is(value: unknown): value is NoteScene; + type: AnnotationType; + private readonly shape; + private readonly iconBackground; + private readonly iconLines; + private active; + constructor(); + update(datum: NoteProperties, context: AnnotationContext): void; + getTextBBox(datum: NoteProperties, coords: _ModuleSupport.Vec2, context: AnnotationContext): _ModuleSupport.BBox; + updateLabel(datum: NoteProperties, bbox: _ModuleSupport.BBox): void; + updateShape(datum: NoteProperties, bbox: _ModuleSupport.BBox): void; + private updateIcon; + protected updateAnchor(datum: NoteProperties, bbox: _ModuleSupport.BBox, context: AnnotationContext): { + x: number; + y: number; + position: "above" | "below"; + }; + protected getLabelCoords(datum: NoteProperties, bbox: _ModuleSupport.BBox): _ModuleSupport.Vec2; + protected getTextBaseline(datum: NoteProperties): CanvasTextBaseline; + protected getHandleCoords(_datum: NoteProperties, coords: _ModuleSupport.Vec2, _bbox: _ModuleSupport.BBox): _ModuleSupport.Vec2; + protected getHandleStyles(datum: NoteProperties): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + }; + toggleHovered(hovered: boolean, active: boolean, readOnly: boolean | undefined): void; + toggleActive(active: boolean): void; + containsPoint(x: number, y: number): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteState.d.ts new file mode 100644 index 000000000..27610e4a0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/note/noteState.d.ts @@ -0,0 +1,6 @@ +import { TextualPointStateMachine } from '../states/textualPointState'; +import { NoteProperties } from './noteProperties'; +import type { NoteScene } from './noteScene'; +export declare class NoteStateMachine extends TextualPointStateMachine { + protected createDatum(): NoteProperties; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelConfig.d.ts new file mode 100644 index 000000000..81c13a02d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelConfig.d.ts @@ -0,0 +1,4 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { ParallelChannelProperties } from './parallelChannelProperties'; +import { ParallelChannelScene } from './parallelChannelScene'; +export declare const parallelChannelConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelProperties.d.ts new file mode 100644 index 000000000..0d0ee6c62 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelProperties.d.ts @@ -0,0 +1,93 @@ +import { type PixelSize, _ModuleSupport } from 'ag-charts-community'; +import { ChannelAnnotationMiddleProperties, ChannelTextProperties } from '../annotationProperties'; +import { type AnnotationOptionsColorPickerType, AnnotationType } from '../annotationTypes'; +declare const ParallelChannelProperties_base: (abstract new (...args: any[]) => { + id: string; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType, isMultiColor?: boolean | undefined): string | undefined; + locked?: boolean | undefined; + readOnly?: boolean | undefined; + isWriteable(): boolean; + isHoverable(): boolean; + visible?: boolean | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; +}) & { + new (...args: any[]): { + background: { + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & { + new (...args: any[]): { + start: import("../annotationProperties").PointProperties; + end: import("../annotationProperties").PointProperties; + }; +} & { + new (...args: any[]): { + handle: { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & { + new (...args: any[]): { + extendStart?: boolean | undefined; + extendEnd?: boolean | undefined; + }; +} & { + new (...args: any[]): { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + }; +} & { + new (...args: any[]): { + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class ParallelChannelProperties extends ParallelChannelProperties_base { + static is(this: void, value: unknown): value is ParallelChannelProperties; + type: AnnotationType.ParallelChannel; + height: number; + middle: ChannelAnnotationMiddleProperties; + text: ChannelTextProperties; + snapToAngle: number; + get bottom(): { + start: { + x: import("../utils/scale").PointType; + y: import("../utils/scale").PointType; + }; + end: { + x: import("../utils/scale").PointType; + y: import("../utils/scale").PointType; + }; + }; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(colorPickerType: AnnotationOptionsColorPickerType): number | undefined; + getLineDash(): PixelSize[] | undefined; + getLineCap(): _ModuleSupport.ShapeLineCap | undefined; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelScene.d.ts new file mode 100644 index 000000000..6dc38e176 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelScene.d.ts @@ -0,0 +1,35 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import { ChannelScene } from '../scenes/channelScene'; +import { DivariantHandle, UnivariantHandle } from '../scenes/handle'; +import type { ParallelChannelProperties } from './parallelChannelProperties'; +type ChannelHandle = keyof ParallelChannelScene['handles']; +export declare class ParallelChannelScene extends ChannelScene { + static is(value: unknown): value is ParallelChannelScene; + type: string; + activeHandle?: ChannelHandle; + handles: { + topLeft: DivariantHandle; + topMiddle: UnivariantHandle; + topRight: DivariantHandle; + bottomLeft: DivariantHandle; + bottomMiddle: UnivariantHandle; + bottomRight: DivariantHandle; + }; + private readonly middleLine; + constructor(); + dragHandle(datum: ParallelChannelProperties, target: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean): void; + protected getTranslatePointsVectors(start: _ModuleSupport.Vec2, end: _ModuleSupport.Vec2): { + start: _ModuleSupport.Vec2; + end: _ModuleSupport.Vec2; + bottomStart: _ModuleSupport.Vec2; + bottomEnd: _ModuleSupport.Vec2; + }; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + updateLines(datum: ParallelChannelProperties, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4, context: AnnotationContext, naturalTop: _ModuleSupport.Vec4, naturalBottom: _ModuleSupport.Vec4): void; + updateHandles(datum: ParallelChannelProperties, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4): void; + updateText(datum: ParallelChannelProperties, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4): void; + getBackgroundPoints(datum: ParallelChannelProperties, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4, bounds: _ModuleSupport.Vec4): [_ModuleSupport.Vec2, _ModuleSupport.Vec2]; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelState.d.ts new file mode 100644 index 000000000..c286cf835 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/parallel-channel/parallelChannelState.d.ts @@ -0,0 +1,17 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationsCreateStateMachineContext } from '../annotationsSuperTypes'; +import type { AnnotationStateEvents } from '../states/stateTypes'; +import { ParallelChannelProperties } from './parallelChannelProperties'; +import type { ParallelChannelScene } from './parallelChannelScene'; +declare const StateMachine: typeof _ModuleSupport.StateMachine; +interface ParallelChannelStateMachineContext extends Omit { + create: (datum: ParallelChannelProperties) => void; +} +export declare class ParallelChannelStateMachine extends StateMachine<'start' | 'waiting-first-render' | 'end' | 'height', Pick> { + debug: import("packages/ag-charts-community/dist/types/src/util/debug").DebugLogger; + protected datum?: ParallelChannelProperties; + protected node?: ParallelChannelScene; + protected snapping: boolean; + constructor(ctx: ParallelChannelStateMachineContext); +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/fibonacciProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/fibonacciProperties.d.ts new file mode 100644 index 000000000..59be1c9c4 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/fibonacciProperties.d.ts @@ -0,0 +1,13 @@ +import { LabelTextProperties } from '../annotationProperties'; +import type { AnnotationOptionsColorPickerType, FibonacciBands } from '../annotationTypes'; +import { LineTypeProperties } from '../line/lineProperties'; +export declare class FibonacciProperties extends LineTypeProperties { + label: LabelTextProperties; + reverse: boolean; + showFill: boolean; + isMultiColor: boolean; + strokes: string[]; + rangeStroke?: string; + bands?: FibonacciBands; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType): string | undefined; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/pointProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/pointProperties.d.ts new file mode 100644 index 000000000..343ad8f64 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/pointProperties.d.ts @@ -0,0 +1,44 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type AnnotationOptionsColorPickerType } from '../annotationTypes'; +declare const PointProperties_base: (abstract new (...args: any[]) => { + id: string; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType, isMultiColor?: boolean | undefined): string | undefined; + locked?: boolean | undefined; + readOnly?: boolean | undefined; + isWriteable(): boolean; + isHoverable(): boolean; + visible?: boolean | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; +}) & { + new (...args: any[]): { + x?: import("../utils/scale").PointType; + y?: import("../utils/scale").PointType; + }; +} & { + new (...args: any[]): { + handle: { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class PointProperties extends PointProperties_base { + getDefaultColor(_colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(_colorPickerType: AnnotationOptionsColorPickerType): number | undefined; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/shapePointProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/shapePointProperties.d.ts new file mode 100644 index 000000000..ee009957c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/shapePointProperties.d.ts @@ -0,0 +1,15 @@ +import { type AnnotationOptionsColorPickerType } from '../annotationTypes'; +import { PointProperties } from './pointProperties'; +declare const ShapePointProperties_base: { + new (...args: any[]): { + fill?: string | undefined; + fillOpacity?: number | undefined; + }; +} & typeof PointProperties; +export declare class ShapePointProperties extends ShapePointProperties_base { + static is(value: unknown): value is ShapePointProperties; + size: number; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(colorPickerType: AnnotationOptionsColorPickerType): number | undefined; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/startEndProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/startEndProperties.d.ts new file mode 100644 index 000000000..8b804755a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/startEndProperties.d.ts @@ -0,0 +1,45 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type AnnotationOptionsColorPickerType } from '../annotationTypes'; +declare const StartEndProperties_base: (abstract new (...args: any[]) => { + id: string; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType, isMultiColor?: boolean | undefined): string | undefined; + locked?: boolean | undefined; + readOnly?: boolean | undefined; + isWriteable(): boolean; + isHoverable(): boolean; + visible?: boolean | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; +}) & { + new (...args: any[]): { + start: import("../annotationProperties").PointProperties; + end: import("../annotationProperties").PointProperties; + }; +} & { + new (...args: any[]): { + handle: { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class StartEndProperties extends StartEndProperties_base { + snapToAngle: number; + getDefaultColor(_colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(_colorPickerType: AnnotationOptionsColorPickerType): number | undefined; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/textualPointProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/textualPointProperties.d.ts new file mode 100644 index 000000000..e0f3238d7 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/textualPointProperties.d.ts @@ -0,0 +1,76 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type AnnotationContext, type AnnotationOptionsColorPickerType, type Padding } from '../annotationTypes'; +import type { AnnotationTextAlignment, AnnotationTextPosition } from '../text/util'; +declare const TextualPointProperties_base: (abstract new (...args: any[]) => { + id: string; + getDefaultColor(colorPickerType: AnnotationOptionsColorPickerType, isMultiColor?: boolean | undefined): string | undefined; + locked?: boolean | undefined; + readOnly?: boolean | undefined; + isWriteable(): boolean; + isHoverable(): boolean; + visible?: boolean | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; +}) & { + new (...args: any[]): { + x?: import("../utils/scale").PointType; + y?: import("../utils/scale").PointType; + }; +} & { + new (...args: any[]): { + handle: { + stroke?: string | undefined; + strokeOpacity?: number | undefined; + strokeWidth?: number | undefined; + lineCap?: _ModuleSupport.ShapeLineCap | undefined; + computedLineDash?: number[] | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + lineStyle?: import("ag-charts-community").AgAnnotationLineStyleType | undefined; + fill?: string | undefined; + fillOpacity?: number | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + }; +} & { + new (...args: any[]): { + padding?: number | undefined; + textAlign: import("ag-charts-community").TextAlign; + formatter?: import("ag-charts-community").Formatter | undefined; + }; +} & { + new (...args: any[]): { + fontStyle?: import("ag-charts-community").FontStyle | undefined; + fontWeight?: import("ag-charts-community").FontWeight | undefined; + fontSize: number; + fontFamily: string; + color?: string | undefined; + }; +} & typeof _ModuleSupport.BaseProperties; +export declare class TextualPointProperties extends TextualPointProperties_base { + text: string; + position: AnnotationTextPosition; + alignment: AnnotationTextAlignment; + placement: 'inside' | 'outside'; + width?: number; + placeholderText?: string; + getDefaultColor(_colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(_colorPickerType: AnnotationOptionsColorPickerType): number | undefined; + getPlaceholderColor(): string | undefined; + getPadding(): Padding; + getText(): { + text: string; + isPlaceholder: boolean; + }; + getTextInputCoords(context: AnnotationContext, _height: number): { + x: number; + y: number; + }; + getTextPosition(): AnnotationTextPosition; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/textualStartEndProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/textualStartEndProperties.d.ts new file mode 100644 index 000000000..f281825fa --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/properties/textualStartEndProperties.d.ts @@ -0,0 +1,45 @@ +import { type AnnotationContext, type AnnotationOptionsColorPickerType, type Padding } from '../annotationTypes'; +import type { AnnotationTextAlignment, AnnotationTextPosition } from '../text/util'; +import { StartEndProperties } from './startEndProperties'; +declare const TextualStartEndProperties_base: { + new (...args: any[]): { + localeManager?: import("packages/ag-charts-community/dist/types/src/locale/localeManager").LocaleManager | undefined; + setLocaleManager(localeManager: import("packages/ag-charts-community/dist/types/src/locale/localeManager").LocaleManager): void; + }; +} & { + new (...args: any[]): { + padding?: number | undefined; + textAlign: import("ag-charts-community").TextAlign; + formatter?: import("ag-charts-community").Formatter | undefined; + }; +} & { + new (...args: any[]): { + fontStyle?: import("ag-charts-community").FontStyle | undefined; + fontWeight?: import("ag-charts-community").FontWeight | undefined; + fontSize: number; + fontFamily: string; + color?: string | undefined; + }; +} & typeof StartEndProperties; +export declare class TextualStartEndProperties extends TextualStartEndProperties_base { + text: string; + position: AnnotationTextPosition; + alignment: AnnotationTextAlignment; + placement: 'inside' | 'outside'; + width?: number; + placeholderText?: string; + getDefaultColor(_colorPickerType: AnnotationOptionsColorPickerType): string | undefined; + getDefaultOpacity(_colorPickerType: AnnotationOptionsColorPickerType): number | undefined; + getPlaceholderColor(): string | undefined; + getPadding(): Padding; + getText(): { + text: string; + isPlaceholder: boolean; + }; + getTextInputCoords(context: AnnotationContext, _height: number): { + x: number; + y: number; + }; + getTextPosition(): AnnotationTextPosition; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/annotationScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/annotationScene.d.ts new file mode 100644 index 000000000..71ae0d38f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/annotationScene.d.ts @@ -0,0 +1,18 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare abstract class AnnotationScene extends _ModuleSupport.Group { + static isCheck(value: unknown, type: string): boolean; + name: string; + zIndex: _ModuleSupport.ZIndexMap; + abstract type: string; + abstract activeHandle?: string; + abstract containsPoint(x: number, y: number): boolean; + abstract toggleHandles(show: boolean | Record): void; + abstract toggleActive(active: boolean): void; + abstract stopDragging(): void; + abstract getAnchor(): _ModuleSupport.FloatingToolbarAnchor; + abstract getCursor(): string | undefined; + abstract getNodeAtCoords(x: number, y: number): string | undefined; + toggleHovered(hovered: boolean, active: boolean, readOnly: boolean | undefined): void; + protected computeBBoxWithoutHandles(): _ModuleSupport.BBox; + protected updateNode(constructor: new () => TNode, node?: TNode, isConfigured?: boolean): TNode | undefined; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/annotationShape.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/annotationShape.d.ts new file mode 100644 index 000000000..4c24c28e8 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/annotationShape.d.ts @@ -0,0 +1,4 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare class AnnotationShape extends _ModuleSupport.Marker { + isPointInPath(x: number, y: number): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/axisLabelScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/axisLabelScene.d.ts new file mode 100644 index 000000000..a2a395c48 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/axisLabelScene.d.ts @@ -0,0 +1,21 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AxisLabelProperties } from '../annotationProperties'; +import type { AnnotationAxisContext } from '../annotationTypes'; +type UpdateOpts = { + x: number; + y: number; + value: any; + styles: Partial; + context: AnnotationAxisContext; +}; +export declare class AxisLabelScene extends _ModuleSupport.Group { + static readonly className = "AxisLabel"; + private readonly label; + private readonly rect; + constructor(); + update(opts: UpdateOpts): void; + private updateLabel; + private updateRect; + private updatePosition; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/capScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/capScene.d.ts new file mode 100644 index 000000000..ad5cee967 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/capScene.d.ts @@ -0,0 +1,21 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { StrokeOptions } from 'ag-charts-types'; +export declare abstract class CapScene extends _ModuleSupport.Group { + abstract type: string; + abstract update(options: { + x: number; + y: number; + angle: number; + } & StrokeOptions): void; +} +export declare class ArrowCapScene extends CapScene { + type: "arrow"; + private readonly path; + private readonly armLength; + constructor(); + update(options: { + x: number; + y: number; + angle: number; + } & StrokeOptions): void; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/channelScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/channelScene.d.ts new file mode 100644 index 000000000..1707ce307 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/channelScene.d.ts @@ -0,0 +1,52 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { ChannelTextProperties } from '../annotationProperties'; +import type { AnnotationContext, Point } from '../annotationTypes'; +import { CollidableLine } from './collidableLineScene'; +import type { CollidableText } from './collidableTextScene'; +import type { Handle } from './handle'; +import { LinearScene } from './linearScene'; +type ChannelHandle = Partial<'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'topMiddle' | 'bottomMiddle'>; +export declare abstract class ChannelScene boolean; +}> extends LinearScene { + protected handles: { + [key: string]: Handle; + }; + protected overflowContinuous: number; + protected topLine: CollidableLine; + protected bottomLine: CollidableLine; + background: _ModuleSupport.Path; + text?: CollidableText; + private readonly anchor; + update(datum: Datum, context: AnnotationContext): void; + toggleHandles(show: boolean | Partial>): void; + toggleActive(active: boolean): void; + stopDragging(): void; + getAnchor(): _ModuleSupport.FloatingToolbarAnchor; + getCursor(): string | undefined; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + protected abstract updateLines(datum: Datum, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4, context: AnnotationContext, naturalTop: _ModuleSupport.Vec4, naturalBottom: _ModuleSupport.Vec4): void; + protected abstract updateHandles(datum: Datum, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4): void; + protected abstract updateText(datum: Datum, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4): void; + protected readonly updateBackground: (datum: { + background: import("ag-charts-community").FillOptions; + }, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4, context: AnnotationContext) => void; + protected updateAnchor(top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4): void; + abstract getBackgroundPoints(datum: Datum, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4, bounds: _ModuleSupport.Vec4): Array<_ModuleSupport.Vec2>; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/collidableLineScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/collidableLineScene.d.ts new file mode 100644 index 000000000..743e99463 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/collidableLineScene.d.ts @@ -0,0 +1,19 @@ +import { _ModuleSupport } from 'ag-charts-community'; +type ShapeClipMask = { + x: number; + y: number; + radius: number; +}; +export declare class CollidableLine extends _ModuleSupport.Line { + collisionBBox?: _ModuleSupport.BBox; + private readonly growCollisionBox; + protected clipMask: Map; + setProperties(styles: { + [K in keyof T]?: T[K] | undefined; + }): T; + private updateCollisionBBox; + isPointInPath(pointX: number, pointY: number): boolean; + render(renderCtx: _ModuleSupport.RenderContext): void; + setClipMask(id: string, mask?: ShapeClipMask): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/collidableTextScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/collidableTextScene.d.ts new file mode 100644 index 000000000..9a7e512f1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/collidableTextScene.d.ts @@ -0,0 +1,5 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare class CollidableText extends _ModuleSupport.TransformableText { + private readonly growCollisionBox; + isPointInPath(pointX: number, pointY: number): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/fibonacciScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/fibonacciScene.d.ts new file mode 100644 index 000000000..47b90c61e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/fibonacciScene.d.ts @@ -0,0 +1,58 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import type { FibonacciProperties } from '../properties/fibonacciProperties'; +import type { FibonacciRangeDatum } from '../utils/fibonacci'; +import { AnnotationScene } from './annotationScene'; +import { CollidableLine } from './collidableLineScene'; +import { CollidableText } from './collidableTextScene'; +export declare abstract class FibonacciScene extends AnnotationScene { + protected readonly trendLine: CollidableLine; + text?: CollidableText; + private readonly rangeFillsGroup; + private readonly rangeFillsGroupSelection; + private readonly rangeStrokesGroup; + private readonly rangeStrokesGroupSelection; + private readonly labelsGroup; + private readonly labelsGroupSelection; + protected anchor: _ModuleSupport.FloatingToolbarAnchor; + constructor(); + update(datum: Datum, context: AnnotationContext): void; + protected extendLine({ x1, y1, x2, y2 }: _ModuleSupport.Vec4, datum: Datum, context: AnnotationContext): { + x1: number; + y1: number; + x2: number; + y2: number; + }; + protected updateLine(datum: Datum, coords?: _ModuleSupport.Vec4, line?: CollidableLine): void; + private updateRangeStrokes; + protected updateRanges(datum: Datum, data: FibonacciRangeDatum[], context: AnnotationContext): void; + private updateRangeFills; + private updateRangeLabels; + private checkWithinBounds; + protected updateText(datum: Datum, coords: _ModuleSupport.Vec4): void; + updateAnchor(_datum: Datum, coords: _ModuleSupport.Vec4, _context: AnnotationContext, _bbox?: _ModuleSupport.BBox): void; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + protected getHandleStyles(datum: Datum): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + }; + drag(datum: Datum, target: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean): void; + protected abstract dragHandle(datum: Datum, target: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean): void; + protected abstract dragAll(datum: Datum, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + abstract translatePoints({ datum, start, end, translation, context, }: { + datum: Datum; + start: _ModuleSupport.Vec2; + end: _ModuleSupport.Vec2; + translation: _ModuleSupport.Vec2; + context: AnnotationContext; + }): void; + abstract translate(datum: Datum, translation: _ModuleSupport.Vec2, context: AnnotationContext): void; + abstract copy(datum: Datum, copiedDatum: Datum, context: AnnotationContext): void; + abstract snapToAngle(datum: Datum, coords: _ModuleSupport.Vec2, context: AnnotationContext): void; + getAnchor(): _ModuleSupport.FloatingToolbarAnchor; + getCursor(): string; + protected abstract updateHandles(datum: Datum, coords1: _ModuleSupport.Vec4, coords2?: _ModuleSupport.Vec4, bbox?: _ModuleSupport.BBox): void; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/handle.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/handle.d.ts new file mode 100644 index 000000000..67c10ca5c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/handle.d.ts @@ -0,0 +1,70 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { AnnotationShape } from './annotationShape'; +type UnivariantHandleStyles = { + x: number; + y: number; +} & { + [K in keyof _ModuleSupport.Rect]?: _ModuleSupport.Rect[K]; +}; +type DivariantHandleStyles = { + x: number; + y: number; +} & { + [K in keyof AnnotationShape]?: AnnotationShape[K]; +}; +export declare abstract class Handle extends _ModuleSupport.Group { + static readonly HANDLE_SIZE: number; + static readonly GLOW_SIZE: number; + static readonly INACTIVE_STROKE_WIDTH = 2; + abstract handle: _ModuleSupport.Rect | AnnotationShape; + protected abstract glow: _ModuleSupport.Rect | AnnotationShape; + protected active: boolean; + protected locked: boolean; + visible: boolean; + zIndex: number; + abstract update(styles: { + [K in keyof (_ModuleSupport.Rect | AnnotationShape)]?: (_ModuleSupport.Rect | AnnotationShape)[K]; + }): void; + drag(target: _ModuleSupport.Vec2): { + point: _ModuleSupport.Vec2; + offset: _ModuleSupport.Vec2; + }; + toggleActive(active: boolean): void; + toggleHovered(hovered: boolean): void; + toggleDragging(dragging: boolean): void; + toggleLocked(locked: boolean): void; + getCursor(): string | undefined; + containsPoint(x: number, y: number): boolean; +} +export declare class UnivariantHandle extends Handle { + static readonly HANDLE_SIZE = 12; + static readonly GLOW_SIZE = 16; + static readonly CORNER_RADIUS = 4; + handle: _ModuleSupport.Rect; + glow: _ModuleSupport.Rect; + gradient: 'horizontal' | 'vertical'; + private cachedStyles?; + constructor(); + toggleLocked(locked: boolean): void; + update(styles: UnivariantHandleStyles): void; + drag(target: _ModuleSupport.Vec2): { + point: _ModuleSupport.Vec2; + offset: { + x: number; + y: number; + }; + }; + getCursor(): "col-resize" | "row-resize" | undefined; +} +export declare class DivariantHandle extends Handle { + static readonly HANDLE_SIZE = 11; + static readonly GLOW_SIZE = 17; + handle: AnnotationShape; + glow: AnnotationShape; + private cachedStyles?; + constructor(); + toggleLocked(locked: boolean): void; + update(styles: DivariantHandleStyles): void; + getCursor(): string; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/linearScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/linearScene.d.ts new file mode 100644 index 000000000..68a940883 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/linearScene.d.ts @@ -0,0 +1,35 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { PointProperties } from '../annotationProperties'; +import type { AnnotationContext } from '../annotationTypes'; +import { AnnotationScene } from './annotationScene'; +export declare abstract class LinearScene; + end: Pick; + extendStart?: boolean; + extendEnd?: boolean; + isWriteable: () => boolean; +}> extends AnnotationScene { + protected dragState?: { + offset: _ModuleSupport.Vec2; + start: _ModuleSupport.Vec2; + end: _ModuleSupport.Vec2; + }; + protected overflowContinuous: number; + protected extendLine({ x1, y1, x2, y2 }: _ModuleSupport.Vec4, datum: Datum, context: AnnotationContext): { + x1: number; + y1: number; + x2: number; + y2: number; + }; + dragStart(datum: Datum, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + drag(datum: Datum, target: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean): void; + protected abstract dragHandle(datum: Datum, target: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean): void; + protected dragAll(datum: Datum, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + translate(datum: Datum, translation: _ModuleSupport.Vec2, context: AnnotationContext): void; + copy(datum: Datum, copiedDatum: Datum, context: AnnotationContext): Datum | undefined; + protected translatePoints(datum: Datum, start: _ModuleSupport.Vec2, end: _ModuleSupport.Vec2, translation: _ModuleSupport.Vec2, context: AnnotationContext): void; + protected getTranslatePointsVectors(start: _ModuleSupport.Vec2, end: _ModuleSupport.Vec2): { + start: _ModuleSupport.Vec2; + end: _ModuleSupport.Vec2; + }; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/pointScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/pointScene.d.ts new file mode 100644 index 000000000..31dfce6e4 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/pointScene.d.ts @@ -0,0 +1,39 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import type { PointProperties } from '../properties/pointProperties'; +import { AnnotationScene } from './annotationScene'; +import { DivariantHandle } from './handle'; +export declare abstract class PointScene extends AnnotationScene { + activeHandle?: string; + protected readonly handle: DivariantHandle; + protected dragState?: { + offset: _ModuleSupport.Vec2; + handle: _ModuleSupport.Vec2; + }; + protected anchor: _ModuleSupport.FloatingToolbarAnchor; + update(datum: Datum, context: AnnotationContext): void; + dragStart(datum: Datum, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + drag(datum: Datum, target: _ModuleSupport.Vec2, context: AnnotationContext): void; + translate(datum: Datum, translation: _ModuleSupport.Vec2, context: AnnotationContext): void; + toggleHandles(show: boolean | Partial>): void; + toggleActive(active: boolean): void; + stopDragging(): void; + copy(datum: Datum, copiedDatum: Datum, context: AnnotationContext): Datum; + getAnchor(): _ModuleSupport.FloatingToolbarAnchor; + getCursor(): string; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + protected updateHandle(datum: Datum, point: _ModuleSupport.Vec2, bbox?: _ModuleSupport.BBox): void; + protected updateAnchor(datum: Datum, point: _ModuleSupport.Vec2, context: AnnotationContext): { + x: number; + y: number; + position: "right" | "above" | "above-left" | "below" | undefined; + }; + protected getHandleCoords(_datum: Datum, point: _ModuleSupport.Vec2, _bbox?: _ModuleSupport.BBox): _ModuleSupport.Vec2; + protected getHandleStyles(datum: Datum): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + }; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/shapePointScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/shapePointScene.d.ts new file mode 100644 index 000000000..7696e4281 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/shapePointScene.d.ts @@ -0,0 +1,15 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +import { type AnnotationContext } from '../annotationTypes'; +import type { ShapePointProperties } from '../properties/shapePointProperties'; +import type { AnnotationShape } from './annotationShape'; +import { PointScene } from './pointScene'; +export declare abstract class ShapePointScene extends PointScene { + protected abstract shape: AnnotationShape; + constructor(); + update(datum: Datum, context: AnnotationContext): void; + private updateShape; + protected updateShapeStyles(datum: Datum): void; + protected updateShapePath(datum: Datum, point: _ModuleSupport.Vec2): void; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/startEndScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/startEndScene.d.ts new file mode 100644 index 000000000..ed9136bb2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/startEndScene.d.ts @@ -0,0 +1,25 @@ +import { type AgAnnotationHandleStyles, _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import type { StartEndProperties } from '../properties/startEndProperties'; +import { DivariantHandle } from './handle'; +import { LinearScene } from './linearScene'; +export type StartEndHandle = 'start' | 'end'; +export declare abstract class StartEndScene extends LinearScene { + activeHandle?: StartEndHandle; + protected readonly start: DivariantHandle; + protected readonly end: DivariantHandle; + protected anchor: _ModuleSupport.FloatingToolbarAnchor; + update(datum: Datum, context: AnnotationContext): void; + toggleHandles(show: boolean | Partial>): void; + toggleActive(active: boolean): void; + dragHandle(datum: Datum, target: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean): void; + stopDragging(): void; + getAnchor(): _ModuleSupport.FloatingToolbarAnchor; + getCursor(): string; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + protected updateHandles(datum: Datum, coords: _ModuleSupport.Vec4, bbox?: _ModuleSupport.BBox): void; + protected updateAnchor(_datum: Datum, coords: _ModuleSupport.Vec4, context: AnnotationContext, _bbox?: _ModuleSupport.BBox): void; + protected getHandleCoords(_datum: Datum, coords: _ModuleSupport.Vec4, handle: StartEndHandle, _bbox?: _ModuleSupport.BBox): _ModuleSupport.Vec2; + protected getHandleStyles(datum: Datum, _handle?: 'start' | 'end'): AgAnnotationHandleStyles; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/textualPointScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/textualPointScene.d.ts new file mode 100644 index 000000000..2fe425710 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/textualPointScene.d.ts @@ -0,0 +1,32 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import type { TextualPointProperties } from '../properties/textualPointProperties'; +import { PointScene } from './pointScene'; +export declare abstract class TextualPointScene extends PointScene { + activeHandle?: string; + protected readonly label: _ModuleSupport.Text; + protected anchor: _ModuleSupport.FloatingToolbarAnchor; + private textInputBBox?; + setTextInputBBox(bbox?: _ModuleSupport.BBox): void; + update(datum: Datum, context: AnnotationContext): void; + copy(datum: Datum, copiedDatum: Datum, context: AnnotationContext): Datum; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + protected getTextBBox(datum: Datum, coords: _ModuleSupport.Vec2, _context: AnnotationContext): _ModuleSupport.BBox; + protected updateLabel(datum: Datum, bbox: _ModuleSupport.BBox): void; + protected updateShape(_datum: Datum, _bbox: _ModuleSupport.BBox): void; + protected updateAnchor(_datum: Datum, bbox: _ModuleSupport.BBox, context: AnnotationContext): { + x: number; + y: number; + position: "right" | "above" | "above-left" | "below" | undefined; + }; + protected getLabelCoords(_datum: Datum, bbox: _ModuleSupport.BBox): _ModuleSupport.Vec2; + protected getTextBaseline(datum: Datum): CanvasTextBaseline; + protected getHandleCoords(_datum: Datum, _coords: _ModuleSupport.Vec2, bbox: _ModuleSupport.BBox): _ModuleSupport.Vec2; + protected getHandleStyles(datum: Datum): { + fill: string | undefined; + stroke: string | undefined; + strokeOpacity: number | undefined; + strokeWidth: number | undefined; + }; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/textualStartEndScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/textualStartEndScene.d.ts new file mode 100644 index 000000000..f203e884d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/textualStartEndScene.d.ts @@ -0,0 +1,19 @@ +import { type AgAnnotationHandleStyles, _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import type { TextualStartEndProperties } from '../properties/textualStartEndProperties'; +import { StartEndScene } from './startEndScene'; +export declare abstract class TextualStartEndScene extends StartEndScene { + activeHandle?: 'start' | 'end'; + protected readonly label: _ModuleSupport.Text; + protected anchor: _ModuleSupport.FloatingToolbarAnchor; + protected textInputBBox?: _ModuleSupport.BBox; + setTextInputBBox(bbox?: _ModuleSupport.BBox): void; + update(datum: Datum, context: AnnotationContext): void; + containsPoint(x: number, y: number): boolean; + getNodeAtCoords(x: number, y: number): string | undefined; + protected getTextBBox(datum: Datum, coords: _ModuleSupport.Vec4): _ModuleSupport.BBox; + protected updateLabel(datum: Datum, bbox: _ModuleSupport.BBox, coords: _ModuleSupport.Vec4): void; + protected updateShape(_datum: Datum, _textBBox: _ModuleSupport.BBox, _coords: _ModuleSupport.Vec4): void; + protected getLabelCoords(_datum: Datum, _bbox: _ModuleSupport.BBox, coords: _ModuleSupport.Vec4): _ModuleSupport.Vec2; + protected getHandleStyles(datum: Datum, handle?: 'start' | 'end'): AgAnnotationHandleStyles; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/withBackgroundScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/withBackgroundScene.d.ts new file mode 100644 index 000000000..2b8cf23c2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/scenes/withBackgroundScene.d.ts @@ -0,0 +1,13 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { FillOptions } from 'ag-charts-types'; +import type { AnnotationContext } from '../annotationTypes'; +import type { AnnotationScene } from './annotationScene'; +export declare class WithBackgroundScene { + static updateBackground(this: AnnotationScene & { + background: _ModuleSupport.Path; + getBackgroundStyles?(datum: Datum): FillOptions; + getBackgroundPoints(datum: Datum, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4, bounds: _ModuleSupport.Vec4): Array<_ModuleSupport.Vec2>; + }, datum: Datum, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4, context: AnnotationContext): void; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/settings-dialog/settingsDialog.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/settings-dialog/settingsDialog.d.ts new file mode 100644 index 000000000..250a58013 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/settings-dialog/settingsDialog.d.ts @@ -0,0 +1,55 @@ +import { type AgAnnotationLineStyleType, _ModuleSupport } from 'ag-charts-community'; +import { EventEmitter } from 'ag-charts-core'; +import type { ColorPickerOptions } from '../../../components/color-picker/colorPicker'; +import { Dialog, type DialogOptions } from '../../../components/dialog/dialog'; +import { type ChannelTextPosition, type FibonacciBands, type LineTextAlignment, type LineTextPosition } from '../annotationTypes'; +import type { ChannelPropertiesType, EphemeralPropertiesType, FibonacciPropertiesType, LinePropertiesType, MeasurerPropertiesType } from '../annotationsSuperTypes'; +export interface LinearSettingsDialogOptions extends DialogOptions { + initialSelectedTab: 'line' | 'text'; + onChangeLine: (props: LinearSettingsDialogLineChangeProps) => void; + onChangeText: (props: LinearSettingsDialogTextChangeProps) => void; + onChangeFillColor: Required['onChange']; + onChangeHideFillColor: Required['onChangeHide']; + onChangeLineColor: Required['onChange']; + onChangeHideLineColor: Required['onChangeHide']; + onChangeLineStyleType: (lineStyleType: AgAnnotationLineStyleType) => void; + onChangeLineStyleWidth: (strokeWidth: number) => void; + onChangeTextColor: Required['onChange']; + onChangeHideTextColor: Required['onChangeHide']; + onChangeTextFontSize: (fontSize: number) => void; +} +export interface LinearSettingsDialogLineChangeProps { + extendStart?: boolean; + extendEnd?: boolean; + extendAbove?: boolean; + extendBelow?: boolean; + extendLeft?: boolean; + extendRight?: boolean; + reverse?: boolean; + showFill?: boolean; + bands?: FibonacciBands; +} +export interface LinearSettingsDialogTextChangeProps { + alignment?: LineTextAlignment; + position?: LineTextPosition | ChannelTextPosition; + label?: string; +} +type LinearDialogPropertiesType = Exclude; +interface EventMap { + hidden: null; +} +export declare class AnnotationSettingsDialog extends Dialog { + readonly events: EventEmitter; + constructor(ctx: _ModuleSupport.ModuleContext); + show(datum: LinearDialogPropertiesType, options: LinearSettingsDialogOptions): void; + private createLinearLineTab; + private createLinearTextTab; + private createColorPickerInput; + private createStrokeWidthSelect; + private createFibonacciRatioSelect; + private createLineStyleRadioGroup; + private createFontSizeSelect; + private createPositionRadioGroup; + private createAlignmentRadioGroup; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/dragState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/dragState.d.ts new file mode 100644 index 000000000..ff3ae1c4d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/dragState.d.ts @@ -0,0 +1,20 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext } from '../annotationTypes'; +import type { AnnotationProperties, AnnotationsStateMachineContext } from '../annotationsSuperTypes'; +import type { AnnotationStateEvents } from './stateTypes'; +declare const StateMachine: typeof _ModuleSupport.StateMachine; +export declare class DragStateMachine void; + drag: (datum: Datum, offset: _ModuleSupport.Vec2, context: AnnotationContext, snapping: boolean) => void; + stopDragging: () => void; +}> extends StateMachine<'idle' | 'dragging', Pick> { + debug: import("packages/ag-charts-community/dist/types/src/util/debug").DebugLogger; + protected hasMoved: boolean; + protected dragStart?: _ModuleSupport.Vec2; + protected snapping: boolean; + protected datum?: Datum; + protected node?: Node; + private offset?; + constructor(ctx: AnnotationsStateMachineContext); +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/pointState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/pointState.d.ts new file mode 100644 index 000000000..d3181a146 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/pointState.d.ts @@ -0,0 +1,16 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationsCreateStateMachineContext } from '../annotationsSuperTypes'; +import type { PointProperties } from '../properties/pointProperties'; +import type { PointScene } from '../scenes/pointScene'; +import type { AnnotationStateEvents } from './stateTypes'; +declare const StateMachine: typeof _ModuleSupport.StateMachine; +interface PointStateMachineContext extends Omit { + create: (datum: Datum) => void; +} +export declare abstract class PointStateMachine> extends StateMachine<'start' | 'waiting-first-render', Pick> { + debug: import("packages/ag-charts-community/dist/types/src/util/debug").DebugLogger; + protected node?: Node; + constructor(ctx: PointStateMachineContext); + protected abstract createDatum(): Datum; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/stateTypes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/stateTypes.d.ts new file mode 100644 index 000000000..199285b8a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/stateTypes.d.ts @@ -0,0 +1,89 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext, AnnotationLineStyle, AnnotationOptionsColorPickerType, AnnotationType, Point } from '../annotationTypes'; +import type { LinearSettingsDialogLineChangeProps, LinearSettingsDialogTextChangeProps } from '../settings-dialog/settingsDialog'; +export type AnnotationStateEvents = InteractionEvents & ActionEvents & DataEvents & ProcessEvents & Record; +type InteractionEvents = { + click: { + point: Point; + shiftKey: boolean; + bbox?: _ModuleSupport.BBox; + textInputValue?: string; + }; + dblclick: { + offset: _ModuleSupport.Vec2; + }; + drag: { + context: AnnotationContext; + offset: _ModuleSupport.Vec2; + point: Point; + shiftKey: boolean; + bbox?: _ModuleSupport.BBox; + textInputValue?: string; + }; + dragStart: { + context: AnnotationContext; + offset: _ModuleSupport.Vec2; + point: Point; + bbox: _ModuleSupport.BBox | undefined; + textInputValue: string | undefined; + }; + dragEnd: undefined; + hover: { + context: AnnotationContext; + offset: _ModuleSupport.Vec2; + point: Point; + shiftKey: boolean; + }; + keyDown: { + context: AnnotationContext; + shiftKey: boolean; + }; + keyUp: { + context: AnnotationContext; + shiftKey: boolean; + }; + textInput: { + bbox: _ModuleSupport.BBox | undefined; + context: AnnotationContext; + key: string; + shiftKey: boolean; + textInputValue: string | undefined; + }; + resize: { + bbox: _ModuleSupport.BBox; + textInputValue?: string; + }; +}; +type ActionEvents = { + copy: undefined; + cut: undefined; + paste: undefined; + translate: { + translation: _ModuleSupport.Vec2; + }; + translateEnd: undefined; + color: { + colorPickerType: AnnotationOptionsColorPickerType; + colorOpacity: string; + color: string; + opacity: number; + isMultiColor: boolean; + }; + fontSize: number; + lineProps: LinearSettingsDialogLineChangeProps; + lineStyle: AnnotationLineStyle; + lineText: LinearSettingsDialogTextChangeProps; + toolbarPressSettings: Event; + updateTextInputBBox: _ModuleSupport.BBox | undefined; +}; +type DataEvents = { + cancel: undefined; + delete: undefined; + deleteAll: undefined; + reset: undefined; + selectLast: undefined; +}; +type ProcessEvents = { + render: undefined; +}; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/textualPointState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/textualPointState.d.ts new file mode 100644 index 000000000..d442e5dd2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/textualPointState.d.ts @@ -0,0 +1,17 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationsCreateStateMachineContext } from '../annotationsSuperTypes'; +import type { TextualPointProperties } from '../properties/textualPointProperties'; +import type { TextualPointScene } from '../scenes/textualPointScene'; +import type { AnnotationStateEvents } from './stateTypes'; +declare const StateMachine: typeof _ModuleSupport.StateMachine; +interface TextualPointStateMachineContext extends Omit { + create: (datum: Datum) => void; +} +export declare abstract class TextualPointStateMachine> extends StateMachine<'start' | 'waiting-first-render' | 'edit', Pick> { + debug: import("packages/ag-charts-community/dist/types/src/util/debug").DebugLogger; + protected datum?: Datum; + protected node?: Node; + constructor(ctx: TextualPointStateMachineContext); + protected abstract createDatum(): Datum; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/textualStartEndState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/textualStartEndState.d.ts new file mode 100644 index 000000000..fcb8c00f3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/textualStartEndState.d.ts @@ -0,0 +1,21 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationsStateMachineContext } from '../annotationsSuperTypes'; +import type { TextualStartEndProperties } from '../properties/textualStartEndProperties'; +import type { TextualStartEndScene } from '../scenes/textualStartEndScene'; +import type { AnnotationStateEvents } from './stateTypes'; +declare const StateMachine: typeof _ModuleSupport.StateMachine; +interface TextualStartEndStateMachineContext extends Omit { + create: (datum: Datum) => void; + delete: () => void; + showTextInput: () => void; + deselect: () => void; + showAnnotationOptions: () => void; +} +export declare abstract class TextualStartEndStateMachine> extends StateMachine<'start' | 'waiting-first-render' | 'edit' | 'end', Pick> { + debug: import("packages/ag-charts-community/dist/types/src/util/debug").DebugLogger; + protected datum?: Datum; + protected node?: Node; + constructor(ctx: TextualStartEndStateMachineContext); + protected abstract createDatum(): Datum; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/textualStateUtils.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/textualStateUtils.d.ts new file mode 100644 index 000000000..aea16d5e1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/states/textualStateUtils.d.ts @@ -0,0 +1,7 @@ +export declare function guardCancelAndExit({ key }: { + key: string; +}): boolean; +export declare function guardSaveAndExit({ key, shiftKey }: { + key: string; + shiftKey: boolean; +}): boolean; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textConfig.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textConfig.d.ts new file mode 100644 index 000000000..9cdeccc66 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textConfig.d.ts @@ -0,0 +1,4 @@ +import type { AnnotationTypeConfig } from '../annotationsSuperTypes'; +import { TextProperties } from './textProperties'; +import { TextScene } from './textScene'; +export declare const textConfig: AnnotationTypeConfig; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textProperties.d.ts new file mode 100644 index 000000000..a98f61bb1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textProperties.d.ts @@ -0,0 +1,7 @@ +import { AnnotationType } from '../annotationTypes'; +import { TextualPointProperties } from '../properties/textualPointProperties'; +export declare class TextProperties extends TextualPointProperties { + static is(this: void, value: unknown): value is TextProperties; + type: AnnotationType.Text; + position: "bottom"; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textScene.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textScene.d.ts new file mode 100644 index 000000000..b09325c4f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textScene.d.ts @@ -0,0 +1,10 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +import { AnnotationType } from '../annotationTypes'; +import { TextualPointScene } from '../scenes/textualPointScene'; +import type { TextProperties } from './textProperties'; +export declare class TextScene extends TextualPointScene { + static is(value: unknown): value is TextScene; + type: AnnotationType; + constructor(); + protected getHandleCoords(_datum: TextProperties, point: _ModuleSupport.Vec2): _ModuleSupport.Vec2; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textState.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textState.d.ts new file mode 100644 index 000000000..a3715272e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/textState.d.ts @@ -0,0 +1,6 @@ +import { TextualPointStateMachine } from '../states/textualPointState'; +import { TextProperties } from './textProperties'; +import type { TextScene } from './textScene'; +export declare class TextStateMachine extends TextualPointStateMachine { + protected createDatum(): TextProperties; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/util.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/util.d.ts new file mode 100644 index 000000000..5f503af6a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/text/util.d.ts @@ -0,0 +1,19 @@ +import { type TextAlign, _ModuleSupport } from 'ag-charts-community'; +import { type FontOptions } from 'ag-charts-core'; +export type AnnotationTextPosition = 'top' | 'center' | 'bottom'; +export type AnnotationTextAlignment = 'left' | 'center' | 'right'; +type TextOptions = FontOptions & { + textAlign: TextAlign; + position: AnnotationTextPosition; +}; +export declare const ANNOTATION_TEXT_LINE_HEIGHT = 1.38; +export declare function maybeWrapText(options: TextOptions, text: string, maxWidth: number): string; +export declare function getBBox(options: TextOptions & { + width?: number; +}, text: string, coords: _ModuleSupport.Vec2, bbox?: _ModuleSupport.BBox): _ModuleSupport.BBox; +export declare function updateTextNode(node: _ModuleSupport.Text, text: string, isPlaceholder: boolean, config: TextOptions & { + visible?: boolean; + color?: string; + getPlaceholderColor: () => string | undefined; +}, { x, y }: _ModuleSupport.Vec2, textBaseline?: CanvasTextBaseline): void; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/axis.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/axis.d.ts new file mode 100644 index 000000000..ba3234004 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/axis.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare function calculateAxisLabelPadding(axisLayout: _ModuleSupport.AxisLayout): number; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/coords.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/coords.d.ts new file mode 100644 index 000000000..4ba2e3dca --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/coords.d.ts @@ -0,0 +1,29 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext, Point } from '../annotationTypes'; +export declare function snapPoint(offset: _ModuleSupport.Vec2, context: AnnotationContext, snapping?: boolean, origin?: Point, angleStep?: number): { + x: any; + y: any; +}; +export declare function snapToAngle(vector: _ModuleSupport.Vec2, center: _ModuleSupport.Vec2, step: number): _ModuleSupport.Vec2; +export declare function getDragStartState(points: Record, context: AnnotationContext): Record; +/** + * Translate an collection of vectors by the given translation. Clamp the vectors as a group within the series area. + * + * @param vectors The collection of vectors to translate. + * @param translation The translation to apply to the vectors. + * @param context Annotation context. + * @param options.overflowContinuous The tolerance for how many vectors can overflow before the group is clamped. + * @param options.snap Snap by which vector and at what angle. + * @param options.translateVectors Which vectors should be considered as currently translating. + * @param options.invertYVectors Invert the y-axis translation for these vectors. + * @returns A collection of translated points in domain space. + */ +export declare function translate(vectors: Record, translation: _ModuleSupport.Vec2, context: AnnotationContext, options?: { + overflowContinuous: number; + translateVectors?: VectorName[]; + invertYVectors?: VectorName[]; + snap?: { + vectors: Record; + angle: number; + }; +}): Record; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/fibonacci.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/fibonacci.d.ts new file mode 100644 index 000000000..521641392 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/fibonacci.d.ts @@ -0,0 +1,22 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +import type { AnnotationContext, FibonacciBands } from '../annotationTypes'; +export declare enum FibonacciNodeTag { + OneLine = 0, + HorizontalLine = 1 +} +type FibonacciRangeLabel = _ModuleSupport.Vec4 & { + text: string; +}; +export interface FibonacciRangeDatum extends _ModuleSupport.Vec4 { + id: any; + tag: FibonacciNodeTag; + label: FibonacciRangeLabel; +} +export declare function getFibonacciCoords(coords1: _ModuleSupport.Vec4, coords2?: _ModuleSupport.Vec4): { + x1: number; + x2: number; + y1: number; + y2: number; +}; +export declare function createFibonacciRangesData({ x1, y1, x2, y2 }: _ModuleSupport.Vec4, context: AnnotationContext, reverse: boolean, yZero: number, bands?: FibonacciBands): FibonacciRangeDatum[]; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/has.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/has.d.ts new file mode 100644 index 000000000..984e4f134 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/has.d.ts @@ -0,0 +1,9 @@ +import type { AnnotationProperties, ChannelPropertiesType, EphemeralPropertiesType, LinePropertiesType, MeasurerPropertiesType, TextualPropertiesType } from '../annotationsSuperTypes'; +import { NoteProperties } from '../note/noteProperties'; +export declare function hasFontSize(datum?: AnnotationProperties): datum is Exclude; +export declare function hasLineStyle(datum?: AnnotationProperties): datum is Exclude; +export declare function hasLineColor(datum?: AnnotationProperties): boolean; +export declare function hasIconColor(datum?: AnnotationProperties): boolean; +export declare function hasFillColor(datum?: AnnotationProperties): boolean; +export declare function hasTextColor(datum?: AnnotationProperties): boolean; +export declare function hasLineText(datum?: AnnotationProperties): datum is Exclude; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/layout.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/layout.d.ts new file mode 100644 index 000000000..30e69949d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/layout.d.ts @@ -0,0 +1,19 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export type PositionedScene = Vec2Scene | Vec4Scene; +type Vec2Scene = _ModuleSupport.Node & { + x: number; + y: number; +}; +type Vec4Scene = _ModuleSupport.Node & { + x: number; + y: number; + x1: number; + y1: number; + x2: number; + y2: number; +}; +export declare function layoutScenesRow(scenes: Array>, startX?: number, gap?: number): void; +export declare function layoutScenesColumn(scenes: Array>, startY?: number, gap?: number): void; +export declare function layoutAddX(scene: PositionedScene, x: number): void; +export declare function layoutAddY(scene: PositionedScene, y: number): void; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/line.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/line.d.ts new file mode 100644 index 000000000..3360dd69d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/line.d.ts @@ -0,0 +1,9 @@ +import { type AgAnnotationLineStyleType, type PixelSize, _ModuleSupport } from 'ag-charts-community'; +export declare function getLineStyle(lineDash?: PixelSize[], lineStyle?: AgAnnotationLineStyleType): AgAnnotationLineStyleType; +export declare function getComputedLineDash(strokeWidth: number, styleType: AgAnnotationLineStyleType): PixelSize[]; +export declare function getLineDash(lineDash?: PixelSize[], computedLineDash?: PixelSize[], lineStyle?: AgAnnotationLineStyleType, strokeWidth?: number): PixelSize[] | undefined; +export declare function getLineCap(lineCap?: _ModuleSupport.ShapeLineCap, lineDash?: PixelSize[], lineStyle?: AgAnnotationLineStyleType): _ModuleSupport.ShapeLineCap | undefined; +/** + * Find the pair of points where a line intersects a bounding box. + */ +export declare function boundsIntersections(coords: _ModuleSupport.Vec4, bounds: _ModuleSupport.BBox): [_ModuleSupport.Vec2, _ModuleSupport.Vec2]; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/lineWithText.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/lineWithText.d.ts new file mode 100644 index 000000000..6b4a3d7b0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/lineWithText.d.ts @@ -0,0 +1,22 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { ChannelTextProperties, LineTextProperties } from '../annotationProperties'; +import type { CollidableLine } from '../scenes/collidableLineScene'; +import { CollidableText } from '../scenes/collidableTextScene'; +interface Numbers { + left: _ModuleSupport.Vec2; + right: _ModuleSupport.Vec2; + inset: _ModuleSupport.Vec2; + offset: _ModuleSupport.Vec2; + normal: _ModuleSupport.Vec2; + angle: number; +} +export declare function updateLineText(id: string, line: CollidableLine, coords: _ModuleSupport.Vec4, textProperties?: Partial, textNode?: CollidableText, text?: string, lineWidth?: number): { + clipMask: { + x: number; + y: number; + radius: number; + }; + numbers: Numbers; +} | undefined; +export declare function updateChannelText(offsetInsideTextLabel: boolean, top: _ModuleSupport.Vec4, bottom: _ModuleSupport.Vec4, textProperties: ChannelTextProperties, lineWidth?: number, textNode?: CollidableText, text?: string): void; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/scale.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/scale.d.ts new file mode 100644 index 000000000..210e48ea3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/scale.d.ts @@ -0,0 +1,9 @@ +type ValueType = number | string | Date | undefined; +export type GroupingValueType = { + value: ValueType; + groupPercentage: number; +}; +export type PointType = ValueType | GroupingValueType; +export declare function getGrouping(d: PointType | undefined): GroupingValueType; +export declare function getGroupingValue(d: PointType | undefined): ValueType; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/styles.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/styles.d.ts new file mode 100644 index 000000000..a60211108 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/styles.d.ts @@ -0,0 +1,5 @@ +import type { AnnotationLineStyle, AnnotationOptionsColorPickerType } from '../annotationTypes'; +import type { AnnotationProperties, ChannelPropertiesType, LinePropertiesType, MeasurerPropertiesType } from '../annotationsSuperTypes'; +export declare function setFontSize(datum: AnnotationProperties, fontSize: number): void; +export declare function setLineStyle(datum: LinePropertiesType | ChannelPropertiesType | MeasurerPropertiesType, style?: AnnotationLineStyle): void; +export declare function setColor(datum: AnnotationProperties, colorPickerType: AnnotationOptionsColorPickerType, colorOpacity: string, color: string, opacity: number, isMultiColor: boolean): void; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/types.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/types.d.ts new file mode 100644 index 000000000..e2517f335 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/types.d.ts @@ -0,0 +1,7 @@ +import type { ChannelPropertiesType, EphemeralPropertiesType, FibonacciPropertiesType, LinePropertiesType, MeasurerPropertiesType, TextualPropertiesType } from '../annotationsSuperTypes'; +export declare function isEphemeralType(datum: unknown): datum is EphemeralPropertiesType; +export declare function isLineType(datum: unknown): datum is LinePropertiesType; +export declare function isChannelType(datum: unknown): datum is ChannelPropertiesType; +export declare function isFibonacciType(datum: unknown): datum is FibonacciPropertiesType; +export declare function isTextType(datum: unknown): datum is TextualPropertiesType; +export declare function isMeasurerType(datum: unknown): datum is MeasurerPropertiesType; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/update.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/update.d.ts new file mode 100644 index 000000000..bc488dbe3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/update.d.ts @@ -0,0 +1,3 @@ +import type { AnnotationContext } from '../annotationTypes'; +import type { AnnotationProperties, AnnotationScene } from '../annotationsSuperTypes'; +export declare function updateAnnotation(node: AnnotationScene, datum: AnnotationProperties, context: AnnotationContext): void; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/validation.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/validation.d.ts new file mode 100644 index 000000000..6f67e29fe --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/validation.d.ts @@ -0,0 +1,16 @@ +import { type Direction } from 'ag-charts-community'; +import type { AnnotationContext, Point } from '../annotationTypes'; +export declare function validateDatumLine(context: AnnotationContext, datum: { + start: Point; + end: Point; +}, options?: { + overflowContinuous: boolean; +}, warningPrefix?: string): boolean; +export declare function validateDatumValue(context: AnnotationContext, datum: { + value?: Point['x' | 'y']; + direction?: Direction; +}, warningPrefix?: string): boolean; +export declare function validateDatumPoint(context: AnnotationContext, point: Point, options?: { + overflowContinuous: boolean; +}, warningPrefix?: string): boolean; +export declare function isPoint(point: Point | undefined): point is Point; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/values.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/values.d.ts new file mode 100644 index 000000000..a68a68d04 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/annotations/utils/values.d.ts @@ -0,0 +1,22 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +import type { PointProperties } from '../annotationProperties'; +import type { AnnotationAxisContext, AnnotationContext, Point } from '../annotationTypes'; +export declare function convertLine(datum: { + start: Pick; + end: Pick; +}, context: AnnotationContext): { + x1: number; + y1: number; + x2: number; + y2: number; +} | undefined; +export declare function convertPoint(point: Point, context: AnnotationContext): { + x: number; + y: number; +}; +export declare function convert(p: Point['x' | 'y'], context: Pick): number; +export declare function invertCoords(coords: _ModuleSupport.Vec2, context: AnnotationContext): { + x: any; + y: any; +}; +export declare function invert(n: _ModuleSupport.Vec2['x' | 'y'], context: Pick): any; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/background/background.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/background/background.d.ts new file mode 100644 index 000000000..678abb5ef --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/background/background.d.ts @@ -0,0 +1,7 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { Image } from '../image/image'; +export declare class Background extends _ModuleSupport.Background { + image: Image; + protected onLayoutComplete(event: _ModuleSupport.LayoutCompleteEvent): void; + protected onImageLoad(): void; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/background/backgroundModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/background/backgroundModule.d.ts new file mode 100644 index 000000000..2d3d3c2e2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/background/backgroundModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const BackgroundModule: _ModuleSupport.RootModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/background/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/background/main.d.ts new file mode 100644 index 000000000..68d34d853 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/background/main.d.ts @@ -0,0 +1 @@ +export * from './backgroundModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/band-highlight/bandHighlight.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/band-highlight/bandHighlight.d.ts new file mode 100644 index 000000000..bd492b31d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/band-highlight/bandHighlight.d.ts @@ -0,0 +1,38 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type InternalAgColorType } from 'ag-charts-core'; +export declare class BandHighlight extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + private readonly ctx; + readonly id: string; + enabled: boolean; + stroke?: string; + lineDash?: number[]; + lineDashOffset: number; + strokeWidth: number; + strokeOpacity: number; + fill: InternalAgColorType; + fillOpacity: number; + readonly fillGradientDefaults: _ModuleSupport.FillGradientDefaults; + readonly fillPatternDefaults: _ModuleSupport.FillPatternDefaults; + readonly fillImageDefaults: _ModuleSupport.FillImageDefaults; + private readonly axisCtx; + private bounds; + private axisLayout?; + private readonly bandHighlightGroup; + private readonly rangeNode; + private activeAxisHighlight?; + constructor(ctx: _ModuleSupport.ModuleContextWithParent<_ModuleSupport.AxisContext>); + private axisChange; + private isHover; + private onClick; + private clearAllHighlight; + private onKeyPress; + private onHoverLikeEvent; + private handleHoverHighlight; + private layout; + private updateBand; + private isVertical; + private onHighlightChange; + private updateBandPosition; + private showBand; + private hideBand; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/band-highlight/bandHighlightModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/band-highlight/bandHighlightModule.d.ts new file mode 100644 index 000000000..9dd162733 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/band-highlight/bandHighlightModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const BandHighlightModule: _ModuleSupport.AxisOptionModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/band-highlight/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/band-highlight/main.d.ts new file mode 100644 index 000000000..f3fbd724a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/band-highlight/main.d.ts @@ -0,0 +1 @@ +export * from './bandHighlightModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/chart-toolbar/chartToolbar.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/chart-toolbar/chartToolbar.d.ts new file mode 100644 index 000000000..55c233d46 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/chart-toolbar/chartToolbar.d.ts @@ -0,0 +1,14 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare class ChartToolbar extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + private readonly ctx; + enabled: boolean; + private readonly toolbar; + private readonly menu; + constructor(ctx: _ModuleSupport.ModuleContext); + private onLayoutStart; + private onButtonPressed; + private updateButton; + private hidePopover; + private setChartType; + private getChartType; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/chart-toolbar/chartToolbarModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/chart-toolbar/chartToolbarModule.d.ts new file mode 100644 index 000000000..94fb5a602 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/chart-toolbar/chartToolbarModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const ChartToolbarModule: _ModuleSupport.Module; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/chart-toolbar/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/chart-toolbar/main.d.ts new file mode 100644 index 000000000..2729d8db9 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/chart-toolbar/main.d.ts @@ -0,0 +1 @@ +export { ChartToolbarModule } from './chartToolbarModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenu.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenu.d.ts new file mode 100644 index 000000000..56eef0af3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenu.d.ts @@ -0,0 +1,33 @@ +import type { AgContextMenuItem } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +export declare class ContextMenu extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + readonly ctx: _ModuleSupport.ModuleContext; + enabled: boolean; + darkTheme: boolean; + readonly items: readonly Readonly[]; + private readonly interactionManager; + private pickedNode; + private pickedLegendItem?; + private showEvent; + private x; + private y; + private collapsingSubMenus; + private readonly element; + private readonly menuWidget; + private readonly mutationObserver?; + constructor(ctx: _ModuleSupport.ModuleContext); + private expandItemsOptions; + private onContext; + private show; + private hide; + private onCollapse; + private onSubMenuExpand; + private onSubMenuCollapse; + private createMenu; + private createMenuItems; + private createButtonOnClick; + private initTableCells; + private initButtonElement; + private reposition; + destroy(): void; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenuItem.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenuItem.d.ts new file mode 100644 index 000000000..ff808412f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenuItem.d.ts @@ -0,0 +1,16 @@ +import type { AgContextMenuItem, AgContextMenuItemShowOn, AgContextMenuItemType, _ModuleSupport } from 'ag-charts-community'; +type Options = Partial<_ModuleSupport.ContextMenuItemContractNonRecursive>; +export declare function expandItems(showing: AgContextMenuItemShowOn, registry: _ModuleSupport.ContextMenuRegistry, items: readonly Readonly[], result: ContextMenuItem[]): void; +export declare class ContextMenuItem implements _ModuleSupport.ContextMenuItemContract { + type: AgContextMenuItemType; + showOn: AgContextMenuItemShowOn; + label: string; + iconUrl: string | undefined; + enabled: boolean; + items: ContextMenuItem[]; + action: _ModuleSupport.ContextMenuItemContract['action']; + constructor(options?: Options); + private setField; + setOptions(options: Options): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenuModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenuModule.d.ts new file mode 100644 index 000000000..71103aa3e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenuModule.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const ContextMenuModule: _ModuleSupport.Module; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenuStyles.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenuStyles.d.ts new file mode 100644 index 000000000..4c861beaa --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/contextMenuStyles.d.ts @@ -0,0 +1 @@ +export declare const DEFAULT_CONTEXT_MENU_CLASS = "ag-charts-context-menu"; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/main.d.ts new file mode 100644 index 000000000..7eeee1bb0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/context-menu/main.d.ts @@ -0,0 +1 @@ +export * from './contextMenuModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/crosshair.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/crosshair.d.ts new file mode 100644 index 000000000..5c99488c4 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/crosshair.d.ts @@ -0,0 +1,45 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { CrosshairLabelProperties } from './crosshairLabel'; +export declare class Crosshair extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + private readonly ctx; + readonly id: string; + enabled: boolean; + stroke?: string; + lineDash?: number[]; + lineDashOffset: number; + strokeWidth: number; + strokeOpacity: number; + snap: boolean; + readonly label: CrosshairLabelProperties; + private readonly labels; + private readonly axisCtx; + private seriesRect; + private bounds; + private axisLayout?; + private readonly crosshairGroup; + protected readonly lineGroup: _ModuleSupport.Group; + protected lineGroupSelection: _ModuleSupport.Selection<_ModuleSupport.Line, any>; + private activeHighlight?; + constructor(ctx: _ModuleSupport.ModuleContextWithParent<_ModuleSupport.AxisContext>); + private layout; + private updateSelections; + private updateLabels; + private updateLabel; + private updateLines; + private isVertical; + private isHover; + private formatValue; + private onClick; + private onMouseHoverLike; + private onMouseOut; + private onKeyPress; + private onHighlightChange; + private isInRange; + private updatePositions; + private getData; + private getActiveHighlightData; + private getLabelHtml; + private showLabel; + private hideCrosshairs; + private hideLabel; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/crosshairLabel.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/crosshairLabel.d.ts new file mode 100644 index 000000000..273470f93 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/crosshairLabel.d.ts @@ -0,0 +1,34 @@ +import type { AgCrosshairLabelFormatterParams, AgCrosshairLabelRendererParams, AgCrosshairLabelRendererResult, ContextDefault, Formatter, FormatterParams } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +type StyleValue = string | number | undefined; +export declare class CrosshairLabelProperties extends BaseProperties implements _ModuleSupport.AxisFormattableLabel, FormatterParams> { + enabled: boolean; + xOffset: number; + yOffset: number; + formatter?: Formatter>; + format?: string; + renderer?: (params: AgCrosshairLabelRendererParams) => string | AgCrosshairLabelRendererResult; + private _cachedFormatter; + formatValue(callWithContext: (formatter: (params: AgCrosshairLabelFormatterParams) => string | undefined, params: AgCrosshairLabelFormatterParams) => string | undefined, type: 'number' | 'date' | 'category', value: any, params: FormatterParams): string | undefined; +} +export declare class CrosshairLabel extends CrosshairLabelProperties { + private readonly domManager; + private readonly id; + private readonly element; + constructor(domManager: _ModuleSupport.DOMManager, key: string, axisId: string); + show(meta: Point): void; + setLabelHtml({ html, styles }: { + html?: string; + styles?: Record; + }): void; + getBBox(): _ModuleSupport.BBox; + toggle(visible?: boolean): void; + destroy(): void; + toLabelHtml(input: string | AgCrosshairLabelRendererResult, defaults?: AgCrosshairLabelRendererResult): { + html: string; + styles: Record; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/crosshairModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/crosshairModule.d.ts new file mode 100644 index 000000000..333872e3c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/crosshairModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const CrosshairModule: _ModuleSupport.AxisOptionModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/main.d.ts new file mode 100644 index 000000000..72a154b91 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/crosshair/main.d.ts @@ -0,0 +1 @@ +export * from './crosshairModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/data-source/dataSource.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/data-source/dataSource.d.ts new file mode 100644 index 000000000..36a5000a3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/data-source/dataSource.d.ts @@ -0,0 +1,12 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AgDataSourceCallbackParams } from 'ag-charts-types'; +export declare class DataSource extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + enabled: boolean; + getData: (params: AgDataSourceCallbackParams) => Promise; + requestThrottle?: number; + updateThrottle?: number; + updateDuringInteraction?: boolean; + private readonly dataService; + constructor(ctx: _ModuleSupport.ModuleContext); + private updateCallback; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/data-source/dataSourceModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/data-source/dataSourceModule.d.ts new file mode 100644 index 000000000..5b7598d23 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/data-source/dataSourceModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const DataSourceModule: _ModuleSupport.Module; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/data-source/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/data-source/main.d.ts new file mode 100644 index 000000000..55dcc1b6f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/data-source/main.d.ts @@ -0,0 +1 @@ +export { DataSourceModule } from './dataSourceModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBar.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBar.d.ts new file mode 100644 index 000000000..bcdee773d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBar.d.ts @@ -0,0 +1,52 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import { ErrorBarProperties } from './errorBarProperties'; +type PickNodeDatumResult = _ModuleSupport.PickNodeDatumResult; +type PropertyDefinitionOpts = Parameters<_ModuleSupport.SeriesOptionInstance['getPropertyDefinitions']>[0]; +export declare class ErrorBars extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.SeriesOptionInstance { + private readonly cartesianSeries; + private readonly groupNode; + private readonly selection; + readonly properties: ErrorBarProperties; + private dataModel?; + private processedData?; + constructor(ctx: _ModuleSupport.SeriesContext); + private hasErrorBars; + private isStacked; + private getUnstackPropertyDefinition; + private getStackPropertyDefinition; + getPropertyDefinitions(opts: PropertyDefinitionOpts): _ModuleSupport.PropertyDefinition[]; + private onDataProcessed; + getDomain(direction: _ModuleSupport.ChartAxisDirection.X | _ModuleSupport.ChartAxisDirection.Y): any[]; + private onDataUpdate; + private getNodeData; + private createNodeData; + private getMaybeFlippedKeys; + private static getDatumKey; + private getDatum; + private convert; + private update; + private updateNode; + pickNodeExact(point: Point): PickNodeDatumResult; + pickNodeNearest(point: Point): PickNodeDatumResult; + pickNodeMainAxisFirst(point: Point, majorDirection: _ModuleSupport.ChartAxisDirection): PickNodeDatumResult | undefined; + getTooltipParams(): { + xLowerKey: string | undefined; + xLowerName: string | undefined; + xUpperKey: string | undefined; + xUpperName: string | undefined; + yLowerKey: string | undefined; + yLowerName: string | undefined; + yUpperKey: string | undefined; + yUpperName: string | undefined; + }; + private onToggleSeriesItem; + private makeStyle; + private getDefaultStyle; + private getHighlightStyle; + private restyleHighlightChange; + private onHighlightChange; + private errorBarFactory; + private getWhiskerProperties; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarModule.d.ts new file mode 100644 index 000000000..14d71b04c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const ErrorBarsModule: _ModuleSupport.SeriesOptionModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarNode.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarNode.d.ts new file mode 100644 index 000000000..fc151d93c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarNode.d.ts @@ -0,0 +1,34 @@ +import type { AgErrorBarOptions, AgErrorBarThemeableOptions } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { HighlightState } from 'ag-charts-types'; +type NearestResult = _ModuleSupport.NearestResult; +export type ErrorBarNodeDatum = _ModuleSupport.CartesianSeriesNodeDatum & _ModuleSupport.ErrorBoundSeriesNodeDatum; +export type ErrorBarStylingOptions = Omit; +type FormatOptions = Pick, 'xLowerKey' | 'xUpperKey' | 'yLowerKey' | 'yUpperKey' | 'itemStyler'>; +type Caller = { + callWithContext O>(callback: F, params: I): O; + callWithContext O | undefined>(callback: F, params: I): O | undefined; +}; +export declare class ErrorBarNode extends _ModuleSupport.Group { + private readonly whiskerPath; + private readonly capsPath; + private capLength; + private readonly bboxes; + protected _datum: ErrorBarNodeDatum | undefined; + get datum(): ErrorBarNodeDatum | undefined; + set datum(datum: ErrorBarNodeDatum | undefined); + constructor(); + private calculateCapLength; + private getItemStylerParams; + private formatStyles; + private applyStyling; + update(style: AgErrorBarThemeableOptions, formatters: FormatOptions, caller: Caller, highlighted: boolean, highlightState: HighlightState): void; + updateBBoxes(): void; + containsPoint(x: number, y: number): boolean; + pickNode(x: number, y: number): _ModuleSupport.Node | undefined; + nearestSquared(x: number, y: number, maxDistance: number): NearestResult<_ModuleSupport.Node>; +} +export declare class ErrorBarGroup extends _ModuleSupport.Group { + nearestSquared(x: number, y: number): _ModuleSupport.PickNodeDatumResult; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarProperties.d.ts new file mode 100644 index 000000000..a546d65d5 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarProperties.d.ts @@ -0,0 +1,31 @@ +import { type AgErrorBarItemStylerParams, type AgErrorBarOptions, type AgErrorBarThemeableOptions, type ErrorBarCapOptions, type Styler, _ModuleSupport } from 'ag-charts-community'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +declare class ErrorBarCap extends BaseProperties { + visible?: boolean; + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + lineDash?: number[]; + lineDashOffset?: number; + length?: number; + lengthRatio?: number; +} +export declare class ErrorBarProperties extends BaseProperties> { + yLowerKey?: string; + yLowerName?: string; + yUpperKey?: string; + yUpperName?: string; + xLowerKey?: string; + xLowerName?: string; + xUpperKey?: string; + xUpperName?: string; + visible?: boolean; + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + lineDash?: number[]; + lineDashOffset?: number; + itemStyler?: Styler, AgErrorBarThemeableOptions>; + cap: ErrorBarCap; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarTheme.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarTheme.d.ts new file mode 100644 index 000000000..e74e5e981 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/error-bar/errorBarTheme.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const ERROR_BARS_THEME: _ModuleSupport.SeriesOptionModule['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/foreground/foreground.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/foreground/foreground.d.ts new file mode 100644 index 000000000..e1ce97cdf --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/foreground/foreground.d.ts @@ -0,0 +1,11 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { Image } from '../image/image'; +export declare class Foreground extends _ModuleSupport.Background { + image: Image; + fill?: string; + fillOpacity?: number; + protected createNode(): _ModuleSupport.Group; + protected onLayoutComplete(event: _ModuleSupport.LayoutCompleteEvent): void; + protected onImageLoad(): void; + private updateTextNode; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/foreground/foregroundModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/foreground/foregroundModule.d.ts new file mode 100644 index 000000000..14351eaee --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/foreground/foregroundModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const ForegroundModule: _ModuleSupport.RootModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/foreground/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/foreground/main.d.ts new file mode 100644 index 000000000..fbf58ea8d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/foreground/main.d.ts @@ -0,0 +1 @@ +export * from './foregroundModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/image/image.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/image/image.d.ts new file mode 100644 index 000000000..d2aeb0d86 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/image/image.d.ts @@ -0,0 +1,23 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +export declare class Image extends BaseProperties { + top?: number; + right?: number; + bottom?: number; + left?: number; + width?: number; + height?: number; + opacity: number; + url?: string; + private readonly imageElement; + private loadedSynchronously; + readonly node: _ModuleSupport.Image; + constructor(); + get complete(): boolean; + private containerWidth; + private containerHeight; + onLoad?: () => void; + performLayout(containerWidth: number, containerHeight: number): _ModuleSupport.Placement; + private readonly onImageLoad; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/miniChart.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/miniChart.d.ts new file mode 100644 index 000000000..d575f57cf --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/miniChart.d.ts @@ -0,0 +1,39 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { MiniChartGroup } from './shapes/miniChartGroup'; +declare class MiniChartPadding { + top: number; + bottom: number; +} +export declare class MiniChart extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + private readonly ctx; + enabled: boolean; + inset: number; + cornerRadius: number; + readonly padding: MiniChartPadding; + readonly root: _ModuleSupport.Group; + readonly seriesRoot: MiniChartGroup; + readonly axisGridGroup: _ModuleSupport.Group; + readonly axisGroup: _ModuleSupport.Group; + readonly axisLabelGroup: _ModuleSupport.Group; + readonly axisCrosslineRangeGroup: _ModuleSupport.Group; + readonly axisCrosslineLineGroup: _ModuleSupport.Group; + readonly axisCrosslineLabelGroup: _ModuleSupport.Group; + data: any; + private _destroyed; + private miniChartAnimationPhase; + protected seriesRect?: _ModuleSupport.BBox; + axes: _ModuleSupport.ChartAxis[]; + series: _ModuleSupport.UnknownSeries[]; + constructor(ctx: _ModuleSupport.ModuleContext); + destroy(): void; + private onSeriesChange; + protected destroySeries(allSeries: _ModuleSupport.UnknownSeries[]): void; + protected assignSeriesToAxes(): void; + protected assignAxesToSeries(): void; + private findMatchingAxis; + updateData(data: any): void; + processData(dataController: _ModuleSupport.DataController): Promise; + computeAxisPadding(): _ModuleSupport.Padding; + layout(width: number, height: number): Promise; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigator.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigator.d.ts new file mode 100644 index 000000000..e63e52ceb --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigator.d.ts @@ -0,0 +1,42 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { MiniChart } from './miniChart'; +import { type NavigatorButtonType } from './navigatorDOMProxy'; +import { RangeHandle } from './shapes/rangeHandle'; +import { RangeMask } from './shapes/rangeMask'; +declare const BaseModuleInstance: typeof _ModuleSupport.BaseModuleInstance; +export declare class Navigator extends BaseModuleInstance implements _ModuleSupport.ModuleInstance { + private readonly ctx; + miniChart?: MiniChart; + enabled: boolean; + mask: RangeMask; + minHandle: RangeHandle; + maxHandle: RangeHandle; + private readonly maskVisibleRange; + height: number; + cornerRadius: number; + spacing: number; + protected x: number; + protected y: number; + protected width: number; + private readonly rangeSelector; + private panStart?; + private readonly domProxy; + constructor(ctx: _ModuleSupport.ModuleContext); + updateBackground(oldGroup?: _ModuleSupport.Group, newGroup?: _ModuleSupport.Group): void; + private updateGroupVisibility; + protected onLayoutStart(ctx: _ModuleSupport.LayoutContext): void; + onLayoutComplete(opts: _ModuleSupport.LayoutCompleteEvent): void; + private canDrag; + onDragStart(dragging: NavigatorButtonType, { offsetX }: { + offsetX: number; + }): void; + onDrag(dragging: NavigatorButtonType, { offsetX }: { + offsetX: number; + }): void; + private onZoomChange; + private layoutNodes; + private updateZoom; + updateData(data: any): void | undefined; + processData(dataController: _ModuleSupport.DataController): Promise; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorDOMProxy.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorDOMProxy.d.ts new file mode 100644 index 000000000..5aa0bfb38 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorDOMProxy.d.ts @@ -0,0 +1,39 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type BoxBounds } from 'ag-charts-core'; +export type NavigatorButtonType = 'min' | 'max' | 'pan'; +type SliderDragHandlers = { + onDragStart(type: NavigatorButtonType, event: { + offsetX: number; + }): void; + onDrag(type: NavigatorButtonType, event: { + offsetX: number; + }): void; +}; +type NavigatorDOMProxyModuleContext = Pick<_ModuleSupport.ModuleContext, 'zoomManager' | 'proxyInteractionService' | 'localeManager' | 'contextMenuRegistry'>; +export declare class NavigatorDOMProxy { + private readonly ctx; + private readonly sliderHandlers; + _min: number; + _max: number; + readonly minRange = 0.001; + private dragStartX; + private readonly toolbar; + private readonly sliders; + constructor(ctx: NavigatorDOMProxyModuleContext, sliderHandlers: SliderDragHandlers); + destroy(): void; + updateVisibility(visible: boolean): void; + updateZoom(): void; + updateBounds(bounds: BoxBounds): void; + updateSliderBounds(sliderIndex: number, bounds: BoxBounds): void; + updateMinMax(min: number, max: number): void; + private updateSliderRatios; + private toCanvasOffsets; + private moveToFront; + private onDragStart; + private onDrag; + private onContextMenu; + private onPanSliderChange; + private onMinSliderChange; + private onMaxSliderChange; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorModule.d.ts new file mode 100644 index 000000000..12284d243 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const NavigatorModule: _ModuleSupport.RootModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorOptionsDefs.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorOptionsDefs.d.ts new file mode 100644 index 000000000..2bad90085 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorOptionsDefs.d.ts @@ -0,0 +1,15 @@ +import { type OptionsDefs } from 'ag-charts-core'; +import type { AgNavigatorHandleOptions, AgNavigatorOptions, BarIgnoredProperties, BoxPlotIgnoredProperties, BubbleIgnoredProperties, CommonIgnoredProperties, HeatmapIgnoredProperties, HistogramIgnoredProperties, LineIgnoredProperties, RangeAreaIgnoredProperties, RangeBarIgnoredProperties, ScatterIgnoredProperties, WaterfallIgnoredProperties } from 'ag-charts-types'; +export declare const navigatorHandleOptionsDef: OptionsDefs; +export declare const commonIgnoredMiniChartProperties: CommonIgnoredProperties[]; +export declare const barIgnoredMiniChartProperties: BarIgnoredProperties[]; +export declare const boxPlotIngnoredMiniChartProperties: BoxPlotIgnoredProperties[]; +export declare const bubbleIgnoredMiniChartProperties: BubbleIgnoredProperties[]; +export declare const heatmapIgnoredMiniChartProperties: HeatmapIgnoredProperties[]; +export declare const histogramIgnoredMiniChartProperties: HistogramIgnoredProperties[]; +export declare const lineIgnoredMiniChartProperties: LineIgnoredProperties[]; +export declare const rangeAreaIgnoredMiniChartProperties: RangeAreaIgnoredProperties[]; +export declare const rangeBarIgnoredMiniChartProperties: RangeBarIgnoredProperties[]; +export declare const scatterIgnoredMiniChartProperties: ScatterIgnoredProperties[]; +export declare const waterfallIgnoredMiniChartProperties: WaterfallIgnoredProperties[]; +export declare const navigatorOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorTheme.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorTheme.d.ts new file mode 100644 index 000000000..52ff99dbc --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/navigatorTheme.d.ts @@ -0,0 +1,2 @@ +import { type AgNavigatorOptions, type WithThemeParams } from 'ag-charts-community'; +export declare const NAVIGATOR_THEME: WithThemeParams; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/miniChartGroup.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/miniChartGroup.d.ts new file mode 100644 index 000000000..45340a183 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/miniChartGroup.d.ts @@ -0,0 +1,8 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const TranslatableGroup: typeof _ModuleSupport.TranslatableGroup; +export declare class MiniChartGroup extends TranslatableGroup { + inset: number; + cornerRadius: number; + protected applyClip(ctx: _ModuleSupport.CanvasContext, clipRect: _ModuleSupport.BBox): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/rangeHandle.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/rangeHandle.d.ts new file mode 100644 index 000000000..e0e8233a8 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/rangeHandle.d.ts @@ -0,0 +1,18 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare class RangeHandle extends _ModuleSupport.Path { + static readonly className = "RangeHandle"; + zIndex: number; + private centerX; + private centerY; + width: number; + height: number; + cornerRadius: number; + grip: boolean; + private readonly gripPath; + setCenter(x: number, y: number): void; + static align(minHandle: RangeHandle, maxHandle: RangeHandle, x: number, y: number, width: number, height: number, min: number, max: number, pixelAlign: number): void; + protected computeBBox(): _ModuleSupport.BBox; + isPointInPath(x: number, y: number): boolean; + updatePath(): void; + protected renderFill(ctx: _ModuleSupport.CanvasContext, path?: Path2D): void; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/rangeMask.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/rangeMask.d.ts new file mode 100644 index 000000000..1e81c686e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/rangeMask.d.ts @@ -0,0 +1,20 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const Path: typeof _ModuleSupport.Path; +export declare class RangeMask extends Path { + static readonly className = "RangeMask"; + cornerRadius: number; + zIndex: number; + private x; + private y; + private width; + private height; + private min; + private max; + private readonly visiblePath; + layout(x: number, y: number, width: number, height: number, min: number, max: number): void; + protected computeBBox(): _ModuleSupport.BBox; + computeVisibleRangeBBox(): _ModuleSupport.BBox; + updatePath(): void; + protected renderStroke(ctx: _ModuleSupport.CanvasContext, path?: Path2D): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/rangeSelector.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/rangeSelector.d.ts new file mode 100644 index 000000000..a338da3e8 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/navigator/shapes/rangeSelector.d.ts @@ -0,0 +1,14 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare class RangeSelector extends _ModuleSupport.Group { + private readonly background; + private x; + private y; + private width; + private height; + private lOffset; + private rOffset; + constructor(children: _ModuleSupport.Node[]); + layout(x: number, y: number, width: number, height: number, lOffset: number, rOffset: number): void; + updateBackground(oldGroup?: _ModuleSupport.Group, newGroup?: _ModuleSupport.Group): void; + protected computeBBox(): _ModuleSupport.BBox; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/ranges/ranges.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/ranges/ranges.d.ts new file mode 100644 index 000000000..f9d2b806b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/ranges/ranges.d.ts @@ -0,0 +1,15 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { RangesButtonProperties } from './rangesButtonProperties'; +export declare class Ranges extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + private readonly ctx; + enabled: boolean; + buttons: _ModuleSupport.PropertiesArray; + private readonly container; + private readonly toolbar; + private readonly verticalSpacing; + constructor(ctx: _ModuleSupport.ModuleContext); + private teardown; + private onLayoutStart; + private onZoomChanged; + private onButtonPress; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/ranges/rangesButtonProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/ranges/rangesButtonProperties.d.ts new file mode 100644 index 000000000..79b2bd443 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/ranges/rangesButtonProperties.d.ts @@ -0,0 +1,7 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const ToolbarButtonProperties: typeof _ModuleSupport.ToolbarButtonProperties; +type RangesButtonValue = number | [Date | number, Date | number] | ((start: Date | number, end: Date | number) => [Date | number, Date | number]); +export declare class RangesButtonProperties extends ToolbarButtonProperties { + value: RangesButtonValue; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/ranges/rangesModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/ranges/rangesModule.d.ts new file mode 100644 index 000000000..00d625603 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/ranges/rangesModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const RangesModule: _ModuleSupport.Module; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/shared-toolbar/sharedToolbar.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/shared-toolbar/sharedToolbar.d.ts new file mode 100644 index 000000000..a46025acf --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/shared-toolbar/sharedToolbar.d.ts @@ -0,0 +1,20 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { SharedToolbarSection } from './sharedToolbarTypes'; +export interface SharedToolbarWithSection extends Pick<_ModuleSupport.Toolbar, 'destroy' | 'addListener' | 'removeListener' | 'setHidden' | 'addToolbarListener' | 'updateButtons' | 'updateButtonByIndex' | 'toggleActiveButtonByIndex' | 'toggleButtonEnabledByIndex' | 'clearActiveButton'> { + layout: (layoutBox: _ModuleSupport.BBox, padding?: number) => void; +} +export declare class SharedToolbar extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + private readonly ctx; + static readonly SECTION_ORDER: Array; + private readonly container; + private sharedToolbar?; + private readonly activeSections; + private readonly sectionButtons; + private firstLayoutSection?; + constructor(ctx: _ModuleSupport.ModuleContext); + getSharedToolbar(section: SharedToolbarSection): SharedToolbarWithSection; + private createSharedToolbar; + private toolbarWithSection; + private getIndex; + private getSectionIndex; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/shared-toolbar/sharedToolbarModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/shared-toolbar/sharedToolbarModule.d.ts new file mode 100644 index 000000000..d43ea0088 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/shared-toolbar/sharedToolbarModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const SharedToolbarModule: _ModuleSupport.ContextModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/shared-toolbar/sharedToolbarTypes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/shared-toolbar/sharedToolbarTypes.d.ts new file mode 100644 index 000000000..1792ef9af --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/shared-toolbar/sharedToolbarTypes.d.ts @@ -0,0 +1 @@ +export type SharedToolbarSection = 'annotations' | 'chartToolbar'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/status-bar/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/status-bar/main.d.ts new file mode 100644 index 000000000..816b152eb --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/status-bar/main.d.ts @@ -0,0 +1 @@ +export { StatusBarModule } from './statusBarModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/status-bar/statusBar.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/status-bar/statusBar.d.ts new file mode 100644 index 000000000..ef66f04df --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/status-bar/statusBar.d.ts @@ -0,0 +1,36 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +declare class StatusBarBackground extends BaseProperties { + fill: string; + fillOpacity: number; +} +export declare class StatusBar extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance, _ModuleSupport.ScopeProvider { + private readonly ctx; + enabled: boolean; + openKey?: string; + highKey?: string; + lowKey?: string; + closeKey?: string; + volumeKey?: string; + readonly title: _ModuleSupport.Label; + readonly positive: _ModuleSupport.Label; + readonly negative: _ModuleSupport.Label; + readonly neutral: _ModuleSupport.Label; + readonly altNeutral: _ModuleSupport.Label; + readonly background: StatusBarBackground; + layoutStyle: 'block' | 'overlay'; + readonly id = "status-bar"; + data?: any[]; + private readonly highlightManager; + private readonly layer; + private readonly labelGroup; + private readonly backgroundNode; + private readonly labels; + constructor(ctx: _ModuleSupport.ModuleContext); + processData(dataController: _ModuleSupport.DataController): Promise; + private startPerformLayout; + private onLayoutComplete; + private updateHighlight; + private getChartType; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/status-bar/statusBarModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/status-bar/statusBarModule.d.ts new file mode 100644 index 000000000..cbe30127e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/status-bar/statusBarModule.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const StatusBarModule: _ModuleSupport.RootModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/sync/chartSync.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/sync/chartSync.d.ts new file mode 100644 index 000000000..79a0dc3b3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/sync/chartSync.d.ts @@ -0,0 +1,42 @@ +import { type AgChartSyncOptions, _ModuleSupport } from 'ag-charts-community'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +export declare class ChartSync extends BaseProperties implements _ModuleSupport.ModuleInstance, AgChartSyncOptions { + protected moduleContext: _ModuleSupport.ModuleContext; + static readonly className = "Sync"; + enabled: boolean; + groupId?: string; + axes: 'x' | 'y' | 'xy'; + nodeInteraction: boolean; + zoom: boolean; + domainMode: 'direction' | 'position' | 'key'; + private readonly domainSync; + constructor(moduleContext: _ModuleSupport.ModuleContext); + updateSiblings(groupId?: string): void; + private updateChart; + private disableZoomSync?; + private enabledZoomSync; + private onZoom; + private disableNodeInteractionSync?; + private enabledNodeInteractionSync; + private onHighlightChange; + private findMatchingHighlightNodes; + private findMatchingNodes; + private dispatchHighlightUpdate; + getSyncedDomain(axis: unknown): Promise; + private updateDomainState; + private validateAxis; + private validateMultiSeries; + private validateSingleSeries; + private calculateDerivedDomain; + private calculateKeyDerivedDomain; + removeAxis(axis: unknown): void; + private waitForDomainsToBeReady; + private prepareZoomUpdate; + private onEnabledChange; + private onGroupIdChange; + private onAxesChange; + private onNodeInteractionChange; + private onZoomChange; + destroy(): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/sync/pluginModules.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/sync/pluginModules.d.ts new file mode 100644 index 000000000..1cb1df046 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/sync/pluginModules.d.ts @@ -0,0 +1,5 @@ +import type { PluginModuleDefinition } from 'ag-charts-core'; +import type { AgAnnotationsOptions, AgInitialStateOptions, AgNavigatorOptions } from 'ag-charts-types'; +export declare const AnnotationsModule: PluginModuleDefinition; +export declare const NavigatorModule: PluginModuleDefinition; +export declare const InitialStateModule: PluginModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/sync/syncModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/sync/syncModule.d.ts new file mode 100644 index 000000000..1bab3a25e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/sync/syncModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const SyncModule: _ModuleSupport.RootModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/text-input/textInput.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/text-input/textInput.d.ts new file mode 100644 index 000000000..d630b13c6 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/text-input/textInput.d.ts @@ -0,0 +1,40 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { FontOptions, TextAlign } from 'ag-charts-types'; +import type { AnnotationTextPosition } from '../annotations/text/util'; +interface Layout { + getTextInputCoords: (height: number) => _ModuleSupport.Vec2; + getTextPosition: () => AnnotationTextPosition; + alignment: 'left' | 'center' | 'right'; + textAlign: TextAlign; + width?: number; +} +export declare class TextInput extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + readonly ctx: _ModuleSupport.ModuleContext; + private readonly element; + private layout; + private visible; + constructor(ctx: _ModuleSupport.ModuleContext); + setKeyDownHandler(handler: (e: KeyboardEvent) => unknown): void; + show(opts: { + anchor?: { + x: number; + y: number; + }; + text?: string; + placeholderText?: string; + styles?: FontOptions & { + placeholderColor?: string; + }; + layout?: Layout; + onChange?: (text: string, bbox: _ModuleSupport.BBox) => void; + onClose?: (text: string) => void; + }): void; + hide(): void; + isVisible(): boolean; + updateColor(color: string): void; + updateFontSize(fontSize: number): _ModuleSupport.BBox | undefined; + getValue(): string | undefined; + private updatePosition; + getBBox(): _ModuleSupport.BBox; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/main.d.ts new file mode 100644 index 000000000..0eef897cb --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/main.d.ts @@ -0,0 +1 @@ +export * from './zoomModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/scenes/zoomRect.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/scenes/zoomRect.d.ts new file mode 100644 index 000000000..b3184e814 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/scenes/zoomRect.d.ts @@ -0,0 +1,9 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare class ZoomRect extends _ModuleSupport.Rect { + static readonly className = "ZoomRect"; + fill: string; + fillOpacity: number; + zIndex: _ModuleSupport.ZIndexMap; + updateValid(): void; + updateInvalid(): void; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoom.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoom.d.ts new file mode 100644 index 000000000..b9534ca8a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoom.d.ts @@ -0,0 +1,115 @@ +import { type AgZoomAnchorPoint, type AgZoomAxisDraggingMode, _ModuleSupport } from 'ag-charts-community'; +import { ZoomToolbar } from './zoomToolbar'; +import type { DefinedZoomState } from './zoomTypes'; +interface ZoomAutoScale { + enabled: boolean; + padding: number; +} +declare class ZoomAutoScaling extends _ModuleSupport.BaseProperties implements ZoomAutoScale { + protected onChange: (opts: ZoomAutoScale) => void; + constructor(onChange: (opts: ZoomAutoScale) => void); + enabled: boolean; + padding: number; +} +export declare class Zoom extends _ModuleSupport.BaseModuleInstance implements _ModuleSupport.ModuleInstance { + private readonly ctx; + enabled: boolean; + enableAxisDragging: boolean; + enableAxisScrolling: boolean; + enableDoubleClickToReset: boolean; + enableIndependentAxes?: boolean; + enablePanning: boolean; + enableScrolling: boolean; + enableSelecting: boolean; + enableTwoFingerZoom: boolean; + panKey: 'alt' | 'ctrl' | 'meta' | 'shift'; + axes: 'x' | 'y' | 'xy'; + scrollingStep: number; + keepAspectRatio: boolean; + minVisibleItems: number; + anchorPointX: AgZoomAnchorPoint; + anchorPointY: AgZoomAnchorPoint; + readonly autoScaling: ZoomAutoScaling; + axisDraggingMode: AgZoomAxisDraggingMode; + private readonly canResetZoom; + buttons: ZoomToolbar; + private seriesRect?; + private paddedRect?; + private readonly axisDragger; + private readonly contextMenu; + private readonly panner; + private readonly selector; + private readonly scroller; + private readonly scrollPanner; + private readonly twoFingers; + private readonly domProxy; + private activeAxis?; + deceleration: number | 'off' | 'short' | 'long'; + private dragState; + private shouldFlipXY?; + private readonly isState; + private destroyContextMenuActions; + private isFirstWheelEvent; + private wasFirstWheelEventZoomCapped?; + private firstWheelEventDirection?; + private readonly debouncedWheelReset; + constructor(ctx: _ModuleSupport.ModuleContext); + private teardown; + private onEnabledChange; + private isIgnoredTouch; + private onSeriesAreaDoubleClick; + private onSeriesAreaHoverEvent; + private onSeriesAreaClickEvent; + private shouldHandleAxisHover; + private shouldHandleAxisClick; + private clearHoveredAxis; + private tryBeginAxisDelegation; + private onSeriesAreaDragStart; + private onSeriesAreaDragMove; + private onSeriesAreaDragEnd; + private handleAxisDragEnd; + private handleRegularDragEnd; + private resetDragState; + private onAxisDoubleClick; + private onAxisDragStart; + private onAxisDragMove; + private onAxisDragEnd; + private onNavZoom; + private onWheel; + private onWheelPanning; + private onWheelScrolling; + private onAxisWheel; + private handleWheelScrolling; + private onTouchStart; + private onTouchMove; + private onTouchEnd; + private onProcessData; + private onLayoutComplete; + private onZoomChange; + private onZoomPanStart; + private onPanUpdate; + private isPanningKeyPressed; + private isScalingX; + private isScalingY; + private getAnchorPointX; + private getAnchorPointY; + private constrainZoom; + private previousZoomValid; + private isZoomValid; + private previousAxisZoomValid; + private isAxisZoomValid; + private resetZoom; + updateSyncZoom(zoom: DefinedZoomState): void; + private updateZoom; + private updateUnifiedZoom; + private updatePrimaryAxisZooms; + private updatePrimaryAxisZoom; + private updateAxisZoom; + private updateAxisCursor; + private readonly toggleAxisDraggingCursorsDebounced; + private toggleAxisDraggingCursors; + private getZoom; + private getResetZoom; + private getModuleProperties; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomAxisDragger.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomAxisDragger.d.ts new file mode 100644 index 000000000..1ea6f0b9e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomAxisDragger.d.ts @@ -0,0 +1,13 @@ +import type { AgZoomAnchorPoint } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +export declare class ZoomAxisDragger { + private coords?; + private oldZoom?; + update(event: { + offsetX: number; + offsetY: number; + }, direction: _ModuleSupport.ChartAxisDirection, anchor: AgZoomAnchorPoint, bbox: _ModuleSupport.BBox, zoom?: _ModuleSupport.AxisZoomState, axisZoom?: _ModuleSupport.ZoomState): _ModuleSupport.ZoomState; + stop(): void; + private updateCoords; + private updateZoom; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomContextMenu.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomContextMenu.d.ts new file mode 100644 index 000000000..884df6e17 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomContextMenu.d.ts @@ -0,0 +1,20 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +import type { DefinedZoomState, ZoomProperties } from './zoomTypes'; +export declare class ZoomContextMenu { + private readonly eventsHub; + private readonly contextMenuRegistry; + private readonly zoomManager; + private readonly getModuleProperties; + private readonly canResetZoom; + private readonly getRect; + private readonly updateZoom; + private readonly isZoomValid; + constructor(eventsHub: _ModuleSupport.EventsHub, contextMenuRegistry: _ModuleSupport.ContextMenuRegistry, zoomManager: _ModuleSupport.ZoomManager, getModuleProperties: () => ZoomProperties, canResetZoom: () => boolean, getRect: () => _ModuleSupport.BBox | undefined, updateZoom: (zoom: DefinedZoomState) => void, isZoomValid: (zoom: DefinedZoomState) => boolean); + registerActions(enabled: boolean | undefined): (() => void) | undefined; + private computeOrigin; + private onZoomToHere; + private onPanToHere; + private onResetZoom; + private iterateFindNextZoomAtPoint; + private getNextZoomAtPoint; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomDOMProxy.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomDOMProxy.d.ts new file mode 100644 index 000000000..98e9e40fa --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomDOMProxy.d.ts @@ -0,0 +1,40 @@ +import { _ModuleSupport, _Widget } from 'ag-charts-community'; +import { type BaseStyleTypeMap } from 'ag-charts-core'; +type AxisHit = { + axisId: string; + direction: _ModuleSupport.ChartAxisDirection; +}; +type AxesHandlers = { + onAxisDragStart: (direction: _ModuleSupport.ChartAxisDirection) => void; + onAxisDragMove: (id: string, direction: _ModuleSupport.ChartAxisDirection, event: _Widget.DragWidgetEvent<'drag-move'>) => void; + onAxisDragEnd: () => void; + onAxisDoubleClick: (id: string, direction: _ModuleSupport.ChartAxisDirection) => void; + onAxisWheel: (id: string, direction: _ModuleSupport.ChartAxisDirection, event: _ModuleSupport.WheelWidgetEvent) => void; +}; +export declare class ZoomDOMProxy { + private readonly axesHandlers; + private axes; + private cursor; + private readonly overlappingAxisIds; + private hoveredAxisId; + private activeAxisId; + private seriesRect; + constructor(axesHandlers: AxesHandlers); + destroy(): void; + update(enableAxisDragging: boolean, enableAxisScrolling: boolean, ctx: _ModuleSupport.ModuleContext, seriesRect?: _ModuleSupport.BBox): void; + setAxisCursor(cursor: BaseStyleTypeMap['cursor'] | undefined): void; + toggleAxisDraggingCursor(direction: _ModuleSupport.ChartAxisDirection, enabled: boolean): void; + private updateOverlappingAxisPointerEvents; + private cleanupAxisState; + pickAxisAtPoint(x: number, y: number): AxisHit | undefined; + setHoveredAxis(axisId: string): void; + clearHoveredAxis(): void; + beginDelegatedAxisDrag(axisId: string): boolean; + endDelegatedAxisDrag(axisId: string): void; + hasOverlappingAxes(): boolean; + getHoveredAxis(): AxisHit | undefined; + getCursor(direction: _ModuleSupport.ChartAxisDirection): "pointer" | "default" | "ew-resize" | "ns-resize" | "grab" | "grabbing"; + private initAxis; + private diffAxisIds; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomModule.d.ts new file mode 100644 index 000000000..2b7e253c5 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomModule.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare const ZoomModule: _ModuleSupport.Module; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomPanner.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomPanner.d.ts new file mode 100644 index 000000000..5a95748e9 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomPanner.d.ts @@ -0,0 +1,38 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AxisZoomStates } from './zoomTypes'; +export interface ZoomPanUpdate { + type: 'update'; + deltaX: number; + deltaY: number; +} +declare const decelerationValues: { + off: number; + short: number; + long: number; +}; +export declare class ZoomPanner { + deceleration: number | keyof typeof decelerationValues; + private get decelerationValue(); + private onUpdate; + private coords?; + private direction?; + private coordsMonitorTimeout; + private zoomCoordsHistoryIndex; + private readonly coordsHistory; + private inertiaHandle; + addListener(_type: 'update', fn: (e: ZoomPanUpdate) => void): () => void; + stopInteractions(): void; + update(event: { + currentX: number; + currentY: number; + }): void; + start(direction?: _ModuleSupport.ChartAxisDirection): void; + stop(): void; + private recordCurrentZoomCoords; + private animateInertia; + private updateCoords; + private isPanningX; + private isPanningY; + translateZooms(bbox: _ModuleSupport.BBox, currentZooms: AxisZoomStates, deltaX: number, deltaY: number): AxisZoomStates; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomScrollPanner.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomScrollPanner.d.ts new file mode 100644 index 000000000..3ea507d8f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomScrollPanner.d.ts @@ -0,0 +1,8 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AxisZoomStates } from './zoomTypes'; +export declare class ZoomScrollPanner { + update(event: { + deltaX: number; + }, step: number, bbox: _ModuleSupport.BBox, zooms: AxisZoomStates): AxisZoomStates; + private translateZooms; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomScroller.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomScroller.d.ts new file mode 100644 index 000000000..4ae91f74a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomScroller.d.ts @@ -0,0 +1,7 @@ +import { _ModuleSupport, _Widget } from 'ag-charts-community'; +import type { AxisZoomStates, DefinedZoomState, ZoomProperties } from './zoomTypes'; +export declare class ZoomScroller { + updateAxes(event: _Widget.WheelWidgetEvent, props: ZoomProperties, bbox: _ModuleSupport.BBox, zooms: AxisZoomStates): AxisZoomStates; + update(event: _Widget.WheelWidgetEvent, props: ZoomProperties, bbox: _ModuleSupport.BBox, oldZoom: DefinedZoomState): DefinedZoomState | undefined; + updateDelta(delta: number, props: ZoomProperties, oldZoom: DefinedZoomState): DefinedZoomState; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomSelector.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomSelector.d.ts new file mode 100644 index 000000000..56b857ebf --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomSelector.d.ts @@ -0,0 +1,21 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +import type { ZoomRect } from './scenes/zoomRect'; +import type { DefinedZoomState, ZoomProperties } from './zoomTypes'; +export declare class ZoomSelector { + private readonly rect; + private readonly getZoom; + private readonly isZoomValid; + private coords?; + constructor(rect: ZoomRect, getZoom: () => DefinedZoomState, isZoomValid: (zoom: DefinedZoomState) => boolean); + update(event: { + currentX: number; + currentY: number; + }, props: ZoomProperties, bbox?: _ModuleSupport.BBox): void; + stop(innerBBox?: _ModuleSupport.BBox, bbox?: _ModuleSupport.BBox, currentZoom?: _ModuleSupport.AxisZoomState): DefinedZoomState; + reset(): void; + didUpdate(): boolean; + private updateCoords; + private updateRect; + private createZoomFromCoords; + private getNormalisedDimensions; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomToolbar.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomToolbar.d.ts new file mode 100644 index 000000000..00ff236a0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomToolbar.d.ts @@ -0,0 +1,46 @@ +import { type AgZoomAnchorPoint, _ModuleSupport } from 'ag-charts-community'; +import type { DefinedZoomState, ZoomProperties } from './zoomTypes'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties, ToolbarButtonProperties: typeof _ModuleSupport.ToolbarButtonProperties; +declare class ZoomButtonProperties extends ToolbarButtonProperties { + value: 'reset' | 'zoom-in' | 'zoom-out' | 'pan-left' | 'pan-right' | 'pan-start' | 'pan-end'; + section: string; +} +type ZoomButtonsVisible = 'always' | 'zoomed' | 'hover'; +export declare class ZoomToolbar extends BaseProperties { + private readonly ctx; + private readonly getModuleProperties; + private readonly canResetZoom; + private readonly updateZoom; + private readonly updateAxisZoom; + private readonly resetZoom; + private readonly isZoomValid; + enabled?: boolean; + buttons: _ModuleSupport.PropertiesArray; + visible: ZoomButtonsVisible; + anchorPointX?: AgZoomAnchorPoint; + anchorPointY?: AgZoomAnchorPoint; + private readonly verticalSpacing; + private readonly detectionRange; + private readonly container; + private readonly toolbar; + private readonly cleanup; + private previousZoom?; + constructor(ctx: _ModuleSupport.ModuleContext, getModuleProperties: () => ZoomProperties, canResetZoom: (zoom: Readonly) => boolean, updateZoom: (zoom: DefinedZoomState) => void, updateAxisZoom: (axisId: string, direction: _ModuleSupport.CartesianAxisDirection, partialZoom: _ModuleSupport.ZoomState | undefined) => void, resetZoom: () => void, isZoomValid: (zoom: DefinedZoomState) => boolean); + destroy(): void; + toggleVisibleZoomed(maxZoom: boolean): void; + private teardown; + private onLayoutComplete; + private onHover; + private onLeave; + private toggleVisibility; + private readonly toggleButtonsDebounced; + private toggleButtons; + private onButtonPress; + private onButtonFocus; + private onButtonPressAxis; + private onButtonPressUnified; + private getNextZoomStateUnified; + private getAnchorPointX; + private getAnchorPointY; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomTwoFingers.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomTwoFingers.d.ts new file mode 100644 index 000000000..d14a690a9 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomTwoFingers.d.ts @@ -0,0 +1,13 @@ +import type { _ModuleSupport, _Widget } from 'ag-charts-community'; +type AxisZoomState = _ModuleSupport.AxisZoomState; +type DefinedZoomState = _ModuleSupport.DefinedZoomState; +export declare class ZoomTwoFingers { + private readonly touchStart; + private readonly initialZoom; + private readonly previous; + start(event: _Widget.TouchWidgetEvent<'touchstart'>, target: _Widget.Widget, zoom: AxisZoomState): boolean; + update(event: _Widget.TouchWidgetEvent<'touchmove'>, target: _Widget.Widget): DefinedZoomState; + end(event: _Widget.TouchWidgetEvent<'touchend' | 'touchcancel'>): boolean; + private twitchTolerantZoomPan4; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomTypes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomTypes.d.ts new file mode 100644 index 000000000..82fc78bb0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomTypes.d.ts @@ -0,0 +1,25 @@ +import type { AgZoomAnchorPoint, _ModuleSupport } from 'ag-charts-community'; +export interface DefinedZoomState extends _ModuleSupport.AxisZoomState { + x: _ModuleSupport.ZoomState; + y: _ModuleSupport.ZoomState; +} +export type ZoomCoords = { + x1: number; + y1: number; + x2: number; + y2: number; +}; +export type AxisZoomStates = Record; +export interface ZoomProperties { + anchorPointX: AgZoomAnchorPoint; + anchorPointY: AgZoomAnchorPoint; + enabled: boolean; + independentAxes: boolean; + isScalingX: boolean; + isScalingY: boolean; + keepAspectRatio: boolean; + scrollingStep: number; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomUtils.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomUtils.d.ts new file mode 100644 index 000000000..04ea0ed72 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/features/zoom/zoomUtils.d.ts @@ -0,0 +1,65 @@ +import type { AgZoomAnchorPoint, _ModuleSupport } from 'ag-charts-community'; +import { type BoxBounds } from 'ag-charts-core'; +import type { DefinedZoomState } from './zoomTypes'; +export declare const UNIT_MIN = 0; +export declare const UNIT_MAX = 1; +export declare const UNIT_SIZE: number; +export declare const DEFAULT_ANCHOR_POINT_X: AgZoomAnchorPoint; +export declare const DEFAULT_ANCHOR_POINT_Y: AgZoomAnchorPoint; +export declare const ZOOM_VALID_CHECK_DEBOUNCE = 300; +export declare function unitZoomState(): DefinedZoomState; +export declare function dx(zoom: DefinedZoomState): number; +export declare function dy(zoom: DefinedZoomState): number; +export declare function isZoomEqual(left: DefinedZoomState, right: DefinedZoomState): boolean; +export declare function isMaxZoom(zoom: DefinedZoomState): boolean; +export declare function definedZoomState(zoom?: _ModuleSupport.AxisZoomState): DefinedZoomState; +/** + * Calculate the position on the series rect as a ratio from the top left corner. Invert the ratio on the y-axis to + * cater for conflicting direction between screen and chart axis systems. Constrains the point to the series + * rect so the zoom is pinned to the edges if the point is over the legends, axes, etc. + */ +export declare function pointToRatio(bbox: BoxBounds, x: number, y: number): { + x: number; + y: number; +}; +/** + * Translate a zoom bounding box by shifting all points by the given x & y amounts. + */ +export declare function translateZoom(zoom: DefinedZoomState, x: number, y: number): DefinedZoomState; +/** + * Scale a zoom bounding box from the top left corner. + */ +export declare function scaleZoom(zoom: DefinedZoomState, sx: number, sy: number): DefinedZoomState; +/** + * Scale a zoom bounding box from the center. + */ +export declare function scaleZoomCenter(zoom: DefinedZoomState, sx: number, sy: number): DefinedZoomState; +/** + * Scale a single zoom axis about its anchor. + */ +export declare function scaleZoomAxisWithAnchor(newState: _ModuleSupport.ZoomState, oldState: _ModuleSupport.ZoomState, anchor: AgZoomAnchorPoint, origin?: number): _ModuleSupport.ZoomState; +export declare function scaleZoomAxisWithPoint(newState: _ModuleSupport.ZoomState, oldState: _ModuleSupport.ZoomState, origin: number): { + min: number; + max: number; +}; +export declare function multiplyZoom(zoom: DefinedZoomState, nx: number, ny: number): { + x: { + min: number; + max: number; + }; + y: { + min: number; + max: number; + }; +}; +/** + * Constrain a zoom bounding box such that no corner exceeds an edge while maintaining the same width and height. + */ +export declare function constrainZoom(zoom: DefinedZoomState): DefinedZoomState; +export declare function constrainAxis(axis: { + min: number; + max: number; +}): { + min: number; + max: number; +}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/gradient-legend/axisTicks.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/gradient-legend/axisTicks.d.ts new file mode 100644 index 000000000..9ad33db61 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/gradient-legend/axisTicks.d.ts @@ -0,0 +1,36 @@ +import { type TextOrSegments, _ModuleSupport } from 'ag-charts-community'; +import type { AgChartLegendPlacement } from 'ag-charts-types'; +interface TickDatum { + tick: any; + tickId: string; + tickLabel: TextOrSegments; + translation: number; +} +interface DataProvider { + data: _ModuleSupport.GradientLegendDatum[]; +} +export declare class AxisTicks { + private readonly ctx; + private readonly dataProvider; + static readonly DefaultTickCount = 5; + static readonly DefaultMinSpacing = 10; + readonly id: string; + protected readonly axisGroup: _ModuleSupport.TranslatableGroup; + protected readonly labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, TickDatum>; + readonly interval: _ModuleSupport.AxisInterval; + readonly label: _ModuleSupport.AxisLabel; + readonly scale: _ModuleSupport.LinearScale; + placement: AgChartLegendPlacement; + translationX: number; + translationY: number; + constructor(ctx: _ModuleSupport.ModuleContext, dataProvider: DataProvider); + private get horizontal(); + attachAxis(axisNode: _ModuleSupport.Group): void; + calculateLayout(): _ModuleSupport.BBox | undefined; + tickFormatter(domain: number[], _ticks: number[], _primary: boolean, fractionDigits?: number): (value: any, index: number) => TextOrSegments | undefined; + inRange(x: number, tolerance?: number): boolean; + padding: number; + private generateTicks; + private getTicksData; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/gradient-legend/gradientLegend.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/gradient-legend/gradientLegend.d.ts new file mode 100644 index 000000000..00c0594a6 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/gradient-legend/gradientLegend.d.ts @@ -0,0 +1,56 @@ +import { type AgChartLegendPosition, type AgGradientLegendOptions, type AgGradientLegendScaleOptions, type Padding, _ModuleSupport } from 'ag-charts-community'; +import { AxisTicks } from './axisTicks'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +declare class GradientBar extends BaseProperties { + thickness: number; + preferredLength: number; +} +declare class GradientLegendScale extends _ModuleSupport.BaseProperties implements Omit { + protected axisTicks: AxisTicks; + constructor(axisTicks: AxisTicks); + label: _ModuleSupport.AxisLabel; + interval: _ModuleSupport.AxisInterval; + padding?: AxisTicks['padding']; +} +export declare class GradientLegend extends _ModuleSupport.BaseProperties { + readonly ctx: _ModuleSupport.ModuleContext; + static readonly className = "GradientLegend"; + readonly id: string; + private readonly axisTicks; + private readonly highlightManager; + private readonly legendGroup; + private readonly containerNode; + private readonly gradientRect; + private readonly arrow; + private readonly ticksGroup; + private readonly cleanup; + enabled: boolean; + position: AgChartLegendPosition; + reverseOrder: boolean; + readonly gradient: GradientBar; + private isVertical; + /** + * Spacing between the legend and the edge of the chart's element. + */ + spacing: number; + border: _ModuleSupport.Border; + cornerRadius: number; + fill?: string; + fillOpacity: number; + padding: Padding; + scale: GradientLegendScale; + data: _ModuleSupport.GradientLegendDatum[]; + constructor(ctx: _ModuleSupport.ModuleContext); + destroy(): void; + attachLegend(scene: _ModuleSupport.Scene): void; + private onStartLayout; + private normalizeColorArrays; + private updateGradientRect; + private updateAxis; + private updateContainer; + private updateArrow; + private getMeasurements; + private getContainerStyles; + private onChartHoverChange; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/gradient-legend/gradientLegendModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/gradient-legend/gradientLegendModule.d.ts new file mode 100644 index 000000000..1d2ceddbe --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/gradient-legend/gradientLegendModule.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const GradientLegendModule: _ModuleSupport.LegendModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/license/licenseManager.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/license/licenseManager.d.ts new file mode 100644 index 000000000..f3c5c9174 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/license/licenseManager.d.ts @@ -0,0 +1,73 @@ +export declare class LicenseManager { + private static readonly RELEASE_INFORMATION; + private static licenseKey?; + private static gridContext; + private watermarkMessage; + private readonly md5; + private readonly document?; + private readonly totalMessageLength; + constructor(document?: Document); + validateLicense(): void; + private static extractExpiry; + private static extractLicenseComponents; + getLicenseDetails(licenseKey: string, gridContext?: boolean): { + licenseKey: never; + valid: boolean; + missing: boolean; + currentLicenseType: string; + incorrectLicenseType?: undefined; + suppliedLicenseType?: undefined; + expiry?: undefined; + expired?: undefined; + version?: undefined; + isTrial?: undefined; + trialExpired?: undefined; + invalidLicenseTypeForCombo?: undefined; + } | { + licenseKey: string; + valid: false; + incorrectLicenseType: boolean; + currentLicenseType: string; + suppliedLicenseType: string | undefined; + missing?: undefined; + expiry?: undefined; + expired?: undefined; + version?: undefined; + isTrial?: undefined; + trialExpired?: undefined; + invalidLicenseTypeForCombo?: undefined; + } | { + licenseKey: string; + valid: true; + expiry: string; + expired: boolean | undefined; + version: string | null; + isTrial: boolean | null; + trialExpired: undefined; + invalidLicenseTypeForCombo: boolean | undefined; + incorrectLicenseType: boolean; + currentLicenseType: string; + suppliedLicenseType: string | undefined; + missing?: undefined; + }; + isDisplayWatermark(): boolean; + getWatermarkMessage(): string; + private getHostname; + private isForceWatermark; + private isWebsiteUrl; + private isLocalhost; + private isE2ETest; + private static formatDate; + private static getChartsReleaseDate; + private static decode; + private static utf8_decode; + static setGridContext(gridContext?: boolean): void; + static setLicenseKey(licenseKey?: string): void; + private static extractBracketedInformation; + private centerPadAndOutput; + private padAndOutput; + private outputInvalidLicenseKey; + private outputExpiredTrialKey; + private outputMissingLicenseKey; + private outputExpiredKey; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/license/md5.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/license/md5.d.ts new file mode 100644 index 000000000..7789bfd10 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/license/md5.d.ts @@ -0,0 +1,18 @@ +export declare class MD5 { + private ieCompatibility; + init(): void; + private md5cycle; + private cmn; + private ff; + private gg; + private hh; + private ii; + private md51; + private md5blk; + private rhex; + private hex; + md5(s: any): any; + private add32; + private add32Std; + private add32Compat; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/license/watermark.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/license/watermark.d.ts new file mode 100644 index 000000000..501bdf58d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/license/watermark.d.ts @@ -0,0 +1,2 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare function injectWatermark(domManager: _ModuleSupport.DOMManager, text: string): void; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/main-modules.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/main-modules.d.ts new file mode 100644 index 000000000..850701ce1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/main-modules.d.ts @@ -0,0 +1,37 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { AngleCategoryAxisModule, AngleNumberAxisModule, OrdinalTimeAxisModule, RadiusCategoryAxisModule, RadiusNumberAxisModule } from './axes/axisModules'; +import { StandaloneChartModule } from './charts/standaloneChartModule'; +import { TopologyChartModule } from './charts/topologyChartModule'; +import { BoxPlotSeriesModule } from './series/box-plot'; +import { CandlestickSeriesModule } from './series/candlestick'; +import { ChordSeriesModule } from './series/chord'; +import { ConeFunnelSeriesModule } from './series/cone-funnel'; +import { FunnelSeriesModule } from './series/funnel'; +import { HeatmapSeriesModule } from './series/heatmap'; +import { LinearGaugeSeriesModule } from './series/linear-gauge/linearGaugeModule'; +import { MapLineSeriesModule } from './series/map-line'; +import { MapLineBackgroundSeriesModule } from './series/map-line-background'; +import { MapMarkerSeriesModule } from './series/map-marker'; +import { MapShapeSeriesModule } from './series/map-shape'; +import { MapShapeBackgroundSeriesModule } from './series/map-shape-background'; +import { NightingaleSeriesModule } from './series/nightingale'; +import { OhlcSeriesModule } from './series/ohlc'; +import { PyramidSeriesModule } from './series/pyramid'; +import { RadarAreaSeriesModule } from './series/radar-area'; +import { RadarLineSeriesModule } from './series/radar-line'; +import { RadialBarSeriesModule } from './series/radial-bar'; +import { RadialColumnSeriesModule } from './series/radial-column'; +import { RadialGaugeSeriesModule } from './series/radial-gauge/radialGaugeModule'; +import { RangeAreaSeriesModule } from './series/range-area'; +import { RangeBarSeriesModule } from './series/range-bar'; +import { SankeySeriesModule } from './series/sankey'; +import { SunburstSeriesModule } from './series/sunburst'; +import { TreemapSeriesModule } from './series/treemap'; +import { WaterfallSeriesModule } from './series/waterfall'; +export declare const ModuleRegistry: typeof _ModuleSupport.ModuleRegistry; +export { OrdinalTimeAxisModule, AngleNumberAxisModule, AngleCategoryAxisModule, RadiusNumberAxisModule, RadiusCategoryAxisModule, BoxPlotSeriesModule, CandlestickSeriesModule, ConeFunnelSeriesModule, FunnelSeriesModule, HeatmapSeriesModule, OhlcSeriesModule, RangeAreaSeriesModule, RangeBarSeriesModule, WaterfallSeriesModule, NightingaleSeriesModule, RadarAreaSeriesModule, RadarLineSeriesModule, RadialBarSeriesModule, RadialColumnSeriesModule, ChordSeriesModule, SankeySeriesModule, LinearGaugeSeriesModule, RadialGaugeSeriesModule, SunburstSeriesModule, TreemapSeriesModule, StandaloneChartModule, PyramidSeriesModule, TopologyChartModule, MapLineSeriesModule, MapLineBackgroundSeriesModule, MapMarkerSeriesModule, MapShapeSeriesModule, MapShapeBackgroundSeriesModule, }; +export declare const AllCartesianEnterpriseModules: (import("packages/ag-charts-core/dist/types/src/main").AxisModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition>)[]; +export declare const AllPolarEnterpriseModules: (import("packages/ag-charts-core/dist/types/src/main").AxisModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").AxisModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").AxisModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").AxisModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition>)[]; +export declare const AllStandaloneEnterpriseModules: (import("packages/ag-charts-core/dist/types/src/main").ChartModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition>)[]; +export declare const AllTopologyEnterpriseModules: (import("packages/ag-charts-core/dist/types/src/main").ChartModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition)[]; +export declare const AllEnterpriseModules: (import("packages/ag-charts-core/dist/types/src/main").AxisModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").AxisModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").AxisModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").AxisModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").AxisModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").ChartModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").ChartModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").PluginModuleDefinition | import("packages/ag-charts-core/dist/types/src/main").PluginModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").PluginModuleDefinition | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition> | import("packages/ag-charts-core/dist/types/src/main").SeriesModuleDefinition>)[]; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/main.d.ts new file mode 100644 index 000000000..58e58ad23 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/main.d.ts @@ -0,0 +1,7 @@ +import type { IntegratedModule } from 'ag-charts-types'; +export * from 'ag-charts-community'; +export declare const LicenseManager: { + setLicenseKey(key: string): void; +}; +export declare function setupEnterpriseModules(): void; +export declare const AgChartsEnterpriseModule: IntegratedModule; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/blotPlotUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/blotPlotUtil.d.ts new file mode 100644 index 000000000..537dae79c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/blotPlotUtil.d.ts @@ -0,0 +1,17 @@ +import type { BoxPlotNode } from './boxPlotNode'; +import type { BoxPlotNodeDatum } from './boxPlotTypes'; +export declare function prepareBoxPlotFromTo(isVertical: boolean): { + from: { + scalingX: number; + scalingY: number; + }; + to: { + scalingX: number; + scalingY: number; + }; +}; +export declare function resetBoxPlotSelectionsScalingCenterFn(isVertical: boolean): (node: BoxPlotNode, datum: BoxPlotNodeDatum) => { + scalingCenterY: number; +} | { + scalingCenterX: number; +}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotModule.d.ts new file mode 100644 index 000000000..ac9531900 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotModule.d.ts @@ -0,0 +1,4 @@ +import { type AgBoxPlotSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const BoxPlotModule: _ModuleSupport.SeriesModule<'box-plot'>; +export declare const BoxPlotSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotNode.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotNode.d.ts new file mode 100644 index 000000000..38eb6fb82 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotNode.d.ts @@ -0,0 +1,44 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const BoxPlotNode_base: new (...args: any[]) => import("packages/ag-charts-community/dist/types/src/scene/transformable").ScalableType<_ModuleSupport.Path>; +export declare class BoxPlotNode extends BoxPlotNode_base { + private readonly wickPath; + horizontal: boolean; + center: number; + thickness: number; + min: number; + q1: number; + median: number; + q3: number; + max: number; + cornerRadius: number; + crisp: boolean; + strokeAlignment: number; + wickStroke: string | undefined; + wickStrokeWidth: number | undefined; + wickStrokeOpacity: number | undefined; + wickLineDash: readonly number[] | undefined; + wickLineDashOffset: number | undefined; + capLengthRatio: number; + wickStrokeAlignment: number; + protected computeBBox(): _ModuleSupport.BBox | undefined; + computeDefaultGradientFillBBox(): _ModuleSupport.BBox; + isPointInPath(x: number, y: number): boolean; + distanceSquared(x: number, y: number): number; + get midPoint(): { + x: number; + y: number; + }; + protected alignedCoordinates(): { + center: number; + x0: number; + x1: number; + min: number; + max: number; + q1: number; + median: number; + q3: number; + }; + updatePath(): void; + drawPath(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotSeries.d.ts new file mode 100644 index 000000000..808327f82 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotSeries.d.ts @@ -0,0 +1,87 @@ +import { type AgBoxPlotSeriesOptions, type AgBoxPlotSeriesStyle, _ModuleSupport } from 'ag-charts-community'; +import { BoxPlotNode } from './boxPlotNode'; +import { BoxPlotSeriesProperties } from './boxPlotSeriesProperties'; +import type { BoxPlotNodeDatum } from './boxPlotTypes'; +interface BoxPlotSeriesNodeDataContext extends _ModuleSupport.AbstractBarSeriesNodeDataContext { + styles: _ModuleSupport.SeriesNodeStyleContext; +} +declare class BoxPlotSeriesNodeEvent extends _ModuleSupport.SeriesNodeEvent { + readonly xKey?: string; + readonly minKey?: string; + readonly q1Key?: string; + readonly medianKey?: string; + readonly q3Key?: string; + readonly maxKey?: string; + constructor(type: TEvent, nativeEvent: Event, datum: BoxPlotNodeDatum, series: BoxPlotSeries); +} +export declare class BoxPlotSeries extends _ModuleSupport.AbstractBarSeries { + static readonly className = "BoxPlotSeries"; + static readonly type: "box-plot"; + properties: BoxPlotSeriesProperties; + protected readonly NodeEvent: typeof BoxPlotSeriesNodeEvent; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + processData(dataController: _ModuleSupport.DataController): Promise; + getSeriesDomain(direction: _ModuleSupport.ChartAxisDirection): any[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, visibleRange: [any, any]): any[]; + createNodeData(): { + itemId: string; + nodeData: BoxPlotNodeDatum[]; + labelData: never[]; + scales: { + x?: _ModuleSupport.Scaling | undefined; + y?: _ModuleSupport.Scaling | undefined; + angle?: _ModuleSupport.Scaling | undefined; + radius?: _ModuleSupport.Scaling | undefined; + }; + groupScale: _ModuleSupport.Scaling | undefined; + visible: boolean; + styles: Record<_ModuleSupport.HighlightState, Required>; + segments: { + stroke?: string | undefined; + strokeWidth?: number | undefined; + strokeOpacity?: number | undefined; + lineDash?: number[] | undefined; + lineDashOffset?: number | undefined; + fill?: import("ag-charts-community").AgColorType | undefined; + fillOpacity?: number | undefined; + clipRect: { + x0: any; + y0: any; + x1: any; + y1: any; + }; + }[] | undefined; + } | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + protected animateEmptyUpdateReady({ datumSelection, }: _ModuleSupport.CartesianAnimationData): void; + protected isLabelEnabled(): boolean; + protected updateDatumSelection(opts: { + nodeData: BoxPlotNodeDatum[]; + datumSelection: _ModuleSupport.Selection; + seriesIdx: number; + }): _ModuleSupport.Selection; + private makeStylerParams; + private getStyle; + private getItemStyle; + private makeItemStylerParams; + protected updateDatumStyles({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection; + isHighlight: boolean; + }): void; + protected updateDatumNodes({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection; + isHighlight: boolean; + }): void; + protected updateLabelNodes(): void; + protected updateLabelSelection(opts: { + labelData: BoxPlotNodeDatum[]; + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, BoxPlotNodeDatum>; + seriesIdx: number; + }): _ModuleSupport.Selection<_ModuleSupport.Text, BoxPlotNodeDatum>; + protected nodeFactory(): BoxPlotNode; + protected computeFocusBounds({ datumIndex }: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotSeriesOptionsDef.d.ts new file mode 100644 index 000000000..2d61c7df1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgBoxPlotSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const boxPlotSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotSeriesProperties.d.ts new file mode 100644 index 000000000..cebf060a8 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotSeriesProperties.d.ts @@ -0,0 +1,44 @@ +import type { AgBoxPlotSeriesItemStylerParams, AgBoxPlotSeriesOptions, AgBoxPlotSeriesStyle, AgBoxPlotSeriesStylerParams, AgBoxPlotSeriesTooltipRendererParams, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties, AbstractBarSeriesProperties: typeof _ModuleSupport.AbstractBarSeriesProperties; +declare class BoxPlotSeriesCap extends BaseProperties { + lengthRatio: number; +} +declare class BoxPlotSeriesWhisker extends BaseProperties { + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + lineDash?: number[]; + lineDashOffset?: number; +} +export declare class BoxPlotSeriesProperties extends AbstractBarSeriesProperties { + xKey: string; + minKey: string; + q1Key: string; + medianKey: string; + q3Key: string; + maxKey: string; + xName?: string; + yName?: string; + minName?: string; + q1Name?: string; + medianName?: string; + q3Name?: string; + maxName?: string; + fill: InternalAgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + cornerRadius: number; + styler?: Styler, AgBoxPlotSeriesStyle>; + itemStyler?: Styler, AgBoxPlotSeriesStyle>; + readonly cap: BoxPlotSeriesCap; + readonly whisker: BoxPlotSeriesWhisker; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + toJson(): AgBoxPlotSeriesOptions; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotThemes.d.ts new file mode 100644 index 000000000..53e6f2b85 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotThemes.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const BOX_PLOT_SERIES_THEME: _ModuleSupport.SeriesModule<'box-plot'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotTypes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotTypes.d.ts new file mode 100644 index 000000000..3d17af705 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/boxPlotTypes.d.ts @@ -0,0 +1,20 @@ +import type { AgBoxPlotSeriesStyle, _ModuleSupport } from 'ag-charts-community'; +export interface BoxPlotNodeDatum extends Omit<_ModuleSupport.CartesianSeriesNodeDatum, 'xValue' | 'yKey' | 'yValue'> { + readonly itemId: string; + readonly bandwidth: number; + readonly scaledValues: { + readonly xValue: number; + readonly minValue: number; + readonly q1Value: number; + readonly medianValue: number; + readonly q3Value: number; + readonly maxValue: number; + }; + readonly focusRect: { + x: number; + y: number; + width: number; + height: number; + }; + style?: Required; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/index.d.ts new file mode 100644 index 000000000..59aada810 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/index.d.ts @@ -0,0 +1 @@ +export { BoxPlotSeriesModule } from './boxPlotModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/main.d.ts new file mode 100644 index 000000000..84702b1af --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/box-plot/main.d.ts @@ -0,0 +1 @@ +export { BoxPlotModule } from './boxPlotModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickModule.d.ts new file mode 100644 index 000000000..b3404119e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickModule.d.ts @@ -0,0 +1,4 @@ +import { type AgCandlestickSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const CandlestickModule: _ModuleSupport.SeriesModule<'candlestick'>; +export declare const CandlestickSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickNode.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickNode.d.ts new file mode 100644 index 000000000..c14fad355 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickNode.d.ts @@ -0,0 +1,14 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { OhlcBaseNode } from '../ohlc/ohlcNode'; +export declare class CandlestickNode extends OhlcBaseNode { + private readonly wickPath; + wickStroke: string | undefined; + wickStrokeWidth: number | undefined; + wickStrokeOpacity: number | undefined; + wickLineDash: readonly number[] | undefined; + wickLineDashOffset: number | undefined; + wickStrokeAlignment: number; + protected computeDefaultGradientFillBBox(): _ModuleSupport.BBox | undefined; + updatePath(): void; + drawPath(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickSeries.d.ts new file mode 100644 index 000000000..f0a071d0c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickSeries.d.ts @@ -0,0 +1,21 @@ +import { type AgCandlestickSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import { type OhlcNodeDatum, OhlcSeriesBase } from '../ohlc/ohlcSeriesBase'; +import { CandlestickNode } from './candlestickNode'; +import { CandlestickSeriesProperties } from './candlestickSeriesProperties'; +export declare class CandlestickSeries extends OhlcSeriesBase> { + static readonly className = "CandleStickSeries"; + static readonly type: "candlestick"; + properties: CandlestickSeriesProperties>; + protected nodeFactory(): CandlestickNode; + protected updateDatumStyles({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection; + isHighlight: boolean; + }): void; + protected updateDatumNodes({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection; + isHighlight: boolean; + }): void; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + protected hasItemStylers(): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickSeriesOptionsDef.d.ts new file mode 100644 index 000000000..1bc8a952c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgCandlestickSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const candlestickSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickSeriesProperties.d.ts new file mode 100644 index 000000000..04048e71a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickSeriesProperties.d.ts @@ -0,0 +1,37 @@ +import type { AgCandlestickSeriesItemOptions, AgCandlestickSeriesItemStylerParams, AgCandlestickSeriesTooltipRendererParams, AgOhlcSeriesBaseOptions, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +import { OhlcSeriesBaseProperties } from '../ohlc/ohlcSeriesProperties'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +declare class CandlestickSeriesWick extends BaseProperties { + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + lineDash?: number[]; + lineDashOffset?: number; +} +declare class CandlestickSeriesItem extends BaseProperties { + fill: InternalAgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + cornerRadius: number; + readonly wick: CandlestickSeriesWick; +} +declare class CandlestickSeriesItems extends BaseProperties { + readonly up: CandlestickSeriesItem; + readonly down: CandlestickSeriesItem; +} +export declare class CandlestickSeriesProperties extends OhlcSeriesBaseProperties { + readonly item: CandlestickSeriesItems; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + itemStyler?: Styler, AgCandlestickSeriesItemOptions>; + constructor(); + getStyle(itemId: 'up' | 'down'): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickThemes.d.ts new file mode 100644 index 000000000..7edd0324d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/candlestickThemes.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const CANDLESTICK_SERIES_THEME: _ModuleSupport.SeriesModule<'candlestick'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/index.d.ts new file mode 100644 index 000000000..810c311a9 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/index.d.ts @@ -0,0 +1 @@ +export { CandlestickSeriesModule } from './candlestickModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/main.d.ts new file mode 100644 index 000000000..da47993a3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/candlestick/main.d.ts @@ -0,0 +1 @@ +export { CandlestickModule } from './candlestickModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordLink.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordLink.d.ts new file mode 100644 index 000000000..37b0d708b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordLink.d.ts @@ -0,0 +1,24 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const Path: typeof _ModuleSupport.Path; +export declare function bezierControlPoints({ radius, startAngle, endAngle, tension, }: { + radius: number; + startAngle: number; + endAngle: number; + tension: number; +}): { + x: readonly [number, number, number, number]; + y: readonly [number, number, number, number]; +}; +export declare class ChordLink extends Path { + centerX: number; + centerY: number; + radius: number; + startAngle1: number; + endAngle1: number; + startAngle2: number; + endAngle2: number; + tension: number; + private tensionedCurveTo; + updatePath(): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordModule.d.ts new file mode 100644 index 000000000..bfda6c6c0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordModule.d.ts @@ -0,0 +1,4 @@ +import { type AgChordSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const ChordModule: _ModuleSupport.SeriesModule<'chord'>; +export declare const ChordSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordSeries.d.ts new file mode 100644 index 000000000..a40f45128 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordSeries.d.ts @@ -0,0 +1,92 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { AgChordSeriesNodeStyle, AgChordSeriesOptions } from 'ag-charts-types'; +import { type FlowProportionLinkDatum, type FlowProportionNodeDatum, type FlowProportionNodeDatumIndex, FlowProportionSeries, type FlowProportionSeriesContext } from '../flow-proportion/flowProportionSeries'; +import { ChordLink } from './chordLink'; +import { ChordSeriesProperties } from './chordSeriesProperties'; +interface ChordNodeDatum extends FlowProportionNodeDatum { + centerX: number; + centerY: number; + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; +} +interface ChordLinkDatum extends FlowProportionLinkDatum { + centerX: number; + centerY: number; + radius: number; + startAngle1: number; + endAngle1: number; + startAngle2: number; + endAngle2: number; +} +interface ChordNodeLabelDatum { + id: string; + text: string; + centerX: number; + centerY: number; + angle: number; + radius: number; + size: number; +} +interface ChordNodeDataContext extends FlowProportionSeriesContext { +} +export declare class ChordSeries extends FlowProportionSeries { + static readonly className = "ChordSeries"; + static readonly type: "chord"; + properties: ChordSeriesProperties; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + private isLabelEnabled; + protected linkFactory(): ChordLink; + protected nodeFactory(): _ModuleSupport.Sector; + createNodeData(): ChordNodeDataContext | undefined; + protected updateLabelSelection(opts: { + labelData: ChordNodeLabelDatum[]; + labelSelection: _ModuleSupport.Selection<_ModuleSupport.TransformableText, ChordNodeLabelDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.TransformableText, ChordNodeLabelDatum>; + protected updateLabelNodes(opts: { + labelSelection: _ModuleSupport.Selection<_ModuleSupport.TransformableText, ChordNodeLabelDatum>; + }): void; + protected updateNodeSelection(opts: { + nodeData: ChordNodeDatum[]; + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Sector, ChordNodeDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.Sector, ChordNodeDatum>; + protected getNodeStyle(nodeDatum: Partial, fromNodeDatumIndex: number, isHighlight: boolean): Required & Partial & { + fill: import("ag-charts-community").AgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + opacity: number; + }>; + private makeItemStylerParams; + protected updateNodeNodes(opts: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Sector, ChordNodeDatum>; + isHighlight: boolean; + }): void; + protected updateLinkSelection(opts: { + nodeData: ChordLinkDatum[]; + datumSelection: _ModuleSupport.Selection; + }): _ModuleSupport.Selection, ChordLinkDatum>; + protected getLinkStyle({ datumIndex, datum }: Partial, fromNodeDatumIndex: FlowProportionNodeDatumIndex, isHighlight: boolean): Partial & { + fill: import("ag-charts-community").AgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + opacity: number; + }> & Required; + protected updateLinkNodes(opts: { + datumSelection: _ModuleSupport.Selection; + isHighlight: boolean; + }): void; + private getShapeFillBBox; + getTooltipContent(datumIndex: FlowProportionNodeDatumIndex): _ModuleSupport.TooltipContent | undefined; + protected computeFocusBounds(node: _ModuleSupport.Sector | ChordLink): _ModuleSupport.BBox | _ModuleSupport.Path | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordSeriesOptionsDef.d.ts new file mode 100644 index 000000000..34fbfa305 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgChordSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const chordSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordSeriesProperties.d.ts new file mode 100644 index 000000000..afa38ce5c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/chordSeriesProperties.d.ts @@ -0,0 +1,54 @@ +import { type AgChordSeriesLabelFormatterParams, type AgChordSeriesLinkItemStylerParams, type AgChordSeriesLinkStyle, type AgChordSeriesNodeItemStylerParams, type AgChordSeriesNodeStyle, type AgChordSeriesOptions, type AgChordSeriesTooltipRendererParams, type Styler, _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties, SeriesProperties: typeof _ModuleSupport.SeriesProperties, Label: typeof _ModuleSupport.Label; +declare class ChordSeriesLabelProperties extends Label { + spacing: number; + maxWidth: number; +} +declare class ChordSeriesLinkProperties extends BaseProperties { + fill: InternalAgColorType | undefined; + fillOpacity: number; + stroke: string | undefined; + strokeOpacity: number; + strokeWidth: number; + lineDash: number[]; + lineDashOffset: number; + tension: number; + itemStyler?: Styler, AgChordSeriesLinkStyle>; + getStyle(fills: InternalAgColorType[], strokes: string[], index: number): Required; +} +declare class ChordSeriesNodeProperties extends BaseProperties { + spacing: number; + width: number; + fill: InternalAgColorType | undefined; + fillOpacity: number; + stroke: string | undefined; + strokeOpacity: number; + strokeWidth: number; + lineDash: number[]; + lineDashOffset: number; + itemStyler?: Styler, AgChordSeriesNodeStyle>; + getStyle(fills: InternalAgColorType[], strokes: string[], index: number): Required; +} +export declare class ChordSeriesProperties extends SeriesProperties { + fromKey: string; + toKey: string; + idKey: string; + idName: string | undefined; + labelKey: string | undefined; + labelName: string | undefined; + sizeKey: string | undefined; + sizeName: string | undefined; + nodes: any[] | undefined; + readonly fillGradientDefaults: _ModuleSupport.FillGradientDefaults; + readonly fillPatternDefaults: _ModuleSupport.FillPatternDefaults; + readonly fillImageDefaults: _ModuleSupport.FillImageDefaults; + fills: InternalAgColorType[]; + strokes: string[]; + readonly label: ChordSeriesLabelProperties; + readonly link: ChordSeriesLinkProperties; + readonly node: ChordSeriesNodeProperties; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + constructor(); +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/index.d.ts new file mode 100644 index 000000000..157449b14 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/index.d.ts @@ -0,0 +1 @@ +export { ChordSeriesModule } from './chordModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/main.d.ts new file mode 100644 index 000000000..76d9cfd89 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/chord/main.d.ts @@ -0,0 +1 @@ +export { ChordModule } from './chordModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelModule.d.ts new file mode 100644 index 000000000..deffe9258 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelModule.d.ts @@ -0,0 +1,4 @@ +import type { AgConeFunnelSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const ConeFunnelModule: _ModuleSupport.SeriesModule<'cone-funnel'>; +export declare const ConeFunnelSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelProperties.d.ts new file mode 100644 index 000000000..90e9f0f41 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelProperties.d.ts @@ -0,0 +1,29 @@ +import type { AgColorType, AgConeFunnelSeriesLabelFormatterParams, AgConeFunnelSeriesOptions, AgConeFunnelSeriesStyle, AgConeFunnelSeriesTooltipRendererParams } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { BaseFunnelProperties } from '../funnel/baseFunnelSeriesProperties'; +declare const Label: typeof _ModuleSupport.Label, AbstractBarSeriesProperties: typeof _ModuleSupport.AbstractBarSeriesProperties, AxisLabel: typeof _ModuleSupport.AxisLabel; +declare class ConeFunnelSeriesLabel extends Label { + placement: string | undefined; + spacing: number; +} +declare class ConeFunnelSeriesStageLabel extends AxisLabel { + placement?: string; +} +export declare class ConeFunnelProperties extends AbstractBarSeriesProperties implements BaseFunnelProperties { + stageKey: string; + valueKey: string; + fills: AgColorType[]; + fillOpacity: number; + strokes: string[]; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + readonly label: ConeFunnelSeriesLabel; + readonly stageLabel: ConeFunnelSeriesStageLabel; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + getStyle(index: number): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelSeries.d.ts new file mode 100644 index 000000000..30f61f71c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelSeries.d.ts @@ -0,0 +1,45 @@ +import { type AgConeFunnelSeriesOptions, type AgConeFunnelSeriesStyle, _ModuleSupport } from 'ag-charts-community'; +import type { RequireOptional } from 'ag-charts-core'; +import { BaseFunnelSeries, type Bounds, type FunnelNodeDatum, type FunnelNodeLabelDatum } from '../funnel/baseFunnelSeries'; +import { ConeFunnelProperties } from './coneFunnelProperties'; +export declare class ConeFunnelSeries extends BaseFunnelSeries<_ModuleSupport.Line, AgConeFunnelSeriesOptions> { + static readonly className = "ConeFunnelSeries"; + static readonly type: "cone-funnel"; + properties: ConeFunnelProperties; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + get hasData(): boolean; + getBandScalePadding(): { + inner: number; + outer: number; + }; + protected connectorEnabled(): boolean; + protected getItemStyle({ datumIndex }: Pick, _isHighlight: boolean): RequireOptional & { + opacity: number; + }; + protected connectorStyle(index: number): RequireOptional & { + opacity: number; + }; + protected nodeFactory(): _ModuleSupport.Line; + protected createLabelData({ datumIndex, rect, barAlongX, yDatum, datum, visible, }: { + datumIndex: number; + rect: Bounds; + barAlongX: boolean; + yDatum: number; + datum: any; + visible: boolean; + }): FunnelNodeLabelDatum | undefined; + protected updateDatumNodes(opts: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Line, FunnelNodeDatum>; + isHighlight: boolean; + }): void; + protected tooltipStyle(_datum: any, datumIndex: number): { + fill: import("ag-charts-community").AgColorType; + fillOpacity: number; + stroke: string; + strokeOpacity: number; + strokeWidth: number; + lineDash: number[]; + lineDashOffset: number; + }; + protected hasItemStylers(): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelSeriesOptionsDef.d.ts new file mode 100644 index 000000000..95427c372 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgConeFunnelSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const coneFunnelSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelThemes.d.ts new file mode 100644 index 000000000..391e62d9c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelThemes.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const CONE_FUNNEL_SERIES_THEME: _ModuleSupport.SeriesModule<'cone-funnel'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelUtil.d.ts new file mode 100644 index 000000000..10d2def09 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/coneFunnelUtil.d.ts @@ -0,0 +1,16 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +type AnimatableBarDatum = { + x: number; + y: number; + height: number; + width: number; + opacity?: number; +}; +export declare function resetLineSelectionsFn(_node: _ModuleSupport.Line, { x, y, width, height, opacity }: AnimatableBarDatum): { + x1: number; + y1: number; + x2: number; + y2: number; + opacity: number; +}; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/index.d.ts new file mode 100644 index 000000000..8adc5f540 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/cone-funnel/index.d.ts @@ -0,0 +1 @@ +export { ConeFunnelSeriesModule } from './coneFunnelModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/flow-proportion/flowProportionProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/flow-proportion/flowProportionProperties.d.ts new file mode 100644 index 000000000..c2e85e263 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/flow-proportion/flowProportionProperties.d.ts @@ -0,0 +1,16 @@ +import type { AgChordSeriesTooltipRendererParams, AgSankeySeriesTooltipRendererParams, _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +export interface FlowProportionSeriesProperties extends _ModuleSupport.SeriesProperties { + nodes: any[] | undefined; + fromKey: string; + toKey: string; + idKey: string; + idName: string | undefined; + labelKey: string | undefined; + labelName: string | undefined; + sizeKey: string | undefined; + sizeName: string | undefined; + fills: InternalAgColorType[]; + strokes: string[]; + tooltip: _ModuleSupport.SeriesTooltip & AgSankeySeriesTooltipRendererParams>; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/flow-proportion/flowProportionSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/flow-proportion/flowProportionSeries.d.ts new file mode 100644 index 000000000..3541a9bcb --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/flow-proportion/flowProportionSeries.d.ts @@ -0,0 +1,129 @@ +import { type FillOptions, type LineDashOptions, type StrokeOptions, _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType, Point } from 'ag-charts-core'; +import type { FlowProportionSeriesProperties } from './flowProportionProperties'; +declare const Series: typeof _ModuleSupport.Series; +export declare enum FlowProportionDatumType { + Link = 0, + Node = 1 +} +export type FlowProportionNodeDatumIndex = { + type: FlowProportionDatumType; + index: number; +}; +type NodeStyle = Pick & Omit, 'fill' | 'stroke'>; +export interface FlowProportionLinkDatum, TLinkDatum extends FlowProportionLinkDatum> extends _ModuleSupport.SeriesNodeDatum { + type: FlowProportionDatumType.Link; + readonly itemId: undefined; + index: number; + fromNode: TNodeDatum; + toNode: TNodeDatum; + size: number; + style: NodeStyle; +} +export interface FlowProportionNodeDatum, TLinkDatum extends FlowProportionLinkDatum> extends _ModuleSupport.SeriesNodeDatum { + type: FlowProportionDatumType.Node; + readonly itemId: undefined; + index: number; + linksBefore: TLinkDatum[]; + linksAfter: TLinkDatum[]; + id: string; + size: number; + label: string | undefined; + style: NodeStyle; +} +export interface FlowProportionSeriesContext, TLinkDatum extends FlowProportionLinkDatum, TLabel> extends _ModuleSupport.SeriesNodeDataContext, TLabel> { +} +type TDatum, TLinkDatum extends FlowProportionLinkDatum> = TLinkDatum | TNodeDatum; +export declare class FlowProportionSeriesNodeEvent extends _ModuleSupport.SeriesNodeEvent<_ModuleSupport.SeriesNodeDatum, TEvent> { + readonly size?: number; + readonly label?: string; + constructor(type: TEvent, nativeEvent: Event, datum: _ModuleSupport.SeriesNodeDatum, series: _ModuleSupport.ISeries, unknown> & { + contextNodeData?: _ModuleSupport.SeriesNodeDataContext, FlowProportionLinkDatum>, unknown>; + }); +} +export declare abstract class FlowProportionSeries, TLinkDatum extends FlowProportionLinkDatum, TLabel, TOpts extends object, TProps extends FlowProportionSeriesProperties, TNode extends _ModuleSupport.Node & _ModuleSupport.DistantObject, TLink extends _ModuleSupport.Node & _ModuleSupport.DistantObject> extends Series, TOpts, TProps, TLabel, _ModuleSupport.SeriesNodeDataContext, TLabel>> { + protected readonly NodeEvent: typeof FlowProportionSeriesNodeEvent; + abstract properties: TProps; + protected get nodes(): any[] | undefined; + protected nodeCount: number; + protected linkCount: number; + protected linksDataModel: _ModuleSupport.DataModel | undefined; + protected linksProcessedData: _ModuleSupport.ProcessedData | undefined; + protected nodesDataModel: _ModuleSupport.DataModel | undefined; + protected nodesProcessedData: _ModuleSupport.ProcessedData | undefined; + contextNodeData?: _ModuleSupport.SeriesNodeDataContext, TLabel>; + private processedNodes; + private readonly linkGroup; + private readonly nodeGroup; + private readonly focusLinkGroup; + private readonly focusNodeGroup; + private readonly highlightLinkGroup; + private readonly highlightNodeGroup; + private labelSelection; + linkSelection: _ModuleSupport.Selection; + nodeSelection: _ModuleSupport.Selection; + private focusLinkSelection; + private focusNodeSelection; + private highlightLinkSelection; + private highlightNodeSelection; + protected abstract linkFactory(): TLink; + protected abstract nodeFactory(): TNode; + processData(dataController: _ModuleSupport.DataController): Promise; + protected abstract getNodeStyle(datum: Partial, fromNodeDatumIndex: number, isHighlight: boolean): NodeStyle; + protected abstract getLinkStyle({ datumIndex, datum }: Partial, fromNodeDatumIndex: FlowProportionNodeDatumIndex, isHighlight: boolean): NodeStyle; + protected getNodeGraph(createNode: (node: FlowProportionNodeDatum) => TNodeDatum, createLink: (link: FlowProportionLinkDatum) => TLinkDatum, { includeCircularReferences }: { + includeCircularReferences: boolean; + }): { + nodeGraph: Map>; + links: TLinkDatum[]; + maxPathLength: number; + }; + updateSelections(): void; + update(opts: { + seriesRect?: _ModuleSupport.BBox; + }): void; + protected abstract updateLabelSelection(opts: { + labelData: TLabel[]; + labelSelection: _ModuleSupport.Selection<_ModuleSupport.TransformableText, TLabel>; + }): _ModuleSupport.Selection<_ModuleSupport.TransformableText, TLabel>; + protected abstract updateLabelNodes(opts: { + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, TLabel>; + }): void; + protected abstract updateNodeSelection(opts: { + nodeData: TNodeDatum[]; + datumSelection: _ModuleSupport.Selection; + }): _ModuleSupport.Selection; + protected abstract updateNodeNodes(opts: { + datumSelection: _ModuleSupport.Selection; + isHighlight: boolean; + }): void; + protected abstract updateLinkSelection(opts: { + nodeData: TLinkDatum[]; + datumSelection: _ModuleSupport.Selection; + }): _ModuleSupport.Selection; + protected abstract updateLinkNodes(opts: { + datumSelection: _ModuleSupport.Selection; + isHighlight: boolean; + }): void; + resetAnimation(_chartAnimationPhase: _ModuleSupport.ChartAnimationPhase): void; + dataCount(): number; + getSeriesDomain(_direction: _ModuleSupport.ChartAxisDirection): any[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, _visibleRange: [any, any]): [number, number]; + protected legendItemSymbol(_type: FlowProportionDatumType, nodeIndex: number, format?: { + fill?: InternalAgColorType; + fillOpacity?: number; + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + lineDash?: number[]; + lineDashOffset?: number; + }): _ModuleSupport.LegendSymbolOptions; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + pickNodeClosestDatum({ x, y }: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + getDatumAriaText(datum: TDatum, description: string): string | undefined; + protected abstract computeFocusBounds(node: TNode | TLink): _ModuleSupport.BBox | _ModuleSupport.Path | undefined; + pickFocus(opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.PickFocusOutputs | undefined; + getCategoryValue(_datumIndex: FlowProportionNodeDatumIndex): any; + datumIndexForCategoryValue(_categoryValue: any): FlowProportionNodeDatumIndex | undefined; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/flow-proportion/flowProportionUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/flow-proportion/flowProportionUtil.d.ts new file mode 100644 index 000000000..93412b169 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/flow-proportion/flowProportionUtil.d.ts @@ -0,0 +1,24 @@ +interface Node { + id: string; +} +interface Link { + fromNode: N; + toNode: N; +} +export interface LinkedNode> { + node: NodeGraphEntry; + link: L; +} +export interface NodeGraphEntry> { + datum: N; + linksBefore: LinkedNode[]; + linksAfter: LinkedNode[]; + maxPathLengthBefore: number; + maxPathLengthAfter: number; +} +export declare function computeNodeGraph>(nodes: Iterable, links: L[], includeCircularReferences: boolean): { + links: L[]; + nodeGraph: Map>; + maxPathLength: number; +}; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/baseFunnelSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/baseFunnelSeries.d.ts new file mode 100644 index 000000000..8a657477e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/baseFunnelSeries.d.ts @@ -0,0 +1,112 @@ +import { type AgFunnelSeriesStyle, type TextOrSegments, _ModuleSupport } from 'ag-charts-community'; +import type { Point, RequireOptional } from 'ag-charts-core'; +import type { BaseFunnelProperties } from './baseFunnelSeriesProperties'; +import { FunnelConnector } from './funnelConnector'; +export type Bounds = { + x: number; + y: number; + width: number; + height: number; +}; +export type FunnelNodeLabelDatum = Readonly & { + datumIndex: number; + text: TextOrSegments; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; + datum: any; + itemId: string; + series: _ModuleSupport.CartesianSeriesNodeDatum['series']; + visible: boolean; +}; +export interface FunnelNodeDatum extends _ModuleSupport.CartesianSeriesNodeDatum, Readonly { + readonly index: number; + readonly itemId: string; + readonly width: number; + readonly height: number; + readonly label: FunnelNodeLabelDatum | undefined; + readonly visible: boolean; + readonly crisp: boolean; + readonly opacity?: number; + readonly clipBBox?: _ModuleSupport.BBox; +} +interface FunnelConnectorDatum { + readonly datum: FunnelNodeDatum; + readonly datumIndex: number; + readonly x0: number; + readonly y0: number; + readonly x1: number; + readonly y1: number; + readonly x2: number; + readonly y2: number; + readonly x3: number; + readonly y3: number; + readonly opacity: number; +} +interface FunnelContext extends _ModuleSupport.AbstractBarSeriesNodeDataContext { + connectorData: FunnelConnectorDatum[]; +} +export interface FunnelAnimationData extends _ModuleSupport.CartesianAnimationData { +} +declare class FunnelSeriesNodeEvent extends _ModuleSupport.SeriesNodeEvent { + readonly xKey?: string; + readonly yKey?: string; + constructor(type: TEvent, nativeEvent: Event, datum: FunnelNodeDatum, series: BaseFunnelSeries); +} +export declare abstract class BaseFunnelSeries extends _ModuleSupport.AbstractBarSeries, FunnelNodeDatum, FunnelNodeLabelDatum, FunnelContext> { + protected readonly NodeEvent: typeof FunnelSeriesNodeEvent; + protected readonly connectorNodeGroup: _ModuleSupport.Group; + protected connectorSelection: _ModuleSupport.Selection, FunnelConnectorDatum>; + get pickModeAxis(): "main-category"; + constructor({ moduleCtx, animationResetFns, }: { + moduleCtx: _ModuleSupport.ModuleContext; + animationResetFns: { + datum: (node: TNode, datum: FunnelNodeDatum) => _ModuleSupport.AnimationValue & Partial; + }; + }); + setZIndex(zIndex: number): boolean; + protected isVertical(): boolean; + protected abstract connectorEnabled(): boolean; + protected abstract connectorStyle(index: number): RequireOptional & { + opacity: number; + }; + private connectionFactory; + processData(dataController: _ModuleSupport.DataController): Promise; + getSeriesDomain(direction: _ModuleSupport.ChartAxisDirection): any[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, _visibleRange: [any, any]): [number, number]; + createNodeData(): FunnelContext | undefined; + protected abstract getItemStyle(_: Partial, _isHighlight: boolean): RequireOptional; + protected abstract createLabelData({ datumIndex, rect, yDatum, datum, }: { + datumIndex: number; + rect: Bounds; + barAlongX: boolean; + yDatum: number; + datum: any; + visible: boolean; + }): FunnelNodeLabelDatum | undefined; + protected updateNodes(seriesHighlighted: boolean, nodeRefresh: boolean): void; + protected updateDatumSelection(opts: { + nodeData: FunnelNodeDatum[]; + datumSelection: _ModuleSupport.Selection; + }): _ModuleSupport.Selection; + private updateConnectorSelection; + private updateConnectorNodes; + protected updateLabelSelection(opts: { + labelData: FunnelNodeLabelDatum[]; + labelSelection: FunnelAnimationData['labelSelection']; + }): _ModuleSupport.Selection<_ModuleSupport.Text, FunnelNodeLabelDatum>; + protected updateLabelNodes(opts: { + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, FunnelNodeLabelDatum>; + }): void; + protected abstract tooltipStyle(datum: any, datumIndex: number): Required; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + protected resetAllAnimation(data: _ModuleSupport.CartesianAnimationData): void; + animateEmptyUpdateReady({ labelSelection }: FunnelAnimationData): void; + animateWaitingUpdateReady(data: FunnelAnimationData): void; + private getDatumId; + protected isLabelEnabled(): boolean; + protected computeFocusBounds({ datumIndex }: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/baseFunnelSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/baseFunnelSeriesProperties.d.ts new file mode 100644 index 000000000..d90efbede --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/baseFunnelSeriesProperties.d.ts @@ -0,0 +1,18 @@ +import type { AgFunnelSeriesItemStylerParams, AgFunnelSeriesLabelFormatterParams, AgFunnelSeriesStyle, AgFunnelSeriesTooltipRendererParams, Styler, _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +interface FunnelSeriesLabel extends _ModuleSupport.Label { +} +export interface BaseFunnelProperties extends _ModuleSupport.AbstractBarSeriesProperties { + stageKey: string; + valueKey: string; + valueName?: string; + fills: InternalAgColorType[]; + strokes: string[]; + itemStyler?: Styler, AgFunnelSeriesStyle>; + label: FunnelSeriesLabel; + tooltip: _ModuleSupport.SeriesTooltip, 'context'>>; + getStyle: (datumIndex: number) => Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelConnector.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelConnector.d.ts new file mode 100644 index 000000000..87ab18373 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelConnector.d.ts @@ -0,0 +1,20 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const Path: typeof _ModuleSupport.Path; +export declare class FunnelConnector extends Path implements _ModuleSupport.DistantObject { + x0: number; + y0: number; + x1: number; + y1: number; + x2: number; + y2: number; + x3: number; + y3: number; + get midPoint(): { + x: number; + y: number; + }; + distanceSquared(x: number, y: number): number; + protected computeBBox(): _ModuleSupport.BBox | undefined; + updatePath(): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelModule.d.ts new file mode 100644 index 000000000..132adb589 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelModule.d.ts @@ -0,0 +1,4 @@ +import type { AgFunnelSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const FunnelModule: _ModuleSupport.SeriesModule<'funnel'>; +export declare const FunnelSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelProperties.d.ts new file mode 100644 index 000000000..e1a1dbfa0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelProperties.d.ts @@ -0,0 +1,45 @@ +import type { AgColorType, AgFunnelSeriesItemStylerParams, AgFunnelSeriesLabelFormatterParams, AgFunnelSeriesOptions, AgFunnelSeriesStyle, AgFunnelSeriesTooltipRendererParams, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType, RequireOptional } from 'ag-charts-core'; +import type { BaseFunnelProperties } from './baseFunnelSeriesProperties'; +declare const Label: typeof _ModuleSupport.Label, AbstractBarSeriesProperties: typeof _ModuleSupport.AbstractBarSeriesProperties, BaseProperties: typeof _ModuleSupport.BaseProperties, AxisLabel: typeof _ModuleSupport.AxisLabel; +declare class FunnelSeriesLabel extends Label { +} +declare class FunnelSeriesStageLabel extends AxisLabel { + placement?: string; +} +declare class FunnelDropOff extends BaseProperties { + enabled: boolean; + fill: InternalAgColorType | undefined; + fillOpacity: number; + stroke: string | undefined; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + getStyle(): RequireOptional & { + opacity: number; + }; +} +export declare class FunnelProperties extends AbstractBarSeriesProperties implements BaseFunnelProperties { + stageKey: string; + valueKey: string; + fills: AgColorType[]; + fillOpacity: number; + strokes: string[]; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + spacingRatio: number; + itemStyler?: Styler, AgFunnelSeriesStyle>; + readonly dropOff: FunnelDropOff; + readonly shadow: _ModuleSupport.DropShadow; + readonly label: FunnelSeriesLabel; + readonly stageLabel: FunnelSeriesStageLabel; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + getStyle(index: number): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelSeries.d.ts new file mode 100644 index 000000000..22f14166c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelSeries.d.ts @@ -0,0 +1,58 @@ +import { type AgFunnelSeriesOptions, type AgFunnelSeriesStyle, _ModuleSupport } from 'ag-charts-community'; +import type { RequireOptional } from 'ag-charts-core'; +import { BaseFunnelSeries, type Bounds, type FunnelAnimationData, type FunnelNodeDatum, type FunnelNodeLabelDatum } from './baseFunnelSeries'; +import { FunnelProperties } from './funnelProperties'; +export declare class FunnelSeries extends BaseFunnelSeries<_ModuleSupport.Rect, AgFunnelSeriesOptions> { + static readonly className = "FunnelSeries"; + static readonly type: "funnel"; + properties: FunnelProperties; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + getBandScalePadding(): { + inner: number; + outer: number; + }; + protected connectorEnabled(): boolean; + protected connectorStyle(index: number): RequireOptional & { + opacity: number; + }; + protected nodeFactory(): _ModuleSupport.Rect; + protected createLabelData({ datumIndex, rect, yDatum, datum, visible, }: { + datumIndex: number; + rect: Bounds; + barAlongX: boolean; + yDatum: number; + datum: any; + visible: boolean; + }): FunnelNodeLabelDatum | undefined; + protected getItemStyle({ datum, datumIndex }: Pick, isHighlight: boolean): Required & { + opacity: number; + } & Partial & { + fill: import("ag-charts-community").AgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + opacity: number; + }>; + protected updateDatumNodes({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, FunnelNodeDatum>; + isHighlight: boolean; + }): void; + protected tooltipStyle(datum: unknown, datumIndex: number): Required & { + opacity: number; + } & Partial & { + fill: import("ag-charts-community").AgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + opacity: number; + }>; + animateEmptyUpdateReady(params: FunnelAnimationData<_ModuleSupport.Rect>): void; + animateWaitingUpdateReady(data: FunnelAnimationData<_ModuleSupport.Rect>): void; + protected hasItemStylers(): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelSeriesOptionsDef.d.ts new file mode 100644 index 000000000..75fcaa36c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgFunnelSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const funnelSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelThemes.d.ts new file mode 100644 index 000000000..ce270c2f0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelThemes.d.ts @@ -0,0 +1,3 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const FUNNEL_SERIES_AXES: any; +export declare const FUNNEL_SERIES_THEME: _ModuleSupport.SeriesModule<'funnel'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelUtil.d.ts new file mode 100644 index 000000000..52169e810 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/funnelUtil.d.ts @@ -0,0 +1,29 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { FunnelConnector } from './funnelConnector'; +type AnimatableConnectorDatum = { + x0: number; + y0: number; + x1: number; + y1: number; + x2: number; + y2: number; + x3: number; + y3: number; + opacity: number | undefined; +}; +export declare function prepareConnectorAnimationFunctions(isVertical: boolean, mode: 'normal' | 'fade'): { + fromFn: _ModuleSupport.FromToMotionPropFn, AnimatableConnectorDatum, T>; + toFn: _ModuleSupport.FromToMotionPropFn, AnimatableConnectorDatum, T>; +}; +export declare function resetConnectorSelectionsFn(_node: FunnelConnector, datum: AnimatableConnectorDatum): { + x0: number; + y0: number; + x1: number; + y1: number; + x2: number; + y2: number; + x3: number; + y3: number; + opacity: number | undefined; +}; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/index.d.ts new file mode 100644 index 000000000..2e63410e9 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/funnel/index.d.ts @@ -0,0 +1 @@ +export { FunnelSeriesModule } from './funnelModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/datumUnion.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/datumUnion.d.ts new file mode 100644 index 000000000..402297da8 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/datumUnion.d.ts @@ -0,0 +1,15 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare class DatumUnion> { + node?: TNode; + datum?: TDatum; + [Symbol.iterator](): IterableIterator<{ + node: TNode; + datum: TDatum; + }>; + nodes(): Iterable; + update(datumSelection: { + nodes(): TNode[]; + }, group: { + appendChild(child: TNode): void; + }, ctor: new () => TNode, nodeUpdater: (unionNode: TNode, first: TNode, last: TNode) => void): void; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/label.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/label.d.ts new file mode 100644 index 000000000..a0bd12c0a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/label.d.ts @@ -0,0 +1,18 @@ +import type { AgChartLabelFormatterParams, RichFormatter, TextOrSegments, _ModuleSupport } from 'ag-charts-community'; +interface GaugeLabelDatum { + value: number; + text?: TextOrSegments; + formatter?: RichFormatter>; +} +interface Ctx { + chartService: { + context?: unknown; + }; +} +export declare const fadeInFns: _ModuleSupport.FromToFns<_ModuleSupport.Node, any, any>; +export declare function formatLabel(value: number | undefined, scale: { + min: number; + max: number; +}): string; +export declare function getLabelText(seriesId: string, ctx: Ctx, datum: GaugeLabelDatum, valueOverride?: number): TextOrSegments | undefined; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/lineMarker.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/lineMarker.d.ts new file mode 100644 index 000000000..79a60cf67 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/lineMarker.d.ts @@ -0,0 +1,2 @@ +import type { AgMarkerShapeFnParams } from 'ag-charts-community'; +export declare function lineMarker({ path, x, y, size }: AgMarkerShapeFnParams): void; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/pick.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/pick.d.ts new file mode 100644 index 000000000..b580da128 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/pick.d.ts @@ -0,0 +1,26 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +type SceneNode = _ModuleSupport.Node; +type SeriesNodeDatum = _ModuleSupport.SeriesNodeDatum<_ModuleSupport.DatumIndexType>; +type SeriesNodePickMatch = _ModuleSupport.SeriesNodePickMatch; +type SelectionNode = { + node: _ModuleSupport.Path; + datum: SeriesNodeDatum; +}; +type SelectionLike = Iterable & { + nodes(): Iterable; +}; +type PickFocusInputs = _ModuleSupport.PickFocusInputs; +type PickFocusOutputs = _ModuleSupport.PickFocusOutputs; +type GaugeSeries = { + contextNodeData?: { + nodeData: SeriesNodeDatum[]; + targetData: SeriesNodeDatum[]; + }; + datumUnion: SelectionLike; + targetSelection: SelectionLike; + pickNodeNearestDistantObject(point: Point, items: Iterable): SeriesNodePickMatch | undefined; +}; +export declare function pickGaugeNearestDatum(self: GaugeSeries, point: Point): SeriesNodePickMatch | undefined; +export declare function pickGaugeFocus(self: GaugeSeries, opts: PickFocusInputs): PickFocusOutputs | undefined; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/segmentation.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/segmentation.d.ts new file mode 100644 index 000000000..e3466d144 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/gauge-util/segmentation.d.ts @@ -0,0 +1,14 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties; +declare class GaugeSegmentationIntervalProperties extends BaseProperties { + values?: number[]; + step?: number; + count?: number; + getSegments(scale: _ModuleSupport.Scale, maxTicks: number): number[]; +} +export declare class GaugeSegmentationProperties extends BaseProperties { + enabled: boolean; + readonly interval: GaugeSegmentationIntervalProperties; + spacing: number; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapModule.d.ts new file mode 100644 index 000000000..f5d13d9b9 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapModule.d.ts @@ -0,0 +1,4 @@ +import { type AgHeatmapSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const HeatmapModule: _ModuleSupport.SeriesModule<'heatmap'>; +export declare const HeatmapSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapSeries.d.ts new file mode 100644 index 000000000..ec76f340a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapSeries.d.ts @@ -0,0 +1,113 @@ +import type { AgHeatmapSeriesOptions, AgHeatmapSeriesStyle, FontStyle, FontWeight, TextAlign, TextOrSegments, VerticalAlign } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import { HeatmapSeriesProperties } from './heatmapSeriesProperties'; +interface HeatmapNodeDatum extends _ModuleSupport.CartesianSeriesNodeDatum { + readonly point: Readonly<_ModuleSupport.SizedPoint>; + readonly itemId: string; + midPoint: Readonly; + readonly width: number; + readonly height: number; + readonly colorValue: any; + style: AgHeatmapSeriesStyle; +} +interface HeatmapLabelDatum extends Point { + datumIndex: number; + series: _ModuleSupport.CartesianSeriesNodeDatum['series']; + datum: any; + itemId: string; + text: TextOrSegments; + fontSize: number; + lineHeight: number; + fontStyle: FontStyle | undefined; + fontFamily: string; + fontWeight: FontWeight | undefined; + color: string | undefined; + textAlign: TextAlign; + textBaseline: VerticalAlign; + style: AgHeatmapSeriesStyle; +} +declare class HeatmapSeriesNodeEvent extends _ModuleSupport.CartesianSeriesNodeEvent { + readonly colorKey?: string; + constructor(type: TEvent, nativeEvent: Event, datum: HeatmapNodeDatum, series: HeatmapSeries); +} +export declare class HeatmapSeries extends _ModuleSupport.CartesianSeries<_ModuleSupport.Rect, AgHeatmapSeriesOptions, HeatmapSeriesProperties, HeatmapNodeDatum, HeatmapLabelDatum> { + static readonly className = "HeatmapSeries"; + static readonly type: "heatmap"; + properties: HeatmapSeriesProperties; + protected readonly NodeEvent: typeof HeatmapSeriesNodeEvent; + readonly colorScale: _ModuleSupport.ColorScale; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + processData(dataController: _ModuleSupport.DataController): Promise; + private isColorScaleValid; + xCoordinateRange(xValue: any, pixelSize: number): [number, number]; + yCoordinateRange(yValues: any[], pixelSize: number): [number, number]; + getSeriesDomain(direction: _ModuleSupport.ChartAxisDirection): any[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, _visibleRange: [any, any]): [number, number]; + createNodeData(): { + itemId: string; + nodeData: HeatmapNodeDatum[]; + labelData: HeatmapLabelDatum[]; + scales: { + x?: _ModuleSupport.Scaling | undefined; + y?: _ModuleSupport.Scaling | undefined; + angle?: _ModuleSupport.Scaling | undefined; + radius?: _ModuleSupport.Scaling | undefined; + }; + visible: boolean; + } | undefined; + protected nodeFactory(): _ModuleSupport.Rect; + update(params: { + seriesRect?: _ModuleSupport.BBox; + }): void; + protected updateDatumSelection(opts: { + nodeData: HeatmapNodeDatum[]; + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, HeatmapNodeDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.Rect, HeatmapNodeDatum>; + protected getItemStyle({ datumIndex, datum, colorValue }: Partial, isHighlight: boolean): Partial & { + fill: import("ag-charts-community").AgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + opacity: number; + }> & { + fill: string; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + opacity: number; + }; + private makeItemStylerParams; + protected updateDatumStyles({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, HeatmapNodeDatum>; + isHighlight: boolean; + }): void; + protected updateDatumNodes({ datumSelection, }: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, HeatmapNodeDatum>; + isHighlight: boolean; + }): void; + protected updateLabelSelection(opts: { + labelData: HeatmapLabelDatum[]; + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, HeatmapLabelDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.Text, HeatmapLabelDatum>; + protected updateLabelNodes(opts: { + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, HeatmapLabelDatum>; + }): void; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.GradientLegendDatum[]; + protected isLabelEnabled(): boolean; + getBandScalePadding(): { + inner: number; + outer: number; + }; + protected computeFocusBounds({ datumIndex }: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + protected initQuadTree(quadtree: _ModuleSupport.QuadtreeNearest): void; + protected pickNodesExactShape(point: Point): _ModuleSupport.SeriesNodeDatum<_ModuleSupport.DatumIndexType>[]; + protected pickNodeClosestDatum(point: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapSeriesOptionsDef.d.ts new file mode 100644 index 000000000..e63959a81 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgHeatmapSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const heatmapSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapSeriesProperties.d.ts new file mode 100644 index 000000000..b21d67265 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapSeriesProperties.d.ts @@ -0,0 +1,24 @@ +import type { AgHeatmapSeriesItemStylerParams, AgHeatmapSeriesLabelFormatterParams, AgHeatmapSeriesOptions, AgHeatmapSeriesStyle, AgHeatmapSeriesTooltipRendererParams, Styler, TextAlign, VerticalAlign } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import { AutoSizedLabel } from '../util/autoSizedLabel'; +declare const CartesianSeriesProperties: typeof _ModuleSupport.CartesianSeriesProperties; +export declare class HeatmapSeriesProperties extends CartesianSeriesProperties { + title?: string; + xKey: string; + yKey: string; + colorKey?: string; + xName?: string; + yName?: string; + colorName?: string; + colorRange: string[]; + stroke: string; + strokeOpacity: number; + strokeWidth: number; + textAlign: TextAlign; + verticalAlign: VerticalAlign; + itemPadding: number; + itemStyler?: Styler, AgHeatmapSeriesStyle>; + readonly label: AutoSizedLabel; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapThemes.d.ts new file mode 100644 index 000000000..2e09ffe40 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/heatmapThemes.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const HEATMAP_SERIES_THEME: _ModuleSupport.SeriesModule<'heatmap'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/index.d.ts new file mode 100644 index 000000000..b21c14d66 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/index.d.ts @@ -0,0 +1 @@ +export { HeatmapSeriesModule } from './heatmapModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/main.d.ts new file mode 100644 index 000000000..8d2cb3c0f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/heatmap/main.d.ts @@ -0,0 +1 @@ +export { HeatmapModule } from './heatmapModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeModule.d.ts new file mode 100644 index 000000000..b58372708 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeModule.d.ts @@ -0,0 +1,4 @@ +import { type AgLinearGaugePreset, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const LinearGaugeModule: _ModuleSupport.SeriesModule<'linear-gauge'>; +export declare const LinearGaugeSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeSeries.d.ts new file mode 100644 index 000000000..9fe1b2b2c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeSeries.d.ts @@ -0,0 +1,100 @@ +import { type AgLinearGaugeOptions, _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import { DatumUnion } from '../gauge-util/datumUnion'; +import { type LinearGaugeLabelDatum, LinearGaugeLabelProperties, type LinearGaugeNodeDatum, type LinearGaugeNodeDatumIndex, LinearGaugeSeriesProperties, type LinearGaugeTargetDatum } from './linearGaugeSeriesProperties'; +interface LinearGaugeNodeDataContext extends _ModuleSupport.SeriesNodeDataContext { + tickData: _ModuleSupport.TickDatum[]; + targetData: LinearGaugeTargetDatum[]; + scaleData: LinearGaugeNodeDatum[]; +} +export declare class LinearGaugeSeries extends _ModuleSupport.Series { + static readonly className = "LinearGaugeSeries"; + static readonly type: "linear-gauge"; + properties: LinearGaugeSeriesProperties; + private seriesRect; + private gaugeRect; + scale: _ModuleSupport.LinearScale; + get range(): [number, number]; + originX: number; + originY: number; + get horizontal(): boolean; + private readonly scaleGroup; + private readonly itemGroup; + private readonly itemTargetGroup; + private readonly itemTargetLabelGroup; + private readonly itemLabelGroup; + private readonly highlightTargetGroup; + private readonly tickGroup; + private scaleSelection; + private datumSelection; + targetSelection: _ModuleSupport.Selection<_ModuleSupport.Marker, LinearGaugeTargetDatum>; + private targetLabelSelection; + private labelSelection; + private highlightTargetSelection; + private tickSelection; + datumUnion: DatumUnion<_ModuleSupport.Rect, LinearGaugeNodeDatum>; + private readonly animationState; + contextNodeData?: LinearGaugeNodeDataContext; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + get hasData(): boolean; + private nodeFactory; + private markerFactory; + processData(): void; + formatLabel(value: number): string; + protected getShapeFillBBox(): _ModuleSupport.ShapeFillBBox; + private getTargets; + private getTargetPoint; + private getTargetLabel; + labelDatum(label: LinearGaugeLabelProperties, value: number): LinearGaugeLabelDatum; + private verticalLabelInset; + private horizontalLabelInset; + private tickFormatter; + createNodeData(): { + itemId: string; + nodeData: LinearGaugeNodeDatum[]; + tickData: _ModuleSupport.TickDatum[]; + targetData: LinearGaugeTargetDatum[]; + labelData: LinearGaugeLabelDatum[]; + scaleData: LinearGaugeNodeDatum[]; + }; + updateSelections(resize: boolean): void; + private highlightDatum; + update({ seriesRect }: { + seriesRect?: _ModuleSupport.BBox; + }): void; + private updateDatumSelection; + private updateDatumNodes; + private updateScaleSelection; + private updateScaleNodes; + private updateTargetSelection; + private updateTargetNodes; + private getTargetStyle; + private updateTargetLabelSelection; + private updateTargetLabelNodes; + private updateTickSelection; + private updateTickNodes; + private updateLabelSelection; + private updateLabelNodes; + labelsHaveExplicitText(): boolean; + formatLabelText(datum?: { + label: number; + }): void; + protected resetAllAnimation(): void; + resetAnimation(phase: _ModuleSupport.ChartAnimationPhase): void; + private animateLabelText; + animateEmptyUpdateReady(): void; + animateWaitingUpdateReady(): void; + protected animateReadyResize(): void; + getSeriesDomain(): number[]; + dataCount(): number; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, _visibleRange: [any, any]): [number, number]; + getLegendData(): _ModuleSupport.ChartLegendDatum<_ModuleSupport.ChartLegendType>[]; + getTooltipContent(datumIndex: LinearGaugeNodeDatumIndex | undefined): _ModuleSupport.TooltipContent | undefined; + pickNodeClosestDatum(point: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + pickFocus(opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.PickFocusOutputs | undefined; + getCaptionText(): string; + getCategoryValue(_datumIndex: LinearGaugeNodeDatumIndex): void; + datumIndexForCategoryValue(_categoryValue: any): LinearGaugeNodeDatumIndex | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeSeriesProperties.d.ts new file mode 100644 index 000000000..7e3190088 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeSeriesProperties.d.ts @@ -0,0 +1,163 @@ +import { type RichFormatter, type TextOrSegments, _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgGradientColor, RequireOptional } from 'ag-charts-core'; +import type { AgChartLabelFormatterParams, AgGradientColorMode, AgLinearGaugeLabelPlacement, AgLinearGaugeMarkerShape, AgLinearGaugeOptions, AgLinearGaugeSeriesStyle, AgLinearGaugeTargetPlacement, AgLinearGaugeTooltipRendererParams, FontStyle, FontWeight, OverflowStrategy, TextWrap } from 'ag-charts-types'; +import { GaugeSegmentationProperties } from '../gauge-util/segmentation'; +import { AutoSizedLabel } from '../util/autoSizedLabel'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties, SeriesProperties: typeof _ModuleSupport.SeriesProperties, Label: typeof _ModuleSupport.Label, AxisLabel: typeof _ModuleSupport.AxisLabel; +export declare enum NodeDataType { + Node = 0, + Target = 1 +} +export type LinearGaugeNodeDatumIndex = { + type: NodeDataType.Node; +} | { + type: NodeDataType.Target; + index: number; +}; +export interface LinearGaugeNodeDatum extends _ModuleSupport.SeriesNodeDatum { + type: NodeDataType.Node; + readonly itemId: 'value' | 'scale' | `value-${number}` | `scale-${number}`; + x0: number; + y0: number; + x1: number; + y1: number; + clipX0: number | undefined; + clipY0: number | undefined; + clipX1: number | undefined; + clipY1: number | undefined; + topLeftCornerRadius: number; + topRightCornerRadius: number; + bottomRightCornerRadius: number; + bottomLeftCornerRadius: number; + horizontalInset: number; + verticalInset: number; + style: AgLinearGaugeSeriesStyle; +} +export interface LinearGaugeTargetDatumLabel { + offsetX: number; + offsetY: number; + fill: string | undefined; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; + fontStyle: FontStyle | undefined; + fontWeight: FontWeight | undefined; + fontSize: number; + fontFamily: string; + lineHeight: number | undefined; +} +export interface LinearGaugeTargetDatum extends _ModuleSupport.SeriesNodeDatum { + type: NodeDataType.Target; + readonly itemId: `target-${number}`; + value: number; + text: string | undefined; + x: number; + y: number; + shape: AgLinearGaugeMarkerShape; + size: number; + rotation: number; + label: LinearGaugeTargetDatumLabel; + style: AgLinearGaugeSeriesStyle; +} +export type LinearGaugeLabelDatum = { + placement: AgLinearGaugeLabelPlacement; + avoidCollisions: boolean; + spacing: number; + text: TextOrSegments | undefined; + value: number; + fill: string | undefined; + fontStyle: FontStyle | undefined; + fontWeight: FontWeight | undefined; + fontSize: number; + minimumFontSize: number | undefined; + fontFamily: string; + lineHeight: number | undefined; + wrapping: TextWrap; + overflowStrategy: OverflowStrategy; + formatter: RichFormatter> | undefined; +}; +declare class LinearGaugeDefaultTargetLabelProperties extends Label { + spacing: number | undefined; +} +export declare class LinearGaugeTargetProperties extends BaseProperties { + text: string | undefined; + value: number; + shape: AgLinearGaugeMarkerShape | undefined; + placement: AgLinearGaugeTargetPlacement | undefined; + spacing: number | undefined; + size: number | undefined; + rotation: number | undefined; + fill: string | undefined; + fillOpacity: number | undefined; + stroke: string | undefined; + strokeWidth: number | undefined; + strokeOpacity: number | undefined; + lineDash: number[] | undefined; + lineDashOffset: number | undefined; + readonly label: LinearGaugeDefaultTargetLabelProperties; + getStyle(defaultTarget: LinearGaugeTargetProperties): Required; +} +declare class LinearGaugeBarProperties extends BaseProperties { + enabled: boolean; + thickness: number | undefined; + thicknessRatio: number; + fills: _ModuleSupport.PropertiesArray<_ModuleSupport.StopProperties>; + fillMode: AgGradientColorMode; + fill: string | undefined; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + getStyle(defaultColorRange: string[], horizontal: boolean, scale: _ModuleSupport.LinearScale): RequireOptional; +} +declare class LinearGaugeScaleIntervalProperties extends BaseProperties { + values?: number[]; + step?: number; + minSpacing: number; + maxSpacing: number; +} +declare class LinearGaugeScaleLabelProperties extends AxisLabel { + placement?: 'before' | 'after'; +} +declare class LinearGaugeScaleProperties extends BaseProperties { + min: number; + max: number; + fills: _ModuleSupport.PropertiesArray<_ModuleSupport.StopProperties>; + fillMode: AgGradientColorMode; + fill: _ModuleSupport.ShapeColor | undefined; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + defaultFill: string; + readonly interval: LinearGaugeScaleIntervalProperties; + readonly label: LinearGaugeScaleLabelProperties; + getStyle(barEnabled: boolean, defaultColorRange: string[], horizontal: boolean, scale: _ModuleSupport.LinearScale): RequireOptional; +} +export declare class LinearGaugeLabelProperties extends AutoSizedLabel { + text?: string; + placement: AgLinearGaugeLabelPlacement; + avoidCollisions: boolean; +} +export declare class LinearGaugeSeriesProperties extends SeriesProperties { + value: number; + readonly segmentation: GaugeSegmentationProperties; + defaultColorRange: string[]; + targets: _ModuleSupport.PropertiesArray; + defaultTarget: LinearGaugeTargetProperties; + defaultScale: LinearGaugeScaleProperties; + direction: 'horizontal' | 'vertical'; + thickness: number; + cornerRadius: number; + cornerMode: 'container' | 'item'; + margin: number; + readonly scale: LinearGaugeScaleProperties; + readonly bar: LinearGaugeBarProperties; + readonly label: LinearGaugeLabelProperties; + readonly tooltip: _ModuleSupport.SeriesTooltip>; +} +export declare function createLinearGradient(fills: _ModuleSupport.StopProperties[], fillMode: AgGradientColorMode, defaultColorRange: string[], scale: _ModuleSupport.LinearScale, horizontal: boolean): InternalAgGradientColor; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeUtil.d.ts new file mode 100644 index 000000000..dc2fec386 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/linearGaugeUtil.d.ts @@ -0,0 +1,53 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { LinearGaugeLabelDatum } from './linearGaugeSeriesProperties'; +interface AnimatableRectDatum { + x0: number; + y0: number; + x1: number; + y1: number; + clipX0: number | undefined; + clipY0: number | undefined; + clipX1: number | undefined; + clipY1: number | undefined; + horizontalInset: number; + verticalInset: number; +} +type RectAnimationParams = { + x0: number; + y0: number; + x1: number; + y1: number; + clipX0: number | undefined; + clipY0: number | undefined; + clipX1: number | undefined; + clipY1: number | undefined; + horizontalInset: number; + verticalInset: number; +}; +interface Ctx { + chartService: { + context?: unknown; + }; +} +export declare function prepareLinearGaugeSeriesAnimationFunctions(initialLoad: boolean, horizontal: boolean): { + node: _ModuleSupport.FromToFns<_ModuleSupport.Rect, RectAnimationParams, AnimatableRectDatum>; +}; +export declare function resetLinearGaugeSeriesResetRectFunction(_node: _ModuleSupport.Rect, datum: AnimatableRectDatum): { + x: number; + y: number; + width: number; + height: number; + clipBBox: _ModuleSupport.BBox | undefined; + visible: boolean; +}; +export declare function formatLinearGaugeLabels(series: _ModuleSupport.Series<_ModuleSupport.DatumIndexType, any, object, any>, ctx: Ctx, selection: _ModuleSupport.Selection<_ModuleSupport.Text, LinearGaugeLabelDatum>, opts: { + padding: number; + horizontal: boolean; +}, bboxes: { + seriesRect: _ModuleSupport.BBox; + gaugeRect: _ModuleSupport.BBox; + barRect: _ModuleSupport.BBox; +}, datumOverrides?: { + label: number | undefined; +}): void; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/main.d.ts new file mode 100644 index 000000000..1dcc5fb3f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/linear-gauge/main.d.ts @@ -0,0 +1 @@ +export { LinearGaugeModule } from './linearGaugeModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/index.d.ts new file mode 100644 index 000000000..0e26c24d0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/index.d.ts @@ -0,0 +1 @@ +export { MapLineBackgroundSeriesModule } from './mapLineBackgroundModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/main.d.ts new file mode 100644 index 000000000..17c6daabf --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/main.d.ts @@ -0,0 +1 @@ +export { MapLineBackgroundModule } from './mapLineBackgroundModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundModule.d.ts new file mode 100644 index 000000000..53a9e6fb2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundModule.d.ts @@ -0,0 +1,4 @@ +import type { AgMapLineBackgroundOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const MapLineBackgroundModule: _ModuleSupport.SeriesModule<'map-line-background'>; +export declare const MapLineBackgroundSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundSeries.d.ts new file mode 100644 index 000000000..6b7957c15 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundSeries.d.ts @@ -0,0 +1,43 @@ +import { type AgMapLineBackgroundOptions, _ModuleSupport } from 'ag-charts-community'; +import { TopologySeries } from '../map-util/topologySeries'; +import { type MapLineBackgroundNodeDatum, MapLineBackgroundSeriesProperties } from './mapLineBackgroundSeriesProperties'; +interface MapLineNodeDataContext extends _ModuleSupport.DataModelSeriesNodeDataContext { +} +export declare class MapLineBackgroundSeries extends TopologySeries implements _ModuleSupport.ITopology { + static readonly className = "MapLineBackgroundSeries"; + static readonly type: "map-line-background"; + scale: _ModuleSupport.MercatorScale | undefined; + topologyBounds: _ModuleSupport.LonLatBBox | undefined; + properties: MapLineBackgroundSeriesProperties; + private _chartTopology?; + getNodeData(): MapLineBackgroundNodeDatum[] | undefined; + private get topology(); + get focusable(): boolean; + setOptionsData(): void; + setChartData(): void; + get hasData(): boolean; + private readonly itemGroup; + private datumSelection; + private contextNodeData?; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + renderToOffscreenCanvas(): boolean; + setChartTopology(topology: any): void; + setZIndex(zIndex: number): boolean; + private nodeFactory; + processData(): void; + createNodeData(): { + itemId: string; + nodeData: MapLineBackgroundNodeDatum[]; + labelData: never[]; + } | undefined; + updateSelections(): void; + update(): void; + private updateDatumSelection; + private updateDatumNodes; + resetAnimation(): void; + getLegendData(): never[]; + getTooltipContent(_seriesDatum: any): _ModuleSupport.TooltipContent | undefined; + protected computeFocusBounds(_opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundSeriesOptionsDef.d.ts new file mode 100644 index 000000000..b82912d91 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgMapLineBackgroundOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const mapLineBackgroundSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundSeriesProperties.d.ts new file mode 100644 index 000000000..7a052ec05 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line-background/mapLineBackgroundSeriesProperties.d.ts @@ -0,0 +1,18 @@ +import type { AgMapLineBackgroundOptions, AgMapLineSeriesStyle } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +declare const SeriesProperties: typeof _ModuleSupport.SeriesProperties; +export interface MapLineBackgroundNodeDatum extends _ModuleSupport.DataModelSeriesNodeDatum { + readonly index: number; + readonly projectedGeometry: _ModuleSupport.Geometry; + style: AgMapLineSeriesStyle; +} +export declare class MapLineBackgroundSeriesProperties extends SeriesProperties { + topology?: _ModuleSupport.FeatureCollection; + stroke: string; + strokeOpacity: number; + strokeWidth: number; + lineDash: number[]; + lineDashOffset: number; + readonly tooltip: _ModuleSupport.SeriesTooltip>; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/index.d.ts new file mode 100644 index 000000000..479b0b99b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/index.d.ts @@ -0,0 +1 @@ +export { MapLineSeriesModule } from './mapLineModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/main.d.ts new file mode 100644 index 000000000..6e2b9c87b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/main.d.ts @@ -0,0 +1 @@ +export { MapLineModule } from './mapLineModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineModule.d.ts new file mode 100644 index 000000000..f2a0822d5 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineModule.d.ts @@ -0,0 +1,4 @@ +import { type AgMapLineSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const MapLineModule: _ModuleSupport.SeriesModule<'map-line'>; +export declare const MapLineSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineSeries.d.ts new file mode 100644 index 000000000..34a5f3bb6 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineSeries.d.ts @@ -0,0 +1,59 @@ +import { type AgMapLineSeriesStyle, _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import type { AgMapLineSeriesOptions } from 'ag-charts-types'; +import { GeoGeometry } from '../map-util/geoGeometry'; +import { TopologySeries } from '../map-util/topologySeries'; +import { type MapLineNodeDatum, type MapLineNodeLabelDatum, MapLineSeriesProperties } from './mapLineSeriesProperties'; +interface MapLineNodeDataContext extends _ModuleSupport.DataModelSeriesNodeDataContext { +} +export declare class MapLineSeries extends TopologySeries { + static readonly className = "MapLineSeries"; + static readonly type: "map-line"; + scale: _ModuleSupport.MercatorScale | undefined; + topologyBounds: _ModuleSupport.LonLatBBox | undefined; + properties: MapLineSeriesProperties; + private _chartTopology?; + getNodeData(): MapLineNodeDatum[] | undefined; + private get topology(); + get hasData(): boolean; + private readonly colorScale; + private readonly sizeScale; + datumSelection: _ModuleSupport.Selection; + private labelSelection; + private highlightDatumSelection; + contextNodeData?: MapLineNodeDataContext; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + renderToOffscreenCanvas(): boolean; + setZIndex(zIndex: number): boolean; + setChartTopology(topology: any): void; + private isLabelEnabled; + private nodeFactory; + processData(dataController: _ModuleSupport.DataController): Promise; + private isColorScaleValid; + private getLabelDatum; + createNodeData(): { + itemId: string; + nodeData: MapLineNodeDatum[]; + labelData: MapLineNodeLabelDatum[]; + } | undefined; + updateSelections(): void; + update(): void; + private updateDatumSelection; + protected getItemStyle({ datumIndex, datum, colorValue, sizeValue }: Partial, isHighlight: boolean): Required; + private makeItemStylerParams; + private updateDatumStyles; + private updateDatumNodes; + updatePlacedLabelData(labelData: _ModuleSupport.PlacedLabel[]): void; + private updateLabelNodes; + resetAnimation(): void; + getLabelData(): MapLineNodeLabelDatum[]; + pickNodeClosestDatum({ x, y }: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + private _previousDatumMidPoint; + datumMidPoint(datum: _ModuleSupport.SeriesNodeDatum<_ModuleSupport.DatumIndexType>): Point | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[] | _ModuleSupport.GradientLegendDatum[]; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + protected computeFocusBounds(opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineSeriesOptionsDef.d.ts new file mode 100644 index 000000000..8d33e6664 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgMapLineSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const mapLineSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineSeriesProperties.d.ts new file mode 100644 index 000000000..772564df2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-line/mapLineSeriesProperties.d.ts @@ -0,0 +1,42 @@ +import type { AgMapLineSeriesItemStylerParams, AgMapLineSeriesLabelFormatterParams, AgMapLineSeriesOptions, AgMapLineSeriesStyle, AgMapLineSeriesTooltipRendererParams, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +declare const SeriesProperties: typeof _ModuleSupport.SeriesProperties; +export interface MapLineNodeLabelDatum extends _ModuleSupport.PointLabelDatum { +} +export interface MapLineNodeDatum extends _ModuleSupport.DataModelSeriesNodeDatum { + readonly itemId: string; + readonly idValue: string; + readonly labelValue: string | undefined; + readonly colorValue: number | undefined; + readonly sizeValue: number | undefined; + readonly legendItemName: string | undefined; + readonly projectedGeometry: _ModuleSupport.Geometry | undefined; + style: AgMapLineSeriesStyle; +} +export declare class MapLineSeriesProperties extends SeriesProperties { + topology?: _ModuleSupport.FeatureCollection; + title?: string; + legendItemName?: string; + idKey: string; + topologyIdKey: string; + idName?: string; + labelKey?: string; + labelName?: string; + sizeKey?: string; + sizeName?: string; + colorKey?: string; + colorName?: string; + sizeDomain?: [number, number]; + colorRange: string[] | undefined; + maxStrokeWidth?: number; + stroke: string; + strokeOpacity: number; + strokeWidth: number; + lineDash: number[]; + lineDashOffset: number; + itemStyler?: Styler, AgMapLineSeriesStyle>; + readonly label: _ModuleSupport.Label; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + getStyle(): Required; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/index.d.ts new file mode 100644 index 000000000..f5e07b959 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/index.d.ts @@ -0,0 +1 @@ +export { MapMarkerSeriesModule } from './mapMarkerModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/main.d.ts new file mode 100644 index 000000000..058e58cfb --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/main.d.ts @@ -0,0 +1 @@ +export { MapMarkerModule } from './mapMarkerModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerModule.d.ts new file mode 100644 index 000000000..24b7dca8d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerModule.d.ts @@ -0,0 +1,4 @@ +import { type AgMapMarkerSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import { type SeriesModuleDefinition } from 'ag-charts-core'; +export declare const MapMarkerModule: _ModuleSupport.SeriesModule<'map-marker'>; +export declare const MapMarkerSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerSeries.d.ts new file mode 100644 index 000000000..224fb0c2c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerSeries.d.ts @@ -0,0 +1,67 @@ +import { type AgMapMarkerSeriesStyle, _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import { type AgMapMarkerSeriesOptions } from 'ag-charts-types'; +import { TopologySeries } from '../map-util/topologySeries'; +import { type MapMarkerNodeDatum, type MapMarkerNodeLabelDatum, MapMarkerSeriesProperties } from './mapMarkerSeriesProperties'; +interface MapMarkerNodeDataContext extends _ModuleSupport.DataModelSeriesNodeDataContext { +} +export declare class MapMarkerSeries extends TopologySeries implements _ModuleSupport.ITopology { + static readonly className = "MapMarkerSeries"; + static readonly type: "map-marker"; + scale: _ModuleSupport.MercatorScale | undefined; + topologyBounds: _ModuleSupport.LonLatBBox | undefined; + properties: MapMarkerSeriesProperties; + private _chartTopology?; + getNodeData(): MapMarkerNodeDatum[] | undefined; + private get topology(); + get hasData(): boolean; + private readonly colorScale; + private readonly sizeScale; + private readonly markerGroup; + private labelSelection; + private markerSelection; + private highlightMarkerSelection; + private contextNodeData?; + private readonly animationState; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + renderToOffscreenCanvas(): boolean; + setChartTopology(topology: any): void; + setZIndex(zIndex: number): boolean; + private isLabelEnabled; + processData(dataController: _ModuleSupport.DataController): Promise; + private isColorScaleValid; + private getLabelDatum; + createNodeData(): { + itemId: string; + nodeData: MapMarkerNodeDatum[]; + labelData: MapMarkerNodeLabelDatum[]; + } | undefined; + updateSelections(): void; + private previousScale; + private checkScaleChange; + update({ seriesRect }: { + seriesRect?: _ModuleSupport.BBox; + }): void; + updatePlacedLabelData(labelData: _ModuleSupport.PlacedLabel[]): void; + private updateLabelNodes; + private updateMarkerSelection; + protected getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }: Partial, isHighlight: boolean): Required; + private makeItemStylerParams; + private updateMarkerNodes; + isProcessedDataAnimatable(): boolean; + resetAnimation(phase: _ModuleSupport.ChartAnimationPhase): void; + private resetAllAnimation; + private animateMarkers; + getLabelData(): MapMarkerNodeLabelDatum[]; + pickNodeClosestDatum(p: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[] | _ModuleSupport.GradientLegendDatum[]; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + getFormattedMarkerStyle(markerDatum: MapMarkerNodeDatum): { + size: number; + shape: import("ag-charts-community").AgMarkerShape; + }; + protected computeFocusBounds(opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerSeriesOptionsDef.d.ts new file mode 100644 index 000000000..7c2278c4a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgMapMarkerSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const mapMarkerSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerSeriesProperties.d.ts new file mode 100644 index 000000000..caf30e79a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-marker/mapMarkerSeriesProperties.d.ts @@ -0,0 +1,60 @@ +import type { AgMapMarkerSeriesItemStylerParams, AgMapMarkerSeriesLabelFormatterParams, AgMapMarkerSeriesOptions, AgMapMarkerSeriesStyle, AgMapMarkerSeriesTooltipRendererParams, AgMarkerShape, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +declare const SeriesProperties: typeof _ModuleSupport.SeriesProperties, Label: typeof _ModuleSupport.Label; +export interface MapMarkerNodeLabelDatum extends _ModuleSupport.PointLabelDatum { +} +export interface MapMarkerNodeDatum extends _ModuleSupport.DataModelSeriesNodeDatum { + readonly index: number; + readonly itemId: string | undefined; + readonly idValue: string | undefined; + readonly lonValue: number | undefined; + readonly latValue: number | undefined; + readonly labelValue: string | undefined; + readonly colorValue: number | undefined; + readonly sizeValue: number | undefined; + readonly legendItemName: string | undefined; + readonly point: Readonly<_ModuleSupport.SizedPoint>; + style: AgMapMarkerSeriesStyle; +} +declare class MapMarkerSeriesLabel extends Label { + placement: _ModuleSupport.LabelPlacement; +} +export declare class MapMarkerSeriesProperties extends SeriesProperties { + topology: _ModuleSupport.FeatureCollection | undefined; + title?: string; + legendItemName?: string; + idKey: string | undefined; + topologyIdKey: string; + idName: string | undefined; + latitudeKey: string | undefined; + latitudeName: string | undefined; + longitudeKey: string | undefined; + longitudeName: string | undefined; + labelKey: string | undefined; + labelName: string | undefined; + sizeKey?: string; + sizeName?: string; + colorKey?: string; + colorName?: string; + colorRange: string[] | undefined; + /** One of the predefined marker names, or a marker shape function (for user-defined markers). */ + shape: AgMarkerShape; + size: number; + maxSize: number | undefined; + sizeDomain?: [number, number]; + fill: InternalAgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + itemStyler?: Styler, AgMapMarkerSeriesStyle>; + readonly label: MapMarkerSeriesLabel; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + getStyle(): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/index.d.ts new file mode 100644 index 000000000..303d36e51 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/index.d.ts @@ -0,0 +1 @@ +export { MapShapeBackgroundSeriesModule } from './mapShapeBackgroundModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/main.d.ts new file mode 100644 index 000000000..6196abd89 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/main.d.ts @@ -0,0 +1 @@ +export { MapShapeBackgroundModule } from './mapShapeBackgroundModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundModule.d.ts new file mode 100644 index 000000000..b49a2b9af --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundModule.d.ts @@ -0,0 +1,4 @@ +import { type AgMapShapeBackgroundOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const MapShapeBackgroundModule: _ModuleSupport.SeriesModule<'map-shape-background'>; +export declare const MapShapeBackgroundSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundSeries.d.ts new file mode 100644 index 000000000..1fad36c7b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundSeries.d.ts @@ -0,0 +1,44 @@ +import { type AgMapShapeBackgroundOptions, _ModuleSupport } from 'ag-charts-community'; +import { TopologySeries } from '../map-util/topologySeries'; +import { type MapShapeBackgroundNodeDatum, MapShapeBackgroundSeriesProperties } from './mapShapeBackgroundSeriesProperties'; +interface MapShapeBackgroundNodeDataContext extends _ModuleSupport.DataModelSeriesNodeDataContext { +} +export declare class MapShapeBackgroundSeries extends TopologySeries implements _ModuleSupport.ITopology { + static readonly className = "MapShapeBackgroundSeries"; + static readonly type: "map-shape-background"; + scale: _ModuleSupport.MercatorScale | undefined; + topologyBounds: _ModuleSupport.LonLatBBox | undefined; + properties: MapShapeBackgroundSeriesProperties; + private _chartTopology?; + private get topology(); + get focusable(): boolean; + setOptionsData(): void; + setChartData(): void; + getNodeData(): MapShapeBackgroundNodeDatum[] | undefined; + get hasData(): boolean; + private readonly itemGroup; + private datumSelection; + private contextNodeData?; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + renderToOffscreenCanvas(): boolean; + setChartTopology(topology: any): void; + setZIndex(zIndex: number): boolean; + private nodeFactory; + processData(): void; + createNodeData(): { + itemId: string; + nodeData: MapShapeBackgroundNodeDatum[]; + labelData: never[]; + } | undefined; + updateSelections(): void; + update(): void; + private updateDatumSelection; + private updateDatumNodes; + resetAnimation(): void; + getLegendData(): never[]; + getTooltipContent(_seriesDatum: any): _ModuleSupport.TooltipContent | undefined; + pickFocus(): undefined; + protected computeFocusBounds(_opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundSeriesOptionsDef.d.ts new file mode 100644 index 000000000..e6e912479 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgMapShapeBackgroundOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const mapShapeBackgroundSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundSeriesProperties.d.ts new file mode 100644 index 000000000..1107a5e02 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape-background/mapShapeBackgroundSeriesProperties.d.ts @@ -0,0 +1,21 @@ +import type { AgMapShapeBackgroundOptions, AgMapShapeBackgroundThemeableOptions } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +declare const SeriesProperties: typeof _ModuleSupport.SeriesProperties; +export interface MapShapeBackgroundNodeDatum extends _ModuleSupport.DataModelSeriesNodeDatum { + readonly index: number; + readonly projectedGeometry: _ModuleSupport.Geometry; + style: AgMapShapeBackgroundThemeableOptions; +} +export declare class MapShapeBackgroundSeriesProperties extends SeriesProperties { + topology?: _ModuleSupport.FeatureCollection; + fill: InternalAgColorType; + fillOpacity: number; + stroke: string; + strokeOpacity: number; + strokeWidth: number; + lineDash: number[]; + lineDashOffset: number; + readonly tooltip: _ModuleSupport.SeriesTooltip>; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/index.d.ts new file mode 100644 index 000000000..62cbd7e8d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/index.d.ts @@ -0,0 +1 @@ +export { MapShapeSeriesModule } from './mapShapeModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/main.d.ts new file mode 100644 index 000000000..8c7128725 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/main.d.ts @@ -0,0 +1 @@ +export { MapShapeModule } from './mapShapeModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeModule.d.ts new file mode 100644 index 000000000..bddb7a3ea --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeModule.d.ts @@ -0,0 +1,4 @@ +import { type AgMapShapeSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const MapShapeModule: _ModuleSupport.SeriesModule<'map-shape'>; +export declare const MapShapeSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeSeries.d.ts new file mode 100644 index 000000000..c141f4fab --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeSeries.d.ts @@ -0,0 +1,61 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import type { AgMapShapeSeriesOptions, AgMapShapeSeriesStyle } from 'ag-charts-types'; +import { GeoGeometry } from '../map-util/geoGeometry'; +import { TopologySeries } from '../map-util/topologySeries'; +import { type MapShapeNodeDatum, type MapShapeNodeLabelDatum, MapShapeSeriesProperties } from './mapShapeSeriesProperties'; +interface MapShapeNodeDataContext extends _ModuleSupport.DataModelSeriesNodeDataContext { +} +export declare class MapShapeSeries extends TopologySeries implements _ModuleSupport.ITopology { + static readonly className = "MapShapeSeries"; + static readonly type: "map-shape"; + scale: _ModuleSupport.MercatorScale | undefined; + topologyBounds: _ModuleSupport.LonLatBBox | undefined; + properties: MapShapeSeriesProperties; + private _chartTopology?; + getNodeData(): MapShapeNodeDatum[] | undefined; + private get topology(); + get hasData(): boolean; + private readonly colorScale; + private readonly itemGroup; + private readonly itemLabelGroup; + datumSelection: _ModuleSupport.Selection; + private labelSelection; + private highlightDatumSelection; + contextNodeData?: MapShapeNodeDataContext; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + renderToOffscreenCanvas(): boolean; + setChartTopology(topology: any): void; + setZIndex(zIndex: number): boolean; + private isLabelEnabled; + private nodeFactory; + processData(dataController: _ModuleSupport.DataController): Promise; + private isColorScaleValid; + private getLabelLayout; + private getLabelDatum; + private previousLabelLayouts; + createNodeData(): { + itemId: string; + nodeData: MapShapeNodeDatum[]; + labelData: MapShapeNodeLabelDatum[]; + } | undefined; + updateSelections(): void; + update(): void; + private updateDatumSelection; + protected getItemStyle({ datumIndex, datum, colorValue }: Partial, isHighlight: boolean): Required; + private makeItemStylerParams; + private updateDatumStyles; + private updateDatumNodes; + private updateLabelSelection; + private updateLabelNodes; + resetAnimation(): void; + pickNodeClosestDatum({ x, y }: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + private _previousDatumMidPoint; + datumMidPoint(datum: _ModuleSupport.SeriesNodeDatum<_ModuleSupport.DatumIndexType>): Point | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[] | _ModuleSupport.GradientLegendDatum[]; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + protected computeFocusBounds(opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.Path | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeSeriesOptionsDef.d.ts new file mode 100644 index 000000000..c6095d895 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgMapShapeSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const mapShapeSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeSeriesProperties.d.ts new file mode 100644 index 000000000..b1bc949f1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-shape/mapShapeSeriesProperties.d.ts @@ -0,0 +1,49 @@ +import type { AgMapShapeSeriesItemStylerParams, AgMapShapeSeriesLabelFormatterParams, AgMapShapeSeriesOptions, AgMapShapeSeriesStyle, AgMapShapeSeriesTooltipRendererParams, Styler, TextOrSegments } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +import { AutoSizedSecondaryLabel } from '../util/autoSizedLabel'; +declare const SeriesProperties: typeof _ModuleSupport.SeriesProperties; +export interface MapShapeNodeLabelDatum { + readonly x: number; + readonly y: number; + readonly text: TextOrSegments; + readonly fontSize: number; + readonly lineHeight: number; +} +export interface MapShapeNodeDatum extends _ModuleSupport.DataModelSeriesNodeDatum { + readonly itemId: string; + readonly idValue: string; + readonly colorValue: number | undefined; + readonly labelValue: string | undefined; + readonly legendItemName: string | undefined; + readonly projectedGeometry: _ModuleSupport.Geometry | undefined; + style: AgMapShapeSeriesStyle; +} +export declare class MapShapeSeriesProperties extends SeriesProperties { + topology?: _ModuleSupport.FeatureCollection; + title?: string; + legendItemName?: string; + idKey: string; + idName: string | undefined; + topologyIdKey: string; + labelKey: string | undefined; + labelName: string | undefined; + colorKey?: string; + colorName?: string; + colorRange: string[] | undefined; + fill: InternalAgColorType; + fillOpacity: number; + stroke: string; + strokeOpacity: number; + strokeWidth: number; + lineDash: number[]; + lineDashOffset: number; + padding: number; + itemStyler?: Styler, AgMapShapeSeriesStyle>; + readonly label: AutoSizedSecondaryLabel; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + getStyle(): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/geoGeometry.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/geoGeometry.d.ts new file mode 100644 index 000000000..f98125562 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/geoGeometry.d.ts @@ -0,0 +1,23 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const Path: typeof _ModuleSupport.Path; +export declare enum GeoGeometryRenderMode { + All = 3, + Polygons = 1, + Lines = 2 +} +export declare class GeoGeometry extends Path implements _ModuleSupport.DistantObject { + projectedGeometry: _ModuleSupport.Geometry | undefined; + renderMode: GeoGeometryRenderMode; + private bbox; + private readonly strokePath; + protected computeBBox(): _ModuleSupport.BBox | undefined; + updatePath(): void; + drawPath(ctx: any): void; + containsPoint(x: number, y: number): boolean; + distanceSquared(x: number, y: number): number; + private geometryDistance; + private drawGeometry; + private drawPolygon; + private drawLineString; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/geometryUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/geometryUtil.d.ts new file mode 100644 index 000000000..06e452b2a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/geometryUtil.d.ts @@ -0,0 +1,11 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare function geometryBbox(geometry: _ModuleSupport.Geometry, into: _ModuleSupport.LonLatBBox | undefined): _ModuleSupport.LonLatBBox | undefined; +export declare function largestPolygon(geometry: _ModuleSupport.Geometry): _ModuleSupport.Position[][] | undefined; +export declare function largestLineString(geometry: _ModuleSupport.Geometry): _ModuleSupport.Position[] | undefined; +export declare enum GeometryType { + Polygon = 1, + LineString = 2, + Point = 4 +} +export declare function containsType(geometry: _ModuleSupport.Geometry | null, type: GeometryType): boolean; +export declare function projectGeometry(geometry: _ModuleSupport.Geometry, scale: _ModuleSupport.MercatorScale): _ModuleSupport.Geometry; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/lineStringUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/lineStringUtil.d.ts new file mode 100644 index 000000000..a4f3598af --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/lineStringUtil.d.ts @@ -0,0 +1,8 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare function lineSegmentDistanceToPointSquared(a: _ModuleSupport.Position, b: _ModuleSupport.Position, x: number, y: number): number; +export declare function lineStringDistance(lineString: _ModuleSupport.Position[], x: number, y: number): number; +export declare function lineStringLength(lineSegment: _ModuleSupport.Position[]): number; +export declare function lineStringCenter(lineSegment: _ModuleSupport.Position[]): { + point: _ModuleSupport.Position; + angle: number; +} | undefined; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/mapThemeDefaults.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/mapThemeDefaults.d.ts new file mode 100644 index 000000000..6eb92c376 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/mapThemeDefaults.d.ts @@ -0,0 +1,3 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const MAP_THEME_DEFAULTS: _ModuleSupport.ExtensibleTheme<'map-shape' | 'map-line' | 'map-marker'>; +export declare function applyMapPalette(object: T): T; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/mapUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/mapUtil.d.ts new file mode 100644 index 000000000..daedecc70 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/mapUtil.d.ts @@ -0,0 +1,18 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +import type { GeoGeometry } from './geoGeometry'; +type AnimatableMapMarkerDatum = { + scalingX: number; + scalingY: number; +}; +export declare function prepareMapMarkerAnimationFunctions(): { + fromFn: _ModuleSupport.FromToMotionPropFn<_ModuleSupport.Marker, AnimatableMapMarkerDatum, unknown>; + toFn: _ModuleSupport.FromToMotionPropFn<_ModuleSupport.Marker, AnimatableMapMarkerDatum, unknown>; +}; +type SomeMapSeries = { + contextNodeData?: { + nodeData: TDatum[]; + }; + datumSelection: _ModuleSupport.Selection; +}; +export declare function findFocusedGeoGeometry(series: SomeMapSeries, opts: _ModuleSupport.PickFocusInputs): GeoGeometry | undefined; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/mapZIndexMap.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/mapZIndexMap.d.ts new file mode 100644 index 000000000..90acf4148 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/mapZIndexMap.d.ts @@ -0,0 +1,7 @@ +export declare enum MapZIndexMap { + ShapeLineBackground = 0, + ShapeLine = 1, + ShapeLineHighlight = 2, + Marker = 3, + MarkerHighlight = 4 +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/markerUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/markerUtil.d.ts new file mode 100644 index 000000000..cda220357 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/markerUtil.d.ts @@ -0,0 +1,3 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare function polygonMarkerCenter(polygons: _ModuleSupport.Position[][], precision: number): _ModuleSupport.Position | undefined; +export declare function markerPositions(geometry: _ModuleSupport.Geometry, precision: number): _ModuleSupport.Position[]; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/polygonLabelUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/polygonLabelUtil.d.ts new file mode 100644 index 000000000..9ba777534 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/polygonLabelUtil.d.ts @@ -0,0 +1,21 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare function preferredLabelCenter(polygons: _ModuleSupport.Position[][], { aspectRatio, precision }: { + aspectRatio: number; + precision: number; +}): { + x: number; + y: number; + maxWidth: number; +} | undefined; +export declare function maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(a: _ModuleSupport.Position, b: _ModuleSupport.Position, cx: number, cy: number, aspectRatio: number): number; +export declare function xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(into: { + minX: number; + maxX: number; +}, a: _ModuleSupport.Position, b: _ModuleSupport.Position, cx: number, cy: number, height: number): { + minX: number; + maxX: number; +}; +export declare function maxWidthInPolygonForRectOfHeight(polygons: _ModuleSupport.Position[][], cx: number, cy: number, height: number): { + x: number; + width: number; +}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/polygonPointSearch.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/polygonPointSearch.d.ts new file mode 100644 index 000000000..8c449d9d5 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/polygonPointSearch.d.ts @@ -0,0 +1,9 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare function polygonPointSearch(polygons: _ModuleSupport.Position[][], precision: number, valueFn: (polygons: _ModuleSupport.Position[][], x: number, y: number, stride: number) => { + distance: number; + maxDistance: number; +}): { + x: number; + y: number; + distance: number; +} | undefined; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/polygonUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/polygonUtil.d.ts new file mode 100644 index 000000000..623a3288f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/polygonUtil.d.ts @@ -0,0 +1,5 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare function polygonBbox(polygon: _ModuleSupport.Position[], into: _ModuleSupport.LonLatBBox | undefined): _ModuleSupport.LonLatBBox | undefined; +export declare function polygonCentroid(polygon: _ModuleSupport.Position[]): _ModuleSupport.Position | undefined; +/** Distance from a point to a polygon. Negative if inside the polygon. */ +export declare function polygonDistance(polygons: _ModuleSupport.Position[][], x: number, y: number): number; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/shapeFillBBox.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/shapeFillBBox.d.ts new file mode 100644 index 000000000..5a84364fe --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/shapeFillBBox.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare function getTopologyShapeFillBBox(scale: _ModuleSupport.MercatorScale | undefined): _ModuleSupport.ShapeFillBBox | undefined; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/topologySeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/topologySeries.d.ts new file mode 100644 index 000000000..b237cce5d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/map-util/topologySeries.d.ts @@ -0,0 +1,13 @@ +import { _ModuleSupport } from 'ag-charts-community'; +interface TopologySeriesNodeDatum extends _ModuleSupport.DataModelSeriesNodeDatum { +} +interface TopologySeriesNodeDataContext extends _ModuleSupport.DataModelSeriesNodeDataContext { +} +declare abstract class TopologySeriesProperties extends _ModuleSupport.SeriesProperties { +} +export declare abstract class TopologySeries, TLabel extends object, TContext extends TopologySeriesNodeDataContext = TopologySeriesNodeDataContext> extends _ModuleSupport.DataModelSeries { + addChartEventListeners(): void; + getSeriesDomain(): number[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, _visibleRange: [any, any]): [number, number]; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/index.d.ts new file mode 100644 index 000000000..4db385bad --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/index.d.ts @@ -0,0 +1 @@ +export { NightingaleSeriesModule } from './nightingaleModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/main.d.ts new file mode 100644 index 000000000..ee6ce9bba --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/main.d.ts @@ -0,0 +1 @@ +export { NightingaleModule } from './nightingaleModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleModule.d.ts new file mode 100644 index 000000000..8dd2e1c00 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleModule.d.ts @@ -0,0 +1,4 @@ +import { type AgNightingaleSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const NightingaleModule: _ModuleSupport.SeriesModule<'nightingale'>; +export declare const NightingaleSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleSeries.d.ts new file mode 100644 index 000000000..0c4a0bf2d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleSeries.d.ts @@ -0,0 +1,32 @@ +import { type AgNightingaleSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { RadialColumnNodeDatum } from '../radial-column/radialColumnSeriesBase'; +import { RadialColumnSeriesBase } from '../radial-column/radialColumnSeriesBase'; +import { RadialColumnSeriesBaseProperties } from '../radial-column/radialColumnSeriesBaseProperties'; +export declare class NightingaleSeries extends RadialColumnSeriesBase<_ModuleSupport.Sector> { + static readonly className = "NightingaleSeries"; + static readonly type: "nightingale"; + properties: RadialColumnSeriesBaseProperties>; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + setZIndex(zIndex: number): boolean; + protected getStackId(): string; + protected nodeFactory(): _ModuleSupport.Sector; + protected updateItemPath(node: _ModuleSupport.Sector, datum: RadialColumnNodeDatum, highlight: boolean): void; + protected getColumnTransitionFunctions(): { + toFn: (_sect: _ModuleSupport.Sector, datum: RadialColumnNodeDatum, status: _ModuleSupport.NodeUpdateState) => { + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + clipSector: _ModuleSupport.SectorBox; + }; + fromFn: (sect: _ModuleSupport.Sector, datum: RadialColumnNodeDatum, status: _ModuleSupport.NodeUpdateState) => { + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + clipSector: _ModuleSupport.SectorBox; + phase: "end" | "remove" | "initial" | "none" | "update" | "add" | "trailing"; + }; + }; + protected hasItemStylers(): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleSeriesOptionsDef.d.ts new file mode 100644 index 000000000..5712c00b9 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgNightingaleSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const nightingaleSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleThemes.d.ts new file mode 100644 index 000000000..4229875f7 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleThemes.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const NIGHTINGALE_SERIES_THEME: _ModuleSupport.SeriesModule<'nightingale'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleUtil.d.ts new file mode 100644 index 000000000..dbd5341c2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/nightingale/nightingaleUtil.d.ts @@ -0,0 +1,32 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { RadialColumnNodeDatum } from '../radial-column/radialColumnSeriesBase'; +export declare function getRadii(datum: RadialColumnNodeDatum): { + innerRadius: number; + outerRadius: number; + clipInnerRadius: number; + clipOuterRadius: number; +}; +export declare function prepareNightingaleAnimationFunctions(axisZeroRadius: number): { + toFn: (_sect: _ModuleSupport.Sector, datum: RadialColumnNodeDatum, status: _ModuleSupport.NodeUpdateState) => { + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + clipSector: _ModuleSupport.SectorBox; + }; + fromFn: (sect: _ModuleSupport.Sector, datum: RadialColumnNodeDatum, status: _ModuleSupport.NodeUpdateState) => { + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + clipSector: _ModuleSupport.SectorBox; + phase: "end" | "remove" | "initial" | "none" | "update" | "add" | "trailing"; + }; +}; +export declare function resetNightingaleSelectionFn(_sect: _ModuleSupport.Sector, datum: RadialColumnNodeDatum): { + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + clipSector: _ModuleSupport.SectorBox; +}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/index.d.ts new file mode 100644 index 000000000..8e19308ae --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/index.d.ts @@ -0,0 +1 @@ +export { OhlcSeriesModule } from './ohlcModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/main.d.ts new file mode 100644 index 000000000..78898663a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/main.d.ts @@ -0,0 +1 @@ +export { OhlcModule } from './ohlcModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcAggregation.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcAggregation.d.ts new file mode 100644 index 000000000..5d6abcfd7 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcAggregation.d.ts @@ -0,0 +1,12 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const AGGREGATION_SPAN: number; +export declare const OPEN = 0; +export declare const HIGH = 3; +export declare const LOW = 2; +export declare const CLOSE = 1; +export { AGGREGATION_SPAN as SPAN }; +export interface OhlcSeriesDataAggregationFilter { + indexData: Int32Array; + maxRange: number; +} +export declare function aggregateOhlcData(scale: _ModuleSupport.ScaleType, xValues: any[], highValues: any[], lowValues: any[], domain: number[], smallestKeyInterval: number | undefined): OhlcSeriesDataAggregationFilter[] | undefined; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcModule.d.ts new file mode 100644 index 000000000..5b6ef73eb --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcModule.d.ts @@ -0,0 +1,4 @@ +import { type AgOhlcSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const OhlcModule: _ModuleSupport.SeriesModule<'ohlc'>; +export declare const OhlcSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcNode.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcNode.d.ts new file mode 100644 index 000000000..7ba90d0d3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcNode.d.ts @@ -0,0 +1,33 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const Path: typeof _ModuleSupport.Path; +export declare class OhlcBaseNode extends Path implements _ModuleSupport.DistantObject { + centerX: number; + y: number; + width: number; + height: number; + yOpen: number; + yClose: number; + crisp: boolean; + protected computeBBox(): _ModuleSupport.BBox | undefined; + isPointInPath(x: number, y: number): boolean; + distanceSquared(x: number, y: number): number; + get midPoint(): { + x: number; + y: number; + }; + protected alignedCoordinates(): { + centerX: number; + x0: number; + x1: number; + y0: number; + y1: number; + yOpen: number; + yClose: number; + }; + protected executeStroke(ctx: _ModuleSupport.CanvasContext, path?: Path2D): void; +} +export declare class OhlcNode extends OhlcBaseNode { + strokeAlignment: number; + updatePath(): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeries.d.ts new file mode 100644 index 000000000..66bde3ed3 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeries.d.ts @@ -0,0 +1,21 @@ +import { type AgOhlcSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import { OhlcNode } from './ohlcNode'; +import { OhlcSeriesBase } from './ohlcSeriesBase'; +import type { OhlcNodeDatum } from './ohlcSeriesBase'; +import { OhlcSeriesProperties } from './ohlcSeriesProperties'; +export declare class OhlcSeries extends OhlcSeriesBase { + static readonly className = "ohlc"; + static readonly type: "ohlc"; + properties: OhlcSeriesProperties; + protected nodeFactory(): OhlcNode; + protected updateDatumStyles({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection; + isHighlight: boolean; + }): void; + protected updateDatumNodes({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection; + isHighlight: boolean; + }): void; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + protected hasItemStylers(): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeriesBase.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeriesBase.d.ts new file mode 100644 index 000000000..d7de369cf --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeriesBase.d.ts @@ -0,0 +1,94 @@ +import { type AgCandlestickSeriesItemOptions, type AgOhlcSeriesBaseOptions, type AgOhlcSeriesItemOptions, type AgOhlcSeriesItemType, type FillOptions, type LineDashOptions, type StrokeOptions, _ModuleSupport } from 'ag-charts-community'; +import type { OhlcBaseNode } from './ohlcNode'; +import type { OhlcSeriesBaseProperties } from './ohlcSeriesProperties'; +interface OhlcCandleStickSeriesStyle extends AgCandlestickSeriesItemOptions, AgOhlcSeriesItemOptions { +} +export interface OhlcNodeDatum extends Omit<_ModuleSupport.CartesianSeriesNodeDatum, 'yKey' | 'yValue'> { + readonly itemId: AgOhlcSeriesItemType; + readonly openValue: number; + readonly closeValue: number; + readonly highValue?: number; + readonly lowValue?: number; + readonly aggregatedValue: number; + readonly isRising: boolean; + readonly centerX: number; + readonly width: number; + readonly y: number; + readonly height: number; + readonly yOpen: number; + readonly yClose: number; + readonly crisp: boolean; + style?: Required; +} +declare class OhlcSeriesNodeEvent extends _ModuleSupport.SeriesNodeEvent { + readonly xKey?: string; + readonly openKey?: string; + readonly closeKey?: string; + readonly highKey?: string; + readonly lowKey?: string; + constructor(type: TEvent, nativeEvent: Event, datum: OhlcNodeDatum, series: OhlcSeriesBase); +} +interface OhlcSeriesBaseNodeDataContext extends _ModuleSupport.AbstractBarSeriesNodeDataContext { + styles: Record<'up' | 'down', _ModuleSupport.SeriesNodeStyleContext>; +} +export declare abstract class OhlcSeriesBase> extends _ModuleSupport.AbstractBarSeries { + protected readonly NodeEvent: typeof OhlcSeriesNodeEvent; + private dataAggregationFilters; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + processData(dataController: _ModuleSupport.DataController): Promise; + private aggregateData; + getSeriesDomain(direction: _ModuleSupport.ChartAxisDirection): any[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, visibleRange: [any, any]): any[]; + getZoomRangeFittingItems(xVisibleRange: [number, number], yVisibleRange: [number, number] | undefined, minVisibleItems: number): { + x: [number, number]; + y: [number, number] | undefined; + } | undefined; + getVisibleItems(xVisibleRange: [number, number], yVisibleRange: [number, number] | undefined, minVisibleItems: number): number; + createNodeData(): { + itemId: string; + nodeData: OhlcNodeDatum[]; + labelData: never[]; + scales: { + x?: _ModuleSupport.Scaling | undefined; + y?: _ModuleSupport.Scaling | undefined; + angle?: _ModuleSupport.Scaling | undefined; + radius?: _ModuleSupport.Scaling | undefined; + }; + groupScale: _ModuleSupport.Scaling | undefined; + visible: boolean; + styles: Record<"up" | "down", Record<_ModuleSupport.HighlightState, Required & { + opacity: number; + } & Required & { + opacity: number; + } & FillOptions & StrokeOptions & LineDashOptions & { + opacity?: number | undefined; + }>>; + } | undefined; + protected isVertical(): boolean; + protected isLabelEnabled(): boolean; + protected updateDatumSelection(opts: { + nodeData: OhlcNodeDatum[]; + datumSelection: _ModuleSupport.Selection; + seriesIdx: number; + }): _ModuleSupport.Selection; + protected updateLabelNodes(_opts: { + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, OhlcNodeDatum>; + seriesIdx: number; + }): void; + protected updateLabelSelection(opts: { + labelData: OhlcNodeDatum[]; + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, OhlcNodeDatum>; + seriesIdx: number; + }): _ModuleSupport.Selection<_ModuleSupport.Text, OhlcNodeDatum>; + protected getItemStyle(datumIndex: number | undefined, isHighlight: boolean, highlightState?: _ModuleSupport.HighlightState, itemId?: 'up' | 'down'): Required & { + opacity: number; + } & Required & { + opacity: number; + } & FillOptions & StrokeOptions & LineDashOptions & { + opacity?: number | undefined; + }; + private makeItemStylerParams; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + computeFocusBounds(opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeriesOptionsDef.d.ts new file mode 100644 index 000000000..b0af0f98c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgOhlcSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const ohlcSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeriesProperties.d.ts new file mode 100644 index 000000000..68c3b80cb --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/ohlc/ohlcSeriesProperties.d.ts @@ -0,0 +1,44 @@ +import type { AgCandlestickSeriesItemOptions, AgCandlestickSeriesItemStylerParams, AgCandlestickSeriesTooltipRendererParams, AgOhlcSeriesBaseOptions, AgOhlcSeriesItemOptions, AgOhlcSeriesItemStylerParams, AgOhlcSeriesOptions, AgOhlcSeriesTooltipRendererParams, FillOptions, LineDashOptions, StrokeOptions, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties, AbstractBarSeriesProperties: typeof _ModuleSupport.AbstractBarSeriesProperties; +declare class OhlcSeriesItem extends BaseProperties { + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; +} +declare class OhlcSeriesItems extends BaseProperties { + readonly up: OhlcSeriesItem; + readonly down: OhlcSeriesItem; +} +export declare abstract class OhlcSeriesBaseProperties extends AbstractBarSeriesProperties { + abstract item: Record<'up' | 'down', FillOptions & StrokeOptions & LineDashOptions>; + xKey: string; + openKey: string; + closeKey: string; + highKey: string; + lowKey: string; + xName?: string; + yName?: string; + openName?: string; + closeName?: string; + highName?: string; + lowName?: string; + abstract readonly tooltip: _ModuleSupport.SeriesTooltip & AgCandlestickSeriesTooltipRendererParams, 'context'>>; + abstract itemStyler?: Styler, AgOhlcSeriesItemOptions> & Styler, AgCandlestickSeriesItemOptions>; + abstract getStyle(itemId: 'up' | 'down'): (Required & { + opacity: number; + }) | (Required & { + opacity: number; + }); +} +export declare class OhlcSeriesProperties extends OhlcSeriesBaseProperties { + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + readonly item: OhlcSeriesItems; + itemStyler?: Styler, AgOhlcSeriesItemOptions>; + getStyle(itemId: 'up' | 'down'): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/index.d.ts new file mode 100644 index 000000000..fa3aeb7d0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/index.d.ts @@ -0,0 +1 @@ +export { PyramidSeriesModule } from './pyramidModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/main.d.ts new file mode 100644 index 000000000..0aa57ceff --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/main.d.ts @@ -0,0 +1 @@ +export { PyramidModule } from './pyramidModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidModule.d.ts new file mode 100644 index 000000000..c509b51d2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidModule.d.ts @@ -0,0 +1,4 @@ +import type { AgPyramidSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const PyramidModule: _ModuleSupport.SeriesModule<'pyramid'>; +export declare const PyramidSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidProperties.d.ts new file mode 100644 index 000000000..d6b9f87e0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidProperties.d.ts @@ -0,0 +1,33 @@ +import type { AgColorType, AgPyramidSeriesItemStylerParams, AgPyramidSeriesLabelFormatterParams, AgPyramidSeriesOptions, AgPyramidSeriesStyle, AgPyramidSeriesTooltipRendererParams, Direction, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +declare const SeriesProperties: typeof _ModuleSupport.SeriesProperties, Label: typeof _ModuleSupport.Label; +declare class PyramidSeriesLabel extends Label { +} +declare class PyramidSeriesStageLabel extends Label { + spacing: number; + placement?: string; +} +export declare class PyramidProperties extends SeriesProperties { + stageKey: string; + valueKey: string; + fills: AgColorType[]; + fillOpacity: number; + strokes: string[]; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + direction: Direction; + reverse?: boolean; + spacing: number; + aspectRatio?: number; + itemStyler?: Styler, AgPyramidSeriesStyle>; + readonly shadow: _ModuleSupport.DropShadow; + readonly label: PyramidSeriesLabel; + readonly stageLabel: PyramidSeriesStageLabel; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + getStyle(index?: number): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidSeries.d.ts new file mode 100644 index 000000000..e1ef50808 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidSeries.d.ts @@ -0,0 +1,76 @@ +import { type AgPyramidSeriesOptions, type AgPyramidSeriesStyle, type TextOrSegments, _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import { FunnelConnector } from '../funnel/funnelConnector'; +import { PyramidProperties } from './pyramidProperties'; +type PyramidNodeLabelDatum = Readonly & { + readonly text: TextOrSegments; + readonly textAlign: CanvasTextAlign; + readonly textBaseline: CanvasTextBaseline; + readonly visible: boolean; +}; +interface PyramidNodeDatum extends _ModuleSupport.DataModelSeriesNodeDatum, Readonly { + readonly itemId: string; + readonly index: number; + readonly xValue: string; + readonly yValue: number; + readonly top: number; + readonly right: number; + readonly bottom: number; + readonly left: number; + readonly label: PyramidNodeLabelDatum | undefined; + style: AgPyramidSeriesStyle; +} +interface PyramidNodeDataContext extends _ModuleSupport.DataModelSeriesNodeDataContext { + stageLabelData: PyramidNodeLabelDatum[] | undefined; + bounds: _ModuleSupport.BBox; +} +export declare class PyramidSeries extends _ModuleSupport.DataModelSeries { + static readonly className = "PyramidSeries"; + static readonly type: "pyramid"; + properties: PyramidProperties; + private readonly itemGroup; + private readonly itemLabelGroup; + private readonly stageLabelGroup; + datumSelection: _ModuleSupport.Selection; + private labelSelection; + private stageLabelSelection; + private highlightDatumSelection; + contextNodeData?: PyramidNodeDataContext; + private readonly animationState; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + addChartEventListeners(): void; + private nodeFactory; + getNodeData(): PyramidNodeDatum[] | undefined; + resetAnimation(phase: _ModuleSupport.ChartAnimationPhase): void; + processData(dataController: _ModuleSupport.DataController): Promise; + createNodeData(): { + itemId: string; + nodeData: PyramidNodeDatum[]; + labelData: PyramidNodeLabelDatum[]; + stageLabelData: PyramidNodeLabelDatum[] | undefined; + bounds: _ModuleSupport.BBox; + } | undefined; + updateSelections(): void; + update({ seriesRect }: { + seriesRect?: _ModuleSupport.BBox; + }): void; + private updateDatumSelection; + protected getItemStyle({ datumIndex, datum }: Partial, isHighlight: boolean): Required; + private makeItemStylerParams; + private updateDatumStyles; + private updateDatumNodes; + private updateLabelSelection; + private updateStageLabelSelection; + private updateLabelNodes; + protected computeFocusBounds(opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | _ModuleSupport.Path | undefined; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + getSeriesDomain(): any[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, _visibleRange: [any, any]): [number, number]; + pickNodeClosestDatum({ x, y }: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + protected animateReset(): void; + private animateEmptyUpdateReady; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidSeriesOptionsDef.d.ts new file mode 100644 index 000000000..ef5ba7d2c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgPyramidSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const pyramidSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidThemes.d.ts new file mode 100644 index 000000000..32bd18a5b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidThemes.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const PYRAMID_SERIES_THEME: _ModuleSupport.SeriesModule<'pyramid'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidUtil.d.ts new file mode 100644 index 000000000..89f93642f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/pyramid/pyramidUtil.d.ts @@ -0,0 +1,17 @@ +import type { Direction, _ModuleSupport } from 'ag-charts-community'; +import type { FunnelConnector } from '../funnel/funnelConnector'; +type AnimatablePyramidDatum = { + x: number; + y: number; + top: number; + right: number; + bottom: number; + left: number; +}; +export declare function applyPyramidDatum(connector: FunnelConnector, { x, y, top, right, bottom, left }: AnimatablePyramidDatum): void; +export declare function preparePyramidAnimationFunctions(direction: Direction): { + fromFn: _ModuleSupport.FromToMotionPropFn, AnimatablePyramidDatum, T>; + toFn: _ModuleSupport.FromToMotionPropFn, AnimatablePyramidDatum, T>; + applyFn: _ModuleSupport.ApplyFn, AnimatablePyramidDatum>; +}; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/index.d.ts new file mode 100644 index 000000000..b34b7949a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/index.d.ts @@ -0,0 +1 @@ +export { RadarAreaSeriesModule } from './radarAreaModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/main.d.ts new file mode 100644 index 000000000..08741cddf --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/main.d.ts @@ -0,0 +1 @@ +export { RadarAreaModule } from './radarAreaModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaModule.d.ts new file mode 100644 index 000000000..f9088a951 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaModule.d.ts @@ -0,0 +1,4 @@ +import { type AgRadarAreaSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const RadarAreaModule: _ModuleSupport.SeriesModule<'radar-area'>; +export declare const RadarAreaSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaSeries.d.ts new file mode 100644 index 000000000..2e4fb82bd --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaSeries.d.ts @@ -0,0 +1,25 @@ +import { type AgRadarAreaSeriesOptions, type AgRadarAreaSeriesStyle, type AgRadarAreaSeriesStylerParams, _ModuleSupport } from 'ag-charts-community'; +import { RadarSeries, type ResolvedRadarStyle } from '../radar/radarSeries'; +import { RadarAreaSeriesProperties } from './radarAreaSeriesProperties'; +type S = AgRadarAreaSeriesStyle; +type O = AgRadarAreaSeriesOptions; +type P = RadarAreaSeriesProperties; +export declare class RadarAreaSeries extends RadarSeries { + static readonly className = "RadarAreaSeries"; + static readonly type: "radar-area"; + properties: RadarAreaSeriesProperties; + private readonly areaGroup; + protected areaSelection: _ModuleSupport.Selection<_ModuleSupport.Path, boolean>; + resetInvalidToZero: boolean; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + protected updatePathSelections(): void; + protected getAreaNode(): _ModuleSupport.Path | undefined; + protected getMarkerFill(highlightedStyle?: _ModuleSupport.SeriesItemHighlightStyle): string | import("ag-charts-community").AgGradientColor | import("ag-charts-community").AgPatternColor | import("ag-charts-community").AgImageFill | (import("ag-charts-community").AgGradientColor & string) | (import("ag-charts-community").AgPatternColor & string) | (import("ag-charts-community").AgImageFill & string) | (string & import("ag-charts-community").AgGradientColor) | (string & import("ag-charts-community").AgPatternColor) | (string & import("ag-charts-community").AgImageFill); + protected updatePathNodes(): void; + protected animatePaths(ratio: number): void; + private getAreaPoints; + protected resetPaths(): ResolvedRadarStyle | undefined; + protected makeStylerParams(highlighted: boolean, highlightStateEnum?: _ModuleSupport.HighlightState): AgRadarAreaSeriesStylerParams; + getStyle(highlighted: boolean, highlightState?: _ModuleSupport.HighlightState): ResolvedRadarStyle; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaSeriesOptionsDef.d.ts new file mode 100644 index 000000000..0a9a883b0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgRadarAreaSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const radarAreaSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaSeriesProperties.d.ts new file mode 100644 index 000000000..ac198fd31 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-area/radarAreaSeriesProperties.d.ts @@ -0,0 +1,6 @@ +import { type AgColorType, type AgRadarAreaSeriesOptions, type AgRadarAreaSeriesStyle } from 'ag-charts-community'; +import { RadarSeriesProperties } from '../radar/radarSeriesProperties'; +export declare class RadarAreaSeriesProperties extends RadarSeriesProperties { + fill: AgColorType; + fillOpacity: number; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/index.d.ts new file mode 100644 index 000000000..fb4ce6120 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/index.d.ts @@ -0,0 +1 @@ +export { RadarLineSeriesModule } from './radarLineModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/main.d.ts new file mode 100644 index 000000000..0d5406ada --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/main.d.ts @@ -0,0 +1 @@ +export { RadarLineModule } from './radarLineModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/radarLineModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/radarLineModule.d.ts new file mode 100644 index 000000000..17389db0f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/radarLineModule.d.ts @@ -0,0 +1,4 @@ +import { type AgRadarLineSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const RadarLineModule: _ModuleSupport.SeriesModule<'radar-line'>; +export declare const RadarLineSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/radarLineSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/radarLineSeries.d.ts new file mode 100644 index 000000000..3ec660719 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/radarLineSeries.d.ts @@ -0,0 +1,16 @@ +import { type AgBaseRadarSeriesOptions, type AgRadarLineSeriesStyle, type AgRadarLineSeriesStylerParams, type AgRadarSeriesStyle, _ModuleSupport } from 'ag-charts-community'; +import { RadarSeries, type ResolvedRadarStyle } from '../radar/radarSeries'; +import { RadarSeriesProperties } from '../radar/radarSeriesProperties'; +type S = AgRadarSeriesStyle; +type O = AgBaseRadarSeriesOptions; +type P = RadarSeriesProperties; +export declare class RadarLineSeries extends RadarSeries { + static readonly className = "RadarLineSeries"; + static readonly type: "radar-line"; + properties: RadarSeriesProperties>>; + protected updatePathSelections(): void; + protected updatePathNodes(): void; + protected makeStylerParams(highlighted: boolean, highlightStateEnum?: _ModuleSupport.HighlightState): AgRadarLineSeriesStylerParams; + getStyle(highlighted: boolean, highlightState?: _ModuleSupport.HighlightState): ResolvedRadarStyle; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/radarLineSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/radarLineSeriesOptionsDef.d.ts new file mode 100644 index 000000000..553114d92 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar-line/radarLineSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgRadarLineSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const radarLineSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar/radarSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar/radarSeries.d.ts new file mode 100644 index 000000000..e17a43fdf --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar/radarSeries.d.ts @@ -0,0 +1,110 @@ +import { type AgBaseRadarSeriesOptions, type AgRadarSeriesStyle, type AgSeriesMarkerStyle, type ContextDefault, type DatumDefault, _ModuleSupport } from 'ag-charts-community'; +import { type CallbackParam, type Point } from 'ag-charts-core'; +import { type RadarNodeDatum, RadarSeriesProperties } from './radarSeriesProperties'; +export interface RadarPathPoint { + x: number; + y: number; + moveTo: boolean; + radius?: number; + startAngle?: number; + endAngle?: number; + arc?: boolean; +} +interface RadarSeriesNodeDataContext extends _ModuleSupport.SeriesNodeDataContext { + styles: _ModuleSupport.SeriesNodeStyleContext; +} +type StylerResult = TStyle & { + marker?: { + enabled?: boolean; + }; +}; +type BaseRadarSeries = RadarSeries, RadarSeriesProperties>>; +export type ResolvedRadarStyle = { + [K in keyof TStyle]-?: Exclude; +} & { + marker: Required & { + enabled: boolean; + }; +}; +declare class RadarSeriesNodeEvent extends _ModuleSupport.SeriesNodeEvent { + readonly angleKey?: string; + readonly radiusKey?: string; + constructor(type: TEvent, nativeEvent: Event, datum: RadarNodeDatum, series: BaseRadarSeries); +} +export declare abstract class RadarSeries, TProps extends RadarSeriesProperties> extends _ModuleSupport.PolarSeries { + static readonly className: string; + protected readonly NodeEvent: typeof RadarSeriesNodeEvent; + private readonly lineGroup; + protected lineSelection: _ModuleSupport.Selection<_ModuleSupport.Path, boolean>; + protected resetInvalidToZero: boolean; + contextNodeData?: RadarSeriesNodeDataContext; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + get hasData(): boolean; + protected nodeFactory(): _ModuleSupport.Marker; + getSeriesDomain(direction: _ModuleSupport.ChartAxisDirection): any[]; + processData(dataController: _ModuleSupport.DataController): Promise; + protected circleCache: { + r: number; + cx: number; + cy: number; + }; + protected didCircleChange(): boolean; + protected getAxisInnerRadius(): number; + maybeRefreshNodeData(): void; + createNodeData(): { + itemId: string; + nodeData: RadarNodeDatum[]; + labelData: RadarNodeDatum[]; + styles: Record<_ModuleSupport.HighlightState, AgSeriesMarkerStyle>; + } | undefined; + update({ seriesRect }: { + seriesRect?: _ModuleSupport.BBox; + }): void; + protected updatePathSelections(): void; + protected updateMarkerSelection(): void; + protected updateHighlightSelection(): void; + protected getMarkerFill(highlightedStyle?: _ModuleSupport.SeriesItemHighlightStyle): string | import("ag-charts-community").AgGradientColor | import("ag-charts-community").AgPatternColor | import("ag-charts-community").AgImageFill | (import("ag-charts-community").AgGradientColor & string) | (import("ag-charts-community").AgPatternColor & string) | (import("ag-charts-community").AgImageFill & string) | (string & import("ag-charts-community").AgGradientColor) | (string & import("ag-charts-community").AgPatternColor) | (string & import("ag-charts-community").AgImageFill); + protected getDatumStylerProperties(datum: any): { + seriesId: string; + datum: any; + angleKey: string; + radiusKey: string; + }; + protected updateDatumStyles(selection: _ModuleSupport.Selection<_ModuleSupport.Marker, RadarNodeDatum>, isHighlight: boolean): void; + protected updateMarkers(selection: _ModuleSupport.Selection<_ModuleSupport.Marker, RadarNodeDatum>, isHighlight: boolean): void; + protected updateLabels(): void; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + protected pickNodeClosestDatum(hitPoint: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + computeLabelsBBox(): _ModuleSupport.BBox | null; + protected getLineNode(): _ModuleSupport.Path | undefined; + protected beforePathAnimation(): void; + protected getPathNodesStyle(): import("ag-charts-core").Intersection, false | null | undefined> | Exclude, false | null | undefined>>; + protected abstract updatePathNodes(): void; + protected getLinePoints(): RadarPathPoint[]; + protected animateSinglePath(pathNode: _ModuleSupport.Path, points: RadarPathPoint[], ratio: number): void; + protected animatePaths(ratio: number): void; + animateEmptyUpdateReady(): void; + animateWaitingUpdateReady(data: _ModuleSupport.PolarAnimationData): void; + animateReadyResize(data: _ModuleSupport.PolarAnimationData): void; + protected resetPaths(): ResolvedRadarStyle | undefined; + protected abstract makeStylerParams(highlighted: boolean, highlightStateEnum?: _ModuleSupport.HighlightState): CallbackParam>; + protected getStylerResult(stylerResult: StylerResult, highlighted: boolean, highlightState?: _ModuleSupport.HighlightState): StylerResult; + abstract getStyle(highlighted: boolean, highlightState?: _ModuleSupport.HighlightState): ResolvedRadarStyle; + getFormattedMarkerStyle(datum: RadarNodeDatum): AgSeriesMarkerStyle & { + size: number; + }; + protected computeFocusBounds(opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar/radarSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar/radarSeriesProperties.d.ts new file mode 100644 index 000000000..da2309285 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar/radarSeriesProperties.d.ts @@ -0,0 +1,36 @@ +import type { AgBaseRadarSeriesOptions, AgRadarSeriesLabelFormatterParams, AgRadarSeriesStyle, AgRadarSeriesTooltipRendererParams, AgRadialSeriesOptionsKeys, AgSeriesMarkerStyle, ContextDefault, DatumDefault, TextOrSegments } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +export interface RadarNodeDatum extends _ModuleSupport.DataModelSeriesNodeDatum { + readonly index: number; + readonly label?: { + x: number; + y: number; + text: TextOrSegments; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; + }; + readonly point: Readonly<_ModuleSupport.SizedPoint>; + readonly angleValue: any; + readonly radiusValue: any; + style?: AgSeriesMarkerStyle; +} +declare const SeriesProperties: typeof _ModuleSupport.SeriesProperties; +export declare class RadarSeriesProperties> extends SeriesProperties { + angleKey: string; + radiusKey: string; + angleName?: string; + radiusName?: string; + legendItemName?: string; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + rotation: number; + styler?: TOpts['styler']; + readonly marker: _ModuleSupport.SeriesMarker>; + readonly label: _ModuleSupport.Label; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + connectMissingData: boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar/radarThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar/radarThemes.d.ts new file mode 100644 index 000000000..97d7c6f2e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radar/radarThemes.d.ts @@ -0,0 +1,3 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const RADAR_LINE_SERIES_THEME: _ModuleSupport.SeriesModule<'radar-line'>['themeTemplate']; +export declare const RADAR_AREA_SERIES_THEME: _ModuleSupport.SeriesModule<'radar-area'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/index.d.ts new file mode 100644 index 000000000..68a0a2903 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/index.d.ts @@ -0,0 +1 @@ +export { RadialBarSeriesModule } from './radialBarModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/main.d.ts new file mode 100644 index 000000000..67cb19543 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/main.d.ts @@ -0,0 +1 @@ +export { RadialBarModule } from './radialBarModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarModule.d.ts new file mode 100644 index 000000000..1e08f23ba --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarModule.d.ts @@ -0,0 +1,4 @@ +import { type AgRadialBarSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const RadialBarModule: _ModuleSupport.SeriesModule<'radial-bar'>; +export declare const RadialBarSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarSeries.d.ts new file mode 100644 index 000000000..d0a5a43e9 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarSeries.d.ts @@ -0,0 +1,75 @@ +import { type AgRadialBarSeriesOptions, type AgRadialSeriesStyle, type TextOrSegments, _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import { RadialBarSeriesProperties } from './radialBarSeriesProperties'; +declare class RadialBarSeriesNodeEvent extends _ModuleSupport.SeriesNodeEvent { + readonly angleKey?: string; + readonly radiusKey?: string; + constructor(type: TEvent, nativeEvent: Event, datum: RadialBarNodeDatum, series: RadialBarSeries); +} +interface RadialBarLabelNodeDatum { + text: TextOrSegments; + x: number; + y: number; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; +} +interface RadialBarNodeDatum extends _ModuleSupport.DataModelSeriesNodeDatum { + readonly label?: RadialBarLabelNodeDatum; + readonly angleValue: any; + readonly radiusValue: any; + readonly innerRadius: number; + readonly outerRadius: number; + readonly startAngle: number; + readonly endAngle: number; + readonly clipSector: _ModuleSupport.SectorBox; + readonly reversed: boolean; + readonly index: number; + style?: Required; +} +export interface RadialBarSeriesNodeDataContext extends _ModuleSupport.DataModelSeriesNodeDataContext { + styles: _ModuleSupport.SeriesNodeStyleContext>; +} +export declare class RadialBarSeries extends _ModuleSupport.PolarSeries, _ModuleSupport.Sector, RadialBarNodeDatum, RadialBarSeriesNodeDataContext> { + static readonly className = "RadialBarSeries"; + static readonly type: "radial-bar"; + properties: RadialBarSeriesProperties>; + protected readonly NodeEvent: typeof RadialBarSeriesNodeEvent; + private readonly groupScale; + private contextNodeData?; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + get hasData(): boolean; + protected nodeFactory(): _ModuleSupport.Sector; + getSeriesDomain(direction: _ModuleSupport.ChartAxisDirection): any[]; + processData(dataController: _ModuleSupport.DataController): Promise; + protected circleCache: { + r: number; + cx: number; + cy: number; + }; + protected didCircleChange(): boolean; + protected maybeRefreshNodeData(): void; + protected getAxisInnerRadius(): number; + createNodeData(): { + itemId: string; + nodeData: RadialBarNodeDatum[]; + labelData: RadialBarNodeDatum[]; + styles: Record<_ModuleSupport.HighlightState, import("../util/radialUtil").RadialSeriesStyleResult>; + } | undefined; + update({ seriesRect }: { + seriesRect?: _ModuleSupport.BBox; + }): void; + protected updateSectorSelection(selection: _ModuleSupport.Selection<_ModuleSupport.Sector, RadialBarNodeDatum>, isHighlight: boolean): void; + protected updateLabels(): void; + private getBarTransitionFunctions; + protected animateEmptyUpdateReady(): void; + animateClearingUpdateEmpty(): void; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + protected pickNodeClosestDatum(point: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + getDatumId(datum: RadialBarNodeDatum): any; + computeLabelsBBox(): null; + protected getStackId(): string; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarSeriesOptionsDef.d.ts new file mode 100644 index 000000000..979c094b0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgRadialBarSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const radialBarSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarSeriesProperties.d.ts new file mode 100644 index 000000000..be3201ed4 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarSeriesProperties.d.ts @@ -0,0 +1,30 @@ +import type { AgRadialBarSeriesOptions, AgRadialSeriesItemStylerParams, AgRadialSeriesLabelFormatterParams, AgRadialSeriesStyle, AgRadialSeriesStylerParams, AgRadialSeriesTooltipRendererParams, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +declare const SeriesProperties: typeof _ModuleSupport.SeriesProperties; +export declare class RadialBarSeriesProperties extends SeriesProperties { + angleKey: string; + radiusKey: string; + angleName?: string; + radiusName?: string; + legendItemName?: string; + fill: InternalAgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + cornerRadius: number; + styler?: Styler, AgRadialSeriesStyle>; + itemStyler?: Styler, AgRadialSeriesStyle>; + rotation: number; + stackGroup?: string; + normalizedTo?: number; + readonly label: _ModuleSupport.Label; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + getStyle(): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarThemes.d.ts new file mode 100644 index 000000000..167964196 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarThemes.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const RADIAL_BAR_SERIES_THEME: _ModuleSupport.SeriesModule<'radial-bar'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarUtil.d.ts new file mode 100644 index 000000000..bcfe4a7a7 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-bar/radialBarUtil.d.ts @@ -0,0 +1,37 @@ +import { _ModuleSupport } from 'ag-charts-community'; +type AnimatableSectorDatum = { + angleValue: any; + radiusValue: any; + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + clipSector: _ModuleSupport.SectorBox; +}; +export declare function prepareRadialBarSeriesAnimationFunctions(axisZeroAngle: number): { + toFn: (sect: _ModuleSupport.Sector, datum: AnimatableSectorDatum, status: _ModuleSupport.NodeUpdateState) => { + startAngle: number; + endAngle: number; + innerRadius: number; + outerRadius: number; + clipSector: _ModuleSupport.SectorBox; + }; + fromFn: (sect: _ModuleSupport.Sector, datum: AnimatableSectorDatum, status: _ModuleSupport.NodeUpdateState) => { + startAngle: number; + endAngle: number; + innerRadius: number; + outerRadius: number; + clipSector: _ModuleSupport.SectorBox; + phase: "end" | "remove" | "initial" | "none" | "update" | "add" | "trailing"; + }; +}; +export declare function resetRadialBarSelectionsFn(_node: _ModuleSupport.Sector, datum: AnimatableSectorDatum): { + centerX: number; + centerY: number; + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + clipSector: _ModuleSupport.SectorBox; +}; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/index.d.ts new file mode 100644 index 000000000..371ef2a6a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/index.d.ts @@ -0,0 +1 @@ +export { RadialColumnSeriesModule } from './radialColumnModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/main.d.ts new file mode 100644 index 000000000..eaebe73c6 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/main.d.ts @@ -0,0 +1 @@ +export { RadialColumnModule } from './radialColumnModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnModule.d.ts new file mode 100644 index 000000000..758af4408 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnModule.d.ts @@ -0,0 +1,4 @@ +import { type AgRadialColumnSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const RadialColumnModule: _ModuleSupport.SeriesModule<'radial-column'>; +export declare const RadialColumnSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeries.d.ts new file mode 100644 index 000000000..5d88406ac --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeries.d.ts @@ -0,0 +1,53 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { RadialColumnNodeDatum } from './radialColumnSeriesBase'; +import { RadialColumnSeriesBase } from './radialColumnSeriesBase'; +import { RadialColumnSeriesProperties } from './radialColumnSeriesProperties'; +export declare class RadialColumnSeries extends RadialColumnSeriesBase<_ModuleSupport.RadialColumnShape> { + static readonly className = "RadialColumnSeries"; + static readonly type: "radial-column"; + properties: RadialColumnSeriesProperties>; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + protected getStackId(): string; + protected nodeFactory(): _ModuleSupport.RadialColumnShape; + protected getColumnTransitionFunctions(): { + toFn: (node: _ModuleSupport.RadialColumnShape, datum: { + innerRadius: number; + outerRadius: number; + columnWidth: number; + axisInnerRadius: number; + axisOuterRadius: number; + startAngle: number; + endAngle: number; + }, status: _ModuleSupport.NodeUpdateState) => { + innerRadius: number; + outerRadius: number; + columnWidth: number; + axisInnerRadius: number; + axisOuterRadius: number; + startAngle: number; + endAngle: number; + }; + fromFn: (node: _ModuleSupport.RadialColumnShape, datum: { + innerRadius: number; + outerRadius: number; + columnWidth: number; + axisInnerRadius: number; + axisOuterRadius: number; + startAngle: number; + endAngle: number; + }, status: _ModuleSupport.NodeUpdateState) => { + innerRadius: number; + outerRadius: number; + columnWidth: number; + axisInnerRadius: number; + axisOuterRadius: number; + startAngle: number; + endAngle: number; + phase: "end" | "remove" | "initial" | "none" | "update" | "add" | "trailing"; + }; + }; + protected isRadiusAxisCircle(): boolean; + protected updateItemPath(node: _ModuleSupport.RadialColumnShape, datum: RadialColumnNodeDatum, highlight: boolean): void; + protected getColumnWidth(startAngle: number, endAngle: number): number; + protected hasItemStylers(): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesBase.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesBase.d.ts new file mode 100644 index 000000000..1729c240d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesBase.d.ts @@ -0,0 +1,86 @@ +import type { AgBaseRadialColumnSeriesOptions, AgRadialSeriesStyle, TextOrSegments } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import type { RadialColumnSeriesBaseProperties } from './radialColumnSeriesBaseProperties'; +declare class RadialColumnSeriesNodeEvent extends _ModuleSupport.SeriesNodeEvent { + readonly angleKey?: string; + readonly radiusKey?: string; + constructor(type: TEvent, nativeEvent: Event, datum: RadialColumnNodeDatum, series: RadialColumnSeriesBase); +} +interface RadialColumnLabelNodeDatum { + x: number; + y: number; + text: TextOrSegments; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; +} +export interface RadialColumnNodeDatum extends _ModuleSupport.DataModelSeriesNodeDatum { + readonly label?: RadialColumnLabelNodeDatum; + readonly angleValue: any; + readonly radiusValue: any; + readonly negative: boolean; + readonly innerRadius: number; + readonly outerRadius: number; + readonly stackInnerRadius: number; + readonly stackOuterRadius: number; + readonly startAngle: number; + readonly endAngle: number; + readonly midAngle: number; + readonly axisInnerRadius: number; + readonly axisOuterRadius: number; + readonly columnWidth: number; + readonly index: number; + style?: AgRadialSeriesStyle; +} +interface RadialColumnSeriesNodeDataContext extends _ModuleSupport.DataModelSeriesNodeDataContext { + styles: _ModuleSupport.SeriesNodeStyleContext; +} +export declare abstract class RadialColumnSeriesBase extends _ModuleSupport.PolarSeries, ItemPathType, RadialColumnNodeDatum, RadialColumnSeriesNodeDataContext> { + protected readonly NodeEvent: typeof RadialColumnSeriesNodeEvent; + private readonly groupScale; + contextNodeData?: RadialColumnSeriesNodeDataContext; + constructor(moduleCtx: _ModuleSupport.ModuleContext, { animationResetFns, }: { + animationResetFns?: { + item?: (node: ItemPathType, datum: RadialColumnNodeDatum) => _ModuleSupport.AnimationValue & Partial; + }; + }); + get hasData(): boolean; + getSeriesDomain(direction: _ModuleSupport.ChartAxisDirection): any[]; + protected abstract getStackId(): string; + processData(dataController: _ModuleSupport.DataController): Promise; + protected circleCache: { + r: number; + cx: number; + cy: number; + }; + protected didCircleChange(): boolean; + protected isRadiusAxisReversed(): boolean | undefined; + maybeRefreshNodeData(): void; + protected getAxisInnerRadius(): number; + createNodeData(): { + itemId: string; + nodeData: RadialColumnNodeDatum[]; + labelData: RadialColumnNodeDatum[]; + styles: Record<_ModuleSupport.HighlightState, import("../util/radialUtil").RadialSeriesStyleResult>; + } | undefined; + protected getColumnWidth(_startAngle: number, _endAngle: number): number; + update({ seriesRect }: { + seriesRect?: _ModuleSupport.BBox; + }): void; + protected abstract updateItemPath(node: ItemPathType, datum: RadialColumnNodeDatum, highlight: boolean): void; + protected updateSectorSelection(selection: _ModuleSupport.Selection, isHighlight: boolean): void; + protected updateLabels(): void; + protected abstract getColumnTransitionFunctions(): { + fromFn: _ModuleSupport.FromToMotionPropFn; + toFn: _ModuleSupport.FromToMotionPropFn; + }; + protected animateEmptyUpdateReady(): void; + animateClearingUpdateEmpty(): void; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + protected pickNodeClosestDatum(point: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + getDatumId(datum: RadialColumnNodeDatum): any; + computeLabelsBBox(): null; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesBaseProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesBaseProperties.d.ts new file mode 100644 index 000000000..3a67d841a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesBaseProperties.d.ts @@ -0,0 +1,30 @@ +import type { AgBaseRadialColumnSeriesOptions, AgRadialSeriesItemStylerParams, AgRadialSeriesLabelFormatterParams, AgRadialSeriesStyle, AgRadialSeriesStylerParams, AgRadialSeriesTooltipRendererParams, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +declare const SeriesProperties: typeof _ModuleSupport.SeriesProperties; +export declare class RadialColumnSeriesBaseProperties extends SeriesProperties { + angleKey: string; + angleName?: string; + radiusKey: string; + radiusName?: string; + legendItemName?: string; + fill: InternalAgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + cornerRadius: number; + styler?: Styler, AgRadialSeriesStyle>; + itemStyler?: Styler, AgRadialSeriesStyle>; + rotation: number; + stackGroup?: string; + normalizedTo?: number; + readonly label: _ModuleSupport.Label; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + getStyle(): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesOptionsDef.d.ts new file mode 100644 index 000000000..6ba03778b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgRadialColumnSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const radialColumnSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesProperties.d.ts new file mode 100644 index 000000000..e294c5e74 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnSeriesProperties.d.ts @@ -0,0 +1,6 @@ +import type { AgBaseRadialColumnSeriesOptions } from 'ag-charts-community'; +import { RadialColumnSeriesBaseProperties } from './radialColumnSeriesBaseProperties'; +export declare class RadialColumnSeriesProperties extends RadialColumnSeriesBaseProperties { + columnWidthRatio?: number; + maxColumnWidthRatio?: number; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnThemes.d.ts new file mode 100644 index 000000000..66cdf9099 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnThemes.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const RADIAL_COLUMN_SERIES_THEME: _ModuleSupport.SeriesModule<'radial-column'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnUtil.d.ts new file mode 100644 index 000000000..a5a2efa24 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-column/radialColumnUtil.d.ts @@ -0,0 +1,58 @@ +import { _ModuleSupport } from 'ag-charts-community'; +type AnimatableRadialColumnDatum = { + innerRadius: number; + outerRadius: number; + columnWidth: number; + axisInnerRadius: number; + axisOuterRadius: number; + startAngle: number; + endAngle: number; +}; +type AngleKey = 'startAngle' | 'endAngle'; +type AngleObject = Record; +export declare function createAngleMotionCalculator(): { + calculate: (node: _ModuleSupport.Path & AngleObject, datum: AngleObject, status: _ModuleSupport.NodeUpdateState) => void; + from: (datum: AngleObject) => { + startAngle: number; + endAngle: number; + }; + to: (datum: AngleObject) => { + startAngle: number; + endAngle: number; + }; +}; +export declare function fixRadialColumnAnimationStatus(node: _ModuleSupport.Path, datum: { + startAngle: number; + endAngle: number; +}, status: _ModuleSupport.NodeUpdateState): _ModuleSupport.NodeUpdateState; +export declare function prepareRadialColumnAnimationFunctions(axisZeroRadius: number): { + toFn: (node: _ModuleSupport.RadialColumnShape, datum: AnimatableRadialColumnDatum, status: _ModuleSupport.NodeUpdateState) => { + innerRadius: number; + outerRadius: number; + columnWidth: number; + axisInnerRadius: number; + axisOuterRadius: number; + startAngle: number; + endAngle: number; + }; + fromFn: (node: _ModuleSupport.RadialColumnShape, datum: AnimatableRadialColumnDatum, status: _ModuleSupport.NodeUpdateState) => { + innerRadius: number; + outerRadius: number; + columnWidth: number; + axisInnerRadius: number; + axisOuterRadius: number; + startAngle: number; + endAngle: number; + phase: "end" | "remove" | "initial" | "none" | "update" | "add" | "trailing"; + }; +}; +export declare function resetRadialColumnSelectionFn(_node: _ModuleSupport.RadialColumnShape, { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle, }: AnimatableRadialColumnDatum): { + innerRadius: number; + outerRadius: number; + columnWidth: number; + axisInnerRadius: number; + axisOuterRadius: number; + startAngle: number; + endAngle: number; +}; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/main.d.ts new file mode 100644 index 000000000..6e6132cd8 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/main.d.ts @@ -0,0 +1 @@ +export { RadialGaugeModule } from './radialGaugeModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeModule.d.ts new file mode 100644 index 000000000..ff8040e44 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeModule.d.ts @@ -0,0 +1,4 @@ +import { type AgRadialGaugePreset, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const RadialGaugeModule: _ModuleSupport.SeriesModule<'radial-gauge'>; +export declare const RadialGaugeSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeNeedle.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeNeedle.d.ts new file mode 100644 index 000000000..29a0ed492 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeNeedle.d.ts @@ -0,0 +1,10 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const RadialGaugeNeedle_base: new (...args: any[]) => import("packages/ag-charts-community/dist/types/src/scene/transformable").RotatableType>>>; +export declare class RadialGaugeNeedle extends RadialGaugeNeedle_base { + static readonly defaultPathData = "M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z"; + scalingCenterX: number; + scalingCenterY: number; + rotationCenterX: number; + rotationCenterY: number; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeSeries.d.ts new file mode 100644 index 000000000..714141878 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeSeries.d.ts @@ -0,0 +1,119 @@ +import { type AgRadialGaugeOptions, type TextAlign, type TextOrSegments, type VerticalAlign, _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import { LinearAngleScale } from '../../axes/angle-number/linearAngleScale'; +import { DatumUnion } from '../gauge-util/datumUnion'; +import { type RadialGaugeLabelDatum, type RadialGaugeNodeDatum, type RadialGaugeNodeDatumIndex, RadialGaugeSeriesProperties, type RadialGaugeTargetDatum } from './radialGaugeSeriesProperties'; +interface RadialGaugeNeedleDatum { + centerX: number; + centerY: number; + radius: number; + angle: number; + series: RadialGaugeSeries; +} +interface RadialGaugeTickDatum { + index: number; + value: number; + text: TextOrSegments; + width: number; + height: number; +} +interface RadialGaugeNodeDataContext extends _ModuleSupport.SeriesNodeDataContext { + needleData: RadialGaugeNeedleDatum[]; + targetData: RadialGaugeTargetDatum[]; + scaleData: RadialGaugeNodeDatum[]; + tickData: RadialGaugeTickDatum[]; +} +export declare class RadialGaugeSeries extends _ModuleSupport.Series implements _ModuleSupport.GaugeSeries { + static readonly className = "RadialGaugeSeries"; + static readonly type: "radial-gauge"; + centerX: number; + centerY: number; + radius: number; + textAlign: TextAlign; + verticalAlign: VerticalAlign; + properties: RadialGaugeSeriesProperties; + scale: LinearAngleScale; + private readonly scaleGroup; + private readonly itemGroup; + private readonly itemNeedleGroup; + private readonly itemTargetGroup; + private readonly itemTargetLabelGroup; + private readonly itemLabelGroup; + private readonly highlightTargetGroup; + private readonly tickGroup; + private scaleSelection; + private datumSelection; + private needleSelection; + targetSelection: _ModuleSupport.Selection<_ModuleSupport.Marker, RadialGaugeTargetDatum>; + private targetLabelSelection; + private labelSelection; + private highlightTargetSelection; + private tickSelection; + datumUnion: DatumUnion<_ModuleSupport.Sector, RadialGaugeNodeDatum>; + private readonly animationState; + contextNodeData?: RadialGaugeNodeDataContext; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + get hasData(): boolean; + private nodeFactory; + private markerFactory; + processData(): void; + private formatLabel; + private layoutScale; + protected getShapeFillBBox(): _ModuleSupport.ShapeFillBBox; + private getTargets; + private getTargetRadius; + private getTargetLabel; + createNodeData(): { + itemId: string; + nodeData: RadialGaugeNodeDatum[]; + needleData: RadialGaugeNeedleDatum[]; + targetData: RadialGaugeTargetDatum[]; + labelData: RadialGaugeLabelDatum[]; + scaleData: RadialGaugeNodeDatum[]; + tickData: RadialGaugeTickDatum[]; + }; + updateSelections(resize: boolean): void; + private highlightDatum; + update({ seriesRect }: { + seriesRect?: _ModuleSupport.BBox; + }): void; + private updateDatumSelection; + private updateDatumNodes; + private updateScaleSelection; + private updateScaleNodes; + private updateNeedleSelection; + private updateNeedleNodes; + private updateTargetSelection; + private updateTargetStyles; + private updateTargetNodes; + private getTargetStyle; + private updateTargetLabelSelection; + private updateTargetLabelNodes; + private updateLabelSelection; + private updateLabelNodes; + private updateTickSelection; + private updateTickNodes; + labelsHaveExplicitText(): boolean; + formatLabelText(datum?: { + label: number | undefined; + secondaryLabel: number | undefined; + }): void; + protected resetAllAnimation(): void; + resetAnimation(phase: _ModuleSupport.ChartAnimationPhase): void; + private animateLabelText; + animateEmptyUpdateReady(): void; + animateWaitingUpdateReady(): void; + protected animateReadyResize(): void; + dataCount(): number; + getSeriesDomain(): number[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, _visibleRange: [any, any]): [number, number]; + getLegendData(): _ModuleSupport.ChartLegendDatum[]; + getTooltipContent(datumIndex: RadialGaugeNodeDatumIndex): _ModuleSupport.TooltipContent | undefined; + pickNodeClosestDatum(point: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + pickFocus(opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.PickFocusOutputs | undefined; + getCaptionText(): string; + getCategoryValue(_datumIndex: RadialGaugeNodeDatumIndex): void; + datumIndexForCategoryValue(_categoryValue: any): RadialGaugeNodeDatumIndex | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeSeriesProperties.d.ts new file mode 100644 index 000000000..b14fee178 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeSeriesProperties.d.ts @@ -0,0 +1,178 @@ +import { type RichFormatter, _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgGradientColor, RequireOptional } from 'ag-charts-core'; +import type { AgChartLabelFormatterParams, AgGradientColorMode, AgRadialGaugeLabelFormatterParams, AgRadialGaugeMarkerShape, AgRadialGaugeOptions, AgRadialGaugeSeriesStyle, AgRadialGaugeTargetPlacement, AgRadialGaugeTooltipRendererParams, FontStyle, FontWeight } from 'ag-charts-types'; +import { GaugeSegmentationProperties } from '../gauge-util/segmentation'; +import { AutoSizedLabel, AutoSizedSecondaryLabel } from '../util/autoSizedLabel'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties, SeriesProperties: typeof _ModuleSupport.SeriesProperties, AxisLabel: typeof _ModuleSupport.AxisLabel, Label: typeof _ModuleSupport.Label; +export declare enum NodeDataType { + Node = 0, + Target = 1 +} +export declare enum LabelType { + Primary = "primary", + Secondary = "secondary" +} +export type RadialGaugeNodeDatumIndex = { + type: NodeDataType.Node; +} | { + type: NodeDataType.Target; + index: number; +}; +export interface RadialGaugeNodeDatum extends _ModuleSupport.SeriesNodeDatum { + type: NodeDataType.Node; + readonly itemId: 'value' | 'scale' | `value-${number}` | `scale-${number}`; + centerX: number; + centerY: number; + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + clipStartAngle: number | undefined; + clipEndAngle: number | undefined; + startCornerRadius: number; + endCornerRadius: number; + style: AgRadialGaugeSeriesStyle; +} +export interface RadialGaugeTargetDatumLabel { + offsetX: number; + offsetY: number; + fill: string | undefined; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; + fontStyle: FontStyle | undefined; + fontWeight: FontWeight | undefined; + fontSize: number; + fontFamily: string; + lineHeight: number | undefined; +} +export interface RadialGaugeTargetDatum extends _ModuleSupport.SeriesNodeDatum { + type: NodeDataType.Target; + readonly itemId: `target-${number}`; + value: number; + text: string | undefined; + centerX: number; + centerY: number; + shape: AgRadialGaugeMarkerShape; + radius: number; + angle: number; + size: number; + rotation: number; + label: RadialGaugeTargetDatumLabel; + style: AgRadialGaugeSeriesStyle; +} +export type RadialGaugeLabelDatum = { + label: LabelType; + centerX: number; + centerY: number; + text: string | undefined; + value: number; + fill: string | undefined; + fontStyle: FontStyle | undefined; + fontWeight: FontWeight | undefined; + fontSize: number; + minimumFontSize: number | undefined; + fontFamily: string; + lineHeight: number | undefined; + formatter: RichFormatter & RequireOptional> | undefined; +}; +declare class RadialGaugeDefaultTargetLabelProperties extends Label { + spacing: number | undefined; +} +export declare class RadialGaugeTargetProperties extends BaseProperties { + text: string | undefined; + value: number | undefined; + shape: AgRadialGaugeMarkerShape | undefined; + placement: AgRadialGaugeTargetPlacement | undefined; + spacing: number | undefined; + size: number | undefined; + rotation: number | undefined; + fill: string | undefined; + fillOpacity: number | undefined; + stroke: string | undefined; + strokeWidth: number | undefined; + strokeOpacity: number | undefined; + lineDash: number[] | undefined; + lineDashOffset: number | undefined; + readonly label: RadialGaugeDefaultTargetLabelProperties; + getStyle(): Required; +} +declare class RadialGaugeBarProperties extends BaseProperties { + enabled: boolean; + fills: _ModuleSupport.PropertiesArray<_ModuleSupport.StopProperties>; + fillMode: AgGradientColorMode; + fill: string | undefined; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + getStyle(defaultColorRange: string[], scale: _ModuleSupport.LinearScale): RequireOptional; +} +declare class RadialGaugeScaleIntervalProperties extends BaseProperties { + values?: number[]; + step?: number; + minSpacing: number; + maxSpacing: number; +} +declare class RadialGaugeScaleLabelProperties extends AxisLabel { +} +declare class RadialGaugeScaleProperties extends BaseProperties { + min: number; + max: number; + fills: _ModuleSupport.PropertiesArray<_ModuleSupport.StopProperties>; + fillMode: AgGradientColorMode; + fill: string | undefined; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + defaultFill: string; + readonly interval: RadialGaugeScaleIntervalProperties; + readonly label: RadialGaugeScaleLabelProperties; + getStyle(barEnabled: boolean, defaultColorRange: string[], scale: _ModuleSupport.LinearScale): RequireOptional; +} +declare class RadialGaugeNeedleProperties extends BaseProperties { + enabled: boolean; + radiusRatio?: number; + spacing: number; + fill: string; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; +} +declare class RadialGaugeLabelProperties extends AutoSizedLabel { + text?: string; +} +declare class RadialGaugeSecondaryLabelProperties extends AutoSizedSecondaryLabel { + text?: string; +} +export declare class RadialGaugeSeriesProperties extends SeriesProperties { + value: number; + startAngle: number; + endAngle: number; + readonly segmentation: GaugeSegmentationProperties; + defaultColorRange: string[]; + targets: _ModuleSupport.PropertiesArray; + readonly defaultTarget: RadialGaugeTargetProperties; + outerRadiusRatio: number; + innerRadiusRatio: number; + outerRadius: number | undefined; + innerRadius: number | undefined; + cornerRadius: number; + cornerMode: 'container' | 'item'; + spacing: number; + readonly scale: RadialGaugeScaleProperties; + readonly bar: RadialGaugeBarProperties; + readonly needle: RadialGaugeNeedleProperties; + readonly label: RadialGaugeLabelProperties; + readonly secondaryLabel: RadialGaugeSecondaryLabelProperties; + readonly tooltip: _ModuleSupport.SeriesTooltip>; +} +export declare function createConicGradient(fills: _ModuleSupport.StopProperties[], fillMode: AgGradientColorMode, defaultColorRange: string[], scale: _ModuleSupport.LinearScale): InternalAgGradientColor; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeUtil.d.ts new file mode 100644 index 000000000..b540b5065 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/radial-gauge/radialGaugeUtil.d.ts @@ -0,0 +1,47 @@ +import { type TextAlign, type VerticalAlign, _ModuleSupport } from 'ag-charts-community'; +import type { RadialGaugeNeedle } from './radialGaugeNeedle'; +import { type RadialGaugeLabelDatum } from './radialGaugeSeriesProperties'; +interface AnimatableSectorDatum { + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + clipStartAngle: number | undefined; + clipEndAngle: number | undefined; +} +type SectorAnimation = { + startAngle: number; + endAngle: number; + clipSector: _ModuleSupport.SectorBox | undefined; +}; +type AnimatableNeedleDatum = { + radius: number; + angle: number; +}; +interface Ctx { + chartService: { + context?: unknown; + }; +} +export declare function prepareRadialGaugeSeriesAnimationFunctions(initialLoad: boolean, initialStartAngle: number): { + node: _ModuleSupport.FromToFns<_ModuleSupport.Sector, SectorAnimation, AnimatableSectorDatum>; + needle: _ModuleSupport.FromToFns; +}; +export declare function resetRadialGaugeSeriesResetSectorFunction(_node: _ModuleSupport.Sector, datum: AnimatableSectorDatum): { + startAngle: number; + endAngle: number; + clipSector: _ModuleSupport.SectorBox | undefined; + visible: boolean; +}; +export declare function resetRadialGaugeSeriesResetNeedleFunction(_node: RadialGaugeNeedle, datum: AnimatableNeedleDatum): { + rotation: number; +}; +export declare function formatRadialGaugeLabels(series: _ModuleSupport.Series<_ModuleSupport.DatumIndexType, any, object, any>, ctx: Ctx, selection: _ModuleSupport.Selection<_ModuleSupport.Text, RadialGaugeLabelDatum>, opts: { + padding: number; + textAlign: TextAlign; + verticalAlign: VerticalAlign; +}, innerRadius: number, datumOverrides?: { + label: number | undefined; + secondaryLabel: number | undefined; +}): void; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/index.d.ts new file mode 100644 index 000000000..51a5db7a4 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/index.d.ts @@ -0,0 +1 @@ +export { RangeAreaSeriesModule } from './rangeAreaModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/main.d.ts new file mode 100644 index 000000000..2c1768c43 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/main.d.ts @@ -0,0 +1 @@ +export { RangeAreaModule } from './rangeAreaModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeArea.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeArea.d.ts new file mode 100644 index 000000000..2aea23d71 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeArea.d.ts @@ -0,0 +1,114 @@ +import { type AgRangeAreaSeriesOptions, type AgSeriesMarkerStyle, _ModuleSupport } from 'ag-charts-community'; +import type { ConstructorReturnType } from 'ag-charts-core'; +import { type RangeAreaMarkerDatum, RangeAreaProperties } from './rangeAreaProperties'; +import { type RangeAreaContext, type RangeAreaLabelDatum } from './rangeAreaUtil'; +declare class RangeAreaSeriesNodeEvent extends _ModuleSupport.SeriesNodeEvent { + readonly xKey?: string; + readonly yLowKey?: string; + readonly yHighKey?: string; + constructor(type: TEvent, nativeEvent: Event, datum: RangeAreaMarkerDatum, series: RangeAreaSeries); +} +declare const BaseSeries: abstract new ({ pathsPerSeries, pathsZIndexSubOrderOffset, datumSelectionGarbageCollection, animationAlwaysUpdateSelections, segmentedDataNodes, animationResetFns, propertyKeys, propertyNames, ...otherOpts }: Partial<{ + pathsPerSeries: string[]; + pathsZIndexSubOrderOffset: number[]; + propertyKeys: _ModuleSupport.SeriesDirectionKeysMapping; + propertyNames: _ModuleSupport.SeriesDirectionKeysMapping; + datumSelectionGarbageCollection: boolean; + animationAlwaysUpdateSelections: boolean; + segmentedDataNodes: boolean; + animationResetFns?: { + path?: ((path: _ModuleSupport.Path) => Partial<_ModuleSupport.Path>) | undefined; + datum?: ((node: _ModuleSupport.Marker, datum: RangeAreaMarkerDatum) => _ModuleSupport.AnimationValue & Partial<_ModuleSupport.Marker>) | undefined; + label?: ((node: _ModuleSupport.Text, datum: RangeAreaLabelDatum) => _ModuleSupport.AnimationValue & Partial<_ModuleSupport.Text>) | undefined; + } | undefined; +}> & Pick<{ + pathsPerSeries: string[]; + pathsZIndexSubOrderOffset: number[]; + propertyKeys: _ModuleSupport.SeriesDirectionKeysMapping; + propertyNames: _ModuleSupport.SeriesDirectionKeysMapping; + datumSelectionGarbageCollection: boolean; + animationAlwaysUpdateSelections: boolean; + segmentedDataNodes: boolean; + animationResetFns?: { + path?: ((path: _ModuleSupport.Path) => Partial<_ModuleSupport.Path>) | undefined; + datum?: ((node: _ModuleSupport.Marker, datum: RangeAreaMarkerDatum) => _ModuleSupport.AnimationValue & Partial<_ModuleSupport.Marker>) | undefined; + label?: ((node: _ModuleSupport.Text, datum: RangeAreaLabelDatum) => _ModuleSupport.AnimationValue & Partial<_ModuleSupport.Text>) | undefined; + } | undefined; +}, "propertyKeys" | "propertyNames"> & _ModuleSupport.SeriesConstructorOpts & { + categoryKey: string | undefined; + clipFocusBox?: boolean | undefined; +}) => _ModuleSupport.CartesianSeries<_ModuleSupport.Marker, AgRangeAreaSeriesOptions, RangeAreaProperties, RangeAreaMarkerDatum, RangeAreaLabelDatum, RangeAreaContext, never>; +type BaseSeries = ConstructorReturnType; +type GetMarkerStyleArg = Parameters[I]; +export declare class RangeAreaSeries extends BaseSeries { + static readonly className = "RangeAreaSeries"; + static readonly type: "range-area"; + properties: RangeAreaProperties; + protected readonly NodeEvent: typeof RangeAreaSeriesNodeEvent; + private dataAggregationFilters; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + processData(dataController: _ModuleSupport.DataController): Promise; + private aggregateData; + xCoordinateRange(xValue: any): [number, number]; + yCoordinateRange(yValues: any[]): [number, number]; + getSeriesDomain(direction: _ModuleSupport.ChartAxisDirection): any[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, visibleRange: [any, any]): any[]; + createNodeData(): RangeAreaContext | undefined; + private createLabelData; + protected isPathOrSelectionDirty(): boolean; + protected strokewidthChange(): boolean; + protected updatePathNodes(opts: { + paths: _ModuleSupport.SegmentedPath[]; + visible: boolean; + animationEnabled: boolean; + }): void; + protected updatePaths(opts: { + contextData: RangeAreaContext; + paths: _ModuleSupport.Path[]; + }): void; + private updateAreaPaths; + private updateFillPath; + private updateStrokePath; + protected updateDatumSelection(opts: { + nodeData: RangeAreaMarkerDatum[]; + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Marker, RangeAreaMarkerDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.Marker, RangeAreaMarkerDatum>; + protected updateDatumStyles({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Marker, RangeAreaMarkerDatum>; + isHighlight: boolean; + }): void; + protected updateDatumNodes(opts: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Marker, RangeAreaMarkerDatum>; + isHighlight: boolean; + }): void; + protected updateLabelSelection(opts: { + labelData: RangeAreaLabelDatum[]; + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, RangeAreaLabelDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.Text, RangeAreaLabelDatum>; + protected updateLabelNodes(opts: { + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, RangeAreaLabelDatum>; + }): void; + protected getHighlightData(nodeData: RangeAreaMarkerDatum[], highlightedItem: RangeAreaMarkerDatum): RangeAreaMarkerDatum[] | undefined; + private getStyle; + private getStylerMarkerOptions; + private getStylerCouple; + private makeStylerParams; + private makeItemStylerParams; + getTooltipContent(datumIndex: number, removeThisDatum: RangeAreaMarkerDatum | undefined): _ModuleSupport.TooltipContent | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + protected isLabelEnabled(): boolean; + onDataChange(): void; + protected nodeFactory(): _ModuleSupport.Marker; + animateEmptyUpdateReady(animationData: _ModuleSupport.CartesianAnimationData<_ModuleSupport.Marker, RangeAreaMarkerDatum, RangeAreaLabelDatum, RangeAreaContext>): void; + protected animateReadyResize(animationData: _ModuleSupport.CartesianAnimationData<_ModuleSupport.Marker, RangeAreaMarkerDatum, RangeAreaLabelDatum, RangeAreaContext>): void; + animateWaitingUpdateReady(animationData: _ModuleSupport.CartesianAnimationData<_ModuleSupport.Marker, RangeAreaMarkerDatum, RangeAreaLabelDatum, RangeAreaContext>): void; + getFormattedMarkerStyle(datum: RangeAreaMarkerDatum): AgSeriesMarkerStyle & { + size: number; + }; + getMarkerStyle(marker: _ModuleSupport.SeriesMarker, datum: GetMarkerStyleArg<1>, params?: TParams, opts?: GetMarkerStyleArg<3>, defaultOverrideStyle?: GetMarkerStyleArg<4>, inheritedStyle?: GetMarkerStyleArg<5>): ReturnType; + protected computeFocusBounds(opts: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + protected isDatumEnabled(nodeData: RangeAreaMarkerDatum[], datumIndex: number): boolean; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaAggregation.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaAggregation.d.ts new file mode 100644 index 000000000..ae0e165c1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaAggregation.d.ts @@ -0,0 +1,7 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export interface RangeAreaSeriesDataAggregationFilter { + maxRange: number; + topIndices: number[]; + bottomIndices: number[]; +} +export declare function aggregateRangeAreaData(scale: _ModuleSupport.ScaleType, xValues: any[], highValues: any[], lowValues: any[], domain: number[], xNeedsValueOf: boolean, yNeedsValueOf: boolean): RangeAreaSeriesDataAggregationFilter[] | undefined; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaIntersection.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaIntersection.d.ts new file mode 100644 index 000000000..d5f43a082 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaIntersection.d.ts @@ -0,0 +1,4 @@ +import { type FillOptions, _ModuleSupport } from 'ag-charts-community'; +import type { Size } from 'ag-charts-core'; +export declare function findRangeAreaIntersections(highSpans: _ModuleSupport.LinePathSpan[], lowSpans: _ModuleSupport.LinePathSpan[], minX: number, maxX: number, initiallyInverted?: boolean): number[]; +export declare function calculateIntersectionSegments(intersections: number[], seriesRect: _ModuleSupport.BBox, chartSize: Size, startsInverted: boolean, style?: FillOptions): _ModuleSupport.Segment[]; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaModule.d.ts new file mode 100644 index 000000000..825febf4e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaModule.d.ts @@ -0,0 +1,4 @@ +import { type AgRangeAreaSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const RangeAreaModule: _ModuleSupport.SeriesModule<'range-area'>; +export declare const RangeAreaSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaProperties.d.ts new file mode 100644 index 000000000..e377d2602 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaProperties.d.ts @@ -0,0 +1,78 @@ +import type { AgMarkerShape, AgRangeAreaSeriesItemStylerParams, AgRangeAreaSeriesItemType, AgRangeAreaSeriesLabelFormatterParams, AgRangeAreaSeriesLabelPlacement, AgRangeAreaSeriesOptions, AgRangeAreaSeriesTooltipRendererParams, AgSeriesMarkerOptions, AgSeriesMarkerStyle, PixelSize, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +export interface RangeAreaMarkerDatum extends Omit<_ModuleSupport.CartesianSeriesNodeDatum, 'yKey' | 'yValue'> { + readonly itemId: AgRangeAreaSeriesItemType; + readonly index: number; + readonly yLowKey: string; + readonly yHighKey: string; + readonly yLowValue: number; + readonly yHighValue: number; + readonly point: Readonly<_ModuleSupport.SizedPoint>; + readonly enabled: boolean; + style?: AgSeriesMarkerStyle; +} +declare const BaseProperties: typeof _ModuleSupport.BaseProperties, CartesianSeriesProperties: typeof _ModuleSupport.CartesianSeriesProperties, Label: typeof _ModuleSupport.Label; +type RangeAreaSeriesItemOptions = NonNullable; +type RangeAreaSeriesLineOptions = NonNullable; +export type RangeAreaSeriesParams = Pick, 'xKey' | 'yLowKey' | 'yHighKey' | 'itemId'>; +declare class RangeAreaSeriesLabel extends Label { + placement: AgRangeAreaSeriesLabelPlacement; + spacing: PixelSize; +} +declare class RangeAreaInvertedStyle { + enabled: boolean; + fill?: InternalAgColorType; + fillOpacity: number; +} +declare class RangeAreaLineStyle extends BaseProperties { + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + readonly marker: _ModuleSupport.SeriesMarker; +} +declare class RangeAreaItemProperties extends BaseProperties { + low: RangeAreaLineStyle; + high: RangeAreaLineStyle; +} +declare class SharedRangeAreaMarker extends BaseProperties> { + enabled?: boolean; + shape?: AgMarkerShape; + size?: number; + fill?: InternalAgColorType; + fillOpacity?: number; + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + lineDash?: number[]; + lineDashOffset?: number; + itemStyler?: AgSeriesMarkerOptions['itemStyler']; +} +export declare class RangeAreaProperties extends CartesianSeriesProperties { + xKey: string; + yLowKey: string; + yHighKey: string; + xName?: string; + yName?: string; + yLowName?: string; + yHighName?: string; + fill: InternalAgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + interpolation: _ModuleSupport.InterpolationProperties; + styler?: Styler; + item: RangeAreaItemProperties; + readonly invertedStyle: RangeAreaInvertedStyle; + readonly shadow: _ModuleSupport.DropShadow; + readonly marker: SharedRangeAreaMarker; + readonly label: RangeAreaSeriesLabel; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + connectMissingData: boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaSeriesOptionsDef.d.ts new file mode 100644 index 000000000..4f8f9e016 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgRangeAreaSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const rangeAreaSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaThemes.d.ts new file mode 100644 index 000000000..23ff85c81 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaThemes.d.ts @@ -0,0 +1,8 @@ +import { type AgChartThemeOverrides, type WithThemeParams } from 'ag-charts-community'; +export declare const RANGE_AREA_SERIES_THEME: WithThemeParams; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaUtil.d.ts new file mode 100644 index 000000000..4d134eb48 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-area/rangeAreaUtil.d.ts @@ -0,0 +1,55 @@ +import { type AgRangeAreaSeriesItemType, type AgSeriesMarkerStyle, type TextOrSegments, _ModuleSupport } from 'ag-charts-community'; +import type { Point } from 'ag-charts-core'; +import { type RangeAreaMarkerDatum } from './rangeAreaProperties'; +export interface RangeAreaLabelDatum extends Readonly { + datumIndex: number; + text: TextOrSegments; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; + datum: any; + readonly itemId: AgRangeAreaSeriesItemType; + series: _ModuleSupport.CartesianSeriesNodeDatum['series']; + style?: AgSeriesMarkerStyle; +} +interface RangeAreaFillPathDatum { + readonly spans: _ModuleSupport.LinePathSpan[]; + readonly phantomSpans: _ModuleSupport.LinePathSpan[]; + readonly itemId: AgRangeAreaSeriesItemType; +} +interface RangeAreaStrokePathDatum { + readonly spans: _ModuleSupport.LinePathSpan[]; + readonly itemId: AgRangeAreaSeriesItemType; +} +export interface RangeAreaContext extends _ModuleSupport.CartesianSeriesNodeDataContext { + fillData: RangeAreaFillPathDatum; + highStrokeData: RangeAreaStrokePathDatum; + lowStrokeData: RangeAreaStrokePathDatum; + styles: { + low: _ModuleSupport.SeriesNodeStyleContext; + high: _ModuleSupport.SeriesNodeStyleContext; + }; + intersectionSegments?: _ModuleSupport.Segment[]; +} +export declare function prepareRangeAreaPathAnimation(newData: RangeAreaContext, oldData: RangeAreaContext, diff: _ModuleSupport.ProcessedOutputDiff | undefined): { + status: _ModuleSupport.NodeUpdateState; + fill: { + status: _ModuleSupport.NodeUpdateState; + path: { + addPhaseFn: (ratio: number, path: _ModuleSupport.Path) => void; + updatePhaseFn: (ratio: number, path: _ModuleSupport.Path) => void; + removePhaseFn: (ratio: number, path: _ModuleSupport.Path) => void; + }; + pathProperties: _ModuleSupport.FromToFns<_ModuleSupport.Path, any, unknown>; + }; + stroke: { + status: _ModuleSupport.NodeUpdateState; + path: { + addPhaseFn: (ratio: number, path: _ModuleSupport.Path) => void; + updatePhaseFn: (ratio: number, path: _ModuleSupport.Path) => void; + removePhaseFn: (ratio: number, path: _ModuleSupport.Path) => void; + }; + pathProperties: _ModuleSupport.FromToFns<_ModuleSupport.Path, any, unknown>; + }; + hasMotion: boolean; +} | undefined; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/index.d.ts new file mode 100644 index 000000000..8e25e61aa --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/index.d.ts @@ -0,0 +1 @@ +export { RangeBarSeriesModule } from './rangeBarModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/main.d.ts new file mode 100644 index 000000000..92121bd96 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/main.d.ts @@ -0,0 +1 @@ +export { RangeBarModule } from './rangeBarModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarAggregation.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarAggregation.d.ts new file mode 100644 index 000000000..785847f0a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarAggregation.d.ts @@ -0,0 +1,6 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export interface RangeBarSeriesDataAggregationFilter { + indexData: Int32Array; + maxRange: number; +} +export declare function aggregateRangeBarData(scale: _ModuleSupport.ScaleType, xValues: any[], highValues: any[], lowValues: any[], domain: number[], smallestKeyInterval: number | undefined): RangeBarSeriesDataAggregationFilter[] | undefined; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarModule.d.ts new file mode 100644 index 000000000..fc4ea6556 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarModule.d.ts @@ -0,0 +1,4 @@ +import { type AgRangeBarSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const RangeBarModule: _ModuleSupport.SeriesModule<'range-bar'>; +export declare const RangeBarSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarProperties.d.ts new file mode 100644 index 000000000..c346e3db1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarProperties.d.ts @@ -0,0 +1,31 @@ +import type { AgRangeBarSeriesItemStylerParams, AgRangeBarSeriesLabelFormatterParams, AgRangeBarSeriesLabelPlacement, AgRangeBarSeriesOptions, AgRangeBarSeriesStyle, AgRangeBarSeriesStylerParams, AgRangeBarSeriesTooltipRendererParams, PixelSize, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +declare const AbstractBarSeriesProperties: typeof _ModuleSupport.AbstractBarSeriesProperties, Label: typeof _ModuleSupport.Label; +declare class RangeBarSeriesLabel extends Label { + placement: AgRangeBarSeriesLabelPlacement; + spacing: PixelSize; +} +export declare class RangeBarProperties extends AbstractBarSeriesProperties { + xKey: string; + yLowKey: string; + yHighKey: string; + xName?: string; + yName?: string; + yLowName?: string; + yHighName?: string; + fill: InternalAgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + cornerRadius: number; + styler?: Styler, AgRangeBarSeriesStyle>; + itemStyler?: Styler, AgRangeBarSeriesStyle>; + readonly shadow: _ModuleSupport.DropShadow; + readonly label: RangeBarSeriesLabel; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarSeries.d.ts new file mode 100644 index 000000000..132ed235d --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarSeries.d.ts @@ -0,0 +1,86 @@ +import { type AgRangeBarSeriesOptions, type AgRangeBarSeriesStyle, type TextOrSegments, _ModuleSupport } from 'ag-charts-community'; +import type { Point } from 'ag-charts-core'; +import { RangeBarProperties } from './rangeBarProperties'; +interface RangeBarNodeLabelDatum extends Readonly { + datumIndex: number; + text: TextOrSegments; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; + datum: any; + itemId: 'high' | 'low'; + series: _ModuleSupport.CartesianSeriesNodeDatum['series']; +} +interface RangeBarNodeDatum extends Omit<_ModuleSupport.CartesianSeriesNodeDatum, 'yKey' | 'yValue'>, Readonly { + readonly index: number; + readonly itemId: string; + readonly yLowKey: string; + readonly yHighKey: string; + readonly yLowValue: number; + readonly yHighValue: number; + readonly width: number; + readonly height: number; + readonly labels: RangeBarNodeLabelDatum[]; + readonly crisp: boolean; + readonly clipBBox?: _ModuleSupport.BBox; + readonly opacity?: number; + style?: Required; +} +type RangeBarAnimationData = _ModuleSupport.AbstractBarSeriesAnimationData<_ModuleSupport.Rect, RangeBarNodeDatum, RangeBarNodeLabelDatum>; +declare class RangeBarSeriesNodeEvent extends _ModuleSupport.SeriesNodeEvent { + readonly xKey?: string; + readonly yLowKey?: string; + readonly yHighKey?: string; + constructor(type: TEvent, nativeEvent: Event, datum: RangeBarNodeDatum, series: RangeBarSeries); +} +interface RangeBarSeriesNodeDataContext extends _ModuleSupport.AbstractBarSeriesNodeDataContext { + styles: _ModuleSupport.SeriesNodeStyleContext; +} +export declare class RangeBarSeries extends _ModuleSupport.AbstractBarSeries<_ModuleSupport.Rect, AgRangeBarSeriesOptions, RangeBarProperties, RangeBarNodeDatum, RangeBarNodeLabelDatum, RangeBarSeriesNodeDataContext> { + static readonly className = "RangeBarSeries"; + static readonly type: "range-bar"; + properties: RangeBarProperties; + private dataAggregationFilters; + protected readonly NodeEvent: typeof RangeBarSeriesNodeEvent; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + processData(dataController: _ModuleSupport.DataController): Promise; + private aggregateData; + getSeriesDomain(direction: _ModuleSupport.ChartAxisDirection): any[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, visibleRange: [any, any]): any[]; + createNodeData(): RangeBarSeriesNodeDataContext | undefined; + private createLabelData; + protected nodeFactory(): _ModuleSupport.Rect; + private getStyle; + private makeStylerParams; + protected updateDatumSelection(opts: { + nodeData: RangeBarNodeDatum[]; + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, RangeBarNodeDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.Rect, RangeBarNodeDatum>; + private getItemStyle; + private makeItemStylerParams; + protected updateDatumStyles(opts: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, RangeBarNodeDatum>; + isHighlight: boolean; + }): void; + protected updateDatumNodes({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, RangeBarNodeDatum>; + isHighlight: boolean; + }): void; + protected updateLabelSelection(opts: { + labelData: RangeBarNodeLabelDatum[]; + labelSelection: RangeBarAnimationData['labelSelection']; + }): _ModuleSupport.Selection<_ModuleSupport.Text, RangeBarNodeLabelDatum>; + protected updateLabelNodes(opts: { + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, RangeBarNodeLabelDatum>; + }): void; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + animateEmptyUpdateReady({ datumSelection, labelSelection }: RangeBarAnimationData): void; + animateWaitingUpdateReady(data: RangeBarAnimationData): void; + private getDatumId; + protected isLabelEnabled(): boolean; + protected onDataChange(): void; + protected computeFocusBounds({ datumIndex }: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarSeriesOptionsDef.d.ts new file mode 100644 index 000000000..d2108e368 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgRangeBarSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const rangeBarSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarThemes.d.ts new file mode 100644 index 000000000..405a27550 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/range-bar/rangeBarThemes.d.ts @@ -0,0 +1,8 @@ +import { type AgChartThemeOverrides, type WithThemeParams } from 'ag-charts-community'; +export declare const RANGE_BAR_SERIES_THEME: WithThemeParams; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/index.d.ts new file mode 100644 index 000000000..95b3b5d07 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/index.d.ts @@ -0,0 +1 @@ +export { SankeySeriesModule } from './sankeyModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/main.d.ts new file mode 100644 index 000000000..ff654a2d0 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/main.d.ts @@ -0,0 +1 @@ +export { SankeyModule } from './sankeyModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeyLink.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeyLink.d.ts new file mode 100644 index 000000000..c318d6917 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeyLink.d.ts @@ -0,0 +1,18 @@ +import { _ModuleSupport } from 'ag-charts-community'; +declare const Path: typeof _ModuleSupport.Path; +export declare class SankeyLink extends Path { + x1: number; + x2: number; + y1: number; + y2: number; + height: number; + inset: number; + elbows: { + x: number; + y: number; + }[]; + protected computeBBox(): _ModuleSupport.BBox | undefined; + updatePath(): void; + updatePathSection(x1: number, y1: number, x2: number, y2: number, height: number, yOffset: number): void; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeyModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeyModule.d.ts new file mode 100644 index 000000000..2f1e0f51a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeyModule.d.ts @@ -0,0 +1,4 @@ +import { type AgSankeySeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const SankeyModule: _ModuleSupport.SeriesModule<'sankey'>; +export declare const SankeySeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeySeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeySeries.d.ts new file mode 100644 index 000000000..c7a2ef82c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeySeries.d.ts @@ -0,0 +1,67 @@ +import { type AgSankeySeriesNodeStyle, type AgSankeySeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import { type FlowProportionNodeDatumIndex, FlowProportionSeries } from '../flow-proportion/flowProportionSeries'; +import { SankeyLink } from './sankeyLink'; +import { type SankeyDatum, type SankeyLinkDatum, type SankeyNodeDatum, type SankeyNodeLabelDatum, SankeySeriesProperties } from './sankeySeriesProperties'; +export declare class SankeySeries extends FlowProportionSeries { + static readonly className = "SankeySeries"; + static readonly type: "sankey"; + properties: SankeySeriesProperties; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + private isLabelEnabled; + protected linkFactory(): SankeyLink; + protected nodeFactory(): _ModuleSupport.Rect; + createNodeData(): { + itemId: string; + nodeData: SankeyDatum[]; + labelData: SankeyNodeLabelDatum[]; + } | undefined; + private sortNodes; + protected updateLabelSelection(opts: { + labelData: SankeyNodeLabelDatum[]; + labelSelection: _ModuleSupport.Selection<_ModuleSupport.TransformableText, SankeyNodeLabelDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.TransformableText, SankeyNodeLabelDatum>; + protected updateLabelNodes(opts: { + labelSelection: _ModuleSupport.Selection<_ModuleSupport.TransformableText, SankeyNodeLabelDatum>; + }): void; + protected updateNodeSelection(opts: { + nodeData: SankeyNodeDatum[]; + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, SankeyNodeDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.Rect, SankeyNodeDatum>; + protected getNodeStyle(nodeDatum: Partial, fromNodeDatumIndex: number, isHighlight: boolean): Required & Required & Partial & { + fill: import("ag-charts-community").AgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + opacity: number; + }>; + private makeItemStylerParams; + protected updateNodeNodes(opts: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, SankeyNodeDatum>; + isHighlight: boolean; + }): void; + private getShapeFillBBox; + protected updateLinkSelection(opts: { + nodeData: SankeyLinkDatum[]; + datumSelection: _ModuleSupport.Selection; + }): _ModuleSupport.Selection, SankeyLinkDatum>; + protected getLinkStyle({ datumIndex, datum }: Partial, fromNodeDatumIndex: FlowProportionNodeDatumIndex, isHighlight: boolean): Required & Required & Partial & { + fill: import("ag-charts-community").AgColorType; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + opacity: number; + }>; + protected updateLinkNodes(opts: { + datumSelection: _ModuleSupport.Selection; + isHighlight: boolean; + }): void; + getTooltipContent(datumIndex: FlowProportionNodeDatumIndex): _ModuleSupport.TooltipContent | undefined; + protected computeFocusBounds(node: _ModuleSupport.Rect | SankeyLink): _ModuleSupport.BBox | _ModuleSupport.Path | undefined; + protected hasItemStylers(): boolean; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeySeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeySeriesOptionsDef.d.ts new file mode 100644 index 000000000..46dd3f25b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeySeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgSankeySeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const sankeySeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeySeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeySeriesProperties.d.ts new file mode 100644 index 000000000..c5c1d9658 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sankey/sankeySeriesProperties.d.ts @@ -0,0 +1,86 @@ +import { type AgSankeySeriesLabelFormatterParams, type AgSankeySeriesLinkItemStylerParams, type AgSankeySeriesLinkOptions, type AgSankeySeriesLinkStyle, type AgSankeySeriesNodeItemStylerParams, type AgSankeySeriesNodeOptions, type AgSankeySeriesNodeStyle, type AgSankeySeriesOptions, type AgSankeySeriesTooltipRendererParams, type Styler, _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +import type { FlowProportionLinkDatum, FlowProportionNodeDatum } from '../flow-proportion/flowProportionSeries'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties, SeriesProperties: typeof _ModuleSupport.SeriesProperties, Label: typeof _ModuleSupport.Label; +export interface SankeyNodeDatum extends FlowProportionNodeDatum { + size: number; + x: number; + y: number; + width: number; + height: number; +} +export interface SankeyLinkDatum extends FlowProportionLinkDatum { + x1: number; + x2: number; + y1: number; + y2: number; + height: number; + elbows: { + x: number; + y: number; + }[]; +} +export type SankeyDatum = SankeyLinkDatum | SankeyNodeDatum; +export interface SankeyNodeLabelDatum { + x: number; + y: number; + textAlign: 'left' | 'right' | 'center'; + text: string; + size: number; +} +declare class SankeySeriesLabelProperties extends Label { + spacing: number; + placement: 'left' | 'right' | 'center' | undefined; + edgePlacement: 'inside' | 'outside' | undefined; +} +declare class SankeySeriesLinkProperties extends BaseProperties> { + fill: InternalAgColorType | undefined; + fillOpacity: number; + stroke: string | undefined; + strokeOpacity: number; + strokeWidth: number; + lineDash: number[]; + lineDashOffset: number; + itemStyler?: Styler, AgSankeySeriesLinkStyle>; +} +declare class SankeySeriesNodeProperties extends BaseProperties> { + spacing: number; + minSpacing: number; + width: number; + alignment: 'left' | 'right' | 'center' | 'justify'; + verticalAlignment: 'top' | 'bottom' | 'center'; + sort: 'data' | 'ascending' | 'descending' | 'auto'; + fill: InternalAgColorType | undefined; + fillOpacity: number; + stroke: string | undefined; + strokeOpacity: number; + strokeWidth: number; + lineDash: number[]; + lineDashOffset: number; + itemStyler?: Styler, AgSankeySeriesNodeStyle>; +} +export declare class SankeySeriesProperties extends SeriesProperties { + nodes: any[] | undefined; + fromKey: string; + toKey: string; + idKey: string; + idName: string | undefined; + labelKey: string | undefined; + labelName: string | undefined; + sizeKey: string | undefined; + sizeName: string | undefined; + readonly fillGradientDefaults: _ModuleSupport.FillGradientDefaults; + readonly fillPatternDefaults: _ModuleSupport.FillPatternDefaults; + readonly fillImageDefaults: _ModuleSupport.FillImageDefaults; + defaultColorRange: string[][]; + defaultPatternFills: string[]; + fills: InternalAgColorType[]; + strokes: string[]; + readonly label: SankeySeriesLabelProperties; + readonly link: SankeySeriesLinkProperties; + readonly node: SankeySeriesNodeProperties; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + constructor(); + getStyle(isLink: boolean, fills: InternalAgColorType[], strokes: string[], index: number): Required | Required; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/index.d.ts new file mode 100644 index 000000000..f75be89ef --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/index.d.ts @@ -0,0 +1 @@ +export { SunburstSeriesModule } from './sunburstModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/main.d.ts new file mode 100644 index 000000000..1b1105cc7 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/main.d.ts @@ -0,0 +1 @@ +export { SunburstModule } from './sunburstModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstModule.d.ts new file mode 100644 index 000000000..12a70d7b2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstModule.d.ts @@ -0,0 +1,4 @@ +import { type AgSunburstSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const SunburstModule: _ModuleSupport.SeriesModule<'sunburst'>; +export declare const SunburstSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstSeries.d.ts new file mode 100644 index 000000000..f1970425b --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstSeries.d.ts @@ -0,0 +1,90 @@ +import { type AgSunburstSeriesLabelFormatterParams, type TextOrSegments, _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import type { AgSunburstSeriesOptions, AgSunburstSeriesStyle, FontStyle, FontWeight } from 'ag-charts-types'; +import { SunburstSeriesProperties } from './sunburstSeriesProperties'; +declare class SunburstNode extends _ModuleSupport.HierarchyNode { + label: LabelLayout | undefined; + secondaryLabel: LabelLayout | undefined; + contentHeight: number; + bbox: _ModuleSupport.BBox | undefined; + startAngle: number; + endAngle: number; +} +interface LabelLayout { + text: TextOrSegments; + fontSize: number; + lineHeight: number; + fontStyle: FontStyle; + fontFamily: string; + fontWeight: FontWeight; + color: string; + labelPlacement: LabelPlacement; + circleQuarter: number; + radius: number; + theta: number; + width: number; + height: number; +} +declare enum LabelPlacement { + CenterCircle = 0, + Parallel = 1, + Perpendicular = 2 +} +export declare class SunburstSeries extends _ModuleSupport.HierarchySeries<_ModuleSupport.Sector, AgSunburstSeriesOptions, SunburstSeriesProperties, SunburstNode> { + static readonly className = "SunburstSeries"; + static readonly type: "sunburst"; + NodeClass: typeof SunburstNode; + properties: SunburstSeriesProperties; + private readonly scalingGroup; + private readonly sectorGroup; + private readonly sectorLabelGroup; + private readonly highlightSectorGroup; + readonly datumSelection: _ModuleSupport.Selection<_ModuleSupport.Sector, SunburstNode>; + private readonly labelSelection; + private readonly highlightSelection; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + processData(): void; + updateSelections(): void; + protected getItemStyle(nodeDatum: Pick, isHighlight: boolean): { + fill?: string | undefined; + fillOpacity?: number | undefined; + stroke?: string | undefined; + strokeWidth?: number | undefined; + strokeOpacity?: number | undefined; + readonly label: import("../util/autoSizedLabel").AutoSizedLabel>; + readonly secondaryLabel: import("../util/autoSizedLabel").AutoSizedLabel>; + deprecated: boolean; + readonly item: _ModuleSupport.SeriesItemHighlightStyle; + readonly series: { + strokeWidth?: number | undefined; + dimOpacity?: number | undefined; + enabled?: boolean | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + readonly text: { + color?: string | undefined; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + }; + set(properties: object): any; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + clear(): any; + toJson(this: J): object; + } & Required & { + opacity: number; + }; + private makeItemStylerParams; + updateNodes(): void; + getTooltipContent(datumIndex: number[]): _ModuleSupport.TooltipContent | undefined; + createNodeData(): undefined; + protected pickNodeClosestDatum(point: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + protected animateEmptyUpdateReady(): void; + protected computeFocusBounds(node: _ModuleSupport.Sector): _ModuleSupport.Path | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstSeriesOptionsDef.d.ts new file mode 100644 index 000000000..3e6dcbc55 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgSunburstSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const sunburstSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstSeriesProperties.d.ts new file mode 100644 index 000000000..4a2b61360 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/sunburst/sunburstSeriesProperties.d.ts @@ -0,0 +1,34 @@ +import type { AgSunburstSeriesItemStylerParams, AgSunburstSeriesLabelFormatterParams, AgSunburstSeriesOptions, AgSunburstSeriesStyle, AgSunburstSeriesTooltipRendererParams, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import { AutoSizedLabel, AutoSizedSecondaryLabel } from '../util/autoSizedLabel'; +declare const HierarchySeriesProperties: typeof _ModuleSupport.HierarchySeriesProperties, HighlightStyle: typeof _ModuleSupport.HighlightStyle; +declare class SunburstSeriesTileHighlightStyle extends HighlightStyle { + constructor(); + fill?: string; + fillOpacity?: number; + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + readonly label: AutoSizedLabel>; + readonly secondaryLabel: AutoSizedLabel>; +} +export declare class SunburstSeriesProperties extends HierarchySeriesProperties { + sizeName?: string; + labelKey?: string; + secondaryLabelKey?: string; + fillOpacity: number; + strokeWidth: number; + strokeOpacity: number; + cornerRadius: number; + sectorSpacing?: number; + padding?: number; + itemStyler?: Styler, AgSunburstSeriesStyle>; + highlightStyle: SunburstSeriesTileHighlightStyle; + readonly label: AutoSizedLabel>; + readonly secondaryLabel: AutoSizedSecondaryLabel>; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + getStyle(index: number): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/index.d.ts new file mode 100644 index 000000000..a8fe2ebcd --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/index.d.ts @@ -0,0 +1 @@ +export { TreemapSeriesModule } from './treemapModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/main.d.ts new file mode 100644 index 000000000..0f180ee82 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/main.d.ts @@ -0,0 +1 @@ +export { TreemapModule } from './treemapModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapModule.d.ts new file mode 100644 index 000000000..e93071773 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapModule.d.ts @@ -0,0 +1,4 @@ +import { type AgTreemapSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const TreemapModule: _ModuleSupport.SeriesModule<'treemap'>; +export declare const TreemapSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapSeries.d.ts new file mode 100644 index 000000000..53d4efb30 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapSeries.d.ts @@ -0,0 +1,88 @@ +import { type AgTreemapSeriesLabelFormatterParams, type AgTreemapSeriesOptions, type AgTreemapSeriesStyle, type FontStyle, type FontWeight, type TextAlign, type TextOrSegments, type VerticalAlign, _ModuleSupport } from 'ag-charts-community'; +import { type Point } from 'ag-charts-core'; +import { TreemapSeriesProperties } from './treemapSeriesProperties'; +declare class TreemapNode extends _ModuleSupport.HierarchyNode { + labelValue: string | undefined; + secondaryLabelValue: string | undefined; + label: LabelLayout | undefined; + secondaryLabel: LabelLayout | undefined; + bbox: _ModuleSupport.BBox | undefined; + padding: Padding | undefined; +} +interface Padding { + top: number; + right: number; + bottom: number; + left: number; +} +interface LabelLayout { + text: TextOrSegments; + fontSize: number; + lineHeight: number; + fontStyle: FontStyle; + fontFamily: string; + fontWeight: FontWeight; + color: string; + textAlign: TextAlign; + verticalAlign: VerticalAlign; + x: number; + y: number; +} +declare class DistantGroup extends _ModuleSupport.Group implements _ModuleSupport.DistantObject { + distanceSquared(x: number, y: number): number; +} +export declare class TreemapSeries extends _ModuleSupport.HierarchySeries { + static readonly className = "TreemapSeries"; + static readonly type: "treemap"; + NodeClass: typeof TreemapNode; + properties: TreemapSeriesProperties; + private readonly rectGroup; + protected readonly datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, TreemapNode>; + private readonly labelSelection; + private readonly highlightSelection; + private groupTitleHeight; + private getNodePadding; + private sortChildren; + /** + * Squarified Treemap algorithm + * https://www.win.tue.nl/~vanwijk/stm.pdf + */ + private squarify; + private applyGap; + createNodeData(): undefined; + protected getItemStyle(nodeDatum: Pick, isLeaf: boolean, isHighlight: boolean): { + fill?: string | undefined; + fillOpacity?: number | undefined; + stroke?: string | undefined; + strokeWidth?: number | undefined; + strokeOpacity?: number | undefined; + readonly label: import("../util/autoSizedLabel").AutoSizedLabel>; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + } & { + fill?: string | undefined; + fillOpacity?: number | undefined; + stroke?: string | undefined; + strokeWidth?: number | undefined; + strokeOpacity?: number | undefined; + readonly label: import("../util/autoSizedLabel").AutoSizedLabel>; + readonly secondaryLabel: import("../util/autoSizedLabel").AutoSizedSecondaryLabel>; + handleUnknownProperties(_unknownKeys: Set, _properties: object): void; + set(properties: object): any; + clear(): any; + toJson(this: J): object; + } & Required & { + opacity: number; + }; + private makeItemStylerParams; + updateSelections(): void; + updateNodes(): void; + pickNodesExactShape(point: Point): TreemapNode[]; + protected pickNodeClosestDatum(point: Point): _ModuleSupport.SeriesNodePickMatch | undefined; + getTooltipContent(datumIndex: number[]): _ModuleSupport.TooltipContent | undefined; + protected computeFocusBounds(node: _ModuleSupport.Group): _ModuleSupport.BBox | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapSeriesOptionsDef.d.ts new file mode 100644 index 000000000..159036f49 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgTreemapSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const treemapSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapSeriesProperties.d.ts new file mode 100644 index 000000000..3ff8740ce --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/treemap/treemapSeriesProperties.d.ts @@ -0,0 +1,74 @@ +import type { AgTreemapSeriesItemStylerParams, AgTreemapSeriesLabelFormatterParams, AgTreemapSeriesOptions, AgTreemapSeriesStyle, AgTreemapSeriesTooltipRendererParams, Styler, TextAlign, VerticalAlign } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +import { AutoSizedLabel, AutoSizedSecondaryLabel } from '../util/autoSizedLabel'; +declare const BaseProperties: typeof _ModuleSupport.BaseProperties, HierarchySeriesProperties: typeof _ModuleSupport.HierarchySeriesProperties, HighlightStyle: typeof _ModuleSupport.HighlightStyle, Label: typeof _ModuleSupport.Label; +declare class TreemapGroupLabel extends Label { + spacing: number; +} +declare class TreemapSeriesGroup extends BaseProperties { + fill: InternalAgColorType | undefined; + fillOpacity: number; + stroke?: string; + strokeWidth: number; + strokeOpacity: number; + cornerRadius: number; + textAlign: TextAlign; + gap: number; + padding: number; + interactive: boolean; + readonly label: TreemapGroupLabel; +} +declare class TreemapSeriesTile extends BaseProperties { + fill: InternalAgColorType | undefined; + fillOpacity: number; + stroke?: string; + strokeWidth: number; + strokeOpacity: number; + cornerRadius: number; + textAlign: TextAlign; + verticalAlign: VerticalAlign; + gap: number; + padding: number; + readonly label: AutoSizedLabel>; + readonly secondaryLabel: AutoSizedSecondaryLabel>; +} +declare class TreemapSeriesGroupHighlightStyle extends BaseProperties { + fill?: string; + fillOpacity?: number; + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + readonly label: AutoSizedLabel>; +} +declare class TreemapSeriesTileHighlightStyle extends BaseProperties { + fill?: string; + fillOpacity?: number; + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + readonly label: AutoSizedLabel>; + readonly secondaryLabel: AutoSizedSecondaryLabel>; +} +declare class TreemapSeriesHighlightStyle extends HighlightStyle { + constructor(); + readonly group: TreemapSeriesGroupHighlightStyle; + readonly tile: TreemapSeriesTileHighlightStyle; + getStyle(isLeaf: boolean): TreemapSeriesGroupHighlightStyle | TreemapSeriesTileHighlightStyle; +} +export declare class TreemapSeriesProperties extends HierarchySeriesProperties { + sizeName?: string; + labelKey?: string; + secondaryLabelKey?: string; + itemStyler?: Styler, AgTreemapSeriesStyle>; + readonly highlightStyle: TreemapSeriesHighlightStyle; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + readonly group: TreemapSeriesGroup; + readonly tile: TreemapSeriesTile; + undocumentedGroupFills: string[]; + undocumentedGroupStrokes: string[]; + getStyle(isLeaf: boolean, fills: InternalAgColorType[], strokes: string[], index: number): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/util/autoSizedLabel.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/util/autoSizedLabel.d.ts new file mode 100644 index 000000000..76fa9c01e --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/util/autoSizedLabel.d.ts @@ -0,0 +1,14 @@ +import { _ModuleSupport } from 'ag-charts-community'; +import type { OverflowStrategy, TextWrap } from 'ag-charts-types'; +declare class BaseAutoSizedLabel extends _ModuleSupport.Label { + wrapping: TextWrap; + overflowStrategy: OverflowStrategy; + lineHeight?: number; + minimumFontSize?: number; +} +export declare class AutoSizedLabel extends BaseAutoSizedLabel { + spacing: number; +} +export declare class AutoSizedSecondaryLabel extends BaseAutoSizedLabel { +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/util/labelFormatter.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/util/labelFormatter.d.ts new file mode 100644 index 000000000..1fd878b82 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/util/labelFormatter.d.ts @@ -0,0 +1,62 @@ +import type { AgChartAutoSizedBaseLabelOptions, AgChartAutoSizedLabelOptions, AgChartAutoSizedSecondaryLabelOptions, FontSize, TextOrSegments } from 'ag-charts-types'; +interface AutoSizedBaseLabelOptions extends AgChartAutoSizedBaseLabelOptions { + fontSize: FontSize; +} +interface AutoSizedLabelOptions extends AgChartAutoSizedLabelOptions { + fontSize: FontSize; +} +interface AutoSizedSecondaryLabelOptions extends AgChartAutoSizedSecondaryLabelOptions { + fontSize: FontSize; +} +type FontSizeCandidate = { + labelFontSize: number; + secondaryLabelFontSize: number; +}; +export declare function generateLabelSecondaryLabelFontSizeCandidates(label: AutoSizedBaseLabelOptions, secondaryLabel: AutoSizedBaseLabelOptions): FontSizeCandidate[]; +type LayoutParams = { + padding: number; +}; +export type LabelFormatting = { + text: TextOrSegments; + fontSize: number; + lineHeight: number; + width: number; + height: number; +}; +type StackedLabelFormatting = { + width: number; + height: number; + meta: Meta; +} & ({ + label: LabelFormatting; + secondaryLabel: LabelFormatting; +} | { + label: LabelFormatting; + secondaryLabel: LabelFormatting | undefined; +} | { + label: LabelFormatting | undefined; + secondaryLabel: LabelFormatting; +}); +type SizeFittingHeightFn = (height: number, canTruncate: boolean) => { + width: number; + height: number; + meta: Meta; +}; +export declare function formatStackedLabels(labelValue: string, labelProps: AutoSizedLabelOptions, secondaryLabelValue: string, secondaryLabelProps: AutoSizedSecondaryLabelOptions, { padding }: LayoutParams, sizeFittingHeight: SizeFittingHeightFn): ({ + width: number; + height: number; + meta: Meta; +} & { + label: LabelFormatting; + secondaryLabel: LabelFormatting | undefined; +}) | ({ + width: number; + height: number; + meta: Meta; +} & { + label: LabelFormatting | undefined; + secondaryLabel: LabelFormatting; +}) | undefined; +export declare function formatSingleLabel(value: string, props: AutoSizedBaseLabelOptions, { padding }: LayoutParams, sizeFittingHeight: SizeFittingHeightFn): [LabelFormatting, Meta] | undefined; +export declare function formatLabels(baseLabelValue: string | undefined, labelProps: AutoSizedLabelOptions, baseSecondaryLabelValue: string | undefined, secondaryLabelProps: AutoSizedSecondaryLabelOptions, layoutParams: LayoutParams, sizeFittingHeight: SizeFittingHeightFn): StackedLabelFormatting | undefined; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/util/radialUtil.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/util/radialUtil.d.ts new file mode 100644 index 000000000..08ae2b556 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/util/radialUtil.d.ts @@ -0,0 +1,61 @@ +import type { AgColorType, AgRadialSeriesItemStylerParams, AgRadialSeriesStyle, AgRadialSeriesStylerParams, HighlightState as HighlightStateString, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { Callback, CallbackParam, InternalAgColorType } from 'ag-charts-core'; +type BaseNodeDatum = _ModuleSupport.DataModelSeriesNodeDatum; +export interface RadialSeriesStyleResult extends Required> { + fill: InternalAgColorType; + opacity: 1; +} +interface RadialSectorSeries { + readonly id: string; + readonly ctx: _ModuleSupport.ModuleContext; + readonly declarationOrder: number; + readonly context?: { + nodeData: D[]; + }; + readonly properties: { + readonly angleKey: string; + readonly radiusKey: string; + readonly fill: InternalAgColorType; + readonly fillOpacity: number; + readonly stroke: string; + readonly strokeWidth: number; + readonly strokeOpacity: number; + readonly lineDash: number[]; + readonly lineDashOffset: number; + readonly cornerRadius: number; + readonly stackGroup?: string; + readonly styler?: Styler, AgRadialSeriesStyle>; + readonly itemStyler?: Styler, AgRadialSeriesStyle>; + }; + callWithContext(fn: F, params: CallbackParam): ReturnType; + cachedCallWithContext(fn: F, params: CallbackParam): ReturnType | undefined; + cachedDatumCallback(id: any, fn: () => T): T | undefined; + filterItemStylerFillParams(fill: AgColorType | undefined): InternalAgColorType | undefined; + getDatumId(datum: D): string | number | boolean | undefined; + getHighlightStyle(isHighlight?: boolean, datumIndex?: number, highlightState?: _ModuleSupport.HighlightState): AgRadialSeriesStyle; + getHighlightStateString(datum: _ModuleSupport.HighlightNodeDatum | undefined, isHighlight?: boolean, datumIndex?: number): HighlightStateString; +} +export declare function makeStylerParams(series: RadialSectorSeries, highlighted: boolean, highlightStateEnum?: _ModuleSupport.HighlightState): AgRadialSeriesStylerParams; +export declare function getStyle(series: RadialSectorSeries, ignoreStylerCallback: boolean, highlighted: boolean, highlightState?: _ModuleSupport.HighlightState): RadialSeriesStyleResult; +export declare function makeItemStylerParams>(series: S, nodeDatum: D, isHighlight: boolean, style: Required & { + opacity: number; +}): { + fill: string | import("ag-charts-community").AgGradientColor | import("ag-charts-community").AgPatternColor | import("ag-charts-community").AgImageFill; + cornerRadius: number; + fillOpacity: number; + stroke: string; + strokeWidth: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + opacity: number; + seriesId: string; + datum: unknown; + highlighted: boolean; + highlightState: HighlightStateString; + angleKey: string; + radiusKey: string; +}; +export declare function getItemStyle>(series: S, nodeDatum: D | undefined, isHighlight: boolean, highlightState?: _ModuleSupport.HighlightState): RadialSeriesStyleResult; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/index.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/index.d.ts new file mode 100644 index 000000000..9e7b90a71 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/index.d.ts @@ -0,0 +1 @@ +export { WaterfallSeriesModule } from './waterfallModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/main.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/main.d.ts new file mode 100644 index 000000000..67400effb --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/main.d.ts @@ -0,0 +1 @@ +export { WaterfallModule } from './waterfallModule'; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallModule.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallModule.d.ts new file mode 100644 index 000000000..e1c5bb98c --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallModule.d.ts @@ -0,0 +1,4 @@ +import { type AgWaterfallSeriesOptions, _ModuleSupport } from 'ag-charts-community'; +import type { SeriesModuleDefinition } from 'ag-charts-core'; +export declare const WaterfallModule: _ModuleSupport.SeriesModule<'waterfall'>; +export declare const WaterfallSeriesModule: SeriesModuleDefinition; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallSeries.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallSeries.d.ts new file mode 100644 index 000000000..abb261d8f --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallSeries.d.ts @@ -0,0 +1,90 @@ +import type { AgWaterfallSeriesItemType, AgWaterfallSeriesOptions, AgWaterfallSeriesStyle, TextOrSegments } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { Point } from 'ag-charts-core'; +import { WaterfallSeriesProperties } from './waterfallSeriesProperties'; +type WaterfallNodeLabelDatum = Readonly & { + readonly text: TextOrSegments; + readonly textAlign: CanvasTextAlign; + readonly textBaseline: CanvasTextBaseline; +}; +type WaterfallNodePointDatum = _ModuleSupport.DataModelSeriesNodeDatum['point'] & { + readonly x2: number; + readonly y2: number; +}; +interface WaterfallNodeDatum extends _ModuleSupport.CartesianSeriesNodeDatum, Readonly { + readonly index: number; + readonly itemId: AgWaterfallSeriesItemType; + readonly cumulativeValue: number; + readonly width: number; + readonly height: number; + readonly label: WaterfallNodeLabelDatum; + readonly crisp: boolean; + readonly clipBBox?: _ModuleSupport.BBox; + readonly opacity?: number; + style?: Required; +} +interface WaterfallContext extends _ModuleSupport.AbstractBarSeriesNodeDataContext { + pointData?: WaterfallNodePointDatum[]; + styles: Record>>; +} +type WaterfallAnimationData = _ModuleSupport.CartesianAnimationData<_ModuleSupport.Rect, WaterfallNodeDatum, WaterfallNodeDatum, WaterfallContext>; +export declare class WaterfallSeries extends _ModuleSupport.AbstractBarSeries<_ModuleSupport.Rect, AgWaterfallSeriesOptions, WaterfallSeriesProperties, WaterfallNodeDatum, WaterfallNodeDatum, WaterfallContext> { + static readonly className = "WaterfallSeries"; + static readonly type: "waterfall"; + properties: WaterfallSeriesProperties; + constructor(moduleCtx: _ModuleSupport.ModuleContext); + private readonly seriesItemTypes; + processData(dataController: _ModuleSupport.DataController): Promise; + getSeriesDomain(direction: _ModuleSupport.ChartAxisDirection): any[]; + getSeriesRange(_direction: _ModuleSupport.ChartAxisDirection, _visibleRange: [any, any]): [number, number]; + createNodeData(): WaterfallContext | undefined; + private updateSeriesItemTypes; + private isSubtotal; + private isTotal; + protected nodeFactory(): _ModuleSupport.Rect; + private getSeriesItemType; + private getItemConfig; + protected updateDatumSelection(opts: { + nodeData: WaterfallNodeDatum[]; + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, WaterfallNodeDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.Rect, WaterfallNodeDatum>; + private getItemStyle; + private makeItemStylerParams; + protected updateDatumStyles({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, WaterfallNodeDatum>; + isHighlight: boolean; + }): void; + protected updateDatumNodes({ datumSelection, isHighlight, }: { + datumSelection: _ModuleSupport.Selection<_ModuleSupport.Rect, WaterfallNodeDatum>; + isHighlight: boolean; + }): void; + protected updateLabelSelection(opts: { + labelData: WaterfallNodeDatum[]; + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, WaterfallNodeDatum>; + }): _ModuleSupport.Selection<_ModuleSupport.Text, WaterfallNodeDatum>; + protected updateLabelNodes(opts: { + labelSelection: _ModuleSupport.Selection<_ModuleSupport.Text, WaterfallNodeDatum>; + }): void; + getTooltipContent(datumIndex: number): _ModuleSupport.TooltipContent | undefined; + private legendItemSymbol; + getLegendData(legendType: _ModuleSupport.ChartLegendType): _ModuleSupport.CategoryLegendDatum[]; + protected toggleSeriesItem(): void; + animateEmptyUpdateReady(opts: WaterfallAnimationData): void; + protected animateConnectorLinesHorizontal(opts: WaterfallAnimationData): void; + protected animateConnectorLinesVertical(opts: WaterfallAnimationData): void; + animateReadyResize(data: WaterfallAnimationData): void; + protected updatePaths(opts: { + contextData: WaterfallContext; + paths: _ModuleSupport.Path[]; + }): void; + resetConnectorLinesPath({ contextData, paths, }: { + contextData: WaterfallContext; + paths: Array<_ModuleSupport.Path>; + }): void; + protected updateLineNode(lineNode: _ModuleSupport.Path): void; + protected isLabelEnabled(): boolean; + protected onDataChange(): void; + protected computeFocusBounds({ datumIndex }: _ModuleSupport.PickFocusInputs): _ModuleSupport.BBox | undefined; + protected hasItemStylers(): boolean; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallSeriesOptionsDef.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallSeriesOptionsDef.d.ts new file mode 100644 index 000000000..b24fa01a6 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallSeriesOptionsDef.d.ts @@ -0,0 +1,3 @@ +import { type AgWaterfallSeriesOptions } from 'ag-charts-community'; +import { type OptionsDefs } from 'ag-charts-core'; +export declare const waterfallSeriesOptionsDef: OptionsDefs; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallSeriesProperties.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallSeriesProperties.d.ts new file mode 100644 index 000000000..ba5c98860 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallSeriesProperties.d.ts @@ -0,0 +1,58 @@ +import type { AgTooltipRendererResult, AgWaterfallSeriesItemStylerParams, AgWaterfallSeriesItemType, AgWaterfallSeriesLabelFormatterParams, AgWaterfallSeriesLabelPlacement, AgWaterfallSeriesOptions, AgWaterfallSeriesStyle, AgWaterfallSeriesTooltipRendererParams, PixelSize, Styler } from 'ag-charts-community'; +import { _ModuleSupport } from 'ag-charts-community'; +import type { InternalAgColorType } from 'ag-charts-core'; +declare const AbstractBarSeriesProperties: typeof _ModuleSupport.AbstractBarSeriesProperties, BaseProperties: typeof _ModuleSupport.BaseProperties, Label: typeof _ModuleSupport.Label; +export declare class WaterfallSeriesTotal extends BaseProperties { + totalType: 'subtotal' | 'total'; + index: number; + axisLabel: string; +} +declare class WaterfallSeriesItemTooltip extends BaseProperties { + renderer?: (params: AgWaterfallSeriesTooltipRendererParams) => string | AgTooltipRendererResult; +} +declare class WaterfallSeriesLabel extends Label { + placement: AgWaterfallSeriesLabelPlacement; + spacing: PixelSize; +} +export declare class WaterfallSeriesItem extends BaseProperties { + name?: string; + fill: InternalAgColorType; + stroke: string; + fillOpacity: number; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + strokeWidth: number; + cornerRadius: number; + itemStyler?: Styler, AgWaterfallSeriesStyle>; + readonly shadow: _ModuleSupport.DropShadow; + readonly label: WaterfallSeriesLabel; + readonly tooltip: WaterfallSeriesItemTooltip; +} +declare class WaterfallSeriesConnectorLine extends BaseProperties { + enabled: boolean; + stroke: string; + strokeOpacity: number; + lineDash: number[]; + lineDashOffset: number; + strokeWidth: number; +} +declare class WaterfallSeriesItems extends BaseProperties { + readonly positive: WaterfallSeriesItem; + readonly negative: WaterfallSeriesItem; + readonly total: WaterfallSeriesItem; +} +export declare class WaterfallSeriesProperties extends AbstractBarSeriesProperties { + xKey: string; + yKey: string; + xName?: string; + yName?: string; + readonly item: WaterfallSeriesItems; + readonly totals: WaterfallSeriesTotal[]; + readonly line: WaterfallSeriesConnectorLine; + readonly tooltip: _ModuleSupport.SeriesTooltip, "context">>; + getStyle(itemId: AgWaterfallSeriesItemType): Required & { + opacity: number; + }; +} +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallThemes.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallThemes.d.ts new file mode 100644 index 000000000..de5fdc619 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/series/waterfall/waterfallThemes.d.ts @@ -0,0 +1,2 @@ +import { _ModuleSupport } from 'ag-charts-community'; +export declare const WATERFALL_SERIES_THEME: _ModuleSupport.SeriesModule<'waterfall'>['themeTemplate']; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/setup.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/setup.d.ts new file mode 100644 index 000000000..77c6c3571 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/setup.d.ts @@ -0,0 +1 @@ +export declare function setupEnterpriseModules(): void; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/typings.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/typings.d.ts new file mode 100644 index 000000000..c71d42302 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/typings.d.ts @@ -0,0 +1,8 @@ +declare module '*.css' { + const contents: string; + export default contents; +} +declare module '*.html' { + const contents: string; + export default contents; +} diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/utils/datum.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/utils/datum.d.ts new file mode 100644 index 000000000..5fab2b6c1 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/utils/datum.d.ts @@ -0,0 +1,4 @@ +import type { _ModuleSupport } from 'ag-charts-community'; +export declare function readDatum(nodeDatum: _ModuleSupport.HighlightNodeDatum | undefined): null | Partial<{ + [key: string]: unknown; +}>; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/utils/formatter.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/utils/formatter.d.ts new file mode 100644 index 000000000..6645b6ff7 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/utils/formatter.d.ts @@ -0,0 +1,9 @@ +import type { Formatter, RichFormatter, TextOrSegments } from 'ag-charts-community'; +interface Ctx { + chartService: { + context?: unknown; + }; +} +export declare function formatWithContext

(ctx: Ctx, formatter: Formatter

, params: P): string | undefined; +export declare function formatWithContext

(ctx: Ctx, formatter: RichFormatter

, params: P): TextOrSegments | undefined; +export {}; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/types/src/utils/polar.d.ts b/yuthon_report/static/src/lib/ag-chart/dist/types/src/utils/polar.d.ts new file mode 100644 index 000000000..b62593de2 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/types/src/utils/polar.d.ts @@ -0,0 +1,10 @@ +/** + * Loops through an array of items right (starting from 0 till the middle item) + * and left (starting from 0, continuing with the last item till the middle item). + * Breaks if the iterator returns a truthy value. + * @param items Array of items. + * @param step Step to increment. + * @param iterator Iterator function that accepts an item and the next item. + * @returns `true` if the `iterator` returned `true`, or `false` if it never happened. + */ +export declare function loopSymmetrically(items: T[], step: number, iterator: (prev: T, next: T) => any): boolean; diff --git a/yuthon_report/static/src/lib/ag-chart/dist/umd/ag-charts-enterprise.js b/yuthon_report/static/src/lib/ag-chart/dist/umd/ag-charts-enterprise.js new file mode 100644 index 000000000..c04f1134a --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/umd/ag-charts-enterprise.js @@ -0,0 +1,102584 @@ +(function (g, f) { + if ("object" == typeof exports && "object" == typeof module) { + module.exports = f(); + } else if ("function" == typeof define && define.amd) { + define("agCharts", [], f); + } else if ("object" == typeof exports) { + exports["agCharts"] = f(); + } else { + g["agCharts"] = f(); + } + }(this, () => { +var exports = {}; +var module = { exports }; +if (typeof require === 'undefined') { + function require(name) { + + throw new Error('Unknown module: ' + name); + } +} + +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from3, except, desc) => { + if (from3 && typeof from3 === "object" || typeof from3 === "function") { + for (let key of __getOwnPropNames(from3)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from3[key], enumerable: !(desc = __getOwnPropDesc(from3, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var __decorateClass = (decorators, target, key, kind) => { + var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; + for (var i = decorators.length - 1, decorator; i >= 0; i--) + if (decorator = decorators[i]) + result = (kind ? decorator(target, key, result) : decorator(result)) || result; + if (kind && result) + __defProp(target, key, result); + return result; +}; + +// packages/ag-charts-enterprise/dist/package/main.esm.mjs +var main_esm_exports = {}; +__export(main_esm_exports, { + AG_CHARTS_LOCALE_EN_US: () => AG_CHARTS_LOCALE_EN_US, + AgCharts: () => AgCharts, + AgChartsCommunityModule: () => AgChartsCommunityModule, + AgChartsEnterpriseModule: () => AgChartsEnterpriseModule, + AgErrorBarSupportedSeriesTypes: () => AgErrorBarSupportedSeriesTypes, + AgTooltipAnchorToType: () => AgTooltipAnchorToType, + AgTooltipPlacementType: () => AgTooltipPlacementType, + LicenseManager: () => LicenseManager2, + VERSION: () => VERSION, + _ModuleSupport: () => module_support_exports, + _Scene: () => integrated_charts_scene_exports, + _Theme: () => integrated_charts_theme_exports, + _Util: () => integrated_charts_util_exports, + _Widget: () => exports_exports, + setupCommunityModules: () => registerInbuiltModules, + setupEnterpriseModules: () => setupEnterpriseModules2, + time: () => time2 +}); +module.exports = __toCommonJS(main_esm_exports); + +// packages/ag-charts-core/src/globals/logger.ts +var logger_exports = {}; +__export(logger_exports, { + error: () => error, + errorOnce: () => errorOnce, + log: () => log, + logGroup: () => logGroup, + reset: () => reset, + table: () => table, + warn: () => warn, + warnOnce: () => warnOnce +}); +var doOnceCache = /* @__PURE__ */ new Set(); +function log(...logContent) { + console.log(...logContent); +} +function warn(message, ...logContent) { + console.warn(`AG Charts - ${message}`, ...logContent); +} +function error(message, ...logContent) { + if (typeof message === "object") { + console.error(`AG Charts error`, message, ...logContent); + } else { + console.error(`AG Charts - ${message}`, ...logContent); + } +} +function table(...logContent) { + console.table(...logContent); +} +function guardOnce(messageOrError, prefix, cb) { + let message; + if (messageOrError instanceof Error) { + message = messageOrError.message; + } else if (typeof messageOrError === "string") { + message = messageOrError; + } else if (typeof messageOrError === "object") { + message = JSON.stringify(messageOrError); + } else { + message = String(messageOrError); + } + const cacheKey = `${prefix}: ${message}`; + if (doOnceCache.has(cacheKey)) + return; + cb(messageOrError); + doOnceCache.add(cacheKey); +} +function warnOnce(messageOrError, ...logContent) { + guardOnce(messageOrError, "Logger.warn", (message) => warn(message, ...logContent)); +} +function errorOnce(messageOrError, ...logContent) { + guardOnce(messageOrError, "Logger.error", (message) => error(message, ...logContent)); +} +function reset() { + doOnceCache.clear(); +} +function logGroup(name, cb) { + console.groupCollapsed(name); + try { + return cb(); + } finally { + console.groupEnd(); + } +} + +// packages/ag-charts-core/src/globals/moduleRegistry.ts +var moduleRegistry_exports = {}; +__export(moduleRegistry_exports, { + detectChartDefinition: () => detectChartDefinition, + getAxisModule: () => getAxisModule, + getPresetModule: () => getPresetModule, + getSeriesModule: () => getSeriesModule, + hasModule: () => hasModule, + listModulesByType: () => listModulesByType, + register: () => register, + registerMany: () => registerMany, + reset: () => reset2 +}); +var registeredModules = /* @__PURE__ */ new Map(); +function register(definition, version) { + const { def: existingDefinition, version: existingVersion } = registeredModules.get(definition.name) ?? {}; + if (!existingDefinition) { + registeredModules.set(definition.name, { def: definition, version }); + return; + } + if (!existingDefinition.enterprise && definition.enterprise && version === existingVersion) { + registeredModules.set(definition.name, { def: definition, version }); + return; + } + if (existingVersion === version) { + warn( + [ + `AG Charts - Module '${definition.name}' already registered,', + 'ignoring (version: ${existingVersion}).`, + `Check your code for duplicate loading of charts NPM modules.` + ].join(" ") + ); + return; + } + throw new Error( + [ + `AG Charts - Module '${definition.name}' already registered with different version:`, + `${existingVersion} vs ${version}`, + ``, + `Check your package.json for conflicting dependencies - depending on your package manager`, + `one of these commands may help:`, + `- npm ls ag-charts-community`, + `- yarn why ag-charts-community` + ].join("\n") + ); +} +function registerMany(definitions, version) { + for (const definition of definitions) { + register(definition, version); + } +} +function reset2() { + registeredModules.clear(); +} +function hasModule(moduleName) { + return registeredModules.has(moduleName); +} +function* listModulesByType(moduleType) { + for (const definition of registeredModules.values()) { + if (isModuleType(moduleType, definition.def)) { + yield definition.def; + } + } +} +function detectChartDefinition(options) { + for (const definition of registeredModules.values()) { + if (isModuleType("chart" /* Chart */, definition.def) && definition.def.detect(options)) { + return definition.def; + } + } + throw new Error( + `AG Charts - Unknown chart type; Check options are correctly structured and series types are specified` + ); +} +function getAxisModule(moduleName) { + const definition = registeredModules.get(moduleName); + if (isModuleType("axis" /* Axis */, definition?.def)) { + return definition?.def; + } +} +function getPresetModule(moduleName) { + const definition = registeredModules.get(moduleName); + if (isModuleType("preset" /* Preset */, definition?.def)) { + return definition?.def; + } +} +function getSeriesModule(moduleName) { + const definition = registeredModules.get(moduleName); + if (isModuleType("series" /* Series */, definition?.def)) { + return definition?.def; + } +} +function isModuleType(moduleType, definition) { + return definition?.type === moduleType; +} + +// packages/ag-charts-core/src/classes/eventEmitter.ts +var EventEmitter = class { + constructor() { + this.events = /* @__PURE__ */ new Map(); + } + /** + * Registers an event listener. + * @param eventName The event name to listen for. + * @param listener The callback to be invoked on the event. + * @returns A function to unregister the listener. + */ + on(eventName, listener) { + if (!this.events.has(eventName)) { + this.events.set(eventName, /* @__PURE__ */ new Set()); + } + this.events.get(eventName)?.add(listener); + return () => this.off(eventName, listener); + } + /** + * Unregisters an event listener. + * @param eventName The event name to stop listening for. + * @param listener The callback to be removed. + */ + off(eventName, listener) { + const eventListeners = this.events.get(eventName); + if (eventListeners) { + eventListeners.delete(listener); + if (eventListeners.size === 0) { + this.events.delete(eventName); + } + } + } + /** + * Emits an event to all registered listeners. + * @param eventName The name of the event to emit. + * @param event The event payload. + */ + emit(eventName, event) { + const listeners = this.events.get(eventName); + if (listeners) { + for (const callback2 of listeners) { + callback2(event); + } + } + } + /** + * Clears all listeners for a specific event or all events if no event name is provided. + * @param eventName (Optional) The name of the event to clear listeners for. If not provided, all listeners for all events are cleared. + */ + clear(eventName) { + if (eventName) { + this.events.delete(eventName); + } else { + this.events.clear(); + } + } +}; + +// packages/ag-charts-core/src/classes/lruCache.ts +var LRUCache = class { + constructor(maxCacheSize) { + this.maxCacheSize = maxCacheSize; + this.store = /* @__PURE__ */ new Map(); + if (maxCacheSize <= 0) { + throw new Error("LRUCache size must be greater than 0"); + } + } + get(key) { + if (!this.store.has(key)) + return; + const value = this.store.get(key); + this.store.delete(key); + this.store.set(key, value); + return value; + } + has(key) { + return this.store.has(key); + } + set(key, value) { + this.store.set(key, value); + if (this.store.size > this.maxCacheSize) { + this.store.delete(this.store.keys().next().value); + } + return value; + } + clear() { + this.store.clear(); + } +}; + +// packages/ag-charts-core/src/utils/numbers.ts +function clamp(min, value, max) { + return Math.min(max, Math.max(min, value)); +} +function inRange(value, range4, epsilon = 1e-10) { + return value >= range4[0] - epsilon && value <= range4[1] + epsilon; +} +function isNumberEqual(a, b, epsilon = 1e-10) { + return a === b || Math.abs(a - b) < epsilon; +} +function isNegative(value) { + return Math.sign(value) === -1 || Object.is(value, -0); +} +function isInteger(value) { + return value % 1 === 0; +} +function roundTo(value, decimals = 2) { + const base = 10 ** decimals; + return Math.round(value * base) / base; +} +function modulus(n, m) { + return Math.floor(n % m + (n < 0 ? Math.abs(m) : 0)); +} +function countFractionDigits(value) { + if (Math.floor(value) === value) { + return 0; + } + let valueString = String(value); + let exponent = 0; + if (value < 1e-6 || value >= 1e21) { + let exponentString; + [valueString, exponentString] = valueString.split("e"); + if (exponentString != null) { + exponent = Number(exponentString); + } + } + const decimalPlaces2 = valueString.split(".")[1]?.length ?? 0; + return Math.max(decimalPlaces2 - exponent, 0); +} + +// packages/ag-charts-core/src/utils/dom/globalsProxy.ts +var verifiedGlobals = {}; +if (typeof globalThis.window !== "undefined") { + verifiedGlobals.window = globalThis.window; +} +if (typeof document !== "undefined") { + verifiedGlobals.document = document; +} else if (typeof globalThis.global !== "undefined") { + verifiedGlobals.document = globalThis.document; +} +function getDocument(propertyName) { + return propertyName ? verifiedGlobals.document?.[propertyName] : verifiedGlobals.document; +} +function getWindow(propertyName) { + return propertyName ? verifiedGlobals.window?.[propertyName] : verifiedGlobals.window; +} +function setDocument(document2) { + verifiedGlobals.document = document2; +} +function setWindow(window) { + verifiedGlobals.window = window; +} + +// packages/ag-charts-core/src/utils/dom/domElements.ts +function createElement(tagName, className, style2) { + const element2 = getDocument().createElement(tagName); + if (typeof className === "object") { + style2 = className; + className = void 0; + } + if (className) { + for (const name of className.split(" ")) { + element2.classList.add(name); + } + } + if (style2) { + Object.assign(element2.style, style2); + } + return element2; +} +function createSvgElement(elementName) { + return getDocument().createElementNS("http://www.w3.org/2000/svg", elementName); +} + +// packages/ag-charts-core/src/utils/dom/domDownload.ts +function downloadUrl(dataUrl, fileName) { + const body = getDocument("body"); + const element2 = createElement("a", { display: "none" }); + element2.href = dataUrl; + element2.download = fileName; + body.appendChild(element2); + element2.click(); + setTimeout(() => element2.remove()); +} + +// packages/ag-charts-core/src/utils/dom/domEvents.ts +function attachListener(element2, eventName, handler, options) { + element2.addEventListener(eventName, handler, options); + return () => element2.removeEventListener(eventName, handler, options); +} + +// packages/ag-charts-core/src/utils/dom/domUtils.ts +var style; +function parseColor(color2) { + if (style == null) { + const OptionConstructor = getWindow("Option"); + style = new OptionConstructor().style; + } + style.color = color2; + const result = style.color || null; + style.color = ""; + return result; +} + +// packages/ag-charts-core/src/utils/typeGuards.ts +function isDefined(val) { + return val != null; +} +function isArray(value) { + return Array.isArray(value); +} +function isBoolean(value) { + return typeof value === "boolean"; +} +function isDate(value) { + return value instanceof Date; +} +function isValidDate(value) { + return isDate(value) && !Number.isNaN(Number(value)); +} +function isRegExp(value) { + return value instanceof RegExp; +} +function isFunction(value) { + return typeof value === "function"; +} +function isObject(value) { + return typeof value === "object" && value !== null && !isArray(value); +} +function isObjectLike(value) { + return isArray(value) || isPlainObject(value); +} +function isPlainObject(value) { + return typeof value === "object" && value !== null && value.constructor?.name === "Object"; +} +function isEmptyObject(value) { + if (typeof value !== "object" || value === null) + return false; + for (const _ in value) { + return false; + } + return true; +} +function isString(value) { + return typeof value === "string"; +} +function isNumber(value) { + return typeof value === "number"; +} +function isFiniteNumber(value) { + return Number.isFinite(value); +} +function isHtmlElement(value) { + return typeof globalThis.window !== "undefined" && value instanceof HTMLElement; +} +function isSymbol(value) { + return typeof value === "symbol"; +} +function isColor(value) { + return isString(value) && (value === "none" || parseColor(value) != null); +} +function isKeyOf(value, container) { + return value in container; +} + +// packages/ag-charts-core/src/modules/format/numberFormat.ts +var formatRegEx = /^(?:(.)?([<>=^]))?([+\-( ])?([$€£¥₣₹#])?(0)?(\d+)?(,)?(?:\.(\d+))?(~)?([%a-z])?$/i; +var surroundedRegEx = /^((?:[^#]|#[^{])*)#{([^}]+)}(.*)$/; +function isValidNumberFormat(value) { + if (!isString(value)) + return false; + const match = surroundedRegEx.exec(value); + return formatRegEx.test(match ? match[2] : value); +} +function parseNumberFormat(format) { + let prefix; + let suffix; + const surrounded = surroundedRegEx.exec(format); + if (surrounded) { + [, prefix, format, suffix] = surrounded; + } + const match = formatRegEx.exec(format); + if (!match) { + logger_exports.warnOnce(`The number formatter is invalid: ${format}`); + return; + } + const [, fill, align2, sign, symbol, zero, width2, comma, precision, trim, type] = match; + return { + fill, + align: align2, + sign, + symbol, + zero, + width: Number.parseInt(width2), + comma, + precision: Number.parseInt(precision), + trim: Boolean(trim), + type, + prefix, + suffix + }; +} +function createNumberFormatter(format) { + const options = typeof format === "string" ? parseNumberFormat(format) : format; + if (options == null) + return; + const { fill, align: align2, sign = "-", symbol, zero, width: width2, comma, type, prefix = "", suffix = "", precision } = options; + let { trim } = options; + const precisionIsNaN = precision == null || Number.isNaN(precision); + let formatBody; + if (!type) { + formatBody = decimalTypes["g"]; + trim = true; + } else if (type in decimalTypes && type in integerTypes) { + formatBody = precisionIsNaN ? integerTypes[type] : decimalTypes[type]; + } else if (type in decimalTypes) { + formatBody = decimalTypes[type]; + } else if (type in integerTypes) { + formatBody = integerTypes[type]; + } else { + throw new Error(`The number formatter type is invalid: ${type}`); + } + const defaultFormatterPrecision = type ? 6 : 12; + let formatterPrecision; + if (!precisionIsNaN) { + formatterPrecision = precision; + } + return (n, fractionDigits) => { + let result = formatBody(n, formatterPrecision ?? fractionDigits ?? defaultFormatterPrecision); + if (trim) { + result = removeTrailingZeros(result); + } + if (comma) { + result = insertSeparator(result, comma); + } + result = addSign(n, result, sign); + if (symbol && symbol !== "#") { + result = `${symbol}${result}`; + } + if (symbol === "#" && type === "x") { + result = `0x${result}`; + } + if (type === "s") { + result = `${result}${getSIPrefix(n)}`; + } + if (type === "%" || type === "p") { + result = `${result}%`; + } + if (width2 != null && !Number.isNaN(width2)) { + result = addPadding(result, width2, fill ?? zero, align2); + } + result = `${prefix}${result}${suffix}`; + return result; + }; +} +var integerTypes = { + b: (n) => absFloor(n).toString(2), + c: (n) => String.fromCodePoint(n), + d: (n) => Math.round(Math.abs(n)).toFixed(0), + o: (n) => absFloor(n).toString(8), + x: (n) => absFloor(n).toString(16), + X: (n) => integerTypes.x(n).toUpperCase(), + n: (n) => integerTypes.d(n), + "%": (n) => `${absFloor(n * 100).toFixed(0)}` +}; +var decimalTypes = { + e: (n, f) => Math.abs(n).toExponential(f), + E: (n, f) => decimalTypes.e(n, f).toUpperCase(), + f: (n, f) => Math.abs(n).toFixed(f), + F: (n, f) => decimalTypes.f(n, f).toUpperCase(), + g: (n, f) => { + if (n === 0) { + return "0"; + } + const a = Math.abs(n); + const p = Math.floor(Math.log10(a)); + if (p >= -4 && p < f) { + return a.toFixed(f - 1 - p); + } + return a.toExponential(f - 1); + }, + G: (n, f) => decimalTypes.g(n, f).toUpperCase(), + n: (n, f) => decimalTypes.g(n, f), + p: (n, f) => decimalTypes.r(n * 100, f), + r: (n, f) => { + if (n === 0) { + return "0"; + } + const a = Math.abs(n); + const p = Math.floor(Math.log10(a)); + const q = p - (f - 1); + if (q <= 0) { + return a.toFixed(-q); + } + const x = 10 ** q; + return (Math.round(a / x) * x).toFixed(); + }, + s: (n, f) => { + const p = getSIPrefixPower(n); + return decimalTypes.r(n / 10 ** p, f); + }, + "%": (n, f) => decimalTypes.f(n * 100, f) +}; +var minSIPrefix = -24; +var maxSIPrefix = 24; +var siPrefixes = { + [minSIPrefix]: "y", + [-21]: "z", + [-18]: "a", + [-15]: "f", + [-12]: "p", + [-9]: "n", + [-6]: "\xB5", + [-3]: "m", + [0]: "", + [3]: "k", + [6]: "M", + [9]: "G", + [12]: "T", + [15]: "P", + [18]: "E", + [21]: "Z", + [maxSIPrefix]: "Y" +}; +var minusSign = "\u2212"; +function absFloor(n) { + return Math.floor(Math.abs(n)); +} +function removeTrailingZeros(numString) { + if (!numString.endsWith("0") || !numString.includes(".")) + return numString; + let endIndex = numString.length - 1; + while (endIndex > 0) { + if (numString[endIndex] == "0") { + endIndex -= 1; + } else if (numString[endIndex] == ".") { + endIndex -= 1; + break; + } else { + break; + } + } + return numString.substring(0, endIndex + 1); +} +function insertSeparator(numString, separator) { + let dotIndex = numString.indexOf("."); + if (dotIndex < 0) { + dotIndex = numString.length; + } + const integerChars = numString.substring(0, dotIndex).split(""); + const fractionalPart = numString.substring(dotIndex); + for (let i = integerChars.length - 3; i > 0; i -= 3) { + integerChars.splice(i, 0, separator); + } + return `${integerChars.join("")}${fractionalPart}`; +} +function getSIPrefix(n) { + return siPrefixes[getSIPrefixPower(n)]; +} +function getSIPrefixPower(n) { + return clamp(minSIPrefix, n ? Math.floor(Math.log10(Math.abs(n)) / 3) * 3 : 0, maxSIPrefix); +} +function addSign(num, numString, signType = "") { + if (signType === "(") { + return num >= 0 ? numString : `(${numString})`; + } + const plusSign = signType === "+" ? "+" : ""; + return `${num >= 0 ? plusSign : minusSign}${numString}`; +} +function addPadding(numString, width2, fill = " ", align2 = ">") { + let result = numString; + if (align2 === ">" || !align2) { + result = result.padStart(width2, fill); + } else if (align2 === "<") { + result = result.padEnd(width2, fill); + } else if (align2 === "^") { + const padWidth = Math.max(0, width2 - result.length); + const padLeft = Math.ceil(padWidth / 2); + const padRight = Math.floor(padWidth / 2); + result = result.padStart(padLeft + result.length, fill); + result = result.padEnd(padRight + result.length, fill); + } + return result; +} + +// packages/ag-charts-core/src/modules/format/timeFormat.ts +var CONSTANTS = { + periods: ["AM", "PM"], + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + months: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ], + shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] +}; +function dayOfYear(date2, startOfYear = new Date(date2.getFullYear(), 0, 1)) { + const startOffset = date2.getTimezoneOffset() - startOfYear.getTimezoneOffset(); + const timeDiff = date2.getTime() - startOfYear.getTime() + startOffset * 6e4; + const timeOneDay = 36e5 * 24; + return Math.floor(timeDiff / timeOneDay); +} +function weekOfYear(date2, startDay) { + const startOfYear = new Date(date2.getFullYear(), 0, 1); + const startOfYearDay = startOfYear.getDay(); + const firstWeekStartOffset = (startDay - startOfYearDay + 7) % 7; + const startOffset = new Date(date2.getFullYear(), 0, firstWeekStartOffset + 1); + if (startOffset <= date2) { + return Math.floor(dayOfYear(date2, startOffset) / 7) + 1; + } + return 0; +} +var SUNDAY = 0; +var MONDAY = 1; +var THURSDAY = 4; +function isoWeekOfYear(date2, year = date2.getFullYear()) { + const firstOfYear = new Date(year, 0, 1); + const firstOfYearDay = firstOfYear.getDay(); + const firstThursdayOffset = (THURSDAY - firstOfYearDay + 7) % 7; + const startOffset = new Date(year, 0, firstThursdayOffset - (THURSDAY - MONDAY) + 1); + if (startOffset <= date2) { + return Math.floor(dayOfYear(date2, startOffset) / 7) + 1; + } + return isoWeekOfYear(date2, year - 1); +} +function timezone(date2) { + const offset = date2.getTimezoneOffset(); + const unsignedOffset = Math.abs(offset); + const sign = offset > 0 ? "-" : "+"; + return `${sign}${pad(Math.floor(unsignedOffset / 60), 2, "0")}${pad(Math.floor(unsignedOffset % 60), 2, "0")}`; +} +var FORMATTERS = { + a: (d) => CONSTANTS.shortDays[d.getDay()], + A: (d) => CONSTANTS.days[d.getDay()], + b: (d) => CONSTANTS.shortMonths[d.getMonth()], + B: (d) => CONSTANTS.months[d.getMonth()], + c: "%x, %X", + d: (d, p) => pad(d.getDate(), 2, p ?? "0"), + e: "%_d", + f: (d, p) => pad(d.getMilliseconds() * 1e3, 6, p ?? "0"), + H: (d, p) => pad(d.getHours(), 2, p ?? "0"), + I: (d, p) => { + const hours = d.getHours() % 12; + return hours === 0 ? "12" : pad(hours, 2, p ?? "0"); + }, + j: (d, p) => pad(dayOfYear(d) + 1, 3, p ?? "0"), + m: (d, p) => pad(d.getMonth() + 1, 2, p ?? "0"), + M: (d, p) => pad(d.getMinutes(), 2, p ?? "0"), + L: (d, p) => pad(d.getMilliseconds(), 3, p ?? "0"), + p: (d) => d.getHours() < 12 ? "AM" : "PM", + Q: (d) => String(d.getTime()), + s: (d) => String(Math.floor(d.getTime() / 1e3)), + S: (d, p) => pad(d.getSeconds(), 2, p ?? "0"), + u: (d) => { + let day = d.getDay(); + if (day < 1) + day += 7; + return String(day % 7); + }, + U: (d, p) => pad(weekOfYear(d, SUNDAY), 2, p ?? "0"), + V: (d, p) => pad(isoWeekOfYear(d), 2, p ?? "0"), + w: (d, p) => pad(d.getDay(), 2, p ?? "0"), + W: (d, p) => pad(weekOfYear(d, MONDAY), 2, p ?? "0"), + x: "%-m/%-d/%Y", + X: "%-I:%M:%S %p", + y: (d, p) => pad(d.getFullYear() % 100, 2, p ?? "0"), + Y: (d, p) => pad(d.getFullYear(), 4, p ?? "0"), + Z: (d) => timezone(d), + "%": () => "%" +}; +var PADS = { + _: " ", + "0": "0", + "-": "" +}; +function pad(value, size, padChar) { + const output = String(Math.floor(value)); + if (output.length >= size) { + return output; + } + return `${padChar.repeat(size - output.length)}${output}`; +} +function buildDateFormatter(formatString) { + const formatParts = []; + while (formatString.length > 0) { + let nextEscapeIdx = formatString.indexOf("%"); + if (nextEscapeIdx !== 0) { + const literalPart = nextEscapeIdx > 0 ? formatString.substring(0, nextEscapeIdx) : formatString; + formatParts.push(literalPart); + } + if (nextEscapeIdx < 0) + break; + const maybePadSpecifier = formatString[nextEscapeIdx + 1]; + const maybePad = PADS[maybePadSpecifier]; + if (maybePad != null) { + nextEscapeIdx++; + } + const maybeFormatterSpecifier = formatString[nextEscapeIdx + 1]; + const maybeFormatter = FORMATTERS[maybeFormatterSpecifier]; + if (typeof maybeFormatter === "function") { + formatParts.push([maybeFormatter, maybePad]); + } else if (typeof maybeFormatter === "string") { + const formatter2 = buildDateFormatter(maybeFormatter); + formatParts.push([formatter2, maybePad]); + } else { + formatParts.push(`${maybePad ?? ""}${maybeFormatterSpecifier}`); + } + formatString = formatString.substring(nextEscapeIdx + 2); + } + return (dateTime) => { + const dateTimeAsDate = typeof dateTime === "number" ? new Date(dateTime) : dateTime; + return formatParts.map((c) => typeof c === "string" ? c : c[0](dateTimeAsDate, c[1])).join(""); + }; +} + +// packages/ag-charts-core/src/utils/functions.ts +function debounce(callback2, waitMs = 0, options) { + const { leading = false, trailing = true, maxWait = Infinity } = options ?? {}; + let timerId; + let startTime; + if (maxWait < waitMs) { + throw new Error("Value of maxWait cannot be lower than waitMs."); + } + function debounceCallback(...args) { + if (leading && !startTime) { + startTime = Date.now(); + timerId = setTimeout(() => startTime = null, waitMs); + callback2(...args); + return; + } + let adjustedWaitMs = waitMs; + if (maxWait !== Infinity && startTime) { + const elapsedTime = Date.now() - startTime; + if (waitMs > maxWait - elapsedTime) { + adjustedWaitMs = maxWait - elapsedTime; + } + } + clearTimeout(timerId); + startTime ?? (startTime = Date.now()); + timerId = setTimeout(() => { + startTime = null; + if (trailing) { + callback2(...args); + } + }, adjustedWaitMs); + } + return Object.assign(debounceCallback, { + cancel() { + clearTimeout(timerId); + startTime = null; + } + }); +} +function throttle(callback2, waitMs, options) { + const { leading = true, trailing = true } = options ?? {}; + let timerId; + let lastArgs; + let shouldWait = false; + function timeoutHandler() { + if (trailing && lastArgs) { + timerId = setTimeout(timeoutHandler, waitMs); + callback2(...lastArgs); + } else { + shouldWait = false; + } + lastArgs = null; + } + function throttleCallback(...args) { + if (shouldWait) { + lastArgs = args; + } else { + shouldWait = true; + timerId = setTimeout(timeoutHandler, waitMs); + if (leading) { + callback2(...args); + } else { + lastArgs = args; + } + } + } + return Object.assign(throttleCallback, { + cancel() { + clearTimeout(timerId); + shouldWait = false; + lastArgs = null; + } + }); +} +function safeCall(callback2, args, errorPath = "") { + try { + return callback2(...args); + } catch (error2) { + const postfix = errorPath ? ` \`${errorPath}\`` : ""; + warnOnce(`Uncaught exception in user callback${postfix}`, error2); + } +} + +// packages/ag-charts-core/src/utils/strings.ts +function joinFormatted(values, conjunction = "and", format = String, maxItems = Infinity) { + if (values.length === 0) { + return ""; + } else if (values.length === 1) { + return format(values[0]); + } + values = values.map(format); + const lastValue = values.pop(); + if (values.length >= maxItems) { + const remainingCount = values.length - (maxItems - 1); + return `${values.slice(0, maxItems - 1).join(", ")}, and ${remainingCount} more ${conjunction} ${lastValue}`; + } + return `${values.join(", ")} ${conjunction} ${lastValue}`; +} +function stringifyValue(value, maxLength = Infinity) { + if (typeof value === "number") { + if (Number.isNaN(value)) { + return "NaN"; + } else if (value === Infinity) { + return "Infinity"; + } else if (value === -Infinity) { + return "-Infinity"; + } + } + const strValue = JSON.stringify(value) ?? typeof value; + if (strValue.length > maxLength) { + return `${strValue.slice(0, maxLength)}... (+${strValue.length - maxLength} characters)`; + } + return strValue; +} +function countLines(text2) { + let count = 1; + for (let i = 0; i < text2.length; i++) { + if (text2.codePointAt(i) === 10) { + count++; + } + } + return count; +} +function levenshteinDistance(a, b) { + if (a === b) + return 0; + const [shorter, longer] = a.length < b.length ? [a, b] : [b, a]; + const m = shorter.length; + const n = longer.length; + let prevRow = new Array(m + 1).fill(0).map((_, i) => i); + let currRow = new Array(m + 1); + for (let i = 1; i <= n; i++) { + currRow[0] = i; + for (let j = 1; j <= m; j++) { + const cost = longer[i - 1] === shorter[j - 1] ? 0 : 1; + currRow[j] = Math.min( + prevRow[j] + 1, + // Deletion + currRow[j - 1] + 1, + // Insertion + prevRow[j - 1] + cost + // Substitution + ); + } + [prevRow, currRow] = [currRow, prevRow]; + } + return prevRow[m]; +} +function kebabCase(a) { + return a.replaceAll(KEBAB_CASE_REGEX, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase()); +} +var KEBAB_CASE_REGEX = /[A-Z]+(?![a-z])|[A-Z]/g; +function toPlainText(text2, fallback = "") { + if (text2 == null) { + return fallback; + } else if (isArray(text2)) { + return text2.map((segment) => segment.text).join(""); + } else if (isString(text2)) { + return text2; + } else { + return String(text2); + } +} + +// packages/ag-charts-core/src/utils/validation.ts +var descriptionSymbol = Symbol("description"); +var requiredSymbol = Symbol("required"); +var markedSymbol = Symbol("marked"); +var undocumentedSymbol = Symbol("undocumented"); +var unionSymbol = Symbol("union"); +var similarOptionsMap = [ + ["placement", "position"], + ["padding", "spacing", "gap"], + ["color", "fill", "stroke"], + ["whisker", "wick"], + ["nodeClick", "seriesNodeClick"], + ["nodeDoubleClick", "seriesNodeDoubleClick"], + ["src", "url"] +].reduce((map, words) => { + for (const word of words) { + map.set(word.toLowerCase(), new Set(words.filter((w) => w !== word))); + } + return map; +}, /* @__PURE__ */ new Map()); +function extendPath(path, key) { + if (isFiniteNumber(key)) { + return `${path}[${key}]`; + } + return path ? `${path}.${key}` : key; +} +var ValidationError = class { + constructor(type, description, value, path, key) { + this.type = type; + this.description = description; + this.value = value; + this.path = path; + this.key = key; + } + setUnionType(unionType, path) { + if (this.path.startsWith(path)) { + const suffix = this.path.slice(path.length); + this.altPath = `${path}[type=${unionType}]${suffix}`; + } + } + getPrefix() { + const { altPath: path = this.path, key } = this; + if (!path && !key) + return "Value"; + return `Option \`${key ? extendPath(path, key) : path}\``; + } + toString() { + const { description = "unknown", type, value } = this; + if (type === "required" /* Required */ && value == null) { + return `${this.getPrefix()} is required and has not been provided; expecting ${description}, ignoring.`; + } + return `${this.getPrefix()} cannot be set to \`${stringifyValue(value, 50)}\`; expecting ${description}, ignoring.`; + } +}; +var UnknownError = class extends ValidationError { + constructor(suggestions, value, path, key) { + super("unknown" /* Unknown */, void 0, value, path, key); + this.suggestions = suggestions; + this.key = key; + } + getPrefix() { + return `Unknown option \`${extendPath(this.altPath ?? this.path, this.key)}\``; + } + getPostfix() { + const suggestions = joinFormatted(findSuggestions(this.key, this.suggestions), "or", (val) => `\`${val}\``); + return suggestions ? `; Did you mean ${suggestions}? Ignoring.` : ", ignoring."; + } + toString() { + return `${this.getPrefix()}${this.getPostfix()}`; + } +}; +function validate(options, optionsDefs2, path = "") { + if (!isObject(options)) { + return { cleared: null, invalid: [new ValidationError("required" /* Required */, "an object", options, path)] }; + } + const cleared = {}; + const invalid = []; + const optionsKeys = new Set(Object.keys(options)); + const unusedKeys = []; + if (unionSymbol in optionsDefs2) { + const validTypes = Object.keys(optionsDefs2); + const defaultType = optionsDefs2[unionSymbol]; + if (options.type != null && validTypes.includes(options.type) || options.type == null && defaultType != null) { + const { type = defaultType, ...rest } = options; + const nestedResult = validate(rest, optionsDefs2[type], path); + Object.assign(cleared, { type }, nestedResult.cleared); + for (const error2 of nestedResult.invalid) { + error2.setUnionType(type, path); + } + invalid.push(...nestedResult.invalid); + } else { + const keywords = joinFormatted(validTypes, "or", (val) => `'${val}'`); + invalid.push( + new ValidationError("required" /* Required */, `a keyword such as ${keywords}`, options.type, path, "type") + ); + } + return { cleared, invalid }; + } + for (const key of Object.keys(optionsDefs2)) { + const validatorOrDefs = optionsDefs2[key]; + const required3 = validatorOrDefs[requiredSymbol]; + const value = options[key]; + optionsKeys.delete(key); + if (value === void 0) { + if (!validatorOrDefs[undocumentedSymbol]) { + unusedKeys.push(key); + } + if (!required3) + continue; + } + const keyPath = extendPath(path, key); + if (isFunction(validatorOrDefs)) { + const context = { options, path: keyPath }; + const validatorResult = validatorOrDefs(value, context); + const objectResult = typeof validatorResult === "object"; + if (objectResult) { + invalid.push(...validatorResult.invalid); + if (validatorResult.valid) { + cleared[key] = validatorResult.cleared; + continue; + } else if (hasRequiredInPath(validatorResult.invalid, keyPath)) { + continue; + } + } else if (validatorResult) { + cleared[key] = value; + continue; + } + invalid.push( + new ValidationError( + required3 ? "required" /* Required */ : "invalid" /* Invalid */, + validatorOrDefs[descriptionSymbol], + value, + path, + key + ) + ); + } else { + const nestedResult = validate(value, validatorOrDefs, keyPath); + if (nestedResult.cleared != null) { + cleared[key] = nestedResult.cleared; + } + invalid.push(...nestedResult.invalid); + } + } + for (const key of optionsKeys) { + const value = options[key]; + if (value === void 0) + continue; + invalid.push(new UnknownError(unusedKeys, value, path, key)); + } + return { cleared, invalid }; +} +function findSuggestions(value, suggestions, maxDistance = 2) { + const result = []; + const lowerCaseValue = value.toLowerCase(); + const similarValues = similarOptionsMap.get(lowerCaseValue); + for (const key of suggestions) { + const lowerCaseKey = key.toLowerCase(); + if (similarValues?.has(key) || lowerCaseKey.includes(lowerCaseValue) || levenshteinDistance(lowerCaseValue, lowerCaseKey) <= maxDistance) { + result.push(key); + } + } + return result; +} +function attachDescription(validatorOrDefs, description) { + if (isFunction(validatorOrDefs)) { + let clonedValidator2 = function(value, context) { + return validatorOrDefs(value, context); + }; + var clonedValidator = clonedValidator2; + clonedValidator2[descriptionSymbol] = description; + return clonedValidator2; + } else { + return { ...validatorOrDefs, [descriptionSymbol]: description }; + } +} +function required(validatorOrDefs) { + return Object.assign( + isFunction(validatorOrDefs) ? (value, context) => validatorOrDefs(value, context) : optionsDefs(validatorOrDefs), + { [requiredSymbol]: true, [descriptionSymbol]: validatorOrDefs[descriptionSymbol] } + ); +} +function undocumented(validatorOrDefs) { + return Object.assign( + isFunction(validatorOrDefs) ? (value, context) => validatorOrDefs(value, context) : optionsDefs(validatorOrDefs), + { [undocumentedSymbol]: true, [descriptionSymbol]: validatorOrDefs[descriptionSymbol] } + ); +} +var optionsDefs = (defs, description = "an object", failAll = false) => attachDescription((value, context) => { + const result = validate(value, defs, context.path); + const valid = !hasRequiredInPath(result.invalid, context.path); + return { valid, cleared: valid || !failAll ? result.cleared : null, invalid: result.invalid }; +}, description); +var typeUnion = (defs, description, defaultType) => ({ + ...defs, + [descriptionSymbol]: description, + [unionSymbol]: defaultType +}); +var and = (...validators) => attachDescription( + (value, context) => { + const invalid = []; + for (const validator of validators) { + const result = validator(value, context); + if (typeof result === "object") { + invalid.push(...result.invalid); + if (!result.valid) { + return { valid: false, cleared: value, invalid }; + } + value = result.cleared; + } else if (!result) { + return false; + } + } + return { valid: true, cleared: value, invalid }; + }, + validators.filter((v) => !v[undocumentedSymbol]).map((v) => v[descriptionSymbol]).filter(Boolean).join(" and ") +); +var or = (...validators) => attachDescription( + (value, context) => { + for (const validator of validators) { + const result = validator(value, context); + if (typeof result === "object" ? result.valid : result) { + return result; + } + } + return false; + }, + validators.filter((v) => !v[undocumentedSymbol]).map((v) => v[descriptionSymbol]).filter(Boolean).join(" or ") +); +var isComparable = (value) => isFiniteNumber(value) || isValidDate(value); +var isValidDateValue = (value) => isDate(value) || (isFiniteNumber(value) || isString(value)) && isValidDate(new Date(value)); +var array = attachDescription(isArray, "an array"); +var boolean = attachDescription(isBoolean, "a boolean"); +var callback = attachDescription(isFunction, "a function"); +var color = attachDescription(isColor, "a color string"); +var date = attachDescription(isValidDateValue, "a date"); +var defined = attachDescription(isDefined, "a defined value"); +var number = attachDescription(isFiniteNumber, "a number"); +var object = attachDescription(isObject, "an object"); +var string = attachDescription(isString, "a string"); +var htmlElement = attachDescription( + (value) => typeof HTMLElement === "undefined" || value instanceof HTMLElement, + "an html element" +); +var arrayLength = (minLength, maxLength = Infinity) => { + let message; + if (maxLength === Infinity) { + message = `an array of at least ${minLength} items`; + } else if (minLength === maxLength) { + message = `an array of exactly ${minLength} items`; + } else if (minLength === 0) { + message = `an array of no more than ${maxLength} items`; + } else { + message = `an array of at least ${minLength} and no more than ${maxLength} items`; + } + return attachDescription( + (value) => isArray(value) && value.length >= minLength && value.length <= maxLength, + message + ); +}; +var stringLength = (minLength, maxLength = Infinity) => { + let message; + if (maxLength === Infinity) { + message = `a string of at least ${minLength} characters`; + } else if (minLength === maxLength) { + message = `an string of exactly ${minLength} characters`; + } else if (minLength === 0) { + message = `an string of no more than ${maxLength} characters`; + } else { + message = `an string of at least ${minLength} and no more than ${maxLength} characters`; + } + return attachDescription( + (value) => isString(value) && value.length >= minLength && value.length <= maxLength, + message + ); +}; +var numberMin = (min, inclusive = true) => attachDescription( + (value) => isFiniteNumber(value) && (value > min || inclusive && value === min), + `a number greater than ${inclusive ? "or equal to " : ""}${min}` +); +var numberRange = (min, max) => attachDescription( + (value) => isFiniteNumber(value) && value >= min && value <= max, + `a number between ${min} and ${max} inclusive` +); +var positiveNumber = numberMin(0); +var positiveNumberNonZero = numberMin(0, false); +var ratio = numberRange(0, 1); +var lessThan = (otherField) => attachDescription( + (value, { options }) => !isComparable(value) || !isComparable(options[otherField]) || value < options[otherField], + `the value to be less than \`${otherField}\`` +); +var lessThanOrEqual = (otherField) => attachDescription( + (value, { options }) => !isComparable(value) || !isComparable(options[otherField]) || value <= options[otherField], + `the value to be less than or equal to \`${otherField}\`` +); +var greaterThan = (otherField) => attachDescription( + (value, { options }) => !isComparable(value) || !isComparable(options[otherField]) || value > options[otherField], + `the value to be greater than \`${otherField}\`` +); +function union(...allowed) { + if (isObject(allowed[0])) { + allowed = Object.values(allowed[0]); + } + const keywords = joinFormatted(allowed, "or", (value) => `'${value}'`); + return attachDescription((value) => allowed.includes(value), `a keyword such as ${keywords}`); +} +var constant = (allowed) => attachDescription((value) => allowed === value, `the value ${JSON.stringify(allowed)}`); +var arrayOf = (validator, description, strict = true) => attachDescription( + (value, context) => { + if (!isArray(value)) + return false; + let valid = strict; + const cleared = []; + const invalid = []; + const setValid = (result) => valid = strict ? valid && result : valid || result; + if (value.length === 0) { + return { valid: true, cleared, invalid }; + } + for (let i = 0; i < value.length; i++) { + const options = value[i]; + const result = validator(options, { options, path: `${context.path}[${i}]` }); + if (typeof result === "object") { + valid = setValid(result.valid); + invalid.push(...result.invalid); + if (result.cleared != null) { + cleared.push(result.cleared); + } + } else { + valid = setValid(result); + if (result) { + cleared.push(options); + } + } + } + return { valid, cleared: valid || !strict ? cleared : null, invalid }; + }, + description ?? `${validator[descriptionSymbol]} array` +); +var arrayOfDefs = (defs, description = "an object array") => attachDescription((value, context) => { + if (!isArray(value)) + return false; + const cleared = []; + const invalid = []; + for (let i = 0; i < value.length; i++) { + const indexPath = `${context.path}[${i}]`; + const result = validate(value[i], defs, indexPath); + if (!hasRequiredInPath(result.invalid, indexPath)) { + cleared.push(result.cleared); + } + invalid.push(...result.invalid); + } + return { valid: true, cleared, invalid }; +}, description); +var callbackOf = (validator, description) => attachDescription((value, context) => { + if (!isFunction(value)) + return false; + if (markedSymbol in value) + return true; + const cbWithValidation = Object.assign( + (...args) => { + const result = safeCall(value, args); + if (result == null) + return; + const validatorResult = validator(result, { options: result, path: "" }); + if (typeof validatorResult === "object") { + for (const error2 of validatorResult.invalid) { + callbackWarnInvalid(context, description ?? validator[descriptionSymbol])(error2); + } + if (validatorResult.valid) { + return validatorResult.cleared; + } + } else if (validatorResult) { + return result; + } else { + warnOnce( + `Callback \`${context.path}\` returned an invalid value \`${stringifyValue(result, 50)}\`; expecting ${description ?? validator[descriptionSymbol]}, ignoring.` + ); + } + }, + { [markedSymbol]: true } + ); + return { valid: true, cleared: cbWithValidation, invalid: [] }; +}, "a function"); +var callbackDefs = (defs, description = "an object") => attachDescription((value, context) => { + if (!isFunction(value)) + return false; + if (markedSymbol in value) + return true; + const cbWithValidation = Object.assign( + (...args) => { + const result = safeCall(value, args, context.path); + if (result == null) + return; + const validatorResult = validate(result, defs); + for (const error2 of validatorResult.invalid) { + callbackWarnInvalid(context, description)(error2); + } + return validatorResult.cleared; + }, + { [markedSymbol]: true } + ); + return { valid: true, cleared: cbWithValidation, invalid: [] }; +}, "a function"); +function hasRequiredInPath(errors, rootPath) { + return errors.some((error2) => error2.type === "required" /* Required */ && error2.path === rootPath); +} +function callbackWarnInvalid(context, description) { + return (error2) => { + if (error2 instanceof UnknownError) { + return warnOnce( + `Callback \`${context.path}\` returned an unknown property \`${extendPath(error2.path, error2.key)}\`${error2.getPostfix()}` + ); + } + const errorValue = stringifyValue(error2.value, 50); + warnOnce( + error2.key ? `Callback \`${context.path}\` returned an invalid property \`${extendPath(error2.path, error2.key)}\`: \`${errorValue}\`; expecting ${error2.description}, ignoring.` : `Callback \`${context.path}\` returned an invalid value \`${errorValue}\`; expecting ${description ?? error2.description}, ignoring.` + ); + }; +} + +// packages/ag-charts-core/src/options/commonOptionsDefs.ts +var themeOperator = (value) => { + if (!isObject(value)) + return false; + const keys = Object.keys(value); + return keys.length === 1 && keys[0].startsWith("$"); +}; +var colorStop = optionsDefs({ color, stop: ratio }, ""); +var colorStopsOrderValidator = attachDescription((value) => { + let lastStop = -Infinity; + for (const item of value) { + if (item?.stop != null) { + if (item.stop < lastStop) { + return false; + } + lastStop = item.stop; + } + } + return true; +}, "color stops to be defined in ascending order"); +var gradientColorStops = and(arrayLength(2), arrayOf(colorStop), colorStopsOrderValidator); +var gradientBounds = union("axis", "item", "series"); +var gradientStrict = optionsDefs( + { + type: required(constant("gradient")), + colorStops: required(gradientColorStops), + rotation: number, + // @ts-expect-error undocumented options + gradient: undocumented(union("linear", "radial", "conic")), + bounds: undocumented(gradientBounds), + reverse: undocumented(boolean), + colorSpace: undocumented(union("rgb", "oklch")) + }, + "a gradient object with color stops" +); +var strokeOptionsDef = { + stroke: color, + strokeWidth: positiveNumber, + strokeOpacity: ratio +}; +var fillGradientDefaults = optionsDefs({ + type: required(constant("gradient")), + gradient: required(union("linear", "radial", "conic")), + bounds: required(gradientBounds), + colorStops: required(or(gradientColorStops, and(arrayLength(2), arrayOf(color)))), + rotation: required(number), + reverse: required(boolean), + colorSpace: required(union("rgb", "oklch")) +}); +var fillPatternDefaults = optionsDefs({ + type: required(constant("pattern")), + pattern: required( + union( + "vertical-lines", + "horizontal-lines", + "forward-slanted-lines", + "backward-slanted-lines", + "circles", + "squares", + "triangles", + "diamonds", + "stars", + "hearts", + "crosses" + ) + ), + path: stringLength(2), + width: required(positiveNumber), + height: required(positiveNumber), + fill: required(color), + fillOpacity: required(ratio), + backgroundFill: required(color), + backgroundFillOpacity: required(ratio), + padding: required(positiveNumber), + rotation: required(number), + scale: required(positiveNumber), + stroke: required(color), + strokeWidth: required(positiveNumber), + strokeOpacity: required(ratio) +}); +var fillImageDefaults = optionsDefs({ + type: required(constant("image")), + url: string, + width: positiveNumber, + height: positiveNumber, + rotation: required(number), + backgroundFill: required(color), + backgroundFillOpacity: ratio, + fit: required(union("stretch", "contain", "cover")), + repeat: required(union("repeat", "repeat-x", "repeat-y", "no-repeat")) +}); +var colorObject = typeUnion( + { + gradient: { + colorStops: gradientColorStops, + rotation: number, + // @ts-expect-error undocumented option + gradient: undocumented(union("linear", "radial", "conic")), + bounds: undocumented(gradientBounds), + reverse: undocumented(boolean), + colorSpace: undocumented(union("rgb", "oklch")) + }, + pattern: { + pattern: union( + "vertical-lines", + "horizontal-lines", + "forward-slanted-lines", + "backward-slanted-lines", + "circles", + "squares", + "triangles", + "diamonds", + "stars", + "hearts", + "crosses" + ), + path: stringLength(2), + width: positiveNumber, + height: positiveNumber, + rotation: number, + scale: positiveNumber, + fill: color, + fillOpacity: ratio, + backgroundFill: color, + backgroundFillOpacity: ratio, + ...strokeOptionsDef, + // @ts-expect-error undocumented option + padding: undocumented(positiveNumber) + }, + image: { + url: required(string), + backgroundFill: color, + backgroundFillOpacity: ratio, + width: positiveNumber, + height: positiveNumber, + fit: union("stretch", "contain", "cover", "none"), + repeat: union("repeat", "repeat-x", "repeat-y", "no-repeat"), + rotation: number + } + }, + "a color object" +); +var colorUnion = or(color, optionsDefs(colorObject, "a color object")); +var fillOptionsDef = { + fill: colorUnion, + fillOpacity: ratio +}; +fillOptionsDef.fillGradientDefaults = undocumented(fillGradientDefaults); +fillOptionsDef.fillPatternDefaults = undocumented(fillPatternDefaults); +fillOptionsDef.fillImageDefaults = undocumented(fillImageDefaults); +var lineDashOptionsDef = { + lineDash: arrayOf(positiveNumber), + lineDashOffset: number +}; +var barHighlightOptionsDef = { + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + opacity: ratio, + cornerRadius: positiveNumber +}; +var lineHighlightOptionsDef = { + ...strokeOptionsDef, + ...lineDashOptionsDef, + opacity: ratio +}; +var shapeHighlightOptionsDef = { + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + opacity: ratio +}; +function highlightOptionsDef(itemHighlightOptionsDef) { + return { + enabled: boolean, + range: union("tooltip", "node"), + highlightedItem: itemHighlightOptionsDef, + unhighlightedItem: itemHighlightOptionsDef + }; +} +function multiSeriesHighlightOptionsDef(itemHighlightOptionsDef, seriesHighlightOptionsDef) { + return { + enabled: boolean, + range: union("tooltip", "node"), + highlightedItem: itemHighlightOptionsDef, + unhighlightedItem: itemHighlightOptionsDef, + highlightedSeries: seriesHighlightOptionsDef, + unhighlightedSeries: seriesHighlightOptionsDef, + bringToFront: boolean + }; +} +var shapeSegmentOptions = { + start: defined, + stop: defined, + ...strokeOptionsDef, + ...fillOptionsDef, + ...lineDashOptionsDef +}; +var lineSegmentOptions = { + start: defined, + stop: defined, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var shapeSegmentation = optionsDefs( + { + enabled: boolean, + key: required(union("x", "y")), + segments: arrayOfDefs(shapeSegmentOptions, "path segments array") + }, + "a segmentation object", + true +); +var lineSegmentation = optionsDefs( + { + enabled: boolean, + key: required(union("x", "y")), + segments: arrayOfDefs(lineSegmentOptions, "path segments array") + }, + "a segmentation object", + true +); +var googleFont = optionsDefs({ googleFont: string }, "google font"); +var fontFamilyFull = or(string, themeOperator, googleFont, arrayOf(or(string, googleFont))); +var fontOptionsDef = { + color, + fontFamily: fontFamilyFull, + fontSize: positiveNumber, + fontStyle: union("normal", "italic", "oblique"), + fontWeight: or(positiveNumber, union("normal", "bold", "bolder", "lighter")) +}; +var paddingOptions = optionsDefs( + { top: number, right: number, bottom: number, left: number }, + "padding object" +); +var padding = or(number, paddingOptions); +var borderOptionsDef = { + enabled: boolean, + stroke: color, + strokeWidth: positiveNumber, + strokeOpacity: ratio +}; +var labelBoxOptionsDef = { + border: { ...borderOptionsDef }, + cornerRadius: number, + padding, + ...fillOptionsDef +}; + +// packages/ag-charts-core/src/utils/math/shapeUtils.ts +function getMaxInnerRectSize(rotationDeg, containerWidth, containerHeight = Infinity) { + const W = containerWidth; + const H = containerHeight; + const angle2 = rotationDeg % 180 * (Math.PI / 180); + const sin = Math.abs(Math.sin(angle2)); + const cos = Math.abs(Math.cos(angle2)); + if (sin === 0) + return { width: W, height: H }; + if (cos === 0) + return { width: H, height: W }; + if (!Number.isFinite(H)) { + const r = cos / sin; + const width2 = W / (cos + r * sin); + return { width: width2, height: r * width2 }; + } + const denominator = cos * cos - sin * sin; + if (denominator === 0) { + const side = Math.min(W, H) / Math.SQRT2; + return { width: side, height: side }; + } + return { + width: Math.abs((W * cos - H * sin) / denominator), + height: Math.abs((H * cos - W * sin) / denominator) + }; +} +function rotatePoint(x, y, angle2, originX = 0, originY = 0) { + const cos = Math.cos(angle2); + const sin = Math.sin(angle2); + const dx2 = x - originX; + const dy2 = y - originY; + return { + x: originX + dx2 * cos - dy2 * sin, + y: originY + dx2 * sin + dy2 * cos + }; +} + +// packages/ag-charts-core/src/utils/arrays.ts +function toArray(value) { + if (value === void 0) { + return []; + } + return Array.isArray(value) ? value : [value]; +} +function unique(array2) { + return Array.from(new Set(array2)); +} +function groupBy(array2, iteratee) { + return array2.reduce((result, item) => { + const groupKey = iteratee(item); + result[groupKey] ?? (result[groupKey] = []); + result[groupKey].push(item); + return result; + }, {}); +} +function arraysEqual(a, b) { + if (a == null || b == null || a.length !== b.length) { + return false; + } + for (let i = 0; i < a.length; i++) { + if (Array.isArray(a[i]) && Array.isArray(b[i])) { + if (!arraysEqual(a[i], b[i])) { + return false; + } + } else if (a[i] !== b[i]) { + return false; + } + } + return true; +} +function circularSliceArray(data, size, offset = 0) { + if (data.length === 0) { + return []; + } + const result = []; + for (let i = 0; i < size; i++) { + result.push(data.at((i + offset) % data.length)); + } + return result; +} +function sortBasedOnArray(baseArray, orderArray) { + const orderMap = /* @__PURE__ */ new Map(); + for (const [index, item] of orderArray.entries()) { + orderMap.set(item, index); + } + return baseArray.sort((a, b) => { + const indexA = orderMap.get(a) ?? Infinity; + const indexB = orderMap.get(b) ?? Infinity; + return indexA - indexB; + }); +} +function dropFirstWhile(array2, cond) { + let i = 0; + while (i < array2.length && cond(array2[i])) { + i += 1; + } + const deleteCount = i; + if (deleteCount !== 0) + array2.splice(0, deleteCount); +} +function dropLastWhile(array2, cond) { + let i = array2.length - 1; + while (i >= 0 && cond(array2[i])) { + i -= 1; + } + const deleteCount = array2.length - 1 - i; + if (deleteCount !== 0) + array2.splice(array2.length - deleteCount, deleteCount); +} +function distribute(min, max, maxCount) { + const values = [min]; + const step = Math.round((max - min) / (maxCount - 1)); + if (step > 0) { + for (let i = min + step; i < max; i += step) { + const length2 = values.push(i); + if (length2 >= maxCount - 1) + break; + } + } + values.push(max); + return values; +} + +// packages/ag-charts-core/src/utils/async.ts +var AsyncAwaitQueue = class { + constructor() { + this.queue = []; + } + /** Await another async process to call notify(). */ + await(timeout = 50) { + return new Promise((resolve) => { + const successFn = () => { + clearTimeout(timeoutHandle); + resolve(true); + }; + const timeoutFn = () => { + const queueIndex = this.queue.indexOf(successFn); + if (queueIndex < 0) + return; + this.queue.splice(queueIndex, 1); + resolve(false); + }; + const timeoutHandle = setTimeout(timeoutFn, timeout); + this.queue.push(successFn); + }); + } + /** Trigger any await()ing async processes to continue. */ + notify() { + for (const cb of this.queue.splice(0)) { + cb(); + } + } +}; +function pause(delayMilliseconds = 0) { + return new Promise((resolve) => { + setTimeout(resolve, delayMilliseconds); + }); +} + +// packages/ag-charts-core/src/utils/iterators.ts +function* iterate(...items) { + for (const item of items) { + if (item == null) + continue; + if (item[Symbol.iterator]) { + yield* item; + } else { + yield item; + } + } +} +function toIterable(value) { + return value != null && typeof value === "object" && Symbol.iterator in value ? value : [value]; +} +function first(iterable) { + for (const value of iterable) { + return value; + } + throw new Error("AG Charts - no first() value found"); +} +function* entries(obj) { + const resultTuple = [void 0, void 0]; + for (const key of Object.keys(obj)) { + resultTuple[0] = key; + resultTuple[1] = obj[key]; + yield resultTuple; + } +} + +// packages/ag-charts-core/src/utils/attributeUtil.ts +function booleanParser(value) { + return value === "true"; +} +function numberParser(value) { + return Number(value); +} +function stringParser(value) { + return value; +} +var AttributeTypeParsers = { + role: stringParser, + "aria-checked": booleanParser, + "aria-controls": stringParser, + "aria-describedby": stringParser, + "aria-disabled": booleanParser, + "aria-expanded": booleanParser, + "aria-haspopup": stringParser, + "aria-hidden": booleanParser, + "aria-label": stringParser, + "aria-labelledby": stringParser, + "aria-live": stringParser, + "aria-orientation": stringParser, + "aria-selected": booleanParser, + "data-focus-override": booleanParser, + "data-focus-visible-override": booleanParser, + "data-preventdefault": booleanParser, + class: stringParser, + for: stringParser, + id: stringParser, + tabindex: numberParser, + title: stringParser, + placeholder: stringParser +}; +function setAttribute(e, qualifiedName, value) { + if (value == null || value === "" || value === "") { + e?.removeAttribute(qualifiedName); + } else { + e?.setAttribute(qualifiedName, value.toString()); + } +} +function setAttributes(e, attrs) { + if (attrs == null) + return; + for (const [key, value] of entries(attrs)) { + if (key === "class") + continue; + setAttribute(e, key, value); + } +} +function getAttribute(e, qualifiedName, defaultValue) { + if (!(e instanceof HTMLElement)) + return void 0; + const value = e.getAttribute(qualifiedName); + if (value === null) + return defaultValue; + return AttributeTypeParsers[qualifiedName]?.(value) ?? void 0; +} +function setElementStyle(e, property, value) { + if (e == null) + return; + if (value == null) { + e.style.removeProperty(property); + } else { + e.style.setProperty(property, value.toString()); + } +} +function setElementStyles(e, styles) { + for (const [key, value] of entries(styles)) { + setElementStyle(e, key, value); + } +} + +// packages/ag-charts-core/src/utils/boxBounds.ts +function boxCollides(b, x, y, w, h) { + return x < b.x + b.width && x + w > b.x && y < b.y + b.height && y + h > b.y; +} +function boxContains(b, x, y, w = 0, h = 0) { + return x >= b.x && x + w <= b.x + b.width && y >= b.y && y + h <= b.y + b.height; +} +function boxEmpty(b) { + return b == null || b.height === 0 || b.width === 0 || Number.isNaN(b.height) || Number.isNaN(b.width); +} +function boxesEqual(a, b) { + return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; +} + +// packages/ag-charts-core/src/utils/binarySearch.ts +function findMaxIndex(min, max, iteratee) { + if (min > max) + return; + let found; + while (max >= min) { + const index = Math.floor((max + min) / 2); + const value = iteratee(index); + if (value) { + found = index; + min = index + 1; + } else { + max = index - 1; + } + } + return found; +} +function findMinIndex(min, max, iteratee) { + if (min > max) + return; + let found; + while (max >= min) { + const index = Math.floor((max + min) / 2); + const value = iteratee(index); + if (value) { + found = index; + max = index - 1; + } else { + min = index + 1; + } + } + return found; +} +function findMaxValue(min, max, iteratee) { + if (min > max) + return; + let found; + while (max >= min) { + const index = Math.floor((max + min) / 2); + const value = iteratee(index); + if (value == null) { + max = index - 1; + } else { + found = value; + min = index + 1; + } + } + return found; +} + +// packages/ag-charts-core/src/utils/canvas.ts +function createCanvasContext(width2 = 0, height2 = 0) { + return new OffscreenCanvas(width2, height2).getContext("2d"); +} + +// packages/ag-charts-core/src/utils/caching.ts +var WeakCache = class { + constructor(getter) { + this.getter = getter; + } + get() { + let result = this.result?.deref(); + if (result) + return result; + result = this.getter(); + this.result = new WeakRef(result); + return result; + } + clear() { + this.result = void 0; + } +}; + +// packages/ag-charts-core/src/utils/cleanupRegistry.ts +var CleanupRegistry = class { + constructor() { + this.callbacks = /* @__PURE__ */ new Set(); + } + flush() { + for (const cb of this.callbacks) { + cb(); + } + this.callbacks.clear(); + } + merge(registry) { + for (const cb of registry.callbacks) { + this.callbacks.add(cb); + } + } + register(...callbacks) { + for (const cb of callbacks) { + if (!cb) + continue; + this.callbacks.add(cb); + } + } +}; + +// packages/ag-charts-core/src/utils/diff.ts +function diffArrays(previous, current) { + const size = Math.max(previous.length, current.length); + const added = /* @__PURE__ */ new Set(); + const removed = /* @__PURE__ */ new Set(); + for (let i = 0; i < size; i++) { + const prev = previous[i]; + const curr = current[i]; + if (prev === curr) + continue; + if (removed.has(curr)) { + removed.delete(curr); + } else if (curr) { + added.add(curr); + } + if (added.has(prev)) { + added.delete(prev); + } else if (prev) { + removed.add(prev); + } + } + return { changed: added.size > 0 || removed.size > 0, added, removed }; +} + +// packages/ag-charts-core/src/utils/geoJson.ts +function isValidCoordinate(value) { + return Array.isArray(value) && value.length >= 2 && value.every(isFiniteNumber); +} +function isValidCoordinates(value) { + return Array.isArray(value) && value.length >= 2 && value.every(isValidCoordinate); +} +function hasSameStartEndPoint(c) { + const start2 = c[0]; + const end3 = c.at(-1); + if (end3 === void 0) + return false; + return isNumberEqual(start2[0], end3[0], 1e-3) && isNumberEqual(start2[1], end3[1], 1e-3); +} +function isValidPolygon(value) { + return Array.isArray(value) && value.every(isValidCoordinates) && value.every(hasSameStartEndPoint); +} +function isValidGeometry(value) { + if (value === null) + return true; + if (!isObject(value) || value.type == null) + return false; + const { type, coordinates } = value; + switch (type) { + case "GeometryCollection": + return Array.isArray(value.geometries) && value.geometries.every(isValidGeometry); + case "MultiPolygon": + return Array.isArray(coordinates) && coordinates.every(isValidPolygon); + case "Polygon": + return isValidPolygon(coordinates); + case "MultiLineString": + return Array.isArray(coordinates) && coordinates.every(isValidCoordinates); + case "LineString": + return isValidCoordinates(coordinates); + case "MultiPoint": + return isValidCoordinates(coordinates); + case "Point": + return isValidCoordinate(coordinates); + default: + return false; + } +} +function isValidFeature(value) { + return isObject(value) && value.type === "Feature" && isValidGeometry(value.geometry); +} +function isValidFeatureCollection(value) { + return isObject(value) && value.type === "FeatureCollection" && Array.isArray(value.features) && value.features.every(isValidFeature); +} +var geoJson = attachDescription(isValidFeatureCollection, "a GeoJSON object"); + +// packages/ag-charts-core/src/utils/graph.ts +var AdjacencyListGraph = class { + constructor(cachedNeighboursEdge, processedEdge, singleValueEdges) { + this._vertexCount = 0; + this._edgeCount = 0; + this.pendingProcessingEdgesFrom = []; + this.pendingProcessingEdgesTo = []; + this.cachedNeighboursEdge = cachedNeighboursEdge; + this.processedEdge = processedEdge; + this.singleValueEdges = singleValueEdges; + } + clear() { + this._vertexCount = 0; + this._edgeCount = 0; + this.pendingProcessingEdgesFrom = []; + this.pendingProcessingEdgesTo = []; + this.singleValueEdges?.clear(); + } + getVertexCount() { + return this._vertexCount; + } + getEdgeCount() { + return this._edgeCount; + } + addVertex(value) { + const vertex = new Vertex(value); + this._vertexCount++; + return vertex; + } + addEdge(from3, to, edge) { + if (edge === this.cachedNeighboursEdge) { + from3.updateCachedNeighbours().set(to.value, to); + } else if (edge === this.processedEdge) { + this.pendingProcessingEdgesFrom.push(from3); + this.pendingProcessingEdgesTo.push(to); + } + const { edges } = from3; + const vertices = edges.get(edge); + if (!vertices) { + edges.set(edge, [to]); + this._edgeCount++; + } else if (!vertices.includes(to)) { + if (this.singleValueEdges?.has(edge)) { + edges.set(edge, [to]); + } else { + vertices.push(to); + this._edgeCount++; + } + } + } + removeVertex(vertex) { + this._vertexCount--; + const edges = vertex.edges; + if (!edges) + return; + for (const [, adjacentVertices] of edges) { + this._vertexCount -= adjacentVertices.length; + } + vertex.clear(); + } + removeEdge(from3, to, edge) { + const neighbours = from3.edges.get(edge); + if (!neighbours) + return; + const index = neighbours.indexOf(to); + if (index === -1) + return; + neighbours.splice(index, 1); + if (neighbours.length === 0) { + from3.edges.delete(edge); + } + this._edgeCount--; + if (edge === this.cachedNeighboursEdge) { + from3.readCachedNeighbours()?.delete(to.value); + } + } + removeEdges(from3, edgeValue) { + from3.edges.delete(edgeValue); + } + getVertexValue(vertex) { + return vertex.value; + } + // Iterate all the neighbours of a given vertex. + *neighbours(from3) { + for (const [, adjacentVertices] of from3.edges) { + for (const adjacentVertex of adjacentVertices) { + yield adjacentVertex; + } + } + } + // Iterate all the neighbours and their edges of a given vertex + *neighboursAndEdges(from3) { + for (const [edge, adjacentVertices] of from3.edges) { + for (const adjacentVertex of adjacentVertices) { + yield [adjacentVertex, edge]; + } + } + } + // Get the set of neighbours along a given edge. + neighboursWithEdgeValue(from3, edgeValue) { + return from3.edges.get(edgeValue); + } + // Find the first neighbour along the given edge. + findNeighbour(from3, edgeValue) { + return from3.edges.get(edgeValue)?.[0]; + } + // Find the value of the first neighbour along the given edge. + findNeighbourValue(from3, edgeValue) { + const neighbour = this.findNeighbour(from3, edgeValue); + if (!neighbour) + return; + return this.getVertexValue(neighbour); + } + // Find the first neighbour with a given value, optionally along a given edge. + findNeighbourWithValue(from3, value, edgeValue) { + const neighbours = edgeValue == null ? this.neighbours(from3) : this.neighboursWithEdgeValue(from3, edgeValue); + if (!neighbours) + return; + for (const neighbour of neighbours) { + if (this.getVertexValue(neighbour) === value) { + return neighbour; + } + } + } + // Find a vertex by iterating an array of vertex values along a given edge. + findVertexAlongEdge(from3, findValues, edgeValue) { + if (edgeValue === this.cachedNeighboursEdge) { + let found2; + for (const value of findValues) { + found2 = (found2 ?? from3).readCachedNeighbours()?.get(value); + if (!found2) + return; + } + return found2; + } + if (findValues.length === 0) + return; + let found = from3; + for (const value of findValues) { + const neighbours = found ? this.neighboursWithEdgeValue(found, edgeValue) : void 0; + if (!neighbours) + return; + found = neighbours.find((n) => n.value === value); + } + return found; + } + adjacent(from3, to) { + for (const [, adjacentVertices] of from3.edges) { + if (adjacentVertices.includes(to)) + return true; + } + return false; + } +}; +var Vertex = class { + constructor(value) { + this.value = value; + this.edges = /* @__PURE__ */ new Map(); + } + readCachedNeighbours() { + return this._cachedNeighbours; + } + updateCachedNeighbours() { + this._cachedNeighbours ?? (this._cachedNeighbours = /* @__PURE__ */ new Map()); + return this._cachedNeighbours; + } + clear() { + this.edges.clear(); + this._cachedNeighbours?.clear(); + } +}; + +// packages/ag-charts-core/src/utils/id.ts +var ID_MAP = /* @__PURE__ */ new Map(); +var elementIDBrand = Symbol("ElementID"); +var nextElementID = 1; +function createId(instance) { + const constructor = instance.constructor; + const className = Object.hasOwn(constructor, "className") ? constructor.className : constructor.name; + if (!className) { + throw new Error(`The ${constructor} is missing the 'className' property.`); + } + const nextId = (ID_MAP.get(className) ?? 0) + 1; + ID_MAP.set(className, nextId); + return `${className}-${nextId}`; +} +function createElementId() { + return `ag-charts-${nextElementID++}`; +} +function generateUUID() { + return crypto.randomUUID?.() ?? generateUUIDv4(); +} +function generateUUIDv4() { + const uuidArray = new Uint8Array(16); + crypto.getRandomValues(uuidArray); + uuidArray[6] = uuidArray[6] & 15 | 64; + uuidArray[8] = uuidArray[8] & 63 | 128; + let uuid = ""; + for (let i = 0; i < uuidArray.length; i++) { + if (i === 4 || i === 6 || i === 8 || i === 10) { + uuid += "-"; + } + uuid += uuidArray[i].toString(16).padStart(2, "0"); + } + return uuid; +} + +// packages/ag-charts-core/src/utils/linkedList.ts +function insertListItemsSorted(list, items, cmp2) { + let head = list; + let current = head; + for (const value of items) { + if (head == null || cmp2(head.value, value) > 0) { + head = { value, next: head }; + current = head; + } else { + current = current; + while (current.next != null && cmp2(current.next.value, value) <= 0) { + current = current.next; + } + current.next = { value, next: current.next }; + } + } + return head; +} + +// packages/ag-charts-core/src/utils/textUtils.ts +var EllipsisChar = "\u2026"; +var LineSplitter = /\r?\n/g; +var TrimEdgeGuard = "\u200B"; +function toFontString({ fontSize, fontStyle, fontWeight, fontFamily }) { + let fontString = ""; + if (fontStyle && fontStyle !== "normal") { + fontString += `${fontStyle} `; + } + if (fontWeight && fontWeight !== "normal" && fontWeight !== 400) { + fontString += `${fontWeight} `; + } + fontString += `${fontSize}px`; + fontString += ` ${fontFamily}`; + return fontString; +} +function calcLineHeight(fontSize, lineHeightRatio = 1.15) { + return Math.round(fontSize * lineHeightRatio); +} +var TrimCharsRegex = /[\s.,;:-]{1,5}$/; +function appendEllipsis(text2) { + return text2.replace(TrimCharsRegex, "") + EllipsisChar; +} +function guardTextEdges(str) { + return TrimEdgeGuard + str + TrimEdgeGuard; +} +function unguardTextEdges(str) { + return str.replaceAll(TrimEdgeGuard, ""); +} +function isTextTruncated(str) { + return str.endsWith(EllipsisChar); +} +function isSegmentTruncated(segment) { + return segment?.text.endsWith(EllipsisChar) ?? false; +} + +// packages/ag-charts-core/src/utils/textMeasurer.ts +var TextMeasurer = class { + constructor(ctx, measureTextCached) { + this.ctx = ctx; + this.measureTextCached = measureTextCached; + this.baselineMap = /* @__PURE__ */ new Map(); + this.charMap = /* @__PURE__ */ new Map(); + this.lineHeightCache = null; + } + baselineDistance(textBaseline) { + if (textBaseline === "alphabetic") + return 0; + if (this.baselineMap.has(textBaseline)) { + return this.baselineMap.get(textBaseline); + } + this.ctx.textBaseline = textBaseline; + const { alphabeticBaseline } = this.ctx.measureText(""); + this.baselineMap.set(textBaseline, alphabeticBaseline); + this.ctx.textBaseline = "alphabetic"; + return alphabeticBaseline; + } + lineHeight() { + this.lineHeightCache ?? (this.lineHeightCache = this.measureText("").height); + return this.lineHeightCache; + } + measureText(text2) { + const m = this.measureTextCached?.(text2) ?? this.ctx.measureText(text2); + const { + width: width2, + // Apply fallbacks for environments like `node-canvas` where some metrics may be missing. + fontBoundingBoxAscent: ascent = m.emHeightAscent, + fontBoundingBoxDescent: descent = m.emHeightDescent + } = m; + const height2 = ascent + descent; + return { width: width2, height: height2, ascent, descent }; + } + measureLines(text2) { + const lines = typeof text2 === "string" ? text2.split(LineSplitter) : text2; + let width2 = 0; + let height2 = 0; + const lineMetrics = lines.map((line) => { + const b = this.measureText(line); + if (width2 < b.width) { + width2 = b.width; + } + height2 += b.height; + return { text: line, ...b }; + }); + return { width: width2, height: height2, lineMetrics }; + } + textWidth(text2, estimate) { + if (estimate) { + let estimatedWidth = 0; + for (let i = 0; i < text2.length; i++) { + estimatedWidth += this.textWidth(text2.charAt(i)); + } + return estimatedWidth; + } + if (text2.length > 1) { + return this.ctx.measureText(text2).width; + } + return this.charMap.get(text2) ?? this.charWidth(text2); + } + charWidth(char) { + const { width: width2 } = this.ctx.measureText(char); + this.charMap.set(char, width2); + return width2; + } +}; +var instanceMap = new LRUCache(50); +function cachedTextMeasurer(font3) { + if (typeof font3 === "object") { + font3 = toFontString(font3); + } + let cachedMeasurer = instanceMap.get(font3); + if (cachedMeasurer) + return cachedMeasurer; + const cachedTextMetrics = new LRUCache(1e4); + const ctx = createCanvasContext(); + ctx.font = font3; + cachedMeasurer = new TextMeasurer(ctx, (text2) => { + let textMetrics = cachedTextMetrics.get(text2); + if (textMetrics) + return textMetrics; + textMetrics = ctx.measureText(text2); + cachedTextMetrics.set(text2, textMetrics); + return textMetrics; + }); + instanceMap.set(font3, cachedMeasurer); + return cachedMeasurer; +} +cachedTextMeasurer.clear = () => instanceMap.clear(); +function measureTextSegments(textSegments, defaultFont) { + let currentLine = { segments: [], width: 0, height: 0, ascent: 0, descent: 0 }; + const lineMetrics = [currentLine]; + for (const segment of textSegments) { + const { + text: text2, + fontSize = defaultFont.fontSize, + fontStyle = defaultFont.fontStyle, + fontWeight = defaultFont.fontWeight, + fontFamily = defaultFont.fontFamily, + ...rest + } = segment; + const font3 = { fontSize, fontStyle, fontWeight, fontFamily }; + const measurer3 = cachedTextMeasurer(font3); + const textLines = text2.split(LineSplitter); + for (let i = 0; i < textLines.length; i++) { + const textLine = textLines[i]; + const textMetrics = measurer3.measureText(textLine); + if (i > 0) { + currentLine = { segments: [], width: 0, height: 0, ascent: 0, descent: 0 }; + lineMetrics.push(currentLine); + } + if (textLine) { + currentLine.width += textMetrics.width; + currentLine.ascent = Math.max(currentLine.ascent, textMetrics.ascent); + currentLine.descent = Math.max(currentLine.descent, textMetrics.descent); + currentLine.height = Math.max(currentLine.height, currentLine.ascent + currentLine.descent); + currentLine.segments.push({ ...font3, ...rest, text: textLine, textMetrics }); + } + } + } + let maxWidth = 0; + let totalHeight = 0; + for (const line of lineMetrics) { + maxWidth = Math.max(maxWidth, line.width); + totalHeight += line.height; + } + return { width: maxWidth, height: totalHeight, lineMetrics }; +} + +// packages/ag-charts-core/src/utils/textWrapper.ts +function shouldHideOverflow(clippedResult, options) { + return options.overflow === "hide" && clippedResult.some(isTextTruncated); +} +function wrapTextOrSegments(input, options) { + return isArray(input) ? wrapTextSegments(input, options) : wrapLines(input, options).join("\n"); +} +function wrapText(text2, options) { + return wrapLines(text2, options).join("\n"); +} +function wrapLines(text2, options) { + return textWrap(text2, options); +} +function truncateLine(text2, measurer3, maxWidth, ellipsisForce) { + const ellipsisWidth = measurer3.textWidth(EllipsisChar); + let estimatedWidth = 0; + let i = 0; + for (; i < text2.length; i++) { + const charWidth = measurer3.textWidth(text2.charAt(i)); + if (estimatedWidth + charWidth > maxWidth) + break; + estimatedWidth += charWidth; + } + if (text2.length === i && (!ellipsisForce || estimatedWidth + ellipsisWidth <= maxWidth)) { + return ellipsisForce ? appendEllipsis(text2) : text2; + } + text2 = text2.slice(0, i).trimEnd(); + while (text2.length && measurer3.textWidth(text2) + ellipsisWidth > maxWidth) { + text2 = text2.slice(0, -1).trimEnd(); + } + return appendEllipsis(text2); +} +function textWrap(text2, options, widthOffset = 0) { + const lines = text2.split(LineSplitter); + const measurer3 = cachedTextMeasurer(options.font); + const result = []; + if (options.textWrap === "never") { + for (const line of lines) { + const truncatedLine = truncateLine(line.trimEnd(), measurer3, Math.max(0, options.maxWidth - widthOffset)); + if (!truncatedLine) + break; + result.push(truncatedLine); + widthOffset = 0; + } + return shouldHideOverflow(result, options) ? [] : result; + } + const wrapHyphenate = options.textWrap === "hyphenate"; + const wrapOnSpace = options.textWrap == null || options.textWrap === "on-space"; + for (const untrimmedLine of lines) { + let line = untrimmedLine.trimEnd(); + if (line === "") { + result.push(line); + continue; + } + let i = 0; + let estimatedWidth = 0; + let lastSpaceIndex = 0; + if (!result.length) { + estimatedWidth = widthOffset; + } + while (i < line.length) { + const char = line.charAt(i); + if (char === " ") { + lastSpaceIndex = i; + } + estimatedWidth += measurer3.textWidth(char); + if (estimatedWidth > options.maxWidth) { + if (i === 0) { + line = ""; + break; + } + let actualWidth = measurer3.textWidth(line.slice(0, i + 1)); + if (!result.length) { + actualWidth += widthOffset; + } + if (actualWidth <= options.maxWidth) { + estimatedWidth = actualWidth; + i++; + continue; + } + if (lastSpaceIndex) { + const nextWord = getWordAt(line, lastSpaceIndex + 1); + const textWidth = measurer3.textWidth(nextWord); + if (textWidth <= options.maxWidth) { + result.push(line.slice(0, lastSpaceIndex).trimEnd()); + line = line.slice(lastSpaceIndex).trimStart(); + i = 0; + estimatedWidth = 0; + lastSpaceIndex = 0; + continue; + } else if (wrapOnSpace && textWidth > options.maxWidth) { + result.push( + line.slice(0, lastSpaceIndex).trimEnd(), + truncateLine(line.slice(lastSpaceIndex).trimStart(), measurer3, options.maxWidth, true) + ); + } + } else if (wrapOnSpace) { + const newLine2 = truncateLine(line, measurer3, options.maxWidth, true); + if (newLine2) { + result.push(newLine2); + } + } + if (wrapOnSpace) { + line = ""; + break; + } + const postfix = wrapHyphenate ? "-" : ""; + let newLine = line.slice(0, i).trim(); + while (newLine.length && measurer3.textWidth(newLine + postfix) > options.maxWidth) { + newLine = newLine.slice(0, -1).trimEnd(); + } + if (newLine && newLine !== TrimEdgeGuard) { + result.push(newLine + postfix); + } else { + line = ""; + break; + } + line = line.slice(newLine.length).trimStart(); + i = -1; + estimatedWidth = 0; + lastSpaceIndex = 0; + } + i++; + } + if (line) { + result.push(line); + } + } + avoidOrphans(result, measurer3, options); + const clippedResult = clipLines(result, measurer3, options); + return shouldHideOverflow(clippedResult, options) ? [] : clippedResult; +} +function getWordAt(text2, position) { + const nextSpaceIndex = text2.indexOf(" ", position); + return nextSpaceIndex === -1 ? text2.slice(position) : text2.slice(position, nextSpaceIndex); +} +function clipLines(lines, measurer3, options) { + if (!isFiniteNumber(options.maxHeight)) { + return lines; + } + const { height: height2, lineMetrics } = measurer3.measureLines(lines); + if (height2 <= options.maxHeight) { + return lines; + } + for (let i = 0, cumulativeHeight = 0; i < lineMetrics.length; i++) { + cumulativeHeight += lineMetrics[i].height; + if (cumulativeHeight > options.maxHeight) { + if (options.overflow === "hide" || i === 0) + return []; + const clippedResults = lines.slice(0, i); + const lastLine = clippedResults.pop(); + return clippedResults.concat( + isTextTruncated(lastLine) ? lastLine : truncateLine(lastLine, measurer3, options.maxWidth, true) + ); + } + } + return lines; +} +function avoidOrphans(lines, measurer3, options) { + if (options.avoidOrphans === false || lines.length < 2) + return; + const { length: length2 } = lines; + const lastLine = lines[length2 - 1]; + const beforeLast = lines[length2 - 2]; + if (beforeLast.length < lastLine.length) + return; + const lastSpaceIndex = beforeLast.lastIndexOf(" "); + if (lastSpaceIndex === -1 || lastSpaceIndex === beforeLast.indexOf(" ") || lastLine.includes(" ")) + return; + const lastWord = beforeLast.slice(lastSpaceIndex + 1); + if (measurer3.textWidth(lastLine + lastWord) <= options.maxWidth) { + lines[length2 - 2] = beforeLast.slice(0, lastSpaceIndex); + lines[length2 - 1] = lastWord + " " + lastLine; + } +} +function wrapTextSegments(textSegments, options) { + const { maxHeight = Infinity } = options; + const result = []; + let lineWidth = 0; + let totalHeight = 0; + function truncateLastSegment() { + const lastSegment = result.pop(); + if (!lastSegment) + return; + const measurer3 = cachedTextMeasurer(lastSegment); + const truncatedText = truncateLine(lastSegment.text, measurer3, options.maxWidth, true); + const textMetrics = measurer3.measureText(truncatedText); + result.push({ ...lastSegment, text: truncatedText, textMetrics }); + } + for (const { width: width2, height: height2, segments } of measureTextSegments(textSegments, options.font).lineMetrics) { + if (totalHeight + height2 > maxHeight) { + if (result.length) { + truncateLastSegment(); + } + break; + } + if (lineWidth + width2 <= options.maxWidth) { + lineWidth += width2; + totalHeight += height2; + result.push(...segments); + continue; + } + for (const segment of segments) { + if (lineWidth + segment.textMetrics.width <= options.maxWidth) { + lineWidth += segment.textMetrics.width; + result.push(segment); + continue; + } + const measurer3 = cachedTextMeasurer(segment); + const guardedText = guardTextEdges(segment.text); + const wrapOptions = { ...options, font: segment, maxHeight: maxHeight - totalHeight }; + let wrappedLines = textWrap(guardedText, { ...wrapOptions, overflow: "hide" }, lineWidth); + if (wrappedLines.length === 0) { + if (options.textWrap === "never") { + wrappedLines = textWrap(guardedText, wrapOptions, lineWidth); + } else { + wrappedLines = textWrap(guardedText, wrapOptions); + const lastSegment = result.at(-1); + if (lastSegment) { + lastSegment.text += "\n"; + lineWidth = 0; + } + } + } + if (wrappedLines.length === 0) { + truncateLastSegment(); + break; + } + const truncationIndex = wrappedLines.findIndex(isTextTruncated); + if (truncationIndex !== -1) { + wrappedLines = wrappedLines.slice(0, truncationIndex + 1); + } + const lastLine = wrappedLines.at(-1); + for (const wrappedLine of wrappedLines) { + const cleanLine = unguardTextEdges(wrappedLine); + const textMetrics = measurer3.measureText(cleanLine); + const subSegment = { ...segment, text: cleanLine, textMetrics }; + if (wrappedLine === lastLine) { + lineWidth += textMetrics.width; + } else { + subSegment.text += "\n"; + lineWidth = 0; + } + totalHeight += textMetrics.height; + result.push(subSegment); + } + if (truncationIndex !== -1) + break; + } + } + return result; +} + +// packages/ag-charts-community/src/module/module.ts +var BaseModuleInstance = class { + constructor() { + this.cleanup = new CleanupRegistry(); + } + destroy() { + this.cleanup.flush(); + } +}; +var ModuleRegistry = class { + constructor() { + this.modules = []; + this.dependencies = /* @__PURE__ */ new Map(); + this.modulesByOptionKey = /* @__PURE__ */ new Map(); + } + register(...modules) { + for (const module2 of modules) { + this.registerDependencies(module2); + const otherModule = this.modules.find( + (other) => module2.type === other.type && ("optionsKey" in module2 && "optionsKey" in other ? module2.optionsKey === other.optionsKey : true) && module2.identifier === other.identifier + ); + if (otherModule) { + if (module2.packageType === "enterprise" && otherModule.packageType === "community") { + const index = this.modules.indexOf(otherModule); + this.modules.splice(index, 1, module2); + if ("optionsKey" in module2) { + this.modulesByOptionKey.set(module2.optionsKey, module2); + } + } + } else { + this.modules.push(module2); + if ("optionsKey" in module2) { + this.modulesByOptionKey.set(module2.optionsKey, module2); + } + } + } + } + hasEnterpriseModules() { + return this.modules.some((m) => m.packageType === "enterprise"); + } + *byType(...types) { + const yielded = /* @__PURE__ */ new Set(); + const modulesByType = this.modules.filter((module2) => types.includes(module2.type)); + const calculateDependencies = (module2) => { + const deps = this.dependencies.get(module2); + return deps?.flatMap(calculateDependencies).concat(deps) ?? []; + }; + const unresolvable = []; + for (const module2 of modulesByType) { + const uniqueKey = "optionsKey" in module2 ? module2.optionsKey : module2.contextKey; + if (yielded.has(uniqueKey)) + continue; + for (const dependency of calculateDependencies(uniqueKey)) { + if (yielded.has(dependency)) + continue; + const dependencyModule = this.modulesByOptionKey.get(dependency); + if (!dependencyModule) { + unresolvable.push(dependency); + continue; + } + if (!types.includes(dependencyModule.type)) + continue; + yield dependencyModule; + yielded.add(dependency); + } + yield module2; + yielded.add(uniqueKey); + } + if (unresolvable.length > 0) { + throw new Error(`Could not resolve module dependencies: ${unresolvable}`); + } + } + registerDependencies(module2) { + if (module2.dependencies == null || module2.dependencies.length === 0) + return; + const uniqueKey = "optionsKey" in module2 ? module2.optionsKey : module2.contextKey; + this.dependencies.set(uniqueKey, module2.dependencies); + } +}; +var moduleRegistry = new ModuleRegistry(); + +// packages/ag-charts-community/src/util/interpolating.ts +var interpolate = Symbol("interpolate"); +var isInterpolating = (x) => x[interpolate] != null; + +// packages/ag-charts-community/src/util/nearest.ts +function nearestSquared(x, y, objects, maxDistanceSquared = Infinity) { + const result = { nearest: void 0, distanceSquared: maxDistanceSquared }; + for (const obj of objects) { + const thisDistance = obj.distanceSquared(x, y); + if (thisDistance === 0) { + return { nearest: obj, distanceSquared: 0 }; + } else if (thisDistance < result.distanceSquared) { + result.nearest = obj; + result.distanceSquared = thisDistance; + } + } + return result; +} +function nearestSquaredInContainer(x, y, container, maxDistanceSquared = Infinity) { + const { x: tx = x, y: ty = y } = container.transformPoint?.(x, y) ?? {}; + const result = { nearest: void 0, distanceSquared: maxDistanceSquared }; + for (const child of container.children) { + const { nearest, distanceSquared: distanceSquared2 } = child.nearestSquared(tx, ty, result.distanceSquared); + if (distanceSquared2 === 0) { + return { nearest, distanceSquared: distanceSquared2 }; + } else if (distanceSquared2 < result.distanceSquared) { + result.nearest = nearest; + result.distanceSquared = distanceSquared2; + } + } + return result; +} + +// packages/ag-charts-community/src/scene/bbox.ts +var _BBox = class _BBox { + constructor(x, y, width2, height2) { + this.x = x; + this.y = y; + this.width = width2; + this.height = height2; + } + static fromObject({ x, y, width: width2, height: height2 }) { + return new _BBox(x, y, width2, height2); + } + static merge(boxes) { + let left = Infinity; + let top = Infinity; + let right = -Infinity; + let bottom = -Infinity; + for (const box of boxes) { + if (box.x < left) { + left = box.x; + } + if (box.y < top) { + top = box.y; + } + if (end(box.x, box.width) > right) { + right = end(box.x, box.width); + } + if (end(box.y, box.height) > bottom) { + bottom = end(box.y, box.height); + } + } + return new _BBox(left, top, right - left, bottom - top); + } + static nearestBox(x, y, boxes) { + return nearestSquared(x, y, boxes); + } + toDOMRect() { + return { + x: this.x, + y: this.y, + width: this.width, + height: this.height, + top: this.y, + left: this.x, + right: end(this.x, this.width), + bottom: end(this.y, this.height), + toJSON() { + return {}; + } + }; + } + clone() { + const { x, y, width: width2, height: height2 } = this; + return new _BBox(x, y, width2, height2); + } + equals(other) { + return boxesEqual(this, other); + } + containsPoint(x, y) { + return boxContains(this, x, y); + } + intersection(other) { + const x0 = Math.max(this.x, other.x); + const y0 = Math.max(this.y, other.y); + const x1 = Math.min(end(this.x, this.width), end(other.x, other.width)); + const y1 = Math.min(end(this.y, this.height), end(other.y, other.height)); + if (x0 > x1 || y0 > y1) + return; + return new _BBox(x0, y0, x1 - x0, y1 - y0); + } + collidesBBox(other) { + return this.x < end(other.x, other.width) && end(this.x, this.width) > other.x && this.y < end(other.y, other.height) && end(this.y, this.height) > other.y; + } + computeCenter() { + return { x: this.x + this.width / 2, y: this.y + this.height / 2 }; + } + isFinite() { + return Number.isFinite(this.x) && Number.isFinite(this.y) && Number.isFinite(this.width) && Number.isFinite(this.height); + } + distanceSquared(x, y) { + if (this.containsPoint(x, y)) { + return 0; + } + const dx2 = x - clamp(this.x, x, end(this.x, this.width)); + const dy2 = y - clamp(this.y, y, end(this.y, this.height)); + return dx2 * dx2 + dy2 * dy2; + } + shrink(amount, position) { + if (typeof amount === "number") { + this.applyMargin(amount, position); + } else { + for (const key of Object.keys(amount)) { + const value = amount[key]; + if (typeof value === "number") { + this.applyMargin(value, key); + } + } + } + if (this.width < 0) { + this.width = 0; + } + if (this.height < 0) { + this.height = 0; + } + return this; + } + grow(amount, position) { + if (typeof amount === "number") { + this.applyMargin(-amount, position); + } else { + for (const key of Object.keys(amount)) { + const value = amount[key]; + if (typeof value === "number") { + this.applyMargin(-value, key); + } + } + } + return this; + } + applyMargin(value, position) { + switch (position) { + case "top": + this.y += value; + case "bottom": + this.height -= value; + break; + case "left": + this.x += value; + case "right": + this.width -= value; + break; + case "vertical": + this.y += value; + this.height -= value * 2; + break; + case "horizontal": + this.x += value; + this.width -= value * 2; + break; + case void 0: + this.x += value; + this.y += value; + this.width -= value * 2; + this.height -= value * 2; + break; + } + } + translate(x, y) { + this.x += x; + this.y += y; + return this; + } + [interpolate](other, d) { + return new _BBox( + this.x * (1 - d) + other.x * d, + this.y * (1 - d) + other.y * d, + this.width * (1 - d) + other.width * d, + this.height * (1 - d) + other.height * d + ); + } +}; +_BBox.zero = Object.freeze(new _BBox(0, 0, 0, 0)); +_BBox.NaN = Object.freeze(new _BBox(Number.NaN, Number.NaN, Number.NaN, Number.NaN)); +var BBox = _BBox; +function end(x, width2) { + if (x === -Infinity && width2 === Infinity) + return Infinity; + return x + width2; +} + +// packages/ag-charts-community/src/util/debug.ts +var LONG_TIME_PERIOD_THRESHOLD = 2e3; +var timeOfLastLog = Date.now(); +var logTimeGap = () => { + const timeSinceLastLog = Date.now() - timeOfLastLog; + if (timeSinceLastLog > LONG_TIME_PERIOD_THRESHOLD) { + const prettyDuration = (Math.floor(timeSinceLastLog / 100) / 10).toFixed(1); + logger_exports.log(`**** ${prettyDuration}s since last log message ****`); + } + timeOfLastLog = Date.now(); +}; +var Debug = { + create(...debugSelectors) { + const resultFn = (...logContent) => { + if (Debug.check(...debugSelectors)) { + if (typeof logContent[0] === "function") { + logContent = toArray(logContent[0]()); + } + logTimeGap(); + logger_exports.log(...logContent); + } + }; + return Object.assign(resultFn, { + check: () => Debug.check(...debugSelectors), + group: (name, cb) => { + if (Debug.check(...debugSelectors)) { + return logger_exports.logGroup(name, cb); + } + return cb(); + } + }); + }, + check(...debugSelectors) { + if (debugSelectors.length === 0) { + debugSelectors.push(true); + } + const chartDebug = toArray(getWindow("agChartsDebug")); + return chartDebug.some((selector) => debugSelectors.includes(selector)); + }, + inDevelopmentMode(fn) { + if (Debug.check("dev")) { + return fn(); + } + } +}; + +// packages/ag-charts-community/src/scene/canvas/canvasUtil.ts +function clearContext({ + context, + pixelRatio, + width: width2, + height: height2 +}) { + context.save(); + try { + context.resetTransform(); + context.clearRect(0, 0, Math.ceil(width2 * pixelRatio), Math.ceil(height2 * pixelRatio)); + } finally { + context.restore(); + } +} +function debugContext(ctx) { + if (Debug.check("canvas")) { + const save = ctx.save.bind(ctx); + const restore = ctx.restore.bind(ctx); + let depth = 0; + Object.assign(ctx, { + save() { + save(); + depth++; + }, + restore() { + if (depth === 0) { + throw new Error("AG Charts - Unable to restore() past depth 0"); + } + restore(); + depth--; + }, + verifyDepthZero() { + if (depth !== 0) { + throw new Error(`AG Charts - Save/restore depth is non-zero: ${depth}`); + } + } + }); + } +} + +// packages/ag-charts-community/src/scene/canvas/hdpiOffscreenCanvas.ts +function canvasDimensions(width2, height2, pixelRatio) { + return [Math.floor(width2 * pixelRatio), Math.floor(height2 * pixelRatio)]; +} +var HdpiOffscreenCanvas = class { + constructor(options) { + const { width: width2, height: height2, pixelRatio, willReadFrequently = false } = options; + this.width = width2; + this.height = height2; + this.pixelRatio = pixelRatio; + const [canvasWidth, canvasHeight] = canvasDimensions(width2, height2, pixelRatio); + this.canvas = new OffscreenCanvas(canvasWidth, canvasHeight); + this.context = this.canvas.getContext("2d", { willReadFrequently }); + this.context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); + debugContext(this.context); + } + drawImage(context, dx2 = 0, dy2 = 0) { + return context.drawImage(this.canvas, dx2, dy2); + } + transferToImageBitmap() { + return this.canvas.transferToImageBitmap(); + } + resize(width2, height2, pixelRatio) { + if (!(width2 > 0 && height2 > 0)) + return; + const { canvas, context } = this; + if (width2 !== this.width || height2 !== this.height || pixelRatio !== this.pixelRatio) { + const [canvasWidth, canvasHeight] = canvasDimensions(width2, height2, pixelRatio); + canvas.width = canvasWidth; + canvas.height = canvasHeight; + } + context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); + this.width = width2; + this.height = height2; + this.pixelRatio = pixelRatio; + } + clear() { + clearContext(this); + } + destroy() { + this.canvas.width = 0; + this.canvas.height = 0; + this.context.clearRect(0, 0, 0, 0); + this.canvas = null; + this.context = null; + Object.freeze(this); + } +}; + +// packages/ag-charts-community/src/util/decorator.ts +var BREAK_TRANSFORM_CHAIN = Symbol("BREAK"); +var CONFIG_KEY = "__decorator_config"; +var ACCESSORS_KEY = "__decorator_accessors"; +function addFakeTransformToInstanceProperty(target, propertyKeyOrSymbol) { + initialiseConfig(target, propertyKeyOrSymbol).optional = true; +} +function initialiseConfig(target, propertyKeyOrSymbol) { + if (Object.getOwnPropertyDescriptor(target, CONFIG_KEY) == null) { + Object.defineProperty(target, CONFIG_KEY, { value: {} }); + } + if (Object.getOwnPropertyDescriptor(target, ACCESSORS_KEY) == null) { + const parentAccessors = Object.getPrototypeOf(target)?.[ACCESSORS_KEY]; + const accessors = parentAccessors?.slice() ?? []; + Object.defineProperty(target, ACCESSORS_KEY, { value: accessors }); + } + const config = target[CONFIG_KEY]; + const propertyKey = propertyKeyOrSymbol.toString(); + if (config[propertyKey] != null) { + return config[propertyKey]; + } + config[propertyKey] = { setters: [], getters: [], observers: [] }; + const descriptor = Object.getOwnPropertyDescriptor(target, propertyKeyOrSymbol); + let prevGet = descriptor?.get; + let prevSet = descriptor?.set; + if (prevGet == null || prevSet == null) { + const accessors = target[ACCESSORS_KEY]; + let index = accessors.indexOf(propertyKeyOrSymbol); + if (index === -1) { + index = accessors.push(propertyKeyOrSymbol) - 1; + } + prevGet ?? (prevGet = function() { + let accessorValues = this.__accessors; + if (accessorValues == null) { + accessorValues = accessors.slice().fill(void 0); + Object.defineProperty(this, "__accessors", { value: accessorValues }); + } + return accessorValues[index]; + }); + prevSet ?? (prevSet = function(value) { + let accessorValues = this.__accessors; + if (accessorValues == null) { + accessorValues = accessors.slice().fill(void 0); + Object.defineProperty(this, "__accessors", { value: accessorValues }); + } + accessorValues[index] = value; + }); + } + const getter = function() { + let value = prevGet.call(this); + for (const transformFn of config[propertyKey].getters) { + value = transformFn(this, propertyKeyOrSymbol, value); + if (value === BREAK_TRANSFORM_CHAIN) { + return; + } + } + return value; + }; + const setter = function(value) { + const { setters, observers } = config[propertyKey]; + let oldValue; + if (setters.some((f) => f.length > 2)) { + oldValue = prevGet.call(this); + } + for (const transformFn of setters) { + value = transformFn(this, propertyKeyOrSymbol, value, oldValue); + if (value === BREAK_TRANSFORM_CHAIN) { + return; + } + } + prevSet.call(this, value); + for (const observerFn of observers) { + observerFn(this, value, oldValue); + } + }; + Object.defineProperty(target, propertyKeyOrSymbol, { + set: setter, + get: getter, + enumerable: true, + configurable: false + }); + return config[propertyKey]; +} +function addTransformToInstanceProperty(setTransform, getTransform, configMetadata) { + return (target, propertyKeyOrSymbol) => { + const config = initialiseConfig(target, propertyKeyOrSymbol); + config.setters.push(setTransform); + if (getTransform) { + config.getters.unshift(getTransform); + } + if (configMetadata) { + Object.assign(config, configMetadata); + } + }; +} +function addObserverToInstanceProperty(setObserver) { + return (target, propertyKeyOrSymbol) => { + initialiseConfig(target, propertyKeyOrSymbol).observers.push(setObserver); + }; +} +function isDecoratedObject(target) { + return target !== void 0 && CONFIG_KEY in target; +} +function listDecoratedProperties(target) { + const targets = /* @__PURE__ */ new Set(); + while (isDecoratedObject(target)) { + targets.add(target?.[CONFIG_KEY]); + target = Object.getPrototypeOf(target); + } + return Array.from(targets).flatMap((configMap) => Object.keys(configMap)); +} +function extractDecoratedProperties(target) { + return listDecoratedProperties(target).reduce((result, key) => { + result[String(key)] = target[key] ?? null; + return result; + }, {}); +} + +// packages/ag-charts-community/src/util/object.ts +function objectsEqual(a, b) { + if (Array.isArray(a)) { + if (!Array.isArray(b)) + return false; + if (a.length !== b.length) + return false; + return a.every((av, i) => objectsEqual(av, b[i])); + } else if (isPlainObject(a)) { + if (!isPlainObject(b)) + return false; + return objectsEqualWith(a, b, objectsEqual); + } + return a === b; +} +function objectsEqualWith(a, b, cmp2) { + if (Object.is(a, b)) + return true; + for (const key of Object.keys(b)) { + if (!(key in a)) + return false; + } + for (const key of Object.keys(a)) { + if (!(key in b)) + return false; + if (!cmp2(a[key], b[key])) + return false; + } + return true; +} +function mergeDefaults(...sources) { + const target = {}; + for (const source of sources) { + if (!isObject(source)) + continue; + const keys = isDecoratedObject(source) ? listDecoratedProperties(source) : Object.keys(source); + for (const key of keys) { + if (isPlainObject(target[key]) && isPlainObject(source[key])) { + target[key] = mergeDefaults(target[key], source[key]); + } else { + target[key] ?? (target[key] = source[key]); + } + } + } + return target; +} +function merge(...sources) { + const target = {}; + for (const source of sources) { + if (!isObject(source)) + continue; + const keys = isDecoratedObject(source) ? listDecoratedProperties(source) : Object.keys(source); + for (const key of keys) { + if (isPlainObject(target[key]) && isPlainObject(source[key])) { + target[key] = merge(target[key], source[key]); + } else if (!(key in target)) { + target[key] ?? (target[key] = source[key]); + } + } + } + return target; +} +function mergeArrayDefaults(dataArray, ...itemDefaults) { + if (itemDefaults && isArray(dataArray)) { + return dataArray.map((item) => mergeDefaults(item, ...itemDefaults)); + } + return dataArray; +} +function mapValues(object2, mapper) { + const result = {}; + for (const [key, value] of entries(object2)) { + result[key] = mapper(value, key, object2); + } + return result; +} +function without(object2, keys) { + const clone2 = { ...object2 }; + for (const key of keys) { + delete clone2[key]; + } + return clone2; +} +function pick(object2, keys) { + if (object2 == null) + return; + const picked = {}; + for (const key of keys) { + if (Object.hasOwn(object2, key)) { + picked[key] = object2[key]; + } + } + return picked; +} +function getPath(object2, path) { + const pathArray = isArray(path) ? path : path.split("."); + return pathArray.reduce((value, pathKey) => value[pathKey], object2); +} +var SKIP_JS_BUILTINS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]); +function setPath(object2, path, newValue) { + const pathArray = isArray(path) ? path.slice() : path.split("."); + const lastKey = pathArray.pop(); + if (pathArray.some((p) => SKIP_JS_BUILTINS.has(p))) + return; + const lastObject = pathArray.reduce((value, pathKey) => value[pathKey], object2); + lastObject[lastKey] = newValue; + return lastObject[lastKey]; +} +function partialAssign(keysToCopy, target, source) { + if (source === void 0) { + return target; + } + for (const key of keysToCopy) { + const value = source[key]; + if (value !== void 0) { + target[key] = value; + } + } + return target; +} +function deepFreeze(obj) { + if (obj == null || typeof obj !== "object" || !isPlainObject(obj)) { + return obj; + } + Object.freeze(obj); + for (const prop of Object.getOwnPropertyNames(obj)) { + const value = obj[prop]; + if (value !== null && (typeof value === "object" || typeof value === "function") && !Object.isFrozen(value)) { + deepFreeze(value); + } + } + return obj; +} +function isObjectWithProperty(obj, key) { + return isPlainObject(obj) && key in obj; +} +function isObjectWithStringProperty(obj, key) { + return isObjectWithProperty(obj, key) && typeof obj[key] === "string"; +} + +// packages/ag-charts-community/src/scene/changeDetectable.ts +var TRIPLE_EQ = (lhs, rhs) => lhs === rhs; +function SceneChangeDetection(opts) { + return function(target, key) { + const privateKey = `__${key}`; + if (target[key]) + return; + prepareGetSet(target, key, privateKey, opts); + }; +} +function SceneRefChangeDetection(opts) { + return SceneChangeDetection(opts); +} +function SceneObjectChangeDetection(opts) { + return SceneChangeDetection(opts); +} +function SceneArrayChangeDetection(opts) { + const baseOpts = opts ?? {}; + baseOpts.equals = arraysEqual; + return SceneChangeDetection(opts); +} +function prepareGetSet(target, key, privateKey, opts) { + const { changeCb, convertor, checkDirtyOnAssignment = false } = opts ?? {}; + const requiredOpts = { changeCb, checkDirtyOnAssignment, convertor }; + const setter = buildCheckDirtyChain( + privateKey, + buildChangeCallbackChain( + buildConvertorChain(buildSetter(privateKey, requiredOpts), requiredOpts), + requiredOpts + ), + requiredOpts + ); + const getter = function() { + return this[privateKey]; + }; + Object.defineProperty(target, key, { + set: setter, + get: getter, + enumerable: true, + configurable: true + }); +} +function buildConvertorChain(setterFn, opts) { + const { convertor } = opts; + if (convertor) { + return function(value) { + setterFn.call(this, convertor(value)); + }; + } + return setterFn; +} +var NO_CHANGE = Symbol("no-change"); +function buildChangeCallbackChain(setterFn, opts) { + const { changeCb } = opts; + if (changeCb) { + return function(value) { + const change = setterFn.call(this, value); + if (change !== NO_CHANGE) { + changeCb.call(this, this); + } + return change; + }; + } + return setterFn; +} +function buildCheckDirtyChain(privateKey, setterFn, opts) { + const { checkDirtyOnAssignment } = opts; + if (checkDirtyOnAssignment) { + return function(value) { + const change = setterFn.call(this, value); + if (value?._dirty === true) { + this.markDirty(privateKey); + } + return change; + }; + } + return setterFn; +} +function buildSetter(privateKey, opts) { + const { equals = TRIPLE_EQ } = opts; + return function(value) { + const oldValue = this[privateKey]; + if (!equals(value, oldValue)) { + this[privateKey] = value; + this.onChangeDetection(privateKey); + return value; + } + return NO_CHANGE; + }; +} + +// packages/ag-charts-community/src/scene/zIndex.ts +var cmp = (a, b) => Math.sign(a - b); +function compareZIndex(a, b) { + if (typeof a === "number" && typeof b === "number") { + return cmp(a, b); + } + const aArray = typeof a === "number" ? [a] : a; + const bArray = typeof b === "number" ? [b] : b; + const length2 = Math.min(aArray.length, bArray.length); + for (let i = 0; i < length2; i += 1) { + const diff8 = cmp(aArray[i], bArray[i]); + if (diff8 !== 0) + return diff8; + } + return cmp(aArray.length, bArray.length); +} + +// packages/ag-charts-community/src/scene/node.ts +var PointerEvents = /* @__PURE__ */ ((PointerEvents14) => { + PointerEvents14[PointerEvents14["All"] = 0] = "All"; + PointerEvents14[PointerEvents14["None"] = 1] = "None"; + return PointerEvents14; +})(PointerEvents || {}); +var MAX_ERROR_COUNT = 5; +var _Node = class _Node { + constructor(options) { + /** Unique number to allow creation order to be easily determined. */ + this.serialNumber = _Node._nextSerialNumber++; + this.childNodeCounts = { groups: 0, nonGroups: 0, thisComplexity: 0, complexity: 0 }; + /** Unique node ID in the form `ClassName-NaturalNumber`. */ + this.id = createId(this); + this.name = void 0; + this.transitionOut = void 0; + this.pointerEvents = 0 /* All */; + this._datum = void 0; + this._previousDatum = void 0; + this.scene = void 0; + this._debugDirtyProperties = void 0; + this.parentNode = void 0; + this.cachedBBox = void 0; + /** + * To simplify the type system (especially in Selections) we don't have the `Parent` node + * (one that has children). Instead, we mimic HTML DOM, where any node can have children. + * But we still need to distinguish regular leaf nodes from container leafs somehow. + */ + this.isContainerNode = false; + this.visible = true; + this.zIndex = 0; + this.batchLevel = 0; + this.batchDirty = false; + this.name = options?.name; + this.tag = options?.tag ?? Number.NaN; + this.zIndex = options?.zIndex ?? 0; + this.scene = options?.scene; + if (options?.debugDirty ?? _Node._debugEnabled) { + this._debugDirtyProperties = /* @__PURE__ */ new Map([["__first__", []]]); + } + } + static toSVG(node, width2, height2) { + const svg = node?.toSVG(); + if (svg == null || !svg.elements.length && !svg.defs?.length) + return; + const root = createSvgElement("svg"); + root.setAttribute("width", String(width2)); + root.setAttribute("height", String(height2)); + root.setAttribute("viewBox", `0 0 ${width2} ${height2}`); + root.setAttribute("overflow", "visible"); + if (svg.defs?.length) { + const defs = createSvgElement("defs"); + defs.append(...svg.defs); + root.append(defs); + } + root.append(...svg.elements); + return root.outerHTML; + } + static *extractBBoxes(nodes, skipInvisible) { + for (const n of nodes) { + if (!skipInvisible || n.visible && !n.transitionOut) { + const bbox = n.getBBox(); + if (bbox) + yield bbox; + } + } + } + /** + * Some arbitrary data bound to the node. + */ + get datum() { + return this._datum; + } + set datum(datum) { + if (this._datum !== datum) { + this._previousDatum = this._datum; + this._datum = datum; + } + } + get previousDatum() { + return this._previousDatum; + } + get layerManager() { + return this.scene?.layersManager; + } + get imageLoader() { + return this.scene?.imageLoader; + } + closestDatum() { + for (const { datum } of this.traverseUp(true)) { + if (datum != null) { + return datum; + } + } + } + /** Perform any pre-rendering initialization. */ + preRender(_renderCtx, thisComplexity = 1) { + this.childNodeCounts.groups = 0; + this.childNodeCounts.nonGroups = 1; + this.childNodeCounts.complexity = thisComplexity; + this.childNodeCounts.thisComplexity = thisComplexity; + if (this.batchLevel > 0 || this.batchDirty) { + throw new Error("AG Charts - illegal rendering state; batched update in progress"); + } + return this.childNodeCounts; + } + /** Guaranteed isolated render - if there is any failure, the Cavans2D context is returned to its prior state. */ + isolatedRender(renderCtx) { + renderCtx.ctx.save(); + try { + this.render(renderCtx); + } catch (e) { + const errorCount = e.errorCount ?? 1; + if (errorCount >= MAX_ERROR_COUNT) { + e.errorCount = errorCount; + throw e; + } + logger_exports.warnOnce("Error during rendering", e, e.stack); + } finally { + renderCtx.ctx.restore(); + } + } + render(renderCtx) { + const { stats } = renderCtx; + this.debugDirtyProperties(); + if (renderCtx.debugNodeSearch) { + const idOrName = this.name ?? this.id; + if (renderCtx.debugNodeSearch.some((v) => typeof v === "string" ? v === idOrName : v.test(idOrName))) { + renderCtx.debugNodes[this.name ?? this.id] = this; + } + } + if (stats) { + stats.nodesRendered++; + stats.opsPerformed += this.childNodeCounts.thisComplexity; + } + } + setScene(scene) { + this.scene = scene; + } + *traverseUp(includeSelf) { + if (includeSelf) { + yield this; + } + let node = this.parentNode; + while (node) { + yield node; + node = node.parentNode; + } + } + /** + * Checks if the node is the root (has no parent). + */ + isRoot() { + return !this.parentNode; + } + removeChild(node) { + throw new Error( + `AG Charts - internal error, unknown child node ${node.name ?? node.id} in $${this.name ?? this.id}` + ); + } + remove() { + this.parentNode?.removeChild(this); + } + destroy() { + if (this.parentNode) { + this.remove(); + } + } + batchedUpdate(fn) { + this.batchLevel++; + fn(); + this.batchLevel--; + if (this.batchLevel === 0 && this.batchDirty) { + this.markDirty(); + this.batchDirty = false; + } + } + setProperties(styles) { + this.batchLevel++; + Object.assign(this, styles); + this.batchLevel--; + if (this.batchLevel === 0 && this.batchDirty) { + this.markDirty(); + this.batchDirty = false; + } + return this; + } + containsPoint(_x, _y) { + return false; + } + pickNode(x, y) { + if (this.containsPoint(x, y)) { + return this; + } + } + pickNodes(x, y, into = []) { + if (this.containsPoint(x, y)) { + into.push(this); + } + return into; + } + getBBox() { + this.cachedBBox ?? (this.cachedBBox = Object.freeze(this.computeBBox())); + return this.cachedBBox; + } + computeBBox() { + return; + } + onChangeDetection(property) { + this.markDirty(property); + } + markDirtyChildrenOrder() { + this.cachedBBox = void 0; + } + markDirty(property) { + if (this.batchLevel > 0) { + this.batchDirty = true; + return; + } + if (property != null && this._debugDirtyProperties) { + this.markDebugProperties(property); + } + this.cachedBBox = void 0; + this.parentNode?.markDirty(); + } + markDebugProperties(property) { + const sources = this._debugDirtyProperties?.get(property) ?? []; + const caller = new Error("Stack trace for property change tracking").stack?.split("\n").filter((line) => { + return line !== "Error" && !line.includes(".markDebugProperties") && !line.includes(".markDirty") && !line.includes("Object.assign ") && !line.includes(`${this.constructor.name}.`); + }) ?? "unknown"; + sources.push(caller[0].replace(" at ", "").trim()); + this._debugDirtyProperties?.set(property, sources); + } + debugDirtyProperties() { + if (this._debugDirtyProperties == null) + return; + if (!this._debugDirtyProperties.has("__first__")) { + for (const [property, sources] of this._debugDirtyProperties.entries()) { + if (sources.length > 1) { + console.groupCollapsed( + `Property changed multiple times before render: ${this.constructor.name}.${property} (${sources.length}x)` + ); + for (const source of sources) + console.log(source); + console.groupEnd(); + } + } + } + this._debugDirtyProperties.clear(); + } + onZIndexChange() { + this.parentNode?.markDirtyChildrenOrder(); + } + toSVG() { + return; + } +}; +_Node._nextSerialNumber = 0; +// eslint-disable-next-line sonarjs/public-static-readonly +_Node._debugEnabled = false; +__decorateClass([ + SceneChangeDetection() +], _Node.prototype, "visible", 2); +__decorateClass([ + SceneObjectChangeDetection({ + equals: objectsEqual, + changeCb: (target) => target.onZIndexChange() + }) +], _Node.prototype, "zIndex", 2); +var Node2 = _Node; + +// packages/ag-charts-community/src/util/angle.ts +var twoPi = Math.PI * 2; +var halfPi = Math.PI / 2; +function normalizeAngle360(radians) { + radians %= twoPi; + radians += twoPi; + radians %= twoPi; + return radians; +} +function normalizeAngle360Inclusive(radians) { + radians %= twoPi; + radians += twoPi; + if (radians !== twoPi) { + radians %= twoPi; + } + return radians; +} +function normalizeAngle180(radians) { + radians %= twoPi; + if (radians < -Math.PI) { + radians += twoPi; + } else if (radians >= Math.PI) { + radians -= twoPi; + } + return radians; +} +function isBetweenAngles(targetAngle, startAngle, endAngle) { + const t = normalizeAngle360(targetAngle); + const a0 = normalizeAngle360(startAngle); + const a1 = normalizeAngle360(endAngle); + if (a0 < a1) { + return a0 <= t && t <= a1; + } else if (a0 > a1) { + return a0 <= t || t <= a1; + } else { + return startAngle !== endAngle; + } +} +function toRadians(degrees) { + return degrees / 180 * Math.PI; +} +function toDegrees(radians) { + return radians / Math.PI * 180; +} +function angleBetween(angle0, angle1) { + angle0 = normalizeAngle360(angle0); + angle1 = normalizeAngle360(angle1); + return angle1 - angle0 + (angle0 > angle1 ? twoPi : 0); +} +function getAngleRatioRadians(angle2) { + const normalizedAngle = normalizeAngle360(angle2); + if (normalizedAngle <= halfPi) { + return normalizedAngle / halfPi; + } else if (normalizedAngle <= Math.PI) { + return (Math.PI - normalizedAngle) / halfPi; + } else if (normalizedAngle <= 1.5 * Math.PI) { + return (normalizedAngle - Math.PI) / halfPi; + } else { + return (twoPi - normalizedAngle) / halfPi; + } +} +function angularPadding(hPadding, vPadding, angle2) { + const angleRatio = getAngleRatioRadians(angle2); + return hPadding * angleRatio + vPadding * Math.abs(1 - angleRatio); +} +function normalizeAngle360FromDegrees(degrees) { + return degrees ? normalizeAngle360(toRadians(degrees)) : 0; +} + +// packages/ag-charts-community/src/util/color.ts +var lerp = (x, y, t) => x * (1 - t) + y * t; +var srgbToLinear = (value) => { + const sign = value < 0 ? -1 : 1; + const abs = Math.abs(value); + if (abs <= 0.04045) + return value / 12.92; + return sign * ((abs + 0.055) / 1.055) ** 2.4; +}; +var srgbFromLinear = (value) => { + const sign = value < 0 ? -1 : 1; + const abs = Math.abs(value); + if (abs > 31308e-7) { + return sign * (1.055 * abs ** (1 / 2.4) - 0.055); + } + return 12.92 * value; +}; +var _Color = class _Color { + /** + * Every color component should be in the [0, 1] range. + * Some easing functions (such as elastic easing) can overshoot the target value by some amount. + * So, when animating colors, if the source or target color components are already near + * or at the edge of the allowed [0, 1] range, it is possible for the intermediate color + * component value to end up outside of that range mid-animation. For this reason the constructor + * performs range checking/constraining. + * @param r Red component. + * @param g Green component. + * @param b Blue component. + * @param a Alpha (opacity) component. + */ + constructor(r, g, b, a = 1) { + this.r = clamp(0, r || 0, 1); + this.g = clamp(0, g || 0, 1); + this.b = clamp(0, b || 0, 1); + this.a = clamp(0, a || 0, 1); + } + /** + * A color string can be in one of the following formats to be valid: + * - #rgb + * - #rrggbb + * - rgb(r, g, b) + * - rgba(r, g, b, a) + * - CSS color name such as 'white', 'orange', 'cyan', etc. + */ + static validColorString(str) { + if (str.includes("#")) { + return !!_Color.parseHex(str); + } + if (str.includes("rgb")) { + return !!_Color.stringToRgba(str); + } + return _Color.nameToHex.has(str.toLowerCase()); + } + /** + * The given string can be in one of the following formats: + * - #rgb + * - #rrggbb + * - rgb(r, g, b) + * - rgba(r, g, b, a) + * - CSS color name such as 'white', 'orange', 'cyan', etc. + * @param str + */ + static fromString(str) { + if (str.includes("#")) { + return _Color.fromHexString(str); + } + const hex = _Color.nameToHex.get(str.toLowerCase()); + if (hex) { + return _Color.fromHexString(hex); + } + if (str.includes("rgb")) { + return _Color.fromRgbaString(str); + } + throw new Error(`Invalid color string: '${str}'`); + } + // See https://drafts.csswg.org/css-color/#hex-notation + static parseHex(input) { + input = input.replaceAll(" ", "").slice(1); + let parts; + switch (input.length) { + case 6: + case 8: + parts = []; + for (let i = 0; i < input.length; i += 2) { + parts.push(Number.parseInt(`${input[i]}${input[i + 1]}`, 16)); + } + break; + case 3: + case 4: + parts = input.split("").map((p) => Number.parseInt(p, 16)).map((p) => p + p * 16); + break; + } + if (parts?.length >= 3 && parts.every((p) => p >= 0)) { + if (parts.length === 3) { + parts.push(255); + } + return parts; + } + } + static fromHexString(str) { + const values = _Color.parseHex(str); + if (values) { + const [r, g, b, a] = values; + return new _Color(r / 255, g / 255, b / 255, a / 255); + } + throw new Error(`Malformed hexadecimal color string: '${str}'`); + } + static stringToRgba(str) { + let po = -1; + let pc = -1; + for (let i = 0; i < str.length; i++) { + const c = str[i]; + if (po === -1 && c === "(") { + po = i; + } else if (c === ")") { + pc = i; + break; + } + } + if (po === -1 || pc === -1) + return; + const contents = str.substring(po + 1, pc); + const parts = contents.split(","); + const rgba = []; + for (let i = 0; i < parts.length; i++) { + const part = parts[i]; + let value = Number.parseFloat(part); + if (!Number.isFinite(value)) { + return; + } + if (part.includes("%")) { + value = clamp(0, value, 100); + value /= 100; + } else if (i === 3) { + value = clamp(0, value, 1); + } else { + value = clamp(0, value, 255); + value /= 255; + } + rgba.push(value); + } + return rgba; + } + static fromRgbaString(str) { + const rgba = _Color.stringToRgba(str); + if (rgba) { + if (rgba.length === 3) { + return new _Color(rgba[0], rgba[1], rgba[2]); + } else if (rgba.length === 4) { + return new _Color(rgba[0], rgba[1], rgba[2], rgba[3]); + } + } + throw new Error(`Malformed rgb/rgba color string: '${str}'`); + } + static fromArray(arr) { + if (arr.length === 4) { + return new _Color(arr[0], arr[1], arr[2], arr[3]); + } + if (arr.length === 3) { + return new _Color(arr[0], arr[1], arr[2]); + } + throw new Error("The given array should contain 3 or 4 color components (numbers)."); + } + static fromHSB(h, s, b, alpha = 1) { + const rgb = _Color.HSBtoRGB(h, s, b); + return new _Color(rgb[0], rgb[1], rgb[2], alpha); + } + static fromHSL(h, s, l, alpha = 1) { + const rgb = _Color.HSLtoRGB(h, s, l); + return new _Color(rgb[0], rgb[1], rgb[2], alpha); + } + static fromOKLCH(l, c, h, alpha = 1) { + const rgb = _Color.OKLCHtoRGB(l, c, h); + return new _Color(rgb[0], rgb[1], rgb[2], alpha); + } + static padHex(str) { + return str.length === 1 ? "0" + str : str; + } + toHexString() { + let hex = "#" + _Color.padHex(Math.round(this.r * 255).toString(16)) + _Color.padHex(Math.round(this.g * 255).toString(16)) + _Color.padHex(Math.round(this.b * 255).toString(16)); + if (this.a < 1) { + hex += _Color.padHex(Math.round(this.a * 255).toString(16)); + } + return hex; + } + toRgbaString(fractionDigits = 3) { + const components = [Math.round(this.r * 255), Math.round(this.g * 255), Math.round(this.b * 255)]; + const k = Math.pow(10, fractionDigits); + if (this.a !== 1) { + components.push(Math.round(this.a * k) / k); + return `rgba(${components.join(", ")})`; + } + return `rgb(${components.join(", ")})`; + } + toString() { + if (this.a === 1) { + return this.toHexString(); + } + return this.toRgbaString(); + } + toHSB() { + return _Color.RGBtoHSB(this.r, this.g, this.b); + } + static RGBtoOKLCH(r, g, b) { + const LSRGB0 = srgbToLinear(r); + const LSRGB1 = srgbToLinear(g); + const LSRGB2 = srgbToLinear(b); + const LMS0 = Math.cbrt(0.4122214708 * LSRGB0 + 0.5363325363 * LSRGB1 + 0.0514459929 * LSRGB2); + const LMS1 = Math.cbrt(0.2119034982 * LSRGB0 + 0.6806995451 * LSRGB1 + 0.1073969566 * LSRGB2); + const LMS2 = Math.cbrt(0.0883024619 * LSRGB0 + 0.2817188376 * LSRGB1 + 0.6299787005 * LSRGB2); + const OKLAB0 = 0.2104542553 * LMS0 + 0.793617785 * LMS1 - 0.0040720468 * LMS2; + const OKLAB1 = 1.9779984951 * LMS0 - 2.428592205 * LMS1 + 0.4505937099 * LMS2; + const OKLAB2 = 0.0259040371 * LMS0 + 0.7827717662 * LMS1 - 0.808675766 * LMS2; + const hue = Math.atan2(OKLAB2, OKLAB1) * 180 / Math.PI; + const OKLCH0 = OKLAB0; + const OKLCH1 = Math.hypot(OKLAB1, OKLAB2); + const OKLCH2 = hue >= 0 ? hue : hue + 360; + return [OKLCH0, OKLCH1, OKLCH2]; + } + static OKLCHtoRGB(l, c, h) { + const OKLAB0 = l; + const OKLAB1 = c * Math.cos(h * Math.PI / 180); + const OKLAB2 = c * Math.sin(h * Math.PI / 180); + const LMS0 = (OKLAB0 + 0.3963377774 * OKLAB1 + 0.2158037573 * OKLAB2) ** 3; + const LMS1 = (OKLAB0 - 0.1055613458 * OKLAB1 - 0.0638541728 * OKLAB2) ** 3; + const LMS2 = (OKLAB0 - 0.0894841775 * OKLAB1 - 1.291485548 * OKLAB2) ** 3; + const LSRGB0 = 4.0767416621 * LMS0 - 3.3077115913 * LMS1 + 0.2309699292 * LMS2; + const LSRGB1 = -1.2684380046 * LMS0 + 2.6097574011 * LMS1 - 0.3413193965 * LMS2; + const LSRGB2 = -0.0041960863 * LMS0 - 0.7034186147 * LMS1 + 1.707614701 * LMS2; + const SRGB0 = srgbFromLinear(LSRGB0); + const SRGB1 = srgbFromLinear(LSRGB1); + const SRGB2 = srgbFromLinear(LSRGB2); + return [SRGB0, SRGB1, SRGB2]; + } + static RGBtoHSL(r, g, b) { + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const l = (max + min) / 2; + let h; + let s; + if (max === min) { + h = 0; + s = 0; + } else { + const delta4 = max - min; + s = l > 0.5 ? delta4 / (2 - max - min) : delta4 / (max + min); + if (max === r) { + h = (g - b) / delta4 + (g < b ? 6 : 0); + } else if (max === g) { + h = (b - r) / delta4 + 2; + } else { + h = (r - g) / delta4 + 4; + } + h *= 360 / 6; + } + return [h, s, l]; + } + static HSLtoRGB(h, s, l) { + h = (h % 360 + 360) % 360; + if (s === 0) { + return [l, l, l]; + } + const q = l < 0.5 ? l * (1 + s) : l + s - l * s; + const p = 2 * l - q; + function hueToRgb(t) { + if (t < 0) + t += 1; + if (t > 1) + t -= 1; + if (t < 1 / 6) + return p + (q - p) * 6 * t; + if (t < 1 / 2) + return q; + if (t < 2 / 3) + return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + const r = hueToRgb(h / 360 + 1 / 3); + const g = hueToRgb(h / 360); + const b = hueToRgb(h / 360 - 1 / 3); + return [r, g, b]; + } + /** + * Converts the given RGB triple to an array of HSB (HSV) components. + */ + static RGBtoHSB(r, g, b) { + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const S = max === 0 ? 0 : (max - min) / max; + let H = 0; + if (min !== max) { + const delta4 = max - min; + const rc = (max - r) / delta4; + const gc = (max - g) / delta4; + const bc = (max - b) / delta4; + if (r === max) { + H = bc - gc; + } else if (g === max) { + H = 2 + rc - bc; + } else { + H = 4 + gc - rc; + } + H /= 6; + if (H < 0) { + H = H + 1; + } + } + return [H * 360, S, max]; + } + /** + * Converts the given HSB (HSV) triple to an array of RGB components. + */ + static HSBtoRGB(H, S, B) { + H = (H % 360 + 360) % 360 / 360; + let r = 0; + let g = 0; + let b = 0; + if (S === 0) { + r = g = b = B; + } else { + const h = (H - Math.floor(H)) * 6; + const f = h - Math.floor(h); + const p = B * (1 - S); + const q = B * (1 - S * f); + const t = B * (1 - S * (1 - f)); + switch (Math.trunc(h)) { + case 0: + r = B; + g = t; + b = p; + break; + case 1: + r = q; + g = B; + b = p; + break; + case 2: + r = p; + g = B; + b = t; + break; + case 3: + r = p; + g = q; + b = B; + break; + case 4: + r = t; + g = p; + b = B; + break; + case 5: + r = B; + g = p; + b = q; + break; + } + } + return [r, g, b]; + } + static mix(c0, c1, t) { + return new _Color(lerp(c0.r, c1.r, t), lerp(c0.g, c1.g, t), lerp(c0.b, c1.b, t), lerp(c0.a, c1.a, t)); + } + static lighten(c, t) { + const oklch = _Color.RGBtoOKLCH(c.r, c.g, c.b); + return _Color.fromOKLCH(clamp(0, oklch[0] + t, 1), oklch[1], oklch[2]); + } + static darken(c, t) { + const oklch = _Color.RGBtoOKLCH(c.r, c.g, c.b); + return _Color.fromOKLCH(clamp(0, oklch[0] - t, 1), oklch[1], oklch[2]); + } + static interpolate(colors, count) { + const step = 1 / (colors.length - 1); + const oklchColors = colors.map((c) => _Color.RGBtoOKLCH(c.r, c.g, c.b)); + return Array.from({ length: count }, (_, i) => { + const t = i / (count - 1); + const index = colors.length <= 2 ? 0 : Math.min(Math.floor(t * (colors.length - 1)), colors.length - 2); + const q = (t - index * step) / step; + const c0 = oklchColors[index]; + const c1 = oklchColors[index + 1]; + return _Color.fromOKLCH(lerp(c0[0], c1[0], q), lerp(c0[1], c1[1], q), lerp(c0[2], c1[2], q)); + }); + } +}; +/** + * CSS Color Module Level 4: + * https://drafts.csswg.org/css-color/#named-colors + */ +_Color.nameToHex = /* @__PURE__ */ new Map([ + ["aliceblue", "#F0F8FF"], + ["antiquewhite", "#FAEBD7"], + ["aqua", "#00FFFF"], + ["aquamarine", "#7FFFD4"], + ["azure", "#F0FFFF"], + ["beige", "#F5F5DC"], + ["bisque", "#FFE4C4"], + ["black", "#000000"], + ["blanchedalmond", "#FFEBCD"], + ["blue", "#0000FF"], + ["blueviolet", "#8A2BE2"], + ["brown", "#A52A2A"], + ["burlywood", "#DEB887"], + ["cadetblue", "#5F9EA0"], + ["chartreuse", "#7FFF00"], + ["chocolate", "#D2691E"], + ["coral", "#FF7F50"], + ["cornflowerblue", "#6495ED"], + ["cornsilk", "#FFF8DC"], + ["crimson", "#DC143C"], + ["cyan", "#00FFFF"], + ["darkblue", "#00008B"], + ["darkcyan", "#008B8B"], + ["darkgoldenrod", "#B8860B"], + ["darkgray", "#A9A9A9"], + ["darkgreen", "#006400"], + ["darkgrey", "#A9A9A9"], + ["darkkhaki", "#BDB76B"], + ["darkmagenta", "#8B008B"], + ["darkolivegreen", "#556B2F"], + ["darkorange", "#FF8C00"], + ["darkorchid", "#9932CC"], + ["darkred", "#8B0000"], + ["darksalmon", "#E9967A"], + ["darkseagreen", "#8FBC8F"], + ["darkslateblue", "#483D8B"], + ["darkslategray", "#2F4F4F"], + ["darkslategrey", "#2F4F4F"], + ["darkturquoise", "#00CED1"], + ["darkviolet", "#9400D3"], + ["deeppink", "#FF1493"], + ["deepskyblue", "#00BFFF"], + ["dimgray", "#696969"], + ["dimgrey", "#696969"], + ["dodgerblue", "#1E90FF"], + ["firebrick", "#B22222"], + ["floralwhite", "#FFFAF0"], + ["forestgreen", "#228B22"], + ["fuchsia", "#FF00FF"], + ["gainsboro", "#DCDCDC"], + ["ghostwhite", "#F8F8FF"], + ["gold", "#FFD700"], + ["goldenrod", "#DAA520"], + ["gray", "#808080"], + ["green", "#008000"], + ["greenyellow", "#ADFF2F"], + ["grey", "#808080"], + ["honeydew", "#F0FFF0"], + ["hotpink", "#FF69B4"], + ["indianred", "#CD5C5C"], + ["indigo", "#4B0082"], + ["ivory", "#FFFFF0"], + ["khaki", "#F0E68C"], + ["lavender", "#E6E6FA"], + ["lavenderblush", "#FFF0F5"], + ["lawngreen", "#7CFC00"], + ["lemonchiffon", "#FFFACD"], + ["lightblue", "#ADD8E6"], + ["lightcoral", "#F08080"], + ["lightcyan", "#E0FFFF"], + ["lightgoldenrodyellow", "#FAFAD2"], + ["lightgray", "#D3D3D3"], + ["lightgreen", "#90EE90"], + ["lightgrey", "#D3D3D3"], + ["lightpink", "#FFB6C1"], + ["lightsalmon", "#FFA07A"], + ["lightseagreen", "#20B2AA"], + ["lightskyblue", "#87CEFA"], + ["lightslategray", "#778899"], + ["lightslategrey", "#778899"], + ["lightsteelblue", "#B0C4DE"], + ["lightyellow", "#FFFFE0"], + ["lime", "#00FF00"], + ["limegreen", "#32CD32"], + ["linen", "#FAF0E6"], + ["magenta", "#FF00FF"], + ["maroon", "#800000"], + ["mediumaquamarine", "#66CDAA"], + ["mediumblue", "#0000CD"], + ["mediumorchid", "#BA55D3"], + ["mediumpurple", "#9370DB"], + ["mediumseagreen", "#3CB371"], + ["mediumslateblue", "#7B68EE"], + ["mediumspringgreen", "#00FA9A"], + ["mediumturquoise", "#48D1CC"], + ["mediumvioletred", "#C71585"], + ["midnightblue", "#191970"], + ["mintcream", "#F5FFFA"], + ["mistyrose", "#FFE4E1"], + ["moccasin", "#FFE4B5"], + ["navajowhite", "#FFDEAD"], + ["navy", "#000080"], + ["oldlace", "#FDF5E6"], + ["olive", "#808000"], + ["olivedrab", "#6B8E23"], + ["orange", "#FFA500"], + ["orangered", "#FF4500"], + ["orchid", "#DA70D6"], + ["palegoldenrod", "#EEE8AA"], + ["palegreen", "#98FB98"], + ["paleturquoise", "#AFEEEE"], + ["palevioletred", "#DB7093"], + ["papayawhip", "#FFEFD5"], + ["peachpuff", "#FFDAB9"], + ["peru", "#CD853F"], + ["pink", "#FFC0CB"], + ["plum", "#DDA0DD"], + ["powderblue", "#B0E0E6"], + ["purple", "#800080"], + ["rebeccapurple", "#663399"], + ["red", "#FF0000"], + ["rosybrown", "#BC8F8F"], + ["royalblue", "#4169E1"], + ["saddlebrown", "#8B4513"], + ["salmon", "#FA8072"], + ["sandybrown", "#F4A460"], + ["seagreen", "#2E8B57"], + ["seashell", "#FFF5EE"], + ["sienna", "#A0522D"], + ["silver", "#C0C0C0"], + ["skyblue", "#87CEEB"], + ["slateblue", "#6A5ACD"], + ["slategray", "#708090"], + ["slategrey", "#708090"], + ["snow", "#FFFAFA"], + ["springgreen", "#00FF7F"], + ["steelblue", "#4682B4"], + ["tan", "#D2B48C"], + ["teal", "#008080"], + ["thistle", "#D8BFD8"], + ["tomato", "#FF6347"], + ["transparent", "#00000000"], + ["turquoise", "#40E0D0"], + ["violet", "#EE82EE"], + ["wheat", "#F5DEB3"], + ["white", "#FFFFFF"], + ["whitesmoke", "#F5F5F5"], + ["yellow", "#FFFF00"], + ["yellowgreen", "#9ACD32"] +]); +var Color = _Color; + +// packages/ag-charts-community/src/scale/scale.ts +var ScaleAlignment = /* @__PURE__ */ ((ScaleAlignment2) => { + ScaleAlignment2[ScaleAlignment2["Leading"] = 0] = "Leading"; + ScaleAlignment2[ScaleAlignment2["Trailing"] = 1] = "Trailing"; + ScaleAlignment2[ScaleAlignment2["Interpolate"] = 2] = "Interpolate"; + return ScaleAlignment2; +})(ScaleAlignment || {}); + +// packages/ag-charts-community/src/scale/abstractScale.ts +var AbstractScale = class { + ticks(_ticks, _domain, _visibleRange) { + return void 0; + } + niceDomain(_ticks, domain = this.domain) { + return domain; + } + get bandwidth() { + return void 0; + } + get step() { + return void 0; + } + get inset() { + return void 0; + } +}; + +// packages/ag-charts-community/src/scale/invalidating.ts +var Invalidating = (target, propertyKey) => { + const mappedProperty = Symbol(String(propertyKey)); + target[mappedProperty] = void 0; + Object.defineProperty(target, propertyKey, { + get() { + return this[mappedProperty]; + }, + set(newValue) { + const oldValue = this[mappedProperty]; + if (oldValue !== newValue) { + this[mappedProperty] = newValue; + this.invalid = true; + } + }, + enumerable: true, + configurable: false + }); +}; + +// packages/ag-charts-community/src/scale/colorScale.ts +var convertColorStringToOklcha = (v) => { + const color2 = Color.fromString(v); + const [l, c, h] = Color.RGBtoOKLCH(color2.r, color2.g, color2.b); + return { l, c, h, a: color2.a }; +}; +var delta = 1e-6; +var isAchromatic = (x) => x.c < delta || x.l < delta || x.l > 1 - delta; +var interpolateOklch = (x, y, d) => { + d = clamp(0, d, 1); + let h; + if (isAchromatic(x)) { + h = y.h; + } else if (isAchromatic(y)) { + h = x.h; + } else { + const xH = x.h; + let yH = y.h; + const deltaH = y.h - x.h; + if (deltaH > 180) { + yH -= 360; + } else if (deltaH < -180) { + yH += 360; + } + h = xH * (1 - d) + yH * d; + } + const c = x.c * (1 - d) + y.c * d; + const l = x.l * (1 - d) + y.l * d; + const a = x.a * (1 - d) + y.a * d; + return Color.fromOKLCH(l, c, h, a); +}; +var ColorScale = class extends AbstractScale { + constructor() { + super(...arguments); + this.type = "color"; + this.defaultTickCount = 0; + this.invalid = true; + this.domain = [0, 1]; + this.range = ["red", "blue"]; + this.parsedRange = this.range.map(convertColorStringToOklcha); + } + update() { + const { domain, range: range4 } = this; + if (domain.length < 2) { + logger_exports.warnOnce("`colorDomain` should have at least 2 values."); + if (domain.length === 0) { + domain.push(0, 1); + } else if (domain.length === 1) { + domain.push(domain[0] + 1); + } + } + for (let i = 1; i < domain.length; i++) { + const a = domain[i - 1]; + const b = domain[i]; + if (a > b) { + logger_exports.warnOnce("`colorDomain` values should be supplied in ascending order."); + domain.sort((a2, b2) => a2 - b2); + break; + } + } + if (range4.length < domain.length) { + for (let i = range4.length; i < domain.length; i++) { + range4.push(range4.length > 0 ? range4[0] : "black"); + } + } + this.parsedRange = this.range.map(convertColorStringToOklcha); + } + normalizeDomains(...domains) { + return { domain: domains.flat(), animatable: true }; + } + toDomain() { + return; + } + convert(x) { + this.refresh(); + const { domain, range: range4, parsedRange } = this; + const d0 = domain[0]; + const d1 = domain.at(-1); + const r0 = range4[0]; + const r1 = range4.at(-1); + if (x <= d0) { + return r0; + } + if (x >= d1) { + return r1; + } + let index; + let q; + if (domain.length === 2) { + const t = (x - d0) / (d1 - d0); + const step = 1 / (range4.length - 1); + index = range4.length <= 2 ? 0 : Math.min(Math.floor(t * (range4.length - 1)), range4.length - 2); + q = (t - index * step) / step; + } else { + for (index = 0; index < domain.length - 2; index++) { + if (x < domain[index + 1]) { + break; + } + } + const a = domain[index]; + const b = domain[index + 1]; + q = (x - a) / (b - a); + } + const c0 = parsedRange[index]; + const c1 = parsedRange[index + 1]; + return interpolateOklch(c0, c1, q).toRgbaString(); + } + invert() { + return; + } + refresh() { + if (!this.invalid) + return; + this.invalid = false; + this.update(); + if (this.invalid) { + logger_exports.warnOnce("Expected update to not invalidate scale"); + } + } +}; +__decorateClass([ + Invalidating +], ColorScale.prototype, "domain", 2); +__decorateClass([ + Invalidating +], ColorScale.prototype, "range", 2); + +// packages/ag-charts-community/src/scene/gradient/gradient.ts +var Gradient = class { + constructor(colorSpace, stops = [], bbox) { + this.colorSpace = colorSpace; + this.stops = stops; + this.bbox = bbox; + this._cache = void 0; + } + createGradient(ctx, shapeBbox, params) { + const bbox = this.bbox ?? shapeBbox; + if (!bbox.isFinite()) { + return; + } + if (this._cache != null && this._cache.ctx === ctx && this._cache.bbox.equals(bbox)) { + return this._cache.gradient; + } + const { stops, colorSpace } = this; + if (stops.length === 0) + return; + if (stops.length === 1) + return stops[0].color; + let gradient2 = this.createCanvasGradient(ctx, bbox, params); + if (gradient2 == null) + return; + const isOkLch = colorSpace === "oklch"; + const step = 0.05; + let c0 = stops[0]; + gradient2.addColorStop(c0.stop, c0.color); + for (let i = 1; i < stops.length; i += 1) { + const c1 = stops[i]; + if (isOkLch) { + const scale2 = new ColorScale(); + scale2.domain = [c0.stop, c1.stop]; + scale2.range = [c0.color, c1.color]; + for (let stop = c0.stop + step; stop < c1.stop; stop += step) { + gradient2.addColorStop(stop, scale2.convert(stop) ?? "transparent"); + } + } + gradient2.addColorStop(c1.stop, c1.color); + c0 = c1; + } + if ("createPattern" in gradient2) { + gradient2 = gradient2.createPattern(); + } + this._cache = { ctx, bbox, gradient: gradient2 }; + return gradient2; + } + toSvg(shapeBbox) { + const bbox = this.bbox ?? shapeBbox; + const gradient2 = this.createSvgGradient(bbox); + for (const { stop: offset, color: color2 } of this.stops) { + const stop = createSvgElement("stop"); + stop.setAttribute("offset", `${offset}`); + stop.setAttribute("stop-color", `${color2}`); + gradient2.appendChild(stop); + } + return gradient2; + } +}; + +// packages/ag-charts-community/src/scene/gradient/conicGradient.ts +var ConicGradient = class extends Gradient { + constructor(colorSpace, stops, angle2 = 0, bbox) { + super(colorSpace, stops, bbox); + this.angle = angle2; + } + createCanvasGradient(ctx, bbox, params) { + const angleOffset = -90; + const { angle: angle2 } = this; + const radians = normalizeAngle360FromDegrees(angle2 + angleOffset); + const cx = params?.centerX ?? bbox.x + bbox.width * 0.5; + const cy = params?.centerY ?? bbox.y + bbox.height * 0.5; + return ctx.createConicGradient(radians, cx, cy); + } + createSvgGradient(_bbox) { + return createSvgElement("linearGradient"); + } +}; + +// packages/ag-charts-community/src/scene/gradient/linearGradient.ts +var LinearGradient = class extends Gradient { + constructor(colorSpace, stops, angle2 = 0, bbox) { + super(colorSpace, stops, bbox); + this.angle = angle2; + } + getGradientPoints(bbox) { + const angleOffset = 90; + const { angle: angle2 } = this; + const radians = normalizeAngle360FromDegrees(angle2 + angleOffset); + const cos = Math.cos(radians); + const sin = Math.sin(radians); + const w = bbox.width; + const h = bbox.height; + const cx = bbox.x + w * 0.5; + const cy = bbox.y + h * 0.5; + const diagonal = Math.hypot(h, w) / 2; + const diagonalAngle = Math.atan2(h, w); + let quarteredAngle; + if (radians < Math.PI / 2) { + quarteredAngle = radians; + } else if (radians < Math.PI) { + quarteredAngle = Math.PI - radians; + } else if (radians < 1.5 * Math.PI) { + quarteredAngle = radians - Math.PI; + } else { + quarteredAngle = 2 * Math.PI - radians; + } + const l = diagonal * Math.abs(Math.cos(quarteredAngle - diagonalAngle)); + return { x0: cx + cos * l, y0: cy + sin * l, x1: cx - cos * l, y1: cy - sin * l }; + } + createCanvasGradient(ctx, bbox) { + const { x0, y0, x1, y1 } = this.getGradientPoints(bbox); + if (Number.isNaN(x0) || Number.isNaN(y0) || Number.isNaN(x1) || Number.isNaN(y1)) { + return void 0; + } + return ctx.createLinearGradient(x0, y0, x1, y1); + } + createSvgGradient(bbox) { + const { x0, y0, x1, y1 } = this.getGradientPoints(bbox); + const gradient2 = createSvgElement("linearGradient"); + gradient2.setAttribute("x1", String(x0)); + gradient2.setAttribute("y1", String(y0)); + gradient2.setAttribute("x2", String(x1)); + gradient2.setAttribute("y2", String(y1)); + gradient2.setAttribute("gradientUnits", "userSpaceOnUse"); + return gradient2; + } +}; + +// packages/ag-charts-community/src/scene/gradient/radialGradient.ts +var RadialGradient = class extends Gradient { + constructor(colorSpace, stops, bbox) { + super(colorSpace, stops, bbox); + } + createCanvasGradient(ctx, bbox, params) { + const cx = params?.centerX ?? bbox.x + bbox.width * 0.5; + const cy = params?.centerY ?? bbox.y + bbox.height * 0.5; + const innerRadius = params?.innerRadius ?? 0; + const outerRadius = params?.outerRadius ?? Math.hypot(bbox.width * 0.5, bbox.height * 0.5) / Math.SQRT2; + return ctx.createRadialGradient(cx, cy, innerRadius, cx, cy, outerRadius); + } + createSvgGradient(bbox) { + const cx = bbox.x + bbox.width * 0.5; + const cy = bbox.y + bbox.height * 0.5; + const gradient2 = createSvgElement("radialGradient"); + gradient2.setAttribute("cx", String(cx)); + gradient2.setAttribute("cy", String(cy)); + gradient2.setAttribute("r", String(Math.hypot(bbox.width * 0.5, bbox.height * 0.5) / Math.SQRT2)); + gradient2.setAttribute("gradientUnits", "userSpaceOnUse"); + return gradient2; + } +}; + +// packages/ag-charts-community/src/util/properties.ts +var BaseProperties = class { + handleUnknownProperties(_unknownKeys, _properties) { + } + set(properties) { + const { className = this.constructor.name } = this.constructor; + if (properties == null) { + this.clear(); + return this; + } + if (typeof properties !== "object") { + logger_exports.warn(`unable to set ${className} - expecting a properties object`); + return this; + } + const keys = new Set(Object.keys(properties)); + for (const propertyKey of listDecoratedProperties(this)) { + if (keys.has(propertyKey)) { + const value = properties[propertyKey]; + const self = this; + if (isProperties(self[propertyKey])) { + if (self[propertyKey] instanceof PropertiesArray) { + const array2 = self[propertyKey].reset(value); + if (array2 == null) { + logger_exports.warn(`unable to set [${String(propertyKey)}] - expecting a properties array`); + } else { + self[propertyKey] = array2; + } + } else { + self[propertyKey].set(value); + } + } else if (isPlainObject(value)) { + self[propertyKey] = merge(value, self[propertyKey] ?? {}); + } else { + self[propertyKey] = value; + } + keys.delete(propertyKey); + } + } + this.handleUnknownProperties(keys, properties); + for (const unknownKey of keys) { + logger_exports.warn(`unable to set [${String(unknownKey)}] in ${className} - property is unknown`); + } + return this; + } + clear() { + for (const propertyKey of listDecoratedProperties(this)) { + const currentValue = this[propertyKey]; + if (isProperties(currentValue)) { + currentValue.clear(); + } else { + this[propertyKey] = void 0; + } + } + return this; + } + toJson() { + return listDecoratedProperties(this).reduce((object2, propertyKey) => { + const propertyValue = this[propertyKey]; + object2[String(propertyKey)] = isProperties(propertyValue) ? propertyValue.toJson() : propertyValue; + return object2; + }, {}); + } +}; +var PropertiesArray = class _PropertiesArray extends Array { + constructor(itemFactory, ...properties) { + super(properties.length); + const isConstructor = (value2) => Boolean(value2?.prototype?.constructor?.name); + const value = isConstructor(itemFactory) ? (params) => new itemFactory().set(params) : itemFactory; + Object.defineProperty(this, "itemFactory", { value, enumerable: false, configurable: false }); + this.set(properties); + } + set(properties) { + if (isArray(properties)) { + this.length = properties.length; + for (let i = 0; i < properties.length; i++) { + this[i] = this.itemFactory(properties[i]); + } + } + return this; + } + reset(properties) { + if (Array.isArray(properties)) { + return new _PropertiesArray(this.itemFactory, ...properties); + } + } + toJson() { + return this.map((value) => value?.toJson?.() ?? value); + } +}; +function isProperties(value) { + return value instanceof BaseProperties || value instanceof PropertiesArray; +} + +// packages/ag-charts-community/src/scene/gradient/stops.ts +var StopProperties = class extends BaseProperties { + constructor() { + super(...arguments); + this.color = "black"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], StopProperties.prototype, "stop", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], StopProperties.prototype, "color", 2); +function stopsAreAscending(fills) { + let currentStop; + for (const fill of fills) { + if (fill?.stop == null) + continue; + if (currentStop != null && fill.stop < currentStop) { + return false; + } + currentStop = fill.stop; + } + return true; +} +function discreteColorStops(colorStops) { + return colorStops.flatMap((colorStop2, i) => { + const { stop } = colorStop2; + const nextColor = colorStops.at(i + 1)?.color; + return nextColor == null ? [colorStop2] : [colorStop2, { stop, color: nextColor }]; + }); +} +function getDefaultColorStops(defaultColorStops, fillMode) { + const stopOffset = fillMode === "discrete" ? 1 : 0; + const colorStops = defaultColorStops.map( + (color2, index, { length: length2 }) => ({ + stop: (index + stopOffset) / (length2 - 1 + stopOffset), + color: color2 + }) + ); + return fillMode === "discrete" ? discreteColorStops(colorStops) : colorStops; +} +function getColorStops(baseFills, defaultColorStops, domain, fillMode = "continuous") { + const fills = baseFills.map((fill) => typeof fill === "string" ? { color: fill } : fill); + if (fills.length === 0) { + return getDefaultColorStops(defaultColorStops, fillMode); + } else if (!stopsAreAscending(fills)) { + logger_exports.warnOnce(`[fills] must have the stops defined in ascending order`); + return []; + } + const d0 = Math.min(...domain); + const d1 = Math.max(...domain); + const isDiscrete = fillMode === "discrete"; + const stops = new Float64Array(fills.length); + let previousDefinedStopIndex = 0; + let nextDefinedStopIndex = -1; + for (let i = 0; i < fills.length; i += 1) { + const colorStop2 = fills[i]; + if (i >= nextDefinedStopIndex) { + nextDefinedStopIndex = fills.length - 1; + for (let j = i + 1; j < fills.length; j += 1) { + if (fills[j]?.stop != null) { + nextDefinedStopIndex = j; + break; + } + } + } + let stop = colorStop2?.stop; + if (stop == null) { + const stop0 = fills[previousDefinedStopIndex]?.stop; + const stop1 = fills[nextDefinedStopIndex]?.stop; + const value0 = stop0 ?? d0; + const value1 = stop1 ?? d1; + const stopOffset = isDiscrete && stop0 == null ? 1 : 0; + stop = value0 + (value1 - value0) * (i - previousDefinedStopIndex + stopOffset) / (nextDefinedStopIndex - previousDefinedStopIndex + stopOffset); + } else { + previousDefinedStopIndex = i; + } + stops[i] = Math.max(0, Math.min(1, (stop - d0) / (d1 - d0))); + } + let lastDefinedColor = fills.find((c) => c.color != null)?.color; + let colorScale; + const colorStops = fills.map((fill, i) => { + let color2 = fill?.color; + const stop = stops[i]; + if (color2 != null) { + lastDefinedColor = color2; + } else if (lastDefinedColor == null) { + if (colorScale == null) { + colorScale = new ColorScale(); + colorScale.domain = [0, 1]; + colorScale.range = defaultColorStops; + } + color2 = colorScale.convert(stop); + } else { + color2 = lastDefinedColor; + } + return { stop, color: color2 }; + }); + return fillMode === "discrete" ? discreteColorStops(colorStops) : colorStops; +} + +// packages/ag-charts-community/src/scene/image/image.ts +var Image2 = class { + constructor(imageLoader, imageOptions) { + this.imageLoader = imageLoader; + this._cache = void 0; + this.url = imageOptions.url; + this.backgroundFill = imageOptions.backgroundFill ?? "black"; + this.backgroundFillOpacity = imageOptions.backgroundFillOpacity ?? 1; + this.repeat = imageOptions.repeat ?? "no-repeat"; + this.width = imageOptions.width; + this.height = imageOptions.height; + this.fit = imageOptions.fit ?? "stretch"; + this.rotation = imageOptions.rotation ?? 0; + } + createCanvasImage(ctx, image, width2, height2) { + if (!image) + return null; + const [renderedWidth, renderedHeight] = this.getSize(image.width, image.height, width2, height2); + if (renderedWidth < 1 || renderedHeight < 1) { + logger_exports.warnOnce("Image fill is too small to render, ignoring."); + return null; + } + return ctx.createPattern(image, this.repeat); + } + getSize(imageWidth, imageHeight, width2, height2) { + const { fit } = this; + let dw = imageWidth; + let dh = imageHeight; + let scale2 = 1; + const shapeAspectRatio = width2 / height2; + const imageAspectRatio = imageWidth / imageHeight; + if (fit === "stretch" || imageWidth === 0 || imageHeight === 0) { + dw = width2; + dh = height2; + } else if (fit === "contain") { + scale2 = imageAspectRatio > shapeAspectRatio ? width2 / imageWidth : height2 / imageHeight; + } else if (fit === "cover") { + scale2 = imageAspectRatio > shapeAspectRatio ? height2 / imageHeight : width2 / imageWidth; + } + return [Math.max(1, dw * scale2), Math.max(1, dh * scale2)]; + } + setImageTransform(pattern, bbox) { + if (typeof pattern === "string") + return; + const { url, rotation, width: width2, height: height2 } = this; + const image = this.imageLoader?.loadImage(url); + if (!image) { + return; + } + const angle2 = normalizeAngle360FromDegrees(rotation); + const cos = Math.cos(angle2); + const sin = Math.sin(angle2); + const [renderedWidth, renderedHeight] = this.getSize( + image.width, + image.height, + width2 ?? bbox.width, + height2 ?? bbox.height + ); + const widthScale = renderedWidth / image.width; + const heightScale = renderedHeight / image.height; + const bboxCenterX = bbox.x + bbox.width / 2; + const bboxCenterY = bbox.y + bbox.height / 2; + const rotatedW = cos * renderedWidth - sin * renderedHeight; + const rotatedH = sin * renderedWidth + cos * renderedHeight; + const shapeCenterX = rotatedW / 2; + const shapeCenterY = rotatedH / 2; + pattern?.setTransform( + new DOMMatrix([ + cos * widthScale, + sin * heightScale, + -sin * widthScale, + cos * heightScale, + bboxCenterX - shapeCenterX, + bboxCenterY - shapeCenterY + ]) + ); + } + createPattern(ctx, shapeWidth, shapeHeight, node) { + const width2 = this.width ?? shapeWidth; + const height2 = this.height ?? shapeHeight; + const cache = this._cache; + if (cache != null && cache.ctx === ctx && cache.width === width2 && cache.height === height2) { + return cache.pattern; + } + const image = this.imageLoader?.loadImage(this.url, node); + const pattern = this.createCanvasImage(ctx, image, width2, height2); + if (pattern == null) + return; + this._cache = { ctx, pattern, width: width2, height: height2 }; + return pattern; + } + toSvg(bbox, pixelRatio) { + const { url, rotation, backgroundFill, backgroundFillOpacity } = this; + const { x, y, width: width2, height: height2 } = bbox; + const pattern = createSvgElement("pattern"); + pattern.setAttribute("viewBox", `0 0 ${width2} ${height2}`); + pattern.setAttribute("x", String(x)); + pattern.setAttribute("y", String(y)); + pattern.setAttribute("width", String(width2)); + pattern.setAttribute("height", String(height2)); + pattern.setAttribute("patternUnits", "userSpaceOnUse"); + const rect2 = createSvgElement("rect"); + rect2.setAttribute("x", "0"); + rect2.setAttribute("y", "0"); + rect2.setAttribute("width", String(width2)); + rect2.setAttribute("height", String(height2)); + rect2.setAttribute("fill", backgroundFill); + rect2.setAttribute("fill-opacity", String(backgroundFillOpacity)); + pattern.appendChild(rect2); + const image = createSvgElement("image"); + image.setAttribute("href", url); + image.setAttribute("x", "0"); + image.setAttribute("y", "0"); + image.setAttribute("width", String(width2)); + image.setAttribute("height", String(height2)); + image.setAttribute("preserveAspectRatio", "none"); + image.setAttribute("transform", `scale(${1 / pixelRatio}) rotate(${rotation}, ${width2 / 2}, ${height2 / 2})`); + pattern.appendChild(image); + return pattern; + } +}; + +// packages/ag-charts-community/src/util/distance.ts +function pointsDistanceSquared(x1, y1, x2, y2) { + const dx2 = x1 - x2; + const dy2 = y1 - y2; + return dx2 * dx2 + dy2 * dy2; +} +function lineDistanceSquared(x, y, x1, y1, x2, y2, best) { + if (x1 === x2 && y1 === y2) { + return Math.min(best, pointsDistanceSquared(x, y, x1, y1)); + } + const dx2 = x2 - x1; + const dy2 = y2 - y1; + const t = Math.max(0, Math.min(1, ((x - x1) * dx2 + (y - y1) * dy2) / (dx2 * dx2 + dy2 * dy2))); + const ix = x1 + t * dx2; + const iy = y1 + t * dy2; + return Math.min(best, pointsDistanceSquared(x, y, ix, iy)); +} + +// packages/ag-charts-community/src/util/svg.ts +var commandEx = /^[\t\n\f\r ]*([achlmqstvz])[\t\n\f\r ]*/i; +var coordinateEx = /^[+-]?((\d*\.\d+)|(\d+\.)|(\d+))(e[+-]?\d+)?/i; +var commaEx = /[\t\n\f\r ]*,?[\t\n\f\r ]*/; +var flagEx = /^[01]/; +var pathParams = { + z: [], + h: [coordinateEx], + v: [coordinateEx], + m: [coordinateEx, coordinateEx], + l: [coordinateEx, coordinateEx], + t: [coordinateEx, coordinateEx], + s: [coordinateEx, coordinateEx, coordinateEx, coordinateEx], + q: [coordinateEx, coordinateEx, coordinateEx, coordinateEx], + c: [coordinateEx, coordinateEx, coordinateEx, coordinateEx, coordinateEx, coordinateEx], + a: [coordinateEx, coordinateEx, coordinateEx, flagEx, flagEx, coordinateEx, coordinateEx] +}; +function parseSvg(d) { + if (!d) + return; + const segments = []; + let i = 0; + let currentCommand; + while (i < d.length) { + const commandMatch = commandEx.exec(d.slice(i)); + let command; + if (commandMatch == null) { + if (!currentCommand) { + logger_exports.warnOnce(`Invalid SVG path, error at index ${i}: Missing command.`); + return; + } + command = currentCommand; + } else { + command = commandMatch[1]; + i += commandMatch[0].length; + } + const segment = parseSegment(command, d, i); + if (!segment) + return; + i = segment[0]; + currentCommand = command; + segments.push(segment[1]); + } + return segments; +} +function parseSegment(command, d, index) { + const params = pathParams[command.toLocaleLowerCase()]; + const pathSeg = { command, params: [] }; + for (const regex of params) { + const segment = d.slice(index); + const match = regex.exec(segment); + if (match != null) { + pathSeg.params.push(Number.parseFloat(match[0])); + index += match[0].length; + const next = commaEx.exec(segment.slice(match[0].length)); + if (next != null) { + index += next[0].length; + } + } else if (pathSeg.params.length === 1) { + return [index, pathSeg]; + } else { + logger_exports.warnOnce( + `Invalid SVG path, error at index ${index}: No path segment parameters for command [${command}]` + ); + return; + } + } + return [index, pathSeg]; +} + +// packages/ag-charts-community/src/scene/polyRoots.ts +function linearRoot(a, b) { + const t = -b / a; + return a !== 0 && t >= 0 && t <= 1 ? [t] : []; +} +function quadraticRoots(a, b, c, delta4 = 1e-6) { + if (Math.abs(a) < delta4) { + return linearRoot(b, c); + } + const D = b * b - 4 * a * c; + const roots = []; + if (Math.abs(D) < delta4) { + const t = -b / (2 * a); + if (t >= 0 && t <= 1) { + roots.push(t); + } + } else if (D > 0) { + const rD = Math.sqrt(D); + const t1 = (-b - rD) / (2 * a); + const t2 = (-b + rD) / (2 * a); + if (t1 >= 0 && t1 <= 1) { + roots.push(t1); + } + if (t2 >= 0 && t2 <= 1) { + roots.push(t2); + } + } + return roots; +} +function cubicRoots(a, b, c, d, delta4 = 1e-6) { + if (Math.abs(a) < delta4) { + return quadraticRoots(b, c, d, delta4); + } + const A = b / a; + const B = c / a; + const C2 = d / a; + const Q = (3 * B - A * A) / 9; + const R = (9 * A * B - 27 * C2 - 2 * A * A * A) / 54; + const D = Q * Q * Q + R * R; + const third = 1 / 3; + const roots = []; + if (D >= 0) { + const rD = Math.sqrt(D); + const S = Math.sign(R + rD) * Math.pow(Math.abs(R + rD), third); + const T = Math.sign(R - rD) * Math.pow(Math.abs(R - rD), third); + const Im = Math.abs(Math.sqrt(3) * (S - T) / 2); + const t = -third * A + (S + T); + if (t >= 0 && t <= 1) { + roots.push(t); + } + if (Math.abs(Im) < delta4) { + const t2 = -third * A - (S + T) / 2; + if (t2 >= 0 && t2 <= 1) { + roots.push(t2); + } + } + } else { + const theta = Math.acos(R / Math.sqrt(-Q * Q * Q)); + const thirdA = third * A; + const twoSqrtQ = 2 * Math.sqrt(-Q); + const t1 = twoSqrtQ * Math.cos(third * theta) - thirdA; + const t2 = twoSqrtQ * Math.cos(third * (theta + 2 * Math.PI)) - thirdA; + const t3 = twoSqrtQ * Math.cos(third * (theta + 4 * Math.PI)) - thirdA; + if (t1 >= 0 && t1 <= 1) { + roots.push(t1); + } + if (t2 >= 0 && t2 <= 1) { + roots.push(t2); + } + if (t3 >= 0 && t3 <= 1) { + roots.push(t3); + } + } + return roots; +} + +// packages/ag-charts-community/src/scene/intersection.ts +function segmentIntersection(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) { + const d = (ax2 - ax1) * (by2 - by1) - (ay2 - ay1) * (bx2 - bx1); + if (d === 0) { + return 0; + } + const ua = ((bx2 - bx1) * (ay1 - by1) - (ax1 - bx1) * (by2 - by1)) / d; + const ub = ((ax2 - ax1) * (ay1 - by1) - (ay2 - ay1) * (ax1 - bx1)) / d; + if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) { + return 1; + } + return 0; +} +function cubicSegmentIntersections(px1, py1, px2, py2, px3, py3, px4, py4, x1, y1, x2, y2) { + let intersections = 0; + const A = y1 - y2; + const B = x2 - x1; + const C2 = x1 * (y2 - y1) - y1 * (x2 - x1); + const bx = bezierCoefficients(px1, px2, px3, px4); + const by = bezierCoefficients(py1, py2, py3, py4); + const a = A * bx[0] + B * by[0]; + const b = A * bx[1] + B * by[1]; + const c = A * bx[2] + B * by[2]; + const d = A * bx[3] + B * by[3] + C2; + const roots = cubicRoots(a, b, c, d); + for (const t of roots) { + const tt = t * t; + const ttt = t * tt; + const x = bx[0] * ttt + bx[1] * tt + bx[2] * t + bx[3]; + const y = by[0] * ttt + by[1] * tt + by[2] * t + by[3]; + let s; + if (x1 === x2) { + s = (y - y1) / (y2 - y1); + } else { + s = (x - x1) / (x2 - x1); + } + if (s >= 0 && s <= 1) { + intersections++; + } + } + return intersections; +} +function bezierCoefficients(P1, P2, P3, P4) { + return [ + // Bézier expressed as matrix operations: + // |-1 3 -3 1| |P1| + // [t^3 t^2 t 1] | 3 -6 3 0| |P2| + // |-3 3 0 0| |P3| + // | 1 0 0 0| |P4| + -P1 + 3 * P2 - 3 * P3 + P4, + 3 * P1 - 6 * P2 + 3 * P3, + -3 * P1 + 3 * P2, + P1 + ]; +} + +// packages/ag-charts-community/src/scene/util/bezier.ts +function evaluateBezier(p0, p1, p2, p3, t) { + return (1 - t) ** 3 * p0 + 3 * (1 - t) ** 2 * t * p1 + 3 * (1 - t) * t ** 2 * p2 + t ** 3 * p3; +} +function solveBezier(p0, p1, p2, p3, value) { + if (value <= Math.min(p0, p3)) { + return p0 < p3 ? 0 : 1; + } else if (value >= Math.max(p0, p3)) { + return p0 < p3 ? 1 : 0; + } + let t0 = 0; + let t1 = 1; + let t = Number.NaN; + for (let i = 0; i < 12; i += 1) { + t = (t0 + t1) / 2; + const curveValue = evaluateBezier(p0, p1, p2, p3, t); + if (curveValue < value) { + t0 = t; + } else { + t1 = t; + } + } + return t; +} +function splitBezier2D(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y, t) { + const x01 = (1 - t) * p0x + t * p1x; + const y01 = (1 - t) * p0y + t * p1y; + const x12 = (1 - t) * p1x + t * p2x; + const y12 = (1 - t) * p1y + t * p2y; + const x23 = (1 - t) * p2x + t * p3x; + const y23 = (1 - t) * p2y + t * p3y; + const x012 = (1 - t) * x01 + t * x12; + const y012 = (1 - t) * y01 + t * y12; + const x123 = (1 - t) * x12 + t * x23; + const y123 = (1 - t) * y12 + t * y23; + const x0123 = (1 - t) * x012 + t * x123; + const y0123 = (1 - t) * y012 + t * y123; + return [ + [ + { x: p0x, y: p0y }, + { x: x01, y: y01 }, + { x: x012, y: y012 }, + { x: x0123, y: y0123 } + ], + [ + { x: x0123, y: y0123 }, + { x: x123, y: y123 }, + { x: x23, y: y23 }, + { x: p3x, y: p3y } + ] + ]; +} +function calculateDerivativeExtrema(p0, p1, p2, p3) { + const a = -p0 + 3 * p1 - 3 * p2 + p3; + const b = 2 * (p0 - 2 * p1 + p2); + const c = -p0 + p1; + if (a === 0) { + if (b !== 0) { + const t = -c / b; + if (t > 0 && t < 1) { + return [t]; + } + } + return []; + } + const discriminant = b * b - 4 * a * c; + if (discriminant >= 0) { + const sqrtDiscriminant = Math.sqrt(discriminant); + const t1 = (-b + sqrtDiscriminant) / (2 * a); + const t2 = (-b - sqrtDiscriminant) / (2 * a); + return [t1, t2].filter((t) => t > 0 && t < 1); + } + return []; +} +function bezier2DExtrema(cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y) { + const tx = calculateDerivativeExtrema(cp0x, cp1x, cp2x, cp3x); + const ty = calculateDerivativeExtrema(cp0y, cp1y, cp2y, cp3y); + return [...tx, ...ty]; +} +function bezierCandidate(points, x, y) { + const midX = evaluateBezier(points[0].x, points[1].x, points[2].x, points[3].x, 0.5); + const midY = evaluateBezier(points[0].y, points[1].y, points[2].y, points[3].y, 0.5); + const distance2 = Math.hypot(midX - x, midY - y); + const minDistance = Math.min( + Math.hypot(points[0].x - x, points[0].y - y), + Math.hypot(points[1].x - x, points[1].y - y), + Math.hypot(points[2].x - x, points[2].y - y), + Math.hypot(points[3].x - x, points[3].y - y) + ); + return { points, distance: distance2, minDistance }; +} +function bezier2DDistance(cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y, x, y, precision = 1) { + const points0 = [ + { x: cp0x, y: cp0y }, + { x: cp1x, y: cp1y }, + { x: cp2x, y: cp2y }, + { x: cp3x, y: cp3y } + ]; + let queue = { + value: bezierCandidate(points0, x, y), + next: null + }; + let bestResult; + while (queue != null) { + const { points, distance: distance2, minDistance } = queue.value; + queue = queue.next; + if (bestResult == null || distance2 < bestResult.distance) { + bestResult = { distance: distance2, minDistance }; + } + if (bestResult != null && bestResult.distance - minDistance <= precision) { + continue; + } + const [leftPoints, rightPoints] = splitBezier2D( + points[0].x, + points[0].y, + points[1].x, + points[1].y, + points[2].x, + points[2].y, + points[3].x, + points[3].y, + 0.5 + ); + const newCandidates = [bezierCandidate(leftPoints, x, y), bezierCandidate(rightPoints, x, y)].sort( + bezierCandidateCmp + ); + queue = insertListItemsSorted(queue, newCandidates, bezierCandidateCmp); + } + return bestResult?.distance ?? Infinity; +} +var bezierCandidateCmp = (a, b) => b.minDistance - a.minDistance; + +// packages/ag-charts-community/src/scene/extendedPath2D.ts +var ExtendedPath2D = class { + constructor() { + // The methods of this class will likely be called many times per animation frame, + // and any allocation can trigger a GC cycle during animation, so we attempt + // to minimize the number of allocations. + this.path2d = new Path2D(); + this.previousCommands = []; + this.previousParams = []; + this.previousClosedPath = false; + this.commands = []; + this.params = []; + this.cx = Number.NaN; + this.cy = Number.NaN; + this.sx = Number.NaN; + this.sy = Number.NaN; + this.openedPath = false; + this.closedPath = false; + } + isEmpty() { + return this.commands.length === 0; + } + isDirty() { + return this.closedPath !== this.previousClosedPath || this.previousCommands.length !== this.commands.length || this.previousParams.length !== this.params.length || this.previousCommands.toString() !== this.commands.toString() || this.previousParams.toString() !== this.params.toString(); + } + getPath2D() { + return this.path2d; + } + moveTo(x, y) { + this.openedPath = true; + this.sx = x; + this.sy = y; + this.cx = x; + this.cy = y; + this.path2d.moveTo(x, y); + this.commands.push(0 /* Move */); + this.params.push(x, y); + } + lineTo(x, y) { + if (this.openedPath) { + this.cx = x; + this.cy = y; + this.path2d.lineTo(x, y); + this.commands.push(1 /* Line */); + this.params.push(x, y); + } else { + this.moveTo(x, y); + } + } + cubicCurveTo(cx1, cy1, cx2, cy2, x, y) { + if (!this.openedPath) { + this.moveTo(cx1, cy1); + } + this.path2d.bezierCurveTo(cx1, cy1, cx2, cy2, x, y); + this.commands.push(2 /* Curve */); + this.params.push(cx1, cy1, cx2, cy2, x, y); + } + closePath() { + if (this.openedPath) { + this.cx = this.sx; + this.cy = this.sy; + this.sx = Number.NaN; + this.sy = Number.NaN; + this.path2d.closePath(); + this.commands.push(3 /* ClosePath */); + this.openedPath = false; + this.closedPath = true; + } + } + rect(x, y, width2, height2) { + this.moveTo(x, y); + this.lineTo(x + width2, y); + this.lineTo(x + width2, y + height2); + this.lineTo(x, y + height2); + this.closePath(); + } + roundRect(x, y, width2, height2, radii) { + radii = Math.min(radii, width2 / 2, height2 / 2); + this.moveTo(x, y + radii); + this.arc(x + radii, y + radii, radii, Math.PI, 1.5 * Math.PI); + this.lineTo(x + radii, y); + this.lineTo(x + width2 - radii, y); + this.arc(x + width2 - radii, y + radii, radii, 1.5 * Math.PI, 2 * Math.PI); + this.lineTo(x + width2, y + radii); + this.lineTo(x + width2, y + height2 - radii); + this.arc(x + width2 - radii, y + height2 - radii, radii, 0, Math.PI / 2); + this.lineTo(x + width2 - radii, y + height2); + this.lineTo(x + radii, y + height2); + this.arc(x + +radii, y + height2 - radii, radii, Math.PI / 2, Math.PI); + this.lineTo(x, y + height2 - radii); + this.closePath(); + } + ellipse(cx, cy, rx, ry, rotation, sAngle, eAngle, counterClockwise = false) { + const r = rx; + const scaleY = ry / rx; + const mxx = Math.cos(rotation); + const myx = Math.sin(rotation); + const mxy = -scaleY * myx; + const myy = scaleY * mxx; + const x0 = r * Math.cos(sAngle); + const y0 = r * Math.sin(sAngle); + const sx = cx + mxx * x0 + mxy * y0; + const sy = cy + myx * x0 + myy * y0; + const distanceSquared2 = (sx - this.cx) ** 2 + (sy - this.cy) ** 2; + if (!this.openedPath) { + this.moveTo(sx, sy); + } else if (distanceSquared2 > 1e-6) { + this.lineTo(sx, sy); + } + let sweep = counterClockwise ? -normalizeAngle360(sAngle - eAngle) : normalizeAngle360(eAngle - sAngle); + if (Math.abs(Math.abs(eAngle - sAngle) - 2 * Math.PI) < 1e-6 && sweep < 2 * Math.PI) { + sweep += 2 * Math.PI * (counterClockwise ? -1 : 1); + } + const arcSections = Math.max(Math.ceil(Math.abs(sweep) / (Math.PI / 2)), 1); + const step = sweep / arcSections; + const h = 4 / 3 * Math.tan(step / 4); + for (let i = 0; i < arcSections; i += 1) { + const a0 = sAngle + step * (i + 0); + const a1 = sAngle + step * (i + 1); + const rSinStart = r * Math.sin(a0); + const rCosStart = r * Math.cos(a0); + const rSinEnd = r * Math.sin(a1); + const rCosEnd = r * Math.cos(a1); + const cp1x = rCosStart - h * rSinStart; + const cp1y = rSinStart + h * rCosStart; + const cp2x = rCosEnd + h * rSinEnd; + const cp2y = rSinEnd - h * rCosEnd; + const cp3x = rCosEnd; + const cp3y = rSinEnd; + this.cubicCurveTo( + cx + mxx * cp1x + mxy * cp1y, + cy + myx * cp1x + myy * cp1y, + cx + mxx * cp2x + mxy * cp2y, + cy + myx * cp2x + myy * cp2y, + cx + mxx * cp3x + mxy * cp3y, + cy + myx * cp3x + myy * cp3y + ); + } + } + arc(x, y, r, sAngle, eAngle, counterClockwise) { + this.ellipse(x, y, r, r, 0, sAngle, eAngle, counterClockwise); + } + appendSvg(svg) { + const parts = parseSvg(svg); + if (parts == null) + return false; + let sx = 0; + let sy = 0; + let cx; + let cy; + let cpx = 0; + let cpy = 0; + for (const { command, params } of parts) { + cx ?? (cx = params[0]); + cy ?? (cy = params[1]); + const relative = command === command.toLowerCase(); + const dx2 = relative ? cx : 0; + const dy2 = relative ? cy : 0; + switch (command.toLowerCase()) { + case "m": + this.moveTo(dx2 + params[0], dy2 + params[1]); + cx = dx2 + params[0]; + cy = dy2 + params[1]; + sx = cx; + sy = cy; + break; + case "c": + this.cubicCurveTo( + dx2 + params[0], + dy2 + params[1], + dx2 + params[2], + dy2 + params[3], + dx2 + params[4], + dy2 + params[5] + ); + cpx = dx2 + params[2]; + cpy = dy2 + params[3]; + cx = dx2 + params[4]; + cy = dy2 + params[5]; + break; + case "s": + this.cubicCurveTo( + cx + cx - cpx, + cy + cy - cpy, + dx2 + params[0], + dy2 + params[1], + dx2 + params[2], + dy2 + params[3] + ); + cpx = dx2 + params[0]; + cpy = dy2 + params[1]; + cx = dx2 + params[2]; + cy = dy2 + params[3]; + break; + case "q": + this.cubicCurveTo( + (dx2 + 2 * params[0]) / 3, + (dy2 + 2 * params[1]) / 3, + (2 * params[0] + params[2]) / 3, + (2 * params[1] + params[3]) / 3, + params[2], + params[3] + ); + cpx = params[0]; + cpy = params[1]; + cx = params[2]; + cy = params[3]; + break; + case "t": + this.cubicCurveTo( + (cx + 2 * (cx + cx - cpx)) / 3, + (cy + 2 * (cy + cy - cpy)) / 3, + (2 * (cx + cx - cpx) + params[0]) / 3, + (2 * (cy + cy - cpy) + params[1]) / 3, + params[0], + params[1] + ); + cpx = cx + cx - cpx; + cpy = cy + cy - cpy; + cx = params[0]; + cy = params[1]; + break; + case "a": + this.svgEllipse( + cx, + cy, + params[0], + params[1], + params[2] * Math.PI / 180, + params[3], + params[4], + dx2 + params[5], + dy2 + params[6] + ); + cx = dx2 + params[5]; + cy = dy2 + params[6]; + break; + case "h": + this.lineTo(dx2 + params[0], cy); + cx = dx2 + params[0]; + break; + case "l": + this.lineTo(dx2 + params[0], dy2 + params[1]); + cx = dx2 + params[0]; + cy = dy2 + params[1]; + break; + case "v": + this.lineTo(cx, dy2 + params[0]); + cy = dy2 + params[0]; + break; + case "z": + this.closePath(); + cx = sx; + cy = sy; + break; + default: + throw new Error(`Could not translate command '${command}' with '${params.join(" ")}'`); + } + } + return true; + } + svgEllipse(x1, y1, rx, ry, rotation, fA, fS, x2, y2) { + rx = Math.abs(rx); + ry = Math.abs(ry); + const dx2 = (x1 - x2) / 2; + const dy2 = (y1 - y2) / 2; + const sin = Math.sin(rotation); + const cos = Math.cos(rotation); + const rotX = cos * dx2 + sin * dy2; + const rotY = -sin * dx2 + cos * dy2; + const normX = rotX / rx; + const normY = rotY / ry; + let scale2 = normX * normX + normY * normY; + let cx = (x1 + x2) / 2; + let cy = (y1 + y2) / 2; + let cpx = 0; + let cpy = 0; + if (scale2 >= 1) { + scale2 = Math.sqrt(scale2); + rx *= scale2; + ry *= scale2; + } else { + scale2 = Math.sqrt(1 / scale2 - 1); + if (fA === fS) + scale2 = -scale2; + cpx = scale2 * rx * normY; + cpy = -scale2 * ry * normX; + cx += cos * cpx - sin * cpy; + cy += sin * cpx + cos * cpy; + } + const sAngle = Math.atan2((rotY - cpy) / ry, (rotX - cpx) / rx); + const deltaTheta = Math.atan2((-rotY - cpy) / ry, (-rotX - cpx) / rx) - sAngle; + const eAngle = sAngle + deltaTheta; + const counterClockwise = !!(1 - fS); + this.ellipse(cx, cy, rx, ry, rotation, sAngle, eAngle, counterClockwise); + } + clear(trackChanges) { + if (trackChanges) { + this.previousCommands = this.commands; + this.previousParams = this.params; + this.previousClosedPath = this.closedPath; + } + this.path2d = new Path2D(); + this.openedPath = false; + this.closedPath = false; + this.commands = []; + this.params = []; + } + isPointInPath(x, y) { + const commands = this.commands; + const params = this.params; + const cn = commands.length; + const ox = -1e4; + const oy = -1e4; + let sx = Number.NaN; + let sy = Number.NaN; + let px = 0; + let py = 0; + let intersectionCount = 0; + for (let ci = 0, pi = 0; ci < cn; ci++) { + switch (commands[ci]) { + case 0 /* Move */: + intersectionCount += segmentIntersection(sx, sy, px, py, ox, oy, x, y); + px = params[pi++]; + sx = px; + py = params[pi++]; + sy = py; + break; + case 1 /* Line */: + intersectionCount += segmentIntersection(px, py, params[pi++], params[pi++], ox, oy, x, y); + px = params[pi - 2]; + py = params[pi - 1]; + break; + case 2 /* Curve */: + intersectionCount += cubicSegmentIntersections( + px, + py, + params[pi++], + params[pi++], + params[pi++], + params[pi++], + params[pi++], + params[pi++], + ox, + oy, + x, + y + ); + px = params[pi - 2]; + py = params[pi - 1]; + break; + case 3 /* ClosePath */: + intersectionCount += segmentIntersection(sx, sy, px, py, ox, oy, x, y); + break; + } + } + return intersectionCount % 2 === 1; + } + distanceSquared(x, y) { + let best = Infinity; + const commands = this.commands; + const params = this.params; + const cn = commands.length; + let sx = Number.NaN; + let sy = Number.NaN; + let cx = 0; + let cy = 0; + for (let ci = 0, pi = 0; ci < cn; ci++) { + switch (commands[ci]) { + case 0 /* Move */: + cx = sx = params[pi++]; + cy = sy = params[pi++]; + break; + case 1 /* Line */: { + const x0 = cx; + const y0 = cy; + cx = params[pi++]; + cy = params[pi++]; + best = lineDistanceSquared(x, y, x0, y0, cx, cy, best); + break; + } + case 2 /* Curve */: { + const cp0x = cx; + const cp0y = cy; + const cp1x = params[pi++]; + const cp1y = params[pi++]; + const cp2x = params[pi++]; + const cp2y = params[pi++]; + cx = params[pi++]; + cy = params[pi++]; + best = bezier2DDistance(cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cx, cy, x, y) ** 2; + break; + } + case 3 /* ClosePath */: + best = lineDistanceSquared(x, y, cx, cy, sx, sy, best); + break; + } + } + return best; + } + // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d + toSVG(transform = (x, y) => ({ x, y })) { + const buffer = []; + const { commands, params } = this; + const addCommand = (command, count) => { + buffer.push(command); + for (let i = 0; i < count; i += 2) { + const { x, y } = transform(params[pi++], params[pi++]); + buffer.push(x, y); + } + }; + let pi = 0; + for (const command of commands) { + switch (command) { + case 0 /* Move */: + addCommand("M", 2); + break; + case 1 /* Line */: + addCommand("L", 2); + break; + case 2 /* Curve */: + addCommand("C", 6); + break; + case 3 /* ClosePath */: + addCommand("Z", 0); + break; + } + } + return buffer.join(" "); + } + computeBBox() { + const { commands, params } = this; + let [top, left, right, bot] = [Infinity, Infinity, -Infinity, -Infinity]; + let [cx, cy] = [Number.NaN, Number.NaN]; + let [sx, sy] = [Number.NaN, Number.NaN]; + const joinPoint = (x, y) => { + top = Math.min(y, top); + left = Math.min(x, left); + right = Math.max(x, right); + bot = Math.max(y, bot); + cx = x; + cy = y; + }; + let pi = 0; + for (const command of commands) { + switch (command) { + case 0 /* Move */: + joinPoint(params[pi++], params[pi++]); + sx = cx; + sy = cy; + break; + case 1 /* Line */: + joinPoint(params[pi++], params[pi++]); + break; + case 2 /* Curve */: { + const cp0x = cx; + const cp0y = cy; + const cp1x = params[pi++]; + const cp1y = params[pi++]; + const cp2x = params[pi++]; + const cp2y = params[pi++]; + const cp3x = params[pi++]; + const cp3y = params[pi++]; + const ts = bezier2DExtrema(cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y); + for (const t of ts) { + const px = evaluateBezier(cp0x, cp1x, cp2x, cp3x, t); + const py = evaluateBezier(cp0y, cp1y, cp2y, cp3y, t); + joinPoint(px, py); + } + joinPoint(cp3x, cp3y); + break; + } + case 3 /* ClosePath */: + joinPoint(sx, sy); + sx = Number.NaN; + sy = Number.NaN; + break; + } + } + return new BBox(left, top, right - left, bot - top); + } +}; + +// packages/ag-charts-community/src/scene/util/pixel.ts +function align(pixelRatio, start2, length2) { + const alignedStart = Math.round(start2 * pixelRatio) / pixelRatio; + if (length2 == null) { + return alignedStart; + } else if (length2 === 0) { + return 0; + } else if (length2 < 1) { + return Math.ceil(length2 * pixelRatio) / pixelRatio; + } + return Math.round((length2 + start2) * pixelRatio) / pixelRatio - alignedStart; +} +function alignBefore(pixelRatio, start2) { + return Math.floor(start2 * pixelRatio) / pixelRatio; +} + +// packages/ag-charts-community/src/scene/pattern/patterns.ts +function drawPatternUnitPolygon(path, params, moves) { + const { width: width2, height: height2, padding: padding2, strokeWidth } = params; + const x0 = width2 / 2; + const y0 = height2 / 2; + const w = Math.max(1, width2 - padding2 - strokeWidth / 2); + const h = Math.max(1, height2 - padding2 - strokeWidth / 2); + let didMove = false; + for (const [dx2, dy2] of moves) { + const x = x0 + (dx2 - 0.5) * w; + const y = y0 + (dy2 - 0.5) * h; + if (didMove) { + path.lineTo(x, y); + } else { + path.moveTo(x, y); + } + didMove = true; + } + path.closePath(); +} +var PATTERNS = { + circles(path, { width: width2, strokeWidth, padding: padding2 }) { + const c = width2 / 2; + const r = Math.max(1, c - padding2 - strokeWidth / 2); + path.arc(c, c, r, 0, Math.PI * 2); + }, + squares(path, { width: width2, height: height2, pixelRatio, padding: padding2, strokeWidth }) { + const offset = padding2 + strokeWidth / 2; + path.moveTo(align(pixelRatio, offset), align(pixelRatio, offset)); + path.lineTo(align(pixelRatio, width2 - offset), align(pixelRatio, offset)); + path.lineTo(align(pixelRatio, width2 - offset), align(pixelRatio, height2 - offset)); + path.lineTo(align(pixelRatio, offset), align(pixelRatio, height2 - offset)); + path.closePath(); + }, + triangles(path, params) { + drawPatternUnitPolygon(path, params, [ + [0.5, 0], + [1, 1], + [0, 1] + ]); + }, + diamonds(path, params) { + drawPatternUnitPolygon(path, params, [ + [0.5, 0], + [1, 0.5], + [0.5, 1], + [0, 0.5] + ]); + }, + stars(path, { width: width2, height: height2, padding: padding2 }) { + const spikes = 5; + const outerRadius = Math.max(1, (width2 - padding2) / 2); + const innerRadius = outerRadius / 2; + const rotation = Math.PI / 2; + for (let i = 0; i < spikes * 2; i++) { + const radius = i % 2 === 0 ? outerRadius : innerRadius; + const angle2 = i * Math.PI / spikes - rotation; + const xCoordinate = width2 / 2 + Math.cos(angle2) * radius; + const yCoordinate = height2 / 2 + Math.sin(angle2) * radius; + path.lineTo(xCoordinate, yCoordinate); + } + path.closePath(); + }, + hearts(path, { width: width2, height: height2, padding: padding2 }) { + const r = Math.max(1, width2 / 4 - padding2 / 2); + const x = width2 / 2; + const y = height2 / 2 + r / 2; + path.arc(x - r, y - r, r, toRadians(130), toRadians(330)); + path.arc(x + r, y - r, r, toRadians(220), toRadians(50)); + path.lineTo(x, y + r); + path.closePath(); + }, + crosses(path, params) { + drawPatternUnitPolygon(path, params, [ + [0.25, 0], + [0.5, 0.25], + [0.75, 0], + [1, 0.25], + [0.75, 0.5], + [1, 0.75], + [0.75, 1], + [0.5, 0.75], + [0.25, 1], + [0, 0.75], + [0.25, 0.5], + [0, 0.25] + ]); + }, + "vertical-lines"(path, { width: width2, height: height2, pixelRatio, strokeWidth }) { + const x = align(pixelRatio, width2 / 2) - strokeWidth % 2 / 2; + path.moveTo(x, 0); + path.lineTo(x, height2); + }, + "horizontal-lines"(path, { width: width2, height: height2, pixelRatio, strokeWidth }) { + const y = align(pixelRatio, height2 / 2) - strokeWidth % 2 / 2; + path.moveTo(0, y); + path.lineTo(width2, y); + }, + "forward-slanted-lines"(path, { width: width2, height: height2, strokeWidth }) { + const angle2 = Math.atan2(height2, width2); + const insetX = strokeWidth * Math.cos(angle2); + const insetY = strokeWidth * Math.sin(angle2); + path.moveTo(-insetX, insetY); + path.lineTo(insetX, -insetY); + path.moveTo(-insetX, height2 + insetY); + path.lineTo(width2 + insetX, -insetY); + path.moveTo(width2 - insetX, height2 + insetY); + path.lineTo(width2 + insetX, height2 - insetY); + }, + "backward-slanted-lines"(path, { width: width2, height: height2, strokeWidth }) { + const angle2 = Math.atan2(height2, width2); + const insetX = strokeWidth * Math.cos(angle2); + const insetY = strokeWidth * Math.sin(angle2); + path.moveTo(width2 - insetX, -insetY); + path.lineTo(width2 + insetX, insetY); + path.moveTo(-insetX, -insetY); + path.lineTo(width2 + insetX, height2 + insetY); + path.moveTo(-insetX, height2 - insetY); + path.lineTo(insetX, height2 + insetY); + } +}; + +// packages/ag-charts-community/src/scene/pattern/pattern.ts +var Pattern = class { + constructor(patternOptions) { + this._cache = void 0; + this.width = Math.max(patternOptions?.width ?? 10, 1); + this.height = Math.max(patternOptions?.height ?? 10, 1); + this.fill = patternOptions.fill ?? "none"; + this.fillOpacity = patternOptions.fillOpacity ?? 1; + this.backgroundFill = patternOptions.backgroundFill ?? "none"; + this.backgroundFillOpacity = patternOptions.backgroundFillOpacity ?? 1; + this.stroke = patternOptions.stroke ?? "black"; + this.strokeOpacity = patternOptions.strokeOpacity ?? 1; + this.strokeWidth = patternOptions.strokeWidth ?? 1; + this.padding = patternOptions.padding ?? 1; + this.pattern = patternOptions.pattern ?? "forward-slanted-lines"; + this.rotation = patternOptions.rotation ?? 0; + this.scale = patternOptions.scale ?? 1; + this.path = patternOptions.path; + } + getPath(pixelRatio) { + const { pattern, width: width2, height: height2, padding: padding2, strokeWidth, path: svgPath } = this; + const path = new ExtendedPath2D(); + let renderPattern = PATTERNS[pattern] != null; + if (svgPath) { + renderPattern && (renderPattern = !path.appendSvg(svgPath)); + } + if (renderPattern) { + PATTERNS[pattern](path, { width: width2, height: height2, pixelRatio, strokeWidth, padding: padding2 }); + } + return path; + } + renderStroke(path2d, ctx) { + const { stroke: stroke3, strokeWidth, strokeOpacity } = this; + if (!strokeWidth) + return; + ctx.strokeStyle = stroke3; + ctx.lineWidth = strokeWidth; + ctx.globalAlpha = strokeOpacity; + ctx.stroke(path2d); + } + renderFill(path2d, ctx) { + const { fill, fillOpacity } = this; + if (fill === "none") { + return; + } + ctx.fillStyle = fill; + ctx.globalAlpha = fillOpacity; + ctx.fill(path2d); + } + createCanvasPattern(ctx, pixelRatio) { + const { width: width2, height: height2, scale: scale2, backgroundFill, backgroundFillOpacity } = this; + if (width2 * scale2 < 1 || height2 * scale2 < 1) { + logger_exports.warnOnce("Pattern fill is too small to render, ignoring."); + return null; + } + const offscreenPattern = new HdpiOffscreenCanvas({ width: width2, height: height2, pixelRatio: pixelRatio * scale2 }); + const offscreenPatternCtx = offscreenPattern.context; + if (backgroundFill !== "none") { + offscreenPatternCtx.fillStyle = backgroundFill; + offscreenPatternCtx.globalAlpha = backgroundFillOpacity; + offscreenPatternCtx.fillRect(0, 0, width2, height2); + } + const path2d = this.getPath(pixelRatio).getPath2D(); + this.renderFill(path2d, offscreenPatternCtx); + this.renderStroke(path2d, offscreenPatternCtx); + const pattern = ctx.createPattern(offscreenPattern.canvas, "repeat"); + this.setPatternTransform(pattern, pixelRatio); + offscreenPattern.destroy(); + return pattern; + } + setPatternTransform(pattern, pixelRatio, tx = 0, ty = 0) { + if (pattern == null) + return; + const angle2 = normalizeAngle360FromDegrees(this.rotation); + const scale2 = 1 / pixelRatio; + const cos = Math.cos(angle2) * scale2; + const sin = Math.sin(angle2) * scale2; + pattern.setTransform(new DOMMatrix([cos, sin, -sin, cos, tx, ty])); + } + createPattern(ctx, pixelRatio) { + if (this._cache != null && this._cache.ctx === ctx && this._cache.pixelRatio === pixelRatio) { + return this._cache.pattern; + } + const pattern = this.createCanvasPattern(ctx, pixelRatio); + if (pattern == null) + return; + this._cache = { ctx, pattern, pixelRatio }; + return pattern; + } + toSvg() { + const { + width: width2, + height: height2, + fill, + fillOpacity, + backgroundFill, + backgroundFillOpacity, + stroke: stroke3, + strokeWidth, + strokeOpacity, + rotation, + scale: scale2 + } = this; + const pattern = createSvgElement("pattern"); + pattern.setAttribute("viewBox", `0 0 ${width2} ${height2}`); + pattern.setAttribute("width", String(width2)); + pattern.setAttribute("height", String(height2)); + pattern.setAttribute("patternUnits", "userSpaceOnUse"); + const rect2 = createSvgElement("rect"); + rect2.setAttribute("x", "0"); + rect2.setAttribute("y", "0"); + rect2.setAttribute("width", String(width2)); + rect2.setAttribute("height", String(height2)); + rect2.setAttribute("fill", backgroundFill); + rect2.setAttribute("fill-opacity", String(backgroundFillOpacity)); + pattern.appendChild(rect2); + const path = createSvgElement("path"); + path.setAttribute("fill", fill); + path.setAttribute("fill-opacity", String(fillOpacity)); + path.setAttribute("stroke-opacity", String(strokeOpacity)); + path.setAttribute("stroke", stroke3); + path.setAttribute("stroke-width", String(strokeWidth)); + path.setAttribute("transform", `rotate(${rotation}) scale(${scale2})`); + path.setAttribute("d", this.getPath(1).toSVG()); + pattern.appendChild(path); + return pattern; + } +}; + +// packages/ag-charts-community/src/scene/util/fill.ts +function isGradientFill(fill) { + return isObject(fill) && fill.type == "gradient"; +} +function isStringFillArray(fills) { + return isArray(fills) && fills.every((fill) => typeof fill === "string"); +} +function isPatternFill(fill) { + return fill !== null && isObject(fill) && fill.type == "pattern"; +} +function isImageFill(fill) { + return fill !== null && isObject(fill) && fill.type == "image"; +} +function isGradientOrPatternFill(fill) { + return isGradientFill(fill) || isPatternFill(fill); +} + +// packages/ag-charts-community/src/scene/shape/svgUtils.ts +function setSvgFontAttributes(element2, options) { + const { fontStyle, fontWeight, fontSize, fontFamily } = options; + if (fontStyle) + element2.setAttribute("font-style", fontStyle); + if (fontWeight) + element2.setAttribute("font-weight", String(fontWeight)); + if (fontSize != null) + element2.setAttribute("font-size", String(fontSize)); + if (fontFamily) + element2.setAttribute("font-family", fontFamily); +} +function setSvgStrokeAttributes(element2, options) { + const { stroke: stroke3, strokeWidth, strokeOpacity } = options; + if (stroke3) + element2.setAttribute("stroke", stroke3); + if (strokeWidth != null) + element2.setAttribute("stroke-width", String(strokeWidth)); + if (strokeOpacity != null) + element2.setAttribute("stroke-opacity", String(strokeOpacity)); +} +function setSvgLineDashAttributes(element2, options) { + const { lineDash, lineDashOffset } = options; + if (lineDash?.some((d) => d !== 0)) { + const lineDashArray = lineDash.length % 2 === 1 ? [...lineDash, ...lineDash] : lineDash; + element2.setAttribute("stroke-dasharray", lineDashArray.join(" ")); + if (lineDashOffset != null) + element2.setAttribute("stroke-dashoffset", String(lineDashOffset)); + } +} + +// packages/ag-charts-community/src/scene/shape/shape.ts +var Shape = class extends Node2 { + constructor() { + super(...arguments); + this.drawingMode = "overlay"; + this.fillOpacity = 1; + this.strokeOpacity = 1; + this.fill = "black"; + this.strokeWidth = 0; + this.lineDashOffset = 0; + this.opacity = 1; + } + getGradient(fill) { + if (isGradientFill(fill)) + return this.createGradient(fill); + } + createGradient(fill) { + const { colorSpace = "rgb", gradient: gradient2 = "linear", colorStops, rotation = 0, reverse = false } = fill; + if (colorStops == null) + return; + let stops = getColorStops(colorStops, ["black"], [0, 1]); + if (reverse) { + stops = stops.map((s) => ({ color: s.color, stop: 1 - s.stop })).reverse(); + } + switch (gradient2) { + case "linear": + return new LinearGradient(colorSpace, stops, rotation); + case "radial": + return new RadialGradient(colorSpace, stops); + case "conic": + return new ConicGradient(colorSpace, stops, rotation); + } + } + getPattern(fill) { + if (isPatternFill(fill)) + return this.createPattern(fill); + } + createPattern(fill) { + return new Pattern(fill); + } + getImage(fill) { + if (isImageFill(fill)) + return this.createImage(fill); + } + createImage(fill) { + return new Image2(this.imageLoader, fill); + } + onFillChange() { + if (typeof this.fill === "object") { + if (objectsEqual(this._cachedFill ?? {}, this.fill)) { + return; + } + } + this.fillGradient = this.getGradient(this.fill); + this.fillPattern = this.getPattern(this.fill); + this.fillImage = this.getImage(this.fill); + this._cachedFill = this.fill; + } + onStrokeChange() { + this.strokeGradient = this.getGradient(this.stroke); + } + /** + * Returns a device-pixel aligned coordinate (or length if length is supplied). + * + * NOTE: Not suitable for strokes, since the stroke needs to be offset to the middle + * of a device pixel. + */ + align(start2, length2) { + return align(this.layerManager?.canvas?.pixelRatio ?? 1, start2, length2); + } + markDirty(property) { + super.markDirty(property); + this.cachedDefaultGradientFillBBox = void 0; + } + fillStroke(ctx, path) { + if (this.drawingMode === "cutout") { + ctx.globalCompositeOperation = "destination-out"; + this.executeFill(ctx, path); + this.executeStroke(ctx, path); + ctx.globalCompositeOperation = "source-over"; + } + this.renderFill(ctx, path); + this.renderStroke(ctx, path); + } + renderFill(ctx, path) { + const { fill, fillOpacity, fillImage } = this; + if (fill != null && fill !== "none" && fillOpacity > 0) { + const { globalAlpha } = ctx; + if (fillImage) { + ctx.globalAlpha = fillImage.backgroundFillOpacity; + ctx.fillStyle = fillImage.backgroundFill; + this.executeFill(ctx, path); + ctx.globalAlpha = globalAlpha; + } + this.applyFillAndAlpha(ctx); + this.applyShadow(ctx); + this.executeFill(ctx, path); + ctx.globalAlpha = globalAlpha; + ctx.shadowColor = "rgba(0, 0, 0, 0)"; + } + } + executeFill(ctx, path) { + if (path) { + ctx.fill(path); + } else { + ctx.fill(); + } + } + applyFillAndAlpha(ctx) { + const { fill, fillGradient, fillPattern, fillImage, fillOpacity = 1, opacity = 1 } = this; + ctx.globalAlpha *= opacity * fillOpacity; + if (fillGradient) { + const { fillBBox = this.getDefaultGradientFillBBox() ?? this.getBBox(), fillParams } = this; + ctx.fillStyle = fillGradient.createGradient(ctx, fillBBox, fillParams) ?? "black"; + } else if (fillPattern) { + const { x, y } = this.getBBox(); + const pixelRatio = this.layerManager?.canvas?.pixelRatio ?? 1; + const pattern = fillPattern.createPattern(ctx, pixelRatio); + fillPattern.setPatternTransform(pattern, pixelRatio, x, y); + if (pattern) { + ctx.fillStyle = pattern; + } else { + ctx.fillStyle = fillPattern.fill; + ctx.globalAlpha *= fillPattern.fillOpacity; + } + } else if (fillImage) { + const bbox = this.getBBox(); + const image = fillImage.createPattern(ctx, bbox.width, bbox.height, this); + fillImage.setImageTransform(image, bbox); + ctx.fillStyle = image ?? "transparent"; + } else { + ctx.fillStyle = typeof fill === "string" ? fill : "black"; + } + } + applyStrokeAndAlpha(ctx) { + const { stroke: stroke3, strokeOpacity = 1, strokeGradient, opacity = 1 } = this; + ctx.strokeStyle = strokeGradient?.createGradient(ctx, this.getBBox()) ?? (typeof stroke3 === "string" ? stroke3 : void 0) ?? "black"; + ctx.globalAlpha *= opacity * strokeOpacity; + } + applyShadow(ctx) { + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const fillShadow = this.fillShadow; + if (fillShadow?.enabled) { + ctx.shadowColor = fillShadow.color; + ctx.shadowOffsetX = fillShadow.xOffset * pixelRatio; + ctx.shadowOffsetY = fillShadow.yOffset * pixelRatio; + ctx.shadowBlur = fillShadow.blur * pixelRatio; + } + } + renderStroke(ctx, path) { + const { stroke: stroke3, strokeWidth, strokeOpacity, lineDash, lineDashOffset, lineCap, lineJoin, miterLimit } = this; + if (stroke3 != null && stroke3 !== "none" && strokeWidth > 0 && strokeOpacity > 0) { + const { globalAlpha } = ctx; + this.applyStrokeAndAlpha(ctx); + ctx.lineWidth = strokeWidth; + if (lineDash) { + ctx.setLineDash(lineDash); + } + if (lineDashOffset) { + ctx.lineDashOffset = lineDashOffset; + } + if (lineCap) { + ctx.lineCap = lineCap; + } + if (lineJoin) { + ctx.lineJoin = lineJoin; + } + if (miterLimit != null) { + ctx.miterLimit = miterLimit; + } + this.executeStroke(ctx, path); + ctx.globalAlpha = globalAlpha; + } + } + executeStroke(ctx, path) { + if (path) { + ctx.stroke(path); + } else { + ctx.stroke(); + } + } + getDefaultGradientFillBBox() { + this.cachedDefaultGradientFillBBox ?? (this.cachedDefaultGradientFillBBox = Object.freeze(this.computeDefaultGradientFillBBox())); + return this.cachedDefaultGradientFillBBox; + } + computeDefaultGradientFillBBox() { + return; + } + containsPoint(x, y) { + return this.isPointInPath(x, y); + } + applySvgFillAttributes(element2, defs) { + const { fill, fillOpacity } = this; + if (typeof fill === "string") { + element2.setAttribute("fill", fill); + } else if (isGradientFill(fill) && this.fillGradient) { + defs ?? (defs = []); + const gradient2 = this.fillGradient.toSvg(this.fillBBox ?? this.getBBox()); + const id = generateUUID(); + gradient2.setAttribute("id", id); + defs.push(gradient2); + element2.setAttribute("fill", `url(#${id})`); + } else if (isPatternFill(fill) && this.fillPattern) { + defs ?? (defs = []); + const pattern = this.fillPattern.toSvg(); + const id = generateUUID(); + pattern.setAttribute("id", id); + defs.push(pattern); + element2.setAttribute("fill", `url(#${id})`); + } else if (isImageFill(fill) && this.fillImage) { + defs ?? (defs = []); + const pixelRatio = this.layerManager?.canvas?.pixelRatio ?? 1; + const pattern = this.fillImage.toSvg(this.getBBox(), pixelRatio); + const id = generateUUID(); + pattern.setAttribute("id", id); + defs.push(pattern); + element2.setAttribute("fill", `url(#${id})`); + } else { + element2.setAttribute("fill", "none"); + } + element2.setAttribute("fill-opacity", String(fillOpacity)); + return defs; + } + applySvgStrokeAttributes(element2) { + const { stroke: stroke3, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this; + setSvgStrokeAttributes(element2, { stroke: isString(stroke3) ? stroke3 : void 0, strokeOpacity, strokeWidth }); + setSvgLineDashAttributes(element2, { lineDash, lineDashOffset }); + } +}; +__decorateClass([ + SceneChangeDetection() +], Shape.prototype, "drawingMode", 2); +__decorateClass([ + SceneChangeDetection() +], Shape.prototype, "fillOpacity", 2); +__decorateClass([ + SceneChangeDetection() +], Shape.prototype, "strokeOpacity", 2); +__decorateClass([ + SceneObjectChangeDetection({ equals: objectsEqual, changeCb: (s) => s.onFillChange() }) +], Shape.prototype, "fill", 2); +__decorateClass([ + SceneObjectChangeDetection({ equals: objectsEqual, changeCb: (s) => s.onStrokeChange() }) +], Shape.prototype, "stroke", 2); +__decorateClass([ + SceneChangeDetection() +], Shape.prototype, "strokeWidth", 2); +__decorateClass([ + SceneArrayChangeDetection() +], Shape.prototype, "lineDash", 2); +__decorateClass([ + SceneChangeDetection() +], Shape.prototype, "lineDashOffset", 2); +__decorateClass([ + SceneChangeDetection() +], Shape.prototype, "lineCap", 2); +__decorateClass([ + SceneChangeDetection() +], Shape.prototype, "lineJoin", 2); +__decorateClass([ + SceneChangeDetection() +], Shape.prototype, "miterLimit", 2); +__decorateClass([ + SceneChangeDetection({ convertor: (v) => clamp(0, v ?? 1, 1) }) +], Shape.prototype, "opacity", 2); +__decorateClass([ + SceneObjectChangeDetection({ equals: TRIPLE_EQ, checkDirtyOnAssignment: true }) +], Shape.prototype, "fillShadow", 2); +__decorateClass([ + SceneObjectChangeDetection({ equals: boxesEqual, changeCb: (s) => s.onFillChange() }) +], Shape.prototype, "fillBBox", 2); +__decorateClass([ + SceneObjectChangeDetection({ equals: objectsEqual, changeCb: (s) => s.onFillChange() }) +], Shape.prototype, "fillParams", 2); + +// packages/ag-charts-community/src/scene/matrix.ts +var IDENTITY_MATRIX_ELEMENTS = [1, 0, 0, 1, 0, 0]; +var Matrix = class _Matrix { + get e() { + return [...this.elements]; + } + constructor(elements = IDENTITY_MATRIX_ELEMENTS) { + this.elements = [...elements]; + } + setElements(elements) { + const e = this.elements; + e[0] = elements[0]; + e[1] = elements[1]; + e[2] = elements[2]; + e[3] = elements[3]; + e[4] = elements[4]; + e[5] = elements[5]; + return this; + } + get identity() { + const e = this.elements; + return isNumberEqual(e[0], 1) && isNumberEqual(e[1], 0) && isNumberEqual(e[2], 0) && isNumberEqual(e[3], 1) && isNumberEqual(e[4], 0) && isNumberEqual(e[5], 0); + } + /** + * Performs the AxB matrix multiplication and saves the result + * to `C`, if given, or to `A` otherwise. + */ + AxB(A, B, C2) { + const a = A[0] * B[0] + A[2] * B[1], b = A[1] * B[0] + A[3] * B[1], c = A[0] * B[2] + A[2] * B[3], d = A[1] * B[2] + A[3] * B[3], e = A[0] * B[4] + A[2] * B[5] + A[4], f = A[1] * B[4] + A[3] * B[5] + A[5]; + C2 = C2 ?? A; + C2[0] = a; + C2[1] = b; + C2[2] = c; + C2[3] = d; + C2[4] = e; + C2[5] = f; + } + /** + * The `other` matrix gets post-multiplied to the current matrix. + * Returns the current matrix. + * @param other + */ + multiplySelf(other) { + this.AxB(this.elements, other.elements); + return this; + } + /** + * The `other` matrix gets post-multiplied to the current matrix. + * Returns a new matrix. + * @param other + */ + multiply(other) { + const elements = [Number.NaN, Number.NaN, Number.NaN, Number.NaN, Number.NaN, Number.NaN]; + if (other instanceof _Matrix) { + this.AxB(this.elements, other.elements, elements); + } else { + this.AxB(this.elements, [other.a, other.b, other.c, other.d, other.e, other.f], elements); + } + return new _Matrix(elements); + } + preMultiplySelf(other) { + this.AxB(other.elements, this.elements, this.elements); + return this; + } + /** + * Returns the inverse of this matrix as a new matrix. + */ + inverse() { + const el = this.elements; + let a = el[0], b = el[1], c = el[2], d = el[3]; + const e = el[4], f = el[5]; + const rD = 1 / (a * d - b * c); + a *= rD; + b *= rD; + c *= rD; + d *= rD; + return new _Matrix([d, -b, -c, a, c * f - d * e, b * e - a * f]); + } + invertSelf() { + const el = this.elements; + let a = el[0], b = el[1], c = el[2], d = el[3]; + const e = el[4], f = el[5]; + const rD = 1 / (a * d - b * c); + a *= rD; + b *= rD; + c *= rD; + d *= rD; + el[0] = d; + el[1] = -b; + el[2] = -c; + el[3] = a; + el[4] = c * f - d * e; + el[5] = b * e - a * f; + return this; + } + transformPoint(x, y) { + const e = this.elements; + return { + x: x * e[0] + y * e[2] + e[4], + y: x * e[1] + y * e[3] + e[5] + }; + } + transformBBox(bbox, target) { + const el = this.elements; + const xx = el[0]; + const xy = el[1]; + const yx = el[2]; + const yy = el[3]; + const h_w = bbox.width * 0.5; + const h_h = bbox.height * 0.5; + const cx = bbox.x + h_w; + const cy = bbox.y + h_h; + const w = Math.abs(h_w * xx) + Math.abs(h_h * yx); + const h = Math.abs(h_w * xy) + Math.abs(h_h * yy); + target ?? (target = new BBox(0, 0, 0, 0)); + target.x = cx * xx + cy * yx + el[4] - w; + target.y = cx * xy + cy * yy + el[5] - h; + target.width = w + w; + target.height = h + h; + return target; + } + toContext(ctx) { + if (this.identity) { + return; + } + const e = this.elements; + ctx.transform(e[0], e[1], e[2], e[3], e[4], e[5]); + } + static updateTransformMatrix(matrix, scalingX, scalingY, rotation, translationX, translationY, opts) { + const sx = scalingX; + const sy = scalingY; + let scx; + let scy; + if (sx === 1 && sy === 1) { + scx = 0; + scy = 0; + } else { + scx = opts?.scalingCenterX ?? 0; + scy = opts?.scalingCenterY ?? 0; + } + const r = rotation; + const cos = Math.cos(r); + const sin = Math.sin(r); + let rcx; + let rcy; + if (r === 0) { + rcx = 0; + rcy = 0; + } else { + rcx = opts?.rotationCenterX ?? 0; + rcy = opts?.rotationCenterY ?? 0; + } + const tx = translationX; + const ty = translationY; + const tx4 = scx * (1 - sx) - rcx; + const ty4 = scy * (1 - sy) - rcy; + matrix.setElements([ + cos * sx, + sin * sx, + -sin * sy, + cos * sy, + cos * tx4 - sin * ty4 + rcx + tx, + sin * tx4 + cos * ty4 + rcy + ty + ]); + return matrix; + } +}; + +// packages/ag-charts-community/src/scene/transformable.ts +function isMatrixTransform(node) { + return isMatrixTransformType(node.constructor); +} +var MATRIX_TRANSFORM_TYPE = Symbol("isMatrixTransform"); +function isMatrixTransformType(cstr) { + return cstr[MATRIX_TRANSFORM_TYPE] === true; +} +function MatrixTransform(Parent) { + var _a, _b; + const ParentNode = Parent; + if (isMatrixTransformType(Parent)) { + return Parent; + } + const TRANSFORM_MATRIX = Symbol("matrix_combined_transform"); + class MatrixTransformInternal extends ParentNode { + constructor() { + super(...arguments); + this[_b] = new Matrix(); + this._dirtyTransform = true; + } + onChangeDetection(property) { + super.onChangeDetection(property); + this._dirtyTransform = true; + if (this.batchLevel > 0) { + return; + } + this.markDirty("transform"); + } + updateMatrix(_matrix) { + } + computeTransformMatrix() { + if (!this._dirtyTransform) + return; + this[TRANSFORM_MATRIX].setElements(IDENTITY_MATRIX_ELEMENTS); + this.updateMatrix(this[TRANSFORM_MATRIX]); + this._dirtyTransform = false; + } + toParent(bbox) { + this.computeTransformMatrix(); + if (this[TRANSFORM_MATRIX].identity) + return bbox.clone(); + return this[TRANSFORM_MATRIX].transformBBox(bbox); + } + toParentPoint(x, y) { + this.computeTransformMatrix(); + if (this[TRANSFORM_MATRIX].identity) + return { x, y }; + return this[TRANSFORM_MATRIX].transformPoint(x, y); + } + fromParent(bbox) { + this.computeTransformMatrix(); + if (this[TRANSFORM_MATRIX].identity) + return bbox.clone(); + return this[TRANSFORM_MATRIX].inverse().transformBBox(bbox); + } + fromParentPoint(x, y) { + this.computeTransformMatrix(); + if (this[TRANSFORM_MATRIX].identity) + return { x, y }; + return this[TRANSFORM_MATRIX].inverse().transformPoint(x, y); + } + computeBBox() { + const bbox = super.computeBBox(); + if (!bbox) + return bbox; + return this.toParent(bbox); + } + computeBBoxWithoutTransforms() { + return super.computeBBox(); + } + pickNode(x, y) { + ({ x, y } = this.fromParentPoint(x, y)); + return super.pickNode(x, y); + } + pickNodes(x, y, into) { + ({ x, y } = this.fromParentPoint(x, y)); + return super.pickNodes(x, y, into); + } + render(renderCtx) { + this.computeTransformMatrix(); + const { ctx } = renderCtx; + const matrix = this[TRANSFORM_MATRIX]; + let performRestore = false; + try { + if (!matrix.identity) { + ctx.save(); + performRestore = true; + matrix.toContext(ctx); + } + super.render(renderCtx); + } finally { + if (performRestore) { + ctx.restore(); + } + } + } + toSVG() { + this.computeTransformMatrix(); + const svg = super.toSVG(); + const matrix = this[TRANSFORM_MATRIX]; + if (matrix.identity || svg == null) + return svg; + const g = createSvgElement("g"); + g.append(...svg.elements); + const [a, b, c, d, e, f] = matrix.e; + g.setAttribute("transform", `matrix(${a} ${b} ${c} ${d} ${e} ${f})`); + return { + elements: [g], + defs: svg.defs + }; + } + } + _a = MATRIX_TRANSFORM_TYPE, _b = TRANSFORM_MATRIX; + MatrixTransformInternal[_a] = true; + return MatrixTransformInternal; +} +function Rotatable(Parent) { + var _a; + const ParentNode = Parent; + const ROTATABLE_MATRIX = Symbol("matrix_rotation"); + class RotatableInternal extends MatrixTransform(ParentNode) { + constructor() { + super(...arguments); + this[_a] = new Matrix(); + this.rotationCenterX = 0; + this.rotationCenterY = 0; + this.rotation = 0; + } + updateMatrix(matrix) { + super.updateMatrix(matrix); + const { rotation, rotationCenterX, rotationCenterY } = this; + if (rotation === 0) + return; + Matrix.updateTransformMatrix(this[ROTATABLE_MATRIX], 1, 1, rotation, 0, 0, { + rotationCenterX, + rotationCenterY + }); + matrix.multiplySelf(this[ROTATABLE_MATRIX]); + } + } + _a = ROTATABLE_MATRIX; + __decorateClass([ + SceneChangeDetection() + ], RotatableInternal.prototype, "rotationCenterX", 2); + __decorateClass([ + SceneChangeDetection() + ], RotatableInternal.prototype, "rotationCenterY", 2); + __decorateClass([ + SceneChangeDetection() + ], RotatableInternal.prototype, "rotation", 2); + return RotatableInternal; +} +function isScalable(node) { + return "scalingX" in node && "scalingY" in node && "scalingCenterX" in node && "scalingCenterY" in node; +} +function Scalable(Parent) { + var _a; + const ParentNode = Parent; + const SCALABLE_MATRIX = Symbol("matrix_scale"); + class ScalableInternal extends MatrixTransform(ParentNode) { + constructor() { + super(...arguments); + this[_a] = new Matrix(); + this.scalingX = 1; + this.scalingY = 1; + this.scalingCenterX = 0; + this.scalingCenterY = 0; + } + updateMatrix(matrix) { + super.updateMatrix(matrix); + const { scalingX, scalingY, scalingCenterX, scalingCenterY } = this; + if (scalingX === 1 && scalingY === 1) + return; + Matrix.updateTransformMatrix(this[SCALABLE_MATRIX], scalingX, scalingY, 0, 0, 0, { + scalingCenterX, + scalingCenterY + }); + matrix.multiplySelf(this[SCALABLE_MATRIX]); + } + } + _a = SCALABLE_MATRIX; + __decorateClass([ + SceneChangeDetection() + ], ScalableInternal.prototype, "scalingX", 2); + __decorateClass([ + SceneChangeDetection() + ], ScalableInternal.prototype, "scalingY", 2); + __decorateClass([ + SceneChangeDetection() + ], ScalableInternal.prototype, "scalingCenterX", 2); + __decorateClass([ + SceneChangeDetection() + ], ScalableInternal.prototype, "scalingCenterY", 2); + return ScalableInternal; +} +function Translatable(Parent) { + var _a; + const ParentNode = Parent; + const TRANSLATABLE_MATRIX = Symbol("matrix_translation"); + class TranslatableInternal extends MatrixTransform(ParentNode) { + constructor() { + super(...arguments); + this[_a] = new Matrix(); + this.translationX = 0; + this.translationY = 0; + } + updateMatrix(matrix) { + super.updateMatrix(matrix); + const { translationX, translationY } = this; + if (translationX === 0 && translationY === 0) + return; + Matrix.updateTransformMatrix(this[TRANSLATABLE_MATRIX], 1, 1, 0, translationX, translationY); + matrix.multiplySelf(this[TRANSLATABLE_MATRIX]); + } + } + _a = TRANSLATABLE_MATRIX; + __decorateClass([ + SceneChangeDetection() + ], TranslatableInternal.prototype, "translationX", 2); + __decorateClass([ + SceneChangeDetection() + ], TranslatableInternal.prototype, "translationY", 2); + return TranslatableInternal; +} +var Transformable = class { + /** + * Converts a BBox from canvas coordinate space into the coordinate space of the given Node. + */ + static fromCanvas(node, bbox) { + const parents = []; + for (const parent of node.traverseUp()) { + if (isMatrixTransform(parent)) { + parents.unshift(parent); + } + } + for (const parent of parents) { + bbox = parent.fromParent(bbox); + } + if (isMatrixTransform(node)) { + bbox = node.fromParent(bbox); + } + return bbox; + } + /** + * Converts a Nodes BBox (or an arbitrary BBox if supplied) from local Node coordinate space + * into the Canvas coordinate space. + */ + static toCanvas(node, bbox) { + if (bbox == null) { + bbox = node.getBBox(); + } else if (isMatrixTransform(node)) { + bbox = node.toParent(bbox); + } + for (const parent of node.traverseUp()) { + if (isMatrixTransform(parent)) { + bbox = parent.toParent(bbox); + } + } + return bbox; + } + /** + * Converts a point from canvas coordinate space into the coordinate space of the given Node. + */ + static fromCanvasPoint(node, x, y) { + const parents = []; + for (const parent of node.traverseUp()) { + if (isMatrixTransform(parent)) { + parents.unshift(parent); + } + } + for (const parent of parents) { + ({ x, y } = parent.fromParentPoint(x, y)); + } + if (isMatrixTransform(node)) { + ({ x, y } = node.fromParentPoint(x, y)); + } + return { x, y }; + } + /** + * Converts a point from a Nodes local coordinate space into the Canvas coordinate space. + */ + static toCanvasPoint(node, x, y) { + if (isMatrixTransform(node)) { + ({ x, y } = node.toParentPoint(x, y)); + } + for (const parent of node.traverseUp()) { + if (isMatrixTransform(parent)) { + ({ x, y } = parent.toParentPoint(x, y)); + } + } + return { x, y }; + } +}; + +// packages/ag-charts-community/src/scene/group.ts +var sharedOffscreenCanvas; +var _Group = class _Group extends Node2 { + // optimizeForInfrequentRedraws: true + constructor(opts) { + super(opts); + this.childNodes = /* @__PURE__ */ new Set(); + this.dirty = false; + this.dirtyZIndex = false; + this.clipRect = void 0; + this.opacity = 1; + // Used when renderToOffscreenCanvas: true + this.layer = void 0; + // optimizeForInfrequentRedraws: false + this.image = void 0; + this._lastWidth = Number.NaN; + this._lastHeight = Number.NaN; + this._lastDevicePixelRatio = Number.NaN; + this.isContainerNode = true; + this.renderToOffscreenCanvas = opts?.renderToOffscreenCanvas === true; + this.optimizeForInfrequentRedraws = opts?.optimizeForInfrequentRedraws === true; + } + static is(value) { + return value instanceof _Group; + } + static computeChildrenBBox(nodes, skipInvisible = true) { + return BBox.merge(Node2.extractBBoxes(nodes, skipInvisible)); + } + static compareChildren(a, b) { + return compareZIndex(a.zIndex, b.zIndex) || a.serialNumber - b.serialNumber; + } + // We consider a group to be boundless, thus any point belongs to it. + containsPoint(_x, _y) { + return true; + } + computeBBox() { + return _Group.computeChildrenBBox(this.children()); + } + computeSafeClippingBBox(pixelRatio) { + const bbox = this.computeBBox(); + if (bbox?.isFinite() !== true) + return; + let strokeWidth = 0; + const strokeMiterAmount = 4; + for (const child of this.descendants()) { + if (child instanceof Shape) { + strokeWidth = Math.max(strokeWidth, child.strokeWidth); + } + } + const padding2 = Math.max( + // Account for anti-aliasing artefacts + 1, + // Account for strokes (incl. miters) - this may not be the best place to include this + strokeWidth / 2 * strokeMiterAmount + ); + const { x: originX, y: originY } = Transformable.toCanvasPoint(this, 0, 0); + const x = alignBefore(pixelRatio, originX + bbox.x - padding2) - originX; + const y = alignBefore(pixelRatio, originY + bbox.y - padding2) - originY; + const width2 = Math.ceil(bbox.x + bbox.width - x + padding2); + const height2 = Math.ceil(bbox.y + bbox.height - y + padding2); + return new BBox(x, y, width2, height2); + } + prepareSharedCanvas(width2, height2, pixelRatio) { + if (sharedOffscreenCanvas == null || sharedOffscreenCanvas.pixelRatio !== pixelRatio) { + sharedOffscreenCanvas = new HdpiOffscreenCanvas({ width: width2, height: height2, pixelRatio }); + } else { + sharedOffscreenCanvas.resize(width2, height2, pixelRatio); + } + return sharedOffscreenCanvas; + } + setScene(scene) { + super.setScene(scene); + if (this.layer) { + this.scene?.layersManager.removeLayer(this.layer); + this.layer = void 0; + } + for (const child of this.children()) { + child.setScene(scene); + } + } + markDirty(property) { + this.dirty = true; + super.markDirty(property); + } + markDirtyChildrenOrder() { + super.markDirtyChildrenOrder(); + this.dirtyZIndex = true; + this.markDirty(); + } + /** + * Appends one or more new node instances to this parent. + * If one needs to: + * - move a child to the end of the list of children + * - move a child from one parent to another (including parents in other scenes) + * one should use the {@link insertBefore} method instead. + * @param nodes A node or nodes to append. + */ + append(nodes) { + for (const node of toIterable(nodes)) { + node.remove(); + this.childNodes.add(node); + node.parentNode = this; + node.setScene(this.scene); + } + this.markDirtyChildrenOrder(); + this.markDirty(); + } + appendChild(node) { + this.append(node); + return node; + } + removeChild(node) { + if (!this.childNodes?.delete(node)) { + throw new Error( + `AG Charts - internal error, unknown child node ${node.name ?? node.id} in $${this.name ?? this.id}` + ); + } + node.parentNode = void 0; + node.setScene(); + this.markDirtyChildrenOrder(); + this.markDirty(); + } + clear() { + for (const child of this.children()) { + delete child.parentNode; + child.setScene(); + } + this.childNodes?.clear(); + this.markDirty(); + } + /** + * Hit testing method. + * Recursively checks if the given point is inside this node or any of its children. + * Returns the first matching node or `undefined`. + * Nodes that render later (show on top) are hit tested first. + */ + pickNode(x, y) { + if (!this.visible || this.pointerEvents === 1 /* None */ || !this.containsPoint(x, y)) { + return; + } + if (this.childNodes != null && this.childNodes.size !== 0) { + const children = [...this.children()]; + for (let i = children.length - 1; i >= 0; i--) { + const child = children[i]; + const hit = child.pickNode(x, y); + if (hit != null) { + return hit; + } + } + } else if (!this.isContainerNode) { + return this; + } + } + pickNodes(x, y, into = []) { + if (!this.visible || this.pointerEvents === 1 /* None */ || !this.containsPoint(x, y)) { + return into; + } + if (!this.isContainerNode) { + into.push(this); + } + for (const child of this.children()) { + child.pickNodes(x, y, into); + } + return into; + } + isDirty(renderCtx) { + const { width: width2, height: height2, devicePixelRatio } = renderCtx; + const { dirty, layer } = this; + const layerResized = layer != null && (this._lastWidth !== width2 || this._lastHeight !== height2); + const pixelRatioChanged = this._lastDevicePixelRatio !== devicePixelRatio; + this._lastWidth = width2; + this._lastHeight = height2; + this._lastDevicePixelRatio = devicePixelRatio; + return dirty || layerResized || pixelRatioChanged; + } + preRender(renderCtx) { + let counts; + if (this.dirty) { + counts = super.preRender(renderCtx, 0); + for (const child of this.children()) { + const childCounts = child.preRender(renderCtx); + counts.groups += childCounts.groups; + counts.nonGroups += childCounts.nonGroups; + counts.complexity += childCounts.complexity; + } + counts.groups += 1; + counts.nonGroups -= 1; + } else { + counts = this.childNodeCounts; + } + if (this.renderToOffscreenCanvas && !this.optimizeForInfrequentRedraws && counts.nonGroups > 0 && this.getVisibility()) { + this.layer ?? (this.layer = this.layerManager?.addLayer({ name: this.name })); + } else if (this.layer != null) { + this.layerManager?.removeLayer(this.layer); + this.layer = void 0; + } + return counts; + } + render(renderCtx) { + const { layer, renderToOffscreenCanvas } = this; + const childRenderCtx = { ...renderCtx }; + const dirty = this.isDirty(renderCtx); + this.dirty = false; + if (!renderToOffscreenCanvas) { + this.renderInContext(childRenderCtx); + super.render(childRenderCtx); + return; + } + const { ctx, stats, devicePixelRatio: pixelRatio } = renderCtx; + let { image } = this; + if (dirty) { + image?.bitmap.close(); + image = void 0; + const bbox = layer ? void 0 : this.computeSafeClippingBBox(pixelRatio); + const renderOffscreen = (offscreenCanvas, ...transform) => { + const offscreenCtx = offscreenCanvas.context; + childRenderCtx.ctx = offscreenCtx; + offscreenCanvas.clear(); + offscreenCtx.save(); + try { + offscreenCtx.setTransform(...transform); + offscreenCtx.globalAlpha = 1; + this.renderInContext(childRenderCtx); + } finally { + offscreenCtx.restore(); + offscreenCtx.verifyDepthZero?.(); + } + }; + if (layer) { + renderOffscreen(layer, ctx.getTransform()); + } else if (bbox) { + const { x, y, width: width2, height: height2 } = bbox; + const canvas = this.prepareSharedCanvas(width2, height2, pixelRatio); + renderOffscreen(canvas, pixelRatio, 0, 0, pixelRatio, -x * pixelRatio, -y * pixelRatio); + image = { bitmap: canvas.transferToImageBitmap(), x, y, width: width2, height: height2 }; + } + this.image = image; + if (stats) + stats.layersRendered++; + } else if (stats) { + stats.layersSkipped++; + } + const { globalAlpha } = ctx; + ctx.globalAlpha = globalAlpha * this.opacity; + if (layer) { + ctx.save(); + try { + ctx.resetTransform(); + layer.drawImage(ctx); + } finally { + ctx.restore(); + } + } else if (image) { + const { bitmap, x, y, width: width2, height: height2 } = image; + ctx.drawImage(bitmap, 0, 0, width2 * pixelRatio, height2 * pixelRatio, x, y, width2, height2); + } + ctx.globalAlpha = globalAlpha; + super.render(childRenderCtx); + } + applyClip(ctx, clipRect) { + const { x, y, width: width2, height: height2 } = clipRect; + ctx.beginPath(); + ctx.rect(x, y, width2, height2); + ctx.clip(); + } + renderInContext(childRenderCtx) { + const { ctx, stats } = childRenderCtx; + if (this.dirtyZIndex) { + this.sortChildren(_Group.compareChildren); + this.dirtyZIndex = false; + } + ctx.save(); + try { + ctx.globalAlpha *= this.opacity; + if (this.clipRect != null) { + this.applyClip(ctx, this.clipRect); + childRenderCtx.clipBBox = Transformable.toCanvas(this, this.clipRect); + } + for (const child of this.children()) { + if (!child.visible) { + if (stats) { + stats.nodesSkipped += child.childNodeCounts.nonGroups + child.childNodeCounts.groups; + stats.opsSkipped += child.childNodeCounts.complexity; + } + continue; + } + child.isolatedRender(childRenderCtx); + } + } finally { + ctx.restore(); + } + } + sortChildren(compareFn) { + if (!this.childNodes) + return; + const sortedChildren = [...this.childNodes].sort(compareFn); + this.childNodes.clear(); + for (const child of sortedChildren) { + this.childNodes.add(child); + } + } + *children() { + yield* this.childNodes; + } + *excludeChildren(exclude) { + for (const child of this.children()) { + if (exclude.instance && !(child instanceof exclude.instance) || exclude.name && child.name !== exclude.name) { + yield child; + } + } + } + *descendants() { + for (const child of this.children()) { + yield child; + if (child instanceof _Group) { + yield* child.descendants(); + } + } + } + /** + * Transforms bbox given in the canvas coordinate space to bbox in this group's coordinate space and + * sets this group's clipRect to the transformed bbox. + * @param bbox clipRect bbox in the canvas coordinate space. + */ + setClipRect(bbox) { + this.clipRect = bbox ? Transformable.fromCanvas(this, bbox) : void 0; + } + /** + * Set the clip rect within the canvas coordinate space. + * @param bbox clipRect bbox in the canvas coordinate space. + */ + setClipRectCanvasSpace(bbox) { + this.clipRect = bbox; + } + getVisibility() { + for (const node of this.traverseUp(true)) { + if (!node.visible) { + return false; + } + } + return true; + } + toSVG() { + if (!this.visible) + return; + const defs = []; + const elements = []; + for (const child of this.children()) { + const svg = child.toSVG(); + if (svg != null) { + elements.push(...svg.elements); + if (svg.defs != null) { + defs.push(...svg.defs); + } + } + } + return { elements, defs }; + } +}; +_Group.className = "Group"; +__decorateClass([ + SceneChangeDetection({ convertor: (v) => clamp(0, v, 1) }) +], _Group.prototype, "opacity", 2); +var Group = _Group; +var ScalableGroup = class extends Scalable(Group) { +}; +var RotatableGroup = class extends Rotatable(Group) { +}; +var TranslatableGroup = class extends Translatable(Group) { +}; +var TransformableGroup = class extends Rotatable(Translatable(Group)) { +}; + +// packages/ag-charts-community/src/util/callbackCache.ts +function needsContext(caller, _params) { + return "context" in caller; +} +function maybeSetContext(caller, params) { + if (caller != null && needsContext(caller, params)) { + if (params != null && typeof params === "object" && params.context === void 0) { + params.context = caller.context; + return true; + } + } + return false; +} +function callWithContext(callers, fn, params) { + if (Array.isArray(callers)) { + for (const caller of callers) { + if (maybeSetContext(caller, params)) { + break; + } + } + } else { + maybeSetContext(callers, params); + } + return fn(params); +} +var CallbackCache = class { + constructor() { + this.cache = /* @__PURE__ */ new WeakMap(); + } + call(callers, fn, params) { + let serialisedParams; + let paramCache = this.cache.get(fn); + try { + serialisedParams = JSON.stringify(params); + } catch { + return this.invoke(callers, fn, paramCache, void 0, params); + } + if (paramCache == null) { + paramCache = /* @__PURE__ */ new Map(); + this.cache.set(fn, paramCache); + } + if (!paramCache.has(serialisedParams)) { + return this.invoke(callers, fn, paramCache, serialisedParams, params); + } + return paramCache.get(serialisedParams); + } + invoke(callers, fn, paramCache, serialisedParams, params) { + try { + const result = callWithContext(callers, fn, params); + if (paramCache && serialisedParams != null) { + paramCache.set(serialisedParams, result); + } + return result; + } catch (e) { + logger_exports.warnOnce(`User callback errored, ignoring`, e); + return; + } + } + invalidateCache() { + this.cache = /* @__PURE__ */ new WeakMap(); + } +}; + +// packages/ag-charts-community/src/util/dom.ts +function setElementBBox(element2, bbox) { + if (!element2) + return; + const { x, y, width: width2, height: height2 } = normalizeBounds(bbox); + setPixelValue(element2.style, "width", width2); + setPixelValue(element2.style, "height", height2); + setPixelValue(element2.style, "left", x); + setPixelValue(element2.style, "top", y); +} +function getElementBBox(element2) { + const width2 = Number.parseFloat(element2.style.width) || element2.offsetWidth; + const height2 = Number.parseFloat(element2.style.height) || element2.offsetHeight; + const x = Number.parseFloat(element2.style.left) || element2.offsetLeft; + const y = Number.parseFloat(element2.style.top) || element2.offsetTop; + return { x, y, width: width2, height: height2 }; +} +function focusCursorAtEnd(element2) { + element2.focus({ preventScroll: true }); + if (element2.lastChild?.textContent == null) + return; + const range4 = getDocument().createRange(); + range4.setStart(element2.lastChild, element2.lastChild.textContent.length); + range4.setEnd(element2.lastChild, element2.lastChild.textContent.length); + const selection = getWindow().getSelection(); + selection?.removeAllRanges(); + selection?.addRange(range4); +} +function isInputPending() { + const navigator = getWindow("navigator"); + if ("scheduling" in navigator) { + const scheduling = navigator.scheduling; + if ("isInputPending" in scheduling) { + return scheduling.isInputPending({ includeContinuous: true }); + } + } + return false; +} +function getIconClassNames(icon) { + return `ag-charts-icon ag-charts-icon-${icon}`; +} +function normalizeBounds(bbox) { + let { x, y, width: width2, height: height2 } = bbox; + if ((width2 == null || width2 > 0) && (height2 == null || height2 > 0)) { + return bbox; + } + if (x != null && width2 != null && width2 < 0) { + width2 = -width2; + x = x - width2; + } + if (y != null && height2 != null && height2 < 0) { + height2 = -height2; + y = y - height2; + } + return { x, y, width: width2, height: height2 }; +} +function setPixelValue(style2, key, value) { + if (value == null) { + style2.removeProperty(key); + } else { + style2.setProperty(key, `${value}px`); + } +} + +// packages/ag-charts-community/src/util/json.ts +var CLASS_INSTANCE_TYPE = "class-instance"; +function jsonDiff(source, target, shallow) { + if (isArray(target)) { + if (!isArray(source) || source.length !== target.length || target.some((v, i) => jsonDiff(source[i], v, shallow) != null)) { + return target; + } + } else if (isPlainObject(target)) { + if (!isPlainObject(source)) { + return target; + } + const result = {}; + const allKeys = /* @__PURE__ */ new Set([ + ...Object.keys(source), + ...Object.keys(target) + ]); + for (const key of allKeys) { + if (source[key] === target[key]) { + continue; + } else if (shallow?.has(key)) { + result[key] = target[key]; + } else if (typeof source[key] === typeof target[key]) { + const diff8 = jsonDiff(source[key], target[key], shallow); + if (diff8 !== null) { + result[key] = diff8; + } + } else { + result[key] = target[key]; + } + } + return Object.keys(result).length ? result : null; + } else if (source !== target) { + return target; + } + return null; +} +function jsonPropertyCompare(source, target) { + for (const key of Object.keys(source)) { + if (source[key] === target?.[key]) + continue; + return false; + } + return true; +} +function deepClone(source, opts) { + if (isArray(source)) { + return cloneArray(source, opts); + } + if (isPlainObject(source)) { + return clonePlainObject(source, opts); + } + if (source instanceof Map) { + return new Map(deepClone(Array.from(source))); + } + return shallowClone(source); +} +function cloneArray(source, opts) { + const result = []; + const seen = opts?.seen; + for (const item of source) { + if (typeof item === "object" && seen?.includes(item)) { + logger_exports.warn("cycle detected in array", item); + continue; + } + seen?.push(item); + result.push(deepClone(item, opts)); + seen?.pop(); + } + return result; +} +function clonePlainObject(source, opts) { + const target = {}; + for (const key of Object.keys(source)) { + if (opts?.assign?.has(key)) { + target[key] = source[key]; + } else if (opts?.shallow?.has(key)) { + target[key] = shallowClone(source[key]); + } else { + target[key] = deepClone(source[key], opts); + } + } + return target; +} +function shallowClone(source) { + if (isArray(source)) { + return source.slice(0); + } + if (isPlainObject(source)) { + return { ...source }; + } + if (isDate(source)) { + return new Date(source); + } + if (isRegExp(source)) { + return new RegExp(source.source, source.flags); + } + return source; +} +function jsonWalk(json, visit, skip, parallelJson, ctx, acc) { + if (isArray(json)) { + acc = visit(json, parallelJson, ctx, acc); + let index = 0; + for (const node of json) { + acc = jsonWalk(node, visit, skip, parallelJson?.[index], ctx, acc); + index++; + } + } else if (isPlainObject(json)) { + acc = visit(json, parallelJson, ctx, acc); + for (const key of Object.keys(json)) { + if (skip?.has(key)) { + continue; + } + const value = json[key]; + acc = jsonWalk(value, visit, skip, parallelJson?.[key], ctx, acc); + } + } + return acc; +} +function jsonApply(target, source, params = {}) { + const { path, matcherPath = path?.replace(/(\[[0-9+]+])/i, "[]"), skip = [] } = params; + if (target == null) { + throw new Error(`AG Charts - target is uninitialised: ${path ?? ""}`); + } + if (source == null) { + return target; + } + if (isProperties(target)) { + return target.set(source); + } + const targetAny = target; + const targetType = classify(target); + for (const property of Object.keys(source)) { + if (SKIP_JS_BUILTINS.has(property)) + continue; + const propertyMatcherPath = `${matcherPath ? matcherPath + "." : ""}${property}`; + if (skip.includes(propertyMatcherPath)) + continue; + const newValue = source[property]; + const propertyPath = `${path ? path + "." : ""}${property}`; + const targetClass = targetAny.constructor; + const currentValue = targetAny[property]; + try { + const currentValueType = classify(currentValue); + const newValueType = classify(newValue); + if (targetType === CLASS_INSTANCE_TYPE && !(property in target || property === "context")) { + if (newValue === void 0) + continue; + logger_exports.warn(`unable to set [${propertyPath}] in ${targetClass?.name} - property is unknown`); + continue; + } + if (currentValueType != null && newValueType != null && newValueType !== currentValueType && (currentValueType !== CLASS_INSTANCE_TYPE || newValueType !== "object")) { + logger_exports.warn( + `unable to set [${propertyPath}] in ${targetClass?.name} - can't apply type of [${newValueType}], allowed types are: [${currentValueType}]` + ); + continue; + } + if (isProperties(currentValue)) { + if (newValue === void 0) { + currentValue.clear(); + } else { + currentValue.set(newValue); + } + } else if (newValueType === "object" && property !== "context") { + if (!(property in targetAny)) { + logger_exports.warn(`unable to set [${propertyPath}] in ${targetClass?.name} - property is unknown`); + continue; + } + if (currentValue == null) { + targetAny[property] = newValue; + } else { + jsonApply(currentValue, newValue, { + ...params, + path: propertyPath, + matcherPath: propertyMatcherPath + }); + } + } else { + targetAny[property] = newValue; + } + } catch (error2) { + logger_exports.warn(`unable to set [${propertyPath}] in [${targetClass?.name}]; nested error is: ${error2.message}`); + } + } + return target; +} +function classify(value) { + if (value == null) { + return null; + } + if (isHtmlElement(value) || isDate(value)) { + return "primitive"; + } + if (isArray(value)) { + return "array"; + } + if (isObject(value)) { + return isPlainObject(value) ? "object" : CLASS_INSTANCE_TYPE; + } + if (isFunction(value)) { + return "function"; + } + return "primitive"; +} + +// packages/ag-charts-community/src/util/mutex.ts +var Mutex = class { + constructor() { + this.available = true; + this.acquireQueue = []; + } + acquire(cb) { + return new Promise((resolve) => { + this.acquireQueue.push([cb, resolve]); + if (this.available) { + this.dispatchNext().catch((e) => logger_exports.errorOnce(e)); + } + }); + } + async acquireImmediately(cb) { + if (!this.available) { + return false; + } + await this.acquire(cb); + return true; + } + async waitForClearAcquireQueue() { + return this.acquire(() => Promise.resolve(void 0)); + } + async dispatchNext() { + this.available = false; + let [next, done] = this.acquireQueue.shift() ?? []; + while (next) { + try { + await next(); + done?.(); + } catch (error2) { + logger_exports.error("mutex callback error", error2); + done?.(); + } + [next, done] = this.acquireQueue.shift() ?? []; + } + this.available = true; + } +}; + +// packages/ag-charts-community/src/util/observable.ts +var Observable = class { + constructor() { + this.eventListeners = /* @__PURE__ */ new Map(); + } + addEventListener(eventType, listener) { + if (typeof listener !== "function") { + throw new TypeError("AG Charts - listener must be a Function"); + } + const eventTypeListeners = this.eventListeners.get(eventType); + if (eventTypeListeners) { + eventTypeListeners.add(listener); + } else { + this.eventListeners.set(eventType, /* @__PURE__ */ new Set([listener])); + } + } + removeEventListener(type, listener) { + const listeners = this.eventListeners.get(type); + if (listeners == null) + return; + listeners.delete(listener); + if (listeners.size === 0) { + this.eventListeners.delete(type); + } + } + hasEventListener(type) { + return this.eventListeners.has(type); + } + clearEventListeners() { + this.eventListeners.clear(); + } + fireEvent(event) { + const listeners = this.eventListeners.get(event.type); + if (listeners) { + for (const listener of listeners) { + listener(event); + } + } + } +}; + +// packages/ag-charts-community/src/util/padding.ts +var Padding = class extends BaseProperties { + constructor(top = 0, right = top, bottom = top, left = right) { + super(); + this.top = top; + this.right = right; + this.bottom = bottom; + this.left = left; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], Padding.prototype, "top", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Padding.prototype, "right", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Padding.prototype, "bottom", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Padding.prototype, "left", 2); + +// packages/ag-charts-community/src/util/proxy.ts +function ProxyProperty(proxyPath, configMetadata) { + const pathArray = isArray(proxyPath) ? proxyPath : proxyPath.split("."); + if (pathArray.length === 1) { + const [property] = pathArray; + return addTransformToInstanceProperty( + (target, _, value) => target[property] = value, + (target) => target[property], + configMetadata + ); + } + return addTransformToInstanceProperty( + (target, _, value) => setPath(target, pathArray, value), + (target) => getPath(target, pathArray), + configMetadata + ); +} +function ProxyOnWrite(proxyProperty) { + return addTransformToInstanceProperty((target, _, value) => target[proxyProperty] = value); +} +function ProxyPropertyOnWrite(childName, childProperty) { + return addTransformToInstanceProperty((target, key, value) => target[childName][childProperty ?? key] = value); +} +function ActionOnSet(opts) { + const { newValue: newValueFn, oldValue: oldValueFn, changeValue: changeValueFn } = opts; + return addTransformToInstanceProperty((target, _, newValue, oldValue) => { + if (newValue !== oldValue) { + if (oldValue !== void 0) { + oldValueFn?.call(target, oldValue); + } + if (newValue !== void 0) { + newValueFn?.call(target, newValue); + } + changeValueFn?.call(target, newValue, oldValue); + } + return newValue; + }); +} +function ObserveChanges(observerFn) { + return addObserverToInstanceProperty(observerFn); +} + +// packages/ag-charts-community/src/util/render.ts +function debouncedAnimationFrame(cb) { + return buildScheduler((innerCb, _delayMs) => getWindow().requestAnimationFrame(innerCb), cb); +} +function debouncedCallback(cb) { + return buildScheduler((innerCb, delayMs = 0) => { + if (delayMs === 0) { + queueMicrotask(innerCb); + } else { + setTimeout(innerCb, delayMs); + } + }, cb); +} +function buildScheduler(scheduleFn, cb) { + let scheduleCount = 0; + let promiseRunning = false; + let awaitingPromise; + let awaitingDone; + const busy = () => { + return promiseRunning; + }; + const done = () => { + promiseRunning = false; + awaitingDone?.(); + awaitingDone = void 0; + awaitingPromise = void 0; + if (scheduleCount > 0) { + scheduleFn(scheduleCb); + } + }; + const scheduleCb = () => { + const count = scheduleCount; + scheduleCount = 0; + promiseRunning = true; + const maybePromise = cb({ count }); + if (!maybePromise) { + done(); + return; + } + maybePromise.then(done, done); + }; + return { + schedule(delayMs) { + if (scheduleCount === 0 && !busy()) { + scheduleFn(scheduleCb, delayMs); + } + scheduleCount++; + }, + async await() { + if (!busy()) { + return; + } + awaitingPromise ?? (awaitingPromise = new Promise((resolve) => { + awaitingDone = resolve; + })); + while (busy()) { + await awaitingPromise; + } + } + }; +} + +// packages/ag-charts-community/src/widget/widgetEvents.ts +var WIDGET_HTML_EVENTS = [ + "blur", + "change", + "contextmenu", + "focus", + "keydown", + "keyup", + "click", + "dblclick", + "mouseenter", + "mousemove", + "mouseleave", + "wheel", + "touchstart", + "touchmove", + "touchend", + "touchcancel" +]; +function allocMouseEvent(type, sourceEvent, current) { + const { offsetX, offsetY, clientX, clientY } = sourceEvent; + const { currentX, currentY } = WidgetEventUtil.calcCurrentXY(current, sourceEvent); + return { type, device: "mouse", offsetX, offsetY, clientX, clientY, currentX, currentY, sourceEvent }; +} +function allocTouchEvent(type, sourceEvent, _current) { + return { type, sourceEvent }; +} +var WidgetAllocators = { + blur: (sourceEvent) => { + return { type: "blur", sourceEvent }; + }, + change: (sourceEvent) => { + return { type: "change", sourceEvent }; + }, + contextmenu: (sourceEvent, current) => { + return allocMouseEvent("contextmenu", sourceEvent, current); + }, + focus: (sourceEvent) => { + return { type: "focus", sourceEvent }; + }, + keydown: (sourceEvent) => { + return { type: "keydown", sourceEvent }; + }, + keyup: (sourceEvent) => { + return { type: "keyup", sourceEvent }; + }, + click: (sourceEvent, current) => { + return allocMouseEvent("click", sourceEvent, current); + }, + dblclick: (sourceEvent, current) => { + return allocMouseEvent("dblclick", sourceEvent, current); + }, + mouseenter: (sourceEvent, current) => { + return allocMouseEvent("mouseenter", sourceEvent, current); + }, + mousemove: (sourceEvent, current) => { + return allocMouseEvent("mousemove", sourceEvent, current); + }, + mouseleave: (sourceEvent, current) => { + return allocMouseEvent("mouseleave", sourceEvent, current); + }, + wheel: (sourceEvent) => { + const { offsetX, offsetY, clientX, clientY } = sourceEvent; + const factor = sourceEvent.deltaMode === 0 ? 0.01 : 1; + const deltaX = sourceEvent.deltaX * factor; + const deltaY = sourceEvent.deltaY * factor; + return { type: "wheel", offsetX, offsetY, clientX, clientY, deltaX, deltaY, sourceEvent }; + }, + touchstart: (sourceEvent, current) => { + return allocTouchEvent("touchstart", sourceEvent, current); + }, + touchmove: (sourceEvent, current) => { + return allocTouchEvent("touchmove", sourceEvent, current); + }, + touchend: (sourceEvent, current) => { + return allocTouchEvent("touchend", sourceEvent, current); + }, + touchcancel: (sourceEvent, current) => { + return allocTouchEvent("touchcancel", sourceEvent, current); + } +}; +var WidgetEventUtil = class { + static alloc(type, sourceEvent, current) { + return WidgetAllocators[type](sourceEvent, current); + } + static isHTMLEvent(type) { + const htmlTypes = WIDGET_HTML_EVENTS; + return htmlTypes.includes(type); + } + static calcCurrentXY(current, event) { + const currentRect = current.getBoundingClientRect(); + return { currentX: event.clientX - currentRect.x, currentY: event.clientY - currentRect.y }; + } +}; + +// packages/ag-charts-community/src/widget/widgetListenerHTML.ts +var WidgetListenerHTML = class { + constructor() { + this.widgetListeners = {}; + this.sourceListeners = {}; + } + initSourceHandler(type, handler) { + this.sourceListeners ?? (this.sourceListeners = {}); + this.sourceListeners[type] = handler; + } + lazyGetWidgetListeners(type, target) { + var _a; + if (!(type in (this.sourceListeners ?? {}))) { + const sourceHandler = (sourceEvent) => { + const widgetEvent = WidgetEventUtil.alloc(type, sourceEvent, target.getElement()); + this.dispatch(type, target, widgetEvent); + }; + const opts = {}; + if (type.startsWith("touch")) + opts.passive = false; + this.initSourceHandler(type, sourceHandler); + target.getElement().addEventListener(type, sourceHandler, opts); + } + this.widgetListeners ?? (this.widgetListeners = {}); + (_a = this.widgetListeners)[type] ?? (_a[type] = []); + return this.widgetListeners[type]; + } + add(type, target, handler) { + const listeners = this.lazyGetWidgetListeners(type, target); + listeners.push(handler); + } + remove(type, target, handler) { + const listeners = this.lazyGetWidgetListeners(type, target); + const index = listeners.indexOf(handler); + if (index > -1) + listeners.splice(index, 1); + } + destroy(target) { + this.widgetListeners = void 0; + if (this.sourceListeners) { + for (const [key, sourceHandler] of entries(this.sourceListeners)) { + target.getElement().removeEventListener(key, sourceHandler); + } + this.sourceListeners = void 0; + } + } + dispatch(type, target, event) { + for (const widgetListener of this.widgetListeners?.[type] ?? []) { + widgetListener(event, target); + } + } +}; + +// packages/ag-charts-community/src/widget/mouseDragger.ts +var MouseDragger = class { + constructor(glob, self, myCallbacks, downEvent) { + this.glob = glob; + this.self = self; + this.window = getWindow(); + this.cleanup = new CleanupRegistry(); + this.mousegeneral = (generalEvent) => { + generalEvent.stopPropagation(); + generalEvent.stopImmediatePropagation(); + }; + this.mousemove = (moveEvent) => { + moveEvent.stopPropagation(); + moveEvent.stopImmediatePropagation(); + this.glob.globalMouseDragCallbacks?.mousemove(moveEvent); + }; + this.mouseup = (upEvent) => { + if (upEvent.button === 0) { + upEvent.stopPropagation(); + upEvent.stopImmediatePropagation(); + this.glob.globalMouseDragCallbacks?.mouseup(upEvent); + this.destroy(); + } + }; + const { window, mousegeneral, mousemove, mouseup } = this; + this.cleanup.register( + attachListener(window, "mousedown", mousegeneral, { capture: true }), + attachListener(window, "mouseenter", mousegeneral, { capture: true }), + attachListener(window, "mouseleave", mousegeneral, { capture: true }), + attachListener(window, "mouseout", mousegeneral, { capture: true }), + attachListener(window, "mouseover", mousegeneral, { capture: true }), + attachListener(window, "mousemove", mousemove, { capture: true }), + attachListener(window, "mouseup", mouseup, { capture: true }) + ); + self.mouseDragger = this; + glob.globalMouseDragCallbacks = myCallbacks; + glob.globalMouseDragCallbacks.mousedown(downEvent); + downEvent.stopPropagation(); + downEvent.stopImmediatePropagation(); + } + destroy() { + this.cleanup.flush(); + this.glob.globalMouseDragCallbacks = void 0; + this.self.mouseDragger = void 0; + } +}; +function startMouseDrag(glob, self, myCallbacks, downEvent) { + if (glob.globalMouseDragCallbacks != null) + return void 0; + return new MouseDragger(glob, self, myCallbacks, downEvent); +} + +// packages/ag-charts-community/src/widget/touchDragger.ts +var LONG_TAP_DURATION_MS = 500; +var LONG_TAP_INTERRUPT_MIN_TOUCHMOVE_PXPX = 100; +function deltaClientSquared(a, b) { + const dx2 = a.clientX - b.clientX; + const dy2 = a.clientY - b.clientY; + return dx2 * dx2 + dy2 * dy2; +} +var gIsInLongTap = false; +var TouchDragger = class { + constructor(glob, self, myCallbacks, initialTouch, target) { + this.glob = glob; + this.self = self; + this.initialTouch = initialTouch; + this.target = target; + this.cleanup = new CleanupRegistry(); + this.longTapInterrupted = false; + this.longtap = () => { + const { target, initialTouch } = this; + if (!this.longTapInterrupted) { + const cleanup = new CleanupRegistry(); + target.dispatchEvent(new TouchEvent("touchcancel", { touches: [initialTouch], bubbles: true })); + gIsInLongTap = true; + const longTapMove = (e) => e.preventDefault(); + const longTapEnd = (e) => { + gIsInLongTap = false; + e.preventDefault(); + cleanup.flush(); + }; + cleanup.register( + attachListener(target, "touchmove", longTapMove, { passive: false }), + attachListener(target, "touchend", longTapEnd, { passive: false }), + attachListener(target, "touchcancel", longTapEnd, { passive: false }) + ); + const { clientX, clientY } = initialTouch; + const contextMenuEvent = new PointerEvent("contextmenu", { + bubbles: true, + cancelable: true, + view: getWindow(), + clientX, + clientY, + pointerType: "touch" + }); + target.dispatchEvent(contextMenuEvent); + } + }; + this.touchmove = (moveEvent) => { + const { glob, self, initialTouch } = this; + const touch = this.findInitialFinger(moveEvent.targetTouches); + if (touch != null) { + this.longTapInterrupted = this.longTapInterrupted || deltaClientSquared(initialTouch, touch) > LONG_TAP_INTERRUPT_MIN_TOUCHMOVE_PXPX; + if (self.dragTouchEnabled) { + glob.globalTouchDragCallbacks?.touchmove(moveEvent, touch); + } + } + }; + this.touchend = (endEvent) => { + this.longTapInterrupted = true; + const touch = this.findInitialFinger(endEvent.changedTouches, endEvent.touches); + if (touch != null) { + this.glob.globalTouchDragCallbacks?.touchend(endEvent, touch); + } + this.destroy(); + }; + this.longtapTimer = setTimeout(this.longtap, LONG_TAP_DURATION_MS); + const { touchmove, touchend } = this; + this.cleanup.register( + attachListener(target, "touchmove", touchmove, { passive: false }), + attachListener(target, "touchstart", touchend, { passive: false }), + attachListener(target, "touchend", touchend, { passive: false }), + attachListener(target, "touchcancel", touchend, { passive: false }) + ); + self.touchDragger = this; + glob.globalTouchDragCallbacks = myCallbacks; + } + destroy() { + clearTimeout(this.longtapTimer); + this.cleanup.flush(); + this.glob.globalTouchDragCallbacks = void 0; + this.self.touchDragger = void 0; + } + findInitialFinger(...touchLists) { + const touches = touchLists.flatMap((touchList) => Array.from(touchList)); + return Array.from(touches).find((v) => v.identifier === this.initialTouch.identifier); + } +}; +function startOneFingerTouch(glob, self, myCallbacks, initialTouch, target) { + if (glob.globalTouchDragCallbacks != null || gIsInLongTap) + return void 0; + return new TouchDragger(glob, self, myCallbacks, initialTouch, target); +} + +// packages/ag-charts-community/src/widget/widgetListenerInternal.ts +function makeMouseDrag(current, type, origin3, sourceEvent) { + const { currentX, currentY } = WidgetEventUtil.calcCurrentXY(current.getElement(), sourceEvent); + const originDeltaX = sourceEvent.pageX - origin3.pageX; + const originDeltaY = sourceEvent.pageY - origin3.pageY; + return { + type, + device: "mouse", + offsetX: origin3.offsetX + originDeltaX, + offsetY: origin3.offsetY + originDeltaY, + clientX: sourceEvent.clientX, + clientY: sourceEvent.clientY, + currentX, + currentY, + originDeltaX, + originDeltaY, + sourceEvent + }; +} +function getTouchOffsets(current, { pageX, pageY }) { + const { x, y } = current.getElement().getBoundingClientRect(); + return { offsetX: pageX - x, offsetY: pageY - y }; +} +function makeTouchDrag(current, type, origin3, sourceEvent, touch) { + const { currentX, currentY } = WidgetEventUtil.calcCurrentXY(current.getElement(), touch); + const originDeltaX = touch.pageX - origin3.pageX; + const originDeltaY = touch.pageY - origin3.pageY; + return { + type, + device: "touch", + offsetX: origin3.offsetX + originDeltaX, + offsetY: origin3.offsetY + originDeltaY, + clientX: touch.clientX, + clientY: touch.clientY, + currentX, + currentY, + originDeltaX, + originDeltaY, + sourceEvent + }; +} +var GlobalCallbacks = {}; +var WidgetListenerInternal = class { + constructor(dispatchCallback) { + this.dispatchCallback = dispatchCallback; + this.dragTouchEnabled = true; + } + destroy() { + this.dragTriggerRemover?.(); + this.dragTriggerRemover = void 0; + this.listeners?.clear(); + this.mouseDragger?.destroy(); + this.touchDragger?.destroy(); + } + getListenerSet(type) { + this.listeners ?? (this.listeners = /* @__PURE__ */ new Map()); + let result = this.listeners.get(type); + if (result === void 0) { + result = /* @__PURE__ */ new Set(); + this.listeners.set(type, result); + } + return result; + } + add(type, target, handler) { + this.getListenerSet(type).add(handler); + switch (type) { + case "drag-start": + case "drag-move": + case "drag-end": { + this.registerDragTrigger(target); + break; + } + } + } + remove(type, _target, handler) { + this.getListenerSet(type).delete(handler); + } + registerDragTrigger(target) { + if (this.dragTriggerRemover == null) { + const element2 = target.getElement(); + const cleanup = new CleanupRegistry(); + cleanup.register( + attachListener(element2, "mousedown", (event) => this.triggerMouseDrag(target, event)), + attachListener(element2, "touchstart", (event) => this.triggerTouchDrag(target, event), { + passive: false + }) + ); + this.dragTriggerRemover = () => cleanup.flush(); + } + } + triggerMouseDrag(current, downEvent) { + if (downEvent.button === 0) { + this.startMouseDrag(current, downEvent); + } + } + startMouseDrag(current, initialDownEvent) { + const origin3 = { pageX: Number.NaN, pageY: Number.NaN, offsetX: Number.NaN, offsetY: Number.NaN }; + partialAssign(["pageX", "pageY", "offsetX", "offsetY"], origin3, initialDownEvent); + const dragCallbacks = { + mousedown: (downEvent) => { + const dragStartEvent = makeMouseDrag(current, "drag-start", origin3, downEvent); + this.dispatch("drag-start", current, dragStartEvent); + }, + mousemove: (moveEvent) => { + const dragMoveEvent = makeMouseDrag(current, "drag-move", origin3, moveEvent); + this.dispatch("drag-move", current, dragMoveEvent); + }, + mouseup: (upEvent) => { + const dragEndEvent = makeMouseDrag(current, "drag-end", origin3, upEvent); + this.dispatch("drag-end", current, dragEndEvent); + this.endDrag(current, dragEndEvent); + } + }; + this.mouseDragger = startMouseDrag(GlobalCallbacks, this, dragCallbacks, initialDownEvent); + } + endDrag(target, { sourceEvent, clientX, clientY }) { + const elem = target.getElement(); + const rect2 = elem.getBoundingClientRect(); + if (!boxContains(rect2, clientX, clientY)) { + elem.dispatchEvent(new MouseEvent("mouseleave", sourceEvent)); + sourceEvent.target?.dispatchEvent(new MouseEvent("mouseenter", sourceEvent)); + } + } + triggerTouchDrag(current, startEvent) { + const touch = startEvent.targetTouches[0]; + if (startEvent.targetTouches.length === 1 && touch != null) { + this.startOneFingerTouch(current, startEvent, touch); + } + } + startOneFingerTouch(current, initialEvent, initialTouch) { + const origin3 = { pageX: Number.NaN, pageY: Number.NaN, ...getTouchOffsets(current, initialTouch) }; + partialAssign(["pageX", "pageY"], origin3, initialTouch); + const dragCallbacks = { + touchmove: (moveEvent, touch) => { + const dragMoveEvent = makeTouchDrag(current, "drag-move", origin3, moveEvent, touch); + this.dispatch("drag-move", current, dragMoveEvent); + }, + touchend: (cancelEvent, touch) => { + const dragMoveEvent = makeTouchDrag(current, "drag-end", origin3, cancelEvent, touch); + this.dispatch("drag-end", current, dragMoveEvent); + } + }; + const target = current.getElement(); + this.touchDragger = startOneFingerTouch(GlobalCallbacks, this, dragCallbacks, initialTouch, target); + const dragStartEvent = makeTouchDrag(current, "drag-start", origin3, initialEvent, initialTouch); + this.dispatch("drag-start", current, dragStartEvent); + } + dispatch(type, current, event) { + for (const handler of this.getListenerSet(type)) { + handler(event, current); + } + this.dispatchCallback(type, event); + } +}; + +// packages/ag-charts-community/src/widget/widget.ts +var WidgetBounds = class { + constructor(elem) { + this.elem = elem; + } + setBounds(bounds) { + setElementBBox(this.elemContainer ?? this.elem, bounds); + } + getBounds() { + return getElementBBox(this.elemContainer ?? this.elem); + } + static setElementContainer(widget, elemContainer) { + const currentBounds = widget.getBounds(); + setElementBBox(elemContainer, currentBounds); + setElementStyles(widget.elem, { width: "100%", height: "100%" }); + widget.elem.remove(); + widget.elemContainer = elemContainer; + widget.elemContainer.replaceChildren(widget.elem); + } +}; +var Widget = class extends WidgetBounds { + constructor() { + super(...arguments); + this.index = Number.NaN; + this.children = []; + } + set id(elementId) { + setAttribute(this.elem, "id", elementId); + } + get id() { + return getAttribute(this.elem, "id"); + } + getElement() { + return this.elem; + } + getBoundingClientRect() { + return this.elem.getBoundingClientRect(); + } + get clientWidth() { + return this.elem.clientWidth; + } + get clientHeight() { + return this.elem.clientHeight; + } + destroy() { + this.destroyListener?.(); + this.destroyListener = void 0; + this.remove(); + for (const child of this.children) { + child.parent = void 0; + child.destroy(); + } + this.children.length = 0; + this.destructor(); + this.remove(); + this.internalListener?.destroy(); + this.htmlListener?.destroy(this); + } + remove() { + this.elem.remove(); + this.elemContainer?.remove(); + } + setHidden(hidden) { + setElementStyle(this.elem, "display", hidden ? "none" : void 0); + } + isHidden() { + return getWindow()?.getComputedStyle?.(this.elem).display === "none"; + } + setCursor(cursor) { + setElementStyle(this.elem, "cursor", cursor); + } + setTextContent(textContent) { + this.elem.textContent = textContent ?? null; + } + setAriaDescribedBy(ariaDescribedBy) { + setAttribute(this.elem, "aria-describedby", ariaDescribedBy); + } + setAriaHidden(ariaHidden) { + setAttribute(this.elem, "aria-hidden", ariaHidden); + } + setAriaLabel(ariaLabel) { + setAttribute(this.elem, "aria-label", ariaLabel); + } + setAriaExpanded(ariaExpanded) { + setAttribute(this.elem, "aria-expanded", ariaExpanded); + } + setAriaControls(ariaControls) { + setAttribute(this.elem, "aria-controls", ariaControls); + } + setAriaHasPopup(ariaHasPopup) { + setAttribute(this.elem, "aria-haspopup", ariaHasPopup); + } + setInnerHTML(html) { + this.elem.innerHTML = html; + } + setPointerEvents(pointerEvents) { + setElementStyle(this.elem, "pointer-events", pointerEvents); + } + setCSSVariable(key, value) { + this.elem.style.setProperty(key, value); + } + isDisabled() { + return getAttribute(this.elem, "aria-disabled", false); + } + hasPopup() { + const ariaHasPopup = getAttribute(this.elem, "aria-haspopup"); + return ariaHasPopup !== void 0 && ariaHasPopup !== "false"; + } + parseFloat(s) { + return s === "" ? 0 : Number.parseFloat(s); + } + cssLeft() { + return this.parseFloat(this.elem.style.left); + } + cssTop() { + return this.parseFloat(this.elem.style.top); + } + cssWidth() { + return this.parseFloat(this.elem.style.width); + } + cssHeight() { + return this.parseFloat(this.elem.style.height); + } + focus(opts) { + this.elem.focus(opts); + } + setFocusOverride(focus) { + setAttribute(this.elem, "data-focus-override", focus); + } + setPreventsDefault(preventDefault) { + setAttribute(this.elem, "data-preventdefault", preventDefault); + } + setTabIndex(tabIndex) { + setAttribute(this.elem, "tabindex", tabIndex); + } + addChild(child) { + this.addChildToDOM(child, this.getBefore(child)); + this.children.push(child); + child.index = this.children.length - 1; + child.parent = this; + this.onChildAdded(child); + } + removeChild(child) { + const i = this.children.indexOf(child); + this.children.splice(i, 1); + this.removeChildFromDOM(child); + this.onChildRemoved(child); + } + moveChild(child, domIndex) { + if (child.domIndex === domIndex) + return; + child.domIndex = domIndex; + this.removeChildFromDOM(child); + this.addChildToDOM(child, this.getBefore(child)); + } + addClass(...tokens) { + this.elem.classList.add(...tokens); + } + removeClass(...tokens) { + this.elem.classList.remove(...tokens); + } + toggleClass(token, force) { + this.elem.classList.toggle(token, force); + } + appendOrInsert(child, before) { + if (before) { + before.getElement().insertAdjacentElement("beforebegin", child); + } else { + this.elem.appendChild(child); + } + } + addChildToDOM(child, before) { + this.appendOrInsert(child.getElement(), before); + } + removeChildFromDOM(child) { + child.getElement().remove(); + } + onChildAdded(_child) { + } + onChildRemoved(_child) { + } + getBefore({ domIndex }) { + if (domIndex === void 0) + return void 0; + return this.children.filter((child) => child.domIndex !== void 0 && child.domIndex > domIndex).reduce((prev, curr) => !prev || curr.domIndex < prev.domIndex ? curr : prev, void 0); + } + addListener(type, listener) { + if (WidgetEventUtil.isHTMLEvent(type)) { + this.htmlListener ?? (this.htmlListener = new WidgetListenerHTML()); + this.htmlListener.add(type, this, listener); + } else { + this.internalListener ?? (this.internalListener = new WidgetListenerInternal(this.onDispatch.bind(this))); + this.internalListener.add(type, this, listener); + } + return () => this.removeListener(type, listener); + } + removeListener(type, listener) { + if (WidgetEventUtil.isHTMLEvent(type)) { + this.htmlListener?.remove(type, this, listener); + } else if (this.htmlListener != null) { + this.internalListener?.remove(type, this, listener); + } + } + setDragTouchEnabled(dragTouchEnabled) { + this.internalListener ?? (this.internalListener = new WidgetListenerInternal(this.onDispatch.bind(this))); + this.internalListener.dragTouchEnabled = dragTouchEnabled; + } + onDispatch(type, event) { + if (!event.sourceEvent?.bubbles) + return; + let { parent } = this; + while (parent != null) { + const { internalListener } = parent; + if (internalListener != null) { + const parentEvent = { ...event, ...WidgetEventUtil.calcCurrentXY(parent.getElement(), event) }; + internalListener.dispatch(type, parent, parentEvent); + } + parent = parent.parent; + } + } + static addWindowEvent(_type, listener) { + const pagehideHandler = (event) => { + if (event.persisted) { + return; + } + listener(); + }; + return attachListener(getWindow(), "pagehide", pagehideHandler); + } +}; + +// packages/ag-charts-community/src/scene/sceneDebug.ts +var StatsAccumulator = class { + // Log every 10 seconds + constructor() { + this.stats = /* @__PURE__ */ new Map(); + this.lastLogTime = Date.now(); + this.LOG_INTERVAL_MS = 1e4; + this.startPeriodicLogging(); + } + startPeriodicLogging() { + if (!Debug.check("scene:stats" /* SCENE_STATS */, "scene:stats:verbose" /* SCENE_STATS_VERBOSE */)) { + return; + } + this.stopPeriodicLogging(); + this.intervalId = setInterval(() => { + this.logAccumulatedStats(); + }, this.LOG_INTERVAL_MS); + } + stopPeriodicLogging() { + if (this.intervalId) { + clearInterval(this.intervalId); + this.intervalId = void 0; + } + } + recordTiming(category, duration) { + const existing = this.stats.get(category); + if (existing) { + existing.min = Math.min(existing.min, duration); + existing.max = Math.max(existing.max, duration); + existing.sum += duration; + existing.count += 1; + } else { + this.stats.set(category, { + min: duration, + max: duration, + sum: duration, + count: 1 + }); + } + } + recordTimings(durations) { + for (const [category, duration] of Object.entries(durations)) { + if (category !== "start" && typeof duration === "number") { + this.recordTiming(category, duration); + } + } + } + logAccumulatedStats() { + if (this.stats.size === 0) + return; + const timeSinceLastLog = (Date.now() - this.lastLogTime) / 1e3; + const categories = Array.from(this.stats.keys()).sort((a, b) => { + if (a === "\u23F1\uFE0F") + return -1; + if (b === "\u23F1\uFE0F") + return 1; + return a.localeCompare(b); + }); + const parts = []; + for (const category of categories) { + const stats = this.stats.get(category); + const avg = stats.sum / stats.count; + parts.push(`${category}[${stats.min.toFixed(1)}/${avg.toFixed(1)}/${stats.max.toFixed(1)}]ms`); + } + const totalStats = this.stats.get("\u23F1\uFE0F"); + const count = totalStats?.count ?? 0; + logger_exports.log(`\u{1F4CA} Stats (${timeSinceLastLog.toFixed(0)}s, ${count} renders): ${parts.join(" ")}`); + this.stats.clear(); + this.lastLogTime = Date.now(); + } + destroy() { + this.stopPeriodicLogging(); + this.stats.clear(); + } +}; +var globalStatsAccumulator; +var statsAccumulatorConsumers = 0; +function getStatsAccumulator() { + globalStatsAccumulator ?? (globalStatsAccumulator = new StatsAccumulator()); + return globalStatsAccumulator; +} +function registerDebugStatsConsumer() { + statsAccumulatorConsumers++; + let released = false; + return () => { + if (released || statsAccumulatorConsumers === 0) + return; + released = true; + statsAccumulatorConsumers--; + if (statsAccumulatorConsumers === 0) { + cleanupDebugStats(); + } + }; +} +function formatBytes(value) { + for (const unit of ["B", "KB", "MB", "GB"]) { + if (value < 1536) { + return `${value.toFixed(1)}${unit}`; + } + value /= 1024; + } + return `${value.toFixed(1)}TB}`; +} +function memoryUsage() { + if (!("memory" in performance)) + return; + const { totalJSHeapSize, usedJSHeapSize, jsHeapSizeLimit } = performance.memory; + const result = []; + for (const amount of [usedJSHeapSize, totalJSHeapSize, jsHeapSizeLimit]) { + if (typeof amount !== "number") + continue; + result.push(formatBytes(amount)); + } + return `Heap ${result.join(" / ")}`; +} +function debugStats(layersManager, debugSplitTimes, ctx, renderCtxStats, extraDebugStats = {}, seriesRect = BBox.zero) { + if (!Debug.check("scene:stats" /* SCENE_STATS */, "scene:stats:verbose" /* SCENE_STATS_VERBOSE */)) + return; + const { + layersRendered = 0, + layersSkipped = 0, + nodesRendered = 0, + nodesSkipped = 0, + opsPerformed = 0, + opsSkipped = 0 + } = renderCtxStats ?? {}; + const end3 = performance.now(); + const { start: start2, ...durations } = debugSplitTimes; + const totalTime = end3 - start2; + const statsAccumulator = getStatsAccumulator(); + statsAccumulator.recordTimings(durations); + statsAccumulator.recordTiming("\u23F1\uFE0F", totalTime); + const splits = Object.entries(durations).map(([n, t]) => time(n, t)).filter((v) => v != null).join(" + "); + const extras = Object.entries(extraDebugStats).map(([k, v]) => `${k}: ${JSON.stringify(v)}`).join(" ; "); + const detailedStats = Debug.check("scene:stats:verbose" /* SCENE_STATS_VERBOSE */); + const memUsage = detailedStats ? memoryUsage() : null; + const stats = [ + `${time("\u23F1\uFE0F", start2, end3)} (${splits})`, + `${extras}`, + `Layers: ${detailedStats ? pct(layersRendered, layersSkipped) : layersManager.size}`, + detailedStats ? `Nodes: ${pct(nodesRendered, nodesSkipped)}` : null, + detailedStats ? `Ops: ${pct(opsPerformed, opsSkipped)}` : null, + memUsage + ].filter(isString); + const measurer3 = new TextMeasurer(ctx); + const statsSize = new Map(stats.map((t) => [t, measurer3.measureText(t)])); + const width2 = Math.max(...Array.from(statsSize.values(), (s) => s.width)); + const height2 = accumulate(statsSize.values(), (s) => s.height); + const x = 2 + seriesRect.x; + ctx.save(); + try { + ctx.fillStyle = "white"; + ctx.fillRect(x, 0, width2, height2); + ctx.fillStyle = "black"; + let y = 0; + for (const [stat, size] of statsSize.entries()) { + y += size.height; + ctx.fillText(stat, x, y); + } + } catch (e) { + logger_exports.warnOnce("Error during debug stats rendering", e); + } finally { + ctx.restore(); + } +} +function prepareSceneNodeHighlight(ctx) { + const config = toArray(getWindow("agChartsSceneDebug")); + const result = []; + for (const name of config) { + if (name === "layout") { + result.push("seriesRoot", "legend", "root", /.*Axis-\d+-axis.*/); + } else { + result.push(name); + } + } + ctx.debugNodeSearch = result; +} +function debugSceneNodeHighlight(ctx, debugNodes) { + ctx.save(); + try { + for (const [name, node] of Object.entries(debugNodes)) { + const bbox = Transformable.toCanvas(node); + if (!bbox) { + logger_exports.log(`Scene.render() - no bbox for debugged node [${name}].`); + continue; + } + ctx.globalAlpha = 0.8; + ctx.strokeStyle = "red"; + ctx.lineWidth = 1; + ctx.strokeRect(bbox.x, bbox.y, bbox.width, bbox.height); + ctx.fillStyle = "red"; + ctx.strokeStyle = "white"; + ctx.font = "16px sans-serif"; + ctx.textBaseline = "top"; + ctx.textAlign = "left"; + ctx.lineWidth = 2; + ctx.strokeText(name, bbox.x, bbox.y, bbox.width); + ctx.fillText(name, bbox.x, bbox.y, bbox.width); + } + } catch (e) { + logger_exports.warnOnce("Error during debug rendering", e); + } finally { + ctx.restore(); + } +} +var skippedProperties = /* @__PURE__ */ new Set(); +var allowedProperties = /* @__PURE__ */ new Set([ + "gradient", + // '_datum', + "zIndex", + "clipRect", + "cachedBBox", + "childNodeCounts", + "path", + "__zIndex", + "name", + "__scalingCenterX", + "__scalingCenterY", + "__rotationCenterX", + "__rotationCenterY", + "_previousDatum", + "__fill", + "__lineDash", + "borderPath", + "borderClipPath", + "_clipPath" +]); +function nodeProps(node) { + const { ...allProps } = node; + for (const prop of Object.keys(allProps)) { + if (allowedProperties.has(prop)) + continue; + if (typeof allProps[prop] === "number") + continue; + if (typeof allProps[prop] === "string") + continue; + if (typeof allProps[prop] === "boolean") + continue; + skippedProperties.add(prop); + delete allProps[prop]; + } + return allProps; +} +function buildTree(node, mode) { + if (!Debug.check(true, "scene" /* SCENE */)) { + return {}; + } + let order = 0; + return { + node: mode === "json" ? nodeProps(node) : node, + name: node.name ?? node.id, + dirty: node instanceof Group ? node.dirty : void 0, + ...Array.from(node instanceof Group ? node.children() : [], (c) => buildTree(c, mode)).reduce((result, childTree) => { + let { name: treeNodeName } = childTree; + const { + node: { visible, opacity, zIndex, translationX, translationY, rotation, scalingX, scalingY }, + node: childNode + } = childTree; + if (!visible || opacity <= 0) { + treeNodeName = `(${treeNodeName})`; + } + if (Group.is(childNode) && childNode.renderToOffscreenCanvas) { + treeNodeName = `*${treeNodeName}*`; + } + const zIndexString = Array.isArray(zIndex) ? `(${zIndex.join(", ")})` : zIndex; + const key = [ + `${(order++).toString().padStart(3, "0")}|`, + `${treeNodeName ?? ""}`, + `z: ${zIndexString}`, + translationX && `x: ${translationX}`, + translationY && `y: ${translationY}`, + rotation && `r: ${rotation}`, + scalingX != null && scalingX !== 1 && `sx: ${scalingX}`, + scalingY != null && scalingY !== 1 && `sy: ${scalingY}` + ].filter((v) => !!v).join(" "); + let selectedKey = key; + let index = 1; + while (result[selectedKey] != null && index < 100) { + selectedKey = `${key} (${index++})`; + } + result[selectedKey] = childTree; + return result; + }, {}) + }; +} +function buildDirtyTree(node) { + const nodeDirty = node instanceof Group ? node.dirty : void 0; + if (!nodeDirty) { + return { dirtyTree: {}, paths: [] }; + } + const childrenDirtyTree = Array.from(node instanceof Group ? node.children() : [], (c) => buildDirtyTree(c)).filter( + (c) => c.paths.length > 0 + ); + const name = Group.is(node) ? node.name ?? node.id : node.id; + const paths = childrenDirtyTree.length ? childrenDirtyTree.flatMap((c) => c.paths).map((p) => `${name}.${p}`) : [name]; + return { + dirtyTree: { + name, + node, + dirty: nodeDirty, + ...childrenDirtyTree.map((c) => c.dirtyTree).filter((t) => t.dirty != null).reduce((result, childTree) => { + result[childTree.name ?? ""] = childTree; + return result; + }, {}) + }, + paths + }; +} +function pct(rendered, skipped) { + const total = rendered + skipped; + return `${rendered} / ${total} (${Math.round(100 * rendered / total)}%)`; +} +function time(name, start2, end3) { + const duration = end3 == null ? start2 : end3 - start2; + return `${name}: ${Math.round(duration * 100) / 100}ms`; +} +function accumulate(iterator, mapper) { + let sum2 = 0; + for (const item of iterator) { + sum2 += mapper(item); + } + return sum2; +} +function cleanupDebugStats(force = false) { + if (!globalStatsAccumulator) { + if (force) { + statsAccumulatorConsumers = 0; + } + return; + } + if (!force && statsAccumulatorConsumers > 0) { + return; + } + globalStatsAccumulator.destroy(); + globalStatsAccumulator = void 0; + if (force) { + statsAccumulatorConsumers = 0; + } +} + +// packages/ag-charts-community/src/scene/util/corner.ts +var drawCorner = (path, { x0, y0, x1, y1, cx, cy }, cornerRadius, move) => { + if (move) { + path.moveTo(x0, y0); + } + if (x0 !== x1 || y0 !== y1) { + const r0 = Math.atan2(y0 - cy, x0 - cx); + const r1 = Math.atan2(y1 - cy, x1 - cx); + path.arc(cx, cy, cornerRadius, r0, r1); + } else { + path.lineTo(x0, y0); + } +}; + +// packages/ag-charts-community/src/scene/shape/path.ts +var Path = class extends Shape { + constructor() { + super(...arguments); + /** + * Declare a path to retain for later rendering and hit testing + * using custom Path2D class. Think of it as a TypeScript version + * of the native Path2D (with some differences) that works in all browsers. + */ + this.path = new ExtendedPath2D(); + this._clipX = Number.NaN; + this._clipY = Number.NaN; + this.clip = false; + /** + * The path only has to be updated when certain attributes change. + * For example, if transform attributes (such as `translationX`) + * are changed, we don't have to update the path. The `dirtyPath` flag + * is how we keep track if the path has to be updated or not. + */ + this._dirtyPath = true; + this.lastPixelRatio = Number.NaN; + } + set clipX(value) { + this._clipX = value; + this.dirtyPath = true; + } + set clipY(value) { + this._clipY = value; + this.dirtyPath = true; + } + set dirtyPath(value) { + if (this._dirtyPath !== value) { + this._dirtyPath = value; + if (value) { + this.markDirty("path"); + } + } + } + get dirtyPath() { + return this._dirtyPath; + } + checkPathDirty() { + if (this._dirtyPath) { + return; + } + this.dirtyPath = this.path.isDirty() || (this.fillShadow?.isDirty() ?? false) || (this._clipPath?.isDirty() ?? false); + } + resetPathDirty() { + this.path.clear(true); + this._dirtyPath = false; + } + isPathDirty() { + return this.path.isDirty(); + } + onChangeDetection(property) { + if (!this._dirtyPath) { + this._dirtyPath = true; + super.onChangeDetection(property); + } + } + computeBBox() { + this.updatePathIfDirty(); + return this.path.computeBBox(); + } + isPointInPath(x, y) { + this.updatePathIfDirty(); + return this.path.closedPath && this.path.isPointInPath(x, y); + } + distanceSquared(x, y) { + return this.distanceSquaredTransformedPoint(x, y); + } + svgPathData(transform) { + this.updatePathIfDirty(); + return this.path.toSVG(transform); + } + distanceSquaredTransformedPoint(x, y) { + this.updatePathIfDirty(); + if (this.path.closedPath && this.path.isPointInPath(x, y)) { + return 0; + } + return this.path.distanceSquared(x, y); + } + isDirtyPath() { + return false; + } + updatePath() { + } + updatePathIfDirty() { + if (this.dirtyPath || this.isDirtyPath()) { + this.updatePath(); + this.dirtyPath = false; + } + } + preRender(renderCtx) { + if (renderCtx.devicePixelRatio !== this.lastPixelRatio) { + this.dirtyPath = true; + } + this.lastPixelRatio = renderCtx.devicePixelRatio; + this.updatePathIfDirty(); + return super.preRender(renderCtx, this.path.commands.length); + } + render(renderCtx) { + const { ctx } = renderCtx; + if (this.clip && !Number.isNaN(this._clipX) && !Number.isNaN(this._clipY)) { + ctx.save(); + try { + const margin = this.strokeWidth / 2; + this._clipPath ?? (this._clipPath = new ExtendedPath2D()); + this._clipPath.clear(); + this._clipPath.rect(-margin, -margin, this._clipX + margin, this._clipY + margin + margin); + ctx.clip(this._clipPath?.getPath2D()); + if (this._clipX > 0 && this._clipY > 0) { + this.drawPath(ctx); + } + } finally { + ctx.restore(); + } + } else { + this._clipPath = void 0; + this.drawPath(ctx); + } + this.fillShadow?.markClean(); + super.render(renderCtx); + } + drawPath(ctx) { + this.fillStroke(ctx, this.path.getPath2D()); + } + toSVG() { + if (!this.visible) + return; + const element2 = createSvgElement("path"); + element2.setAttribute("d", this.svgPathData()); + const defs = this.applySvgFillAttributes(element2, []); + this.applySvgStrokeAttributes(element2); + return { + elements: [element2], + defs + }; + } +}; +Path.className = "Path"; +__decorateClass([ + SceneChangeDetection() +], Path.prototype, "clip", 2); +__decorateClass([ + SceneChangeDetection() +], Path.prototype, "clipX", 1); +__decorateClass([ + SceneChangeDetection() +], Path.prototype, "clipY", 1); + +// packages/ag-charts-community/src/scene/shape/rect.ts +var cornerEdges = (leadingEdge, trailingEdge, leadingInset, trailingInset, cornerRadius) => { + let leadingClipped = false; + let trailingClipped = false; + let leading0 = trailingInset - Math.sqrt(Math.max(cornerRadius ** 2 - leadingInset ** 2, 0)); + let leading1 = 0; + let trailing0 = 0; + let trailing1 = leadingInset - Math.sqrt(Math.max(cornerRadius ** 2 - trailingInset ** 2, 0)); + if (leading0 > leadingEdge) { + leadingClipped = true; + leading0 = leadingEdge; + leading1 = leadingInset - Math.sqrt(Math.max(cornerRadius ** 2 - (trailingInset - leadingEdge) ** 2)); + } else if (isNumberEqual(leading0, 0)) { + leading0 = 0; + } + if (trailing1 > trailingEdge) { + trailingClipped = true; + trailing0 = trailingInset - Math.sqrt(Math.max(cornerRadius ** 2 - (leadingInset - trailingEdge) ** 2)); + trailing1 = trailingEdge; + } else if (isNumberEqual(trailing1, 0)) { + trailing1 = 0; + } + return { leading0, leading1, trailing0, trailing1, leadingClipped, trailingClipped }; +}; +var clippedRoundRect = (path, x, y, width2, height2, cornerRadii, clipBBox) => { + let { + topLeft: topLeftCornerRadius, + topRight: topRightCornerRadius, + bottomRight: bottomRightCornerRadius, + bottomLeft: bottomLeftCornerRadius + } = cornerRadii; + const maxVerticalCornerRadius = Math.max( + topLeftCornerRadius + bottomLeftCornerRadius, + topRightCornerRadius + bottomRightCornerRadius + ); + const maxHorizontalCornerRadius = Math.max( + topLeftCornerRadius + topRightCornerRadius, + bottomLeftCornerRadius + bottomRightCornerRadius + ); + if (maxVerticalCornerRadius <= 0 && maxHorizontalCornerRadius <= 0) { + if (clipBBox == null) { + path.rect(x, y, width2, height2); + } else { + const x0 = Math.max(x, clipBBox.x); + const x1 = Math.min(x + width2, clipBBox.x + clipBBox.width); + const y0 = Math.max(y, clipBBox.y); + const y1 = Math.min(y + height2, clipBBox.y + clipBBox.height); + path.rect(x0, y0, x1 - x0, y1 - y0); + } + return; + } else if (clipBBox == null && topLeftCornerRadius === topRightCornerRadius && topLeftCornerRadius === bottomRightCornerRadius && topLeftCornerRadius === bottomLeftCornerRadius) { + path.roundRect(x, y, width2, height2, topLeftCornerRadius); + return; + } + if (width2 < 0) { + x += width2; + width2 = Math.abs(width2); + } + if (height2 < 0) { + y += height2; + height2 = Math.abs(height2); + } + if (width2 <= 0 || height2 <= 0) + return; + if (clipBBox == null) { + clipBBox = new BBox(x, y, width2, height2); + } else { + const x0 = Math.max(x, clipBBox.x); + const x1 = Math.min(x + width2, clipBBox.x + clipBBox.width); + const y0 = Math.max(y, clipBBox.y); + const y1 = Math.min(y + height2, clipBBox.y + clipBBox.height); + clipBBox = new BBox(x0, y0, x1 - x0, y1 - y0); + } + const borderScale = Math.max(maxVerticalCornerRadius / height2, maxHorizontalCornerRadius / width2, 1); + if (borderScale > 1) { + topLeftCornerRadius /= borderScale; + topRightCornerRadius /= borderScale; + bottomRightCornerRadius /= borderScale; + bottomLeftCornerRadius /= borderScale; + } + let drawTopLeftCorner = true; + let drawTopRightCorner = true; + let drawBottomRightCorner = true; + let drawBottomLeftCorner = true; + let topLeftCorner; + let topRightCorner; + let bottomRightCorner; + let bottomLeftCorner; + if (drawTopLeftCorner) { + const nodes = cornerEdges( + clipBBox.height, + clipBBox.width, + Math.max(x + topLeftCornerRadius - clipBBox.x, 0), + Math.max(y + topLeftCornerRadius - clipBBox.y, 0), + topLeftCornerRadius + ); + if (nodes.leadingClipped) + drawBottomLeftCorner = false; + if (nodes.trailingClipped) + drawTopRightCorner = false; + const x0 = Math.max(clipBBox.x + nodes.leading1, clipBBox.x); + const y0 = Math.max(clipBBox.y + nodes.leading0, clipBBox.y); + const x1 = Math.max(clipBBox.x + nodes.trailing1, clipBBox.x); + const y1 = Math.max(clipBBox.y + nodes.trailing0, clipBBox.y); + const cx = x + topLeftCornerRadius; + const cy = y + topLeftCornerRadius; + topLeftCorner = { x0, y0, x1, y1, cx, cy }; + } + if (drawTopRightCorner) { + const nodes = cornerEdges( + clipBBox.width, + clipBBox.height, + Math.max(y + topRightCornerRadius - clipBBox.y, 0), + Math.max(clipBBox.x + clipBBox.width - (x + width2 - topRightCornerRadius), 0), + topRightCornerRadius + ); + if (nodes.leadingClipped) + drawTopLeftCorner = false; + if (nodes.trailingClipped) + drawBottomRightCorner = false; + const x0 = Math.min(clipBBox.x + clipBBox.width - nodes.leading0, clipBBox.x + clipBBox.width); + const y0 = Math.max(clipBBox.y + nodes.leading1, clipBBox.y); + const x1 = Math.min(clipBBox.x + clipBBox.width - nodes.trailing0, clipBBox.x + clipBBox.width); + const y1 = Math.max(clipBBox.y + nodes.trailing1, clipBBox.y); + const cx = x + width2 - topRightCornerRadius; + const cy = y + topRightCornerRadius; + topRightCorner = { x0, y0, x1, y1, cx, cy }; + } + if (drawBottomRightCorner) { + const nodes = cornerEdges( + clipBBox.height, + clipBBox.width, + Math.max(clipBBox.x + clipBBox.width - (x + width2 - bottomRightCornerRadius), 0), + Math.max(clipBBox.y + clipBBox.height - (y + height2 - bottomRightCornerRadius), 0), + bottomRightCornerRadius + ); + if (nodes.leadingClipped) + drawTopRightCorner = false; + if (nodes.trailingClipped) + drawBottomLeftCorner = false; + const x0 = Math.min(clipBBox.x + clipBBox.width - nodes.leading1, clipBBox.x + clipBBox.width); + const y0 = Math.min(clipBBox.y + clipBBox.height - nodes.leading0, clipBBox.y + clipBBox.height); + const x1 = Math.min(clipBBox.x + clipBBox.width - nodes.trailing1, clipBBox.x + clipBBox.width); + const y1 = Math.min(clipBBox.y + clipBBox.height - nodes.trailing0, clipBBox.y + clipBBox.height); + const cx = x + width2 - bottomRightCornerRadius; + const cy = y + height2 - bottomRightCornerRadius; + bottomRightCorner = { x0, y0, x1, y1, cx, cy }; + } + if (drawBottomLeftCorner) { + const nodes = cornerEdges( + clipBBox.width, + clipBBox.height, + Math.max(clipBBox.y + clipBBox.height - (y + height2 - bottomLeftCornerRadius), 0), + Math.max(x + bottomLeftCornerRadius - clipBBox.x, 0), + bottomLeftCornerRadius + ); + if (nodes.leadingClipped) + drawBottomRightCorner = false; + if (nodes.trailingClipped) + drawTopLeftCorner = false; + const x0 = Math.max(clipBBox.x + nodes.leading0, clipBBox.x); + const y0 = Math.min(clipBBox.y + clipBBox.height - nodes.leading1, clipBBox.y + clipBBox.height); + const x1 = Math.max(clipBBox.x + nodes.trailing0, clipBBox.x); + const y1 = Math.min(clipBBox.y + clipBBox.height - nodes.trailing1, clipBBox.y + clipBBox.height); + const cx = x + bottomLeftCornerRadius; + const cy = y + height2 - bottomLeftCornerRadius; + bottomLeftCorner = { x0, y0, x1, y1, cx, cy }; + } + let didMove = false; + if (drawTopLeftCorner && topLeftCorner != null) { + drawCorner(path, topLeftCorner, topLeftCornerRadius, !didMove); + didMove || (didMove = true); + } + if (drawTopRightCorner && topRightCorner != null) { + drawCorner(path, topRightCorner, topRightCornerRadius, !didMove); + didMove || (didMove = true); + } + if (drawBottomRightCorner && bottomRightCorner != null) { + drawCorner(path, bottomRightCorner, bottomRightCornerRadius, !didMove); + didMove || (didMove = true); + } + if (drawBottomLeftCorner && bottomLeftCorner != null) { + drawCorner(path, bottomLeftCorner, bottomLeftCornerRadius, !didMove); + } + path.closePath(); +}; +var Rect = class extends Path { + constructor() { + super(...arguments); + this.borderPath = new ExtendedPath2D(); + this.x = 0; + this.y = 0; + this.width = 10; + this.height = 10; + this.topLeftCornerRadius = 0; + this.topRightCornerRadius = 0; + this.bottomRightCornerRadius = 0; + this.bottomLeftCornerRadius = 0; + this.clipBBox = void 0; + this.crisp = false; + this.lastUpdatePathStrokeWidth = this.strokeWidth; + this.effectiveStrokeWidth = this.strokeWidth; + this.hittester = super.isPointInPath.bind(this); + this.distanceCalculator = super.distanceSquaredTransformedPoint.bind(this); + /** + * When the rectangle's width or height is less than a pixel + * and crisp mode is on, the rectangle will still fit into the pixel, + * but will be less opaque to make an effect of holding less space. + */ + this.microPixelEffectOpacity = 1; + } + set cornerRadius(cornerRadius) { + this.topLeftCornerRadius = cornerRadius; + this.topRightCornerRadius = cornerRadius; + this.bottomRightCornerRadius = cornerRadius; + this.bottomLeftCornerRadius = cornerRadius; + } + isDirtyPath() { + return this.lastUpdatePathStrokeWidth !== this.strokeWidth || Boolean(this.path.isDirty() || this.borderPath.isDirty()); + } + updatePath() { + const { + path, + borderPath, + crisp, + topLeftCornerRadius: topLeft, + topRightCornerRadius: topRight, + bottomRightCornerRadius: bottomRight, + bottomLeftCornerRadius: bottomLeft + } = this; + let { x, y, width: w, height: h, strokeWidth, clipBBox } = this; + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const pixelSize = 1 / pixelRatio; + let microPixelEffectOpacity = 1; + path.clear(true); + borderPath.clear(true); + if (w === 0 || h === 0) { + this.effectiveStrokeWidth = 0; + this.lastUpdatePathStrokeWidth = 0; + this.microPixelEffectOpacity = 0; + return; + } + if (crisp) { + if (w <= pixelSize) { + microPixelEffectOpacity *= w / pixelSize; + } + if (h <= pixelSize) { + microPixelEffectOpacity *= h / pixelSize; + } + w = this.align(x, w); + h = this.align(y, h); + x = this.align(x); + y = this.align(y); + clipBBox = clipBBox == null ? void 0 : new BBox( + this.align(clipBBox.x), + this.align(clipBBox.y), + this.align(clipBBox.x, clipBBox.width), + this.align(clipBBox.y, clipBBox.height) + ); + } + if (strokeWidth) { + if (w < pixelSize) { + const lx = x + pixelSize / 2; + borderPath.moveTo(lx, y); + borderPath.lineTo(lx, y + h); + strokeWidth = pixelSize; + this.borderClipPath = void 0; + } else if (h < pixelSize) { + const ly = y + pixelSize / 2; + borderPath.moveTo(x, ly); + borderPath.lineTo(x + w, ly); + strokeWidth = pixelSize; + this.borderClipPath = void 0; + } else if (strokeWidth < w && strokeWidth < h) { + const halfStrokeWidth = strokeWidth / 2; + x += halfStrokeWidth; + y += halfStrokeWidth; + w -= strokeWidth; + h -= strokeWidth; + const adjustedClipBBox = clipBBox?.clone().shrink(halfStrokeWidth); + const cornerRadii = { + topLeft: topLeft > 0 ? topLeft - strokeWidth : 0, + topRight: topRight > 0 ? topRight - strokeWidth : 0, + bottomRight: bottomRight > 0 ? bottomRight - strokeWidth : 0, + bottomLeft: bottomLeft > 0 ? bottomLeft - strokeWidth : 0 + }; + this.borderClipPath = void 0; + if (w > 0 && h > 0 && (adjustedClipBBox == null || adjustedClipBBox?.width > 0 && adjustedClipBBox?.height > 0)) { + clippedRoundRect(path, x, y, w, h, cornerRadii, adjustedClipBBox); + clippedRoundRect(borderPath, x, y, w, h, cornerRadii, adjustedClipBBox); + } + } else { + this.borderClipPath = this.borderClipPath ?? new ExtendedPath2D(); + this.borderClipPath.clear(true); + this.borderClipPath.rect(x, y, w, h); + borderPath.rect(x, y, w, h); + } + } else { + const cornerRadii = { topLeft, topRight, bottomRight, bottomLeft }; + this.borderClipPath = void 0; + clippedRoundRect(path, x, y, w, h, cornerRadii, clipBBox); + } + if ([topLeft, topRight, bottomRight, bottomLeft].every((r) => r === 0)) { + const bbox = this.getBBox(); + this.hittester = bbox.containsPoint.bind(bbox); + this.distanceSquared = (hitX, hitY) => this.getBBox().distanceSquared(hitX, hitY); + } else { + this.hittester = super.isPointInPath; + this.distanceCalculator = super.distanceSquaredTransformedPoint; + } + this.effectiveStrokeWidth = strokeWidth; + this.lastUpdatePathStrokeWidth = strokeWidth; + this.microPixelEffectOpacity = microPixelEffectOpacity; + } + computeBBox() { + const { x, y, width: width2, height: height2, clipBBox } = this; + return clipBBox?.clone() ?? new BBox(x, y, width2, height2); + } + isPointInPath(x, y) { + return this.hittester(x, y); + } + get midPoint() { + return { x: this.x + this.width / 2, y: this.y + this.height / 2 }; + } + distanceSquared(x, y) { + return this.distanceCalculator(x, y); + } + applyFillAndAlpha(ctx) { + super.applyFillAndAlpha(ctx); + ctx.globalAlpha *= this.microPixelEffectOpacity; + } + applyStrokeAndAlpha(ctx) { + super.applyStrokeAndAlpha(ctx); + ctx.globalAlpha *= this.microPixelEffectOpacity; + } + renderStroke(ctx) { + const { stroke: stroke3, effectiveStrokeWidth } = this; + if (stroke3 && effectiveStrokeWidth) { + const { globalAlpha } = ctx; + const { lineDash, lineDashOffset, lineCap, lineJoin, borderPath, borderClipPath } = this; + if (borderClipPath) { + ctx.clip(borderClipPath.getPath2D()); + } + this.applyStrokeAndAlpha(ctx); + ctx.lineWidth = effectiveStrokeWidth; + if (lineDash) { + ctx.setLineDash(lineDash); + } + if (lineDashOffset) { + ctx.lineDashOffset = lineDashOffset; + } + if (lineCap) { + ctx.lineCap = lineCap; + } + if (lineJoin) { + ctx.lineJoin = lineJoin; + } + ctx.stroke(borderPath.getPath2D()); + ctx.globalAlpha = globalAlpha; + } + } +}; +Rect.className = "Rect"; +__decorateClass([ + SceneChangeDetection() +], Rect.prototype, "x", 2); +__decorateClass([ + SceneChangeDetection() +], Rect.prototype, "y", 2); +__decorateClass([ + SceneChangeDetection() +], Rect.prototype, "width", 2); +__decorateClass([ + SceneChangeDetection() +], Rect.prototype, "height", 2); +__decorateClass([ + SceneChangeDetection() +], Rect.prototype, "topLeftCornerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], Rect.prototype, "topRightCornerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], Rect.prototype, "bottomRightCornerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], Rect.prototype, "bottomLeftCornerRadius", 2); +__decorateClass([ + SceneObjectChangeDetection({ equals: boxesEqual }) +], Rect.prototype, "clipBBox", 2); +__decorateClass([ + SceneChangeDetection() +], Rect.prototype, "crisp", 2); + +// packages/ag-charts-community/src/scene/shape/text.ts +var _Text = class _Text extends Shape { + constructor(options) { + super(options); + this.x = 0; + this.y = 0; + this.lines = []; + this.text = void 0; + this.fontCache = void 0; + this.fontSize = _Text.defaultFontSize; + this.fontFamily = "sans-serif"; + this.textAlign = "start"; + this.textBaseline = "alphabetic"; + this.boxPadding = 0; + this.trimText = options?.trimText ?? true; + } + onTextChange() { + this.richText?.clear(); + this.textMap?.clear(); + if (isArray(this.text)) { + this.lines = []; + this.richText ?? (this.richText = new Group()); + this.richText.setScene(this.scene); + this.richText.append( + this.text.flatMap((s) => isString(s.text) ? s.text.split(LineSplitter) : String(s.text)).filter(Boolean).map(() => new _Text({ trimText: false })) + ); + } else { + const lines = this.text?.split("\n") ?? []; + this.lines = this.trimText ? lines.map((line) => line.trim()) : lines; + } + } + get font() { + this.fontCache ?? (this.fontCache = toFontString(this)); + return this.fontCache; + } + static measureBBox(text2, x, y, options) { + if (isArray(text2)) { + const { font: font3, lineHeight, textAlign, textBaseline } = options; + const { width: width2, height: height2, lineMetrics } = measureTextSegments(text2, font3); + const totalHeight = lineHeight ? lineHeight * lineMetrics.length : height2; + const offsetTop = _Text.calcTopOffset(totalHeight, lineMetrics[0], textBaseline); + const offsetLeft = _Text.calcLeftOffset(width2, textAlign); + return new BBox(x - offsetLeft, y - offsetTop, width2, totalHeight); + } else { + return _Text.computeBBox(text2?.split(LineSplitter), x, y, options); + } + } + static computeBBox(lines, x, y, opts) { + const { font: font3, lineHeight, textAlign, textBaseline } = opts; + const { width: width2, height: height2, lineMetrics } = cachedTextMeasurer(font3).measureLines(lines); + const totalHeight = lineHeight ? lineHeight * lineMetrics.length : height2; + const offsetTop = _Text.calcTopOffset(totalHeight, lineMetrics[0], textBaseline); + const offsetLeft = _Text.calcLeftOffset(width2, textAlign); + return new BBox(x - offsetLeft, y - offsetTop, width2, totalHeight); + } + static calcTopOffset(height2, textMetrics, textBaseline) { + switch (textBaseline) { + case "alphabetic": + return textMetrics?.ascent ?? 0; + case "middle": + return height2 / 2; + case "bottom": + return height2; + default: + return 0; + } + } + static calcLeftOffset(width2, textAlign) { + let offset = 0; + switch (textAlign) { + case "center": + offset = 0.5; + break; + case "right": + case "end": + offset = 1; + } + return width2 * offset; + } + computeBBox() { + this.generateTextMap(); + if (this.textMap?.size) { + const bbox = BBox.merge(this.textMap.values()); + bbox.x = this.x - _Text.calcLeftOffset(bbox.width, this.textAlign); + bbox.y = this.y; + return bbox; + } + const { x, y, lines, textBaseline, textAlign } = this; + const measuredTextBounds = _Text.computeBBox(lines, x, y, { font: this, textBaseline, textAlign }); + if (this.boxing != null) + measuredTextBounds.grow(this.boxPadding); + return measuredTextBounds; + } + getTextMeasureBBox() { + return this.computeBBox(); + } + getPlainText() { + return toPlainText(this.text); + } + isPointInPath(x, y) { + return this.getBBox()?.containsPoint(x, y) ?? false; + } + setScene(scene) { + this.richText?.setScene(scene); + super.setScene(scene); + } + generateTextMap() { + if (!isArray(this.text) || this.textMap?.size) + return; + this.textMap ?? (this.textMap = /* @__PURE__ */ new Map()); + let offsetY = 0; + const textNodes = this.richText.children(); + for (const { width: width2, height: height2, ascent, segments } of measureTextSegments(this.text, this).lineMetrics) { + let offsetX = 0; + for (const { color: color2, textMetrics, ...segment } of segments) { + const textNode = textNodes.next().value; + textNode.x = this.x - width2 / 2 + offsetX; + textNode.y = ascent + offsetY; + textNode.setProperties({ ...segment, fill: color2 ?? this.fill }); + const textBBox = textNode.getBBox(); + this.textMap.set(textNode, textBBox); + offsetX += textMetrics.width; + } + offsetY += height2; + } + } + render(renderCtx) { + const { ctx, stats } = renderCtx; + if (!this.text || !this.layerManager) { + if (stats) + stats.nodesSkipped += 1; + return super.render(renderCtx); + } + if (isArray(this.text) && this.richText) { + this.generateTextMap(); + const richTextBBox = this.richText.getBBox(); + const { width: width2, height: height2, lineMetrics } = measureTextSegments(this.text, this); + let translateX = 0; + switch (this.textAlign) { + case "left": + case "start": + translateX = width2 / 2; + break; + case "right": + case "end": + translateX = width2 / -2; + } + let translateY = this.y; + switch (this.textBaseline) { + case "alphabetic": + translateY -= lineMetrics[0]?.ascent ?? 0; + break; + case "middle": + translateY -= lineMetrics.length === 1 ? lineMetrics[0].ascent + lineMetrics[0].segments.reduce( + (offsetY, segment) => Math.min(offsetY, cachedTextMeasurer(segment).baselineDistance("middle")), + 0 + ) : height2 / 2; + break; + case "bottom": + translateY -= height2; + break; + } + this.renderBoxing(renderCtx, richTextBBox.clone().translate(translateX, translateY)); + ctx.save(); + ctx.translate(translateX, translateY); + this.richText.opacity = this.opacity; + this.richText.render(renderCtx); + ctx.restore(); + } else { + this.renderText(renderCtx); + } + if (_Text.debug.check() && !this.textMap?.size) { + const bbox = this.getBBox(); + ctx.strokeStyle = "red"; + ctx.lineWidth = 1; + ctx.strokeRect(bbox.x, bbox.y, bbox.width, bbox.height); + } + super.render(renderCtx); + } + markDirty(property) { + this.textMap?.clear(); + return super.markDirty(property); + } + renderText(renderCtx) { + const { fill, stroke: stroke3, strokeWidth, font: font3, textAlign } = this; + if (!fill && !(stroke3 && strokeWidth) || !this.layerManager) { + return super.render(renderCtx); + } + const { ctx } = renderCtx; + if (ctx.font !== font3) { + ctx.font = font3; + } + ctx.textAlign = textAlign; + this.renderBoxing(renderCtx); + this.fillStroke(ctx); + } + renderBoxing(renderCtx, bbox) { + if (!this.boxing) + return; + const textBBox = bbox ?? _Text.computeBBox(this.lines, this.x, this.y, this); + if (textBBox.width === 0 || textBBox.height === 0) + return; + const { x, y, width: width2, height: height2 } = textBBox.grow(this.boxPadding); + this.boxing.opacity = this.opacity; + this.boxing.x = x; + this.boxing.y = y; + this.boxing.width = width2; + this.boxing.height = height2; + this.boxing.preRender(renderCtx); + this.boxing.render(renderCtx); + } + executeFill(ctx) { + this.renderLines((line, x, y) => ctx.fillText(line, x, y)); + } + executeStroke(ctx) { + this.renderLines((line, x, y) => ctx.strokeText(line, x, y)); + } + renderLines(renderCallback) { + const { x, y, lines } = this; + if (!Number.isFinite(x) || !Number.isFinite(y)) + return; + const measurer3 = cachedTextMeasurer(this); + const { lineMetrics } = measurer3.measureLines(lines); + const { textBaseline, lineHeight = measurer3.lineHeight() } = this; + let offsetY = 0; + if (textBaseline === "top") { + offsetY = lineMetrics[0].ascent; + } else if (textBaseline === "middle" || textBaseline === "bottom") { + offsetY = lineHeight * (1 - lines.length); + if (textBaseline === "middle") { + offsetY /= 2; + offsetY -= measurer3.baselineDistance(textBaseline); + } else { + offsetY -= lineMetrics[0].descent; + } + } + for (const line of lineMetrics) { + renderCallback(line.text, x, y + offsetY); + offsetY += lineHeight; + } + } + setFont(props) { + this.fontFamily = props.fontFamily; + this.fontSize = props.fontSize; + this.fontStyle = props.fontStyle; + this.fontWeight = props.fontWeight; + } + setAlign(props) { + this.textAlign = props.textAlign; + this.textBaseline = props.textBaseline; + } + setBoxing(props) { + const stroke3 = props.border?.enabled ? props.border?.stroke : void 0; + if (props.fill != null || stroke3 != null) { + this.boxing ?? (this.boxing = new Rect({ scene: this.scene })); + this.boxing.fill = props.fill; + this.boxing.fillOpacity = props.fillOpacity ?? 1; + this.boxing.cornerRadius = props.cornerRadius ?? 0; + this.boxing.stroke = stroke3; + this.boxing.strokeWidth = props.border?.strokeWidth ?? 0; + this.boxing.strokeOpacity = props.border?.strokeOpacity ?? 1; + this.boxPadding = props.padding ?? 0; + } else if (this.boxing) { + this.boxing.destroy(); + this.boxing = void 0; + } + } + getBoxingProperties() { + const { fill, fillOpacity, cornerRadius, stroke: stroke3, strokeWidth, strokeOpacity } = this.boxing ?? {}; + return { + border: { enabled: stroke3 != null, stroke: stroke3, strokeWidth, strokeOpacity }, + cornerRadius, + fill, + fillOpacity, + padding: this.boxPadding + }; + } + toSVG() { + if (!this.visible || !this.text) + return; + const element2 = createSvgElement("text"); + if (isString(this.text)) { + this.applySvgFillAttributes(element2); + setSvgFontAttributes(element2, this); + element2.setAttribute( + "text-anchor", + { + center: "middle", + left: "start", + right: "end", + start: "start", + end: "end" + }[this.textAlign ?? "start"] + ); + element2.setAttribute("alignment-baseline", this.textBaseline); + element2.setAttribute("x", String(this.x)); + element2.setAttribute("y", String(this.y)); + element2.textContent = this.text; + } else { + for (const segment of this.text) { + const segmentElement = createSvgElement("tspan"); + setSvgFontAttributes(segmentElement, { + fontSize: segment.fontSize ?? this.fontSize, + fontFamily: segment.fontFamily ?? this.fontFamily, + fontWeight: segment.fontWeight ?? this.fontWeight, + fontStyle: segment.fontStyle ?? this.fontStyle + }); + this.applySvgFillAttributes(segmentElement); + segmentElement.textContent = segment.text; + element2.append(segmentElement); + } + } + return { elements: [element2] }; + } +}; +_Text.className = "Text"; +_Text.debug = Debug.create(true, "scene:text" /* SCENE_TEXT */); +_Text.defaultFontSize = 10; +__decorateClass([ + SceneChangeDetection() +], _Text.prototype, "x", 2); +__decorateClass([ + SceneChangeDetection() +], _Text.prototype, "y", 2); +__decorateClass([ + SceneRefChangeDetection({ + changeCb: (o) => o.onTextChange() + }) +], _Text.prototype, "text", 2); +__decorateClass([ + SceneChangeDetection({ + changeCb: (o) => { + o.fontCache = void 0; + } + }) +], _Text.prototype, "fontStyle", 2); +__decorateClass([ + SceneChangeDetection({ + changeCb: (o) => { + o.fontCache = void 0; + } + }) +], _Text.prototype, "fontWeight", 2); +__decorateClass([ + SceneChangeDetection({ + changeCb: (o) => { + o.fontCache = void 0; + } + }) +], _Text.prototype, "fontSize", 2); +__decorateClass([ + SceneChangeDetection({ + changeCb: (o) => { + o.fontCache = void 0; + } + }) +], _Text.prototype, "fontFamily", 2); +__decorateClass([ + SceneChangeDetection() +], _Text.prototype, "textAlign", 2); +__decorateClass([ + SceneChangeDetection() +], _Text.prototype, "textBaseline", 2); +__decorateClass([ + SceneChangeDetection() +], _Text.prototype, "lineHeight", 2); +var Text = _Text; +var RotatableText = class extends Rotatable(Text) { +}; +var TransformableText = class extends Rotatable(Translatable(Text)) { +}; + +// packages/ag-charts-community/src/chart/themes/constants.ts +var constants_exports = {}; +__export(constants_exports, { + BASE_FONT_SIZE: () => BASE_FONT_SIZE, + CARTESIAN_AXIS_TYPE: () => CARTESIAN_AXIS_TYPE, + CARTESIAN_POSITION: () => CARTESIAN_POSITION, + FONT_SIZE: () => FONT_SIZE, + FONT_SIZE_RATIO: () => FONT_SIZE_RATIO, + POLAR_AXIS_SHAPE: () => POLAR_AXIS_SHAPE, + POLAR_AXIS_TYPE: () => POLAR_AXIS_TYPE +}); +var FONT_SIZE = /* @__PURE__ */ ((FONT_SIZE3) => { + FONT_SIZE3[FONT_SIZE3["SMALLEST"] = 8] = "SMALLEST"; + FONT_SIZE3[FONT_SIZE3["SMALLER"] = 10] = "SMALLER"; + FONT_SIZE3[FONT_SIZE3["SMALL"] = 12] = "SMALL"; + FONT_SIZE3[FONT_SIZE3["MEDIUM"] = 13] = "MEDIUM"; + FONT_SIZE3[FONT_SIZE3["LARGE"] = 14] = "LARGE"; + FONT_SIZE3[FONT_SIZE3["LARGEST"] = 17] = "LARGEST"; + return FONT_SIZE3; +})(FONT_SIZE || {}); +var BASE_FONT_SIZE = 12 /* SMALL */; +var FONT_SIZE_RATIO = { + SMALLEST: 8 /* SMALLEST */ / BASE_FONT_SIZE, + SMALLER: 10 /* SMALLER */ / BASE_FONT_SIZE, + SMALL: 12 /* SMALL */ / BASE_FONT_SIZE, + MEDIUM: 13 /* MEDIUM */ / BASE_FONT_SIZE, + LARGE: 14 /* LARGE */ / BASE_FONT_SIZE, + LARGEST: 17 /* LARGEST */ / BASE_FONT_SIZE +}; +var CARTESIAN_POSITION = /* @__PURE__ */ ((CARTESIAN_POSITION6) => { + CARTESIAN_POSITION6["TOP"] = "top"; + CARTESIAN_POSITION6["TOP_RIGHT"] = "top-right"; + CARTESIAN_POSITION6["TOP_LEFT"] = "top-left"; + CARTESIAN_POSITION6["RIGHT"] = "right"; + CARTESIAN_POSITION6["RIGHT_TOP"] = "right-top"; + CARTESIAN_POSITION6["RIGHT_BOTTOM"] = "right-bottom"; + CARTESIAN_POSITION6["BOTTOM"] = "bottom"; + CARTESIAN_POSITION6["BOTTOM_RIGHT"] = "bottom-right"; + CARTESIAN_POSITION6["BOTTOM_LEFT"] = "bottom-left"; + CARTESIAN_POSITION6["LEFT"] = "left"; + CARTESIAN_POSITION6["LEFT_TOP"] = "left-top"; + CARTESIAN_POSITION6["LEFT_BOTTOM"] = "left-bottom"; + return CARTESIAN_POSITION6; +})(CARTESIAN_POSITION || {}); +var CARTESIAN_AXIS_TYPE = /* @__PURE__ */ ((CARTESIAN_AXIS_TYPE9) => { + CARTESIAN_AXIS_TYPE9["CATEGORY"] = "category"; + CARTESIAN_AXIS_TYPE9["GROUPED_CATEGORY"] = "grouped-category"; + CARTESIAN_AXIS_TYPE9["ORDINAL_TIME"] = "ordinal-time"; + CARTESIAN_AXIS_TYPE9["UNIT_TIME"] = "unit-time"; + CARTESIAN_AXIS_TYPE9["TIME"] = "time"; + CARTESIAN_AXIS_TYPE9["NUMBER"] = "number"; + CARTESIAN_AXIS_TYPE9["LOG"] = "log"; + return CARTESIAN_AXIS_TYPE9; +})(CARTESIAN_AXIS_TYPE || {}); +var POLAR_AXIS_TYPE = /* @__PURE__ */ ((POLAR_AXIS_TYPE10) => { + POLAR_AXIS_TYPE10["ANGLE_CATEGORY"] = "angle-category"; + POLAR_AXIS_TYPE10["ANGLE_NUMBER"] = "angle-number"; + POLAR_AXIS_TYPE10["RADIUS_CATEGORY"] = "radius-category"; + POLAR_AXIS_TYPE10["RADIUS_NUMBER"] = "radius-number"; + return POLAR_AXIS_TYPE10; +})(POLAR_AXIS_TYPE || {}); +var POLAR_AXIS_SHAPE = /* @__PURE__ */ ((POLAR_AXIS_SHAPE3) => { + POLAR_AXIS_SHAPE3["CIRCLE"] = "circle"; + POLAR_AXIS_SHAPE3["POLYGON"] = "polygon"; + return POLAR_AXIS_SHAPE3; +})(POLAR_AXIS_SHAPE || {}); + +// packages/ag-charts-community/src/chart/caption.ts +var Caption = class extends BaseProperties { + constructor() { + super(...arguments); + this.id = createId(this); + this.node = new RotatableText({ zIndex: 1 }).setProperties({ + textAlign: "center", + pointerEvents: 1 /* None */ + }); + this.enabled = false; + this.textAlign = "center"; + this.fontSize = 10 /* SMALLER */; + this.fontFamily = "sans-serif"; + this.wrapping = "always"; + this.padding = 0; + this.layoutStyle = "block"; + this.truncated = false; + } + registerInteraction(moduleCtx, where) { + return moduleCtx.eventsHub.on("layout:complete", () => this.updateA11yText(moduleCtx, where)); + } + computeTextWrap(containerWidth, containerHeight) { + const { text: text2, padding: padding2, wrapping } = this; + const maxWidth = Math.min(this.maxWidth ?? Infinity, containerWidth) - padding2 * 2; + const maxHeight = this.maxHeight ?? containerHeight - padding2 * 2; + const options = { maxWidth, maxHeight, font: this, textWrap: wrapping }; + if (!Number.isFinite(maxWidth) && !Number.isFinite(maxHeight)) { + this.node.text = text2; + return; + } + let wrappedText; + if (isArray(text2)) { + wrappedText = wrapTextSegments(text2, options); + this.truncated = wrappedText.some(isSegmentTruncated); + } else { + wrappedText = wrapText(text2 ?? "", options); + this.truncated = isTextTruncated(wrappedText); + } + this.node.text = wrappedText; + } + updateA11yText(moduleCtx, where) { + const { proxyInteractionService } = moduleCtx; + if (this.enabled && this.text) { + const bbox = Transformable.toCanvas(this.node); + if (bbox) { + const { id: domManagerId } = this; + this.proxyText ?? (this.proxyText = proxyInteractionService.createProxyElement({ type: "text", domManagerId, where })); + this.proxyText.textContent = toPlainText(this.text); + this.proxyText.setBounds(bbox); + this.proxyText.addListener("mousemove", (ev) => this.handleMouseMove(moduleCtx, ev)); + this.proxyText.addListener("mouseleave", (ev) => this.handleMouseLeave(moduleCtx, ev)); + } + } else { + this.proxyText?.destroy(); + this.proxyText = void 0; + } + } + handleMouseMove(moduleCtx, event) { + if (event != null && this.enabled && this.truncated) { + const { x, y } = Transformable.toCanvas(this.node); + const canvasX = event.sourceEvent.offsetX + x; + const canvasY = event.sourceEvent.offsetY + y; + moduleCtx.tooltipManager.updateTooltip(this.id, { canvasX, canvasY, showArrow: false }, [ + { type: "structured", title: toPlainText(this.text) } + ]); + } + } + handleMouseLeave(moduleCtx, _event) { + moduleCtx.tooltipManager.removeTooltip(this.id); + } +}; +Caption.SMALL_PADDING = 10; +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("node", "visible") +], Caption.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("node") +], Caption.prototype, "text", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("node") +], Caption.prototype, "textAlign", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("node") +], Caption.prototype, "fontStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("node") +], Caption.prototype, "fontWeight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("node") +], Caption.prototype, "fontSize", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("node") +], Caption.prototype, "fontFamily", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("node", "fill") +], Caption.prototype, "color", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Caption.prototype, "spacing", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Caption.prototype, "maxWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Caption.prototype, "maxHeight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Caption.prototype, "wrapping", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Caption.prototype, "padding", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Caption.prototype, "layoutStyle", 2); + +// packages/ag-charts-community/src/chart/chartAxisDirection.ts +var ChartAxisDirection = /* @__PURE__ */ ((ChartAxisDirection33) => { + ChartAxisDirection33["X"] = "x"; + ChartAxisDirection33["Y"] = "y"; + ChartAxisDirection33["Angle"] = "angle"; + ChartAxisDirection33["Radius"] = "radius"; + return ChartAxisDirection33; +})(ChartAxisDirection || {}); +function isChartAxisDirection(d) { + switch (d) { + case "x": + case "y": + case "angle": + case "radius": + return true; + default: + return false; + } +} + +// packages/ag-charts-community/src/chart/chartCaptions.ts +var ChartCaptions = class { + constructor() { + this.title = new Caption(); + this.subtitle = new Caption(); + this.footnote = new Caption(); + } + positionCaptions(ctx) { + const { title, subtitle, footnote } = this; + const maxHeight = ctx.layoutBox.height / 10; + if (title.enabled) { + this.positionCaption("top", title, ctx.layoutBox, maxHeight); + this.shrinkLayoutByCaption("top", title, ctx.layoutBox); + } + if (subtitle.enabled) { + this.positionCaption("top", subtitle, ctx.layoutBox, maxHeight); + this.shrinkLayoutByCaption("top", subtitle, ctx.layoutBox); + } + if (footnote.enabled) { + this.positionCaption("bottom", footnote, ctx.layoutBox, maxHeight); + this.shrinkLayoutByCaption("bottom", footnote, ctx.layoutBox); + } + } + positionAbsoluteCaptions(ctx) { + const { title, subtitle, footnote } = this; + const { rect: rect2 } = ctx.series; + for (const caption of [title, subtitle, footnote]) { + if (caption.layoutStyle !== "overlay") + continue; + if (caption.textAlign === "left") { + caption.node.x = rect2.x + caption.padding; + } else if (caption.textAlign === "right") { + const bbox = caption.node.getBBox(); + caption.node.x = rect2.x + rect2.width - bbox.width - caption.padding; + } + } + } + computeX(align2, layoutBox) { + if (align2 === "left") { + return layoutBox.x; + } else if (align2 === "right") { + return layoutBox.x + layoutBox.width; + } + return layoutBox.x + layoutBox.width / 2; + } + positionCaption(vAlign, caption, layoutBox, maxHeight) { + if (!caption.text) + return; + const { lineMetrics } = isArray(caption.text) ? measureTextSegments(caption.text, caption) : cachedTextMeasurer(caption).measureLines(caption.text); + const containerHeight = Math.max(lineMetrics[0].height, maxHeight); + caption.node.x = this.computeX(caption.textAlign, layoutBox) + caption.padding; + caption.node.y = layoutBox.y + (vAlign === "top" ? 0 : layoutBox.height) + caption.padding; + caption.node.textBaseline = vAlign; + caption.computeTextWrap(layoutBox.width, containerHeight); + } + shrinkLayoutByCaption(vAlign, caption, layoutBox) { + if (caption.layoutStyle === "block") { + const bbox = caption.node.getBBox().clone(); + const { spacing = 0 } = caption; + if (vAlign === "bottom" && isArray(caption.text)) { + bbox.y -= bbox.height; + } + layoutBox.shrink( + vAlign === "top" ? Math.ceil(bbox.y - layoutBox.y + bbox.height + spacing) : Math.ceil(layoutBox.y + layoutBox.height - bbox.y + spacing), + vAlign + ); + } + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], ChartCaptions.prototype, "title", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], ChartCaptions.prototype, "subtitle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], ChartCaptions.prototype, "footnote", 2); + +// packages/ag-charts-community/src/api/preset/chartTypeOriginator.ts +var chartTypes = [ + "candlestick", + "hollow-candlestick", + "ohlc", + "line", + "step-line", + "hlc", + "high-low" +]; +var ChartTypeOriginator = class { + constructor(chartService) { + this.chartService = chartService; + this.mementoOriginatorKey = "chartType"; + } + createMemento() { + let chartType = this.chartService.publicApi?.getOptions()?.chartType; + chartType ?? (chartType = "candlestick"); + return chartType; + } + guardMemento(blob) { + return blob == null || chartTypes.includes(blob); + } + restoreMemento(_version, _mementoVersion, memento) { + if (memento == null) + return; + const options = { chartType: memento }; + this.chartService.publicApi?.updateDelta(options).catch((e) => logger_exports.error("error restoring state", e)); + } +}; + +// packages/ag-charts-community/src/version.ts +var VERSION = "12.3.1"; + +// packages/ag-charts-community/src/api/state/historyManager.ts +var NOT_FOUND = Symbol("previous-memento-not-found"); +var HistoryManager = class { + constructor(eventsHub) { + this.history = []; + this.historyIndex = -1; + this.originators = /* @__PURE__ */ new Map(); + this.clearState = /* @__PURE__ */ new Map(); + this.maxHistoryLength = 100; + this.debug = Debug.create(true, "history"); + this.cleanup = new CleanupRegistry(); + this.cleanup.register( + eventsHub.on("series:undo", this.undo.bind(this)), + eventsHub.on("series:redo", this.redo.bind(this)) + ); + } + destroy() { + this.cleanup.flush(); + } + addMementoOriginator(originator) { + this.originators.set(originator.mementoOriginatorKey, originator); + this.clearState.set(originator.mementoOriginatorKey, originator.createMemento()); + this.debugEvent("History add originator:", originator.mementoOriginatorKey); + } + clear() { + this.debug(`History clear:`, Object.keys(this.originators)); + this.history = []; + this.historyIndex = -1; + for (const [mementoOriginatorKey, originator] of this.originators.entries()) { + this.clearState.set(mementoOriginatorKey, originator.createMemento()); + } + } + record(label, ...originators) { + if (this.historyIndex < this.history.length - 1) { + this.history = this.history.slice(0, this.historyIndex + 1); + } + if (this.history.length > this.maxHistoryLength) { + this.history = this.history.slice(-this.maxHistoryLength); + } + const mementos = /* @__PURE__ */ new Map(); + for (const originator of originators) { + if (!this.originators.has(originator.mementoOriginatorKey)) { + throw new Error( + `Originator [${originator.mementoOriginatorKey}] has not been added to the HistoryManager.` + ); + } + mementos.set(originator.mementoOriginatorKey, originator.createMemento()); + } + this.history.push({ label, mementos }); + this.historyIndex = this.history.length - 1; + this.debugEvent(`History record: [${label}]`); + } + undo() { + const undoAction = this.history[this.historyIndex]; + if (!undoAction) + return; + for (const mementoOriginatorKey of undoAction.mementos.keys()) { + const previousMemento = this.findPreviousMemento(mementoOriginatorKey); + if (previousMemento === NOT_FOUND) { + throw new Error(`Could not find previous memento for [${mementoOriginatorKey}].`); + } + this.restoreMemento(mementoOriginatorKey, previousMemento); + } + this.historyIndex -= 1; + this.debugEvent(`History undo: [${undoAction.label}]`); + } + redo() { + const redoAction = this.history[this.historyIndex + 1]; + if (!redoAction) + return; + for (const [mementoOriginatorKey, memento] of redoAction.mementos.entries()) { + this.restoreMemento(mementoOriginatorKey, memento); + } + this.historyIndex += 1; + this.debugEvent(`History redo: [${redoAction.label}]`); + } + findPreviousMemento(mementoOriginatorKey) { + for (let i = this.historyIndex - 1; i >= 0; i--) { + if (this.history[i].mementos.has(mementoOriginatorKey)) { + return this.history[i].mementos.get(mementoOriginatorKey); + } + } + if (this.clearState.has(mementoOriginatorKey)) { + return this.clearState.get(mementoOriginatorKey); + } + return NOT_FOUND; + } + restoreMemento(mementoOriginatorKey, memento) { + this.originators.get(mementoOriginatorKey)?.restoreMemento(VERSION, VERSION, memento); + } + debugEvent(...logContent) { + this.debug( + ...logContent, + this.history.map((action, index) => index === this.historyIndex ? `** ${action.label} **` : action.label) + ); + } +}; + +// packages/ag-charts-community/src/api/state/memento.ts +var MementoCaretaker = class _MementoCaretaker { + constructor(version) { + this.version = version.split("-")[0]; + } + save(...originators) { + const packet = { version: this.version }; + for (const originator of Object.values(originators)) { + packet[originator.mementoOriginatorKey] = this.encode(originator, originator.createMemento()); + } + return packet; + } + restore(blob, ...originators) { + if (typeof blob !== "object") { + logger_exports.warnOnce(`Could not restore data of type [${typeof blob}], expecting an object, ignoring.`); + return; + } + if (blob == null) { + logger_exports.warnOnce(`Could not restore data of type [null], expecting an object, ignoring.`); + return; + } + if (!("version" in blob) || typeof blob.version !== "string") { + logger_exports.warnOnce(`Could not restore data, missing [version] string in object, ignoring.`); + return; + } + for (const originator of originators) { + const memento = this.decode(originator, blob[originator.mementoOriginatorKey]); + const messages = []; + if (!originator.guardMemento(memento, messages)) { + const messagesString = messages.length > 0 ? ` + +${messages.join("\n\n")} + +` : ""; + logger_exports.warnOnce( + `Could not restore [${originator.mementoOriginatorKey}] data, value was invalid, ignoring.${messagesString}`, + memento + ); + return; + } + originator.restoreMemento(this.version, blob.version, memento); + } + } + /** + * Encode a memento as a serializable object, encoding any non-serializble types. + */ + encode(originator, memento) { + try { + return JSON.parse(JSON.stringify(memento, _MementoCaretaker.encodeTypes)); + } catch (error2) { + throw new Error(`Failed to encode [${originator.mementoOriginatorKey}] value [${error2}].`, { + cause: error2 + }); + } + } + /** + * Decode an encoded memento, decoding any non-serializable types. + */ + decode(originator, encoded) { + if (encoded == null) + return encoded; + try { + return JSON.parse(JSON.stringify(encoded), _MementoCaretaker.decodeTypes); + } catch (error2) { + throw new Error(`Failed to decode [${originator.mementoOriginatorKey}] value [${error2}].`, { + cause: error2 + }); + } + } + static encodeTypes(key, value) { + if (isDate(this[key])) { + return { __type: "date", value: this[key].toISOString() }; + } + return value; + } + static decodeTypes(key, value) { + if (isObject(this[key]) && "__type" in this[key] && this[key].__type === "date") { + return new Date(this[key].value); + } + return value; + } +}; + +// packages/ag-charts-community/src/api/state/stateManager.ts +var StateManager = class { + constructor() { + this.caretaker = new MementoCaretaker(VERSION); + this.state = /* @__PURE__ */ new Map(); + } + setState(originator, value) { + if (objectsEqual(this.state.get(originator.mementoOriginatorKey), value)) { + return; + } + this.setStateAndRestore(originator, value); + } + setStateAndRestore(originator, value) { + this.state.set(originator.mementoOriginatorKey, value); + this.restoreState(originator); + } + restoreState(originator) { + const { caretaker, state } = this; + if (!state.has(originator.mementoOriginatorKey)) + return; + const value = state.get(originator.mementoOriginatorKey); + caretaker.restore({ version: caretaker.version, [originator.mementoOriginatorKey]: value }, originator); + } +}; + +// packages/ag-charts-community/src/styles.css +var styles_default = '.ag-charts-wrapper,.ag-charts-wrapper:after,.ag-charts-wrapper:before,.ag-charts-wrapper *,.ag-charts-wrapper *:after,.ag-charts-wrapper *:before{box-sizing:border-box}.ag-charts-wrapper{--align-items: center;--justify-content: center;position:relative;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.ag-charts-wrapper--safe-horizontal{--justify-content: flex-start}.ag-charts-wrapper--safe-vertical{--align-items: flex-start}.ag-charts-tab-guard{width:0%;height:0%;position:absolute;pointer-events:none}.ag-charts-canvas-center{width:100%;height:100%;position:absolute;touch-action:auto;pointer-events:auto;display:flex;align-items:var(--align-items);justify-content:var(--justify-content)}.ag-charts-canvas-container,.ag-charts-canvas{position:relative;user-select:none;-webkit-user-select:none}.ag-charts-canvas-container>*,.ag-charts-canvas>*{pointer-events:none}.ag-charts-canvas canvas{display:block}.ag-charts-series-area{outline:none;pointer-events:auto;position:absolute}.ag-charts-swapchain{top:0;left:0;outline:none;opacity:0;pointer-events:none;position:absolute;width:100%;height:100%}.ag-charts-swapchain:focus-visible{opacity:1}.ag-charts-canvas-proxy,.ag-charts-canvas-overlay{inset:0;pointer-events:none;position:absolute;user-select:none;-webkit-user-select:none}.ag-charts-canvas-overlay>*{position:absolute;pointer-events:auto}.ag-charts-theme-default,.ag-charts-theme-default-dark{--ag-charts-accent-color: #2196f3;--ag-charts-background-color: #fff;--ag-charts-border-color: #dddddd;--ag-charts-border-radius: 4px;--ag-charts-chart-background-color: #fff;--ag-charts-chart-padding: 20px;--ag-charts-focus-shadow: 0 0 0 3px #2196f3;--ag-charts-foreground-color: #181d1f;--ag-charts-font-family: Verdana, sans-serif;--ag-charts-font-size: 12px;--ag-charts-font-weight: 400;--ag-charts-popup-shadow: 0 0 16px rgba(0, 0, 0, .15);--ag-charts-subtle-text-color: #8c8c8c;--ag-charts-text-color: #181d1f;--ag-charts-chrome-background-color: #fafafa;--ag-charts-chrome-font-family: Verdana, sans-serif;--ag-charts-chrome-font-size: 12px;--ag-charts-chrome-font-weight: 400;--ag-charts-chrome-subtle-text-color: #8c8c8c;--ag-charts-chrome-text-color: #181d1f;--ag-charts-button-background-color: #fff;--ag-charts-button-border: 1px solid #dddddd;--ag-charts-button-font-weight: normal;--ag-charts-button-text-color: inherit;--ag-charts-input-background-color: #fff;--ag-charts-input-border: 1px solid #dddddd;--ag-charts-input-text-color: #181d1f;--ag-charts-menu-background-color: #fafafa;--ag-charts-menu-border: 1px solid #dddddd;--ag-charts-menu-text-color: #181d1f;--ag-charts-panel-background-color: #fafafa;--ag-charts-panel-text-color: #181d1f;--ag-charts-tooltip-background-color: #fafafa;--ag-charts-tooltip-border: 1px solid #dddddd;--ag-charts-tooltip-text-color: #181d1f;--ag-charts-tooltip-subtle-text-color: #8c8c8c;--ag-charts-crosshair-label-background-color: #fafafa;--ag-charts-crosshair-label-text-color: #181d1f;--ag-charts-spacing: 4px;--ag-charts-icon-size: 16px;--ag-charts-focus-color: color-mix(in srgb, var(--ag-charts-background-color), var(--ag-charts-accent-color) 12%);--ag-charts-input-border-radius: var(--ag-charts-border-radius);--ag-charts-input-focus-border-color: var(--ag-charts-accent-color);--ag-charts-input-focus-text-color: var(--ag-charts-accent-color);--ag-charts-input-disabled-background-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-foreground-color) 6% );--ag-charts-input-disabled-border-color: var(--ag-charts-border-color);--ag-charts-input-disabled-text-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-input-text-color) 50% );--ag-charts-input-placeholder-text-color: color-mix( in srgb, var(--ag-charts-input-background-color), var(--ag-charts-input-text-color) 60% );--ag-charts-button-border-radius: var(--ag-charts-border-radius);--ag-charts-button-focus-background-color: color-mix( in srgb, var(--ag-charts-button-background-color), var(--ag-charts-accent-color) 12% );--ag-charts-button-focus-border-color: var(--ag-charts-accent-color);--ag-charts-button-focus-text-color: var(--ag-charts-accent-color);--ag-charts-button-disabled-background-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-foreground-color) 6% );--ag-charts-button-disabled-border-color: var(--ag-charts-border-color);--ag-charts-button-disabled-text-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-chrome-text-color) 50% );--ag-charts-checkbox-background-color: color-mix( in srgb, var(--ag-charts-background-color), var(--ag-charts-foreground-color) 35% );--ag-charts-checkbox-checked-background-color: var(--ag-charts-accent-color);--ag-charts-tooltip-border-radius: var(--ag-charts-border-radius);--ag-charts-menu-border-radius: var(--ag-charts-border-radius);--ag-charts-chrome-font-size-small: var(--ag-charts-chrome-font-size);--ag-charts-chrome-font-size-medium: calc(var(--ag-charts-chrome-font-size) * (13 / 12));--ag-charts-chrome-font-size-large: calc(var(--ag-charts-chrome-font-size) * (14 / 12));--ag-charts-border: 1px solid var(--ag-charts-border-color);--ag-charts-focus-border: 1px solid var(--ag-charts-accent-color);--ag-charts-focus-border-shadow: 0 0 0 3px color-mix(in srgb, transparent, var(--ag-charts-accent-color) 20%);--ag-charts-layer-menu: 6;--ag-charts-layer-ui-overlay: 5;--ag-charts-layer-tooltip: 4;--ag-charts-layer-toolbar: 3;--ag-charts-layer-crosshair: 2;--ag-charts-layer-annotations: 1}.ag-charts-theme-default-dark{--ag-charts-focus-color: color-mix(in srgb, var(--ag-charts-background-color), var(--ag-charts-accent-color) 22%)}.ag-chart-canvas-wrapper .ag-charts-theme-default{--ag-charts-border-radius: var(--ag-border-radius, 4px);--ag-charts-border: var(--ag-borders-critical, solid 1px) var(--ag-charts-border-color);--ag-charts-focus-shadow: var(--ag-focus-shadow, 0 0 0 3px var(--ag-charts-accent-color));--ag-charts-focus-border-shadow: var( --ag-focus-shadow, 0 0 0 3px color-mix(in srgb, transparent, var(--ag-charts-accent-color) 20%) )}.ag-charts-icon{display:block;width:20px;height:20px;speak:none;speak:never;mask:var(--icon) center / contain no-repeat;background-color:currentColor;transition:background-color .25s ease-in-out}.ag-charts-icon-align-center{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNNyAxMGg2djFIN3pNNCA3aDEydjFINHptMSA2aDEwdjFINXoiLz48L3N2Zz4=)}.ag-charts-icon-align-left{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNNCAxMGg2djFINHptMC0zaDEydjFINHptMCA2aDEwdjFINHoiLz48L3N2Zz4=)}.ag-charts-icon-align-right{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTAgMTBoNnYxaC02ek00IDdoMTJ2MUg0em0yIDZoMTB2MUg2eiIvPjwvc3ZnPg==)}.ag-charts-icon-arrow-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1LjI5MyA0LjVIMTIuNXYtMUgxN3Y0aC0xVjUuMjA3bC05LjY0NiA5LjY0Ny0uNzA4LS43MDh6IiBmaWxsPSIjMDAwIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03IDE2YTIuNSAyLjUgMCAxIDEtNSAwIDIuNSAyLjUgMCAwIDEgNSAwbS0yLjUgMS41YTEuNSAxLjUgMCAxIDAgMC0zIDEuNSAxLjUgMCAwIDAgMCAzIiBmaWxsPSIjMDAwIi8+PC9zdmc+)}.ag-charts-icon-arrow-down-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02IDhMMS41IDhMMTAgMThMMTguNSA4TDE0IDhMMTQgM0w2IDNMNiA4Wk03IDRMNyA5SDMuNjYyNDRMMTAgMTYuNDU2TDE2LjMzNzYgOUwxMyA5TDEzIDRMNyA0WiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-arrow-up-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNCAxMkgxOC41TDEwIDJMMS41IDEySDZMNi4wMDAwMiAxN0gxNFYxMlpNMTMgMTZWMTFIMTYuMzM3NkwxMCAzLjU0NDA1TDMuNjYyNDQgMTFIN0w3LjAwMDAyIDE2SDEzWiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-callout-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMyA0LjVBMS41IDEuNSAwIDAgMSA0LjUgM2gxMUExLjUgMS41IDAgMCAxIDE3IDQuNXY4YTEuNSAxLjUgMCAwIDEtMS41IDEuNWgtNC41MTRhMjYgMjYgMCAwIDAtMi4wMTcgMS41NGwtLjMxNC4yNmMtLjU1LjQ1Ny0xLjExNS45MjYtMS43NiAxLjQtLjY2OS40OTEtMS41NjItLjAxMi0xLjU2Mi0uOFYxNEg0LjVBMS41IDEuNSAwIDAgMSAzIDEyLjV6TTQuNSA0YS41LjUgMCAwIDAtLjUuNXY4YS41LjUgMCAwIDAgLjUuNWgxLjgzM3YzLjM3MmEzNiAzNiAwIDAgMCAxLjY3OC0xLjMzOGwuMzItLjI2NWEyNiAyNiAwIDAgMSAyLjIyNS0xLjY4NWwuMTI2LS4wODRIMTUuNWEuNS41IDAgMCAwIC41LS41di04YS41LjUgMCAwIDAtLjUtLjV6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-candlestick-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNyAxdjNoMnYxMkg3djNINnYtM0g0VjRoMlYxek01IDVoM3YxMEg1ek0xMSAxNFY2aDJWMy4yNWgxVjZoMnY4aC0ydjIuNzVoLTFWMTR6bTEtN2gzdjZoLTN6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-close{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNSA1IDEwIDEwTTUgMTUgMTUgNSIgc3Ryb2tlPSIjMDAwIi8+PC9zdmc+)}.ag-charts-icon-comment-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNy41MTMgMy45OTVhNi41IDYuNSAwIDAgMSA2LjA5OCAxMS40MWMtLjU4OC4zOTMtMS4yMTcuNTM2LTEuODI5LjU4NWExMyAxMyAwIDAgMS0xLjI3LjAxN0EyNyAyNyAwIDAgMCAxMCAxNkg0LjVhLjUuNSAwIDAgMS0uNS0uNVYxMHEwLS4yNDctLjAwNy0uNTEzYy0uMDA4LS40MTYtLjAxNi0uODU3LjAxNy0xLjI2OS4wNS0uNjEyLjE5Mi0xLjI0LjU4NS0xLjgzYTYuNSA2LjUgMCAwIDEgMi45MTgtMi4zOTNtMy41Ni42MWE1LjUgNS41IDAgMCAwLTUuNjQ2IDIuMzRjLS4yNjYuMzk3LS4zNzkuODQyLS40MiAxLjM1NC0uMDMuMzYtLjAyMi43MTgtLjAxNSAxLjEwOFE1IDkuNjg5IDUgMTB2NWg1cS4zMTEuMDAxLjU5My4wMDhjLjM5LjAwNy43NDcuMDE1IDEuMTA4LS4wMTUuNTEyLS4wNDEuOTU3LS4xNTQgMS4zNTUtLjQyYTUuNSA1LjUgMCAwIDAtMS45ODMtOS45NjciIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-crosshair-add-line{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTEwIDUuNWEuNS41IDAgMCAxIC41LjV2My41aDMuODc1YS41LjUgMCAwIDEgMCAxSDEwLjV2NC4yNWEuNS41IDAgMSAxLTEgMFYxMC41SDUuNjI1YS41LjUgMCAxIDEgMC0xSDkuNVY2YS41LjUgMCAwIDEgLjUtLjUiLz48L3N2Zz4=)}.ag-charts-icon-date-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMiAyaDF2MTZIMnptMTUgMGgxdjE2aC0xeiIgZmlsbD0iIzE4MUQxRiIvPjxwYXRoIGQ9Ik0xMy4xNTcgMTFINXYtMWg3Ljc5M0wxMSA4LjIwN2wuNzA3LS43MDcgMy4xODIgMy4xODItMy4xODIgMy4xODItLjcwNy0uNzA3eiIgZmlsbD0iIzAwMCIvPjwvc3ZnPg==)}.ag-charts-icon-date-price-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMyAySDJ2MTZoMXptMy41MDcgNC44OUw4LjUgNC44OTVWMTBINXYxaDMuNXY3aDF2LTdoNS4wODhsLTEuOTU3IDEuOTU3LjcwNy43MDcgMy4xODItMy4xODJMMTMuMzM4IDcuM2wtLjcwNy43MDdMMTQuNjI0IDEwSDkuNVY0LjkzMmwxLjk1NyAxLjk1Ny43MDctLjcwN0w4Ljk4MiAzIDUuOCA2LjE4MnoiIGZpbGw9IiMxODFEMUYiLz48L3N2Zz4=)}.ag-charts-icon-delete{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZD0iTTguNDk2IDguOTk2QS41LjUgMCAwIDEgOSA5LjQ5MnY0YS41LjUgMCAxIDEtMSAuMDA4di00YS41LjUgMCAwIDEgLjQ5Ni0uNTA0TTEyIDkuNWEuNS41IDAgMCAwLTEgMHY0YS41LjUgMCAwIDAgMSAweiIvPjxwYXRoIGZpbGw9IiMxMzE3MjIiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTYgNVYzLjVBMi41IDIuNSAwIDAgMSA4LjUgMWgzQTIuNSAyLjUgMCAwIDEgMTQgMy41VjVoMi44MzNhLjUuNSAwIDAgMSAwIDFIMTV2MTAuMjVjMCAuNDE1LS4wNjYuODYzLS4zIDEuMjIxLS4yNTcuMzk0LS42NzIuNjEyLTEuMi42MTJoLTdjLS41MjggMC0uOTQzLS4yMTgtMS4yLS42MTItLjIzNC0uMzU4LS4zLS44MDYtLjMtMS4yMjFWNkgzLjMzM2EuNS41IDAgMCAxIDAtMXptMS0xLjVBMS41IDEuNSAwIDAgMSA4LjUgMmgzQTEuNSAxLjUgMCAwIDEgMTMgMy41VjVIN3pNNiAxNi4yNVY2aDh2MTAuMjVjMCAuMzM1LS4wNTkuNTU0LS4xMzguNjc1LS4wNTUuMDg1LS4xNC4xNTgtLjM2Mi4xNThoLTdjLS4yMjIgMC0uMzA3LS4wNzMtLjM2Mi0uMTU4LS4wOC0uMTIxLS4xMzgtLjM0LS4xMzgtLjY3NSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-disjoint-channel,.ag-charts-icon-disjoint-channel-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTkuMDI4IDE3LjQ2YTIuMjUgMi4yNSAwIDAgMC00LjA5Mi0xLjg1bC05LjUxMS0yLjM3OGEyLjI1IDIuMjUgMCAxIDAtLjIyNS45NzRsOS40NzUgMi4zNjlhMi4yNTEgMi4yNTEgMCAwIDAgNC4zNTMuODg2bS0xLjY2Mi0xLjk2NWExLjI1IDEuMjUgMCAxIDEtLjg4NSAyLjMzOCAxLjI1IDEuMjUgMCAwIDEgLjg4NS0yLjMzOE00LjM0MyAxMy42NjlhMS4yNSAxLjI1IDAgMSAwLTIuMzM4LS44ODUgMS4yNSAxLjI1IDAgMCAwIDIuMzM4Ljg4NU0zLjk3IDguNzY5YTIuMjUgMi4yNSAwIDAgMCAxLjQ1NS0yLjExbDkuNTExLTIuMzc4YTIuMjUgMi4yNSAwIDEgMC0uMjYtLjk2NUw1LjIgNS42ODVhMi4yNSAyLjI1IDAgMSAwLTEuMjMgMy4wODRtLjM3My0yLjU0N2ExLjI1IDEuMjUgMCAxIDEtMi4zMzguODg1IDEuMjUgMS4yNSAwIDAgMSAyLjMzOC0uODg1bTEzLjc1LTMuNDM4YTEuMjUgMS4yNSAwIDEgMS0yLjMzOC44ODUgMS4yNSAxLjI1IDAgMCAxIDIuMzM4LS44ODUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-drag-handle{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSI1Ljc1IiBjeT0iNy43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjcuNzUiIHI9Ii43NSIgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuNSIvPjxjaXJjbGUgY3g9IjEzLjc1IiBjeT0iNy43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iMTMuNzUiIGN5PSIxMS43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjExLjc1IiByPSIuNzUiIGZpbGw9IiMwMDAiIGZpbGwtb3BhY2l0eT0iLjUiLz48Y2lyY2xlIGN4PSI1Ljc1IiBjeT0iMTEuNzUiIHI9Ii43NSIgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuNSIvPjwvc3ZnPg==)}.ag-charts-icon-fibonacci-retracement-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA1aDEydjFIMnoiLz48Y2lyY2xlIGN4PSIxNS43NSIgY3k9IjUuNSIgcj0iMS43NSIgc3Ryb2tlPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC4yNSIgY3k9IjE0LjUiIHI9IjEuNzUiIHN0cm9rZT0iIzAwMCIvPjxwYXRoIGZpbGw9IiMwMDAiIGQ9Ik0xOCAxNUg2di0xaDEyem0wLTQuNUgydi0xaDE2eiIvPjwvc3ZnPg==)}.ag-charts-icon-fibonacci-retracement-trend-based-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJtNC45OTYgMTIuNjc0IDMuMjkxLTUuNzQzLjg2OC40OTctMy4yOTEgNS43NDN6Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjUuNSIgcj0iMS43NSIgc3Ryb2tlPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC4zNTEiIGN5PSIxNC41IiByPSIxLjc1IiBzdHJva2U9IiMwMDAiLz48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTggNmgtN1Y1aDd6bTAgNC41aC03di0xaDd6bTAgNC41SDZ2LTFoMTJ6Ii8+PC9zdmc+)}.ag-charts-icon-fill-color{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtOC4wNzEgNC4wNi0uOTI0LS45MjQuNzA3LS43MDcgNy4yODggNy4yODgtNC45NSA0Ljk1YTMuNSAzLjUgMCAwIDEtNC45NSAwbC0xLjQxNC0xLjQxNGEzLjUgMy41IDAgMCAxIDAtNC45NXptLjcwNy43MDhMNC41MzYgOS4wMWEyLjUgMi41IDAgMCAwIDAgMy41MzZMNS45NSAxMy45NmEyLjUgMi41IDAgMCAwIDMuNTM1IDBsNC4yNDMtNC4yNDN6bTYuOSA3LjIwMi0uMzQ1LjM2My0uMzQ0LS4zNjNhLjUuNSAwIDAgMSAuNjg4IDBtLS4zNDUgMS4wOGE4IDggMCAwIDAtLjI4LjMyMyA0LjMgNC4zIDAgMCAwLS40MDkuNTgyYy0uMTEzLjIwMS0uMTQ0LjMyNi0uMTQ0LjM3OGEuODMzLjgzMyAwIDAgMCAxLjY2NyAwYzAtLjA1Mi0uMDMxLS4xNzctLjE0NC0uMzc4YTQuMyA0LjMgMCAwIDAtLjQxLS41ODIgOCA4IDAgMCAwLS4yOC0uMzIybS0uMzQ0LTEuMDguMzQ0LjM2My4zNDQtLjM2My4wMDIuMDAyLjAwNC4wMDQuMDEzLjAxMmE2IDYgMCAwIDEgLjIwNi4yMDhjLjEzMS4xMzYuMzA4LjMyNy40ODUuNTQ1LjE3Ni4yMTUuMzYzLjQ2Ny41MDcuNzI0LjEzNy4yNDMuMjczLjU1My4yNzMuODY4YTEuODMzIDEuODMzIDAgMSAxLTMuNjY3IDBjMC0uMzE1LjEzNi0uNjI1LjI3My0uODY4LjE0NC0uMjU3LjMzLS41MDkuNTA3LS43MjRhOSA5IDAgMCAxIC42NDUtLjcwOGwuMDQ2LS4wNDUuMDEzLS4wMTIuMDA0LS4wMDR6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-hollow-candlestick-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1vcGFjaXR5PSIuMTUiIGQ9Ik01IDVoM3YxMEg1eiIvPjxwYXRoIGZpbGw9IiMxMzE3MjIiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTcgMXYzaDJ2MTJIN3YzSDZ2LTNINFY0aDJWMXpNNSA1aDN2MTBINXptNyAyaDN2NmgtM3ptLTEgN1Y2aDJWMy4yNWgxVjZoMnY4aC0ydjIuNzVoLTFWMTR6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-horizontal-line,.ag-charts-icon-horizontal-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNLjUgOS41aDcuMzA2YTIuMjUgMi4yNSAwIDAgMSA0LjM4OCAwSDE5LjV2MWgtNy4zMDZhMi4yNSAyLjI1IDAgMCAxLTQuMzg4IDBILjV6bTkuNSAxLjc1YTEuMjUgMS4yNSAwIDEgMCAwLTIuNSAxLjI1IDEuMjUgMCAwIDAgMCAyLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-line-color{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTQuMjQyIDIuNzIyYy0uNjEyIDAtMS4yLjI0My0xLjYzMi42NzVsLTEuMzQzIDEuMzQ0YS41LjUgMCAwIDAtLjExMi4xMTJMNC4wNSAxMS45NTljLS4yMDcuMjA3LS4zNi40Ni0uNDQ2Ljc0di4wMDFsLS42OSAyLjc2N3YuMDAyYS44Mi44MiAwIDAgMCAxLjAyMiAxLjAyMWguMDAybDIuNjM0LS44MjJjLjI4LS4wODUuNTM0LS4yMzcuNzQtLjQ0M2w3LjEwNy03LjEwOGEuNS41IDAgMCAwIC4xMTItLjExMmwxLjM0My0xLjM0M2EyLjMwOCAyLjMwOCAwIDAgMC0xLjYzMi0zLjk0TTE0LjEyMiA3bDEuMDQ0LTEuMDQ1YTEuMzA4IDEuMzA4IDAgMSAwLTEuODQ5LTEuODVMMTIuMjcxIDUuMTV6bS0yLjU1OC0xLjE0Mi02LjgwNyA2LjgwOWEuOC44IDAgMCAwLS4xOTYuMzI1bC0uNzUgMi40NjggMi40Ny0uNzQ5YS44LjggMCAwIDAgLjMyNS0uMTk0bDYuODA4LTYuODF6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-line-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTcuMzYyIDQuODczLTQuNTk0IDYuNjU0LTQuODUtMy4zMTctNC4yNTEgNi45NzctLjg1NC0uNTJMNy42MTIgNi43OWw0Ljg5OSAzLjM1IDQuMDI4LTUuODM2eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-line-style-dashed{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA5aDR2MUgyem0xMiAwaDR2MWgtNHpNOCA5aDR2MUg4eiIvPjwvc3ZnPg==)}.ag-charts-icon-line-style-dotted{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSIyLjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC41IiBjeT0iOS41IiByPSIuNSIgZmlsbD0iIzAwMCIvPjxjaXJjbGUgY3g9IjYuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48Y2lyY2xlIGN4PSI4LjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iMTAuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48Y2lyY2xlIGN4PSIxMi41IiBjeT0iOS41IiByPSIuNSIgZmlsbD0iIzAwMCIvPjxjaXJjbGUgY3g9IjE0LjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iMTYuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48L3N2Zz4=)}.ag-charts-icon-line-style-solid{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA5aDE2djFIMnoiLz48L3N2Zz4=)}.ag-charts-icon-line-with-markers-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTguMTk4IDQuODg4LTMuNTU2IDQuOTE4YTIuMjUgMi4yNSAwIDEgMS0zLjg2Ni43NWwtMS40MzItLjlhMi4yNCAyLjI0IDAgMCAxLTIuMDA5LjQzNWwtMy44MjggNi40MjgtLjg2LS41MTJMNi40NSA5LjYyM2EyLjI1IDIuMjUgMCAxIDEgMy41MS0uNzYxbDEuMzI5LjgzNWEyLjI0IDIuMjQgMCAwIDEgMi41NTctLjQ5N2wzLjU0Mi00Ljg5OHptLTQuOTYgNS4xNTNhMS4yNSAxLjI1IDAgMSAwLS42NCAyLjQxOSAxLjI1IDEuMjUgMCAwIDAgLjY0LTIuNDE5TTkuMSA4LjMyMXEuMDY2LS4xOTIuMDY3LS40MDRhMS4yNSAxLjI1IDAgMSAwLS4wNjcuNDA0IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-lock,.ag-charts-icon-locked{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuMjA3IDMuNzY0YTIuODk0IDIuODk0IDAgMCAwLTIuODk1IDIuODk0VjloNS43ODlWNi42NThhMi44OTQgMi44OTQgMCAwIDAtMi44OTUtMi44OTRNMTQuMSA5VjYuNjU4YTMuODk0IDMuODk0IDAgMSAwLTcuNzg5IDB2Mi4zNDlBMi41IDIuNSAwIDAgMCA0IDExLjV2M0EyLjUgMi41IDAgMCAwIDYuNSAxN2g4YTIuNSAyLjUgMCAwIDAgMi41LTIuNXYtM0EyLjUgMi41IDAgMCAwIDE0LjUgOXpNNi41IDEwQTEuNSAxLjUgMCAwIDAgNSAxMS41djNBMS41IDEuNSAwIDAgMCA2LjUgMTZoOGExLjUgMS41IDAgMCAwIDEuNS0xLjV2LTNhMS41IDEuNSAwIDAgMC0xLjUtMS41eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-measurer-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibTQuNDYxIDEyLjcxIDEuNTMyLTEuNTMxIDEuNDE0IDEuNDE0LjcwNy0uNzA3TDYuNyAxMC40NzJsMS41MzItMS41MzMgMiAyIC43MDctLjcwNy0yLTIgNi4wMS02LjAxIDIuODMgMi44MjhMNS4wNSAxNy43NzggMi4yMjIgMTQuOTVsMS41MzItMS41MzIgMS40MTQgMS40MTQuNzA3LS43MDd6TS44MDggMTQuOTVsLjcwNy0uNzA3TDE0LjI0MyAxLjUxNWwuNzA3LS43MDcuNzA3LjcwNyAyLjgyOCAyLjgyOC43MDcuNzA3LS43MDcuNzA3TDUuNzU3IDE4LjQ4NWwtLjcwNy43MDctLjcwNy0uNzA3LTIuODI4LTIuODI4em0xMS4wNzgtNi44MzVMMTAuNDcgNi43bC43MDctLjcwNyAxLjQxNSAxLjQxNHptLjgyNC0zLjY1NCAxIDEgLjcwOC0uNzA3LTEtMXoiIGZpbGw9IiMxODFEMUYiLz48L3N2Zz4=)}.ag-charts-icon-note-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMyA0LjVBMS41IDEuNSAwIDAgMSA0LjUgM2gxMUExLjUgMS41IDAgMCAxIDE3IDQuNXY4YTEuNSAxLjUgMCAwIDEtMS41IDEuNWgtMy4yMWwtMS40NjkgMi41N2ExIDEgMCAwIDEtMS42ODIuMDg1TDcuMjQzIDE0SDQuNUExLjUgMS41IDAgMCAxIDMgMTIuNXpNNC41IDRhLjUuNSAwIDAgMC0uNS41djhhLjUuNSAwIDAgMCAuNS41aDMuMjU3bDIuMTk2IDMuMDc0TDExLjcxIDEzaDMuNzlhLjUuNSAwIDAgMCAuNS0uNXYtOGEuNS41IDAgMCAwLS41LS41eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi41IDYuNUEuNS41IDAgMCAxIDcgNmg2YS41LjUgMCAwIDEgMCAxSDdhLjUuNSAwIDAgMS0uNS0uNU02LjUgOS41QS41LjUgMCAwIDEgNyA5aDZhLjUuNSAwIDAgMSAwIDFIN2EuNS41IDAgMCAxLS41LS41IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-ohlc-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZD0iTTEzIDExaC0zdi0xaDNWM2gxdjJoNHYxaC00djExaC0xek02IDE3di0yaDN2LTFINlY0SDV2MUgydjFoM3YxMXoiLz48L3N2Zz4=)}.ag-charts-icon-pan-end{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0ibTYuNjQ2IDEzLjgxMy0uMzUzLjM1NC43MDcuNzA3LjM1NC0uMzU0ek0xMS4xNjYgMTBsLjM1NC4zNTQuMzU0LS4zNTQtLjM1NC0uMzU0ek03LjM1NSA1LjQ4IDcgNS4xMjZsLS43MDcuNzA3LjM1My4zNTR6bTAgOS4wNCA0LjE2Ni00LjE2Ni0uNzA3LS43MDgtNC4xNjcgNC4xNjd6bTQuMTY2LTQuODc0TDcuMzU0IDUuNDhsLS43MDguNzA3IDQuMTY3IDQuMTY3ek0xMy4wODMgNXYxMGgxVjV6Ii8+PC9zdmc+)}.ag-charts-icon-pan-left{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTIuNzkgNS44MzMgOC42MjUgMTBsNC4xNjYgNC4xNjctLjcwNy43MDdMNy4yMSAxMGw0Ljg3My00Ljg3NHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-pan-right{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNy4yMSAxNC4xNjcgMTEuMzc2IDEwIDcuMjEgNS44MzNsLjcwNy0uNzA3TDEyLjc5IDEwbC00Ljg3MyA0Ljg3NHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-pan-start{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTYgNXYxMGgxVjV6TTkuNjI0IDEwbDQuMTY2LTQuMTY3LS43MDctLjcwN0w4LjIxIDEwbDQuODc0IDQuODc0LjcwNy0uNzA3eiIvPjwvc3ZnPg==)}.ag-charts-icon-parallel-channel,.ag-charts-icon-parallel-channel-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTcuNzIgNS4zMzFBMi4yNSAyLjI1IDAgMSAwIDE0LjcwNSAzLjZsLTkuNDkgNC41NjJhMi4yNSAyLjI1IDAgMSAwIC4yMDkgMS4wMWw5LjY2Mi00LjY0NmEyLjI1IDIuMjUgMCAwIDAgMi42MzQuODA1bS4zNzMtMi41NDdhMS4yNSAxLjI1IDAgMSAxLTIuMzM4Ljg4NSAxLjI1IDEuMjUgMCAwIDEgMi4zMzgtLjg4NU00LjM0MyA4LjY3YTEuMjUgMS4yNSAwIDEgMS0yLjMzOC44ODUgMS4yNSAxLjI1IDAgMCAxIDIuMzM4LS44ODVNNS4zMDcgMTYuNzI4YTIuMjUgMi4yNSAwIDEgMS0uNTI1LS44NThsOS45MjMtNC43N2EyLjI1IDIuMjUgMCAxIDEgLjM4MS45MjZ6bS0uOTY0LjI3NGExLjI1IDEuMjUgMCAxIDEtMi4zMzguODg1IDEuMjUgMS4yNSAwIDAgMSAyLjMzOC0uODg1bTEzLjAyMy01LjEwNmExLjI1IDEuMjUgMCAxIDAtLjg4NS0yLjMzOSAxLjI1IDEuMjUgMCAwIDAgLjg4NSAyLjMzOSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-position-bottom{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii4yNSIgZD0iTTMgMTBoMTR2MUgzem0zLTNoOHYxSDZ6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTYgMTNoOHYxSDZ6Ii8+PC9zdmc+)}.ag-charts-icon-position-center{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMyAxMGgxNHYxSDN6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuMjUiIGQ9Ik02IDdoOHYxSDZ6bTAgNmg4djFINnoiLz48L3N2Zz4=)}.ag-charts-icon-position-top{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii4yNSIgZD0iTTMgMTBoMTR2MUgzeiIvPjxwYXRoIGZpbGw9IiMwMDAiIGQ9Ik02IDdoOHYxSDZ6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuMjUiIGQ9Ik02IDEzaDh2MUg2eiIvPjwvc3ZnPg==)}.ag-charts-icon-price-label-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNC41IDNBMS41IDEuNSAwIDAgMCAzIDQuNVYxM2ExLjUgMS41IDAgMCAwIDEuNSAxLjVoLjgzM3YuMDU3Yy4yNDItLjI5OS41OTctLjUwMyAxLS41NDhWMTMuNUg0LjVBLjUuNSAwIDAgMSA0IDEzVjQuNWEuNS41IDAgMCAxIC41LS41aDExYS41LjUgMCAwIDEgLjUuNXY4YS41LjUgMCAwIDEtLjUuNWgtNC44MThsLS4xMjYuMDg0YTI2IDI2IDAgMCAwLTIuMjI1IDEuNjg1bC0uMzIuMjY1LS4wNjguMDU2YTEuNSAxLjUgMCAwIDEtMi42MDkgMS4zNTRjLjAzMy43NjMuOTA1IDEuMjM4IDEuNTYuNzU2LjY0Ni0uNDc0IDEuMjEtLjk0MyAxLjc2MS0xLjRsLjMxMy0uMjZBMjYgMjYgMCAwIDEgMTAuOTg2IDE0SDE1LjVhMS41IDEuNSAwIDAgMCAxLjUtMS41di04QTEuNSAxLjUgMCAwIDAgMTUuNSAzeiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC43MTYgMTQuODE1YTIuMjUgMi4yNSAwIDEgMS00LjIxIDEuNTkzIDIuMjUgMi4yNSAwIDAgMSA0LjIxLTEuNTkzbS0xLjY2MiAxLjk2NmExLjI1IDEuMjUgMCAxIDAtLjg4NS0yLjMzOSAxLjI1IDEuMjUgMCAwIDAgLjg4NSAyLjMzOSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-price-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNOS4wNDYgMTVWNS44NzdoLjk0MlYxNXoiIGZpbGw9IiMxODFEMUYiLz48cGF0aCBkPSJNOS4wNDYgMTVWNS44NzdoLjk0MlYxNXoiIGZpbGw9IiMxODFEMUYiLz48cGF0aCBkPSJNOS41IDYuMjI4IDcuMTY3IDguMzc2IDYuNSA3Ljc2MiA5LjUgNWwzIDIuNzYyLS42NjcuNjE0eiIgZmlsbD0iIzAwMCIvPjxwYXRoIGQ9Ik0yIDE4di0xaDE2djF6TTIgM1YyaDE2djF6IiBmaWxsPSIjMTgxRDFGIi8+PC9zdmc+)}.ag-charts-icon-reset{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTIuMDQgNC40NDVhNS44MSA1LjgxIDAgMCAwLTcuMjU3IDIuNDUzLjUuNSAwIDAgMS0uODY1LS41MDJBNi44MSA2LjgxIDAgMSAxIDMgOS44MTNhLjUuNSAwIDAgMSAxIDAgNS44MSA1LjgxIDAgMSAwIDguMDQtNS4zNjgiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiMwMDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTQuMjg5IDMuMDAyYS41LjUgMCAwIDEgLjUuNXYyLjY1NWgyLjY1NWEuNS41IDAgMCAxIDAgMUg0LjI5YS41LjUgMCAwIDEtLjUtLjVWMy41MDJhLjUuNSAwIDAgMSAuNS0uNSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-settings{--icon: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkIj48cGF0aCBkPSJNMTAgMTNhMyAzIDAgMSAwIDAtNiAzIDMgMCAwIDAgMCA2bTAtMWEyIDIgMCAxIDEtLjAwMS0zLjk5OUEyIDIgMCAwIDEgMTAgMTIiLz48cGF0aCBkPSJNMi4zMSAxNC4zNDVjLS44MTctMS40OTEuMDI3LTIuNDk5LjQ3NC0yLjg2NS41MzEtLjQzNC45NjktLjM2NS45NzItMS40OC0uMDAzLTEuMTE1LS40NDEtMS4wNDYtLjk3Mi0xLjQ4MS0uNDU0LS4zNzEtMS4zMTctMS40MDUtLjQzNC0yLjkzNmwuMDA1LS4wMDljLjg4NC0xLjUyIDIuMjA3LTEuMjkgMi43NTUtMS4wODMuNjQxLjI0My44MDEuNjU2IDEuNzY4LjEwMS45NjQtLjU2LjY4Ni0uOTA0Ljc5Ni0xLjU4Mi4wOTQtLjU3OC41NTktMS44NDMgMi4zMjYtMS44NDNoLjAxYzEuNzU5LjAwNSAyLjIyMiAxLjI2NiAyLjMxNiAxLjg0My4xMS42NzgtLjE2OCAxLjAyMi43OTYgMS41ODIuOTY3LjU1NSAxLjEyNy4xNDIgMS43NjgtLjEwMS41NDktLjIwOCAxLjg3Ni0uNDM4IDIuNzYgMS4wOTJzLjAyIDIuNTY1LS40MzQgMi45MzZjLS41MzEuNDM1LS45NjkuMzY2LS45NzIgMS40ODEuMDAzIDEuMTE1LjQ0MSAxLjA0Ni45NzIgMS40OC40NTQuMzcyIDEuMzE3IDEuNDA2LjQzNCAyLjkzN2wtLjAwNS4wMDljLS44ODQgMS41Mi0yLjIwNyAxLjI5LTIuNzU1IDEuMDgzLS42NDEtLjI0My0uODAxLS42NTYtMS43NjgtLjEwMS0uOTY0LjU2LS42ODYuOTA0LS43OTYgMS41ODEtLjA5NC41NzktLjU1OSAxLjg0NC0yLjMyNiAxLjg0NGgtLjAxYy0xLjc1OS0uMDA1LTIuMjIyLTEuMjY2LTIuMzE2LTEuODQ0LS4xMS0uNjc3LjE2OC0xLjAyMS0uNzk2LTEuNTgxLS45NjctLjU1NS0xLjEyNy0uMTQyLTEuNzY4LjEwMS0uNTQ5LjIwOC0xLjg3Ni40MzgtMi43Ni0xLjA5MmwtLjAyLS4wMzZ6TTkuOTg0IDIuMTYySDEwYzEuMzU1IDAgMS4zNDIgMS4wMzkgMS4zNTMgMS40MjUuMDA4LjMxMi4wNCAxLjE2IDEuMjU5IDEuODcybC4wMTUuMDA4YzEuMjI1LjcgMS45NzYuMzA0IDIuMjUxLjE1NS4zMzctLjE4MyAxLjIyNi0uNzExIDEuOTAyLjQ0NWwuMDA4LjAxNGMuNjc4IDEuMTczLS4yMjkgMS42ODItLjU1OCAxLjg4NC0uMjY2LjE2My0uOTg0LjYxNS0uOTkxIDIuMDI3di4wMTZjLjAwNyAxLjQxMi43MjUgMS44NjQuOTkxIDIuMDI3LjMyOC4yMDEgMS4yMjkuNzA3LjU2NiAxLjg3bC0uMDA4LjAxNGMtLjY3NyAxLjE3NC0xLjU3MS42NDMtMS45MS40NTktLjI3NS0uMTQ5LTEuMDI2LS41NDUtMi4yNTEuMTU0bC0uMDE1LjAwOWMtMS4yMTkuNzEyLTEuMjUxIDEuNTYtMS4yNTkgMS44NzItLjAxMS4zODYuMDAyIDEuNDI1LTEuMzUzIDEuNDI1cy0xLjM0Mi0xLjAzOS0xLjM1My0xLjQyNWMtLjAwOC0uMzEyLS4wNC0xLjE2LTEuMjU5LTEuODcybC0uMDE1LS4wMDljLTEuMjI1LS42OTktMS45NzYtLjMwMy0yLjI1MS0uMTU0LS4zMzYuMTgzLTEuMjE5LjcwNi0xLjg5NC0uNDMybC0uMDE2LS4wMjdjLS42NzgtMS4xNzQuMjI5LTEuNjgyLjU1OC0xLjg4NC4yNjYtLjE2My45ODQtLjYxNS45OTEtMi4wMjd2LS4wMTZjLS4wMDctMS40MTItLjcyNS0xLjg2NC0uOTkxLTIuMDI3LS4zMjgtLjIwMS0xLjIyOS0uNzA3LS41NjYtMS44N2wuMDA4LS4wMTRjLjY3Ny0xLjE3NCAxLjU3MS0uNjQzIDEuOTEtLjQ1OS4yNzUuMTQ5IDEuMDI2LjU0NSAyLjI1MS0uMTU1bC4wMTUtLjAwOGMxLjIxOS0uNzEyIDEuMjUxLTEuNTYgMS4yNTktMS44NzIuMDEtLjM4NC0uMDAyLTEuNDE3IDEuMzM3LTEuNDI1Ii8+PC9zdmc+)}.ag-charts-icon-step-line-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzE4MUQxRiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNiA0aDV2OGgzVjhoNXYxaC00djRoLTVWNUg3djEwSDJ2LTFoNHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-text-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00IDRIMTZWN0gxNVY1SDEwLjVWMTVIMTRWMTZINlYxNUg5LjVWNUg1VjdINFY0WiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-trend-line,.ag-charts-icon-trend-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS4zMTQgMTAuOTM4YTIuMjUgMi4yNSAwIDEgMSAuMDEtMWg5LjM1MmEyLjI1IDIuMjUgMCAxIDEgLjAxIDF6bS0yLjE4OS43MjlhMS4yNSAxLjI1IDAgMSAwIDAtMi41IDEuMjUgMS4yNSAwIDAgMCAwIDIuNW0xMy43NSAwYTEuMjUgMS4yNSAwIDEgMCAwLTIuNSAxLjI1IDEuMjUgMCAwIDAgMCAyLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-unlock,.ag-charts-icon-unlocked{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuNjUxIDMuNWEyLjg5NCAyLjg5NCAwIDAgMC0yLjg5NCAyLjg5NFY5SDE0LjVhMi41IDIuNSAwIDAgMSAyLjUgMi41djNhMi41IDIuNSAwIDAgMS0yLjUgMi41aC04QTIuNSAyLjUgMCAwIDEgNCAxNC41di0zQTIuNSAyLjUgMCAwIDEgNi41IDloLjI1N1Y2LjM5NGEzLjg5NCAzLjg5NCAwIDEgMSA3Ljc4OSAwIC41LjUgMCAwIDEtMSAwQTIuODk0IDIuODk0IDAgMCAwIDEwLjY1IDMuNU02LjUgMTBBMS41IDEuNSAwIDAgMCA1IDExLjV2M0ExLjUgMS41IDAgMCAwIDYuNSAxNmg4YTEuNSAxLjUgMCAwIDAgMS41LTEuNXYtM2ExLjUgMS41IDAgMCAwLTEuNS0xLjV6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-vertical-line,.ag-charts-icon-vertical-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuNSA3LjgwNmEyLjI1IDIuMjUgMCAwIDEgMCA0LjM4OFYxOS41aC0xdi03LjMwNmEyLjI1IDIuMjUgMCAwIDEgMC00LjM4OFYuNWgxem0tLjUuOTQ0YTEuMjUgMS4yNSAwIDEgMSAwIDIuNSAxLjI1IDEuMjUgMCAwIDEgMC0yLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-zoom-in{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTEwIDUuNWEuNS41IDAgMCAxIC41LjV2My41aDMuODc1YS41LjUgMCAwIDEgMCAxSDEwLjV2NC4yNWEuNS41IDAgMSAxLTEgMFYxMC41SDUuNjI1YS41LjUgMCAxIDEgMC0xSDkuNVY2YS41LjUgMCAwIDEgLjUtLjUiLz48L3N2Zz4=)}.ag-charts-icon-zoom-out{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS41IDEwYS41LjUgMCAwIDEgLjUtLjVoOGEuNS41IDAgMCAxIDAgMUg2YS41LjUgMCAwIDEtLjUtLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-high-low-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNyA0aDJ2MTJINFY0aDNNNSA1aDN2MTBINXpNMTEgMTRWNmg1djhoLTVtMS03aDN2NmgtM3oiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-hlc-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTguMTYzIDEuODM3LTUuMzM0IDExLjYyMUw2Ljk1NyA4LjEybC00LjE5OSA5LjYyMi0uOTE2LS40IDQuNzU2LTEwLjlMMTIuNDkgMTEuOCAxNy4yNTQgMS40MnoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiMwMDAiIGZpbGwtb3BhY2l0eT0iLjQiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTUuODI1IDIuNzA0LjU1IDEzLjc4NWwuOTAyLjQzIDQuNzI0LTkuOTE5IDYuMDM0IDUuMDI5IDMuMjU1LTguMTQtLjkyOC0uMzctMi43NDUgNi44NnptNy44NTIgMTQuNjM2IDUuNzgtMTMuMTM5LS45MTUtLjQwMi01LjIxOSAxMS44Ni02LjAwNS01LjUwNC0zLjI3OCA3LjY0OC45Mi4zOTQgMi43MjItNi4zNTJ6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-chevron-right{--icon: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03LjQ3IDUuNDdhLjc1Ljc1IDAgMCAxIDEuMDYgMGw0IDRhLjc1Ljc1IDAgMCAxIDAgMS4wNmwtNCA0YS43NS43NSAwIDAgMS0xLjA2LTEuMDZMMTAuOTQgMTAgNy40NyA2LjUzYS43NS43NSAwIDAgMSAwLTEuMDYiIGZpbGw9IiMwMDAiLz48L3N2Zz4=)}.ag-charts-icon-zoom-in-alt{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXpvb20taW4iPjxjaXJjbGUgY3g9IjExIiBjeT0iMTEiIHI9IjgiLz48bGluZSB4MT0iMjEiIHgyPSIxNi42NSIgeTE9IjIxIiB5Mj0iMTYuNjUiLz48bGluZSB4MT0iMTEiIHgyPSIxMSIgeTE9IjgiIHkyPSIxNCIvPjxsaW5lIHgxPSI4IiB4Mj0iMTQiIHkxPSIxMSIgeTI9IjExIi8+PC9zdmc+)}.ag-charts-icon-zoom-out-alt{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXpvb20tb3V0Ij48Y2lyY2xlIGN4PSIxMSIgY3k9IjExIiByPSI4Ii8+PGxpbmUgeDE9IjIxIiB4Mj0iMTYuNjUiIHkxPSIyMSIgeTI9IjE2LjY1Ii8+PGxpbmUgeDE9IjgiIHgyPSIxNCIgeTE9IjExIiB5Mj0iMTEiLz48L3N2Zz4=)}.ag-charts-input{--input-layer-active: 1;--input-layer-focus: 2;--input-padding: calc(var(--ag-charts-spacing) * 2);--input-padding-large: calc(var(--ag-charts-spacing) * 2.5);color:var(--ag-charts-input-text-color);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-large);transition-duration:.25s;transition-property:none;transition-timing-function:ease-out}.ag-charts-input:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:var(--input-layer-focus)}.ag-charts-button{background:var(--ag-charts-button-background-color);border:var(--ag-charts-button-border);border-radius:var(--ag-charts-button-border-radius);color:var(--ag-charts-button-text-color);cursor:pointer;padding:var(--input-padding);transition-property:background,border-color}.ag-charts-button:hover{background:var(--ag-charts-focus-color)}.ag-charts-button:has(.ag-charts-icon){padding:2px}.ag-charts-checkbox{--checkbox-transition-duration: .1s;appearance:none;background:var(--ag-charts-checkbox-background-color);border-radius:calc(var(--ag-charts-border-radius) * 9);cursor:pointer;height:18px;margin:0;transition-duration:var(--checkbox-transition-duration);transition-property:margin;width:29px}.ag-charts-checkbox:before{display:block;background:var(--ag-charts-input-background-color);border-radius:calc(var(--ag-charts-border-radius) * 7);content:" ";height:14px;margin:2px;transition-duration:var(--checkbox-transition-duration);transition-property:margin;transition-timing-function:var(--ag-charts-input-transition-easing);width:14px}.ag-charts-checkbox:checked{background:var(--ag-charts-checkbox-checked-background-color)}.ag-charts-checkbox:checked:before{margin-left:13px}.ag-charts-select{background:var(--ag-charts-input-background-color);border:var(--ag-charts-input-border);border-radius:var(--ag-charts-input-border-radius);padding:3px 2px 4px;font-size:inherit}.ag-charts-textarea{--textarea-line-height: 1.38;background:var(--ag-charts-input-background-color);border:var(--ag-charts-input-border);border-radius:var(--ag-charts-input-border-radius);line-height:var(--textarea-line-height);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-large);padding:var(--input-padding-large) var(--input-padding)}.ag-charts-textarea::placeholder{color:var(--ag-charts-input-placeholder-text-color)}.ag-charts-proxy-container{pointer-events:none;position:absolute}.ag-charts-proxy-legend-toolbar{pointer-events:auto}.ag-charts-proxy-legend-toolbar>div[role=listitem]{pointer-events:none}.ag-charts-proxy-elem{-webkit-appearance:none;appearance:none;background:none;border:none;color:#0000;overflow:hidden;pointer-events:auto;position:absolute}.ag-charts-proxy-elem::-moz-range-thumb,.ag-charts-proxy-elem::-moz-range-track{opacity:0}.ag-charts-proxy-elem::-webkit-slider-runnable-track,.ag-charts-proxy-elem::-webkit-slider-thumb{opacity:0}.ag-charts-proxy-elem:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow)}.ag-charts-focus-indicator{position:absolute;display:block;pointer-events:none;user-select:none;-webkit-user-select:none;width:100%;height:100%}.ag-charts-focus-indicator>div{position:absolute;outline:solid 1px var(--ag-charts-chrome-background-color);box-shadow:var(--ag-charts-focus-shadow)}.ag-charts-focus-indicator>svg{width:100%;height:100%;fill:none;overflow:visible}.ag-charts-focus-svg-outer-path{stroke:var(--ag-charts-chrome-background-color);stroke-width:4px}.ag-charts-focus-svg-inner-path{stroke:var(--ag-charts-accent-color);stroke-width:2px}.ag-charts-overlay{color:#181d1f;pointer-events:none}.ag-charts-overlay.ag-charts-dark-overlay{color:#fff}.ag-charts-overlay--loading{color:#8c8c8c}.ag-charts-overlay__loading-background{background:#fff;pointer-events:none}.ag-charts-overlay.ag-charts-dark-overlay .ag-charts-overlay__loading-background{background:#192232}.ag-charts-tooltip{--tooltip-arrow-size: 8px;--tooltip-row-spacing: 8px;--tooltip-column-spacing: 16px;position:fixed;inset:unset;margin:0;padding:0;overflow:visible;top:var(--top, 0px);left:var(--left, 0px);width:max-content;max-width:100%;font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);color:var(--ag-charts-tooltip-text-color);background:var(--ag-charts-tooltip-background-color);border:var(--ag-charts-tooltip-border);border-radius:var(--ag-charts-tooltip-border-radius);box-shadow:var(--ag-charts-popup-shadow)}.ag-charts-tooltip--compact .ag-charts-tooltip-content{--tooltip-row-spacing: 2px;--tooltip-column-spacing: 8px;padding:3px 6px}.ag-charts-tooltip--arrow-top:before,.ag-charts-tooltip--arrow-right:before,.ag-charts-tooltip--arrow-bottom:before,.ag-charts-tooltip--arrow-left:before{content:"";position:absolute;display:block;width:var(--tooltip-arrow-size);height:var(--tooltip-arrow-size);border:inherit;border-bottom-color:transparent;border-right-color:transparent;background:inherit;clip-path:polygon(0 0,100% 0,100% 1px,1px 100%,0 100%)}.ag-charts-tooltip--arrow-top:before{bottom:100%;left:50%;transform:translate(-50%) translateY(calc(var(--tooltip-arrow-size) * .5)) rotate(45deg)}.ag-charts-tooltip--arrow-bottom:before{top:100%;left:50%;transform:translate(-50%) translateY(calc(var(--tooltip-arrow-size) * -.5)) rotate(225deg)}.ag-charts-tooltip--arrow-left:before{right:100%;top:50%;transform:translateY(-50%) translate(calc(var(--tooltip-arrow-size) * .5)) rotate(315deg)}.ag-charts-tooltip--arrow-right:before{left:100%;top:50%;transform:translateY(-50%) translate(calc(var(--tooltip-arrow-size) * -.5)) rotate(135deg)}.ag-charts-tooltip--no-interaction{pointer-events:none;user-select:none;-webkit-user-select:none}.ag-charts-tooltip--wrap-always{overflow-wrap:break-word;word-break:break-word;hyphens:none}.ag-charts-tooltip--wrap-hyphenate{overflow-wrap:break-word;word-break:break-word;hyphens:auto}.ag-charts-tooltip--wrap-on-space{overflow-wrap:normal;word-break:normal}.ag-charts-tooltip--wrap-never{white-space:nowrap}.ag-charts-tooltip-heading,.ag-charts-tooltip-title,.ag-charts-tooltip-label,.ag-charts-tooltip-value{overflow:hidden;text-overflow:ellipsis}.ag-charts-tooltip-content{display:grid;grid:auto-flow minmax(1em,auto) / 1fr;padding:8px 12px;gap:var(--tooltip-row-spacing)}.ag-charts-tooltip-content:has(.ag-charts-tooltip-symbol){grid:auto-flow minmax(1em,auto) / auto 1fr}.ag-charts-tooltip-heading{grid-column:1 / -1}.ag-charts-tooltip-symbol{grid-column:1 / 2;place-self:center}.ag-charts-tooltip-symbol svg{display:block}.ag-charts-tooltip-title{grid-column:-2 / -1}.ag-charts-tooltip-row{grid-column:1 / -1;display:flex;gap:var(--tooltip-column-spacing);align-items:baseline;justify-content:space-between;overflow:hidden}.ag-charts-tooltip-row--inline{grid-column:-2 / -1}.ag-charts-tooltip-label{flex:1;min-width:0}.ag-charts-tooltip-value{min-width:0}.ag-charts-tooltip-footer{grid-column:1 / -1;color:var(--ag-charts-tooltip-subtle-text-color);text-align:center}.ag-charts-popover{position:absolute;border:var(--ag-charts-border);border-radius:var(--ag-charts-border-radius);background:var(--ag-charts-panel-background-color);color:var(--ag-charts-chrome-text-color);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);box-shadow:var(--ag-charts-popup-shadow);z-index:var(--ag-charts-layer-ui-overlay)}.ag-charts-menu{--item-padding: 6px 12px;--icon-color: var(--ag-charts-menu-text-color);display:grid;grid:auto-flow auto / 1fr;column-gap:12px;font-size:var(--ag-charts-chrome-font-size)}.ag-charts-menu:has(.ag-charts-menu__icon,.ag-charts-menu__row--stroke-width-visible){grid:auto-flow auto / auto 1fr}.ag-charts-menu__row--stroke-width-visible:before{content:"";height:var(--strokeWidth);width:12px;background:var(--icon-color)}.ag-charts-menu__row--stroke-width-visible[aria-disabled=true]:before{filter:grayscale(1);opacity:.5}.ag-charts-menu__row{display:grid;grid-column:1 / -1;grid-template-columns:subgrid;align-items:center;padding:var(--item-padding)}.ag-charts-menu__row:not(.ag-charts-menu__row--active){cursor:pointer}.ag-charts-menu__row:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.ag-charts-menu__row:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.ag-charts-menu__row:focus{background:var(--ag-charts-focus-color)}.ag-charts-menu__row:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:var(--ag-charts-layer-menu)}.ag-charts-menu__row--active{--icon-color: var(--ag-charts-accent-color);background:var(--ag-charts-focus-color);color:var(--ag-charts-accent-color)}.ag-charts-menu__label{grid-column:-1 / span 1}.ag-charts-toolbar{--toolbar-gap: calc(var(--ag-charts-spacing) * 2);--toolbar-size: 34px;--toolbar-button-padding: 6px;align-items:center;display:flex;flex-wrap:nowrap;position:absolute}.ag-charts-toolbar__button{align-items:center;background:var(--ag-charts-chrome-background-color);border:var(--ag-charts-button-border);color:var(--ag-charts-button-text-color);cursor:pointer;display:flex;font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-medium);font-weight:var(--ag-charts-chrome-font-weight);justify-content:center;min-height:var(--toolbar-size);min-width:var(--toolbar-size);padding:var(--toolbar-button-padding);position:relative;transition:background-color .25s ease-in-out,border-color .25s ease-in-out,color .25s ease-in-out;white-space:nowrap}.ag-charts-toolbar__button:hover{background:var(--ag-charts-focus-color);z-index:1}.ag-charts-toolbar__button:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-toolbar__button--active{background:var(--ag-charts-focus-color);border-color:var(--ag-charts-accent-color);color:var(--ag-charts-accent-color);z-index:2}.ag-charts-toolbar__button[aria-disabled=true]{background:var(--ag-charts-button-disabled-background-color);color:var(--ag-charts-button-disabled-text-color);cursor:default}.ag-charts-toolbar--horizontal{flex-direction:row;.ag-charts-toolbar__button{margin:0 0 0 -1px}.ag-charts-toolbar__button--first{border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius);margin:0}.ag-charts-toolbar__button--last{border-bottom-right-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius)}}.ag-charts-toolbar--vertical{flex-direction:column;.ag-charts-toolbar__button{margin:-1px 0 0;max-width:100%}.ag-charts-toolbar__button--first{border-top-left-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius);margin:0}.ag-charts-toolbar__button--last{border-bottom-left-radius:var(--ag-charts-border-radius);border-bottom-right-radius:var(--ag-charts-border-radius)}}.ag-charts-toolbar__icon+.ag-charts-toolbar__label{margin-left:var(--toolbar-gap)}.ag-charts-toolbar__icon,.ag-charts-toolbar__label{pointer-events:none}.ag-charts-floating-toolbar{border:none;display:flex;.ag-charts-toolbar{align-items:unset;position:unset}}.ag-charts-floating-toolbar__drag-handle{align-items:center;background:var(--ag-charts-chrome-background-color);border:var(--ag-charts-border);border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius);cursor:grab;display:flex;justify-content:center;min-width:24px;padding-left:0;padding-right:0}.ag-charts-floating-toolbar__drag-handle--dragging{cursor:grabbing}\n'; + +// packages/ag-charts-community/src/util/baseManager.ts +var BaseManager = class { + constructor() { + this.cleanup = new CleanupRegistry(); + this.destroyed = false; + } + destroy() { + this.cleanup.flush(); + this.destroyed = true; + } +}; + +// packages/ag-charts-community/src/util/guardedElement.ts +var GuardedElement = class _GuardedElement { + constructor(element2, topTabGuard, bottomTabGuard) { + this.element = element2; + this.topTabGuard = topTabGuard; + this.bottomTabGuard = bottomTabGuard; + this.cleanup = new CleanupRegistry(); + this.guardTabIndex = 0; + this.hasFocus = false; + this.initTabGuard(this.topTabGuard, false); + this.initTabGuard(this.bottomTabGuard, true); + this.element.addEventListener("focus", () => this.onFocus(), { capture: true }); + this.element.addEventListener("blur", (ev) => this.onBlur(ev), { capture: true }); + } + set tabIndex(index) { + this.guardTabIndex = index; + if (this.guardTabIndex === 0) { + this.setGuardIndices(void 0); + } else if (!this.hasFocus) { + this.setGuardIndices(this.guardTabIndex); + } + } + destroy() { + this.cleanup.flush(); + } + initTabGuard(guard, reverse) { + this.cleanup.register(attachListener(guard, "focus", () => this.onTab(guard, reverse))); + } + setGuardIndices(index) { + const tabindex = index; + setAttribute(this.topTabGuard, "tabindex", tabindex); + setAttribute(this.bottomTabGuard, "tabindex", tabindex); + } + onFocus() { + this.hasFocus = true; + if (this.guardTabIndex !== 0) { + this.setGuardIndices(0); + } + } + onBlur({ relatedTarget }) { + const { topTabGuard: top, bottomTabGuard: bot } = this; + this.hasFocus = false; + if (this.guardTabIndex !== 0 && relatedTarget !== top && relatedTarget !== bot) { + this.setGuardIndices(this.guardTabIndex); + } + } + onTab(guard, reverse) { + if (this.guardTabIndex !== 0) { + let focusTarget; + if (guard.tabIndex === 0) { + focusTarget = this.findExitTarget(!reverse); + this.setGuardIndices(this.guardTabIndex); + } else { + focusTarget = this.findEnterTarget(reverse); + } + focusTarget?.focus(); + } + } + static queryFocusable(element2, selectors) { + const myWindow = getWindow(); + return Array.from(element2.querySelectorAll(selectors)).filter((e) => { + if (e instanceof HTMLElement) { + const style2 = myWindow.getComputedStyle(e); + return style2.display !== "none" && style2.visibility !== "none"; + } + return false; + }); + } + findEnterTarget(reverse) { + const focusables = _GuardedElement.queryFocusable(this.element, '[tabindex="0"]'); + const index = reverse ? focusables.length - 1 : 0; + return focusables[index]; + } + findExitTarget(reverse) { + const focusables = _GuardedElement.queryFocusable(getDocument(), "[tabindex]").filter((e) => e.tabIndex > 0).sort((a, b) => a.tabIndex - b.tabIndex); + const { before, after } = _GuardedElement.findBeforeAndAfter(focusables, this.guardTabIndex); + return reverse ? before : after; + } + static findBeforeAndAfter(elements, targetTabIndex) { + let left = 0; + let right = elements.length - 1; + let before = void 0; + let after = void 0; + while (left <= right) { + const mid = Math.floor((left + right) / 2); + const currentTabIndex = elements[mid].tabIndex; + if (currentTabIndex === targetTabIndex) { + before = elements[mid - 1] || void 0; + after = elements[mid + 1] || void 0; + break; + } else if (currentTabIndex < targetTabIndex) { + before = elements[mid]; + left = mid + 1; + } else { + after = elements[mid]; + right = mid - 1; + } + } + return { before, after }; + } +}; + +// packages/ag-charts-community/src/util/keynavUtil.ts +function addEscapeEventListener(elem, onEscape, keyCodes = ["Escape"]) { + return attachListener(elem, "keydown", (event) => { + if (matchesKey(event, ...keyCodes)) { + onEscape(event); + } + }); +} +function addMouseCloseListener(menu, hideCallback) { + const removeEvent = attachListener(getWindow(), "mousedown", (event) => { + if ([0, 2].includes(event.button) && !containsEvent(menu, event)) { + hideCallback(); + removeEvent(); + } + }); + return removeEvent; +} +function addTouchCloseListener(menu, hideCallback) { + const removeEvent = attachListener(getWindow(), "touchstart", (event) => { + const touches = Array.from(event.targetTouches); + if (touches.some((touch) => !containsEvent(menu, touch))) { + hideCallback(); + removeEvent(); + } + }); + return removeEvent; +} +function containsEvent(container, event) { + if (event.target instanceof Element && event.target.shadowRoot != null) { + return true; + } + return event.target instanceof Node && container.contains(event.target); +} +function addOverrideFocusVisibleEventListener(menu, buttons2, overrideFocusVisible) { + const setFocusVisible = (value) => { + for (const btn of buttons2) { + setAttribute(btn, "data-focus-visible-override", value); + } + }; + setFocusVisible(overrideFocusVisible); + return attachListener(menu, "keydown", () => setFocusVisible(true), { once: true }); +} +function hasNoModifiers(event) { + return !(event.shiftKey || event.altKey || event.ctrlKey || event.metaKey); +} +function matchesKey(event, ...keys) { + return hasNoModifiers(event) && keys.includes(event.key); +} +function linkTwoButtons(src, dst, key) { + return attachListener(src, "keydown", (event) => { + if (matchesKey(event, key)) { + dst.focus(); + } + }); +} +var PREV_NEXT_KEYS = { + horizontal: { nextKey: "ArrowRight", prevKey: "ArrowLeft" }, + vertical: { nextKey: "ArrowDown", prevKey: "ArrowUp" } +}; +function initRovingTabIndex(opts) { + const { orientation, buttons: buttons2, wrapAround = false, onEscape, onFocus, onBlur } = opts; + const { nextKey, prevKey } = PREV_NEXT_KEYS[orientation]; + const setTabIndices = (event) => { + if (event.target && "tabIndex" in event.target) { + for (const b of buttons2) { + b.tabIndex = -1; + } + event.target.tabIndex = 0; + } + }; + const [c, m] = wrapAround ? [buttons2.length, buttons2.length] : [0, Infinity]; + const cleanup = new CleanupRegistry(); + for (let i = 0; i < buttons2.length; i++) { + const prev = buttons2[(c + i - 1) % m]; + const curr = buttons2[i]; + const next = buttons2[(c + i + 1) % m]; + cleanup.register( + attachListener(curr, "focus", setTabIndices), + onFocus && attachListener(curr, "focus", onFocus), + onBlur && attachListener(curr, "blur", onBlur), + onEscape && addEscapeEventListener(curr, onEscape), + prev && linkTwoButtons(curr, prev, prevKey), + next && linkTwoButtons(curr, next, nextKey), + attachListener(curr, "keydown", (event) => { + if (matchesKey(event, nextKey, prevKey)) { + event.preventDefault(); + } + }) + ); + curr.tabIndex = i === 0 ? 0 : -1; + } + return cleanup; +} +function makeAccessibleClickListener(element2, onclick) { + return (event) => { + if (element2.ariaDisabled === "true") { + return event.preventDefault(); + } + onclick(event); + }; +} +function isButtonClickEvent(event) { + if ("button" in event) { + return event.button === 0; + } + return hasNoModifiers(event) && (event.code === "Space" || event.key === "Enter"); +} +function getLastFocus(sourceEvent) { + if (sourceEvent?.target instanceof HTMLElement && "tabindex" in sourceEvent.target.attributes) { + return sourceEvent.target; + } + return void 0; +} +function stopPageScrolling(element2) { + return attachListener(element2, "keydown", (event) => { + if (event.defaultPrevented) + return; + const shouldPrevent = getAttribute(event.target, "data-preventdefault", true); + if (shouldPrevent && matchesKey(event, "ArrowRight", "ArrowLeft", "ArrowDown", "ArrowUp")) { + event.preventDefault(); + } + }); +} + +// packages/ag-charts-community/src/util/pixelRatioObserver.ts +var PixelRatioObserver = class { + constructor(callback2) { + this.callback = callback2; + this.devicePixelRatio = getWindow("devicePixelRatio") ?? 1; + this.devicePixelRatioMediaQuery = void 0; + this.devicePixelRatioListener = (e) => { + if (e.matches) + return; + this.devicePixelRatio = getWindow("devicePixelRatio") ?? 1; + this.unregisterDevicePixelRatioListener(); + this.registerDevicePixelRatioListener(); + this.callback(this.pixelRatio); + }; + } + get pixelRatio() { + return this.devicePixelRatio; + } + observe() { + this.registerDevicePixelRatioListener(); + } + disconnect() { + this.unregisterDevicePixelRatioListener(); + } + unregisterDevicePixelRatioListener() { + this.devicePixelRatioMediaQuery?.removeEventListener("change", this.devicePixelRatioListener); + this.devicePixelRatioMediaQuery = void 0; + } + registerDevicePixelRatioListener() { + const devicePixelRatioMediaQuery = getWindow("matchMedia")?.(`(resolution: ${this.pixelRatio}dppx)`); + devicePixelRatioMediaQuery?.addEventListener("change", this.devicePixelRatioListener); + this.devicePixelRatioMediaQuery = devicePixelRatioMediaQuery; + } +}; + +// packages/ag-charts-community/src/util/sizeMonitor.ts +var SizeMonitor = class { + constructor() { + this.elements = /* @__PURE__ */ new Map(); + this.documentReady = false; + this.queuedObserveRequests = []; + this.onLoad = () => { + this.documentReady = true; + for (const [el, cb] of this.queuedObserveRequests) { + this.observe(el, cb); + } + this.queuedObserveRequests = []; + this.observeWindow(); + }; + if (typeof ResizeObserver !== "undefined") { + this.resizeObserver = new ResizeObserver((entries2) => { + for (const { + target, + contentRect: { width: width2, height: height2 } + } of entries2) { + const entry = this.elements.get(target); + this.checkSize(entry, target, width2, height2); + } + }); + } + let animationFrame; + this.pixelRatioObserver = new PixelRatioObserver(() => { + clearTimeout(animationFrame); + animationFrame = setTimeout(() => this.checkPixelRatio(), 0); + }); + this.documentReady = getDocument("readyState") === "complete"; + if (this.documentReady) { + this.observeWindow(); + } else { + getWindow()?.addEventListener("load", this.onLoad); + } + } + destroy() { + getWindow()?.removeEventListener("load", this.onLoad); + this.resizeObserver?.disconnect(); + this.resizeObserver = void 0; + this.pixelRatioObserver?.disconnect(); + this.pixelRatioObserver = void 0; + } + observeWindow() { + this.pixelRatioObserver?.observe(); + } + checkPixelRatio() { + const pixelRatio = this.pixelRatioObserver?.pixelRatio ?? 1; + for (const [element2, entry] of this.elements) { + if (entry.size != null && entry.size.pixelRatio !== pixelRatio) { + const { width: width2, height: height2 } = entry.size; + entry.size = { width: width2, height: height2, pixelRatio }; + entry.cb(entry.size, element2); + } + } + } + checkSize(entry, element2, width2, height2) { + if (!entry) + return; + if (width2 !== entry.size?.width || height2 !== entry.size?.height) { + const pixelRatio = this.pixelRatioObserver?.pixelRatio ?? 1; + entry.size = { width: width2, height: height2, pixelRatio }; + entry.cb(entry.size, element2); + } + } + // Only a single callback is supported. + observe(element2, cb) { + if (!this.documentReady) { + this.queuedObserveRequests.push([element2, cb]); + return; + } + if (this.elements.has(element2)) { + this.removeFromQueue(element2); + } else { + this.resizeObserver?.observe(element2); + } + const entry = { cb }; + this.elements.set(element2, entry); + } + unobserve(element2) { + this.resizeObserver?.unobserve(element2); + this.elements.delete(element2); + this.removeFromQueue(element2); + if (!this.elements.size) { + this.destroy(); + } + } + removeFromQueue(element2) { + this.queuedObserveRequests = this.queuedObserveRequests.filter(([el]) => el !== element2); + } +}; + +// packages/ag-charts-community/src/util/stateTracker.ts +var StateTracker = class extends Map { + constructor(defaultValue, defaultState) { + super(); + this.defaultValue = defaultValue; + this.defaultState = defaultState; + } + set(key, value) { + this.delete(key); + if (value !== void 0) { + super.set(key, value); + } + delete this.cachedState; + delete this.cachedValue; + return this; + } + delete(key) { + delete this.cachedState; + delete this.cachedValue; + return super.delete(key); + } + stateId() { + this.cachedState ?? (this.cachedState = Array.from(this.keys()).pop() ?? this.defaultState); + return this.cachedState; + } + stateValue() { + this.cachedValue ?? (this.cachedValue = Array.from(this.values()).pop() ?? this.defaultValue); + return this.cachedValue; + } +}; + +// packages/ag-charts-community/src/dom/domLayout.html +var domLayout_default = '

'; + +// packages/ag-charts-community/src/dom/domManager.ts +var DOM_ELEMENT_CLASSES = [ + "styles", + "canvas", + "canvas-center", + "canvas-container", + "canvas-overlay", + "canvas-proxy", + "series-area", + "tooltip-container" +]; +var MINIMAL_DOM_ELEMENT_ROLES = /* @__PURE__ */ new Set(["styles", "canvas-container", "canvas", "tooltip-container"]); +var CONTAINER_MODIFIERS = { + safeHorizontal: "ag-charts-wrapper--safe-horizontal", + safeVertical: "ag-charts-wrapper--safe-vertical" +}; +var domElementConfig = /* @__PURE__ */ new Map([ + ["styles", { childElementType: "style" }], + ["canvas", { childElementType: "canvas" }], + ["canvas-proxy", { childElementType: "div" }], + ["canvas-overlay", { childElementType: "div" }], + ["canvas-center", { childElementType: "div" }], + ["series-area", { childElementType: "div" }], + ["tooltip-container", { childElementType: "div" }] +]); +function setupObserver(element2, cb) { + if (typeof IntersectionObserver === "undefined") + return; + const observer = new IntersectionObserver( + (observedEntries) => { + for (const entry of observedEntries) { + if (entry.target === element2) { + cb(entry.intersectionRatio); + } + } + }, + { root: element2 } + ); + observer.observe(element2); + return observer; +} +var NULL_DOMRECT = { + x: 0, + y: 0, + width: 0, + height: 0, + top: 0, + bottom: 0, + left: 0, + right: 0, + toJSON() { + return NULL_DOMRECT; + } +}; +function createTabGuardElement(guardedElem, where) { + const div = createElement("div"); + div.className = "ag-charts-tab-guard"; + guardedElem.insertAdjacentElement(where, div); + return div; +} +var _DOMManager = class _DOMManager extends BaseManager { + constructor(eventsHub, chart, initialContainer, styleContainer, mode = "normal") { + super(); + this.eventsHub = eventsHub; + this.chart = chart; + this.styleContainer = styleContainer; + this.mode = mode; + this.anchorName = `--${createId(this)}`; + this.styles = /* @__PURE__ */ new Map(); + this.pendingContainer = void 0; + this.container = void 0; + this.documentRoot = void 0; + this.initiallyConnected = void 0; + this.containerSize = void 0; + this.sizeMonitor = new SizeMonitor(); + this.cursorState = new StateTracker("default"); + this.minWidth = 0; + this.minHeight = 0; + this.element = this.initDOM(); + this.rootElements = this.initRootElements(); + this.rootElements["canvas"].element.style.setProperty("anchor-name", this.anchorName); + let hidden = false; + this.observer = setupObserver(this.element, (intersectionRatio) => { + if (intersectionRatio === 0 && !hidden) { + this.eventsHub.emit("dom:hidden", null); + } + hidden = intersectionRatio === 0; + }); + this.setSizeOptions(); + this.updateContainerSize(); + this.addStyles("ag-charts-community", styles_default); + this.setContainer(initialContainer); + this.cleanup.register(stopPageScrolling(this.element)); + if (this.mode === "normal") { + const guardedElement = this.rootElements["canvas-center"].element; + if (guardedElement == null) + throw new Error("Error initializing tab guards"); + const topGuard = createTabGuardElement(guardedElement, "beforebegin"); + const botGuard = createTabGuardElement(guardedElement, "afterend"); + this.tabGuards = new GuardedElement(guardedElement, topGuard, botGuard); + } + } + initDOM() { + if (this.mode === "normal") { + const templateEl = createElement("div"); + templateEl.innerHTML = domLayout_default; + return templateEl.firstChild; + } + const element2 = createElement("div"); + element2.role = "presentation"; + element2.dataset.agCharts = ""; + element2.classList.add("ag-charts-wrapper"); + const seriesArea = createElement("div"); + element2.appendChild(seriesArea); + seriesArea.role = "presentation"; + seriesArea.classList.add("ag-charts-series-area"); + return element2; + } + initRootElements() { + const { mode, element: element2 } = this; + const rootElements = {}; + for (const domElement of DOM_ELEMENT_CLASSES) { + const className = `ag-charts-${domElement}`; + let el; + if (mode === "normal") { + el = element2.classList.contains(className) ? element2 : element2.getElementsByClassName(className)[0]; + } else if (MINIMAL_DOM_ELEMENT_ROLES.has(domElement)) { + el = element2; + } else { + el = element2.getElementsByClassName(className)[0] ?? createElement("div"); + } + if (el == null) { + throw new Error(`AG Charts - unable to find DOM element ${className}`); + } + rootElements[domElement] = { + element: el, + children: /* @__PURE__ */ new Map(), + listeners: [] + }; + } + return rootElements; + } + destroy() { + super.destroy(); + this.observer?.unobserve(this.element); + if (this.container) { + this.sizeMonitor.unobserve(this.container); + } + this.pendingContainer = void 0; + for (const el of Object.values(this.rootElements)) { + for (const c of el.children.values()) { + c.remove(); + } + el.element.remove(); + } + this.element.remove(); + } + postRenderUpdate() { + if (this.mode === "minimal") + return; + if (this.pendingContainer == null || this.pendingContainer === this.container) + return; + if (_DOMManager.batchedUpdateContainer.length === 0) { + getWindow().setTimeout(this.applyBatchedUpdateContainer.bind(this), 0); + } + _DOMManager.batchedUpdateContainer.push(this); + } + applyBatchedUpdateContainer() { + for (const manager of _DOMManager.batchedUpdateContainer) { + if (!manager.destroyed) { + manager.updateContainer(); + } + } + _DOMManager.batchedUpdateContainer.splice(0); + } + setSizeOptions(minWidth = 300, minHeight = 300, optionsWidth, optionsHeight) { + const { style: style2 } = this.element; + style2.width = `${optionsWidth ?? minWidth}px`; + style2.height = `${optionsHeight ?? minHeight}px`; + this.minWidth = optionsWidth ?? minWidth; + this.minHeight = optionsHeight ?? minHeight; + this.updateContainerClassName(); + } + updateContainerSize() { + const { style: centerStyle } = this.rootElements["canvas-center"].element; + centerStyle.visibility = this.containerSize == null ? "hidden" : ""; + if (this.containerSize) { + centerStyle.width = `${this.containerSize.width ?? 0}px`; + centerStyle.height = `${this.containerSize.height ?? 0}px`; + } else { + centerStyle.width = ""; + centerStyle.height = ""; + } + this.updateContainerClassName(); + } + setTabGuardIndex(tabIndex) { + if (!this.tabGuards) + return; + this.tabGuards.tabIndex = tabIndex; + } + setContainer(newContainer) { + if (newContainer === this.container) + return; + this.pendingContainer = newContainer; + if (this.mode === "minimal" || this.container == null) { + this.updateContainer(); + } + } + updateContainer() { + const { pendingContainer } = this; + if (pendingContainer == null || pendingContainer === this.container) + return; + if (this.container) { + this.element.remove(); + this.sizeMonitor.unobserve(this.container); + } + if (this.documentRoot != null) { + for (const id of this.rootElements["styles"].children.keys()) { + this.removeChild("styles", id); + } + } + this.container = pendingContainer; + this.pendingContainer = void 0; + this.documentRoot = this.getShadowDocumentRoot(pendingContainer); + this.initiallyConnected = pendingContainer.isConnected; + for (const [id, styles] of this.styles) { + this.addStyles(id, styles); + } + pendingContainer.appendChild(this.element); + this.sizeMonitor.observe(pendingContainer, (size) => { + this.containerSize = size; + this.updateContainerSize(); + this.eventsHub.emit("dom:resize", null); + }); + this.eventsHub.emit("dom:container-change", null); + } + setThemeClass(themeClassName) { + const themeClassNamePrefix = "ag-charts-theme-"; + for (const className of Array.from(this.element.classList)) { + if (className.startsWith(themeClassNamePrefix) && className !== themeClassName) { + this.element.classList.remove(className); + } + } + this.element.classList.add(themeClassName); + } + setThemeParameters(params) { + for (const [key, value] of entries(params)) { + let formattedValue = `${value}`; + if (key.endsWith("Size") || key.endsWith("Radius")) { + formattedValue = `${value}px`; + } else if (key.endsWith("Border") && typeof value === "boolean") { + formattedValue = value ? "var(--ag-charts-border)" : "none"; + } + this.element.style.setProperty(`--ag-charts-${kebabCase(key)}`, formattedValue); + } + } + updateCanvasLabel(ariaLabel) { + setAttribute(this.rootElements["canvas-proxy"].element, "aria-label", ariaLabel); + } + getEventElement(defaultElem, eventType) { + const events = ["focus", "blur", "keydown", "keyup"]; + return events.includes(eventType) ? this.rootElements["series-area"].element : defaultElem; + } + addEventListener(type, listener, options) { + const element2 = this.getEventElement(this.element, type); + return attachListener(element2, type, listener, options); + } + removeEventListener(type, listener, options) { + this.getEventElement(this.element, type).removeEventListener(type, listener, options); + } + /** Get the main chart area client bound rect. */ + getBoundingClientRect() { + return this.rootElements["canvas"].element.getBoundingClientRect(); + } + /** + * Get the client bounding rect for overlay elements that might float outside the bounds of the + * main chart area. + */ + getOverlayClientRect() { + const window = getWindow(); + const windowBBox = new BBox(0, 0, window.innerWidth, window.innerHeight); + const containerBBox = this.getRawOverlayClientRect(); + return windowBBox.intersection(containerBBox)?.toDOMRect() ?? NULL_DOMRECT; + } + getRawOverlayClientRect() { + let element2 = this.element; + const fullScreenElement = this.element.getRootNode()?.fullscreenElement; + while (element2 != null) { + let isContainer; + if (fullScreenElement != null && element2 === fullScreenElement) { + isContainer = true; + } else { + const styleMap = element2.computedStyleMap?.(); + const overflowY = styleMap?.get("overflow-y")?.toString(); + isContainer = overflowY === "auto" || overflowY === "scroll"; + } + if (isContainer) { + return BBox.fromObject(element2.getBoundingClientRect()); + } + element2 = element2.parentElement; + } + if (this.documentRoot != null) + return BBox.fromObject(this.documentRoot.getBoundingClientRect()); + const { innerWidth, innerHeight } = getWindow(); + return new BBox(0, 0, innerWidth, innerHeight); + } + getShadowDocumentRoot(current = this.container) { + const docRoot = current?.ownerDocument?.body ?? getDocument("body"); + while (current != null) { + if (current === docRoot) { + return void 0; + } + if (current.parentNode instanceof DocumentFragment) { + return current; + } + current = current.parentNode; + } + } + getParent(domElementClass) { + return this.rootElements[domElementClass].element; + } + getChildBoundingClientRect(type) { + const { children } = this.rootElements[type]; + const childRects = []; + for (const child of children.values()) { + childRects.push(BBox.fromObject(child.getBoundingClientRect())); + } + return BBox.merge(childRects); + } + isManagedChildDOMElement(el, domElementClass, id) { + const { children } = this.rootElements[domElementClass]; + const search = children?.get(id); + return search != null && el.contains(search); + } + contains(element2, domElementClass) { + if (domElementClass == null) + return this.element.contains(element2); + return this.rootElements[domElementClass].element.contains(element2); + } + addStyles(id, styles) { + const dataAttribute = "data-ag-charts"; + this.styles.set(id, styles); + if (this.container == null) + return; + const checkId = (el) => { + return el.getAttribute(dataAttribute) === id; + }; + const addStyleElement = (el) => { + const metaElements = /* @__PURE__ */ new Set(["TITLE", "META"]); + let skippingMetaElements = true; + let insertAfterEl; + for (const child of el.children) { + if (skippingMetaElements && metaElements.has(child.tagName)) { + insertAfterEl = child; + continue; + } + skippingMetaElements = false; + if (checkId(child)) + return; + if (child.hasAttribute(dataAttribute)) { + insertAfterEl = child; + } + } + const styleEl = createElement("style"); + if (this.chart.styleNonce != null) { + styleEl.nonce = this.chart.styleNonce; + } + if (insertAfterEl == null) { + el.prepend(styleEl); + } else { + el.insertBefore(styleEl, insertAfterEl.nextSibling); + } + return styleEl; + }; + let styleElement; + if (this.styleContainer) { + styleElement = addStyleElement(this.styleContainer); + } else if (this.initiallyConnected === false) { + styleElement = this.addChild("styles", id); + } else if (this.documentRoot == null && !_DOMManager.headStyles.has(id)) { + styleElement = addStyleElement(getDocument("head")); + _DOMManager.headStyles.add(id); + } else if (this.documentRoot != null) { + styleElement = this.addChild("styles", id); + } + if (styleElement == null || checkId(styleElement)) + return; + styleElement.setAttribute(dataAttribute, id); + styleElement.innerHTML = styles; + } + removeStyles(id) { + this.removeChild("styles", id); + } + updateCursor(callerId, style2) { + this.cursorState.set(callerId, style2); + this.element.style.cursor = this.cursorState.stateValue(); + } + getCursor() { + return this.element.style.cursor; + } + addChild(domElementClass, id, child, insert) { + const { element: element2, children, listeners } = this.rootElements[domElementClass]; + if (!children) { + throw new Error("AG Charts - unable to create DOM elements after destroy()"); + } + if (children.has(id)) { + return children.get(id); + } + const { childElementType = "div" } = domElementConfig.get(domElementClass) ?? {}; + if (child && child.tagName.toLowerCase() !== childElementType.toLowerCase()) { + throw new Error("AG Charts - mismatching DOM element type"); + } + const newChild = child ?? createElement(childElementType); + for (const [type, fn, opts] of listeners) { + newChild.addEventListener(type, fn, opts); + } + children.set(id, newChild); + if (childElementType === "style" && this.chart.styleNonce != null) { + newChild.nonce = this.chart.styleNonce; + } + if (insert) { + const queryResult = element2.querySelector(insert.query); + if (queryResult == null) { + throw new Error(`AG Charts - addChild query failed ${insert.query}`); + } + queryResult.insertAdjacentElement(insert.where, newChild); + } else { + element2?.appendChild(newChild); + } + return newChild; + } + removeChild(domElementClass, id) { + const { children } = this.rootElements[domElementClass]; + if (!children) + return; + children.get(id)?.remove(); + children.delete(id); + } + incrementDataCounter(name) { + const { dataset } = this.element; + dataset[name] ?? (dataset[name] = "0"); + dataset[name] = String(Number(dataset[name]) + 1); + } + setDataBoolean(name, value) { + this.element.dataset[name] = String(value); + } + setDataNumber(name, value) { + this.element.dataset[name] = String(value); + } + updateContainerClassName() { + const { element: element2, containerSize, minWidth, minHeight } = this; + element2.classList.toggle(CONTAINER_MODIFIERS.safeHorizontal, minWidth >= (containerSize?.width ?? Infinity)); + element2.classList.toggle(CONTAINER_MODIFIERS.safeVertical, minHeight >= (containerSize?.height ?? Infinity)); + } +}; +_DOMManager.batchedUpdateContainer = []; +_DOMManager.headStyles = /* @__PURE__ */ new Set(); +var DOMManager = _DOMManager; + +// packages/ag-charts-community/src/widget/boundedTextWidget.ts +var BoundedTextWidget = class extends Widget { + constructor() { + super(createElement("div")); + this.textElement = createSvgElement("text"); + this.textElement.role = "presentation"; + this.svgElement = createSvgElement("svg"); + this.svgElement.appendChild(this.textElement); + this.svgElement.style.width = "100%"; + this.svgElement.style.opacity = "0"; + this.svgElement.role = "presentation"; + this.elem.appendChild(this.svgElement); + this.elem.role = "presentation"; + } + set textContent(text2) { + this.textElement.textContent = text2; + const bboxCalculator = this.textElement; + const bbox = bboxCalculator.getBBox?.(); + if (bbox) { + this.svgElement.setAttribute("viewBox", `${bbox.x} ${bbox.y} ${bbox.width} ${bbox.height}`); + } + } + get textContent() { + return this.textElement.textContent; + } + destructor() { + } +}; + +// packages/ag-charts-community/src/widget/expansionControllerImpl.ts +var ExpansionControllerImpl = class { + constructor(controller, getDispatcher) { + this.getDispatcher = getDispatcher; + this.onExpanded = () => { + this.controller.setAriaExpanded(true); + const dispatcher = this.getDispatcher(); + if (dispatcher && this.controls) { + const event = { + type: "expand-controlled-widget", + controlled: this.controls + }; + dispatcher.dispatch("expand-controlled-widget", this.controller, event); + } + }; + this.onCollapsed = (e) => { + this.controller.setAriaExpanded(false); + if (e.mode === "0" /* CLOSE */) { + this.controller.focus(); + } + }; + controller.setAriaExpanded(false); + this.controller = controller; + } + destroy() { + this.controls?.collapse({ mode: "2" /* DESTROY */ }); + this.setControlled(void 0); + } + setControlled(controls) { + if (this.controls) { + this.controls.removeListener("expand-widget", this.onExpanded); + this.controls.removeListener("collapse-widget", this.onCollapsed); + } + this.controls = controls; + if (this.controls) { + this.controller.setAriaControls(this.controls.id); + this.controls.addListener("expand-widget", this.onExpanded); + this.controls.addListener("collapse-widget", this.onCollapsed); + } + } + getControlled() { + return this.controls; + } + expandControlled(opts) { + if (!this.controller.isDisabled()) { + this.controls?.expand({ + controller: this.controller, + sourceEvent: void 0, + overrideFocusVisible: opts?.overrideFocusVisible + }); + } + } +}; + +// packages/ag-charts-community/src/widget/abstractButtonWidget.ts +var AbstractButtonWidget = class extends Widget { + constructor(element2, role) { + super(element2); + setAttribute(this.elem, "role", role); + this.setEnabled(true); + this.addListener("keydown", ({ sourceEvent }) => { + if (isButtonClickEvent(sourceEvent)) { + sourceEvent.preventDefault(); + this.htmlListener?.dispatch("click", this, { type: "click", device: "keyboard", sourceEvent }); + } + }); + } + lazyControllerImpl() { + this.controllerImpl ?? (this.controllerImpl = new ExpansionControllerImpl(this, () => this.internalListener)); + return this.controllerImpl; + } + destructor() { + this.controllerImpl?.destroy(); + } + setEnabled(enabled) { + setAttribute(this.elem, "aria-disabled", !enabled); + } + setControlled(controls) { + return this.lazyControllerImpl().setControlled(controls); + } + getControlled() { + return this.lazyControllerImpl().getControlled(); + } + expandControlled(opts) { + return this.lazyControllerImpl().expandControlled(opts); + } + addListener(type, listener) { + return super.addListener(type, (ev, current) => { + if ((type === "click" || type === "dblclick") && this.isDisabled()) + return; + listener(ev, current); + }); + } +}; + +// packages/ag-charts-community/src/widget/buttonWidget.ts +var ButtonWidget = class extends AbstractButtonWidget { + constructor() { + super(createElement("button")); + } +}; + +// packages/ag-charts-community/src/widget/groupWidget.ts +var GroupWidget = class extends Widget { + constructor() { + super(createElement("div")); + setAttribute(this.elem, "role", "group"); + } + destructor() { + } +}; + +// packages/ag-charts-community/src/widget/rovingTabContainerWidget.ts +var RovingTabContainerWidget = class extends Widget { + constructor(initialOrientation, role) { + super(createElement("div")); + this.focusedChildIndex = 0; + this.onChildFocus = (_event, child) => { + const oldFocus = this.children[this.focusedChildIndex]; + this.focusedChildIndex = child.index; + oldFocus?.setTabIndex(-1); + child.setTabIndex(0); + }; + this.onChildKeyDown = (event, child) => { + const rovingOrientation = this.orientation; + const [primaryKeys, secondaryKeys] = rovingOrientation === "both" ? [PREV_NEXT_KEYS["horizontal"], PREV_NEXT_KEYS["vertical"]] : [PREV_NEXT_KEYS[rovingOrientation], void 0]; + let targetIndex = -1; + if (hasNoModifiers(event.sourceEvent)) { + const key = event.sourceEvent.key; + if (key === primaryKeys.nextKey || key === secondaryKeys?.nextKey) { + targetIndex = child.index + 1; + } else if (key === primaryKeys.prevKey || key === secondaryKeys?.prevKey) { + targetIndex = child.index - 1; + } + } + this.children[targetIndex]?.focus(); + }; + setAttribute(this.elem, "role", role); + this.orientation = initialOrientation; + } + get orientation() { + return getAttribute(this.elem, "aria-orientation") ?? "both"; + } + set orientation(orientation) { + setAttribute(this.elem, "aria-orientation", orientation === "both" ? void 0 : orientation); + } + focus() { + this.children[this.focusedChildIndex]?.focus(); + } + clear() { + this.focusedChildIndex = 0; + for (const child of this.children) { + this.removeChildListeners(child); + child.parent = void 0; + } + this.elem.textContent = ""; + this.children.length = 0; + } + addChildListeners(child) { + child.addListener("focus", this.onChildFocus); + child.addListener("keydown", this.onChildKeyDown); + } + removeChildListeners(child) { + child.removeListener("focus", this.onChildFocus); + child.removeListener("keydown", this.onChildKeyDown); + } + onChildAdded(child) { + this.addChildListeners(child); + child.setTabIndex(this.children.length === 1 ? 0 : -1); + } + onChildRemoved(removedChild) { + this.removeChildListeners(removedChild); + const { focusedChildIndex, children } = this; + const removedFocusedChild = focusedChildIndex === removedChild.index; + for (let i = 0; i < children.length; i++) { + const child = children[i]; + if (child.index === focusedChildIndex) { + this.focusedChildIndex = i; + } + child.index = i; + } + if (removedFocusedChild) { + const newFocusChild = children[focusedChildIndex] ?? children[focusedChildIndex - 1]; + if (newFocusChild) { + this.focusedChildIndex = newFocusChild.index; + newFocusChild.setTabIndex(0); + } else { + this.focusedChildIndex = 0; + } + } + } +}; + +// packages/ag-charts-community/src/widget/listWidget.ts +var ListWidget = class extends RovingTabContainerWidget { + constructor() { + super("both", "list"); + this.setHidden(true); + } + destructor() { + for (const c of this.children) { + c.getElement().parentElement.remove(); + } + } + addChildToDOM(child, before) { + const listItem = createElement("div"); + setAttribute(listItem, "role", "listitem"); + setElementStyle(listItem, "position", "absolute"); + Widget.setElementContainer(child, listItem); + this.appendOrInsert(listItem, before); + this.setHidden(false); + } + removeChildFromDOM(child) { + child.getElement().parentElement.remove(); + this.setHidden(this.children.length === 0); + } + setHidden(hidden) { + if (this.children.length === 0) { + hidden = true; + } + super.setHidden(hidden); + } +}; + +// packages/ag-charts-community/src/widget/nativeWidget.ts +var NativeWidget = class extends Widget { + constructor(elem) { + super(elem); + } + destructor() { + } +}; + +// packages/ag-charts-community/src/util/format.util.ts +var percentFormatter = new Intl.NumberFormat("en-US", { style: "percent" }); +function formatValue(value, maximumFractionDigits = 2) { + if (typeof value === "number") { + return formatNumber(value, maximumFractionDigits); + } + return typeof value === "string" ? value : String(value ?? ""); +} +function formatPercent(value) { + return percentFormatter.format(value); +} +var numberFormatters = (/* @__PURE__ */ new Map()).set( + 2, + new Intl.NumberFormat("en-US", { maximumFractionDigits: 2, useGrouping: false }) +); +function formatNumber(value, maximumFractionDigits) { + let formatter2 = numberFormatters.get(maximumFractionDigits); + if (!formatter2) { + formatter2 = new Intl.NumberFormat("en-US", { maximumFractionDigits, useGrouping: false }); + numberFormatters.set(maximumFractionDigits, formatter2); + } + return formatter2.format(value); +} + +// packages/ag-charts-community/src/widget/sliderWidget.ts +var _SliderWidget = class _SliderWidget extends Widget { + constructor() { + super(createElement("input")); + this._step = _SliderWidget.STEP_ONE; + this.orientation = "both"; + } + get step() { + return this._step; + } + set step(step) { + this._step = step; + this.getElement().step = step.attributeValue; + } + get keyboardStep() { + return this._keyboardStep?.step ?? this._step; + } + set keyboardStep(step) { + if (step === this._keyboardStep?.step) + return; + if (this._keyboardStep !== void 0) { + this.removeListener("keydown", this._keyboardStep.onKeyDown); + this.removeListener("keyup", this._keyboardStep.onKeyUp); + this.removeListener("blur", this._keyboardStep.onBlur); + this._keyboardStep = void 0; + } + if (step !== void 0) { + const onKeyDown = () => this.getElement().step = step.attributeValue; + const resetStep = () => this.getElement().step = this._step.attributeValue; + this._keyboardStep = { step, onKeyDown, onKeyUp: resetStep, onBlur: resetStep }; + this.addListener("keydown", this._keyboardStep.onKeyDown); + this.addListener("keyup", this._keyboardStep.onKeyUp); + this.addListener("blur", this._keyboardStep.onBlur); + } + } + get orientation() { + return getAttribute(this.elem, "aria-orientation") ?? "both"; + } + set orientation(orientation) { + setAttribute(this.elem, "aria-orientation", orientation === "both" ? void 0 : orientation); + _SliderWidget.registerDefaultPreventers(this, orientation); + } + destructor() { + } + clampValueRatio(clampMin, clampMax) { + const ratio2 = this.getValueRatio(); + const clampedRatio = clamp(clampMin, ratio2, clampMax); + if (clampedRatio !== ratio2) { + this.setValueRatio(clampedRatio); + } + return clampedRatio; + } + setValueRatio(ratio2, opts) { + const { divider } = this.step; + const value = Math.round(ratio2 * 1e4) / divider; + const { ariaValueText = formatPercent(value / divider) } = opts ?? {}; + const elem = this.getElement(); + elem.value = `${value}`; + elem.ariaValueText = ariaValueText; + } + getValueRatio() { + return this.getElement().valueAsNumber / this.step.divider; + } + static registerDefaultPreventers(target, orientation) { + if (orientation === "both") { + target.removeListener("keydown", _SliderWidget.onKeyDown); + } else { + target.addListener("keydown", _SliderWidget.onKeyDown); + } + } + static onKeyDown(ev, current) { + let ignoredKeys = []; + const { orientation } = current; + if (orientation === "horizontal") { + ignoredKeys = ["ArrowUp", "ArrowDown"]; + } else if (orientation === "vertical") { + ignoredKeys = ["ArrowLeft", "ArrowRight"]; + } + if (ignoredKeys.includes(ev.sourceEvent.code)) { + ev.sourceEvent.preventDefault(); + } + } +}; +_SliderWidget.STEP_ONE = { attributeValue: "1", divider: 1 }; +_SliderWidget.STEP_HUNDRETH = { attributeValue: "0.01", divider: 100 }; +var SliderWidget = _SliderWidget; + +// packages/ag-charts-community/src/widget/switchWidget.ts +var SwitchWidget = class extends ButtonWidget { + constructor() { + super(); + setAttribute(this.elem, "role", "switch"); + this.setChecked(false); + } + setChecked(checked) { + setAttribute(this.elem, "aria-checked", checked); + } +}; + +// packages/ag-charts-community/src/widget/toolbarWidget.ts +var ToolbarWidget = class extends RovingTabContainerWidget { + constructor(orientation = "horizontal") { + super(orientation, "toolbar"); + } + destructor() { + } +}; + +// packages/ag-charts-community/src/dom/proxyInteractionService.ts +function checkType(type, meta) { + return meta.params?.type === type; +} +function allocateResult(type) { + if ("button" === type) { + return new ButtonWidget(); + } else if ("slider" === type) { + return new SliderWidget(); + } else if ("toolbar" === type) { + return new ToolbarWidget(); + } else if ("group" === type) { + return new GroupWidget(); + } else if ("list" === type) { + return new ListWidget(); + } else if ("region" === type) { + return new NativeWidget(createElement("div")); + } else if ("text" === type) { + return new BoundedTextWidget(); + } else if ("listswitch" === type) { + return new SwitchWidget(); + } else { + throw new Error("AG Charts - error allocating meta"); + } +} +function allocateMeta(params) { + const meta = { params, result: void 0 }; + meta.result = allocateResult(meta.params.type); + return meta; +} +var ProxyInteractionService = class { + constructor(eventsHub, localeManager, domManager) { + this.eventsHub = eventsHub; + this.localeManager = localeManager; + this.domManager = domManager; + this.cleanup = new CleanupRegistry(); + } + destroy() { + this.cleanup.flush(); + } + addLocalisation(fn) { + fn(); + this.cleanup.register(this.eventsHub.on("locale:change", fn)); + } + createProxyContainer(args) { + const meta = allocateMeta(args); + const { params, result } = meta; + const div = result.getElement(); + this.domManager.addChild("canvas-proxy", params.domManagerId, div); + div.classList.add(...params.classList, "ag-charts-proxy-container"); + div.role = params.type; + if (checkType("toolbar", meta)) { + meta.result.orientation = meta.params.orientation; + } + this.addLocalisation(() => { + div.ariaLabel = this.localeManager.t(params.ariaLabel.id, params.ariaLabel.params); + }); + return result; + } + createProxyElement(args) { + const meta = allocateMeta(args); + if (checkType("button", meta)) { + const { params, result } = meta; + const button = result.getElement(); + this.initInteract(params, result); + if (typeof params.textContent === "string") { + button.textContent = params.textContent; + } else { + const { textContent } = params; + this.addLocalisation(() => { + button.textContent = this.localeManager.t(textContent.id, textContent.params); + }); + } + this.setParent(meta.params, meta.result); + } + if (checkType("slider", meta)) { + const { params, result } = meta; + const slider = result.getElement(); + this.initInteract(params, result); + slider.type = "range"; + slider.role = "presentation"; + slider.style.margin = "0px"; + this.addLocalisation(() => { + slider.ariaLabel = this.localeManager.t(params.ariaLabel.id, params.ariaLabel.params); + }); + this.setParent(meta.params, meta.result); + } + if (checkType("text", meta)) { + const { params, result } = meta; + this.initElement(params, result); + this.setParent(meta.params, meta.result); + } + if (checkType("listswitch", meta)) { + const { params, result: button } = meta; + this.initInteract(params, button); + button.setTextContent(params.textContent); + button.setChecked(params.ariaChecked); + button.setAriaDescribedBy(params.ariaDescribedBy); + this.setParent(meta.params, meta.result); + } + if (checkType("region", meta)) { + const { params, result } = meta; + const region = result.getElement(); + this.initInteract(params, result); + region.role = "region"; + this.setParent(meta.params, meta.result); + } + return meta.result; + } + initElement(params, widget) { + const element2 = widget.getElement(); + setElementStyle(element2, "cursor", params.cursor); + element2.classList.toggle("ag-charts-proxy-elem", true); + return element2; + } + initInteract(params, widget) { + const { tabIndex, domIndex } = params; + const element2 = this.initElement(params, widget); + if (tabIndex !== void 0) { + element2.tabIndex = tabIndex; + } + if (domIndex !== void 0) { + widget.domIndex = domIndex; + } + } + setParent(params, element2) { + if ("parent" in params) { + params.parent?.addChild(element2); + } else { + const insert = { where: params.where, query: ".ag-charts-series-area" }; + this.domManager.addChild("canvas-proxy", params.domManagerId, element2.getElement(), insert); + element2.destroyListener = () => { + this.domManager.removeChild("canvas-proxy", params.domManagerId); + }; + } + } +}; + +// packages/ag-charts-locale/src/en-US.ts +var AG_CHARTS_LOCALE_EN_US = { + // Initial screen reader alt-text of the series area + ariaInitSeriesArea: "interactive chart", + // Screen reader announcement when focusing an item in the chart + ariaAnnounceHoverDatum: "${datum}", + // Screen reader announcement when focusing a chart + ariaAnnounceChart: "chart, ${seriesCount}[number] series", + // Screen reader announcement when focusing a standalone chart (gauges, pyramid) + ariaAnnounceStandaloneChart: "chart, ${caption}", + // Screen reader announcement when focusing a hierarchy chart + ariaAnnounceHierarchyChart: "hierarchy chart, ${caption}", + // Screen reader announcement when focusing a gauge chart + ariaAnnounceGaugeChart: "gauge chart, ${caption}", + // Screen reader announcement when focusing an item in a treemap or sunburst chart + ariaAnnounceHierarchyDatum: "level ${level}[number], ${count}[number] children, ${description}", + // Screen reader announcement when focusing a link in a Sankey or chord chart + ariaAnnounceFlowProportionLink: "link ${index} of ${count}, from ${from} to ${to}, ${sizeName} ${size}", + // Screen reader announcement when focusing a node in a Sankey or chord chart + ariaAnnounceFlowProportionNode: "node ${index} of ${count}, ${description}", + // Screen reader description for legend items + ariaDescriptionLegendItem: "Press Space or Enter to toggle visibility", + // Screen reader for the '+' horizontal line button on the Y-axis + ariaLabelAddHorizontalLine: "Add Horizontal Line", + // Screen reader text for annotations toolbar + ariaLabelAnnotationsToolbar: "Annotations", + // Screen reader text for annotation-options toolbar + ariaLabelAnnotationOptionsToolbar: "Annotation Options", + // Screen reader text for annotation-settings dialog + ariaLabelAnnotationSettingsDialog: "Annotation Settings", + // Screen reader text for the color-code label in the picker dialog + ariaLabelColor: "Color", + // Screen reader text for the color picker dialog + ariaLabelColorPicker: "Color picker", + // Screen reader text for the alpha-channel slider label + ariaLabelColorPickerAlpha: "Transparency", + // Screen reader text for the hue slider label + ariaLabelColorPickerHue: "Hue", + // Screen reader text for when the color-code is multi-colored + ariaLabelColorPickerMultiColor: "Multi Color", + // Screen reader text for the 2D palette slider label + ariaLabelColorPickerPalette: "Palette", + // Screen reader text for the financial charts toolbar + ariaLabelFinancialCharts: "Financial Charts", + // Screen reader text label for the gauge targets + ariaLabelGaugeTarget: "Target", + // Screen reader text label for the gauge values + ariaLabelGaugeValue: "Value", + // Screen reader text for the legend toolbar + ariaLabelLegend: "Legend", + // Screen reader text for the legend pagination button + ariaLabelLegendPagination: "Legend Pagination", + // Screen reader text for the previous legend page button + ariaLabelLegendPagePrevious: "Previous Legend Page", + // Screen reader text for the next legend page button + ariaLabelLegendPageNext: "Next Legend Page", + // Screen reader text for the an item in the legend + ariaLabelLegendItem: "${label}, Legend item ${index}[number] of ${count}[number]", + // Screen reader text for the an unknown item in the legend + ariaLabelLegendItemUnknown: "Unknown legend item", + // Screen reader text for the navigator element + ariaLabelNavigator: "Navigator", + // Screen reader text for an accessibility control that changes the position of the navigator's range + ariaLabelNavigatorRange: "Range", + // Screen reader text for an accessibility control that changes the start of the navigator's range + ariaLabelNavigatorMinimum: "Minimum", + // Screen reader text for an accessibility control that changes the end of the navigator's range + ariaLabelNavigatorMaximum: "Maximum", + // Screen reader text for ranges toolbar + ariaLabelRangesToolbar: "Ranges", + // Screen reader text for the settings dialog tab-bar + ariaLabelSettingsTabBar: "Settings", + // Screen reader text for zoom toolbar + ariaLabelZoomToolbar: "Zoom", + // Aria role description for a 2D role="slider" + ariaRoleDescription2DSlider: "2D slider", + // Screen reader text for color picker's 2D slider palette + ariaValueColorPalette: "s ${s}[percent0to2dp], v ${v}[percent0to2dp]", + // Screen reader text for color picker's 2D slider palette (when arrowing up or down) + ariaValueColorPaletteFirstV: "v ${v}[percent0to2dp], s ${s}[percent0to2dp]", + // Screen reader text for the value of the navigator's range + ariaValuePanRange: "${min}[percent0to2dp] to ${max}[percent0to2dp]", + // Alt-text for the solid line dash style menu item icon + iconAltTextLineStyleSolid: "Solid", + // Alt-text for the long-dashed line dash style menu item icon + iconAltTextLineStyleDashed: "Long-dashed", + // Alt-text for the short-dashed line dash style menu item icon + iconAltTextLineStyleDotted: "Short-dashed", + // Alt-text for the 'position-top' icon + iconAltTextPositionTop: "Top", + // Alt-text for the 'position-center' icon + iconAltTextPositionCenter: "Center", + // Alt-text for the 'position-bottom' icon + iconAltTextPositionBottom: "Bottom", + // Alt-text for the 'position-left' icon + iconAltTextAlignLeft: "Left", + // Alt-text for the 'align-center' icon + iconAltTextAlignCenter: "Center", + // Alt-text for the 'position-right' icon + iconAltTextAlignRight: "Right", + // Alt-text for the 'close' icon + iconAltTextClose: "Close", + // Default text for the 'loading data' overlay + overlayLoadingData: "Loading data...", + // Default text for the 'no data' overlay + overlayNoData: "No data to display", + // Default text for the 'no visible series' overlay + overlayNoVisibleSeries: "No visible series", + // Default text for the 'unsupported browser' overlay + overlayUnsupportedBrowser: "Incompatible browser version. Please upgrade your browser.", + // Text for frequency label in Histogram Series tooltip + seriesHistogramTooltipFrequency: "Frequency", + // Text for sum label in Histogram Series tooltip + seriesHistogramTooltipSum: "${yName} (sum)", + // Text for sum label in Histogram Series tooltip + seriesHistogramTooltipCount: "${yName} (count)", + // Text for sum label in Histogram Series tooltip + seriesHistogramTooltipMean: "${yName} (mean)", + // Text for the series type toolbar's chart type button + toolbarSeriesTypeDropdown: "Chart Type", + // Text for the series type toolbar's OHLC chart type button + toolbarSeriesTypeOHLC: "OHLC", + // Text for the series type toolbar's HLC chart type button + toolbarSeriesTypeHLC: "HLC", + // Text for the series type toolbar's high low chart type button + toolbarSeriesTypeHighLow: "High Low", + // Text for the series type toolbar's candles chart type button + toolbarSeriesTypeCandles: "Candles", + // Text for the series type toolbar's hollow candles chart type button + toolbarSeriesTypeHollowCandles: "Hollow Candles", + // Text for the series type toolbar's line chart type button + toolbarSeriesTypeLine: "Line", + // Text for the series type toolbar's line with markers chart type button + toolbarSeriesTypeLineWithMarkers: "Line with Markers", + // Text for the series type toolbar's line with step line chart type button + toolbarSeriesTypeStepLine: "Step Line", + // Text for the annotation toolbar's trend line button + toolbarAnnotationsTrendLine: "Trend Line", + // Text for the annotation toolbar's Fibonacci Retracement button + toolbarAnnotationsFibonacciRetracement: "Fib Retracement", + // Text for the annotation toolbar's Fibonacci Retracement Trend Based button + toolbarAnnotationsFibonacciRetracementTrendBased: "Fib Trend Based", + // Text for the annotation toolbar's horizontal line button + toolbarAnnotationsHorizontalLine: "Horizontal Line", + // Text for the annotation toolbar's vertical line button + toolbarAnnotationsVerticalLine: "Vertical Line", + // Text for the annotation toolbar's parallel channel button + toolbarAnnotationsParallelChannel: "Parallel Channel", + // Text for the annotation toolbar's disjoint channel button + toolbarAnnotationsDisjointChannel: "Disjoint Channel", + // Text for the annotation toolbar's clear all button + toolbarAnnotationsClearAll: "Clear All", + // Text for the annotation toolbar's fill color picker annotation button + toolbarAnnotationsFillColor: "Fill Color", + // Text for the annotation toolbar's line color picker annotation button + toolbarAnnotationsLineColor: "Line Color", + // Text for the annotation toolbar's line style type button + toolbarAnnotationsLineStyle: "Line Style", + // Text for the annotation toolbar's line stroke width button + toolbarAnnotationsLineStrokeWidth: "Line Stroke Width", + // Text for the annotation toolbar's settings annotation button + toolbarAnnotationsSettings: "Settings", + // Text for the annotation toolbar's text color picker annotation button + toolbarAnnotationsTextColor: "Text Color", + // Text for the annotation toolbar's text size picker annotation button + toolbarAnnotationsTextSize: "Text Size", + // Text for the annotation toolbar's lock annotation button + toolbarAnnotationsLock: "Lock", + // Text for the annotation toolbar's unlock annotation button + toolbarAnnotationsUnlock: "Unlock", + // Text for the annotation toolbar's delete annotation button + toolbarAnnotationsDelete: "Delete", + // Text for the annotation toolbar's drag handle + toolbarAnnotationsDragHandle: "Drag Toolbar", + // Text for the annotation toolbar's line drawings menu button + toolbarAnnotationsLineAnnotations: "Trend Lines", + // Text for the annotation toolbar's Fibonacci drawings menu button + toolbarAnnotationsFibonacciAnnotations: "Fibonacci", + // Text for the annotation toolbar's text annotations menu button + toolbarAnnotationsTextAnnotations: "Text Annotations", + // Text for the annotation toolbar's shapes menu button + toolbarAnnotationsShapeAnnotations: "Arrows", + // Text for the annotation toolbar's measurers menu button + toolbarAnnotationsMeasurerAnnotations: "Measurers", + // Text for the annotation toolbar's callout button + toolbarAnnotationsCallout: "Callout", + // Text for the annotation toolbar's comment button + toolbarAnnotationsComment: "Comment", + // Text for the annotation toolbar's note button + toolbarAnnotationsNote: "Note", + // Text for the annotation toolbar's text button + toolbarAnnotationsText: "Text", + // Text for the annotation toolbar's arrow button + toolbarAnnotationsArrow: "Arrow", + // Text for the annotation toolbar's arrow up button + toolbarAnnotationsArrowUp: "Arrow Up", + // Text for the annotation toolbar's arrow down button + toolbarAnnotationsArrowDown: "Arrow Down", + // Text for the annotation toolbar's date range button + toolbarAnnotationsDateRange: "Date Range", + // Text for the annotation toolbar's price range button + toolbarAnnotationsPriceRange: "Price Range", + // Text for the annotation toolbar's date and price range button + toolbarAnnotationsDatePriceRange: "Date and Price", + // Text for the annotation toolbar's quick date and price range button + toolbarAnnotationsQuickDatePriceRange: "Measure", + // Text for the range toolbar's 1 month button + toolbarRange1Month: "1M", + // Aria label for the range toolbar's 1 month button + toolbarRange1MonthAria: "1 month", + // Text for the range toolbar's 3 month button + toolbarRange3Months: "3M", + // Aria label for the range toolbar's 3 month button + toolbarRange3MonthsAria: "3 months", + // Text for the range toolbar's 6 month button + toolbarRange6Months: "6M", + // Aria label for the range toolbar's 6 month button + toolbarRange6MonthsAria: "6 months", + // Text for the range toolbar's year to date button + toolbarRangeYearToDate: "YTD", + // Aria label for the range toolbar's year to date month button + toolbarRangeYearToDateAria: "Year to date", + // Text for the range toolbar's 1 year button + toolbarRange1Year: "1Y", + // Aria label for the range toolbar's 1 year button + toolbarRange1YearAria: "1 year", + // Text for the range toolbar's full range button + toolbarRangeAll: "All", + // Aria label for the range toolbar's full range button + toolbarRangeAllAria: "All", + // Text for the zoom toolbar's zoom out button + toolbarZoomZoomOut: "Zoom out", + // Text for the zoom toolbar's zoom in button + toolbarZoomZoomIn: "Zoom in", + // Text for the zoom toolbar's pan left button + toolbarZoomPanLeft: "Pan left", + // Text for the zoom toolbar's pan right button + toolbarZoomPanRight: "Pan right", + // Text for the zoom toolbar's pan to the start button + toolbarZoomPanStart: "Pan to the start", + // Text for the zoom toolbar's pan to the end button + toolbarZoomPanEnd: "Pan to the end", + // Text for the zoom toolbar's pan reset button + toolbarZoomReset: "Reset the zoom", + // Text for the context menu's download button + contextMenuDownload: "Download", + // Text for the context menu's toggle series visibility button + contextMenuToggleSeriesVisibility: "Toggle Visibility", + // Text for the context menu's toggle other series visibility button + contextMenuToggleOtherSeries: "Toggle Other Series", + // Text for the context menu's zoom to point button + contextMenuZoomToCursor: "Zoom to here", + // Text for the context menu's pan to point button + contextMenuPanToCursor: "Pan to here", + // Text for the context menu's reset zoom button + contextMenuResetZoom: "Reset zoom", + // Text for the annotation dialog's header channel tab label + dialogHeaderChannel: "Channel", + // Text for the annotation dialog's header line tab label + dialogHeaderLine: "Line", + // Text for the annotation dialog's header fibonacci retracement line tab label + dialogHeaderFibonacciRange: "Fib Retracement", + // Text for the annotation dialog's header date range tab label + dialogHeaderDateRange: "Date Range", + // Text for the annotation dialog's header price range tab label + dialogHeaderPriceRange: "Price Range", + // Text for the annotation dialog's header date and price range tab label + dialogHeaderDatePriceRange: "Date and Price", + // Text for the annotation dialog's header text tab label + dialogHeaderText: "Text", + // Text for the annotation dialog's text alignment radio label + dialogInputAlign: "Align", + // Text for the annotation dialog's color picker label + dialogInputColorPicker: "Color", + // Text for the annotation dialog's color picker alt text + dialogInputColorPickerAltText: "Text Color", + // Text for the annotation dialog's fill color picker label + dialogInputFillColorPicker: "Fill", + // Text for the annotation dialog's fill color picker alt text + dialogInputFillColorPickerAltText: "Fill Color", + // Text for the annotation dialog's extend channel start checkbox + dialogInputExtendChannelStart: "Extend channel start", + // Text for the annotation dialog's extend channel end checkbox + dialogInputExtendChannelEnd: "Extend channel end", + // Text for the annotation dialog's extend line start checkbox + dialogInputExtendLineStart: "Extend line start", + // Text for the annotation dialog's extend line end checkbox + dialogInputExtendLineEnd: "Extend line end", + // Text for the annotation dialog's extend above checkbox + dialogInputExtendAbove: "Extend above", + // Text for the annotation dialog's extend below checkbox + dialogInputExtendBelow: "Extend below", + // Text for the annotation dialog's extend left checkbox + dialogInputExtendLeft: "Extend left", + // Text for the annotation dialog's extend right checkbox + dialogInputExtendRight: "Extend right", + // Text for the annotation dialog's reverse checkbox + dialogInputReverse: "Reverse", + // Text for the annotation dialog's show fill checkbox + dialogInputShowFill: "Show Fill", + // Text for the annotation dialog's font size select box label + dialogInputFontSize: "Size", + // Text for the annotation dialog's font size select box alt text + dialogInputFontSizeAltText: "Font Size", + // Text for the annotation dialog's line style radio label + dialogInputLineStyle: "Dash", + // Text for the annotation dialog's text position radio label + dialogInputPosition: "Position", + // Text for the annotation dialog's stroke width label + dialogInputStrokeWidth: "Weight", + // Text for the annotation dialog's stroke width label + dialogInputStrokeWidthAltText: "Line Weight", + // Text for the annotation dialog's Fibonacci bands label + dialogInputFibonacciBands: "Bands", + // Text for the annotation dialog's Fibonacci bands label + dialogInputFibonacciBandsAltText: "Fibonacci Bands", + // Text for text area input placeholders + inputTextareaPlaceholder: "Add Text", + // Text for the measurer statistics date range bars value + measurerDateRangeBars: "${value}[number] bars", + // Text for the measurer statistics price range value + measurerPriceRangeValue: "${value}[number]", + // Text for the measurer statistics price range percentage + measurerPriceRangePercent: "${value}[percent]", + // Text for the measurer statistics volume value + measurerVolume: "Vol ${value}", + // Status when multiple data are under the cursor, and the user can click to cycle through which one appears in the tooltip + tooltipPaginationStatus: "${index}[number] of ${count}[number]" +}; + +// packages/ag-charts-community/src/locale/defaultMessageFormatter.ts +var messageRegExp = /\$\{(\w+)}(?:\[(\w+)])?/gi; +var formatters = { + number: new Intl.NumberFormat("en-US"), + percent: new Intl.NumberFormat("en-US", { style: "percent", minimumFractionDigits: 2, maximumFractionDigits: 2 }), + percent0to2dp: new Intl.NumberFormat("en-US", { + style: "percent", + minimumFractionDigits: 0, + maximumFractionDigits: 2 + }), + date: new Intl.DateTimeFormat("en-US", { dateStyle: "full" }), + time: new Intl.DateTimeFormat("en-US", { timeStyle: "full" }), + datetime: new Intl.DateTimeFormat("en-US", { dateStyle: "full", timeStyle: "full" }) +}; +var defaultMessageFormatter = ({ defaultValue, variables }) => { + return defaultValue?.replaceAll(messageRegExp, (_, match, format) => { + const value = variables[match]; + const formatter2 = format == null ? null : formatters[format]; + if (format != null && formatter2 == null) { + logger_exports.warnOnce(`Format style [${format}] is not supported`); + } + if (formatter2 != null) { + return formatter2.format(value); + } else if (typeof value === "number") { + return formatters.number.format(value); + } else if (value instanceof Date) { + return formatters.datetime.format(value); + } + return String(value); + }); +}; + +// packages/ag-charts-community/src/locale/localeManager.ts +var LocaleManager = class { + constructor(eventsHub) { + this.eventsHub = eventsHub; + this.localeText = void 0; + this.getLocaleText = void 0; + } + setLocaleText(localeText) { + if (this.localeText !== localeText) { + this.localeText = localeText; + this.eventsHub.emit("locale:change", null); + } + } + setLocaleTextFormatter(getLocaleText) { + this.getLocaleText = getLocaleText; + if (this.getLocaleText !== getLocaleText) { + this.getLocaleText = getLocaleText; + this.eventsHub.emit("locale:change", null); + } + } + t(key, variables = {}) { + const { localeText = AG_CHARTS_LOCALE_EN_US, getLocaleText } = this; + const defaultValue = localeText[key]; + return getLocaleText?.({ key, defaultValue, variables }) ?? defaultMessageFormatter({ key, defaultValue, variables }) ?? key; + } +}; + +// packages/ag-charts-community/src/scene/canvas/hdpiCanvas.ts +var HdpiCanvas = class { + constructor(options) { + this.enabled = true; + this.width = 600; + this.height = 300; + const { width: width2, height: height2, canvasElement, willReadFrequently = false } = options; + this.pixelRatio = options.pixelRatio ?? getWindow("devicePixelRatio") ?? 1; + this.element = canvasElement ?? createElement("canvas"); + this.element.style.display = "block"; + this.element.style.width = (width2 ?? this.width) + "px"; + this.element.style.height = (height2 ?? this.height) + "px"; + this.element.width = Math.round((width2 ?? this.width) * this.pixelRatio); + this.element.height = Math.round((height2 ?? this.height) * this.pixelRatio); + this.context = this.element.getContext("2d", { willReadFrequently }); + this.onEnabledChange(); + this.resize(width2 ?? 0, height2 ?? 0, this.pixelRatio); + debugContext(this.context); + } + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- OffscreenCanvasRenderingContext2D is intentionally `any` for Angular 13+ compatibility (AG-6969) + drawImage(context, dx2 = 0, dy2 = 0) { + return context.drawImage(this.context.canvas, dx2, dy2); + } + toDataURL(type) { + return this.element.toDataURL(type); + } + resize(width2, height2, pixelRatio) { + if (!(width2 > 0 && height2 > 0)) + return; + const { element: element2, context } = this; + element2.width = Math.round(width2 * pixelRatio); + element2.height = Math.round(height2 * pixelRatio); + context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); + element2.style.width = width2 + "px"; + element2.style.height = height2 + "px"; + this.width = width2; + this.height = height2; + this.pixelRatio = pixelRatio; + } + clear() { + clearContext(this); + } + destroy() { + this.element.remove(); + this.element.width = 0; + this.element.height = 0; + this.context.clearRect(0, 0, 0, 0); + Object.freeze(this); + } + reset() { + this.context.reset(); + this.context.verifyDepthZero?.(); + } + onEnabledChange() { + if (this.element) { + this.element.style.display = this.enabled ? "" : "none"; + } + } +}; +__decorateClass([ + ObserveChanges((target) => target.onEnabledChange()) +], HdpiCanvas.prototype, "enabled", 2); + +// packages/ag-charts-community/src/scene/image/imageLoader.ts +var ImageLoader = class extends EventEmitter { + constructor() { + super(...arguments); + this.cache = /* @__PURE__ */ new Map(); + this.imageLoadingCount = 0; + } + loadImage(uri, affectedNode) { + const entry = this.cache.get(uri); + if (entry?.image) { + return entry.image; + } else if (entry != null && affectedNode) { + entry.nodes.add(affectedNode); + return; + } + if (!affectedNode) { + return; + } + const nextEntry = { image: void 0, nodes: /* @__PURE__ */ new Set([affectedNode]) }; + const image = new Image(); + this.imageLoadingCount++; + image.onload = () => { + nextEntry.image = image; + for (const node of nextEntry.nodes) { + node.markDirty(); + } + nextEntry.nodes.clear(); + this.imageLoadingCount--; + this.emit("image-loaded", { uri }); + }; + image.onerror = () => { + this.imageLoadingCount--; + nextEntry.nodes.clear(); + this.emit("image-error", { uri }); + }; + image.src = uri; + this.cache.set(uri, nextEntry); + return nextEntry.image; + } + waitingToLoad() { + return this.imageLoadingCount > 0; + } + destroy() { + for (const entry of this.cache.values()) { + entry.nodes.clear(); + } + this.cache.clear(); + } +}; + +// packages/ag-charts-community/src/scene/layersManager.ts +var LayersManager = class { + constructor(canvas) { + this.canvas = canvas; + this.debug = Debug.create(true, "scene"); + this.layersMap = /* @__PURE__ */ new Map(); + this.nextLayerId = 0; + } + get size() { + return this.layersMap.size; + } + resize(width2, height2, pixelRatio) { + this.canvas.resize(width2, height2, pixelRatio); + for (const { canvas } of this.layersMap.values()) { + canvas.resize(width2, height2, pixelRatio); + } + } + addLayer(opts) { + const { width: width2, height: height2, pixelRatio } = this.canvas; + const { name } = opts; + const canvas = new HdpiOffscreenCanvas({ width: width2, height: height2, pixelRatio }); + this.layersMap.set(canvas, { + id: this.nextLayerId++, + name, + canvas + }); + this.debug("Scene.addLayer() - layers", this.layersMap); + return canvas; + } + removeLayer(canvas) { + if (this.layersMap.has(canvas)) { + this.layersMap.delete(canvas); + canvas.destroy(); + this.debug("Scene.removeLayer() - layers", this.layersMap); + } + } + clear() { + for (const layer of this.layersMap.values()) { + layer.canvas.destroy(); + } + this.layersMap.clear(); + } +}; + +// packages/ag-charts-community/src/scene/scene.ts +var Scene = class extends EventEmitter { + constructor(canvasOptions) { + super(); + this.debug = Debug.create(true, "scene" /* SCENE */); + this.id = createId(this); + this.imageLoader = new ImageLoader(); + this.root = null; + this.pendingSize = null; + this.isDirty = false; + this.cleanup = new CleanupRegistry(); + this.updateDebugFlags(); + this.canvas = new HdpiCanvas(canvasOptions); + this.layersManager = new LayersManager(this.canvas); + this.cleanup.register( + this.imageLoader.on("image-loaded", () => { + this.emit("scene-changed", {}); + }), + this.imageLoader.on("image-error", ({ uri }) => { + logger_exports.warnOnce(`Unable to load image ${uri}`); + }) + ); + } + waitingForUpdate() { + return this.imageLoader?.waitingToLoad() ?? false; + } + get width() { + return this.pendingSize?.[0] ?? this.canvas.width; + } + get height() { + return this.pendingSize?.[1] ?? this.canvas.height; + } + get pixelRatio() { + return this.pendingSize?.[2] ?? this.canvas.pixelRatio; + } + /** @deprecated v10.2.0 Only used by AG Grid Sparklines */ + setContainer(value) { + const { element: element2 } = this.canvas; + element2.remove(); + value.appendChild(element2); + return this; + } + setRoot(node) { + if (this.root === node) { + return this; + } + this.isDirty = true; + this.root?.setScene(); + this.root = node; + if (node) { + node.visible = true; + node.setScene(this); + } + return this; + } + updateDebugFlags() { + Debug.inDevelopmentMode(() => Node2._debugEnabled = true); + } + clearCanvas() { + this.canvas.clear(); + } + attachNode(node) { + this.appendChild(node); + return () => node.remove(); + } + appendChild(node) { + this.root?.appendChild(node); + return this; + } + removeChild(node) { + node.remove(); + return this; + } + download(fileName, fileFormat) { + downloadUrl(this.canvas.toDataURL(fileFormat), fileName?.trim() ?? "image"); + } + /** NOTE: Integrated Charts undocumented image download method. */ + getDataURL(fileFormat) { + return this.canvas.toDataURL(fileFormat); + } + resize(width2, height2, pixelRatio) { + width2 = Math.round(width2); + height2 = Math.round(height2); + pixelRatio ?? (pixelRatio = this.pixelRatio); + if (width2 > 0 && height2 > 0 && (width2 !== this.width || height2 !== this.height || pixelRatio !== this.pixelRatio)) { + this.pendingSize = [width2, height2, pixelRatio]; + this.isDirty = true; + return true; + } + return false; + } + render(opts) { + const { debugSplitTimes = { start: performance.now() }, extraDebugStats, seriesRect } = opts ?? {}; + const { + canvas, + canvas: { context: ctx } = {}, + root, + pendingSize, + width: width2, + height: height2, + pixelRatio: devicePixelRatio + } = this; + if (!ctx) { + return; + } + const statsEnabled = Debug.check("scene:stats" /* SCENE_STATS */, "scene:stats:verbose" /* SCENE_STATS_VERBOSE */); + if (statsEnabled) { + this.ensureDebugStatsRegistration(); + } + const renderStartTime = performance.now(); + let resized = false; + if (pendingSize) { + resized = true; + this.layersManager.resize(...pendingSize); + this.pendingSize = null; + } + if (root && !root.visible) { + this.isDirty = false; + return; + } + let rootDirty; + if (root instanceof Group) { + rootDirty = root.dirty; + } + if (root != null && rootDirty === false && !this.isDirty) { + if (this.debug.check()) { + this.debug("Scene.render() - no-op", { + tree: buildTree(root, "console") + }); + } + if (statsEnabled) { + debugStats(this.layersManager, debugSplitTimes, ctx, void 0, extraDebugStats, seriesRect); + } + return; + } + const renderCtx = { + ctx, + width: width2, + height: height2, + devicePixelRatio, + debugNodes: {} + }; + if (Debug.check("scene:stats:verbose" /* SCENE_STATS_VERBOSE */)) { + renderCtx.stats = { + layersRendered: 0, + layersSkipped: 0, + nodesRendered: 0, + nodesSkipped: 0, + opsPerformed: 0, + opsSkipped: 0 + }; + } + prepareSceneNodeHighlight(renderCtx); + let canvasCleared = false; + if (rootDirty !== false || resized) { + canvasCleared = true; + canvas.clear(); + } + if (root && Debug.check("scene:dirtyTree" /* SCENE_DIRTY_TREE */)) { + const { dirtyTree, paths } = buildDirtyTree(root); + Debug.create("scene:dirtyTree" /* SCENE_DIRTY_TREE */)("Scene.render() - dirtyTree", { dirtyTree, paths }); + } + if (root && canvasCleared) { + if (root.visible) { + root.preRender(renderCtx); + } + if (this.debug.check()) { + const tree = buildTree(root, "console"); + this.debug("Scene.render() - before", { + canvasCleared, + tree + }); + } + if (root.visible) { + try { + ctx.save(); + root.render(renderCtx); + ctx.restore(); + } catch (e) { + this.canvas.reset(); + throw e; + } + } + } + debugSplitTimes["\u270D\uFE0F"] = performance.now() - renderStartTime; + ctx.verifyDepthZero?.(); + this.isDirty = false; + if (statsEnabled) { + debugStats(this.layersManager, debugSplitTimes, ctx, renderCtx.stats, extraDebugStats, seriesRect); + } + debugSceneNodeHighlight(ctx, renderCtx.debugNodes); + if (root && this.debug.check()) { + this.debug("Scene.render() - after", { + tree: buildTree(root, "console"), + canvasCleared + }); + } + } + ensureDebugStatsRegistration() { + if (this.releaseDebugStats) + return; + const release = registerDebugStatsConsumer(); + const cleanup = () => { + release(); + this.releaseDebugStats = void 0; + }; + this.releaseDebugStats = cleanup; + this.cleanup.register(cleanup); + } + toSVG() { + const { root, width: width2, height: height2 } = this; + if (root == null) + return; + return Node2.toSVG(root, width2, height2); + } + /** Alternative to destroy() that preserves re-usable resources. */ + strip() { + const { context, pixelRatio } = this.canvas; + context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); + this.layersManager.clear(); + this.setRoot(null); + this.isDirty = false; + this.clear(); + } + destroy() { + this.strip(); + this.canvas.destroy(); + this.imageLoader.destroy(); + this.cleanup.flush(); + cleanupDebugStats(); + Object.assign(this, { canvas: void 0 }); + } +}; +Scene.className = "Scene"; + +// packages/ag-charts-community/src/chart/annotation/annotationManager.ts +var AnnotationManager = class { + constructor(eventsHub, annotationRoot, fireChartEvent) { + this.eventsHub = eventsHub; + this.annotationRoot = annotationRoot; + this.fireChartEvent = fireChartEvent; + this.mementoOriginatorKey = "annotations"; + this.annotations = []; + } + createMemento() { + return this.annotations; + } + guardMemento(blob) { + return blob == null || isArray(blob); + } + restoreMemento(_version, _mementoVersion, memento) { + this.annotations = this.cleanData(memento ?? []).map((annotation) => { + const annotationTheme = this.getAnnotationTypeStyles(annotation.type); + return mergeDefaults(annotation, annotationTheme); + }); + this.eventsHub.emit("annotations:restore", { annotations: this.annotations }); + } + updateData(annotations) { + this.annotations = this.cleanData(annotations ?? []); + } + fireChangedEvent() { + this.fireChartEvent({ type: "annotations", annotations: deepClone([...this.annotations]) }); + } + attachNode(node) { + this.annotationRoot.append(node); + return () => { + node.remove(); + return this; + }; + } + setAnnotationStyles(styles) { + this.styles = styles; + } + getAnnotationTypeStyles(type) { + return this.styles?.[type]; + } + cleanData(annotations) { + for (const annotation of annotations) { + if ("textAlign" in annotation) + delete annotation.textAlign; + } + return annotations; + } +}; + +// packages/ag-charts-community/src/chart/zIndexMap.ts +var ZIndexMap = /* @__PURE__ */ ((ZIndexMap11) => { + ZIndexMap11[ZIndexMap11["CHART_BACKGROUND"] = 0] = "CHART_BACKGROUND"; + ZIndexMap11[ZIndexMap11["AXIS_BAND_HIGHLIGHT"] = 1] = "AXIS_BAND_HIGHLIGHT"; + ZIndexMap11[ZIndexMap11["AXIS_GRID"] = 2] = "AXIS_GRID"; + ZIndexMap11[ZIndexMap11["AXIS"] = 3] = "AXIS"; + ZIndexMap11[ZIndexMap11["SERIES_AREA_CONTAINER"] = 4] = "SERIES_AREA_CONTAINER"; + ZIndexMap11[ZIndexMap11["ZOOM_SELECTION"] = 5] = "ZOOM_SELECTION"; + ZIndexMap11[ZIndexMap11["SERIES_CROSSLINE_RANGE"] = 6] = "SERIES_CROSSLINE_RANGE"; + ZIndexMap11[ZIndexMap11["SERIES_LAYER"] = 7] = "SERIES_LAYER"; + ZIndexMap11[ZIndexMap11["AXIS_FOREGROUND"] = 8] = "AXIS_FOREGROUND"; + ZIndexMap11[ZIndexMap11["SERIES_CROSSHAIR"] = 9] = "SERIES_CROSSHAIR"; + ZIndexMap11[ZIndexMap11["SERIES_CROSSLINE_LINE"] = 10] = "SERIES_CROSSLINE_LINE"; + ZIndexMap11[ZIndexMap11["SERIES_ANNOTATION"] = 11] = "SERIES_ANNOTATION"; + ZIndexMap11[ZIndexMap11["CHART_ANNOTATION"] = 12] = "CHART_ANNOTATION"; + ZIndexMap11[ZIndexMap11["CHART_ANNOTATION_FOCUSED"] = 13] = "CHART_ANNOTATION_FOCUSED"; + ZIndexMap11[ZIndexMap11["STATUS_BAR"] = 14] = "STATUS_BAR"; + ZIndexMap11[ZIndexMap11["SERIES_LABEL"] = 15] = "SERIES_LABEL"; + ZIndexMap11[ZIndexMap11["LEGEND"] = 16] = "LEGEND"; + ZIndexMap11[ZIndexMap11["NAVIGATOR"] = 17] = "NAVIGATOR"; + ZIndexMap11[ZIndexMap11["FOREGROUND"] = 18] = "FOREGROUND"; + return ZIndexMap11; +})(ZIndexMap || {}); + +// packages/ag-charts-community/src/chart/axis/axisManager.ts +var AxisManager = class { + constructor(eventsHub, sceneRoot) { + this.eventsHub = eventsHub; + this.sceneRoot = sceneRoot; + this.axes = /* @__PURE__ */ new Map(); + this.axisGridGroup = new Group({ name: "Axes-Grids", zIndex: 2 /* AXIS_GRID */ }); + this.axisGroup = new Group({ name: "Axes", zIndex: 3 /* AXIS */ }); + this.axisLabelGroup = new Group({ name: "Axes-Labels", zIndex: 15 /* SERIES_LABEL */ }); + this.axisCrosslineRangeGroup = new Group({ + name: "Axes-Crosslines-Range", + zIndex: 6 /* SERIES_CROSSLINE_RANGE */ + }); + this.axisCrosslineLineGroup = new Group({ + name: "Axes-Crosslines-Line", + zIndex: 10 /* SERIES_CROSSLINE_LINE */ + }); + this.axisCrosslineLabelGroup = new Group({ + name: "Axes-Crosslines-Label", + zIndex: 15 /* SERIES_LABEL */ + }); + this.sceneRoot.appendChild(this.axisGroup); + this.sceneRoot.appendChild(this.axisGridGroup); + this.sceneRoot.appendChild(this.axisLabelGroup); + this.sceneRoot.appendChild(this.axisCrosslineRangeGroup); + this.sceneRoot.appendChild(this.axisCrosslineLineGroup); + this.sceneRoot.appendChild(this.axisCrosslineLabelGroup); + } + updateAxes(oldAxes, newAxes) { + const axisNodes = { + axisNode: this.axisGroup, + gridNode: this.axisGridGroup, + labelNode: this.axisLabelGroup, + crossLineRangeNode: this.axisCrosslineRangeGroup, + crossLineLineNode: this.axisCrosslineLineGroup, + crossLineLabelNode: this.axisCrosslineLabelGroup + }; + for (const axis of oldAxes) { + if (newAxes.includes(axis)) + continue; + axis.detachAxis(axisNodes); + axis.destroy(); + } + for (const axis of newAxes) { + if (oldAxes?.includes(axis)) + continue; + axis.attachAxis(axisNodes); + } + this.axes.clear(); + for (const axis of newAxes) { + const ctx = axis.createAxisContext(); + if (this.axes.has(ctx.direction)) { + this.axes.get(ctx.direction)?.push(ctx); + } else { + this.axes.set(ctx.direction, [ctx]); + } + } + this.eventsHub.emit("axis:change", null); + } + getAxisContext(direction) { + return this.axes.get(direction) ?? []; + } + destroy() { + this.axes.clear(); + this.axisGroup.remove(); + this.axisGridGroup.remove(); + } +}; + +// packages/ag-charts-community/src/chart/chartUpdateType.ts +var ChartUpdateType = /* @__PURE__ */ ((ChartUpdateType4) => { + ChartUpdateType4[ChartUpdateType4["FULL"] = 0] = "FULL"; + ChartUpdateType4[ChartUpdateType4["UPDATE_DATA"] = 1] = "UPDATE_DATA"; + ChartUpdateType4[ChartUpdateType4["PROCESS_DATA"] = 2] = "PROCESS_DATA"; + ChartUpdateType4[ChartUpdateType4["PROCESS_DOMAIN"] = 3] = "PROCESS_DOMAIN"; + ChartUpdateType4[ChartUpdateType4["PERFORM_LAYOUT"] = 4] = "PERFORM_LAYOUT"; + ChartUpdateType4[ChartUpdateType4["SERIES_UPDATE"] = 5] = "SERIES_UPDATE"; + ChartUpdateType4[ChartUpdateType4["PRE_SCENE_RENDER"] = 6] = "PRE_SCENE_RENDER"; + ChartUpdateType4[ChartUpdateType4["SCENE_RENDER"] = 7] = "SCENE_RENDER"; + ChartUpdateType4[ChartUpdateType4["NONE"] = 8] = "NONE"; + return ChartUpdateType4; +})(ChartUpdateType || {}); + +// packages/ag-charts-community/src/chart/data/dataService.ts +var DataService = class { + constructor(eventsHub, caller, animationManager) { + this.eventsHub = eventsHub; + this.caller = caller; + this.animationManager = animationManager; + this.dispatchOnlyLatest = true; + this.dispatchThrottle = 0; + this.requestThrottle = 300; + this.isLoadingInitialData = false; + this.isLoadingData = false; + this.freshRequests = []; + this.requestCounter = 0; + this.pendingData = void 0; + this.debug = Debug.create(true, "data-model", "data-source"); + this.throttledFetch = this.createThrottledFetch(this.requestThrottle); + this.throttledDispatch = this.createThrottledDispatch(this.dispatchThrottle); + } + updateCallback(dataSourceCallback) { + if (typeof dataSourceCallback !== "function") + return; + this.debug("DataService - updated data source callback"); + this.dataSourceCallback = dataSourceCallback; + this.isLoadingInitialData = true; + this.animationManager.skip(); + this.eventsHub.emit("data:source-change", null); + } + clearCallback() { + this.dataSourceCallback = void 0; + } + load(params) { + const { pendingData } = this; + if (pendingData != null && pendingData.params.windowStart?.valueOf() === params.windowStart?.valueOf() && pendingData.params.windowEnd?.valueOf() === params.windowEnd?.valueOf()) { + const id = this.requestCounter++; + this.isLoadingInitialData = false; + this.dispatch(id, pendingData.data); + return; + } + this.isLoadingData = true; + this.throttledFetch(params); + } + isLazy() { + return this.dataSourceCallback != null; + } + isLoading() { + return this.isLazy() && (this.isLoadingInitialData || this.isLoadingData); + } + async getData() { + const { latestRequest } = this; + if (!latestRequest) + return; + const { params, fetchRequest } = latestRequest; + const data = await fetchRequest; + return { params, data }; + } + restoreData(data) { + this.pendingData = data; + } + createThrottledFetch(requestThrottle) { + return throttle( + (params) => this.fetch(params).catch((e) => logger_exports.error("callback failed", e)), + requestThrottle, + { leading: false, trailing: true } + ); + } + createThrottledDispatch(dispatchThrottle) { + return throttle((id, data) => this.dispatch(id, data), dispatchThrottle, { + leading: true, + trailing: true + }); + } + dispatch(id, data) { + this.debug(`DataService - dispatching 'data-load' | ${id}`); + this.eventsHub.emit("data:load", { data }); + } + async fetch(params) { + if ("context" in this.caller) { + params.context = this.caller.context; + } + const fetchRequest = Promise.resolve().then(async () => { + if (!this.dataSourceCallback) { + throw new Error("DataService - [dataSource.getData] callback not initialised"); + } + const start2 = performance.now(); + const id = this.requestCounter++; + this.debug(`DataService - requesting | ${id}`); + let response; + try { + response = await this.dataSourceCallback(params); + this.debug(`DataService - response | ${performance.now() - start2}ms | ${id}`); + } catch (error2) { + this.debug(`DataService - request failed | ${id}`); + logger_exports.errorOnce(`DataService - request failed | [${error2}]`); + } + this.isLoadingInitialData = false; + const requestIndex = this.freshRequests.indexOf(fetchRequest); + if (requestIndex === -1 || this.dispatchOnlyLatest && requestIndex !== this.freshRequests.length - 1) { + this.debug(`DataService - discarding stale request | ${id}`); + return response; + } + this.freshRequests = this.freshRequests.slice(requestIndex + 1); + if (this.freshRequests.length === 0) { + this.isLoadingData = false; + } + if (Array.isArray(response)) { + this.throttledDispatch(id, response); + } else { + this.eventsHub.emit("data:error", null); + } + return response; + }); + this.latestRequest = { params, fetchRequest }; + this.freshRequests.push(fetchRequest); + await fetchRequest; + } +}; +__decorateClass([ + ActionOnSet({ + newValue(dispatchThrottle) { + this.throttledDispatch = this.createThrottledDispatch(dispatchThrottle); + } + }) +], DataService.prototype, "dispatchThrottle", 2); +__decorateClass([ + ActionOnSet({ + newValue(requestThrottle) { + this.throttledFetch = this.createThrottledFetch(requestThrottle); + } + }) +], DataService.prototype, "requestThrottle", 2); + +// packages/ag-charts-community/src/chart/fonts/fontManager.ts +var FontManager = class { + constructor(domManager, updateService) { + this.domManager = domManager; + this.updateService = updateService; + this.observers = []; + } + updateFonts(fonts) { + if (!fonts || fonts.size === 0) + return; + this.loadFonts(fonts); + for (const font3 of fonts) { + this.observeFontStatus(font3); + } + } + destroy() { + for (const observer of this.observers) { + observer.disconnect(); + } + this.observers = []; + } + loadFonts(fonts) { + const fontStrings = Array.from(fonts).map((font3) => encodeURIComponent(font3)); + const fontStyle = ":wght@100;200;300;400;500;600;700;800;900"; + const joinString = `${fontStyle}&family=`; + const css = `@import url('https://fonts.googleapis.com/css2?family=${fontStrings.join(joinString)}${fontStyle}&display=swap'); +`; + this.domManager.addStyles(`google-font-${fontStrings.join("-")}`, css); + } + observeFontStatus(font3) { + const fontCheckElement = globalThis.document.createElement("div"); + fontCheckElement.style.setProperty("position", "absolute"); + fontCheckElement.style.setProperty("top", "0"); + fontCheckElement.style.setProperty("margin", "0"); + fontCheckElement.style.setProperty("padding", "0"); + fontCheckElement.style.setProperty("overflow", "hidden"); + fontCheckElement.style.setProperty("visibility", "hidden"); + fontCheckElement.style.setProperty("width", "auto"); + fontCheckElement.style.setProperty("max-width", "none"); + fontCheckElement.style.setProperty("font-synthesis", "none"); + fontCheckElement.style.setProperty("font-family", font3); + fontCheckElement.style.setProperty("font-size", "16px"); + fontCheckElement.style.setProperty("white-space", "nowrap"); + fontCheckElement.textContent = "UVWxyz"; + this.domManager.addChild("canvas-container", `font-check-${encodeURIComponent(font3)}`, fontCheckElement); + const fontCheckObserver = new ResizeObserver((entries2) => { + const width2 = entries2?.at(0)?.contentBoxSize.at(0)?.inlineSize; + if (width2 != null && width2 > 0) { + cachedTextMeasurer.clear(); + this.updateService.update(4 /* PERFORM_LAYOUT */); + } + }); + fontCheckObserver.observe(fontCheckElement); + this.observers.push(fontCheckObserver); + } +}; + +// packages/ag-charts-types/src/chart/errorBarOptions.ts +var AgErrorBarSupportedSeriesTypes = ["bar", "line", "scatter"]; + +// packages/ag-charts-types/src/chart/navigatorOptions.ts +var __MINI_CHART_SERIES_OPTIONS = void 0; +var __VERIFY_MINI_CHART_SERIES_OPTIONS = void 0; +__VERIFY_MINI_CHART_SERIES_OPTIONS = __MINI_CHART_SERIES_OPTIONS; + +// packages/ag-charts-types/src/chart/themeOptions.ts +var __THEME_OVERRIDES = void 0; +var __VERIFY_THEME_OVERRIDES = void 0; +__VERIFY_THEME_OVERRIDES = __THEME_OVERRIDES; + +// packages/ag-charts-types/src/chart/tooltipOptions.ts +var AgTooltipAnchorToType = /* @__PURE__ */ ((AgTooltipAnchorToType2) => { + AgTooltipAnchorToType2["POINTER"] = "pointer"; + AgTooltipAnchorToType2["NODE"] = "node"; + AgTooltipAnchorToType2["CHART"] = "chart"; + return AgTooltipAnchorToType2; +})(AgTooltipAnchorToType || {}); +var AgTooltipPlacementType = /* @__PURE__ */ ((AgTooltipPlacementType2) => { + AgTooltipPlacementType2["TOP"] = "top"; + AgTooltipPlacementType2["RIGHT"] = "right"; + AgTooltipPlacementType2["BOTTOM"] = "bottom"; + AgTooltipPlacementType2["LEFT"] = "left"; + AgTooltipPlacementType2["TOP_RIGHT"] = "top-right"; + AgTooltipPlacementType2["BOTTOM_RIGHT"] = "bottom-right"; + AgTooltipPlacementType2["BOTTOM_LEFT"] = "bottom-left"; + AgTooltipPlacementType2["TOP_LEFT"] = "top-left"; + AgTooltipPlacementType2["CENTER"] = "center"; + return AgTooltipPlacementType2; +})(AgTooltipPlacementType || {}); + +// packages/ag-charts-types/src/presets/gauge/commonOptions.ts +var __THEMEABLE_OPTIONS = void 0; +var __VERIFY_THEMEABLE_OPTIONS = void 0; +__VERIFY_THEMEABLE_OPTIONS = __THEMEABLE_OPTIONS; +var __AXIS_LABEL_OPTIONS = void 0; +var __VERIFY_AXIS_LABEL_OPTIONS = void 0; +__VERIFY_AXIS_LABEL_OPTIONS = __AXIS_LABEL_OPTIONS; + +// packages/ag-charts-community/src/util/listeners.ts +var Listeners = class { + constructor() { + this.registeredListeners = /* @__PURE__ */ new Map(); + } + addListener(eventType, handler) { + const record = { symbol: Symbol(eventType), handler }; + if (this.registeredListeners.has(eventType)) { + this.registeredListeners.get(eventType).push(record); + } else { + this.registeredListeners.set(eventType, [record]); + } + return () => this.removeListener(record.symbol); + } + removeListener(eventSymbol) { + for (const [type, listeners] of this.registeredListeners.entries()) { + const matchIndex = listeners.findIndex((listener) => listener.symbol === eventSymbol); + if (matchIndex >= 0) { + listeners.splice(matchIndex, 1); + if (listeners.length === 0) { + this.registeredListeners.delete(type); + } + break; + } + } + } + dispatch(eventType, ...params) { + for (const listener of this.getListenersByType(eventType)) { + try { + listener.handler(...params); + } catch (e) { + logger_exports.errorOnce(e); + } + } + } + getListenersByType(eventType) { + return this.registeredListeners.get(eventType) ?? []; + } + destroy() { + this.registeredListeners.clear(); + } +}; + +// packages/ag-charts-community/src/util/memo.ts +var memorizedFns = /* @__PURE__ */ new WeakMap(); +function memo(params, fnGenerator) { + const serialisedParams = JSON.stringify(params, null, 0); + if (!memorizedFns.has(fnGenerator)) { + memorizedFns.set(fnGenerator, /* @__PURE__ */ new Map()); + } + if (!memorizedFns.get(fnGenerator)?.has(serialisedParams)) { + memorizedFns.get(fnGenerator)?.set(serialisedParams, fnGenerator(params)); + } + return memorizedFns.get(fnGenerator)?.get(serialisedParams); +} +var MemoizeNode = class { + constructor() { + this.weak = /* @__PURE__ */ new WeakMap(); + this.strong = /* @__PURE__ */ new Map(); + this.set = false; + this.value = void 0; + } +}; +function simpleMemorize2(fn, cacheCallback2) { + let root = new MemoizeNode(); + const memoised = (...p) => { + let current = root; + for (const param of p) { + const target = typeof param === "object" || typeof param === "symbol" ? current.weak : current.strong; + let next = target.get(param); + if (next == null) { + next = new MemoizeNode(); + target.set(param, next); + } + current = next; + } + if (current.set) { + cacheCallback2?.("hit", fn, p); + return current.value; + } else { + const out = fn(...p); + current.set = true; + current.value = out; + cacheCallback2?.("miss", fn, p); + return out; + } + }; + memoised.reset = () => { + root = new MemoizeNode(); + }; + return memoised; +} +function simpleMemorize(fn, cacheCallback2) { + const primitiveCache = /* @__PURE__ */ new Map(); + const paramsToKeys = (...params) => { + return params.map((v) => { + if (typeof v === "object") + return v; + if (typeof v === "symbol") + return v; + if (!primitiveCache.has(v)) { + primitiveCache.set(v, { v }); + } + return primitiveCache.get(v); + }); + }; + const empty = {}; + const cache = /* @__PURE__ */ new WeakMap(); + return (...p) => { + const keys = p.length === 0 ? [empty] : paramsToKeys(...p); + let currentCache = cache; + for (const key of keys.slice(0, -1)) { + if (!currentCache.has(key)) { + currentCache.set(key, /* @__PURE__ */ new WeakMap()); + } + currentCache = currentCache.get(key); + } + const finalKey = keys.at(-1); + let cachedValue = currentCache.get(finalKey); + if (cachedValue) { + cacheCallback2?.("hit", fn, p); + } else { + cachedValue = fn(...p); + currentCache.set(finalKey, cachedValue); + cacheCallback2?.("miss", fn, p); + } + return cachedValue; + }; +} + +// packages/ag-charts-community/src/chart/axis/timeFormatUtil.ts +var defaultTimeFormats = { + millisecond: "%H:%M:%S.%L", + second: "%H:%M:%S", + minute: "%H:%M", + hour: "%H:%M", + day: "%e", + month: "%b", + year: "%Y" +}; +var hardCodedTimeFormats = { + millisecond: "%Y %b %e %H:%M:%S.%L", + second: "%Y %b %e %H:%M:%S", + minute: "%Y %b %e %H:%M", + hour: "%Y %b %e %H:%M", + day: "%Y %b %e", + month: "%Y %b", + year: "%Y" +}; +var FORMAT_ORDERS = { + year: 0, + month: 1, + day: 2, + hour: 3, + minute: 4, + second: 5, + millisecond: 6 +}; +var MILLISECOND_FORMAT = /%[-_0]?L/; +var SECOND_FORMAT = /%[-_0]?S/; +var MINUTE_FORMAT = /%[-_0]?M/; +var HOUR_FORMAT = /%[-_0]?[HI]/; +var DAY_FORMAT = /^%[-_0]?[de]$/; +var MONTH_FORMAT = /^%[-_0]?[Bbm]$/; +var YEAR_FORMAT = /^%[-_0]?[Yy]$/; +function deriveTimeSpecifier(format, unit, truncateDate) { + if (typeof format === "string") + return format; + format ?? (format = defaultTimeFormats); + const { + millisecond = defaultTimeFormats.millisecond, + second = defaultTimeFormats.second, + minute = defaultTimeFormats.minute, + hour = defaultTimeFormats.hour, + day = defaultTimeFormats.day, + month = defaultTimeFormats.month, + year = defaultTimeFormats.year + } = format; + const formatOrder = FORMAT_ORDERS[unit]; + const hardcodedTimeFormat = hardCodedTimeFormats[unit]; + const truncationOrder = truncateDate ? FORMAT_ORDERS[truncateDate] : -1; + if (truncationOrder < FORMAT_ORDERS.year && formatOrder >= FORMAT_ORDERS.year && !YEAR_FORMAT.test(year) || truncationOrder < FORMAT_ORDERS.month && formatOrder >= FORMAT_ORDERS.month && !MONTH_FORMAT.test(month) || truncationOrder < FORMAT_ORDERS.day && formatOrder >= FORMAT_ORDERS.day && !DAY_FORMAT.test(day)) { + return hardcodedTimeFormat; + } + let timeFormat; + switch (unit) { + case "year": + return year; + case "month": + return truncationOrder < FORMAT_ORDERS.year ? `${month} ${year}` : month; + case "day": + return truncationOrder < FORMAT_ORDERS.year ? `${month} ${day} ${year}` : `${month} ${day}`; + case "hour": + timeFormat = hour; + break; + case "minute": + timeFormat = minute; + break; + case "second": + timeFormat = second; + break; + case "millisecond": + timeFormat = millisecond; + break; + default: + return hardcodedTimeFormat; + } + if (formatOrder >= FORMAT_ORDERS.hour && !HOUR_FORMAT.test(timeFormat) || formatOrder >= FORMAT_ORDERS.minute && !MINUTE_FORMAT.test(timeFormat) || formatOrder >= FORMAT_ORDERS.second && !SECOND_FORMAT.test(timeFormat) || formatOrder >= FORMAT_ORDERS.millisecond && !MILLISECOND_FORMAT.test(timeFormat)) { + return hardcodedTimeFormat; + } + let dateFormat; + if (truncationOrder < FORMAT_ORDERS.year) { + dateFormat = `${month} ${day} ${year}`; + } else if (truncationOrder < FORMAT_ORDERS.month) { + dateFormat = `${month} ${day}`; + } + return dateFormat ? `${timeFormat} ${dateFormat}` : timeFormat; +} + +// packages/ag-charts-community/src/chart/formatter/formatManager.ts +var FormatManager = class _FormatManager extends Listeners { + constructor() { + super(...arguments); + this.formats = /* @__PURE__ */ new Map(); + this.dateFormatter = simpleMemorize2( + (propertyFormatter, specifier, unit, style2, truncateDate) => { + const mergedFormatter = _FormatManager.mergeSpecifiers(propertyFormatter, specifier) ?? defaultTimeFormats; + return _FormatManager.getFormatter("date", mergedFormatter, unit, style2, { truncateDate }); + } + ); + this.formatter = void 0; + } + static mergeSpecifiers(...specifiers) { + let out; + for (const specifier of specifiers) { + if (isPlainObject(specifier) && isPlainObject(out)) { + out = { ...out, ...specifier }; + } else { + out = specifier; + } + } + return out; + } + static getFormatter(type, specifier, unit, style2 = "long", { truncateDate } = {}) { + if (isPlainObject(specifier)) { + if (type !== "date") { + logger_exports.warn("Date formatter configuration is not supported for non-date types."); + return; + } + unit ?? (unit = "millisecond"); + const fullFormat = style2 === "component" ? specifier?.[unit] ?? defaultTimeFormats[unit] : deriveTimeSpecifier(specifier, unit, truncateDate); + return buildDateFormatter(fullFormat); + } + switch (type) { + case "number": { + const options = parseNumberFormat(specifier); + if (options == null) + return; + return createNumberFormatter(options); + } + case "date": + return buildDateFormatter(specifier); + case "category": + return (value) => specifier.replace("%s", String(value)); + } + } + setFormatter(formatter2) { + if (this.formatter !== formatter2) { + this.formatter = formatter2; + this.formats.clear(); + this.dateFormatter.reset(); + this.dispatch("format-changed"); + } + } + format(formatInContext, params, { specifier, truncateDate } = {}) { + if (params.value == null) + return; + const { formatter: formatter2 } = this; + if (formatter2 == null) + return; + if (typeof formatter2 === "function") { + const value = formatInContext(formatter2, params); + return value == null ? void 0 : String(value); + } + const propertyFormatter = formatter2[params.property]; + if (propertyFormatter == null) + return; + if (typeof propertyFormatter === "function") { + const value = formatInContext(propertyFormatter, params); + return value == null || isArray(value) ? value : String(value); + } else if (params.type === "date") { + const { unit, style: style2 } = params; + const dateFormatter = this.dateFormatter(propertyFormatter, specifier, unit, style2, truncateDate); + return dateFormatter?.(params.value); + } + const valueSpecifier = specifier ?? propertyFormatter; + if (typeof valueSpecifier !== "string") + return; + let valueFormatter = this.formats.get(valueSpecifier); + if (valueFormatter == null) { + valueFormatter = _FormatManager.getFormatter(params.type, valueSpecifier); + this.formats.set(valueSpecifier, valueFormatter); + } + return valueFormatter?.(params.value, params.type === "number" ? params.fractionDigits : void 0); + } + defaultFormat(params, { specifier, truncateDate } = {}) { + const { formatter: formatter2 } = this; + const propertyFormatter = typeof formatter2 === "function" ? void 0 : formatter2?.[params.property]; + switch (params.type) { + case "date": { + const { unit, style: style2 } = params; + const propertySpecifier = propertyFormatter != null && typeof propertyFormatter !== "function" ? propertyFormatter : void 0; + const dateFormatter = this.dateFormatter(propertySpecifier, specifier, unit, style2, truncateDate); + return dateFormatter?.(params.value) ?? String(params.value); + } + case "number": + return formatValue(params.value, params.fractionDigits); + case "category": + if (Array.isArray(params.value)) { + return params.value.join(" - "); + } else if (typeof params.value === "string") { + return params.value; + } else if (typeof params.value === "number") { + return formatValue(params.value); + } else { + return String(params.value); + } + } + } +}; + +// packages/ag-charts-community/src/util/interpolate.ts +function interpolateNumber(a, b) { + return (d) => Number(a) * (1 - d) + Number(b) * d; +} +function interpolateColor(a, b) { + if (typeof a === "string") { + try { + a = Color.fromString(a); + } catch { + a = Color.fromArray([0, 0, 0]); + } + } + if (typeof b === "string") { + try { + b = Color.fromString(b); + } catch { + b = Color.fromArray([0, 0, 0]); + } + } + return (d) => Color.mix(a, b, d).toRgbaString(); +} + +// packages/ag-charts-community/src/motion/easing.ts +var easing_exports = {}; +__export(easing_exports, { + easeIn: () => easeIn, + easeInOut: () => easeInOut, + easeInOutQuad: () => easeInOutQuad, + easeInQuad: () => easeInQuad, + easeOut: () => easeOut, + easeOutQuad: () => easeOutQuad, + inverseEaseOut: () => inverseEaseOut, + linear: () => linear +}); +var linear = (n) => n; +var easeIn = (n) => 1 - Math.cos(n * Math.PI / 2); +var easeOut = (n) => Math.sin(n * Math.PI / 2); +var easeInOut = (n) => -(Math.cos(n * Math.PI) - 1) / 2; +var easeInQuad = (n) => n * n; +var easeOutQuad = (n) => 1 - (1 - n) ** 2; +var easeInOutQuad = (n) => n < 0.5 ? 2 * n * n : 1 - (-2 * n + 2) ** 2 / 2; +var inverseEaseOut = (x) => 2 * Math.asin(x) / Math.PI; + +// packages/ag-charts-community/src/motion/animation.ts +var QUICK_TRANSITION = 0.2; +var PHASE_ORDER = ["initial", "remove", "update", "add", "trailing", "end", "none"]; +var PHASE_METADATA = { + initial: { + animationDuration: 1, + animationDelay: 0 + }, + add: { + animationDuration: 0.25, + animationDelay: 0.75 + }, + remove: { + animationDuration: 0.25, + animationDelay: 0 + }, + update: { + animationDuration: 0.5, + animationDelay: 0.25 + }, + trailing: { + animationDuration: QUICK_TRANSITION, + animationDelay: 1, + skipIfNoEarlierAnimations: true + }, + end: { + animationDelay: 1 + QUICK_TRANSITION, + animationDuration: 0, + skipIfNoEarlierAnimations: true + }, + none: { + animationDuration: 0, + animationDelay: 0 + } +}; +var RepeatType = /* @__PURE__ */ ((RepeatType2) => { + RepeatType2["Loop"] = "loop"; + RepeatType2["Reverse"] = "reverse"; + return RepeatType2; +})(RepeatType || {}); +function isNodeArray(array2) { + return array2.every((n) => n instanceof Node2); +} +function deconstructSelectionsOrNodes(selectionsOrNodes) { + return isNodeArray(selectionsOrNodes) ? { nodes: selectionsOrNodes, selections: [] } : { nodes: [], selections: selectionsOrNodes }; +} +function animationValuesEqual(a, b) { + if (a === b) { + return true; + } else if (Array.isArray(a) && Array.isArray(b)) { + return a.length === b.length && a.every((v, i) => animationValuesEqual(v, b[i])); + } else if (isInterpolating(a) && isInterpolating(b)) { + return a.equals(b); + } else if (isPlainObject(a) && isPlainObject(b)) { + return objectsEqualWith(a, b, animationValuesEqual); + } + return false; +} +var Animation = class { + constructor(opts) { + this.isComplete = false; + this.elapsed = 0; + this.iteration = 0; + this.isPlaying = false; + this.isReverse = false; + this.id = opts.id; + this.groupId = opts.groupId; + this.autoplay = opts.autoplay ?? true; + this.ease = opts.ease ?? linear; + this.phase = opts.phase; + const durationProportion = opts.duration ?? PHASE_METADATA[this.phase].animationDuration; + this.duration = durationProportion * opts.defaultDuration; + this.delay = (opts.delay ?? 0) * opts.defaultDuration; + this.onComplete = opts.onComplete; + this.onPlay = opts.onPlay; + this.onStop = opts.onStop; + this.onUpdate = opts.onUpdate; + this.interpolate = this.createInterpolator(opts.from, opts.to); + this.from = opts.from; + if (opts.skip === true) { + this.onUpdate?.(opts.to, false, this); + this.onStop?.(this); + this.onComplete?.(this); + this.isComplete = true; + } + if (opts.collapsable !== false) { + this.duration = this.checkCollapse(opts, this.duration); + } + } + checkCollapse(opts, calculatedDuration) { + return animationValuesEqual(opts.from, opts.to) ? 0 : calculatedDuration; + } + play(initialUpdate = false) { + if (this.isPlaying || this.isComplete) + return; + this.isPlaying = true; + this.onPlay?.(this); + if (!this.autoplay) + return; + this.autoplay = false; + if (!initialUpdate) + return; + this.onUpdate?.(this.from, true, this); + } + stop() { + this.isPlaying = false; + if (!this.isComplete) { + this.isComplete = true; + this.onStop?.(this); + } + } + update(time3) { + if (this.isComplete) + return time3; + if (!this.isPlaying && this.autoplay) { + this.play(true); + } + const previousElapsed = this.elapsed; + this.elapsed += time3; + if (this.delay > this.elapsed) + return 0; + const value = this.interpolate(this.isReverse ? 1 - this.delta : this.delta); + this.onUpdate?.(value, false, this); + const totalDuration = this.delay + this.duration; + if (this.elapsed >= totalDuration) { + this.stop(); + this.isComplete = true; + this.onComplete?.(this); + return time3 - (totalDuration - previousElapsed); + } + return 0; + } + get delta() { + return this.ease(clamp(0, (this.elapsed - this.delay) / this.duration, 1)); + } + createInterpolator(from3, to) { + if (typeof to !== "object" || isInterpolating(to)) { + return this.interpolateValue(from3, to); + } else if (Array.isArray(to)) { + const interpolatorValues = []; + for (let i = 0; i < to.length; i++) { + const interpolator = this.createInterpolator(from3[i], to[i]); + if (interpolator != null) { + interpolatorValues.push(interpolator); + } + } + return (d) => { + const out = []; + for (const interpolator of interpolatorValues) { + out.push(interpolator(d)); + } + return out; + }; + } + const interpolatorEntries = []; + for (const key of Object.keys(to)) { + const interpolator = this.createInterpolator(from3[key], to[key]); + if (interpolator != null) { + interpolatorEntries.push([key, interpolator]); + } + } + return (d) => { + const result = {}; + for (const [key, interpolator] of interpolatorEntries) { + result[key] = interpolator(d); + } + return result; + }; + } + interpolateValue(a, b) { + if (a == null || b == null) { + return; + } else if (isInterpolating(a)) { + return (d) => a[interpolate](b, d); + } + try { + switch (typeof a) { + case "number": + return interpolateNumber(a, b); + case "string": + return interpolateColor(a, b); + case "boolean": + if (a === b) { + return () => a; + } + break; + case "object": + return () => a; + default: + throw new Error(`Unable to interpolate values: ${a}, ${b}`); + } + } catch { + } + throw new Error(`Unable to interpolate values: ${a}, ${b}`); + } +}; + +// packages/ag-charts-community/src/chart/interaction/animationBatch.ts +var AnimationBatch = class { + constructor(maxAnimationTime) { + this.maxAnimationTime = maxAnimationTime; + this.debug = Debug.create(true, "animation"); + this.controllers = /* @__PURE__ */ new Map(); + this.stoppedCbs = /* @__PURE__ */ new Set(); + this.currentPhase = 0; + this.phases = new Map(PHASE_ORDER.map((p) => [p, []])); + this.skipAnimations = false; + this.animationTimeConsumed = 0; + /** Guard against premature animation execution. */ + this.isReady = false; + } + get size() { + return this.controllers.size; + } + get consumedTimeMs() { + return this.animationTimeConsumed; + } + isActive() { + return this.controllers.size > 0; + } + getActiveControllers() { + return this.phases.get(PHASE_ORDER[this.currentPhase]) ?? []; + } + checkOverlappingId(id) { + if (id != null && this.controllers.has(id)) { + this.controllers.get(id).stop(); + this.debug(`Skipping animation batch due to update of existing animation: ${id}`); + this.skip(); + } + } + addAnimation(animation) { + if (animation.isComplete) + return; + const animationPhaseIdx = PHASE_ORDER.indexOf(animation.phase); + if (animationPhaseIdx < this.currentPhase) { + this.debug(`Skipping animation due to being for an earlier phase`, animation.id); + animation.stop(); + return; + } + this.controllers.set(animation.id, animation); + this.phases.get(animation.phase)?.push(animation); + } + removeAnimation(animation) { + this.controllers.delete(animation.id); + const phase = this.phases.get(animation.phase); + const index = phase?.indexOf(animation); + if (index != null && index >= 0) { + phase?.splice(index, 1); + } + } + progress(deltaTime) { + if (!this.isReady) + return; + let unusedTime = deltaTime === 0 ? 0.01 : deltaTime; + const refresh = () => { + const phase2 = PHASE_ORDER[this.currentPhase]; + return { + phaseControllers: [...this.getActiveControllers()], + phase: phase2, + phaseMeta: PHASE_METADATA[phase2] + }; + }; + let { phase, phaseControllers, phaseMeta } = refresh(); + const arePhasesComplete = () => PHASE_ORDER[this.currentPhase] == null; + const progressPhase = () => { + ({ phase, phaseControllers, phaseMeta } = refresh()); + while (!arePhasesComplete() && phaseControllers.length === 0) { + this.currentPhase++; + ({ phase, phaseControllers, phaseMeta } = refresh()); + this.debug(`AnimationBatch - phase changing to ${phase}`, { unusedTime }, phaseControllers); + } + }; + const total = this.controllers.size; + this.debug(`AnimationBatch - ${deltaTime}ms; phase ${phase} with ${phaseControllers?.length} of ${total}`); + do { + const phaseDeltaTime = unusedTime; + const skipPhase = phaseMeta.skipIfNoEarlierAnimations && this.animationTimeConsumed === 0; + let completeCount = 0; + for (const controller of phaseControllers) { + if (skipPhase) { + controller.stop(); + } else { + unusedTime = Math.min(controller.update(phaseDeltaTime), unusedTime); + } + if (controller.isComplete) { + completeCount++; + this.removeAnimation(controller); + } + } + this.animationTimeConsumed += phaseDeltaTime - unusedTime; + this.debug( + `AnimationBatch - updated ${phaseControllers.length} controllers; ${completeCount} completed`, + phaseControllers + ); + this.debug(`AnimationBatch - animationTimeConsumed: ${this.animationTimeConsumed}`); + progressPhase(); + } while (unusedTime > 0 && !arePhasesComplete()); + if (this.animationTimeConsumed > this.maxAnimationTime) { + this.debug(`Animation batch exceeded max animation time, skipping`, [...this.controllers]); + this.stop(); + } + } + ready() { + if (this.isReady) + return; + this.isReady = true; + this.debug(`AnimationBatch - ready; skipped: ${this.skipAnimations}`, [...this.controllers]); + let skipAll = true; + for (const [, controller] of this.controllers) { + if (controller.duration > 0 && PHASE_METADATA[controller.phase].skipIfNoEarlierAnimations !== true) { + skipAll = false; + break; + } + } + if (!skipAll) { + for (const [, controller] of this.controllers) { + if (controller.autoplay) { + controller.play(true); + } + } + } + } + skip(skip = true) { + if (this.skipAnimations === false && skip === true) { + for (const controller of this.controllers.values()) { + controller.stop(); + } + this.controllers.clear(); + } + this.skipAnimations = skip; + } + play() { + for (const controller of this.controllers.values()) { + controller.play(); + } + } + stop() { + for (const controller of this.controllers.values()) { + try { + controller.stop(); + this.removeAnimation(controller); + } catch (error2) { + logger_exports.error("Error during animation stop", error2); + } + } + this.dispatchStopped(); + } + stopByAnimationId(id) { + if (id != null && this.controllers.has(id)) { + const controller = this.controllers.get(id); + if (controller) { + controller.stop(); + this.removeAnimation(controller); + } + } + } + stopByAnimationGroupId(id) { + for (const controller of this.controllers.values()) { + if (controller.groupId === id) { + this.stopByAnimationId(controller.id); + } + } + } + dispatchStopped() { + for (const cb of this.stoppedCbs) { + cb(); + } + this.stoppedCbs.clear(); + } + isSkipped() { + return this.skipAnimations; + } + getRemainingTime(restrictPhase) { + if (!this.isActive()) + return 0; + let total = 0; + for (const [phase, controllers] of this.phases) { + if (controllers.length === 0) + continue; + if (restrictPhase != null && restrictPhase !== phase) + continue; + total += Math.max(...controllers.map((c) => c.isComplete ? 0 : c.delay + c.duration - (c.elapsed ?? 0))); + } + return total; + } + destroy() { + this.stop(); + this.controllers.clear(); + } +}; + +// packages/ag-charts-community/src/chart/interaction/interactionManager.ts +var InteractionState = /* @__PURE__ */ ((InteractionState6) => { + InteractionState6[InteractionState6["Default"] = 32] = "Default"; + InteractionState6[InteractionState6["ZoomDrag"] = 16] = "ZoomDrag"; + InteractionState6[InteractionState6["Annotations"] = 8] = "Annotations"; + InteractionState6[InteractionState6["ContextMenu"] = 4] = "ContextMenu"; + InteractionState6[InteractionState6["Animation"] = 2] = "Animation"; + InteractionState6[InteractionState6["AnnotationsSelected"] = 1] = "AnnotationsSelected"; + InteractionState6[InteractionState6["Clickable"] = 41] = "Clickable"; + InteractionState6[InteractionState6["Focusable"] = 34] = "Focusable"; + InteractionState6[InteractionState6["Keyable"] = 43] = "Keyable"; + InteractionState6[InteractionState6["ContextMenuable"] = 36] = "ContextMenuable"; + InteractionState6[InteractionState6["AnnotationsMoveable"] = 9] = "AnnotationsMoveable"; + InteractionState6[InteractionState6["AnnotationsDraggable"] = 57] = "AnnotationsDraggable"; + InteractionState6[InteractionState6["ZoomDraggable"] = 50] = "ZoomDraggable"; + InteractionState6[InteractionState6["ZoomClickable"] = 34] = "ZoomClickable"; + InteractionState6[InteractionState6["ZoomWheelable"] = 59] = "ZoomWheelable"; + InteractionState6[InteractionState6["All"] = 63] = "All"; + return InteractionState6; +})(InteractionState || {}); +var InteractionManager = class { + constructor() { + this.stateQueue = 32 /* Default */ | 2 /* Animation */; + } + pushState(state) { + this.stateQueue |= state; + } + popState(state) { + this.stateQueue &= ~state; + } + isState(allowedStates) { + return !!(this.stateQueue & -this.stateQueue & allowedStates); + } +}; + +// packages/ag-charts-community/src/chart/interaction/animationManager.ts +function validAnimationDuration(testee) { + if (testee == null) + return true; + return !Number.isNaN(testee) && testee >= 0 && testee <= 2; +} +var AnimationManager = class { + constructor(interactionManager, chartUpdateMutex) { + this.interactionManager = interactionManager; + this.chartUpdateMutex = chartUpdateMutex; + this.defaultDuration = 1e3; + this.maxAnimatableItems = Infinity; + this.batch = new AnimationBatch(this.defaultDuration * 1.5); + this.debug = Debug.create(true, "animation"); + this.events = new EventEmitter(); + this.rafAvailable = typeof requestAnimationFrame !== "undefined"; + this.isPlaying = true; + this.requestId = null; + this.skipAnimations = true; + this.currentAnonymousAnimationId = 0; + this.cumulativeAnimationTime = 0; + } + addListener(eventName, listener) { + return this.events.on(eventName, listener); + } + /** + * Create an animation to tween a value between the `from` and `to` properties. If an animation already exists + * with the same `id`, immediately stop it. + */ + animate(opts) { + const batch = this.batch; + try { + batch.checkOverlappingId(opts.id); + } catch (error2) { + this.failsafeOnError(error2); + return; + } + let { id } = opts; + if (id == null) { + id = `__${this.currentAnonymousAnimationId}`; + this.currentAnonymousAnimationId += 1; + } + const skip = this.isSkipped() || opts.phase === "none"; + if (skip) { + this.debug("AnimationManager - skipping animation"); + } + const { delay, duration } = opts; + if (!validAnimationDuration(delay)) { + throw new Error(`Animation delay of ${delay} is unsupported (${id})`); + } + if (!validAnimationDuration(duration)) { + throw new Error(`Animation duration of ${duration} is unsupported (${id})`); + } + const animation = new Animation({ + ...opts, + id, + skip, + autoplay: this.isPlaying ? opts.autoplay : false, + phase: opts.phase, + defaultDuration: this.defaultDuration + }); + if (this.forceTimeJump(animation, this.defaultDuration)) { + return; + } + this.batch.addAnimation(animation); + return animation; + } + play() { + if (this.isPlaying) { + return; + } + this.isPlaying = true; + this.debug("AnimationManager.play()"); + try { + this.batch.play(); + } catch (error2) { + this.failsafeOnError(error2); + } + this.requestAnimation(); + } + stop() { + this.isPlaying = false; + this.cancelAnimation(); + this.debug("AnimationManager.stop()"); + this.batch.stop(); + } + stopByAnimationId(id) { + try { + this.batch.stopByAnimationId(id); + } catch (error2) { + this.failsafeOnError(error2); + } + } + stopByAnimationGroupId(id) { + try { + this.batch.stopByAnimationGroupId(id); + } catch (error2) { + this.failsafeOnError(error2); + } + } + reset() { + if (this.isPlaying) { + this.stop(); + this.play(); + } else { + this.stop(); + } + } + skip(skip = true) { + this.skipAnimations = skip; + } + isSkipped() { + return !this.rafAvailable || this.skipAnimations || this.batch.isSkipped(); + } + isActive() { + return this.isPlaying && this.batch.isActive(); + } + getRemainingTime(phase) { + return this.batch.getRemainingTime(phase); + } + getCumulativeAnimationTime() { + return this.cumulativeAnimationTime; + } + skipCurrentBatch() { + if (this.debug.check()) { + this.debug(`AnimationManager - skipCurrentBatch()`, { + stack: new Error("Stack trace for animation skip tracking").stack + }); + } + this.batch.skip(); + } + /** Mocking point for tests to guarantee that animation updates happen. */ + isSkippingFrames() { + return true; + } + /** Mocking point for tests to capture requestAnimationFrame callbacks. */ + scheduleAnimationFrame(cb) { + this.requestId = getWindow().requestAnimationFrame((t) => { + cb(t).catch((e) => logger_exports.error(e)); + }); + } + /** Mocking point for tests to skip animations to a specific point in time. */ + forceTimeJump(_animation, _defaultDuration) { + return false; + } + requestAnimation() { + if (!this.rafAvailable) + return; + if (!this.batch.isActive() || this.requestId !== null) + return; + let prevTime; + const onAnimationFrame = async (time3) => { + await this.debug.group("AnimationManager.onAnimationFrame()", async () => { + const executeAnimationFrame = () => { + const deltaTime = time3 - (prevTime ?? time3); + prevTime = time3; + this.debug("AnimationManager", { + controllersCount: this.batch.size, + deltaTime + }); + this.interactionManager.pushState(2 /* Animation */); + try { + this.batch.progress(deltaTime); + this.cumulativeAnimationTime += deltaTime; + } catch (error2) { + this.failsafeOnError(error2); + } + this.events.emit("animation-frame", { + type: "animation-frame", + deltaMs: deltaTime + }); + }; + if (this.isSkippingFrames()) { + await this.chartUpdateMutex.acquireImmediately(executeAnimationFrame); + } else { + await this.chartUpdateMutex.acquire(executeAnimationFrame); + } + if (this.batch.isActive()) { + this.scheduleAnimationFrame(onAnimationFrame); + } else { + this.batch.stop(); + this.events.emit("animation-stop", { + type: "animation-stop", + deltaMs: this.batch.consumedTimeMs + }); + } + }); + }; + this.events.emit("animation-start", { + type: "animation-start", + deltaMs: 0 + }); + this.scheduleAnimationFrame(onAnimationFrame); + } + cancelAnimation() { + if (this.requestId === null) + return; + cancelAnimationFrame(this.requestId); + this.events.emit("animation-stop", { + type: "animation-stop", + deltaMs: this.batch.consumedTimeMs + }); + this.requestId = null; + this.startBatch(); + } + failsafeOnError(error2, cancelAnimation = true) { + logger_exports.error("Error during animation, skipping animations", error2); + if (cancelAnimation) { + this.cancelAnimation(); + } + } + startBatch(skipAnimations) { + this.debug(`AnimationManager - startBatch() with skipAnimations=${skipAnimations}.`); + this.reset(); + this.batch.destroy(); + this.batch = new AnimationBatch(this.defaultDuration * 1.5); + if (skipAnimations === true) { + this.batch.skip(); + } + } + endBatch() { + if (this.batch.isActive()) { + this.batch.ready(); + this.requestAnimation(); + } else { + this.interactionManager.popState(2 /* Animation */); + if (this.batch.isSkipped()) { + this.batch.skip(false); + } + } + } + onBatchStop(cb) { + this.batch.stoppedCbs.add(cb); + } + destroy() { + this.stop(); + this.events.clear(); + } +}; + +// packages/ag-charts-community/src/chart/interaction/contextMenuTypes.ts +var ContextMenuBuiltinItems = class { + constructor() { + this.download = { + type: "action", + showOn: "always", + label: "contextMenuDownload", + enabled: true, + action: void 0, + items: void 0 + }; + this["zoom-to-cursor"] = { + type: "action", + showOn: "series-area", + label: "contextMenuZoomToCursor", + enabled: true, + action: void 0, + items: void 0 + }; + this["pan-to-cursor"] = { + type: "action", + showOn: "series-area", + label: "contextMenuPanToCursor", + enabled: true, + action: void 0, + items: void 0 + }; + this["reset-zoom"] = { + type: "action", + showOn: "series-area", + label: "contextMenuResetZoom", + enabled: true, + action: void 0, + items: void 0 + }; + this["toggle-series-visibility"] = { + type: "action", + showOn: "legend-item", + label: "contextMenuToggleSeriesVisibility", + enabled: true, + action: void 0, + items: void 0 + }; + this["toggle-other-series"] = { + type: "action", + showOn: "legend-item", + label: "contextMenuToggleOtherSeries", + enabled: true, + action: void 0, + items: void 0 + }; + this["separator"] = { + type: "separator", + showOn: "always", + label: "separator", + enabled: true, + action: void 0, + items: void 0 + }; + } +}; +var ContextMenuBuiltinItemLists = class { + constructor() { + this.defaults = [ + "download", + "zoom-to-cursor", + "pan-to-cursor", + "reset-zoom", + "toggle-series-visibility", + "toggle-other-series" + ]; + } +}; +var ContextMenuBuiltins = class { + constructor() { + this.items = new ContextMenuBuiltinItems(); + this.lists = new ContextMenuBuiltinItemLists(); + } +}; + +// packages/ag-charts-community/src/chart/interaction/contextMenuRegistry.ts +var ContextMenuRegistry = class { + constructor(eventsHub) { + this.eventsHub = eventsHub; + this.builtins = new ContextMenuBuiltins(); + this.hiddenActions = /* @__PURE__ */ new Set(); + this.toggle("zoom-to-cursor", "hide"); + this.toggle("pan-to-cursor", "hide"); + this.toggle("reset-zoom", "hide"); + } + static check(showOn, event) { + return event.showOn == showOn; + } + static checkCallback(desiredShowOn, showOn, _callback) { + return desiredShowOn === showOn; + } + dispatchContext(showOn, pointerEvent, context, position) { + const { widgetEvent } = pointerEvent; + if (widgetEvent.sourceEvent.defaultPrevented) { + return; + } + const x = position?.x ?? pointerEvent.canvasX; + const y = position?.y ?? pointerEvent.canvasY; + const event = { showOn, x, y, context, widgetEvent }; + this.eventsHub.emit("context-menu:setup", event); + this.eventsHub.emit("context-menu:complete", event); + } + isVisible(id) { + return !this.hiddenActions.has(id); + } + toggle(id, action) { + action ?? (action = this.isVisible(id) ? "hide" : "show"); + switch (action) { + case "show": + this.hiddenActions.delete(id); + break; + case "hide": + this.hiddenActions.add(id); + break; + } + } +}; + +// packages/ag-charts-community/src/chart/interaction/highlightManager.ts +var HighlightManager = class { + constructor(eventsHub) { + this.eventsHub = eventsHub; + this.highlightStates = new StateTracker(); + } + updateHighlight(callerId, highlightedDatum) { + const previousHighlight = this.getActiveHighlight(); + this.highlightStates.set(callerId, highlightedDatum); + const currentHighlight = this.getActiveHighlight(); + if (!this.isEqual(currentHighlight, previousHighlight)) { + this.eventsHub.emit("highlight:change", { callerId, currentHighlight, previousHighlight }); + } + } + getActiveHighlight() { + return this.highlightStates.stateValue(); + } + isEqual(a, b) { + return a === b || a != null && b != null && a?.series === b?.series && a?.itemId === b?.itemId && a?.datum === b?.datum; + } +}; + +// packages/ag-charts-community/src/chart/series/seriesProperties.ts +var HighlightState = /* @__PURE__ */ ((HighlightState6) => { + HighlightState6[HighlightState6["None"] = 0] = "None"; + HighlightState6[HighlightState6["Item"] = 1] = "Item"; + HighlightState6[HighlightState6["Series"] = 2] = "Series"; + HighlightState6[HighlightState6["OtherSeries"] = 3] = "OtherSeries"; + HighlightState6[HighlightState6["OtherItem"] = 4] = "OtherItem"; + return HighlightState6; +})(HighlightState || {}); +var highlightStates = [ + 0 /* None */, + 1 /* Item */, + 2 /* Series */, + 3 /* OtherSeries */, + 4 /* OtherItem */ +]; +function toHighlightString(state) { + const unreachable = (a) => a; + switch (state) { + case 1 /* Item */: + return "highlighted-item"; + case 4 /* OtherItem */: + return "unhighlighted-item"; + case 2 /* Series */: + return "highlighted-series"; + case 3 /* OtherSeries */: + return "unhighlighted-series"; + case 0 /* None */: + return "none"; + default: + return unreachable(state); + } +} +var SeriesItemHighlightStyle = class extends BaseProperties { +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesItemHighlightStyle.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesItemHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesItemHighlightStyle.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesItemHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesItemHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesItemHighlightStyle.prototype, "lineDash", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesItemHighlightStyle.prototype, "lineDashOffset", 2); +var HighlightProperties = class extends BaseProperties { + constructor() { + super(...arguments); + this.enabled = true; + this.range = "tooltip"; + this.bringToFront = false; + this.highlightedItem = {}; + this.unhighlightedItem = {}; + this.highlightedSeries = {}; + this.unhighlightedSeries = {}; + } + getItemHighlightStyle(highlightState) { + switch (highlightState) { + case 1 /* Item */: + return this.highlightedItem; + case 4 /* OtherItem */: + return this.unhighlightedItem; + case 2 /* Series */: + return this.highlightedSeries; + case 3 /* OtherSeries */: + return this.unhighlightedSeries; + } + } + getSeriesHighlightStyle(highlightState) { + switch (highlightState) { + case 1 /* Item */: + case 4 /* OtherItem */: + case 2 /* Series */: + return this.highlightedSeries; + case 3 /* OtherSeries */: + return this.unhighlightedSeries; + } + } + getStyle(highlightState) { + return mergeDefaults( + this.getItemHighlightStyle(highlightState), + this.getSeriesHighlightStyle(highlightState) + ); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], HighlightProperties.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HighlightProperties.prototype, "range", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HighlightProperties.prototype, "bringToFront", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HighlightProperties.prototype, "highlightedItem", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HighlightProperties.prototype, "unhighlightedItem", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HighlightProperties.prototype, "highlightedSeries", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HighlightProperties.prototype, "unhighlightedSeries", 2); +var SeriesHighlightStyle = class extends BaseProperties { +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesHighlightStyle.prototype, "dimOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesHighlightStyle.prototype, "enabled", 2); +var TextHighlightStyle = class extends BaseProperties { + constructor() { + super(...arguments); + this.color = "black"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], TextHighlightStyle.prototype, "color", 2); +var SegmentOptions = class extends BaseProperties { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#874349"; + this.strokeWidth = 2; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], SegmentOptions.prototype, "start", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SegmentOptions.prototype, "stop", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SegmentOptions.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SegmentOptions.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SegmentOptions.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SegmentOptions.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SegmentOptions.prototype, "strokeOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SegmentOptions.prototype, "lineDash", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SegmentOptions.prototype, "lineDashOffset", 2); +var Segmentation = class { + constructor() { + this.key = "x"; + this.segments = new PropertiesArray(SegmentOptions); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], Segmentation.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Segmentation.prototype, "key", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Segmentation.prototype, "segments", 2); +var FillGradientDefaults = class extends BaseProperties { + constructor() { + super(...arguments); + this.type = "gradient"; + this.colorStops = []; + this.bounds = "item"; + this.gradient = "linear"; + this.rotation = 0; + this.reverse = false; + this.colorSpace = "rgb"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], FillGradientDefaults.prototype, "type", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillGradientDefaults.prototype, "colorStops", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillGradientDefaults.prototype, "bounds", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillGradientDefaults.prototype, "gradient", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillGradientDefaults.prototype, "rotation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillGradientDefaults.prototype, "reverse", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillGradientDefaults.prototype, "colorSpace", 2); +var FillPatternDefaults = class extends BaseProperties { + constructor() { + super(...arguments); + this.type = "pattern"; + this.colorStops = []; + this.bounds = "item"; + this.gradient = "linear"; + this.rotation = 0; + this.scale = 1; + this.reverse = false; + this.pattern = "forward-slanted-lines"; + this.width = 26; + this.height = 26; + this.padding = 6; + this.fill = "black"; + this.fillOpacity = 1; + this.backgroundFill = "white"; + this.backgroundFillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "type", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "colorStops", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "bounds", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "gradient", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "rotation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "scale", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "reverse", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "path", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "pattern", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "width", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "height", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "padding", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "backgroundFill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "backgroundFillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "strokeOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillPatternDefaults.prototype, "strokeWidth", 2); +var FillImageDefaults = class extends BaseProperties { + constructor() { + super(...arguments); + this.type = "image"; + this.url = ""; + this.rotation = 0; + this.scale = 1; + this.backgroundFill = "black"; + this.backgroundFillOpacity = 1; + this.repeat = "no-repeat"; + this.fit = "contain"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], FillImageDefaults.prototype, "type", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillImageDefaults.prototype, "url", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillImageDefaults.prototype, "rotation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillImageDefaults.prototype, "scale", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillImageDefaults.prototype, "backgroundFill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillImageDefaults.prototype, "backgroundFillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillImageDefaults.prototype, "repeat", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], FillImageDefaults.prototype, "fit", 2); +var HighlightStyle = class extends BaseProperties { + constructor(deprecated = true) { + super(); + this.deprecated = deprecated; + this.item = new SeriesItemHighlightStyle(); + this.series = new SeriesHighlightStyle(); + this.text = new TextHighlightStyle(); + } + set(properties) { + if (this.deprecated) { + logger_exports.warnOnce("highlightStyle is deprecated, use highlight instead."); + } + return super.set(properties); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], HighlightStyle.prototype, "item", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HighlightStyle.prototype, "series", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HighlightStyle.prototype, "text", 2); +var SeriesProperties = class extends BaseProperties { + constructor() { + super(...arguments); + this.visible = true; + this.focusPriority = Infinity; + this.showInLegend = true; + this.cursor = "default"; + this.nodeClickRange = "exact"; + this.highlight = new HighlightProperties(); + this.highlightStyle = new HighlightStyle(); + } + handleUnknownProperties(unknownKeys, properties) { + if ("context" in properties) { + this.context = properties.context; + unknownKeys.delete("context"); + } + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesProperties.prototype, "id", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesProperties.prototype, "visible", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesProperties.prototype, "focusPriority", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesProperties.prototype, "showInLegend", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesProperties.prototype, "cursor", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesProperties.prototype, "nodeClickRange", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesProperties.prototype, "highlight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesProperties.prototype, "highlightStyle", 2); + +// packages/ag-charts-community/src/chart/series/util.ts +function datumBoundaryPoints(datum, domain) { + if (datum == null || domain.length === 0) { + return [false, false]; + } + const datumValue = datum.valueOf(); + const d0 = domain[0]; + const d1 = domain.at(-1); + if (typeof d0 === "string") { + return [datumValue === d0, datumValue === d1]; + } + let min = d0.valueOf(); + let max = d1.valueOf(); + if (min > max) { + [min, max] = [max, min]; + } + return [datumValue === min, datumValue === max]; +} +function datumStylerProperties(xValue2, yValue, xKey, yKey, xDomain, yDomain) { + const [min, max] = datumBoundaryPoints(yValue, yDomain); + const [first2, last] = datumBoundaryPoints(xValue2, xDomain); + return { + xKey, + yKey, + xValue: xValue2, + yValue, + first: first2, + last, + min, + max + }; +} +function visibleRangeIndices(sortOrder, length2, [range0, range1], xRange) { + let xMinIndex = findMinIndex(0, length2 - 1, (i) => { + const index = sortOrder === 1 ? i : length2 - i; + const x1 = xRange(index)?.[1] ?? Number.NaN; + return !Number.isFinite(x1) || x1 >= range0; + }) ?? 0; + let xMaxIndex = findMaxIndex(0, length2 - 1, (i) => { + const index = sortOrder === 1 ? i : length2 - i; + const x0 = xRange(index)?.[0] ?? Number.NaN; + return !Number.isFinite(x0) || x0 <= range1; + }) ?? length2 - 1; + if (sortOrder === -1) { + [xMinIndex, xMaxIndex] = [length2 - xMaxIndex, length2 - xMinIndex]; + } + xMinIndex = Math.max(xMinIndex, 0); + xMaxIndex = Math.min(xMaxIndex + 1, length2); + return [xMinIndex, xMaxIndex]; +} +function getDatumRefPoint(series, datum, movedBounds) { + if (movedBounds) { + const { x, y, width: width2, height: height2 } = movedBounds; + return { canvasX: x + width2 / 2, canvasY: y + height2 / 2 }; + } + const refPoint = datum.yBar?.upperPoint ?? datum.midPoint ?? series.datumMidPoint?.(datum); + if (refPoint) { + const { x, y } = Transformable.toCanvasPoint(series.contentGroup, refPoint.x, refPoint.y); + return { canvasX: Math.round(x), canvasY: Math.round(y) }; + } +} +function countExpandingSearch(min, max, start2, countUntil, iteratee) { + let i = -1; + let count = 0; + let shift = 0; + let reachedAnEnd = false; + while (count < countUntil && i <= max - min) { + i += 1; + const index = start2 + shift; + if (!reachedAnEnd) + shift *= -1; + if (shift >= 0) + shift += 1; + if (reachedAnEnd && shift < 0) + shift -= 1; + if (index < min || index > max) { + reachedAnEnd = true; + continue; + } + if (iteratee(index)) + count += 1; + } + return count; +} +function getItemStyles(getItemStyle2) { + const result = {}; + for (const state of highlightStates) { + result[state] = getItemStyle2(void 0, false, state); + } + return result; +} +function getItemStylesPerItemId(getItemStyle2, ...itemIds) { + const result = {}; + for (const itemId of itemIds ?? ["default"]) { + for (const state of highlightStates) { + const states = result[itemId] ?? (result[itemId] = {}); + states[state] = getItemStyle2(void 0, false, state, itemId); + } + } + return result; +} + +// packages/ag-charts-community/src/chart/interaction/tooltipManager.ts +var TooltipManager = class { + constructor(eventsHub, localeManager, domManager, tooltip) { + this.domManager = domManager; + this.tooltip = tooltip; + this.stateTracker = new StateTracker(); + this.suppressState = new StateTracker(false); + this.appliedState = null; + this.cleanup = new CleanupRegistry(); + this.cleanup.register( + tooltip.setup(localeManager, domManager), + eventsHub.on("dom:hidden", () => this.tooltip.hide()) + ); + } + destroy() { + this.cleanup.flush(); + } + updateTooltip(callerId, meta, content, pagination) { + content ?? (content = this.stateTracker.get(callerId)?.content); + this.stateTracker.set(callerId, { meta, content, pagination }); + this.applyStates(); + } + removeTooltip(callerId) { + this.stateTracker.delete(callerId); + this.applyStates(); + } + suppressTooltip(callerId) { + this.suppressState.set(callerId, true); + } + unsuppressTooltip(callerId) { + this.suppressState.delete(callerId); + } + applyStates() { + const id = this.stateTracker.stateId(); + const state = id ? this.stateTracker.get(id) : void 0; + if (this.suppressState.stateValue() || state?.meta == null || state?.content == null) { + this.appliedState = null; + this.tooltip.hide(); + return; + } + const canvasRect = this.domManager.getBoundingClientRect(); + const boundingRect = this.tooltip.bounds === "extended" ? this.domManager.getOverlayClientRect() : canvasRect; + if (objectsEqual(this.appliedState?.content, state?.content) && objectsEqual(this.appliedState?.pagination, state?.pagination)) { + const renderInstantly = this.tooltip.isVisible(); + this.tooltip.show(boundingRect, canvasRect, state?.meta, null, void 0, renderInstantly); + } else { + this.tooltip.show(boundingRect, canvasRect, state?.meta, state?.content, state?.pagination); + } + this.appliedState = state; + } + static makeTooltipMeta(event, series, datum, movedBounds) { + const { canvasX, canvasY } = event; + const tooltip = series.properties.tooltip; + const { placement, anchorTo, xOffset, yOffset } = tooltip.position; + const refPoint = getDatumRefPoint(series, datum, movedBounds); + const meta = { + canvasX, + canvasY, + nodeCanvasX: refPoint?.canvasX ?? canvasX, + nodeCanvasY: refPoint?.canvasY ?? canvasY, + enableInteraction: tooltip.interaction?.enabled ?? false, + showArrow: tooltip.showArrow, + position: { + placement, + anchorTo, + xOffset, + yOffset + } + }; + return meta; + } +}; + +// packages/ag-charts-community/src/chart/interaction/dragInterpreter.ts +var DRAG_THRESHOLD_PX = 3; +var DOUBLE_TAP_TIMER_MS = 505; +var DOUBLE_TAP_THRESHOLD_PX = 30; +function makeSynthetic(type, event) { + const { device, offsetX, offsetY, clientX, clientY, currentX, currentY, sourceEvent } = event; + return { type, device, offsetX, offsetY, clientX, clientY, currentX, currentY, sourceEvent }; +} +function checkDragDistance(dx2, dy2) { + const distanceSquared2 = dx2 * dx2 + dy2 * dy2; + const thresholdSquared = DRAG_THRESHOLD_PX * DRAG_THRESHOLD_PX; + return distanceSquared2 >= thresholdSquared; +} +function checkDoubleTapDistance(t1, t2) { + const dx2 = t1.clientX - t2.clientX; + const dy2 = t1.clientY - t2.clientY; + const distanceSquared2 = dx2 * dx2 + dy2 * dy2; + const thresholdSquared = DOUBLE_TAP_THRESHOLD_PX * DOUBLE_TAP_THRESHOLD_PX; + return distanceSquared2 < thresholdSquared; +} +var DragInterpreter = class { + constructor(widget) { + this.cleanup = new CleanupRegistry(); + this.events = new EventEmitter(); + this.isDragging = false; + this.touch = { distanceTravelledX: 0, distanceTravelledY: 0, clientX: 0, clientY: 0 }; + this.cleanup.register( + widget.addListener("touchstart", this.onTouchStart.bind(this)), + widget.addListener("touchmove", this.onTouchMove.bind(this)), + widget.addListener("touchend", this.onTouchEnd.bind(this)), + widget.addListener("mousemove", this.onMouseMove.bind(this)), + widget.addListener("dblclick", this.onDblClick.bind(this)), + widget.addListener("drag-start", this.onDragStart.bind(this)), + widget.addListener("drag-move", this.onDragMove.bind(this)), + widget.addListener("drag-end", this.onDragEnd.bind(this)) + ); + } + destroy() { + this.cleanup.flush(); + } + onTouchStart(e) { + const { clientX, clientY } = e.sourceEvent.targetTouches[0] ?? { clientX: Infinity, clientY: Infinity }; + this.touch.distanceTravelledX = 0; + this.touch.distanceTravelledY = 0; + this.touch.clientX = clientX; + this.touch.clientY = clientY; + } + onTouchMove(e) { + const { clientX, clientY } = e.sourceEvent.targetTouches[0] ?? { clientX: Infinity, clientY: Infinity }; + this.touch.distanceTravelledX += Math.abs(this.touch.clientX - clientX); + this.touch.distanceTravelledY += Math.abs(this.touch.clientY - clientY); + this.touch.clientX = clientX; + this.touch.clientY = clientY; + } + onTouchEnd(event) { + event.sourceEvent.preventDefault(); + } + onMouseMove(event) { + this.events.emit("mousemove", event); + } + onDblClick(event) { + this.events.emit("dblclick", event); + } + onDragStart(event) { + this.dragStartEvent = event; + } + onDragMove(event) { + if (this.dragStartEvent != null) { + if (checkDragDistance(event.originDeltaX, event.originDeltaY)) { + this.events.emit("drag-start", this.dragStartEvent); + this.events.emit("drag-move", { ...this.dragStartEvent, type: "drag-move" }); + this.dragStartEvent = void 0; + this.isDragging = true; + } + } + if (this.isDragging) { + this.events.emit("drag-move", event); + } + } + onDragEnd(event) { + if (this.isDragging) { + this.events.emit("drag-end", event); + this.isDragging = false; + return; + } + if (event.device === "mouse") { + const click = makeSynthetic("click", event); + this.events.emit("click", click); + } else if (event.sourceEvent.type === "touchend") { + if (checkDragDistance(this.touch.distanceTravelledX, this.touch.distanceTravelledY)) { + return; + } + const click = makeSynthetic("click", event); + this.events.emit("click", click); + const now = Date.now(); + if (this.lastClick !== void 0 && now - this.lastClick.time <= DOUBLE_TAP_TIMER_MS && checkDoubleTapDistance(this.lastClick, event)) { + const dblClick = makeSynthetic("dblclick", event); + this.events.emit("dblclick", dblClick); + this.lastClick = void 0; + } else { + this.lastClick = { time: now, clientX: event.clientX, clientY: event.clientY }; + } + } + } +}; + +// packages/ag-charts-community/src/chart/interaction/widgetSet.ts +var DOMManagerWidget = class extends NativeWidget { + constructor(elem) { + super(elem); + } + addChildToDOM() { + } + removeChildFromDOM() { + } +}; +var WidgetSet = class { + constructor(domManager, opts) { + this.seriesWidget = new DOMManagerWidget(domManager.getParent("series-area")); + this.chartWidget = new DOMManagerWidget(domManager.getParent("canvas-proxy")); + this.containerWidget = new DOMManagerWidget(domManager.getParent("canvas-container")); + this.containerWidget.addChild(this.chartWidget); + this.chartWidget.addChild(this.seriesWidget); + if (opts.withDragInterpretation) { + this.seriesDragInterpreter = new DragInterpreter(this.seriesWidget); + } + } + destroy() { + this.seriesDragInterpreter?.destroy(); + this.seriesWidget.destroy(); + this.chartWidget.destroy(); + this.containerWidget.destroy(); + } +}; + +// packages/ag-charts-community/src/util/number.ts +function clampArray(value, array2) { + const [min, max] = findMinMax(array2); + return clamp(min, value, max); +} +function findMinMax(array2) { + if (array2.length === 0) + return []; + const result = [Infinity, -Infinity]; + for (const val of array2) { + if (val < result[0]) + result[0] = val; + if (val > result[1]) + result[1] = val; + } + return result; +} +function findRangeExtent(array2) { + const [min, max] = findMinMax(array2); + return max - min; +} +function nextPowerOf2(value) { + value = Math.trunc(value); + if (value <= 0) + return 1; + if (value === 1) + return 2; + return 1 << 32 - Math.clz32(value - 1); +} +function previousPowerOf2(value) { + value = Math.trunc(value); + if (value <= 0) + return 0; + if (value === 1) + return 1; + return 1 << 31 - Math.clz32(value); +} + +// packages/ag-charts-community/src/scale/continuousScale.ts +var _ContinuousScale = class _ContinuousScale extends AbstractScale { + constructor(domain = [], range4 = []) { + super(); + this.domain = domain; + this.range = range4; + this.defaultTickCount = _ContinuousScale.defaultTickCount; + this.defaultClamp = false; + } + static is(value) { + return value instanceof _ContinuousScale; + } + normalizeDomains(...domains) { + return normalizeContinuousDomains(...domains); + } + calcBandwidth(smallestInterval = 1, minWidth = 1) { + const { domain } = this; + const rangeDistance = this.getPixelRange(); + if (domain.length === 0) + return rangeDistance; + const intervals = Math.abs(domain[1].valueOf() - domain[0].valueOf()) / smallestInterval + 1; + let bands = intervals; + if (minWidth !== 0) { + const maxBands = Math.floor(rangeDistance); + bands = Math.min(bands, maxBands); + } + return rangeDistance / Math.max(1, bands); + } + convert(value, options) { + const { domain } = this; + if (!domain || domain.length < 2 || value == null) { + return Number.NaN; + } + const { range: range4 } = this; + const clamp2 = options?.clamp ?? this.defaultClamp; + let d0 = domain[0].valueOf(); + let d1 = domain[1].valueOf(); + let x = value.valueOf(); + if (this.transform) { + d0 = this.transform(d0); + d1 = this.transform(d1); + x = this.transform(x); + } + if (clamp2) { + const [start2, stop] = findMinMax([d0, d1]); + if (x < start2) { + return range4[0]; + } else if (x > stop) { + return range4[1]; + } + } + if (d0 === d1) { + return (range4[0] + range4[1]) / 2; + } else if (x === d0) { + return range4[0]; + } else if (x === d1) { + return range4[1]; + } + const r0 = range4[0]; + return r0 + (x - d0) / (d1 - d0) * (range4[1] - r0); + } + invert(x, _nearest) { + const { domain } = this; + if (domain.length < 2) + return; + let d0 = domain[0].valueOf(); + let d1 = domain[1].valueOf(); + if (this.transform) { + d0 = this.transform(d0); + d1 = this.transform(d1); + } + const { range: range4 } = this; + const [r0, r1] = range4; + let d; + if (r0 === r1) { + d = this.toDomain((d0 + d1) / 2); + } else { + d = this.toDomain(d0 + (x - r0) / (r1 - r0) * (d1 - d0)); + } + return this.transformInvert ? this.transformInvert(d) : d; + } + getPixelRange() { + const [a, b] = this.range; + return Math.abs(b - a); + } +}; +_ContinuousScale.defaultTickCount = 5; +var ContinuousScale = _ContinuousScale; +function normalizeContinuousDomains(...domains) { + let min; + let minValue = Infinity; + let max; + let maxValue = -Infinity; + for (const domain of domains) { + for (const d of domain) { + const value = d.valueOf(); + if (value < minValue) { + minValue = value; + min = d; + } + if (value > maxValue) { + maxValue = value; + max = d; + } + } + } + if (min != null && max != null) { + const domain = [min, max]; + return { domain, animatable: true }; + } else { + return { domain: [], animatable: false }; + } +} + +// packages/ag-charts-community/src/scale/bandScale.ts +var _BandScale = class _BandScale extends AbstractScale { + constructor() { + super(...arguments); + this.invalid = true; + this.range = [0, 1]; + this.round = false; + this._bandwidth = 1; + this._step = 1; + this._inset = 1; + this._rawBandwidth = 1; + /** + * The ratio of the range that is reserved for space between bands. + */ + this._paddingInner = 0; + /** + * The ratio of the range that is reserved for space before the first + * and after the last band. + */ + this._paddingOuter = 0; + } + static is(value) { + return value instanceof _BandScale; + } + get bandwidth() { + this.refresh(); + return this._bandwidth; + } + get step() { + this.refresh(); + return this._step; + } + get inset() { + this.refresh(); + return this._inset; + } + get rawBandwidth() { + this.refresh(); + return this._rawBandwidth; + } + set padding(value) { + value = clamp(0, value, 1); + this._paddingInner = value; + this._paddingOuter = value; + } + get padding() { + return this._paddingInner; + } + set paddingInner(value) { + this.invalid = true; + this._paddingInner = clamp(0, value, 1); + } + get paddingInner() { + return this._paddingInner; + } + set paddingOuter(value) { + this.invalid = true; + this._paddingOuter = clamp(0, value, 1); + } + get paddingOuter() { + return this._paddingOuter; + } + refresh() { + if (!this.invalid) + return; + this.invalid = false; + this.update(); + if (this.invalid) { + logger_exports.warnOnce("Expected update to not invalidate scale"); + } + } + convert(d, options) { + this.refresh(); + const i = this.findIndex(d, options?.alignment); + if (i == null || i < 0 || i >= this.bands.length) { + return Number.NaN; + } + return this.ordinalRange(i); + } + invertNearestIndex(position) { + this.refresh(); + const bandCount = this.bands.length; + if (bandCount === 0) + return -1; + let low = 0; + let high = bandCount - 1; + let closestDistance = Infinity; + let closestIndex = 0; + while (low <= high) { + const mid = Math.trunc((high + low) / 2); + const p = this.ordinalRange(mid); + const distance2 = Math.abs(p - position); + if (distance2 === 0) + return mid; + if (distance2 < closestDistance) { + closestDistance = distance2; + closestIndex = mid; + } + if (p < position) { + low = mid + 1; + } else { + high = mid - 1; + } + } + return closestIndex; + } + update() { + const [r0, r1] = this.range; + let { _paddingInner: paddingInner } = this; + const { _paddingOuter: paddingOuter, bands } = this; + const bandCount = bands.length; + if (bandCount === 0) + return; + const rangeDistance = r1 - r0; + let rawStep; + if (bandCount === 1) { + paddingInner = 0; + rawStep = rangeDistance * (1 - paddingOuter * 2); + } else { + rawStep = rangeDistance / Math.max(1, bandCount - paddingInner + paddingOuter * 2); + } + const round4 = this.round && Math.floor(rawStep) > 0; + const step = round4 ? Math.floor(rawStep) : rawStep; + let inset = r0 + (rangeDistance - step * (bandCount - paddingInner)) / 2; + let bandwidth = step * (1 - paddingInner); + if (round4) { + inset = Math.round(inset); + bandwidth = Math.round(bandwidth); + } + this._step = step; + this._inset = inset; + this._bandwidth = bandwidth; + this._rawBandwidth = rawStep * (1 - paddingInner); + } + ordinalRange(i) { + const { _inset: inset, _step: step, range: range4 } = this; + const min = Math.min(range4[0], range4[1]); + const max = Math.max(range4[0], range4[1]); + return clamp(min, inset + step * i, max); + } +}; +__decorateClass([ + Invalidating +], _BandScale.prototype, "range", 2); +__decorateClass([ + Invalidating +], _BandScale.prototype, "round", 2); +var BandScale = _BandScale; + +// packages/ag-charts-community/src/scale/discreteTimeScale.ts +var DiscreteTimeScale = class _DiscreteTimeScale extends BandScale { + static is(value) { + return value instanceof _DiscreteTimeScale; + } + toDomain(value) { + return new Date(value); + } + get reversed() { + const { domain } = this; + return domain.length > 0 && domain[0].valueOf() > domain.at(-1).valueOf(); + } + convert(value, options) { + this.refresh(); + if (!(value instanceof Date)) + value = new Date(value); + const { domain, bands, reversed } = this; + if (domain.length <= 0) + return Number.NaN; + const r0 = this.ordinalRange(0); + const r1 = this.ordinalRange(bands.length - 1); + if (bands.length === 0) + return r0; + if (options?.clamp === true) { + const { range: range4 } = this; + if (value < bands[0]) + return range4[0]; + if (value > bands.at(-1)) + return range4[1]; + } + const alignment = options?.alignment ?? 0 /* Leading */; + if (alignment !== 2 /* Interpolate */) { + const r2 = super.convert(value, options); + return reversed ? r1 - (r2 - r0) : r2; + } + const v = value.valueOf(); + let bandIndex = this.findIndex(value) ?? 0; + let dIndex; + if (reversed) { + bandIndex = Math.min(Math.max(bandIndex, 1), bands.length - 1); + dIndex = -1; + } else { + bandIndex = Math.min(Math.max(bandIndex, 0), bands.length - 2); + dIndex = 1; + } + const v0 = bands[bandIndex].valueOf(); + const v1 = bands[bandIndex + dIndex].valueOf(); + const vr0 = this.ordinalRange(bandIndex); + const vr1 = this.ordinalRange(bandIndex + dIndex); + const ratio2 = (v - v0) / (v1 - v0); + const r = ratio2 * (vr1 - vr0) + vr0; + return reversed ? r1 - (r - r0) : r; + } + invert(position, nearest = false) { + this.refresh(); + const { domain, bands } = this; + if (domain.length <= 0) + return; + const reversed = domain[0].valueOf() > domain.at(-1).valueOf(); + let index; + if (nearest) { + index = this.invertNearestIndex(position - this.bandwidth / 2); + } else { + const closestIndex = findMinIndex(0, bands.length - 1, (i) => { + const p = this.ordinalRange(i); + return p >= position; + }); + index = closestIndex ?? bands.length - 1; + } + return bands[reversed ? bands.length - 1 - index : index]; + } + findIndex(value, alignment = 0 /* Leading */) { + const { bands } = this; + const target = value.valueOf(); + if (alignment === 1 /* Trailing */) { + return findMinIndex(0, bands.length - 1, (index) => bands[index].valueOf() >= target); + } + return findMaxIndex(0, bands.length - 1, (index) => bands[index].valueOf() <= target); + } +}; + +// packages/ag-charts-community/src/util/vector4.ts +var Vec4 = { + bottomCenter, + center, + clone, + collides, + end: end2, + from, + height, + round, + start, + topCenter, + origin, + width +}; +function start(a) { + return { x: a.x1, y: a.y1 }; +} +function end2(a) { + return { x: a.x2, y: a.y2 }; +} +function topCenter(a) { + return { x: (a.x1 + a.x2) / 2, y: Math.min(a.y1, a.y2) }; +} +function center(a) { + return { x: (a.x1 + a.x2) / 2, y: (a.y1 + a.y2) / 2 }; +} +function bottomCenter(a) { + return { x: (a.x1 + a.x2) / 2, y: Math.max(a.y1, a.y2) }; +} +function width(a) { + return Math.abs(a.x2 - a.x1); +} +function height(a) { + return Math.abs(a.y2 - a.y1); +} +function round(a) { + return { x1: Math.round(a.x1), y1: Math.round(a.y1), x2: Math.round(a.x2), y2: Math.round(a.y2) }; +} +function clone(a) { + return { x1: a.x1, y1: a.y1, x2: a.x2, y2: a.y2 }; +} +function collides(a, b) { + const an = normalise(a); + const bn = normalise(b); + return an.x1 <= bn.x2 && an.x2 >= bn.x1 && an.y1 <= bn.y2 && an.y2 >= bn.y1; +} +function normalise(a) { + return { x1: Math.min(a.x1, a.x2), x2: Math.max(a.x1, a.x2), y1: Math.min(a.y1, a.y2), y2: Math.max(a.y1, a.y2) }; +} +function from(a, b, c, d) { + if (typeof a === "number") { + return { x1: a, y1: b, x2: c, y2: d }; + } + if ("width" in a) { + return normalise({ + x1: a.x, + y1: a.y, + x2: a.x + a.width, + y2: a.y + a.height + }); + } + throw new Error(`Values can not be converted into a vector4: [${JSON.stringify(a)}] [${b}] [${c}] [${d}]`); +} +function origin() { + return { x1: 0, y1: 0, x2: 0, y2: 0 }; +} + +// packages/ag-charts-community/src/util/panToBBox.ts +function normalize(screenMin, min, screenMax, max, target) { + return min + (max - min) * ((target - screenMin) / (screenMax - screenMin)); +} +function unnormalize(screenMin, min, screenMax, max, ratio2) { + return screenMin + (ratio2 - min) * ((screenMax - screenMin) / (max - min)); +} +function calcWorldAxis(viewportMin, viewportMax, ratio2) { + return [ + unnormalize(viewportMin, ratio2.min, viewportMax, ratio2.max, 0), + unnormalize(viewportMin, ratio2.min, viewportMax, ratio2.max, 1) + ]; +} +function calcWorldVec4(viewport, ratioX, ratioY) { + const [x1, x2] = calcWorldAxis(viewport.x1, viewport.x2, ratioX); + const [y1, y2] = calcWorldAxis(viewport.y1, viewport.y2, ratioY); + return { x1, x2, y1, y2 }; +} +function panAxesUnnormalized(worldMin, worldMax, viewportMin, viewportMax, targetMin, targetMax) { + if (viewportMin <= targetMin && targetMax <= viewportMax) + return viewportMin; + const minDiff = targetMin - viewportMin; + const maxDiff = targetMax - viewportMax; + const diff8 = Math.abs(minDiff) < Math.abs(maxDiff) ? minDiff : maxDiff; + return clamp(worldMin, viewportMin + diff8, worldMax); +} +function calcPanToBBoxRatios(viewportBBox, ratios, targetBBox) { + const { x: ratioX = { min: 0, max: 1 }, y: ratioY = { min: 0, max: 1 } } = ratios; + const target = Vec4.from(targetBBox); + const viewport = Vec4.from(viewportBBox); + const world = calcWorldVec4(viewport, ratioX, ratioY); + const x = panAxesUnnormalized(world.x1, world.x2, viewport.x1, viewport.x2, target.x1, target.x2); + const y = panAxesUnnormalized(world.y1, world.y2, viewport.y1, viewport.y2, target.y1, target.y2); + const result = { + x: { + min: normalize(viewport.x1, ratioX.min, viewport.x2, ratioX.max, x), + max: normalize(viewport.x1, ratioX.min, viewport.x2, ratioX.max, x + viewportBBox.width) + }, + y: { + min: normalize(viewport.y1, ratioY.min, viewport.y2, ratioY.max, y), + max: normalize(viewport.y1, ratioY.min, viewport.y2, ratioY.max, y + viewportBBox.height) + } + }; + const diffX = result.x.max - result.x.min; + const diffY = result.y.max - result.y.min; + result.x.min = clamp(0, result.x.min, 1 - diffX); + result.x.max = result.x.min + diffX; + result.y.min = clamp(0, result.y.min, 1 - diffY); + result.y.max = result.y.min + diffY; + return result; +} + +// packages/ag-charts-community/src/chart/rangeAlignment.ts +function rangeAlignment(start2, end3) { + const startValue = start2?.valueOf(); + const endValue = end3?.valueOf(); + if (typeof startValue !== "number" || typeof endValue !== "number") + return [void 0, void 0]; + return startValue < endValue ? [0 /* Leading */, 1 /* Trailing */] : [1 /* Trailing */, 0 /* Leading */]; +} + +// packages/ag-charts-community/src/chart/interaction/zoomManager.ts +var ZoomManagerAutoScaleAxis = class { + constructor() { + this.enabled = false; + this.padding = 0; + this.manuallyAdjusted = false; + } +}; +var rangeValidator = (axis) => attachDescription((value, { options }) => { + if (!ContinuousScale.is(axis?.scale) && !DiscreteTimeScale.is(axis?.scale)) + return true; + if (value == null || options.end == null) + return true; + return value < options.end; +}, `to be less than end`); +var ZoomManager = class extends BaseManager { + constructor(eventsHub, fireChartEvent) { + super(); + this.eventsHub = eventsHub; + this.fireChartEvent = fireChartEvent; + this.mementoOriginatorKey = "zoom"; + this.axisZoomManagers = /* @__PURE__ */ new Map(); + this.state = new StateTracker(void 0, "initial"); + this.axes = []; + this.didLayoutAxes = false; + this.autoScaleYAxis = new ZoomManagerAutoScaleAxis(); + this.lastRestoredState = void 0; + this.independentAxes = false; + this.navigatorModule = false; + this.zoomModule = false; + // The initial state memento can not be restored until the chart has performed its first layout. Instead save it as + // pending and restore then delete it on the first layout. + this.pendingMemento = void 0; + this.boundFireOnceChartEvent = this.fireOnceChartEvent.bind(this); + this.cleanup.register( + eventsHub.on("layout:complete", () => { + this.didLayoutAxes = true; + const { pendingMemento } = this; + if (pendingMemento) { + this.restoreMemento(pendingMemento.version, pendingMemento.mementoVersion, pendingMemento.memento); + } + this.autoScaleYZoom("zoom-manager"); + }) + ); + } + createMemento() { + return this.getMementoRanges(); + } + guardMemento(blob, messages) { + if (blob == null) + return true; + if (!isObject(blob)) + return false; + const primaryX = this.getPrimaryAxis("x" /* X */); + const primaryY = this.getPrimaryAxis("y" /* Y */); + const zoomMementoDefs = { + rangeX: { start: rangeValidator(primaryX), end: defined }, + rangeY: { start: rangeValidator(primaryY), end: defined }, + ratioX: { start: defined, end: defined }, + ratioY: { start: defined, end: defined }, + autoScaledAxes: defined + }; + const { invalid } = validate(blob, zoomMementoDefs); + if (invalid.length > 0) { + messages.push(...invalid.map(String)); + return false; + } + return true; + } + restoreMemento(version, mementoVersion, memento) { + const { independentAxes } = this; + if (!this.axes || !this.didLayoutAxes) { + this.pendingMemento = { version, mementoVersion, memento }; + return; + } + this.pendingMemento = void 0; + const zoom = this.getDefinedZoom(); + if (memento?.rangeX) { + zoom.x = this.rangeToRatio(memento.rangeX, "x" /* X */) ?? { min: 0, max: 1 }; + } else if (memento?.ratioX) { + zoom.x = { + min: memento.ratioX.start ?? 0, + max: memento.ratioX.end ?? 1 + }; + } else { + zoom.x = { min: 0, max: 1 }; + } + if (!this.navigatorModule || this.zoomModule) { + let yAutoScale = memento?.autoScaledAxes?.includes("y"); + if (memento?.rangeY) { + yAutoScale ?? (yAutoScale = false); + zoom.y = this.rangeToRatio(memento.rangeY, "y" /* Y */) ?? { min: 0, max: 1 }; + } else if (memento?.ratioY) { + yAutoScale ?? (yAutoScale = false); + zoom.y = { + min: memento.ratioY.start ?? 0, + max: memento.ratioY.end ?? 1 + }; + } else { + yAutoScale ?? (yAutoScale = true); + const autoZoomY = yAutoScale ? this.getAutoScaleYZoom(zoom.x) : void 0; + zoom.y = autoZoomY ?? { min: 0, max: 1 }; + } + zoom.autoScaleYAxis = yAutoScale; + } + this.lastRestoredState = zoom; + if (independentAxes !== true) { + this.updateZoom("zoom-manager", zoom); + return; + } + const primaryX = this.getPrimaryAxis("x" /* X */); + const primaryY = this.getPrimaryAxis("y" /* Y */); + for (const axis of [primaryX, primaryY]) { + if (!axis) + continue; + this.updateAxisZoom("zoom-manager", axis.id, zoom[axis.direction]); + } + } + updateAxes(nextAxes) { + const { axes, axisZoomManagers } = this; + const existingZoomManagers = new Map(axisZoomManagers); + axisZoomManagers.clear(); + axes.length = 0; + for (const axis of nextAxes) { + if (typeof axis === "string") { + axisZoomManagers.set(axis, existingZoomManagers.get(axis) ?? new AxisZoomManager(axis)); + } else { + axes.push(axis); + axisZoomManagers.set(axis.id, existingZoomManagers.get(axis.id) ?? new AxisZoomManager(axis)); + } + } + if (this.state.size > 0 && axes.length > 0) { + this.updateZoom(this.state.stateId(), this.state.stateValue()); + } + } + setIndependentAxes(independent = true) { + this.independentAxes = independent; + } + setAutoScaleYAxis(enabled, padding2) { + this.autoScaleYAxis.enabled = enabled; + this.autoScaleYAxis.padding = padding2; + if (enabled) { + this.autoScaleYZoom("toggle-auto-scale"); + } + } + setNavigatorEnabled(enabled = true) { + this.navigatorModule = enabled; + } + setZoomModuleEnabled(enabled = true) { + this.zoomModule = enabled; + } + isNavigatorEnabled() { + return this.navigatorModule; + } + isZoomEnabled() { + return this.zoomModule; + } + updateZoom(callerId, newZoom) { + if (newZoom?.x && (newZoom.x.min < 0 || newZoom.x.max > 1)) { + logger_exports.warnOnce( + `Attempted to update x-axis zoom to an invalid ratio of [{ min: ${newZoom.x.min}, max: ${newZoom.x.max} }], expecting a ratio of 0 to 1, ignoring.` + ); + newZoom.x = void 0; + } + if (newZoom?.y && (newZoom.y.min < 0 || newZoom.y.max > 1)) { + logger_exports.warnOnce( + `Attempted to update y-axis zoom to an invalid ratio of [{ min: ${newZoom.y.min}, max: ${newZoom.y.max} }], expecting a ratio of 0 to 1, ignoring.` + ); + newZoom.y = void 0; + } + if (this.axisZoomManagers.size === 0) { + const stateId = this.state.stateId(); + if (stateId === "initial" || stateId === callerId) { + this.state.set(callerId, newZoom); + } + return; + } + this.state.set(callerId, newZoom); + const autoScaleYAxis = newZoom?.autoScaleYAxis; + if (autoScaleYAxis != null) { + this.autoScaleYAxis.manuallyAdjusted = !autoScaleYAxis; + } + for (const axis of this.axisZoomManagers.values()) { + axis.updateZoom(callerId, newZoom?.[axis.direction]); + } + this.applyChanges(callerId); + } + updateAxisZoom(callerId, axisId, newZoom) { + this.axisZoomManagers.get(axisId)?.updateZoom(callerId, newZoom); + this.applyChanges(callerId); + } + resetZoom(callerId) { + this.autoScaleYAxis.manuallyAdjusted = false; + const zoom = this.getRestoredZoom(); + this.updateZoom(callerId, { + x: { min: zoom?.x?.min ?? 0, max: zoom?.x?.max ?? 1 }, + y: { min: zoom?.y?.min ?? 0, max: zoom?.y?.max ?? 1 }, + autoScaleYAxis: zoom?.autoScaleYAxis ?? true + }); + } + resetAxisZoom(callerId, axisId) { + const axisZoomManager = this.axisZoomManagers.get(axisId); + const direction = axisZoomManager?.direction; + if (direction == null) + return; + const restoredZoom = this.getRestoredZoom(); + if (direction === "y" /* Y */) { + const autoScaleYAxis = restoredZoom?.autoScaleYAxis ?? true; + this.autoScaleYAxis.manuallyAdjusted = !autoScaleYAxis; + } + for (const axis of this.axes) { + if (axis.direction !== direction) + continue; + this.updateAxisZoom(callerId, axis.id, restoredZoom?.[direction] ?? { min: 0, max: 1 }); + } + } + setAxisManuallyAdjusted(_callerId, axisId) { + const direction = this.axisZoomManagers.get(axisId)?.direction; + if (direction !== "y" /* Y */) + return; + this.autoScaleYAxis.manuallyAdjusted = true; + } + updatePrimaryAxisZoom(callerId, direction, newZoom) { + const primaryAxis = this.getPrimaryAxis(direction); + if (!primaryAxis) + return; + this.updateAxisZoom(callerId, primaryAxis.id, newZoom); + } + panToBBox(callerId, seriesRect, target) { + if (!this.isZoomEnabled() && !this.isNavigatorEnabled()) + return false; + const zoom = this.getZoom(); + if (zoom === void 0 || !zoom.x && !zoom.y) + return false; + const panIsPossible = seriesRect.width > 0 && seriesRect.height > 0 && Math.abs(target.width) <= Math.abs(seriesRect.width) && Math.abs(target.height) <= Math.abs(seriesRect.height); + if (!panIsPossible) { + logger_exports.warnOnce(`cannot pan to target BBox - chart too small?`); + return false; + } + const newZoom = calcPanToBBoxRatios(seriesRect, zoom, target); + if (this.independentAxes) { + this.updatePrimaryAxisZoom(callerId, "x" /* X */, newZoom.x); + this.updatePrimaryAxisZoom(callerId, "y" /* Y */, newZoom.y); + } else { + this.updateZoom(callerId, newZoom); + } + return true; + } + // Fire this event to signal to listeners that the view is changing through a zoom and/or pan change. + fireZoomPanStartEvent(callerId) { + this.eventsHub.emit("zoom:pan-start", { callerId }); + } + extendToEnd(callerId, direction, extent3) { + return this.extendWith(callerId, direction, (end3) => Number(end3) - extent3); + } + extendWith(callerId, direction, fn) { + const axis = this.getPrimaryAxis(direction); + if (!axis) + return; + const extents = this.getDomainExtents(axis); + if (!extents) + return; + const [, end3] = extents; + const start2 = fn(end3); + const ratio2 = this.rangeToRatio({ start: start2 }, direction); + if (!ratio2) + return; + this.updateZoom(callerId, { [direction]: ratio2 }); + } + updateWith(callerId, direction, fn) { + const axis = this.getPrimaryAxis(direction); + if (!axis) + return; + const extents = this.getDomainExtents(axis); + if (!extents) + return; + let [start2, end3] = extents; + [start2, end3] = fn(start2, end3); + const ratio2 = this.rangeToRatio({ start: start2, end: end3 }, direction); + if (!ratio2) + return; + this.updateZoom(callerId, { [direction]: ratio2 }); + } + getZoom() { + let x; + let y; + for (const axis of this.axisZoomManagers.values()) { + if (axis.direction === "x" /* X */) { + x ?? (x = axis.getZoom()); + } else if (axis.direction === "y" /* Y */) { + y ?? (y = axis.getZoom()); + } + } + if (x || y) { + return { x, y }; + } + } + getAxisZoom(axisId) { + return this.axisZoomManagers.get(axisId)?.getZoom() ?? { min: 0, max: 1 }; + } + getAxisZooms() { + const axes = {}; + for (const [axisId, axis] of this.axisZoomManagers.entries()) { + axes[axisId] = { + direction: axis.direction, + zoom: axis.getZoom() + }; + } + return axes; + } + getRestoredZoom() { + return this.lastRestoredState; + } + getPrimaryAxisId(direction) { + return this.getPrimaryAxis(direction)?.id; + } + getBoundSeries() { + const xAxis = this.getPrimaryAxis("x" /* X */); + const yAxis = this.getPrimaryAxis("y" /* Y */); + let boundSeries; + if (this.independentAxes) { + const xBoundSeries = new Set(xAxis?.boundSeries ?? []); + const yBoundSeries = new Set(yAxis?.boundSeries ?? []); + boundSeries = /* @__PURE__ */ new Set(); + for (const series of xBoundSeries) { + if (yBoundSeries.has(series)) { + boundSeries.add(series); + } + } + } else { + boundSeries = /* @__PURE__ */ new Set([...xAxis?.boundSeries ?? [], ...yAxis?.boundSeries ?? []]); + } + return boundSeries; + } + constrainZoomToItemCount(zoom, minVisibleItems) { + const { autoScaleYAxis } = this; + const shouldAutoscale = autoScaleYAxis.enabled && !autoScaleYAxis.manuallyAdjusted; + let xVisibleRange = [zoom.x.min, zoom.x.max]; + let yVisibleRange = shouldAutoscale ? void 0 : [zoom.y.min, zoom.y.max]; + for (const series of this.getBoundSeries()) { + const nextZoom = series.getZoomRangeFittingItems(xVisibleRange, yVisibleRange, minVisibleItems); + if (nextZoom == null) + return; + xVisibleRange = nextZoom.x; + yVisibleRange = nextZoom.y; + } + const xZoom = { min: xVisibleRange[0], max: xVisibleRange[1] }; + let yZoom; + yZoom ?? (yZoom = this.getAutoScaleYZoom(xZoom)); + if (yVisibleRange) { + yZoom = { min: yVisibleRange[0], max: yVisibleRange[1] }; + } + if (yZoom == null) + return; + return { x: xZoom, y: yZoom }; + } + isVisibleItemsCountAtLeast(zoom, minVisibleItems, includeYVisibleRange) { + const { autoScaleYAxis } = this; + const boundSeries = this.getBoundSeries(); + const xVisibleRange = [zoom.x.min, zoom.x.max]; + const yVisibleRange = !includeYVisibleRange && autoScaleYAxis.enabled && !autoScaleYAxis.manuallyAdjusted ? void 0 : [zoom.y.min, zoom.y.max]; + let visibleItemsCount = 0; + for (const series of boundSeries) { + const remainingItems = minVisibleItems - (visibleItemsCount ?? 0); + const seriesVisibleItems = series.getVisibleItems(xVisibleRange, yVisibleRange, remainingItems); + visibleItemsCount += seriesVisibleItems; + if (visibleItemsCount >= minVisibleItems) + return true; + } + return boundSeries.size === 0; + } + getMementoRanges() { + const zoom = this.getDefinedZoom(); + let autoScaledAxes; + if (this.autoScaleYAxis.enabled) { + autoScaledAxes = this.autoScaleYAxis.manuallyAdjusted ? [] : ["y"]; + } + const memento = { + rangeX: this.getRangeDirection(zoom.x, "x" /* X */), + rangeY: this.getRangeDirection(zoom.y, "y" /* Y */), + ratioX: { start: zoom.x.min, end: zoom.x.max }, + ratioY: { start: zoom.y.min, end: zoom.y.max }, + autoScaledAxes + }; + return memento; + } + getAutoScaleYZoom(zoomX) { + if (!this.isZoomEnabled()) + return; + const { independentAxes, autoScaleYAxis } = this; + if (!autoScaleYAxis.enabled || autoScaleYAxis.manuallyAdjusted) + return; + const { padding: padding2 } = autoScaleYAxis; + let yZoom; + if (independentAxes) { + yZoom = this.primaryAxisZoom("y" /* Y */, zoomX, { padding: padding2 }); + } else { + yZoom = this.combinedAxisZoom("y" /* Y */, zoomX, { padding: padding2 }); + } + if (zoomX.min === 0 && zoomX.max === 1) { + return yZoom == null ? void 0 : { min: 0, max: 1 }; + } else { + return yZoom; + } + } + autoScaleYZoom(callerId, applyChanges = true) { + const { independentAxes } = this; + const zoom = this.getZoom(); + if (zoom?.x == null) + return; + const zoomY = this.getAutoScaleYZoom(zoom.x); + if (zoomY == null || objectsEqual(zoom.y, zoomY)) + return; + if (independentAxes) { + const primaryAxis = this.getPrimaryAxis("y" /* Y */); + const primaryAxisManager = primaryAxis == null ? void 0 : this.axisZoomManagers.get(primaryAxis.id); + primaryAxisManager?.updateZoom("zoom-manager", zoomY); + } else { + for (const axisZoomManager of this.axisZoomManagers.values()) { + if (axisZoomManager.direction === "y" /* Y */) { + axisZoomManager.updateZoom("zoom-manager", zoomY); + } + } + } + if (applyChanges) { + this.applyChanges(callerId); + } + } + applyChanges(callerId) { + this.autoScaleYZoom(callerId, false); + const changed = Array.from(this.axisZoomManagers.values(), (axis) => axis.applyChanges()).includes(true); + if (!changed) { + return; + } + const axes = {}; + for (const [axisId, axis] of this.axisZoomManagers.entries()) { + axes[axisId] = axis.getZoom(); + } + this.eventsHub.emit("zoom:change", { ...this.getZoom(), axes, callerId }); + this.eventsHub.on("layout:complete", this.boundFireOnceChartEvent); + } + fireOnceChartEvent() { + this.fireChartEvent({ type: "zoom", ...this.getMementoRanges() }); + this.eventsHub.off("layout:complete", this.boundFireOnceChartEvent); + } + getRangeDirection(ratio2, direction) { + const axis = this.getPrimaryAxis(direction); + if (!axis || !ContinuousScale.is(axis.scale) && !DiscreteTimeScale.is(axis.scale)) + return; + const extents = this.getDomainPixelExtents(axis); + if (!extents) + return; + const [d0, d1] = extents; + let start2; + let end3; + if (d0 <= d1) { + start2 = axis.scale.invert(0); + end3 = axis.scale.invert(d0 + (d1 - d0) * ratio2.max); + } else { + start2 = axis.scale.invert(d0 - (d0 - d1) * ratio2.min); + end3 = axis.scale.invert(0); + } + return { start: start2, end: end3 }; + } + rangeToRatio(range4, direction) { + const axis = this.getPrimaryAxis(direction); + if (!axis) + return; + const extents = this.getDomainPixelExtents(axis); + if (!extents) + return; + const [d0, d1] = extents; + const { scale: scale2 } = axis; + const { start: start2, end: end3 } = range4; + const [startAlignment = 0 /* Leading */, endAlignment = 1 /* Trailing */] = rangeAlignment( + start2, + end3 + ); + let r0 = start2 == null ? d0 : scale2.convert(start2, { alignment: startAlignment }); + let r1 = end3 == null ? d1 : scale2.convert(end3, { alignment: endAlignment }) + (scale2.bandwidth ?? 0); + if (!isFiniteNumber(r0) || !isFiniteNumber(r1)) + return; + const [dMin, dMax] = [Math.min(d0, d1), Math.max(d0, d1)]; + if (r0 < dMin || r0 > dMax) { + logger_exports.warnOnce( + `Invalid range start [${start2}], expecting a value between [${scale2.invert(d0)}] and [${scale2.invert(d1)}], ignoring.` + ); + return; + } + if (r1 < dMin || r1 > dMax) { + logger_exports.warnOnce( + `Invalid range end [${end3}], expecting a value between [${scale2.invert(d0)}] and [${scale2.invert(d1)}], ignoring.` + ); + return; + } + r0 = Math.min(dMax, Math.max(dMin, r0)); + r1 = Math.min(dMax, Math.max(dMin, r1)); + const diff8 = d1 - d0; + if (diff8 === 0) + return; + const min = Math.abs((r0 - d0) / diff8); + const max = Math.abs((r1 - d0) / diff8); + if (min >= max) + return; + return { min, max }; + } + getPrimaryAxis(direction) { + return this.axes?.find((a) => a.direction === direction); + } + getDomainExtents(axis) { + const { domain } = axis.scale; + const d0 = domain.at(0); + const d1 = domain.at(-1); + if (d0 == null || d1 == null) + return; + return [d0, d1]; + } + getDomainPixelExtents(axis) { + const [d0, d1] = axis.scale.range; + if (!isFiniteNumber(d0) || !isFiniteNumber(d1)) + return; + return [d0, d1]; + } + getDefinedZoom() { + const zoom = this.getZoom(); + return { + x: { min: zoom?.x?.min ?? 0, max: zoom?.x?.max ?? 1 }, + y: { min: zoom?.y?.min ?? 0, max: zoom?.y?.max ?? 1 } + }; + } + zoomBounds(xAxis, yAxis, zoom, padding2) { + const xScale = xAxis.scale; + const xScaleRange = xScale.range; + xScale.range = [0, 1]; + const yScale = yAxis.scale; + const yScaleRange = yScale.range; + yScale.range = [0, 1]; + let min = 1; + let minPadding = false; + let max = 0; + let maxPadding = false; + for (const series of yAxis.boundSeries) { + if (!series.visible) + continue; + const { connectsToYAxis } = series; + const yValues = series.getRange("y" /* Y */, [zoom.min, zoom.max]); + for (const yValue of yValues) { + const y = yScale.convert(yValue); + if (!Number.isFinite(y)) + continue; + if (y < min) { + min = y; + minPadding = !connectsToYAxis || yValue < 0; + } + if (y > max) { + max = y; + maxPadding = !connectsToYAxis || yValue > 0; + } + } + } + if (isFiniteNumber(yAxis.min)) { + min = 0; + } + if (isFiniteNumber(yAxis.max)) { + max = 1; + } + xScale.range = xScaleRange; + yScale.range = yScaleRange; + if (min >= max) + return; + const totalPadding = (minPadding ? padding2 : 0) + (maxPadding ? padding2 : 0); + const paddedDelta = Math.min((max - min) * (1 + totalPadding), 1); + if (paddedDelta <= 0) + return; + if (minPadding && maxPadding) { + const mid = (max + min) / 2; + min = mid - paddedDelta / 2; + max = mid + paddedDelta / 2; + } else if (!minPadding && maxPadding) { + max = min + paddedDelta; + } else if (minPadding && !maxPadding) { + min = max - paddedDelta; + } + if (min < 0) { + max += -min; + min = 0; + } else if (max > 1) { + min -= max - 1; + max = 1; + } + return { min, max }; + } + primaryAxisZoom(direction, zoom, { padding: padding2 = 0 } = {}) { + const crossDirection = direction === "x" /* X */ ? "y" /* Y */ : "x" /* X */; + const xAxis = this.getPrimaryAxis(crossDirection); + const yAxis = this.getPrimaryAxis(direction); + if (xAxis == null || yAxis == null) + return; + return this.zoomBounds(xAxis, yAxis, zoom, padding2); + } + combinedAxisZoom(direction, zoom, { padding: padding2 = 0 } = {}) { + const crossDirection = direction === "x" /* X */ ? "y" /* Y */ : "x" /* X */; + const seriesXAxes = /* @__PURE__ */ new Map(); + for (const xAxis of this.axes) { + if (xAxis.direction !== crossDirection) + continue; + for (const series of xAxis.boundSeries) { + seriesXAxes.set(series, xAxis); + } + } + let min = 1; + let max = 0; + for (const yAxis of this.axes) { + if (yAxis.direction !== direction) + continue; + for (const series of yAxis.boundSeries) { + const xAxis = seriesXAxes.get(series); + if (xAxis == null) + continue; + const bounds = this.zoomBounds(xAxis, yAxis, zoom, padding2); + if (bounds == null) + return; + min = Math.min(min, bounds.min); + max = Math.max(max, bounds.max); + } + } + const delta4 = 1e-6; + if (min < delta4) + min = 0; + if (max > 1 - delta4) + max = 1; + if (min > max) + return; + return { min, max }; + } +}; +var AxisZoomManager = class { + constructor(axis) { + let min; + let max; + if (typeof axis === "string") { + this.direction = axis; + min = 0; + max = 1; + } else { + this.direction = axis.direction; + [min = 0, max = 1] = axis.visibleRange; + } + this.state = new StateTracker({ min, max }); + this.currentZoom = this.state.stateValue(); + } + updateZoom(callerId, newZoom) { + this.state.set(callerId, newZoom); + } + getZoom() { + return deepClone(this.state.stateValue()); + } + hasChanges() { + const currentZoom = this.currentZoom; + const pendingZoom = this.state.stateValue(); + return currentZoom.min !== pendingZoom.min || currentZoom.max !== pendingZoom.max; + } + applyChanges() { + const hasChanges = this.hasChanges(); + this.currentZoom = this.state.stateValue(); + return hasChanges; + } +}; + +// packages/ag-charts-community/src/chart/layout/layoutManager.ts +var LayoutElement = /* @__PURE__ */ ((LayoutElement6) => { + LayoutElement6[LayoutElement6["Caption"] = 0] = "Caption"; + LayoutElement6[LayoutElement6["Legend"] = 1] = "Legend"; + LayoutElement6[LayoutElement6["ToolbarLeft"] = 2] = "ToolbarLeft"; + LayoutElement6[LayoutElement6["ToolbarBottom"] = 3] = "ToolbarBottom"; + LayoutElement6[LayoutElement6["Navigator"] = 4] = "Navigator"; + LayoutElement6[LayoutElement6["Overlay"] = 5] = "Overlay"; + return LayoutElement6; +})(LayoutElement || {}); +var LayoutManager = class { + constructor(eventsHub) { + this.eventsHub = eventsHub; + this.elements = /* @__PURE__ */ new Map(); + } + registerElement(element2, listener) { + if (this.elements.has(element2)) { + this.elements.get(element2).add(listener); + } else { + this.elements.set(element2, /* @__PURE__ */ new Set([listener])); + } + return () => this.elements.get(element2)?.delete(listener); + } + createContext(width2, height2) { + const context = new LayoutContext(width2, height2); + for (const element2 of Object.values(LayoutElement)) { + if (typeof element2 !== "number") + continue; + const listeners = this.elements.get(element2); + if (listeners) { + for (const listener of listeners) { + listener(context); + } + } + } + return context; + } + emitLayoutComplete(context, options) { + const { width: width2, height: height2 } = context; + this.eventsHub.emit("layout:complete", { + axes: options.axes ?? [], + chart: { width: width2, height: height2 }, + clipSeries: options.clipSeries ?? false, + series: options.series + }); + } +}; +var LayoutContext = class { + constructor(width2, height2) { + this.width = width2; + this.height = height2; + this.layoutBox = new BBox(0, 0, width2, height2); + } +}; + +// packages/ag-charts-community/src/scene/util/labelPlacement.ts +function circleRectOverlap({ point: c, anchor: unitCenter }, x, y, w, h) { + if (c.size === 0) { + return false; + } + let cx = c.x; + let cy = c.y; + if (unitCenter != null) { + cx -= (unitCenter.x - 0.5) * c.size; + cy -= (unitCenter.y - 0.5) * c.size; + } + let edgeX = cx; + if (cx < x) { + edgeX = x; + } else if (cx > x + w) { + edgeX = x + w; + } + let edgeY = cy; + if (cy < y) { + edgeY = y; + } else if (cy > y + h) { + edgeY = y + h; + } + const dx2 = cx - edgeX; + const dy2 = cy - edgeY; + const d = Math.hypot(dx2, dy2); + return d <= c.size / 2; +} +function isPointLabelDatum(x) { + return x != null && typeof x.point === "object" && typeof x.label === "object"; +} +var labelPlacements = { + top: { x: 0, y: -1 }, + bottom: { x: 0, y: 1 }, + left: { x: -1, y: 0 }, + right: { x: 1, y: 0 }, + "top-left": { x: -1, y: -1 }, + "top-right": { x: 1, y: -1 }, + "bottom-left": { x: -1, y: 1 }, + "bottom-right": { x: 1, y: 1 } +}; +function placeLabels(data, bounds, padding2 = 5) { + const result = /* @__PURE__ */ new Map(); + const previousResults = []; + const sortedDataClone = new Map( + Array.from(data.entries(), ([k, d]) => [k, d.toSorted((a, b) => b.point.size - a.point.size)]) + ); + const dataValues = [...sortedDataClone.values()].flat(); + for (const [seriesId, datums] of sortedDataClone.entries()) { + const labels = []; + if (!datums[0]?.label) + continue; + for (let index = 0, ln = datums.length; index < ln; index++) { + const d = datums[index]; + const { point, label, anchor } = d; + const { text: text2, width: width2, height: height2 } = label; + const r = point.size / 2; + let dx2 = 0; + let dy2 = 0; + if (r > 0 && d.placement != null) { + const placement = labelPlacements[d.placement]; + dx2 = (width2 / 2 + r + padding2) * placement.x; + dy2 = (height2 / 2 + r + padding2) * placement.y; + } + let x = point.x - width2 / 2 + dx2; + let y = point.y - height2 / 2 + dy2; + if (anchor) { + x -= (anchor.x - 0.5) * point.size; + y -= (anchor.y - 0.5) * point.size; + } + if (boxContains(bounds, x, y, width2, height2) && !dataValues.some((dataDatum) => circleRectOverlap(dataDatum, x, y, width2, height2)) && !previousResults.some((pr) => boxCollides(pr, x, y, width2, height2))) { + const resultDatum = { index, text: text2, x, y, width: width2, height: height2, datum: d }; + labels.push(resultDatum); + previousResults.push(resultDatum); + } + } + result.set(seriesId, labels); + } + return result; +} + +// packages/ag-charts-community/src/chart/layout/seriesLabelLayoutManager.ts +var SeriesLabelLayoutManager = class { + constructor() { + this.labelData = /* @__PURE__ */ new Map(); + } + updateLabels(placedLabelSeries, padding2, seriesRect = BBox.zero) { + const bounds = { + x: -padding2.left, + y: -padding2.top, + width: seriesRect.width + padding2.left + padding2.right, + height: seriesRect.height + padding2.top + padding2.bottom + }; + const expectedSeriesId = new Set(placedLabelSeries.map((s) => s.id)); + for (const seriesId of this.labelData.keys()) { + if (!expectedSeriesId.has(seriesId)) { + this.labelData.delete(seriesId); + } + } + for (const series of placedLabelSeries) { + const labelData = series.getLabelData(); + if (labelData.every(isPointLabelDatum)) { + this.labelData.set(series.id, labelData); + } + } + const placedLabels = placeLabels(this.labelData, bounds, 5); + for (const series of placedLabelSeries) { + series.updatePlacedLabelData?.(placedLabels.get(series.id) ?? []); + } + } +}; + +// packages/ag-charts-community/src/chart/legend/legendManager.ts +var LegendManager = class { + constructor(eventsHub) { + this.eventsHub = eventsHub; + this.mementoOriginatorKey = "legend"; + this.legendDataMap = /* @__PURE__ */ new Map(); + } + createMemento() { + return this.getData().filter(({ hideInLegend, isFixed }) => !hideInLegend && !isFixed).map(({ enabled, seriesId, itemId, legendItemName }) => ({ + visible: enabled, + seriesId, + itemId, + legendItemName + })); + } + guardMemento(blob) { + return blob == null || isArray(blob); + } + restoreMemento(_version, _mementoVersion, memento) { + if (memento) { + for (const datum of memento) { + const { seriesId, data } = this.getRestoredData(datum) ?? {}; + if (!seriesId || !data) { + continue; + } + this.updateData(seriesId, data); + } + } + this.update(); + } + getRestoredData(datum) { + const { seriesId, itemId, legendItemName, visible } = datum; + if (seriesId) { + const legendData = this.legendDataMap.get(seriesId) ?? []; + const data = legendData.map((d) => { + const match = d.seriesId === seriesId && (!itemId || d.itemId === itemId); + if (match && d.isFixed) { + this.warnFixed(d.seriesId, d.itemId); + } + return !d.isFixed && match ? { ...d, enabled: visible } : d; + }); + return { seriesId, data }; + } + if (itemId == null && legendItemName == null) { + return; + } + for (const legendDatum of this.getData()) { + if (itemId != null && legendDatum.itemId !== itemId || legendItemName != null && legendDatum.legendItemName !== legendItemName) { + continue; + } + if (legendDatum.isFixed) { + this.warnFixed(legendDatum.seriesId, itemId); + return; + } + const seriesLegendData = (this.legendDataMap.get(legendDatum.seriesId) ?? []).map( + (d) => d.itemId === itemId || d.legendItemName === legendItemName ? { ...d, enabled: visible } : d + ); + return { + seriesId: legendDatum.seriesId, + data: seriesLegendData + }; + } + } + warnFixed(seriesId, itemId) { + logger_exports.warnOnce( + `The legend item with seriesId [${seriesId}] and itemId [${itemId}] is not configurable, this series item cannot be toggled through the legend.` + ); + } + update(data) { + this.eventsHub.emit("legend:change", { + legendData: data ?? this.getData() + }); + } + updateData(seriesId, data = []) { + this.eventsHub.emit("legend:change-partial", { seriesId, legendData: data }); + this.legendDataMap.set(seriesId, data); + } + clearData() { + this.legendDataMap.clear(); + } + toggleItem(enabled, seriesId, itemId, legendItemName) { + if (legendItemName) { + for (const datum of this.getData()) { + const newData = (this.legendDataMap.get(datum.seriesId) ?? []).map( + (d) => d.legendItemName === legendItemName ? { ...d, enabled } : d + ); + this.updateData(datum.seriesId, newData); + } + return; + } + const seriesLegendData = this.getData(seriesId); + const singleLegendItem = seriesLegendData.length === 1; + const data = seriesLegendData.map( + (datum) => itemId == null && singleLegendItem || datum.itemId === itemId ? { ...datum, enabled } : datum + ); + this.updateData(seriesId, data); + } + getData(seriesId) { + if (seriesId) { + return this.legendDataMap.get(seriesId) ?? []; + } + return [...this.legendDataMap].reduce( + (data, [_, legendData]) => data.concat(legendData), + [] + ); + } + getDatum({ seriesId, itemId } = {}) { + return this.getData(seriesId).find((datum) => datum.itemId === itemId); + } + getSeriesEnabled(seriesId) { + const data = this.getData(seriesId); + if (data.length > 0) { + return data.some((d) => d.enabled); + } + } + getItemEnabled({ seriesId, itemId } = {}) { + return this.getDatum({ seriesId, itemId })?.enabled ?? true; + } +}; + +// packages/ag-charts-community/src/chart/optionsGraphService.ts +var OptionsGraphService = class { + updateCallback(resolvePartialCallback) { + this.resolvePartialCallback = resolvePartialCallback; + } + resolvePartial(path, partialOptions, resolveOptions) { + return this.resolvePartialCallback?.(path, partialOptions, resolveOptions); + } +}; + +// packages/ag-charts-community/src/chart/series/seriesStateManager.ts +var SeriesStateManager = class { + constructor() { + this.groups = /* @__PURE__ */ new Map(); + } + registerSeries({ internalId, seriesGrouping, visible, type }) { + if (!seriesGrouping) + return; + let group = this.groups.get(type); + if (group == null) { + group = /* @__PURE__ */ new Map(); + this.groups.set(type, group); + } + group.set(internalId, { grouping: seriesGrouping, visible }); + } + updateSeries({ internalId, seriesGrouping, visible, type }) { + if (!seriesGrouping) + return; + const entry = this.groups.get(type)?.get(internalId); + if (entry) { + entry.grouping = seriesGrouping; + entry.visible = visible; + } + } + deregisterSeries({ internalId, type }) { + const group = this.groups.get(type); + if (group == null) + return; + group.delete(internalId); + if (group.size === 0) { + this.groups.delete(type); + } + } + getVisiblePeerGroupIndex({ type, seriesGrouping, visible }) { + if (!seriesGrouping) { + return { visibleGroupCount: visible ? 1 : 0, visibleSameStackCount: visible ? 1 : 0, index: 0 }; + } + const visibleGroupsSet = /* @__PURE__ */ new Set(); + const visibleSameStackSet = /* @__PURE__ */ new Set(); + const group = this.groups.get(type); + for (const entry of group?.values() ?? []) { + if (!entry.visible) + continue; + visibleGroupsSet.add(entry.grouping.groupIndex); + if (entry.grouping.groupIndex === seriesGrouping.groupIndex) { + visibleSameStackSet.add(entry.grouping.stackIndex); + } + } + const visibleGroups = Array.from(visibleGroupsSet); + visibleGroups.sort((a, b) => a - b); + return { + visibleGroupCount: visibleGroups.length, + visibleSameStackCount: visibleSameStackSet.size, + index: visibleGroups.indexOf(seriesGrouping.groupIndex) + }; + } +}; + +// packages/ag-charts-community/src/chart/updateService.ts +var UpdateService = class { + constructor(updateCallback) { + this.updateCallback = updateCallback; + this.events = new EventEmitter(); + } + addListener(eventName, listener) { + return this.events.on(eventName, listener); + } + destroy() { + this.events.clear(); + } + update(type = 0 /* FULL */, options) { + this.updateCallback(type, options); + } + dispatchUpdateComplete(apiUpdate) { + this.events.emit("update-complete", { type: "update-complete", apiUpdate }); + } + dispatchPreDomUpdate() { + this.events.emit("pre-dom-update", { type: "pre-dom-update" }); + } + dispatchPreSceneRender() { + this.events.emit("pre-scene-render", { type: "pre-scene-render" }); + } + dispatchProcessData({ series }) { + this.events.emit("process-data", { type: "process-data", series }); + } +}; + +// packages/ag-charts-community/src/chart/chartContext.ts +var ChartContext = class { + constructor(chart, vars) { + this.eventsHub = new EventEmitter(); + this.callbackCache = new CallbackCache(); + this.highlightManager = new HighlightManager(this.eventsHub); + this.formatManager = new FormatManager(); + this.layoutManager = new LayoutManager(this.eventsHub); + this.localeManager = new LocaleManager(this.eventsHub); + this.seriesStateManager = new SeriesStateManager(); + this.stateManager = new StateManager(); + this.seriesLabelLayoutManager = new SeriesLabelLayoutManager(); + this.cleanup = new CleanupRegistry(); + this.contextModules = []; + const { + scene, + root, + syncManager, + container, + fireEvent, + updateCallback, + updateMutex, + styleContainer, + chartType, + domMode, + withDragInterpretation + } = vars; + this.chartService = chart; + this.syncManager = syncManager; + this.domManager = new DOMManager(this.eventsHub, this.chartService, container, styleContainer, domMode); + this.widgets = new WidgetSet(this.domManager, { withDragInterpretation }); + const canvasElement = this.domManager.addChild( + "canvas", + "scene-canvas", + scene?.canvas.element + ); + this.scene = scene ?? new Scene({ canvasElement }); + this.scene.setRoot(root); + this.cleanup.register( + this.scene.on("scene-changed", () => { + this.updateService.update(7 /* SCENE_RENDER */); + }) + ); + this.axisManager = new AxisManager(this.eventsHub, root); + this.legendManager = new LegendManager(this.eventsHub); + this.annotationManager = new AnnotationManager(this.eventsHub, chart.annotationRoot, fireEvent); + this.chartTypeOriginator = new ChartTypeOriginator(chart); + this.interactionManager = new InteractionManager(); + this.contextMenuRegistry = new ContextMenuRegistry(this.eventsHub); + this.optionsGraphService = new OptionsGraphService(); + this.updateService = new UpdateService(updateCallback); + this.proxyInteractionService = new ProxyInteractionService(this.eventsHub, this.localeManager, this.domManager); + this.fontManager = new FontManager(this.domManager, this.updateService); + this.historyManager = new HistoryManager(this.eventsHub); + this.animationManager = new AnimationManager(this.interactionManager, updateMutex); + this.dataService = new DataService(this.eventsHub, chart, this.animationManager); + this.tooltipManager = new TooltipManager(this.eventsHub, this.localeManager, this.domManager, chart.tooltip); + this.zoomManager = new ZoomManager(this.eventsHub, fireEvent); + for (const module2 of moduleRegistry.byType("context")) { + if (!module2.chartTypes.includes(chartType)) + continue; + const moduleInstance = module2.moduleFactory(this); + this.contextModules.push(moduleInstance); + this[module2.contextKey] = moduleInstance; + } + } + destroy() { + this.animationManager.destroy(); + this.axisManager.destroy(); + this.callbackCache.invalidateCache(); + this.domManager.destroy(); + this.fontManager.destroy(); + this.proxyInteractionService.destroy(); + this.tooltipManager.destroy(); + this.zoomManager.destroy(); + this.widgets.destroy(); + for (const m of this.contextModules) { + m.destroy(); + } + this.cleanup.flush(); + } +}; + +// packages/ag-charts-community/src/chart/chartHighlight.ts +var ChartHighlight = class extends BaseProperties { + constructor() { + super(...arguments); + this.range = "tooltip"; + this.drawingMode = "overlay"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], ChartHighlight.prototype, "range", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], ChartHighlight.prototype, "drawingMode", 2); + +// packages/ag-charts-community/src/chart/data/caching.ts +function setsEqual(a, b) { + if (a.size !== b.size) + return false; + for (const value of a) { + if (!b.has(value)) + return false; + } + return true; +} +function idsMapEqual(a, b) { + if (a == null || b == null) + return a === b; + if (a.size !== b.size) + return false; + for (const [key, aValue] of a) { + const bValue = b.get(key); + if (bValue == null) + return false; + if (!setsEqual(aValue, bValue)) + return false; + } + return true; +} +function propsEqual(a, b) { + if (a.length !== b.length) + return false; + for (let i = 0; i < a.length; i += 1) { + const { type: typeA, idsMap: idsMapA, scopes: scopesA, data: dataA, ...propA } = a[i]; + const { type: typeB, idsMap: idsMapB, scopes: scopesB, data: dataB, ...propB } = b[i]; + if (typeA !== typeB) + return false; + if (scopesA && scopesB && !arraysEqual(scopesA, scopesB)) + return false; + if (dataA && dataB && dataA !== dataB) + return false; + if (!objectsEqual(propA, propB) || !idsMapEqual(idsMapA, idsMapB)) + return false; + } + return true; +} +function optsEqual(a, b) { + const { props: propsA, ...restA } = a; + const { props: propsB, ...restB } = b; + return objectsEqual(restA, restB) && propsEqual(propsA, propsB); +} +function canReuseCachedData(cachedDataItem, dataSet, ids, opts) { + if (dataSet !== cachedDataItem.dataSet) { + return false; + } + return arraysEqual(ids, cachedDataItem.ids) && optsEqual(opts, cachedDataItem.opts); +} + +// packages/ag-charts-community/src/chart/data/dataChangeDescription.ts +function isAppendOnly(indexMap) { + return indexMap.removedIndices.size === 0 && indexMap.totalPrependCount === 0 && indexMap.totalAppendCount > 0; +} +function isPrependOnly(indexMap) { + return indexMap.removedIndices.size === 0 && indexMap.totalAppendCount === 0 && indexMap.totalPrependCount > 0; +} +function hasNoRemovals(indexMap) { + return indexMap.removedIndices.size === 0; +} +var DataChangeDescription = class { + constructor(indexMap, insertions) { + this.indexMap = indexMap; + this.prependValues = insertions.prependValues; + this.appendValues = insertions.appendValues; + } + /** + * Get all indices that were removed from the original array, sorted ascending. + * + * @returns Array of removed indices (e.g., [2, 5, 8]) + * + * @example + * ```typescript + * const removed = changeDesc.getRemovedIndices(); + * console.log(`Removed ${removed.length} items at indices: ${removed}`); + * ``` + */ + getRemovedIndices() { + return Array.from(this.indexMap.removedIndices).sort((a, b) => a - b); + } + /** + * Iterate over preserved elements, mapping source index to destination index. + * Only calls callback for elements that were NOT removed. + * + * **Use this for:** + * - Tracking which elements moved (when sourceIndex !== destIndex) + * - Generating diff metadata (added/removed/moved items) + * - Understanding index shifts caused by prepends/removes + * + * @param callback - Called for each preserved element with (sourceIndex, destIndex) + * + * @example Detecting moved items + * ```typescript + * const movedItems = new Set(); + * changeDesc.forEachPreservedIndex((srcIdx, destIdx) => { + * if (srcIdx !== destIdx) { + * movedItems.add(destIdx); + * } + * }); + * ``` + */ + forEachPreservedIndex(callback2) { + const { originalLength, removedIndices, totalPrependCount } = this.indexMap; + let removalsBeforeCount = 0; + const sortedRemovals = Array.from(removedIndices).sort((a, b) => a - b); + let removalIdx = 0; + for (let srcIdx = 0; srcIdx < originalLength; srcIdx++) { + while (removalIdx < sortedRemovals.length && sortedRemovals[removalIdx] < srcIdx) { + removalsBeforeCount++; + removalIdx++; + } + if (!removedIndices.has(srcIdx)) { + const destIdx = srcIdx + totalPrependCount - removalsBeforeCount; + callback2(srcIdx, destIdx); + } + } + } + /** + * Get the values that were prepended to the beginning of the array. + * + * These values are stored during change description construction and can be used + * to avoid reprocessing prepended data. + * + * @returns Array of prepended values in order + * + * @example Processing prepended data + * ```typescript + * const prependedData = changeDesc.getPrependedValues(); + * for (const row of prependedData) { + * processRow(row); + * } + * ``` + */ + getPrependedValues() { + return this.prependValues; + } + /** + * Get the values that were appended to the end of the array. + * + * These values are stored during change description construction and can be used + * to avoid reprocessing appended data. + * + * @returns Array of appended values in order + * + * @example Processing appended data + * ```typescript + * const appendedData = changeDesc.getAppendedValues(); + * for (const row of appendedData) { + * processRow(row); + * } + * ``` + */ + getAppendedValues() { + return this.appendValues; + } + /** + * Applies the transformation to an array in-place using native Array operations. + * This is a zero-copy operation that mutates the array directly. + * + * **Use this for:** + * - Transforming processed data arrays (keys, columns, invalidity) + * - Applying prepends, removals, and appends in a single pass + * - Maintaining synchronization between data and processed arrays + * + * **How it works:** + * 1. Applies splice operations in order (prepends, removals, appends) + * 2. Calls processInsertion callback for each inserted element + * 3. Mutates the array in-place for zero-copy efficiency + * + * @param array - The array to transform in-place (will be mutated) + * @param processInsertion - Callback to generate values for inserted indices + * + * @example Transforming a column array + * ```typescript + * // Transform processed column to match new data layout + * const insertionCache = new Map(); // Pre-computed processed values + * changeDesc.applyToArray(columnArray, (destIndex) => { + * return insertionCache.get(destIndex) ?? defaultValue; + * }); + * ``` + * + * @example Transforming an invalidity array + * ```typescript + * // Transform invalidity flags to match new data + * changeDesc.applyToArray(invalidityArray, (destIndex) => { + * const cached = insertionCache.get(destIndex); + * return cached?.hasInvalidKey ?? false; + * }); + * ``` + */ + applyToArray(array2, processInsertion, onRemove) { + const { spliceOps, finalLength, originalLength } = this.indexMap; + if (originalLength === finalLength && spliceOps.length === 0) { + return; + } + for (const op of spliceOps) { + const insertElements = op.insertCount > 0 ? Array.from({ length: op.insertCount }, (_, j) => processInsertion(op.index + j)) : []; + const removed = array2.splice(op.index, op.deleteCount, ...insertElements); + if (onRemove && removed.length > 0) { + onRemove(removed, op); + } + } + if (array2.length !== finalLength) { + array2.length = finalLength; + } + } +}; + +// packages/ag-charts-community/src/chart/data/dataDomain.ts +var DiscreteDomain = class _DiscreteDomain { + constructor() { + this.domain = /* @__PURE__ */ new Set(); + } + static is(value) { + return value instanceof _DiscreteDomain; + } + extend(val) { + this.domain.add(val); + } + getDomain() { + return Array.from(this.domain); + } +}; +var ContinuousDomain = class _ContinuousDomain { + constructor() { + this.domain = [Infinity, -Infinity]; + } + static is(value) { + return value instanceof _ContinuousDomain; + } + static extendDomain(values, domain = [Infinity, -Infinity]) { + for (const value of values) { + if (typeof value !== "number") { + continue; + } + if (domain[0] > value) { + domain[0] = value; + } + if (domain[1] < value) { + domain[1] = value; + } + } + return domain; + } + extend(value) { + if (typeof value !== "number" && !(value instanceof Date)) { + return; + } + if (this.domain[0] > value) { + this.domain[0] = value; + } + if (this.domain[1] < value) { + this.domain[1] = value; + } + } + getDomain() { + return [...this.domain]; + } +}; +var DEFAULT_MIN_DATA_SIZE_FOR_BANDING = 1e3; +var DEFAULT_TARGET_BAND_COUNT = 10; +var BandedDomain = class { + constructor(domainFactory, config = {}, isDiscrete = false) { + this.bands = []; + this.dataSize = 0; + this.fullDomainCache = null; + // Tracks when band structure has gaps due to removals and needs rebalancing. + // Set to true when removing data creates non-contiguous bands. + // Prevents unnecessary rebalancing when bands are still valid. + this.needsReinitialization = false; + this.domainFactory = domainFactory; + this.isDiscrete = isDiscrete; + this.config = { + minDataSizeForBanding: config.minDataSizeForBanding ?? DEFAULT_MIN_DATA_SIZE_FOR_BANDING, + targetBandCount: config.targetBandCount ?? DEFAULT_TARGET_BAND_COUNT, + maxBandSize: config.maxBandSize ?? Infinity, + enableBanding: config.enableBanding ?? true + }; + } + /** + * Initializes or rebalances bands based on current data size. + */ + initializeBands(dataSize) { + this.dataSize = dataSize; + this.fullDomainCache = null; + this.needsReinitialization = false; + if (!this.config.enableBanding || dataSize < this.config.minDataSizeForBanding) { + this.bands = [ + { + startIndex: 0, + endIndex: dataSize, + subDomain: this.domainFactory(), + isDirty: true + } + ]; + return; + } + const targetBandCount = this.getTargetBandCount(this.dataSize); + const bandSize = Math.ceil(dataSize / targetBandCount); + this.bands = []; + for (let i = 0; i < targetBandCount; i++) { + const startIndex = i * bandSize; + const endIndex = Math.min((i + 1) * bandSize, dataSize); + this.bands.push({ + startIndex, + endIndex, + subDomain: this.domainFactory(), + isDirty: true + }); + } + } + /** + * Finds the band(s) that contain the given index range. + */ + findAffectedBands(startIndex, endIndex) { + const affected = []; + for (let i = 0; i < this.bands.length; i++) { + const band = this.bands[i]; + if (startIndex < band.endIndex && endIndex > band.startIndex) { + affected.push(i); + } + } + return affected; + } + /** + * Marks bands as dirty that need rescanning. + */ + markBandsDirty(startIndex, endIndex) { + const affectedBands = this.findAffectedBands(startIndex, endIndex); + for (const bandIndex of affectedBands) { + this.bands[bandIndex].isDirty = true; + } + this.fullDomainCache = null; + } + /** + * Handles insertion of new data by adjusting band indices. + */ + handleInsertion(insertIndex, insertCount) { + this.dataSize += insertCount; + this.fullDomainCache = null; + for (let i = 0; i < this.bands.length; i++) { + const band = this.bands[i]; + const isLastBand = i === this.bands.length - 1; + if (insertIndex <= band.startIndex) { + band.startIndex += insertCount; + band.endIndex += insertCount; + } else if (insertIndex < band.endIndex || insertIndex === band.endIndex && isLastBand) { + band.endIndex += insertCount; + band.isDirty = true; + } + } + this.considerRebalancing(); + } + /** + * Handles removal of data by adjusting band indices. + */ + handleRemoval(removeIndex, removeCount) { + this.dataSize -= removeCount; + this.fullDomainCache = null; + for (const band of this.bands) { + if (removeIndex + removeCount <= band.startIndex) { + band.startIndex = Math.max(0, band.startIndex - removeCount); + band.endIndex = Math.max(band.startIndex, band.endIndex - removeCount); + } else if (removeIndex < band.endIndex) { + if (removeIndex <= band.startIndex) { + const removedFromBand = Math.min(removeCount, band.endIndex - band.startIndex); + band.startIndex = removeIndex; + band.endIndex = Math.max(band.startIndex, band.endIndex - removedFromBand); + } else { + band.endIndex = Math.max(band.startIndex, band.endIndex - removeCount); + } + band.isDirty = true; + } + } + this.bands = this.bands.filter((band) => band.endIndex > band.startIndex); + let needsNormalization = false; + if (this.bands.length > 1) { + if (this.bands[0].startIndex !== 0) { + needsNormalization = true; + } + for (let i = 1; i < this.bands.length; i++) { + if (this.bands[i].startIndex !== this.bands[i - 1].endIndex) { + this.needsReinitialization = true; + break; + } + } + } + if (needsNormalization && !this.needsReinitialization) { + const offset = this.bands[0].startIndex; + for (const band of this.bands) { + band.startIndex -= offset; + band.endIndex -= offset; + } + } + this.considerRebalancing(); + } + /** + * Marks all bands as dirty, forcing a full rescan. + */ + markAllBandsDirty() { + for (const band of this.bands) { + band.isDirty = true; + } + this.fullDomainCache = null; + } + /** + * Considers whether bands should be rebalanced based on current distribution. + */ + considerRebalancing() { + if (!this.needsReinitialization) { + return; + } + if (this.dataSize < this.config.minDataSizeForBanding) { + if (this.bands.length > 1) { + this.initializeBands(this.dataSize); + } + return; + } + if (this.config.maxBandSize < Infinity) { + const maxSize = Math.max(...this.bands.map((b) => b.endIndex - b.startIndex)); + if (maxSize > this.config.maxBandSize) { + this.initializeBands(this.dataSize); + return; + } + } + const targetBandCount = this.getTargetBandCount(this.dataSize); + if (Math.abs(this.bands.length - targetBandCount) > targetBandCount * 0.5) { + this.initializeBands(this.dataSize); + } + } + getTargetBandCount(dataSize) { + return Math.max(this.config.targetBandCount, Math.ceil(dataSize / 1e3)); + } + /** + * Extends the domain with values from specified bands. + * This is called after dirty bands have been rescanned. + */ + extendBandsFromData(data, invalidData) { + const dataLength = data.length; + for (const band of this.bands) { + if (!band.isDirty) + continue; + band.subDomain = this.domainFactory(); + const { startIndex, endIndex } = band; + for (let i = startIndex; i < endIndex && i < dataLength; i++) { + if (invalidData?.[i]) + continue; + band.subDomain.extend(data[i]); + } + band.isDirty = false; + } + this.fullDomainCache = null; + } + /** + * Gets the bands that need rescanning. + */ + getDirtyBands() { + return this.bands.filter((band) => band.isDirty); + } + /** + * Standard IDataDomain interface - extends domain with a single value. + * Note: This is less efficient than batch operations with bands. + */ + extend(_value) { + this.markAllBandsDirty(); + this.fullDomainCache = null; + } + /** + * Combines all band sub-domains to get the overall domain. + */ + getDomain() { + if (this.fullDomainCache !== null) { + return this.fullDomainCache; + } + if (this.bands.length === 0) { + this.fullDomainCache = []; + return []; + } + if (this.bands.length === 1) { + this.fullDomainCache = this.bands[0].subDomain.getDomain(); + return this.fullDomainCache; + } + if (this.isDiscrete) { + const combined = /* @__PURE__ */ new Set(); + for (const band of this.bands) { + const bandDomain = band.subDomain.getDomain(); + for (const value of bandDomain) { + combined.add(value); + } + } + this.fullDomainCache = Array.from(combined); + } else { + let min; + let max; + for (const band of this.bands) { + const bandDomain = band.subDomain.getDomain(); + if (bandDomain.length === 2) { + const [bandMin, bandMax] = bandDomain; + if (min === void 0 || bandMin != null && min != null && bandMin < min) { + min = bandMin; + } + if (max === void 0 || bandMax != null && max != null && bandMax > max) { + max = bandMax; + } + } + } + if (min !== void 0 && max !== void 0) { + this.fullDomainCache = [min, max]; + } else { + this.fullDomainCache = []; + } + } + return this.fullDomainCache; + } + /** + * Returns statistics about the banded domain for debugging. + */ + getStats() { + const dirtyCount = this.bands.filter((b) => b.isDirty).length; + const totalSize = this.bands.reduce((sum2, b) => sum2 + (b.endIndex - b.startIndex), 0); + return { + bandCount: this.bands.length, + dirtyBandCount: dirtyCount, + averageBandSize: this.bands.length > 0 ? totalSize / this.bands.length : 0, + dataSize: this.dataSize, + needsReinitialization: this.needsReinitialization + }; + } +}; + +// packages/ag-charts-community/src/chart/data/rangeLookup.ts +var MIN = 0; +var MAX = 1; +var SPAN = 2; +var RangeLookup = class { + constructor(allValues) { + const dataLength = allValues.reduce((acc, v) => Math.max(acc, v.length), 0); + const sizePower = 32 - Math.clz32(dataLength); + let maxLevelSize = 1 << sizePower; + if (dataLength === maxLevelSize / 2) { + maxLevelSize = maxLevelSize >>> 1; + } + this.maxLevelSize = maxLevelSize; + const buffer = new Float64Array((maxLevelSize * 2 - 1) * 2).fill(Number.NaN); + for (const values of allValues) { + for (let i = 0; i < values.length; i += 1) { + const value = Number(values[i]); + const bufferIndex = maxLevelSize + i - 1; + const bufferMinIndex = Math.trunc(bufferIndex * SPAN) + MIN; + const bufferMaxIndex = Math.trunc(bufferIndex * SPAN) + MAX; + const prevMinValue = buffer[bufferMinIndex]; + const prevMaxValue = buffer[bufferMaxIndex]; + if (!Number.isFinite(prevMinValue) || value < prevMinValue) { + buffer[bufferMinIndex] = value; + } + if (!Number.isFinite(prevMaxValue) || value > prevMaxValue) { + buffer[bufferMaxIndex] = value; + } + } + } + for (let size = Math.trunc(maxLevelSize / 2); size >= 1; size = Math.trunc(size / 2)) { + const start2 = Math.trunc(size - 1); + const end3 = Math.trunc(start2 + size); + for (let i = 0; i < size; i += 1) { + const nodeIndex = start2 + i; + const leftIndex = end3 + i * 2; + const rightIndex = leftIndex + 1; + const aMin = buffer[Math.trunc(leftIndex * SPAN) + MIN]; + const bMin = buffer[Math.trunc(rightIndex * SPAN) + MIN]; + buffer[Math.trunc(nodeIndex * SPAN) + MIN] = !Number.isFinite(bMin) || aMin < bMin ? aMin : bMin; + const aMax = buffer[Math.trunc(leftIndex * SPAN) + MAX]; + const bMax = buffer[Math.trunc(rightIndex * SPAN) + MAX]; + buffer[Math.trunc(nodeIndex * SPAN) + MAX] = !Number.isFinite(bMax) || aMax > bMax ? aMax : bMax; + } + } + this.buffer = buffer; + } + computeRangeInto(buffer, start2, end3, bufferIndex, currentStart, step, into) { + const currentEnd = currentStart + step - 1; + if (currentEnd < start2 || currentStart >= end3) + return into; + if (currentStart >= start2 && currentEnd < end3) { + const min = buffer[Math.trunc(bufferIndex * SPAN) + MIN]; + const max = buffer[Math.trunc(bufferIndex * SPAN) + MAX]; + if (Number.isFinite(min)) + into[0] = Math.min(into[0], min); + if (Number.isFinite(max)) + into[1] = Math.max(into[1], max); + } else if (step > 1) { + bufferIndex = Math.trunc(bufferIndex * 2); + step = Math.trunc(step / 2); + this.computeRangeInto(buffer, start2, end3, Math.trunc(bufferIndex + 1), currentStart, step, into); + this.computeRangeInto(buffer, start2, end3, Math.trunc(bufferIndex + 2), currentStart + step, step, into); + } + return into; + } + rangeBetween(start2, end3) { + if (start2 > end3) + return [Number.NaN, Number.NaN]; + const { maxLevelSize, buffer } = this; + const range4 = [Infinity, -Infinity]; + this.computeRangeInto(buffer, start2, end3, 0, 0, maxLevelSize, range4); + return range4; + } + get range() { + const { buffer } = this; + return [buffer[MIN], buffer[MAX]]; + } +}; + +// packages/ag-charts-community/src/chart/data/sortOrder.ts +function valuesSortOrder(values, needsValueOf) { + const valuesLength = values.length; + if (values.length <= 1) + return 1; + let order = 0; + let v0 = values[0]; + for (let i = 1; i < valuesLength; i++) { + const v1 = values[i]; + if (v1 == null) + continue; + const primitive = needsValueOf ? v1.valueOf() : v1; + if (typeof primitive !== "number") + return; + const diff8 = Math.sign(v1 - v0); + if (diff8 !== 0) { + if (order !== 0 && order !== diff8) + return; + order = diff8; + } + v0 = v1; + } + return order === 0 ? 1 : order; +} + +// packages/ag-charts-community/src/chart/data/dataModel.ts +var KEY_SORT_ORDERS = Symbol("key-sort-orders"); +var COLUMN_SORT_ORDERS = Symbol("column-sort-orders"); +var DOMAIN_RANGES = Symbol("domain-ranges"); +var DOMAIN_BANDS = Symbol("domain-bands"); +var SHARED_ZERO_INDICES = Object.freeze([0]); +function toKeyString(keys) { + return keys.map((key) => isObject(key) ? JSON.stringify(key) : key).join("-"); +} +function fixNumericExtent(extent3) { + const numberExtent = extent3?.map(Number); + return numberExtent?.every(Number.isFinite) ? numberExtent : []; +} +function getMissCount(scopeProvider, missMap) { + return missMap?.get(scopeProvider.id) ?? 0; +} +function isScoped(obj) { + return "scopes" in obj && Array.isArray(obj.scopes); +} +function createArray(length2, value) { + const out = []; + for (let i = 0; i < length2; i += 1) { + out[i] = value; + } + return out; +} +function datumKeys(keys, datumIndex) { + const out = []; + for (const k of keys) { + const key = k?.[datumIndex]; + if (key == null) + return; + out.push(key); + } + return out; +} +function getPathComponents(path) { + const components = []; + let matchIndex = 0; + let matchGroup; + const regExp = /((?:(?:^|\.)\s*\w+|\[\s*(?:'(?:[^']|(? { + let current = datum; + for (const component of components) { + current = current[component]; + } + return current; + }; +} +var DataModel = class { + constructor(opts, mode = "standalone", suppressFieldDotNotation = false) { + this.opts = opts; + this.mode = mode; + this.suppressFieldDotNotation = suppressFieldDotNotation; + this.debug = Debug.create(true, "data-model"); + this.scopeCache = /* @__PURE__ */ new Map(); + this.keys = []; + this.values = []; + this.aggregates = []; + this.groupProcessors = []; + this.propertyProcessors = []; + this.reducers = []; + this.processors = []; + this.markScopeDatumInvalid = function(scopes, data, datumIndex, invalidData) { + for (const scope of scopes) { + if (!invalidData.has(scope)) { + invalidData.set(scope, createArray(data.length, false)); + } + invalidData.get(scope)[datumIndex] = true; + } + }; + let keys = true; + for (const next of opts.props) { + if (next.type === "key" && !keys) { + throw new Error("AG Charts - internal config error: keys must come before values."); + } + if (next.type === "value" && keys) { + keys = false; + } + } + const verifyMatchGroupId = ({ matchGroupIds = [] }) => { + for (const matchGroupId of matchGroupIds) { + if (this.values.every((def) => def.groupId !== matchGroupId)) { + throw new Error( + `AG Charts - internal config error: matchGroupIds properties must match defined groups (${matchGroupId}).` + ); + } + } + }; + const keyScopes = /* @__PURE__ */ new Set(); + const valueScopes = /* @__PURE__ */ new Set(); + for (const def of opts.props) { + const scopes = def.type === "key" ? keyScopes : valueScopes; + if (isScoped(def)) { + if (def.scopes) { + for (const s of def.scopes) { + scopes.add(s); + } + } + } + switch (def.type) { + case "key": + this.keys.push({ ...def, index: this.keys.length, missing: /* @__PURE__ */ new Map() }); + break; + case "value": + if (def.property == null) { + throw new Error( + `AG Charts - internal config error: no properties specified for value definitions: ${JSON.stringify( + def + )}` + ); + } + this.values.push({ ...def, index: this.values.length, missing: /* @__PURE__ */ new Map() }); + break; + case "aggregate": + verifyMatchGroupId(def); + this.aggregates.push({ ...def, index: this.aggregates.length }); + break; + case "group-value-processor": + verifyMatchGroupId(def); + this.groupProcessors.push({ ...def, index: this.groupProcessors.length }); + break; + case "property-value-processor": + this.propertyProcessors.push({ ...def, index: this.propertyProcessors.length }); + break; + case "reducer": + this.reducers.push({ ...def, index: this.reducers.length }); + break; + case "processor": + this.processors.push({ ...def, index: this.processors.length }); + break; + } + } + if (!!this.opts.groupByKeys || this.opts.groupByFn != null) { + const ungroupedScopes = new Set(valueScopes.values()); + for (const s of keyScopes) { + ungroupedScopes.delete(s); + } + if (ungroupedScopes.size > 0) { + throw new Error( + `AG Charts - scopes missing key for grouping, illegal configuration: ${[...ungroupedScopes.values()]}` + ); + } + } + } + resolveProcessedDataDefById(scope, searchId) { + const def = this.scopeCache.get(scope.id)?.get(searchId); + if (!def) { + throw new Error(`AG Charts - didn't find property definition for [${searchId}, ${scope.id}]`); + } + return { index: def.index, def }; + } + resolveProcessedDataIndexById(scope, searchId) { + return this.resolveProcessedDataDefById(scope, searchId).index; + } + resolveKeysById(scope, searchId, processedData) { + const index = this.resolveProcessedDataIndexById(scope, searchId); + const keys = processedData.keys[index]; + if (keys == null) { + throw new Error(`AG Charts - didn't find keys for [${searchId}, ${scope.id}]`); + } + return keys.get(scope.id); + } + hasColumnById(scope, searchId) { + return this.scopeCache.get(scope.id)?.get(searchId) != null; + } + resolveColumnById(scope, searchId, processedData) { + const index = this.resolveProcessedDataIndexById(scope, searchId); + const column = processedData.columns?.[index]; + if (column == null) { + throw new Error(`AG Charts - didn't find column for [${searchId}, ${scope.id}]`); + } + return column; + } + resolveColumnNeedsValueOf(scope, searchId, processedData) { + const index = this.resolveProcessedDataIndexById(scope, searchId); + return processedData.columnNeedValueOf?.[index] ?? true; + } + /** + * Converts a relative datum index to an absolute column index. + * + * INDEXING STRATEGY: + * - Relative index: Offset from the start of a group (stored in datumIndices) + * - Absolute index: Position in the full column array + * - Conversion: absoluteIndex = groupIndex + relativeIndex + * + * When groupsUnique=true, relativeIndex is always 0, making this a simple + * identity mapping. This optimization reduces memory usage significantly + * for large datasets with unique keys. + * + * @param groupIndex index of the group in ProcessedData.groups + * @param relativeDatumIndex relative index stored in group.datumIndices + * @returns absolute index for accessing columns + */ + resolveAbsoluteIndex(groupIndex, relativeDatumIndex) { + return groupIndex + relativeDatumIndex; + } + /** + * Provides a convenience iterator to iterate over all of the extract datum values in a + * specific DataGroup. + * + * @param scope to which datums should belong + * @param group containing the datums + * @param processedData containing the group + * @param groupIndex index of the group in processedData.groups + */ + *forEachDatum(scope, processedData, group, groupIndex) { + const columnIndex = processedData.columnScopes.findIndex((s) => s.has(scope.id)); + for (const relativeDatumIndex of group.datumIndices[columnIndex] ?? []) { + const absoluteDatumIndex = this.resolveAbsoluteIndex(groupIndex, relativeDatumIndex); + yield processedData.columns[columnIndex][absoluteDatumIndex]; + } + } + getUniqueDataSets(processedData) { + return new Set(processedData.dataSources.values()); + } + /** + * Provides a convenience iterator to iterate over all of the extracted datum values in a + * GroupedData. + * + * @param scope to which datums should belong + * @param processedData to iterate through + */ + *forEachGroupDatum(scope, processedData) { + const columnIndex = processedData.columnScopes.findIndex((s) => s.has(scope.id)); + const output = { + groupIndex: 0, + columnIndex + }; + const empty = []; + for (const group of processedData.groups) { + output.group = group; + for (const relativeDatumIndex of group.datumIndices[columnIndex] ?? empty) { + output.datumIndex = this.resolveAbsoluteIndex(output.groupIndex, relativeDatumIndex); + yield output; + } + output.groupIndex++; + } + } + getDomain(scope, searchId, type, processedData) { + const domains = this.getDomainsByType(type ?? "value", processedData); + return domains?.[this.resolveProcessedDataIndexById(scope, searchId)] ?? []; + } + getDomainBetweenRange(scope, searchIds, [i0, i1], processedData) { + const columnIndices = searchIds.map((searchId) => this.resolveProcessedDataIndexById(scope, searchId)); + const cacheKey = columnIndices.join(":"); + const domainRanges = processedData[DOMAIN_RANGES]; + let rangeLookup = domainRanges.get(cacheKey); + if (rangeLookup == null) { + const values = columnIndices.map((columnIndex) => processedData.columns[columnIndex]); + rangeLookup = new RangeLookup(values); + domainRanges.set(cacheKey, rangeLookup); + } + return rangeLookup.rangeBetween(i0, i1); + } + getSortOrder(values, index, sortOrders, needsValueOf) { + let sortOrder = sortOrders.get(index); + if (sortOrder == null) { + sortOrder = { sortOrder: valuesSortOrder(values, needsValueOf) }; + sortOrders.set(index, sortOrder); + } + return sortOrder.sortOrder; + } + getKeySortOrder(scope, searchId, processedData) { + const columnIndex = this.resolveProcessedDataIndexById(scope, searchId); + const keys = processedData.keys[columnIndex]?.get(scope.id); + return keys ? this.getSortOrder(keys, columnIndex, processedData[KEY_SORT_ORDERS], true) : void 0; + } + getColumnSortOrder(scope, searchId, processedData) { + const columnIndex = this.resolveProcessedDataIndexById(scope, searchId); + const needsValueOf = processedData.columnNeedValueOf?.[columnIndex] ?? true; + return this.getSortOrder( + processedData.columns[columnIndex], + columnIndex, + processedData[COLUMN_SORT_ORDERS], + needsValueOf + ); + } + getDomainsByType(type, processedData) { + switch (type) { + case "key": + return processedData.domain.keys; + case "value": + return processedData.domain.values; + case "aggregate": + return processedData.domain.aggValues; + case "group-value-processor": + return processedData.domain.groups; + default: + return null; + } + } + processData(sources) { + const { + opts: { groupByKeys, groupByFn }, + aggregates, + groupProcessors, + reducers, + processors, + propertyProcessors + } = this; + const start2 = performance.now(); + if (groupByKeys && this.keys.length === 0) { + return; + } + let processedData = this.extractData(sources); + if (groupByKeys) { + processedData = this.groupData(processedData); + } else if (groupByFn) { + processedData = this.groupData(processedData, groupByFn(processedData)); + } + if (groupProcessors.length > 0 && processedData.type === "grouped") { + this.postProcessGroups(processedData); + } + if (aggregates.length > 0 && processedData.type === "ungrouped") { + this.aggregateUngroupedData(processedData); + } else if (aggregates.length > 0 && processedData.type === "grouped") { + this.aggregateGroupedData(processedData); + } + if (propertyProcessors.length > 0) { + this.postProcessProperties(processedData); + } + if (reducers.length > 0) { + this.reduceData(processedData); + } + if (processors.length > 0) { + this.postProcessData(processedData); + } + this.warnDataMissingProperties(sources); + const end3 = performance.now(); + processedData.time = end3 - start2; + this.collectOptimizationMetadata(processedData, "full-process"); + if (this.debug.check()) { + logProcessedData(processedData); + } + this.processScopeCache(); + return processedData; + } + /** + * Determines if incremental reprocessing is supported for the given data. + * + * Reprocessing is supported when: + * - For ungrouped data: No aggregates, reducers, processors, or property processors + * - For grouped data: Additionally requires: + * - groupsUnique=true (each datum has unique keys) + * - Single data source (all scopes share same DataSet) + * - No invalid keys (to maintain groups.length === columns.length invariant) + * - All group processors support reprocessing + * + * When unsupported, falls back to full reprocessing automatically. + * + * @returns true if incremental reprocessing can be used, false otherwise + */ + isReprocessingSupported(processedData) { + if (processedData.type === "grouped") { + if (!processedData.groupsUnique) + return false; + const uniqueDataSets = this.getUniqueDataSets(processedData); + if (uniqueDataSets.size !== 1) + return false; + const scope = first(processedData.scopes); + const invalidKeys = processedData.invalidKeys?.get(scope); + if (invalidKeys?.some((invalid) => invalid)) + return false; + } + if (this.aggregates.length > 0) + return false; + if (this.reducers.length > 0) + return false; + if (this.processors.length > 0) + return false; + if (this.propertyProcessors.length > 0) + return false; + return this.groupProcessors.every((p) => p.supportsReprocessing ?? false); + } + reprocessData(processedData, dataSets) { + if (!this.isReprocessingSupported(processedData)) { + if (this.debug.check()) { + this.debug("Falling back to full reprocessing - incremental not supported for current configuration"); + } + const uniqueDataSets = this.getUniqueDataSets(processedData); + for (const dataSet of uniqueDataSets) { + dataSet.commitPendingTransactions(); + } + return this.processData(processedData.dataSources); + } + const start2 = performance.now(); + const scopeChanges = this.collectScopeChanges(processedData, dataSets); + if (scopeChanges.size === 0) { + return processedData; + } + this.commitPendingTransactions(processedData); + const { processValue } = this.initDataDomainProcessor("skip"); + const insertionCaches = this.processAllInsertions(processedData, scopeChanges, processValue); + this.updateBandsForChanges(processedData, scopeChanges); + const removedKeys = this.transformKeysArrays(processedData, scopeChanges, insertionCaches); + this.transformColumnsArrays(processedData, scopeChanges, insertionCaches); + this.transformInvalidityArrays(processedData, scopeChanges, insertionCaches); + if (processedData.type === "grouped") { + this.transformGroupsArray(processedData, scopeChanges, insertionCaches); + if (this.groupProcessors.length > 0) { + this.reprocessGroupProcessors(processedData, scopeChanges); + } + } + this.recomputeDomains(processedData); + if (processedData.reduced?.diff != null && scopeChanges.size > 0) { + this.generateDiffMetadata(processedData, scopeChanges, removedKeys); + } + this.updateProcessedDataMetadata(processedData); + const end3 = performance.now(); + processedData.time = end3 - start2; + this.collectOptimizationMetadata(processedData, "reprocess"); + return processedData; + } + /** + * Applies an operation to all banded domains in a collection. + */ + applyOperationToBandedDomains(bandedDomains, operation) { + for (const domain of bandedDomains.values()) { + if (domain instanceof BandedDomain) { + operation(domain); + } + } + } + /** + * Updates banded domains based on pending changes. + * + * BANDING OPTIMIZATION: + * - Divides large datasets into bands (default ~100 bands) + * - Tracks which bands are "dirty" and need recalculation + * - During updates, only dirty bands are reprocessed + * - Significantly reduces domain calculation overhead for large datasets + * + * Example: 1M data points → 100 bands of 10K points each + * Adding 1000 points only dirties 1-2 bands instead of scanning all 1M points + * + * This optimizes domain recalculation by only marking affected bands as dirty. + * Deduplicates change descriptions to avoid processing the same changes multiple times + * when multiple scopes share the same DataSet. + */ + updateBandsForChanges(processedData, scopeChanges) { + const bandedDomains = processedData[DOMAIN_BANDS]; + if (bandedDomains.size === 0) + return; + const processedChangeDescs = /* @__PURE__ */ new Set(); + for (const [, changeDesc] of scopeChanges) { + if (processedChangeDescs.has(changeDesc)) + continue; + processedChangeDescs.add(changeDesc); + const { indexMap } = changeDesc; + const { spliceOps } = indexMap; + for (const op of spliceOps) { + if (op.insertCount > 0) { + this.applyOperationToBandedDomains( + bandedDomains, + (domain) => domain.handleInsertion(op.index, op.insertCount) + ); + } + if (op.deleteCount > 0) { + this.applyOperationToBandedDomains( + bandedDomains, + (domain) => domain.handleRemoval(op.index, op.deleteCount) + ); + } + } + } + } + /** + * Collects change descriptions from all DataSets before committing. + */ + collectScopeChanges(processedData, dataSets) { + const scopeChanges = /* @__PURE__ */ new Map(); + for (const [scopeId, dataSet] of processedData.dataSources) { + const changeDesc = dataSets?.get(dataSet) ?? dataSet.getChangeDescription(); + if (changeDesc) { + scopeChanges.set(scopeId, changeDesc); + } + } + return scopeChanges; + } + /** + * Commits all pending transactions to the data arrays. + * Deduplicates DataSets to avoid committing the same DataSet multiple times + * when multiple scopes share the same DataSet. + */ + commitPendingTransactions(processedData) { + const uniqueDataSets = this.getUniqueDataSets(processedData); + for (const dataSet of uniqueDataSets) { + dataSet.commitPendingTransactions(); + } + } + /** + * Pre-processes all insertions once per scope to avoid redundant computation. + */ + processAllInsertions(processedData, scopeChanges, processValue) { + const insertionCaches = /* @__PURE__ */ new Map(); + for (const [scope, changeDesc] of scopeChanges) { + const dataSet = processedData.dataSources.get(scope); + if (!dataSet) + continue; + const cache = this.processInsertionsOnce(scope, changeDesc, dataSet, processValue); + insertionCaches.set(scope, cache); + } + return insertionCaches; + } + /** + * Generic utility to transform arrays using cached insertion results. + * This reduces duplication across transformKeysArrays, transformColumnsArrays, and transformInvalidityArrays. + */ + transformArraysWithCache(definitions, scopeChanges, insertionCaches, getArray, getScopes, extractValue) { + for (const [defIndex, def] of definitions.entries()) { + for (const scope of getScopes(def)) { + const changeDesc = scopeChanges.get(scope); + if (!changeDesc) + continue; + const array2 = getArray(defIndex, scope); + if (!array2) + continue; + const insertionCache = insertionCaches.get(scope); + changeDesc.applyToArray(array2, (destIndex) => { + const cached = insertionCache?.get(destIndex); + return extractValue(cached, def, defIndex); + }); + } + } + } + /** + * Transforms keys arrays using cached insertion results. + */ + transformKeysArrays(processedData, scopeChanges, insertionCaches) { + const removedByScope = /* @__PURE__ */ new Map(); + const ensureRemovedMetadata = (scope) => { + let metadata = removedByScope.get(scope); + if (!metadata) { + metadata = { tuples: [] }; + removedByScope.set(scope, metadata); + } + return metadata; + }; + const processedArrays = /* @__PURE__ */ new WeakSet(); + for (const [defIndex, def] of this.keys.entries()) { + for (const scope of def.scopes ?? []) { + const changeDesc = scopeChanges.get(scope); + if (!changeDesc) + continue; + const keysArray = processedData.keys[defIndex]?.get(scope); + if (!keysArray) + continue; + if (processedArrays.has(keysArray)) { + const sourceScope = Array.from(processedData.keys[defIndex].entries()).find( + ([_, arr]) => arr === keysArray + )?.[0]; + if (sourceScope && sourceScope !== scope && removedByScope.has(sourceScope)) { + removedByScope.set(scope, removedByScope.get(sourceScope)); + } + continue; + } + processedArrays.add(keysArray); + const insertionCache = insertionCaches.get(scope); + const removedMetadata = ensureRemovedMetadata(scope); + let removalCursor = 0; + changeDesc.applyToArray( + keysArray, + (destIndex) => { + const cached = insertionCache?.get(destIndex); + if (cached) { + const keyResult = cached.keys.get(defIndex); + return keyResult?.valid ? keyResult.value : def.invalidValue; + } + return def.invalidValue; + }, + (removedValues) => { + for (const value of removedValues) { + if (!removedMetadata.tuples[removalCursor]) { + removedMetadata.tuples[removalCursor] = new Array(this.keys.length); + } + removedMetadata.tuples[removalCursor][defIndex] = value; + removalCursor += 1; + } + } + ); + } + } + const removedKeyStrings = /* @__PURE__ */ new Map(); + for (const [scope, { tuples }] of removedByScope) { + if (tuples.length === 0) + continue; + const scopeSet = /* @__PURE__ */ new Set(); + for (const tuple of tuples) { + const keyValues = []; + for (const [defIndex, value] of tuple.entries()) { + const keyDef = this.keys[defIndex]; + if (!keyDef.scopes?.includes(scope)) + continue; + keyValues.push(value); + } + if (keyValues.length > 0) { + scopeSet.add(toKeyString(keyValues)); + } + } + removedKeyStrings.set(scope, scopeSet); + } + return removedKeyStrings; + } + /** + * Transforms columns arrays using cached insertion results. + */ + transformColumnsArrays(processedData, scopeChanges, insertionCaches) { + this.transformArraysWithCache( + this.values, + scopeChanges, + insertionCaches, + (defIndex) => processedData.columns[defIndex], + (def) => [first(def.scopes)], + (cached, def, defIndex) => { + if (cached) { + const valueResult = cached.values.get(defIndex); + return valueResult?.valid ? valueResult.value : def.invalidValue; + } + return def.invalidValue; + } + ); + } + /** + * Helper to transform a scope-based invalidity map. + */ + transformInvalidityMap(invalidityMap, scopeChanges, insertionCaches, extractValue) { + const processedArrays = /* @__PURE__ */ new Set(); + for (const [scope, changeDesc] of scopeChanges) { + const array2 = invalidityMap.get(scope); + if (!array2) + continue; + if (processedArrays.has(array2)) + continue; + processedArrays.add(array2); + const insertionCache = insertionCaches.get(scope); + changeDesc.applyToArray(array2, (destIndex) => { + const cached = insertionCache?.get(destIndex); + return extractValue(cached); + }); + } + } + /** + * Transforms invalidity arrays using cached insertion results. + */ + transformInvalidityArrays(processedData, scopeChanges, insertionCaches) { + if (processedData.invalidKeys) { + this.transformInvalidityMap( + processedData.invalidKeys, + scopeChanges, + insertionCaches, + (cached) => cached?.hasInvalidKey ?? false + ); + } + if (processedData.invalidData) { + this.transformInvalidityMap( + processedData.invalidData, + scopeChanges, + insertionCaches, + (cached) => cached ? cached.hasInvalidKey || cached.hasInvalidValue : false + ); + } + } + /** + * Transforms the groups array for grouped data during reprocessing. + * Only called when groupsUnique=true and no invalid keys exist. + * + * This maintains the invariant: groups[i] corresponds to datum at columns[i]. + */ + transformGroupsArray(processedData, scopeChanges, insertionCaches) { + const scope = first(processedData.scopes); + const changeDesc = scopeChanges.get(scope); + if (!changeDesc) + return; + const insertionCache = insertionCaches.get(scope); + for (const [, cached] of insertionCache ?? []) { + if (cached.hasInvalidKey) { + throw new Error( + "AG Charts - reprocessing grouped data with invalid keys not supported. This typically indicates a data quality issue that requires full reprocessing." + ); + } + } + changeDesc.applyToArray(processedData.groups, (destIndex) => { + return this.createDataGroupForInsertion(destIndex, processedData, scope, insertionCache); + }); + } + /** + * Creates a new DataGroup for an inserted datum during reprocessing. + * + * When groupsUnique=true and no invalid keys exist, each datum has: + * - A unique set of keys + * - datumIndices[columnIdx] = [0] (relative offset is always 0) + * - All scopes are valid initially (unless invalid value detected) + */ + createDataGroupForInsertion(datumIndex, processedData, scope, insertionCache) { + const keys = []; + for (const keysMap of processedData.keys) { + const scopeKeys = keysMap.get(scope); + if (scopeKeys) { + keys.push(scopeKeys[datumIndex]); + } + } + const firstGroup = processedData.groups[0]; + const allZeroDatumIndices = () => Object.freeze(createArray(processedData.columnScopes.length, SHARED_ZERO_INDICES)); + const datumIndices = firstGroup?.datumIndices ?? allZeroDatumIndices(); + const cached = insertionCache?.get(datumIndex); + const hasInvalidValue = cached?.hasInvalidValue ?? false; + let validScopes; + if (hasInvalidValue) { + validScopes = new Set(processedData.scopes); + validScopes.delete(scope); + } else { + validScopes = processedData.scopes; + } + return { + keys, + datumIndices, + aggregation: [], + // Empty - we don't support aggregates in reprocessing yet + validScopes + }; + } + /** + * Creates or retrieves the appropriate domain for a definition. + * Handles both discrete and continuous domains, with optional banding optimization. + */ + setupDomainForDefinition(def, bandedDomains, bandingConfig) { + if (def.valueType === "category") { + return new DiscreteDomain(); + } + let domain = bandedDomains.get(def); + if (!domain && bandingConfig?.enableBanding !== false) { + domain = new BandedDomain(() => new ContinuousDomain(), bandingConfig, false); + bandedDomains.set(def, domain); + } + return domain ?? new ContinuousDomain(); + } + /** + * Extends a domain from data array, using banded optimization if available. + * Note: For BandedDomain, bands should already be initialized before calling this method. + */ + extendDomainFromData(domain, data, invalidData) { + if (domain instanceof BandedDomain) { + domain.extendBandsFromData(data, invalidData); + } else { + for (let i = 0; i < data.length; i++) { + if (invalidData?.[i] === true) + continue; + domain.extend(data[i]); + } + } + } + /** + * Initializes a banded domain if needed based on data size and state. + * This is a memory optimization that divides large datasets into bands. + */ + initializeBandedDomain(domain, dataSize, propertyName) { + if (!(domain instanceof BandedDomain)) + return; + const stats = domain.getStats(); + const shouldReinit = stats.bandCount === 0 || stats.dataSize !== dataSize || stats.needsReinitialization; + if (this.debug.check() && shouldReinit && propertyName) { + this.debug( + `Reinitializing bands for ${propertyName}: bandCount=${stats.bandCount}, dataSize=${stats.dataSize}, dataLength=${dataSize}, needsReinitialization=${stats.needsReinitialization}` + ); + } + if (shouldReinit) { + domain.initializeBands(dataSize); + } + } + /** + * Recomputes domains from transformed arrays. + * Uses BandedDomain optimization for continuous domains to avoid full rescans. + */ + recomputeDomains(processedData) { + const startTime = this.debug.check() ? performance.now() : 0; + const bandedDomains = processedData[DOMAIN_BANDS]; + const bandingConfig = this.opts.domainBandingConfig; + let bandStats; + const keyDomains = /* @__PURE__ */ new Map(); + const valueDomains = /* @__PURE__ */ new Map(); + for (const keyDef of this.keys) { + keyDomains.set(keyDef, this.setupDomainForDefinition(keyDef, bandedDomains, bandingConfig)); + } + for (const valueDef of this.values) { + valueDomains.set(valueDef, this.setupDomainForDefinition(valueDef, bandedDomains, bandingConfig)); + } + for (const [keyDefIndex, keyDef] of this.keys.entries()) { + const keysMap = processedData.keys[keyDefIndex]; + const domain = keyDomains.get(keyDef); + const maxKeyLength = Math.max(...Array.from(keysMap.values()).map((keys) => keys.length)); + this.initializeBandedDomain(domain, maxKeyLength, String(keyDef.property)); + } + for (const [valueDefIndex, valueDef] of this.values.entries()) { + const column = processedData.columns[valueDefIndex]; + const domain = valueDomains.get(valueDef); + this.initializeBandedDomain(domain, column.length, String(valueDef.property)); + } + const preScanDomainStats = /* @__PURE__ */ new Map(); + if (bandedDomains.size > 0) { + bandStats = { + totalBands: 0, + dirtyBands: 0, + totalData: 0 + }; + for (const domain of bandedDomains.values()) { + if (domain instanceof BandedDomain) { + const stats = domain.getStats(); + preScanDomainStats.set(domain, stats); + bandStats.totalBands += stats.bandCount; + bandStats.dirtyBands += stats.dirtyBandCount; + bandStats.totalData = Math.max(bandStats.totalData, stats.dataSize); + } + } + } + for (const [keyDefIndex, keyDef] of this.keys.entries()) { + const keysMap = processedData.keys[keyDefIndex]; + const domain = keyDomains.get(keyDef); + for (const scope of keyDef.scopes ?? []) { + const keys = keysMap.get(scope); + if (!keys) + continue; + const invalidKeys = processedData.invalidKeys?.get(scope); + this.extendDomainFromData(domain, keys, invalidKeys); + } + } + for (const [valueDefIndex, valueDef] of this.values.entries()) { + const column = processedData.columns[valueDefIndex]; + const domain = valueDomains.get(valueDef); + const columnScope = first(valueDef.scopes); + const invalidData = processedData.invalidData?.get(columnScope); + this.extendDomainFromData(domain, column, invalidData); + } + processedData.domain.keys = this.keys.map((keyDef) => { + const domain = keyDomains.get(keyDef); + const result = domain.getDomain(); + if (ContinuousDomain.is(domain) && result[0] > result[1]) { + return []; + } + return result; + }); + processedData.domain.values = this.values.map((valueDef) => { + const domain = valueDomains.get(valueDef); + const result = domain.getDomain(); + if (ContinuousDomain.is(domain) && result[0] > result[1]) { + return []; + } + return result; + }); + if (processedData.type === "grouped") { + processedData.domain.groups = processedData.groups.map((group) => group.keys); + } + this.collectDomainBandingMetadata(processedData, keyDomains, valueDomains, bandedDomains, preScanDomainStats); + if (this.debug.check() && startTime > 0) { + const endTime = performance.now(); + const duration = endTime - startTime; + if (bandStats && bandStats.totalBands > 0) { + const scanRatio = bandStats.dirtyBands / bandStats.totalBands; + const dataScanned = Math.round(scanRatio * bandStats.totalData); + this.debug( + `recomputeDomains with banding: ${duration.toFixed(2)}ms, bands: ${bandStats.dirtyBands}/${bandStats.totalBands} dirty, data scanned: ~${dataScanned}/${bandStats.totalData} (${(scanRatio * 100).toFixed(1)}%)` + ); + } else { + this.debug(`recomputeDomains: ${duration.toFixed(2)}ms (no banding)`); + } + } + } + /** + * Generates diff metadata for animations and incremental rendering. + * This is an opt-in feature - only runs if diff tracking is already initialized. + */ + generateDiffMetadata(processedData, scopeChanges, removedKeys) { + const getKeyString = (scope, datumIndex) => { + const keys = []; + for (const keysMap of processedData.keys) { + const scopeKeys = keysMap.get(scope); + if (!scopeKeys) + return void 0; + keys.push(scopeKeys[datumIndex]); + } + return keys.length > 0 ? toKeyString(keys) : void 0; + }; + for (const [scope, changeDesc] of scopeChanges) { + const diff8 = { + changed: true, + added: /* @__PURE__ */ new Set(), + removed: removedKeys.get(scope) ?? /* @__PURE__ */ new Set(), + updated: /* @__PURE__ */ new Set(), + moved: /* @__PURE__ */ new Set() + }; + for (const op of changeDesc.indexMap.spliceOps) { + if (op.insertCount > 0) { + for (let i = 0; i < op.insertCount; i++) { + const datumIndex = op.index + i; + const keyStr = getKeyString(scope, datumIndex); + if (keyStr) { + diff8.added.add(keyStr); + } + } + } + } + const { originalLength, totalPrependCount } = changeDesc.indexMap; + if (isAppendOnly(changeDesc.indexMap)) { + } else if (isPrependOnly(changeDesc.indexMap) && originalLength > 0) { + for (let destIndex = totalPrependCount; destIndex < totalPrependCount + originalLength; destIndex++) { + const keyStr = getKeyString(scope, destIndex); + if (keyStr) + diff8.moved.add(keyStr); + } + } else if (hasNoRemovals(changeDesc.indexMap) && totalPrependCount > 0) { + for (let sourceIndex = 0; sourceIndex < originalLength; sourceIndex++) { + const destIndex = sourceIndex + totalPrependCount; + const keyStr = getKeyString(scope, destIndex); + if (keyStr) + diff8.moved.add(keyStr); + } + } else { + changeDesc.forEachPreservedIndex((sourceIndex, destIndex) => { + if (sourceIndex !== destIndex) { + const keyStr = getKeyString(scope, destIndex); + if (keyStr) + diff8.moved.add(keyStr); + } + }); + } + processedData.reduced.diff[scope] = diff8; + } + } + /** + * Updates metadata after array transformations. + */ + updateProcessedDataMetadata(processedData) { + let maxDataLength = 0; + for (const dataSet of processedData.dataSources.values()) { + maxDataLength = Math.max(maxDataLength, dataSet.data.length); + } + processedData.input.count = maxDataLength; + let partialValidDataCount = 0; + for (const [scope, invalidData] of processedData.invalidData ?? /* @__PURE__ */ new Map()) { + const invalidKeys = processedData.invalidKeys?.get(scope); + for (let i = 0; i < invalidData.length; i++) { + if (invalidData[i] && !invalidKeys?.[i]) { + partialValidDataCount += 1; + } + } + } + processedData.partialValidDataCount = partialValidDataCount; + if (processedData.invalidKeyCount) { + for (const [scope, invalidKeys] of processedData.invalidKeys ?? /* @__PURE__ */ new Map()) { + const count = invalidKeys.filter(Boolean).length; + processedData.invalidKeyCount.set(scope, count); + } + } + processedData[DOMAIN_RANGES].clear(); + processedData[KEY_SORT_ORDERS].clear(); + processedData[COLUMN_SORT_ORDERS].clear(); + } + /** + * Processes all insertions for a given scope once, caching the results. + * Returns a map from ADJUSTED destIndex to processed values for all keys and values. + * The adjusted destIndex accounts for out-of-bounds insertions that need to be shifted. + */ + processInsertionsOnce(scope, changeDesc, dataSet, processValue) { + const cache = /* @__PURE__ */ new Map(); + const { finalLength } = changeDesc.indexMap; + for (const op of changeDesc.indexMap.spliceOps) { + if (op.insertCount <= 0) + continue; + for (let i = 0; i < op.insertCount; i++) { + const destIndex = op.index + i; + if (destIndex < 0 || destIndex >= finalLength) { + continue; + } + const datum = dataSet.data[destIndex]; + const keys = /* @__PURE__ */ new Map(); + const values = /* @__PURE__ */ new Map(); + let hasInvalidKey = false; + let hasInvalidValue = false; + if (datum == null || typeof datum !== "object") { + hasInvalidKey = true; + hasInvalidValue = true; + } else { + for (const [keyDefIndex, keyDef] of this.keys.entries()) { + if (!keyDef.scopes?.includes(scope)) + continue; + const result = processValue(keyDef, datum, destIndex, scope); + keys.set(keyDefIndex, { value: result.value, valid: result.valid }); + if (!result.valid) { + hasInvalidKey = true; + } + } + for (const [valueDefIndex, valueDef] of this.values.entries()) { + if (!valueDef.scopes?.includes(scope)) + continue; + const result = processValue(valueDef, datum, destIndex, valueDef.scopes); + values.set(valueDefIndex, { value: result.value, valid: result.valid }); + if (!result.valid) { + hasInvalidValue = true; + } + } + } + cache.set(destIndex, { keys, values, hasInvalidKey, hasInvalidValue }); + } + } + return cache; + } + warnDataMissingProperties(sources) { + if (sources.size === 0) + return; + for (const def of iterate(this.keys, this.values)) { + for (const [scope, missCount] of def.missing) { + if (missCount < (sources.get(scope)?.data.length ?? Infinity)) + continue; + const scopeHint = scope == null ? "" : ` for ${scope}`; + logger_exports.warnOnce(`the key '${def.property}' was not found in any data element${scopeHint}.`); + } + } + } + processScopeCache() { + this.scopeCache.clear(); + for (const def of iterate(this.keys, this.values, this.aggregates)) { + if (!def.idsMap) + continue; + for (const [scope, ids] of def.idsMap) { + for (const id of ids) { + if (!this.scopeCache.has(scope)) { + this.scopeCache.set(scope, /* @__PURE__ */ new Map([[id, def]])); + } else if (this.scopeCache.get(scope)?.has(id)) { + throw new Error("duplicate definition ids on the same scope are not allowed."); + } else { + this.scopeCache.get(scope).set(id, def); + } + } + } + } + } + valueGroupIdxLookup({ matchGroupIds }) { + const result = []; + for (const [index, def] of this.values.entries()) { + if (!matchGroupIds || def.groupId && matchGroupIds.includes(def.groupId)) { + result.push(index); + } + } + return result; + } + valueIdxLookup(scopes, prop) { + const noScopesToMatch = scopes == null || scopes.length === 0; + const propId = typeof prop === "string" ? prop : prop.id; + const hasMatchingScopeId = (def) => { + if (def.idsMap) { + for (const [scope, ids] of def.idsMap) { + if (scopes?.includes(scope) && ids.has(propId)) { + return true; + } + } + } + return false; + }; + const result = this.values.reduce((res, def, index) => { + const validDefScopes = def.scopes == null || noScopesToMatch && !def.scopes.length || def.scopes.some((s) => scopes?.includes(s)); + if (validDefScopes && (def.property === propId || def.id === propId || hasMatchingScopeId(def))) { + res.push(index); + } + return res; + }, []); + if (result.length === 0) { + throw new Error( + `AG Charts - configuration error, unknown property ${JSON.stringify(prop)} in scope(s) ${JSON.stringify( + scopes + )}` + ); + } + return result; + } + extractData(sources) { + const { dataDomain, processValue, allScopesHaveSameDefs } = this.initDataDomainProcessor("extend"); + const { keys: keyDefs, values: valueDefs } = this; + const { invalidData, invalidKeys, invalidKeyCount, allKeyMappings } = this.extractKeys( + keyDefs, + sources, + processValue + ); + const { columns, columnScopes, columnNeedValueOf, partialValidDataCount, maxDataLength } = this.extractValues( + invalidData, + valueDefs, + sources, + invalidKeys, + processValue + ); + const propertyDomain = (def) => { + const defDomain = dataDomain.get(def); + const result = defDomain.getDomain(); + if (ContinuousDomain.is(defDomain) && result[0] > result[1]) { + return []; + } + return result; + }; + return { + type: "ungrouped", + input: { count: maxDataLength }, + scopes: new Set(sources.keys()), + dataSources: sources, + aggregation: void 0, + keys: [...allKeyMappings.values()], + columns, + columnScopes, + columnNeedValueOf, + invalidKeys, + invalidKeyCount, + invalidData, + domain: { + keys: keyDefs.map(propertyDomain), + values: valueDefs.map(propertyDomain) + }, + defs: { + allScopesHaveSameDefs, + keys: keyDefs, + values: valueDefs + }, + partialValidDataCount, + time: 0, + [DOMAIN_RANGES]: /* @__PURE__ */ new Map(), + [KEY_SORT_ORDERS]: /* @__PURE__ */ new Map(), + [COLUMN_SORT_ORDERS]: /* @__PURE__ */ new Map(), + [DOMAIN_BANDS]: /* @__PURE__ */ new Map() + }; + } + extractKeys(keyDefs, sources, processValue) { + const invalidKeys = /* @__PURE__ */ new Map(); + const invalidData = /* @__PURE__ */ new Map(); + const invalidKeyCount = /* @__PURE__ */ new Map(); + const allKeys = /* @__PURE__ */ new Map(); + let keyDefKeys; + let scopeDataProcessed; + const cloneScope = (source, target) => { + const sourceScope = scopeDataProcessed.get(source); + keyDefKeys.set(target, keyDefKeys.get(sourceScope)); + if (invalidKeys.has(sourceScope)) { + invalidKeys.set(target, invalidKeys.get(sourceScope)); + invalidData.set(target, invalidData.get(sourceScope)); + } + }; + for (const keyDef of keyDefs) { + const { invalidValue, scopes: keyScopes } = keyDef; + keyDefKeys = /* @__PURE__ */ new Map(); + scopeDataProcessed = /* @__PURE__ */ new Map(); + allKeys.set(keyDef, keyDefKeys); + for (const scope of keyScopes ?? []) { + const data = sources.get(scope)?.data ?? []; + if (scopeDataProcessed.has(data)) { + cloneScope(data, scope); + continue; + } + const keys = []; + keyDefKeys.set(scope, keys); + scopeDataProcessed.set(data, scope); + let invalidScopeKeys; + let invalidScopeData; + let missingKeys = 0; + for (let datumIndex = 0; datumIndex < data.length; datumIndex++) { + if (data[datumIndex] == null || typeof data[datumIndex] !== "object") + continue; + const result = processValue(keyDef, data[datumIndex], datumIndex, scope); + if (result.valid) { + keys.push(result.value); + continue; + } + keys.push(invalidValue); + invalidScopeKeys ?? (invalidScopeKeys = createArray(data.length, false)); + invalidScopeData ?? (invalidScopeData = createArray(data.length, false)); + missingKeys += 1; + invalidScopeKeys[datumIndex] = true; + invalidScopeData[datumIndex] = true; + } + if (invalidScopeKeys && invalidScopeData) { + invalidKeys.set(scope, invalidScopeKeys); + invalidData.set(scope, invalidScopeData); + invalidKeyCount.set(scope, missingKeys); + } + } + } + return { invalidData, invalidKeys, invalidKeyCount, allKeyMappings: allKeys }; + } + extractValues(invalidData, valueDefs, sources, scopeInvalidKeys, processValue) { + let partialValidDataCount = 0; + const columns = []; + const allColumnScopes = []; + const columnNeedValueOf = []; + let maxDataLength = 0; + for (const def of valueDefs) { + const { invalidValue } = def; + const valueSources = new Set(def.scopes.map((s) => sources.get(s))); + if (valueSources.size > 1) { + throw new Error(`AG Charts - more than one data source for: ${JSON.stringify(def)}`); + } + const columnScopes = new Set(def.scopes); + const columnScope = first(def.scopes); + const columnSource = sources.get(columnScope)?.data ?? []; + const column = new Array(); + const invalidKeys = scopeInvalidKeys.get(columnScope); + let needsValueOf = false; + for (let datumIndex = 0; datumIndex < columnSource.length; datumIndex++) { + if (columnSource[datumIndex] == null || typeof columnSource[datumIndex] !== "object") + continue; + const valueDatum = columnSource[datumIndex]; + const invalidKey = invalidKeys == null ? false : invalidKeys[datumIndex]; + const result = processValue(def, valueDatum, datumIndex, def.scopes); + let value = result.value; + if (invalidKey || !result.valid) { + this.markScopeDatumInvalid(def.scopes, columnSource, datumIndex, invalidData); + } + if (invalidKey) { + value = invalidValue; + } else if (!result.valid) { + partialValidDataCount += 1; + value = invalidValue; + } + if (!needsValueOf && value != null && typeof value === "object") { + needsValueOf = true; + } + column[datumIndex] = value; + } + columns.push(column); + allColumnScopes.push(columnScopes); + columnNeedValueOf.push(needsValueOf); + maxDataLength = Math.max(maxDataLength, column.length); + } + return { columns, columnScopes: allColumnScopes, columnNeedValueOf, partialValidDataCount, maxDataLength }; + } + /** + * GROUPED DATA STRUCTURE AND INVARIANTS: + * + * When groupsUnique=true (each datum has distinct keys): + * - groups.length === columns[i].length for all columns + * - groups[i] corresponds to datum at columns[j][i] + * - All datumIndices arrays contain [0] (shared memory optimization) + * - Relative indexing: datumIndices contains offsets from group start + * - Absolute indexing: groupIndex + relativeDatumIndex gives column position + * + * When groupsUnique=false (data is aggregated): + * - groups.length <= columns[i].length + * - Multiple datums may map to same group + * - datumIndices contain actual relative offsets + * + * This design optimizes memory usage for high-frequency data updates + * where each datum typically has unique keys (e.g., time series data). + */ + groupData(data, groupingFn) { + var _a; + const { keys: dataKeys, columns: allColumns, columnScopes, invalidKeys, invalidData } = data; + const allScopes = data.scopes; + const resultGroups = []; + const resultData = []; + const groups = allScopes.size !== 1 || groupingFn != null ? /* @__PURE__ */ new Map() : void 0; + let groupsUnique = true; + let groupIndex = 0; + const rawBatchCount = allScopes.size; + const columnBatches = this.groupBatches( + allScopes, + allColumns, + columnScopes, + dataKeys, + invalidData, + invalidKeys + ); + const mergedBatchCount = columnBatches.length; + if (this.debug.check() && !data.optimizations) { + data.optimizations = {}; + } + if (this.debug.check()) { + const mergeRatio = rawBatchCount > 0 ? 1 - mergedBatchCount / rawBatchCount : 0; + data.optimizations.batchMerging = { + originalBatchCount: rawBatchCount, + mergedBatchCount, + mergeRatio + }; + } + const singleBatch = columnBatches.length === 1; + const allZeroDatumIndices = Object.freeze(createArray(columnBatches[0][1].length, SHARED_ZERO_INDICES)); + for (const [ + scopes, + scopeColumnIndexes, + scopeKeys, + siblingScopes, + scopeInvalidData, + scopeInvalidKeys + ] of columnBatches) { + const firstColumn = allColumns[first(scopeColumnIndexes)]; + for (let datumIndex = 0; datumIndex < firstColumn.length; datumIndex++) { + if (scopeInvalidKeys?.[datumIndex] === true) + continue; + const keys = scopeKeys.map((k) => k[datumIndex]); + if (keys == null || keys.length === 0) { + throw new Error("AG Charts - no keys found for scope(s): " + scopes.join(", ")); + } + const group = groupingFn?.(keys) ?? keys; + const groupStr = groups == null ? void 0 : toKeyString(group); + let outputGroup = groups?.get(groupStr); + let currentGroup; + let currentGroupIndex; + let isNewGroup = false; + if (outputGroup == null) { + currentGroup = { + keys: group, + datumIndices: [], + aggregation: [], + validScopes: allScopes + }; + currentGroupIndex = groupIndex++; + outputGroup = [currentGroupIndex, currentGroup]; + isNewGroup = true; + groups?.set(groupStr, outputGroup); + resultGroups.push(currentGroup.keys); + resultData.push(currentGroup); + } else { + [currentGroupIndex, currentGroup] = outputGroup; + groupsUnique = false; + } + if (scopeInvalidData?.[datumIndex] === true) { + if (currentGroup.validScopes === allScopes) { + currentGroup.validScopes = new Set(allScopes.values()); + } + for (const invalidScope of siblingScopes) { + currentGroup.validScopes.delete(invalidScope); + } + } + if (isNewGroup && datumIndex === currentGroupIndex && singleBatch) { + currentGroup.datumIndices = allZeroDatumIndices; + } else { + if (!isNewGroup && currentGroup.datumIndices === allZeroDatumIndices) { + currentGroup.datumIndices = allZeroDatumIndices.map((arr) => [...arr]); + } + for (const columnIdx of scopeColumnIndexes) { + (_a = currentGroup.datumIndices)[columnIdx] ?? (_a[columnIdx] = []); + currentGroup.datumIndices[columnIdx].push(datumIndex - currentGroupIndex); + } + } + } + } + return { + ...data, + type: "grouped", + domain: { + ...data.domain, + groups: resultGroups + }, + groups: resultData, + groupsUnique, + optimizations: data.optimizations, + [DOMAIN_BANDS]: data[DOMAIN_BANDS] + }; + } + /** + * Groups and merges column batches for efficient processing. + * + * BATCH MERGING OPTIMIZATION: + * - Identifies columns that share the same data characteristics + * - Merges compatible batches to reduce iteration overhead + * - Can reduce processing iterations by 30-50% for multi-scope datasets + * + * Compatibility criteria: + * - Same keys arrays (by reference) + * - Same invalidity arrays (by reference) + * - Scopes can be safely processed together + */ + groupBatches(allScopes, allColumns, columnScopes, dataKeys, invalidData, invalidKeys) { + const columnBatches = []; + const processedColumnIndexes = /* @__PURE__ */ new Set(); + for (const scope of allScopes) { + const scopeColumnIndexes = allColumns.map((_, idx) => idx).filter((idx) => !processedColumnIndexes.has(idx) && columnScopes[idx].has(scope)); + if (scopeColumnIndexes.length === 0) + continue; + for (const idx of scopeColumnIndexes) { + processedColumnIndexes.add(idx); + } + const siblingScopes = /* @__PURE__ */ new Set(); + for (const columnIdx of scopeColumnIndexes) { + for (const columnScope of columnScopes[columnIdx]) { + siblingScopes.add(columnScope); + } + } + const scopeKeys = dataKeys.map((k) => k.get(scope)).filter((k) => k != null); + const scopeInvalidData = invalidData?.get(scope); + const scopeInvalidKeys = invalidKeys?.get(scope); + columnBatches.push([ + scope, + scopeColumnIndexes, + scopeKeys, + siblingScopes, + scopeInvalidData, + scopeInvalidKeys + ]); + } + return this.mergeCompatibleBatches(columnBatches); + } + /** + * Checks if two column batches can be merged based on shared data characteristics. + */ + areBatchesCompatible(batch1, batch2) { + const [, , keys1, , invalidData1, invalidKeys1] = batch1; + const [, , keys2, , invalidData2, invalidKeys2] = batch2; + return keys1.every((k, i) => k === keys2[i]) && invalidKeys1 === invalidKeys2 && invalidData1 === invalidData2; + } + mergeCompatibleBatches(columnBatches) { + const merged = []; + const processed = /* @__PURE__ */ new Set(); + for (let i = 0; i < columnBatches.length; i++) { + if (processed.has(i)) + continue; + const [scope, columnIndexes, keys, siblingScopes, invalidData, invalidKeys] = columnBatches[i]; + const mergedBatch = [ + [scope], + [...columnIndexes], + keys, + new Set(siblingScopes), + invalidData, + invalidKeys + ]; + this.findAndMergeCompatibleBatches(columnBatches, i, mergedBatch, processed); + merged.push(mergedBatch); + processed.add(i); + } + return merged; + } + findAndMergeCompatibleBatches(columnBatches, startIndex, mergedBatch, processed) { + const firstBatch = columnBatches[startIndex]; + for (let j = startIndex + 1; j < columnBatches.length; j++) { + if (processed.has(j)) + continue; + const otherBatch = columnBatches[j]; + const [scope, otherColumnIndexes, , otherSiblingScopes] = otherBatch; + if (!this.areBatchesCompatible(firstBatch, otherBatch)) + continue; + mergedBatch[0].push(scope); + mergedBatch[1].push(...otherColumnIndexes); + for (const siblingScope of otherSiblingScopes) { + mergedBatch[3].add(siblingScope); + } + processed.add(j); + } + } + aggregateUngroupedData(processedData) { + const domainAggValues = this.aggregates.map(() => [Infinity, -Infinity]); + processedData.domain.aggValues = domainAggValues; + const { columns, dataSources } = processedData; + const onlyScope = first(dataSources.keys()); + const keys = processedData.keys.map((k) => k.get(onlyScope)); + const rawData = dataSources.get(onlyScope)?.data ?? []; + processedData.aggregation = rawData?.map((_, datumIndex) => { + const aggregation = []; + for (const [index, def] of this.aggregates.entries()) { + const indices = this.valueGroupIdxLookup(def); + let groupAggValues = def.groupAggregateFunction?.() ?? [Infinity, -Infinity]; + const valuesToAgg = indices.map((columnIndex) => columns[columnIndex][datumIndex]); + const k = datumKeys(keys, datumIndex); + const valuesAgg = k == null ? void 0 : def.aggregateFunction(valuesToAgg, k); + if (valuesAgg) { + groupAggValues = def.groupAggregateFunction?.(valuesAgg, groupAggValues) ?? ContinuousDomain.extendDomain(valuesAgg, groupAggValues); + } + const finalValues = def.finalFunction?.(groupAggValues) ?? groupAggValues; + aggregation[index] = finalValues; + ContinuousDomain.extendDomain(finalValues, domainAggValues[index]); + } + return aggregation; + }); + } + aggregateGroupedData(processedData) { + const domainAggValues = this.aggregates.map(() => [Infinity, -Infinity]); + processedData.domain.aggValues = domainAggValues; + const { columns } = processedData; + for (const [index, def] of this.aggregates.entries()) { + const indices = this.valueGroupIdxLookup(def); + for (let groupIndex = 0; groupIndex < processedData.groups.length; groupIndex++) { + const group = processedData.groups[groupIndex]; + group.aggregation ?? (group.aggregation = []); + const groupKeys = group.keys; + let groupAggValues = def.groupAggregateFunction?.() ?? [Infinity, -Infinity]; + const maxDatumIndex = Math.max( + ...indices.map((columnIndex) => group.datumIndices[columnIndex]?.length ?? 0) + ); + for (let datumIndex = 0; datumIndex < maxDatumIndex; datumIndex++) { + const valuesToAgg = indices.map((columnIndex) => { + const relativeDatumIndex = group.datumIndices[columnIndex]?.[datumIndex]; + if (relativeDatumIndex == null) { + return void 0; + } + const absoluteDatumIndex = this.resolveAbsoluteIndex(groupIndex, relativeDatumIndex); + return columns[columnIndex][absoluteDatumIndex]; + }); + const valuesAgg = def.aggregateFunction(valuesToAgg, groupKeys); + if (valuesAgg) { + groupAggValues = def.groupAggregateFunction?.(valuesAgg, groupAggValues) ?? ContinuousDomain.extendDomain(valuesAgg, groupAggValues); + } + } + const finalValues = def.finalFunction?.(groupAggValues) ?? groupAggValues; + group.aggregation[index] = finalValues; + ContinuousDomain.extendDomain(finalValues, domainAggValues[index]); + } + } + } + postProcessGroups(processedData) { + const { groupProcessors } = this; + const { columnScopes, columns, invalidData } = processedData; + for (const processor of groupProcessors) { + const valueIndexes = this.valueGroupIdxLookup(processor); + const adjustFn = processor.adjust()(); + for (let groupIndex = 0; groupIndex < processedData.groups.length; groupIndex++) { + const dataGroup = processedData.groups[groupIndex]; + adjustFn(columns, valueIndexes, dataGroup, groupIndex); + } + for (const valueIndex of valueIndexes) { + const valueDef = this.values[valueIndex]; + const isDiscrete = valueDef.valueType === "category"; + const column = columns[valueIndex]; + const columnScope = first(columnScopes[valueIndex]); + const invalidDatums = invalidData?.get(columnScope); + const domain = isDiscrete ? new DiscreteDomain() : new ContinuousDomain(); + for (let datumIndex = 0; datumIndex < column.length; datumIndex += 1) { + if (invalidDatums?.[datumIndex] === true) + continue; + domain.extend(column[datumIndex]); + } + processedData.domain.values[valueIndex] = domain.getDomain(); + } + } + } + /** + * Reprocesses group processors for incremental updates. + * Only processes newly inserted groups to avoid double-processing. + * This is safe only when all group processors support reprocessing. + * Deduplicates change descriptions to avoid processing the same groups multiple times + * when multiple scopes share the same DataSet. + */ + reprocessGroupProcessors(processedData, scopeChanges) { + const { groupProcessors } = this; + const { columns } = processedData; + for (const processor of groupProcessors) { + if (!processor.supportsReprocessing) { + throw new Error( + "AG Charts - attempted to reprocess group processor that does not support reprocessing. This is an internal error that should not occur." + ); + } + } + const processedChangeDescs = /* @__PURE__ */ new Set(); + for (const [, changeDesc] of scopeChanges) { + if (processedChangeDescs.has(changeDesc)) + continue; + processedChangeDescs.add(changeDesc); + } + for (const processor of groupProcessors) { + const valueIndexes = this.valueGroupIdxLookup(processor); + const adjustFn = processor.adjust()(); + for (const changeDesc of processedChangeDescs) { + const { indexMap } = changeDesc; + for (const op of indexMap.spliceOps) { + if (op.insertCount > 0) { + for (let i = 0; i < op.insertCount; i++) { + const groupIndex = op.index + i; + const dataGroup = processedData.groups[groupIndex]; + adjustFn(columns, valueIndexes, dataGroup, groupIndex); + } + } + } + } + } + } + postProcessProperties(processedData) { + for (const { adjust, property, scopes } of this.propertyProcessors) { + for (const idx of this.valueIdxLookup(scopes, property)) { + adjust()(processedData, idx); + } + } + } + reduceData(processedData) { + processedData.reduced ?? (processedData.reduced = {}); + const { dataSources, keys } = processedData; + for (const def of this.reducers) { + const reducer = def.reducer(); + let accValue = def.initialValue; + if (processedData.type === "grouped") { + for (const group of processedData.groups) { + accValue = reducer(accValue, group.keys); + } + } else { + const onlyScope = isScoped(def) ? def.scopes[0] : first(dataSources.keys()); + const keyColumns = keys.map((k) => k.get(onlyScope)).filter((k) => k != null); + const keysParam = keyColumns.map(() => void 0); + const rawData = dataSources.get(onlyScope)?.data ?? []; + for (let datumIndex = 0; datumIndex < rawData.length; datumIndex += 1) { + for (let keyIdx = 0; keyIdx < keysParam.length; keyIdx++) { + keysParam[keyIdx] = keyColumns[keyIdx]?.[datumIndex]; + } + accValue = reducer(accValue, keysParam); + } + } + processedData.reduced[def.property] = accValue; + } + } + postProcessData(processedData) { + processedData.reduced ?? (processedData.reduced = {}); + for (const def of this.processors) { + processedData.reduced[def.property] = def.calculate( + processedData, + processedData.reduced[def.property] + ); + } + } + initDataDomainProcessor(domainMode) { + const { keys: keyDefs, values: valueDefs } = this; + const scopes = /* @__PURE__ */ new Set(); + for (const valueDef of valueDefs) { + if (!valueDef.scopes) + continue; + for (const scope of valueDef.scopes) { + scopes.add(scope); + } + } + const dataDomain = /* @__PURE__ */ new Map(); + const processorFns = /* @__PURE__ */ new Map(); + let allScopesHaveSameDefs = true; + const initDataDomain = () => { + for (const def of iterate(keyDefs, valueDefs)) { + if (def.valueType === "category") { + dataDomain.set(def, new DiscreteDomain()); + } else { + dataDomain.set(def, new ContinuousDomain()); + allScopesHaveSameDefs && (allScopesHaveSameDefs = (def.scopes?.length ?? 0) === scopes.size); + } + } + }; + initDataDomain(); + const accessors = this.buildAccessors(iterate(keyDefs, valueDefs)); + const reusableResult = { + value: void 0, + missing: false, + valid: false + }; + const processValue = (def, datum, idx, valueScopes) => { + let valueInDatum; + let value; + if (accessors.has(def.property)) { + try { + value = accessors.get(def.property)(datum); + } catch { + } + valueInDatum = value != null; + } else { + valueInDatum = def.property in datum; + value = valueInDatum ? datum[def.property] : def.missingValue; + } + if (def.forceValue != null) { + const valueNegative = valueInDatum && isNegative(value); + value = valueNegative ? -1 * def.forceValue : def.forceValue; + valueInDatum = true; + } + reusableResult.missing = !valueInDatum; + const missingValueDef = "missingValue" in def; + if (!valueInDatum && !missingValueDef) { + if (typeof valueScopes === "string") { + const missCount = def.missing.get(valueScopes) ?? 0; + def.missing.set(valueScopes, missCount + 1); + } else { + for (const scope of valueScopes) { + const missCount = def.missing.get(scope) ?? 0; + def.missing.set(scope, missCount + 1); + } + } + } + if (!dataDomain.has(def)) { + initDataDomain(); + } + const isKeyWithNullValue = def.type === "key" && value == null; + if (valueInDatum && def.validation?.(value, datum, idx) === false || isKeyWithNullValue) { + reusableResult.valid = false; + if ("invalidValue" in def) { + value = def.invalidValue; + } else { + if (this.mode !== "integrated") { + logger_exports.warnOnce( + `invalid value of type [${typeof value}] for [${def.scopes} / ${def.id}] ignored:`, + `[${value}]` + ); + } + reusableResult.value = void 0; + return reusableResult; + } + } else { + reusableResult.valid = true; + } + if (def.processor) { + let processor = processorFns.get(def); + if (processor == null) { + processor = def.processor(); + processorFns.set(def, processor); + } + value = processor(value, idx); + } + if (domainMode === "extend") { + dataDomain.get(def)?.extend(value); + } + reusableResult.value = value; + return reusableResult; + }; + return { dataDomain, processValue, initDataDomain, scopes, allScopesHaveSameDefs }; + } + /** + * Collects optimization metadata for debugging purposes. + * Only called when debug mode is enabled. + */ + collectOptimizationMetadata(processedData, pathTaken) { + const existingDomainBanding = processedData.optimizations?.domainBanding; + processedData.optimizations = { + performance: { + processingTime: processedData.time, + pathTaken + }, + ...existingDomainBanding && { domainBanding: existingDomainBanding } + }; + const reprocessingSupported = this.isReprocessingSupported(processedData); + const reprocessingApplied = pathTaken === "reprocess"; + let reprocessingReason; + if (!reprocessingSupported) { + const reasons = []; + if (processedData.type === "grouped") { + if (!processedData.groupsUnique) { + reasons.push("groupsUnique=false"); + } + const uniqueDataSets = this.getUniqueDataSets(processedData); + if (uniqueDataSets.size !== 1) { + reasons.push("multiple data sources"); + } + const scope = first(processedData.scopes); + const invalidKeys = processedData.invalidKeys?.get(scope); + if (invalidKeys?.some((invalid) => invalid)) { + reasons.push("has invalid keys"); + } + } + if (this.aggregates.length > 0) { + reasons.push("has aggregates"); + } + if (this.reducers.length > 0) { + reasons.push("has reducers"); + } + if (this.processors.length > 0) { + reasons.push("has processors"); + } + if (this.propertyProcessors.length > 0) { + reasons.push("has property processors"); + } + reprocessingReason = reasons.length > 0 ? reasons.join(", ") : void 0; + } + processedData.optimizations.reprocessing = { + applied: reprocessingApplied, + reason: reprocessingReason + }; + if (processedData.type === "grouped") { + let sharedGroupCount = 0; + const firstGroup = processedData.groups[0]; + if (firstGroup) { + const sharedDatumIndices = firstGroup.datumIndices; + for (const group of processedData.groups) { + if (group.datumIndices === sharedDatumIndices) { + sharedGroupCount++; + } + } + } + processedData.optimizations.sharedDatumIndices = { + applied: sharedGroupCount > 0, + sharedGroupCount, + totalGroupCount: processedData.groups.length + }; + } + } + /** + * Collects domain banding optimization metadata. + * Always called to make metadata available for testing and debugging. + * @param preScanDomainStats Per-domain pre-scan band statistics collected before extending domains + */ + collectDomainBandingMetadata(processedData, keyDomains, valueDomains, bandedDomains, preScanDomainStats) { + processedData.optimizations ?? (processedData.optimizations = {}); + const keyDefs = []; + const valueDefs = []; + for (const keyDef of this.keys) { + const domain = keyDomains.get(keyDef); + const bandedDomain = bandedDomains.get(keyDef); + const isBanded = domain instanceof BandedDomain; + let reason; + if (!isBanded) { + if (keyDef.valueType === "category") { + reason = "discrete domain"; + } else if (this.opts.domainBandingConfig?.enableBanding === false) { + reason = "banding disabled"; + } else { + reason = "not configured"; + } + } + let stats; + if (isBanded && bandedDomain) { + const domainStats = preScanDomainStats.get(bandedDomain) ?? bandedDomain.getStats(); + const scanRatio = domainStats.bandCount > 0 ? domainStats.dirtyBandCount / domainStats.bandCount : 0; + stats = { + totalBands: domainStats.bandCount, + dirtyBands: domainStats.dirtyBandCount, + dataSize: domainStats.dataSize, + scanRatio + }; + } + keyDefs.push({ + property: String(keyDef.property), + applied: isBanded, + reason, + stats + }); + } + for (const valueDef of this.values) { + const domain = valueDomains.get(valueDef); + const bandedDomain = bandedDomains.get(valueDef); + const isBanded = domain instanceof BandedDomain; + let reason; + if (!isBanded) { + if (valueDef.valueType === "category") { + reason = "discrete domain"; + } else if (this.opts.domainBandingConfig?.enableBanding === false) { + reason = "banding disabled"; + } else { + reason = "not configured"; + } + } + let stats; + if (isBanded && bandedDomain) { + const domainStats = preScanDomainStats.get(bandedDomain) ?? bandedDomain.getStats(); + const scanRatio = domainStats.bandCount > 0 ? domainStats.dirtyBandCount / domainStats.bandCount : 0; + stats = { + totalBands: domainStats.bandCount, + dirtyBands: domainStats.dirtyBandCount, + dataSize: domainStats.dataSize, + scanRatio + }; + } + valueDefs.push({ + property: String(valueDef.property), + applied: isBanded, + reason, + stats + }); + } + processedData.optimizations.domainBanding = { + keyDefs, + valueDefs + }; + } + buildAccessors(defs) { + const result = /* @__PURE__ */ new Map(); + if (this.suppressFieldDotNotation) { + return result; + } + for (const def of defs) { + const isPath = def.property.includes(".") || def.property.includes("["); + if (!isPath) + continue; + const components = getPathComponents(def.property); + if (components == null) { + logger_exports.warnOnce("Invalid property path [%s]", def.property); + continue; + } + const accessor = createPathAccessor(components); + result.set(def.property, accessor); + } + return result; + } +}; +function logProcessedData(processedData) { + const logValues = (name, data) => { + if (data.length > 0) { + logger_exports.log(`DataModel.processData() - ${name}`); + logger_exports.table(data); + } + }; + logger_exports.log("DataModel.processData() - processedData", processedData); + logValues("Key Domains", processedData.domain.keys); + logValues("Value Domains", processedData.domain.values); + logValues("Aggregate Domains", processedData.domain.aggValues ?? []); + if (processedData.optimizations) { + logger_exports.log("DataModel.processData() - Optimization Summary"); + const opt = processedData.optimizations; + if (opt.performance) { + logger_exports.log(` Performance: ${opt.performance.processingTime.toFixed(2)}ms (${opt.performance.pathTaken})`); + } + if (opt.reprocessing) { + const symbol = opt.reprocessing.applied ? "\u2713" : "\u2717"; + const reason = opt.reprocessing.reason ? ` (${opt.reprocessing.reason})` : ""; + logger_exports.log(` Reprocessing: ${symbol}${reason}`); + } + if (opt.domainBanding) { + const keyStats = opt.domainBanding.keyDefs.filter((d) => d.applied); + const valueStats = opt.domainBanding.valueDefs.filter((d) => d.applied); + const totalApplied = keyStats.length + valueStats.length; + const totalDefs = opt.domainBanding.keyDefs.length + opt.domainBanding.valueDefs.length; + if (totalApplied > 0) { + logger_exports.log(` Domain Banding: \u2713 (${totalApplied}/${totalDefs} definitions)`); + for (const def of [...keyStats, ...valueStats]) { + if (def.stats) { + const pct2 = (def.stats.scanRatio * 100).toFixed(1); + logger_exports.log( + ` ${def.property}: scanned ${def.stats.dirtyBands}/${def.stats.totalBands} bands (${pct2}%)` + ); + } + } + } else { + const reasons = [ + ...opt.domainBanding.keyDefs.filter((d) => !d.applied).map((d) => d.reason), + ...opt.domainBanding.valueDefs.filter((d) => !d.applied).map((d) => d.reason) + ]; + const uniqueReasons = [...new Set(reasons)].join(", "); + logger_exports.log(` Domain Banding: \u2717 (${uniqueReasons})`); + } + } + if (opt.sharedDatumIndices) { + const symbol = opt.sharedDatumIndices.applied ? "\u2713" : "\u2717"; + const ratio2 = `${opt.sharedDatumIndices.sharedGroupCount}/${opt.sharedDatumIndices.totalGroupCount}`; + logger_exports.log(` Shared DatumIndices: ${symbol} (${ratio2} groups)`); + } + if (opt.batchMerging) { + const pct2 = (opt.batchMerging.mergeRatio * 100).toFixed(0); + const reduction = `${opt.batchMerging.originalBatchCount} \u2192 ${opt.batchMerging.mergedBatchCount}`; + logger_exports.log(` Batch Merging: ${reduction} (${pct2}% reduction)`); + } + } +} + +// packages/ag-charts-community/src/chart/data/dataSet.ts +var DataSet = class _DataSet { + constructor(data) { + this.data = data; + this.pendingTransactions = []; + } + /** + * Creates an empty DataSet. + */ + static empty() { + return new _DataSet([]); + } + /** + * Wraps existing data in a DataSet. + */ + static wrap(data) { + return new _DataSet(data); + } + netSize() { + if (!this.hasPendingTransactions()) { + return this.data.length; + } + const changeDesc = this.getChangeDescription(); + return changeDesc ? changeDesc.indexMap.finalLength : this.data.length; + } + /** Queues a transaction (applied on commit). */ + addTransaction(transaction) { + this.pendingTransactions.push(transaction); + this.cachedChangeDescription = void 0; + } + hasPendingTransactions() { + return this.pendingTransactions.length > 0; + } + getPendingTransactionCount() { + return this.pendingTransactions.length; + } + /** Applies all pending transactions to the data array. */ + commitPendingTransactions() { + if (!this.hasPendingTransactions()) { + return false; + } + const changeDescription = this.getChangeDescription(); + if (!changeDescription) { + return false; + } + const allInsertions = [ + ...changeDescription.getPrependedValues(), + ...changeDescription.getAppendedValues() + ]; + let insertionIndex = 0; + changeDescription.applyToArray(this.data, () => allInsertions[insertionIndex++]); + this.pendingTransactions = []; + this.cachedChangeDescription = void 0; + return true; + } + clearPendingTransactions() { + const count = this.pendingTransactions.length; + this.pendingTransactions = []; + this.cachedChangeDescription = void 0; + return count; + } + getPendingTransactions() { + return [...this.pendingTransactions]; + } + /** Custom JSON serialization (avoids snapshot bloat). */ + toJSON() { + return this.data; + } + /** Builds a DataChangeDescription from pending transactions (does not modify data). */ + getChangeDescription() { + if (!this.hasPendingTransactions()) { + return void 0; + } + if (this.cachedChangeDescription) { + return this.cachedChangeDescription; + } + const { indexMap, prependValues, appendValues } = this.buildIndexMap(); + const changeDescription = new DataChangeDescription(indexMap, { + prependValues, + appendValues + }); + this.cachedChangeDescription = changeDescription; + return changeDescription; + } + /** + * Helper method to remove items from a list of groups. + * Mutates the groups in-place and removes found items from toRemove set. + * @param groups List of groups to search and remove from + * @param toRemove Set of items to remove (modified in-place) + */ + removeFromGroups(groups, toRemove) { + for (const group of groups) { + let i = 0; + while (i < group.length && toRemove.size > 0) { + if (toRemove.has(group[i])) { + toRemove.delete(group[i]); + group.splice(i, 1); + } else { + i++; + } + } + if (toRemove.size === 0) + break; + } + } + /** + * Builds the index transformation map by sequentially applying all pending transactions. + * Optimized to: + * - Track operation boundaries instead of individual items + * - Only scan for values that are actually being removed + * - Stop scanning early when all removed values are found + */ + buildIndexMap() { + const originalLength = this.data.length; + const prependsList = []; + const appendsList = []; + const removedOriginalIndices = /* @__PURE__ */ new Set(); + for (const transaction of this.pendingTransactions) { + const { prepend, append, remove } = transaction; + if (Array.isArray(prepend) && prepend.length > 0) { + prependsList.unshift([...prepend]); + } + if (Array.isArray(append) && append.length > 0) { + appendsList.push([...append]); + } + if (Array.isArray(remove) && remove.length > 0) { + const toRemove = new Set(remove); + this.removeFromGroups(prependsList, toRemove); + if (toRemove.size > 0) { + this.removeFromGroups(appendsList, toRemove); + } + if (toRemove.size > 0) { + for (let i = 0; i < this.data.length && toRemove.size > 0; i++) { + const value = this.data[i]; + if (toRemove.has(value)) { + removedOriginalIndices.add(i); + toRemove.delete(value); + } + } + } + } + } + const survivingPrepends = prependsList.flat(); + const survivingAppends = appendsList.flat(); + const totalPrependCount = survivingPrepends.length; + const totalAppendCount = survivingAppends.length; + const survivingOriginalCount = originalLength - removedOriginalIndices.size; + const finalLength = totalPrependCount + survivingOriginalCount + totalAppendCount; + const spliceOps = []; + if (totalPrependCount > 0) { + spliceOps.push({ + index: 0, + deleteCount: 0, + insertCount: totalPrependCount + }); + } + if (removedOriginalIndices.size > 0) { + const sortedRemovals = Array.from(removedOriginalIndices).sort((a, b) => b - a); + let currentGroupStart = sortedRemovals[0]; + let currentGroupCount = 1; + for (let i = 1; i < sortedRemovals.length; i++) { + const currentIndex = sortedRemovals[i]; + const prevIndex = sortedRemovals[i - 1]; + if (prevIndex - currentIndex === 1) { + currentGroupCount++; + } else { + spliceOps.push({ + index: currentGroupStart - currentGroupCount + 1 + totalPrependCount, + deleteCount: currentGroupCount, + insertCount: 0 + }); + currentGroupStart = currentIndex; + currentGroupCount = 1; + } + } + spliceOps.push({ + index: currentGroupStart - currentGroupCount + 1 + totalPrependCount, + deleteCount: currentGroupCount, + insertCount: 0 + }); + } + if (totalAppendCount > 0) { + spliceOps.push({ + index: totalPrependCount + survivingOriginalCount, + deleteCount: 0, + insertCount: totalAppendCount + }); + } + const indexMap = { + originalLength, + finalLength, + spliceOps, + removedIndices: removedOriginalIndices, + totalPrependCount, + totalAppendCount + }; + return { + indexMap, + prependValues: survivingPrepends, + appendValues: survivingAppends + }; + } +}; + +// packages/ag-charts-community/src/chart/data/dataController.ts +function getPropertyKeys(props) { + return props.filter((p) => p.type === "key").map((p) => p.property).join(";"); +} +var _DataController = class _DataController { + constructor(mode, suppressFieldDotNotation) { + this.mode = mode; + this.suppressFieldDotNotation = suppressFieldDotNotation; + this.debug = Debug.create(true, "data-model"); + this.requested = []; + this.status = "setup"; + } + async request(id, dataSet, opts) { + if (this.status !== "setup") { + throw new Error(`AG Charts - data request after data setup phase.`); + } + return new Promise((resolve, reject) => { + this.requested.push({ id, opts, dataSet, resolve, reject }); + }); + } + execute(cachedData) { + if (this.status !== "setup") { + throw new Error(`AG Charts - data request after data setup phase.`); + } + this.status = "executed"; + const dataSets = /* @__PURE__ */ new Map(); + for (const request of this.requested) { + if (request.dataSet.hasPendingTransactions()) { + dataSets.set(request.dataSet, request.dataSet.getChangeDescription()); + } + request.dataSet.commitPendingTransactions(); + } + this.debug("DataController.execute() - requested", this.requested); + const valid = this.validateRequests(this.requested); + this.debug("DataController.execute() - validated", valid); + const merged = this.mergeRequested(valid); + this.debug("DataController.execute() - merged", merged); + if (this.debug.check()) { + getWindow().processedData = []; + } + const nextCachedData = []; + for (const { dataSet, ids, opts, resolves, rejects } of merged) { + const reusableCache = cachedData?.find((cacheItem) => canReuseCachedData(cacheItem, dataSet, ids, opts)); + const resolveResult = (dataModel2, processedData2) => { + if (this.debug.check()) { + getWindow("processedData").push(processedData2); + } + if (processedData2 == null) { + for (const cb of rejects) { + cb(new Error(`AG Charts - no processed data generated`)); + } + return; + } + nextCachedData.push({ opts, dataSet, dataLength: dataSet.data.length, ids, dataModel: dataModel2, processedData: processedData2 }); + for (const resolve of resolves) { + resolve({ dataModel: dataModel2, processedData: processedData2 }); + } + }; + const fullReprocess = () => { + try { + const dataModel2 = new DataModel(opts, this.mode, this.suppressFieldDotNotation); + const sources = new Map(valid.map((v) => [v.id, v.dataSet])); + const processedData2 = dataModel2.processData(sources); + resolveResult(dataModel2, processedData2); + return dataModel2; + } catch (error2) { + for (const cb of rejects) { + cb(error2); + } + } + }; + if (reusableCache == null) { + fullReprocess(); + continue; + } + const { dataModel, processedData } = reusableCache; + const changeDescription = dataSets.get(dataSet); + if (processedData && changeDescription && dataModel.isReprocessingSupported(processedData)) { + this.debug("DataController.execute() - reprocessing data", processedData, dataSet); + dataModel.reprocessData(processedData, dataSets); + if (Debug.check("data-model:reprocess-diff")) { + const baselineModel = new DataModel(opts, this.mode, this.suppressFieldDotNotation); + const sources = new Map(valid.map((v) => [v.id, v.dataSet])); + const baselineData = baselineModel.processData(sources); + const reprocessedJson = JSON.parse(JSON.stringify(processedData, _DataController.jsonReplacer)); + const baselineJson = JSON.parse(JSON.stringify(baselineData, _DataController.jsonReplacer)); + delete reprocessedJson.time; + delete reprocessedJson.optimizations; + delete baselineJson.time; + delete baselineJson.optimizations; + const diff8 = jsonDiff(baselineJson, reprocessedJson); + if (diff8) { + logger_exports.log("\u26A0\uFE0F DATA-MODEL REPROCESS DIFF DETECTED \u26A0\uFE0F"); + logger_exports.log("Difference between incremental update and full reprocess:"); + logger_exports.log(""); + logger_exports.log("BASELINE (full reprocess):"); + logger_exports.log(JSON.stringify(baselineJson, null, 2)); + logger_exports.log(""); + logger_exports.log("REPROCESSED (incremental update):"); + logger_exports.log(JSON.stringify(reprocessedJson, null, 2)); + logger_exports.log(""); + logger_exports.log("DIFF (what changed):"); + logger_exports.log(JSON.stringify(diff8, null, 2)); + } else { + logger_exports.log("\u2705 Data-model reprocess matches baseline (no diff)"); + } + } + resolveResult(dataModel, processedData); + continue; + } + fullReprocess(); + } + return nextCachedData; + } + validateRequests(requested) { + const valid = []; + for (const [index, request] of requested.entries()) { + if (index > 0 && request.dataSet.data.length !== requested[0].dataSet.data.length && request.opts.groupByData === false && request.opts.groupByKeys === false) { + request.reject( + new Error("all series[].data arrays must be of the same length and have matching keys.") + ); + } else { + valid.push(request); + } + } + return valid; + } + mergeRequested(requested) { + const grouped = []; + for (const request of requested) { + const match = grouped.find(_DataController.groupMatch(request)); + if (match) { + match.push(request); + } else { + grouped.push([request]); + } + } + return grouped.map(_DataController.mergeRequests); + } + static groupMatch({ dataSet, opts }) { + const { groupByData, groupByKeys = false, groupByFn, props } = opts; + const propsKeys = getPropertyKeys(props); + return ([group]) => (groupByData === false || group.dataSet === dataSet) && (group.opts.groupByKeys ?? false) === groupByKeys && group.opts.groupByFn === groupByFn && getPropertyKeys(group.opts.props) === propsKeys; + } + static mergeRequests(requests) { + const result = { + ids: [], + rejects: [], + resolves: [], + dataSet: requests[0].dataSet, + opts: { ...requests[0].opts, props: [] } + }; + const optsByTypeAndDataId = /* @__PURE__ */ new Map(); + const dataIds = /* @__PURE__ */ new Map(); + let nextDataId = 0; + for (const request of requests) { + const { + id, + dataSet, + resolve, + reject, + opts: { props, ...opts } + } = request; + result.ids.push(id); + result.rejects.push(reject); + result.resolves.push(resolve); + result.dataSet ?? (result.dataSet = dataSet); + result.opts ?? (result.opts = { ...opts, props: [] }); + for (const prop of props) { + const clone2 = { ...prop, scopes: [id], data: dataSet.data }; + _DataController.createIdsMap(id, clone2); + let dataId; + if (_DataController.crossScopeMergableTypes.has(clone2.type)) { + dataId = -1; + } else if (dataIds.has(dataSet.data)) { + dataId = dataIds.get(dataSet.data); + } else { + dataId = nextDataId++; + dataIds.set(dataSet.data, dataId); + } + const matchKey = `${clone2.type}-${dataId}-${clone2.groupId}`; + const matches = optsByTypeAndDataId.get(matchKey); + const match = matches?.find((existing) => _DataController.deepEqual(existing, clone2)); + if (matches == null) { + result.opts.props.push(clone2); + optsByTypeAndDataId.set(matchKey, [clone2]); + continue; + } else if (match == null) { + result.opts.props.push(clone2); + matches.push(clone2); + continue; + } + if (clone2.scopes != null) { + match.scopes ?? (match.scopes = []); + match.scopes.push(...clone2.scopes); + } + if ((match.type === "key" || match.type === "value") && clone2.idsMap?.size) { + match.idsMap ?? (match.idsMap = /* @__PURE__ */ new Map()); + _DataController.mergeIdsMap(clone2.idsMap, match.idsMap); + } + } + } + return result; + } + static mergeIdsMap(fromMap, toMap) { + for (const [scope, ids] of fromMap) { + const toMapValue = toMap.get(scope); + if (toMapValue == null) { + toMap.set(scope, new Set(ids)); + } else { + for (const id of ids) { + toMapValue.add(id); + } + } + } + } + static createIdsMap(scope, prop) { + if (prop.id == null) + return; + prop.idsMap ?? (prop.idsMap = /* @__PURE__ */ new Map()); + if (prop.idsMap.has(scope)) { + prop.idsMap.get(scope).add(prop.id); + } else { + prop.idsMap.set(scope, /* @__PURE__ */ new Set([prop.id])); + } + } + static deepEqual(a, b) { + if (a === b) { + return true; + } + if (a && b && typeof a == "object" && typeof b == "object") { + if (a.constructor !== b.constructor) { + return false; + } + let i, length2; + if (Array.isArray(a)) { + length2 = a.length; + if (length2 !== b.length) { + return false; + } + for (i = length2 - 1; i >= 0; i--) { + if (!_DataController.deepEqual(a[i], b[i])) { + return false; + } + } + return true; + } + const keys = Object.keys(a); + length2 = keys.length; + if (length2 !== Object.keys(b).length) { + return false; + } + for (i = length2 - 1; i >= 0; i--) { + const key = keys[i]; + if (!_DataController.skipKeys.has(key) && (!Object.hasOwn(b, key) || !_DataController.deepEqual(a[key], b[key]))) { + return false; + } + } + return true; + } + return false; + } + /** JSON replacer for serializing non-JSON-serializable objects like Map and Set */ + static jsonReplacer(_key, value) { + if (value instanceof Map) { + return { __type: "Map", value: Array.from(value.entries()) }; + } + if (value instanceof Set) { + return { __type: "Set", value: Array.from(value) }; + } + return value; + } +}; +_DataController.crossScopeMergableTypes = /* @__PURE__ */ new Set(["key", "group-value-processor"]); +// optimized version of deep equality for `mergeRequests` which can potentially loop over 1M times +_DataController.skipKeys = /* @__PURE__ */ new Set(["id", "idsMap", "type", "scopes", "data"]); +var DataController = _DataController; + +// packages/ag-charts-community/src/chart/factory/axisRegistry.ts +var AxisRegistry = class { + constructor() { + this.axesMap = /* @__PURE__ */ new Map(); + this.themeTemplates = /* @__PURE__ */ new Map(); + } + register(axisType, module2) { + this.axesMap.set(axisType, module2.moduleFactory); + if (module2.themeTemplate) { + this.setThemeTemplate(axisType, module2.themeTemplate); + } + } + create(axisType, moduleContext) { + const axisFactory = this.axesMap.get(axisType); + if (axisFactory) { + return axisFactory(moduleContext); + } + throw new Error(`AG Charts - unknown axis type: ${axisType}`); + } + has(axisType) { + return this.axesMap.has(axisType); + } + keys() { + return this.axesMap.keys(); + } + setThemeTemplate(axisType, themeTemplate) { + this.themeTemplates.set(axisType, themeTemplate); + return this; + } + getThemeTemplate(axisType) { + return this.themeTemplates.get(axisType); + } +}; +var axisRegistry = new AxisRegistry(); + +// packages/ag-charts-community/src/chart/factory/expectedEnterpriseModules.ts +var EXPECTED_ENTERPRISE_MODULES = [ + { + type: "root", + optionsKey: "animation", + chartTypes: ["cartesian", "polar", "topology", "standalone"] + }, + { type: "root", optionsKey: "annotations", chartTypes: ["cartesian"] }, + { + type: "root", + optionsKey: "background", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + optionsInnerKey: "image" + }, + { + type: "root", + optionsKey: "foreground", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + optionsInnerKey: "image" + }, + { + type: "root", + optionsKey: "chartToolbar", + chartTypes: ["cartesian"] + }, + { + type: "root", + optionsKey: "contextMenu", + chartTypes: ["cartesian", "polar", "topology", "standalone"] + }, + { type: "root", optionsKey: "statusBar", chartTypes: ["cartesian"], identifier: "status-bar" }, + { + type: "root", + optionsKey: "dataSource", + chartTypes: ["cartesian", "polar", "topology", "standalone"] + }, + { type: "root", optionsKey: "sync", chartTypes: ["cartesian"] }, + { type: "root", optionsKey: "zoom", chartTypes: ["cartesian", "topology"] }, + { type: "root", optionsKey: "ranges", chartTypes: ["cartesian"] }, + { + type: "legend", + optionsKey: "gradientLegend", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + identifier: "gradient" + }, + { type: "root", optionsKey: "navigator", chartTypes: ["cartesian"] }, + { type: "axis", optionsKey: "axes[]", chartTypes: ["polar"], identifier: "angle-category" }, + { type: "axis", optionsKey: "axes[]", chartTypes: ["polar"], identifier: "angle-number" }, + { type: "axis", optionsKey: "axes[]", chartTypes: ["polar"], identifier: "radius-category" }, + { type: "axis", optionsKey: "axes[]", chartTypes: ["polar"], identifier: "radius-number" }, + { type: "axis", optionsKey: "axes[]", chartTypes: ["cartesian"], identifier: "ordinal-time" }, + { type: "axis-option", optionsKey: "crosshair", chartTypes: ["cartesian"] }, + { type: "axis-option", optionsKey: "bandHighlight", chartTypes: ["cartesian"] }, + { type: "series", optionsKey: "series[]", chartTypes: ["cartesian"], identifier: "box-plot" }, + { type: "series", optionsKey: "series[]", chartTypes: ["cartesian"], identifier: "candlestick" }, + { type: "series", optionsKey: "series[]", chartTypes: ["cartesian"], identifier: "cone-funnel" }, + { type: "series", optionsKey: "series[]", chartTypes: ["cartesian"], identifier: "funnel" }, + { type: "series", optionsKey: "series[]", chartTypes: ["cartesian"], identifier: "ohlc" }, + { type: "series", optionsKey: "series[]", chartTypes: ["cartesian"], identifier: "heatmap" }, + { type: "series", optionsKey: "series[]", chartTypes: ["cartesian"], identifier: "range-area" }, + { type: "series", optionsKey: "series[]", chartTypes: ["cartesian"], identifier: "range-bar" }, + { type: "series", optionsKey: "series[]", chartTypes: ["cartesian"], identifier: "waterfall" }, + { type: "series", optionsKey: "series[]", chartTypes: ["polar"], identifier: "nightingale" }, + { type: "series", optionsKey: "series[]", chartTypes: ["polar"], identifier: "radar-area" }, + { type: "series", optionsKey: "series[]", chartTypes: ["polar"], identifier: "radar-line" }, + { type: "series", optionsKey: "series[]", chartTypes: ["polar"], identifier: "radial-bar" }, + { type: "series", optionsKey: "series[]", chartTypes: ["polar"], identifier: "radial-column" }, + { type: "series", optionsKey: "series[]", chartTypes: ["topology"], identifier: "map-shape" }, + { type: "series", optionsKey: "series[]", chartTypes: ["topology"], identifier: "map-line" }, + { type: "series", optionsKey: "series[]", chartTypes: ["topology"], identifier: "map-marker" }, + { type: "series", optionsKey: "series[]", chartTypes: ["topology"], identifier: "map-shape-background" }, + { type: "series", optionsKey: "series[]", chartTypes: ["topology"], identifier: "map-line-background" }, + { type: "series", optionsKey: "series[]", chartTypes: ["standalone"], identifier: "pyramid" }, + { type: "series", optionsKey: "series[]", chartTypes: ["standalone"], identifier: "linear-gauge" }, + { type: "series", optionsKey: "series[]", chartTypes: ["standalone"], identifier: "radial-gauge" }, + { type: "series", optionsKey: "series[]", chartTypes: ["standalone"], identifier: "sunburst" }, + { type: "series", optionsKey: "series[]", chartTypes: ["standalone"], identifier: "treemap" }, + { type: "series", optionsKey: "series[]", chartTypes: ["standalone"], identifier: "chord" }, + { type: "series", optionsKey: "series[]", chartTypes: ["standalone"], identifier: "sankey" }, + { type: "series-option", optionsKey: "errorBar", chartTypes: ["cartesian"], identifier: "error-bars" }, + { type: "context", contextKey: "sharedToolbar", chartTypes: ["cartesian"] } +]; +function getEnterpriseSeriesChartTypes(type) { + return EXPECTED_ENTERPRISE_MODULES.find((s) => s.type === "series" && s.identifier === type)?.chartTypes; +} +function isEnterpriseCartesian(seriesType) { + const type = getEnterpriseSeriesChartTypes(seriesType)?.find((v) => v === "cartesian"); + return type === "cartesian"; +} +function isEnterprisePolar(seriesType) { + const type = getEnterpriseSeriesChartTypes(seriesType)?.find((v) => v === "polar"); + return type === "polar"; +} +function isEnterpriseTopology(seriesType) { + const type = getEnterpriseSeriesChartTypes(seriesType)?.find((v) => v === "topology"); + return type === "topology"; +} +function isEnterpriseStandalone(seriesType) { + const type = getEnterpriseSeriesChartTypes(seriesType)?.find((v) => v === "standalone"); + return type === "standalone"; +} +function isEnterpriseModule(module2) { + return module2.packageType === "enterprise"; +} +function verifyIfModuleExpected(module2) { + if (!isEnterpriseModule(module2)) { + throw new Error("AG Charts - internal configuration error, only enterprise modules need verification."); + } + const stub = EXPECTED_ENTERPRISE_MODULES.find((s) => { + return s.type === module2.type && ("optionsKey" in s && "optionsKey" in module2 ? s.optionsKey === module2.optionsKey : true) && ("contextKey" in s && "contextKey" in module2 ? s.contextKey === module2.contextKey : true) && s.identifier === module2.identifier && module2.chartTypes.every((t) => s.chartTypes.includes(t)); + }); + if (stub) { + stub.useCount ?? (stub.useCount = 0); + stub.useCount++; + } + return stub != null; +} +function getUnusedExpectedModules() { + return EXPECTED_ENTERPRISE_MODULES.filter(({ useCount }) => useCount == null || useCount === 0); +} + +// packages/ag-charts-community/src/chart/factory/legendRegistry.ts +var LegendRegistry = class { + constructor() { + this.legendMap = /* @__PURE__ */ new Map(); + this.themeTemplates = /* @__PURE__ */ new Map(); + } + register(legendType, { optionsKey, moduleFactory, themeTemplate }) { + this.legendMap.set(legendType, { optionsKey, moduleFactory }); + this.themeTemplates.set(optionsKey, themeTemplate); + } + create(legendType, moduleContext) { + const legendFactory = this.legendMap.get(legendType)?.moduleFactory; + if (legendFactory) { + return legendFactory(moduleContext); + } + throw new Error(`AG Charts - unknown legend type: ${legendType}`); + } + getThemeTemplates() { + return Object.fromEntries(this.themeTemplates); + } + getKeys() { + return Array.from(this.legendMap.entries()).reduce( + (result, [legendType, record]) => { + result[legendType] = record.optionsKey; + return result; + }, + {} + ); + } +}; +var legendRegistry = new LegendRegistry(); + +// packages/ag-charts-community/src/chart/factory/chartTypes.ts +var ChartTypes = class extends Map { + get(seriesType) { + return super.get(seriesType) ?? "unknown"; + } + isCartesian(seriesType) { + return this.get(seriesType) === "cartesian"; + } + isPolar(seriesType) { + return this.get(seriesType) === "polar"; + } + isTopology(seriesType) { + return this.get(seriesType) === "topology"; + } + isStandalone(seriesType) { + return this.get(seriesType) === "standalone"; + } + get seriesTypes() { + return Array.from(this.keys()); + } + get cartesianTypes() { + return this.seriesTypes.filter((t) => this.isCartesian(t)); + } + get polarTypes() { + return this.seriesTypes.filter((t) => this.isPolar(t)); + } + get topologyTypes() { + return this.seriesTypes.filter((t) => this.isTopology(t)); + } + get standaloneTypes() { + return this.seriesTypes.filter((t) => this.isStandalone(t)); + } +}; +var ChartDefaults = class extends Map { + set(chartType, defaults) { + return super.set(chartType, mergeDefaults(defaults, this.get(chartType))); + } +}; +var chartTypes2 = new ChartTypes(); +var publicChartTypes = new ChartTypes(); +var chartDefaults = new ChartDefaults(); + +// packages/ag-charts-community/src/chart/factory/seriesRegistry.ts +var SeriesRegistry = class { + constructor() { + this.seriesMap = /* @__PURE__ */ new Map(); + this.themeTemplates = /* @__PURE__ */ new Map(); + } + register(seriesType, { + chartTypes: [chartType], + moduleFactory, + predictAxis, + defaultAxes, + themeTemplate, + solo, + stackable, + groupable, + stackedByDefault, + hidden + }) { + this.setThemeTemplate(seriesType, themeTemplate); + this.seriesMap.set(seriesType, { + moduleFactory, + predictAxis, + defaultAxes, + solo, + stackable, + groupable, + stackedByDefault + }); + chartTypes2.set(seriesType, chartType); + if (!hidden) { + publicChartTypes.set(seriesType, chartType); + } + } + create(seriesType, moduleContext) { + const seriesFactory = this.seriesMap.get(seriesType)?.moduleFactory; + if (seriesFactory) { + return seriesFactory(moduleContext); + } + throw new Error(`AG Charts - unknown series type: ${seriesType}`); + } + predictAxes(seriesType, userSeriesOptions, data) { + if (!userSeriesOptions) + return; + const seriesData = userSeriesOptions?.data ?? data; + if (!seriesData?.length) + return; + const predictAxis = this.seriesMap.get(seriesType)?.predictAxis; + if (!predictAxis) + return; + const axes = /* @__PURE__ */ new Map(); + const indices = distribute(0, seriesData.length - 1, 5); + for (const index of indices) { + const datum = seriesData[index]; + for (const direction of Object.values(ChartAxisDirection)) { + const axis = predictAxis(direction, datum, userSeriesOptions); + if (!axes.has(direction)) { + axes.set(direction, axis); + continue; + } + const prevAxis = axes.get(direction); + if (!axis && !prevAxis) + continue; + if (!axis || !prevAxis) + return; + for (const key of Object.keys(prevAxis)) { + if (prevAxis[key] !== axis[key]) { + return; + } + } + } + } + for (const [direction, axis] of axes) { + if (!axis) + axes.delete(direction); + } + if (axes.size === 0) + return; + if (axes.size === 1) { + const defaultAxes = this.cloneDefaultAxes(seriesType); + if (!defaultAxes) + return; + const [predictedAxis] = axes.values(); + return defaultAxes.map((axis) => { + if (axis.type === "category" /* CATEGORY */) { + return predictedAxis; + } + return axis; + }); + } + return Array.from(axes.values()); + } + cloneDefaultAxes(seriesType) { + const defaultAxes = this.seriesMap.get(seriesType)?.defaultAxes; + if (defaultAxes == null) + return null; + return deepClone(defaultAxes); + } + setThemeTemplate(seriesType, themeTemplate) { + const currentTemplate = this.themeTemplates.get(seriesType); + this.themeTemplates.set(seriesType, mergeDefaults(themeTemplate, currentTemplate)); + } + getThemeTemplate(seriesType) { + return this.themeTemplates.get(seriesType); + } + isSolo(seriesType) { + return this.seriesMap.get(seriesType)?.solo ?? false; + } + isGroupable(seriesType) { + return this.seriesMap.get(seriesType)?.groupable ?? false; + } + isStackable(seriesType) { + return this.seriesMap.get(seriesType)?.stackable ?? false; + } + isStackedByDefault(seriesType) { + return this.seriesMap.get(seriesType)?.stackedByDefault ?? false; + } +}; +var seriesRegistry = new SeriesRegistry(); + +// packages/ag-charts-community/src/chart/interaction/syncManager.ts +var _SyncManager = class _SyncManager { + constructor(chart) { + this.chart = chart; + } + subscribe(groupId = _SyncManager.DEFAULT_GROUP) { + let syncGroup = this.get(groupId); + if (!syncGroup) { + syncGroup = { members: /* @__PURE__ */ new Set() }; + _SyncManager.chartsGroups.set(groupId, syncGroup); + } + syncGroup.members.add(this.chart); + return this; + } + unsubscribe(groupId = _SyncManager.DEFAULT_GROUP) { + const groupState = this.get(groupId); + groupState?.members.delete(this.chart); + delete groupState?.domains?.x?.sources?.[this.chart.id]; + delete groupState?.domains?.y?.sources?.[this.chart.id]; + return this; + } + getChart() { + return this.chart; + } + getGroupState(groupId = _SyncManager.DEFAULT_GROUP) { + return this.get(groupId); + } + getGroupMembers(groupId = _SyncManager.DEFAULT_GROUP) { + const syncGroup = this.get(groupId); + return syncGroup ? Array.from(syncGroup.members) : []; + } + getGroupSiblings(groupId = _SyncManager.DEFAULT_GROUP) { + return this.getGroupMembers(groupId).filter((chart) => chart !== this.chart); + } + getGroupSyncMode(groupId = _SyncManager.DEFAULT_GROUP) { + if (this.getGroupMembers(groupId).some((c) => c.series.length > 1)) { + return "multi-series"; + } + return "single-series"; + } + get(groupId) { + return _SyncManager.chartsGroups.get(groupId); + } +}; +_SyncManager.chartsGroups = /* @__PURE__ */ new Map(); +_SyncManager.DEFAULT_GROUP = Symbol("sync-group-default"); +var SyncManager = _SyncManager; + +// packages/ag-charts-community/src/chart/keyboard.ts +var Keyboard = class extends BaseProperties { + constructor() { + super(...arguments); + this.enabled = false; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], Keyboard.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Keyboard.prototype, "tabIndex", 2); + +// packages/ag-charts-community/src/motion/fromToMotion.ts +var fromToMotion_exports = {}; +__export(fromToMotion_exports, { + NODE_UPDATE_STATE_TO_PHASE_MAPPING: () => NODE_UPDATE_STATE_TO_PHASE_MAPPING, + fromToMotion: () => fromToMotion, + staticFromToMotion: () => staticFromToMotion +}); +var NODE_UPDATE_STATE_TO_PHASE_MAPPING = { + added: "add", + updated: "update", + removed: "remove", + unknown: "initial", + "no-op": "none" +}; +function fromToMotion(groupId, subId, animationManager, selectionsOrNodes, fns, getDatumId, diff8) { + const { fromFn, toFn, applyFn = (node, props) => node.setProperties(props) } = fns; + const { nodes, selections } = deconstructSelectionsOrNodes(selectionsOrNodes); + const processNodes = (liveNodes, subNodes) => { + let prevFromProps; + let liveNodeIndex = 0; + let nodeIndex = 0; + for (const node of subNodes) { + const isLive = liveNodes[liveNodeIndex] === node; + const ctx = { + last: nodeIndex >= subNodes.length - 1, + lastLive: liveNodeIndex >= liveNodes.length - 1, + prev: subNodes[nodeIndex - 1], + prevFromProps, + prevLive: liveNodes[liveNodeIndex - 1], + next: subNodes[nodeIndex + 1], + nextLive: liveNodes[liveNodeIndex + (isLive ? 1 : 0)] + }; + const animationId = `${groupId}_${subId}_${node.id}`; + animationManager.stopByAnimationId(animationId); + let status = "unknown"; + if (!isLive) { + status = "removed"; + } else if (getDatumId && diff8) { + status = calculateStatus(node, node.datum, getDatumId, diff8); + } + node.transitionOut = status === "removed"; + const { phase, start: start2, finish, delay, duration, ...from3 } = fromFn(node, node.datum, status, ctx); + const { + phase: toPhase, + start: toStart, + finish: toFinish, + delay: toDelay, + duration: toDuration, + ...to + } = toFn(node, node.datum, status, ctx); + const collapsable = finish == null; + animationManager.animate({ + id: animationId, + groupId, + phase: phase ?? toPhase ?? "update", + duration: duration ?? toDuration, + delay: delay ?? toDelay, + from: from3, + to, + ease: easeOut, + collapsable, + onPlay: () => { + const startProps = { ...start2, ...toStart, ...from3 }; + applyFn(node, startProps, "start"); + }, + onUpdate(props) { + applyFn(node, props, "update"); + }, + onStop: () => { + const endProps = { + ...start2, + ...toStart, + ...from3, + ...to, + ...finish, + ...toFinish + }; + applyFn(node, endProps, "end"); + } + }); + if (isLive) { + liveNodeIndex++; + } + nodeIndex++; + prevFromProps = from3; + } + }; + let selectionIndex = 0; + for (const selection of selections) { + const selectionNodes = selection.nodes(); + const liveNodes = selectionNodes.filter((n) => !selection.isGarbage(n)); + processNodes(liveNodes, selectionNodes); + animationManager.animate({ + id: `${groupId}_${subId}_selection_${selectionIndex}`, + groupId, + phase: "end", + from: 0, + to: 1, + ease: easeOut, + onStop() { + selection.cleanup(); + } + }); + selectionIndex++; + } + processNodes(nodes, nodes); +} +function staticFromToMotion(groupId, subId, animationManager, selectionsOrNodes, from3, to, extraOpts) { + const { nodes, selections } = deconstructSelectionsOrNodes(selectionsOrNodes); + const { start: start2, finish, phase } = extraOpts; + animationManager.animate({ + id: `${groupId}_${subId}`, + groupId, + phase: phase ?? "update", + from: from3, + to, + ease: easeOut, + onPlay: () => { + if (!start2) + return; + for (const node of nodes) { + node.setProperties(start2); + } + for (const selection of selections) { + for (const node of selection.nodes()) { + node.setProperties(start2); + } + } + }, + onUpdate(props) { + for (const node of nodes) { + node.setProperties(props); + } + for (const selection of selections) { + for (const node of selection.nodes()) { + node.setProperties(props); + } + } + }, + onStop: () => { + for (const node of nodes) { + node.setProperties({ ...to, ...finish }); + } + for (const selection of selections) { + for (const node of selection.nodes()) { + node.setProperties({ ...to, ...finish }); + } + selection.cleanup(); + } + } + }); +} +function calculateStatus(node, datum, getDatumId, diff8) { + const id = getDatumId(node, datum); + if (diff8.added.has(id)) { + return "added"; + } + if (diff8.removed.has(id)) { + return "removed"; + } + if (node.previousDatum == null && node.datum != null) { + return "added"; + } + if (node.previousDatum != null && node.datum == null) { + return "removed"; + } + return "updated"; +} + +// packages/ag-charts-community/src/motion/resetMotion.ts +var resetMotion_exports = {}; +__export(resetMotion_exports, { + resetMotion: () => resetMotion +}); +function resetMotion(selectionsOrNodes, propsFn) { + const { nodes, selections } = deconstructSelectionsOrNodes(selectionsOrNodes); + for (const selection of selections) { + for (const node of selection.nodes()) { + const from3 = propsFn(node, node.datum); + node.setProperties(from3); + } + selection.cleanup(); + } + for (const node of nodes) { + const from3 = propsFn(node, node.datum); + node.setProperties(from3); + } +} + +// packages/ag-charts-community/src/scene/selection.ts +var Selection = class _Selection { + constructor(parentNode, classOrFactory, autoCleanup = true) { + this.parentNode = parentNode; + this.autoCleanup = autoCleanup; + this.garbageBin = /* @__PURE__ */ new Set(); + this._nodesMap = /* @__PURE__ */ new Map(); + this._nodes = []; + this.data = []; + this.debug = Debug.create(true, "scene", "scene:selections"); + this.nodeFactory = Object.prototype.isPrototypeOf.call(Node2, classOrFactory) ? () => new classOrFactory() : classOrFactory; + } + static select(parent, classOrFactory, garbageCollection = true) { + return new _Selection(parent, classOrFactory, garbageCollection); + } + static selectAll(parent, predicate) { + const results = []; + const traverse = (node) => { + if (predicate(node)) { + results.push(node); + } + if (node instanceof Group) { + for (const child of node.children()) { + traverse(child); + } + } + }; + traverse(parent); + return results; + } + static selectByClass(node, ...Classes) { + return _Selection.selectAll(node, (n) => Classes.some((C2) => n instanceof C2)); + } + static selectByTag(node, tag) { + return _Selection.selectAll(node, (n) => n.tag === tag); + } + createNode(datum, initializer, idx) { + const node = this.nodeFactory(datum); + node.datum = datum; + initializer?.(node); + if (idx == null) { + this._nodes.push(node); + } else { + this._nodes.splice(idx, 0, node); + } + this.parentNode.appendChild(node); + return node; + } + /** + * Update the data in a selection. If an `getDatumId()` function is provided, maintain a list of ids related to + * the nodes. Otherwise, take the more efficient route of simply creating and destroying nodes at the end + * of the array. + */ + update(data, initializer, getDatumId) { + if (this.garbageBin.size > 0) { + this.debug(`Selection - update() called with pending garbage`, data); + } + if (getDatumId) { + const dataMap = /* @__PURE__ */ new Map(); + const duplicateMap = /* @__PURE__ */ new Map(); + for (let idx = 0; idx < data.length; idx++) { + const datum = data[idx]; + let id = getDatumId(datum); + if (dataMap.has(id)) { + const index = (duplicateMap.get(id) ?? 0) + 1; + duplicateMap.set(id, index); + id = `${id}:${index}`; + } + dataMap.set(id, idx); + } + for (const [node, datumId] of this._nodesMap.entries()) { + const idx = dataMap.get(datumId); + if (idx == null) { + this.garbageBin.add(node); + } else { + node.datum = data[idx]; + this.garbageBin.delete(node); + dataMap.delete(datumId); + } + } + for (const [datumId, idx] of dataMap.entries()) { + const datum = data[idx]; + this._nodesMap.set(this.createNode(datum, initializer, idx), datumId); + } + } else { + const maxLength = Math.max(data.length, this.data.length); + for (let i = 0; i < maxLength; i++) { + if (i >= data.length) { + this.garbageBin.add(this._nodes[i]); + } else if (i >= this._nodes.length) { + this.createNode(data[i], initializer); + } else { + this._nodes[i].datum = data[i]; + this.garbageBin.delete(this._nodes[i]); + } + } + } + this.data = data.slice(); + if (this.autoCleanup) { + this.cleanup(); + } + return this; + } + cleanup() { + if (this.garbageBin.size === 0) { + return this; + } + this._nodes = this._nodes.filter((node) => { + if (this.garbageBin.has(node)) { + this._nodesMap.delete(node); + this.garbageBin.delete(node); + node.destroy(); + return false; + } + return true; + }); + return this; + } + clear() { + this.update([]); + return this; + } + isGarbage(node) { + return this.garbageBin.has(node); + } + each(iterate2) { + for (const entry of this._nodes.entries()) { + iterate2(entry[1], entry[1].datum, entry[0]); + } + return this; + } + *[Symbol.iterator]() { + for (let index = 0; index < this._nodes.length; index++) { + const node = this._nodes[index]; + yield { node, datum: node.datum, index }; + } + } + select(predicate) { + return _Selection.selectAll(this.parentNode, predicate); + } + selectByClass(Class) { + return _Selection.selectByClass(this.parentNode, Class); + } + selectByTag(tag) { + return _Selection.selectByTag(this.parentNode, tag); + } + nodes() { + return this._nodes; + } + at(index) { + return this._nodes.at(index); + } + get length() { + return this._nodes.length; + } +}; + +// packages/ag-charts-community/src/scene/shape/line.ts +var Line = class extends Shape { + constructor(opts = {}) { + super(opts); + this.x1 = 0; + this.y1 = 0; + this.x2 = 0; + this.y2 = 0; + this.fill = void 0; + this.strokeWidth = 1; + } + set x(value) { + this.x1 = value; + this.x2 = value; + } + set y(value) { + this.y1 = value; + this.y2 = value; + } + get midPoint() { + return { x: (this.x1 + this.x2) / 2, y: (this.y1 + this.y2) / 2 }; + } + computeBBox() { + return new BBox( + Math.min(this.x1, this.x2), + Math.min(this.y1, this.y2), + Math.abs(this.x2 - this.x1), + Math.abs(this.y2 - this.y1) + ); + } + isPointInPath(x, y) { + if (this.x1 === this.x2 || this.y1 === this.y2) { + return this.getBBox().clone().grow(this.strokeWidth / 2).containsPoint(x, y); + } + return false; + } + distanceSquared(px, py) { + const { x1, y1, x2, y2 } = this; + return lineDistanceSquared(px, py, x1, y1, x2, y2, Infinity); + } + render(renderCtx) { + const { ctx, devicePixelRatio } = renderCtx; + let { x1, y1, x2, y2 } = this; + if (x1 === x2) { + const { strokeWidth } = this; + const x = Math.round(x1 * devicePixelRatio) / devicePixelRatio + Math.trunc(strokeWidth * devicePixelRatio) % 2 / (devicePixelRatio * 2); + x1 = x; + x2 = x; + } else if (y1 === y2) { + const { strokeWidth } = this; + const y = Math.round(y1 * devicePixelRatio) / devicePixelRatio + Math.trunc(strokeWidth * devicePixelRatio) % 2 / (devicePixelRatio * 2); + y1 = y; + y2 = y; + } + ctx.beginPath(); + ctx.moveTo(x1, y1); + ctx.lineTo(x2, y2); + this.fillStroke(ctx); + this.fillShadow?.markClean(); + super.render(renderCtx); + } + toSVG() { + if (!this.visible) + return; + const element2 = createSvgElement("line"); + element2.setAttribute("x1", String(this.x1)); + element2.setAttribute("y1", String(this.y1)); + element2.setAttribute("x2", String(this.x2)); + element2.setAttribute("y2", String(this.y2)); + this.applySvgStrokeAttributes(element2); + return { + elements: [element2] + }; + } +}; +Line.className = "Line"; +__decorateClass([ + SceneChangeDetection() +], Line.prototype, "x1", 2); +__decorateClass([ + SceneChangeDetection() +], Line.prototype, "y1", 2); +__decorateClass([ + SceneChangeDetection() +], Line.prototype, "x2", 2); +__decorateClass([ + SceneChangeDetection() +], Line.prototype, "y2", 2); + +// packages/ag-charts-community/src/util/stateMachine.ts +var debugColor = "color: green"; +var debugQuietColor = "color: grey"; +function StateMachineProperty() { + return addObserverToInstanceProperty(() => { + }); +} +function applyProperties(parentState, childState) { + const childProperties = listDecoratedProperties(childState); + if (childProperties.length === 0) + return; + const properties = extractDecoratedProperties(parentState); + for (const property of childProperties) { + if (property in properties) { + childState[property] = properties[property]; + } + } +} +var AbstractStateMachine = class { + transitionRoot(event, data) { + if (this.parent) { + this.parent.transitionRoot(event, data); + } else { + this.transition(event, data); + } + } +}; +var _StateMachine = class _StateMachine extends AbstractStateMachine { + constructor(defaultState, states, enterEach) { + super(); + this.defaultState = defaultState; + this.states = states; + this.enterEach = enterEach; + this.debug = Debug.create(true, "animation"); + this.state = defaultState; + this.debug(`%c${this.constructor.name} | init -> ${defaultState}`, debugColor); + } + // TODO: handle events which do not require data without requiring `undefined` to be passed as as parameter, while + // also still requiring data to be passed to those events which do require it. + transition(event, data) { + const shouldTransitionSelf = this.transitionChild(event, data); + if (!shouldTransitionSelf || this.state === _StateMachine.child || this.state === _StateMachine.parent) { + return; + } + const currentState = this.state; + const currentStateConfig = this.states[this.state]; + let destination = currentStateConfig[event]; + const debugPrefix = `%c${this.constructor.name} | ${this.state} -> ${event} ->`; + if (Array.isArray(destination)) { + destination = destination.find((transition) => { + if (!transition.guard) + return true; + const valid = transition.guard(data); + if (!valid) { + this.debug(`${debugPrefix} (guarded)`, transition.target, debugQuietColor); + } + return valid; + }); + } else if (typeof destination === "object" && !(destination instanceof _StateMachine) && destination.guard && !destination.guard(data)) { + this.debug(`${debugPrefix} (guarded)`, destination.target, debugQuietColor); + return; + } + if (!destination) { + this.debug(`${debugPrefix} ${this.state}`, debugQuietColor); + return; + } + const destinationState = this.getDestinationState(destination); + const exitFn = destinationState === this.state ? void 0 : currentStateConfig.onExit; + this.debug(`${debugPrefix} ${destinationState}`, debugColor); + this.state = destinationState; + if (typeof destination === "function") { + destination(data); + } else if (typeof destination === "object" && !(destination instanceof _StateMachine)) { + destination.action?.(data); + } + exitFn?.(); + this.enterEach?.(currentState, destinationState); + if (destinationState !== currentState && destinationState !== _StateMachine.child && destinationState !== _StateMachine.parent) { + this.states[destinationState].onEnter?.(currentState, data); + } + } + transitionAsync(event, data) { + setTimeout(() => { + this.transition(event, data); + }, 0); + } + is(value) { + if (this.state === _StateMachine.child && this.childState) { + return this.childState.is(value); + } + return this.state === value; + } + resetHierarchy() { + this.debug( + `%c${this.constructor.name} | ${this.state} -> [resetHierarchy] -> ${this.defaultState}`, + "color: green" + ); + this.state = this.defaultState; + } + transitionChild(event, data) { + if (this.state !== _StateMachine.child || !this.childState) + return true; + applyProperties(this, this.childState); + this.childState.transition(event, data); + if (!this.childState.is(_StateMachine.parent)) + return true; + this.debug(`%c${this.constructor.name} | ${this.state} -> ${event} -> ${this.defaultState}`, debugColor); + this.state = this.defaultState; + this.states[this.state].onEnter?.(); + this.childState.resetHierarchy(); + return false; + } + getDestinationState(destination) { + let state = this.state; + if (typeof destination === "string") { + state = destination; + } else if (destination instanceof _StateMachine) { + this.childState = destination; + this.childState.parent = this; + state = _StateMachine.child; + } else if (typeof destination === "object") { + if (destination.target instanceof _StateMachine) { + this.childState = destination.target; + this.childState.parent = this; + state = _StateMachine.child; + } else if (destination.target != null) { + state = destination.target; + } + } + return state; + } +}; +_StateMachine.child = "__child"; +_StateMachine.parent = "__parent"; +var StateMachine = _StateMachine; +var ParallelStateMachine = class extends AbstractStateMachine { + constructor(...stateMachines) { + super(); + this.stateMachines = stateMachines; + for (const stateMachine of stateMachines) { + stateMachine.parent = this; + } + } + transition(event, data) { + for (const stateMachine of this.stateMachines) { + applyProperties(this, stateMachine); + stateMachine.transition(event, data); + } + } + transitionAsync(event, data) { + for (const stateMachine of this.stateMachines) { + applyProperties(this, stateMachine); + stateMachine.transitionAsync(event, data); + } + } +}; + +// packages/ag-charts-community/src/chart/label.ts +var LabelBorder = class { + constructor() { + this.enabled = true; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], LabelBorder.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LabelBorder.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LabelBorder.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LabelBorder.prototype, "strokeOpacity", 2); +var Label = class extends BaseProperties { + constructor() { + super(...arguments); + this.enabled = true; + this.border = new LabelBorder(); + this._cachedFormatter = void 0; + } + formatValue(formatWithContext2, type, value, params) { + const { formatter: formatter2, format } = this; + let result; + if (formatter2 != null) { + result ?? (result = formatWithContext2(formatter2, params)); + } + if (format != null) { + let cachedFormatter = this._cachedFormatter; + if (cachedFormatter == null || cachedFormatter.type !== type || cachedFormatter.format !== format) { + cachedFormatter = { + type, + format, + formatter: FormatManager.getFormatter(type, format) + }; + this._cachedFormatter = cachedFormatter; + } + result ?? (result = cachedFormatter.formatter?.(value)); + } + return result == null || isArray(result) ? result : String(result); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "border", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "color", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "cornerRadius", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "fontStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "fontWeight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "fontSize", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "fontFamily", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "formatter", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "format", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "padding", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Label.prototype, "itemStyler", 2); +function expandLabelPadding(label) { + const { enabled: borderEnabled = false, stroke: borderStroke } = label?.border ?? {}; + const hasBoxing = label?.fill != null || borderEnabled && borderStroke != null; + const padding2 = hasBoxing ? label?.padding : null; + if (padding2 == null) { + return { bottom: 0, left: 0, right: 0, top: 0 }; + } else if (typeof padding2 === "number") { + return { bottom: padding2, left: padding2, right: padding2, top: padding2 }; + } else { + const { bottom = 0, left = 0, right = 0, top = 0 } = padding2; + return { bottom, left, right, top }; + } +} + +// packages/ag-charts-community/src/module/moduleMap.ts +var ModuleMap = class { + constructor() { + this.moduleMap = /* @__PURE__ */ new Map(); + } + *modules() { + for (const m of this.moduleMap.values()) { + yield m.moduleInstance; + } + } + addModule(module2, moduleFactory) { + if (this.moduleMap.has(module2.optionsKey)) { + throw new Error(`AG Charts - module already initialised: ${module2.optionsKey}`); + } + this.moduleMap.set(module2.optionsKey, { module: module2, moduleInstance: moduleFactory(module2) }); + } + removeModule(module2) { + const moduleKey = isString(module2) ? module2 : module2.optionsKey; + this.moduleMap.get(moduleKey)?.moduleInstance.destroy(); + this.moduleMap.delete(moduleKey); + } + getModule(module2) { + return this.moduleMap.get(isString(module2) ? module2 : module2.optionsKey)?.moduleInstance; + } + isEnabled(module2) { + return this.moduleMap.has(isString(module2) ? module2 : module2.optionsKey); + } + mapModules(callback2) { + return Array.from(this.moduleMap.values(), (m, i) => callback2(m.moduleInstance, i)); + } + destroy() { + for (const moduleKey of this.moduleMap.keys()) { + this.moduleMap.get(moduleKey)?.moduleInstance.destroy(); + } + this.moduleMap.clear(); + } +}; + +// packages/ag-charts-community/src/scene/shape/range.ts +var Range = class extends Shape { + constructor(opts = {}) { + super(opts); + this.x1 = 0; + this.y1 = 0; + this.x2 = 0; + this.y2 = 0; + this.startLine = false; + this.endLine = false; + this.horizontal = false; + this.strokeWidth = 1; + } + computeBBox() { + return new BBox(this.x1, this.y1, this.x2 - this.x1, this.y2 - this.y1); + } + isPointInPath(_x, _y) { + return false; + } + render(renderCtx) { + const { ctx } = renderCtx; + let { x1, y1, x2, y2 } = this; + x1 = this.align(x1); + y1 = this.align(y1); + x2 = this.align(x2); + y2 = this.align(y2); + const { fill, horizontal } = this; + const { globalAlpha } = ctx; + if (fill != null) { + this.applyFillAndAlpha(ctx); + ctx.beginPath(); + ctx.moveTo(x1, y1); + ctx.lineTo(x2, y1); + ctx.lineTo(x2, y2); + ctx.lineTo(x1, y2); + ctx.closePath(); + ctx.fill(); + ctx.globalAlpha = globalAlpha; + } + const { stroke: stroke3, strokeWidth, startLine, endLine } = this; + const strokeActive = !!((startLine || endLine) && stroke3 && strokeWidth); + if (strokeActive) { + const { lineDash, lineDashOffset, lineCap, lineJoin } = this; + this.applyStrokeAndAlpha(ctx); + ctx.lineWidth = strokeWidth; + if (lineDash) { + ctx.setLineDash([...lineDash]); + } + if (lineDashOffset) { + ctx.lineDashOffset = lineDashOffset; + } + if (lineCap) { + ctx.lineCap = lineCap; + } + if (lineJoin) { + ctx.lineJoin = lineJoin; + } + ctx.beginPath(); + if (startLine) { + ctx.moveTo(x1, y1); + if (horizontal) { + ctx.lineTo(x1, y2); + } else { + ctx.lineTo(x2, y1); + } + } + if (endLine) { + ctx.moveTo(x2, y2); + if (horizontal) { + ctx.lineTo(x2, y1); + } else { + ctx.lineTo(x1, y2); + } + } + ctx.stroke(); + ctx.globalAlpha = globalAlpha; + } + this.fillShadow?.markClean(); + super.render(renderCtx); + } +}; +Range.className = "Range"; +__decorateClass([ + SceneChangeDetection() +], Range.prototype, "x1", 2); +__decorateClass([ + SceneChangeDetection() +], Range.prototype, "y1", 2); +__decorateClass([ + SceneChangeDetection() +], Range.prototype, "x2", 2); +__decorateClass([ + SceneChangeDetection() +], Range.prototype, "y2", 2); +__decorateClass([ + SceneChangeDetection() +], Range.prototype, "startLine", 2); +__decorateClass([ + SceneChangeDetection() +], Range.prototype, "endLine", 2); +__decorateClass([ + SceneChangeDetection() +], Range.prototype, "horizontal", 2); + +// packages/ag-charts-community/src/util/value.ts +function isStringObject(value) { + return value != null && Object.hasOwn(value, "toString") && isString(value.toString()); +} +function isNumberObject(value) { + return value != null && Object.hasOwn(value, "valueOf") && isFiniteNumber(value.valueOf()); +} +function isContinuous(value) { + return isFiniteNumber(value) || isValidDate(value) || isNumberObject(value); +} +function checkDatum(value, isContinuousScale) { + return value != null && (!isContinuousScale || isContinuous(value)); +} +function transformIntegratedCategoryValue(value) { + if (isStringObject(value) && Object.hasOwn(value, "id")) { + return value.id; + } + return value; +} + +// packages/ag-charts-community/src/chart/crossline/crossLine.ts +function getCrossLineValue(crossLine) { + switch (crossLine.type) { + case "line": + return crossLine.value; + case "range": + return crossLine.range; + } +} +function validateCrossLineValue(crossLine, scale2) { + const value = getCrossLineValue(crossLine); + if (value == null) { + return false; + } + const isContinuous3 = ContinuousScale.is(scale2) || DiscreteTimeScale.is(scale2); + const validValue = (val) => checkDatum(val, isContinuous3) && !Number.isNaN(scale2.convert(val, { clamp: true })); + if (crossLine.type === "range") { + const [start2, end3] = value; + return validValue(start2) && validValue(end3); + } else { + return validValue(value); + } +} + +// packages/ag-charts-community/src/chart/crossline/cartesianCrossLine.ts +var horizontalLineAnchors = { + top: { rangeH: 0, rangeV: -1, labelH: 0, labelV: 1 }, + "inside-top": { rangeH: 0, rangeV: -1, labelH: 0, labelV: 1 }, + "top-left": { rangeH: -1, rangeV: -1, labelH: -1, labelV: 1 }, + "inside-top-left": { rangeH: -1, rangeV: -1, labelH: -1, labelV: 1 }, + left: { rangeH: -1, rangeV: 0, labelH: 1, labelV: 0 }, + "inside-left": { rangeH: -1, rangeV: 0, labelH: -1, labelV: 0 }, + "bottom-left": { rangeH: -1, rangeV: 1, labelH: -1, labelV: -1 }, + "inside-bottom-left": { rangeH: -1, rangeV: 1, labelH: -1, labelV: -1 }, + bottom: { rangeH: 0, rangeV: 1, labelH: 0, labelV: -1 }, + "inside-bottom": { rangeH: 0, rangeV: 1, labelH: 0, labelV: -1 }, + "bottom-right": { rangeH: 1, rangeV: 1, labelH: 1, labelV: -1 }, + "inside-bottom-right": { rangeH: 1, rangeV: 1, labelH: 1, labelV: -1 }, + right: { rangeH: 1, rangeV: 0, labelH: -1, labelV: 0 }, + "inside-right": { rangeH: 1, rangeV: 0, labelH: 1, labelV: 0 }, + "top-right": { rangeH: 1, rangeV: -1, labelH: 1, labelV: 1 }, + "inside-top-right": { rangeH: 1, rangeV: -1, labelH: 1, labelV: 1 }, + inside: { rangeH: 0, rangeV: 0, labelH: 0, labelV: 0 } +}; +var verticalLineAnchors = { + top: { rangeH: 0, rangeV: -1, labelH: 0, labelV: 1 }, + "inside-top": { rangeH: 0, rangeV: -1, labelH: 0, labelV: -1 }, + "top-left": { rangeH: -1, rangeV: -1, labelH: 1, labelV: -1 }, + "inside-top-left": { rangeH: -1, rangeV: -1, labelH: 1, labelV: -1 }, + left: { rangeH: -1, rangeV: 0, labelH: 1, labelV: 0 }, + "inside-left": { rangeH: -1, rangeV: 0, labelH: 1, labelV: 0 }, + "bottom-left": { rangeH: -1, rangeV: 1, labelH: 1, labelV: 1 }, + "inside-bottom-left": { rangeH: -1, rangeV: 1, labelH: 1, labelV: 1 }, + bottom: { rangeH: 0, rangeV: 1, labelH: 0, labelV: -1 }, + "inside-bottom": { rangeH: 0, rangeV: 1, labelH: 0, labelV: 1 }, + "bottom-right": { rangeH: 1, rangeV: 1, labelH: -1, labelV: 1 }, + "inside-bottom-right": { rangeH: 1, rangeV: 1, labelH: -1, labelV: 1 }, + right: { rangeH: 1, rangeV: 0, labelH: -1, labelV: 0 }, + "inside-right": { rangeH: 1, rangeV: 0, labelH: -1, labelV: 0 }, + "top-right": { rangeH: 1, rangeV: -1, labelH: -1, labelV: -1 }, + "inside-top-right": { rangeH: -1, rangeV: -1, labelH: -1, labelV: -1 }, + inside: { rangeH: 0, rangeV: 0, labelH: 0, labelV: 0 } +}; +var horizontalRangeAnchors = { + top: { rangeH: 0, rangeV: -1, labelH: 0, labelV: 1 }, + "inside-top": { rangeH: 0, rangeV: -1, labelH: 0, labelV: -1 }, + "top-left": { rangeH: -1, rangeV: -1, labelH: -1, labelV: 1 }, + "inside-top-left": { rangeH: -1, rangeV: -1, labelH: -1, labelV: -1 }, + left: { rangeH: -1, rangeV: 0, labelH: 1, labelV: 0 }, + "inside-left": { rangeH: -1, rangeV: 0, labelH: -1, labelV: 0 }, + "bottom-left": { rangeH: -1, rangeV: 1, labelH: -1, labelV: -1 }, + "inside-bottom-left": { rangeH: -1, rangeV: 1, labelH: -1, labelV: 1 }, + bottom: { rangeH: 0, rangeV: 1, labelH: 0, labelV: -1 }, + "inside-bottom": { rangeH: 0, rangeV: 1, labelH: 0, labelV: 1 }, + "bottom-right": { rangeH: 1, rangeV: 1, labelH: 1, labelV: -1 }, + "inside-bottom-right": { rangeH: 1, rangeV: 1, labelH: 1, labelV: 1 }, + right: { rangeH: 1, rangeV: 0, labelH: -1, labelV: 0 }, + "inside-right": { rangeH: 1, rangeV: 0, labelH: 1, labelV: 0 }, + "top-right": { rangeH: 1, rangeV: -1, labelH: 1, labelV: 1 }, + "inside-top-right": { rangeH: 1, rangeV: -1, labelH: 1, labelV: -1 }, + inside: { rangeH: 0, rangeV: 0, labelH: 0, labelV: 0 } +}; +var verticalRangeAnchors = { + top: { rangeH: 0, rangeV: -1, labelH: 0, labelV: 1 }, + "inside-top": { rangeH: 0, rangeV: -1, labelH: 0, labelV: -1 }, + "top-left": { rangeH: -1, rangeV: -1, labelH: 1, labelV: -1 }, + "inside-top-left": { rangeH: -1, rangeV: -1, labelH: -1, labelV: -1 }, + left: { rangeH: -1, rangeV: 0, labelH: 1, labelV: 0 }, + "inside-left": { rangeH: -1, rangeV: 0, labelH: -1, labelV: 0 }, + "bottom-left": { rangeH: -1, rangeV: 1, labelH: 1, labelV: 1 }, + "inside-bottom-left": { rangeH: -1, rangeV: 1, labelH: -1, labelV: 1 }, + bottom: { rangeH: 0, rangeV: 1, labelH: 0, labelV: -1 }, + "inside-bottom": { rangeH: 0, rangeV: 1, labelH: 0, labelV: 1 }, + "bottom-right": { rangeH: 1, rangeV: 1, labelH: -1, labelV: 1 }, + "inside-bottom-right": { rangeH: 1, rangeV: 1, labelH: 1, labelV: 1 }, + right: { rangeH: 1, rangeV: 0, labelH: -1, labelV: 0 }, + "inside-right": { rangeH: 1, rangeV: 0, labelH: 1, labelV: 0 }, + "top-right": { rangeH: 1, rangeV: -1, labelH: -1, labelV: -1 }, + "inside-top-right": { rangeH: 1, rangeV: -1, labelH: 1, labelV: -1 }, + inside: { rangeH: 0, rangeV: 0, labelH: 0, labelV: 0 } +}; +var CartesianCrossLineLabel = class extends BaseProperties { + constructor() { + super(...arguments); + this.fontSize = 14 /* LARGE */; + this.fontFamily = "Verdana, sans-serif"; + this.padding = 5; + this.color = "rgba(87, 87, 87, 1)"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "text", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "fontStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "fontWeight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "fontSize", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "fontFamily", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "padding", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "color", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "position", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "rotation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLineLabel.prototype, "parallel", 2); +var CartesianCrossLine = class extends BaseProperties { + constructor() { + super(); + this.id = createId(this); + this.defaultColorRange = []; + this.fill = "#c16068"; + this.label = new CartesianCrossLineLabel(); + this.scale = void 0; + this.clippedRange = [-Infinity, Infinity]; + this.gridLength = 0; + this.position = "top"; + this.rangeGroup = new Group({ name: this.id }); + this.lineGroup = new Group({ name: this.id }); + this.labelGroup = new Group({ name: this.id }); + this.crossLineRange = new Range(); + this.crossLineLabel = new TransformableText(); + this.data = void 0; + this.startLine = false; + this.endLine = false; + this._isRange = void 0; + this.lineGroup.append(this.crossLineRange); + this.labelGroup.append(this.crossLineLabel); + this.crossLineRange.pointerEvents = 1 /* None */; + } + get defaultLabelPosition() { + return "top"; + } + update(visible) { + const { enabled, type, data, scale: scale2 } = this; + if (!scale2 || !enabled || !visible || !validateCrossLineValue(this, scale2) || data == null) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updateNodes(); + const isRange = type === "range"; + if (isRange !== this._isRange) { + if (isRange) { + this.rangeGroup.appendChild(this.crossLineRange); + } else { + this.lineGroup.appendChild(this.crossLineRange); + } + } + this._isRange = isRange; + } + calculateLayout(visible) { + this.data = void 0; + if (!visible) + return; + const { type, range: range4, value, scale: scale2, clippedRange, strokeWidth = 0 } = this; + if (!scale2) + return; + const bandwidth = scale2.bandwidth ?? 0; + const step = scale2.step ?? 0; + const rangePadding = scale2 instanceof BandScale ? (step - bandwidth) / 2 : 0; + let [clippedRange0, clippedRange1] = findMinMax(clippedRange); + clippedRange0 -= bandwidth; + clippedRange1 += bandwidth; + let yStart; + let yEnd; + let clampedYStart; + let clampedYEnd; + if (type === "line") { + const offset = bandwidth / 2; + yStart = scale2.convert(value) + offset; + yEnd = Number.NaN; + clampedYStart = scale2.convert(value, { clamp: true }) + offset; + clampedYEnd = Number.NaN; + if (clampedYStart >= clippedRange1 || clampedYStart <= clippedRange0) { + return; + } + } else if (range4) { + const [r0, r1] = range4; + const [startAlignment, endAlignment] = rangeAlignment(r0, r1); + yStart = scale2.convert(r0, { alignment: startAlignment }); + yEnd = scale2.convert(r1, { alignment: endAlignment }); + clampedYStart = scale2.convert(r0, { clamp: true, alignment: startAlignment }); + clampedYEnd = scale2.convert(r1, { clamp: true, alignment: endAlignment }); + if (clampedYStart > clampedYEnd) { + [clampedYStart, clampedYEnd] = [clampedYEnd, clampedYStart]; + [yStart, yEnd] = [yEnd, yStart]; + } + if (clampedYStart >= clippedRange1 || clampedYEnd <= clippedRange0) { + return; + } + if (Number.isFinite(yStart)) { + clampedYStart -= rangePadding; + } + if (Number.isFinite(yEnd)) { + yEnd += bandwidth; + clampedYEnd += bandwidth + rangePadding; + } + } else { + return; + } + clampedYStart = clampArray(clampedYStart, clippedRange); + clampedYEnd = clampArray(clampedYEnd, clippedRange); + if (yStart - rangePadding >= clampedYStart) + yStart -= rangePadding; + if (yEnd + rangePadding <= clampedYEnd) + yEnd += rangePadding; + this.startLine = strokeWidth > 0 && yStart >= clampedYStart && yStart <= clampedYStart + rangePadding; + this.endLine = strokeWidth > 0 && yEnd >= clampedYEnd - bandwidth - rangePadding && yEnd <= clampedYEnd; + this.data = [clampedYStart, clampedYEnd]; + if (this.label.enabled === false || !this.label.text) + return; + } + updateNodes() { + const { position, data: [r0, r1] = [0, 0], gridLength } = this; + const dr = Number.isFinite(r1) ? r1 - r0 : 0; + let bounds; + switch (position) { + case "top": + case "bottom": + bounds = new BBox(r0, position === "top" ? 0 : -gridLength, dr, gridLength); + break; + case "left": + case "right": + bounds = new BBox(position === "left" ? 0 : -gridLength, r0, gridLength, dr); + } + this.updateRangeNode(bounds); + const { label } = this; + if (label.enabled !== false && label.text) { + this.updateLabel(); + this.positionLabel(bounds); + } + } + updateRangeNode(bounds) { + const { + type, + position, + crossLineRange, + startLine, + endLine, + fill, + fillOpacity, + stroke: stroke3, + strokeWidth, + strokeOpacity, + lineDash + } = this; + crossLineRange.x1 = bounds.x; + crossLineRange.x2 = bounds.x + bounds.width; + crossLineRange.y1 = bounds.y; + crossLineRange.y2 = bounds.y + bounds.height; + crossLineRange.horizontal = position === "top" || position === "bottom"; + crossLineRange.startLine = startLine; + crossLineRange.endLine = endLine; + crossLineRange.fill = type === "range" ? fill : void 0; + crossLineRange.fillOpacity = fillOpacity ?? 1; + crossLineRange.stroke = stroke3; + crossLineRange.strokeWidth = strokeWidth ?? 1; + crossLineRange.strokeOpacity = strokeOpacity ?? 1; + crossLineRange.lineDash = lineDash; + } + updateLabel() { + const { crossLineLabel, label } = this; + if (!label.text) + return; + crossLineLabel.fontStyle = label.fontStyle; + crossLineLabel.fontWeight = label.fontWeight; + crossLineLabel.fontSize = label.fontSize; + crossLineLabel.fontFamily = label.fontFamily; + crossLineLabel.fill = label.color; + crossLineLabel.text = label.text; + } + get anchor() { + const horizontal = this.position === "left" || this.position === "right"; + const range4 = this.type === "range"; + const { position = this.defaultLabelPosition } = this.label; + if (range4) { + const anchors = horizontal ? horizontalRangeAnchors : verticalRangeAnchors; + return anchors[position]; + } else { + const anchors = horizontal ? horizontalLineAnchors : verticalLineAnchors; + return anchors[position]; + } + } + positionLabel(bounds) { + const { crossLineLabel, label, anchor } = this; + crossLineLabel.rotation = toRadians(label.rotation ?? 0); + crossLineLabel.textBaseline = "middle"; + crossLineLabel.textAlign = "center"; + const bbox = crossLineLabel.getBBox(); + if (!bbox) + return; + const { width: width2, height: height2 } = bbox; + const xOffset = label.padding + width2 / 2; + const yOffset = label.padding + height2 / 2; + const x = bounds.x + bounds.width * (anchor.rangeH + 1) / 2 - xOffset * anchor.labelH; + const y = bounds.y + bounds.height * (anchor.rangeV + 1) / 2 - yOffset * anchor.labelV; + crossLineLabel.x = x; + crossLineLabel.y = y; + crossLineLabel.rotationCenterX = x; + crossLineLabel.rotationCenterY = y; + } + computeLabelSize() { + const { label } = this; + if (label.enabled === false || !label.text) + return; + const tempText = new TransformableText(); + tempText.fontFamily = label.fontFamily; + tempText.fontSize = label.fontSize; + tempText.fontStyle = label.fontStyle; + tempText.fontWeight = label.fontWeight; + tempText.text = label.text; + tempText.rotation = toRadians(label.rotation ?? 0); + tempText.textBaseline = "middle"; + tempText.textAlign = "center"; + const bbox = tempText.getBBox(); + if (!bbox) + return; + const { width: width2, height: height2 } = bbox; + return { width: width2, height: height2 }; + } + calculatePadding(into) { + const { label, anchor } = this; + const size = this.computeLabelSize(); + if (!size) + return; + const { width: width2, height: height2 } = size; + const xOffset = label.padding + width2; + const yOffset = label.padding + height2; + const horizontal = this.position === "left" || this.position === "right"; + if (horizontal) { + if (anchor.rangeH === -1 && anchor.labelH === 1) { + into.left = Math.max(into.left ?? 0, xOffset); + } else if (anchor.rangeH === 1 && anchor.labelH === -1) { + into.right = Math.max(into.right ?? 0, xOffset); + } + } + if (!horizontal) { + if (anchor.rangeV === -1 && anchor.labelV === 1) { + into.top = Math.max(into.top ?? 0, yOffset); + } else if (anchor.rangeV === 1 && anchor.labelV === -1) { + into.bottom = Math.max(into.bottom ?? 0, yOffset); + } + } + } +}; +CartesianCrossLine.className = "CrossLine"; +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "type", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "range", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "value", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "defaultColorRange", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "strokeOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "lineDash", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianCrossLine.prototype, "label", 2); + +// packages/ag-charts-community/src/chart/axis/axisGridLine.ts +var AxisGridLine = class { + constructor() { + this.enabled = true; + this.width = 1; + this.style = [ + { + fill: void 0, + fillOpacity: 1, + stroke: void 0, + strokeWidth: void 0, + lineDash: [] + } + ]; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisGridLine.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisGridLine.prototype, "width", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisGridLine.prototype, "style", 2); + +// packages/ag-charts-community/src/chart/axis/axisInterval.ts +var AxisInterval = class extends BaseProperties { +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisInterval.prototype, "placement", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisInterval.prototype, "step", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisInterval.prototype, "values", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisInterval.prototype, "minSpacing", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisInterval.prototype, "maxSpacing", 2); + +// packages/ag-charts-community/src/chart/axis/axisLabel.ts +var AxisLabel = class extends BaseProperties { + constructor() { + super(...arguments); + this.enabled = true; + this.border = new LabelBorder(); + this.wrapping = "never"; + this.truncate = false; + this.spacing = 5; + this.color = "#575757"; + this.avoidCollisions = true; + this.mirrored = false; + this.parallel = false; + this._formatters = { + "component:year": void 0, + "component:month": void 0, + "component:day": void 0, + "component:none": void 0, + "long:year": void 0, + "long:month": void 0, + "long:day": void 0, + "long:none": void 0 + }; + } + /** + * The side of the axis line to position the labels on. + * -1 = left (default) + * 1 = right + */ + getSideFlag() { + return this.mirrored ? 1 : -1; + } + formatValue(callWithContext3, params, index, options) { + const { formatter: formatter2, format } = this; + const { type, value, domain, boundSeries } = params; + const fractionDigits = params.type === "number" ? params.fractionDigits : void 0; + const unit = params.type === "date" ? params.unit : void 0; + let result; + if (formatter2 != null) { + const step = params.type === "date" ? params.step : void 0; + result = callWithContext3(formatter2, { value, index, domain, fractionDigits, unit, step, boundSeries }); + } + if (format != null && result == null) { + const { specifier, dateStyle = "long", truncateDate } = options ?? {}; + const cacheKey = `${dateStyle}:${truncateDate ?? "none"}`; + let valueFormatter = this._formatters[cacheKey]; + const mergedFormat = FormatManager.mergeSpecifiers(specifier, format); + if (valueFormatter == null || valueFormatter.type !== type || valueFormatter.unit !== unit || !objectsEqual(valueFormatter.mergedFormat, mergedFormat)) { + valueFormatter = { + type, + mergedFormat, + unit, + formatter: FormatManager.getFormatter(type, mergedFormat, unit, dateStyle, { truncateDate }) + }; + this._formatters[cacheKey] = valueFormatter; + } + result = valueFormatter.formatter?.(value, fractionDigits); + } + return result == null || isArray(result) ? result : String(result); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "border", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "cornerRadius", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "fontStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "fontWeight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "fontSize", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "fontFamily", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "wrapping", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "truncate", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "spacing", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "minSpacing", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "color", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "rotation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "avoidCollisions", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "mirrored", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "padding", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "parallel", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "itemStyler", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "formatter", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLabel.prototype, "format", 2); + +// packages/ag-charts-community/src/chart/axis/axisLine.ts +var AxisLine = class { + constructor() { + this.enabled = true; + this.width = 1; + this.stroke = void 0; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLine.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLine.prototype, "width", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisLine.prototype, "stroke", 2); + +// packages/ag-charts-community/src/chart/axis/axisTick.ts +var AxisTick = class extends BaseProperties { + constructor() { + super(...arguments); + this.enabled = true; + this.width = 1; + this.size = 6; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTick.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTick.prototype, "width", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTick.prototype, "size", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTick.prototype, "stroke", 2); + +// packages/ag-charts-community/src/chart/axis/axisTitle.ts +var AxisTitle = class extends BaseProperties { + constructor() { + super(...arguments); + this.caption = new Caption(); + this.enabled = false; + this.spacing = Caption.SMALL_PADDING; + this.fontSize = 10 /* SMALLER */; + this.fontFamily = "sans-serif"; + this.wrapping = "always"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTitle.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTitle.prototype, "text", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTitle.prototype, "spacing", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTitle.prototype, "fontStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTitle.prototype, "fontWeight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTitle.prototype, "fontSize", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTitle.prototype, "fontFamily", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTitle.prototype, "color", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTitle.prototype, "wrapping", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AxisTitle.prototype, "formatter", 2); + +// packages/ag-charts-community/src/chart/axis/axisUtil.ts +var NiceMode = /* @__PURE__ */ ((NiceMode3) => { + NiceMode3[NiceMode3["TickAndDomain"] = 0] = "TickAndDomain"; + NiceMode3[NiceMode3["TicksOnly"] = 1] = "TicksOnly"; + NiceMode3[NiceMode3["Off"] = 2] = "Off"; + return NiceMode3; +})(NiceMode || {}); +function prepareAxisAnimationContext(axis) { + const [requestedRangeMin, requestedRangeMax] = findMinMax(axis.range); + const min = Math.floor(requestedRangeMin); + const max = Math.ceil(requestedRangeMax); + return { min, max, visible: min !== max }; +} +var fullCircle = Math.PI * 2; +var halfCircle = fullCircle / 2; +function normaliseEndRotation(start2, end3) { + const directDistance = Math.abs(end3 - start2); + if (directDistance < halfCircle) { + return end3; + } else if (start2 > end3) { + return end3 + fullCircle; + } + return end3 - fullCircle; +} +function prepareAxisAnimationFunctions(ctx) { + const { min, max } = ctx; + const outOfBounds = (y) => { + return y < min || y > max; + }; + const tick = { + fromFn(node, datum, status) { + let { x1, x2, y1, y2 } = node; + let opacity = node.opacity; + if (status === "added" || outOfBounds(datum.offset)) { + ({ x1, x2, y1, y2 } = datum); + opacity = 0; + } + return { + x1, + x2, + y1, + y2, + opacity, + phase: NODE_UPDATE_STATE_TO_PHASE_MAPPING[status] + }; + }, + toFn(_node, datum, status) { + const { x1, x2, y1, y2 } = datum; + let opacity = 1; + if (status === "removed") { + opacity = 0; + } + return { x1, x2, y1, y2, opacity }; + }, + applyFn(node, props) { + node.setProperties(props); + node.visible = !outOfBounds(node.y); + } + }; + const label = { + fromFn(node, newDatum, status) { + const datum = node.previousDatum ?? newDatum; + let { x, y, rotationCenterX, rotationCenterY, rotation } = datum; + let opacity = node.opacity; + if (status === "removed" || outOfBounds(datum.y)) { + rotation = newDatum.rotation; + } else if (status === "added" || outOfBounds(node.datum.y)) { + ({ x, y, rotationCenterX, rotationCenterY, rotation } = newDatum); + opacity = 0; + } + return { + x, + y, + rotationCenterX, + rotationCenterY, + rotation, + opacity, + phase: NODE_UPDATE_STATE_TO_PHASE_MAPPING[status] + }; + }, + toFn(node, datum, status) { + const { x, y, rotationCenterX, rotationCenterY } = datum; + let rotation = 0; + let opacity = 1; + if (status === "added") { + rotation = datum.rotation; + } else if (status === "removed") { + opacity = 0; + rotation = datum.rotation; + } else { + rotation = normaliseEndRotation(node.previousDatum?.rotation ?? datum.rotation, datum.rotation); + } + return { + x, + y, + rotationCenterX, + rotationCenterY, + rotation, + opacity, + finish: { rotation: datum.rotation } + }; + } + }; + const line = { + fromFn(node, datum) { + const { x1, x2, y1, y2 } = node.previousDatum ?? datum; + return { + x1, + x2, + y1, + y2, + phase: NODE_UPDATE_STATE_TO_PHASE_MAPPING["updated"] + }; + }, + toFn(_node, datum) { + const { x1, x2, y1, y2 } = datum; + return { x1, x2, y1, y2 }; + } + }; + const group = { + fromFn(node, _datum) { + const { translationX, translationY } = node; + return { + translationX, + translationY, + phase: NODE_UPDATE_STATE_TO_PHASE_MAPPING["updated"] + }; + }, + toFn(_node, datum) { + const { translationX, translationY } = datum; + return { translationX, translationY }; + } + }; + return { tick, line, label, group }; +} +function resetAxisGroupFn() { + return (_node, datum) => { + return { + translationX: datum.translationX, + translationY: datum.translationY + }; + }; +} +function resetAxisLabelSelectionFn() { + return (_node, datum) => { + return { + x: datum.x, + y: datum.y, + rotationCenterX: datum.rotationCenterX, + rotationCenterY: datum.rotationCenterY, + rotation: datum.rotation + }; + }; +} +function resetAxisLineSelectionFn() { + return (_node, datum) => { + const { x1, x2, y1, y2 } = datum; + return { x1, x2, y1, y2 }; + }; +} +function resetAxisFillSelectionFn() { + return (_node, datum) => { + const { x1, x2, y1, y2 } = datum; + return { x: x1, y: y1, width: x2 - x1, height: y2 - y1 }; + }; +} + +// packages/ag-charts-community/src/chart/axis/axis.ts +var AxisGroupZIndexMap = /* @__PURE__ */ ((AxisGroupZIndexMap3) => { + AxisGroupZIndexMap3[AxisGroupZIndexMap3["TickLines"] = 0] = "TickLines"; + AxisGroupZIndexMap3[AxisGroupZIndexMap3["AxisLine"] = 1] = "AxisLine"; + AxisGroupZIndexMap3[AxisGroupZIndexMap3["TickLabels"] = 2] = "TickLabels"; + return AxisGroupZIndexMap3; +})(AxisGroupZIndexMap || {}); +function tickLayoutCacheValid(a, b) { + return a.domain === b.domain && a.rangeExtent === b.rangeExtent && a.nice === b.nice && a.gridLength === b.gridLength && a.visibleRange[0] === b.visibleRange[0] && a.visibleRange[1] === b.visibleRange[1] && a.initialPrimaryTickCount?.unzoomed === b.initialPrimaryTickCount?.unzoomed && a.initialPrimaryTickCount?.zoomed === b.initialPrimaryTickCount?.zoomed; +} +var _Axis = class _Axis { + constructor(moduleCtx, scale2) { + this.moduleCtx = moduleCtx; + this.scale = scale2; + this.id = createId(this); + this._crossLines = []; + this.nice = true; + this.reverse = false; + this.keys = []; + this.interval = new AxisInterval(); + this.dataDomain = { domain: [], clipped: false }; + this.title = new AxisTitle(); + this.gridLength = 0; + /** + * The distance between the grid ticks and the axis ticks. + */ + this.gridPadding = 0; + /** + * Is used to avoid collisions between axis labels and series. + */ + this.seriesAreaPadding = 0; + this.layoutConstraints = { + stacked: true, + align: "start", + width: 100, + unit: "percent" + }; + this.boundSeries = []; + this.includeInvisibleDomains = false; + this.interactionEnabled = true; + this.axisGroup = new Group({ name: `${this.id}-axis` }); + // Order is important to apply the correct z-index. + this.tickLineGroup = this.axisGroup.appendChild( + new TransformableGroup({ name: `${this.id}-Axis-tick-lines`, zIndex: 0 /* TickLines */ }) + ); + this.tickLabelGroup = this.axisGroup.appendChild( + new TransformableGroup({ name: `${this.id}-Axis-tick-labels`, zIndex: 2 /* TickLabels */ }) + ); + this.labelGroup = new Group({ + name: `${this.id}-Labels`, + zIndex: 11 /* SERIES_ANNOTATION */ + }); + this.gridGroup = new TranslatableGroup({ name: `${this.id}-Axis-grid`, zIndex: 2 /* AXIS_GRID */ }); + this.gridFillGroup = this.gridGroup.appendChild(new Group({ name: `${this.id}-gridFills` })); + this.gridLineGroup = this.gridGroup.appendChild(new Group({ name: `${this.id}-gridLines` })); + this.crossLineRangeGroup = new TransformableGroup({ + name: `${this.id}-CrossLines-Range`, + zIndex: 6 /* SERIES_CROSSLINE_RANGE */ + }); + this.crossLineLineGroup = new TransformableGroup({ + name: `${this.id}-CrossLines-Line`, + zIndex: 10 /* SERIES_CROSSLINE_LINE */ + }); + this.crossLineLabelGroup = new TransformableGroup({ + name: `${this.id}-CrossLines-Label`, + zIndex: 15 /* SERIES_LABEL */ + }); + this.tickLabelGroupSelection = Selection.select( + this.tickLabelGroup, + TransformableText, + false + ); + this.line = new AxisLine(); + this.tick = new AxisTick(); + this.gridLine = new AxisGridLine(); + this.label = this.createLabel(); + this.defaultTickMinSpacing = _Axis.defaultTickMinSpacing; + this.translation = { x: 0, y: 0 }; + this.layout = { + label: { + fractionDigits: 0, + spacing: this.label.spacing, + format: this.label.format + } + }; + this.axisContext = void 0; + this.cleanup = new CleanupRegistry(); + // AG-15360 Avoid calling removeTooltip() if no tooltip is shown. This avoid a laggy tooltips caused by interference + // with SeriesAreaManager's tooltip updates. + this.isHovering = false; + this.range = [0, 1]; + this.visibleRange = [0, 1]; + this.animatable = true; + this.tickLayout = void 0; + this.formatterBoundSeries = new WeakCache(() => { + const { direction, boundSeries } = this; + return deepFreeze(boundSeries.flatMap((series) => series.getFormatterContext(direction))); + }); + this.moduleMap = new ModuleMap(); + this.range = this.scale.range.slice(); + for (const crossLine of this.crossLines) { + this.initCrossLine(crossLine); + } + this.cleanup.register( + this.moduleCtx.widgets.containerWidget.addListener("mousemove", (e) => this.onMouseMove(e)), + this.moduleCtx.widgets.containerWidget.addListener("mouseleave", () => this.endHovering()) + ); + } + set crossLines(value) { + const { CrossLineConstructor } = this.constructor; + for (const crossLine of this._crossLines) { + this.detachCrossLine(crossLine); + } + this._crossLines = value.map((crossLine) => { + const instance = new CrossLineConstructor(); + instance.set(crossLine); + return instance; + }); + for (const crossLine of this._crossLines) { + this.attachCrossLine(crossLine); + this.initCrossLine(crossLine); + } + } + get crossLines() { + return this._crossLines; + } + get type() { + return this.constructor.type ?? ""; + } + get primaryLabel() { + return void 0; + } + get primaryTick() { + return void 0; + } + isCategoryLike() { + return false; + } + resetAnimation(_phase) { + } + onMouseMove(event) { + const node = this.tickLabelGroup.pickNode(event.currentX, event.currentY); + const datum = node?.datum; + const { textUntruncated: title = void 0 } = datum ?? {}; + if (title) { + this.moduleCtx.tooltipManager.updateTooltip( + this.id, + { canvasX: event.currentX, canvasY: event.currentY, showArrow: false }, + [{ type: "structured", title }] + ); + this.isHovering = true; + } else { + this.endHovering(); + } + } + endHovering() { + if (this.isHovering) { + this.moduleCtx.tooltipManager.removeTooltip(this.id); + this.isHovering = false; + } + } + attachCrossLine(crossLine) { + this.crossLineRangeGroup.appendChild(crossLine.rangeGroup); + this.crossLineLineGroup.appendChild(crossLine.lineGroup); + this.crossLineLabelGroup.appendChild(crossLine.labelGroup); + } + detachCrossLine(crossLine) { + crossLine.rangeGroup.remove(); + crossLine.lineGroup.remove(); + crossLine.labelGroup.remove(); + } + destroy() { + this.moduleMap.destroy(); + this.cleanup.flush(); + } + setScaleRange(visibleRange) { + const { range: rr, scale: scale2 } = this; + const span = (rr[1] - rr[0]) / (visibleRange[1] - visibleRange[0]); + const shift = span * visibleRange[0]; + const start2 = rr[0] - shift; + scale2.range = [start2, start2 + span]; + } + updateScale() { + const { + range: [r0, r1] + } = this; + this.setScaleRange(this.visibleRange); + for (const crossLine of this.crossLines) { + crossLine.clippedRange = [r0, r1]; + } + } + setCrossLinesVisible(visible) { + this.crossLineRangeGroup.visible = visible; + this.crossLineLineGroup.visible = visible; + this.crossLineLabelGroup.visible = visible; + } + attachAxis(groups) { + groups.gridNode.appendChild(this.gridGroup); + groups.axisNode.appendChild(this.axisGroup); + groups.labelNode.appendChild(this.labelGroup); + groups.crossLineRangeNode.appendChild(this.crossLineRangeGroup); + groups.crossLineLineNode.appendChild(this.crossLineLineGroup); + groups.crossLineLabelNode.appendChild(this.crossLineLabelGroup); + } + detachAxis() { + this.gridGroup.remove(); + this.axisGroup.remove(); + this.labelGroup.remove(); + this.crossLineRangeGroup.remove(); + this.crossLineLineGroup.remove(); + this.crossLineLabelGroup.remove(); + } + attachLabel(axisLabelNode) { + this.labelGroup.append(axisLabelNode); + } + /** + * Checks if a point or an object is in range. + * @param value A point (or object's starting point). + * @param tolerance Expands the range on both ends by this amount. + */ + inRange(value, tolerance = 0) { + const [min, max] = findMinMax(this.range); + return value >= min - tolerance && value <= max + tolerance; + } + /** + * Get a point's overflow on the range, expanded to include the non-visible range. + * @param value Point + * @returns Overflow + */ + getRangeOverflow(value) { + const { range: rr, visibleRange: vr } = this; + const size = (rr[1] - rr[0]) / (vr[1] - vr[0]); + const [min, max] = findMinMax([rr[0] - size * vr[0], rr[0] - size * vr[0] + size]); + if (value < min) + return value - min; + if (value > max) + return value - max; + return 0; + } + onGridLengthChange(value, prevValue) { + if (prevValue ^ value) { + this.onGridVisibilityChange(); + } + for (const crossLine of this.crossLines) { + this.initCrossLine(crossLine); + } + } + onGridVisibilityChange() { + } + createLabel() { + return new AxisLabel(); + } + /** + * Creates/removes/updates the scene graph nodes that constitute the axis. + */ + update() { + this.formatterBoundSeries.clear(); + this.updatePosition(); + this.updateSelections(); + this.gridLineGroup.visible = this.gridLine.enabled; + this.updateLabels(); + this.updateCrossLines(); + } + getLabelStyles(params, additionalStyles, label = this.label) { + const defaultStyle = { + border: label.border, + color: label.color, + cornerRadius: label.cornerRadius, + fill: label.fill, + fillOpacity: label.fillOpacity, + fontFamily: label.fontFamily, + fontSize: label.fontSize, + fontStyle: label.fontStyle, + fontWeight: label.fontWeight, + padding: label.padding, + spacing: label.spacing + }; + let stylerOutput; + if (label.itemStyler) { + stylerOutput = this.cachedCallWithContext(label.itemStyler, { + ...params, + ...defaultStyle + }); + } + const merged = mergeDefaults(stylerOutput, additionalStyles, defaultStyle); + return { + border: merged.border, + color: merged.color, + cornerRadius: merged.cornerRadius, + fill: merged.fill, + fillOpacity: merged.fillOpacity, + fontFamily: merged.fontFamily, + fontSize: merged.fontSize, + fontStyle: merged.fontStyle, + fontWeight: merged.fontWeight, + padding: merged.padding, + spacing: merged.spacing + }; + } + getTickSize(tick = this.tick) { + return tick.enabled ? tick.size : 0; + } + processData() { + this.invalidateLayoutCache(); + const { includeInvisibleDomains, boundSeries, direction } = this; + const visibleSeries = includeInvisibleDomains ? boundSeries : boundSeries.filter((s) => s.isEnabled()); + const domains = visibleSeries.map((series) => series.getDomain(direction)); + this.setDomains(...domains); + } + setDomains(...domains) { + let domain; + let animatable; + if (domains.length > 0) { + ({ domain, animatable } = this.scale.normalizeDomains(...domains)); + } else { + domain = []; + animatable = true; + } + this.dataDomain = this.normaliseDataDomain(domain); + if (this.reverse) { + this.dataDomain.domain.reverse(); + } + this.animatable = animatable; + } + calculateDomain(initialPrimaryTickCount) { + const { + dataDomain: { domain }, + range: range4, + nice, + scale: scale2, + gridLength + } = this; + const rangeExtent = findRangeExtent(range4); + const visibleRange = [0, 1]; + this.updateScale(); + const { unzoomedTickLayoutCache } = this; + let unzoomedTickLayout; + if (unzoomedTickLayoutCache == null || !tickLayoutCacheValid(unzoomedTickLayoutCache, { + domain, + rangeExtent, + nice, + gridLength, + visibleRange, + initialPrimaryTickCount + })) { + const scaleRange = scale2.range; + this.setScaleRange([0, 1]); + const niceMode = nice ? 0 /* TickAndDomain */ : 2 /* Off */; + unzoomedTickLayout = this.calculateTickLayout(domain, niceMode, [0, 1], initialPrimaryTickCount); + scale2.range = scaleRange; + this.unzoomedTickLayoutCache = { + domain, + rangeExtent, + nice, + gridLength, + visibleRange, + initialPrimaryTickCount, + tickLayout: unzoomedTickLayout + }; + } else { + unzoomedTickLayout = unzoomedTickLayoutCache.tickLayout; + } + this.updateScale(); + scale2.domain = unzoomedTickLayout.niceDomain; + return { unzoomedTickLayout, domain: scale2.domain }; + } + calculateLayout(initialPrimaryTickCount, chartLayout) { + this.chartLayout = chartLayout; + const { visibleRange, nice } = this; + const unzoomed = visibleRange[0] === 0 && visibleRange[1] === 1; + const { unzoomedTickLayout, domain } = this.calculateDomain(initialPrimaryTickCount); + let tickLayout; + if (unzoomed) { + tickLayout = unzoomedTickLayout; + } else { + const { range: range4, gridLength } = this; + const rangeExtent = findRangeExtent(range4); + const niceMode = nice ? 1 /* TicksOnly */ : 2 /* Off */; + const { tickLayoutCache } = this; + if (tickLayoutCache == null || !tickLayoutCacheValid(tickLayoutCache, { + domain, + rangeExtent, + nice, + gridLength, + visibleRange, + initialPrimaryTickCount + })) { + tickLayout = this.calculateTickLayout(domain, niceMode, visibleRange, initialPrimaryTickCount); + this.tickLayoutCache = { + domain, + rangeExtent, + nice, + gridLength, + visibleRange, + initialPrimaryTickCount, + tickLayout + }; + } else { + tickLayout = tickLayoutCache.tickLayout; + } + } + const { rawTickCount: zoomedTickCount = 0, fractionDigits, bbox } = tickLayout; + const unzoomedTickCount = unzoomedTickLayout.rawTickCount ?? 0; + const primaryTickCount = zoomedTickCount !== 0 && unzoomedTickCount !== 0 ? { zoomed: zoomedTickCount, unzoomed: unzoomedTickCount } : void 0; + this.tickLayout = tickLayout.layout; + this.layout.label = { + fractionDigits, + spacing: this.label.spacing, + format: this.label.format + }; + this.layoutCrossLines(); + return { primaryTickCount, bbox }; + } + invalidateLayoutCache() { + this.unzoomedTickLayoutCache = void 0; + this.tickLayoutCache = void 0; + this.tickLayout = void 0; + } + updateCrossLines() { + const crosslinesVisible = this.hasDefinedDomain() || this.hasVisibleSeries(); + for (const crossLine of this.crossLines) { + crossLine.update(crosslinesVisible); + } + } + updatePosition() { + const { crossLineRangeGroup, crossLineLineGroup, crossLineLabelGroup, gridGroup, translation } = this; + const translationX = Math.floor(translation.x); + const translationY = Math.floor(translation.y); + gridGroup.setProperties({ translationX, translationY }); + crossLineRangeGroup.setProperties({ translationX, translationY }); + crossLineLineGroup.setProperties({ translationX, translationY }); + crossLineLabelGroup.setProperties({ translationX, translationY }); + } + // For formatting (nice rounded) tick values. + tickFormatter(domain, ticks, primary, inputFractionDigits, inputTimeInterval, dateStyle = "long") { + const { moduleCtx, label } = this; + const { formatManager } = moduleCtx; + const primaryLabel = primary ? this.primaryLabel : void 0; + const tickFormatParams = this.tickFormatParams(domain, ticks, inputFractionDigits, inputTimeInterval); + const boundSeries = this.formatterBoundSeries.get(); + let fractionDigits; + let timeInterval3; + let truncateDate; + if (tickFormatParams.type === "number") { + fractionDigits = tickFormatParams.fractionDigits; + } else if (tickFormatParams.type === "date") { + const { unit, step, epoch } = tickFormatParams; + timeInterval3 = { unit, step, epoch }; + truncateDate = tickFormatParams.truncateDate; + } + const f = this.uncachedCallWithContext.bind(this); + const params = { + datum: void 0, + seriesId: void 0, + legendItemName: void 0, + key: void 0, + source: "axis-label", + property: this.direction, + domain, + boundSeries + }; + const currentLabel = primaryLabel ?? label; + const specifier = primary ? label.format : void 0; + const options = { + specifier: FormatManager.mergeSpecifiers(primaryLabel?.format, label.format), + truncateDate + }; + return (value, index) => { + const formatParams = this.datumFormatParams(value, params, fractionDigits, timeInterval3, dateStyle); + formatParams.value = value; + return currentLabel.formatValue(f, formatParams, index, { specifier, dateStyle, truncateDate }) ?? formatManager.format(f, formatParams, options) ?? formatManager.defaultFormat(formatParams, options); + }; + } + formatDatum(contextProvider, input, source, seriesId, legendItemName, datum, key, domain, label, params) { + if (input == null) + return ""; + const { moduleCtx, direction, dataDomain } = this; + domain ?? (domain = dataDomain.domain); + const { formatManager } = moduleCtx; + const boundSeries = this.formatterBoundSeries.get(); + let inputFractionDigits; + switch (source) { + case "crosshair": + case "annotation-label": + inputFractionDigits = this.layout.label.fractionDigits + 1; + break; + case "series-label": + inputFractionDigits = 2; + break; + case "tooltip": + inputFractionDigits = 3; + break; + case "legend-label": + inputFractionDigits = void 0; + break; + } + const formatParams = this.datumFormatParams( + input, + { + source, + datum, + seriesId, + legendItemName, + key, + property: direction, + domain, + boundSeries + }, + inputFractionDigits, + void 0, + "long" + ); + const { type, value } = formatParams; + const f = this.createCallWithContext(contextProvider); + const result = label?.formatValue(f, type, value, params ?? formatParams) ?? formatManager.format(f, formatParams) ?? this.label.formatValue(f, formatParams, Number.NaN) ?? formatManager.defaultFormat(formatParams); + return isArray(result) ? result : String(result); + } + getBBox() { + return this.axisGroup.getBBox(); + } + initCrossLine(crossLine) { + crossLine.scale = this.scale; + crossLine.gridLength = this.gridLength; + } + hasVisibleSeries() { + return this.boundSeries.some((s) => s.isEnabled()); + } + clipTickLines(x, y, width2, height2) { + this.tickLineGroup.setClipRect(new BBox(x, y, width2, height2)); + } + clipGrid(x, y, width2, height2) { + this.gridGroup.setClipRect(new BBox(x, y, width2, height2)); + } + getTitleFormatterParams(domain) { + const { direction } = this; + const boundSeries = this.formatterBoundSeries.get(); + return { domain, direction, boundSeries, defaultValue: this.title?.text }; + } + normaliseDataDomain(d) { + return { domain: [...d], clipped: false }; + } + getLayoutState() { + return { + id: this.id, + rect: this.getBBox(), + gridPadding: this.gridPadding, + seriesAreaPadding: this.seriesAreaPadding, + tickSize: this.getTickSize(), + direction: this.direction, + domain: this.dataDomain.domain, + scale: this.scale, + ...this.layout + }; + } + getModuleMap() { + return this.moduleMap; + } + createModuleContext() { + this.axisContext ?? (this.axisContext = this.createAxisContext()); + return { ...this.moduleCtx, parent: this.axisContext }; + } + createAxisContext() { + const { scale: scale2 } = this; + return { + axisId: this.id, + scale: this.scale, + direction: this.direction, + continuous: ContinuousScale.is(scale2) || DiscreteTimeScale.is(scale2), + getCanvasBounds: () => { + return Transformable.toCanvas(this.axisGroup); + }, + seriesKeyProperties: () => this.boundSeries.reduce((keys, series) => { + const seriesKeys = series.getKeyProperties(this.direction); + for (const key of seriesKeys) { + keys.add(key); + } + return keys; + }, /* @__PURE__ */ new Set()), + seriesIds: () => this.boundSeries.map((series) => series.id), + scaleInvert: (val) => scale2.invert(val, true), + scaleInvertNearest: (val) => scale2.invert(val, true), + formatScaleValue: (value, source, label) => this.formatDatum( + void 0, + value, + source, + void 0, + void 0, + void 0, + void 0, + void 0, + label + ), + attachLabel: (node) => this.attachLabel(node), + inRange: (value, tolerance) => this.inRange(value, tolerance), + getRangeOverflow: (value) => this.getRangeOverflow(value), + pickBand: (point) => this.pickBand(point) + }; + } + pickBand(point) { + if (!BandScale.is(this.scale)) { + return; + } + const { scale: scale2, range: range4 } = this; + const value = scale2.invert(this.isVertical() ? point.y : point.x, true); + const bandwidth = scale2.bandwidth ?? 0; + const step = scale2.step ?? 0; + const offset = (step - bandwidth) / 2; + const position = scale2.convert(value); + const start2 = position - offset; + const end3 = position + bandwidth + offset; + return { + id: this.id, + value, + band: [clampArray(start2, range4), clampArray(end3, range4)], + position + }; + } + isVertical() { + return this.direction === "y" /* Y */; + } + isReversed() { + return this.reverse; + } + cachedCallWithContext(fn, params) { + const { callbackCache, chartService } = this.moduleCtx; + return callbackCache.call([this, chartService], fn, params); + } + uncachedCallWithContext(fn, params) { + const { chartService } = this.moduleCtx; + return callWithContext([this, chartService], fn, params); + } + createCallWithContext(contextProvider) { + const { chartService } = this.moduleCtx; + return (fn, params) => callWithContext([contextProvider, this, chartService], fn, params); + } +}; +_Axis.defaultTickMinSpacing = 50; +_Axis.CrossLineConstructor = CartesianCrossLine; +__decorateClass([ + addFakeTransformToInstanceProperty +], _Axis.prototype, "nice", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Axis.prototype, "reverse", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Axis.prototype, "keys", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Axis.prototype, "interval", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Axis.prototype, "title", 2); +__decorateClass([ + ObserveChanges((target, value, oldValue) => target.onGridLengthChange(value, oldValue)) +], _Axis.prototype, "gridLength", 2); +var Axis = _Axis; + +// packages/ag-charts-community/src/chart/axis/cartesianAxisLabel.ts +var CartesianAxisLabel = class extends AxisLabel { + constructor() { + super(...arguments); + this.autoRotateAngle = 335; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianAxisLabel.prototype, "autoRotate", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianAxisLabel.prototype, "autoRotateAngle", 2); + +// packages/ag-charts-community/src/util/time/duration.ts +var durationSecond = 1e3; +var durationMinute = durationSecond * 60; +var durationHour = durationMinute * 60; +var durationDay = durationHour * 24; +var durationWeek = durationDay * 7; +var durationMonth = durationDay * 30; +var durationYear = durationDay * 365; + +// packages/ag-charts-community/src/util/time/encoding.ts +var tzOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset() * durationMinute; +var unitEncoding = { + millisecond: { + milliseconds: 1, + hierarchy: "day", + encode(date2) { + return date2.getTime(); + }, + decode(encoded) { + return new Date(encoded); + } + }, + second: { + milliseconds: durationSecond, + hierarchy: "day", + encode(date2, utc) { + const offset = utc ? 0 : tzOffset; + return Math.floor((date2.getTime() - offset) / durationSecond); + }, + decode(encoded, utc) { + const offset = utc ? 0 : tzOffset; + return new Date(offset + encoded * durationSecond); + } + }, + minute: { + milliseconds: durationMinute, + hierarchy: "day", + encode(date2, utc) { + const offset = utc ? 0 : tzOffset; + return Math.floor((date2.getTime() - offset) / durationMinute); + }, + decode(encoded, utc) { + const offset = utc ? 0 : tzOffset; + return new Date(offset + encoded * durationMinute); + } + }, + hour: { + milliseconds: durationHour, + hierarchy: "day", + encode(date2, utc) { + const offset = utc ? 0 : tzOffset; + return Math.floor((date2.getTime() - offset) / durationHour); + }, + decode(encoded, utc) { + const offset = utc ? 0 : tzOffset; + return new Date(offset + encoded * durationHour); + } + }, + day: { + milliseconds: durationDay, + hierarchy: "month", + encode(date2, utc) { + const tzOffsetMs = utc ? 0 : date2.getTimezoneOffset() * durationMinute; + return Math.floor((date2.getTime() - tzOffsetMs) / durationDay); + }, + decode(encoded, utc) { + let d; + if (utc) { + d = /* @__PURE__ */ new Date(0); + d.setUTCDate(d.getUTCDate() + encoded); + d.setUTCHours(0, 0, 0, 0); + } else { + d = new Date(1970, 0, 1); + d.setDate(d.getDate() + encoded); + } + return d; + } + }, + month: { + milliseconds: durationMonth, + hierarchy: "year", + encode(date2, utc) { + if (utc) { + return date2.getUTCFullYear() * 12 + date2.getUTCMonth(); + } else { + return date2.getFullYear() * 12 + date2.getMonth(); + } + }, + decode(encoded, utc) { + if (utc) { + const year = Math.floor(encoded / 12); + const m = encoded - year * 12; + return new Date(Date.UTC(year, m, 1)); + } else { + const y = Math.floor(encoded / 12); + const month = encoded - y * 12; + return new Date(y, month, 1); + } + } + }, + year: { + milliseconds: durationYear, + hierarchy: void 0, + encode(date2, utc) { + if (utc) { + return date2.getUTCFullYear(); + } else { + return date2.getFullYear(); + } + }, + decode(encoded, utc) { + let d; + if (utc) { + d = /* @__PURE__ */ new Date(); + d.setUTCFullYear(encoded); + d.setUTCMonth(0, 1); + d.setUTCHours(0, 0, 0, 0); + } else { + d = new Date(encoded, 0, 1, 0, 0, 0, 0); + } + return d; + } + } +}; + +// packages/ag-charts-community/src/util/time/range.ts +function timeInterval(interval) { + return typeof interval === "string" ? { unit: interval, step: 1, epoch: void 0, utc: false } : { + unit: interval.unit, + step: interval.step ?? 1, + epoch: interval.epoch, + utc: interval.utc ?? false + }; +} +function getOffset(unit, step, epoch, utc) { + if (epoch == null) + return 0; + const encoding = unitEncoding[unit]; + return Math.floor(encoding.encode(new Date(epoch), utc)) % step; +} +function encode(d, unit, step, utc, offset) { + const encoding = unitEncoding[unit]; + return Math.floor((encoding.encode(new Date(d), utc) - offset) / step); +} +function decode(encoded, unit, step, utc, offset) { + const encoding = unitEncoding[unit]; + return encoding.decode(encoded * step + offset, utc); +} +function encodingFloor(date2, unit, step, utc, offset) { + const d = new Date(date2); + const e = encode(d, unit, step, utc, offset); + return decode(e, unit, step, utc, offset); +} +function encodingCeil(date2, unit, step, utc, offset) { + const d = new Date(Number(date2) - 1); + const e = encode(d, unit, step, utc, offset); + return decode(e + 1, unit, step, utc, offset); +} +function intervalFloor(interval, date2) { + const { unit, step, epoch, utc } = timeInterval(interval); + const offset = getOffset(unit, step, epoch, utc); + return encodingFloor(date2, unit, step, utc, offset); +} +function intervalCeil(interval, date2) { + const { unit, step, epoch, utc } = timeInterval(interval); + const offset = getOffset(unit, step, epoch, utc); + return encodingCeil(date2, unit, step, utc, offset); +} +function intervalPrevious(interval, date2) { + const { unit, step, epoch, utc } = timeInterval(interval); + const offset = getOffset(unit, step, epoch, utc); + return decode( + encode(encodingCeil(date2, unit, step, utc, offset), unit, step, utc, offset) - 1, + unit, + step, + utc, + offset + ); +} +function intervalNext(interval, date2) { + const { unit, step, epoch, utc } = timeInterval(interval); + const offset = getOffset(unit, step, epoch, utc); + return decode( + encode(encodingFloor(date2, unit, step, utc, offset), unit, step, utc, offset) + 1, + unit, + step, + utc, + offset + ); +} +function intervalExtent(start2, stop, visibleRange) { + if (start2.valueOf() > stop.valueOf()) { + [start2, stop] = [stop, start2]; + if (visibleRange != null) { + visibleRange = [1 - visibleRange[1], 1 - visibleRange[0]]; + } + } + if (visibleRange != null) { + const delta4 = stop.valueOf() - start2.valueOf(); + const t0 = start2.valueOf(); + start2 = new Date(t0 + visibleRange[0] * delta4); + stop = new Date(t0 + visibleRange[1] * delta4); + } + return [new Date(start2), new Date(stop)]; +} +function rangeData(interval, start2, stop, { extend = false, visibleRange = [0, 1], limit, defaultAlignment = "start" } = {}) { + const params = timeInterval(interval); + const { unit, step, utc } = params; + let epoch; + if (params.epoch != null) { + epoch = params.epoch; + } else if (defaultAlignment === "interval") { + epoch = void 0; + } else if (start2.valueOf() > stop.valueOf()) { + epoch = stop; + } else { + epoch = start2; + } + const offset = getOffset(params.unit, params.step, epoch, params.utc); + let [d0, d1] = intervalExtent(start2, stop, visibleRange); + d0 = extend ? encodingFloor(d0, unit, step, utc, offset) : encodingCeil(d0, unit, step, utc, offset); + d1 = extend ? encodingCeil(d1, unit, step, utc, offset) : encodingFloor(d1, unit, step, utc, offset); + const e0 = encode(d0, unit, step, utc, offset); + let e1 = encode(d1, unit, step, utc, offset); + if (limit != null && e1 - e0 > limit) { + e1 = e0 + limit; + } + return { + range: [e0, e1], + unit, + step, + utc, + offset + }; +} +function intervalRangeCount(interval, start2, stop, params) { + const { + range: [e0, e1] + } = rangeData(interval, start2, stop, params); + return Math.abs(e1 - e0); +} +function intervalRange(interval, start2, stop, params) { + const { + range: [e0, e1], + unit, + step, + utc, + offset + } = rangeData(interval, start2, stop, params); + const values = []; + for (let e = e0; e <= e1; e += 1) { + const d = decode(e, unit, step, utc, offset); + values.push(d); + } + return values; +} +function intervalRangeStartIndex(interval, start2, stop, { extend, visibleRange, limit, defaultAlignment } = {}) { + const { + range: [s] + } = rangeData(interval, start2, stop, { extend, visibleRange, limit, defaultAlignment }); + const { + range: [s0] + } = rangeData(interval, start2, stop, { extend, limit, defaultAlignment }); + return s - s0; +} + +// packages/ag-charts-community/src/util/time/index.ts +function intervalUnit(interval) { + return typeof interval === "string" ? interval : interval.unit; +} +function intervalStep(interval) { + return typeof interval === "string" ? 1 : interval.step ?? 1; +} +function intervalEpoch(interval) { + return typeof interval === "string" ? void 0 : interval.epoch; +} +function intervalHierarchy(interval) { + return unitEncoding[intervalUnit(interval)].hierarchy; +} +function intervalMilliseconds(interval) { + const step = intervalStep(interval); + return step * unitEncoding[intervalUnit(interval)].milliseconds; +} + +// packages/ag-charts-community/src/util/timeFormatDefaults.ts +function dateToNumber(value) { + return value instanceof Date ? value.getTime() : value; +} +function lowestGranularityForInterval(interval) { + if (interval < durationSecond) { + return "millisecond"; + } else if (interval < durationMinute) { + return "second"; + } else if (interval < durationHour) { + return "minute"; + } else if (interval < durationHour * 23) { + return "hour"; + } else if (interval < 28 * durationDay) { + return "day"; + } else if (interval < durationYear) { + return "month"; + } else { + return "year"; + } +} +function lowestGranularityUnitForTicks(ticks) { + if (ticks.length === 0) { + return "millisecond"; + } else if (ticks.length === 1) { + return lowestGranularityUnitForValue(ticks[0]); + } + let minInterval = Infinity; + for (let i = 1; i < ticks.length; i++) { + minInterval = Math.min(minInterval, Math.abs(ticks[i].valueOf() - ticks[i - 1].valueOf())); + } + return lowestGranularityForInterval(minInterval); +} +function lowestGranularityUnitForValue(value) { + if (intervalFloor("second", value) < value) { + return "millisecond"; + } else if (intervalFloor("minute", value) < value) { + return "second"; + } else if (intervalFloor("hour", value) < value) { + return "minute"; + } else if (intervalFloor("day", value) < value) { + return "hour"; + } else if (intervalFloor("month", value) < value) { + return "day"; + } else if (intervalFloor("year", value) < value) { + return "month"; + } + return "year"; +} +function dateTruncationForDomain(domain) { + const [d0, d1] = domain.length === 0 ? [0, 0] : findMinMax([domain[0].valueOf(), domain.at(-1).valueOf()]); + const startYear = new Date(d0).getFullYear(); + const stopYear = new Date(d1).getFullYear(); + if (startYear !== stopYear) + return; + const startMonth = new Date(d0).getMonth(); + const stopMonth = new Date(d1).getMonth(); + if (startMonth !== stopMonth) + return "year"; + const startDate = new Date(d0).getDate(); + const stopDate = new Date(d1).getDate(); + if (startDate !== stopDate) + return "month"; + return "day"; +} + +// packages/ag-charts-community/src/scale/scaleUtil.ts +function visibleTickRange(ticks, reversed, visibleRange) { + if (visibleRange == null || visibleRange[0] === 0 && visibleRange[1] === 1) + return; + const vt0 = clamp(0, Math.floor(visibleRange[0] * ticks.length), ticks.length); + const vt1 = clamp(0, Math.ceil(visibleRange[1] * ticks.length), ticks.length); + const t0 = reversed ? ticks.length - vt1 : vt0; + const t1 = reversed ? ticks.length - vt0 : vt1; + return [t0, t1]; +} +function visibleTickSliceIndices(ticks, reversed, visibleRange) { + return visibleTickRange(ticks, reversed, visibleRange) ?? [0, ticks.length]; +} +function filterVisibleTicks(ticks, reversed, visibleRange) { + const tickRange = visibleTickRange(ticks, reversed, visibleRange); + if (tickRange == null) + return { ticks, count: ticks.length, firstTickIndex: 0 }; + const [t0, t1] = tickRange; + return { + ticks: ticks.slice(t0, t1), + count: ticks.length, + firstTickIndex: t0 + }; +} + +// packages/ag-charts-community/src/scale/categoryScale.ts +var CategoryScale = class _CategoryScale extends BandScale { + constructor() { + super(...arguments); + this.type = "category"; + this.defaultTickCount = 0; + /** + * Maps datum to its index in the {@link domain} array. + * Used to check for duplicate data (not allowed). + */ + this.index = /* @__PURE__ */ new Map(); + this.indexInitialized = false; + /** + * Contains unique data only. + */ + this._domain = []; + } + static is(value) { + return value instanceof _CategoryScale; + } + set domain(values) { + if (this._domain === values) + return; + this.invalid = true; + this._domain = values; + this.index.clear(); + this.indexInitialized = false; + } + get domain() { + return this._domain; + } + get bands() { + return this._domain; + } + normalizeDomains(...domains) { + let normalizedDomain = void 0; + const seenDomains = /* @__PURE__ */ new Set(); + let animatable = true; + for (const domain of domains) { + if (seenDomains.has(domain)) + continue; + seenDomains.add(domain); + if (normalizedDomain == null) { + normalizedDomain = deduplicateCategories(domain); + } else { + animatable && (animatable = domainOrderedToNormalizedDomain(domain, normalizedDomain)); + normalizedDomain = deduplicateCategories([...normalizedDomain, ...domain]); + } + } + normalizedDomain ?? (normalizedDomain = []); + return { domain: normalizedDomain, animatable }; + } + toDomain(_value) { + return void 0; + } + invert(position, nearest = false) { + this.refresh(); + const offset = nearest ? this.bandwidth / 2 : 0; + const index = this.invertNearestIndex(Math.max(0, position - offset)); + const matches = nearest || position === this.ordinalRange(index); + return matches ? this.domain[index] : void 0; + } + ticks(params, domain = this.domain, visibleRange) { + const { bands } = this; + let { tickCount } = params; + if (tickCount === 0) { + const firstTickIndex2 = bands.length > 1 ? 1 : 0; + const ticks2 = bands[firstTickIndex2] ? [bands[firstTickIndex2]] : []; + return { ticks: ticks2, count: void 0, firstTickIndex: firstTickIndex2 }; + } + let step = tickCount != null && tickCount !== 0 ? Math.trunc(bands.length / tickCount) : 1; + step = previousPowerOf2(step); + if (step <= 1) { + return filterVisibleTicks(domain, false, visibleRange); + } + tickCount = Math.trunc(bands.length / step); + const span = step * tickCount; + const inset = previousPowerOf2(Math.trunc((bands.length - span) / 2)); + const vt0 = clamp(0, Math.floor((visibleRange?.[0] ?? 0) * bands.length), bands.length); + const vt1 = clamp(0, Math.ceil((visibleRange?.[1] ?? 1) * bands.length), bands.length); + const i0 = Math.floor((vt0 - inset) / step) * step + inset; + const i1 = Math.ceil((vt1 - inset) / step) * step + inset; + const ticks = []; + for (let i = i0; i < i1; i += step) { + if (i >= 0 && i < bands.length) { + ticks.push(bands[i]); + } + } + let firstTickIndex = ticks.length > 0 ? this.findIndex(ticks[0]) : void 0; + if (firstTickIndex != null) { + firstTickIndex = Math.floor((firstTickIndex - inset) / step); + } + return { ticks, count: void 0, firstTickIndex }; + } + findIndex(value) { + const { index, indexInitialized } = this; + if (!indexInitialized) { + const { domain } = this; + for (let i = 0; i < domain.length; i++) { + index.set(dateToNumber(domain[i]), i); + } + this.indexInitialized = true; + } + return index.get(dateToNumber(value)); + } +}; +function deduplicateCategories(d) { + let domain; + const uniqueValues = /* @__PURE__ */ new Set(); + for (const value of d) { + const key = dateToNumber(value); + const lastSize = uniqueValues.size; + uniqueValues.add(key); + const isUniqueValue = uniqueValues.size !== lastSize; + if (isUniqueValue) { + domain?.push(value); + } else { + domain ?? (domain = d.slice(0, uniqueValues.size)); + } + } + return domain ?? d; +} +function domainOrderedToNormalizedDomain(domain, normalizedDomain) { + let normalizedIndex = -1; + for (const value of domain) { + const normalizedNextIndex = normalizedDomain.indexOf(value); + if (normalizedNextIndex === -1) { + normalizedIndex = Infinity; + } else if (normalizedNextIndex <= normalizedIndex) { + return false; + } else { + normalizedIndex = normalizedNextIndex; + } + } + return true; +} + +// packages/ag-charts-community/src/util/date.ts +function compareDates(a, b) { + return a.valueOf() - b.valueOf(); +} +function deduplicateSortedArray(values) { + let v0 = Number.NaN; + const out = []; + for (const v of values) { + const v1 = v.valueOf(); + if (v0 !== v1) + out.push(v); + v0 = v1; + } + return out; +} +function sortAndUniqueDates(values) { + const sortedValues = values.slice().sort(compareDates); + return datesSortOrder(sortedValues) == null ? deduplicateSortedArray(sortedValues) : sortedValues; +} +function datesSortOrder(d) { + if (d.length === 0) + return 1; + const sign = Number(d.at(-1)) > Number(d[0]) ? 1 : -1; + let v0 = -Infinity * sign; + for (const v of d) { + const v1 = v.valueOf(); + if (Math.sign(v1 - v0) !== sign) + return; + v0 = v1; + } + return sign; +} + +// packages/ag-charts-community/src/util/visibleRange.ts +function rescaleVisibleRange(visibleRange, [s0, s1], [d0, d1]) { + const dr = d1 - d0; + const vr = s1 - s0; + const vd0 = s0 + vr * visibleRange[0]; + const vd1 = s0 + vr * visibleRange[1]; + return [(vd0 - d0) / dr, (vd1 - d0) / dr]; +} + +// packages/ag-charts-community/src/util/ticks.ts +var tInterval = (timeInterval3, step) => ({ + duration: intervalMilliseconds(timeInterval3) * step, + timeInterval: timeInterval3, + step +}); +var TickIntervals = [ + tInterval({ unit: "second" }, 1), + tInterval({ unit: "second" }, 5), + tInterval({ unit: "second" }, 15), + tInterval({ unit: "second" }, 30), + tInterval({ unit: "minute" }, 1), + tInterval({ unit: "minute" }, 5), + tInterval({ unit: "minute" }, 15), + tInterval({ unit: "minute" }, 30), + tInterval({ unit: "hour" }, 1), + tInterval({ unit: "hour" }, 3), + tInterval({ unit: "hour" }, 6), + tInterval({ unit: "hour" }, 12), + tInterval({ unit: "day" }, 1), + tInterval({ unit: "day" }, 2), + tInterval({ unit: "day", step: 7 }, 1), + tInterval({ unit: "day", step: 7 }, 2), + tInterval({ unit: "day", step: 7 }, 3), + tInterval({ unit: "month" }, 1), + tInterval({ unit: "month" }, 2), + tInterval({ unit: "month" }, 3), + tInterval({ unit: "month" }, 4), + tInterval({ unit: "month" }, 6), + tInterval({ unit: "year" }, 1) +]; +var TickMultipliers = [1, 2, 5, 10]; +function isCloseToInteger(n, delta4) { + return Math.abs(Math.round(n) - n) < delta4; +} +function countTicks(d0, d1, step) { + const extent3 = Math.abs(d1 - d0); + return extent3 >= step ? Math.abs(d1 - d0) / step + 1 : 1; +} +function createTicks(start2, stop, count, minCount, maxCount, visibleRange) { + if (start2 === stop) + return { ticks: [start2], count: 1, firstTickIndex: 0 }; + if (count < 2) + return { ticks: [start2, stop], count: 2, firstTickIndex: 0 }; + const step = tickStep(start2, stop, count, minCount, maxCount); + if (!Number.isFinite(step)) + return { ticks: [], count: 0, firstTickIndex: void 0 }; + let d0 = start2; + let d1 = stop; + if (!isCloseToInteger(d0 / step, 1e-12)) { + d0 = Math.ceil(d0 / step) * step; + } + if (!isCloseToInteger(d1 / step, 1e-12)) { + d1 = Math.floor(d1 / step) * step; + } + if (visibleRange != null) { + visibleRange = rescaleVisibleRange(visibleRange, [start2, stop], [d0, d1]); + } + const { ticks } = range(d0, d1, step, visibleRange); + const firstTick = ticks.at(0); + return { + ticks, + count: countTicks(d0, d1, step), + firstTickIndex: firstTick == null ? void 0 : Math.round((firstTick - d0) / step) + }; +} +var minPrimaryTickRatio = Math.floor(2 * durationWeek / durationMonth * 10) / 10; +function isPrimaryTickInterval({ timeInterval: timeInterval3, step }) { + const milliseconds = intervalMilliseconds(timeInterval3) * step; + const hierarchy = intervalHierarchy(timeInterval3); + const hierarchyMilliseconds = hierarchy ? intervalMilliseconds(hierarchy) : void 0; + return milliseconds <= (hierarchyMilliseconds ?? Infinity) * minPrimaryTickRatio; +} +function defaultEpoch(timeInterval3, { weekStart }) { + if (timeInterval3.unit === "day" && timeInterval3.step === 7) { + return weekStart; + } +} +function getTickTimeInterval(start2, stop, count, minCount, maxCount, { + weekStart, + primaryOnly = false, + targetInterval +}) { + if (count <= 0) + return; + const target = targetInterval ?? Math.abs(stop - start2) / Math.max(count, 1); + const i0 = TickIntervals.findLast((t) => (!primaryOnly || isPrimaryTickInterval(t)) && target > t.duration); + const i1 = TickIntervals.find((t) => (!primaryOnly || isPrimaryTickInterval(t)) && target <= t.duration); + if (i0 == null) { + const step2 = Math.max(tickStep(start2, stop, count, minCount, maxCount), 1); + return { unit: "millisecond", step: step2 }; + } else if (i1 == null) { + const step2 = targetInterval == null ? tickStep(start2 / durationYear, stop / durationYear, count, minCount, maxCount) : 1; + return { unit: "year", step: step2 }; + } + const { timeInterval: timeInterval3, step } = target - i0.duration < i1.duration - target ? i0 : i1; + return { + unit: timeInterval3.unit, + step: intervalStep(timeInterval3) * step, + epoch: defaultEpoch(timeInterval3, { weekStart }) + }; +} +function tickStep(start2, end3, count, minCount = 0, maxCount = Infinity) { + if (start2 === end3) { + return clamp(1, minCount, maxCount); + } else if (count < 1) { + return Number.NaN; + } + const extent3 = Math.abs(end3 - start2); + const step = 10 ** Math.floor(Math.log10(extent3 / count)); + let m = Number.NaN, minDiff = Infinity, isInBounds = false; + for (const multiplier of TickMultipliers) { + const c = Math.ceil(extent3 / (multiplier * step)); + const validBounds = c >= minCount && c <= maxCount; + if (isInBounds && !validBounds) + continue; + const diffCount = Math.abs(c - count); + if (minDiff > diffCount || isInBounds !== validBounds) { + isInBounds || (isInBounds = validBounds); + minDiff = diffCount; + m = multiplier; + } + } + return m * step; +} +function decimalPlaces(decimal) { + for (let i = decimal.length - 1; i >= 0; i -= 1) { + if (decimal[i] !== "0") { + return i + 1; + } + } + return 0; +} +function tickFormat(ticks, format) { + const options = parseNumberFormat(format ?? ",f"); + if (options == null) + return; + if (options.precision == null || Number.isNaN(options.precision)) { + if (!options.type || "eEFgGnprs".includes(options.type)) { + options.precision = Math.max( + ...ticks.map((x) => { + if (!Number.isFinite(x)) + return 0; + const [integer, decimal] = x.toExponential((options.type ? 6 : 12) - 1).split(/[.e]/g); + return (integer !== "1" && integer !== "-1" ? 1 : 0) + decimalPlaces(decimal) + 1; + }) + ); + } else if ("f%".includes(options.type)) { + options.precision = Math.max( + ...ticks.map((x) => { + if (!Number.isFinite(x) || x === 0) + return 0; + const l = Math.floor(Math.log10(Math.abs(x))); + const digits = options.type ? 6 : 12; + const decimal = x.toExponential(digits - 1).split(/[.e]/g)[1]; + const decimalLength = decimalPlaces(decimal); + return Math.max(0, decimalLength - l); + }) + ); + } + } + const formatter2 = createNumberFormatter(options); + return (n) => formatter2(Number(n)); +} +function range(start2, end3, step, visibleRange) { + if (!Number.isFinite(step) || step <= 0) { + return { ticks: [], count: 0, firstTickIndex: void 0 }; + } else if (start2 === end3) { + return { ticks: [start2], count: 1, firstTickIndex: 0 }; + } + const f = 10 ** countFractionDigits(step); + const d0 = Math.min(start2, end3); + const d1 = Math.max(start2, end3); + let vd0; + let vd1; + if (visibleRange != null && (visibleRange[0] !== 0 || visibleRange[1] !== 1)) { + const rangeExtent = end3 - start2; + const adjustedStart = start2 + rangeExtent * visibleRange[0]; + const adjustedEnd = end3 - rangeExtent * (1 - visibleRange[1]); + vd0 = Math.min(adjustedStart, adjustedEnd); + vd1 = Math.max(adjustedStart, adjustedEnd); + } else { + vd0 = d0; + vd1 = d1; + } + vd0 = Math.floor(vd0 * f) / f; + vd1 = Math.ceil(vd1 * f) / f; + const ticks = []; + for (let i = 0; ; i += 1) { + const p = Math.round((d0 + step * i) * f) / f; + if (p > d1) + break; + if (p >= vd0 && p <= vd1) { + ticks.push(p); + } + } + const firstTick = ticks.at(0); + return { + ticks, + count: countTicks(d0, d1, step), + firstTickIndex: firstTick == null ? void 0 : Math.round((firstTick - d0) / step) + }; +} +function isDenseInterval(count, availableRange) { + if (count >= availableRange) { + logger_exports.warnOnce( + `the configured interval results in more than 1 item per pixel, ignoring. Supply a larger interval or omit this configuration` + ); + return true; + } + return false; +} +function niceTicksDomain(start2, end3) { + const extent3 = Math.abs(end3 - start2); + const step = 10 ** Math.floor(Math.log10(extent3)); + let minError = Infinity, ticks = [start2, end3]; + for (const multiplier of TickMultipliers) { + const m = multiplier * step; + const d0 = Math.floor(start2 / m) * m; + const d1 = Math.ceil(end3 / m) * m; + const error2 = 1 - extent3 / Math.abs(d1 - d0); + if (minError > error2) { + minError = error2; + ticks = [d0, d1]; + } + } + return ticks; +} +function estimateTickCount(rangeExtent, zoomExtent, minSpacing, maxSpacing, defaultTickCount, defaultMinSpacing) { + if (rangeExtent <= 0) { + return { minTickCount: 0, maxTickCount: 0, tickCount: 0 }; + } + defaultMinSpacing = Math.max(defaultMinSpacing, rangeExtent / (defaultTickCount + 1)); + minSpacing ?? (minSpacing = defaultMinSpacing); + maxSpacing ?? (maxSpacing = rangeExtent); + if (minSpacing > maxSpacing) { + if (minSpacing === defaultMinSpacing) { + minSpacing = maxSpacing; + } else { + maxSpacing = minSpacing; + } + } + minSpacing = Math.max(minSpacing, 1); + const maxTickCount = Math.max(1, Math.floor(rangeExtent / (zoomExtent * minSpacing))); + const minTickCount = Math.min(maxTickCount, Math.ceil(rangeExtent / (zoomExtent * maxSpacing))); + const tickCount = clamp(minTickCount, Math.floor(defaultTickCount / zoomExtent), maxTickCount); + return { minTickCount, maxTickCount, tickCount }; +} + +// packages/ag-charts-community/src/scale/timeScale.ts +var sunday = new Date(1970, 0, 4); +var TimeScale = class _TimeScale extends ContinuousScale { + constructor() { + super([], [0, 1]); + this.type = "time"; + } + static is(value) { + return value instanceof _TimeScale; + } + toDomain(d) { + return new Date(d); + } + convert(value, options) { + return super.convert(value?.valueOf() ?? Number.NaN, options); + } + invert(value) { + return new Date(super.invert(value)); + } + niceDomain(ticks, domain = this.domain) { + if (domain.length < 2) + return []; + let [d0, d1] = domain; + const maxAttempts = 4; + const availableRange = this.getPixelRange(); + for (let i = 0; i < maxAttempts; i++) { + const [n0, n1] = updateNiceDomainIteration(d0, d1, ticks, availableRange); + if (dateToNumber(d0) === dateToNumber(n0) && dateToNumber(d1) === dateToNumber(n1)) { + break; + } + d0 = n0; + d1 = n1; + } + return [d0, d1]; + } + /** + * Returns uniformly-spaced dates that represent the scale's domain. + */ + ticks(params, domain = this.domain, visibleRange = [0, 1], { extend = false } = {}) { + const { nice, interval, tickCount = ContinuousScale.defaultTickCount, minTickCount, maxTickCount } = params; + if (domain.length < 2) + return; + const timestamps = domain.map(dateToNumber); + const start2 = timestamps[0]; + const stop = timestamps.at(-1); + if (interval != null) { + const availableRange = this.getPixelRange(); + return { + ticks: getDateTicksForInterval({ start: start2, stop, interval, availableRange, visibleRange, extend }) ?? getDefaultDateTicks({ start: start2, stop, tickCount, minTickCount, maxTickCount, visibleRange, extend }), + count: void 0 + }; + } else if (nice && tickCount === 2) { + return { ticks: domain, count: void 0 }; + } else if (nice && tickCount === 1) { + return { ticks: domain.slice(0, 1), count: void 0 }; + } + const timeInterval3 = getTickTimeInterval(start2, stop, tickCount, minTickCount, maxTickCount, { + weekStart: sunday + }); + if (timeInterval3 == null) + return; + const ticks = intervalRange(timeInterval3, new Date(start2), new Date(stop), { visibleRange, extend }); + const firstTickIndex = intervalRangeStartIndex(timeInterval3, new Date(start2), new Date(stop), { + visibleRange, + extend + }); + return { + ticks, + count: void 0, + firstTickIndex, + timeInterval: timeInterval3 + }; + } +}; +function getDefaultDateTicks({ + start: start2, + stop, + tickCount, + minTickCount, + maxTickCount, + visibleRange, + extend +}) { + const t = getTickTimeInterval(start2, stop, tickCount, minTickCount, maxTickCount, { weekStart: sunday }); + return t ? intervalRange(t, new Date(start2), new Date(stop), { visibleRange, extend }) : []; +} +function getDateTicksForInterval({ + start: start2, + stop, + interval, + availableRange, + visibleRange, + extend +}) { + if (!interval) { + return []; + } + if (isPlainObject(interval) || typeof interval === "string") { + const ticks2 = intervalRange(interval, new Date(start2), new Date(stop), { visibleRange, extend }); + if (isDenseInterval(ticks2.length, availableRange)) { + return; + } + return ticks2; + } + const absInterval = Math.abs(interval); + if (isDenseInterval(Math.abs(stop - start2) / absInterval, availableRange)) + return; + const tickInterval = TickIntervals.findLast((t) => absInterval % t.duration === 0); + if (tickInterval) { + const { timeInterval: timeInterval3, step, duration } = tickInterval; + const alignedInterval = { + ...timeInterval3, + step: step * intervalStep(timeInterval3) * Math.round(absInterval / duration), + epoch: defaultEpoch(timeInterval3, { weekStart: sunday }) + }; + return intervalRange(alignedInterval, new Date(start2), new Date(stop), { visibleRange, extend }); + } + let date2 = new Date(Math.min(start2, stop)); + const stopDate = new Date(Math.max(start2, stop)); + const ticks = []; + while (date2 <= stopDate) { + ticks.push(date2); + date2 = new Date(date2); + date2.setMilliseconds(date2.getMilliseconds() + absInterval); + } + return ticks; +} +function updateNiceDomainIteration(d0, d1, ticks, availableRange) { + const { interval } = ticks; + const start2 = Math.min(dateToNumber(d0), dateToNumber(d1)); + const stop = Math.max(dateToNumber(d0), dateToNumber(d1)); + let i; + if (isPlainObject(interval) || typeof interval === "string") { + i = interval; + } else { + let tickCount; + if (typeof interval === "number") { + tickCount = (stop - start2) / Math.max(interval, 1); + if (isDenseInterval(tickCount, availableRange)) { + tickCount = void 0; + } + } + tickCount ?? (tickCount = ticks.tickCount ?? ContinuousScale.defaultTickCount); + i = getTickTimeInterval(start2, stop, tickCount, ticks.minTickCount, ticks.maxTickCount, { weekStart: sunday }); + } + if (i == null) + return [d0, d1]; + const domain = intervalRange(i, new Date(start2), new Date(stop), { extend: true }); + if (domain == null || domain.length < 2) + return [d0, d1]; + const r0 = domain[0]; + const r1 = domain.at(-1); + return d0 <= d1 ? [r0, r1] : [r1, r0]; +} + +// packages/ag-charts-community/src/scale/ordinalTimeScale.ts +var OrdinalTimeScale = class _OrdinalTimeScale extends DiscreteTimeScale { + constructor() { + super(...arguments); + this.type = "ordinal-time"; + this.defaultTickCount = ContinuousScale.defaultTickCount; + this._domain = []; + this.isReversed = false; + } + static is(value) { + return value instanceof _OrdinalTimeScale; + } + set domain(domain) { + if (domain === this._domain) + return; + this.invalid = true; + this._domain = domain; + this._bands = void 0; + this.isReversed = domainReversed(domain); + } + get domain() { + return this._domain; + } + get bands() { + this._bands ?? (this._bands = this.isReversed ? this.domain.slice().reverse() : this.domain); + return this._bands; + } + normalizeDomains(...domains) { + const sortedDomains = domains.filter((domain) => domain.length > 0); + if (sortedDomains.length === 0) { + return { domain: [], animatable: false }; + } else if (sortedDomains.length === 1) { + let domain = sortedDomains[0]; + const sortOrder = datesSortOrder(domain); + if (sortOrder === -1) { + domain = domain.slice().reverse(); + } else if (sortOrder == null) { + domain = sortAndUniqueDates(domain.slice()); + } + return { domain, animatable: true }; + } + return { + domain: sortAndUniqueDates(sortedDomains.flat()), + animatable: true + }; + } + ticks(params, domain, visibleRange = [0, 1], { extend = false, dropInitial = false } = {}) { + const { interval, maxTickCount, tickCount = maxTickCount } = params; + const { bands } = this; + if (!bands.length) + return; + this.refresh(); + if (interval == null) { + const { ticks: ticks2, tickOffset, tickEvery } = this.getDefaultTicks(domain, tickCount, visibleRange, extend); + let firstTickIndex = ticks2.length > 0 ? this.findIndex(ticks2[0]) : void 0; + firstTickIndex = firstTickIndex == null ? void 0 : Math.floor((firstTickIndex - tickOffset) / tickEvery); + return { ticks: ticks2, count: void 0, firstTickIndex }; + } + let start2; + let stop; + if (domain && domain.length >= 2) { + start2 = domain[0].valueOf(); + stop = domain.at(-1).valueOf(); + } else { + start2 = bands[0].valueOf(); + stop = bands.at(-1).valueOf(); + } + const [r0, r1] = this.range; + const availableRange = Math.abs(r1 - r0); + const dateTicks = getDateTicksForInterval({ start: start2, stop, interval, availableRange, visibleRange, extend }) ?? this.getDefaultTicks(domain, tickCount, visibleRange, extend).ticks; + const ticks = []; + let lastIndex = -1; + for (const dateTick of dateTicks) { + const index = this.findIndex(dateTick, 1 /* Trailing */) ?? -1; + const duplicated = index === lastIndex; + lastIndex = index; + if (!(dropInitial && index === 0) && index !== -1 && !duplicated) { + ticks.push(bands[index]); + } + } + return { ticks, count: void 0, firstTickIndex: void 0 }; + } + stepTicks(bandStep, domain, visibleRange = [0, 1], dropLast = true) { + const bandIndices = domain ? this.bandDomainIndices(domain) : void 0; + const ticks = this.ticksEvery(bandIndices, visibleRange, bandStep, 0, false); + const lastTick = ticks.at(-1); + const lastBandIndex = dropLast && bandStep > 1 ? bandIndices?.[1] : void 0; + const lastTickIndex = lastBandIndex != null && lastTick != null ? this.findIndex(lastTick) : void 0; + if (lastTickIndex != null && lastBandIndex != null && lastBandIndex - lastTickIndex < bandStep) { + ticks.pop(); + } + return ticks; + } + bandCount(visibleRange = [0, 1]) { + const { domain } = this; + const startIndex = Math.floor(visibleRange[0] * domain.length); + const endIndex = Math.ceil(visibleRange[1] * domain.length); + return endIndex - startIndex; + } + getDefaultTicks(domain, maxTickCount, visibleRange, extend) { + const { bands } = this; + const tickEvery = Math.ceil(bands.length / maxTickCount); + const tickOffset = Math.floor(tickEvery / 2); + const bandIndices = domain ? this.bandDomainIndices(domain) : void 0; + return { + ticks: this.ticksEvery(bandIndices, visibleRange, tickEvery, tickOffset, extend), + tickOffset, + tickEvery + }; + } + bandDomainIndices(domain) { + const isReversed = domainReversed(domain); + const i0 = this.findIndex(domain[isReversed ? domain.length - 1 : 0], 1 /* Trailing */) ?? 0; + const i1 = this.findIndex(domain[isReversed ? 0 : domain.length - 1], 1 /* Trailing */) ?? this.bands.length - 1; + return [i0, i1]; + } + ticksEvery([i0, i1] = [0, this.bands.length], visibleRange, tickEvery, tickOffset, extend) { + const { bands } = this; + const offset = i0; + const span = i1 - i0 + 1; + let startIndex = offset + Math.floor(visibleRange[0] * span); + let endIndex = offset + Math.ceil(visibleRange[1] * span); + if (extend) { + startIndex -= tickEvery; + endIndex += tickEvery; + } + startIndex = Math.max(startIndex, 0); + endIndex = Math.min(endIndex, bands.length); + let ticks; + if (tickEvery <= 1) { + ticks = bands.slice(startIndex, endIndex); + } else { + ticks = []; + for (let index = startIndex; index < endIndex; index += 1) { + if ((index - offset + tickOffset) % tickEvery === 0) { + ticks.push(bands[index]); + } + } + } + return ticks; + } +}; +function domainReversed(domain) { + return domain.length > 0 && domain[0] > domain.at(-1); +} + +// packages/ag-charts-community/src/scale/unitTimeScale.ts +var MAX_BANDS = 5e7; +var UnitTimeScale = class _UnitTimeScale extends DiscreteTimeScale { + constructor() { + super(...arguments); + this.type = "unit-time"; + this.defaultTickCount = 12; + this._domain = []; + this._bands = void 0; + } + static is(value) { + return value instanceof _UnitTimeScale; + } + static supportsInterval(domain, interval) { + return supportsInterval(domain, interval); + } + set domain(domain) { + if (domain === this._domain) + return; + this._domain = domain; + this._bands = void 0; + } + get domain() { + return this._domain; + } + get interval() { + return this._interval; + } + set interval(interval) { + if (this._interval === interval) + return; + this._interval = interval; + this._bands = void 0; + } + get bands() { + this._bands ?? (this._bands = this.calculateBands(this._domain, [0, 1]).bands); + return this._bands; + } + normalizeDomains(...domains) { + return normalizeContinuousDomains(...domains); + } + convert(value, options) { + this.refresh(); + if (!(value instanceof Date)) + value = new Date(value); + const { domain, interval } = this; + if (domain.length < 2) + return Number.NaN; + if (options?.clamp !== true && interval != null) { + const t = value.valueOf(); + const [start2, stop] = calculateBandRange(domain, interval); + const d0 = Math.min(start2.valueOf(), stop.valueOf()); + const d1 = Math.max(start2.valueOf(), stop.valueOf()); + const dNext = intervalNext(interval, new Date(d1)).valueOf(); + if (t < d0 || t >= dNext) + return Number.NaN; + } + return super.convert(value, options); + } + calculateBands(domain, visibleRange, extend = false) { + if (domain === this.domain && visibleRange[0] === 0 && visibleRange[1] === 1 && !extend && this._bands != null) { + return { bands: this._bands, firstBandIndex: 0 }; + } + if (domain.length < 2) + return { bands: [], firstBandIndex: void 0 }; + const { interval } = this; + if (interval == null) + return { bands: [], firstBandIndex: void 0 }; + const rangeParams = { visibleRange, extend }; + if (!supportsInterval(domain, interval, rangeParams)) + return { bands: [], firstBandIndex: void 0 }; + const [start2, stop] = calculateBandRange(domain, interval); + if (intervalRangeCount(interval, start2, stop, rangeParams) > MAX_BANDS) { + logger_exports.warnOnce(`the configured unit results in too many bands, ignoring. Supply a larger unit.`); + return { bands: [], firstBandIndex: void 0 }; + } + const bands = intervalRange(interval, start2, stop, rangeParams); + const firstBandIndex = intervalRangeStartIndex(interval, start2, stop, rangeParams); + return { bands, firstBandIndex }; + } + ticks({ interval }, domain = this.domain, visibleRange = [0, 1], { extend = false } = {}) { + if (domain.length < 2) + return; + let bands; + let firstBandIndex; + let bandsSliceIndices; + if (domain === this.domain && !extend) { + ({ bands } = this.calculateBands(domain, [0, 1], false)); + bandsSliceIndices = visibleTickSliceIndices(bands, false, visibleRange); + firstBandIndex = bandsSliceIndices[0]; + } else { + ({ bands, firstBandIndex } = this.calculateBands(domain, visibleRange, extend)); + } + if (interval == null) { + return { ticks: bands, count: void 0, firstTickIndex: firstBandIndex }; + } + const milliseconds = this.interval ? intervalMilliseconds(this.interval) : Infinity; + const d0 = Math.min(domain[0].valueOf(), domain[1].valueOf()); + const d1 = Math.max(domain[0].valueOf(), domain[1].valueOf()); + let intervalTicks; + let intervalStartIndex; + let intervalEndIndex; + if (isPlainObject(interval) || typeof interval === "string") { + intervalTicks = intervalRange(interval, domain[0], domain[1], { extend: true, visibleRange }); + intervalStartIndex = 0; + intervalEndIndex = intervalTicks.length - 1; + } else { + const i0 = bandsSliceIndices ? bandsSliceIndices[0] : 0; + const i1 = bandsSliceIndices ? bandsSliceIndices[1] : bands.length - 1; + intervalTicks = bands; + intervalStartIndex = findMaxIndex(i0, i1, (index) => bands[index].valueOf() <= d0) ?? i0; + intervalEndIndex = findMaxIndex(i0, i1, (index) => bands[index].valueOf() <= d1) ?? i1; + } + const ticks = []; + let lastIndex; + for (let i = intervalStartIndex; i <= intervalEndIndex; i++) { + const intervalTickValue = intervalTicks[i].valueOf(); + const bandIndex = findMaxIndex(0, bands.length - 1, (index) => bands[index].valueOf() <= intervalTickValue); + const tick = bandIndex != null && bandIndex != lastIndex ? bands[bandIndex] : void 0; + lastIndex = bandIndex; + if (tick != null && intervalTickValue - tick.getTime() <= milliseconds) + ticks.push(tick); + } + let bandStart; + let bandEnd; + if (this.interval) { + const bandRange = calculateBandRange([new Date(d0), new Date(d1)], this.interval); + bandStart = bandRange[0].valueOf(); + bandEnd = bandRange[1].valueOf(); + } else { + bandStart = d0; + bandEnd = d1; + } + let firstTickIndex = findMinIndex(0, ticks.length - 1, (i) => ticks[i].valueOf() >= bandStart) ?? 0; + let lastTickIndex = findMaxIndex(0, ticks.length - 1, (i) => ticks[i].valueOf() <= bandEnd) ?? ticks.length - 1; + if (extend) { + firstTickIndex = Math.max(firstTickIndex - 1, 0); + lastTickIndex = Math.min(lastTickIndex + 1, ticks.length - 1); + } + return { + ticks: ticks.slice(firstTickIndex, lastTickIndex + 1), + count: ticks.length, + firstTickIndex: firstBandIndex + }; + } +}; +function supportsInterval(domain, interval, rangeParams) { + const [start2, stop] = calculateBandRange(domain, interval); + return intervalRangeCount(interval, start2, stop, rangeParams) <= MAX_BANDS; +} +function calculateBandRange(domain, interval) { + const start2 = intervalFloor(interval, domain[0]); + const stop = intervalFloor(interval, domain[1]); + return [start2, stop]; +} + +// packages/ag-charts-community/src/util/secondaryAxisTicks.ts +function calculateNiceSecondaryAxis(scale2, domain, primaryTickCount, reverse, visibleRange) { + let [d0, d1] = findMinMax(domain.map(Number)); + const unzoomedTickCount = Math.floor(primaryTickCount.unzoomed); + if (unzoomedTickCount <= 1) { + const [start3, stop2] = domainWithOddTickCount(d0, d1); + const tickCount = 5 * Math.pow(2, -Math.ceil(Math.log2(visibleRange[1] - visibleRange[0]))); + const { ticks: ticks2 } = createTicks(start3, stop2, tickCount, void 0, void 0, visibleRange); + const d2 = [scale2.toDomain(start3), scale2.toDomain(stop2)]; + if (reverse) + d2.reverse(); + return { domain: d2, ticks: ticks2 }; + } + if (d0 === d1) { + const order = Math.floor(Math.log10(d0)); + const magnitude = Math.pow(10, order); + const rangeOffsetStep = Math.min(magnitude, 1); + const rangeOffset = unzoomedTickCount - 1; + d0 -= rangeOffsetStep * Math.floor(rangeOffset / 2); + d1 = d0 + rangeOffsetStep * rangeOffset; + } + let start2 = d0; + let stop = d1; + start2 = calculateNiceStart(start2, stop, unzoomedTickCount); + const baseStep = getTickStep(start2, stop, unzoomedTickCount); + const segments = unzoomedTickCount - 1; + stop = start2 + segments * baseStep; + const stepAlignedStart = Math.floor(start2 / baseStep) * baseStep; + const stepAlignedStop = Math.floor(stop / baseStep) * baseStep; + if (stepAlignedStart <= d0 && stepAlignedStop >= d1) { + start2 = stepAlignedStart; + stop = stepAlignedStop; + } + const d = [scale2.toDomain(start2), scale2.toDomain(stop)]; + if (reverse) + d.reverse(); + const step = baseStep * ((primaryTickCount.unzoomed - 1) / (primaryTickCount.zoomed - 1)); + const ticks = getTicks(start2, step, Math.floor(primaryTickCount.zoomed)); + return { domain: d, ticks }; +} +function domainWithOddTickCount(d0, d1) { + let start2 = d0; + let stop = d1; + let iterations = 0; + do { + [start2, stop] = niceTicksDomain(start2, stop); + const { ticks } = createTicks(start2, stop, 5); + if (ticks.length % 2 === 1) + return [start2, stop]; + start2 -= 1; + stop += 1; + } while (iterations++ < 10); + return [d0, d1]; +} +function calculateNiceStart(a, b, count) { + a = Math.floor(a); + const rawStep = Math.abs(b - a) / (count - 1); + const order = Math.floor(Math.log10(rawStep)); + const magnitude = Math.pow(10, order); + return Math.floor(a / magnitude) * magnitude; +} +function getTicks(start2, step, count) { + const fractionDigits = countFractionDigits(step); + const f = Math.pow(10, fractionDigits); + const ticks = []; + for (let i = 0; i < count; i++) { + const tick = start2 + step * i; + ticks.push(Math.round(tick * f) / f); + } + return ticks; +} +function getTickStep(start2, stop, count) { + const segments = count - 1; + const rawStep = (stop - start2) / segments; + return calculateNextNiceStep(rawStep); +} +function calculateNextNiceStep(rawStep) { + const order = Math.floor(Math.log10(rawStep)); + const magnitude = Math.pow(10, order); + const step = rawStep / magnitude; + if (step > 0 && step <= 1) + return magnitude; + if (step > 1 && step <= 2) + return 2 * magnitude; + if (step > 2 && step <= 5) + return 5 * magnitude; + if (step > 5 && step <= 10) + return 10 * magnitude; + return rawStep; +} + +// packages/ag-charts-community/src/util/tempUtils.ts +function createIdsGenerator() { + const idsCounter = /* @__PURE__ */ new Map(); + return (name) => { + const counter = idsCounter.get(name); + if (counter) { + idsCounter.set(name, counter + 1); + return `${name}_${counter}`; + } + idsCounter.set(name, 1); + return name; + }; +} + +// packages/ag-charts-community/src/chart/axis/generateTicksUtils.ts +var DENSE_TICK_COUNT = 18; +var TICK_STEP_VALUES = [1, 2, 3, 4, 6, 8, 9, 10, 12]; +function axisLabelsOverlap(data, padding2 = 0) { + const result = []; + for (const datum of data) { + const { x, y, width: width2, height: height2 } = datum; + if (result.some((l) => boxCollides(l, x, y, width2 + padding2, height2 + padding2))) { + return true; + } + result.push(datum); + } + return false; +} +function createTimeScaleTicks(interval, domain, visibleRange, extend) { + if (interval == null) { + return domain; + } + if (typeof interval !== "number") { + const epoch = domain[0]; + const alignedInterval = typeof interval === "string" ? { unit: interval, epoch } : { ...interval, epoch }; + return intervalRange(alignedInterval, domain[0], domain[1], { visibleRange, extend }); + } + const ticks = []; + const d0 = domain[0].valueOf(); + const d1 = domain[1].valueOf(); + for (let intervalTickTime = d0; intervalTickTime <= d1; intervalTickTime += interval) { + ticks.push(new Date(intervalTickTime)); + } + return ticks; +} +function ticksEqual(a, b) { + if (a.length !== b.length) { + return false; + } + for (let i = 0; i < a.length; i += 1) { + if (a[i]?.valueOf() !== b[i]?.valueOf()) { + return false; + } + } + return true; +} +function ticksSpacing(ticks) { + if (ticks.length < 2) + return Infinity; + let spacing = 0; + let y0 = ticks[0].translation; + for (let i = 1; i < ticks.length; i++) { + const y1 = ticks[i].translation; + const delta4 = Math.abs(y1 - y0); + spacing = Math.max(spacing, delta4); + y0 = y1; + } + return spacing; +} +function formatTicks(options, { + niceDomain, + rawTicks, + rawFirstTickIndex = 0, + generatePrimaryTicks, + primaryTicksIndices, + alignment, + fractionDigits, + timeInterval: timeInterval3 +}) { + const { scale: scale2, label, tickFormatter, inRange: inRange2, isVertical, sizeLimit = Infinity } = options; + const isContinuous3 = TimeScale.is(scale2) || DiscreteTimeScale.is(scale2); + const measurer3 = cachedTextMeasurer(label); + const idGenerator = createIdsGenerator(); + const ticks = []; + withTemporaryDomain(scale2, niceDomain, () => { + const maxBandwidth = BandScale.is(scale2) ? scale2.bandwidth ?? Infinity : Infinity; + const halfBandwidth = (scale2.bandwidth ?? 0) / 2; + const axisFormatter = axisTickFormatter( + label.enabled, + generatePrimaryTicks, + niceDomain, + rawTicks, + fractionDigits, + timeInterval3, + tickFormatter + ); + const wrapOptions = { + font: label, + maxWidth: isVertical ? sizeLimit : maxBandwidth, + maxHeight: isVertical ? maxBandwidth : sizeLimit, + overflow: label.truncate ? "ellipsis" : "hide", + textWrap: label.wrapping + }; + for (let i = 0; i < rawTicks.length; i++) { + const tick = rawTicks[i]; + const translation = scale2.convert(tick, { alignment }) + halfBandwidth; + if (inRange2 && !inRange2(translation)) + continue; + const isPrimary = primaryTicksIndices?.has(i) ?? false; + const inputText = axisFormatter(isPrimary, tick, i); + let wrappedLabel = null; + if (label.avoidCollisions) { + wrappedLabel = wrapTextOrSegments(inputText, wrapOptions) || null; + } + const tickLabel = wrappedLabel ?? inputText; + const isSegmented = isArray(tickLabel); + const isTruncated = tickLabel !== inputText && (!isSegmented || isSegmentTruncated(tickLabel.at(-1))); + let tickId; + if (isContinuous3) { + const tickValue = tick?.valueOf(); + if (Number.isFinite(tickValue)) { + tickId = idGenerator(`v:${tickValue}`); + } + } + tickId ?? (tickId = idGenerator(`l:${isSegmented ? toPlainText(tickLabel.flat()) : tickLabel}`)); + ticks.push({ + tick, + tickId, + tickLabel, + isPrimary, + index: i + rawFirstTickIndex, + textUntruncated: isTruncated ? toPlainText(inputText) : void 0, + textMetrics: isSegmented ? measureTextSegments(tickLabel, label) : measurer3.measureLines(tickLabel), + translation: Math.floor(translation) + }); + } + }); + return ticks; +} +function withTemporaryDomain(scale2, temporaryDomain, callback2) { + const originalDomain = scale2.domain; + try { + scale2.domain = temporaryDomain; + callback2(); + } finally { + scale2.domain = originalDomain; + } +} +function axisTickFormatter(labelEnabled, generatePrimaryTicks, niceDomain, rawTicks, fractionDigits, timeInterval3, tickFormatter) { + const dateStyle = generatePrimaryTicks ? "component" : "long"; + const parentInterval = generatePrimaryTicks && timeInterval3 ? intervalHierarchy(timeInterval3) : void 0; + const primaryFormatter = generatePrimaryTicks ? tickFormatter(niceDomain, rawTicks, true, fractionDigits, parentInterval, dateStyle) : null; + const defaultFormatter = labelEnabled ? tickFormatter(niceDomain, rawTicks, false, fractionDigits, timeInterval3, dateStyle) : null; + return (isPrimary, tick, index) => { + const formatter2 = isPrimary ? primaryFormatter : defaultFormatter; + return formatter2?.(tick, index) ?? String(tick); + }; +} +function getTimeIntervalTicks(scale2, visibleRange, tickCount, maxTickCount, tickParams, timeInterval3, reverse, minimumTimeGranularity) { + if (!TimeScale.is(scale2) && !DiscreteTimeScale.is(scale2)) + return; + const parentInterval = intervalHierarchy(timeInterval3); + if (parentInterval == null) + return; + if (reverse) { + visibleRange = [1 - visibleRange[1], 1 - visibleRange[0]]; + } + const dv0 = Math.min(scale2.domain[0].valueOf(), scale2.domain.at(-1).valueOf()); + const dv1 = Math.max(scale2.domain[0].valueOf(), scale2.domain.at(-1).valueOf()); + let [dp0, dp1] = intervalExtent(new Date(dv0), new Date(dv1), visibleRange); + dp0 = intervalFloor(parentInterval, dp0); + if (dp0.valueOf() >= dv0) { + dp0 = intervalPrevious(parentInterval, dp0); + } + dp1 = intervalCeil(parentInterval, dp1); + if (dp1.valueOf() <= dv1) { + dp1 = intervalNext(parentInterval, dp1); + } + const primaryTicks = intervalRange(parentInterval, dp0, dp1); + const milliseconds = intervalMilliseconds(timeInterval3); + const skipFirstPrimaryTick = OrdinalTimeScale.is(scale2); + const intervalTickParams = { ...tickParams, interval: timeInterval3 }; + const ticks = []; + let primaryTicksIndices; + let parentLevelMode; + let alignment; + let ordinalTickStep = 0; + if (OrdinalTimeScale.is(scale2)) { + const timeIntervalGranularity = intervalUnit(timeInterval3); + parentLevelMode = minimumTimeGranularity != null && intervalMilliseconds(minimumTimeGranularity) >= intervalMilliseconds(timeIntervalGranularity) ? 2 /* OrdinalTimeStepTicks */ : 3 /* OrdinalTimeScaleTicks */; + alignment = 1 /* Trailing */; + const tickDensity = tickCount / maxTickCount; + const baseTickStep = scale2.bandCount(visibleRange) / (tickDensity * DENSE_TICK_COUNT); + ordinalTickStep = TICK_STEP_VALUES.findLast((t) => baseTickStep >= t) ?? 1; + } else if (UnitTimeScale.is(scale2) && (scale2.interval == null || intervalMilliseconds(scale2.interval) >= milliseconds)) { + parentLevelMode = 1 /* UnitTimeScaleTicks */; + } else { + parentLevelMode = 0 /* ContinuousTimeScaleTicks */; + alignment = 2 /* Interpolate */; + } + for (let i = 0; i < primaryTicks.length - 1; i++) { + const p0 = primaryTicks[i]; + const p1 = primaryTicks[i + 1]; + const first2 = i === 0; + const last = i === primaryTicks.length - 2; + const dp = p1.valueOf() - p0.valueOf(); + const pVisibleRange = [ + Math.max((dv0 - p0.valueOf()) / dp, 0), + Math.min((dv1 - p0.valueOf()) / dp, 1) + ]; + let intervalTicks; + switch (parentLevelMode) { + case 0 /* ContinuousTimeScaleTicks */: + intervalTicks = createTimeScaleTicks(intervalTickParams.interval, [p0, p1], pVisibleRange, true); + break; + case 1 /* UnitTimeScaleTicks */: + case 3 /* OrdinalTimeScaleTicks */: { + const scaleTicks = scale2.ticks(intervalTickParams, [p0, p1], pVisibleRange, { + extend: true, + dropInitial: true + }); + intervalTicks = scaleTicks?.ticks ?? []; + break; + } + case 2 /* OrdinalTimeStepTicks */: + intervalTicks = scale2.stepTicks( + ordinalTickStep, + [p0, p1], + void 0, + !last + ); + break; + } + dropFirstWhile(intervalTicks, (firstTick2) => firstTick2.valueOf() < p0.valueOf()); + if (!last) { + dropLastWhile(intervalTicks, (lastTick) => { + switch (parentLevelMode) { + case 0 /* ContinuousTimeScaleTicks */: + case 3 /* OrdinalTimeScaleTicks */: + return lastTick.valueOf() + milliseconds > p1.valueOf(); + case 1 /* UnitTimeScaleTicks */: + case 2 /* OrdinalTimeStepTicks */: + return lastTick.valueOf() >= p1.valueOf(); + } + }); + } + if (intervalTicks.length === 0) + continue; + const firstTick = intervalTicks[0]; + const firstTickDiff = compareDates(firstTick, p0); + const firstPrimary = parentLevelMode === 0 /* ContinuousTimeScaleTicks */ ? firstTickDiff === 0 : firstTickDiff <= milliseconds; + if (firstPrimary && (!skipFirstPrimaryTick || !first2)) { + primaryTicksIndices ?? (primaryTicksIndices = /* @__PURE__ */ new Set()); + primaryTicksIndices.add(ticks.length); + } + ticks.push(...intervalTicks); + } + if (primaryTicksIndices?.size === 1 && primaryTicksIndices.has(0)) { + primaryTicksIndices = void 0; + } + return { ticks, primaryTicksIndices, alignment }; +} +function timeIntervalMaxLabelSize(label, primaryLabel, domain, timeInterval3, textMeasurer) { + const specifier = labelSpecifier(label.format, timeInterval3); + if (specifier == null) { + return { width: 0, height: 0 }; + } + const labelFormatter = buildDateFormatter(specifier); + const hierarchy = timeInterval3 ? intervalHierarchy(timeInterval3) : void 0; + const primarySpecifier = labelSpecifier(primaryLabel?.format, hierarchy); + const primaryLabelFormatter = primarySpecifier ? buildDateFormatter(primarySpecifier) : labelFormatter; + const d0 = new Date(domain[0]); + const d1 = new Date(domain.at(-1)); + const hierarchyRange = hierarchy ? intervalRange(hierarchy, new Date(domain[0]), new Date(domain.at(-1)), { extend: true }) : void 0; + let maxWidth = 0; + let maxHeight = 0; + if (labelFormatter != null) { + const padding2 = expandLabelPadding(label); + const xPadding = padding2.left + padding2.right; + const yPadding = padding2.top + padding2.bottom; + let l0; + let l1; + if (hierarchyRange != null && hierarchyRange.length > 1) { + l0 = hierarchyRange[0]; + l1 = hierarchyRange[1]; + } else { + l0 = d0; + l1 = d1; + } + const labelRange = intervalRange(timeInterval3, l0, l1, { limit: 50 }); + for (const date2 of labelRange) { + const text2 = labelFormatter(date2); + const { width: width2, height: height2 } = textMeasurer.measureLines(text2); + maxWidth = Math.max(maxWidth, width2 + xPadding); + maxHeight = Math.max(maxHeight, height2 + yPadding); + } + } + if (primaryLabelFormatter != null && hierarchyRange != null) { + const padding2 = expandLabelPadding(primaryLabel); + const xPadding = padding2.left + padding2.right; + const yPadding = padding2.top + padding2.bottom; + for (const date2 of hierarchyRange) { + const text2 = primaryLabelFormatter(date2); + const { width: width2, height: height2 } = textMeasurer.measureLines(text2); + maxWidth = Math.max(maxWidth, width2 + xPadding); + maxHeight = Math.max(maxHeight, height2 + yPadding); + } + } + return { + width: Math.ceil(maxWidth), + height: Math.ceil(maxHeight) + }; +} +function getTextBaseline(parallel, labelRotation, sideFlag, parallelFlipFlag) { + if (parallel && !labelRotation) { + return sideFlag * parallelFlipFlag === -1 ? "top" : "bottom"; + } + return "middle"; +} +function getTextAlign(parallel, labelRotation, labelAutoRotation, sideFlag, regularFlipFlag) { + const labelRotated = labelRotation > 0 && labelRotation <= Math.PI; + const labelAutoRotated = labelAutoRotation > 0 && labelAutoRotation <= Math.PI; + const alignFlag = labelRotated || labelAutoRotated ? -1 : 1; + if (parallel) { + if (labelRotation || labelAutoRotation) { + if (sideFlag * alignFlag === -1) { + return "end"; + } + } else { + return "center"; + } + } else if (sideFlag * regularFlipFlag === -1) { + return "end"; + } + return "start"; +} +function labelSpecifier(format, timeInterval3) { + if (format == null) + return; + if (typeof format === "string") { + return format; + } else if (isPlainObject(format) && timeInterval3 != null) { + return format[intervalUnit(timeInterval3)]; + } +} +function calculateLabelRotation(rotation, parallel, axisRotation = 0) { + const configuredRotation = normalizeAngle360FromDegrees(rotation); + const parallelFlipFlag = !configuredRotation && axisRotation >= 0 && axisRotation <= Math.PI ? -1 : 1; + const regularFlipFlag = !configuredRotation && axisRotation - Math.PI / 2 >= 0 && axisRotation - Math.PI / 2 <= Math.PI ? -1 : 1; + let defaultRotation = 0; + if (parallel) { + defaultRotation = parallelFlipFlag * (Math.PI / 2); + } else if (regularFlipFlag === -1) { + defaultRotation = Math.PI; + } + return { configuredRotation, defaultRotation, parallelFlipFlag, regularFlipFlag }; +} + +// packages/ag-charts-community/src/chart/axis/generateTicks.ts +var sunday2 = new Date(1970, 0, 4); +function generateTicks(options) { + const { label, domain, axisRotation, labelOffset, sideFlag } = options; + const { defaultRotation, configuredRotation, parallelFlipFlag, regularFlipFlag } = calculateLabelRotation( + label.rotation, + label.parallel, + axisRotation + ); + const initialRotation = configuredRotation + defaultRotation; + const checkLabelOverlap = (tickData2, rotation2 = 0) => { + const labelSpacing = label.minSpacing ?? (configuredRotation === 0 && rotation2 === 0 ? 10 : 0); + const labelRotation = initialRotation + rotation2; + const labelPadding = expandLabelPadding(label); + return axisLabelsOverlap(createTimeLabelData(options, tickData2, labelRotation), labelSpacing) || axisLabelsOverlap(createLabelData(tickData2.ticks, labelOffset, labelRotation, labelPadding), labelSpacing); + }; + const { maxTickCount } = estimateScaleTickCount(options); + const tickGenerationType = getTickGenerationType(options); + const avoidCollisions = label.enabled && label.avoidCollisions; + const maxIterations = Number.isFinite(maxTickCount) ? maxTickCount : 10; + const tryAutoRotate = avoidCollisions && label.autoRotate && label.rotation == null; + let index = 0; + let autoRotation = 0; + let labelOverlap = true; + let tickData = { + tickDomain: [], + niceDomain: domain, + ticks: [], + rawTicks: [], + rawTickCount: void 0, + timeInterval: void 0, + fractionDigits: 0 + }; + while (labelOverlap && index <= maxIterations) { + ({ tickData, index } = buildTickData(options, tickGenerationType, tickData, index)); + autoRotation = tryAutoRotate && checkLabelOverlap(tickData, 0) ? normalizeAngle360FromDegrees(label.autoRotateAngle) : 0; + labelOverlap = avoidCollisions && checkLabelOverlap(tickData, autoRotation); + } + const textAlign = getTextAlign(label.parallel, configuredRotation, autoRotation, sideFlag, regularFlipFlag); + const textBaseline = getTextBaseline(label.parallel, configuredRotation, sideFlag, parallelFlipFlag); + const rotation = configuredRotation + autoRotation; + return { tickData, textAlign, textBaseline, rotation }; +} +function getTickGenerationType(options) { + if (options.interval?.values) { + return 2 /* VALUES */; + } else if (options.primaryTickCount != null) { + return 1 /* CREATE_SECONDARY */; + } + return 0 /* CREATE */; +} +function estimateScaleTickCount({ + scale: scale2, + domain, + range: range4, + visibleRange, + label, + defaultTickMinSpacing, + interval: { minSpacing, maxSpacing } +}) { + const { defaultTickCount } = scale2; + const rangeExtent = findRangeExtent(range4); + const zoomExtent = findRangeExtent(visibleRange); + if (CategoryScale.is(scale2)) { + const maxTickCount = domain.length; + const estimatedTickCount = Math.ceil(rangeExtent / (zoomExtent * label.fontSize)); + return { + tickCount: Math.min(estimatedTickCount, maxTickCount), + minTickCount: 0, + maxTickCount + }; + } + return estimateTickCount(rangeExtent, zoomExtent, minSpacing, maxSpacing, defaultTickCount, defaultTickMinSpacing); +} +function buildTickData(options, tickGenerationType, previousTickData, index) { + const { step, values } = options.interval; + const { maxTickCount, minTickCount, tickCount } = estimateScaleTickCount(options); + const countTicks2 = (i) => Math.max(tickCount - i, minTickCount); + const regenerateTicks = step == null && values == null && countTicks2(index) > minTickCount; + const previousTicks = previousTickData.rawTicks; + const maxIterations = tickCount - minTickCount; + const countParams = { minTickCount, maxTickCount, tickCount: countTicks2(index) }; + let nextTicks = calculateRawTicks(options, tickGenerationType, countParams); + if (regenerateTicks && ticksEqual(nextTicks.rawTicks, previousTicks)) { + let lowerBound = index; + let upperBound = maxIterations; + while (lowerBound <= upperBound) { + index = Math.trunc((lowerBound + upperBound) / 2); + countParams.tickCount = countTicks2(index); + const nextTicksCandidate = calculateRawTicks(options, tickGenerationType, countParams); + if (ticksEqual(nextTicksCandidate.rawTicks, previousTicks)) { + lowerBound = index + 1; + } else { + nextTicks = nextTicksCandidate; + upperBound = index - 1; + } + } + } + const { + tickDomain, + niceDomain, + rawTicks, + rawTickCount, + rawFirstTickIndex, + generatePrimaryTicks, + primaryTicksIndices, + alignment, + fractionDigits, + timeInterval: timeInterval3 + } = nextTicks; + return { + tickData: { + tickDomain, + niceDomain, + rawTicks, + rawTickCount, + fractionDigits, + timeInterval: timeInterval3, + ticks: formatTicks(options, { + niceDomain, + rawTicks, + rawFirstTickIndex, + generatePrimaryTicks, + primaryTicksIndices, + alignment, + fractionDigits, + timeInterval: timeInterval3 + }) + }, + index: index + 1 + }; +} +function calculateRawTicks(options, tickGenerationType, countParams) { + const { + domain, + reverse, + visibleRange, + scale: scale2, + interval, + primaryLabel, + niceMode, + primaryTickCount, + minimumTimeGranularity + } = options; + const domainParams = { + nice: niceMode === 0 /* TickAndDomain */, + interval: interval.step, + ...countParams + }; + const tickParams = { ...domainParams }; + tickParams.nice || (tickParams.nice = niceMode === 1 /* TicksOnly */); + let secondaryAxisTicks; + if (tickGenerationType === 1 /* CREATE_SECONDARY */ && primaryTickCount != null && ContinuousScale.is(scale2)) { + secondaryAxisTicks = calculateNiceSecondaryAxis(scale2, domain, primaryTickCount, reverse, visibleRange); + } + const niceDomain = niceMode === 0 /* TickAndDomain */ ? secondaryAxisTicks?.domain ?? scale2.niceDomain(domainParams, domain) : domain; + let tickDomain = niceDomain; + let rawTicks; + let rawTickCount; + let rawFirstTickIndex; + let timeInterval3; + let primaryTicksIndices; + let alignment; + const generatePrimaryTicks = primaryLabel?.enabled === true && tickParams.interval == null; + withTemporaryDomain(scale2, niceDomain, () => { + switch (tickGenerationType) { + case 2 /* VALUES */: + tickDomain = interval.values; + rawTicks = interval.values; + rawTickCount = rawTicks.length; + if (OrdinalTimeScale.is(scale2)) { + alignment = 1 /* Trailing */; + } else if (UnitTimeScale.is(scale2)) { + alignment = 2 /* Interpolate */; + } + if (ContinuousScale.is(scale2)) { + const [d0, d1] = findMinMax(niceDomain.map(Number)); + rawTicks = rawTicks.filter((value) => Number(value) >= d0 && Number(value) <= d1).sort((a, b) => Number(a) - Number(b)); + } + break; + case 1 /* CREATE_SECONDARY */: + if (secondaryAxisTicks) { + rawTicks = secondaryAxisTicks.ticks; + rawTickCount = secondaryAxisTicks.ticks.length; + } else { + const tickGeneration = scale2.ticks(tickParams, niceDomain, visibleRange); + rawTicks = tickGeneration?.ticks; + rawTickCount = tickGeneration?.count; + } + break; + default: { + const { tickCount, minTickCount, maxTickCount } = countParams; + if (niceDomain.length > 0 && tickParams.interval == null && (UnitTimeScale.is(scale2) || generatePrimaryTicks && (TimeScale.is(scale2) || OrdinalTimeScale.is(scale2)))) { + const dates = niceDomain; + const start2 = Math.min(dates[0].valueOf(), dates.at(-1).valueOf()); + const end3 = Math.max(dates[0].valueOf(), dates.at(-1).valueOf()); + timeInterval3 = getTickTimeInterval(start2, end3, tickCount, minTickCount, maxTickCount, { + weekStart: primaryLabel == null ? sunday2 : void 0, + primaryOnly: true + }); + } + let minTimeInterval; + if (OrdinalTimeScale.is(scale2)) { + minTimeInterval = minimumTimeGranularity; + } else if (UnitTimeScale.is(scale2)) { + minTimeInterval = scale2.interval; + } + if (minTimeInterval != null && timeInterval3 != null && // Prefer UnitTimeAxis.unit over this interval, because the user may have defined an epoch + intervalMilliseconds(minTimeInterval) >= intervalMilliseconds(timeInterval3)) { + timeInterval3 = minTimeInterval; + } + const intervalTicks = timeInterval3 ? getTimeIntervalTicks( + scale2, + visibleRange, + tickCount, + maxTickCount, + tickParams, + timeInterval3, + reverse, + minimumTimeGranularity + ) : void 0; + if (intervalTicks) { + ({ ticks: rawTicks, primaryTicksIndices, alignment } = intervalTicks); + } else { + const intervalTickParams = UnitTimeScale.is(scale2) && tickParams.interval == null && timeInterval3 != null ? { ...tickParams, interval: timeInterval3 } : tickParams; + const tickGeneration = scale2.ticks(intervalTickParams, niceDomain, visibleRange); + rawTicks = tickGeneration?.ticks; + rawTickCount = tickGeneration?.count; + rawFirstTickIndex = tickGeneration?.firstTickIndex; + if (TimeScale.is(scale2) || DiscreteTimeScale.is(scale2)) { + const paramsInterval = typeof tickParams.interval === "number" ? lowestGranularityForInterval(tickParams.interval) : tickParams.interval; + timeInterval3 ?? (timeInterval3 = paramsInterval ?? tickGeneration?.timeInterval); + } + } + } + } + }); + rawTicks ?? (rawTicks = []); + let fractionDigits = 0; + for (const tick of rawTicks) { + if (typeof tick !== "number") + continue; + const value = countFractionDigits(tick); + if (value > fractionDigits) { + fractionDigits = value; + } + } + if (!generatePrimaryTicks) { + primaryTicksIndices = void 0; + } + return { + tickDomain, + niceDomain, + rawTicks, + rawTickCount, + rawFirstTickIndex, + generatePrimaryTicks, + primaryTicksIndices, + alignment, + fractionDigits, + timeInterval: timeInterval3 + }; +} +function createTimeLabelData(options, tickData, labelRotation) { + const { niceDomain, ticks, timeInterval: timeInterval3 } = tickData; + if (timeInterval3 == null) + return []; + const spacing = ticksSpacing(ticks); + const { label, labelOffset, primaryLabel, domain } = options; + const { width: width2, height: height2 } = timeIntervalMaxLabelSize( + label, + primaryLabel, + niceDomain ?? domain, + timeInterval3, + cachedTextMeasurer(label) + ); + const labelData = []; + for (const translation of [0, spacing]) { + const { x, y } = rotatePoint(labelOffset, translation, labelRotation); + labelData.push({ x, y, width: width2, height: height2 }); + } + return labelData; +} +function createLabelData(tickData, labelOffset, labelRotation, labelPadding) { + const labelData = []; + const xPadding = labelPadding.left + labelPadding.right; + const yPadding = labelPadding.top + labelPadding.bottom; + for (const { tickLabel, textMetrics, translation } of tickData) { + if (!tickLabel) + continue; + const { x, y } = rotatePoint(labelOffset, translation, labelRotation); + const width2 = textMetrics.width + xPadding; + const height2 = textMetrics.height + yPadding; + labelData.push({ x, y, width: width2, height: height2 }); + } + return labelData; +} + +// packages/ag-charts-community/src/chart/axis/cartesianAxis.ts +var _CartesianAxis = class _CartesianAxis extends Axis { + constructor(moduleCtx, scale2) { + super(moduleCtx, scale2); + this.maxThicknessRatio = 0.3; + this.crossAxisTranslation = { x: 0, y: 0 }; + this.minimumTimeGranularity = void 0; + this.headingLabelGroup = this.axisGroup.appendChild( + new TranslatableGroup({ name: `${this.id}-Axis-heading` }) + ); + this.lineNodeGroup = this.axisGroup.appendChild( + new TranslatableGroup({ name: `${this.id}-Axis-line` }) + ); + this.lineNode = this.lineNodeGroup.appendChild(new Line({ zIndex: 1 /* AxisLine */ })); + this.tickLineGroupSelection = Selection.select(this.tickLineGroup, Line, false); + this.gridLineGroupSelection = Selection.select(this.gridLineGroup, Line, false); + this.gridFillGroupSelection = Selection.select(this.gridFillGroup, Rect, false); + this.tempText = new TransformableText({ debugDirty: false }); + this.tempCaption = new Caption(); + this.animationManager = moduleCtx.animationManager; + this.animationState = new StateMachine("empty", { + empty: { + update: { + target: "ready", + action: () => this.resetSelectionNodes() + }, + reset: "empty" + }, + ready: { + update: (data) => this.animateReadyUpdate(data), + resize: () => this.resetSelectionNodes(), + reset: "empty" + } + }); + this.headingLabelGroup.appendChild(this.title.caption.node); + let previousSize = void 0; + this.cleanup.register( + moduleCtx.eventsHub.on("layout:complete", (e) => { + const size = [e.chart.width, e.chart.height]; + if (previousSize != null && !arraysEqual(size, previousSize)) { + this.animationState.transition("resize"); + } + previousSize = size; + }), + this.title.caption.registerInteraction(this.moduleCtx, "afterend") + ); + } + static is(value) { + return value instanceof _CartesianAxis; + } + get horizontal() { + return this.position === "top" || this.position === "bottom"; + } + onGridVisibilityChange() { + this.gridLineGroupSelection.clear(); + this.gridFillGroupSelection.clear(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } + } + get direction() { + return this.position === "top" || this.position === "bottom" ? "x" /* X */ : "y" /* Y */; + } + createAxisContext() { + return { ...super.createAxisContext(), position: this.position }; + } + createLabel() { + return new CartesianAxisLabel(); + } + updateDirection() { + switch (this.position) { + case "top": + this.label.mirrored = true; + this.label.parallel = true; + break; + case "right": + this.label.mirrored = true; + this.label.parallel = false; + break; + case "bottom": + this.label.mirrored = false; + this.label.parallel = true; + break; + case "left": + this.label.mirrored = false; + this.label.parallel = false; + break; + } + if (this.axisContext) { + this.axisContext.position = this.position; + this.axisContext.direction = this.direction; + } + } + calculateLayout(primaryTickCount, chartLayout) { + this.updateDirection(); + return super.calculateLayout(primaryTickCount, chartLayout); + } + layoutCrossLines() { + const crosslinesVisible = this.hasDefinedDomain() || this.hasVisibleSeries(); + for (const crossLine of this.crossLines) { + crossLine.calculateLayout?.(crosslinesVisible); + } + } + calculateTickLayout(domain, niceMode, visibleRange, initialPrimaryTickCount) { + const sideFlag = this.label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + this.label.spacing + this.seriesAreaPadding); + if (niceMode === 2 /* Off */ && this.label.enabled === false && this.tick.enabled === false && this.gridLine.enabled === false) { + const { bbox: bbox2, spacing: spacing2 } = this.tickBBox(domain, [], []); + const layout2 = { + ticks: [], + tickLines: [], + gridLines: [], + gridFills: [], + labels: [], + spacing: spacing2 + }; + return { + ticks: [], + rawTickCount: 0, + tickDomain: domain, + niceDomain: domain, + fractionDigits: 0, + timeInterval: void 0, + bbox: bbox2, + layout: layout2 + }; + } + const { label, primaryLabel, scale: scale2, range: range4, interval, reverse, defaultTickMinSpacing, minimumTimeGranularity } = this; + const tickGenerationResult = generateTicks({ + label, + scale: scale2, + interval, + primaryLabel, + domain, + range: range4, + reverse, + niceMode, + visibleRange, + defaultTickMinSpacing, + minimumTimeGranularity, + sideFlag, + labelOffset: labelX, + primaryTickCount: initialPrimaryTickCount, + axisRotation: this.horizontal ? -0.5 * Math.PI : 0, + isVertical: this.direction === "y" /* Y */, + sizeLimit: this.chartLayout?.sizeLimit, + inRange: (translation) => this.inRange(translation, 1e-3), + tickFormatter: (...args) => this.tickFormatter(...args) + }); + const { tickData } = tickGenerationResult; + const removeOverflowLabels = this.label.avoidCollisions && this.horizontal && tickData.ticks.length > 2 && (ContinuousScale.is(this.scale) || DiscreteTimeScale.is(this.scale)); + if (removeOverflowLabels) { + const removeOverflowThreshold = this.chartLayout?.padding.right ?? 0; + const lastTick = tickData.ticks.at(-1); + if (lastTick?.tickLabel != null && lastTick.translation + lastTick.textMetrics.width / 2 > range4[1] + removeOverflowThreshold) { + lastTick.tickLabel = void 0; + if (visibleRange[0] === 0 && visibleRange[1] === 1) { + tickData.ticks[0].tickLabel = void 0; + } + } + } + const { ticks, tickDomain, rawTicks, rawTickCount, fractionDigits, timeInterval: timeInterval3, niceDomain } = tickData; + const labels = ticks.map((d) => this.getTickLabelProps(d, tickGenerationResult)); + const { position, gridPadding, gridLength } = this; + const direction = position === "bottom" || position === "right" ? -1 : 1; + const p1 = direction * gridPadding; + const p2 = direction * (gridLength + gridPadding); + const gridLines = this.calculateGridLines(ticks, p1, p2); + const gridFills = this.calculateGridFills(ticks, p1, p2); + const tickLines = this.calculateTickLines(ticks, direction); + const { bbox, spacing } = this.tickBBox(tickDomain, ticks, labels); + const layout = { ticks, gridLines, gridFills, tickLines, labels, spacing }; + return { ticks: rawTicks, rawTickCount, tickDomain, niceDomain, fractionDigits, timeInterval: timeInterval3, bbox, layout }; + } + calculateGridLines(ticks, p1, p2) { + return ticks.map((tick, index) => this.calculateGridLine(tick, index, p1, p2, ticks)); + } + calculateGridLine({ index: tickIndex, tickId, translation: offset }, _index, p1, p2, _ticks) { + const { gridLine, horizontal } = this; + const [x1, y1, x2, y2] = horizontal ? [offset, p1, offset, p2] : [p1, offset, p2, offset]; + const { style: style2 } = gridLine; + const { stroke: stroke3, strokeWidth = 0, lineDash } = style2[tickIndex % style2.length] ?? {}; + return { tickId, offset, x1, y1, x2, y2, stroke: stroke3, strokeWidth, lineDash }; + } + calculateGridFills(ticks, p1, p2) { + const { horizontal, range: range4, type } = this; + const gridFills = []; + if (ticks.length == 0) + return gridFills; + let gridFillIndexOffset = 0; + const isVerticalUnitTime = !horizontal && type === "unit-time"; + const firstFillOffCanvas = isVerticalUnitTime && ticks[0].translation < range4[0] || !isVerticalUnitTime && ticks[0].translation > range4[0]; + if (firstFillOffCanvas) { + const injectedTick = { tickId: `before:${ticks[0].tickId}`, translation: range4[0] }; + gridFills.push(this.calculateGridFill(injectedTick, -1, ticks[0].index, p1, p2, ticks)); + gridFillIndexOffset = 1; + } + gridFills.push( + ...ticks.map( + (tick, index) => this.calculateGridFill(tick, index, tick.index + gridFillIndexOffset, p1, p2, ticks) + ) + ); + return gridFills; + } + calculateGridFill({ tickId, translation }, index, gridFillIndex, p1, p2, ticks) { + const { gridLine, horizontal, range: range4 } = this; + const nextTick = ticks[index + 1]; + const startOffset = translation; + const endOffset = nextTick ? nextTick.translation : range4[1]; + const [x1, y1, x2, y2] = horizontal ? [startOffset, Math.max(p1, p2), endOffset, Math.min(p1, p2)] : [Math.min(p1, p2), Math.min(startOffset, endOffset), Math.max(p1, p2), Math.max(startOffset, endOffset)]; + const { fill, fillOpacity } = gridLine.style[gridFillIndex % gridLine.style.length] ?? {}; + return { tickId, x1, y1, x2, y2, fill, fillOpacity }; + } + calculateTickLines(ticks, direction) { + return ticks.map((tick) => this.calculateTickLine(tick, tick.index, direction, ticks)); + } + calculateTickLine({ isPrimary, tickId, translation: offset }, _index, direction, _ticks) { + const { horizontal, tick, primaryTick } = this; + const datumTick = isPrimary && primaryTick ? primaryTick : tick; + const h = -direction * this.getTickSize(datumTick); + const [x1, y1, x2, y2] = horizontal ? [offset, 0, offset, h] : [0, offset, h, offset]; + const { stroke: stroke3, width: strokeWidth } = datumTick; + const lineDash = void 0; + return { tickId, offset, x1, y1, x2, y2, stroke: stroke3, strokeWidth, lineDash }; + } + update() { + this.updateDirection(); + const previousTicksIds = Array.from(this.tickLabelGroupSelection.nodes(), (node) => node.datum.tickId); + super.update(); + const { tickLayout } = this; + this.updateTitle(this.scale.domain, tickLayout?.spacing ?? 0); + if (!this.animatable) { + this.moduleCtx.animationManager.skipCurrentBatch(); + } + if (tickLayout) { + const { ticks } = tickLayout; + if (this.animationManager.isSkipped()) { + this.resetSelectionNodes(); + } else { + const tickIds = ticks.map((datum) => datum.tickId); + const diff8 = diffArrays(previousTicksIds, tickIds); + this.animationState.transition("update", diff8); + } + } + const { enabled, stroke: stroke3, width: width2 } = this.line; + this.lineNode.setProperties({ stroke: stroke3, strokeWidth: enabled ? width2 : 0 }); + this.updateTickLines(); + this.updateGridLines(); + this.updateGridFills(); + } + getAxisTransform() { + return { + translationX: Math.floor(this.translation.x + this.crossAxisTranslation.x), + translationY: Math.floor(this.translation.y + this.crossAxisTranslation.y) + }; + } + updatePosition() { + super.updatePosition(); + const axisTransform = this.getAxisTransform(); + this.tickLineGroup.datum = axisTransform; + this.tickLabelGroup.datum = axisTransform; + this.lineNodeGroup.datum = axisTransform; + this.headingLabelGroup.datum = axisTransform; + } + setAxisVisible(visible) { + this.tickLineGroup.visible = visible && (this.tick.enabled || (this.primaryTick?.enabled ?? false)); + this.tickLabelGroup.visible = visible && (this.label.enabled || (this.primaryTick?.enabled ?? false)); + this.lineNodeGroup.visible = visible; + this.headingLabelGroup.visible = visible; + } + getAxisLineCoordinates() { + const { horizontal } = this; + const [c1, c2] = findMinMax(this.range); + return horizontal ? { x1: c1, x2: c2, y1: 0, y2: 0 } : { x1: 0, x2: 0, y1: c1, y2: c2 }; + } + getTickLineBBox(datum) { + const { translation } = datum; + const { position, primaryTick } = this; + let tickSize = this.getTickSize(); + if (primaryTick?.enabled) { + tickSize = Math.max(tickSize, this.getTickSize(primaryTick)); + } + switch (position) { + case "top": + return new BBox(translation, -tickSize, translation, tickSize); + case "bottom": + return new BBox(translation, 0, translation, tickSize); + case "left": + return new BBox(-tickSize, translation, tickSize, translation); + case "right": + return new BBox(0, translation, tickSize, translation); + } + } + lineNodeBBox() { + const { position, seriesAreaPadding } = this; + const { y1, y2 } = this.getAxisLineCoordinates(); + const dy2 = y2 - y1; + switch (position) { + case "top": + return new BBox(y1, -seriesAreaPadding, dy2, seriesAreaPadding); + case "bottom": + return new BBox(y1, 0, dy2, seriesAreaPadding); + case "left": + return new BBox(-seriesAreaPadding, y1, seriesAreaPadding, dy2); + case "right": + return new BBox(0, y1, seriesAreaPadding, dy2); + } + } + titleBBox(domain, spacing) { + const { tempCaption } = this; + tempCaption.node.setProperties(this.titleProps(tempCaption, domain, spacing)); + return tempCaption.node.getBBox(); + } + tickBBox(domain, ticks, labels) { + const { tick, primaryTick, label, primaryLabel, title, position, horizontal, seriesAreaPadding } = this; + const boxes = []; + boxes.push(this.lineNodeBBox()); + if (tick.enabled || primaryTick?.enabled) { + for (const datum of ticks) { + boxes.push(this.getTickLineBBox(datum)); + } + } + const { tempText } = this; + if (label.enabled) { + for (const datum of labels) { + if (!datum.visible) + continue; + tempText.setProperties(datum); + const box = tempText.getBBox(); + if (box) { + boxes.push(box); + } + } + } + if (primaryLabel?.enabled && position === "bottom") { + const inexactMeasurementPadding = 2; + boxes.push( + new BBox( + 0, + calcLineHeight(label.fontSize) + inexactMeasurementPadding, + 1, + this.getTickSize(tick) + label.spacing + seriesAreaPadding + ) + ); + if (primaryLabel.format != null) { + const { format } = primaryLabel; + const formats = isPlainObject(format) ? Object.values(format) : [format]; + const maxLines = formats.reduce((m, f) => Math.max(m, countLines(f)), 0); + boxes.push( + new BBox( + 0, + this.getTickSize(primaryTick ?? tick) + primaryLabel.spacing + seriesAreaPadding, + 1, + maxLines * calcLineHeight(primaryLabel.fontSize) + inexactMeasurementPadding + ) + ); + } + } + let spacing = 0; + if (title.enabled) { + const combined = BBox.merge(boxes); + spacing = horizontal ? combined.height : combined.width; + boxes.push(this.titleBBox(domain, spacing)); + } + const bbox = BBox.merge(boxes); + return { bbox, spacing }; + } + titleProps(caption, domain, spacing) { + const { title } = this; + if (!title.enabled) { + caption.enabled = false; + return { + visible: false, + text: "", + textBaseline: "bottom", + x: 0, + y: 0, + rotationCenterX: 0, + rotationCenterY: 0, + rotation: 0 + }; + } + caption.enabled = true; + caption.color = title.color; + caption.fontFamily = title.fontFamily; + caption.fontSize = title.fontSize; + caption.fontStyle = title.fontStyle; + caption.fontWeight = title.fontWeight; + caption.wrapping = title.wrapping; + const padding2 = (title.spacing ?? 0) + spacing; + const { range: range4 } = this; + const midOffset = (range4[0] + range4[1]) / 2; + let x; + let y; + let rotation; + let textBaseline; + switch (this.position) { + case "top": + x = midOffset; + y = -padding2; + rotation = 0; + textBaseline = "bottom"; + break; + case "bottom": + x = midOffset; + y = padding2; + rotation = 0; + textBaseline = "top"; + break; + case "left": + x = -padding2; + y = midOffset; + rotation = -0.5 * Math.PI; + textBaseline = "bottom"; + break; + case "right": + x = padding2; + y = midOffset; + rotation = 0.5 * Math.PI; + textBaseline = "bottom"; + break; + } + const { formatter: formatter2 = (p) => p.defaultValue } = title; + const text2 = this.cachedCallWithContext(formatter2, this.getTitleFormatterParams(domain)); + caption.text = text2; + return { + visible: true, + text: text2, + textBaseline, + x, + y, + rotationCenterX: x, + rotationCenterY: y, + rotation + }; + } + getTickLabelProps(datum, tickGenerationResult) { + const { horizontal, primaryLabel, primaryTick, seriesAreaPadding, scale: scale2 } = this; + const { tickId, tickLabel: text2 = "", translation, isPrimary, textUntruncated } = datum; + const label = isPrimary && primaryLabel?.enabled ? primaryLabel : this.label; + const tick = isPrimary && primaryTick?.enabled ? primaryTick : this.tick; + const { rotation, textBaseline, textAlign } = tickGenerationResult; + const { range: range4 } = scale2; + const sideFlag = this.label.getSideFlag(); + const borderOffset = expandLabelPadding(label)[this.position]; + const labelOffset = sideFlag * (this.getTickSize(tick) + label.spacing + seriesAreaPadding) - borderOffset; + const visible = text2 !== ""; + const x = horizontal ? translation : labelOffset; + const y = horizontal ? -labelOffset : translation; + return { + ...this.getLabelStyles({ value: datum.tick, formattedValue: text2 }, void 0, label), + tickId, + rotation, + text: text2, + textAlign, + textBaseline, + textUntruncated, + visible, + x, + y, + rotationCenterX: x, + rotationCenterY: y, + range: range4 + }; + } + updateSelections() { + if (!this.tickLayout) + return; + const lineData = this.getAxisLineCoordinates(); + const { tickLines, gridLines, gridFills, labels } = this.tickLayout; + const getDatumId = (datum) => datum.tickId; + this.lineNode.datum = lineData; + this.gridLineGroupSelection.update(this.gridLine.enabled ? gridLines : [], void 0, getDatumId); + this.gridFillGroupSelection.update(this.gridLine.enabled ? gridFills : [], void 0, getDatumId); + this.tickLineGroupSelection.update(tickLines, void 0, getDatumId); + this.tickLabelGroupSelection.update(labels, void 0, getDatumId); + } + updateGridLines() { + this.gridLineGroupSelection.each((line, datum) => { + line.stroke = datum.stroke; + line.strokeWidth = datum.strokeWidth; + line.lineDash = datum.lineDash; + }); + } + updateGridFills() { + this.gridFillGroupSelection.each((rect2, datum) => { + rect2.fill = datum.fill; + rect2.fillOpacity = datum.fillOpacity ?? 1; + }); + } + updateTickLines() { + this.tickLineGroupSelection.each((line, datum) => { + line.stroke = datum.stroke; + line.strokeWidth = datum.strokeWidth; + line.lineDash = datum.lineDash; + }); + } + updateTitle(domain, spacing) { + const { caption } = this.title; + const titleProps = this.titleProps(caption, domain, spacing); + caption.node.visible = titleProps.visible; + caption.node.text = titleProps.text; + caption.node.textBaseline = titleProps.textBaseline; + caption.node.datum = titleProps; + } + updateLabels() { + if (!this.label.enabled) + return; + this.tickLabelGroupSelection.each((node, datum) => { + node.fill = datum.color; + node.text = datum.text; + node.textBaseline = datum.textBaseline; + node.textAlign = datum.textAlign ?? "center"; + node.pointerEvents = datum.textUntruncated == null ? 1 /* None */ : 0 /* All */; + node.setFont(datum); + node.setBoxing(datum); + }); + } + animateReadyUpdate(diff8) { + const { animationManager } = this.moduleCtx; + const selectionCtx = prepareAxisAnimationContext(this); + const fns = prepareAxisAnimationFunctions(selectionCtx); + fromToMotion( + this.id, + "axis-group", + animationManager, + [this.lineNodeGroup, this.tickLabelGroup, this.tickLineGroup, this.headingLabelGroup], + fns.group + ); + fromToMotion(this.id, "line", animationManager, [this.lineNode], fns.line); + fromToMotion( + this.id, + "line-paths", + animationManager, + [this.gridLineGroupSelection, this.tickLineGroupSelection], + fns.tick, + (_, d) => d.tickId, + diff8 + ); + fromToMotion( + this.id, + "tick-labels", + animationManager, + [this.tickLabelGroupSelection], + fns.label, + (_, d) => d.tickId, + diff8 + ); + fromToMotion( + this.id, + "title", + animationManager, + [this.title.caption.node], + fns.label, + (_, d) => d.tickId, + diff8 + ); + } + resetSelectionNodes() { + resetMotion( + [this.lineNodeGroup, this.tickLabelGroup, this.tickLineGroup, this.headingLabelGroup], + resetAxisGroupFn() + ); + resetMotion([this.gridLineGroupSelection, this.tickLineGroupSelection], resetAxisLineSelectionFn()); + resetMotion([this.gridFillGroupSelection], resetAxisFillSelectionFn()); + resetMotion([this.tickLabelGroupSelection], resetAxisLabelSelectionFn()); + resetMotion([this.title.caption.node], resetAxisLabelSelectionFn()); + resetMotion([this.lineNode], resetAxisLineSelectionFn()); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], _CartesianAxis.prototype, "thickness", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _CartesianAxis.prototype, "maxThicknessRatio", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _CartesianAxis.prototype, "position", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _CartesianAxis.prototype, "crossAt", 2); +var CartesianAxis = _CartesianAxis; + +// packages/ag-charts-community/src/chart/mapping/prepareAxis.ts +var CartesianAxisPositions = ["top", "right", "bottom", "left"]; +function isAxisPosition(position) { + return typeof position === "string" && CartesianAxisPositions.includes(position); +} +function guessInvalidPositions(axes) { + const invalidAxes = []; + const usedPositions = []; + const guesses = [...CartesianAxisPositions]; + for (const axis of axes) { + if (axis instanceof CartesianAxis) { + if (isAxisPosition(axis.position)) { + usedPositions.push(axis.position); + } else { + invalidAxes.push(axis); + } + } + } + for (const axis of invalidAxes) { + let nextGuess; + do { + nextGuess = guesses.pop(); + } while (nextGuess && usedPositions.includes(nextGuess)); + if (nextGuess == null) + break; + axis.position = nextGuess; + } +} + +// packages/ag-charts-community/src/chart/mapping/prepareSeries.ts +var MATCHING_KEYS = ["direction", "xKey", "yKey", "sizeKey", "angleKey", "radiusKey", "normalizedTo"]; +function matchSeriesOptions(series, optSeries, oldOptsSeries) { + const generateKey = (type, i, opts) => { + const result = [type]; + for (const key of MATCHING_KEYS) { + if (key in i && i[key] != null) + result.push(`${key}=${i[key]}`); + } + if (opts?.seriesGrouping) { + result.push(`seriesGrouping.groupId=${opts?.seriesGrouping.groupId}`); + } + return result.join(";"); + }; + const seriesMap = /* @__PURE__ */ new Map(); + let idx = 0; + for (const s of series) { + const key = generateKey(s.type, s.properties, oldOptsSeries?.[idx]); + if (!seriesMap.has(key)) { + seriesMap.set(key, []); + } + seriesMap.get(key)?.push([s, idx++]); + } + const optsMap = /* @__PURE__ */ new Map(); + idx = 0; + for (const o of optSeries) { + const key = generateKey(o.type, o, o); + if (!optsMap.has(key)) { + optsMap.set(key, []); + } + optsMap.get(key)?.push([o, idx++]); + } + const overlap = [...seriesMap.keys()].some((k) => optsMap.has(k)); + if (!overlap) { + return { status: "no-overlap", oldKeys: seriesMap.keys(), newKeys: optsMap.keys() }; + } + const changes = []; + for (const [key, optsTuples] of optsMap.entries()) { + for (const [opts, targetIdx] of optsTuples) { + const seriesArray = seriesMap.get(key); + if (seriesArray == null || seriesArray.length < 1) { + changes.push({ opts, targetIdx, idx: targetIdx, status: "add" }); + seriesMap.delete(key); + continue; + } + const [outputSeries, currentIdx] = seriesArray.shift(); + const previousOpts = oldOptsSeries?.[currentIdx] ?? {}; + const diff8 = jsonDiff(previousOpts, opts ?? {}); + const { groupIndex, stackIndex } = diff8?.seriesGrouping ?? {}; + if (groupIndex != null || stackIndex != null) { + changes.push({ + opts, + series: outputSeries, + diff: diff8, + targetIdx, + idx: currentIdx, + status: "series-grouping" + }); + } else if (diff8) { + changes.push({ + opts, + series: outputSeries, + diff: diff8, + targetIdx, + idx: currentIdx, + status: "update" + }); + } else { + changes.push({ opts, series: outputSeries, targetIdx, idx: currentIdx, status: "no-op" }); + } + if (seriesArray.length === 0) { + seriesMap.delete(key); + } + } + } + for (const seriesArray of seriesMap.values()) { + for (const [outputSeries, currentIdx] of seriesArray) { + changes.push({ series: outputSeries, idx: currentIdx, targetIdx: -1, status: "remove" }); + } + } + return { status: "overlap", changes }; +} + +// packages/ag-charts-community/src/chart/mapping/types.ts +function optionsType(input) { + const { series } = input; + return series?.[0]?.type ?? "line"; +} +function isAgCartesianChartOptions(input) { + const specifiedType = optionsType(input); + return chartTypes2.isCartesian(specifiedType) || isEnterpriseCartesian(specifiedType); +} +function isAgPolarChartOptions(input) { + const specifiedType = optionsType(input); + return chartTypes2.isPolar(specifiedType) || isEnterprisePolar(specifiedType); +} +function isAgTopologyChartOptions(input) { + const specifiedType = optionsType(input); + return chartTypes2.isTopology(specifiedType) || isEnterpriseTopology(specifiedType); +} +function isAgStandaloneChartOptions(input) { + const specifiedType = optionsType(input); + return chartTypes2.isStandalone(specifiedType) || isEnterpriseStandalone(specifiedType); +} + +// packages/ag-charts-community/src/chart/modulesManager.ts +var ModulesManager = class extends ModuleMap { + applyOptions(options) { + for (const m of this.moduleMap.values()) { + if (m.module.optionsKey in options && isProperties(m.moduleInstance)) { + m.moduleInstance.set(options[m.module.optionsKey]); + } + } + } + *legends() { + for (const { module: module2, moduleInstance } of this.moduleMap.values()) { + if (module2.type !== "legend") + continue; + yield { + legendType: module2.identifier, + legend: moduleInstance + }; + } + } +}; + +// packages/ag-charts-community/src/chart/overlay/overlay.ts +var DEFAULT_OVERLAY_CLASS = "ag-charts-overlay"; +var DEFAULT_OVERLAY_DARK_CLASS = "ag-charts-dark-overlay"; +var Overlay = class extends BaseProperties { + constructor(className, defaultMessageId) { + super(); + this.className = className; + this.defaultMessageId = defaultMessageId; + this.enabled = true; + } + getText(localeManager) { + if (isArray(this.text)) { + return this.text.map((s) => s.text).join(""); + } + return localeManager.t(this.text ?? this.defaultMessageId); + } + getElement(callers, animationManager, localeManager, rect2) { + this.content?.remove(); + this.focusBox = rect2; + if (this.renderer) { + const params = {}; + const htmlContent = callWithContext(callers, this.renderer, params); + if (htmlContent instanceof HTMLElement) { + this.content = htmlContent; + } else { + const tempDiv = createElement("div"); + tempDiv.innerHTML = htmlContent; + const { firstElementChild } = tempDiv; + if (firstElementChild instanceof HTMLElement && tempDiv.childElementCount === 1) { + this.content = firstElementChild; + } else { + this.content = tempDiv; + } + } + } else { + const content = createElement("div", { + display: "flex", + alignItems: "center", + justifyContent: "center", + boxSizing: "border-box", + height: "100%", + margin: "8px", + fontFamily: "var(--ag-charts-font-family)", + fontSize: "var(--ag-charts-font-size)", + fontWeight: "var(--ag-charts-font-weight)" + }); + if (isArray(this.text)) { + const container = createElement("div"); + for (const segment of this.text) { + const el = createElement("span", { + color: segment.color, + fontSize: `${segment.fontSize}px`, + fontFamily: segment.fontFamily ?? "inherit", + fontWeight: String(segment.fontWeight), + fontStyle: segment.fontStyle + }); + el.innerText = segment.text; + container.appendChild(el); + } + content.appendChild(container); + } else { + content.innerText = this.getText(localeManager); + } + this.content = content; + animationManager?.animate({ + from: 0, + to: 1, + id: "overlay", + phase: "add", + groupId: "opacity", + onUpdate(value) { + content.style.opacity = String(value); + }, + onStop() { + content.style.opacity = "1"; + } + }); + } + return this.content; + } + removeElement(cleanup = () => this.content?.remove(), animationManager) { + if (!this.content) + return; + if (animationManager) { + const { content } = this; + animationManager.animate({ + from: 1, + to: 0, + phase: "remove", + id: "overlay", + groupId: "opacity", + onUpdate(value) { + content.style.opacity = String(value); + }, + onStop() { + cleanup?.(); + } + }); + } else { + cleanup?.(); + } + this.content = void 0; + this.focusBox = void 0; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], Overlay.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Overlay.prototype, "text", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Overlay.prototype, "renderer", 2); + +// packages/ag-charts-community/src/chart/overlay/chartOverlays.ts +var ChartOverlays = class extends BaseProperties { + constructor() { + super(...arguments); + this.darkTheme = false; + this.loading = new Overlay("ag-charts-loading-overlay", "overlayLoadingData"); + this.noData = new Overlay("ag-charts-no-data-overlay", "overlayNoData"); + this.noVisibleSeries = new Overlay("ag-charts-no-visible-series", "overlayNoVisibleSeries"); + this.unsupportedBrowser = new Overlay("ag-charts-unsupported-browser", "overlayUnsupportedBrowser"); + } + getFocusInfo(localeManager) { + for (const overlay of [this.loading, this.noData, this.noVisibleSeries, this.unsupportedBrowser]) { + if (overlay.focusBox !== void 0) { + return { text: overlay.getText(localeManager), rect: overlay.focusBox }; + } + } + return void 0; + } + destroy() { + this.loading.removeElement(); + this.noData.removeElement(); + this.noVisibleSeries.removeElement(); + this.unsupportedBrowser.removeElement(); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], ChartOverlays.prototype, "darkTheme", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], ChartOverlays.prototype, "loading", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], ChartOverlays.prototype, "noData", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], ChartOverlays.prototype, "noVisibleSeries", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], ChartOverlays.prototype, "unsupportedBrowser", 2); + +// packages/ag-charts-community/src/chart/overlay/loadingSpinner.ts +function getLoadingSpinner(text2, defaultDuration) { + const { animationDuration } = PHASE_METADATA["add"]; + const duration = animationDuration * defaultDuration; + const container = createElement("div", `${DEFAULT_OVERLAY_CLASS}--loading`, { + display: "flex", + alignItems: "center", + justifyContent: "center", + flexDirection: "column", + height: "100%", + boxSizing: "border-box", + font: "13px Verdana, sans-serif", + // FONT_SIZE.MEDIUM + userSelect: "none", + animation: `ag-charts-loading ${duration}ms linear 50ms both` + }); + const matrix = createElement("span", { + width: "45px", + height: "40px", + backgroundImage: [ + "linear-gradient(#0000 calc(1 * 100% / 6), #ccc 0 calc(3 * 100% / 6), #0000 0), ", + "linear-gradient(#0000 calc(2 * 100% / 6), #ccc 0 calc(4 * 100% / 6), #0000 0), ", + "linear-gradient(#0000 calc(3 * 100% / 6), #ccc 0 calc(5 * 100% / 6), #0000 0)" + ].join(""), + backgroundSize: "10px 400%", + backgroundRepeat: "no-repeat", + animation: "ag-charts-loading-matrix 1s infinite linear" + }); + const label = createElement("p", { marginTop: "1em" }); + label.innerText = text2; + const background = createElement("div", `${DEFAULT_OVERLAY_CLASS}__loading-background`, { + position: "absolute", + inset: "0", + opacity: "0.5", + zIndex: "-1" + }); + const animationStyles = createElement("style"); + animationStyles.innerText = [ + "@keyframes ag-charts-loading { from { opacity: 0 } to { opacity: 1 } }", + "@keyframes ag-charts-loading-matrix {", + "0% { background-position: 0% 0%, 50% 0%, 100% 0%; }", + "100% { background-position: 0% 100%, 50% 100%, 100% 100%; }", + "}" + ].join(" "); + container.replaceChildren(animationStyles, matrix, label, background); + return container; +} + +// packages/ag-charts-community/src/chart/series/seriesZIndexMap.ts +var SeriesZIndexMap = /* @__PURE__ */ ((SeriesZIndexMap3) => { + SeriesZIndexMap3[SeriesZIndexMap3["BACKGROUND"] = 0] = "BACKGROUND"; + SeriesZIndexMap3[SeriesZIndexMap3["ANY_CONTENT"] = 1] = "ANY_CONTENT"; + return SeriesZIndexMap3; +})(SeriesZIndexMap || {}); +var SeriesContentZIndexMap = /* @__PURE__ */ ((SeriesContentZIndexMap2) => { + SeriesContentZIndexMap2[SeriesContentZIndexMap2["FOREGROUND"] = 0] = "FOREGROUND"; + SeriesContentZIndexMap2[SeriesContentZIndexMap2["HIGHLIGHT"] = 1] = "HIGHLIGHT"; + SeriesContentZIndexMap2[SeriesContentZIndexMap2["LABEL"] = 2] = "LABEL"; + return SeriesContentZIndexMap2; +})(SeriesContentZIndexMap || {}); + +// packages/ag-charts-community/src/chart/series/shapeUtil.ts +function getShapeFill(fill, defaultGradient, defaultPattern, defaultImage) { + if (isGradientFill(fill)) { + return { + type: "gradient", + gradient: fill.gradient ?? defaultGradient.gradient, + colorStops: fill.colorStops ?? defaultGradient.colorStops, + bounds: fill.bounds ?? defaultGradient.bounds, + rotation: fill.rotation ?? defaultGradient.rotation, + reverse: fill.reverse ?? defaultGradient.reverse, + colorSpace: fill.colorSpace ?? defaultGradient.colorSpace + }; + } + if (isPatternFill(fill)) { + const pattern = fill.pattern ?? defaultPattern.pattern; + let strokeWidth = fill.strokeWidth; + if (pattern === "backward-slanted-lines" || pattern === "forward-slanted-lines" || pattern === "horizontal-lines" || pattern === "vertical-lines") { + strokeWidth ?? (strokeWidth = defaultPattern.strokeWidth); + } else { + strokeWidth ?? (strokeWidth = 0); + } + const width2 = fill.width ?? fill.height ?? defaultPattern.width; + const height2 = fill.height ?? fill.width ?? defaultPattern.height; + return { + type: "pattern", + pattern, + width: width2, + height: height2, + path: fill.path, + padding: fill.padding ?? defaultPattern.padding, + fill: fill.fill ?? defaultPattern.fill, + fillOpacity: fill.fillOpacity ?? defaultPattern.fillOpacity, + backgroundFill: fill.backgroundFill ?? defaultPattern.backgroundFill, + backgroundFillOpacity: fill.backgroundFillOpacity ?? defaultPattern.backgroundFillOpacity, + stroke: fill.stroke ?? defaultPattern.stroke, + strokeOpacity: fill.strokeOpacity ?? defaultPattern.strokeOpacity, + strokeWidth, + rotation: fill.rotation ?? defaultPattern.rotation, + scale: fill.scale ?? defaultPattern.scale + }; + } + if (isImageFill(fill)) { + return { + type: "image", + url: fill.url, + width: fill.width, + height: fill.height, + backgroundFill: fill.backgroundFill ?? defaultImage.backgroundFill, + backgroundFillOpacity: fill.backgroundFillOpacity ?? defaultImage.backgroundFillOpacity, + rotation: fill.rotation ?? defaultImage.rotation, + repeat: fill.repeat ?? defaultImage.repeat, + fit: fill.fit ?? defaultImage.fit + }; + } + return fill; +} +function getShapeStyle(style2, defaultGradient, defaultPattern, defaultImage) { + if (!isGradientFill(style2?.fill) && !isPatternFill(style2?.fill) && !isImageFill(style2?.fill)) + return style2; + return { + ...style2, + fill: getShapeFill(style2.fill, defaultGradient, defaultPattern, defaultImage) + }; +} +function applyShapeFillBBox(shape, fill, fillBBox, fillParams) { + if (fillBBox == null || !isGradientFill(fill) || fill.bounds == null || fill.bounds === "item") { + shape.fillBBox = void 0; + } else { + shape.fillBBox = fillBBox[fill.bounds]; + } + shape.fillParams = fillParams; +} +function applyShapeStyle(shape, style2, fillBBox, fillParams) { + const opacity = style2?.opacity ?? 1; + shape.fill = style2?.fill; + applyShapeFillBBox(shape, shape.fill, fillBBox, fillParams); + shape.fillOpacity = (style2?.fillOpacity ?? 1) * opacity; + shape.stroke = style2?.stroke; + shape.strokeOpacity = (style2?.strokeOpacity ?? 1) * opacity; + shape.strokeWidth = style2?.strokeWidth ?? 0; + shape.lineDash = style2?.lineDash; + shape.lineDashOffset = style2?.lineDashOffset ?? 0; +} + +// packages/ag-charts-community/src/chart/series/series.ts +var SeriesNodePickMode = /* @__PURE__ */ ((SeriesNodePickMode17) => { + SeriesNodePickMode17[SeriesNodePickMode17["EXACT_SHAPE_MATCH"] = 0] = "EXACT_SHAPE_MATCH"; + SeriesNodePickMode17[SeriesNodePickMode17["NEAREST_NODE"] = 1] = "NEAREST_NODE"; + SeriesNodePickMode17[SeriesNodePickMode17["AXIS_ALIGNED"] = 2] = "AXIS_ALIGNED"; + return SeriesNodePickMode17; +})(SeriesNodePickMode || {}); +var CROSS_FILTER_MARKER_FILL_OPACITY_FACTOR = 0.25; +var CROSS_FILTER_MARKER_STROKE_OPACITY_FACTOR = 0.125; +var SeriesNodeEvent = class { + constructor(type, event, nodeDatum, series) { + this.type = type; + this.event = event; + this.defaultPrevented = false; + this.datum = nodeDatum.datum; + this.seriesId = series.id; + } + preventDefault() { + this.defaultPrevented = true; + } +}; +var SeriesGroupingChangedEvent = class { + constructor(series, seriesGrouping) { + this.series = series; + this.seriesGrouping = seriesGrouping; + this.type = "groupingChanged"; + } +}; +function propertyAxisDirection(property) { + switch (property) { + case "x": + return "x" /* X */; + case "y": + return "y" /* Y */; + case "angle": + return "angle" /* Angle */; + case "radius": + return "radius" /* Radius */; + } +} +function axisDirectionProperty(direction) { + switch (direction) { + case "x" /* X */: + return "x"; + case "y" /* Y */: + return "y"; + case "angle" /* Angle */: + return "angle"; + case "radius" /* Radius */: + return "radius"; + } +} +var Series = class extends Observable { + constructor(seriesOpts) { + super(); + this.cleanup = new CleanupRegistry(); + this.usesPlacedLabels = false; + this.hasChangesOnHighlight = false; + this.seriesGrouping = void 0; + this.NodeEvent = SeriesNodeEvent; + this.internalId = createId(this); + // The group node that contains the series rendering in its default (non-highlighted) state. + this.contentGroup = new TranslatableGroup({ + name: `${this.internalId}-content`, + zIndex: 1 /* ANY_CONTENT */ + }); + // The group node that contains all highlighted series items. This is a performance optimisation + // for large-scale data-sets, where the only thing that routinely varies is the currently + // highlighted node. + this.highlightGroup = new TranslatableGroup({ + name: `${this.internalId}-highlight`, + zIndex: 1 /* ANY_CONTENT */ + }); + // Error bars etc. + this.annotationGroup = new TranslatableGroup({ + name: `${this.internalId}-annotation` + }); + // Lazily initialised labelGroup for label presentation. + this.labelGroup = new TranslatableGroup({ + name: `${this.internalId}-series-labels` + }); + this.axes = {}; + this.directions = ["x" /* X */, "y" /* Y */]; + // Flag to determine if we should recalculate node data. + this.nodeDataRefresh = true; + this.processedDataUpdated = true; + this.moduleMap = new ModuleMap(); + this.datumCallbackCache = /* @__PURE__ */ new Map(); + this.connectsToYAxis = false; + this.declarationOrder = -1; + this._broughtToFront = false; + this.events = new EventEmitter(); + this._pickNodeCache = new LRUCache(5); + // Use a wrapper to comply with the @typescript-eslint/unbound-method rule. + this.fireEventWrapper = (event) => super.fireEvent(event); + const { + moduleCtx, + pickModes, + propertyKeys = {}, + propertyNames = {}, + canHaveAxes = false, + usesPlacedLabels = false + } = seriesOpts; + this.ctx = moduleCtx; + this.propertyKeys = propertyKeys; + this.propertyNames = propertyNames; + this.canHaveAxes = canHaveAxes; + this.usesPlacedLabels = usesPlacedLabels; + this.pickModes = pickModes; + this.cleanup.register(this.ctx?.eventsHub.on("highlight:change", (event) => this.onChangeHighlight(event))); + } + get pickModeAxis() { + return "main"; + } + get id() { + return this.properties?.id ?? this.internalId; + } + get type() { + return this.constructor.type ?? ""; + } + get focusable() { + return true; + } + get data() { + return this._data ?? this._chartData; + } + set visible(newVisibility) { + this.properties.visible = newVisibility; + this.ctx.legendManager.toggleItem(newVisibility, this.id); + this.ctx.legendManager.update(); + this.visibleMaybeChanged(); + } + get visible() { + return this.ctx.legendManager.getSeriesEnabled(this.id) ?? this.properties.visible; + } + get hasData() { + const dataSet = this.data; + if (dataSet == null) + return false; + return dataSet.netSize() > 0; + } + get tooltipEnabled() { + return this.properties.tooltip?.enabled; + } + onDataChange() { + this.nodeDataRefresh = true; + this.processedDataUpdated = true; + this._pickNodeCache.clear(); + } + setOptionsData(input) { + this._data = input; + this.onDataChange(); + } + setChartData(input) { + this._chartData = input; + if (this.data === input) { + this.onDataChange(); + } + } + onSeriesGroupingChange(prev, next) { + const { internalId, type, visible } = this; + if (prev) { + this.ctx.seriesStateManager.deregisterSeries(this); + } + if (next) { + this.ctx.seriesStateManager.registerSeries({ internalId, type, visible, seriesGrouping: next }); + } + this.fireEvent(new SeriesGroupingChangedEvent(this, next)); + } + getBandScalePadding() { + return { inner: 1, outer: 0 }; + } + attachSeries(seriesContentNode, seriesNode, annotationNode) { + seriesContentNode.appendChild(this.contentGroup); + seriesNode.appendChild(this.highlightGroup); + seriesNode.appendChild(this.labelGroup); + annotationNode?.appendChild(this.annotationGroup); + } + detachSeries(_seriesContentNode, _seriesNode, _annotationNode) { + this.contentGroup.remove(); + this.highlightGroup.remove(); + this.labelGroup.remove(); + this.annotationGroup.remove(); + } + setSeriesIndex(index, forceUpdate = false) { + const bringToFront = this.bringToFront(); + if (!forceUpdate && index === this.declarationOrder && bringToFront === this._broughtToFront) + return false; + this.declarationOrder = index; + this._broughtToFront = bringToFront; + this.setZIndex(bringToFront ? Number.MAX_VALUE : index); + this.fireEvent(new SeriesGroupingChangedEvent(this, this.seriesGrouping)); + return true; + } + setZIndex(zIndex) { + this.contentGroup.zIndex = [1 /* ANY_CONTENT */, zIndex, 0 /* FOREGROUND */]; + this.highlightGroup.zIndex = [1 /* ANY_CONTENT */, zIndex, 1 /* HIGHLIGHT */]; + this.labelGroup.zIndex = [1 /* ANY_CONTENT */, zIndex, 2 /* LABEL */]; + this.annotationGroup.zIndex = zIndex; + } + renderToOffscreenCanvas() { + return false; + } + addEventListener(type, listener) { + return super.addEventListener(type, listener); + } + removeEventListener(type, listener) { + return super.removeEventListener(type, listener); + } + hasEventListener(type) { + return super.hasEventListener(type); + } + addChartEventListeners() { + return; + } + updatedDomains() { + } + destroy() { + this.cleanup.flush(); + this.resetDatumCallbackCache(); + this.ctx.seriesStateManager.deregisterSeries(this); + } + getPropertyValues(property, properties) { + const direction = propertyAxisDirection(property); + const resolvedProperty = direction == null ? property : axisDirectionProperty(this.resolveKeyDirection(direction)); + const keys = properties?.[resolvedProperty]; + const values = []; + if (!keys) { + return values; + } + const addValues = (...items) => { + for (const value of items) { + if (Array.isArray(value)) { + addValues(...value); + } else if (typeof value === "object") { + addValues(...Object.values(value)); + } else { + values.push(value); + } + } + }; + addValues(...keys.map((key) => this.properties[key])); + return values; + } + getKeys(direction) { + return this.getPropertyValues(axisDirectionProperty(direction), this.propertyKeys); + } + getKeyProperties(direction) { + return this.propertyKeys[this.resolveKeyDirection(direction)] ?? []; + } + getNames(direction) { + return this.getPropertyValues(axisDirectionProperty(direction), this.propertyNames); + } + getFormatterContext(property) { + const { id: seriesId } = this; + const keys = this.getPropertyValues(property, this.propertyKeys); + const names = this.getPropertyValues(property, this.propertyNames); + const out = []; + for (let idx = 0; idx < keys.length; idx++) { + out.push({ seriesId, key: keys[idx], name: names[idx] }); + } + return out; + } + resolveKeyDirection(direction) { + return direction; + } + // The union of the series domain ('community') and series-option domains ('enterprise'). + getDomain(direction) { + const seriesDomain = this.getSeriesDomain(direction); + const moduleDomains = this.moduleMap.mapModules((module2) => module2.getDomain(direction)).flat(); + return moduleDomains.length === 0 ? seriesDomain : seriesDomain.concat(moduleDomains); + } + getRange(direction, visibleRange) { + return this.getSeriesRange(direction, visibleRange); + } + getZoomRangeFittingItems(_xVisibleRange, _yVisibleRange, _minVisibleItems) { + return void 0; + } + getVisibleItems(_xVisibleRange, _yVisibleRange, _minVisibleItems) { + return Infinity; + } + // Indicate that something external changed and we should recalculate nodeData. + markNodeDataDirty() { + this.nodeDataRefresh = true; + this._pickNodeCache.clear(); + this.visibleMaybeChanged(); + } + visibleMaybeChanged() { + this.ctx.seriesStateManager.updateSeries(this); + } + getOpacity() { + const defaultOpacity = 1; + if (!this.properties.highlight) { + return defaultOpacity; + } + const { opacity = defaultOpacity } = this.getHighlightStyle(); + return opacity; + } + getHighlightState(highlightedDatum, isHighlight, datumIndex, legendItemValues) { + if (isHighlight) { + return 1 /* Item */; + } + if (highlightedDatum?.series == null) { + return 0 /* None */; + } + if (this.isSeriesHighlighted(highlightedDatum, legendItemValues)) { + const itemHighlighted = this.isItemHighlighted(highlightedDatum, datumIndex); + if (itemHighlighted == null) { + return 2 /* Series */; + } + if (itemHighlighted) { + return 2 /* Series */; + } + return 4 /* OtherItem */; + } + return 3 /* OtherSeries */; + } + getHighlightStateString(datum, isHighlight, datumIndex, legendItemValues) { + return toHighlightString(this.getHighlightState(datum, isHighlight, datumIndex, legendItemValues)); + } + onChangeHighlight(event) { + const previousHighlightedDatum = event.previousHighlight; + const currentHighlightedDatum = event.currentHighlight; + const currentHighlightState = this.getHighlightState(currentHighlightedDatum); + const previousHighlightState = this.getHighlightState(previousHighlightedDatum); + this.setSeriesIndex(this.declarationOrder); + const hasItemStylers = this.hasItemStylers(); + if (!hasItemStylers && currentHighlightState === previousHighlightState) { + this.hasChangesOnHighlight = false; + return; + } + const { highlightedSeries, unhighlightedItem, unhighlightedSeries } = this.properties.highlight; + this.hasChangesOnHighlight = hasItemStylers || !isEmptyObject(highlightedSeries) || !isEmptyObject(unhighlightedItem) || !isEmptyObject(unhighlightedSeries); + } + bringToFront() { + return this.properties.highlight.bringToFront && this.isSeriesHighlighted(this.ctx.highlightManager.getActiveHighlight()); + } + isSeriesHighlighted(highlightedDatum, _legendItemValues) { + return highlightedDatum?.series === this; + } + isItemHighlighted(highlightedDatum, datumIndex) { + if (highlightedDatum?.datumIndex == null || datumIndex == null) + return; + return highlightedDatum.datumIndex === datumIndex; + } + getHighlightStyle(isHighlight, datumIndex, highlightState, legendItemValues) { + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + highlightState ?? (highlightState = this.getHighlightState(highlightedDatum, isHighlight, datumIndex, legendItemValues)); + return this.properties.highlight.getStyle(highlightState); + } + filterItemStylerFillParams(fill) { + if (isGradientFill(fill)) { + return without(fill, ["bounds", "colorSpace", "gradient", "reverse"]); + } else if (isPatternFill(fill)) { + return without(fill, ["padding"]); + } + return fill; + } + getModuleTooltipParams() { + return this.moduleMap.mapModules((module2) => module2.getTooltipParams()).reduce((total, current) => Object.assign(total, current), {}); + } + pickNodes(point, intent, exactMatchOnly = false) { + const { pickModes, pickModeAxis, visible, contentGroup } = this; + if (!visible || !contentGroup.visible) + return; + if (intent === "highlight" && !this.properties.highlight.enabled) + return; + if (intent === "highlight-tooltip" && !this.properties.highlight.enabled) + return; + let maxDistance = Infinity; + if (intent === "tooltip" || intent === "highlight-tooltip") { + const { tooltip } = this.properties; + maxDistance = typeof tooltip.range === "number" ? tooltip.range : Infinity; + exactMatchOnly || (exactMatchOnly = tooltip.range === "exact"); + } else if (intent === "event" || intent === "context-menu") { + const { nodeClickRange } = this.properties; + maxDistance = typeof nodeClickRange === "number" ? nodeClickRange : Infinity; + exactMatchOnly || (exactMatchOnly = nodeClickRange === "exact"); + } + const selectedPickModes = pickModes.filter( + (m) => !exactMatchOnly || m === 0 /* EXACT_SHAPE_MATCH */ + ); + const { x, y } = point; + const key = JSON.stringify({ x, y, maxDistance, selectedPickModes }); + if (this._pickNodeCache.has(key)) { + return this._pickNodeCache.get(key); + } + for (const pickMode of selectedPickModes) { + let result; + switch (pickMode) { + case 0 /* EXACT_SHAPE_MATCH */: { + const exact = this.pickNodesExactShape(point); + result = exact.length === 0 ? void 0 : { datums: exact, distance: 0 }; + break; + } + case 1 /* NEAREST_NODE */: { + const closest = this.pickNodeClosestDatum(point); + const exact = closest?.distance === 0 ? this.pickNodesExactShape(point) : void 0; + if (exact != null && exact.length !== 0) { + result = { datums: exact, distance: 0 }; + } else if (closest) { + result = { datums: [closest.datum], distance: closest.distance }; + } else { + result = void 0; + } + break; + } + case 2 /* AXIS_ALIGNED */: { + const closest = pickModeAxis == null ? void 0 : this.pickNodeMainAxisFirst(point, pickModeAxis === "main-category"); + result = closest == null ? void 0 : { datums: [closest.datum], distance: closest.distance }; + break; + } + } + if (result && result.distance <= maxDistance) { + return this._pickNodeCache.set(key, { pickMode, datums: result.datums, distance: result.distance }); + } + } + return this._pickNodeCache.set(key, void 0); + } + pickNodesExactShape(point) { + const datums = []; + for (const node of this.contentGroup.pickNodes(point.x, point.y)) { + const datum = node.closestDatum(); + if (datum != null && datum.missing !== true) { + datums.push(datum); + } + } + return datums; + } + pickNodeClosestDatum(_point) { + throw new Error("AG Charts - Series.pickNodeClosestDatum() not implemented"); + } + pickNodeNearestDistantObject(point, items) { + const match = nearestSquared(point.x, point.y, items); + const datum = match.nearest?.closestDatum(); + if (datum != null && datum.missing !== true) { + return { datum, distance: Math.sqrt(match.distanceSquared) }; + } + } + pickNodeMainAxisFirst(_point, _requireCategoryAxis) { + throw new Error("AG Charts - Series.pickNodeMainAxisFirst() not implemented"); + } + getLabelData() { + return []; + } + updatePlacedLabelData(_labels) { + return; + } + fireEvent(event) { + callWithContext([this.properties, this.ctx.chartService], this.fireEventWrapper, event); + } + fireNodeClickEvent(event, datum) { + const clickEvent = new this.NodeEvent("seriesNodeClick", event, datum, this); + this.fireEvent(clickEvent); + return !clickEvent.defaultPrevented; + } + fireNodeDoubleClickEvent(event, datum) { + const clickEvent = new this.NodeEvent("seriesNodeDoubleClick", event, datum, this); + this.fireEvent(clickEvent); + return !clickEvent.defaultPrevented; + } + createNodeContextMenuActionEvent(event, datum) { + return new this.NodeEvent("nodeContextMenuAction", event, datum, this); + } + onLegendInitialState(legendType, initialState) { + const { visible = true, itemId, legendItemName } = initialState ?? {}; + this.toggleSeriesItem(visible, legendType, itemId, legendItemName); + } + onLegendItemClick(event) { + const { enabled, itemId, series, legendType } = event; + const legendItemName = "legendItemName" in this.properties ? this.properties.legendItemName : void 0; + const legendItemKey = "legendItemKey" in this.properties ? this.properties.legendItemKey : void 0; + const matchedLegendItemName = legendItemName != void 0 && legendItemName === event.legendItemName; + if (series.id === this.id || matchedLegendItemName || legendItemKey != void 0) { + this.toggleSeriesItem(enabled, legendType, itemId, legendItemName, event); + } + } + onLegendItemDoubleClick(event) { + const { enabled, itemId, series, numVisibleItems, legendType } = event; + const legendItemName = "legendItemName" in this.properties ? this.properties.legendItemName : void 0; + const legendItemKey = "legendItemKey" in this.properties ? this.properties.legendItemKey : void 0; + const matchedLegendItemName = legendItemName != void 0 && legendItemName === event.legendItemName; + if (series.id === this.id || matchedLegendItemName || legendItemKey != void 0) { + this.toggleSeriesItem(true, legendType, itemId, legendItemName, event); + } else if (enabled && numVisibleItems === 1) { + this.toggleSeriesItem(true, legendType, void 0, legendItemName); + } else { + this.toggleSeriesItem(false, legendType, void 0, legendItemName); + } + } + toggleSeriesItem(enabled, legendType, itemId, legendItemName, legendEvent) { + const seriesId = this.id; + if (enabled || legendType !== "category") { + this.visible = enabled; + } + this.nodeDataRefresh = true; + this._pickNodeCache.clear(); + const event = { + type: "seriesVisibilityChange", + seriesId, + itemId, + legendItemName: legendEvent?.legendItemName ?? legendItemName, + visible: enabled + }; + this.fireEvent(event); + this.ctx.legendManager.toggleItem(enabled, seriesId, itemId, legendItemName); + } + isEnabled() { + return this.visible; + } + getModuleMap() { + return this.moduleMap; + } + createModuleContext() { + return { ...this.ctx, series: this }; + } + getAxisValueText(axis, source, value, datum, key, legendItemName) { + const { id: seriesId, properties } = this; + return axis.formatDatum(properties, value, source, seriesId, legendItemName, datum, key); + } + getLabelText(value, datum, key, property, domain, label, baseParams) { + if (value == null) + return ""; + const { axes, canHaveAxes, ctx, id: seriesId, properties } = this; + const source = "series-label"; + const legendItemName = "legendItemName" in properties ? properties.legendItemName : void 0; + const params = { + seriesId: this.id, + ...baseParams + }; + const direction = canHaveAxes ? propertyAxisDirection(property) : void 0; + const axis = direction == null ? void 0 : axes[this.resolveKeyDirection(direction)]; + if (axis != null) { + return axis.formatDatum( + properties, + value, + source, + seriesId, + legendItemName, + datum, + key, + domain, + label, + params + ); + } + const { formatManager } = ctx; + const formatInContext = this.callWithContext.bind(this); + const format = (formatParams) => label.formatValue(formatInContext, formatParams.type, formatParams.value, params) ?? formatManager.format(formatInContext, formatParams) ?? String(value); + const boundSeries = this.getFormatterContext(property); + switch (property) { + case "y": + case "color": + case "size": { + const fractionDigits = void 0; + return format({ + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }); + } + case "x": + case "radius": + case "angle": + case "label": + case "secondaryLabel": + case "calloutLabel": + case "sectorLabel": + case "legendItem": + return format({ + type: "category", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries + }); + } + } + getMarkerStyle(marker, { datumIndex, datum, point }, params, opts, defaultOverrideStyle = { size: point?.size ?? marker.size ?? 0 }, inheritedStyle) { + const { itemStyler } = marker; + const { + highlightState, + isHighlight = false, + checkForHighlight = true, + resolveMarkerSubPath = ["marker"], + resolveStyler = false + } = opts ?? {}; + const resolvePath2 = ["series", `${this.declarationOrder}`, ...resolveMarkerSubPath]; + if (resolveStyler) { + const resolveOpt = { permissivePath: true }; + const resolved = this.ctx.optionsGraphService.resolvePartial(resolvePath2, defaultOverrideStyle, resolveOpt); + if (resolved) { + defaultOverrideStyle = { ...resolved, size: resolved.size ?? defaultOverrideStyle.size }; + } + } + const highlightStyle = checkForHighlight ? this.getHighlightStyle(isHighlight, datumIndex, highlightState) : void 0; + const baseStyle = mergeDefaults(highlightStyle, defaultOverrideStyle, marker.getStyle(), inheritedStyle); + let markerStyle = baseStyle; + if (itemStyler && params) { + const highlight5 = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(highlight5, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(markerStyle.fill); + const style2 = this.cachedCallWithContext(itemStyler, { + seriesId: this.id, + ...markerStyle, + fill, + ...params, + highlighted: isHighlight, + highlightState: highlightStateString, + datum + }); + const resolved = this.ctx.optionsGraphService.resolvePartial(resolvePath2, style2); + markerStyle = mergeDefaults(resolved, markerStyle); + } + return markerStyle; + } + applyMarkerStyle(style2, markerNode, point, fillBBox, { applyTranslation = true, selected = true } = {}) { + const { shape, size = 0 } = style2; + const visible = this.visible && size > 0 && point && !Number.isNaN(point.x) && !Number.isNaN(point.y); + applyShapeStyle(markerNode, style2, fillBBox); + if (applyTranslation) { + markerNode.setProperties({ + visible, + shape, + size, + x: point?.x, + y: point?.y, + scalingCenterX: point?.x, + scalingCenterY: point?.y + }); + } else { + markerNode.setProperties({ visible, shape, size }); + } + if (!selected) { + markerNode.fillOpacity *= CROSS_FILTER_MARKER_FILL_OPACITY_FACTOR; + markerNode.strokeOpacity *= CROSS_FILTER_MARKER_STROKE_OPACITY_FACTOR; + } + if (typeof shape === "function" && !markerNode.dirtyPath) { + markerNode.path.clear(true); + markerNode.updatePath(); + markerNode.checkPathDirty(); + const bb = markerNode.getBBox(); + if (point != null && bb.isFinite()) { + const center2 = bb.computeCenter(); + const [dx2, dy2] = ["x", "y"].map( + (key) => (style2.strokeWidth ?? 0) + Math.abs(center2[key] - point[key]) + ); + point.focusSize = Math.max(bb.width + dx2, bb.height + dy2); + } + } + } + get nodeDataDependencies() { + return this._nodeDataDependencies ?? { seriesRectWidth: Number.NaN, seriesRectHeight: Number.NaN }; + } + checkResize(newSeriesRect) { + const { width: seriesRectWidth, height: seriesRectHeight } = newSeriesRect ?? { + width: Number.NaN, + height: Number.NaN + }; + const newNodeDataDependencies = newSeriesRect ? { seriesRectWidth, seriesRectHeight } : void 0; + const resize = jsonDiff(this.nodeDataDependencies, newNodeDataDependencies) != null; + if (resize) { + this._nodeDataDependencies = newNodeDataDependencies; + this.markNodeDataDirty(); + } + return resize; + } + pickFocus(_opts) { + return void 0; + } + resetDatumCallbackCache() { + this.datumCallbackCache.clear(); + } + cachedDatumCallback(id, fn) { + const { datumCallbackCache } = this; + const existing = datumCallbackCache.get(id); + if (existing != null) + return existing; + try { + const value = fn(); + datumCallbackCache.set(id, value); + return value; + } catch (error2) { + logger_exports.error(String(error2)); + } + } + cachedCallWithContext(fn, params) { + return this.ctx.callbackCache.call([this.properties, this.ctx.chartService], fn, params); + } + callWithContext(fn, params) { + return callWithContext([this.properties, this.ctx.chartService], fn, params); + } + formatTooltipWithContext(tooltip, content, params) { + return tooltip.formatTooltip([this.properties, this.ctx.chartService], content, params); + } + // @todo(AG-13777) - Remove this function (see CartesianSeries.ts) + minTimeInterval() { + return; + } +}; +__decorateClass([ + ActionOnSet({ + changeValue: function(newVal, oldVal) { + this.onSeriesGroupingChange(oldVal, newVal); + } + }) +], Series.prototype, "seriesGrouping", 2); + +// packages/ag-charts-community/src/dom/focusIndicator.ts +var FocusIndicator = class { + constructor(swapChain) { + this.swapChain = swapChain; + this.hasBeenActivated = false; + this.div = createElement("div"); + this.svg = createSvgElement("svg"); + this.outerPath = createSvgElement("path"); + this.innerPath = createSvgElement("path"); + this.svg.append(this.outerPath); + this.svg.append(this.innerPath); + this.outerPath.classList.add("ag-charts-focus-svg-outer-path"); + this.innerPath.classList.add("ag-charts-focus-svg-inner-path"); + this.element = createElement("div", "ag-charts-focus-indicator"); + this.element.ariaHidden = "true"; + this.element.append(this.svg); + this.swapChain.addListener("swap", (parent) => this.onSwap(parent)); + } + clear() { + } + update(focus, rect2, clip) { + if (rect2 == null) + return; + if (focus instanceof Path) { + const transform = (localX, localY) => { + let { x, y } = Transformable.toCanvasPoint(focus, localX, localY); + x -= rect2.x ?? 0; + y -= rect2.y ?? 0; + return { x, y }; + }; + const d = focus.svgPathData(transform); + this.outerPath.setAttribute("d", d); + this.innerPath.setAttribute("d", d); + this.show(this.svg); + } else { + let bbox; + if (clip) { + const x0 = Math.max(focus.x - rect2.x, 0); + const y0 = Math.max(focus.y - rect2.y, 0); + const x1 = Math.min(focus.x + focus.width - rect2.x, rect2.width); + const y1 = Math.min(focus.y + focus.height - rect2.y, rect2.height); + bbox = new BBox(x0, y0, x1 - x0, y1 - y0); + } else { + bbox = new BBox(focus.x - rect2.x, focus.y - rect2.y, focus.width, focus.height); + } + setElementBBox(this.div, bbox); + this.show(this.div); + } + } + onSwap(newParent) { + if (newParent === this.element.parentElement) + return; + this.element.remove(); + newParent.appendChild(this.element); + this.overrideFocusVisible(this.focusVisible); + } + show(child) { + this.hasBeenActivated = true; + this.element.innerHTML = ""; + this.element.append(child); + } + overrideFocusVisible(focusVisible) { + this.focusVisible = focusVisible; + const opacity = { true: "1", false: "0", undefined: "" }; + const parent = this.element.parentElement; + parent?.style.setProperty("opacity", opacity[`${focusVisible}`]); + } + // Get the `:focus-visible` CSS state. + isFocusVisible(force = false) { + if (!force && !this.hasBeenActivated) + return false; + const parent = this.element.parentElement; + return parent != null && getWindow().getComputedStyle(parent).opacity === "1"; + } +}; + +// packages/ag-charts-community/src/dom/focusSwapChain.ts +var FocusSwapChain = class { + constructor(label1, label2, announcerRole, initialAltText) { + this.label1 = label1; + this.label2 = label2; + this.hasFocus = false; + this.skipDispatch = false; + this.listeners = { + blur: [], + focus: [], + swap: [] + }; + this.onBlur = (e) => { + setElementStyle(e.target, "pointer-events", void 0); + return !this.skipDispatch && this.dispatch("blur", e); + }; + this.onFocus = (e) => { + setElementStyle(e.target, "pointer-events", "auto"); + return !this.skipDispatch && this.dispatch("focus", e); + }; + setAttribute(this.label1, "id", createElementId()); + setAttribute(this.label2, "id", createElementId()); + setElementStyle(this.label1, "display", "none"); + setElementStyle(this.label2, "display", "none"); + this.label1.textContent = initialAltText; + this.label2.textContent = initialAltText; + this.activeAnnouncer = this.createAnnouncer(announcerRole); + this.inactiveAnnouncer = this.createAnnouncer(announcerRole); + setAttribute(this.activeAnnouncer, "tabindex", 0); + this.label2.insertAdjacentElement("afterend", this.activeAnnouncer); + this.label2.insertAdjacentElement("afterend", this.inactiveAnnouncer); + this.swap(initialAltText); + } + createAnnouncer(role) { + const announcer = createElement("div"); + announcer.role = role; + announcer.className = "ag-charts-swapchain"; + announcer.addEventListener("blur", this.onBlur); + announcer.addEventListener("focus", this.onFocus); + return announcer; + } + destroy() { + for (const announcer of [this.activeAnnouncer, this.inactiveAnnouncer]) { + announcer.removeEventListener("blur", this.onBlur); + announcer.removeEventListener("focus", this.onFocus); + announcer.remove(); + } + } + focus(opts) { + this.focusOptions = opts; + this.activeAnnouncer.focus(opts); + this.focusOptions = void 0; + } + update(newLabel) { + this.skipDispatch = true; + this.swap(newLabel); + if (this.hasFocus) { + this.activeAnnouncer.focus(this.focusOptions); + } + this.skipDispatch = false; + } + addListener(type, handler) { + this.listeners[type].push(handler); + if (type === "swap") { + const swapHandler = handler; + swapHandler(this.activeAnnouncer); + } + } + dispatch(type, param) { + if (type === "focus") + this.hasFocus = true; + else if (type === "blur") + this.hasFocus = false; + for (const fn of this.listeners[type]) { + fn(param); + } + } + swap(newLabel) { + const userTabIndex = this.activeAnnouncer.tabIndex; + this.label2.textContent = newLabel; + [this.inactiveAnnouncer, this.activeAnnouncer] = [this.activeAnnouncer, this.inactiveAnnouncer]; + [this.label1, this.label2] = [this.label2, this.label1]; + setAttributes(this.inactiveAnnouncer, { + "aria-labelledby": this.label1.id, + "aria-hidden": true, + tabindex: void 0 + }); + setAttributes(this.activeAnnouncer, { + "aria-labelledby": this.label1.id, + "aria-hidden": false, + tabindex: userTabIndex + }); + this.dispatch("swap", this.activeAnnouncer); + } +}; + +// packages/ag-charts-community/src/chart/interaction/keyBindings.ts +var KEY_BINDINGS = { + arrowdown: { bindings: [{ code: "ArrowDown" }] }, + arrowleft: { bindings: [{ code: "ArrowLeft" }] }, + arrowright: { bindings: [{ code: "ArrowRight" }] }, + arrowup: { bindings: [{ code: "ArrowUp" }] }, + delete: { bindings: [{ key: "Backspace" }, { key: "Delete" }], activatesFocusIndicator: false }, + redo: { + bindings: [ + { key: "y", ctrlOrMeta: true }, + { key: "z", ctrlOrMeta: true, shift: true } + ], + activatesFocusIndicator: false + }, + undo: { bindings: [{ key: "z", ctrlOrMeta: true }], activatesFocusIndicator: false }, + submit: { bindings: [{ key: "Enter" }, { code: "Enter" }, { code: "Space" }] }, + zoomin: { bindings: [{ key: "+" }, { code: "ZoomIn" }, { code: "Add" }], activatesFocusIndicator: false }, + zoomout: { bindings: [{ key: "-" }, { code: "ZoomOut" }, { code: "Substract" }], activatesFocusIndicator: false } +}; +function matchesKeyBinding(e, bindings) { + for (const kb of bindings) { + if ("code" in kb) { + if (kb.code === e.code) + return true; + } else { + const matches = kb.key === e.key && (kb.shift === void 0 || kb.shift === e.shiftKey) && (kb.ctrlOrMeta === void 0 || kb.ctrlOrMeta === e.ctrlKey || kb.ctrlOrMeta === e.metaKey); + if (matches) + return true; + } + } + return false; +} +function mapKeyboardEventToAction(event) { + for (const [actionName, { activatesFocusIndicator = true, bindings }] of entries(KEY_BINDINGS)) { + if (matchesKeyBinding(event, bindings)) { + return { name: actionName, activatesFocusIndicator }; + } + } + return void 0; +} + +// packages/ag-charts-community/src/chart/keyboardUtil.ts +function computeCenter(series, hoverRect, pick2) { + const refPoint = getDatumRefPoint(series, pick2.datum, pick2.movedBounds); + if (refPoint != null) + return { x: refPoint.canvasX, y: refPoint.canvasY }; + const bboxOrPath = pick2.bounds; + if (bboxOrPath == null) + return; + if (bboxOrPath instanceof BBox) { + const { x: centerX, y: centerY } = bboxOrPath.computeCenter(); + return { + x: hoverRect.x + centerX, + y: hoverRect.y + centerY + }; + } + return Transformable.toCanvas(bboxOrPath).computeCenter(); +} +function getPickedFocusBBox({ bounds }) { + if (bounds instanceof BBox) + return bounds; + if (bounds != null) + return Transformable.toCanvas(bounds); + return BBox.NaN; +} +function makeKeyboardPointerEvent(series, hoverRect, pick2) { + const { x: canvasX, y: canvasY } = computeCenter(series, hoverRect, pick2) ?? {}; + if (canvasX !== void 0 && canvasY !== void 0) { + return { type: "keyboard", canvasX, canvasY }; + } + return void 0; +} + +// packages/ag-charts-community/src/util/placement.ts +function calculatePlacement(naturalWidth, naturalHeight, container, bounds) { + let { top, right, bottom, left, width: width2, height: height2 } = bounds; + if (left != null) { + if (width2 != null) { + right = container.width - left + width2; + } else if (right != null) { + width2 = container.width - left - right; + } + } else if (right != null && width2 != null) { + left = container.width - right - width2; + } + if (top != null) { + if (height2 != null) { + bottom = container.height - top - height2; + } else if (bottom != null) { + height2 = container.height - bottom - top; + } + } else if (bottom != null && height2 != null) { + top = container.height - bottom - height2; + } + if (width2 == null) { + if (height2 == null) { + height2 = naturalHeight; + width2 = naturalWidth; + } else { + width2 = Math.ceil(naturalWidth * height2 / naturalHeight); + } + } else { + height2 ?? (height2 = Math.ceil(naturalHeight * width2 / naturalWidth)); + } + if (left == null) { + if (right == null) { + left = Math.floor((container.width - width2) / 2); + } else { + left = container.width - right - width2; + } + } + if (top == null) { + if (bottom == null) { + top = Math.floor((container.height - height2) / 2); + } else { + top = container.height - height2 - bottom; + } + } + return { x: left, y: top, width: width2, height: height2 }; +} + +// packages/ag-charts-community/src/chart/tooltip/springAnimation.ts +var M = 0.1; +var K = 200; +var C = 12; +var DELTA = 0.5; +var SpringAnimation = class { + constructor() { + this.events = new EventEmitter(); + this.x1 = Number.NaN; + this.y1 = Number.NaN; + this.x = Number.NaN; + this.y = Number.NaN; + this.vx = 0; + this.vy = 0; + this.t0 = Number.NaN; + this.animationFrameHandle = void 0; + } + reset() { + this.x = Number.NaN; + this.y = Number.NaN; + if (this.animationFrameHandle != null) { + cancelAnimationFrame(this.animationFrameHandle); + this.animationFrameHandle = void 0; + } + } + update(x, y) { + if (Number.isNaN(this.x) || Number.isNaN(this.y)) { + this.x = x; + this.y = y; + this.vx = 0; + this.vy = 0; + this.emitUpdate(); + if (this.animationFrameHandle != null) { + cancelAnimationFrame(this.animationFrameHandle); + this.animationFrameHandle = void 0; + } + return; + } + this.x1 = x; + this.y1 = y; + this.t0 = Date.now(); + this.animationFrameHandle ?? (this.animationFrameHandle = requestAnimationFrame(this.onFrame.bind(this))); + } + onFrame() { + this.animationFrameHandle = void 0; + const { x1, y1, t0 } = this; + const t1 = Date.now(); + const dt = t1 - t0; + this.t0 = t1; + const stepT = 1e-3; + const iterations = Math.trunc(Math.ceil(dt / (stepT * 1e3))); + let { x, y, vx, vy } = this; + for (let i = 0; i < iterations; i += 1) { + const dx2 = x - x1; + const dy2 = y - y1; + const ax = -(K * dx2 + C * vx) / M; + const ay = -(K * dy2 + C * vy) / M; + vx += ax * stepT; + vy += ay * stepT; + x += vx * stepT; + y += vy * stepT; + } + if (Math.hypot(x - x1, y - y1) < DELTA) { + this.x = this.x1; + this.y = this.y1; + this.vx = 0; + this.vy = 0; + } else { + this.x = x; + this.y = y; + this.vx = vx; + this.vy = vy; + this.animationFrameHandle = requestAnimationFrame(this.onFrame.bind(this)); + } + this.emitUpdate(); + } + emitUpdate() { + this.events.emit("update", { x: this.x, y: this.y }); + } +}; + +// packages/ag-charts-community/src/util/sanitize.ts +var element = null; +function sanitizeHtml(text2) { + if (text2 === "") + return ""; + element ?? (element = createElement("div")); + element.textContent = toPlainText(text2); + return element.innerHTML.replaceAll("\n", "
"); +} + +// packages/ag-charts-community/src/chart/marker/shapes.ts +function drawMarkerUnitPolygon(params, moves) { + const { path, size } = params; + const { x: x0, y: y0 } = params; + path.clear(); + let didMove = false; + for (const [dx2, dy2] of moves) { + const x = x0 + (dx2 - 0.5) * size; + const y = y0 + (dy2 - 0.5) * size; + if (didMove) { + path.lineTo(x, y); + } else { + path.moveTo(x, y); + } + didMove = true; + } + path.closePath(); +} +var MARKER_SHAPES = { + circle({ path, x, y, size }) { + const r = size / 2; + path.arc(x, y, r, 0, Math.PI * 2); + path.closePath(); + }, + cross(params) { + drawMarkerUnitPolygon(params, [ + [0.25, 0], + [0.5, 0.25], + [0.75, 0], + [1, 0.25], + [0.75, 0.5], + [1, 0.75], + [0.75, 1], + [0.5, 0.75], + [0.25, 1], + [0, 0.75], + [0.25, 0.5], + [0, 0.25] + ]); + }, + diamond(params) { + drawMarkerUnitPolygon(params, [ + [0.5, 0], + [1, 0.5], + [0.5, 1], + [0, 0.5] + ]); + }, + heart({ path, x, y, size }) { + const r = size / 4; + y = y + r / 2; + path.arc(x - r, y - r, r, toRadians(130), toRadians(330)); + path.arc(x + r, y - r, r, toRadians(220), toRadians(50)); + path.lineTo(x, y + r); + path.closePath(); + }, + pin({ path, x, y, size: s }) { + const cx = 0.5; + const cy = 0.5; + path.moveTo(x + (0.15625 - cx) * s, y + (0.34375 - cy) * s); + path.cubicCurveTo( + x + (0.15625 - cx) * s, + y + (0.151491 - cy) * s, + x + (0.307741 - cx) * s, + y + (0 - cy) * s, + x + (0.5 - cx) * s, + y + (0 - cy) * s + ); + path.cubicCurveTo( + x + (0.692259 - cx) * s, + y + (0 - cy) * s, + x + (0.84375 - cx) * s, + y + (0.151491 - cy) * s, + x + (0.84375 - cx) * s, + y + (0.34375 - cy) * s + ); + path.cubicCurveTo( + x + (0.84375 - cx) * s, + y + (0.493824 - cy) * s, + x + (0.784625 - cx) * s, + y + (0.600181 - cy) * s, + x + (0.716461 - cx) * s, + y + (0.695393 - cy) * s + ); + path.cubicCurveTo( + x + (0.699009 - cx) * s, + y + (0.719769 - cy) * s, + x + (0.681271 - cx) * s, + y + (0.743104 - cy) * s, + x + (0.663785 - cx) * s, + y + (0.766105 - cy) * s + ); + path.cubicCurveTo( + x + (0.611893 - cx) * s, + y + (0.834367 - cy) * s, + x + (0.562228 - cx) * s, + y + (0.899699 - cy) * s, + x + (0.528896 - cx) * s, + y + (0.980648 - cy) * s + ); + path.cubicCurveTo( + x + (0.524075 - cx) * s, + y + (0.992358 - cy) * s, + x + (0.512663 - cx) * s, + y + (1 - cy) * s, + x + (0.5 - cx) * s, + y + (1 - cy) * s + ); + path.cubicCurveTo( + x + (0.487337 - cx) * s, + y + (1 - cy) * s, + x + (0.475925 - cx) * s, + y + (0.992358 - cy) * s, + x + (0.471104 - cx) * s, + y + (0.980648 - cy) * s + ); + path.cubicCurveTo( + x + (0.487337 - cx) * s, + y + (1 - cy) * s, + x + (0.475925 - cx) * s, + y + (0.992358 - cy) * s, + x + (0.471104 - cx) * s, + y + (0.980648 - cy) * s + ); + path.cubicCurveTo( + x + (0.437772 - cx) * s, + y + (0.899699 - cy) * s, + x + (0.388107 - cx) * s, + y + (0.834367 - cy) * s, + x + (0.336215 - cx) * s, + y + (0.766105 - cy) * s + ); + path.cubicCurveTo( + x + (0.318729 - cx) * s, + y + (0.743104 - cy) * s, + x + (0.300991 - cx) * s, + y + (0.719769 - cy) * s, + x + (0.283539 - cx) * s, + y + (0.695393 - cy) * s + ); + path.cubicCurveTo( + x + (0.215375 - cx) * s, + y + (0.600181 - cy) * s, + x + (0.15625 - cx) * s, + y + (0.493824 - cy) * s, + x + (0.15625 - cx) * s, + y + (0.34375 - cy) * s + ); + path.closePath(); + }, + plus(params) { + drawMarkerUnitPolygon(params, [ + [1 / 3, 0], + [2 / 3, 0], + [2 / 3, 1 / 3], + [1, 1 / 3], + [1, 2 / 3], + [2 / 3, 2 / 3], + [2 / 3, 1], + [1 / 3, 1], + [1 / 3, 2 / 3], + [0, 2 / 3], + [0, 1 / 3], + [1 / 3, 1 / 3] + ]); + }, + square({ path, x, y, size, pixelRatio }) { + const hs = size / 2; + path.moveTo(align(pixelRatio, x - hs), align(pixelRatio, y - hs)); + path.lineTo(align(pixelRatio, x + hs), align(pixelRatio, y - hs)); + path.lineTo(align(pixelRatio, x + hs), align(pixelRatio, y + hs)); + path.lineTo(align(pixelRatio, x - hs), align(pixelRatio, y + hs)); + path.closePath(); + }, + star({ path, x, y, size }) { + const spikes = 5; + const outerRadius = size / 2; + const innerRadius = outerRadius / 2; + const rotation = Math.PI / 2; + for (let i = 0; i < spikes * 2; i++) { + const radius = i % 2 === 0 ? outerRadius : innerRadius; + const angle2 = i * Math.PI / spikes - rotation; + const xCoordinate = x + Math.cos(angle2) * radius; + const yCoordinate = y + Math.sin(angle2) * radius; + path.lineTo(xCoordinate, yCoordinate); + } + path.closePath(); + }, + triangle(params) { + drawMarkerUnitPolygon(params, [ + [0.5, 0], + [1, 0.87], + [0, 0.87] + ]); + } +}; + +// packages/ag-charts-community/src/chart/marker/marker.ts +var InternalMarker = class extends Path { + constructor() { + super(...arguments); + this.shape = "square"; + this.x = 0; + this.y = 0; + this.size = 12; + } + isPointInPath(x, y) { + return this.distanceSquared(x, y) <= 0; + } + get midPoint() { + return { x: this.x, y: this.y }; + } + distanceSquared(x, y) { + const anchor = Marker.anchor(this.shape); + const dx2 = x - this.x + (anchor.x - 0.5) * this.size; + const dy2 = y - this.y + (anchor.y - 0.5) * this.size; + const radius = this.size / 2; + return Math.max(dx2 * dx2 + dy2 * dy2 - radius * radius, 0); + } + updatePath() { + const { path, shape, x, y, size } = this; + const pixelRatio = this.layerManager?.canvas?.pixelRatio ?? 1; + const anchor = Marker.anchor(shape); + const drawParams = { + path, + x: x - (anchor.x - 0.5) * size, + y: y - (anchor.y - 0.5) * size, + size, + pixelRatio + }; + path.clear(); + if (typeof shape === "string") { + MARKER_SHAPES[shape](drawParams); + } else if (typeof shape === "function") { + shape(drawParams); + } + } + computeBBox() { + const { x, y, size } = this; + const anchor = Marker.anchor(this.shape); + return new BBox(x - size * anchor.x, y - size * anchor.y, size, size); + } + executeFill(ctx, path) { + if (!path) + return; + return super.executeFill(ctx, path); + } + executeStroke(ctx, path) { + if (!path) + return; + return super.executeStroke(ctx, path); + } +}; +__decorateClass([ + SceneObjectChangeDetection({ equals: TRIPLE_EQ }) +], InternalMarker.prototype, "shape", 2); +__decorateClass([ + SceneChangeDetection() +], InternalMarker.prototype, "x", 2); +__decorateClass([ + SceneChangeDetection() +], InternalMarker.prototype, "y", 2); +__decorateClass([ + SceneChangeDetection({ convertor: Math.abs }) +], InternalMarker.prototype, "size", 2); +var Marker = class extends Rotatable(Scalable(Translatable(InternalMarker))) { + static anchor(shape) { + if (shape === "pin") { + return { x: 0.5, y: 1 }; + } else if (typeof shape === "function" && "anchor" in shape) { + return shape.anchor; + } + return { x: 0.5, y: 0.5 }; + } + constructor(options) { + super(options); + if (options?.shape != null) { + this.shape = options.shape; + } + } +}; + +// packages/ag-charts-community/src/chart/legend/legendSymbol.ts +function legendSymbolSvg(symbol, size, lineSize = size * (5 / 3)) { + const group = new Group(); + const markerStrokeWidth = Math.min(symbol.marker.strokeWidth ?? 1, 2); + const lineStrokeWidth = Math.min(symbol.line?.strokeWidth ?? 0, 2); + const width2 = Math.max(symbol.marker.enabled === false ? 0 : size, symbol.line == null ? 0 : lineSize); + const height2 = Math.max(symbol.marker.enabled === false ? 0 : size, lineStrokeWidth); + if (symbol.line != null) { + const { stroke: stroke3, strokeOpacity, lineDash } = symbol.line; + const line = new Line(); + line.x1 = 0; + line.y1 = height2 / 2; + line.x2 = width2; + line.y2 = height2 / 2; + line.stroke = stroke3; + line.strokeOpacity = strokeOpacity; + line.strokeWidth = lineStrokeWidth; + line.lineDash = lineDash; + group.append(line); + } + if (symbol.marker.enabled !== false) { + const { shape, fill, fillOpacity, stroke: stroke3, strokeOpacity, lineDash, lineDashOffset } = symbol.marker; + const marker = new Marker(); + marker.shape = shape ?? "square"; + marker.size = size; + marker.fill = fill; + marker.fillOpacity = fillOpacity ?? 1; + marker.stroke = stroke3; + marker.strokeOpacity = strokeOpacity ?? 1; + marker.strokeWidth = markerStrokeWidth; + marker.lineDash = lineDash; + marker.lineDashOffset = lineDashOffset ?? 0; + const anchor = Marker.anchor(shape); + const x = width2 / 2 + (anchor.x - 0.5) * size; + const y = height2 / 2 + (anchor.y - 0.5) * size; + const scale2 = size / (size + markerStrokeWidth); + marker.x = x; + marker.y = y; + marker.scalingCenterX = x; + marker.scalingCenterY = y; + marker.scalingX = scale2; + marker.scalingY = scale2; + group.append(marker); + } + return Group.toSVG(group, width2, height2); +} + +// packages/ag-charts-community/src/chart/tooltip/tooltipContent.ts +var DEFAULT_TOOLTIP_CLASS = "ag-charts-tooltip"; +var DEFAULT_TOOLTIP_DARK_CLASS = "ag-charts-tooltip--dark"; +function aggregateTooltipContent(content) { + const out = []; + const groupedContents = /* @__PURE__ */ new Map(); + for (const item of content) { + if (item.type === "structured") { + const { heading } = item; + const insertionTarget = heading == null ? void 0 : groupedContents.get(heading); + const groupedItem = { type: "structured", heading, items: [item] }; + if (insertionTarget == null) { + groupedContents.set(heading, groupedItem); + out.push(groupedItem); + } else { + insertionTarget.items.push(item); + } + } else { + out.push(item); + } + } + return out; +} +function tooltipContentAriaLabel(ungroupedContent) { + const content = aggregateTooltipContent(ungroupedContent); + const ariaLabel = []; + for (const c of content) { + if (c.type === "raw") { + continue; + } + if (c.heading != null) { + ariaLabel.push(toPlainText(c.heading)); + } + for (const i of c.items) { + if (i.title != null) { + ariaLabel.push(toPlainText(i.title)); + } + if (i.data) { + for (const datum of i.data) { + ariaLabel.push(datum.label ?? datum.fallbackLabel, datum.value); + } + } + } + } + return ariaLabel.filter((s) => s !== "").join("; "); +} +function dataHtml(label, value, inline) { + let rowHtml = ""; + if (label == null && !value) { + return ""; + } + if (label == null) { + rowHtml += `${sanitizeHtml(value)}`; + } else { + rowHtml += `${sanitizeHtml(label)}`; + rowHtml += " "; + rowHtml += `${sanitizeHtml(value)}`; + } + const rowClassNames = [`${DEFAULT_TOOLTIP_CLASS}-row`]; + if (inline) + rowClassNames.push(`${DEFAULT_TOOLTIP_CLASS}-row--inline`); + rowHtml = `
${rowHtml}
`; + return rowHtml; +} +function tooltipRowContentHtml(content) { + let html = ""; + if (content.data?.length && content.data.every((datum) => datum.value == null || datum.value === "")) { + return html; + } + const dataInline = content.title == null && content.data?.length === 1; + const symbol = content.symbol == null ? void 0 : legendSymbolSvg(content.symbol, 12); + if (symbol != null && (content.title != null || content.data?.length)) { + html += `${symbol}`; + } + if (content.title != null) { + html += `${sanitizeHtml(content.title)}`; + html += " "; + } + if (content.data) { + for (const datum of content.data) { + html += dataHtml(datum.label ?? datum.fallbackLabel, datum.value, dataInline); + html += " "; + } + } + return html; +} +function tooltipPaginationContentHtml(localeManager, pagination) { + if (localeManager == null || pagination.length === 1) + return; + const text2 = localeManager?.t("tooltipPaginationStatus", { + index: pagination.index + 1, + count: pagination.length + }); + return ``; +} +function tooltipContentHtml(localeManager, content, mode, pagination) { + const singleItem = content.items.length === 1 ? content.items[0] : void 0; + let compact; + let compactTitle; + let compactFallbackLabel; + switch (mode) { + case "compact": + compact = true; + compactTitle = toPlainText(singleItem?.title); + break; + case "single": + compact = singleItem != null && (content.heading == null || singleItem.title == null) && singleItem.data?.length === 1 && singleItem.data[0].label == null && singleItem.data[0].value != null; + compactFallbackLabel = toPlainText(content.heading ?? singleItem?.title); + break; + case "shared": + compact = false; + } + let html = ""; + if (compact && singleItem != null) { + if (compactTitle != null) { + html += dataHtml(void 0, compactTitle, false); + } + if (singleItem.data) { + for (const datum of singleItem.data) { + html += dataHtml(datum.label ?? compactFallbackLabel, datum.value, false); + html += " "; + } + } + } else { + if (content.heading != null) { + html += `${sanitizeHtml(toPlainText(content.heading))}`; + html += " "; + } + for (const item of content.items) { + html += tooltipRowContentHtml(item); + } + } + if (html.length === 0) + return; + const paginationContent = mode !== "compact" && pagination != null ? tooltipPaginationContentHtml(localeManager, pagination) : void 0; + if (paginationContent + null) { + html += paginationContent; + } + html = `
${html.trimEnd()}
`; + return html; +} +function tooltipPaginationHtml(localeManager, pagination) { + const paginationContent = pagination == null ? void 0 : tooltipPaginationContentHtml(localeManager, pagination); + if (paginationContent == null) + return ""; + return `
${paginationContent}
`; +} +function tooltipHtml(localeManager, content, mode, pagination) { + const aggregatedContent = aggregateTooltipContent(content); + if (aggregatedContent.length === 0) + return; + if (aggregatedContent.length === 1 && aggregatedContent[0].type === "structured") { + return tooltipContentHtml(localeManager, aggregatedContent[0], mode, pagination); + } else { + const htmlRows = aggregatedContent.map((c) => { + return c.type === "structured" ? tooltipContentHtml(localeManager, c, mode) : c.rawHtmlString; + }); + if (pagination != null) { + htmlRows.push(tooltipPaginationHtml(localeManager, pagination) ?? ""); + } + return htmlRows.join(""); + } +} + +// packages/ag-charts-community/src/chart/tooltip/tooltip.ts +var horizontalAlignments = { + left: -1, + "top-left": -1, + "bottom-left": -1, + top: 0, + center: 0, + bottom: 0, + right: 1, + "top-right": 1, + "bottom-right": 1 +}; +var verticalAlignments = { + "top-left": -1, + top: -1, + "top-right": -1, + left: 0, + center: 0, + right: 0, + "bottom-left": 1, + bottom: 1, + "bottom-right": 1 +}; +var arrowPositions = { + left: 3 /* Right */, + "top-left": void 0, + "bottom-left": void 0, + top: 2 /* Bottom */, + center: void 0, + bottom: 1 /* Top */, + right: 0 /* Left */, + "top-right": void 0, + "bottom-right": void 0 +}; +var directionChecks = { + top: 2 /* Vertical */, + bottom: 2 /* Vertical */, + left: 1 /* Horizontal */, + right: 1 /* Horizontal */, + "top-right": 3 /* Both */, + "top-left": 3 /* Both */, + "bottom-right": 3 /* Both */, + "bottom-left": 3 /* Both */, + center: 0 /* None */ +}; +var defaultPlacements = { + pointer: "top", + node: "top", + chart: "top-left" +}; +var TooltipPosition = class extends BaseProperties { + constructor() { + super(...arguments); + /** The horizontal offset in pixels for the position of the tooltip. */ + this.xOffset = 0; + /** The vertical offset in pixels for the position of the tooltip. */ + this.yOffset = 0; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], TooltipPosition.prototype, "xOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], TooltipPosition.prototype, "yOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], TooltipPosition.prototype, "anchorTo", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], TooltipPosition.prototype, "placement", 2); +var Tooltip = class extends BaseProperties { + constructor() { + super(); + this.enabled = true; + this.mode = "single"; + this.delay = 0; + this.range = void 0; + this.wrapping = "hyphenate"; + this.position = new TooltipPosition(); + this.pagination = false; + this.darkTheme = false; + this.bounds = "extended"; + this.cleanup = new CleanupRegistry(); + this.springAnimation = new SpringAnimation(); + this.enableInteraction = false; + this.wrapTypes = ["always", "hyphenate", "on-space", "never"]; + this.sizeMonitor = new SizeMonitor(); + // Reading the element size is expensive, so cache the result + this._elementSize = void 0; + this._showTimeout = void 0; + this.arrowPosition = void 0; + this._visible = false; + this.positionParams = void 0; + this.localeManager = void 0; + this.cleanup.register(this.springAnimation.events.on("update", this.updateTooltipPosition.bind(this))); + } + get interactive() { + return this.enableInteraction; + } + setup(localeManager, domManager) { + if ("togglePopover" in getWindow().HTMLElement.prototype) { + this.element = domManager.addChild("tooltip-container", DEFAULT_TOOLTIP_CLASS); + this.element.setAttribute("popover", "manual"); + this.element.className = DEFAULT_TOOLTIP_CLASS; + this.element.style.positionAnchor = domManager.anchorName; + this.sizeMonitor.observe(this.element, (size) => { + this._elementSize = size; + this.updateTooltipPosition(); + }); + } + this.localeManager = localeManager; + return () => { + domManager.removeChild("tooltip-container", DEFAULT_TOOLTIP_CLASS); + this.cleanup.flush(); + if (this.element) { + this.sizeMonitor.unobserve(this.element); + } + }; + } + isVisible() { + return this._visible; + } + contains(node) { + return this.element?.contains(node) ?? false; + } + updateTooltipPosition() { + const { element: element2, _elementSize: elementSize, positionParams } = this; + if (element2 == null || elementSize == null || positionParams == null) + return; + const { canvasRect, relativeRect, meta } = positionParams; + const { x: canvasX, y: canvasY } = this.springAnimation; + const anchorTo = meta.position?.anchorTo ?? "pointer"; + let placements2 = meta.position?.placement ?? defaultPlacements[anchorTo]; + if (!Array.isArray(placements2)) { + placements2 = [placements2]; + } + const xOffset = meta.position?.xOffset ?? 0; + const yOffset = meta.position?.yOffset ?? 0; + const minX = relativeRect.x; + const minY = relativeRect.y; + const maxX = relativeRect.width - elementSize.width - 1 + minX; + const maxY = relativeRect.height - elementSize.height + minY; + let i = 0; + let placement; + let position; + let constrained = false; + do { + placement = placements2[i]; + i += 1; + const tooltipBounds = this.getTooltipBounds({ + elementSize, + placement, + anchorTo, + canvasX, + canvasY, + yOffset, + xOffset, + canvasRect + }); + position = calculatePlacement(elementSize.width, elementSize.height, relativeRect, tooltipBounds); + constrained = false; + if (directionChecks[placement] & 1 /* Horizontal */) { + constrained || (constrained = position.x < minX || position.x > maxX); + } + if (directionChecks[placement] & 2 /* Vertical */) { + constrained || (constrained = position.y < minY || position.y > maxY); + } + } while (i < placements2.length && constrained); + const left = clamp(minX, position.x, maxX); + const top = clamp(minY, position.y, maxY); + constrained || (constrained = left !== position.x || top !== position.y); + const defaultShowArrow = anchorTo !== "chart" && !constrained && !xOffset && !yOffset; + const showArrow = meta.showArrow ?? this.showArrow ?? defaultShowArrow; + this.arrowPosition = showArrow ? arrowPositions[placement] : void 0; + this.updateClassModifiers(); + element2.style.translate = `${left}px ${top}px`; + } + /** + * Shows tooltip at the given event's coordinates. + * If the `html` parameter is missing, moves the existing tooltip to the new position. + */ + show(boundingRect, canvasRect, meta, content, pagination, instantly = false) { + const { element: element2 } = this; + if (element2 != null && content != null && content.length !== 0) { + const html = tooltipHtml(this.localeManager, content, this.mode, this.pagination ? pagination : void 0); + if (html == null) { + this.toggle(false); + return; + } + element2.innerHTML = html; + } else if (element2 == null || element2.innerHTML === "") { + this.toggle(false); + return; + } + const relativeRect = { + x: boundingRect.x - canvasRect.x, + y: boundingRect.y - canvasRect.y, + width: boundingRect.width, + height: boundingRect.height + }; + this.positionParams = { + canvasRect, + relativeRect, + meta + }; + const anchorTo = meta.position?.anchorTo ?? "pointer"; + switch (anchorTo) { + case "node": + this.springAnimation.update(meta.nodeCanvasX ?? meta.canvasX, meta.nodeCanvasY ?? meta.canvasY); + break; + case "pointer": + this.springAnimation.update(meta.canvasX, meta.canvasY); + break; + case "chart": + this.springAnimation.reset(); + } + if (meta.enableInteraction) { + this.enableInteraction = true; + element2.style.pointerEvents = "auto"; + element2.removeAttribute("aria-hidden"); + element2.tabIndex = -1; + } else { + this.enableInteraction = false; + element2.style.pointerEvents = "none"; + element2.setAttribute("aria-hidden", "true"); + element2.removeAttribute("tabindex"); + } + element2.style.setProperty("--top", `${canvasRect.top}px`); + element2.style.setProperty("--left", `${canvasRect.left}px`); + this.updateClassModifiers(); + this.toggle(true, instantly); + } + hide() { + this.toggle(false); + } + maybeEnterInteractiveTooltip({ relatedTarget }, callback2) { + const { interactive, interactiveLeave, enabled, element: element2 } = this; + if (element2 == null) + return false; + if (interactiveLeave) + return true; + const isEntering = interactive && enabled && this.isVisible() && relatedTarget instanceof Node && this.contains(relatedTarget); + if (isEntering) { + this.interactiveLeave = { + callback: callback2, + listener: (popoverEvent) => { + const isLeaving = popoverEvent.relatedTarget == null || popoverEvent.relatedTarget instanceof Node && !this.contains(popoverEvent.relatedTarget); + if (isLeaving) { + this.popInteractiveLeaveCallback(); + } + } + }; + element2.addEventListener("focusout", this.interactiveLeave.listener); + element2.addEventListener("mouseout", this.interactiveLeave.listener); + } + return isEntering; + } + popInteractiveLeaveCallback() { + const { interactiveLeave, element: element2 } = this; + this.interactiveLeave = void 0; + if (interactiveLeave) { + if (element2) { + element2.removeEventListener("focusout", interactiveLeave.listener); + element2.removeEventListener("mouseout", interactiveLeave.listener); + } + interactiveLeave.callback(); + } + } + toggle(visible, instantly = false) { + const { delay } = this; + if (visible && delay > 0 && !instantly) { + this._showTimeout ?? (this._showTimeout = setTimeout(() => { + this._showTimeout = void 0; + this.toggleCallback(true); + }, delay)); + } else { + clearTimeout(this._showTimeout); + this._showTimeout = void 0; + this.toggleCallback(visible); + } + } + toggleCallback(visible) { + if (!this.element?.isConnected) + return; + if (this._visible === visible) + return; + this._visible = visible; + this.element.togglePopover(visible); + if (visible) { + this.updateTooltipPosition(); + } else { + this.springAnimation.reset(); + this.popInteractiveLeaveCallback(); + } + } + updateClassModifiers() { + if (!this.element?.isConnected) + return; + const { classList } = this.element; + const toggleClass = (name, include) => classList.toggle(`${DEFAULT_TOOLTIP_CLASS}--${name}`, include); + toggleClass("no-interaction", !this.enableInteraction); + toggleClass("arrow-top", this.arrowPosition === 1 /* Top */); + toggleClass("arrow-right", this.arrowPosition === 3 /* Right */); + toggleClass("arrow-bottom", this.arrowPosition === 2 /* Bottom */); + toggleClass("arrow-left", this.arrowPosition === 0 /* Left */); + toggleClass("compact", this.mode === "compact"); + classList.toggle(DEFAULT_TOOLTIP_DARK_CLASS, this.darkTheme); + for (const wrapType of this.wrapTypes) { + classList.toggle(`${DEFAULT_TOOLTIP_CLASS}--wrap-${wrapType}`, wrapType === this.wrapping); + } + } + getTooltipBounds(opts) { + const { elementSize, anchorTo, placement, canvasX, canvasY, yOffset, xOffset, canvasRect } = opts; + const { width: tooltipWidth, height: tooltipHeight } = elementSize; + const bounds = { width: tooltipWidth, height: tooltipHeight }; + if (anchorTo === "node" || anchorTo === "pointer") { + const horizontalAlignment = horizontalAlignments[placement]; + const verticalAlignment = verticalAlignments[placement]; + bounds.top = canvasY + yOffset + tooltipHeight * (verticalAlignment - 1) / 2 + 8 * verticalAlignment; + bounds.left = canvasX + xOffset + tooltipWidth * (horizontalAlignment - 1) / 2 + 8 * horizontalAlignment; + return bounds; + } + switch (placement) { + case "top": { + bounds.top = yOffset; + bounds.left = canvasRect.width / 2 - tooltipWidth / 2 + xOffset; + return bounds; + } + case "right": { + bounds.top = canvasRect.height / 2 - tooltipHeight / 2 + yOffset; + bounds.left = canvasRect.width - tooltipWidth + xOffset; + return bounds; + } + case "left": { + bounds.top = canvasRect.height / 2 - tooltipHeight / 2 + yOffset; + bounds.left = xOffset; + return bounds; + } + case "bottom": { + bounds.top = canvasRect.height - tooltipHeight + yOffset; + bounds.left = canvasRect.width / 2 - tooltipWidth / 2 + xOffset; + return bounds; + } + case "top-left": { + bounds.top = yOffset; + bounds.left = xOffset; + return bounds; + } + case "top-right": { + bounds.top = yOffset; + bounds.left = canvasRect.width - tooltipWidth + xOffset; + return bounds; + } + case "bottom-right": { + bounds.top = canvasRect.height - tooltipHeight + yOffset; + bounds.left = canvasRect.width - tooltipWidth + xOffset; + return bounds; + } + case "bottom-left": { + bounds.top = canvasRect.height - tooltipHeight + yOffset; + bounds.left = xOffset; + return bounds; + } + } + return bounds; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], Tooltip.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Tooltip.prototype, "mode", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Tooltip.prototype, "showArrow", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Tooltip.prototype, "delay", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Tooltip.prototype, "range", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Tooltip.prototype, "wrapping", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Tooltip.prototype, "position", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Tooltip.prototype, "pagination", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Tooltip.prototype, "darkTheme", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Tooltip.prototype, "bounds", 2); + +// packages/ag-charts-community/src/chart/series/seriesAreaManager.ts +function pickedNodesEqual(a, b) { + return a.series === b.series && objectsEqual(a.datumIndex, b.datumIndex); +} +var PickedNodeState = class { + constructor() { + this.candidates = []; + } + get current() { + return this.active; + } + reset() { + this.candidates.length = 0; + this.active = void 0; + } + update(nextCandidates, previousActive) { + this.candidates = nextCandidates; + let nextIndex = previousActive == null ? -1 : nextCandidates.findIndex((c) => pickedNodesEqual(c, previousActive)); + if (nextIndex === -1) + nextIndex = 0; + this.active = nextCandidates[nextIndex]; + return { current: this.active, index: nextIndex, length: nextCandidates.length }; + } + next() { + const { candidates, active } = this; + const hoverIndex = active == null ? -1 : candidates.findIndex((c) => pickedNodesEqual(c, active)); + if (hoverIndex === -1) + return void 0; + let nextIndex = hoverIndex + 1; + if (nextIndex >= candidates.length) { + nextIndex = 0; + } + this.active = candidates[nextIndex]; + return { current: this.active, index: nextIndex, length: this.candidates.length }; + } +}; +var SeriesAreaManager = class extends BaseManager { + constructor(chart) { + super(); + this.chart = chart; + this.id = createId(this); + this.series = []; + this.announceMode = "when-changed"; + this.highlight = { + /** Last received event that still needs to be applied. */ + pendingHoverEvent: void 0, + /** Last applied event. */ + appliedHoverEvent: void 0, + /** Last applied event, which has been temporarily stashed during the main chart update cycle. */ + stashedHoverEvent: void 0 + }; + this.tooltip = { + lastHover: void 0 + }; + /** + * A11y Requirements for Tooltip/Highlight (see AG-13051 for details): + * + * - When the series-area is blurred, always the mouse to update the tooltip/highlight. + * + * - When the series-area receives a `focus` event, use `:focus-visible` to guess the input device. + * (this is decided by the browser). + * + * - For keyboard users, `focus` and `keydown` events always updates & shows the tooltip/highlight on + * the currently (or newly) focused datum. + * + * - For keyboard users, `mousemove` events update the tooltip/highlight iff `pickNode` finds a match + * for the mouse event offsets. + */ + this.hoverDevice = "pointer"; + /** + * This is the "second last" input event. It can be useful for keydown + * events that for which don't to set the isFocusVisible state + * (e.g. Backspace/Delete key on FC annotations, see AG-13041). + * + * Use with caution! The focus indicator must ALWAYS be visible for + * keyboard-only users. + */ + this.previousInputDevice = "keyboard"; + this.focus = { + sortedSeries: [], + series: void 0, + seriesIndex: 0, + datumIndex: 0, + datum: void 0 + }; + this.cachedTooltipContent = void 0; + this.hoverScheduler = debouncedAnimationFrame(() => { + if (!this.tooltip.lastHover && !this.highlight.pendingHoverEvent) + return; + if (this.chart.getUpdateType() <= 5 /* SERIES_UPDATE */) { + this.hoverScheduler.schedule(); + return; + } + if (this.highlight.pendingHoverEvent) { + this.handleHoverHighlight(false); + } + if (this.tooltip.lastHover) { + this.handleHoverTooltip(this.tooltip.lastHover, false); + } + }); + this.tooltipCandidates = new PickedNodeState(); + const initialAltText = chart.ctx.localeManager.t("ariaInitSeriesArea"); + const label1 = chart.ctx.domManager.addChild("series-area", "series-area-aria-label1"); + const label2 = chart.ctx.domManager.addChild("series-area", "series-area-aria-label2"); + this.swapChain = new FocusSwapChain(label1, label2, "img", initialAltText); + this.swapChain.addListener("blur", (event) => this.onBlur(event)); + this.swapChain.addListener("focus", () => this.onFocus()); + if (chart.ctx.domManager.mode === "normal") { + this.focusIndicator = new FocusIndicator(this.swapChain); + this.focusIndicator.overrideFocusVisible(chart.mode === "integrated" ? false : void 0); + } + const { seriesDragInterpreter, seriesWidget, containerWidget } = chart.ctx.widgets; + seriesWidget.setTabIndex(-1); + this.cleanup.register( + () => chart.ctx.domManager.removeChild("series-area", "series-area-aria-label1"), + () => chart.ctx.domManager.removeChild("series-area", "series-area-aria-label2"), + seriesWidget.addListener("focus", () => this.swapChain.focus({ preventScroll: true })), + seriesWidget.addListener("mousemove", (event) => this.onHover(event, seriesWidget)), + seriesWidget.addListener("wheel", (event) => this.onWheel(event)), + seriesWidget.addListener("mouseleave", (event) => this.onLeave(event)), + seriesWidget.addListener("keydown", (event) => this.onKeyDown(event)), + seriesWidget.addListener("contextmenu", (event, current) => this.onContextMenu(event, current)), + containerWidget.addListener("contextmenu", (event, current) => this.onContextMenu(event, current)), + containerWidget.addListener("click", (event, current) => this.onClick(event, current)), + containerWidget.addListener("dblclick", (event, current) => this.onClick(event, current)), + chart.ctx.animationManager.addListener("animation-start", () => this.clearAll()), + chart.ctx.eventsHub.on("dom:resize", () => this.clearAll()), + chart.ctx.eventsHub.on("highlight:change", (event) => this.changeHighlightDatum(event)), + chart.ctx.eventsHub.on("layout:complete", (event) => this.layoutComplete(event)), + chart.ctx.updateService.addListener("pre-scene-render", () => this.preSceneRender()), + chart.ctx.updateService.addListener("update-complete", () => this.updateComplete()), + chart.ctx.eventsHub.on("zoom:change", () => this.clearAll()), + chart.ctx.eventsHub.on("zoom:pan-start", () => this.clearAll()) + ); + if (seriesDragInterpreter) { + this.cleanup.register( + seriesDragInterpreter.events.on("drag-move", (event) => this.onDragMove(event, seriesWidget)), + seriesDragInterpreter.events.on("click", (event) => this.onClick(event, seriesWidget)), + seriesDragInterpreter.events.on("dblclick", (event) => this.onClick(event, seriesWidget)) + ); + } + } + get bbox() { + return (this.seriesRect ?? BBox.zero).clone(); + } + isState(allowedStates) { + return this.chart.ctx.interactionManager.isState(allowedStates); + } + isIgnoredTouch(event) { + if (event.device !== "touch" || event.type === "click") + return false; + if (this.chart.ctx.chartService.touch.dragAction === "hover") + return false; + if (this.chart.ctx.chartService.touch.dragAction === "drag") { + if (this.isState(9 /* AnnotationsMoveable */)) { + return false; + } + } + return true; + } + dataChanged() { + var _a; + this.cachedTooltipContent = void 0; + if (this.highlight.appliedHoverEvent) { + (_a = this.highlight).stashedHoverEvent ?? (_a.stashedHoverEvent = this.highlight.appliedHoverEvent); + this.clearHighlight(); + } + this.chart.ctx.tooltipManager.removeTooltip(this.id); + this.focusIndicator?.clear(); + } + preSceneRender() { + if (this.highlight.stashedHoverEvent != null) { + this.highlight.pendingHoverEvent = this.highlight.stashedHoverEvent; + this.highlight.stashedHoverEvent = void 0; + this.handleHoverHighlight(true); + } + if (this.tooltip.lastHover != null) { + this.handleHoverTooltip(this.tooltip.lastHover, true); + } + } + updateComplete() { + if (this.isState(34 /* Focusable */) && this.focusIndicator?.isFocusVisible()) { + if (this.announceMode !== "always") { + this.announceMode = "never"; + } + this.handleFocus(0, 0); + } + } + update(type, opts) { + this.chart.ctx.updateService.update(type, opts); + } + seriesChanged(series) { + this.focus.sortedSeries = [...series].sort((a, b) => { + let fpA = a.properties.focusPriority ?? Infinity; + let fpB = b.properties.focusPriority ?? Infinity; + if (fpA === fpB) { + [fpA, fpB] = [a.declarationOrder, b.declarationOrder]; + } + if (fpA < fpB) { + return -1; + } else if (fpA > fpB) { + return 1; + } + return 0; + }); + this.series = series; + } + layoutComplete(event) { + this.seriesRect = event.series.rect; + this.hoverRect = event.series.rect; + this.chart.ctx.widgets.seriesWidget.setBounds(event.series.rect); + if (this.chart.ctx.domManager.mode === "normal") { + this.chart.ctx.widgets.chartWidget.setBounds(event.chart); + } + } + onContextMenu(event, current) { + const { sourceEvent } = event; + if (sourceEvent.currentTarget != current.getElement()) + return; + if (sourceEvent.target == this.chart.ctx.widgets.containerWidget.getElement()) { + if (this.isState(36 /* ContextMenuable */)) { + const { currentX: canvasX2, currentY: canvasY2 } = event; + this.chart.ctx.contextMenuRegistry.dispatchContext( + "always", + { widgetEvent: event, canvasX: canvasX2, canvasY: canvasY2 }, + void 0 + ); + } + return; + } + let pickedNode; + let position; + if (this.focusIndicator?.isFocusVisible()) { + pickedNode = this.chart.ctx.highlightManager.getActiveHighlight(); + if (pickedNode && this.seriesRect && pickedNode.midPoint) { + position = Transformable.toCanvasPoint( + pickedNode.series.contentGroup, + pickedNode.midPoint.x, + pickedNode.midPoint.y + ); + } + } else if (this.isState(36 /* ContextMenuable */)) { + const pick2 = this.pickNodes({ x: event.currentX, y: event.currentY }, "context-menu"); + if (pick2) { + this.chart.ctx.highlightManager.updateHighlight(this.id); + pickedNode = pick2.matches[0].datum; + } + } + const pickedSeries = pickedNode?.series; + this.clearAll(); + const canvasX = event.currentX + current.cssLeft(); + const canvasY = event.currentY + current.cssTop(); + const { datumIndex } = pickedNode ?? {}; + if (pickedSeries && pickedNode && datumIndex != null) { + this.chart.ctx.contextMenuRegistry.dispatchContext( + "series-node", + { widgetEvent: event, canvasX, canvasY }, + { pickedSeries, pickedNode: { ...pickedNode, datumIndex } }, + position + ); + } else { + this.chart.ctx.contextMenuRegistry.dispatchContext( + "series-area", + { widgetEvent: event, canvasX, canvasY }, + void 0, + position + ); + } + } + onLeave(event) { + if (!this.isState(41 /* Clickable */)) + return; + const relatedTarget = event.sourceEvent.relatedTarget; + if (relatedTarget?.className === "ag-charts-text-input__textarea") { + return; + } + if (this.maybeEnterInteractiveTooltip(event.sourceEvent)) { + return; + } + this.chart.ctx.domManager.updateCursor(this.id); + if (this.hoverDevice !== "keyboard") + this.clearAll(); + } + onWheel(_event) { + if (!this.isState(41 /* Clickable */)) + return; + this.focusIndicator?.overrideFocusVisible(false); + this.previousInputDevice = "pointer"; + } + onDragMove(event, current) { + if (!this.isState(41 /* Clickable */)) + return; + this.focusIndicator?.overrideFocusVisible(false); + this.onHoverLikeEvent(event, current); + } + onHover(event, current) { + if (!this.isState(41 /* Clickable */)) + return; + this.onHoverLikeEvent(event, current); + } + onHoverLikeEvent(event, current) { + if (this.isIgnoredTouch(event)) + return; + if (event.device === "touch" && this.chart.ctx.chartService.touch.dragAction === "hover") { + event.sourceEvent.preventDefault(); + } + if (current !== this.chart.ctx.widgets.seriesWidget) + return; + if (event.device === "touch" || excludesType(event, "drag-move")) { + this.tooltip.lastHover = event; + } + this.hoverDevice = "pointer"; + this.previousInputDevice = "pointer"; + this.highlight.pendingHoverEvent = event; + this.hoverScheduler.schedule(); + let pick2; + if (this.isState(32 /* Default */)) { + const { currentX: x, currentY: y } = event; + pick2 = this.pickNodes({ x, y }, "event"); + const matches = pick2?.matches; + const found = matches?.[0]; + if (found?.series.hasEventListener("seriesNodeClick") || found?.series.hasEventListener("seriesNodeDoubleClick") || matches != null && matches.length > 1 && this.chart.tooltip.pagination) { + this.chart.ctx.domManager.updateCursor(this.id, "pointer"); + } else { + this.chart.ctx.domManager.updateCursor(this.id); + } + } + const consumed = Boolean(pick2?.matches.length); + this.emitSeriesAreaHoverEvent(event, consumed); + } + onClick(event, current) { + if (event.device === "keyboard") { + return; + } + if (current === this.chart.ctx.widgets.seriesWidget && this.chart.ctx.animationManager.isActive()) { + this.chart.ctx.animationManager.skipCurrentBatch(); + } + if (event.device === "touch" && current === this.chart.ctx.widgets.seriesWidget) { + this.swapChain.focus({ preventScroll: true }); + } + if (!this.isState(41 /* Clickable */)) + return; + if (current === this.chart.ctx.widgets.seriesWidget) { + if (!current.getElement().contains(event.sourceEvent.target)) { + return; + } + } else if (event.sourceEvent.target != current.getElement()) { + return; + } + this.focusIndicator?.overrideFocusVisible(false); + this.onHoverLikeEvent(event, current); + const isSeriesWidget = current === this.chart.ctx.widgets.seriesWidget; + if (!this.isState(32 /* Default */)) { + if (isSeriesWidget) { + this.emitSeriesAreaClickEvent(event, false); + } + return; + } + if (isSeriesWidget) { + const consumed = Boolean(this.checkSeriesNodeClick(event)); + if (consumed) { + this.emitSeriesAreaClickEvent(event, true); + this.update(5 /* SERIES_UPDATE */); + event.sourceEvent.preventDefault(); + return; + } + this.emitSeriesAreaClickEvent(event, false); + } + const newEvent = { type: event.type === "click" ? "click" : "doubleClick", event: event.sourceEvent }; + this.chart.fireEvent(newEvent); + } + emitSeriesAreaHoverEvent(event, consumed) { + const coords = this.toCanvasCoordinates(event.currentX, event.currentY); + if (coords == null) + return; + const payload = { + x: coords.x, + y: coords.y, + consumed, + sourceEvent: event.sourceEvent + }; + this.chart.ctx.eventsHub.emit("series-area:hover", payload); + } + emitSeriesAreaClickEvent(event, consumed) { + if (!("currentX" in event)) + return; + const coords = this.toCanvasCoordinates(event.currentX, event.currentY); + if (coords == null) + return; + const payload = { + x: coords.x, + y: coords.y, + consumed, + sourceEvent: event.sourceEvent + }; + this.chart.ctx.eventsHub.emit("series-area:click", payload); + } + toCanvasCoordinates(x, y) { + const offsetX = this.hoverRect?.x ?? this.seriesRect?.x ?? 0; + const offsetY = this.hoverRect?.y ?? this.seriesRect?.y ?? 0; + return { x: x + offsetX, y: y + offsetY }; + } + onFocus() { + if (!this.isState(34 /* Focusable */)) + return; + this.hoverDevice = this.focusIndicator?.isFocusVisible(true) ? "keyboard" : "pointer"; + this.handleFocus(0, 0); + } + onBlur(event) { + if (!this.isState(34 /* Focusable */)) + return; + this.hoverDevice = "pointer"; + if (!this.maybeEnterInteractiveTooltip(event)) { + this.clearAll(); + } + this.focusIndicator?.overrideFocusVisible(void 0); + } + onKeyDown(widgetEvent) { + if (!this.isState(43 /* Keyable */)) + return; + const action = mapKeyboardEventToAction(widgetEvent.sourceEvent); + if (action?.activatesFocusIndicator === false) { + this.focusIndicator?.overrideFocusVisible(this.previousInputDevice === "keyboard"); + } + switch (action?.name) { + case "redo": + return this.chart.ctx.eventsHub.emit("series:redo", null); + case "undo": + return this.chart.ctx.eventsHub.emit("series:undo", null); + case "zoomin": + return this.chart.ctx.eventsHub.emit("series:keynav-zoom", { delta: 1, widgetEvent }); + case "zoomout": + return this.chart.ctx.eventsHub.emit("series:keynav-zoom", { delta: -1, widgetEvent }); + case "arrowup": + return this.onArrow(-1, 0, widgetEvent); + case "arrowdown": + return this.onArrow(1, 0, widgetEvent); + case "arrowleft": + return this.onArrow(0, -1, widgetEvent); + case "arrowright": + return this.onArrow(0, 1, widgetEvent); + case "submit": + return this.onSubmit(widgetEvent); + } + } + onArrow(seriesIndexDelta, datumIndexDelta, event) { + if (!this.isState(34 /* Focusable */)) + return; + this.hoverDevice = "keyboard"; + this.previousInputDevice = "keyboard"; + this.focusIndicator?.overrideFocusVisible(true); + this.focus.seriesIndex += seriesIndexDelta; + this.focus.datumIndex += datumIndexDelta; + this.handleFocus(seriesIndexDelta, datumIndexDelta); + event.sourceEvent.preventDefault(); + this.chart.ctx.eventsHub.emit("series:focus-change", null); + } + onSubmit(event) { + if (!this.isState(34 /* Focusable */)) + return; + const { series, datum } = this.focus; + const sourceEvent = event.sourceEvent; + if (series != null && datum != null) { + series.fireNodeClickEvent(sourceEvent, datum); + } else { + this.chart.fireEvent({ + type: "click", + event: sourceEvent + }); + } + sourceEvent.preventDefault(); + } + checkSeriesNodeClick(event) { + var _a; + const result = this.pickNodes({ x: event.currentX, y: event.currentY }, "event"); + if (result == null || result.matches.length === 0) + return; + const paginationUpdate = this.chart.tooltip.pagination ? this.tooltipCandidates.update(result.matches, this.tooltipCandidates.current)?.current : void 0; + const { series, datum } = paginationUpdate ?? result.matches[0]; + const distance2 = paginationUpdate == null ? result.distance : 0; + if (event.type === "click") { + const defaultBehavior = series.fireNodeClickEvent(event.sourceEvent, datum); + const nextTooltipCandidate = defaultBehavior && this.chart.tooltip.pagination ? this.tooltipCandidates.next() : void 0; + if (nextTooltipCandidate != null) { + event.sourceEvent.preventDefault(); + const { currentX, currentY } = event; + const canvasX = currentX + (this.hoverRect?.x ?? 0); + const canvasY = currentY + (this.hoverRect?.y ?? 0); + (_a = this.highlight).pendingHoverEvent ?? (_a.pendingHoverEvent = this.highlight.appliedHoverEvent); + this.handleHoverHighlight(false); + this.showTooltip(nextTooltipCandidate.current, canvasX, canvasY, { + index: nextTooltipCandidate.index, + length: nextTooltipCandidate.length + }); + } + return true; + } + if (event.type === "dblclick") { + event.preventZoomDblClick = distance2 === 0; + series.fireNodeDoubleClickEvent(event.sourceEvent, datum); + return true; + } + return false; + } + handleFocus(seriesIndexDelta, datumIndexDelta) { + const overlayFocus = this.chart.overlays.getFocusInfo(this.chart.ctx.localeManager); + if (overlayFocus == null) { + if (this.handleSeriesFocus(seriesIndexDelta, datumIndexDelta) === 0 /* SUCCESS */) { + this.announceMode = "when-changed"; + } else { + this.announceMode = "always"; + } + } else { + this.focusIndicator?.update(overlayFocus.rect, this.seriesRect, false); + this.swapChain.update(overlayFocus.text); + this.announceMode = "always"; + } + } + handleSeriesFocus(otherIndexDelta, datumIndexDelta) { + if (this.chart.chartType === "standalone") { + return this.handleSoloSeriesFocus(otherIndexDelta, datumIndexDelta); + } + const { focus } = this; + const visibleSeries = focus.sortedSeries.filter((s) => s.visible && s.focusable); + if (visibleSeries.length === 0) + return 1 /* SERIES_NOT_FOUND */; + const oldDatumIndex = focus.datumIndex - datumIndexDelta; + const oldOtherIndex = focus.seriesIndex - otherIndexDelta; + focus.seriesIndex = clamp(0, focus.seriesIndex, visibleSeries.length - 1); + focus.series = visibleSeries[focus.seriesIndex]; + const datumIndex = this.focus.datumIndex; + const otherIndex = this.focus.seriesIndex; + return this.updatePickedFocus( + datumIndex, + datumIndexDelta, + oldDatumIndex, + otherIndex, + otherIndexDelta, + oldOtherIndex + ); + } + handleSoloSeriesFocus(otherIndexDelta, datumIndexDelta) { + this.focus.series = this.focus.sortedSeries[0]; + const datumIndex = this.focus.datumIndex; + const otherIndex = this.focus.seriesIndex; + const oldDatumIndex = this.focus.datumIndex - datumIndexDelta; + const oldOtherIndex = this.focus.seriesIndex - otherIndexDelta; + return this.updatePickedFocus( + datumIndex, + datumIndexDelta, + oldDatumIndex, + otherIndex, + otherIndexDelta, + oldOtherIndex + ); + } + updatePickedFocus(datumIndex, datumIndexDelta, oldDatumIndex, otherIndex, otherIndexDelta, oldOtherIndex) { + const { focus, hoverRect, seriesRect } = this; + if (focus.series == null || hoverRect == null) + return 1 /* SERIES_NOT_FOUND */; + const pick2 = focus?.series?.pickFocus({ datumIndex, datumIndexDelta, otherIndex, otherIndexDelta, seriesRect }); + if (!pick2) + return 2 /* DATUM_NOT_FOUND */; + const { datum } = pick2; + focus.datum = datum; + focus.datumIndex = pick2.datumIndex; + if (pick2.otherIndex != null) { + focus.seriesIndex = pick2.otherIndex; + } + if (this.focusIndicator?.isFocusVisible()) { + this.chart.ctx.animationManager.reset(); + const focusBBox = getPickedFocusBBox(pick2); + const { x, y } = focusBBox.computeCenter(); + if (!hoverRect.containsPoint(x, y)) { + const panSuccess = this.chart.ctx.zoomManager.panToBBox(this.id, hoverRect, focusBBox); + if (panSuccess) { + return 3 /* PAN_REQUIRED */; + } + } + const { x1, x2, y1, y2 } = Vec4.from(focusBBox); + const nw = hoverRect.containsPoint(x1, y1); + const ne = hoverRect.containsPoint(x2, y1); + const sw = hoverRect.containsPoint(x1, y2); + const se = hoverRect.containsPoint(x2, y2); + if (!(nw || ne || sw || se)) { + const hoverBounds = Vec4.from(hoverRect); + pick2.movedBounds = focusBBox.clone(); + if (x1 < hoverBounds.x1 && x2 < hoverBounds.x1) { + pick2.movedBounds.x = hoverBounds.x1 - 2; + pick2.movedBounds.width = 4; + } else if (x1 > hoverBounds.x2 && x2 > hoverBounds.x2) { + pick2.movedBounds.x = hoverBounds.x2 - 2; + pick2.movedBounds.width = 4; + } + if (y1 < hoverBounds.y1 && y2 < hoverBounds.y1) { + pick2.movedBounds.y = hoverBounds.y1 - 2; + pick2.movedBounds.height = 4; + } else if (y1 > hoverBounds.y2 && y2 > hoverBounds.y2) { + pick2.movedBounds.y = hoverBounds.y2 - 2; + pick2.movedBounds.height = 4; + } + } + } + this.focusIndicator?.update(pick2.movedBounds ?? pick2.bounds, this.seriesRect, pick2.clipFocusBox); + const tooltipContent = this.getTooltipContent(focus.series, datum.datumIndex, datum, "aria-label"); + const keyboardEvent = makeKeyboardPointerEvent(focus.series, hoverRect, pick2); + if (keyboardEvent != null && this.hoverDevice === "keyboard") { + this.tooltip.lastHover = void 0; + this.highlight.appliedHoverEvent = void 0; + this.highlight.pendingHoverEvent = void 0; + this.highlight.stashedHoverEvent = void 0; + const meta = TooltipManager.makeTooltipMeta(keyboardEvent, focus.series, datum, pick2.movedBounds); + this.chart.ctx.highlightManager.updateHighlight(this.id, datum); + if (this.isTooltipEnabled(focus.series)) { + this.chart.ctx.tooltipManager.updateTooltip(this.id, meta, tooltipContent); + } + } + this.maybeAnnouncePickedFocus( + datumIndexDelta, + oldDatumIndex, + otherIndexDelta, + oldOtherIndex, + pick2, + tooltipContent + ); + return 0 /* SUCCESS */; + } + maybeAnnouncePickedFocus(datumIndexDelta, oldDatumIndex, otherIndexDelta, oldOtherIndex, pick2, tooltipContent) { + const { focus } = this; + let mode; + if (this.announceMode === "when-changed") { + const shouldAnnouncePick = datumIndexDelta === 0 && otherIndexDelta === 0 || oldDatumIndex !== pick2.datumIndex || oldOtherIndex !== (pick2.otherIndex ?? focus.seriesIndex); + if (shouldAnnouncePick) { + mode = "always"; + } else { + mode = "never"; + } + } else { + mode = this.announceMode; + } + if (mode === "always") { + this.swapChain.update(this.getDatumAriaText(pick2.datum, tooltipContent)); + } + } + getDatumAriaText(datum, tooltipContent) { + const description = tooltipContent == null ? "" : tooltipContentAriaLabel(tooltipContent); + return this.chart.ctx.localeManager.t("ariaAnnounceHoverDatum", { + datum: datum.series.getDatumAriaText?.(datum, description) ?? description + }); + } + clearHighlight() { + this.highlight.pendingHoverEvent = void 0; + this.highlight.appliedHoverEvent = void 0; + this.chart.ctx.highlightManager.updateHighlight(this.id); + } + clearTooltip() { + this.chart.ctx.tooltipManager.removeTooltip(this.id); + this.tooltip.lastHover = void 0; + } + clearAll() { + this.clearHighlight(); + this.clearTooltip(); + this.focusIndicator?.clear(); + } + handleHoverHighlight(redisplay) { + this.highlight.appliedHoverEvent = this.highlight.pendingHoverEvent; + this.highlight.pendingHoverEvent = void 0; + const event = this.highlight.appliedHoverEvent; + if (!event || !this.isState(41 /* Clickable */)) + return; + const { currentX, currentY } = event; + const canvasX = event.currentX + (this.hoverRect?.x ?? 0); + const canvasY = event.currentY + (this.hoverRect?.y ?? 0); + if (redisplay ? this.chart.ctx.animationManager.isActive() : !this.hoverRect?.containsPoint(canvasX, canvasY)) { + this.clearHighlight(); + return; + } + const { range: range4 } = this.chart.highlight; + const intent = range4 === "tooltip" ? "highlight-tooltip" : "highlight"; + const pick2 = this.pickNodes({ x: currentX, y: currentY }, intent); + if (!pick2 || pick2.matches.length === 0) { + this.chart.ctx.highlightManager.updateHighlight(this.id); + return; + } + const { current: tooltipPick } = this.tooltipCandidates; + const tooltipMatch = tooltipPick == null ? void 0 : pick2.matches.find((m) => pickedNodesEqual(m, tooltipPick)); + const datum = tooltipMatch?.datum ?? pick2.matches[0].datum; + this.chart.ctx.highlightManager.updateHighlight(this.id, datum); + this.hoverDevice = "pointer"; + } + handleHoverTooltip(event, redisplay) { + const { current: previousHover } = this.tooltipCandidates; + this.tooltipCandidates.reset(); + if (!this.isState(41 /* Clickable */)) + return; + const { currentX, currentY } = event; + const canvasX = currentX + (this.hoverRect?.x ?? 0); + const canvasY = currentY + (this.hoverRect?.y ?? 0); + const targetElement = event.sourceEvent.target; + if (redisplay ? this.chart.ctx.animationManager.isActive() : !this.hoverRect?.containsPoint(canvasX, canvasY)) { + if (this.hoverDevice == "pointer") + this.clearTooltip(); + return; + } + if (targetElement && this.chart.tooltip.interactive && this.chart.ctx.domManager.isManagedChildDOMElement(targetElement, "canvas-overlay", DEFAULT_TOOLTIP_CLASS)) { + return; + } + const pick2 = this.pickNodes({ x: event.currentX, y: event.currentY }, "tooltip"); + if (!pick2 || pick2.matches.length === 0) { + if (this.hoverDevice == "pointer") + this.clearTooltip(); + return; + } + this.hoverDevice = "pointer"; + if (pick2.distance === 0) { + const { current, index, length: length2 } = this.tooltipCandidates.update( + pick2.matches, + this.chart.tooltip.pagination ? previousHover : void 0 + ); + this.showTooltip(current, canvasX, canvasY, { index, length: length2 }); + } else { + this.showTooltip(pick2.matches[0], canvasX, canvasY); + } + } + showTooltip({ series, datum, datumIndex }, canvasX, canvasY, pagination) { + const tooltipContent = this.getTooltipContent(series, datumIndex, datum, "tooltip"); + const shouldUpdateTooltip = tooltipContent != null; + if (shouldUpdateTooltip) { + const meta = TooltipManager.makeTooltipMeta( + { type: "pointermove", canvasX, canvasY }, + series, + datum, + void 0 + ); + this.chart.ctx.tooltipManager.updateTooltip(this.id, meta, tooltipContent, pagination); + } else { + this.chart.ctx.tooltipManager.removeTooltip(this.id); + } + } + maybeEnterInteractiveTooltip(event) { + return this.chart.tooltip.maybeEnterInteractiveTooltip(event, () => { + this.tooltip.lastHover = void 0; + this.chart.ctx.tooltipManager.removeTooltip(this.id); + this.chart.ctx.highlightManager.updateHighlight(this.id); + }); + } + changeHighlightDatum(event) { + const lastSeries = event.previousHighlight?.series; + const newSeries = event.currentHighlight?.series; + if (lastSeries?.properties.cursor && event.previousHighlight?.datum) { + this.chart.ctx.domManager.updateCursor(lastSeries.id); + } + if (newSeries?.properties.cursor && newSeries.properties.cursor !== "default" && event.currentHighlight?.datum) { + this.chart.ctx.domManager.updateCursor(newSeries.id, newSeries.properties.cursor); + } + if (newSeries == null || lastSeries == null) { + this.update(5 /* SERIES_UPDATE */, { clearCallbackCache: true }); + } else { + this.update(5 /* SERIES_UPDATE */, { + seriesToUpdate: new Set([lastSeries, newSeries].filter(Boolean)), + clearCallbackCache: true + }); + } + } + pickNodes(point, intent, exactMatchOnly) { + const reverseSeries = [...this.series].reverse(); + let result; + for (const series of reverseSeries) { + if (!series.visible || !series.contentGroup.visible) + continue; + const pick2 = series.pickNodes(point, intent, exactMatchOnly); + if (pick2 == null || pick2.datums.length === 0) + continue; + const { datums, distance: distance2 } = pick2; + if (pick2.datums.length === 0) + continue; + if (distance2 === 0) { + if (result?.distance !== 0) { + result = { matches: [], distance: 0 }; + } + for (const datum of datums) { + const { datumIndex } = datum; + result.matches.push({ series, datum, datumIndex }); + } + } else if (result == null || result.distance > distance2) { + const [datum] = datums; + const { datumIndex } = datum; + result = { matches: [{ series, datum, datumIndex }], distance: distance2 }; + } + } + return result; + } + isTooltipEnabled(series) { + return series.tooltipEnabled ?? this.chart.tooltip.enabled; + } + getTooltipContent(series, datumIndex, datum, purpose) { + let result; + if (purpose === "aria-label" || this.isTooltipEnabled(series)) { + const { cachedTooltipContent } = this; + if (cachedTooltipContent != null && cachedTooltipContent.series === series && cachedTooltipContent.datumIndex === datumIndex) { + result = cachedTooltipContent.content; + } else { + const content = this.chart.getTooltipContent(series, datumIndex, datum, purpose); + this.cachedTooltipContent = { series, datumIndex, content }; + result = content; + } + purpose; + result; + } else { + this.cachedTooltipContent = void 0; + purpose; + result; + } + return result; + } +}; +function excludesType(obj, excluded) { + return obj.type !== excluded; +} + +// packages/ag-charts-community/src/chart/series/seriesLayerManager.ts +var SERIES_THRESHOLD_FOR_AGGRESSIVE_LAYER_REDUCTION = 30; +var SeriesLayerManager = class { + constructor(seriesRoot) { + this.seriesRoot = seriesRoot; + this.groups = /* @__PURE__ */ new Map(); + this.series = /* @__PURE__ */ new Map(); + this.expectedSeriesCount = 1; + this.mode = "normal"; + } + setSeriesCount(count) { + this.expectedSeriesCount = count; + } + getGroupIndex(seriesConfig) { + const { internalId, seriesGrouping } = seriesConfig; + return seriesGrouping?.groupIndex ?? internalId; + } + getGroupType(seriesConfig, bringToFront) { + return bringToFront ? "top" : seriesConfig.type; + } + requestGroup(seriesConfig) { + const { internalId, contentGroup: seriesContentGroup } = seriesConfig; + const bringToFront = seriesConfig.bringToFront(); + const type = this.getGroupType(seriesConfig, bringToFront); + const groupIndex = this.getGroupIndex(seriesConfig); + const seriesInfo = this.series.get(internalId); + if (seriesInfo != null) { + throw new Error(`AG Charts - series already has an allocated layer: ${JSON.stringify(seriesInfo)}`); + } + if (this.series.size === 0) { + this.mode = this.expectedSeriesCount >= SERIES_THRESHOLD_FOR_AGGRESSIVE_LAYER_REDUCTION ? "aggressive-grouping" : "normal"; + } + let group = this.groups.get(type); + if (group == null) { + group = /* @__PURE__ */ new Map(); + this.groups.set(type, group); + } + const lookupIndex = this.lookupIdx(groupIndex); + let groupInfo = group.get(lookupIndex); + if (groupInfo == null) { + groupInfo = { + type, + id: lookupIndex, + seriesIds: [], + group: this.seriesRoot.appendChild( + new Group({ + name: `${seriesConfig.contentGroup.name ?? type}-managed-layer`, + zIndex: seriesConfig.contentGroup.zIndex, + // Set in updateLayerCompositing + renderToOffscreenCanvas: false + }) + ) + }; + group.set(lookupIndex, groupInfo); + } + this.series.set(internalId, { layerState: groupInfo, seriesConfig, bringToFront }); + groupInfo.seriesIds.push(internalId); + groupInfo.group.appendChild(seriesContentGroup); + return groupInfo.group; + } + changeGroup(seriesConfig) { + const { internalId, contentGroup } = seriesConfig; + const bringToFront = seriesConfig.bringToFront(); + const type = this.getGroupType(seriesConfig, bringToFront); + const oldGroup = this.series.get(internalId); + const oldType = oldGroup ? this.getGroupType(oldGroup.seriesConfig, oldGroup.bringToFront) : void 0; + const groupIndex = this.getGroupIndex(seriesConfig); + const lookupIndex = this.lookupIdx(groupIndex); + const groupInfo = this.groups.get(type)?.get(lookupIndex); + if (oldType === type && groupInfo?.seriesIds.includes(internalId) === true) { + return; + } + if (this.series.has(internalId)) { + this._releaseGroup({ internalId, contentGroup, type: oldType }); + } + return this.requestGroup(seriesConfig); + } + releaseGroup(seriesConfig) { + const { internalId, contentGroup } = seriesConfig; + const type = this.getGroupType(seriesConfig, seriesConfig.bringToFront()); + this._releaseGroup({ internalId, contentGroup, type }); + } + _releaseGroup(seriesConfig) { + const { internalId, contentGroup, type } = seriesConfig; + if (!this.series.has(internalId)) { + throw new Error(`AG Charts - series doesn't have an allocated layer: ${internalId}`); + } + const groupInfo = this.series.get(internalId)?.layerState; + if (groupInfo) { + groupInfo.seriesIds = groupInfo.seriesIds.filter((v) => v !== internalId); + contentGroup.remove(); + } + if (groupInfo?.seriesIds.length === 0) { + groupInfo.group.remove(); + this.groups.get(groupInfo.type)?.delete(groupInfo.id); + this.groups.get(type)?.delete(internalId); + } else if (groupInfo != null && groupInfo.seriesIds.length > 0) { + groupInfo.group.zIndex = this.getLowestSeriesZIndex(groupInfo.seriesIds); + } + this.series.delete(internalId); + } + updateLayerCompositing() { + for (const groups of this.groups.values()) { + for (const groupInfo of groups.values()) { + const { group, seriesIds } = groupInfo; + let renderToOffscreenCanvas; + if (seriesIds.length === 0) { + renderToOffscreenCanvas = false; + } else if (seriesIds.length > 1) { + renderToOffscreenCanvas = true; + } else { + const series = this.series.get(seriesIds[0]); + renderToOffscreenCanvas = series?.seriesConfig.renderToOffscreenCanvas() === true; + } + group.renderToOffscreenCanvas = renderToOffscreenCanvas; + group.zIndex = this.getLowestSeriesZIndex(seriesIds); + } + } + } + lookupIdx(groupIndex) { + if (this.mode === "normal") { + return groupIndex; + } + if (typeof groupIndex === "string") { + groupIndex = Number(groupIndex.split("-").at(-1)); + if (!Number.isFinite(groupIndex)) { + return 0; + } + } + return Math.floor( + clamp(0, groupIndex / this.expectedSeriesCount, 1) * SERIES_THRESHOLD_FOR_AGGRESSIVE_LAYER_REDUCTION + ); + } + destroy() { + for (const groups of this.groups.values()) { + for (const groupInfo of groups.values()) { + groupInfo.group.remove(); + } + } + this.groups.clear(); + this.series.clear(); + } + getLowestSeriesZIndex(seriesIds) { + let lowestSeriesZIndex = void 0; + for (const seriesId of seriesIds) { + const series = this.series.get(seriesId); + const zIndex = series?.seriesConfig.contentGroup.zIndex ?? 1 /* ANY_CONTENT */; + if (lowestSeriesZIndex == null || zIndex == null) { + lowestSeriesZIndex = zIndex; + continue; + } + lowestSeriesZIndex = compareZIndex(lowestSeriesZIndex, zIndex) <= 0 ? lowestSeriesZIndex : zIndex; + } + return lowestSeriesZIndex ?? 1 /* ANY_CONTENT */; + } +}; + +// packages/ag-charts-community/src/chart/touch.ts +var Touch = class extends BaseProperties { + constructor() { + super(...arguments); + this.dragAction = "drag"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], Touch.prototype, "dragAction", 2); + +// packages/ag-charts-community/src/chart/update/dataWindowProcessor.ts +var DataWindowProcessor = class { + constructor(chart, eventsHub, dataService, updateService, zoomManager, animationManager) { + this.chart = chart; + this.eventsHub = eventsHub; + this.dataService = dataService; + this.updateService = updateService; + this.zoomManager = zoomManager; + this.animationManager = animationManager; + this.dirtyZoom = false; + this.dirtyDataSource = false; + this.lastAxisZooms = /* @__PURE__ */ new Map(); + this.cleanup = new CleanupRegistry(); + this.cleanup.register( + this.eventsHub.on("data:source-change", () => this.onDataSourceChange()), + this.eventsHub.on("data:load", () => this.onDataLoad()), + this.eventsHub.on("data:error", () => this.onDataError()), + this.updateService.addListener("update-complete", (e) => this.onUpdateComplete(e)), + this.eventsHub.on("zoom:change", () => this.onZoomChange()) + ); + } + destroy() { + this.cleanup.flush(); + } + onDataLoad() { + this.animationManager.skip(); + this.updateService.update(1 /* UPDATE_DATA */); + } + onDataError() { + this.updateService.update(4 /* PERFORM_LAYOUT */); + } + onDataSourceChange() { + this.dirtyDataSource = true; + } + onUpdateComplete(event) { + if (!event.apiUpdate && !this.dirtyZoom && !this.dirtyDataSource) + return; + this.updateWindow(event); + } + onZoomChange() { + this.dirtyZoom = true; + } + updateWindow(event) { + if (!this.dataService.isLazy()) + return; + const axis = this.getValidAxis(); + let window; + let shouldRefresh = true; + if (axis) { + const zoom = this.zoomManager.getAxisZoom(axis.id); + if (zoom.min !== 0 || zoom.max !== 1) { + window = this.getAxisWindow(axis, zoom); + } + shouldRefresh = this.shouldRefresh(event, axis, zoom); + } + this.dirtyZoom = false; + this.dirtyDataSource = false; + if (!shouldRefresh) + return; + this.dataService.load({ windowStart: window?.min, windowEnd: window?.max }); + } + getValidAxis() { + return this.chart.axes.find((axis) => axis.type === "time"); + } + shouldRefresh(event, axis, zoom) { + if (event.apiUpdate) + return true; + if (this.dirtyDataSource) + return true; + if (!this.dirtyZoom) + return false; + const lastZoom = this.lastAxisZooms.get(axis.id); + if (lastZoom && zoom.min === lastZoom.min && zoom.max === lastZoom.max) { + return false; + } + this.lastAxisZooms.set(axis.id, zoom); + return true; + } + getAxisWindow(axis, zoom) { + const { domain } = axis.scale; + if (!zoom || domain.length === 0 || Number.isNaN(Number(domain[0]))) + return; + const diff8 = Number(domain[1]) - Number(domain[0]); + const min = new Date(Number(domain[0]) + diff8 * zoom.min); + const max = new Date(Number(domain[0]) + diff8 * zoom.max); + return { min, max }; + } +}; + +// packages/ag-charts-community/src/util/browser.ts +var isSafariRegexp = /^((?!chrome|android).)*safari/i; +var safariVersionRegexp = /Version\/(\d+(\.\d+)?)/; +var isChromeRegexp = /Chrome/; +var chromeVersionRegexp = /Chrome\/(\d+)/; +var isEdge = /Edg/; +var isOpera = /OPR/; +function isUnsupportedBrowser() { + const { userAgent } = getWindow("navigator"); + if (isSafariRegexp.test(userAgent)) { + const versionExec = safariVersionRegexp.exec(userAgent); + if (versionExec == null) + return false; + const version = Number.parseFloat(versionExec[1]); + const supported = Math.floor(version) > 16; + if (!supported) { + logger_exports.warnOnce(`Unsupported Safari version: ${version}; ${userAgent}`); + } + return !supported; + } else if (isChromeRegexp.test(userAgent) && !isEdge.test(userAgent) && !isOpera.test(userAgent)) { + const versionExec = chromeVersionRegexp.exec(userAgent); + if (versionExec == null) + return false; + const version = Number.parseInt(versionExec[1], 10); + const supported = version > 126; + if (!supported) { + logger_exports.warnOnce(`Unsupported Chrome version: ${version}; ${userAgent}`); + } + return !supported; + } + return false; +} + +// packages/ag-charts-community/src/chart/update/overlaysProcessor.ts +var visibleIgnoredSeries = /* @__PURE__ */ new Set(["map-shape-background", "map-line-background"]); +var OverlaysProcessor = class { + constructor(chartLike, overlays, eventsHub, dataService, localeManager, animationManager, domManager) { + this.chartLike = chartLike; + this.overlays = overlays; + this.eventsHub = eventsHub; + this.dataService = dataService; + this.localeManager = localeManager; + this.animationManager = animationManager; + this.domManager = domManager; + this.cleanup = new CleanupRegistry(); + this.overlayElem = this.domManager.addChild("canvas-overlay", "overlay"); + this.overlayElem.role = "status"; + this.overlayElem.ariaAtomic = "false"; + this.overlayElem.ariaLive = "polite"; + this.overlayElem.classList.toggle(DEFAULT_OVERLAY_CLASS); + this.cleanup.register(this.eventsHub.on("layout:complete", (e) => this.onLayoutComplete(e))); + } + destroy() { + this.cleanup.flush(); + this.domManager.removeChild("canvas-overlay", "overlay"); + } + onLayoutComplete({ series: { rect: rect2 } }) { + const isLoading = this.dataService.isLoading(); + const hasData = this.chartLike.series.some((s) => s.hasData); + const anySeriesVisible = this.chartLike.series.some((s) => s.visible && !visibleIgnoredSeries.has(s.type)); + if (this.overlays.darkTheme) { + this.overlayElem.classList.add(DEFAULT_OVERLAY_DARK_CLASS); + } else { + this.overlayElem.classList.remove(DEFAULT_OVERLAY_DARK_CLASS); + } + this.overlayElem.style.left = `${rect2.x}px`; + this.overlayElem.style.top = `${rect2.y}px`; + this.overlayElem.style.width = `${rect2.width}px`; + this.overlayElem.style.height = `${rect2.height}px`; + const loadingShown = isLoading; + const noDataShown = !isLoading && !hasData; + const noVisibleSeriesShown = hasData && !anySeriesVisible; + const unsupportedBrowser = this.overlays.unsupportedBrowser.enabled && isUnsupportedBrowser(); + if (loadingShown) { + this.showOverlay(this.overlays.loading, rect2); + } else { + this.hideOverlay(this.overlays.loading); + } + if (noDataShown) { + this.showOverlay(this.overlays.noData, rect2); + } else { + this.hideOverlay(this.overlays.noData); + } + if (noVisibleSeriesShown) { + this.showOverlay(this.overlays.noVisibleSeries, rect2); + } else { + this.hideOverlay(this.overlays.noVisibleSeries); + } + if (unsupportedBrowser) { + this.showOverlay(this.overlays.unsupportedBrowser, rect2); + } else { + this.hideOverlay(this.overlays.unsupportedBrowser); + } + const shown = loadingShown || noDataShown || noVisibleSeriesShown || unsupportedBrowser; + setAttribute(this.overlayElem, "aria-hidden", !shown); + } + showOverlay(overlay, seriesRect) { + if (!overlay.enabled) + return; + const element2 = overlay.getElement(this.chartLike, this.animationManager, this.localeManager, seriesRect); + this.overlayElem.appendChild(element2); + } + hideOverlay(overlay) { + overlay.removeElement(() => { + this.overlayElem.innerText = "\xA0"; + }, this.animationManager); + } +}; + +// packages/ag-charts-community/src/chart/chart.ts +var debug = Debug.create(true, "opts"); +var _Chart = class _Chart extends Observable { + constructor(options, resources) { + var _a; + super(); + this.id = createId(this); + this.seriesRoot = new TranslatableGroup({ + name: `${this.id}-series-root`, + zIndex: 7 /* SERIES_LAYER */ + }); + this.annotationRoot = new TranslatableGroup({ + name: `${this.id}-annotation-root`, + zIndex: 11 /* SERIES_ANNOTATION */ + }); + this.titleGroup = new Group({ + name: "titles", + zIndex: 15 /* SERIES_LABEL */ + }); + this.debug = Debug.create(); + this.extraDebugStats = {}; + this.data = DataSet.empty(); + this._firstAutoSize = true; + this._autoSizeNotify = new AsyncAwaitQueue(); + this.chartCaptions = new ChartCaptions(); + this.padding = new Padding(20); + this.keyboard = new Keyboard(); + this.touch = new Touch(); + this.mode = "standalone"; + this.styleNonce = void 0; + this.formatter = void 0; + this.suppressFieldDotNotation = false; + this.loadGoogleFonts = false; + this.destroyed = false; + this.cleanup = new CleanupRegistry(); + this.chartAnimationPhase = "initial"; + this.modulesManager = new ModulesManager(); + this.processors = []; + this.queuedUserOptions = []; + this.queuedChartOptions = []; + this.firstApply = true; + this.syncStatus = "init"; + // Use a wrapper to comply with the @typescript-eslint/unbound-method rule. + this.fireEventWrapper = (event) => super.fireEvent(event); + this.apiUpdate = false; + this._pendingFactoryUpdatesCount = 0; + this._performUpdateSkipAnimations = false; + this._performUpdateNotify = new AsyncAwaitQueue(); + this.performUpdateType = 8 /* NONE */; + this.runningUpdateType = 8 /* NONE */; + this.updateShortcutCount = 0; + this.seriesToUpdate = /* @__PURE__ */ new Set(); + this.updateMutex = new Mutex(); + this.clearCallbackCacheOnUpdate = false; + this.updateRequestors = {}; + this.performUpdateTrigger = debouncedCallback(({ count }) => { + if (this.destroyed) + return; + this.updateMutex.acquire(async () => { + try { + await this.performUpdate(count); + } catch (error2) { + logger_exports.error("update error", error2, error2.stack); + } + }).catch((e) => logger_exports.errorOnce(e)); + }); + this._performUpdateSplits = {}; + this._previousSplit = 0; + this.axes = []; + this.series = []; + this._cachedData = void 0; + this.onSeriesNodeClick = (event) => { + this.fireEvent(event); + }; + this.onSeriesNodeDoubleClick = (event) => { + this.fireEvent(event); + }; + this.onSeriesVisibilityChange = (event) => { + this.fireEvent(event); + }; + this.seriesGroupingChanged = (event) => { + if (!(event instanceof SeriesGroupingChangedEvent)) + return; + const { series, seriesGrouping } = event; + if (series.contentGroup.isRoot()) + return; + const seriesContentNode = this.seriesLayerManager.changeGroup({ + internalId: series.internalId, + type: series.type, + contentGroup: series.contentGroup, + bringToFront: () => series.bringToFront(), + renderToOffscreenCanvas: () => series.renderToOffscreenCanvas(), + seriesGrouping + }); + if (seriesContentNode != null) { + series.attachSeries(seriesContentNode, this.seriesRoot, this.annotationRoot); + } + }; + this.chartOptions = options; + const scene = resources?.scene; + const container = resources?.container ?? options.processedOptions.container ?? void 0; + const styleContainer = resources?.styleContainer ?? options.specialOverrides.styleContainer; + if (scene) { + this._firstAutoSize = false; + this._lastAutoSize = [scene.width, scene.height, scene.pixelRatio]; + } + const root = new Group({ name: "root" }); + root.visible = false; + root.append(this.seriesRoot); + root.append(this.annotationRoot); + root.append(this.titleGroup); + this.titleGroup.append(this.title.node); + this.titleGroup.append(this.subtitle.node); + this.titleGroup.append(this.footnote.node); + this.tooltip = new Tooltip(); + this.seriesLayerManager = new SeriesLayerManager(this.seriesRoot); + this.mode = options.userOptions.mode ?? this.mode; + this.styleNonce = options.processedOptions.styleNonce; + const ctx = this.ctx = new ChartContext(this, { + chartType: this.getChartType(), + scene, + root, + container, + styleContainer, + domMode: options.optionMetadata.domMode, + withDragInterpretation: options.optionMetadata.withDragInterpretation ?? true, + syncManager: new SyncManager(this), + fireEvent: (event) => this.fireEvent(event), + updateCallback: (type, opts) => this.update(type, opts), + updateMutex: this.updateMutex + }); + this.cleanup.register(ctx.eventsHub.on("dom:resize", () => this.parentResize(ctx.domManager.containerSize))); + this.overlays = new ChartOverlays(); + (_a = this.overlays.loading).renderer ?? (_a.renderer = () => getLoadingSpinner(this.overlays.loading.getText(ctx.localeManager), ctx.animationManager.defaultDuration)); + this.processors = [ + new DataWindowProcessor( + this, + ctx.eventsHub, + ctx.dataService, + ctx.updateService, + ctx.zoomManager, + ctx.animationManager + ), + new OverlaysProcessor( + this, + this.overlays, + ctx.eventsHub, + ctx.dataService, + ctx.localeManager, + ctx.animationManager, + ctx.domManager + ) + ]; + this.highlight = new ChartHighlight(); + this.container = container; + const moduleContext = this.getModuleContext(); + ctx.domManager.setDataBoolean("animating", false); + ctx.domManager.setDataNumber("animationTimeMs", 0); + this.seriesAreaManager = new SeriesAreaManager(this.initSeriesAreaDependencies()); + this.cleanup.register( + ctx.layoutManager.registerElement(0 /* Caption */, (e) => { + e.layoutBox.shrink(this.padding.toJson()); + this.chartCaptions.positionCaptions(e); + }), + ctx.eventsHub.on("layout:complete", (e) => this.chartCaptions.positionAbsoluteCaptions(e)), + ctx.eventsHub.on("data:load", (event) => { + this.data = new DataSet(event.data); + }), + this.title.registerInteraction(moduleContext, "beforebegin"), + this.subtitle.registerInteraction(moduleContext, "beforebegin"), + this.footnote.registerInteraction(moduleContext, "afterend"), + Widget.addWindowEvent("page-left", () => this.destroy()), + ctx.animationManager.addListener("animation-frame", () => { + this.update(7 /* SCENE_RENDER */); + ctx.domManager.setDataNumber("animationTimeMs", ctx.animationManager.getCumulativeAnimationTime()); + }), + ctx.animationManager.addListener("animation-start", () => ctx.domManager.setDataBoolean("animating", true)), + ctx.animationManager.addListener("animation-stop", () => { + ctx.domManager.setDataBoolean("animating", false); + ctx.domManager.setDataNumber("animationTimeMs", ctx.animationManager.getCumulativeAnimationTime()); + }), + ctx.eventsHub.on("zoom:change", () => { + for (const s of this.series) { + s.animationState?.transition("updateData"); + } + const skipAnimations = this.chartAnimationPhase !== "initial"; + this.update(4 /* PERFORM_LAYOUT */, { forceNodeDataRefresh: true, skipAnimations }); + }) + ); + this.parentResize(ctx.domManager.containerSize); + } + static getInstance(element2) { + return _Chart.chartsInstances.get(element2); + } + /** NOTE: This is exposed for use by Integrated charts only. */ + get canvasElement() { + return this.ctx.scene.canvas.element; + } + download(fileName, fileFormat) { + this.ctx.scene.download(fileName, fileFormat); + } + getCanvasDataURL(fileFormat) { + return this.ctx.scene.getDataURL(fileFormat); + } + toSVG() { + return this.ctx.scene.toSVG(); + } + get seriesAreaBoundingBox() { + return this.seriesAreaManager.bbox; + } + getOptions() { + return this.queuedUserOptions.at(-1) ?? this.chartOptions.userOptions; + } + getChartOptions() { + return this.queuedChartOptions.at(-1) ?? this.chartOptions; + } + overrideFocusVisible(visible) { + this.seriesAreaManager.focusIndicator?.overrideFocusVisible(visible); + } + fireEvent(event) { + callWithContext(this, this.fireEventWrapper, event); + } + initSeriesAreaDependencies() { + const { ctx, tooltip, highlight: highlight5, overlays, seriesRoot, mode } = this; + const chartType = this.getChartType(); + const fireEvent = this.fireEvent.bind(this); + const getUpdateType = () => this.performUpdateType; + const getTooltipContent = (series, datumIndex, removeThisDatum, purpose) => this.getTooltipContent(series, datumIndex, removeThisDatum, purpose); + return { + fireEvent, + getUpdateType, + getTooltipContent, + chartType, + ctx, + tooltip, + highlight: highlight5, + overlays, + seriesRoot, + mode + }; + } + getModuleContext() { + return this.ctx; + } + getTooltipContent(series, datumIndex, removeMeDatum, purpose) { + const useTooltip = purpose === "aria-label" || series.properties.tooltip.enabled !== false; + const baseTooltipContent = useTooltip ? series.getTooltipContent(datumIndex, removeMeDatum) : void 0; + const tooltipContent = baseTooltipContent == null ? [] : [baseTooltipContent]; + if (this.tooltip.mode !== "shared" || this.series.length === 1) { + return tooltipContent; + } + const categoryValue = series.getCategoryValue(datumIndex); + if (categoryValue == null) + return tooltipContent; + return this.series.flatMap((s) => { + if (s === series) + return tooltipContent; + if (!s.isEnabled() || s.properties.tooltip.enabled === false) + return []; + const seriesDatumIndex = s.datumIndexForCategoryValue(categoryValue); + const seriesTooltipContent = seriesDatumIndex == null ? void 0 : s.getTooltipContent(seriesDatumIndex, void 0); + return seriesTooltipContent == null ? [] : [seriesTooltipContent]; + }); + } + getCaptionText() { + return [this.title, this.subtitle, this.footnote].filter((caption) => caption.enabled && caption.text).map((caption) => caption.text).join(". "); + } + getAriaLabel() { + return this.ctx.localeManager.t("ariaAnnounceChart", { seriesCount: this.series.length }); + } + resetAnimations() { + this.chartAnimationPhase = "initial"; + for (const series of this.series) { + series.resetAnimation(this.chartAnimationPhase); + } + for (const axis of this.axes) { + axis.resetAnimation(this.chartAnimationPhase); + } + this.animationRect = void 0; + this.ctx.animationManager.reset(); + } + skipAnimations() { + this.ctx.animationManager.skipCurrentBatch(); + this._performUpdateSkipAnimations = true; + } + detachAndClear() { + this.container = void 0; + this.ctx.scene.clearCanvas(); + } + destroy(opts) { + if (this.destroyed) { + return; + } + const keepTransferableResources = opts?.keepTransferableResources; + let result; + this.performUpdateType = 8 /* NONE */; + this.cleanup.flush(); + for (const p of this.processors) { + p.destroy(); + } + this.overlays.destroy(); + this.modulesManager.destroy(); + if (keepTransferableResources) { + this.ctx.scene.strip(); + result = { + container: this.container, + scene: this.ctx.scene + }; + } else { + this.ctx.scene.destroy(); + this.container = void 0; + } + this.destroySeries(this.series); + this.seriesLayerManager.destroy(); + for (const a of this.axes) { + a.destroy(); + } + this.axes = []; + this.animationRect = void 0; + this.ctx.destroy(); + this.destroyed = true; + Object.freeze(this); + return result; + } + requestFactoryUpdate(cb) { + if (this.destroyed) + return; + this._pendingFactoryUpdatesCount++; + this.updateMutex.acquire(async () => { + if (this.destroyed) + return; + try { + await cb(this); + } finally { + if (!this.destroyed) { + this._pendingFactoryUpdatesCount--; + } + } + }).catch((e) => logger_exports.errorOnce(e)); + } + clearCallbackCache() { + this.ctx.callbackCache.invalidateCache(); + for (const series of this.series) { + series.resetDatumCallbackCache(); + } + } + update(type = 0 /* FULL */, opts) { + if (this.destroyed) + return; + const { + forceNodeDataRefresh = false, + skipAnimations, + seriesToUpdate = this.series, + newAnimationBatch, + apiUpdate = false, + clearCallbackCache = false + } = opts ?? {}; + this.apiUpdate = apiUpdate; + this.ctx.widgets.seriesWidget.setDragTouchEnabled(this.touch.dragAction !== "none"); + if (forceNodeDataRefresh) { + for (const series of this.series) { + series.markNodeDataDirty(); + } + } + for (const series of seriesToUpdate) { + this.seriesToUpdate.add(series); + } + if (skipAnimations) { + this.ctx.animationManager.skipCurrentBatch(); + this._performUpdateSkipAnimations = true; + } + if (newAnimationBatch && this.ctx.animationManager.isActive()) { + this._performUpdateSkipAnimations = true; + } + if (type === 0 /* FULL */ || clearCallbackCache) { + this.clearCallbackCacheOnUpdate = true; + } + if (this.debug.check()) { + let stack = new Error("Stack trace for update tracking").stack ?? ""; + stack = stack.replaceAll(/\([^)]*/g, ""); + this.updateRequestors[stack] = type; + } + if (type < this.performUpdateType) { + this.performUpdateType = type; + this.ctx.domManager.setDataBoolean("updatePending", true); + this.performUpdateTrigger.schedule(opts?.backOffMs); + } + } + updateSplits(splitName) { + const splits = this._performUpdateSplits; + splits[splitName] ?? (splits[splitName] = 0); + splits[splitName] += performance.now() - this._previousSplit; + this._previousSplit = performance.now(); + } + async performUpdate(count) { + const { performUpdateType, extraDebugStats, _performUpdateSplits: splits, ctx } = this; + const seriesToUpdate = [...this.seriesToUpdate]; + if (this.clearCallbackCacheOnUpdate) { + this.clearCallbackCacheOnUpdate = false; + this.clearCallbackCache(); + } + this.performUpdateType = 8 /* NONE */; + this.seriesToUpdate.clear(); + this.runningUpdateType = performUpdateType; + if (this.updateShortcutCount === 0 && performUpdateType < 7 /* SCENE_RENDER */) { + ctx.animationManager.startBatch(this._performUpdateSkipAnimations); + ctx.animationManager.onBatchStop(() => this.chartAnimationPhase = "ready"); + } + this.ctx.scene.updateDebugFlags(); + this.debug("Chart.performUpdate() - start", ChartUpdateType[performUpdateType]); + this._previousSplit = performance.now(); + splits.start ?? (splits.start = this._previousSplit); + switch (performUpdateType) { + case 0 /* FULL */: + if (this.checkUpdateShortcut(0 /* FULL */)) + break; + this.ctx.updateService.dispatchPreDomUpdate(); + this.updateDOM(); + case 1 /* UPDATE_DATA */: + if (this.checkUpdateShortcut(1 /* UPDATE_DATA */)) + break; + await this.updateData(); + this.updateSplits("\u2B07\uFE0F"); + case 2 /* PROCESS_DATA */: + if (this.checkUpdateShortcut(2 /* PROCESS_DATA */)) + break; + await this.processData(); + this.seriesAreaManager.dataChanged(); + this.updateSplits("\u{1F4CA}"); + case 3 /* PROCESS_DOMAIN */: + if (this.checkUpdateShortcut(3 /* PROCESS_DOMAIN */)) + break; + await this.processDomains(); + this.updateSplits("\u26F0\uFE0F"); + case 4 /* PERFORM_LAYOUT */: + await this.checkFirstAutoSize(); + if (this.checkUpdateShortcut(4 /* PERFORM_LAYOUT */)) + break; + await this.processLayout(); + this.updateSplits("\u2316"); + case 5 /* SERIES_UPDATE */: { + if (this.checkUpdateShortcut(5 /* SERIES_UPDATE */)) + break; + this.seriesRoot.renderToOffscreenCanvas = this.highlight.drawingMode === "cutout"; + await this.updateSeries(seriesToUpdate); + this.updateAriaLabels(); + this.seriesLayerManager.updateLayerCompositing(); + this.updateSplits("\u{1F914}"); + } + case 6 /* PRE_SCENE_RENDER */: + if (this.checkUpdateShortcut(6 /* PRE_SCENE_RENDER */)) + break; + ctx.updateService.dispatchPreSceneRender(); + this.updateSplits("\u2196"); + case 7 /* SCENE_RENDER */: + if (this.checkUpdateShortcut(7 /* SCENE_RENDER */)) + break; + ctx.animationManager.endBatch(); + extraDebugStats["updateShortcutCount"] = this.updateShortcutCount; + ctx.scene.render({ debugSplitTimes: splits, extraDebugStats, seriesRect: this.seriesRect }); + this.extraDebugStats = {}; + for (const key of Object.keys(splits)) { + delete splits[key]; + } + this.ctx.domManager.incrementDataCounter("sceneRenders"); + this.ctx.domManager.postRenderUpdate(); + case 8 /* NONE */: + this.updateShortcutCount = 0; + this.updateRequestors = {}; + this._performUpdateSkipAnimations = false; + ctx.animationManager.endBatch(); + } + if (!this.destroyed) { + ctx.updateService.dispatchUpdateComplete(this.apiUpdate); + this.apiUpdate = false; + this.ctx.domManager.setDataBoolean("updatePending", false); + this.runningUpdateType = 8 /* NONE */; + this.syncStatus = "ready"; + } + this._performUpdateNotify.notify(); + const end3 = performance.now(); + this.debug("Chart.performUpdate() - end", { + chart: this, + durationMs: Math.round((end3 - splits["start"]) * 100) / 100, + count, + performUpdateType: ChartUpdateType[performUpdateType] + }); + } + updateThemeClassName() { + const themeClassNamePrefix = "ag-charts-theme-"; + const validThemeClassNames = [`${themeClassNamePrefix}default`, `${themeClassNamePrefix}default-dark`]; + let themeClassName = validThemeClassNames[0]; + let isDark = false; + let { theme } = this.chartOptions.processedOptions; + while (typeof theme !== "string" && theme != null) { + theme = theme.baseTheme; + } + if (typeof theme === "string") { + themeClassName = theme.replace("ag-", themeClassNamePrefix); + isDark = theme.includes("-dark"); + } + if (!validThemeClassNames.includes(themeClassName)) { + themeClassName = isDark ? validThemeClassNames[1] : validThemeClassNames[0]; + } + this.ctx.domManager.setThemeClass(themeClassName); + } + updateDOM() { + this.updateThemeClassName(); + const { enabled, tabIndex } = this.keyboard; + this.ctx.domManager.setTabGuardIndex(enabled ? tabIndex ?? 0 : -1); + this.ctx.domManager.setThemeParameters(this.chartOptions.themeParameters); + } + updateAriaLabels() { + this.ctx.domManager.updateCanvasLabel(this.getAriaLabel()); + } + checkUpdateShortcut(checkUpdateType) { + const maxShortcuts = 3; + if (this.destroyed) + return true; + if (this.updateShortcutCount > maxShortcuts) { + logger_exports.warn( + `exceeded the maximum number of simultaneous updates (${maxShortcuts + 1}), discarding changes and rendering`, + this.updateRequestors + ); + return false; + } + if (this.performUpdateType <= checkUpdateType) { + this.updateShortcutCount++; + return true; + } + return false; + } + async checkFirstAutoSize() { + if (this.width != null && this.height != null) { + } else if (!this._lastAutoSize) { + const success = await this._autoSizeNotify.await(500); + if (!success) { + this.debug("Chart.checkFirstAutoSize() - timeout for first size update."); + } + } + } + onAxisChange(newValue, oldValue) { + if (oldValue == null && newValue.length === 0) + return; + this.ctx.axisManager.updateAxes(oldValue ?? [], newValue); + } + onSeriesChange(newValue, oldValue) { + const seriesToDestroy = oldValue?.filter((series) => !newValue.includes(series)) ?? []; + this.destroySeries(seriesToDestroy); + this.seriesLayerManager?.setSeriesCount(newValue.length); + for (const series of newValue) { + if (oldValue?.includes(series)) + continue; + const seriesContentNode = this.seriesLayerManager.requestGroup(series); + series.attachSeries(seriesContentNode, this.seriesRoot, this.annotationRoot); + series.chart = {}; + Object.defineProperty(series.chart, "mode", { + get: () => this.mode + }); + Object.defineProperty(series.chart, "isMiniChart", { + get: () => false + }); + Object.defineProperty(series.chart, "seriesRect", { + get: () => this.seriesRect + }); + series.resetAnimation(this.chartAnimationPhase); + this.addSeriesListeners(series); + series.addChartEventListeners(); + } + this.seriesAreaManager?.seriesChanged(newValue); + } + destroySeries(allSeries) { + if (allSeries) { + for (const series of allSeries) { + series.removeEventListener("seriesNodeClick", this.onSeriesNodeClick); + series.removeEventListener("seriesNodeDoubleClick", this.onSeriesNodeDoubleClick); + series.removeEventListener("groupingChanged", this.seriesGroupingChanged); + series.destroy(); + this.seriesLayerManager.releaseGroup(series); + series.detachSeries(void 0, this.seriesRoot, this.annotationRoot); + series.chart = void 0; + } + } + } + addSeriesListeners(series) { + if (this.hasEventListener("seriesNodeClick")) { + series.addEventListener("seriesNodeClick", this.onSeriesNodeClick); + } + if (this.hasEventListener("seriesNodeDoubleClick")) { + series.addEventListener("seriesNodeDoubleClick", this.onSeriesNodeDoubleClick); + } + if (this.hasEventListener("seriesVisibilityChange")) { + series.addEventListener("seriesVisibilityChange", this.onSeriesVisibilityChange); + } + series.addEventListener("groupingChanged", this.seriesGroupingChanged); + } + assignSeriesToAxes() { + for (const axis of this.axes) { + axis.boundSeries = this.series.filter((s) => s.axes[axis.direction] === axis); + } + } + assignAxesToSeries() { + const directionToAxesMap = groupBy(this.axes, (axis) => axis.direction); + for (const series of this.series) { + for (const direction of series.directions) { + const directionAxes = directionToAxesMap[direction]; + if (!directionAxes) { + logger_exports.warnOnce( + `no available axis for direction [${direction}]; check series and axes configuration.` + ); + return; + } + const seriesKeys = series.getKeys(direction); + const newAxis = directionAxes.find( + (axis) => !axis.keys.length || seriesKeys.some((key) => axis.keys.includes(key)) + ); + if (!newAxis) { + logger_exports.warnOnce( + `no matching axis for direction [${direction}] and keys [${seriesKeys}]; check series and axes configuration.` + ); + return; + } + series.axes[direction] = newAxis; + } + } + } + parentResize(size) { + if (size == null || this.width != null && this.height != null) + return; + let { width: width2, height: height2 } = size; + const { pixelRatio } = size; + width2 = Math.floor(width2); + height2 = Math.floor(height2); + if (width2 === 0 && height2 === 0) + return; + const [autoWidth = 0, autoHeight = 0, autoPixelRatio = 1] = this._lastAutoSize ?? []; + if (autoWidth === width2 && autoHeight === height2 && autoPixelRatio === pixelRatio) + return; + this._lastAutoSize = [width2, height2, pixelRatio]; + this.resize("SizeMonitor", {}); + } + resize(source, opts) { + const { scene, animationManager } = this.ctx; + const { inWidth, inHeight, inMinWidth, inMinHeight, inOverrideDevicePixelRatio } = opts; + this.ctx.domManager.setSizeOptions( + inMinWidth ?? this.minWidth, + inMinHeight ?? this.minHeight, + inWidth ?? this.width, + inHeight ?? this.height + ); + const width2 = inWidth ?? this.width ?? this._lastAutoSize?.[0]; + const height2 = inHeight ?? this.height ?? this._lastAutoSize?.[1]; + const pixelRatio = inOverrideDevicePixelRatio ?? this.overrideDevicePixelRatio ?? this._lastAutoSize?.[2]; + this.debug(`Chart.resize() from ${source}`, { + width: width2, + height: height2, + pixelRatio, + stack: new Error("Stack trace for resize tracking").stack + }); + if (width2 == null || height2 == null || !isFiniteNumber(width2) || !isFiniteNumber(height2)) + return; + if (scene.resize(width2, height2, pixelRatio)) { + animationManager.reset(); + let skipAnimations = true; + if ((this.width == null || this.height == null) && this._firstAutoSize) { + skipAnimations = false; + this._firstAutoSize = false; + } + this.update(4 /* PERFORM_LAYOUT */, { forceNodeDataRefresh: true, skipAnimations }); + this._autoSizeNotify.notify(); + } + } + async updateData() { + for (const s of this.series) { + s.setChartData(this.data); + } + const moduleResults = this.modulesManager.mapModules((m) => m.updateData?.(this.data)); + await Promise.all( + moduleResults.filter((p) => p != null && typeof p === "object") + ); + } + async processData() { + if (this.series.some((s) => s.canHaveAxes)) { + this.assignAxesToSeries(); + this.assignSeriesToAxes(); + } + const dataController = new DataController(this.mode, this.suppressFieldDotNotation); + const seriesPromises = this.series.map((s) => s.processData(dataController)); + const modulePromises = this.modulesManager.mapModules((m) => m.processData?.(dataController)); + this._cachedData = dataController.execute(this._cachedData); + this.updateSplits("\u{1F3ED}"); + await Promise.all([...seriesPromises, ...modulePromises.filter((p) => p != null)]); + this.updateLegends(); + } + // eslint-disable-next-line @typescript-eslint/require-await + async processDomains() { + for (const axis of this.axes) { + axis.processData(); + } + for (const series of this.series) { + series.updatedDomains(); + } + } + updateLegends(initialStateLegend) { + for (const { legend, legendType } of this.modulesManager.legends()) { + if (legendType === "category") { + this.setCategoryLegendData(initialStateLegend); + } else { + this.setLegendData(legendType, legend); + } + } + } + setCategoryLegendData(initialState) { + const { + ctx: { legendManager, stateManager } + } = this; + if (initialState) { + for (const s of this.series) { + const seriesState = initialState.find((init) => init.seriesId === s.id); + s.onLegendInitialState("category", seriesState); + } + } + const legendData = this.series.flatMap((s) => { + const seriesLegendData = s.getLegendData("category"); + legendManager.updateData(s.id, seriesLegendData); + return seriesLegendData; + }); + if (initialState) { + stateManager.setStateAndRestore(legendManager, initialState); + return; + } + if (this.mode !== "integrated") { + const seriesMarkerFills = {}; + const seriesTypeMap = new Map(this.series.map((s) => [s.id, s.type])); + for (const { + seriesId, + symbol: { marker }, + label + } of legendData.filter((d) => !d.hideInLegend)) { + if (marker.fill == null) + continue; + const seriesType = seriesTypeMap.get(seriesId); + const markerFill = seriesMarkerFills[seriesType] ?? (seriesMarkerFills[seriesType] = /* @__PURE__ */ new Map()); + if (markerFill.has(label.text)) { + if (markerFill.get(label.text) !== marker.fill) { + logger_exports.warnOnce( + `legend item '${toPlainText(label.text)}' has multiple fill colors, this may cause unexpected behaviour.` + ); + } + } else { + markerFill.set(label.text, marker.fill); + } + } + } + legendManager.update(); + } + setLegendData(legendType, legend) { + legend.data = this.series.filter((s) => s.properties.showInLegend).flatMap((s) => s.getLegendData(legendType)); + } + async processLayout() { + const oldRect = this.animationRect; + const { width: width2, height: height2 } = this.ctx.scene; + const ctx = this.ctx.layoutManager.createContext(width2, height2); + await this.performLayout(ctx); + if (oldRect && !this.animationRect?.equals(oldRect)) { + this.ctx.animationManager.skipCurrentBatch(); + } + this.debug("Chart.performUpdate() - seriesRect", this.seriesRect); + } + async updateSeries(seriesToUpdate) { + const { seriesRect } = this; + await Promise.all( + seriesToUpdate.map((series) => series.update({ seriesRect })).filter((p) => p != null) + ); + this.ctx.seriesLabelLayoutManager.updateLabels( + this.series.filter((s) => s.visible && s.usesPlacedLabels), + this.padding, + this.seriesRect + ); + } + async waitForUpdate(timeoutMs, failOnTimeout) { + const agChartsDebugTimeout = getWindow("agChartsDebugTimeout"); + if (agChartsDebugTimeout == null) { + timeoutMs ?? (timeoutMs = 1e4); + failOnTimeout ?? (failOnTimeout = false); + } else { + timeoutMs = agChartsDebugTimeout; + failOnTimeout ?? (failOnTimeout = true); + } + const start2 = performance.now(); + while (this._pendingFactoryUpdatesCount > 0 || this.performUpdateType !== 8 /* NONE */ || this.runningUpdateType !== 8 /* NONE */ || this.ctx.scene.waitingForUpdate() || this.data.hasPendingTransactions()) { + if (this.destroyed) + break; + if (this._pendingFactoryUpdatesCount > 0) { + await this.updateMutex.waitForClearAcquireQueue(); + } + if (this.performUpdateType !== 8 /* NONE */ || this.runningUpdateType !== 8 /* NONE */ || this.data.hasPendingTransactions()) { + await this._performUpdateNotify.await(); + } + if (performance.now() - start2 > timeoutMs) { + const message = `Chart.waitForUpdate() timeout of ${timeoutMs} reached - first chart update taking too long.`; + if (failOnTimeout) { + throw new Error(message); + } else { + logger_exports.warnOnce(message); + } + } + if (isInputPending()) { + await pause(); + } + if (this.ctx.scene.waitingForUpdate()) { + await pause(50); + } + } + } + filterMiniChartSeries(series) { + return series?.filter((s) => s.showInMiniChart !== false); + } + applyOptions(newChartOptions) { + const minimumUpdateType = 4 /* PERFORM_LAYOUT */; + const deltaOptions = this.firstApply ? newChartOptions.processedOptions : newChartOptions.diffOptions(this.chartOptions); + if (deltaOptions == null || Object.keys(deltaOptions).length === 0) { + debug("Chart.applyOptions() - no delta, forcing re-layout", deltaOptions); + this.update(minimumUpdateType, { apiUpdate: true, newAnimationBatch: true }); + return; + } + const oldOpts = this.firstApply ? {} : this.chartOptions.processedOptions; + const newOpts = newChartOptions.processedOptions; + debug("Chart.applyOptions() - applying delta", deltaOptions); + const modulesChanged = this.applyModules(newOpts); + const skip = [ + "type", + "data", + "series", + "listeners", + "preset", + "theme", + "legend.listeners", + "navigator.miniChart.series", + "navigator.miniChart.label", + "locale.localeText", + "axes", + "topology", + "nodes", + "initialState", + "styleContainer", + "formatter" + ]; + if (deltaOptions.listeners) { + this.registerListeners(this, deltaOptions.listeners); + } + jsonApply(this, deltaOptions, { skip }); + let forceNodeDataRefresh = false; + let seriesStatus = "no-op"; + if (deltaOptions.series != null) { + seriesStatus = this.applySeries(this, deltaOptions.series, oldOpts?.series); + forceNodeDataRefresh = true; + } + if (seriesStatus === "replaced") { + this.resetAnimations(); + } + if (this.applyAxes(this, newOpts, oldOpts, seriesStatus, [])) { + forceNodeDataRefresh = true; + } + if (deltaOptions.data) { + this.data = new DataSet(deltaOptions.data); + } + if (deltaOptions.legend?.listeners && this.modulesManager.isEnabled("legend")) { + Object.assign(this.legend.listeners, deltaOptions.legend.listeners); + } + if (deltaOptions.locale?.localeText) { + this.modulesManager.getModule("locale").localeText = deltaOptions.locale?.localeText; + } + this.chartOptions = newChartOptions; + const navigatorModule = this.modulesManager.getModule("navigator"); + const zoomModule = this.modulesManager.getModule("zoom"); + if (!navigatorModule?.enabled && !zoomModule?.enabled) { + this.ctx.zoomManager.updateZoom("chart"); + } + const miniChart = navigatorModule?.miniChart; + const miniChartSeries = newOpts.navigator?.miniChart?.series ?? newOpts.series; + if (miniChart?.enabled === true && miniChartSeries != null) { + this.applyMiniChartOptions(miniChart, miniChartSeries, newOpts, oldOpts); + } else if (miniChart?.enabled === false) { + miniChart.series = []; + miniChart.axes = []; + } + this.ctx.annotationManager.setAnnotationStyles(newChartOptions.annotationThemes); + forceNodeDataRefresh || (forceNodeDataRefresh = this.shouldForceNodeDataRefresh(deltaOptions, seriesStatus)); + const majorChange = forceNodeDataRefresh || modulesChanged; + const updateType = majorChange ? 0 /* FULL */ : minimumUpdateType; + this.maybeResetAnimations(seriesStatus); + if (this.shouldClearLegendData(newOpts, oldOpts, seriesStatus)) { + this.ctx.legendManager.clearData(); + } + this.applyInitialState(newOpts); + this.ctx.formatManager.setFormatter(newOpts.formatter); + debug("Chart.applyOptions() - update type", ChartUpdateType[updateType], { + seriesStatus, + forceNodeDataRefresh + }); + if (newChartOptions.optionsProcessingTime !== void 0) { + this._performUpdateSplits["\u2699\uFE0F"] = newChartOptions.optionsProcessingTime; + const optionsStartTime = performance.now() - newChartOptions.optionsProcessingTime; + this._performUpdateSplits.start = optionsStartTime; + } + this.update(updateType, { + apiUpdate: true, + forceNodeDataRefresh, + newAnimationBatch: true, + clearCallbackCache: true + }); + this.firstApply = false; + } + applyInitialState(options) { + const { annotationManager, chartTypeOriginator, historyManager, stateManager, zoomManager } = this.ctx; + const { initialState } = options; + if ("annotations" in options && options.annotations?.enabled && initialState?.annotations != null) { + const annotations = initialState.annotations.map((annotation) => { + const annotationTheme = annotationManager.getAnnotationTypeStyles(annotation.type); + return mergeDefaults(annotation, annotationTheme); + }); + stateManager.setState(annotationManager, annotations); + } + if (initialState?.chartType != null) { + stateManager.setState(chartTypeOriginator, initialState.chartType); + } + if ((options.navigator?.enabled || options.zoom?.enabled) && initialState?.zoom != null) { + stateManager.setState(zoomManager, initialState.zoom); + } + if (initialState?.legend != null) { + this.updateLegends(initialState.legend); + } + if (initialState != null) { + historyManager.clear(); + } + } + maybeResetAnimations(seriesStatus) { + if (this.mode !== "standalone") + return; + switch (seriesStatus) { + case "series-grouping-change": + case "replaced": + this.resetAnimations(); + break; + default: + } + } + shouldForceNodeDataRefresh(deltaOptions, seriesStatus) { + const seriesDataUpdate = !!deltaOptions.data || seriesStatus === "data-change" || seriesStatus === "replaced"; + const legendKeys = legendRegistry.getKeys(); + const optionsHaveLegend = Object.values(legendKeys).some( + (legendKey) => deltaOptions[legendKey] != null + ); + const otherRefreshUpdate = deltaOptions.title != null && deltaOptions.subtitle != null || deltaOptions.formatter != null; + return seriesDataUpdate || optionsHaveLegend || otherRefreshUpdate; + } + shouldClearLegendData(options, oldOpts, seriesStatus) { + const seriesChanged = seriesStatus === "replaced" || seriesStatus === "series-grouping-change" || seriesStatus === "updated" && (options.series?.length !== oldOpts.series?.length || !options.series?.every((s, i) => s.type === oldOpts.series?.[i].type)); + const legendRemoved = oldOpts.legend != null && options.legend == null; + return seriesChanged || legendRemoved; + } + applyMiniChartOptions(miniChart, miniChartSeries, completeOptions, oldOpts) { + const oldSeries = oldOpts?.navigator?.miniChart?.series ?? oldOpts?.series; + const miniChartSeriesStatus = this.applySeries( + miniChart, + this.filterMiniChartSeries(miniChartSeries), + this.filterMiniChartSeries(oldSeries) + ); + this.applyAxes(miniChart, completeOptions, oldOpts, miniChartSeriesStatus, [ + "axes[].tick", + "axes[].thickness", + "axes[].title", + "axes[].crosshair", + "axes[].gridLine", + "axes[].label" + ]); + const series = miniChart.series; + for (const s of series) { + s.properties.id = void 0; + } + const axes = miniChart.axes; + const horizontalAxis = axes.find((axis) => axis.direction === "x" /* X */); + for (const axis of axes) { + axis.nice = false; + axis.gridLine.enabled = false; + axis.label.enabled = axis === horizontalAxis; + axis.tick.enabled = false; + axis.interactionEnabled = false; + } + if (horizontalAxis != null) { + const miniChartOpts = completeOptions.navigator?.miniChart; + const labelOptions2 = miniChartOpts?.label; + const intervalOptions = miniChartOpts?.label?.interval; + horizontalAxis.line.enabled = false; + horizontalAxis.label.set( + without(labelOptions2, [ + "interval", + "autoRotate", + "autoRotateAngle", + "itemStyler", + "minSpacing", + "rotation" + ]) + ); + if (horizontalAxis.type === "grouped-category") { + horizontalAxis.label.enabled = false; + horizontalAxis.label.rotation = 0; + const { depthOptions } = horizontalAxis; + if (depthOptions.length === 0) { + depthOptions.set([{ label: { enabled: true } }]); + } else { + for (let i = 1; i < depthOptions.length; i++) { + depthOptions[i].label.enabled = false; + } + } + } else if (horizontalAxis.type === "time" || horizontalAxis.type === "unit-time" || horizontalAxis.type === "ordinal-time") { + horizontalAxis.parentLevel.enabled = false; + } + horizontalAxis.interval.step = intervalOptions?.step; + horizontalAxis.interval.values = intervalOptions?.values; + horizontalAxis.interval.minSpacing = intervalOptions?.minSpacing; + horizontalAxis.interval.maxSpacing = intervalOptions?.maxSpacing; + } + } + applyModules(options) { + const { type: chartType } = this.constructor; + let modulesChanged = false; + for (const module2 of moduleRegistry.byType("root", "legend")) { + const isConfigured = options[module2.optionsKey] != null; + const shouldBeEnabled = isConfigured && module2.chartTypes.includes(chartType); + if (shouldBeEnabled === this.modulesManager.isEnabled(module2)) + continue; + if (shouldBeEnabled) { + this.modulesManager.addModule(module2, (m) => m.moduleFactory(this.getModuleContext())); + if (module2.type === "legend") { + this.modulesManager.getModule(module2)?.attachLegend(this.ctx.scene); + } + this[module2.optionsKey] = this.modulesManager.getModule(module2); + } else { + this.modulesManager.removeModule(module2); + delete this[module2.optionsKey]; + } + modulesChanged = true; + } + return modulesChanged; + } + initSeriesDeclarationOrder(series) { + for (let idx = 0; idx < series.length; idx++) { + series[idx].setSeriesIndex(idx); + } + } + applySeries(chart, optSeries, oldOptSeries) { + if (!optSeries) { + return "no-change"; + } + const matchResult = matchSeriesOptions(chart.series, optSeries, oldOptSeries); + if (matchResult.status === "no-overlap") { + debug(`Chart.applySeries() - creating new series instances, status: ${matchResult.status}`, matchResult); + const chartSeries = optSeries.map((opts) => this.createSeries(opts)); + this.initSeriesDeclarationOrder(chartSeries); + chart.series = chartSeries; + return "replaced"; + } + debug(`Chart.applySeries() - matchResult`, matchResult); + const seriesInstances = []; + let dataChanged = false; + let groupingChanged = false; + let isUpdated = false; + const changes = matchResult.changes.toSorted((a, b) => a.targetIdx - b.targetIdx); + for (const change of changes) { + groupingChanged || (groupingChanged = change.status === "series-grouping"); + dataChanged || (dataChanged = change.diff?.data != null); + isUpdated || (isUpdated = change.status !== "no-op"); + switch (change.status) { + case "add": { + const newSeries = this.createSeries(change.opts); + seriesInstances.push(newSeries); + debug(`Chart.applySeries() - created new series`, newSeries); + break; + } + case "remove": + debug(`Chart.applySeries() - removing series at previous idx ${change.idx}`, change.series); + break; + case "no-op": + seriesInstances.push(change.series); + debug(`Chart.applySeries() - no change to series at previous idx ${change.idx}`, change.series); + break; + case "series-grouping": + case "update": + default: { + const { series, diff: diff8, idx } = change; + debug(`Chart.applySeries() - applying series diff previous idx ${idx}`, diff8, series); + this.applySeriesValues(series, diff8); + series.markNodeDataDirty(); + seriesInstances.push(series); + } + } + } + this.initSeriesDeclarationOrder(seriesInstances); + debug(`Chart.applySeries() - final series instances`, seriesInstances); + chart.series = seriesInstances; + if (groupingChanged) { + return "series-grouping-change"; + } + if (dataChanged) { + return "data-change"; + } + return isUpdated ? "updated" : "no-op"; + } + applyAxes(chart, options, oldOpts, seriesStatus, skip = []) { + if (!("axes" in options) || !options.axes) { + return false; + } + skip = ["axes[].type", ...skip]; + const axes = options.axes; + const forceRecreate = seriesStatus === "replaced"; + const matchingTypes = !forceRecreate && chart.axes.length === axes.length && chart.axes.every((a, i) => a.type === axes[i].type); + if (matchingTypes && isAgCartesianChartOptions(oldOpts)) { + for (const [index, axis] of chart.axes.entries()) { + const previousOpts = oldOpts.axes?.[index] ?? {}; + const axisDiff = jsonDiff(previousOpts, axes[index]); + debug(`Chart.applyAxes() - applying axis diff idx ${index}`, axisDiff); + const path = `axes[${index}]`; + jsonApply(axis, axisDiff, { path, skip }); + } + return true; + } + debug(`Chart.applyAxes() - creating new axes instances; seriesStatus: ${seriesStatus}`); + chart.axes = this.createAxis(axes, skip); + return true; + } + createSeries(seriesOptions) { + const seriesInstance = seriesRegistry.create(seriesOptions.type, this.getModuleContext()); + this.applySeriesOptionModules(seriesInstance, seriesOptions); + this.applySeriesValues(seriesInstance, seriesOptions); + return seriesInstance; + } + applySeriesOptionModules(series, options) { + const moduleContext = series.createModuleContext(); + const moduleMap = series.getModuleMap(); + for (const module2 of moduleRegistry.byType("series-option")) { + if (module2.optionsKey in options && module2.seriesTypes.includes(series.type)) { + moduleMap.addModule(module2, (m) => m.moduleFactory(moduleContext)); + } + } + } + applySeriesValues(target, options) { + const moduleMap = target.getModuleMap(); + const { type, data, listeners, seriesGrouping, showInMiniChart, ...seriesOptions } = options; + for (const moduleDef of EXPECTED_ENTERPRISE_MODULES) { + if (moduleDef.type !== "series-option") + continue; + if (moduleDef.optionsKey in seriesOptions) { + const module2 = moduleMap.getModule(moduleDef.optionsKey); + if (module2) { + const moduleOptions = seriesOptions[moduleDef.optionsKey]; + delete seriesOptions[moduleDef.optionsKey]; + module2.properties.set(moduleOptions); + } + } + } + if (seriesOptions.visible != null) { + target.visible = seriesOptions.visible; + } + target.properties.set(seriesOptions); + if ("data" in options) { + target.setOptionsData(data == null ? void 0 : DataSet.wrap(data)); + } + if (listeners) { + this.registerListeners(target, listeners); + } + if ("seriesGrouping" in options) { + if (seriesGrouping == null) { + target.seriesGrouping = void 0; + } else { + target.seriesGrouping = { ...target.seriesGrouping, ...seriesGrouping }; + } + } + } + createAxis(options, skip) { + const newAxes = []; + const moduleContext = this.getModuleContext(); + for (let index = 0; index < options.length; index++) { + const axisOptions = options[index]; + const axis = axisRegistry.create(axisOptions.type, moduleContext); + this.applyAxisModules(axis, axisOptions); + jsonApply(axis, axisOptions, { path: `axes[${index}]`, skip }); + newAxes.push(axis); + } + guessInvalidPositions(newAxes); + return newAxes; + } + applyAxisModules(axis, options) { + const moduleContext = axis.createModuleContext(); + const moduleMap = axis.getModuleMap(); + for (const module2 of moduleRegistry.byType("axis-option")) { + const shouldBeEnabled = options[module2.optionsKey] != null; + if (shouldBeEnabled === moduleMap.isEnabled(module2)) + continue; + if (shouldBeEnabled) { + moduleMap.addModule(module2, (m) => m.moduleFactory(moduleContext)); + axis[module2.optionsKey] = moduleMap.getModule(module2); + } else { + moduleMap.removeModule(module2); + delete axis[module2.optionsKey]; + } + } + } + registerListeners(source, listeners) { + source.clearEventListeners(); + for (const [property, listener] of entries(listeners)) { + source.addEventListener(property, listener); + } + } + async applyTransaction(transaction) { + await this.updateMutex.acquire(() => { + this.data.addTransaction(transaction); + this.update(1 /* UPDATE_DATA */, { + apiUpdate: true, + skipAnimations: true + }); + }); + await this.waitForUpdate(); + } +}; +_Chart.chartsInstances = /* @__PURE__ */ new WeakMap(); +__decorateClass([ + ActionOnSet({ + newValue(value) { + if (this.destroyed) + return; + this.ctx.domManager.setContainer(value); + _Chart.chartsInstances.set(value, this); + }, + oldValue(value) { + _Chart.chartsInstances.delete(value); + } + }) +], _Chart.prototype, "container", 2); +__decorateClass([ + ActionOnSet({ + newValue(value) { + this.resize("width option", { inWidth: value }); + } + }) +], _Chart.prototype, "width", 2); +__decorateClass([ + ActionOnSet({ + newValue(value) { + this.resize("height option", { inHeight: value }); + } + }) +], _Chart.prototype, "height", 2); +__decorateClass([ + ActionOnSet({ + newValue(value) { + this.resize("minWidth option", { inMinWidth: value }); + } + }) +], _Chart.prototype, "minWidth", 2); +__decorateClass([ + ActionOnSet({ + newValue(value) { + this.resize("minHeight option", { inMinHeight: value }); + } + }) +], _Chart.prototype, "minHeight", 2); +__decorateClass([ + ActionOnSet({ + newValue(value) { + this.resize("overrideDevicePixelRatio option", { inOverrideDevicePixelRatio: value }); + } + }) +], _Chart.prototype, "overrideDevicePixelRatio", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Chart.prototype, "padding", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Chart.prototype, "keyboard", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Chart.prototype, "touch", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Chart.prototype, "mode", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Chart.prototype, "styleNonce", 2); +__decorateClass([ + ProxyProperty("chartCaptions.title") +], _Chart.prototype, "title", 2); +__decorateClass([ + ProxyProperty("chartCaptions.subtitle") +], _Chart.prototype, "subtitle", 2); +__decorateClass([ + ProxyProperty("chartCaptions.footnote") +], _Chart.prototype, "footnote", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Chart.prototype, "formatter", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Chart.prototype, "suppressFieldDotNotation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _Chart.prototype, "loadGoogleFonts", 2); +__decorateClass([ + ActionOnSet({ + changeValue(newValue, oldValue) { + this.onAxisChange(newValue, oldValue); + } + }) +], _Chart.prototype, "axes", 2); +__decorateClass([ + ActionOnSet({ + changeValue(newValue, oldValue) { + this.onSeriesChange(newValue, oldValue); + } + }) +], _Chart.prototype, "series", 2); +var Chart = _Chart; + +// packages/ag-charts-community/src/chart/factory/processEnterpriseOptions.ts +function removeUsedEnterpriseOptions(options, silent) { + let usedOptions = []; + const optsType = options?.series?.[0]?.type; + const isGaugeChart = optsType === "linear-gauge" || optsType === "radial-gauge"; + const optionsChartType = optsType ? chartTypes2.get(optsType) : "unknown"; + for (const module2 of EXPECTED_ENTERPRISE_MODULES) { + if (optionsChartType !== "unknown" && !module2.chartTypes.includes(optionsChartType)) + continue; + if (module2.type === "root" || module2.type === "legend") { + const optionValue = options[module2.optionsKey]; + if (optionValue == null) + continue; + if (!module2.optionsInnerKey) { + usedOptions.push(module2.optionsKey); + delete options[module2.optionsKey]; + } else if (optionValue[module2.optionsInnerKey]) { + usedOptions.push(`${module2.optionsKey}.${module2.optionsInnerKey}`); + delete optionValue[module2.optionsInnerKey]; + } + } else if (module2.type === "axis") { + if (!("axes" in options) || !isArray(options.axes) || !options.axes?.some((axis) => axis.type === module2.identifier)) { + continue; + } + usedOptions.push(`axis[type=${module2.identifier}]`); + options.axes = options.axes.filter((axis) => axis.type !== module2.identifier); + } else if (module2.type === "axis-option") { + if (!("axes" in options) || !isArray(options.axes) || !options.axes?.some((axis) => axis[module2.optionsKey])) { + continue; + } + usedOptions.push(`axis.${module2.optionsKey}`); + for (const axis of options.axes) { + if (axis[module2.optionsKey]) { + delete axis[module2.optionsKey]; + } + } + } else if (module2.type === "series") { + if (module2.community) + continue; + if (!isArray(options.series) || !options.series?.some((series) => series.type === module2.identifier)) { + continue; + } + usedOptions.push(`series[type=${module2.identifier}]`); + options.series = options.series.filter((series) => series.type !== module2.identifier); + } else if (module2.type === "series-option") { + if (!isArray(options.series) || !options.series?.some((series) => series[module2.optionsKey])) { + continue; + } + usedOptions.push(`series.${module2.optionsKey}`); + for (const series of options.series) { + if (series[module2.optionsKey]) { + delete series[module2.optionsKey]; + } + } + } + } + if (usedOptions.length && !silent) { + if (isGaugeChart) { + usedOptions = ["AgCharts.createGauge"]; + } + let enterprisePackageName = "ag-charts-enterprise"; + let enterpriseReferenceUrl = "https://www.ag-grid.com/charts/javascript/installation/"; + if (options.mode === "integrated") { + enterprisePackageName = "ag-grid-charts-enterprise' or 'ag-grid-enterprise/charts-enterprise"; + enterpriseReferenceUrl = "https://www.ag-grid.com/javascript-data-grid/integrated-charts-installation/"; + } + logger_exports.warnOnce( + [ + `unable to use these enterprise features as '${enterprisePackageName}' has not been loaded:`, + "", + ...usedOptions, + "", + `See: ${enterpriseReferenceUrl}` + ].join("\n") + ); + } +} +function removeUnusedEnterpriseOptions(options) { + const integratedMode = "mode" in options && options.mode === "integrated"; + for (const module2 of moduleRegistry.byType("root", "legend")) { + const moduleOptions = options[module2.optionsKey]; + const isPresentAndDisabled = moduleOptions != null && moduleOptions.enabled === false; + const removable = !("removable" in module2) || module2.removable === true || module2.removable === "standalone-only" && !integratedMode; + if (isPresentAndDisabled && removable) { + delete options[module2.optionsKey]; + } + } +} + +// packages/ag-charts-community/src/module/coreModulesTypes.ts +function paletteType(partial) { + if (partial?.up || partial?.down || partial?.neutral) { + return "user-full"; + } else if (partial?.fills || partial?.strokes) { + return "user-indexed"; + } + return "inbuilt"; +} + +// packages/ag-charts-community/src/chart/themes/defaultColors.ts +var DEFAULT_FILLS = { + BLUE: "#5090dc", + ORANGE: "#ffa03a", + GREEN: "#459d55", + CYAN: "#34bfe1", + YELLOW: "#e1cc00", + VIOLET: "#9669cb", + GRAY: "#b5b5b5", + MAGENTA: "#bd5aa7", + BROWN: "#8a6224", + RED: "#ef5452" +}; +var DEFAULT_STROKES = { + BLUE: "#2b5c95", + ORANGE: "#cc6f10", + GREEN: "#1e652e", + CYAN: "#18859e", + YELLOW: "#a69400", + VIOLET: "#603c88", + GRAY: "#575757", + MAGENTA: "#7d2f6d", + BROWN: "#4f3508", + RED: "#a82529" +}; + +// packages/ag-charts-community/src/chart/themes/symbols.ts +var symbols_exports = {}; +__export(symbols_exports, { + DEFAULT_ANNOTATION_HANDLE_FILL: () => DEFAULT_ANNOTATION_HANDLE_FILL, + DEFAULT_ANNOTATION_STATISTICS_COLOR: () => DEFAULT_ANNOTATION_STATISTICS_COLOR, + DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE: () => DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE, + DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL: () => DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, + DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE: () => DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE, + DEFAULT_ANNOTATION_STATISTICS_FILL: () => DEFAULT_ANNOTATION_STATISTICS_FILL, + DEFAULT_ANNOTATION_STATISTICS_STROKE: () => DEFAULT_ANNOTATION_STATISTICS_STROKE, + DEFAULT_CAPTION_ALIGNMENT: () => DEFAULT_CAPTION_ALIGNMENT, + DEFAULT_CAPTION_LAYOUT_STYLE: () => DEFAULT_CAPTION_LAYOUT_STYLE, + DEFAULT_FIBONACCI_STROKES: () => DEFAULT_FIBONACCI_STROKES, + DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL: () => DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR: () => DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, + DEFAULT_GRIDLINE_ENABLED: () => DEFAULT_GRIDLINE_ENABLED, + DEFAULT_POLAR_SERIES_STROKE: () => DEFAULT_POLAR_SERIES_STROKE, + DEFAULT_SEPARATION_LINES_COLOUR: () => DEFAULT_SEPARATION_LINES_COLOUR, + DEFAULT_SHADOW_COLOUR: () => DEFAULT_SHADOW_COLOUR, + DEFAULT_SPARKLINE_CROSSHAIR_STROKE: () => DEFAULT_SPARKLINE_CROSSHAIR_STROKE, + DEFAULT_TEXTBOX_COLOR: () => DEFAULT_TEXTBOX_COLOR, + DEFAULT_TEXTBOX_FILL: () => DEFAULT_TEXTBOX_FILL, + DEFAULT_TEXTBOX_STROKE: () => DEFAULT_TEXTBOX_STROKE, + DEFAULT_TEXT_ANNOTATION_COLOR: () => DEFAULT_TEXT_ANNOTATION_COLOR, + DEFAULT_TOOLBAR_POSITION: () => DEFAULT_TOOLBAR_POSITION, + IS_DARK_THEME: () => IS_DARK_THEME, + PALETTE_ALT_DOWN_FILL: () => PALETTE_ALT_DOWN_FILL, + PALETTE_ALT_DOWN_STROKE: () => PALETTE_ALT_DOWN_STROKE, + PALETTE_ALT_NEUTRAL_FILL: () => PALETTE_ALT_NEUTRAL_FILL, + PALETTE_ALT_NEUTRAL_STROKE: () => PALETTE_ALT_NEUTRAL_STROKE, + PALETTE_ALT_UP_FILL: () => PALETTE_ALT_UP_FILL, + PALETTE_ALT_UP_STROKE: () => PALETTE_ALT_UP_STROKE, + PALETTE_DOWN_FILL: () => PALETTE_DOWN_FILL, + PALETTE_DOWN_STROKE: () => PALETTE_DOWN_STROKE, + PALETTE_NEUTRAL_FILL: () => PALETTE_NEUTRAL_FILL, + PALETTE_NEUTRAL_STROKE: () => PALETTE_NEUTRAL_STROKE, + PALETTE_UP_FILL: () => PALETTE_UP_FILL, + PALETTE_UP_STROKE: () => PALETTE_UP_STROKE +}); +var IS_DARK_THEME = Symbol("is-dark-theme"); +var DEFAULT_SEPARATION_LINES_COLOUR = Symbol("default-separation-lines-colour"); +var DEFAULT_SHADOW_COLOUR = Symbol("default-shadow-colour"); +var DEFAULT_CAPTION_LAYOUT_STYLE = Symbol("default-caption-layout-style"); +var DEFAULT_CAPTION_ALIGNMENT = Symbol("default-caption-alignment"); +var PALETTE_UP_STROKE = Symbol("palette-up-stroke"); +var PALETTE_DOWN_STROKE = Symbol("palette-down-stroke"); +var PALETTE_UP_FILL = Symbol("palette-up-fill"); +var PALETTE_DOWN_FILL = Symbol("palette-down-fill"); +var PALETTE_NEUTRAL_STROKE = Symbol("palette-neutral-stroke"); +var PALETTE_NEUTRAL_FILL = Symbol("palette-neutral-fill"); +var PALETTE_ALT_UP_STROKE = Symbol("palette-alt-up-stroke"); +var PALETTE_ALT_DOWN_STROKE = Symbol("palette-alt-down-stroke"); +var PALETTE_ALT_UP_FILL = Symbol("palette-alt-up-fill"); +var PALETTE_ALT_DOWN_FILL = Symbol("palette-alt-down-fill"); +var PALETTE_ALT_NEUTRAL_FILL = Symbol("palette-gray-fill"); +var PALETTE_ALT_NEUTRAL_STROKE = Symbol("palette-gray-stroke"); +var DEFAULT_POLAR_SERIES_STROKE = Symbol("default-polar-series-stroke"); +var DEFAULT_SPARKLINE_CROSSHAIR_STROKE = Symbol("default-sparkline-crosshair-stroke"); +var DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR = Symbol( + "default-financial-charts-annotation-stroke" +); +var DEFAULT_FIBONACCI_STROKES = Symbol("default-hierarchy-strokes"); +var DEFAULT_TEXT_ANNOTATION_COLOR = Symbol("default-text-annotation-color"); +var DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL = Symbol( + "default-financial-charts-annotation-background-fill" +); +var DEFAULT_ANNOTATION_HANDLE_FILL = Symbol("default-annotation-handle-fill"); +var DEFAULT_ANNOTATION_STATISTICS_FILL = Symbol("default-annotation-statistics-fill"); +var DEFAULT_ANNOTATION_STATISTICS_STROKE = Symbol("default-annotation-statistics-stroke"); +var DEFAULT_ANNOTATION_STATISTICS_COLOR = Symbol("default-annotation-statistics-color"); +var DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE = Symbol( + "default-annotation-statistics-divider-stroke" +); +var DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL = Symbol( + "default-annotation-statistics-fill" +); +var DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE = Symbol( + "default-annotation-statistics-stroke" +); +var DEFAULT_TEXTBOX_FILL = Symbol("default-textbox-fill"); +var DEFAULT_TEXTBOX_STROKE = Symbol("default-textbox-stroke"); +var DEFAULT_TEXTBOX_COLOR = Symbol("default-textbox-color"); +var DEFAULT_TOOLBAR_POSITION = Symbol("default-toolbar-position"); +var DEFAULT_GRIDLINE_ENABLED = Symbol("default-gridline-enabled"); + +// packages/ag-charts-community/src/chart/themes/util.ts +var DIRECTION_SWAP_AXES = [ + { + type: "number" /* NUMBER */, + position: { + $if: [ + { $eq: [{ $path: ["/series/0/direction", void 0] }, "horizontal"] }, + "bottom" /* BOTTOM */, + "left" /* LEFT */ + ] + } + }, + { + type: "category" /* CATEGORY */, + position: { + $if: [ + { $eq: [{ $path: ["/series/0/direction", void 0] }, "horizontal"] }, + "left" /* LEFT */, + "bottom" /* BOTTOM */ + ] + } + } +]; +var SAFE_FILL_OPERATION = { + $if: [ + { + $or: [ + { $isGradient: { $palette: "fill" } }, + { $isPattern: { $palette: "fill" } }, + { $isImage: { $value: "$1" } } + ] + }, + { $palette: "fillFallback" }, + { $palette: "fill" } + ] +}; +var SAFE_FILLS_OPERATION = { + $if: [ + { + $or: [ + { $isGradient: { $palette: "fill" } }, + { $isPattern: { $palette: "fill" } }, + { $isImage: { $value: "$1" } } + ] + }, + { $palette: "fillsFallback" }, + { $palette: "fills" } + ] +}; +var SAFE_STROKE_FILL_OPERATION = { + $if: [ + { $isGradient: { $palette: "fill" } }, + { $palette: "fillFallback" }, + { + $if: [ + { $isPattern: { $palette: "fill" } }, + { $path: ["/stroke", { $palette: "fillFallback" }, { $palette: "fill" }] }, + { $palette: "fill" } + ] + } + ] +}; +var SAFE_RANGE2_OPERATION = { + $if: [ + { + $or: [ + { $isGradient: { $palette: "fill" } }, + { $isPattern: { $palette: "fill" } }, + { $isImage: { $value: "$1" } } + ] + }, + [{ $palette: "fillFallback" }, { $palette: "fillFallback" }], + { $palette: "range2" } + ] +}; +var FILL_GRADIENT_BLANK_DEFAULTS = { + type: "gradient", + gradient: "linear", + bounds: "item", + colorStops: [{ color: "black" }], + rotation: 0, + reverse: false, + colorSpace: "rgb" +}; +var FILL_GRADIENT_LINEAR_DEFAULTS = { + type: "gradient", + gradient: "linear", + bounds: "item", + colorStops: { $shallow: { $map: [{ color: { $value: "$1" } }, { $palette: "gradient" }] } }, + rotation: 0, + reverse: false, + colorSpace: "rgb" +}; +var FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS = { + ...FILL_GRADIENT_LINEAR_DEFAULTS, + colorStops: { + $shallow: [ + { + color: { + $mix: [{ $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, "black", 0.15] + } + }, + { + color: { + $mix: [{ $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, "white", 0.15] + } + } + ] + } +}; +var FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS = { + ...FILL_GRADIENT_LINEAR_DEFAULTS, + colorStops: { + $map: [{ color: { $value: "$1" } }, { $path: ["/0", void 0, { $palette: "gradients" }] }] + } +}; +var FILL_GRADIENT_LINEAR_KEYED_DEFAULTS = (key) => ({ + ...FILL_GRADIENT_LINEAR_DEFAULTS, + colorStops: { + $shallow: { + $if: [ + { + $or: [ + { $isGradient: { $palette: `${key}.fill` } }, + { $isPattern: { $palette: `${key}.fill` } }, + { $isImage: { $palette: `${key}.fill` } } + ] + }, + { $path: ["/colorStops", void 0, { $palette: `${key}.fill` }] }, + [ + { color: { $mix: [{ $palette: `${key}.fill` }, "black", 0.15] } }, + { color: { $mix: [{ $palette: `${key}.fill` }, "white", 0.15] } } + ] + ] + } + } +}); +var FILL_GRADIENT_RADIAL_DEFAULTS = { + type: "gradient", + gradient: "radial", + bounds: "item", + colorStops: { $shallow: { $map: [{ color: { $value: "$1" } }, { $palette: "gradient" }] } }, + rotation: 0, + reverse: false, + colorSpace: "rgb" +}; +var FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS = { + ...FILL_GRADIENT_RADIAL_DEFAULTS, + reverse: true +}; +var FILL_GRADIENT_RADIAL_SERIES_DEFAULTS = { + ...FILL_GRADIENT_RADIAL_DEFAULTS, + bounds: "series" +}; +var FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS = { + ...FILL_GRADIENT_RADIAL_DEFAULTS, + bounds: "series", + reverse: true +}; +var FILL_GRADIENT_CONIC_SERIES_DEFAULTS = { + type: "gradient", + gradient: "conic", + bounds: "series", + colorStops: { $map: [{ color: { $value: "$1" } }, { $palette: "gradient" }] }, + rotation: 0, + reverse: false, + colorSpace: "rgb" +}; +var FILL_PATTERN_DEFAULTS = { + type: "pattern", + pattern: "forward-slanted-lines", + width: { $isUserOption: ["./height", { $path: "./height" }, 10] }, + height: { $isUserOption: ["./width", { $path: "./width" }, 10] }, + padding: 2, + fill: { + $if: [ + { + $or: [{ $isGradient: { $palette: "fill" } }, { $isImage: { $palette: "fill" } }] + }, + { $palette: "fillFallback" }, + { + $if: [ + { $isPattern: { $palette: "fill" } }, + { $path: ["/fill", { $palette: "fillFallback" }, { $palette: "fill" }] }, + { $palette: "fill" } + ] + } + ] + }, + fillOpacity: 1, + stroke: SAFE_STROKE_FILL_OPERATION, + strokeOpacity: 1, + strokeWidth: { + $switch: [ + { $path: "./pattern" }, + 0, + [["backward-slanted-lines", "forward-slanted-lines", "horizontal-lines", "vertical-lines"], 4] + ] + }, + backgroundFill: "none", + backgroundFillOpacity: 1, + rotation: 0, + scale: 1 +}; +var FILL_PATTERN_SINGLE_DEFAULTS = { + ...FILL_PATTERN_DEFAULTS, + stroke: { + $if: [ + { $isGradient: { $palette: "fill" } }, + { $path: ["/0", void 0, { $palette: "fillsFallback" }] }, + { + $if: [ + { $isPattern: { $palette: "fill" } }, + { + $path: [ + "/stroke", + { $path: ["/0", void 0, { $palette: "fillsFallback" }] }, + { $path: ["/0", void 0, { $palette: "fills" }] } + ] + }, + { $path: ["/0", void 0, { $palette: "fills" }] } + ] + } + ] + }, + fill: { + $if: [ + { + $or: [{ $isGradient: { $palette: "fill" } }, { $isImage: { $palette: "fill" } }] + }, + { $path: ["/0", void 0, { $palette: "fillsFallback" }] }, + { + $if: [ + { $isPattern: { $palette: "fill" } }, + { + $path: [ + "/fill", + { $path: ["/0", void 0, { $palette: "fillsFallback" }] }, + { $path: ["/0", void 0, { $palette: "fills" }] } + ] + }, + { $path: ["/0", void 0, { $palette: "fills" }] } + ] + } + ] + } +}; +var FILL_PATTERN_BLANK_DEFAULTS = { + type: "pattern", + pattern: "forward-slanted-lines", + width: 8, + height: 8, + padding: 1, + fill: "black", + fillOpacity: 1, + backgroundFill: "white", + backgroundFillOpacity: 1, + stroke: "black", + strokeOpacity: 1, + strokeWidth: 1, + rotation: 0, + scale: 1 +}; +var FILL_PATTERN_HIERARCHY_DEFAULTS = { + ...FILL_PATTERN_DEFAULTS, + fill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + stroke: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] } +}; +var FILL_PATTERN_KEYED_DEFAULTS = (key) => ({ + ...FILL_PATTERN_DEFAULTS, + stroke: { + $if: [ + { $isGradient: { $palette: `${key}.fill` } }, + { $palette: "fillFallback" }, + { + $if: [ + { $isPattern: { $palette: `${key}.fill` } }, + { $path: ["/stroke", { $palette: "fillFallback" }, { $palette: `${key}.fill` }] }, + { $palette: `${key}.fill` } + ] + } + ] + } +}); +var FILL_IMAGE_DEFAULTS = { + type: "image", + backgroundFill: { $palette: "fillFallback" }, + backgroundFillOpacity: 1, + repeat: "no-repeat", + fit: "contain", + rotation: 0 +}; +var FILL_IMAGE_BLANK_DEFAULTS = { + type: "image", + backgroundFill: "black", + backgroundFillOpacity: 1, + rotation: 0, + repeat: "no-repeat", + fit: "contain", + width: 8, + height: 8 +}; +function getSequentialColors(colors) { + return mapValues(colors, (value) => { + const color2 = Color.fromString(value); + return [Color.darken(color2, 0.15).toString(), value, Color.lighten(color2, 0.15).toString()]; + }); +} +var ITEM_HIGHLIGHT_BASE_STYLE = { + stroke: { $path: ["../../highlightStyle/item/stroke", `rgba(0, 0, 0, 0.4)`] }, + strokeWidth: { $path: ["../../highlightStyle/item/strokeWidth", 2] }, + strokeOpacity: { $path: ["../../highlightStyle/item/strokeOpacity", void 0] }, + opacity: { + $path: [ + "../../highlightStyle/item/opacity", + { + $if: [{ $eq: [{ $path: ["/highlight/drawingMode", void 0] }, "cutout"] }, 0.67, 1] + } + ] + } +}; +var ITEM_HIGHLIGHT_STYLE = { + ...ITEM_HIGHLIGHT_BASE_STYLE, + fill: { + $path: [ + "../../highlightStyle/item/fill", + { + $if: [ + { $eq: [{ $path: ["/highlight/drawingMode", void 0] }, "cutout"] }, + void 0, + `rgba(255,255,255, 0.33)` + ] + } + ] + }, + fillOpacity: { $path: ["../../highlightStyle/item/fillOpacity", void 0] } +}; +var LABEL_BOXING_DEFAULTS = { + padding: 8, + cornerRadius: 4, + fill: { + $if: [ + { + $and: [ + { $eq: [{ $path: "./fill/type" }, "image"] }, + { $isUserOption: ["./fill/backgroundFill", false, true] } + ] + }, + { backgroundFill: "transparent" }, + void 0 + ] + }, + border: { + enabled: { $isUserOption: ["../border", true, false] }, + strokeWidth: 1, + stroke: { $foregroundOpacity: 0.08 } + } +}; +function multiSeriesHighlightStyle(hasFill = true) { + return { + enabled: true, + highlightedItem: hasFill ? ITEM_HIGHLIGHT_STYLE : ITEM_HIGHLIGHT_BASE_STYLE, + unhighlightedItem: { + strokeWidth: { $path: ["../../highlightStyle/series/strokeWidth", void 0] } + }, + highlightedSeries: { + strokeWidth: { $path: ["../../highlightStyle/series/strokeWidth", void 0] } + }, + unhighlightedSeries: { + opacity: { $path: ["../../highlightStyle/series/dimOpacity", void 0] } + } + }; +} +function singleSeriesHighlightStyle(hasFill = true) { + return { + enabled: true, + highlightedItem: hasFill ? ITEM_HIGHLIGHT_STYLE : ITEM_HIGHLIGHT_BASE_STYLE, + unhighlightedItem: { + strokeWidth: { $path: ["../../highlightStyle/series/strokeWidth", void 0] }, + opacity: { $path: ["../../highlightStyle/series/dimOpacity", void 0] } + } + }; +} +var LEGEND_CONTAINER_THEME = { + border: { + enabled: false, + stroke: { $foregroundBackgroundMix: 0.25 }, + strokeOpacity: 1, + strokeWidth: 1 + }, + cornerRadius: 4, + fillOpacity: 1, + padding: { + $if: [{ $eq: [{ $path: "./border/enabled" }, true] }, 5, { $isUserOption: ["./fill", 5, 0] }] + } +}; +var SEGMENTATION_DEFAULTS = { + enabled: false, + key: "x", + segments: { + $apply: [ + { + fill: { + $applySwitch: [ + { $path: "type" }, + { $path: "../../../fill" }, + ["gradient", FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $path: "../../../stroke" }, + fillOpacity: { $path: "../../../fillOpacity" }, + strokeWidth: { + $isUserOption: [ + "./stroke", + { + $isUserOption: [ + "../../../strokeWidth", + { $path: "../../../strokeWidth" }, + { + $if: [ + { $greaterThan: [{ $path: "../../../strokeWidth" }, 0] }, + { $path: "../../../strokeWidth" }, + 2 + ] + } + ] + }, + { $path: "../../../strokeWidth" } + ] + }, + strokeOpacity: { $path: "../../../strokeOpacity" }, + lineDash: { $path: "../../../lineDash" }, + lineDashOffset: { $path: "../../../lineDashOffset" } + } + ] + } +}; + +// packages/ag-charts-community/src/chart/themes/chartTheme.ts +var DEFAULT_BACKGROUND_FILL = "white"; +var CHART_TYPE_CONFIG = { + get cartesian() { + return { seriesTypes: chartTypes2.cartesianTypes, commonOptions: ["zoom", "navigator"] }; + }, + get polar() { + return { seriesTypes: chartTypes2.polarTypes, commonOptions: [] }; + }, + get topology() { + return { seriesTypes: chartTypes2.topologyTypes, commonOptions: [] }; + }, + get standalone() { + return { seriesTypes: chartTypes2.standaloneTypes, commonOptions: [] }; + } +}; +var PRESET_OVERRIDES_TYPES = { + "radial-gauge": true, + "linear-gauge": true +}; +function isPresetOverridesType(type) { + return PRESET_OVERRIDES_TYPES[type] === true; +} +var _ChartTheme = class _ChartTheme { + static getDefaultColors() { + return { + fills: DEFAULT_FILLS, + fillsFallback: Object.values(DEFAULT_FILLS), + strokes: DEFAULT_STROKES, + sequentialColors: getSequentialColors(DEFAULT_FILLS), + divergingColors: [DEFAULT_FILLS.ORANGE, DEFAULT_FILLS.YELLOW, DEFAULT_FILLS.GREEN], + hierarchyColors: ["#fff", "#e0e5ea", "#c1ccd5", "#a3b4c1", "#859cad"], + secondSequentialColors: Color.interpolate( + [ + Color.fromHexString(DEFAULT_FILLS.BLUE), + Color.fromHexString("#cbdef5") + // TODO: Color.lighten(DEFAULT_FILLS.BLUE, ?) + ], + 8 + ).map((color2) => color2.toString()), + secondDivergingColors: [DEFAULT_FILLS.GREEN, DEFAULT_FILLS.YELLOW, DEFAULT_FILLS.RED], + secondHierarchyColors: ["#fff", "#c5cbd1", "#a4b1bd", "#8498a9", "#648096"], + up: { fill: DEFAULT_FILLS.GREEN, stroke: DEFAULT_STROKES.GREEN }, + down: { fill: DEFAULT_FILLS.RED, stroke: DEFAULT_STROKES.RED }, + neutral: { fill: DEFAULT_FILLS.GRAY, stroke: DEFAULT_STROKES.GRAY }, + altUp: { fill: DEFAULT_FILLS.BLUE, stroke: DEFAULT_STROKES.BLUE }, + altDown: { fill: DEFAULT_FILLS.ORANGE, stroke: DEFAULT_STROKES.ORANGE }, + altNeutral: { fill: DEFAULT_FILLS.GRAY, stroke: DEFAULT_STROKES.GRAY } + }; + } + static getDefaultPublicParameters() { + return { + accentColor: "#2196f3", + axisColor: { $foregroundBackgroundMix: 0.325 }, + backgroundColor: DEFAULT_BACKGROUND_FILL, + borderColor: { $foregroundOpacity: 0.15 }, + borderRadius: 4, + chartBackgroundColor: { $ref: "backgroundColor" }, + chartPadding: 20, + focusShadow: "0 0 0 3px var(--ag-charts-accent-color)", + foregroundColor: "#181d1f", + fontFamily: "Verdana, sans-serif", + fontSize: BASE_FONT_SIZE, + fontWeight: 400, + gridLineColor: { $foregroundBackgroundMix: 0.1 }, + popupShadow: "0 0 16px rgba(0, 0, 0, 0.15)", + subtleTextColor: { $mix: [{ $ref: "textColor" }, { $ref: "chartBackgroundColor" }, 0.38] }, + textColor: { $ref: "foregroundColor" }, + chromeBackgroundColor: { $foregroundBackgroundMix: 0.02 }, + chromeFontFamily: { $ref: "fontFamily" }, + chromeFontSize: { $ref: "fontSize" }, + chromeFontWeight: { $ref: "fontWeight" }, + chromeTextColor: { $ref: "foregroundColor" }, + chromeSubtleTextColor: { $mix: [{ $ref: "chromeTextColor" }, { $ref: "backgroundColor" }, 0.38] }, + buttonBackgroundColor: { $ref: "backgroundColor" }, + buttonBorder: true, + buttonFontWeight: 400, + buttonTextColor: { $ref: "textColor" }, + inputBackgroundColor: { $ref: "backgroundColor" }, + inputBorder: true, + inputTextColor: { $ref: "textColor" }, + menuBackgroundColor: { $ref: "chromeBackgroundColor" }, + menuBorder: true, + menuTextColor: { $ref: "chromeTextColor" }, + panelBackgroundColor: { $ref: "chromeBackgroundColor" }, + panelSubtleTextColor: { $ref: "chromeSubtleTextColor" }, + tooltipBackgroundColor: { $ref: "chromeBackgroundColor" }, + tooltipBorder: true, + tooltipTextColor: { $ref: "chromeTextColor" }, + tooltipSubtleTextColor: { $ref: "chromeSubtleTextColor" }, + crosshairLabelBackgroundColor: { $ref: "foregroundColor" }, + crosshairLabelTextColor: { $ref: "chartBackgroundColor" } + }; + } + static getAxisDefaults(overrideDefaults, { title, time: time3 }) { + return mergeDefaults( + overrideDefaults, + title && { + title: { + enabled: false, + text: "Axis Title", + spacing: 25, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: FONT_SIZE_RATIO.MEDIUM }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + } + }, + time3 && { + parentLevel: { + enabled: false, + label: { + // TODO: { $merge: [{ $path: '../../label' }, { fontWeight: 'bold' }]} + enabled: { $path: "../../label/enabled" }, + border: { + enabled: { + $or: [ + { $isUserOption: ["../border", true, false] }, + { $path: "../../../label/border/enabled" } + ] + }, + strokeWidth: { $path: "../../../label/border/strokeWidth" }, + stroke: { $path: "../../../label/border/stroke" } + }, + fill: { $path: "../../label/fill" }, + fontSize: { $path: "../../label/fontSize" }, + fontFamily: { $path: "../../label/fontFamily" }, + fontWeight: "bold", + spacing: { $path: "../../label/spacing" }, + color: { $path: "../../label/color" }, + cornerRadius: { $path: "../../label/cornerRadius" }, + padding: { $path: "../../label/padding" }, + avoidCollisions: { $path: "../../label/avoidCollisions" } + }, + tick: { + enabled: { $path: "../../tick/enabled" }, + width: { $path: "../../tick/width" }, + size: { $path: "../../tick/size" }, + stroke: { $path: "../../tick/stroke" } + } + } + }, + { + label: { + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + spacing: 11, + color: { $ref: "textColor" }, + avoidCollisions: true, + cornerRadius: 4, + border: { + enabled: { $isUserOption: ["../border", true, false] }, + strokeWidth: 1, + stroke: { $foregroundOpacity: 0.08 } + }, + padding: { + $if: [ + { $eq: [{ $path: "./border/enabled" }, true] }, + { left: 12, right: 12, top: 8, bottom: 8 }, + void 0 + ] + } + }, + line: { + enabled: true, + width: 1, + stroke: { $ref: "axisColor" } + }, + tick: { + enabled: false, + size: 6, + width: 1, + stroke: { $ref: "axisColor" } + }, + gridLine: { + enabled: true, + width: 1, + style: { + $apply: [ + { + fillOpacity: 1, + stroke: { $ref: "gridLineColor" }, + strokeWidth: { $path: "../../width" }, + lineDash: [] + }, + [ + { + fillOpacity: 1, + stroke: { $ref: "gridLineColor" }, + strokeWidth: { $path: "../../width" }, + lineDash: [] + } + ] + ] + } + }, + crossLines: { + $apply: [ + { + enabled: true, + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + fillOpacity: 0.08, + strokeWidth: 1, + label: { + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + padding: 5, + color: { $ref: "textColor" } + } + }, + void 0, + // TODO: can we just infer this common path? + { + $pathString: [ + "/common/axes/$axisType/crossLines", + { axisType: { $path: ["/axes/$index/type"] } } + ] + }, + { + $pathString: [ + "/$seriesType/axes/$axisType/crossLines", + { + seriesType: { $path: ["/series/0/type", "line"] }, + axisType: { $path: ["/axes/$index/type"] } + } + ] + } + ] + } + } + ); + } + getChartDefaults() { + return { + minHeight: 300, + minWidth: 300, + background: { visible: true, fill: { $ref: "chartBackgroundColor" } }, + padding: { + top: { $ref: "chartPadding" }, + right: { $ref: "chartPadding" }, + bottom: { $ref: "chartPadding" }, + left: { $ref: "chartPadding" } + }, + seriesArea: { + border: { + enabled: false, + stroke: { $ref: "foregroundColor" }, + strokeOpacity: 1, + strokeWidth: 1 + }, + cornerRadius: 4, + padding: { $if: [{ $eq: [{ $path: "./border/enabled" }, true] }, 5, 0] } + }, + keyboard: { enabled: true }, + title: { + enabled: false, + text: "Title", + spacing: { $if: [{ $path: "../subtitle/enabled" }, 10, 20] }, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: FONT_SIZE_RATIO.LARGEST }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + wrapping: "hyphenate", + layoutStyle: DEFAULT_CAPTION_LAYOUT_STYLE, + textAlign: DEFAULT_CAPTION_ALIGNMENT + }, + subtitle: { + enabled: false, + text: "Subtitle", + spacing: 20, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: FONT_SIZE_RATIO.MEDIUM }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "subtleTextColor" }, + wrapping: "hyphenate", + layoutStyle: DEFAULT_CAPTION_LAYOUT_STYLE, + textAlign: DEFAULT_CAPTION_ALIGNMENT + }, + footnote: { + enabled: false, + text: "Footnote", + spacing: 20, + fontSize: { $rem: FONT_SIZE_RATIO.MEDIUM }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "subtleTextColor" }, + wrapping: "hyphenate", + layoutStyle: DEFAULT_CAPTION_LAYOUT_STYLE, + textAlign: DEFAULT_CAPTION_ALIGNMENT + }, + legend: { + ...LEGEND_CONTAINER_THEME, + enabled: { + $and: [ + { $greaterThan: [{ $size: { $path: "/series" } }, 1] }, + { + $or: [ + { $isChartType: "cartesian" }, + { $isChartType: "standalone" }, + { + $and: [ + { $isChartType: "polar" }, + { $not: { $isSeriesType: "pie" } }, + { $not: { $isSeriesType: "donut" } } + ] + } + ] + } + ] + }, + position: "bottom" /* BOTTOM */, + orientation: { + $if: [ + { + $or: [ + { $eq: [{ $path: "./position" }, "left" /* LEFT */] }, + { $eq: [{ $path: "./position" }, "left-top" /* LEFT_TOP */] }, + { $eq: [{ $path: "./position" }, "left-bottom" /* LEFT_BOTTOM */] }, + { $eq: [{ $path: "./position" }, "right" /* RIGHT */] }, + { $eq: [{ $path: "./position" }, "right-top" /* RIGHT_TOP */] }, + { $eq: [{ $path: "./position" }, "right-bottom" /* RIGHT_BOTTOM */] }, + { $eq: [{ $path: "./position/placement" }, "left" /* LEFT */] }, + { $eq: [{ $path: "./position/placement" }, "left-top" /* LEFT_TOP */] }, + { $eq: [{ $path: "./position/placement" }, "left-bottom" /* LEFT_BOTTOM */] }, + { $eq: [{ $path: "./position/placement" }, "right" /* RIGHT */] }, + { $eq: [{ $path: "./position/placement" }, "right-top" /* RIGHT_TOP */] }, + { $eq: [{ $path: "./position/placement" }, "right-bottom" /* RIGHT_BOTTOM */] } + ] + }, + "vertical", + "horizontal" + ] + }, + spacing: 30, + listeners: {}, + toggleSeries: true, + item: { + paddingX: 16, + paddingY: 8, + marker: { size: 15, padding: 8 }, + showSeriesStroke: true, + label: { + color: { $ref: "textColor" }, + fontSize: { $rem: FONT_SIZE_RATIO.SMALL }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" } + } + }, + reverseOrder: false, + pagination: { + marker: { size: 12 }, + activeStyle: { fill: { $ref: "foregroundColor" } }, + inactiveStyle: { fill: { $ref: "subtleTextColor" } }, + highlightStyle: { fill: { $ref: "foregroundColor" } }, + label: { color: { $ref: "textColor" } } + }, + fill: { + $if: [{ $path: ["./position/floating", false] }, { $ref: "chartBackgroundColor" }, "transparent"] + } + }, + tooltip: { + enabled: true, + darkTheme: IS_DARK_THEME, + delay: 0, + pagination: false, + mode: { + $if: [ + { + $or: [ + { + $and: [ + { $isChartType: "cartesian" }, + { $not: { $hasSeriesType: "bubble" } }, + { $not: { $hasSeriesType: "scatter" } }, + { $greaterThan: [{ $size: { $path: "/series" } }, 1] }, + { $lessThan: [{ $size: { $path: "/series" } }, 4] } + ] + }, + { + $and: [ + { $isChartType: "polar" }, + { $greaterThan: [{ $size: { $path: "/series" } }, 1] }, + { $lessThan: [{ $size: { $path: "/series" } }, 4] } + ] + } + ] + }, + "shared", + "single" + ] + } + }, + overlays: { darkTheme: IS_DARK_THEME }, + listeners: {}, + series: { + tooltip: { + range: { $path: ["/tooltip/range", "exact"] }, + position: { + anchorTo: { $path: ["/tooltip/position/anchorTo", "pointer"] }, + placement: { $path: ["/tooltip/position/placement", void 0] }, + xOffset: { $path: ["/tooltip/position/xOffset", 0] }, + yOffset: { $path: ["/tooltip/position/yOffset", 0] } + } + } + } + }; + } + constructor(options = {}) { + const { overrides, palette, params } = deepClone(options); + const defaults = this.createChartConfigPerChartType(this.getDefaults()); + const presets = {}; + if (overrides) { + this.processOverrides(presets, overrides); + } + const { fills, strokes, sequentialColors, ...otherColors } = this.getDefaultColors(); + this.palette = deepFreeze( + mergeDefaults(palette, { + fills: Object.values(fills), + strokes: Object.values(strokes), + sequentialColors: Object.values(sequentialColors), + ...otherColors + }) + ); + this.paletteType = paletteType(palette); + this.params = mergeDefaults(params, this.getPublicParameters()); + this.config = deepFreeze(deepClone(defaults)); + this.overrides = deepFreeze(overrides); + this.presets = deepFreeze(presets); + } + processOverrides(presets, overrides) { + for (const s of chartTypes2.seriesTypes) { + const seriesType = s; + const seriesOverrides = overrides[seriesType]; + if (isPresetOverridesType(seriesType)) { + presets[seriesType] = seriesOverrides; + delete overrides[seriesType]; + } + } + } + createChartConfigPerChartType(config) { + for (const [nextType, { seriesTypes }] of entries(CHART_TYPE_CONFIG)) { + const typeDefaults = chartDefaults.get(nextType); + for (const seriesType of seriesTypes) { + config[seriesType] ?? (config[seriesType] = typeDefaults); + } + } + return config; + } + getDefaults() { + const getOverridesByType = (chartType, seriesTypes) => { + const result = {}; + const chartTypeDefaults = { + axes: {}, + ...legendRegistry.getThemeTemplates(), + ...this.getChartDefaults(), + ...chartDefaults.get(chartType) + }; + for (const seriesType of seriesTypes) { + result[seriesType] = mergeDefaults( + seriesRegistry.getThemeTemplate(seriesType), + result[seriesType] ?? chartTypeDefaults + ); + const { axes } = result[seriesType]; + for (const axisType of axisRegistry.keys()) { + axes[axisType] = mergeDefaults( + axes[axisType], + axisRegistry.getThemeTemplate(axisType), + _ChartTheme.axisDefault[axisType] + ); + } + if (seriesType === "map-shape-background" || seriesType === "map-line-background") { + delete result[seriesType].series.tooltip; + } + } + return result; + }; + return mergeDefaults( + getOverridesByType("cartesian", chartTypes2.cartesianTypes), + getOverridesByType("polar", chartTypes2.polarTypes), + getOverridesByType("topology", chartTypes2.topologyTypes), + getOverridesByType("standalone", chartTypes2.standaloneTypes) + ); + } + static applyTemplateTheme(node, _other, params) { + if (isArray(node)) { + for (let i = 0; i < node.length; i++) { + const symbol = node[i]; + if (typeof symbol === "symbol" && params?.has(symbol)) { + node[i] = params.get(symbol); + } + } + } else { + for (const name of Object.keys(node)) { + const value = node[name]; + if (typeof value === "symbol" && params?.has(value)) { + node[name] = params.get(value); + } + } + } + } + templateTheme(themeTemplate, clone2 = true) { + const themeInstance = clone2 ? deepClone(themeTemplate) : themeTemplate; + const params = this.getTemplateParameters(); + jsonWalk(themeInstance, _ChartTheme.applyTemplateTheme, void 0, void 0, params); + return themeInstance; + } + getDefaultColors() { + return _ChartTheme.getDefaultColors(); + } + getPublicParameters() { + return _ChartTheme.getDefaultPublicParameters(); + } + // Private parameters that are not exposed in the themes API. + getTemplateParameters() { + const params = /* @__PURE__ */ new Map(); + params.set(IS_DARK_THEME, false); + params.set(DEFAULT_SEPARATION_LINES_COLOUR, "#d9d9d9"); + params.set(DEFAULT_SHADOW_COLOUR, "#00000080"); + params.set(DEFAULT_SPARKLINE_CROSSHAIR_STROKE, "#aaa"); + params.set(DEFAULT_CAPTION_LAYOUT_STYLE, "block"); + params.set(DEFAULT_CAPTION_ALIGNMENT, "center"); + params.set(DEFAULT_FIBONACCI_STROKES, [ + "#797b86", + "#e24c4a", + "#f49d2d", + "#65ab58", + "#409682", + "#4db9d2", + "#5090dc", + "#3068f9", + "#e24c4a", + "#913aac", + "#d93e64" + ]); + params.set(DEFAULT_POLAR_SERIES_STROKE, DEFAULT_BACKGROUND_FILL); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, DEFAULT_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, DEFAULT_FILLS.BLUE); + params.set(DEFAULT_TEXT_ANNOTATION_COLOR, DEFAULT_FILLS.BLUE); + params.set(DEFAULT_ANNOTATION_HANDLE_FILL, DEFAULT_BACKGROUND_FILL); + params.set(DEFAULT_ANNOTATION_STATISTICS_FILL, "#fafafa"); + params.set(DEFAULT_ANNOTATION_STATISTICS_STROKE, "#ddd"); + params.set(DEFAULT_ANNOTATION_STATISTICS_COLOR, "#000"); + params.set(DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE, "#181d1f"); + params.set(DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, "#e35c5c"); + params.set(DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE, "#e35c5c"); + params.set(DEFAULT_TEXTBOX_FILL, "#fafafa"); + params.set(DEFAULT_TEXTBOX_STROKE, "#ddd"); + params.set(DEFAULT_TEXTBOX_COLOR, "#000"); + params.set(DEFAULT_TOOLBAR_POSITION, "top"); + params.set(DEFAULT_GRIDLINE_ENABLED, false); + const defaultColors = this.getDefaultColors(); + params.set(PALETTE_UP_STROKE, this.palette.up?.stroke ?? defaultColors.up.stroke); + params.set(PALETTE_UP_FILL, this.palette.up?.fill ?? defaultColors.up.fill); + params.set(PALETTE_DOWN_STROKE, this.palette.down?.stroke ?? defaultColors.down.stroke); + params.set(PALETTE_DOWN_FILL, this.palette.down?.fill ?? defaultColors.down.fill); + params.set(PALETTE_NEUTRAL_STROKE, this.palette.neutral?.stroke ?? defaultColors.neutral.stroke); + params.set(PALETTE_NEUTRAL_FILL, this.palette.neutral?.fill ?? defaultColors.neutral.fill); + params.set(PALETTE_ALT_UP_STROKE, this.palette.altUp?.stroke ?? defaultColors.up.stroke); + params.set(PALETTE_ALT_UP_FILL, this.palette.altUp?.fill ?? defaultColors.up.fill); + params.set(PALETTE_ALT_DOWN_STROKE, this.palette.altDown?.stroke ?? defaultColors.down.stroke); + params.set(PALETTE_ALT_DOWN_FILL, this.palette.altDown?.fill ?? defaultColors.down.fill); + params.set(PALETTE_ALT_NEUTRAL_FILL, this.palette.altNeutral?.fill ?? defaultColors.altNeutral.fill); + params.set(PALETTE_ALT_NEUTRAL_STROKE, this.palette.altNeutral?.stroke ?? defaultColors.altNeutral.stroke); + return params; + } +}; +_ChartTheme.axisDefault = { + ["number" /* NUMBER */]: _ChartTheme.getAxisDefaults( + { + keys: [], + line: { enabled: false }, + crosshair: { enabled: true } + }, + { title: true, time: false } + ), + ["log" /* LOG */]: _ChartTheme.getAxisDefaults( + { + keys: [], + base: 10, + line: { enabled: false }, + crosshair: { enabled: true } + }, + { title: true, time: false } + ), + ["category" /* CATEGORY */]: _ChartTheme.getAxisDefaults( + { + keys: [], + groupPaddingInner: 0.1, + label: { autoRotate: true, wrapping: "on-space" }, + gridLine: { enabled: DEFAULT_GRIDLINE_ENABLED }, + crosshair: { enabled: false } + }, + { title: true, time: false } + ), + ["grouped-category" /* GROUPED_CATEGORY */]: _ChartTheme.getAxisDefaults( + { + keys: [], + tick: { enabled: true, stroke: DEFAULT_SEPARATION_LINES_COLOUR }, + label: { spacing: 10, rotation: 270, wrapping: "on-space" }, + maxThicknessRatio: 0.5, + paddingInner: 0.4, + groupPaddingInner: 0.2, + crosshair: { enabled: false } + }, + { title: true, time: false } + ), + ["time" /* TIME */]: _ChartTheme.getAxisDefaults( + { + keys: [], + gridLine: { enabled: DEFAULT_GRIDLINE_ENABLED }, + crosshair: { enabled: true } + }, + { title: true, time: true } + ), + ["unit-time" /* UNIT_TIME */]: _ChartTheme.getAxisDefaults( + { + keys: [], + groupPaddingInner: 0.1, + label: { autoRotate: false }, + gridLine: { enabled: DEFAULT_GRIDLINE_ENABLED }, + crosshair: { enabled: true }, + parentLevel: { enabled: true } + }, + { title: true, time: true } + ), + ["ordinal-time" /* ORDINAL_TIME */]: _ChartTheme.getAxisDefaults( + { + keys: [], + groupPaddingInner: 0, + label: { autoRotate: false }, + gridLine: { enabled: DEFAULT_GRIDLINE_ENABLED }, + crosshair: { enabled: true } + }, + { title: true, time: true } + ), + ["angle-category" /* ANGLE_CATEGORY */]: _ChartTheme.getAxisDefaults( + { + label: { spacing: 5 }, + gridLine: { enabled: DEFAULT_GRIDLINE_ENABLED }, + shape: { $findFirstSiblingNotOperation: void 0 } + }, + { title: false, time: false } + ), + ["angle-number" /* ANGLE_NUMBER */]: _ChartTheme.getAxisDefaults( + { + label: { spacing: 5 }, + gridLine: { enabled: DEFAULT_GRIDLINE_ENABLED } + }, + { title: false, time: false } + ), + ["radius-category" /* RADIUS_CATEGORY */]: _ChartTheme.getAxisDefaults( + { + positionAngle: 0, + line: { enabled: false }, + label: { minSpacing: 5 } + }, + { title: true, time: false } + ), + ["radius-number" /* RADIUS_NUMBER */]: _ChartTheme.getAxisDefaults( + { + positionAngle: 0, + line: { enabled: false }, + shape: { $findFirstSiblingNotOperation: void 0 }, + label: { minSpacing: 5 } + }, + { title: true, time: false } + ) +}; +var ChartTheme = _ChartTheme; + +// packages/ag-charts-community/src/chart/themes/darkTheme.ts +var DEFAULT_DARK_BACKGROUND_FILL = "#192232"; +var DEFAULT_DARK_FILLS = { + BLUE: "#5090dc", + ORANGE: "#ffa03a", + GREEN: "#459d55", + CYAN: "#34bfe1", + YELLOW: "#e1cc00", + VIOLET: "#9669cb", + GRAY: "#b5b5b5", + MAGENTA: "#bd5aa7", + BROWN: "#8a6224", + RED: "#ef5452" +}; +var DEFAULT_DARK_STROKES = { + BLUE: "#74a8e6", + ORANGE: "#ffbe70", + GREEN: "#6cb176", + CYAN: "#75d4ef", + YELLOW: "#f6e559", + VIOLET: "#aa86d8", + GRAY: "#a1a1a1", + MAGENTA: "#ce7ab9", + BROWN: "#997b52", + RED: "#ff7872" +}; +var DarkTheme = class extends ChartTheme { + getDefaultColors() { + return { + fills: DEFAULT_DARK_FILLS, + fillsFallback: Object.values(DEFAULT_DARK_FILLS), + strokes: DEFAULT_DARK_STROKES, + sequentialColors: getSequentialColors(DEFAULT_DARK_FILLS), + divergingColors: [DEFAULT_DARK_FILLS.ORANGE, DEFAULT_DARK_FILLS.YELLOW, DEFAULT_DARK_FILLS.GREEN], + hierarchyColors: ["#192834", "#253746", "#324859", "#3f596c", "#4d6a80"], + secondSequentialColors: [ + "#5090dc", + "#4882c6", + "#4073b0", + "#38659a", + "#305684", + "#28486e", + "#203a58", + "#182b42" + ], + secondDivergingColors: [DEFAULT_DARK_FILLS.GREEN, DEFAULT_DARK_FILLS.YELLOW, DEFAULT_DARK_FILLS.RED], + secondHierarchyColors: ["#192834", "#3b5164", "#496275", "#577287", "#668399"], + up: { fill: DEFAULT_DARK_FILLS.GREEN, stroke: DEFAULT_DARK_STROKES.GREEN }, + down: { fill: DEFAULT_DARK_FILLS.RED, stroke: DEFAULT_DARK_STROKES.RED }, + neutral: { fill: DEFAULT_DARK_FILLS.GRAY, stroke: DEFAULT_DARK_STROKES.GRAY }, + altUp: { fill: DEFAULT_DARK_FILLS.BLUE, stroke: DEFAULT_DARK_STROKES.BLUE }, + altDown: { fill: DEFAULT_DARK_FILLS.ORANGE, stroke: DEFAULT_DARK_STROKES.ORANGE }, + altNeutral: { fill: DEFAULT_DARK_FILLS.GRAY, stroke: DEFAULT_DARK_STROKES.GRAY } + }; + } + getPublicParameters() { + return { + ...super.getPublicParameters(), + axisColor: { $foregroundBackgroundMix: 0.737 }, + backgroundColor: DEFAULT_DARK_BACKGROUND_FILL, + borderColor: { $foregroundBackgroundMix: 0.216 }, + chromeBackgroundColor: { $foregroundBackgroundMix: 0.07 }, + foregroundColor: "#fff", + gridLineColor: { $foregroundBackgroundMix: 0.257 }, + popupShadow: "0 0 16px rgba(0, 0, 0, 0.33)", + subtleTextColor: { $mix: [{ $ref: "textColor" }, { $ref: "chartBackgroundColor" }, 0.57] }, + crosshairLabelBackgroundColor: { $foregroundBackgroundMix: 0.65 } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(IS_DARK_THEME, true); + params.set(DEFAULT_POLAR_SERIES_STROKE, DEFAULT_DARK_BACKGROUND_FILL); + params.set(DEFAULT_SEPARATION_LINES_COLOUR, "#7f8389"); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, DEFAULT_DARK_FILLS.BLUE); + params.set(DEFAULT_TEXT_ANNOTATION_COLOR, "#fff"); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, DEFAULT_DARK_FILLS.BLUE); + params.set(DEFAULT_ANNOTATION_HANDLE_FILL, DEFAULT_DARK_BACKGROUND_FILL); + params.set(DEFAULT_ANNOTATION_STATISTICS_FILL, "#28313e"); + params.set(DEFAULT_ANNOTATION_STATISTICS_STROKE, "#4b525d"); + params.set(DEFAULT_ANNOTATION_STATISTICS_COLOR, "#fff"); + params.set(DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE, "#fff"); + params.set(DEFAULT_TEXTBOX_FILL, "#28313e"); + params.set(DEFAULT_TEXTBOX_STROKE, "#4b525d"); + params.set(DEFAULT_TEXTBOX_COLOR, "#fff"); + return params; + } + constructor(options) { + super(options); + } +}; + +// packages/ag-charts-community/src/chart/themes/financialDark.ts +var FINANCIAL_DARK_FILLS = { + GREEN: "#089981", + RED: "#F23645", + BLUE: "#5090dc", + GRAY: "#A9A9A9" +}; +var FINANCIAL_DARK_STROKES = { + GREEN: "#089981", + RED: "#F23645", + BLUE: "#5090dc", + GRAY: "#909090" +}; +var FinancialDark = class extends DarkTheme { + getDefaultColors() { + return { + ...super.getDefaultColors(), + fills: { ...FINANCIAL_DARK_FILLS }, + fillsFallback: Object.values({ ...FINANCIAL_DARK_FILLS }), + strokes: { ...FINANCIAL_DARK_STROKES }, + sequentialColors: getSequentialColors(FINANCIAL_DARK_FILLS), + divergingColors: [FINANCIAL_DARK_FILLS.GREEN, FINANCIAL_DARK_FILLS.BLUE, FINANCIAL_DARK_FILLS.RED], + // hierarchyColors: [], + secondSequentialColors: [ + "#5090dc", + "#4882c6", + "#4073b0", + "#38659a", + "#305684", + "#28486e", + "#203a58", + "#182b42" + ], + // secondDivergingColors: [], + // secondHierarchyColors: [], + up: { fill: FINANCIAL_DARK_FILLS.GREEN, stroke: FINANCIAL_DARK_STROKES.GREEN }, + down: { fill: FINANCIAL_DARK_FILLS.RED, stroke: FINANCIAL_DARK_STROKES.RED }, + neutral: { fill: FINANCIAL_DARK_FILLS.BLUE, stroke: FINANCIAL_DARK_STROKES.BLUE }, + altUp: { fill: FINANCIAL_DARK_FILLS.GREEN, stroke: FINANCIAL_DARK_STROKES.GREEN }, + altDown: { fill: FINANCIAL_DARK_FILLS.RED, stroke: FINANCIAL_DARK_STROKES.RED }, + altNeutral: { fill: FINANCIAL_DARK_FILLS.GRAY, stroke: FINANCIAL_DARK_STROKES.GRAY } + }; + } + getPublicParameters() { + return { + ...super.getPublicParameters(), + chartPadding: 0, + gridLineColor: { $foregroundBackgroundMix: 0.12 } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, FINANCIAL_DARK_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, FINANCIAL_DARK_FILLS.BLUE); + params.set(DEFAULT_CAPTION_LAYOUT_STYLE, "overlay"); + params.set(DEFAULT_CAPTION_ALIGNMENT, "left"); + params.set(DEFAULT_TOOLBAR_POSITION, "bottom"); + params.set(DEFAULT_GRIDLINE_ENABLED, true); + return params; + } +}; + +// packages/ag-charts-community/src/chart/themes/financialLight.ts +var FINANCIAL_LIGHT_FILLS = { + GREEN: "#089981", + RED: "#F23645", + BLUE: "#5090dc", + GRAY: "#A9A9A9" +}; +var FINANCIAL_LIGHT_STROKES = { + GREEN: "#089981", + RED: "#F23645", + BLUE: "#5090dc", + GRAY: "#909090" +}; +var FinancialLight = class extends ChartTheme { + getDefaultColors() { + return { + ...super.getDefaultColors(), + fills: { ...FINANCIAL_LIGHT_FILLS }, + fillsFallback: Object.values({ ...FINANCIAL_LIGHT_FILLS }), + strokes: { ...FINANCIAL_LIGHT_STROKES }, + sequentialColors: getSequentialColors(FINANCIAL_LIGHT_FILLS), + divergingColors: [FINANCIAL_LIGHT_FILLS.GREEN, FINANCIAL_LIGHT_FILLS.BLUE, FINANCIAL_LIGHT_FILLS.RED], + // hierarchyColors: [], + // secondSequentialColors: [], + // secondDivergingColors: [], + // secondHierarchyColors: [], + up: { fill: FINANCIAL_LIGHT_FILLS.GREEN, stroke: FINANCIAL_LIGHT_STROKES.GREEN }, + down: { fill: FINANCIAL_LIGHT_FILLS.RED, stroke: FINANCIAL_LIGHT_STROKES.RED }, + neutral: { fill: FINANCIAL_LIGHT_FILLS.BLUE, stroke: FINANCIAL_LIGHT_STROKES.BLUE }, + altUp: { fill: FINANCIAL_LIGHT_FILLS.GREEN, stroke: FINANCIAL_LIGHT_STROKES.GREEN }, + altDown: { fill: FINANCIAL_LIGHT_FILLS.RED, stroke: FINANCIAL_LIGHT_STROKES.RED }, + altNeutral: { fill: FINANCIAL_LIGHT_FILLS.GRAY, stroke: FINANCIAL_LIGHT_STROKES.GRAY } + }; + } + getPublicParameters() { + return { + ...super.getPublicParameters(), + chartPadding: 0, + gridLineColor: { $foregroundBackgroundMix: 0.06 } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, FINANCIAL_LIGHT_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, FINANCIAL_LIGHT_FILLS.BLUE); + params.set(DEFAULT_CAPTION_LAYOUT_STYLE, "overlay"); + params.set(DEFAULT_CAPTION_ALIGNMENT, "left"); + params.set(DEFAULT_TOOLBAR_POSITION, "bottom"); + params.set(DEFAULT_GRIDLINE_ENABLED, true); + return params; + } +}; + +// packages/ag-charts-community/src/chart/themes/materialDark.ts +var MATERIAL_DARK_FILLS = { + BLUE: "#2196F3", + ORANGE: "#FF9800", + GREEN: "#4CAF50", + CYAN: "#00BCD4", + YELLOW: "#FFEB3B", + VIOLET: "#7E57C2", + GRAY: "#9E9E9E", + MAGENTA: "#F06292", + BROWN: "#795548", + RED: "#F44336" +}; +var MATERIAL_DARK_STROKES = { + BLUE: "#90CAF9", + ORANGE: "#FFCC80", + GREEN: "#A5D6A7", + CYAN: "#80DEEA", + YELLOW: "#FFF9C4", + VIOLET: "#B39DDB", + GRAY: "#E0E0E0", + MAGENTA: "#F48FB1", + BROWN: "#A1887F", + RED: "#EF9A9A" +}; +var MaterialDark = class extends DarkTheme { + getDefaultColors() { + return { + ...super.getDefaultColors(), + fills: MATERIAL_DARK_FILLS, + fillsFallback: Object.values(MATERIAL_DARK_FILLS), + strokes: MATERIAL_DARK_STROKES, + sequentialColors: getSequentialColors(MATERIAL_DARK_FILLS), + divergingColors: [MATERIAL_DARK_FILLS.ORANGE, MATERIAL_DARK_FILLS.YELLOW, MATERIAL_DARK_FILLS.GREEN], + // hierarchyColors: [], + secondSequentialColors: [ + "#2196f3", + // 500 + "#208FEC", + // (interpolated) + "#1E88E5", + // 600 + "#1C7FDC", + // (interpolated) + "#1976d2", + // 700 + "#176EC9", + // (interpolated) + "#1565c0" + // 800 + ], + secondDivergingColors: [MATERIAL_DARK_FILLS.GREEN, MATERIAL_DARK_FILLS.YELLOW, MATERIAL_DARK_FILLS.RED], + // secondHierarchyColors: [], + up: { fill: MATERIAL_DARK_FILLS.GREEN, stroke: MATERIAL_DARK_STROKES.GREEN }, + down: { fill: MATERIAL_DARK_FILLS.RED, stroke: MATERIAL_DARK_STROKES.RED }, + neutral: { fill: MATERIAL_DARK_FILLS.GRAY, stroke: MATERIAL_DARK_STROKES.GRAY }, + altUp: { fill: MATERIAL_DARK_FILLS.BLUE, stroke: MATERIAL_DARK_STROKES.BLUE }, + altDown: { fill: MATERIAL_DARK_FILLS.RED, stroke: MATERIAL_DARK_STROKES.RED }, + altNeutral: { fill: MATERIAL_DARK_FILLS.GRAY, stroke: MATERIAL_DARK_STROKES.GRAY } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, MATERIAL_DARK_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, MATERIAL_DARK_FILLS.BLUE); + return params; + } +}; + +// packages/ag-charts-community/src/chart/themes/materialLight.ts +var MATERIAL_LIGHT_FILLS = { + BLUE: "#2196F3", + ORANGE: "#FF9800", + GREEN: "#4CAF50", + CYAN: "#00BCD4", + YELLOW: "#FFEB3B", + VIOLET: "#7E57C2", + GRAY: "#9E9E9E", + MAGENTA: "#F06292", + BROWN: "#795548", + RED: "#F44336" +}; +var MATERIAL_LIGHT_STROKES = { + BLUE: "#1565C0", + ORANGE: "#E65100", + GREEN: "#2E7D32", + CYAN: "#00838F", + YELLOW: "#F9A825", + VIOLET: "#4527A0", + GRAY: "#616161", + MAGENTA: "#C2185B", + BROWN: "#4E342E", + RED: "#B71C1C" +}; +var MaterialLight = class extends ChartTheme { + getDefaultColors() { + return { + ...super.getDefaultColors(), + fills: MATERIAL_LIGHT_FILLS, + fillsFallback: Object.values(MATERIAL_LIGHT_FILLS), + strokes: MATERIAL_LIGHT_STROKES, + sequentialColors: getSequentialColors(MATERIAL_LIGHT_FILLS), + divergingColors: [MATERIAL_LIGHT_FILLS.ORANGE, MATERIAL_LIGHT_FILLS.YELLOW, MATERIAL_LIGHT_FILLS.GREEN], + // hierarchyColors: [], + secondSequentialColors: [ + "#2196f3", + // 500 + "#329EF4", + // (interpolated) + "#42a5f5", + // 400 + "#53ADF6", + // (interpolated) + "#64b5f6", + // 300 + "#7AC0F8", + // (interpolated) + "#90caf9" + // 200 + ], + secondDivergingColors: [MATERIAL_LIGHT_FILLS.GREEN, MATERIAL_LIGHT_FILLS.YELLOW, MATERIAL_LIGHT_FILLS.RED], + // secondHierarchyColors: [], + up: { fill: MATERIAL_LIGHT_FILLS.GREEN, stroke: MATERIAL_LIGHT_STROKES.GREEN }, + down: { fill: MATERIAL_LIGHT_FILLS.RED, stroke: MATERIAL_LIGHT_STROKES.RED }, + neutral: { fill: MATERIAL_LIGHT_FILLS.GRAY, stroke: MATERIAL_LIGHT_STROKES.GRAY }, + altUp: { fill: MATERIAL_LIGHT_FILLS.BLUE, stroke: MATERIAL_LIGHT_STROKES.BLUE }, + altDown: { fill: MATERIAL_LIGHT_FILLS.RED, stroke: MATERIAL_LIGHT_STROKES.RED }, + altNeutral: { fill: MATERIAL_LIGHT_FILLS.GRAY, stroke: MATERIAL_LIGHT_STROKES.GRAY } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, MATERIAL_LIGHT_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, MATERIAL_LIGHT_FILLS.BLUE); + return params; + } +}; + +// packages/ag-charts-community/src/chart/themes/polychromaDark.ts +var POLYCHROMA_DARK_FILLS = { + BLUE: "#436ff4", + PURPLE: "#9a7bff", + MAGENTA: "#d165d2", + PINK: "#f0598b", + RED: "#f47348", + ORANGE: "#f2a602", + YELLOW: "#e9e201", + GREEN: "#21b448", + CYAN: "#00b9a2", + MODERATE_BLUE: "#00aee4", + GRAY: "#bbbbbb" +}; +var POLYCHROMA_DARK_STROKES = { + BLUE: "#6698ff", + PURPLE: "#c0a3ff", + MAGENTA: "#fc8dfc", + PINK: "#ff82b1", + RED: "#ff9b70", + ORANGE: "#ffcf4e", + YELLOW: "#ffff58", + GREEN: "#58dd70", + CYAN: "#51e2c9", + MODERATE_BLUE: "#4fd7ff", + GRAY: "#eeeeee" +}; +var PolychromaDark = class extends DarkTheme { + getDefaultColors() { + return { + fills: POLYCHROMA_DARK_FILLS, + fillsFallback: Object.values(POLYCHROMA_DARK_FILLS), + strokes: POLYCHROMA_DARK_STROKES, + sequentialColors: getSequentialColors(POLYCHROMA_DARK_FILLS), + divergingColors: [POLYCHROMA_DARK_FILLS.BLUE, POLYCHROMA_DARK_FILLS.RED], + hierarchyColors: [], + secondSequentialColors: [ + POLYCHROMA_DARK_FILLS.BLUE, + POLYCHROMA_DARK_FILLS.PURPLE, + POLYCHROMA_DARK_FILLS.MAGENTA, + POLYCHROMA_DARK_FILLS.PINK, + POLYCHROMA_DARK_FILLS.RED, + POLYCHROMA_DARK_FILLS.ORANGE, + POLYCHROMA_DARK_FILLS.YELLOW, + POLYCHROMA_DARK_FILLS.GREEN + ], + secondDivergingColors: [POLYCHROMA_DARK_FILLS.BLUE, POLYCHROMA_DARK_FILLS.RED], + secondHierarchyColors: [], + up: { fill: POLYCHROMA_DARK_FILLS.GREEN, stroke: POLYCHROMA_DARK_STROKES.GREEN }, + down: { fill: POLYCHROMA_DARK_FILLS.RED, stroke: POLYCHROMA_DARK_STROKES.RED }, + neutral: { fill: POLYCHROMA_DARK_FILLS.GRAY, stroke: POLYCHROMA_DARK_STROKES.GRAY }, + altUp: { fill: POLYCHROMA_DARK_FILLS.BLUE, stroke: POLYCHROMA_DARK_STROKES.BLUE }, + altDown: { fill: POLYCHROMA_DARK_FILLS.RED, stroke: POLYCHROMA_DARK_STROKES.RED }, + altNeutral: { fill: POLYCHROMA_DARK_FILLS.GRAY, stroke: POLYCHROMA_DARK_STROKES.GRAY } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, POLYCHROMA_DARK_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, POLYCHROMA_DARK_FILLS.BLUE); + return params; + } +}; + +// packages/ag-charts-community/src/chart/themes/polychromaLight.ts +var POLYCHROMA_LIGHT_FILLS = { + BLUE: "#436ff4", + PURPLE: "#9a7bff", + MAGENTA: "#d165d2", + PINK: "#f0598b", + RED: "#f47348", + ORANGE: "#f2a602", + YELLOW: "#e9e201", + GREEN: "#21b448", + CYAN: "#00b9a2", + MODERATE_BLUE: "#00aee4", + GRAY: "#bbbbbb" +}; +var POLYCHROMA_LIGHT_STROKES = { + BLUE: "#2346c9", + PURPLE: "#7653d4", + MAGENTA: "#a73da9", + PINK: "#c32d66", + RED: "#c84b1c", + ORANGE: "#c87f00", + YELLOW: "#c1b900", + GREEN: "#008c1c", + CYAN: "#00927c", + MODERATE_BLUE: "#0087bb", + GRAY: "#888888" +}; +var PolychromaLight = class extends ChartTheme { + getDefaultColors() { + return { + ...super.getDefaultColors(), + fills: POLYCHROMA_LIGHT_FILLS, + fillsFallback: Object.values(POLYCHROMA_LIGHT_FILLS), + strokes: POLYCHROMA_LIGHT_STROKES, + sequentialColors: getSequentialColors(POLYCHROMA_LIGHT_FILLS), + divergingColors: [POLYCHROMA_LIGHT_FILLS.BLUE, POLYCHROMA_LIGHT_FILLS.RED], + hierarchyColors: [], + secondSequentialColors: [ + POLYCHROMA_LIGHT_FILLS.BLUE, + POLYCHROMA_LIGHT_FILLS.PURPLE, + POLYCHROMA_LIGHT_FILLS.MAGENTA, + POLYCHROMA_LIGHT_FILLS.PINK, + POLYCHROMA_LIGHT_FILLS.RED, + POLYCHROMA_LIGHT_FILLS.ORANGE, + POLYCHROMA_LIGHT_FILLS.YELLOW, + POLYCHROMA_LIGHT_FILLS.GREEN + ], + secondDivergingColors: [POLYCHROMA_LIGHT_FILLS.BLUE, POLYCHROMA_LIGHT_FILLS.RED], + secondHierarchyColors: [], + up: { fill: POLYCHROMA_LIGHT_FILLS.GREEN, stroke: POLYCHROMA_LIGHT_STROKES.GREEN }, + down: { fill: POLYCHROMA_LIGHT_FILLS.RED, stroke: POLYCHROMA_LIGHT_STROKES.RED }, + neutral: { fill: POLYCHROMA_LIGHT_FILLS.GRAY, stroke: POLYCHROMA_LIGHT_STROKES.GRAY }, + altUp: { fill: POLYCHROMA_LIGHT_FILLS.BLUE, stroke: POLYCHROMA_LIGHT_STROKES.BLUE }, + altDown: { fill: POLYCHROMA_LIGHT_FILLS.RED, stroke: POLYCHROMA_LIGHT_STROKES.RED }, + altNeutral: { fill: POLYCHROMA_LIGHT_FILLS.GRAY, stroke: POLYCHROMA_LIGHT_STROKES.GRAY } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, POLYCHROMA_LIGHT_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, POLYCHROMA_LIGHT_FILLS.BLUE); + return params; + } +}; + +// packages/ag-charts-community/src/chart/themes/sheetsDark.ts +var SHEETS_DARK_FILLS = { + BLUE: "#4472C4", + ORANGE: "#ED7D31", + GRAY: "#A5A5A5", + YELLOW: "#FFC000", + MODERATE_BLUE: "#5B9BD5", + GREEN: "#70AD47", + DARK_GRAY: "#7B7B7B", + DARK_BLUE: "#264478", + VERY_DARK_GRAY: "#636363", + DARK_YELLOW: "#997300" +}; +var SHEETS_DARK_STROKES = { + BLUE: "#6899ee", + ORANGE: "#ffa55d", + GRAY: "#cdcdcd", + YELLOW: "#ffea53", + MODERATE_BLUE: "#82c3ff", + GREEN: "#96d56f", + DARK_GRAY: "#a1a1a1", + DARK_BLUE: "#47689f", + VERY_DARK_GRAY: "#878787", + DARK_YELLOW: "#c0993d" +}; +var SheetsDark = class extends DarkTheme { + getDefaultColors() { + return { + ...super.getDefaultColors(), + fills: { ...SHEETS_DARK_FILLS, RED: SHEETS_DARK_FILLS.ORANGE }, + fillsFallback: Object.values({ ...SHEETS_DARK_FILLS, RED: SHEETS_DARK_FILLS.ORANGE }), + strokes: { ...SHEETS_DARK_STROKES, RED: SHEETS_DARK_STROKES.ORANGE }, + sequentialColors: getSequentialColors({ ...SHEETS_DARK_FILLS, RED: SHEETS_DARK_FILLS.ORANGE }), + divergingColors: [SHEETS_DARK_FILLS.ORANGE, SHEETS_DARK_FILLS.YELLOW, SHEETS_DARK_FILLS.GREEN], + // hierarchyColors: [], + secondSequentialColors: [ + "#5090dc", + "#4882c6", + "#4073b0", + "#38659a", + "#305684", + "#28486e", + "#203a58", + "#182b42" + ], + secondDivergingColors: [SHEETS_DARK_FILLS.GREEN, SHEETS_DARK_FILLS.YELLOW, SHEETS_DARK_FILLS.ORANGE], + // secondHierarchyColors: [], + up: { fill: SHEETS_DARK_FILLS.GREEN, stroke: SHEETS_DARK_STROKES.GREEN }, + down: { fill: SHEETS_DARK_FILLS.ORANGE, stroke: SHEETS_DARK_STROKES.ORANGE }, + neutral: { fill: SHEETS_DARK_FILLS.GRAY, stroke: SHEETS_DARK_STROKES.GRAY }, + altUp: { fill: SHEETS_DARK_FILLS.BLUE, stroke: SHEETS_DARK_STROKES.BLUE }, + altDown: { fill: SHEETS_DARK_FILLS.ORANGE, stroke: SHEETS_DARK_STROKES.ORANGE }, + altNeutral: { fill: SHEETS_DARK_FILLS.GRAY, stroke: SHEETS_DARK_STROKES.GRAY } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, SHEETS_DARK_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, SHEETS_DARK_FILLS.BLUE); + return params; + } +}; + +// packages/ag-charts-community/src/chart/themes/sheetsLight.ts +var SHEETS_LIGHT_FILLS = { + BLUE: "#5281d5", + ORANGE: "#ff8d44", + GRAY: "#b5b5b5", + YELLOW: "#ffd02f", + MODERATE_BLUE: "#6aabe6", + GREEN: "#7fbd57", + DARK_GRAY: "#8a8a8a", + DARK_BLUE: "#335287", + VERY_DARK_GRAY: "#717171", + DARK_YELLOW: "#a98220" +}; +var SHEETS_LIGHT_STROKES = { + BLUE: "#214d9b", + ORANGE: "#c25600", + GRAY: "#7f7f7f", + YELLOW: "#d59800", + MODERATE_BLUE: "#3575ac", + GREEN: "#4b861a", + DARK_GRAY: "#575757", + DARK_BLUE: "#062253", + VERY_DARK_GRAY: "#414141", + DARK_YELLOW: "#734f00" +}; +var SheetsLight = class extends ChartTheme { + getDefaultColors() { + return { + ...super.getDefaultColors(), + fills: { ...SHEETS_LIGHT_FILLS, RED: SHEETS_LIGHT_FILLS.ORANGE }, + fillsFallback: Object.values({ ...SHEETS_LIGHT_FILLS, RED: SHEETS_LIGHT_FILLS.ORANGE }), + strokes: { ...SHEETS_LIGHT_STROKES, RED: SHEETS_LIGHT_STROKES.ORANGE }, + sequentialColors: getSequentialColors({ ...SHEETS_LIGHT_FILLS, RED: SHEETS_LIGHT_FILLS.ORANGE }), + divergingColors: [SHEETS_LIGHT_FILLS.ORANGE, SHEETS_LIGHT_FILLS.YELLOW, SHEETS_LIGHT_FILLS.GREEN], + // hierarchyColors: [], + secondSequentialColors: [ + "#5090dc", + "#629be0", + "#73a6e3", + "#85b1e7", + "#96bcea", + "#a8c8ee", + "#b9d3f1", + "#cbdef5" + ], + secondDivergingColors: [SHEETS_LIGHT_FILLS.GREEN, SHEETS_LIGHT_FILLS.YELLOW, SHEETS_LIGHT_FILLS.ORANGE], + secondHierarchyColors: [], + up: { fill: SHEETS_LIGHT_FILLS.GREEN, stroke: SHEETS_LIGHT_STROKES.GREEN }, + down: { fill: SHEETS_LIGHT_FILLS.ORANGE, stroke: SHEETS_LIGHT_STROKES.ORANGE }, + neutral: { fill: SHEETS_LIGHT_STROKES.GRAY, stroke: SHEETS_LIGHT_STROKES.GRAY }, + altUp: { fill: SHEETS_LIGHT_FILLS.BLUE, stroke: SHEETS_LIGHT_STROKES.BLUE }, + altDown: { fill: SHEETS_LIGHT_FILLS.ORANGE, stroke: SHEETS_LIGHT_STROKES.ORANGE }, + altNeutral: { fill: SHEETS_LIGHT_FILLS.GRAY, stroke: SHEETS_LIGHT_STROKES.GRAY } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, SHEETS_LIGHT_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, SHEETS_LIGHT_FILLS.BLUE); + return params; + } +}; + +// packages/ag-charts-community/src/chart/commonOptionsDefs.ts +var legendPlacementLiterals = [ + "top", + "top-right", + "top-left", + "bottom", + "bottom-right", + "bottom-left", + "right", + "right-top", + "right-bottom", + "left", + "left-top", + "left-bottom" +]; +var legendPositionOptionsDef = { + floating: boolean, + placement: union(...legendPlacementLiterals), + xOffset: number, + yOffset: number +}; +var legendPositionValidator = attachDescription( + (value, context) => { + let result; + if (typeof value === "string") { + const allowedValues = legendPlacementLiterals; + if (allowedValues.includes(value)) { + result = true; + } else { + result = { valid: false, invalid: [], cleared: null }; + result.invalid.push( + new ValidationError( + "invalid" /* Invalid */, + `a legend placement string: ["${legendPlacementLiterals.join('", "')}"]`, + value, + context.path + ) + ); + } + } else { + const { cleared, invalid } = validate(value, legendPositionOptionsDef); + result = { valid: invalid.length === 0, cleared, invalid }; + } + return result; + }, + `a legend position object or placement string` +); +var shapeValidator = or( + union("circle", "cross", "diamond", "heart", "plus", "pin", "square", "star", "triangle"), + callback +); +var textWrapValidator = union("never", "always", "hyphenate", "on-space"); +var tooltipPlacementValidator = union( + "top", + "right", + "bottom", + "left", + "top-right", + "bottom-right", + "bottom-left", + "top-left", + "center" +); +var rangeValidator2 = or(positiveNumber, union("exact", "nearest")); +var textOrSegments = or( + string, + // TODO remove undocumented in next major version, or make official and add to external types + undocumented(number), + undocumented(date), + arrayOfDefs( + { + text: required(string), + ...fontOptionsDef + }, + "text segments array" + ) +); +var zoomAnchorPoint = union("pointer", "start", "middle", "end"); +var chartCaptionOptionsDefs = { + enabled: boolean, + text: textOrSegments, + textAlign: union("left", "center", "right"), + wrapping: union("never", "always", "hyphenate", "on-space"), + spacing: positiveNumber, + maxWidth: positiveNumber, + maxHeight: positiveNumber, + ...fontOptionsDef +}; +chartCaptionOptionsDefs.padding = undocumented(positiveNumber); +var chartOverlayOptionsDefs = { + enabled: boolean, + text: textOrSegments, + renderer: callbackOf(or(string, htmlElement)) +}; +var contextMenuItemLiterals = [ + "defaults", + "download", + "zoom-to-cursor", + "pan-to-cursor", + "reset-zoom", + "toggle-series-visibility", + "toggle-other-series", + "separator" +]; +var contextMenuItemObjectDef = { + type: union("action", "separator"), + showOn: union("always", "series-area", "series-node", "legend-item"), + label: required(string), + enabled: boolean, + action: callback, + items: (value, context) => contextMenuItemsArray(value, context) +}; +contextMenuItemObjectDef.iconUrl = undocumented(string); +var contextMenuItemObjectValidator = optionsDefs(contextMenuItemObjectDef); +var contextMenuItemValidator = attachDescription( + (value, context) => { + let result; + if (typeof value === "string") { + const allowedValues = contextMenuItemLiterals; + if (allowedValues.includes(value)) { + result = true; + } else { + result = { valid: false, invalid: [], cleared: null }; + result.invalid.push( + new ValidationError( + "invalid" /* Invalid */, + `a context menu item string alias: ["${contextMenuItemLiterals.join('", "')}"]`, + value, + context.path + ) + ); + } + } else { + result = contextMenuItemObjectValidator(value, context); + } + return result; + }, + `a context menu item object or string alias: [${contextMenuItemLiterals.join(", ")}]` +); +var contextMenuItemsArray = arrayOf(contextMenuItemValidator, "a menu items array", false); +var toolbarButtonOptionsDefs = { + label: string, + ariaLabel: string, + tooltip: string, + icon: union( + "align-center", + "align-left", + "align-right", + "arrow-drawing", + "arrow-down-drawing", + "arrow-up-drawing", + "callout-annotation", + "candlestick-series", + "close", + "comment-annotation", + "date-range-drawing", + "date-price-range-drawing", + "delete", + "disjoint-channel-drawing", + "drag-handle", + "fill-color", + "line-style-solid", + "line-style-dashed", + "line-style-dotted", + "high-low-series", + "hlc-series", + "hollow-candlestick-series", + "horizontal-line-drawing", + "line-color", + "line-series", + "line-with-markers-series", + "locked", + "measurer-drawing", + "note-annotation", + "ohlc-series", + "pan-end", + "pan-left", + "pan-right", + "pan-start", + "parallel-channel-drawing", + "position-bottom", + "position-center", + "position-top", + "price-label-annotation", + "price-range-drawing", + "reset", + "settings", + "step-line-series", + "text-annotation", + "trend-line-drawing", + "fibonacci-retracement-drawing", + "fibonacci-retracement-trend-based-drawing", + "unlocked", + "vertical-line-drawing", + "zoom-in", + "zoom-out" + ) +}; +var formatter = or(string, callbackOf(textOrSegments)); +var formatObjectValidator = optionsDefs({ + x: formatter, + y: formatter, + angle: formatter, + radius: formatter, + size: formatter, + color: formatter, + label: formatter, + secondaryLabel: formatter, + sectorLabel: formatter, + calloutLabel: formatter, + legendItem: formatter +}); +var numberFormatValidator = attachDescription(isValidNumberFormat, "a valid number format string"); +var commonChartOptionsDefs = { + width: positiveNumber, + height: positiveNumber, + minWidth: positiveNumber, + minHeight: positiveNumber, + suppressFieldDotNotation: boolean, + title: chartCaptionOptionsDefs, + subtitle: chartCaptionOptionsDefs, + footnote: chartCaptionOptionsDefs, + padding: { + top: positiveNumber, + right: positiveNumber, + bottom: positiveNumber, + left: positiveNumber + }, + seriesArea: { + border: borderOptionsDef, + clip: boolean, + cornerRadius: number, + padding + }, + legend: { + enabled: boolean, + position: legendPositionValidator, + orientation: union("horizontal", "vertical"), + maxWidth: positiveNumber, + maxHeight: positiveNumber, + spacing: positiveNumber, + border: borderOptionsDef, + cornerRadius: number, + padding, + fill: colorUnion, + fillOpacity: ratio, + preventHidingAll: boolean, + reverseOrder: boolean, + toggleSeries: boolean, + item: { + marker: { + size: positiveNumber, + shape: shapeValidator, + padding: positiveNumber, + strokeWidth: positiveNumber + }, + line: { + length: positiveNumber, + strokeWidth: positiveNumber + }, + label: { + maxLength: positiveNumber, + formatter: callback, + ...fontOptionsDef + }, + maxWidth: positiveNumber, + paddingX: positiveNumber, + paddingY: positiveNumber, + showSeriesStroke: boolean + }, + pagination: { + marker: { + size: positiveNumber, + shape: shapeValidator, + padding: positiveNumber + }, + activeStyle: { + ...fillOptionsDef, + ...strokeOptionsDef + }, + inactiveStyle: { + ...fillOptionsDef, + ...strokeOptionsDef + }, + highlightStyle: { + ...fillOptionsDef, + ...strokeOptionsDef + }, + label: fontOptionsDef + }, + listeners: { + legendItemClick: callback, + legendItemDoubleClick: callback + } + }, + gradientLegend: { + enabled: boolean, + position: legendPositionValidator, + spacing: positiveNumber, + reverseOrder: boolean, + border: borderOptionsDef, + cornerRadius: number, + padding, + fill: colorUnion, + fillOpacity: ratio, + gradient: { + preferredLength: positiveNumber, + thickness: positiveNumber + }, + scale: { + label: { + ...fontOptionsDef, + minSpacing: positiveNumber, + format: numberFormatValidator, + formatter: callback + }, + padding: positiveNumber, + interval: { + step: number, + values: array, + minSpacing: and(positiveNumber, lessThan("maxSpacing")), + maxSpacing: and(positiveNumber, greaterThan("minSpacing")) + } + } + }, + listeners: { + seriesNodeClick: callback, + seriesNodeDoubleClick: callback, + seriesVisibilityChange: callback, + click: callback, + doubleClick: callback, + annotations: callback, + zoom: callback + }, + loadGoogleFonts: boolean, + highlight: { + drawingMode: union("overlay", "cutout"), + range: union("tooltip", "node") + }, + overlays: { + loading: chartOverlayOptionsDefs, + noData: chartOverlayOptionsDefs, + noVisibleSeries: chartOverlayOptionsDefs, + unsupportedBrowser: chartOverlayOptionsDefs + }, + tooltip: { + enabled: boolean, + showArrow: boolean, + pagination: boolean, + delay: positiveNumber, + range: rangeValidator2, + wrapping: textWrapValidator, + mode: union("single", "shared", "compact"), + position: { + anchorTo: union("pointer", "node", "chart"), + placement: or(tooltipPlacementValidator, arrayOf(tooltipPlacementValidator)), + xOffset: number, + yOffset: number + } + }, + animation: { + enabled: boolean, + duration: positiveNumber + }, + contextMenu: { + enabled: boolean, + items: contextMenuItemsArray + }, + context: () => true, + dataSource: { + getData: callback + }, + keyboard: { + enabled: boolean, + tabIndex: number + }, + touch: { + dragAction: union("none", "drag", "hover") + }, + ranges: { + enabled: boolean, + buttons: arrayOfDefs( + { + ...toolbarButtonOptionsDefs, + value: or(number, and(arrayOf(or(number, date)), arrayLength(2, 2)), callback) + }, + "range button options array" + ) + }, + // modules + locale: { + localeText: object, + getLocaleText: callbackOf(string) + }, + background: { + visible: boolean, + fill: color, + // enterprise + image: { + url: required(string), + top: number, + right: number, + bottom: number, + left: number, + width: positiveNumber, + height: positiveNumber, + opacity: ratio + } + }, + styleNonce: string, + sync: { + enabled: boolean, + groupId: string, + axes: union("x", "y", "xy"), + nodeInteraction: boolean, + zoom: boolean + }, + zoom: { + enabled: boolean, + enableAxisDragging: boolean, + enableAxisScrolling: boolean, + enableDoubleClickToReset: boolean, + enablePanning: boolean, + enableScrolling: boolean, + enableSelecting: boolean, + enableTwoFingerZoom: boolean, + keepAspectRatio: boolean, + anchorPointX: zoomAnchorPoint, + anchorPointY: zoomAnchorPoint, + axisDraggingMode: union("pan", "zoom"), + axes: union("x", "y", "xy"), + deceleration: or(union("off", "short", "long"), ratio), + minVisibleItems: positiveNumber, + panKey: union("alt", "ctrl", "meta", "shift"), + scrollingStep: ratio, + autoScaling: { + enabled: boolean, + padding: ratio + }, + buttons: { + enabled: boolean, + buttons: arrayOfDefs( + { + ...toolbarButtonOptionsDefs, + value: union("reset", "zoom-in", "zoom-out", "pan-left", "pan-right", "pan-start", "pan-end"), + section: string + }, + "zoom button options array" + ), + visible: union("always", "zoomed", "hover") + } + }, + formatter: or(callbackOf(textOrSegments), formatObjectValidator) +}; +commonChartOptionsDefs.dataSource.requestThrottle = undocumented(positiveNumber); +commonChartOptionsDefs.dataSource.updateThrottle = undocumented(positiveNumber); +commonChartOptionsDefs.dataSource.updateDuringInteraction = undocumented(boolean); +commonChartOptionsDefs.zoom.enableIndependentAxes = undocumented(boolean); +commonChartOptionsDefs.statusBar = undocumented(defined); +commonChartOptionsDefs.foreground = undocumented({ + visible: boolean, + text: string, + image: { + url: string, + top: number, + right: number, + bottom: number, + left: number, + width: positiveNumber, + height: positiveNumber, + opacity: ratio + }, + ...fillOptionsDef +}); +commonChartOptionsDefs.overrideDevicePixelRatio = undocumented(number); +commonChartOptionsDefs.sync.domainMode = undocumented(union("direction", "position", "key")); +var commonSeriesThemeableOptionsDefs = { + cursor: string, + context: () => true, + showInLegend: boolean, + nodeClickRange: rangeValidator2, + listeners: { + seriesNodeClick: callback, + seriesNodeDoubleClick: callback + }, + // TODO Remove in next major version + highlightStyle: { + item: { ...fillOptionsDef, ...strokeOptionsDef }, + series: { + enabled: boolean, + dimOpacity: ratio, + strokeWidth: positiveNumber + } + }, + highlight: highlightOptionsDef(shapeHighlightOptionsDef) +}; +var commonSeriesOptionsDefs = { + ...commonSeriesThemeableOptionsDefs, + id: string, + visible: boolean, + context: () => true, + data: array +}; +commonSeriesOptionsDefs.seriesGrouping = undocumented(defined); +var markerStyleOptionsDefs = { + shape: shapeValidator, + size: positiveNumber, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var markerOptionsDefs = { + enabled: boolean, + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + shape: shapeValidator, + size: positiveNumber + }), + ...markerStyleOptionsDefs +}; +var seriesLabelOptionsDefs = { + enabled: boolean, + formatter: callbackOf(textOrSegments), + format: numberFormatValidator, + itemStyler: callbackDefs({ + enabled: boolean, + ...labelBoxOptionsDef, + ...fontOptionsDef + }), + ...labelBoxOptionsDef, + ...fontOptionsDef +}; +var autoSizedLabelOptionsDefs = { + ...seriesLabelOptionsDefs, + lineHeight: positiveNumber, + minimumFontSize: positiveNumber, + wrapping: textWrapValidator, + overflowStrategy: union("ellipsis", "hide") +}; +var errorBarThemeableOptionsDefs = { + visible: boolean, + cap: { + visible: boolean, + length: positiveNumber, + lengthRatio: ratio, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var errorBarOptionsDefs = { + ...errorBarThemeableOptionsDefs, + xLowerKey: string, + xUpperKey: string, + yLowerKey: string, + yUpperKey: string, + xLowerName: string, + xUpperName: string, + yLowerName: string, + yUpperName: string, + itemStyler: callbackDefs({ + visible: boolean, + ...strokeOptionsDef, + ...lineDashOptionsDef, + cap: { + visible: boolean, + length: positiveNumber, + lengthRatio: ratio, + ...strokeOptionsDef, + ...lineDashOptionsDef + } + }) +}; +var tooltipOptionsDefs = { + enabled: boolean, + showArrow: boolean, + range: rangeValidator2, + renderer: callbackOf( + or( + string, + optionsDefs( + { + heading: string, + title: string, + data: arrayOfDefs({ + label: required(string), + value: required(string) + }) + }, + "tooltip renderer result object" + ) + ) + ), + position: { + anchorTo: union("node", "pointer", "chart"), + placement: or(tooltipPlacementValidator, arrayOf(tooltipPlacementValidator)), + xOffset: number, + yOffset: number + }, + interaction: { + enabled: boolean + } +}; +var shadowOptionsDefs = { + enabled: boolean, + xOffset: number, + yOffset: number, + blur: positiveNumber, + color +}; +var interpolationOptionsDefs = typeUnion( + { + linear: {}, + smooth: { + tension: ratio + }, + step: { + position: union("start", "middle", "end") + } + }, + "interpolation line options" +); + +// packages/ag-charts-community/src/api/preset/gaugeOptionsDefs.ts +var fillsOptionsDef = { + fills: and( + arrayLength(2), + arrayOf(optionsDefs({ color, stop: number }, "")), + colorStopsOrderValidator + ), + fillMode: union("continuous", "discrete") +}; +var linearGaugeTargetOptionsDef = { + value: required(number), + text: string, + shape: or( + union("circle", "cross", "diamond", "heart", "plus", "pin", "square", "star", "triangle", "line"), + callback + ), + placement: union("before", "after", "middle"), + spacing: positiveNumber, + size: positiveNumber, + rotation: number, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var radialGaugeTargetOptionsDef = { + value: required(number), + text: string, + shape: or( + union("circle", "cross", "diamond", "heart", "plus", "pin", "square", "star", "triangle", "line"), + callback + ), + placement: union("inside", "outside", "middle"), + spacing: positiveNumber, + size: positiveNumber, + rotation: number, + label: { + ...seriesLabelOptionsDefs, + spacing: positiveNumber + }, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var linearGaugeSeriesThemeableOptionsDef = { + direction: union("horizontal", "vertical"), + cornerMode: union("container", "item"), + cornerRadius: positiveNumber, + thickness: positiveNumber, + segmentation: { + enabled: boolean, + spacing: positiveNumber, + interval: { + values: arrayOf(number), + step: number, + count: number + } + }, + bar: { + enabled: boolean, + thickness: positiveNumber, + thicknessRatio: ratio, + ...fillsOptionsDef, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + label: { + ...autoSizedLabelOptionsDefs, + text: string, + spacing: positiveNumber, + avoidCollisions: boolean, + placement: union( + "inside-start", + "outside-start", + "inside-end", + "outside-end", + "inside-center", + "bar-inside", + "bar-inside-end", + "bar-outside-end", + "bar-end" + ) + }, + tooltip: tooltipOptionsDefs, + ...without(commonSeriesThemeableOptionsDefs, ["listeners"]) +}; +var linearGaugeSeriesOptionsDef = { + ...linearGaugeSeriesThemeableOptionsDef, + ...without(commonSeriesOptionsDefs, ["listeners"]), + type: required(constant("linear-gauge")), + value: required(number), + scale: { + min: and(number, lessThan("max")), + max: and(number, greaterThan("min")), + label: { + enabled: boolean, + formatter: callback, + rotation: number, + spacing: positiveNumber, + minSpacing: positiveNumber, + placement: union("before", "after"), + avoidCollisions: boolean, + format: numberFormatValidator, + ...fontOptionsDef + }, + interval: { + values: arrayOf(number), + step: number + }, + ...fillsOptionsDef, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + targets: arrayOfDefs(linearGaugeTargetOptionsDef, "target options array") +}; +linearGaugeSeriesOptionsDef.margin = undocumented(number); +linearGaugeSeriesOptionsDef.defaultColorRange = undocumented(arrayOf(color)); +linearGaugeSeriesOptionsDef.defaultTarget = undocumented({ + ...linearGaugeTargetOptionsDef, + value: number, + label: { + ...seriesLabelOptionsDefs, + spacing: number + } +}); +linearGaugeSeriesOptionsDef.defaultScale = undocumented(linearGaugeSeriesOptionsDef.scale); +linearGaugeSeriesOptionsDef.scale.defaultFill = undocumented(color); +var radialGaugeSeriesThemeableOptionsDef = { + outerRadius: positiveNumber, + innerRadius: positiveNumber, + outerRadiusRatio: ratio, + innerRadiusRatio: ratio, + startAngle: number, + endAngle: number, + spacing: positiveNumber, + cornerMode: union("container", "item"), + cornerRadius: positiveNumber, + scale: { + min: and(number, lessThan("max")), + max: and(number, greaterThan("min")), + label: { + enabled: boolean, + formatter: callback, + rotation: number, + spacing: positiveNumber, + minSpacing: positiveNumber, + avoidCollisions: boolean, + format: numberFormatValidator, + ...fontOptionsDef + }, + interval: { + values: arrayOf(number), + step: number + }, + ...fillsOptionsDef, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + segmentation: { + enabled: boolean, + spacing: positiveNumber, + interval: { + values: arrayOf(number), + step: number, + count: number + } + }, + bar: { + enabled: boolean, + ...fillsOptionsDef, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + needle: { + enabled: boolean, + spacing: positiveNumber, + radiusRatio: ratio, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + label: { + text: string, + spacing: positiveNumber, + ...autoSizedLabelOptionsDefs + }, + secondaryLabel: { + text: string, + ...autoSizedLabelOptionsDefs + }, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs +}; +var radialGaugeSeriesOptionsDef = { + ...radialGaugeSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs, + type: required(constant("radial-gauge")), + value: required(number), + targets: arrayOfDefs(radialGaugeTargetOptionsDef, "target options array") +}; +radialGaugeSeriesOptionsDef.defaultColorRange = undocumented(arrayOf(color)); +radialGaugeSeriesOptionsDef.defaultTarget = undocumented({ + ...radialGaugeTargetOptionsDef, + value: number, + label: { + ...seriesLabelOptionsDefs, + spacing: number + } +}); +radialGaugeSeriesOptionsDef.scale.defaultFill = undocumented(color); + +// packages/ag-charts-community/src/chart/axesOptionsDefs.ts +var timeIntervalUnit = union("millisecond", "second", "minute", "hour", "day", "month", "year"); +var timeIntervalDefs = { + unit: required(timeIntervalUnit), + step: positiveNumberNonZero, + epoch: date, + utc: boolean +}; +timeIntervalDefs.every = callback; +var timeInterval2 = optionsDefs(timeIntervalDefs, "a time interval object"); +var commonCrossLineLabelOptionsDefs = { + enabled: boolean, + text: string, + padding: number, + ...fontOptionsDef +}; +var commonCrossLineOptionsDefs = attachDescription( + { + enabled: boolean, + type: required(union("line", "range")), + range: and( + attachDescription((_, { options }) => options.type === "range", "crossLine type to be 'range'"), + arrayOf(defined), + arrayLength(2, 2) + ), + value: and( + attachDescription((_, { options }) => options.type === "line", "crossLine type to be 'line'"), + defined + ), + label: commonCrossLineLabelOptionsDefs, + fill: color, + fillOpacity: ratio, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + "cross-line options" +); +var cartesianCrossLineOptionsDefs = { + ...commonCrossLineOptionsDefs, + label: { + ...commonCrossLineLabelOptionsDefs, + position: union( + "top", + "left", + "right", + "bottom", + "top-left", + "top-right", + "bottom-left", + "bottom-right", + "inside", + "inside-left", + "inside-right", + "inside-top", + "inside-bottom", + "inside-top-left", + "inside-bottom-left", + "inside-top-right", + "inside-bottom-right" + ), + rotation: number + } +}; +var commonAxisLabelOptionsDefs = { + enabled: boolean, + rotation: number, + avoidCollisions: boolean, + minSpacing: positiveNumber, + spacing: positiveNumber, + formatter: callbackOf(textOrSegments), + itemStyler: callbackDefs({ + ...fontOptionsDef, + ...labelBoxOptionsDef, + spacing: number + }), + ...fontOptionsDef, + ...labelBoxOptionsDef +}; +var cartesianAxisLabelOptionsDefs = { + autoRotate: boolean, + autoRotateAngle: number, + wrapping: union("never", "always", "hyphenate", "on-space"), + truncate: boolean, + ...commonAxisLabelOptionsDefs +}; +var cartesianNumericAxisLabel = { + format: numberFormatValidator, + ...cartesianAxisLabelOptionsDefs +}; +var cartesianTimeAxisLabel = { + format: or(string, object), + ...cartesianAxisLabelOptionsDefs +}; +var cartesianAxisTick = { + enabled: boolean, + width: positiveNumber, + size: positiveNumber, + stroke: color +}; +var cartesianTimeAxisParentLevel = { + enabled: boolean, + label: cartesianTimeAxisLabel, + tick: cartesianAxisTick +}; +var commonAxisIntervalOptionsDefs = { + values: arrayOf(defined), + minSpacing: positiveNumber +}; +var commonAxisOptionsDefs = { + reverse: boolean, + gridLine: { + enabled: boolean, + width: positiveNumber, + style: arrayOfDefs( + { + fill: color, + fillOpacity: positiveNumber, + stroke: or(color, themeOperator), + strokeWidth: positiveNumber, + lineDash: arrayOf(positiveNumber) + }, + "a grid-line style object array" + ) + }, + interval: commonAxisIntervalOptionsDefs, + label: commonAxisLabelOptionsDefs, + line: { + enabled: boolean, + width: positiveNumber, + stroke: color + }, + tick: cartesianAxisTick, + context: () => true +}; +commonAxisOptionsDefs.layoutConstraints = undocumented({ + stacked: required(boolean), + align: required(union("start", "end")), + unit: required(union("percent", "px")), + width: required(positiveNumber) +}); +var cartesianAxisOptionsDefs = { + ...commonAxisOptionsDefs, + crossAt: { + value: required(or(number, date, string, arrayOf(string))), + sticky: boolean + }, + keys: arrayOf(string), + crossLines: arrayOfDefs(cartesianCrossLineOptionsDefs, "a cross-line options array"), + position: union("top", "right", "bottom", "left"), + thickness: positiveNumber, + maxThicknessRatio: ratio, + title: { + enabled: boolean, + text: textOrSegments, + spacing: positiveNumber, + formatter: callbackOf(textOrSegments), + ...fontOptionsDef + } +}; +cartesianAxisOptionsDefs.title._enabledFromTheme = undocumented(boolean); +var cartesianAxisBandHighlightOptions = { + enabled: boolean, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +function cartesianAxisCrosshairOptions(canFormat, timeFormat) { + const baseCrosshairLabel = { + enabled: boolean, + xOffset: number, + yOffset: number, + formatter: callbackOf(string), + renderer: callbackOf( + or( + string, + optionsDefs( + { + text: string, + color, + backgroundColor: color, + opacity: ratio + }, + "crosshair label renderer result object" + ) + ) + ) + }; + let crosshairLabel; + if (canFormat) { + crosshairLabel = { + ...baseCrosshairLabel, + format: timeFormat ? or( + string, + optionsDefs({ + millisecond: string, + second: string, + hour: string, + day: string, + month: string, + year: string + }) + ) : string + }; + } + return { + enabled: boolean, + snap: boolean, + label: crosshairLabel ?? baseCrosshairLabel, + ...strokeOptionsDef, + ...lineDashOptionsDef + }; +} +function continuousAxisOptions(validDatum, supportTimeInterval) { + return { + min: and(validDatum, lessThan("max")), + max: and(validDatum, greaterThan("min")), + nice: boolean, + interval: { + step: supportTimeInterval ? or(positiveNumberNonZero, timeIntervalUnit, timeInterval2) : positiveNumberNonZero, + values: arrayOf(validDatum), + minSpacing: and(positiveNumber, lessThan("maxSpacing")), + maxSpacing: and(positiveNumber, greaterThan("minSpacing")) + } + }; +} +var discreteTimeAxisIntervalOptionsDefs = { + step: or(positiveNumberNonZero, timeIntervalUnit, timeInterval2), + values: arrayOf(or(number, date)), + minSpacing: and(positiveNumber, lessThan("maxSpacing")), + maxSpacing: and(positiveNumber, greaterThan("minSpacing")), + placement: union("on", "between") +}; + +// packages/ag-charts-community/src/chart/axis/categoryAxis.ts +var _CategoryAxis = class _CategoryAxis extends CartesianAxis { + constructor(moduleCtx, scale2 = new CategoryScale(), includeInvisibleDomains = true) { + super(moduleCtx, scale2); + this.groupPaddingInner = 0.1; + this.includeInvisibleDomains = includeInvisibleDomains; + this.nice = false; + } + static is(value) { + return value instanceof _CategoryAxis; + } + isCategoryLike() { + return true; + } + hasDefinedDomain() { + return false; + } + normaliseDataDomain(domain) { + return { domain, clipped: false }; + } + updateScale() { + super.updateScale(); + let { paddingInner, paddingOuter } = this; + if (!isFiniteNumber(paddingInner) || !isFiniteNumber(paddingOuter)) { + const padding2 = this.reduceBandScalePadding(); + paddingInner ?? (paddingInner = padding2.inner); + paddingOuter ?? (paddingOuter = padding2.outer); + } + this.scale.paddingInner = paddingInner ?? 0; + this.scale.paddingOuter = paddingOuter ?? 0; + } + calculateGridLines(ticks, p1, p2) { + const gridLines = super.calculateGridLines(ticks, p1, p2); + if (this.interval.placement === "between" && ticks.length > 0) { + gridLines.push( + super.calculateGridLine( + { + index: ticks.at(-1).index + 1, + tickId: `after:${ticks.at(-1).tickId}`, + translation: this.range[1] + }, + ticks.length, + p1, + p2, + ticks + ) + ); + } + return gridLines; + } + calculateGridLine({ index: tickIndex, tickId, translation }, index, p1, p2, ticks) { + const { gridLine, horizontal, interval, scale: scale2 } = this; + if (interval.placement !== "between") { + return super.calculateGridLine({ index: tickIndex, tickId, translation }, index, p1, p2, ticks); + } + const halfStep = translation < scale2.step ? Math.floor(scale2.step / 2) : scale2.step / 2; + const offset = translation - halfStep; + const [x1, y1, x2, y2] = horizontal ? [offset, Math.max(p1, p2), offset, Math.min(p1, p2)] : [Math.min(p1, p2), offset, Math.max(p1, p2), offset]; + const { style: style2 } = gridLine; + const { stroke: stroke3, strokeWidth = 0, lineDash } = style2[tickIndex % style2.length] ?? {}; + return { tickId, offset, x1, y1, x2, y2, stroke: stroke3, strokeWidth, lineDash }; + } + calculateGridFills(ticks, p1, p2) { + const { horizontal, range: range4, scale: scale2 } = this; + if (this.interval.placement !== "between") { + return super.calculateGridFills(ticks, p1, p2); + } + const gridFills = []; + if (ticks.length == 0) + return gridFills; + const firstTick = ticks[0]; + const firstFillOffCanvas = firstTick.translation > range4[0] + scale2.step / 2; + const lastTick = ticks.at(-1); + const lastFillOffCanvas = horizontal && lastTick.translation < range4[1] - scale2.step / 2; + if (firstFillOffCanvas) { + const tick = { tickId: `before:${firstTick.tickId}`, translation: firstTick.translation - scale2.step }; + gridFills.push(this.calculateGridFill(tick, -1, firstTick.index - 1, p1, p2, ticks)); + } + gridFills.push(...ticks.map((tick, index) => this.calculateGridFill(tick, index, tick.index, p1, p2, ticks))); + if (lastFillOffCanvas) { + const tick = { tickId: `after:${lastTick.tickId}`, translation: lastTick.translation + scale2.step }; + gridFills.push(this.calculateGridFill(tick, ticks.length, lastTick.index + 1, p1, p2, ticks)); + } + return gridFills; + } + calculateGridFill({ tickId, translation }, index, gridFillIndex, p1, p2, ticks) { + const { gridLine, horizontal, interval, scale: scale2 } = this; + if (interval.placement !== "between") { + return super.calculateGridFill({ tickId, translation }, index, gridFillIndex, p1, p2, ticks); + } + const startOffset = translation - scale2.step / 2; + const endOffset = translation + scale2.step / 2; + const [x1, y1, x2, y2] = horizontal ? [startOffset, Math.max(p1, p2), endOffset, Math.min(p1, p2)] : [Math.min(p1, p2), startOffset, Math.max(p1, p2), endOffset]; + const { fill, fillOpacity } = gridLine.style[gridFillIndex % gridLine.style.length] ?? {}; + return { tickId, x1, y1, x2, y2, fill, fillOpacity }; + } + calculateTickLines(ticks, direction) { + const tickLines = super.calculateTickLines(ticks, direction); + if (this.interval.placement === "between" && ticks.length > 0) { + tickLines.push( + super.calculateTickLine( + { isPrimary: false, tickId: `after:${ticks.at(-1)?.tickId}`, translation: this.range[1] }, + ticks.length, + direction, + ticks + ) + ); + } + return tickLines; + } + calculateTickLine({ isPrimary, tickId, translation }, index, direction, ticks) { + const { horizontal, interval, primaryTick, scale: scale2, tick } = this; + if (interval.placement !== "between") { + return super.calculateTickLine({ isPrimary, tickId, translation }, index, direction, ticks); + } + const datumTick = isPrimary && primaryTick?.enabled ? primaryTick : tick; + const h = -direction * this.getTickSize(datumTick); + const halfStep = translation < scale2.step ? Math.floor(scale2.step / 2) : scale2.step / 2; + const offset = translation - halfStep; + const [x1, y1, x2, y2] = horizontal ? [offset, 0, offset, h] : [0, offset, h, offset]; + const { stroke: stroke3, width: strokeWidth } = datumTick; + const lineDash = void 0; + return { tickId, offset, x1, y1, x2, y2, stroke: stroke3, strokeWidth, lineDash }; + } + reduceBandScalePadding() { + return this.boundSeries.reduce( + (result, series) => { + const padding2 = series.getBandScalePadding?.(); + if (padding2) { + if (result.inner > padding2.inner) { + result.inner = padding2.inner; + } + if (result.outer < padding2.outer) { + result.outer = padding2.outer; + } + } + return result; + }, + { inner: Infinity, outer: -Infinity } + ); + } + tickFormatParams(_domain, _ticks, _fractionDigits, _timeInterval) { + return { type: "category" }; + } + datumFormatParams(value, params, _fractionDigits, _timeInterval, _style) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + if (Array.isArray(value) && value.some((v) => typeof v !== "string")) { + value = value.map(String); + } else if (!Array.isArray(value) && typeof value !== "string" && typeof value !== "number" && !(value instanceof Date)) { + value = String(value); + } + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +_CategoryAxis.className = "CategoryAxis"; +_CategoryAxis.type = "category"; +__decorateClass([ + addFakeTransformToInstanceProperty +], _CategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _CategoryAxis.prototype, "paddingInner", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], _CategoryAxis.prototype, "paddingOuter", 2); +var CategoryAxis = _CategoryAxis; + +// packages/ag-charts-community/src/scale/groupedCategoryScale.ts +var GroupedCategoryScale = class _GroupedCategoryScale extends CategoryScale { + static is(value) { + return value instanceof _GroupedCategoryScale; + } + normalizeDomains(...domains) { + const { domain } = super.normalizeDomains(...domains); + return { domain, animatable: false }; + } + findIndex(value) { + return super.findIndex(value) ?? this.getMatchIndex(value); + } + getMatchIndex(value) { + const key = JSON.stringify(value); + const match = this._domain.find((d) => JSON.stringify(d) === key); + if (match != null) { + return super.findIndex(match); + } + } +}; + +// packages/ag-charts-community/src/util/extent.ts +function extent(values) { + if (values.length === 0) { + return null; + } + let min = Infinity; + let max = -Infinity; + for (const n of values) { + const v = n instanceof Date ? n.getTime() : n; + if (typeof v !== "number") + continue; + if (v < min) { + min = v; + } + if (v > max) { + max = v; + } + } + const result = [min, max]; + return result.every(Number.isFinite) ? result : null; +} +function normalisedExtentWithMetadata(d, min, max) { + let clipped = false; + const de = extent(d); + if (de == null) { + return { extent: min != null && max != null && min <= max ? [min, max] : [], clipped: false }; + } + let [d0, d1] = de; + if (min != null) { + clipped || (clipped = min > d0); + d0 = min; + } + if (max != null) { + clipped || (clipped = max < d1); + d1 = max; + } + if (d0 > d1) { + return { extent: [], clipped: false }; + } + return { extent: [d0, d1], clipped }; +} + +// packages/ag-charts-community/src/chart/data/aggregateFunctions.ts +function sumValues(values, accumulator = [0, 0]) { + for (const value of values) { + if (typeof value !== "number") { + continue; + } + if (value < 0) { + accumulator[0] += value; + } + if (value > 0) { + accumulator[1] += value; + } + } + return accumulator; +} +function sum(id, matchGroupId) { + const result = { + id, + matchGroupIds: [matchGroupId], + type: "aggregate", + aggregateFunction: (values) => sumValues(values) + }; + return result; +} +function groupSum(id, opts) { + const visible = opts?.visible ?? true; + return { + id, + type: "aggregate", + matchGroupIds: opts?.matchGroupId ? [opts?.matchGroupId] : void 0, + aggregateFunction: (values) => sumValues(values), + groupAggregateFunction: (next, acc = [0, 0]) => { + if (visible) { + acc[0] += next?.[0] ?? 0; + acc[1] += next?.[1] ?? 0; + } + return acc; + } + }; +} +function range2(id, matchGroupId) { + const result = { + id, + matchGroupIds: [matchGroupId], + type: "aggregate", + aggregateFunction: (values) => ContinuousDomain.extendDomain(values) + }; + return result; +} +function groupCount(id, opts) { + const visible = opts?.visible ?? true; + return { + id, + type: "aggregate", + aggregateFunction: () => [0, 1], + groupAggregateFunction: (next, acc = [0, 0]) => { + if (visible) { + acc[0] += next?.[0] ?? 0; + acc[1] += next?.[1] ?? 0; + } + return acc; + } + }; +} +function groupAverage(id, opts) { + const visible = opts?.visible ?? true; + const def = { + id, + matchGroupIds: opts?.matchGroupId ? [opts?.matchGroupId] : void 0, + type: "aggregate", + aggregateFunction: (values) => sumValues(values), + groupAggregateFunction: (next, acc = [0, 0, -1]) => { + if (visible) { + acc[0] += next?.[0] ?? 0; + acc[2]++; + acc[1] += next?.[1] ?? 0; + } + return acc; + }, + finalFunction: (acc = [0, 0, 0]) => { + const result = acc[0] + acc[1]; + if (result >= 0) { + return [0, result / acc[2]]; + } + return [result / acc[2], 0]; + } + }; + return def; +} +function area(id, aggFn, matchGroupId) { + const result = { + id, + matchGroupIds: matchGroupId ? [matchGroupId] : void 0, + type: "aggregate", + aggregateFunction: (values, keyRange = []) => { + const keyWidth = keyRange[1] - keyRange[0]; + return aggFn.aggregateFunction(values).map((v) => v / keyWidth); + } + }; + if (aggFn.groupAggregateFunction) { + result.groupAggregateFunction = aggFn.groupAggregateFunction; + } + return result; +} +function accumulatedValue(onlyPositive) { + return () => { + let value = 0; + return (datum) => { + if (!isFiniteNumber(datum)) { + return datum; + } + value += onlyPositive ? Math.max(0, datum) : datum; + return value; + }; + }; +} +function trailingAccumulatedValue() { + return () => { + let value = 0; + return (datum) => { + if (!isFiniteNumber(datum)) { + return datum; + } + const trailingValue = value; + value += datum; + return trailingValue; + }; + }; +} + +// packages/ag-charts-community/src/chart/data/processors.ts +var MAX_ANIMATABLE_NODES = 1e3; +function processedDataIsAnimatable(processedData) { + return processedData.input.count <= MAX_ANIMATABLE_NODES; +} +function basicContinuousCheckDatumValidation(value) { + return value != null && isContinuous(value); +} +function basicDiscreteCheckDatumValidation(value) { + return value != null; +} +function getValidationFn(scaleType) { + switch (scaleType) { + case "number": + case "log": + case "time": + case "unit-time": + case "ordinal-time": + case "color": + return basicContinuousCheckDatumValidation; + default: + return basicDiscreteCheckDatumValidation; + } +} +function getValueType(scaleType) { + switch (scaleType) { + case "number": + case "log": + case "time": + case "color": + return "range"; + default: + return "category"; + } +} +function keyProperty(propName, scaleType, opts = {}) { + const result = { + property: propName, + type: "key", + valueType: getValueType(scaleType), + validation: getValidationFn(scaleType), + ...opts + }; + return result; +} +function valueProperty(propName, scaleType, opts = {}) { + const result = { + property: propName, + type: "value", + valueType: getValueType(scaleType), + validation: getValidationFn(scaleType), + ...opts + }; + return result; +} +function rowCountProperty(propName, opts = {}) { + const result = { + property: propName, + type: "value", + valueType: "range", + missingValue: 1, + processor: () => () => 1, + ...opts + }; + return result; +} +var noopProcessor = function(v) { + return v; +}; +function processorChain(...chain) { + const filteredChain = chain.filter((fn) => fn != null); + if (filteredChain.length === 0) { + return () => noopProcessor; + } + if (filteredChain.length === 1) { + return filteredChain[0]; + } + return () => { + const processorInstances = filteredChain.map((fn) => fn()); + return (value, index) => { + return processorInstances.reduce((r, p) => p(r, index), value); + }; + }; +} +function rangedValueProperty(propName, opts = {}) { + const { min = -Infinity, max = Infinity, processor, ...defOpts } = opts; + return { + type: "value", + property: propName, + valueType: "range", + validation: basicContinuousCheckDatumValidation, + processor: processorChain(processor, () => (datum) => isFiniteNumber(datum) ? clamp(min, datum, max) : datum), + ...defOpts + }; +} +function accumulativeValueProperty(propName, scaleType, opts = {}) { + const { onlyPositive, processor, ...defOpts } = opts; + const result = { + ...valueProperty(propName, scaleType, defOpts), + processor: processorChain(processor, accumulatedValue(onlyPositive)) + }; + return result; +} +function trailingAccumulatedValueProperty(propName, scaleType, opts = {}) { + const result = { + ...valueProperty(propName, scaleType, opts), + processor: trailingAccumulatedValue() + }; + return result; +} +function groupAccumulativeValueProperty(propName, mode, opts, scaleType) { + return [ + valueProperty(propName, scaleType, opts), + accumulateGroup(opts.groupId, mode, opts.separateNegative), + ...opts.rangeId == null ? [] : [range2(opts.rangeId, opts.groupId)] + ]; +} +var SMALLEST_KEY_INTERVAL = { + type: "reducer", + property: "smallestKeyInterval", + initialValue: Infinity, + reducer: () => { + let prevX = Number.NaN; + return (smallestSoFar, keys) => { + const nextX = typeof keys[0] === "number" ? keys[0] : Number(keys[0]); + const interval = Math.abs(nextX - prevX); + prevX = nextX; + const currentSmallest = smallestSoFar ?? Infinity; + if (!Number.isNaN(interval) && interval > 0 && interval < currentSmallest) { + return interval; + } + return currentSmallest; + }; + } +}; +var LARGEST_KEY_INTERVAL = { + type: "reducer", + property: "largestKeyInterval", + initialValue: -Infinity, + reducer: () => { + let prevX = Number.NaN; + return (largestSoFar, keys) => { + const nextX = typeof keys[0] === "number" ? keys[0] : Number(keys[0]); + const interval = Math.abs(nextX - prevX); + prevX = nextX; + const currentLargest = largestSoFar ?? -Infinity; + if (!Number.isNaN(interval) && interval > 0 && interval > currentLargest) { + return interval; + } + return currentLargest; + }; + } +}; +var SORT_DOMAIN_GROUPS = { + type: "processor", + property: "sortedGroupDomain", + calculate: ({ domain: { groups } }) => groups?.slice().sort((a, b) => { + for (let i = 0; i < a.length; i++) { + const result = a[i] - b[i]; + if (result !== 0) { + return result; + } + } + return 0; + }) +}; +function normaliseFnBuilder({ normaliseTo }) { + const normalise2 = (val, extent3) => { + if (extent3 === 0) + return 0; + const result = (val ?? 0) * normaliseTo / extent3; + if (result >= 0) { + return Math.min(normaliseTo, result); + } + return Math.max(-normaliseTo, result); + }; + return () => () => (columns, valueIndexes, dataGroup, groupIndex) => { + const extent3 = normaliseFindExtent(columns, valueIndexes, dataGroup, groupIndex); + for (const valueIdx of valueIndexes) { + const datumIndices = dataGroup.datumIndices[valueIdx]; + if (datumIndices == null) + continue; + for (const relativeDatumIndex of datumIndices) { + const datumIndex = groupIndex + relativeDatumIndex; + const column = columns[valueIdx]; + const value = column[datumIndex]; + if (value == null) { + column[datumIndex] = void 0; + continue; + } + column[datumIndex] = normalise2(value, extent3); + } + } + }; +} +function normaliseFindExtent(columns, valueIndexes, dataGroup, groupIndex) { + const valuesExtent = [0, 0]; + for (const valueIdx of valueIndexes) { + const column = columns[valueIdx]; + const datumIndices = dataGroup.datumIndices[valueIdx]; + if (datumIndices == null) + continue; + for (const relativeDatumIndex of datumIndices) { + const datumIndex = groupIndex + relativeDatumIndex; + const value = column[datumIndex]; + if (value == null) + continue; + const valueExtent = typeof value === "number" ? value : Math.max(...value.map((v) => v ?? 0)); + const valIdx = valueExtent < 0 ? 0 : 1; + if (valIdx === 0) { + valuesExtent[valIdx] = Math.min(valuesExtent[valIdx], valueExtent); + } else { + valuesExtent[valIdx] = Math.max(valuesExtent[valIdx], valueExtent); + } + } + } + return Math.max(Math.abs(valuesExtent[0]), valuesExtent[1]); +} +function normaliseGroupTo(matchGroupIds, normaliseTo) { + return { + type: "group-value-processor", + matchGroupIds, + adjust: memo({ normaliseTo }, normaliseFnBuilder) + }; +} +function normalisePropertyFnBuilder({ + normaliseTo, + zeroDomain, + rangeMin, + rangeMax +}) { + const normaliseSpan = normaliseTo[1] - normaliseTo[0]; + const normalise2 = (val, start2, span) => { + const result = normaliseTo[0] + (val - start2) / span * normaliseSpan; + if (span === 0) { + return zeroDomain; + } else if (result >= normaliseTo[1]) { + return normaliseTo[1]; + } else if (result < normaliseTo[0]) { + return normaliseTo[0]; + } + return result; + }; + return () => (pData, pIdx) => { + let [start2, end3] = pData.domain.values[pIdx]; + if (rangeMin != null) + start2 = rangeMin; + if (rangeMax != null) + end3 = rangeMax; + const span = end3 - start2; + pData.domain.values[pIdx] = [normaliseTo[0], normaliseTo[1]]; + const column = pData.columns[pIdx]; + for (let datumIndex = 0; datumIndex < column.length; datumIndex += 1) { + column[datumIndex] = normalise2(column[datumIndex], start2, span); + } + }; +} +function normalisePropertyTo(property, normaliseTo, zeroDomain, rangeMin, rangeMax) { + return { + type: "property-value-processor", + property, + adjust: memo({ normaliseTo, rangeMin, rangeMax, zeroDomain }, normalisePropertyFnBuilder) + }; +} +var ANIMATION_VALIDATION_UNIQUE_KEYS = 1; +var ANIMATION_VALIDATION_ORDERED_KEYS = 2; +function animationValidationProcessKey(count, def, keyValues, column) { + let validation = ANIMATION_VALIDATION_UNIQUE_KEYS | ANIMATION_VALIDATION_ORDERED_KEYS; + if (def.valueType === "category") { + if (keyValues.length < count) + validation &= ~ANIMATION_VALIDATION_UNIQUE_KEYS; + return validation; + } + let lastValue = column[0]?.valueOf(); + for (let d = 1; validation !== 0 && d < column.length; d++) { + const keyValue = column[d]?.valueOf(); + if (!Number.isFinite(keyValue) || lastValue > keyValue) + validation &= ~ANIMATION_VALIDATION_ORDERED_KEYS; + if (Number.isFinite(keyValue) && lastValue === keyValue) + validation &= ~ANIMATION_VALIDATION_UNIQUE_KEYS; + lastValue = keyValue; + } + return validation; +} +function animationValidation(valueKeyIds) { + return { + type: "processor", + property: "animationValidation", + calculate(result) { + if (!processedDataIsAnimatable(result)) + return; + const { keys: keysDefs, values: valuesDef } = result.defs; + const { + input, + domain: { keys: domainKeys, values: domainValues }, + keys, + columns, + invalidKeyCount + } = result; + let validation = ANIMATION_VALIDATION_UNIQUE_KEYS | ANIMATION_VALIDATION_ORDERED_KEYS; + if (input.count !== 0) { + for (let i = 0; validation !== 0 && i < keysDefs.length; i++) { + for (const scope of keysDefs[i].scopes) { + const column = keys[i].get(scope); + const missingKeys = invalidKeyCount?.get(scope) ?? 0; + const count = column.length - missingKeys; + validation &= animationValidationProcessKey(count, keysDefs[i], domainKeys[i], column); + } + } + for (let i = 0; validation !== 0 && i < valuesDef.length; i++) { + const value = valuesDef[i]; + if (!valueKeyIds?.includes(value.id)) + continue; + validation &= animationValidationProcessKey( + 0, + value, + domainValues[i], + columns[i] + ); + } + } + return { + uniqueKeys: (validation & ANIMATION_VALIDATION_UNIQUE_KEYS) !== 0, + orderedKeys: (validation & ANIMATION_VALIDATION_ORDERED_KEYS) !== 0 + }; + } + }; +} +function buildGroupAccFn({ mode, separateNegative }) { + return () => () => (columns, valueIndexes, dataGroup, groupIndex) => { + const acc = [0, 0]; + for (const valueIdx of valueIndexes) { + const datumIndices = dataGroup.datumIndices[valueIdx]; + if (datumIndices == null) + continue; + const stackNegative = acc[0]; + const stackPositive = acc[1]; + const column = columns[valueIdx]; + let didAccumulate = false; + for (const relativeDatumIndex of datumIndices) { + const datumIndex = groupIndex + relativeDatumIndex; + const currentVal = column[datumIndex]; + if (!isFiniteNumber(currentVal)) + continue; + const useNegative = separateNegative && isNegative(currentVal); + const accValue = useNegative ? stackNegative : stackPositive; + if (mode === "normal") { + column[datumIndex] = accValue + currentVal; + } else { + column[datumIndex] = accValue; + } + if (!didAccumulate) { + const accIndex = useNegative ? 0 : 1; + acc[accIndex] = accValue + currentVal; + didAccumulate = true; + } + } + } + }; +} +function accumulateGroup(matchGroupId, mode, separateNegative = false) { + const adjust = memo({ mode, separateNegative }, buildGroupAccFn); + return { + type: "group-value-processor", + matchGroupIds: [matchGroupId], + adjust, + supportsReprocessing: true + }; +} +function valueIdentifier(value) { + return value.id ?? value.property; +} +function valueIndices(id, previousData, processedData) { + const properties = /* @__PURE__ */ new Map(); + const previousValues = previousData.defs.values; + for (let previousIndex = 0; previousIndex < previousValues.length; previousIndex += 1) { + const previousValue = previousValues[previousIndex]; + if (previousValue.scopes?.includes(id) === false) + continue; + const valueId = valueIdentifier(previousValue); + if (properties.has(valueId)) + return; + properties.set(valueId, previousIndex); + } + const indices = []; + const nextValues = processedData.defs.values; + for (let nextIndex = 0; nextIndex < nextValues.length; nextIndex += 1) { + const nextValue = nextValues[nextIndex]; + if (nextValue.scopes?.includes(id) === false) + continue; + const valueId = valueIdentifier(nextValue); + const previousIndex = properties.get(valueId); + if (previousIndex == null) + return; + properties.delete(valueId); + indices.push({ previousIndex, nextIndex }); + } + if (properties.size !== 0) + return; + return indices; +} +function columnsEqual(previousColumns, nextColumns, indices, previousDatumIndex, nextDatumIndex) { + for (const { previousIndex, nextIndex } of indices) { + const previousColumn = previousColumns[previousIndex]; + const nextColumn = nextColumns[nextIndex]; + const previousValue = previousColumn[previousDatumIndex]; + const nextValue = nextColumn[nextDatumIndex]; + if (previousValue !== nextValue) { + return false; + } + } + return true; +} +function diff(id, previousData, updateMovedData = true) { + return { + type: "processor", + property: "diff", + calculate(processedData, previousValue) { + if (!processedDataIsAnimatable(processedData)) + return; + const moved = /* @__PURE__ */ new Map(); + const added = /* @__PURE__ */ new Map(); + const updated = /* @__PURE__ */ new Map(); + const removed = /* @__PURE__ */ new Map(); + const previousKeys = previousData.keys.map((keyMap) => keyMap.get(id)); + const keys = processedData.keys.map((keyMap) => keyMap.get(id)); + const previousColumns = previousData.columns; + const columns = processedData.columns; + const indices = valueIndices(id, previousData, processedData); + if (indices == null) + return previousValue; + const length2 = Math.max(previousData.input.count, processedData.input.count); + for (let i = 0; i < length2; i++) { + const hasPreviousDatum = i < previousData.input.count; + const hasDatum = i < processedData.input.count; + const prevKeys = hasPreviousDatum ? datumKeys(previousKeys, i) : void 0; + const prevId = prevKeys == null ? "" : createDatumId(...prevKeys); + const dKeys = hasDatum ? datumKeys(keys, i) : void 0; + const datumId = dKeys == null ? "" : createDatumId(...dKeys); + if (hasDatum && hasPreviousDatum && prevId === datumId) { + if (!columnsEqual(previousColumns, columns, indices, i, i)) { + updated.set(datumId, i); + } + continue; + } + const removedIndex = removed.get(datumId); + if (removedIndex != null) { + if (updateMovedData || !columnsEqual(previousColumns, columns, indices, removedIndex, i)) { + updated.set(datumId, i); + moved.set(datumId, i); + } + removed.delete(datumId); + } else if (hasDatum) { + added.set(datumId, i); + } + const addedIndex = added.get(prevId); + if (addedIndex != null) { + if (updateMovedData || !columnsEqual(previousColumns, columns, indices, addedIndex, i)) { + updated.set(prevId, i); + moved.set(prevId, i); + } + added.delete(prevId); + } else if (hasPreviousDatum) { + updated.delete(prevId); + removed.set(prevId, i); + } + } + const changed = added.size > 0 || updated.size > 0 || removed.size > 0; + const value = { + changed, + added: new Set(added.keys()), + updated: new Set(updated.keys()), + removed: new Set(removed.keys()), + moved: new Set(moved.keys()) + }; + return { + ...previousValue, + [id]: value + }; + } + }; +} +function createDatumId(...keys) { + if (keys.length === 1) { + const key = transformIntegratedCategoryValue(keys[0]); + const isPrimitive = typeof key === "boolean" || typeof key === "number" || typeof key === "string"; + if (isPrimitive) + return key; + } + return keys.map((key) => transformIntegratedCategoryValue(key)).join("___"); +} + +// packages/ag-charts-community/src/chart/axis/tree.ts +var Dimensions = class { + constructor() { + this.top = Infinity; + this.right = -Infinity; + this.bottom = -Infinity; + this.left = Infinity; + } + update(x, y) { + if (x > this.right) { + this.right = x; + } + if (x < this.left) { + this.left = x; + } + if (y > this.bottom) { + this.bottom = y; + } + if (y < this.top) { + this.top = y; + } + } +}; +var TreeNode = class _TreeNode { + constructor(label = "", parent, refId) { + this.label = label; + this.parent = parent; + this.refId = refId; + this.position = 0; + this.subtreeLeft = Number.NaN; + this.subtreeRight = Number.NaN; + this.children = []; + this.leafCount = 0; + this.prelim = 0; + this.mod = 0; + this.ancestor = this; + this.change = 0; + this.shift = 0; + this.index = 0; + // screen is meant to be recomputed from (layout) when the tree is resized (without performing another layout) + this.screen = 0; + this.depth = parent ? parent.depth + 1 : 0; + } + insertTick(tick, index) { + let current = this; + let endNode; + for (let i = 0; i < tick.length; i++) { + const pathPart = tick[i]; + const isNotLeaf = i !== tick.length - 1; + const { children } = current; + const existingNode = children.find((child) => child.label === pathPart); + if (existingNode && isNotLeaf) { + current = existingNode; + endNode = existingNode; + } else { + const node = new _TreeNode(pathPart, current, index); + node.index = children.length; + children.push(node); + if (isNotLeaf) { + current = node; + } + endNode = node; + } + } + return endNode; + } + getLeftSibling() { + return this.index > 0 ? this.parent?.children[this.index - 1] : void 0; + } + getLeftmostSibling() { + return this.index > 0 ? this.parent?.children[0] : void 0; + } + // traverse the left contour of a subtree, return the successor of v on this contour + nextLeft() { + return this.children[0]; + } + // traverse the right contour of a subtree, return the successor of v on this contour + nextRight() { + return this.children.at(-1); + } + getSiblings() { + return this.parent?.children.filter((_, i) => i !== this.index) ?? []; + } +}; +function ticksToTree(ticks) { + const maxDepth = ticks.reduce((depth, tick) => Math.max(depth, tick.length), 0); + const root = new TreeNode(); + const tickNodes = /* @__PURE__ */ new Map(); + for (let i = 0; i < ticks.length; i++) { + const tick = ticks[i]; + while (tick.length < maxDepth) { + tick.push(""); + } + const node = root.insertTick(tick, i); + if (node != null) { + tickNodes.set(tick, node); + } + } + return { root, tickNodes }; +} +function moveSubtree(wm, wp, shift) { + const subtrees = wp.index - wm.index; + const ratio2 = shift / subtrees; + wp.change -= ratio2; + wp.shift += shift; + wm.change += ratio2; + wp.prelim += shift; + wp.mod += shift; +} +function ancestor(vim, v, defaultAncestor) { + return v.getSiblings().includes(vim.ancestor) ? vim.ancestor : defaultAncestor; +} +function executeShifts({ children }) { + let shift = 0; + let change = 0; + for (let i = children.length - 1; i >= 0; i--) { + const w = children[i]; + w.prelim += shift; + w.mod += shift; + change += w.change; + shift += w.shift + change; + } +} +function apportion(v, defaultAncestor) { + const w = v.getLeftSibling(); + if (w) { + let vop = v; + let vip = v; + let vim = w; + let vom = vip.getLeftmostSibling(); + let sip = vip.mod; + let sop = vop.mod; + let sim = vim.mod; + let som = vom.mod; + while (vim.nextRight() && vip.nextLeft()) { + vim = vim.nextRight(); + vip = vip.nextLeft(); + vom = vom.nextLeft(); + vop = vop.nextRight(); + vop.ancestor = v; + const shift = vim.prelim + sim - (vip.prelim + sip) + 1; + if (shift > 0) { + moveSubtree(ancestor(vim, v, defaultAncestor), v, shift); + sip += shift; + sop += shift; + } + sim += vim.mod; + sip += vip.mod; + som += vom.mod; + sop += vop.mod; + } + if (vim.nextRight() && !vop.nextRight()) { + vop.mod += sim - sop; + } else { + if (vip.nextLeft() && !vom.nextLeft()) { + vom.mod += sip - som; + } + defaultAncestor = v; + } + } + return defaultAncestor; +} +function firstWalk(node) { + const { children } = node; + if (children.length) { + let [defaultAncestor] = children; + for (const child of children) { + firstWalk(child); + defaultAncestor = apportion(child, defaultAncestor); + } + executeShifts(node); + const midpoint = (children[0].prelim + children.at(-1).prelim) / 2; + const leftSibling = node.getLeftSibling(); + if (leftSibling) { + node.prelim = leftSibling.prelim + 1; + node.mod = node.prelim - midpoint; + } else { + node.prelim = midpoint; + } + } else { + const leftSibling = node.getLeftSibling(); + node.prelim = leftSibling ? leftSibling.prelim + 1 : 0; + } +} +function secondWalk(v, m, layout) { + v.position = v.prelim + m; + layout.insertNode(v); + for (const w of v.children) { + secondWalk(w, m + v.mod, layout); + } +} +function thirdWalk(v) { + const { children } = v; + let leafCount = 0; + for (const w of children) { + thirdWalk(w); + if (w.children.length) { + leafCount += w.leafCount; + } else { + leafCount++; + } + } + v.leafCount = leafCount; + if (children.length) { + v.subtreeLeft = children[0].subtreeLeft; + v.subtreeRight = children.at(-1).subtreeRight; + v.position = (v.subtreeLeft + v.subtreeRight) / 2; + } else { + v.subtreeLeft = v.position; + v.subtreeRight = v.position; + } +} +function treeLayout(ticks) { + const layout = new TreeLayout(); + const { root, tickNodes } = ticksToTree(ticks); + firstWalk(root); + secondWalk(root, -root.prelim, layout); + thirdWalk(root); + return { layout, tickNodes }; +} +var TreeLayout = class { + constructor() { + this.dimensions = new Dimensions(); + this.nodes = []; + this.depth = 0; + } + insertNode(node) { + if (this.depth < node.depth) { + this.depth = node.depth; + } + this.dimensions.update(node.position, node.depth); + this.nodes.push(node); + } + scaling(extent3, flip) { + let scaling = 1; + if (extent3 > 0) { + const { left, right } = this.dimensions; + if (right !== left) { + scaling = extent3 / (right - left); + } + } + if (flip) { + scaling *= -1; + } + return scaling; + } +}; + +// packages/ag-charts-community/src/chart/axis/groupedCategoryAxis.ts +var MIN_CATEGORY_SPACING = 5; +var DepthLabelProperties = class extends BaseProperties { + constructor() { + super(...arguments); + this.enabled = true; + this.border = new LabelBorder(); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "avoidCollisions", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "border", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "color", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "cornerRadius", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "spacing", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "rotation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "wrapping", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "truncate", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "fontStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "fontWeight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "fontSize", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "fontFamily", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthLabelProperties.prototype, "padding", 2); +var DepthTickProperties = class extends BaseProperties { + constructor() { + super(...arguments); + this.enabled = true; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthTickProperties.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthTickProperties.prototype, "width", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthTickProperties.prototype, "stroke", 2); +var DepthProperties = class extends BaseProperties { + constructor() { + super(...arguments); + this.label = new DepthLabelProperties(); + this.tick = new DepthTickProperties(); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthProperties.prototype, "label", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DepthProperties.prototype, "tick", 2); +var GroupedCategoryAxis = class extends CategoryAxis { + constructor(moduleCtx) { + super(moduleCtx, new GroupedCategoryScale()); + // Label scale (labels are positioned between ticks, tick count = label count + 1). + // We don't call is `labelScale` for consistency with other axes. + this.tickScale = new GroupedCategoryScale(); + this.computedLayout = void 0; + this.tickTreeLayout = void 0; + this.tickNodes = void 0; + this.depthOptions = new PropertiesArray(DepthProperties); + this.includeInvisibleDomains = true; + this.tickScale.paddingInner = 1; + this.tickScale.paddingOuter = 0; + } + resizeTickTree() { + if (!this.tickTreeLayout) + return; + const { nodes } = this.tickTreeLayout; + const { range: range4, step, inset, bandwidth } = this.scale; + const width2 = Math.abs(range4[1] - range4[0]) - step; + const scaling = this.tickTreeLayout.scaling(width2, range4[0] > range4[1]); + const shift = inset + bandwidth / 2; + let offset = 0; + for (const node of nodes) { + const screen = node.position * scaling; + if (offset > screen) { + offset = screen; + } + node.screen = screen + shift; + } + for (const node of nodes) { + node.screen -= offset; + } + } + getDepthOptionsMap(maxDepth) { + const optionsMap = []; + const { depthOptions, label } = this; + const defaultNonLeafRotation = this.horizontal ? 0 : -90; + for (let i = 0; i < maxDepth; i++) { + optionsMap.push( + depthOptions[i]?.label.enabled ?? label.enabled ? { + enabled: true, + spacing: depthOptions[i]?.label.spacing ?? label.spacing, + wrapping: depthOptions[i]?.label.wrapping ?? label.wrapping, + truncate: depthOptions[i]?.label.truncate ?? label.truncate, + rotation: depthOptions[i]?.label.rotation ?? (i ? defaultNonLeafRotation : label.rotation), + // Default top-level label roration only applies to label leaves + avoidCollisions: depthOptions[i]?.label.avoidCollisions ?? label.avoidCollisions + } : { enabled: false, spacing: 0, rotation: 0, avoidCollisions: false } + ); + } + return optionsMap; + } + updateCategoryLabels() { + if (!this.computedLayout) + return; + this.tickLabelGroupSelection.update(this.computedLayout.tickLabelLayout).each((node, datum) => { + node.fill = datum.color; + node.text = datum.text; + node.textBaseline = datum.textBaseline; + node.textAlign = datum.textAlign ?? "center"; + node.setFont(datum); + node.setBoxing(datum); + }); + } + updateAxisLine() { + if (!this.computedLayout) + return; + this.lineNode.visible = this.line.enabled; + this.lineNode.stroke = this.line.stroke; + this.lineNode.strokeWidth = this.line.width; + } + computeLayout() { + this.updateDirection(); + this.updateScale(); + const { step } = this.scale; + const { title, label, range: range4, depthOptions, horizontal, line } = this; + this.lineNode.datum = horizontal ? { x1: range4[0], x2: range4[1], y1: 0, y2: 0 } : { x1: 0, x2: 0, y1: range4[0], y2: range4[1] }; + this.lineNode.setProperties({ stroke: line.stroke, strokeWidth: line.enabled ? line.width : 0 }); + this.resizeTickTree(); + if (!this.tickTreeLayout?.depth) { + return { bbox: BBox.zero, spacing: 0, depthLabelMaxSize: {}, tickLabelLayout: [] }; + } + const { depth: maxDepth, nodes: treeLabels } = this.tickTreeLayout; + const sideFlag = horizontal ? -label.getSideFlag() : label.getSideFlag(); + const tickLabelLayout = []; + const labelBBoxes = /* @__PURE__ */ new Map(); + const tempText = new TransformableText(); + const optionsMap = this.getDepthOptionsMap(maxDepth); + const labelSpacing = sideFlag * optionsMap[0].spacing; + const tickFormatter = this.tickFormatter(this.scale.domain, this.scale.domain, false); + const setLabelProps = (datum, index) => { + const depth = maxDepth - datum.depth; + if (!optionsMap[depth]?.enabled || !inRange(datum.screen, range4)) + return false; + let maxWidth = (datum.leafCount || 1) * step; + if (maxWidth < MIN_CATEGORY_SPACING) + return false; + let text2 = tickFormatter(datum.label, index - 1); + const labelStyles = this.getLabelStyles( + { value: datum.index, formattedValue: text2, depth }, + depthOptions[depth]?.label + ); + if (label.avoidCollisions) { + const rotation = optionsMap[depth].rotation; + let maxHeight = this.thickness; + if (rotation != null) { + const innerRect = getMaxInnerRectSize(rotation, maxWidth, maxHeight); + maxWidth = innerRect.width; + maxHeight = innerRect.height; + } + const wrapOptions = { + font: labelStyles, + textWrap: optionsMap[depth].wrapping, + overflow: optionsMap[depth].truncate ? "ellipsis" : "hide", + maxWidth, + maxHeight + }; + text2 = wrapTextOrSegments(text2, wrapOptions) || text2; + } + tempText.x = horizontal ? datum.screen : labelSpacing; + tempText.y = horizontal ? labelSpacing : datum.screen; + tempText.rotation = 0; + tempText.fill = labelStyles.color; + tempText.text = text2; + tempText.textAlign = "center"; + tempText.textBaseline = label.parallel ? "top" : "bottom"; + tempText.setFont(labelStyles); + tempText.setBoxing(labelStyles); + return true; + }; + const depthLabelMaxSize = {}; + for (const [index, datum] of treeLabels.entries()) { + const depth = maxDepth - datum.depth; + depthLabelMaxSize[depth] ?? (depthLabelMaxSize[depth] = 0); + const isLeaf = !datum.children.length; + if (isLeaf && step < MIN_CATEGORY_SPACING) + continue; + const isVisible = setLabelProps(datum, index); + if (!isVisible || !tempText.getBBox()) + continue; + labelBBoxes.set(index, tempText.getBBox()); + tempText.rotation = normalizeAngle360FromDegrees(optionsMap[depth]?.rotation); + const { width: width2, height: height2 } = tempText.getBBox(); + const labelSize = horizontal ? height2 : width2; + if (depthLabelMaxSize[depth] < labelSize) { + depthLabelMaxSize[depth] = labelSize; + } + } + const idGenerator = createIdsGenerator(); + const nestedPadding = (d) => { + if (d === 0) + return 0; + let v = depthLabelMaxSize[0]; + for (let i = 1; i <= d; i++) { + v += optionsMap[i].spacing; + if (i !== d) { + v += depthLabelMaxSize[i]; + } + } + return v; + }; + for (const [index, datum] of treeLabels.entries()) { + if (index === 0) + continue; + const visible = setLabelProps(datum, index); + const isLeaf = !datum.children.length; + const depth = maxDepth - datum.depth; + if (isLeaf && step < MIN_CATEGORY_SPACING) + continue; + if (!visible) + continue; + const labelRotation = normalizeAngle360FromDegrees(optionsMap[depth].rotation); + const labelBBox = labelBBoxes.get(index); + if (!labelBBox) + continue; + const { width: w, height: h } = labelBBox; + const depthPadding = nestedPadding(depth); + tempText.textAlign = "center"; + tempText.textBaseline = "middle"; + tempText.rotation = labelRotation; + if (horizontal) { + tempText.y += (depthPadding + angularPadding(w / 2, h / 2, labelRotation)) * sideFlag; + tempText.rotationCenterX = datum.screen; + tempText.rotationCenterY = tempText.y; + } else { + tempText.x += depthPadding * sideFlag + angularPadding( + (optionsMap[depth].spacing * sideFlag + w) / 2, + label.mirrored ? w : 0, + labelRotation + ) - w / 2; + tempText.rotationCenterX = tempText.x; + tempText.rotationCenterY = datum.screen; + } + if (optionsMap[depth].avoidCollisions) { + const { width: width2, height: height2 } = tempText.getBBox(); + const labelSize = horizontal ? width2 : height2; + const availableRange = isLeaf ? step : datum.leafCount * step; + if (labelSize > availableRange) { + labelBBoxes.delete(index); + continue; + } + } + const text2 = tempText.getPlainText(); + const boxing = tempText.getBoxingProperties(); + tickLabelLayout.push({ + text: text2, + visible: true, + tickId: idGenerator(text2), + range: this.scale.range, + border: boxing.border, + color: tempText.fill, + cornerRadius: boxing.cornerRadius, + fill: boxing.fill, + fontFamily: tempText.fontFamily, + fontSize: tempText.fontSize, + fontStyle: tempText.fontStyle, + fontWeight: tempText.fontWeight, + padding: boxing.padding, + rotation: tempText.rotation, + rotationCenterX: tempText.rotationCenterX, + rotationCenterY: tempText.rotationCenterY, + textAlign: tempText.textAlign, + textBaseline: tempText.textBaseline, + x: tempText.x, + y: tempText.y + }); + labelBBoxes.set(index, Transformable.toCanvas(tempText)); + } + let maxTickSize = depthLabelMaxSize[0]; + for (let i = 0; i < maxDepth; i++) { + maxTickSize += optionsMap[i].spacing; + if (i !== 0) { + maxTickSize += depthLabelMaxSize[i]; + } + } + const bboxes = [ + this.lineNodeBBox(), + BBox.merge(labelBBoxes.values()), + new BBox(0, 0, maxTickSize * sideFlag, 0) + ]; + let spacing = 0; + if (title.enabled) { + const withoutTitle = BBox.merge(bboxes); + spacing = horizontal ? withoutTitle.height : withoutTitle.width; + bboxes.push(this.titleBBox(this.scale.domain, spacing)); + } + const mergedBBox = BBox.merge(bboxes); + this.layoutCrossLines(); + return { bbox: mergedBBox, spacing, depthLabelMaxSize, tickLabelLayout }; + } + /** + * Creates/removes/updates the scene graph nodes that constitute the axis. + * Supposed to be called _manually_ after changing _any_ of the axis properties. + * This allows to bulk set axis properties before updating the nodes. + * The node changes made by this method are rendered on the next animation frame. + * We could schedule this method call automatically on the next animation frame + * when any of the axis properties change (the way we do when properties of scene graph's + * nodes change), but this will mean that we first wait for the next animation + * frame to make changes to the nodes of the axis, then wait for another animation + * frame to render those changes. It's nice to have everything update automatically, + * but this extra level of async indirection will not just introduce an unwanted delay, + * it will also make it harder to reason about the program. + */ + update() { + if (!this.computedLayout) + return; + this.moduleCtx.animationManager.skipCurrentBatch(); + const { tickScale, tick, gridLine, gridLength, visibleRange, tickTreeLayout } = this; + if (!tickTreeLayout) + return; + const { depthLabelMaxSize, spacing } = this.computedLayout; + const { depth: maxDepth } = tickTreeLayout; + const optionsMap = this.getDepthOptionsMap(maxDepth); + const { position, horizontal, gridPadding } = this; + const direction = position === "bottom" || position === "right" ? -1 : 1; + const p1 = gridPadding; + const p2 = direction * gridLength - gridPadding; + let rawTicks; + if (tickScale.step > MIN_CATEGORY_SPACING) { + const tickParams = { + nice: false, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + rawTicks = tickScale.ticks(tickParams, void 0, visibleRange).ticks; + } else { + rawTicks = []; + } + const gridLineData = rawTicks.map( + (t, index) => ({ + index: tickScale.findIndex(t), + tickId: createDatumId(index, ...t), + translation: Math.round(tickScale.convert(t)) + }) + ); + this.gridLineGroupSelection.update( + gridLine.enabled && gridLength ? this.calculateGridLines(gridLineData, p1, p2) : [] + ); + this.gridFillGroupSelection.update( + gridLine.enabled && gridLength ? this.calculateGridFills(gridLineData, p1, p2) : [] + ); + this.tickLineGroupSelection.update( + tick.enabled ? rawTicks.map((t, index) => { + const { tickId, translation: offset } = gridLineData[index]; + const node = this.tickNodes?.get(t); + const depth = node == null ? maxDepth - 1 : Math.min(separatorDepth2(node), maxDepth - 1); + const tickOptions = this.depthOptions[depth]?.tick; + let tickSize = depthLabelMaxSize[0]; + for (let i = 0; i <= depth; i++) { + tickSize += optionsMap[i].spacing; + if (i !== 0) { + tickSize += depthLabelMaxSize[i]; + } + } + const stroke3 = tickOptions?.stroke ?? tick.stroke; + const strokeWidth = tickOptions?.enabled === false ? 0 : tickOptions?.width ?? tick.width; + const h = -direction * tickSize; + const [x1, x2, y1, y2] = horizontal ? [offset, offset, 0, h] : [0, h, offset, offset]; + const lineDash = void 0; + return { tickId, offset, x1, y1, x2, y2, stroke: stroke3, strokeWidth, lineDash }; + }) : [] + ); + this.updatePosition(); + this.updateCategoryLabels(); + this.updateAxisLine(); + this.updateGridLines(); + this.updateGridFills(); + this.updateTickLines(); + this.updateTitle(this.scale.domain, spacing); + this.updateCrossLines(); + this.resetSelectionNodes(); + } + calculateLayout() { + const { depthLabelMaxSize, tickLabelLayout, spacing, bbox } = this.computeLayout(); + this.computedLayout = { depthLabelMaxSize, tickLabelLayout, spacing }; + return { bbox, niceDomain: this.scale.domain }; + } + /** + * The length of the grid. The grid is only visible in case of a non-zero value. + */ + onGridVisibilityChange() { + super.onGridVisibilityChange(); + this.tickLabelGroupSelection.clear(); + } + updateScale() { + super.updateScale(); + this.tickScale.range = this.scale.range; + this.scale.paddingOuter = this.scale.paddingInner / 2; + } + processData() { + const { direction } = this; + const flatDomains = this.boundSeries.filter((s) => s.visible).flatMap((series) => series.getDomain(direction)); + this.dataDomain = { domain: extent(flatDomains) ?? this.filterDuplicateArrays(flatDomains), clipped: false }; + if (this.isReversed()) { + this.dataDomain.domain.reverse(); + } + const domain = this.dataDomain.domain.map(convertIntegratedCategoryValue); + const { layout, tickNodes } = treeLayout(domain); + this.tickTreeLayout = layout; + this.tickNodes = tickNodes; + const orderedDomain = []; + for (const node of this.tickTreeLayout.nodes) { + if (node.leafCount || node.refId == null) + continue; + orderedDomain.push(this.dataDomain.domain[node.refId]); + } + const sortedDomain = sortBasedOnArray(this.dataDomain.domain, orderedDomain); + this.scale.domain = sortedDomain; + const tickScaleDomain = sortedDomain.map(convertIntegratedCategoryValue); + tickScaleDomain.push([""]); + this.tickScale.domain = tickScaleDomain; + } + filterDuplicateArrays(array2) { + const seen = /* @__PURE__ */ new Set(); + return array2.filter((item) => { + const key = isArray(item) ? JSON.stringify(item) : item; + if (seen.has(key)) + return false; + seen.add(key); + return true; + }); + } +}; +GroupedCategoryAxis.className = "GroupedCategoryAxis"; +GroupedCategoryAxis.type = "grouped-category"; +__decorateClass([ + addFakeTransformToInstanceProperty +], GroupedCategoryAxis.prototype, "depthOptions", 2); +function separatorDepth2(node) { + let depth = 0; + let current = node; + while (current?.index === 0) { + depth += 1; + current = current.parent; + } + return depth; +} +function convertIntegratedCategoryValue(datum) { + return toArray(isObject(datum) && "value" in datum ? datum.value : datum); +} + +// packages/ag-charts-community/src/scale/logScale.ts +var logFunctions = { + 2: (_base, x) => Math.log2(x), + [Math.E]: (_base, x) => Math.log(x), + 10: (_base, x) => Math.log10(x) +}; +var DEFAULT_LOG = (base, x) => Math.log(x) / Math.log(base); +function log2(base, domain, x) { + const start2 = Math.min(...domain); + const fn = logFunctions[base] ?? DEFAULT_LOG; + return start2 >= 0 ? fn(base, x) : -fn(base, -x); +} +var powFunctions = { + [Math.E]: (_base, x) => Math.exp(x), + 10: (_base, x) => x >= 0 ? 10 ** x : 1 / 10 ** -x +}; +var DEFAULT_POW = (base, x) => base ** x; +function pow(base, domain, x) { + const start2 = Math.min(...domain); + const fn = powFunctions[base] ?? DEFAULT_POW; + return start2 >= 0 ? fn(base, x) : -fn(base, -x); +} +var LogScale = class _LogScale extends ContinuousScale { + constructor(d = [1, 10], r = [0, 1]) { + super(d, r); + this.type = "log"; + // Handling <1 and crossing 0 cases is tricky, easiest solution is to default to clamping. + this.defaultClamp = true; + this.base = 10; + this.log = (x) => log2(this.base, this.domain, x); + this.pow = (x) => pow(this.base, this.domain, x); + } + static is(value) { + return value instanceof _LogScale; + } + transform(x) { + const [min, max] = findMinMax(this.domain); + if (min >= 0 !== max >= 0) + return Number.NaN; + return min >= 0 ? Math.log(x) : -Math.log(-x); + } + transformInvert(x) { + const [min, max] = findMinMax(this.domain); + if (min >= 0 !== max >= 0) + return Number.NaN; + return min >= 0 ? Math.exp(x) : -Math.exp(-x); + } + toDomain(d) { + return d; + } + niceDomain(_ticks, domain = this.domain) { + if (domain.length < 2) + return []; + const { base } = this; + const [d0, d1] = domain; + const roundStart = d0 > d1 ? Math.ceil : Math.floor; + const roundStop = d0 > d1 ? Math.floor : Math.ceil; + const n0 = pow(base, domain, roundStart(log2(base, domain, d0))); + const n1 = pow(base, domain, roundStop(log2(base, domain, d1))); + return [n0, n1]; + } + ticks({ interval, tickCount = ContinuousScale.defaultTickCount }, domain = this.domain, visibleRange) { + if (!domain || domain.length < 2 || tickCount < 1) { + return; + } + const base = this.base; + const [d0, d1] = domain; + const start2 = Math.min(d0, d1); + const stop = Math.max(d0, d1); + let p0 = this.log(start2); + let p1 = this.log(stop); + if (interval) { + const inBounds = (tick) => tick >= start2 && tick <= stop; + const step = Math.min(Math.abs(interval), Math.abs(p1 - p0)); + const { ticks: rangeTicks, count, firstTickIndex } = range(p0, p1, step, visibleRange); + const ticks2 = rangeTicks.map(this.pow).filter(inBounds); + if (!isDenseInterval(ticks2.length, this.getPixelRange())) { + return { ticks: ticks2, count, firstTickIndex }; + } + } + if (!isInteger(base) || p1 - p0 >= tickCount) { + const step = Math.min(p1 - p0, tickCount); + const { ticks: ticks2, count, firstTickIndex } = createTicks(p0, p1, step, void 0, void 0, visibleRange); + return { + ticks: ticks2.map(this.pow), + count, + firstTickIndex + }; + } + const ticks = []; + const isPositive = start2 > 0; + p0 = Math.floor(p0) - 1; + p1 = Math.round(p1) + 1; + const availableSpacing = findRangeExtent(this.range) / tickCount; + let lastTickPosition = Infinity; + for (let p = p0; p <= p1; p++) { + const nextMagnitudeTickPosition = this.convert(this.pow(p + 1)); + for (let k = 1; k < base; k++) { + const q = isPositive ? k : base - k + 1; + const t = this.pow(p) * q; + const tickPosition = this.convert(t); + const prevSpacing = Math.abs(lastTickPosition - tickPosition); + const nextSpacing = Math.abs(tickPosition - nextMagnitudeTickPosition); + const fits = prevSpacing >= availableSpacing && nextSpacing >= availableSpacing; + if (t >= start2 && t <= stop && (k === 1 || fits || ticks.length === 0)) { + ticks.push(t); + lastTickPosition = tickPosition; + } + } + } + return filterVisibleTicks(ticks, isPositive, visibleRange); + } +}; + +// packages/ag-charts-community/src/scale/linearScale.ts +var LinearScale = class _LinearScale extends ContinuousScale { + constructor() { + super([0, 1], [0, 1]); + this.type = "number"; + } + static is(value) { + return value instanceof _LinearScale; + } + static getTickStep(start2, stop, ticks) { + const { interval, tickCount = ContinuousScale.defaultTickCount, minTickCount, maxTickCount } = ticks; + return interval ?? tickStep(start2, stop, tickCount, minTickCount, maxTickCount); + } + toDomain(d) { + return d; + } + ticks({ interval, tickCount = ContinuousScale.defaultTickCount, minTickCount, maxTickCount }, domain = this.domain, visibleRange) { + if (!domain || domain.length < 2 || tickCount < 1 || !domain.every(Number.isFinite)) { + return { ticks: [], count: 0, firstTickIndex: 0 }; + } + const [d0, d1] = domain; + if (interval) { + const step = Math.abs(interval); + if (!isDenseInterval((d1 - d0) / step, this.getPixelRange())) { + return range(d0, d1, step, visibleRange); + } + } + return createTicks(d0, d1, tickCount, minTickCount, maxTickCount, visibleRange); + } + niceDomain(ticks, domain = this.domain) { + if (domain.length < 2) + return []; + const { tickCount = ContinuousScale.defaultTickCount } = ticks; + let [start2, stop] = domain; + if (tickCount === 1) { + [start2, stop] = niceTicksDomain(start2, stop); + } else if (tickCount > 1) { + const roundStart = start2 > stop ? Math.ceil : Math.floor; + const roundStop = start2 > stop ? Math.floor : Math.ceil; + const maxAttempts = 4; + for (let i = 0; i < maxAttempts; i++) { + const prev0 = start2; + const prev1 = stop; + const step = _LinearScale.getTickStep(start2, stop, ticks); + const [d0, d1] = domain; + start2 = roundStart(d0 / step) * step; + stop = roundStop(d1 / step) * step; + if (start2 === prev0 && stop === prev1) + break; + } + } + return [start2, stop]; + } +}; + +// packages/ag-charts-community/src/chart/axis/numberAxis.ts +var NumberAxis = class extends CartesianAxis { + constructor(moduleCtx, scale2 = new LinearScale()) { + super(moduleCtx, scale2); + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata(d, min, max); + return { domain: extent3, clipped }; + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +NumberAxis.className = "NumberAxis"; +NumberAxis.type = "number"; +__decorateClass([ + addFakeTransformToInstanceProperty +], NumberAxis.prototype, "min", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], NumberAxis.prototype, "max", 2); + +// packages/ag-charts-community/src/chart/axis/logAxis.ts +var LogAxis = class extends NumberAxis { + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata(d, min, max); + if (extent3[0] < 0 && extent3[1] > 0 || d[0] < 0 && d[1] > 0) { + logger_exports.warn( + `The log axis domain crosses zero, the chart data cannot be rendered. See log axis documentation for more information.` + ); + return { domain: [], clipped }; + } else if (extent3[0] === 0 || extent3[1] === 0 || d[0] === 0 || d[1] === 0) { + logger_exports.warn( + `The log axis domain contains a value of 0, the chart data cannot be rendered. See log axis documentation for more information.` + ); + return { domain: [], clipped }; + } + return { domain: extent3, clipped }; + } + set base(value) { + this.scale.base = value; + } + get base() { + return this.scale.base; + } + constructor(moduleCtx) { + super(moduleCtx, new LogScale()); + } +}; +LogAxis.className = "LogAxis"; +LogAxis.type = "log"; + +// packages/ag-charts-community/src/chart/axis/timeAxis.ts +var TimeAxisParentLevel = class extends BaseProperties { + constructor() { + super(...arguments); + this.enabled = false; + this.label = new AxisLabel(); + this.tick = new AxisTick(); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], TimeAxisParentLevel.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], TimeAxisParentLevel.prototype, "label", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], TimeAxisParentLevel.prototype, "tick", 2); +var TimeAxis = class extends CartesianAxis { + constructor(moduleCtx) { + super(moduleCtx, new TimeScale()); + this.parentLevel = new TimeAxisParentLevel(); + this.min = void 0; + this.max = void 0; + } + // eslint-disable-next-line sonarjs/use-type-alias + get _unit() { + return void 0; + } + set _unit(_unit) { + logger_exports.warnOnce(`To use 'unit', use an axis with type 'unit-time' instead of 'time'.`); + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + isCategoryLike() { + return false; + } + get primaryLabel() { + return this.parentLevel.enabled ? this.parentLevel.label : void 0; + } + get primaryTick() { + return this.parentLevel.enabled ? this.parentLevel.tick : void 0; + } + normaliseDataDomain(d) { + return normaliseTimeDataDomain(d, this.min, this.max); + } + processData() { + super.processData(); + const { boundSeries, direction, min, max } = this; + this.minimumTimeGranularity = minimumTimeAxisDatumGranularity(boundSeries, direction, min, max); + } + tickFormatParams(domain, ticks, _fractionDigits, timeInterval3) { + timeInterval3 ?? (timeInterval3 = lowestGranularityUnitForTicks(ticks)); + const truncateDate = dateTruncationForDomain(domain); + const unit = intervalUnit(timeInterval3); + const step = intervalStep(timeInterval3); + const epoch = intervalEpoch(timeInterval3); + return { type: "date", unit, step, epoch, truncateDate }; + } + datumFormatParams(value, params, _fractionDigits, timeInterval3, style2) { + if (typeof value === "number") + value = new Date(value); + if (timeInterval3 == null) { + const { minimumTimeGranularity } = this; + const datumGranularity = lowestGranularityUnitForValue(value); + if (minimumTimeGranularity != null && intervalMilliseconds(minimumTimeGranularity) < intervalMilliseconds(datumGranularity)) { + timeInterval3 = minimumTimeGranularity; + } else { + timeInterval3 = datumGranularity; + } + } + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + const unit = intervalUnit(timeInterval3); + const step = intervalStep(timeInterval3); + const epoch = intervalEpoch(timeInterval3); + return { + type: "date", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + unit, + step, + epoch, + style: style2 + }; + } +}; +TimeAxis.className = "TimeAxis"; +TimeAxis.type = "time"; +__decorateClass([ + addFakeTransformToInstanceProperty +], TimeAxis.prototype, "parentLevel", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], TimeAxis.prototype, "min", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], TimeAxis.prototype, "max", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("_unit") +], TimeAxis.prototype, "unit", 2); +function minimumTimeAxisDatumGranularity(boundSeries, direction, min, max) { + const minTimeInterval = boundSeries.reduce((t, series) => { + return Math.min(series.minTimeInterval() ?? Infinity, t); + }, Infinity); + if (Number.isFinite(minTimeInterval)) { + return lowestGranularityForInterval(minTimeInterval); + } else { + return calculateDefaultUnit(boundSeries, direction, min, max)?.unit; + } +} +function calculateDefaultUnit(boundSeries, direction, min, max) { + let start2 = Infinity; + let end3 = -Infinity; + let interval; + let maxDataCount = 0; + const domainValues = []; + for (const series of boundSeries) { + if (!series.visible) + continue; + const { domain } = normaliseTimeDataDomain(series.getDomain(direction), void 0, void 0); + if (domain.length === 0) + continue; + const d0 = domain[0].valueOf(); + const d1 = domain.at(-1).valueOf(); + domainValues.push(d0, d1); + start2 = Math.min(start2 ?? Infinity, d0, d1); + end3 = Math.max(end3 ?? -Infinity, d0, d1); + const domainExtent = Math.abs(d1 - d0); + if (domainExtent === 0) + continue; + const dataCount = series.dataCount(); + maxDataCount = Math.max(maxDataCount, dataCount); + if (dataCount <= 1) + continue; + const i = domainExtent / (dataCount - 1); + interval = Math.min(interval ?? Infinity, i); + } + start2 = Math.min(start2, min?.valueOf() ?? Infinity, max?.valueOf() ?? Infinity); + end3 = Math.max(end3, min?.valueOf() ?? -Infinity, max?.valueOf() ?? -Infinity); + if (!Number.isFinite(start2) || !Number.isFinite(end3)) + return; + interval ?? (interval = Math.abs(end3 - start2)); + interval = Math.min(interval, minNonZeroDifference(domainValues)); + const unit = lowestGranularityForInterval(interval); + let step = interval / intervalMilliseconds(unit); + if (maxDataCount <= 2) { + step = Math.floor(step); + } else { + step = Math.round(step); + } + step = Math.max(step, 1); + const epoch = step === 1 ? void 0 : intervalFloor(unit, start2); + return { unit, step, epoch }; +} +function minNonZeroDifference(values) { + values.sort((a, b) => a - b); + let minDiff = Infinity; + for (let i = 1; i < values.length; i++) { + const d0 = values[i - 1]; + const d1 = values[i]; + const delta4 = d1 - d0; + if (delta4 > 0) { + minDiff = Math.min(minDiff, Math.abs(d1 - d0)); + } + } + return minDiff; +} +function normaliseTimeDataDomain(d, min, max) { + let clipped = false; + if (typeof min === "number") { + min = new Date(min); + } + if (typeof max === "number") { + max = new Date(max); + } + const de = extent(d)?.map((x) => new Date(x)); + if (de == null) { + return { + domain: min != null && max != null && min.valueOf() <= max.valueOf() ? [min, max] : [], + clipped: false + }; + } + let [d0, d1] = de; + if (min instanceof Date) { + clipped || (clipped = min > d0); + d0 = min; + } + if (max instanceof Date) { + clipped || (clipped = max < d1); + d1 = max; + } + if (d0 > d1) { + return { domain: [], clipped: false }; + } + return { domain: [d0, d1], clipped }; +} + +// packages/ag-charts-community/src/chart/axis/discreteTimeAxis.ts +var DiscreteTimeAxis = class extends CategoryAxis { + calculateGridLine({ index: tickIndex, tickId, translation }, index, p1, p2, ticks) { + const { gridLine, horizontal, interval, range: range4 } = this; + if (interval.placement !== "between") { + return super.calculateGridLine({ index: tickIndex, tickId, translation }, index, p1, p2, ticks); + } + const prevTick = ticks[index - 1]; + const offset = prevTick ? translation - (translation - prevTick.translation) / 2 : range4[0]; + const [x1, y1, x2, y2] = horizontal ? [offset, Math.max(p1, p2), offset, Math.min(p1, p2)] : [Math.min(p1, p2), offset, Math.max(p1, p2), offset]; + const { style: style2 } = gridLine; + const { stroke: stroke3, strokeWidth = 0, lineDash } = style2[tickIndex % style2.length] ?? {}; + return { tickId, offset, x1, y1, x2, y2, stroke: stroke3, strokeWidth, lineDash }; + } + calculateGridFills(ticks, p1, p2) { + if (this.interval.placement !== "between") { + return super.calculateGridFills(ticks, p1, p2); + } + return ticks.map((tick, index) => this.calculateGridFill(tick, index, tick.index, p1, p2, ticks)); + } + calculateGridFill({ tickId, translation }, index, gridFillIndex, p1, p2, ticks) { + const { gridLine, horizontal, interval, range: range4 } = this; + if (interval.placement !== "between") { + return super.calculateGridFill({ tickId, translation }, index, gridFillIndex, p1, p2, ticks); + } + const prevTick = ticks[index - 1]; + const nextTick = ticks[index + 1]; + const startOffset = prevTick ? translation - (translation - prevTick.translation) / 2 : range4[0]; + const endOffset = nextTick ? translation + (nextTick.translation - translation) / 2 : range4[1]; + const [x1, y1, x2, y2] = horizontal ? [startOffset, Math.max(p1, p2), endOffset, Math.min(p1, p2)] : [Math.min(p1, p2), startOffset, Math.max(p1, p2), endOffset]; + const { fill, fillOpacity } = gridLine.style[gridFillIndex % gridLine.style.length] ?? {}; + return { tickId, x1, y1, x2, y2, fill, fillOpacity }; + } + calculateTickLine({ isPrimary, tickId, translation }, index, direction, ticks) { + const { horizontal, interval, primaryTick, range: range4, tick } = this; + if (interval.placement !== "between") { + return super.calculateTickLine({ isPrimary, tickId, translation }, index, direction, ticks); + } + const datumTick = isPrimary && primaryTick?.enabled ? primaryTick : tick; + const h = -direction * this.getTickSize(datumTick); + const prevTick = ticks[index - 1]; + const offset = prevTick ? translation - (translation - prevTick.translation) / 2 : range4[0]; + const [x1, y1, x2, y2] = horizontal ? [offset, 0, offset, h] : [0, offset, h, offset]; + const { stroke: stroke3, width: strokeWidth } = datumTick; + const lineDash = void 0; + return { tickId, offset, x1, y1, x2, y2, stroke: stroke3, strokeWidth, lineDash }; + } +}; + +// packages/ag-charts-community/src/chart/axis/unitTimeAxis.ts +var UnitTimeAxis = class extends DiscreteTimeAxis { + constructor(moduleCtx) { + super(moduleCtx, new UnitTimeScale(), false); + this.parentLevel = new TimeAxisParentLevel(); + this.min = void 0; + this.max = void 0; + // eslint-disable-next-line sonarjs/use-type-alias + this.unit = void 0; + this.defaultUnit = void 0; + } + get primaryLabel() { + return this.parentLevel.enabled ? this.parentLevel.label : void 0; + } + get primaryTick() { + return this.parentLevel.enabled ? this.parentLevel.tick : void 0; + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + isCategoryLike() { + return true; + } + processData() { + super.processData(); + let defaultUnit; + const { domain } = this.dataDomain; + if (domain.length === 2 && domain[0].valueOf() === domain[1].valueOf()) { + defaultUnit = lowestGranularityUnitForValue(domain[0]); + } else { + const { boundSeries, direction, min, max } = this; + defaultUnit = calculateDefaultUnit(boundSeries, direction, min, max); + } + if (!objectsEqual(this.defaultUnit, defaultUnit)) { + this.defaultUnit = defaultUnit; + } + } + updateScale() { + super.updateScale(); + this.scale.interval = this.unit ?? this.defaultUnit; + } + normaliseDataDomain(domain) { + return normaliseTimeDataDomain(domain, this.min, this.max); + } + tickFormatParams(domain, ticks, _fractionDigits, timeInterval3) { + timeInterval3 ?? (timeInterval3 = lowestGranularityUnitForTicks(ticks)); + const truncateDate = dateTruncationForDomain(domain); + const unit = intervalUnit(timeInterval3); + const step = intervalStep(timeInterval3); + const epoch = intervalEpoch(timeInterval3); + return { type: "date", unit, step, epoch, truncateDate }; + } + datumFormatParams(value, params, _fractionDigits, timeInterval3, style2) { + const interval = this.unit ?? this.defaultUnit ?? "millisecond"; + timeInterval3 ?? (timeInterval3 = interval); + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + const unit = intervalUnit(timeInterval3); + const step = intervalStep(timeInterval3); + const epoch = intervalEpoch(timeInterval3); + return { + type: "date", + value: intervalFloor(interval, value), + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + unit, + step, + epoch, + style: style2 + }; + } +}; +UnitTimeAxis.className = "UnitTimeAxis"; +UnitTimeAxis.type = "unit-time"; +__decorateClass([ + addFakeTransformToInstanceProperty +], UnitTimeAxis.prototype, "parentLevel", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], UnitTimeAxis.prototype, "min", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], UnitTimeAxis.prototype, "max", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], UnitTimeAxis.prototype, "unit", 2); + +// packages/ag-charts-community/src/module/axisModules.ts +var numberAxisOptionsDefs = { + ...cartesianAxisOptionsDefs, + ...continuousAxisOptions(number), + type: required(constant("number")), + label: cartesianNumericAxisLabel, + crosshair: cartesianAxisCrosshairOptions(true) +}; +var logAxisOptionsDefs = { + ...cartesianAxisOptionsDefs, + ...continuousAxisOptions(number), + type: required(constant("log")), + base: and( + positiveNumberNonZero, + attachDescription((value) => value !== 1, "not equal to 1") + ), + label: cartesianNumericAxisLabel, + crosshair: cartesianAxisCrosshairOptions(true) +}; +var timeAxisOptionsDefs = { + ...cartesianAxisOptionsDefs, + ...continuousAxisOptions(or(number, date), true), + type: required(constant("time")), + label: cartesianTimeAxisLabel, + parentLevel: cartesianTimeAxisParentLevel, + crosshair: cartesianAxisCrosshairOptions(true, true) +}; +var categoryAxisOptionsDefs = { + ...cartesianAxisOptionsDefs, + type: required(constant("category")), + label: cartesianAxisLabelOptionsDefs, + paddingInner: ratio, + paddingOuter: ratio, + groupPaddingInner: ratio, + crosshair: cartesianAxisCrosshairOptions(), + bandHighlight: cartesianAxisBandHighlightOptions, + interval: { + ...commonAxisIntervalOptionsDefs, + placement: union("on", "between") + } +}; +var groupedCategoryAxisOptionsDefs = { + ...cartesianAxisOptionsDefs, + type: required(constant("grouped-category")), + label: cartesianAxisLabelOptionsDefs, + crosshair: cartesianAxisCrosshairOptions(), + bandHighlight: cartesianAxisBandHighlightOptions, + paddingInner: ratio, + groupPaddingInner: ratio, + depthOptions: arrayOfDefs( + { + label: { + enabled: boolean, + avoidCollisions: boolean, + wrapping: union("never", "always", "hyphenate", "on-space"), + truncate: boolean, + rotation: number, + spacing: number, + ...fontOptionsDef, + ...labelBoxOptionsDef + }, + tick: { + enabled: boolean, + stroke: color, + width: positiveNumber + } + }, + "depth options objects array" + ) +}; +var unitTimeAxisOptionsDefs = { + ...cartesianAxisOptionsDefs, + type: required(constant("unit-time")), + unit: or(timeInterval2, timeIntervalUnit), + label: cartesianTimeAxisLabel, + parentLevel: cartesianTimeAxisParentLevel, + paddingInner: ratio, + paddingOuter: ratio, + groupPaddingInner: ratio, + crosshair: cartesianAxisCrosshairOptions(true, true), + bandHighlight: cartesianAxisBandHighlightOptions, + min: and(or(number, date), lessThan("max")), + max: and(or(number, date), greaterThan("min")), + interval: discreteTimeAxisIntervalOptionsDefs +}; +var NumberAxisModule = { + type: "axis", + name: "number", + chartType: "cartesian", + options: numberAxisOptionsDefs, + create: (ctx) => new NumberAxis(ctx) +}; +var LogAxisModule = { + type: "axis", + name: "log", + chartType: "cartesian", + options: logAxisOptionsDefs, + create: (ctx) => new LogAxis(ctx) +}; +var TimeAxisModule = { + type: "axis", + name: "time", + chartType: "cartesian", + options: timeAxisOptionsDefs, + create: (ctx) => new TimeAxis(ctx) +}; +var CategoryAxisModule = { + type: "axis", + name: "category", + chartType: "cartesian", + options: categoryAxisOptionsDefs, + create: (ctx) => new CategoryAxis(ctx) +}; +var GroupedCategoryAxisModule = { + type: "axis", + name: "grouped-category", + chartType: "cartesian", + options: groupedCategoryAxisOptionsDefs, + create: (ctx) => new GroupedCategoryAxis(ctx) +}; +var UnitTimeAxisModule = { + type: "axis", + name: "unit-time", + chartType: "cartesian", + options: unitTimeAxisOptionsDefs, + create: (ctx) => new UnitTimeAxis(ctx) +}; + +// packages/ag-charts-community/src/chart/axesOptionsEnterpriseDefs.ts +var ordinalTimeAxisOptionsDefs = { + ...cartesianAxisOptionsDefs, + type: required(constant("ordinal-time")), + paddingInner: ratio, + paddingOuter: ratio, + groupPaddingInner: ratio, + label: cartesianTimeAxisLabel, + parentLevel: cartesianTimeAxisParentLevel, + interval: discreteTimeAxisIntervalOptionsDefs, + crosshair: cartesianAxisCrosshairOptions(true, true), + bandHighlight: cartesianAxisBandHighlightOptions +}; +var angleNumberAxisOptionsDefs = { + ...commonAxisOptionsDefs, + ...continuousAxisOptions(number), + type: required(constant("angle-number")), + crossLines: arrayOfDefs(commonCrossLineOptionsDefs), + startAngle: number, + endAngle: number, + label: { + ...commonAxisLabelOptionsDefs, + orientation: union("fixed", "parallel", "perpendicular"), + format: numberFormatValidator + } +}; +var angleCategoryAxisOptionsDefs = { + ...commonAxisOptionsDefs, + type: required(constant("angle-category")), + shape: union("polygon", "circle"), + crossLines: arrayOfDefs(commonCrossLineOptionsDefs), + startAngle: number, + endAngle: number, + paddingInner: ratio, + groupPaddingInner: ratio, + label: { + ...commonAxisLabelOptionsDefs, + orientation: union("fixed", "parallel", "perpendicular") + } +}; +angleCategoryAxisOptionsDefs.innerRadiusRatio = ratio; +var radiusNumberAxisOptionsDefs = { + ...commonAxisOptionsDefs, + ...continuousAxisOptions(number), + type: required(constant("radius-number")), + shape: union("polygon", "circle"), + positionAngle: number, + innerRadiusRatio: ratio, + crossLines: arrayOfDefs( + { + ...commonCrossLineOptionsDefs, + label: { + ...commonCrossLineLabelOptionsDefs, + positionAngle: number + } + }, + "cross-line options" + ), + title: { + enabled: boolean, + text: textOrSegments, + spacing: positiveNumber, + formatter: callbackOf(textOrSegments), + ...fontOptionsDef + }, + label: { + ...commonAxisLabelOptionsDefs, + format: numberFormatValidator + } +}; +var radiusCategoryAxisOptionsDefs = { + ...commonAxisOptionsDefs, + type: required(constant("radius-category")), + positionAngle: number, + innerRadiusRatio: ratio, + paddingInner: ratio, + paddingOuter: ratio, + groupPaddingInner: ratio, + label: commonAxisLabelOptionsDefs, + crossLines: arrayOfDefs( + { + ...commonCrossLineOptionsDefs, + label: { + ...commonCrossLineLabelOptionsDefs, + positionAngle: number + } + }, + "cross-line options" + ), + title: { + enabled: boolean, + text: textOrSegments, + spacing: positiveNumber, + formatter: callbackOf(textOrSegments), + ...fontOptionsDef + } +}; + +// packages/ag-charts-community/src/chart/series/cartesian/areaSeriesOptionsDef.ts +var highlight = multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef); +var areaStyler = callbackDefs({ + ...strokeOptionsDef, + ...fillOptionsDef, + ...lineDashOptionsDef, + marker: markerStyleOptionsDefs +}); +var areaSeriesThemeableOptionsDef = { + showInMiniChart: boolean, + connectMissingData: boolean, + interpolation: interpolationOptionsDefs, + label: seriesLabelOptionsDefs, + styler: areaStyler, + marker: markerOptionsDefs, + tooltip: tooltipOptionsDefs, + shadow: shadowOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + highlight, + segmentation: shapeSegmentation +}; +var areaSeriesOptionsDef = { + ...areaSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs, + highlight, + type: required(constant("area")), + xKey: required(string), + yKey: required(string), + xName: string, + yName: string, + legendItemName: string, + stacked: boolean, + stackGroup: string, + normalizedTo: number +}; + +// packages/ag-charts-community/src/chart/series/cartesian/barSeriesOptionsDef.ts +var highlight2 = multiSeriesHighlightOptionsDef(barHighlightOptionsDef, barHighlightOptionsDef); +var barStyler = callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + cornerRadius: positiveNumber +}); +var barSeriesThemeableOptionsDef = { + direction: union("horizontal", "vertical"), + showInMiniChart: boolean, + cornerRadius: positiveNumber, + styler: barStyler, + itemStyler: barStyler, + crisp: boolean, + label: { + ...seriesLabelOptionsDefs, + placement: union("inside-center", "inside-start", "inside-end", "outside-start", "outside-end"), + spacing: positiveNumber + }, + errorBar: errorBarThemeableOptionsDefs, + shadow: shadowOptionsDefs, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + highlight: highlight2, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + segmentation: shapeSegmentation +}; +barSeriesThemeableOptionsDef.sparklineMode = undocumented(boolean); +var barSeriesOptionsDef = { + ...barSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs, + highlight: highlight2, + type: required(constant("bar")), + xKey: required(string), + yKey: required(string), + xName: string, + yName: string, + direction: union("horizontal", "vertical"), + grouped: boolean, + stacked: boolean, + stackGroup: string, + normalizedTo: number, + legendItemName: string, + errorBar: errorBarOptionsDefs +}; +barSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented(boolean); +barSeriesOptionsDef.focusPriority = undocumented(number); + +// packages/ag-charts-community/src/chart/series/cartesian/bubbleSeriesOptionsDef.ts +var bubbleSeriesThemeableOptionsDef = { + title: string, + domain: arrayOf(number), + maxSize: positiveNumber, + showInMiniChart: boolean, + label: { + placement: union("top", "right", "bottom", "left"), + ...seriesLabelOptionsDefs + }, + tooltip: tooltipOptionsDefs, + styler: callbackDefs({ + ...markerOptionsDefs, + maxSize: positiveNumber + }), + maxRenderedItems: number, + ...commonSeriesThemeableOptionsDefs, + ...without(markerOptionsDefs, ["enabled"]), + highlight: multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef) +}; +var bubbleSeriesOptionsDef = { + ...bubbleSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs, + type: required(constant("bubble")), + xKey: required(string), + yKey: required(string), + sizeKey: required(string), + labelKey: string, + xName: string, + yName: string, + sizeName: string, + labelName: string, + legendItemName: string, + highlight: multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef) +}; + +// packages/ag-charts-community/src/chart/series/cartesian/histogramSeriesOptionsDef.ts +var histogramSeriesThemeableOptionsDef = { + showInMiniChart: boolean, + cornerRadius: positiveNumber, + label: seriesLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + shadow: shadowOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + highlight: multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef), + areaPlot: boolean, + aggregation: union("count", "sum", "mean"), + bins: arrayOf(arrayOf(number)), + binCount: positiveNumber +}; +var histogramSeriesOptionsDef = { + ...commonSeriesOptionsDefs, + ...histogramSeriesThemeableOptionsDef, + type: required(constant("histogram")), + xKey: required(string), + yKey: string, + xName: string, + yName: string +}; + +// packages/ag-charts-community/src/chart/series/cartesian/lineSeriesOptionsDef.ts +var highlight3 = multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, lineHighlightOptionsDef); +var lineStyler = callbackDefs({ + ...strokeOptionsDef, + ...lineDashOptionsDef, + marker: markerStyleOptionsDefs +}); +var lineSeriesThemeableOptionsDef = { + title: string, + showInMiniChart: boolean, + connectMissingData: boolean, + interpolation: interpolationOptionsDefs, + label: seriesLabelOptionsDefs, + styler: lineStyler, + marker: markerOptionsDefs, + tooltip: tooltipOptionsDefs, + errorBar: errorBarThemeableOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...strokeOptionsDef, + ...lineDashOptionsDef, + highlight: highlight3, + segmentation: lineSegmentation +}; +lineSeriesThemeableOptionsDef.sparklineMode = undocumented(boolean); +var lineSeriesOptionsDef = { + ...lineSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs, + highlight: highlight3, + type: required(constant("line")), + xKey: required(string), + yKey: required(string), + xName: string, + yName: string, + stacked: boolean, + stackGroup: string, + normalizedTo: number, + legendItemName: string, + errorBar: errorBarOptionsDefs +}; +lineSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented(boolean); +lineSeriesOptionsDef.focusPriority = undocumented(number); + +// packages/ag-charts-community/src/chart/series/cartesian/scatterSeriesOptionsDef.ts +var scatterSeriesThemeableOptionsDef = { + title: string, + showInMiniChart: boolean, + label: { + placement: union("top", "right", "bottom", "left"), + ...seriesLabelOptionsDefs + }, + tooltip: tooltipOptionsDefs, + errorBar: errorBarThemeableOptionsDefs, + styler: callbackDefs(markerOptionsDefs), + maxRenderedItems: number, + ...commonSeriesThemeableOptionsDefs, + ...without(markerOptionsDefs, ["enabled"]), + highlight: multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef) +}; +var scatterSeriesOptionsDef = { + ...scatterSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs, + type: required(constant("scatter")), + xKey: required(string), + yKey: required(string), + labelKey: string, + xName: string, + yName: string, + labelName: string, + legendItemName: string, + errorBar: errorBarOptionsDefs, + highlight: multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef) +}; + +// packages/ag-charts-community/src/chart/series/polar/pieSeriesOptionsDef.ts +var highlight4 = multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef); +var pieSeriesThemeableOptionsDef = { + ...commonSeriesThemeableOptionsDefs, + radiusMin: positiveNumber, + radiusMax: positiveNumber, + rotation: number, + outerRadiusOffset: number, + outerRadiusRatio: ratio, + hideZeroValueSectorsInLegend: boolean, + sectorSpacing: positiveNumber, + cornerRadius: positiveNumber, + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + cornerRadius: positiveNumber + }), + title: { + enabled: boolean, + text: string, + showInLegend: boolean, + spacing: positiveNumber, + ...fontOptionsDef + }, + calloutLabel: { + enabled: boolean, + offset: number, + minAngle: positiveNumber, + avoidCollisions: boolean, + formatter: callbackOf(textOrSegments), + format: string, + itemStyler: callbackDefs({ + enabled: boolean, + ...labelBoxOptionsDef, + ...fontOptionsDef + }), + ...labelBoxOptionsDef, + ...fontOptionsDef + }, + sectorLabel: { + enabled: boolean, + positionOffset: number, + positionRatio: ratio, + formatter: callbackOf(textOrSegments), + format: string, + itemStyler: callbackDefs({ + enabled: boolean, + ...labelBoxOptionsDef, + ...fontOptionsDef + }), + ...labelBoxOptionsDef, + ...fontOptionsDef + }, + calloutLine: { + colors: arrayOf(color), + length: positiveNumber, + strokeWidth: positiveNumber, + itemStyler: callbackDefs({ + color, + length: positiveNumber, + strokeWidth: positiveNumber + }) + }, + fills: arrayOf(colorUnion), + strokes: arrayOf(color), + tooltip: tooltipOptionsDefs, + shadow: shadowOptionsDefs, + highlight: highlight4, + ...lineDashOptionsDef, + ...without(fillOptionsDef, ["fill"]), + ...without(strokeOptionsDef, ["stroke"]) +}; +var pieSeriesOptionsDef = { + ...pieSeriesThemeableOptionsDef, + ...commonSeriesOptionsDefs, + type: required(constant("pie")), + angleKey: required(string), + radiusKey: string, + calloutLabelKey: string, + sectorLabelKey: string, + legendItemKey: string, + angleName: string, + radiusName: string, + calloutLabelName: string, + sectorLabelName: string, + highlight: highlight4 +}; +pieSeriesOptionsDef.defaultColorRange = undocumented(arrayOf(arrayOf(color))); +pieSeriesOptionsDef.defaultPatternFills = undocumented(arrayOf(color)); +pieSeriesOptionsDef.title._enabledFromTheme = undocumented(boolean); +pieSeriesOptionsDef.calloutLabel._enabledFromTheme = undocumented(boolean); +pieSeriesOptionsDef.sectorLabel._enabledFromTheme = undocumented(boolean); + +// packages/ag-charts-community/src/chart/series/polar/donutSeriesOptionsDef.ts +var donutSeriesThemeableOptionsDef = { + ...pieSeriesThemeableOptionsDef, + innerRadiusOffset: number, + innerRadiusRatio: ratio, + innerCircle: { + fill: string, + fillOpacity: ratio + }, + innerLabels: { + spacing: positiveNumber, + ...fontOptionsDef, + ...labelBoxOptionsDef + } +}; +var donutSeriesOptionsDef = { + ...donutSeriesThemeableOptionsDef, + ...pieSeriesOptionsDef, + type: required(constant("donut")), + innerLabels: arrayOfDefs( + { + text: required(string), + spacing: positiveNumber, + ...fontOptionsDef, + ...labelBoxOptionsDef + }, + "inner label options array" + ) +}; + +// packages/ag-charts-community/src/chart/themes/annotationOptionsDef.ts +var annotationLineOptionsDef = { + lineStyle: union("solid", "dashed", "dotted"), + ...lineDashOptionsDef +}; +var annotationHandleStylesDefs = { + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var annotationTextStylesDef = { + visible: boolean, + locked: boolean, + readOnly: boolean, + handle: annotationHandleStylesDefs, + ...fontOptionsDef +}; +var annotationLineTextDefs = { + position: union("top", "center", "bottom"), + alignment: union("left", "center", "right"), + ...fontOptionsDef +}; +var annotationChannelTextDefs = { + position: union("top", "inside", "bottom"), + alignment: union("left", "center", "right"), + ...fontOptionsDef +}; +var annotationAxisLabelOptionsDef = { + enabled: boolean, + cornerRadius: positiveNumber, + formatter: callback, + ...fontOptionsDef, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var annotationChannelMiddleDefs = { + visible: boolean, + ...annotationLineOptionsDef, + ...strokeOptionsDef +}; +var annotationMeasurerStatisticsOptionsDefs = { + divider: strokeOptionsDef, + ...fillOptionsDef, + ...strokeOptionsDef, + ...fontOptionsDef +}; +var annotationQuickMeasurerDirectionStylesDefs = { + handle: annotationHandleStylesDefs, + statistics: annotationMeasurerStatisticsOptionsDefs, + ...annotationLineOptionsDef, + ...fillOptionsDef, + ...strokeOptionsDef +}; +var annotationLineStyleDefs = { + visible: boolean, + locked: boolean, + readOnly: boolean, + extendStart: boolean, + extendEnd: boolean, + handle: annotationHandleStylesDefs, + text: annotationLineTextDefs, + ...annotationLineOptionsDef, + ...strokeOptionsDef +}; +var annotationCrossLineStyleDefs = { + visible: boolean, + locked: boolean, + readOnly: boolean, + axisLabel: annotationAxisLabelOptionsDef, + handle: annotationHandleStylesDefs, + text: annotationLineTextDefs, + ...annotationLineOptionsDef, + ...strokeOptionsDef +}; +var annotationChannelStyleDefs = { + visible: boolean, + locked: boolean, + readOnly: boolean, + extendStart: boolean, + extendEnd: boolean, + handle: annotationHandleStylesDefs, + text: annotationChannelTextDefs, + background: fillOptionsDef, + ...annotationLineOptionsDef, + ...strokeOptionsDef +}; +var annotationDisjointChannelStyleDefs = { + ...annotationChannelStyleDefs +}; +var annotationParallelChannelStyleDefs = { + ...annotationChannelStyleDefs, + middle: annotationChannelMiddleDefs +}; +var annotationFibonacciStylesDefs = { + label: fontOptionsDef, + showFill: boolean, + isMultiColor: boolean, + strokes: arrayOf(color), + rangeStroke: color, + bands: union(4, 6, 10), + ...annotationLineStyleDefs +}; +var annotationCalloutStylesDefs = { + ...fillOptionsDef, + ...strokeOptionsDef, + ...annotationTextStylesDef +}; +var annotationCommentStylesDefs = { + ...fillOptionsDef, + ...strokeOptionsDef, + ...annotationTextStylesDef +}; +var annotationNoteStylesDefs = { + ...fillOptionsDef, + ...strokeOptionsDef, + ...annotationTextStylesDef, + background: { + ...fillOptionsDef, + ...strokeOptionsDef + } +}; +var annotationShapeStylesDefs = { + visible: boolean, + locked: boolean, + readOnly: boolean, + handle: annotationHandleStylesDefs, + ...fillOptionsDef +}; +var annotationMeasurerStylesDefs = { + visible: boolean, + locked: boolean, + readOnly: boolean, + extendStart: boolean, + extendEnd: boolean, + handle: annotationHandleStylesDefs, + text: annotationLineTextDefs, + background: fillOptionsDef, + statistics: annotationMeasurerStatisticsOptionsDefs, + ...annotationLineOptionsDef, + ...strokeOptionsDef +}; +var annotationQuickMeasurerStylesDefs = { + visible: boolean, + up: annotationQuickMeasurerDirectionStylesDefs, + down: annotationQuickMeasurerDirectionStylesDefs +}; +var annotationOptionsDef = { + enabled: boolean, + axesButtons: { + enabled: boolean, + axes: union("x", "y", "xy") + }, + toolbar: { + enabled: boolean, + padding: positiveNumber, + buttons: arrayOfDefs( + { + ...toolbarButtonOptionsDefs, + value: union( + "line-menu", + "fibonacci-menu", + "text-menu", + "shape-menu", + "measurer-menu", + "line", + "horizontal-line", + "vertical-line", + "parallel-channel", + "disjoint-channel", + "fibonacci-retracement", + "fibonacci-retracement-trend-based", + "text", + "comment", + "callout", + "note", + "clear" + ) + }, + "annotation toolbar buttons array" + ) + }, + optionsToolbar: { + enabled: boolean, + buttons: arrayOf( + or( + optionsDefs({ + ...toolbarButtonOptionsDefs, + value: required( + union( + "line-stroke-width", + "line-style-type", + "line-color", + "fill-color", + "text-color", + "text-size", + "delete", + "settings" + ) + ) + }), + optionsDefs({ + ...toolbarButtonOptionsDefs, + value: required(union("lock")), + checkedOverrides: toolbarButtonOptionsDefs + }) + ) + ) + } +}; +annotationOptionsDef.data = undocumented(array); +annotationOptionsDef.xKey = undocumented(string); +annotationOptionsDef.volumeKey = undocumented(string); +annotationOptionsDef.snap = undocumented(boolean); + +// packages/ag-charts-community/src/chart/themes/enterpriseThemeableOptionsDef.ts +var boxPlotStyleOptionsDef = { + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + cornerRadius: positiveNumber, + whisker: { + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + cap: { + lengthRatio: ratio + } +}; +var boxPlotHighlightStyleOptionsDef = { + ...boxPlotStyleOptionsDef, + opacity: ratio +}; +var boxPlotStyler = callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + cornerRadius: positiveNumber, + whisker: { + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + cap: { + lengthRatio: ratio + } +}); +var boxPlotSeriesThemeableOptionsDef = { + direction: union("horizontal", "vertical"), + showInMiniChart: boolean, + styler: boxPlotStyler, + itemStyler: boxPlotStyler, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...boxPlotStyleOptionsDef, + highlight: multiSeriesHighlightOptionsDef(boxPlotHighlightStyleOptionsDef, boxPlotHighlightStyleOptionsDef), + segmentation: shapeSegmentation +}; +var candlestickSeriesItemOptionsDef = { + cornerRadius: positiveNumber, + wick: { + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var candlestickHighlightStyleOptionsDef = { + ...candlestickSeriesItemOptionsDef, + opacity: ratio +}; +var candlestickSeriesThemeableOptionsDef = { + item: { + up: candlestickSeriesItemOptionsDef, + down: candlestickSeriesItemOptionsDef + }, + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + cornerRadius: positiveNumber, + wick: { + ...strokeOptionsDef, + ...lineDashOptionsDef + } + }), + showInMiniChart: boolean, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + highlight: multiSeriesHighlightOptionsDef(candlestickHighlightStyleOptionsDef, candlestickHighlightStyleOptionsDef) +}; +var chordSeriesThemeableOptionsDef = { + fills: arrayOf(colorUnion), + strokes: arrayOf(color), + label: { + spacing: positiveNumber, + maxWidth: positiveNumber, + ...seriesLabelOptionsDefs + }, + link: { + tension: ratio, + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + tension: ratio + }), + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + node: { + width: positiveNumber, + spacing: positiveNumber, + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }), + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs +}; +var coneFunnelSeriesThemeableOptionsDef = { + direction: union("horizontal", "vertical"), + fills: arrayOf(colorUnion), + strokes: arrayOf(color), + label: { + spacing: positiveNumber, + placement: union("before", "middle", "after"), + ...seriesLabelOptionsDefs + }, + stageLabel: { + placement: union("before", "after"), + format: numberFormatValidator, + ...commonAxisLabelOptionsDefs + }, + tooltip: tooltipOptionsDefs, + ...without(commonSeriesThemeableOptionsDefs, ["showInLegend"]), + ...without(fillOptionsDef, ["fill"]), + ...without(strokeOptionsDef, ["stroke"]), + ...lineDashOptionsDef, + highlight: highlightOptionsDef(lineHighlightOptionsDef) +}; +var funnelSeriesThemeableOptionsDef = { + direction: union("horizontal", "vertical"), + fills: arrayOf(colorUnion), + strokes: arrayOf(color), + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }), + spacingRatio: ratio, + crisp: boolean, + dropOff: { + enabled: boolean, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + stageLabel: { + placement: union("before", "after"), + format: numberFormatValidator, + ...commonAxisLabelOptionsDefs + }, + label: seriesLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + shadow: shadowOptionsDefs, + ...without(commonSeriesThemeableOptionsDefs, ["showInLegend"]), + ...without(fillOptionsDef, ["fill"]), + ...without(strokeOptionsDef, ["stroke"]), + ...lineDashOptionsDef +}; +var heatmapSeriesThemeableOptionsDef = { + title: string, + textAlign: union("left", "center", "right"), + verticalAlign: union("top", "middle", "bottom"), + itemPadding: positiveNumber, + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef + }), + showInMiniChart: boolean, + label: autoSizedLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...strokeOptionsDef +}; +var ohlcSeriesThemeableOptionsDef = { + showInMiniChart: boolean, + itemStyler: callbackDefs({ + ...strokeOptionsDef, + ...lineDashOptionsDef + }), + item: { + up: { + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + down: { + ...strokeOptionsDef, + ...lineDashOptionsDef + } + }, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + highlight: multiSeriesHighlightOptionsDef(lineHighlightOptionsDef, lineHighlightOptionsDef) +}; +var mapLineSeriesThemeableOptionsDef = { + maxStrokeWidth: positiveNumber, + itemStyler: callbackDefs({ + ...strokeOptionsDef, + ...lineDashOptionsDef + }), + sizeDomain: arrayOf(positiveNumber), + label: seriesLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...strokeOptionsDef, + ...lineDashOptionsDef, + highlightStyle: { + // eslint-disable-next-line sonarjs/deprecation + ...commonSeriesThemeableOptionsDefs.highlightStyle, + ...strokeOptionsDef + }, + highlight: multiSeriesHighlightOptionsDef(lineHighlightOptionsDef, lineHighlightOptionsDef) +}; +var mapLineBackgroundSeriesThemeableOptionsDef = { + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var mapMarkerSeriesThemeableOptionsDef = { + colorRange: arrayOf(color), + maxSize: positiveNumber, + sizeDomain: arrayOf(positiveNumber), + label: { + placement: union("top", "bottom", "left", "right"), + ...seriesLabelOptionsDefs + }, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...without(markerOptionsDefs, ["enabled"]), + // TODO Remove in next major version + highlightStyle: { + // eslint-disable-next-line sonarjs/deprecation + ...commonSeriesThemeableOptionsDefs.highlightStyle, + ...fillOptionsDef, + ...strokeOptionsDef + }, + highlight: multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef) +}; +var mapShapeSeriesThemeableOptionsDef = { + colorRange: arrayOf(color), + padding: positiveNumber, + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }), + label: autoSizedLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + // TODO Remove in next major version + highlightStyle: { + // eslint-disable-next-line sonarjs/deprecation + ...commonSeriesThemeableOptionsDefs.highlightStyle, + ...fillOptionsDef, + ...strokeOptionsDef + }, + highlight: multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef) +}; +var mapShapeBackgroundSeriesThemeableOptionsDef = { + ...commonSeriesThemeableOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var radialSeriesStylerDef = callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + cornerRadius: positiveNumber +}); +var nightingaleSeriesThemeableOptionsDef = { + cornerRadius: positiveNumber, + styler: radialSeriesStylerDef, + itemStyler: radialSeriesStylerDef, + label: seriesLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + highlight: multiSeriesHighlightOptionsDef(barHighlightOptionsDef, barHighlightOptionsDef) +}; +var pyramidSeriesThemeableOptionsDef = { + direction: union("horizontal", "vertical"), + aspectRatio: positiveNumber, + spacing: positiveNumber, + reverse: boolean, + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }), + fills: arrayOf(colorUnion), + strokes: arrayOf(color), + label: seriesLabelOptionsDefs, + stageLabel: { + spacing: positiveNumber, + placement: union("before", "after"), + ...seriesLabelOptionsDefs + }, + tooltip: tooltipOptionsDefs, + shadow: shadowOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...without(fillOptionsDef, ["fill"]), + ...without(strokeOptionsDef, ["stroke"]), + ...lineDashOptionsDef +}; +var radarAreaSeriesThemeableOptionsDef = { + connectMissingData: boolean, + marker: markerOptionsDefs, + styler: callbackDefs({ + marker: markerStyleOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }), + label: seriesLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + highlight: multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef) +}; +var radarLineSeriesThemeableOptionsDef = { + connectMissingData: boolean, + marker: markerOptionsDefs, + styler: callbackDefs({ + marker: markerStyleOptionsDefs, + ...strokeOptionsDef, + ...lineDashOptionsDef + }), + label: seriesLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...strokeOptionsDef, + ...lineDashOptionsDef, + highlight: multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, lineHighlightOptionsDef) +}; +var radialBarSeriesThemeableOptionsDef = { + cornerRadius: positiveNumber, + styler: radialSeriesStylerDef, + itemStyler: radialSeriesStylerDef, + label: seriesLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + highlight: multiSeriesHighlightOptionsDef(barHighlightOptionsDef, barHighlightOptionsDef) +}; +var radialColumnSeriesThemeableOptionsDef = { + cornerRadius: positiveNumber, + columnWidthRatio: ratio, + maxColumnWidthRatio: ratio, + styler: radialSeriesStylerDef, + itemStyler: radialSeriesStylerDef, + label: seriesLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + highlight: multiSeriesHighlightOptionsDef(barHighlightOptionsDef, barHighlightOptionsDef) +}; +var rangeAreaSeriesLineThemeableOptionsDef = { + marker: markerOptionsDefs, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var rangeAreaSeriesItemLineThemeableOptionsDef = { + marker: { + enabled: boolean, + ...markerStyleOptionsDefs + }, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var rangeAreaSeriesLineStyleDef = { + marker: markerStyleOptionsDefs, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var rangeAreaSeriesThemeableOptionsDef = { + showInMiniChart: boolean, + connectMissingData: boolean, + interpolation: interpolationOptionsDefs, + label: { + ...seriesLabelOptionsDefs, + placement: union("inside", "outside"), + spacing: positiveNumber + }, + tooltip: tooltipOptionsDefs, + shadow: shadowOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...fillOptionsDef, + ...rangeAreaSeriesLineThemeableOptionsDef, + item: { + low: { ...rangeAreaSeriesItemLineThemeableOptionsDef }, + high: { ...rangeAreaSeriesItemLineThemeableOptionsDef } + }, + styler: callbackDefs({ + ...fillOptionsDef, + item: { + low: { ...rangeAreaSeriesLineStyleDef }, + high: { ...rangeAreaSeriesLineStyleDef } + } + }), + highlight: multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef, shapeHighlightOptionsDef), + segmentation: shapeSegmentation, + invertedStyle: { + enabled: boolean, + ...fillOptionsDef + } +}; +var rangeBarStyleCallback = callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + cornerRadius: positiveNumber +}); +var rangeBarSeriesThemeableOptionsDef = { + direction: union("horizontal", "vertical"), + grouped: boolean, + showInMiniChart: boolean, + cornerRadius: positiveNumber, + styler: rangeBarStyleCallback, + itemStyler: rangeBarStyleCallback, + label: { + ...seriesLabelOptionsDefs, + placement: union("inside", "outside"), + spacing: positiveNumber + }, + tooltip: tooltipOptionsDefs, + shadow: shadowOptionsDefs, + ...commonSeriesThemeableOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + highlight: multiSeriesHighlightOptionsDef(barHighlightOptionsDef, barHighlightOptionsDef), + segmentation: shapeSegmentation +}; +var sankeySeriesThemeableOptionsDef = { + fills: arrayOf(colorUnion), + strokes: arrayOf(color), + label: { + ...seriesLabelOptionsDefs, + spacing: positiveNumber, + placement: union("left", "right", "center"), + edgePlacement: union("inside", "outside") + }, + link: { + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }), + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + node: { + width: positiveNumber, + spacing: positiveNumber, + minSpacing: and(positiveNumber, lessThanOrEqual("spacing")), + alignment: union("left", "center", "right", "justify"), + verticalAlignment: union("top", "bottom", "center"), + sort: union("data", "ascending", "descending", "auto"), + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }), + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs +}; +var sunburstSeriesThemeableOptionsDef = { + fills: arrayOf(colorUnion), + strokes: arrayOf(color), + colorRange: arrayOf(color), + sectorSpacing: positiveNumber, + cornerRadius: positiveNumber, + padding: positiveNumber, + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef + }), + label: { + spacing: positiveNumber, + ...autoSizedLabelOptionsDefs + }, + secondaryLabel: autoSizedLabelOptionsDefs, + tooltip: tooltipOptionsDefs, + ...without(commonSeriesThemeableOptionsDefs, ["highlight", "showInLegend"]), + ...without(fillOptionsDef, ["fill"]), + ...without(strokeOptionsDef, ["stroke"]), + // TODO Remove in next major version + highlightStyle: { + label: { + color + }, + secondaryLabel: { + color + }, + ...fillOptionsDef, + ...strokeOptionsDef + } +}; +var treemapSeriesThemeableOptionsDef = { + fills: arrayOf(colorUnion), + strokes: arrayOf(color), + colorRange: arrayOf(color), + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef + }), + group: { + gap: positiveNumber, + padding: positiveNumber, + cornerRadius: positiveNumber, + textAlign: union("left", "center", "right"), + interactive: boolean, + label: { + ...seriesLabelOptionsDefs, + spacing: positiveNumber + }, + ...fillOptionsDef, + ...strokeOptionsDef + }, + tile: { + gap: positiveNumber, + padding: positiveNumber, + cornerRadius: positiveNumber, + textAlign: union("left", "center", "right"), + verticalAlign: union("top", "middle", "bottom"), + label: { + ...seriesLabelOptionsDefs, + spacing: positiveNumber, + lineHeight: positiveNumber, + minimumFontSize: positiveNumber, + wrapping: union("never", "always", "hyphenate", "on-space"), + overflowStrategy: union("ellipsis", "hide") + }, + secondaryLabel: { + ...seriesLabelOptionsDefs, + lineHeight: positiveNumber, + minimumFontSize: positiveNumber, + wrapping: union("never", "always", "hyphenate", "on-space"), + overflowStrategy: union("ellipsis", "hide") + }, + ...fillOptionsDef, + ...strokeOptionsDef + }, + tooltip: tooltipOptionsDefs, + ...without(commonSeriesThemeableOptionsDefs, ["highlight", "showInLegend"]), + // TODO Remove in next major version + highlightStyle: { + group: { + label: { + color + }, + ...fillOptionsDef, + ...strokeOptionsDef + }, + tile: { + label: { + color + }, + secondaryLabel: { + color + }, + ...fillOptionsDef, + ...strokeOptionsDef + } + } +}; +var waterfallSeriesItemOptionsDef = { + name: string, + cornerRadius: positiveNumber, + itemStyler: callbackDefs({ + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef, + cornerRadius: positiveNumber + }), + label: { + ...seriesLabelOptionsDefs, + placement: union("inside-start", "inside-center", "inside-end", "outside-start", "outside-end"), + spacing: positiveNumber + }, + tooltip: tooltipOptionsDefs, + shadow: shadowOptionsDefs, + ...fillOptionsDef, + ...strokeOptionsDef, + ...lineDashOptionsDef +}; +var waterfallSeriesThemeableOptionsDef = { + direction: union("horizontal", "vertical"), + showInMiniChart: boolean, + item: { + positive: waterfallSeriesItemOptionsDef, + negative: waterfallSeriesItemOptionsDef, + total: waterfallSeriesItemOptionsDef + }, + line: { + enabled: boolean, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + tooltip: tooltipOptionsDefs, + ...commonSeriesThemeableOptionsDefs +}; + +// packages/ag-charts-community/src/chart/themes/themeOptionsDef.ts +var serializableDate = optionsDefs( + { + __type: required(constant("date")), + value: or(string, number) + }, + "a serializable date object" +); +var navigatorHandleOptionsDef = { + width: positiveNumber, + height: positiveNumber, + grip: boolean, + fill: color, + stroke: color, + strokeWidth: positiveNumber, + cornerRadius: positiveNumber +}; +var navigatorOptionsDef = { + enabled: boolean, + height: positiveNumber, + spacing: positiveNumber, + cornerRadius: number, + mask: { + fill: color, + fillOpacity: ratio, + stroke: color, + strokeWidth: positiveNumber + }, + minHandle: navigatorHandleOptionsDef, + maxHandle: navigatorHandleOptionsDef, + miniChart: { + enabled: boolean, + padding: { + top: positiveNumber, + bottom: positiveNumber + }, + label: { + enabled: boolean, + avoidCollisions: boolean, + spacing: positiveNumber, + format: numberFormatValidator, + formatter: callbackOf(textOrSegments), + interval: { + minSpacing: positiveNumber, + maxSpacing: positiveNumber, + values: array, + step: number + }, + ...fontOptionsDef + }, + series: defined + } +}; +var cartesianAxesThemeDef = { + number: { + ...without(numberAxisOptionsDefs, ["type", "crossLines"]), + top: without(numberAxisOptionsDefs, ["type", "crossLines", "position"]), + right: without(numberAxisOptionsDefs, ["type", "crossLines", "position"]), + bottom: without(numberAxisOptionsDefs, ["type", "crossLines", "position"]), + left: without(numberAxisOptionsDefs, ["type", "crossLines", "position"]), + crossLines: without(cartesianCrossLineOptionsDefs, ["type"]) + }, + log: { + ...without(logAxisOptionsDefs, ["type", "crossLines"]), + top: without(logAxisOptionsDefs, ["type", "crossLines", "position"]), + right: without(logAxisOptionsDefs, ["type", "crossLines", "position"]), + bottom: without(logAxisOptionsDefs, ["type", "crossLines", "position"]), + left: without(logAxisOptionsDefs, ["type", "crossLines", "position"]), + crossLines: without(cartesianCrossLineOptionsDefs, ["type"]) + }, + category: { + ...without(categoryAxisOptionsDefs, ["type", "crossLines"]), + top: without(categoryAxisOptionsDefs, ["type", "crossLines", "position"]), + right: without(categoryAxisOptionsDefs, ["type", "crossLines", "position"]), + bottom: without(categoryAxisOptionsDefs, ["type", "crossLines", "position"]), + left: without(categoryAxisOptionsDefs, ["type", "crossLines", "position"]), + crossLines: without(cartesianCrossLineOptionsDefs, ["type"]) + }, + time: { + ...without(timeAxisOptionsDefs, ["type", "crossLines"]), + top: without(timeAxisOptionsDefs, ["type", "crossLines", "position"]), + right: without(timeAxisOptionsDefs, ["type", "crossLines", "position"]), + bottom: without(timeAxisOptionsDefs, ["type", "crossLines", "position"]), + left: without(timeAxisOptionsDefs, ["type", "crossLines", "position"]), + crossLines: without(cartesianCrossLineOptionsDefs, ["type"]) + }, + "unit-time": { + ...without(unitTimeAxisOptionsDefs, ["type", "crossLines"]), + top: without(unitTimeAxisOptionsDefs, ["type", "crossLines", "position"]), + right: without(unitTimeAxisOptionsDefs, ["type", "crossLines", "position"]), + bottom: without(unitTimeAxisOptionsDefs, ["type", "crossLines", "position"]), + left: without(unitTimeAxisOptionsDefs, ["type", "crossLines", "position"]), + crossLines: without(cartesianCrossLineOptionsDefs, ["type"]) + }, + "grouped-category": { + ...without(groupedCategoryAxisOptionsDefs, ["type"]), + top: without(groupedCategoryAxisOptionsDefs, ["type", "position"]), + right: without(groupedCategoryAxisOptionsDefs, ["type", "position"]), + bottom: without(groupedCategoryAxisOptionsDefs, ["type", "position"]), + left: without(groupedCategoryAxisOptionsDefs, ["type", "position"]), + crossLines: without(cartesianCrossLineOptionsDefs, ["type"]) + }, + "ordinal-time": { + ...without(ordinalTimeAxisOptionsDefs, ["type", "crossLines"]), + top: without(ordinalTimeAxisOptionsDefs, ["type", "crossLines", "position"]), + right: without(ordinalTimeAxisOptionsDefs, ["type", "crossLines", "position"]), + bottom: without(ordinalTimeAxisOptionsDefs, ["type", "crossLines", "position"]), + left: without(ordinalTimeAxisOptionsDefs, ["type", "crossLines", "position"]), + crossLines: without(cartesianCrossLineOptionsDefs, ["type"]) + } +}; +var polarAxesThemeDef = { + "angle-category": { + ...without(angleCategoryAxisOptionsDefs, ["type", "crossLines"]), + crossLines: without(commonCrossLineOptionsDefs, ["type"]) + }, + "angle-number": { + ...without(angleNumberAxisOptionsDefs, ["type", "crossLines"]), + crossLines: without(commonCrossLineOptionsDefs, ["type"]) + }, + "radius-category": { + ...without(radiusCategoryAxisOptionsDefs, ["type", "crossLines"]), + crossLines: { + ...without(commonCrossLineOptionsDefs, ["type"]), + label: { + ...commonCrossLineLabelOptionsDefs, + positionAngle: number + } + } + }, + "radius-number": { + ...without(radiusNumberAxisOptionsDefs, ["type", "crossLines"]), + crossLines: { + ...without(commonCrossLineOptionsDefs, ["type"]), + label: { + ...commonCrossLineLabelOptionsDefs, + positionAngle: number + } + } + } +}; +var undocumentedSeriesOptionsDef = { + visible: undocumented(boolean) +}; +var themeOverridesOptionsDef = { + common: { + ...commonChartOptionsDefs, + navigator: navigatorOptionsDef, + axes: { + ...cartesianAxesThemeDef, + ...polarAxesThemeDef + }, + annotations: { + ...annotationOptionsDef, + line: annotationLineStyleDefs, + "horizontal-line": annotationCrossLineStyleDefs, + "vertical-line": annotationCrossLineStyleDefs, + "disjoint-channel": annotationDisjointChannelStyleDefs, + "parallel-channel": annotationParallelChannelStyleDefs, + "fibonacci-retracement": annotationFibonacciStylesDefs, + "fibonacci-retracement-trend-based": annotationFibonacciStylesDefs, + callout: annotationCalloutStylesDefs, + comment: annotationCommentStylesDefs, + note: annotationNoteStylesDefs, + text: annotationTextStylesDef, + arrow: annotationLineStyleDefs, + "arrow-up": annotationShapeStylesDefs, + "arrow-down": annotationShapeStylesDefs, + "date-range": annotationMeasurerStylesDefs, + "price-range": annotationMeasurerStylesDefs, + "date-price-range": annotationMeasurerStylesDefs, + "quick-date-price-range": annotationQuickMeasurerStylesDefs + }, + chartToolbar: { + enabled: boolean + }, + initialState: { + legend: arrayOfDefs( + { + visible: boolean, + seriesId: string, + itemId: string, + legendItemName: string + }, + "legend state array" + ), + zoom: { + rangeX: { + start: or(number, serializableDate), + end: or(number, serializableDate) + }, + rangeY: { + start: or(number, serializableDate), + end: or(number, serializableDate) + }, + ratioX: { + start: ratio, + end: ratio + }, + ratioY: { + start: ratio, + end: ratio + }, + autoScaledAxes: arrayOf(constant("y")) + } + } + }, + line: { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: lineSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + scatter: { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: scatterSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef, + // @ts-expect-error undocumented option - required by grid + paired: undocumented(boolean) + }, + bubble: { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: bubbleSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + area: { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: areaSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + bar: { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: barSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "box-plot": { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: boxPlotSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + candlestick: { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: candlestickSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "cone-funnel": { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: coneFunnelSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + funnel: { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: funnelSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + ohlc: { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: ohlcSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + histogram: { + ...commonChartOptionsDefs, + axes: without(cartesianAxesThemeDef, ["category", "grouped-category", "unit-time", "ordinal-time"]), + series: histogramSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + heatmap: { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: heatmapSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + waterfall: { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: waterfallSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "range-bar": { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: rangeBarSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "range-area": { + ...commonChartOptionsDefs, + axes: cartesianAxesThemeDef, + series: rangeAreaSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + donut: { + ...commonChartOptionsDefs, + series: donutSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + pie: { + ...commonChartOptionsDefs, + series: pieSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "radar-line": { + ...commonChartOptionsDefs, + axes: polarAxesThemeDef, + series: radarLineSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "radar-area": { + ...commonChartOptionsDefs, + axes: polarAxesThemeDef, + series: radarAreaSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "radial-bar": { + ...commonChartOptionsDefs, + axes: polarAxesThemeDef, + series: radialBarSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "radial-column": { + ...commonChartOptionsDefs, + axes: polarAxesThemeDef, + series: radialColumnSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + nightingale: { + ...commonChartOptionsDefs, + axes: polarAxesThemeDef, + series: nightingaleSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + sunburst: { + ...commonChartOptionsDefs, + series: sunburstSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + treemap: { + ...commonChartOptionsDefs, + series: treemapSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "map-shape": { + ...commonChartOptionsDefs, + series: mapShapeSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "map-line": { + ...commonChartOptionsDefs, + series: mapLineSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "map-marker": { + ...commonChartOptionsDefs, + series: mapMarkerSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "map-shape-background": { + ...commonChartOptionsDefs, + series: mapShapeBackgroundSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "map-line-background": { + ...commonChartOptionsDefs, + series: mapLineBackgroundSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + sankey: { + ...commonChartOptionsDefs, + series: sankeySeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + chord: { + ...commonChartOptionsDefs, + series: chordSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + pyramid: { + ...commonChartOptionsDefs, + series: pyramidSeriesThemeableOptionsDef, + navigator: navigatorOptionsDef, + ...undocumentedSeriesOptionsDef + }, + "radial-gauge": { + ...commonChartOptionsDefs, + ...radialGaugeSeriesThemeableOptionsDef, + targets: without(radialGaugeTargetOptionsDef, ["value"]), + tooltip: { + ...radialGaugeSeriesThemeableOptionsDef.tooltip, + ...commonChartOptionsDefs.tooltip + } + }, + "linear-gauge": { + ...commonChartOptionsDefs, + ...linearGaugeSeriesThemeableOptionsDef, + targets: without(linearGaugeTargetOptionsDef, ["value"]), + tooltip: { + ...linearGaugeSeriesThemeableOptionsDef.tooltip, + ...commonChartOptionsDefs.tooltip + } + } +}; +function mapValues2(object2, mapper) { + const result = {}; + for (const key of Reflect.ownKeys(object2)) { + result[key] = mapper(object2[key], key, object2); + } + return result; +} +var themeOverridesOptionsWithOperatorsDef = mapValues2( + themeOverridesOptionsDef, + function themeOperatorMapper(value, key) { + if (isSymbol(key)) + return value; + if (isFunction(value)) { + return or(value, themeOperator, isSymbol); + } else if (isObject(value)) { + return or( + optionsDefs( + unionSymbol in value ? mapValues2(value, (val) => isObject(val) ? mapValues2(val, themeOperatorMapper) : val) : mapValues2(value, themeOperatorMapper) + ), + themeOperator, + isSymbol + ); + } + throw new Error(`Invalid theme override value: ${String(value)}`); + } +); + +// packages/ag-charts-community/src/chart/themes/vividDark.ts +var VIVID_DARK_FILLS = { + BLUE: "#0083ff", + ORANGE: "#ff6600", + GREEN: "#00af00", + CYAN: "#00ccff", + YELLOW: "#f7c700", + VIOLET: "#ac26ff", + GRAY: "#a7a7b7", + MAGENTA: "#e800c5", + BROWN: "#b54300", + RED: "#ff0000" +}; +var VIVID_DARK_STROKES = { + BLUE: "#67b7ff", + ORANGE: "#ffc24d", + GREEN: "#5cc86f", + CYAN: "#54ebff", + VIOLET: "#fff653", + YELLOW: "#c18aff", + GRAY: "#aeaeae", + MAGENTA: "#f078d4", + BROWN: "#ba8438", + RED: "#ff726e" +}; +var VividDark = class extends DarkTheme { + getDefaultColors() { + return { + fills: VIVID_DARK_FILLS, + fillsFallback: Object.values(VIVID_DARK_FILLS), + strokes: VIVID_DARK_STROKES, + sequentialColors: getSequentialColors(VIVID_DARK_FILLS), + divergingColors: [VIVID_DARK_FILLS.ORANGE, VIVID_DARK_FILLS.YELLOW, VIVID_DARK_FILLS.GREEN], + hierarchyColors: [], + secondSequentialColors: [ + "#0083ff", + "#0076e6", + "#0069cc", + "#005cb3", + "#004f99", + "#004280", + "#003466", + "#00274c" + ], + secondDivergingColors: [VIVID_DARK_FILLS.GREEN, VIVID_DARK_FILLS.YELLOW, VIVID_DARK_FILLS.RED], + secondHierarchyColors: [], + up: { fill: VIVID_DARK_FILLS.GREEN, stroke: VIVID_DARK_STROKES.GREEN }, + down: { fill: VIVID_DARK_FILLS.RED, stroke: VIVID_DARK_STROKES.RED }, + neutral: { fill: VIVID_DARK_FILLS.GRAY, stroke: VIVID_DARK_STROKES.GRAY }, + altUp: { fill: VIVID_DARK_FILLS.BLUE, stroke: VIVID_DARK_STROKES.BLUE }, + altDown: { fill: VIVID_DARK_FILLS.ORANGE, stroke: VIVID_DARK_STROKES.ORANGE }, + altNeutral: { fill: VIVID_DARK_FILLS.GRAY, stroke: VIVID_DARK_STROKES.GRAY } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, VIVID_DARK_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, VIVID_DARK_FILLS.BLUE); + return params; + } +}; + +// packages/ag-charts-community/src/chart/themes/vividLight.ts +var VIVID_FILLS = { + BLUE: "#0083ff", + ORANGE: "#ff6600", + GREEN: "#00af00", + CYAN: "#00ccff", + YELLOW: "#f7c700", + VIOLET: "#ac26ff", + GRAY: "#a7a7b7", + MAGENTA: "#e800c5", + BROWN: "#b54300", + RED: "#ff0000" +}; +var VIVID_STROKES = { + BLUE: "#0f68c0", + ORANGE: "#d47100", + GREEN: "#007922", + CYAN: "#009ac2", + VIOLET: "#bca400", + YELLOW: "#753cac", + GRAY: "#646464", + MAGENTA: "#9b2685", + BROWN: "#6c3b00", + RED: "#cb0021" +}; +var VividLight = class extends ChartTheme { + getDefaultColors() { + return { + ...super.getDefaultColors(), + fills: VIVID_FILLS, + fillsFallback: Object.values(VIVID_FILLS), + strokes: VIVID_STROKES, + sequentialColors: getSequentialColors(VIVID_FILLS), + divergingColors: [VIVID_FILLS.ORANGE, VIVID_FILLS.YELLOW, VIVID_FILLS.GREEN], + hierarchyColors: [], + secondSequentialColors: [ + "#0083ff", + "#1a8fff", + "#339cff", + "#4da8ff", + "#66b5ff", + "#80c1ff", + "#99cdff", + "#b3daff" + ], + secondDivergingColors: [VIVID_FILLS.GREEN, VIVID_FILLS.YELLOW, VIVID_FILLS.RED], + secondHierarchyColors: [], + up: { fill: VIVID_FILLS.GREEN, stroke: VIVID_STROKES.GREEN }, + down: { fill: VIVID_FILLS.RED, stroke: VIVID_STROKES.RED }, + neutral: { fill: VIVID_FILLS.GRAY, stroke: VIVID_STROKES.GRAY }, + altUp: { fill: VIVID_FILLS.BLUE, stroke: VIVID_STROKES.BLUE }, + altDown: { fill: VIVID_FILLS.ORANGE, stroke: VIVID_STROKES.ORANGE }, + altNeutral: { fill: VIVID_FILLS.GRAY, stroke: VIVID_STROKES.GRAY } + }; + } + getTemplateParameters() { + const params = super.getTemplateParameters(); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, VIVID_FILLS.BLUE); + params.set(DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, VIVID_FILLS.BLUE); + return params; + } +}; + +// packages/ag-charts-community/src/chart/mapping/themes.ts +var lightTheme = simpleMemorize(() => new ChartTheme()); +var themeCacheDebug = Debug.create(true, "perf"); +var cacheCallback = (status, fn, keys) => { + themeCacheDebug(`[CACHE] ChartTheme`, status, fn.name, keys); +}; +var themes = { + // darkThemes, + "ag-default-dark": simpleMemorize(() => new DarkTheme()), + "ag-sheets-dark": simpleMemorize(() => new SheetsDark(), cacheCallback), + "ag-polychroma-dark": simpleMemorize(() => new PolychromaDark(), cacheCallback), + "ag-vivid-dark": simpleMemorize(() => new VividDark(), cacheCallback), + "ag-material-dark": simpleMemorize(() => new MaterialDark(), cacheCallback), + "ag-financial-dark": simpleMemorize(() => new FinancialDark(), cacheCallback), + // lightThemes, + "ag-default": lightTheme, + "ag-sheets": simpleMemorize(() => new SheetsLight(), cacheCallback), + "ag-polychroma": simpleMemorize(() => new PolychromaLight(), cacheCallback), + "ag-vivid": simpleMemorize(() => new VividLight(), cacheCallback), + "ag-material": simpleMemorize(() => new MaterialLight(), cacheCallback), + "ag-financial": simpleMemorize(() => new FinancialLight(), cacheCallback) +}; +var getChartTheme = simpleMemorize(createChartTheme, cacheCallback); +function createChartTheme(value) { + if (value instanceof ChartTheme) { + return value; + } else if (!validateStructure(value)) { + return lightTheme(); + } + if (value == null || typeof value === "string") { + const stockTheme = themes[value ?? "ag-default"]; + if (stockTheme) { + return stockTheme(); + } + throw new Error(`Cannot find theme \`${value}\`.`); + } + const { cleared, invalid } = validate(reduceThemeOptions(value), themeOptionsDef, "theme"); + for (const error2 of invalid) { + logger_exports.warnOnce(String(error2)); + } + const baseTheme = cleared?.baseTheme ? getChartTheme(cleared.baseTheme) : lightTheme(); + return cleared ? new baseTheme.constructor(cleared) : baseTheme; +} +function reduceThemeOptions(options) { + if (!isObject(options) || !isObject(options.baseTheme)) + return options; + let maybeNested = options; + let palette; + let params; + const overrides = []; + while (typeof maybeNested === "object") { + palette ?? (palette = maybeNested.palette); + params ?? (params = maybeNested.params); + if (maybeNested.overrides) { + overrides.push(maybeNested.overrides); + } + maybeNested = maybeNested.baseTheme; + } + return { + baseTheme: maybeNested, + overrides: mergeDefaults(...overrides), + params, + palette + }; +} +var themeOptionsDef = { + baseTheme: or(string, object), + overrides: themeOverridesOptionsWithOperatorsDef, + params: { + accentColor: color, + axisColor: color, + backgroundColor: color, + borderColor: color, + borderRadius: number, + chartBackgroundColor: color, + chartPadding: number, + focusShadow: string, + foregroundColor: color, + fontFamily: fontFamilyFull, + fontSize: number, + fontWeight: or(string, number), + gridLineColor: color, + popupShadow: string, + subtleTextColor: color, + textColor: color, + chromeBackgroundColor: color, + chromeFontFamily: fontFamilyFull, + chromeFontSize: number, + chromeFontWeight: or(string, number), + chromeSubtleTextColor: color, + chromeTextColor: color, + buttonBackgroundColor: color, + buttonBorder: boolean, + buttonFontWeight: number, + buttonTextColor: color, + inputBackgroundColor: color, + inputBorder: boolean, + inputTextColor: color, + menuBackgroundColor: color, + menuBorder: boolean, + menuTextColor: color, + panelBackgroundColor: color, + panelSubtleTextColor: color, + tooltipBackgroundColor: color, + tooltipBorder: boolean, + tooltipTextColor: color, + tooltipSubtleTextColor: color, + crosshairLabelBackgroundColor: color, + crosshairLabelTextColor: color + }, + palette: { + fills: arrayOf(colorUnion), + strokes: arrayOf(color), + up: { fill: or(color, gradientStrict), stroke: color }, + down: { fill: or(color, gradientStrict), stroke: color }, + neutral: { fill: or(color, gradientStrict), stroke: color } + } +}; +var themeNameValidator = union( + "ag-default", + "ag-default-dark", + "ag-sheets", + "ag-sheets-dark", + "ag-polychroma", + "ag-polychroma-dark", + "ag-vivid", + "ag-vivid-dark", + "ag-material", + "ag-material-dark", + "ag-financial", + "ag-financial-dark" +); +function validateStructure(value) { + const { invalid } = validate( + { theme: value }, + { theme: or(themeNameValidator, object) } + ); + for (const error2 of invalid) { + logger_exports.warnOnce(String(error2)); + } + return invalid.length === 0; +} + +// packages/ag-charts-community/src/module/enterpriseModule.ts +var enterpriseModule = { + isEnterprise: false +}; + +// packages/ag-charts-community/src/module/optionsGraphUtils.ts +var PATH_EDGE = "path"; +var PATH_ARRAY_EDGE = "pathArray"; +var DEFAULTS_EDGE = "default"; +var OVERRIDES_EDGE = "override"; +var USER_OPTIONS_EDGE = "user"; +var USER_PARTIAL_OPTIONS_EDGE = "userPartial"; +var OPERATION_EDGE = "operation"; +var OPERATION_VALUE_EDGE = "operationValue"; +var DEPENDENCY_EDGE = "dependency"; +var AUTO_ENABLE_EDGE = "autoEnable"; +var AUTO_ENABLE_VALUE_EDGE = "autoEnableValue"; +var PRUNE_EDGE = "prune"; +var CHILDREN_SOURCE_EDGE = "childrenSource"; +function isRatio(value) { + return isNumber(value) && value >= 0 && value <= 1; +} +function hasPathSafe(object2, path) { + let result = object2; + for (const part of path) { + const isPartKey = typeof part === "string" && result != null && (typeof result === "object" || Array.isArray(result)) && part in result; + if (!isPartKey) + return false; + result = result[part]; + } + return true; +} +function getPathSafe(object2, path) { + let result = object2; + for (const part of path) { + const isPartKey = typeof part === "string" && result != null && (typeof result === "object" || Array.isArray(result)) && part in result; + if (!isPartKey) + return; + result = result[part]; + } + return result; +} +function setPathSafe(object2, path, value) { + const pathLength = path.length; + if (pathLength === 0) + return; + let result = object2; + const lastIndex = pathLength - 1; + const lastPart = path[lastIndex]; + for (let i = 0; i < lastIndex; i++) { + const part = path[i]; + const nextPart = path[i + 1]; + let currentValue = result[part]; + if (currentValue == null || !isObjectLike(currentValue)) { + currentValue = Number.isNaN(Number(nextPart)) ? {} : []; + result[part] = currentValue; + } + result = currentValue; + } + result[lastPart] = value; +} +var DIGITS_ONLY_REGEX = /^\d+$/; +function getPathLastIndexIndex(pathArray, offset = 0) { + let count = 0; + for (let i = pathArray.length - 1; i >= 0; i--) { + const part = pathArray[i]; + if (DIGITS_ONLY_REGEX.test(part)) { + count++; + if (count > offset) + return i; + } + } + return -1; +} +function getPathLastIndex(pathArray, offset = 0) { + const indexIndex = getPathLastIndexIndex(pathArray, offset); + return Number(pathArray[indexIndex]); +} +function resolvePath(currentPath, path, variables) { + const relativePathParts = path.split("/"); + let resolvedPath = [...currentPath]; + if (path.startsWith("/")) { + resolvedPath = []; + relativePathParts.shift(); + } + let prevPartWasTwoDots = false; + for (const part of relativePathParts) { + if (part === "..") { + resolvedPath.pop(); + if (!prevPartWasTwoDots) + resolvedPath.pop(); + } else if (part === ".") { + resolvedPath.pop(); + } else if (part === "$index") { + const index = getPathLastIndex(currentPath); + if (Number.isNaN(index)) + return UNRESOLVABLE_PATH; + resolvedPath.push(`${index}`); + } else if (part === "$prevIndex") { + const index = getPathLastIndex(currentPath); + if (Number.isNaN(index) || Number(index) <= 0) + return UNRESOLVABLE_PATH; + resolvedPath.push(`${Number(index) - 1}`); + } else if (part.startsWith("$")) { + const variable = variables?.[part.slice(1)]; + if (variable == null) + return UNRESOLVABLE_PATH; + resolvedPath.push(variable); + } else if (part.length !== 0) { + resolvedPath.push(part); + } + prevPartWasTwoDots = part === ".."; + } + return resolvedPath; +} +var UNRESOLVABLE_PATH = Symbol("unresolvable-path"); +var RESOLVED_TO_BRANCH = Symbol("resolved-to-branch"); + +// packages/ag-charts-community/src/module/optionsGraphOperations.ts +function getOperation(value, keys) { + if (value == null || typeof value !== "object" || Array.isArray(value)) + return; + keys ?? (keys = Object.keys(value)); + if (keys.length === 0) + return; + const operation = keys[0]; + if (!operationTypes.has(operation)) + return; + return { + operation, + values: Array.isArray(value[operation]) ? value[operation] : [value[operation]] + }; +} +function getOperationTargetVertex(graph, vertex, valueVertex) { + const operation = getOperation(graph.getVertexValue(valueVertex)); + switch (operation?.operation) { + case "$path" /* Path */: { + const [relativePath] = operation.values; + const pathArray = graph.getPathArray(vertex); + const path = resolvePath(pathArray, relativePath); + if (path === UNRESOLVABLE_PATH) + return; + return graph.findVertexAtPath(path); + } + case "$value" /* Value */: + return vertex; + } +} +var cacheOperations = { + $cacheMax: cacheMaxOperation +}; +function cacheMaxOperation(graph, vertex, values) { + const [valueVertex] = values; + const pathArray = graph.getPathArray(vertex); + const cached = graph.getCachedValue(pathArray, "$cacheMax" /* CacheMax */); + const value = graph.resolveVertexValue(vertex, valueVertex); + if (typeof value !== "number") + return cached; + if (typeof cached !== "number") { + graph.setCachedValue(pathArray, "$cacheMax" /* CacheMax */, value); + return value; + } + const maxValue = Math.max(cached, value); + graph.setCachedValue(pathArray, "$cacheMax" /* CacheMax */, maxValue); + return maxValue; +} +var chartOperations = { + $hasSeriesType: { dependencies: seriesTypeDependencyFactory, resolve: hasSeriesTypeOperation }, + $isChartType: { dependencies: seriesTypeDependencyFactory, resolve: isChartTypeOperation }, + $isSeriesType: { dependencies: seriesTypeDependencyFactory, resolve: isSeriesTypeOperation } +}; +function seriesTypeDependencyFactory(graph, vertex, _values) { + const dependencyVertex = graph.findVertexAtPath(["series", "0", "type"]); + if (dependencyVertex) { + graph.addEdge(vertex, dependencyVertex, DEPENDENCY_EDGE); + } +} +function hasSeriesTypeOperation(graph, vertex, values) { + const [valueVertex] = values; + const value = graph.resolveVertexValue(vertex, valueVertex); + const series = graph.getResolvedPath(["series"]); + if (!Array.isArray(series)) + return false; + for (const s of series) { + if (s.type === value) + return true; + } + return false; +} +function isSeriesTypeOperation(graph, vertex, values) { + const [valueVertex] = values; + const value = graph.resolveVertexValue(vertex, valueVertex); + const seriesType = graph.getResolvedPath(["series", "0", "type"]); + return seriesType === value; +} +function isChartTypeOperation(graph, vertex, values) { + const [valueVertex] = values; + const value = graph.resolveVertexValue(vertex, valueVertex); + const seriesType = graph.getResolvedPath(["series", "0", "type"]); + if (typeof seriesType !== "string") + return false; + switch (value) { + case "cartesian": + return chartTypes2.isCartesian(seriesType); + case "polar": + return chartTypes2.isPolar(seriesType); + case "standalone": + return chartTypes2.isStandalone(seriesType); + } + return false; +} +var colorOperations = { + $foregroundBackgroundMix: foregroundBackgroundMixOperation, + $foregroundOpacity: foregroundOpacityOperation, + $interpolate: interpolateOperation, + $isGradient: isGradientOperation, + $isImage: isImageOperation, + $isPattern: isPatternOperation, + $mix: mixOperation +}; +function foregroundBackgroundMixOperation(graph, vertex, values) { + const [foregroundRatioVertex] = values; + const foregroundRatio = graph.resolveVertexValue(vertex, foregroundRatioVertex); + const foregroundColor = graph.getParamValue("foregroundColor"); + const backgroundColor = graph.getParamValue("backgroundColor"); + if (typeof foregroundColor === "string" && typeof backgroundColor === "string" && isRatio(foregroundRatio)) { + return Color.mix( + Color.fromString(foregroundColor), + Color.fromString(backgroundColor), + 1 - foregroundRatio + ).toString(); + } + Debug.inDevelopmentMode( + () => logger_exports.warnOnce( + `\`$foregroundBackgroundMix\` json operation failed on [${String(foregroundRatio)}}}] at [${graph.getPathArray(vertex).join(".")}], expecting a number between 0 and 1.` + ) + ); +} +function foregroundOpacityOperation(graph, vertex, values) { + const [opacityVertex] = values; + const opacity = graph.resolveVertexValue(vertex, opacityVertex); + const foregroundColor = graph.getParamValue("foregroundColor"); + if (typeof foregroundColor === "string" && isRatio(opacity)) { + const color2 = Color.fromString(foregroundColor); + return new Color(color2.r, color2.g, color2.b, opacity).toString(); + } + Debug.inDevelopmentMode( + () => logger_exports.warnOnce( + `\`$foregroundOpacity\` json operation failed on [${String(opacity)}}}] at [${graph.getPathArray(vertex).join(".")}], expecting a number between 0 and 1.` + ) + ); +} +function interpolateOperation(graph, vertex, values) { + const [colorsVertex, countVertex] = values; + const colors = graph.resolveVertexValue(vertex, colorsVertex); + const count = graph.resolveVertexValue(vertex, countVertex); + if (!isArray(colors) || !isNumber(count)) + return; + return Color.interpolate( + colors.map((color2) => Color.fromString(color2)), + count + ).map((color2) => color2.toString()); +} +function isGradientOperation(graph, vertex, values) { + const [valueVertex] = values; + const value = graph.resolveVertexValue(vertex, valueVertex); + return isGradientFill(value); +} +function isImageOperation(graph, vertex, values) { + const [valueVertex] = values; + const value = graph.resolveVertexValue(vertex, valueVertex); + return isImageFill(value); +} +function isPatternOperation(graph, vertex, values) { + const [valueVertex] = values; + const value = graph.resolveVertexValue(vertex, valueVertex); + return isPatternFill(value); +} +function mixOperation(graph, vertex, values) { + const [colorAVertex, colorBVertex, ratioVertex] = values; + const colorA = graph.resolveVertexValue(vertex, colorAVertex); + const colorB = graph.resolveVertexValue(vertex, colorBVertex); + const ratio2 = graph.resolveVertexValue(vertex, ratioVertex); + const pathArray = graph.getPathArray(vertex); + const warningPrefix = `\`$mix\` json operation failed on [${String(colorA)}, ${String(colorB)}, ${String(ratio2)}] at [${pathArray.join(".")}], expecting`; + const warningMessage = `${warningPrefix} two colors and a number between 0 and 1.`; + if (typeof colorB !== "string" || !isRatio(ratio2)) { + Debug.inDevelopmentMode(() => logger_exports.warnOnce(warningMessage)); + return; + } + if (typeof colorA === "string") { + try { + return Color.mix(Color.fromString(colorA), Color.fromString(colorB), ratio2).toString(); + } catch { + Debug.inDevelopmentMode(() => logger_exports.warnOnce(warningMessage)); + return; + } + } + if (!isGradientFill(colorA)) { + Debug.inDevelopmentMode(() => logger_exports.warnOnce(warningMessage)); + return; + } + let colorStops = colorA.colorStops; + try { + colorStops = colorStops?.map((value) => { + let color2; + if (typeof value.color === "string") { + color2 = Color.mix(Color.fromString(value.color), Color.fromString(colorB), ratio2).toString(); + } + return { ...value, color: color2 }; + }); + } catch { + Debug.inDevelopmentMode( + () => logger_exports.warnOnce(`${warningPrefix} a gradient, a color and a number between 0 and 1.`) + ); + return; + } + return { ...colorA, colorStops }; +} +var fontOperations = { + $rem: remOperation +}; +function remOperation(graph, vertex, values) { + const [valueVertex] = values; + const value = graph.getVertexValue(valueVertex); + const fontSize = graph.getParamValue("fontSize"); + if (typeof fontSize === "number" && typeof value === "number") { + return Math.round(value * fontSize); + } + Debug.inDevelopmentMode( + () => logger_exports.warnOnce( + `\`$rem\` json operation failed on [${String(value)}] at [${graph.getPathArray(vertex).join(".")}], expecting a number.` + ) + ); +} +var logicOperations = { + $and: andOperation, + $eq: eqOperation, + $greaterThan: greaterThanOperation, + $if: ifOperation, + $lessThan: lessThanOperation, + $not: notOperation, + $or: orOperation, + $switch: switchOperation +}; +function andOperation(graph, vertex, values) { + for (const valueVertex of values) { + const value = graph.resolveVertexValue(vertex, valueVertex); + if (!value) + return false; + } + return true; +} +function eqOperation(graph, vertex, values) { + let compare; + let first2 = true; + for (const valueVertex of values) { + const value = graph.resolveVertexValue(vertex, valueVertex); + if (first2) { + compare = value; + first2 = false; + } else if (value !== compare) { + return false; + } + } + return true; +} +function greaterThanOperation(graph, vertex, values) { + const [value, compare] = values; + return graph.resolveVertexValue(vertex, value) > graph.resolveVertexValue(vertex, compare); +} +function ifOperation(graph, vertex, values) { + const [conditionVertex, thenVertex, elseVertex] = values; + const condition = graph.resolveVertexValue(vertex, conditionVertex); + const valueVertex = condition ? thenVertex : elseVertex; + const neighbours = graph.neighboursWithEdgeValue(valueVertex, PATH_EDGE); + if (neighbours) { + for (const neighbour of neighbours) { + graph.addEdge(vertex, neighbour, PATH_EDGE); + } + } + return graph.resolveVertexValue(vertex, valueVertex); +} +function lessThanOperation(graph, vertex, values) { + const [value, compare] = values; + return graph.resolveVertexValue(vertex, value) < graph.resolveVertexValue(vertex, compare); +} +function notOperation(graph, vertex, values) { + const [valueVertex] = values; + if (!valueVertex) + return; + return !graph.resolveVertexValue(vertex, valueVertex); +} +function orOperation(graph, vertex, values) { + for (const valueVertex of values) { + const value = graph.resolveVertexValue(vertex, valueVertex); + if (value) + return true; + } + return false; +} +function switchOperation(graph, vertex, values) { + const [conditionValueVertex, defaultValueVertex, ...caseVertices] = values; + const conditionValue = graph.resolveVertexValue(vertex, conditionValueVertex); + for (const caseVertex of caseVertices) { + const caseValue = graph.getVertexValue(caseVertex); + if (!Array.isArray(caseValue)) + continue; + const [caseConditionValue, caseResultValue] = caseValue; + if (conditionValue === caseConditionValue || Array.isArray(caseConditionValue) && caseConditionValue.includes(conditionValue)) { + return caseResultValue; + } + } + return graph.resolveVertexValue(vertex, defaultValueVertex); +} +var locationOperations = { + $isUserOption: isUserOptionOperation, + $isThemeOverride: isThemeOverrideOperation, + $palette: paletteOperation, + $mapPalette: mapPaletteOperation, + $path: { + dependencies: pathOperationDependenciesFactory, + resolve: pathOperation + }, + $pathString: { + dependencies: pathOperationDependenciesFactory, + resolve: pathStringOperation + }, + $ref: refOperation +}; +function isUserOptionOperation(graph, vertex, values) { + const [relativePathVertices, thenVertex, elseVertex] = values; + const children = graph.neighboursWithEdgeValue(relativePathVertices, PATH_EDGE); + if (children) { + for (const child of children) { + const relativePathVertex = graph.findNeighbour(child, DEFAULTS_EDGE); + if (relativePathVertex && isUserOptionCheck(graph, vertex, relativePathVertex)) { + return graph.resolveVertexValue(vertex, thenVertex); + } + } + } else if (isUserOptionCheck(graph, vertex, relativePathVertices)) { + return graph.resolveVertexValue(vertex, thenVertex); + } + return graph.resolveVertexValue(vertex, elseVertex); +} +function isUserOptionCheck(graph, vertex, relativePathVertex) { + const relativePath = graph.resolveVertexValue(vertex, relativePathVertex); + if (!isString(relativePath)) { + throw new Error(`\`$isUserOption\` json operation failed on [${String(relativePath)}], expecting a string.`); + } + const pathArray = graph.getPathArray(vertex); + const path = resolvePath(pathArray, relativePath); + if (path === UNRESOLVABLE_PATH) + return false; + return graph.hasUserOption(path); +} +function isThemeOverrideOperation(graph, vertex, values) { + const [relativePathVertex, thenVertex, elseVertex] = values; + const relativePath = graph.resolveVertexValue(vertex, relativePathVertex); + if (!isString(relativePath)) { + throw new Error(`\`$isThemeOverride\` json operation failed on [${String(relativePath)}], expecting a string.`); + } + const pathArray = graph.getPathArray(vertex); + const path = resolvePath(pathArray, relativePath); + if (path === UNRESOLVABLE_PATH) + return; + if (graph.hasThemeOverride(path)) { + return graph.resolveVertexValue(vertex, thenVertex); + } + return graph.resolveVertexValue(vertex, elseVertex); +} +var PALETTE_INDEX_KEYS = /* @__PURE__ */ new Set(["fill", "fillFallback", "stroke", "gradient", "range2"]); +function paletteOperation(graph, vertex, values) { + const [keyVertex] = values; + const key = graph.resolveVertexValue(vertex, keyVertex); + if (!isString(key)) + return; + if (PALETTE_INDEX_KEYS.has(key)) { + const pathArray = graph.getPathArray(vertex); + const index = getPathLastIndex(pathArray); + if (Number.isNaN(index)) + return; + switch (key) { + case "fill": + return circularSliceArray(graph.palette.fills, 1, index)[0]; + case "fillFallback": + return circularSliceArray(graph.palette.fillsFallback, 1, index)[0]; + case "stroke": + return circularSliceArray(graph.palette.strokes, 1, index)[0]; + case "gradient": + return circularSliceArray(graph.palette.sequentialColors, 1, index)[0]; + case "range2": + return circularSliceArray(graph.palette.fills, 2, index); + } + return; + } + if (key === "gradients") { + return graph.palette.sequentialColors; + } + if (key === "type") { + return graph.paletteType; + } + const value = getPathSafe(graph.palette, key.split(".")); + if (Array.isArray(value)) + return [...value]; + if (typeof value === "object") + return { ...value }; + return value; +} +function mapPaletteOperation(graph, vertex, values) { + const [keyVertex] = values; + const key = graph.resolveVertexValue(vertex, keyVertex); + if (!isString(key)) + return; + if (PALETTE_INDEX_KEYS.has(key)) { + const pathArray = graph.getPathArray(vertex); + let index = getPathLastIndex(pathArray); + let ignoreIndexOffset = 0; + const path = ["series", "0", "type"]; + for (let i = 0; i < index; i++) { + path[1] = `${i}`; + const siblingSeriesType = graph.getResolvedPath(path); + if ("map-shape-background" === siblingSeriesType || "map-line-background" === siblingSeriesType) { + ignoreIndexOffset++; + } + } + index -= ignoreIndexOffset; + if (Number.isNaN(index)) + return; + switch (key) { + case "fill": + return circularSliceArray(graph.palette.fills, 1, index)[0]; + case "fillFallback": + return circularSliceArray(graph.palette.fillsFallback, 1, index)[0]; + case "stroke": + return circularSliceArray(graph.palette.strokes, 1, index)[0]; + case "gradient": + return circularSliceArray(graph.palette.sequentialColors, 1, index)[0]; + case "range2": + return circularSliceArray(graph.palette.fills, 2, index); + } + return; + } + if (key === "gradients") { + return graph.palette.sequentialColors; + } + if (key === "type") { + return graph.paletteType; + } + const value = getPathSafe(graph.palette, key.split(".")); + if (Array.isArray(value)) + return [...value]; + if (typeof value === "object") + return { ...value }; + return value; +} +function pathOperationDependenciesFactory(graph, vertex, values) { + const [relativePathVertex] = values; + const relativePath = graph.getVertexValue(relativePathVertex); + if (isString(relativePath)) { + const pathArray = graph.getPathArray(vertex); + const path = resolvePath(pathArray, relativePath); + if (path === UNRESOLVABLE_PATH) { + return; + } + const dependencyVertex = graph.findVertexAtPath(path); + if (dependencyVertex) { + graph.addEdge(vertex, dependencyVertex, DEPENDENCY_EDGE); + } + } +} +function pathOperation(graph, vertex, values) { + const hasDefaultValue = values.length > 1; + const hasCustomBranch = values.length > 2; + const [relativePathVertex, defaultValueVertex, customBranchVertex] = values; + const relativePath = graph.resolveVertexValue(vertex, relativePathVertex); + const customBranch = hasCustomBranch ? graph.resolveVertexValue(vertex, customBranchVertex) : null; + if (!isString(relativePath)) { + throw new Error(`\`$path\` json operation failed on [${String(relativePath)}], expecting a string.`); + } + const pathArray = graph.getPathArray(vertex); + const path = resolvePath(pathArray, relativePath); + if (path === UNRESOLVABLE_PATH) { + return; + } + const resolved = customBranch ? getPathSafe(customBranch, path) : graph.getResolvedPath(path); + if (resolved != null) { + return resolved; + } + if (hasDefaultValue) { + return graph.resolveVertexValue(vertex, defaultValueVertex); + } +} +function pathStringOperation(graph, vertex, values) { + const [relativePathVertex, variablesVertex] = values; + const relativePath = graph.resolveVertexValue(vertex, relativePathVertex); + if (!isString(relativePath)) { + throw new Error(`\`$path\` json operation failed on [${String(relativePath)}], expecting a string.`); + } + let variables; + if (variablesVertex) { + variables = graph.graftAndResolveOrphan(vertex, variablesVertex); + } + const pathArray = graph.getPathArray(vertex); + const path = resolvePath(pathArray, relativePath, variables); + if (path === UNRESOLVABLE_PATH) { + throw new Error(`Unresolvable path [${relativePath}] at [${pathArray.join(".")}]`); + } + return path; +} +function refOperation(graph, _vertex, values) { + const [value] = values; + const paramKey = graph.getVertexValue(value); + return graph.getParamValue(paramKey); +} +var transformOperations = { + $apply: applyOperation, + $applyCycle: applyCycleOperation, + $applySwitch: applySwitchOperation, + $applyTheme: applyThemeOperation, + $findFirstSiblingNotOperation: findFirstSiblingNotOperationOperation, + $map: mapOperation, + $merge: mergeOperation, + $omit: omitOperation, + $size: sizeOperation, + $shallow: shallowOperation, + $shallowSimple: shallowSimpleOperation, + $value: valueOperation +}; +function applyOperation(graph, vertex, values) { + const [objectVertex, defaultValueVertex, overridesPathVertex1, overridesPathVertex2] = values; + const object2 = graph.getVertexValue(objectVertex); + if (!isPlainObject(object2)) + return; + const defaultValue = defaultValueVertex ? graph.getVertexValue(defaultValueVertex) : void 0; + const children = graph.neighboursWithEdgeValue(vertex, PATH_EDGE); + const hasChildren = children && children.length > 0; + if (!hasChildren && defaultValue == null) { + return RESOLVED_TO_BRANCH; + } + const overridesPath1 = overridesPathVertex1 ? graph.resolveVertexValue(vertex, overridesPathVertex1) : void 0; + const overridesPath2 = overridesPathVertex2 ? graph.resolveVertexValue(vertex, overridesPathVertex2) : void 0; + if (!hasChildren && defaultValue != null) { + if (getOperation(defaultValue)) { + const resolvedDefaultValue = graph.resolveVertexValue(vertex, defaultValueVertex); + if (isPlainObject(resolvedDefaultValue)) { + graph.graftObject(vertex, resolvedDefaultValue, [overridesPath1, overridesPath2]); + } + } else { + graph.graftObject(vertex, defaultValue, [overridesPath1, overridesPath2]); + } + } + if (!hasChildren) + return RESOLVED_TO_BRANCH; + for (const child of children) { + const childNeighbours = graph.neighboursWithEdgeValue(child, PATH_EDGE); + if (!childNeighbours || childNeighbours.length === 0) { + const stubVertex = graph.addVertex({}); + graph.addEdge(child, stubVertex, DEFAULTS_EDGE); + } else { + graph.graftObject(child, object2, [overridesPath1, overridesPath2]); + } + } + return RESOLVED_TO_BRANCH; +} +function applyCycleOperation(graph, vertex, values) { + const [sizeVertex, defaultValuesVertex, operationVertex] = values; + const size = graph.resolveVertexValue(vertex, sizeVertex); + if (typeof size !== "number") + return; + const pathArray = graph.getPathArray(vertex); + const userOption = graph.dangerouslyGetUserOption(pathArray); + const hasThemeOverride = graph.hasThemeOverride(pathArray); + const graftEdge = userOption == null ? void 0 : USER_OPTIONS_EDGE; + const cycledValues = userOption ?? graph.resolveVertexValue(vertex, defaultValuesVertex); + if (!Array.isArray(cycledValues)) + return; + const operation = operationVertex ? graph.getVertexValue(operationVertex) : void 0; + for (let index = 0; index < size; index++) { + const value = cycledValues[index % cycledValues.length]; + if (value == null) + continue; + if (userOption || !hasThemeOverride) { + graph.graftValue(vertex, `${index}`, value, void 0, graftEdge); + } + if (operation) { + graph.graftValue(vertex, `${index}`, operation, value, graftEdge); + } + } + return RESOLVED_TO_BRANCH; +} +function applySwitchOperation(graph, vertex, values) { + const [conditionValueVertex, defaultValueVertex, ...caseVertices] = values; + const conditionValue = graph.resolveVertexValue(vertex, conditionValueVertex); + for (const caseVertex of caseVertices) { + const caseValue = graph.getVertexValue(caseVertex); + if (!Array.isArray(caseValue)) + continue; + const [caseConditionValue, caseResultValue] = caseValue; + if (conditionValue === caseConditionValue || Array.isArray(caseConditionValue) && caseConditionValue.includes(conditionValue)) { + graph.graftObject(vertex, caseResultValue, [], DEFAULTS_EDGE); + return RESOLVED_TO_BRANCH; + } + } + return graph.resolveVertexValue(vertex, defaultValueVertex); +} +function applyThemeOperation(graph, vertex, values) { + const [fromPathVertex, variablesVertex, ignorePathsVertex] = values; + let fromPaths = graph.getVertexValue(fromPathVertex); + if (typeof fromPaths === "string") { + fromPaths = [fromPaths]; + } + if (!Array.isArray(fromPaths)) + return; + const children = graph.neighboursWithEdgeValue(vertex, PATH_EDGE); + const ignorePathsValue = ignorePathsVertex ? graph.getVertexValue(ignorePathsVertex) : []; + const ignorePaths = Array.isArray(ignorePathsValue) ? new Set(ignorePathsValue) : /* @__PURE__ */ new Set(); + if (!children) + return RESOLVED_TO_BRANCH; + for (const child of children) { + const variables = graph.graftAndResolveOrphan(child, variablesVertex); + for (const fromPath of fromPaths) { + const fromPathResolved = resolvePath([], fromPath, variables); + if (fromPathResolved === UNRESOLVABLE_PATH) { + continue; + } + graph.graftConfig(child, fromPathResolved, ignorePaths); + } + } + return RESOLVED_TO_BRANCH; +} +function findFirstSiblingNotOperationOperation(graph, vertex, values) { + const [defaultValueVertex] = values; + const pathArray = graph.getPathArray(vertex); + const indexIndex = getPathLastIndexIndex(pathArray); + if (indexIndex < 0) { + return graph.resolveVertexValue(vertex, defaultValueVertex); + } + const parentPathArray = pathArray.slice(0, indexIndex); + const parentVertex = graph.findVertexAtPath(parentPathArray); + if (!parentVertex) { + return graph.resolveVertexValue(vertex, defaultValueVertex); + } + const siblings = graph.neighboursWithEdgeValue(parentVertex, PATH_EDGE); + if (siblings) { + for (let index = 0; index < siblings.length; index++) { + if (`${index}` === pathArray[indexIndex]) + continue; + const siblingChildPathArray = parentPathArray.concat([`${index}`, ...pathArray.slice(indexIndex + 1)]); + const siblingChildVertex = graph.findVertexAtPath(siblingChildPathArray); + if (!siblingChildVertex) + continue; + const siblingChildUserOptionsValue = graph.findNeighbourValue(siblingChildVertex, USER_OPTIONS_EDGE); + if (siblingChildUserOptionsValue != null) { + return siblingChildUserOptionsValue; + } + const siblingChildOverridesValue = graph.findNeighbourValue(siblingChildVertex, OVERRIDES_EDGE); + if (siblingChildOverridesValue != null) { + return siblingChildOverridesValue; + } + } + } + return graph.resolveVertexValue(vertex, defaultValueVertex); +} +function mapOperation(graph, vertex, values) { + const [mapOperationVertex, mapValuesVertex] = values; + const mapOperationValue = graph.getVertexValue(mapOperationVertex); + const mapValues4 = graph.resolveVertexValue(vertex, mapValuesVertex); + if (!Array.isArray(mapValues4)) + return; + const neighbours = graph.neighboursWithEdgeValue(vertex, PATH_EDGE); + if (neighbours && neighbours.length > 0) { + return; + } + let index = 0; + for (const value of mapValues4) { + graph.graftValue(vertex, `${index}`, mapOperationValue, value); + index++; + } + return RESOLVED_TO_BRANCH; +} +function mergeOperation(graph, vertex, values) { + for (const valueVertex of values) { + const value = graph.resolveVertexValue(vertex, valueVertex); + if (!isPlainObject(value)) + continue; + graph.graftObject(vertex, value); + } + return RESOLVED_TO_BRANCH; +} +function omitOperation(graph, vertex, values) { + const [keysVertex, objectVertex] = values; + let keys = graph.getVertexValue(keysVertex); + if (!Array.isArray(keys)) { + const targetVertex = getOperationTargetVertex(graph, vertex, objectVertex); + if (!targetVertex) + return; + keys = graph.resolveVertexValue(targetVertex, keysVertex); + } + const object2 = graph.resolveVertexValue(vertex, objectVertex); + if (!Array.isArray(keys) || !isPlainObject(object2)) + return; + return without(object2, keys); +} +function sizeOperation(graph, vertex, values) { + const [valueVertex] = values; + const value = graph.resolveVertexValue(vertex, valueVertex); + if (!isObjectLike(value)) + return 0; + if ("length" in value) + return value.length; + return Object.keys(value).length; +} +function shallowSimpleOperation(graph, _vertex, values) { + const shallowValues = []; + for (const valueVertex of values) { + shallowValues.push(graph.getVertexValue(valueVertex)); + } + return shallowValues; +} +function shallowOperation(graph, vertex, values) { + const pathArray = graph.getPathArray(vertex); + const hasUserOption = graph.hasUserOption(pathArray); + if (!hasUserOption && values.length === 1) { + return graph.resolveVertexValue(vertex, values[0]); + } + const shallowValues = []; + for (const valueVertex of values) { + shallowValues.push(graph.getVertexValue(valueVertex)); + } + if (hasUserOption) { + graph.prune(vertex, [OVERRIDES_EDGE, DEFAULTS_EDGE]); + return RESOLVED_TO_BRANCH; + } + graph.graftObject(vertex, shallowValues); + return RESOLVED_TO_BRANCH; +} +function valueOperation(graph, vertex, values) { + const [valueVertex] = values; + const value = graph.getVertexValue(valueVertex); + const pathArray = graph.getPathArray(vertex); + if (value === "$index") { + return getPathLastIndex(pathArray); + } + if (value === "$parentIndex") { + return getPathLastIndex(pathArray, 1); + } + if (value === "$1") { + return graph.resolveValue$1(pathArray); + } +} +var numericOperations = { + $isEven: isEvenOperation, + $mul: mulOperation, + $round: roundOperation +}; +function isEvenOperation(graph, vertex, values) { + const [valueVertex] = values; + const value = graph.resolveVertexValue(vertex, valueVertex); + if (Number.isNaN(Number(value))) + return false; + return Number(value) % 2 === 0; +} +function mulOperation(graph, vertex, values) { + let result; + for (const valueVertex of values) { + const value = graph.resolveVertexValue(vertex, valueVertex); + if (result == null) { + result = Number(value); + } else { + result *= Number(value); + } + } + return result; +} +function roundOperation(graph, vertex, values) { + const [valueVertex] = values; + if (!valueVertex) + return; + return Math.round(Number(graph.resolveVertexValue(vertex, valueVertex))); +} +var operations = { + ...cacheOperations, + ...chartOperations, + ...colorOperations, + ...fontOperations, + ...locationOperations, + ...logicOperations, + ...numericOperations, + ...transformOperations +}; +var operationTypes = new Set(Object.keys(operations)); +function isOperation(value) { + return operationTypes.has(value); +} + +// packages/ag-charts-community/src/module/optionsGraph.ts +var debug2 = Debug.create("opts", "options-graph"); +var createOptionsGraph = simpleMemorize(createOptionsGraphFn); +function createOptionsGraphFn(theme, options) { + return debug2.group( + "OptionsGraph.constructor()", + () => new OptionsGraph( + theme.config, + options, + theme.params, + theme.palette, + theme.overrides, + theme.getTemplateParameters() + ) + ); +} +var _OptionsGraph = class _OptionsGraph extends AdjacencyListGraph { + constructor(config = {}, userOptions = {}, params = void 0, palette = {}, overrides = void 0, internalParams = /* @__PURE__ */ new Map()) { + super(PATH_EDGE, OPERATION_EDGE, /* @__PURE__ */ new Set([USER_PARTIAL_OPTIONS_EDGE, USER_OPTIONS_EDGE])); + this.config = config; + this.userOptions = userOptions; + this.palette = palette; + this.overrides = overrides; + this.internalParams = internalParams; + // The current priority order in which to resolve options values. + this.edgePriority = [..._OptionsGraph.EDGE_PRIORITY]; + // The edge value to use when grafting new branches onto the graph from operations. + this.graftEdge = _OptionsGraph.GRAFT_EDGE; + this.resolvedParams = {}; + this.resolvedAnnotations = {}; + // The current value referenced by operations that use `$1`. + this.value$1 = /* @__PURE__ */ new Map(); + this.cachedPathVertices = /* @__PURE__ */ new Map(); + this.hasUnsafeClearKeys = false; + this.rollbackVertices = []; + this.rollbackEdgesFrom = []; + this.rollbackEdgesTo = []; + this.rollbackEdgesValue = []; + this.isRollingBack = false; + this.EMPTY_PATH_ARRAY_VERTEX = this.addVertex([]); + this.root = this.addVertex("root"); + this.params = this.addVertex("params"); + this.annotations = this.addVertex("annotations"); + this.paletteType = isObject(userOptions?.theme) ? paletteType(userOptions.theme?.palette) : "inbuilt"; + const seriesType = userOptions.series?.[0]?.type ?? "line"; + userOptions.axes ?? (userOptions.axes = seriesRegistry.predictAxes(seriesType, userOptions.series?.[0], userOptions.data) ?? seriesRegistry.cloneDefaultAxes(seriesType) ?? []); + debug2("build user"); + this.buildGraphFromObject(this.root, USER_OPTIONS_EDGE, without(userOptions, ["theme"])); + debug2("build defaults"); + this.buildGraphFromObject(this.root, DEFAULTS_EDGE, without(config[seriesType], _OptionsGraph.COMPLEX_KEYS)); + const seriesOverrides = overrides ? without(overrides[seriesType], _OptionsGraph.COMPLEX_KEYS) : {}; + if (Object.keys(seriesOverrides).length > 0) { + debug2("build series overrides"); + this.buildGraphFromObject(this.root, OVERRIDES_EDGE, seriesOverrides); + } + const commonOverrides = overrides ? without(overrides.common, _OptionsGraph.COMPLEX_KEYS) : {}; + if (Object.keys(commonOverrides).length > 0) { + debug2("build common overrides"); + this.buildGraphFromObject( + this.root, + OVERRIDES_EDGE, + chartTypes2.isCartesian(seriesType) ? commonOverrides : without(commonOverrides, ["zoom", "navigator"]) + ); + } + if (params) { + debug2("build params"); + this.buildGraphFromObject(this.params, DEFAULTS_EDGE, params); + } + const axesVertex = this.findNeighbourWithValue(this.root, "axes", PATH_EDGE); + const seriesVertex = this.findNeighbourWithValue(this.root, "series", PATH_EDGE); + if (axesVertex) { + debug2("build axes"); + this.buildGraphFromObject(axesVertex, DEFAULTS_EDGE, { + $applyTheme: [ + ["/$seriesType/axes/$axisType/$position", "/$seriesType/axes/$axisType"], + { + seriesType: { $path: ["/series/0/type", "line"] }, + axisType: { $path: ["./type", "category"] }, + position: { $path: ["./position"] } + }, + ["top", "right", "bottom", "left"] + ] + }); + } + if (seriesVertex) { + debug2("build series"); + this.buildGraphFromObject(seriesVertex, DEFAULTS_EDGE, { + $applyTheme: ["/$seriesType/series", { seriesType: { $path: ["./type", "line"] } }] + }); + } + const annotationsTypeConfig = without( + config[seriesType]?.annotations ?? {}, + _OptionsGraph.ANNOTATIONS_OPTIONS_KEYS + ); + if (Object.keys(annotationsTypeConfig).length > 0) { + debug2("build annotations type config"); + this.buildGraphFromObject(this.annotations, DEFAULTS_EDGE, annotationsTypeConfig); + } + const annotationsTypeOverrides = without( + overrides?.common?.annotations ?? {}, + _OptionsGraph.ANNOTATIONS_OPTIONS_KEYS + ); + if (Object.keys(annotationsTypeOverrides).length > 0) { + debug2("build annotations type overrides"); + this.buildGraphFromObject(this.annotations, OVERRIDES_EDGE, annotationsTypeOverrides); + } + const annotationsConfig = pick(config[seriesType]?.annotations ?? {}, _OptionsGraph.ANNOTATIONS_OPTIONS_KEYS); + if (Object.keys(annotationsConfig).length > 0) { + debug2("build annotations config"); + this.buildGraphFromObject(this.root, DEFAULTS_EDGE, { annotations: annotationsConfig }); + } + const annotationsOverrides = pick(overrides?.common?.annotations ?? {}, _OptionsGraph.ANNOTATIONS_OPTIONS_KEYS); + if (Object.keys(annotationsOverrides).length > 0) { + debug2("build annotations overrides"); + this.buildGraphFromObject(this.root, OVERRIDES_EDGE, { annotations: annotationsOverrides }); + } + this.buildDependencyGraph(); + } + clear() { + debug2.group("OptionsGraph.clear()", () => { + super.clear(); + this.cachedPathVertices.clear(); + this.root = void 0; + this.params = void 0; + this.annotations = void 0; + debug2("cleared"); + }); + } + clearSafe() { + if (this.hasUnsafeClearKeys) + return; + this.clear(); + } + resolve() { + return debug2.group("OptionsGraph.resolve()", () => { + this.resolved = {}; + this.resolvedParams = {}; + this.resolvedAnnotations = {}; + debug2("resolve params"); + this.resolveVertex(this.params, this.resolvedParams); + debug2("resolve annotations"); + this.resolveVertex(this.annotations, this.resolvedAnnotations); + debug2("resolve root"); + this.resolveVertex(this.root); + debug2("resolved root", this.resolved); + debug2("vertex count", this.getVertexCount()); + debug2("edge count", this.getEdgeCount()); + return this.resolved; + }); + } + resolveParams() { + return this.resolvedParams; + } + resolveAnnotationThemes() { + return this.resolvedAnnotations; + } + addVertex(value) { + const vertex = super.addVertex(value); + if (this.isRollingBack) { + this.rollbackVertices.push(vertex); + } + return vertex; + } + addEdge(from3, to, edge) { + const hasEdge = (this.neighboursWithEdgeValue(from3, edge)?.indexOf(to) ?? -1) !== -1; + if (this.isRollingBack && !hasEdge) { + this.rollbackEdgesFrom.push(from3); + this.rollbackEdgesTo.push(to); + this.rollbackEdgesValue.push(edge); + } + super.addEdge(from3, to, edge); + } + /** + * Resolve partial options against the existing graph at a given path without overriding the existing user values. + * Returns an object with only those keys that were also present within `partialOptions`. + */ + resolvePartial(path, partialOptions, resolveOptions) { + if (!partialOptions) + return; + if (!this.root) + return; + const { permissivePath, proxyPaths } = resolveOptions ?? {}; + const partialKeys = Object.keys(partialOptions); + if (debug2.check()) { + console.groupCollapsed(`OptionsGraph.resolvePartial() - ${path.join(".")} [${partialKeys}]`); + } + if (partialKeys.length === 0) + return {}; + const parentVertex = this.findVertexAtPath(path); + if (!parentVertex) { + if (permissivePath) { + return void 0; + } else { + throw new Error(`Could not find vertex in OptionsGraph at path [${path.join(".")}].`); + } + } + const pathArrayVertex = this.findNeighbour(parentVertex, PATH_ARRAY_EDGE); + this.userPartialOptions = {}; + setPathSafe(this.userPartialOptions, path, partialOptions); + if (proxyPaths) { + for (const proxyFrom of Object.keys(proxyPaths)) { + const proxyTo = proxyPaths[proxyFrom]; + const proxyValue = getPathSafe(partialOptions, [proxyFrom]); + if (proxyValue != null) { + setPathSafe(partialOptions, proxyTo, proxyValue); + setPathSafe(this.userPartialOptions, [...path, ...proxyTo], proxyValue); + delete partialOptions[proxyFrom]; + delete this.userPartialOptions[proxyFrom]; + } + } + } + this.graftEdge = USER_PARTIAL_OPTIONS_EDGE; + this.edgePriority = [USER_PARTIAL_OPTIONS_EDGE, ..._OptionsGraph.EDGE_PRIORITY]; + this.snapshot(); + this.buildGraphFromObject(parentVertex, USER_PARTIAL_OPTIONS_EDGE, partialOptions, pathArrayVertex); + for (const key of partialKeys) { + const childVertex = proxyPaths?.[key] ? this.findVertexAtPath([...path, ...proxyPaths[key]]) : this.findNeighbourWithValue(parentVertex, key, PATH_EDGE); + if (childVertex) { + this.refreshPendingProcessingEdges(childVertex); + } + } + this.buildDependencyGraph(); + const resolved = {}; + this.resolveVertex(parentVertex, resolved); + this.rollback(); + this.graftEdge = _OptionsGraph.GRAFT_EDGE; + this.edgePriority = _OptionsGraph.EDGE_PRIORITY; + this.userPartialOptions = void 0; + if (proxyPaths) { + for (const proxyFrom of Object.keys(proxyPaths)) { + const proxyTo = proxyPaths[proxyFrom]; + const proxyValue = getPathSafe(resolved, [...path, ...proxyTo]); + setPathSafe(resolved, [...path, proxyFrom], proxyValue); + } + } + const pathed = getPathSafe(resolved, path); + const shouldPick = resolveOptions?.pick ?? true; + const partial = shouldPick ? pick(getPathSafe(resolved, path), partialKeys) : pathed; + debug2("vertex count", this.getVertexCount()); + debug2("edge count", this.getEdgeCount()); + debug2("resolved partial", partial); + if (debug2.check()) { + console.groupEnd(); + } + return partial; + } + findVertexAtPath(path) { + const key = path.join("."); + if (this.cachedPathVertices.has(key)) { + return this.cachedPathVertices.get(key); + } + const vertex = this.findVertexAlongEdge(this.root, path, PATH_EDGE); + if (!vertex) + return; + this.cachedPathVertices.set(key, vertex); + return vertex; + } + hasUserOption(path) { + const hasUserOptionSimple = hasPathSafe(this.userOptions, path); + if (hasUserOptionSimple) + return true; + const pathVertex = this.findVertexAtPath(path); + if (pathVertex) { + if (this.findNeighbour(pathVertex, USER_OPTIONS_EDGE) != null) + return true; + if (this.findNeighbour(pathVertex, USER_PARTIAL_OPTIONS_EDGE) != null) + return true; + const childrenSource = this.findNeighbourValue(pathVertex, CHILDREN_SOURCE_EDGE); + return childrenSource === USER_OPTIONS_EDGE || childrenSource === USER_PARTIAL_OPTIONS_EDGE; + } + return false; + } + /** + * Get the value from the user options at the given path. This method is dangerous since it does not resolve + * through the graph, however is useful for operations that operate on their own path where attempting to + * resolve would cause an infinite loop. + */ + dangerouslyGetUserOption(path) { + if (this.userPartialOptions) { + const value = getPathSafe(this.userPartialOptions, path); + if (value != null) + return value; + } + return getPathSafe(this.userOptions, path); + } + hasThemeOverride(path) { + if (this.overrides == null) + return false; + if (path[0] === "axes" && path.length > 1) { + const axisType = this.getResolvedPath(["axes", path[1], "type"]); + if (hasPathSafe(this.overrides, ["common", "axes", axisType, ...path.slice(2)])) { + return true; + } + const seriesType = this.getResolvedPath(["series", "0", "type"]); + return hasPathSafe(this.overrides, [seriesType, "axes", axisType, ...path.slice(2)]); + } + if (path[0] === "series" && path.length > 1) { + const seriesType = this.getResolvedPath(["series", path[1], "type"]); + return hasPathSafe(this.overrides, [seriesType, "series", ...path.slice(2)]); + } + return hasPathSafe(this.overrides, path); + } + getParamValue(path) { + if (this.resolvedParams[path] != null) { + return this.resolvedParams[path]; + } + const paramVertex = this.findVertexAlongEdge(this.params, [path], PATH_EDGE); + if (!paramVertex) + return; + const defaultValueVertex = this.findNeighbour(paramVertex, DEFAULTS_EDGE); + if (!defaultValueVertex) + return; + const resolved = this.resolveVertexValue(paramVertex, defaultValueVertex); + this.resolvedParams[path] = resolved; + return resolved; + } + getPathArray(vertex) { + return this.findNeighbourValue(vertex, PATH_ARRAY_EDGE) ?? []; + } + getResolvedPath(path) { + return getPathSafe(this.resolved, path); + } + getCachedValue(path, key) { + const cacheKey = [...path, key].join("."); + return _OptionsGraph.valueCache.get(cacheKey); + } + setCachedValue(path, key, value) { + const cacheKey = [...path, key].join("."); + _OptionsGraph.valueCache.set(cacheKey, value); + } + prune(vertex, edges) { + this.addEdge(vertex, this.addVertex(edges), PRUNE_EDGE); + } + resolveVertexValue(vertex, valueVertex) { + this.resolveVertexDependencies(valueVertex); + const operation = this.findNeighbourValue(valueVertex, OPERATION_EDGE); + if (operation && isOperation(operation)) { + const operationValues = this.neighboursWithEdgeValue(valueVertex, OPERATION_VALUE_EDGE); + const operator = operations[operation]; + const operatorFn = typeof operator === "function" ? operator : operator.resolve; + const resolved = operatorFn?.(this, vertex, operationValues ?? []); + return resolved === RESOLVED_TO_BRANCH ? void 0 : resolved; + } + let value = this.getVertexValue(valueVertex); + if (Array.isArray(value)) { + const object2 = {}; + this.resolveVertexChildren(valueVertex, object2); + value = getPathSafe(object2, this.getPathArray(vertex)); + } + return this.resolveValueOrSymbol(value); + } + /** + * Resolve the value currently referenced by `$1` by the nearest self-or-ancestor that has a defined value. + */ + resolveValue$1(pathArray) { + for (let i = pathArray.length; i >= 0; i--) { + const key = pathArray.slice(0, i).join("."); + const resolvedValue = this.value$1.get(key); + if (resolvedValue != void 0) { + return resolvedValue; + } + } + } + /** + * Graft a branch of the theme config onto the target vertex. + */ + graftConfig(target, configPathArray, ignorePaths) { + const targetConfigObject = getPathSafe(this.config, configPathArray); + const targetPathArrayVertex = this.findNeighbour(target, PATH_ARRAY_EDGE); + if (isObject(targetConfigObject)) { + this.buildGraphFromObject( + target, + DEFAULTS_EDGE, + targetConfigObject, + targetPathArrayVertex, + void 0, + ignorePaths + ); + } + if (this.overrides) { + const targetOverridesObject = getPathSafe(this.overrides, configPathArray); + if (isObject(targetOverridesObject)) { + this.buildGraphFromObject( + target, + OVERRIDES_EDGE, + targetOverridesObject, + targetPathArrayVertex, + void 0, + ignorePaths + ); + } + const commonOverridesObject = getPathSafe(this.overrides, ["common", ...configPathArray.slice(1)]); + if (isObject(commonOverridesObject)) { + this.buildGraphFromObject( + target, + OVERRIDES_EDGE, + commonOverridesObject, + targetPathArrayVertex, + void 0, + ignorePaths + ); + } + } + this.buildDependencyGraph(); + } + /** + * Graft a given object onto the target vertex. + */ + graftObject(target, object2, overridesPathArrays, edgeValue = this.graftEdge) { + const pathArrayVertex = this.findNeighbour(target, PATH_ARRAY_EDGE); + this.buildGraphFromObject(target, edgeValue, object2, pathArrayVertex); + if (this.overrides && overridesPathArrays) { + for (const overridePathArray of overridesPathArrays) { + if (overridePathArray == null) + continue; + const overrides = getPathSafe(this.overrides, overridePathArray); + if (overrides) { + this.buildGraphFromObject(target, OVERRIDES_EDGE, overrides, pathArrayVertex); + } + } + } + this.buildDependencyGraph(); + } + /** + * Graft a given operation and value onto `path` child of the target vertex. The `ontoObject` value is built onto + * the graph each time this function is called, at the given path, while `value` is used for value$1 where + * `ontoObject` is an operation that invokes value$1. + */ + graftValue(target, path, ontoObject, value, edgeValue = this.graftEdge) { + const pathArray = [...this.getPathArray(target), path]; + this.value$1.set(pathArray.join("."), value); + const pathVertex = this.findVertexAtPath(pathArray) ?? this.addVertex(path); + this.buildGraphFromValue(target, pathVertex, edgeValue, pathArray, ontoObject); + this.buildDependencyGraph(); + } + /** + * Resolve a branch as if it were a child of the context vertex, but without attaching it to the resolved root. + */ + graftAndResolveOrphan(context, branch) { + const orphan = {}; + const orphanVertex = this.addVertex(orphan); + const contextPathArray = this.getPathArray(context); + this.graftAndResolveChildren(branch, orphanVertex, contextPathArray, []); + this.resolveVertex(orphanVertex, orphan); + return getPathSafe(orphan, contextPathArray); + } + buildGraphFromObject(parentVertex, edgeValue, object2, pathArrayVertex, shallowPaths = _OptionsGraph.SHALLOW_KEYS, ignorePaths) { + const keys = Object.keys(object2); + const operation = getOperation(object2, keys); + if (operation) { + const valueVertex = this.addVertex(object2); + this.addEdge(parentVertex, valueVertex, edgeValue); + this.buildGraphFromOperation(valueVertex, edgeValue, operation, pathArrayVertex); + return; + } + if (keys.length === 0) { + this.addEdge(parentVertex, this.addVertex(Array.isArray(object2) ? [] : {}), edgeValue); + this.buildGraphAutoEnable(parentVertex, edgeValue, object2, void 0); + return; + } + const pathVertices = this.getVertexChildrenByKey(parentVertex); + const pathArray = pathArrayVertex ? this.getVertexValue(pathArrayVertex) : []; + let enabledVertex; + if (Array.isArray(object2)) { + this.addEdge(parentVertex, this.addVertex(edgeValue), CHILDREN_SOURCE_EDGE); + } + const childPathArray = [...pathArray]; + const pathArrayLength = pathArray.length; + for (const key of keys) { + if (ignorePaths?.has(key)) + continue; + const childPathVertex = pathVertices?.get(key) ?? this.addVertex(key); + childPathArray[pathArrayLength] = key; + if (shallowPaths?.has(key)) { + this.buildShallowGraphFromValue(parentVertex, childPathVertex, edgeValue, childPathArray, object2[key]); + } else { + this.buildGraphFromValue( + parentVertex, + childPathVertex, + edgeValue, + childPathArray, + object2[key], + shallowPaths + ); + } + if (key === "enabled") { + enabledVertex = childPathVertex; + } + } + this.buildGraphAutoEnable(parentVertex, edgeValue, object2, enabledVertex); + } + buildGraphAutoEnable(parentVertex, edgeValue, object2, enabledVertex) { + if (edgeValue === DEFAULTS_EDGE && !enabledVertex) + return; + if (edgeValue === USER_OPTIONS_EDGE && enabledVertex) + return; + if (edgeValue !== DEFAULTS_EDGE && edgeValue !== USER_OPTIONS_EDGE && edgeValue !== USER_PARTIAL_OPTIONS_EDGE && edgeValue !== OVERRIDES_EDGE) + return; + let autoEnableVertex = this.findNeighbour(parentVertex, AUTO_ENABLE_EDGE); + if (!autoEnableVertex) { + autoEnableVertex = this.addVertex(AUTO_ENABLE_EDGE); + this.addEdge(parentVertex, autoEnableVertex, AUTO_ENABLE_EDGE); + } + if (enabledVertex) { + this.addEdge(enabledVertex, autoEnableVertex, AUTO_ENABLE_VALUE_EDGE); + } + const { enabled, _enabledFromTheme } = object2; + this.addEdge( + autoEnableVertex, + this.addVertex({ enabled, _enabledFromTheme, keys: Object.keys(object2).length }), + edgeValue + ); + } + getVertexChildrenByKey(vertex) { + const pathNeighbours = this.neighboursWithEdgeValue(vertex, PATH_EDGE); + if (!pathNeighbours) + return; + const pathVertices = /* @__PURE__ */ new Map(); + for (const neighbour of pathNeighbours) { + pathVertices.set(this.getVertexValue(neighbour), neighbour); + } + return pathVertices; + } + buildGraphFromValue(parentVertex, pathVertex, edgeValue, pathArray, value, shallowPaths) { + this.addEdge(parentVertex, pathVertex, PATH_EDGE); + let pathArrayVertex = this.findNeighbour(pathVertex, PATH_ARRAY_EDGE); + if (!pathArrayVertex) { + pathArrayVertex = this.addVertex([...pathArray]); + this.addEdge(pathVertex, pathArrayVertex, PATH_ARRAY_EDGE); + } + const operation = getOperation(value); + if (operation) { + const valueVertex = this.addVertex(value); + this.addEdge(pathVertex, valueVertex, edgeValue); + this.addEdge(valueVertex, pathArrayVertex, PATH_ARRAY_EDGE); + this.buildGraphFromOperation(valueVertex, edgeValue, operation, pathArrayVertex); + } else if (isObjectLike(value)) { + this.buildGraphFromObject(pathVertex, edgeValue, value, pathArrayVertex, shallowPaths); + } else { + const neighbour = this.findNeighbour(pathVertex, edgeValue); + if (neighbour && this.getVertexValue(neighbour) === value) { + return; + } + const valueVertex = this.addVertex(value); + this.addEdge(pathVertex, valueVertex, edgeValue); + } + } + buildShallowGraphFromValue(parentVertex, pathVertex, edgeValue, pathArray, value) { + this.addEdge(parentVertex, pathVertex, PATH_EDGE); + let pathArrayVertex = this.findNeighbour(pathVertex, PATH_ARRAY_EDGE); + if (!pathArrayVertex) { + pathArrayVertex = this.addVertex([...pathArray]); + this.addEdge(pathVertex, pathArrayVertex, PATH_ARRAY_EDGE); + } + const valueVertex = this.addVertex(value); + this.addEdge(pathVertex, valueVertex, edgeValue); + } + buildGraphFromOperation(valueVertex, edgeValue, operation, pathArrayVertex) { + const operationVertex = this.addVertex(operation.operation); + this.addEdge(valueVertex, operationVertex, OPERATION_EDGE); + for (const operationValue of operation.values) { + this.buildGraphFromOperationValue(valueVertex, operationValue, edgeValue, pathArrayVertex); + } + } + buildGraphFromOperationValue(valueVertex, operationValue, edgeValue, pathArrayVertex = this.EMPTY_PATH_ARRAY_VERTEX) { + const operationValueVertex = this.addVertex(operationValue); + this.addEdge(valueVertex, pathArrayVertex, PATH_ARRAY_EDGE); + this.addEdge(valueVertex, operationValueVertex, OPERATION_VALUE_EDGE); + const innerOperation = getOperation(operationValue); + if (innerOperation) { + this.buildGraphFromOperation(operationValueVertex, edgeValue, innerOperation, pathArrayVertex); + } else if (isObjectLike(operationValue)) { + this.buildGraphFromObject(operationValueVertex, edgeValue, operationValue, pathArrayVertex); + } + } + /** + * Add dependency edges on operations that require other vertices to be resolved before the operation can be + * resolved. Then clear the list of pending edges. + */ + buildDependencyGraph() { + for (let i = 0; i < this.pendingProcessingEdgesFrom.length; i++) { + const valueVertex = this.pendingProcessingEdgesFrom[i]; + const operationKeyVertex = this.pendingProcessingEdgesTo[i]; + const operation = this.getVertexValue(operationKeyVertex); + if (!isOperation(operation)) + continue; + const operationValues = this.neighboursWithEdgeValue(valueVertex, OPERATION_VALUE_EDGE); + const operator = operations[operation]; + const dependenciesFn = typeof operator === "function" ? void 0 : operator.dependencies; + dependenciesFn?.(this, valueVertex, operationValues ?? []); + } + this.pendingProcessingEdgesFrom = []; + this.pendingProcessingEdgesTo = []; + } + /** + * Within the branch starting at the given vertex, reassign any value vertices and their operation key vertices to + * the pending processing edges. These can then be built with `this.buildDependencyGraph()`. + */ + refreshPendingProcessingEdges(vertex) { + const defaultValueVertex = this.findNeighbour(vertex, DEFAULTS_EDGE); + const valueVertex = defaultValueVertex ?? vertex; + const operationVertex = this.findNeighbour(valueVertex, OPERATION_EDGE); + if (operationVertex) { + this.pendingProcessingEdgesFrom.push(valueVertex); + this.pendingProcessingEdgesTo.push(operationVertex); + const neighbours2 = this.neighboursWithEdgeValue(valueVertex, OPERATION_VALUE_EDGE); + if (neighbours2) { + for (const neighbour of neighbours2) { + this.refreshPendingProcessingEdges(neighbour); + } + } + } + const neighbours = this.neighboursWithEdgeValue(vertex, PATH_EDGE); + if (neighbours) { + for (const neighbour of neighbours) { + this.refreshPendingProcessingEdges(neighbour); + } + } + } + resolveVertex(vertex, object2 = this.resolved, prune) { + const pathArray = this.getPathArray(vertex); + this.resolveVertexInEdgePriority(vertex, object2, pathArray, prune); + this.resolveVertexAutoEnable(vertex, object2, pathArray); + this.resolveVertexChildren(vertex, object2, prune); + } + resolveVertexInEdgePriority(vertex, object2, pathArray, prune) { + const children = this.neighboursWithEdgeValue(vertex, PATH_EDGE); + const [highestPriority] = this.edgePriority; + for (const edgeValue of this.edgePriority) { + const valueVertex = this.findNeighbour(vertex, edgeValue); + if (valueVertex == null) + continue; + const value = this.resolveVertexValueInternal(vertex, valueVertex); + if (value == null && edgeValue !== highestPriority) + continue; + if (children && children.length > 0 && edgeValue !== highestPriority) + continue; + if (Array.isArray(prune) && prune.includes(edgeValue)) + continue; + this.hasUnsafeClearKeys || (this.hasUnsafeClearKeys = value != null && _OptionsGraph.UNSAFE_CLEAR_KEYS.has(pathArray.at(-1))); + if (pathArray.length === 0) { + if (value == null) + continue; + this.resolved = value; + } else { + setPathSafe(object2, pathArray, value); + } + break; + } + } + resolveVertexValueInternal(vertex, valueVertex) { + this.resolveVertexDependencies(valueVertex); + const operation = this.findNeighbourValue(valueVertex, OPERATION_EDGE); + if (operation && isOperation(operation)) { + const operationValues = this.neighboursWithEdgeValue(valueVertex, OPERATION_VALUE_EDGE); + const operator = operations[operation]; + const operatorFn = typeof operator === "function" ? operator : operator.resolve; + const resolved = operatorFn?.(this, vertex, operationValues ?? []); + return resolved === RESOLVED_TO_BRANCH ? void 0 : resolved; + } + return this.resolveValueOrSymbol(this.getVertexValue(valueVertex)); + } + resolveVertexAutoEnable(vertex, object2, pathArray) { + const autoEnableValueVertex = this.neighboursWithEdgeValue(vertex, AUTO_ENABLE_VALUE_EDGE)?.[0]; + if (!autoEnableValueVertex) + return; + const pathVertex = this.findVertexAtPath(pathArray); + const defaultsEnabled = this.findNeighbourValue(autoEnableValueVertex, DEFAULTS_EDGE); + const overridesEnabled = this.findNeighbourValue(autoEnableValueVertex, OVERRIDES_EDGE); + const userOptionsEnabled = this.findNeighbourValue(autoEnableValueVertex, USER_OPTIONS_EDGE); + const hasUserOptionEnabled = pathVertex && this.findNeighbour(pathVertex, USER_OPTIONS_EDGE) != null; + const userPartialOptionsEnabled = hasUserOptionEnabled ? void 0 : this.findNeighbourValue(autoEnableValueVertex, USER_PARTIAL_OPTIONS_EDGE); + const isUserEnabled = userOptionsEnabled != null && userOptionsEnabled.enabled == null || userPartialOptionsEnabled != null && userPartialOptionsEnabled.enabled == null; + if (isUserEnabled && !defaultsEnabled?._enabledFromTheme && !overridesEnabled?._enabledFromTheme) { + setPathSafe(object2, pathArray, true); + } + } + resolveVertexChildren(vertex, object2, prune) { + const children = this.neighboursWithEdgeValue(vertex, PATH_EDGE); + if (!children) + return; + prune ?? (prune = this.findNeighbourValue(vertex, PRUNE_EDGE)); + for (const child of children) { + const path = this.getVertexValue(child); + if (children.length > 1 && isOperation(path)) + continue; + if (path === "_enabledFromTheme") + continue; + this.resolveVertex(child, object2, prune); + } + } + resolveVertexDependencies(vertex) { + const dependencies = this.neighboursWithEdgeValue(vertex, DEPENDENCY_EDGE); + if (!dependencies) + return; + for (const dependency of dependencies) { + this.resolveVertex(dependency); + } + } + graftAndResolveChildren(remoteBranch, orphanBranch, contextPathArray, orphanPathArray) { + const remoteChildren = this.neighboursWithEdgeValue(remoteBranch, PATH_EDGE); + if (!remoteChildren) + return; + for (const remoteChild of remoteChildren) { + const remoteChildPath = this.getVertexValue(remoteChild); + const childContextPathArray = [...contextPathArray, remoteChildPath]; + const childOrphanPathArray = [...orphanPathArray, remoteChildPath]; + const orphanChildPathVertex = this.addVertex(remoteChildPath); + const defaultValue = this.findNeighbourValue(remoteChild, DEFAULTS_EDGE); + this.addEdge(orphanBranch, orphanChildPathVertex, PATH_EDGE); + const orphanChildPathArrayVertex = this.addVertex(childContextPathArray); + this.addEdge(orphanChildPathVertex, orphanChildPathArrayVertex, PATH_ARRAY_EDGE); + if (isObject(defaultValue)) { + this.buildGraphFromObject( + orphanChildPathVertex, + DEFAULTS_EDGE, + defaultValue, + orphanChildPathArrayVertex + ); + const orphanChildValueVertex = this.findNeighbour(orphanChildPathVertex, DEFAULTS_EDGE); + this.addEdge(orphanChildValueVertex, this.addVertex(childContextPathArray), PATH_ARRAY_EDGE); + const operation = this.findNeighbourValue(orphanChildValueVertex, OPERATION_EDGE); + if (isOperation(operation)) { + const operationValues = this.neighboursWithEdgeValue(orphanChildValueVertex, OPERATION_VALUE_EDGE); + const operator = operations[operation]; + const dependenciesFn = typeof operator === "function" ? void 0 : operator.dependencies; + dependenciesFn?.(this, orphanChildValueVertex, operationValues ?? []); + } + } + this.graftAndResolveChildren( + remoteChild, + orphanChildPathVertex, + childContextPathArray, + childOrphanPathArray + ); + } + } + resolveValueOrSymbol(value) { + return typeof value === "symbol" && this.internalParams?.has(value) ? this.internalParams.get(value) : value; + } + snapshot() { + debug2(`snapshot`); + this.isRollingBack = true; + } + rollback() { + debug2(`rollback ${this.rollbackEdgesFrom.length} edges and ${this.rollbackVertices.length} vertices`); + for (let i = 0; i < this.rollbackEdgesFrom.length; i++) { + const from3 = this.rollbackEdgesFrom[i]; + const to = this.rollbackEdgesTo[i]; + const edgeValue = this.rollbackEdgesValue[i]; + this.removeEdge(from3, to, edgeValue); + } + for (const vertex of this.rollbackVertices) { + this.removeVertex(vertex); + } + this.cachedPathVertices.clear(); + this.rollbackVertices = []; + this.rollbackEdgesFrom = []; + this.rollbackEdgesTo = []; + this.rollbackEdgesValue = []; + this.isRollingBack = false; + } +}; +// The default priority order in which to resolve options values. +_OptionsGraph.EDGE_PRIORITY = [USER_OPTIONS_EDGE, OVERRIDES_EDGE, DEFAULTS_EDGE]; +_OptionsGraph.GRAFT_EDGE = DEFAULTS_EDGE; +// These keys must be stored as shallow objects in the graph and not manipulated. +_OptionsGraph.SHALLOW_KEYS = /* @__PURE__ */ new Set(["context", "data", "topology"]); +// These keys must be excluded when building the graph, they are instead resolved separately since they are objects +// that must be applied to arrays. +_OptionsGraph.COMPLEX_KEYS = ["annotations", "axes", "series"]; +_OptionsGraph.ANNOTATIONS_OPTIONS_KEYS = [ + "axesButtons", + "data", + "enabled", + "optionsToolbar", + "snap", + "toolbar", + "xKey", + "volumeKey" +]; +// If any of these keys are present in the resolved object then calling `clearSafe()` will not clear the graph. +_OptionsGraph.UNSAFE_CLEAR_KEYS = /* @__PURE__ */ new Set(["itemStyler", "styler"]); +// A cache of values that persists between chart updates, use sparingly. +_OptionsGraph.valueCache = /* @__PURE__ */ new Map(); +var OptionsGraph = _OptionsGraph; + +// packages/ag-charts-community/src/module/optionsModule.ts +var stringFormat = (value) => `'${value}'`; +var _ChartOptions = class _ChartOptions { + constructor(currentUserOptions, newUserOptions, processedOverrides, specialOverrides, metadata, deltaOptions, stripSymbols = false, apiStartTime) { + this.themeParameters = {}; + this.optionMetadata = metadata ?? {}; + this.processedOverrides = processedOverrides ?? {}; + let baseChartOptions = null; + if (currentUserOptions instanceof _ChartOptions) { + baseChartOptions = currentUserOptions; + this.specialOverrides = baseChartOptions.specialOverrides; + if (deltaOptions === void 0) { + deltaOptions = jsonDiff( + baseChartOptions.userOptions, + newUserOptions, + _ChartOptions.JSON_DIFF_OPTS + ); + } + this.userOptions = deepClone(merge(deltaOptions, baseChartOptions.userOptions), { + ..._ChartOptions.OPTIONS_CLONE_OPTS_SLOW, + seen: [] + }); + } else { + this.userOptions = deepClone(currentUserOptions ?? newUserOptions, { + ..._ChartOptions.OPTIONS_CLONE_OPTS_SLOW, + seen: [] + }); + this.specialOverrides = this.specialOverridesDefaults({ ...specialOverrides }); + } + if (stripSymbols) { + this.removeLeftoverSymbols(this.userOptions); + } + const dataChangedLength = currentUserOptions instanceof _ChartOptions && deltaOptions?.data !== void 0 && deltaOptions?.data?.length !== currentUserOptions.userOptions.data?.length; + let activeTheme, processedOptions, fastDelta, themeParameters, annotationThemes, googleFonts, optionsGraph; + if (!stripSymbols && deltaOptions !== void 0 && _ChartOptions.isFastPathDelta(deltaOptions) && baseChartOptions != null && !dataChangedLength) { + ({ activeTheme, processedOptions, fastDelta } = this.fastSetup(deltaOptions, baseChartOptions)); + themeParameters = baseChartOptions.themeParameters; + annotationThemes = baseChartOptions.annotationThemes; + } else { + _ChartOptions.perfDebug(`ChartOptions.slowSetup()`); + ({ activeTheme, processedOptions, themeParameters, annotationThemes, googleFonts, optionsGraph } = this.slowSetup(processedOverrides, deltaOptions, stripSymbols)); + } + this.activeTheme = activeTheme; + this.processedOptions = processedOptions; + this.fastDelta = fastDelta ?? void 0; + this.themeParameters = themeParameters; + this.annotationThemes = annotationThemes; + this.googleFonts = googleFonts; + this.optionsGraph = optionsGraph; + if (apiStartTime !== void 0 && typeof apiStartTime === "number" && !Number.isNaN(apiStartTime)) { + const endTime = performance.now(); + this.optionsProcessingTime = endTime - apiStartTime; + } + Debug.inDevelopmentMode(() => deepFreeze(this)); + } + static isFastPathDelta(deltaOptions) { + for (const key of Object.keys(deltaOptions ?? {})) { + if (!this.FAST_PATH_OPTIONS.has(key)) { + _ChartOptions.perfDebug("ChartOptions.isFastPathDelta() - slow path required due to presence of: ", key); + return false; + } + } + _ChartOptions.perfDebug(`ChartOptions.isFastPathDelta() - fast path possible.`); + return true; + } + fastSetup(deltaOptions, baseChartOptions) { + const { activeTheme, processedOptions: baseOptions } = baseChartOptions; + const { presetType } = this.optionMetadata; + if (presetType != null && deltaOptions?.data != null) { + const presetDef = moduleRegistry_exports.getPresetModule(presetType); + if (presetDef?.processData) { + const { series, data } = presetDef.processData(deltaOptions.data); + deltaOptions = mergeDefaults({ series, data }, deltaOptions); + } + } + this.fastSeriesSetup(deltaOptions, baseOptions); + const processedOptions = mergeDefaults(deltaOptions, baseOptions); + _ChartOptions.debug("ChartOptions.fastSetup() - processed options", processedOptions); + return { activeTheme, processedOptions, fastDelta: deltaOptions }; + } + fastSeriesSetup(deltaOptions, baseOptions) { + if (!deltaOptions?.series) + return; + if (deltaOptions.series?.every((s, i) => jsonPropertyCompare(s, baseOptions.series?.[i] ?? {}))) { + delete deltaOptions["series"]; + } else { + deltaOptions.series = deltaOptions.series.map((s, i) => { + return merge(s, baseOptions.series?.[i] ?? {}); + }); + } + } + slowSetup(processedOverrides, deltaOptions, stripSymbols = false) { + let options = deepClone(this.userOptions, _ChartOptions.OPTIONS_CLONE_OPTS_FAST); + if (deltaOptions) { + options = mergeDefaults(deltaOptions, options); + if (stripSymbols) { + this.removeLeftoverSymbols(options); + } + } + const { presetType } = this.optionMetadata; + if (presetType != null) { + const presetDef = moduleRegistry_exports.getPresetModule(presetType); + if (presetDef) { + const { validate: validatePreset = validate } = presetDef; + const presetParams = options; + const presetSubType = options.type; + const presetTheme = presetSubType == null ? void 0 : getChartTheme(options.theme).presets[presetSubType]; + const { cleared, invalid } = validatePreset(presetParams, presetDef.options, ""); + for (const error2 of invalid) { + logger_exports.warn(error2); + } + if (hasRequiredInPath(invalid, "")) { + options = {}; + } else { + _ChartOptions.debug(">>> AgCharts.createOrUpdate() - applying preset", cleared); + options = presetDef.create(cleared, presetTheme, () => this.activeTheme); + } + } + } + this.soloSeriesIntegrity(options); + if (!enterpriseModule.isEnterprise) { + removeUsedEnterpriseOptions(options); + } + const activeTheme = getChartTheme(options.theme); + if (presetType != null) { + activeTheme.templateTheme(options, false); + } + this.validateSeriesOptions(options); + this.chartDef = moduleRegistry_exports.detectChartDefinition(options); + if (!this.chartDef.placeholder) { + const { validate: validateChart = validate } = this.chartDef; + const { cleared, invalid } = validateChart(options, this.chartDef.options, ""); + for (const error2 of invalid) { + logger_exports.warn(error2); + } + options = cleared; + } + this.validateAxesOptions(options); + this.removeDisabledOptions(options); + let googleFonts = this.processFonts(activeTheme.params); + googleFonts = this.processFonts(options, googleFonts); + this.processSeriesOptions(options); + const optionsGraph = createOptionsGraph(activeTheme, options); + const resolvedOptions = optionsGraph.resolve(); + const themeParameters = optionsGraph.resolveParams(); + const annotationThemes = optionsGraph.resolveAnnotationThemes(); + optionsGraph.clearSafe(); + const processedOptions = mergeDefaults(processedOverrides, resolvedOptions); + removeUnusedEnterpriseOptions(processedOptions); + if (!enterpriseModule.isEnterprise) { + removeUsedEnterpriseOptions(processedOptions, true); + } + this.validateSeriesOptions(processedOptions); + this.validateAxesOptions(processedOptions); + this.validatePluginOptions(processedOptions); + this.processMiniChartSeriesOptions(processedOptions); + if (!processedOptions.loadGoogleFonts) { + googleFonts.clear(); + } + _ChartOptions.debug(() => ["ChartOptions.slowSetup() - processed options", deepClone(processedOptions)]); + return { activeTheme, processedOptions, themeParameters, annotationThemes, googleFonts, optionsGraph }; + } + validatePluginOptions(options) { + for (const pluginDef of moduleRegistry_exports.listModulesByType("plugin" /* Plugin */)) { + const pluginKey = pluginDef.name; + if (pluginKey in options && (!pluginDef.chartType || pluginDef.chartType === this.chartDef?.name)) { + const { cleared, invalid } = validate(options[pluginKey], pluginDef.options, pluginDef.name); + for (const error2 of invalid) { + logger_exports.warn(error2); + } + options[pluginKey] = cleared; + } + } + } + validateSeriesOptions(options) { + const chartType = this.chartDef?.name; + const validatedSeriesOptions = []; + const seriesCount = options.series?.length ?? 0; + let validSeriesTypes; + for (let index = 0; index < seriesCount; index++) { + const keyPath = `series[${index}]`; + const seriesOptions = options.series[index]; + const seriesDef = moduleRegistry_exports.getSeriesModule(seriesOptions.type); + if (seriesDef == null) { + validSeriesTypes ?? (validSeriesTypes = joinFormatted( + Array.from(moduleRegistry_exports.listModulesByType("series" /* Series */)).filter((def) => !chartType || def.chartType === chartType).map((def) => def.name), + "or", + stringFormat + )); + logger_exports.warn( + seriesOptions.type == null ? `Option \`${keyPath}.type\` is required and has not been provided; expecting ${validSeriesTypes}, ignoring.` : `Unknown type \`${seriesOptions.type}\` at \`${keyPath}.type\`; expecting ${validSeriesTypes}, ignoring.` + ); + continue; + } else if (chartType && seriesDef.chartType !== chartType) { + logger_exports.warn( + `Series type \`${seriesDef.name}\` at \`${keyPath}.type\` is not supported by chart type \`${chartType}\`, ignoring.` + ); + continue; + } + const { validate: validateSeries = validate } = seriesDef; + const { cleared, invalid } = validateSeries(seriesOptions, seriesDef.options, keyPath); + for (const error2 of invalid) { + logger_exports.warn(error2); + } + if (!hasRequiredInPath(invalid, keyPath)) { + validatedSeriesOptions.push(cleared); + } + } + options.series = validatedSeriesOptions; + } + validateAxesOptions(options) { + if (!("axes" in options) || !options.axes) + return; + const chartType = this.chartDef?.name; + const validatedAxesOptions = []; + const axesCount = options.axes.length ?? 0; + let validAxesTypes; + for (let index = 0; index < axesCount; index++) { + const keyPath = `axes[${index}]`; + const axisOptions = options.axes[index]; + const axisDef = moduleRegistry_exports.getAxisModule(axisOptions.type); + if (axisDef == null) { + validAxesTypes ?? (validAxesTypes = joinFormatted( + Array.from(moduleRegistry_exports.listModulesByType("axis" /* Axis */)).filter((def) => def.chartType === chartType).map((def) => def.name), + "or", + stringFormat + )); + logger_exports.warn( + `Unknown type \`${axisOptions.type}\` at \`${keyPath}.type\`; expecting one of ${validAxesTypes}, ignoring all axes options.` + ); + delete options.axes; + break; + } else if (axisDef.chartType !== chartType) { + logger_exports.warn( + `Axis type \`${axisDef.name}\` at \`${keyPath}.type\` is not supported by chart type \`${chartType}\`, ignoring.` + ); + break; + } + const { validate: validateAxis = validate } = axisDef; + const { cleared, invalid } = validateAxis(axisOptions, axisDef.options, keyPath); + for (const error2 of invalid) { + logger_exports.warn(error2); + } + if (!hasRequiredInPath(invalid, keyPath)) { + validatedAxesOptions.push(cleared); + } + } + options.axes = validatedAxesOptions; + } + diffOptions(other) { + if (this === other) + return {}; + if (other == null) + return this.processedOptions; + return this.fastDelta ?? jsonDiff(other.processedOptions, this.processedOptions, _ChartOptions.JSON_DIFF_OPTS); + } + optionsType(options) { + return options.series?.[0]?.type ?? "line"; + } + processSeriesOptions(options) { + const processedSeries = options.series?.map((series) => { + series.type ?? (series.type = "line"); + const seriesDef = moduleRegistry_exports.getSeriesModule(series.type); + const visibleDefined = Boolean(seriesDef?.options.visible); + const seriesOptions = mergeDefaults( + this.getSeriesGroupingOptions(series), + series, + visibleDefined && { visible: true } + ); + return seriesOptions; + }); + options.series = this.setSeriesGroupingOptions(processedSeries ?? []); + } + processMiniChartSeriesOptions(options) { + const miniChartSeries = options.navigator?.miniChart?.series; + if (miniChartSeries == null) + return; + options.navigator.miniChart.series = this.setSeriesGroupingOptions( + miniChartSeries + ); + } + getSeriesGroupingOptions(series) { + const groupable = seriesRegistry.isGroupable(series.type); + const stackable = seriesRegistry.isStackable(series.type); + const stackedByDefault = seriesRegistry.isStackedByDefault(series.type); + if (series.grouped && !groupable) { + logger_exports.warnOnce(`unsupported grouping of series type "${series.type}".`); + } + if ((series.stacked || series.stackGroup) && !stackable) { + logger_exports.warnOnce(`unsupported stacking of series type "${series.type}".`); + } + let { grouped, stacked } = series; + stacked ?? (stacked = (stackedByDefault || series.stackGroup != null) && !(groupable && grouped)); + grouped ?? (grouped = true); + return { + stacked: stackable && stacked, + grouped: groupable && grouped && !(stackable && stacked) + }; + } + setSeriesGroupingOptions(allSeries) { + const seriesGroups = this.getSeriesGrouping(allSeries); + _ChartOptions.debug("ChartOptions.setSeriesGroupingOptions() - series grouping: ", seriesGroups); + const groupIdx = {}; + const groupCount2 = seriesGroups.reduce((countMap, seriesGroup) => { + var _a; + if (seriesGroup.groupType === "default" /* DEFAULT */) { + return countMap; + } + countMap[_a = seriesGroup.seriesType] ?? (countMap[_a] = 0); + countMap[seriesGroup.seriesType] += seriesGroup.groupType === "stack" /* STACK */ ? 1 : seriesGroup.series.length; + return countMap; + }, {}); + return seriesGroups.flatMap((seriesGroup) => { + var _a; + groupIdx[_a = seriesGroup.seriesType] ?? (groupIdx[_a] = 0); + switch (seriesGroup.groupType) { + case "stack" /* STACK */: { + const groupIndex = groupIdx[seriesGroup.seriesType]++; + return seriesGroup.series.map( + (series, stackIndex) => Object.assign(series, { + seriesGrouping: { + groupId: seriesGroup.groupId, + groupIndex, + groupCount: groupCount2[seriesGroup.seriesType], + stackIndex, + stackCount: seriesGroup.series.length + } + }) + ); + } + case "group" /* GROUP */: + return seriesGroup.series.map( + (series) => Object.assign(series, { + seriesGrouping: { + groupId: seriesGroup.groupId, + groupIndex: groupIdx[seriesGroup.seriesType]++, + groupCount: groupCount2[seriesGroup.seriesType], + stackIndex: 0, + stackCount: 0 + } + }) + ); + } + return seriesGroup.series; + }).map(({ stacked: _, grouped: __, ...seriesOptions }) => seriesOptions); + } + getSeriesGroupId(series) { + return [series.type, series.xKey, series.stacked ? series.stackGroup ?? "stacked" : "grouped"].filter(Boolean).join("-"); + } + getSeriesGrouping(allSeries) { + const groupMap = /* @__PURE__ */ new Map(); + return allSeries.reduce((result, series) => { + const seriesType = series.type; + if (!series.stacked && !series.grouped) { + result.push({ groupType: "default" /* DEFAULT */, seriesType, series: [series], groupId: "__default__" }); + } else { + const groupId = this.getSeriesGroupId(series); + if (!groupMap.has(groupId)) { + const groupType = series.stacked ? "stack" /* STACK */ : "group" /* GROUP */; + const record = { groupType, seriesType, series: [], groupId }; + groupMap.set(groupId, record); + result.push(record); + } + groupMap.get(groupId).series.push(series); + } + return result; + }, []); + } + soloSeriesIntegrity(options) { + if (!isArray(options.series)) + return; + const allSeries = options.series; + if (allSeries && allSeries.length > 1 && allSeries.some((series) => seriesRegistry.isSolo(series.type))) { + const mainSeriesType = this.optionsType(options); + if (seriesRegistry.isSolo(mainSeriesType)) { + logger_exports.warn( + `series[0] of type '${mainSeriesType}' is incompatible with other series types. Only processing series[0]` + ); + options.series = allSeries.slice(0, 1); + } else { + const { solo, nonSolo } = groupBy( + allSeries, + (s) => seriesRegistry.isSolo(s.type) ? "solo" : "nonSolo" + ); + const rejects = unique(solo.map((s) => s.type)).join(", "); + logger_exports.warn(`Unable to mix these series types with the lead series type: ${rejects}`); + options.series = nonSolo; + } + } + } + static processFontOptions(node, _, __, googleFonts = /* @__PURE__ */ new Set()) { + if (typeof node === "object" && "fontFamily" in node) { + if (Array.isArray(node.fontFamily)) { + const fontFamily = []; + for (const font3 of node.fontFamily) { + if (typeof font3 === "object" && "googleFont" in font3) { + fontFamily.push(font3.googleFont); + googleFonts?.add(font3.googleFont); + } else { + fontFamily.push(font3); + } + } + node.fontFamily = fontFamily.join(", "); + } else if (typeof node.fontFamily === "object" && "googleFont" in node.fontFamily) { + node.fontFamily = node.fontFamily.googleFont; + googleFonts?.add(node.fontFamily); + } + } + return googleFonts; + } + processFonts(options, googleFonts = /* @__PURE__ */ new Set()) { + return jsonWalk( + options, + _ChartOptions.processFontOptions, + /* @__PURE__ */ new Set(["data", "theme"]), + void 0, + void 0, + googleFonts + ); + } + static removeDisabledOptionJson(optionsNode) { + if ("enabled" in optionsNode && optionsNode.enabled === false) { + for (const key of Object.keys(optionsNode)) { + if (key === "enabled") + continue; + delete optionsNode[key]; + } + } + } + removeDisabledOptions(options) { + jsonWalk(options, _ChartOptions.removeDisabledOptionJson, /* @__PURE__ */ new Set(["data", "theme", "contextMenu"])); + } + static removeLeftoverSymbolsJson(optionsNode) { + if (!optionsNode || !isObject(optionsNode)) + return; + for (const key of Object.keys(optionsNode)) { + const value = optionsNode[key]; + if (isSymbol(value)) { + delete optionsNode[key]; + } + } + } + removeLeftoverSymbols(options) { + jsonWalk(options, _ChartOptions.removeLeftoverSymbolsJson, /* @__PURE__ */ new Set(["data"])); + } + specialOverridesDefaults(options) { + if (options.window == null) { + options.window = getWindow(); + } else { + setWindow(options.window); + } + if (options.document == null) { + options.document = getDocument(); + } else { + setDocument(options.document); + } + if (options.window == null) { + throw new Error("AG Charts - unable to resolve global window"); + } + if (options.document == null) { + throw new Error("AG Charts - unable to resolve global document"); + } + return options; + } +}; +_ChartOptions.OPTIONS_CLONE_OPTS_SLOW = { + shallow: /* @__PURE__ */ new Set(["data", "container"]), + assign: /* @__PURE__ */ new Set(["context", "theme"]) +}; +_ChartOptions.OPTIONS_CLONE_OPTS_FAST = { + shallow: /* @__PURE__ */ new Set(["container"]), + assign: /* @__PURE__ */ new Set(["data", "context", "theme"]) +}; +_ChartOptions.JSON_DIFF_OPTS = /* @__PURE__ */ new Set(["data"]); +_ChartOptions.perfDebug = Debug.create(true, "perf"); +_ChartOptions.FAST_PATH_OPTIONS = /* @__PURE__ */ new Set(["data", "width", "height", "container"]); +_ChartOptions.debug = Debug.create(true, "opts"); +var ChartOptions = _ChartOptions; + +// packages/ag-charts-community/src/chart/chartProxy.ts +var debug3 = Debug.create(true, "opts"); +var DESTROYED_ERROR = "AG Charts - Chart was destroyed, cannot perform request."; +var _AgChartInstanceProxy = class _AgChartInstanceProxy { + constructor(chart, factoryApi, licenseManager) { + this.factoryApi = factoryApi; + this.licenseManager = licenseManager; + this.chart = chart; + } + async update(options) { + if (!this.chart) + throw new Error(DESTROYED_ERROR); + return debug3.group("AgChartInstance.update()", async () => { + const apiStartTime = Debug.check("scene:stats", "scene:stats:verbose") ? performance.now() : void 0; + this.factoryApi.update(options, this, void 0, apiStartTime); + await this.chart?.waitForUpdate(); + }); + } + async updateDelta(deltaOptions) { + if (!this.chart) + throw new Error(DESTROYED_ERROR); + return debug3.group("AgChartInstance.updateDelta()", async () => { + const apiStartTime = Debug.check("scene:stats", "scene:stats:verbose") ? performance.now() : void 0; + this.factoryApi.updateUserDelta(this, deltaOptions, apiStartTime); + await this.chart?.waitForUpdate(); + }); + } + getOptions() { + if (!this.chart) + throw new Error(DESTROYED_ERROR); + const options = deepClone(this.chart.getOptions(), ChartOptions.OPTIONS_CLONE_OPTS_FAST); + for (const key of Object.keys(options)) { + if (key.startsWith("_")) { + delete options[key]; + } + } + return options; + } + waitForUpdate() { + if (!this.chart) + throw new Error(DESTROYED_ERROR); + return this.chart.waitForUpdate(); + } + async applyTransaction(transaction) { + if (!this.chart) + throw new Error(DESTROYED_ERROR); + if (transaction == null || typeof transaction !== "object") { + throw new Error("AG Charts - applyTransaction expects a transaction object."); + } + const { append, prepend, remove } = transaction; + if (append != null && !Array.isArray(append)) { + throw new Error('AG Charts - transaction "append" must be an array.'); + } + if (prepend != null && !Array.isArray(prepend)) { + throw new Error('AG Charts - transaction "prepend" must be an array.'); + } + if (remove != null && !Array.isArray(remove)) { + throw new Error('AG Charts - transaction "remove" must be an array or single value.'); + } + return this.chart.applyTransaction(transaction); + } + async download(opts) { + if (!this.chart) + throw new Error(DESTROYED_ERROR); + const clone2 = await this.prepareResizedChart(this, this.chart, opts); + try { + clone2.chart?.download(opts?.fileName, opts?.fileFormat); + } finally { + clone2.destroy(); + } + } + async __toSVG(opts) { + if (!this.chart) + throw new Error(DESTROYED_ERROR); + const clone2 = await this.prepareResizedChart(this, this.chart, { width: 600, height: 300, ...opts }); + try { + return clone2?.chart?.toSVG(); + } finally { + clone2?.destroy(); + } + } + async getImageDataURL(opts) { + if (!this.chart) + throw new Error(DESTROYED_ERROR); + const clone2 = await this.prepareResizedChart(this, this.chart, opts); + try { + return clone2.chart.getCanvasDataURL(opts?.fileFormat); + } finally { + clone2.destroy(); + } + } + getState() { + return this.factoryApi.caretaker.save(...this.getEnabledOriginators()); + } + async setState(state) { + const { chart } = this; + if (!chart) + return; + const originators = this.getEnabledOriginators(); + if (!originators.includes(chart.ctx.legendManager)) { + await this.setStateOriginators(state, originators); + return; + } + await this.setStateOriginators( + state, + originators.filter((originator) => originator !== chart.ctx.zoomManager) + ); + await this.setStateOriginators(state, [chart.ctx.zoomManager]); + } + resetAnimations() { + this.chart?.resetAnimations(); + } + skipAnimations() { + this.chart?.skipAnimations(); + } + destroy() { + if (this.releaseChart) { + this.releaseChart(); + this.releaseChart = void 0; + } else if (this.chart) { + this.chart.publicApi = void 0; + this.chart.destroy(); + } + this.chart = void 0; + } + async prepareResizedChart(proxy, chart, opts = {}) { + const width2 = opts.width ?? chart.width ?? chart.ctx.scene.canvas.width; + const height2 = opts.height ?? chart.height ?? chart.ctx.scene.canvas.height; + const state = proxy.getState(); + const isEnterprise = moduleRegistry.hasEnterpriseModules(); + const processedOverrides = { + ...chart.chartOptions.processedOverrides, + container: document.createElement("div"), + width: width2, + height: height2 + }; + if (opts.width != null && opts.height != null) { + processedOverrides.overrideDevicePixelRatio = 1; + } + const userOptions = chart.getOptions(); + if (isEnterprise) { + processedOverrides.animation = { enabled: false }; + if (this.licenseManager?.isDisplayWatermark()) { + processedOverrides.foreground = { + text: this.licenseManager.getWatermarkMessage(), + image: { + url: `data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU4IiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgMjU4IDQwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjUuNzc5IDI4LjY1N0gxMy4zNTlMMTEuMTczIDM0LjAxMkg1LjY3Mjk3TDE3LjE4MiA3LjA1OTk5SDIxLjk1M0wzMy40NjIgMzQuMDEySDI3Ljk2MkwyNS43NzYgMjguNjU3SDI1Ljc3OVpNMjQuMDY4IDI0LjM5N0wxOS41ODggMTMuNDM0TDE1LjEwNyAyNC4zOTdIMjQuMDY4Wk02Mi4wOTIgMTguODIzSDQ5LjgxN1YyMy4wODZINTYuNzc1QzU2LjU1NSAyNS4yMjIgNTUuNzU1IDI2LjkyNyA1NC4zNzIgMjguMjAyQzUyLjk4OSAyOS40NzYgNTEuMTY2IDMwLjExNSA0OC45MDkgMzAuMTE1QzQ3LjYyMiAzMC4xMTUgNDYuNDUgMjkuODg1IDQ1LjM5MyAyOS40MjNDNDQuMzU4MyAyOC45NzgxIDQzLjQzMjYgMjguMzEzOCA0Mi42OCAyNy40NzZDNDEuOTI3IDI2LjYzOSA0MS4zNDQgMjUuNjMxIDQwLjkzMSAyNC40NTNDNDAuNTE5IDIzLjI3NSA0MC4zMTEgMjEuOTcgNDAuMzExIDIwLjUzN0M0MC4zMTEgMTkuMTA1IDQwLjUxNiAxNy44IDQwLjkzMSAxNi42MjFDNDEuMzQ0IDE1LjQ0MyA0MS45MjcgMTQuNDM2IDQyLjY4IDEzLjU5OEM0My40Mzc2IDEyLjc1NzcgNDQuMzY5NiAxMi4wOTMyIDQ1LjQxMSAxMS42NTFDNDYuNDc4IDExLjE4OSA0Ny42NTYgMTAuOTYgNDguOTQ2IDEwLjk2QzUxLjYxMiAxMC45NiA1My42MzcgMTEuNjAyIDU1LjAyIDEyLjg4NUw1OC4zIDkuNjA0OTlDNTUuODE3IDcuNjY5OTkgNTIuNjc2IDYuNjk5OTkgNDguODcyIDYuNjk5OTlDNDYuNzYgNi42OTk5OSA0NC44NTMgNy4wMzQ5OSA0My4xNTQgNy43MDA5OUM0MS40NTUgOC4zNjc5OSAzOS45OTggOS4zMDM5OSAzOC43ODMgMTAuNTA0QzM3LjU2NyAxMS43MDcgMzYuNjM0IDEzLjE1OCAzNS45NzcgMTQuODU3QzM1LjMxOSAxNi41NTYgMzQuOTk0IDE4LjQ1MSAzNC45OTQgMjAuNTRDMzQuOTk0IDIyLjYzIDM1LjMyOSAyNC40OTQgMzUuOTk1IDI2LjIwNUMzNi42NjIgMjcuOTE2IDM3LjYwNSAyOS4zNzQgMzguODE3IDMwLjU3N0M0MC4wMzIgMzEuNzggNDEuNDg2IDMyLjcxMyA0My4xODggMzMuMzgzQzQ0Ljg4OCAzNC4wNDkgNDYuNzgyIDM0LjM4NCA0OC44NzIgMzQuMzg0QzUwLjk2MSAzNC4zODQgNTIuNzUgMzQuMDQ5IDU0LjM5IDMzLjM4M0M1Ni4wMzEgMzIuNzE2IDU3LjQyNiAzMS43OCA1OC41NzkgMzAuNTc3QzU5LjczMyAyOS4zNzQgNjAuNjE5IDI3LjkxNiA2MS4yMzkgMjYuMjA1QzYxLjg2IDI0LjQ5NCA2Mi4xNyAyMi42MDUgNjIuMTcgMjAuNTRDNjIuMTY5NiAxOS45Njg4IDYyLjE0NDUgMTkuMzk4IDYyLjA5NSAxOC44MjlMNjIuMDkyIDE4LjgyM1pNMTUxLjgxIDE2Ljk4MUMxNTMuNDEgMTQuNjA5IDE1Ny40MTkgMTQuMzU4IDE1OS4wMjIgMTQuMzU4VjE4LjkxQzE1Ni45NTcgMTguOTEgMTU0Ljk4NSAxOC45OTYgMTUzLjc1NyAxOS44OTJDMTUyLjUyOSAyMC43OTIgMTUxLjkxOSAyMS45ODIgMTUxLjkxOSAyMy40NjRWMzMuOTlIMTQ2Ljk2NFYxNC4zNThIMTUxLjczNkwxNTEuODEgMTYuOTgxWk0xNDMuMDExIDE0LjM2MVYzNC4wMzFIMTM4LjI0TDEzOC4xMzEgMzEuMDQ1QzEzNy40NjYgMzIuMDc2IDEzNi41NTEgMzIuOTIxOSAxMzUuNDcxIDMzLjUwNEMxMzQuMzc2IDM0LjA5OSAxMzMuMDY4IDM0LjM5NiAxMzEuNTM2IDM0LjM5NkMxMzAuMiAzNC4zOTYgMTI4Ljk2MyAzNC4xNTIgMTI3LjgyMiAzMy42NjhDMTI2LjcgMzMuMTk2NCAxMjUuNjg5IDMyLjQ5NSAxMjQuODU1IDMxLjYwOUMxMjQuMDE4IDMwLjcyMiAxMjMuMzU0IDI5LjY2MiAxMjIuODcxIDI4LjQyMkMxMjIuMzg0IDI3LjE4NSAxMjIuMTQyIDI1LjgxMSAxMjIuMTQyIDI0LjMwNEMxMjIuMTQyIDIyLjc5OCAxMjIuMzg0IDIxLjM3OCAxMjIuODcxIDIwLjExNkMxMjMuMzU3IDE4Ljg1NCAxMjQuMDE4IDE3Ljc3MiAxMjQuODU1IDE2Ljg3M0MxMjUuNjg4IDE1Ljk3NjQgMTI2LjY5OCAxNS4yNjM2IDEyNy44MjIgMTQuNzhDMTI4Ljk2MyAxNC4yODEgMTMwLjIwMyAxNC4wMzMgMTMxLjUzNiAxNC4wMzNDMTMzLjA0MyAxNC4wMzMgMTM0LjMzIDE0LjMxOCAxMzUuMzk3IDE0Ljg4OEMxMzYuNDYyIDE1LjQ1ODkgMTM3LjM3NSAxNi4yNzggMTM4LjA1NyAxNy4yNzZWMTQuMzYxSDE0My4wMTFaTTEzMi42MzEgMzAuMTMzQzEzNC4yNTYgMzAuMTMzIDEzNS41NjcgMjkuNTk0IDEzNi41NjUgMjguNTEyQzEzNy41NjEgMjcuNDMgMTM4LjA2IDI1Ljk5MSAxMzguMDYgMjQuMTk2QzEzOC4wNiAyMi40MDEgMTM3LjU2MSAyMC45OSAxMzYuNTY1IDE5Ljg5OUMxMzUuNTcgMTguODA3IDEzNC4yNTkgMTguMjU4IDEzMi42MzEgMTguMjU4QzEzMS4wMDMgMTguMjU4IDEyOS43MjkgMTguODA0IDEyOC43MzQgMTkuODk5QzEyNy43MzggMjAuOTkzIDEyNy4yMzkgMjIuNDM4IDEyNy4yMzkgMjQuMjMzQzEyNy4yMzkgMjYuMDI4IDEyNy43MzUgMjcuNDMzIDEyOC43MzQgMjguNTE1QzEyOS43MjkgMjkuNTk0IDEzMS4wMjggMzAuMTM2IDEzMi42MzEgMzAuMTM2VjMwLjEzM1pNOTMuNjk4IDI3Ljg3NkM5My41Nzk1IDI4LjAwMjUgOTMuNDU2NCAyOC4xMjQ2IDkzLjMyOSAyOC4yNDJDOTEuOTQ3IDI5LjUxNiA5MC4xMjMgMzAuMTU1IDg3Ljg2NiAzMC4xNTVDODYuNTggMzAuMTU1IDg1LjQwOCAyOS45MjYgODQuMzUgMjkuNDY0QzgzLjMxNTUgMjkuMDE4OSA4Mi4zODk4IDI4LjM1NDYgODEuNjM3IDI3LjUxN0M4MC44ODQgMjYuNjc5IDgwLjMwMSAyNS42NzIgNzkuODg5IDI0LjQ5NEM3OS40NzYgMjMuMzE1IDc5LjI2OSAyMi4wMSA3OS4yNjkgMjAuNTc4Qzc5LjI2OSAxOS4xNDUgNzkuNDczIDE3Ljg0IDc5Ljg4OSAxNi42NjJDODAuMzAxIDE1LjQ4NCA4MC44ODQgMTQuNDc2IDgxLjYzNyAxMy42MzlDODIuMzk0OSAxMi43OTg3IDgzLjMyNzMgMTIuMTM0MiA4NC4zNjkgMTEuNjkyQzg1LjQzNiAxMS4yMyA4Ni42MTQgMTEgODcuOTAzIDExQzkwLjU3IDExIDkyLjU5NSAxMS42NDIgOTMuOTc3IDEyLjkyNkw5Ny4yNTggOS42NDQ5OUM5NC43NzQgNy43MTA5OSA5MS42MzMgNi43Mzk5OSA4Ny44MjkgNi43Mzk5OUM4NS43MTggNi43Mzk5OSA4My44MTEgNy4wNzQ5OSA4Mi4xMTIgNy43NDE5OUM4MC40MTMgOC40MDc5OSA3OC45NTYgOS4zNDQ5OSA3Ny43NCAxMC41NDVDNzYuNTI1IDExLjc0NyA3NS41OTIgMTMuMTk5IDc0LjkzNCAxNC44OThDNzQuMjc3IDE2LjU5NyA3My45NTEgMTguNDkxIDczLjk1MSAyMC41ODFDNzMuOTUxIDIyLjY3IDc0LjI4NiAyNC41MzQgNzQuOTUzIDI2LjI0NUM3NS42MTkgMjcuOTU3IDc2LjU2MiAyOS40MTQgNzcuNzc0IDMwLjYxN0M3OC45OSAzMS44MiA4MC40NDQgMzIuNzUzIDgyLjE0NiAzMy40MjNDODMuODQ1IDM0LjA5IDg1LjczOSAzNC40MjQgODcuODI5IDM0LjQyNEM4OS45MTkgMzQuNDI0IDkxLjcwOCAzNC4wOSA5My4zNDggMzMuNDIzQzk0LjcxOCAzMi44NjUgOTUuOTE4IDMyLjEyMSA5Ni45NDggMzEuMTkxQzk3LjE0OSAzMS4wMDggOTcuMzQ4IDMwLjgxNSA5Ny41MzcgMzAuNjJMOTMuNzAxIDI3Ljg4NUw5My42OTggMjcuODc2Wk0xMTAuODAyIDE0LjAxNUMxMDkuMTk5IDE0LjAxNSAxMDYuODM2IDE0LjQ3MSAxMDUuNjExIDE2LjE1OEwxMDUuNTM3IDYuMDE1OTlIMTAwLjc2NVYzMy45MzlIMTA1LjcyVjIyLjY0MUMxMDUuNzcxIDIxLjQ2MDcgMTA2LjI4OCAyMC4zNDg4IDEwNy4xNTcgMTkuNTQ4OUMxMDguMDI3IDE4Ljc0OTEgMTA5LjE3OCAxOC4zMjY2IDExMC4zNTggMTguMzc0QzExMy4zOTcgMTguMzc0IDExNC4yNjggMjEuMTU5IDExNC4yNjggMjIuNjQxVjMzLjkzOUgxMTkuMjIzVjIxLjA1OUMxMTkuMjIzIDIxLjA1OSAxMTkuMTQyIDE0LjAxNSAxMTAuODAyIDE0LjAxNVpNMTczLjc2MyAxNC4zNThIMTY5Ljk5OVY4LjcxNDk5SDE2NS4wNDhWMTQuMzU4SDE2MS4yODRWMTguOTE2SDE2NS4wNDhWMzQuMDAzSDE2OS45OTlWMTguOTE2SDE3My43NjNWMTQuMzU4Wk0xOTAuNzg3IDI1LjI2MkMxOTAuMTI5IDI0LjUwMTQgMTg5LjMwNyAyMy44OTk0IDE4OC4zODQgMjMuNTAxQzE4Ny40ODggMjMuMTE3IDE4Ni4zMzEgMjIuNzMyIDE4NC45NDggMjIuMzY0QzE4NC4xNjUgMjIuMTQzOSAxODMuMzkgMjEuODk3OCAxODIuNjIzIDIxLjYyNkMxODIuMTYzIDIxLjQ2MjEgMTgxLjc0MSAyMS4yMDY2IDE4MS4zODMgMjAuODc1QzE4MS4yMzUgMjAuNzQyMSAxODEuMTE4IDIwLjU3ODkgMTgxLjAzOSAyMC4zOTY0QzE4MC45NjEgMjAuMjE0IDE4MC45MjIgMjAuMDE2NiAxODAuOTI3IDE5LjgxOEMxODAuOTI3IDE5LjI3MiAxODEuMTU2IDE4Ljg0NCAxODEuNjI1IDE4LjUxQzE4Mi4xMjEgMTguMTU2IDE4Mi44NjIgMTcuOTc2IDE4My44MjYgMTcuOTc2QzE4NC43OSAxNy45NzYgMTg1LjU4NyAxOC4yMDkgMTg2LjE0OCAxOC42NjhDMTg2LjcwNiAxOS4xMjQgMTg3LjAwNyAxOS43MjUgMTg3LjA3MiAyMC41TDE4Ny4wOTQgMjAuNzgySDE5MS42MzNMMTkxLjYxNyAyMC40NkMxOTEuNTIxIDE4LjQ4NSAxOTAuNzcxIDE2LjkgMTg5LjM4NSAxNS43NUMxODguMDEyIDE0LjYxMiAxODYuMTg1IDE0LjAzMyAxODMuOTYyIDE0LjAzM0MxODIuNDc3IDE0LjAzMyAxODEuMTQxIDE0LjI4NyAxNzkuOTk0IDE0Ljc4NkMxNzguODMxIDE1LjI5MSAxNzcuOTI2IDE1Ljk5NSAxNzcuMjk2IDE2Ljg4MkMxNzYuNjczIDE3Ljc0NTUgMTc2LjMzOCAxOC43ODQgMTc2LjM0MSAxOS44NDlDMTc2LjM0MSAyMS4xNjcgMTc2LjY5OCAyMi4yNDkgMTc3LjM5OSAyMy4wNjRDMTc4LjA2IDIzLjg0MzIgMTc4Ljg5OCAyNC40NTM0IDE3OS44NDIgMjQuODQ0QzE4MC43NDQgMjUuMjE2IDE4MS45MjggMjUuNjA3IDE4My4zNjEgMjZDMTg0LjgwNiAyNi40MSAxODUuODcyIDI2Ljc4NSAxODYuNTMgMjcuMTIzQzE4Ny4xIDI3LjQxNCAxODcuMzc5IDI3Ljg0NSAxODcuMzc5IDI4LjQ0NEMxODcuMzc5IDI5LjA0MiAxODcuMTIyIDI5LjQ2NyAxODYuNTk1IDI5LjgzOUMxODYuMDQzIDMwLjIyNiAxODUuMjM3IDMwLjQyNSAxODQuMjAxIDMwLjQyNUMxODMuMTY2IDMwLjQyNSAxODIuMzk0IDMwLjE3NCAxODEuNzQ5IDI5LjY3NEMxODEuMTEzIDI5LjE4MSAxODAuNzcyIDI4LjU4OSAxODAuNzEgMjcuODY0TDE4MC42ODUgMjcuNTgySDE3Ni4wMTNMMTc2LjAyNSAyNy45MDFDMTc2LjA2NyAyOS4wOTU1IDE3Ni40NzIgMzAuMjQ4NyAxNzcuMTg4IDMxLjIwNkMxNzcuOTA3IDMyLjE4IDE3OC44OTMgMzIuOTU4IDE4MC4xMTggMzMuNTE5QzE4MS4zMzYgMzQuMDc3IDE4Mi43MzIgMzQuMzYyIDE4NC4yNjYgMzQuMzYyQzE4NS44MDEgMzQuMzYyIDE4Ny4xMDkgMzQuMTA4IDE4OC4yMzggMzMuNjA5QzE4OS4zNzYgMzMuMTA0IDE5MC4yNzIgMzIuMzk0IDE5MC45MDEgMzEuNDk0QzE5MS41MzQgMzAuNTkyIDE5MS44NTMgMjkuNTU0IDE5MS44NTMgMjguNDAzQzE5MS44MjggMjcuMTEgMTkxLjQ2NiAyNi4wNTMgMTkwLjc3NyAyNS4yNjJIMTkwLjc4N1oiIGZpbGw9IiM5QjlCOUIiLz4KPHBhdGggZD0iTTI0MS45ODIgMjUuNjU4MlYxNy43MTE3SDIyOC40NDFMMjIwLjQ5NCAyNS42NTgySDI0MS45ODJaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNTcuMjM5IDUuOTUwODFIMjQwLjI2NUwyMzIuMjU1IDEzLjg5NzNIMjU3LjIzOVY1Ljk1MDgxWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjEyLjYxMSAzMy42MDQ4TDIxNi42OCAyOS41MzYxSDIzMC40MTJWMzcuNDgyN0gyMTIuNjExVjMzLjYwNDhaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yMTUuNTk5IDIxLjc4MDNIMjI0LjM3MkwyMzIuMzgyIDEzLjgzMzdIMjE1LjU5OVYyMS43ODAzWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjA2IDMzLjYwNDdIMjEyLjYxMUwyMjAuNDk0IDI1LjY1ODJIMjA2VjMzLjYwNDdaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNDAuMjY1IDUuOTUwODFMMjM2LjE5NyAxMC4wMTk0SDIxMC4yNTlWMi4wNzI4OEgyNDAuMjY1VjUuOTUwODFaIiBmaWxsPSIjOUI5QjlCIi8+Cjwvc3ZnPgo=`, + width: 170, + height: 25, + right: 25, + bottom: 50, + opacity: 0.7 + } + }; + } + } + const specialOverrides = { ...chart.chartOptions.specialOverrides }; + const optionsMetadata = { ...chart.chartOptions.optionMetadata }; + const data = await this.chart?.ctx.dataService.getData(); + const cloneProxy = this.factoryApi.create( + userOptions, + processedOverrides, + specialOverrides, + optionsMetadata, + data + ); + await cloneProxy.setState(state); + cloneProxy.chart?.ctx.zoomManager.updateZoom("chartProxy", chart.ctx.zoomManager.getZoom()); + cloneProxy.chart?.ctx.legendManager.clearData(); + cloneProxy.chart?.ctx.legendManager.update(chart.ctx.legendManager.getData()); + for (const [index, series] of chart.series.entries()) { + cloneProxy.chart.series[index].visible = series.visible; + } + const legendPages = []; + for (const legend of chart.modulesManager.legends()) { + legendPages.push(legend.legend.pagination?.currentPage ?? 0); + } + for (const legend of cloneProxy.chart.modulesManager.legends()) { + const page = legendPages.shift() ?? 0; + if (!legend.legend.pagination) + continue; + legend.legend.pagination.setPage(page); + } + cloneProxy.chart?.update(0 /* FULL */, { forceNodeDataRefresh: true }); + await cloneProxy.waitForUpdate(); + return cloneProxy; + } + getEnabledOriginators() { + if (!this.chart) + return []; + const { + chartOptions: { processedOptions, optionMetadata }, + ctx: { annotationManager, chartTypeOriginator, zoomManager, legendManager } + } = this.chart; + const originators = []; + if ("annotations" in processedOptions && processedOptions.annotations?.enabled) { + originators.push(annotationManager); + } + const isFinancialChart = optionMetadata.presetType === "price-volume"; + if (isFinancialChart) { + originators.push(chartTypeOriginator); + } + if (processedOptions.navigator?.enabled || processedOptions.zoom?.enabled) { + originators.push(zoomManager); + } + if ("legend" in this.chart) { + originators.push(legendManager); + } + return originators; + } + async setStateOriginators(state, originators) { + this.factoryApi.caretaker.restore(state, ...originators); + this.chart?.ctx.updateService.update(2 /* PROCESS_DATA */, { forceNodeDataRefresh: true }); + await this.chart?.waitForUpdate(); + } +}; +_AgChartInstanceProxy.chartInstances = /* @__PURE__ */ new WeakMap(); +__decorateClass([ + ActionOnSet({ + oldValue(chart) { + if (!chart.destroyed) { + chart.publicApi = void 0; + } + _AgChartInstanceProxy.chartInstances.delete(chart); + }, + newValue(chart) { + if (!chart) + return; + chart.publicApi = this; + _AgChartInstanceProxy.chartInstances.set(chart, this); + } + }) +], _AgChartInstanceProxy.prototype, "chart", 2); +var AgChartInstanceProxy = _AgChartInstanceProxy; + +// packages/ag-charts-community/src/locale/locale.ts +var Locale = class extends BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.localeText = void 0; + } +}; +__decorateClass([ + ObserveChanges((target) => { + target.ctx.localeManager.setLocaleText(target.localeText); + }), + addFakeTransformToInstanceProperty +], Locale.prototype, "localeText", 2); +__decorateClass([ + ObserveChanges((target) => { + target.ctx.localeManager.setLocaleTextFormatter(target.getLocaleText); + }), + addFakeTransformToInstanceProperty +], Locale.prototype, "getLocaleText", 2); + +// packages/ag-charts-community/src/locale/localeModule.ts +var LocaleModule = { + type: "root", + optionsKey: "locale", + packageType: "community", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Locale(ctx) +}; + +// packages/ag-charts-community/src/chart/background/background.ts +var Background = class extends BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.rectNode = new Rect(); + this.textNode = new Text(); + this.fill = "white"; + this.node = this.createNode(); + this.node.append([this.rectNode, this.textNode]); + this.visible = true; + this.cleanup.register( + ctx.scene.attachNode(this.node), + ctx.eventsHub.on("layout:complete", (e) => this.onLayoutComplete(e)) + ); + } + createNode() { + return new Group({ name: "background", zIndex: 0 /* CHART_BACKGROUND */ }); + } + onLayoutComplete(e) { + const { width: width2, height: height2 } = e.chart; + this.rectNode.width = width2; + this.rectNode.height = height2; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("node", "visible") +], Background.prototype, "visible", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("rectNode", "fill") +], Background.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Background.prototype, "image", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + ProxyPropertyOnWrite("textNode") +], Background.prototype, "text", 2); + +// packages/ag-charts-community/src/chart/background/backgroundModule.ts +var BackgroundModule = { + type: "root", + optionsKey: "background", + packageType: "community", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Background(ctx) +}; + +// packages/ag-charts-community/src/util/border.ts +var Border = class extends BaseProperties { + constructor(node) { + super(); + this.node = node; + this.enabled = false; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 1; + } +}; +__decorateClass([ + ActionOnSet({ + changeValue(newValue) { + if (newValue) { + this.node.strokeWidth = this.strokeWidth; + } else { + this.node.strokeWidth = 0; + } + } + }), + addFakeTransformToInstanceProperty +], Border.prototype, "enabled", 2); +__decorateClass([ + ProxyPropertyOnWrite("node", "stroke"), + addFakeTransformToInstanceProperty +], Border.prototype, "stroke", 2); +__decorateClass([ + ProxyPropertyOnWrite("node", "strokeOpacity"), + addFakeTransformToInstanceProperty +], Border.prototype, "strokeOpacity", 2); +__decorateClass([ + ActionOnSet({ + changeValue(newValue) { + if (this.enabled) { + this.node.strokeWidth = newValue; + } else { + this.node.strokeWidth = 0; + } + } + }), + addFakeTransformToInstanceProperty +], Border.prototype, "strokeWidth", 2); + +// packages/ag-charts-community/src/chart/gridLayout.ts +function gridLayout({ + orientation, + bboxes, + maxHeight, + maxWidth, + itemPaddingY = 0, + itemPaddingX = 0, + forceResult = false +}) { + const horizontal = orientation === "horizontal"; + const primary = { + max: horizontal ? maxWidth : maxHeight, + fn: horizontal ? (b) => b.width : (b) => b.height, + padding: horizontal ? itemPaddingX : itemPaddingY + }; + const secondary = { + max: horizontal ? maxHeight : maxWidth, + fn: horizontal ? (b) => b.height : (b) => b.width, + padding: horizontal ? itemPaddingY : itemPaddingX + }; + let processedBBoxCount = 0; + const rawPages = []; + while (processedBBoxCount < bboxes.length) { + const unprocessedBBoxes = bboxes.slice(processedBBoxCount); + const result = processBBoxes(unprocessedBBoxes, processedBBoxCount, primary, secondary, forceResult); + if (!result) { + return; + } + processedBBoxCount += result.processedBBoxCount; + rawPages.push(result.pageIndices); + } + return buildPages(rawPages, orientation, bboxes, itemPaddingY, itemPaddingX); +} +function processBBoxes(bboxes, indexOffset, primary, secondary, forceResult) { + const minGuess = 1; + let startingGuess = estimateStartingGuess(bboxes, primary); + if (startingGuess < minGuess) { + if (!forceResult) { + return; + } + startingGuess = minGuess; + } + let guess = startingGuess; + while (guess >= minGuess) { + const pageIndices = calculatePage(bboxes, indexOffset, guess, primary, secondary, forceResult); + if (pageIndices == null && guess <= minGuess) { + return; + } + if (pageIndices == null) { + guess--; + continue; + } + if (typeof pageIndices === "number") { + if (pageIndices <= minGuess) { + return; + } + guess = pageIndices < guess && pageIndices > minGuess ? pageIndices : guess; + guess--; + continue; + } + const processedBBoxCount = pageIndices.length * pageIndices[0].length; + return { processedBBoxCount, pageIndices }; + } +} +function calculatePage(bboxes, indexOffset, primaryCount, primary, secondary, forceResult) { + const result = []; + let sumSecondary = 0; + let currentMaxSecondary = 0; + let currentPrimaryIndices = []; + const maxPrimaryValues = []; + for (let bboxIndex = 0; bboxIndex < bboxes.length; bboxIndex++) { + const primaryValueIdx = (bboxIndex + primaryCount) % primaryCount; + if (primaryValueIdx === 0) { + sumSecondary += currentMaxSecondary; + currentMaxSecondary = 0; + if (currentPrimaryIndices.length > 0) { + result.push(currentPrimaryIndices); + } + currentPrimaryIndices = []; + } + const primaryValue = primary.fn(bboxes[bboxIndex]) + primary.padding; + maxPrimaryValues[primaryValueIdx] = Math.max(maxPrimaryValues[primaryValueIdx] ?? 0, primaryValue); + currentMaxSecondary = Math.max(currentMaxSecondary, secondary.fn(bboxes[bboxIndex]) + secondary.padding); + const currentSecondaryDimension = sumSecondary + currentMaxSecondary; + const returnResult = !forceResult || result.length > 0; + if (currentSecondaryDimension > secondary.max && returnResult) { + currentPrimaryIndices = []; + break; + } + const sumPrimary = maxPrimaryValues.reduce((sum2, next) => sum2 + next, 0); + if (sumPrimary > primary.max && !forceResult) { + if (maxPrimaryValues.length < primaryCount) { + return maxPrimaryValues.length; + } + return; + } + currentPrimaryIndices.push(bboxIndex + indexOffset); + } + if (currentPrimaryIndices.length > 0) { + result.push(currentPrimaryIndices); + } + return result.length > 0 ? result : void 0; +} +function buildPages(rawPages, orientation, bboxes, itemPaddingY, itemPaddingX) { + let maxPageWidth = 0; + let maxPageHeight = 0; + const pages = rawPages.map((indices) => { + if (orientation === "horizontal") { + indices = transpose(indices); + } + let endIndex = 0; + const columns = indices.map((colIndices) => { + const colBBoxes = colIndices.map((bboxIndex) => { + endIndex = Math.max(bboxIndex, endIndex); + return bboxes[bboxIndex]; + }); + let columnHeight = 0; + let columnWidth = 0; + for (const bbox of colBBoxes) { + columnHeight += bbox.height + itemPaddingY; + columnWidth = Math.max(columnWidth, bbox.width + itemPaddingX); + } + return { + indices: colIndices, + bboxes: colBBoxes, + columnHeight: Math.ceil(columnHeight), + columnWidth: Math.ceil(columnWidth) + }; + }); + let pageWidth = 0; + let pageHeight = 0; + for (const column of columns) { + pageWidth += column.columnWidth; + pageHeight = Math.max(pageHeight, column.columnHeight); + } + maxPageWidth = Math.max(pageWidth, maxPageWidth); + maxPageHeight = Math.max(pageHeight, maxPageHeight); + return { + columns, + startIndex: indices[0][0], + endIndex, + pageWidth, + pageHeight + }; + }); + return { pages, maxPageWidth, maxPageHeight }; +} +function transpose(data) { + const result = []; + for (const _ of data[0]) { + result.push([]); + } + for (const [dataIdx, innerData] of data.entries()) { + for (const [itemIdx, item] of innerData.entries()) { + result[itemIdx][dataIdx] = item; + } + } + return result; +} +function estimateStartingGuess(bboxes, primary) { + const n = bboxes.length; + let primarySum = 0; + for (let bboxIndex = 0; bboxIndex < n; bboxIndex++) { + primarySum += primary.fn(bboxes[bboxIndex]) + primary.padding; + if (primarySum > primary.max) { + const ratio2 = n / bboxIndex; + if (ratio2 < 2) { + return Math.ceil(n / 2); + } + return bboxIndex; + } + } + return n; +} + +// packages/ag-charts-community/src/chart/pagination/pagination.ts +var PaginationLabel = class extends BaseProperties { + constructor() { + super(...arguments); + this.color = "black"; + this.fontStyle = void 0; + this.fontWeight = void 0; + this.fontSize = 12 /* SMALL */; + this.fontFamily = "Verdana, sans-serif"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationLabel.prototype, "color", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationLabel.prototype, "fontStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationLabel.prototype, "fontWeight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationLabel.prototype, "fontSize", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationLabel.prototype, "fontFamily", 2); +var PaginationMarkerStyle = class extends BaseProperties { + constructor() { + super(...arguments); + this.size = 15; + this.fill = void 0; + this.fillOpacity = void 0; + this.stroke = void 0; + this.strokeWidth = 1; + this.strokeOpacity = 1; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationMarkerStyle.prototype, "size", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationMarkerStyle.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationMarkerStyle.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationMarkerStyle.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationMarkerStyle.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationMarkerStyle.prototype, "strokeOpacity", 2); +var PaginationMarker = class extends BaseProperties { + constructor(parent) { + super(); + this.parent = parent; + this.shape = "triangle"; + this.size = 15; + this.padding = 8; + } +}; +__decorateClass([ + ActionOnSet({ + changeValue() { + if (this.parent.marker === this) { + this.parent.onMarkerShapeChange(); + } + } + }) +], PaginationMarker.prototype, "shape", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationMarker.prototype, "size", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PaginationMarker.prototype, "padding", 2); +var Pagination = class extends BaseProperties { + constructor(chartUpdateCallback, pageUpdateCallback) { + super(); + this.chartUpdateCallback = chartUpdateCallback; + this.pageUpdateCallback = pageUpdateCallback; + this.id = createId(this); + this.marker = new PaginationMarker(this); + this.activeStyle = new PaginationMarkerStyle(); + this.inactiveStyle = new PaginationMarkerStyle(); + this.highlightStyle = new PaginationMarkerStyle(); + this.label = new PaginationLabel(); + this.group = new TranslatableGroup({ name: "pagination" }); + this.labelNode = new Text(); + this.totalPages = 0; + this.currentPage = 0; + this.translationX = 0; + this.translationY = 0; + this.nextButtonDisabled = false; + this.previousButtonDisabled = false; + this._visible = true; + this._enabled = true; + this._orientation = "vertical"; + this.nextButton = new Marker(); + this.previousButton = new Marker(); + this.labelNode.setProperties({ + textBaseline: "middle", + fontSize: 12 /* SMALL */, + fontFamily: "Verdana, sans-serif", + fill: "black", + y: 1 + }); + this.group.append([this.nextButton, this.previousButton, this.labelNode]); + this.update(); + this.updateMarkers(); + } + set visible(value) { + this._visible = value; + this.updateGroupVisibility(); + } + get visible() { + return this._visible; + } + set enabled(value) { + this._enabled = value; + this.updateGroupVisibility(); + } + get enabled() { + return this._enabled; + } + updateGroupVisibility() { + this.group.visible = this.enabled && this.visible; + } + set orientation(value) { + this._orientation = value; + switch (value) { + case "horizontal": { + this.previousButton.rotation = -Math.PI / 2; + this.nextButton.rotation = Math.PI / 2; + break; + } + case "vertical": + default: { + this.previousButton.rotation = 0; + this.nextButton.rotation = Math.PI; + } + } + } + get orientation() { + return this._orientation; + } + update() { + this.updateLabel(); + this.updatePositions(); + this.enableOrDisableButtons(); + } + updatePositions() { + this.group.translationX = this.translationX; + this.group.translationY = this.translationY; + this.updateLabelPosition(); + this.updateNextButtonPosition(); + } + updateLabelPosition() { + const { size: markerSize, padding: markerPadding } = this.marker; + this.nextButton.size = markerSize; + this.previousButton.size = markerSize; + this.labelNode.x = markerSize / 2 + markerPadding; + } + updateNextButtonPosition() { + const labelBBox = this.labelNode.getBBox(); + this.nextButton.translationX = labelBBox.width + (this.marker.size / 2 + this.marker.padding) * 2; + } + updateLabel() { + const { + currentPage, + totalPages: pages, + labelNode, + label: { color: color2, fontStyle, fontWeight, fontSize, fontFamily } + } = this; + labelNode.text = `${currentPage + 1} / ${pages}`; + labelNode.fill = color2; + labelNode.fontStyle = fontStyle; + labelNode.fontWeight = fontWeight; + labelNode.fontSize = fontSize; + labelNode.fontFamily = fontFamily; + } + updateMarkers() { + const { + nextButton, + previousButton, + nextButtonDisabled, + previousButtonDisabled, + activeStyle, + inactiveStyle, + highlightStyle, + highlightActive + } = this; + const buttonStyle = (button, disabled) => { + if (disabled) { + return inactiveStyle; + } else if (button === highlightActive) { + return highlightStyle; + } + return activeStyle; + }; + this.updateMarker(nextButton, buttonStyle("next", nextButtonDisabled)); + this.updateMarker(previousButton, buttonStyle("previous", previousButtonDisabled)); + } + updateMarker(marker, style2) { + const { shape, size } = this.marker; + marker.shape = shape; + marker.size = size; + marker.fill = style2.fill; + marker.fillOpacity = style2.fillOpacity ?? 1; + marker.stroke = style2.stroke; + marker.strokeWidth = style2.strokeWidth; + marker.strokeOpacity = style2.strokeOpacity; + } + enableOrDisableButtons() { + const { currentPage, totalPages } = this; + const zeroPagesToDisplay = totalPages === 0; + const onLastPage = currentPage === totalPages - 1; + const onFirstPage = currentPage === 0; + this.nextButtonDisabled = onLastPage || zeroPagesToDisplay; + this.previousButtonDisabled = onFirstPage || zeroPagesToDisplay; + } + setPage(pageNumber) { + pageNumber = clamp(0, pageNumber, Math.max(0, this.totalPages - 1)); + if (this.currentPage !== pageNumber) { + this.currentPage = pageNumber; + this.onPaginationChanged(); + } + } + getCursor(node) { + return { previous: this.previousButtonDisabled, next: this.nextButtonDisabled }[node] ? void 0 : "pointer"; + } + onClick(event, node) { + event.preventDefault(); + if (node === "next" && !this.nextButtonDisabled) { + this.incrementPage(); + this.onPaginationChanged(); + } else if (node === "previous" && !this.previousButtonDisabled) { + this.decrementPage(); + this.onPaginationChanged(); + } + } + onMouseHover(node) { + this.highlightActive = node; + this.updateMarkers(); + this.chartUpdateCallback(7 /* SCENE_RENDER */); + } + onPaginationChanged() { + this.pageUpdateCallback(this.currentPage); + } + incrementPage() { + this.currentPage = Math.min(this.currentPage + 1, this.totalPages - 1); + } + decrementPage() { + this.currentPage = Math.max(this.currentPage - 1, 0); + } + onMarkerShapeChange() { + this.updatePositions(); + this.updateMarkers(); + this.chartUpdateCallback(7 /* SCENE_RENDER */); + } + attachPagination(node) { + node.append(this.group); + } + getBBox() { + return this.group.getBBox(); + } + computeCSSBounds() { + const prev = Transformable.toCanvas(this.previousButton); + const next = Transformable.toCanvas(this.nextButton); + return { prev, next }; + } +}; +Pagination.className = "Pagination"; +__decorateClass([ + addFakeTransformToInstanceProperty +], Pagination.prototype, "marker", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Pagination.prototype, "activeStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Pagination.prototype, "inactiveStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Pagination.prototype, "highlightStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Pagination.prototype, "label", 2); + +// packages/ag-charts-community/src/chart/legend/legendDOMProxy.ts +var LegendDOMProxy = class { + constructor(ctx, idPrefix) { + this.dirty = true; + this.itemList = ctx.proxyInteractionService.createProxyContainer({ + type: "list", + domManagerId: `${idPrefix}-toolbar`, + classList: ["ag-charts-proxy-legend-toolbar"], + ariaLabel: { id: "ariaLabelLegend" } + }); + this.paginationGroup = ctx.proxyInteractionService.createProxyContainer({ + type: "group", + domManagerId: `${idPrefix}-pagination`, + classList: ["ag-charts-proxy-legend-pagination"], + ariaLabel: { id: "ariaLabelLegendPagination" } + }); + this.itemDescription = createElement("p"); + this.itemDescription.style.display = "none"; + this.itemDescription.id = createElementId(); + this.itemDescription.textContent = this.getItemAriaDescription(ctx.localeManager); + this.itemList.getElement().append(this.itemDescription); + } + initLegendList(params) { + if (!this.dirty) + return; + const { ctx, itemSelection, datumReader, itemListener } = params; + const lm = ctx.localeManager; + const count = itemSelection.length; + itemSelection.each((markerLabel, datum, index) => { + markerLabel.proxyButton?.destroy(); + markerLabel.proxyButton = ctx.proxyInteractionService.createProxyElement({ + type: "listswitch", + textContent: this.getItemAriaText(lm, toPlainText(datumReader.getItemLabel(datum)), index, count), + ariaChecked: !!markerLabel.datum.enabled, + ariaDescribedBy: this.itemDescription.id, + parent: this.itemList + }); + const button = markerLabel.proxyButton; + button.addListener("click", (ev) => itemListener.onClick(ev.sourceEvent, markerLabel.datum, button)); + button.addListener("dblclick", (ev) => itemListener.onDoubleClick(ev.sourceEvent, markerLabel.datum)); + button.addListener("mouseenter", (ev) => itemListener.onHover(ev.sourceEvent, markerLabel)); + button.addListener("mouseleave", () => itemListener.onLeave()); + button.addListener("contextmenu", (ev) => itemListener.onContextClick(ev, markerLabel)); + button.addListener("blur", () => itemListener.onLeave()); + button.addListener("focus", (ev) => itemListener.onHover(ev.sourceEvent, markerLabel)); + button.addListener("drag-start", () => { + }); + }); + this.dirty = false; + } + update(params) { + if (params.visible) { + this.initLegendList(params); + this.updateItemProxyButtons(params); + this.updatePaginationProxyButtons(params, true); + } + this.updateVisibility(params.visible); + } + updateVisibility(visible) { + this.itemList.setHidden(!visible); + this.paginationGroup.setHidden(!visible); + } + updateItemProxyButtons({ itemSelection, group, pagination, interactive }) { + const groupBBox = Transformable.toCanvas(group); + this.itemList.setBounds(groupBBox); + const maxHeight = Math.max(...itemSelection.nodes().map((l) => l.getBBox().height)); + itemSelection.each((l, _datum) => { + if (l.proxyButton) { + const visible = l.pageIndex === pagination.currentPage; + const { x, y, height: height2, width: width2 } = Transformable.toCanvas(l); + const margin = (maxHeight - height2) / 2; + const bbox = { x: x - groupBBox.x, y: y - margin - groupBBox.y, height: maxHeight, width: width2 }; + const enabled = interactive && visible; + l.proxyButton.setCursor("pointer"); + l.proxyButton.setEnabled(enabled); + l.proxyButton.setPointerEvents(enabled ? void 0 : "none"); + l.proxyButton.setBounds(bbox); + } + }); + } + updatePaginationProxyButtons(params, init) { + const { pagination } = params; + this.paginationGroup.setHidden(!pagination.visible); + if (init && "ctx" in params) { + const { oldPages, newPages } = params; + const oldNeedsButtons = (oldPages?.length ?? newPages.length) > 1; + const newNeedsButtons = newPages.length > 1; + if (oldNeedsButtons !== newNeedsButtons) { + if (newNeedsButtons) { + this.createPaginationButtons(params); + } else { + this.destroyPaginationButtons(); + } + } + this.paginationGroup.setAriaHidden(newNeedsButtons ? void 0 : true); + } + if (this.prevButton && this.nextButton) { + const { prev, next } = pagination.computeCSSBounds(); + const group = BBox.merge([prev, next]); + prev.x -= group.x; + prev.y -= group.y; + next.x -= group.x; + next.y -= group.y; + this.paginationGroup.setBounds(group); + this.prevButton.setBounds(prev); + this.nextButton.setBounds(next); + this.prevButton.setEnabled(pagination.currentPage !== 0); + this.nextButton.setEnabled(pagination.currentPage !== pagination.totalPages - 1); + this.nextButton.setCursor(pagination.getCursor("next")); + this.prevButton.setCursor(pagination.getCursor("previous")); + } + } + createPaginationButtons(params) { + const { ctx, pagination } = params; + if (!this.prevButton) { + this.prevButton = ctx.proxyInteractionService.createProxyElement({ + type: "button", + textContent: { id: "ariaLabelLegendPagePrevious" }, + tabIndex: 0, + parent: this.paginationGroup + }); + this.prevButton.addListener("click", (ev) => this.onPageButton(params, ev, "previous")); + this.prevButton.addListener("mouseenter", () => pagination.onMouseHover("previous")); + this.prevButton.addListener("mouseleave", () => pagination.onMouseHover(void 0)); + } + if (!this.nextButton) { + this.nextButton = ctx.proxyInteractionService.createProxyElement({ + type: "button", + textContent: { id: "ariaLabelLegendPageNext" }, + tabIndex: 0, + parent: this.paginationGroup + }); + this.nextButton.addListener("click", (ev) => this.onPageButton(params, ev, "next")); + this.nextButton.addListener("mouseenter", () => pagination.onMouseHover("next")); + this.nextButton.addListener("mouseleave", () => pagination.onMouseHover(void 0)); + } + } + destroyPaginationButtons() { + this.nextButton?.destroy(); + this.prevButton?.destroy(); + this.nextButton = void 0; + this.prevButton = void 0; + } + onPageButton(params, ev, node) { + params.pagination.onClick(ev.sourceEvent, node); + this.updatePaginationProxyButtons(params, false); + } + onDataUpdate(oldData, newData) { + this.dirty = oldData.length !== newData.length || oldData.some((_v, index, _a) => { + const [newValue, oldValue] = [newData[index], oldData[index]]; + return newValue.id !== oldValue.id; + }); + } + onLocaleChanged(localeManager, itemSelection, datumReader) { + const count = itemSelection.length; + itemSelection.each(({ proxyButton }, datum, index) => { + const button = proxyButton?.getElement(); + if (button != null) { + const label = toPlainText(datumReader.getItemLabel(datum)); + button.textContent = this.getItemAriaText(localeManager, label, index, count); + } + }); + this.itemDescription.textContent = this.getItemAriaDescription(localeManager); + } + onPageChange(params) { + this.updateItemProxyButtons(params); + this.updatePaginationProxyButtons(params, false); + } + getItemAriaText(localeManager, label, index, count) { + if (index >= 0 && label) { + index++; + return localeManager.t("ariaLabelLegendItem", { label, index, count }); + } + return localeManager.t("ariaLabelLegendItemUnknown"); + } + getItemAriaDescription(localeManager) { + return localeManager.t("ariaDescriptionLegendItem"); + } +}; + +// packages/ag-charts-community/src/chart/legend/legendEvent.ts +function makeLegendItemEvent(type, { itemId, seriesId, label: { text: text2 } }, event) { + const result = { + defaultPrevented: false, + apiEvent: { + type, + itemId, + // FIXME: AG-16068 + seriesId, + event, + text: toPlainText(text2), + preventDefault: () => result.defaultPrevented = true + } + }; + return result; +} + +// packages/ag-charts-community/src/chart/legend/legendMarkerLabel.ts +var LegendMarkerLabel = class extends TranslatableGroup { + constructor() { + super({ name: "markerLabelGroup" }); + this.symbolsGroup = this.appendChild( + new Group({ + name: "legend-markerLabel-symbols", + renderToOffscreenCanvas: true, + optimizeForInfrequentRedraws: true + }) + ); + this.label = this.appendChild(new Text()); + this.enabled = true; + this.pageIndex = Number.NaN; + this.spacing = 0; + this.length = 0; + this.isCustomMarker = false; + this.marker = this.symbolsGroup.appendChild(new Marker({ zIndex: 1 })); + this.line = this.symbolsGroup.appendChild(new Line({ zIndex: 0 })); + this.line.visible = false; + this.label.textBaseline = "middle"; + this.label.y = 1; + } + destroy() { + super.destroy(); + this.proxyButton?.destroy(); + } + setEnabled(enabled) { + this.enabled = enabled; + this.refreshVisibilities(); + } + getTextMeasureBBox() { + this.layout(); + return BBox.merge([this.symbolsGroup.getBBox(), this.label.getTextMeasureBBox()]); + } + refreshVisibilities() { + const opacity = this.enabled ? 1 : 0.5; + this.label.opacity = opacity; + this.opacity = opacity; + } + layout() { + const { marker, line, length: length2, isCustomMarker } = this; + let centerTranslateX = 0; + let centerTranslateY = 0; + if (marker.visible) { + const { size } = marker; + const anchor = Marker.anchor(marker.shape); + centerTranslateX = (anchor.x - 0.5) * size + length2 / 2; + centerTranslateY = (anchor.y - 0.5) * size; + if (isCustomMarker) { + marker.x = 0; + marker.y = 0; + marker.translationX = centerTranslateX; + marker.translationY = centerTranslateY; + } else { + marker.x = centerTranslateX; + marker.y = centerTranslateY; + marker.translationX = 0; + marker.translationY = 0; + } + } + if (line.visible) { + line.x1 = 0; + line.x2 = length2; + line.y1 = 0; + line.y2 = 0; + } + } + preRender(renderCtx) { + const out = super.preRender(renderCtx); + this.layout(); + return out; + } + layoutLabel() { + const { length: length2, spacing } = this; + this.label.x = length2 + spacing; + } + computeBBox() { + this.layout(); + return super.computeBBox(); + } +}; +LegendMarkerLabel.className = "MarkerLabel"; +__decorateClass([ + ProxyPropertyOnWrite("label") +], LegendMarkerLabel.prototype, "text", 2); +__decorateClass([ + ProxyPropertyOnWrite("label") +], LegendMarkerLabel.prototype, "fontStyle", 2); +__decorateClass([ + ProxyPropertyOnWrite("label") +], LegendMarkerLabel.prototype, "fontWeight", 2); +__decorateClass([ + ProxyPropertyOnWrite("label") +], LegendMarkerLabel.prototype, "fontSize", 2); +__decorateClass([ + ProxyPropertyOnWrite("label") +], LegendMarkerLabel.prototype, "fontFamily", 2); +__decorateClass([ + ProxyPropertyOnWrite("label", "fill") +], LegendMarkerLabel.prototype, "color", 2); +__decorateClass([ + ObserveChanges((target) => target.layoutLabel()) +], LegendMarkerLabel.prototype, "spacing", 2); +__decorateClass([ + ObserveChanges((target) => target.layoutLabel()) +], LegendMarkerLabel.prototype, "length", 2); +__decorateClass([ + SceneChangeDetection() +], LegendMarkerLabel.prototype, "isCustomMarker", 2); + +// packages/ag-charts-community/src/chart/legend/legendUtil.ts +function expandLegendPosition(position) { + const { + placement = "bottom", + floating = false, + xOffset = 0, + yOffset = 0 + } = typeof position === "string" ? { placement: position, floating: false } : position; + return { placement, floating, xOffset, yOffset }; +} + +// packages/ag-charts-community/src/chart/legend/legend.ts +var LegendLabel = class extends BaseProperties { + constructor() { + super(...arguments); + this.maxLength = void 0; + this.color = "black"; + this.fontStyle = void 0; + this.fontWeight = void 0; + this.fontSize = 12 /* SMALL */; + this.fontFamily = "Verdana, sans-serif"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendLabel.prototype, "maxLength", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendLabel.prototype, "color", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendLabel.prototype, "fontStyle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendLabel.prototype, "fontWeight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendLabel.prototype, "fontSize", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendLabel.prototype, "fontFamily", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendLabel.prototype, "formatter", 2); +var LegendMarker = class extends BaseProperties { + constructor() { + super(...arguments); + this.shape = void 0; + this.size = 15; + this.padding = 8; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendMarker.prototype, "shape", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendMarker.prototype, "size", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendMarker.prototype, "padding", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendMarker.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendMarker.prototype, "enabled", 2); +var LegendLine = class extends BaseProperties { +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendLine.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendLine.prototype, "length", 2); +var LegendItem = class extends BaseProperties { + constructor() { + super(...arguments); + this.paddingX = 16; + this.paddingY = 8; + this.showSeriesStroke = false; + this.marker = new LegendMarker(); + this.label = new LegendLabel(); + this.line = new LegendLine(); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendItem.prototype, "maxWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendItem.prototype, "paddingX", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendItem.prototype, "paddingY", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendItem.prototype, "showSeriesStroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendItem.prototype, "marker", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendItem.prototype, "label", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendItem.prototype, "line", 2); +var LegendListeners = class extends BaseProperties { +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendListeners.prototype, "legendItemClick", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LegendListeners.prototype, "legendItemDoubleClick", 2); +var fillGradientDefaults2 = { + type: "gradient", + bounds: "item", + gradient: "linear", + colorStops: [{ color: "black" }], + rotation: 0, + reverse: false, + colorSpace: "rgb" +}; +var fillPatternDefaults2 = { + type: "pattern", + pattern: "forward-slanted-lines", + width: 8, + height: 8, + padding: 1, + fill: "black", + fillOpacity: 1, + backgroundFill: "white", + backgroundFillOpacity: 1, + stroke: "black", + strokeOpacity: 1, + strokeWidth: 1, + rotation: 0, + scale: 1 +}; +var fillImageDefaults2 = { + type: "image", + backgroundFill: "black", + backgroundFillOpacity: 1, + rotation: 0, + repeat: "no-repeat", + fit: "contain", + width: 8, + height: 8 +}; +var Legend = class extends BaseProperties { + constructor(ctx) { + super(); + this.ctx = ctx; + this.id = createId(this); + this.group = new TranslatableGroup({ name: "legend", zIndex: 16 /* LEGEND */ }); + this.itemSelection = Selection.select( + this.group, + LegendMarkerLabel + ); + this.containerNode = this.group.appendChild(new Rect({ name: "legend-container" })); + this.oldSize = [0, 0]; + this.pages = []; + this.maxPageSize = [0, 0]; + /** Item index to track on re-pagination, so current page updates appropriately. */ + this.paginationTrackingIndex = 0; + this.truncatedItems = /* @__PURE__ */ new Set(); + this._data = []; + this.toggleSeries = true; + this.item = new LegendItem(); + this.listeners = new LegendListeners(); + this.enabled = true; + this.position = "bottom"; + this.border = new Border(this.containerNode); + this.cornerRadius = 0; + this.fillOpacity = 1; + this.padding = 4; + this.spacing = 0; + this.cleanup = new CleanupRegistry(); + this.size = [0, 0]; + this._visible = true; + this.pagination = new Pagination( + (type) => ctx.updateService.update(type), + (page) => this.updatePageNumber(page) + ); + this.pagination.attachPagination(this.group); + const { items } = ctx.contextMenuRegistry.builtins; + items["toggle-series-visibility"].action = (params) => this.contextToggleVisibility(params); + items["toggle-other-series"].action = (params) => this.contextToggleOtherSeries(params); + this.cleanup.register( + ctx.eventsHub.on("legend:change", this.onLegendDataChange.bind(this)), + ctx.eventsHub.on("legend:change-partial", this.onLegendDataChangePartial.bind(this)), + ctx.layoutManager.registerElement(1 /* Legend */, (e) => this.positionLegend(e)), + ctx.eventsHub.on("locale:change", () => this.onLocaleChanged()), + () => delete items["toggle-series-visibility"].action, + () => delete items["toggle-other-series"].action, + () => this.group.remove() + ); + this.domProxy = new LegendDOMProxy(this.ctx, this.id); + this.ctx.historyManager.addMementoOriginator(ctx.legendManager); + } + set data(value) { + if (objectsEqual(value, this._data)) + return; + this.domProxy.onDataUpdate(this._data, value); + this._data = value; + this.updateGroupVisibility(); + } + get data() { + return this._data; + } + onLegendDataChange({ legendData = [] }) { + if (!this.enabled) + return; + this.data = legendData.filter((datum) => !datum.hideInLegend); + } + onLegendDataChangePartial(event) { + this.itemSelection.each(({ proxyButton }, { itemId }) => { + if (proxyButton == null) + return; + for (const eventElem of event.legendData) { + if (eventElem.itemId === itemId) { + proxyButton.setChecked(eventElem.enabled); + } + } + }); + } + destroy() { + this.ctx.domManager.removeChild("canvas-overlay", `${this.id}-toolbar`); + this.ctx.domManager.removeChild("canvas-overlay", `${this.id}-pagination`); + this.cleanup.flush(); + this.itemSelection.clear(); + } + getOrientation() { + return this.orientation ?? "horizontal"; + } + set visible(value) { + this._visible = value; + this.updateGroupVisibility(); + } + get visible() { + return this._visible; + } + updateGroupVisibility() { + this.group.visible = this.enabled && this.visible && this.data.length > 0; + } + isInteractive() { + const { + toggleSeries, + listeners: { legendItemClick, legendItemDoubleClick } + } = this; + return toggleSeries || legendItemDoubleClick != null || legendItemClick != null; + } + attachLegend(scene) { + scene.appendChild(this.group); + } + getItemLabel(datum) { + const { formatter: formatter2 } = this.item.label; + if (formatter2) { + const seriesDatum = datum.datum; + return this.cachedCallWithContext(formatter2, { + itemId: datum.itemId, + value: datum.label.text, + seriesId: datum.seriesId, + ...seriesDatum && { datum: seriesDatum } + }); + } + return datum.label.text; + } + /** + * The method is given the desired size of the legend, which only serves as a hint. + * The vertically oriented legend will take as much horizontal space as needed, but will + * respect the height constraints, and the horizontal legend will take as much vertical + * space as needed in an attempt not to exceed the given width. + * After the layout is done, the {@link size} will contain the actual size of the legend. + * If the actual size is not the same as the previous actual size, the legend will fire + * the 'layoutChange' event to communicate that another layout is needed, and the above + * process should be repeated. + * @param width + * @param height + */ + calcLayout(width2, height2) { + const { + paddingX, + paddingY, + label, + maxWidth, + label: { maxLength = Infinity, fontStyle, fontWeight, fontSize, fontFamily } + } = this.item; + const data = [...this.data]; + if (this.reverseOrder) { + data.reverse(); + } + this.itemSelection.update(data); + const bboxes = []; + const measurer3 = cachedTextMeasurer(label); + const itemMaxWidthPercentage = 0.8; + const maxItemWidth = maxWidth ?? width2 * itemMaxWidthPercentage; + const { markerWidth, anyLineEnabled } = this.calculateMarkerWidth(); + this.itemSelection.each((markerLabel, datum) => { + markerLabel.fontStyle = fontStyle; + markerLabel.fontWeight = fontWeight; + markerLabel.fontSize = fontSize; + markerLabel.fontFamily = fontFamily; + const paddedSymbolWidth = this.updateMarkerLabel(markerLabel, datum, markerWidth, anyLineEnabled); + const id = datum.itemId ?? datum.id; + const labelText = this.getItemLabel(datum); + const text2 = toPlainText(labelText, "").replace(LineSplitter, " "); + markerLabel.text = this.truncate(text2, maxLength, maxItemWidth, paddedSymbolWidth, measurer3, id); + bboxes.push(markerLabel.getTextMeasureBBox()); + }); + width2 = Math.max(1, width2); + height2 = Math.max(1, height2); + if (!Number.isFinite(width2)) { + return {}; + } + [width2, height2] = this.updateContainer(width2, height2); + const size = this.size; + const oldSize = this.oldSize; + size[0] = width2; + size[1] = height2; + if (size[0] !== oldSize[0] || size[1] !== oldSize[1]) { + oldSize[0] = size[0]; + oldSize[1] = size[1]; + } + const { pages, maxPageHeight, maxPageWidth } = this.updatePagination(bboxes, width2, height2); + const oldPages = this.pages; + this.pages = pages; + this.maxPageSize = [maxPageWidth - paddingX, maxPageHeight - paddingY]; + const pageNumber = this.pagination.currentPage; + const page = this.pages[pageNumber]; + if (this.pages.length < 1 || !page) { + this.visible = false; + return { oldPages }; + } + this.visible = true; + this.updatePositions(pageNumber); + this.update(); + return { oldPages }; + } + isCustomMarker(markerEnabled3, shape) { + return markerEnabled3 && shape !== void 0 && typeof shape !== "string"; + } + calcSymbolsEnabled(symbol) { + const { showSeriesStroke, marker } = this.item; + const markerEnabled3 = !!marker.enabled || !showSeriesStroke || (symbol.marker.enabled ?? true); + const lineEnabled = !!(symbol.line && showSeriesStroke); + const isCustomMarker = this.isCustomMarker(markerEnabled3, symbol.marker.shape); + return { markerEnabled: markerEnabled3, lineEnabled, isCustomMarker }; + } + calcSymbolsLengths(symbol, markerEnabled3, lineEnabled) { + const { marker, line } = this.item; + let customMarkerSize; + const { shape } = symbol.marker; + if (this.isCustomMarker(markerEnabled3, shape)) { + const tmpShape = new Marker(); + tmpShape.shape = shape; + tmpShape.updatePath(); + const bbox = tmpShape.getBBox(); + customMarkerSize = Math.max(bbox.width, bbox.height); + } + const markerLength = markerEnabled3 ? marker.size : 0; + const lineLength = lineEnabled ? line.length ?? 25 : 0; + return { markerLength, lineLength, customMarkerSize }; + } + calculateMarkerWidth() { + let markerWidth = 0; + let anyLineEnabled = false; + this.itemSelection.each((_, datum) => { + const { symbol } = datum; + const { lineEnabled, markerEnabled: markerEnabled3 } = this.calcSymbolsEnabled(symbol); + const { + markerLength, + lineLength, + customMarkerSize = -Infinity + } = this.calcSymbolsLengths(symbol, markerEnabled3, lineEnabled); + markerWidth = Math.max(markerWidth, lineLength, customMarkerSize, markerLength); + anyLineEnabled || (anyLineEnabled = lineEnabled); + }); + return { markerWidth, anyLineEnabled }; + } + updateMarkerLabel(markerLabel, datum, markerWidth, anyLineEnabled) { + const { marker: itemMarker, paddingX } = this.item; + const { symbol } = datum; + let paddedSymbolWidth = paddingX; + const { markerEnabled: markerEnabled3, isCustomMarker } = this.calcSymbolsEnabled(symbol); + const spacing = itemMarker.padding; + if (markerEnabled3 || anyLineEnabled) { + paddedSymbolWidth += spacing + markerWidth; + } + const { marker, line } = markerLabel; + marker.visible = markerEnabled3; + if (marker.visible) { + marker.shape = itemMarker.shape ?? symbol.marker.shape ?? "square"; + marker.size = itemMarker.size; + applyShapeStyle(marker, this.getMarkerStyles(deepClone(symbol))); + } + line.visible = anyLineEnabled; + if (line.visible) { + applyShapeStyle(line, this.getLineStyles(symbol)); + } + markerLabel.length = markerWidth; + markerLabel.spacing = spacing; + markerLabel.isCustomMarker = isCustomMarker; + return paddedSymbolWidth; + } + updateContainer(width2, height2) { + const containerStyles = this.getContainerStyles(); + this.containerNode.width = 0; + this.containerNode.height = 0; + applyShapeStyle(this.containerNode, containerStyles); + this.containerNode.cornerRadius = containerStyles.cornerRadius; + width2 -= containerStyles.strokeWidth * 2 + containerStyles.padding.left + containerStyles.padding.right; + height2 -= containerStyles.strokeWidth * 2 + containerStyles.padding.top + containerStyles.padding.bottom; + return [width2, height2]; + } + truncate(text2, maxCharLength, maxItemWidth, paddedMarkerWidth, measurer3, id) { + let addEllipsis = false; + if (text2.length > maxCharLength) { + text2 = text2.substring(0, maxCharLength); + addEllipsis = true; + } + const result = truncateLine(text2, measurer3, maxItemWidth - paddedMarkerWidth, addEllipsis); + if (isTextTruncated(result)) { + this.truncatedItems.add(id); + } else { + this.truncatedItems.delete(id); + } + return result; + } + updatePagination(bboxes, width2, height2) { + const orientation = this.getOrientation(); + const trackingIndex = Math.min(this.paginationTrackingIndex, bboxes.length); + this.pagination.orientation = orientation; + this.pagination.translationX = 0; + this.pagination.translationY = 0; + const { pages, maxPageHeight, maxPageWidth, paginationBBox, paginationVertical } = this.calculatePagination( + bboxes, + width2, + height2 + ); + const newCurrentPage = pages.findIndex((p) => p.endIndex >= trackingIndex); + this.pagination.currentPage = clamp(0, newCurrentPage, pages.length - 1); + const { paddingX: itemPaddingX, paddingY: itemPaddingY } = this.item; + const paginationComponentPadding = 8; + const legendItemsWidth = maxPageWidth - itemPaddingX; + const legendItemsHeight = maxPageHeight - itemPaddingY; + let paginationX = 0; + let paginationY = -paginationBBox.y - this.item.marker.size / 2; + if (paginationVertical) { + paginationY += legendItemsHeight + paginationComponentPadding; + } else { + paginationX += -paginationBBox.x + legendItemsWidth + paginationComponentPadding; + paginationY += (legendItemsHeight - paginationBBox.height) / 2; + } + this.pagination.translationX = paginationX; + this.pagination.translationY = paginationY; + this.pagination.update(); + this.pagination.updateMarkers(); + let pageIndex = 0; + this.itemSelection.each((markerLabel, _, nodeIndex) => { + if (nodeIndex > (pages[pageIndex]?.endIndex ?? Infinity)) { + pageIndex++; + } + markerLabel.pageIndex = pageIndex; + }); + return { + maxPageHeight, + maxPageWidth, + pages + }; + } + calculatePagination(bboxes, width2, height2) { + const { paddingX: itemPaddingX, paddingY: itemPaddingY } = this.item; + const vertPositions = [ + "left", + "left-top", + "left-bottom", + "right", + "right-top", + "right-bottom" + ]; + const { placement } = expandLegendPosition(this.position); + const orientation = this.getOrientation(); + const paginationVertical = vertPositions.includes(placement); + let paginationBBox = this.pagination.getBBox(); + let lastPassPaginationBBox = new BBox(0, 0, 0, 0); + let pages = []; + let maxPageWidth = 0; + let maxPageHeight = 0; + let count = 0; + const stableOutput = (bbox) => { + return bbox.width === paginationBBox.width && bbox.height === paginationBBox.height; + }; + const forceResult = this.maxWidth !== void 0 && this.maxHeight !== void 0; + do { + if (count++ > 10) { + logger_exports.warn("unable to find stable legend layout."); + break; + } + paginationBBox = lastPassPaginationBBox; + const maxWidth = width2 - (paginationVertical ? 0 : paginationBBox.width); + const maxHeight = height2 - (paginationVertical ? paginationBBox.height : 0); + const layout = gridLayout({ + orientation, + bboxes, + maxHeight, + maxWidth, + itemPaddingY, + itemPaddingX, + forceResult + }); + pages = layout?.pages ?? []; + maxPageWidth = layout?.maxPageWidth ?? 0; + maxPageHeight = layout?.maxPageHeight ?? 0; + const totalPages = pages.length; + this.pagination.visible = totalPages > 1; + this.pagination.totalPages = totalPages; + this.pagination.update(); + this.pagination.updateMarkers(); + lastPassPaginationBBox = this.pagination.getBBox(); + if (!this.pagination.visible) { + break; + } + } while (!stableOutput(lastPassPaginationBBox)); + return { maxPageWidth, maxPageHeight, pages, paginationBBox: lastPassPaginationBBox, paginationVertical }; + } + updatePositions(pageNumber = 0) { + const { + item: { paddingY }, + itemSelection, + pages + } = this; + if (pages.length < 1 || !pages[pageNumber]) { + return; + } + const { columns, startIndex: visibleStart, endIndex: visibleEnd } = pages[pageNumber]; + let x = 0; + let y = 0; + const columnCount = columns.length; + const rowCount = columns[0].indices.length; + const horizontal = this.getOrientation() === "horizontal"; + const itemHeight = columns[0].bboxes[0].height + paddingY; + const rowSumColumnWidths = []; + itemSelection.each((markerLabel, _, i) => { + if (i < visibleStart || i > visibleEnd) { + markerLabel.visible = false; + return; + } + const pageIndex = i - visibleStart; + let columnIndex; + let rowIndex; + if (horizontal) { + columnIndex = pageIndex % columnCount; + rowIndex = Math.floor(pageIndex / columnCount); + } else { + columnIndex = Math.floor(pageIndex / rowCount); + rowIndex = pageIndex % rowCount; + } + markerLabel.visible = true; + const column = columns[columnIndex]; + if (!column) { + return; + } + y = Math.floor(itemHeight * rowIndex); + x = Math.floor(rowSumColumnWidths[rowIndex] ?? 0); + rowSumColumnWidths[rowIndex] = (rowSumColumnWidths[rowIndex] ?? 0) + column.columnWidth; + markerLabel.translationX = x; + markerLabel.translationY = y; + }); + } + updatePageNumber(pageNumber) { + const { itemSelection, group, pagination, pages } = this; + const { startIndex, endIndex } = pages[pageNumber]; + if (startIndex === 0) { + this.paginationTrackingIndex = 0; + } else if (pageNumber === pages.length - 1) { + this.paginationTrackingIndex = endIndex; + } else { + this.paginationTrackingIndex = Math.floor((startIndex + endIndex) / 2); + } + this.pagination.update(); + this.pagination.updateMarkers(); + this.updatePositions(pageNumber); + this.domProxy.onPageChange({ itemSelection, group, pagination, interactive: this.isInteractive() }); + this.ctx.updateService.update(7 /* SCENE_RENDER */); + } + update() { + const { + label: { color: color2 } + } = this.item; + this.itemSelection.each((markerLabel, datum) => { + markerLabel.setEnabled(datum.enabled); + markerLabel.color = color2; + }); + this.updateContextMenu(); + } + updateContextMenu() { + const action = this.toggleSeries ? "show" : "hide"; + this.ctx.contextMenuRegistry.toggle("toggle-series-visibility", action); + this.ctx.contextMenuRegistry.toggle("toggle-other-series", action); + } + getLineStyles(datum) { + const { stroke: stroke3, strokeOpacity = 1, strokeWidth, lineDash } = datum.line ?? {}; + const defaultLineStrokeWidth = Math.min(2, strokeWidth ?? 1); + return { + stroke: stroke3, + strokeOpacity, + strokeWidth: this.item.line.strokeWidth ?? defaultLineStrokeWidth, + lineDash + }; + } + getMarkerStyles({ marker }) { + const { fill, stroke: stroke3, strokeOpacity = 1, fillOpacity = 1, strokeWidth, lineDash, lineDashOffset } = marker; + const defaultLineStrokeWidth = Math.min(2, strokeWidth ?? 1); + if (isPatternFill(fill)) { + fill.width = 8; + fill.height = 8; + fill.padding = 1; + fill.strokeWidth = Math.min(2, fill.strokeWidth ?? 2); + } + if (isImageFill(fill)) { + fill.fit = "contain"; + fill.width = void 0; + fill.height = void 0; + fill.repeat = "no-repeat"; + } + return getShapeStyle( + { + fill, + stroke: stroke3, + strokeOpacity, + fillOpacity, + strokeWidth: this.item.marker.strokeWidth ?? defaultLineStrokeWidth, + lineDash, + lineDashOffset + }, + fillGradientDefaults2, + fillPatternDefaults2, + fillImageDefaults2 + ); + } + getContainerStyles() { + const { stroke: stroke3, strokeOpacity, strokeWidth } = this.border; + const { cornerRadius, fill, fillOpacity, padding: padding2 } = this; + const isPaddingNumber = typeof padding2 === "number"; + return getShapeStyle( + { + cornerRadius, + fill, + fillOpacity, + padding: { + top: isPaddingNumber ? padding2 : padding2.top ?? 0, + right: isPaddingNumber ? padding2 : padding2.right ?? 0, + bottom: isPaddingNumber ? padding2 : padding2.bottom ?? 0, + left: isPaddingNumber ? padding2 : padding2.left ?? 0 + }, + stroke: stroke3, + strokeOpacity, + strokeWidth: this.border.enabled ? strokeWidth : 0 + }, + fillGradientDefaults2, + fillPatternDefaults2, + fillImageDefaults2 + ); + } + computePagedBBox() { + const actualBBox = Group.computeChildrenBBox(this.group.excludeChildren({ name: "legend-container" })); + if (this.pages.length > 1) { + const [maxPageWidth, maxPageHeight] = this.maxPageSize; + actualBBox.height = Math.max(maxPageHeight, actualBBox.height); + actualBBox.width = Math.max(maxPageWidth, actualBBox.width); + } + const { strokeWidth, padding: padding2 } = this.getContainerStyles(); + actualBBox.grow(padding2).grow(strokeWidth); + return actualBBox; + } + findNode(params) { + const { datum, proxyButton } = this.itemSelection.select((ml) => ml.datum?.itemId === params.itemId)[0] ?? {}; + if (datum === void 0 || proxyButton === void 0) { + throw new Error( + `AG Charts - Missing required properties { datum: ${datum}, proxyButton: ${JSON.stringify(proxyButton)} }` + ); + } + return { datum, proxyButton }; + } + contextToggleVisibility(params) { + const { datum, proxyButton } = this.findNode(params); + this.doClick(params.event, datum, proxyButton); + } + contextToggleOtherSeries(params) { + this.doDoubleClick(params.event, this.findNode(params).datum); + } + onContextClick(widgetEvent, node) { + const { sourceEvent } = widgetEvent; + const legendItem = node.datum; + if (this.preventHidingAll && this.contextMenuDatum?.enabled && this.getVisibleItemCount() <= 1) { + this.ctx.contextMenuRegistry.builtins.items["toggle-series-visibility"].enabled = false; + } else { + this.ctx.contextMenuRegistry.builtins.items["toggle-series-visibility"].enabled = true; + } + const toggleOtherSeriesVisible = this.ctx.chartService.series.length > 1 && this.ctx.chartService.series[0]?.getLegendData("category")[0]?.hideToggleOtherSeries !== true; + const action = toggleOtherSeriesVisible ? "show" : "hide"; + this.ctx.contextMenuRegistry.toggle("toggle-other-series", action); + const { offsetX, offsetY } = sourceEvent; + const { x: canvasX, y: canvasY } = Transformable.toCanvasPoint(node, offsetX, offsetY); + this.ctx.contextMenuRegistry.dispatchContext("legend-item", { widgetEvent, canvasX, canvasY }, { legendItem }); + } + onClick(event, datum, proxyButton) { + if (this.doClick(event, datum, proxyButton)) { + event.preventDefault(); + } + } + getVisibleItemCount() { + return this.ctx.chartService.series.flatMap((s) => s.getLegendData("category")).filter((d) => d.enabled).length; + } + doClick(event, datum, proxyButton) { + const { + listeners: { legendItemClick }, + ctx: { chartService, highlightManager }, + preventHidingAll, + toggleSeries + } = this; + if (!datum) { + return false; + } + const { legendType, seriesId, itemId, enabled, legendItemName } = datum; + const series = chartService.series.find((s) => s.id === seriesId); + if (!series) { + return false; + } + let newEnabled = enabled; + const clickEvent = makeLegendItemEvent("click", datum, event); + if (legendItemClick) { + callWithContext([series.properties, this.ctx.chartService], legendItemClick, clickEvent.apiEvent); + } + if (clickEvent.defaultPrevented) + return true; + if (toggleSeries) { + newEnabled = !enabled; + if (preventHidingAll && !newEnabled) { + const numVisibleItems = this.getVisibleItemCount(); + if (numVisibleItems < 2) { + newEnabled = true; + } + } + proxyButton.setChecked(newEnabled); + this.ctx.eventsHub.emit("legend:item-click", { + legendType, + series, + itemId, + enabled: newEnabled, + legendItemName + }); + } + if (newEnabled) { + highlightManager.updateHighlight(this.id, { + series, + itemId, + datum: void 0, + datumIndex: void 0, + legendItemName + }); + } else { + highlightManager.updateHighlight(this.id); + } + this.ctx.legendManager.update(); + this.ctx.updateService.update(2 /* PROCESS_DATA */, { + forceNodeDataRefresh: true, + skipAnimations: datum.skipAnimations ?? false + }); + return true; + } + onDoubleClick(event, datum) { + if (this.doDoubleClick(event, datum)) { + event.preventDefault(); + } + } + doDoubleClick(event, datum) { + const { + listeners: { legendItemDoubleClick }, + ctx: { chartService }, + toggleSeries + } = this; + if (!datum) { + return false; + } + const { legendType, id, itemId, seriesId } = datum; + const series = chartService.series.find((s) => s.id === id); + if (!series) { + return false; + } + const doubleClickEvent = makeLegendItemEvent("dblclick", datum, event); + if (legendItemDoubleClick) { + callWithContext( + [series.properties, this.ctx.chartService], + legendItemDoubleClick, + doubleClickEvent.apiEvent + ); + } + if (doubleClickEvent.defaultPrevented) + return true; + if (toggleSeries) { + const legendData = chartService.series.flatMap((s) => s.getLegendData("category")); + let numVisibleItems = 0; + const visibleLegendItemNames = /* @__PURE__ */ new Set(); + for (const d of legendData) { + if (!d.enabled) + continue; + numVisibleItems += 1; + if (d.legendItemName != null) { + visibleLegendItemNames.add(d.legendItemName); + } + } + if (visibleLegendItemNames.size > 0) { + numVisibleItems = visibleLegendItemNames.size; + } + const clickedItem = legendData.find((d) => d.itemId === itemId && d.seriesId === seriesId); + this.ctx.eventsHub.emit("legend:item-double-click", { + legendType, + series, + itemId, + numVisibleItems, + enabled: clickedItem?.enabled ?? false, + legendItemName: clickedItem?.legendItemName + }); + } + this.ctx.legendManager.update(); + this.ctx.updateService.update(2 /* PROCESS_DATA */, { forceNodeDataRefresh: true }); + return true; + } + toTooltipMeta(event, node) { + let point; + if (event instanceof FocusEvent) { + point = Transformable.toCanvas(node).computeCenter(); + } else { + event.preventDefault(); + point = Transformable.toCanvasPoint(node, event.offsetX, event.offsetY); + } + return { canvasX: point.x, canvasY: point.y, showArrow: false }; + } + onHover(event, node) { + if (!this.enabled) + throw new Error("AG Charts - onHover handler called on disabled legend"); + this.pagination.setPage(node.pageIndex); + const datum = node.datum; + const series = datum ? this.ctx.chartService.series.find((s) => s.id === datum?.id) : void 0; + if (datum && this.truncatedItems.has(datum.itemId ?? datum.id)) { + const meta = this.toTooltipMeta(event, node); + this.ctx.tooltipManager.updateTooltip(this.id, meta, [ + { type: "structured", title: this.getItemLabel(datum) } + ]); + } else { + this.ctx.tooltipManager.removeTooltip(this.id); + } + if (datum?.enabled && series) { + this.updateHighlight({ + series, + itemId: datum?.itemId, + datum: void 0, + datumIndex: void 0, + legendItemName: datum?.legendItemName + }); + } else { + this.updateHighlight(); + } + } + onLeave() { + this.ctx.tooltipManager.removeTooltip(this.id); + this.updateHighlight(); + } + updateHighlight(datum) { + if (this.ctx.interactionManager.isState(32 /* Default */)) { + this.ctx.highlightManager.updateHighlight(this.id, datum); + } else if (this.ctx.interactionManager.isState(2 /* Animation */)) { + this.pendingHighlightDatum = datum; + this.ctx.animationManager.onBatchStop(() => { + this.ctx.highlightManager.updateHighlight(this.id, this.pendingHighlightDatum); + }); + } + } + onLocaleChanged() { + this.domProxy.onLocaleChanged(this.ctx.localeManager, this.itemSelection, this); + } + positionLegend(ctx) { + const oldPages = this.positionLegendScene(ctx); + this.positionLegendDOM(oldPages); + } + positionLegendScene(ctx) { + if (!this.enabled || !this.data.length) + return; + const { placement, floating, xOffset, yOffset } = expandLegendPosition(this.position); + const layoutBox = floating ? new BBox(0, 0, ctx.width, ctx.height) : ctx.layoutBox; + const { x, y, width: width2, height: height2 } = layoutBox; + const [legendWidth, legendHeight] = this.calculateLegendDimensions(layoutBox); + const { oldPages } = this.calcLayout(legendWidth, legendHeight); + const legendBBox = this.computePagedBBox(); + if (this.visible) { + let unreachable2 = function(_a) { + return void 0; + }; + var unreachable = unreachable2; + const legendSpacing = this.spacing; + let translationX; + let translationY; + switch (placement) { + case "top": + translationX = (width2 - legendBBox.width) / 2; + translationY = 0; + break; + case "bottom": + translationX = (width2 - legendBBox.width) / 2; + translationY = height2 - legendBBox.height; + break; + case "right": + translationX = width2 - legendBBox.width; + translationY = (height2 - legendBBox.height) / 2; + break; + case "left": + translationX = 0; + translationY = (height2 - legendBBox.height) / 2; + break; + case "top-right": + case "right-top": + translationX = width2 - legendBBox.width; + translationY = 0; + break; + case "top-left": + case "left-top": + translationX = 0; + translationY = 0; + break; + case "bottom-right": + case "right-bottom": + translationX = width2 - legendBBox.width; + translationY = height2 - legendBBox.height; + break; + case "bottom-left": + case "left-bottom": + translationX = 0; + translationY = height2 - legendBBox.height; + break; + default: + unreachable2(placement); + } + if (!floating) { + let shrinkAmount; + let shrinkDirection; + switch (placement) { + case "top": + case "top-right": + case "top-left": + shrinkAmount = legendBBox.height + legendSpacing; + shrinkDirection = "top"; + break; + case "bottom": + case "bottom-right": + case "bottom-left": + shrinkAmount = legendBBox.height + legendSpacing; + shrinkDirection = "bottom"; + break; + case "left": + case "left-top": + case "left-bottom": + shrinkAmount = legendBBox.width + legendSpacing; + shrinkDirection = "left"; + break; + case "right": + case "right-top": + case "right-bottom": + shrinkAmount = legendBBox.width + legendSpacing; + shrinkDirection = "right"; + break; + default: + unreachable2(placement); + } + layoutBox.shrink(shrinkAmount, shrinkDirection); + } + translationX += xOffset; + translationY += yOffset; + this.group.translationX = Math.floor(x + translationX - legendBBox.x); + this.group.translationY = Math.floor(y + translationY - legendBBox.y); + this.containerNode.x = legendBBox.x; + this.containerNode.y = legendBBox.y; + this.containerNode.width = legendBBox.width; + this.containerNode.height = legendBBox.height; + } + return oldPages; + } + positionLegendDOM(oldPages) { + const { ctx, itemSelection, pagination, pages: newPages, group } = this; + const visible = this.visible && this.enabled; + const interactive = this.isInteractive(); + this.domProxy.update({ + visible, + interactive, + ctx, + itemSelection, + group, + pagination, + oldPages, + newPages, + datumReader: this, + itemListener: this + }); + } + calculateLegendDimensions(shrinkRect) { + const { width: width2, height: height2 } = shrinkRect; + const { placement } = expandLegendPosition(this.position); + const aspectRatio = width2 / height2; + const maxCoefficient = 0.5; + const minHeightCoefficient = 0.2; + const minWidthCoefficient = 0.25; + let legendWidth, legendHeight; + function unreachable(_a) { + return void 0; + } + switch (placement) { + case "top": + case "top-left": + case "top-right": + case "bottom": + case "bottom-left": + case "bottom-right": { + const heightCoefficient = aspectRatio < 1 ? Math.min(maxCoefficient, minHeightCoefficient * (1 / aspectRatio)) : minHeightCoefficient; + legendWidth = this.maxWidth ? Math.min(this.maxWidth, width2) : width2; + legendHeight = this.maxHeight ? Math.min(this.maxHeight, height2) : Math.round(height2 * heightCoefficient); + break; + } + case "left": + case "left-top": + case "left-bottom": + case "right": + case "right-top": + case "right-bottom": { + const widthCoefficient = aspectRatio > 1 ? Math.min(maxCoefficient, minWidthCoefficient * aspectRatio) : minWidthCoefficient; + legendWidth = this.maxWidth ? Math.min(this.maxWidth, width2) : Math.round(width2 * widthCoefficient); + legendHeight = this.maxHeight ? Math.min(this.maxHeight, height2) : height2; + break; + } + default: + unreachable(placement); + } + return [legendWidth, legendHeight]; + } + cachedCallWithContext(fn, params) { + const { callbackCache, chartService } = this.ctx; + return callbackCache.call([this, chartService], fn, params); + } +}; +Legend.className = "Legend"; +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "toggleSeries", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "pagination", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "item", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "listeners", 2); +__decorateClass([ + ObserveChanges((target, newValue, oldValue) => { + target.updateGroupVisibility(); + if (newValue === oldValue) { + return; + } + const { + ctx: { legendManager, stateManager } + } = target; + if (oldValue === false && newValue === true) { + stateManager.restoreState(legendManager); + } + }), + addFakeTransformToInstanceProperty +], Legend.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "position", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "maxWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "maxHeight", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "reverseOrder", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "orientation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "preventHidingAll", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "border", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "cornerRadius", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "padding", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "spacing", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "xOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], Legend.prototype, "yOffset", 2); + +// packages/ag-charts-community/src/chart/legend/legendModule.ts +var CommunityLegendModule = { + type: "legend", + optionsKey: "legend", + identifier: "category", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Legend(ctx), + packageType: "community", + removable: "standalone-only" +}; + +// packages/ag-charts-community/src/chart/series-area/seriesArea.ts +var SeriesArea = class extends BaseProperties { + constructor(ctx) { + super(); + this.ctx = ctx; + this.rectNode = new Rect(); + this.border = new Border(this.rectNode); + this.cornerRadius = 0; + this.padding = 0; + this.cleanup = new CleanupRegistry(); + this.node = this.createNode(); + this.node.append([this.rectNode]); + this.rectNode.fill = void 0; + this.cleanup.register( + ctx.scene.attachNode(this.node), + ctx.eventsHub.on("layout:complete", (e) => this.onLayoutComplete(e)) + ); + } + destroy() { + this.cleanup.flush(); + } + getPadding() { + const { border, padding: padding2 } = this; + const strokeWidth = border.enabled ? border.strokeWidth : 0; + if (typeof padding2 === "number") { + const total = padding2 + strokeWidth; + return { top: total, right: total, bottom: total, left: total }; + } + return { + top: (padding2.top ?? 0) + strokeWidth, + right: (padding2.right ?? 0) + strokeWidth, + bottom: (padding2.bottom ?? 0) + strokeWidth, + left: (padding2.left ?? 0) + strokeWidth + }; + } + createNode() { + return new Group({ name: "series-area-container", zIndex: 4 /* SERIES_AREA_CONTAINER */ }); + } + onLayoutComplete(event) { + const { x, y, width: width2, height: height2 } = event.series.paddedRect; + this.rectNode.x = x; + this.rectNode.y = y; + this.rectNode.width = width2; + this.rectNode.height = height2; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesArea.prototype, "border", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesArea.prototype, "clip", 2); +__decorateClass([ + ProxyPropertyOnWrite("rectNode", "cornerRadius"), + addFakeTransformToInstanceProperty +], SeriesArea.prototype, "cornerRadius", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesArea.prototype, "padding", 2); + +// packages/ag-charts-community/src/chart/series-area/seriesAreaModule.ts +var SeriesAreaModule = { + type: "root", + optionsKey: "seriesArea", + packageType: "community", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new SeriesArea(ctx) +}; + +// packages/ag-charts-community/src/motion/pathMotion.ts +function pathMotion(groupId, subId, animationManager, paths, fns) { + const animate = (phase, path, collapsable, updateFn) => { + animationManager.animate({ + id: `${groupId}_${subId}_${path.id}_${phase}`, + groupId, + from: collapsable ? 1 : 0, + to: 1, + ease: easeOut, + collapsable, + onUpdate(ratio2, preInit) { + if (preInit && phase !== "removed") + return; + path.path.clear(true); + updateFn(ratio2, path); + path.checkPathDirty(); + }, + onStop() { + if (phase !== "added") + return; + path.path.clear(true); + updateFn(1, path); + path.checkPathDirty(); + }, + phase: NODE_UPDATE_STATE_TO_PHASE_MAPPING[phase] + }); + }; + const tempPath = new Path(); + const resultsChange = (updateFn) => { + tempPath.resetPathDirty(); + updateFn(0, tempPath); + tempPath.resetPathDirty(); + updateFn(1, tempPath); + tempPath.checkPathDirty(); + return tempPath.isPathDirty(); + }; + const { addPhaseFn, updatePhaseFn, removePhaseFn } = fns; + for (const path of paths) { + if (!animationManager.isSkipped()) { + animate("removed", path, !resultsChange(removePhaseFn), removePhaseFn); + animate("updated", path, !resultsChange(updatePhaseFn), updatePhaseFn); + } + animate("added", path, !resultsChange(addPhaseFn), addPhaseFn); + } +} + +// packages/ag-charts-community/src/chart/labelUtil.ts +function getLabelStyles(series, nodeDatum, params, label, isHighlight, activeHighlight) { + if (series.visible && label.itemStyler) { + const highlighted = isHighlight || series.isSeriesHighlighted(activeHighlight); + const highlightState = series.getHighlightStateString( + activeHighlight, + isHighlight || nodeDatum != null && activeHighlight?.series === nodeDatum.series && activeHighlight?.datumIndex === nodeDatum.datumIndex, + nodeDatum?.datumIndex + ); + const styleParams = { + border: label.border, + color: label.color, + cornerRadius: label.cornerRadius, + datum: nodeDatum?.datum, + enabled: label.enabled, + fill: label.fill, + fillOpacity: label.fillOpacity, + fontFamily: label.fontFamily, + fontSize: label.fontSize, + fontStyle: label.fontStyle, + fontWeight: label.fontWeight, + itemId: nodeDatum?.itemId, + // FIXME: AG-16068 + seriesId: series.id, + padding: label.padding, + highlighted, + highlightState + }; + const stylerResult = series.ctx.optionsGraphService.resolvePartial( + ["series", `${series.declarationOrder}`, "label"], + series.cachedCallWithContext(label.itemStyler, { ...params, ...styleParams }), + { pick: false } + ) ?? {}; + return mergeDefaults(stylerResult, styleParams); + } + return label; +} +function updateLabelNode(series, textNode, params, label, labelDatum, isHighlight, activeHighlight) { + if (series.visible && label.enabled && labelDatum) { + const style2 = getLabelStyles(series, textNode.datum, params, label, isHighlight, activeHighlight); + textNode.visible = true; + textNode.x = labelDatum.x; + textNode.y = labelDatum.y; + textNode.text = labelDatum.text; + textNode.fill = style2.color; + textNode.setAlign(labelDatum); + textNode.setFont(style2); + textNode.setBoxing(style2); + } else { + textNode.visible = false; + } +} +var placements = { + "inside-start": { inside: true, direction: -1, textAlignment: 1 }, + "inside-end": { inside: true, direction: 1, textAlignment: -1 }, + "outside-start": { inside: false, direction: -1, textAlignment: -1 }, + "outside-end": { inside: false, direction: 1, textAlignment: 1 } +}; +function adjustLabelPlacement({ + isUpward, + isVertical, + placement, + spacing = 0, + rect: rect2 +}) { + let x = rect2.x + rect2.width / 2; + let y = rect2.y + rect2.height / 2; + let textAlign = "center"; + let textBaseline = "middle"; + if (placement !== "inside-center") { + const barDirection = (isUpward ? 1 : -1) * (isVertical ? -1 : 1); + const { direction, textAlignment } = placements[placement]; + const displacementRatio = (direction + 1) * 0.5; + if (isVertical) { + const y0 = isUpward ? rect2.y + rect2.height : rect2.y; + const height2 = rect2.height * barDirection; + y = y0 + height2 * displacementRatio + spacing * textAlignment * barDirection; + textBaseline = textAlignment === barDirection ? "top" : "bottom"; + } else { + const x0 = isUpward ? rect2.x : rect2.x + rect2.width; + const width2 = rect2.width * barDirection; + x = x0 + width2 * displacementRatio + spacing * textAlignment * barDirection; + textAlign = textAlignment === barDirection ? "left" : "right"; + } + } + return { x, y, textAlign, textBaseline }; +} + +// packages/ag-charts-community/src/chart/series/seriesLabelUtil.ts +function seriesLabelFadeInAnimation({ id }, subId, animationManager, ...labelSelections) { + for (const labelSelection of labelSelections) { + labelSelection.cleanup(); + } + staticFromToMotion( + id, + subId, + animationManager, + labelSelections, + { opacity: 0 }, + { opacity: 1 }, + { phase: "trailing" } + ); +} +function seriesLabelFadeOutAnimation({ id }, subId, animationManager, ...labelSelections) { + staticFromToMotion( + id, + subId, + animationManager, + labelSelections, + { opacity: 1 }, + { opacity: 0 }, + { phase: "remove" } + ); +} +function resetLabelFn(_node) { + return { opacity: 1 }; +} + +// packages/ag-charts-community/src/chart/series/aggregation.ts +var AGGREGATION_INDEX_X_MIN = 0; +var AGGREGATION_INDEX_X_MAX = 1; +var AGGREGATION_INDEX_Y_MIN = 2; +var AGGREGATION_INDEX_Y_MAX = 3; +var AGGREGATION_SPAN = 4; +var SMALLEST_INTERVAL_MIN_RECURSE = 3; +var SMALLEST_INTERVAL_RECURSE_LIMIT = 20; +var SMALLEST_INTERVAL_MAX_INDEX_ADJUSTMENTS = 100; +function estimateSmallestPixelIntervalIter(xValues, d0, d1, startDatumIndex, endDatumIndex, currentSmallestInterval, depth, xNeedsValueOf) { + let indexAdjustments = 0; + while (indexAdjustments < SMALLEST_INTERVAL_MAX_INDEX_ADJUSTMENTS && xValues[startDatumIndex] == null && startDatumIndex < endDatumIndex) { + startDatumIndex += 1; + indexAdjustments += 1; + } + while (indexAdjustments < SMALLEST_INTERVAL_MAX_INDEX_ADJUSTMENTS && xValues[endDatumIndex] == null && endDatumIndex > startDatumIndex) { + endDatumIndex -= 1; + indexAdjustments += 1; + } + if (indexAdjustments >= SMALLEST_INTERVAL_MAX_INDEX_ADJUSTMENTS || startDatumIndex >= endDatumIndex) { + return currentSmallestInterval; + } + const ratio2 = Number.isFinite(d0) ? aggregationXRatioForXValue(xValues[endDatumIndex], d0, d1, xNeedsValueOf) - aggregationXRatioForXValue(xValues[startDatumIndex], d0, d1, xNeedsValueOf) : aggregationXRatioForDatumIndex(endDatumIndex, xValues.length) - aggregationXRatioForDatumIndex(startDatumIndex, xValues.length); + if (ratio2 === 0 || !Number.isFinite(ratio2)) + return currentSmallestInterval; + const currentInterval = Math.abs(ratio2) / (endDatumIndex - startDatumIndex); + let recurse; + if (depth < SMALLEST_INTERVAL_MIN_RECURSE) { + recurse = true; + } else if (depth > SMALLEST_INTERVAL_RECURSE_LIMIT) { + recurse = false; + } else { + recurse = currentInterval <= currentSmallestInterval; + } + currentSmallestInterval = Math.min(currentSmallestInterval, currentInterval); + if (!recurse) + return currentSmallestInterval; + const midIndex = Math.floor((startDatumIndex + endDatumIndex) / 2); + const leadingInterval = estimateSmallestPixelIntervalIter( + xValues, + d0, + d1, + startDatumIndex, + midIndex, + currentSmallestInterval, + depth + 1, + xNeedsValueOf + ); + const trailingInterval = estimateSmallestPixelIntervalIter( + xValues, + d0, + d1, + midIndex + 1, + endDatumIndex, + currentSmallestInterval, + depth + 1, + xNeedsValueOf + ); + return Math.min(leadingInterval, trailingInterval, currentSmallestInterval); +} +function estimateSmallestPixelInterval(xValues, d0, d1, xNeedsValueOf) { + return estimateSmallestPixelIntervalIter( + xValues, + d0, + d1, + 0, + xValues.length - 1, + 1 / (xValues.length - 1), + 0, + xNeedsValueOf + ); +} +function aggregationRangeFittingPoints(xValues, d0, d1, opts) { + if (Number.isFinite(d0)) { + const smallestKeyInterval = opts?.smallestKeyInterval; + const xNeedsValueOf = opts?.xNeedsValueOf ?? true; + const smallestPixelInterval = smallestKeyInterval == null ? estimateSmallestPixelInterval(xValues, d0, d1, xNeedsValueOf) : smallestKeyInterval / (d1 - d0); + return nextPowerOf2(Math.trunc(1 / smallestPixelInterval)) >> 3; + } else { + let power = Math.ceil(Math.log2(xValues.length)) - 1; + power = Math.min(Math.max(power, 0), 24); + return Math.trunc(2 ** power); + } +} +function aggregationDomain(scale2, domain) { + switch (scale2) { + case "category": + return [Number.NaN, Number.NaN]; + case "number": + case "time": + case "ordinal-time": + case "unit-time": { + let min = Infinity; + let max = -Infinity; + for (const d of domain) { + const value = Number(d); + min = Math.min(min, value); + max = Math.max(max, value); + } + return [min, max]; + } + case "color": + case "log": + case "mercator": + return [0, 0]; + } +} +function aggregationXRatioForDatumIndex(datumIndex, domainCount) { + return datumIndex / domainCount; +} +function aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf) { + if (xNeedsValueOf) { + return (xValue2.valueOf() - d0) / (d1 - d0); + } + return (xValue2 - d0) / (d1 - d0); +} +function aggregationIndexForXRatio(xRatio, maxRange) { + return Math.trunc(Math.min(Math.floor(xRatio * maxRange), maxRange - 1) * AGGREGATION_SPAN); +} +function createAggregationIndices(xValues, yMaxValues, yMinValues, d0, d1, maxRange, { + positive, + xNeedsValueOf = true, + yNeedsValueOf = true +} = {}) { + const indexData = new Int32Array(maxRange * AGGREGATION_SPAN).fill(-1); + const valueData = new Float64Array(maxRange * AGGREGATION_SPAN).fill(Number.NaN); + const continuous = Number.isFinite(d0) && Number.isFinite(d1); + const domainCount = xValues.length; + const domainRange = continuous ? d1 - d0 : 0; + const invDomainCount = 1 / domainCount; + let lastAggIndex = -1; + let cachedXMinIndex = -1; + let cachedXMinValue = Number.NaN; + let cachedXMaxIndex = -1; + let cachedXMaxValue = Number.NaN; + let cachedYMinIndex = -1; + let cachedYMinValue = Number.NaN; + let cachedYMaxIndex = -1; + let cachedYMaxValue = Number.NaN; + const flushCache = (aggIndex) => { + const baseIdx = aggIndex; + indexData[baseIdx + AGGREGATION_INDEX_X_MIN] = cachedXMinIndex; + indexData[baseIdx + AGGREGATION_INDEX_X_MAX] = cachedXMaxIndex; + indexData[baseIdx + AGGREGATION_INDEX_Y_MIN] = cachedYMinIndex; + indexData[baseIdx + AGGREGATION_INDEX_Y_MAX] = cachedYMaxIndex; + valueData[baseIdx + AGGREGATION_INDEX_X_MIN] = cachedXMinValue; + valueData[baseIdx + AGGREGATION_INDEX_X_MAX] = cachedXMaxValue; + valueData[baseIdx + AGGREGATION_INDEX_Y_MIN] = cachedYMinValue; + valueData[baseIdx + AGGREGATION_INDEX_Y_MAX] = cachedYMaxValue; + }; + const readCache = (aggIndex) => { + const baseIdx = aggIndex; + cachedXMinIndex = indexData[baseIdx + AGGREGATION_INDEX_X_MIN]; + cachedXMaxIndex = indexData[baseIdx + AGGREGATION_INDEX_X_MAX]; + cachedYMinIndex = indexData[baseIdx + AGGREGATION_INDEX_Y_MIN]; + cachedYMaxIndex = indexData[baseIdx + AGGREGATION_INDEX_Y_MAX]; + cachedXMinValue = valueData[baseIdx + AGGREGATION_INDEX_X_MIN]; + cachedXMaxValue = valueData[baseIdx + AGGREGATION_INDEX_X_MAX]; + cachedYMinValue = valueData[baseIdx + AGGREGATION_INDEX_Y_MIN]; + cachedYMaxValue = valueData[baseIdx + AGGREGATION_INDEX_Y_MAX]; + }; + const xValuesLength = xValues.length; + const yArraysSame = yMaxValues === yMinValues; + for (let datumIndex = 0; datumIndex < xValuesLength; datumIndex++) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const yMaxValue = yMaxValues[datumIndex]; + const yMinValue = yArraysSame ? yMaxValue : yMinValues[datumIndex]; + let yMax; + let yMin; + if (yNeedsValueOf) { + yMax = yMaxValue == null ? Number.NaN : yMaxValue.valueOf(); + yMin = yMinValue == null ? Number.NaN : yMinValue.valueOf(); + } else { + yMax = yMaxValue ?? Number.NaN; + yMin = yMinValue ?? Number.NaN; + } + if (positive != null && yMax >= 0 !== positive) + continue; + let xRatio; + if (continuous) { + if (xNeedsValueOf) { + xRatio = (xValue2.valueOf() - d0) / domainRange; + } else { + xRatio = (xValue2 - d0) / domainRange; + } + } else { + xRatio = datumIndex * invDomainCount; + } + const aggIndex = Math.trunc(Math.min(Math.floor(xRatio * maxRange), maxRange - 1) * AGGREGATION_SPAN); + if (aggIndex !== lastAggIndex) { + if (lastAggIndex !== -1) { + flushCache(lastAggIndex); + } + lastAggIndex = aggIndex; + readCache(aggIndex); + } + const yMinValid = !Number.isNaN(yMin); + const yMaxValid = !Number.isNaN(yMax); + if (cachedXMinIndex === -1) { + cachedXMinIndex = datumIndex; + cachedXMinValue = xRatio; + cachedXMaxIndex = datumIndex; + cachedXMaxValue = xRatio; + if (yMinValid) { + cachedYMinIndex = datumIndex; + cachedYMinValue = yMin; + } + if (yMaxValid) { + cachedYMaxIndex = datumIndex; + cachedYMaxValue = yMax; + } + } else { + if (xRatio < cachedXMinValue) { + cachedXMinIndex = datumIndex; + cachedXMinValue = xRatio; + } + if (xRatio > cachedXMaxValue) { + cachedXMaxIndex = datumIndex; + cachedXMaxValue = xRatio; + } + if (yMinValid && yMin < cachedYMinValue) { + cachedYMinIndex = datumIndex; + cachedYMinValue = yMin; + } + if (yMaxValid && yMax > cachedYMaxValue) { + cachedYMaxIndex = datumIndex; + cachedYMaxValue = yMax; + } + } + } + if (lastAggIndex !== -1) { + flushCache(lastAggIndex); + } + return { indexData, valueData }; +} +function compactAggregationIndices(indexData, valueData, maxRange, { inPlace = false } = {}) { + const nextMaxRange = Math.trunc(maxRange / 2); + const nextIndexData = inPlace ? indexData : new Int32Array(nextMaxRange * AGGREGATION_SPAN); + const nextValueData = inPlace ? valueData : new Float64Array(nextMaxRange * AGGREGATION_SPAN); + for (let i = 0; i < nextMaxRange; i += 1) { + const aggIndex = Math.trunc(i * AGGREGATION_SPAN); + const index0 = Math.trunc(aggIndex * 2); + const index1 = Math.trunc(index0 + AGGREGATION_SPAN); + const index1Unset = indexData[index1 + AGGREGATION_INDEX_X_MIN] === -1; + const xMinAggIndex = index1Unset || valueData[index0 + AGGREGATION_INDEX_X_MIN] < valueData[index1 + AGGREGATION_INDEX_X_MIN] ? index0 : index1; + nextIndexData[aggIndex + AGGREGATION_INDEX_X_MIN] = indexData[xMinAggIndex + AGGREGATION_INDEX_X_MIN]; + nextValueData[aggIndex + AGGREGATION_INDEX_X_MIN] = valueData[xMinAggIndex + AGGREGATION_INDEX_X_MIN]; + const xMaxAggIndex = index1Unset || valueData[index0 + AGGREGATION_INDEX_X_MAX] > valueData[index1 + AGGREGATION_INDEX_X_MAX] ? index0 : index1; + nextIndexData[aggIndex + AGGREGATION_INDEX_X_MAX] = indexData[xMaxAggIndex + AGGREGATION_INDEX_X_MAX]; + nextValueData[aggIndex + AGGREGATION_INDEX_X_MAX] = valueData[xMaxAggIndex + AGGREGATION_INDEX_X_MAX]; + const yMinAggIndex = index1Unset || valueData[index0 + AGGREGATION_INDEX_Y_MIN] < valueData[index1 + AGGREGATION_INDEX_Y_MIN] ? index0 : index1; + nextIndexData[aggIndex + AGGREGATION_INDEX_Y_MIN] = indexData[yMinAggIndex + AGGREGATION_INDEX_Y_MIN]; + nextValueData[aggIndex + AGGREGATION_INDEX_Y_MIN] = valueData[yMinAggIndex + AGGREGATION_INDEX_Y_MIN]; + const yMaxAggIndex = index1Unset || valueData[index0 + AGGREGATION_INDEX_Y_MAX] > valueData[index1 + AGGREGATION_INDEX_Y_MAX] ? index0 : index1; + nextIndexData[aggIndex + AGGREGATION_INDEX_Y_MAX] = indexData[yMaxAggIndex + AGGREGATION_INDEX_Y_MAX]; + nextValueData[aggIndex + AGGREGATION_INDEX_Y_MAX] = valueData[yMaxAggIndex + AGGREGATION_INDEX_Y_MAX]; + } + return { maxRange: nextMaxRange, indexData: nextIndexData, valueData: nextValueData }; +} + +// packages/ag-charts-community/src/chart/series/cartesian/areaAggregation.ts +var AGGREGATION_THRESHOLD = 1e3; +var MAX_POINTS = 10; +function aggregationIndexType(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return -1; + const xRatio = Number.isFinite(d0) ? aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf) : aggregationXRatioForDatumIndex(datumIndex, xValues.length); + const aggIndex = aggregationIndexForXRatio(xRatio, maxRange); + if (datumIndex === indexData[aggIndex + AGGREGATION_INDEX_X_MIN] || datumIndex === indexData[aggIndex + AGGREGATION_INDEX_X_MAX] || datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MIN] || datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MAX]) { + return aggIndex; + } + return -1; +} +function aggregateAreaData(scale2, xValues, yValues, domain, xNeedsValueOf, yNeedsValueOf) { + if (xValues.length < AGGREGATION_THRESHOLD) + return; + const [d0, d1] = aggregationDomain(scale2, domain); + let maxRange = aggregationRangeFittingPoints(xValues, d0, d1, { xNeedsValueOf }); + const { indexData, valueData } = createAggregationIndices(xValues, yValues, yValues, d0, d1, maxRange, { + xNeedsValueOf, + yNeedsValueOf + }); + let metaIndices = []; + let indices = []; + let currentGroup = -1; + for (let datumIndex = 0; datumIndex < xValues.length; datumIndex += 1) { + const group = aggregationIndexType(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf); + if (group === -1) + continue; + const newGroupIndex = indices.push(datumIndex) - 1; + if (group !== currentGroup) { + metaIndices.push(newGroupIndex); + currentGroup = group; + } + } + metaIndices.push(indices.length - 1); + const filters = [{ maxRange, metaIndices, indices }]; + while (indices.length > MAX_POINTS && maxRange > 64) { + ({ maxRange } = compactAggregationIndices(indexData, valueData, maxRange, { inPlace: true })); + const previousIndices = indices; + metaIndices = []; + indices = []; + currentGroup = -1; + for (const datumIndex of previousIndices) { + const group = aggregationIndexType(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf); + if (group === -1) + continue; + const newGroupIndex = indices.push(datumIndex) - 1; + if (group !== currentGroup) { + metaIndices.push(newGroupIndex); + currentGroup = group; + } + } + metaIndices.push(indices.length - 1); + filters.push({ maxRange, metaIndices, indices }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-community/src/scene/util/changeDetectableProperties.ts +var ChangeDetectableProperties = class extends BaseProperties { + constructor() { + super(...arguments); + this._dirty = true; + } + markDirty() { + this._dirty = true; + } + markClean(_opts) { + this._dirty = false; + } + isDirty() { + return this._dirty; + } + onChangeDetection(_property) { + this.markDirty(); + } +}; + +// packages/ag-charts-community/src/scene/dropShadow.ts +var DropShadow = class extends ChangeDetectableProperties { + constructor() { + super(...arguments); + this.enabled = true; + this.color = "rgba(0, 0, 0, 0.5)"; + this.xOffset = 0; + this.yOffset = 0; + this.blur = 5; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], DropShadow.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], DropShadow.prototype, "color", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], DropShadow.prototype, "xOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], DropShadow.prototype, "yOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], DropShadow.prototype, "blur", 2); + +// packages/ag-charts-community/src/chart/series/seriesMarker.ts +var SeriesMarker = class extends ChangeDetectableProperties { + constructor() { + super(...arguments); + this.enabled = true; + this.shape = "circle"; + this.size = 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle() { + const { size, shape, fill, fillOpacity, stroke: stroke3, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + size, + shape, + fill, + fillOpacity, + stroke: stroke3, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } + getDiameter() { + return this.size + this.strokeWidth; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], SeriesMarker.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneObjectChangeDetection({ equals: TRIPLE_EQ }) +], SeriesMarker.prototype, "shape", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], SeriesMarker.prototype, "size", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneObjectChangeDetection({ equals: objectsEqual }) +], SeriesMarker.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], SeriesMarker.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], SeriesMarker.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], SeriesMarker.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], SeriesMarker.prototype, "strokeOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesMarker.prototype, "lineDash", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesMarker.prototype, "lineDashOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneObjectChangeDetection({ equals: TRIPLE_EQ }) +], SeriesMarker.prototype, "itemStyler", 2); + +// packages/ag-charts-community/src/chart/series/seriesTooltip.ts +var SeriesTooltipInteraction = class extends BaseProperties { + constructor() { + super(...arguments); + this.enabled = false; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesTooltipInteraction.prototype, "enabled", 2); +var SeriesTooltip = class extends BaseProperties { + constructor() { + super(...arguments); + this.interaction = new SeriesTooltipInteraction(); + this.position = new TooltipPosition(); + this.range = void 0; + this.class = void 0; + } + formatTooltip(callers, content, params) { + const overrides = this.renderer == null ? void 0 : callWithContext(callers, this.renderer, params); + if (typeof overrides === "string") + return { type: "raw", rawHtmlString: overrides }; + if (overrides != null) + return { type: "structured", ...content, ...overrides }; + return { type: "structured", ...content }; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesTooltip.prototype, "enabled", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesTooltip.prototype, "showArrow", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesTooltip.prototype, "renderer", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesTooltip.prototype, "interaction", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesTooltip.prototype, "position", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesTooltip.prototype, "range", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], SeriesTooltip.prototype, "class", 2); +function makeSeriesTooltip() { + return new SeriesTooltip(); +} + +// packages/ag-charts-community/src/scene/shape/segmentedPath.ts +var SegmentedPath = class extends Path { + constructor() { + super(...arguments); + this.segmentPath = new Path(); + } + drawPath(ctx) { + if (!this.segments || this.segments.length === 0) { + super.drawPath(ctx); + return; + } + ctx.save(); + const inverse = new Path2D(); + rect(inverse, { x0: 0, y0: 0, x1: ctx.canvas.width, y1: ctx.canvas.height }, false); + for (const s of this.segments) { + rect(inverse, s.clipRect); + } + ctx.clip(inverse); + super.drawPath(ctx); + ctx.restore(); + const { segmentPath } = this; + segmentPath.setProperties({ + opacity: this.opacity, + visible: this.visible, + lineCap: this.lineCap, + lineJoin: this.lineJoin, + pointerEvents: this.pointerEvents + }); + for (const { clipRect, fill, stroke: stroke3, ...styles } of this.segments) { + ctx.save(); + segmentPath.path = this.path; + segmentPath.setProperties(styles); + segmentPath.fill = this.fill == null ? "none" : fill; + segmentPath.stroke = this.stroke == null ? "none" : stroke3; + const clipPath = new Path2D(); + rect(clipPath, clipRect); + ctx.clip(clipPath); + segmentPath.drawPath(ctx); + ctx.restore(); + } + } +}; +__decorateClass([ + SceneRefChangeDetection() +], SegmentedPath.prototype, "segments", 2); +function rect(path, { x0, y0, x1, y1 }, clockwise = true) { + const minX = Math.min(x0, x1); + const minY = Math.min(y0, y1); + const maxX = Math.max(x0, x1); + const maxY = Math.max(y0, y1); + path.moveTo(minX, minY); + if (clockwise) { + path.lineTo(maxX, minY); + path.lineTo(maxX, maxY); + path.lineTo(minX, maxY); + } else { + path.lineTo(minX, maxY); + path.lineTo(maxX, maxY); + path.lineTo(maxX, minY); + } + path.closePath(); +} + +// packages/ag-charts-community/src/scene/segmentedGroup.ts +var SegmentedGroup = class extends TranslatableGroup { + constructor() { + super(...arguments); + this.segments = []; + this.scalablePath = new (Scalable(Path))(); + } + renderInContext(childRenderCtx) { + if (!this.visible) + return; + const { ctx } = childRenderCtx; + if (!this.segments || this.segments?.length === 0) { + return super.renderInContext(childRenderCtx); + } + ctx.save(); + const inverse = new Path2D(); + rect(inverse, { x0: 0, y0: 0, x1: ctx.canvas.width, y1: ctx.canvas.height }, false); + for (const s of this.segments) { + rect(inverse, s.clipRect); + } + ctx.clip(inverse); + for (const child of this.children()) { + if (!child.visible) + continue; + child.render(childRenderCtx); + } + ctx.restore(); + const { scalablePath } = this; + for (const { clipRect, ...styles } of this.segments) { + ctx.save(); + const clipPath = new Path2D(); + rect(clipPath, clipRect); + ctx.clip(clipPath); + scalablePath.setProperties(styles); + for (const child of this.children()) { + if (!child.visible || !(child instanceof Path)) + continue; + scalablePath.path = child.path; + scalablePath.setProperties({ + opacity: child.opacity, + lineCap: child.lineCap, + lineJoin: child.lineJoin, + ...isScalable(child) && { + scalingX: child.scalingX, + scalingY: child.scalingY, + scalingCenterX: child.scalingCenterX, + scalingCenterY: child.scalingCenterY + } + }); + scalablePath.render(childRenderCtx); + } + ctx.restore(); + } + } +}; +__decorateClass([ + SceneRefChangeDetection() +], SegmentedGroup.prototype, "segments", 2); + +// packages/ag-charts-community/src/scene/util/quadtree.ts +var QuadtreeNearest = class { + constructor(capacity, maxdepth, boundary) { + this.root = new QuadtreeNodeNearest(capacity, maxdepth, boundary); + } + clear(boundary) { + this.root.clear(boundary); + } + addValue(hitTester, value) { + const elem = { + hitTester, + value, + distanceSquared: (x, y) => { + return hitTester.distanceSquared(x, y); + } + }; + this.root.addElem(elem); + } + find(x, y) { + const arg = { best: { nearest: void 0, distanceSquared: Infinity } }; + this.root.find(x, y, arg); + return arg.best; + } +}; +var QuadtreeSubdivisions = class { + constructor(nw, ne, sw, se) { + this.nw = nw; + this.ne = ne; + this.sw = sw; + this.se = se; + } + addElem(elem) { + this.nw.addElem(elem); + this.ne.addElem(elem); + this.sw.addElem(elem); + this.se.addElem(elem); + } + find(x, y, arg) { + this.nw.find(x, y, arg); + this.ne.find(x, y, arg); + this.sw.find(x, y, arg); + this.se.find(x, y, arg); + } +}; +var QuadtreeNode = class { + constructor(capacity, maxdepth, boundary) { + this.capacity = capacity; + this.maxdepth = maxdepth; + this.boundary = boundary ?? BBox.NaN; + this.elems = []; + this.subdivisions = void 0; + } + clear(boundary) { + this.elems.length = 0; + this.boundary = boundary; + this.subdivisions = void 0; + } + addElem(e) { + if (this.addCondition(e)) { + if (this.subdivisions === void 0) { + if (this.maxdepth === 0 || this.elems.length < this.capacity) { + this.elems.push(e); + } else { + this.subdivide(e); + } + } else { + this.subdivisions.addElem(e); + } + } + } + find(x, y, arg) { + if (this.findCondition(x, y, arg)) { + if (this.subdivisions === void 0) { + this.findAction(x, y, arg); + } else { + this.subdivisions.find(x, y, arg); + } + } + } + subdivide(newElem) { + this.subdivisions = this.makeSubdivisions(); + for (const e of this.elems) { + this.subdivisions.addElem(e); + } + this.subdivisions.addElem(newElem); + this.elems.length = 0; + } + makeSubdivisions() { + const { x, y, width: width2, height: height2 } = this.boundary; + const { capacity } = this; + const depth = this.maxdepth - 1; + const halfWidth = width2 / 2; + const halfHeight = height2 / 2; + const nwBoundary = new BBox(x, y, halfWidth, halfHeight); + const neBoundary = new BBox(x + halfWidth, y, halfWidth, halfHeight); + const swBoundary = new BBox(x, y + halfHeight, halfWidth, halfHeight); + const seBoundary = new BBox(x + halfWidth, y + halfHeight, halfWidth, halfHeight); + return new QuadtreeSubdivisions( + this.child(capacity, depth, nwBoundary), + this.child(capacity, depth, neBoundary), + this.child(capacity, depth, swBoundary), + this.child(capacity, depth, seBoundary) + ); + } +}; +var QuadtreeNodeNearest = class _QuadtreeNodeNearest extends QuadtreeNode { + addCondition(e) { + const { x, y } = e.hitTester.midPoint; + return this.boundary.containsPoint(x, y); + } + findCondition(x, y, arg) { + const { best } = arg; + return best.distanceSquared !== 0 && this.boundary.distanceSquared(x, y) < best.distanceSquared; + } + findAction(x, y, arg) { + const other = nearestSquared(x, y, this.elems, arg.best.distanceSquared); + if (other.nearest !== void 0 && other.distanceSquared < arg.best.distanceSquared) { + arg.best = other; + } + } + child(capacity, depth, boundary) { + return new _QuadtreeNodeNearest(capacity, depth, boundary); + } +}; + +// packages/ag-charts-community/src/chart/series/dataModelSeries.ts +var DataModelSeries = class extends Series { + constructor({ clipFocusBox, categoryKey, ...seriesOpts }) { + super(seriesOpts); + this.categoryKey = categoryKey; + this.clipFocusBox = clipFocusBox ?? true; + } + dataCount() { + return this.processedData?.dataSources?.get(this.id)?.data?.length ?? 0; + } + getHasData(axisKey) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return super.hasData; + } + const values = dataModel.resolveColumnById(this, axisKey, processedData); + for (const value of values) { + if (value != null && (typeof value !== "number" || !Number.isNaN(value))) { + return true; + } + } + return false; + } + getScaleInformation({ + xScale, + yScale + }) { + const isContinuousX = ContinuousScale.is(xScale); + const isContinuousY = ContinuousScale.is(yScale); + return { isContinuousX, isContinuousY, xScaleType: xScale?.type, yScaleType: yScale?.type }; + } + getModulePropertyDefinitions() { + const xScale = this.axes["x" /* X */]?.scale; + const yScale = this.axes["y" /* Y */]?.scale; + return this.moduleMap.mapModules((mod) => mod.getPropertyDefinitions(this.getScaleInformation({ xScale, yScale }))).flat(); + } + // Request data, but with message dispatching to series-options (modules). + async requestDataModel(dataController, dataSet, opts) { + opts.props.push(...this.getModulePropertyDefinitions()); + const { dataModel, processedData } = await dataController.request( + this.id, + dataSet ?? DataSet.empty(), + opts + ); + this.dataModel = dataModel; + this.processedData = processedData; + this.events.emit("data-processed", { dataModel, processedData }); + return { dataModel, processedData }; + } + isProcessedDataAnimatable() { + const { processedData, ctx } = this; + if (!processedData) + return false; + const nodeData = this.getNodeData(); + if (nodeData != null && nodeData.length > ctx.animationManager.maxAnimatableItems) + return false; + const validationResults = processedData.reduced?.animationValidation; + if (!validationResults) + return true; + const { orderedKeys, uniqueKeys } = validationResults; + return orderedKeys && uniqueKeys; + } + checkProcessedDataAnimatable() { + if (!this.isProcessedDataAnimatable()) { + this.ctx.animationManager.skipCurrentBatch(); + } + } + pickFocus(opts) { + const nodeData = this.getNodeData(); + if (nodeData === void 0 || nodeData.length === 0) { + return; + } + const datumIndex = this.computeFocusDatumIndex(opts, nodeData); + if (datumIndex === void 0) { + return; + } + const { clipFocusBox } = this; + const datum = nodeData[datumIndex]; + const derivedOpts = { ...opts, datumIndex }; + const bounds = this.computeFocusBounds(derivedOpts); + if (bounds !== void 0) { + return { bounds, clipFocusBox, datum, datumIndex }; + } + } + pickNodesExactShape(point) { + const datums = super.pickNodesExactShape(point); + datums.sort((a, b) => a.datumIndex - b.datumIndex); + return datums; + } + isDatumEnabled(nodeData, datumIndex) { + const { missing = false, enabled = true, focusable = true } = nodeData[datumIndex]; + return !missing && enabled && focusable; + } + computeFocusDatumIndex(opts, nodeData) { + const searchBackward = (datumIndex2, delta4) => { + while (datumIndex2 >= 0 && !this.isDatumEnabled(nodeData, datumIndex2)) { + datumIndex2 += delta4; + } + return datumIndex2 === -1 ? void 0 : datumIndex2; + }; + const searchForward = (datumIndex2, delta4) => { + while (datumIndex2 < nodeData.length && !this.isDatumEnabled(nodeData, datumIndex2)) { + datumIndex2 += delta4; + } + return datumIndex2 === nodeData.length ? void 0 : datumIndex2; + }; + let datumIndex; + const clampedIndex = clamp(0, opts.datumIndex, nodeData.length - 1); + if (opts.datumIndexDelta < 0) { + datumIndex = searchBackward(clampedIndex, opts.datumIndexDelta); + } else if (opts.datumIndexDelta > 0) { + datumIndex = searchForward(clampedIndex, opts.datumIndexDelta); + } else { + datumIndex = searchForward(clampedIndex, 1) ?? searchBackward(clampedIndex, -1); + } + if (datumIndex === void 0) { + if (opts.datumIndexDelta === 0) { + return; + } else { + return opts.datumIndex - opts.datumIndexDelta; + } + } else { + return datumIndex; + } + } + // Workaround - it would be nice if this difference didn't exist + dataModelPropertyIsKey(key) { + const { processedData } = this; + if (!processedData) + return false; + return processedData.defs.keys.some((def) => def.id === key && def.idsMap?.get(this.id)?.has(key) === true); + } + keysOrValues(xKey) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) + return []; + return this.dataModelPropertyIsKey(xKey) ? dataModel.resolveKeysById(this, xKey, processedData) : dataModel.resolveColumnById(this, xKey, processedData); + } + sortOrder(xKey) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) + return; + return this.dataModelPropertyIsKey(xKey) ? dataModel.getKeySortOrder(this, xKey, processedData) : dataModel.getColumnSortOrder(this, xKey, processedData); + } + getCategoryKey() { + return this.categoryKey; + } + getCategoryValue(datumIndex) { + const { processedData, dataModel } = this; + const categoryKey = this.getCategoryKey(); + if (!processedData || !dataModel || !categoryKey) + return; + const invalid = processedData.invalidData?.get(this.id)?.[datumIndex] ?? false; + return invalid ? void 0 : this.keysOrValues(categoryKey)[datumIndex]; + } + datumIndexForCategoryValue(categoryValue) { + const { processedData, dataModel } = this; + const categoryKey = this.getCategoryKey(); + if (!processedData || !dataModel || !categoryKey) + return; + categoryValue = categoryValue.valueOf(); + const invalidValues = processedData.invalidData?.get(this.id); + const xValues = this.keysOrValues(categoryKey); + for (let datumIndex = 0; datumIndex < xValues.length; datumIndex += 1) { + if (invalidValues?.[datumIndex] === true) + continue; + const xValue2 = xValues[datumIndex]?.valueOf(); + if (objectsEqual(categoryValue, xValue2)) + return datumIndex; + } + } +}; + +// packages/ag-charts-community/src/chart/series/cartesian/cartesianSeries.ts +var DEFAULT_CARTESIAN_DIRECTION_KEYS = { + ["x" /* X */]: ["xKey"], + ["y" /* Y */]: ["yKey"] +}; +var DEFAULT_CARTESIAN_DIRECTION_NAMES = { + ["x" /* X */]: ["xName"], + ["y" /* Y */]: ["yName"] +}; +var CartesianSeriesNodeEvent = class extends SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yKey = series.properties.yKey; + } +}; +var CartesianSeriesProperties = class extends SeriesProperties { + constructor() { + super(...arguments); + this.pickOutsideVisibleMinorAxis = false; + this.segmentation = new Segmentation(); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianSeriesProperties.prototype, "legendItemName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianSeriesProperties.prototype, "pickOutsideVisibleMinorAxis", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], CartesianSeriesProperties.prototype, "segmentation", 2); +var RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD = 100; +var CartesianSeries = class extends DataModelSeries { + constructor({ + pathsPerSeries = ["path"], + pathsZIndexSubOrderOffset = [], + datumSelectionGarbageCollection = true, + animationAlwaysUpdateSelections = false, + segmentedDataNodes = true, + animationResetFns, + propertyKeys, + propertyNames, + ...otherOpts + }) { + super({ + propertyKeys, + propertyNames, + canHaveAxes: true, + ...otherOpts + }); + this.NodeEvent = CartesianSeriesNodeEvent; + this.dataNodeGroup = this.contentGroup.appendChild( + new SegmentedGroup({ name: `${this.id}-series-dataNodes`, zIndex: 1 }) + ); + this.labelGroup = this.contentGroup.appendChild( + new TranslatableGroup({ name: `${this.id}-series-labels` }) + ); + this.labelSelection = Selection.select(this.labelGroup, Text); + this.highlightSelection = Selection.select(this.highlightGroup, () => this.nodeFactory()); + this.annotationSelections = /* @__PURE__ */ new Set(); + this.seriesBelowStackContext = void 0; + this.debug = Debug.create(); + if (!propertyKeys || !propertyNames) + throw new Error(`Unable to initialise series type ${this.type}`); + this.opts = { + pathsPerSeries, + pathsZIndexSubOrderOffset, + propertyKeys, + propertyNames, + animationResetFns, + animationAlwaysUpdateSelections, + datumSelectionGarbageCollection, + segmentedDataNodes + }; + this.paths = pathsPerSeries.map((path) => { + return new SegmentedPath({ name: `${this.id}-${path}` }); + }); + this.datumSelection = Selection.select( + this.dataNodeGroup, + () => this.nodeFactory(), + datumSelectionGarbageCollection + ); + this.animationState = new StateMachine( + "empty", + { + empty: { + update: { + target: "ready", + action: (data) => this.animateEmptyUpdateReady(data) + }, + reset: "empty", + skip: "ready", + disable: "disabled" + }, + ready: { + updateData: "waiting", + clear: "clearing", + highlight: (data) => this.animateReadyHighlight(data), + resize: (data) => this.animateReadyResize(data), + reset: "empty", + skip: "ready", + disable: "disabled" + }, + waiting: { + update: { + target: "ready", + action: (data) => { + if (this.ctx.animationManager.isSkipped()) { + this.resetAllAnimation(data); + } else { + this.animateWaitingUpdateReady(data); + } + } + }, + reset: "empty", + skip: "ready", + disable: "disabled" + }, + disabled: { + update: (data) => this.resetAllAnimation(data), + reset: "empty" + }, + clearing: { + update: { + target: "empty", + action: (data) => this.animateClearingUpdateEmpty(data) + }, + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + } + get contextNodeData() { + return this._contextNodeData; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + attachSeries(seriesContentNode, seriesNode, annotationNode) { + super.attachSeries(seriesContentNode, seriesNode, annotationNode); + this.attachPaths(this.paths); + } + detachSeries(seriesContentNode, seriesNode, annotationNode) { + super.detachSeries(seriesContentNode, seriesNode, annotationNode); + this.detachPaths(this.paths); + } + updatedDomains() { + this.animationState.transition("updateData"); + } + attachPaths(paths) { + for (const path of paths) { + this.contentGroup.appendChild(path); + } + } + detachPaths(paths) { + for (const path of paths) { + path.remove(); + } + } + renderToOffscreenCanvas() { + const nodeData = this.getNodeData(); + return nodeData != null && nodeData.length > RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } else if (phase === "disabled") { + this.animationState.transition("disable"); + } + } + addChartEventListeners() { + this.cleanup.register( + this.ctx.eventsHub.on("legend:item-click", (event) => this.onLegendItemClick(event)), + this.ctx.eventsHub.on("legend:item-double-click", (event) => this.onLegendItemDoubleClick(event)) + ); + } + destroy() { + super.destroy(); + this._contextNodeData = void 0; + } + isSeriesHighlighted(highlightedDatum) { + const { series, legendItemName: activeLegendItemName } = highlightedDatum ?? {}; + const { legendItemName } = this.properties; + return series === this || legendItemName != null && legendItemName === activeLegendItemName; + } + strokewidthChange() { + const unhighlightedStrokeWidth = ("strokeWidth" in this.properties && this.properties.strokeWidth) ?? 0; + const highlightedSeriesStrokeWidth = this.properties.highlight.highlightedSeries.strokeWidth ?? unhighlightedStrokeWidth; + const highlightedItemStrokeWidth = this.properties.highlight.highlightedItem?.strokeWidth ?? unhighlightedStrokeWidth; + return unhighlightedStrokeWidth > highlightedItemStrokeWidth || highlightedSeriesStrokeWidth > highlightedItemStrokeWidth; + } + update({ seriesRect }) { + const { _contextNodeData: previousContextData } = this; + const resize = this.checkResize(seriesRect); + const itemHighlighted = this.updateHighlightSelection(); + this.contentGroup.batchedUpdate(() => { + const dataChanged = this.updateSelections(); + const segments = this.contextNodeData?.segments; + if (this.opts.segmentedDataNodes) { + this.dataNodeGroup.segments = segments ?? this.dataNodeGroup.segments; + } else { + this.dataNodeGroup.segments = void 0; + } + this.updateNodes(itemHighlighted, resize || dataChanged); + }); + const animationData = this.getAnimationData(seriesRect, previousContextData); + if (!animationData) + return; + if (resize) { + this.animationState.transition("resize", animationData); + } + this.animationState.transition("update", animationData); + this.processedDataUpdated = false; + } + createStackContext() { + return void 0; + } + updateSelections() { + var _a; + const animationSkipUpdate = !this.opts.animationAlwaysUpdateSelections && this.ctx.animationManager.isSkipped(); + if (!this.visible && animationSkipUpdate) { + return false; + } + const { nodeDataRefresh } = this; + if (!nodeDataRefresh && !this.isPathOrSelectionDirty()) { + return false; + } + if (nodeDataRefresh) { + this.nodeDataRefresh = false; + this.debug(`CartesianSeries.updateSelections() - calling createNodeData() for`, this.id); + this.markQuadtreeDirty(); + this._contextNodeData = this.createNodeData(); + const animationValid = this.isProcessedDataAnimatable(); + if (this._contextNodeData) { + (_a = this._contextNodeData).animationValid ?? (_a.animationValid = animationValid); + } + const { dataModel, processedData } = this; + if (dataModel !== void 0 && processedData !== void 0) { + this.events.emit("data-update", { dataModel, processedData }); + } + this.updateSeriesSelections(); + } + return nodeDataRefresh; + } + updateSeriesSelections() { + const { datumSelection, labelSelection, paths } = this; + const contextData = this._contextNodeData; + if (!contextData) + return; + const { nodeData, labelData, itemId } = contextData; + this.updatePaths({ itemId, contextData, paths }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.labelGroup.batchedUpdate(() => { + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }) ?? labelSelection; + }); + } + getShapeFillBBox() { + const { axes } = this; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + const [axisX1, axisX2] = findMinMax(xAxis?.range ?? [0, 1]); + const [axisY1, axisY2] = findMinMax(yAxis?.range ?? [0, 1]); + const xSeriesDomain = this.getSeriesDomain("x" /* X */); + const xSeriesRange = [xAxis?.scale.convert(xSeriesDomain.at(0)), xAxis?.scale.convert(xSeriesDomain.at(-1))]; + const ySeriesDomain = this.getSeriesDomain("y" /* Y */); + const ySeriesRange = [yAxis?.scale.convert(ySeriesDomain.at(0)), yAxis?.scale.convert(ySeriesDomain.at(-1))]; + const [seriesX1, seriesX2] = findMinMax(xSeriesRange); + const [seriesY1, seriesY2] = findMinMax(ySeriesRange); + return { + axis: new BBox(axisX1, axisY1, axisX2 - axisX1, axisY2 - axisY1), + series: new BBox(seriesX1, seriesY1, seriesX2 - seriesX1, seriesY2 - seriesY1) + }; + } + updateNodes(itemHighlighted, nodeRefresh) { + const { highlightSelection, datumSelection } = this; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const visible = this.visible && this._contextNodeData != null; + this.contentGroup.visible = animationEnabled || visible; + this.highlightGroup.visible = (animationEnabled || visible) && itemHighlighted; + this.updateDatumStyles({ datumSelection: highlightSelection, isHighlight: true }); + const drawingMode = this.ctx.chartService.highlight?.drawingMode ?? "overlay"; + this.updateDatumNodes({ + datumSelection: highlightSelection, + isHighlight: true, + drawingMode + }); + this.animationState.transition("highlight", highlightSelection); + const { dataNodeGroup, labelSelection, paths, labelGroup } = this; + const { itemId } = this.contextNodeData ?? {}; + this.updatePathNodes({ itemId, paths, visible, animationEnabled }); + dataNodeGroup.visible = animationEnabled || visible; + labelGroup.visible = visible; + if (!dataNodeGroup.visible) { + return; + } + if (this.hasItemStylers()) { + this.updateDatumStyles({ datumSelection, isHighlight: false }); + } + const redrawAll = this.strokewidthChange() || this.hasChangesOnHighlight; + if (nodeRefresh || redrawAll) { + this.updateDatumNodes({ datumSelection, isHighlight: false, drawingMode: "overlay" }); + if (!this.usesPlacedLabels) { + this.labelGroup.batchedUpdate(() => { + this.updateLabelNodes({ labelSelection, isHighlight: false }); + }); + } + } + } + getHighlightData(_nodeData, highlightedItem) { + return highlightedItem ? [{ ...highlightedItem }] : void 0; + } + updateHighlightSelection() { + const { highlightSelection, _contextNodeData: contextNodeData } = this; + if (!contextNodeData) + return false; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const seriesHighlighted = this.isSeriesHighlighted(highlightedDatum); + const item = seriesHighlighted && highlightedDatum?.datum ? highlightedDatum : void 0; + if (item == null) + return false; + const { nodeData } = contextNodeData; + const highlightItems = this.getHighlightData(nodeData, item); + this.highlightSelection = this.updateHighlightSelectionItem({ + items: highlightItems, + highlightSelection + }); + return true; + } + markQuadtreeDirty() { + this.quadtree = void 0; + } + *datumNodesIter() { + for (const { node } of this.datumSelection) { + if (node.datum.missing === true) + continue; + yield node; + } + } + getQuadTree() { + if (this.quadtree === void 0) { + const { width: width2, height: height2 } = this.ctx.scene.canvas; + const canvasRect = new BBox(0, 0, width2, height2); + this.quadtree = new QuadtreeNearest(100, 10, canvasRect); + this.initQuadTree(this.quadtree); + } + return this.quadtree; + } + initQuadTree(_quadtree) { + } + pickNodeDataExactShape(point) { + const { x, y } = point; + const { dataNodeGroup } = this; + const matches = dataNodeGroup.pickNodes(x, y).filter((match) => match.datum.missing !== true); + if (matches.length !== 0) { + const datums = matches.map((match) => match.datum); + return datums; + } + } + pickModulesExactShape(point) { + for (const mod of this.moduleMap.modules()) { + const { datum } = mod.pickNodeExact(point) ?? {}; + if (datum == null) + continue; + if (datum?.missing === true) + continue; + return [datum]; + } + } + pickNodesExactShape(point) { + const result = super.pickNodesExactShape(point); + if (result.length !== 0) { + return result; + } + return this.pickNodeDataExactShape(point) ?? this.pickModulesExactShape(point) ?? []; + } + pickNodeDataClosestDatum(point) { + const { x, y } = point; + const { axes, _contextNodeData: contextNodeData } = this; + if (!contextNodeData) + return; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + const hitPoint = { x, y }; + let minDistanceSquared = Infinity; + let closestDatum; + for (const datum of contextNodeData.nodeData) { + const { point: { x: datumX = Number.NaN, y: datumY = Number.NaN } = {} } = datum; + if (Number.isNaN(datumX) || Number.isNaN(datumY)) { + continue; + } + const isInRange = xAxis?.inRange(datumX) && yAxis?.inRange(datumY); + if (!isInRange) { + continue; + } + const distanceSquared2 = Math.max((hitPoint.x - datumX) ** 2 + (hitPoint.y - datumY) ** 2, 0); + if (distanceSquared2 < minDistanceSquared) { + minDistanceSquared = distanceSquared2; + closestDatum = datum; + } + } + if (minDistanceSquared != null) { + return { datum: closestDatum, distance: Math.sqrt(minDistanceSquared) }; + } + } + pickModulesClosestDatum(point) { + let minDistanceSquared = Infinity; + let closestDatum; + for (const mod of this.moduleMap.modules()) { + const modPick = mod.pickNodeNearest(point); + if (modPick !== void 0 && modPick.distanceSquared < minDistanceSquared) { + minDistanceSquared = modPick.distanceSquared; + closestDatum = modPick.datum; + } + } + if (minDistanceSquared != null) { + return { datum: closestDatum, distance: Math.sqrt(minDistanceSquared) }; + } + } + pickNodeClosestDatum(point) { + let minDistance = Infinity; + let closestDatum; + const pick2 = this.pickNodeDataClosestDatum(point); + if (pick2 != null && pick2.distance < minDistance) { + minDistance = pick2.distance; + closestDatum = pick2.datum; + } + const modPick = this.pickModulesClosestDatum(point); + if (modPick != null && modPick.distance < minDistance) { + minDistance = modPick.distance; + closestDatum = modPick.datum; + } + if (closestDatum) { + const distance2 = Math.max(minDistance - (closestDatum.point?.size ?? 0) / 2, 0); + return { datum: closestDatum, distance: distance2 }; + } + } + pickNodeMainAxisFirst(point, requireCategoryAxis) { + const { x, y } = point; + const { axes, _contextNodeData: contextNodeData } = this; + const { pickOutsideVisibleMinorAxis } = this.properties; + if (!contextNodeData) + return; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (xAxis == null || yAxis == null) + return; + const directions2 = [xAxis, yAxis].filter((axis) => axis.isCategoryLike()).map((a) => a.direction); + if (requireCategoryAxis && directions2.length === 0) + return; + const [majorDirection = "x" /* X */] = directions2; + const hitPointCoords = [x, y]; + if (majorDirection !== "x" /* X */) + hitPointCoords.reverse(); + const minDistance = [Infinity, Infinity]; + let closestDatum; + for (const datum of contextNodeData.nodeData) { + const { x: datumX = Number.NaN, y: datumY = Number.NaN } = datum.point ?? datum.midPoint ?? {}; + if (Number.isNaN(datumX) || Number.isNaN(datumY) || datum.missing === true) + continue; + const visible = [xAxis?.inRange(datumX, 1), yAxis?.inRange(datumY, 1)]; + if (majorDirection !== "x" /* X */) { + visible.reverse(); + } + if (!visible[0] || !pickOutsideVisibleMinorAxis && !visible[1]) + continue; + const datumPoint = [datumX, datumY]; + if (majorDirection !== "x" /* X */) { + datumPoint.reverse(); + } + let newMinDistance = true; + for (let i = 0; i < datumPoint.length; i++) { + const dist = Math.abs(datumPoint[i] - hitPointCoords[i]); + if (dist > minDistance[i]) { + newMinDistance = false; + break; + } else if (dist < minDistance[i]) { + minDistance[i] = dist; + minDistance.fill(Infinity, i + 1, minDistance.length); + } + } + if (newMinDistance) { + closestDatum = datum; + } + } + if (closestDatum) { + let closestDistanceSquared = Math.max( + minDistance[0] ** 2 + minDistance[1] ** 2 - (closestDatum.point?.size ?? 0), + 0 + ); + for (const mod of this.moduleMap.modules()) { + const modPick = mod.pickNodeMainAxisFirst(point, majorDirection); + if (modPick !== void 0 && modPick.distanceSquared < closestDistanceSquared) { + closestDatum = modPick.datum; + closestDistanceSquared = modPick.distanceSquared; + break; + } + } + return { + datum: closestDatum, + distance: Math.sqrt(closestDistanceSquared) + }; + } + } + isPathOrSelectionDirty() { + return false; + } + shouldFlipXY() { + return false; + } + visibleRangeIndices(axisKey, visibleRange, indices, sortOrderParams) { + let sortOrder; + if (sortOrderParams == null) { + const { processedData, dataModel } = this; + sortOrder = dataModel.getColumnSortOrder(this, axisKey, processedData) ?? 1; + } else { + sortOrder = sortOrderParams.sortOrder; + } + const xValues = this.keysOrValues(axisKey); + const pixelSize = 0; + const [start2, end3] = visibleRangeIndices( + sortOrder, + indices?.length ?? xValues.length, + visibleRange, + (topIndex) => { + const datumIndex = indices?.[topIndex] ?? topIndex; + return this.xCoordinateRange(xValues[datumIndex], pixelSize, datumIndex); + } + ); + return start2 < end3 ? [start2, end3] : [end3, start2]; + } + domainForVisibleRange(_direction, axisKeys, crossAxisKey, visibleRange, indices) { + const { processedData, dataModel } = this; + const [r0, r1] = visibleRange; + const crossAxisValues = this.keysOrValues(crossAxisKey); + const sortOrder = this.sortOrder(crossAxisKey); + if (sortOrder != null) { + const crossAxisRange = this.visibleRangeIndices(crossAxisKey, visibleRange, indices, { sortOrder }); + return dataModel.getDomainBetweenRange(this, axisKeys, crossAxisRange, processedData); + } + const allAxisValues = axisKeys.map((axisKey) => this.keysOrValues(axisKey)); + let axisMin = Infinity; + let axisMax = -Infinity; + for (const [i, crossAxisValue] of crossAxisValues.entries()) { + const [x0, x1] = this.xCoordinateRange(crossAxisValue, 0, i); + if (x1 < r0 || x0 > r1) + continue; + for (let j = 0; j < axisKeys.length; j++) { + const axisValue = allAxisValues[j][i]; + axisMin = Math.min(axisMin, axisValue); + axisMax = Math.max(axisMax, axisValue); + } + } + if (axisMin > axisMax) + return [Number.NaN, Number.NaN]; + return [axisMin, axisMax]; + } + domainForClippedRange(direction, axisKeys, crossAxisKey) { + const { processedData, dataModel, axes } = this; + const crossDirection = direction === "x" /* X */ ? "y" /* Y */ : "x" /* X */; + const crossAxisRange = axisExtent(axes[crossDirection]); + if (!crossAxisRange) { + return axisKeys.flatMap((axisKey) => dataModel.getDomain(this, axisKey, "value", processedData)); + } + const crossAxisValues = this.keysOrValues(crossAxisKey); + const sortOrder = dataModel.getColumnSortOrder(this, crossAxisKey, processedData); + if (sortOrder != null) { + const crossRange = clippedRangeIndices( + sortOrder, + crossAxisValues.length, + crossAxisRange, + (index) => crossAxisValues[index] + ); + return dataModel.getDomainBetweenRange(this, axisKeys, crossRange, processedData); + } + const allAxisValues = axisKeys.map((axisKey) => this.keysOrValues(axisKey)); + const range0 = crossAxisRange[0].valueOf(); + const range1 = crossAxisRange[1].valueOf(); + const axisValues = []; + for (const [i, crossAxisValue] of crossAxisValues.entries()) { + const c = crossAxisValue.valueOf(); + if (c < range0 || c > range1) + continue; + const values = allAxisValues.map((v) => v[i]); + if (c >= range0) { + axisValues.push(...values); + } + if (c <= range1) { + axisValues.push(...values); + } + } + return axisValues; + } + zoomFittingVisibleItems(crossAxisKey, _axisKeys, xVisibleRange, yVisibleRange, minVisibleItems) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) + return; + const crossAxis = this.axes["x" /* X */]; + if (yVisibleRange != null) + return; + const sortOrder = this.sortOrder(crossAxisKey); + if (sortOrder == null) + return; + const xValues = this.keysOrValues(crossAxisKey); + if (minVisibleItems > xValues.length) { + return { x: [0, 1], y: void 0 }; + } + const crossScale = crossAxis.scale; + const crossScaleRange = crossScale.range; + crossScale.range = [0, 1]; + let [r0, r1] = this.visibleRangeIndices(crossAxisKey, xVisibleRange, void 0, { sortOrder }); + r1 -= 1; + const pixelSize = 0; + if (this.xCoordinateRange(xValues[r0], pixelSize, r0)[0] < xVisibleRange[0]) { + r0 += 1; + } + if (this.xCoordinateRange(xValues[r1], pixelSize, r1)[1] > xVisibleRange[1]) { + r1 -= 1; + } + let xZoom; + if (Math.abs(r1 - r0) >= minVisibleItems - 1) { + xZoom = xVisibleRange; + } else { + const midPoint = (xVisibleRange[0] + xVisibleRange[1]) / 2; + while (Math.abs(r1 - r0) < minVisibleItems - 1 && (r0 > 0 || r1 < xValues.length - 1)) { + if (r0 === 0) { + r1 += 1; + } else if (r1 === xValues.length - 1) { + r0 -= 1; + } else { + const nextR0X = this.xCoordinateRange(xValues[r0 - 1], pixelSize, r0 - 1)[0]; + const nextR1X = this.xCoordinateRange(xValues[r1 + 1], pixelSize, r1 + 1)[1]; + if (Math.abs(nextR0X - midPoint) < Math.abs(nextR1X - midPoint)) { + r0 -= 1; + } else { + r1 += 1; + } + } + } + const x0 = this.xCoordinateRange(xValues[r0], pixelSize, r0)[0]; + const x1 = this.xCoordinateRange(xValues[r1], pixelSize, r1)[1]; + xZoom = [Math.min(xVisibleRange[0], x0), Math.max(xVisibleRange[1], x1)]; + } + crossScale.range = crossScaleRange; + return { x: xZoom, y: void 0 }; + } + countVisibleItems(crossAxisKey, axisKeys, xVisibleRange, yVisibleRange, minVisibleItems) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) + return Infinity; + const crossValues = this.keysOrValues(crossAxisKey); + const allAxisValues = axisKeys.map((axisKey) => dataModel.resolveColumnById(this, axisKey, processedData)); + const shouldFlipXY = this.shouldFlipXY(); + const crossAxis = shouldFlipXY ? this.axes["y" /* Y */] : this.axes["x" /* X */]; + const axis = shouldFlipXY ? this.axes["x" /* X */] : this.axes["y" /* Y */]; + const crossVisibleRange = shouldFlipXY ? yVisibleRange ?? [0, 1] : xVisibleRange; + const axisVisibleRange = shouldFlipXY ? xVisibleRange : yVisibleRange ?? [0, 1]; + if (yVisibleRange == null) { + const sortOrder = this.sortOrder(crossAxisKey); + if (sortOrder != null) { + const crossScale = crossAxis.scale; + const crossScaleRange = crossScale.range; + crossScale.range = [0, 1]; + const xValues = this.keysOrValues(crossAxisKey); + let [r0, r1] = this.visibleRangeIndices(crossAxisKey, crossVisibleRange, void 0, { sortOrder }); + r1 -= 1; + const pixelSize2 = 0; + if (this.xCoordinateRange(xValues[r0], pixelSize2, r0)[0] < crossVisibleRange[0]) { + r0 += 1; + } + if (this.xCoordinateRange(xValues[r1], pixelSize2, r1)[1] > crossVisibleRange[1]) { + r1 -= 1; + } + const xItemsVisible = Math.abs(r1 - r0) + 1; + crossScale.range = crossScaleRange; + return xItemsVisible; + } + } + const convert2 = (d, r, v) => { + return d[0] + (v - r[0]) / (r[1] - r[0]) * (d[1] - d[0]); + }; + const crossAxisRange = crossAxis.range.toSorted(); + const axisRange = axis.range.toSorted(); + const crossMin = convert2(crossAxisRange, crossAxis.visibleRange, crossVisibleRange[0]); + const crossMax = convert2(crossAxisRange, crossAxis.visibleRange, crossVisibleRange[1]); + const axisMin = convert2(axisRange, axis.visibleRange, Math.min(...axisVisibleRange)); + const axisMax = convert2(axisRange, axis.visibleRange, Math.max(...axisVisibleRange)); + const startIndex = Math.round( + (crossVisibleRange[0] + (crossVisibleRange[1] - crossVisibleRange[0]) / 2) * crossValues.length + ); + const pixelSize = 0; + return countExpandingSearch(0, crossValues.length - 1, startIndex, minVisibleItems, (index) => { + const [cross0, cross1] = this.xCoordinateRange(crossValues[index], pixelSize, index); + const [axis0, axis1] = this.yCoordinateRange( + allAxisValues.map((axisValues) => axisValues[index]), + pixelSize, + index + ); + if (!isFiniteNumber(cross0) || !isFiniteNumber(cross1) || !isFiniteNumber(axis0) || !isFiniteNumber(axis1)) { + return false; + } + return cross0 >= crossMin && cross1 <= crossMax && axis0 >= axisMin && axis1 <= axisMax; + }); + } + // @todo(AG-13777) - Remove this function. + // We need data model updates to know if a data set is sorted & unique - and at the same time + // it should generate the equivalent of `SMALLEST_KEY_INTERVAL`. We'll use that value here + minTimeInterval() { + let xValues; + try { + xValues = this.keysOrValues("xValue"); + } catch { + } + if (xValues == null || xValues.length > 1e3) + return; + let minInterval = Infinity; + let x0 = xValues[0]; + let sortOrder; + for (let i = 1; i < xValues.length; i++) { + const x1 = xValues[i]; + if (x1 != null && x0 != null) { + const interval = x1.valueOf() - x0.valueOf(); + const sign = Math.sign(interval); + if (sign === 0) + continue; + if (sortOrder !== void 0 && sign !== sortOrder) + return; + minInterval = Math.min(minInterval, Math.abs(interval)); + sortOrder = sign; + } + x0 = x1; + } + if (Number.isFinite(minInterval)) + return minInterval; + } + updateHighlightSelectionItem(opts) { + const { items, highlightSelection } = opts; + const nodeData = items ?? []; + return this.updateDatumSelection({ + nodeData, + datumSelection: highlightSelection + }); + } + updateDatumSelection(opts) { + return opts.datumSelection; + } + updateDatumNodes(_opts) { + } + updateDatumStyles(_opts) { + } + updatePaths(opts) { + for (const p of opts.paths) { + p.visible = false; + } + } + updatePathNodes(opts) { + const { paths, visible } = opts; + for (const path of paths) { + path.visible = visible; + } + } + resetPathAnimation(data) { + const { path } = this.opts?.animationResetFns ?? {}; + if (path) { + for (const paths of data.paths) { + resetMotion([paths], path); + } + } + } + resetDatumAnimation(data) { + const { datum } = this.opts?.animationResetFns ?? {}; + if (datum) { + resetMotion([data.datumSelection], datum); + } + } + resetLabelAnimation(data) { + const { label } = this.opts?.animationResetFns ?? {}; + if (label) { + resetMotion([data.labelSelection], label); + } + } + resetAllAnimation(data) { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + this.resetPathAnimation(data); + this.resetDatumAnimation(data); + this.resetLabelAnimation(data); + if (data.contextData?.animationValid === false) { + this.ctx.animationManager.skipCurrentBatch(); + } + } + animateEmptyUpdateReady(data) { + this.ctx.animationManager.skipCurrentBatch(); + this.resetAllAnimation(data); + } + animateWaitingUpdateReady(data) { + this.ctx.animationManager.skipCurrentBatch(); + this.resetAllAnimation(data); + } + animateReadyHighlight(data) { + const { datum } = this.opts?.animationResetFns ?? {}; + if (datum) { + resetMotion([data], datum); + } + } + animateReadyResize(data) { + this.resetAllAnimation(data); + } + animateClearingUpdateEmpty(data) { + this.ctx.animationManager.skipCurrentBatch(); + this.resetAllAnimation(data); + } + getAnimationData(seriesRect, previousContextData) { + const { _contextNodeData: contextData } = this; + if (!contextData) + return; + const animationData = { + datumSelection: this.datumSelection, + labelSelection: this.labelSelection, + annotationSelections: [...this.annotationSelections], + contextData, + previousContextData, + paths: this.paths, + seriesRect + }; + return animationData; + } + updateLabelSelection(opts) { + return opts.labelSelection; + } + getScaling(scale2) { + if (scale2 instanceof LogScale) { + const { range: range4, domain } = scale2; + return { + type: "log", + convert: (d) => scale2.convert(d), + domain: [domain[0], domain[1]], + range: [range4[0], range4[1]] + }; + } else if (scale2 instanceof ContinuousScale) { + const { range: range4, domain } = scale2; + return { + type: "continuous", + domain: [domain[0], domain[1]], + range: [range4[0], range4[1]] + }; + } else if (scale2 instanceof BandScale) { + const domain = scale2 instanceof UnitTimeScale ? scale2.bands : scale2.domain; + return { + type: "category", + domain, + inset: scale2.inset, + step: scale2.step + }; + } + } + calculateScaling() { + const result = {}; + for (const direction of Object.values(ChartAxisDirection)) { + const axis = this.axes[direction]; + if (!axis) + continue; + const scalingResult = this.getScaling(axis.scale); + if (scalingResult != null) { + result[direction] = scalingResult; + } + } + return result; + } +}; +function axisExtent(axis) { + let min; + let max; + if (axis instanceof NumberAxis || axis instanceof TimeAxis) { + ({ min, max } = axis); + } + if (min == null && max == null) + return; + min ?? (min = -Infinity); + max ?? (max = Infinity); + return [min, max]; +} +function clippedRangeIndices(sortOrder, length2, range4, xValue2) { + const range0 = range4[0].valueOf(); + const range1 = range4[1].valueOf(); + let xMinIndex = findMinIndex(0, length2 - 1, (i) => { + const index = sortOrder === 1 ? i : length2 - i; + const x = xValue2(index)?.valueOf(); + return !Number.isFinite(x) || x >= range0; + }); + let xMaxIndex = findMaxIndex(0, length2 - 1, (i) => { + const index = sortOrder === 1 ? i : length2 - i; + const x = xValue2(index)?.valueOf(); + return !Number.isFinite(x) || x <= range1; + }); + if (xMinIndex == null || xMaxIndex == null) + return [0, 0]; + if (sortOrder === -1) { + [xMinIndex, xMaxIndex] = [length2 - xMaxIndex, length2 - xMinIndex]; + } + xMinIndex = Math.max(xMinIndex, 0); + xMaxIndex = Math.min(xMaxIndex + 1, length2); + return [xMinIndex, xMaxIndex]; +} + +// packages/ag-charts-community/src/chart/series/cartesian/interpolationProperties.ts +var InterpolationProperties = class extends BaseProperties { + constructor() { + super(...arguments); + this.type = "linear"; + this.tension = 1; + this.position = "end"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], InterpolationProperties.prototype, "type", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], InterpolationProperties.prototype, "tension", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], InterpolationProperties.prototype, "position", 2); + +// packages/ag-charts-community/src/chart/series/cartesian/areaSeriesProperties.ts +var AreaSeriesProperties = class extends CartesianSeriesProperties { + constructor() { + super(...arguments); + this.xName = void 0; + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#874349"; + this.strokeWidth = 2; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.interpolation = new InterpolationProperties(); + this.shadow = new DropShadow(); + this.marker = new SeriesMarker(); + this.label = new Label(); + this.tooltip = makeSeriesTooltip(); + this.connectMissingData = false; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "xName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "yName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "yFilterKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "normalizedTo", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "interpolation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "styler", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "shadow", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "marker", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "label", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], AreaSeriesProperties.prototype, "connectMissingData", 2); + +// packages/ag-charts-community/src/chart/series/cartesian/lineInterpolation.ts +function spanRange(span) { + switch (span.type) { + case "linear": + case "step": + case "multi-line": + return [ + { x: span.x0, y: span.y0 }, + { x: span.x1, y: span.y1 } + ]; + case "cubic": + return [ + { x: span.cp0x, y: span.cp0y }, + { x: span.cp3x, y: span.cp3y } + ]; + } +} +function spanRangeNormalized(span) { + const range4 = spanRange(span); + if (range4[0].x > range4[1].x) { + range4.reverse(); + } + return range4; +} +function collapseSpanToPoint(span, point) { + const { x, y } = point; + switch (span.type) { + case "linear": + return { + type: "linear", + moveTo: span.moveTo, + x0: x, + y0: y, + x1: x, + y1: y + }; + case "step": + return { + type: "step", + moveTo: span.moveTo, + x0: x, + y0: y, + x1: x, + y1: y, + stepX: x + }; + case "cubic": + return { + type: "cubic", + moveTo: span.moveTo, + cp0x: x, + cp0y: y, + cp1x: x, + cp1y: y, + cp2x: x, + cp2y: y, + cp3x: x, + cp3y: y + }; + case "multi-line": + return { + type: "multi-line", + moveTo: span.moveTo, + x0: x, + y0: y, + x1: x, + y1: y, + midPoints: span.midPoints.map(() => ({ x, y })) + }; + } +} +function rescaleSpan(span, nextStart, nextEnd) { + const [prevStart, prevEnd] = spanRange(span); + const widthScale = prevEnd.x === prevStart.x ? 0 : (nextEnd.x - nextStart.x) / (prevEnd.x - prevStart.x); + const heightScale = prevEnd.y === prevStart.y ? 0 : (nextEnd.y - nextStart.y) / (prevEnd.y - prevStart.y); + switch (span.type) { + case "linear": + return { + type: "linear", + moveTo: span.moveTo, + x0: nextStart.x, + y0: nextStart.y, + x1: nextEnd.x, + y1: nextEnd.y + }; + case "cubic": + return { + type: "cubic", + moveTo: span.moveTo, + cp0x: nextStart.x, + cp0y: nextStart.y, + cp1x: nextEnd.x - (span.cp2x - prevStart.x) * widthScale, + cp1y: nextEnd.y - (span.cp2y - prevStart.y) * heightScale, + cp2x: nextEnd.x - (span.cp1x - prevStart.x) * widthScale, + cp2y: nextEnd.y - (span.cp1y - prevStart.y) * heightScale, + cp3x: nextEnd.x, + cp3y: nextEnd.y + }; + case "step": + return { + type: "step", + moveTo: span.moveTo, + x0: nextStart.x, + y0: nextStart.y, + x1: nextEnd.x, + y1: nextEnd.y, + stepX: nextEnd.x - (span.stepX - prevStart.x) * widthScale + }; + case "multi-line": + return { + type: "multi-line", + moveTo: span.moveTo, + x0: nextStart.x, + y0: nextStart.y, + x1: nextEnd.x, + y1: nextEnd.y, + midPoints: span.midPoints.map((midPoint) => ({ + x: nextStart.x + (midPoint.x - prevStart.x) * widthScale, + y: nextStart.y + (midPoint.y - prevStart.y) * heightScale + })) + }; + } +} +function clipSpanX(span, x0, x1) { + const { moveTo: moveTo2 } = span; + const [start2, end3] = spanRangeNormalized(span); + const { x: spanX0, y: spanY0 } = start2; + const { x: spanX1, y: spanY1 } = end3; + if (x1 < spanX0) { + return rescaleSpan(span, start2, start2); + } else if (x0 > spanX1) { + return rescaleSpan(span, end3, end3); + } + switch (span.type) { + case "linear": { + const m = spanY0 === spanY1 ? void 0 : (spanY1 - spanY0) / (spanX1 - spanX0); + const y0 = m == null ? spanY0 : m * (x0 - spanX0) + spanY0; + const y1 = m == null ? spanY0 : m * (x1 - spanX0) + spanY0; + return { type: "linear", moveTo: moveTo2, x0, y0, x1, y1 }; + } + case "step": + if (x1 <= span.stepX) { + const y = span.y0; + return { type: "step", moveTo: moveTo2, x0, y0: y, x1, y1: y, stepX: x1 }; + } else if (x0 >= span.stepX) { + const y = span.y1; + return { type: "step", moveTo: moveTo2, x0, y0: y, x1, y1: y, stepX: x0 }; + } else { + const { y0, y1, stepX } = span; + return { type: "step", moveTo: moveTo2, x0, y0, x1, y1, stepX }; + } + case "cubic": { + const t0 = solveBezier(span.cp0x, span.cp1x, span.cp2x, span.cp3x, x0); + let [_unused, bezier] = splitBezier2D( + span.cp0x, + span.cp0y, + span.cp1x, + span.cp1y, + span.cp2x, + span.cp2y, + span.cp3x, + span.cp3y, + t0 + ); + const t1 = solveBezier(bezier[0].x, bezier[1].x, bezier[2].x, bezier[3].x, x1); + [bezier, _unused] = splitBezier2D( + bezier[0].x, + bezier[0].y, + bezier[1].x, + bezier[1].y, + bezier[2].x, + bezier[2].y, + bezier[3].x, + bezier[3].y, + t1 + ); + return { + type: "cubic", + moveTo: moveTo2, + cp0x: bezier[0].x, + cp0y: bezier[0].y, + cp1x: bezier[1].x, + cp1y: bezier[1].y, + cp2x: bezier[2].x, + cp2y: bezier[2].y, + cp3x: bezier[3].x, + cp3y: bezier[3].y + }; + } + case "multi-line": { + const { midPoints } = span; + const midPointStartIndex = midPoints.findLastIndex((midPoint) => midPoint.x <= x0); + let midPointEndIndex = midPoints.findIndex((midPoint) => midPoint.x >= x1); + if (midPointEndIndex === -1) + midPointEndIndex = midPoints.length; + const startPoint = midPointStartIndex >= 0 ? midPoints[midPointStartIndex] : void 0; + const startX = startPoint?.x ?? spanX0; + const startY = startPoint?.y ?? spanY0; + const endPoint = midPointEndIndex < midPoints.length ? midPoints[midPointEndIndex] : void 0; + const endX = endPoint?.x ?? spanX1; + const endY = endPoint?.y ?? spanY1; + const m = startY === endY ? void 0 : (endY - startY) / (endX - startX); + const y0 = m == null ? startY : m * (startX - spanX0) + startY; + const y1 = m == null ? startY : m * (endX - spanX0) + startY; + return { + type: "multi-line", + moveTo: moveTo2, + x0, + y0, + x1, + y1, + midPoints: midPoints.slice(Math.max(midPointStartIndex, 0), midPointEndIndex) + }; + } + } +} +var SpanJoin = /* @__PURE__ */ ((SpanJoin2) => { + SpanJoin2[SpanJoin2["MoveTo"] = 0] = "MoveTo"; + SpanJoin2[SpanJoin2["LineTo"] = 1] = "LineTo"; + SpanJoin2[SpanJoin2["Skip"] = 2] = "Skip"; + return SpanJoin2; +})(SpanJoin || {}); +function linearPoints(points) { + const spans = []; + let i = 0; + let x0 = Number.NaN; + let y0 = Number.NaN; + for (const { x: x1, y: y1 } of points) { + if (i > 0) { + const moveTo2 = i === 1; + spans.push({ type: "linear", moveTo: moveTo2, x0, y0, x1, y1 }); + } + i += 1; + x0 = x1; + y0 = y1; + } + return spans; +} +var lineSteps = { + start: 0, + middle: 0.5, + end: 1 +}; +function stepPoints(points, position) { + const spans = []; + let i = 0; + let x0 = Number.NaN; + let y0 = Number.NaN; + const p0 = typeof position === "number" ? position : lineSteps[position]; + for (const { x: x1, y: y1 } of points) { + if (i > 0) { + const moveTo2 = i === 1; + const stepX = x0 + (x1 - x0) * p0; + spans.push({ type: "step", moveTo: moveTo2, x0, y0, x1, y1, stepX }); + } + i += 1; + x0 = x1; + y0 = y1; + } + return spans; +} +var flatnessRatio = 0.05; +function smoothPoints(iPoints, tension) { + const points = Array.isArray(iPoints) ? iPoints : Array.from(iPoints); + if (points.length <= 1) + return []; + const gradients = points.map((c, i) => { + const p = i === 0 ? c : points[i - 1]; + const n = i === points.length - 1 ? c : points[i + 1]; + const isTerminalPoint = i === 0 || i === points.length - 1; + if (Math.sign(p.y - c.y) === Math.sign(n.y - c.y)) { + return 0; + } + if (!isTerminalPoint) { + const range4 = Math.abs(p.y - n.y); + const prevRatio = Math.abs(c.y - p.y) / range4; + const nextRatio = Math.abs(c.y - n.y) / range4; + if (prevRatio <= flatnessRatio || 1 - prevRatio <= flatnessRatio || nextRatio <= flatnessRatio || 1 - nextRatio <= flatnessRatio) { + return 0; + } + } + return (n.y - p.y) / (n.x - p.x); + }); + if (gradients[1] === 0) { + gradients[0] *= 2; + } + if (gradients.at(-2) === 0) { + gradients[gradients.length - 1] *= 2; + } + const spans = []; + for (let i = 1; i < points.length; i += 1) { + const prev = points[i - 1]; + const prevM = gradients[i - 1]; + const cur = points[i]; + const curM = gradients[i]; + const dx2 = cur.x - prev.x; + const dy2 = cur.y - prev.y; + let dcp1x = dx2 * tension / 3; + let dcp1y = dx2 * prevM * tension / 3; + let dcp2x = dx2 * tension / 3; + let dcp2y = dx2 * curM * tension / 3; + if (curM === 0 && Math.abs(dcp1y) > Math.abs(dy2)) { + dcp1x *= Math.abs(dy2 / dcp1y); + dcp1y = Math.sign(dcp1y) * Math.abs(dy2); + } + if (prevM === 0 && Math.abs(dcp2y) > Math.abs(dy2)) { + dcp2x *= Math.abs(dy2 / dcp2y); + dcp2y = Math.sign(dcp2y) * Math.abs(dy2); + } + spans.push({ + type: "cubic", + moveTo: i === 1, + cp0x: prev.x, + cp0y: prev.y, + cp1x: prev.x + dcp1x, + cp1y: prev.y + dcp1y, + cp2x: cur.x - dcp2x, + cp2y: cur.y - dcp2y, + cp3x: cur.x, + cp3y: cur.y + }); + } + return spans; +} + +// packages/ag-charts-community/src/chart/series/cartesian/lineInterpolationPlotting.ts +function lerp2(a, b, ratio2) { + return (b - a) * ratio2 + a; +} +function linearSupertype(span, stepX) { + const { x0, y0, x1, y1 } = span; + const m = (y1 - y0) / (x1 - x0); + const stepY = m * (stepX - x0) + y0; + return { + leftCp1x: x0, + leftCp1y: y0, + leftCp2x: stepX, + leftCp2y: stepY, + stepX, + stepY0: stepY, + stepY1: stepY, + rightCp1x: stepX, + rightCp1y: stepY, + rightCp2x: x1, + rightCp2y: y1 + }; +} +function bezierSupertype(span, stepX) { + const { cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y } = span; + const t = solveBezier(cp0x, cp1x, cp2x, cp3x, stepX); + const [left, right] = splitBezier2D(cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y, t); + const stepY = left[3].y; + return { + leftCp1x: left[1].x, + leftCp1y: left[1].y, + leftCp2x: left[2].x, + leftCp2y: left[2].y, + stepX, + stepY0: stepY, + stepY1: stepY, + rightCp1x: right[1].x, + rightCp1y: right[1].y, + rightCp2x: right[2].x, + rightCp2y: right[2].y + }; +} +function stepSupertype(span) { + const { x0, y0, x1, y1, stepX } = span; + return { + leftCp1x: (x0 + stepX) / 2, + leftCp1y: y0, + leftCp2x: (x0 + stepX) / 2, + leftCp2y: y0, + stepX, + stepY0: y0, + stepY1: y1, + rightCp1x: (stepX + x1) / 2, + rightCp1y: y1, + rightCp2x: (stepX + x1) / 2, + rightCp2y: y1 + }; +} +function spanSupertype(span, stepX) { + if (span.type === "linear") { + return linearSupertype(span, stepX); + } else if (span.type === "cubic") { + return bezierSupertype(span, stepX); + } else if (span.type === "step") { + return stepSupertype(span); + } else { + return linearSupertype(span, stepX); + } +} +function plotStart(path, moveTo2, x0, y0, x1, y1, reversed) { + switch (moveTo2) { + case 0 /* MoveTo */: + if (reversed) { + path.moveTo(x1, y1); + } else { + path.moveTo(x0, y0); + } + break; + case 1 /* LineTo */: + if (reversed) { + path.lineTo(x1, y1); + } else { + path.lineTo(x0, y0); + } + break; + case 2 /* Skip */: + break; + } +} +function plotLinear(path, x0, y0, x1, y1, reversed) { + if (reversed) { + path.lineTo(x0, y0); + } else { + path.lineTo(x1, y1); + } +} +function plotCubic(path, cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y, reversed) { + if (reversed) { + path.cubicCurveTo(cp2x, cp2y, cp1x, cp1y, cp0x, cp0y); + } else { + path.cubicCurveTo(cp1x, cp1y, cp2x, cp2y, cp3x, cp3y); + } +} +function plotStep(path, x0, y0, x1, y1, stepX, reversed) { + if (reversed) { + path.lineTo(stepX, y1); + path.lineTo(stepX, y0); + path.lineTo(x0, y0); + } else { + path.lineTo(stepX, y0); + path.lineTo(stepX, y1); + path.lineTo(x1, y1); + } +} +function plotMultiLine(path, x0, y0, x1, y1, midPoints, reversed) { + if (reversed) { + for (let i = midPoints.length - 1; i >= 0; i--) { + const { x, y } = midPoints[i]; + path.lineTo(x, y); + } + path.lineTo(x0, y0); + } else { + for (const { x, y } of midPoints) { + path.lineTo(x, y); + } + path.lineTo(x1, y1); + } +} +function plotSpan(path, span, moveTo2, reversed) { + const [start2, end3] = spanRange(span); + plotStart(path, moveTo2, start2.x, start2.y, end3.x, end3.y, reversed); + switch (span.type) { + case "linear": + plotLinear(path, span.x0, span.y0, span.x1, span.y1, reversed); + break; + case "cubic": + plotCubic( + path, + span.cp0x, + span.cp0y, + span.cp1x, + span.cp1y, + span.cp2x, + span.cp2y, + span.cp3x, + span.cp3y, + reversed + ); + break; + case "step": + plotStep(path, span.x0, span.y0, span.x1, span.y1, span.stepX, reversed); + break; + case "multi-line": + plotMultiLine(path, span.x0, span.y0, span.x1, span.y1, span.midPoints, reversed); + break; + } +} +function interpolatedSpanRange(a, b, ratio2) { + const [aStart, aEnd] = spanRange(a); + const [bStart, bEnd] = spanRange(b); + const x0 = lerp2(aStart.x, bStart.x, ratio2); + const y0 = lerp2(aStart.y, bStart.y, ratio2); + const x1 = lerp2(aEnd.x, bEnd.x, ratio2); + const y1 = lerp2(aEnd.y, bEnd.y, ratio2); + return [ + { x: x0, y: y0 }, + { x: x1, y: y1 } + ]; +} +function plotInterpolatedSpans(path, a, b, ratio2, moveTo2, reversed) { + const [{ x: x0, y: y0 }, { x: x1, y: y1 }] = interpolatedSpanRange(a, b, ratio2); + plotStart(path, moveTo2, x0, y0, x1, y1, reversed); + if (a.type === "cubic" && b.type === "cubic") { + const cp1x = lerp2(a.cp1x, b.cp1x, ratio2); + const cp1y = lerp2(a.cp1y, b.cp1y, ratio2); + const cp2x = lerp2(a.cp2x, b.cp2x, ratio2); + const cp2y = lerp2(a.cp2y, b.cp2y, ratio2); + plotCubic(path, x0, y0, cp1x, cp1y, cp2x, cp2y, x1, y1, reversed); + } else if (a.type === "step" && b.type === "step") { + const stepX = lerp2(a.stepX, b.stepX, ratio2); + plotStep(path, x0, y0, x1, y1, stepX, reversed); + } else if (a.type === "linear" && b.type === "linear") { + plotLinear(path, x0, y0, x1, y1, reversed); + } else { + let defaultStepX; + if (a.type === "step") { + defaultStepX = a.stepX; + } else if (b.type === "step") { + defaultStepX = b.stepX; + } else { + defaultStepX = (x0 + x1) / 2; + } + const as = spanSupertype(a, defaultStepX); + const bs = spanSupertype(b, defaultStepX); + const leftCp1x = lerp2(as.leftCp1x, bs.leftCp1x, ratio2); + const leftCp1y = lerp2(as.leftCp1y, bs.leftCp1y, ratio2); + const leftCp2x = lerp2(as.leftCp2x, bs.leftCp2x, ratio2); + const leftCp2y = lerp2(as.leftCp2y, bs.leftCp2y, ratio2); + const stepX = lerp2(as.stepX, bs.stepX, ratio2); + const stepY0 = lerp2(as.stepY0, bs.stepY0, ratio2); + const stepY1 = lerp2(as.stepY1, bs.stepY1, ratio2); + const rightCp1x = lerp2(as.rightCp1x, bs.rightCp1x, ratio2); + const rightCp1y = lerp2(as.rightCp1y, bs.rightCp1y, ratio2); + const rightCp2x = lerp2(as.rightCp2x, bs.rightCp2x, ratio2); + const rightCp2y = lerp2(as.rightCp2y, bs.rightCp2y, ratio2); + if (reversed) { + path.cubicCurveTo(rightCp2x, rightCp2y, rightCp1x, rightCp1y, stepX, stepY1); + path.lineTo(stepX, stepY0); + path.cubicCurveTo(leftCp2x, leftCp2y, leftCp1x, leftCp1y, x0, y0); + } else { + path.cubicCurveTo(leftCp1x, leftCp1y, leftCp2x, leftCp2y, stepX, stepY0); + path.lineTo(stepX, stepY1); + path.cubicCurveTo(rightCp1x, rightCp1y, rightCp2x, rightCp2y, x1, y1); + } + } +} + +// packages/ag-charts-community/src/chart/series/cartesian/lineInterpolationUtil.ts +var MAX_CATEGORIES = 1e3; +var CollapseMode = /* @__PURE__ */ ((CollapseMode3) => { + CollapseMode3[CollapseMode3["Zero"] = 0] = "Zero"; + CollapseMode3[CollapseMode3["Split"] = 1] = "Split"; + return CollapseMode3; +})(CollapseMode || {}); +function integratedCategoryMatch(a, b) { + if (a == null || b == null) + return false; + if (typeof a !== "object" || typeof b !== "object") + return false; + if ("id" in a && "id" in b) { + return a.id === b.id; + } + return a.toString() === b.toString(); +} +function toAxisValue(value) { + return transformIntegratedCategoryValue(value).valueOf(); +} +function scale(val, scaling) { + if (!scaling) + return Number.NaN; + if (val instanceof Date) { + val = val.getTime(); + } + if (scaling.type === "continuous" && typeof val === "number") { + const domainRatio = (val - scaling.domain[0]) / (scaling.domain[1] - scaling.domain[0]); + return domainRatio * (scaling.range[1] - scaling.range[0]) + scaling.range[0]; + } + if (scaling.type === "log" && typeof val === "number") { + return scaling.convert(val); + } + if (scaling.type !== "category") + return Number.NaN; + const axisValue = toAxisValue(val); + let matchingIndex = scaling.domain.findIndex((d) => toAxisValue(d) === axisValue); + if (matchingIndex === -1) { + matchingIndex = scaling.domain.findIndex((d) => integratedCategoryMatch(val, d)); + } + if (matchingIndex >= 0) { + return scaling.inset + scaling.step * matchingIndex; + } + return Number.NaN; +} +function getAxisIndices({ data }, values) { + return data.map((datum, datumIndex) => ({ + xValue0Index: values.indexOf(toAxisValue(datum.xValue0)), + xValue1Index: values.indexOf(toAxisValue(datum.xValue1)), + datumIndex + })); +} +function isValidScaling(data) { + return Object.values(data.scales).every((s) => { + if (s.type === "category") { + return s.domain.length < MAX_CATEGORIES; + } + return true; + }); +} +function validateCategorySorting(newData, oldData) { + const oldScale = oldData.scales.x; + const newScale = newData.scales.x; + if (oldScale?.type !== "category" || newScale?.type !== "category") + return true; + let x0 = -Infinity; + for (const oldValue of oldScale.domain) { + const x = scale(oldValue, newScale); + if (!Number.isFinite(x)) + continue; + if (x < x0) { + return false; + } else { + x0 = x; + } + } + return true; +} +function validateAxisEntriesOrder(axisValues, data) { + let x0 = -Infinity; + for (const axisValue of axisValues) { + const x = scale(axisValue.value, data.scales.x); + if (!Number.isFinite(x)) + continue; + if (x < x0) { + return false; + } else { + x0 = x; + } + } + return true; +} +function spanAxisContext(newData, oldData) { + const allAxisEntries = /* @__PURE__ */ new Map(); + for (const { xValue0, xValue1 } of newData.data) { + const xValue0Value = toAxisValue(xValue0); + const xValue1Value = toAxisValue(xValue1); + allAxisEntries.set(xValue0Value, xValue0).set(xValue1Value, xValue1); + } + const newAxisEntries = Array.from(allAxisEntries, ([axisValue, value]) => ({ axisValue, value })); + newAxisEntries.sort((a, b) => { + return scale(a.value, newData.scales.x) - scale(b.value, newData.scales.x); + }); + const exclusivelyOldAxisEntries = []; + for (const { xValue0, xValue1 } of oldData.data) { + const xValue0Value = toAxisValue(xValue0); + const xValue1Value = toAxisValue(xValue1); + if (!allAxisEntries.has(xValue0Value)) { + allAxisEntries.set(xValue0Value, xValue0); + exclusivelyOldAxisEntries.push({ axisValue: xValue0Value, value: xValue0 }); + } + if (!allAxisEntries.has(xValue1Value)) { + allAxisEntries.set(xValue1Value, xValue1); + exclusivelyOldAxisEntries.push({ axisValue: xValue1Value, value: xValue1 }); + } + } + exclusivelyOldAxisEntries.sort((a, b) => { + return scale(a.value, oldData.scales.x) - scale(b.value, oldData.scales.x); + }); + const axisEntries = newAxisEntries; + let insertionIndex = 0; + for (const oldAxisEntry of exclusivelyOldAxisEntries) { + for (let i = axisEntries.length - 1; i >= insertionIndex; i -= 1) { + const oldValueX = scale(oldAxisEntry.value, oldData.scales.x); + const newValueX = scale(axisEntries[i].value, oldData.scales.x); + if (oldValueX > newValueX) { + insertionIndex = i + 1; + break; + } + } + axisEntries.splice(insertionIndex, 0, oldAxisEntry); + insertionIndex += 1; + } + if (!validateAxisEntriesOrder(axisEntries, oldData)) + return; + const axisValues = axisEntries.map((axisEntry) => axisEntry.axisValue); + const oldDataAxisIndices = getAxisIndices(oldData, axisValues); + const newDataAxisIndices = getAxisIndices(newData, axisValues); + return { axisValues, oldDataAxisIndices, newDataAxisIndices }; +} +function clipSpan(span, data, axisValues, xValue0Index, xIndices) { + if (xIndices.xValue1Index === xIndices.xValue0Index + 1) + return span; + const range4 = spanRange(span); + let start2; + let end3; + if (data.scales.x?.type === "category") { + const step = (range4[1].x - range4[0].x) / (xIndices.xValue1Index - xIndices.xValue0Index); + start2 = range4[0].x + (xValue0Index - xIndices.xValue0Index) * step; + end3 = start2 + step; + } else { + const xValue0 = axisValues[xValue0Index]; + const xValue1 = axisValues[xValue0Index + 1]; + start2 = scale(xValue0, data.scales.x); + end3 = scale(xValue1, data.scales.x); + } + return clipSpanX(span, start2, end3); +} +function axisZeroSpan(span, data) { + const [r0, r1] = spanRange(span); + const y0 = scale(0, data.scales.y); + return rescaleSpan(span, { x: r0.x, y: y0 }, { x: r1.x, y: y0 }); +} +function collapseSpanToMidpoint(span) { + const [r0, r1] = spanRange(span); + return collapseSpanToPoint(span, { + x: (r0.x + r1.x) / 2, + y: (r0.y + r1.y) / 2 + }); +} +function collapseSpan(span, collapseMode, data, axisIndices, indices, range4) { + let xValue2; + let yValue; + if (indices.xValue0Index >= range4.xValue1Index) { + const datumIndex = axisIndices.findLast((i) => i.xValue1Index <= range4.xValue1Index)?.datumIndex; + const datum = datumIndex == null ? void 0 : data.data[datumIndex]; + xValue2 = datum?.xValue1; + yValue = datum?.yValue1; + } else if (indices.xValue0Index <= range4.xValue0Index) { + const datumIndex = axisIndices.find((i) => i.xValue0Index >= range4.xValue0Index)?.datumIndex; + const datum = datumIndex == null ? void 0 : data.data[datumIndex]; + xValue2 = datum?.xValue0; + yValue = datum?.yValue0; + } + if (xValue2 == null || yValue == null) { + switch (collapseMode) { + case 0 /* Zero */: + return axisZeroSpan(span, data); + case 1 /* Split */: + return collapseSpanToMidpoint(span); + } + } + const x = scale(xValue2, data.scales.x); + const y = scale(yValue, data.scales.y); + const point = { x, y }; + return rescaleSpan(span, point, point); +} +function zeroDataSpan(spanDatum, zeroData) { + if (zeroData == null) + return; + const newSpanXValue0 = toAxisValue(spanDatum.xValue0); + const newSpanXValue1 = toAxisValue(spanDatum.xValue1); + return zeroData.find( + (zeroSpanDatum) => toAxisValue(zeroSpanDatum.xValue0) === newSpanXValue0 && toAxisValue(zeroSpanDatum.xValue1) === newSpanXValue1 + )?.span; +} +function addSpan(newData, collapseMode, newAxisIndices, newIndices, oldZeroData, range4, out) { + const newSpanDatum = newData.data[newIndices.datumIndex]; + const newSpan = newSpanDatum.span; + const zeroSpan = zeroDataSpan(newSpanDatum, oldZeroData); + if (zeroSpan == null) { + const oldSpan = collapseSpan(newSpan, collapseMode, newData, newAxisIndices, newIndices, range4); + out.added.push({ from: oldSpan, to: newSpan }); + } else { + out.removed.push({ from: zeroSpan, to: zeroSpan }); + out.moved.push({ from: zeroSpan, to: newSpan }); + out.added.push({ from: newSpan, to: newSpan }); + } +} +function removeSpan(oldData, collapseMode, oldAxisIndices, oldIndices, newZeroData, range4, out) { + const oldSpanDatum = oldData.data[oldIndices.datumIndex]; + const oldSpan = oldSpanDatum.span; + const zeroSpan = zeroDataSpan(oldSpanDatum, newZeroData); + if (zeroSpan == null) { + const newSpan = collapseSpan(oldSpan, collapseMode, oldData, oldAxisIndices, oldIndices, range4); + out.removed.push({ from: oldSpan, to: newSpan }); + } else { + out.removed.push({ from: oldSpan, to: oldSpan }); + out.moved.push({ from: oldSpan, to: zeroSpan }); + out.added.push({ from: zeroSpan, to: zeroSpan }); + } +} +function alignSpanToContainingSpan(span, axisValues, preData, postData, postSpanIndices) { + const xScale = postData.scales.x; + const startXValue0 = axisValues[postSpanIndices.xValue0Index]; + const endXValue1 = axisValues[postSpanIndices.xValue1Index]; + let startDatum; + let endDatum; + if (xScale?.type === "continuous" || xScale?.type === "log") { + startDatum = preData.data.findLast((spanDatum) => toAxisValue(spanDatum.xValue0) <= startXValue0); + endDatum = preData.data.find((spanDatum) => toAxisValue(spanDatum.xValue1) >= endXValue1); + } else { + startDatum = preData.data.find((spanDatum) => toAxisValue(spanDatum.xValue0) === startXValue0); + endDatum = preData.data.find((spanDatum) => toAxisValue(spanDatum.xValue1) === endXValue1); + } + if (startDatum == null || endDatum == null) + return; + const [{ x: x0 }, { x: x1 }] = spanRange(span); + const startX = scale(startDatum.xValue0, preData.scales.x); + const startY = scale(startDatum.yValue0, preData.scales.y); + const endX = scale(endDatum.xValue1, preData.scales.x); + const endY = scale(endDatum.yValue1, preData.scales.y); + let altSpan = postData.data[postSpanIndices.datumIndex].span; + altSpan = rescaleSpan(altSpan, { x: startX, y: startY }, { x: endX, y: endY }); + altSpan = clipSpanX(altSpan, x0, x1); + return altSpan; +} +function appendSpanPhases(newData, oldData, collapseMode, axisValues, xValue0Index, newAxisIndices, oldAxisIndices, range4, out) { + const xValue1Index = xValue0Index + 1; + const oldIndices = oldAxisIndices.find((i) => i.xValue0Index <= xValue0Index && i.xValue1Index >= xValue1Index); + const newIndices = newAxisIndices.find((i) => i.xValue0Index <= xValue0Index && i.xValue1Index >= xValue1Index); + const oldZeroData = oldData.zeroData; + const newZeroData = newData.zeroData; + if (oldIndices == null && newIndices != null) { + addSpan(newData, collapseMode, newAxisIndices, newIndices, oldZeroData, range4, out); + return; + } else if (oldIndices != null && newIndices == null) { + removeSpan(oldData, collapseMode, oldAxisIndices, oldIndices, newZeroData, range4, out); + return; + } else if (oldIndices == null || newIndices == null) { + return; + } + let ordering; + if (oldIndices.xValue0Index === newIndices.xValue0Index && oldIndices.xValue1Index === newIndices.xValue1Index) { + ordering = 0; + } else if (oldIndices.xValue0Index <= newIndices.xValue0Index && oldIndices.xValue1Index >= newIndices.xValue1Index) { + ordering = -1; + } else if (oldIndices.xValue0Index >= newIndices.xValue0Index && oldIndices.xValue1Index <= newIndices.xValue1Index) { + ordering = 1; + } else { + ordering = 0; + } + const oldSpanDatum = oldData.data[oldIndices.datumIndex]; + const clippedOldSpanOldScale = clipSpan(oldSpanDatum.span, oldData, axisValues, xValue0Index, oldIndices); + const newSpanDatum = newData.data[newIndices.datumIndex]; + const clippedNewSpanNewScale = clipSpan(newSpanDatum.span, newData, axisValues, xValue0Index, newIndices); + if (ordering === 1) { + const clippedPostRemoveOldSpanOldScale = alignSpanToContainingSpan( + clippedOldSpanOldScale, + axisValues, + oldData, + newData, + newIndices + ); + if (clippedPostRemoveOldSpanOldScale == null) { + removeSpan(oldData, collapseMode, oldAxisIndices, oldIndices, newZeroData, range4, out); + } else { + out.removed.push({ from: clippedOldSpanOldScale, to: clippedPostRemoveOldSpanOldScale }); + out.moved.push({ from: clippedPostRemoveOldSpanOldScale, to: clippedNewSpanNewScale }); + out.added.push({ from: clippedNewSpanNewScale, to: clippedNewSpanNewScale }); + } + } else if (ordering === -1) { + const clippedPreAddedNewSpanNewScale = alignSpanToContainingSpan( + clippedNewSpanNewScale, + axisValues, + newData, + oldData, + oldIndices + ); + if (clippedPreAddedNewSpanNewScale == null) { + addSpan(newData, collapseMode, newAxisIndices, newIndices, oldZeroData, range4, out); + } else { + out.removed.push({ from: clippedOldSpanOldScale, to: clippedOldSpanOldScale }); + out.moved.push({ from: clippedOldSpanOldScale, to: clippedPreAddedNewSpanNewScale }); + out.added.push({ from: clippedPreAddedNewSpanNewScale, to: clippedNewSpanNewScale }); + } + } else { + out.removed.push({ from: clippedOldSpanOldScale, to: clippedOldSpanOldScale }); + out.moved.push({ from: clippedOldSpanOldScale, to: clippedNewSpanNewScale }); + out.added.push({ from: clippedNewSpanNewScale, to: clippedNewSpanNewScale }); + } +} +function phaseAnimation(axisContext, newData, oldData, collapseMode) { + const out = { + removed: [], + moved: [], + added: [] + }; + const { axisValues, oldDataAxisIndices, newDataAxisIndices } = axisContext; + const range4 = { + xValue0Index: Math.max( + oldDataAxisIndices.at(0)?.xValue0Index ?? -Infinity, + newDataAxisIndices.at(0)?.xValue0Index ?? -Infinity + ), + xValue1Index: Math.min( + oldDataAxisIndices.at(-1)?.xValue1Index ?? Infinity, + newDataAxisIndices.at(-1)?.xValue1Index ?? Infinity + ) + }; + for (let xValue0Index = 0; xValue0Index < axisValues.length - 1; xValue0Index += 1) { + appendSpanPhases( + newData, + oldData, + collapseMode, + axisValues, + xValue0Index, + newDataAxisIndices, + oldDataAxisIndices, + range4, + out + ); + } + return out; +} +function replotXAnimation(newData, oldData) { + const removed = []; + const moved = []; + const added = []; + for (let i = 0; i < oldData.data.length; i += 1) { + const oldSpan = oldData.data[i].span; + const newSpan = newData.data[i].span; + removed.push({ from: oldSpan, to: oldSpan }); + moved.push({ from: oldSpan, to: newSpan }); + added.push({ from: newSpan, to: newSpan }); + } + return { + removed, + moved, + added + }; +} +function resetSpan(data, spanDatum, collapseMode) { + const { span } = spanDatum; + switch (collapseMode) { + case 0 /* Zero */: + return zeroDataSpan(spanDatum, data.zeroData) ?? axisZeroSpan(span, data); + case 1 /* Split */: + return collapseSpanToMidpoint(span); + } +} +function resetAnimation(newData, oldData, collapseMode) { + const added = []; + const removed = []; + for (const oldSpanDatum of oldData.data) { + const oldSpan = oldSpanDatum.span; + const collapsedSpan = resetSpan(oldData, oldSpanDatum, collapseMode); + removed.push({ from: oldSpan, to: collapsedSpan }); + } + for (const newSpanDatum of newData.data) { + const newSpan = newSpanDatum.span; + const collapsedSpan = resetSpan(newData, newSpanDatum, collapseMode); + added.push({ from: collapsedSpan, to: newSpan }); + } + return { + removed, + moved: [], + added + }; +} +function pairUpSpans(newData, oldData, collapseMode) { + if (!isValidScaling(newData) || !isValidScaling(oldData)) + return; + if (!validateCategorySorting(newData, oldData)) + return; + const axisContext = spanAxisContext(newData, oldData); + if (axisContext == null) { + return resetAnimation(newData, oldData, collapseMode); + } else if (axisContext.axisValues.length === axisContext.oldDataAxisIndices.length + axisContext.newDataAxisIndices.length + 2) { + return replotXAnimation(newData, oldData); + } else { + return phaseAnimation(axisContext, newData, oldData, collapseMode); + } +} + +// packages/ag-charts-community/src/chart/series/cartesian/scaling.ts +function isContinuousScaling(scaling) { + return scaling.type === "continuous" || scaling.type === "log"; +} +function isCategoryScaling(scaling) { + return scaling.type === "category"; +} +function areScalingEqual(a, b) { + if (a === void 0 || b === void 0) { + return a !== void 0 || b !== void 0; + } + if (isContinuousScaling(a) && isContinuousScaling(b)) { + return a.type === b.type && arraysEqual(a.domain, b.domain) && arraysEqual(a.range, b.range); + } + if (isCategoryScaling(a) && isCategoryScaling(b)) { + return a.inset === b.inset && a.step === b.step && arraysEqual(a.domain, b.domain); + } + return false; +} +function isScaleValid(scale2) { + if (scale2 == null) + return false; + if (scale2.type === "category") + return scale2.domain.every((v) => v != null); + return scale2.domain.every((v) => Number.isFinite(v) || v instanceof Date) && scale2.range.every((v) => Number.isFinite(v)); +} + +// packages/ag-charts-community/src/chart/series/cartesian/lineUtil.ts +function interpolatePoints(points, interpolation) { + let spans; + const pointsIter = points.map((point) => point.point); + switch (interpolation.type) { + case "linear": + spans = linearPoints(pointsIter); + break; + case "smooth": + spans = smoothPoints(pointsIter, interpolation.tension); + break; + case "step": + spans = stepPoints(pointsIter, interpolation.position); + break; + } + return spans.map((span, i) => ({ + span, + xValue0: points[i].xDatum, + yValue0: points[i].yDatum, + xValue1: points[i + 1].xDatum, + yValue1: points[i + 1].yDatum + })); +} +function pointsEq(a, b, delta4 = 1e-3) { + return Math.abs(a.x - b.x) < delta4 && Math.abs(a.y - b.y) < delta4; +} +function plotLinePathStroke({ path }, spans) { + let lastPoint; + for (const { span } of spans) { + const [start2, end3] = spanRange(span); + const join = lastPoint != null && pointsEq(lastPoint, start2) ? 2 /* Skip */ : 0 /* MoveTo */; + plotSpan(path, span, join, false); + lastPoint = end3; + } +} +function plotInterpolatedLinePathStroke(ratio2, path, spans) { + let lastPoint; + for (const span of spans) { + const [start2, end3] = interpolatedSpanRange(span.from, span.to, ratio2); + const join = lastPoint != null && pointsEq(lastPoint, start2) ? 2 /* Skip */ : 0 /* MoveTo */; + plotInterpolatedSpans(path.path, span.from, span.to, ratio2, join, false); + lastPoint = end3; + } +} +function prepareLinePathStrokeAnimationFns(status, spans, visibleToggleMode) { + const removePhaseFn = (ratio2, path) => plotInterpolatedLinePathStroke(ratio2, path, spans.removed); + const updatePhaseFn = (ratio2, path) => plotInterpolatedLinePathStroke(ratio2, path, spans.moved); + const addPhaseFn = (ratio2, path) => plotInterpolatedLinePathStroke(ratio2, path, spans.added); + const pathProperties = prepareLinePathPropertyAnimation(status, visibleToggleMode); + return { status, path: { addPhaseFn, updatePhaseFn, removePhaseFn }, pathProperties }; +} +function prepareLinePathPropertyAnimation(status, visibleToggleMode) { + const phase = visibleToggleMode === "none" ? "updated" : status; + const result = { + fromFn(path, datum) { + const out = { phase: NODE_UPDATE_STATE_TO_PHASE_MAPPING[phase] }; + const segments = path.previousDatum ?? datum; + if (segments != null) { + out.segments = segments; + } + if (status === "removed") { + out.finish = { visible: false }; + } else if (status === "added") { + out.start = { visible: true }; + } + return out; + }, + toFn(_path, datum) { + const out = { phase: NODE_UPDATE_STATE_TO_PHASE_MAPPING[phase] }; + const segments = datum; + if (segments != null) { + out.segments = segments; + } + return out; + } + }; + if (visibleToggleMode === "fade") { + return { + fromFn(path, datum) { + const opacity = status === "added" ? 0 : path.opacity; + const segments = status === "removed" ? path.previousDatum ?? datum : datum; + return { ...result.fromFn(path, datum), opacity, segments }; + }, + toFn(path, datum) { + const opacity = status === "removed" ? 0 : 1; + const segments = status === "removed" ? path.previousDatum ?? datum : datum; + return { ...result.toFn(path, datum), opacity, segments }; + } + }; + } + return result; +} +function prepareLinePathAnimation(newData, oldData, diff8) { + const isCategoryBased = newData.scales.x?.type === "category"; + const wasCategoryBased = oldData.scales.x?.type === "category"; + if (isCategoryBased !== wasCategoryBased || !isScaleValid(newData.scales.x) || !isScaleValid(oldData.scales.x)) { + return; + } + if (newData.strokeData == null || oldData.strokeData == null) { + return; + } + let status = "updated"; + if (oldData.visible && !newData.visible) { + status = "removed"; + } else if (!oldData.visible && newData.visible) { + status = "added"; + } + const strokeSpans = pairUpSpans( + { scales: newData.scales, data: newData.strokeData.spans }, + { scales: oldData.scales, data: oldData.strokeData.spans }, + 1 /* Split */ + ); + if (strokeSpans == null) + return; + const stroke3 = prepareLinePathStrokeAnimationFns(status, strokeSpans, "fade"); + const hasMotion = (diff8?.changed ?? true) || !areScalingEqual(newData.scales.x, oldData.scales.x) || !areScalingEqual(newData.scales.y, oldData.scales.y) || status !== "updated"; + return { status, stroke: stroke3, hasMotion }; +} + +// packages/ag-charts-community/src/chart/series/cartesian/areaUtil.ts +function plotAreaPathFill({ path }, { spans, phantomSpans }) { + let phantomSpanIndex = 0; + let sp = { x: Number.NaN, y: Number.NaN }; + let pp = { x: Number.NaN, y: Number.NaN }; + for (let i = 0; i < spans.length; i += 1) { + const { span } = spans[i]; + const { span: phantomSpan } = phantomSpans[i]; + const { 0: sp0, 1: sp1 } = spanRange(span); + const { 0: pp0, 1: pp1 } = spanRange(phantomSpan); + if (pointsEq(sp, sp0) && pointsEq(pp, pp0)) { + plotSpan(path, span, 2 /* Skip */, false); + } else { + for (let j = i - 1; j >= phantomSpanIndex; j -= 1) { + plotSpan(path, phantomSpans[j].span, 1 /* LineTo */, true); + } + path.closePath(); + plotSpan(path, span, 0 /* MoveTo */, false); + phantomSpanIndex = i; + } + sp = sp1; + pp = pp1; + } + for (let j = spans.length - 1; j >= phantomSpanIndex; j -= 1) { + plotSpan(path, phantomSpans[j].span, 1 /* LineTo */, true); + } + path.closePath(); +} +function plotInterpolatedAreaSeriesFillSpans(ratio2, { path }, spans, fillPhantomSpans) { + for (let i = 0; i < spans.length; i += 1) { + const span = spans[i]; + const reversedPhantomSpan = fillPhantomSpans[i]; + plotInterpolatedSpans(path, span.from, span.to, ratio2, 0 /* MoveTo */, false); + plotInterpolatedSpans(path, reversedPhantomSpan.from, reversedPhantomSpan.to, ratio2, 1 /* LineTo */, true); + path.closePath(); + } +} +function prepareAreaFillAnimationFns(status, spans, fillPhantomSpans, visibleToggleMode) { + const removePhaseFn = (ratio2, path) => plotInterpolatedAreaSeriesFillSpans(ratio2, path, spans.removed, fillPhantomSpans.removed); + const updatePhaseFn = (ratio2, path) => plotInterpolatedAreaSeriesFillSpans(ratio2, path, spans.moved, fillPhantomSpans.moved); + const addPhaseFn = (ratio2, path) => plotInterpolatedAreaSeriesFillSpans(ratio2, path, spans.added, fillPhantomSpans.added); + const pathProperties = prepareLinePathPropertyAnimation(status, visibleToggleMode); + return { status, path: { addPhaseFn, updatePhaseFn, removePhaseFn }, pathProperties }; +} +function prepareAreaPathAnimation(newData, oldData) { + const isCategoryBased = newData.scales.x?.type === "category"; + const wasCategoryBased = oldData.scales.x?.type === "category"; + if (isCategoryBased !== wasCategoryBased || !isScaleValid(newData.scales.x) || !isScaleValid(oldData.scales.x)) { + return; + } + let status = "updated"; + if (oldData.visible && !newData.visible) { + status = "removed"; + } else if (!oldData.visible && newData.visible) { + status = "added"; + } + const fillSpans = pairUpSpans( + { scales: newData.scales, data: newData.fillData.spans }, + { scales: oldData.scales, data: oldData.fillData.spans }, + 0 /* Zero */ + ); + if (fillSpans == null) + return; + const fillPhantomSpans = pairUpSpans( + { scales: newData.scales, data: newData.fillData.phantomSpans }, + { scales: oldData.scales, data: oldData.fillData.phantomSpans }, + 0 /* Zero */ + ); + if (fillPhantomSpans == null) + return; + const strokeSpans = pairUpSpans( + { + scales: newData.scales, + data: newData.strokeData.spans, + zeroData: newData.fillData.phantomSpans + }, + { + scales: oldData.scales, + data: oldData.strokeData.spans, + zeroData: oldData.fillData.phantomSpans + }, + 0 /* Zero */ + ); + if (strokeSpans == null) + return; + const fadeMode = "none"; + const fill = prepareAreaFillAnimationFns(status, fillSpans, fillPhantomSpans, fadeMode); + const stroke3 = prepareLinePathStrokeAnimationFns(status, strokeSpans, fadeMode); + return { status, fill, stroke: stroke3 }; +} + +// packages/ag-charts-community/src/chart/series/cartesian/markerUtil.ts +function markerFadeInAnimation({ id }, animationManager, status, ...markerSelections) { + const params = { phase: status ? NODE_UPDATE_STATE_TO_PHASE_MAPPING[status] : "trailing" }; + staticFromToMotion(id, "markers", animationManager, markerSelections, { opacity: 0 }, { opacity: 1 }, params); + for (const s of markerSelections) { + s.cleanup(); + } +} +function markerScaleInAnimation({ id }, animationManager, ...markerSelections) { + staticFromToMotion( + id, + "markers", + animationManager, + markerSelections, + { scalingX: 0, scalingY: 0 }, + { scalingX: 1, scalingY: 1 }, + { phase: "initial" } + ); + for (const s of markerSelections) { + s.cleanup(); + } +} +function markerSwipeScaleInAnimation({ id, nodeDataDependencies }, animationManager, ...markerSelections) { + const seriesWidth = nodeDataDependencies.seriesRectWidth; + const fromFn = (_, datum) => { + const x = datum.midPoint?.x ?? seriesWidth; + let delay = clamp(0, inverseEaseOut(x / seriesWidth), 1); + if (Number.isNaN(delay)) { + delay = 0; + } + return { scalingX: 0, scalingY: 0, delay, duration: QUICK_TRANSITION, phase: "initial" }; + }; + const toFn = () => { + return { scalingX: 1, scalingY: 1 }; + }; + fromToMotion(id, "markers", animationManager, markerSelections, { fromFn, toFn }); +} +function resetMarkerFn(_node) { + return { opacity: 1, scalingX: 1, scalingY: 1 }; +} +function resetMarkerPositionFn(_node, datum) { + return { + x: datum.point?.x ?? Number.NaN, + y: datum.point?.y ?? Number.NaN, + scalingCenterX: datum.point?.x ?? Number.NaN, + scalingCenterY: datum.point?.y ?? Number.NaN + }; +} +function computeMarkerFocusBounds(series, { datumIndex }) { + const nodeData = series.getNodeData(); + if (nodeData === void 0) + return void 0; + const datum = nodeData[datumIndex]; + const { point } = datum ?? {}; + if (datum == null || point == null) + return void 0; + const style2 = series.getFormattedMarkerStyle(datum); + const anchor = Marker.anchor(style2.shape); + const size = point.focusSize ?? style2.size; + const paddedSize = 4 + size; + const paddedRadius = paddedSize / 2; + const anchorX = (anchor.x - 0.5) * size; + const anchorY = (anchor.y - 0.5) * size; + const x = datum.point.x - paddedRadius - anchorX; + const y = datum.point.y - paddedRadius - anchorY; + return Transformable.toCanvas(series.contentGroup, new BBox(x, y, paddedSize, paddedSize)); +} +function markerEnabled(dataCount, scale2, marker, markerStyle = marker) { + const enabled = markerStyle.enabled ?? marker.enabled; + if (!enabled) + return false; + const minSpacing = 1; + const step = scale2.step ?? findRangeExtent(scale2.range) / Math.max(1, dataCount); + return step > minSpacing; +} +function getMarkerStyles(series, line, marker, inheritedStyle) { + inheritedStyle ?? (inheritedStyle = { + stroke: line.stroke, + strokeOpacity: line.strokeOpacity, + strokeWidth: line.strokeWidth + }); + return highlightStates.reduce( + (styles, state) => { + styles[state] = series.getMarkerStyle( + marker, + {}, + void 0, + { highlightState: state }, + void 0, + inheritedStyle + ); + return styles; + }, + {} + ); +} + +// packages/ag-charts-community/src/chart/series/cartesian/pathUtil.ts +function pathSwipeInAnimation({ id, visible, nodeDataDependencies }, animationManager, ...paths) { + const { seriesRectWidth: width2, seriesRectHeight: height2 } = nodeDataDependencies; + staticFromToMotion( + id, + "path_properties", + animationManager, + paths, + { clipX: 0 }, + { clipX: width2 }, + { + phase: "initial", + start: { clip: true, clipY: height2, visible }, + finish: { clip: false, visible } + } + ); +} +function pathFadeInAnimation({ id }, subId, animationManager, phase = "add", ...selection) { + staticFromToMotion(id, subId, animationManager, selection, { opacity: 0 }, { opacity: 1 }, { phase }); +} +function buildResetPathFn(opts) { + return (_node) => ({ + visible: opts.getVisible(), + opacity: opts.getOpacity(), + clipScalingX: 1, + clip: false + }); +} +function updateClipPath({ nodeDataDependencies }, path) { + const toFinite = (value) => Number.isFinite(value) ? value : 0; + path.clipX = toFinite(nodeDataDependencies.seriesRectWidth); + path.clipY = toFinite(nodeDataDependencies.seriesRectHeight); +} + +// packages/ag-charts-community/src/chart/series/cartesian/util.ts +function isAxisReversed(axis) { + return axis.isReversed() !== axis.range[1] < axis.range[0]; +} +function calculateSegments(segmentation, xAxis, yAxis, seriesRect, chartSize, applyOffset = true) { + if (xAxis.scale.domain.length === 0 || yAxis.scale.domain.length === 0) { + return; + } + const axis = segmentation.key === "x" /* X */ ? xAxis : yAxis; + const { scale: scale2, direction } = axis; + const isXDirection = direction === "x" /* X */; + const bandwidth = scale2.bandwidth ?? 0; + const offset = applyOffset ? ((scale2.step ?? 0) - bandwidth) / 2 : 0; + const horizontalMargin = Math.max(seriesRect.x, chartSize.width - (seriesRect.x + seriesRect.width)); + const verticalMargin = Math.max(seriesRect.y, chartSize.height - (seriesRect.y + seriesRect.height)); + const getDefaultStart = () => { + if (isAxisReversed(isXDirection ? xAxis : yAxis)) { + return isXDirection ? seriesRect.width + horizontalMargin : seriesRect.height + verticalMargin; + } + return isXDirection ? -horizontalMargin : -verticalMargin; + }; + const getDefaultStop = () => { + if (isAxisReversed(isXDirection ? xAxis : yAxis)) { + return isXDirection ? -horizontalMargin : -verticalMargin; + } + return isXDirection ? seriesRect.width + horizontalMargin : seriesRect.height + verticalMargin; + }; + const getSegments = (segments) => { + const result = []; + let previousDefinedStopIndex = -1; + for (let i = 0; i < segments.length; i++) { + const segment = segments[i]; + if (isEmptyObject(segment)) { + continue; + } + const { start: start2, stop, ...styles } = segments[i]; + const startFallback = segments[previousDefinedStopIndex]?.stop; + const stopFallback = segments.slice(i + 1).find((s) => s.start != null)?.start; + let startPosition = scale2.convert(start2 ?? startFallback) - offset; + let stopPosition = scale2.convert(stop ?? stopFallback) + 2 * offset; + const invalidStart = start2 != null && Number.isNaN(startPosition); + const invalidStop = stop != null && Number.isNaN(stopPosition); + if (invalidStart || invalidStop) { + continue; + } + if (Number.isNaN(startPosition)) + startPosition = getDefaultStart(); + if (Number.isNaN(stopPosition)) + stopPosition = getDefaultStop(); + if (stop != null) { + previousDefinedStopIndex = i; + } + result.push({ start: startPosition, stop: stopPosition, ...styles }); + } + return result; + }; + return getSegments(segmentation.segments).map(({ stop, start: start2, ...style2 }) => { + const x0 = isXDirection ? start2 : -horizontalMargin; + const y0 = isXDirection ? -verticalMargin : start2; + const x1 = isXDirection ? stop + bandwidth : seriesRect.width + horizontalMargin; + const y1 = isXDirection ? seriesRect.height + verticalMargin : stop + bandwidth; + return { clipRect: { x0, y0, x1, y1 }, ...style2 }; + }); +} +var TIME_AXIS_KEYS = /* @__PURE__ */ new Set(["time", "timestamp", "date", "datetime"]); +function predictCartesianAxis(direction, datum, seriesOptions) { + if (direction !== "x" /* X */ && direction !== "y" /* Y */) + return; + if (!isObject(datum)) + return; + const key = getSeriesOptionsKey(direction, seriesOptions); + if (key == null || !(key in datum)) + return; + const value = datum[key]; + const position = getAxisPosition(direction, seriesOptions); + const timeAxis = predictTimeAxisType(key, value); + if (timeAxis) { + return { type: timeAxis, position }; + } + if (typeof value === "number") { + return { + type: "number" /* NUMBER */, + position + }; + } + return { + type: "category" /* CATEGORY */, + position + }; +} +function predictCartesianTimeAxis(direction, datum, seriesOptions) { + if (direction !== "x" /* X */ && direction !== "y" /* Y */) + return; + if (!isObject(datum)) + return; + const key = getSeriesOptionsKey(direction, seriesOptions); + if (key == null || !(key in datum)) + return; + const position = getAxisPosition(direction, seriesOptions); + const type = predictTimeAxisType(key, datum[key]); + if (!type) + return; + return { type, position }; +} +function predictTimeAxisType(key, value) { + if (isDate(value) || TIME_AXIS_KEYS.has(key) && isNumber(value)) { + return "time" /* TIME */; + } +} +function getSeriesOptionsKey(direction, seriesOptions) { + let key; + if (direction === "x" /* X */) { + if ("xKey" in seriesOptions) { + key = seriesOptions.xKey; + } + } else if (direction === "y" /* Y */) { + if ("yKey" in seriesOptions) { + key = seriesOptions.yKey; + } + } + return key; +} +function getAxisPosition(direction, seriesOptions) { + if ("direction" in seriesOptions && seriesOptions.direction === "horizontal") { + return direction === "x" /* X */ ? "left" /* LEFT */ : "bottom" /* BOTTOM */; + } + return direction === "x" /* X */ ? "bottom" /* BOTTOM */ : "left" /* LEFT */; +} + +// packages/ag-charts-community/src/chart/series/cartesian/areaSeries.ts +var CROSS_FILTER_AREA_FILL_OPACITY_FACTOR = 0.125; +var CROSS_FILTER_AREA_STROKE_OPACITY_FACTOR = 0.25; +var memoizedAggregateAreaData = simpleMemorize2(aggregateAreaData); +var AreaSeries = class extends CartesianSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: DEFAULT_CARTESIAN_DIRECTION_KEYS, + propertyNames: DEFAULT_CARTESIAN_DIRECTION_NAMES, + categoryKey: "xValue", + pathsPerSeries: ["fill", "stroke"], + pathsZIndexSubOrderOffset: [0, 1e3], + datumSelectionGarbageCollection: false, + segmentedDataNodes: false, + pickModes: [2 /* AXIS_ALIGNED */, 0 /* EXACT_SHAPE_MATCH */], + animationResetFns: { + path: buildResetPathFn({ getVisible: () => this.visible, getOpacity: () => this.getOpacity() }), + label: resetLabelFn, + datum: (node, datum) => ({ ...resetMarkerFn(node), ...resetMarkerPositionFn(node, datum) }) + }, + clipFocusBox: false + }); + this.properties = new AreaSeriesProperties(); + this.connectsToYAxis = true; + this.dataAggregationFilters = void 0; + this.backgroundGroup = new Group({ + name: `${this.id}-background`, + zIndex: 0 /* BACKGROUND */ + }); + this._isStacked = void 0; + this.fillSpans = []; + this.phantomSpans = []; + this.strokeSpans = []; + } + get pickModeAxis() { + return "main"; + } + get hasData() { + return this.getHasData("xValue"); + } + renderToOffscreenCanvas() { + return super.renderToOffscreenCanvas() || this.contextNodeData != null && (this.contextNodeData.fillData.spans.length > RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD || this.contextNodeData.strokeData.spans.length > RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD); + } + attachSeries(seriesContentNode, seriesNode, annotationNode) { + super.attachSeries(seriesContentNode, seriesNode, annotationNode); + seriesContentNode.appendChild(this.backgroundGroup); + } + detachSeries(seriesContentNode, seriesNode, annotationNode) { + super.detachSeries(seriesContentNode, seriesNode, annotationNode); + this.backgroundGroup.remove(); + } + attachPaths([fill, stroke3]) { + this.backgroundGroup.appendChild(fill); + this.contentGroup.appendChild(stroke3); + stroke3.zIndex = -1; + } + detachPaths([fill, stroke3]) { + fill.remove(); + stroke3.remove(); + } + isStacked() { + const stackCount = this.seriesGrouping?.stackCount ?? 1; + return stackCount > 1; + } + isNormalized() { + return this.properties.normalizedTo != null; + } + setSeriesIndex(index) { + const isStacked = this.isStacked(); + const isStackedChanged = isStacked === this._isStacked; + this._isStacked = isStackedChanged; + return super.setSeriesIndex(index, isStackedChanged); + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + if (this.isStacked()) { + this.backgroundGroup.zIndex = [0 /* BACKGROUND */, zIndex]; + this.contentGroup.zIndex = [1 /* ANY_CONTENT */, zIndex, 0 /* FOREGROUND */]; + } else { + this.backgroundGroup.zIndex = [1 /* ANY_CONTENT */, zIndex, 0 /* FOREGROUND */, 0]; + this.contentGroup.zIndex = [1 /* ANY_CONTENT */, zIndex, 0 /* FOREGROUND */, 1]; + } + } + async processData(dataController) { + if (this.data == null) + return; + const { data, visible, seriesGrouping: { groupIndex = this.id, stackCount = 1 } = {} } = this; + const { xKey, yKey, yFilterKey, connectMissingData, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.axes["x" /* X */]?.scale; + const yScale = this.axes["y" /* Y */]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const stacked = stackCount > 1 || normalizedTo != null; + const idMap = { + value: `area-stack-${groupIndex}-yValue`, + marker: `area-stack-${groupIndex}-yValues-marker` + }; + const common = { invalidValue: null }; + if ((isDefined(normalizedTo) || connectMissingData) && stackCount > 1) { + common.invalidValue = 0; + } + if (!visible) { + common.forceValue = 0; + } + const props = [ + keyProperty(xKey, xScaleType, { id: "xValue" }), + valueProperty(yKey, yScaleType, { id: `yValueRaw`, ...common }), + ...yFilterKey == null ? [] : [valueProperty(yFilterKey, yScaleType, { id: "yFilterRaw" })] + ]; + if (stacked) { + props.push( + ...groupAccumulativeValueProperty( + yKey, + "normal", + { id: `yValueCumulative`, ...common, groupId: idMap.marker }, + yScaleType + ) + ); + } + if (isDefined(normalizedTo)) { + props.push( + valueProperty(yKey, yScaleType, { id: `yValue`, ...common, groupId: idMap.value }), + normaliseGroupTo(Object.values(idMap), normalizedTo) + ); + } + if (animationEnabled) { + props.push(animationValidation()); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props, + groupByKeys: stacked, + groupByData: !stacked + }); + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + xCoordinateRange(xValue2, pixelSize) { + const { marker } = this.properties; + const x = this.axes["x" /* X */].scale.convert(xValue2); + const r = marker.enabled ? 0.5 * marker.size * pixelSize : 0; + return [x - r, x + r]; + } + yCoordinateRange(yValues, pixelSize) { + const { marker } = this.properties; + const y = this.axes["y" /* Y */].scale.convert(yValues[0]); + const r = marker.enabled ? 0.5 * marker.size * pixelSize : 0; + return [y - r, y + r]; + } + yValueKey() { + return this.isNormalized() ? "yValue" : "yValueRaw"; + } + yCumulativeKey(processData) { + return processData.type === "grouped" ? "yValueCumulative" : this.yValueKey(); + } + getSeriesDomain(direction) { + const { dataModel, processedData, axes } = this; + if (!dataModel || !processedData) + return []; + const yAxis = axes["y" /* Y */]; + if (direction === "x" /* X */) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = dataModel.getDomain(this, `xValue`, "key", processedData); + if (keyDef?.def.type === "key" && keyDef.def.valueType === "category") { + return keys; + } + return fixNumericExtent(extent(keys)); + } + const yExtent = this.domainForClippedRange( + "y" /* Y */, + [this.yCumulativeKey(processedData)], + "xValue" + ); + if (yAxis instanceof NumberAxis && !(yAxis instanceof LogAxis)) { + const fixedYExtent = Number.isFinite(yExtent[1] - yExtent[0]) ? [Math.min(yExtent[0], 0), Math.max(yExtent[1], 0)] : []; + return fixNumericExtent(fixedYExtent); + } else { + return fixNumericExtent(yExtent); + } + } + getSeriesRange(_direction, visibleRange) { + const [y0, y1] = this.domainForVisibleRange( + "y" /* Y */, + [this.yCumulativeKey(this.processedData)], + "xValue", + visibleRange + ); + return [Math.min(y0, 0), Math.max(y1, 0)]; + } + getZoomRangeFittingItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.zoomFittingVisibleItems( + "xValue", + [this.yCumulativeKey(this.processedData)], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + getVisibleItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.countVisibleItems( + "xValue", + [this.yCumulativeKey(this.processedData)], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + aggregateData(dataModel, processedData) { + if (processedDataIsAnimatable(processedData)) + return; + const xAxis = this.axes["x" /* X */]; + if (xAxis == null) + return; + const { scale: scale2 } = xAxis; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, this.yCumulativeKey(processedData), processedData); + const domain = dataModel.getDomain(this, `xValue`, "key", processedData); + const xNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `xValue`, processedData); + const yNeedsValueOf = dataModel.resolveColumnNeedsValueOf( + this, + this.yCumulativeKey(processedData), + processedData + ); + return memoizedAggregateAreaData(scale2.type, xValues, yValues, domain, xNeedsValueOf, yNeedsValueOf); + } + stackAggregatedData(aggregation) { + const { indices, metaIndices } = aggregation; + const { visible, axes, dataModel, processedData, seriesBelowStackContext } = this; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (!visible) { + this.phantomSpans = []; + this.fillSpans = []; + this.strokeSpans = []; + return seriesBelowStackContext; + } + if (xAxis == null || yAxis == null || dataModel == null || processedData == null) + return; + const { scale: xScale } = xAxis; + const { scale: yScale } = yAxis; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yValues = dataModel.resolveColumnById(this, this.yCumulativeKey(processedData), processedData); + let [m0, m1] = visibleRangeIndices(1, metaIndices.length - 1, xAxis.range, (metaIndex) => { + const startIndex = metaIndices[metaIndex]; + const endIndex = metaIndices[metaIndex + 1]; + const startDatumIndex = indices[startIndex]; + const endDatumIndex = indices[endIndex]; + const xValue0 = xValues[startDatumIndex]; + const xValue1 = xValues[endDatumIndex]; + const { 0: x0 } = this.xCoordinateRange(xValue0, 0); + const { 1: x1 } = this.xCoordinateRange(xValue1, 0); + return [x0, x1]; + }); + m0 = Math.max(m0 - 1, 0); + m1 = Math.min(m1 + 1, metaIndices.length - 1); + let phantomSpans = []; + if (seriesBelowStackContext?.fillSpans) { + phantomSpans = seriesBelowStackContext?.fillSpans; + } else { + for (let metaIndex = m0; metaIndex < m1; metaIndex += 1) { + const startIndex = metaIndices[metaIndex]; + const endIndex = metaIndices[metaIndex + 1]; + const startDatumIndex = indices[startIndex]; + const endDatumIndex = indices[endIndex]; + const xValue0 = xValues[startDatumIndex]; + const xValue1 = xValues[endDatumIndex]; + const span = { + type: "linear", + moveTo: false, + x0: xScale.convert(xValue0) + xOffset, + y0: yScale.convert(0), + x1: xScale.convert(xValue1) + xOffset, + y1: yScale.convert(0) + }; + phantomSpans.push({ + span, + xValue0, + xValue1, + yValue0: 0, + yValue1: 0 + }); + } + } + this.phantomSpans = phantomSpans; + const fillSpans = []; + const strokeSpans = []; + for (let metaIndex = m0; metaIndex < m1; metaIndex += 1) { + const startIndex = metaIndices[metaIndex]; + const endIndex = metaIndices[metaIndex + 1]; + const startDatumIndex = indices[startIndex]; + const endDatumIndex = indices[endIndex]; + const xValue0 = xValues[startDatumIndex]; + const xValue1 = xValues[endDatumIndex]; + const yValue0 = yValues[startDatumIndex]; + const yValue1 = yValues[endDatumIndex]; + const midPoints = []; + for (let i = startIndex + 1; i < endIndex; i++) { + const datumIndex = indices[i]; + midPoints.push({ + x: xScale.convert(xValues[datumIndex]) + xOffset, + y: yScale.convert(yValues[datumIndex]) + }); + } + const span = { + type: "multi-line", + moveTo: false, + x0: xScale.convert(xValue0) + xOffset, + y0: yScale.convert(yValue0), + x1: xScale.convert(xValue1) + xOffset, + y1: yScale.convert(yValue1), + midPoints + }; + const spanDatum = { + span, + xValue0, + xValue1, + yValue0, + yValue1 + }; + fillSpans.push(spanDatum); + strokeSpans.push(spanDatum); + } + this.fillSpans = fillSpans; + this.strokeSpans = strokeSpans; + return { + stack: [], + fillSpans, + strokeSpans + }; + } + stackYValueData() { + const { visible, axes, dataModel, processedData, seriesBelowStackContext, properties } = this; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (xAxis == null || yAxis == null || dataModel == null || processedData == null) + return; + const { interpolation } = properties; + const { scale: xScale } = xAxis; + const { scale: yScale } = yAxis; + const xOffset = (xScale.bandwidth ?? 0) / 2; + let xValues = dataModel.resolveKeysById(this, "xValue", processedData); + let yValues = dataModel.resolveColumnById(this, this.yValueKey(), processedData); + const connectMissingData = !this.isStacked() && this.properties.connectMissingData; + const invalidKeys = processedData.invalidKeys?.get(this.id); + const invalidData = connectMissingData ? processedData.invalidData?.get(this.id) : void 0; + const indexFilter = invalidData ?? invalidKeys; + if (indexFilter != null) { + xValues = xValues.filter((_, datumIndex) => indexFilter[datumIndex] === false); + yValues = yValues.filter((_, datumIndex) => indexFilter[datumIndex] === false); + } + let [startIndex, endIndex] = visibleRangeIndices( + 1, + xValues.length, + xAxis.range, + (datumIndex) => this.xCoordinateRange(xValues[datumIndex], 0) + ); + startIndex = Math.max(startIndex - 2, 0); + endIndex = Math.min(endIndex + 2, xValues.length); + let phantomSpans; + if (seriesBelowStackContext?.fillSpans) { + phantomSpans = seriesBelowStackContext?.fillSpans; + } else { + const phantomSpanPoints = []; + for (let datumIndex = startIndex; datumIndex < endIndex; datumIndex += 1) { + const xDatum = xValues[datumIndex]; + phantomSpanPoints.push({ + point: { + x: xScale.convert(xDatum) + xOffset, + y: yScale.convert(0) + }, + xDatum, + yDatum: 0 + }); + } + phantomSpans = interpolatePoints(phantomSpanPoints, { type: "linear" }); + } + this.phantomSpans = phantomSpans; + if (!visible) { + this.fillSpans = phantomSpans; + this.strokeSpans = []; + return seriesBelowStackContext; + } + let bottomStack = seriesBelowStackContext?.stack; + if (bottomStack == null) { + bottomStack = []; + for (let datumIndex = startIndex; datumIndex < endIndex - 1; datumIndex += 1) { + bottomStack.push({ leading: 0, trailing: 0, dataValid: true, breakBefore: false }); + } + } + const topStack = bottomStack.slice(); + let trackingValidData = false; + for (let stackIndex = 0; stackIndex < topStack.length; stackIndex += 1) { + const leadingIndex = startIndex + stackIndex; + const trailingIndex = startIndex + stackIndex + 1; + let { leading, trailing, breakBefore } = bottomStack[stackIndex]; + const leadingValue = yValues[leadingIndex]; + const trailingValue = yValues[trailingIndex]; + const missingLeading = !Number.isFinite(leadingValue); + const missingTrailing = !Number.isFinite(trailingValue); + const dataValid = !missingLeading && !missingTrailing; + if (dataValid) { + leading += leadingValue; + trailing += trailingValue; + } + if (stackIndex !== 0 && dataValid !== trackingValidData) { + breakBefore = true; + } + trackingValidData = dataValid; + topStack[stackIndex] = { leading, trailing, dataValid, breakBefore }; + } + const fillSpans = []; + const strokeSpans = []; + const topSpanPoints = []; + for (let stackIndex = 0; stackIndex < topStack.length; stackIndex += 1) { + const { leading, dataValid, breakBefore } = topStack[stackIndex]; + const leadingIndex = startIndex + stackIndex; + if (breakBefore) { + if (topSpanPoints.length !== 0) { + const previousStack = topStack[stackIndex - 1]; + const previousPoint = { + point: { + x: xScale.convert(xValues[leadingIndex]) + xOffset, + y: yScale.convert(previousStack.trailing) + }, + xDatum: xValues[leadingIndex], + yDatum: previousStack.trailing + }; + topSpanPoints.push(previousPoint); + const spans = interpolatePoints(topSpanPoints, interpolation); + fillSpans.push(...spans); + strokeSpans.push(...spans); + } + topSpanPoints.length = 0; + } + if (dataValid) { + const leadingPoint = { + point: { + x: xScale.convert(xValues[leadingIndex]) + xOffset, + y: yScale.convert(leading) + }, + xDatum: xValues[leadingIndex], + yDatum: leading + }; + topSpanPoints.push(leadingPoint); + } else { + fillSpans.push(phantomSpans[stackIndex]); + } + } + if (topSpanPoints.length !== 0) { + const previousStack = topStack.at(-1); + const trailingIndex = startIndex + topStack.length; + const trailingPoint = { + point: { + x: xScale.convert(xValues[trailingIndex]) + xOffset, + y: yScale.convert(previousStack.trailing) + }, + xDatum: xValues[trailingIndex], + yDatum: previousStack.trailing + }; + topSpanPoints.push(trailingPoint); + const spans = interpolatePoints(topSpanPoints, interpolation); + fillSpans.push(...spans); + strokeSpans.push(...spans); + topSpanPoints.length = 0; + } + this.fillSpans = fillSpans; + this.strokeSpans = strokeSpans; + return { + stack: topStack, + fillSpans, + strokeSpans + }; + } + createStackContext() { + const xAxis = this.axes["x" /* X */]; + if (xAxis == null) + return; + const { scale: xScale } = xAxis; + const [r0, r1] = xScale.range; + const range4 = Math.abs(r1 - r0); + const dataAggregationFilter = this.dataAggregationFilters?.find((f) => f.maxRange > range4); + if (dataAggregationFilter) { + return this.stackAggregatedData(dataAggregationFilter); + } else { + return this.stackYValueData(); + } + } + createNodeData() { + const { axes, data, processedData, dataModel, dataAggregationFilters } = this; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (!xAxis || !yAxis || !data || !dataModel || !processedData) + return; + const { + xKey, + xName, + yFilterKey, + yKey, + yName, + legendItemName, + marker, + label, + fill: seriesFill, + stroke: seriesStroke + } = this.properties; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const { isContinuousY } = this.getScaleInformation({ xScale, yScale }); + const xOffset = (xScale.bandwidth ?? 0) / 2; + const stacked = processedData.type === "grouped"; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yRawValues = dataModel.resolveColumnById(this, `yValueRaw`, processedData); + const yCumulativeValues = stacked ? dataModel.resolveColumnById(this, `yValueCumulative`, processedData) : yRawValues; + const yFilterValues = yFilterKey == null ? void 0 : dataModel.resolveColumnById(this, "yFilterRaw", processedData); + const yDomain = this.getSeriesDomain("y" /* Y */); + const labelData = []; + const markerData = []; + const { visibleSameStackCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + let crossFiltering = false; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const invalidData = processedData.invalidData?.get(this.id); + const [r0, r1] = xScale.range; + const range4 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range4); + let startIndex = 0; + let endIndex = 0; + const indices = dataAggregationFilter?.indices; + [startIndex, endIndex] = this.visibleRangeIndices("xValue", xAxis.range, indices); + startIndex = Math.max(startIndex - 2, 0); + endIndex = Math.min(endIndex + 2, indices?.length ?? xValues.length); + if (processedData.input.count < 1e3) { + startIndex = 0; + endIndex = processedData.input.count; + } + const createMarkerCoordinate = (xDatum, yEnd, rawYDatum) => { + let currY; + if (isDefined(this.properties.normalizedTo) ? isContinuousY && isContinuous(rawYDatum) : !Number.isNaN(rawYDatum)) { + currY = yEnd; + } + return { + x: xScale.convert(xDatum) + xOffset, + y: yScale.convert(currY), + size: marker.size + }; + }; + const handleDatum = (datumIndex) => { + const xDatum = xValues[datumIndex]; + if (xDatum == null) + return; + const seriesDatum = rawData[datumIndex]; + const yDatum = yRawValues[datumIndex]; + const yValueCumulative = yCumulativeValues[datumIndex]; + const validPoint = Number.isFinite(yDatum) && invalidData?.[datumIndex] !== true; + const point = createMarkerCoordinate(xDatum, +yValueCumulative, yDatum); + const selected = yFilterValues == null ? void 0 : yFilterValues[datumIndex] === yDatum; + if (selected === false) { + crossFiltering = true; + } + if (validPoint && marker) { + markerData.push({ + series: this, + itemId: yKey, + datum: seriesDatum, + datumIndex, + midPoint: { x: point.x, y: point.y }, + cumulativeValue: +yValueCumulative, + yValue: yDatum, + xValue: xDatum, + yKey, + xKey, + point, + fill: marker.fill ?? seriesFill, + stroke: marker.stroke ?? seriesStroke, + strokeWidth: marker.strokeWidth ?? this.properties.strokeWidth, + selected + }); + } + if (label.enabled && validPoint) { + const labelText = this.getLabelText( + yDatum, + seriesDatum, + yKey, + "y", + yDomain, + label, + { value: yDatum, datum: seriesDatum, xKey, yKey, xName, yName, legendItemName } + ); + labelData.push({ + series: this, + itemId: yKey, + datum: seriesDatum, + datumIndex, + x: point.x, + y: point.y, + labelText + }); + } + }; + for (let i = startIndex; i < endIndex; i += 1) { + const datumIndex = indices?.[i] ?? i; + if (xValues[datumIndex] == null) + continue; + handleDatum(datumIndex); + } + const segments = calculateSegments( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene, + false + ); + const context = { + itemId: yKey, + fillData: { itemId: yKey, spans: this.fillSpans, phantomSpans: this.phantomSpans }, + strokeData: { itemId: yKey, spans: this.strokeSpans }, + labelData, + nodeData: markerData, + scales: this.calculateScaling(), + visible: this.visible, + stackVisible: visibleSameStackCount > 0, + crossFiltering, + styles: getMarkerStyles(this, this.properties, marker), + segments + }; + return context; + } + isPathOrSelectionDirty() { + return this.properties.marker.isDirty(); + } + updatePathNodes(opts) { + const { + paths: [fillPaths, strokePaths], + visible, + animationEnabled + } = opts; + const crossFiltering = this.contextNodeData?.crossFiltering === true; + const segments = this.contextNodeData?.segments; + const merged = mergeDefaults(this.getHighlightStyle(), this.getStyle(false)); + const { strokeWidth, stroke: stroke3, strokeOpacity, lineDash, lineDashOffset, fill, fillOpacity, opacity } = merged; + strokePaths.setProperties({ + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: 1 /* None */, + stroke: stroke3, + strokeWidth, + strokeOpacity: strokeOpacity * (crossFiltering ? CROSS_FILTER_AREA_STROKE_OPACITY_FACTOR : 1), + lineDash, + lineDashOffset, + opacity, + visible: visible || animationEnabled + }); + strokePaths.datum = segments; + applyShapeStyle( + fillPaths, + { + fill, + stroke: void 0, + fillOpacity: fillOpacity * (crossFiltering ? CROSS_FILTER_AREA_FILL_OPACITY_FACTOR : 1) + }, + this.getShapeFillBBox() + ); + fillPaths.setProperties({ + segments, + lineJoin: "round", + pointerEvents: 1 /* None */, + fillShadow: this.properties.shadow, + opacity, + visible: visible || animationEnabled + }); + fillPaths.datum = segments; + updateClipPath(this, strokePaths); + updateClipPath(this, fillPaths); + } + updatePaths(opts) { + this.updateAreaPaths(opts.paths, opts.contextData); + } + updateAreaPaths(paths, contextData) { + for (const path of paths) { + path.visible = contextData.visible; + } + if (contextData.visible) { + this.updateFillPath(paths, contextData); + this.updateStrokePath(paths, contextData); + } else { + for (const path of paths) { + path.path.clear(); + path.markDirty("AreaSeries"); + } + } + } + updateFillPath(paths, contextData) { + const [fill] = paths; + fill.path.clear(); + plotAreaPathFill(fill, contextData.fillData); + fill.markDirty("AreaSeries"); + } + updateStrokePath(paths, contextData) { + const { spans } = contextData.strokeData; + const [, stroke3] = paths; + stroke3.path.clear(); + plotLinePathStroke(stroke3, spans); + stroke3.markDirty("AreaSeries"); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const { contextNodeData, processedData, axes, properties } = this; + const { marker, styler } = properties; + const markerStyle = styler ? this.getStyle(false).marker : void 0; + const markersEnabled = contextNodeData?.crossFiltering === true || markerEnabled(processedData.input.count, axes["x" /* X */].scale, marker, markerStyle); + if (marker.isDirty()) { + datumSelection.clear(); + datumSelection.cleanup(); + } + return datumSelection.update(markersEnabled ? nodeData : []); + } + updateDatumStyles(opts) { + const { datumSelection, isHighlight } = opts; + const { marker } = this.properties; + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum) => { + if (!datumSelection.isGarbage(node)) { + const highlightState = this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { stroke: stroke3, strokeWidth, strokeOpacity } = stylerStyle; + const params = this.makeItemStylerParams( + this.dataModel, + this.processedData, + datum.datumIndex, + stylerStyle.marker + ); + datum.style = this.getMarkerStyle( + marker, + datum, + params, + { isHighlight, highlightState }, + stylerStyle.marker, + { + stroke: stroke3, + strokeWidth, + strokeOpacity + } + ); + } + }); + } + updateDatumNodes(opts) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum) => { + const style2 = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style2, node, datum.point, fillBBox, { selected: datum.selected }); + }); + if (!isHighlight) { + this.properties.marker.markClean(); + } + } + updateLabelSelection(opts) { + return opts.labelSelection.update(this.isLabelEnabled() ? opts.labelData : []); + } + updateLabelNodes(opts) { + const { isHighlight = false } = opts; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const params = this.makeLabelFormatterParams(); + opts.labelSelection.each((text2, datum) => { + const style2 = getLabelStyles(this, datum, params, this.properties.label, isHighlight, activeHighlight); + const { enabled, fontStyle, fontWeight, fontSize, fontFamily, color: color2 } = style2; + if (enabled && datum?.labelText) { + text2.fontStyle = fontStyle; + text2.fontWeight = fontWeight; + text2.fontSize = fontSize; + text2.fontFamily = fontFamily; + text2.textAlign = "center"; + text2.textBaseline = "bottom"; + text2.text = datum.labelText; + text2.x = datum.x; + text2.y = datum.y - 10; + text2.fill = color2; + text2.visible = true; + text2.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + text2.setBoxing(style2); + } else { + text2.visible = false; + } + }); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { marker, fill, fillOpacity, lineDash, lineDashOffset, stroke: stroke3, strokeOpacity, strokeWidth, xKey, yKey } = this.properties; + const highlightState = toHighlightString(highlightStateEnum ?? 0 /* None */); + return { + marker: { + fill: marker.fill, + fillOpacity: marker.fillOpacity, + size: marker.size, + shape: marker.shape, + stroke: marker.stroke, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }, + highlightState, + highlighted, + fill, + fillOpacity, + lineDash, + lineDashOffset, + seriesId, + stroke: stroke3, + strokeOpacity, + strokeWidth, + xKey, + yKey + }; + } + makeItemStylerParams(dataModel, processedData, datumIndex, style2) { + const { xKey, yKey } = this.properties; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValueRaw`, processedData)[datumIndex]; + const xDomain = dataModel.getDomain(this, `xValue`, "key", processedData); + const yDomain = dataModel.getDomain(this, this.yCumulativeKey(processedData), "value", processedData); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + ...datumStylerProperties(xValue2, yValue, xKey, yKey, xDomain, yDomain), + xValue: xValue2, + yValue, + ...style2, + fill + }; + } + makeLabelFormatterParams() { + const { xKey, xName, yKey, yName, legendItemName } = this.properties; + return { xKey, xName, yKey, yName, legendItemName }; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { xKey, xName, yKey, yName, tooltip, legendItemName } = properties; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data?.[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValueRaw`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(dataModel, processedData, datumIndex, stylerStyle.marker); + const format = this.getMarkerStyle( + this.properties.marker, + { datumIndex, datum }, + params, + { isHighlight: false }, + stylerStyle.marker + ); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [ + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, yKey, legendItemName) + } + ] + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yKey, + yName, + ...format, + ...this.getModuleTooltipParams() + } + ); + } + legendItemSymbol() { + const { fill, stroke: stroke3, fillOpacity, strokeOpacity, strokeWidth, lineDash, marker } = this.getStyle(false); + const useAreaFill = !marker.enabled || marker.fill == null; + const legendMarkerFill = useAreaFill ? fill : marker.fill; + const markerStyle = this.getMarkerStyle( + this.properties.marker, + {}, + void 0, + { isHighlight: false, checkForHighlight: false }, + { + size: marker.size, + shape: marker.shape, + fill: legendMarkerFill, + fillOpacity: useAreaFill ? fillOpacity : marker.fillOpacity, + stroke: marker.stroke + } + ); + return { + marker: { + ...markerStyle, + enabled: marker.enabled || strokeWidth <= 0 + }, + line: { + stroke: stroke3, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { yKey: itemId, yName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType, + id: seriesId, + itemId, + legendItemName, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId }), + label: { + text: legendItemName ?? yName ?? itemId + }, + symbol: this.legendItemSymbol(), + hideInLegend: !showInLegend + } + ]; + } + animateEmptyUpdateReady(animationData) { + const { datumSelection, labelSelection, contextData, paths } = animationData; + const { animationManager } = this.ctx; + this.updateAreaPaths(paths, contextData); + pathSwipeInAnimation(this, animationManager, ...paths); + resetMotion([datumSelection], resetMarkerPositionFn); + markerSwipeScaleInAnimation(this, animationManager, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + } + animateReadyResize(animationData) { + const { contextData, paths } = animationData; + this.updateAreaPaths(paths, contextData); + super.animateReadyResize(animationData); + } + animateWaitingUpdateReady(animationData) { + const { animationManager } = this.ctx; + const { datumSelection, labelSelection, contextData, paths, previousContextData } = animationData; + const [fill, stroke3] = paths; + if (contextData.visible === false && previousContextData?.visible === false) + return; + if (fill == null && stroke3 == null) + return; + this.resetDatumAnimation(animationData); + this.resetLabelAnimation(animationData); + const update = () => { + this.resetPathAnimation(animationData); + this.updateAreaPaths(paths, contextData); + }; + const skip = () => { + animationManager.skipCurrentBatch(); + update(); + }; + if (contextData == null || previousContextData == null) { + update(); + markerFadeInAnimation(this, animationManager, "added", datumSelection); + pathFadeInAnimation(this, "fill_path_properties", animationManager, "add", fill); + pathFadeInAnimation(this, "stroke_path_properties", animationManager, "add", stroke3); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + return; + } + if (contextData.crossFiltering !== previousContextData.crossFiltering) { + skip(); + return; + } + const fns = prepareAreaPathAnimation(contextData, previousContextData); + if (fns === void 0) { + skip(); + return; + } else if (fns.status === "no-op") { + return; + } + markerFadeInAnimation(this, animationManager, void 0, datumSelection); + fromToMotion(this.id, "fill_path_properties", animationManager, [fill], fns.fill.pathProperties); + pathMotion(this.id, "fill_path_update", animationManager, [fill], fns.fill.path); + fromToMotion(this.id, "stroke_path_properties", animationManager, [stroke3], fns.stroke.pathProperties); + pathMotion(this.id, "stroke_path_update", animationManager, [stroke3], fns.stroke.path); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + this.ctx.animationManager.animate({ + id: this.id, + groupId: "reset_after_animation", + phase: "trailing", + from: {}, + to: {}, + onComplete: () => this.updateAreaPaths(paths, contextData) + }); + } + isLabelEnabled() { + return this.properties.label.enabled; + } + nodeFactory() { + return new Marker(); + } + getStyle(highlighted, highlightState) { + const { styler, marker, fill, fillOpacity, lineDash, lineDashOffset, stroke: stroke3, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill: markerFill = "transparent", fillOpacity: markerFillOpacity } = marker; + let stylerResult = {}; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + const cbResult = this.cachedCallWithContext(styler, stylerParams) ?? {}; + const resolved = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + cbResult, + { pick: false } + ); + stylerResult = resolved ?? {}; + } + stylerResult.marker ?? (stylerResult.marker = {}); + return { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke3, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? markerFill, + fillOpacity: stylerResult.marker.fillOpacity ?? markerFillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke3, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } + getFormattedMarkerStyle(datum) { + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams( + this.dataModel, + this.processedData, + datum.datumIndex, + stylerStyle.marker + ); + return this.getMarkerStyle( + this.properties.marker, + datum, + params, + { isHighlight: true }, + void 0, + stylerStyle + ); + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds(this, opts); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +AreaSeries.className = "AreaSeries"; +AreaSeries.type = "area"; + +// packages/ag-charts-community/src/chart/series/cartesian/areaSeriesModule.ts +var AreaSeriesModule = { + type: "series", + optionsKey: "series[]", + packageType: "community", + chartTypes: ["cartesian"], + identifier: "area", + moduleFactory: (ctx) => new AreaSeries(ctx), + stackable: true, + predictAxis: predictCartesianTimeAxis, + defaultAxes: [ + { + type: "number" /* NUMBER */, + position: "left" /* LEFT */ + }, + { + type: "category" /* CATEGORY */, + position: "bottom" /* BOTTOM */ + } + ], + themeTemplate: { + series: { + nodeClickRange: "nearest", + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + fillOpacity: 0.8, + strokeOpacity: 1, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + lineDash: [0], + lineDashOffset: 0, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + interpolation: { + type: "linear" + }, + marker: { + enabled: false, + shape: "circle", + size: 7, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" } + }, + label: { + ...LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] }, + position: { + anchorTo: { $path: ["/tooltip/position/anchorTo", "node"] } + } + }, + highlight: multiSeriesHighlightStyle(), + segmentation: SEGMENTATION_DEFAULTS + } + } +}; +var NewAreaSeriesModule = { + type: "series", + name: "area", + chartType: "cartesian", + options: areaSeriesOptionsDef, + create: (ctx) => new AreaSeries(ctx) +}; + +// packages/ag-charts-community/src/scene/shape/barShape.ts +var BarShape = class extends Rect { + constructor() { + super(...arguments); + this.direction = "x"; + this.featherRatio = 0; + } + get feathered() { + return Math.abs(this.featherRatio) > 1e-6; + } + isPointInPath(x, y) { + if (!this.feathered) { + return super.isPointInPath(x, y); + } + const bbox = this.getBBox(); + return bbox.containsPoint(x, y); + } + updatePath() { + if (!this.feathered) { + super.updatePath(); + return; + } + const { path, borderPath, x, y, width: width2, height: height2, direction, featherRatio } = this; + path.clear(); + borderPath.clear(); + if (direction === "x") { + const featherInsetX = Math.abs(featherRatio) * width2; + if (featherRatio > 0) { + path.moveTo(x, y); + path.lineTo(x + width2 - featherInsetX, y); + path.lineTo(x + width2, y + height2 / 2); + path.lineTo(x + width2 - featherInsetX, y + height2); + path.lineTo(x, y + height2); + path.closePath(); + } else { + path.moveTo(x + featherInsetX, y); + path.lineTo(x + width2, y); + path.lineTo(x + width2, y + height2); + path.lineTo(x + featherInsetX, y + height2); + path.lineTo(x, y + height2 / 2); + path.closePath(); + } + } else { + const featherInsetY = Math.abs(featherRatio) * height2; + if (featherRatio > 0) { + path.moveTo(x, y + featherInsetY); + path.lineTo(x + width2 / 2, y); + path.lineTo(x + width2, y + featherInsetY); + path.lineTo(x + width2, y + height2); + path.lineTo(x, y + height2); + path.closePath(); + } else { + path.moveTo(x, y); + path.lineTo(x + width2, y); + path.lineTo(x + width2, y + height2 - featherInsetY); + path.lineTo(x + width2 / 2, y + height2); + path.lineTo(x, y + height2 - featherInsetY); + path.closePath(); + } + } + } + renderStroke(ctx) { + if (!this.feathered) { + super.renderStroke(ctx); + return; + } + const { stroke: stroke3, strokeWidth } = this; + if (stroke3 && strokeWidth) { + const { globalAlpha } = ctx; + const { lineDash, lineDashOffset, lineCap, lineJoin, path } = this; + this.applyStrokeAndAlpha(ctx); + ctx.lineWidth = strokeWidth; + if (lineDash) { + ctx.setLineDash(lineDash); + } + if (lineDashOffset) { + ctx.lineDashOffset = lineDashOffset; + } + if (lineCap) { + ctx.lineCap = lineCap; + } + if (lineJoin) { + ctx.lineJoin = lineJoin; + } + ctx.stroke(path.getPath2D()); + ctx.globalAlpha = globalAlpha; + } + } +}; +__decorateClass([ + SceneChangeDetection() +], BarShape.prototype, "direction", 2); +__decorateClass([ + SceneChangeDetection() +], BarShape.prototype, "featherRatio", 2); + +// packages/ag-charts-community/src/chart/series/cartesian/quadtreeUtil.ts +function addHitTestersToQuadtree(quadtree, hitTesters) { + for (const node of hitTesters) { + const datum = node.datum; + if (datum === void 0) { + logger_exports.error("undefined datum"); + } else { + quadtree.addValue(node, datum); + } + } +} +function findQuadtreeMatch(series, point) { + const { x, y } = point; + const { nearest, distanceSquared: distanceSquared2 } = series.getQuadTree().find(x, y); + if (nearest !== void 0) { + return { datum: nearest.value, distance: Math.sqrt(distanceSquared2) }; + } + return void 0; +} + +// packages/ag-charts-community/src/chart/series/cartesian/abstractBarSeries.ts +var AbstractBarSeriesProperties = class extends CartesianSeriesProperties { + constructor() { + super(...arguments); + this.direction = "vertical"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], AbstractBarSeriesProperties.prototype, "direction", 2); +var AbstractBarSeries = class extends CartesianSeries { + constructor() { + super(...arguments); + /** + * Used to get the position of bars within each group. + */ + this.groupScale = new CategoryScale(); + this.smallestDataInterval = void 0; + this.largestDataInterval = void 0; + } + get hasData() { + return this.getHasData("xValue"); + } + padBandExtent(keys, alignStart) { + const ratio2 = typeof alignStart === "boolean" ? 1 : 0.5; + const scalePadding = isFiniteNumber(this.smallestDataInterval) ? this.smallestDataInterval * ratio2 : 0; + const keysExtent = extent(keys) ?? [Number.NaN, Number.NaN]; + if (typeof alignStart === "boolean") { + keysExtent[alignStart ? 0 : 1] -= (alignStart ? 1 : -1) * scalePadding; + } else { + keysExtent[0] -= scalePadding; + keysExtent[1] += scalePadding; + } + return fixNumericExtent(keysExtent); + } + getBandScalePadding() { + return { inner: 0.3, outer: 0.15 }; + } + shouldFlipXY() { + return !this.isVertical(); + } + isVertical() { + return this.properties.direction === "vertical"; + } + getBarDirection() { + return this.shouldFlipXY() ? "x" /* X */ : "y" /* Y */; + } + getCategoryDirection() { + return this.shouldFlipXY() ? "y" /* Y */ : "x" /* X */; + } + getValueAxis() { + const direction = this.getBarDirection(); + return this.axes[direction]; + } + getCategoryAxis() { + const direction = this.getCategoryDirection(); + return this.axes[direction]; + } + getBandwidth(xAxis, minWidth) { + return ContinuousScale.is(xAxis.scale) ? xAxis.scale.calcBandwidth(this.smallestDataInterval, minWidth) : xAxis.scale.bandwidth; + } + xCoordinateRange(xValue2) { + const xAxis = this.axes[this.getCategoryDirection()]; + const xScale = xAxis.scale; + const bandWidth = this.getBandwidth(xAxis, 0) ?? 0; + const barOffset = ContinuousScale.is(xScale) ? bandWidth * -0.5 : 0; + const x = xScale.convert(xValue2) + barOffset; + return [x, x + bandWidth]; + } + yCoordinateRange(yValues) { + const yAxis = this.axes[this.getBarDirection()]; + const yScale = yAxis.scale; + const ys = yValues.map((yValue) => yScale.convert(yValue)); + if (ys.length === 1) { + const y0 = yScale.convert(0); + return [Math.min(ys[0], y0), Math.max(ys[0], y0)]; + } + return [Math.min(...ys), Math.max(...ys)]; + } + updateGroupScale(xAxis) { + const domain = []; + const { groupScale } = this; + const xBandWidth = this.getBandwidth(xAxis); + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + for (let groupIdx = 0; groupIdx < visibleGroupCount; groupIdx++) { + domain.push(String(groupIdx)); + } + groupScale.domain = domain; + groupScale.range = [0, xBandWidth ?? 0]; + if (xAxis instanceof GroupedCategoryAxis) { + groupScale.paddingInner = xAxis.groupPaddingInner; + } else if (xAxis instanceof CategoryAxis) { + groupScale.paddingInner = xAxis.groupPaddingInner; + groupScale.round = groupScale.padding !== 0; + } else { + groupScale.padding = 0; + } + const barWidth = groupScale.bandwidth >= 1 ? ( + // Pixel-rounded value for low-volume bar charts. + groupScale.bandwidth + ) : ( + // Handle high-volume bar charts gracefully. + groupScale.rawBandwidth + ); + return { barWidth, groupIndex }; + } + resolveKeyDirection(direction) { + if (this.getBarDirection() === "x" /* X */) { + if (direction === "x" /* X */) { + return "y" /* Y */; + } + return "x" /* X */; + } + return direction; + } + initQuadTree(quadtree) { + addHitTestersToQuadtree(quadtree, this.datumNodesIter()); + } + pickNodeClosestDatum(point) { + return findQuadtreeMatch(this, point); + } +}; + +// packages/ag-charts-community/src/chart/series/cartesian/barAggregation.ts +var AGGREGATION_THRESHOLD2 = 1e3; +function getIndices(maxRange, indexData) { + return Array.from({ length: maxRange }, (_, index) => { + const aggIndex = index * AGGREGATION_SPAN; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX]; + return Math.trunc((xMinIndex + xMaxIndex) / 2); + }); +} +function aggregateBarData(scale2, xValues, yStartValues, yEndValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD2) + return; + const [d0, d1] = aggregationDomain(scale2, domain); + let maxRange = aggregationRangeFittingPoints(xValues, d0, d1, { smallestKeyInterval }); + let { indexData: positiveIndexData, valueData: positiveValueData } = createAggregationIndices( + xValues, + yEndValues, + yStartValues ?? yEndValues, + d0, + d1, + maxRange, + { positive: true } + ); + let { indexData: negativeIndexData, valueData: negativeValueData } = createAggregationIndices( + xValues, + yEndValues, + yStartValues ?? yEndValues, + d0, + d1, + maxRange, + { positive: false } + ); + let positiveIndices = getIndices(maxRange, positiveIndexData); + let negativeIndices = getIndices(maxRange, negativeIndexData); + const filters = [ + { maxRange, positiveIndices, positiveIndexData, negativeIndices, negativeIndexData } + ]; + while (maxRange > 64) { + ({ indexData: positiveIndexData, valueData: positiveValueData } = compactAggregationIndices( + positiveIndexData, + positiveValueData, + maxRange + )); + ({ + indexData: negativeIndexData, + valueData: negativeValueData, + maxRange + } = compactAggregationIndices(negativeIndexData, negativeValueData, maxRange)); + positiveIndices = getIndices(maxRange, positiveIndexData); + negativeIndices = getIndices(maxRange, negativeIndexData); + filters.push({ maxRange, positiveIndices, positiveIndexData, negativeIndices, negativeIndexData }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-community/src/chart/series/cartesian/barSeriesProperties.ts +var BarSeriesLabel = class extends Label { + constructor() { + super(...arguments); + this.placement = "inside-center"; + this.spacing = 0; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesLabel.prototype, "placement", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesLabel.prototype, "spacing", 2); +var BarSeriesProperties = class extends AbstractBarSeriesProperties { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#874349"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.crisp = void 0; + this.shadow = new DropShadow(); + this.label = new BarSeriesLabel(); + this.tooltip = makeSeriesTooltip(); + this.sparklineMode = false; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "xName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "yName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "yFilterKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "stackGroup", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "normalizedTo", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "crisp", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "styler", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "shadow", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "label", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BarSeriesProperties.prototype, "sparklineMode", 2); + +// packages/ag-charts-community/src/chart/series/cartesian/barUtil.ts +function checkCrisp(scale2, visibleRange, smallestDataInterval, largestDataInterval) { + if (visibleRange != null) { + const [visibleMin, visibleMax] = visibleRange; + const isZoomed = visibleMin !== 0 || visibleMax !== 1; + if (isZoomed) + return false; + } + if (ContinuousScale.is(scale2)) { + const spacing = scale2.calcBandwidth(largestDataInterval) - scale2.calcBandwidth(smallestDataInterval); + if (spacing > 0 && spacing < 1) + return false; + } + if (BandScale.is(scale2)) { + const { bandwidth, step } = scale2; + if (bandwidth > 0 && bandwidth < 1) + return false; + const spacing = step - bandwidth; + if (spacing > 0 && spacing < 1) + return false; + } + return true; +} +var isDatumNegative = (datum) => { + return isNegative(datum.yValue ?? 0); +}; +function collapsedStartingBarPosition(isVertical, axes, mode) { + const { startingX, startingY } = getStartingValues(isVertical, axes); + const calculate = (datum, prevDatum) => { + let x = isVertical ? datum.x : startingX; + let y = isVertical ? startingY : datum.y; + let width2 = isVertical ? datum.width : 0; + let height2 = isVertical ? 0 : datum.height; + const { opacity = 1 } = datum; + if (prevDatum && (Number.isNaN(x) || Number.isNaN(y))) { + ({ x, y } = prevDatum); + width2 = isVertical ? prevDatum.width : 0; + height2 = isVertical ? 0 : prevDatum.height; + if (isVertical && !isDatumNegative(prevDatum)) { + y += prevDatum.height; + } else if (!isVertical && isDatumNegative(prevDatum)) { + x += prevDatum.width; + } + } + let clipBBox; + if (datum.clipBBox == null) { + clipBBox = void 0; + } else if (isDatumNegative(datum)) { + clipBBox = isVertical ? new BBox(x, y - height2, width2, height2) : new BBox(x - width2, y, width2, height2); + } else { + clipBBox = new BBox(x, y, width2, height2); + } + return { x, y, width: width2, height: height2, clipBBox, opacity }; + }; + return { isVertical, calculate, mode }; +} +function midpointStartingBarPosition(isVertical, mode) { + return { + isVertical, + calculate: (datum) => { + return { + x: isVertical ? datum.x : datum.x + datum.width / 2, + y: isVertical ? datum.y + datum.height / 2 : datum.y, + width: isVertical ? datum.width : 0, + height: isVertical ? 0 : datum.height, + clipBBox: datum.clipBBox, + opacity: datum.opacity ?? 1 + }; + }, + mode + }; +} +function prepareBarAnimationFunctions(initPos, unknownStatus) { + const isRemoved = (datum) => datum == null || Number.isNaN(datum.x) || Number.isNaN(datum.y); + const fromFn = (rect2, datum, status) => { + if (status === "updated" && isRemoved(datum)) { + status = "removed"; + } else if (status === "updated" && isRemoved(rect2.previousDatum)) { + status = "added"; + } + let source; + if (status === "unknown" || status === "added") { + if (rect2.previousDatum == null && initPos.mode === "fade") { + source = { + ...resetBarSelectionsFn(rect2, datum), + opacity: 0 + }; + } else { + source = initPos.calculate(datum, rect2.previousDatum); + } + if (status === "unknown") { + status = unknownStatus; + } + } else { + source = { + x: rect2.x, + y: rect2.y, + width: rect2.width, + height: rect2.height, + clipBBox: rect2.clipBBox, + opacity: rect2.opacity ?? 1 + }; + } + const phase = NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { ...source, phase }; + }; + const toFn = (rect2, datum, status) => { + if (status === "removed" && rect2.datum == null && initPos.mode === "fade") { + return { ...resetBarSelectionsFn(rect2, datum), opacity: 0 }; + } else if (status === "removed" || isRemoved(datum)) { + return initPos.calculate(datum, rect2.previousDatum); + } else { + return { + x: datum.x, + y: datum.y, + width: datum.width, + height: datum.height, + clipBBox: datum.clipBBox, + opacity: datum.opacity ?? 1 + }; + } + }; + const applyFn = (rect2, datum, status) => { + rect2.setProperties(datum); + rect2.crisp = status === "end" && (rect2.datum?.crisp ?? false); + }; + return { toFn, fromFn, applyFn }; +} +function getStartingValues(isVertical, axes) { + const axis = axes[isVertical ? "y" /* Y */ : "x" /* X */]; + let startingX = Infinity; + let startingY = 0; + if (!axis) { + return { startingX, startingY }; + } + if (isVertical) { + startingY = axis.scale.convert(ContinuousScale.is(axis.scale) ? 0 : Math.max(...axis.range)); + } else { + startingX = axis.scale.convert(ContinuousScale.is(axis.scale) ? 0 : Math.min(...axis.range)); + } + return { startingX, startingY }; +} +function resetBarSelectionsFn(rect2, { x, y, width: width2, height: height2, clipBBox, opacity = 1 }) { + return { x, y, width: width2, height: height2, clipBBox, opacity, crisp: rect2.datum?.crisp ?? false }; +} +function computeBarFocusBounds(series, datum) { + if (datum === void 0) + return void 0; + const { x, y, width: width2, height: height2 } = datum; + return Transformable.toCanvas(series.contentGroup, new BBox(x, y, width2, height2)); +} + +// packages/ag-charts-community/src/chart/series/cartesian/diffUtil.ts +function calculateDataDiff(seriesId, datumSelection, getDatumId, contextNodeData, previousContextNodeData, processedData, processedDataUpdated) { + let dataDiff = processedData?.reduced?.diff?.[seriesId]; + if (dataDiff?.changed) { + return dataDiff; + } + if (!processedDataUpdated) { + return { + changed: false, + added: /* @__PURE__ */ new Set(), + updated: /* @__PURE__ */ new Set(), + removed: /* @__PURE__ */ new Set(), + moved: /* @__PURE__ */ new Set() + }; + } + const scalingChanged = hasScalingChanged(contextNodeData, previousContextNodeData); + if (dataDiff == null && processedData?.reduced?.diff != null) { + dataDiff = { + changed: true, + added: /* @__PURE__ */ new Set(), + updated: /* @__PURE__ */ new Set(), + removed: /* @__PURE__ */ new Set(), + moved: /* @__PURE__ */ new Set() + }; + if (scalingChanged) { + dataDiff.updated = new Set(Array.from(datumSelection, ({ datum }) => getDatumId(datum))); + } else { + dataDiff.added = new Set(Array.from(datumSelection, ({ datum }) => getDatumId(datum))); + } + } else if (scalingChanged) { + dataDiff = { + changed: true, + added: /* @__PURE__ */ new Set(), + updated: new Set(Array.from(datumSelection, ({ datum }) => getDatumId(datum))), + removed: /* @__PURE__ */ new Set(), + moved: /* @__PURE__ */ new Set() + }; + } + return dataDiff; +} +function isGroupScaleContext(ctx) { + return typeof ctx === "object" && ctx !== null && "groupScale" in ctx; +} +function hasScalingChanged(contextNodeData, previousContextNodeData) { + if (!previousContextNodeData) + return false; + const scales = contextNodeData.scales; + const prevScales = previousContextNodeData.scales; + if (!areScalingEqual(scales.x, prevScales.x)) + return true; + if (!areScalingEqual(scales.y, prevScales.y)) + return true; + if (!isGroupScaleContext(contextNodeData) || !isGroupScaleContext(previousContextNodeData)) + return false; + const groupScale = contextNodeData.groupScale; + const prevGroupScale = previousContextNodeData.groupScale; + return !areScalingEqual(groupScale, prevGroupScale); +} + +// packages/ag-charts-community/src/chart/series/cartesian/barSeries.ts +var memoizedAggregateBarData = simpleMemorize2(aggregateBarData); +var BarSeries = class extends AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: DEFAULT_CARTESIAN_DIRECTION_KEYS, + propertyNames: DEFAULT_CARTESIAN_DIRECTION_NAMES, + categoryKey: "xValue", + pickModes: [ + 2 /* AXIS_ALIGNED */, + // Only used in sparklineMode + 1 /* NEAREST_NODE */, + 0 /* EXACT_SHAPE_MATCH */ + ], + pathsPerSeries: [], + datumSelectionGarbageCollection: false, + animationAlwaysUpdateSelections: true, + animationResetFns: { + datum: resetBarSelectionsFn, + label: resetLabelFn + } + }); + this.properties = new BarSeriesProperties(); + this.connectsToYAxis = true; + this.dataAggregationFilters = void 0; + } + get pickModeAxis() { + return this.properties.sparklineMode ? "main" : void 0; + } + crossFilteringEnabled() { + return this.properties.yFilterKey != null && (this.seriesGrouping == null || this.seriesGrouping.stackIndex === 0); + } + async processData(dataController) { + if (!this.data) + return; + const { xKey, yKey, yFilterKey, normalizedTo } = this.properties; + const { seriesGrouping: { groupIndex = this.id } = {}, data } = this; + const stackCount = this.seriesGrouping?.stackCount ?? 0; + const stacked = stackCount > 1 || normalizedTo != null; + const grouped = stacked; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const stackGroupName = `bar-stack-${groupIndex}-yValues`; + const stackGroupTrailingName = `${stackGroupName}-trailing`; + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const props = [ + keyProperty(xKey, xScaleType, { id: "xValue" }), + valueProperty(yKey, yScaleType, { id: `yValue-raw`, invalidValue: null, ...visibleProps }) + ]; + if (this.crossFilteringEnabled()) { + props.push( + valueProperty(yFilterKey, yScaleType, { + id: `yFilterValue`, + invalidValue: null, + ...visibleProps + }) + ); + } + if (stacked) { + props.push( + ...groupAccumulativeValueProperty( + yKey, + "normal", + { + id: `yValue-end`, + rangeId: `yValue-range`, + invalidValue: null, + missingValue: 0, + groupId: stackGroupName, + separateNegative: true, + ...visibleProps + }, + yScaleType + ), + ...groupAccumulativeValueProperty( + yKey, + "trailing", + { + id: `yValue-start`, + invalidValue: null, + missingValue: 0, + groupId: stackGroupTrailingName, + separateNegative: true, + ...visibleProps + }, + yScaleType + ) + ); + } + if (isContinuousX) { + props.push(SMALLEST_KEY_INTERVAL, LARGEST_KEY_INTERVAL); + } + if (isFiniteNumber(normalizedTo)) { + props.push(normaliseGroupTo([stackGroupName, stackGroupTrailingName], Math.abs(normalizedTo))); + } + if (animationEnabled && this.processedData) { + props.push(diff(this.id, this.processedData)); + } + if (animationEnabled || !grouped) { + props.push(animationValidation()); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props, + groupByKeys: grouped, + groupByData: !grouped + }); + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.animationState.transition("updateData"); + } + yCumulativeKey(dataModel) { + return dataModel.hasColumnById(this, `yValue-end`) ? "yValue-end" : "yValue-raw"; + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (dataModel == null || processedData == null) + return []; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = dataModel.getDomain(this, `xValue`, "key", processedData); + if (keyDef?.def.type === "key" && keyDef.def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yKey = this.yCumulativeKey(dataModel); + let yExtent = this.domainForClippedRange(direction, [yKey], "xValue"); + const yFilterExtent = this.crossFilteringEnabled() ? dataModel.getDomain(this, `yFilterValue`, "value", processedData) : void 0; + if (yFilterExtent != null) { + yExtent = [Math.min(yExtent[0], yFilterExtent[0]), Math.max(yExtent[1], yFilterExtent[1])]; + } + const yAxis = this.getValueAxis(); + if (yAxis instanceof NumberAxis && !(yAxis instanceof LogAxis)) { + const fixedYExtent = Number.isFinite(yExtent[1] - yExtent[0]) ? [Math.min(0, yExtent[0]), Math.max(0, yExtent[1])] : []; + return fixNumericExtent(fixedYExtent); + } else { + return fixNumericExtent(yExtent); + } + } + getSeriesRange(direction, visibleRange) { + const selfDirection = this.properties.direction === "horizontal" ? "x" /* X */ : "y" /* Y */; + if (selfDirection !== direction) + return []; + const yKey = this.yCumulativeKey(this.dataModel); + const [y0, y1] = this.domainForVisibleRange("y" /* Y */, [yKey], "xValue", visibleRange); + return [Math.min(y0, 0), Math.max(y1, 0)]; + } + getZoomRangeFittingItems(xVisibleRange, yVisibleRange, minVisibleItems) { + const yKey = this.yCumulativeKey(this.dataModel); + return this.zoomFittingVisibleItems("xValue", [yKey], xVisibleRange, yVisibleRange, minVisibleItems); + } + getVisibleItems(xVisibleRange, yVisibleRange, minVisibleItems) { + const yKey = this.yCumulativeKey(this.dataModel); + return this.countVisibleItems("xValue", [yKey], xVisibleRange, yVisibleRange, minVisibleItems); + } + aggregateData(dataModel, processedData) { + if (processedDataIsAnimatable(processedData)) + return; + const xAxis = this.axes["x" /* X */]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const isStacked = dataModel.hasColumnById(this, `yValue-start`); + const yStartValues = isStacked ? dataModel.resolveColumnById(this, `yValue-start`, processedData) : void 0; + const yEndValues = isStacked ? dataModel.resolveColumnById(this, `yValue-end`, processedData) : dataModel.resolveColumnById(this, `yValue-raw`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateBarData( + xAxis.scale.type, + xValues, + yStartValues, + yEndValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + createNodeData() { + const { dataModel, processedData, groupScale, dataAggregationFilters } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const rawData = processedData.dataSources?.get(this.id); + if (rawData == null) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const { xKey, yKey, xName, yName, legendItemName, label } = this.properties; + const yDomain = this.getSeriesDomain("y" /* Y */); + const yReversed = yAxis.isReversed(); + const { barWidth, groupIndex: groupScaleIndex } = this.updateGroupScale(xAxis); + const groupOffset = groupScale.convert(String(groupScaleIndex)); + const barOffset = ContinuousScale.is(xScale) ? barWidth * -0.5 : 0; + const isStacked = dataModel.hasColumnById(this, `yValue-start`); + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yRawValues = dataModel.resolveColumnById(this, `yValue-raw`, processedData); + const yStartValues = isStacked ? dataModel.resolveColumnById(this, `yValue-start`, processedData) : void 0; + const yEndValues = isStacked ? dataModel.resolveColumnById(this, `yValue-end`, processedData) : void 0; + const yFilterValues = this.crossFilteringEnabled() ? dataModel.resolveColumnById(this, `yFilterValue`, processedData) : void 0; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xPosition = (index) => xScale.convert(xValues[index]) + groupOffset + barOffset; + const [r0, r1] = xScale.range; + const range4 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range4); + const crisp = dataAggregationFilter == null && (this.properties.crisp ?? checkCrisp(xAxis?.scale, xAxis?.visibleRange, this.smallestDataInterval, this.largestDataInterval)); + const bboxBottom = yScale.convert(0); + const nodeDatum = ({ + datum, + datumIndex, + xValue: xValue2, + yValue, + cumulativeValue, + phantom, + currY, + prevY, + x, + width: width2, + isPositive, + yRange, + labelText, + opacity, + featherRatio, + crossScale = 1 + }) => { + const isUpward = isPositive !== yReversed; + const y = yScale.convert(currY); + const bottomY = yScale.convert(prevY); + const bboxHeight = yScale.convert(yRange); + const barAlongX = this.getBarDirection() === "x" /* X */; + const xOffset = width2 * 0.5 * (1 - crossScale); + const rect2 = { + x: barAlongX ? Math.min(y, bottomY) : x + xOffset, + y: barAlongX ? x + xOffset : Math.min(y, bottomY), + width: barAlongX ? Math.abs(bottomY - y) : width2 * crossScale, + height: barAlongX ? width2 * crossScale : Math.abs(bottomY - y) + }; + const clipBBox = new BBox(rect2.x, rect2.y, rect2.width, rect2.height); + const barRect = { + x: barAlongX ? Math.min(bboxBottom, bboxHeight) : x + xOffset, + y: barAlongX ? x + xOffset : Math.min(bboxBottom, bboxHeight), + width: barAlongX ? Math.abs(bboxBottom - bboxHeight) : width2 * crossScale, + height: barAlongX ? width2 * crossScale : Math.abs(bboxBottom - bboxHeight) + }; + const lengthRatioMultiplier = this.shouldFlipXY() ? rect2.height : rect2.width; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + return { + series: this, + itemId: phantom ? createDatumId(yKey, phantom) : yKey, + datum, + datumIndex, + cumulativeValue, + phantom, + xValue: xValue2, + yValue, + yKey, + xKey, + capDefaults: { + lengthRatioMultiplier, + lengthMax: lengthRatioMultiplier + }, + x: barRect.x, + y: barRect.y, + width: barRect.width, + height: barRect.height, + midPoint: { x: rect2.x + rect2.width / 2, y: rect2.y + rect2.height / 2 }, + opacity, + featherRatio, + topLeftCornerRadius: barAlongX !== isUpward, + topRightCornerRadius: isUpward, + bottomRightCornerRadius: barAlongX === isUpward, + bottomLeftCornerRadius: !isUpward, + clipBBox, + crisp, + label: labelText == null ? void 0 : { + text: labelText, + ...adjustLabelPlacement({ + isUpward, + isVertical: !barAlongX, + placement: label.placement, + spacing, + rect: rect2 + }) + }, + missing: yValue == null, + focusable: !phantom + }; + }; + const phantomNodes = []; + const nodes = []; + const labels = []; + const handleDatum = (datumIndex, x, width2, yStart, yEnd, yRange, featherRatio = 0, opacity = 1) => { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return; + const datum = rawData.data[datumIndex]; + const yRawValue = yRawValues[datumIndex]; + const yFilterValue = yFilterValues == null ? void 0 : Number(yFilterValues[datumIndex]); + const isPositive = yRawValue >= 0 && !Object.is(yRawValue, -0); + if (!Number.isFinite(yEnd)) + return; + if (yFilterValue != null && !Number.isFinite(yFilterValue)) + return; + const labelText = label.enabled && yRawValue != null ? this.getLabelText( + yFilterValue ?? yRawValue, + datum, + yKey, + "y", + yDomain, + label, + { datum, value: yFilterValue ?? yRawValue, xKey, yKey, xName, yName, legendItemName } + ) : void 0; + const inset = yFilterValue != null && yFilterValue > yRawValue; + const nodeData = nodeDatum({ + datum, + datumIndex, + xValue: xValue2, + yValue: yFilterValue ?? yRawValue, + cumulativeValue: yFilterValue ?? yEnd, + phantom: false, + currY: yFilterValue == null ? yEnd : yStart + yFilterValue, + prevY: yStart, + x, + width: width2, + isPositive, + yRange: Math.max(yStart + (yFilterValue ?? -Infinity), yRange), + labelText, + opacity, + featherRatio, + crossScale: inset ? 0.6 : void 0 + }); + nodes.push(nodeData); + labels.push(nodeData); + if (yFilterValue != null) { + const phantomNodeData = nodeDatum({ + datum: rawData.data[datumIndex], + datumIndex, + xValue: xValue2, + yValue: yFilterValue, + cumulativeValue: yFilterValue, + phantom: true, + currY: yEnd, + prevY: yStart, + x, + width: width2, + isPositive, + yRange, + labelText: void 0, + opacity, + featherRatio, + crossScale: void 0 + }); + phantomNodes.push(phantomNodeData); + } + }; + if (dataAggregationFilter != null) { + const { positiveIndices, positiveIndexData, negativeIndices, negativeIndexData } = dataAggregationFilter; + const sign = yReversed ? -1 : 1; + for (let p = 0; p < 2; p += 1) { + const positive = p === 0; + const indices = positive ? positiveIndices : negativeIndices; + const indexData = positive ? positiveIndexData : negativeIndexData; + const Y_MIN = positive ? AGGREGATION_INDEX_Y_MIN : AGGREGATION_INDEX_Y_MAX; + const Y_MAX = positive ? AGGREGATION_INDEX_Y_MAX : AGGREGATION_INDEX_Y_MIN; + const [start2, end3] = this.visibleRangeIndices("xValue", xAxis.range, indices); + for (let i = start2; i < end3; i += 1) { + const aggIndex = i * AGGREGATION_SPAN; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX]; + const yMinIndex = indexData[aggIndex + Y_MIN]; + const yMaxIndex = indexData[aggIndex + Y_MAX]; + if (xMinIndex === -1) + continue; + if (xValues[yMaxIndex] == null || xValues[yMinIndex] == null) + continue; + const x = xPosition(Math.trunc((xMinIndex + xMaxIndex) / 2)); + const width2 = Math.abs(xPosition(xMaxIndex) - xPosition(xMinIndex)) + barWidth; + if (x - width2 < 0 || x > range4) + continue; + const bandCount = Math.abs(xMaxIndex - xMinIndex) + 1; + const opacity = BandScale.is(xScale) ? Math.min(xScale.bandwidth * Math.max(bandCount - 1, 1) / (xScale.step * bandCount), 1) : 1; + let yStart; + let yEnd; + let featherRatio = 0; + if (isStacked) { + yStart = Number(yStartValues[yMinIndex]); + yEnd = Number(yEndValues[yMaxIndex]); + } else { + const yEndMax = Number(yRawValues[yMaxIndex]); + const yEndMin = Number(yRawValues[yMinIndex]); + yStart = 0; + yEnd = yEndMax; + featherRatio = (positive ? 1 : -1) * sign * (1 - yEndMin / yEndMax); + } + handleDatum(yMaxIndex, x, width2, yStart, yEnd, yEnd, featherRatio, opacity); + } + } + } else if (processedData.type === "grouped") { + const invalidData = processedData.invalidData?.get(this.id); + const width2 = barWidth; + const yRangeIndex = isStacked ? dataModel.resolveProcessedDataIndexById(this, `yValue-range`) : -1; + const columnIndex = processedData.columnScopes.findIndex((s) => s.has(this.id)); + const { groups } = processedData; + const [start2, end3] = visibleRangeIndices(1, groups.length, xAxis.range, (groupIndex) => { + const group = groups[groupIndex]; + const xValue2 = group.keys[0]; + return this.xCoordinateRange(xValue2); + }); + for (let groupIndex = start2; groupIndex < end3; groupIndex += 1) { + const group = groups[groupIndex]; + const { aggregation } = group; + const datumIndices = group.datumIndices[columnIndex]; + if (datumIndices == null) + continue; + for (const relativeDatumIndex of datumIndices) { + const datumIndex = groupIndex + relativeDatumIndex; + const x = xPosition(datumIndex); + if (invalidData?.[datumIndex] === true) + continue; + const yRawValue = yRawValues[datumIndex]; + if (yRawValue == null) + continue; + const isPositive = yRawValue >= 0 && !Object.is(yRawValue, -0); + const yStart = isStacked ? Number(yStartValues?.[datumIndex]) : 0; + const yEnd = isStacked ? Number(yEndValues?.[datumIndex]) : yRawValue; + let yRange = yEnd; + if (isStacked) { + yRange = aggregation[yRangeIndex][isPositive ? 1 : 0]; + } + handleDatum(datumIndex, x, width2, yStart, yEnd, yRange); + } + } + } else { + const invalidData = processedData.invalidData?.get(this.id); + const width2 = barWidth; + let [start2, end3] = this.visibleRangeIndices("xValue", xAxis.range); + if (processedData.input.count < 1e3) { + start2 = 0; + end3 = processedData.input.count; + } + for (let datumIndex = start2; datumIndex < end3; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const yRawValue = yRawValues[datumIndex]; + if (yRawValue == null) + continue; + const x = xPosition(datumIndex); + const yEnd = Number(yRawValue); + handleDatum(datumIndex, x, width2, 0, yEnd, yEnd); + } + } + const segments = calculateSegments( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + return { + itemId: yKey, + nodeData: phantomNodes.length > 0 ? [...phantomNodes, ...nodes] : nodes, + labelData: labels, + scales: this.calculateScaling(), + visible: this.visible || animationEnabled, + groupScale: this.getScaling(this.groupScale), + styles: getItemStyles(this.getItemStyle.bind(this)), + segments + }; + } + nodeFactory() { + return new BarShape(); + } + getHighlightData(nodeData, highlightedItem) { + const highlightItem = nodeData.find( + (nodeDatum) => nodeDatum.datum === highlightedItem.datum && !nodeDatum.phantom + ); + return highlightItem == null ? void 0 : [{ ...highlightItem }]; + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => this.getDatumId(datum)); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stackGroup, + stroke: stroke3, + strokeOpacity, + strokeWidth, + xKey, + yKey + } = this.properties; + const highlightState = toHighlightString(highlightStateEnum ?? 0 /* None */); + return { + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + seriesId, + stackGroup, + stroke: stroke3, + strokeOpacity, + strokeWidth, + xKey, + yKey + }; + } + makeItemStylerParams(dataModel, processedData, datumIndex, xValue2, isHighlight, style2) { + const { id: seriesId } = this; + const { xKey, yKey, stackGroup } = this.properties; + const datum = processedData.dataSources.get(seriesId)?.data?.[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue-raw`, processedData)[datumIndex]; + const xDomain = dataModel.getDomain(this, `xValue`, "key", processedData); + const yDomain = dataModel.getDomain(this, this.yCumulativeKey(dataModel), "value", processedData); + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + ...datumStylerProperties(xValue2, yValue, xKey, yKey, xDomain, yDomain), + datum, + xValue: xValue2, + yValue, + stackGroup, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style2, + fill + }; + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke3, + strokeOpacity, + strokeWidth, + styler + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke3, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth + }; + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style2 = mergeDefaults(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId(this.getDatumId({ xValue: xValue2, phantom: false }), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams( + dataModel, + processedData, + datumIndex, + xValue2, + isHighlight, + style2 + ); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style2 = mergeDefaults(overrides, style2); + } + } + return style2; + } + updateDatumStyles(opts) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + opts.datumSelection.each((node, datum) => { + if (!opts.datumSelection.isGarbage(node)) { + const highlightState = this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex); + datum.style = this.getItemStyle(datum.datumIndex, opts.isHighlight, highlightState); + } + }); + } + updateDatumNodes(opts) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { shadow } = this.properties; + const categoryAlongX = this.getCategoryDirection() === "x" /* X */; + const fillBBox = this.getShapeFillBBox(); + const direction = this.getBarDirection(); + opts.datumSelection.each((rect2, datum) => { + const style2 = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex)]; + applyShapeStyle(rect2, style2, fillBBox); + rect2.drawingMode = opts.drawingMode; + const cornerRadius = style2.cornerRadius ?? 0; + rect2.topLeftCornerRadius = datum.topLeftCornerRadius ? cornerRadius : 0; + rect2.topRightCornerRadius = datum.topRightCornerRadius ? cornerRadius : 0; + rect2.bottomRightCornerRadius = datum.bottomRightCornerRadius ? cornerRadius : 0; + rect2.bottomLeftCornerRadius = datum.bottomLeftCornerRadius ? cornerRadius : 0; + rect2.visible = categoryAlongX ? (datum.clipBBox?.width ?? datum.width) > 0 : (datum.clipBBox?.height ?? datum.height) > 0; + rect2.direction = direction; + rect2.featherRatio = datum.featherRatio; + rect2.crisp = datum.crisp; + rect2.fillShadow = shadow; + }); + } + updateLabelSelection(opts) { + const data = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(data, (text2) => { + text2.pointerEvents = 1 /* None */; + }); + } + updateLabelNodes(opts) { + const { isHighlight = false } = opts; + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yKey: this.properties.yKey, + yName: this.properties.yName ?? this.properties.yKey, + legendItemName: this.properties.legendItemName ?? this.properties.xName ?? this.properties.xKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(isHighlight, datum?.datumIndex).opacity ?? 1; + updateLabelNode(this, textNode, params, this.properties.label, datum.label, isHighlight, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yKey, yName, legendItemName, stackGroup, tooltip } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data?.[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue-raw`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [ + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, yKey, legendItemName) + } + ] + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yKey, + yName, + legendItemName, + stackGroup, + ...format, + ...this.getModuleTooltipParams() + } + ); + } + legendItemSymbol() { + const { fill, stroke: stroke3, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + 0 /* None */ + ); + return { + marker: { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke3 ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { showInLegend } = this.properties; + if (legendType !== "category") { + return []; + } + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { yKey: itemId, yName, legendItemName } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId }), + label: { text: legendItemName ?? yName ?? itemId }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + animateEmptyUpdateReady({ datumSelection, labelSelection, annotationSelections }) { + const fns = prepareBarAnimationFunctions( + collapsedStartingBarPosition(this.isVertical(), this.axes, "normal"), + "unknown" + ); + fromToMotion(this.id, "nodes", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation(this, "labels", this.ctx.animationManager, labelSelection); + seriesLabelFadeInAnimation(this, "annotations", this.ctx.animationManager, ...annotationSelections); + } + animateWaitingUpdateReady(data) { + const { datumSelection, labelSelection, annotationSelections, contextData, previousContextData } = data; + this.ctx.animationManager.stopByAnimationGroupId(this.id); + const dataDiff = calculateDataDiff( + this.id, + datumSelection, + this.getDatumId.bind(this), + data.contextData, + previousContextData, + this.processedData, + this.processedDataUpdated + ); + const mode = previousContextData == null ? "fade" : "normal"; + const fns = prepareBarAnimationFunctions( + collapsedStartingBarPosition(this.isVertical(), this.axes, mode), + "added" + ); + fromToMotion( + this.id, + "nodes", + this.ctx.animationManager, + [datumSelection], + fns, + (_, datum) => this.getDatumId(datum), + dataDiff + ); + if (!dataDiff || dataDiff?.changed || !areScalingEqual(contextData.groupScale, previousContextData?.groupScale)) { + seriesLabelFadeInAnimation(this, "labels", this.ctx.animationManager, labelSelection); + seriesLabelFadeInAnimation(this, "annotations", this.ctx.animationManager, ...annotationSelections); + } + } + getDatumId(datum) { + return createDatumId(datum.xValue, datum.phantom); + } + isLabelEnabled() { + return this.properties.label.enabled; + } + computeFocusBounds({ datumIndex }) { + const datumBox = this.contextNodeData?.nodeData[datumIndex].clipBBox; + return computeBarFocusBounds(this, datumBox); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +BarSeries.className = "BarSeries"; +BarSeries.type = "bar"; + +// packages/ag-charts-community/src/chart/series/cartesian/barSeriesModule.ts +var BarSeriesModule = { + type: "series", + optionsKey: "series[]", + packageType: "community", + chartTypes: ["cartesian"], + identifier: "bar", + moduleFactory: (ctx) => new BarSeries(ctx), + stackable: true, + groupable: true, + predictAxis: predictCartesianTimeAxis, + defaultAxes: DIRECTION_SWAP_AXES, + themeTemplate: { + zoom: { + autoScaling: { + enabled: { + $and: [ + { $eq: [{ $path: "../axes" }, "x"] }, + { $not: { $eq: [{ $path: "/series/0/direction" }, "horizontal"] } } + ] + } + } + }, + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + fillOpacity: 1, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + lineDash: [0], + lineDashOffset: 0, + label: { + ...LABEL_BOXING_DEFAULTS, + padding: { $isUserOption: ["./spacing", 0, 8] }, + // compatibility with old `padding` property (now named `spacing`). + enabled: false, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { + $if: [ + { + $or: [ + { $eq: [{ $path: "./placement" }, "outside-start"] }, + { $eq: [{ $path: "./placement" }, "outside-end"] } + ] + }, + { $ref: "textColor" }, + { $ref: "chartBackgroundColor" } + ] + }, + placement: "inside-center" + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + errorBar: { + cap: { + lengthRatio: 0.3 + } + }, + highlight: multiSeriesHighlightStyle(), + segmentation: SEGMENTATION_DEFAULTS + } + } +}; +var NewBarSeriesModule = { + type: "series", + name: "bar", + chartType: "cartesian", + options: barSeriesOptionsDef, + create: (ctx) => new BarSeries(ctx) +}; + +// packages/ag-charts-community/src/chart/series/cartesian/bubbleAggregation.ts +var SIZE_QUANTIZATION = 3; +var FILTER_DATUM_THRESHOLD = 5; +var FILTER_RANGE_THRESHOLD = 0.05; +function getPrimaryDatumIndex(context, indices, bounds) { + const { xValues, yValues, xDomain, yDomain, xNeedsValueOf, yNeedsValueOf } = context; + const { x0, y0, x1, y1 } = bounds; + let currentIndex = 0; + let currentDistanceSquared = Infinity; + const midX = (x0 + x1) / 2; + const midY = (y0 + y1) / 2; + for (const datumIndex of indices) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + if (xValue2 == null || yValue == null) + continue; + const xRatio = aggregationXRatioForXValue(xValue2, xDomain.min, xDomain.max, xNeedsValueOf); + const yRatio = aggregationXRatioForXValue(yValue, yDomain.min, yDomain.max, yNeedsValueOf); + const distanceSquared2 = (xRatio - midX) ** 2 + (yRatio - midY) ** 2; + if (distanceSquared2 < currentDistanceSquared) { + currentDistanceSquared = distanceSquared2; + currentIndex = datumIndex; + } + } + return currentIndex; +} +function countVisibleItems(context, indices, bounds) { + const { xValues, yValues, xDomain, yDomain, xNeedsValueOf, yNeedsValueOf } = context; + const { x0, y0, x1, y1 } = bounds; + let count = 0; + for (const datumIndex of indices) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + if (xValue2 == null || yValue == null) + continue; + const xRatio = aggregationXRatioForXValue(xValue2, xDomain.min, xDomain.max, xNeedsValueOf); + const yRatio = aggregationXRatioForXValue(yValue, yDomain.min, yDomain.max, yNeedsValueOf); + if (xRatio >= x0 && xRatio <= x1 && yRatio >= y0 && yRatio <= y1) { + count += 1; + } + } + return count; +} +function quadChildren(context, indices, bounds) { + const { xValues, yValues, xDomain, yDomain, xNeedsValueOf, yNeedsValueOf } = context; + const { x0, y0, x1, y1 } = bounds; + const childBuckets = [ + { x0: 1, y0: 1, x1: 0, y1: 0, indices: [] }, + { x0: 1, y0: 1, x1: 0, y1: 0, indices: [] }, + { x0: 1, y0: 1, x1: 0, y1: 0, indices: [] }, + { x0: 1, y0: 1, x1: 0, y1: 0, indices: [] } + ]; + const midX = (x0 + x1) / 2; + const midY = (y0 + y1) / 2; + for (const datumIndex of indices) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + if (xValue2 == null || yValue == null) + continue; + const xRatio = aggregationXRatioForXValue(xValue2, xDomain.min, xDomain.max, xNeedsValueOf); + const yRatio = aggregationXRatioForXValue(yValue, yDomain.min, yDomain.max, yNeedsValueOf); + const childIndex = (xRatio > midX ? 1 : 0) + (yRatio > midY ? 2 : 0); + const childBucket = childBuckets[childIndex]; + childBucket.indices.push(datumIndex); + childBucket.x0 = Math.min(childBucket.x0, xRatio); + childBucket.y0 = Math.min(childBucket.y0, yRatio); + childBucket.x1 = Math.max(childBucket.x1, xRatio); + childBucket.y1 = Math.max(childBucket.y1, yRatio); + } + const children = []; + for (const childBucket of childBuckets) { + const { indices: childIndices, x0: cx0, x1: cx1, y0: cy0, y1: cy1 } = childBucket; + if (childIndices.length === 0) + continue; + const child = aggregateQuad(context, childIndices, { x0: cx0, y0: cy0, x1: cx1, y1: cy1 }); + children.push(child); + } + return children; +} +function aggregateQuad(context, indices, bounds) { + const { x0, y0, x1, y1 } = bounds; + const terminate = indices.length < FILTER_DATUM_THRESHOLD && x1 - x0 < FILTER_RANGE_THRESHOLD && y1 - y0 < FILTER_RANGE_THRESHOLD || x0 === x1 && y0 === y1; + let children = terminate ? null : quadChildren(context, indices, bounds); + if (children?.length === 1) { + return children[0]; + } else if (children?.length === 0) { + children = null; + } + const scale2 = Math.hypot(x1 - x0, y1 - y0); + const primaryDatumIndex = getPrimaryDatumIndex(context, indices, bounds); + return { scale: scale2, x0, y0, x1, y1, indices, primaryDatumIndex, children }; +} +function aggregateBubbleData(xScale, yScale, xValues, yValues, sizeValues, xDomain, yDomain, sizeDomain, xNeedsValueOf, yNeedsValueOf) { + const [xd0, xd1] = aggregationDomain(xScale, xDomain); + const [yd0, yd1] = aggregationDomain(yScale, yDomain); + const [sd0, sd1] = sizeDomain; + const context = { + xValues, + yValues, + xDomain: { min: xd0, max: xd1 }, + yDomain: { min: yd0, max: yd1 }, + xNeedsValueOf, + yNeedsValueOf + }; + const filters = []; + if (sizeValues != null && sd1 > sd0) { + const sizeIndices = Array.from({ length: SIZE_QUANTIZATION }, () => []); + for (let datumIndex = 0; datumIndex < sizeValues.length; datumIndex += 1) { + const sizeValue = sizeValues[datumIndex]; + const sizeRatio = (sizeValue - sd0) / (sd1 - sd0); + const sizeIndex = Math.trunc(sizeRatio * SIZE_QUANTIZATION); + if (sizeIndex >= 0 && sizeIndex < SIZE_QUANTIZATION) { + sizeIndices[sizeIndex].push(datumIndex); + } + } + for (let i = 0; i < sizeIndices.length; i += 1) { + const indices = sizeIndices[i]; + const node = aggregateQuad(context, indices, { x0: 0, y0: 0, x1: 1, y1: 1 }); + if (node != null) { + const sizeRatio = i / SIZE_QUANTIZATION; + filters.push({ sizeRatio, node }); + } + } + } else { + const indices = xValues.map((_, i) => i); + const node = aggregateQuad(context, indices, { x0: 0, y0: 0, x1: 1, y1: 1 }); + if (node != null) { + filters.push({ sizeRatio: 0, node }); + } + } + return filters.length > 0 ? { xValues, yValues, xd0, xd1, yd0, yd1, filters, xNeedsValueOf, yNeedsValueOf } : void 0; +} +function computeBubbleAggregationCountIndices(dilation, dataAggregation, options, counter, groupedAggregation, singleDatumIndices) { + const { + xRange, + yRange, + xVisibleRange: [xvr0, xvr1], + yVisibleRange: [yvr0, yvr1], + minSize, + maxSize + } = options; + const { xValues, yValues, xd0, xd1, yd0, yd1, xNeedsValueOf, yNeedsValueOf } = dataAggregation; + const baseScalingFactor = 1 / Math.min(xRange / (xvr1 - xvr0), yRange / (yvr1 - yvr0)); + const context = { + xValues, + yValues, + xDomain: { min: xd0, max: xd1 }, + yDomain: { min: yd0, max: yd1 }, + xNeedsValueOf, + yNeedsValueOf + }; + for (const { sizeRatio, node } of dataAggregation.filters) { + const radius = 0.5 * (minSize + sizeRatio * (maxSize - minSize)); + const baseMinScale = radius * baseScalingFactor; + const minScale = dilation * baseMinScale; + const x0 = xvr0 - radius / xRange; + const x1 = xvr1 + radius / xRange; + const y0 = yvr0 - radius / yRange; + const y1 = yvr1 + radius / yRange; + const queue = [node]; + while (queue.length > 0) { + const item = queue.pop(); + if (item.x1 < x0 || item.x0 > x1 || item.y1 < y0 || item.y0 > y1) { + continue; + } + if (dilation !== 1 && item.scale <= minScale) { + if (counter != null) { + counter.count += 1; + } + groupedAggregation?.push({ + datumIndex: item.primaryDatumIndex, + count: item.indices.length, + area: (item.x1 - item.x0) * (item.y1 - item.y0), + dilation: clamp(1, item.scale / baseMinScale, dilation) + }); + } else if (item.children == null) { + const { indices } = item; + if (counter != null) { + const fullyVisible = item.x0 >= xvr0 && item.x1 <= xvr1 && item.y0 >= yvr0 && item.y1 <= yvr1; + const itemCount = fullyVisible ? indices.length : countVisibleItems(context, indices, { x0: xvr0, y0: yvr0, x1: xvr1, y1: yvr1 }); + counter.count += itemCount; + } + singleDatumIndices?.push(...indices); + } else { + queue.push(...item.children); + } + } + } +} +function computeBubbleAggregationCount(dilation, dataAggregation, options) { + const counter = { count: 0 }; + computeBubbleAggregationCountIndices(dilation, dataAggregation, options, counter, void 0, void 0); + return counter.count; +} +var MAX_AGGREGATION_DILATION = 100; +var DILATION_ITERATIONS = 12; +function computeBubbleAggregationDilation(dataAggregation, aggregationOptions, maxRenderedItems) { + if (computeBubbleAggregationCount(1, dataAggregation, aggregationOptions) <= maxRenderedItems) { + return 1; + } + let minDilation = 1; + let maxDilation = 2; + while (computeBubbleAggregationCount(maxDilation, dataAggregation, aggregationOptions) > maxRenderedItems && maxDilation < MAX_AGGREGATION_DILATION) { + minDilation *= 2; + maxDilation *= 2; + } + for (let i = 0; i < DILATION_ITERATIONS; i += 1) { + const dilation = (maxDilation + minDilation) / 2; + const count = computeBubbleAggregationCount(dilation, dataAggregation, aggregationOptions); + if (count > maxRenderedItems) { + minDilation = dilation; + } else { + maxDilation = dilation; + } + } + return (minDilation + maxDilation) / 2; +} +function computeBubbleAggregationData(dilation, dataAggregation, options) { + const groupedAggregation = []; + const singleDatumIndices = []; + computeBubbleAggregationCountIndices( + dilation, + dataAggregation, + options, + void 0, + groupedAggregation, + singleDatumIndices + ); + return { groupedAggregation, singleDatumIndices }; +} + +// packages/ag-charts-community/src/chart/series/cartesian/bubbleSeriesProperties.ts +var BubbleSeriesMarker = class extends SeriesMarker { + constructor() { + super(...arguments); + this.maxSize = 30; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneChangeDetection() +], BubbleSeriesMarker.prototype, "maxSize", 2); +__decorateClass([ + addFakeTransformToInstanceProperty, + SceneArrayChangeDetection() +], BubbleSeriesMarker.prototype, "domain", 2); +var BubbleSeriesLabel = class extends Label { + constructor() { + super(...arguments); + this.placement = "top"; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesLabel.prototype, "placement", 2); +var BubbleSeriesProperties = class extends CartesianSeriesProperties { + constructor() { + super(...arguments); + this.label = new BubbleSeriesLabel(); + this.tooltip = makeSeriesTooltip(); + this.maxRenderedItems = Infinity; + // No validation. Not a part of the options contract. + this.marker = new BubbleSeriesMarker(); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "labelKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "xFilterKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "yFilterKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "sizeFilterKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "xName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "yName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "sizeName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "labelName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "title", 2); +__decorateClass([ + ProxyProperty("marker.shape") +], BubbleSeriesProperties.prototype, "shape", 2); +__decorateClass([ + ProxyProperty("marker.size") +], BubbleSeriesProperties.prototype, "size", 2); +__decorateClass([ + ProxyProperty("marker.maxSize") +], BubbleSeriesProperties.prototype, "maxSize", 2); +__decorateClass([ + ProxyProperty("marker.domain") +], BubbleSeriesProperties.prototype, "domain", 2); +__decorateClass([ + ProxyProperty("marker.fill") +], BubbleSeriesProperties.prototype, "fill", 2); +__decorateClass([ + ProxyProperty("marker.fillOpacity") +], BubbleSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + ProxyProperty("marker.stroke") +], BubbleSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + ProxyProperty("marker.strokeWidth") +], BubbleSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + ProxyProperty("marker.strokeOpacity") +], BubbleSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + ProxyProperty("marker.lineDash") +], BubbleSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + ProxyProperty("marker.lineDashOffset") +], BubbleSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + ProxyProperty("marker.itemStyler") +], BubbleSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "styler", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "label", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], BubbleSeriesProperties.prototype, "maxRenderedItems", 2); + +// packages/ag-charts-community/src/chart/series/cartesian/bubbleSeries.ts +var BubbleScatterSeriesNodeEvent = class extends CartesianSeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.sizeKey = series.properties.sizeKey; + } +}; +var BubbleSeries = class extends CartesianSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: { + ...DEFAULT_CARTESIAN_DIRECTION_KEYS, + label: ["labelKey"], + size: ["sizeKey"] + }, + propertyNames: { + ...DEFAULT_CARTESIAN_DIRECTION_NAMES, + label: ["labelName"], + size: ["sizeName"] + }, + categoryKey: void 0, + pickModes: [ + 2 /* AXIS_ALIGNED */, + 1 /* NEAREST_NODE */, + 0 /* EXACT_SHAPE_MATCH */ + ], + pathsPerSeries: [], + datumSelectionGarbageCollection: false, + animationResetFns: { + label: resetLabelFn, + datum: resetMarkerFn + }, + usesPlacedLabels: true, + clipFocusBox: false + }); + this.NodeEvent = BubbleScatterSeriesNodeEvent; + this.properties = new BubbleSeriesProperties(); + this.dataAggregation = void 0; + this.sizeScale = new LinearScale(); + } + get pickModeAxis() { + return "main-category"; + } + get type() { + return super.type; + } + get hasData() { + return this.getHasData("xValue"); + } + async processData(dataController) { + if (this.data == null || !this.visible) + return; + const xScale = this.axes["x" /* X */]?.scale; + const yScale = this.axes["y" /* Y */]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const sizeScaleType = this.sizeScale.type; + const { xKey, yKey, sizeKey, xFilterKey, yFilterKey, sizeFilterKey, labelKey, marker } = this.properties; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty(xKey, xScaleType, { id: `xValue` }), + valueProperty(yKey, yScaleType, { id: `yValue` }), + ...xFilterKey == null ? [] : [valueProperty(xFilterKey, xScaleType, { id: `xFilterValue` })], + ...yFilterKey == null ? [] : [valueProperty(yFilterKey, yScaleType, { id: `yFilterValue` })], + ...sizeFilterKey == null ? [] : [valueProperty(sizeFilterKey, sizeScaleType, { id: `sizeFilterValue` })], + ...sizeKey ? [valueProperty(sizeKey, sizeScaleType, { id: `sizeValue` })] : [], + ...labelKey ? [valueProperty(labelKey, "category", { id: `labelValue` })] : [] + ] + }); + const sizeKeyIdx = sizeKey ? dataModel.resolveProcessedDataIndexById(this, `sizeValue`) : void 0; + const mutableMarkerDomain = marker.domain ? [marker.domain[0], marker.domain[1]] : void 0; + this.sizeScale.domain = mutableMarkerDomain ?? (sizeKeyIdx == null ? void 0 : processedData.domain.values[sizeKeyIdx]) ?? []; + this.dataAggregation = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + xCoordinateRange(xValue2, pixelSize, index) { + const { properties, sizeScale } = this; + const { size, sizeKey } = properties; + const x = this.axes["x" /* X */].scale.convert(xValue2); + const sizeValues = sizeKey == null ? void 0 : this.dataModel.resolveColumnById(this, `sizeValue`, this.processedData); + const sizeValue = sizeValues == null ? size : sizeScale.convert(sizeValues[index]); + const r = 0.5 * sizeValue * pixelSize; + return [x - r, x + r]; + } + yCoordinateRange(yValues, pixelSize, index) { + const { properties, sizeScale } = this; + const { size, sizeKey } = properties; + const y = this.axes["y" /* Y */].scale.convert(yValues[0]); + const sizeValues = sizeKey == null ? void 0 : this.dataModel.resolveColumnById(this, `sizeValue`, this.processedData); + const sizeValue = sizeValues == null ? size : sizeScale.convert(sizeValues[index]); + const r = 0.5 * sizeValue * pixelSize; + return [y - r, y + r]; + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + const dataValues = { + ["x" /* X */]: "xValue", + ["y" /* Y */]: "yValue" + }; + const id = dataValues[direction]; + const dataDef = dataModel.resolveProcessedDataDefById(this, id); + const domain = dataModel.getDomain(this, id, "value", processedData); + if (dataDef?.def.type === "value" && dataDef?.def.valueType === "category") { + return domain; + } + const crossDirection = direction === "x" /* X */ ? "y" /* Y */ : "x" /* X */; + const crossId = dataValues[crossDirection]; + const ext = this.domainForClippedRange(direction, [id], crossId); + return fixNumericExtent(extent(ext)); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange("y" /* Y */, ["yValue"], "xValue", visibleRange); + } + getVisibleItems(xVisibleRange, yVisibleRange, minVisibleItems) { + const { dataAggregation, axes } = this; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (dataAggregation == null || xAxis == null || yAxis == null) { + return this.countVisibleItems("xValue", ["yValue"], xVisibleRange, yVisibleRange, minVisibleItems); + } + const aggregationOptions = this.aggregationOptions(xAxis, yAxis, xVisibleRange, yVisibleRange ?? [0, 1]); + return computeBubbleAggregationCount(0, dataAggregation, aggregationOptions); + } + aggregateData(dataModel, processedData) { + if (processedData.type === "grouped") + return; + if (processedData.input.count <= this.properties.maxRenderedItems) + return; + const xAxis = this.axes["x" /* X */]; + const yAxis = this.axes["y" /* Y */]; + if (xAxis == null || yAxis == null) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + if (!ContinuousScale.is(xScale) || !ContinuousScale.is(yScale)) + return; + const { sizeScale, properties } = this; + const { sizeKey } = properties; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const sizeValues = sizeKey ? dataModel.resolveColumnById(this, `sizeValue`, processedData) : void 0; + const xDomain = dataModel.getDomain(this, `xValue`, "value", processedData); + const yDomain = dataModel.getDomain(this, `yValue`, "value", processedData); + const sizeDomain = sizeKey ? sizeScale.domain : [0, 0]; + const xNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `xValue`, processedData); + const yNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `yValue`, processedData); + return aggregateBubbleData( + xScale.type, + yScale.type, + xValues, + yValues, + sizeValues, + xDomain, + yDomain, + sizeDomain, + xNeedsValueOf, + yNeedsValueOf + ); + } + aggregationOptions(xAxis, yAxis, xVisibleRange = xAxis.visibleRange, yVisibleRange = yAxis.visibleRange) { + const { processedData, dataModel } = this; + const { sizeKey } = this.properties; + const [markerSize, markerMaxSize] = this.getSizeRange(); + const xRange = Math.abs(xAxis.range[1] - xAxis.range[0]); + const yRange = Math.abs(yAxis.range[1] - yAxis.range[0]); + const minSize = Math.max(markerSize, 1); + const maxSize = sizeKey ? Math.max(markerMaxSize, 1) : minSize; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + if (processedData != null && dataModel != null) { + if (ContinuousScale.is(xScale)) { + xVisibleRange = rescaleVisibleRange( + xVisibleRange, + xScale.domain.map(dateToNumber), + dataModel.getDomain(this, `xValue`, "value", processedData).map(dateToNumber) + ); + } + if (ContinuousScale.is(yScale)) { + yVisibleRange = rescaleVisibleRange( + yVisibleRange, + yScale.domain.map(dateToNumber), + dataModel.getDomain(this, `yValue`, "value", processedData).map(dateToNumber) + ); + } + } + return { xRange, yRange, minSize, maxSize, xVisibleRange, yVisibleRange }; + } + createNodeData() { + const { axes, dataModel, processedData, sizeScale, visible } = this; + const { + xKey, + yKey, + sizeKey, + xFilterKey, + yFilterKey, + sizeFilterKey, + labelKey, + xName, + yName, + sizeName, + labelName, + label, + legendItemName, + marker, + maxRenderedItems + } = this.properties; + const { enabled: labelEnabled, placement } = label; + const anchor = Marker.anchor(marker.shape); + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xDataValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yDataValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const sizeDataValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const labelDataValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const xFilterDataValues = xFilterKey == null ? void 0 : dataModel.resolveColumnById(this, `xFilterValue`, processedData); + const yFilterDataValues = yFilterKey == null ? void 0 : dataModel.resolveColumnById(this, `yFilterValue`, processedData); + const sizeFilterDataValues = sizeFilterKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeFilterValue`, processedData); + let labelTextDomain; + if (labelKey) { + labelTextDomain = []; + } else if (sizeKey) { + labelTextDomain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + } else { + labelTextDomain = []; + } + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const yOffset = (yScale.bandwidth ?? 0) / 2; + const nodeData = []; + sizeScale.range = this.getSizeRange(); + const textMeasurer = cachedTextMeasurer(label); + const rawData = processedData.dataSources.get(this.id)?.data; + if (rawData == null) + return; + const padding2 = expandLabelPadding(label); + const handleDatum = (datumIndex, count, dilation, area2) => { + const datum = rawData[datumIndex]; + const xDatum = xDataValues[datumIndex]; + const yDatum = yDataValues[datumIndex]; + const sizeValue = sizeDataValues?.[datumIndex]; + const x = xScale.convert(xDatum) + xOffset; + const y = yScale.convert(yDatum) + yOffset; + let selected; + if (xFilterDataValues != null && yFilterDataValues != null) { + selected = xFilterDataValues[datumIndex] === xDatum && yFilterDataValues[datumIndex] === yDatum; + if (sizeFilterDataValues != null) { + selected && (selected = sizeFilterDataValues[datumIndex] === sizeValue); + } + } + let nodeLabel; + if (labelEnabled) { + let labelTextValue; + let labelTextKey; + let labelTextProperty; + if (labelKey && labelDataValues) { + labelTextValue = labelDataValues[datumIndex]; + labelTextKey = labelKey; + labelTextProperty = "label"; + } else if (sizeKey) { + labelTextValue = sizeValue; + labelTextKey = sizeKey; + labelTextProperty = "size"; + } else { + labelTextValue = yDatum; + labelTextKey = yKey; + labelTextProperty = "y"; + } + const labelText = this.getLabelText( + labelTextValue, + datum, + labelTextKey, + labelTextProperty, + labelTextDomain, + label, + { + value: labelTextValue, + datum, + xKey, + yKey, + sizeKey, + labelKey, + xName, + yName, + sizeName, + labelName, + legendItemName + } + ); + let { width: width2, height: height2 } = isArray(labelText) ? measureTextSegments(labelText, label) : textMeasurer.measureLines(String(labelText)); + width2 += padding2.left + padding2.right; + height2 += padding2.bottom + padding2.top; + nodeLabel = { text: labelText, width: width2, height: height2 }; + } else { + nodeLabel = { text: "", width: 0, height: 0 }; + } + const markerSize = sizeValue == null ? sizeScale.range[0] : sizeScale.convert(sizeValue); + const point = { x, y, size: Math.sqrt(dilation) * markerSize }; + nodeData.push({ + series: this, + itemId: yKey, + yKey, + xKey, + datum, + datumIndex, + xValue: xDatum, + yValue: yDatum, + sizeValue, + capDefaults: { lengthRatioMultiplier: marker.getDiameter(), lengthMax: Infinity }, + point, + midPoint: { x, y }, + label: nodeLabel, + anchor, + placement, + count, + dilation, + area: area2, + selected + }); + }; + const { dataAggregation } = this; + if (!visible) { + } else if (dataAggregation == null) { + for (let datumIndex = 0; datumIndex < rawData.length; datumIndex++) { + handleDatum(datumIndex, 1, 1, 0); + } + } else { + const aggregationOptions = this.aggregationOptions(xAxis, yAxis); + const aggregationDilation = computeBubbleAggregationDilation( + dataAggregation, + aggregationOptions, + maxRenderedItems + ); + const { groupedAggregation, singleDatumIndices } = computeBubbleAggregationData( + aggregationDilation, + dataAggregation, + aggregationOptions + ); + for (const { datumIndex, count, dilation, area: area2 } of groupedAggregation) { + handleDatum(datumIndex, count, dilation, area2); + } + for (const datumIndex of singleDatumIndices) { + handleDatum(datumIndex, 1, 1, 0); + } + } + return { + itemId: yKey, + nodeData, + labelData: labelEnabled ? nodeData : [], + scales: this.calculateScaling(), + visible: this.visible || animationEnabled, + styles: getMarkerStyles(this, this.properties, marker) + }; + } + isPathOrSelectionDirty() { + return this.properties.marker.isDirty(); + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const { sizeKey } = this.properties; + if (this.properties.marker.isDirty()) { + datumSelection.clear(); + datumSelection.cleanup(); + } + let getId; + if (sizeKey) { + getId = (datum) => createDatumId(datum.xValue, datum.yValue, datum.sizeValue, toPlainText(datum.label.text)); + } + return datumSelection.update(nodeData, void 0, getId); + } + updateDatumStyles(opts) { + const { datumSelection, isHighlight } = opts; + const { xKey, yKey, sizeKey, labelKey, marker } = this.properties; + const params = { xKey, yKey, sizeKey, labelKey }; + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum) => { + if (!datumSelection.isGarbage(node)) { + const highlightState = this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(opts.isHighlight, highlightState); + datum.style = this.getMarkerStyle( + marker, + datum, + params, + { + isHighlight, + highlightState, + resolveMarkerSubPath: [] + }, + stylerStyle + ); + } + }); + } + updateDatumNodes(opts) { + const { contextNodeData } = this; + if (!contextNodeData) + return; + const { datumSelection, isHighlight, drawingMode } = opts; + this.sizeScale.range = this.getSizeRange(); + const fillBBox = this.getShapeFillBBox(); + const aggregated = this.dataAggregation != null; + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum, index) => { + const { + point: { size }, + count, + area: area2, + dilation + } = datum; + let style2 = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + style2 = { ...style2 }; + style2.size = size; + if (dilation > 1) { + const fillOpacity = style2.fillOpacity ?? 0; + const opacityScale = 0.269669 + 683e-6 * count + -37.534348 * area2 + 4449e-6 * count * area2 + -0 * count ** 2 + 44.428603 * area2 ** 2; + style2.fillOpacity = clamp(fillOpacity / dilation, fillOpacity / 0.1 * opacityScale, 1); + } + this.applyMarkerStyle(style2, node, datum.point, fillBBox, { selected: datum.selected }); + node.drawingMode = drawingMode; + node.zIndex = aggregated ? [-count, index] : 0; + }); + if (!isHighlight) { + this.properties.marker.markClean(); + } + } + updatePlacedLabelData(labelData) { + this.labelSelection.update( + labelData.map((v) => ({ + ...v.datum, + point: { + x: v.x, + y: v.y, + size: v.datum.point.size + } + })), + (text2) => { + text2.pointerEvents = 1 /* None */; + } + ); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { isHighlight = false } = opts; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const params = this.makeLabelFormatterParams(); + opts.labelSelection.each((text2, datum) => { + const style2 = getLabelStyles(this, datum, params, this.properties.label, isHighlight, activeHighlight); + text2.text = datum.label.text; + text2.fill = style2.color; + text2.x = datum.point?.x ?? 0; + text2.y = datum.point?.y ?? 0; + text2.fontStyle = style2.fontStyle; + text2.fontWeight = style2.fontWeight; + text2.fontSize = style2.fontSize; + text2.fontFamily = style2.fontFamily; + text2.textBaseline = "top"; + text2.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + text2.setBoxing(style2); + }); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { + id: seriesId, + properties: { + size, + maxSize, + shape, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke3, + strokeOpacity, + strokeWidth, + xKey, + yKey, + sizeKey, + labelKey + } + } = this; + const highlightState = toHighlightString(highlightStateEnum ?? 0 /* None */); + if (this.type === "bubble") { + return { + highlightState, + highlighted, + size, + maxSize, + shape, + fill, + fillOpacity, + lineDash, + lineDashOffset, + seriesId, + sizeKey, + stroke: stroke3, + strokeOpacity, + strokeWidth, + xKey, + yKey, + labelKey + }; + } else if (this.type === "scatter") { + return { + highlightState, + highlighted, + size, + shape, + fill, + fillOpacity, + lineDash, + lineDashOffset, + seriesId, + stroke: stroke3, + strokeOpacity, + strokeWidth, + xKey, + yKey, + labelKey + }; + } else { + return this.type; + } + } + makeLabelFormatterParams() { + const { xKey, xName, yKey, yName, sizeKey, sizeName, labelKey, labelName, legendItemName } = this.properties; + return { + xKey, + xName, + yKey, + yName, + sizeKey, + sizeName, + labelKey, + labelName, + legendItemName + }; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties, ctx } = this; + const { formatManager } = ctx; + const { + xKey, + xName, + yKey, + yName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + tooltip, + marker, + legendItemName + } = properties; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data?.[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const data = []; + if (this.isLabelEnabled() && labelKey != null) { + const value = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? formatValue(value) }); + } + data.push( + { + label: xName, + fallbackLabel: xKey, + value: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName) + }, + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, yKey, legendItemName) + } + ); + if (sizeKey != null) { + const value = dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue(value) }); + } + const activeStyle = this.getMarkerStyle( + marker, + { datum, datumIndex }, + { xKey, yKey, sizeKey, labelKey, highlighted: true }, + { resolveMarkerSubPath: [] } + ); + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(), + data + }, + { + seriesId, + datum, + title: yKey, + xKey, + xName, + yKey, + yName, + sizeKey, + sizeName, + labelKey, + labelName, + legendItemName, + ...activeStyle, + ...this.getModuleTooltipParams() + } + ); + } + legendItemSymbol() { + const style2 = this.getStyle(false); + const marker = this.getMarkerStyle( + this.properties.marker, + {}, + void 0, + { + isHighlight: false, + checkForHighlight: false, + resolveMarkerSubPath: [] + }, + style2 + ); + return { + marker + }; + } + getLegendData() { + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { yKey: itemId, yName, legendItemName, title, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId }), + label: { + text: legendItemName ?? title ?? yName ?? itemId + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + animateEmptyUpdateReady({ datumSelection, labelSelection }) { + markerScaleInAnimation(this, this.ctx.animationManager, datumSelection); + seriesLabelFadeInAnimation(this, "labels", this.ctx.animationManager, labelSelection); + } + isLabelEnabled() { + return this.properties.label.enabled; + } + nodeFactory() { + return new Marker(); + } + getStyle(highlighted, highlightState) { + const { properties } = this; + let stylerResult = {}; + if (properties.styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + const cbResult = this.cachedCallWithContext(properties.styler, stylerParams) ?? {}; + const resolved = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + cbResult, + { pick: false } + ); + stylerResult = resolved ?? {}; + } + return { + fill: stylerResult.fill ?? properties.fill, + fillOpacity: stylerResult.fillOpacity ?? properties.fillOpacity, + lineDash: stylerResult.lineDash ?? properties.lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? properties.lineDashOffset, + shape: stylerResult.shape ?? properties.shape, + size: stylerResult.size ?? properties.size, + maxSize: stylerResult.maxSize ?? properties.maxSize, + stroke: stylerResult.stroke ?? properties.stroke, + strokeOpacity: stylerResult.strokeOpacity ?? properties.strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? properties.strokeWidth + }; + } + getSizeRange() { + const { size, maxSize } = this.getStyle(false); + return [size, maxSize]; + } + getFormattedMarkerStyle(datum) { + const { xKey, yKey, sizeKey, labelKey, marker } = this.properties; + return this.getMarkerStyle(marker, datum, { xKey, yKey, sizeKey, labelKey }, { resolveMarkerSubPath: [] }); + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds(this, opts); + } + hasItemStylers() { + const { styler, itemStyler, marker, label } = this.properties; + return !!(styler ?? itemStyler ?? marker.itemStyler ?? label.itemStyler); + } + initQuadTree(quadtree) { + addHitTestersToQuadtree(quadtree, this.datumNodesIter()); + } + pickNodeDataClosestDatum(point) { + return findQuadtreeMatch(this, point); + } +}; +BubbleSeries.className = "BubbleSeries"; +BubbleSeries.type = "bubble"; + +// packages/ag-charts-community/src/chart/series/cartesian/bubbleSeriesModule.ts +var BubbleSeriesModule = { + type: "series", + optionsKey: "series[]", + packageType: "community", + chartTypes: ["cartesian"], + identifier: "bubble", + moduleFactory: (ctx) => new BubbleSeries(ctx), + predictAxis: predictCartesianAxis, + defaultAxes: [ + { + type: "number" /* NUMBER */, + position: "bottom" /* BOTTOM */ + }, + { + type: "number" /* NUMBER */, + position: "left" /* LEFT */ + } + ], + themeTemplate: { + series: { + shape: "circle", + size: 7, + maxSize: 30, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + fillOpacity: 0.8, + maxRenderedItems: 1e4, + label: { + ...LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] }, + position: { + anchorTo: { $path: ["/tooltip/position/anchorTo", "node"] } + } + }, + highlight: multiSeriesHighlightStyle() + } + } +}; +var NewBubbleSeriesModule = { + type: "series", + name: "bubble", + chartType: "cartesian", + options: bubbleSeriesOptionsDef, + create: (ctx) => new BubbleSeries(ctx) +}; + +// packages/ag-charts-community/src/chart/series/cartesian/histogramSeriesProperties.ts +var HistogramSeriesProperties = class extends CartesianSeriesProperties { + constructor() { + super(...arguments); + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.areaPlot = false; + this.aggregation = "sum"; + this.shadow = new DropShadow(); + this.label = new Label(); + this.tooltip = makeSeriesTooltip(); + } + getStyle() { + const { fill, fillOpacity, stroke: stroke3, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke: stroke3, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "xName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "yName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "areaPlot", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "bins", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "aggregation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "binCount", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "shadow", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "label", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HistogramSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-community/src/chart/series/cartesian/histogramSeries.ts +var defaultBinCount = 10; +var HistogramSeries = class extends CartesianSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: DEFAULT_CARTESIAN_DIRECTION_KEYS, + propertyNames: DEFAULT_CARTESIAN_DIRECTION_NAMES, + categoryKey: void 0, + pickModes: [1 /* NEAREST_NODE */, 0 /* EXACT_SHAPE_MATCH */], + datumSelectionGarbageCollection: true, + animationResetFns: { + datum: resetBarSelectionsFn, + label: resetLabelFn + } + }); + this.properties = new HistogramSeriesProperties(); + this.calculatedBins = []; + } + get hasData() { + return this.calculatedBins.length > 0; + } + // During processData phase, used to unify different ways of the user specifying + // the bins. Returns bins in format[[min1, max1], [min2, max2], ... ]. + deriveBins(xDomain) { + const binStarts = createTicks(xDomain[0], xDomain[1], defaultBinCount).ticks; + const binSize = tickStep(xDomain[0], xDomain[1], defaultBinCount); + const [firstBinEnd] = binStarts; + const expandStartToBin = (n) => [n, n + binSize]; + return [[firstBinEnd - binSize, firstBinEnd], ...binStarts.map(expandStartToBin)]; + } + calculateNiceBins(domain, binCount) { + const startGuess = Math.floor(domain[0]); + const stop = domain[1]; + const segments = binCount || 1; + const { start: start2, binSize } = this.calculateNiceStart(startGuess, stop, segments); + return this.getBins(start2, stop, binSize, segments); + } + getBins(start2, stop, step, count) { + const bins = []; + const precision = this.calculatePrecision(step); + for (let i = 0; i < count; i++) { + const a = Math.round((start2 + i * step) * precision) / precision; + let b = Math.round((start2 + (i + 1) * step) * precision) / precision; + if (i === count - 1) { + b = Math.max(b, stop); + } + bins[i] = [a, b]; + } + return bins; + } + calculatePrecision(step) { + let precision = 10; + if (Number.isFinite(step) && step > 0) { + while (step < 1) { + precision *= 10; + step *= 10; + } + } + return precision; + } + calculateNiceStart(a, b, segments) { + const binSize = Math.abs(b - a) / segments; + const order = Math.floor(Math.log10(binSize)); + const magnitude = Math.pow(10, order); + const start2 = Math.floor(a / magnitude) * magnitude; + return { + start: start2, + binSize + }; + } + async processData(dataController) { + const { visible } = this; + const { xKey, yKey, areaPlot, aggregation } = this.properties; + const xScale = this.axes["x" /* X */]?.scale; + const yScale = this.axes["y" /* Y */]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ yScale, xScale }); + const visibleProps = visible ? {} : { forceValue: 0 }; + const props = [keyProperty(xKey, xScaleType), SORT_DOMAIN_GROUPS]; + if (yKey) { + let aggProp = groupCount("groupAgg", { visible }); + if (aggregation === "count") { + } else if (aggregation === "sum") { + aggProp = groupSum("groupAgg", { visible }); + } else if (aggregation === "mean") { + aggProp = groupAverage("groupAgg", { visible }); + } + if (areaPlot) { + aggProp = area("groupAgg", aggProp); + } + props.push(valueProperty(yKey, yScaleType, { invalidValue: void 0, ...visibleProps }), aggProp); + } else { + props.push(rowCountProperty("count")); + let aggProp = groupCount("groupAgg", { visible }); + if (areaPlot) { + aggProp = area("groupAgg", aggProp); + } + props.push(aggProp); + } + let calculatedBinDomains = []; + const groupByFn = (dataSet) => { + const xExtent = fixNumericExtent(dataSet.domain.keys[0]); + if (xExtent.length === 0) { + dataSet.domain.groups = []; + return () => []; + } + const bins = isNumber(this.properties.binCount) ? this.calculateNiceBins(xExtent, this.properties.binCount) : this.properties.bins ?? this.deriveBins(xExtent); + const binCount = bins.length; + calculatedBinDomains = [...bins]; + return (keys) => { + let xValue2 = keys[0]; + if (isDate(xValue2)) { + xValue2 = xValue2.getTime(); + } + if (!isNumber(xValue2)) + return []; + for (let i = 0; i < binCount; i++) { + const nextBin = bins[i]; + if (xValue2 >= nextBin[0] && xValue2 < nextBin[1]) { + return nextBin; + } + if (i === binCount - 1 && xValue2 <= nextBin[1]) { + return nextBin; + } + } + return []; + }; + }; + const { dataModel, processedData: p } = await this.requestDataModel(dataController, this.data, { + props, + groupByFn + }); + const processedData = p; + const groups = /* @__PURE__ */ new Map(); + for (const [groupIndex, group] of processedData.groups.entries()) { + const domain = group.keys; + groups.set(createDatumId(...domain), { group, groupIndex }); + } + this.calculatedBins = calculatedBinDomains.map((domain) => { + const g = groups.get(createDatumId(...domain)); + if (g) { + const { group, groupIndex } = g; + const [[negativeAgg, positiveAgg] = [0, 0]] = group.aggregation; + const datum = [...dataModel.forEachDatum(this, processedData, group, groupIndex)]; + const frequency = this.frequency(group); + const total = negativeAgg + positiveAgg; + return { domain, datum, groupIndex, frequency, total }; + } else { + return { domain, datum: [], groupIndex: -1, frequency: 0, total: 0 }; + } + }); + this.animationState.transition("updateData"); + } + xCoordinateRange() { + return [Number.NaN, Number.NaN]; + } + yCoordinateRange() { + return [Number.NaN, Number.NaN]; + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel || !this.calculatedBins.length) + return []; + const yDomain = dataModel.getDomain(this, `groupAgg`, "aggregate", processedData); + const xDomainMin = this.calculatedBins[0].domain[0]; + const xDomainMax = this.calculatedBins[(this.calculatedBins?.length ?? 0) - 1].domain[1]; + if (direction === "x" /* X */) { + return fixNumericExtent([xDomainMin, xDomainMax]); + } + return fixNumericExtent(yDomain); + } + getSeriesRange(_direction, [r0, r1]) { + const { dataModel, processedData } = this; + if (!dataModel || processedData?.type !== "grouped") + return [Number.NaN, Number.NaN]; + const xScale = this.axes["x" /* X */].scale; + const yMin = 0; + let yMax = -Infinity; + for (const { keys, aggregation } of processedData.groups) { + const [[negativeAgg, positiveAgg] = [0, 0]] = aggregation; + const [xDomainMin, xDomainMax] = keys; + const [x0, x1] = findMinMax([xScale.convert(xDomainMin), xScale.convert(xDomainMax)]); + if (x1 >= r0 && x0 <= r1) { + const total = negativeAgg + positiveAgg; + yMax = Math.max(yMax, total); + } + } + if (yMin > yMax) + return [Number.NaN, Number.NaN]; + return [yMin, yMax]; + } + frequency(group) { + return group.datumIndices.reduce((acc, datumIndices) => acc + datumIndices.length, 0); + } + createNodeData() { + const { axes, processedData, dataModel } = this; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (!xAxis || !yAxis || !dataModel) { + return; + } + const { scale: xScale } = xAxis; + const { scale: yScale } = yAxis; + const { xKey, yKey, xName, yName, label } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const nodeData = []; + const context = { + itemId: this.properties.yKey ?? this.id, + nodeData, + labelData: nodeData, + scales: this.calculateScaling(), + animationValid: true, + visible: this.visible || animationEnabled, + styles: getItemStyles(this.getItemStyle.bind(this)) + }; + if (processedData == null || processedData.type !== "grouped") { + return context; + } + for (const { domain, datum, groupIndex, frequency, total } of this.calculatedBins) { + const [xDomainMin, xDomainMax] = domain; + const xMinPx = xScale.convert(xDomainMin); + const xMaxPx = xScale.convert(xDomainMax); + const yZeroPx = yScale.convert(0); + const yMaxPx = yScale.convert(total); + const w = Math.abs(xMaxPx - xMinPx); + const h = Math.abs(yMaxPx - yZeroPx); + const x = Math.min(xMinPx, xMaxPx); + const y = Math.min(yZeroPx, yMaxPx); + let selectionDatumLabel = void 0; + if (label.enabled && total !== 0) { + selectionDatumLabel = { + x: x + w / 2, + y: y + h / 2, + text: this.getLabelText( + total, + datum, + yKey, + "y", + [], + label, + { value: total, datum, xKey, yKey, xName, yName } + ) + }; + } + const nodeMidPoint = { + x: x + w / 2, + y: y + h / 2 + }; + const yAxisReversed = yAxis.isReversed(); + nodeData.push({ + series: this, + datumIndex: groupIndex, + datum, + // required by SeriesNodeDatum, but might not make sense here + // since each selection is an aggregation of multiple data. + aggregatedValue: total, + frequency, + domain, + yKey, + xKey, + x, + y, + xValue: xMinPx, + yValue: yMaxPx, + width: w, + height: h, + midPoint: nodeMidPoint, + topLeftCornerRadius: !yAxisReversed, + topRightCornerRadius: !yAxisReversed, + bottomRightCornerRadius: yAxisReversed, + bottomLeftCornerRadius: yAxisReversed, + label: selectionDatumLabel, + crisp: true + }); + } + nodeData.sort((a, b) => a.x - b.x); + return context; + } + nodeFactory() { + return new Rect(); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + return datumSelection.update( + nodeData, + void 0, + (datum) => createDatumId(...datum.domain) + ); + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties } = this; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + return mergeDefaults(highlightStyle, properties.getStyle()); + } + updateDatumStyles(opts) { + const { datumSelection, isHighlight } = opts; + datumSelection.each((node, datum) => { + if (!datumSelection.isGarbage(node)) { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight); + } + }); + } + updateDatumNodes(opts) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { shadow } = this.properties; + const fillBBox = this.getShapeFillBBox(); + opts.datumSelection.each((rect2, datum) => { + const style2 = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex)]; + const { cornerRadius = 0 } = style2; + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle(rect2, style2, fillBBox); + rect2.topLeftCornerRadius = topLeftCornerRadius ? cornerRadius : 0; + rect2.topRightCornerRadius = topRightCornerRadius ? cornerRadius : 0; + rect2.bottomRightCornerRadius = bottomRightCornerRadius ? cornerRadius : 0; + rect2.bottomLeftCornerRadius = bottomLeftCornerRadius ? cornerRadius : 0; + rect2.crisp = datum.crisp; + rect2.fillShadow = shadow; + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData, (text2) => { + text2.pointerEvents = 1 /* None */; + text2.textAlign = "center"; + text2.textBaseline = "middle"; + }); + } + updateLabelNodes(opts) { + const labelEnabled = this.isLabelEnabled(); + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((text2, datum) => { + const style2 = getLabelStyles(this, datum, this.properties, this.properties.label, false, activeHighlight); + const { enabled, fontStyle, fontWeight, fontSize, fontFamily, color: color2 } = style2; + if (enabled && labelEnabled && datum?.label) { + text2.text = datum.label.text; + text2.x = datum.label.x; + text2.y = datum.label.y; + text2.fontStyle = fontStyle; + text2.fontWeight = fontWeight; + text2.fontFamily = fontFamily; + text2.fontSize = fontSize; + text2.fill = color2; + text2.visible = true; + text2.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + text2.setBoxing(style2); + } else { + text2.visible = false; + } + }); + } + initQuadTree(quadtree) { + const { value: childNode } = this.contentGroup.children().next(); + if (childNode instanceof Group) { + addHitTestersToQuadtree(quadtree, childNode.children()); + } + } + pickNodeClosestDatum(point) { + return findQuadtreeMatch(this, point); + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + axes, + properties, + ctx: { localeManager } + } = this; + const { xKey, xName, yKey, yName, tooltip, legendItemName } = properties; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (!dataModel || processedData?.type !== "grouped" || !xAxis || !yAxis) { + return; + } + const group = processedData.groups[datumIndex]; + const { aggregation, keys } = group; + const [[negativeAgg, positiveAgg] = [0, 0]] = aggregation; + const frequency = this.frequency(group); + const domain = keys; + const [rangeMin, rangeMax] = domain; + const aggregatedValue = negativeAgg + positiveAgg; + const datum = { + data: [...dataModel.forEachDatum(this, processedData, group, datumIndex)], + aggregatedValue, + frequency, + domain + }; + const data = [ + { + label: xName, + fallbackLabel: xKey, + value: `${this.getAxisValueText(xAxis, "tooltip", rangeMin, datum, xKey, legendItemName)} - ${this.getAxisValueText(xAxis, "tooltip", rangeMax, datum, xKey, legendItemName)}` + }, + { + label: localeManager.t("seriesHistogramTooltipFrequency"), + value: this.getAxisValueText(yAxis, "tooltip", frequency, datum, yKey, legendItemName) + } + ]; + if (yKey != null) { + let label; + switch (properties.aggregation) { + case "sum": + label = localeManager.t("seriesHistogramTooltipSum", { yName: yName ?? yKey }); + break; + case "mean": + label = localeManager.t("seriesHistogramTooltipMean", { yName: yName ?? yKey }); + break; + case "count": + label = localeManager.t("seriesHistogramTooltipCount", { yName: yName ?? yKey }); + break; + } + data.push({ + label, + value: this.getAxisValueText(yAxis, "tooltip", aggregatedValue, datum, yKey, legendItemName) + }); + } + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(), + data + }, + { + seriesId, + datum, + title: yName, + xKey, + // HistogramSeries is an outlier since it's callbacks don't use TDatum. + xName, + yKey, + // HistogramSeries is an outlier since it's callbacks don't use TDatum. + yName, + xRange: [rangeMin, rangeMax], + frequency, + ...this.getItemStyle(datumIndex, false) + } + ); + } + legendItemSymbol() { + const { fill, fillOpacity, stroke: stroke3, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this.properties; + return { + marker: { + fill: deepClone(fill) ?? "rgba(0, 0, 0, 0)", + stroke: stroke3 ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { xKey: itemId, yName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId }), + label: { + text: yName ?? itemId ?? "Frequency" + }, + symbol: this.legendItemSymbol(), + hideInLegend: !showInLegend + } + ]; + } + animateEmptyUpdateReady({ datumSelection, labelSelection }) { + const fns = prepareBarAnimationFunctions(collapsedStartingBarPosition(true, this.axes, "normal"), "unknown"); + fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const fns = prepareBarAnimationFunctions(collapsedStartingBarPosition(true, this.axes, "normal"), "added"); + const dataDiff = { + changed: true, + added: /* @__PURE__ */ new Set(), + updated: /* @__PURE__ */ new Set(), + removed: /* @__PURE__ */ new Set(), + moved: /* @__PURE__ */ new Set() + }; + fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [data.datumSelection], + fns, + (_, datum) => createDatumId(...datum.domain), + dataDiff + ); + if (dataDiff?.changed) { + seriesLabelFadeInAnimation(this, "labels", this.ctx.animationManager, data.labelSelection); + } + } + isLabelEnabled() { + return this.properties.label.enabled; + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +HistogramSeries.className = "HistogramSeries"; +HistogramSeries.type = "histogram"; + +// packages/ag-charts-community/src/chart/series/cartesian/histogramSeriesModule.ts +var HistogramSeriesModule = { + type: "series", + optionsKey: "series[]", + packageType: "community", + chartTypes: ["cartesian"], + identifier: "histogram", + moduleFactory: (ctx) => new HistogramSeries(ctx), + predictAxis: predictCartesianTimeAxis, + defaultAxes: [ + { + type: "number" /* NUMBER */, + position: "bottom" /* BOTTOM */ + }, + { + type: "number" /* NUMBER */, + position: "left" /* LEFT */ + } + ], + themeTemplate: { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: 1, + fillOpacity: 1, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0, + label: { + ...LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + highlight: multiSeriesHighlightStyle() + } + } +}; +var NewHistogramSeriesModule = { + type: "series", + name: "histogram", + chartType: "cartesian", + enterprise: true, + options: histogramSeriesOptionsDef, + create: (ctx) => new HistogramSeries(ctx) +}; + +// packages/ag-charts-community/src/chart/series/cartesian/lineAggregation.ts +var AGGREGATION_THRESHOLD3 = 1e3; +var MAX_POINTS2 = 10; +function aggregationContainsIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf, xValuesLength) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = Number.isFinite(d0) ? aggregationXRatioForXValue(xValue2, d0, d1, xNeedsValueOf) : aggregationXRatioForDatumIndex(datumIndex, xValuesLength); + const aggIndex = aggregationIndexForXRatio(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_X_MIN] || datumIndex === indexData[aggIndex + AGGREGATION_INDEX_X_MAX] || datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MIN] || datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MAX]; +} +function aggregateLineData(scale2, xValues, yValues, domain, xNeedsValueOf, yNeedsValueOf) { + const xValuesLength = xValues.length; + if (xValuesLength < AGGREGATION_THRESHOLD3) + return; + const [d0, d1] = aggregationDomain(scale2, domain); + let maxRange = aggregationRangeFittingPoints(xValues, d0, d1, { xNeedsValueOf }); + const { indexData, valueData } = createAggregationIndices(xValues, yValues, yValues, d0, d1, maxRange, { + xNeedsValueOf, + yNeedsValueOf + }); + let indices = []; + for (let datumIndex = 0; datumIndex < xValuesLength; datumIndex++) { + if (aggregationContainsIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf, xValuesLength)) { + indices.push(datumIndex); + } + } + const filters = [{ maxRange, indices }]; + while (indices.length > MAX_POINTS2 && maxRange > 64) { + ({ maxRange } = compactAggregationIndices(indexData, valueData, maxRange, { inPlace: true })); + indices = indices.filter( + (datumIndex) => aggregationContainsIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf, xValuesLength) + ); + filters.push({ maxRange, indices }); + } + filters.reverse(); + return filters; +} + +// packages/ag-charts-community/src/chart/series/cartesian/lineSeriesProperties.ts +var LineSeriesProperties = class extends CartesianSeriesProperties { + constructor() { + super(...arguments); + this.stroke = "#874349"; + this.strokeWidth = 2; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.interpolation = new InterpolationProperties(); + this.marker = new SeriesMarker(); + this.label = new Label(); + this.tooltip = makeSeriesTooltip(); + this.connectMissingData = false; + this.sparklineMode = false; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "xKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "yKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "xName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "yName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "yFilterKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "stackGroup", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "normalizedTo", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "title", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "stroke", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "interpolation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "styler", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "marker", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "label", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "tooltip", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "connectMissingData", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], LineSeriesProperties.prototype, "sparklineMode", 2); + +// packages/ag-charts-community/src/chart/series/cartesian/lineSeries.ts +var CROSS_FILTER_LINE_STROKE_OPACITY_FACTOR = 0.25; +var memoizedAggregateLineData = simpleMemorize2(aggregateLineData); +var LineSeries = class extends CartesianSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: DEFAULT_CARTESIAN_DIRECTION_KEYS, + propertyNames: DEFAULT_CARTESIAN_DIRECTION_NAMES, + categoryKey: "xValue", + pickModes: [ + 2 /* AXIS_ALIGNED */, + 1 /* NEAREST_NODE */, + 0 /* EXACT_SHAPE_MATCH */ + ], + datumSelectionGarbageCollection: false, + segmentedDataNodes: false, + animationResetFns: { + path: buildResetPathFn({ getVisible: () => this.visible, getOpacity: () => this.getOpacity() }), + label: resetLabelFn, + datum: (node, datum) => ({ ...resetMarkerFn(node), ...resetMarkerPositionFn(node, datum) }) + }, + clipFocusBox: false + }); + this.properties = new LineSeriesProperties(); + this.dataAggregationFilters = void 0; + } + get pickModeAxis() { + return this.properties.sparklineMode ? "main" : "main-category"; + } + get hasData() { + return this.getHasData("xValue"); + } + isNormalized() { + return this.properties.normalizedTo != null; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, visible, seriesGrouping: { groupIndex = this.id, stackCount = 0 } = {} } = this; + const { xKey, yKey, yFilterKey, connectMissingData, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.axes["x" /* X */]?.scale; + const yScale = this.axes["y" /* Y */]?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const stacked = stackCount > 1 || normalizedTo != null; + const common = { invalidValue: null }; + if (connectMissingData && stacked) { + common.invalidValue = 0; + } + if (stacked && !visible) { + common.forceValue = 0; + } + const idMap = { + value: `area-stack-${groupIndex}-yValue`, + marker: `area-stack-${groupIndex}-yValues-marker` + }; + const props = []; + if (!isContinuousX || stacked) { + props.push(keyProperty(xKey, xScaleType, { id: "xKey" })); + } + props.push( + valueProperty(xKey, xScaleType, { id: "xValue" }), + valueProperty(yKey, yScaleType, { + id: `yValueRaw`, + ...common, + invalidValue: void 0 + }) + ); + if (yFilterKey != null) { + props.push(valueProperty(yFilterKey, yScaleType, { id: "yFilterRaw" })); + } + if (stacked) { + props.push( + ...groupAccumulativeValueProperty( + yKey, + "normal", + { id: `yValueCumulative`, ...common, groupId: idMap.marker }, + yScaleType + ) + ); + } + if (isDefined(normalizedTo)) { + props.push( + valueProperty(yKey, yScaleType, { id: `yValue`, ...common, groupId: idMap.value }), + normaliseGroupTo(Object.values(idMap), normalizedTo) + ); + } + if (animationEnabled) { + props.push(animationValidation(isContinuousX ? ["xValue"] : void 0)); + if (this.processedData) { + props.push(diff(this.id, this.processedData)); + } + } + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props, + groupByKeys: stacked, + groupByData: !stacked + }); + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + yValueKey() { + return this.isNormalized() ? "yValue" : "yValueRaw"; + } + yCumulativeKey(processData) { + return processData.type === "grouped" ? "yValueCumulative" : this.yValueKey(); + } + xCoordinateRange(xValue2, pixelSize) { + const { marker } = this.properties; + const x = this.axes["x" /* X */].scale.convert(xValue2); + const r = marker.enabled ? 0.5 * marker.size * pixelSize : 0; + return [x - r, x + r]; + } + yCoordinateRange(yValues, pixelSize) { + const { marker } = this.properties; + const y = this.axes["y" /* Y */].scale.convert(yValues[0]); + const r = marker.enabled ? 0.5 * marker.size * pixelSize : 0; + return [y - r, y + r]; + } + getSeriesDomain(direction) { + const { dataModel, processedData, axes } = this; + if (!dataModel || !processedData) + return []; + const yAxis = axes["y" /* Y */]; + if (direction === "x" /* X */) { + const xDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = dataModel.getDomain(this, `xValue`, "value", processedData); + if (xDef?.def.type === "value" && xDef.def.valueType === "category") { + return domain; + } + return fixNumericExtent(extent(domain)); + } + const yExtent = this.domainForClippedRange( + "y" /* Y */, + [this.yCumulativeKey(processedData)], + "xValue" + ); + if (this.isNormalized() && yAxis instanceof NumberAxis && !(yAxis instanceof LogAxis)) { + const fixedYExtent = Number.isFinite(yExtent[1] - yExtent[0]) ? [Math.min(yExtent[0], 0), Math.max(yExtent[1], 0)] : []; + return fixNumericExtent(fixedYExtent); + } else { + return fixNumericExtent(yExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange( + "y" /* Y */, + [this.yCumulativeKey(this.processedData)], + "xValue", + visibleRange + ); + } + getZoomRangeFittingItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.zoomFittingVisibleItems( + "xValue", + [this.yCumulativeKey(this.processedData)], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + getVisibleItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.countVisibleItems( + "xValue", + [this.yCumulativeKey(this.processedData)], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable(processedData)) + return; + const xAxis = this.axes["x" /* X */]; + if (xAxis == null) + return; + const { scale: scale2 } = xAxis; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, this.yCumulativeKey(processedData), processedData); + const domain = dataModel.getDomain(this, `xValue`, "value", processedData); + const xNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `xValue`, processedData); + const yNeedsValueOf = dataModel.resolveColumnNeedsValueOf( + this, + this.yCumulativeKey(processedData), + processedData + ); + return memoizedAggregateLineData(scale2.type, xValues, yValues, domain, xNeedsValueOf, yNeedsValueOf); + } + createNodeData() { + const { dataModel, processedData, axes, dataAggregationFilters } = this; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const { + xKey, + xName, + yFilterKey, + yKey, + yName, + marker, + label, + connectMissingData, + interpolation, + legendItemName + } = this.properties; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const yOffset = (yScale.bandwidth ?? 0) / 2; + const size = marker.enabled ? marker.size : 0; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yRawValues = dataModel.resolveColumnById(this, `yValueRaw`, processedData); + const yCumulativeValues = dataModel.resolveColumnById(this, this.yCumulativeKey(processedData), processedData); + const selectionValues = yFilterKey == null ? void 0 : dataModel.resolveColumnById(this, `yFilterRaw`, processedData); + const yDomain = this.getSeriesDomain("y" /* Y */); + const capDefaults = { + lengthRatioMultiplier: this.properties.marker.getDiameter(), + lengthMax: Infinity + }; + const nodeData = []; + const spanPoints = []; + const handleDatum = (datumIndex) => { + const datum = rawData[datumIndex]; + const xDatum = xValues[datumIndex]; + const yDatum = yRawValues[datumIndex]; + const yCumulative = yCumulativeValues[datumIndex]; + const selected = selectionValues?.[datumIndex]; + const x = xScale.convert(xDatum) + xOffset; + const y = yScale.convert(yCumulative) + yOffset; + if (!Number.isFinite(x)) + return; + if (yDatum != null) { + const labelText = label.enabled ? this.getLabelText(yDatum, datum, yKey, "y", yDomain, label, { + value: yDatum, + datum, + xKey, + yKey, + xName, + yName, + legendItemName + }) : void 0; + nodeData.push({ + series: this, + datum, + datumIndex, + yKey, + xKey, + point: { x, y, size }, + midPoint: { x, y }, + cumulativeValue: yCumulative, + yValue: yDatum, + xValue: xDatum, + capDefaults, + labelText, + selected + }); + } + const currentSpanPoints = spanPoints.at(-1); + if (yDatum != null) { + const spanPoint = { + point: { x, y }, + xDatum, + yDatum + }; + if (Array.isArray(currentSpanPoints)) { + currentSpanPoints.push(spanPoint); + } else if (currentSpanPoints == null) { + spanPoints.push([spanPoint]); + } else { + currentSpanPoints.skip += 1; + spanPoints.push([spanPoint]); + } + } else if (!connectMissingData) { + if (Array.isArray(currentSpanPoints) || currentSpanPoints == null) { + spanPoints.push({ skip: 0 }); + } else { + currentSpanPoints.skip += 1; + } + } + }; + const [r0, r1] = xScale.range; + const range4 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range4); + const indices = dataAggregationFilter?.indices; + let [start2, end3] = this.visibleRangeIndices("xValue", xAxis.range, indices); + start2 = Math.max(start2 - 1, 0); + end3 = Math.min(end3 + 1, indices?.length ?? xValues.length); + if (processedData.input.count < 1e3) { + start2 = 0; + end3 = processedData.input.count; + } + for (let i = start2; i < end3; i += 1) { + handleDatum(indices?.[i] ?? i); + } + const strokeSpans = spanPoints.flatMap((p) => { + return Array.isArray(p) ? interpolatePoints(p, interpolation) : []; + }); + const strokeData = { itemId: yKey, spans: strokeSpans }; + const crossFiltering = selectionValues?.some((selectionValue, index) => selectionValue === yRawValues[index]) ?? false; + const segments = calculateSegments( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene, + false + ); + return { + itemId: yKey, + nodeData, + labelData: nodeData, + strokeData, + scales: this.calculateScaling(), + visible: this.visible, + crossFiltering, + styles: getMarkerStyles(this, this.properties, marker), + segments + }; + } + isPathOrSelectionDirty() { + return this.properties.marker.isDirty(); + } + updatePathNodes(opts) { + const { + paths: [lineNode], + visible, + animationEnabled + } = opts; + const crossFiltering = this.contextNodeData?.crossFiltering === true; + const merged = mergeDefaults(this.getHighlightStyle(), this.getStyle(false)); + const { strokeWidth, stroke: stroke3, strokeOpacity, lineDash, lineDashOffset, opacity } = merged; + const segments = this.contextNodeData?.segments; + lineNode.setProperties({ + segments, + fill: void 0, + lineJoin: "round", + pointerEvents: 1 /* None */, + opacity, + stroke: stroke3, + strokeWidth, + strokeOpacity: strokeOpacity * (crossFiltering ? CROSS_FILTER_LINE_STROKE_OPACITY_FACTOR : 1), + lineDash, + lineDashOffset + }); + lineNode.datum = segments; + if (!animationEnabled) { + lineNode.visible = visible; + } + updateClipPath(this, lineNode); + } + updateDatumSelection(opts) { + let { nodeData } = opts; + const { datumSelection } = opts; + const { contextNodeData, processedData, axes, properties } = this; + const { marker } = properties; + const markersEnabled = contextNodeData?.crossFiltering === true || markerEnabled(processedData.input.count, axes["x" /* X */].scale, marker); + nodeData = markersEnabled ? nodeData : []; + if (marker.isDirty()) { + datumSelection.clear(); + datumSelection.cleanup(); + } + return datumSelection.update(nodeData, void 0, (datum) => createDatumId(datum.xValue)); + } + updateDatumStyles(opts) { + const { datumSelection, isHighlight } = opts; + const { marker } = this.properties; + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum) => { + if (!datumSelection.isGarbage(node)) { + const highlightState = this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { stroke: stroke3, strokeWidth, strokeOpacity } = stylerStyle; + const params = this.makeItemStylerParams( + this.dataModel, + this.processedData, + datum.datumIndex, + stylerStyle.marker + ); + datum.style = this.getMarkerStyle( + marker, + datum, + params, + { isHighlight, highlightState }, + stylerStyle.marker, + { + stroke: stroke3, + strokeWidth, + strokeOpacity + } + ); + } + }); + } + updateDatumNodes(opts) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { datumSelection, isHighlight, drawingMode } = opts; + const applyTranslation = this.ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum) => { + const state = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const style2 = datum.style ?? contextNodeData.styles[state]; + this.applyMarkerStyle(style2, node, datum.point, fillBBox, { + applyTranslation, + selected: datum.selected + }); + node.drawingMode = drawingMode; + }); + if (!isHighlight) { + this.properties.marker.markClean(); + } + } + updateLabelSelection(opts) { + return opts.labelSelection.update(this.isLabelEnabled() ? opts.labelData : []); + } + updateLabelNodes(opts) { + const { isHighlight = false } = opts; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const params = this.makeLabelFormatterParams(); + opts.labelSelection.each((text2, datum) => { + const style2 = getLabelStyles(this, datum, params, this.properties.label, isHighlight, activeHighlight); + const { enabled, fontStyle, fontWeight, fontSize, fontFamily, color: color2 } = style2; + if (enabled && datum?.labelText) { + text2.fontStyle = fontStyle; + text2.fontWeight = fontWeight; + text2.fontSize = fontSize; + text2.fontFamily = fontFamily; + text2.textAlign = "center"; + text2.textBaseline = "bottom"; + text2.text = datum.labelText; + text2.x = datum.point.x; + text2.y = datum.point.y - 10; + text2.fill = color2; + text2.visible = true; + text2.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + text2.setBoxing(style2); + } else { + text2.visible = false; + } + }); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { marker, lineDash, lineDashOffset, stroke: stroke3, strokeOpacity, strokeWidth, xKey, yKey } = this.properties; + const highlightState = toHighlightString(highlightStateEnum ?? 0 /* None */); + return { + marker: { + fill: marker.fill, + fillOpacity: marker.fillOpacity, + size: marker.size, + shape: marker.shape, + stroke: marker.stroke, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }, + highlightState, + highlighted, + lineDash, + lineDashOffset, + seriesId, + stroke: stroke3, + strokeOpacity, + strokeWidth, + xKey, + yKey + }; + } + makeItemStylerParams(dataModel, processedData, datumIndex, style2) { + const { xKey, yKey } = this.properties; + const xValue2 = dataModel.resolveColumnById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValueRaw`, processedData)[datumIndex]; + const xDomain = dataModel.getDomain(this, `xValue`, "key", processedData); + const yDomain = dataModel.getDomain(this, this.yCumulativeKey(processedData), "value", processedData); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + ...datumStylerProperties(xValue2, yValue, xKey, yKey, xDomain, yDomain), + xValue: xValue2, + yValue, + ...style2, + fill + }; + } + makeLabelFormatterParams() { + const { xKey, xName, yKey, yName, legendItemName } = this.properties; + return { xKey, xName, yKey, yName, legendItemName }; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { xKey, xName, yKey, yName, tooltip, legendItemName } = properties; + const xAxis = axes["x" /* X */]; + const yAxis = axes["y" /* Y */]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data?.[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValueRaw`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(dataModel, processedData, datumIndex, stylerStyle.marker); + const format = this.getMarkerStyle( + this.properties.marker, + { datumIndex, datum }, + params, + { isHighlight: false }, + stylerStyle.marker + ); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [ + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, yKey, legendItemName) + } + ] + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yKey, + yName, + ...format, + ...this.getModuleTooltipParams() + } + ); + } + legendItemSymbol() { + const { stroke: stroke3, strokeOpacity, strokeWidth, lineDash, marker } = this.getStyle(false); + const markerStyle = this.getMarkerStyle( + this.properties.marker, + {}, + void 0, + { + isHighlight: false, + checkForHighlight: false + }, + { + size: marker.size, + shape: marker.shape, + fill: marker.fill, + fillOpacity: marker.fillOpacity, + stroke: marker.stroke, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + } + ); + return { + marker: { + ...markerStyle, + enabled: this.properties.marker.enabled + }, + line: { + stroke: stroke3, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { yKey: itemId, yName, title, legendItemName, showInLegend } = this.properties; + return [ + { + legendType, + id: seriesId, + itemId, + legendItemName, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId }), + label: { + text: legendItemName ?? title ?? yName ?? itemId + }, + symbol: this.legendItemSymbol(), + hideInLegend: !showInLegend + } + ]; + } + updatePaths(opts) { + this.updateLinePaths(opts.paths, opts.contextData); + } + updateLinePaths(paths, contextData) { + const spans = contextData.strokeData.spans; + const [lineNode] = paths; + lineNode.path.clear(); + plotLinePathStroke(lineNode, spans); + lineNode.markDirty("LineSeries"); + } + animateEmptyUpdateReady(animationData) { + const { datumSelection, labelSelection, annotationSelections, contextData, paths } = animationData; + const { animationManager } = this.ctx; + this.updateLinePaths(paths, contextData); + pathSwipeInAnimation(this, animationManager, ...paths); + resetMotion([datumSelection], resetMarkerPositionFn); + markerSwipeScaleInAnimation(this, animationManager, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelection); + seriesLabelFadeInAnimation(this, "annotations", animationManager, ...annotationSelections); + } + animateReadyResize(animationData) { + const { contextData, paths } = animationData; + this.updateLinePaths(paths, contextData); + super.animateReadyResize(animationData); + } + animateWaitingUpdateReady(animationData) { + const { animationManager } = this.ctx; + const { + datumSelection, + labelSelection: labelSelections, + annotationSelections, + contextData, + paths, + previousContextData + } = animationData; + const [path] = paths; + if (contextData.visible === false && previousContextData?.visible === false) + return; + this.resetDatumAnimation(animationData); + this.resetLabelAnimation(animationData); + const update = () => { + this.resetPathAnimation(animationData); + this.updateLinePaths(paths, contextData); + }; + const skip = () => { + animationManager.skipCurrentBatch(); + update(); + }; + if (contextData == null || previousContextData == null) { + update(); + markerFadeInAnimation(this, animationManager, "added", datumSelection); + pathFadeInAnimation(this, "path_properties", animationManager, "add", path); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelections); + seriesLabelFadeInAnimation(this, "annotations", animationManager, ...annotationSelections); + return; + } + if (contextData.crossFiltering !== previousContextData.crossFiltering) { + skip(); + return; + } + const fns = prepareLinePathAnimation( + contextData, + previousContextData, + this.processedData?.reduced?.diff?.[this.id] + ); + if (fns === void 0) { + skip(); + return; + } else if (fns.status === "no-op") { + return; + } + fromToMotion(this.id, "path_properties", animationManager, [path], fns.stroke.pathProperties); + if (fns.status === "added") { + this.updateLinePaths(paths, contextData); + } else if (fns.status === "removed") { + this.updateLinePaths(paths, previousContextData); + } else { + pathMotion(this.id, "path_update", animationManager, [path], fns.stroke.path); + } + if (fns.hasMotion) { + markerFadeInAnimation(this, animationManager, void 0, datumSelection); + seriesLabelFadeInAnimation(this, "labels", animationManager, labelSelections); + seriesLabelFadeInAnimation(this, "annotations", animationManager, ...annotationSelections); + } + this.ctx.animationManager.animate({ + id: this.id, + groupId: "reset_after_animation", + phase: "trailing", + from: {}, + to: {}, + onComplete: () => this.updateLinePaths(paths, contextData) + }); + } + isLabelEnabled() { + return this.properties.label.enabled; + } + getBandScalePadding() { + return { inner: 1, outer: 0.1 }; + } + nodeFactory() { + return new Marker(); + } + getStyle(highlighted, highlightState) { + const { styler, marker, lineDash, lineDashOffset, stroke: stroke3, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill = "transparent", fillOpacity } = marker; + let stylerResult = {}; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + const cbResult = this.cachedCallWithContext(styler, stylerParams) ?? {}; + const resolved = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + cbResult, + { pick: false } + ); + stylerResult = resolved ?? {}; + } + stylerResult.marker ?? (stylerResult.marker = {}); + return { + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke3, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + fill: stylerResult.marker.fill ?? fill, + fillOpacity: stylerResult.marker.fillOpacity ?? fillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke3, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } + getFormattedMarkerStyle(datum) { + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams( + this.dataModel, + this.processedData, + datum.datumIndex, + stylerStyle.marker + ); + return this.getMarkerStyle( + this.properties.marker, + datum, + params, + { isHighlight: true }, + void 0, + stylerStyle + ); + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds(this, opts); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +LineSeries.className = "LineSeries"; +LineSeries.type = "line"; + +// packages/ag-charts-community/src/chart/series/cartesian/lineSeriesModule.ts +var LineSeriesModule = { + type: "series", + optionsKey: "series[]", + packageType: "community", + chartTypes: ["cartesian"], + identifier: "line", + moduleFactory: (ctx) => new LineSeries(ctx), + stackable: true, + predictAxis: predictCartesianTimeAxis, + defaultAxes: [ + { + type: "number" /* NUMBER */, + position: "left" /* LEFT */ + }, + { + type: "category" /* CATEGORY */, + position: "bottom" /* BOTTOM */ + } + ], + themeTemplate: { + series: { + stroke: SAFE_STROKE_FILL_OPERATION, + strokeWidth: 2, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0, + interpolation: { + type: "linear" + }, + marker: { + shape: "circle", + size: 7, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" } + }, + label: { + ...LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + errorBar: { + cap: { + lengthRatio: 1 + } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] }, + position: { + anchorTo: { $path: ["/tooltip/position/anchorTo", "node"] } + } + }, + highlight: multiSeriesHighlightStyle(), + segmentation: SEGMENTATION_DEFAULTS + } + } +}; +var NewLineSeriesModule = { + type: "series", + name: "line", + chartType: "cartesian", + options: lineSeriesOptionsDef, + create: (ctx) => new LineSeries(ctx) +}; + +// packages/ag-charts-community/src/chart/series/cartesian/scatterSeries.ts +var ScatterSeries = class extends BubbleSeries { +}; +ScatterSeries.className = "ScatterSeries"; +ScatterSeries.type = "scatter"; + +// packages/ag-charts-community/src/chart/series/cartesian/scatterSeriesModule.ts +var ScatterSeriesModule = { + type: "series", + optionsKey: "series[]", + packageType: "community", + chartTypes: ["cartesian"], + identifier: "scatter", + moduleFactory: (ctx) => new ScatterSeries(ctx), + predictAxis: predictCartesianAxis, + defaultAxes: [ + { + type: "number" /* NUMBER */, + position: "bottom" /* BOTTOM */ + }, + { + type: "number" /* NUMBER */, + position: "left" /* LEFT */ + } + ], + themeTemplate: { + series: { + shape: "circle", + size: 7, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + fillOpacity: 0.8, + maxRenderedItems: 1e4, + label: { + ...LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + errorBar: { + cap: { + lengthRatio: 1 + } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] }, + position: { + anchorTo: { $path: ["/tooltip/position/anchorTo", "node"] } + } + }, + highlight: multiSeriesHighlightStyle() + } + } +}; +var NewScatterSeriesModule = { + type: "series", + name: "scatter", + chartType: "cartesian", + options: scatterSeriesOptionsDef, + create: (ctx) => new ScatterSeries(ctx) +}; + +// packages/ag-charts-community/src/scene/sectorBox.ts +var SectorBox = class _SectorBox { + constructor(startAngle, endAngle, innerRadius, outerRadius) { + this.startAngle = startAngle; + this.endAngle = endAngle; + this.innerRadius = innerRadius; + this.outerRadius = outerRadius; + } + clone() { + const { startAngle, endAngle, innerRadius, outerRadius } = this; + return new _SectorBox(startAngle, endAngle, innerRadius, outerRadius); + } + equals(other) { + return this.startAngle === other.startAngle && this.endAngle === other.endAngle && this.innerRadius === other.innerRadius && this.outerRadius === other.outerRadius; + } + [interpolate](other, d) { + return new _SectorBox( + this.startAngle * (1 - d) + other.startAngle * d, + this.endAngle * (1 - d) + other.endAngle * d, + this.innerRadius * (1 - d) + other.innerRadius * d, + this.outerRadius * (1 - d) + other.outerRadius * d + ); + } +}; + +// packages/ag-charts-community/src/scene/util/sector.ts +function sectorBox({ startAngle, endAngle, innerRadius, outerRadius }) { + let x0 = Infinity; + let y0 = Infinity; + let x1 = -Infinity; + let y1 = -Infinity; + const addPoint = (x, y) => { + x0 = Math.min(x, x0); + y0 = Math.min(y, y0); + x1 = Math.max(x, x1); + y1 = Math.max(y, y1); + }; + addPoint(innerRadius * Math.cos(startAngle), innerRadius * Math.sin(startAngle)); + addPoint(innerRadius * Math.cos(endAngle), innerRadius * Math.sin(endAngle)); + addPoint(outerRadius * Math.cos(startAngle), outerRadius * Math.sin(startAngle)); + addPoint(outerRadius * Math.cos(endAngle), outerRadius * Math.sin(endAngle)); + if (isBetweenAngles(0, startAngle, endAngle)) { + addPoint(outerRadius, 0); + } + if (isBetweenAngles(Math.PI * 0.5, startAngle, endAngle)) { + addPoint(0, outerRadius); + } + if (isBetweenAngles(Math.PI, startAngle, endAngle)) { + addPoint(-outerRadius, 0); + } + if (isBetweenAngles(Math.PI * 1.5, startAngle, endAngle)) { + addPoint(0, -outerRadius); + } + return new BBox(x0, y0, x1 - x0, y1 - y0); +} +function isPointInSector(x, y, sector) { + const radius = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); + const { innerRadius, outerRadius } = sector; + if (sector.startAngle === sector.endAngle || radius < Math.min(innerRadius, outerRadius) || radius > Math.max(innerRadius, outerRadius)) { + return false; + } + const startAngle = normalizeAngle180(sector.startAngle); + const endAngle = normalizeAngle180(sector.endAngle); + const angle2 = Math.atan2(y, x); + return startAngle < endAngle ? angle2 <= endAngle && angle2 >= startAngle : angle2 <= endAngle && angle2 >= -Math.PI || angle2 >= startAngle && angle2 <= Math.PI; +} +function arcIntersections(cx, cy, r, startAngle, endAngle, counterClockwise, x1, y1, x2, y2) { + if (Number.isNaN(cx) || Number.isNaN(cy)) { + return 0; + } + if (counterClockwise) { + [endAngle, startAngle] = [startAngle, endAngle]; + } + const k = (y2 - y1) / (x2 - x1); + const y0 = y1 - k * x1; + const a = Math.pow(k, 2) + 1; + const b = 2 * (k * (y0 - cy) - cx); + const c = Math.pow(cx, 2) + Math.pow(y0 - cy, 2) - Math.pow(r, 2); + const d = Math.pow(b, 2) - 4 * a * c; + if (d < 0) { + return 0; + } + const i1x = (-b + Math.sqrt(d)) / 2 / a; + const i2x = (-b - Math.sqrt(d)) / 2 / a; + let intersections = 0; + for (const x of [i1x, i2x]) { + const isXInsideLine = x >= Math.min(x1, x2) && x <= Math.max(x1, x2); + if (!isXInsideLine) { + continue; + } + const y = k * x + y0; + const adjacent = x - cx; + const opposite = y - cy; + const angle2 = Math.atan2(opposite, adjacent); + if (isBetweenAngles(angle2, startAngle, endAngle)) { + intersections++; + } + } + return intersections; +} +function lineCollidesSector(line, sector) { + const { startAngle, endAngle, innerRadius, outerRadius } = sector; + const outerStart = { x: outerRadius * Math.cos(startAngle), y: outerRadius * Math.sin(startAngle) }; + const outerEnd = { x: outerRadius * Math.cos(endAngle), y: outerRadius * Math.sin(endAngle) }; + const innerStart = innerRadius === 0 ? { x: 0, y: 0 } : { x: innerRadius * Math.cos(startAngle), y: innerRadius * Math.sin(startAngle) }; + const innerEnd = innerRadius === 0 ? { x: 0, y: 0 } : { x: innerRadius * Math.cos(endAngle), y: innerRadius * Math.sin(endAngle) }; + return segmentIntersection( + line.start.x, + line.start.y, + line.end.x, + line.end.y, + outerStart.x, + outerStart.y, + innerStart.x, + innerStart.y + ) || segmentIntersection( + line.start.x, + line.start.y, + line.end.x, + line.end.y, + outerEnd.x, + outerEnd.y, + innerEnd.x, + innerEnd.y + ) || arcIntersections( + 0, + 0, + outerRadius, + startAngle, + endAngle, + true, + line.start.x, + line.start.y, + line.end.x, + line.end.y + ); +} +function boxCollidesSector(box, sector) { + const topLeft = { x: box.x, y: box.y }; + const topRight = { x: box.x + box.width, y: box.y }; + const bottomLeft = { x: box.x, y: box.y + box.height }; + const bottomRight = { x: box.x + box.width, y: box.y + box.height }; + return lineCollidesSector({ start: topLeft, end: topRight }, sector) || lineCollidesSector({ start: bottomLeft, end: bottomRight }, sector); +} +function radiiScalingFactor(r, sweep, a, b) { + if (a === 0 && b === 0) + return 0; + const fs1 = Math.asin(Math.abs(1 * a) / (r + 1 * a)) + Math.asin(Math.abs(1 * b) / (r + 1 * b)) - sweep; + if (fs1 < 0) + return 1; + let start2 = 0; + let end3 = 1; + for (let i = 0; i < 8; i += 1) { + const s = (start2 + end3) / 2; + const fs = Math.asin(Math.abs(s * a) / (r + s * a)) + Math.asin(Math.abs(s * b) / (r + s * b)) - sweep; + if (fs < 0) { + start2 = s; + } else { + end3 = s; + } + } + return start2; +} +var delta2 = 1e-6; +function clockwiseAngle(angle2, relativeToStartAngle) { + if (angleBetween(angle2, relativeToStartAngle) < delta2) { + return relativeToStartAngle; + } else { + return normalizeAngle360(angle2 - relativeToStartAngle) + relativeToStartAngle; + } +} +function clockwiseAngles(startAngle, endAngle, relativeToStartAngle = 0) { + const fullPie = Math.abs(endAngle - startAngle) >= 2 * Math.PI; + const sweepAngle = fullPie ? 2 * Math.PI : normalizeAngle360(endAngle - startAngle); + startAngle = clockwiseAngle(startAngle, relativeToStartAngle); + endAngle = startAngle + sweepAngle; + return { startAngle, endAngle }; +} +function arcRadialLineIntersectionAngle(cx, cy, r, startAngle, endAngle, clipAngle) { + const sinA = Math.sin(clipAngle); + const cosA = Math.cos(clipAngle); + const c = cx ** 2 + cy ** 2 - r ** 2; + let p0x; + let p0y; + let p1x; + let p1y; + if (cosA > 0.5) { + const tanA = sinA / cosA; + const a = 1 + tanA ** 2; + const b = -2 * (cx + cy * tanA); + const d = b ** 2 - 4 * a * c; + if (d < 0) + return; + const x0 = (-b + Math.sqrt(d)) / (2 * a); + const x1 = (-b - Math.sqrt(d)) / (2 * a); + p0x = x0; + p0y = x0 * tanA; + p1x = x1; + p1y = x1 * tanA; + } else { + const cotA = cosA / sinA; + const a = 1 + cotA ** 2; + const b = -2 * (cy + cx * cotA); + const d = b ** 2 - 4 * a * c; + if (d < 0) + return; + const y0 = (-b + Math.sqrt(d)) / (2 * a); + const y1 = (-b - Math.sqrt(d)) / (2 * a); + p0x = y0 * cotA; + p0y = y0; + p1x = y1 * cotA; + p1y = y1; + } + const normalisedX = cosA; + const normalisedY = sinA; + const p0DotNormalized = p0x * normalisedX + p0y * normalisedY; + const p1DotNormalized = p1x * normalisedX + p1y * normalisedY; + const a0 = p0DotNormalized > 0 ? clockwiseAngle(Math.atan2(p0y - cy, p0x - cx), startAngle) : Number.NaN; + const a1 = p1DotNormalized > 0 ? clockwiseAngle(Math.atan2(p1y - cy, p1x - cx), startAngle) : Number.NaN; + if (a0 >= startAngle && a0 <= endAngle) { + return a0; + } else if (a1 >= startAngle && a1 <= endAngle) { + return a1; + } +} +function arcCircleIntersectionAngle(cx, cy, r, startAngle, endAngle, circleR) { + const d = Math.hypot(cx, cy); + const d1 = (d ** 2 - r ** 2 + circleR ** 2) / (2 * d); + const d2 = d - d1; + const theta = Math.atan2(cy, cx); + const deltaTheta = Math.acos(-d2 / r); + const a0 = clockwiseAngle(theta + deltaTheta, startAngle); + const a1 = clockwiseAngle(theta - deltaTheta, startAngle); + if (a0 >= startAngle && a0 <= endAngle) { + return a0; + } else if (a1 >= startAngle && a1 <= endAngle) { + return a1; + } +} + +// packages/ag-charts-community/src/scene/shape/sector.ts +var Arc = class { + constructor(cx, cy, r, a0, a1) { + this.cx = cx; + this.cy = cy; + this.r = r; + this.a0 = a0; + this.a1 = a1; + if (this.a0 >= this.a1) { + this.a0 = Number.NaN; + this.a1 = Number.NaN; + } + } + isValid() { + return Number.isFinite(this.a0) && Number.isFinite(this.a1); + } + pointAt(a) { + return { + x: this.cx + this.r * Math.cos(a), + y: this.cy + this.r * Math.sin(a) + }; + } + clipStart(a) { + if (a == null || !this.isValid() || a < this.a0) + return; + this.a0 = a; + if (Number.isNaN(a) || this.a0 >= this.a1) { + this.a0 = Number.NaN; + this.a1 = Number.NaN; + } + } + clipEnd(a) { + if (a == null || !this.isValid() || a > this.a1) + return; + this.a1 = a; + if (Number.isNaN(a) || this.a0 >= this.a1) { + this.a0 = Number.NaN; + this.a1 = Number.NaN; + } + } +}; +var Sector = class extends Path { + constructor() { + super(...arguments); + this.centerX = 0; + this.centerY = 0; + this.innerRadius = 10; + this.outerRadius = 20; + this.startAngle = 0; + this.endAngle = Math.PI * 2; + this.clipSector = void 0; + this.concentricEdgeInset = 0; + this.radialEdgeInset = 0; + this.startOuterCornerRadius = 0; + this.endOuterCornerRadius = 0; + this.startInnerCornerRadius = 0; + this.endInnerCornerRadius = 0; + } + set inset(value) { + this.concentricEdgeInset = value; + this.radialEdgeInset = value; + } + set cornerRadius(value) { + this.startOuterCornerRadius = value; + this.endOuterCornerRadius = value; + this.startInnerCornerRadius = value; + this.endInnerCornerRadius = value; + } + computeBBox() { + return sectorBox(this).translate(this.centerX, this.centerY); + } + normalizedRadii() { + const { concentricEdgeInset } = this; + let { innerRadius, outerRadius } = this; + innerRadius = innerRadius > 0 ? innerRadius + concentricEdgeInset : 0; + outerRadius = Math.max(outerRadius - concentricEdgeInset, 0); + return { innerRadius, outerRadius }; + } + normalizedClipSector() { + const { clipSector } = this; + if (clipSector == null) + return; + const { startAngle, endAngle } = clockwiseAngles(this.startAngle, this.endAngle); + const { innerRadius, outerRadius } = this.normalizedRadii(); + const clipAngles = clockwiseAngles(clipSector.startAngle, clipSector.endAngle, startAngle); + return new SectorBox( + Math.max(startAngle, clipAngles.startAngle), + Math.min(endAngle, clipAngles.endAngle), + Math.max(innerRadius, clipSector.innerRadius), + Math.min(outerRadius, clipSector.outerRadius) + ); + } + getAngleOffset(radius) { + return radius > 0 ? this.radialEdgeInset / radius : 0; + } + arc(r, angleSweep, a0, a1, outerArc, innerArc, start2, inner) { + if (r <= 0) + return; + const { startAngle, endAngle } = clockwiseAngles(this.startAngle, this.endAngle); + const { innerRadius, outerRadius } = this.normalizedRadii(); + const clipSector = this.normalizedClipSector(); + if (inner && innerRadius <= 0) + return; + const angleOffset = inner ? this.getAngleOffset(innerRadius + r) : this.getAngleOffset(outerRadius - r); + const angle2 = start2 ? startAngle + angleOffset + angleSweep : endAngle - angleOffset - angleSweep; + const radius = inner ? innerRadius + r : outerRadius - r; + const cx = radius * Math.cos(angle2); + const cy = radius * Math.sin(angle2); + if (clipSector != null) { + const delta4 = 1e-6; + if (!start2 && !(angle2 >= startAngle - delta4 && angle2 <= clipSector.endAngle - delta4)) + return; + if (start2 && !(angle2 >= clipSector.startAngle + delta4 && angle2 <= endAngle - delta4)) + return; + if (inner && radius < clipSector.innerRadius - delta4) + return; + if (!inner && radius > clipSector.outerRadius + delta4) + return; + } + const arc = new Arc(cx, cy, r, a0, a1); + if (clipSector != null) { + if (inner) { + arc.clipStart(arcRadialLineIntersectionAngle(cx, cy, r, a0, a1, clipSector.endAngle)); + arc.clipEnd(arcRadialLineIntersectionAngle(cx, cy, r, a0, a1, clipSector.startAngle)); + } else { + arc.clipStart(arcRadialLineIntersectionAngle(cx, cy, r, a0, a1, clipSector.startAngle)); + arc.clipEnd(arcRadialLineIntersectionAngle(cx, cy, r, a0, a1, clipSector.endAngle)); + } + let circleClipStart; + let circleClipEnd; + if (start2) { + circleClipStart = arcCircleIntersectionAngle(cx, cy, r, a0, a1, clipSector.innerRadius); + circleClipEnd = arcCircleIntersectionAngle(cx, cy, r, a0, a1, clipSector.outerRadius); + } else { + circleClipStart = arcCircleIntersectionAngle(cx, cy, r, a0, a1, clipSector.outerRadius); + circleClipEnd = arcCircleIntersectionAngle(cx, cy, r, a0, a1, clipSector.innerRadius); + } + arc.clipStart(circleClipStart); + arc.clipEnd(circleClipEnd); + if (circleClipStart != null) { + const { x: x2, y: y2 } = arc.pointAt(circleClipStart); + const theta2 = clockwiseAngle(Math.atan2(y2, x2), startAngle); + if (start2) { + innerArc?.clipStart(theta2); + } else { + outerArc.clipEnd(theta2); + } + } + if (circleClipEnd != null) { + const { x: x2, y: y2 } = arc.pointAt(circleClipEnd); + const theta2 = clockwiseAngle(Math.atan2(y2, x2), startAngle); + if (start2) { + outerArc.clipStart(theta2); + } else { + innerArc?.clipEnd(theta2); + } + } + } + if (clipSector != null) { + const { x: x2, y: y2 } = arc.pointAt((arc.a0 + arc.a1) / 2); + if (!isPointInSector(x2, y2, clipSector)) + return; + } + const { x, y } = arc.pointAt(start2 === inner ? arc.a0 : arc.a1); + const theta = clockwiseAngle(Math.atan2(y, x), startAngle); + const radialArc = inner ? innerArc : outerArc; + if (start2) { + radialArc?.clipStart(theta); + } else { + radialArc?.clipEnd(theta); + } + return arc; + } + updatePath() { + const delta4 = 1e-6; + const { path, centerX, centerY, concentricEdgeInset, radialEdgeInset } = this; + let { startOuterCornerRadius, endOuterCornerRadius, startInnerCornerRadius, endInnerCornerRadius } = this; + const { startAngle, endAngle } = clockwiseAngles(this.startAngle, this.endAngle); + const { innerRadius, outerRadius } = this.normalizedRadii(); + const clipSector = this.normalizedClipSector(); + const sweepAngle = endAngle - startAngle; + const fullPie = sweepAngle >= 2 * Math.PI - delta4; + path.clear(); + if (innerRadius === 0 && outerRadius === 0 || innerRadius > outerRadius) { + return; + } else if ((clipSector?.startAngle ?? startAngle) === (clipSector?.endAngle ?? endAngle)) { + return; + } else if (fullPie && this.clipSector == null && startOuterCornerRadius === 0 && endOuterCornerRadius === 0 && startInnerCornerRadius === 0 && endInnerCornerRadius === 0) { + path.moveTo(centerX + outerRadius * Math.cos(startAngle), centerY + outerRadius * Math.sin(startAngle)); + path.arc(centerX, centerY, outerRadius, startAngle, endAngle); + if (innerRadius > concentricEdgeInset) { + path.moveTo(centerX + innerRadius * Math.cos(endAngle), centerY + innerRadius * Math.sin(endAngle)); + path.arc(centerX, centerY, innerRadius, endAngle, startAngle, true); + } + path.closePath(); + return; + } else if (this.clipSector == null && Math.abs(innerRadius - outerRadius) < 1e-6) { + path.arc(centerX, centerY, outerRadius, startAngle, endAngle, false); + path.arc(centerX, centerY, outerRadius, endAngle, startAngle, true); + path.closePath(); + return; + } + const innerAngleOffset = this.getAngleOffset(innerRadius); + const outerAngleOffset = this.getAngleOffset(outerRadius); + const outerAngleExceeded = sweepAngle < 2 * outerAngleOffset; + if (outerAngleExceeded) + return; + const hasInnerSweep = (clipSector?.innerRadius ?? innerRadius) > concentricEdgeInset; + const innerAngleExceeded = innerRadius < concentricEdgeInset || sweepAngle < 2 * innerAngleOffset; + const radialLength = outerRadius - innerRadius; + const maxRadialLength = Math.max( + startOuterCornerRadius, + startInnerCornerRadius, + endOuterCornerRadius, + endInnerCornerRadius + ); + const initialScalingFactor = maxRadialLength > 0 ? Math.min(radialLength / maxRadialLength, 1) : 1; + startOuterCornerRadius *= initialScalingFactor; + endOuterCornerRadius *= initialScalingFactor; + startInnerCornerRadius *= initialScalingFactor; + endInnerCornerRadius *= initialScalingFactor; + const outerScalingFactor = radiiScalingFactor( + outerRadius, + sweepAngle - 2 * outerAngleOffset, + -startOuterCornerRadius, + -endOuterCornerRadius + ); + startOuterCornerRadius *= outerScalingFactor; + endOuterCornerRadius *= outerScalingFactor; + if (!innerAngleExceeded && hasInnerSweep) { + const innerScalingFactor = radiiScalingFactor( + innerRadius, + sweepAngle - 2 * innerAngleOffset, + startInnerCornerRadius, + endInnerCornerRadius + ); + startInnerCornerRadius *= innerScalingFactor; + endInnerCornerRadius *= innerScalingFactor; + } else { + startInnerCornerRadius = 0; + endInnerCornerRadius = 0; + } + const maxCombinedRadialLength = Math.max( + startOuterCornerRadius + startInnerCornerRadius, + endOuterCornerRadius + endInnerCornerRadius + ); + const edgesScalingFactor = maxCombinedRadialLength > 0 ? Math.min(radialLength / maxCombinedRadialLength, 1) : 1; + startOuterCornerRadius *= edgesScalingFactor; + endOuterCornerRadius *= edgesScalingFactor; + startInnerCornerRadius *= edgesScalingFactor; + endInnerCornerRadius *= edgesScalingFactor; + let startOuterCornerRadiusAngleSweep = 0; + let endOuterCornerRadiusAngleSweep = 0; + const startOuterCornerRadiusSweep = startOuterCornerRadius / (outerRadius - startOuterCornerRadius); + const endOuterCornerRadiusSweep = endOuterCornerRadius / (outerRadius - endOuterCornerRadius); + if (startOuterCornerRadiusSweep >= 0 && startOuterCornerRadiusSweep < 1 - delta4) { + startOuterCornerRadiusAngleSweep = Math.asin(startOuterCornerRadiusSweep); + } else { + startOuterCornerRadiusAngleSweep = sweepAngle / 2; + const maxStartOuterCornerRadius = outerRadius / (1 / Math.sin(startOuterCornerRadiusAngleSweep) + 1); + startOuterCornerRadius = Math.min(maxStartOuterCornerRadius, startOuterCornerRadius); + } + if (endOuterCornerRadiusSweep >= 0 && endOuterCornerRadiusSweep < 1 - delta4) { + endOuterCornerRadiusAngleSweep = Math.asin(endOuterCornerRadiusSweep); + } else { + endOuterCornerRadiusAngleSweep = sweepAngle / 2; + const maxEndOuterCornerRadius = outerRadius / (1 / Math.sin(endOuterCornerRadiusAngleSweep) + 1); + endOuterCornerRadius = Math.min(maxEndOuterCornerRadius, endOuterCornerRadius); + } + const startInnerCornerRadiusAngleSweep = Math.asin( + startInnerCornerRadius / (innerRadius + startInnerCornerRadius) + ); + const endInnerCornerRadiusAngleSweep = Math.asin(endInnerCornerRadius / (innerRadius + endInnerCornerRadius)); + const outerArcRadius = clipSector?.outerRadius ?? outerRadius; + const outerArcRadiusOffset = this.getAngleOffset(outerArcRadius); + const outerArc = new Arc( + 0, + 0, + outerArcRadius, + startAngle + outerArcRadiusOffset, + endAngle - outerArcRadiusOffset + ); + const innerArcRadius = clipSector?.innerRadius ?? innerRadius; + const innerArcRadiusOffset = this.getAngleOffset(innerArcRadius); + const innerArc = hasInnerSweep ? new Arc(0, 0, innerArcRadius, startAngle + innerArcRadiusOffset, endAngle - innerArcRadiusOffset) : void 0; + if (clipSector != null) { + outerArc.clipStart(clipSector.startAngle); + outerArc.clipEnd(clipSector.endAngle); + innerArc?.clipStart(clipSector.startAngle); + innerArc?.clipEnd(clipSector.endAngle); + } + const startOuterArc = this.arc( + startOuterCornerRadius, + startOuterCornerRadiusAngleSweep, + startAngle - Math.PI * 0.5, + startAngle + startOuterCornerRadiusAngleSweep, + outerArc, + innerArc, + true, + false + ); + const endOuterArc = this.arc( + endOuterCornerRadius, + endOuterCornerRadiusAngleSweep, + endAngle - endOuterCornerRadiusAngleSweep, + endAngle + Math.PI * 0.5, + outerArc, + innerArc, + false, + false + ); + const endInnerArc = this.arc( + endInnerCornerRadius, + endInnerCornerRadiusAngleSweep, + endAngle + Math.PI * 0.5, + endAngle + Math.PI - endInnerCornerRadiusAngleSweep, + outerArc, + innerArc, + false, + true + ); + const startInnerArc = this.arc( + startInnerCornerRadius, + startInnerCornerRadiusAngleSweep, + startAngle + Math.PI + startInnerCornerRadiusAngleSweep, + startAngle + Math.PI * 1.5, + outerArc, + innerArc, + true, + true + ); + if (innerAngleExceeded) { + const x = sweepAngle < Math.PI * 0.5 ? radialEdgeInset * (1 + Math.cos(sweepAngle)) / Math.sin(sweepAngle) : Number.NaN; + let r; + if (x > 0 && x < outerRadius) { + r = Math.max(Math.hypot(radialEdgeInset, x), innerRadius); + } else { + r = radialEdgeInset; + } + r = Math.max(r, innerRadius); + const midAngle = startAngle + sweepAngle * 0.5; + path.moveTo(centerX + r * Math.cos(midAngle), centerY + r * Math.sin(midAngle)); + } else if (startInnerArc?.isValid() === true || innerArc?.isValid() === true) { + } else { + const midAngle = startAngle + sweepAngle / 2; + const cx = innerRadius * Math.cos(midAngle); + const cy = innerRadius * Math.sin(midAngle); + path.moveTo(centerX + cx, centerY + cy); + } + if (startOuterArc?.isValid() === true) { + const { cx, cy, r, a0, a1 } = startOuterArc; + path.arc(centerX + cx, centerY + cy, r, a0, a1); + } + if (outerArc.isValid()) { + const { r, a0, a1 } = outerArc; + path.arc(centerX, centerY, r, a0, a1); + } + if (endOuterArc?.isValid() === true) { + const { cx, cy, r, a0, a1 } = endOuterArc; + path.arc(centerX + cx, centerY + cy, r, a0, a1); + } + if (!innerAngleExceeded) { + if (endInnerArc?.isValid() === true) { + const { cx, cy, r, a0, a1 } = endInnerArc; + path.arc(centerX + cx, centerY + cy, r, a0, a1); + } + if (innerArc?.isValid() === true) { + const { r, a0, a1 } = innerArc; + path.arc(centerX, centerY, r, a1, a0, true); + } + if (startInnerArc?.isValid() === true) { + const { cx, cy, r, a0, a1 } = startInnerArc; + path.arc(centerX + cx, centerY + cy, r, a0, a1); + } + } + path.closePath(); + } + isPointInPath(x, y) { + const { startAngle, endAngle, innerRadius, outerRadius } = this.clipSector ?? this; + return isPointInSector(x - this.centerX, y - this.centerY, { + startAngle, + endAngle, + innerRadius: Math.min(innerRadius, outerRadius), + outerRadius: Math.max(innerRadius, outerRadius) + }); + } +}; +Sector.className = "Sector"; +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "centerX", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "centerY", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "innerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "outerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "startAngle", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "endAngle", 2); +__decorateClass([ + SceneObjectChangeDetection({ equals: (lhs, rhs) => lhs.equals(rhs) }) +], Sector.prototype, "clipSector", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "concentricEdgeInset", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "radialEdgeInset", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "startOuterCornerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "endOuterCornerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "startInnerCornerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], Sector.prototype, "endInnerCornerRadius", 2); + +// packages/ag-charts-community/src/chart/series/polar/donutSeriesProperties.ts +var DonutTitle = class extends Caption { + constructor() { + super(...arguments); + this.showInLegend = false; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutTitle.prototype, "showInLegend", 2); +var DonutInnerLabel = class extends Label { + constructor() { + super(...arguments); + this.spacing = 2; + } + set(properties, _reset) { + return super.set(properties); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutInnerLabel.prototype, "text", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutInnerLabel.prototype, "spacing", 2); +var DonutInnerCircle = class extends BaseProperties { + constructor() { + super(...arguments); + this.fill = "transparent"; + this.fillOpacity = 1; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutInnerCircle.prototype, "fill", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutInnerCircle.prototype, "fillOpacity", 2); +var DonutSeriesCalloutLabel = class extends Label { + constructor() { + super(...arguments); + this.offset = 3; + this.minAngle = 0; + this.minSpacing = 4; + this.maxCollisionOffset = 50; + this.avoidCollisions = true; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesCalloutLabel.prototype, "offset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesCalloutLabel.prototype, "minAngle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesCalloutLabel.prototype, "minSpacing", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesCalloutLabel.prototype, "maxCollisionOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesCalloutLabel.prototype, "avoidCollisions", 2); +var DonutSeriesSectorLabel = class extends Label { + constructor() { + super(...arguments); + this.positionOffset = 0; + this.positionRatio = 0.5; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesSectorLabel.prototype, "positionOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesSectorLabel.prototype, "positionRatio", 2); +var DonutSeriesCalloutLine = class extends BaseProperties { + constructor() { + super(...arguments); + this.length = 10; + this.strokeWidth = 1; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesCalloutLine.prototype, "colors", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesCalloutLine.prototype, "length", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesCalloutLine.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesCalloutLine.prototype, "itemStyler", 2); +var DonutSeriesProperties = class extends SeriesProperties { + constructor() { + super(...arguments); + this.defaultColorRange = []; + this.defaultPatternFills = []; + this.fills = Object.values(DEFAULT_FILLS); + this.strokes = Object.values(DEFAULT_STROKES); + this.fillOpacity = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.outerRadiusOffset = 0; + this.outerRadiusRatio = 1; + this.strokeWidth = 1; + this.sectorSpacing = 0; + this.hideZeroValueSectorsInLegend = false; + this.innerLabels = new PropertiesArray(DonutInnerLabel); + this.title = new DonutTitle(); + this.innerCircle = new DonutInnerCircle(); + this.shadow = new DropShadow(); + this.calloutLabel = new DonutSeriesCalloutLabel(); + this.sectorLabel = new DonutSeriesSectorLabel(); + this.calloutLine = new DonutSeriesCalloutLine(); + this.tooltip = makeSeriesTooltip(); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "angleKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "angleName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "angleFilterKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "radiusKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "radiusName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "radiusMin", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "radiusMax", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "calloutLabelKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "calloutLabelName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "sectorLabelKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "sectorLabelName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "legendItemKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "defaultPatternFills", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "fills", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "strokes", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "lineDash", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "itemStyler", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "rotation", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "outerRadiusOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "outerRadiusRatio", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "innerRadiusOffset", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "innerRadiusRatio", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "sectorSpacing", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "hideZeroValueSectorsInLegend", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "innerLabels", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "title", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "innerCircle", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "shadow", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "calloutLabel", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "sectorLabel", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "calloutLine", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], DonutSeriesProperties.prototype, "tooltip", 2); + +// packages/ag-charts-community/src/chart/series/polar/pieUtil.ts +function preparePieSeriesAnimationFunctions(initialLoad, rotationDegrees, scaleFn, oldScaleFn) { + const scale2 = [scaleFn.convert(0), scaleFn.convert(1)]; + const oldScale = [oldScaleFn.convert(0), oldScaleFn.convert(1)]; + const rotation = Math.PI / -2 + toRadians(rotationDegrees); + const phase = initialLoad ? "initial" : "update"; + const scaleToNewRadius = ({ radius }) => { + return { innerRadius: scale2[0], outerRadius: scale2[0] + (scale2[1] - scale2[0]) * radius }; + }; + const scaleToOldRadius = ({ radius }) => { + return { innerRadius: oldScale[0], outerRadius: oldScale[0] + (oldScale[1] - oldScale[0]) * radius }; + }; + const fromFn = (sect, datum, status, { prevFromProps }) => { + let { startAngle, endAngle, innerRadius, outerRadius } = sect; + let { fill, stroke: stroke3 } = datum.sectorFormat; + if (status === "updated" && sect.previousDatum == null) { + status = "added"; + } + if (status === "unknown" || status === "added" && !prevFromProps) { + startAngle = rotation; + endAngle = rotation; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + } else if (status === "added" && prevFromProps) { + startAngle = prevFromProps.endAngle ?? rotation; + endAngle = prevFromProps.endAngle ?? rotation; + innerRadius = prevFromProps.innerRadius ?? datum.innerRadius; + outerRadius = prevFromProps.outerRadius ?? datum.outerRadius; + } + if (status === "added" && !initialLoad) { + const radii = scaleToOldRadius(datum); + innerRadius = radii.innerRadius; + outerRadius = radii.outerRadius; + } + if (status === "updated") { + fill = sect.fill ?? fill; + stroke3 = (typeof sect.stroke === "string" ? sect.stroke : void 0) ?? stroke3; + } + return { startAngle, endAngle, innerRadius, outerRadius, fill, stroke: stroke3, phase }; + }; + const toFn = (_sect, datum, status, { prevLive }) => { + let { startAngle, endAngle, innerRadius, outerRadius } = datum; + const { stroke: stroke3, fill } = datum.sectorFormat; + if (status === "removed" && prevLive) { + startAngle = prevLive.datum?.endAngle; + endAngle = prevLive.datum?.endAngle; + } else if (status === "removed" && !prevLive) { + startAngle = rotation; + endAngle = rotation; + } + if (status === "removed") { + const radii = scaleToNewRadius(datum); + innerRadius = radii.innerRadius; + outerRadius = radii.outerRadius; + } + return { startAngle, endAngle, outerRadius, innerRadius, stroke: stroke3, fill }; + }; + const innerCircleFromFn = (node, _) => { + return { size: node.previousDatum?.radius ?? node.size ?? 0, phase }; + }; + const innerCircleToFn = (_, datum) => { + return { size: datum.radius ?? 0 }; + }; + return { nodes: { toFn, fromFn }, innerCircle: { fromFn: innerCircleFromFn, toFn: innerCircleToFn } }; +} +function resetPieSelectionsFn(_node, datum) { + return { + startAngle: datum.startAngle, + endAngle: datum.endAngle, + innerRadius: datum.innerRadius, + outerRadius: datum.outerRadius, + stroke: datum.sectorFormat.stroke + }; +} +function pickByMatchingAngle(series, point) { + const dy2 = point.y - series.centerY; + const dx2 = point.x - series.centerX; + const angle2 = Math.atan2(dy2, dx2); + const sectors = series.getItemNodes(); + for (const sector of sectors) { + if (sector.datum.missing === true) + continue; + if (isBetweenAngles(angle2, sector.startAngle, sector.endAngle)) { + const radius = Math.hypot(dx2, dy2); + let distance2 = 0; + if (radius < sector.innerRadius) { + distance2 = sector.innerRadius - radius; + } else if (radius > sector.outerRadius) { + distance2 = radius - sector.outerRadius; + } + return { datum: sector.datum, distance: distance2 }; + } + } + return void 0; +} + +// packages/ag-charts-community/src/chart/series/polar/polarZIndexMap.ts +var PolarZIndexMap = /* @__PURE__ */ ((PolarZIndexMap3) => { + PolarZIndexMap3[PolarZIndexMap3["BACKGROUND"] = 0] = "BACKGROUND"; + PolarZIndexMap3[PolarZIndexMap3["FOREGROUND"] = 1] = "FOREGROUND"; + PolarZIndexMap3[PolarZIndexMap3["HIGHLIGHT"] = 2] = "HIGHLIGHT"; + PolarZIndexMap3[PolarZIndexMap3["LABEL"] = 3] = "LABEL"; + return PolarZIndexMap3; +})(PolarZIndexMap || {}); + +// packages/ag-charts-community/src/chart/series/polar/polarSeries.ts +var DEFAULT_POLAR_DIRECTION_KEYS = { + ["angle" /* Angle */]: ["angleKey"], + ["radius" /* Radius */]: ["radiusKey"] +}; +var DEFAULT_POLAR_DIRECTION_NAMES = { + ["angle" /* Angle */]: ["angleName"], + ["radius" /* Radius */]: ["radiusName"] +}; +var PolarSeries = class extends DataModelSeries { + constructor({ + categoryKey, + pickModes = [1 /* NEAREST_NODE */, 0 /* EXACT_SHAPE_MATCH */], + canHaveAxes = false, + animationResetFns, + ...opts + }) { + super({ + ...opts, + categoryKey, + pickModes, + canHaveAxes + }); + this.directions = ["angle" /* Angle */, "radius" /* Radius */]; + this.itemGroup = this.contentGroup.appendChild(new Group()); + this.nodeData = []; + this.itemSelection = Selection.select( + this.itemGroup, + () => this.nodeFactory(), + false + ); + this.labelSelection = Selection.select( + this.labelGroup, + () => this.labelFactory(), + false + ); + this.highlightSelection = Selection.select( + this.highlightGroup, + () => this.nodeFactory() + ); + /** + * The center of the polar series (for example, the center of a pie). + * If the polar chart has multiple series, all of them will have their + * center set to the same value as a result of the polar chart layout. + * The center coordinates are not supposed to be set by the user. + */ + this.centerX = 0; + this.centerY = 0; + /** + * The maximum radius the series can use. + * This value is set automatically as a result of the polar chart layout + * and is not supposed to be set by the user. + */ + this.radius = 0; + this.animationResetFns = animationResetFns; + this.animationState = new StateMachine( + "empty", + { + empty: { + update: { + target: "ready", + action: (data) => this.animateEmptyUpdateReady(data) + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + highlight: (data) => this.animateReadyHighlight(data), + highlightMarkers: (data) => this.animateReadyHighlightMarkers(data), + resize: (data) => this.animateReadyResize(data), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: (data) => this.animateWaitingUpdateReady(data) + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty", + action: (data) => this.animateClearingUpdateEmpty(data) + }, + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + } + getItemNodes() { + return [...this.itemGroup.children()]; + } + getNodeData() { + return this.nodeData; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [zIndex, 1 /* FOREGROUND */]; + this.highlightGroup.zIndex = [zIndex, 2 /* HIGHLIGHT */]; + this.labelGroup.zIndex = [zIndex, 3 /* LABEL */]; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + labelFactory() { + const text2 = new Text(); + text2.pointerEvents = 1 /* None */; + return text2; + } + addChartEventListeners() { + this.cleanup.register( + this.ctx.eventsHub.on("legend:item-click", (event) => this.onLegendItemClick(event)), + this.ctx.eventsHub.on("legend:item-double-click", (event) => this.onLegendItemDoubleClick(event)) + ); + } + getInnerRadius() { + return 0; + } + computeLabelsBBox(_options, _seriesRect) { + return null; + } + getShapeFillBBox() { + const outerRadius = this.radius; + return { + series: new BBox(-outerRadius, -outerRadius, outerRadius * 2, outerRadius * 2), + axis: new BBox(-outerRadius, -outerRadius, outerRadius * 2, outerRadius * 2) + }; + } + resetAllAnimation() { + const { item, label } = this.animationResetFns ?? {}; + this.ctx.animationManager.stopByAnimationGroupId(this.id); + if (item) { + resetMotion([this.itemSelection, this.highlightSelection], item); + } + if (label) { + resetMotion([this.labelSelection], label); + } + this.itemSelection.cleanup(); + this.labelSelection.cleanup(); + this.highlightSelection.cleanup(); + } + animateEmptyUpdateReady(_data) { + this.ctx.animationManager.skipCurrentBatch(); + this.resetAllAnimation(); + } + animateWaitingUpdateReady(_data) { + this.ctx.animationManager.skipCurrentBatch(); + this.resetAllAnimation(); + } + animateReadyHighlight(_data) { + const { item } = this.animationResetFns ?? {}; + if (item) { + resetMotion([this.highlightSelection], item); + } + } + animateReadyHighlightMarkers(_data) { + } + animateReadyResize(_data) { + this.resetAllAnimation(); + } + animateClearingUpdateEmpty(_data) { + this.ctx.animationManager.skipCurrentBatch(); + this.resetAllAnimation(); + } + computeFocusBounds(opts) { + const datum = this.getNodeData()?.[opts.datumIndex]; + if (datum !== void 0) { + return this.itemSelection.select((node) => node instanceof Path && node.datum === datum)[0]; + } + return void 0; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + isSeriesHighlighted(highlightedDatum, legendItemValues) { + const { series, legendItemName: activeLegendItemName, itemId } = highlightedDatum ?? {}; + const legendItemName = typeof itemId === "number" ? legendItemValues?.[itemId] : void 0; + return series === this || legendItemName != null && legendItemName === activeLegendItemName; + } +}; + +// packages/ag-charts-community/src/chart/series/polar/donutSeries.ts +var PieDonutSeriesNodeEvent = class extends SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + this.calloutLabelKey = series.properties.calloutLabelKey; + this.sectorLabelKey = series.properties.sectorLabelKey; + } +}; +var DonutSeries = class extends PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + ...DEFAULT_POLAR_DIRECTION_KEYS, + sectorLabel: ["sectorLabelKey"], + calloutLabel: ["calloutLabelKey"] + }, + propertyNames: { + ...DEFAULT_POLAR_DIRECTION_NAMES, + sectorLabel: ["sectorLabelName"], + calloutLabel: ["calloutLabelName"] + }, + pickModes: [1 /* NEAREST_NODE */, 0 /* EXACT_SHAPE_MATCH */], + animationResetFns: { item: resetPieSelectionsFn, label: resetLabelFn } + }); + this.properties = new DonutSeriesProperties(); + this.phantomNodeData = void 0; + this.backgroundGroup = new TranslatableGroup({ + name: `${this.id}-background`, + zIndex: 0 /* BACKGROUND */ + }); + this.noVisibleData = false; + this.previousRadiusScale = new LinearScale(); + this.radiusScale = new LinearScale(); + this.phantomGroup = this.backgroundGroup.appendChild(new Group({ name: "phantom" })); + this.phantomSelection = Selection.select( + this.phantomGroup, + () => this.nodeFactory(), + false + ); + this.calloutLabelGroup = this.contentGroup.appendChild(new Group({ name: "pieCalloutLabels" })); + this.calloutLabelSelection = new Selection( + this.calloutLabelGroup, + Group + ); + // AG-6193 If the sum of all datums is 0, then we'll draw 1 or 2 rings to represent the empty series. + this.zerosumRingsGroup = this.backgroundGroup.appendChild(new Group({ name: `${this.id}-zerosumRings` })); + this.zerosumOuterRing = this.zerosumRingsGroup.appendChild(new Marker({ shape: "circle" })); + this.zerosumInnerRing = this.zerosumRingsGroup.appendChild(new Marker({ shape: "circle" })); + this.innerLabelsGroup = this.contentGroup.appendChild(new Group({ name: "innerLabels" })); + this.innerCircleGroup = this.backgroundGroup.appendChild(new Group({ name: `${this.id}-innerCircle` })); + this.innerLabelsSelection = Selection.select(this.innerLabelsGroup, Text); + this.innerCircleSelection = Selection.select( + this.innerCircleGroup, + () => new Marker({ shape: "circle" }) + ); + this.surroundingRadius = void 0; + this.NodeEvent = PieDonutSeriesNodeEvent; + this.angleScale = new LinearScale(); + this.angleScale.domain = [0, 1]; + this.angleScale.range = [-Math.PI, Math.PI].map((angle2) => angle2 + Math.PI / 2); + this.phantomGroup.opacity = 0.2; + this.innerLabelsGroup.pointerEvents = 1 /* None */; + } + get calloutNodeData() { + return this.phantomNodeData ?? this.nodeData; + } + get hasData() { + return this.getHasData("angleValue"); + } + attachSeries(seriesContentNode, seriesNode, annotationNode) { + super.attachSeries(seriesContentNode, seriesNode, annotationNode); + seriesContentNode?.appendChild(this.backgroundGroup); + } + detachSeries(seriesContentNode, seriesNode, annotationNode) { + super.detachSeries(seriesContentNode, seriesNode, annotationNode); + this.backgroundGroup.remove(); + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.backgroundGroup.zIndex = [0 /* BACKGROUND */, zIndex]; + } + nodeFactory() { + const sector = new Sector(); + sector.miterLimit = 1e9; + return sector; + } + getSeriesDomain(direction) { + if (direction === "angle" /* Angle */) { + return this.angleScale.domain; + } else { + return this.radiusScale.domain; + } + } + async processData(dataController) { + if (this.data == null) + return; + const { + visible, + id: seriesId, + ctx: { legendManager } + } = this; + const { angleKey, angleFilterKey, radiusKey, calloutLabelKey, sectorLabelKey, legendItemKey } = this.properties; + const processor = () => (value, index) => { + if (visible && legendManager.getItemEnabled({ seriesId, itemId: index })) { + return value; + } + return 0; + }; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const extraKeyProps = []; + const extraProps = []; + if (legendItemKey) { + extraKeyProps.push(keyProperty(legendItemKey, "category", { id: `legendItemKey` })); + } else if (calloutLabelKey) { + extraKeyProps.push(keyProperty(calloutLabelKey, "category", { id: `calloutLabelKey` })); + } else if (sectorLabelKey) { + extraKeyProps.push(keyProperty(sectorLabelKey, "category", { id: `sectorLabelKey` })); + } + const radiusScaleType = this.radiusScale.type; + const angleScaleType = this.angleScale.type; + if (radiusKey) { + extraProps.push( + rangedValueProperty(radiusKey, { + id: "radiusValue", + min: this.properties.radiusMin ?? 0, + max: this.properties.radiusMax, + missingValue: this.properties.radiusMax ?? 1, + processor + }), + valueProperty(radiusKey, radiusScaleType, { id: `radiusRaw`, processor }), + // Raw value pass-through. + normalisePropertyTo("radiusValue", [0, 1], 1, this.properties.radiusMin ?? 0, this.properties.radiusMax) + ); + } + if (calloutLabelKey) { + extraProps.push(valueProperty(calloutLabelKey, "category", { id: `calloutLabelValue` })); + } + if (sectorLabelKey) { + extraProps.push(valueProperty(sectorLabelKey, "category", { id: `sectorLabelValue` })); + } + if (legendItemKey) { + extraProps.push(valueProperty(legendItemKey, "category", { id: `legendItemValue` })); + } + if (angleFilterKey) { + extraProps.push( + accumulativeValueProperty(angleFilterKey, angleScaleType, { + id: `angleFilterValue`, + onlyPositive: true, + invalidValue: 0, + processor + }), + valueProperty(angleFilterKey, angleScaleType, { id: `angleFilterRaw` }), + normalisePropertyTo("angleFilterValue", [0, 1], 0, 0) + ); + } + if (animationEnabled && this.processedData?.reduced?.animationValidation?.uniqueKeys && extraKeyProps.length > 0) { + extraProps.push(diff(this.id, this.processedData)); + } + extraProps.push(animationValidation()); + await this.requestDataModel(dataController, this.data, { + props: [ + ...extraKeyProps, + accumulativeValueProperty(angleKey, angleScaleType, { + id: `angleValue`, + onlyPositive: true, + invalidValue: 0, + processor + }), + valueProperty(angleKey, angleScaleType, { id: `angleRaw` }), + // Raw value pass-through. + normalisePropertyTo("angleValue", [0, 1], 0, 0), + ...extraProps + ] + }); + for (const valueDef of this.processedData?.defs?.values ?? []) { + const { id, missing, property } = valueDef; + const missCount = getMissCount(this, missing); + if (id !== "angleRaw" && missCount > 0) { + logger_exports.warnOnce( + `no value was found for the key '${String(property)}' on ${missCount} data element${missCount > 1 ? "s" : ""}` + ); + } + } + this.animationState.transition("updateData"); + } + maybeRefreshNodeData() { + if (!this.nodeDataRefresh) + return; + const { nodeData = [], phantomNodeData } = this.createNodeData() ?? {}; + this.nodeData = nodeData; + this.phantomNodeData = phantomNodeData; + this.nodeDataRefresh = false; + } + getProcessedDataValues(dataModel, processedData) { + const angleValues = dataModel.resolveColumnById(this, `angleValue`, processedData); + const angleRawValues = dataModel.resolveColumnById(this, `angleRaw`, processedData); + const angleFilterValues = this.properties.angleFilterKey == null ? void 0 : dataModel.resolveColumnById(this, `angleFilterValue`, processedData); + const angleFilterRawValues = this.properties.angleFilterKey == null ? void 0 : dataModel.resolveColumnById(this, `angleFilterRaw`, processedData); + const radiusValues = this.properties.radiusKey ? dataModel.resolveColumnById(this, `radiusValue`, processedData) : void 0; + const radiusRawValues = this.properties.radiusKey ? dataModel.resolveColumnById(this, `radiusRaw`, processedData) : void 0; + const calloutLabelValues = this.properties.calloutLabelKey ? dataModel.resolveColumnById(this, `calloutLabelValue`, processedData) : void 0; + const sectorLabelValues = this.properties.sectorLabelKey ? dataModel.resolveColumnById(this, `sectorLabelValue`, processedData) : void 0; + const legendItemValues = this.properties.legendItemKey ? dataModel.resolveColumnById(this, `legendItemValue`, processedData) : void 0; + return { + angleValues, + angleRawValues, + angleFilterValues, + angleFilterRawValues, + radiusValues, + radiusRawValues, + calloutLabelValues, + sectorLabelValues, + legendItemValues + }; + } + createNodeData() { + const { + id: seriesId, + processedData, + dataModel, + angleScale, + ctx: { legendManager }, + visible + } = this; + const { rotation, innerRadiusRatio } = this.properties; + if (!dataModel || processedData?.type !== "ungrouped") + return; + const processedDataValues = this.getProcessedDataValues(dataModel, processedData); + const { + angleValues, + angleRawValues, + angleFilterValues, + angleFilterRawValues, + radiusValues, + radiusRawValues, + legendItemValues + } = processedDataValues; + const useFilterAngles = angleFilterRawValues?.some((filterRawValue, index) => { + return filterRawValue > angleRawValues[index]; + }) ?? false; + let currentStart = 0; + let sum2 = 0; + const nodes = []; + const phantomNodes = angleFilterRawValues == null ? void 0 : []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const invalidData = processedData.invalidData?.get(this.id); + for (const [datumIndex, datum] of rawData.entries()) { + if (invalidData?.[datumIndex] === true) + continue; + const currentValue = useFilterAngles ? angleFilterValues[datumIndex] : angleValues[datumIndex]; + const crossFilterScale = angleFilterRawValues != null && !useFilterAngles ? Math.sqrt(angleFilterRawValues[datumIndex] / angleRawValues[datumIndex]) : 1; + const startAngle = angleScale.convert(currentStart) + toRadians(rotation); + currentStart = currentValue; + sum2 += currentValue; + const endAngle = angleScale.convert(currentStart) + toRadians(rotation); + const span = Math.abs(endAngle - startAngle); + const midAngle = startAngle + span / 2; + const angleValue = angleRawValues[datumIndex]; + const radiusRaw = radiusValues?.[datumIndex] ?? 1; + const radius = radiusRaw * crossFilterScale; + const radiusValue = radiusRawValues?.[datumIndex]; + const legendItemValue = legendItemValues?.[datumIndex]; + const nodeLabels = this.getLabels(datumIndex, datum, midAngle, span, processedDataValues); + const sectorFormat = this.getItemStyle({ datum, datumIndex }, false); + const node = { + itemId: datumIndex, + series: this, + datum, + datumIndex, + angleValue, + midAngle, + midCos: Math.cos(midAngle), + midSin: Math.sin(midAngle), + startAngle, + endAngle, + radius, + innerRadius: Math.max(this.radiusScale.convert(0), 0), + outerRadius: Math.max(this.radiusScale.convert(radius), 0), + sectorFormat, + radiusValue, + legendItemValue, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + focusable: true, + ...nodeLabels + }; + nodes.push(node); + if (phantomNodes != null) { + phantomNodes.push({ + ...node, + radius: 1, + innerRadius: Math.max(this.radiusScale.convert(0), 0), + outerRadius: Math.max(this.radiusScale.convert(1), 0), + focusable: false + }); + } + } + this.zerosumOuterRing.visible = sum2 === 0; + this.zerosumInnerRing.visible = sum2 === 0 && innerRadiusRatio != null && innerRadiusRatio !== 1 && innerRadiusRatio > 0; + return { + itemId: seriesId, + nodeData: nodes, + labelData: nodes, + phantomNodeData: phantomNodes + }; + } + getLabelContent(datumIndex, datum, values) { + const { id: seriesId, ctx, properties } = this; + const { formatManager } = ctx; + const { calloutLabel, sectorLabel, calloutLabelKey, sectorLabelKey, legendItemKey } = properties; + const calloutLabelValue = values.calloutLabelValues?.[datumIndex]; + const sectorLabelValue = values.sectorLabelValues?.[datumIndex]; + const legendItemValue = values.legendItemValues?.[datumIndex]; + const labelFormatterParams = { + datum, + angleKey: this.properties.angleKey, + angleName: this.properties.angleName, + radiusKey: this.properties.radiusKey, + radiusName: this.properties.radiusName, + calloutLabelKey: this.properties.calloutLabelKey, + calloutLabelName: this.properties.calloutLabelName, + sectorLabelKey: this.properties.sectorLabelKey, + sectorLabelName: this.properties.sectorLabelName, + legendItemKey: this.properties.legendItemKey + }; + const result = { + callout: void 0, + sector: void 0, + legendItem: void 0 + }; + if (calloutLabelKey) { + result.callout = this.getLabelText( + calloutLabelValue, + datum, + calloutLabelKey, + "calloutLabel", + [], + calloutLabel, + { ...labelFormatterParams, value: calloutLabelValue } + ); + } + if (sectorLabelKey) { + result.sector = this.getLabelText( + sectorLabelValue, + datum, + sectorLabelKey, + "sectorLabel", + [], + sectorLabel, + { ...labelFormatterParams, value: sectorLabelValue } + ); + } + if (legendItemKey != null && legendItemValue != null) { + result.legendItem = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: legendItemValue, + datum, + seriesId, + legendItemName: void 0, + key: legendItemKey, + source: "legend-label", + property: "legendItem", + domain: [], + boundSeries: this.getFormatterContext("legendItem") + }) ?? legendItemValue; + } + return result; + } + getLabels(datumIndex, datum, midAngle, span, values) { + const { properties } = this; + const { calloutLabel, sectorLabel, legendItemKey } = properties; + const formats = this.getLabelContent(datumIndex, datum, values); + const result = {}; + if (calloutLabel.enabled && formats.callout && span >= toRadians(calloutLabel.minAngle)) { + result.calloutLabel = { + ...this.getTextAlignment(midAngle), + text: formats.callout, + hidden: false, + collisionTextAlign: void 0, + collisionOffsetY: 0, + box: void 0 + }; + } + if (sectorLabel.enabled && formats.sector) { + result.sectorLabel = { text: formats.sector }; + } + if (legendItemKey && formats.legendItem) { + result.legendItem = { key: legendItemKey, text: formats.legendItem }; + } + return result; + } + getTextAlignment(midAngle) { + const quadrantTextOpts = [ + { textAlign: "center", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "middle" }, + { textAlign: "center", textBaseline: "top" }, + { textAlign: "right", textBaseline: "middle" } + ]; + const midAngle180 = normalizeAngle180(midAngle); + const quadrantStart = -0.75 * Math.PI; + const quadrantOffset = midAngle180 - quadrantStart; + const quadrant = Math.floor(quadrantOffset / (Math.PI / 2)); + const quadrantIndex = modulus(quadrant, quadrantTextOpts.length); + return quadrantTextOpts[quadrantIndex]; + } + getFillParams(fill, innerRadius, outerRadius) { + if (!isGradientFill(fill) || fill.bounds === "item") + return; + return { + centerX: 0, + centerY: 0, + innerRadius, + outerRadius + }; + } + getItemStyle({ datum, datumIndex }, isHighlight, highlightState, legendItemValues) { + const { fills, strokes, itemStyler } = this.properties; + const defaultStroke = strokes[datumIndex]; + const defaultFill = fills[datumIndex]; + const { + fill, + fillOpacity, + stroke: stroke3, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity + } = mergeDefaults( + this.getHighlightStyle(isHighlight, datumIndex, highlightState, legendItemValues), + { fill: defaultFill, stroke: defaultStroke }, + this.properties + ); + let overrides; + if (itemStyler) { + overrides = this.cachedDatumCallback( + this.getDatumId(datumIndex) + (isHighlight ? "-highlight" : "-hide"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, { + fill, + fillOpacity, + stroke: stroke3, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius + }); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params), + { proxyPaths: { fill: ["fills", `${datumIndex}`], stroke: ["strokes", `${datumIndex}`] } } + ); + } + ); + } + return { + fill: overrides?.fill ?? fill, + fillOpacity: overrides?.fillOpacity ?? fillOpacity, + stroke: overrides?.stroke ?? stroke3, + strokeWidth: overrides?.strokeWidth ?? strokeWidth, + strokeOpacity: overrides?.strokeOpacity ?? strokeOpacity, + lineDash: overrides?.lineDash ?? lineDash, + lineDashOffset: overrides?.lineDashOffset ?? lineDashOffset, + cornerRadius: overrides?.cornerRadius ?? cornerRadius, + opacity + }; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style2) { + const { angleKey, radiusKey, calloutLabelKey, sectorLabelKey, legendItemKey } = this.properties; + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + datum, + angleKey, + radiusKey, + calloutLabelKey, + sectorLabelKey, + legendItemKey, + ...style2, + fill, + highlighted: isHighlight, + highlightState: this.getHighlightStateString( + this.ctx.highlightManager?.getActiveHighlight(), + isHighlight, + datumIndex + ), + seriesId: this.id + }; + } + getCalloutLineStyle(nodeDatum, highlighted) { + const { properties } = this; + let itemStylerResult = {}; + if (properties.calloutLine.itemStyler) { + const highlightState = this.getHighlightStateString( + this.ctx.highlightManager?.getActiveHighlight(), + highlighted, + nodeDatum.datumIndex + ); + const params = { + angleKey: properties.angleKey, + angleName: properties.angleName ?? properties.angleKey, + calloutLabelKey: properties.calloutLabelKey, + calloutLabelName: properties.calloutLabelName ?? properties.calloutLabelKey, + datum: nodeDatum.datum, + highlighted, + highlightState, + legendItemKey: properties.legendItemKey, + radiusKey: properties.radiusKey, + radiusName: properties.radiusName ?? properties.radiusKey, + sectorLabelKey: properties.sectorLabelKey, + sectorLabelName: properties.sectorLabelName ?? properties.sectorLabelKey, + seriesId: this.id + }; + itemStylerResult = this.cachedCallWithContext(properties.calloutLine.itemStyler, params) ?? {}; + } + return { + length: itemStylerResult.length ?? properties.calloutLine.length, + strokeWidth: itemStylerResult.strokeWidth ?? properties.calloutLine.strokeWidth, + color: itemStylerResult.color, + colors: properties.calloutLine.colors + }; + } + getInnerRadius() { + const { radius } = this; + const { innerRadiusRatio = 1, innerRadiusOffset = 0 } = this.properties; + const innerRadius = radius * innerRadiusRatio + innerRadiusOffset; + if (innerRadius === radius || innerRadius < 0) { + return 0; + } + return innerRadius; + } + getOuterRadius() { + const { outerRadiusRatio, outerRadiusOffset } = this.properties; + return Math.max(this.radius * outerRadiusRatio + outerRadiusOffset, 0); + } + updateRadiusScale(resize) { + const newRange = [this.getInnerRadius(), this.getOuterRadius()]; + this.radiusScale.range = newRange; + if (resize) { + this.previousRadiusScale.range = newRange; + } + const setRadii = (d) => ({ + ...d, + innerRadius: Math.max(this.radiusScale.convert(0), 0), + outerRadius: Math.max(this.radiusScale.convert(d.radius), 0) + }); + this.nodeData = this.nodeData.map(setRadii); + this.phantomNodeData = this.phantomNodeData?.map(setRadii); + } + getTitleTranslationY() { + const outerRadius = Math.max(0, this.radiusScale.range[1]); + if (outerRadius === 0) { + return Number.NaN; + } + const spacing = this.properties.title?.spacing ?? 0; + const titleOffset = 2 + spacing; + const dy2 = Math.max(0, -outerRadius); + return -outerRadius - titleOffset - dy2; + } + update({ seriesRect }) { + const { title } = this.properties; + const newNodeDataDependencies = { + seriesRectWidth: seriesRect?.width, + seriesRectHeight: seriesRect?.height + }; + const resize = jsonDiff(this.nodeDataDependencies, newNodeDataDependencies) != null; + if (resize) { + this._nodeDataDependencies = newNodeDataDependencies; + } + this.maybeRefreshNodeData(); + this.updateTitleNodes(); + this.updateRadiusScale(resize); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + this.backgroundGroup.translationX = this.centerX; + this.backgroundGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + if (title) { + const dy2 = this.getTitleTranslationY(); + title.node.y = Number.isFinite(dy2) ? dy2 : 0; + const titleBox = title.node.getBBox(); + title.node.visible = title.enabled && Number.isFinite(dy2) && !this.bboxIntersectsSurroundingSeries(titleBox); + } + for (const circle of [this.zerosumInnerRing, this.zerosumOuterRing]) { + circle.fillOpacity = 0; + circle.stroke = this.properties.calloutLabel.color; + circle.strokeWidth = 1; + circle.strokeOpacity = 1; + } + this.updateNodeMidPoint(); + this.updateSelections(); + this.updateNodes(seriesRect); + } + updateTitleNodes() { + const { oldTitle } = this; + const { title } = this.properties; + if (oldTitle !== title) { + if (oldTitle) { + oldTitle.node.remove(); + } + if (title) { + title.node.textBaseline = "bottom"; + this.labelGroup?.appendChild(title.node); + } + this.oldTitle = title; + } + } + updateNodeMidPoint() { + const setMidPoint = (d) => { + const radius = d.innerRadius + (d.outerRadius - d.innerRadius) / 2; + d.midPoint = { + x: d.midCos * Math.max(0, radius), + y: d.midSin * Math.max(0, radius) + }; + }; + for (const datum of this.nodeData) { + setMidPoint(datum); + } + if (this.phantomNodeData) { + for (const datum of this.phantomNodeData) { + setMidPoint(datum); + } + } + } + updateSelections() { + this.updateGroupSelection(); + this.updateInnerCircleSelection(); + } + updateGroupSelection() { + const { + itemSelection, + highlightSelection, + phantomSelection, + calloutLabelSelection, + labelSelection, + innerLabelsSelection + } = this; + const highlightedNodeData = this.nodeData.map((datum) => ({ + ...datum, + // Allow mutable sectorFormat, so formatted sector styles can be updated and varied + // between normal and highlighted cases. + sectorFormat: { ...datum.sectorFormat } + })); + const update = (selection, nodeData) => { + selection.update(nodeData, void 0, (datum) => this.getDatumId(datum.datumIndex)); + if (this.ctx.animationManager.isSkipped()) { + selection.cleanup(); + } + }; + update(itemSelection, this.nodeData); + update(highlightSelection, highlightedNodeData); + update(phantomSelection, this.phantomNodeData ?? []); + calloutLabelSelection.update(this.calloutNodeData, (group) => { + const line = new Line(); + line.tag = 0 /* CalloutLine */; + line.pointerEvents = 1 /* None */; + group.appendChild(line); + const text2 = new Text(); + text2.tag = 1 /* CalloutLabel */; + text2.pointerEvents = 1 /* None */; + group.appendChild(text2); + }); + labelSelection.update(this.nodeData); + innerLabelsSelection.update(this.properties.innerLabels, (node) => { + node.pointerEvents = 1 /* None */; + }); + } + updateInnerCircleSelection() { + const { innerCircle } = this.properties; + let radius = 0; + const innerRadius = this.getInnerRadius(); + if (innerRadius > 0) { + const circleRadius = Math.min(innerRadius, this.getOuterRadius()); + const antiAliasingPadding = 1; + radius = Math.ceil(circleRadius * 2 + antiAliasingPadding); + } + const datums = innerCircle ? [{ radius }] : []; + this.innerCircleSelection.update(datums); + } + updateNodes(seriesRect) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { visible, dataModel, processedData } = this; + this.backgroundGroup.visible = visible; + this.contentGroup.visible = visible; + if (!dataModel || !processedData) + return; + const { legendItemValues } = this.getProcessedDataValues(dataModel, processedData); + const seriesHighlighted = this.isSeriesHighlighted(highlightedDatum, legendItemValues); + const drawingMode = this.ctx.chartService.highlight?.drawingMode ?? "overlay"; + this.highlightGroup.visible = visible && seriesHighlighted; + this.labelGroup.visible = visible; + this.innerCircleSelection.each((node, { radius }) => { + node.setProperties({ + fill: this.properties.innerCircle?.fill, + opacity: this.properties.innerCircle?.fillOpacity, + size: radius + }); + }); + const innerRadius = this.radiusScale.range[0]; + const outerRadius = this.radiusScale.range[1]; + const fillBBox = this.getShapeFillBBox(); + const animationDisabled = this.ctx.animationManager.isSkipped(); + const updateSectorFn = (sector, datum, _index, isDatumHighlighted, mode) => { + const format = this.getItemStyle(datum, isDatumHighlighted, void 0, legendItemValues); + datum.sectorFormat.fill = format.fill; + datum.sectorFormat.stroke = format.stroke; + if (animationDisabled) { + sector.startAngle = datum.startAngle; + sector.endAngle = datum.endAngle; + sector.innerRadius = datum.innerRadius; + sector.outerRadius = datum.outerRadius; + } + if (isDatumHighlighted || animationDisabled) { + sector.fill = format.fill; + sector.stroke = format.stroke; + } + const fillParams = this.getFillParams(format.fill, innerRadius, outerRadius); + applyShapeStyle(sector, format, fillBBox, fillParams); + sector.drawingMode = mode; + sector.cornerRadius = format.cornerRadius; + sector.fillShadow = this.properties.shadow; + const inset = Math.max( + (this.properties.sectorSpacing + (format.stroke == null ? 0 : format.strokeWidth)) / 2, + 0 + ); + sector.inset = inset; + sector.lineJoin = this.properties.sectorSpacing >= 0 || inset > 0 ? "miter" : "round"; + }; + this.itemSelection.each((node, datum, index) => updateSectorFn(node, datum, index, false, "overlay")); + this.phantomSelection.each((node, datum, index) => updateSectorFn(node, datum, index, false, "overlay")); + this.highlightSelection.each((node, datum, index) => { + updateSectorFn(node, datum, index, true, drawingMode); + node.visible = datum.itemId === highlightedDatum?.itemId; + }); + this.updateCalloutLineNodes(); + this.updateCalloutLabelNodes(seriesRect); + this.updateSectorLabelNodes(); + this.updateInnerLabelNodes(); + this.updateZerosumRings(); + this.animationState.transition("update"); + } + updateCalloutLineNodes() { + const { strokes } = this.properties; + const { offset } = this.properties.calloutLabel; + for (const line of this.calloutLabelSelection.selectByTag(0 /* CalloutLine */)) { + const datum = line.closestDatum(); + const { length: calloutLength, strokeWidth, color: color2, colors } = this.getCalloutLineStyle(datum, false); + const calloutStrokeWidth = strokeWidth; + const calloutColors = isStringFillArray(colors) ? colors : strokes; + const { calloutLabel: label, outerRadius, datumIndex } = datum; + if (label?.text && !label.hidden && outerRadius !== 0) { + line.visible = true; + line.strokeWidth = calloutStrokeWidth; + line.stroke = color2 ?? calloutColors[datumIndex % calloutColors.length]; + line.strokeOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + line.fill = void 0; + const x1 = datum.midCos * outerRadius; + const y1 = datum.midSin * outerRadius; + let x2 = datum.midCos * (outerRadius + calloutLength); + let y2 = datum.midSin * (outerRadius + calloutLength); + const isMoved = label.collisionTextAlign ?? label.collisionOffsetY !== 0; + if (isMoved && label.box != null) { + const box = label.box; + let cx = x2; + let cy = y2; + if (x2 < box.x) { + cx = box.x; + } else if (x2 > box.x + box.width) { + cx = box.x + box.width; + } + if (y2 < box.y) { + cy = box.y; + } else if (y2 > box.y + box.height) { + cy = box.y + box.height; + } + const dx2 = cx - x2; + const dy2 = cy - y2; + const length2 = Math.sqrt(Math.pow(dx2, 2) + Math.pow(dy2, 2)); + const paddedLength = length2 - offset; + if (paddedLength > 0) { + x2 = x2 + dx2 * paddedLength / length2; + y2 = y2 + dy2 * paddedLength / length2; + } + } + line.x1 = x1; + line.y1 = y1; + line.x2 = x2; + line.y2 = y2; + } else { + line.visible = false; + } + } + } + getLabelOverflow(box, seriesRect) { + const seriesLeft = -this.centerX; + const seriesRight = seriesLeft + seriesRect.width; + const seriesTop = -this.centerY; + const seriesBottom = seriesTop + seriesRect.height; + const errPx = 1; + let maxWidth = box.width; + if (box.x + errPx < seriesLeft) { + maxWidth = (box.x + box.width - seriesLeft) / box.width; + } else if (box.x + box.width - errPx > seriesRight) { + maxWidth = (seriesRight - box.x) / box.width; + } + const hasVerticalOverflow = box.y + errPx < seriesTop || box.y + box.height - errPx > seriesBottom; + const hasSurroundingSeriesOverflow = this.bboxIntersectsSurroundingSeries(box); + return { maxWidth, hasVerticalOverflow, hasSurroundingSeriesOverflow }; + } + bboxIntersectsSurroundingSeries(box) { + const { surroundingRadius } = this; + if (surroundingRadius == null) { + return false; + } + const corners = [ + { x: box.x, y: box.y }, + { x: box.x + box.width, y: box.y }, + { x: box.x + box.width, y: box.y + box.height }, + { x: box.x, y: box.y + box.height } + ]; + const sur2 = surroundingRadius ** 2; + return corners.some((corner) => corner.x ** 2 + corner.y ** 2 > sur2); + } + computeCalloutLabelCollisionOffsets() { + const { radiusScale } = this; + const { calloutLabel } = this.properties; + const { offset, minSpacing } = calloutLabel; + const innerRadius = radiusScale.convert(0); + const shouldSkip = (datum) => { + const label = datum.calloutLabel; + return !label || datum.outerRadius === 0; + }; + const fullData = this.calloutNodeData; + const data = fullData.filter((t) => !shouldSkip(t)); + for (const datum of data) { + const label = datum.calloutLabel; + if (label == null) + continue; + label.hidden = false; + label.collisionTextAlign = void 0; + label.collisionOffsetY = 0; + } + if (data.length <= 1) { + return; + } + const leftLabels = data.filter((d) => d.midCos < 0).sort((a, b) => a.midSin - b.midSin); + const rightLabels = data.filter((d) => d.midCos >= 0).sort((a, b) => a.midSin - b.midSin); + const topLabels = data.filter((d) => d.midSin < 0 && d.calloutLabel?.textAlign === "center").sort((a, b) => a.midCos - b.midCos); + const bottomLabels = data.filter((d) => d.midSin >= 0 && d.calloutLabel?.textAlign === "center").sort((a, b) => a.midCos - b.midCos); + const getTextBBox = (datum) => { + const label = datum.calloutLabel; + if (label == null) + return BBox.zero.clone(); + const style2 = this.getLabelStyle(datum, calloutLabel); + const padding2 = expandLabelPadding(style2); + const calloutLength = this.getCalloutLineStyle(datum, false).length; + const labelRadius = datum.outerRadius + calloutLength + offset; + const x = datum.midCos * labelRadius; + const y = datum.midSin * labelRadius + label.collisionOffsetY; + const textAlign = label.collisionTextAlign ?? label.textAlign; + const textBaseline = label.textBaseline; + return Text.measureBBox(label.text, x, y, { + font: this.properties.calloutLabel, + textAlign, + textBaseline + }).grow(padding2); + }; + const avoidNeighbourYCollision = (label, next, direction) => { + const box = getTextBBox(label).grow(minSpacing / 2); + const other = getTextBBox(next).grow(minSpacing / 2); + const collidesOrBehind = box.x < other.x + other.width && box.x + box.width > other.x && (direction === "to-top" ? box.y < other.y + other.height : box.y + box.height > other.y); + if (collidesOrBehind) { + next.calloutLabel.collisionOffsetY = direction === "to-top" ? box.y - other.y - other.height : box.y + box.height - other.y; + } + }; + const avoidYCollisions = (labels) => { + const midLabel = labels.slice().sort((a, b) => Math.abs(a.midSin) - Math.abs(b.midSin))[0]; + const midIndex = labels.indexOf(midLabel); + for (let i = midIndex - 1; i >= 0; i--) { + const prev = labels[i + 1]; + const next = labels[i]; + avoidNeighbourYCollision(prev, next, "to-top"); + } + for (let i = midIndex + 1; i < labels.length; i++) { + const prev = labels[i - 1]; + const next = labels[i]; + avoidNeighbourYCollision(prev, next, "to-bottom"); + } + }; + const avoidXCollisions = (labels) => { + const labelsCollideLabelsByY = data.some((datum) => datum.calloutLabel.collisionOffsetY !== 0); + const boxes = labels.map((label) => getTextBBox(label)); + const paddedBoxes = boxes.map((box) => box.clone().grow(minSpacing / 2)); + let labelsCollideLabelsByX = false; + for (let i = 0; i < paddedBoxes.length && !labelsCollideLabelsByX; i++) { + const box = paddedBoxes[i]; + for (let j = i + 1; j < labels.length; j++) { + const other = paddedBoxes[j]; + if (box.collidesBBox(other)) { + labelsCollideLabelsByX = true; + break; + } + } + } + const sectors = fullData.map((datum) => { + const { startAngle, endAngle, outerRadius } = datum; + return { startAngle, endAngle, innerRadius, outerRadius }; + }); + const labelsCollideSectors = boxes.some((box) => sectors.some((sector) => boxCollidesSector(box, sector))); + if (!labelsCollideLabelsByX && !labelsCollideLabelsByY && !labelsCollideSectors) + return; + for (const d of labels) { + if (d.calloutLabel.textAlign !== "center") + continue; + const label = d.calloutLabel; + if (d.midCos < 0) { + label.collisionTextAlign = "right"; + } else if (d.midCos > 0) { + label.collisionTextAlign = "left"; + } else { + label.collisionTextAlign = "center"; + } + } + }; + avoidYCollisions(leftLabels); + avoidYCollisions(rightLabels); + avoidXCollisions(topLabels); + avoidXCollisions(bottomLabels); + } + getLabelStyle(datum, label) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const isHighlight = false; + return getLabelStyles(this, datum, this.properties, label, isHighlight, activeHighlight); + } + updateCalloutLabelNodes(seriesRect) { + const { radiusScale } = this; + const { calloutLabel } = this.properties; + const tempTextNode = new Text(); + for (const text2 of this.calloutLabelSelection.selectByTag(1 /* CalloutLabel */)) { + const datum = text2.closestDatum(); + const label = datum.calloutLabel; + const radius = radiusScale.convert(datum.radius); + const outerRadius = Math.max(0, radius); + if (!label?.text || outerRadius === 0 || label.hidden) { + text2.visible = false; + continue; + } + const style2 = this.getLabelStyle(datum, calloutLabel); + const calloutLength = this.getCalloutLineStyle(datum, false).length; + const labelRadius = outerRadius + calloutLength + calloutLabel.offset; + const x = datum.midCos * labelRadius; + const y = datum.midSin * labelRadius + label.collisionOffsetY; + const align2 = { + textAlign: label.collisionTextAlign ?? label.textAlign, + textBaseline: label.textBaseline + }; + tempTextNode.text = label.text; + tempTextNode.x = x; + tempTextNode.y = y; + tempTextNode.setFont(style2); + tempTextNode.setAlign(align2); + tempTextNode.setBoxing(style2); + const box = tempTextNode.getBBox(); + let displayText = label.text; + let visible = true; + if (calloutLabel.avoidCollisions) { + const { maxWidth, hasVerticalOverflow } = this.getLabelOverflow(box, seriesRect); + if (box.width > maxWidth) { + const options = { + font: this.properties.calloutLabel, + textWrap: "on-space", + overflow: "hide", + maxWidth + }; + displayText = wrapTextOrSegments(label.text, options); + } + visible = !hasVerticalOverflow; + } + text2.text = displayText; + text2.x = x; + text2.y = y; + text2.setFont(style2); + text2.setAlign(align2); + text2.setBoxing(style2); + text2.fill = style2.color; + text2.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + text2.visible = visible; + } + } + computeLabelsBBox(options, seriesRect) { + const { calloutLabel } = this.properties; + const { offset, maxCollisionOffset, minSpacing } = calloutLabel; + if (!calloutLabel.avoidCollisions) { + return null; + } + this.maybeRefreshNodeData(); + this.updateRadiusScale(false); + this.computeCalloutLabelCollisionOffsets(); + const textBoxes = []; + const text2 = new Text(); + let titleBox = void 0; + const { title } = this.properties; + if (title?.text && title.enabled) { + const dy2 = this.getTitleTranslationY(); + if (Number.isFinite(dy2)) { + text2.text = title.text; + text2.x = 0; + text2.y = dy2; + text2.setFont(title); + text2.setAlign({ + textBaseline: "bottom", + textAlign: "center" + }); + titleBox = text2.getBBox(); + textBoxes.push(titleBox); + } + } + for (const datum of this.calloutNodeData) { + const label = datum.calloutLabel; + if (!label || datum.outerRadius === 0) { + continue; + } + const style2 = this.getLabelStyle(datum, calloutLabel); + const calloutLength = this.getCalloutLineStyle(datum, false).length; + const labelRadius = datum.outerRadius + calloutLength + offset; + const x = datum.midCos * labelRadius; + const y = datum.midSin * labelRadius + label.collisionOffsetY; + text2.text = label.text; + text2.x = x; + text2.y = y; + text2.setFont(style2); + text2.setAlign({ + textAlign: label.collisionTextAlign ?? label.textAlign, + textBaseline: label.textBaseline + }); + text2.setBoxing(style2); + const box = text2.getBBox(); + label.box = box; + if (Math.abs(label.collisionOffsetY) > maxCollisionOffset) { + label.hidden = true; + continue; + } + if (titleBox) { + const seriesTop = -this.centerY; + const titleCleanArea = new BBox( + titleBox.x - minSpacing, + seriesTop, + titleBox.width + 2 * minSpacing, + titleBox.y + titleBox.height + minSpacing - seriesTop + ); + if (box.collidesBBox(titleCleanArea)) { + label.hidden = true; + continue; + } + } + if (options.hideWhenNecessary) { + const { maxWidth, hasVerticalOverflow, hasSurroundingSeriesOverflow } = this.getLabelOverflow( + box, + seriesRect + ); + const isTooShort = box.width > maxWidth; + if (hasVerticalOverflow || isTooShort || hasSurroundingSeriesOverflow) { + label.hidden = true; + continue; + } + } + label.hidden = false; + textBoxes.push(box); + } + if (textBoxes.length === 0) { + return null; + } + return BBox.merge(textBoxes); + } + updateSectorLabelNodes() { + const { properties } = this; + const { positionOffset, positionRatio } = this.properties.sectorLabel; + const innerRadius = this.radiusScale.convert(0); + const shouldPutTextInCenter = innerRadius <= 0 && // is donut? + this.ctx.legendManager.getData(this.id)?.filter((d) => d.enabled).length === 1; + const align2 = { textAlign: "center", textBaseline: "middle" }; + const updateSectorLabel = (text2, datum) => { + const { outerRadius, startAngle, endAngle } = datum; + let isTextVisible = false; + if (datum.sectorLabel && outerRadius !== 0) { + const style2 = this.getLabelStyle(datum, properties.sectorLabel); + const labelRadius = innerRadius * (1 - positionRatio) + outerRadius * positionRatio + positionOffset; + text2.fill = style2.color; + text2.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + text2.text = datum.sectorLabel.text; + if (shouldPutTextInCenter) { + text2.x = 0; + text2.y = 0; + } else { + text2.x = datum.midCos * labelRadius; + text2.y = datum.midSin * labelRadius; + } + text2.setFont(style2); + text2.setAlign(align2); + text2.setBoxing(style2); + const bbox = text2.getBBox(); + const corners = [ + [bbox.x, bbox.y], + [bbox.x + bbox.width, bbox.y], + [bbox.x + bbox.width, bbox.y + bbox.height], + [bbox.x, bbox.y + bbox.height] + ]; + const sectorBounds = { startAngle, endAngle, innerRadius, outerRadius }; + if (corners.every(([x, y]) => isPointInSector(x, y, sectorBounds))) { + isTextVisible = true; + } + } + text2.visible = isTextVisible; + }; + this.labelSelection.each(updateSectorLabel); + } + updateInnerLabelNodes() { + const textBBoxes = []; + const margins = []; + this.innerLabelsSelection.each((text2, datum) => { + const { fontStyle, fontWeight, fontSize, fontFamily, color: color2 } = datum; + text2.fontStyle = fontStyle; + text2.fontWeight = fontWeight; + text2.fontSize = fontSize; + text2.fontFamily = fontFamily; + text2.text = datum.text; + text2.x = 0; + text2.y = 0; + text2.fill = color2; + text2.textAlign = "center"; + textBBoxes.push(text2.getBBox()); + margins.push(datum.spacing); + }); + const getMarginTop = (index) => index === 0 ? 0 : margins[index]; + const getMarginBottom = (index) => index === margins.length - 1 ? 0 : margins[index]; + const totalWidth = textBBoxes.reduce((max, bbox) => Math.max(max, bbox.width), 0); + const totalHeight = textBBoxes.reduce( + (sum2, bbox, i) => sum2 + bbox.height + getMarginTop(i) + getMarginBottom(i), + 0 + ); + const innerRadius = this.getInnerRadius(); + const labelRadius = Math.sqrt(Math.pow(totalWidth / 2, 2) + Math.pow(totalHeight / 2, 2)); + const labelsVisible = labelRadius <= (innerRadius > 0 ? innerRadius : this.getOuterRadius()); + const textBottoms = []; + for (let i = 0, prev = -totalHeight / 2; i < textBBoxes.length; i++) { + const bbox = textBBoxes[i]; + const bottom = bbox.height + prev + getMarginTop(i); + textBottoms.push(bottom); + prev = bottom + getMarginBottom(i); + } + this.innerLabelsSelection.each((text2, _datum, index) => { + text2.visible = labelsVisible; + if (Array.isArray(text2.text)) { + text2.y = textBottoms[index] - textBBoxes[index].height; + } else { + text2.y = textBottoms[index]; + } + }); + } + updateZerosumRings() { + this.zerosumOuterRing.size = this.getOuterRadius() * 2; + this.zerosumInnerRing.size = this.getInnerRadius() * 2; + } + pickNodeClosestDatum(point) { + return pickByMatchingAngle(this, point); + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + legendItemKey, + calloutLabelKey, + calloutLabelName, + sectorLabelKey, + sectorLabelName, + angleKey, + angleName, + radiusKey, + radiusName, + tooltip + } = properties; + const title = this.properties.title.node.getPlainText(); + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data?.[datumIndex]; + const processedDataValues = this.getProcessedDataValues(dataModel, processedData); + const { angleRawValues } = processedDataValues; + const angleRawValue = angleRawValues[datumIndex]; + const labelValues = this.getLabelContent(datumIndex, datum, processedDataValues); + const label = labelValues.legendItem ?? labelValues.callout ?? labelValues.sector ?? angleName; + const domain = dataModel.getDomain(this, `angleRaw`, "value", processedData); + const angleContent = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: angleRawValue, + datum, + seriesId, + legendItemName: void 0, + key: angleKey, + source: "tooltip", + property: "angle", + domain, + boundSeries: this.getFormatterContext("angle"), + fractionDigits: void 0 + }) ?? formatValue(angleRawValue, 3); + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(datumIndex), + data: [{ label: toPlainText(label), fallbackLabel: angleKey, value: angleContent }] + }, + { + seriesId, + datum, + title: angleName, + legendItemKey, + calloutLabelKey, + calloutLabelName, + sectorLabelKey, + sectorLabelName, + angleKey, + angleName, + radiusKey, + radiusName, + ...this.getItemStyle({ datum, datumIndex }, false) + } + ); + } + legendItemSymbol(datumIndex) { + const datum = this.processedData?.dataSources.get(this.id)?.data?.[datumIndex]; + const sectorFormat = this.getItemStyle({ datum, datumIndex }, false); + const { fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties; + let { fill } = sectorFormat; + const { stroke: stroke3 } = sectorFormat; + if (isGradientFill(fill)) { + fill = { ...fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: { + fill, + stroke: stroke3, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + visible, + processedData, + dataModel, + id: seriesId, + ctx: { legendManager } + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { angleKey, calloutLabelKey, sectorLabelKey, legendItemKey, showInLegend } = this.properties; + if (!legendItemKey && (!calloutLabelKey || calloutLabelKey === angleKey) && (!sectorLabelKey || sectorLabelKey === angleKey)) { + return []; + } + const processedDataValues = this.getProcessedDataValues(dataModel, processedData); + const { angleRawValues } = processedDataValues; + const titleText = this.properties.title?.showInLegend && this.properties.title.text; + const legendData = []; + const hideZeros = this.properties.hideZeroValueSectorsInLegend; + const rawData = processedData.dataSources.get(this.id)?.data; + const invalidData = processedData.invalidData?.get(this.id); + for (let datumIndex = 0; datumIndex < processedData.input.count; datumIndex++) { + const datum = rawData?.[datumIndex]; + const angleRawValue = angleRawValues[datumIndex]; + if (invalidData?.[datumIndex] === true || hideZeros && angleRawValue === 0) { + continue; + } + const labelParts = []; + if (titleText) { + labelParts.push(titleText); + } + const labels = this.getLabelContent(datumIndex, datum, processedDataValues); + if (legendItemKey && labels.legendItem !== void 0) { + labelParts.push(labels.legendItem); + } else if (calloutLabelKey && calloutLabelKey !== angleKey && labels.callout !== void 0) { + labelParts.push(labels.callout); + } else if (sectorLabelKey && sectorLabelKey !== angleKey && labels.sector !== void 0) { + labelParts.push(labels.sector); + } + if (labelParts.length === 0) + continue; + legendData.push({ + legendType: "category", + id: seriesId, + datum, + itemId: datumIndex, + seriesId, + hideToggleOtherSeries: true, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { + text: labelParts.map((s) => toPlainText(s)).join(" - ") + }, + symbol: this.legendItemSymbol(datumIndex), + legendItemName: legendItemKey == null ? void 0 : datum[legendItemKey], + hideInLegend: !showInLegend + }); + } + return legendData; + } + // Used for grid + setLegendState(enabledItems) { + const { + id: seriesId, + ctx: { legendManager, updateService } + } = this; + for (const [itemId, enabled] of enabledItems.entries()) { + legendManager.toggleItem(enabled, seriesId, itemId); + } + legendManager.update(); + updateService.update(5 /* SERIES_UPDATE */); + } + animateEmptyUpdateReady(_data) { + const { animationManager } = this.ctx; + const fns = preparePieSeriesAnimationFunctions( + true, + this.properties.rotation, + this.radiusScale, + this.previousRadiusScale + ); + fromToMotion( + this.id, + "nodes", + animationManager, + [this.itemSelection, this.highlightSelection, this.phantomSelection], + fns.nodes, + (_, datum) => this.getDatumId(datum.datumIndex) + ); + fromToMotion(this.id, `innerCircle`, animationManager, [this.innerCircleSelection], fns.innerCircle); + seriesLabelFadeInAnimation(this, "callout", animationManager, this.calloutLabelSelection); + seriesLabelFadeInAnimation(this, "sector", animationManager, this.labelSelection); + seriesLabelFadeInAnimation(this, "inner", animationManager, this.innerLabelsSelection); + this.previousRadiusScale.range = this.radiusScale.range; + } + animateWaitingUpdateReady() { + const { itemSelection, highlightSelection, phantomSelection, processedData, radiusScale, previousRadiusScale } = this; + const { animationManager } = this.ctx; + const dataDiff = processedData?.reduced?.diff?.[this.id]; + this.ctx.animationManager.stopByAnimationGroupId(this.id); + const supportedDiff = (dataDiff?.moved.size ?? 0) === 0; + const hasKeys = (processedData?.defs.keys.length ?? 0) > 0; + const hasUniqueKeys = processedData?.reduced?.animationValidation?.uniqueKeys ?? true; + if (!supportedDiff || !hasKeys || !hasUniqueKeys) { + this.ctx.animationManager.skipCurrentBatch(); + } + const noVisibleData = !this.nodeData.some((n) => n.enabled); + const fns = preparePieSeriesAnimationFunctions( + false, + this.properties.rotation, + radiusScale, + previousRadiusScale + ); + fromToMotion( + this.id, + "nodes", + animationManager, + [itemSelection, highlightSelection, phantomSelection], + fns.nodes, + (_, datum) => this.getDatumId(datum.datumIndex), + dataDiff + ); + fromToMotion(this.id, `innerCircle`, animationManager, [this.innerCircleSelection], fns.innerCircle); + seriesLabelFadeInAnimation(this, "callout", this.ctx.animationManager, this.calloutLabelSelection); + seriesLabelFadeInAnimation(this, "sector", this.ctx.animationManager, this.labelSelection); + if (this.noVisibleData !== noVisibleData) { + this.noVisibleData = noVisibleData; + seriesLabelFadeInAnimation(this, "inner", this.ctx.animationManager, this.innerLabelsSelection); + } + this.previousRadiusScale.range = this.radiusScale.range; + } + animateClearingUpdateEmpty() { + const { itemSelection, highlightSelection, phantomSelection, radiusScale, previousRadiusScale } = this; + const { animationManager } = this.ctx; + const fns = preparePieSeriesAnimationFunctions( + false, + this.properties.rotation, + radiusScale, + previousRadiusScale + ); + fromToMotion( + this.id, + "nodes", + animationManager, + [itemSelection, highlightSelection, phantomSelection], + fns.nodes, + (_, datum) => this.getDatumId(datum.datumIndex) + ); + fromToMotion(this.id, `innerCircle`, animationManager, [this.innerCircleSelection], fns.innerCircle); + seriesLabelFadeOutAnimation(this, "callout", this.ctx.animationManager, this.calloutLabelSelection); + seriesLabelFadeOutAnimation(this, "sector", this.ctx.animationManager, this.labelSelection); + seriesLabelFadeOutAnimation(this, "inner", this.ctx.animationManager, this.innerLabelsSelection); + this.previousRadiusScale.range = this.radiusScale.range; + } + getDatumId(datumIndex) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return `${datumIndex}`; + } + const { calloutLabelKey, sectorLabelKey, legendItemKey } = this.properties; + if (!processedData.reduced?.animationValidation?.uniqueKeys) { + return `${datumIndex}`; + } + if (legendItemKey) { + const legendItemKeys = dataModel.resolveKeysById(this, "legendItemKey", processedData); + return createDatumId(legendItemKeys[datumIndex]); + } else if (calloutLabelKey) { + const calloutLabelKeys = dataModel.resolveKeysById(this, "calloutLabelKey", processedData); + return createDatumId(calloutLabelKeys[datumIndex]); + } else if (sectorLabelKey) { + const sectorLabelKeys = dataModel.resolveKeysById(this, "sectorLabelKey", processedData); + return createDatumId(sectorLabelKeys[datumIndex]); + } + return `${datumIndex}`; + } + hasItemStylers() { + return !(this.properties.itemStyler == null && this.properties.calloutLabel.itemStyler == null && this.properties.sectorLabel.itemStyler == null && this.properties.innerLabels.every((innerLabel) => innerLabel.itemStyler == null)); + } +}; +DonutSeries.className = "DonutSeries"; +DonutSeries.type = "donut"; + +// packages/ag-charts-community/src/chart/series/polar/pieTheme.ts +var pieTheme = { + series: { + title: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: FONT_SIZE_RATIO.LARGE }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "subtleTextColor" }, + spacing: 5 + }, + calloutLabel: { + ...LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + offset: 3, + minAngle: 1e-3 + }, + sectorLabel: { + ...LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "chartBackgroundColor" }, + positionOffset: 0, + positionRatio: 0.5 + }, + calloutLine: { + length: 10, + strokeWidth: 2, + colors: { + $map: [ + { + $if: [ + { + $or: [ + { $isGradient: { $value: "$1" } }, + { $isPattern: { $value: "$1" } }, + { $isImage: { $value: "$1" } } + ] + }, + { $path: ["../../strokes/$index", { $ref: "foregroundColor" }] }, + { $value: "$1" } + ] + }, + { + $if: [ + { $eq: [{ $path: "../strokeWidth" }, 0] }, + { $path: "../fills" }, + { $path: "../strokes" } + ] + } + ] + } + }, + fills: { + $applyCycle: [ + { $cacheMax: { $size: { $path: ["./data", { $path: "/data" }] } } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS], + ["pattern", FILL_PATTERN_DEFAULTS], + ["image", FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $cacheMax: { $size: { $path: ["./data", { $path: "/data" }] } } }, { $palette: "strokes" }] + }, + fillOpacity: 1, + strokeOpacity: 1, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + lineDash: [0], + lineDashOffset: 0, + rotation: 0, + sectorSpacing: 1, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + highlight: multiSeriesHighlightStyle() + }, + legend: { enabled: true } +}; + +// packages/ag-charts-community/src/chart/series/polar/donutTheme.ts +var donutTheme = { + ...pieTheme, + series: { + ...pieTheme.series, + innerRadiusRatio: { + $if: [{ $eq: [{ $path: ["./innerRadiusOffset", void 0] }, void 0] }, 0.7, void 0] + }, + innerLabels: { + $apply: { + ...LABEL_BOXING_DEFAULTS, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 2 + } + }, + highlight: singleSeriesHighlightStyle() + } +}; + +// packages/ag-charts-community/src/chart/series/polar/donutSeriesModule.ts +var DonutSeriesModule = { + type: "series", + optionsKey: "series[]", + packageType: "community", + chartTypes: ["polar"], + identifier: "donut", + moduleFactory: (ctx) => new DonutSeries(ctx), + themeTemplate: donutTheme +}; +var NewDonutSeriesModule = { + type: "series", + name: "donut", + chartType: "polar", + options: donutSeriesOptionsDef, + create: (ctx) => new DonutSeries(ctx) +}; + +// packages/ag-charts-community/src/chart/series/polar/pieSeries.ts +var PieSeries = class extends DonutSeries { +}; +PieSeries.className = "PieSeries"; +PieSeries.type = "pie"; + +// packages/ag-charts-community/src/chart/series/polar/pieSeriesModule.ts +var PieSeriesModule = { + type: "series", + optionsKey: "series[]", + packageType: "community", + chartTypes: ["polar"], + identifier: "pie", + moduleFactory: (ctx) => new PieSeries(ctx), + themeTemplate: pieTheme +}; +var NewPieSeriesModule = { + type: "series", + name: "pie", + chartType: "polar", + options: pieSeriesOptionsDef, + create: (ctx) => new PieSeries(ctx) +}; + +// packages/ag-charts-community/src/chart/factory/registerInbuiltModules.ts +function registerInbuiltModules() { + moduleRegistry.register( + BackgroundModule, + SeriesAreaModule, + CommunityLegendModule, + LocaleModule, + AreaSeriesModule, + BarSeriesModule, + BubbleSeriesModule, + LineSeriesModule, + ScatterSeriesModule, + DonutSeriesModule, + PieSeriesModule, + HistogramSeriesModule + ); + for (const AxisConstructor of [NumberAxis, CategoryAxis, TimeAxis, GroupedCategoryAxis, LogAxis, UnitTimeAxis]) { + axisRegistry.register(AxisConstructor.type, { + moduleFactory: (ctx) => new AxisConstructor(ctx) + }); + } +} + +// packages/ag-charts-community/src/chart/factory/setupModules.ts +function setupModules() { + for (const m of moduleRegistry.modules) { + if (m.packageType === "enterprise" && !verifyIfModuleExpected(m)) { + logger_exports.errorOnce("Unexpected enterprise module registered: " + m.identifier); + } + if (m.type === "root" && m.themeTemplate) { + for (const chartType of m.chartTypes) { + chartDefaults.set(chartType, m.themeTemplate); + } + } + if (m.type === "series") { + if (m.chartTypes.length > 1) { + throw new Error(`AG Charts - Module definition error: ${m.identifier}`); + } + seriesRegistry.register(m.identifier, m); + } + if (m.type === "series-option" && m.themeTemplate) { + for (const seriesType of m.seriesTypes) { + seriesRegistry.setThemeTemplate(seriesType, m.themeTemplate); + } + } + if (m.type === "axis-option" && m.themeTemplate) { + for (const axisType of m.axisTypes) { + const axisTypeTheme = axisRegistry.getThemeTemplate(axisType); + const theme = mergeDefaults(m.themeTemplate, axisTypeTheme); + axisRegistry.setThemeTemplate(axisType, theme); + } + } + if (m.type === "axis") { + axisRegistry.register(m.identifier, m); + } + if (m.type === "legend") { + legendRegistry.register(m.identifier, m); + } + } + if (moduleRegistry.hasEnterpriseModules()) { + const expectedButUnused = getUnusedExpectedModules(); + if (expectedButUnused.length > 0) { + logger_exports.errorOnce("Enterprise modules expected but not registered: ", expectedButUnused); + } + } +} + +// packages/ag-charts-community/src/api/preset/presetUtils.ts +var IGNORED_PROP = Symbol("IGNORED_PROP"); +function pickProps(opts, values) { + const out = {}; + for (const key of Object.keys(values)) { + const value = values[key]; + if (value !== IGNORED_PROP && Object.hasOwn(opts, key)) { + out[key] = value; + } + } + return out; +} + +// packages/ag-charts-community/src/api/preset/gauge.ts +function tooltipOptions(opts) { + const { enabled, mode, showArrow, range: range4, position, pagination, delay, wrapping, interaction, renderer, ...rest } = opts; + const seriesTooltipOptions = pickProps(opts, { + enabled, + showArrow, + range: range4, + position, + interaction, + renderer, + ...rest + }); + const chartTooltipOptions = pickProps(opts, { + enabled: IGNORED_PROP, + showArrow: IGNORED_PROP, + range: IGNORED_PROP, + position: IGNORED_PROP, + mode, + pagination, + delay, + wrapping, + ...rest + }); + return { chartTooltipOptions, seriesTooltipOptions }; +} +function radialGaugeOptions(opts) { + const { + animation, + background, + container, + contextMenu, + context, + footnote, + height: height2, + listeners, + locale, + minHeight, + minWidth, + overrideDevicePixelRatio, + padding: padding2, + subtitle, + theme, + title, + width: width2, + type, + cursor, + nodeClickRange, + tooltip = {}, + value, + scale: scale2 = {}, + startAngle, + endAngle, + // eslint-disable-next-line sonarjs/deprecation + highlightStyle, + highlight: highlight5, + segmentation, + bar, + needle, + targets, + outerRadius, + innerRadius, + outerRadiusRatio, + innerRadiusRatio, + cornerRadius, + cornerMode, + label, + secondaryLabel, + spacing, + ...rest + } = opts; + const { chartTooltipOptions, seriesTooltipOptions } = tooltipOptions(tooltip); + const chartOpts = pickProps(opts, { + animation, + background, + container, + contextMenu, + context, + footnote, + height: height2, + listeners, + locale, + minHeight, + minWidth, + overrideDevicePixelRatio, + padding: padding2, + subtitle, + theme, + title, + tooltip: chartTooltipOptions, + width: width2 + }); + const seriesOpts = pickProps(opts, { + needle: needle == null ? IGNORED_PROP : { enabled: true, ...needle }, + startAngle, + endAngle, + scale: scale2, + type, + cursor, + context, + nodeClickRange, + tooltip: seriesTooltipOptions, + value, + highlightStyle, + highlight: highlight5, + segmentation, + bar, + targets, + outerRadius, + innerRadius, + outerRadiusRatio, + innerRadiusRatio, + cornerRadius, + cornerMode, + label, + secondaryLabel, + spacing, + ...rest + }); + return { + ...chartOpts, + series: [seriesOpts] + }; +} +function linearGaugeOptions(opts) { + const { + animation, + background, + container, + contextMenu, + context, + footnote, + height: height2, + listeners, + locale, + minHeight, + minWidth, + overrideDevicePixelRatio, + padding: padding2, + subtitle, + theme, + title, + width: width2, + type, + cursor, + nodeClickRange, + tooltip = {}, + value, + scale: scale2 = {}, + direction = "vertical", + thickness, + // eslint-disable-next-line sonarjs/deprecation + highlightStyle, + highlight: highlight5, + segmentation, + bar, + targets, + cornerRadius, + cornerMode, + label, + ...rest + } = opts; + const { chartTooltipOptions, seriesTooltipOptions } = tooltipOptions(tooltip); + const chartOpts = pickProps(opts, { + animation, + background, + container, + contextMenu, + context, + footnote, + height: height2, + listeners, + locale, + minHeight, + minWidth, + overrideDevicePixelRatio, + padding: padding2, + subtitle, + theme, + title, + tooltip: chartTooltipOptions, + width: width2 + }); + const seriesOpts = pickProps(opts, { + scale: scale2, + type, + cursor, + context, + nodeClickRange, + tooltip: seriesTooltipOptions, + value, + direction, + thickness, + highlightStyle, + highlight: highlight5, + segmentation, + bar, + targets, + cornerRadius, + cornerMode, + label, + ...rest + }); + return { + ...chartOpts, + series: [seriesOpts] + }; +} +function applyThemeDefaults(opts, presetTheme) { + if (presetTheme == null) + return opts; + const { targets: targetsTheme, ...gaugeTheme } = presetTheme; + opts = mergeDefaults(opts, gaugeTheme); + if (opts.targets != null && targetsTheme != null) { + opts.targets = mergeArrayDefaults(opts.targets, targetsTheme); + } + return opts; +} +function gauge(opts, presetTheme) { + switch (opts.type) { + case "radial-gauge": + return radialGaugeOptions(applyThemeDefaults(opts, presetTheme)); + case "linear-gauge": + return linearGaugeOptions(applyThemeDefaults(opts, presetTheme)); + default: + return {}; + } +} + +// packages/ag-charts-community/src/api/preset/priceVolumePresetTheme.ts +var stroke = { + stroke: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR +}; +var handle = { + fill: DEFAULT_ANNOTATION_HANDLE_FILL +}; +var axisLabel = { + color: "white", + fill: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR +}; +var lineText = { + color: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR +}; +var font = { + color: DEFAULT_TEXT_ANNOTATION_COLOR, + fontSize: { $rem: FONT_SIZE_RATIO.LARGE }, + fontFamily: { $ref: "fontFamily" } +}; +var measurerStatistics = { + ...font, + fontSize: { $ref: "fontSize" }, + color: DEFAULT_ANNOTATION_STATISTICS_COLOR, + fill: DEFAULT_ANNOTATION_STATISTICS_FILL, + stroke: DEFAULT_ANNOTATION_STATISTICS_STROKE, + strokeWidth: 1, + divider: { + stroke: DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE, + strokeWidth: 1, + strokeOpacity: 0.5 + } +}; +var measurer = { + ...stroke, + background: { + fill: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + fillOpacity: 0.2 + }, + handle: { ...handle }, + text: { ...lineText }, + statistics: { ...measurerStatistics } +}; +var annotationsTheme = { + // Lines + line: { + ...stroke, + handle: { ...handle }, + text: { ...lineText } + }, + "horizontal-line": { + ...stroke, + handle: { ...handle }, + axisLabel: { ...axisLabel }, + text: { ...lineText } + }, + "vertical-line": { + ...stroke, + handle: { ...handle }, + axisLabel: { ...axisLabel }, + text: { ...lineText } + }, + // Channels + "disjoint-channel": { + ...stroke, + background: { + fill: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + fillOpacity: 0.2 + }, + handle: { ...handle }, + text: { ...lineText } + }, + "parallel-channel": { + ...stroke, + background: { + fill: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + fillOpacity: 0.2 + }, + handle: { ...handle }, + text: { ...lineText } + }, + // Fibonnaccis + "fibonacci-retracement": { + ...stroke, + strokes: DEFAULT_FIBONACCI_STROKES, + rangeStroke: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, + handle: { ...handle }, + text: { ...lineText, position: "center" }, + label: { + ...font, + color: void 0, + fontSize: { $rem: FONT_SIZE_RATIO.SMALLER } + } + }, + "fibonacci-retracement-trend-based": { + ...stroke, + strokes: DEFAULT_FIBONACCI_STROKES, + rangeStroke: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, + handle: { ...handle }, + text: { ...lineText, position: "center" }, + label: { + ...font, + color: void 0, + fontSize: { $rem: FONT_SIZE_RATIO.SMALLER } + } + }, + // Texts + callout: { + ...stroke, + ...font, + color: { $ref: "textColor" }, + handle: { ...handle }, + fill: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + fillOpacity: 0.2 + }, + comment: { + ...font, + color: "white", + fontWeight: 700, + handle: { ...handle }, + fill: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR + }, + note: { + ...font, + color: DEFAULT_TEXTBOX_COLOR, + fill: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, + stroke: { $ref: "chartBackgroundColor" }, + strokeWidth: 1, + strokeOpacity: 1, + handle: { ...handle }, + background: { + fill: DEFAULT_TEXTBOX_FILL, + stroke: DEFAULT_TEXTBOX_STROKE, + strokeWidth: 1 + } + }, + text: { + ...font, + handle: { ...handle } + }, + // Shapes + arrow: { + ...stroke, + handle: { ...handle }, + text: { ...lineText } + }, + "arrow-up": { + fill: { $palette: "up.fill" }, + handle: { ...handle, stroke: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR } + }, + "arrow-down": { + fill: { $palette: "down.fill" }, + handle: { ...handle, stroke: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR } + }, + // Measurers + "date-range": { + ...measurer + }, + "price-range": { + ...measurer + }, + "date-price-range": { + ...measurer + }, + "quick-date-price-range": { + up: { + ...stroke, + fill: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + fillOpacity: 0.2, + handle: { ...handle }, + statistics: { + ...measurerStatistics, + color: "#fff", + fill: DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + strokeWidth: 0, + divider: { + stroke: "#fff", + strokeWidth: 1, + strokeOpacity: 0.5 + } + } + }, + down: { + ...stroke, + stroke: DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE, + fill: DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, + fillOpacity: 0.2, + handle: { + ...handle, + stroke: DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE + }, + statistics: { + ...measurerStatistics, + color: "#fff", + fill: DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, + strokeWidth: 0, + divider: { + stroke: "#fff", + strokeWidth: 1, + strokeOpacity: 0.5 + } + } + } + }, + axesButtons: { + enabled: true + } +}; + +// packages/ag-charts-community/src/api/preset/priceVolumePreset.ts +var chartTypes3 = ["ohlc", "line", "step-line", "hlc", "high-low", "candlestick", "hollow-candlestick"]; +var toolbarButtons = [ + { + icon: "trend-line-drawing", + tooltip: "toolbarAnnotationsLineAnnotations", + value: "line-menu" + }, + { + icon: "fibonacci-retracement-drawing", + tooltip: "toolbarAnnotationsFibonacciAnnotations", + value: "fibonacci-menu" + }, + { + icon: "text-annotation", + tooltip: "toolbarAnnotationsTextAnnotations", + value: "text-menu" + }, + { + icon: "arrow-drawing", + tooltip: "toolbarAnnotationsShapeAnnotations", + value: "shape-menu" + }, + { + icon: "measurer-drawing", + tooltip: "toolbarAnnotationsMeasurerAnnotations", + value: "measurer-menu" + }, + { + icon: "delete", + tooltip: "toolbarAnnotationsClearAll", + value: "clear" + } +]; +function priceVolume(opts, _presetTheme, getTheme) { + const { + dateKey = "date", + highKey = "high", + openKey = "open", + lowKey = "low", + closeKey = "close", + volumeKey = "volume", + chartType = "candlestick", + navigator = false, + volume = true, + rangeButtons = true, + statusBar = true, + toolbar: toolbar2 = true, + zoom = true, + sync = false, + theme, + data, + formatter: formatter2, + ...unusedOpts + } = opts; + const priceSeries = createPriceSeries(chartType, dateKey, highKey, lowKey, openKey, closeKey); + const volumeSeries = createVolumeSeries(getTheme, openKey, closeKey, volume, volumeKey); + const miniChart = volume ? { + miniChart: { + enabled: navigator, + series: [ + { + type: "line", + xKey: dateKey, + yKey: volumeKey, + stroke: SAFE_STROKE_FILL_OPERATION, + marker: { enabled: false } + } + ] + }, + height: 40, + minHandle: { + height: 46 + }, + maxHandle: { + height: 46 + } + } : null; + const navigatorOpts = { + navigator: { + enabled: navigator, + ...miniChart + } + }; + const annotationOpts = { + annotations: { + enabled: toolbar2, + optionsToolbar: { + enabled: toolbar2 + }, + // @ts-expect-error undocumented option + snap: true, + toolbar: { + enabled: toolbar2, + buttons: toolbarButtons, + padding: 0 + }, + data, + xKey: dateKey, + volumeKey: volume ? volumeKey : void 0 + } + }; + const statusBarOpts = statusBar ? { + statusBar: { + enabled: true, + data, + highKey, + openKey, + lowKey, + closeKey, + volumeKey: volume ? volumeKey : void 0 + } + } : null; + const zoomOpts = { + zoom: { + enabled: zoom, + autoScaling: { + enabled: true + }, + // @ts-expect-error undocumented option + enableIndependentAxes: true + } + }; + const toolbarOpts = { + ranges: { + enabled: rangeButtons + } + }; + const syncGroup = sync ? { + sync: { + enabled: sync, + nodeInteraction: true, + zoom: true + } + } : null; + const volumeAxis = volume ? [ + { + type: "number", + position: "left", + keys: [volumeKey], + label: { enabled: false }, + crosshair: { enabled: false }, + gridLine: { enabled: false }, + nice: false, + // @ts-expect-error undocumented option + layoutConstraints: { + stacked: false, + width: 20, + unit: "percent", + align: "end" + } + } + ] : []; + return { + theme: { + baseTheme: typeof theme === "string" ? theme : "ag-financial", + ...mergeDefaults(typeof theme === "object" ? theme : null, { + overrides: { + common: { + title: { padding: 4 }, + padding: { + top: 6, + right: 8, + bottom: 6 + }, + chartToolbar: { + enabled: toolbar2 + }, + annotations: { ...annotationsTheme }, + axes: { + number: { + interval: { maxSpacing: 45 }, + label: { format: ".2f" } + } + } + }, + bar: { + series: { + fillOpacity: 0.5 + } + }, + line: { + series: { + marker: { enabled: false }, + ...inlineSwitch(chartType, { + hlc: { + stroke: { $palette: "altNeutral.stroke" }, + strokeWidth: 2 + }, + line: { + stroke: { $palette: "neutral.stroke" } + }, + "step-line": { + stroke: { $palette: "neutral.stroke" }, + interpolation: { type: "step" } + } + }) + } + }, + candlestick: { + series: { + ...inlineSwitch(chartType, { + "hollow-candlestick": { + item: { + up: { fill: "transparent" } + } + } + }) + } + }, + "range-area": { + series: { + fillOpacity: 0.3, + strokeWidth: 2 + } + } + } + }) + }, + animation: { enabled: false }, + legend: { enabled: false }, + series: [...volumeSeries, ...priceSeries], + axes: [ + { + type: "number", + position: "right", + keys: [openKey, closeKey, highKey, lowKey], + crosshair: { + enabled: true, + snap: false + }, + // @ts-expect-error undocumented option + layoutConstraints: { + stacked: false, + width: 100, + unit: "percent", + align: "start" + } + }, + ...volumeAxis, + { + type: "ordinal-time", + position: "bottom", + line: { + enabled: false + }, + label: { + enabled: true + }, + crosshair: { + enabled: true + } + } + ], + tooltip: { enabled: false }, + data, + formatter: formatter2, + ...annotationOpts, + ...navigatorOpts, + ...statusBarOpts, + ...zoomOpts, + ...toolbarOpts, + ...syncGroup, + ...unusedOpts + }; +} +function createVolumeSeries(getTheme, openKey, closeKey, volume, volumeKey) { + if (!volume) + return []; + return [ + { + type: "bar", + xKey: "date", + yKey: volumeKey, + tooltip: { enabled: false }, + itemStyler({ datum }) { + const { up, down } = getTheme().palette; + return { fill: datum[openKey] < datum[closeKey] ? up?.fill : down?.fill }; + }, + // @ts-expect-error undocumented option + focusPriority: 1, + highlight: { enabled: false } + } + ]; +} +var RANGE_AREA_TYPE = "range-area"; +function createPriceSeries(chartType, xKey, highKey, lowKey, openKey, closeKey) { + const keys = { + xKey, + openKey, + closeKey, + highKey, + lowKey + }; + const singleKeys = { + xKey, + yKey: closeKey + }; + const common = { + pickOutsideVisibleMinorAxis: true + }; + switch (chartType ?? "candlestick") { + case "ohlc": + return createPriceSeriesOHLC(common, keys); + case "line": + case "step-line": + return createPriceSeriesLine(common, singleKeys); + case "hlc": + return createPriceSeriesHLC(common, singleKeys, keys); + case "high-low": + return createPriceSeriesHighLow(common, keys); + case "candlestick": + case "hollow-candlestick": + return createPriceSeriesCandlestick(common, keys); + default: + logger_exports.warnOnce(`unknown chart type: ${chartType}; expected one of: ${chartTypes3.join(", ")}`); + return createPriceSeriesCandlestick(common, keys); + } +} +function createPriceSeriesOHLC(common, keys) { + return [ + { + type: "ohlc", + // @ts-expect-error undocumented option + focusPriority: 0, + ...common, + ...keys + } + ]; +} +function createPriceSeriesLine(common, singleKeys) { + return [ + { + type: "line", + // @ts-expect-error undocumented option + focusPriority: 0, + ...common, + ...singleKeys + } + ]; +} +function createPriceSeriesHLC(common, singleKeys, { xKey, highKey, closeKey, lowKey }) { + return [ + { + type: RANGE_AREA_TYPE, + // @ts-expect-error undocumented option + focusPriority: 0, + ...common, + xKey, + yHighKey: highKey, + yLowKey: closeKey, + fill: PALETTE_UP_FILL, + stroke: PALETTE_UP_STROKE + }, + { + type: RANGE_AREA_TYPE, + // @ts-expect-error undocumented option + focusPriority: 0, + ...common, + xKey, + yHighKey: closeKey, + yLowKey: lowKey, + fill: PALETTE_DOWN_FILL, + stroke: PALETTE_DOWN_STROKE + }, + { + type: "line", + ...common, + ...singleKeys + } + ]; +} +function createPriceSeriesHighLow(common, { xKey, highKey, lowKey }) { + return [ + { + type: "range-bar", + ...common, + xKey, + yHighKey: highKey, + yLowKey: lowKey, + fill: PALETTE_NEUTRAL_FILL, + stroke: PALETTE_NEUTRAL_STROKE, + tooltip: { + range: "nearest" + }, + // @ts-expect-error undocumented option + focusPriority: 0 + } + ]; +} +function createPriceSeriesCandlestick(common, keys) { + return [ + { + type: "candlestick", + // @ts-expect-error undocumented option + focusPriority: 0, + ...common, + ...keys + } + ]; +} +function inlineSwitch(caseName, switchCases) { + return switchCases[caseName] ?? switchCases.default; +} + +// packages/ag-charts-community/src/api/preset/sparkline.ts +var commonAxisProperties = { + title: { + enabled: false + }, + label: { + enabled: false + }, + line: { + enabled: false + }, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false, + stroke: DEFAULT_SPARKLINE_CROSSHAIR_STROKE, + lineDash: [0], + label: { + enabled: false + } + } +}; +var numericAxisProperties = { + ...commonAxisProperties, + nice: false +}; +var chartTooltipDefaults = { + mode: "compact", + position: { + anchorTo: "node", + placement: ["right", "left"] + }, + showArrow: false +}; +var barGridLineDefaults = { + style: [{ stroke: { $ref: "gridLineColor" } }], + width: 2 +}; +var barAxisDefaults = { + number: { + gridLine: barGridLineDefaults + }, + time: { + gridLine: barGridLineDefaults + }, + category: { + gridLine: barGridLineDefaults + } +}; +var SPARKLINE_THEME = { + overrides: { + common: { + animation: { enabled: false }, + contextMenu: { enabled: false }, + keyboard: { enabled: false }, + background: { visible: false }, + navigator: { + enabled: false + }, + padding: { + top: 0, + right: 0, + bottom: 0, + left: 0 + }, + axes: { + number: { + ...numericAxisProperties, + interval: { + values: [0] + } + }, + log: { + ...numericAxisProperties + }, + time: { + ...numericAxisProperties + }, + category: { + ...commonAxisProperties + } + } + }, + bar: { + series: { + crisp: false, + label: { + placement: "inside-end", + padding: 4 + }, + // @ts-expect-error undocumented option + sparklineMode: true + }, + tooltip: { + ...chartTooltipDefaults, + position: { + ...chartTooltipDefaults.position, + anchorTo: "pointer" + }, + range: "nearest" + }, + axes: barAxisDefaults + }, + line: { + seriesArea: { + padding: { + top: 2, + right: 2, + bottom: 2, + left: 2 + } + }, + series: { + // @ts-expect-error undocumented option + sparklineMode: true, + strokeWidth: 1, + marker: { + enabled: false, + size: 3 + } + }, + tooltip: chartTooltipDefaults + }, + area: { + seriesArea: { + padding: { + top: 1, + right: 0, + bottom: 1, + left: 0 + } + }, + series: { + strokeWidth: 1, + fillOpacity: 0.4 + }, + tooltip: chartTooltipDefaults + } + } +}; +var setInitialBaseTheme = simpleMemorize(createInitialBaseTheme); +function createInitialBaseTheme(baseTheme, initialBaseTheme) { + if (typeof baseTheme === "string") { + return { + ...initialBaseTheme, + baseTheme + }; + } + if (baseTheme != null) { + return { + ...baseTheme, + // @ts-expect-error internal implementation + baseTheme: setInitialBaseTheme(baseTheme.baseTheme, initialBaseTheme) + }; + } + return initialBaseTheme; +} +function sparklineDataPreset(data) { + if (Array.isArray(data) && data.length !== 0) { + const firstItem = data.find((v) => v != null); + if (typeof firstItem === "number") { + const mappedData = data.map((y, x) => ({ x, y })); + return { data: mappedData, series: [{ xKey: "x", yKey: "y" }], datumKey: "y" }; + } else if (Array.isArray(firstItem)) { + const mappedData = data.map((datum) => ({ x: datum?.[0], y: datum?.[1], datum })); + return { data: mappedData, series: [{ xKey: "x", yKey: "y" }], datumKey: "datum" }; + } + } else if (data?.length === 0) { + return { data, series: [{ xKey: "x", yKey: "y" }], datumKey: "y" }; + } + return { data }; +} +function axisPreset(opts) { + switch (opts?.type) { + case "number": { + const { type, min, max, reverse } = opts; + return pickProps(opts, { + type, + reverse, + min, + max + }); + } + case "time": { + const { type, min, max, reverse } = opts; + return pickProps(opts, { + type, + reverse, + min, + max + }); + } + case "category": + default: { + const { paddingInner, paddingOuter, reverse } = opts ?? {}; + return pickProps( + { ...opts, type: "category" }, + { + type: "category", + reverse, + paddingInner, + paddingOuter + } + ); + } + } +} +function gridLinePreset(opts, defaultEnabled, sparkOpts) { + const gridLineOpts = {}; + if (opts?.stroke != null) { + gridLineOpts.style = [{ stroke: opts?.stroke }]; + gridLineOpts.enabled ?? (gridLineOpts.enabled = true); + } + if (opts?.strokeWidth != null) { + gridLineOpts.width = opts?.strokeWidth; + gridLineOpts.enabled ?? (gridLineOpts.enabled = true); + } + if (sparkOpts.type === "bar" && sparkOpts.direction !== "horizontal") { + gridLineOpts.enabled ?? (gridLineOpts.enabled = true); + } + if (opts?.visible != null) { + gridLineOpts.enabled = opts.visible; + } + gridLineOpts.enabled ?? (gridLineOpts.enabled = defaultEnabled); + return gridLineOpts; +} +var tooltipRendererFn = simpleMemorize((context, tooltip, datumKey) => { + return (params) => { + const xValue2 = params.datum[params.xKey]; + const yValue = params.datum[params.yKey]; + const datum = datumKey == null ? params.datum : params.datum[datumKey]; + const userContent = tooltip?.renderer?.({ context, datum, xValue: xValue2, yValue }); + if (typeof userContent === "string") + return userContent; + const content = userContent?.content ?? yValue.toFixed(2); + return userContent?.title ? { + heading: void 0, + title: void 0, + data: [{ label: userContent.title, value: content }] + } : { + heading: void 0, + title: content, + data: [] + }; + }; +}); +function sparkline(opts) { + const { + background, + container, + height: height2, + listeners, + locale, + minHeight, + minWidth, + overrideDevicePixelRatio, + padding: padding2, + width: width2, + theme: baseTheme, + data: baseData, + crosshair, + axis, + min, + max, + tooltip, + context, + styleNonce, + ...optsRest + } = opts; + const chartOpts = pickProps(opts, { + background, + container, + height: height2, + listeners, + locale, + minHeight, + minWidth, + overrideDevicePixelRatio, + padding: padding2, + width: width2, + styleNonce, + tooltip: IGNORED_PROP, + context: IGNORED_PROP, + data: IGNORED_PROP, + crosshair: IGNORED_PROP, + axis: IGNORED_PROP, + min: IGNORED_PROP, + max: IGNORED_PROP, + theme: IGNORED_PROP + }); + const { data, series: [seriesOverrides] = [], datumKey } = sparklineDataPreset(baseData); + const seriesOptions = optsRest; + if (seriesOverrides != null) + Object.assign(seriesOptions, seriesOverrides); + seriesOptions.tooltip = { + ...tooltip, + renderer: tooltipRendererFn(context, tooltip, datumKey) + }; + chartOpts.theme = setInitialBaseTheme(baseTheme, SPARKLINE_THEME); + chartOpts.data = data; + chartOpts.series = [seriesOptions]; + const swapAxes = seriesOptions.type !== "bar" || seriesOptions.direction !== "horizontal"; + const [xAxisPosition, yAxisPosition] = swapAxes ? ["bottom", "left"] : ["left", "bottom"]; + const xAxis = { + ...axisPreset(axis), + position: xAxisPosition, + ...pickProps(opts, { crosshair }) + }; + const yAxis = { + type: "number", + gridLine: gridLinePreset(axis, false, opts), + position: yAxisPosition, + ...pickProps(opts, { min, max }) + }; + chartOpts.axes = swapAxes ? [yAxis, xAxis] : [xAxis, yAxis]; + return chartOpts; +} + +// packages/ag-charts-community/src/api/preset/presetModules.ts +var priceVolumeOptionsDef = { + chartType: union("candlestick", "hollow-candlestick", "ohlc", "line", "step-line", "hlc", "high-low"), + dateKey: string, + openKey: string, + highKey: string, + lowKey: string, + closeKey: string, + volumeKey: string, + navigator: boolean, + volume: boolean, + rangeButtons: boolean, + statusBar: boolean, + toolbar: boolean, + zoom: boolean, + sync: boolean, + // Valid pass-through options + theme: defined, + container: defined, + width: defined, + height: defined, + minWidth: defined, + minHeight: defined, + listeners: defined, + initialState: defined, + title: defined, + data: array, + formatter: defined +}; +var commonGaugeOptions = { + // Valid pass-through options + theme: defined, + container: defined, + animation: defined, + background: defined, + contextMenu: defined, + context: () => true, + listeners: defined, + locale: defined, + width: defined, + height: defined, + minWidth: defined, + minHeight: defined, + title: defined, + subtitle: defined, + footnote: defined, + padding: defined, + tooltip: { + ...tooltipOptionsDefs, + ...commonChartOptionsDefs.tooltip + } +}; +commonGaugeOptions.overrideDevicePixelRatio = undocumented(positiveNumber); +var commonSparklineOmit = [ + "showInLegend", + "showInMiniChart", + "grouped", + "stacked", + "stackGroup", + "tooltip", + "listeners", + "errorBar", + "xKey", + "yKey", + "type" +]; +var commonSparklineAxisOptionsDef = { + visible: boolean, + reverse: boolean, + stroke: color, + strokeWidth: positiveNumber +}; +var commonSparklineOptionsDef = { + context: () => true, + tooltip: defined, + theme: defined, + background: defined, + container: defined, + width: defined, + height: defined, + minWidth: defined, + minHeight: defined, + padding: defined, + listeners: defined, + locale: defined, + data: defined, + styleNonce: string, + axis: typeUnion( + { + number: { + ...commonSparklineAxisOptionsDef, + min: and(number, lessThan("max")), + max: and(number, greaterThan("min")) + }, + category: { + ...commonSparklineAxisOptionsDef, + paddingInner: ratio, + paddingOuter: ratio + }, + time: { + ...commonSparklineAxisOptionsDef, + min: and(or(number, date), lessThan("max")), + max: and(or(number, date), greaterThan("min")) + } + }, + "axis options", + "category" + // AG-14799 - Contrary to the AgSparklineAxisOptions interface, type is optional and defaults to 'category'. + ), + min: and(number, lessThan("max")), + max: and(number, greaterThan("min")), + crosshair: { + enabled: boolean, + snap: boolean, + ...strokeOptionsDef, + ...lineDashOptionsDef + }, + xKey: string, + yKey: string +}; +commonSparklineOptionsDef.overrideDevicePixelRatio = undocumented(number); +var PriceVolumePresetModule = { + type: "preset", + name: "price-volume", + enterprise: true, + options: priceVolumeOptionsDef, + create: priceVolume +}; +var GaugePresetModule = { + type: "preset", + name: "gauge-preset", + enterprise: true, + options: typeUnion( + { + "linear-gauge": { + ...without(linearGaugeSeriesOptionsDef, ["type"]), + ...commonGaugeOptions + }, + "radial-gauge": { + ...without(radialGaugeSeriesOptionsDef, ["type"]), + ...commonGaugeOptions + } + }, + "gauge options" + ), + create: gauge +}; +var SparklinePresetModule = { + type: "preset", + name: "sparkline", + options: typeUnion( + { + area: { + ...commonSparklineOptionsDef, + ...without(areaSeriesOptionsDef, commonSparklineOmit) + }, + bar: { + ...commonSparklineOptionsDef, + ...without(barSeriesOptionsDef, commonSparklineOmit) + }, + line: { + ...commonSparklineOptionsDef, + ...without(lineSeriesOptionsDef, commonSparklineOmit) + } + }, + "sparkline options" + ), + create: sparkline, + processData: sparklineDataPreset +}; + +// packages/ag-charts-community/src/chart/cartesianUtil.ts +function stackCartesianSeries(series) { + const seriesGroups = /* @__PURE__ */ new Map(); + for (const s of series) { + if (!(s instanceof CartesianSeries)) + continue; + const stackCount = s.seriesGrouping?.stackCount ?? 0; + const groupIndex = stackCount > 0 ? s.seriesGrouping?.groupIndex : void 0; + if (groupIndex == null) { + s.seriesBelowStackContext = void 0; + s.createStackContext(); + continue; + } + const groupKey = `${s.type}-${groupIndex}`; + let group = seriesGroups.get(groupKey); + if (group == null) { + group = []; + seriesGroups.set(groupKey, group); + } + group.push(s); + } + for (const group of seriesGroups.values()) { + group.sort((a, b) => (a.seriesGrouping?.stackIndex ?? 0) - (b.seriesGrouping?.stackIndex ?? 0)); + let seriesBelowStackContext; + for (const s of group) { + s.seriesBelowStackContext = seriesBelowStackContext; + seriesBelowStackContext = s.createStackContext(); + } + } +} + +// packages/ag-charts-community/src/chart/cartesianChart.ts +var directions = ["top", "right", "bottom", "left"]; +var _CartesianChart = class _CartesianChart extends Chart { + constructor(options, resources) { + super(options, resources); + // TODO should come from theme + /** Integrated Charts feature state - not used in Standalone Charts. */ + this.paired = true; + this.axes = []; + this.lastUpdateClipRect = void 0; + this.lastLayoutWidth = Number.NaN; + this.lastLayoutHeight = Number.NaN; + } + onAxisChange(newValue, oldValue) { + super.onAxisChange(newValue, oldValue); + this.syncAxisChanges(newValue, oldValue); + if (this.ctx != null) { + this.ctx.zoomManager.updateAxes(newValue); + } + } + destroySeries(series) { + super.destroySeries(series); + this.lastLayoutWidth = Number.NaN; + this.lastLayoutHeight = Number.NaN; + } + getChartType() { + return "cartesian"; + } + setRootClipRects(clipRect) { + const { seriesRoot, annotationRoot } = this; + seriesRoot.setClipRect(clipRect); + annotationRoot.setClipRect(clipRect); + } + async processData() { + await super.processData(); + if (this.syncStatus === "init") { + this.syncStatus = "domains-calculated"; + } + this.ctx.updateService.dispatchProcessData({ series: { shouldFlipXY: this.shouldFlipXY() } }); + } + async processDomains() { + await super.processDomains(); + for (const axis of this.axes) { + const syncedDomain = await this.getSyncedDomain(axis); + if (syncedDomain != null) { + axis.setDomains(syncedDomain); + } + } + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { clipSeries, seriesRect, visible } = this.updateAxes(ctx.layoutBox); + this.seriesRoot.visible = visible; + this.seriesRect = seriesRect; + this.animationRect = ctx.layoutBox; + const { x, y } = seriesRect; + if (ctx.width !== this.lastLayoutWidth || ctx.height !== this.lastLayoutHeight) { + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(x); + group.translationY = Math.floor(y); + } + } else { + const { translationX, translationY } = seriesRoot; + staticFromToMotion( + this.id, + "seriesRect", + this.ctx.animationManager, + [seriesRoot, annotationRoot], + { translationX, translationY }, + { translationX: Math.floor(x), translationY: Math.floor(y) }, + { phase: "update" } + ); + } + this.lastLayoutWidth = ctx.width; + this.lastLayoutHeight = ctx.height; + const seriesArea = this.modulesManager.getModule("seriesArea"); + const seriesPaddedRect = seriesRect.clone().grow(seriesArea.getPadding()); + const clipRect = seriesArea.clip || clipSeries ? seriesPaddedRect : void 0; + const { lastUpdateClipRect } = this; + this.lastUpdateClipRect = clipRect; + if (this.ctx.animationManager.isActive() && lastUpdateClipRect != null) { + this.ctx.animationManager.animate({ + id: this.id, + groupId: "clip-rect", + phase: "update", + from: lastUpdateClipRect, + to: seriesPaddedRect, + onUpdate: (interpolatedClipRect) => this.setRootClipRects(interpolatedClipRect), + onComplete: () => this.setRootClipRects(clipRect) + }); + } else { + this.setRootClipRects(clipRect); + } + this.ctx.layoutManager.emitLayoutComplete(ctx, { + axes: this.axes.map((axis) => axis.getLayoutState()), + series: { + visible, + rect: seriesRect, + paddedRect: seriesPaddedRect + }, + clipSeries + }); + stackCartesianSeries(this.series); + } + updateAxes(layoutBox) { + const { clipSeries, seriesRect, overflows } = this.resolveAxesLayout(layoutBox); + for (const axis of this.axes) { + axis.update(); + axis.setCrossLinesVisible(!overflows); + this.clipAxis(axis, seriesRect, layoutBox); + } + return { clipSeries, seriesRect, visible: !overflows }; + } + // Iteratively try to resolve axis widths - since X axis width affects Y axis range, + // and vice-versa, we need to iteratively try and find a fit for the axes and their + // ticks/labels. + resolveAxesLayout(layoutBox) { + let newState; + let prevState; + let iterations = 0; + const maxIterations = 10; + const crossAtAxes = this.axes.filter((axis) => axis.crossAt?.value != null); + do { + prevState = newState ?? this.getDefaultState(); + newState = this.updateAxesPass(new Map(prevState.axisAreaWidths), layoutBox.clone(), crossAtAxes); + if (iterations++ > maxIterations) { + logger_exports.warn("Max iterations reached. Unable to stabilize axes layout."); + break; + } + } while (!this.isLayoutStable(newState, prevState)); + this.lastAreaWidths = newState.axisAreaWidths; + return newState; + } + updateAxesPass(axisAreaWidths, axisAreaBound, crossAtAxes) { + const axisWidths = /* @__PURE__ */ new Map(); + const primaryTickCounts = {}; + let overflows = false; + let clipSeries = false; + for (const dir of directions) { + const padding2 = this.modulesManager.getModule("seriesArea").getPadding()[dir]; + const axis = this.axes.findLast((a) => a.position === dir); + if (axis) { + axis.seriesAreaPadding = padding2; + } else { + axisAreaBound.shrink(padding2, dir); + } + } + const totalWidth = (axisAreaWidths.get("left") ?? 0) + (axisAreaWidths.get("right") ?? 0); + const totalHeight = (axisAreaWidths.get("top") ?? 0) + (axisAreaWidths.get("bottom") ?? 0); + const crossLinePadding = this.buildCrossLinePadding(axisAreaWidths); + const crossLineHPadding = crossLinePadding.left + crossLinePadding.right; + const crossLineVPadding = crossLinePadding.top + crossLinePadding.bottom; + if (axisAreaBound.width <= totalWidth + crossLineHPadding || axisAreaBound.height <= totalHeight + crossLineVPadding) { + overflows = true; + } else { + axisAreaBound.shrink(crossLinePadding); + } + const { scene } = this.ctx; + const seriesRect = axisAreaBound.clone().shrink(Object.fromEntries(axisAreaWidths)); + for (const axis of this.axes) { + const { position = "left", direction } = axis; + const isVertical = direction === "y" /* Y */; + let axisWidth; + this.sizeAxis(axis, seriesRect, position); + if (axis.thickness == null) { + const availableSize = getSize(isVertical, scene); + axisWidth = availableSize * (axis.maxThicknessRatio ?? 1); + } else { + axisWidth = axis.thickness; + } + const { primaryTickCount, bbox } = axis.calculateLayout( + axis.nice ? primaryTickCounts[direction] : void 0, + { sizeLimit: axisWidth - axis.label.spacing, padding: this.padding } + ); + primaryTickCounts[direction] ?? (primaryTickCounts[direction] = primaryTickCount); + clipSeries || (clipSeries = axis.dataDomain.clipped || axis.visibleRange[0] > 0 || axis.visibleRange[1] < 1); + if (axis.thickness == null) { + axisWidth = Math.min(getSize(isVertical, bbox) ?? 0, axisWidth); + } + axisWidths.set(axis.id, Math.ceil(axisWidth)); + } + let crossPositions; + if (crossAtAxes.length > 0) { + crossPositions = this.calculateAxesCrossPositions(axisWidths, seriesRect, crossAtAxes); + } + const axisGroups = groupBy(this.axes, (axis) => axis.position ?? "left"); + const newAxisAreaWidths = /* @__PURE__ */ new Map(); + const axisOffsets = /* @__PURE__ */ new Map(); + for (const [position, axes] of entries(axisGroups)) { + let currentOffset = getSize(position !== "left" && position !== "right", scene) % scene.pixelRatio; + let totalAxisWidth = 0; + for (const axis of axes ?? []) { + axisOffsets.set(axis.id, currentOffset); + const axisThickness = axisWidths.get(axis.id) ?? 0; + totalAxisWidth = Math.max(totalAxisWidth, currentOffset + axisThickness); + if (axis.layoutConstraints.stacked) { + currentOffset += axisThickness + _CartesianChart.AxesPadding; + } + } + newAxisAreaWidths.set(position, Math.ceil(totalAxisWidth)); + } + for (const [position, axes] of entries(axisGroups)) { + this.positionAxes({ + axes: axes ?? [], + position, + axisWidths, + axisOffsets, + axisAreaWidths: newAxisAreaWidths, + axisBound: axisAreaBound, + seriesRect + }); + } + if (crossPositions != null) { + this.applyAxisCrossing(seriesRect, crossPositions); + } + return { clipSeries, seriesRect, axisAreaWidths: newAxisAreaWidths, overflows }; + } + calculateAxesCrossPositions(axisWidths, seriesRect, crossAtAxes) { + const crossPositions = /* @__PURE__ */ new Map(); + const primaryXAxis = this.axes.find((axis) => axis.direction === "x" /* X */); + const primaryYAxis = this.axes.find((axis) => axis.direction === "y" /* Y */); + for (const axis of crossAtAxes) { + const { crossPosition, visible } = this.calculateAxisCrossPosition(axis, primaryXAxis, primaryYAxis); + axis.setAxisVisible(visible); + this.adjustAxisWidth(axis, axisWidths, crossPosition, seriesRect, visible); + if (crossPosition == void 0) + continue; + crossPositions.set(axis.id, crossPosition); + } + return crossPositions; + } + calculateAxisCrossPosition(axis, primaryXAxis, primaryYAxis) { + const perpendicularAxis = axis.direction === "x" /* X */ ? primaryYAxis : primaryXAxis; + if (!perpendicularAxis) + return { crossPosition: void 0, visible: true }; + const { + scale: { domain, bandwidth }, + range: range4 + } = perpendicularAxis; + const halfBandwidth = (bandwidth ?? 0) / 2; + const crossPosition = perpendicularAxis.scale.convert(axis.crossAt?.value, { clamp: false }) + halfBandwidth; + if (perpendicularAxis.inRange(crossPosition)) + return { crossPosition, visible: true }; + if (axis.crossAt?.sticky === false) { + return { crossPosition: void 0, visible: false }; + } + const clampedPosition = Number.isNaN(crossPosition) ? range4[domain[0]] : clampArray(crossPosition, range4); + return { crossPosition: clampedPosition, visible: true }; + } + adjustAxisWidth(axis, axisWidths, crossPosition, seriesRect, visible) { + const hasCrosshair = axis.getModuleMap().getModule("crosshair")?.enabled === true; + const annotationsEnabled = this.modulesManager.getModule("annotations")?.enabled === true; + const initialAnnotations = this.ctx.annotationManager.createMemento(); + const hasAnnotations = annotationsEnabled || initialAnnotations.some((annotation) => { + switch (annotation.type) { + case "vertical-line": + return axis.direction === "x" /* X */; + case "horizontal-line": + return axis.direction === "y" /* Y */; + default: + return false; + } + }); + if (hasCrosshair || hasAnnotations) + return; + const currentWidth = axisWidths.get(axis.id) ?? 0; + const adjustedWidth = visible ? this.calculateAxisBleedingWidth(axis, currentWidth, crossPosition, seriesRect) : 0; + axisWidths.set(axis.id, adjustedWidth); + } + calculateAxisBleedingWidth(axis, actualWidth, crossPosition, seriesRect) { + if (crossPosition == null) + return actualWidth; + switch (axis.position) { + case "left": + case "top": + return Math.max(0, actualWidth - crossPosition); + case "right": + return Math.max(0, crossPosition + actualWidth - seriesRect.width); + case "bottom": + return Math.max(0, crossPosition + actualWidth - seriesRect.height); + default: + return actualWidth; + } + } + applyAxisCrossing(seriesRect, crossPositions) { + for (const axis of this.axes) { + const crossPosition = crossPositions.get(axis.id); + if (crossPosition == null) { + axis.crossAxisTranslation.x = 0; + axis.crossAxisTranslation.y = 0; + continue; + } + const isXDirection = axis.direction === "x" /* X */; + axis.crossAxisTranslation.x = isXDirection ? 0 : seriesRect.x + crossPosition - axis.translation.x; + axis.crossAxisTranslation.y = isXDirection ? seriesRect.y + crossPosition - axis.translation.y : 0; + } + } + buildCrossLinePadding(axisAreaSize) { + var _a; + const crossLinePadding = { top: 0, right: 0, bottom: 0, left: 0 }; + for (const axis of this.axes) { + const { position, label } = axis; + if (axis.crossLines) { + for (const crossLine of axis.crossLines) { + if (crossLine instanceof CartesianCrossLine) { + crossLine.position = position ?? "top"; + (_a = crossLine.label).parallel ?? (_a.parallel = label.parallel); + } + crossLine.calculatePadding?.(crossLinePadding); + } + } + } + for (const [side, padding2 = 0] of entries(crossLinePadding)) { + crossLinePadding[side] = Math.max(padding2 - (axisAreaSize.get(side) ?? 0), 0); + } + return crossLinePadding; + } + clampToOutsideSeriesRect(seriesRect, value, dimension, direction) { + const bound = dimension === "x" ? seriesRect.x : seriesRect.y; + const size = dimension === "x" ? seriesRect.width : seriesRect.height; + return direction === 1 ? Math.min(value, bound + size) : Math.max(value, bound); + } + async getSyncedDomain(axis) { + const syncModule = this.modulesManager.getModule("sync"); + if (!syncModule?.enabled) + return; + return await syncModule.getSyncedDomain(axis); + } + syncAxisChanges(newValue, oldValue) { + const syncModule = this.modulesManager.getModule("sync"); + if (!syncModule?.enabled) + return; + const removed = new Set(oldValue ?? []); + for (const axis of newValue) { + removed.delete(axis); + } + for (const removedAxis of removed) { + syncModule.removeAxis(removedAxis); + } + } + sizeAxis(axis, seriesRect, position) { + const isNumberAxis = axis instanceof NumberAxis; + const isLeftRight = position === "left" || position === "right"; + const { width: width2, height: height2 } = seriesRect; + const maxEnd = isLeftRight ? height2 : width2; + let start2 = 0; + let end3 = maxEnd; + let { min, max } = this.ctx.zoomManager.getAxisZoom(axis.id); + const { width: axisWidth, unit, align: align2 } = axis.layoutConstraints; + if (unit === "px") { + end3 = start2 + axisWidth; + } else { + end3 = end3 * axisWidth / 100; + } + if (align2 === "end") { + start2 = maxEnd - (end3 - start2); + end3 = maxEnd; + } + if (isLeftRight) { + if (isNumberAxis) { + [start2, end3] = [end3, start2]; + } else { + [min, max] = [1 - max, 1 - min]; + } + } + axis.range = [start2, end3]; + axis.visibleRange = [min, max]; + axis.gridLength = isLeftRight ? width2 : height2; + } + positionAxes(opts) { + const { axes, axisBound, axisWidths, axisOffsets, axisAreaWidths, seriesRect, position } = opts; + const axisAreaWidth = axisAreaWidths.get(position) ?? 0; + let mainDimension = "x"; + let minorDimension = "y"; + let direction = 1; + if (position === "top" || position === "bottom") { + mainDimension = "y"; + minorDimension = "x"; + } + let axisBoundMainOffset = axisBound[mainDimension]; + if (position === "right" || position === "bottom") { + direction = -1; + axisBoundMainOffset += mainDimension === "x" ? axisBound.width : axisBound.height; + } + for (const axis of axes) { + const minorOffset = axisAreaWidths.get(minorDimension === "x" ? "left" : "top") ?? 0; + const axisThickness = axisWidths.get(axis.id) ?? 0; + const axisOffset = axisOffsets.get(axis.id) ?? 0; + axis.gridPadding = axisAreaWidth - axisOffset - axisThickness; + axis.translation[minorDimension] = axisBound[minorDimension] + minorOffset; + axis.translation[mainDimension] = this.clampToOutsideSeriesRect( + seriesRect, + axisBoundMainOffset + direction * (axisOffset + axisThickness), + mainDimension, + direction + ); + } + } + shouldFlipXY() { + return this.series.every((series) => series instanceof CartesianSeries && series.shouldFlipXY()); + } + getDefaultState() { + const axisAreaWidths = /* @__PURE__ */ new Map(); + if (this.lastAreaWidths) { + for (const { position = "left" } of this.axes) { + const areaWidth = this.lastAreaWidths.get(position); + if (areaWidth != null) { + axisAreaWidths.set(position, areaWidth); + } + } + } + return { axisAreaWidths, clipSeries: false, overflows: false }; + } + isLayoutStable(newState, prevState) { + if (prevState.overflows !== newState.overflows || prevState.clipSeries !== newState.clipSeries) { + return false; + } + for (const key of newState.axisAreaWidths.keys()) { + if (!prevState.axisAreaWidths.has(key)) { + return false; + } + } + for (const [p, w] of prevState.axisAreaWidths.entries()) { + const otherW = newState.axisAreaWidths.get(p); + if ((w != null || otherW != null) && w !== otherW) { + return false; + } + } + return true; + } + clipAxis(axis, seriesRect, layoutBBox) { + const gridLinePadding = Math.ceil(axis.gridLine?.width ?? 0); + const axisLinePadding = Math.ceil(axis.line?.width ?? 0); + let { width: width2, height: height2 } = seriesRect; + width2 += axis.direction === "x" /* X */ ? gridLinePadding : axisLinePadding; + height2 += axis.direction === "y" /* Y */ ? gridLinePadding : axisLinePadding; + axis.clipGrid(seriesRect.x, seriesRect.y, width2, height2); + switch (axis.position) { + case "left": + case "right": + axis.clipTickLines( + layoutBBox.x, + seriesRect.y - gridLinePadding, + layoutBBox.width + gridLinePadding, + seriesRect.height + gridLinePadding * 2 + ); + break; + case "top": + case "bottom": + axis.clipTickLines( + seriesRect.x - gridLinePadding, + layoutBBox.y, + seriesRect.width + gridLinePadding * 2, + layoutBBox.height + gridLinePadding + ); + break; + } + } +}; +_CartesianChart.className = "CartesianChart"; +_CartesianChart.type = "cartesian"; +_CartesianChart.AxesPadding = 15; +__decorateClass([ + ActionOnSet({ + changeValue(newValue, oldValue) { + this.onAxisChange(newValue, oldValue); + } + }) +], _CartesianChart.prototype, "axes", 2); +var CartesianChart = _CartesianChart; +function getSize(isVertical, bounds) { + return isVertical ? bounds?.width : bounds?.height; +} + +// packages/ag-charts-community/src/chart/chartOptionsDefs.ts +var commonChartOptions = { + mode: undocumented(union("integrated", "standalone")), + container: htmlElement, + context: () => true, + theme: defined, + series: array, + annotations: defined, + navigator: defined, + initialState: { + chartType: string, + annotations: defined, + legend: arrayOfDefs( + { + visible: boolean, + seriesId: string, + itemId: string, + legendItemName: string + }, + "legend state array" + ), + zoom: defined + } +}; +var cartesianChartOptionsDefs = { + ...commonChartOptionsDefs, + ...commonChartOptions, + axes: arrayLength(2), + data: array +}; +var polarChartOptionsDefs = { + ...commonChartOptionsDefs, + ...commonChartOptions, + axes: arrayLength(2), + data: array +}; +var topologyChartOptionsDefs = { + ...commonChartOptionsDefs, + ...commonChartOptions, + data: array, + topology: geoJson +}; +var standaloneChartOptionsDefs = { + ...commonChartOptionsDefs, + ...commonChartOptions, + data: array +}; + +// packages/ag-charts-community/src/chart/cartesianChartModule.ts +var histogramAxisTypes = /* @__PURE__ */ new Set(["number", "log", "time"]); +var validHistogramAxis = (axis) => isObject(axis) && !histogramAxisTypes.has(axis.type); +var CartesianChartModule = { + type: "chart", + name: "cartesian", + options: cartesianChartOptionsDefs, + detect: isAgCartesianChartOptions, + create(options, resources) { + return new CartesianChart(options, resources); + }, + validate(options, optionsDefs2, path) { + const additionalErrors = []; + if (options?.series?.[0]?.type === "histogram") { + if (options?.axes?.some(validHistogramAxis)) { + additionalErrors.push( + new ValidationError( + "invalid", + "only continuous axis types when histogram series is used", + options.axes, + path, + "axes" + ) + ); + options = without(options, ["axes"]); + } + } + const result = validate(options, optionsDefs2, path); + result.invalid.push(...additionalErrors); + return result; + } +}; + +// packages/ag-charts-community/src/chart/enterpriseChartModules.ts +var placeholderCreate = () => { + throw new Error("Enterprise module placeholder cannot be initialised"); +}; +var StandaloneChartModule = { + type: "chart", + name: "standalone", + placeholder: true, + options: {}, + detect: isAgStandaloneChartOptions, + create: placeholderCreate +}; +var TopologyChartModule = { + type: "chart", + name: "topology", + placeholder: true, + options: {}, + detect: isAgTopologyChartOptions, + create: placeholderCreate +}; + +// packages/ag-charts-community/src/chart/axis/polarAxis.ts +var PolarAxis = class extends Axis { + constructor() { + super(...arguments); + this.shape = "polygon"; + this.innerRadiusRatio = 0; + this.defaultTickMinSpacing = 20; + } + update() { + super.update(); + this.tickLineGroup.visible = this.tick.enabled; + this.tickLabelGroup.visible = this.label.enabled; + } + layoutCrossLines() { + const sideFlag = this.label.getSideFlag(); + const crosslinesVisible = this.hasDefinedDomain() || this.hasVisibleSeries(); + const { rotation, parallelFlipRotation, regularFlipRotation } = this.calculateRotations(); + for (const crossLine of this.crossLines) { + crossLine.sideFlag = -sideFlag; + crossLine.direction = rotation === -Math.PI / 2 ? "angle" /* Angle */ : "radius" /* Radius */; + crossLine.parallelFlipRotation = parallelFlipRotation; + crossLine.regularFlipRotation = regularFlipRotation; + crossLine.calculateLayout?.(crosslinesVisible, this.reverse); + } + } + updatePosition() { + super.updatePosition(); + const translationX = Math.floor(this.translation.x); + const translationY = Math.floor(this.translation.y); + this.tickLineGroup.translationX = translationX; + this.tickLineGroup.translationY = translationY; + this.tickLabelGroup.translationX = translationX; + this.tickLabelGroup.translationY = translationY; + this.crossLineRangeGroup.translationX = translationX; + this.crossLineRangeGroup.translationY = translationY; + this.crossLineLineGroup.translationX = translationX; + this.crossLineLineGroup.translationY = translationY; + this.crossLineLabelGroup.translationX = translationX; + this.crossLineLabelGroup.translationY = translationY; + this.tickLabelGroupSelection.each(resetAxisLabelSelectionFn()); + } + computeLabelsBBox(_options, _seriesRect) { + return null; + } + computeRange() { + } + getAxisLinePoints() { + return void 0; + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], PolarAxis.prototype, "shape", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], PolarAxis.prototype, "innerRadiusRatio", 2); + +// packages/ag-charts-community/src/chart/polarChart.ts +var PolarChart = class extends Chart { + constructor(options, resources) { + super(options, resources); + this.padding = new Padding(40); + this.ctx.axisManager.axisGroup.zIndex = 8 /* AXIS_FOREGROUND */; + } + getChartType() { + return "polar"; + } + async performLayout(ctx) { + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + this.seriesRoot.translationX = seriesRect.x; + this.seriesRoot.translationY = seriesRect.y; + await this.computeCircle(seriesRect); + for (const axis of this.axes) { + axis.update(); + } + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: true, rect: seriesRect, paddedRect: layoutBox } + }); + } + updateAxes(seriesBox, cx, cy, radius) { + const angleAxis = this.axes.find((axis) => axis.direction === "angle" /* Angle */); + const radiusAxis = this.axes.find((axis) => axis.direction === "radius" /* Radius */); + if (!(angleAxis instanceof PolarAxis) || !(radiusAxis instanceof PolarAxis)) + return; + const angleScale = angleAxis.scale; + const innerRadiusRatio = radiusAxis.innerRadiusRatio; + angleAxis.innerRadiusRatio = innerRadiusRatio; + angleAxis.computeRange(); + angleAxis.gridLength = radius; + radiusAxis.gridAngles = angleScale.ticks({ + nice: angleAxis.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.map((value) => angleScale.convert(value)); + radiusAxis.gridRange = angleAxis.range; + radiusAxis.range = [radius, radius * innerRadiusRatio]; + for (const axis of [angleAxis, radiusAxis]) { + axis.translation.x = seriesBox.x + cx; + axis.translation.y = seriesBox.y + cy; + axis.calculateLayout(); + } + } + async computeCircle(seriesBox) { + const polarSeries = this.series.filter(isPolarSeries); + const polarAxes = this.axes.filter(isPolarAxis); + const setSeriesCircle = (cx, cy, r) => { + this.updateAxes(seriesBox, cx, cy, r); + for (const series of polarSeries) { + series.centerX = cx; + series.centerY = cy; + series.radius = r; + } + const pieSeries = polarSeries.filter((s) => s.type === "donut" || s.type === "pie"); + if (pieSeries.length > 1) { + const innerRadii = pieSeries.map((series) => { + const innerRadius = series.getInnerRadius(); + return { series, innerRadius }; + }).sort((a, b) => a.innerRadius - b.innerRadius); + innerRadii.at(-1).series.surroundingRadius = void 0; + for (let i = 0; i < innerRadii.length - 1; i++) { + innerRadii[i].series.surroundingRadius = innerRadii[i + 1].innerRadius; + } + } + }; + const centerX = seriesBox.width / 2; + const centerY = seriesBox.height / 2; + const initialRadius = Math.max(0, Math.min(seriesBox.width, seriesBox.height) / 2); + let radius = initialRadius; + setSeriesCircle(centerX, centerY, radius); + const shake = async ({ hideWhenNecessary = false } = {}) => { + const labelBoxes = []; + for (const series of iterate(polarAxes, polarSeries)) { + const box = await series.computeLabelsBBox({ hideWhenNecessary }, seriesBox); + if (box) { + labelBoxes.push(box); + } + } + if (labelBoxes.length === 0) { + setSeriesCircle(centerX, centerY, initialRadius); + return; + } + const labelBox = BBox.merge(labelBoxes); + const refined = this.refineCircle(labelBox, radius, seriesBox); + setSeriesCircle(refined.centerX, refined.centerY, refined.radius); + radius = refined.radius; + }; + await shake(); + await shake(); + await shake(); + await shake({ hideWhenNecessary: true }); + await shake({ hideWhenNecessary: true }); + for (const series of iterate(polarAxes, polarSeries)) { + await series.computeLabelsBBox({ hideWhenNecessary: true }, seriesBox); + } + return { radius, centerX, centerY }; + } + refineCircle(labelsBox, radius, seriesBox) { + const minCircleRatio = 0.5; + const circleLeft = -radius; + const circleTop = -radius; + const circleRight = radius; + const circleBottom = radius; + let padLeft = Math.max(0, circleLeft - labelsBox.x); + let padTop = Math.max(0, circleTop - labelsBox.y); + let padRight = Math.max(0, labelsBox.x + labelsBox.width - circleRight); + let padBottom = Math.max(0, labelsBox.y + labelsBox.height - circleBottom); + padLeft = padRight = Math.max(padLeft, padRight); + padTop = padBottom = Math.max(padTop, padBottom); + const availCircleWidth = seriesBox.width - padLeft - padRight; + const availCircleHeight = seriesBox.height - padTop - padBottom; + let newRadius = Math.min(availCircleWidth, availCircleHeight) / 2; + const minHorizontalRadius = minCircleRatio * seriesBox.width / 2; + const minVerticalRadius = minCircleRatio * seriesBox.height / 2; + const minRadius = Math.min(minHorizontalRadius, minVerticalRadius); + if (newRadius < minRadius) { + newRadius = minRadius; + const horizontalPadding = padLeft + padRight; + const verticalPadding = padTop + padBottom; + if (2 * newRadius + verticalPadding > seriesBox.height) { + const padHeight = seriesBox.height - 2 * newRadius; + if (Math.min(padTop, padBottom) * 2 > padHeight) { + padTop = padHeight / 2; + padBottom = padHeight / 2; + } else if (padTop > padBottom) { + padTop = padHeight - padBottom; + } else { + padBottom = padHeight - padTop; + } + } + if (2 * newRadius + horizontalPadding > seriesBox.width) { + const padWidth = seriesBox.width - 2 * newRadius; + if (Math.min(padLeft, padRight) * 2 > padWidth) { + padLeft = padWidth / 2; + padRight = padWidth / 2; + } else if (padLeft > padRight) { + padLeft = padWidth - padRight; + } else { + padRight = padWidth - padLeft; + } + } + } + const newWidth = padLeft + 2 * newRadius + padRight; + const newHeight = padTop + 2 * newRadius + padBottom; + return { + centerX: (seriesBox.width - newWidth) / 2 + padLeft + newRadius, + centerY: (seriesBox.height - newHeight) / 2 + padTop + newRadius, + radius: newRadius + }; + } +}; +PolarChart.className = "PolarChart"; +PolarChart.type = "polar"; +function isPolarSeries(series) { + return series instanceof PolarSeries; +} +function isPolarAxis(axis) { + return axis instanceof PolarAxis; +} + +// packages/ag-charts-community/src/chart/polarChartModule.ts +var PolarChartModule = { + type: "chart", + name: "polar", + options: polarChartOptionsDefs, + detect: isAgPolarChartOptions, + create(options, resources) { + return new PolarChart(options, resources); + }, + validate(options, optionsDefs2, path) { + const additionalErrors = []; + const baseType = options?.series?.[0]?.type; + if (baseType === "pie" || baseType === "donut") { + if (options?.axes) { + additionalErrors.push(new UnknownError([], options.axes, path, "axes")); + options = without(options, ["axes"]); + } + } + const result = validate(options, optionsDefs2, path); + result.invalid.push(...additionalErrors); + return result; + } +}; + +// packages/ag-charts-community/src/main-modules.ts +var AllCartesianCommunityModules = [ + CartesianChartModule, + NumberAxisModule, + LogAxisModule, + TimeAxisModule, + CategoryAxisModule, + GroupedCategoryAxisModule, + UnitTimeAxisModule, + NewAreaSeriesModule, + NewBarSeriesModule, + NewBubbleSeriesModule, + NewHistogramSeriesModule, + NewLineSeriesModule, + NewScatterSeriesModule +]; +var AllPolarCommunityModules = [PolarChartModule, NewDonutSeriesModule, NewPieSeriesModule]; +var AllCommunityModules = [ + ...AllCartesianCommunityModules, + ...AllPolarCommunityModules, + // Enterprise placeholders + StandaloneChartModule, + TopologyChartModule, + // Presets + PriceVolumePresetModule, + GaugePresetModule, + SparklinePresetModule +]; + +// packages/ag-charts-community/src/util/pool.ts +var CLEANUP_TIMEOUT_MS = 1e3; +var _Pool = class _Pool { + constructor(name, buildItem, releaseItem, destroyItem, maxPoolSize, cleanupTimeMs = CLEANUP_TIMEOUT_MS) { + this.name = name; + this.buildItem = buildItem; + this.releaseItem = releaseItem; + this.destroyItem = destroyItem; + this.maxPoolSize = maxPoolSize; + this.cleanupTimeMs = cleanupTimeMs; + this.freePool = []; + this.busyPool = /* @__PURE__ */ new Set(); + } + static getPool(name, buildItem, releaseItem, destroyItem, maxPoolSize) { + if (!this.pools.has(name)) { + this.pools.set(name, new _Pool(name, buildItem, releaseItem, destroyItem, maxPoolSize)); + } + return this.pools.get(name); + } + isFull() { + return this.freePool.length + this.busyPool.size >= this.maxPoolSize; + } + hasFree() { + return this.freePool.length > 0; + } + obtain(params) { + if (!this.hasFree() && this.isFull()) { + throw new Error("AG Charts - pool exhausted"); + } + let nextFree = this.freePool.pop(); + if (nextFree == null) { + nextFree = this.buildItem(params); + _Pool.debug(() => [ + `Pool[name=${this.name}]: Created instance (${this.freePool.length} / ${this.busyPool.size + 1} / ${this.maxPoolSize})`, + nextFree + ]); + } else { + _Pool.debug(() => [ + `Pool[name=${this.name}]: Re-used instance (${this.freePool.length} / ${this.busyPool.size + 1} / ${this.maxPoolSize})`, + nextFree + ]); + } + this.busyPool.add(nextFree); + return { item: nextFree, release: () => this.release(nextFree) }; + } + obtainFree() { + const nextFree = this.freePool.pop(); + if (nextFree == null) { + throw new Error("AG Charts - pool has no free instances"); + } + _Pool.debug(() => [ + `Pool[name=${this.name}]: Re-used instance (${this.freePool.length} / ${this.busyPool.size + 1} / ${this.maxPoolSize})`, + nextFree + ]); + this.busyPool.add(nextFree); + return { item: nextFree, release: () => this.release(nextFree) }; + } + release(item) { + if (!this.busyPool.has(item)) { + throw new Error("AG Charts - cannot free item from pool which is not tracked as busy."); + } + _Pool.debug(() => [ + `Pool[name=${this.name}]: Releasing instance (${this.freePool.length} / ${this.busyPool.size} / ${this.maxPoolSize})`, + item + ]); + this.releaseItem(item); + this.busyPool.delete(item); + this.freePool.push(item); + _Pool.debug(() => [ + `Pool[name=${this.name}]: Returned instance to free pool (${this.freePool.length} / ${this.busyPool.size} / ${this.maxPoolSize})`, + item + ]); + const now = Date.now(); + const earliestClean = now + this.cleanupTimeMs * 0.5; + if (this.cleanPoolTimer && (this.cleanPoolDue ?? Infinity) < earliestClean) { + clearTimeout(this.cleanPoolTimer); + this.cleanPoolTimer = void 0; + } + if (!this.cleanPoolTimer) { + this.cleanPoolDue = now + this.cleanupTimeMs; + this.cleanPoolTimer = setTimeout(this.cleanPool.bind(this), this.cleanupTimeMs); + } + } + cleanPool() { + const itemsToFree = this.freePool.splice(0); + for (const item of itemsToFree) { + this.destroyItem(item); + } + _Pool.debug(() => [ + `Pool[name=${this.name}]: Cleaned pool of ${itemsToFree.length} items (${this.freePool.length} / ${this.busyPool.size} / ${this.maxPoolSize})` + ]); + } + destroy() { + this.cleanPool(); + for (const item of this.busyPool.values()) { + this.destroyItem(item); + } + this.busyPool.clear(); + } +}; +_Pool.pools = /* @__PURE__ */ new Map(); +_Pool.debug = Debug.create(true, "pool"); +var Pool = _Pool; + +// packages/ag-charts-community/src/api/agCharts.ts +moduleRegistry_exports.registerMany(AllCommunityModules, VERSION); +var debug4 = Debug.create(true, "opts"); +var AgCharts = class { + static licenseCheck(options) { + if (this.licenseChecked) + return; + this.licenseManager = enterpriseModule.licenseManager?.(options); + this.licenseManager?.validateLicense(); + this.licenseChecked = true; + } + static getLicenseDetails(licenseKey) { + return enterpriseModule.licenseManager?.({}).getLicenseDetails(licenseKey); + } + /** + * Returns the `AgChartInstance` for a DOM node, if there is one. + */ + static getInstance(element2) { + return AgChartsInternal.getInstance(element2); + } + /** + * Create a new `AgChartInstance` based upon the given configuration options. + */ + static create(userOptions, optionsMetadata) { + const apiStartTime = Debug.check("scene:stats", "scene:stats:verbose") ? performance.now() : void 0; + return debug4.group("AgCharts.create()", () => { + userOptions = Debug.inDevelopmentMode(() => deepFreeze(deepClone(userOptions))) ?? userOptions; + this.licenseCheck(userOptions); + const chart = AgChartsInternal.createOrUpdate({ + userOptions, + licenseManager: this.licenseManager, + optionsMetadata, + apiStartTime + }); + if (this.licenseManager?.isDisplayWatermark() && this.licenseManager) { + enterpriseModule.injectWatermark?.( + chart.chart.ctx.domManager, + this.licenseManager.getWatermarkMessage() + ); + } + return chart; + }); + } + static createFinancialChart(options) { + return debug4.group("AgCharts.createFinancialChart()", () => { + return this.create(options, { presetType: "price-volume" }); + }); + } + static createGauge(options) { + return debug4.group("AgCharts.createGauge()", () => { + return this.create(options, { presetType: "gauge-preset" }); + }); + } + static __createSparkline(options) { + return debug4.group("AgCharts.__createSparkline()", () => { + const { pool, ...normalOptions } = options; + return this.create(normalOptions, { + presetType: "sparkline", + pool: pool ?? true, + domMode: "minimal", + withDragInterpretation: false + }); + }); + } +}; +AgCharts.licenseChecked = false; +var _AgChartsInternal = class _AgChartsInternal { + static getInstance(element2) { + const chart = Chart.getInstance(element2); + return chart ? AgChartInstanceProxy.chartInstances.get(chart) : void 0; + } + static initialiseModules() { + if (_AgChartsInternal.initialised) + return; + registerInbuiltModules(); + setupModules(); + _AgChartsInternal.initialised = true; + } + static createOrUpdate(opts) { + let { proxy } = opts; + const { + userOptions, + licenseManager, + processedOverrides = proxy?.chart?.chartOptions.processedOverrides ?? {}, + specialOverrides = proxy?.chart?.chartOptions.specialOverrides ?? {}, + optionsMetadata = proxy?.chart?.chartOptions.optionMetadata ?? {}, + deltaOptions, + data, + stripSymbols = false, + apiStartTime + } = opts; + const styles = enterpriseModule.styles == null ? [] : [["ag-charts-enterprise", enterpriseModule.styles]]; + _AgChartsInternal.initialiseModules(); + debug4(() => [">>> AgCharts.createOrUpdate() user options", deepClone(userOptions)]); + const { presetType } = optionsMetadata; + let mutableOptions = userOptions; + if (AgCharts.optionsMutationFn && mutableOptions) { + mutableOptions = AgCharts.optionsMutationFn( + deepClone(mutableOptions, ChartOptions.OPTIONS_CLONE_OPTS_FAST), + presetType + ); + debug4(() => [">>> AgCharts.createOrUpdate() MUTATED user options", deepClone(mutableOptions)]); + } + const pool = this.getPool(optionsMetadata); + let create = false; + let poolResult; + let chart = proxy?.chart; + if (chart == null && pool?.hasFree()) { + poolResult = pool.obtainFree(); + chart = poolResult.item; + } + const { document: document2, window: userWindow, styleContainer, ...options } = mutableOptions ?? {}; + const baseOptions = chart?.getChartOptions(); + const chartOptions = new ChartOptions( + baseOptions, + options, + processedOverrides, + { + ...specialOverrides, + document: document2, + window: userWindow, + styleContainer + }, + optionsMetadata, + deltaOptions, + stripSymbols, + apiStartTime + ); + if (chart == null || moduleRegistry_exports.detectChartDefinition(chartOptions.processedOptions) !== moduleRegistry_exports.detectChartDefinition(chart.chartOptions.processedOptions)) { + poolResult?.release(); + poolResult = this.getPool(chartOptions.optionMetadata)?.obtain(chartOptions); + if (poolResult) { + chart = poolResult.item; + } else { + create = true; + chart = _AgChartsInternal.createChartInstance(chartOptions, chart); + } + } + if (chartOptions.optionsGraph) { + chart.ctx.optionsGraphService.updateCallback((path, partialOptions, resolveOptions) => { + return chartOptions.optionsGraph?.resolvePartial(path, partialOptions, resolveOptions); + }); + } + for (const [id, css] of styles) { + chart.ctx.domManager.addStyles(id, css); + } + chart.ctx.fontManager.updateFonts(chartOptions.googleFonts); + if (data != null) { + chart.ctx.dataService.restoreData(data); + } + if (proxy == null) { + proxy = new AgChartInstanceProxy(chart, _AgChartsInternal.callbackApi, licenseManager); + proxy.releaseChart = poolResult?.release; + } else if (poolResult || create) { + proxy.releaseChart?.(); + proxy.chart = chart; + proxy.releaseChart = poolResult?.release; + } + if (debug4.check() && typeof globalThis.window !== "undefined") { + globalThis.agChartInstances ?? (globalThis.agChartInstances = {}); + globalThis.agChartInstances[chart.id] = chart; + } + chart.queuedUserOptions.push(chartOptions.userOptions); + chart.queuedChartOptions.push(chartOptions); + chart.requestFactoryUpdate((chartRef) => { + debug4.group(">>>> Chart.applyOptions()", () => { + chartRef.applyOptions(chartOptions); + const queueIdx = chartRef.queuedUserOptions.indexOf(chartOptions.userOptions) + 1; + chartRef.queuedUserOptions.splice(0, queueIdx); + chartRef.queuedChartOptions.splice(0, queueIdx); + }); + }); + return proxy; + } + static markRemovedProperties(node, _, modified = false) { + if (typeof node !== "object") + return modified; + for (const key of Object.keys(node)) { + const value = node[key]; + if (value === void 0) { + Object.assign(node, { [key]: Symbol("UNSET") }); + modified || (modified = true); + } + } + return modified; + } + static updateUserDelta(proxy, deltaOptions, apiStartTime) { + deltaOptions = deepClone(deltaOptions, ChartOptions.OPTIONS_CLONE_OPTS_FAST); + const stripSymbols = jsonWalk( + deltaOptions, + _AgChartsInternal.markRemovedProperties, + /* @__PURE__ */ new Set(["data"]), + void 0, + void 0, + false + ); + debug4(() => [">>> AgCharts.updateUserDelta() user delta", deepClone(deltaOptions)]); + _AgChartsInternal.createOrUpdate({ + proxy, + deltaOptions, + stripSymbols, + apiStartTime + }); + } + static createChartInstance(options, oldChart) { + const transferableResource = oldChart?.destroy({ keepTransferableResources: true }); + const chartDef = moduleRegistry_exports.detectChartDefinition(options.processedOptions); + return chartDef.create(options, transferableResource); + } + static getPool(optionMetadata) { + if (optionMetadata.pool !== true) + return; + return Pool.getPool( + optionMetadata.presetType ?? "default", + this.createChartInstance, + this.detachAndClear, + this.destroy, + Infinity + // AG-13480 - Prevent Grid exhausting pool during sorting. + ); + } +}; +_AgChartsInternal.caretaker = new MementoCaretaker(VERSION); +_AgChartsInternal.initialised = false; +_AgChartsInternal.callbackApi = { + caretaker: _AgChartsInternal.caretaker, + create(userOptions, processedOverrides, specialOverrides, optionsMetadata, data) { + return _AgChartsInternal.createOrUpdate({ + userOptions, + processedOverrides, + specialOverrides, + optionsMetadata, + data + }); + }, + update(opts, chart, specialOverrides, apiStartTime) { + return _AgChartsInternal.createOrUpdate({ + userOptions: opts, + proxy: chart, + specialOverrides, + apiStartTime + }); + }, + updateUserDelta(chart, deltaOptions, apiStartTime) { + return _AgChartsInternal.updateUserDelta(chart, deltaOptions, apiStartTime); + } +}; +_AgChartsInternal.detachAndClear = (chart) => chart.detachAndClear(); +_AgChartsInternal.destroy = (chart) => chart.destroy(); +var AgChartsInternal = _AgChartsInternal; + +// packages/ag-charts-community/src/integrated-charts-scene.ts +var integrated_charts_scene_exports = {}; +__export(integrated_charts_scene_exports, { + Arc: () => Arc2, + BBox: () => BBox, + Caption: () => Caption, + CategoryScale: () => CategoryScale, + Group: () => Group, + Line: () => Line, + LinearScale: () => LinearScale, + Marker: () => Marker, + Path: () => Path, + RadialColumnShape: () => RadialColumnShape, + Rect: () => Rect, + Scene: () => Scene, + Sector: () => Sector, + Shape: () => Shape, + TranslatableGroup: () => TranslatableGroup, + getRadialColumnWidth: () => getRadialColumnWidth, + toRadians: () => toRadians +}); + +// packages/ag-charts-community/src/scene/shape/arc.ts +var Arc2 = class extends Path { + constructor() { + super(...arguments); + this.centerX = 0; + this.centerY = 0; + this.radius = 10; + this.startAngle = 0; + this.endAngle = Math.PI * 2; + this.counterClockwise = false; + this.type = 0 /* Open */; + } + get fullPie() { + return isNumberEqual(normalizeAngle360(this.startAngle), normalizeAngle360(this.endAngle)); + } + updatePath() { + const path = this.path; + path.clear(); + path.arc(this.centerX, this.centerY, this.radius, this.startAngle, this.endAngle, this.counterClockwise); + if (this.type === 1 /* Chord */) { + path.closePath(); + } else if (this.type === 2 /* Round */ && !this.fullPie) { + path.lineTo(this.centerX, this.centerY); + path.closePath(); + } + } + computeBBox() { + return new BBox(this.centerX - this.radius, this.centerY - this.radius, this.radius * 2, this.radius * 2); + } + isPointInPath(x, y) { + const bbox = this.getBBox(); + return this.type !== 0 /* Open */ && bbox.containsPoint(x, y) && this.path.isPointInPath(x, y); + } +}; +Arc2.className = "Arc"; +__decorateClass([ + SceneChangeDetection() +], Arc2.prototype, "centerX", 2); +__decorateClass([ + SceneChangeDetection() +], Arc2.prototype, "centerY", 2); +__decorateClass([ + SceneChangeDetection() +], Arc2.prototype, "radius", 2); +__decorateClass([ + SceneChangeDetection() +], Arc2.prototype, "startAngle", 2); +__decorateClass([ + SceneChangeDetection() +], Arc2.prototype, "endAngle", 2); +__decorateClass([ + SceneChangeDetection() +], Arc2.prototype, "counterClockwise", 2); +__decorateClass([ + SceneChangeDetection() +], Arc2.prototype, "type", 2); + +// packages/ag-charts-community/src/scene/shape/radialColumnShape.ts +function rotatePoint2(x, y, rotation) { + const radius = Math.hypot(x, y); + const angle2 = Math.atan2(y, x); + const rotated = angle2 + rotation; + return { + x: Math.cos(rotated) * radius, + y: Math.sin(rotated) * radius + }; +} +var RadialColumnShape = class extends Path { + constructor() { + super(...arguments); + this.isBeveled = true; + this.columnWidth = 0; + this.startAngle = 0; + this.endAngle = 0; + this.outerRadius = 0; + this.innerRadius = 0; + this.axisInnerRadius = 0; + this.axisOuterRadius = 0; + this.isRadiusAxisReversed = false; + } + set cornerRadius(_value) { + } + computeBBox() { + const { innerRadius, outerRadius, columnWidth } = this; + const rotation = this.getRotation(); + const left = -columnWidth / 2; + const right = columnWidth / 2; + const top = -outerRadius; + const bottom = -innerRadius; + let x0 = Infinity; + let y0 = Infinity; + let x1 = -Infinity; + let y1 = -Infinity; + for (let i = 0; i < 4; i += 1) { + const { x, y } = rotatePoint2(i % 2 === 0 ? left : right, i < 2 ? top : bottom, rotation); + x0 = Math.min(x, x0); + y0 = Math.min(y, y0); + x1 = Math.max(x, x1); + y1 = Math.max(y, y1); + } + return new BBox(x0, y0, x1 - x0, y1 - y0); + } + getRotation() { + const { startAngle, endAngle } = this; + const midAngle = angleBetween(startAngle, endAngle); + return normalizeAngle360(startAngle + midAngle / 2 + Math.PI / 2); + } + updatePath() { + const { isBeveled } = this; + if (isBeveled) { + this.updateBeveledPath(); + } else { + this.updateRectangularPath(); + } + this.checkPathDirty(); + } + updateRectangularPath() { + const { columnWidth, innerRadius, outerRadius, path } = this; + const left = -columnWidth / 2; + const right = columnWidth / 2; + const top = -outerRadius; + const bottom = -innerRadius; + const rotation = this.getRotation(); + const points = [ + [left, bottom], + [left, top], + [right, top], + [right, bottom] + ].map(([x, y]) => rotatePoint2(x, y, rotation)); + path.clear(true); + path.moveTo(points[0].x, points[0].y); + path.lineTo(points[1].x, points[1].y); + path.lineTo(points[2].x, points[2].y); + path.lineTo(points[3].x, points[3].y); + path.closePath(); + } + updateBeveledPath() { + const { columnWidth, path, outerRadius, innerRadius, axisInnerRadius, axisOuterRadius, isRadiusAxisReversed } = this; + const isStackBottom = isNumberEqual(innerRadius, axisInnerRadius); + const sideRotation = Math.asin(columnWidth / 2 / innerRadius); + const pointRotation = this.getRotation(); + const rotate2 = (x, y) => rotatePoint2(x, y, pointRotation); + const getTriangleHypotenuse = (leg, otherLeg) => Math.hypot(leg, otherLeg); + const getTriangleLeg = (hypotenuse, otherLeg) => { + if (otherLeg > hypotenuse) { + return 0; + } + return Math.sqrt(hypotenuse ** 2 - otherLeg ** 2); + }; + const compare = (value, otherValue, lessThan2) => lessThan2 ? value < otherValue : value > otherValue; + const shouldConnectBottomCircle = isStackBottom && !Number.isNaN(sideRotation) && sideRotation < Math.PI / 6; + let left = -columnWidth / 2; + let right = columnWidth / 2; + const top = -outerRadius; + const bottom = -innerRadius * (shouldConnectBottomCircle ? Math.cos(sideRotation) : 1); + const hasBottomIntersection = compare( + axisOuterRadius, + getTriangleHypotenuse(innerRadius, columnWidth / 2), + !isRadiusAxisReversed + ); + if (hasBottomIntersection) { + const bottomIntersectionX = getTriangleLeg(axisOuterRadius, innerRadius); + left = -bottomIntersectionX; + right = bottomIntersectionX; + } + path.clear(true); + const bottomLeftPt = rotate2(left, bottom); + path.moveTo(bottomLeftPt.x, bottomLeftPt.y); + const isEmpty = isNumberEqual(innerRadius, outerRadius); + const hasSideIntersection = compare( + axisOuterRadius, + getTriangleHypotenuse(outerRadius, columnWidth / 2), + !isRadiusAxisReversed + ); + if (isEmpty && shouldConnectBottomCircle) { + path.arc( + 0, + 0, + innerRadius, + normalizeAngle360(-sideRotation - Math.PI / 2) + pointRotation, + normalizeAngle360(sideRotation - Math.PI / 2) + pointRotation, + false + ); + } else if (hasSideIntersection) { + const sideIntersectionY = -getTriangleLeg(axisOuterRadius, columnWidth / 2); + const topIntersectionX = getTriangleLeg(axisOuterRadius, outerRadius); + if (!hasBottomIntersection) { + const topLeftPt = rotate2(left, sideIntersectionY); + path.lineTo(topLeftPt.x, topLeftPt.y); + } + path.arc( + 0, + 0, + axisOuterRadius, + Math.atan2(sideIntersectionY, left) + pointRotation, + Math.atan2(top, -topIntersectionX) + pointRotation, + false + ); + if (!isNumberEqual(topIntersectionX, 0)) { + const topRightBevelPt = rotate2(topIntersectionX, top); + path.lineTo(topRightBevelPt.x, topRightBevelPt.y); + } + path.arc( + 0, + 0, + axisOuterRadius, + Math.atan2(top, topIntersectionX) + pointRotation, + Math.atan2(sideIntersectionY, right) + pointRotation, + false + ); + } else { + const topLeftPt = rotate2(left, top); + const topRightPt = rotate2(right, top); + path.lineTo(topLeftPt.x, topLeftPt.y); + path.lineTo(topRightPt.x, topRightPt.y); + } + const bottomRightPt = rotate2(right, bottom); + path.lineTo(bottomRightPt.x, bottomRightPt.y); + if (shouldConnectBottomCircle) { + path.arc( + 0, + 0, + innerRadius, + normalizeAngle360(sideRotation - Math.PI / 2) + pointRotation, + normalizeAngle360(-sideRotation - Math.PI / 2) + pointRotation, + true + ); + } else { + const rotatedBottomLeftPt = rotate2(left, bottom); + path.lineTo(rotatedBottomLeftPt.x, rotatedBottomLeftPt.y); + } + path.closePath(); + } +}; +RadialColumnShape.className = "RadialColumnShape"; +__decorateClass([ + SceneChangeDetection() +], RadialColumnShape.prototype, "isBeveled", 2); +__decorateClass([ + SceneChangeDetection() +], RadialColumnShape.prototype, "columnWidth", 2); +__decorateClass([ + SceneChangeDetection() +], RadialColumnShape.prototype, "startAngle", 2); +__decorateClass([ + SceneChangeDetection() +], RadialColumnShape.prototype, "endAngle", 2); +__decorateClass([ + SceneChangeDetection() +], RadialColumnShape.prototype, "outerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], RadialColumnShape.prototype, "innerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], RadialColumnShape.prototype, "axisInnerRadius", 2); +__decorateClass([ + SceneChangeDetection() +], RadialColumnShape.prototype, "axisOuterRadius", 2); +__decorateClass([ + SceneChangeDetection() +], RadialColumnShape.prototype, "isRadiusAxisReversed", 2); +function getRadialColumnWidth(startAngle, endAngle, axisOuterRadius, columnWidthRatio, maxColumnWidthRatio) { + const rotation = angleBetween(startAngle, endAngle); + const pad2 = rotation * (1 - columnWidthRatio) / 2; + startAngle += pad2; + endAngle -= pad2; + if (rotation < 1e-3) { + return 2 * axisOuterRadius * maxColumnWidthRatio; + } + if (rotation >= 2 * Math.PI) { + const midAngle = startAngle + rotation / 2; + startAngle = midAngle - Math.PI; + endAngle = midAngle + Math.PI; + } + const startX = axisOuterRadius * Math.cos(startAngle); + const startY = axisOuterRadius * Math.sin(startAngle); + const endX = axisOuterRadius * Math.cos(endAngle); + const endY = axisOuterRadius * Math.sin(endAngle); + const colWidth = Math.floor(Math.hypot(startX - endX, startY - endY)); + const maxWidth = 2 * axisOuterRadius * maxColumnWidthRatio; + return Math.max(1, Math.min(maxWidth, colWidth)); +} + +// packages/ag-charts-community/src/integrated-charts-theme.ts +var integrated_charts_theme_exports = {}; +__export(integrated_charts_theme_exports, { + ChartTheme: () => ChartTheme, + DEFAULT_ANNOTATION_HANDLE_FILL: () => DEFAULT_ANNOTATION_HANDLE_FILL, + DEFAULT_ANNOTATION_STATISTICS_COLOR: () => DEFAULT_ANNOTATION_STATISTICS_COLOR, + DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE: () => DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE, + DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL: () => DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, + DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE: () => DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE, + DEFAULT_ANNOTATION_STATISTICS_FILL: () => DEFAULT_ANNOTATION_STATISTICS_FILL, + DEFAULT_ANNOTATION_STATISTICS_STROKE: () => DEFAULT_ANNOTATION_STATISTICS_STROKE, + DEFAULT_CAPTION_ALIGNMENT: () => DEFAULT_CAPTION_ALIGNMENT, + DEFAULT_CAPTION_LAYOUT_STYLE: () => DEFAULT_CAPTION_LAYOUT_STYLE, + DEFAULT_FIBONACCI_STROKES: () => DEFAULT_FIBONACCI_STROKES, + DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL: () => DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR: () => DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, + DEFAULT_GRIDLINE_ENABLED: () => DEFAULT_GRIDLINE_ENABLED, + DEFAULT_POLAR_SERIES_STROKE: () => DEFAULT_POLAR_SERIES_STROKE, + DEFAULT_SEPARATION_LINES_COLOUR: () => DEFAULT_SEPARATION_LINES_COLOUR, + DEFAULT_SHADOW_COLOUR: () => DEFAULT_SHADOW_COLOUR, + DEFAULT_SPARKLINE_CROSSHAIR_STROKE: () => DEFAULT_SPARKLINE_CROSSHAIR_STROKE, + DEFAULT_TEXTBOX_COLOR: () => DEFAULT_TEXTBOX_COLOR, + DEFAULT_TEXTBOX_FILL: () => DEFAULT_TEXTBOX_FILL, + DEFAULT_TEXTBOX_STROKE: () => DEFAULT_TEXTBOX_STROKE, + DEFAULT_TEXT_ANNOTATION_COLOR: () => DEFAULT_TEXT_ANNOTATION_COLOR, + DEFAULT_TOOLBAR_POSITION: () => DEFAULT_TOOLBAR_POSITION, + IS_DARK_THEME: () => IS_DARK_THEME, + PALETTE_ALT_DOWN_FILL: () => PALETTE_ALT_DOWN_FILL, + PALETTE_ALT_DOWN_STROKE: () => PALETTE_ALT_DOWN_STROKE, + PALETTE_ALT_NEUTRAL_FILL: () => PALETTE_ALT_NEUTRAL_FILL, + PALETTE_ALT_NEUTRAL_STROKE: () => PALETTE_ALT_NEUTRAL_STROKE, + PALETTE_ALT_UP_FILL: () => PALETTE_ALT_UP_FILL, + PALETTE_ALT_UP_STROKE: () => PALETTE_ALT_UP_STROKE, + PALETTE_DOWN_FILL: () => PALETTE_DOWN_FILL, + PALETTE_DOWN_STROKE: () => PALETTE_DOWN_STROKE, + PALETTE_NEUTRAL_FILL: () => PALETTE_NEUTRAL_FILL, + PALETTE_NEUTRAL_STROKE: () => PALETTE_NEUTRAL_STROKE, + PALETTE_UP_FILL: () => PALETTE_UP_FILL, + PALETTE_UP_STROKE: () => PALETTE_UP_STROKE, + getChartTheme: () => getChartTheme, + resolveOperation: () => resolveOperation, + themeNames: () => themeNames, + themeSymbols: () => symbols_exports, + themes: () => themes +}); +var themeNames = Object.keys(themes); +function resolveOperation(operation) { + const params = ChartTheme.getDefaultPublicParameters(); + const palette = ChartTheme.getDefaultColors(); + const graph = new OptionsGraph({ line: { operation } }, { series: [{ type: "line" }] }, params, palette); + const resolved = graph.resolve(); + return resolved.operation; +} + +// packages/ag-charts-community/src/integrated-charts-util.ts +var integrated_charts_util_exports = {}; +__export(integrated_charts_util_exports, { + Color: () => Color, + interpolateColor: () => interpolateColor +}); + +// packages/ag-charts-community/src/util/time-interop.ts +function createTimeInterval(unit, step, epoch, utc) { + return { + unit, + step, + epoch, + utc, + every(count) { + return createTimeInterval(this.unit, (this.step ?? 1) * count, this.epoch, this.utc); + } + }; +} +var cachedInstances = {}; +function getTimeInterval(unit, step = 1, epoch, utc = false) { + logger_exports.warnOnce("time import is deprecated, use object notation instead"); + const key = `${unit}:${step}:${epoch?.getTime() ?? 0}:${utc}`; + let instance = cachedInstances[key]; + if (instance == null) { + instance = createTimeInterval(unit, step, epoch, utc); + cachedInstances[key] = instance; + } + return instance; +} +var time2 = { + get millisecond() { + return getTimeInterval("millisecond"); + }, + get second() { + return getTimeInterval("second"); + }, + get minute() { + return getTimeInterval("minute"); + }, + get hour() { + return getTimeInterval("hour"); + }, + get day() { + return getTimeInterval("day"); + }, + get monday() { + return getTimeInterval("day", 7, new Date(1970, 0, 5)); + }, + get tuesday() { + return getTimeInterval("day", 7, new Date(1970, 0, 6)); + }, + get wednesday() { + return getTimeInterval("day", 7, new Date(1970, 0, 7)); + }, + get thursday() { + return getTimeInterval("day", 7, new Date(1970, 0, 1)); + }, + get friday() { + return getTimeInterval("day", 7, new Date(1970, 0, 2)); + }, + get saturday() { + return getTimeInterval("day", 7, new Date(1970, 0, 3)); + }, + get sunday() { + return getTimeInterval("day", 7, new Date(1970, 0, 4)); + }, + get month() { + return getTimeInterval("month"); + }, + get year() { + return getTimeInterval("year"); + }, + get utcMillisecond() { + return getTimeInterval("millisecond", 1, void 0, true); + }, + get utcSecond() { + return getTimeInterval("second", 1, void 0, true); + }, + get utcMinute() { + return getTimeInterval("minute", 1, void 0, true); + }, + get utcHour() { + return getTimeInterval("hour", 1, void 0, true); + }, + get utcDay() { + return getTimeInterval("day", 1, void 0, true); + }, + get utcMonth() { + return getTimeInterval("month", 1, void 0, true); + }, + get utcYear() { + return getTimeInterval("year", 1, void 0, true); + } +}; + +// packages/ag-charts-community/src/module-support.ts +var module_support_exports = {}; +__export(module_support_exports, { + AGGREGATION_INDEX_X_MAX: () => AGGREGATION_INDEX_X_MAX, + AGGREGATION_INDEX_X_MIN: () => AGGREGATION_INDEX_X_MIN, + AGGREGATION_INDEX_Y_MAX: () => AGGREGATION_INDEX_Y_MAX, + AGGREGATION_INDEX_Y_MIN: () => AGGREGATION_INDEX_Y_MIN, + AGGREGATION_SPAN: () => AGGREGATION_SPAN, + AbstractBarSeries: () => AbstractBarSeries, + AbstractBarSeriesProperties: () => AbstractBarSeriesProperties, + ActionOnSet: () => ActionOnSet, + AnchoredPopover: () => AnchoredPopover, + Animation: () => Animation, + AnimationManager: () => AnimationManager, + Arc: () => Arc2, + Axis: () => Axis, + AxisGroupZIndexMap: () => AxisGroupZIndexMap, + AxisInterval: () => AxisInterval, + AxisLabel: () => AxisLabel, + AxisTick: () => AxisTick, + BASE_FONT_SIZE: () => BASE_FONT_SIZE, + BBox: () => BBox, + Background: () => Background, + BackgroundModule: () => BackgroundModule, + BandScale: () => BandScale, + BarSeries: () => BarSeries, + BarSeriesModule: () => BarSeriesModule, + BaseModuleInstance: () => BaseModuleInstance, + BaseProperties: () => BaseProperties, + BaseToolbar: () => BaseToolbar, + Border: () => Border, + ButtonWidget: () => ButtonWidget, + CallbackCache: () => CallbackCache, + Caption: () => Caption, + CartesianAxis: () => CartesianAxis, + CartesianCrossLine: () => CartesianCrossLine, + CartesianSeries: () => CartesianSeries, + CartesianSeriesNodeEvent: () => CartesianSeriesNodeEvent, + CartesianSeriesProperties: () => CartesianSeriesProperties, + CategoryAxis: () => CategoryAxis, + CategoryScale: () => CategoryScale, + ChangeDetectableProperties: () => ChangeDetectableProperties, + Chart: () => Chart, + ChartAxisDirection: () => ChartAxisDirection, + ChartOptions: () => ChartOptions, + ChartUpdateType: () => ChartUpdateType, + CollapseMode: () => CollapseMode, + Color: () => Color, + ColorScale: () => ColorScale, + ConicGradient: () => ConicGradient, + ContextMenuBuiltins: () => ContextMenuBuiltins, + ContextMenuRegistry: () => ContextMenuRegistry, + ContinuousScale: () => ContinuousScale, + DEFAULT_CARTESIAN_DIRECTION_KEYS: () => DEFAULT_CARTESIAN_DIRECTION_KEYS, + DEFAULT_CARTESIAN_DIRECTION_NAMES: () => DEFAULT_CARTESIAN_DIRECTION_NAMES, + DEFAULT_POLAR_DIRECTION_KEYS: () => DEFAULT_POLAR_DIRECTION_KEYS, + DEFAULT_POLAR_DIRECTION_NAMES: () => DEFAULT_POLAR_DIRECTION_NAMES, + DEFAULT_TOOLTIP_CLASS: () => DEFAULT_TOOLTIP_CLASS, + DEFAULT_TOOLTIP_DARK_CLASS: () => DEFAULT_TOOLTIP_DARK_CLASS, + DIRECTION_SWAP_AXES: () => DIRECTION_SWAP_AXES, + DOMManager: () => DOMManager, + DataChangeDescription: () => DataChangeDescription, + DataController: () => DataController, + DataModel: () => DataModel, + DataModelSeries: () => DataModelSeries, + DataService: () => DataService, + DataSet: () => DataSet, + Debug: () => Debug, + Deprecated: () => Deprecated, + DeprecatedAndRenamedTo: () => DeprecatedAndRenamedTo, + DiscreteTimeAxis: () => DiscreteTimeAxis, + DiscreteTimeScale: () => DiscreteTimeScale, + DragInterpreter: () => DragInterpreter, + DraggablePopover: () => DraggablePopover, + DropShadow: () => DropShadow, + ExtendedPath2D: () => ExtendedPath2D, + FILL_GRADIENT_BLANK_DEFAULTS: () => FILL_GRADIENT_BLANK_DEFAULTS, + FILL_GRADIENT_CONIC_SERIES_DEFAULTS: () => FILL_GRADIENT_CONIC_SERIES_DEFAULTS, + FILL_GRADIENT_LINEAR_DEFAULTS: () => FILL_GRADIENT_LINEAR_DEFAULTS, + FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS: () => FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS, + FILL_GRADIENT_LINEAR_KEYED_DEFAULTS: () => FILL_GRADIENT_LINEAR_KEYED_DEFAULTS, + FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS: () => FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS, + FILL_GRADIENT_RADIAL_DEFAULTS: () => FILL_GRADIENT_RADIAL_DEFAULTS, + FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS: () => FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS, + FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS: () => FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS: () => FILL_GRADIENT_RADIAL_SERIES_DEFAULTS, + FILL_IMAGE_BLANK_DEFAULTS: () => FILL_IMAGE_BLANK_DEFAULTS, + FILL_IMAGE_DEFAULTS: () => FILL_IMAGE_DEFAULTS, + FILL_PATTERN_BLANK_DEFAULTS: () => FILL_PATTERN_BLANK_DEFAULTS, + FILL_PATTERN_DEFAULTS: () => FILL_PATTERN_DEFAULTS, + FILL_PATTERN_HIERARCHY_DEFAULTS: () => FILL_PATTERN_HIERARCHY_DEFAULTS, + FILL_PATTERN_KEYED_DEFAULTS: () => FILL_PATTERN_KEYED_DEFAULTS, + FILL_PATTERN_SINGLE_DEFAULTS: () => FILL_PATTERN_SINGLE_DEFAULTS, + FONT_SIZE: () => FONT_SIZE, + FONT_SIZE_RATIO: () => FONT_SIZE_RATIO, + FillGradientDefaults: () => FillGradientDefaults, + FillImageDefaults: () => FillImageDefaults, + FillPatternDefaults: () => FillPatternDefaults, + FloatingToolbar: () => FloatingToolbar, + FormatManager: () => FormatManager, + Gradient: () => Gradient, + Group: () => Group, + GroupedCategoryAxis: () => GroupedCategoryAxis, + HdpiCanvas: () => HdpiCanvas, + HierarchyNode: () => HierarchyNode, + HierarchySeries: () => HierarchySeries, + HierarchySeriesProperties: () => HierarchySeriesProperties, + HighlightManager: () => HighlightManager, + HighlightProperties: () => HighlightProperties, + HighlightState: () => HighlightState, + HighlightStyle: () => HighlightStyle, + Image: () => Image3, + InteractionManager: () => InteractionManager, + InteractionState: () => InteractionState, + InterpolationProperties: () => InterpolationProperties, + Invalidating: () => Invalidating, + LABEL_BOXING_DEFAULTS: () => LABEL_BOXING_DEFAULTS, + LARGEST_KEY_INTERVAL: () => LARGEST_KEY_INTERVAL, + LEGEND_CONTAINER_THEME: () => LEGEND_CONTAINER_THEME, + Label: () => Label, + LayoutElement: () => LayoutElement, + LayoutManager: () => LayoutManager, + LegendMarkerLabel: () => LegendMarkerLabel, + Line: () => Line, + LineSeries: () => LineSeries, + LineSeriesModule: () => LineSeriesModule, + LinearGradient: () => LinearGradient, + LinearScale: () => LinearScale, + LogScale: () => LogScale, + LonLatBBox: () => LonLatBBox, + MIN_CATEGORY_SPACING: () => MIN_CATEGORY_SPACING, + Marker: () => Marker, + Menu: () => Menu, + MenuItemRadioWidget: () => MenuItemRadioWidget, + MenuItemWidget: () => MenuItemWidget, + MenuWidget: () => MenuWidget, + MercatorScale: () => MercatorScale, + ModuleRegistry: () => moduleRegistry_exports, + Motion: () => easing_exports, + NODE_UPDATE_STATE_TO_PHASE_MAPPING: () => NODE_UPDATE_STATE_TO_PHASE_MAPPING, + NativeWidget: () => NativeWidget, + NewAreaSeriesModule: () => NewAreaSeriesModule, + NewBarSeriesModule: () => NewBarSeriesModule, + NewBubbleSeriesModule: () => NewBubbleSeriesModule, + NewHistogramSeriesModule: () => NewHistogramSeriesModule, + NewLineSeriesModule: () => NewLineSeriesModule, + NewScatterSeriesModule: () => NewScatterSeriesModule, + NiceMode: () => NiceMode, + Node: () => Node2, + NumberAxis: () => NumberAxis, + ObserveChanges: () => ObserveChanges, + OrdinalTimeScale: () => OrdinalTimeScale, + PHASE_METADATA: () => PHASE_METADATA, + PHASE_ORDER: () => PHASE_ORDER, + PREV_NEXT_KEYS: () => PREV_NEXT_KEYS, + Padding: () => Padding, + ParallelStateMachine: () => ParallelStateMachine, + Path: () => Path, + PointerEvents: () => PointerEvents, + PolarAxis: () => PolarAxis, + PolarSeries: () => PolarSeries, + PolarZIndexMap: () => PolarZIndexMap, + Popover: () => Popover, + PropertiesArray: () => PropertiesArray, + Property: () => addFakeTransformToInstanceProperty, + ProxyInteractionService: () => ProxyInteractionService, + ProxyOnWrite: () => ProxyOnWrite, + ProxyProperty: () => ProxyProperty, + ProxyPropertyOnWrite: () => ProxyPropertyOnWrite, + QUICK_TRANSITION: () => QUICK_TRANSITION, + QuadtreeNearest: () => QuadtreeNearest, + RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD: () => RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD, + RadialColumnShape: () => RadialColumnShape, + Range: () => Range, + Rect: () => Rect, + RepeatType: () => RepeatType, + Rotatable: () => Rotatable, + RotatableGroup: () => RotatableGroup, + RotatableText: () => RotatableText, + SAFE_FILLS_OPERATION: () => SAFE_FILLS_OPERATION, + SAFE_FILL_OPERATION: () => SAFE_FILL_OPERATION, + SAFE_RANGE2_OPERATION: () => SAFE_RANGE2_OPERATION, + SAFE_STROKE_FILL_OPERATION: () => SAFE_STROKE_FILL_OPERATION, + SEGMENTATION_DEFAULTS: () => SEGMENTATION_DEFAULTS, + SKIP_JS_BUILTINS: () => SKIP_JS_BUILTINS, + SMALLEST_KEY_INTERVAL: () => SMALLEST_KEY_INTERVAL, + SORT_DOMAIN_GROUPS: () => SORT_DOMAIN_GROUPS, + Scalable: () => Scalable, + ScalableGroup: () => ScalableGroup, + ScaleAlignment: () => ScaleAlignment, + Scene: () => Scene, + SceneArrayChangeDetection: () => SceneArrayChangeDetection, + SceneChangeDetection: () => SceneChangeDetection, + SceneObjectChangeDetection: () => SceneObjectChangeDetection, + SceneRefChangeDetection: () => SceneRefChangeDetection, + Sector: () => Sector, + SectorBox: () => SectorBox, + SegmentOptions: () => SegmentOptions, + Segmentation: () => Segmentation, + SegmentedPath: () => SegmentedPath, + Selection: () => Selection, + Series: () => Series, + SeriesContentZIndexMap: () => SeriesContentZIndexMap, + SeriesGroupingChangedEvent: () => SeriesGroupingChangedEvent, + SeriesItemHighlightStyle: () => SeriesItemHighlightStyle, + SeriesMarker: () => SeriesMarker, + SeriesNodeEvent: () => SeriesNodeEvent, + SeriesNodePickMode: () => SeriesNodePickMode, + SeriesProperties: () => SeriesProperties, + SeriesTooltip: () => SeriesTooltip, + SeriesZIndexMap: () => SeriesZIndexMap, + Shape: () => Shape, + SliderWidget: () => SliderWidget, + SpanJoin: () => SpanJoin, + StateMachine: () => StateMachine, + StateMachineProperty: () => StateMachineProperty, + StopProperties: () => StopProperties, + SvgPath: () => SvgPath, + TIME_AXIS_KEYS: () => TIME_AXIS_KEYS, + TRIPLE_EQ: () => TRIPLE_EQ, + Text: () => Text, + ThemeConstants: () => constants_exports, + ThemeSymbols: () => symbols_exports, + TimeAxisParentLevel: () => TimeAxisParentLevel, + TimeScale: () => TimeScale, + Toolbar: () => Toolbar, + ToolbarButtonProperties: () => ToolbarButtonProperties, + ToolbarButtonWidget: () => ToolbarButtonWidget, + ToolbarWidget: () => ToolbarWidget, + Tooltip: () => Tooltip, + TooltipManager: () => TooltipManager, + TooltipPosition: () => TooltipPosition, + Transformable: () => Transformable, + TransformableGroup: () => TransformableGroup, + TransformableText: () => TransformableText, + Translatable: () => Translatable, + TranslatableGroup: () => TranslatableGroup, + TranslatableSvgPath: () => TranslatableSvgPath, + UnitTimeScale: () => UnitTimeScale, + UpdateService: () => UpdateService, + Vec2: () => Vec2, + Vec4: () => Vec4, + WIDGET_HTML_EVENTS: () => WIDGET_HTML_EVENTS, + Widget: () => Widget, + WidgetEventUtil: () => WidgetEventUtil, + ZIndexMap: () => ZIndexMap, + ZoomManager: () => ZoomManager, + accumulateGroup: () => accumulateGroup, + accumulatedValue: () => accumulatedValue, + accumulativeValueProperty: () => accumulativeValueProperty, + addEscapeEventListener: () => addEscapeEventListener, + addHitTestersToQuadtree: () => addHitTestersToQuadtree, + addMouseCloseListener: () => addMouseCloseListener, + addOverrideFocusVisibleEventListener: () => addOverrideFocusVisibleEventListener, + addTouchCloseListener: () => addTouchCloseListener, + adjustLabelPlacement: () => adjustLabelPlacement, + aggregationDomain: () => aggregationDomain, + aggregationIndexForXRatio: () => aggregationIndexForXRatio, + aggregationRangeFittingPoints: () => aggregationRangeFittingPoints, + aggregationXRatioForDatumIndex: () => aggregationXRatioForDatumIndex, + aggregationXRatioForXValue: () => aggregationXRatioForXValue, + angleBetween: () => angleBetween, + angleCategoryAxisOptionsDefs: () => angleCategoryAxisOptionsDefs, + angleNumberAxisOptionsDefs: () => angleNumberAxisOptionsDefs, + angularPadding: () => angularPadding, + animationValidation: () => animationValidation, + annotationCalloutStylesDefs: () => annotationCalloutStylesDefs, + annotationChannelStyleDefs: () => annotationChannelStyleDefs, + annotationChannelTextDefs: () => annotationChannelTextDefs, + annotationCommentStylesDefs: () => annotationCommentStylesDefs, + annotationCrossLineStyleDefs: () => annotationCrossLineStyleDefs, + annotationDisjointChannelStyleDefs: () => annotationDisjointChannelStyleDefs, + annotationFibonacciStylesDefs: () => annotationFibonacciStylesDefs, + annotationLineStyleDefs: () => annotationLineStyleDefs, + annotationLineTextDefs: () => annotationLineTextDefs, + annotationMeasurerStylesDefs: () => annotationMeasurerStylesDefs, + annotationNoteStylesDefs: () => annotationNoteStylesDefs, + annotationOptionsDef: () => annotationOptionsDef, + annotationParallelChannelStyleDefs: () => annotationParallelChannelStyleDefs, + annotationQuickMeasurerStylesDefs: () => annotationQuickMeasurerStylesDefs, + annotationShapeStylesDefs: () => annotationShapeStylesDefs, + annotationTextStylesDef: () => annotationTextStylesDef, + applyShapeFillBBox: () => applyShapeFillBBox, + applyShapeStyle: () => applyShapeStyle, + areScalingEqual: () => areScalingEqual, + area: () => area, + autoSizedLabelOptionsDefs: () => autoSizedLabelOptionsDefs, + axisLabelsOverlap: () => axisLabelsOverlap, + bezier2DDistance: () => bezier2DDistance, + bezier2DExtrema: () => bezier2DExtrema, + boxPlotHighlightStyleOptionsDef: () => boxPlotHighlightStyleOptionsDef, + boxPlotSeriesThemeableOptionsDef: () => boxPlotSeriesThemeableOptionsDef, + boxPlotStyleOptionsDef: () => boxPlotStyleOptionsDef, + buildResetPathFn: () => buildResetPathFn, + calculateDataDiff: () => calculateDataDiff, + calculateLabelRotation: () => calculateLabelRotation, + calculateLabelTranslation: () => calculateLabelTranslation, + calculatePlacement: () => calculatePlacement, + calculateSegments: () => calculateSegments, + callWithContext: () => callWithContext, + candlestickSeriesThemeableOptionsDef: () => candlestickSeriesThemeableOptionsDef, + cartesianAxisBandHighlightOptions: () => cartesianAxisBandHighlightOptions, + cartesianAxisCrosshairOptions: () => cartesianAxisCrosshairOptions, + cartesianAxisLabelOptionsDefs: () => cartesianAxisLabelOptionsDefs, + cartesianAxisOptionsDefs: () => cartesianAxisOptionsDefs, + cartesianChartOptionsDefs: () => cartesianChartOptionsDefs, + cartesianCrossLineOptionsDefs: () => cartesianCrossLineOptionsDefs, + cartesianNumericAxisLabel: () => cartesianNumericAxisLabel, + cartesianTimeAxisLabel: () => cartesianTimeAxisLabel, + cartesianTimeAxisParentLevel: () => cartesianTimeAxisParentLevel, + checkCrisp: () => checkCrisp, + chordSeriesThemeableOptionsDef: () => chordSeriesThemeableOptionsDef, + clampArray: () => clampArray, + clipSpanX: () => clipSpanX, + clippedRoundRect: () => clippedRoundRect, + collapseSpanToPoint: () => collapseSpanToPoint, + collapsedStartingBarPosition: () => collapsedStartingBarPosition, + commonAxisIntervalOptionsDefs: () => commonAxisIntervalOptionsDefs, + commonAxisLabelOptionsDefs: () => commonAxisLabelOptionsDefs, + commonAxisOptionsDefs: () => commonAxisOptionsDefs, + commonChartOptionsDefs: () => commonChartOptionsDefs, + commonCrossLineLabelOptionsDefs: () => commonCrossLineLabelOptionsDefs, + commonCrossLineOptionsDefs: () => commonCrossLineOptionsDefs, + commonSeriesOptionsDefs: () => commonSeriesOptionsDefs, + commonSeriesThemeableOptionsDefs: () => commonSeriesThemeableOptionsDefs, + compactAggregationIndices: () => compactAggregationIndices, + compareDates: () => compareDates, + computeBarFocusBounds: () => computeBarFocusBounds, + computeMarkerFocusBounds: () => computeMarkerFocusBounds, + coneFunnelSeriesThemeableOptionsDef: () => coneFunnelSeriesThemeableOptionsDef, + continuousAxisOptions: () => continuousAxisOptions, + countExpandingSearch: () => countExpandingSearch, + createAggregationIndices: () => createAggregationIndices, + createButton: () => createButton, + createCheckbox: () => createCheckbox, + createDatumId: () => createDatumId, + createDeprecationWarning: () => createDeprecationWarning, + createIcon: () => createIcon, + createIdsGenerator: () => createIdsGenerator, + createSelect: () => createSelect, + createTextArea: () => createTextArea, + dateToNumber: () => dateToNumber, + dateTruncationForDomain: () => dateTruncationForDomain, + datesSortOrder: () => datesSortOrder, + datumKeys: () => datumKeys, + datumStylerProperties: () => datumStylerProperties, + deconstructSelectionsOrNodes: () => deconstructSelectionsOrNodes, + deepClone: () => deepClone, + deepFreeze: () => deepFreeze, + diff: () => diff, + discreteTimeAxisIntervalOptionsDefs: () => discreteTimeAxisIntervalOptionsDefs, + drawCorner: () => drawCorner, + drawMarkerUnitPolygon: () => drawMarkerUnitPolygon, + durationDay: () => durationDay, + durationHour: () => durationHour, + durationMinute: () => durationMinute, + durationMonth: () => durationMonth, + durationSecond: () => durationSecond, + durationWeek: () => durationWeek, + durationYear: () => durationYear, + easing: () => easing_exports, + enterpriseModule: () => enterpriseModule, + errorBarOptionsDefs: () => errorBarOptionsDefs, + errorBarThemeableOptionsDefs: () => errorBarThemeableOptionsDefs, + estimateTickCount: () => estimateTickCount, + evaluateBezier: () => evaluateBezier, + expandLegendPosition: () => expandLegendPosition, + extent: () => extent, + extractDecoratedProperties: () => extractDecoratedProperties, + fillsOptionsDef: () => fillsOptionsDef, + findMinMax: () => findMinMax, + findQuadtreeMatch: () => findQuadtreeMatch, + findRangeExtent: () => findRangeExtent, + fixNumericExtent: () => fixNumericExtent, + focusCursorAtEnd: () => focusCursorAtEnd, + formatNumber: () => formatNumber, + formatObjectValidator: () => formatObjectValidator, + formatPercent: () => formatPercent, + formatTicks: () => formatTicks, + formatValue: () => formatValue, + fromToMotion: () => fromToMotion, + funnelSeriesThemeableOptionsDef: () => funnelSeriesThemeableOptionsDef, + generateTicks: () => generateTicks, + getAngleRatioRadians: () => getAngleRatioRadians, + getColorStops: () => getColorStops, + getCrossLineValue: () => getCrossLineValue, + getDateTicksForInterval: () => getDateTicksForInterval, + getDatumRefPoint: () => getDatumRefPoint, + getElementBBox: () => getElementBBox, + getIconClassNames: () => getIconClassNames, + getItemStyles: () => getItemStyles, + getItemStylesPerItemId: () => getItemStylesPerItemId, + getLabelStyles: () => getLabelStyles, + getLastFocus: () => getLastFocus, + getMarkerStyles: () => getMarkerStyles, + getMissCount: () => getMissCount, + getPath: () => getPath, + getPathComponents: () => getPathComponents, + getRadialColumnWidth: () => getRadialColumnWidth, + getSequentialColors: () => getSequentialColors, + getShapeFill: () => getShapeFill, + getShapeStyle: () => getShapeStyle, + getTextAlign: () => getTextAlign, + getTextBaseline: () => getTextBaseline, + getTimeIntervalTicks: () => getTimeIntervalTicks, + groupAccumulativeValueProperty: () => groupAccumulativeValueProperty, + groupAverage: () => groupAverage, + groupCount: () => groupCount, + groupSum: () => groupSum, + hasNoModifiers: () => hasNoModifiers, + heatmapSeriesThemeableOptionsDef: () => heatmapSeriesThemeableOptionsDef, + highlightStates: () => highlightStates, + initRovingTabIndex: () => initRovingTabIndex, + interpolatePoints: () => interpolatePoints, + interpolationOptionsDefs: () => interpolationOptionsDefs, + intervalCeil: () => intervalCeil, + intervalEpoch: () => intervalEpoch, + intervalExtent: () => intervalExtent, + intervalFloor: () => intervalFloor, + intervalHierarchy: () => intervalHierarchy, + intervalMilliseconds: () => intervalMilliseconds, + intervalNext: () => intervalNext, + intervalPrevious: () => intervalPrevious, + intervalRange: () => intervalRange, + intervalRangeCount: () => intervalRangeCount, + intervalRangeStartIndex: () => intervalRangeStartIndex, + intervalStep: () => intervalStep, + intervalUnit: () => intervalUnit, + isAgStandaloneChartOptions: () => isAgStandaloneChartOptions, + isAgTopologyChartOptions: () => isAgTopologyChartOptions, + isBetweenAngles: () => isBetweenAngles, + isButtonClickEvent: () => isButtonClickEvent, + isChartAxisDirection: () => isChartAxisDirection, + isContinuous: () => isContinuous, + isDecoratedObject: () => isDecoratedObject, + isDenseInterval: () => isDenseInterval, + isGradientFill: () => isGradientFill, + isGradientOrPatternFill: () => isGradientOrPatternFill, + isImageFill: () => isImageFill, + isInputPending: () => isInputPending, + isObjectWithProperty: () => isObjectWithProperty, + isObjectWithStringProperty: () => isObjectWithStringProperty, + isPatternFill: () => isPatternFill, + isProperties: () => isProperties, + isScaleValid: () => isScaleValid, + jsonApply: () => jsonApply, + jsonDiff: () => jsonDiff, + jsonPropertyCompare: () => jsonPropertyCompare, + jsonWalk: () => jsonWalk, + keyProperty: () => keyProperty, + legendSymbolSvg: () => legendSymbolSvg, + lineDistanceSquared: () => lineDistanceSquared, + linearGaugeSeriesOptionsDef: () => linearGaugeSeriesOptionsDef, + linearGaugeSeriesThemeableOptionsDef: () => linearGaugeSeriesThemeableOptionsDef, + linearGaugeTargetOptionsDef: () => linearGaugeTargetOptionsDef, + linearPoints: () => linearPoints, + listDecoratedProperties: () => listDecoratedProperties, + lowestGranularityForInterval: () => lowestGranularityForInterval, + lowestGranularityUnitForTicks: () => lowestGranularityUnitForTicks, + lowestGranularityUnitForValue: () => lowestGranularityUnitForValue, + makeAccessibleClickListener: () => makeAccessibleClickListener, + makeSeriesTooltip: () => makeSeriesTooltip, + mapLineBackgroundSeriesThemeableOptionsDef: () => mapLineBackgroundSeriesThemeableOptionsDef, + mapLineSeriesThemeableOptionsDef: () => mapLineSeriesThemeableOptionsDef, + mapMarkerSeriesThemeableOptionsDef: () => mapMarkerSeriesThemeableOptionsDef, + mapShapeBackgroundSeriesThemeableOptionsDef: () => mapShapeBackgroundSeriesThemeableOptionsDef, + mapShapeSeriesThemeableOptionsDef: () => mapShapeSeriesThemeableOptionsDef, + mapValues: () => mapValues, + markerEnabled: () => markerEnabled, + markerFadeInAnimation: () => markerFadeInAnimation, + markerOptionsDefs: () => markerOptionsDefs, + markerScaleInAnimation: () => markerScaleInAnimation, + markerStyleOptionsDefs: () => markerStyleOptionsDefs, + markerSwipeScaleInAnimation: () => markerSwipeScaleInAnimation, + memo: () => memo, + merge: () => merge, + mergeArrayDefaults: () => mergeArrayDefaults, + mergeDefaults: () => mergeDefaults, + midpointStartingBarPosition: () => midpointStartingBarPosition, + minimumTimeAxisDatumGranularity: () => minimumTimeAxisDatumGranularity, + moduleRegistry: () => moduleRegistry, + motion: () => motion, + multiSeriesHighlightStyle: () => multiSeriesHighlightStyle, + nearestSquared: () => nearestSquared, + nearestSquaredInContainer: () => nearestSquaredInContainer, + nextPowerOf2: () => nextPowerOf2, + nightingaleSeriesThemeableOptionsDef: () => nightingaleSeriesThemeableOptionsDef, + normaliseGroupTo: () => normaliseGroupTo, + normalisePropertyTo: () => normalisePropertyTo, + normalisedExtentWithMetadata: () => normalisedExtentWithMetadata, + normalizeAngle180: () => normalizeAngle180, + normalizeAngle360: () => normalizeAngle360, + normalizeAngle360FromDegrees: () => normalizeAngle360FromDegrees, + normalizeAngle360Inclusive: () => normalizeAngle360Inclusive, + normalizeContinuousDomains: () => normalizeContinuousDomains, + numberFormatValidator: () => numberFormatValidator, + objectsEqual: () => objectsEqual, + objectsEqualWith: () => objectsEqualWith, + ohlcSeriesThemeableOptionsDef: () => ohlcSeriesThemeableOptionsDef, + ordinalTimeAxisOptionsDefs: () => ordinalTimeAxisOptionsDefs, + pairUpSpans: () => pairUpSpans, + partialAssign: () => partialAssign, + pathFadeInAnimation: () => pathFadeInAnimation, + pathMotion: () => pathMotion, + pathSwipeInAnimation: () => pathSwipeInAnimation, + pick: () => pick, + pickByMatchingAngle: () => pickByMatchingAngle, + plotAreaPathFill: () => plotAreaPathFill, + plotInterpolatedAreaSeriesFillSpans: () => plotInterpolatedAreaSeriesFillSpans, + plotInterpolatedLinePathStroke: () => plotInterpolatedLinePathStroke, + plotLinePathStroke: () => plotLinePathStroke, + pointsEq: () => pointsEq, + polarChartOptionsDefs: () => polarChartOptionsDefs, + predictCartesianAxis: () => predictCartesianAxis, + predictCartesianTimeAxis: () => predictCartesianTimeAxis, + predictTimeAxisType: () => predictTimeAxisType, + prepareAreaFillAnimationFns: () => prepareAreaFillAnimationFns, + prepareAreaPathAnimation: () => prepareAreaPathAnimation, + prepareAxisAnimationContext: () => prepareAxisAnimationContext, + prepareAxisAnimationFunctions: () => prepareAxisAnimationFunctions, + prepareBarAnimationFunctions: () => prepareBarAnimationFunctions, + prepareLinePathAnimation: () => prepareLinePathAnimation, + prepareLinePathPropertyAnimation: () => prepareLinePathPropertyAnimation, + prepareLinePathStrokeAnimationFns: () => prepareLinePathStrokeAnimationFns, + preparePieSeriesAnimationFunctions: () => preparePieSeriesAnimationFunctions, + previousPowerOf2: () => previousPowerOf2, + processedDataIsAnimatable: () => processedDataIsAnimatable, + pyramidSeriesThemeableOptionsDef: () => pyramidSeriesThemeableOptionsDef, + radarAreaSeriesThemeableOptionsDef: () => radarAreaSeriesThemeableOptionsDef, + radarLineSeriesThemeableOptionsDef: () => radarLineSeriesThemeableOptionsDef, + radialBarSeriesThemeableOptionsDef: () => radialBarSeriesThemeableOptionsDef, + radialColumnSeriesThemeableOptionsDef: () => radialColumnSeriesThemeableOptionsDef, + radialGaugeSeriesOptionsDef: () => radialGaugeSeriesOptionsDef, + radialGaugeSeriesThemeableOptionsDef: () => radialGaugeSeriesThemeableOptionsDef, + radialGaugeTargetOptionsDef: () => radialGaugeTargetOptionsDef, + radialSeriesStylerDef: () => radialSeriesStylerDef, + radiusCategoryAxisOptionsDefs: () => radiusCategoryAxisOptionsDefs, + radiusNumberAxisOptionsDefs: () => radiusNumberAxisOptionsDefs, + range: () => range, + rangeAreaSeriesThemeableOptionsDef: () => rangeAreaSeriesThemeableOptionsDef, + rangeBarSeriesThemeableOptionsDef: () => rangeBarSeriesThemeableOptionsDef, + rangeValidator: () => rangeValidator2, + rangedValueProperty: () => rangedValueProperty, + rescaleSpan: () => rescaleSpan, + resetAxisFillSelectionFn: () => resetAxisFillSelectionFn, + resetAxisGroupFn: () => resetAxisGroupFn, + resetAxisLabelSelectionFn: () => resetAxisLabelSelectionFn, + resetAxisLineSelectionFn: () => resetAxisLineSelectionFn, + resetBarSelectionsFn: () => resetBarSelectionsFn, + resetLabelFn: () => resetLabelFn, + resetMarkerFn: () => resetMarkerFn, + resetMarkerPositionFn: () => resetMarkerPositionFn, + resetMotion: () => resetMotion, + resetPieSelectionsFn: () => resetPieSelectionsFn, + rowCountProperty: () => rowCountProperty, + sankeySeriesThemeableOptionsDef: () => sankeySeriesThemeableOptionsDef, + scale: () => scale, + sectorBox: () => sectorBox, + seriesLabelFadeInAnimation: () => seriesLabelFadeInAnimation, + seriesLabelFadeOutAnimation: () => seriesLabelFadeOutAnimation, + seriesLabelOptionsDefs: () => seriesLabelOptionsDefs, + setElementBBox: () => setElementBBox, + setPath: () => setPath, + shadowOptionsDefs: () => shadowOptionsDefs, + shallowClone: () => shallowClone, + simpleMemorize: () => simpleMemorize, + simpleMemorize2: () => simpleMemorize2, + singleSeriesHighlightStyle: () => singleSeriesHighlightStyle, + smoothPoints: () => smoothPoints, + solveBezier: () => solveBezier, + sortAndUniqueDates: () => sortAndUniqueDates, + spanRange: () => spanRange, + splitBezier2D: () => splitBezier2D, + stackCartesianSeries: () => stackCartesianSeries, + standaloneChartOptionsDefs: () => standaloneChartOptionsDefs, + staticFromToMotion: () => staticFromToMotion, + stepPoints: () => stepPoints, + stopPageScrolling: () => stopPageScrolling, + sum: () => sum, + sumValues: () => sumValues, + sunburstSeriesThemeableOptionsDef: () => sunburstSeriesThemeableOptionsDef, + textOrSegments: () => textOrSegments, + tickFormat: () => tickFormat, + ticksEqual: () => ticksEqual, + ticksSpacing: () => ticksSpacing, + timeInterval: () => timeInterval2, + timeIntervalMaxLabelSize: () => timeIntervalMaxLabelSize, + timeIntervalUnit: () => timeIntervalUnit, + toDegrees: () => toDegrees, + toHighlightString: () => toHighlightString, + toRadians: () => toRadians, + toolbarButtonOptionsDefs: () => toolbarButtonOptionsDefs, + tooltipContentAriaLabel: () => tooltipContentAriaLabel, + tooltipHtml: () => tooltipHtml, + tooltipOptionsDefs: () => tooltipOptionsDefs, + topologyChartOptionsDefs: () => topologyChartOptionsDefs, + trailingAccumulatedValue: () => trailingAccumulatedValue, + trailingAccumulatedValueProperty: () => trailingAccumulatedValueProperty, + treemapSeriesThemeableOptionsDef: () => treemapSeriesThemeableOptionsDef, + updateClipPath: () => updateClipPath, + updateLabelNode: () => updateLabelNode, + validateCrossLineValue: () => validateCrossLineValue, + valueProperty: () => valueProperty, + visibleRangeIndices: () => visibleRangeIndices, + waterfallSeriesThemeableOptionsDef: () => waterfallSeriesThemeableOptionsDef, + withTemporaryDomain: () => withTemporaryDomain, + without: () => without +}); + +// packages/ag-charts-community/src/util/deprecation.ts +function createDeprecationWarning() { + return (key, message) => { + const msg = [`Property [${key}] is deprecated.`, message].filter(Boolean).join(" "); + logger_exports.warnOnce(msg); + }; +} +function Deprecated(message, opts) { + const warnDeprecated = createDeprecationWarning(); + const def = opts?.default; + return addTransformToInstanceProperty((_, key, value) => { + if (value !== def) { + warnDeprecated(key.toString(), message); + } + return value; + }); +} +function DeprecatedAndRenamedTo(newPropName, mapValue) { + const warnDeprecated = createDeprecationWarning(); + return addTransformToInstanceProperty( + (target, key, value) => { + if (value !== target[newPropName]) { + warnDeprecated(key.toString(), `Use [${newPropName}] instead.`); + setPath(target, newPropName, mapValue ? mapValue(value) : value); + } + return BREAK_TRANSFORM_CHAIN; + }, + (target, key) => { + warnDeprecated(key.toString(), `Use [${newPropName}] instead.`); + return getPath(target, newPropName); + } + ); +} + +// packages/ag-charts-community/src/util/vector.ts +var Vec2 = { + add, + angle, + apply, + equal, + distance, + distanceSquared, + from: from2, + gradient, + intercept, + intersectAtX, + intersectAtY, + length, + lengthSquared, + multiply, + normalized, + origin: origin2, + required: required2, + rotate, + round: round2, + sub +}; +function add(a, b) { + if (typeof b === "number") { + return { x: a.x + b, y: a.y + b }; + } + return { x: a.x + b.x, y: a.y + b.y }; +} +function sub(a, b) { + if (typeof b === "number") { + return { x: a.x - b, y: a.y - b }; + } + return { x: a.x - b.x, y: a.y - b.y }; +} +function multiply(a, b) { + if (typeof b === "number") { + return { x: a.x * b, y: a.y * b }; + } + return { x: a.x * b.x, y: a.y * b.y }; +} +function length(a) { + return Math.hypot(a.x, a.y); +} +function lengthSquared(a) { + return a.x * a.x + a.y * a.y; +} +function distance(a, b) { + return length(sub(a, b)); +} +function distanceSquared(a, b) { + return lengthSquared(sub(a, b)); +} +function normalized(a) { + const l = length(a); + return { x: a.x / l, y: a.y / l }; +} +function angle(a, b) { + if (b == null) + return Math.atan2(a.y, a.x); + return Math.atan2(a.y, a.x) - Math.atan2(b.y, b.x); +} +function rotate(a, theta, b = origin2()) { + const l = length(a); + return { x: b.x + l * Math.cos(theta), y: b.y + l * Math.sin(theta) }; +} +function gradient(a, b, reflection) { + const dx2 = b.x - a.x; + const dy2 = reflection == null ? b.y - a.y : reflection - b.y - (reflection - a.y); + return dy2 / dx2; +} +function intercept(a, gradient2, reflection) { + const y = reflection == null ? a.y : reflection - a.y; + return y - gradient2 * a.x; +} +function intersectAtY(gradient2, coefficient, y = 0, reflection) { + return { + x: gradient2 === Infinity ? Infinity : (y - coefficient) / gradient2, + y: reflection == null ? y : reflection - y + }; +} +function intersectAtX(gradient2, coefficient, x = 0, reflection) { + const y = gradient2 === Infinity ? Infinity : gradient2 * x + coefficient; + return { x, y: reflection == null ? y : reflection - y }; +} +function round2(a, decimals = 2) { + return { x: roundTo(a.x, decimals), y: roundTo(a.y, decimals) }; +} +function equal(a, b) { + return a.x === b.x && a.y === b.y; +} +function from2(a, b) { + if (typeof a === "number") { + return { x: a, y: b }; + } + if ("currentX" in a) { + return { x: a.currentX, y: a.currentY }; + } + if ("offsetWidth" in a) { + return { x: a.offsetWidth, y: a.offsetHeight }; + } + if ("width" in a) { + return [ + { x: a.x, y: a.y }, + { x: a.x + a.width, y: a.y + a.height } + ]; + } + if ("x1" in a) { + return [ + { x: a.x1, y: a.y1 }, + { x: a.x2, y: a.y2 } + ]; + } + throw new Error(`Values can not be converted into a vector: [${JSON.stringify(a)}] [${b}]`); +} +function apply(a, b) { + a.x = b.x; + a.y = b.y; + return a; +} +function required2(a) { + return { x: a?.x ?? 0, y: a?.y ?? 0 }; +} +function origin2() { + return { x: 0, y: 0 }; +} + +// packages/ag-charts-community/src/chart/series/hierarchy/hierarchySeries.ts +var _HierarchyNode = class _HierarchyNode { + constructor(series, datumIndex, datum, sizeValue, colorValue, sumSize, depth, parent, children, style2) { + this.series = series; + this.datumIndex = datumIndex; + this.datum = datum; + this.sizeValue = sizeValue; + this.colorValue = colorValue; + this.sumSize = sumSize; + this.depth = depth; + this.parent = parent; + this.children = children; + this.style = style2; + this.midPoint = { x: 0, y: 0 }; + } + get hasChildren() { + return this.children.length > 0; + } + walk(callback2, order = _HierarchyNode.Walk.PreOrder) { + if (order === _HierarchyNode.Walk.PreOrder) { + callback2(this); + } + for (const child of this.children) { + child.walk(callback2, order); + } + if (order === _HierarchyNode.Walk.PostOrder) { + callback2(this); + } + } + *[Symbol.iterator]() { + yield this; + for (const child of this.children) { + yield* child; + } + } +}; +_HierarchyNode.Walk = { + PreOrder: 0, + PostOrder: 1 +}; +var HierarchyNode = _HierarchyNode; +var HierarchySeries = class extends Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [1 /* NEAREST_NODE */, 0 /* EXACT_SHAPE_MATCH */] + }); + this.colorDomain = [0, 0]; + this.maxDepth = 0; + this.colorScale = new ColorScale(); + this.animationState = new StateMachine( + "empty", + { + empty: { + update: { + target: "ready", + action: (data) => this.animateEmptyUpdateReady(data) + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + highlight: (data) => this.animateReadyHighlight(data), + resize: (data) => this.animateReadyResize(data), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: (data) => this.animateWaitingUpdateReady(data) + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty", + action: (data) => this.animateClearingUpdateEmpty(data) + }, + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + processData() { + const { NodeClass } = this; + const { childrenKey, sizeKey, colorKey, colorRange } = this.properties; + let maxDepth = 0; + let minColor = Infinity; + let maxColor = -Infinity; + const createNode = (datum, indexPath, parent) => { + const depth = parent.depth == null ? 0 : parent.depth + 1; + const children = childrenKey == null ? void 0 : datum[childrenKey]; + const isLeaf = children == null || children.length === 0; + let sizeValue = sizeKey == null ? void 0 : datum[sizeKey]; + if (Number.isFinite(sizeValue)) { + sizeValue = Math.max(sizeValue, 0); + } else { + sizeValue = isLeaf ? 1 : 0; + } + const sumSize = sizeValue; + maxDepth = Math.max(maxDepth, depth); + const colorValue = colorKey == null ? void 0 : datum[colorKey]; + if (typeof colorValue === "number") { + minColor = Math.min(minColor, colorValue); + maxColor = Math.max(maxColor, colorValue); + } + const style2 = this.getItemStyle({ datumIndex: indexPath, datum, depth, colorValue }, isLeaf, false); + return appendChildren( + new NodeClass(this, indexPath, datum, sizeValue, colorValue, sumSize, depth, parent, [], style2), + children + ); + }; + const appendChildren = (node, data) => { + const { datumIndex } = node; + if (data) { + for (const [childIndex, datum] of data.entries()) { + const child = createNode(datum, datumIndex.concat(childIndex), node); + node.children.push(child); + node.sumSize += child.sumSize; + } + } + return node; + }; + const rootNode = appendChildren( + new NodeClass(this, [], void 0, 0, void 0, 0, void 0, void 0, [], {}), + this.data?.data + ); + const colorDomain = [minColor, maxColor]; + this.colorScale.domain = minColor < maxColor ? [minColor, maxColor] : [0, 1]; + this.colorScale.range = colorRange ?? ["black"]; + this.colorScale.update(); + this.rootNode = rootNode; + this.maxDepth = maxDepth; + this.colorDomain = colorDomain; + } + update({ seriesRect }) { + this.updateSelections(); + this.updateNodes(); + const animationData = this.getAnimationData(); + const resize = this.checkResize(seriesRect); + if (resize) { + this.animationState.transition("resize", animationData); + } + this.animationState.transition("update", animationData); + } + resetAllAnimation(_data) { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + } + animateEmptyUpdateReady(data) { + this.ctx.animationManager.skipCurrentBatch(); + this.resetAllAnimation(data); + } + animateWaitingUpdateReady(data) { + this.ctx.animationManager.skipCurrentBatch(); + this.resetAllAnimation(data); + } + animateReadyHighlight(_data) { + } + animateReadyResize(data) { + this.resetAllAnimation(data); + } + animateClearingUpdateEmpty(data) { + this.ctx.animationManager.skipCurrentBatch(); + this.resetAllAnimation(data); + } + getAnimationData() { + return {}; + } + isProcessedDataAnimatable() { + return true; + } + checkProcessedDataAnimatable() { + if (!this.isProcessedDataAnimatable()) { + this.ctx.animationManager.skipCurrentBatch(); + } + } + dataCount() { + return Number.NaN; + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData(legendType) { + const { colorKey, colorRange } = this.properties; + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + return legendType === "gradient" && colorKey != null && colorRange != null ? [ + { + legendType: "gradient", + enabled: visible && legendManager.getItemEnabled({ seriesId }), + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain: this.colorDomain + } + ] : []; + } + getDatumIdFromData(node) { + return node.datumIndex.join(":"); + } + getDatumId(node) { + return this.getDatumIdFromData(node); + } + removeMeIndexPathForIndex(index) { + return this.datumSelection.at(index + 1)?.datum.datumIndex ?? []; + } + removeMeIndexForIndexPath(indexPath) { + for (const { index, datum } of this.datumSelection) { + if (arraysEqual(datum.datumIndex, indexPath)) { + return index - 1; + } + } + return 0; + } + pickFocus(opts) { + if (!this.rootNode?.children.length) + return void 0; + const index = clamp(0, opts.datumIndex - opts.datumIndexDelta, this.datumSelection.length - 1); + const { datumIndexDelta: childDelta, otherIndexDelta: depthDelta } = opts; + let path = this.removeMeIndexPathForIndex(index); + const currentNode = path.reduce((n, childIndex) => n.children[childIndex], this.rootNode); + if (depthDelta > 0 && currentNode.hasChildren) { + path = [...path, 0]; + } else if (depthDelta < 0 && path.length > 1) { + path = path.slice(0, -1); + } else if (depthDelta === 0 && childDelta !== 0) { + const maxIndex = currentNode.parent.children.length - 1; + path = path.slice(); + path[path.length - 1] = clamp(0, path.at(-1) + childDelta, maxIndex); + } + const nextNode = path.reduce((n, childIndex) => n.children[childIndex], this.rootNode); + const bounds = this.computeFocusBounds(this.datumSelection.at(index + 1)); + if (bounds == null) + return; + return { + datum: nextNode, + datumIndex: this.removeMeIndexForIndexPath(path), + otherIndex: nextNode.depth, + bounds, + clipFocusBox: true + }; + } + getDatumAriaText(datum, description) { + if (!(datum instanceof this.NodeClass)) { + logger_exports.error(`datum is not HierarchyNode: ${JSON.stringify(datum)}`); + return; + } + return this.ctx.localeManager.t("ariaAnnounceHierarchyDatum", { + level: (datum.depth ?? -1) + 1, + count: datum.children.length, + description + }); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } +}; + +// packages/ag-charts-community/src/chart/series/hierarchy/hierarchySeriesProperties.ts +var HierarchySeriesProperties = class extends SeriesProperties { + constructor() { + super(...arguments); + this.childrenKey = "children"; + this.fills = Object.values(DEFAULT_FILLS); + this.strokes = Object.values(DEFAULT_STROKES); + } +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], HierarchySeriesProperties.prototype, "childrenKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HierarchySeriesProperties.prototype, "sizeKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HierarchySeriesProperties.prototype, "colorKey", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HierarchySeriesProperties.prototype, "colorName", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HierarchySeriesProperties.prototype, "fills", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HierarchySeriesProperties.prototype, "strokes", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], HierarchySeriesProperties.prototype, "colorRange", 2); + +// packages/ag-charts-community/src/chart/series/topology/lonLatBbox.ts +var LonLatBBox = class _LonLatBBox { + constructor(lon0, lat0, lon1, lat1) { + this.lon0 = lon0; + this.lat0 = lat0; + this.lon1 = lon1; + this.lat1 = lat1; + } + extend(lon0, lat0, lon1, lat1) { + this.lon0 = Math.min(this.lon0, lon0); + this.lat0 = Math.min(this.lat0, lat0); + this.lon1 = Math.max(this.lon1, lon1); + this.lat1 = Math.max(this.lat1, lat1); + return this; + } + merge(other) { + return this.extend(other.lon0, other.lat0, other.lon1, other.lat1); + } + static extend(into, lon0, lat0, lon1, lat1) { + return into ? into.extend(lon0, lat0, lon1, lat1) : new _LonLatBBox(lon0, lat0, lon1, lat1); + } +}; + +// packages/ag-charts-community/src/chart/series/topology/mercatorScale.ts +var radsInDeg = Math.PI / 180; +var lonX = (lon) => lon * radsInDeg; +var latY = (lat) => -Math.log(Math.tan(Math.PI * 0.25 + lat * radsInDeg * 0.5)); +var xLon = (x) => x / radsInDeg; +var yLat = (y) => (Math.atan(Math.exp(-y)) - Math.PI * 0.25) / (radsInDeg * 0.5); +var MercatorScale = class _MercatorScale extends AbstractScale { + constructor(domain, range4) { + super(); + this.domain = domain; + this.range = range4; + this.type = "mercator"; + this.defaultTickCount = 0; + this.bounds = _MercatorScale.bounds(domain); + } + static bounds(domain) { + const [[lon0, lat0], [lon1, lat1]] = domain; + const x0 = lonX(lon0); + const y0 = latY(lat0); + const x1 = lonX(lon1); + const y1 = latY(lat1); + return new BBox(Math.min(x0, x1), Math.min(y0, y1), Math.abs(x1 - x0), Math.abs(y1 - y0)); + } + static fixedScale() { + return new _MercatorScale( + [ + [xLon(0), yLat(0)], + [xLon(1), yLat(1)] + ], + [ + [0, 0], + [1, 1] + ] + ); + } + toDomain() { + return; + } + normalizeDomains(...domains) { + let x0 = -Infinity; + let x1 = Infinity; + let y0 = -Infinity; + let y1 = Infinity; + for (const domain of domains) { + for (const [x, y] of domain) { + x0 = Math.min(x, x0); + x1 = Math.max(x, x1); + y0 = Math.min(y, y0); + y1 = Math.max(y, y1); + } + } + return { + domain: [ + [x0, y0], + [x1, y1] + ], + animatable: true + }; + } + convert([lon, lat]) { + const [[x0, y0], [x1, y1]] = this.range; + const xScale = (x1 - x0) / this.bounds.width; + const yScale = (y1 - y0) / this.bounds.height; + return [(lonX(lon) - this.bounds.x) * xScale + x0, (latY(lat) - this.bounds.y) * yScale + y0]; + } + invert([x, y]) { + const [[x0, y0], [x1, y1]] = this.range; + const xScale = (x1 - x0) / this.bounds.width; + const yScale = (y1 - y0) / this.bounds.height; + return [xLon((x - x0) / xScale + this.bounds.x), yLat((y - y0) / yScale + this.bounds.y)]; + } +}; + +// packages/ag-charts-community/src/chart/crossline/crossLineLabelPosition.ts +var horizontalCrosslineTranslationDirections = { + top: { xTranslationDirection: 0, yTranslationDirection: -1 }, + bottom: { xTranslationDirection: 0, yTranslationDirection: 1 }, + left: { xTranslationDirection: -1, yTranslationDirection: 0 }, + right: { xTranslationDirection: 1, yTranslationDirection: 0 }, + "top-left": { xTranslationDirection: 1, yTranslationDirection: -1 }, + "top-right": { xTranslationDirection: -1, yTranslationDirection: -1 }, + "bottom-left": { xTranslationDirection: 1, yTranslationDirection: 1 }, + "bottom-right": { xTranslationDirection: -1, yTranslationDirection: 1 }, + inside: { xTranslationDirection: 0, yTranslationDirection: 0 }, + "inside-left": { xTranslationDirection: 1, yTranslationDirection: 0 }, + "inside-right": { xTranslationDirection: -1, yTranslationDirection: 0 }, + "inside-top": { xTranslationDirection: 0, yTranslationDirection: 1 }, + "inside-bottom": { xTranslationDirection: 0, yTranslationDirection: -1 }, + "inside-top-left": { xTranslationDirection: 1, yTranslationDirection: 1 }, + "inside-bottom-left": { xTranslationDirection: 1, yTranslationDirection: -1 }, + "inside-top-right": { xTranslationDirection: -1, yTranslationDirection: 1 }, + "inside-bottom-right": { xTranslationDirection: -1, yTranslationDirection: -1 } +}; +var verticalCrossLineTranslationDirections = { + top: { xTranslationDirection: 1, yTranslationDirection: 0 }, + bottom: { xTranslationDirection: -1, yTranslationDirection: 0 }, + left: { xTranslationDirection: 0, yTranslationDirection: -1 }, + right: { xTranslationDirection: 0, yTranslationDirection: 1 }, + "top-left": { xTranslationDirection: -1, yTranslationDirection: -1 }, + "top-right": { xTranslationDirection: -1, yTranslationDirection: 1 }, + "bottom-left": { xTranslationDirection: 1, yTranslationDirection: -1 }, + "bottom-right": { xTranslationDirection: 1, yTranslationDirection: 1 }, + inside: { xTranslationDirection: 0, yTranslationDirection: 0 }, + "inside-left": { xTranslationDirection: 0, yTranslationDirection: 1 }, + "inside-right": { xTranslationDirection: 0, yTranslationDirection: -1 }, + "inside-top": { xTranslationDirection: -1, yTranslationDirection: 0 }, + "inside-bottom": { xTranslationDirection: 1, yTranslationDirection: 0 }, + "inside-top-left": { xTranslationDirection: -1, yTranslationDirection: 1 }, + "inside-bottom-left": { xTranslationDirection: 1, yTranslationDirection: 1 }, + "inside-top-right": { xTranslationDirection: -1, yTranslationDirection: -1 }, + "inside-bottom-right": { xTranslationDirection: 1, yTranslationDirection: -1 } +}; +function calculateLabelTranslation({ + yDirection, + padding: padding2 = 0, + position = "top", + bbox +}) { + const crossLineTranslationDirections = yDirection ? horizontalCrosslineTranslationDirections : verticalCrossLineTranslationDirections; + const { xTranslationDirection, yTranslationDirection } = crossLineTranslationDirections[position]; + const xTranslation = xTranslationDirection * (padding2 + bbox.width / 2); + const yTranslation = yTranslationDirection * (padding2 + bbox.height / 2); + return { + xTranslation, + yTranslation + }; +} + +// packages/ag-charts-community/src/dom/elements.ts +function createButton(options, attrs) { + const button = createElement("button", getClassName("ag-charts-input ag-charts-button", attrs)); + if (options.label === void 0) { + button.append(createIcon(options.icon)); + button.ariaLabel = options.altText; + } else { + button.append(options.label); + } + button.addEventListener("click", options.onPress); + setAttributes(button, attrs); + return button; +} +function createCheckbox(options, attrs) { + const checkbox = createElement("input", getClassName("ag-charts-input ag-charts-checkbox", attrs)); + checkbox.type = "checkbox"; + checkbox.checked = options.checked; + checkbox.addEventListener("change", (event) => options.onChange(checkbox.checked, event)); + checkbox.addEventListener("keydown", (event) => { + if (isButtonClickEvent(event)) { + event.preventDefault(); + checkbox.click(); + } + }); + setAttributes(checkbox, attrs); + return checkbox; +} +function createSelect(options, attrs) { + const select = createElement("select", getClassName("ag-charts-input ag-charts-select", attrs)); + select.append( + ...options.options.map((option) => { + const optionEl = createElement("option"); + optionEl.value = option.value; + optionEl.textContent = option.label; + return optionEl; + }) + ); + setAttribute(select, "data-preventdefault", false); + select.value = options.value; + select.addEventListener("change", (event) => options.onChange(select.value, event)); + setAttributes(select, attrs); + return select; +} +function createTextArea(options, attrs) { + const textArea = createElement("textarea", getClassName("ag-charts-input ag-charts-textarea", attrs)); + textArea.value = options.value; + textArea.addEventListener("input", (event) => options.onChange(textArea.value, event)); + setAttributes(textArea, attrs); + setAttribute(textArea, "data-preventdefault", false); + return textArea; +} +function createIcon(icon) { + const el = createElement("span", `ag-charts-icon ag-charts-icon-${icon}`); + setAttribute(el, "aria-hidden", true); + return el; +} +function getClassName(baseClass, attrs) { + if (attrs == null) + return baseClass; + return `${baseClass} ${attrs.class}`; +} + +// packages/ag-charts-community/src/scene/shape/svgPath.ts +var SvgPath = class extends Path { + constructor(d = "") { + super(); + this._d = ""; + this.d = d; + } + get d() { + return this._d; + } + set d(d) { + if (d === this._d) + return; + this._d = d; + this.path.clear(); + this.path.appendSvg(d); + this.checkPathDirty(); + } +}; +var TranslatableSvgPath = class extends Translatable(SvgPath) { + isPointInPath(x, y) { + return super.isPointInPath(x - this.translationX, y - this.translationY); + } +}; + +// packages/ag-charts-community/src/scene/image.ts +var Image3 = class extends Node2 { + constructor(sourceImage) { + super(); + this.sourceImage = sourceImage; + this.x = 0; + this.y = 0; + this.width = 0; + this.height = 0; + this.opacity = 1; + } + render(renderCtx) { + const { ctx } = renderCtx; + const image = this.sourceImage; + if (image) { + ctx.globalAlpha = this.opacity; + ctx.drawImage(image, 0, 0, image.width, image.height, this.x, this.y, this.width, this.height); + } + super.render(renderCtx); + } +}; +__decorateClass([ + SceneChangeDetection() +], Image3.prototype, "x", 2); +__decorateClass([ + SceneChangeDetection() +], Image3.prototype, "y", 2); +__decorateClass([ + SceneChangeDetection() +], Image3.prototype, "width", 2); +__decorateClass([ + SceneChangeDetection() +], Image3.prototype, "height", 2); +__decorateClass([ + SceneChangeDetection() +], Image3.prototype, "opacity", 2); + +// packages/ag-charts-community/src/widget/exports.ts +var exports_exports = {}; +__export(exports_exports, { + ButtonWidget: () => ButtonWidget, + MenuItemRadioWidget: () => MenuItemRadioWidget, + MenuItemWidget: () => MenuItemWidget, + MenuWidget: () => MenuWidget, + NativeWidget: () => NativeWidget, + SliderWidget: () => SliderWidget, + ToolbarWidget: () => ToolbarWidget, + WIDGET_HTML_EVENTS: () => WIDGET_HTML_EVENTS, + Widget: () => Widget, + WidgetEventUtil: () => WidgetEventUtil +}); + +// packages/ag-charts-community/src/widget/menuItemWidget.ts +var MenuItemWidget = class extends AbstractButtonWidget { + constructor() { + super(createElement("div"), "menuitem"); + } +}; +var MenuItemRadioWidget = class extends AbstractButtonWidget { + constructor() { + super(createElement("div"), "menuitemradio"); + } + setChecked(checked) { + setAttribute(this.elem, "aria-checked", checked); + } +}; + +// packages/ag-charts-community/src/widget/menuWidget.ts +var closeKeys = ["Escape", "ArrowLeft"]; +var MenuWidget = class _MenuWidget extends RovingTabContainerWidget { + constructor(orientation = "vertical") { + super(orientation, "menu"); + this.handleMouseEnter = (ev, current) => { + if (!current.hasPopup()) { + this.expandSubMenu(ev, void 0); + } + }; + this.handleMouseMove = (_ev, current) => { + current.focus({ preventScroll: true }); + }; + } + destructor() { + this.collapse({ mode: "2" /* DESTROY */ }); + } + addSeparator() { + const sep = getDocument().createElement("div"); + setAttribute(sep, "role", "separator"); + this.elem.appendChild(sep); + return sep; + } + onChildAdded(child) { + super.onChildAdded(child); + child.addListener("mouseenter", this.handleMouseEnter); + child.addListener("mousemove", this.handleMouseMove); + } + onChildRemoved(child) { + super.onChildRemoved(child); + child.removeListener("mouseenter", this.handleMouseEnter); + child.removeListener("mousemove", this.handleMouseMove); + } + addSubMenu() { + const subMenuButton = new MenuItemWidget(); + const subMenu = new _MenuWidget(this.orientation); + subMenu.id = createElementId(); + const expand = () => { + this.collapseExpandedSubMenu(subMenu); + subMenuButton.expandControlled(); + }; + const arrowRightOpener = (ev) => { + if (hasNoModifiers(ev.sourceEvent) && ev.sourceEvent.code === "ArrowRight") { + this.collapseExpandedSubMenu(subMenu); + subMenuButton.expandControlled(); + } + }; + subMenuButton.setControlled(subMenu); + subMenuButton.setAriaHasPopup("menu"); + subMenuButton.addListener("click", expand); + subMenuButton.addListener("mouseenter", expand); + subMenuButton.addListener("keydown", arrowRightOpener); + this.addChild(subMenuButton); + return { subMenuButton, subMenu }; + } + expandSubMenu(ev, subMenu) { + const { expansionScope } = this; + if (!expansionScope) + return; + this.collapseExpandedSubMenu(subMenu); + subMenu?.expand(ev); + } + collapseExpandedSubMenu(newSubMenu) { + const { expansionScope } = this; + if (!expansionScope) + return; + expansionScope.expandedSubMenu?.collapse({ mode: "4" /* SIDLING_OPENED */ }); + expansionScope.expandedSubMenu = newSubMenu; + } + expand(opts) { + if (this.expansionScope != null) + return; + this.expansionScope = { + lastFocus: getLastFocus(opts.sourceEvent), + expandedSubMenu: void 0, + abort: () => this.collapse({ mode: "1" /* ABORT */ }), + close: () => this.collapse({ mode: "0" /* CLOSE */ }), + removers: new CleanupRegistry() + }; + const scope = this.expansionScope; + const buttons2 = this.children.map((value) => value.getElement()); + setAttribute(scope.lastFocus, "aria-expanded", true); + scope.removers.register( + addMouseCloseListener(this.elem, scope.abort), + addTouchCloseListener(this.elem, scope.abort), + ...this.children.map((child) => addEscapeEventListener(child.getElement(), scope.close, closeKeys)), + opts?.overrideFocusVisible && addOverrideFocusVisibleEventListener(this.elem, buttons2, opts.overrideFocusVisible) + ); + this.internalListener?.dispatch("expand-widget", this, { type: "expand-widget" }); + this.children[0]?.focus({ preventScroll: true }); + } + collapse(opts) { + const { mode = "0" /* CLOSE */ } = opts ?? {}; + if (this.expansionScope === void 0) + return; + const { lastFocus, removers, expandedSubMenu } = this.expansionScope; + this.expansionScope = void 0; + expandedSubMenu?.collapse({ mode: "3" /* PARENT_CLOSED */ }); + setAttribute(lastFocus, "aria-expanded", false); + if (mode === "0" /* CLOSE */) { + lastFocus?.focus({ preventScroll: true }); + } + removers.flush(); + this.internalListener?.dispatch("collapse-widget", this, { type: "collapse-widget", mode }); + } +}; + +// packages/ag-charts-community/src/components/popover/popover.ts +var canvasOverlay = "canvas-overlay"; +var Popover = class extends BaseModuleInstance { + constructor(ctx, id, options) { + super(); + this.ctx = ctx; + this.hideFns = []; + this.setOwnedWidget = /* @__PURE__ */ (() => { + let ownedWidget; + return (owns) => { + ownedWidget?.destroy(); + ownedWidget = owns; + }; + })(); + this.moduleId = `popover-${id}`; + if (options?.detached) { + this.element = createElement("div"); + } else { + this.element = ctx.domManager.addChild(canvasOverlay, this.moduleId); + } + this.element.setAttribute("role", "presentation"); + this.hideFns.push(() => this.setOwnedWidget(void 0)); + this.cleanup.register(() => ctx.domManager.removeChild(canvasOverlay, this.moduleId)); + } + attachTo(popover) { + if (this.element.parentElement) + return; + popover.element.append(this.element); + } + hide(opts) { + const { lastFocus = this.lastFocus } = opts ?? {}; + if (this.element.children.length === 0) + return; + for (const fn of this.hideFns) { + fn(); + } + lastFocus?.focus(); + this.lastFocus = void 0; + } + removeChildren() { + this.element.replaceChildren(); + } + initPopoverElement(popover, options) { + if (!this.element.parentElement) { + throw new Error("Can not show popover that has not been attached to a parent."); + } + popover ?? (popover = createElement("div", "ag-charts-popover")); + popover.classList.toggle("ag-charts-popover", true); + if (options.ariaLabel != null) { + popover.setAttribute("aria-label", options.ariaLabel); + } + if (options.class != null) { + popover.classList.add(options.class); + } + this.element.replaceChildren(popover); + return popover; + } + showWidget(controller, owns, options) { + this.setOwnedWidget(owns); + this.initPopoverElement(owns.getElement(), options); + owns.addListener("collapse-widget", () => { + controller.setControlled(void 0); + this.setOwnedWidget(void 0); + }); + controller.setControlled(owns); + controller.expandControlled(); + } + showWithChildren(children, options) { + const popover = this.initPopoverElement(void 0, options); + popover.replaceChildren(...children); + this.hideFns.push(() => this.removeChildren()); + if (options.onHide) { + this.hideFns.push(options.onHide); + } + if (options.initialFocus && options.sourceEvent) { + const lastFocus = getLastFocus(options.sourceEvent); + if (lastFocus !== void 0) { + this.lastFocus = lastFocus; + this.initialFocus = options.initialFocus; + } + } + return popover; + } + getPopoverElement() { + return this.element.firstElementChild; + } + updatePosition(position) { + const popover = this.getPopoverElement(); + if (!popover) + return; + popover.style.setProperty("right", "unset"); + popover.style.setProperty("bottom", "unset"); + if (position.x != null) + popover.style.setProperty("left", `${Math.floor(position.x)}px`); + if (position.y != null) + popover.style.setProperty("top", `${Math.floor(position.y)}px`); + this.initialFocus?.focus(); + this.initialFocus = void 0; + } +}; + +// packages/ag-charts-community/src/components/popover/anchoredPopover.ts +var AnchoredPopover = class extends Popover { + setAnchor(anchor, fallbackAnchor) { + this.anchor = anchor; + this.fallbackAnchor = fallbackAnchor; + this.updatePosition(anchor); + this.repositionWithinBounds(); + } + updateAnchor(options) { + const anchor = options.anchor ?? this.anchor; + const fallbackAnchor = options.fallbackAnchor ?? this.fallbackAnchor; + if (anchor) { + this.setAnchor(anchor, fallbackAnchor); + } + } + showWidget(controller, owns, options) { + super.showWidget(controller, owns, options); + this.updateAnchor(options); + } + showWithChildren(children, options) { + const popover = super.showWithChildren(children, options); + this.updateAnchor(options); + getWindow().requestAnimationFrame(() => { + this.repositionWithinBounds(); + }); + return popover; + } + repositionWithinBounds() { + const { anchor, ctx, fallbackAnchor } = this; + const popover = this.getPopoverElement(); + if (!anchor || !popover) + return; + const canvasRect = ctx.domManager.getBoundingClientRect(); + const { offsetWidth: width2, offsetHeight: height2 } = popover; + let x = clamp(0, anchor.x, canvasRect.width - width2); + let y = clamp(0, anchor.y, canvasRect.height - height2); + if (x !== anchor.x && fallbackAnchor?.x != null) { + x = clamp(0, fallbackAnchor.x - width2, canvasRect.width - width2); + } + if (y !== anchor.y && fallbackAnchor?.y != null) { + y = clamp(0, fallbackAnchor.y - height2, canvasRect.height - height2); + } + this.updatePosition({ x, y }); + } +}; + +// packages/ag-charts-community/src/components/menu/menu.ts +var Menu = class extends AnchoredPopover { + show(controller, options) { + const menu = new MenuWidget("vertical"); + for (const item of options.items) { + menu.addChild(this.createRow(options, item, menu)); + } + menu.addClass("ag-charts-menu"); + this.showWidget(controller, menu, options); + } + allocRow(options, item) { + if (options.menuItemRole == null || options.menuItemRole === "menuitem") { + return new MenuItemWidget(); + } else { + options.menuItemRole; + const result = new MenuItemRadioWidget(); + result.setChecked(options.value === item.value); + return result; + } + } + createRow(options, item, menu) { + const active = item.value === options.value; + const row = this.allocRow(options, item); + row.addClass("ag-charts-menu__row"); + row.toggleClass(`ag-charts-menu__row--active`, active); + if (typeof item.value === "string") { + row.getElement().dataset.popoverId = item.value; + } + if (item.icon != null) { + const icon = createElement("span", `ag-charts-menu__icon ${getIconClassNames(item.icon)}`); + row.getElement().appendChild(icon); + } + const strokeWidthVisible = item.strokeWidth != null; + if (strokeWidthVisible) { + row.toggleClass(`ag-charts-menu__row--stroke-width-visible`, strokeWidthVisible); + row.setCSSVariable("--strokeWidth", strokeWidthVisible ? `${item.strokeWidth}px` : null); + } + if (item.label != null) { + const label = createElement("span", "ag-charts-menu__label"); + label.textContent = this.ctx.localeManager.t(item.label); + row.getElement().appendChild(label); + } + if ("altText" in item) { + row.setAriaLabel(this.ctx.localeManager.t(item.altText)); + } + row.addListener("click", ({ sourceEvent }) => { + options.onPress?.(item); + sourceEvent.preventDefault(); + sourceEvent.stopPropagation(); + menu.collapse(); + }); + return row; + } +}; + +// packages/ag-charts-community/src/components/popover/draggablePopover.ts +var DraggablePopover = class extends Popover { + constructor() { + super(...arguments); + this.dragged = false; + } + setDragHandle(dragHandle) { + dragHandle.addListener("drag-start", (event) => { + dragHandle.addClass(this.dragHandleDraggingClass); + this.onDragStart(event); + }); + dragHandle.addListener("drag-move", this.onDragMove.bind(this)); + dragHandle.addListener("drag-end", () => { + dragHandle.removeClass(this.dragHandleDraggingClass); + this.onDragEnd.bind(this); + }); + } + onDragStart(event) { + const popover = this.getPopoverElement(); + if (!popover) + return; + event.sourceEvent.preventDefault(); + this.dragged = true; + this.dragStartState = { + client: Vec2.from(event.clientX, event.clientY), + position: Vec2.from( + Number(popover.style.getPropertyValue("left").replace("px", "")), + Number(popover.style.getPropertyValue("top").replace("px", "")) + ) + }; + } + onDragMove(event) { + const { dragStartState } = this; + const popover = this.getPopoverElement(); + if (!dragStartState || !popover) + return; + const offset = Vec2.sub(Vec2.from(event.clientX, event.clientY), dragStartState.client); + const position = Vec2.add(dragStartState.position, offset); + const bounds = this.ctx.domManager.getBoundingClientRect(); + const partialPosition = {}; + if (position.x >= 0 && position.x + popover.offsetWidth <= bounds.width) { + partialPosition.x = position.x; + } + if (position.y >= 0 && position.y + popover.offsetHeight <= bounds.height) { + partialPosition.y = position.y; + } + this.updatePosition(partialPosition); + } + onDragEnd() { + this.dragStartState = void 0; + } +}; + +// packages/ag-charts-community/src/components/toolbar/toolbarButtonProperties.ts +var ToolbarButtonProperties = class extends BaseProperties { +}; +__decorateClass([ + addFakeTransformToInstanceProperty +], ToolbarButtonProperties.prototype, "icon", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], ToolbarButtonProperties.prototype, "label", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], ToolbarButtonProperties.prototype, "ariaLabel", 2); +__decorateClass([ + addFakeTransformToInstanceProperty +], ToolbarButtonProperties.prototype, "tooltip", 2); + +// packages/ag-charts-community/src/components/toolbar/toolbarButtonWidget.ts +var ARIA_HASPOPUP = { + "disjoint-channel": "false", + "fibonacci-menu": "menu", + "fibonacci-retracement": "false", + "fibonacci-retracement-trend-based": "false", + "fill-color": "dialog", + "horizontal-line": "false", + "line-color": "dialog", + "line-menu": "menu", + "line-stroke-width": "menu", + "line-style-type": "menu", + "measurer-menu": "menu", + "pan-end": "false", + "pan-left": "false", + "pan-right": "false", + "pan-start": "false", + "parallel-channel": "false", + "shape-menu": "menu", + "text-color": "dialog", + "text-menu": "menu", + "text-size": "menu", + "vertical-line": "false", + "zoom-in": "false", + "zoom-out": "false", + callout: "false", + clear: "false", + comment: "false", + delete: "false", + line: "false", + lock: "false", + menu: "menu", + note: "false", + reset: "false", + settings: "dialog", + text: "false" +}; +function getAriaHasPopupOfValue(value) { + if (typeof value !== "string") + return "false"; + return ARIA_HASPOPUP[value]; +} +var ToolbarButtonWidget = class extends ButtonWidget { + constructor(localeManager) { + super(); + this.localeManager = localeManager; + } + update(options) { + const { localeManager } = this; + if (options.tooltip) { + this.elem.title = localeManager.t(options.tooltip); + } + let innerHTML = ""; + if (options.icon != null) { + innerHTML = ``; + } + if (options.label != null) { + const label = localeManager.t(options.label); + innerHTML = `${innerHTML}${label}`; + } + const haspopup = getAriaHasPopupOfValue(options.value); + if (haspopup == "false") { + this.setAriaHasPopup(void 0); + this.setAriaExpanded(void 0); + } else { + this.setAriaHasPopup(haspopup); + this.setAriaExpanded(false); + } + this.elem.innerHTML = innerHTML; + } + setChecked(checked) { + setAttribute(this.elem, "aria-checked", checked); + } +}; + +// packages/ag-charts-community/src/components/toolbar/toolbar.ts +var BUTTON_ACTIVE_CLASS = "ag-charts-toolbar__button--active"; +var BaseToolbar = class extends ToolbarWidget { + constructor({ eventsHub, localeManager }, ariaLabelId, orientation) { + super(orientation); + this.ariaLabelId = ariaLabelId; + this.horizontalSpacing = 10; + this.verticalSpacing = 10; + this.events = new Listeners(); + this.hasPrefix = false; + this.buttonWidgets = []; + this.updateAriaLabel = () => this.setAriaLabel(this.localeManager.t(this.ariaLabelId)); + this.eventsHub = eventsHub; + this.localeManager = localeManager; + this.addClass("ag-charts-toolbar"); + this.toggleClass("ag-charts-toolbar--horizontal", orientation === "horizontal"); + this.toggleClass("ag-charts-toolbar--vertical", orientation === "vertical"); + this.eventsHub.on("locale:change", this.updateAriaLabel); + this.updateAriaLabel(); + } + setAriaLabelId(ariaLabelId) { + this.ariaLabelId = ariaLabelId; + this.updateAriaLabel(); + } + addToolbarListener(eventType, handler) { + return this.events.addListener(eventType, handler); + } + clearButtons() { + this.expanded?.collapse({ mode: "2" /* DESTROY */ }); + for (const button of this.buttonWidgets) { + button.destroy(); + } + this.buttonWidgets.splice(0); + } + updateButtons(buttons2) { + const { buttonWidgets } = this; + for (const [index, button] of buttons2.entries()) { + const buttonWidget = this.buttonWidgets.at(index) ?? this.createButton(index, button); + buttonWidget.update(button); + } + for (let index = buttons2.length; index < buttonWidgets.length; index++) { + const button = this.buttonWidgets.at(index); + button?.destroy(); + } + this.buttonWidgets.splice(buttons2.length); + this.refreshButtonClasses(); + } + updateButtonByIndex(index, button) { + this.buttonWidgets.at(index)?.update(button); + } + clearActiveButton() { + for (const button of this.buttonWidgets) { + button.toggleClass(BUTTON_ACTIVE_CLASS, false); + } + } + toggleActiveButtonByIndex(index) { + if (index === -1) + return; + for (const [buttonIndex, button] of this.buttonWidgets.entries()) { + button.toggleClass(BUTTON_ACTIVE_CLASS, index != null && index === buttonIndex); + } + } + toggleButtonEnabledByIndex(index, enabled) { + if (index === -1) + return; + this.buttonWidgets.at(index)?.setEnabled(enabled); + } + toggleSwitchCheckedByIndex(index, checked) { + if (index === -1) + return; + this.buttonWidgets.at(index)?.setChecked(checked); + } + getButtonBounds() { + return this.buttonWidgets.map((buttonWidget) => this.getButtonWidgetBounds(buttonWidget)); + } + setButtonHiddenByIndex(index, hidden) { + this.buttonWidgets.at(index)?.setHidden(hidden); + } + getButtonWidgetBounds(buttonWidget) { + const parent = this.getBounds(); + const bounds = buttonWidget.getBounds(); + return new BBox(bounds.x + parent.x, bounds.y + parent.y, bounds.width, bounds.height); + } + refreshButtonClasses() { + const { buttonWidgets, hasPrefix } = this; + let first2; + let last; + let section; + for (const [index, buttonWidget] of buttonWidgets.entries()) { + first2 = !hasPrefix && index === 0 || section != buttonWidget.section; + last = index === buttonWidgets.length - 1 || buttonWidget.section != buttonWidgets.at(index + 1)?.section; + buttonWidget.toggleClass("ag-charts-toolbar__button--first", first2); + buttonWidget.toggleClass("ag-charts-toolbar__button--last", last); + buttonWidget.toggleClass("ag-charts-toolbar__button--gap", index > 0 && first2); + section = buttonWidget.section; + } + } + createButton(index, button) { + const buttonWidget = this.createButtonWidget(); + buttonWidget.addClass("ag-charts-toolbar__button"); + buttonWidget.addListener("click", (event) => { + const buttonOptions = { index, ...button instanceof BaseProperties ? button.toJson() : button }; + const buttonBounds = this.getButtonWidgetBounds(buttonWidget); + const params = { + event, + button: buttonOptions, + buttonBounds, + buttonWidget + }; + this.events.dispatch("button-pressed", params); + }); + buttonWidget.addListener("focus", () => { + const params = { button: { index } }; + this.events.dispatch("button-focused", params); + }); + buttonWidget.addListener("expand-controlled-widget", (e) => { + this.expanded?.collapse({ mode: "4" /* SIDLING_OPENED */ }); + this.expanded = e.controlled; + const removeListener = this.expanded.addListener("collapse-widget", () => { + this.expanded = void 0; + removeListener(); + }); + }); + if (button.section) { + buttonWidget.section = button.section; + } + this.buttonWidgets.push(buttonWidget); + this.addChild(buttonWidget); + return buttonWidget; + } +}; +var Toolbar = class extends BaseToolbar { + createButtonWidget() { + return new ToolbarButtonWidget(this.localeManager); + } +}; + +// packages/ag-charts-community/src/components/toolbar/floatingToolbar.ts +var FloatingToolbarPopover = class extends DraggablePopover { + constructor(ctx, id, onPopoverMoved) { + super(ctx, id); + this.onPopoverMoved = onPopoverMoved; + this.dragHandleDraggingClass = "ag-charts-floating-toolbar__drag-handle--dragging"; + } + show(children, options = {}) { + this.showWithChildren(children, { + ...options, + class: "ag-charts-floating-toolbar" + }); + } + hide() { + this.dragged = false; + super.hide(); + } + getBounds() { + const element2 = this.getPopoverElement(); + return new BBox( + element2?.offsetLeft ?? 0, + element2?.offsetTop ?? 0, + element2?.offsetWidth ?? 0, + element2?.offsetHeight ?? 0 + ); + } + hasBeenDragged() { + return this.dragged; + } + setAnchor(anchor, horizontalSpacing, verticalSpacing) { + const element2 = this.getPopoverElement(); + if (!element2) + return; + const position = anchor.position ?? "above"; + const { offsetWidth: width2, offsetHeight: height2 } = element2; + let top = anchor.y - height2 - verticalSpacing; + let left = anchor.x - width2 / 2; + if (position === "below") { + top = anchor.y + verticalSpacing; + } else if (position === "right") { + top = anchor.y - height2 / 2; + left = anchor.x + horizontalSpacing; + } else if (position === "above-left") { + left = anchor.x; + } + this.updatePosition({ x: left, y: top }); + } + ignorePointerEvents() { + const element2 = this.getPopoverElement(); + if (element2) + element2.style.pointerEvents = "none"; + } + capturePointerEvents() { + const element2 = this.getPopoverElement(); + if (element2) + element2.style.pointerEvents = "unset"; + } + updatePosition(position) { + const bounds = this.getBounds(); + const canvasRect = this.ctx.domManager.getBoundingClientRect(); + position.x = Math.floor(clamp(0, position.x, canvasRect.width - bounds.width)); + position.y = Math.floor(clamp(0, position.y, canvasRect.height - bounds.height)); + super.updatePosition(position); + this.onPopoverMoved(); + } +}; +var FloatingToolbar = class extends BaseToolbar { + constructor(ctx, ariaLabelId, id) { + super(ctx, ariaLabelId, "horizontal"); + this.hasPrefix = true; + this.popover = new FloatingToolbarPopover(ctx, id, this.onPopoverMoved.bind(this)); + this.dragHandle = new DragHandleWidget(ctx.localeManager.t("toolbarAnnotationsDragHandle")); + this.popover.setDragHandle(this.dragHandle); + } + destroy() { + super.destroy(); + this.popover.destroy(); + } + show(options = {}) { + this.popover.show([this.dragHandle.getElement(), this.getElement()], options); + } + hide() { + this.popover.hide(); + } + setAnchor(anchor) { + this.popover.setAnchor(anchor, this.horizontalSpacing, this.verticalSpacing); + } + hasBeenDragged() { + return this.popover.hasBeenDragged(); + } + ignorePointerEvents() { + this.popover.ignorePointerEvents(); + } + capturePointerEvents() { + this.popover.capturePointerEvents(); + } + onPopoverMoved() { + const popoverBounds = this.popover.getBounds(); + if (this.popoverBounds?.equals(popoverBounds)) + return; + this.popoverBounds = popoverBounds.clone(); + const buttonBounds = this.getButtonBounds(); + this.events.dispatch("toolbar-moved", { popoverBounds, buttonBounds }); + } + getButtonWidgetBounds(buttonWidget) { + const popoverBounds = this.popover.getBounds(); + const bounds = super.getButtonWidgetBounds(buttonWidget); + const dragHandleBounds = this.dragHandle.getBounds(); + return new BBox( + bounds.x + popoverBounds.x - dragHandleBounds.width, + bounds.y + popoverBounds.y, + bounds.width, + bounds.height + ); + } +}; +var DragHandleWidget = class extends NativeWidget { + constructor(title) { + super(createElement("div", "ag-charts-floating-toolbar__drag-handle")); + const icon = new NativeWidget( + createElement("span", `${getIconClassNames("drag-handle")} ag-charts-toolbar__icon`) + ); + icon.setAriaHidden(true); + this.addChild(icon); + this.elem.title = title; + } +}; + +// packages/ag-charts-community/src/module-support.ts +var motion = { ...fromToMotion_exports, ...resetMotion_exports }; + +// packages/ag-charts-community/src/main.ts +var AgChartsCommunityModule = { + VERSION, + _Scene: integrated_charts_scene_exports, + _Theme: integrated_charts_theme_exports, + _Util: integrated_charts_util_exports, + create: AgCharts.create.bind(AgCharts), + createSparkline: AgCharts.__createSparkline.bind(AgCharts), + setup: registerInbuiltModules, + isEnterprise: false +}; + +// packages/ag-charts-enterprise/dist/package/main.esm.mjs +var __defProp2 = Object.defineProperty; +var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; +var __decorateClass2 = (decorators, target, key, kind) => { + var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc2(target, key) : target; + for (var i = decorators.length - 1, decorator; i >= 0; i--) + if (decorator = decorators[i]) + result = (kind ? decorator(target, key, result) : decorator(result)) || result; + if (kind && result) + __defProp2(target, key, result); + return result; +}; +var MD5 = class { + constructor() { + this.ieCompatibility = false; + } + init() { + this.ieCompatibility = this.md5("hello") != "5d41402abc4b2a76b9719d911017c592"; + } + md5cycle(x, k) { + let a = x[0], b = x[1], c = x[2], d = x[3]; + a = this.ff(a, b, c, d, k[0], 7, -680876936); + d = this.ff(d, a, b, c, k[1], 12, -389564586); + c = this.ff(c, d, a, b, k[2], 17, 606105819); + b = this.ff(b, c, d, a, k[3], 22, -1044525330); + a = this.ff(a, b, c, d, k[4], 7, -176418897); + d = this.ff(d, a, b, c, k[5], 12, 1200080426); + c = this.ff(c, d, a, b, k[6], 17, -1473231341); + b = this.ff(b, c, d, a, k[7], 22, -45705983); + a = this.ff(a, b, c, d, k[8], 7, 1770035416); + d = this.ff(d, a, b, c, k[9], 12, -1958414417); + c = this.ff(c, d, a, b, k[10], 17, -42063); + b = this.ff(b, c, d, a, k[11], 22, -1990404162); + a = this.ff(a, b, c, d, k[12], 7, 1804603682); + d = this.ff(d, a, b, c, k[13], 12, -40341101); + c = this.ff(c, d, a, b, k[14], 17, -1502002290); + b = this.ff(b, c, d, a, k[15], 22, 1236535329); + a = this.gg(a, b, c, d, k[1], 5, -165796510); + d = this.gg(d, a, b, c, k[6], 9, -1069501632); + c = this.gg(c, d, a, b, k[11], 14, 643717713); + b = this.gg(b, c, d, a, k[0], 20, -373897302); + a = this.gg(a, b, c, d, k[5], 5, -701558691); + d = this.gg(d, a, b, c, k[10], 9, 38016083); + c = this.gg(c, d, a, b, k[15], 14, -660478335); + b = this.gg(b, c, d, a, k[4], 20, -405537848); + a = this.gg(a, b, c, d, k[9], 5, 568446438); + d = this.gg(d, a, b, c, k[14], 9, -1019803690); + c = this.gg(c, d, a, b, k[3], 14, -187363961); + b = this.gg(b, c, d, a, k[8], 20, 1163531501); + a = this.gg(a, b, c, d, k[13], 5, -1444681467); + d = this.gg(d, a, b, c, k[2], 9, -51403784); + c = this.gg(c, d, a, b, k[7], 14, 1735328473); + b = this.gg(b, c, d, a, k[12], 20, -1926607734); + a = this.hh(a, b, c, d, k[5], 4, -378558); + d = this.hh(d, a, b, c, k[8], 11, -2022574463); + c = this.hh(c, d, a, b, k[11], 16, 1839030562); + b = this.hh(b, c, d, a, k[14], 23, -35309556); + a = this.hh(a, b, c, d, k[1], 4, -1530992060); + d = this.hh(d, a, b, c, k[4], 11, 1272893353); + c = this.hh(c, d, a, b, k[7], 16, -155497632); + b = this.hh(b, c, d, a, k[10], 23, -1094730640); + a = this.hh(a, b, c, d, k[13], 4, 681279174); + d = this.hh(d, a, b, c, k[0], 11, -358537222); + c = this.hh(c, d, a, b, k[3], 16, -722521979); + b = this.hh(b, c, d, a, k[6], 23, 76029189); + a = this.hh(a, b, c, d, k[9], 4, -640364487); + d = this.hh(d, a, b, c, k[12], 11, -421815835); + c = this.hh(c, d, a, b, k[15], 16, 530742520); + b = this.hh(b, c, d, a, k[2], 23, -995338651); + a = this.ii(a, b, c, d, k[0], 6, -198630844); + d = this.ii(d, a, b, c, k[7], 10, 1126891415); + c = this.ii(c, d, a, b, k[14], 15, -1416354905); + b = this.ii(b, c, d, a, k[5], 21, -57434055); + a = this.ii(a, b, c, d, k[12], 6, 1700485571); + d = this.ii(d, a, b, c, k[3], 10, -1894986606); + c = this.ii(c, d, a, b, k[10], 15, -1051523); + b = this.ii(b, c, d, a, k[1], 21, -2054922799); + a = this.ii(a, b, c, d, k[8], 6, 1873313359); + d = this.ii(d, a, b, c, k[15], 10, -30611744); + c = this.ii(c, d, a, b, k[6], 15, -1560198380); + b = this.ii(b, c, d, a, k[13], 21, 1309151649); + a = this.ii(a, b, c, d, k[4], 6, -145523070); + d = this.ii(d, a, b, c, k[11], 10, -1120210379); + c = this.ii(c, d, a, b, k[2], 15, 718787259); + b = this.ii(b, c, d, a, k[9], 21, -343485551); + x[0] = this.add32(a, x[0]); + x[1] = this.add32(b, x[1]); + x[2] = this.add32(c, x[2]); + x[3] = this.add32(d, x[3]); + } + cmn(q, a, b, x, s, t) { + a = this.add32(this.add32(a, q), this.add32(x, t)); + return this.add32(a << s | a >>> 32 - s, b); + } + ff(a, b, c, d, x, s, t) { + return this.cmn(b & c | ~b & d, a, b, x, s, t); + } + gg(a, b, c, d, x, s, t) { + return this.cmn(b & d | c & ~d, a, b, x, s, t); + } + hh(a, b, c, d, x, s, t) { + return this.cmn(b ^ c ^ d, a, b, x, s, t); + } + ii(a, b, c, d, x, s, t) { + return this.cmn(c ^ (b | ~d), a, b, x, s, t); + } + md51(s) { + const n = s.length; + const state = [1732584193, -271733879, -1732584194, 271733878]; + let i; + for (i = 64; i <= s.length; i += 64) { + this.md5cycle(state, this.md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + const tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < s.length; i++) { + tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3); + } + tail[i >> 2] |= 128 << (i % 4 << 3); + if (i > 55) { + this.md5cycle(state, tail); + for (i = 0; i < 16; i++) { + tail[i] = 0; + } + } + tail[14] = n * 8; + this.md5cycle(state, tail); + return state; + } + /* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5 + * algorithm for multi-byte characters (perhaps by adding every four 16-bit characters and + * shortening the sum to 32 bits). Otherwise I suthis.ggest performing MD-5 as if every character + * was two bytes--e.g., 0040 0025 = @%--but then how will an ordinary MD-5 sum be matched? + * There is no way to standardize text to something like UTF-8 before transformation; speed cost is + * utterly prohibitive. The JavaScript standard itself needs to look at this: it should start + * providing access to strings as preformed UTF-8 8-bit unsigned value arrays. + */ + md5blk(s) { + const md5blks = []; + for (let i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + } + rhex(n) { + const hex_chr = "0123456789abcdef".split(""); + let s = "", j = 0; + for (; j < 4; j++) { + s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15]; + } + return s; + } + hex(x) { + for (let i = 0; i < x.length; i++) { + x[i] = this.rhex(x[i]); + } + return x.join(""); + } + md5(s) { + return this.hex(this.md51(s)); + } + add32(a, b) { + return this.ieCompatibility ? this.add32Compat(a, b) : this.add32Std(a, b); + } + /* this function is much faster, so if possible we use it. Some IEs are the only ones I know of that + need the idiotic second function, generated by an if clause. */ + add32Std(a, b) { + return a + b & 4294967295; + } + add32Compat(x, y) { + const lsw = (x & 65535) + (y & 65535), msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 65535; + } +}; +function missingOrEmpty(value) { + return value == null || value.length === 0; +} +var LICENSE_TYPES = { + "01": "GRID", + "02": "CHARTS", + "0102": "BOTH" +}; +var LICENSING_HELP_URL = "https://www.ag-grid.com/charts/licensing/"; +var _LicenseManager = class _LicenseManager2 { + constructor(document2) { + this.watermarkMessage = void 0; + this.totalMessageLength = 124; + this.document = document2; + this.md5 = new MD5(); + this.md5.init(); + } + validateLicense() { + const licenseDetails = this.getLicenseDetails(_LicenseManager2.licenseKey, _LicenseManager2.gridContext); + const currentLicenseName = `AG ${licenseDetails.currentLicenseType === "BOTH" ? "Grid and " : ""}Charts Enterprise`; + let suppliedLicenseName = ""; + if (licenseDetails.suppliedLicenseType === "BOTH") { + suppliedLicenseName = "AG Grid and AG Charts Enterprise"; + } else if (licenseDetails.suppliedLicenseType === "GRID") { + suppliedLicenseName = "AG Grid Enterprise"; + } else if (licenseDetails.suppliedLicenseType !== void 0) { + suppliedLicenseName = "AG Charts Enterprise"; + } + if (licenseDetails.missing) { + if (!this.isWebsiteUrl() || this.isForceWatermark()) { + this.outputMissingLicenseKey(currentLicenseName); + } + } else if (licenseDetails.expired) { + const gridReleaseDate = _LicenseManager2.getChartsReleaseDate(); + const formattedReleaseDate = _LicenseManager2.formatDate(gridReleaseDate); + this.outputExpiredKey(licenseDetails.expiry, formattedReleaseDate, suppliedLicenseName); + } else if (!licenseDetails.valid) { + this.outputInvalidLicenseKey( + !!licenseDetails.incorrectLicenseType, + currentLicenseName, + suppliedLicenseName + ); + } else if (licenseDetails.isTrial && licenseDetails.trialExpired) { + this.outputExpiredTrialKey(licenseDetails.expiry, currentLicenseName, suppliedLicenseName); + } + } + static extractExpiry(license) { + const restrictionHashed = license.substring(license.lastIndexOf("_") + 1, license.length); + return new Date(Number.parseInt(_LicenseManager2.decode(restrictionHashed), 10)); + } + static extractLicenseComponents(licenseKey) { + let cleanedLicenseKey = licenseKey.replaceAll(/[\u200B-\u200D\uFEFF]/g, ""); + cleanedLicenseKey = cleanedLicenseKey.replaceAll(/\r?\n|\r/g, ""); + if (licenseKey.length <= 32) { + return { md5: null, license: licenseKey, version: null, isTrial: null }; + } + const hashStart = cleanedLicenseKey.length - 32; + const md5 = cleanedLicenseKey.substring(hashStart); + const license = cleanedLicenseKey.substring(0, hashStart); + const [version, isTrial, type] = _LicenseManager2.extractBracketedInformation(cleanedLicenseKey); + return { md5, license, version, isTrial, type }; + } + getLicenseDetails(licenseKey, gridContext = false) { + const currentLicenseType = "CHARTS"; + if (missingOrEmpty(licenseKey)) { + return { + licenseKey, + valid: false, + missing: true, + currentLicenseType + }; + } + const chartsReleaseDate = _LicenseManager2.getChartsReleaseDate(); + const { md5, license, version, isTrial, type } = _LicenseManager2.extractLicenseComponents(licenseKey); + let valid = md5 === this.md5.md5(license) && !licenseKey.includes("For_Trialing_ag-Grid_Only"); + let trialExpired = void 0; + let expired = void 0; + let expiry = null; + let incorrectLicenseType = false; + let suppliedLicenseType = void 0; + function handleTrial() { + const now = /* @__PURE__ */ new Date(); + trialExpired = expiry < now; + expired = void 0; + } + if (valid) { + expiry = _LicenseManager2.extractExpiry(license); + valid = !Number.isNaN(expiry.getTime()); + if (valid) { + expired = chartsReleaseDate > expiry; + switch (version) { + case "legacy": + case "2": { + valid = false; + break; + } + case "3": { + if (missingOrEmpty(type)) { + valid = false; + } else { + suppliedLicenseType = type; + if (type !== LICENSE_TYPES["02"] && type !== LICENSE_TYPES["0102"]) { + valid = false; + incorrectLicenseType = true; + } else if (isTrial) { + handleTrial(); + } + } + } + } + } + } + if (!valid) { + return { + licenseKey, + valid, + incorrectLicenseType, + currentLicenseType, + suppliedLicenseType + }; + } + return { + licenseKey, + valid, + expiry: _LicenseManager2.formatDate(expiry), + expired, + version, + isTrial, + trialExpired, + invalidLicenseTypeForCombo: gridContext ? suppliedLicenseType !== "BOTH" : void 0, + incorrectLicenseType, + currentLicenseType, + suppliedLicenseType + }; + } + isDisplayWatermark() { + return this.isForceWatermark() || !this.isLocalhost() && !this.isE2ETest() && !this.isWebsiteUrl() && !missingOrEmpty(this.watermarkMessage); + } + getWatermarkMessage() { + return this.watermarkMessage ?? ""; + } + getHostname() { + if (!this.document) { + return "localhost"; + } + const win = this.document.defaultView ?? globalThis; + if (!win) { + return "localhost"; + } + const loc = win.location; + const { hostname = "" } = loc; + return hostname; + } + isForceWatermark() { + if (!this.document) { + return false; + } + const win = this.document?.defaultView ?? globalThis.window != void 0 ? globalThis : void 0; + if (!win) { + return false; + } + const { pathname } = win.location; + return pathname ? pathname.includes("forceWatermark") : false; + } + isWebsiteUrl() { + const hostname = this.getHostname(); + return /^((?:[\w-]+\.)?ag-grid\.com)$/.exec(hostname) !== null; + } + isLocalhost() { + const hostname = this.getHostname(); + return /^(?:127\.0\.0\.1|localhost)$/.exec(hostname) !== null; + } + isE2ETest() { + const hostname = this.getHostname(); + return /^(?:172\.17\.0\.1|host\.docker\.internal)$/.exec(hostname) !== null; + } + static formatDate(date2) { + const monthNames = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ]; + const day = date2.getDate(); + const monthIndex = date2.getMonth(); + const year = date2.getFullYear(); + return day + " " + monthNames[monthIndex] + " " + year; + } + static getChartsReleaseDate() { + return new Date(Number.parseInt(_LicenseManager2.decode(_LicenseManager2.RELEASE_INFORMATION), 10)); + } + static decode(input) { + const keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + let t = ""; + let n, r, i; + let s, o, u, a; + let f = 0; + const e = input.replaceAll(/[^A-Za-z0-9+/=]/g, ""); + while (f < e.length) { + s = keystr.indexOf(e.charAt(f++)); + o = keystr.indexOf(e.charAt(f++)); + u = keystr.indexOf(e.charAt(f++)); + a = keystr.indexOf(e.charAt(f++)); + n = s << 2 | o >> 4; + r = (o & 15) << 4 | u >> 2; + i = (u & 3) << 6 | a; + t = t + String.fromCodePoint(n); + if (u != 64) { + t = t + String.fromCodePoint(r); + } + if (a != 64) { + t = t + String.fromCodePoint(i); + } + } + t = _LicenseManager2.utf8_decode(t); + return t; + } + static utf8_decode(input) { + input = input.replaceAll("rn", "n"); + let t = ""; + for (let n = 0; n < input.length; n++) { + const r = input.codePointAt(n); + if (r < 128) { + t += String.fromCodePoint(r); + } else if (r > 127 && r < 2048) { + t += String.fromCodePoint(r >> 6 | 192); + t += String.fromCodePoint(r & 63 | 128); + } else { + t += String.fromCodePoint(r >> 12 | 224); + t += String.fromCodePoint(r >> 6 & 63 | 128); + t += String.fromCodePoint(r & 63 | 128); + } + } + return t; + } + static setGridContext(gridContext = false) { + _LicenseManager2.gridContext = gridContext; + } + static setLicenseKey(licenseKey) { + if (this.licenseKey && this.licenseKey !== licenseKey) { + console.warn( + `License Key being set multiple times with different values. This can result in an incorrect license key being used.` + ); + } + _LicenseManager2.licenseKey = licenseKey; + } + static extractBracketedInformation(licenseKey) { + if (!licenseKey.includes("[")) { + return ["legacy", false, void 0]; + } + const matches = licenseKey.match(/\[(.*?)\]/g).map((match) => match.replace("[", "").replace("]", "")); + if (!matches || matches.length === 0) { + return ["legacy", false, void 0]; + } + const isTrial = matches.filter((match) => match === "TRIAL").length === 1; + const rawVersion = matches.find((match) => match.startsWith("v")); + const version = rawVersion ? rawVersion.replace("v", "") : "legacy"; + const type = LICENSE_TYPES[matches.find((match) => LICENSE_TYPES[match])]; + return [version, isTrial, type]; + } + centerPadAndOutput(input) { + const paddingRequired = this.totalMessageLength - input.length; + console.error(input.padStart(paddingRequired / 2 + input.length, "*").padEnd(this.totalMessageLength, "*")); + } + padAndOutput(input, padding2 = "*", terminateWithPadding = "") { + console.error( + input.padEnd(this.totalMessageLength - terminateWithPadding.length, padding2) + terminateWithPadding + ); + } + outputInvalidLicenseKey(incorrectLicenseType, currentLicenseName, suppliedLicenseName) { + if (!_LicenseManager2.gridContext) { + if (incorrectLicenseType) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Incompatible License Key "); + this.padAndOutput( + `* Your license key is for ${suppliedLicenseName} only and does not cover you for ${currentLicenseName}.`, + " ", + "*" + ); + this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } else { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Invalid License Key "); + this.padAndOutput(`* Your license key is not valid.`, " ", "*"); + this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + } + this.watermarkMessage = "Invalid License"; + } + outputExpiredTrialKey(formattedExpiryDate, currentLicenseName, suppliedLicenseName) { + if (!_LicenseManager2.gridContext) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Trial Period Expired. "); + this.padAndOutput( + `* Your trial only license for ${suppliedLicenseName} expired on ${formattedExpiryDate}.`, + " ", + "*" + ); + this.padAndOutput("* Please email info@ag-grid.com to purchase a license.", " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + this.watermarkMessage = "Trial Period Expired"; + } + outputMissingLicenseKey(currentLicenseName) { + if (!_LicenseManager2.gridContext) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" License Key Not Found "); + this.padAndOutput(`* All ${currentLicenseName} features are unlocked for trial.`, " ", "*"); + this.padAndOutput( + "* If you want to hide the watermark please email info@ag-grid.com for a trial license key.", + " ", + "*" + ); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + this.watermarkMessage = "For Trial Use Only"; + } + outputExpiredKey(formattedExpiryDate, formattedReleaseDate, currentLicenseName) { + if (!_LicenseManager2.gridContext) { + this.centerPadAndOutput(""); + this.centerPadAndOutput(` ${currentLicenseName} License `); + this.centerPadAndOutput(" Incompatible Software Version "); + this.padAndOutput( + `* Your license key works with versions of ${currentLicenseName} released before ${formattedExpiryDate}.`, + " ", + "*" + ); + this.padAndOutput(`* The version you are trying to use was released on ${formattedReleaseDate}.`, " ", "*"); + this.padAndOutput("* Please contact info@ag-grid.com to renew your license key.", " ", "*"); + this.centerPadAndOutput(""); + this.centerPadAndOutput(""); + } + this.watermarkMessage = "License Expired"; + } +}; +_LicenseManager.RELEASE_INFORMATION = "MTc2MTcyODQ5OTU1NQ=="; +_LicenseManager.gridContext = false; +var LicenseManager = _LicenseManager; +function loopSymmetrically(items, step, iterator) { + const loop = (start2, end3, loopStep, loopIterator) => { + let prev = items[0]; + for (let i = start2; loopStep > 0 ? i <= end3 : i > end3; i += loopStep) { + const curr = items[i]; + if (loopIterator(prev, curr)) + return true; + prev = curr; + } + return false; + }; + const midIndex = Math.floor(items.length / 2); + if (loop(step, midIndex, step, iterator)) + return true; + return loop(items.length - step, midIndex, -step, iterator); +} +var { AxisInterval: AxisInterval2, Property } = module_support_exports; +var AngleAxisInterval = class extends AxisInterval2 { +}; +__decorateClass2([ + Property +], AngleAxisInterval.prototype, "minSpacing", 2); +var { BaseProperties: BaseProperties2, ChartAxisDirection: ChartAxisDirection2, Property: Property2, Group: Group5, FONT_SIZE: FONT_SIZE2 } = module_support_exports; +var PolarCrossLineLabel = class extends BaseProperties2 { + constructor() { + super(...arguments); + this.fontSize = FONT_SIZE2.LARGE; + this.fontFamily = "Verdana, sans-serif"; + this.padding = 5; + this.color = "rgba(87, 87, 87, 1)"; + } +}; +__decorateClass2([ + Property2 +], PolarCrossLineLabel.prototype, "enabled", 2); +__decorateClass2([ + Property2 +], PolarCrossLineLabel.prototype, "text", 2); +__decorateClass2([ + Property2 +], PolarCrossLineLabel.prototype, "fontStyle", 2); +__decorateClass2([ + Property2 +], PolarCrossLineLabel.prototype, "fontWeight", 2); +__decorateClass2([ + Property2 +], PolarCrossLineLabel.prototype, "fontSize", 2); +__decorateClass2([ + Property2 +], PolarCrossLineLabel.prototype, "fontFamily", 2); +__decorateClass2([ + Property2 +], PolarCrossLineLabel.prototype, "padding", 2); +__decorateClass2([ + Property2 +], PolarCrossLineLabel.prototype, "color", 2); +__decorateClass2([ + Property2 +], PolarCrossLineLabel.prototype, "parallel", 2); +var PolarCrossLine = class extends BaseProperties2 { + constructor() { + super(...arguments); + this.id = createId(this); + this.defaultColorRange = []; + this.shape = "polygon"; + this.label = new PolarCrossLineLabel(); + this.scale = void 0; + this.clippedRange = [-Infinity, Infinity]; + this.gridLength = 0; + this.sideFlag = -1; + this.parallelFlipRotation = 0; + this.regularFlipRotation = 0; + this.direction = ChartAxisDirection2.Angle; + this.axisInnerRadius = 0; + this.axisOuterRadius = 0; + this.lineGroup = new Group5({ name: this.id }); + this.rangeGroup = new Group5({ name: this.id }); + this.labelGroup = new Group5({ name: this.id }); + this._isRange = void 0; + } + assignCrossLineGroup(isRange, crossLineRange) { + if (isRange !== this._isRange) { + if (isRange) { + this.rangeGroup.appendChild(crossLineRange); + } else { + this.lineGroup.appendChild(crossLineRange); + } + } + this._isRange = isRange; + } + setSectorNodeProps(node) { + node.fill = this.fill; + node.fillOpacity = this.fillOpacity ?? 1; + node.stroke = this.stroke; + node.strokeOpacity = this.strokeOpacity ?? 1; + node.strokeWidth = this.strokeWidth ?? 1; + node.lineDash = this.lineDash; + } + setLabelNodeProps(node, x, y, baseline, rotation) { + const { label } = this; + node.x = x; + node.y = y; + node.text = label.text; + node.textAlign = "center"; + node.textBaseline = baseline; + node.rotation = rotation; + node.rotationCenterX = x; + node.rotationCenterY = y; + node.fill = label.color; + node.fontFamily = label.fontFamily; + node.fontSize = label.fontSize; + node.fontStyle = label.fontStyle; + node.visible = true; + } +}; +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "enabled", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "type", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "range", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "value", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "defaultColorRange", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "fill", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "fillOpacity", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "stroke", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "strokeWidth", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "lineDash", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "shape", 2); +__decorateClass2([ + Property2 +], PolarCrossLine.prototype, "label", 2); +var { + ChartAxisDirection: ChartAxisDirection22, + getCrossLineValue: getCrossLineValue2, + validateCrossLineValue: validateCrossLineValue2, + normalizeAngle360: normalizeAngle3602, + Group: Group22, + Path: Path2, + Sector: Sector2, + RotatableText: RotatableText2, + ContinuousScale: ContinuousScale2 +} = module_support_exports; +var AngleCrossLine = class extends PolarCrossLine { + constructor() { + super(); + this.direction = ChartAxisDirection22.Angle; + this.polygonNode = new Path2(); + this.sectorNode = new Sector2(); + this.lineNode = new Path2(); + this.crossLineRange = new Group22(); + this.labelNode = new RotatableText2(); + this.ticks = []; + this.crossLineRange.append(this.polygonNode); + this.crossLineRange.append(this.sectorNode); + this.crossLineRange.append(this.lineNode); + this.labelGroup.append(this.labelNode); + } + visibilityCheck() { + if (!ContinuousScale2.is(this.scale)) { + return true; + } + const [d0, d1] = this.scale.domain; + const value = getCrossLineValue2(this); + if (this.type === "range") { + const [start2, end3] = value; + return start2 >= d0 && start2 <= d1 && end3 >= start2 && end3 <= d1; + } else { + return value >= d0 && value <= d1; + } + } + update(visible) { + const { scale: scale2 } = this; + if (!scale2 || !validateCrossLineValue2(this, scale2) || !this.visibilityCheck()) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updateLineNode(visible); + this.updatePolygonNode(visible); + this.updateSectorNode(visible); + this.updateLabelNode(visible); + } + updateLineNode(visible) { + const { scale: scale2, type, value, lineNode: line } = this; + if (!visible || type !== "line" || !scale2) { + line.visible = false; + return; + } + const angle2 = scale2.convert(value); + if (Number.isNaN(angle2)) { + line.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + line.visible = true; + line.stroke = this.stroke; + line.strokeOpacity = this.strokeOpacity ?? 1; + line.strokeWidth = this.strokeWidth ?? 1; + line.fill = void 0; + line.lineDash = this.lineDash; + const x = axisOuterRadius * Math.cos(angle2); + const y = axisOuterRadius * Math.sin(angle2); + const x0 = axisInnerRadius * Math.cos(angle2); + const y0 = axisInnerRadius * Math.sin(angle2); + line.path.clear(true); + line.path.moveTo(x0, y0); + line.path.lineTo(x, y); + this.assignCrossLineGroup(false, this.crossLineRange); + } + updatePolygonNode(visible) { + const { polygonNode: polygon, range: range22, scale: scale2, shape, type, ticks } = this; + if (!visible || type !== "range" || shape !== "polygon" || !scale2 || !range22) { + polygon.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + const startIndex = ticks.indexOf(range22[0]); + const endIndex = ticks.indexOf(range22[1]); + const stops = startIndex <= endIndex ? ticks.slice(startIndex, endIndex + 1) : ticks.slice(startIndex).concat(ticks.slice(0, endIndex + 1)); + const angles = stops.map((value) => scale2.convert(value)); + polygon.visible = true; + this.setSectorNodeProps(polygon); + const { path } = polygon; + path.clear(true); + for (const [index, angle2] of angles.entries()) { + const x = axisOuterRadius * Math.cos(angle2); + const y = axisOuterRadius * Math.sin(angle2); + if (index === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + if (axisInnerRadius === 0) { + path.lineTo(0, 0); + } else { + const reversedAngles = angles.slice().reverse(); + for (const angle2 of reversedAngles) { + const x = axisInnerRadius * Math.cos(angle2); + const y = axisInnerRadius * Math.sin(angle2); + path.lineTo(x, y); + } + } + polygon.path.closePath(); + this.assignCrossLineGroup(true, this.crossLineRange); + } + updateSectorNode(visible) { + const { sectorNode: sector, range: range22, scale: scale2, shape, type } = this; + if (!visible || type !== "range" || shape !== "circle" || !scale2 || !range22) { + sector.visible = false; + return; + } + const { axisInnerRadius, axisOuterRadius } = this; + const angles = range22.map((value) => scale2.convert(value)); + const step = scale2.step ?? 0; + const padding2 = scale2 instanceof module_support_exports.BandScale ? step / 2 : 0; + sector.visible = true; + this.setSectorNodeProps(sector); + sector.centerX = 0; + sector.centerY = 0; + sector.innerRadius = axisInnerRadius; + sector.outerRadius = axisOuterRadius; + sector.startAngle = angles[0] - padding2; + sector.endAngle = angles[1] + padding2; + this.assignCrossLineGroup(true, this.crossLineRange); + } + updateLabelNode(visible) { + const { label, labelNode: node, range: range22, scale: scale2, type, ticks } = this; + if (!visible || label.enabled === false || !label.text || !scale2 || type === "range" && !range22) { + node.visible = false; + return; + } + node.visible = true; + const { axisInnerRadius, axisOuterRadius } = this; + let labelX; + let labelY; + let rotation; + let textBaseline; + if (type === "line") { + const angle2 = normalizeAngle3602(scale2.convert(this.value)); + const angle270 = 1.5 * Math.PI; + const isRightSide = isNumberEqual(angle2, angle270) || angle2 > angle270 || angle2 < Math.PI / 2; + const midX = (axisInnerRadius + axisOuterRadius) / 2 * Math.cos(angle2); + const midY = (axisInnerRadius + axisOuterRadius) / 2 * Math.sin(angle2); + labelX = midX + label.padding * Math.cos(angle2 + Math.PI / 2); + labelY = midY + label.padding * Math.sin(angle2 + Math.PI / 2); + textBaseline = isRightSide ? "top" : "bottom"; + rotation = isRightSide ? angle2 : angle2 - Math.PI; + } else { + const [startAngle, endAngle] = range22.map((value) => normalizeAngle3602(scale2.convert(value))); + let angle2 = (startAngle + endAngle) / 2; + if (startAngle > endAngle) { + angle2 -= Math.PI; + } + angle2 = normalizeAngle3602(angle2); + const isBottomSide = (isNumberEqual(angle2, 0) || angle2 > 0) && angle2 < Math.PI; + let distance2; + if (this.shape === "circle" || ticks.length < 3) { + distance2 = axisOuterRadius - label.padding; + } else { + distance2 = axisOuterRadius * Math.cos(Math.PI / ticks.length) - label.padding; + } + labelX = distance2 * Math.cos(angle2); + labelY = distance2 * Math.sin(angle2); + textBaseline = isBottomSide ? "bottom" : "top"; + rotation = isBottomSide ? angle2 - Math.PI / 2 : angle2 + Math.PI / 2; + } + this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation); + } +}; +AngleCrossLine.className = "AngleCrossLine"; +var { + ChartAxisDirection: ChartAxisDirection3, + Property: Property3, + toRadians: toRadians2, + normalizeAngle360: normalizeAngle36022, + normalizeAngle360Inclusive: normalizeAngle360Inclusive2, + Path: Path22, + RotatableText: RotatableText22, + Transformable: Transformable2, + BBox: BBox2, + Selection: Selection2, + Line: Line2 +} = module_support_exports; +var AngleAxisLabel = class extends module_support_exports.AxisLabel { + constructor() { + super(...arguments); + this.orientation = "fixed"; + } +}; +__decorateClass2([ + Property3 +], AngleAxisLabel.prototype, "orientation", 2); +var AngleAxis = class extends module_support_exports.PolarAxis { + constructor(moduleCtx, scale2) { + super(moduleCtx, scale2); + this.startAngle = 0; + this.endAngle = void 0; + this.tickLineGroupSelection = Selection2.select( + this.tickLineGroup, + Line2, + false + ); + this.gridLineGroupSelection = Selection2.select( + this.gridLineGroup, + Line2, + false + ); + this.labelData = []; + this.tickData = []; + this.radiusLineGroup = this.axisGroup.appendChild(new module_support_exports.TransformableGroup()); + this.radiusLine = this.radiusLineGroup.appendChild(new Path22()); + this.includeInvisibleDomains = true; + } + get direction() { + return ChartAxisDirection3.Angle; + } + createLabel() { + return new AngleAxisLabel(); + } + calculateRotations() { + const rotation = toRadians2(this.startAngle); + const parallelFlipRotation = normalizeAngle36022(rotation); + const regularFlipRotation = normalizeAngle36022(rotation - Math.PI / 2); + return { rotation, parallelFlipRotation, regularFlipRotation }; + } + calculateTickLayout(domain) { + const { nice, scale: scale2 } = this; + const ticksParams = { + nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + const niceDomain = nice ? scale2.niceDomain(ticksParams, domain) : domain; + const tickData = this.generateAngleTicks(niceDomain); + this.tickData = tickData; + const ticks = tickData.map((t) => t.value); + const fractionDigits = ticks.reduce( + (f, t) => Math.max(typeof t === "number" ? countFractionDigits(t) : 0, f), + 0 + ); + return { + niceDomain, + tickDomain: niceDomain, + ticks, + rawTickCount: void 0, + fractionDigits, + timeInterval: void 0, + bbox: this.getBBox() + }; + } + update() { + super.update(); + this.updateRadiusLine(); + this.updateGridLines(); + this.updateTickLines(); + } + normalizedAngles() { + const startAngle = normalizeAngle36022(-Math.PI / 2 + toRadians2(this.startAngle)); + const sweep = this.endAngle == null ? 2 * Math.PI : normalizeAngle360Inclusive2(toRadians2(this.endAngle) - toRadians2(this.startAngle)); + const endAngle = startAngle + sweep; + return [startAngle, endAngle]; + } + computeRange() { + this.range = this.normalizedAngles(); + } + updateSelections() { + const data = this.tickData; + this.gridLineGroupSelection.update(this.gridLength && this.gridLine.enabled ? data : []); + this.tickLineGroupSelection.update(this.tick.enabled ? data : []); + this.tickLabelGroupSelection.update(this.label.enabled ? data : []); + this.gridLineGroupSelection.cleanup(); + this.tickLineGroupSelection.cleanup(); + this.tickLabelGroupSelection.cleanup(); + } + updatePosition() { + super.updatePosition(); + const { translation, radiusLineGroup } = this; + const translationX = Math.floor(translation.x); + const translationY = Math.floor(translation.y); + radiusLineGroup.translationX = translationX; + radiusLineGroup.translationY = translationY; + } + updateRadiusLine() { + const node = this.radiusLine; + const { path } = node; + path.clear(true); + const { points, closePath } = this.getAxisLinePoints(); + for (const { x, y, moveTo: moveTo2, arc, radius = 0, startAngle = 0, endAngle = 0 } of points) { + if (arc) { + path.arc(x, y, radius, startAngle, endAngle); + } else if (moveTo2) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + if (closePath) { + path.closePath(); + } + node.visible = this.line.enabled; + node.stroke = this.line.stroke; + node.strokeWidth = this.line.width; + node.fill = void 0; + } + getAxisLinePoints() { + const { scale: scale2, shape, gridLength: radius } = this; + const [startAngle, endAngle] = this.range; + const isFullCircle = isNumberEqual(endAngle - startAngle, 2 * Math.PI); + const points = []; + if (shape === "circle") { + if (isFullCircle) { + points.push( + { x: radius, y: 0, moveTo: true }, + { + x: 0, + y: 0, + radius, + startAngle: 0, + endAngle: 2 * Math.PI, + arc: true, + moveTo: false + } + ); + } else { + points.push( + { + x: radius * Math.cos(startAngle), + y: radius * Math.sin(startAngle), + moveTo: true + }, + { + x: 0, + y: 0, + radius, + startAngle: normalizeAngle36022(startAngle), + endAngle: normalizeAngle36022(endAngle), + arc: true, + moveTo: false + } + ); + } + } else if (shape === "polygon") { + const angles = scale2.ticks({ + nice: this.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.map((value) => scale2.convert(value)); + if (angles && angles.length > 2) { + for (const [i, angle2] of angles.entries()) { + const x = radius * Math.cos(angle2); + const y = radius * Math.sin(angle2); + const moveTo2 = i === 0; + points.push({ x, y, moveTo: moveTo2 }); + } + } + } + return { points, closePath: isFullCircle }; + } + updateGridLines() { + const { + scale: scale2, + gridLength: radius, + gridLine: { style: style2, width: width2 }, + innerRadiusRatio + } = this; + if (!(style2 && radius > 0)) { + return; + } + const innerRadius = radius * innerRadiusRatio; + const styleCount = style2.length; + this.gridLineGroupSelection.each((line, datum, index) => { + const { value } = datum; + const { stroke: stroke22, lineDash } = style2[index % styleCount]; + const angle2 = scale2.convert(value); + line.x1 = innerRadius * Math.cos(angle2); + line.y1 = innerRadius * Math.sin(angle2); + line.x2 = radius * Math.cos(angle2); + line.y2 = radius * Math.sin(angle2); + line.stroke = stroke22; + line.strokeWidth = width2; + line.lineDash = lineDash; + line.fill = void 0; + }); + this.gridLineGroupSelection.cleanup(); + } + updateLabels() { + const { label, tickLabelGroupSelection } = this; + tickLabelGroupSelection.each((node, _, index) => { + const labelDatum = this.labelData[index]; + if (!labelDatum || labelDatum.hidden) { + node.visible = false; + return; + } + node.text = labelDatum.text; + node.setFont(label); + node.fill = label.color; + node.x = labelDatum.x; + node.y = labelDatum.y; + node.setAlign(labelDatum); + node.setBoxing(label); + node.visible = true; + if (labelDatum.rotation) { + node.rotation = labelDatum.rotation; + node.rotationCenterX = labelDatum.x; + node.rotationCenterY = labelDatum.y; + } else { + node.rotation = 0; + } + }); + } + updateTickLines() { + const { scale: scale2, gridLength: radius, tick, tickLineGroupSelection } = this; + tickLineGroupSelection.each((line, datum) => { + const { value } = datum; + const angle2 = scale2.convert(value); + const cos = Math.cos(angle2); + const sin = Math.sin(angle2); + line.x1 = radius * cos; + line.y1 = radius * sin; + line.x2 = (radius + tick.size) * cos; + line.y2 = (radius + tick.size) * sin; + line.stroke = tick.stroke; + line.strokeWidth = tick.width; + }); + } + createLabelNodeData(ticks, options, seriesRect) { + const { label, gridLength: radius, scale: scale2, tick } = this; + if (!label.enabled) { + return []; + } + const tempText = new RotatableText22(); + const seriesLeft = seriesRect.x - this.translation.x; + const seriesRight = seriesRect.x + seriesRect.width - this.translation.x; + const { fractionDigits } = this.layout.label; + const axisTickFormatter2 = this.tickFormatter(this.scale.domain, this.tickData, false, fractionDigits); + const labelData = ticks.map((datum, index) => { + const { value } = datum; + const distance2 = radius + label.spacing + tick.size; + const angle2 = scale2.convert(value); + const cos = Math.cos(angle2); + const sin = Math.sin(angle2); + const x = distance2 * cos; + const y = distance2 * sin; + const { textAlign, textBaseline } = this.getLabelAlign(angle2); + const isLastTickOverFirst = index === ticks.length - 1 && value !== ticks[0] && isNumberEqual(normalizeAngle36022(angle2), normalizeAngle36022(scale2.convert(ticks[0]))); + const rotation = this.getLabelRotation(angle2); + let text2 = axisTickFormatter2(value, index); + tempText.text = text2; + tempText.x = x; + tempText.y = y; + tempText.setFont(label); + tempText.textAlign = textAlign; + tempText.textBaseline = textBaseline; + tempText.rotation = rotation; + if (rotation) { + tempText.rotationCenterX = x; + tempText.rotationCenterY = y; + } + let box = rotation ? Transformable2.toCanvas(tempText) : tempText.getBBox(); + if (box && options.hideWhenNecessary && !rotation) { + const overflowLeft = seriesLeft - box.x; + const overflowRight = box.x + box.width - seriesRight; + const pixelError = 1; + if (overflowLeft > pixelError || overflowRight > pixelError) { + const availWidth = box.width - Math.max(overflowLeft, overflowRight); + const wrapOptions = { maxWidth: availWidth, font: label, textWrap: "never" }; + text2 = wrapTextOrSegments(text2, wrapOptions); + tempText.text = text2; + box = tempText.getBBox(); + } + } + return { + text: text2, + x, + y, + textAlign, + textBaseline, + hidden: text2 === "" || (datum.hidden ?? isLastTickOverFirst), + rotation, + box + }; + }); + if (label.avoidCollisions) { + this.avoidLabelCollisions(labelData); + } + return labelData; + } + computeLabelsBBox(options, seriesRect) { + this.labelData = this.createLabelNodeData(this.tickData, options, seriesRect); + const textBoxes = this.labelData.map(({ box }) => box).filter((box) => box != null); + if (!this.label.enabled || textBoxes.length === 0) { + return null; + } + return BBox2.merge(textBoxes); + } + getLabelOrientation() { + const { label } = this; + return label instanceof AngleAxisLabel ? label.orientation : "fixed"; + } + getLabelRotation(tickAngle) { + let rotation = toRadians2(this.label.rotation ?? 0); + tickAngle = normalizeAngle36022(tickAngle); + const orientation = this.getLabelOrientation(); + if (orientation === "parallel") { + rotation += tickAngle; + if (tickAngle >= 0 && tickAngle < Math.PI) { + rotation -= Math.PI / 2; + } else { + rotation += Math.PI / 2; + } + } else if (orientation === "perpendicular") { + rotation += tickAngle; + if (tickAngle >= Math.PI / 2 && tickAngle < 1.5 * Math.PI) { + rotation += Math.PI; + } + } + return rotation; + } + getLabelAlign(tickAngle) { + const cos = Math.cos(tickAngle); + const sin = Math.sin(tickAngle); + let textAlign; + let textBaseline; + const orientation = this.getLabelOrientation(); + const isCos0 = isNumberEqual(cos, 0); + const isSin0 = isNumberEqual(sin, 0); + const isCos1 = isNumberEqual(cos, 1); + const isSinMinus1 = isNumberEqual(sin, -1); + const isCosPositive = cos > 0 && !isCos0; + const isSinPositive = sin > 0 && !isSin0; + if (orientation === "parallel") { + textAlign = "center"; + textBaseline = isCos1 && isSin0 || isSinPositive ? "top" : "bottom"; + } else if (orientation === "perpendicular") { + textAlign = isSinMinus1 || isCosPositive ? "left" : "right"; + textBaseline = "middle"; + } else { + textAlign = "right"; + if (isCos0) { + textAlign = "center"; + } else if (isCosPositive) { + textAlign = "left"; + } + textBaseline = "bottom"; + if (isSin0) { + textBaseline = "middle"; + } else if (isSinPositive) { + textBaseline = "top"; + } + } + return { textAlign, textBaseline }; + } + updateCrossLines() { + const { shape, gridLength: radius, innerRadiusRatio } = this; + for (const crossLine of this.crossLines) { + if (crossLine instanceof AngleCrossLine) { + crossLine.ticks = this.tickData.map((t) => t.value); + crossLine.shape = shape; + crossLine.axisOuterRadius = radius; + crossLine.axisInnerRadius = radius * innerRadiusRatio; + } + } + super.updateCrossLines(); + } +}; +AngleAxis.CrossLineConstructor = AngleCrossLine; +__decorateClass2([ + Property3 +], AngleAxis.prototype, "startAngle", 2); +__decorateClass2([ + Property3 +], AngleAxis.prototype, "endAngle", 2); +var { Property: Property4, CategoryScale: CategoryScale2 } = module_support_exports; +var AngleCategoryAxis = class extends AngleAxis { + constructor(moduleCtx) { + super(moduleCtx, new CategoryScale2()); + this.groupPaddingInner = 0; + this.paddingInner = 0; + this.interval = new AngleAxisInterval(); + } + hasDefinedDomain() { + return false; + } + generateAngleTicks(domain) { + const { scale: scale2, gridLength: radius } = this; + const { values, minSpacing } = this.interval; + const tickParams = { + nice: this.nice, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + }; + const ticks = values ?? scale2.ticks(tickParams, domain)?.ticks ?? []; + if (ticks.length < 2 || minSpacing == null) { + return ticks.map((value) => { + return { value, visible: true }; + }); + } + const startTick = ticks[0]; + const startAngle = scale2.convert(startTick); + const startX = radius * Math.cos(startAngle); + const startY = radius * Math.sin(startAngle); + for (let step = 1; step < ticks.length - 1; step++) { + const nextTick = ticks[step]; + const nextAngle = scale2.convert(nextTick); + if (nextAngle - startAngle > Math.PI) { + break; + } + const nextX = radius * Math.cos(nextAngle); + const nextY = radius * Math.sin(nextAngle); + const spacing = Math.hypot(nextX - startX, nextY - startY); + if (spacing > minSpacing) { + const visibleTicks = /* @__PURE__ */ new Set([startTick]); + loopSymmetrically(ticks, step, (_, next) => { + visibleTicks.add(next); + }); + return ticks.map((value) => { + const visible = visibleTicks.has(value); + return { value, visible }; + }); + } + } + return [{ value: startTick, visible: true }]; + } + avoidLabelCollisions(labelData) { + const { minSpacing } = this.label; + if (labelData.length < 3) + return; + const labelsCollide = (prev, next) => { + if (prev.hidden || next.hidden) { + return false; + } else if (minSpacing == null) { + return prev.box.collidesBBox(next.box); + } + const prevBox = prev.box.clone().grow(minSpacing / 2); + const nextBox = next.box.clone().grow(minSpacing / 2); + return prevBox.collidesBBox(nextBox); + }; + const firstLabel = labelData[0]; + const lastLabel = labelData.at(-1); + const visibleLabels = /* @__PURE__ */ new Set([firstLabel]); + const lastLabelIsOverFirst = isNumberEqual(firstLabel.x, lastLabel.x) && isNumberEqual(firstLabel.y, lastLabel.y); + const maxStep = Math.floor(labelData.length / 2); + for (let step = 1; step <= maxStep; step++) { + const labels = lastLabelIsOverFirst ? labelData.slice(0, -1) : labelData; + const collisionDetected = loopSymmetrically(labels, step, labelsCollide); + if (!collisionDetected) { + loopSymmetrically(labels, step, (_, next) => { + visibleLabels.add(next); + }); + break; + } + } + for (const datum of labelData) { + if (!visibleLabels.has(datum)) { + datum.hidden = true; + datum.box = void 0; + } + } + } + tickFormatParams() { + return { type: "category" }; + } + datumFormatParams(value, params) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +AngleCategoryAxis.className = "AngleCategoryAxis"; +AngleCategoryAxis.type = "angle-category"; +__decorateClass2([ + Property4 +], AngleCategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass2([ + Property4 +], AngleCategoryAxis.prototype, "paddingInner", 2); +__decorateClass2([ + Property4 +], AngleCategoryAxis.prototype, "interval", 2); +var AngleCategoryAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "angle-category", + moduleFactory: (ctx) => new AngleCategoryAxis(ctx) +}; +var { range: range3, isDenseInterval: isDenseInterval2, LinearScale: LinearScale2 } = module_support_exports; +var LinearAngleScale = class _LinearAngleScale extends LinearScale2 { + constructor() { + super(...arguments); + this.arcLength = 0; + } + static getNiceStepAndTickCount(ticks, domain) { + const [start2, stop] = domain; + let step = LinearScale2.getTickStep(start2, stop, ticks); + const maxTickCount = Number.isNaN(ticks.maxTickCount) ? Infinity : ticks.maxTickCount; + const expectedTickCount = Math.abs(stop - start2) / step; + let niceTickCount = Math.pow(2, Math.ceil(Math.log(expectedTickCount) / Math.log(2))); + if (niceTickCount > maxTickCount) { + niceTickCount /= 2; + step *= 2; + } + return { count: niceTickCount, step }; + } + ticks(ticks, domain = this.domain) { + const { arcLength } = this; + if (!domain || domain.length < 2 || domain.some((d) => !Number.isFinite(d)) || arcLength <= 0) { + return { ticks: [], count: 0 }; + } + const { nice, interval } = ticks; + const [d0, d1] = domain; + if (interval) { + const step2 = Math.abs(interval); + const availableRange = this.getPixelRange(); + if (!isDenseInterval2((d1 - d0) / step2, availableRange)) { + return range3(d0, d1, step2); + } + } + let step; + if (nice && this.hasNiceRange()) { + const linearNiceDomain = super.niceDomain(ticks, domain); + step = _LinearAngleScale.getNiceStepAndTickCount(ticks, linearNiceDomain).step; + } else { + step = LinearScale2.getTickStep(d0, d1, ticks); + } + return range3(d0, d1, step); + } + hasNiceRange() { + const sortedRange = this.range.slice().sort((a, b) => a - b); + const niceRanges = [Math.PI, 2 * Math.PI]; + return niceRanges.some((r) => isNumberEqual(r, sortedRange[1] - sortedRange[0])); + } + niceDomain(ticks, domain = this.domain) { + const linearNiceDomain = super.niceDomain(ticks, domain); + if (!this.hasNiceRange()) + return linearNiceDomain; + const reversed = linearNiceDomain[0] > linearNiceDomain[1]; + const start2 = reversed ? linearNiceDomain[1] : linearNiceDomain[0]; + const { step, count } = _LinearAngleScale.getNiceStepAndTickCount(ticks, linearNiceDomain); + const s = 1 / step; + const stop = step >= 1 ? Math.ceil(start2 / step + count) * step : Math.ceil((start2 + count * step) * s) / s; + return reversed ? [stop, start2] : [start2, stop]; + } + getPixelRange() { + return this.arcLength; + } +}; +var { Property: Property5, angleBetween: angleBetween2, normalisedExtentWithMetadata: normalisedExtentWithMetadata2, findMinMax: findMinMax2 } = module_support_exports; +var AngleNumberAxis = class extends AngleAxis { + constructor(moduleCtx) { + super(moduleCtx, new LinearAngleScale()); + this.shape = "circle"; + this.interval = new AngleAxisInterval(); + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata2(d, min, max); + return { domain: extent3, clipped }; + } + updateScale() { + super.updateScale(); + this.scale.arcLength = this.getRangeArcLength(); + } + getRangeArcLength() { + const { range: requestedRange } = this; + const min = Math.min(...requestedRange); + const max = Math.max(...requestedRange); + const rotation = angleBetween2(min, max) || 2 * Math.PI; + const radius = this.gridLength; + return rotation * radius; + } + generateAngleTicks(domain) { + const { scale: scale2, range: requestedRange, nice } = this; + const { values, step, minSpacing, maxSpacing } = this.interval; + let rawTicks; + if (values == null) { + const { arcLength } = scale2; + const minTickCount = maxSpacing ? Math.floor(arcLength / maxSpacing) : 1; + const maxTickCount = minSpacing ? Math.floor(arcLength / minSpacing) : Infinity; + const preferredTickCount = Math.floor(4 / Math.PI * Math.abs(requestedRange[0] - requestedRange[1])); + const tickCount = Math.max(minTickCount, Math.min(maxTickCount, preferredTickCount)); + const tickParams = { + nice, + interval: step, + tickCount, + minTickCount, + maxTickCount + }; + rawTicks = scale2.ticks(tickParams, domain)?.ticks ?? []; + } else { + const [d0, d1] = findMinMax2(domain.map(Number)); + rawTicks = values.filter((value) => value >= d0 && value <= d1).sort((a, b) => a - b); + } + return rawTicks.map((value) => ({ value, visible: true })); + } + avoidLabelCollisions(labelData) { + const { minSpacing } = this.label; + const labelsCollide = (prev, next) => { + if (prev.hidden || next.hidden) { + return false; + } else if (minSpacing == null) { + return prev.box.collidesBBox(next.box); + } + const prevBox = prev.box.clone().grow(minSpacing / 2); + const nextBox = next.box.clone().grow(minSpacing / 2); + return prevBox.collidesBBox(nextBox); + }; + const firstLabel = labelData[0]; + const lastLabel = labelData.at(-1); + if (firstLabel !== lastLabel && isNumberEqual(firstLabel.x, lastLabel.x) && isNumberEqual(firstLabel.y, lastLabel.y)) { + lastLabel.hidden = true; + } + for (let step = 1; step < labelData.length; step *= 2) { + let collisionDetected = false; + for (let i = step; i < labelData.length; i += step) { + const next = labelData[i]; + const prev = labelData[i - step]; + if (labelsCollide(prev, next)) { + collisionDetected = true; + break; + } + } + if (!collisionDetected) { + for (const [i, datum] of labelData.entries()) { + if (i % step > 0) { + datum.hidden = true; + datum.box = void 0; + } + } + return; + } + } + for (const [i, datum] of labelData.entries()) { + if (i > 0) { + datum.hidden = true; + datum.box = void 0; + } + } + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +AngleNumberAxis.className = "AngleNumberAxis"; +AngleNumberAxis.type = "angle-number"; +__decorateClass2([ + Property5 +], AngleNumberAxis.prototype, "min", 2); +__decorateClass2([ + Property5 +], AngleNumberAxis.prototype, "max", 2); +__decorateClass2([ + Property5 +], AngleNumberAxis.prototype, "interval", 2); +var AngleNumberAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "angle-number", + moduleFactory: (ctx) => new AngleNumberAxis(ctx) +}; +var { + OrdinalTimeScale: OrdinalTimeScale2, + Property: Property6, + TimeAxisParentLevel: TimeAxisParentLevel2, + lowestGranularityUnitForTicks: lowestGranularityUnitForTicks2, + lowestGranularityUnitForValue: lowestGranularityUnitForValue2, + minimumTimeAxisDatumGranularity: minimumTimeAxisDatumGranularity2, + dateTruncationForDomain: dateTruncationForDomain2, + intervalUnit: intervalUnit2, + intervalStep: intervalStep2, + intervalEpoch: intervalEpoch2, + intervalMilliseconds: intervalMilliseconds2 +} = module_support_exports; +var OrdinalTimeAxis = class extends module_support_exports.DiscreteTimeAxis { + constructor(moduleCtx) { + super(moduleCtx, new OrdinalTimeScale2()); + this.parentLevel = new TimeAxisParentLevel2(); + } + get primaryLabel() { + return this.parentLevel.enabled ? this.parentLevel.label : void 0; + } + get primaryTick() { + return this.parentLevel.enabled ? this.parentLevel.tick : void 0; + } + processData() { + super.processData(); + const { boundSeries, direction } = this; + this.minimumTimeGranularity = minimumTimeAxisDatumGranularity2(boundSeries, direction, void 0, void 0); + } + tickFormatParams(domain, ticks, _fractionDigits, timeInterval3) { + timeInterval3 ?? (timeInterval3 = lowestGranularityUnitForTicks2(ticks)); + const truncateDate = dateTruncationForDomain2(domain); + const unit = intervalUnit2(timeInterval3); + const step = intervalStep2(timeInterval3); + const epoch = intervalEpoch2(timeInterval3); + return { type: "date", unit, step, epoch, truncateDate }; + } + datumFormatParams(value, params, _fractionDigits, timeInterval3, style2) { + if (typeof value === "number") + value = new Date(value); + if (timeInterval3 == null) { + const { minimumTimeGranularity } = this; + const datumGranularity = lowestGranularityUnitForValue2(value); + if (minimumTimeGranularity != null && intervalMilliseconds2(minimumTimeGranularity) < intervalMilliseconds2(datumGranularity)) { + timeInterval3 = minimumTimeGranularity; + } else { + timeInterval3 = datumGranularity; + } + } + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + const unit = intervalUnit2(timeInterval3); + const step = intervalStep2(timeInterval3); + const epoch = intervalEpoch2(timeInterval3); + return { + type: "date", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + unit, + step, + epoch, + style: style2 + }; + } +}; +OrdinalTimeAxis.className = "OrdinalTimeAxis"; +OrdinalTimeAxis.type = "ordinal-time"; +__decorateClass2([ + Property6 +], OrdinalTimeAxis.prototype, "parentLevel", 2); +var OrdinalTimeAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "ordinal-time", + moduleFactory: (ctx) => new OrdinalTimeAxis(ctx) +}; +var { + ChartAxisDirection: ChartAxisDirection4, + Property: Property7, + validateCrossLineValue: validateCrossLineValue22, + normalizeAngle360FromDegrees: normalizeAngle360FromDegrees2, + Group: Group32, + Path: Path3, + Sector: Sector22, + RotatableText: RotatableText3 +} = module_support_exports; +var RadiusCrossLineLabel = class extends PolarCrossLineLabel { + constructor() { + super(...arguments); + this.positionAngle = void 0; + } +}; +__decorateClass2([ + Property7 +], RadiusCrossLineLabel.prototype, "positionAngle", 2); +var RadiusCrossLine = class extends PolarCrossLine { + constructor() { + super(); + this.direction = ChartAxisDirection4.Radius; + this.label = new RadiusCrossLineLabel(); + this.polygonNode = new Path3(); + this.sectorNode = new Sector22(); + this.crossLineRange = new Group32(); + this.labelNode = new RotatableText3(); + this.outerRadius = 0; + this.innerRadius = 0; + this.crossLineRange.append(this.polygonNode); + this.crossLineRange.append(this.sectorNode); + this.labelGroup.append(this.labelNode); + } + update(visible) { + const { scale: scale2 } = this; + if (!scale2 || !validateCrossLineValue22(this, scale2)) { + this.rangeGroup.visible = false; + this.lineGroup.visible = false; + this.labelGroup.visible = false; + return; + } + this.updateRadii(); + const { innerRadius, outerRadius } = this; + visible && (visible = innerRadius >= this.axisInnerRadius && outerRadius <= this.axisOuterRadius); + this.rangeGroup.visible = visible; + this.lineGroup.visible = visible; + this.labelGroup.visible = visible; + this.updatePolygonNode(visible); + this.updateSectorNode(visible); + this.updateLabelNode(visible); + this.assignCrossLineGroup(this.type === "range", this.crossLineRange); + } + updateRadii() { + const { range: range22, scale: scale2, type, axisInnerRadius, axisOuterRadius } = this; + if (!scale2) + return { innerRadius: 0, outerRadius: 0 }; + const getRadius = (value) => axisOuterRadius + axisInnerRadius - value; + let outerRadius, innerRadius; + if (type === "line") { + outerRadius = getRadius(scale2.convert(this.value)); + innerRadius = outerRadius; + } else { + const bandwidth = Math.abs(scale2?.bandwidth ?? 0); + const convertedRange = range22.map((r) => scale2.convert(r)); + outerRadius = getRadius(Math.max(...convertedRange)); + innerRadius = getRadius(Math.min(...convertedRange)) + bandwidth; + } + this.outerRadius = outerRadius; + this.innerRadius = innerRadius; + } + drawPolygon(radius, angles, polygon) { + for (const [index, angle2] of angles.entries()) { + const x = radius * Math.cos(angle2); + const y = radius * Math.sin(angle2); + if (index === 0) { + polygon.path.moveTo(x, y); + } else { + polygon.path.lineTo(x, y); + } + } + polygon.path.closePath(); + } + updatePolygonNode(visible) { + const { gridAngles, polygonNode: polygon, scale: scale2, shape, type, innerRadius, outerRadius } = this; + if (!visible || shape !== "polygon" || !scale2 || !gridAngles) { + polygon.visible = false; + return; + } + polygon.visible = true; + const padding2 = this.getPadding(); + polygon.path.clear(true); + this.drawPolygon(outerRadius - padding2, gridAngles, polygon); + const reversedAngles = gridAngles.slice().reverse(); + const innerPolygonRadius = type === "line" ? outerRadius - padding2 : innerRadius + padding2; + this.drawPolygon(innerPolygonRadius, reversedAngles, polygon); + this.setSectorNodeProps(polygon); + } + updateSectorNode(visible) { + const { axisInnerRadius, axisOuterRadius, scale: scale2, sectorNode: sector, shape, innerRadius, outerRadius } = this; + if (!visible || shape !== "circle" || !scale2) { + sector.visible = false; + return; + } + sector.visible = true; + sector.startAngle = 0; + sector.endAngle = 2 * Math.PI; + const padding2 = this.getPadding(); + const r0 = clamp(axisInnerRadius, innerRadius + padding2, axisOuterRadius); + const r1 = clamp(axisInnerRadius, outerRadius - padding2, axisOuterRadius); + sector.innerRadius = Math.min(r0, r1); + sector.outerRadius = Math.max(r0, r1); + this.setSectorNodeProps(sector); + } + updateLabelNode(visible) { + const { innerRadius, label, labelNode: node, scale: scale2, shape, type } = this; + if (!visible || label.enabled === false || !label.text || !scale2) { + node.visible = false; + return; + } + const angle2 = normalizeAngle360FromDegrees2((label.positionAngle ?? 0) - 90); + const isBottomSide = (isNumberEqual(angle2, 0) || angle2 > 0) && angle2 < Math.PI; + const rotation = isBottomSide ? angle2 - Math.PI / 2 : angle2 + Math.PI / 2; + let distance2; + const angles = this.gridAngles ?? []; + if (type === "line") { + distance2 = innerRadius + label.padding; + } else if (shape === "circle" || angles.length < 3) { + distance2 = innerRadius - label.padding; + } else { + distance2 = innerRadius * Math.cos(Math.PI / angles.length) - label.padding; + } + const labelX = distance2 * Math.cos(angle2); + const labelY = distance2 * Math.sin(angle2); + let textBaseline; + if (type === "line") { + textBaseline = isBottomSide ? "top" : "bottom"; + } else { + textBaseline = isBottomSide ? "bottom" : "top"; + } + this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation); + } + getPadding() { + const { scale: scale2 } = this; + if (!scale2) + return 0; + const bandwidth = Math.abs(scale2.bandwidth ?? 0); + const step = Math.abs(scale2.step ?? 0); + return scale2 instanceof module_support_exports.BandScale ? (step - bandwidth) / 2 : 0; + } +}; +RadiusCrossLine.className = "RadiusCrossLine"; +var { + ChartAxisDirection: ChartAxisDirection5, + ZIndexMap: ZIndexMap2, + Property: Property8, + normalizeAngle360: normalizeAngle3603, + toRadians: toRadians22, + Caption: Caption2, + Group: Group42, + TransformableGroup: TransformableGroup2, + Path: Path4, + Line: Line22, + Selection: Selection22, + generateTicks: generateTicks2, + AxisGroupZIndexMap: AxisGroupZIndexMap2 +} = module_support_exports; +var RadiusAxisLabel = class extends module_support_exports.AxisLabel { + constructor() { + super(...arguments); + this.autoRotateAngle = 335; + } +}; +__decorateClass2([ + Property8 +], RadiusAxisLabel.prototype, "autoRotate", 2); +__decorateClass2([ + Property8 +], RadiusAxisLabel.prototype, "autoRotateAngle", 2); +var RadiusAxis = class extends module_support_exports.PolarAxis { + constructor(moduleCtx, scale2) { + super(moduleCtx, scale2); + this.positionAngle = 0; + this.gridLineGroupSelection = Selection22.select( + this.gridLineGroup, + Line22, + false + ); + this.generatedTicks = void 0; + this.headingLabelGroup = this.axisGroup.appendChild( + new TransformableGroup2({ name: `${this.id}-Axis-heading` }) + ); + this.lineNodeGroup = this.axisGroup.appendChild( + new TransformableGroup2({ name: `${this.id}-Axis-line` }) + ); + this.lineNode = this.lineNodeGroup.appendChild( + new Line22({ + name: `${this.id}-Axis-line`, + zIndex: AxisGroupZIndexMap2.AxisLine + }) + ); + this.gridPathGroup = this.gridGroup.appendChild( + new Group42({ + name: `${this.id}-gridPaths`, + zIndex: ZIndexMap2.AXIS_GRID + }) + ); + this.gridPathSelection = Selection22.select(this.gridPathGroup, Path4); + this.headingLabelGroup.appendChild(this.title.caption.node); + this.cleanup.register(this.title.caption.registerInteraction(this.moduleCtx, "afterend")); + } + get direction() { + return ChartAxisDirection5.Radius; + } + getAxisTransform() { + const maxRadius = this.scale.range[0]; + const { translation, positionAngle, innerRadiusRatio } = this; + const innerRadius = maxRadius * innerRadiusRatio; + const rotation = toRadians22(positionAngle); + return { + translationX: translation.x, + translationY: translation.y - maxRadius - innerRadius, + rotation, + rotationCenterX: 0, + rotationCenterY: maxRadius + innerRadius + }; + } + update() { + super.update(); + this.updateTitle(); + this.updateGridLines(); + const { enabled, stroke: stroke22, width: width2 } = this.line; + this.lineNode.setProperties({ + stroke: stroke22, + strokeWidth: enabled ? width2 : 0, + x1: 0, + y1: this.range[0], + x2: 0, + y2: this.range[1] + }); + } + updatePosition() { + super.updatePosition(); + const axisTransform = this.getAxisTransform(); + this.tickLineGroup.setProperties(axisTransform); + this.tickLabelGroup.setProperties(axisTransform); + this.lineNodeGroup.setProperties(axisTransform); + this.headingLabelGroup.setProperties(axisTransform); + } + calculateRotations() { + const rotation = 0; + const parallelFlipRotation = 0; + const regularFlipRotation = -Math.PI / 2; + return { rotation, parallelFlipRotation, regularFlipRotation }; + } + calculateTickLayout(domain, niceMode, _visibleRange) { + const visibleRange = [0, 1]; + const sideFlag = this.label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + this.label.spacing + this.seriesAreaPadding); + const { range: range22, reverse, defaultTickMinSpacing } = this; + const tickGenerationResult = generateTicks2({ + scale: this.scale, + label: this.label, + interval: this.interval, + tickFormatter: (...args) => this.tickFormatter(...args), + domain, + range: range22, + reverse, + niceMode, + visibleRange, + defaultTickMinSpacing, + labelOffset: labelX, + sideFlag, + axisRotation: 0, + sizeLimit: void 0, + primaryTickCount: void 0 + }); + const { tickData } = tickGenerationResult; + const { ticks, rawTicks, rawTickCount, tickDomain, fractionDigits, niceDomain = domain } = tickData; + const labels = ticks.map((d) => this.getTickLabelProps(d, tickGenerationResult)); + this.generatedTicks = { ticks, labels }; + return { ticks: rawTicks, tickDomain, niceDomain, rawTickCount, fractionDigits, timeInterval: void 0 }; + } + updateSelections() { + const { generatedTicks } = this; + if (!generatedTicks) + return; + const { ticks, labels } = generatedTicks; + this.gridLineGroupSelection.update(this.gridLength ? ticks : []); + this.tickLabelGroupSelection.update(labels); + this.gridPathSelection.update(this.gridLine.enabled ? this.prepareGridPathTickData(ticks) : []); + this.gridLineGroupSelection.cleanup(); + this.tickLabelGroupSelection.cleanup(); + this.gridPathSelection.cleanup(); + } + // TODO - abstract out + updateLabels() { + if (!this.label.enabled) + return; + const axisLabelPositionFn = module_support_exports.resetAxisLabelSelectionFn(); + this.tickLabelGroupSelection.each((node, datum) => { + node.fill = datum.color; + node.text = datum.text; + node.textBaseline = datum.textBaseline; + node.textAlign = datum.textAlign ?? "center"; + node.setFont(datum); + node.setBoxing(datum); + node.setProperties(axisLabelPositionFn(node, datum)); + }); + } + updateGridLines() { + const { + gridLine: { style: style2, width: width2 }, + shape, + generatedTicks + } = this; + if (!style2 || !generatedTicks) { + return; + } + const styleCount = style2.length; + const setStyle = (node, index) => { + const { stroke: stroke22, lineDash } = style2[index % styleCount]; + node.stroke = stroke22; + node.strokeWidth = width2; + node.lineDash = lineDash; + node.fill = void 0; + }; + const [startAngle, endAngle] = this.gridRange ?? [0, 2 * Math.PI]; + const isFullCircle = isNumberEqual(endAngle - startAngle, 2 * Math.PI); + const drawCircleShape = (node, value) => { + const { path } = node; + path.clear(true); + const radius = this.getTickRadius(value); + if (isFullCircle) { + path.moveTo(radius, 0); + path.arc(0, 0, radius, 0, 2 * Math.PI); + } else { + path.moveTo(radius * Math.cos(startAngle), radius * Math.sin(startAngle)); + path.arc(0, 0, radius, normalizeAngle3603(startAngle), normalizeAngle3603(endAngle)); + } + if (isFullCircle) { + path.closePath(); + } + }; + const drawPolygonShape = (node, value) => { + const { path } = node; + const angles = this.gridAngles; + path.clear(true); + if (!angles || angles.length < 3) { + return; + } + const radius = this.getTickRadius(value); + for (const [idx, angle2] of angles.entries()) { + const x = radius * Math.cos(angle2); + const y = radius * Math.sin(angle2); + if (idx === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + for (const [innerIdx, innerAngle] of angles.entries()) { + const x2 = radius * Math.cos(innerAngle); + const y2 = radius * Math.sin(innerAngle); + if (innerIdx === 0) { + path.moveTo(x2, y2); + } else { + path.lineTo(x2, y2); + } + } + path.closePath(); + } + path.closePath(); + }; + const drawFn = shape === "circle" ? drawCircleShape : drawPolygonShape; + this.gridPathSelection.each((node, value, index) => { + setStyle(node, index); + drawFn(node, value); + }); + } + updateTitle() { + const identityFormatter = (params) => params.defaultValue; + const { title, range: requestedRange } = this; + const { formatter: formatter2 = identityFormatter } = this.title; + title.caption.enabled = title.enabled; + title.caption.fontFamily = title.fontFamily; + title.caption.fontSize = title.fontSize; + title.caption.fontStyle = title.fontStyle; + title.caption.fontWeight = title.fontWeight; + title.caption.color = title.color; + title.caption.wrapping = title.wrapping; + let titleVisible = false; + const titleNode = title.caption.node; + if (title.enabled) { + titleVisible = true; + titleNode.rotation = Math.PI / 2; + titleNode.x = Math.floor((requestedRange[0] + requestedRange[1]) / 2); + titleNode.y = -Caption2.SMALL_PADDING; + titleNode.textAlign = "center"; + titleNode.textBaseline = "bottom"; + titleNode.text = this.cachedCallWithContext(formatter2, this.getTitleFormatterParams(this.scale.domain)); + } + titleNode.visible = titleVisible; + } + updateCrossLines() { + for (const crossLine of this.crossLines) { + if (crossLine instanceof RadiusCrossLine) { + const { shape, gridAngles, range: range22, innerRadiusRatio } = this; + const radius = range22[0]; + crossLine.shape = shape; + crossLine.gridAngles = gridAngles; + crossLine.axisOuterRadius = radius; + crossLine.axisInnerRadius = radius * innerRadiusRatio; + } + } + super.updateCrossLines(); + } + createLabel() { + return new RadiusAxisLabel(); + } + // TODO - abstract out (shared with cartesian axis) + getTickLabelProps(datum, tickGenerationResult) { + const { label } = this; + const { rotation, textBaseline, textAlign } = tickGenerationResult; + const range22 = this.scale.range; + const text2 = datum.tickLabel ?? ""; + const sideFlag = label.getSideFlag(); + const labelX = sideFlag * (this.getTickSize() + label.spacing + this.seriesAreaPadding); + const visible = text2 !== "" && text2 != null; + const combinedRotation = rotation; + return { + ...this.getLabelStyles({ value: datum.tick, formattedValue: datum.tickLabel }), + tickId: datum.tickId, + rotation: combinedRotation, + text: text2, + textAlign, + textBaseline, + visible, + x: labelX, + y: datum.translation, + rotationCenterX: labelX, + rotationCenterY: datum.translation, + range: range22 + }; + } +}; +RadiusAxis.CrossLineConstructor = RadiusCrossLine; +__decorateClass2([ + Property8 +], RadiusAxis.prototype, "positionAngle", 2); +var { ProxyPropertyOnWrite: ProxyPropertyOnWrite2, Property: Property9, CategoryScale: CategoryScale22 } = module_support_exports; +var RadiusCategoryAxis = class extends RadiusAxis { + constructor(moduleCtx) { + super(moduleCtx, new CategoryScale22()); + this.shape = "circle"; + this.groupPaddingInner = 0; + this.paddingInner = 0; + this.paddingOuter = 0; + } + hasDefinedDomain() { + return false; + } + normaliseDataDomain(domain) { + return { domain, clipped: false }; + } + prepareGridPathTickData(data) { + return data.slice().reverse(); + } + getTickRadius(tickDatum) { + const { scale: scale2, innerRadiusRatio } = this; + const maxRadius = scale2.range[0]; + const minRadius = maxRadius * innerRadiusRatio; + if (CategoryScale22.is(scale2)) { + const ticks = scale2.domain; + const index = ticks.length - 1 - ticks.indexOf(tickDatum.tick); + return index === 0 ? minRadius : scale2.inset + scale2.step * (index - 0.5) + scale2.bandwidth / 2; + } else { + const tickRange = (maxRadius - minRadius) / scale2.domain.length; + return maxRadius - tickDatum.translation + minRadius - tickRange / 2; + } + } + tickFormatParams() { + return { type: "category" }; + } + datumFormatParams(value, params) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { type: "category", value, datum, seriesId, legendItemName, key, source, property, domain, boundSeries }; + } +}; +RadiusCategoryAxis.className = "RadiusCategoryAxis"; +RadiusCategoryAxis.type = "radius-category"; +__decorateClass2([ + Property9 +], RadiusCategoryAxis.prototype, "groupPaddingInner", 2); +__decorateClass2([ + ProxyPropertyOnWrite2("scale", "paddingInner"), + Property9 +], RadiusCategoryAxis.prototype, "paddingInner", 2); +__decorateClass2([ + ProxyPropertyOnWrite2("scale", "paddingOuter"), + Property9 +], RadiusCategoryAxis.prototype, "paddingOuter", 2); +var RadiusCategoryAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radius-category", + moduleFactory: (ctx) => new RadiusCategoryAxis(ctx) +}; +var { Property: Property10, normalisedExtentWithMetadata: normalisedExtentWithMetadata22, LinearScale: LinearScale22 } = module_support_exports; +var RadiusNumberAxis = class extends RadiusAxis { + constructor(moduleCtx) { + super(moduleCtx, new LinearScale22()); + this.shape = "polygon"; + } + hasDefinedDomain() { + const { min, max } = this; + return min != null && max != null && min < max; + } + prepareGridPathTickData(data) { + const { scale: scale2 } = this; + const domainTop = scale2.domain[1]; + return data.filter(({ tick }) => tick !== domainTop).sort((a, b) => b.tick - a.tick); + } + getTickRadius(tickDatum) { + const { scale: scale2 } = this; + const maxRadius = scale2.range[0]; + const minRadius = maxRadius * this.innerRadiusRatio; + return maxRadius - tickDatum.translation + minRadius; + } + normaliseDataDomain(d) { + const { min, max } = this; + const { extent: extent3, clipped } = normalisedExtentWithMetadata22(d, min, max); + return { domain: extent3, clipped }; + } + tickFormatParams(_domain, _ticks, fractionDigits) { + return { type: "number", fractionDigits }; + } + datumFormatParams(value, params, fractionDigits) { + const { datum, seriesId, legendItemName, key, source, property, domain, boundSeries } = params; + return { + type: "number", + value, + datum, + seriesId, + legendItemName, + key, + source, + property, + domain, + boundSeries, + fractionDigits + }; + } +}; +RadiusNumberAxis.className = "RadiusNumberAxis"; +RadiusNumberAxis.type = "radius-number"; +__decorateClass2([ + Property10 +], RadiusNumberAxis.prototype, "min", 2); +__decorateClass2([ + Property10 +], RadiusNumberAxis.prototype, "max", 2); +var RadiusNumberAxisModule = { + type: "axis", + optionsKey: "axes[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radius-number", + moduleFactory: (ctx) => new RadiusNumberAxis(ctx) +}; +var { ObserveChanges: ObserveChanges2, Property: Property11 } = module_support_exports; +var Animation2 = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + ctx.animationManager.skip(false); + this.cleanup.register(() => { + ctx.animationManager.skip(true); + }); + } +}; +__decorateClass2([ + ObserveChanges2((target, newValue) => { + target.ctx.animationManager.skip(!newValue); + }), + Property11 +], Animation2.prototype, "enabled", 2); +__decorateClass2([ + ObserveChanges2((target, newValue) => { + target.ctx.animationManager.defaultDuration = newValue; + }), + Property11 +], Animation2.prototype, "duration", 2); +__decorateClass2([ + ObserveChanges2((target, newValue) => { + target.ctx.animationManager.maxAnimatableItems = newValue ?? Infinity; + }), + Property11 +], Animation2.prototype, "maxAnimatableItems", 2); +var AnimationModule = { + type: "root", + optionsKey: "animation", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Animation2(ctx), + themeTemplate: { + animation: { + enabled: true, + maxAnimatableItems: 1e3 + } + } +}; +var textInputTemplate_default = '
'; +var { focusCursorAtEnd: focusCursorAtEnd2 } = module_support_exports; +var moduleId = "text-input"; +var canvasOverlay2 = "canvas-overlay"; +var TextInput = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.layout = { + getTextInputCoords: () => ({ x: 0, y: 0 }), + getTextPosition: () => "center", + alignment: "center", + textAlign: "center" + }; + this.visible = false; + this.element = ctx.domManager.addChild(canvasOverlay2, moduleId); + this.element.classList.add("ag-charts-text-input"); + this.cleanup.register(() => ctx.domManager.removeChild(canvasOverlay2, moduleId)); + } + setKeyDownHandler(handler) { + this.cleanup.register(attachListener(this.element, "keydown", handler)); + } + show(opts) { + this.element.innerHTML = textInputTemplate_default; + const textArea = this.element.firstElementChild; + setAttributes(textArea, { + role: "textbox", + // AG-15233 + "data-preventdefault": false + // AG-13715 + }); + if (!textArea.isContentEditable) { + textArea.contentEditable = "true"; + } + textArea.setAttribute( + "placeholder", + this.ctx.localeManager.t(opts.placeholderText ?? "inputTextareaPlaceholder") + ); + if (opts.styles?.placeholderColor) { + textArea.style.setProperty("--placeholder-text-color", opts.styles?.placeholderColor); + } + textArea.innerText = opts.text ?? ""; + textArea.style.color = opts.styles?.color ?? "inherit"; + textArea.style.fontFamily = opts.styles?.fontFamily ?? "inherit"; + textArea.style.fontSize = opts.styles?.fontSize ? `${opts.styles.fontSize}px` : "inherit"; + textArea.style.fontStyle = opts.styles?.fontStyle ?? "inherit"; + textArea.style.fontWeight = typeof opts.styles?.fontWeight === "number" ? `${opts.styles.fontWeight}` : opts.styles?.fontWeight ?? "inherit"; + focusCursorAtEnd2(textArea); + textArea.addEventListener("input", () => { + this.updatePosition(); + opts.onChange?.(this.getValue(), this.getBBox()); + }); + textArea.addEventListener("click", (event) => { + event.stopPropagation(); + }); + if (opts.layout) { + this.layout = opts.layout; + this.updatePosition(); + } + opts.onChange?.(this.getValue(), this.getBBox()); + this.visible = true; + } + hide() { + this.element.innerHTML = ""; + this.layout = { + getTextInputCoords: () => ({ x: 0, y: 0 }), + getTextPosition: () => "center", + alignment: "center", + textAlign: "center" + }; + this.visible = false; + } + isVisible() { + return this.visible; + } + updateColor(color6) { + if (!this.element.firstElementChild) + return; + this.element.firstElementChild.style.color = color6; + } + updateFontSize(fontSize) { + if (!this.element.firstElementChild) + return; + this.element.firstElementChild.style.fontSize = `${fontSize}px`; + this.updatePosition(); + return this.getBBox(); + } + getValue() { + if (!this.element.firstElementChild) + return; + return this.element.firstElementChild.innerText.trim(); + } + updatePosition() { + const { element: element2 } = this; + const textArea = element2.firstElementChild; + if (!textArea) + return; + const sceneRect = this.ctx.domManager.getBoundingClientRect(); + const { width: width2, getTextInputCoords, getTextPosition, alignment, textAlign } = this.layout; + element2.style.setProperty("width", width2 ? `${width2}px` : "unset"); + const textRect = textArea.getBoundingClientRect(); + const point = getTextInputCoords(textRect.height); + let horizontalPosition = point.x; + if (alignment === "center") { + horizontalPosition -= (width2 ?? textRect.width) / 2; + } else if (alignment === "right") { + horizontalPosition -= width2 ?? textRect.width; + } + const position = getTextPosition(); + let verticalPosition = point.y; + if (position === "center") { + verticalPosition -= textRect.height / 2; + } else if (position === "bottom") { + verticalPosition -= textRect.height; + } + element2.style.setProperty("top", `${verticalPosition}px`); + element2.style.setProperty("left", `${horizontalPosition}px`); + element2.style.setProperty("max-width", `${sceneRect.width - horizontalPosition}px`); + element2.style.setProperty("text-align", alignment); + textArea.style.setProperty("text-align", textAlign); + } + getBBox() { + const { left, top, width: width2, height: height2 } = this.element.getBoundingClientRect(); + return new module_support_exports.BBox(left, top, width2, height2); + } +}; +var { BaseProperties: BaseProperties22, Property: Property12 } = module_support_exports; +var AxesButtons = class extends BaseProperties22 { + constructor() { + super(...arguments); + this.enabled = false; + this.axes = "y"; + } +}; +__decorateClass2([ + Property12 +], AxesButtons.prototype, "enabled", 2); +__decorateClass2([ + Property12 +], AxesButtons.prototype, "axes", 2); +var AnnotationType = /* @__PURE__ */ ((AnnotationType3) => { + AnnotationType3["Line"] = "line"; + AnnotationType3["HorizontalLine"] = "horizontal-line"; + AnnotationType3["VerticalLine"] = "vertical-line"; + AnnotationType3["DisjointChannel"] = "disjoint-channel"; + AnnotationType3["ParallelChannel"] = "parallel-channel"; + AnnotationType3["FibonacciRetracement"] = "fibonacci-retracement"; + AnnotationType3["FibonacciRetracementTrendBased"] = "fibonacci-retracement-trend-based"; + AnnotationType3["Callout"] = "callout"; + AnnotationType3["Comment"] = "comment"; + AnnotationType3["Note"] = "note"; + AnnotationType3["Text"] = "text"; + AnnotationType3["Arrow"] = "arrow"; + AnnotationType3["ArrowUp"] = "arrow-up"; + AnnotationType3["ArrowDown"] = "arrow-down"; + AnnotationType3["DateRange"] = "date-range"; + AnnotationType3["PriceRange"] = "price-range"; + AnnotationType3["DatePriceRange"] = "date-price-range"; + AnnotationType3["QuickDatePriceRange"] = "quick-date-price-range"; + return AnnotationType3; +})(AnnotationType || {}); +var ANNOTATION_TYPES = Object.values(AnnotationType); +function stringToAnnotationType(value) { + for (const t of ANNOTATION_TYPES) { + if (t === value) + return t; + } +} +var { BaseProperties: BaseProperties3, FONT_SIZE: FONT_SIZE22, Property: Property13 } = module_support_exports; +var PointProperties = class extends BaseProperties3 { +}; +__decorateClass2([ + Property13 +], PointProperties.prototype, "x", 2); +__decorateClass2([ + Property13 +], PointProperties.prototype, "y", 2); +var ChannelAnnotationMiddleProperties = class extends Stroke(LineStyle(Visible(BaseProperties3))) { +}; +var AxisLabelProperties = class extends Stroke(LineStyle(Fill(Label3(Font(BaseProperties3))))) { + constructor() { + super(...arguments); + this.cornerRadius = 2; + } +}; +__decorateClass2([ + Property13 +], AxisLabelProperties.prototype, "enabled", 2); +__decorateClass2([ + Property13 +], AxisLabelProperties.prototype, "cornerRadius", 2); +var BackgroundProperties = class extends Fill(BaseProperties3) { +}; +var HandleProperties = class extends Stroke(LineStyle(Fill(BaseProperties3))) { +}; +var LineTextProperties = class extends Font(BaseProperties3) { + constructor() { + super(...arguments); + this.label = ""; + this.position = "top"; + this.alignment = "left"; + } +}; +__decorateClass2([ + Property13 +], LineTextProperties.prototype, "label", 2); +__decorateClass2([ + Property13 +], LineTextProperties.prototype, "position", 2); +__decorateClass2([ + Property13 +], LineTextProperties.prototype, "alignment", 2); +var LabelTextProperties = class extends Font(BaseProperties3) { +}; +var ChannelTextProperties = class extends Font(BaseProperties3) { + constructor() { + super(...arguments); + this.label = ""; + } +}; +__decorateClass2([ + Property13 +], ChannelTextProperties.prototype, "label", 2); +__decorateClass2([ + Property13 +], ChannelTextProperties.prototype, "position", 2); +__decorateClass2([ + Property13 +], ChannelTextProperties.prototype, "alignment", 2); +function Annotation(Parent) { + class AnnotationInternal extends Writeable(Visible(Parent)) { + constructor() { + super(...arguments); + this.id = generateUUID(); + } + } + return AnnotationInternal; +} +function Line3(Parent) { + class LineInternal extends Parent { + constructor() { + super(...arguments); + this.start = new PointProperties(); + this.end = new PointProperties(); + } + } + __decorateClass2([ + Property13 + ], LineInternal.prototype, "start", 2); + __decorateClass2([ + Property13 + ], LineInternal.prototype, "end", 2); + return LineInternal; +} +function Point(Parent) { + class PointInternal extends Parent { + } + __decorateClass2([ + Property13 + ], PointInternal.prototype, "x", 2); + __decorateClass2([ + Property13 + ], PointInternal.prototype, "y", 2); + return PointInternal; +} +function Value(Parent) { + class ValueInternal extends Parent { + } + __decorateClass2([ + Property13 + ], ValueInternal.prototype, "value", 2); + return ValueInternal; +} +function Background2(Parent) { + class BackgroundInternal extends Parent { + constructor() { + super(...arguments); + this.background = new BackgroundProperties(); + } + } + __decorateClass2([ + Property13 + ], BackgroundInternal.prototype, "background", 2); + return BackgroundInternal; +} +function Handle(Parent) { + class HandleInternal extends Parent { + constructor() { + super(...arguments); + this.handle = new HandleProperties(); + } + } + __decorateClass2([ + Property13 + ], HandleInternal.prototype, "handle", 2); + return HandleInternal; +} +function AxisLabel2(Parent) { + class AxisLabelInternal extends Parent { + constructor() { + super(...arguments); + this.axisLabel = new AxisLabelProperties(); + } + } + __decorateClass2([ + Property13 + ], AxisLabelInternal.prototype, "axisLabel", 2); + return AxisLabelInternal; +} +function Label3(Parent) { + class LabelInternal extends Parent { + constructor() { + super(...arguments); + this.padding = void 0; + this.textAlign = "center"; + this.formatter = void 0; + } + // TODO: making this generic causes issues with mixins sequence + } + __decorateClass2([ + Property13 + ], LabelInternal.prototype, "padding", 2); + __decorateClass2([ + Property13 + ], LabelInternal.prototype, "textAlign", 2); + __decorateClass2([ + Property13 + ], LabelInternal.prototype, "formatter", 2); + return LabelInternal; +} +function Cappable(Parent) { + class CappableInternal extends Parent { + } + return CappableInternal; +} +function Extendable(Parent) { + class ExtendableInternal extends Parent { + } + __decorateClass2([ + Property13 + ], ExtendableInternal.prototype, "extendStart", 2); + __decorateClass2([ + Property13 + ], ExtendableInternal.prototype, "extendEnd", 2); + return ExtendableInternal; +} +function Writeable(Parent) { + class WriteableInternal extends Parent { + isWriteable() { + return !this.locked && !this.readOnly; + } + isHoverable() { + return !this.readOnly; + } + } + __decorateClass2([ + Property13 + ], WriteableInternal.prototype, "locked", 2); + __decorateClass2([ + Property13 + ], WriteableInternal.prototype, "readOnly", 2); + return WriteableInternal; +} +function Localisable(Parent) { + class LocalisableInternal extends Parent { + setLocaleManager(localeManager) { + this.localeManager ?? (this.localeManager = localeManager); + } + } + return LocalisableInternal; +} +function Visible(Parent) { + class VisibleInternal extends Parent { + } + __decorateClass2([ + Property13 + ], VisibleInternal.prototype, "visible", 2); + return VisibleInternal; +} +function Fill(Parent) { + class FillInternal extends Parent { + } + __decorateClass2([ + Property13 + ], FillInternal.prototype, "fill", 2); + __decorateClass2([ + Property13 + ], FillInternal.prototype, "fillOpacity", 2); + return FillInternal; +} +function Stroke(Parent) { + class StrokeInternal extends Parent { + } + __decorateClass2([ + Property13 + ], StrokeInternal.prototype, "stroke", 2); + __decorateClass2([ + Property13 + ], StrokeInternal.prototype, "strokeOpacity", 2); + __decorateClass2([ + Property13 + ], StrokeInternal.prototype, "strokeWidth", 2); + return StrokeInternal; +} +function LineStyle(Parent) { + class LineDashInternal extends Parent { + constructor() { + super(...arguments); + this.lineCap = void 0; + this.computedLineDash = void 0; + } + } + __decorateClass2([ + Property13 + ], LineDashInternal.prototype, "lineDash", 2); + __decorateClass2([ + Property13 + ], LineDashInternal.prototype, "lineDashOffset", 2); + __decorateClass2([ + Property13 + ], LineDashInternal.prototype, "lineStyle", 2); + return LineDashInternal; +} +function Font(Parent) { + class FontInternal extends Parent { + constructor() { + super(...arguments); + this.fontSize = FONT_SIZE22.SMALL; + this.fontFamily = "Verdana, sans-serif"; + } + } + __decorateClass2([ + Property13 + ], FontInternal.prototype, "fontStyle", 2); + __decorateClass2([ + Property13 + ], FontInternal.prototype, "fontWeight", 2); + __decorateClass2([ + Property13 + ], FontInternal.prototype, "fontSize", 2); + __decorateClass2([ + Property13 + ], FontInternal.prototype, "fontFamily", 2); + __decorateClass2([ + Property13 + ], FontInternal.prototype, "color", 2); + return FontInternal; +} +function getGrouping(d) { + if (isNumber(d) || isString(d) || isDate(d)) { + return { value: d, groupPercentage: 0 }; + } + return d ?? { value: void 0, groupPercentage: 0 }; +} +function getGroupingValue(d) { + return getGrouping(d)?.value; +} +function convertLine(datum, context) { + if (datum.start == null || datum.end == null) + return; + const start2 = convertPoint(datum.start, context); + const end3 = convertPoint(datum.end, context); + if (start2 == null || end3 == null) + return; + return { x1: start2.x, y1: start2.y, x2: end3.x, y2: end3.y }; +} +function convertPoint(point, context) { + const x = convert(point.x, context.xAxis); + const y = convert(point.y, context.yAxis); + return { x, y }; +} +function convert(p, context) { + if (p == null) + return 0; + const { value, groupPercentage } = getGrouping(p); + const { scale: scale2, snapToGroup } = context; + const width2 = scale2.bandwidth === 0 ? scale2.step ?? 0 : scale2.bandwidth ?? 0; + const offset = snapToGroup ? width2 / 2 : width2 * groupPercentage; + return scale2.convert(value) + offset; +} +function invertCoords(coords, context) { + const x = invert(coords.x, context.xAxis); + const y = invert(coords.y, context.yAxis); + return { x, y }; +} +function invert(n, context) { + const { scale: scale2 } = context; + if (context.continuous && scale2.step == null) { + return context.scaleInvert(n); + } + const value = context.scaleInvertNearest(n); + const width2 = scale2.bandwidth === 0 ? scale2.step : scale2.bandwidth ?? 0; + const bandStart = scale2.convert(value); + const bandEnd = bandStart + width2; + const groupPercentage = bandStart === bandEnd ? 0 : (n - bandStart) / (bandEnd - bandStart); + return { value, groupPercentage }; +} +var { BaseProperties: BaseProperties4 } = module_support_exports; +var StartEndProperties = class extends Annotation(Line3(Handle(BaseProperties4))) { + constructor() { + super(...arguments); + this.snapToAngle = 45; + } + getDefaultColor(_colorPickerType) { + return void 0; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } +}; +var { Property: Property14 } = module_support_exports; +var TextualStartEndProperties = class extends Localisable(Label3(Font(StartEndProperties))) { + constructor() { + super(...arguments); + this.text = ""; + this.position = "top"; + this.alignment = "left"; + this.placement = "inside"; + this.placeholderText = "inputTextareaPlaceholder"; + } + getDefaultColor(_colorPickerType) { + return this.color; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } + getPlaceholderColor() { + return void 0; + } + getPadding() { + const { padding: padding2 = 0 } = this; + return { + top: padding2, + right: padding2, + bottom: padding2, + left: padding2 + }; + } + getText() { + const isPlaceholder = this.text.length == 0; + let text2 = this.text; + if (isPlaceholder) { + text2 = this.placeholderText ?? ""; + if (this.localeManager) + text2 = this.localeManager.t(text2); + } + return { + text: text2, + isPlaceholder + }; + } + getTextInputCoords(context, _height) { + return convertPoint(this.end, context); + } + getTextPosition() { + return this.position; + } +}; +__decorateClass2([ + Property14 +], TextualStartEndProperties.prototype, "text", 2); +var { Property: Property15, Color: Color2 } = module_support_exports; +var DEFAULT_CALLOUT_PADDING = { + top: 6, + right: 12, + bottom: 9, + left: 12 +}; +var CalloutProperties = class extends Fill(Stroke(TextualStartEndProperties)) { + constructor() { + super(...arguments); + this.type = "callout"; + this.position = "bottom"; + this.alignment = "left"; + } + static is(value) { + return isObject(value) && value.type === "callout"; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fill; + case `line-color`: + return this.stroke; + case `text-color`: + default: + return this.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fillOpacity; + case `line-color`: + return this.strokeOpacity; + case `text-color`: + default: + return void 0; + } + } + getPlaceholderColor() { + const { r, g, b } = Color2.fromString(this.color ?? "#888888"); + return new Color2(r, g, b, 0.66).toString(); + } + getPadding() { + const { padding: padding2 } = this; + if (padding2 == null) { + return { ...DEFAULT_CALLOUT_PADDING }; + } + return { + top: padding2, + right: padding2, + bottom: padding2, + left: padding2 + }; + } + getTextInputCoords(context, height2) { + const coords = super.getTextInputCoords(context, height2); + const padding2 = this.getPadding(); + const paddingLeft = padding2.left ?? 0; + const paddingBottom = padding2.bottom ?? 0; + return { + x: coords.x + paddingLeft, + y: coords.y - paddingBottom + }; + } +}; +__decorateClass2([ + Property15 +], CalloutProperties.prototype, "type", 2); +var { BaseProperties: BaseProperties5, Property: Property16 } = module_support_exports; +var TextualPointProperties = class extends Annotation(Point(Handle(Label3(Font(BaseProperties5))))) { + constructor() { + super(...arguments); + this.text = ""; + this.position = "top"; + this.alignment = "left"; + this.placement = "inside"; + this.placeholderText = "inputTextareaPlaceholder"; + } + getDefaultColor(_colorPickerType) { + return this.color; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } + getPlaceholderColor() { + return void 0; + } + getPadding() { + const { padding: padding2 = 0 } = this; + return { + top: padding2, + right: padding2, + bottom: padding2, + left: padding2 + }; + } + getText() { + const isPlaceholder = this.text.length == 0; + const text2 = isPlaceholder ? this.placeholderText ?? "" : this.text; + return { + text: text2, + isPlaceholder + }; + } + getTextInputCoords(context, _height) { + return convertPoint(this, context); + } + getTextPosition() { + return this.position; + } +}; +__decorateClass2([ + Property16 +], TextualPointProperties.prototype, "text", 2); +var { Property: Property17, Color: Color22 } = module_support_exports; +var DEFAULT_COMMENT_PADDING = { + top: 8, + right: 14, + bottom: 8, + left: 14 +}; +var CommentProperties = class extends Fill(Stroke(TextualPointProperties)) { + constructor() { + super(...arguments); + this.type = "comment"; + this.position = "bottom"; + this.alignment = "left"; + } + static is(value) { + return isObject(value) && value.type === "comment"; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fill; + case `line-color`: + return this.stroke; + case `text-color`: + default: + return this.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.fillOpacity; + case `line-color`: + return this.strokeOpacity; + case `text-color`: + default: + return void 0; + } + } + getPlaceholderColor() { + const { r, g, b } = Color22.fromString(this.color ?? "#888888"); + return new Color22(r, g, b, 0.66).toString(); + } + getPadding() { + const { padding: padding2, fontSize } = this; + if (padding2 == null) { + return { + top: Math.max(fontSize * 0.4, DEFAULT_COMMENT_PADDING.top), + bottom: Math.max(fontSize * 0.4, DEFAULT_COMMENT_PADDING.bottom), + left: Math.max(fontSize * 0.8, DEFAULT_COMMENT_PADDING.left), + right: Math.max(fontSize * 0.8, DEFAULT_COMMENT_PADDING.right) + }; + } + return { + top: padding2, + right: padding2, + bottom: padding2, + left: padding2 + }; + } + getTextInputCoords(context, height2) { + const coords = super.getTextInputCoords(context, height2); + const padding2 = this.getPadding(); + return { + x: coords.x + padding2.left, + y: coords.y - padding2.bottom + }; + } +}; +__decorateClass2([ + Property17 +], CommentProperties.prototype, "type", 2); +var { Vec2: Vec22 } = module_support_exports; +function getLineStyle(lineDash, lineStyle) { + return lineDash ? "dashed" : lineStyle ?? "solid"; +} +function getComputedLineDash(strokeWidth, styleType) { + switch (styleType) { + case "solid": + return []; + case "dashed": + return [strokeWidth * 4, strokeWidth * 2]; + case "dotted": + return [0, strokeWidth * 2]; + } +} +function getLineDash(lineDash, computedLineDash, lineStyle, strokeWidth) { + const styleType = getLineStyle(lineDash, lineStyle); + return computedLineDash ?? lineDash ?? getComputedLineDash(strokeWidth ?? 1, styleType); +} +function getLineCap(lineCap, lineDash, lineStyle) { + const styleType = getLineStyle(lineDash, lineStyle); + return lineCap ?? styleType === "dotted" ? "round" : void 0; +} +function boundsIntersections(coords, bounds) { + const [p1, p2] = Vec22.from(coords); + const reflection = bounds.height; + const gradient2 = Vec22.gradient(p2, p1, reflection); + const intercept2 = Vec22.intercept(p2, gradient2, reflection); + const fallback = [ + { x: p1.x, y: reflection ?? 0 }, + { x: p1.x, y: reflection == null ? bounds.height : reflection - bounds.height } + ]; + if (gradient2 === Infinity) { + return fallback; + } + let points = [ + Vec22.intersectAtY(gradient2, intercept2, 0, reflection), + Vec22.intersectAtY(gradient2, intercept2, bounds.height, reflection), + Vec22.intersectAtX(gradient2, intercept2, 0, reflection), + Vec22.intersectAtX(gradient2, intercept2, bounds.width, reflection) + ]; + points = points.filter((p) => p.x >= bounds.x && p.x <= bounds.width && p.y >= bounds.y && p.y <= bounds.height).sort((a, b) => { + if (a.x === b.x) + return 0; + return a.x < b.x ? -1 : 1; + }); + if (points.length !== 2) { + return fallback; + } + return points; +} +var { BaseProperties: BaseProperties6, Property: Property18 } = module_support_exports; +var MeasurerStatisticsDivider = class extends Stroke(BaseProperties6) { +}; +var MeasurerStatistics = class extends Font(Fill(Stroke(BaseProperties6))) { + constructor() { + super(...arguments); + this.divider = new MeasurerStatisticsDivider(); + } +}; +__decorateClass2([ + Property18 +], MeasurerStatistics.prototype, "divider", 2); +var MeasurerDirectionProperties = class extends Fill(Stroke(Handle(BaseProperties6))) { + constructor() { + super(...arguments); + this.statistics = new MeasurerStatistics(); + } +}; +__decorateClass2([ + Property18 +], MeasurerDirectionProperties.prototype, "statistics", 2); +var MeasurerTypeProperties = class extends Localisable(Background2(Stroke(LineStyle(StartEndProperties)))) { + constructor() { + super(...arguments); + this.direction = "both"; + this.hasDateRange = false; + this.hasPriceRange = false; + this.statistics = new MeasurerStatistics(); + this.getVolume = () => void 0; + this.text = new LineTextProperties(); + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fill; + case `line-color`: + return this.stroke; + case `text-color`: + return this.text.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fillOpacity; + case `line-color`: + return this.strokeOpacity; + } + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass2([ + Property18 +], MeasurerTypeProperties.prototype, "statistics", 2); +__decorateClass2([ + Property18 +], MeasurerTypeProperties.prototype, "text", 2); +function DateRange(Parent) { + class DateRangeInternal extends Parent { + constructor() { + super(...arguments); + this.hasDateRange = true; + } + } + return DateRangeInternal; +} +function PriceRange(Parent) { + class PriceRangeInternal extends Parent { + constructor() { + super(...arguments); + this.hasPriceRange = true; + } + } + return PriceRangeInternal; +} +var DateRangeProperties = class extends DateRange(MeasurerTypeProperties) { + constructor() { + super(...arguments); + this.type = "date-range"; + this.direction = "horizontal"; + } + static is(value) { + return isObject(value) && value.type === "date-range"; + } +}; +__decorateClass2([ + Property18 +], DateRangeProperties.prototype, "type", 2); +__decorateClass2([ + Property18 +], DateRangeProperties.prototype, "extendAbove", 2); +__decorateClass2([ + Property18 +], DateRangeProperties.prototype, "extendBelow", 2); +var PriceRangeProperties = class extends PriceRange(MeasurerTypeProperties) { + constructor() { + super(...arguments); + this.type = "price-range"; + this.direction = "vertical"; + } + static is(value) { + return isObject(value) && value.type === "price-range"; + } +}; +__decorateClass2([ + Property18 +], PriceRangeProperties.prototype, "type", 2); +__decorateClass2([ + Property18 +], PriceRangeProperties.prototype, "extendLeft", 2); +__decorateClass2([ + Property18 +], PriceRangeProperties.prototype, "extendRight", 2); +var DatePriceRangeProperties = class extends DateRange(PriceRange(MeasurerTypeProperties)) { + constructor() { + super(...arguments); + this.type = "date-price-range"; + this.direction = "both"; + } + static is(value) { + return isObject(value) && value.type === "date-price-range"; + } +}; +__decorateClass2([ + Property18 +], DatePriceRangeProperties.prototype, "type", 2); +var QuickDatePriceRangeProperties = class extends DateRange(PriceRange(MeasurerTypeProperties)) { + constructor() { + super(...arguments); + this.type = "quick-date-price-range"; + this.up = new MeasurerDirectionProperties(); + this.down = new MeasurerDirectionProperties(); + this.direction = "both"; + } + static is(value) { + return isObject(value) && value.type === "quick-date-price-range"; + } +}; +__decorateClass2([ + Property18 +], QuickDatePriceRangeProperties.prototype, "type", 2); +__decorateClass2([ + Property18 +], QuickDatePriceRangeProperties.prototype, "up", 2); +__decorateClass2([ + Property18 +], QuickDatePriceRangeProperties.prototype, "down", 2); +var { BBox: BBox22 } = module_support_exports; +var ANNOTATION_TEXT_LINE_HEIGHT = 1.38; +function maybeWrapText(options, text2, maxWidth) { + return maxWidth ? wrapText(text2, { maxWidth, font: options, textWrap: "always", avoidOrphans: false }) : text2; +} +function measureAnnotationText(options, text2) { + const { lineMetrics, width: width2 } = cachedTextMeasurer(options).measureLines(text2); + const height2 = lineMetrics.length * calcLineHeight(options.fontSize, ANNOTATION_TEXT_LINE_HEIGHT); + return { width: width2, height: height2 }; +} +function getBBox(options, text2, coords, bbox) { + let width2 = bbox?.width ?? 0; + let height2 = bbox?.height ?? 0; + if (!bbox) { + const wrappedText = options.width == null ? text2 : maybeWrapText(options, text2, options.width); + ({ width: width2, height: height2 } = measureAnnotationText(options, wrappedText)); + } + return new BBox22(coords.x, coords.y, width2, height2); +} +function updateTextNode(node, text2, isPlaceholder, config, { x, y }, textBaseline) { + const { visible = true, fontFamily, fontSize = 14, fontStyle, fontWeight, textAlign } = config; + const lineHeight = calcLineHeight(fontSize, ANNOTATION_TEXT_LINE_HEIGHT); + textBaseline ?? (textBaseline = config.position == "center" ? "middle" : config.position); + const fill = isPlaceholder ? config.getPlaceholderColor() : config.color; + node.setProperties({ + x, + y, + visible, + text: text2, + fill, + fontFamily, + fontSize, + fontStyle, + fontWeight, + textAlign, + lineHeight, + textBaseline + }); +} +var { BaseProperties: BaseProperties7, Property: Property19 } = module_support_exports; +var DEFAULT_NOTE_PADDING = 10; +var HANDLE_SIZE = 11; +var ICON_HEIGHT = 20; +var ICON_WIDTH = 22; +var ICON_SPACING = 10; +var LABEL_OFFSET = ICON_HEIGHT + ICON_SPACING; +var TOOLBAR_OFFSET = 34; +var NoteBackgroundProperties = class extends Fill(Stroke(BaseProperties7)) { +}; +var NoteProperties = class extends Fill(Stroke(TextualPointProperties)) { + constructor() { + super(...arguments); + this.type = "note"; + this.background = new NoteBackgroundProperties(); + this.position = "bottom"; + this.alignment = "center"; + this.width = 200; + } + static is(value) { + return isObject(value) && value.type === "note"; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `line-color`: + return this.fill; + case `text-color`: + return this.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `line-color`: + return this.fillOpacity; + case `text-color`: + return void 0; + } + } + getPadding() { + const padding2 = this.padding ?? DEFAULT_NOTE_PADDING; + return { + top: padding2, + right: padding2, + bottom: padding2, + left: padding2 + }; + } + getTextInputCoords(context, height2) { + const { width: width2, text: text2 } = this; + const textInputCoords = super.getTextInputCoords(context, height2); + const padding2 = this.getPadding().top; + const bbox = getBBox(this, text2, textInputCoords); + bbox.x = clamp(width2 / 2, bbox.x, context.seriesRect.width - width2 / 2); + const topY = bbox.y - LABEL_OFFSET - padding2 * 2; + const bottomY = bbox.y + HANDLE_SIZE + padding2 * 2; + const textHeight = Math.max(bbox.height, height2); + if (topY - textHeight - TOOLBAR_OFFSET < 0) { + bbox.y = bottomY; + this.position = "top"; + } else { + bbox.y = topY + padding2; + this.position = "bottom"; + } + return { + x: bbox.x, + y: bbox.y + }; + } + isHoverable() { + return true; + } +}; +__decorateClass2([ + Property19 +], NoteProperties.prototype, "type", 2); +__decorateClass2([ + Property19 +], NoteProperties.prototype, "background", 2); +var { BaseProperties: BaseProperties8 } = module_support_exports; +var PointProperties2 = class extends Annotation(Point(Handle(BaseProperties8))) { + getDefaultColor(_colorPickerType) { + return void 0; + } + getDefaultOpacity(_colorPickerType) { + return void 0; + } +}; +var ShapePointProperties = class _ShapePointProperties extends Fill(PointProperties2) { + constructor() { + super(...arguments); + this.size = 32; + } + static is(value) { + return value instanceof _ShapePointProperties; + } + getDefaultColor(colorPickerType) { + return colorPickerType === `fill-color` ? this.fill : void 0; + } + getDefaultOpacity(colorPickerType) { + return colorPickerType === `fill-color` ? this.fillOpacity : void 0; + } +}; +var { BaseProperties: BaseProperties9, Property: Property20 } = module_support_exports; +var HorizontalLineProperties = class extends Annotation(Value(Handle(AxisLabel2(Stroke(LineStyle(BaseProperties9)))))) { + constructor() { + super(...arguments); + this.direction = "horizontal"; + this.type = "horizontal-line"; + this.text = new LineTextProperties(); + } + static is(value) { + return isObject(value) && value.type === "horizontal-line"; + } + getDefaultColor() { + return this.stroke; + } + getDefaultOpacity() { + return this.strokeOpacity; + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass2([ + Property20 +], HorizontalLineProperties.prototype, "type", 2); +__decorateClass2([ + Property20 +], HorizontalLineProperties.prototype, "text", 2); +var VerticalLineProperties = class extends Annotation(Value(Handle(AxisLabel2(Stroke(LineStyle(BaseProperties9)))))) { + constructor() { + super(...arguments); + this.direction = "vertical"; + this.type = "vertical-line"; + this.text = new LineTextProperties(); + } + static is(value) { + return isObject(value) && value.type === "vertical-line"; + } + getDefaultColor() { + return this.stroke; + } + getDefaultOpacity() { + return this.strokeOpacity; + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass2([ + Property20 +], VerticalLineProperties.prototype, "type", 2); +__decorateClass2([ + Property20 +], VerticalLineProperties.prototype, "text", 2); +var { BaseProperties: BaseProperties10, Property: Property21 } = module_support_exports; +var DisjointChannelProperties = class extends Annotation( + Background2(Line3(Handle(Extendable(Stroke(LineStyle(BaseProperties10)))))) +) { + constructor() { + super(...arguments); + this.type = "disjoint-channel"; + this.text = new ChannelTextProperties(); + this.snapToAngle = 45; + } + static is(value) { + return isObject(value) && value.type === "disjoint-channel"; + } + get bottom() { + const bottom = { + start: { x: this.start.x, y: this.start.y }, + end: { x: this.end.x, y: this.end.y } + }; + if (typeof bottom.start.y === "number" && typeof bottom.end.y === "number") { + bottom.start.y -= this.startHeight; + bottom.end.y -= this.endHeight; + } else { + logger_exports.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`); + } + return bottom; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fill; + case `line-color`: + return this.stroke; + case "text-color": + return this.text.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fillOpacity; + case `line-color`: + return this.strokeOpacity; + } + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass2([ + Property21 +], DisjointChannelProperties.prototype, "type", 2); +__decorateClass2([ + Property21 +], DisjointChannelProperties.prototype, "startHeight", 2); +__decorateClass2([ + Property21 +], DisjointChannelProperties.prototype, "endHeight", 2); +__decorateClass2([ + Property21 +], DisjointChannelProperties.prototype, "text", 2); +var { Property: Property22 } = module_support_exports; +var LineTypeProperties = class extends Localisable( + Cappable(Extendable(Stroke(LineStyle(StartEndProperties)))) +) { + constructor() { + super(...arguments); + this.text = new LineTextProperties(); + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case "line-color": + return this.stroke; + case "text-color": + return this.text.color; + } + } + getDefaultOpacity() { + return this.strokeOpacity; + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass2([ + Property22 +], LineTypeProperties.prototype, "text", 2); +var ArrowProperties = class extends LineTypeProperties { + constructor() { + super(...arguments); + this.type = "arrow"; + this.endCap = "arrow"; + } + static is(value) { + return isObject(value) && value.type === "arrow"; + } +}; +__decorateClass2([ + Property22 +], ArrowProperties.prototype, "type", 2); +var LineProperties = class extends LineTypeProperties { + constructor() { + super(...arguments); + this.type = "line"; + } + static is(value) { + return isObject(value) && value.type === "line"; + } +}; +__decorateClass2([ + Property22 +], LineProperties.prototype, "type", 2); +var { Property: Property23 } = module_support_exports; +var FibonacciProperties = class extends LineTypeProperties { + constructor() { + super(...arguments); + this.label = new LabelTextProperties(); + this.reverse = false; + this.showFill = true; + this.isMultiColor = true; + this.strokes = []; + this.bands = 10; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case "line-color": + return this.rangeStroke ?? this.stroke; + case "text-color": + return this.text.color; + } + } +}; +__decorateClass2([ + Property23 +], FibonacciProperties.prototype, "label", 2); +__decorateClass2([ + Property23 +], FibonacciProperties.prototype, "reverse", 2); +__decorateClass2([ + Property23 +], FibonacciProperties.prototype, "showFill", 2); +__decorateClass2([ + Property23 +], FibonacciProperties.prototype, "isMultiColor", 2); +__decorateClass2([ + Property23 +], FibonacciProperties.prototype, "strokes", 2); +__decorateClass2([ + Property23 +], FibonacciProperties.prototype, "rangeStroke", 2); +__decorateClass2([ + Property23 +], FibonacciProperties.prototype, "bands", 2); +var { Property: Property24 } = module_support_exports; +var FibonacciRetracementTrendBasedProperties = class extends FibonacciProperties { + constructor() { + super(...arguments); + this.type = "fibonacci-retracement-trend-based"; + this.endRetracement = new PointProperties(); + } + static is(value) { + return isObject(value) && value.type === "fibonacci-retracement-trend-based"; + } +}; +__decorateClass2([ + Property24 +], FibonacciRetracementTrendBasedProperties.prototype, "type", 2); +__decorateClass2([ + Property24 +], FibonacciRetracementTrendBasedProperties.prototype, "endRetracement", 2); +var { Property: Property25 } = module_support_exports; +var FibonacciRetracementProperties = class extends FibonacciProperties { + constructor() { + super(...arguments); + this.type = "fibonacci-retracement"; + } + static is(value) { + return isObject(value) && value.type === "fibonacci-retracement"; + } +}; +__decorateClass2([ + Property25 +], FibonacciRetracementProperties.prototype, "type", 2); +var { BaseProperties: BaseProperties11, Property: Property26 } = module_support_exports; +var ParallelChannelProperties = class extends Annotation( + Background2(Line3(Handle(Extendable(Stroke(LineStyle(BaseProperties11)))))) +) { + constructor() { + super(...arguments); + this.type = "parallel-channel"; + this.middle = new ChannelAnnotationMiddleProperties(); + this.text = new ChannelTextProperties(); + this.snapToAngle = 45; + } + static is(value) { + return isObject(value) && value.type === "parallel-channel"; + } + get bottom() { + const bottom = { + start: { x: this.start.x, y: this.start.y }, + end: { x: this.end.x, y: this.end.y } + }; + if (typeof bottom.start.y === "number" && typeof bottom.end.y === "number") { + bottom.start.y -= this.height; + bottom.end.y -= this.height; + } else { + logger_exports.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`); + } + return bottom; + } + getDefaultColor(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fill; + case `line-color`: + return this.stroke; + case "text-color": + return this.text.color; + } + } + getDefaultOpacity(colorPickerType) { + switch (colorPickerType) { + case `fill-color`: + return this.background.fillOpacity; + case `line-color`: + return this.strokeOpacity; + } + } + getLineDash() { + return getLineDash(this.lineDash, this.computedLineDash, this.lineStyle, this.strokeWidth); + } + getLineCap() { + return getLineCap(this.lineCap, this.lineDash, this.lineStyle); + } +}; +__decorateClass2([ + Property26 +], ParallelChannelProperties.prototype, "type", 2); +__decorateClass2([ + Property26 +], ParallelChannelProperties.prototype, "height", 2); +__decorateClass2([ + Property26 +], ParallelChannelProperties.prototype, "middle", 2); +__decorateClass2([ + Property26 +], ParallelChannelProperties.prototype, "text", 2); +var { Property: Property27 } = module_support_exports; +var TextProperties = class extends TextualPointProperties { + constructor() { + super(...arguments); + this.type = "text"; + this.position = "bottom"; + } + static is(value) { + return isObject(value) && value.type === "text"; + } +}; +__decorateClass2([ + Property27 +], TextProperties.prototype, "type", 2); +function isEphemeralType(datum) { + return QuickDatePriceRangeProperties.is(datum); +} +function isLineType(datum) { + return LineProperties.is(datum) || HorizontalLineProperties.is(datum) || VerticalLineProperties.is(datum) || ArrowProperties.is(datum) || isFibonacciType(datum); +} +function isChannelType(datum) { + return DisjointChannelProperties.is(datum) || ParallelChannelProperties.is(datum); +} +function isFibonacciType(datum) { + return FibonacciRetracementProperties.is(datum) || FibonacciRetracementTrendBasedProperties.is(datum); +} +function isTextType(datum) { + return CalloutProperties.is(datum) || CommentProperties.is(datum) || NoteProperties.is(datum) || TextProperties.is(datum); +} +function isMeasurerType(datum) { + return DateRangeProperties.is(datum) || PriceRangeProperties.is(datum) || DatePriceRangeProperties.is(datum) || QuickDatePriceRangeProperties.is(datum); +} +function hasFontSize(datum) { + return isTextType(datum) && !NoteProperties.is(datum); +} +function hasLineStyle(datum) { + return isLineType(datum) || isChannelType(datum) || isMeasurerType(datum) && !QuickDatePriceRangeProperties.is(datum); +} +function hasLineColor(datum) { + return isLineType(datum) || isChannelType(datum) || isMeasurerType(datum) || CalloutProperties.is(datum) || NoteProperties.is(datum); +} +function hasIconColor(datum) { + return NoteProperties.is(datum); +} +function hasFillColor(datum) { + return isChannelType(datum) || isMeasurerType(datum) || CalloutProperties.is(datum) || CommentProperties.is(datum) || ShapePointProperties.is(datum); +} +function hasTextColor(datum) { + return isTextType(datum) && !NoteProperties.is(datum); +} +function hasLineText(datum) { + return (isLineType(datum) || isChannelType(datum) || isMeasurerType(datum)) && !isEphemeralType(datum) && isObject(datum.text); +} +function setFontSize(datum, fontSize) { + if ("fontSize" in datum) + datum.fontSize = fontSize; + if (hasLineText(datum)) + datum.text.fontSize = fontSize; +} +function setLineStyle(datum, style2) { + const strokeWidth = style2?.strokeWidth ?? datum.strokeWidth ?? 1; + const lineType = style2?.type ?? datum.lineStyle; + const lineStyle = lineType ?? getLineStyle(datum.lineDash, lineType); + const computedLineDash = getComputedLineDash(strokeWidth, lineStyle); + datum.strokeWidth = strokeWidth; + datum.computedLineDash = computedLineDash; + datum.lineStyle = lineStyle; + datum.lineCap = lineStyle === "dotted" ? "round" : void 0; +} +function setColor(datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor) { + switch (colorPickerType) { + case `fill-color`: { + if ("fill" in datum) + datum.fill = color6; + if ("fillOpacity" in datum) + datum.fillOpacity = opacity; + if ("background" in datum) { + datum.background.fill = color6; + datum.background.fillOpacity = opacity; + } + break; + } + case `line-color`: { + if ("axisLabel" in datum) { + datum.axisLabel.fill = color6; + datum.axisLabel.fillOpacity = opacity; + datum.axisLabel.stroke = color6; + datum.axisLabel.strokeOpacity = opacity; + } + if ("fill" in datum && "fillOpacity" in datum && hasIconColor(datum)) { + datum.fill = color6; + datum.fillOpacity = opacity; + } else { + if ("strokeOpacity" in datum) + datum.strokeOpacity = opacity; + if ("isMultiColor" in datum && "rangeStroke" in datum) { + datum.isMultiColor = isMultiColor; + datum.rangeStroke = color6; + } else if ("stroke" in datum) { + datum.stroke = color6; + } + } + break; + } + case `text-color`: { + if ("color" in datum) + datum.color = colorOpacity; + if (hasLineText(datum)) + datum.text.color = color6; + break; + } + } +} +var { deepClone: deepClone2 } = module_support_exports; +var AnnotationDefaults = class { + constructor() { + this.mementoOriginatorKey = "annotation-defaults"; + this.colors = new Map( + Object.values(AnnotationType).map((type) => [ + type, + /* @__PURE__ */ new Map([ + ["line-color", void 0], + ["fill-color", void 0], + ["text-color", void 0] + ]) + ]) + ); + this.fontSizes = /* @__PURE__ */ new Map([ + ["callout", void 0], + ["comment", void 0], + ["text", void 0], + ["arrow", void 0], + ["line", void 0], + ["disjoint-channel", void 0], + ["parallel-channel", void 0], + ["date-range", void 0], + ["price-range", void 0], + ["date-price-range", void 0] + ]); + this.lineStyles = /* @__PURE__ */ new Map([ + ["line", void 0], + ["horizontal-line", void 0], + ["vertical-line", void 0], + ["disjoint-channel", void 0], + ["parallel-channel", void 0], + ["arrow", void 0], + ["date-range", void 0], + ["price-range", void 0], + ["date-price-range", void 0] + ]); + this.lineTextAlignments = /* @__PURE__ */ new Map([ + ["line", void 0], + ["horizontal-line", void 0], + ["vertical-line", void 0], + ["disjoint-channel", void 0], + ["parallel-channel", void 0], + ["arrow", void 0], + ["date-range", void 0], + ["price-range", void 0], + ["date-price-range", void 0] + ]); + this.lineTextPositions = /* @__PURE__ */ new Map([ + ["line", void 0], + ["horizontal-line", void 0], + ["vertical-line", void 0], + ["disjoint-channel", void 0], + ["parallel-channel", void 0], + ["arrow", void 0], + ["date-range", void 0], + ["price-range", void 0], + ["date-price-range", void 0] + ]); + this.fibonacciOptions = /* @__PURE__ */ new Map([ + [ + "fibonacci-retracement", + { + bands: void 0, + reverse: void 0, + showFill: void 0 + } + ], + [ + "fibonacci-retracement-trend-based", + { + bands: void 0, + reverse: void 0, + showFill: void 0 + } + ] + ]); + } + createMemento() { + return { + colors: deepClone2(this.colors), + fontSizes: deepClone2(this.fontSizes), + lineStyles: deepClone2(this.lineStyles), + lineTextAlignments: deepClone2(this.lineTextAlignments), + lineTextPositions: deepClone2(this.lineTextPositions), + fibonacciOptions: deepClone2(this.fibonacciOptions) + }; + } + guardMemento(_blob) { + return true; + } + restoreMemento(_version, _mementoVersion, blob) { + this.colors = deepClone2(blob.colors); + this.fontSizes = deepClone2(blob.fontSizes); + this.lineStyles = deepClone2(blob.lineStyles); + this.lineTextAlignments = deepClone2(blob.lineTextAlignments); + this.lineTextPositions = deepClone2(blob.lineTextPositions); + this.fibonacciOptions = deepClone2(blob.fibonacciOptions); + } + setDefaultColor(type, colorType, colorOpacity, color6, opacity, isMultiColor) { + this.colors.get(type)?.set(colorType, [colorOpacity, color6, opacity, isMultiColor]); + } + setDefaultFontSize(type, fontSize) { + this.fontSizes.set(type, fontSize); + } + setDefaultLineStyleType(type, lineStyleType) { + const defaultStyle = this.lineStyles.get(type); + if (defaultStyle) { + defaultStyle.type = lineStyleType; + } else { + this.lineStyles.set(type, { type: lineStyleType }); + } + } + setDefaultLineStyleWidth(type, strokeWidth) { + const defaultStyle = this.lineStyles.get(type); + if (defaultStyle) { + defaultStyle.strokeWidth = strokeWidth; + } else { + this.lineStyles.set(type, { strokeWidth }); + } + } + setDefaultLineTextAlignment(type, alignment) { + this.lineTextAlignments.set(type, alignment); + } + setDefaultLineTextPosition(type, position) { + this.lineTextPositions.set(type, position); + } + setDefaultFibonacciOptions(type, key, value) { + if (type != "fibonacci-retracement" && type != "fibonacci-retracement-trend-based") + return; + const options = this.fibonacciOptions.get(type); + options[key] = value; + this.fibonacciOptions.set(type, options); + } + applyDefaults(datum) { + for (const [annotationType, colors] of this.colors) { + if (datum.type !== annotationType) + continue; + for (const [colorPickerType, [colorOpacity, color6, opacity, isMultiColor] = []] of colors) { + if (colorOpacity && color6 && opacity != null && isMultiColor != null) { + setColor(datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + } + } + } + for (const [annotationType, size] of this.fontSizes) { + if (datum.type !== annotationType || size == null) + continue; + setFontSize(datum, size); + } + for (const [annotationType, style2] of this.lineStyles) { + if (datum.type !== annotationType || style2 == null) + continue; + setLineStyle(datum, style2); + } + for (const [annotationType, position] of this.lineTextPositions) { + if (datum.type !== annotationType || position == null) + continue; + datum.text.position = position; + } + for (const [annotationType, alignment] of this.lineTextAlignments) { + if (datum.type !== annotationType || alignment == null) + continue; + datum.text.alignment = alignment; + } + for (const [annotationType, options] of this.fibonacciOptions) { + if (datum.type !== annotationType || options == null) + continue; + for (const option of Object.keys(options)) { + const value = options[option]; + if (value == null) { + continue; + } + datum.set({ [option]: value }); + } + } + } +}; +var colorPickerTemplate_default = '
'; +var { Color: Color3 } = module_support_exports; +var getHsva = (input) => { + try { + const color6 = Color3.fromString(input); + const [h, s, v] = color6.toHSB(); + return [h, s, v, color6.a]; + } catch { + return; + } +}; +var ColorPicker = class extends module_support_exports.AnchoredPopover { + constructor(ctx, options) { + super(ctx, "color-picker", options); + this.hasChanged = false; + this.hideFns.push(() => { + this.i18nUpdater = void 0; + if (this.hasChanged) + this.onChangeHide?.(); + }); + this.cleanup.register(this.ctx.eventsHub.on("locale:change", () => this.i18nUpdater?.())); + } + show(options) { + this.hasChanged = false; + this.onChangeHide = options.onChangeHide; + const { element: element2, initialFocus } = this.createColorPicker(options); + const popover = this.showWithChildren([element2], { initialFocus, ...options }); + popover.classList.add("ag-charts-color-picker"); + popover.setAttribute("role", "dialog"); + } + createColorPicker(opts) { + const { localeManager } = this.ctx; + let isMultiColor = opts.isMultiColor ?? false; + let [h, s, v, a] = getHsva(opts.color ?? "#f00") ?? [0, 1, 0.5, 1]; + a = opts.opacity ?? a; + const colorPicker = createElement("div", "ag-charts-color-picker__content"); + colorPicker.innerHTML = colorPickerTemplate_default; + colorPicker.ariaLabel = this.ctx.localeManager.t("ariaLabelColorPicker"); + const paletteInput = colorPicker.querySelector(".ag-charts-color-picker__palette"); + const hueInput = colorPicker.querySelector(".ag-charts-color-picker__hue-input"); + const multiColorButton = colorPicker.querySelector( + ".ag-charts-color-picker__multi-color-button" + ); + const alphaInput = colorPicker.querySelector(".ag-charts-color-picker__alpha-input"); + const colorInput = colorPicker.querySelector(".ag-charts-color-picker__color-input"); + const colorInputLabel = colorPicker.querySelector(".ag-charts-color-picker__color-label"); + const updatePaletteInputAriaValue = (first2) => { + const key = { s: "ariaValueColorPalette", v: "ariaValueColorPaletteFirstV" }[first2]; + paletteInput.ariaValueText = localeManager.t(key, { s, v }); + }; + this.i18nUpdater = () => { + paletteInput.ariaRoleDescription = localeManager.t("ariaRoleDescription2DSlider"); + paletteInput.ariaLabel = localeManager.t("ariaLabelColorPickerPalette"); + hueInput.ariaLabel = localeManager.t("ariaLabelColorPickerHue"); + multiColorButton.ariaLabel = localeManager.t("ariaLabelColorPickerMultiColor"); + alphaInput.ariaLabel = localeManager.t("ariaLabelColorPickerAlpha"); + colorInput.ariaLabel = localeManager.t("ariaLabelColor"); + updatePaletteInputAriaValue("s"); + }; + this.i18nUpdater(); + multiColorButton.classList.toggle( + "ag-charts-color-picker__multi-color-button--hidden", + !opts.hasMultiColorOption + ); + const update = (trackChange = true) => { + const color6 = Color3.fromHSB(h, s, v, a); + const colorString = color6.toHexString(); + colorPicker.style.setProperty("--h", `${h}`); + colorPicker.style.setProperty("--s", `${s}`); + colorPicker.style.setProperty("--v", `${v}`); + colorPicker.style.setProperty("--a", `${a}`); + colorPicker.style.setProperty("--color", colorString.slice(0, 7)); + colorPicker.style.setProperty("--color-a", colorString); + hueInput.value = `${h}`; + alphaInput.value = `${a}`; + alphaInput.classList.toggle("ag-charts-color-picker__alpha-input--opaque", a === 1); + multiColorButton.classList.toggle("ag-charts-color-picker__multi-color-button--active", isMultiColor); + colorInputLabel.classList.toggle("ag-charts-color-picker__color-label--multi-color", isMultiColor); + if (document.activeElement !== colorInput) { + multiColorButton.ariaChecked = isMultiColor.toString(); + colorInput.value = isMultiColor ? localeManager.t("ariaLabelColorPickerMultiColor") : colorString.toUpperCase(); + } + if (trackChange || opts.color == null) { + const plainColor = Color3.fromHSB(h, s, v, 1).toHexString(); + opts.onChange?.(colorString, plainColor, a, isMultiColor); + } + if (trackChange) + this.hasChanged = true; + }; + update(false); + const preventDefault = (event) => event.preventDefault(); + const stopPropagation = (event) => event.stopPropagation(); + const beginPaletteInteraction = (e) => { + e.preventDefault(); + const currentTarget = e.currentTarget; + currentTarget.focus(); + const rect2 = currentTarget.getBoundingClientRect(); + const pointerMove = ({ clientX, clientY }) => { + isMultiColor = false; + s = Math.min(Math.max((clientX - rect2.left) / rect2.width, 0), 1); + v = 1 - Math.min(Math.max((clientY - rect2.top) / rect2.height, 0), 1); + update(); + updatePaletteInputAriaValue("s"); + }; + pointerMove(e); + const pointerUp = attachListener(getWindow(), "pointermove", pointerMove); + getWindow().addEventListener("pointerup", pointerUp, { once: true }); + }; + colorPicker.addEventListener("mousedown", stopPropagation); + colorPicker.addEventListener("touchstart", stopPropagation); + colorPicker.addEventListener("touchmove", stopPropagation); + colorPicker.addEventListener("keydown", (e) => { + e.stopPropagation(); + switch (e.key) { + case "Enter": + case "Escape": + this.hide(); + break; + default: + return; + } + e.preventDefault(); + }); + paletteInput.addEventListener("pointerdown", beginPaletteInteraction); + paletteInput.addEventListener("touchstart", preventDefault, { passive: false }); + paletteInput.addEventListener("touchmove", preventDefault, { passive: false }); + paletteInput.addEventListener("keydown", (e) => { + if (e.key === "ArrowLeft") { + s = clamp(0, s - 0.01, 1); + updatePaletteInputAriaValue("s"); + } else if (e.key === "ArrowRight") { + s = clamp(0, s + 0.01, 1); + updatePaletteInputAriaValue("s"); + } else if (e.key === "ArrowUp") { + v = clamp(0, v + 0.01, 1); + updatePaletteInputAriaValue("v"); + } else if (e.key === "ArrowDown") { + v = clamp(0, v - 0.01, 1); + updatePaletteInputAriaValue("v"); + } else { + return; + } + e.preventDefault(); + update(); + }); + paletteInput.addEventListener("focus", () => { + updatePaletteInputAriaValue("s"); + }); + multiColorButton.addEventListener("click", () => { + isMultiColor = !isMultiColor; + update(); + }); + hueInput.addEventListener("input", (e) => { + isMultiColor = false; + h = e.currentTarget.valueAsNumber ?? 0; + update(); + }); + alphaInput.addEventListener("input", (e) => { + isMultiColor = false; + a = e.currentTarget.valueAsNumber ?? 0; + update(); + }); + colorInput.addEventListener("input", (e) => { + isMultiColor = false; + const hsva = getHsva(e.currentTarget.value); + if (hsva == null) + return; + [h, s, v, a] = hsva; + update(); + }); + colorInput.addEventListener("blur", () => update()); + colorInput.addEventListener("keydown", (e) => { + if (e.key === "Enter") { + e.currentTarget.blur(); + update(); + } + }); + return { element: colorPicker, initialFocus: paletteInput }; + } +}; +function channelMenuItemVisible(scale2) { + return !(scale2 instanceof module_support_exports.LogScale) && !(scale2 instanceof module_support_exports.BandScale); +} +var LINE_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsTrendLine", + icon: "trend-line-drawing", + value: "line" + /* Line */ + }, + { + label: "toolbarAnnotationsHorizontalLine", + icon: "horizontal-line-drawing", + value: "horizontal-line" + /* HorizontalLine */ + }, + { + label: "toolbarAnnotationsVerticalLine", + icon: "vertical-line-drawing", + value: "vertical-line" + /* VerticalLine */ + }, + { + label: "toolbarAnnotationsParallelChannel", + icon: "parallel-channel-drawing", + value: "parallel-channel", + visible: channelMenuItemVisible + }, + { + label: "toolbarAnnotationsDisjointChannel", + icon: "disjoint-channel-drawing", + value: "disjoint-channel", + visible: channelMenuItemVisible + } +]; +var FIBONACCI_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsFibonacciRetracement", + icon: "fibonacci-retracement-drawing", + value: "fibonacci-retracement" + /* FibonacciRetracement */ + }, + { + label: "toolbarAnnotationsFibonacciRetracementTrendBased", + icon: "fibonacci-retracement-trend-based-drawing", + value: "fibonacci-retracement-trend-based" + /* FibonacciRetracementTrendBased */ + } +]; +var FIBONACCI_RATIO_ITEMS = [ + { label: "Fibonacci - Extended", value: 10 }, + { label: "Fibonacci - 6 Band", value: 6 }, + { label: "Fibonacci - 4 Band", value: 4 } +]; +var TEXT_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsText", + icon: "text-annotation", + value: "text" + /* Text */ + }, + { + label: "toolbarAnnotationsComment", + icon: "comment-annotation", + value: "comment" + /* Comment */ + }, + { + label: "toolbarAnnotationsCallout", + icon: "callout-annotation", + value: "callout" + /* Callout */ + }, + { + label: "toolbarAnnotationsNote", + icon: "note-annotation", + value: "note" + /* Note */ + } +]; +var SHAPE_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsArrow", + icon: "arrow-drawing", + value: "arrow" + /* Arrow */ + }, + { + label: "toolbarAnnotationsArrowUp", + icon: "arrow-up-drawing", + value: "arrow-up" + /* ArrowUp */ + }, + { + label: "toolbarAnnotationsArrowDown", + icon: "arrow-down-drawing", + value: "arrow-down" + /* ArrowDown */ + } +]; +var MEASURER_ANNOTATION_ITEMS = [ + { + label: "toolbarAnnotationsQuickDatePriceRange", + icon: "measurer-drawing", + value: "quick-date-price-range" + /* QuickDatePriceRange */ + }, + { + label: "toolbarAnnotationsDateRange", + icon: "date-range-drawing", + value: "date-range" + /* DateRange */ + }, + { + label: "toolbarAnnotationsPriceRange", + icon: "price-range-drawing", + value: "price-range" + /* PriceRange */ + }, + { + label: "toolbarAnnotationsDatePriceRange", + icon: "date-price-range-drawing", + value: "date-price-range" + /* DatePriceRange */ + } +]; +var LINE_STROKE_WIDTH_ITEMS = [ + { strokeWidth: 1, label: "1", value: 1 }, + { strokeWidth: 2, label: "2", value: 2 }, + { strokeWidth: 3, label: "3", value: 3 }, + { strokeWidth: 4, label: "4", value: 4 }, + { strokeWidth: 8, label: "8", value: 8 } +]; +var LINE_STYLE_TYPE_ITEMS = [ + { icon: "line-style-solid", altText: "iconAltTextLineStyleSolid", value: "solid" }, + { icon: "line-style-dashed", altText: "iconAltTextLineStyleDashed", value: "dashed" }, + { icon: "line-style-dotted", altText: "iconAltTextLineStyleDotted", value: "dotted" } +]; +var TEXT_SIZE_ITEMS = [ + { label: "10", value: 10 }, + { label: "12", value: 12 }, + { label: "14", value: 14 }, + { label: "16", value: 16 }, + { label: "18", value: 18 }, + { label: "22", value: 22 }, + { label: "28", value: 28 }, + { label: "36", value: 36 }, + { label: "46", value: 46 } +]; +var { Color: Color4, FloatingToolbar: FloatingToolbar2, Menu: Menu2, PropertiesArray: PropertiesArray2, ToolbarButtonProperties: ToolbarButtonProperties2, ToolbarButtonWidget: ToolbarButtonWidget2, Property: Property28 } = module_support_exports; +var AnnotationOptionsButtonProperties = class extends ToolbarButtonProperties2 { + constructor() { + super(...arguments); + this.checkedOverrides = new ToolbarButtonProperties2(); + } +}; +__decorateClass2([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "value", 2); +__decorateClass2([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "checkedOverrides", 2); +__decorateClass2([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "color", 2); +__decorateClass2([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property28 +], AnnotationOptionsButtonProperties.prototype, "isMultiColor", 2); +var AnnotationOptionsButtonWidget = class extends ToolbarButtonWidget2 { + update(options) { + super.update(options); + if (options.value === "line-stroke-width") { + this.updateLineStrokeWidth(options); + } + if (options.value === "fill-color" || options.value === "line-color" || options.value === "text-color") { + this.updateFillColor(options); + } + } + updateFillColor(options) { + const element2 = this.getElement(); + element2.classList.add("ag-charts-annotations__color-picker-button"); + element2.classList.toggle("ag-charts-annotations__color-picker-button--multi-color", options.isMultiColor); + element2.style.setProperty("--color", options.color ?? null); + } + updateLineStrokeWidth(options) { + const element2 = this.getElement(); + element2.classList.add("ag-charts-annotations__stroke-width-button"); + element2.style.setProperty("--stroke-width", `${options.strokeWidth}px`); + } +}; +var FloatingAnnotationOptionsToolbar = class extends FloatingToolbar2 { + createButtonWidget() { + return new AnnotationOptionsButtonWidget(this.localeManager); + } +}; +var AnnotationOptionsToolbar = class extends module_support_exports.BaseProperties { + constructor(ctx, getActiveDatum) { + super(); + this.ctx = ctx; + this.getActiveDatum = getActiveDatum; + this.enabled = true; + this.buttons = new PropertiesArray2(AnnotationOptionsButtonProperties); + this.cleanup = new CleanupRegistry(); + this.events = new EventEmitter(); + this.visibleButtons = []; + this.toolbar = new FloatingAnnotationOptionsToolbar( + this.ctx, + "ariaLabelAnnotationOptionsToolbar", + "annotation-options" + ); + this.colorPicker = new ColorPicker(this.ctx); + this.textSizeMenu = new Menu2(this.ctx, "text-size"); + this.lineStyleTypeMenu = new Menu2(this.ctx, "annotations-line-style-type"); + this.lineStrokeWidthMenu = new Menu2(this.ctx, "annotations-line-stroke-width"); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPress.bind(this)), + this.toolbar.addToolbarListener("toolbar-moved", this.onToolbarMoved.bind(this)), + ctx.widgets.seriesWidget.addListener("drag-start", this.onDragStart.bind(this)), + ctx.widgets.seriesWidget.addListener("drag-end", this.onDragEnd.bind(this)), + () => { + this.colorPicker.destroy(); + this.toolbar.destroy(); + } + ); + } + onDragStart() { + this.toolbar.ignorePointerEvents(); + } + onDragEnd() { + this.toolbar.capturePointerEvents(); + } + destroy() { + this.cleanup.flush(); + } + show() { + if (!this.enabled) + return; + this.toolbar.show(); + } + hide() { + this.toolbar.hide(); + } + updateButtons(datum) { + if (!this.enabled) + return; + const visible = { + [ + "line-style-type" + /* LineStyleType */ + ]: hasLineStyle(datum), + [ + "line-stroke-width" + /* LineStrokeWidth */ + ]: hasLineStyle(datum), + [ + "line-color" + /* LineColor */ + ]: hasLineColor(datum), + [ + "text-color" + /* TextColor */ + ]: hasTextColor(datum), + [ + "fill-color" + /* FillColor */ + ]: hasFillColor(datum), + [ + "text-size" + /* TextSize */ + ]: hasFontSize(datum), + [ + "settings" + /* Settings */ + ]: hasLineText(datum), + [ + "lock" + /* Lock */ + ]: true, + [ + "delete" + /* Delete */ + ]: true + }; + this.visibleButtons = this.buttons.filter((button) => visible[button.value]); + this.toolbar.clearButtons(); + this.toolbar.updateButtons(this.visibleButtons); + this.refreshButtons(datum); + } + setAnchorScene(scene) { + if (this.toolbar.hasBeenDragged()) + return; + this.toolbar.setAnchor(scene.getAnchor()); + } + hideOverlays() { + this.toolbar.clearActiveButton(); + this.colorPicker.hide({ lastFocus: null }); + this.textSizeMenu.hide(); + this.lineStyleTypeMenu.hide(); + this.lineStrokeWidthMenu.hide(); + this.events.emit("hid-overlays", null); + } + clearActiveButton() { + this.toolbar.clearActiveButton(); + } + updateColors(datum) { + this.updateColorPickerColor( + "line-color", + datum.getDefaultColor( + "line-color" + /* LineColor */ + ), + datum.getDefaultOpacity( + "line-color" + /* LineColor */ + ), + "isMultiColor" in datum && datum?.isMultiColor + ); + this.updateColorPickerColor( + "fill-color", + datum.getDefaultColor( + "fill-color" + /* FillColor */ + ), + datum.getDefaultOpacity( + "fill-color" + /* FillColor */ + ), + "isMultiColor" in datum && datum?.isMultiColor + ); + this.updateColorPickerColor( + "text-color", + datum.getDefaultColor( + "text-color" + /* TextColor */ + ), + datum.getDefaultOpacity( + "text-color" + /* TextColor */ + ), + "isMultiColor" in datum && datum?.isMultiColor + ); + } + updateColorPickerColor(colorPickerType, color6, opacity, isMultiColor) { + if (color6 != null && opacity != null) { + const { r, g, b } = Color4.fromString(color6); + color6 = Color4.fromArray([r, g, b, opacity]).toHexString(); + } + this.updateButtonByValue(colorPickerType, { color: color6, isMultiColor }); + } + updateFontSize(fontSize) { + this.updateButtonByValue("text-size", { + label: fontSize == null ? void 0 : String(fontSize) + }); + } + updateLineStyleType(item) { + this.updateButtonByValue("line-style-type", { + icon: item.icon + }); + } + updateStrokeWidth(item) { + this.updateButtonByValue("line-stroke-width", { + label: item.label, + strokeWidth: item.value + }); + } + onButtonPress({ + event, + button, + buttonWidget + }) { + const datum = this.getActiveDatum(); + if (!datum) + return; + this.hideOverlays(); + switch (button.value) { + case "line-style-type": { + const lineStyle = hasLineStyle(datum) ? getLineStyle(datum.lineDash, datum.lineStyle) : void 0; + this.lineStyleTypeMenu.show(buttonWidget, { + items: LINE_STYLE_TYPE_ITEMS, + ariaLabel: this.ctx.localeManager.t("toolbarAnnotationsLineStyle"), + value: lineStyle, + onPress: (item) => this.onLineStyleTypeMenuPress(item, datum), + class: "ag-charts-annotations__line-style-type-menu" + }); + break; + } + case "line-stroke-width": { + const strokeWidth = hasLineStyle(datum) ? datum.strokeWidth : void 0; + this.lineStrokeWidthMenu.show(buttonWidget, { + items: LINE_STROKE_WIDTH_ITEMS, + ariaLabel: this.ctx.localeManager.t("toolbarAnnotationsLineStrokeWidth"), + value: strokeWidth, + onPress: (item) => this.onLineStrokeWidthMenuPress(item, datum), + class: "ag-charts-annotations__line-stroke-width-menu" + }); + break; + } + case "line-color": + case "fill-color": + case "text-color": { + this.toolbar.toggleActiveButtonByIndex(button.index); + this.colorPicker.show({ + color: datum?.getDefaultColor(button.value), + opacity: datum?.getDefaultOpacity(button.value), + sourceEvent: event.sourceEvent, + hasMultiColorOption: "isMultiColor" in datum, + isMultiColor: "isMultiColor" in datum && datum?.isMultiColor, + onChange: datum == null ? void 0 : this.onColorPickerChange.bind(this, button.value, datum), + onChangeHide: ((type) => { + this.events.emit("saved-color", { + type: datum.type, + colorPickerType: button.value, + color: datum.getDefaultColor(type) + }); + }).bind(this, button.value) + }); + break; + } + case "text-size": { + const fontSize = isTextType(datum) ? datum.fontSize : void 0; + this.textSizeMenu.show(buttonWidget, { + items: TEXT_SIZE_ITEMS, + ariaLabel: this.ctx.localeManager.t("toolbarAnnotationsTextSize"), + value: fontSize, + onPress: (item) => this.onTextSizeMenuPress(item, datum), + class: "ag-charts-annotations__text-size-menu" + }); + break; + } + case "delete": { + this.events.emit("pressed-delete", null); + break; + } + case "lock": { + datum.locked = !datum.locked; + this.refreshButtons(datum); + this.events.emit("pressed-lock", { locked: datum.locked }); + break; + } + case "settings": { + this.toolbar.toggleActiveButtonByIndex(button.index); + this.events.emit("pressed-settings", event); + break; + } + } + } + onToolbarMoved(event) { + const { buttonBounds, popoverBounds } = event; + const colorPickerAnchor = { x: popoverBounds.x, y: popoverBounds.y + popoverBounds.height + 4 }; + const colorPickerFallbackAnchor = { y: popoverBounds.y - 4 }; + this.colorPicker.setAnchor(colorPickerAnchor, colorPickerFallbackAnchor); + for (const [index, bounds] of buttonBounds.entries()) { + const button = this.visibleButtons.at(index); + if (!button) + continue; + const anchor = { x: bounds.x, y: bounds.y + bounds.height - 1 }; + const fallbackAnchor = { y: bounds.y }; + switch (button.value) { + case "line-stroke-width": + this.lineStrokeWidthMenu.setAnchor(anchor, fallbackAnchor); + break; + case "line-style-type": + this.lineStyleTypeMenu.setAnchor(anchor, fallbackAnchor); + break; + case "text-size": + this.textSizeMenu.setAnchor(anchor, fallbackAnchor); + break; + } + } + } + onColorPickerChange(colorPickerType, datum, colorOpacity, color6, opacity, isMultiColor) { + this.events.emit("updated-color", { + type: datum.type, + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }); + this.updateColorPickerColor(colorPickerType, colorOpacity, opacity, isMultiColor); + } + onTextSizeMenuPress(item, datum) { + if (!hasFontSize(datum)) + return; + const fontSize = item.value; + this.events.emit("updated-font-size", { type: datum.type, fontSize }); + this.textSizeMenu.hide(); + this.updateFontSize(fontSize); + } + onLineStyleTypeMenuPress(item, datum) { + if (!hasLineStyle(datum)) + return; + const type = item.value; + this.events.emit("updated-line-style", { type: datum.type, lineStyleType: type }); + this.lineStyleTypeMenu.hide(); + this.updateLineStyleType(item); + } + onLineStrokeWidthMenuPress(item, datum) { + if (!hasLineStyle(datum)) { + return; + } + const strokeWidth = item.value; + this.events.emit("updated-line-width", { type: datum.type, strokeWidth }); + this.lineStrokeWidthMenu.hide(); + this.updateStrokeWidth(item); + } + refreshButtons(datum) { + const locked = datum.locked ?? false; + for (const [index, button] of this.visibleButtons.entries()) { + if (!button) + continue; + if (button.value === "lock") { + this.toolbar.toggleSwitchCheckedByIndex(index, locked); + this.updateButtonByIndex(index, locked ? button.checkedOverrides.toJson() : button.toJson()); + } else { + this.toolbar.toggleButtonEnabledByIndex(index, !locked); + } + } + if (hasFontSize(datum)) + this.updateFontSize(datum.fontSize); + this.updateColors(datum); + this.updateLineStyles(datum); + } + updateLineStyles(datum) { + if (!hasLineStyle(datum)) + return; + const strokeWidth = datum.strokeWidth ?? 1; + const lineStyleType = getLineStyle(datum.lineDash, datum.lineStyle); + this.updateStrokeWidth({ + strokeWidth, + value: strokeWidth, + label: String(strokeWidth) + }); + this.updateLineStyleType( + LINE_STYLE_TYPE_ITEMS.find((item) => item.value === lineStyleType) ?? LINE_STYLE_TYPE_ITEMS[0] + ); + } + updateButtonByValue(value, change) { + const index = this.visibleButtons.findIndex((button) => button.value === value); + if (index === -1) + return; + this.updateButtonByIndex(index, change); + } + updateButtonByIndex(index, change) { + const button = this.visibleButtons.at(index); + if (!button) + return; + this.toolbar.updateButtonByIndex(index, { ...button.toJson(), ...change, value: change.value ?? button.value }); + } +}; +__decorateClass2([ + Property28 +], AnnotationOptionsToolbar.prototype, "enabled", 2); +__decorateClass2([ + Property28 +], AnnotationOptionsToolbar.prototype, "buttons", 2); +var { StateMachine: StateMachine2, StateMachineProperty: StateMachineProperty2, Vec2: Vec222, Debug: Debug2 } = module_support_exports; +var DragStateMachine = class extends StateMachine2 { + constructor(ctx) { + const actionKeyChange = ({ context }) => { + this.node?.drag(this.datum, this.offset, context, this.snapping); + ctx.update(); + }; + super("idle", { + idle: { + dragStart: { + target: "dragging", + action: ({ offset, context }) => { + this.hasMoved = false; + this.dragStart = offset; + this.offset = offset; + this.node?.dragStart(this.datum, offset, context); + } + } + }, + dragging: { + keyDown: actionKeyChange, + keyUp: actionKeyChange, + drag: ({ offset, context }) => { + this.hasMoved = Vec222.lengthSquared(Vec222.sub(offset, this.dragStart)) > 0; + this.offset = offset; + this.node?.drag(this.datum, offset, context, this.snapping); + ctx.update(); + }, + dragEnd: { + target: StateMachine2.parent, + action: () => { + this.node?.stopDragging(); + if (this.hasMoved) + ctx.recordAction("Move annotation"); + ctx.update(); + } + } + } + }); + this.debug = Debug2.create(true, "annotations"); + this.hasMoved = false; + this.snapping = false; + } +}; +__decorateClass2([ + StateMachineProperty2() +], DragStateMachine.prototype, "snapping", 2); +__decorateClass2([ + StateMachineProperty2() +], DragStateMachine.prototype, "datum", 2); +__decorateClass2([ + StateMachineProperty2() +], DragStateMachine.prototype, "node", 2); +var { Property: Property29 } = module_support_exports; +var ArrowDownProperties = class extends ShapePointProperties { + constructor() { + super(...arguments); + this.type = "arrow-down"; + } + static is(value) { + return isObject(value) && value.type === "arrow-down"; + } +}; +__decorateClass2([ + Property29 +], ArrowDownProperties.prototype, "type", 2); +var AnnotationShape = class extends module_support_exports.Marker { + // Use exact method for this, rather than the Marker's high performance approximation. + isPointInPath(x, y) { + this.updatePathIfDirty(); + return this.path.closedPath && this.path.isPointInPath(x, y); + } +}; +var _Handle = class _Handle2 extends module_support_exports.Group { + constructor() { + super(...arguments); + this.active = false; + this.locked = false; + this.visible = false; + this.zIndex = 1; + } + drag(target) { + const { handle: handle22, locked } = this; + if (locked) { + return { point: { x: handle22.x, y: handle22.y }, offset: { x: 0, y: 0 } }; + } + return { + point: target, + offset: { x: target.x - handle22.x, y: target.y - handle22.y } + }; + } + toggleActive(active) { + this.active = active; + if (!active) { + this.handle.strokeWidth = _Handle2.INACTIVE_STROKE_WIDTH; + } + } + toggleHovered(hovered) { + this.glow.visible = !this.locked && hovered; + this.glow.dirtyPath = true; + } + toggleDragging(dragging) { + if (this.locked) + return; + this.handle.visible = !dragging; + this.glow.visible = this.glow.visible && !dragging; + this.handle.dirtyPath = true; + this.glow.dirtyPath = true; + } + toggleLocked(locked) { + this.locked = locked; + } + getCursor() { + return void 0; + } + containsPoint(x, y) { + return this.handle.containsPoint(x, y); + } +}; +_Handle.INACTIVE_STROKE_WIDTH = 2; +var Handle2 = _Handle; +var _InvariantHandle = class _InvariantHandle2 extends Handle2 { + constructor() { + super(); + this.handle = new AnnotationShape({ shape: "circle" }); + this.glow = new AnnotationShape({ shape: "circle" }); + this.append([this.handle]); + this.handle.size = _InvariantHandle2.HANDLE_SIZE; + this.handle.strokeWidth = Handle2.INACTIVE_STROKE_WIDTH; + this.handle.zIndex = 2; + } + update(styles) { + this.handle.setProperties({ ...styles, strokeWidth: Handle2.INACTIVE_STROKE_WIDTH }); + } + drag(target) { + return { point: target, offset: { x: 0, y: 0 } }; + } +}; +_InvariantHandle.HANDLE_SIZE = 7; +_InvariantHandle.GLOW_SIZE = 9; +var InvariantHandle = _InvariantHandle; +var _UnivariantHandle = class _UnivariantHandle2 extends Handle2 { + constructor() { + super(); + this.handle = new module_support_exports.Rect(); + this.glow = new module_support_exports.Rect(); + this.gradient = "horizontal"; + this.append([this.glow, this.handle]); + this.handle.cornerRadius = _UnivariantHandle2.CORNER_RADIUS; + this.handle.width = _UnivariantHandle2.HANDLE_SIZE; + this.handle.height = _UnivariantHandle2.HANDLE_SIZE; + this.handle.strokeWidth = Handle2.INACTIVE_STROKE_WIDTH; + this.handle.zIndex = 2; + this.glow.cornerRadius = _UnivariantHandle2.CORNER_RADIUS; + this.glow.width = _UnivariantHandle2.GLOW_SIZE; + this.glow.height = _UnivariantHandle2.GLOW_SIZE; + this.glow.strokeWidth = 0; + this.glow.fillOpacity = 0.2; + this.glow.zIndex = 1; + this.glow.visible = false; + } + toggleLocked(locked) { + super.toggleLocked(locked); + if (locked) { + const offset = (_UnivariantHandle2.HANDLE_SIZE - InvariantHandle.HANDLE_SIZE) / 2; + this.handle.cornerRadius = 1; + this.handle.fill = this.handle.stroke; + this.handle.strokeWidth = 0; + this.handle.x += offset; + this.handle.y += offset; + this.handle.width = InvariantHandle.HANDLE_SIZE; + this.handle.height = InvariantHandle.HANDLE_SIZE; + this.glow.width = InvariantHandle.GLOW_SIZE; + this.glow.height = InvariantHandle.GLOW_SIZE; + } else { + this.handle.cornerRadius = _UnivariantHandle2.CORNER_RADIUS; + this.handle.width = _UnivariantHandle2.HANDLE_SIZE; + this.handle.height = _UnivariantHandle2.HANDLE_SIZE; + this.glow.width = _UnivariantHandle2.GLOW_SIZE; + this.glow.height = _UnivariantHandle2.GLOW_SIZE; + if (this.cachedStyles) { + this.handle.setProperties(this.cachedStyles); + } + } + } + update(styles) { + this.cachedStyles = { ...styles }; + if (!this.active) { + delete styles.strokeWidth; + } + if (this.locked) { + delete styles.fill; + delete styles.strokeWidth; + const offset = (_UnivariantHandle2.HANDLE_SIZE - InvariantHandle.HANDLE_SIZE) / 2; + styles.x -= offset; + styles.y -= offset; + this.cachedStyles.x -= offset; + this.cachedStyles.y -= offset; + } + this.handle.setProperties(styles); + this.glow.setProperties({ + ...styles, + x: (styles.x ?? this.glow.x) - 2, + y: (styles.y ?? this.glow.y) - 2, + strokeWidth: 0, + fill: styles.stroke + }); + } + drag(target) { + if (this.locked) { + return { point: target, offset: { x: 0, y: 0 } }; + } + if (this.gradient === "vertical") { + return { + point: { x: target.x, y: this.handle.y }, + offset: { x: target.x - this.handle.x, y: 0 } + }; + } + return { + point: { x: this.handle.x, y: target.y }, + offset: { x: 0, y: target.y - this.handle.y } + }; + } + getCursor() { + if (this.locked) + return; + return this.gradient === "vertical" ? "col-resize" : "row-resize"; + } +}; +_UnivariantHandle.HANDLE_SIZE = 12; +_UnivariantHandle.GLOW_SIZE = 16; +_UnivariantHandle.CORNER_RADIUS = 4; +var UnivariantHandle = _UnivariantHandle; +var _DivariantHandle = class _DivariantHandle2 extends Handle2 { + constructor() { + super(); + this.handle = new AnnotationShape({ shape: "circle" }); + this.glow = new AnnotationShape({ shape: "circle" }); + this.append([this.glow, this.handle]); + this.handle.size = _DivariantHandle2.HANDLE_SIZE; + this.handle.strokeWidth = Handle2.INACTIVE_STROKE_WIDTH; + this.handle.zIndex = 2; + this.glow.size = _DivariantHandle2.GLOW_SIZE; + this.glow.strokeWidth = 0; + this.glow.fillOpacity = 0.2; + this.glow.zIndex = 1; + this.glow.visible = false; + } + toggleLocked(locked) { + super.toggleLocked(locked); + if (locked) { + this.handle.fill = this.handle.stroke; + this.handle.strokeWidth = 0; + this.handle.size = InvariantHandle.HANDLE_SIZE; + this.glow.size = InvariantHandle.GLOW_SIZE; + } else { + this.handle.size = _DivariantHandle2.HANDLE_SIZE; + this.glow.size = _DivariantHandle2.GLOW_SIZE; + if (this.cachedStyles) { + this.handle.setProperties(this.cachedStyles); + } + } + } + update(styles) { + this.cachedStyles = { ...styles }; + if (!this.active) { + delete styles.strokeWidth; + } + if (this.locked) { + delete styles.fill; + delete styles.strokeWidth; + } + this.handle.setProperties(styles); + this.glow.setProperties({ ...styles, strokeWidth: 0, fill: styles.stroke }); + } + getCursor() { + return "pointer"; + } +}; +_DivariantHandle.HANDLE_SIZE = 11; +_DivariantHandle.GLOW_SIZE = 17; +var DivariantHandle = _DivariantHandle; +var { ZIndexMap: ZIndexMap22 } = module_support_exports; +var AnnotationScene = class extends module_support_exports.Group { + constructor() { + super(...arguments); + this.name = "AnnotationScene"; + this.zIndex = ZIndexMap22.CHART_ANNOTATION; + } + static isCheck(value, type) { + return isObject(value) && Object.hasOwn(value, "type") && value.type === type; + } + toggleHovered(hovered, active, readOnly) { + if (readOnly === true) + return; + this.toggleHandles(hovered || active); + } + computeBBoxWithoutHandles() { + return module_support_exports.Transformable.toCanvas( + this, + module_support_exports.Group.computeChildrenBBox(this.excludeChildren({ instance: Handle2 })) + ); + } + updateNode(constructor, node, isConfigured) { + if (!isConfigured && node) { + node.remove(); + return; + } + if (isConfigured && node == null) { + node = new constructor(); + this.appendChild(node); + } + return node; + } +}; +var { ContinuousScale: ContinuousScale22, Vec2: Vec23, toRadians: toRadians3 } = module_support_exports; +function snapPoint(offset, context, snapping = false, origin3, angleStep = 1) { + if (!snapping) + return invertCoords(offset, context); + const center2 = origin3 ? convertPoint(origin3, context) : Vec23.origin(); + return invertCoords(snapToAngle(offset, center2, angleStep), context); +} +function snapToAngle(vector, center2, step) { + const radial = Vec23.sub(vector, center2); + const stepRadians = toRadians3(step); + const theta = Math.round(Vec23.angle(radial) / stepRadians) * stepRadians; + return Vec23.rotate(radial, theta, center2); +} +function getDragStartState(points, context) { + const dragState = {}; + for (const [name, point] of entries(points)) { + dragState[name] = convertPoint(point, context); + } + return dragState; +} +function translate(vectors, translation, context, options = { + overflowContinuous: 0, + translateVectors: void 0, + invertYVectors: void 0, + snap: void 0 +}) { + const { xAxis, yAxis } = context; + const vectorNames = Object.keys(vectors); + const overflowsX = []; + const overflowsY = []; + const translateVectors = new Set(options.translateVectors ?? vectorNames); + const invertYVectors = new Set(options.invertYVectors ?? []); + const movingVectors = /* @__PURE__ */ new Set([...translateVectors, ...invertYVectors]); + const invertYTranslation = Vec23.multiply(translation, Vec23.from(1, -1)); + for (const name of vectorNames) { + if (movingVectors.has(name)) { + vectors[name] = Vec23.add(vectors[name], invertYVectors.has(name) ? invertYTranslation : translation); + if (options.snap) { + vectors[name] = snapToAngle(vectors[name], options.snap.vectors[name], options.snap.angle); + } + } + overflowsX.push(xAxis.getRangeOverflow(vectors[name].x)); + overflowsY.push(yAxis.getRangeOverflow(vectors[name].y)); + } + const sortNumbersAbs = (a, b) => Math.abs(a) - Math.abs(b); + const overflowDirection = (scale2, directionTranslation, overflows) => { + if (options.overflowContinuous === 0 || !ContinuousScale22.is(scale2)) { + return overflows.toSorted(sortNumbersAbs).at(-1) ?? 0; + } + if (vectorNames.length === movingVectors.size) { + return overflows.toSorted(sortNumbersAbs).at(-options.overflowContinuous - 1) ?? 0; + } + if (overflows.filter((value) => value !== 0).length <= options.overflowContinuous) { + return 0; + } + const newTranslatedOverflows = overflows.filter( + (value, index) => value !== 0 && Math.abs(value) <= Math.abs(directionTranslation) && movingVectors.has(vectorNames[index]) + ); + return newTranslatedOverflows.toSorted(sortNumbersAbs).at(-1) ?? 0; + }; + const overflow = Vec23.from( + overflowDirection(xAxis.scale, translation.x, overflowsX), + overflowDirection(yAxis.scale, translation.y, overflowsY) + ); + if (!Vec23.equal(overflow, Vec23.origin())) { + for (const name of vectorNames) { + if (!movingVectors.has(name)) + continue; + vectors[name] = Vec23.round(Vec23.sub(vectors[name], overflow), 4); + } + } + const result = {}; + for (const name of vectorNames) { + result[name] = invertCoords(vectors[name], context); + } + return result; +} +var { Vec2: Vec24 } = module_support_exports; +var PointScene = class extends AnnotationScene { + constructor() { + super(...arguments); + this.handle = new DivariantHandle(); + this.anchor = { + x: 0, + y: 0, + position: "above" + }; + } + update(datum, context) { + const coords = convertPoint(datum, context); + this.updateHandle(datum, coords); + this.anchor = this.updateAnchor(datum, coords, context); + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ handle: datum }, context) + }; + } + drag(datum, target, context) { + const { dragState } = this; + if (!datum.isWriteable() || !dragState) + return; + const { point } = translate({ point: dragState.handle }, Vec24.sub(target, dragState.offset), context); + datum.x = point.x; + datum.y = point.y; + } + translate(datum, translation, context) { + if (!datum.isWriteable()) + return; + const { point } = translate({ point: convertPoint(datum, context) }, translation, context); + datum.x = point.x; + datum.y = point.y; + } + toggleHandles(show) { + this.handle.visible = Boolean(show); + this.handle.toggleHovered(this.activeHandle === "handle"); + } + toggleActive(active) { + this.toggleHandles(active); + this.handle.toggleActive(active); + } + stopDragging() { + this.handle.toggleDragging(false); + } + copy(datum, copiedDatum, context) { + const coords = convertPoint(datum, context); + const point = invertCoords({ x: coords.x - 30, y: coords.y - 30 }, context); + copiedDatum.x = point.x; + copiedDatum.y = point.y; + return copiedDatum; + } + getAnchor() { + return this.anchor; + } + getCursor() { + return "pointer"; + } + containsPoint(x, y) { + const { handle: handle22 } = this; + this.activeHandle = void 0; + if (handle22.containsPoint(x, y)) { + this.activeHandle = "handle"; + return true; + } + return false; + } + getNodeAtCoords(x, y) { + if (this.handle.containsPoint(x, y)) + return "handle"; + } + updateHandle(datum, point, bbox) { + const { x, y } = this.getHandleCoords(datum, point, bbox); + const styles = this.getHandleStyles(datum); + this.handle.update({ ...styles, x, y }); + this.handle.toggleLocked(datum.locked ?? false); + } + updateAnchor(datum, point, context) { + const coords = this.getHandleCoords(datum, point); + return { + x: coords.x + context.seriesRect.x, + y: coords.y + context.seriesRect.y, + position: this.anchor.position + }; + } + getHandleCoords(_datum, point, _bbox) { + return { + x: point.x, + y: point.y + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } +}; +var ShapePointScene = class extends PointScene { + constructor() { + super(); + this.append([this.handle]); + } + update(datum, context) { + super.update(datum, context); + const coords = convertPoint(datum, context); + this.updateShape(datum, coords); + } + updateShape(datum, point) { + this.updateShapeStyles(datum); + this.updateShapePath(datum, point); + } + updateShapeStyles(datum) { + const { shape } = this; + shape.fill = datum.fill; + shape.fillOpacity = datum.fillOpacity ?? 1; + } + updateShapePath(datum, point) { + const { shape } = this; + shape.x = point.x; + shape.y = point.y; + shape.size = datum.size; + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.shape.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.shape.containsPoint(x, y)) + return "shape"; + return super.getNodeAtCoords(x, y); + } +}; +var arrowUpPoints = [ + [0.5, 0], + [1, 0.5], + [0.75, 0.5], + [0.75, 1], + [0.25, 1], + [0.25, 0.5], + [0, 0.5] +]; +function arrowUp(params) { + module_support_exports.drawMarkerUnitPolygon(params, arrowUpPoints); +} +arrowUp.anchor = { x: 0.5, y: 0 }; +var ArrowUpScene = class extends ShapePointScene { + constructor() { + super(); + this.type = "arrow-up"; + this.shape = new AnnotationShape({ shape: arrowUp }); + this.append([this.shape]); + } + static is(value) { + return AnnotationScene.isCheck( + value, + "arrow-up" + /* ArrowUp */ + ); + } + getHandleCoords(datum, point) { + const halfSize = DivariantHandle.HANDLE_SIZE / 2; + const handleCoords = super.getHandleCoords(datum, point); + handleCoords.y -= halfSize; + return handleCoords; + } +}; +var arrowDownPoints = arrowUpPoints.map(([x, y]) => [x, 1 - y]); +function arrowDown(params) { + module_support_exports.drawMarkerUnitPolygon(params, arrowDownPoints); +} +arrowDown.anchor = { x: 0.5, y: 1 }; +var ArrowDownScene = class extends ShapePointScene { + constructor() { + super(); + this.type = "arrow-down"; + this.shape = new AnnotationShape({ shape: arrowDown }); + this.append([this.shape]); + } + static is(value) { + return AnnotationScene.isCheck( + value, + "arrow-down" + /* ArrowDown */ + ); + } + updateAnchor(datum, point, context) { + const anchor = super.updateAnchor(datum, point, context); + anchor.y -= datum.size; + return anchor; + } + getHandleCoords(datum, point) { + const halfSize = DivariantHandle.HANDLE_SIZE / 2; + const handleCoords = super.getHandleCoords(datum, point); + handleCoords.y += halfSize; + return handleCoords; + } +}; +var { StateMachine: StateMachine22, StateMachineProperty: StateMachineProperty22, Debug: Debug22 } = module_support_exports; +var PointStateMachine = class extends StateMachine22 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ x: point.x, y: point.y }); + ctx.create(datum); + }; + const actionFirstRender = () => { + this.node?.toggleActive(true); + ctx.showAnnotationOptions(); + ctx.update(); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + cancel: StateMachine22.parent, + reset: StateMachine22.parent + }, + "waiting-first-render": { + render: { + target: StateMachine22.parent, + action: actionFirstRender + } + } + }); + this.debug = Debug22.create(true, "annotations"); + } +}; +__decorateClass2([ + StateMachineProperty22() +], PointStateMachine.prototype, "node", 2); +var ArrowDownStateMachine = class extends PointStateMachine { + createDatum() { + return new ArrowDownProperties(); + } +}; +var arrowDownConfig = { + type: "arrow-down", + datum: ArrowDownProperties, + scene: ArrowDownScene, + isDatum: ArrowDownProperties.is, + translate: (node, datum, translation, context) => { + if (ArrowDownProperties.is(datum) && ArrowDownScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (ArrowDownProperties.is(datum) && ArrowDownProperties.is(copiedDatum) && ArrowDownScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ArrowDownProperties.is(datum) && ArrowDownScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ArrowDownStateMachine({ + ...ctx, + create: createDatum( + "arrow-down" + /* ArrowDown */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var { Property: Property30 } = module_support_exports; +var ArrowUpProperties = class extends ShapePointProperties { + constructor() { + super(...arguments); + this.type = "arrow-up"; + } + static is(value) { + return isObject(value) && value.type === "arrow-up"; + } +}; +__decorateClass2([ + Property30 +], ArrowUpProperties.prototype, "type", 2); +var ArrowUpStateMachine = class extends PointStateMachine { + createDatum() { + return new ArrowUpProperties(); + } +}; +var arrowUpConfig = { + type: "arrow-up", + datum: ArrowUpProperties, + scene: ArrowUpScene, + isDatum: ArrowUpProperties.is, + translate: (node, datum, translation, context) => { + if (ArrowUpProperties.is(datum) && ArrowUpScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (ArrowUpProperties.is(datum) && ArrowUpProperties.is(copiedDatum) && ArrowUpScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ArrowUpProperties.is(datum) && ArrowUpScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ArrowUpStateMachine({ + ...ctx, + create: createDatum( + "arrow-up" + /* ArrowUp */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var { Vec2: Vec25, Vec4: Vec42 } = module_support_exports; +var LinearScene = class extends AnnotationScene { + constructor() { + super(...arguments); + this.overflowContinuous = 0; + } + extendLine({ x1, y1, x2, y2 }, datum, context) { + const linePoints = { x1, y1, x2, y2 }; + if (!datum.extendStart && !datum.extendEnd) { + return linePoints; + } + const [left, right] = boundsIntersections(linePoints, context.yAxis.bounds); + const isFlippedX = linePoints.x2 < linePoints.x1; + const isFlippedY = linePoints.y1 >= linePoints.y2; + const isVertical = linePoints.x2 === linePoints.x1; + if (datum.extendEnd) { + if (isVertical) { + linePoints.y2 = isFlippedY ? right.y : left.y; + } else { + linePoints.x2 = isFlippedX ? left.x : right.x; + linePoints.y2 = isFlippedX ? left.y : right.y; + } + } + if (datum.extendStart) { + if (isVertical) { + linePoints.y1 = isFlippedY ? left.y : right.y; + } else { + linePoints.x1 = isFlippedX ? right.x : left.x; + linePoints.y1 = isFlippedX ? right.y : left.y; + } + } + return linePoints; + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ start: datum.start, end: datum.end }, context) + }; + } + drag(datum, target, context, snapping) { + if (!datum.isWriteable()) + return; + if (this.activeHandle) { + this.dragHandle(datum, target, context, snapping); + } else { + this.dragAll(datum, target, context); + } + } + dragAll(datum, target, context) { + const { dragState } = this; + if (!dragState) + return; + this.translatePoints(datum, dragState.start, dragState.end, Vec25.sub(target, dragState.offset), context); + } + translate(datum, translation, context) { + if (!datum.isWriteable()) + return; + this.translatePoints( + datum, + convertPoint(datum.start, context), + convertPoint(datum.end, context), + translation, + context + ); + } + copy(datum, copiedDatum, context) { + const coords = convertLine(datum, context); + if (!coords) { + return; + } + const bbox = this.computeBBoxWithoutHandles(); + const translation = { x: -bbox.width / 2, y: -bbox.height / 2 }; + this.translatePoints(copiedDatum, Vec42.start(coords), Vec42.end(coords), translation, context); + return copiedDatum; + } + translatePoints(datum, start2, end3, translation, context) { + const vectors = this.getTranslatePointsVectors(start2, end3); + const points = translate(vectors, translation, context, { + overflowContinuous: this.overflowContinuous + }); + datum.start.x = points.start.x; + datum.end.x = points.end.x; + datum.start.y = points.start.y; + datum.end.y = points.end.y; + } + getTranslatePointsVectors(start2, end3) { + return { start: start2, end: end3 }; + } +}; +var { Vec2: Vec26, Vec4: Vec422 } = module_support_exports; +var StartEndScene = class extends LinearScene { + constructor() { + super(...arguments); + this.start = new DivariantHandle(); + this.end = new DivariantHandle(); + this.anchor = { + x: 0, + y: 0, + position: "above" + }; + } + update(datum, context) { + const coords = convertLine(datum, context); + if (coords == null) { + return; + } + this.updateHandles(datum, coords); + this.updateAnchor(datum, coords, context); + } + toggleHandles(show) { + if (typeof show === "boolean") { + this.start.visible = show; + this.end.visible = show; + } else { + for (const [handle22, visible] of entries(show)) { + this[handle22].visible = visible; + } + } + this.start.toggleHovered(this.activeHandle === "start"); + this.end.toggleHovered(this.activeHandle === "end"); + } + toggleActive(active) { + this.toggleHandles(active); + this.start.toggleActive(active); + this.end.toggleActive(active); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, dragState } = this; + if (!activeHandle || !dragState) + return; + this[activeHandle].toggleDragging(true); + const snapHandle = activeHandle === "start" ? "end" : "start"; + const snap = snapping ? { vectors: { [activeHandle]: convertPoint(datum[snapHandle], context) }, angle: datum.snapToAngle } : void 0; + const { [activeHandle]: point } = translate( + { [activeHandle]: dragState[activeHandle] }, + Vec26.sub(target, dragState.offset), + context, + { overflowContinuous: 0, snap } + ); + datum[activeHandle].x = point.x; + datum[activeHandle].y = point.y; + } + stopDragging() { + this.start.toggleDragging(false); + this.end.toggleDragging(false); + } + getAnchor() { + return this.anchor; + } + getCursor() { + return "pointer"; + } + containsPoint(x, y) { + const { start: start2, end: end3 } = this; + this.activeHandle = void 0; + if (start2.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + if (end3.containsPoint(x, y)) { + this.activeHandle = "end"; + return true; + } + return false; + } + getNodeAtCoords(x, y) { + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y)) + return "handle"; + } + updateHandles(datum, coords, bbox) { + this.start.update({ + ...this.getHandleStyles(datum, "start"), + ...this.getHandleCoords(datum, coords, "start") + }); + this.end.update({ + ...this.getHandleStyles(datum, "end"), + ...this.getHandleCoords(datum, coords, "end", bbox) + }); + this.start.toggleLocked(datum.locked ?? false); + this.end.toggleLocked(datum.locked ?? false); + } + updateAnchor(_datum, coords, context, _bbox) { + this.anchor = { + x: coords.x1 + context.seriesRect.x, + y: coords.y1 + context.seriesRect.y, + position: this.anchor.position + }; + } + getHandleCoords(_datum, coords, handle22, _bbox) { + return handle22 === "start" ? Vec422.start(coords) : Vec422.end(coords); + } + getHandleStyles(datum, _handle) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } +}; +var { Vec4: Vec43 } = module_support_exports; +var TextualStartEndScene = class extends StartEndScene { + constructor() { + super(...arguments); + this.label = new module_support_exports.Text({ zIndex: 1 }); + this.anchor = { + x: 0, + y: 0, + position: "above-left" + }; + } + setTextInputBBox(bbox) { + this.textInputBBox = bbox; + this.markDirty("TextualStartEndScene"); + } + update(datum, context) { + const coords = convertLine(datum, context); + if (coords == null) { + return; + } + const bbox = this.getTextBBox(datum, coords); + this.updateLabel(datum, bbox, coords); + this.updateHandles(datum, coords, bbox); + this.updateShape(datum, bbox, coords); + this.updateAnchor(datum, coords, context, bbox); + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.label.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.label.containsPoint(x, y)) + return "text"; + return super.getNodeAtCoords(x, y); + } + getTextBBox(datum, coords) { + const { text: text2 } = datum.getText(); + return getBBox(datum, text2, Vec43.end(coords), this.textInputBBox); + } + updateLabel(datum, bbox, coords) { + const { text: text2, isPlaceholder } = datum.getText(); + updateTextNode(this.label, text2, isPlaceholder, datum, this.getLabelCoords(datum, bbox, coords)); + } + updateShape(_datum, _textBBox, _coords) { + } + getLabelCoords(_datum, _bbox, coords) { + return Vec43.end(coords); + } + getHandleStyles(datum, handle22) { + return { + ...super.getHandleStyles(datum, handle22), + stroke: datum.handle.stroke ?? datum.color + }; + } +}; +var { drawCorner: drawCorner2, Path: Path5 } = module_support_exports; +var CalloutScene = class extends TextualStartEndScene { + constructor() { + super(); + this.type = "callout"; + this.shape = new Path5(); + this.append([this.shape, this.label, this.start, this.end]); + } + static is(value) { + return AnnotationScene.isCheck( + value, + "callout" + /* Callout */ + ); + } + drag(datum, target, context, snapping) { + if (!datum.isWriteable()) + return; + if (this.activeHandle === "end") { + this.dragHandle(datum, target, context, snapping); + } else { + this.dragAll(datum, target, context); + } + } + getLabelCoords(datum, bbox, coords) { + const padding2 = datum.getPadding(); + const { + bodyBounds = { + x: 0, + y: 0, + width: 0, + height: 0 + } + } = this.getDimensions(datum, bbox, coords) ?? {}; + return { + x: bodyBounds.x + padding2.left, + y: bodyBounds.y - padding2.bottom + }; + } + getHandleStyles(datum, handle22) { + return handle22 === "start" ? { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + } : { fill: void 0, strokeWidth: 0 }; + } + updateAnchor(datum, coords, context, bbox) { + const { bodyBounds } = this.getDimensions(datum, bbox, coords) ?? {}; + const bounds = bodyBounds ?? bbox; + this.anchor = { + x: bounds.x + context.seriesRect.x, + y: bounds.y + context.seriesRect.y - bounds.height, + position: this.anchor.position + }; + } + updateShape(datum, textBBox, coords) { + const { shape } = this; + shape.fill = datum.fill; + shape.fillOpacity = datum.fillOpacity ?? 1; + shape.stroke = datum.stroke; + shape.strokeWidth = datum.strokeWidth ?? 1; + shape.strokeOpacity = datum.strokeOpacity ?? 1; + const { tailPoint, bodyBounds } = this.getDimensions(datum, textBBox, coords) ?? {}; + if (!tailPoint || !bodyBounds) { + return; + } + this.updatePath(tailPoint, bodyBounds); + } + updatePath(tailPoint, bodyBounds) { + const { x: tailX, y: tailY } = tailPoint; + const { x, y, width: width2, height: height2 } = bodyBounds; + const top = y - height2; + const right = x + width2; + const placement = this.calculateCalloutPlacement({ x: tailX, y: tailY }, bodyBounds); + const cornerRadius = 8; + const pathParams2 = [ + { + coordinates: { + x0: x, + x1: x + cornerRadius, + y0: top + cornerRadius, + y1: top, + cx: placement === `topLeft` ? tailX : x + cornerRadius, + cy: placement === `topLeft` ? tailY : top + cornerRadius + }, + type: placement === `topLeft` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: x + cornerRadius, + x1: right - cornerRadius, + y0: top, + y1: top, + cx: tailX, + cy: tailY + }, + type: placement === `top` ? "calloutSide" : "side" + }, + { + coordinates: { + x0: right - cornerRadius, + x1: right, + y0: top, + y1: top + cornerRadius, + cx: placement === `topRight` ? tailX : right - cornerRadius, + cy: placement === `topRight` ? tailY : top + cornerRadius + }, + type: placement === `topRight` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: right, + x1: right, + y0: top + cornerRadius, + y1: y - cornerRadius, + cx: tailX, + cy: tailY + }, + type: placement === `right` ? "calloutSide" : "side" + }, + { + coordinates: { + x0: right, + x1: right - cornerRadius, + y0: y - cornerRadius, + y1: y, + cx: placement === `bottomRight` ? tailX : right - cornerRadius, + cy: placement === `bottomRight` ? tailY : y - cornerRadius + }, + type: placement === `bottomRight` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: right - cornerRadius, + x1: x + cornerRadius, + y0: y, + y1: y, + cx: tailX, + cy: tailY + }, + type: placement === `bottom` ? "calloutSide" : "side" + }, + { + coordinates: { + x0: x + cornerRadius, + x1: x, + y0: y, + y1: y - cornerRadius, + cx: placement === `bottomLeft` ? tailX : x + cornerRadius, + cy: placement === `bottomLeft` ? tailY : y - cornerRadius + }, + type: placement === `bottomLeft` ? "calloutCorner" : "corner" + }, + { + coordinates: { + x0: x, + x1: x, + y0: y - cornerRadius, + y1: top + cornerRadius, + cx: tailX, + cy: tailY + }, + type: placement === `left` ? "calloutSide" : "side" + } + ]; + const { path } = this.shape; + path.clear(); + path.moveTo(x, top + cornerRadius); + for (const { coordinates, type } of pathParams2) { + this.drawPath(path, coordinates, cornerRadius, type); + } + path.closePath(); + } + drawPath(path, { x0, y0, x1, y1, cx, cy }, cornerRadius, type) { + const sideTailRadius = 6; + switch (type) { + case "calloutCorner": { + path.lineTo(cx, cy); + path.lineTo(x1, y1); + break; + } + case "corner": { + drawCorner2( + path, + { + x0, + x1, + y0, + y1, + cx, + cy + }, + cornerRadius, + false + ); + break; + } + case "calloutSide": { + if (x0 === x1) { + const direction = y0 > y1 ? -1 : 1; + const midY = Math.min(y0, y1) + Math.abs(y0 - y1) / 2; + path.lineTo(x0, midY - sideTailRadius * direction); + path.lineTo(cx, cy); + path.lineTo(x0, midY + sideTailRadius * direction); + path.lineTo(x1, y1); + } else { + const direction = x0 > x1 ? -1 : 1; + const midX = Math.min(x0, x1) + Math.abs(x1 - x0) / 2; + path.lineTo(midX - sideTailRadius * direction, y0); + path.lineTo(cx, cy); + path.lineTo(midX + sideTailRadius * direction, y0); + path.lineTo(x1, y1); + } + break; + } + case "side": + default: { + path.lineTo(x1, y1); + break; + } + } + } + calculateCalloutPlacement(placement, bounds) { + const right = bounds.x + bounds.width; + const top = bounds.y - bounds.height; + let xPlacement; + let yPlacement; + if (placement.x > right) { + xPlacement = "right"; + } else if (placement.x < bounds.x) { + xPlacement = "left"; + } + if (placement.y > bounds.y) { + yPlacement = "bottom"; + } else if (placement.y < top) { + yPlacement = "top"; + } + if (xPlacement && yPlacement) { + return `${yPlacement}${xPlacement[0].toUpperCase()}${xPlacement.substring(1)}`; + } else { + return yPlacement ?? xPlacement; + } + } + getDimensions(datum, textBBox, coords) { + const { fontSize } = datum; + const padding2 = datum.getPadding(); + const horizontalPadding = padding2.left + padding2.right; + const verticalPadding = padding2.top + padding2.bottom; + const width2 = textBBox.width + horizontalPadding; + const height2 = Math.max(textBBox.height + verticalPadding, fontSize + verticalPadding); + return { + tailPoint: { + x: coords.x1, + y: coords.y1 + }, + bodyBounds: { + x: textBBox.x, + y: textBBox.y, + width: width2, + height: height2 + } + }; + } + containsPoint(x, y) { + const { start: start2, end: end3, shape } = this; + this.activeHandle = void 0; + if (start2.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + const bodyContainsPoint = end3.containsPoint(x, y) || shape.containsPoint(x, y); + if (bodyContainsPoint) { + this.activeHandle = "end"; + } + return bodyContainsPoint; + } +}; +function guardCancelAndExit({ key }) { + return key === "Escape"; +} +function guardSaveAndExit({ key, shiftKey }) { + return !shiftKey && key === "Enter"; +} +var { StateMachine: StateMachine3, StateMachineProperty: StateMachineProperty3, Debug: Debug3 } = module_support_exports; +var TextualStartEndStateMachine = class extends StateMachine3 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point, visible: true }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ start: true }); + }; + const onStartEditing = () => { + ctx.showTextInput(); + if (this.datum) + this.datum.visible = false; + }; + const onStopEditing = () => { + ctx.hideTextInput(); + if (this.datum) + this.datum.visible = true; + ctx.deselect(); + }; + const actionUpdateTextInputBBox = (bbox) => { + this.node?.setTextInputBBox(bbox); + ctx.update(); + }; + const onEndHover = ({ point }) => { + const { datum, node } = this; + datum?.set({ end: point }); + node?.toggleActive(true); + node?.toggleHandles({ end: false }); + ctx.update(); + }; + const onEndClick = () => { + ctx.showAnnotationOptions(); + this.node?.toggleHandles({ end: true }); + }; + const actionColor = ({ + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }) => { + const { datum } = this; + if (!datum) + return; + if (colorPickerType === "text-color") { + ctx.updateTextInputColor(color6); + } + setColor(datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + ctx.update(); + }; + const actionFontSize = (fontSize) => { + const { datum, node } = this; + if (!datum || !node || !isTextType(datum)) + return; + datum.fontSize = fontSize; + ctx.updateTextInputFontSize(fontSize); + ctx.update(); + }; + const actionCancel = () => { + ctx.delete(); + }; + const actionSave = ({ textInputValue, bbox }) => { + const { datum } = this; + if (bbox != null && textInputValue != null && textInputValue.length > 0) { + if (!isTextType(datum)) { + return; + } + const wrappedText = maybeWrapText(datum, textInputValue, bbox.width); + datum?.set({ text: wrappedText }); + ctx.update(); + ctx.recordAction(`Create ${datum?.type} annotation`); + } else { + ctx.delete(); + } + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + dragStart: { + target: "waiting-first-render", + action: actionCreate + }, + cancel: StateMachine3.parent, + reset: StateMachine3.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: onEndHover, + drag: onEndHover, + click: { + target: "edit", + action: onEndClick + }, + dragEnd: { + target: "edit", + action: onEndClick + }, + reset: { + target: StateMachine3.parent, + action: actionCancel + }, + cancel: { + target: StateMachine3.parent, + action: actionCancel + } + }, + edit: { + onEnter: onStartEditing, + updateTextInputBBox: actionUpdateTextInputBBox, + color: actionColor, + fontSize: actionFontSize, + textInput: [ + { + guard: guardCancelAndExit, + target: StateMachine3.parent, + action: actionCancel + }, + { + guard: guardSaveAndExit, + target: StateMachine3.parent, + action: actionSave + } + ], + click: { + target: StateMachine3.parent, + action: actionSave + }, + dragStart: { + target: StateMachine3.parent, + action: actionSave + }, + resize: { + target: StateMachine3.parent, + action: actionSave + }, + onExit: onStopEditing, + cancel: { + target: StateMachine3.parent, + action: actionCancel + } + } + }); + this.debug = Debug3.create(true, "annotations"); + } +}; +__decorateClass2([ + StateMachineProperty3() +], TextualStartEndStateMachine.prototype, "datum", 2); +__decorateClass2([ + StateMachineProperty3() +], TextualStartEndStateMachine.prototype, "node", 2); +var CalloutStateMachine = class extends TextualStartEndStateMachine { + createDatum() { + return new CalloutProperties(); + } +}; +var calloutConfig = { + type: "callout", + datum: CalloutProperties, + scene: CalloutScene, + isDatum: CalloutProperties.is, + translate: (node, datum, transition, context) => { + if (CalloutProperties.is(datum) && CalloutScene.is(node)) + return node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (CalloutProperties.is(datum) && CalloutProperties.is(copiedDatum) && CalloutScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (CalloutProperties.is(datum) && CalloutScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CalloutStateMachine({ + ...ctx, + create: createDatum( + "callout" + /* Callout */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var TextualPointScene = class extends PointScene { + constructor() { + super(...arguments); + this.label = new module_support_exports.Text({ zIndex: 1 }); + this.anchor = { + x: 0, + y: 0, + position: "above-left" + }; + } + setTextInputBBox(bbox) { + this.textInputBBox = bbox; + this.markDirty("TextualPointScene"); + } + update(datum, context) { + const coords = convertPoint(datum, context); + const bbox = this.getTextBBox(datum, coords, context); + this.updateLabel(datum, bbox); + this.updateHandle(datum, coords, bbox); + this.updateShape(datum, bbox); + this.anchor = this.updateAnchor(datum, bbox, context); + } + copy(datum, copiedDatum, context) { + const coords = convertPoint(datum, context); + const bbox = this.getTextBBox(datum, coords, context); + const padding2 = datum.getPadding(); + const horizontalPadding = padding2.left + padding2.right; + const verticalPadding = padding2.top + padding2.bottom; + const xOffset = (bbox.width + horizontalPadding) / 2; + const yOffset = bbox.height + verticalPadding; + const point = invertCoords({ x: coords.x - xOffset, y: coords.y - yOffset }, context); + copiedDatum.x = point.x; + copiedDatum.y = point.y; + return copiedDatum; + } + containsPoint(x, y) { + const { label } = this; + return super.containsPoint(x, y) || label.visible && label.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.label.visible && this.label.containsPoint(x, y)) + return "text"; + return super.getNodeAtCoords(x, y); + } + getTextBBox(datum, coords, _context) { + const { text: text2 } = datum.getText(); + return getBBox(datum, text2, { x: coords.x, y: coords.y }, this.textInputBBox); + } + updateLabel(datum, bbox) { + const { text: text2, isPlaceholder } = datum.getText(); + updateTextNode( + this.label, + text2, + isPlaceholder, + datum, + this.getLabelCoords(datum, bbox), + this.getTextBaseline(datum) + ); + } + updateShape(_datum, _bbox) { + } + updateAnchor(_datum, bbox, context) { + return { + x: bbox.x + context.seriesRect.x, + y: bbox.y + context.seriesRect.y - bbox.height, + position: this.anchor.position + }; + } + getLabelCoords(_datum, bbox) { + return bbox; + } + getTextBaseline(datum) { + return datum.position == "center" ? "middle" : datum.position; + } + getHandleCoords(_datum, _coords, bbox) { + return bbox; + } + getHandleStyles(datum) { + const styles = super.getHandleStyles(datum); + styles.stroke = datum.handle.stroke ?? datum.color; + return styles; + } +}; +var { drawCorner: drawCorner22 } = module_support_exports; +var CommentScene = class extends TextualPointScene { + constructor() { + super(); + this.type = "comment"; + this.shape = new module_support_exports.Path(); + this.append([this.shape, this.label, this.handle]); + } + static is(value) { + return AnnotationScene.isCheck( + value, + "comment" + /* Comment */ + ); + } + updateShape(datum, bbox) { + const { shape } = this; + shape.fill = datum.fill; + shape.fillOpacity = datum.fillOpacity ?? 1; + shape.stroke = datum.stroke ?? "transparent"; + shape.strokeWidth = datum.strokeWidth ?? 1; + shape.strokeOpacity = datum.strokeOpacity ?? 1; + this.updatePath(datum, bbox); + } + getLabelCoords(datum, point) { + const padding2 = datum.getPadding(); + return { + x: point.x + padding2.left, + y: point.y - padding2.bottom + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke ?? datum.fill, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } + updateAnchor(datum, bbox, context) { + const anchor = super.updateAnchor(datum, bbox, context); + const padding2 = datum.getPadding(); + anchor.y -= padding2.bottom + padding2.top; + return anchor; + } + updatePath(datum, bbox) { + const padding2 = datum.getPadding(); + const { x, y } = bbox; + let { width: width2, height: height2 } = bbox; + const { fontSize } = datum; + const horizontalPadding = padding2.left + padding2.right; + const verticalPadding = padding2.top + padding2.bottom; + width2 = width2 + horizontalPadding; + height2 = Math.max(height2 + verticalPadding, fontSize + verticalPadding); + const top = y - height2; + const right = x + width2; + const cornerRadius = (calcLineHeight(fontSize, ANNOTATION_TEXT_LINE_HEIGHT) + verticalPadding) / 2; + const { path } = this.shape; + path.clear(); + path.moveTo(x, y); + path.lineTo(x, top + cornerRadius); + drawCorner22( + path, + { + x0: x, + x1: x + cornerRadius, + y0: top + cornerRadius, + y1: top, + cx: x + cornerRadius, + cy: top + cornerRadius + }, + cornerRadius, + false + ); + path.lineTo(right - cornerRadius, top); + drawCorner22( + path, + { + x0: right - cornerRadius, + x1: right, + y0: top, + y1: top + cornerRadius, + cx: right - cornerRadius, + cy: top + cornerRadius + }, + cornerRadius, + false + ); + path.lineTo(right, y - cornerRadius); + drawCorner22( + path, + { + x0: right, + x1: right - cornerRadius, + y0: y - cornerRadius, + y1: y, + cx: right - cornerRadius, + cy: y - cornerRadius + }, + cornerRadius, + false + ); + path.closePath(); + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.shape.containsPoint(x, y); + } +}; +var { StateMachine: StateMachine4, StateMachineProperty: StateMachineProperty4, Debug: Debug4 } = module_support_exports; +var TextualPointStateMachine = class extends StateMachine4 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ x: point.x, y: point.y }); + ctx.create(datum); + }; + const actionFirstRender = () => { + this.node?.toggleActive(true); + ctx.showAnnotationOptions(); + ctx.update(); + }; + const onStartEditing = () => { + ctx.showTextInput(); + if (this.datum) { + this.datum.visible = false; + } + }; + const onStopEditing = () => { + ctx.hideTextInput(); + if (this.datum) + this.datum.visible = true; + ctx.deselect(); + }; + const actionUpdateTextInputBBox = (bbox) => { + this.node?.setTextInputBBox(bbox); + ctx.update(); + }; + const actionColor = ({ + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }) => { + if (!this.datum) + return; + if (colorPickerType === "text-color") { + ctx.updateTextInputColor(color6); + } + setColor(this.datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + ctx.update(); + }; + const actionFontSize = (fontSize) => { + const { datum, node } = this; + if (!datum || !node || !isTextType(datum)) + return; + datum.fontSize = fontSize; + ctx.updateTextInputFontSize(fontSize); + ctx.update(); + }; + const actionCancel = () => { + ctx.delete(); + }; + const actionSave = ({ textInputValue, bbox }) => { + if (bbox != null && textInputValue != null && textInputValue.length > 0) { + const { datum } = this; + if (!isTextType(datum)) { + return; + } + const wrappedText = maybeWrapText(datum, textInputValue, bbox.width); + datum?.set({ text: wrappedText }); + ctx.update(); + ctx.recordAction(`Create ${datum?.type} annotation`); + } else { + ctx.delete(); + } + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + dragStart: { + target: "waiting-first-render", + action: actionCreate + }, + cancel: StateMachine4.parent, + reset: StateMachine4.parent + }, + "waiting-first-render": { + render: { + target: "edit", + action: actionFirstRender + } + }, + edit: { + onEnter: onStartEditing, + updateTextInputBBox: actionUpdateTextInputBBox, + color: actionColor, + fontSize: actionFontSize, + textInput: [ + { + guard: guardCancelAndExit, + target: StateMachine4.parent, + action: actionCancel + }, + { + guard: guardSaveAndExit, + target: StateMachine4.parent, + action: actionSave + } + ], + click: { + target: StateMachine4.parent, + action: actionSave + }, + dragStart: { + target: StateMachine4.parent, + action: actionSave + }, + resize: { + target: StateMachine4.parent, + action: actionSave + }, + onExit: onStopEditing, + cancel: { + target: StateMachine4.parent, + action: actionCancel + } + } + }); + this.debug = Debug4.create(true, "annotations"); + } +}; +__decorateClass2([ + StateMachineProperty4() +], TextualPointStateMachine.prototype, "datum", 2); +__decorateClass2([ + StateMachineProperty4() +], TextualPointStateMachine.prototype, "node", 2); +var CommentStateMachine = class extends TextualPointStateMachine { + createDatum() { + return new CommentProperties(); + } +}; +var commentConfig = { + type: "comment", + datum: CommentProperties, + scene: CommentScene, + isDatum: CommentProperties.is, + translate: (node, datum, translation, context) => { + if (CommentProperties.is(datum) && CommentScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (CommentProperties.is(datum) && CommentProperties.is(copiedDatum) && CommentScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (CommentProperties.is(datum) && CommentScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CommentStateMachine({ + ...ctx, + create: createDatum( + "comment" + /* Comment */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var { calculateLabelTranslation: calculateLabelTranslation2 } = module_support_exports; +var AxisLabelScene = class extends module_support_exports.Group { + constructor() { + super({ name: "AnnotationAxisLabelGroup" }); + this.label = new module_support_exports.Text({ zIndex: 1 }); + this.rect = new module_support_exports.Rect(); + const { label } = this; + label.fontSize = 12; + label.fontFamily = "Verdana, sans-serif"; + label.fill = "black"; + label.textBaseline = "middle"; + label.textAlign = "center"; + this.append([this.rect, this.label]); + } + update(opts) { + this.updateLabel(opts); + this.updateRect(opts); + this.updatePosition(opts); + } + updateLabel({ value, styles, context }) { + const { fontWeight, fontSize, fontStyle, fontFamily, textAlign, color: color6 = "white", formatter: formatter2 } = styles; + const text2 = formatter2 ? formatter2({ value }) : context.formatScaleValue(value, "annotation-label"); + this.label.setProperties({ + fontWeight, + fontSize, + fontStyle, + fontFamily, + textAlign, + fill: color6, + text: text2 + }); + } + updateRect({ styles }) { + const { rect: rect2 } = this; + const { cornerRadius, fill, fillOpacity, stroke: stroke22, strokeOpacity } = styles; + rect2.fill = fill; + rect2.fillOpacity = fillOpacity ?? 1; + rect2.stroke = stroke22; + rect2.strokeOpacity = strokeOpacity ?? 1; + rect2.cornerRadius = cornerRadius ?? 0; + } + updatePosition({ x, y, context, styles: { padding: padding2 } }) { + const { label, rect: rect2 } = this; + const labelBBox = label.getBBox()?.clone(); + const horizontalPadding = padding2 ?? 8; + const verticalPadding = padding2 ?? 4; + const { xTranslation, yTranslation } = calculateLabelTranslation2({ + yDirection: true, + padding: context.labelPadding, + position: context.position ?? "left", + bbox: labelBBox + }); + labelBBox.grow(horizontalPadding, "horizontal"); + labelBBox.grow(verticalPadding, "vertical"); + const translationX = x + xTranslation; + const translationY = y + yTranslation; + label.x = translationX; + label.y = translationY; + rect2.y = translationY - Math.round(labelBBox.height / 2); + rect2.x = translationX - Math.round(labelBBox.width / 2); + rect2.height = labelBBox.height; + rect2.width = labelBBox.width; + } +}; +AxisLabelScene.className = "AxisLabel"; +var { Vec2: Vec27 } = module_support_exports; +var CollidableLine = class extends module_support_exports.Line { + constructor() { + super(...arguments); + this.growCollisionBox = 9; + this.clipMask = /* @__PURE__ */ new Map(); + } + setProperties(styles) { + super.setProperties(styles); + this.updateCollisionBBox(); + return this; + } + updateCollisionBBox() { + const { growCollisionBox, strokeWidth, x1, y1, x2, y2 } = this; + let height2 = strokeWidth + growCollisionBox; + if (height2 % 2 === 0) + height2 += 1; + const topLeft = Vec27.from(x1, y1 - Math.floor(height2 / 2)); + const bottomRight = Vec27.from(x2, y2); + const width2 = Vec27.distance(topLeft, bottomRight); + this.collisionBBox = new module_support_exports.BBox(topLeft.x, topLeft.y, width2, height2); + } + isPointInPath(pointX, pointY) { + const { collisionBBox, x1, y1, x2, y2 } = this; + if (!collisionBBox) + return false; + const v1 = Vec27.from(x1, y1); + const v2 = Vec27.from(x2, y2); + const point = Vec27.sub(Vec27.from(pointX, pointY), v1); + const end3 = Vec27.sub(v2, v1); + const rotated = Vec27.rotate(point, Vec27.angle(point, end3), v1); + return collisionBBox.containsPoint(rotated.x, rotated.y) ?? false; + } + render(renderCtx) { + const { clipMask } = this; + const { ctx } = renderCtx; + if (clipMask.size === 0) { + super.render(renderCtx); + return; + } + ctx.save(); + try { + for (const mask of this.clipMask.values()) { + const { x, y, radius } = mask; + ctx.beginPath(); + ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height); + ctx.ellipse(x, y, radius, radius, 0, Math.PI * 2, 0, true); + ctx.clip(); + } + super.render(renderCtx); + } finally { + ctx.restore(); + } + } + setClipMask(id, mask) { + const cm = this.clipMask.get(id); + if (module_support_exports.jsonDiff(cm, mask) != null) { + this.markDirty("CollidableLine"); + } + if (mask) { + this.clipMask.set(id, mask); + } else { + this.clipMask.delete(id); + } + } +}; +var CollidableText = class extends module_support_exports.TransformableText { + constructor() { + super(...arguments); + this.growCollisionBox = { + top: 4, + right: 4, + bottom: 4, + left: 4 + }; + } + isPointInPath(pointX, pointY) { + const localPoint = this.fromParentPoint(pointX, pointY); + const uBBox = this.computeBBoxWithoutTransforms(); + if (!uBBox) + return false; + return uBBox.grow(this.growCollisionBox).containsPoint(localPoint.x, localPoint.y); + } +}; +var { Vec2: Vec28 } = module_support_exports; +function updateLineText(id, line, coords, textProperties, textNode, text2, lineWidth) { + if (!text2 || !textNode || !textProperties) { + line.setClipMask(id); + return; + } + const { alignment, position } = textProperties; + const numbers = getNumbers(coords, textProperties.fontSize, lineWidth); + const { point, textBaseline } = positionAndAlignment(numbers, position, alignment); + setProperties(textNode, text2, textProperties, point, numbers.angle, textBaseline); + const { x, y, width: width2, height: height2 } = textNode.getBBox(); + const diameter = Vec28.length(Vec28.from(width2, height2)); + const clipMask = { + x: x + width2 / 2, + y: y + height2 / 2, + radius: diameter / 2 + Vec28.length(numbers.offset) + }; + if (position === "center") { + line.setClipMask(id, clipMask); + } else { + line.setClipMask(id); + } + return { clipMask, numbers }; +} +function updateChannelText(offsetInsideTextLabel, top, bottom, textProperties, lineWidth, textNode, text2) { + if (!text2 || !textNode) + return; + const { alignment, position } = textProperties; + const [actualTop, actualBottom] = top.y1 <= bottom.y1 ? [top, bottom] : [bottom, top]; + let relativeLine = actualTop; + if (position === "bottom") { + relativeLine = actualBottom; + } else if (position === "inside") { + relativeLine = { + x1: (actualTop.x1 + actualBottom.x1) / 2, + y1: (actualTop.y1 + actualBottom.y1) / 2, + x2: (actualTop.x2 + actualBottom.x2) / 2, + y2: (actualTop.y2 + actualBottom.y2) / 2 + }; + } + const numbers = getNumbers(relativeLine, textProperties.fontSize, lineWidth); + const { point, textBaseline } = positionAndAlignment( + numbers, + position === "inside" ? "center" : position, + alignment, + offsetInsideTextLabel + ); + setProperties(textNode, text2, textProperties, point, numbers.angle, textBaseline); +} +function getNumbers(coords, fontSize, strokeWidth) { + let [left, right] = Vec28.from(coords); + if (left.x > right.x) + [left, right] = [right, left]; + const normal = Vec28.normalized(Vec28.sub(right, left)); + const angle2 = Vec28.angle(normal); + const inset = Vec28.multiply(normal, DivariantHandle.HANDLE_SIZE / 2 + (fontSize ?? 14) / 2); + const offset = Vec28.multiply(normal, (strokeWidth ?? 2) / 2 + (fontSize ?? 14) / 3); + return { left, right, normal, angle: angle2, inset, offset }; +} +function positionAndAlignment({ left, right, normal, angle: angle2, inset, offset }, position, alignment, offsetInsideTextLabel) { + let point; + if (alignment === "right") { + point = Vec28.sub(right, inset); + } else if (alignment === "center") { + point = Vec28.add(left, Vec28.multiply(normal, Vec28.distance(left, right) / 2)); + } else { + point = Vec28.add(left, inset); + } + let textBaseline = "bottom"; + if (position === "bottom") { + point = Vec28.rotate(offset, angle2 + Math.PI / 2, point); + textBaseline = "top"; + } else if (position === "center" && !offsetInsideTextLabel) { + textBaseline = "middle"; + } else { + point = Vec28.rotate(offset, angle2 - Math.PI / 2, point); + } + return { point, textBaseline }; +} +function setProperties(scene, text2, textProperties, point, angle2, textBaseline) { + scene.setProperties({ + text: text2, + x: point.x, + y: point.y, + rotation: angle2, + rotationCenterX: point.x, + rotationCenterY: point.y, + fill: textProperties.color, + fontFamily: textProperties.fontFamily, + fontSize: textProperties.fontSize, + fontStyle: textProperties.fontStyle, + fontWeight: textProperties.fontWeight, + textAlign: textProperties.alignment, + textBaseline + }); +} +var { ChartAxisDirection: ChartAxisDirection6, Vec2: Vec29, Vec4: Vec44 } = module_support_exports; +var CrossLineScene = class extends AnnotationScene { + constructor() { + super(); + this.type = "cross-line"; + this.line = new CollidableLine(); + this.middle = new UnivariantHandle(); + this.isHorizontal = false; + this.append([this.line, this.middle]); + } + static is(value) { + return AnnotationScene.isCheck(value, "cross-line"); + } + update(datum, context) { + const { seriesRect } = context; + this.seriesRect = seriesRect; + this.isHorizontal = HorizontalLineProperties.is(datum); + const axisContext = this.isHorizontal ? context.yAxis : context.xAxis; + const coords = this.convertCrossLine(datum, axisContext); + if (coords == null) { + this.visible = false; + return; + } + this.visible = datum.visible ?? true; + if (!this.visible) + return; + this.updateLine(datum, coords); + this.updateHandle(datum, coords); + this.updateText(datum, coords); + this.updateAxisLabel(datum, axisContext, coords); + } + updateLine(datum, coords) { + const { line } = this; + const { lineDashOffset, stroke: stroke22, strokeWidth, strokeOpacity } = datum; + const { x1, y1, x2, y2 } = coords; + line.setProperties({ + x1, + y1, + x2, + y2, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke22, + strokeWidth, + strokeOpacity, + fillOpacity: 0 + }); + } + updateHandle(datum, coords) { + const { middle } = this; + const { locked, stroke: stroke22, strokeWidth, strokeOpacity } = datum; + const handleStyles = { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? stroke22, + strokeOpacity: datum.handle.strokeOpacity ?? strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? strokeWidth + }; + const handlePosition = Vec29.sub( + Vec44.center(coords), + Vec29.from(middle.handle.width / 2, middle.handle.height / 2) + ); + middle.gradient = this.isHorizontal ? "horizontal" : "vertical"; + middle.update({ ...handleStyles, ...handlePosition }); + middle.toggleLocked(locked ?? false); + } + updateText(datum, coords) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateLineText(this.line.id, this.line, coords, datum.text, this.text, datum.text.label, datum.strokeWidth); + } + createAxisLabel(context) { + const axisLabel22 = new AxisLabelScene(); + context.attachLabel(axisLabel22); + return axisLabel22; + } + updateAxisLabel(datum, axisContext, coords) { + this.axisLabel ?? (this.axisLabel = this.createAxisLabel(axisContext)); + const { axisLabel: axisLabel22, seriesRect } = this; + const { direction, position } = axisContext; + if (datum.axisLabel.enabled) { + axisLabel22.visible = this.visible; + const labelCorner = position === "left" || position === "top" ? Vec44.start(coords) : Vec44.end(coords); + const labelPosition = direction === ChartAxisDirection6.X ? labelCorner.x : labelCorner.y; + if (!axisContext.inRange(labelPosition)) { + axisLabel22.visible = false; + return; + } + const value = getGroupingValue(datum.value); + axisLabel22.update({ + ...Vec29.add(labelCorner, Vec29.required(seriesRect)), + value, + styles: datum.axisLabel, + context: axisContext + }); + } else { + axisLabel22.visible = false; + } + } + setAxisLabelOpacity(opacity) { + if (!this.axisLabel) + return; + this.axisLabel.opacity = opacity; + } + setAxisLabelVisible(visible) { + if (!this.axisLabel) + return; + this.axisLabel.visible = visible; + } + toggleHandles(show) { + this.middle.visible = show; + this.middle.toggleHovered(this.activeHandle === "middle"); + } + destroy() { + super.destroy(); + this.axisLabel?.destroy(); + } + toggleActive(active) { + this.toggleHandles(active); + this.middle.toggleActive(active); + } + dragStart(datum, target, context) { + const middle = HorizontalLineProperties.is(datum) ? { x: target.x, y: convert(datum.value, context.yAxis) } : { x: convert(datum.value, context.xAxis), y: target.y }; + this.dragState = { + offset: target, + middle + }; + } + drag(datum, target, context) { + const { activeHandle, dragState } = this; + if (!datum.isWriteable() || !dragState) + return; + if (activeHandle) { + this[activeHandle].toggleDragging(true); + } + this.translatePoint(datum, dragState.middle, Vec29.sub(target, dragState.offset), context); + } + translate(datum, translation, context) { + if (!datum.isWriteable()) + return; + const vector = HorizontalLineProperties.is(datum) ? Vec29.from(0, convert(datum.value, context.yAxis)) : Vec29.from(convert(datum.value, context.xAxis), 0); + this.translatePoint(datum, vector, translation, context); + } + translatePoint(datum, value, translation, context) { + const isHorizontal2 = HorizontalLineProperties.is(datum); + if (isHorizontal2) { + translation.x = 0; + } else { + translation.y = 0; + } + const { point } = translate({ point: value }, translation, context); + datum.value = isHorizontal2 ? point.y : point.x; + } + stopDragging() { + this.middle.toggleDragging(false); + } + copy(datum, copiedDatum, context) { + const isHorizontal2 = HorizontalLineProperties.is(datum); + const axisContext = this.isHorizontal ? context.yAxis : context.xAxis; + const coords = this.convertCrossLine(datum, axisContext); + if (!coords) { + return; + } + const yOffset = isHorizontal2 ? -30 : 0; + const xOffset = isHorizontal2 ? 0 : -30; + const point = invertCoords({ x: coords.x1 + xOffset, y: coords.y1 + yOffset }, context); + copiedDatum.set({ value: isHorizontal2 ? point.y : point.x }); + return copiedDatum; + } + getCursor() { + if (this.activeHandle == null) + return "pointer"; + return this[this.activeHandle].getCursor(); + } + containsPoint(x, y) { + const { middle, line, text: text2 } = this; + this.activeHandle = void 0; + if (middle.containsPoint(x, y)) { + this.activeHandle = "middle"; + return true; + } + return line.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.line.isPointInPath(x, y)) + return "line"; + if (this.middle.containsPoint(x, y)) + return "handle"; + } + getAnchor() { + const bbox = this.computeBBoxWithoutHandles(); + if (this.isHorizontal) { + return { x: bbox.x + bbox.width / 2, y: bbox.y }; + } + return { x: bbox.x + bbox.width, y: bbox.y + bbox.height / 2, position: "right" }; + } + convertCrossLine(datum, context) { + if (datum.value == null) + return; + let x1 = 0; + let y1 = 0; + let x2, y2; + const { bounds } = context; + const scaledValue = convert(datum.value, context); + if (HorizontalLineProperties.is(datum)) { + x2 = bounds.width; + y1 = scaledValue; + y2 = scaledValue; + } else { + x1 = scaledValue; + x2 = scaledValue; + y2 = bounds.height; + } + return { x1, y1, x2, y2 }; + } +}; +var { StateMachine: StateMachine5, StateMachineProperty: StateMachineProperty5, Debug: Debug5 } = module_support_exports; +var CrossLineStateMachine = class extends StateMachine5 { + constructor(direction, ctx) { + const onClick = ({ point }) => { + const isHorizontal2 = direction === "horizontal"; + const datum = isHorizontal2 ? new HorizontalLineProperties() : new VerticalLineProperties(); + datum.set({ value: isHorizontal2 ? point.y : point.x }); + ctx.create(datum); + ctx.recordAction( + `Create ${isHorizontal2 ? "horizontal-line" : "vertical-line"} annotation` + ); + }; + const actionFirstRender = () => { + this.node?.toggleActive(true); + ctx.showAnnotationOptions(); + ctx.update(); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: onClick + }, + drag: { + target: "waiting-first-render", + action: onClick + }, + reset: StateMachine5.parent, + cancel: StateMachine5.parent + }, + "waiting-first-render": { + render: { + target: StateMachine5.parent, + action: actionFirstRender + } + } + }); + this.debug = Debug5.create(true, "annotations"); + } +}; +__decorateClass2([ + StateMachineProperty5() +], CrossLineStateMachine.prototype, "node", 2); +var horizontalLineConfig = { + type: "horizontal-line", + datum: HorizontalLineProperties, + scene: CrossLineScene, + isDatum: HorizontalLineProperties.is, + translate: (node, datum, translation, context) => { + if (HorizontalLineProperties.is(datum) && CrossLineScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (HorizontalLineProperties.is(datum) && HorizontalLineProperties.is(copiedDatum) && CrossLineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (HorizontalLineProperties.is(datum) && CrossLineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CrossLineStateMachine("horizontal", { + ...ctx, + create: createDatum( + "horizontal-line" + /* HorizontalLine */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var verticalLineConfig = { + type: "vertical-line", + datum: VerticalLineProperties, + scene: CrossLineScene, + isDatum: VerticalLineProperties.is, + translate: (node, datum, translation, context) => { + if (VerticalLineProperties.is(datum) && CrossLineScene.is(node)) + node.translate(datum, translation, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (VerticalLineProperties.is(datum) && VerticalLineProperties.is(copiedDatum) && CrossLineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (VerticalLineProperties.is(datum) && CrossLineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new CrossLineStateMachine("vertical", { + ...ctx, + create: createDatum( + "vertical-line" + /* VerticalLine */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var { Vec4: Vec45 } = module_support_exports; +var WithBackgroundScene = class { + static updateBackground(datum, top, bottom, context) { + const { background } = this; + const { seriesRect } = context; + background.path.clear(true); + const bounds = Vec45.from(0, 0, seriesRect.width, seriesRect.height); + const points = this.getBackgroundPoints(datum, top, bottom, bounds); + for (let i = 0; i < points.length; i++) { + const point = points[i]; + if (i === 0) { + background.path.moveTo(point.x, point.y); + } else { + background.path.lineTo(point.x, point.y); + } + } + background.path.closePath(); + background.checkPathDirty(); + const backgroundStyles = this.getBackgroundStyles?.(datum) ?? datum.background; + background.fill = backgroundStyles.fill; + background.fillOpacity = backgroundStyles.fillOpacity ?? 1; + } +}; +var ChannelScene = class extends LinearScene { + constructor() { + super(...arguments); + this.handles = {}; + this.overflowContinuous = 2; + this.topLine = new CollidableLine(); + this.bottomLine = new CollidableLine(); + this.background = new module_support_exports.Path({ zIndex: -1 }); + this.anchor = { x: 0, y: 0 }; + this.updateBackground = WithBackgroundScene.updateBackground.bind(this); + } + update(datum, context) { + const { locked, visible } = datum; + const top = convertLine(datum, context); + const bottom = convertLine(datum.bottom, context); + if (top == null || bottom == null) { + this.visible = false; + return; + } else { + this.visible = visible ?? true; + } + const topLine = this.extendLine(top, datum, context); + const bottomLine = this.extendLine(bottom, datum, context); + this.updateLines(datum, topLine, bottomLine, context, top, bottom); + this.updateHandles(datum, top, bottom); + this.updateText(datum, top, bottom); + this.updateBackground(datum, topLine, bottomLine, context); + this.updateAnchor(top, bottom); + for (const handle22 of Object.values(this.handles)) { + handle22.toggleLocked(locked ?? false); + } + } + toggleHandles(show) { + const { handles } = this; + if (typeof show === "boolean") { + for (const [handle22, node] of Object.entries(handles)) { + node.visible = show; + node.toggleHovered(this.activeHandle === handle22); + } + return; + } + for (const [handle22, visible] of Object.entries(show)) { + const node = handles[handle22]; + node.visible = visible ?? true; + node.toggleHovered(this.activeHandle === handle22); + } + } + toggleActive(active) { + this.toggleHandles(active); + for (const node of Object.values(this.handles)) { + node.toggleActive(active); + } + } + stopDragging() { + const { activeHandle, handles } = this; + if (activeHandle == null) + return; + handles[activeHandle].toggleDragging(false); + } + getAnchor() { + return this.anchor; + } + getCursor() { + if (this.activeHandle == null) + return "pointer"; + return this.handles[this.activeHandle].getCursor(); + } + containsPoint(x, y) { + const { handles, topLine, bottomLine, text: text2 } = this; + this.activeHandle = void 0; + for (const [handle22, child] of Object.entries(handles)) { + if (child.containsPoint(x, y)) { + this.activeHandle = handle22; + return true; + } + } + return topLine.containsPoint(x, y) || bottomLine.containsPoint(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.topLine.containsPoint(x, y) || this.bottomLine.containsPoint(x, y)) + return "line"; + for (const [, child] of Object.entries(this.handles)) { + if (child.containsPoint(x, y)) + return "handle"; + } + } + updateAnchor(top, bottom) { + const { x, y } = module_support_exports.Transformable.toCanvasPoint( + this.topLine, + (top.x1 + top.x2) / 2, + Math.min(top.y1, top.y2, bottom.y1, bottom.y2) + ); + this.anchor.x = x; + this.anchor.y = y; + } +}; +var { Vec2: Vec210, Vec4: Vec46 } = module_support_exports; +var DisjointChannelScene = class extends ChannelScene { + constructor() { + super(); + this.type = "disjoint-channel"; + this.handles = { + topLeft: new DivariantHandle(), + topRight: new DivariantHandle(), + bottomLeft: new DivariantHandle(), + bottomRight: new UnivariantHandle() + }; + this.append([this.background, this.topLine, this.bottomLine, ...Object.values(this.handles)]); + } + static is(value) { + return AnnotationScene.isCheck(value, "disjoint-channel"); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, handles } = this; + if (activeHandle == null) + return; + const { offset } = handles[activeHandle].drag(target); + handles[activeHandle].toggleDragging(true); + if (activeHandle === "bottomRight") { + offset.x = 0; + } + let translateVectors = []; + let invertYVectors = []; + let allowSnapping = snapping; + switch (activeHandle) { + case "topLeft": + translateVectors = ["topLeft"]; + invertYVectors = ["bottomLeft"]; + break; + case "bottomLeft": + translateVectors = ["bottomLeft"]; + invertYVectors = ["topLeft"]; + break; + case "topRight": + translateVectors = ["topRight"]; + invertYVectors = ["bottomRight"]; + break; + case "bottomRight": + translateVectors = ["bottomLeft", "bottomRight"]; + allowSnapping = false; + break; + } + const top = convertLine(datum, context); + const bottom = convertLine(datum.bottom, context); + if (!top || !bottom) + return; + const vectors = { + topLeft: Vec46.start(top), + topRight: Vec46.end(top), + bottomLeft: Vec46.start(bottom), + bottomRight: Vec46.end(bottom) + }; + const snap = { + vectors: { + topLeft: vectors.topRight, + bottomLeft: vectors.bottomRight, + topRight: vectors.topLeft, + bottomRight: vectors.bottomLeft + }, + angle: datum.snapToAngle + }; + const points = translate(vectors, offset, context, { + overflowContinuous: this.overflowContinuous, + translateVectors, + invertYVectors, + snap: allowSnapping ? snap : void 0 + }); + datum.start.x = points.topLeft.x; + datum.start.y = points.topLeft.y; + datum.end.x = points.topRight.x; + datum.end.y = points.topRight.y; + datum.startHeight = points.topLeft.y - points.bottomLeft.y; + datum.endHeight = points.topRight.y - points.bottomRight.y; + } + getTranslatePointsVectors(start2, end3) { + const { bottomLeft, bottomRight, topLeft, topRight } = this.handles; + const startHeight = bottomLeft.getBBox().y - topLeft.getBBox().y; + const endHeight = bottomRight.getBBox().y - topRight.getBBox().y; + const bottomStart = Vec210.add(start2, Vec210.from(0, startHeight)); + const bottomEnd = Vec210.add(end3, Vec210.from(0, endHeight)); + return { start: start2, end: end3, bottomStart, bottomEnd }; + } + updateLines(datum, top, bottom) { + const { topLine, bottomLine } = this; + const { lineDashOffset, stroke: stroke22, strokeOpacity, strokeWidth } = datum; + const lineStyles = { + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke22, + strokeOpacity, + strokeWidth + }; + topLine.setProperties({ ...top, ...lineStyles }); + bottomLine.setProperties({ ...bottom, ...lineStyles }); + } + updateHandles(datum, top, bottom) { + const { + handles: { topLeft, topRight, bottomLeft, bottomRight } + } = this; + const handleStyles = { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + topLeft.update({ ...handleStyles, ...Vec46.start(top) }); + topRight.update({ ...handleStyles, ...Vec46.end(top) }); + bottomLeft.update({ ...handleStyles, ...Vec46.start(bottom) }); + bottomRight.update({ + ...handleStyles, + ...Vec210.sub(Vec46.end(bottom), Vec210.from(bottomRight.handle.width / 2, bottomRight.handle.height / 2)) + }); + } + updateText(datum, top, bottom) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateChannelText(false, top, bottom, datum.text, datum.strokeWidth, this.text, datum.text.label); + } + getBackgroundPoints(datum, top, bottom, bounds) { + const isFlippedX = top.x1 > top.x2; + const isFlippedY = top.y1 > top.y2; + const topY = isFlippedY ? bounds.y2 : bounds.y1; + const bottomY = isFlippedY ? bounds.y1 : bounds.y2; + const points = Vec210.from(top); + if (datum.extendEnd && top.y2 === bottomY) { + points.push(Vec210.from(isFlippedX ? bounds.x1 : bounds.x2, isFlippedY ? bounds.y1 : bounds.y2)); + } + if (datum.extendEnd && bottom.y2 === topY) { + points.push(Vec210.from(isFlippedX ? bounds.x1 : bounds.x2, isFlippedY ? bounds.y2 : bounds.y1)); + } + points.push(...Vec210.from(bottom).reverse()); + if (datum.extendStart && bottom.y1 === bottomY) { + points.push(Vec210.from(isFlippedX ? bounds.x2 : bounds.x1, isFlippedY ? bounds.y1 : bounds.y2)); + } + if (datum.extendStart && top.y1 === topY) { + points.push(Vec210.from(isFlippedX ? bounds.x2 : bounds.x1, isFlippedY ? bounds.y2 : bounds.y1)); + } + return points; + } +}; +var { StateMachine: StateMachine6, StateMachineProperty: StateMachineProperty6, Debug: Debug6 } = module_support_exports; +var DisjointChannelStateMachine = class extends StateMachine6 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = new DisjointChannelProperties(); + datum.set({ start: point, end: point, startHeight: 0, endHeight: 0 }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ topLeft: true, topRight: false, bottomLeft: false, bottomRight: false }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ topRight: true }); + ctx.update(); + }; + const actionHeightUpdate = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !isNumber(startY) || !isNumber(endY) || !isNumber(pointY)) + return; + const endHeight = endY - (pointY ?? 0); + const startHeight = (startY - endY) * 2 + endHeight; + const bottomStart = { x: datum?.start.x, y: startY - startHeight }; + const bottomEnd = { x: datum?.end.x, y: point.y }; + node?.toggleHandles({ bottomLeft: true, bottomRight: true }); + if (!ctx.validatePoint(bottomStart, { overflowContinuous: true }) || !ctx.validatePoint(bottomEnd, { overflowContinuous: true })) { + return; + } + datum.set({ startHeight, endHeight }); + ctx.update(); + }; + const actionHeightFinish = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !isNumber(startY) || !isNumber(endY) || !isNumber(pointY)) + return; + const endHeight = endY - (pointY ?? 0); + const startHeight = (startY - endY) * 2 + endHeight; + const bottomStart = { x: datum.start.x, y: startY - endHeight }; + const bottomEnd = { x: datum.end.x, y: point.y }; + node?.toggleHandles(true); + if (!ctx.validatePoint(bottomStart, { overflowContinuous: true }) || !ctx.validatePoint(bottomEnd, { overflowContinuous: true })) { + return; + } + datum.set({ startHeight, endHeight }); + ctx.recordAction(`Create ${"disjoint-channel"} annotation`); + ctx.showAnnotationOptions(); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine6.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + drag: actionEndUpdate, + click: { + target: "height", + action: actionEndFinish + }, + dragEnd: { + target: "height", + action: actionEndFinish + }, + reset: { + target: StateMachine6.parent, + action: actionCancel + }, + cancel: { + target: StateMachine6.parent, + action: actionCancel + } + }, + height: { + hover: actionHeightUpdate, + click: { + target: StateMachine6.parent, + action: actionHeightFinish + }, + drag: { + target: StateMachine6.parent, + action: actionHeightFinish + }, + reset: { + target: StateMachine6.parent, + action: actionCancel + }, + cancel: { + target: StateMachine6.parent, + action: actionCancel + } + } + }); + this.debug = Debug6.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass2([ + StateMachineProperty6() +], DisjointChannelStateMachine.prototype, "datum", 2); +__decorateClass2([ + StateMachineProperty6() +], DisjointChannelStateMachine.prototype, "node", 2); +__decorateClass2([ + StateMachineProperty6() +], DisjointChannelStateMachine.prototype, "snapping", 2); +var disjointChannelConfig = { + type: "disjoint-channel", + datum: DisjointChannelProperties, + scene: DisjointChannelScene, + isDatum: DisjointChannelProperties.is, + translate: (node, datum, transition, context) => { + if (DisjointChannelProperties.is(datum) && DisjointChannelScene.is(node)) { + node.translate(datum, transition, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (DisjointChannelProperties.is(datum) && DisjointChannelProperties.is(copiedDatum) && DisjointChannelScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (DisjointChannelProperties.is(datum) && DisjointChannelScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new DisjointChannelStateMachine({ + ...ctx, + create: createDatum( + "disjoint-channel" + /* DisjointChannel */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var FIBONACCI_RETRACEMENT_RATIOS = [0, 23.6, 38.2, 50, 61.8, 78.6, 100]; +var FIBONACCI_EXTENSION_RATIOS = [161.8, 261.8, 361.8, 423.6]; +var FIBONACCI_RATIOS = [...FIBONACCI_RETRACEMENT_RATIOS, ...FIBONACCI_EXTENSION_RATIOS]; +var FIBONACCI_RATIOS_MAP = { + 10: FIBONACCI_RATIOS, + 6: FIBONACCI_RETRACEMENT_RATIOS, + 4: FIBONACCI_RETRACEMENT_RATIOS.filter((r) => r !== 78.6 && r !== 23.6) +}; +var FIBONACCI_RANGE_LABEL_PADDING = 10; +function getFibonacciCoords(coords1, coords2) { + const { x2, y1, y2 } = coords1; + const trendLineVerticalDistance = y1 - y2; + if (coords2 == null) { + return { + x1: x2, + x2, + y1: y2 - trendLineVerticalDistance, + y2 + }; + } + return { + x1: coords2.x1, + x2: coords2.x2, + y1: coords2.y2 - trendLineVerticalDistance, + y2: coords2.y2 + }; +} +function createFibonacciRangesData({ x1, y1, x2, y2 }, context, reverse, yZero, bands = 10) { + const verticalDistance = y1 - y2; + const direction = reverse ? -1 : 1; + let startY = yZero; + const data = []; + for (const [index, ratio3] of FIBONACCI_RATIOS_MAP[bands].entries()) { + const endY = yZero + verticalDistance * (ratio3 / 100) * direction; + const yDatumVal = context.yAxis.scaleInvert(endY); + data.push({ + id: index, + x1, + x2, + y1: startY, + y2: endY, + tag: ratio3 == 100 ? 0 : 1, + label: { + x1: Math.min(x1, x2) - FIBONACCI_RANGE_LABEL_PADDING, + x2, + y1: endY, + y2: endY, + text: `${(ratio3 / 100).toFixed(3)} (${yDatumVal.toFixed(2)})` + } + }); + startY = endY; + } + return data; +} +var { Vec2: Vec211, Vec4: Vec47 } = module_support_exports; +var FibonacciScene = class extends AnnotationScene { + constructor() { + super(); + this.trendLine = new CollidableLine(); + this.rangeFillsGroup = new module_support_exports.Group({ + name: `${this.id}-range-fills` + }); + this.rangeFillsGroupSelection = module_support_exports.Selection.select(this.rangeFillsGroup, module_support_exports.Range); + this.rangeStrokesGroup = new module_support_exports.Group({ + name: `${this.id}-range-strokes` + }); + this.rangeStrokesGroupSelection = module_support_exports.Selection.select(this.rangeStrokesGroup, CollidableLine); + this.labelsGroup = new module_support_exports.Group({ + name: `${this.id}-ranges-labels` + }); + this.labelsGroupSelection = module_support_exports.Selection.select(this.labelsGroup, CollidableText); + this.anchor = { + x: 0, + y: 0, + position: "above" + }; + this.append([this.trendLine, this.rangeFillsGroup, this.rangeStrokesGroup, this.labelsGroup]); + } + update(datum, context) { + let coords = convertLine(datum, context); + if (coords == null) { + this.visible = false; + return; + } + coords = Vec47.round(coords); + this.visible = datum.visible ?? true; + if (!this.visible) + return; + this.updateLine(datum, coords, this.trendLine); + this.updateHandles(datum, coords); + this.updateAnchor(datum, coords, context); + const { reverse } = datum; + const extendedCoords = this.extendLine(coords, datum, context); + const yZero = reverse ? extendedCoords.y1 : extendedCoords.y2; + const yOne = reverse ? extendedCoords.y2 : extendedCoords.y1; + const data = createFibonacciRangesData(extendedCoords, context, datum.reverse, yZero, datum.bands); + this.updateRanges(datum, data, context); + const oneLinePoints = { ...extendedCoords, y1: yOne, y2: yOne }; + this.updateText(datum, oneLinePoints); + } + extendLine({ x1, y1, x2, y2 }, datum, context) { + const linePoints = { x1, y1, x2, y2 }; + if (!datum.extendStart && !datum.extendEnd) { + return linePoints; + } + const { x, width: width2 } = context.xAxis.bounds; + if (datum.extendEnd) { + linePoints[x1 > x2 ? "x1" : "x2"] = x + width2; + } + if (datum.extendStart) { + linePoints[x1 > x2 ? "x2" : "x1"] = x; + } + return linePoints; + } + updateLine(datum, coords, line) { + if (!coords || !line) { + return; + } + const { lineDashOffset, strokeWidth, strokeOpacity, stroke: stroke22 } = datum; + line.setProperties({ + ...coords, + lineCap: datum.getLineCap(), + lineDash: [3, 4], + lineDashOffset, + strokeWidth, + strokeOpacity, + fillOpacity: 0, + stroke: stroke22 + }); + } + updateRangeStrokes(datum) { + const { lineDashOffset, strokeWidth, strokeOpacity, strokes, rangeStroke, isMultiColor } = datum; + this.rangeStrokesGroupSelection.each((line, { x1, x2, y2, tag }, index) => { + const y = y2; + const color6 = isMultiColor ? strokes[index % strokes.length] : rangeStroke; + line.setProperties({ + x1, + x2, + y1: y, + y2: y, + stroke: color6, + strokeOpacity, + strokeWidth, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + tag + }); + }); + } + updateRanges(datum, data, context) { + const getDatumId = (d) => d.id; + this.rangeFillsGroupSelection.update(data, void 0, getDatumId); + this.rangeStrokesGroupSelection.update(data, void 0, getDatumId); + this.labelsGroupSelection.update(data, void 0, getDatumId); + this.updateRangeFills(datum); + this.updateRangeStrokes(datum); + this.updateRangeLabels(datum, context); + } + updateRangeFills(datum) { + const { + lineDashOffset, + strokeWidth, + strokeOpacity, + strokes: colors, + rangeStroke, + showFill, + isMultiColor + } = datum; + this.rangeFillsGroupSelection.each((range22, { x1, x2, y1, y2 }, index) => { + const color6 = isMultiColor ? colors[index % colors.length] : rangeStroke; + if (!showFill) { + range22.visible = false; + return; + } + range22.setProperties({ + x1, + x2, + y1, + y2, + startLine: false, + endLine: false, + stroke: color6, + strokeOpacity, + fill: color6, + fillOpacity: (strokeOpacity ?? 1) * 0.15, + strokeWidth, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + visible: true + }); + }); + } + updateRangeLabels(trendLineProperties, { xAxis }) { + const { rangeStrokesGroupSelection } = this; + const { + strokes: colors, + strokeWidth, + rangeStroke, + isMultiColor, + label: { fontFamily, fontSize, fontStyle, fontWeight, color: color6 } + } = trendLineProperties; + const labelProperties = { + fontFamily, + fontSize, + fontStyle, + fontWeight + }; + const withinBounds = this.checkWithinBounds(xAxis, labelProperties, this.labelsGroupSelection.at(0)); + this.labelsGroupSelection.each((textNode, datum, index) => { + const textColor = color6 ?? (isMultiColor ? colors[index % colors.length] : rangeStroke); + const line = rangeStrokesGroupSelection.at(index); + if (!line) { + return; + } + const { text: text2, ...coords } = datum.label; + if (withinBounds) { + textNode.setProperties({ + ...labelProperties, + text: text2, + x: coords.x1, + y: coords.y1, + textBaseline: "middle", + textAlign: "end", + fill: textColor + }); + updateLineText(textNode.id, line, coords); + } else { + const textProperties = { + ...labelProperties, + label: text2, + position: "center", + alignment: "left", + color: textColor + }; + updateLineText(textNode.id, line, coords, textProperties, textNode, text2, strokeWidth); + } + }); + } + checkWithinBounds(xAxis, fontOptions, textNode) { + if (!textNode) { + return false; + } + const { text: text2, ...coords } = textNode.datum.label; + textNode.setProperties({ + ...fontOptions, + text: text2, + x: coords.x1, + y: coords.y1, + textBaseline: "middle", + textAlign: "end" + }); + const { x } = textNode.getBBox(); + return x >= xAxis.bounds.x && x <= xAxis.bounds.x + xAxis.bounds.width; + } + updateText(datum, coords) { + const oneLine = this.rangeStrokesGroupSelection.selectByTag( + 0 + /* OneLine */ + )[0]; + if (!oneLine) { + return; + } + const { text: textProperties, strokeWidth } = datum; + this.text = this.updateNode(CollidableText, this.text, !!textProperties.label); + updateLineText(oneLine.id, oneLine, coords, textProperties, this.text, textProperties.label, strokeWidth); + } + updateAnchor(_datum, coords, _context, _bbox) { + const point = Vec47.topCenter(coords); + Vec211.apply(this.anchor, module_support_exports.Transformable.toCanvasPoint(this.trendLine, point.x, point.y)); + } + containsPoint(x, y) { + const { trendLine, rangeStrokesGroupSelection, text: text2 } = this; + let isInStrokePath = false; + rangeStrokesGroupSelection.each((line) => isInStrokePath || (isInStrokePath = line.isPointInPath(x, y))); + return isInStrokePath || trendLine.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.trendLine.isPointInPath(x, y)) + return "line"; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + } + drag(datum, target, context, snapping) { + if (!datum.isWriteable()) + return; + if (this.activeHandle) { + this.dragHandle(datum, target, context, snapping); + } else { + this.dragAll(datum, target, context); + } + } + getAnchor() { + return this.anchor; + } + getCursor() { + return "pointer"; + } +}; +var { ContinuousScale: ContinuousScale3 } = module_support_exports; +function validateDatumPoint(context, point, options = { overflowContinuous: false }, warningPrefix) { + if (point.x == null || point.y == null) { + if (warningPrefix) { + logger_exports.warnOnce(`${warningPrefix}requires both an [x] and [y] property, ignoring.`); + } + return false; + } + const { xAxis, yAxis } = context; + const continuousX = options.overflowContinuous && ContinuousScale3.is(xAxis.scale); + const continuousY = options.overflowContinuous && ContinuousScale3.is(yAxis.scale); + const validX = continuousX || validateDatumPointDirection(point.x, xAxis); + const validY = continuousY || validateDatumPointDirection(point.y, yAxis); + if (validX && validY) + return true; + if (warningPrefix) { + let text2 = "x & y domains"; + if (validX) + text2 = "y domain"; + if (validY) + text2 = "x domain"; + const xValue2 = getGroupingValue(point.x); + const yValue = getGroupingValue(point.y); + logger_exports.warnOnce(`${warningPrefix}is outside the ${text2}, ignoring. - x: [${xValue2}], y: ${yValue}]`); + } + return false; +} +function validateDatumPointDirection(d, context) { + const { domain } = context.scale; + const value = getGroupingValue(d); + if (domain && value != null && context.continuous) { + return value >= domain[0] && value <= domain.at(-1); + } + return true; +} +var { Vec2: Vec212, Vec4: Vec48 } = module_support_exports; +var FibonacciRetracementTrendBasedScene = class extends FibonacciScene { + constructor() { + super(); + this.type = "fibonacci-retracement-trend-based"; + this.endRetracementLine = new CollidableLine(); + this.start = new DivariantHandle(); + this.end = new DivariantHandle(); + this.endRetracement = new DivariantHandle(); + this.append([this.endRetracementLine, this.start, this.end, this.endRetracement]); + } + static is(value) { + return AnnotationScene.isCheck(value, "fibonacci-retracement-trend-based"); + } + update(datum, context) { + let { coords1, coords2 } = this.getCoords(datum, context); + if (coords1 == null || coords2 == null) { + this.visible = false; + return; + } + coords1 = Vec48.round(coords1); + coords2 = Vec48.round(coords2); + this.visible = datum.visible ?? true; + if (!this.visible) + return; + if (datum.endRetracement.x == void 0 || datum.endRetracement.y == void 0) { + coords2 = void 0; + } + this.updateLine(datum, coords1, this.trendLine); + this.updateLine(datum, coords2, this.endRetracementLine); + this.updateHandles(datum, coords1, coords2); + this.updateAnchor(datum, coords2 ?? coords1, context); + const { reverse, bands } = datum; + const coords = getFibonacciCoords(coords1, coords2); + const extendedCoords = this.extendLine(coords, datum, context); + const yZero = extendedCoords.y2; + const yOne = extendedCoords.y1; + const data = coords2 ? createFibonacciRangesData(extendedCoords, context, reverse, yZero, bands) : []; + this.updateRanges(datum, data, context); + const oneLinePoints = { ...extendedCoords, y1: yOne, y2: yOne }; + this.updateText(datum, oneLinePoints); + } + containsPoint(x, y) { + const { start: start2, end: end3, endRetracement, endRetracementLine } = this; + this.activeHandle = void 0; + if (start2.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + if (end3.containsPoint(x, y)) { + this.activeHandle = "end"; + return true; + } + if (endRetracement.containsPoint(x, y)) { + this.activeHandle = "endRetracement"; + return true; + } + return endRetracementLine.isPointInPath(x, y) || super.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y) || this.endRetracement.containsPoint(x, y)) + return "handle"; + if (this.endRetracementLine.isPointInPath(x, y)) + return "line"; + return super.getNodeAtCoords(x, y); + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ start: datum.start, end: datum.end, endRetracement: datum.endRetracement }, context) + }; + } + stopDragging() { + this.start.toggleDragging(false); + this.end.toggleDragging(false); + this.endRetracement.toggleDragging(false); + } + dragAll(datum, target, context) { + const { dragState } = this; + if (!dragState) + return; + this.translatePoints({ + datum, + start: dragState.start, + end: dragState.end, + endRetracement: dragState.endRetracement, + translation: Vec212.sub(target, dragState.offset), + context + }); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, dragState } = this; + if (!activeHandle || !dragState) + return; + this[activeHandle].toggleDragging(true); + const point = snapping ? this.snapToAngle(datum, target, context) : invertCoords(this[activeHandle].drag(target).point, context); + if (!point || !validateDatumPoint(context, point)) + return; + datum[activeHandle].x = point.x; + datum[activeHandle].y = point.y; + } + snapToAngle(datum, coords, context) { + const { activeHandle } = this; + const handles = ["start", "end", "endRetracement"]; + if (!activeHandle) + return; + const index = (handles.indexOf(activeHandle) + 1) % handles.length; + const fixedHandle = handles[index]; + this[activeHandle].toggleDragging(true); + const fixed = convertPoint(datum[fixedHandle], context); + return invertCoords(snapToAngle(coords, fixed, datum.snapToAngle), context); + } + translatePoints({ + datum, + start: start2, + end: end3, + endRetracement, + translation, + context + }) { + const points = translate({ start: start2, end: end3, endRetracement }, translation, context, { overflowContinuous: 2 }); + datum.start.x = points.start.x; + datum.end.x = points.end.x; + datum.endRetracement.x = points.endRetracement.x; + datum.start.y = points.start.y; + datum.end.y = points.end.y; + datum.endRetracement.y = points.endRetracement.y; + } + translate(datum, translation, context) { + this.translatePoints({ + datum, + start: convertPoint(datum.start, context), + end: convertPoint(datum.end, context), + endRetracement: convertPoint(datum.endRetracement, context), + translation, + context + }); + } + copy(datum, copiedDatum, context) { + const { coords1, coords2 } = this.getCoords(datum, context); + if (!coords1 || !coords2) { + return; + } + const bbox = this.computeBBoxWithoutHandles(); + this.translatePoints({ + datum: copiedDatum, + start: Vec48.start(coords1), + end: Vec48.end(coords1), + endRetracement: Vec48.end(coords2), + translation: { x: -bbox.width / 2, y: -bbox.height / 2 }, + context + }); + return copiedDatum; + } + getCoords(datum, context) { + return { + coords1: convertLine(datum, context), + coords2: convertLine({ start: datum.end, end: datum.endRetracement }, context) + }; + } + toggleHandles(show) { + if (typeof show === "boolean") { + this.start.visible = show; + this.end.visible = show; + this.endRetracement.visible = show; + } else { + for (const [handle22, visible] of entries(show)) { + this[handle22].visible = visible; + } + } + this.start.toggleHovered(this.activeHandle === "start"); + this.end.toggleHovered(this.activeHandle === "end"); + this.endRetracement.toggleHovered(this.activeHandle === "endRetracement"); + } + toggleActive(active) { + this.toggleHandles(active); + this.start.toggleActive(active); + this.end.toggleActive(active); + this.endRetracement.toggleActive(active); + } + updateHandles(datum, coords1, coords2, bbox) { + this.start.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords1, "start") + }); + this.end.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords1, "end", bbox) + }); + if (coords2) { + this.endRetracement.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords2, "endRetracement", bbox) + }); + } + this.start.toggleLocked(datum.locked ?? false); + this.end.toggleLocked(datum.locked ?? false); + this.endRetracement.toggleLocked(datum.locked ?? false); + } + getHandleCoords(_datum, coords, handle22, _bbox) { + return handle22 === "start" ? Vec48.start(coords) : Vec48.end(coords); + } +}; +var { StateMachine: StateMachine7, StateMachineProperty: StateMachineProperty7, Debug: Debug7 } = module_support_exports; +var FibonacciRetracementTrendBasedStateMachine = class extends StateMachine7 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ start: true, end: false, endRetracement: false }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + const { datum } = this; + if (!datum) + return; + datum.endRetracement.x = datum.end.x; + datum.endRetracement.y = datum.end.y; + this.node?.toggleHandles({ end: true }); + ctx.update(); + }; + const actionEndRetracementUpdate = ({ + offset, + context + }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ endRetracement: snapPoint(offset, context, snapping, datum.end, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndRetracementFinish = () => { + this.node?.toggleHandles({ endRetracement: true }); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + const onExitEnd = () => { + ctx.showAnnotationOptions(); + ctx.recordAction(`Create ${this.datum?.type} annotation`); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine7.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + click: { + target: "endRetracement", + action: actionEndFinish + }, + drag: actionEndUpdate, + dragEnd: { + target: "endRetracement", + action: actionEndFinish + }, + reset: { + target: StateMachine7.parent, + action: actionCancel + }, + cancel: { + target: StateMachine7.parent, + action: actionCancel + }, + onExit: onExitEnd + }, + endRetracement: { + hover: actionEndRetracementUpdate, + click: { + target: StateMachine7.parent, + action: actionEndRetracementFinish + }, + drag: { + target: StateMachine7.parent, + action: actionEndRetracementFinish + }, + reset: { + target: StateMachine7.parent, + action: actionCancel + }, + cancel: { + target: StateMachine7.parent, + action: actionCancel + } + } + }); + this.debug = Debug7.create(true, "annotations"); + this.snapping = false; + } + createDatum() { + return new FibonacciRetracementTrendBasedProperties(); + } +}; +__decorateClass2([ + StateMachineProperty7() +], FibonacciRetracementTrendBasedStateMachine.prototype, "datum", 2); +__decorateClass2([ + StateMachineProperty7() +], FibonacciRetracementTrendBasedStateMachine.prototype, "node", 2); +__decorateClass2([ + StateMachineProperty7() +], FibonacciRetracementTrendBasedStateMachine.prototype, "snapping", 2); +var fibonacciRetracementTrendBasedConfig = { + type: "fibonacci-retracement-trend-based", + datum: FibonacciRetracementTrendBasedProperties, + scene: FibonacciRetracementTrendBasedScene, + isDatum: FibonacciRetracementTrendBasedProperties.is, + translate: (node, datum, transition, context) => { + if (FibonacciRetracementTrendBasedProperties.is(datum) && FibonacciRetracementTrendBasedScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (FibonacciRetracementTrendBasedProperties.is(datum) && FibonacciRetracementTrendBasedProperties.is(copiedDatum) && FibonacciRetracementTrendBasedScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (FibonacciRetracementTrendBasedProperties.is(datum) && FibonacciRetracementTrendBasedScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new FibonacciRetracementTrendBasedStateMachine({ + ...ctx, + create: createDatum( + "fibonacci-retracement-trend-based" + /* FibonacciRetracementTrendBased */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var { Vec2: Vec213, Vec4: Vec49 } = module_support_exports; +var FibonacciRetracementScene = class extends FibonacciScene { + constructor() { + super(); + this.type = "fibonacci-retracement"; + this.start = new DivariantHandle(); + this.end = new DivariantHandle(); + this.append([this.start, this.end]); + } + static is(value) { + return AnnotationScene.isCheck(value, "fibonacci-retracement"); + } + containsPoint(x, y) { + const { start: start2, end: end3 } = this; + this.activeHandle = void 0; + if (start2.containsPoint(x, y)) { + this.activeHandle = "start"; + return true; + } + if (end3.containsPoint(x, y)) { + this.activeHandle = "end"; + return true; + } + return super.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y)) + return "handle"; + return super.getNodeAtCoords(x, y); + } + dragStart(datum, target, context) { + this.dragState = { + offset: target, + ...getDragStartState({ start: datum.start, end: datum.end }, context) + }; + } + stopDragging() { + this.start.toggleDragging(false); + this.end.toggleDragging(false); + } + dragAll(datum, target, context) { + const { dragState } = this; + if (!dragState) + return; + this.translatePoints({ + datum, + start: dragState.start, + end: dragState.end, + translation: Vec213.sub(target, dragState.offset), + context + }); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, dragState } = this; + if (!activeHandle || !dragState) + return; + this[activeHandle].toggleDragging(true); + const point = snapping ? this.snapToAngle(datum, target, context) : invertCoords(this[activeHandle].drag(target).point, context); + if (!point || !validateDatumPoint(context, point)) + return; + datum[activeHandle].x = point.x; + datum[activeHandle].y = point.y; + } + snapToAngle(datum, coords, context) { + const { activeHandle } = this; + const handles = ["start", "end"]; + const fixedHandle = handles.find((handle22) => handle22 !== activeHandle); + if (!activeHandle || !fixedHandle) + return; + this[activeHandle].toggleDragging(true); + const fixed = convertPoint(datum[fixedHandle], context); + return invertCoords(snapToAngle(coords, fixed, datum.snapToAngle), context); + } + translatePoints({ + datum, + start: start2, + end: end3, + translation, + context + }) { + const points = translate({ start: start2, end: end3 }, translation, context, { overflowContinuous: 1 }); + datum.start.x = points.start.x; + datum.end.x = points.end.x; + datum.start.y = points.start.y; + datum.end.y = points.end.y; + } + translate(datum, translation, context) { + this.translatePoints({ + datum, + start: convertPoint(datum.start, context), + end: convertPoint(datum.end, context), + translation, + context + }); + } + copy(datum, copiedDatum, context) { + const coords = convertLine(datum, context); + if (!coords) { + return; + } + const bbox = this.computeBBoxWithoutHandles(); + this.translatePoints({ + datum: copiedDatum, + start: { x: coords.x1, y: coords.y1 }, + end: { x: coords.x2, y: coords.y2 }, + translation: { x: -bbox.width / 2, y: -bbox.height / 2 }, + context + }); + return copiedDatum; + } + toggleHandles(show) { + if (typeof show === "boolean") { + this.start.visible = show; + this.end.visible = show; + } else { + for (const [handle22, visible] of entries(show)) { + this[handle22].visible = visible; + } + } + this.start.toggleHovered(this.activeHandle === "start"); + this.end.toggleHovered(this.activeHandle === "end"); + } + toggleActive(active) { + this.toggleHandles(active); + this.start.toggleActive(active); + this.end.toggleActive(active); + } + updateHandles(datum, coords, _coords2, bbox) { + this.start.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords, "start") + }); + this.end.update({ + ...this.getHandleStyles(datum), + ...this.getHandleCoords(datum, coords, "end", bbox) + }); + this.start.toggleLocked(datum.locked ?? false); + this.end.toggleLocked(datum.locked ?? false); + } + getHandleCoords(_datum, coords, handle22, _bbox) { + return handle22 === "start" ? Vec49.start(coords) : Vec49.end(coords); + } +}; +var { StateMachine: StateMachine8, StateMachineProperty: StateMachineProperty8, Debug: Debug8 } = module_support_exports; +var LineTypeStateMachine = class extends StateMachine8 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ start: true, end: false }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ end: true }); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + const onExitEnd = () => { + ctx.showAnnotationOptions(); + ctx.recordAction(`Create ${this.datum?.type} annotation`); + }; + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine8.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + click: { + target: StateMachine8.parent, + action: actionEndFinish + }, + drag: actionEndUpdate, + dragEnd: { + target: StateMachine8.parent, + action: actionEndFinish + }, + reset: { + target: StateMachine8.parent, + action: actionCancel + }, + cancel: { + target: StateMachine8.parent, + action: actionCancel + }, + onExit: onExitEnd + } + }); + this.debug = Debug8.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass2([ + StateMachineProperty8() +], LineTypeStateMachine.prototype, "datum", 2); +__decorateClass2([ + StateMachineProperty8() +], LineTypeStateMachine.prototype, "node", 2); +__decorateClass2([ + StateMachineProperty8() +], LineTypeStateMachine.prototype, "snapping", 2); +var ArrowStateMachine = class extends LineTypeStateMachine { + createDatum() { + return new ArrowProperties(); + } +}; +var LineStateMachine = class extends LineTypeStateMachine { + createDatum() { + return new LineProperties(); + } +}; +var FibonacciRetracementStateMachine = class extends LineTypeStateMachine { + createDatum() { + return new FibonacciRetracementProperties(); + } +}; +var fibonacciRetracementConfig = { + type: "fibonacci-retracement", + datum: FibonacciRetracementProperties, + scene: FibonacciRetracementScene, + isDatum: FibonacciRetracementProperties.is, + translate: (node, datum, transition, context) => { + if (FibonacciRetracementProperties.is(datum) && FibonacciRetracementScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (FibonacciRetracementProperties.is(datum) && FibonacciRetracementProperties.is(copiedDatum) && FibonacciRetracementScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (FibonacciRetracementProperties.is(datum) && FibonacciRetracementScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new FibonacciRetracementStateMachine({ + ...ctx, + create: createDatum( + "fibonacci-retracement" + /* FibonacciRetracement */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var { Vec2: Vec214 } = module_support_exports; +var CapScene = class extends module_support_exports.Group { +}; +var ArrowCapScene = class extends CapScene { + constructor() { + super(); + this.type = "arrow"; + this.path = new module_support_exports.Path(); + this.armLength = 6; + this.append([this.path]); + } + update(options) { + const { path } = this; + const { x, y, angle: angle2, ...rest } = options; + const origin3 = Vec214.from(x, y); + const offsetAngle = 3 * Math.PI / 4; + const armLength = this.armLength + (options.strokeWidth ?? 0) * 2; + const leftEnd = Vec214.rotate(Vec214.from(0, armLength), angle2 + offsetAngle, origin3); + const rightEnd = Vec214.rotate(Vec214.from(armLength, 0), angle2 - offsetAngle, origin3); + path.setProperties(rest); + path.fillOpacity = 0; + path.path.clear(); + path.path.moveTo(leftEnd.x, leftEnd.y); + path.path.lineTo(origin3.x, origin3.y); + path.path.lineTo(rightEnd.x, rightEnd.y); + } +}; +var { Vec2: Vec215, Vec4: Vec410 } = module_support_exports; +var LineScene = class extends StartEndScene { + constructor() { + super(); + this.type = "line"; + this.line = new CollidableLine(); + this.append([this.line, this.start, this.end]); + } + static is(value) { + return AnnotationScene.isCheck(value, "line"); + } + update(datum, context) { + let coords = convertLine(datum, context); + if (coords == null) { + this.visible = false; + return; + } + coords = Vec410.round(coords); + this.visible = datum.visible ?? true; + if (!this.visible) + return; + this.updateLine(datum, coords, context); + this.updateHandles(datum, coords); + this.updateText(datum, coords); + this.updateCaps(datum, coords); + this.updateAnchor(datum, coords, context); + } + updateLine(datum, coords, context) { + const { line } = this; + const { lineDashOffset, stroke: stroke22, strokeWidth, strokeOpacity } = datum; + const linePoints = this.extendLine(coords, datum, context); + line.setProperties({ + ...linePoints, + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke22, + strokeWidth, + strokeOpacity, + fillOpacity: 0 + }); + } + updateText(datum, coords) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateLineText(this.line.id, this.line, coords, datum.text, this.text, datum.text.label, datum.strokeWidth); + } + updateCaps(datum, coords) { + if (!datum.startCap && this.startCap) { + this.startCap.remove(); + this.startCap = void 0; + } + if (!datum.endCap && this.endCap) { + this.endCap.remove(); + this.endCap = void 0; + } + if (!datum.startCap && !datum.endCap) + return; + const { stroke: stroke22, strokeWidth, strokeOpacity } = datum; + const [start2, end3] = Vec215.from(coords); + const angle2 = Vec215.angle(Vec215.sub(end3, start2)); + if (datum.startCap) { + if (this.startCap && this.startCap.type !== datum.startCap) { + this.startCap.remove(); + this.startCap = void 0; + } + if (this.startCap == null) { + this.startCap = new ArrowCapScene(); + this.append([this.startCap]); + } + this.startCap.update({ + x: start2.x, + y: start2.y, + angle: angle2 - Math.PI, + stroke: stroke22, + strokeWidth, + strokeOpacity + }); + } + if (datum.endCap) { + if (this.endCap && this.endCap.type !== datum.endCap) { + this.endCap.remove(); + this.endCap = void 0; + } + if (this.endCap == null) { + this.endCap = new ArrowCapScene(); + this.append([this.endCap]); + } + this.endCap.update({ + x: end3.x, + y: end3.y, + angle: angle2, + stroke: stroke22, + strokeWidth, + strokeOpacity + }); + } + } + updateAnchor(_datum, coords, _context, _bbox) { + const point = Vec410.topCenter(coords); + Vec215.apply(this.anchor, module_support_exports.Transformable.toCanvasPoint(this.line, point.x, point.y)); + } + containsPoint(x, y) { + const { line, text: text2 } = this; + return super.containsPoint(x, y) || line.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.line.isPointInPath(x, y)) + return "line"; + return super.getNodeAtCoords(x, y); + } + getHandleCoords(_datum, coords, handle22, _bbox) { + const { startCap, endCap } = this; + let [startPoint, endPoint] = Vec215.from(coords); + const angle2 = Vec215.angle(Vec215.sub(endPoint, startPoint)); + if (startCap) { + startPoint = Vec215.rotate(Vec215.from(0, -DivariantHandle.HANDLE_SIZE / 2), angle2, startPoint); + } + if (endCap) { + endPoint = Vec215.rotate(Vec215.from(0, DivariantHandle.HANDLE_SIZE / 2), angle2, endPoint); + } + return handle22 === "start" ? startPoint : endPoint; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + } +}; +var lineConfig = { + type: "line", + datum: LineProperties, + scene: LineScene, + isDatum: LineProperties.is, + translate: (node, datum, transition, context) => { + if (LineProperties.is(datum) && LineScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (LineProperties.is(datum) && LineProperties.is(copiedDatum) && LineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (LineProperties.is(datum) && LineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new LineStateMachine({ + ...ctx, + create: createDatum( + "line" + /* Line */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var arrowConfig = { + type: "arrow", + datum: ArrowProperties, + scene: LineScene, + isDatum: ArrowProperties.is, + translate: (node, datum, transition, context) => { + if (ArrowProperties.is(datum) && LineScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (ArrowProperties.is(datum) && ArrowProperties.is(copiedDatum) && LineScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ArrowProperties.is(datum) && LineScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ArrowStateMachine({ + ...ctx, + create: createDatum( + "arrow" + /* Arrow */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +function layoutScenesRow(scenes, startX = 0, gap = 0) { + let x = startX; + for (const scene of scenes) { + if (Array.isArray(scene)) { + for (const scene_ of scene) { + layoutSetX(scene_, x); + } + x += module_support_exports.Group.computeChildrenBBox(scene).width + gap; + } else { + layoutSetX(scene, x); + x += scene.getBBox().width + gap; + } + } +} +function layoutScenesColumn(scenes, startY = 0, gap = 0) { + let y = startY; + for (const scene of scenes) { + if (Array.isArray(scene)) { + for (const scene_ of scene) { + layoutSetY(scene_, y); + } + y += module_support_exports.Group.computeChildrenBBox(scene).height + gap; + } else { + layoutSetY(scene, y); + y += scene.getBBox().height + gap; + } + } +} +function layoutSetX(scene, x) { + if ("x1" in scene) { + scene.x2 = x + (scene.x2 - scene.x1); + scene.x1 = x; + } else { + scene.x = x; + } +} +function layoutSetY(scene, y) { + if ("y1" in scene) { + scene.y2 = y + (scene.y2 - scene.y1); + scene.y1 = y; + } else { + scene.y = y; + } +} +function layoutAddX(scene, x) { + if ("x1" in scene) { + scene.x1 += x; + scene.x2 += x; + } else { + scene.x += x; + } +} +function layoutAddY(scene, y) { + if ("y1" in scene) { + scene.y1 += y; + scene.y2 += y; + } else { + scene.y += y; + } +} +var { Vec4: Vec411 } = module_support_exports; +var MeasurerStatisticsScene = class extends module_support_exports.Group { + constructor() { + super(); + this.name = "MeasurerStatisticsScene"; + this.background = new module_support_exports.Rect(); + this.dateRangeBarsText = new module_support_exports.Text(); + this.dateRangeDivider = new module_support_exports.Line(); + this.dateRangeValueText = new module_support_exports.Text(); + this.priceRangeValueText = new module_support_exports.Text(); + this.priceRangeDivider = new module_support_exports.Line(); + this.priceRangePercentageText = new module_support_exports.Text(); + this.volumeText = new module_support_exports.Text(); + this.volumeFormatter = new Intl.NumberFormat("en-US", { + notation: "compact", + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }); + this.append([ + this.background, + this.dateRangeBarsText, + this.dateRangeDivider, + this.dateRangeValueText, + this.priceRangeValueText, + this.priceRangeDivider, + this.priceRangePercentageText, + this.volumeText + ]); + } + update(datum, stats, anchor, coords, context, verticalDirection, localeManager) { + this.verticalDirection = verticalDirection; + const scenes = this.updateStatistics(datum, stats, anchor, localeManager); + const bbox = module_support_exports.Group.computeChildrenBBox(scenes.flat()); + const padding2 = 10; + bbox.grow(padding2); + this.updateBackground(datum, bbox, padding2); + this.reposition(scenes, padding2, context); + this.checkVisibility(datum, context, coords); + } + checkVisibility(datum, context, coords) { + const bounds = Vec411.from(new module_support_exports.BBox(0, 0, context.seriesRect.width, context.seriesRect.height)); + if (Vec411.collides(coords, bounds)) { + this.visible = datum.visible ?? true; + } else { + this.visible = false; + } + } + updateStatistics(datum, stats, anchor, localeManager) { + const { + dateRangeBarsText, + dateRangeDivider, + dateRangeValueText, + priceRangeValueText, + priceRangeDivider, + priceRangePercentageText, + volumeText + } = this; + const horizontalGap = 8; + const verticalGap = 6; + const dividerLineHeight = datum.statistics.fontSize + 3; + const dividerLineOffset = -2; + const textStyles = this.getTextStyles(datum); + const dividerLineStyles = { + ...this.getDividerStyles(datum), + x1: 0, + y1: 0, + x2: 0, + y2: dividerLineHeight + }; + const dateScenes = [dateRangeBarsText, dateRangeDivider, dateRangeValueText]; + const priceScenes = [priceRangeValueText, priceRangeDivider, priceRangePercentageText]; + const scenes = []; + if (stats.priceRange) { + priceRangeValueText.setProperties({ + ...textStyles, + text: this.formatPriceRangeValue(stats.priceRange.value, localeManager) + }); + priceRangeDivider.setProperties(dividerLineStyles); + priceRangePercentageText.setProperties({ + ...textStyles, + text: this.formatPriceRangePercentage(stats.priceRange.percentage, localeManager) + }); + layoutScenesRow(priceScenes, anchor.x, horizontalGap); + scenes.push(priceScenes); + } + if (stats.dateRange) { + dateRangeBarsText.setProperties({ + ...textStyles, + text: this.formatDateRangeBars(stats.dateRange.bars, localeManager) + }); + dateRangeDivider.setProperties(dividerLineStyles); + dateRangeValueText.setProperties({ + ...textStyles, + text: this.formatDateRangeValue(stats.dateRange.value) + }); + layoutScenesRow(dateScenes, anchor.x, horizontalGap); + scenes.push(dateScenes); + } + if (stats.volume == null) { + volumeText.visible = false; + } else { + volumeText.setProperties({ + ...textStyles, + x: anchor.x, + text: this.formatVolume(stats.volume, localeManager), + visible: true + }); + scenes.push(volumeText); + } + layoutScenesColumn(scenes, anchor.y, verticalGap); + priceRangeDivider.y1 += dividerLineOffset; + priceRangeDivider.y2 += dividerLineOffset; + dateRangeDivider.y1 += dividerLineOffset; + dateRangeDivider.y2 += dividerLineOffset; + return scenes; + } + updateBackground(datum, bbox, padding2) { + const styles = this.getBackgroundStyles(datum); + this.background.setProperties({ + ...styles, + ...bbox, + x: bbox.x - bbox.width / 2 + padding2, + y: bbox.y + }); + } + reposition(scenes, padding2, context) { + const { width: width2, height: height2 } = context.seriesRect; + const background = Vec411.from(this.background.getBBox()); + let offsetX = 0; + if (background.x1 < 0) + offsetX = -background.x1; + if (background.x2 > width2) + offsetX = width2 - background.x2; + const offsetY = Math.min(padding2, height2 - background.y2); + for (const scene of scenes) { + if (Array.isArray(scene)) { + const rowWidth = module_support_exports.Group.computeChildrenBBox(scene).width; + for (const scene_ of scene) { + layoutAddX(scene_, offsetX - rowWidth / 2); + layoutAddY(scene_, offsetY); + } + } else { + layoutAddX(scene, offsetX - scene.getBBox().width / 2); + layoutAddY(scene, offsetY); + } + } + this.background.x += offsetX; + this.background.y += offsetY; + } + getTextStyles(datum) { + return { + fill: datum.statistics.color, + fontFamily: datum.statistics.fontFamily, + fontSize: datum.statistics.fontSize, + fontStyle: datum.statistics.fontStyle, + fontWeight: datum.statistics.fontWeight, + textBaseline: "top" + }; + } + getDividerStyles(datum) { + return { + stroke: datum.statistics.divider.stroke, + strokeOpacity: datum.statistics.divider.strokeOpacity, + strokeWidth: datum.statistics.divider.strokeWidth + }; + } + getBackgroundStyles(datum) { + return { + fill: datum.statistics.fill, + stroke: datum.statistics.stroke, + strokeOpacity: datum.statistics.strokeOpacity, + strokeWidth: datum.statistics.strokeWidth, + cornerRadius: 4 + }; + } + formatDateRangeBars(bars, localeManager) { + return localeManager?.t("measurerDateRangeBars", { value: bars }) ?? `${bars}`; + } + formatDateRangeValue(time3) { + const range22 = []; + const sign = time3 >= 0 ? "" : "-"; + time3 = Math.abs(time3); + const MINUTE = 1e3 * 60; + const HOUR = MINUTE * 60; + const DAY2 = HOUR * 24; + const minutes = Math.floor(time3 / MINUTE); + const hours = Math.floor(time3 / HOUR); + const days = Math.floor(time3 / DAY2); + const remainderHours = hours % (DAY2 / HOUR); + const remainderMinutes = minutes % (HOUR / MINUTE); + if (days >= 1) + range22.push(`${days}d`); + if (hours >= 1 && (time3 < DAY2 || remainderHours !== 0)) + range22.push(`${remainderHours}h`); + if (time3 < HOUR || remainderMinutes !== 0) + range22.push(`${remainderMinutes}m`); + range22[0] = `${sign}${range22[0]}`; + return range22.join(" "); + } + formatPriceRangeValue(value, localeManager) { + return localeManager?.t("measurerPriceRangeValue", { value: Number(value.toFixed(2)) }) ?? `${value}`; + } + formatPriceRangePercentage(percentage, localeManager) { + return localeManager?.t("measurerPriceRangePercent", { value: percentage }) ?? `${percentage}`; + } + formatVolume(volume, localeManager) { + const volumeString = Number.isNaN(volume) ? "" : this.volumeFormatter.format(volume); + return localeManager?.t("measurerVolume", { value: volumeString }) ?? volumeString; + } +}; +var QuickMeasurerStatisticsScene = class extends MeasurerStatisticsScene { + getDirectionStyles(datum) { + return this.verticalDirection === "down" ? datum.down.statistics : datum.up.statistics; + } + getTextStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + ...super.getTextStyles(datum), + fill: styles.color, + fontFamily: styles.fontFamily, + fontSize: styles.fontSize, + fontStyle: styles.fontStyle, + fontWeight: styles.fontWeight + }; + } + getDividerStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + stroke: styles.divider.stroke, + strokeOpacity: styles.divider.strokeOpacity, + strokeWidth: styles.divider.strokeWidth + }; + } + getBackgroundStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + ...super.getBackgroundStyles(datum), + fill: styles.fill, + stroke: styles.stroke, + strokeOpacity: styles.strokeOpacity, + strokeWidth: styles.strokeWidth + }; + } +}; +var { Vec2: Vec216, Vec4: Vec412 } = module_support_exports; +var MeasurerScene = class extends StartEndScene { + constructor() { + super(); + this.type = "measurer"; + this.horizontalLine = new CollidableLine(); + this.verticalLine = new CollidableLine(); + this.horizontalStartLine = new CollidableLine(); + this.horizontalEndLine = new CollidableLine(); + this.verticalStartLine = new CollidableLine(); + this.verticalEndLine = new CollidableLine(); + this.horizontalEndCap = new ArrowCapScene(); + this.verticalEndCap = new ArrowCapScene(); + this.background = new module_support_exports.Path({ zIndex: -1 }); + this.updateBackground = WithBackgroundScene.updateBackground.bind(this); + this.statistics = this.createStatisticsScene(); + this.statistics.zIndex = 1; + this.append([ + this.background, + this.verticalStartLine, + this.verticalEndLine, + this.horizontalStartLine, + this.horizontalEndLine, + this.horizontalLine, + this.verticalLine, + this.horizontalEndCap, + this.verticalEndCap, + this.start, + this.end, + this.statistics + ]); + } + static is(value) { + return AnnotationScene.isCheck(value, "measurer"); + } + createStatisticsScene() { + return new MeasurerStatisticsScene(); + } + update(datum, context) { + const coords = convertLine(datum, context); + if (coords == null) { + this.visible = false; + return; + } + this.visible = datum.visible ?? true; + if (!this.visible) + return; + const extended = this.extendPerpendicular(coords, datum, context); + const verticalStart = { ...extended, y2: extended.y1 }; + const verticalEnd = { ...extended, y1: extended.y2 }; + this.verticalDirection = coords.y1 < coords.y2 ? "down" : "up"; + this.updateVisibilities(datum); + this.updateLines(datum, coords); + this.updateHandles(datum, coords); + this.updateText(datum, coords); + this.updateCaps(datum, coords); + this.updateBoundingLines(datum, extended); + this.updateBackground(datum, verticalStart, verticalEnd, context); + this.updateStatistics(datum, coords, context); + this.updateAnchor(datum, coords, context); + } + extendPerpendicular(coords, datum, context) { + const extended = { + x1: Math.min(coords.x1, coords.x2), + x2: Math.max(coords.x1, coords.x2), + y1: Math.min(coords.y1, coords.y2), + y2: Math.max(coords.y1, coords.y2) + }; + const [start2, end3] = Vec216.from(context.yAxis.bounds); + if (DateRangeProperties.is(datum)) { + if (datum.extendAbove) + extended.y1 = start2.y; + if (datum.extendBelow) + extended.y2 = end3.y; + } else if (PriceRangeProperties.is(datum)) { + if (datum.extendLeft) + extended.x1 = start2.x; + if (datum.extendRight) + extended.x2 = end3.x; + } + return extended; + } + updateVisibilities(datum) { + const { + horizontalStartLine, + horizontalEndLine, + horizontalEndCap, + verticalStartLine, + verticalEndLine, + verticalEndCap + } = this; + const { direction } = datum; + verticalStartLine.visible = direction !== "vertical"; + verticalEndLine.visible = direction !== "vertical"; + horizontalEndCap.visible = direction !== "vertical"; + horizontalStartLine.visible = direction !== "horizontal"; + horizontalEndLine.visible = direction !== "horizontal"; + verticalEndCap.visible = direction !== "horizontal"; + } + updateLines(datum, coords) { + const { horizontalLine, verticalLine } = this; + const { direction } = datum; + const { x1, y1, x2, y2 } = coords; + const center2 = Vec216.round(Vec412.center(coords), 0); + const lineStyles = this.getLineStyles(datum); + if (direction !== "vertical") { + horizontalLine.setProperties({ + ...lineStyles, + x1, + x2, + y1: center2.y, + y2: center2.y + }); + } + if (direction !== "horizontal") { + verticalLine.setProperties({ + ...lineStyles, + x1: center2.x, + x2: center2.x, + y1, + y2 + }); + } + } + updateText(datum, coords) { + const { direction } = datum; + const center2 = Vec216.round(Vec412.center(coords), 0); + let line; + const textCoords = { ...coords }; + if (direction === "vertical") { + line = this.verticalLine; + textCoords.x1 = center2.x; + textCoords.x2 = center2.x; + } else { + line = this.horizontalLine; + textCoords.y1 = center2.y; + textCoords.y2 = center2.y; + } + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + const { id } = line; + const clip = updateLineText(id, line, textCoords, datum.text, this.text, datum.text.label, datum.strokeWidth); + let verticalClipMask; + if (direction === "both" && clip && this.text) { + const textBBox = Vec412.from(this.text.getBBox()); + const { offset } = clip.numbers; + const crossesVerticalLine = textBBox.x1 <= center2.x + offset.x && textBBox.x2 >= center2.x - offset.x; + if (crossesVerticalLine) { + verticalClipMask = { + x: center2.x, + y: clip.clipMask.y, + radius: this.text.getBBox().height / 2 + Vec216.length(offset) + }; + } + } + this.verticalLine.setClipMask(id, verticalClipMask); + } + updateCaps(datum, coords) { + const { horizontalEndCap, verticalEndCap } = this; + const { direction } = datum; + const { x1, y1, x2, y2 } = coords; + const center2 = Vec216.round(Vec412.center(coords), 0); + const { stroke: stroke22, strokeWidth, strokeOpacity } = this.getLineStyles(datum); + const capStyles = { stroke: stroke22, strokeWidth, strokeOpacity }; + if (direction !== "vertical") { + const angle2 = x1 <= x2 ? 0 : Math.PI; + let x = x2; + if (direction === "horizontal") { + x += x1 <= x2 ? -2 : 2; + } + horizontalEndCap.update({ ...capStyles, x, y: center2.y, angle: angle2 }); + } + if (direction !== "horizontal") { + const angle2 = y1 <= y2 ? Math.PI / 2 : Math.PI / -2; + let y = y2; + if (direction === "vertical") { + y += y1 <= y2 ? -2 : 2; + } + verticalEndCap.update({ ...capStyles, x: center2.x, y, angle: angle2 }); + } + } + updateBoundingLines(datum, extendedCoords) { + const { verticalStartLine, verticalEndLine, horizontalStartLine, horizontalEndLine } = this; + const { direction } = datum; + const { x1, y1, x2, y2 } = extendedCoords; + const lineStyles = this.getLineStyles(datum); + if (direction === "horizontal") { + verticalStartLine.setProperties({ ...lineStyles, x1, y1, x2: x1, y2 }); + verticalEndLine.setProperties({ ...lineStyles, x1: x2, y1, x2, y2 }); + } + if (direction === "vertical") { + horizontalStartLine.setProperties({ ...lineStyles, x1, y1, x2, y2: y1 }); + horizontalEndLine.setProperties({ ...lineStyles, x1, y1: y2, x2, y2 }); + } + } + updateStatistics(datum, coords, context) { + const point = Vec216.add(Vec412.bottomCenter(coords), Vec216.from(0, 10)); + const statistics = { volume: this.getVolume(datum) }; + if (datum.hasPriceRange) { + statistics.priceRange = { + percentage: this.getPriceRangePercentage(datum), + value: this.getPriceRangeValue(datum) + }; + } + if (datum.hasDateRange) { + statistics.dateRange = { + bars: this.getDateRangeBars(coords, context), + value: this.getDateRangeValue(datum) + }; + } + this.statistics.update(datum, statistics, point, coords, context, this.verticalDirection, datum.localeManager); + } + updateAnchor(_datum, coords, _context, _bbox) { + const point = Vec412.topCenter(coords); + Vec216.apply(this.anchor, module_support_exports.Transformable.toCanvasPoint(this.horizontalLine, point.x, point.y)); + } + getBackgroundPoints(_datum, verticalStart, verticalEnd, _bounds) { + const [startStart, startEnd] = Vec216.from(verticalStart); + const [endStart, endEnd] = Vec216.from(verticalEnd); + return [startStart, startEnd, endEnd, endStart]; + } + getLineStyles(datum) { + const { lineDashOffset, stroke: stroke22, strokeWidth, strokeOpacity } = datum; + return { + lineCap: datum.getLineCap(), + lineDash: datum.getLineDash(), + lineDashOffset, + stroke: stroke22, + strokeWidth, + strokeOpacity, + fillOpacity: 0 + }; + } + getBackgroundStyles(datum) { + const { background } = datum; + return { + fill: background.fill, + fillOpacity: background.fillOpacity + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + } + containsPoint(x, y) { + const { + horizontalLine, + text: text2, + verticalLine, + horizontalStartLine, + horizontalEndLine, + verticalStartLine, + verticalEndLine + } = this; + return super.containsPoint(x, y) || horizontalLine.isPointInPath(x, y) || verticalLine.isPointInPath(x, y) || horizontalStartLine.visible && horizontalStartLine.isPointInPath(x, y) || horizontalEndLine.visible && horizontalEndLine.isPointInPath(x, y) || verticalStartLine.visible && verticalStartLine.isPointInPath(x, y) || verticalEndLine.visible && verticalEndLine.isPointInPath(x, y) || Boolean(text2?.containsPoint(x, y)); + } + getNodeAtCoords(x, y) { + if (this.text?.containsPoint(x, y)) + return "text"; + if (this.start.containsPoint(x, y) || this.end.containsPoint(x, y)) + return "handle"; + return "line"; + } + getDateRangeBars(coords, context) { + const { step } = context.xAxis.scale; + const sign = coords.x1 <= coords.x2 ? 1 : -1; + return step ? Math.round(Vec412.width(coords) / step) * sign : 0; + } + getDateRangeValue(datum) { + const start2 = getGroupingValue(datum.start.x); + const end3 = getGroupingValue(datum.end.x); + if (!isDate(start2) || !isDate(end3)) { + throw new Error("Can not create a date range measurement of non-date x-axis."); + } + return end3.getTime() - start2.getTime(); + } + getPriceRangePercentage(datum) { + if (datum.start.y == null || datum.end.y == null) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + const endY = getGroupingValue(datum.end.y); + const startY = getGroupingValue(datum.start.y); + if (!isNumber(endY) || !isNumber(startY)) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + return (endY - startY) / startY; + } + getPriceRangeValue(datum) { + if (datum.start.y == null || datum.end.y == null) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + const endY = getGroupingValue(datum.end.y); + const startY = getGroupingValue(datum.start.y); + if (!isNumber(endY) || !isNumber(startY)) { + throw new Error("Can not create a price range measurement of a non-numeric y-axis"); + } + return endY - startY; + } + getVolume(datum) { + return datum.getVolume(datum.start.x, datum.end.x); + } +}; +var QuickMeasurerScene = class extends MeasurerScene { + constructor() { + super(...arguments); + this.type = "quick-measurer"; + } + static is(value) { + return AnnotationScene.isCheck(value, "quick-measurer"); + } + createStatisticsScene() { + return new QuickMeasurerStatisticsScene(); + } + getDirectionStyles(datum) { + return this.verticalDirection === "down" ? datum.down : datum.up; + } + getLineStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + ...super.getLineStyles(datum), + stroke: styles.stroke, + strokeWidth: styles.strokeWidth, + strokeOpacity: styles.strokeOpacity + }; + } + getBackgroundStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + fill: styles.fill, + fillOpacity: styles.fillOpacity + }; + } + getHandleStyles(datum) { + const styles = this.getDirectionStyles(datum); + return { + fill: styles.handle.fill, + stroke: styles.handle.stroke ?? styles.stroke, + strokeOpacity: styles.handle.strokeOpacity ?? styles.strokeOpacity, + strokeWidth: styles.handle.strokeWidth ?? styles.strokeWidth + }; + } +}; +var { StateMachine: StateMachine9, StateMachineProperty: StateMachineProperty9, Debug: Debug9 } = module_support_exports; +var MeasurerTypeStateMachine = class extends StateMachine9 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = this.createDatum(); + datum.set({ start: point, end: point }); + ctx.create(datum); + }; + const actionEndUpdate = ({ point }) => { + const { datum, node } = this; + datum?.set({ end: point }); + node?.toggleActive(true); + node?.toggleHandles({ end: false }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ end: true }); + }; + const actionCancel = () => ctx.delete(); + const onExitEnd = () => { + ctx.showAnnotationOptions(); + ctx.recordAction(`Create ${this.node?.type} annotation`); + }; + super("start", { + start: { + reset: StateMachine9.parent, + click: { + target: "end", + action: actionCreate + }, + drag: { + target: "end", + action: actionCreate + } + }, + end: { + hover: actionEndUpdate, + drag: actionEndUpdate, + click: { + target: StateMachine9.parent, + action: actionEndFinish + }, + dragEnd: { + target: StateMachine9.parent, + action: actionEndFinish + }, + reset: { + target: StateMachine9.parent, + action: actionCancel + }, + cancel: { + target: StateMachine9.parent, + action: actionCancel + }, + onExit: onExitEnd + } + }); + this.debug = Debug9.create(true, "annotations"); + } +}; +__decorateClass2([ + StateMachineProperty9() +], MeasurerTypeStateMachine.prototype, "datum", 2); +__decorateClass2([ + StateMachineProperty9() +], MeasurerTypeStateMachine.prototype, "node", 2); +var DateRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new DateRangeProperties(); + } +}; +var PriceRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new PriceRangeProperties(); + } +}; +var DatePriceRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new DatePriceRangeProperties(); + } +}; +var QuickDatePriceRangeStateMachine = class extends MeasurerTypeStateMachine { + createDatum() { + return new QuickDatePriceRangeProperties(); + } +}; +var dateRangeConfig = { + type: "date-range", + datum: DateRangeProperties, + scene: MeasurerScene, + isDatum: DateRangeProperties.is, + translate: (node, datum, translation, context) => { + if (DateRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (DateRangeProperties.is(datum) && DateRangeProperties.is(copiedDatum) && MeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (DateRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new DateRangeStateMachine({ + ...ctx, + create: createDatum( + "date-range" + /* DateRange */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var priceRangeConfig = { + type: "price-range", + datum: PriceRangeProperties, + scene: MeasurerScene, + isDatum: PriceRangeProperties.is, + translate: (node, datum, translation, context) => { + if (PriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (PriceRangeProperties.is(datum) && PriceRangeProperties.is(copiedDatum) && MeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (PriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new PriceRangeStateMachine({ + ...ctx, + create: createDatum( + "date-range" + /* DateRange */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var datePriceRangeConfig = { + type: "date-price-range", + datum: DatePriceRangeProperties, + scene: MeasurerScene, + isDatum: DatePriceRangeProperties.is, + translate: (node, datum, translation, context) => { + if (DatePriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (DatePriceRangeProperties.is(datum) && DatePriceRangeProperties.is(copiedDatum) && MeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (DatePriceRangeProperties.is(datum) && MeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new DatePriceRangeStateMachine({ + ...ctx, + create: createDatum( + "date-range" + /* DateRange */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var quickDatePriceRangeConfig = { + type: "quick-date-price-range", + datum: QuickDatePriceRangeProperties, + scene: QuickMeasurerScene, + isDatum: QuickDatePriceRangeProperties.is, + translate: (node, datum, translation, context) => { + if (QuickDatePriceRangeProperties.is(datum) && QuickMeasurerScene.is(node)) { + node.translate(datum, translation, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (QuickDatePriceRangeProperties.is(datum) && QuickDatePriceRangeProperties.is(copiedDatum) && QuickMeasurerScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (QuickDatePriceRangeProperties.is(datum) && QuickMeasurerScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new QuickDatePriceRangeStateMachine({ + ...ctx, + create: createDatum( + "quick-date-price-range" + /* QuickDatePriceRange */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var { ZIndexMap: ZIndexMap3 } = module_support_exports; +var NoteScene = class extends TextualPointScene { + constructor() { + super(); + this.type = "note"; + this.shape = new module_support_exports.Rect(); + this.iconBackground = new module_support_exports.TranslatableSvgPath( + "M22 1.83333C22 0.820811 21.1792 0 20.1667 0H1.83333C0.820811 0 0 0.82081 0 1.83333V13.9868C0 14.9994 0.820811 15.8202 1.83333 15.8202L5.88971 15.8202C6.44575 15.8202 6.97175 16.0725 7.31971 16.5062L9.57006 19.3112C10.304 20.2259 11.6962 20.2259 12.4301 19.3112L14.6804 16.5062C15.0284 16.0725 15.5544 15.8202 16.1104 15.8202L20.1667 15.8202C21.1792 15.8202 22 14.9994 22 13.9868V1.83333Z" + ); + this.iconLines = new module_support_exports.TranslatableSvgPath( + "M17.1114 5.75C17.1114 6.16421 16.7756 6.5 16.3614 6.5H5.63916C5.22495 6.5 4.88916 6.16421 4.88916 5.75V5.75C4.88916 5.33579 5.22495 5 5.63916 5H16.3614C16.7756 5 17.1114 5.33579 17.1114 5.75V5.75ZM17.1114 9.25C17.1114 9.66421 16.7756 10 16.3614 10H5.63916C5.22495 10 4.88916 9.66421 4.88916 9.25V9.25C4.88916 8.83579 5.22495 8.5 5.63916 8.5H16.3614C16.7756 8.5 17.1114 8.83579 17.1114 9.25V9.25Z" + ); + this.active = false; + this.shape.visible = false; + this.label.visible = false; + this.iconBackground.fillShadow = new module_support_exports.DropShadow(); + this.append([this.shape, this.label, this.iconBackground, this.iconLines, this.handle]); + } + static is(value) { + return AnnotationScene.isCheck( + value, + "note" + /* Note */ + ); + } + update(datum, context) { + this.updateIcon(datum, context); + super.update(datum, context); + } + getTextBBox(datum, coords, context) { + const bbox = super.getTextBBox(datum, coords, context); + bbox.x -= datum.width / 2; + bbox.x = clamp(0, bbox.x, context.seriesRect.width - datum.width); + const padding2 = datum.getPadding().top; + const topY = bbox.y - LABEL_OFFSET - padding2 * 2; + const bottomY = bbox.y + DivariantHandle.HANDLE_SIZE + padding2 * 2; + if (topY - bbox.height - TOOLBAR_OFFSET < 0) { + bbox.y = bottomY; + datum.position = "top"; + } else { + bbox.y = topY + padding2; + datum.position = "bottom"; + } + return bbox; + } + updateLabel(datum, bbox) { + const labelVisibility = datum.visible === false ? false : this.label.visible; + super.updateLabel(datum, bbox); + this.label.visible = labelVisibility; + this.label.text = wrapText(datum.text, { + maxWidth: 200, + font: datum, + textWrap: "always", + avoidOrphans: false + }); + } + updateShape(datum, bbox) { + const { shape } = this; + shape.fill = datum.background.fill; + shape.fillOpacity = datum.background.fillOpacity ?? 1; + shape.stroke = datum.background.stroke; + shape.strokeOpacity = datum.background.strokeOpacity ?? 1; + shape.strokeWidth = datum.background.strokeWidth ?? 1; + shape.cornerRadius = 4; + const padding2 = datum.getPadding().top; + const isPositionTop = datum.position === "top"; + shape.x = bbox.x - padding2; + shape.width = datum.width + padding2 * 2; + shape.height = bbox.height + padding2 * 2; + shape.y = bbox.y + (isPositionTop ? 0 : -bbox.height) - padding2; + } + updateIcon(datum, context) { + const { active, iconBackground, iconLines } = this; + const { x, y } = convertPoint(datum, context); + iconBackground.translationX = x - ICON_WIDTH / 2; + iconBackground.translationY = y - ICON_HEIGHT; + iconLines.translationX = iconBackground.translationX; + iconLines.translationY = iconBackground.translationY; + iconBackground.fill = datum.fill; + iconBackground.fillOpacity = datum.fillOpacity ?? 1; + iconBackground.stroke = datum.stroke; + iconBackground.strokeOpacity = datum.strokeOpacity ?? 1; + iconBackground.strokeWidth = datum.strokeWidth ?? 1; + iconLines.fill = datum.stroke; + if (active) { + iconBackground.fillShadow.color = datum.fill ?? "rgba(0, 0, 0, 0.22)"; + } else { + iconBackground.fillShadow.color = "rgba(0, 0, 0, 0.22)"; + } + } + updateAnchor(datum, bbox, context) { + const padding2 = datum.getPadding().top; + const isPositionTop = datum.position === "top"; + const direction = isPositionTop ? 1 : -1; + return { + x: bbox.x + context.seriesRect.x + datum.width / 2, + y: bbox.y + context.seriesRect.y + direction * (bbox.height + padding2), + position: isPositionTop ? "below" : "above" + }; + } + getLabelCoords(datum, bbox) { + const isPositionTop = datum.position === "top"; + const padding2 = datum.getPadding().top + calcLineHeight(datum.fontSize, ANNOTATION_TEXT_LINE_HEIGHT) / 2; + return { x: bbox.x, y: bbox.y + (isPositionTop ? padding2 / 2 : 0) }; + } + getTextBaseline(datum) { + return datum.position === "top" ? "middle" : datum.position; + } + getHandleCoords(_datum, coords, _bbox) { + return { + x: coords.x, + y: coords.y + DivariantHandle.HANDLE_SIZE / 2 + 4 + }; + } + getHandleStyles(datum) { + return { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.fill, + strokeOpacity: datum.handle.strokeOpacity, + strokeWidth: datum.handle.strokeWidth + }; + } + toggleHovered(hovered, active, readOnly) { + super.toggleHovered(hovered, active, readOnly); + const visible = hovered || active && !readOnly; + this.label.visible = visible; + this.shape.visible = visible; + this.zIndex = visible ? ZIndexMap3.CHART_ANNOTATION_FOCUSED : ZIndexMap3.CHART_ANNOTATION; + } + toggleActive(active) { + super.toggleActive(active); + this.label.visible = active; + this.shape.visible = active; + this.active = active; + } + containsPoint(x, y) { + if (this.shape.visible && this.shape.containsPoint(x, y)) + return true; + if (this.iconBackground.containsPoint(x, y)) + return true; + return super.containsPoint(x, y); + } +}; +var NoteStateMachine = class extends TextualPointStateMachine { + createDatum() { + return new NoteProperties(); + } +}; +var noteConfig = { + type: "note", + datum: NoteProperties, + scene: NoteScene, + isDatum: NoteProperties.is, + translate: (node, datum, transition, context) => { + if (NoteProperties.is(datum) && NoteScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (NoteProperties.is(datum) && NoteProperties.is(copiedDatum) && NoteScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (NoteProperties.is(datum) && NoteScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new NoteStateMachine({ + ...ctx, + create: createDatum( + "note" + /* Note */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var { Vec2: Vec217, Vec4: Vec413 } = module_support_exports; +var ParallelChannelScene = class extends ChannelScene { + constructor() { + super(); + this.type = "parallel-channel"; + this.handles = { + topLeft: new DivariantHandle(), + topMiddle: new UnivariantHandle(), + topRight: new DivariantHandle(), + bottomLeft: new DivariantHandle(), + bottomMiddle: new UnivariantHandle(), + bottomRight: new DivariantHandle() + }; + this.middleLine = new CollidableLine(); + this.append([this.background, this.topLine, this.middleLine, this.bottomLine, ...Object.values(this.handles)]); + } + static is(value) { + return AnnotationScene.isCheck(value, "parallel-channel"); + } + dragHandle(datum, target, context, snapping) { + const { activeHandle, handles } = this; + if (activeHandle == null) + return; + const { offset } = handles[activeHandle].drag(target); + handles[activeHandle].toggleDragging(true); + if (activeHandle === "topMiddle" || activeHandle === "bottomMiddle") { + offset.x = 0; + } + let translateVectors = []; + let allowSnapping = snapping; + switch (activeHandle) { + case "topLeft": + case "bottomLeft": + translateVectors = ["topLeft", "bottomLeft"]; + break; + case "topMiddle": + translateVectors = ["topLeft", "topRight"]; + offset.y -= UnivariantHandle.HANDLE_SIZE / 2; + allowSnapping = false; + break; + case "topRight": + case "bottomRight": + translateVectors = ["topRight", "bottomRight"]; + break; + case "bottomMiddle": + translateVectors = ["bottomLeft", "bottomRight"]; + offset.y -= UnivariantHandle.HANDLE_SIZE / 2; + allowSnapping = false; + break; + } + const top = convertLine(datum, context); + const bottom = convertLine(datum.bottom, context); + if (!top || !bottom) + return; + const vectors = { + topLeft: Vec413.start(top), + topRight: Vec413.end(top), + bottomLeft: Vec413.start(bottom), + bottomRight: Vec413.end(bottom) + }; + const snap = { + vectors: { + topLeft: vectors.topRight, + bottomLeft: vectors.bottomRight, + topRight: vectors.topLeft, + bottomRight: vectors.bottomLeft + }, + angle: datum.snapToAngle + }; + const points = translate(vectors, offset, context, { + overflowContinuous: this.overflowContinuous, + translateVectors, + snap: allowSnapping ? snap : void 0 + }); + datum.start.x = points.topLeft.x; + datum.start.y = points.topLeft.y; + datum.end.x = points.topRight.x; + datum.end.y = points.topRight.y; + datum.height = points.topLeft.y - points.bottomLeft.y; + } + getTranslatePointsVectors(start2, end3) { + const { bottomLeft, topLeft } = this.handles; + const height2 = bottomLeft.getBBox().y - topLeft.getBBox().y; + const bottomStart = Vec217.add(start2, Vec217.from(0, height2)); + const bottomEnd = Vec217.add(end3, Vec217.from(0, height2)); + return { start: start2, end: end3, bottomStart, bottomEnd }; + } + containsPoint(x, y) { + return super.containsPoint(x, y) || this.middleLine.visible && this.middleLine.strokeWidth > 0 && this.middleLine.containsPoint(x, y); + } + getNodeAtCoords(x, y) { + if (this.middleLine.visible && this.middleLine.strokeWidth > 0 && this.middleLine.containsPoint(x, y)) + return "line"; + return super.getNodeAtCoords(x, y); + } + updateLines(datum, top, bottom, context, naturalTop, naturalBottom) { + const { topLine, middleLine, bottomLine } = this; + const { lineDashOffset, stroke: stroke22, strokeOpacity, strokeWidth } = datum; + const lineDash = datum.getLineDash(); + const lineStyles = { + lineCap: datum.getLineCap(), + lineDash, + lineDashOffset, + stroke: stroke22, + strokeOpacity, + strokeWidth + }; + topLine.setProperties({ ...top, ...lineStyles }); + bottomLine.setProperties({ ...bottom, ...lineStyles }); + const middlePoints = this.extendLine( + { + x1: naturalTop.x1, + y1: naturalBottom.y1 + (naturalTop.y1 - naturalBottom.y1) / 2, + x2: naturalTop.x2, + y2: naturalBottom.y2 + (naturalTop.y2 - naturalBottom.y2) / 2 + }, + datum, + context + ); + middleLine.setProperties({ + ...middlePoints, + lineDash: datum.middle.lineDash ?? lineDash, + lineDashOffset: datum.middle.lineDashOffset ?? lineDashOffset, + stroke: datum.middle.stroke ?? stroke22, + strokeOpacity: datum.middle.strokeOpacity ?? strokeOpacity, + strokeWidth: datum.middle.strokeWidth ?? strokeWidth, + visible: datum.middle.visible ?? true + }); + } + updateHandles(datum, top, bottom) { + const { + handles: { topLeft, topMiddle, topRight, bottomLeft, bottomMiddle, bottomRight } + } = this; + const handleStyles = { + fill: datum.handle.fill, + stroke: datum.handle.stroke ?? datum.stroke, + strokeOpacity: datum.handle.strokeOpacity ?? datum.strokeOpacity, + strokeWidth: datum.handle.strokeWidth ?? datum.strokeWidth + }; + topLeft.update({ ...handleStyles, ...Vec413.start(top) }); + topRight.update({ ...handleStyles, ...Vec413.end(top) }); + bottomLeft.update({ ...handleStyles, ...Vec413.start(bottom) }); + bottomRight.update({ ...handleStyles, ...Vec413.end(bottom) }); + topMiddle.update({ + ...handleStyles, + ...Vec217.sub(Vec413.center(top), Vec217.from(topMiddle.handle.width / 2, topMiddle.handle.height / 2)) + }); + bottomMiddle.update({ + ...handleStyles, + ...Vec217.sub(Vec413.center(bottom), Vec217.from(bottomMiddle.handle.width / 2, bottomMiddle.handle.height / 2)) + }); + } + updateText(datum, top, bottom) { + this.text = this.updateNode(CollidableText, this.text, !!datum.text.label); + updateChannelText(true, top, bottom, datum.text, datum.strokeWidth, this.text, datum.text.label); + } + getBackgroundPoints(datum, top, bottom, bounds) { + const isFlippedX = top.x1 > top.x2; + const isFlippedY = top.y1 > top.y2; + const outOfBoundsStart = top.x1 !== bottom.x1 && top.y1 !== bottom.y1; + const outOfBoundsEnd = top.x2 !== bottom.x2 && top.y2 !== bottom.y2; + const points = Vec217.from(top); + if (datum.extendEnd && outOfBoundsEnd) { + points.push(Vec217.from(isFlippedX ? bounds.x1 : bounds.x2, isFlippedY ? bounds.y1 : bounds.y2)); + } + points.push(...Vec217.from(bottom).reverse()); + if (datum.extendStart && outOfBoundsStart) { + points.push(Vec217.from(isFlippedX ? bounds.x2 : bounds.x1, isFlippedY ? bounds.y2 : bounds.y1)); + } + return points; + } +}; +var { StateMachine: StateMachine10, StateMachineProperty: StateMachineProperty10, Debug: Debug10 } = module_support_exports; +var ParallelChannelStateMachine = class extends StateMachine10 { + constructor(ctx) { + const actionCreate = ({ point }) => { + const datum = new ParallelChannelProperties(); + datum.set({ start: point, end: point, height: 0 }); + ctx.create(datum); + }; + const actionFirstRender = () => { + const { node } = this; + node?.toggleActive(true); + node?.toggleHandles({ + topLeft: true, + topMiddle: false, + topRight: false, + bottomLeft: false, + bottomMiddle: false, + bottomRight: false + }); + }; + const actionEndUpdate = ({ offset, context }) => { + const { datum, snapping } = this; + if (!datum) + return; + datum.set({ end: snapPoint(offset, context, snapping, datum.start, datum.snapToAngle) }); + ctx.update(); + }; + const actionEndFinish = () => { + this.node?.toggleHandles({ + topRight: true + }); + ctx.update(); + }; + const actionHeightUpdate = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !isNumber(startY) || !isNumber(endY) || !isNumber(pointY)) + return; + const height2 = endY - (pointY ?? 0); + const bottomStartY = startY - height2; + node?.toggleHandles({ bottomLeft: true, bottomRight: true }); + if (!ctx.validatePoint({ x: datum.start.x, y: bottomStartY }, { overflowContinuous: true }) || !ctx.validatePoint({ x: datum.end.x, y: point.y }, { overflowContinuous: true })) { + return; + } + datum.set({ height: height2 }); + ctx.update(); + }; + const actionHeightFinish = ({ point }) => { + const { datum, node } = this; + const endY = getGroupingValue(datum?.end.y); + const startY = getGroupingValue(datum?.start.y); + const { y: pointY } = point; + if (datum == null || !isNumber(startY) || !isNumber(endY) || !isNumber(pointY)) + return; + const height2 = endY - (pointY ?? 0); + const bottomStartY = startY - height2; + node?.toggleHandles(true); + if (!ctx.validatePoint({ x: datum.start.x, y: bottomStartY }, { overflowContinuous: true }) || !ctx.validatePoint({ x: datum.end.x, y: point.y }, { overflowContinuous: true })) { + return; + } + datum.set({ height: height2 }); + ctx.recordAction(`Create ${"parallel-channel"} annotation`); + ctx.showAnnotationOptions(); + ctx.update(); + }; + const actionCancel = () => ctx.delete(); + super("start", { + start: { + click: { + target: "waiting-first-render", + action: actionCreate + }, + drag: { + target: "waiting-first-render", + action: actionCreate + }, + reset: StateMachine10.parent + }, + "waiting-first-render": { + render: { + target: "end", + action: actionFirstRender + } + }, + end: { + hover: actionEndUpdate, + drag: actionEndUpdate, + click: { + target: "height", + action: actionEndFinish + }, + dragEnd: { + target: "height", + action: actionEndFinish + }, + reset: { + target: StateMachine10.parent, + action: actionCancel + }, + cancel: { + target: StateMachine10.parent, + action: actionCancel + } + }, + height: { + hover: actionHeightUpdate, + click: { + target: StateMachine10.parent, + action: actionHeightFinish + }, + drag: { + target: StateMachine10.parent, + action: actionHeightFinish + }, + reset: { + target: StateMachine10.parent, + action: actionCancel + }, + cancel: { + target: StateMachine10.parent, + action: actionCancel + } + } + }); + this.debug = Debug10.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass2([ + StateMachineProperty10() +], ParallelChannelStateMachine.prototype, "datum", 2); +__decorateClass2([ + StateMachineProperty10() +], ParallelChannelStateMachine.prototype, "node", 2); +__decorateClass2([ + StateMachineProperty10() +], ParallelChannelStateMachine.prototype, "snapping", 2); +var parallelChannelConfig = { + type: "parallel-channel", + datum: ParallelChannelProperties, + scene: ParallelChannelScene, + isDatum: ParallelChannelProperties.is, + translate: (node, datum, transition, context) => { + if (ParallelChannelProperties.is(datum) && ParallelChannelScene.is(node)) { + node.translate(datum, transition, context); + } + }, + copy: (node, datum, copiedDatum, context) => { + if (ParallelChannelProperties.is(datum) && ParallelChannelProperties.is(copiedDatum) && ParallelChannelScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (ParallelChannelProperties.is(datum) && ParallelChannelScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new ParallelChannelStateMachine({ + ...ctx, + create: createDatum( + "parallel-channel" + /* ParallelChannel */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var TextScene = class extends TextualPointScene { + constructor() { + super(); + this.type = "text"; + this.append([this.label, this.handle]); + } + static is(value) { + return AnnotationScene.isCheck( + value, + "text" + /* Text */ + ); + } + getHandleCoords(_datum, point) { + const halfSize = DivariantHandle.HANDLE_SIZE / 2; + return { + x: point.x + halfSize, + y: point.y + 2 + halfSize + }; + } +}; +var TextStateMachine = class extends TextualPointStateMachine { + createDatum() { + return new TextProperties(); + } +}; +var textConfig = { + type: "text", + datum: TextProperties, + scene: TextScene, + isDatum: TextProperties.is, + translate: (node, datum, transition, context) => { + if (TextProperties.is(datum) && TextScene.is(node)) + node.translate(datum, transition, context); + }, + copy: (node, datum, copiedDatum, context) => { + if (TextProperties.is(datum) && TextProperties.is(copiedDatum) && TextScene.is(node)) { + return node.copy(datum, copiedDatum, context); + } + }, + update: (node, datum, context) => { + if (TextProperties.is(datum) && TextScene.is(node)) { + node.update(datum, context); + } + }, + createState: (ctx, { createDatum }) => new TextStateMachine({ + ...ctx, + create: createDatum( + "text" + /* Text */ + ) + }), + dragState: (ctx) => new DragStateMachine(ctx) +}; +var annotationConfigs = { + // Lines + [lineConfig.type]: lineConfig, + [horizontalLineConfig.type]: horizontalLineConfig, + [verticalLineConfig.type]: verticalLineConfig, + // Channels + [parallelChannelConfig.type]: parallelChannelConfig, + [disjointChannelConfig.type]: disjointChannelConfig, + // Fibonaccis + [fibonacciRetracementConfig.type]: fibonacciRetracementConfig, + [fibonacciRetracementTrendBasedConfig.type]: fibonacciRetracementTrendBasedConfig, + // Texts + [calloutConfig.type]: calloutConfig, + [commentConfig.type]: commentConfig, + [noteConfig.type]: noteConfig, + [textConfig.type]: textConfig, + // Shapes + [arrowConfig.type]: arrowConfig, + [arrowUpConfig.type]: arrowUpConfig, + [arrowDownConfig.type]: arrowDownConfig, + // Measurers + [dateRangeConfig.type]: dateRangeConfig, + [priceRangeConfig.type]: priceRangeConfig, + [datePriceRangeConfig.type]: datePriceRangeConfig, + [quickDatePriceRangeConfig.type]: quickDatePriceRangeConfig +}; +function getTypedDatum(datum) { + for (const { isDatum } of Object.values(annotationConfigs)) { + if (isDatum(datum)) { + return datum; + } + } +} +var { ActionOnSet: ActionOnSet2, ParallelStateMachine: ParallelStateMachine2, StateMachine: StateMachine11, StateMachineProperty: StateMachineProperty11, Debug: Debug11 } = module_support_exports; +var AnnotationsStateMachine = class extends ParallelStateMachine2 { + constructor(ctx) { + super( + new SnappingStateMachine((snapping) => { + this.snapping = snapping; + }), + new UpdateMachine(() => { + this.node = this.active == null ? void 0 : ctx.node(this.active); + }), + new AnnotationsMainStateMachine(ctx, (index) => { + this.active = index; + this.datum = this.active == null ? void 0 : ctx.datum(this.active); + this.node = this.active == null ? void 0 : ctx.node(this.active); + }) + ); + this.snapping = false; + } + // TODO: remove this leak + getActive() { + return this.active; + } + // TODO: remove this leak + isActive(index) { + return index === this.active; + } +}; +__decorateClass2([ + StateMachineProperty11() +], AnnotationsStateMachine.prototype, "snapping", 2); +__decorateClass2([ + StateMachineProperty11() +], AnnotationsStateMachine.prototype, "datum", 2); +__decorateClass2([ + StateMachineProperty11() +], AnnotationsStateMachine.prototype, "node", 2); +var SnappingStateMachine = class extends StateMachine11 { + constructor(setSnapping) { + super("idle", { + [ + "idle" + /* Idle */ + ]: { + hover: ({ shiftKey }) => setSnapping(shiftKey), + keyDown: ({ shiftKey }) => setSnapping(shiftKey), + keyUp: ({ shiftKey }) => setSnapping(shiftKey), + click: ({ shiftKey }) => setSnapping(shiftKey), + drag: ({ shiftKey }) => setSnapping(shiftKey) + }, + [ + "dragging" + /* Dragging */ + ]: {}, + [ + "translating" + /* Translating */ + ]: {}, + [ + "text-input" + /* TextInput */ + ]: {} + }); + } +}; +var UpdateMachine = class extends StateMachine11 { + constructor(update) { + super("idle", { + [ + "idle" + /* Idle */ + ]: { + onEnter: update, + render: update + }, + [ + "dragging" + /* Dragging */ + ]: { + onEnter: update, + render: update + }, + [ + "translating" + /* Translating */ + ]: { + onEnter: update, + render: update + }, + [ + "text-input" + /* TextInput */ + ]: { + render: update + } + }); + } +}; +var AnnotationsMainStateMachine = class extends StateMachine11 { + constructor(ctx, setActive) { + const createDatum = (type) => (datum) => { + ctx.create(type, datum); + this.active = ctx.selectLast(); + }; + const deleteDatum = () => { + if (this.active != null) + ctx.delete(this.active); + this.active = void 0; + ctx.select(); + }; + const stateMachineHelpers = { + createDatum + }; + const createStateMachineContext = { + ...ctx, + delete: deleteDatum, + showTextInput: () => { + if (this.active != null) + ctx.showTextInput(this.active); + }, + deselect: () => { + const prevActive = this.active; + this.active = void 0; + this.hovered = void 0; + ctx.select(this.active, prevActive); + }, + showAnnotationOptions: () => { + if (this.active != null) + ctx.showAnnotationOptions(this.active); + } + }; + const createStateMachines = Object.fromEntries( + Object.entries(annotationConfigs).map(([type, config]) => [ + type, + config.createState(createStateMachineContext, stateMachineHelpers) + ]) + ); + const dragStateMachines = Object.fromEntries( + Object.entries(annotationConfigs).map(([type, config]) => [ + type, + config.dragState(ctx, stateMachineHelpers) + ]) + ); + const actionColor = ({ + colorPickerType, + colorOpacity, + color: color6, + opacity, + isMultiColor + }) => { + if (!this.datum) + return; + if (colorPickerType === "text-color") { + ctx.updateTextInputColor(color6); + } + setColor(this.datum, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + ctx.update(); + }; + const actionFontSize = (fontSize) => { + const { datum, node } = this; + if (!datum || !node) + return; + if (isTextType(datum)) { + datum.fontSize = fontSize; + ctx.updateTextInputFontSize(fontSize); + } else if (hasLineText(datum)) { + datum.text.fontSize = fontSize; + } + ctx.update(); + }; + const actionLineStyle = (lineStyle) => { + const { datum, node } = this; + if (!datum || !node || !hasLineStyle(datum)) + return; + setLineStyle(datum, lineStyle); + ctx.update(); + }; + const actionUpdateTextInputBBox = (bbox) => { + const { node } = this; + if (!node || !("setTextInputBBox" in node)) + return; + node.setTextInputBBox(bbox); + ctx.update(); + }; + const actionSaveText = ({ textInputValue, bbox }) => { + const { datum } = this; + if (bbox != null && textInputValue != null && textInputValue.length > 0) { + if (!isTextType(datum)) { + return; + } + const wrappedText = maybeWrapText(datum, textInputValue, bbox.width); + datum.set({ text: wrappedText }); + ctx.update(); + ctx.recordAction(`Change ${datum.type} annotation text`); + } else { + ctx.delete(this.active); + ctx.recordAction(`Delete ${datum?.type} annotation`); + } + }; + const actionCancel = () => { + ctx.updateTextInputBBox(void 0); + }; + const guardActive = () => this.active != null; + const guardCopied = () => this.copied != null; + const guardActiveHasLineText = () => { + const { active, datum } = this; + if (active == null) + return false; + if (!datum) + return false; + return hasLineText(datum) && datum.isWriteable(); + }; + const guardActiveNotEphemeral = () => this.active != null && !isEphemeralType(this.datum); + const guardHovered = () => this.hovered != null; + super("idle", { + [ + "idle" + /* Idle */ + ]: { + onEnter: () => { + ctx.select(this.active, this.active); + if (this.hoverCoords) { + this.hovered = ctx.hoverAtCoords(this.hoverCoords, this.active, this.hovered); + } + }, + hover: ({ offset }) => { + this.hovered = ctx.hoverAtCoords(offset, this.active, this.hovered); + this.hoverCoords = offset; + }, + translate: { + guard: guardActive, + target: "translating", + action: ({ translation }) => { + ctx.startInteracting(); + ctx.translate(this.active, translation); + ctx.update(); + } + }, + copy: { + guard: guardActiveNotEphemeral, + action: () => { + this.copied = ctx.copy(this.active); + } + }, + cut: { + guard: guardActiveNotEphemeral, + action: () => { + this.copied = ctx.copy(this.active); + deleteDatum(); + } + }, + paste: { + guard: guardCopied, + action: () => { + ctx.paste(this.copied); + } + }, + selectLast: () => { + const previousActive = this.active; + this.active = ctx.selectLast(); + ctx.select(this.active, previousActive); + }, + click: [ + { + guard: () => { + const { active, hovered, datum } = this; + if (active == null || hovered !== active) + return false; + if (!datum) + return false; + return isTextType(datum) && datum.isWriteable(); + }, + target: "text-input" + /* TextInput */ + }, + { + action: () => { + const prevActive = this.active; + this.active = this.hovered; + ctx.select(this.active, prevActive); + } + } + ], + dblclick: { + guard: guardActiveHasLineText, + action: ({ offset }) => { + const nodeAtCoords = ctx.getNodeAtCoords(offset, this.active) === "text" ? "text" : "line"; + ctx.showAnnotationSettings(this.active, void 0, nodeAtCoords); + } + }, + dragStart: [ + { + guard: guardHovered, + target: "dragging", + action: () => { + const prevActive = this.active; + this.active = this.hovered; + ctx.select(this.active, prevActive); + ctx.startInteracting(); + } + }, + { + action: () => { + const prevActive = this.active; + this.active = this.hovered; + ctx.select(this.active, prevActive); + } + } + ], + color: { + guard: guardActive, + action: actionColor + }, + fontSize: { + guard: guardActive, + action: actionFontSize + }, + lineProps: { + guard: guardActive, + action: (props) => { + const datum = getTypedDatum(this.datum); + datum?.set(props); + ctx.update(); + ctx.recordAction( + `Change ${datum?.type} ${Object.entries(props).map(([key, value]) => `${key} to ${value}`).join(", ")}` + ); + } + }, + lineStyle: { + guard: guardActive, + action: actionLineStyle + }, + lineText: { + guard: guardActive, + action: (props) => { + const datum = getTypedDatum(this.datum); + if (!hasLineText(datum)) + return; + if (isChannelType(datum) && props.position === "center") { + props.position = "inside"; + } + datum.text.set(props); + ctx.update(); + } + }, + updateTextInputBBox: { + guard: guardActive, + action: actionUpdateTextInputBBox + }, + toolbarPressSettings: { + guard: guardActiveHasLineText, + action: (sourceEvent) => { + ctx.showAnnotationSettings(this.active, sourceEvent); + } + }, + reset: () => { + if (this.active != null) { + this.node?.toggleActive(false); + } + this.hovered = void 0; + this.active = void 0; + ctx.select(this.active, this.active); + ctx.resetToIdle(); + }, + delete: () => { + if (this.active == null) + return; + ctx.delete(this.active); + if (isEphemeralType(this.datum)) + return; + ctx.recordAction(`Delete ${this.datum?.type} annotation`); + }, + deleteAll: () => { + ctx.deleteAll(); + }, + ...createStateMachines + }, + [ + "dragging" + /* Dragging */ + ]: { + onEnter: (_, data) => { + if (this.active == null) + return; + const type = ctx.getAnnotationType(this.active); + if (!type) + return; + this.transitionRoot(type); + this.transitionRoot("dragStart", data); + }, + ...dragStateMachines + }, + [ + "translating" + /* Translating */ + ]: { + onEnter: () => { + }, + translate: { + guard: guardActive, + target: "translating", + action: ({ translation }) => { + ctx.startInteracting(); + ctx.translate(this.active, translation); + ctx.update(); + } + }, + translateEnd: { + guard: guardActive, + target: "idle" + /* Idle */ + }, + onExit: () => { + ctx.stopInteracting(); + ctx.update(); + ctx.recordAction("Translate annotation"); + } + }, + [ + "text-input" + /* TextInput */ + ]: { + onEnter: () => { + if (this.active == null) + return; + const datum = getTypedDatum(this.datum); + if (!datum || !("getTextInputCoords" in datum)) + return; + ctx.startInteracting(); + ctx.showTextInput(this.active); + datum.visible = false; + ctx.update(); + }, + updateTextInputBBox: { + guard: guardActive, + action: actionUpdateTextInputBBox + }, + resize: { + target: "idle", + action: actionSaveText + }, + click: { + target: "idle", + action: actionSaveText + }, + drag: { + target: "idle", + action: actionSaveText + }, + textInput: [ + { + guard: guardCancelAndExit, + target: "idle", + action: actionCancel + }, + { + guard: guardSaveAndExit, + target: "idle", + action: actionSaveText + } + ], + color: { + guard: guardActive, + action: actionColor + }, + fontSize: { + guard: guardActive, + action: actionFontSize + }, + cancel: { + target: "idle", + action: actionCancel + }, + onExit: () => { + ctx.stopInteracting(); + ctx.hideTextInput(); + const wasActive = this.active; + this.active = this.hovered = void 0; + ctx.select(this.active, wasActive); + if (wasActive == null) + return; + const datum = ctx.datum(wasActive); + const node = ctx.node(wasActive); + if (!datum || !node) + return; + datum.visible = true; + } + } + }); + this.setActive = setActive; + this.debug = Debug11.create(true, "annotations"); + this.snapping = false; + } +}; +__decorateClass2([ + ActionOnSet2({ + changeValue(newValue) { + this.setActive(newValue); + } + }), + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "active", 2); +__decorateClass2([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "hovered", 2); +__decorateClass2([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "hoverCoords", 2); +__decorateClass2([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "copied", 2); +__decorateClass2([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "snapping", 2); +__decorateClass2([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "datum", 2); +__decorateClass2([ + StateMachineProperty11() +], AnnotationsMainStateMachine.prototype, "node", 2); +var { ActionOnSet: ActionOnSet22, LayoutElement: LayoutElement2, Menu: Menu22, PropertiesArray: PropertiesArray22, ToolbarButtonProperties: ToolbarButtonProperties22, Property: Property31, ChartAxisDirection: ChartAxisDirection7 } = module_support_exports; +var AnnotationsToolbarButtonProperties = class extends ToolbarButtonProperties22 { +}; +__decorateClass2([ + Property31 +], AnnotationsToolbarButtonProperties.prototype, "value", 2); +var AnnotationsToolbar = class extends module_support_exports.BaseProperties { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + this.padding = 20; + this.buttons = new PropertiesArray22(AnnotationsToolbarButtonProperties); + this.events = new EventEmitter(); + this.annotationMenu = new Menu22(this.ctx, "annotations"); + this.cleanup = new CleanupRegistry(); + this.toolbar = ctx.sharedToolbar.getSharedToolbar("annotations"); + const onKeyDown = this.onKeyDown.bind(this); + this.toolbar.addListener("keydown", onKeyDown); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onToolbarButtonPress.bind(this)), + ctx.layoutManager.registerElement(LayoutElement2.ToolbarLeft, this.onLayoutStart.bind(this)), + () => { + this.toolbar.removeListener("keydown", onKeyDown); + this.toolbar.destroy(); + } + ); + } + destroy() { + this.cleanup.flush(); + } + toggleClearButtonEnabled(enabled) { + const index = this.buttons.findIndex((button) => button.value === "clear"); + this.toolbar.toggleButtonEnabledByIndex(index, enabled); + } + resetButtonIcons() { + for (const [index, button] of this.buttons.entries()) { + switch (button.value) { + case "line-menu": + this.updateButtonByIndex(index, { icon: "trend-line-drawing", value: "line-menu" }); + break; + case "fibonacci-menu": + this.updateButtonByIndex(index, { icon: "fibonacci-retracement-drawing", value: "fibonacci-menu" }); + break; + case "text-menu": + this.updateButtonByIndex(index, { icon: "text-annotation", value: "text-menu" }); + break; + case "shape-menu": + this.updateButtonByIndex(index, { icon: "arrow-drawing", value: "shape-menu" }); + break; + case "measurer-menu": + this.updateButtonByIndex(index, { icon: "measurer-drawing", value: "measurer-menu" }); + break; + } + } + } + hideOverlays() { + this.annotationMenu.hide(); + } + clearActiveButton() { + this.toolbar.clearActiveButton(); + } + onLayoutStart(event) { + if (!this.enabled) + return; + this.toolbar.updateButtons(this.buttons); + this.toolbar.layout(event.layoutBox, this.padding); + } + refreshButtonsEnabled(enabled) { + for (const [index, button] of this.buttons.entries()) { + if (!button) + continue; + this.toolbar.toggleButtonEnabledByIndex(index, enabled); + } + } + onToolbarButtonPress({ + event, + button, + buttonBounds, + buttonWidget + }) { + const axisScale = this.ctx.axisManager.getAxisContext(ChartAxisDirection7.Y)[0].scale; + switch (button.value) { + case "clear": + this.events.emit("pressed-clear", null); + break; + case "line-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsLineAnnotations", + LINE_ANNOTATION_ITEMS.filter((item) => item.visible ? item.visible(axisScale) : true) + ); + break; + case "fibonacci-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsFibonacciAnnotations", + FIBONACCI_ANNOTATION_ITEMS + ); + break; + case "text-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsTextAnnotations", + TEXT_ANNOTATION_ITEMS + ); + break; + case "shape-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsShapeAnnotations", + SHAPE_ANNOTATION_ITEMS + ); + break; + case "measurer-menu": + this.onToolbarButtonPressShowMenu( + event, + buttonBounds, + buttonWidget, + button.value, + "toolbarAnnotationsMeasurerAnnotations", + MEASURER_ANNOTATION_ITEMS + ); + break; + } + } + onToolbarButtonPressShowMenu(event, buttonBounds, controller, menu, ariaLabel, items) { + this.events.emit("pressed-show-menu", null); + const index = this.buttons.findIndex((button) => button.value === menu); + this.toolbar.toggleActiveButtonByIndex(index); + this.annotationMenu.setAnchor({ x: buttonBounds.x + buttonBounds.width + 6, y: buttonBounds.y }); + this.annotationMenu.show(controller, { + items, + ariaLabel: this.ctx.localeManager.t(ariaLabel), + class: "ag-charts-annotations__toolbar-menu", + sourceEvent: event.sourceEvent, + onPress: this.onButtonPressMenuCreateAnnotation.bind(this, menu) + }); + } + onButtonPressMenuCreateAnnotation(menu, item) { + const index = this.buttons.findIndex((button) => button.value === menu); + this.updateButtonByIndex(index, { icon: item.icon }); + this.events.emit("pressed-create-annotation", { annotation: item.value }); + this.annotationMenu.hide(); + } + onKeyDown({ sourceEvent }) { + if (sourceEvent.key === "Escape") { + this.events.emit("cancel-create-annotation", null); + } + } + updateButtonByIndex(index, change) { + const button = this.buttons.at(index); + if (!button) + return; + button.set({ ...button.toJson(), ...change, value: change.value ?? button.value }); + this.toolbar.updateButtonByIndex(index, { ...button.toJson() }); + } +}; +__decorateClass2([ + Property31, + ActionOnSet22({ + changeValue(enabled) { + this.toolbar?.setHidden(!enabled); + } + }) +], AnnotationsToolbar.prototype, "enabled", 2); +__decorateClass2([ + Property31 +], AnnotationsToolbar.prototype, "padding", 2); +__decorateClass2([ + Property31 +], AnnotationsToolbar.prototype, "buttons", 2); +var { BaseModuleInstance: BaseModuleInstance2, InteractionState: InteractionState2, Property: Property32, ChartAxisDirection: ChartAxisDirection8, getIconClassNames: getIconClassNames2 } = module_support_exports; +var DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS = `ag-charts-annotations__axis-button`; +var AxisButton = class extends BaseModuleInstance2 { + constructor(ctx, axisCtx, onButtonClick, seriesRect) { + super(); + this.ctx = ctx; + this.axisCtx = axisCtx; + this.onButtonClick = onButtonClick; + this.seriesRect = seriesRect; + this.enabled = true; + this.snap = false; + this.padding = 0; + this.button = this.setup(); + this.toggleVisibility(false); + this.updateButtonElement(); + this.snap = Boolean(axisCtx.scale.bandwidth); + ctx.domManager.addEventListener("focusin", ({ target }) => { + const htmlTarget = target instanceof HTMLElement ? target : void 0; + const isSeriesAreaChild = htmlTarget && ctx.domManager.contains(htmlTarget, "series-area"); + if (!isSeriesAreaChild && htmlTarget !== this.button.getElement()) + this.hide(); + }); + this.cleanup.register( + ctx.widgets.seriesWidget.addListener("drag-move", (e) => this.onMouseDrag(e)), + ctx.widgets.seriesWidget.addListener("mousemove", (e) => this.onMouseMove(e)), + ctx.widgets.seriesWidget.addListener("mouseleave", () => this.onMouseLeave()), + ctx.widgets.seriesDragInterpreter?.events.on("click", (e) => this.onClick(e)), + ctx.eventsHub.on("series:focus-change", () => this.onKeyPress()), + ctx.eventsHub.on("zoom:pan-start", () => this.hide()), + ctx.eventsHub.on("zoom:change", () => this.hide()), + () => this.destroyElements(), + () => this.button.destroy() + ); + } + update(seriesRect, padding2) { + this.seriesRect = seriesRect; + this.padding = padding2; + } + setup() { + const button = new exports_exports.ButtonWidget(); + button.addClass(DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS); + button.setTabIndex(-1); + button.setAriaLabel(this.ctx.localeManager.t("ariaLabelAddHorizontalLine")); + this.ctx.widgets.seriesWidget.getElement().appendChild(button.getElement()); + return button; + } + destroyElements() { + this.ctx.domManager.removeChild("canvas-overlay", DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS); + } + onMouseMove(e) { + if (this.ctx.interactionManager.isState(InteractionState2.Clickable)) + this.show(e); + } + onMouseDrag(e) { + if (this.ctx.interactionManager.isState(InteractionState2.AnnotationsMoveable)) + this.show(e); + } + onMouseLeave() { + if (this.ctx.interactionManager.isState(InteractionState2.Clickable)) + this.hide(); + } + onClick(e) { + if (this.ctx.interactionManager.isState(InteractionState2.Clickable) && e.device === "touch") + this.show(e); + } + show(event) { + const { sourceEvent, currentX: x, currentY: y } = event; + if (!(this.enabled && this.ctx.widgets.seriesWidget.getElement().contains(sourceEvent.target))) { + this.hide(); + return; + } + this.toggleVisibility(true); + const buttonCoords = this.getButtonCoordinates({ x, y }); + this.coords = { + x: buttonCoords.x + this.button.clientWidth / 2, + y: buttonCoords.y + this.button.clientHeight / 2 + }; + this.updatePosition(buttonCoords); + } + hide() { + this.toggleVisibility(false); + } + onKeyPress() { + if (this.snap && this.ctx.interactionManager.isState(InteractionState2.Default)) + return; + this.hide(); + } + getButtonCoordinates({ x, y }) { + const { + axisCtx: { direction, position }, + seriesRect, + snap, + axisCtx, + padding: padding2 + } = this; + const { clientWidth: buttonWidth, clientHeight: buttonHeight } = this.button; + const [minY, maxY] = [0, seriesRect.height]; + const [minX, maxX] = [0, seriesRect.width]; + if (snap) { + x = convert(invert(x - seriesRect.x, axisCtx), axisCtx) + seriesRect.x; + y = convert(invert(y - seriesRect.y, axisCtx), axisCtx) + seriesRect.y; + } + if (direction === ChartAxisDirection8.X) { + const crosshairLabelPadding = 5; + const offset = buttonHeight - Math.max(0, padding2 - crosshairLabelPadding); + x = x - buttonWidth / 2; + y = position === "top" ? minY - buttonHeight + offset : maxY - offset; + } else { + const crosshairLabelPadding = 9; + const offset = buttonWidth - Math.max(0, padding2 - crosshairLabelPadding); + x = position === "left" ? minX - buttonWidth + offset : maxX - offset; + y = y - buttonHeight / 2; + } + return { x, y }; + } + toggleVisibility(visible) { + const { button } = this; + if (button == null) + return; + const isVisible = this.enabled && visible; + this.toggleClass("-hidden", !isVisible); + } + toggleClass(name, include) { + this.button.toggleClass(`${DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS}-${name}`, include); + } + updatePosition({ x, y }) { + this.button.getElement().style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`; + } + updateButtonElement() { + const { button } = this; + button.addListener("click", () => this.onButtonClick(this.coords)); + button.addListener("touchend", () => this.onButtonClick(this.coords)); + button.addListener("drag-start", () => { + }); + button.setInnerHTML( + `` + ); + } +}; +__decorateClass2([ + Property32 +], AxisButton.prototype, "enabled", 2); +var { + Color: Color5, + DraggablePopover: DraggablePopover2, + NativeWidget: NativeWidget2, + Vec2: Vec218, + createButton: createButton2, + createCheckbox: createCheckbox2, + createSelect: createSelect2, + createTextArea: createTextArea2, + initRovingTabIndex: initRovingTabIndex2, + getIconClassNames: getIconClassNames22, + mapValues: mapValues3 +} = module_support_exports; +var _Dialog = class _Dialog2 extends DraggablePopover2 { + constructor(ctx, id) { + super(ctx, id); + this.dragHandleDraggingClass = "ag-charts-dialog__drag-handle--dragging"; + this.colorPicker = new ColorPicker(this.ctx, { detached: true }); + this.cleanup.register(ctx.eventsHub.on("layout:complete", this.onLayoutComplete.bind(this))); + } + showWithChildren(children, options) { + const popover = super.showWithChildren(children, options); + popover.classList.add("ag-charts-dialog"); + popover.setAttribute("role", "dialog"); + popover.addEventListener("mousedown", (event) => { + if (event.target.classList?.contains("ag-charts-dialog__color-picker-button")) + return; + this.colorPicker.hide(); + }); + popover.addEventListener("keydown", this.onKeyDown.bind(this)); + getWindow().requestAnimationFrame(() => this.reposition()); + this.colorPicker.attachTo(this); + return popover; + } + updatePosition(position) { + super.updatePosition(position); + const { anchor, fallbackAnchor } = this.getColorPickerAnchors() ?? {}; + if (!anchor) + return; + this.colorPicker.setAnchor(anchor, fallbackAnchor); + } + /************** + * Containers * + **************/ + createTabs(tablistLabel, initial, tabs) { + const element2 = createElement("div", "ag-charts-dialog__tabs"); + const tabButtonIds = mapValues3(tabs, () => createElementId()); + const tabPanelIds = mapValues3(tabs, () => createElementId()); + for (const [key, tab] of entries(tabs)) { + setAttributes(tab.panel, { + id: tabPanelIds[key], + role: "tabpanel", + "aria-labelledby": tabButtonIds[key] + }); + } + const onPressTab = (active) => { + for (const [key, tab] of entries(tabs)) { + tab.panel.classList.toggle("ag-charts-dialog__tab-panel--active", key === active); + tabButtons[key].classList.toggle("ag-charts-dialog__tab-button--active", key === active); + setAttribute(tabButtons[key], "aria-selected", key === active); + if (key === active) + tab.onShow?.(); + } + }; + const header = new NativeWidget2(createElement("div", "ag-charts-dialog__header")); + header.addListener("drag-start", (event) => { + const { sourceEvent } = event; + if (sourceEvent.target instanceof Element && sourceEvent.target.classList.contains("ag-charts-dialog__header")) { + this.onDragStart(event); + } + }); + header.addListener("drag-move", (event) => this.onDragMove(event)); + header.addListener("drag-end", () => this.onDragEnd()); + const dragHandle = new DragHandleWidget2(); + this.setDragHandle(dragHandle); + const tabButtons = mapValues3( + tabs, + (tab, key) => createButton2( + { + label: this.ctx.localeManager.t(tab.label), + onPress: () => onPressTab(key) + }, + { + id: tabButtonIds[key], + class: "ag-charts-dialog__tab-button", + role: "tab", + "aria-controls": tabPanelIds[key] + } + ) + ); + const tabList = createElement("div", "ag-charts-dialog__tab-list"); + setAttributes(tabList, { role: "tablist", "aria-label": this.ctx.localeManager.t(tablistLabel) }); + tabList.append(...Object.values(tabButtons)); + const closeButton = this.createHeaderCloseButton(); + header.getElement().append(dragHandle.getElement(), tabList, closeButton); + element2.append(header.getElement(), ...Object.values(tabs).map((t) => t.panel)); + onPressTab(initial); + initRovingTabIndex2({ orientation: "horizontal", buttons: Object.values(tabButtons) }); + return { tabs: element2, initialFocus: tabButtons[initial] }; + } + createTabPanel() { + return createElement("div", "ag-charts-dialog__tab-panel"); + } + /********** + * Inputs * + **********/ + createInputGroupLine() { + return createElement("div", "ag-charts-dialog__input-group-line"); + } + createRadioGroup({ label, options, value, onChange }) { + const group = this.createInputGroup(label); + setAttributes(group, { + role: "radiogroup", + tabindex: -1, + "aria-label": this.ctx.localeManager.t(label) + }); + const activeClass = "ag-charts-dialog__button--active"; + const buttons2 = []; + for (const button of options) { + const { icon, altText: altTextKey } = button; + const altText = this.ctx.localeManager.t(altTextKey); + const buttonEl = createButton2( + { + icon, + altText, + onPress: () => { + for (const b of Array.from(group.children)) { + b.classList.remove(activeClass); + b.ariaChecked = "false"; + } + buttonEl.classList.add(activeClass); + buttonEl.ariaChecked = "true"; + onChange(button.value); + } + }, + { + "aria-checked": button.value === value, + class: "ag-charts-dialog__button", + role: "radio", + title: altText + } + ); + if (button.value === value) { + buttonEl.classList.add(activeClass); + } + group.appendChild(buttonEl); + buttons2.push(buttonEl); + } + initRovingTabIndex2({ orientation: "horizontal", buttons: buttons2 }); + return group; + } + createSelect({ altText, label, options, value, onChange }) { + const group = this.createInputGroup(label); + const altTextT = this.ctx.localeManager.t(altText); + const select = createSelect2( + { value, options, onChange }, + { class: "ag-charts-dialog__select", "aria-label": altTextT, title: altTextT } + ); + group.append(select); + return group; + } + createTextArea({ placeholder, value, onChange }) { + const placeholderT = placeholder ? this.ctx.localeManager.t(placeholder) : void 0; + return createTextArea2({ value, onChange }, { placeholder: placeholderT }); + } + createCheckbox({ label, checked, onChange }) { + const id = createElementId(); + const group = this.createInputGroup(label, { for: id }); + const checkbox = createCheckbox2( + { checked, onChange }, + { class: "ag-charts-dialog__checkbox", role: "switch", id } + ); + group.append(checkbox); + return group; + } + createColorPicker({ + color: color6, + opacity, + label, + altText, + onChange, + onChangeHide, + isMultiColor, + hasMultiColorOption + }) { + const group = this.createInputGroup(label); + const altTextT = this.ctx.localeManager.t(altText); + const colorEl = createButton2( + { + label: altTextT, + onPress: (event) => { + const { anchor, fallbackAnchor } = this.getColorPickerAnchors(colorEl) ?? {}; + this.colorPicker.show({ + anchor, + fallbackAnchor, + color: color6, + opacity, + isMultiColor, + hasMultiColorOption, + sourceEvent: event, + onChange: (newColorOpacity, newColor, newOpacity, newIsMultiColor) => { + colorEl.style.setProperty("--color", newColorOpacity); + colorEl.classList.toggle( + "ag-charts-dialog__color-picker-button--multi-color", + newIsMultiColor + ); + onChange(newColorOpacity, newColor, newOpacity, newIsMultiColor); + }, + onChangeHide + }); + } + }, + { + "aria-label": altTextT, + tabindex: 0, + class: "ag-charts-dialog__color-picker-button", + title: altTextT + } + ); + if (isMultiColor) { + colorEl.classList.toggle("ag-charts-dialog__color-picker-button--multi-color"); + } else if (color6) { + const hex = Color5.fromString(color6); + const hexWithOpacity = new Color5(hex.r, hex.g, hex.b, opacity); + colorEl.style.setProperty("--color", hexWithOpacity.toHexString()); + } + group.append(colorEl); + this.hideFns.push(() => { + this.colorPicker.hide(); + }); + return group; + } + /*********** + * Private * + ***********/ + createHeaderCloseButton() { + return createButton2( + { icon: "close", altText: this.ctx.localeManager.t("iconAltTextClose"), onPress: () => this.hide() }, + { class: "ag-charts-dialog__close-button" } + ); + } + createInputGroup(label, options) { + const group = createElement("div", "ag-charts-dialog__input-group"); + const labelEl = createElement("label", "ag-charts-dialog__input-group-label"); + labelEl.innerText = this.ctx.localeManager.t(label); + setAttribute(labelEl, "for", options?.for); + group.appendChild(labelEl); + return group; + } + onLayoutComplete(event) { + this.seriesRect = event.series.paddedRect; + this.reposition(); + } + onKeyDown(event) { + if (event.altKey || event.ctrlKey || event.metaKey || event.isComposing || event.key !== "Escape") + return; + this.hide(); + } + reposition() { + const { seriesRect, ctx } = this; + const clientRect = ctx.domManager.getBoundingClientRect(); + const popover = this.getPopoverElement(); + if (!seriesRect || !popover) + return; + const outerOffset = Vec218.from(0, seriesRect.y); + const outerSize = Vec218.from(clientRect.width, seriesRect.height); + const popoverSize = Vec218.from(popover); + const halfWidth = Vec218.from(0.5, 1); + let position; + if (seriesRect.width > 1e3) { + const bottomCenter2 = Vec218.sub( + Vec218.add(outerOffset, Vec218.multiply(outerSize, halfWidth)), + Vec218.multiply(popoverSize, halfWidth) + ); + position = Vec218.sub(bottomCenter2, Vec218.from(0, _Dialog2.offset)); + } else { + const bottomRight = Vec218.sub(Vec218.add(outerOffset, outerSize), popoverSize); + position = Vec218.sub(bottomRight, _Dialog2.offset); + } + this.updatePosition(position); + } + getColorPickerAnchors(element2) { + if (element2) + this.colorPickerAnchorElement = element2; + if (!this.colorPickerAnchorElement) + return; + const rect2 = this.colorPickerAnchorElement.getBoundingClientRect(); + const canvasRect = this.ctx.domManager.getBoundingClientRect(); + const topLeft = Vec218.sub(Vec218.from(rect2.x, rect2.y), Vec218.from(canvasRect.left, canvasRect.top)); + const anchor = Vec218.add(topLeft, Vec218.from(0, rect2.height + 5)); + const fallbackAnchor = Vec218.sub(topLeft, Vec218.from(0, 5)); + return { anchor, fallbackAnchor }; + } +}; +_Dialog.offset = 60; +var Dialog = _Dialog; +var DragHandleWidget2 = class extends NativeWidget2 { + constructor() { + super(createElement("div", "ag-charts-dialog__drag-handle")); + const icon = new NativeWidget2(createElement("span", getIconClassNames22("drag-handle"))); + icon.setAriaHidden(true); + this.addChild(icon); + } +}; +var { focusCursorAtEnd: focusCursorAtEnd22 } = module_support_exports; +var AnnotationSettingsDialog = class extends Dialog { + constructor(ctx) { + super(ctx, "settings"); + this.events = new EventEmitter(); + this.hideFns.push(() => this.events.emit("hidden", null)); + } + show(datum, options) { + const lineTab = this.createLinearLineTab(datum, options); + const textTab = this.createLinearTextTab(datum, options); + let lineLabel = "dialogHeaderLine"; + if (isChannelType(datum)) { + lineLabel = "dialogHeaderChannel"; + } else if (isFibonacciType(datum)) { + lineLabel = "dialogHeaderFibonacciRange"; + } else if (datum.type === "date-range") { + lineLabel = "dialogHeaderDateRange"; + } else if (datum.type === "price-range") { + lineLabel = "dialogHeaderPriceRange"; + } else if (datum.type === "date-price-range") { + lineLabel = "dialogHeaderDatePriceRange"; + } + const { tabs, initialFocus } = this.createTabs("ariaLabelSettingsTabBar", options.initialSelectedTab, { + line: { + label: lineLabel, + panel: lineTab + }, + text: { + label: "dialogHeaderText", + panel: textTab.panel, + onShow: textTab.onShow + } + }); + options.initialFocus = initialFocus; + const popover = this.showWithChildren([tabs], options); + popover.classList.add("ag-charts-dialog--annotation-settings"); + } + createLinearLineTab(datum, options) { + const panel = this.createTabPanel(); + const groupOne = this.createInputGroupLine(); + const groupTwo = this.createInputGroupLine(); + const hasMultiColorOption = "isMultiColor" in datum; + const lineColorPicker = this.createColorPickerInput( + "line-color", + datum.getDefaultColor("line-color"), + datum.getDefaultOpacity("line-color"), + hasMultiColorOption ? datum.isMultiColor : false, + hasMultiColorOption, + options.onChangeLineColor, + options.onChangeHideLineColor + ); + const strokeWidth = this.createStrokeWidthSelect(datum.strokeWidth ?? 2, options.onChangeLineStyleWidth); + const lineStyle = this.createLineStyleRadioGroup(datum.lineStyle ?? "solid", options.onChangeLineStyleType); + groupOne.append(lineColorPicker); + if ("background" in datum) { + const fillColorPicker = this.createColorPickerInput( + "fill-color", + datum.getDefaultColor("fill-color"), + datum.getDefaultOpacity("fill-color"), + false, + false, + options.onChangeFillColor, + options.onChangeHideFillColor + ); + groupOne.append(fillColorPicker); + groupTwo.append(strokeWidth); + } else if ("showFill" in datum) { + groupOne.append( + this.createCheckbox({ + label: "dialogInputShowFill", + checked: datum.showFill ?? true, + onChange: (showFill) => options.onChangeLine({ showFill }) + }) + ); + groupTwo.append(strokeWidth); + } else { + groupOne.append(strokeWidth); + } + groupTwo.append(lineStyle); + panel.append(groupOne, groupTwo); + if ("bands" in datum) { + panel.append( + this.createFibonacciRatioSelect(datum.bands ?? 10, (bands) => options.onChangeLine({ bands })) + ); + } + if ("extendStart" in datum && "extendEnd" in datum) { + panel.append( + this.createCheckbox({ + label: isChannelType(datum) ? "dialogInputExtendChannelStart" : "dialogInputExtendLineStart", + checked: datum.extendStart ?? false, + onChange: (extendStart) => options.onChangeLine({ extendStart }) + }), + this.createCheckbox({ + label: isChannelType(datum) ? "dialogInputExtendChannelEnd" : "dialogInputExtendLineEnd", + checked: datum.extendEnd ?? false, + onChange: (extendEnd) => options.onChangeLine({ extendEnd }) + }) + ); + } + if ("extendAbove" in datum && "extendBelow" in datum) { + panel.append( + this.createCheckbox({ + label: "dialogInputExtendAbove", + checked: datum.extendAbove ?? false, + onChange: (extendAbove) => options.onChangeLine({ extendAbove }) + }), + this.createCheckbox({ + label: "dialogInputExtendBelow", + checked: datum.extendBelow ?? false, + onChange: (extendBelow) => options.onChangeLine({ extendBelow }) + }) + ); + } + if ("extendLeft" in datum && "extendRight" in datum) { + panel.append( + this.createCheckbox({ + label: "dialogInputExtendLeft", + checked: datum.extendLeft ?? false, + onChange: (extendLeft) => options.onChangeLine({ extendLeft }) + }), + this.createCheckbox({ + label: "dialogInputExtendRight", + checked: datum.extendRight ?? false, + onChange: (extendRight) => options.onChangeLine({ extendRight }) + }) + ); + } + if ("reverse" in datum && "showFill" in datum) { + panel.append( + this.createCheckbox({ + label: "dialogInputReverse", + checked: datum.reverse ?? false, + onChange: (reverse) => options.onChangeLine({ reverse }) + }) + ); + } + return panel; + } + createLinearTextTab(datum, options) { + const panel = this.createTabPanel(); + const textArea = this.createTextArea({ + placeholder: "inputTextareaPlaceholder", + value: datum.text.label, + onChange: (value) => options.onChangeText({ label: value }) + }); + const fontSize = this.createFontSizeSelect(datum.text.fontSize, options.onChangeTextFontSize); + const colorPicker = this.createColorPickerInput( + "text-color", + datum.text.color, + 1, + false, + false, + options.onChangeTextColor, + options.onChangeHideTextColor + ); + const textPosition = datum.text.position === "inside" ? "center" : datum.text.position; + const position = this.createPositionRadioGroup( + textPosition ?? "top", + (value) => options.onChangeText({ position: value }) + ); + const alignment = this.createAlignmentRadioGroup( + datum.text.alignment ?? "center", + (value) => options.onChangeText({ alignment: value }) + ); + const inputGroupLine = this.createInputGroupLine(); + inputGroupLine.append(fontSize, colorPicker, position, alignment); + panel.append(textArea, inputGroupLine); + return { panel, onShow: () => focusCursorAtEnd22(textArea) }; + } + createColorPickerInput(colorType, color6, opacity, isMultiColor, hasMultiColorOption, onChange, onChangeHide) { + const label = colorType === "fill-color" ? "dialogInputFillColorPicker" : "dialogInputColorPicker"; + const altText = colorType === "fill-color" ? "dialogInputFillColorPickerAltText" : "dialogInputColorPickerAltText"; + return this.createColorPicker({ + label, + altText, + color: color6, + opacity, + isMultiColor, + hasMultiColorOption, + onChange, + onChangeHide + }); + } + createStrokeWidthSelect(strokeWidth, onChange) { + return this.createSelect({ + label: "dialogInputStrokeWidth", + altText: "dialogInputStrokeWidthAltText", + options: LINE_STROKE_WIDTH_ITEMS.map(({ label, value }) => ({ label, value: `${value}` })), + value: String(strokeWidth), + onChange: (value) => onChange(Number(value)) + }); + } + createFibonacciRatioSelect(bands, onChange) { + return this.createSelect({ + label: "dialogInputFibonacciBands", + altText: "dialogInputFibonacciBandsAltText", + options: FIBONACCI_RATIO_ITEMS.map(({ label, value }) => ({ label, value: `${value}` })), + value: String(bands), + onChange: (value) => onChange(Number(value)) + }); + } + createLineStyleRadioGroup(lineStyle, onChange) { + return this.createRadioGroup({ + label: "dialogInputLineStyle", + options: [ + { icon: "line-style-solid", altText: "iconAltTextLineStyleSolid", value: "solid" }, + { icon: "line-style-dashed", altText: "iconAltTextLineStyleDashed", value: "dashed" }, + { icon: "line-style-dotted", altText: "iconAltTextLineStyleDotted", value: "dotted" } + ], + value: lineStyle, + onChange + }); + } + createFontSizeSelect(fontSize, onChange) { + return this.createSelect({ + label: "dialogInputFontSize", + altText: "dialogInputFontSizeAltText", + options: TEXT_SIZE_ITEMS.map(({ label, value }) => ({ label, value: String(value) })), + value: String(fontSize), + onChange: (value) => onChange(Number(value)) + }); + } + createPositionRadioGroup(position, onChange) { + return this.createRadioGroup({ + label: "dialogInputPosition", + options: [ + { icon: "position-top", altText: "iconAltTextPositionTop", value: "top" }, + { icon: "position-center", altText: "iconAltTextPositionCenter", value: "center" }, + { icon: "position-bottom", altText: "iconAltTextPositionBottom", value: "bottom" } + ], + value: position, + onChange + }); + } + createAlignmentRadioGroup(alignment, onChange) { + return this.createRadioGroup({ + label: "dialogInputAlign", + options: [ + { icon: "align-left", altText: "iconAltTextAlignLeft", value: "left" }, + { icon: "align-center", altText: "iconAltTextAlignCenter", value: "center" }, + { icon: "align-right", altText: "iconAltTextAlignRight", value: "right" } + ], + value: alignment, + onChange + }); + } +}; +function calculateAxisLabelPadding(axisLayout) { + return axisLayout.gridPadding + axisLayout.seriesAreaPadding + axisLayout.tickSize + axisLayout.label.spacing; +} +function updateAnnotation(node, datum, context) { + for (const { update } of Object.values(annotationConfigs)) { + update(node, datum, context); + } +} +var { + ChartUpdateType: ChartUpdateType2, + InteractionState: InteractionState22, + PropertiesArray: PropertiesArray3, + Property: Property33, + ChartAxisDirection: ChartAxisDirection9, + keyProperty: keyProperty2, + valueProperty: valueProperty2, + Vec2: Vec219, + Selection: Selection3, + BBox: BBox3 +} = module_support_exports; +var _Annotations = class _Annotations2 extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + this.toolbar = new AnnotationsToolbar(this.ctx); + this.optionsToolbar = new AnnotationOptionsToolbar(this.ctx, () => { + const active = this.state.getActive(); + if (active == null) + return; + return getTypedDatum(this.annotationData.at(active)); + }); + this.axesButtons = new AxesButtons(); + this.snap = false; + this.data = void 0; + this.xKey = void 0; + this.volumeKey = void 0; + this.annotationData = new PropertiesArray3( + _Annotations2.createAnnotationDatum + ); + this.defaults = new AnnotationDefaults(); + this.container = new module_support_exports.Group({ name: "static-annotations" }); + this.annotations = new Selection3( + this.container, + this.createAnnotationScene.bind(this) + ); + this.settingsDialog = new AnnotationSettingsDialog(this.ctx); + this.textInput = new TextInput(this.ctx); + this.postUpdateFns = []; + this.state = this.setupStateMachine(); + this.setupListeners(); + this.setupDOM(); + this.ctx.historyManager.addMementoOriginator(ctx.annotationManager); + this.ctx.historyManager.addMementoOriginator(this.defaults); + this.textInput.setKeyDownHandler(this.onTextInput.bind(this)); + this.cleanup.register(() => { + this.clear(); + this.xAxis?.button?.destroy(); + this.yAxis?.button?.destroy(); + }); + } + setupStateMachine() { + const { ctx } = this; + return new AnnotationsStateMachine({ + resetToIdle: () => { + ctx.domManager.updateCursor("annotations"); + this.popAnnotationState(InteractionState22.Annotations); + this.hideOverlays(); + this.optionsToolbar.hide(); + this.deleteEphemeralAnnotations(); + this.update(); + }, + hoverAtCoords: (coords, active, previousHovered) => { + let hovered; + this.annotations.each((annotation, datum, index) => { + if (!datum.isHoverable()) + return; + const contains = annotation.containsPoint(coords.x, coords.y); + if (contains) + hovered ?? (hovered = index); + annotation.toggleHovered(contains, active === index, datum.readOnly); + }); + if (hovered != null) { + ctx.tooltipManager.suppressTooltip("annotations"); + } else if (!this.isAnnotationState()) { + ctx.tooltipManager.unsuppressTooltip("annotations"); + } + if (hovered == null || !this.annotationData.at(hovered)?.readOnly) { + this.ctx.domManager.updateCursor( + "annotations", + hovered == null ? void 0 : this.annotations.at(hovered)?.getCursor() + ); + } + if (hovered !== previousHovered) { + this.update(); + } + return hovered; + }, + getNodeAtCoords: (coords, active) => { + const node = this.annotations.at(active); + if (!node) { + return; + } + return node.getNodeAtCoords(coords.x, coords.y); + }, + translate: (index, translation) => { + const node = this.annotations.at(index); + const datum = getTypedDatum(this.annotationData.at(index)); + if (!node || !datum) { + return; + } + return this.translateNode(node, datum, translation); + }, + copy: (index) => { + const node = this.annotations.at(index); + const datum = getTypedDatum(this.annotationData.at(index)); + if (!node || !datum) { + return; + } + return this.createAnnotationDatumCopy(node, datum); + }, + paste: (datum) => { + this.createAnnotation(datum.type, datum, false); + this.postUpdateFns.push(() => { + this.state.transitionAsync("selectLast"); + this.state.transitionAsync("copy"); + }); + }, + select: (index, previous) => { + const { annotations, optionsToolbar: optionsToolbar2, toolbar: toolbar2 } = this; + this.hideOverlays(); + toolbar2.clearActiveButton(); + toolbar2.resetButtonIcons(); + const selectedNode = index == null ? null : annotations.at(index); + const previousNode = previous == null ? null : annotations.at(previous); + const selectedDatum = index == null ? null : this.annotationData.at(index); + if (previousNode === selectedNode && selectedNode != null) { + return; + } + previousNode?.toggleActive(false); + optionsToolbar2.hide(); + if (selectedNode && !selectedDatum?.readOnly) { + this.pushAnnotationState(InteractionState22.AnnotationsSelected); + selectedNode.toggleActive(true); + if (!isEphemeralType(selectedDatum)) { + optionsToolbar2.updateButtons(this.annotationData.at(index)); + this.postUpdateFns.push(() => { + optionsToolbar2.show(); + optionsToolbar2.setAnchorScene(selectedNode); + }); + } + } else { + this.popAnnotationState(InteractionState22.AnnotationsSelected); + this.popAnnotationState(InteractionState22.Annotations); + } + if (!isEphemeralType(selectedDatum)) { + this.deleteEphemeralAnnotations(); + } + this.update(); + }, + selectLast: () => { + this.pushAnnotationState(InteractionState22.AnnotationsSelected); + return this.annotationData.length - 1; + }, + startInteracting: () => { + this.pushAnnotationState(InteractionState22.Annotations); + }, + stopInteracting: () => { + this.popAnnotationState(InteractionState22.Annotations); + }, + create: (type, datum) => { + this.createAnnotation(type, datum); + }, + delete: (index) => { + this.annotationData.splice(index, 1); + }, + deleteAll: () => { + const readOnly = this.annotationData.filter((datum) => { + if (datum.readOnly === true) + return datum; + }); + this.annotationData.splice(0, this.annotationData.length); + for (const datum of readOnly) { + this.annotationData.push(datum); + } + }, + validatePoint: (point, options) => { + const context = this.getAnnotationContext(); + return context ? validateDatumPoint(context, point, options) : true; + }, + getAnnotationType: (index) => { + return stringToAnnotationType(this.annotationData[index].type); + }, + datum: (index) => { + return this.annotationData.at(index); + }, + node: (index) => { + return this.annotations.at(index); + }, + recordAction: (label) => { + this.recordActionAfterNextUpdate(label); + }, + update: () => { + this.postUpdateFns.push(() => { + const active = this.state.getActive(); + const node = active == null ? null : this.annotations.at(active); + if (node == null) + return; + this.optionsToolbar.setAnchorScene(node); + }); + this.update(); + }, + showTextInput: (active) => { + const datum = getTypedDatum(this.annotationData.at(active)); + const node = this.annotations.at(active); + if (!node || !datum || !("getTextInputCoords" in datum) || !("getTextPosition" in datum)) + return; + const styles = { + color: datum.color, + fontFamily: datum.fontFamily, + fontSize: datum.fontSize, + fontStyle: datum.fontStyle, + fontWeight: datum.fontWeight, + placeholderColor: datum.getPlaceholderColor() + }; + const context = this.getAnnotationContext(); + const getTextInputCoords = (height2) => Vec219.add(datum.getTextInputCoords(context, height2), Vec219.required(this.seriesRect)); + const getTextPosition = () => datum.getTextPosition(); + this.textInput.show({ + styles, + layout: { + getTextInputCoords, + getTextPosition, + alignment: datum.alignment, + textAlign: datum.textAlign, + width: datum.width + }, + text: datum.text, + placeholderText: datum.placeholderText, + onChange: (_text, bbox) => { + this.state.transition("updateTextInputBBox", bbox); + } + }); + this.ctx.domManager.updateCursor("annotations"); + }, + hideTextInput: () => { + this.textInput.hide(); + }, + updateTextInputColor: (color6) => { + this.textInput.updateColor(color6); + }, + updateTextInputFontSize: (fontSize) => { + const bbox = this.textInput.updateFontSize(fontSize); + this.state.transition("updateTextInputBBox", bbox); + }, + updateTextInputBBox: (bbox) => { + this.state.transition("updateTextInputBBox", bbox); + }, + showAnnotationOptions: (active) => { + const node = this.annotations.at(active); + if (!node || isEphemeralType(this.annotationData.at(active))) + return; + this.optionsToolbar.updateButtons(this.annotationData.at(active)); + this.optionsToolbar.show(); + this.optionsToolbar.setAnchorScene(node); + }, + showAnnotationSettings: (active, sourceEvent, initialTab = "line") => { + const datum = this.annotationData.at(active); + if (!isLineType(datum) && !isChannelType(datum) && !isMeasurerType(datum)) + return; + if (isEphemeralType(datum)) + return; + const onChangeColor = (colorType) => (colorOpacity, color6, opacity, isMultiColor) => { + this.setColorAndDefault(datum.type, colorType, colorOpacity, color6, opacity, isMultiColor); + this.optionsToolbar.updateColorPickerColor(colorType, color6, opacity, isMultiColor); + }; + const onChangeHideColor = (colorType) => () => { + this.recordActionAfterNextUpdate( + `Change ${datum.type} ${colorType} to ${datum.getDefaultColor(colorType)}`, + ["annotations", "defaults"] + ); + this.update(); + }; + const options = { + initialSelectedTab: initialTab, + ariaLabel: this.ctx.localeManager.t("ariaLabelAnnotationSettingsDialog"), + sourceEvent, + onChangeLine: (props) => { + this.state.transition("lineProps", props); + if (props.bands != null) + this.defaults.setDefaultFibonacciOptions(datum.type, "bands", props.bands); + if (props.reverse != null) + this.defaults.setDefaultFibonacciOptions(datum.type, "reverse", props.reverse); + if (props.showFill != null) + this.defaults.setDefaultFibonacciOptions(datum.type, "showFill", props.showFill); + }, + onChangeText: (props) => { + this.state.transition("lineText", props); + if (props.alignment) + this.defaults.setDefaultLineTextAlignment(datum.type, props.alignment); + if (props.position) + this.defaults.setDefaultLineTextPosition(datum.type, props.position); + this.recordActionAfterNextUpdate( + `Change ${datum.type} text ${Object.keys(props).map((key) => `${key} to ${props[key]}`).join(", ")}` + ); + }, + onChangeFillColor: onChangeColor("fill-color"), + onChangeHideFillColor: onChangeHideColor("fill-color"), + onChangeLineColor: onChangeColor("line-color"), + onChangeHideLineColor: onChangeHideColor("line-color"), + onChangeLineStyleType: (lineStyleType) => { + this.setLineStyleTypeAndDefault(datum.type, lineStyleType); + this.optionsToolbar.updateLineStyleType( + LINE_STYLE_TYPE_ITEMS.find((item) => item.value === lineStyleType) ?? LINE_STYLE_TYPE_ITEMS[0] + ); + }, + onChangeLineStyleWidth: (strokeWidth) => { + this.setLineStyleWidthAndDefault(datum.type, strokeWidth); + this.optionsToolbar.updateStrokeWidth({ + strokeWidth, + value: strokeWidth, + label: String(strokeWidth) + }); + }, + onChangeTextColor: onChangeColor("text-color"), + onChangeHideTextColor: onChangeHideColor("text-color"), + onChangeTextFontSize: (fontSize) => { + this.setFontSizeAndDefault(datum.type, fontSize); + } + }; + this.settingsDialog.show(datum, options); + } + }); + } + setupListeners() { + const { ctx, optionsToolbar: optionsToolbar2, settingsDialog, toolbar: toolbar2 } = this; + const { seriesWidget, seriesDragInterpreter, chartWidget } = ctx.widgets; + if (seriesDragInterpreter) { + this.cleanup.register( + // Interactions + seriesDragInterpreter.events.on("click", this.hoverTouchPreHandler.bind(this)), + seriesDragInterpreter.events.on("drag-start", this.hoverTouchPreHandler.bind(this)), + seriesDragInterpreter.events.on("drag-move", this.dragMoveTouchPreHandler.bind(this)), + seriesDragInterpreter.events.on("mousemove", this.onHover.bind(this)), + seriesDragInterpreter.events.on("click", this.onClick.bind(this)), + seriesDragInterpreter.events.on("dblclick", this.onDoubleClick.bind(this)), + seriesDragInterpreter.events.on("drag-start", this.onDragStart.bind(this)), + seriesDragInterpreter.events.on("drag-move", this.onDrag.bind(this)), + seriesDragInterpreter.events.on("drag-end", this.onDragEnd.bind(this)) + ); + } + this.cleanup.register( + // Interactions + seriesWidget.addListener("keydown", this.onKeyDown.bind(this)), + seriesWidget.addListener("keyup", this.onKeyUp.bind(this)), + chartWidget.addListener("click", this.onCancel.bind(this)), + // Services + ctx.eventsHub.on("annotations:restore", this.onRestoreAnnotations.bind(this)), + ctx.eventsHub.on("layout:complete", this.onLayoutComplete.bind(this)), + ctx.updateService.addListener("pre-scene-render", this.onPreRender.bind(this)), + ctx.eventsHub.on("zoom:change", () => this.onResize()), + ctx.eventsHub.on("dom:resize", () => this.onResize()), + // Toolbar + toolbar2.events.on("cancel-create-annotation", () => { + this.cancel(); + this.reset(); + this.update(); + }), + toolbar2.events.on("pressed-create-annotation", ({ annotation }) => { + this.cancel(); + this.pushAnnotationState(InteractionState22.Annotations); + this.state.transition(annotation); + this.update(); + }), + toolbar2.events.on("pressed-clear", () => { + this.clear(); + this.recordActionAfterNextUpdate("Clear all"); + }), + toolbar2.events.on("pressed-show-menu", () => { + this.cancel(); + this.reset(); + }), + toolbar2.events.on("pressed-unrelated", () => { + this.reset(); + }), + // Annotation Options Toolbar + optionsToolbar2.events.on("pressed-delete", () => { + this.cancel(); + this.delete(); + this.reset(); + }), + optionsToolbar2.events.on("pressed-settings", ({ sourceEvent }) => { + this.state.transition("toolbarPressSettings", sourceEvent); + }), + optionsToolbar2.events.on("pressed-lock", ({ locked }) => { + this.recordActionAfterNextUpdate(locked ? "Locked" : "Unlocked"); + this.update(); + }), + optionsToolbar2.events.on("hid-overlays", () => { + this.settingsDialog.hide(); + }), + optionsToolbar2.events.on("saved-color", ({ type, colorPickerType, color: color6 }) => { + this.recordActionAfterNextUpdate(`Change ${type} ${colorPickerType} to ${color6}`, [ + "annotations", + "defaults" + ]); + }), + optionsToolbar2.events.on( + "updated-color", + ({ type, colorPickerType, colorOpacity, color: color6, opacity, isMultiColor }) => { + this.setColorAndDefault(type, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + } + ), + optionsToolbar2.events.on("updated-font-size", ({ type, fontSize }) => { + this.setFontSizeAndDefault(type, fontSize); + }), + optionsToolbar2.events.on("updated-line-style", ({ type, lineStyleType }) => { + this.setLineStyleTypeAndDefault(type, lineStyleType); + }), + optionsToolbar2.events.on("updated-line-width", ({ type, strokeWidth }) => { + this.setLineStyleWidthAndDefault(type, strokeWidth); + }), + // Settings Dialog + settingsDialog.events.on("hidden", () => { + this.optionsToolbar.clearActiveButton(); + }) + ); + } + setupDOM() { + const { ctx, toolbar: toolbar2, optionsToolbar: optionsToolbar2 } = this; + this.cleanup.register(ctx.annotationManager.attachNode(this.container), () => { + ctx.domManager.removeStyles(DEFAULT_ANNOTATION_AXIS_BUTTON_CLASS); + toolbar2.destroy(); + optionsToolbar2.destroy(); + }); + } + async processData(dataController) { + if (!this.enabled || this.data == null || this.xKey == null || this.volumeKey == null) + return; + const props = [ + keyProperty2(this.xKey, void 0, { id: "date" }), + valueProperty2(this.volumeKey, "number", { id: "volume" }) + ]; + const dataSet = module_support_exports.DataSet.wrap(this.data) ?? module_support_exports.DataSet.empty(); + const { dataModel, processedData } = await dataController.request("annotations", dataSet, { + props + }); + this.dataModel = dataModel; + this.processedData = processedData; + } + /** + * Create an annotation scene within the `this.annotations` scene selection. This method is automatically called by + * the selection when a new scene is required. + */ + createAnnotationScene(datum) { + if (datum.type in annotationConfigs) { + return new annotationConfigs[datum.type].scene(); + } + throw new Error( + `AG Charts - Cannot create annotation scene of type [${datum.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.` + ); + } + /** + * Create an annotation datum within the `this.annotationData` properties array. It is created as an instance + * of `AnnotationProperties` from the given config for its type. This method is only called when annotations + * are added from the initial state. + */ + static createAnnotationDatum(params) { + if (params.type in annotationConfigs) { + return new annotationConfigs[params.type].datum().set(params); + } + throw new Error( + `AG Charts - Cannot create annotation datum of unknown type [${params.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.` + ); + } + /** + * Append an annotation datum to `this.annotationData`, applying default styles. This method is called when a user + * interacts with the chart to draw their own annotations. + */ + createAnnotation(type, datum, applyDefaults = true) { + this.annotationData.push(datum); + if (applyDefaults) { + const styles = this.ctx.annotationManager.getAnnotationTypeStyles(type); + if (styles) + datum.set(styles); + this.defaults.applyDefaults(datum); + } + this.injectDatumDependencies(datum); + this.update(); + } + injectDatumDependencies(datum) { + if ("setLocaleManager" in datum) { + datum.setLocaleManager(this.ctx.localeManager); + } + if ("getVolume" in datum) { + datum.getVolume = this.getDatumRangeVolume.bind(this); + } + } + getDatumRangeVolume(fromPoint, toPoint) { + const { dataModel, processedData } = this; + let from3 = getGroupingValue(fromPoint); + let to = getGroupingValue(toPoint); + if (!isValidDate(from3) || !isValidDate(to) || !dataModel || !processedData || this.volumeKey == null) + return; + if (from3 > to) { + [from3, to] = [to, from3]; + } + const dateValues = dataModel.resolveKeysById({ id: "annotations" }, "date", processedData); + const volumeValues = dataModel.resolveColumnById({ id: "annotations" }, "volume", processedData); + let sum2 = 0; + for (let datumIndex = 0; datumIndex < processedData.input.count; datumIndex++) { + const key = dateValues[datumIndex]; + if (isValidDate(key) && key >= from3 && key <= to) { + sum2 += volumeValues[datumIndex]; + } + } + return sum2; + } + translateNode(node, datum, translation) { + const config = this.getAnnotationConfig(datum); + const context = this.getAnnotationContext(); + if (!context) { + return; + } + config.translate(node, datum, translation, context); + } + createAnnotationDatumCopy(node, datum) { + const config = this.getAnnotationConfig(datum); + const newDatum = new config.datum(); + newDatum.set(datum.toJson()); + const context = this.getAnnotationContext(); + if (!context) { + return; + } + return config.copy(node, datum, newDatum, context); + } + getAnnotationConfig(datum) { + if (datum.type in annotationConfigs) { + return annotationConfigs[datum.type]; + } + throw new Error( + `AG Charts - Cannot get annotation config of unknown type [${datum.type}], expected one of [${Object.keys(annotationConfigs)}], ignoring.` + ); + } + onRestoreAnnotations(event) { + if (!this.enabled) + return; + this.clear(); + this.annotationData.set(event.annotations); + this.postUpdateFns.push(() => { + this.ctx.annotationManager.fireChangedEvent(); + }); + this.update(); + } + onLayoutComplete(event) { + const seriesRect = event.series.paddedRect; + this.seriesRect = seriesRect; + this.container.setClipRect(seriesRect); + for (const axisLayout of event.axes ?? []) { + if (axisLayout.direction === module_support_exports.ChartAxisDirection.X) { + this.xAxis = this.getAxis(axisLayout, seriesRect, this.xAxis?.button); + } else { + this.yAxis = this.getAxis(axisLayout, seriesRect, this.yAxis?.button); + } + } + if (this.showAnnotations()) { + this.animateAnnotations({ from: 0, to: 1, phase: "trailing" }); + } else { + this.animateAnnotations({ from: 1, to: 0, phase: "remove" }); + } + } + showAnnotations() { + if (!this.yAxis || !this.xAxis) { + return false; + } + const hasData = this.ctx.chartService.series.some((s) => s.hasData); + const seriesIds = this.yAxis.context.seriesIds(); + const anyBoundSeriesVisible = seriesIds.some((id) => { + const series = this.ctx.chartService.series.find((s) => s.id === id); + return series?.visible; + }); + return hasData && anyBoundSeriesVisible; + } + animateAnnotations({ from: from3, to, phase }) { + const { annotations } = this; + this.ctx.animationManager?.animate({ + from: from3, + to, + id: "chart-annotations", + phase, + groupId: "opacity", + onUpdate(value) { + annotations.each((node) => { + node.opacity = value; + if ("setAxisLabelOpacity" in node) { + node.setAxisLabelOpacity(value); + } + }); + }, + onStop() { + annotations.each((node) => { + node.opacity = to; + if ("setAxisLabelOpacity" in node) { + node.setAxisLabelOpacity(to); + } + }); + } + }); + } + onPreRender() { + this.updateAnnotations(); + this.state.transition("render"); + } + getAxis(axisLayout, seriesRect, button) { + const axisCtx = this.ctx.axisManager.getAxisContext(axisLayout.direction)[0]; + const { position: axisPosition = "bottom", direction } = axisCtx; + const padding2 = axisLayout.gridPadding + axisLayout.seriesAreaPadding; + const bounds = new BBox3(0, 0, seriesRect.width, seriesRect.height).grow(padding2, axisPosition); + const lineDirection = direction === ChartAxisDirection9.X ? "vertical" : "horizontal"; + const { axesButtons, snap } = this; + const buttonEnabled = this.enabled && axesButtons.enabled && (axesButtons.axes === "xy" || axesButtons.axes === direction); + if (buttonEnabled) { + button ?? (button = new AxisButton( + this.ctx, + { ...axisCtx, snapToGroup: snap }, + (coords) => this.onAxisButtonClick(coords, lineDirection), + seriesRect + )); + const axisLabelPadding = calculateAxisLabelPadding(axisLayout); + button.update(seriesRect, axisLabelPadding); + } else { + button?.destroy(); + button = void 0; + } + return { layout: axisLayout, context: axisCtx, bounds, button }; + } + recordActionAfterNextUpdate(label, types = ["annotations"]) { + const { + defaults, + ctx: { annotationManager, historyManager } + } = this; + const originators = types.map((type) => type === "defaults" ? defaults : annotationManager); + this.postUpdateFns.push(() => { + historyManager.record(label, ...originators); + annotationManager.fireChangedEvent(); + }); + } + setColorAndDefault(datumType, colorPickerType, colorOpacity, color6, opacity, isMultiColor) { + this.state.transition("color", { colorPickerType, colorOpacity, color: color6, opacity, isMultiColor }); + this.defaults.setDefaultColor(datumType, colorPickerType, colorOpacity, color6, opacity, isMultiColor); + } + setFontSizeAndDefault(datumType, fontSize) { + this.state.transition("fontSize", fontSize); + this.defaults.setDefaultFontSize(datumType, fontSize); + this.recordActionAfterNextUpdate(`Change ${datumType} font size to ${fontSize}`, ["annotations", "defaults"]); + } + setLineStyleTypeAndDefault(datumType, styleType) { + this.state.transition("lineStyle", { type: styleType }); + this.defaults.setDefaultLineStyleType(datumType, styleType); + this.recordActionAfterNextUpdate(`Change ${datumType} line style to ${styleType}`, ["annotations", "defaults"]); + } + setLineStyleWidthAndDefault(datumType, strokeWidth) { + this.state.transition("lineStyle", { strokeWidth }); + this.defaults.setDefaultLineStyleWidth(datumType, strokeWidth); + this.recordActionAfterNextUpdate(`Change ${datumType} stroke width to ${strokeWidth}`, [ + "annotations", + "defaults" + ]); + } + updateAnnotations() { + const { + annotationData, + annotations, + seriesRect, + ctx: { annotationManager } + } = this; + const context = this.getAnnotationContext(); + if (!seriesRect || !context) + return; + annotationManager.updateData(annotationData.toJson()); + const showAnnotations = this.showAnnotations(); + this.toolbar.refreshButtonsEnabled(showAnnotations); + this.toolbar.toggleClearButtonEnabled(annotationData.length > 0 && showAnnotations); + annotations.update(annotationData ?? [], void 0, (datum) => datum.id).each((node, datum) => { + if (!showAnnotations) { + node.visible = false; + if ("setAxisLabelVisible" in node) { + node.setAxisLabelVisible(false); + } + return; + } + if ("setAxisLabelVisible" in node) { + node.setAxisLabelVisible(true); + } + this.injectDatumDependencies(datum); + updateAnnotation(node, datum, context); + }); + for (const fn of this.postUpdateFns) { + fn(); + } + this.postUpdateFns = []; + } + getAnnotationContext() { + const { seriesRect, xAxis, yAxis, snap } = this; + if (!(seriesRect && xAxis && yAxis)) { + return; + } + return { + seriesRect, + xAxis: { + ...xAxis.context, + bounds: xAxis.bounds, + labelPadding: calculateAxisLabelPadding(xAxis.layout), + snapToGroup: snap + }, + yAxis: { + ...yAxis.context, + bounds: yAxis.bounds, + labelPadding: calculateAxisLabelPadding(xAxis.layout), + snapToGroup: snap + } + }; + } + onHover(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const shiftKey = event.sourceEvent.shiftKey; + const offset = Vec219.from(event); + const point = invertCoords(offset, context); + state.transition("hover", { offset, point, shiftKey, context }); + } + onClick(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const shiftKey = event.sourceEvent.shiftKey; + const point = invertCoords(Vec219.from(event), context); + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + state.transition("click", { point, shiftKey, textInputValue, bbox }); + } + onDoubleClick(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const offset = Vec219.from(event); + state.transition("dblclick", { offset }); + } + onAxisButtonClick(coords, direction) { + this.cancel(); + this.reset(); + const context = this.getAnnotationContext(); + if (!this.annotationData || !context) + return; + const { state } = this; + this.pushAnnotationState(InteractionState22.Annotations); + const isHorizontal2 = direction === "horizontal"; + state.transition( + isHorizontal2 ? "horizontal-line" : "vertical-line" + /* VerticalLine */ + ); + this.optionsToolbar.hide(); + if (!coords) { + return; + } + const point = invertCoords(coords, context); + if (!validateDatumPoint(context, point)) { + return; + } + state.transition("click", { point, shiftKey: false }); + this.update(); + } + onResize() { + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + this.state.transition("resize", { textInputValue, bbox }); + } + hoverTouchPreHandler(event) { + if (event.device === "touch") { + this.onHover(event); + } + } + dragMoveTouchPreHandler(event) { + if (event.device === "touch" && this.ctx.interactionManager.isState(InteractionState22.AnnotationsSelected)) { + event.sourceEvent.preventDefault(); + } + } + onDragStart(event) { + if (!this.ctx.interactionManager.isState(InteractionState22.AnnotationsDraggable)) + return; + const context = this.getAnnotationContext(); + if (!context) + return; + const offset = Vec219.from(event); + const point = invertCoords(offset, context); + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + this.state.transition("dragStart", { context, offset, point, textInputValue, bbox }); + } + onDrag(event) { + if (!this.ctx.interactionManager.isState(InteractionState22.AnnotationsDraggable)) + return; + const context = this.getAnnotationContext(); + if (!context) + return; + const offset = Vec219.from(event); + const point = invertCoords(offset, context); + const shiftKey = event.sourceEvent.shiftKey; + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + this.state.transition("drag", { context, offset, point, shiftKey, textInputValue, bbox }); + } + onDragEnd() { + this.state.transition("dragEnd"); + } + onCancel(widgetEvent) { + const { sourceEvent } = widgetEvent ?? {}; + if (sourceEvent?.currentTarget !== sourceEvent?.target) + return; + this.cancel(); + this.reset(); + } + onDelete() { + if (this.textInput.isVisible()) + return; + this.cancel(); + this.delete(); + this.reset(); + this.update(); + } + onTextInput(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) + return; + const { key, shiftKey } = event; + const textInputValue = this.textInput.getValue(); + const bbox = this.textInput.getBBox(); + state.transition("textInput", { key, shiftKey, textInputValue, bbox, context }); + } + onKeyDown(event) { + const { state } = this; + const context = this.getAnnotationContext(); + if (!context) { + return; + } + const { sourceEvent } = event; + const { shiftKey, ctrlKey, metaKey } = sourceEvent; + const ctrlMeta = ctrlKey || metaKey; + const ctrlShift = ctrlKey || shiftKey; + state.transition("keyDown", { shiftKey, context }); + const translation = { x: 0, y: 0 }; + const xStep = Math.max(context?.xAxis.scale.bandwidth ?? 0, ctrlShift ? 10 : 1); + const yStep = Math.max(context?.yAxis.scale.bandwidth ?? 0, ctrlShift ? 10 : 1); + switch (sourceEvent.key) { + case "ArrowDown": + translation.y = yStep; + break; + case "ArrowUp": + translation.y = -yStep; + break; + case "ArrowLeft": + translation.x = -xStep; + break; + case "ArrowRight": + translation.x = xStep; + break; + case "Escape": + this.onCancel(); + return; + case "Backspace": + case "Delete": + this.onDelete(); + return; + } + if (translation.x || translation.y) { + state.transition("translate", { translation }); + sourceEvent.stopPropagation(); + sourceEvent.preventDefault(); + } + if (!ctrlMeta) { + return; + } + switch (sourceEvent.key) { + case "c": + state.transition("copy"); + return; + case "x": + state.transition("cut"); + this.recordActionAfterNextUpdate("Cut annotation"); + return; + case "v": + state.transition("paste"); + this.recordActionAfterNextUpdate("Paste annotation"); + return; + } + } + onKeyUp(event) { + const { shiftKey } = event.sourceEvent; + const context = this.getAnnotationContext(); + if (!context) { + return; + } + this.state.transition("keyUp", { shiftKey, context }); + this.state.transition("translateEnd"); + } + clear() { + this.cancel(); + this.deleteAll(); + this.reset(); + } + reset() { + this.state.transition("reset"); + } + cancel() { + this.state.transition("cancel"); + } + delete() { + this.state.transition("delete"); + } + deleteAll() { + this.state.transition("deleteAll"); + } + deleteEphemeralAnnotations() { + let deletedEphemeral = false; + for (const [index, datum] of this.annotationData.entries()) { + if (isEphemeralType(datum)) { + this.annotationData.splice(index, 1); + deletedEphemeral = true; + } + } + if (deletedEphemeral) { + this.recordActionAfterNextUpdate("Delete ephemeral annotations"); + } + } + hideOverlays() { + this.settingsDialog.hide(); + this.toolbar.hideOverlays(); + this.optionsToolbar.hideOverlays(); + } + pushAnnotationState(state) { + this.ctx.interactionManager.pushState(state); + this.ctx.tooltipManager.suppressTooltip("annotations"); + } + popAnnotationState(state) { + this.ctx.interactionManager.popState(state); + this.ctx.tooltipManager.unsuppressTooltip("annotations"); + } + isAnnotationState() { + return this.ctx.interactionManager.isState(InteractionState22.Annotations) || this.ctx.interactionManager.isState(InteractionState22.AnnotationsSelected); + } + update(status = ChartUpdateType2.PRE_SCENE_RENDER) { + this.ctx.updateService.update(status); + } +}; +__decorateClass2([ + Property33 +], _Annotations.prototype, "enabled", 2); +__decorateClass2([ + Property33 +], _Annotations.prototype, "toolbar", 2); +__decorateClass2([ + Property33 +], _Annotations.prototype, "optionsToolbar", 2); +__decorateClass2([ + Property33 +], _Annotations.prototype, "axesButtons", 2); +__decorateClass2([ + Property33 +], _Annotations.prototype, "snap", 2); +var Annotations = _Annotations; +var { FONT_SIZE_RATIO: FONT_SIZE_RATIO2, ThemeSymbols } = module_support_exports; +var stroke2 = { + stroke: { $ref: "foregroundColor" }, + strokeOpacity: 1, + strokeWidth: 2 +}; +var handle2 = { + fill: ThemeSymbols.DEFAULT_ANNOTATION_HANDLE_FILL, + strokeOpacity: 1, + strokeWidth: 2 +}; +var font2 = { + color: { $ref: "chartBackgroundColor" }, + fontSize: { $rem: FONT_SIZE_RATIO2.LARGE }, + fontFamily: { $ref: "fontFamily" } +}; +var axisLabel2 = { + ...font2, + enabled: true, + fill: { $ref: "foregroundColor" }, + fontSize: { $ref: "fontSize" } +}; +var text = { + ...font2, + textAlign: "left" +}; +var lineText2 = { + ...font2, + position: "top", + alignment: "center", + color: { $ref: "textColor" } +}; +var channelText = { + ...font2, + position: "top", + alignment: "center", + color: { $ref: "textColor" } +}; +var measurerStatistics2 = { + ...font2, + fontSize: { $ref: "fontSize" }, + color: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_COLOR, + fill: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_FILL, + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_STROKE, + strokeWidth: 1, + divider: { + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE, + strokeWidth: 1, + strokeOpacity: 0.5 + } +}; +var measurer2 = { + ...stroke2, + background: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + handle: { ...handle2 }, + text: { ...lineText2 }, + statistics: { ...measurerStatistics2 } +}; +var toolbar = { + buttons: { + $shallowSimple: [ + { + icon: "text-annotation", + tooltip: "toolbarAnnotationsTextAnnotations", + value: "text-menu" + }, + { + icon: "trend-line-drawing", + tooltip: "toolbarAnnotationsLineAnnotations", + value: "line-menu" + }, + { + icon: "arrow-drawing", + tooltip: "toolbarAnnotationsShapeAnnotations", + value: "shape-menu" + }, + { + icon: "delete", + tooltip: "toolbarAnnotationsClearAll", + value: "clear" + } + ] + }, + padding: { $ref: "chartPadding" } +}; +var optionsToolbar = { + buttons: { + $shallowSimple: [ + { + icon: "text-annotation", + tooltip: "toolbarAnnotationsTextColor", + value: "text-color" + }, + { + icon: "line-color", + tooltip: "toolbarAnnotationsLineColor", + value: "line-color" + }, + { + icon: "fill-color", + tooltip: "toolbarAnnotationsFillColor", + value: "fill-color" + }, + { + tooltip: "toolbarAnnotationsTextSize", + value: "text-size" + }, + { + tooltip: "toolbarAnnotationsLineStrokeWidth", + value: "line-stroke-width" + }, + { + icon: "line-style-solid", + tooltip: "toolbarAnnotationsLineStyle", + value: "line-style-type" + }, + { + icon: "settings", + tooltip: "toolbarAnnotationsSettings", + value: "settings" + }, + { + icon: "unlocked", + tooltip: "toolbarAnnotationsLock", + ariaLabel: "toolbarAnnotationsLock", + checkedOverrides: { + icon: "locked", + tooltip: "toolbarAnnotationsUnlock" + }, + value: "lock" + }, + { + icon: "delete", + tooltip: "toolbarAnnotationsDelete", + value: "delete" + } + ] + } +}; +var annotationsTheme2 = { + enabled: false, + // Lines + line: { + ...stroke2, + handle: { ...handle2 }, + text: { ...lineText2 } + }, + "horizontal-line": { + ...stroke2, + handle: { ...handle2 }, + axisLabel: { ...axisLabel2 }, + text: { ...lineText2 } + }, + "vertical-line": { + ...stroke2, + handle: { ...handle2 }, + axisLabel: { ...axisLabel2 }, + text: { ...lineText2 } + }, + // Channels + "disjoint-channel": { + ...stroke2, + background: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + handle: { ...handle2 }, + text: { ...channelText } + }, + "parallel-channel": { + ...stroke2, + middle: { + lineDash: [6, 5], + strokeWidth: 1 + }, + background: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + handle: { ...handle2 }, + text: { ...channelText } + }, + // Fibonnaccis + "fibonacci-retracement": { + ...stroke2, + strokes: ThemeSymbols.DEFAULT_FIBONACCI_STROKES, + rangeStroke: { $ref: "foregroundColor" }, + handle: { ...handle2 }, + text: { ...lineText2, position: "center" }, + label: { + ...font2, + color: void 0, + fontSize: { $rem: FONT_SIZE_RATIO2.SMALLER } + } + }, + "fibonacci-retracement-trend-based": { + ...stroke2, + strokes: ThemeSymbols.DEFAULT_FIBONACCI_STROKES, + rangeStroke: { $ref: "foregroundColor" }, + handle: { ...handle2 }, + text: { ...lineText2, position: "center" }, + label: { + ...font2, + color: void 0, + fontSize: { $rem: FONT_SIZE_RATIO2.SMALLER } + } + }, + // Texts + callout: { + ...stroke2, + ...text, + color: { $ref: "textColor" }, + handle: { ...handle2 }, + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.075 + }, + comment: { + ...text, + fontWeight: 700, + handle: { ...handle2 }, + fill: { $ref: "foregroundColor" } + }, + note: { + ...text, + color: ThemeSymbols.DEFAULT_TEXTBOX_COLOR, + fill: ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR, + stroke: { $ref: "chartBackgroundColor" }, + strokeWidth: 1, + strokeOpacity: 1, + handle: { ...handle2 }, + background: { + fill: ThemeSymbols.DEFAULT_TEXTBOX_FILL, + stroke: ThemeSymbols.DEFAULT_TEXTBOX_STROKE, + strokeWidth: 1 + } + }, + text: { + ...text, + color: { $ref: "textColor" }, + handle: { ...handle2 } + }, + // Shapes + arrow: { + ...stroke2, + handle: { ...handle2 }, + text: { ...lineText2 } + }, + "arrow-up": { + fill: { $palette: "up.fill" }, + handle: { ...handle2, stroke: { $ref: "foregroundColor" } } + }, + "arrow-down": { + fill: { $palette: "down.fill" }, + handle: { ...handle2, stroke: { $ref: "foregroundColor" } } + }, + // Measurers + "date-range": { + ...measurer2 + }, + "price-range": { + ...measurer2 + }, + "date-price-range": { + ...measurer2 + }, + "quick-date-price-range": { + up: { + ...stroke2, + fill: ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + fillOpacity: 0.2, + handle: { ...handle2 }, + statistics: { + ...measurerStatistics2, + color: "#fff", + fill: ThemeSymbols.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL, + strokeWidth: 0, + divider: { + stroke: "#fff", + strokeWidth: 1, + strokeOpacity: 0.5 + } + } + }, + down: { + ...stroke2, + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE, + fill: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, + fillOpacity: 0.2, + handle: { + ...handle2, + stroke: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE + }, + statistics: { + ...measurerStatistics2, + color: "#fff", + fill: ThemeSymbols.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL, + strokeWidth: 0, + divider: { + stroke: "#fff", + strokeWidth: 1, + strokeOpacity: 0.5 + } + } + } + }, + axesButtons: {}, + // Toolbars + toolbar, + optionsToolbar +}; +var AnnotationsModule = { + type: "root", + optionsKey: "annotations", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new Annotations(ctx), + themeTemplate: { + annotations: annotationsTheme2 + } +}; +var { BaseProperties: BaseProperties12, ObserveChanges: ObserveChanges22, ProxyProperty: ProxyProperty2, Property: Property34, calculatePlacement: calculatePlacement2 } = module_support_exports; +var Image4 = class extends BaseProperties12 { + constructor() { + super(); + this.opacity = 1; + this.loadedSynchronously = true; + this.containerWidth = 0; + this.containerHeight = 0; + this.onLoad = void 0; + this.onImageLoad = () => { + if (this.loadedSynchronously) { + return; + } + this.node.visible = false; + this.performLayout(this.containerWidth, this.containerHeight); + this.onLoad?.(); + }; + this.imageElement = createElement("img"); + this.imageElement.onload = this.onImageLoad; + this.node = new module_support_exports.Image(this.imageElement); + } + get complete() { + return this.imageElement.width > 0 && this.imageElement.height > 0; + } + performLayout(containerWidth, containerHeight) { + this.containerWidth = containerWidth; + this.containerHeight = containerHeight; + const container = { width: containerWidth, height: containerHeight }; + const placement = calculatePlacement2(this.imageElement.width, this.imageElement.height, container, this); + this.node.setProperties( + this.complete ? { + visible: true, + opacity: this.opacity, + ...placement + } : { visible: false } + ); + return placement; + } +}; +__decorateClass2([ + Property34 +], Image4.prototype, "top", 2); +__decorateClass2([ + Property34 +], Image4.prototype, "right", 2); +__decorateClass2([ + Property34 +], Image4.prototype, "bottom", 2); +__decorateClass2([ + Property34 +], Image4.prototype, "left", 2); +__decorateClass2([ + Property34 +], Image4.prototype, "width", 2); +__decorateClass2([ + Property34 +], Image4.prototype, "height", 2); +__decorateClass2([ + Property34 +], Image4.prototype, "opacity", 2); +__decorateClass2([ + ProxyProperty2("imageElement.src"), + ObserveChanges22((target) => target.loadedSynchronously = target.complete) +], Image4.prototype, "url", 2); +var { ActionOnSet: ActionOnSet3, Property: Property35 } = module_support_exports; +var Background22 = class extends module_support_exports.Background { + constructor() { + super(...arguments); + this.image = new Image4(); + } + onLayoutComplete(event) { + super.onLayoutComplete(event); + if (this.image) { + const { width: width2, height: height2 } = event.chart; + this.image.performLayout(width2, height2); + } + } + onImageLoad() { + this.ctx.updateService.update(module_support_exports.ChartUpdateType.SCENE_RENDER); + } +}; +__decorateClass2([ + Property35, + ActionOnSet3({ + newValue(image) { + this.node.appendChild(image.node); + image.onLoad = () => this.onImageLoad(); + }, + oldValue(image) { + image.node.remove(); + image.onLoad = void 0; + } + }) +], Background22.prototype, "image", 2); +var BackgroundModule2 = { + type: "root", + optionsKey: "background", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Background22(ctx) +}; +var { + Range: Range2, + TranslatableGroup: TranslatableGroup2, + BBox: BBox4, + Property: Property36, + ZIndexMap: ZIndexMap4, + ChartAxisDirection: ChartAxisDirection10, + FillGradientDefaults: FillGradientDefaults2, + FillImageDefaults: FillImageDefaults2, + FillPatternDefaults: FillPatternDefaults2, + getShapeFill: getShapeFill2, + InteractionState: InteractionState3 +} = module_support_exports; +var BandHighlight = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.id = createId(this); + this.enabled = false; + this.stroke = "rgb(195, 195, 195)"; + this.lineDash = [6, 3]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.fill = "#c16068"; + this.fillOpacity = 1; + this.fillGradientDefaults = new FillGradientDefaults2(); + this.fillPatternDefaults = new FillPatternDefaults2(); + this.fillImageDefaults = new FillImageDefaults2(); + this.bounds = new BBox4(0, 0, 0, 0); + this.bandHighlightGroup = new TranslatableGroup2({ + name: "bandHighlight", + zIndex: ZIndexMap4.AXIS_BAND_HIGHLIGHT + }); + this.rangeNode = this.bandHighlightGroup.appendChild(new Range2()); + this.activeAxisHighlight = void 0; + this.axisCtx = ctx.parent; + this.hideBand(); + ctx.domManager.addEventListener("focusin", ({ target }) => { + const isSeriesAreaChild = target instanceof HTMLElement && ctx.domManager.contains(target, "series-area"); + if (this.bandHighlightGroup.visible && !isSeriesAreaChild) { + this.hideBand(); + this.ctx.updateService.update(module_support_exports.ChartUpdateType.PERFORM_LAYOUT); + } + }); + const { + widgets: { seriesWidget, seriesDragInterpreter }, + animationManager, + eventsHub + } = ctx; + this.cleanup.register( + ctx.scene.attachNode(this.bandHighlightGroup), + seriesWidget.addListener("mousemove", (event) => this.onHoverLikeEvent(event)), + seriesWidget.addListener("mouseleave", () => this.clearAllHighlight()), + animationManager.addListener("animation-start", () => this.clearAllHighlight()), + eventsHub.on("layout:complete", (event) => this.layout(event)), + eventsHub.on("series:focus-change", () => this.onKeyPress()), + eventsHub.on("zoom:pan-start", () => this.clearAllHighlight()), + eventsHub.on("zoom:change", () => this.clearAllHighlight()), + eventsHub.on("dom:resize", () => this.clearAllHighlight()), + eventsHub.on("axis:change", () => this.axisChange()) + ); + if (seriesDragInterpreter) { + this.cleanup.register( + seriesDragInterpreter.events.on("drag-move", (event) => this.onHoverLikeEvent(event)), + seriesDragInterpreter.events.on("click", (event) => this.onClick(event)) + ); + } + } + axisChange() { + this.onHighlightChange(); + } + isHover(event) { + return event.type === "mousemove" || event.type === "click" || event.device === "touch" && this.ctx.chartService.touch.dragAction === "hover"; + } + onClick(event) { + if (event.device === "touch") { + this.onHoverLikeEvent(event); + } + } + clearAllHighlight() { + if (!this.ctx.interactionManager.isState(InteractionState3.Clickable)) + return; + this.onHighlightChange(); + } + onKeyPress() { + if (this.ctx.interactionManager.isState(InteractionState3.Default)) { + this.onHighlightChange(); + } + } + onHoverLikeEvent(event) { + const requiredState = this.isHover(event) ? InteractionState3.Clickable : InteractionState3.AnnotationsMoveable; + if (!this.ctx.interactionManager.isState(requiredState)) + return; + this.handleHoverHighlight(event); + } + handleHoverHighlight(event) { + if (!event) + return; + const { currentX: x, currentY: y } = event; + this.onHighlightChange(this.axisCtx.pickBand({ x, y })); + } + layout({ series: { rect: rect2, visible }, axes }) { + if (!visible || !axes || !this.enabled) + return; + const { position: axisPosition = "left", axisId } = this.axisCtx; + const axisLayout = axes.find((a) => a.id === axisId); + if (!axisLayout) + return; + this.axisLayout = axisLayout; + this.bounds = rect2.clone().grow(axisLayout.gridPadding, axisPosition); + const { bandHighlightGroup, bounds } = this; + bandHighlightGroup.translationX = Math.round(bounds.x); + bandHighlightGroup.translationY = Math.round(bounds.y); + this.updateBand(); + } + updateBand() { + const { + rangeNode: node, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + fill, + fillOpacity, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3, + lineDashOffset, + axisLayout + } = this; + if (!axisLayout) + return; + node.stroke = stroke22; + node.strokeWidth = strokeWidth; + node.strokeOpacity = strokeOpacity; + node.lineDash = lineDash; + node.lineDashOffset = lineDashOffset; + node.fill = getShapeFill2(fill, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + node.fillOpacity = fillOpacity; + node.startLine = true; + node.endLine = true; + } + isVertical() { + return this.axisCtx.direction === ChartAxisDirection10.X; + } + onHighlightChange(axisBandDatum) { + if (!this.enabled) + return; + this.activeAxisHighlight = axisBandDatum; + if (this.activeAxisHighlight) { + this.showBand(); + } else { + this.hideBand(); + } + this.ctx.updateService.update(module_support_exports.ChartUpdateType.SCENE_RENDER); + } + updateBandPosition() { + const { rangeNode, bounds } = this; + const { band } = this.activeAxisHighlight ?? {}; + if (band == void 0) { + this.hideBand(); + return; + } + let r0 = Math.min(...band); + let r1 = Math.max(...band); + if (r1 - r0 < 1) { + const mid = (r0 + r1) / 2; + r0 = mid - 0.5; + r1 = mid + 0.5; + } + if (this.isVertical()) { + rangeNode.y1 = 0; + rangeNode.y2 = bounds.height; + rangeNode.x1 = r0; + rangeNode.x2 = r1; + rangeNode.horizontal = true; + } else { + rangeNode.y1 = r0; + rangeNode.y2 = r1; + rangeNode.x1 = 0; + rangeNode.x2 = bounds.width; + rangeNode.horizontal = false; + } + } + showBand() { + this.updateBandPosition(); + this.bandHighlightGroup.visible = true; + } + hideBand() { + this.bandHighlightGroup.visible = false; + } +}; +__decorateClass2([ + Property36 +], BandHighlight.prototype, "enabled", 2); +__decorateClass2([ + Property36 +], BandHighlight.prototype, "stroke", 2); +__decorateClass2([ + Property36 +], BandHighlight.prototype, "lineDash", 2); +__decorateClass2([ + Property36 +], BandHighlight.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property36 +], BandHighlight.prototype, "strokeWidth", 2); +__decorateClass2([ + Property36 +], BandHighlight.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property36 +], BandHighlight.prototype, "fill", 2); +__decorateClass2([ + Property36 +], BandHighlight.prototype, "fillOpacity", 2); +__decorateClass2([ + Property36 +], BandHighlight.prototype, "fillGradientDefaults", 2); +__decorateClass2([ + Property36 +], BandHighlight.prototype, "fillPatternDefaults", 2); +__decorateClass2([ + Property36 +], BandHighlight.prototype, "fillImageDefaults", 2); +var BandHighlightModule = { + type: "axis-option", + optionsKey: "bandHighlight", + packageType: "enterprise", + chartTypes: ["cartesian"], + axisTypes: ["category", "ordinal-time", "unit-time", "grouped-category"], + moduleFactory: (ctx) => new BandHighlight(ctx), + themeTemplate: { + bandHighlight: { + enabled: false, + strokeWidth: 0, + lineDash: [], + fill: { $foregroundBackgroundMix: 0.05 } + } + } +}; +var { ActionOnSet: ActionOnSet4, LayoutElement: LayoutElement22, Menu: Menu3, Property: Property37 } = module_support_exports; +var menuItems = [ + { label: "toolbarSeriesTypeOHLC", icon: "ohlc-series", value: "ohlc" }, + { label: "toolbarSeriesTypeCandles", icon: "candlestick-series", value: "candlestick" }, + { label: "toolbarSeriesTypeHollowCandles", icon: "hollow-candlestick-series", value: "hollow-candlestick" }, + { label: "toolbarSeriesTypeLine", icon: "line-series", value: "line" }, + { label: "toolbarSeriesTypeStepLine", icon: "step-line-series", value: "step-line" }, + { label: "toolbarSeriesTypeHLC", icon: "hlc-series", value: "hlc" }, + { label: "toolbarSeriesTypeHighLow", icon: "high-low-series", value: "high-low" } +]; +var ChartToolbar = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.menu = new Menu3(this.ctx, "chart-toolbar"); + this.toolbar = ctx.sharedToolbar.getSharedToolbar("chartToolbar"); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPressed.bind(this)), + ctx.layoutManager.registerElement(LayoutElement22.ToolbarLeft, this.onLayoutStart.bind(this)), + () => this.toolbar.destroy() + ); + } + onLayoutStart(event) { + if (!this.enabled) + return; + this.updateButton(); + this.toolbar.layout(event.layoutBox); + } + onButtonPressed({ event, buttonBounds, buttonWidget }) { + this.menu.setAnchor({ x: buttonBounds.x + buttonBounds.width + 6, y: buttonBounds.y }); + this.menu.show(buttonWidget, { + items: menuItems, + menuItemRole: "menuitemradio", + ariaLabel: this.ctx.localeManager.t("toolbarSeriesTypeDropdown"), + class: "ag-charts-chart-toolbar__menu", + value: this.getChartType(), + sourceEvent: event.sourceEvent, + onPress: (item) => { + this.setChartType(item.value); + this.hidePopover(); + }, + onHide: () => { + this.toolbar.clearActiveButton(); + } + }); + this.toolbar.toggleActiveButtonByIndex(0); + } + updateButton() { + const chartType = this.getChartType(); + const icon = menuItems.find((item) => item.value === chartType)?.icon; + if (icon != null) { + this.toolbar.updateButtons([{ icon, tooltip: "toolbarSeriesTypeDropdown", value: "menu" }]); + } + } + hidePopover() { + this.toolbar.clearActiveButton(); + this.menu.hide(); + } + setChartType(chartType) { + const options = { chartType }; + this.ctx.chartService.publicApi?.updateDelta(options).catch((e) => logger_exports.error(e)); + } + getChartType() { + const chartType = this.ctx.chartService.publicApi?.getOptions()?.chartType; + if (chartType == null || !menuItems.some((item) => item.value === chartType)) { + return "candlestick"; + } + return chartType; + } +}; +__decorateClass2([ + Property37, + ActionOnSet4({ + changeValue(enabled) { + this.toolbar?.setHidden(!enabled); + } + }) +], ChartToolbar.prototype, "enabled", 2); +var ChartToolbarModule = { + type: "root", + optionsKey: "chartToolbar", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new ChartToolbar(ctx) +}; +function showsFor(showOn, showing) { + if (showOn === "always") + return true; + if (showOn === "series-area") + return showing === "series-area" || showing === "series-node"; + return showOn === showing; +} +function appendItem(showing, item, result) { + let mustShow = true; + if (item.type === "separator") { + const last = result.at(-1); + mustShow = last !== void 0 && last.type !== "separator"; + } + mustShow && (mustShow = showsFor(item.showOn ?? "always", showing)); + if (mustShow) { + const menuItem = new ContextMenuItem(item); + result.push(menuItem); + return menuItem; + } +} +function appendBuiltinItem(showing, registry, keyword, result) { + if (registry.isVisible(keyword)) { + appendItem(showing, registry.builtins.items[keyword], result); + } +} +function expandBuiltin(showing, registry, keyword, result) { + const { builtins } = registry; + if (isKeyOf(keyword, builtins.lists)) { + for (const childKeyword of builtins.lists[keyword]) { + appendBuiltinItem(showing, registry, childKeyword, result); + } + } else { + appendBuiltinItem(showing, registry, keyword, result); + } +} +function expandItems(showing, registry, items, result) { + for (const item of items) { + if (typeof item === "string") { + expandBuiltin(showing, registry, item, result); + } else { + const menuItem = appendItem(showing, item, result); + if (item.items && menuItem && item.items.length > 0) { + expandItems(showing, registry, item.items, menuItem.items); + } + } + } + if (result.at(-1)?.type === "separator") { + result.pop(); + } +} +var ContextMenuItem = class { + constructor(options) { + this.type = "action"; + this.showOn = "always"; + this.label = ""; + this.iconUrl = void 0; + this.enabled = true; + this.items = []; + this.action = void 0; + if (options) + this.setOptions(options); + this.items = []; + } + setField(key, that, value) { + that[key] = value; + } + setOptions(options) { + let key; + for (key in options) { + if (options[key] !== void 0) { + this.setField(key, this, options[key]); + } + } + } +}; +var DEFAULT_CONTEXT_MENU_CLASS = "ag-charts-context-menu"; +var { Property: Property38, ContextMenuRegistry: ContextMenuRegistry2, callWithContext: callWithContext2, getIconClassNames: getIconClassNames3 } = module_support_exports; +var moduleId2 = "context-menu"; +var ContextMenu = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = true; + this.darkTheme = false; + this.items = ["defaults"]; + this.pickedNode = void 0; + this.showEvent = void 0; + this.x = 0; + this.y = 0; + this.collapsingSubMenus = 0; + this.menuWidget = new exports_exports.MenuWidget(); + this.interactionManager = ctx.interactionManager; + this.element = ctx.domManager.addChild("canvas-overlay", moduleId2); + this.element.classList.add(DEFAULT_CONTEXT_MENU_CLASS); + this.element.style.display = "none"; + this.element.addEventListener("contextmenu", (event) => event.preventDefault()); + this.element.addEventListener("focusout", ({ relatedTarget }) => { + if (this.collapsingSubMenus > 0) + return; + if (relatedTarget == null || relatedTarget instanceof Node && !this.element.contains(relatedTarget)) { + this.hide(); + } + }); + this.cleanup.register( + () => this.element.remove(), + () => this.menuWidget.destroy(), + ctx.eventsHub.on("dom:hidden", () => this.hide()), + this.menuWidget.addListener("collapse-widget", () => this.onCollapse()) + ); + this.menuWidget.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__menu`); + if (typeof MutationObserver !== "undefined") { + const observer = new MutationObserver(() => { + if (this.element.contains(this.menuWidget.getElement())) { + this.reposition(); + } + }); + observer.observe(this.element, { childList: true }); + this.mutationObserver = observer; + this.cleanup.register(() => observer.disconnect()); + } + this.ctx.contextMenuRegistry.builtins.items["download"].action = () => { + const title = ctx.chartService.title; + let fileName = "image"; + if (title?.enabled) { + fileName = title.node.getPlainText().replace(/\.+/, ""); + } + this.ctx.chartService.publicApi?.download({ fileName }).catch((e) => { + logger_exports.error("Unable to download chart", e); + }); + }; + this.cleanup.register(this.ctx.eventsHub.on("context-menu:complete", (e) => this.onContext(e))); + } + expandItemsOptions(showing) { + const result = []; + expandItems(showing, this.ctx.contextMenuRegistry, this.items, result); + return result; + } + onContext(event) { + if (!this.enabled) + return; + event.widgetEvent.sourceEvent.preventDefault(); + this.showEvent = event.widgetEvent.sourceEvent; + this.x = event.x; + this.y = event.y; + this.pickedNode = void 0; + this.pickedLegendItem = void 0; + if (ContextMenuRegistry2.check("series-node", event)) { + this.pickedNode = event.context.pickedNode; + } else if (ContextMenuRegistry2.check("legend-item", event)) { + this.pickedLegendItem = event.context.legendItem; + } + const expandedItems = this.expandItemsOptions(event.showOn); + if (expandedItems.length === 0) + return; + this.show(event.widgetEvent, expandedItems); + } + show(widgetEvent, expandedItems) { + const { sourceEvent } = widgetEvent; + this.interactionManager.pushState(module_support_exports.InteractionState.ContextMenu); + this.element.style.display = "block"; + const overrideFocusVisible = sourceEvent.pointerType === "touch" ? false : void 0; + if (overrideFocusVisible !== void 0) { + this.ctx.chartService.overrideFocusVisible(overrideFocusVisible); + } + this.createMenu(expandedItems); + this.element.appendChild(this.menuWidget.getElement()); + this.menuWidget.expand({ sourceEvent, overrideFocusVisible }); + } + hide() { + this.menuWidget.collapse(); + } + onCollapse() { + this.interactionManager.popState(module_support_exports.InteractionState.ContextMenu); + this.menuWidget.getElement().remove(); + this.element.style.display = "none"; + } + onSubMenuExpand(button, menu) { + const bounds = button.getBounds(); + button.setFocusOverride(true); + button.getElement().insertAdjacentElement("afterend", menu.getElement()); + menu.getElement().style.position = "absolute"; + const canvasRect = this.ctx.domManager.getBoundingClientRect(); + const buttonClientRect = button.getBoundingClientRect(); + const remainingSpaceOnRight = canvasRect.right - buttonClientRect.right; + const remainingSpaceOnLeft = buttonClientRect.left - canvasRect.left; + const { offsetWidth: menuOffsetWidth, offsetHeight: menuOffsetHeight } = menu.getElement(); + let y = bounds.y; + if (canvasRect.height > menuOffsetHeight) { + const remainingSpaceOnBottom = canvasRect.bottom - buttonClientRect.top; + if (remainingSpaceOnBottom < menuOffsetHeight) { + y -= menuOffsetHeight - remainingSpaceOnBottom; + } + } + if (remainingSpaceOnRight >= menuOffsetWidth) { + menu.setBounds({ x: bounds.x + bounds.width, y }); + } else { + const x = bounds.x - menuOffsetWidth; + const leftDelta = remainingSpaceOnLeft + x; + if (leftDelta >= 0) { + menu.setBounds({ x, y }); + } else { + menu.setBounds({ x: x - leftDelta, y }); + } + } + } + onSubMenuCollapse(button, menu) { + button.setFocusOverride(void 0); + this.collapsingSubMenus++; + menu.remove(); + this.collapsingSubMenus--; + } + createMenu(expandedItems) { + const { menuWidget } = this; + menuWidget.clear(); + menuWidget.setTabIndex(-1); + this.createMenuItems(menuWidget, expandedItems); + } + createMenuItems(menuWidget, expandedItems) { + for (const item of expandedItems) { + switch (item.type) { + case "separator": { + const sep = menuWidget.addSeparator(); + sep.classList.add(`${DEFAULT_CONTEXT_MENU_CLASS}__divider`); + break; + } + case "action": { + if (item.items.length === 0) { + const btn = new exports_exports.MenuItemWidget(); + this.initButtonElement(btn, item); + menuWidget.addChild(btn); + } else { + const { subMenuButton, subMenu } = menuWidget.addSubMenu(); + subMenu.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__menu`); + subMenu.addListener("expand-widget", () => this.onSubMenuExpand(subMenuButton, subMenu)); + subMenu.addListener("collapse-widget", () => this.onSubMenuCollapse(subMenuButton, subMenu)); + this.initButtonElement(subMenuButton, item); + this.createMenuItems(subMenu, item.items); + } + break; + } + default: + throw new Error("unhandled case"); + } + } + } + createButtonOnClick(showOn, callback2) { + if (ContextMenuRegistry2.checkCallback("legend-item", showOn, callback2)) { + return (widgetEvent) => { + const event = widgetEvent.sourceEvent; + if (this.pickedLegendItem) { + const { seriesId, itemId, label } = this.pickedLegendItem; + const { chartService: chart } = this.ctx; + if (typeof itemId !== "string") { + logger_exports.error(`unexpected itemId type: [${typeof itemId}] (expected [string])`); + return; + } + const series = chart.series.find((s) => s.id === seriesId); + const callers = [series?.properties, chart]; + const apiEvent = { + type: "contextmenu", + seriesId, + itemId, + text: toPlainText(label.text), + event + }; + callWithContext2(callers, callback2, apiEvent); + this.hide(); + } else { + logger_exports.error("legend item not found"); + } + }; + } else if (ContextMenuRegistry2.checkCallback("series-area", showOn, callback2)) { + return () => { + const caller = this.ctx.chartService; + const apiEvent = { type: "seriesContextMenuAction", event: this.showEvent }; + callWithContext2(caller, callback2, apiEvent); + this.hide(); + }; + } else if (ContextMenuRegistry2.checkCallback("series-node", showOn, callback2)) { + return () => { + const { showEvent } = this; + const { chartService: chart } = this.ctx; + const pickedNode = this.pickedNode; + const callers = [pickedNode?.series.properties, chart]; + const apiEvent = pickedNode?.series.createNodeContextMenuActionEvent(showEvent, pickedNode); + if (apiEvent) { + callWithContext2(callers, callback2, apiEvent); + } else { + logger_exports.error("series node not found"); + } + this.hide(); + }; + } + return () => { + const caller = this.ctx.chartService; + const apiEvent = { type: "contextMenuEvent", event: this.showEvent }; + callWithContext2(caller, callback2, apiEvent); + this.hide(); + }; + } + initTableCells(elem) { + const cellIcon = createElement("div"); + const cellLabel = createElement("div"); + const cellArrow = createElement("div"); + cellIcon.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__icon`, true); + cellLabel.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__cell`, true); + cellArrow.classList.toggle(`${DEFAULT_CONTEXT_MENU_CLASS}__cell`, true); + cellIcon.ariaHidden = "true"; + cellLabel.role = "presentation"; + cellArrow.ariaHidden = "true"; + elem.append(cellIcon, cellLabel, cellArrow); + return { cellIcon, cellLabel, cellArrow }; + } + initButtonElement(button, item) { + button.addClass(`${DEFAULT_CONTEXT_MENU_CLASS}__item`); + button.setEnabled(item.enabled); + const label = this.ctx.localeManager.t(item.label); + const cellPaddingClass = `${DEFAULT_CONTEXT_MENU_CLASS}__cellpadding`; + const { cellIcon, cellLabel, cellArrow } = this.initTableCells(button.getElement()); + cellLabel.textContent = label; + cellLabel.classList.add(cellPaddingClass); + if (item.iconUrl != null) { + const img = createElement("img"); + img.src = item.iconUrl; + cellIcon.append(img); + cellIcon.classList.add(cellPaddingClass); + } + if (item.items.length > 0) { + const span = createElement("span", getIconClassNames3("chevron-right")); + cellArrow.append(span); + cellArrow.classList.add(cellPaddingClass); + } + const { showOn, action } = item; + if (action != null) { + button.addListener("click", this.createButtonOnClick(showOn, action)); + } + if (item.items.length === 0) { + button.addListener("mouseleave", () => button.setFocusOverride(false)); + button.addListener("mouseenter", () => button.setFocusOverride(void 0)); + } + } + reposition() { + let { x, y } = this; + this.element.style.top = "unset"; + this.element.style.bottom = "unset"; + const canvasRect = this.ctx.domManager.getBoundingClientRect(); + const { offsetWidth: width2, offsetHeight: height2 } = this.element; + x = clamp(0, x, canvasRect.width - width2); + y = clamp(0, y, canvasRect.height - height2); + this.element.style.left = `${x}px`; + this.element.style.top = `calc(${y}px - 0.5em)`; + } + destroy() { + super.destroy(); + this.mutationObserver?.disconnect(); + this.ctx.domManager.removeStyles(moduleId2); + this.ctx.domManager.removeChild("canvas-overlay", moduleId2); + } +}; +__decorateClass2([ + Property38 +], ContextMenu.prototype, "enabled", 2); +__decorateClass2([ + Property38 +], ContextMenu.prototype, "darkTheme", 2); +__decorateClass2([ + Property38 +], ContextMenu.prototype, "items", 2); +var ContextMenuModule = { + type: "root", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + optionsKey: "contextMenu", + moduleFactory: (ctx) => new ContextMenu(ctx), + themeTemplate: { + contextMenu: { + enabled: true, + darkTheme: module_support_exports.ThemeSymbols.IS_DARK_THEME + } + } +}; +function readDatum(nodeDatum) { + if (typeof nodeDatum?.datum === "object") { + return nodeDatum.datum; + } + return null; +} +var { FormatManager: FormatManager2, BaseProperties: BaseProperties13, Property: Property39 } = module_support_exports; +var DEFAULT_LABEL_CLASS = "ag-charts-crosshair-label"; +var CrosshairLabelProperties = class extends BaseProperties13 { + constructor() { + super(...arguments); + this.enabled = true; + this.xOffset = 0; + this.yOffset = 0; + this.format = void 0; + this.renderer = void 0; + this._cachedFormatter = void 0; + } + formatValue(callWithContext22, type, value, params) { + const { formatter: formatter2, format } = this; + const { domain, boundSeries } = params; + let result; + if (formatter2 != null) { + const fractionDigits = params.type === "number" ? params.fractionDigits : void 0; + const unit = params.type === "date" ? params.unit : void 0; + const step = params.type === "date" ? params.step : void 0; + result = callWithContext22(formatter2, { value, domain, fractionDigits, unit, step, boundSeries }); + } + if (format != null) { + let cachedFormatter = this._cachedFormatter; + if (cachedFormatter == null || cachedFormatter.type !== type || cachedFormatter.format !== format) { + cachedFormatter = { + type, + format, + formatter: FormatManager2.getFormatter(type, format) + }; + this._cachedFormatter = cachedFormatter; + } + result ?? (result = cachedFormatter.formatter?.(value)); + } + return result == null ? void 0 : String(result); + } +}; +__decorateClass2([ + Property39 +], CrosshairLabelProperties.prototype, "enabled", 2); +__decorateClass2([ + Property39 +], CrosshairLabelProperties.prototype, "xOffset", 2); +__decorateClass2([ + Property39 +], CrosshairLabelProperties.prototype, "yOffset", 2); +__decorateClass2([ + Property39 +], CrosshairLabelProperties.prototype, "formatter", 2); +__decorateClass2([ + Property39 +], CrosshairLabelProperties.prototype, "format", 2); +__decorateClass2([ + Property39 +], CrosshairLabelProperties.prototype, "renderer", 2); +var CrosshairLabel = class extends CrosshairLabelProperties { + constructor(domManager, key, axisId) { + super(); + this.domManager = domManager; + this.id = createId(this); + this.element = domManager.addChild("canvas-overlay", `crosshair-label-${this.id}`); + this.element.classList.add(DEFAULT_LABEL_CLASS); + setAttribute(this.element, "aria-hidden", true); + this.element.dataset.key = key; + this.element.dataset.axisId = axisId; + } + show(meta) { + const { element: element2 } = this; + const left = meta.x + this.xOffset; + const top = meta.y + this.yOffset; + element2.style.top = `${Math.round(top)}px`; + element2.style.left = `${Math.round(left)}px`; + this.toggle(true); + } + setLabelHtml({ html, styles }) { + if (html !== void 0) { + this.element.innerHTML = html; + } + if (styles !== void 0) { + const styleElement = this.element.children[0] ?? this.element; + Object.assign(styleElement.style, styles); + } + } + getBBox() { + const { element: element2 } = this; + return new module_support_exports.BBox( + element2.clientLeft, + element2.clientTop, + element2.clientWidth, + element2.clientHeight + ); + } + toggle(visible) { + this.element.classList.toggle(`ag-charts-crosshair-label--hidden`, !visible); + } + destroy() { + this.domManager.removeChild("canvas-overlay", `crosshair-label-${this.id}`); + } + toLabelHtml(input, defaults) { + if (typeof input === "string") { + return { html: input, styles: {} }; + } + defaults = defaults ?? {}; + const { + text: text2 = defaults.text ?? "", + color: color6 = defaults.color, + backgroundColor = defaults.backgroundColor, + opacity = defaults.opacity ?? 1 + } = input; + const styles = { + opacity, + "background-color": backgroundColor?.toLowerCase(), + color: color6 + }; + return { + html: `
+ ${text2} +
`, + styles + }; + } +}; +var { Group: Group52, TranslatableGroup: TranslatableGroup22, Line: Line4, BBox: BBox5, InteractionState: InteractionState4, Property: Property40, ZIndexMap: ZIndexMap5, ChartAxisDirection: ChartAxisDirection11 } = module_support_exports; +var Crosshair = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.id = createId(this); + this.enabled = false; + this.stroke = "rgb(195, 195, 195)"; + this.lineDash = [6, 3]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.snap = true; + this.label = new CrosshairLabelProperties(); + this.seriesRect = new BBox5(0, 0, 0, 0); + this.bounds = new BBox5(0, 0, 0, 0); + this.crosshairGroup = new TranslatableGroup22({ + name: "crosshairs", + zIndex: ZIndexMap5.SERIES_CROSSHAIR + }); + this.lineGroup = this.crosshairGroup.appendChild( + new Group52({ + name: `${this.id}-crosshair-lines`, + zIndex: ZIndexMap5.SERIES_CROSSHAIR + }) + ); + this.lineGroupSelection = module_support_exports.Selection.select(this.lineGroup, Line4, false); + this.activeHighlight = void 0; + this.axisCtx = ctx.parent; + this.labels = {}; + this.hideCrosshairs(); + ctx.domManager.addEventListener("focusin", ({ target }) => { + const isSeriesAreaChild = target instanceof HTMLElement && ctx.domManager.contains(target, "series-area"); + if (this.crosshairGroup.visible && !isSeriesAreaChild) { + this.hideCrosshairs(); + this.ctx.updateService.update(module_support_exports.ChartUpdateType.PERFORM_LAYOUT); + } + }); + const { seriesDragInterpreter } = ctx.widgets; + this.cleanup.register( + ctx.scene.attachNode(this.crosshairGroup), + ctx.widgets.seriesWidget.addListener("mousemove", (event) => this.onMouseHoverLike(event)), + ctx.widgets.seriesWidget.addListener("mouseleave", () => this.onMouseOut()), + ctx.eventsHub.on("series:focus-change", () => this.onKeyPress()), + ctx.eventsHub.on("zoom:pan-start", () => this.onMouseOut()), + ctx.eventsHub.on("zoom:change", () => this.onMouseOut()), + ctx.eventsHub.on("highlight:change", (event) => this.onHighlightChange(event)), + ctx.eventsHub.on("layout:complete", (event) => this.layout(event)), + () => { + for (const label of Object.values(this.labels)) { + label.destroy(); + } + } + ); + if (seriesDragInterpreter) { + this.cleanup.register( + seriesDragInterpreter.events.on("drag-move", (event) => this.onMouseHoverLike(event)), + seriesDragInterpreter.events.on("click", (event) => this.onClick(event)) + ); + } + } + layout({ series: { rect: rect2, visible }, axes }) { + if (!visible || !axes || !this.enabled) + return; + this.seriesRect = rect2; + const { position: axisPosition = "left", axisId } = this.axisCtx; + const axisLayout = axes.find((a) => a.id === axisId); + if (!axisLayout) + return; + this.axisLayout = axisLayout; + this.bounds = rect2.clone().grow(axisLayout.gridPadding + axisLayout.seriesAreaPadding, axisPosition); + const { crosshairGroup, bounds } = this; + crosshairGroup.translationX = Math.round(bounds.x); + crosshairGroup.translationY = Math.round(bounds.y); + const crosshairKeys = ["pointer", ...this.axisCtx.seriesKeyProperties()]; + this.updateSelections(crosshairKeys); + this.updateLines(); + this.updateLabels(crosshairKeys); + } + updateSelections(data) { + this.lineGroupSelection.update(data, void 0, (key) => key); + } + updateLabels(keys) { + const { labels, ctx } = this; + for (const key of keys) { + if (this.label.enabled) { + labels[key] ?? (labels[key] = new CrosshairLabel(ctx.domManager, key, this.axisCtx.axisId)); + } + if (labels[key]) { + this.updateLabel(labels[key]); + } + } + } + updateLabel(label) { + const { enabled, xOffset, yOffset, format, renderer } = this.label; + label.enabled = enabled; + label.xOffset = xOffset; + label.yOffset = yOffset; + label.format = format; + label.renderer = renderer; + } + updateLines() { + const { lineGroupSelection, bounds, stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset, axisLayout } = this; + if (!axisLayout) + return; + const isVertical = this.isVertical(); + lineGroupSelection.each((line) => { + line.stroke = stroke22; + line.strokeWidth = strokeWidth; + line.strokeOpacity = strokeOpacity; + line.lineDash = lineDash; + line.lineDashOffset = lineDashOffset; + line.y1 = 0; + line.y2 = isVertical ? bounds.height : 0; + line.x1 = 0; + line.x2 = isVertical ? 0 : bounds.width; + }); + } + isVertical() { + return this.axisCtx.direction === ChartAxisDirection11.X; + } + isHover(event) { + return event.type === "mousemove" || event.type === "click" || event.device === "touch" && this.ctx.chartService.touch.dragAction === "hover"; + } + formatValue(value) { + return toPlainText(this.axisCtx.formatScaleValue(value, "crosshair", this.label)); + } + onClick(event) { + if (event.device === "touch") { + this.onMouseHoverLike(event); + } + } + onMouseHoverLike(event) { + if (!this.enabled || this.snap) + return; + const requiredState = this.isHover(event) ? InteractionState4.Clickable : InteractionState4.AnnotationsMoveable; + if (!this.ctx.interactionManager.isState(requiredState)) + return; + this.updatePositions(this.getData(event)); + this.crosshairGroup.visible = true; + this.ctx.updateService.update(module_support_exports.ChartUpdateType.SCENE_RENDER); + } + onMouseOut() { + if (!this.ctx.interactionManager.isState(InteractionState4.Clickable)) + return; + this.hideCrosshairs(); + this.ctx.updateService.update(module_support_exports.ChartUpdateType.SCENE_RENDER); + } + onKeyPress() { + if (this.enabled && !this.snap && this.ctx.interactionManager.isState(InteractionState4.Default)) { + this.hideCrosshairs(); + } + } + onHighlightChange(event) { + if (!this.enabled) + return; + const { crosshairGroup, axisCtx } = this; + const { datum, series } = event.currentHighlight ?? {}; + const hasCrosshair = datum && (series?.axes.x?.id === axisCtx.axisId || series?.axes.y?.id === axisCtx.axisId); + this.activeHighlight = hasCrosshair ? event.currentHighlight : void 0; + if (!this.activeHighlight) { + this.hideCrosshairs(); + } else if (this.snap) { + const activeHighlightData = this.getActiveHighlightData(this.activeHighlight); + this.updatePositions(activeHighlightData); + crosshairGroup.visible = true; + } + } + isInRange(value) { + return this.axisCtx.inRange(value); + } + updatePositions(data) { + const { seriesRect, lineGroupSelection } = this; + lineGroupSelection.each((line, key) => { + const lineData = data[key]; + if (!lineData) { + line.visible = false; + this.hideLabel(key); + return; + } + line.visible = true; + const { value, position } = lineData; + let x = 0; + let y = 0; + if (this.isVertical()) { + x = position; + line.x = Math.round(x); + } else { + y = position; + line.y = Math.round(y); + } + if (this.label.enabled) { + this.showLabel(x + seriesRect.x, y + seriesRect.y, value, key); + } else { + this.hideLabel(key); + } + }); + } + getData(event) { + const { axisCtx } = this; + const key = "pointer"; + const { xKey = "", yKey = "" } = this.activeHighlight ?? {}; + const { currentX, currentY } = event; + const datum = readDatum(this.activeHighlight); + const isVertical = this.isVertical(); + const position = isVertical ? currentX : currentY; + let value = datum?.[isVertical ? xKey : yKey] ?? ""; + if (axisCtx.continuous) { + value = axisCtx.scaleInvert(position); + } + return { [key]: { position, value } }; + } + getActiveHighlightData(activeHighlight) { + const { axisCtx } = this; + const { series, xKey = "", aggregatedValue, cumulativeValue, midPoint } = activeHighlight; + const datum = readDatum(activeHighlight); + const seriesKeyProperties = series.getKeyProperties(axisCtx.direction); + const halfBandwidth = (axisCtx.scale.bandwidth ?? 0) / 2; + const matchingAxisId = series.axes[axisCtx.direction]?.id === axisCtx.axisId; + const isYKey = seriesKeyProperties.includes("yKey") && matchingAxisId; + const isXKey = seriesKeyProperties.includes("xKey") && matchingAxisId; + const datumValue = aggregatedValue ?? cumulativeValue; + if (isYKey && datumValue !== void 0) { + const position = axisCtx.scale.convert(datumValue) + halfBandwidth; + const isInRange = this.isInRange(position); + return isInRange ? { + yKey: { value: datumValue, position } + } : {}; + } + if (isXKey) { + const position = (this.isVertical() ? midPoint?.x : midPoint?.y) ?? 0; + const value = axisCtx.continuous ? axisCtx.scaleInvert(position) : datum?.[xKey]; + return this.isInRange(position) ? { xKey: { value, position } } : {}; + } + const activeHighlightData = {}; + for (const key of seriesKeyProperties) { + const keyValue = series.properties[key]; + const value = datum?.[keyValue]; + const position = axisCtx.scale.convert(value) + halfBandwidth; + const isInRange = this.isInRange(position); + if (isInRange) { + activeHighlightData[key] = { value, position }; + } + } + return activeHighlightData; + } + getLabelHtml(value, label) { + const fractionDigits = this.axisLayout?.label?.fractionDigits ?? 0; + const defaults = { text: this.formatValue(value) }; + if (this.label.renderer) { + return label.toLabelHtml(this.label.renderer({ value, fractionDigits }), defaults); + } + return label.toLabelHtml(defaults); + } + showLabel(x, y, value, key) { + if (!this.axisLayout) + return; + const { bounds } = this; + const label = this.labels[key]; + const html = this.getLabelHtml(value, label); + label.setLabelHtml(html); + const { width: width2, height: height2 } = label.getBBox(); + const axisPosition = this.axisCtx.position; + let padding2 = this.axisLayout.label.spacing + this.axisLayout.tickSize; + if (this.axisCtx.direction === ChartAxisDirection11.X) { + padding2 -= 4; + label.show({ + x: x - width2 / 2, + y: axisPosition === "bottom" ? bounds.y + bounds.height + padding2 : bounds.y - height2 - padding2 + }); + } else { + padding2 -= 8; + label.show({ + x: axisPosition === "right" ? bounds.x + bounds.width + padding2 : bounds.x - width2 - padding2, + y: y - height2 / 2 + }); + } + } + hideCrosshairs() { + this.crosshairGroup.visible = false; + for (const key of Object.keys(this.labels)) { + this.hideLabel(key); + } + } + hideLabel(key) { + this.labels[key]?.toggle(false); + } +}; +__decorateClass2([ + Property40 +], Crosshair.prototype, "enabled", 2); +__decorateClass2([ + Property40 +], Crosshair.prototype, "stroke", 2); +__decorateClass2([ + Property40 +], Crosshair.prototype, "lineDash", 2); +__decorateClass2([ + Property40 +], Crosshair.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property40 +], Crosshair.prototype, "strokeWidth", 2); +__decorateClass2([ + Property40 +], Crosshair.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property40 +], Crosshair.prototype, "snap", 2); +__decorateClass2([ + Property40 +], Crosshair.prototype, "label", 2); +var CrosshairModule = { + type: "axis-option", + optionsKey: "crosshair", + packageType: "enterprise", + chartTypes: ["cartesian"], + axisTypes: ["category", "time", "unit-time", "ordinal-time", "number", "log"], + moduleFactory: (ctx) => new Crosshair(ctx), + themeTemplate: { + crosshair: { + snap: true, + stroke: { $ref: "subtleTextColor" }, + strokeWidth: 1, + strokeOpacity: 1, + lineDash: [5, 6], + lineDashOffset: 0, + label: { + enabled: true + } + } + } +}; +var { ActionOnSet: ActionOnSet5, Property: Property41 } = module_support_exports; +var DataSource = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.enabled = false; + this.getData = () => Promise.resolve(); + this.dataService = ctx.dataService; + } + updateCallback(enabled, getData) { + if (!this.dataService) + return; + if (enabled && getData != null) { + this.dataService.updateCallback(getData); + } else { + this.dataService.clearCallback(); + } + } +}; +__decorateClass2([ + ActionOnSet5({ + newValue(enabled) { + this.updateCallback(enabled, this.getData); + } + }), + Property41 +], DataSource.prototype, "enabled", 2); +__decorateClass2([ + ActionOnSet5({ + newValue(getData) { + this.updateCallback(this.enabled, getData); + } + }), + Property41 +], DataSource.prototype, "getData", 2); +__decorateClass2([ + ActionOnSet5({ + newValue(requestThrottle) { + this.dataService.requestThrottle = requestThrottle; + } + }) +], DataSource.prototype, "requestThrottle", 2); +__decorateClass2([ + ActionOnSet5({ + newValue(updateThrottle) { + this.dataService.dispatchThrottle = updateThrottle; + } + }) +], DataSource.prototype, "updateThrottle", 2); +__decorateClass2([ + ActionOnSet5({ + newValue(updateDuringInteraction) { + this.dataService.dispatchOnlyLatest = !updateDuringInteraction; + } + }) +], DataSource.prototype, "updateDuringInteraction", 2); +var DataSourceModule = { + type: "root", + optionsKey: "dataSource", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new DataSource(ctx), + themeTemplate: { + dataSource: { enabled: false } + } +}; +var { nearestSquared: nearestSquared2, nearestSquaredInContainer: nearestSquaredInContainer2, partialAssign: partialAssign2, mergeDefaults: mergeDefaults2, BBox: BBox6 } = module_support_exports; +var HierarchicalBBox = class { + constructor(components) { + this.components = components; + this.union = BBox6.merge(components); + } + containsPoint(x, y) { + if (!this.union.containsPoint(x, y)) { + return false; + } + for (const bbox of this.components) { + if (bbox.containsPoint(x, y)) { + return true; + } + } + return false; + } +}; +var ErrorBarNode = class extends module_support_exports.Group { + constructor() { + super(); + this.capLength = Number.NaN; + this._datum = void 0; + this.whiskerPath = new module_support_exports.Path(); + this.capsPath = new module_support_exports.Path(); + this.bboxes = new HierarchicalBBox([]); + this.append([this.whiskerPath, this.capsPath]); + } + get datum() { + return this._datum; + } + set datum(datum) { + this._datum = datum; + } + calculateCapLength(capsTheme, capDefaults) { + const { lengthRatio = 1, length: length2 } = capsTheme; + const { lengthRatioMultiplier, lengthMax } = capDefaults; + const desiredLength = length2 ?? lengthRatio * lengthRatioMultiplier; + return Math.min(desiredLength, lengthMax); + } + getItemStylerParams(options, style2, highlighted, highlightState) { + const { datum } = this; + if (datum == null || options.itemStyler == null) + return; + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = options; + return { + ...style2, + datum: datum.datum, + seriesId: datum.series.id, + xKey: datum.xKey, + yKey: datum.yKey, + xLowerKey, + xUpperKey, + yLowerKey, + yUpperKey, + highlighted, + highlightState + }; + } + formatStyles(style2, options, caller, highlighted, highlightState) { + let { cap: capsStyle, ...whiskerStyle } = style2; + const params = this.getItemStylerParams(options, style2, highlighted, highlightState); + if (params != null && options.itemStyler != null) { + const result = caller.callWithContext(options.itemStyler, params); + whiskerStyle = mergeDefaults2(result, whiskerStyle); + capsStyle = mergeDefaults2(result?.cap, result, capsStyle); + } + return { whiskerStyle, capsStyle }; + } + applyStyling(target, source) { + partialAssign2( + ["visible", "stroke", "strokeWidth", "strokeOpacity", "lineDash", "lineDashOffset"], + target, + source + ); + } + update(style2, formatters2, caller, highlighted, highlightState) { + if (this.datum === void 0) { + return; + } + const { whiskerStyle, capsStyle } = this.formatStyles(style2, formatters2, caller, highlighted, highlightState); + const { xBar, yBar, capDefaults } = this.datum; + const whisker = this.whiskerPath; + this.applyStyling(whisker, whiskerStyle); + whisker.path.clear(true); + if (yBar !== void 0) { + whisker.path.moveTo(yBar.lowerPoint.x, yBar.lowerPoint.y); + whisker.path.lineTo(yBar.upperPoint.x, yBar.upperPoint.y); + } + if (xBar !== void 0) { + whisker.path.moveTo(xBar.lowerPoint.x, xBar.lowerPoint.y); + whisker.path.lineTo(xBar.upperPoint.x, xBar.upperPoint.y); + } + whisker.path.closePath(); + this.capLength = this.calculateCapLength(capsStyle ?? {}, capDefaults); + const capOffset = this.capLength / 2; + const caps = this.capsPath; + this.applyStyling(caps, capsStyle); + caps.path.clear(true); + if (yBar !== void 0) { + caps.path.moveTo(yBar.lowerPoint.x - capOffset, yBar.lowerPoint.y); + caps.path.lineTo(yBar.lowerPoint.x + capOffset, yBar.lowerPoint.y); + caps.path.moveTo(yBar.upperPoint.x - capOffset, yBar.upperPoint.y); + caps.path.lineTo(yBar.upperPoint.x + capOffset, yBar.upperPoint.y); + } + if (xBar !== void 0) { + caps.path.moveTo(xBar.lowerPoint.x, xBar.lowerPoint.y - capOffset); + caps.path.lineTo(xBar.lowerPoint.x, xBar.lowerPoint.y + capOffset); + caps.path.moveTo(xBar.upperPoint.x, xBar.upperPoint.y - capOffset); + caps.path.lineTo(xBar.upperPoint.x, xBar.upperPoint.y + capOffset); + } + caps.path.closePath(); + } + updateBBoxes() { + const { capLength, whiskerPath: whisker, capsPath: caps } = this; + const { yBar, xBar } = this.datum ?? {}; + const capOffset = capLength / 2; + const components = []; + if (yBar !== void 0) { + const whiskerHeight = yBar.lowerPoint.y - yBar.upperPoint.y; + components.push( + new BBox6(yBar.lowerPoint.x, yBar.upperPoint.y, whisker.strokeWidth, whiskerHeight), + new BBox6(yBar.lowerPoint.x - capOffset, yBar.lowerPoint.y, capLength, caps.strokeWidth), + new BBox6(yBar.upperPoint.x - capOffset, yBar.upperPoint.y, capLength, caps.strokeWidth) + ); + } + if (xBar !== void 0) { + const whiskerWidth = xBar.upperPoint.x - xBar.lowerPoint.x; + components.push( + new BBox6(xBar.lowerPoint.x, xBar.upperPoint.y, whiskerWidth, whisker.strokeWidth), + new BBox6(xBar.lowerPoint.x, xBar.lowerPoint.y - capOffset, caps.strokeWidth, capLength), + new BBox6(xBar.upperPoint.x, xBar.upperPoint.y - capOffset, caps.strokeWidth, capLength) + ); + } + this.bboxes.components = components; + this.bboxes.union = BBox6.merge(components); + } + containsPoint(x, y) { + return this.bboxes.containsPoint(x, y); + } + pickNode(x, y) { + return this.containsPoint(x, y) ? this : void 0; + } + nearestSquared(x, y, maxDistance) { + const { bboxes } = this; + if (bboxes.union.distanceSquared(x, y) > maxDistance) { + return { nearest: void 0, distanceSquared: Infinity }; + } + const { distanceSquared: distanceSquared2 } = nearestSquared2(x, y, bboxes.components); + return { nearest: this, distanceSquared: distanceSquared2 }; + } +}; +var ErrorBarGroup = class extends module_support_exports.Group { + nearestSquared(x, y) { + const { nearest, distanceSquared: distanceSquared2 } = nearestSquaredInContainer2(x, y, { + children: this.children() + }); + if (nearest !== void 0 && !Number.isNaN(distanceSquared2)) { + return { datum: nearest.datum, distanceSquared: distanceSquared2 }; + } + } +}; +var { BaseProperties: BaseProperties14, Property: Property42 } = module_support_exports; +var ErrorBarCap = class extends BaseProperties14 { +}; +__decorateClass2([ + Property42 +], ErrorBarCap.prototype, "visible", 2); +__decorateClass2([ + Property42 +], ErrorBarCap.prototype, "stroke", 2); +__decorateClass2([ + Property42 +], ErrorBarCap.prototype, "strokeWidth", 2); +__decorateClass2([ + Property42 +], ErrorBarCap.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property42 +], ErrorBarCap.prototype, "lineDash", 2); +__decorateClass2([ + Property42 +], ErrorBarCap.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property42 +], ErrorBarCap.prototype, "length", 2); +__decorateClass2([ + Property42 +], ErrorBarCap.prototype, "lengthRatio", 2); +var ErrorBarProperties = class extends BaseProperties14 { + constructor() { + super(...arguments); + this.visible = true; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cap = new ErrorBarCap(); + } +}; +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "yLowerKey", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "yLowerName", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "yUpperKey", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "yUpperName", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "xLowerKey", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "xLowerName", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "xUpperKey", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "xUpperName", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "visible", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "stroke", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property42 +], ErrorBarProperties.prototype, "cap", 2); +var { fixNumericExtent: fixNumericExtent2, groupAccumulativeValueProperty: groupAccumulativeValueProperty2, mergeDefaults: mergeDefaults22, valueProperty: valueProperty22, ChartAxisDirection: ChartAxisDirection12 } = module_support_exports; +function toErrorBoundCartesianSeries(ctx) { + for (const supportedType of AgErrorBarSupportedSeriesTypes) { + if (supportedType === ctx.series.type) { + return ctx.series; + } + } + throw new Error( + `AG Charts - unsupported series type '${ctx.series.type}', error bars supported series types: ${AgErrorBarSupportedSeriesTypes.join(", ")}` + ); +} +var ErrorBars = class _ErrorBars extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.properties = new ErrorBarProperties(); + const series = toErrorBoundCartesianSeries(ctx); + const { annotationGroup, annotationSelections } = series; + this.cartesianSeries = series; + this.groupNode = new ErrorBarGroup({ + name: `${annotationGroup.id}-errorBars` + }); + annotationGroup.appendChild(this.groupNode); + this.selection = module_support_exports.Selection.select(this.groupNode, () => this.errorBarFactory()); + annotationSelections.add(this.selection); + series.addEventListener("seriesVisibilityChange", (e) => this.onToggleSeriesItem(e)); + this.cleanup.register( + series.events.on("data-processed", (e) => this.onDataProcessed(e)), + series.events.on("data-update", (e) => this.onDataUpdate(e)), + ctx.eventsHub.on("highlight:change", (event) => this.onHighlightChange(event)), + () => this.groupNode.remove(), + () => annotationSelections.delete(this.selection) + ); + } + hasErrorBars() { + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = this.properties; + return isDefined(xLowerKey) && isDefined(xUpperKey) || isDefined(yLowerKey) && isDefined(yUpperKey); + } + isStacked() { + const stackCount = this.cartesianSeries.seriesGrouping?.stackCount; + return stackCount == null ? false : stackCount > 0; + } + getUnstackPropertyDefinition(opts) { + const props = []; + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey, xErrorsID, yErrorsID } = this.getMaybeFlippedKeys(); + const { xScaleType, yScaleType } = opts; + if (yLowerKey != null && yUpperKey != null) { + props.push( + valueProperty22(yLowerKey, yScaleType, { id: `${yErrorsID}-lower` }), + valueProperty22(yUpperKey, yScaleType, { id: `${yErrorsID}-upper` }) + ); + } + if (xLowerKey != null && xUpperKey != null) { + props.push( + valueProperty22(xLowerKey, xScaleType, { id: `${xErrorsID}-lower` }), + valueProperty22(xUpperKey, xScaleType, { id: `${xErrorsID}-upper` }) + ); + } + return props; + } + getStackPropertyDefinition(opts) { + const props = []; + const { cartesianSeries } = this; + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey, xErrorsID, yErrorsID } = this.getMaybeFlippedKeys(); + const { xScaleType, yScaleType } = opts; + const groupIndex = cartesianSeries.seriesGrouping?.groupIndex ?? cartesianSeries.id; + const groupOpts = { + invalidValue: null, + missingValue: 0, + separateNegative: true, + ...cartesianSeries.visible ? {} : { forceValue: 0 } + }; + const makeErrorProperty = (key, id, type, scaleType) => { + return groupAccumulativeValueProperty2( + key, + "normal", + { + id: `${id}-${type}`, + groupId: `errorGroup-${groupIndex}-${type}`, + ...groupOpts + }, + scaleType + ); + }; + const pushErrorProperties = (lowerKey, upperKey, id, scaleType) => { + props.push( + ...makeErrorProperty(lowerKey, id, "lower", scaleType), + ...makeErrorProperty(upperKey, id, "upper", scaleType) + ); + }; + if (yLowerKey != null && yUpperKey != null) { + pushErrorProperties(yLowerKey, yUpperKey, yErrorsID, yScaleType); + } + if (xLowerKey != null && xUpperKey != null) { + pushErrorProperties(xLowerKey, xUpperKey, xErrorsID, xScaleType); + } + return props; + } + getPropertyDefinitions(opts) { + if (this.isStacked()) { + return this.getStackPropertyDefinition(opts); + } else { + return this.getUnstackPropertyDefinition(opts); + } + } + onDataProcessed(event) { + this.dataModel = event.dataModel; + this.processedData = event.processedData; + } + getDomain(direction) { + const { xLowerKey, xUpperKey, xErrorsID, yLowerKey, yUpperKey, yErrorsID } = this.getMaybeFlippedKeys(); + const hasAxisErrors = direction === ChartAxisDirection12.X ? isDefined(xLowerKey) && isDefined(xUpperKey) : isDefined(yLowerKey) && isDefined(yUpperKey); + if (hasAxisErrors) { + const { dataModel, processedData, cartesianSeries: series } = this; + if (dataModel != null && processedData != null) { + const id = { x: xErrorsID, y: yErrorsID }[direction]; + const lowerDomain = dataModel.getDomain(series, `${id}-lower`, "value", processedData); + const upperDomain = dataModel.getDomain(series, `${id}-upper`, "value", processedData); + const domain = [Math.min(...lowerDomain, ...upperDomain), Math.max(...lowerDomain, ...upperDomain)]; + return fixNumericExtent2(domain); + } + } + return []; + } + onDataUpdate(event) { + this.dataModel = event.dataModel; + this.processedData = event.processedData; + if (isDefined(event.dataModel) && isDefined(event.processedData)) { + this.createNodeData(); + this.update(); + } + } + getNodeData() { + return this.hasErrorBars() ? this.cartesianSeries.contextNodeData?.nodeData : void 0; + } + createNodeData() { + const nodeData = this.getNodeData(); + const xScale = this.cartesianSeries.axes[ChartAxisDirection12.X]?.scale; + const yScale = this.cartesianSeries.axes[ChartAxisDirection12.Y]?.scale; + if (!xScale || !yScale || !nodeData) { + return; + } + for (let i = 0; i < nodeData.length; i++) { + const { midPoint, xLower, xUpper, yLower, yUpper } = this.getDatum(nodeData, i); + if (midPoint != null) { + let xBar, yBar; + if (isDefined(xLower) && isDefined(xUpper)) { + xBar = { + lowerPoint: { x: this.convert(xScale, xLower), y: midPoint.y }, + upperPoint: { x: this.convert(xScale, xUpper), y: midPoint.y } + }; + } + if (isDefined(yLower) && isDefined(yUpper)) { + yBar = { + lowerPoint: { x: midPoint.x, y: this.convert(yScale, yLower) }, + upperPoint: { x: midPoint.x, y: this.convert(yScale, yUpper) } + }; + } + nodeData[i].xBar = xBar; + nodeData[i].yBar = yBar; + } + } + } + getMaybeFlippedKeys() { + let { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = this.properties; + let [xErrorsID, yErrorsID] = ["xValue-errors", "yValue-errors"]; + if (this.cartesianSeries.shouldFlipXY()) { + [xLowerKey, yLowerKey] = [yLowerKey, xLowerKey]; + [xUpperKey, yUpperKey] = [yUpperKey, xUpperKey]; + [xErrorsID, yErrorsID] = [yErrorsID, xErrorsID]; + } + return { xLowerKey, xUpperKey, xErrorsID, yLowerKey, yUpperKey, yErrorsID }; + } + static getDatumKey(nodeDatum, key, offset) { + if (key == null) { + return; + } + const datum = readDatum(nodeDatum); + const value = datum?.[key]; + if (value == null) { + return; + } + if (typeof value !== "number") { + logger_exports.warnOnce(`Found [${key}] error value of type ${typeof value}. Expected number type`); + return; + } + return value + offset; + } + getDatum(nodeData, datumIndex) { + const { xLowerKey, xUpperKey, yLowerKey, yUpperKey } = this.getMaybeFlippedKeys(); + const datum = nodeData[datumIndex]; + const d = datum.cumulativeValue == null || !this.isStacked() ? 0 : datum.cumulativeValue - datum.yValue; + const [xOffset, yOffset] = this.cartesianSeries.shouldFlipXY() ? [d, 0] : [0, d]; + return { + midPoint: datum.midPoint, + xLower: _ErrorBars.getDatumKey(datum, xLowerKey, xOffset), + xUpper: _ErrorBars.getDatumKey(datum, xUpperKey, xOffset), + yLower: _ErrorBars.getDatumKey(datum, yLowerKey, yOffset), + yUpper: _ErrorBars.getDatumKey(datum, yUpperKey, yOffset) + }; + } + convert(scale2, value) { + const offset = (scale2.bandwidth ?? 0) / 2; + return scale2.convert(value) + offset; + } + update() { + const nodeData = this.getNodeData(); + if (nodeData != null) { + this.selection.update(nodeData); + this.selection.each((node, datum, i) => this.updateNode(node, datum, i)); + } + } + updateNode(node, datum, _index) { + node.datum = datum; + node.update(this.getDefaultStyle(), this.properties, this.cartesianSeries, false, "none"); + node.updateBBoxes(); + } + pickNodeExact(point) { + const { x, y } = point; + const node = this.groupNode.pickNode(x, y); + if (node != null) { + return { datum: node.datum, distanceSquared: 0 }; + } + } + pickNodeNearest(point) { + return this.groupNode.nearestSquared(point.x, point.y); + } + pickNodeMainAxisFirst(point, majorDirection) { + let closestDatum; + let closestDistance = [Infinity, Infinity]; + const referencePoints = [point.x, point.y]; + if (majorDirection === ChartAxisDirection12.Y) { + referencePoints.reverse(); + } + for (const child of this.groupNode.children()) { + const childBBox = child.getBBox(); + const childReferencePoints = [childBBox.x + childBBox.width / 2, childBBox.y + childBBox.height / 2]; + if (majorDirection === ChartAxisDirection12.Y) { + childReferencePoints.reverse(); + } + const childDistances = []; + for (let i = 0; i < referencePoints.length; i++) { + childDistances.push(Math.abs(referencePoints[i] - childReferencePoints[i])); + } + if (childDistances[0] < closestDistance[0] || childDistances[0] == closestDistance[0] && childDistances[1] < closestDistance[1]) { + closestDatum = child.datum; + closestDistance = childDistances; + } + } + if (closestDatum) { + return { + datum: closestDatum, + distanceSquared: Math.pow(closestDistance[0], 2) + Math.pow(closestDistance[1], 2) + }; + } + } + getTooltipParams() { + const { + xLowerKey, + xUpperKey, + yLowerKey, + yUpperKey, + xLowerName = xLowerKey, + xUpperName = xUpperKey, + yLowerName = yLowerKey, + yUpperName = yUpperKey + } = this.properties; + return { xLowerKey, xLowerName, xUpperKey, xUpperName, yLowerKey, yLowerName, yUpperKey, yUpperName }; + } + onToggleSeriesItem(event) { + this.groupNode.visible = event.visible; + } + makeStyle(baseStyle) { + return { + visible: baseStyle.visible, + lineDash: baseStyle.lineDash, + lineDashOffset: baseStyle.lineDashOffset, + stroke: baseStyle.stroke, + strokeWidth: baseStyle.strokeWidth, + strokeOpacity: baseStyle.strokeOpacity, + cap: mergeDefaults22(this.properties.cap, baseStyle) + }; + } + getDefaultStyle() { + return this.makeStyle(this.getWhiskerProperties()); + } + getHighlightStyle() { + return this.makeStyle(this.getWhiskerProperties()); + } + restyleHighlightChange(highlightChange, style2, highlighted) { + const nodeData = this.getNodeData(); + if (nodeData == null) + return; + for (let i = 0; i < nodeData.length; i++) { + if (highlightChange === nodeData[i]) { + this.selection.at(i)?.update( + style2, + this.properties, + this.cartesianSeries, + highlighted, + highlighted ? "highlighted-item" : "unhighlighted-item" + ); + break; + } + } + } + onHighlightChange(event) { + const { previousHighlight, currentHighlight } = event; + if (currentHighlight?.series === this.cartesianSeries) { + this.restyleHighlightChange(currentHighlight, this.getHighlightStyle(), true); + } + if (previousHighlight?.series === this.cartesianSeries) { + this.restyleHighlightChange(previousHighlight, this.getDefaultStyle(), false); + } + this.groupNode.opacity = this.cartesianSeries.getOpacity(); + } + errorBarFactory() { + return new ErrorBarNode(); + } + getWhiskerProperties() { + const { stroke: stroke22, strokeWidth, visible, strokeOpacity, lineDash, lineDashOffset } = this.properties; + return { stroke: stroke22, strokeWidth, visible, strokeOpacity, lineDash, lineDashOffset }; + } +}; +var ERROR_BARS_THEME = { + series: { + errorBar: { + visible: true, + stroke: { $ref: "foregroundColor" }, + strokeWidth: 1, + strokeOpacity: 1, + cap: { + length: void 0, + lengthRatio: void 0 + } + } + } +}; +var ErrorBarsModule = { + type: "series-option", + identifier: "error-bars", + optionsKey: "errorBar", + packageType: "enterprise", + chartTypes: ["cartesian"], + seriesTypes: AgErrorBarSupportedSeriesTypes, + moduleFactory: (ctx) => new ErrorBars(ctx), + themeTemplate: ERROR_BARS_THEME +}; +var { ZIndexMap: ZIndexMap6, ActionOnSet: ActionOnSet6, Property: Property43, ProxyPropertyOnWrite: ProxyPropertyOnWrite22 } = module_support_exports; +var Foreground = class extends module_support_exports.Background { + constructor() { + super(...arguments); + this.image = new Image4(); + this.fill = "transparent"; + this.fillOpacity = void 0; + } + createNode() { + return new module_support_exports.Group({ name: "foreground", zIndex: ZIndexMap6.FOREGROUND }); + } + onLayoutComplete(event) { + super.onLayoutComplete(event); + const { width: width2, height: height2 } = event.chart; + let placement = { + x: 0, + y: 0, + width: width2, + height: height2 + }; + if (this.image) { + placement = this.image.performLayout(width2, height2); + } + if (this.text) { + this.updateTextNode(placement); + } + } + onImageLoad() { + this.ctx.updateService.update(module_support_exports.ChartUpdateType.SCENE_RENDER); + } + updateTextNode(placement) { + const { textNode } = this; + textNode.fontWeight = "bold"; + textNode.fontFamily = "Impact, sans-serif"; + textNode.fontSize = 19; + textNode.opacity = 0.7; + textNode.fill = "#9b9b9b"; + textNode.textBaseline = "top"; + const textBBox = this.textNode.getBBox(); + const textPadding = 10; + textNode.x = placement.x + placement.width / 2 - textBBox.width / 2; + textNode.y = placement.y + placement.height + textPadding; + } +}; +__decorateClass2([ + Property43, + ActionOnSet6({ + newValue(image) { + this.node.appendChild(image.node); + image.onLoad = () => this.onImageLoad(); + }, + oldValue(image) { + image.node.remove(); + image.onLoad = void 0; + } + }) +], Foreground.prototype, "image", 2); +__decorateClass2([ + Property43, + ProxyPropertyOnWrite22("rectNode", "fill") +], Foreground.prototype, "fill", 2); +__decorateClass2([ + Property43, + ProxyPropertyOnWrite22("rectNode", "fillOpacity") +], Foreground.prototype, "fillOpacity", 2); +var ForegroundModule = { + type: "root", + optionsKey: "foreground", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + moduleFactory: (ctx) => new Foreground(ctx) +}; +var { TranslatableGroup: TranslatableGroup3, SceneChangeDetection: SceneChangeDetection2 } = module_support_exports; +var MiniChartGroup = class extends TranslatableGroup3 { + constructor() { + super(...arguments); + this.inset = 0; + this.cornerRadius = 0; + } + applyClip(ctx, clipRect) { + const { cornerRadius, inset } = this; + const { x, y, width: width2, height: height2 } = clipRect; + const path = new Path2D(); + path.roundRect(x + inset, y + inset, width2 - 2 * inset, height2 - 2 * inset, cornerRadius); + ctx.clip(path); + } +}; +__decorateClass2([ + SceneChangeDetection2() +], MiniChartGroup.prototype, "inset", 2); +__decorateClass2([ + SceneChangeDetection2() +], MiniChartGroup.prototype, "cornerRadius", 2); +var { Property: Property44, ZIndexMap: ZIndexMap7, ActionOnSet: ActionOnSet7, CategoryAxis: CategoryAxis2, Padding: Padding2, Group: Group6, BBox: BBox7, ProxyProperty: ProxyProperty22, stackCartesianSeries: stackCartesianSeries2 } = module_support_exports; +var MiniChartPadding = class { + constructor() { + this.top = 0; + this.bottom = 0; + } +}; +__decorateClass2([ + Property44 +], MiniChartPadding.prototype, "top", 2); +__decorateClass2([ + Property44 +], MiniChartPadding.prototype, "bottom", 2); +var MiniChart = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.padding = new MiniChartPadding(); + this.root = new Group6({ name: "root" }); + this.seriesRoot = this.root.appendChild( + new MiniChartGroup({ name: "Series-root", zIndex: ZIndexMap7.SERIES_LAYER, renderToOffscreenCanvas: true }) + ); + this.axisGridGroup = this.root.appendChild(new Group6({ name: "Axes-Grids", zIndex: ZIndexMap7.AXIS_GRID })); + this.axisGroup = this.root.appendChild(new Group6({ name: "Axes-Grids", zIndex: ZIndexMap7.AXIS_GRID })); + this.axisLabelGroup = this.root.appendChild(new Group6({ name: "Axes-Labels", zIndex: ZIndexMap7.SERIES_LABEL })); + this.axisCrosslineRangeGroup = this.root.appendChild( + new Group6({ name: "Axes-Crosslines-Range", zIndex: ZIndexMap7.SERIES_CROSSLINE_RANGE }) + ); + this.axisCrosslineLineGroup = this.root.appendChild( + new Group6({ name: "Axes-Crosslines-Line", zIndex: ZIndexMap7.SERIES_CROSSLINE_LINE }) + ); + this.axisCrosslineLabelGroup = this.root.appendChild( + new Group6({ name: "Axes-Crosslines-Label", zIndex: ZIndexMap7.SERIES_LABEL }) + ); + this.data = []; + this._destroyed = false; + this.miniChartAnimationPhase = "initial"; + this.seriesRect = void 0; + this.axes = []; + this.series = []; + } + destroy() { + if (this._destroyed) { + return; + } + this.destroySeries(this.series); + for (const a of this.axes) { + a.destroy(); + } + this.axes = []; + this._destroyed = true; + } + onSeriesChange(newValue, oldValue) { + const seriesToDestroy = oldValue?.filter((series) => !newValue.includes(series)) ?? []; + this.destroySeries(seriesToDestroy); + for (const series of newValue) { + if (oldValue?.includes(series)) + continue; + series.attachSeries(this.seriesRoot, this.seriesRoot, void 0); + series.chart = {}; + Object.defineProperty(series.chart, "mode", { + get: () => "standalone" + }); + Object.defineProperty(series.chart, "isMiniChart", { + get: () => true + }); + Object.defineProperty(series.chart, "seriesRect", { + get: () => this.seriesRect + }); + series.resetAnimation(this.miniChartAnimationPhase === "initial" ? "initial" : "disabled"); + } + this.seriesRect = void 0; + } + destroySeries(allSeries) { + if (allSeries) { + for (const series of allSeries) { + series.destroy(); + series.detachSeries(this.seriesRoot, this.seriesRoot, void 0); + series.chart = void 0; + } + } + } + assignSeriesToAxes() { + for (const axis of this.axes) { + axis.boundSeries = this.series.filter((s) => { + const seriesAxis = s.axes[axis.direction]; + return seriesAxis === axis; + }); + } + } + assignAxesToSeries() { + const directionToAxesMap = {}; + for (const axis of this.axes) { + const direction = axis.direction; + const directionAxes = directionToAxesMap[direction] ?? (directionToAxesMap[direction] = []); + directionAxes.push(axis); + } + for (const series of this.series) { + for (const direction of series.directions) { + const directionAxes = directionToAxesMap[direction]; + if (!directionAxes) { + logger_exports.warnOnce( + `no available axis for direction [${direction}]; check series and axes configuration.` + ); + continue; + } + const seriesKeys = series.getKeys(direction); + const newAxis = this.findMatchingAxis(directionAxes, seriesKeys); + if (!newAxis) { + logger_exports.warnOnce( + `no matching axis for direction [${direction}] and keys [${seriesKeys}]; check series and axes configuration.` + ); + continue; + } + series.axes[direction] = newAxis; + } + } + } + findMatchingAxis(directionAxes, directionKeys) { + for (const axis of directionAxes) { + if (!axis.keys.length) { + return axis; + } + if (!directionKeys) { + continue; + } + for (const directionKey of directionKeys) { + if (axis.keys.includes(directionKey)) { + return axis; + } + } + } + } + updateData(data) { + for (const s of this.series) { + s.setChartData(data); + } + if (this.miniChartAnimationPhase === "initial") { + this.ctx.animationManager.onBatchStop(() => { + this.miniChartAnimationPhase = "ready"; + for (const s of this.series) { + s.resetAnimation("disabled"); + } + }); + } + } + async processData(dataController) { + if (this.series.some((s) => s.canHaveAxes)) { + this.assignAxesToSeries(); + this.assignSeriesToAxes(); + } + await Promise.all( + this.series.map(async (s) => { + s.resetDatumCallbackCache(); + return s.processData(dataController); + }) + ); + for (const axis of this.axes) { + axis.processData(); + } + } + computeAxisPadding() { + const padding2 = new Padding2(); + if (!this.enabled) { + return padding2; + } + for (const { position, thickness, line, label } of this.axes) { + if (position == null) + continue; + let size; + if (thickness) { + size = thickness; + } else { + size = (line.enabled ? line.width : 0) + (label.enabled ? calcLineHeight(label.fontSize ?? 0) + label.spacing : 0); + } + padding2[position] = Math.ceil(size); + } + return padding2; + } + async layout(width2, height2) { + var _a; + const { padding: padding2 } = this; + const animated = this.seriesRect != null; + const seriesRect = new BBox7(0, 0, width2, height2 - (padding2.top + padding2.bottom)); + const resized = this.seriesRect == null || this.seriesRect.width !== width2 || this.seriesRect.height !== height2; + this.seriesRect = seriesRect; + this.seriesRoot.translationY = padding2.top; + this.seriesRoot.setClipRectCanvasSpace(new BBox7(0, -padding2.top, width2, height2)); + for (const axis of this.axes) { + const { position = "left" } = axis; + switch (position) { + case "top": + case "bottom": + axis.range = [0, seriesRect.width]; + axis.gridLength = seriesRect.height; + break; + case "right": + case "left": { + const isCategoryAxis = axis instanceof CategoryAxis2; + axis.range = isCategoryAxis ? [0, seriesRect.height] : [seriesRect.height, 0]; + axis.gridLength = seriesRect.width; + break; + } + } + axis.gridPadding = 0; + axis.translation.x = 0; + axis.translation.y = 0; + if (position === "right") { + axis.translation.x = width2; + } else if (position === "bottom") { + axis.translation.y = height2; + } + if (!animated) { + axis.resetAnimation("initial"); + } + if (axis.crossLines) { + for (const crossLine of axis.crossLines) { + if (crossLine instanceof module_support_exports.CartesianCrossLine) { + crossLine.position = axis.position ?? "top"; + (_a = crossLine.label).parallel ?? (_a.parallel = axis.label?.parallel); + } + } + } + axis.calculateLayout(); + axis.update(); + } + if (resized) { + stackCartesianSeries2(this.series); + } + await Promise.all(this.series.map(async (series) => series.update({ seriesRect }))); + } +}; +__decorateClass2([ + Property44 +], MiniChart.prototype, "enabled", 2); +__decorateClass2([ + ProxyProperty22(["seriesRoot", "inset"]) +], MiniChart.prototype, "inset", 2); +__decorateClass2([ + ProxyProperty22(["seriesRoot", "cornerRadius"]) +], MiniChart.prototype, "cornerRadius", 2); +__decorateClass2([ + ActionOnSet7({ + changeValue(newValue, oldValue = []) { + const axisNodes = { + axisNode: this.axisGroup, + gridNode: this.axisGridGroup, + labelNode: this.axisLabelGroup, + crossLineLineNode: this.axisCrosslineLineGroup, + crossLineRangeNode: this.axisCrosslineRangeGroup, + crossLineLabelNode: this.axisCrosslineLabelGroup + }; + for (const axis of oldValue) { + if (newValue.includes(axis)) + continue; + axis.detachAxis(); + axis.destroy(); + } + for (const axis of newValue) { + if (oldValue?.includes(axis)) + continue; + axis.attachAxis(axisNodes); + } + } + }) +], MiniChart.prototype, "axes", 2); +__decorateClass2([ + ActionOnSet7({ + changeValue(newValue, oldValue) { + this.onSeriesChange(newValue, oldValue); + } + }) +], MiniChart.prototype, "series", 2); +var { SliderWidget: SliderWidget2 } = module_support_exports; +var NavigatorDOMProxy = class { + constructor(ctx, sliderHandlers) { + this.ctx = ctx; + this.sliderHandlers = sliderHandlers; + this._min = 0; + this._max = 1; + this.minRange = 1e-3; + this.dragStartX = 0; + this.ctx = ctx; + this.toolbar = ctx.proxyInteractionService.createProxyContainer({ + type: "toolbar", + domManagerId: `navigator-toolbar`, + classList: ["ag-charts-proxy-navigator-toolbar"], + orientation: "vertical", + ariaLabel: { id: "ariaLabelNavigator" } + }); + this.sliders = [ + ctx.proxyInteractionService.createProxyElement({ + type: "slider", + domIndex: 1, + ariaLabel: { id: "ariaLabelNavigatorMinimum" }, + parent: this.toolbar, + cursor: "ew-resize" + }), + ctx.proxyInteractionService.createProxyElement({ + type: "slider", + domIndex: -Infinity, + ariaLabel: { id: "ariaLabelNavigatorRange" }, + parent: this.toolbar, + cursor: "grab" + }), + ctx.proxyInteractionService.createProxyElement({ + type: "slider", + domIndex: 2, + ariaLabel: { id: "ariaLabelNavigatorMaximum" }, + parent: this.toolbar, + cursor: "ew-resize" + }) + ]; + for (const [index, key] of ["min", "pan", "max"].entries()) { + const slider = this.sliders[index]; + slider.step = SliderWidget2.STEP_HUNDRETH; + slider.keyboardStep = SliderWidget2.STEP_ONE; + slider.orientation = "horizontal"; + slider.setPreventsDefault(false); + slider.addListener("drag-start", (ev) => this.onDragStart(index, ev, key)); + slider.addListener("drag-move", (ev) => this.onDrag(slider, ev, key)); + slider.addListener("drag-end", () => this.updateSliderRatios()); + slider.addListener("contextmenu", (ev) => this.onContextMenu(slider, ev)); + } + this.sliders[0].addListener("change", () => this.onMinSliderChange()); + this.sliders[1].addListener("change", () => this.onPanSliderChange()); + this.sliders[2].addListener("change", () => this.onMaxSliderChange()); + this.updateSliderRatios(); + this.updateVisibility(false); + } + destroy() { + this.toolbar.destroy(); + } + updateVisibility(visible) { + this.toolbar.setHidden(!visible); + } + updateZoom() { + const { _min: min, _max: max } = this; + if (min == null || max == null) + return; + return this.ctx.zoomManager.updateZoom("navigator", { x: { min, max } }); + } + updateBounds(bounds) { + this.toolbar.setBounds(bounds); + } + updateSliderBounds(sliderIndex, bounds) { + this.sliders[sliderIndex].setBounds(bounds); + } + updateMinMax(min, max) { + this._min = min; + this._max = max; + this.updateSliderRatios(); + } + updateSliderRatios() { + let { _min: min, _max: max } = this; + min = Math.round(min * 100) / 100; + max = Math.round(max * 100) / 100; + const panAria = this.ctx.localeManager.t("ariaValuePanRange", { min, max }); + this.sliders[0].setValueRatio(min); + this.sliders[1].setValueRatio(min, { ariaValueText: panAria }); + this.sliders[2].setValueRatio(max); + } + toCanvasOffsets(event) { + return { offsetX: this.dragStartX + event.originDeltaX }; + } + moveToFront(index) { + if (index === 1) + return; + const frontSlider = this.sliders[index]; + const otherSlider = this.sliders[2 - index]; + this.toolbar.moveChild(otherSlider, frontSlider.domIndex - 1); + } + onDragStart(index, event, key) { + const slider = this.sliders[index]; + const toolbarLeft = this.toolbar.cssLeft(); + const sliderLeft = slider.cssLeft(); + this.dragStartX = toolbarLeft + sliderLeft + event.offsetX; + this.moveToFront(index); + event.sourceEvent.preventDefault(); + this.sliderHandlers.onDragStart(key, this.toCanvasOffsets(event)); + } + onDrag(_slider, event, key) { + event.sourceEvent.preventDefault(); + this.sliderHandlers.onDrag(key, this.toCanvasOffsets(event)); + } + onContextMenu(slider, widgetEvent) { + const { offsetX, offsetY } = widgetEvent; + const { x: toolbarX, y: toolbarY } = this.toolbar.getBounds(); + const { x: sliderX, y: sliderY } = slider.getBounds(); + const canvasX = offsetX + toolbarX + sliderX; + const canvasY = offsetY + toolbarY + sliderY; + this.ctx.contextMenuRegistry.dispatchContext("always", { widgetEvent, canvasX, canvasY }, void 0); + } + onPanSliderChange() { + const ratio3 = this.sliders[1].getValueRatio(); + const span = this._max - this._min; + this._min = clamp(0, ratio3, 1 - span); + this._max = this._min + span; + this.updateZoom(); + } + onMinSliderChange() { + this._min = this.sliders[0].clampValueRatio(0, this._max - this.minRange); + this.updateZoom(); + } + onMaxSliderChange() { + this._max = this.sliders[2].clampValueRatio(this._min + this.minRange, 1); + this.updateZoom(); + } +}; +var { Property: Property45, SceneChangeDetection: SceneChangeDetection22, BBox: BBox8, ExtendedPath2D: ExtendedPath2D2 } = module_support_exports; +var RangeHandle = class extends module_support_exports.Path { + constructor() { + super(...arguments); + this.zIndex = 3; + this.centerX = 0; + this.centerY = 0; + this.width = 8; + this.height = 16; + this.cornerRadius = 4; + this.grip = true; + this.gripPath = new ExtendedPath2D2(); + } + setCenter(x, y) { + this.dirtyPath = true; + if (this.centerX !== x || this.centerY !== y) { + this.centerX = x; + this.centerY = y; + this.markDirty("center"); + } + } + static align(minHandle, maxHandle, x, y, width2, height2, min, max, pixelAlign) { + const minHandleX = minHandle.align(x + width2 * min) + pixelAlign; + const maxHandleX = minHandleX + minHandle.align(x + width2 * min, width2 * (max - min)) - 2 * pixelAlign; + const handleY = minHandle.align(y + height2 / 2); + minHandle.setCenter(minHandleX, handleY); + maxHandle.setCenter(maxHandleX, handleY); + } + computeBBox() { + const { centerX, centerY, width: width2, height: height2 } = this; + const x = centerX - width2 / 2; + const y = centerY - height2 / 2; + return new BBox8(x, y, width2, height2); + } + isPointInPath(x, y) { + const bbox = this.getBBox(); + return bbox.containsPoint(x, y); + } + updatePath() { + const { centerX, centerY, path, gripPath, strokeWidth, cornerRadius, grip } = this; + const pixelAlign = strokeWidth / 2; + const pixelRatio = this.layerManager?.canvas?.pixelRatio ?? 1; + path.clear(); + gripPath.clear(); + const halfWidth = Math.floor(this.width / 2 * pixelRatio) / pixelRatio; + const halfHeight = Math.floor(this.height / 2 * pixelRatio) / pixelRatio; + path.roundRect( + centerX - halfWidth + pixelAlign, + centerY - halfHeight + pixelAlign, + 2 * (halfWidth - pixelAlign), + 2 * (halfHeight - pixelAlign), + cornerRadius + ); + const gripSpacing = 3; + if (grip) { + for (let x = -0.5; x <= 0.5; x += 1) { + for (let y = -1; y <= 1; y += 1) { + gripPath.arc(centerX + x * gripSpacing, centerY + y * gripSpacing, 1, 0, 2 * Math.PI); + gripPath.closePath(); + } + } + } + } + renderFill(ctx, path) { + const { stroke: stroke22 } = this; + super.renderFill(ctx, path); + ctx.fillStyle = typeof stroke22 === "string" ? stroke22 : "black"; + ctx.fill(this.gripPath.getPath2D()); + } +}; +RangeHandle.className = "RangeHandle"; +__decorateClass2([ + Property45, + SceneChangeDetection22() +], RangeHandle.prototype, "width", 2); +__decorateClass2([ + Property45, + SceneChangeDetection22() +], RangeHandle.prototype, "height", 2); +__decorateClass2([ + Property45, + SceneChangeDetection22() +], RangeHandle.prototype, "cornerRadius", 2); +__decorateClass2([ + Property45, + SceneChangeDetection22() +], RangeHandle.prototype, "grip", 2); +var { Path: Path6, BBox: BBox9, ExtendedPath2D: ExtendedPath2D22, clippedRoundRect: clippedRoundRect2, Property: Property46, SceneChangeDetection: SceneChangeDetection3 } = module_support_exports; +var RangeMask = class extends Path6 { + constructor() { + super(...arguments); + this.cornerRadius = 4; + this.zIndex = 2; + this.x = 0; + this.y = 0; + this.width = 200; + this.height = 30; + this.min = 0; + this.max = 1; + this.visiblePath = new ExtendedPath2D22(); + } + layout(x, y, width2, height2, min, max) { + min = Number.isNaN(min) ? this.min : min; + max = Number.isNaN(max) ? this.max : max; + if (x !== this.x || y !== this.y || width2 !== this.width || this.height !== height2 || min !== this.min || max !== this.max) { + this.x = x; + this.y = y; + this.width = width2; + this.height = height2; + this.min = min; + this.max = max; + this.dirtyPath = true; + this.markDirty("RangeMask.layout"); + } + } + computeBBox() { + const { x, y, width: width2, height: height2 } = this; + return new BBox9(x, y, width2, height2); + } + computeVisibleRangeBBox() { + const { x, y, width: width2, height: height2, min, max } = this; + const minX = x + width2 * min; + const maxX = x + width2 * max; + return new BBox9(minX, y, maxX - minX, height2); + } + updatePath() { + const { path, visiblePath, x, y, width: width2, height: height2, min, max, strokeWidth, cornerRadius } = this; + const pixelAlign = strokeWidth / 2; + path.clear(); + visiblePath.clear(); + const ax = this.align(x) + pixelAlign; + const ay = this.align(y) + pixelAlign; + const aw = this.align(x, width2) - 2 * pixelAlign; + const ah = this.align(y, height2) - 2 * pixelAlign; + const minX = this.align(x + width2 * min) + pixelAlign; + const maxX = minX + this.align(x + width2 * min, width2 * (max - min)) - 2 * pixelAlign; + const cornerRadiusParams = { + topLeft: cornerRadius, + topRight: cornerRadius, + bottomRight: cornerRadius, + bottomLeft: cornerRadius + }; + const drawRect = (p, x0, x1) => { + if (x1 - x0 < 1) + return; + const bbox = new BBox9(x0, ay, x1 - x0, ah); + clippedRoundRect2(p, ax, ay, aw, ah, cornerRadiusParams, bbox); + }; + drawRect(path, ax, minX); + drawRect(path, maxX, aw + ax); + drawRect(visiblePath, minX, maxX); + } + renderStroke(ctx, path) { + super.renderStroke(ctx, path); + super.renderStroke(ctx, this.visiblePath.getPath2D()); + } +}; +RangeMask.className = "RangeMask"; +__decorateClass2([ + Property46, + SceneChangeDetection3() +], RangeMask.prototype, "cornerRadius", 2); +var RangeSelector = class extends module_support_exports.Group { + constructor(children) { + super({ name: "rangeSelectorGroup", zIndex: module_support_exports.ZIndexMap.NAVIGATOR }); + this.x = 0; + this.y = 0; + this.width = 200; + this.height = 30; + this.lOffset = 0; + this.rOffset = 0; + this.background = this.appendChild( + new module_support_exports.TranslatableGroup({ name: "navigator-background", zIndex: 1 }) + ); + this.append(children); + } + layout(x, y, width2, height2, lOffset, rOffset) { + this.x = x; + this.y = y; + this.width = width2; + this.height = height2; + this.lOffset = lOffset; + this.rOffset = rOffset; + this.background.translationX = x; + this.background.translationY = y; + this.markDirty("RangeSelector"); + } + updateBackground(oldGroup, newGroup) { + if (oldGroup != null) { + oldGroup.remove(); + } + if (newGroup != null) { + this.background.appendChild(newGroup); + } + this.markDirty("RangeSelector"); + } + computeBBox() { + const { x, y, width: width2, height: height2, lOffset, rOffset } = this; + return new module_support_exports.BBox(x - lOffset, y, width2 + (lOffset + rOffset), height2); + } +}; +var { BaseModuleInstance: BaseModuleInstance22, ObserveChanges: ObserveChanges3, Property: Property47 } = module_support_exports; +var Navigator = class extends BaseModuleInstance22 { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.mask = new RangeMask(); + this.minHandle = new RangeHandle(); + this.maxHandle = new RangeHandle(); + this.maskVisibleRange = { + id: "navigator-mask-visible-range", + getBBox: () => this.mask.computeVisibleRangeBBox(), + toCanvasBBox: () => this.mask.computeVisibleRangeBBox(), + fromCanvasPoint: (x, y) => ({ x, y }) + }; + this.height = 30; + this.cornerRadius = 0; + this.spacing = 10; + this.x = 0; + this.y = 0; + this.width = 0; + this.rangeSelector = new RangeSelector([this.mask, this.minHandle, this.maxHandle]); + this.cleanup.register( + ctx.scene.attachNode(this.rangeSelector), + ctx.eventsHub.on("locale:change", () => this.updateZoom()), + ctx.layoutManager.registerElement(module_support_exports.LayoutElement.Navigator, (e) => this.onLayoutStart(e)), + ctx.eventsHub.on("layout:complete", (e) => this.onLayoutComplete(e)), + ctx.eventsHub.on("zoom:change", (event) => this.onZoomChange(event)) + ); + this.domProxy = new NavigatorDOMProxy(ctx, this); + this.updateGroupVisibility(); + this.miniChart = new MiniChart(ctx); + } + updateBackground(oldGroup, newGroup) { + this.rangeSelector?.updateBackground(oldGroup, newGroup); + } + updateGroupVisibility() { + const { enabled } = this; + if (this.rangeSelector == null || enabled === this.rangeSelector.visible) + return; + this.rangeSelector.visible = enabled; + this.domProxy.updateVisibility(enabled); + if (enabled) { + this.updateZoom(); + } else { + this.ctx.zoomManager.updateZoom("navigator"); + } + } + onLayoutStart(ctx) { + if (this.enabled) { + const { layoutBox } = ctx; + const navigatorTotalHeight = this.height + this.spacing; + layoutBox.shrink(navigatorTotalHeight, "bottom"); + this.y = layoutBox.y + layoutBox.height + this.spacing; + } else { + this.y = 0; + } + if (this.enabled && this.miniChart) { + const { top, bottom } = this.miniChart.computeAxisPadding(); + ctx.layoutBox.shrink(top + bottom, "bottom"); + this.y -= bottom; + this.miniChart.inset = this.mask.strokeWidth / 2; + this.miniChart.cornerRadius = this.mask.cornerRadius; + } + } + onLayoutComplete(opts) { + const { x, width: width2 } = opts.series.rect; + const { y, height: height2 } = this; + this.domProxy.updateVisibility(this.enabled); + if (this.enabled) { + const { _min: min, _max: max } = this.domProxy; + this.layoutNodes(x, y, width2, height2, min, max); + this.domProxy.updateBounds({ x, y, width: width2, height: height2 }); + } + this.x = x; + this.width = width2; + this.miniChart?.layout(width2, height2).catch((e) => logger_exports.error(e)); + } + canDrag() { + return this.enabled && this.ctx.interactionManager.isState(module_support_exports.InteractionState.ZoomDraggable); + } + onDragStart(dragging, { offsetX }) { + if (!this.canDrag()) + return; + if (dragging === "pan") { + this.panStart = (offsetX - this.x) / this.width - this.domProxy._min; + } + this.ctx.zoomManager.fireZoomPanStartEvent("navigator"); + } + onDrag(dragging, { offsetX }) { + if (!this.canDrag()) + return; + const { panStart, x, width: width2 } = this; + const { minRange } = this.domProxy; + let { _min: min, _max: max } = this.domProxy; + const ratio3 = (offsetX - x) / width2; + if (dragging === "min") { + min = clamp(0, ratio3, max - minRange); + } else if (dragging === "max") { + max = clamp(min + minRange, ratio3, 1); + } else if (dragging === "pan" && panStart != null) { + const span = max - min; + min = clamp(0, ratio3 - panStart, 1 - span); + max = min + span; + } + this.domProxy._min = min; + this.domProxy._max = max; + this.updateZoom(); + } + onZoomChange(event) { + const { x: xZoom } = event; + if (!xZoom) + return; + const { x, y, width: width2, height: height2 } = this; + const { min, max } = xZoom; + this.domProxy.updateMinMax(min, max); + this.layoutNodes(x, y, width2, height2, min, max); + } + layoutNodes(x, y, width2, height2, min, max) { + const { rangeSelector, mask, minHandle, maxHandle } = this; + mask.layout(x, y, width2, height2, min, max); + rangeSelector.layout(x, y, width2, height2, minHandle.width / 2, maxHandle.width / 2); + RangeHandle.align(minHandle, maxHandle, x, y, width2, height2, min, max, mask.strokeWidth / 2); + if (min + (max - min) / 2 < 0.5) { + minHandle.zIndex = 3; + maxHandle.zIndex = 4; + } else { + minHandle.zIndex = 4; + maxHandle.zIndex = 3; + } + for (const [index, node] of [minHandle, this.maskVisibleRange, maxHandle].entries()) { + const bbox = node.getBBox(); + const tbox = { x: bbox.x - x, y: bbox.y - y, height: bbox.height, width: bbox.width }; + this.domProxy.updateSliderBounds(index, tbox); + } + } + updateZoom() { + if (!this.enabled) + return; + this.domProxy.updateZoom(); + } + updateData(data) { + return this.miniChart?.updateData(data); + } + async processData(dataController) { + if (this.miniChart) { + return this.miniChart?.processData(dataController); + } + } +}; +__decorateClass2([ + ObserveChanges3((target, value, oldValue) => { + target.updateBackground(oldValue?.root, value?.root); + }) +], Navigator.prototype, "miniChart", 2); +__decorateClass2([ + Property47, + ObserveChanges3((target, value) => { + target.ctx.zoomManager.setNavigatorEnabled(Boolean(value)); + target.updateGroupVisibility(); + }) +], Navigator.prototype, "enabled", 2); +__decorateClass2([ + Property47 +], Navigator.prototype, "height", 2); +__decorateClass2([ + Property47, + ObserveChanges3((target, value) => { + target.mask.cornerRadius = value; + }) +], Navigator.prototype, "cornerRadius", 2); +__decorateClass2([ + Property47 +], Navigator.prototype, "spacing", 2); +function prepareBoxPlotFromTo(isVertical) { + const from3 = isVertical ? { scalingX: 1, scalingY: 0 } : { scalingX: 0, scalingY: 1 }; + const to = { scalingX: 1, scalingY: 1 }; + return { from: from3, to }; +} +function resetBoxPlotSelectionsScalingCenterFn(isVertical) { + return (_node, datum) => { + if (isVertical) { + return { scalingCenterY: datum.scaledValues.medianValue }; + } + return { scalingCenterX: datum.scaledValues.medianValue }; + }; +} +var { + Path: Path7, + Scalable: Scalable2, + ExtendedPath2D: ExtendedPath2D3, + SceneChangeDetection: SceneChangeDetection4, + SceneArrayChangeDetection: SceneArrayChangeDetection2, + BBox: BBox10, + clippedRoundRect: baseClippedRoundRect +} = module_support_exports; +var BoxPlotNode = class extends Scalable2(Path7) { + constructor() { + super(...arguments); + this.wickPath = new ExtendedPath2D3(); + this.horizontal = false; + this.center = 0; + this.thickness = 0; + this.min = 0; + this.q1 = 0; + this.median = 0; + this.q3 = 0; + this.max = 0; + this.cornerRadius = 0; + this.crisp = false; + this.strokeAlignment = 0; + this.wickStroke = void 0; + this.wickStrokeWidth = void 0; + this.wickStrokeOpacity = void 0; + this.capLengthRatio = 1; + this.wickStrokeAlignment = 0; + } + computeBBox() { + const { horizontal, center: center2, thickness, min, max } = this; + return horizontal ? new BBox10(Math.min(min, max), center2 - thickness / 2, Math.abs(max - min), thickness) : new BBox10(center2 - thickness / 2, Math.min(min, max), thickness, Math.abs(max - min)); + } + computeDefaultGradientFillBBox() { + const { horizontal, center: center2, thickness, q1, q3 } = this; + return horizontal ? new BBox10(Math.min(q1, q3), center2 - thickness / 2, Math.abs(q3 - q1), thickness) : new BBox10(center2 - thickness / 2, Math.min(q1, q3), thickness, Math.abs(q3 - q1)); + } + isPointInPath(x, y) { + return this.getBBox().containsPoint(x, y); + } + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } + get midPoint() { + return this.horizontal ? { x: (this.min + this.max) / 2, y: this.center } : { x: this.center, y: (this.min + this.max) / 2 }; + } + alignedCoordinates() { + const { thickness, crisp } = this; + let { center: center2, min, q1, median, q3, max } = this; + let x0 = center2 - thickness / 2; + let x1 = center2 + thickness / 2; + if (crisp && thickness > 1) { + min = this.align(min); + q1 = this.align(q1); + median = this.align(median); + q3 = this.align(q3); + max = min + this.align(min, max - min); + const halfWidth = this.align(thickness / 2); + center2 = this.align(center2); + x0 = center2 - halfWidth; + x1 = center2 + halfWidth; + } + return { center: center2, x0, x1, min, max, q1, median, q3 }; + } + updatePath() { + const { + path, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke, + wickStrokeWidth, + wickStrokeOpacity, + wickLineDash, + wickLineDashOffset, + strokeAlignment, + cornerRadius, + capLengthRatio, + horizontal + } = this; + const { center: center2, x0, x1, min, max, q1, median, q3 } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const wickStrokeAlignment = this.wickStrokeAlignment > 0 ? pixelRatio / this.wickStrokeAlignment / 2 % 1 : 0; + this.path.clear(); + this.wickPath.clear(); + const needsWickPath = wickStroke != null && wickStroke !== stroke22 || wickStrokeWidth != null && wickStrokeWidth !== strokeWidth || wickStrokeOpacity != null && wickStrokeOpacity !== strokeOpacity || wickLineDash != null && wickLineDash !== lineDash || wickLineDashOffset != null && wickLineDashOffset !== lineDashOffset; + const wickPath = needsWickPath ? this.wickPath : path; + if (Math.abs(x1 - x0) <= 3) { + moveTo(wickPath, horizontal, center2, min); + lineTo(wickPath, horizontal, center2, max); + return; + } + const wickTop = Math.min(min, max); + const wickBottom = Math.max(min, max); + const boxTop = Math.min(q1, q3); + const boxBottom = Math.max(q1, q3); + const capX0 = center2 - Math.abs((x1 - x0) * capLengthRatio) / 2; + const capX1 = center2 + Math.abs((x1 - x0) * capLengthRatio) / 2; + moveTo(wickPath, horizontal, capX0, wickTop - wickStrokeAlignment); + lineTo(wickPath, horizontal, capX1, wickTop - wickStrokeAlignment); + moveTo(wickPath, horizontal, center2 - wickStrokeAlignment, wickTop - wickStrokeAlignment); + lineTo(wickPath, horizontal, center2 - wickStrokeAlignment, boxTop + strokeWidth / 2); + moveTo(wickPath, horizontal, center2 - wickStrokeAlignment, wickBottom + wickStrokeAlignment); + lineTo(wickPath, horizontal, center2 - wickStrokeAlignment, boxBottom - strokeWidth / 2); + moveTo(wickPath, horizontal, capX0, wickBottom + wickStrokeAlignment); + lineTo(wickPath, horizontal, capX1, wickBottom + wickStrokeAlignment); + const horizontalBoxStrokeAdjustment = strokeWidth / 2 + strokeAlignment; + const verticalBoxStrokeAdjustment = strokeWidth / 2 - strokeAlignment; + const rectHeight = boxBottom - boxTop - 2 * verticalBoxStrokeAdjustment; + if (rectHeight > 0) { + const rectX = x0 + horizontalBoxStrokeAdjustment; + const rectY = boxTop + verticalBoxStrokeAdjustment; + const rectWidth = x1 - x0 - 2 * horizontalBoxStrokeAdjustment; + const cornerRadii = { + topLeft: cornerRadius, + topRight: cornerRadius, + bottomRight: cornerRadius, + bottomLeft: cornerRadius + }; + clippedRoundRect22( + path, + horizontal, + rectX, + rectY, + rectWidth, + rectHeight, + cornerRadii, + new BBox10(rectX, rectY, rectWidth, median - rectY) + ); + clippedRoundRect22( + path, + horizontal, + rectX, + rectY, + rectWidth, + rectHeight, + cornerRadii, + new BBox10(rectX, median, rectWidth, rectY + rectHeight - median) + ); + } else { + const boxMid = (boxTop + boxBottom) / 2; + moveTo(path, horizontal, x0, boxMid); + lineTo(path, horizontal, x1, boxMid); + } + } + drawPath(ctx) { + super.drawPath(ctx); + const { wickPath } = this; + if (wickPath.isEmpty()) + return; + const { + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke = stroke22, + wickStrokeWidth = strokeWidth, + wickStrokeOpacity = strokeOpacity, + wickLineDash = lineDash, + wickLineDashOffset = lineDashOffset + } = this; + if (wickStrokeWidth === 0) + return; + ctx.globalAlpha *= wickStrokeOpacity; + if (typeof wickStroke === "string") { + ctx.strokeStyle = wickStroke; + } + ctx.lineWidth = wickStrokeWidth; + if (wickLineDash != null) { + ctx.setLineDash([...wickLineDash]); + } + ctx.lineDashOffset = wickLineDashOffset; + ctx.stroke(wickPath.getPath2D()); + } +}; +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "horizontal", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "center", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "thickness", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "min", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "q1", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "median", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "q3", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "max", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "cornerRadius", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "crisp", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "strokeAlignment", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStroke", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStrokeWidth", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStrokeOpacity", 2); +__decorateClass2([ + SceneArrayChangeDetection2() +], BoxPlotNode.prototype, "wickLineDash", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickLineDashOffset", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "capLengthRatio", 2); +__decorateClass2([ + SceneChangeDetection4() +], BoxPlotNode.prototype, "wickStrokeAlignment", 2); +function moveTo(path, horizontal, x, y) { + if (horizontal) { + path.moveTo(y, x); + } else { + path.moveTo(x, y); + } +} +function lineTo(path, horizontal, x, y) { + if (horizontal) { + path.lineTo(y, x); + } else { + path.lineTo(x, y); + } +} +function clippedRoundRect22(path, horizontal, x, y, width2, height2, cornerRadii, clipBBox) { + if (horizontal) { + baseClippedRoundRect( + // eslint-disable-next-line sonarjs/arguments-order + path, + y, + x, + height2, + width2, + cornerRadii, + clipBBox == null ? void 0 : new BBox10(clipBBox.y, clipBBox.x, clipBBox.height, clipBBox.width) + ); + } else { + baseClippedRoundRect(path, x, y, width2, height2, cornerRadii, clipBBox); + } +} +var { BaseProperties: BaseProperties15, AbstractBarSeriesProperties: AbstractBarSeriesProperties2, makeSeriesTooltip: makeSeriesTooltip2, Property: Property48, mergeDefaults: mergeDefaults3 } = module_support_exports; +var BoxPlotSeriesCap = class extends BaseProperties15 { + constructor() { + super(...arguments); + this.lengthRatio = 0.5; + } +}; +__decorateClass2([ + Property48 +], BoxPlotSeriesCap.prototype, "lengthRatio", 2); +var BoxPlotSeriesWhisker = class extends BaseProperties15 { +}; +__decorateClass2([ + Property48 +], BoxPlotSeriesWhisker.prototype, "stroke", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesWhisker.prototype, "strokeWidth", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesWhisker.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesWhisker.prototype, "lineDash", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesWhisker.prototype, "lineDashOffset", 2); +var BoxPlotSeriesProperties = class extends AbstractBarSeriesProperties2 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.cap = new BoxPlotSeriesCap(); + this.whisker = new BoxPlotSeriesWhisker(); + this.tooltip = makeSeriesTooltip2(); + } + toJson() { + const { stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const properties = super.toJson(); + properties.whisker = mergeDefaults3(properties.whisker, { + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + return properties; + } +}; +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "xKey", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "minKey", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "q1Key", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "medianKey", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "q3Key", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "maxKey", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "xName", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "yName", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "minName", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "q1Name", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "medianName", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "q3Name", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "maxName", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "fill", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "stroke", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "styler", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "cap", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "whisker", 2); +__decorateClass2([ + Property48 +], BoxPlotSeriesProperties.prototype, "tooltip", 2); +var { + fixNumericExtent: fixNumericExtent22, + keyProperty: keyProperty22, + mergeDefaults: mergeDefaults4, + SeriesNodePickMode: SeriesNodePickMode2, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL2, + valueProperty: valueProperty3, + diff: diff2, + animationValidation: animationValidation2, + computeBarFocusBounds: computeBarFocusBounds2, + createDatumId: createDatumId2, + HighlightState: HighlightState3, + ContinuousScale: ContinuousScale4, + ChartAxisDirection: ChartAxisDirection13, + motion: motion2, + getItemStyles: getItemStyles2, + applyShapeFillBBox: applyShapeFillBBox2, + calculateSegments: calculateSegments2, + toHighlightString: toHighlightString2 +} = module_support_exports; +var BoxPlotSeriesNodeEvent = class extends module_support_exports.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.minKey = series.properties.minKey; + this.q1Key = series.properties.q1Key; + this.medianKey = series.properties.medianKey; + this.q3Key = series.properties.q3Key; + this.maxKey = series.properties.maxKey; + } +}; +var BoxPlotSeries = class extends module_support_exports.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode2.NEAREST_NODE, SeriesNodePickMode2.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["medianKey", "q1Key", "q3Key", "minKey", "maxKey"] + }, + propertyNames: { + x: ["xName"], + y: ["medianName", "q1Name", "q3Name", "minName", "maxName"] + }, + categoryKey: "xValue", + pathsPerSeries: [] + }); + this.properties = new BoxPlotSeriesProperties(); + this.NodeEvent = BoxPlotSeriesNodeEvent; + } + async processData(dataController) { + if (!this.visible) + return; + const { xKey, minKey, q1Key, medianKey, q3Key, maxKey } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (animationEnabled && this.processedData) { + extraProps.push(diff2(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation2()); + } + const { processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty22(xKey, xScaleType, { id: `xValue` }), + valueProperty3(minKey, yScaleType, { id: `minValue` }), + valueProperty3(q1Key, yScaleType, { id: `q1Value` }), + valueProperty3(medianKey, yScaleType, { id: `medianValue` }), + valueProperty3(q3Key, yScaleType, { id: `q3Value` }), + valueProperty3(maxKey, yScaleType, { id: `maxValue` }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL2] : [], + ...extraProps + ] + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + if (direction !== this.getBarDirection()) { + const { index, def } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = processedData.domain.keys[index]; + if (def.type === "key" && def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yExtent = this.domainForClippedRange(direction, ["minValue", "maxValue"], "xValue"); + return fixNumericExtent22(yExtent); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection13.Y, ["maxValue", "minValue"], "xValue", visibleRange); + } + createNodeData() { + const { visible, dataModel, processedData } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const { xKey } = this.properties; + const nodeData = []; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const minValues = dataModel.resolveColumnById(this, "minValue", processedData); + const q1Values = dataModel.resolveColumnById(this, "q1Value", processedData); + const medianValues = dataModel.resolveColumnById(this, "medianValue", processedData); + const q3Values = dataModel.resolveColumnById(this, "q3Value", processedData); + const maxValues = dataModel.resolveColumnById(this, "maxValue", processedData); + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale4.is(xAxis.scale) ? barWidth * -0.5 : 0; + const { groupScale } = this; + const isVertical = this.isVertical(); + const segments = calculateSegments2( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + const context = { + itemId: xKey, + nodeData, + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStyles2(this.getItemStyle.bind(this)), + segments + }; + if (!visible) + return context; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const minValue = minValues[datumIndex]; + const q1Value = q1Values[datumIndex]; + const medianValue = medianValues[datumIndex]; + const q3Value = q3Values[datumIndex]; + const maxValue = maxValues[datumIndex]; + if ([minValue, q1Value, medianValue, q3Value, maxValue].some((value) => typeof value !== "number") || minValue > q1Value || q1Value > medianValue || medianValue > q3Value || q3Value > maxValue) { + continue; + } + const scaledValues = { + xValue: xAxis.scale.convert(xValue2), + minValue: yAxis.scale.convert(minValue), + q1Value: yAxis.scale.convert(q1Value), + medianValue: yAxis.scale.convert(medianValue), + q3Value: yAxis.scale.convert(q3Value), + maxValue: yAxis.scale.convert(maxValue) + }; + const bandwidth = barWidth; + scaledValues.xValue += groupScale.convert(String(groupIndex)) + barOffset + bandwidth / 2; + const height2 = Math.abs(scaledValues.q3Value - scaledValues.q1Value); + const midX = scaledValues.xValue; + const midY = Math.min(scaledValues.q3Value, scaledValues.q1Value) + height2 / 2; + const midPoint = { + x: isVertical ? midX : midY, + y: isVertical ? midY : midX + }; + let focusRect; + if (isVertical) { + focusRect = { + x: midPoint.x - bandwidth / 2, + y: scaledValues.minValue, + width: bandwidth, + height: scaledValues.maxValue - scaledValues.minValue + }; + } else { + focusRect = { + x: scaledValues.minValue, + y: midPoint.y - bandwidth / 2, + width: scaledValues.maxValue - scaledValues.minValue, + height: bandwidth + }; + } + nodeData.push({ + series: this, + itemId: xValue2, + datum, + datumIndex, + xKey, + bandwidth, + scaledValues, + midPoint, + focusRect + }); + } + return context; + } + legendItemSymbol() { + const { fill, stroke: stroke22, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + HighlightState3.None + ); + return { + marker: { + fill: module_support_exports.deepClone(fill), + fillOpacity, + stroke: stroke22, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { xKey, yName, showInLegend, legendItemName } = this.properties; + if (!xKey || legendType !== "category") { + return []; + } + return [ + { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: seriesId }), + label: { + text: legendItemName ?? yName ?? seriesId + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { + xKey, + xName, + yName, + medianKey, + medianName, + q1Key, + q1Name, + q3Key, + q3Name, + minKey, + minName, + maxKey, + maxName, + legendItemName, + tooltip + } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const minValue = dataModel.resolveColumnById(this, `minValue`, processedData)[datumIndex]; + const q1Value = dataModel.resolveColumnById(this, `q1Value`, processedData)[datumIndex]; + const medianValue = dataModel.resolveColumnById(this, `medianValue`, processedData)[datumIndex]; + const q3Value = dataModel.resolveColumnById(this, `q3Value`, processedData)[datumIndex]; + const maxValue = dataModel.resolveColumnById(this, `maxValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + const data = [ + { + label: minName, + fallbackLabel: minKey, + value: this.getAxisValueText(yAxis, "tooltip", minValue, datum, minKey, legendItemName) + }, + { + label: q1Name, + fallbackLabel: q1Key, + value: this.getAxisValueText(yAxis, "tooltip", q1Value, datum, q1Key, legendItemName) + }, + { + label: medianName, + fallbackLabel: medianKey, + value: this.getAxisValueText(yAxis, "tooltip", medianValue, datum, medianKey, legendItemName) + }, + { + label: q3Name, + fallbackLabel: q3Key, + value: this.getAxisValueText(yAxis, "tooltip", q3Value, datum, q3Key, legendItemName) + }, + { + label: maxName, + fallbackLabel: maxKey, + value: this.getAxisValueText(yAxis, "tooltip", maxValue, datum, maxKey, legendItemName) + } + ]; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + title: legendItemName ?? yName, + symbol: this.legendItemSymbol(), + data + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yName, + medianKey, + medianName, + q1Key, + q1Name, + q3Key, + q3Name, + minKey, + minName, + maxKey, + maxName, + ...format + } + ); + } + animateEmptyUpdateReady({ + datumSelection + }) { + const isVertical = this.isVertical(); + const { from: from3, to } = prepareBoxPlotFromTo(isVertical); + motion2.resetMotion([datumSelection], resetBoxPlotSelectionsScalingCenterFn(isVertical)); + motion2.staticFromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], from3, to, { + phase: "initial" + }); + } + isLabelEnabled() { + return false; + } + updateDatumSelection(opts) { + const data = opts.nodeData ?? []; + return opts.datumSelection.update(data); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + cap: { lengthRatio }, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke22, + strokeOpacity, + strokeWidth, + maxKey, + maxName, + medianKey, + medianName, + minKey, + minName, + q1Key, + q1Name, + q3Key, + q3Name, + whisker: { + lineDash: whiskerLineDash, + lineDashOffset: whiskerLineDashOffset, + stroke: whiskerStroke, + strokeOpacity: whiskerStrokeOpacity, + strokeWidth: whiskerStrokeWidth + }, + xKey, + xName, + yName + } = this.properties; + const highlightState = toHighlightString2(highlightStateEnum ?? HighlightState3.None); + return { + cap: { lengthRatio }, + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + maxKey, + maxName: maxName ?? maxKey, + medianKey, + medianName: medianName ?? medianKey, + minKey, + minName: minName ?? minKey, + q1Key, + q1Name: q1Name ?? q1Key, + q3Key, + q3Name: q3Name ?? q3Key, + seriesId, + stroke: stroke22, + strokeOpacity, + strokeWidth, + whisker: { + lineDash: whiskerLineDash ?? lineDash, + lineDashOffset: whiskerLineDashOffset ?? lineDashOffset, + stroke: whiskerStroke ?? stroke22, + strokeOpacity: whiskerStrokeOpacity ?? strokeOpacity, + strokeWidth: whiskerStrokeWidth ?? strokeWidth + }, + xKey, + xName: xName ?? xKey, + yName + }; + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cap, + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke22, + strokeOpacity, + strokeWidth, + styler, + whisker + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke22, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + cap: { lengthRatio: stylerResult.cap?.lengthRatio ?? cap.lengthRatio }, + whisker: { + lineDash: stylerResult.whisker?.lineDash ?? whisker.lineDash, + lineDashOffset: stylerResult.whisker?.lineDashOffset ?? whisker.lineDashOffset, + stroke: stylerResult.whisker?.stroke ?? whisker.stroke, + strokeOpacity: stylerResult.whisker?.strokeOpacity ?? whisker.strokeOpacity, + strokeWidth: stylerResult.whisker?.strokeWidth ?? whisker.strokeWidth + } + }; + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style2 = mergeDefaults4(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId2(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datumIndex, isHighlight, style2); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style2 = mergeDefaults4(overrides, style2); + } + } + const { stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = style2; + style2.whisker = mergeDefaults4(style2.whisker, { + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + return style2; + } + makeItemStylerParams(datumIndex, isHighlight, style2) { + const { id: seriesId } = this; + const { xKey, minKey, q1Key, medianKey, q3Key, maxKey } = this.properties; + const datum = this.processedData?.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum, + xKey, + minKey, + q1Key, + medianKey, + q3Key, + maxKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style2, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((_, nodeDatum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = this.getItemStyle(nodeDatum.datumIndex, isHighlight, highlightState); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const isVertical = this.isVertical(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const fillBBox = this.getShapeFillBBox(); + const strokeAlignment = this.getStyle(false, false, HighlightState3.None).strokeWidth / 2; + const wickStrokeAlignment = properties.whisker.strokeWidth ?? properties.strokeWidth; + datumSelection.each((boxPlotNode, nodeDatum) => { + const style2 = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + applyShapeFillBBox2(boxPlotNode, style2.fill, fillBBox); + boxPlotNode.fill = style2.fill; + boxPlotNode.fillOpacity = style2.fillOpacity; + boxPlotNode.stroke = style2.stroke; + boxPlotNode.strokeWidth = style2.strokeWidth; + boxPlotNode.strokeOpacity = style2.strokeOpacity; + boxPlotNode.lineDash = style2.lineDash; + boxPlotNode.lineDashOffset = style2.lineDashOffset; + boxPlotNode.wickStroke = style2.whisker.stroke; + boxPlotNode.wickStrokeWidth = style2.whisker.strokeWidth; + boxPlotNode.wickStrokeOpacity = style2.whisker.strokeOpacity; + boxPlotNode.wickLineDash = style2.whisker.lineDash; + boxPlotNode.wickLineDashOffset = style2.whisker.lineDashOffset; + boxPlotNode.cornerRadius = style2.cornerRadius; + boxPlotNode.crisp = true; + boxPlotNode.horizontal = !isVertical; + boxPlotNode.center = nodeDatum.scaledValues.xValue; + boxPlotNode.thickness = nodeDatum.bandwidth; + boxPlotNode.min = nodeDatum.scaledValues.minValue; + boxPlotNode.q1 = nodeDatum.scaledValues.q1Value; + boxPlotNode.median = nodeDatum.scaledValues.medianValue; + boxPlotNode.q3 = nodeDatum.scaledValues.q3Value; + boxPlotNode.max = nodeDatum.scaledValues.maxValue; + boxPlotNode.capLengthRatio = style2.cap.lengthRatio; + boxPlotNode.strokeAlignment = strokeAlignment; + boxPlotNode.wickStrokeAlignment = wickStrokeAlignment; + }); + } + updateLabelNodes() { + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData); + } + nodeFactory() { + return new BoxPlotNode(); + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds2(this, this.contextNodeData?.nodeData[datumIndex].focusRect); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null; + } +}; +BoxPlotSeries.className = "BoxPlotSeries"; +BoxPlotSeries.type = "box-plot"; +var { boxPlotSeriesThemeableOptionsDef: boxPlotSeriesThemeableOptionsDef2, commonSeriesOptionsDefs: commonSeriesOptionsDefs2 } = module_support_exports; +var boxPlotSeriesOptionsDef = { + ...commonSeriesOptionsDefs2, + ...boxPlotSeriesThemeableOptionsDef2, + type: required(constant("box-plot")), + xKey: required(string), + minKey: required(string), + q1Key: required(string), + medianKey: required(string), + q3Key: required(string), + maxKey: required(string), + xName: string, + yName: string, + minName: string, + q1Name: string, + medianName: string, + q3Name: string, + maxName: string, + grouped: boolean, + legendItemName: string, + segmentation: shapeSegmentation +}; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE2 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle2, + FILL_GRADIENT_LINEAR_DEFAULTS: FILL_GRADIENT_LINEAR_DEFAULTS2, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS2, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS2, + SAFE_FILL_OPERATION: SAFE_FILL_OPERATION2, + SEGMENTATION_DEFAULTS: SEGMENTATION_DEFAULTS2 +} = module_support_exports; +var BOX_PLOT_SERIES_THEME = { + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { + $or: [ + { $isGradient: { $palette: "fill" } }, + { $isPattern: { $palette: "fill" } }, + { $isImage: { $palette: "fill" } } + ] + }, + { $palette: "fill" }, + { $mix: [SAFE_FILL_OPERATION2, { $ref: "chartBackgroundColor" }, 0.7] } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_DEFAULTS2], + ["image", FILL_IMAGE_DEFAULTS2], + ["pattern", FILL_PATTERN_DEFAULTS2] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: 2, + fillOpacity: 1, + strokeOpacity: 1, + lineDash: void 0, + lineDashOffset: 0, + highlight: multiSeriesHighlightStyle2(), + segmentation: SEGMENTATION_DEFAULTS2 + }, + axes: { + [CARTESIAN_AXIS_TYPE2.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE2.CATEGORY]: { + groupPaddingInner: 0.2, + crosshair: { + enabled: false, + snap: false + } + } + } +}; +var BoxPlotModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "box-plot", + moduleFactory: (ctx) => new BoxPlotSeries(ctx), + predictAxis: module_support_exports.predictCartesianTimeAxis, + defaultAxes: module_support_exports.DIRECTION_SWAP_AXES, + themeTemplate: BOX_PLOT_SERIES_THEME, + groupable: true +}; +var BoxPlotSeriesModule = { + type: "series", + name: "box-plot", + chartType: "cartesian", + enterprise: true, + options: boxPlotSeriesOptionsDef, + create: (ctx) => new BoxPlotSeries(ctx) +}; +var { + AGGREGATION_SPAN: AGGREGATION_SPAN2, + AGGREGATION_INDEX_X_MAX: AGGREGATION_INDEX_X_MAX2, + AGGREGATION_INDEX_X_MIN: AGGREGATION_INDEX_X_MIN2, + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX2, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN2, + aggregationDomain: aggregationDomain2, + aggregationRangeFittingPoints: aggregationRangeFittingPoints2, + compactAggregationIndices: compactAggregationIndices2, + createAggregationIndices: createAggregationIndices2 +} = module_support_exports; +var AGGREGATION_THRESHOLD4 = 1e3; +var OPEN = AGGREGATION_INDEX_X_MIN2; +var HIGH = AGGREGATION_INDEX_Y_MAX2; +var LOW = AGGREGATION_INDEX_Y_MIN2; +var CLOSE = AGGREGATION_INDEX_X_MAX2; +function aggregateOhlcData(scale2, xValues, highValues, lowValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD4) + return; + const [d0, d1] = aggregationDomain2(scale2, domain); + let maxRange = aggregationRangeFittingPoints2(xValues, d0, d1, { smallestKeyInterval }); + let { indexData, valueData } = createAggregationIndices2(xValues, highValues, lowValues, d0, d1, maxRange); + const filters = [{ maxRange, indexData }]; + while (maxRange > 64) { + ({ indexData, valueData, maxRange } = compactAggregationIndices2(indexData, valueData, maxRange)); + filters.push({ maxRange, indexData }); + } + filters.reverse(); + return filters; +} +var { + fixNumericExtent: fixNumericExtent3, + keyProperty: keyProperty3, + createDatumId: createDatumId22, + SeriesNodePickMode: SeriesNodePickMode22, + ChartAxisDirection: ChartAxisDirection14, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL22, + valueProperty: valueProperty4, + diff: diff22, + animationValidation: animationValidation22, + computeBarFocusBounds: computeBarFocusBounds22, + visibleRangeIndices: visibleRangeIndices2, + BandScale: BandScale2, + processedDataIsAnimatable: processedDataIsAnimatable2, + mergeDefaults: mergeDefaults5, + simpleMemorize2: simpleMemorize22, + getItemStylesPerItemId: getItemStylesPerItemId2 +} = module_support_exports; +var memoizedAggregateOhlcData = simpleMemorize22(aggregateOhlcData); +var OhlcSeriesNodeEvent = class extends module_support_exports.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.openKey = series.properties.openKey; + this.closeKey = series.properties.closeKey; + this.highKey = series.properties.highKey; + this.lowKey = series.properties.lowKey; + } +}; +var OhlcSeriesBase = class extends module_support_exports.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode22.AXIS_ALIGNED, SeriesNodePickMode22.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["lowKey", "highKey", "openKey", "closeKey"] + }, + propertyNames: { + x: ["xName"], + y: ["lowName", "highName", "openName", "closeName"] + }, + categoryKey: "xValue", + pathsPerSeries: [] + }); + this.NodeEvent = OhlcSeriesNodeEvent; + this.dataAggregationFilters = void 0; + } + async processData(dataController) { + if (!this.visible) + return; + const { xKey, openKey, closeKey, highKey, lowKey } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (animationEnabled) { + if (this.processedData) { + extraProps.push(diff22(this.id, this.processedData)); + } + extraProps.push(animationValidation22()); + } + if (openKey) { + extraProps.push( + valueProperty4(openKey, yScaleType, { + id: `openValue`, + invalidValue: void 0, + missingValue: void 0 + }) + ); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty3(xKey, xScaleType, { id: `xValue` }), + valueProperty4(closeKey, yScaleType, { id: `closeValue` }), + valueProperty4(highKey, yScaleType, { id: `highValue` }), + valueProperty4(lowKey, yScaleType, { id: `lowValue` }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL22] : [], + ...extraProps + ] + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.dataAggregationFilters = this.aggregateData( + dataModel, + processedData + ); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable2(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection14.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const highValues = dataModel.resolveColumnById(this, `highValue`, processedData); + const lowValues = dataModel.resolveColumnById(this, `lowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateOhlcData( + xAxis.scale.type, + xValues, + highValues, + lowValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + if (direction !== this.getBarDirection()) { + const { index, def } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const keys = processedData.domain.keys[index]; + if (def.type === "key" && def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } + const yExtent = this.domainForClippedRange(direction, ["highValue", "lowValue"], "xValue"); + return fixNumericExtent3(yExtent); + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection14.Y, ["highValue", "lowValue"], "xValue", visibleRange); + } + getZoomRangeFittingItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.zoomFittingVisibleItems( + "xValue", + ["highValue", "lowValue"], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + getVisibleItems(xVisibleRange, yVisibleRange, minVisibleItems) { + return this.countVisibleItems( + "xValue", + ["highValue", "lowValue"], + xVisibleRange, + yVisibleRange, + minVisibleItems + ); + } + createNodeData() { + const { visible, dataModel, processedData } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(dataModel && processedData && xAxis && yAxis)) + return; + const nodeData = []; + const { xKey, highKey, lowKey } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const openValues = dataModel.resolveColumnById(this, "openValue", processedData); + const closeValues = dataModel.resolveColumnById(this, "closeValue", processedData); + const highValues = dataModel.resolveColumnById(this, "highValue", processedData); + const lowValues = dataModel.resolveColumnById(this, "lowValue", processedData); + const { groupScale } = this; + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const groupOffset = groupScale.convert(String(groupIndex)); + const effectiveBarWidth = barWidth >= 1 ? barWidth : groupScale.rawBandwidth; + const applyWidthOffset = BandScale2.is(xAxis.scale); + const context = { + itemId: xKey, + nodeData, + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStylesPerItemId2(this.getItemStyle.bind(this), "up", "down") + }; + if (!visible) + return context; + const handleDatum = (datumIndex, xValue2, openValue, closeValue, highValue, lowValue, width2, crisp) => { + const datum = rawData[datumIndex]; + const xOffset = applyWidthOffset ? width2 / 2 : 0; + const centerX = xAxis.scale.convert(xValue2) + groupOffset + xOffset; + const yOpen = yAxis.scale.convert(openValue); + const yClose = yAxis.scale.convert(closeValue); + const yHigh = yAxis.scale.convert(highValue); + const yLow = yAxis.scale.convert(lowValue); + const isRising = closeValue > openValue; + const itemId = isRising ? "up" : "down"; + const y = Math.min(yHigh, yLow); + const height2 = Math.max(yHigh, yLow) - y; + const midPoint = { + x: centerX, + y: y + height2 / 2 + }; + nodeData.push({ + series: this, + itemId, + datum, + datumIndex, + xKey, + xValue: xValue2, + openValue, + closeValue, + highValue, + lowValue, + midPoint, + aggregatedValue: closeValue, + isRising, + centerX, + width: width2, + y, + height: height2, + yOpen, + yClose, + crisp + }); + }; + const { dataAggregationFilters } = this; + const xScale = xAxis.scale; + const [r0, r1] = xScale.range; + const range22 = Math.abs(r1 - r0); + const xPosition = (index) => xScale.convert(xValues[index]) + groupOffset; + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range22); + if (dataAggregationFilter == null) { + const invalidData = processedData.invalidData?.get(this.id); + let [start2, end3] = visibleRangeIndices2(1, rawData.length, xAxis.range, (index) => { + const xOffset = applyWidthOffset ? 0 : -effectiveBarWidth / 2; + const x = xPosition(index) + xOffset; + return [x, x + effectiveBarWidth]; + }); + if (processedData.input.count < 1e3) { + start2 = 0; + end3 = processedData.input.count; + } + for (let datumIndex = start2; datumIndex < end3; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + continue; + const openValue = openValues[datumIndex]; + const closeValue = closeValues[datumIndex]; + const highValue = highValues[datumIndex]; + const lowValue = lowValues[datumIndex]; + const validLowValue = lowValue != null && lowValue <= openValue && lowValue <= closeValue; + const validHighValue = highValue != null && highValue >= openValue && highValue >= closeValue; + if (!validLowValue) { + logger_exports.warnOnce( + `invalid low value for key [${lowKey}] in data element, low value cannot be higher than datum open or close values` + ); + continue; + } + if (!validHighValue) { + logger_exports.warnOnce( + `invalid high value for key [${highKey}] in data element, high value cannot be lower than datum open or close values.` + ); + continue; + } + handleDatum(datumIndex, xValue2, openValue, closeValue, highValue, lowValue, effectiveBarWidth, true); + } + } else { + const { maxRange, indexData } = dataAggregationFilter; + const [start2, end3] = visibleRangeIndices2(1, maxRange, xAxis.range, (index) => { + const aggIndex = index * AGGREGATION_SPAN2; + const openIndex = indexData[aggIndex + OPEN]; + const closeIndex = indexData[aggIndex + CLOSE]; + if (openIndex === -1) + return; + const xOffset = applyWidthOffset ? 0 : -effectiveBarWidth / 2; + return [xPosition(openIndex) + xOffset, xPosition(closeIndex) + xOffset + effectiveBarWidth]; + }); + for (let i = start2; i < end3; i += 1) { + const aggIndex = i * AGGREGATION_SPAN2; + const openIndex = indexData[aggIndex + OPEN]; + const closeIndex = indexData[aggIndex + CLOSE]; + const highIndex = indexData[aggIndex + HIGH]; + const lowIndex = indexData[aggIndex + LOW]; + if (openIndex === -1) + continue; + const midDatumIndex = Math.trunc((openIndex + closeIndex) / 2); + const xValue2 = xValues[midDatumIndex]; + if (xValue2 == null) + continue; + const openValue = openValues[openIndex]; + const closeValue = closeValues[closeIndex]; + const highValue = highValues[highIndex]; + const lowValue = lowValues[lowIndex]; + const width2 = Math.abs(xPosition(closeIndex) - xPosition(openIndex)) + effectiveBarWidth; + handleDatum(midDatumIndex, xValue2, openValue, closeValue, highValue, lowValue, width2, false); + } + } + return context; + } + isVertical() { + return true; + } + isLabelEnabled() { + return false; + } + updateDatumSelection(opts) { + const data = opts.nodeData ?? []; + return opts.datumSelection.update(data); + } + updateLabelNodes(_opts) { + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData); + } + getItemStyle(datumIndex, isHighlight, highlightState, itemId = "up") { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + const baseStyle = mergeDefaults5(highlightStyle, properties.getStyle(itemId)); + let style2 = baseStyle; + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId22(createDatumId22(xValue2), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(itemId, datumIndex, isHighlight, style2); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`, "item", itemId], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style2 = mergeDefaults5(overrides, style2); + } + } + return style2; + } + makeItemStylerParams(itemId, datumIndex, isHighlight, style2) { + const { id: seriesId, properties, processedData } = this; + const { xKey, openKey, closeKey, highKey, lowKey } = properties; + const datum = processedData.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const params = { + seriesId, + datum, + itemId, + xKey, + openKey, + closeKey, + highKey, + lowKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style2 + }; + if ("fill" in params && "fill" in style2) { + params.fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + } + return params; + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { + xKey, + xName, + yName, + openKey, + openName, + highKey, + highName, + lowKey, + lowName, + closeKey, + closeName, + legendItemName, + tooltip + } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const openValue = dataModel.resolveColumnById(this, `openValue`, processedData)[datumIndex]; + const highValue = dataModel.resolveColumnById(this, `highValue`, processedData)[datumIndex]; + const lowValue = dataModel.resolveColumnById(this, `lowValue`, processedData)[datumIndex]; + const closeValue = dataModel.resolveColumnById(this, `closeValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const itemId = closeValue >= openValue ? "up" : "down"; + const item = this.properties.item[itemId]; + const format = this.getItemStyle(datumIndex, false); + const marker = { + fill: item.fill ?? item.stroke, + fillOpacity: item.fillOpacity ?? item.strokeOpacity ?? 1, + stroke: item.stroke, + strokeWidth: item.strokeWidth ?? 1, + strokeOpacity: item.strokeOpacity ?? 1, + lineDash: item.lineDash ?? [0], + lineDashOffset: item.lineDashOffset ?? 0 + }; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + title: legendItemName, + symbol: { + marker + }, + data: [ + { + label: openName, + fallbackLabel: openKey, + value: this.getAxisValueText(yAxis, "tooltip", openValue, datum, openKey, legendItemName) + }, + { + label: highName, + fallbackLabel: highKey, + value: this.getAxisValueText(yAxis, "tooltip", highValue, datum, highKey, legendItemName) + }, + { + label: lowName, + fallbackLabel: lowKey, + value: this.getAxisValueText(yAxis, "tooltip", lowValue, datum, lowKey, legendItemName) + }, + { + label: closeName, + fallbackLabel: closeKey, + value: this.getAxisValueText(yAxis, "tooltip", closeValue, datum, closeKey, legendItemName) + } + ] + }, + { + seriesId, + datum, + title: yName, + itemId, + xKey, + xName, + yName, + openKey, + openName, + highKey, + highName, + lowKey, + lowName, + closeKey, + closeName, + ...format + } + ); + } + computeFocusBounds(opts) { + const nodeDatum = this.getNodeData()?.at(opts.datumIndex); + if (nodeDatum == null) + return; + const { centerX, y, width: width2, height: height2 } = nodeDatum; + const datum = { + x: centerX - width2 / 2, + y, + width: width2, + height: height2 + }; + return computeBarFocusBounds22(this, datum); + } +}; +var { Path: Path8, SceneChangeDetection: SceneChangeDetection5, BBox: BBox11 } = module_support_exports; +var OhlcBaseNode = class extends Path8 { + constructor() { + super(...arguments); + this.centerX = 0; + this.y = 0; + this.width = 0; + this.height = 0; + this.yOpen = 0; + this.yClose = 0; + this.crisp = false; + } + computeBBox() { + const { centerX, y, width: width2, height: height2 } = this; + return new BBox11(centerX - width2 / 2, y, width2, height2); + } + isPointInPath(x, y) { + return this.getBBox().containsPoint(x, y); + } + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } + get midPoint() { + return { x: this.centerX, y: this.y + this.height / 2 }; + } + alignedCoordinates() { + const { y, width: width2, height: height2, crisp } = this; + let { centerX, yOpen, yClose } = this; + let x0 = centerX - width2 / 2; + let x1 = centerX + width2 / 2; + let y0 = y; + let y1 = y + height2; + if (crisp && width2 > 1) { + centerX = this.align(centerX); + if (yOpen <= yClose) { + const h = this.align(yOpen, yClose - yOpen); + yOpen = this.align(yOpen); + yClose = yOpen + h; + } else { + const h = this.align(yClose, yOpen - yClose); + yClose = this.align(yClose); + yOpen = yClose + h; + } + const halfWidth = this.align(width2 / 2); + x0 = centerX - halfWidth; + x1 = centerX + halfWidth; + y0 = this.align(y); + y1 = y0 + this.align(y0, height2); + } + return { centerX, x0, x1, y0, y1, yOpen, yClose }; + } + executeStroke(ctx, path) { + const { width: width2, strokeWidth } = this; + if (width2 < strokeWidth) { + ctx.lineWidth = width2; + } + super.executeStroke(ctx, path); + } +}; +__decorateClass2([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "centerX", 2); +__decorateClass2([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "y", 2); +__decorateClass2([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "width", 2); +__decorateClass2([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "height", 2); +__decorateClass2([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "yOpen", 2); +__decorateClass2([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "yClose", 2); +__decorateClass2([ + SceneChangeDetection5() +], OhlcBaseNode.prototype, "crisp", 2); +var OhlcNode = class extends OhlcBaseNode { + constructor() { + super(...arguments); + this.strokeAlignment = 0; + } + updatePath() { + const { path } = this; + const { centerX, x0, x1, y0, y1, yOpen, yClose } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const strokeAlignment = this.strokeAlignment > 0 ? pixelRatio / this.strokeAlignment / 2 % 1 : 0; + path.clear(); + path.moveTo(centerX - strokeAlignment, y0); + path.lineTo(centerX - strokeAlignment, y1); + if (Math.abs(x1 - x0) > 1) { + path.moveTo(x0, yOpen - strokeAlignment); + path.lineTo(centerX - strokeAlignment, yOpen - strokeAlignment); + path.moveTo(centerX - strokeAlignment, yClose - strokeAlignment); + path.lineTo(x1, yClose - strokeAlignment); + } + } +}; +__decorateClass2([ + SceneChangeDetection5() +], OhlcNode.prototype, "strokeAlignment", 2); +var { SceneArrayChangeDetection: SceneArrayChangeDetection22, SceneChangeDetection: SceneChangeDetection6, ExtendedPath2D: ExtendedPath2D4, BBox: BBox12 } = module_support_exports; +var CandlestickNode = class extends OhlcBaseNode { + constructor() { + super(...arguments); + this.wickPath = new ExtendedPath2D4(); + this.wickStroke = void 0; + this.wickStrokeWidth = void 0; + this.wickStrokeOpacity = void 0; + this.wickStrokeAlignment = 0; + } + computeDefaultGradientFillBBox() { + const { width: width2, centerX, yOpen, yClose } = this; + const boxTop = Math.min(yOpen, yClose); + const boxBottom = Math.max(yOpen, yClose); + const rectHeight = boxBottom - boxTop; + const x0 = centerX - width2 / 2; + const x1 = centerX + width2 / 2; + return new BBox12(x0, boxTop, x1 - x0, rectHeight); + } + updatePath() { + const { + path, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke, + wickStrokeWidth, + wickStrokeOpacity, + wickLineDash, + wickLineDashOffset + } = this; + const { centerX, x0, x1, y0, y1, yOpen, yClose } = this.alignedCoordinates(); + const pixelRatio = this.layerManager?.canvas.pixelRatio ?? 1; + const wickStrokeAlignment = this.wickStrokeAlignment > 0 ? pixelRatio / this.wickStrokeAlignment / 2 % 1 : 0; + this.path.clear(); + this.wickPath.clear(); + const needsWickPath = wickStroke != null && wickStroke !== stroke22 || wickStrokeWidth != null && wickStrokeWidth !== strokeWidth || wickStrokeOpacity != null && wickStrokeOpacity !== strokeOpacity || wickLineDash != null && wickLineDash !== lineDash || wickLineDashOffset != null && wickLineDashOffset !== lineDashOffset; + const wickPath = needsWickPath ? this.wickPath : path; + if (Math.abs(x1 - x0) <= 3) { + wickPath.moveTo(centerX - wickStrokeAlignment, y0); + wickPath.lineTo(centerX - wickStrokeAlignment, y1); + return; + } + const boxTop = Math.min(yOpen, yClose); + const boxBottom = Math.max(yOpen, yClose); + const boxStrokeAdjustment = strokeWidth / 2; + wickPath.moveTo(centerX - wickStrokeAlignment, y0); + wickPath.lineTo(centerX - wickStrokeAlignment, boxTop + boxStrokeAdjustment); + wickPath.moveTo(centerX - wickStrokeAlignment, y1); + wickPath.lineTo(centerX - wickStrokeAlignment, boxBottom - boxStrokeAdjustment); + const rectHeight = boxBottom - boxTop - 2 * boxStrokeAdjustment; + if (rectHeight > 0) { + path.rect( + x0 + boxStrokeAdjustment, + boxTop + boxStrokeAdjustment, + x1 - x0 - 2 * boxStrokeAdjustment, + rectHeight + ); + } else { + const boxMid = (boxTop + boxBottom) / 2; + path.moveTo(x0, boxMid); + path.lineTo(x1, boxMid); + } + } + drawPath(ctx) { + super.drawPath(ctx); + const { wickPath } = this; + if (wickPath.isEmpty()) + return; + const { + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + wickStroke = stroke22, + wickStrokeWidth = strokeWidth, + wickStrokeOpacity = strokeOpacity, + wickLineDash = lineDash, + wickLineDashOffset = lineDashOffset + } = this; + if (wickStrokeWidth === 0) + return; + ctx.globalAlpha *= wickStrokeOpacity; + if (typeof wickStroke === "string") { + ctx.strokeStyle = wickStroke; + } + ctx.lineWidth = wickStrokeWidth; + if (wickLineDash != null) { + ctx.setLineDash([...wickLineDash]); + } + ctx.lineDashOffset = wickLineDashOffset; + ctx.stroke(wickPath.getPath2D()); + } +}; +__decorateClass2([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStroke", 2); +__decorateClass2([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStrokeWidth", 2); +__decorateClass2([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStrokeOpacity", 2); +__decorateClass2([ + SceneArrayChangeDetection22() +], CandlestickNode.prototype, "wickLineDash", 2); +__decorateClass2([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickLineDashOffset", 2); +__decorateClass2([ + SceneChangeDetection6() +], CandlestickNode.prototype, "wickStrokeAlignment", 2); +var { BaseProperties: BaseProperties16, Property: Property49, AbstractBarSeriesProperties: AbstractBarSeriesProperties22, makeSeriesTooltip: makeSeriesTooltip22 } = module_support_exports; +var OhlcSeriesItem = class extends BaseProperties16 { + constructor() { + super(...arguments); + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass2([ + Property49 +], OhlcSeriesItem.prototype, "stroke", 2); +__decorateClass2([ + Property49 +], OhlcSeriesItem.prototype, "strokeWidth", 2); +__decorateClass2([ + Property49 +], OhlcSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property49 +], OhlcSeriesItem.prototype, "lineDash", 2); +__decorateClass2([ + Property49 +], OhlcSeriesItem.prototype, "lineDashOffset", 2); +var OhlcSeriesItems = class extends BaseProperties16 { + constructor() { + super(...arguments); + this.up = new OhlcSeriesItem(); + this.down = new OhlcSeriesItem(); + } +}; +__decorateClass2([ + Property49 +], OhlcSeriesItems.prototype, "up", 2); +__decorateClass2([ + Property49 +], OhlcSeriesItems.prototype, "down", 2); +var OhlcSeriesBaseProperties = class extends AbstractBarSeriesProperties22 { +}; +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "xKey", 2); +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "openKey", 2); +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "closeKey", 2); +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "highKey", 2); +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "lowKey", 2); +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "xName", 2); +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "yName", 2); +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "openName", 2); +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "closeName", 2); +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "highName", 2); +__decorateClass2([ + Property49 +], OhlcSeriesBaseProperties.prototype, "lowName", 2); +var OhlcSeriesProperties = class extends OhlcSeriesBaseProperties { + constructor() { + super(...arguments); + this.tooltip = makeSeriesTooltip22(); + this.item = new OhlcSeriesItems(); + } + getStyle(itemId) { + const { strokeWidth, strokeOpacity, stroke: stroke22, lineDash, lineDashOffset } = this.item[itemId]; + return { + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property49 +], OhlcSeriesProperties.prototype, "tooltip", 2); +__decorateClass2([ + Property49 +], OhlcSeriesProperties.prototype, "item", 2); +__decorateClass2([ + Property49 +], OhlcSeriesProperties.prototype, "itemStyler", 2); +var { BaseProperties: BaseProperties17, makeSeriesTooltip: makeSeriesTooltip3, Property: Property50 } = module_support_exports; +var CandlestickSeriesWick = class extends BaseProperties17 { +}; +__decorateClass2([ + Property50 +], CandlestickSeriesWick.prototype, "stroke", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesWick.prototype, "strokeWidth", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesWick.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesWick.prototype, "lineDash", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesWick.prototype, "lineDashOffset", 2); +var CandlestickSeriesItem = class extends BaseProperties17 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.fillOpacity = 1; + this.stroke = "#333"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.wick = new CandlestickSeriesWick(); + } +}; +__decorateClass2([ + Property50 +], CandlestickSeriesItem.prototype, "fill", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesItem.prototype, "fillOpacity", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesItem.prototype, "stroke", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesItem.prototype, "strokeWidth", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesItem.prototype, "lineDash", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesItem.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesItem.prototype, "cornerRadius", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesItem.prototype, "wick", 2); +var CandlestickSeriesItems = class extends BaseProperties17 { + constructor() { + super(...arguments); + this.up = new CandlestickSeriesItem(); + this.down = new CandlestickSeriesItem(); + } +}; +__decorateClass2([ + Property50 +], CandlestickSeriesItems.prototype, "up", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesItems.prototype, "down", 2); +var CandlestickSeriesProperties = class extends OhlcSeriesBaseProperties { + constructor() { + super(); + this.item = new CandlestickSeriesItems(); + this.tooltip = makeSeriesTooltip3(); + this.highlightStyle.deprecated = false; + } + getStyle(itemId) { + const { fill, fillOpacity, strokeWidth, strokeOpacity, stroke: stroke22, lineDash, lineDashOffset, cornerRadius, wick } = this.item[itemId]; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1, + wick + }; + } +}; +__decorateClass2([ + Property50 +], CandlestickSeriesProperties.prototype, "item", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesProperties.prototype, "tooltip", 2); +__decorateClass2([ + Property50 +], CandlestickSeriesProperties.prototype, "itemStyler", 2); +var { isGradientFill: isGradientFill2, isPatternFill: isPatternFill2, isImageFill: isImageFill2, applyShapeStyle: applyShapeStyle2 } = module_support_exports; +var CandlestickSeries = class extends OhlcSeriesBase { + constructor() { + super(...arguments); + this.properties = new CandlestickSeriesProperties(); + } + nodeFactory() { + const node = new CandlestickNode(); + node.lineCap = "butt"; + return node; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { up, down } = properties.item; + datumSelection.each((node, datum) => { + const { centerX, width: width2, y, height: height2, yOpen, yClose, crisp } = datum; + const baseStyle = datum.isRising ? up : down; + const style2 = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + node.centerX = centerX; + node.width = width2; + node.y = y; + node.height = height2; + node.yOpen = yOpen; + node.yClose = yClose; + node.crisp = crisp; + applyShapeStyle2(node, style2, this.getShapeFillBBox()); + const styleWick = style2?.wick; + node.wickStroke = styleWick?.stroke; + node.wickStrokeWidth = styleWick?.strokeWidth; + node.wickStrokeOpacity = styleWick?.strokeOpacity; + node.wickLineDash = styleWick?.lineDash; + node.wickLineDashOffset = styleWick?.lineDashOffset; + node.wickStrokeAlignment = baseStyle.wick.strokeWidth ?? baseStyle.strokeWidth; + }); + } + legendItemSymbol() { + const { up, down } = this.properties.item; + const upColorStops = isGradientFill2(up.fill) ? up.fill.colorStops.map( + (c) => typeof c === "string" ? c : { color: c.color, stop: c.stop == null ? void 0 : c.stop * 0.5 } + ) : [ + { color: isPatternFill2(up.fill) || isImageFill2(up.fill) ? up.stroke : up.fill, stop: 0 }, + { color: isPatternFill2(up.fill) || isImageFill2(up.fill) ? up.stroke : up.fill, stop: 0.5 } + ]; + const downColorStops = isGradientFill2(down.fill) ? down.fill.colorStops.map( + (c) => typeof c === "string" ? c : { color: c.color, stop: c.stop == null ? void 0 : c.stop * 0.5 } + ) : [{ color: isPatternFill2(down.fill) || isImageFill2(down.fill) ? down.stroke : down.fill, stop: 0.5 }]; + const fill = { + type: "gradient", + gradient: "linear", + rotation: 90, + colorStops: [...upColorStops, ...downColorStops], + reverse: false + }; + const stroke22 = { + type: "gradient", + gradient: "linear", + rotation: 90, + colorStops: [ + { color: up.stroke, stop: 0 }, + { color: up.stroke, stop: 0.5 }, + { color: down.stroke, stop: 0.5 } + ], + reverse: false + }; + return { + marker: { + fill, + fillOpacity: up.fillOpacity, + stroke: stroke22, + strokeWidth: up.strokeWidth ?? 1, + strokeOpacity: up.strokeOpacity ?? 1, + lineDash: up.lineDash, + lineDashOffset: up.lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id, + data, + visible, + ctx: { legendManager } + } = this; + const { xKey, yName, showInLegend, legendItemName } = this.properties; + if (!data?.data.length || !xKey || legendType !== "category") { + return []; + } + return [ + { + legendType: "category", + id, + itemId: id, + seriesId: id, + enabled: visible && legendManager.getItemEnabled({ seriesId: id, itemId: id }), + label: { + text: legendItemName ?? yName ?? id + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + hasItemStylers() { + return this.properties.itemStyler != null; + } +}; +CandlestickSeries.className = "CandleStickSeries"; +CandlestickSeries.type = "candlestick"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs22, candlestickSeriesThemeableOptionsDef: candlestickSeriesThemeableOptionsDef2 } = module_support_exports; +var candlestickSeriesOptionsDef = { + ...commonSeriesOptionsDefs22, + ...candlestickSeriesThemeableOptionsDef2, + type: required(constant("candlestick")), + xKey: required(string), + openKey: required(string), + highKey: required(string), + lowKey: required(string), + closeKey: required(string), + xName: string, + yName: string, + openName: string, + highName: string, + lowName: string, + closeName: string +}; +candlestickSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented(boolean); +candlestickSeriesOptionsDef.focusPriority = undocumented(number); +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE22 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle22, + FILL_GRADIENT_LINEAR_KEYED_DEFAULTS: FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS22, + FILL_PATTERN_KEYED_DEFAULTS: FILL_PATTERN_KEYED_DEFAULTS2 +} = module_support_exports; +function itemTheme(key) { + return { + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + key === "up" ? "transparent" : { $palette: "fill" }, + { $palette: `${key}.fill` } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_KEYED_DEFAULTS2(key)], + ["image", FILL_IMAGE_DEFAULTS22], + ["pattern", FILL_PATTERN_KEYED_DEFAULTS2(key)] + ] + }, + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: `${key}.stroke` } + ] + } + }; +} +var CANDLESTICK_SERIES_THEME = { + series: { + item: { + up: itemTheme("up"), + down: itemTheme("down") + }, + highlightStyle: { + item: { strokeWidth: 3 } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: multiSeriesHighlightStyle22() + }, + animation: { enabled: false }, + axes: { + [CARTESIAN_AXIS_TYPE22.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE22.ORDINAL_TIME]: { + groupPaddingInner: 0, + crosshair: { + enabled: true + } + } + } +}; +var { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE3, CARTESIAN_POSITION: CARTESIAN_POSITION2 } = module_support_exports.ThemeConstants; +var CandlestickModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "candlestick", + moduleFactory: (ctx) => new CandlestickSeries(ctx), + defaultAxes: [ + { + type: CARTESIAN_AXIS_TYPE3.NUMBER, + position: CARTESIAN_POSITION2.LEFT + }, + { + type: CARTESIAN_AXIS_TYPE3.ORDINAL_TIME, + position: CARTESIAN_POSITION2.BOTTOM + } + ], + themeTemplate: CANDLESTICK_SERIES_THEME, + groupable: false +}; +var CandlestickSeriesModule = { + type: "series", + name: "candlestick", + chartType: "cartesian", + enterprise: true, + options: candlestickSeriesOptionsDef, + create: (ctx) => new CandlestickSeries(ctx) +}; +function generateLabelSecondaryLabelFontSizeCandidates(label, secondaryLabel) { + const { fontSize: labelFontSize, minimumFontSize: labelMinimumFontSize = labelFontSize } = label; + const { + fontSize: secondaryLabelFontSize, + minimumFontSize: secondaryLabelMinimumFontSize = secondaryLabelFontSize + } = secondaryLabel; + const labelTracks = labelFontSize - labelMinimumFontSize; + const secondaryLabelTracks = secondaryLabelFontSize - secondaryLabelMinimumFontSize; + let currentLabelFontSize = label.fontSize; + let currentSecondaryLabelFontSize = secondaryLabel.fontSize; + const out = [{ labelFontSize, secondaryLabelFontSize }]; + while (currentLabelFontSize > labelMinimumFontSize || currentSecondaryLabelFontSize > secondaryLabelMinimumFontSize) { + const labelProgress = labelTracks > 0 ? (currentLabelFontSize - labelMinimumFontSize) / labelTracks : -1; + const secondaryLabelProgress = secondaryLabelTracks > 0 ? (currentSecondaryLabelFontSize - secondaryLabelMinimumFontSize) / secondaryLabelTracks : -1; + if (labelProgress > secondaryLabelProgress) { + currentLabelFontSize--; + } else { + currentSecondaryLabelFontSize--; + } + out.push({ + labelFontSize: currentLabelFontSize, + secondaryLabelFontSize: currentSecondaryLabelFontSize + }); + } + out.reverse(); + return out; +} +function formatStackedLabels(labelValue, labelProps, secondaryLabelValue, secondaryLabelProps, { padding: padding2 }, sizeFittingHeight) { + const { spacing = 0 } = labelProps; + const widthAdjust = 2 * padding2; + const heightAdjust = 2 * padding2 + spacing; + const minimumHeight = (labelProps.minimumFontSize ?? labelProps.fontSize) + (secondaryLabelProps.minimumFontSize ?? secondaryLabelProps.fontSize); + if (minimumHeight > sizeFittingHeight(minimumHeight + heightAdjust, false).height - heightAdjust) + return; + const fontSizeCandidates = generateLabelSecondaryLabelFontSizeCandidates(labelProps, secondaryLabelProps); + const labelTextSizeProps = { + fontFamily: labelProps.fontFamily, + fontStyle: labelProps.fontStyle, + fontWeight: labelProps.fontWeight + }; + const secondaryLabelTextSizeProps = { + fontFamily: secondaryLabelProps.fontFamily, + fontStyle: secondaryLabelProps.fontStyle, + fontWeight: secondaryLabelProps.fontWeight + }; + let label; + let secondaryLabel; + return findMaxValue(0, fontSizeCandidates.length - 1, (index) => { + const { labelFontSize, secondaryLabelFontSize } = fontSizeCandidates[index]; + const allowTruncation = index === 0; + const labelFont = { ...labelTextSizeProps, fontSize: labelFontSize }; + const secondaryLabelFont = { ...secondaryLabelTextSizeProps, fontSize: secondaryLabelFontSize }; + const labelLineHeight = cachedTextMeasurer(labelFont).lineHeight(); + const secondaryLabelLineHeight = cachedTextMeasurer(secondaryLabelFont).lineHeight(); + const sizeFitting = sizeFittingHeight( + labelLineHeight + secondaryLabelLineHeight + heightAdjust, + allowTruncation + ); + const availableWidth = sizeFitting.width - widthAdjust; + const availableHeight = sizeFitting.height - heightAdjust; + if (labelLineHeight + secondaryLabelLineHeight > availableHeight) + return; + if (label == null || label.fontSize !== labelFontSize) { + label = wrapLabel( + labelProps, + labelValue, + availableWidth, + availableHeight, + labelFont, + labelProps.wrapping, + allowTruncation ? labelProps.overflowStrategy : "hide" + ); + } + if (label == null || label.width > availableWidth || label.height > availableHeight) + return; + if (secondaryLabel == null || secondaryLabel.fontSize !== secondaryLabelFontSize) { + secondaryLabel = wrapLabel( + secondaryLabelProps, + secondaryLabelValue, + availableWidth, + availableHeight, + secondaryLabelFont, + secondaryLabelProps.wrapping, + allowTruncation ? secondaryLabelProps.overflowStrategy : "hide" + ); + } + if (secondaryLabel == null) + return; + const totalLabelHeight = label.height + secondaryLabel.height; + if (secondaryLabel.width > availableWidth || totalLabelHeight > availableHeight) + return; + return { + width: Math.max(label.width, secondaryLabel.width), + height: totalLabelHeight + spacing, + meta: sizeFitting.meta, + label, + secondaryLabel + }; + }); +} +function formatSingleLabel(value, props, { padding: padding2 }, sizeFittingHeight) { + const sizeAdjust = 2 * padding2; + const minimumFontSize = Math.min(props.minimumFontSize ?? props.fontSize, props.fontSize); + const textSizeProps = { + fontFamily: props.fontFamily, + fontStyle: props.fontStyle, + fontWeight: props.fontWeight + }; + return findMaxValue(minimumFontSize, props.fontSize, (fontSize) => { + const currentFont = { ...textSizeProps, fontSize }; + const measurer22 = cachedTextMeasurer(currentFont); + const allowTruncation = fontSize === minimumFontSize; + const lineHeight = props.lineHeight ?? measurer22.lineHeight(); + const sizeFitting = sizeFittingHeight(lineHeight + sizeAdjust, allowTruncation); + const availableWidth = sizeFitting.width - sizeAdjust; + const availableHeight = sizeFitting.height - sizeAdjust; + if (lineHeight > availableHeight || availableWidth < 0) + return; + const lines = wrapLines(value, { + maxWidth: availableWidth, + maxHeight: availableHeight, + font: currentFont, + textWrap: props.wrapping, + overflow: (allowTruncation ? props.overflowStrategy : null) ?? "hide" + }); + if (!lines.length) + return; + const { width: width2, height: height2 } = measurer22.measureLines(lines); + const text2 = lines.join("\n"); + return [{ width: width2, height: height2, text: text2, fontSize, lineHeight }, sizeFitting.meta]; + }); +} +function hasInvalidFontSize(label) { + return label?.minimumFontSize != null && label?.fontSize != null && label?.minimumFontSize > label?.fontSize; +} +function formatLabels(baseLabelValue, labelProps, baseSecondaryLabelValue, secondaryLabelProps, layoutParams, sizeFittingHeight) { + const labelValue = labelProps.enabled ? baseLabelValue : void 0; + const secondaryLabelValue = secondaryLabelProps.enabled ? baseSecondaryLabelValue : void 0; + if (hasInvalidFontSize(labelProps) || hasInvalidFontSize(secondaryLabelProps)) { + logger_exports.warnOnce(`minimumFontSize should be set to a value less than or equal to the font size`); + } + let value; + if (labelValue != null && secondaryLabelValue != null) { + value = formatStackedLabels( + labelValue, + labelProps, + secondaryLabelValue, + secondaryLabelProps, + layoutParams, + sizeFittingHeight + ); + } + let labelMeta; + if (value == null && labelValue != null) { + labelMeta = formatSingleLabel(labelValue, labelProps, layoutParams, sizeFittingHeight); + } + if (labelMeta != null) { + const [label, meta] = labelMeta; + value = { + width: label.width, + height: label.height, + meta, + label, + secondaryLabel: void 0 + }; + } + let secondaryLabelMeta; + if (value == null && labelValue == null && secondaryLabelValue != null) { + secondaryLabelMeta = formatSingleLabel( + secondaryLabelValue, + secondaryLabelProps, + layoutParams, + sizeFittingHeight + ); + } + if (secondaryLabelMeta != null) { + const [secondaryLabel, meta] = secondaryLabelMeta; + value = { + width: secondaryLabel.width, + height: secondaryLabel.height, + meta, + label: void 0, + secondaryLabel + }; + } + return value; +} +function wrapLabel(props, text2, maxWidth, maxHeight, font22, textWrap2, overflow) { + const lines = wrapLines(text2, { maxWidth, maxHeight, font: font22, textWrap: textWrap2, overflow }); + if (!lines.length) + return; + const measurer22 = cachedTextMeasurer(font22); + const lineHeight = props.lineHeight ?? measurer22.lineHeight(); + const { width: width2 } = measurer22.measureLines(lines); + return { + width: width2, + lineHeight, + text: lines.join("\n"), + height: lines.length * lineHeight, + fontSize: font22.fontSize + }; +} +var { Property: Property51 } = module_support_exports; +var BaseAutoSizedLabel = class extends module_support_exports.Label { + constructor() { + super(...arguments); + this.wrapping = "on-space"; + this.overflowStrategy = "ellipsis"; + } +}; +__decorateClass2([ + Property51 +], BaseAutoSizedLabel.prototype, "wrapping", 2); +__decorateClass2([ + Property51 +], BaseAutoSizedLabel.prototype, "overflowStrategy", 2); +__decorateClass2([ + Property51 +], BaseAutoSizedLabel.prototype, "lineHeight", 2); +__decorateClass2([ + Property51 +], BaseAutoSizedLabel.prototype, "minimumFontSize", 2); +var AutoSizedLabel = class extends BaseAutoSizedLabel { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass2([ + Property51 +], AutoSizedLabel.prototype, "spacing", 2); +var AutoSizedSecondaryLabel = class extends BaseAutoSizedLabel { +}; +var { CartesianSeriesProperties: CartesianSeriesProperties2, makeSeriesTooltip: makeSeriesTooltip4, Property: Property52 } = module_support_exports; +var HeatmapSeriesProperties = class extends CartesianSeriesProperties2 { + constructor() { + super(...arguments); + this.colorRange = ["black", "black"]; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.itemPadding = 0; + this.label = new AutoSizedLabel(); + this.tooltip = makeSeriesTooltip4(); + } +}; +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "title", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "xKey", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "yKey", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "colorKey", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "xName", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "yName", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "colorName", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "colorRange", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "stroke", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "textAlign", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "verticalAlign", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "itemPadding", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property52 +], HeatmapSeriesProperties.prototype, "tooltip", 2); +var { + SeriesNodePickMode: SeriesNodePickMode3, + computeBarFocusBounds: computeBarFocusBounds3, + getMissCount: getMissCount2, + valueProperty: valueProperty5, + ChartAxisDirection: ChartAxisDirection15, + DEFAULT_CARTESIAN_DIRECTION_KEYS: DEFAULT_CARTESIAN_DIRECTION_KEYS2, + DEFAULT_CARTESIAN_DIRECTION_NAMES: DEFAULT_CARTESIAN_DIRECTION_NAMES2, + createDatumId: createDatumId3, + ColorScale: ColorScale2, + Rect: Rect2, + PointerEvents: PointerEvents2, + applyShapeStyle: applyShapeStyle22, + mergeDefaults: mergeDefaults6, + formatValue: formatValue2, + addHitTestersToQuadtree: addHitTestersToQuadtree2, + findQuadtreeMatch: findQuadtreeMatch2, + updateLabelNode: updateLabelNode2 +} = module_support_exports; +var HeatmapSeriesNodeEvent = class extends module_support_exports.CartesianSeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.colorKey = series.properties.colorKey; + } +}; +var textAlignFactors = { + left: -0.5, + center: 0, + right: -0.5 +}; +var verticalAlignFactors = { + top: -0.5, + middle: 0, + bottom: -0.5 +}; +var HeatmapSeries = class extends module_support_exports.CartesianSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: { + ...DEFAULT_CARTESIAN_DIRECTION_KEYS2, + color: ["colorKey"] + }, + propertyNames: { + ...DEFAULT_CARTESIAN_DIRECTION_NAMES2, + color: ["colorName"] + }, + categoryKey: void 0, + pickModes: [SeriesNodePickMode3.NEAREST_NODE, SeriesNodePickMode3.EXACT_SHAPE_MATCH], + pathsPerSeries: [] + }); + this.properties = new HeatmapSeriesProperties(); + this.NodeEvent = HeatmapSeriesNodeEvent; + this.colorScale = new ColorScale2(); + } + async processData(dataController) { + const xAxis = this.axes[ChartAxisDirection15.X]; + const yAxis = this.axes[ChartAxisDirection15.Y]; + if (!xAxis || !yAxis || !this.data?.data.length) { + return; + } + const { xKey, yKey, colorRange, colorKey } = this.properties; + const xScale = this.axes[ChartAxisDirection15.X]?.scale; + const yScale = this.axes[ChartAxisDirection15.Y]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const colorScaleType = this.colorScale.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty5(xKey, xScaleType, { id: "xValue" }), + valueProperty5(yKey, yScaleType, { id: "yValue" }), + ...colorKey ? [valueProperty5(colorKey, colorScaleType, { id: "colorValue", invalidValue: void 0 })] : [] + ] + }); + if (this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const rawDomain = processedData.domain.values[colorKeyIdx].filter((v) => v != null); + const domain = module_support_exports.extent(rawDomain); + this.colorScale.domain = domain ?? []; + if (domain?.length && domain[0] === domain[1]) { + const midIndex = Math.floor(colorRange.length / 2); + this.colorScale.range = [colorRange[midIndex], colorRange[midIndex]]; + } else { + this.colorScale.range = colorRange; + } + this.colorScale.update(); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorDataIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount2(this, processedData.defs.values[colorDataIdx].missing); + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const actualCount = processedData.domain.values[colorKeyIdx].filter((v) => v != null).length; + const colorDataMissing = dataCount === 0 || dataCount === missCount || actualCount === 0; + return !colorDataMissing; + } + xCoordinateRange(xValue2, pixelSize) { + const xScale = this.axes[ChartAxisDirection15.X].scale; + const xOffset = pixelSize * (xScale.bandwidth ?? 0) / 2; + const x = xScale.convert(xValue2) + xOffset; + const width2 = pixelSize * (xScale.bandwidth ?? 10); + return [x, x + width2]; + } + yCoordinateRange(yValues, pixelSize) { + const yScale = this.axes[ChartAxisDirection15.Y].scale; + const yOffset = pixelSize * (yScale.bandwidth ?? 0) / 2; + const y = yScale.convert(yValues[0]) + yOffset; + const height2 = pixelSize * (yScale.bandwidth ?? 10); + return [y, y + height2]; + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!dataModel || !processedData) + return []; + if (direction === ChartAxisDirection15.X) { + return dataModel.getDomain(this, `xValue`, "value", processedData); + } else { + return dataModel.getDomain(this, `yValue`, "value", processedData); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { data, visible, axes, dataModel, processedData } = this; + const xAxis = axes[ChartAxisDirection15.X]; + const yAxis = axes[ChartAxisDirection15.Y]; + if (!(data && dataModel && processedData && visible && xAxis && yAxis)) + return; + if (xAxis.type !== "category" || yAxis.type !== "category") { + logger_exports.warnOnce( + `Heatmap series expected axes to have "category" type, but received "${xAxis.type}" and "${yAxis.type}" instead.` + ); + return; + } + const { xKey, xName, yKey, yName, colorKey, colorName, textAlign, verticalAlign, itemPadding, label } = this.properties; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const colorValues = colorKey ? dataModel.resolveColumnById(this, `colorValue`, processedData) : void 0; + const colorDomain = colorKey ? dataModel.getDomain(this, "colorValue", "value", processedData) : []; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const yOffset = (yScale.bandwidth ?? 0) / 2; + const nodeData = []; + const labelData = []; + const width2 = xScale.bandwidth ?? 10; + const height2 = yScale.bandwidth ?? 10; + const textAlignFactor = (width2 - 2 * itemPadding) * textAlignFactors[textAlign]; + const verticalAlignFactor = (height2 - 2 * itemPadding) * verticalAlignFactors[verticalAlign]; + const sizeFittingHeight = () => ({ width: width2, height: height2, meta: null }); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xDatum = xValues[datumIndex]; + const yDatum = yValues[datumIndex]; + const x = xScale.convert(xDatum) + xOffset; + const y = yScale.convert(yDatum) + yOffset; + const colorValue = colorValues?.[datumIndex]; + const labelText = label.enabled && colorValue != null ? this.getLabelText( + colorValue, + datum, + colorKey, + "color", + colorDomain, + label, + { value: colorValue, datum, colorKey, colorName, xKey, yKey, xName, yName } + ) : void 0; + const labels = formatLabels( + toPlainText(labelText), + this.properties.label, + void 0, + this.properties.label, + { padding: itemPadding }, + sizeFittingHeight + ); + const point = { x, y, size: 0 }; + const style2 = this.getItemStyle({ datumIndex, datum, colorValue }, false); + nodeData.push({ + series: this, + itemId: yKey, + datumIndex, + yKey, + xKey, + xValue: xDatum, + yValue: yDatum, + colorValue, + datum, + point, + width: width2, + height: height2, + midPoint: { x, y }, + missing: colorValues != null && colorValue == null, + style: style2 + }); + if (labels?.label != null) { + const { text: text2, fontSize, lineHeight, height: labelHeight } = labels.label; + const { fontStyle, fontFamily, fontWeight, color: color6 } = this.properties.label; + const lx = point.x + textAlignFactor * (width2 - 2 * itemPadding); + const ly = point.y + verticalAlignFactor * (height2 - 2 * itemPadding) - (labels.height - labelHeight) * 0.5; + labelData.push({ + series: this, + itemId: yKey, + datum, + datumIndex, + text: text2, + fontSize, + lineHeight, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + textBaseline: verticalAlign, + x: lx, + y: ly, + style: style2 + }); + } + } + return { + itemId: this.properties.yKey ?? this.id, + nodeData, + labelData, + scales: this.calculateScaling(), + visible: this.visible + }; + } + nodeFactory() { + return new Rect2(); + } + update(params) { + this.ctx.animationManager.skipCurrentBatch(); + return super.update(params); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data); + } + getItemStyle({ datumIndex, datum, colorValue }, isHighlight) { + const { properties } = this; + const { itemStyler, stroke: stroke22, strokeWidth, strokeOpacity } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const style2 = mergeDefaults6(highlightStyle, { + fill: this.isColorScaleValid() && colorValue != null ? this.colorScale.convert(colorValue) : "transparent", + fillOpacity: 1, + stroke: stroke22, + strokeWidth, + strokeOpacity, + opacity: 1 + }); + let overrides; + if (itemStyler != null && datumIndex != null) { + overrides = this.cachedDatumCallback(createDatumId3(datumIndex, isHighlight ? "highlight" : "node"), () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style2); + return this.callWithContext(itemStyler, params); + }); + } + return overrides ? mergeDefaults6(overrides, style2) : style2; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style2) { + const { id: seriesId, properties } = this; + const { xKey, yKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum, + xKey, + yKey, + highlighted: isHighlight, + highlightState, + ...style2, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const xAxis = this.axes[ChartAxisDirection15.X]; + const [visibleMin, visibleMax] = xAxis?.visibleRange ?? []; + const isZoomed = visibleMin !== 0 || visibleMax !== 1; + const crisp = !isZoomed; + datumSelection.each((rect2, nodeDatum) => { + const { point, width: width2, height: height2, style: style2 } = nodeDatum; + applyShapeStyle22(rect2, style2); + rect2.crisp = crisp; + rect2.x = Math.floor(point.x - width2 / 2); + rect2.y = Math.floor(point.y - height2 / 2); + rect2.width = Math.ceil(width2); + rect2.height = Math.ceil(height2); + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + const { enabled } = this.properties.label; + const data = enabled ? labelData : []; + return labelSelection.update(data); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((text2, datum) => { + text2.pointerEvents = PointerEvents2.None; + text2.text = datum.text; + text2.fillOpacity = this.getHighlightStyle(false, datum.datumIndex)?.opacity ?? 1; + updateLabelNode2(this, text2, this.properties, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties, colorScale, ctx } = this; + const { formatManager } = ctx; + const { xKey, xName, yKey, yName, colorKey, colorName, colorRange, title, legendItemName, tooltip } = properties; + const xAxis = axes[ChartAxisDirection15.X]; + const yAxis = axes[ChartAxisDirection15.Y]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + const colorValue = colorKey != null && this.isColorScaleValid() ? dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex] : void 0; + if (xValue2 == null) + return; + const data = []; + let fill; + if (colorValue == null) { + fill = colorRange[0]; + } else { + fill = colorScale.convert(colorValue); + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue2(colorValue) }); + } + data.push( + { + label: xName, + fallbackLabel: xKey, + value: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName) + }, + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, yKey, legendItemName) + } + ); + const format = this.getItemStyle({ datumIndex, datum, colorValue }, false); + if (format.fill != null) { + fill = format.fill; + } + const symbol = fill == null ? void 0 : { + marker: { + shape: "square", + fill, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + } + }; + return this.formatTooltipWithContext( + tooltip, + { title: title ?? legendItemName, symbol, data }, + { + seriesId, + datum, + title, + xKey, + xName, + yKey, + yName, + colorKey, + colorName, + ...format + } + ); + } + getLegendData(legendType) { + if (legendType !== "gradient" || !this.isColorScaleValid() || !this.dataModel) { + return []; + } + return [ + { + legendType: "gradient", + enabled: this.visible, + seriesId: this.id, + series: this.getFormatterContext("color"), + colorDomain: this.colorScale.domain, + colorRange: this.colorScale.range + } + ]; + } + isLabelEnabled() { + return this.properties.label.enabled && Boolean(this.properties.colorKey); + } + getBandScalePadding() { + return { inner: 0, outer: 0 }; + } + computeFocusBounds({ datumIndex }) { + const datum = this.contextNodeData?.nodeData[datumIndex]; + if (datum === void 0) + return void 0; + const { width: width2, height: height2, midPoint } = datum; + const focusRect = { x: midPoint.x - width2 / 2, y: midPoint.y - height2 / 2, width: width2, height: height2 }; + return computeBarFocusBounds3(this, focusRect); + } + initQuadTree(quadtree) { + addHitTestersToQuadtree2(quadtree, this.datumNodesIter()); + } + pickNodesExactShape(point) { + const item = findQuadtreeMatch2(this, point); + return item != null && item.distance <= 0 ? [item.datum] : []; + } + pickNodeClosestDatum(point) { + return findQuadtreeMatch2(this, point); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +HeatmapSeries.className = "HeatmapSeries"; +HeatmapSeries.type = "heatmap"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs3, heatmapSeriesThemeableOptionsDef: heatmapSeriesThemeableOptionsDef2, without: without2 } = module_support_exports; +var heatmapSeriesOptionsDef = { + ...without2(heatmapSeriesThemeableOptionsDef2, ["showInLegend"]), + ...without2(commonSeriesOptionsDefs3, ["showInLegend"]), + type: required(constant("heatmap")), + xKey: required(string), + yKey: required(string), + colorKey: string, + xName: string, + yName: string, + colorName: string, + colorRange: arrayOf(color) +}; +var HEATMAP_SERIES_THEME = { + series: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $ref: "chartBackgroundColor" }, + { $path: ["/0", { $palette: "stroke" }, { $palette: "strokes" }] } + ] + }, + strokeWidth: { $isUserOption: ["./stroke", 2, void 0] }, + // @ts-expect-error undocumented option + colorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "divergingColors" }, + module_support_exports.SAFE_RANGE2_OPERATION + ] + }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: false, + color: { $ref: "textColor" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + wrapping: "on-space", + overflowStrategy: "ellipsis" + }, + itemPadding: 3, + highlight: module_support_exports.singleSeriesHighlightStyle() + }, + gradientLegend: { + enabled: true, + ...module_support_exports.LEGEND_CONTAINER_THEME + } +}; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE4, CARTESIAN_POSITION: CARTESIAN_POSITION22 } +} = module_support_exports; +var HeatmapModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "heatmap", + moduleFactory: (ctx) => new HeatmapSeries(ctx), + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE4.CATEGORY, position: CARTESIAN_POSITION22.LEFT }, + { type: CARTESIAN_AXIS_TYPE4.CATEGORY, position: CARTESIAN_POSITION22.BOTTOM } + ], + themeTemplate: HEATMAP_SERIES_THEME +}; +var HeatmapSeriesModule = { + type: "series", + name: "heatmap", + chartType: "cartesian", + enterprise: true, + options: heatmapSeriesOptionsDef, + create: (ctx) => new HeatmapSeries(ctx) +}; +var { applyShapeStyle: applyShapeStyle3 } = module_support_exports; +var OhlcSeries = class extends OhlcSeriesBase { + constructor() { + super(...arguments); + this.properties = new OhlcSeriesProperties(); + } + nodeFactory() { + const node = new OhlcNode(); + node.lineCap = "square"; + return node; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum.datumIndex, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData, properties } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const { up, down } = properties.item; + datumSelection.each((node, datum) => { + const { centerX, width: width2, y, height: height2, yOpen, yClose, crisp } = datum; + const baseStyle = datum.isRising ? up : down; + node.centerX = centerX; + node.width = width2; + node.y = y; + node.height = height2; + node.yOpen = yOpen; + node.yClose = yClose; + node.crisp = crisp; + const style2 = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle3(node, style2); + node.strokeAlignment = baseStyle.strokeWidth; + }); + } + getLegendData(legendType) { + const { + id, + data, + ctx: { legendManager }, + visible + } = this; + const { + xKey, + yName, + item: { up, down }, + showInLegend, + legendItemName + } = this.properties; + if (!data?.data.length || !xKey || legendType !== "category") { + return []; + } + const fill = { + type: "gradient", + gradient: "linear", + colorSpace: "rgb", + colorStops: [ + { color: up.stroke, stop: 0 }, + { color: up.stroke, stop: 0.5 }, + { color: down.stroke, stop: 0.5 } + ], + rotation: 90 + }; + return [ + { + legendType: "category", + id, + itemId: id, + seriesId: id, + enabled: visible && legendManager.getItemEnabled({ seriesId: id, itemId: id }), + label: { + text: legendItemName ?? yName ?? id + }, + symbol: { + marker: { + fill, + fillOpacity: up.strokeOpacity, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + } + }, + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + hasItemStylers() { + return this.properties.itemStyler != null; + } +}; +OhlcSeries.className = "ohlc"; +OhlcSeries.type = "ohlc"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs4, ohlcSeriesThemeableOptionsDef: ohlcSeriesThemeableOptionsDef2 } = module_support_exports; +var ohlcSeriesOptionsDef = { + ...commonSeriesOptionsDefs4, + ...ohlcSeriesThemeableOptionsDef2, + type: required(constant("ohlc")), + xKey: required(string), + openKey: required(string), + highKey: required(string), + lowKey: required(string), + closeKey: required(string), + xName: string, + yName: string, + openName: string, + highName: string, + lowName: string, + closeName: string +}; +ohlcSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented(boolean); +ohlcSeriesOptionsDef.focusPriority = undocumented(number); +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE5, CARTESIAN_POSITION: CARTESIAN_POSITION3 }, + multiSeriesHighlightStyle: multiSeriesHighlightStyle3 +} = module_support_exports; +var OhlcModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "ohlc", + moduleFactory: (ctx) => new OhlcSeries(ctx), + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE5.NUMBER, position: CARTESIAN_POSITION3.LEFT }, + { type: CARTESIAN_AXIS_TYPE5.ORDINAL_TIME, position: CARTESIAN_POSITION3.BOTTOM } + ], + themeTemplate: { + animation: { enabled: false }, + series: { + item: { + up: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: "up.stroke" } + ] + } + }, + down: { + stroke: { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $palette: "stroke" }, + { $palette: "down.stroke" } + ] + } + } + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: multiSeriesHighlightStyle3(false) + }, + axes: { + [CARTESIAN_AXIS_TYPE5.NUMBER]: { + crosshair: { + snap: false + } + }, + [CARTESIAN_AXIS_TYPE5.ORDINAL_TIME]: { + groupPaddingInner: 0, + crosshair: { + enabled: true + } + } + } + }, + groupable: false +}; +var OhlcSeriesModule = { + type: "series", + name: "ohlc", + chartType: "cartesian", + enterprise: true, + options: ohlcSeriesOptionsDef, + create: (ctx) => new OhlcSeries(ctx) +}; +var { + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX22, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN22, + aggregationDomain: aggregationDomain22, + aggregationIndexForXRatio: aggregationIndexForXRatio2, + aggregationRangeFittingPoints: aggregationRangeFittingPoints22, + aggregationXRatioForXValue: aggregationXRatioForXValue2, + compactAggregationIndices: compactAggregationIndices22, + createAggregationIndices: createAggregationIndices22 +} = module_support_exports; +var AGGREGATION_THRESHOLD22 = 1e3; +function aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = aggregationXRatioForXValue2(xValue2, d0, d1, xNeedsValueOf); + const aggIndex = aggregationIndexForXRatio2(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MAX22]; +} +function aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) { + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return false; + const xRatio = aggregationXRatioForXValue2(xValue2, d0, d1, xNeedsValueOf); + const aggIndex = aggregationIndexForXRatio2(xRatio, maxRange); + return datumIndex === indexData[aggIndex + AGGREGATION_INDEX_Y_MIN22]; +} +function aggregateRangeAreaData(scale2, xValues, highValues, lowValues, domain, xNeedsValueOf, yNeedsValueOf) { + if (xValues.length < AGGREGATION_THRESHOLD22) + return; + const [d0, d1] = aggregationDomain22(scale2, domain); + let maxRange = aggregationRangeFittingPoints22(xValues, d0, d1, { xNeedsValueOf }); + const { indexData, valueData } = createAggregationIndices22(xValues, highValues, lowValues, d0, d1, maxRange, { + xNeedsValueOf, + yNeedsValueOf + }); + let topIndices = []; + let bottomIndices = []; + for (let datumIndex = 0; datumIndex < xValues.length; datumIndex += 1) { + if (aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf)) { + topIndices.push(datumIndex); + } + if (aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf)) { + bottomIndices.push(datumIndex); + } + } + const filters = [{ maxRange, topIndices, bottomIndices }]; + while (maxRange > 64) { + ({ maxRange } = compactAggregationIndices22(indexData, valueData, maxRange, { inPlace: true })); + topIndices = topIndices.filter( + (datumIndex) => aggregationContainsTopIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) + ); + bottomIndices = bottomIndices.filter( + (datumIndex) => aggregationContainsBottomIndex(xValues, d0, d1, indexData, maxRange, datumIndex, xNeedsValueOf) + ); + filters.push({ maxRange, topIndices, bottomIndices }); + } + filters.reverse(); + return filters; +} +function getYValueAtX({ span }, x) { + switch (span.type) { + case "linear": + case "step": + case "multi-line": { + const t = (x - span.x0) / (span.x1 - span.x0); + return span.y0 + t * (span.y1 - span.y0); + } + case "cubic": { + const { cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y } = span; + let t = 0.5; + const tolerance = 1e-6; + for (let i = 0; i < 10; i++) { + const mt2 = 1 - t; + const xt = mt2 * mt2 * mt2 * cp0x + 3 * mt2 * mt2 * t * cp1x + 3 * mt2 * t * t * cp2x + t * t * t * cp3x; + const fx = xt - x; + if (Math.abs(fx) < tolerance) + break; + const dxdt = 3 * mt2 * mt2 * (cp1x - cp0x) + 6 * mt2 * t * (cp2x - cp1x) + 3 * t * t * (cp3x - cp2x); + if (Math.abs(dxdt) < 1e-12) + break; + t = t - fx / dxdt; + t = Math.max(0, Math.min(1, t)); + } + const mt = 1 - t; + return mt * mt * mt * cp0y + 3 * mt * mt * t * cp1y + 3 * mt * t * t * cp2y + t * t * t * cp3y; + } + } +} +function findSpanForX(spans, x, startIndex = 0) { + for (let i = startIndex; i < spans.length; i++) { + const span = spans[i]; + const [start2, end3] = module_support_exports.spanRange(span.span); + if (x >= start2.x && x <= end3.x) { + return { span, index: i }; + } + if (x < start2.x) { + break; + } + } + return { span: null, index: startIndex }; +} +function checkForIntersection(highSpans, lowSpans, x, wasInverted, spanIndex) { + const high = findSpanForX(highSpans, x, spanIndex); + const low = findSpanForX(lowSpans, x, spanIndex); + if (!high.span || !low.span) { + return { intersection: null, spanIndex: high.index, isInverted: wasInverted }; + } + const highY = getYValueAtX(high.span, x); + const lowY = getYValueAtX(low.span, x); + const isInverted = highY > lowY; + const intersection = wasInverted === isInverted ? null : { x, y: highY }; + return { intersection, spanIndex: high.index, isInverted }; +} +function findRangeAreaIntersections(highSpans, lowSpans, minX, maxX, initiallyInverted = false) { + if (highSpans.length === 0 || lowSpans.length === 0) + return []; + const intersections = []; + let wasInverted = initiallyInverted; + let spanIndex = 0; + for (let x = minX; x <= maxX; x += 0.5) { + const result = checkForIntersection(highSpans, lowSpans, x, wasInverted, spanIndex); + if (result.intersection) { + intersections.push(result.intersection.x); + } + spanIndex = result.spanIndex; + wasInverted = result.isInverted; + } + return intersections; +} +function calculateIntersectionSegments(intersections, seriesRect, chartSize, startsInverted, style2 = {}) { + const horizontalMargin = Math.max(seriesRect.x, chartSize.width - (seriesRect.x + seriesRect.width)); + const verticalMargin = Math.max(seriesRect.y, chartSize.height - (seriesRect.y + seriesRect.height)); + const result = []; + const createClipRect = (x0, x1) => ({ + x0, + y0: -verticalMargin, + x1, + y1: seriesRect.height + verticalMargin + }); + if (startsInverted) { + result.push({ + clipRect: createClipRect(-horizontalMargin, intersections[0] ?? seriesRect.width + horizontalMargin), + ...style2 + }); + } + const startIndex = startsInverted ? 1 : 0; + for (let i = startIndex; i < intersections.length; i += 2) { + result.push({ + clipRect: createClipRect(intersections[i], intersections[i + 1] ?? seriesRect.width + horizontalMargin), + ...style2 + }); + } + return result; +} +var { + BaseProperties: BaseProperties18, + CartesianSeriesProperties: CartesianSeriesProperties22, + InterpolationProperties: InterpolationProperties2, + SeriesMarker: SeriesMarker2, + makeSeriesTooltip: makeSeriesTooltip5, + Property: Property53, + DropShadow: DropShadow2, + Label: Label22 +} = module_support_exports; +var RangeAreaSeriesLabel = class extends Label22 { + constructor() { + super(...arguments); + this.placement = "outside"; + this.spacing = 0; + } +}; +__decorateClass2([ + Property53 +], RangeAreaSeriesLabel.prototype, "placement", 2); +__decorateClass2([ + Property53 +], RangeAreaSeriesLabel.prototype, "spacing", 2); +var RangeAreaInvertedStyle = class { + constructor() { + this.enabled = false; + this.fillOpacity = 1; + } +}; +__decorateClass2([ + Property53 +], RangeAreaInvertedStyle.prototype, "enabled", 2); +__decorateClass2([ + Property53 +], RangeAreaInvertedStyle.prototype, "fill", 2); +__decorateClass2([ + Property53 +], RangeAreaInvertedStyle.prototype, "fillOpacity", 2); +var RangeAreaLineStyle = class extends BaseProperties18 { + constructor() { + super(...arguments); + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.marker = new SeriesMarker2(); + } +}; +__decorateClass2([ + Property53 +], RangeAreaLineStyle.prototype, "stroke", 2); +__decorateClass2([ + Property53 +], RangeAreaLineStyle.prototype, "strokeWidth", 2); +__decorateClass2([ + Property53 +], RangeAreaLineStyle.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property53 +], RangeAreaLineStyle.prototype, "lineDash", 2); +__decorateClass2([ + Property53 +], RangeAreaLineStyle.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property53 +], RangeAreaLineStyle.prototype, "marker", 2); +var RangeAreaItemProperties = class extends BaseProperties18 { + constructor() { + super(...arguments); + this.low = new RangeAreaLineStyle(); + this.high = new RangeAreaLineStyle(); + } +}; +__decorateClass2([ + Property53 +], RangeAreaItemProperties.prototype, "low", 2); +__decorateClass2([ + Property53 +], RangeAreaItemProperties.prototype, "high", 2); +var SharedRangeAreaMarker = class extends BaseProperties18 { +}; +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "enabled", 2); +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "shape", 2); +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "size", 2); +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "fill", 2); +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "fillOpacity", 2); +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "stroke", 2); +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "strokeWidth", 2); +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "lineDash", 2); +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property53 +], SharedRangeAreaMarker.prototype, "itemStyler", 2); +var RangeAreaProperties = class extends CartesianSeriesProperties22 { + constructor() { + super(...arguments); + this.fill = "#99CCFF"; + this.fillOpacity = 1; + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.interpolation = new InterpolationProperties2(); + this.item = new RangeAreaItemProperties(); + this.invertedStyle = new RangeAreaInvertedStyle(); + this.shadow = new DropShadow2().set({ enabled: false }); + this.marker = new SharedRangeAreaMarker(); + this.label = new RangeAreaSeriesLabel(); + this.tooltip = makeSeriesTooltip5(); + this.connectMissingData = false; + } +}; +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "xKey", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "yLowKey", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "yHighKey", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "xName", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "yName", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "yLowName", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "yHighName", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "fill", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "stroke", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "interpolation", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "styler", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "item", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "invertedStyle", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "shadow", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "marker", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "label", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "tooltip", 2); +__decorateClass2([ + Property53 +], RangeAreaProperties.prototype, "connectMissingData", 2); +var { + CollapseMode: CollapseMode2, + isScaleValid: isScaleValid2, + pairUpSpans: pairUpSpans2, + prepareAreaFillAnimationFns: prepareAreaFillAnimationFns2, + plotInterpolatedLinePathStroke: plotInterpolatedLinePathStroke2, + prepareLinePathPropertyAnimation: prepareLinePathPropertyAnimation2, + areScalingEqual: areScalingEqual2 +} = module_support_exports; +function prepareRangeAreaPathStrokeAnimationFns(status, highSpans, lowSpans, visibleToggleMode) { + const removePhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke2(ratio3, path, highSpans.removed); + plotInterpolatedLinePathStroke2(ratio3, path, lowSpans.removed); + }; + const updatePhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke2(ratio3, path, highSpans.moved); + plotInterpolatedLinePathStroke2(ratio3, path, lowSpans.moved); + }; + const addPhaseFn = (ratio3, path) => { + plotInterpolatedLinePathStroke2(ratio3, path, highSpans.added); + plotInterpolatedLinePathStroke2(ratio3, path, lowSpans.added); + }; + const pathProperties = prepareLinePathPropertyAnimation2(status, visibleToggleMode); + return { status, path: { addPhaseFn, updatePhaseFn, removePhaseFn }, pathProperties }; +} +function prepareRangeAreaPathAnimation(newData, oldData, diff8) { + const isCategoryBased = newData.scales.x?.type === "category"; + const wasCategoryBased = oldData.scales.x?.type === "category"; + if (isCategoryBased !== wasCategoryBased || !isScaleValid2(newData.scales.x) || !isScaleValid2(oldData.scales.x)) { + return; + } + let status = "updated"; + if (oldData.visible && !newData.visible) { + status = "removed"; + } else if (!oldData.visible && newData.visible) { + status = "added"; + } + const fillSpans = pairUpSpans2( + { scales: newData.scales, data: newData.fillData.spans }, + { scales: oldData.scales, data: oldData.fillData.spans }, + CollapseMode2.Split + ); + if (fillSpans == null) + return; + const fillPhantomSpans = pairUpSpans2( + { scales: newData.scales, data: newData.fillData.phantomSpans }, + { scales: oldData.scales, data: oldData.fillData.phantomSpans }, + CollapseMode2.Split + ); + if (fillPhantomSpans == null) + return; + const highStrokeSpans = pairUpSpans2( + { scales: newData.scales, data: newData.highStrokeData.spans }, + { scales: oldData.scales, data: oldData.highStrokeData.spans }, + CollapseMode2.Split + ); + if (highStrokeSpans == null) + return; + const lowStrokeSpans = pairUpSpans2( + { scales: newData.scales, data: newData.lowStrokeData.spans }, + { scales: oldData.scales, data: oldData.lowStrokeData.spans }, + CollapseMode2.Split + ); + if (lowStrokeSpans == null) + return; + const fadeMode = "fade"; + const fill = prepareAreaFillAnimationFns2(status, fillSpans, fillPhantomSpans, fadeMode); + const stroke22 = prepareRangeAreaPathStrokeAnimationFns(status, highStrokeSpans, lowStrokeSpans, fadeMode); + const hasMotion = (diff8?.changed ?? true) || !areScalingEqual2(newData.scales.x, oldData.scales.x) || !areScalingEqual2(newData.scales.y, oldData.scales.y) || status !== "updated"; + return { status, fill, stroke: stroke22, hasMotion }; +} +var { + valueProperty: valueProperty6, + keyProperty: keyProperty4, + ChartAxisDirection: ChartAxisDirection16, + mergeDefaults: mergeDefaults7, + updateLabelNode: updateLabelNode22, + fixNumericExtent: fixNumericExtent4, + buildResetPathFn: buildResetPathFn2, + resetLabelFn: resetLabelFn2, + resetMarkerFn: resetMarkerFn2, + resetMarkerPositionFn: resetMarkerPositionFn2, + pathSwipeInAnimation: pathSwipeInAnimation2, + resetMotion: resetMotion2, + markerSwipeScaleInAnimation: markerSwipeScaleInAnimation2, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation2, + animationValidation: animationValidation3, + diff: diff3, + updateClipPath: updateClipPath2, + computeMarkerFocusBounds: computeMarkerFocusBounds2, + plotAreaPathFill: plotAreaPathFill2, + plotLinePathStroke: plotLinePathStroke2, + interpolatePoints: interpolatePoints2, + pathFadeInAnimation: pathFadeInAnimation2, + markerFadeInAnimation: markerFadeInAnimation2, + fromToMotion: fromToMotion2, + pathMotion: pathMotion2, + extent: extent2, + applyShapeFillBBox: applyShapeFillBBox22, + PointerEvents: PointerEvents22, + Marker: Marker2, + BBox: BBox13, + findMinMax: findMinMax22, + applyShapeStyle: applyShapeStyle4, + processedDataIsAnimatable: processedDataIsAnimatable22, + simpleMemorize2: simpleMemorize222, + markerEnabled: markerEnabled2, + getMarkerStyles: getMarkerStyles2, + calculateSegments: calculateSegments22, + toHighlightString: toHighlightString22, + HighlightState: HighlightState22 +} = module_support_exports; +var memoizedAggregateRangeAreaData = simpleMemorize222(aggregateRangeAreaData); +var RangeAreaSeriesNodeEvent = class extends module_support_exports.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yLowKey = series.properties.yLowKey; + this.yHighKey = series.properties.yHighKey; + } +}; +var BaseSeries = module_support_exports.CartesianSeries; +var RangeAreaSeries = class extends BaseSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pathsPerSeries: ["fill", "lowStroke", "highStroke"], + pickModes: [module_support_exports.SeriesNodePickMode.AXIS_ALIGNED], + propertyKeys: { + [ChartAxisDirection16.X]: ["xKey"], + [ChartAxisDirection16.Y]: ["yLowKey", "yHighKey"] + }, + propertyNames: { + [ChartAxisDirection16.X]: ["xName"], + [ChartAxisDirection16.Y]: ["yLowName", "yHighName", "yName"] + }, + categoryKey: "xValue", + animationResetFns: { + path: buildResetPathFn2({ getVisible: () => this.visible, getOpacity: () => this.getOpacity() }), + label: resetLabelFn2, + datum: (node, datum) => ({ ...resetMarkerFn2(node), ...resetMarkerPositionFn2(node, datum) }) + }, + clipFocusBox: false + }); + this.properties = new RangeAreaProperties(); + this.NodeEvent = RangeAreaSeriesNodeEvent; + this.dataAggregationFilters = void 0; + } + async processData(dataController) { + const { xKey, yLowKey, yHighKey } = this.properties; + const xScale = this.axes[ChartAxisDirection16.X]?.scale; + const yScale = this.axes[ChartAxisDirection16.Y]?.scale; + const { xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + if (!this.ctx.animationManager.isSkipped() && this.processedData) { + extraProps.push(diff3(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation3()); + } + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty4(xKey, xScaleType, { id: `xValue` }), + valueProperty6(yLowKey, yScaleType, { id: `yLowValue` }), + valueProperty6(yHighKey, yScaleType, { id: `yHighValue` }), + ...extraProps + ] + }); + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable22(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection16.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + const xNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `xValue`, processedData); + const yNeedsValueOf = dataModel.resolveColumnNeedsValueOf(this, `yHighValue`, processedData); + return memoizedAggregateRangeAreaData( + xAxis.scale.type, + xValues, + yHighValues, + yLowValues, + domain, + xNeedsValueOf, + yNeedsValueOf + ); + } + xCoordinateRange(xValue2) { + const x = this.axes[ChartAxisDirection16.X].scale.convert(xValue2); + return [x, x]; + } + yCoordinateRange(yValues) { + const y = this.axes[ChartAxisDirection16.Y].scale.convert(yValues[0]); + return [y, y]; + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!(processedData && dataModel)) + return []; + const { + domain: { + keys: [keys] + } + } = processedData; + if (direction === ChartAxisDirection16.X) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef.def.valueType === "category") { + return keys; + } + return fixNumericExtent4(extent2(keys)); + } else { + const yExtent = this.domainForClippedRange(ChartAxisDirection16.Y, ["yHighValue", "yLowValue"], "xValue"); + const fixedYExtent = findMinMax22(yExtent); + return fixNumericExtent4(fixedYExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection16.Y, ["yHighValue", "yLowValue"], "xValue", visibleRange); + } + createNodeData() { + const { data, dataModel, processedData, axes } = this; + const xAxis = axes[ChartAxisDirection16.X]; + const yAxis = axes[ChartAxisDirection16.Y]; + if (!(data && xAxis && yAxis && dataModel && processedData && this.chart?.seriesRect)) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const { xKey, yLowKey, yHighKey, connectMissingData, interpolation, fill, fillOpacity, item } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xOffset = (xScale.bandwidth ?? 0) / 2; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yHighValues = dataModel.resolveColumnById(this, "yHighValue", processedData); + const yLowValues = dataModel.resolveColumnById(this, "yLowValue", processedData); + const xPosition = (index) => xScale.convert(xValues[index]) + xOffset; + const labelData = []; + const markerData = []; + const spanPoints = []; + const handleDatumPoint = (datumIndex, yHighValue, yLowValue) => { + const datum = rawData[datumIndex]; + const xValue2 = xValues[datumIndex]; + if (xValue2 == null) + return; + const currentSpanPoints = spanPoints.at(-1); + if (Number.isFinite(yHighValue) && Number.isFinite(yLowValue)) { + const appendMarker = (id, yValue, y) => { + const { size } = item[id].marker; + markerData.push({ + index: datumIndex, + series: this, + itemId: id, + datum, + datumIndex, + midPoint: { x, y }, + yHighValue, + yLowValue, + xValue: xValue2, + xKey, + yLowKey, + yHighKey, + point: { x, y, size }, + enabled: true + }); + const highLabelDatum = this.createLabelData({ + datumIndex, + point: { x, y }, + value: yValue, + yLowValue, + yHighValue, + itemId: id, + inverted, + datum, + series: this + }); + labelData.push(highLabelDatum); + }; + const inverted = yLowValue > yHighValue; + const x = xPosition(datumIndex); + const yHighCoordinate = yScale.convert(yHighValue); + const yLowCoordinate = yScale.convert(yLowValue); + appendMarker("high", yHighValue, yHighCoordinate); + appendMarker("low", yLowValue, yLowCoordinate); + const spanPoint = { + high: { + point: { x, y: yHighCoordinate }, + xDatum: xValue2, + yDatum: yHighValue + }, + low: { + point: { x, y: yLowCoordinate }, + xDatum: xValue2, + yDatum: yLowValue + } + }; + if (Array.isArray(currentSpanPoints)) { + currentSpanPoints.push(spanPoint); + } else if (currentSpanPoints == null) { + spanPoints.push([spanPoint]); + } else { + currentSpanPoints.skip += 1; + spanPoints.push([spanPoint]); + } + } else if (!connectMissingData) { + if (Array.isArray(currentSpanPoints) || currentSpanPoints == null) { + spanPoints.push({ skip: 0 }); + } else { + currentSpanPoints.skip += 1; + } + } + }; + const { dataAggregationFilters } = this; + const [r0, r1] = xScale.range; + const range22 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range22); + const topIndices = dataAggregationFilter?.topIndices; + const bottomIndices = dataAggregationFilter?.bottomIndices; + let [start2, end3] = this.visibleRangeIndices("xValue", xAxis.range, topIndices); + start2 = Math.max(start2 - 1, 0); + end3 = Math.min(end3 + 1, topIndices?.length ?? xValues.length); + if (processedData.input.count < 1e3) { + start2 = 0; + end3 = processedData.input.count; + } + for (let i = start2; i < end3; i += 1) { + const topDatumIndex = topIndices?.[i] ?? i; + const bottomDatumIndex = bottomIndices?.[i] ?? i; + handleDatumPoint(topDatumIndex, yHighValues[topDatumIndex], yLowValues[bottomDatumIndex]); + } + const highSpans = spanPoints.flatMap((p) => { + if (!Array.isArray(p)) + return []; + const highPoints = p.map((d) => d.high); + return interpolatePoints2(highPoints, interpolation); + }); + const lowSpans = spanPoints.flatMap((p) => { + if (!Array.isArray(p)) + return []; + const lowPoints = p.map((d) => d.low); + return interpolatePoints2(lowPoints, interpolation); + }); + const segments = calculateSegments22( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene, + false + ); + let intersectionSegments = void 0; + if (this.properties.invertedStyle.enabled) { + const startsInverted = yHighValues[0] < yLowValues[0]; + const intersectionXValues = findRangeAreaIntersections( + highSpans, + lowSpans, + xScale.range[0], + xScale.range[1], + startsInverted + ); + intersectionSegments = calculateIntersectionSegments( + intersectionXValues, + this.chart.seriesRect, + this.ctx.scene, + startsInverted, + this.properties.invertedStyle + ); + } + const getLowOrHighMarkerStyles = (lowOrHigh) => { + const line = item[lowOrHigh]; + const { stroke: stroke22, strokeWidth, strokeOpacity } = line; + const inheritedStyles = { fill, fillOpacity, stroke: stroke22, strokeWidth, strokeOpacity }; + return getMarkerStyles2(this, line, line.marker, inheritedStyles); + }; + const context = { + itemId: `${yLowKey}-${yHighKey}`, + labelData, + nodeData: markerData, + fillData: { itemId: "high", spans: highSpans, phantomSpans: lowSpans }, + highStrokeData: { itemId: "high", spans: highSpans }, + lowStrokeData: { itemId: "low", spans: lowSpans }, + scales: this.calculateScaling(), + visible: this.visible, + styles: { + low: getLowOrHighMarkerStyles("low"), + high: getLowOrHighMarkerStyles("high") + }, + segments, + intersectionSegments + }; + return context; + } + createLabelData({ + datumIndex, + point, + value, + itemId, + inverted, + datum, + series + }) { + const { xKey, yLowKey, yHighKey, xName, yName, yLowName, yHighName, legendItemName, label } = this.properties; + const { placement } = label; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + let actualItemId = itemId; + if (inverted) { + actualItemId = itemId === "low" ? "high" : "low"; + } + const direction = placement === "outside" && actualItemId === "high" || placement === "inside" && actualItemId === "low" ? -1 : 1; + const yDomain = this.getSeriesDomain(ChartAxisDirection16.Y); + return { + x: point.x, + y: point.y + spacing * direction, + series, + itemId, + datum, + datumIndex, + text: this.getLabelText( + value, + datum, + itemId === "high" ? yHighKey : yLowKey, + "y", + yDomain, + label, + { value, datum, itemId, xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName } + ), + textAlign: "center", + textBaseline: direction === -1 ? "bottom" : "top" + }; + } + isPathOrSelectionDirty() { + const { low, high } = this.properties.item; + return low.marker.isDirty() || high.marker.isDirty(); + } + strokewidthChange() { + const itemStrokeWidthChange = (lowOrHigh) => { + const unhighlightedStrokeWidth = this.properties.item[lowOrHigh].strokeWidth ?? 0; + const highlightedSeriesStrokeWidth = this.properties.highlight.highlightedSeries.item?.[lowOrHigh]?.strokeWidth ?? unhighlightedStrokeWidth; + const highlightedItemStrokeWidth = this.properties.highlight.highlightedItem.item?.[lowOrHigh]?.strokeWidth ?? unhighlightedStrokeWidth; + return unhighlightedStrokeWidth > highlightedItemStrokeWidth || highlightedSeriesStrokeWidth > highlightedItemStrokeWidth; + }; + return itemStrokeWidthChange("low") || itemStrokeWidthChange("high"); + } + updatePathNodes(opts) { + const { visible } = opts; + const [fillPath, lowStrokePath, highStrokePath] = opts.paths; + const segments = this.contextNodeData?.segments; + const highlightDatum = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightState(highlightDatum, false); + const highlightStyle = this.getHighlightStyle(); + const { item, fill, fillOpacity, opacity } = mergeDefaults7( + highlightStyle, + this.getStyle(false, highlightState) + ); + lowStrokePath.setProperties({ + datum: segments, + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: PointerEvents22.None, + stroke: item.low.stroke, + strokeWidth: item.low.strokeWidth, + strokeOpacity: item.low.strokeOpacity, + lineDash: item.low.lineDash, + lineDashOffset: item.low.lineDashOffset, + opacity, + visible + }); + highStrokePath.setProperties({ + segments, + fill: void 0, + lineCap: "round", + lineJoin: "round", + pointerEvents: PointerEvents22.None, + stroke: item.high.stroke, + strokeWidth: item.high.strokeWidth, + strokeOpacity: item.high.strokeOpacity, + lineDash: item.high.lineDash, + lineDashOffset: item.high.lineDashOffset, + opacity, + visible + }); + const fillBBox = this.getShapeFillBBox(); + applyShapeFillBBox22(fillPath, fill, fillBBox); + applyShapeStyle4(fillPath, { stroke: void 0, fill, fillOpacity, opacity }, fillBBox); + const fillSegments = this.contextNodeData?.intersectionSegments ?? segments; + fillPath.setProperties({ + segments: fillSegments, + pointerEvents: PointerEvents22.None, + lineJoin: "round", + fillShadow: this.properties.shadow, + opacity, + visible + }); + fillPath.datum = fillSegments; + updateClipPath2(this, fillPath); + updateClipPath2(this, lowStrokePath); + updateClipPath2(this, highStrokePath); + } + updatePaths(opts) { + this.updateAreaPaths(opts.paths, opts.contextData); + } + updateAreaPaths(paths, contextData) { + for (const path of paths) { + path.visible = contextData.visible; + } + if (contextData.visible) { + this.updateFillPath(paths, contextData); + this.updateStrokePath(paths, contextData); + } else { + for (const path of paths) { + path.path.clear(); + path.markDirty("RangeArea"); + } + } + } + updateFillPath(paths, contextData) { + const [fill] = paths; + fill.path.clear(); + plotAreaPathFill2(fill, contextData.fillData); + fill.markDirty("RangeArea"); + } + updateStrokePath(paths, contextData) { + const [, lowStroke, highStroke] = paths; + lowStroke.path.clear(); + highStroke.path.clear(); + plotLinePathStroke2(lowStroke, contextData.lowStrokeData.spans); + plotLinePathStroke2(highStroke, contextData.highStrokeData.spans); + lowStroke.markDirty("RangeArea"); + highStroke.markDirty("RangeArea"); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const { processedData, axes, properties } = this; + const rules = properties.styler ? this.getStylerMarkerOptions().item : properties.item; + const { low, high } = rules; + const markersEnabled = markerEnabled2(processedData.input.count, axes[ChartAxisDirection16.X].scale, { + enabled: low.marker.enabled || high.marker.enabled + }); + if (properties.item.low.marker.isDirty() || properties.item.high.marker.isDirty()) { + datumSelection.clear(); + datumSelection.cleanup(); + } + let resolvedNodeData; + if (markersEnabled) { + if (low.marker.enabled && high.marker.enabled) { + resolvedNodeData = nodeData; + } else { + resolvedNodeData = []; + for (const datum of nodeData) { + if (rules[datum.itemId].marker.enabled) { + resolvedNodeData.push(datum); + } + } + } + } else { + resolvedNodeData = []; + } + return datumSelection.update(resolvedNodeData); + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((_, datum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { fill, fillOpacity, item } = stylerStyle; + const { stroke: stroke22, strokeWidth, strokeOpacity } = item[datum.itemId]; + const { marker } = this.properties.item[datum.itemId]; + const params = this.makeItemStylerParams(datum.itemId); + datum.style = this.getMarkerStyle( + marker, + datum, + params, + { isHighlight, highlightState, resolveMarkerSubPath: ["item", datum.itemId, "marker"] }, + stylerStyle.item[datum.itemId].marker, + { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity + } + ); + }); + } + updateDatumNodes(opts) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + datumSelection.each((node, datum) => { + const { itemId } = datum; + const style2 = datum.style ?? contextNodeData.styles[itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style2, node, datum.point, fillBBox); + }); + if (!isHighlight) { + this.properties.item.low.marker.markClean(); + this.properties.item.high.marker.markClean(); + } + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + return labelSelection.update(labelData, (text2) => { + text2.pointerEvents = PointerEvents22.None; + }); + } + updateLabelNodes(opts) { + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yName: this.properties.yName, + yLowKey: this.properties.yLowKey, + yLowName: this.properties.yLowName ?? this.properties.yLowKey, + yHighKey: this.properties.yHighKey, + yHighName: this.properties.yHighName ?? this.properties.yHighKey, + legendItemName: this.properties.legendItemName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + updateLabelNode22(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getHighlightData(nodeData, highlightedItem) { + const highlightItems = nodeData.filter((nodeDatum) => nodeDatum.datum === highlightedItem.datum); + return highlightItems.length > 0 ? highlightItems : void 0; + } + getStyle(highlighted, highlightState) { + return this.getStylerCouple(highlighted, highlightState)[0]; + } + getStylerMarkerOptions() { + return this.getStylerCouple(false)[1]; + } + getStylerCouple(highlighted, highlightState) { + const { fill, fillOpacity, item, styler } = this.properties; + let stylerResult = {}; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + const markerOpts = { + item: { low: { marker: { enabled: false } }, high: { marker: { enabled: false } } } + }; + const makeItemResult = (lowOrHigh) => { + const stylerItem = stylerResult.item?.[lowOrHigh]; + const { lineDash, lineDashOffset, marker, stroke: stroke22, strokeOpacity, strokeWidth } = item[lowOrHigh]; + markerOpts.item[lowOrHigh].marker.enabled = stylerItem?.marker?.enabled ?? marker.enabled; + return { + marker: { + fill: stylerItem?.marker?.fill ?? marker.fill ?? fill, + fillOpacity: stylerItem?.marker?.fillOpacity ?? marker.fillOpacity, + shape: stylerItem?.marker?.shape ?? marker.shape, + size: stylerItem?.marker?.size ?? marker.size, + lineDash: stylerItem?.marker?.lineDash ?? marker.lineDash, + lineDashOffset: stylerItem?.marker?.lineDashOffset ?? marker.lineDashOffset, + stroke: stylerItem?.marker?.stroke ?? marker.stroke ?? stroke22, + strokeOpacity: stylerItem?.marker?.strokeOpacity ?? marker.strokeOpacity, + strokeWidth: stylerItem?.marker?.strokeWidth ?? marker.strokeWidth + }, + lineDash: stylerItem?.lineDash ?? lineDash, + lineDashOffset: stylerItem?.lineDashOffset ?? lineDashOffset, + stroke: stylerItem?.stroke ?? stroke22, + strokeOpacity: stylerItem?.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerItem?.strokeWidth ?? strokeWidth + }; + }; + const style2 = { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + opacity: 1, + topLevel: { + lineDash: this.properties.lineDash, + lineDashOffset: this.properties.lineDashOffset, + marker: this.properties.marker, + stroke: this.properties.stroke, + strokeOpacity: this.properties.strokeOpacity, + strokeWidth: this.properties.strokeWidth + }, + item: { + low: makeItemResult("low"), + high: makeItemResult("high") + } + }; + return [style2, markerOpts]; + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { fill, fillOpacity, item, xKey, yHighKey, yLowKey } = this.properties; + const highlightState = toHighlightString22(highlightStateEnum ?? HighlightState22.None); + const makeItemParam = (lowOrHigh) => { + const { lineDash, lineDashOffset, marker, stroke: stroke22, strokeOpacity, strokeWidth } = item[lowOrHigh]; + return { + marker: { + fill: marker.fill ?? fill, + fillOpacity: marker.fillOpacity, + size: marker.size, + shape: marker.shape, + stroke: marker.stroke ?? stroke22, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }, + lineDash, + lineDashOffset, + stroke: stroke22, + strokeOpacity, + strokeWidth + }; + }; + return { + item: { + low: makeItemParam("low"), + high: makeItemParam("high") + }, + fill, + fillOpacity, + highlightState, + highlighted, + seriesId, + xKey, + yLowKey, + yHighKey + }; + } + makeItemStylerParams(itemId) { + const { xKey, yLowKey, yHighKey } = this.properties; + return { xKey, yLowKey, yHighKey, itemId }; + } + getTooltipContent(datumIndex, removeThisDatum) { + const itemId = removeThisDatum?.itemId ?? "high"; + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { xName, yName, yLowKey, yLowName, xKey, yHighKey, yHighName, tooltip, legendItemName } = properties; + const xAxis = axes[ChartAxisDirection16.X]; + const yAxis = axes[ChartAxisDirection16.Y]; + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yHighValue = dataModel.resolveColumnById(this, `yHighValue`, processedData)[datumIndex]; + const yLowValue = dataModel.resolveColumnById(this, `yLowValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(itemId); + const format = this.getMarkerStyle( + this.properties.item[itemId].marker, + { datumIndex, datum }, + params, + { isHighlight: false, resolveMarkerSubPath: ["item", itemId, "marker"] }, + stylerStyle.item[itemId].marker + ); + const value = `${this.getAxisValueText(yAxis, "tooltip", yLowValue, datum, yLowKey, legendItemName)} - ${this.getAxisValueText(yAxis, "tooltip", yHighValue, datum, yHighKey, legendItemName)}`; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [{ label: yName, fallbackLabel: `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`, value }] + }, + { + seriesId, + datum, + title: yName, + itemId, + xName, + yName, + yLowKey, + yLowName, + xKey, + yHighKey, + yHighName, + legendItemName, + ...format + } + ); + } + legendItemSymbol() { + const { fill, topLevel } = this.getStyle(false); + const { stroke: stroke22, strokeWidth, strokeOpacity, lineDash, marker } = topLevel; + const markerStyle = { + shape: marker.shape, + fill: marker.fill ?? fill, + stroke: marker.stroke ?? stroke22, + fillOpacity: marker.fillOpacity, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }; + return { + marker: markerStyle, + line: { + stroke: stroke22, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { yLowKey, yHighKey, yName, yLowName, yHighName, legendItemName, showInLegend } = this.properties; + const legendItemText = legendItemName ?? yName ?? `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`; + const itemId = `${yLowKey}-${yHighKey}`; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible, + label: { text: `${legendItemText}` }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + isLabelEnabled() { + return this.properties.label.enabled; + } + onDataChange() { + } + nodeFactory() { + return new Marker2(); + } + animateEmptyUpdateReady(animationData) { + const { datumSelection, labelSelection, contextData, paths } = animationData; + const { animationManager } = this.ctx; + this.updateAreaPaths(paths, contextData); + pathSwipeInAnimation2(this, animationManager, ...paths); + resetMotion2([datumSelection], resetMarkerPositionFn2); + markerSwipeScaleInAnimation2(this, animationManager, datumSelection); + seriesLabelFadeInAnimation2(this, "labels", animationManager, labelSelection); + } + animateReadyResize(animationData) { + const { contextData, paths } = animationData; + this.updateAreaPaths(paths, contextData); + super.animateReadyResize(animationData); + } + animateWaitingUpdateReady(animationData) { + const { animationManager } = this.ctx; + const { datumSelection, labelSelection, contextData, paths, previousContextData } = animationData; + const [fill, lowStroke, highStroke] = paths; + if (fill == null && lowStroke == null && highStroke == null) + return; + this.resetDatumAnimation(animationData); + this.resetLabelAnimation(animationData); + const update = () => { + this.resetPathAnimation(animationData); + this.updateAreaPaths(paths, contextData); + }; + const skip = () => { + animationManager.skipCurrentBatch(); + update(); + }; + if (contextData == null || previousContextData == null) { + update(); + markerFadeInAnimation2(this, animationManager, "added", datumSelection); + pathFadeInAnimation2(this, "fill_path_properties", animationManager, "add", fill); + pathFadeInAnimation2(this, "low_stroke_path_properties", animationManager, "add", lowStroke); + pathFadeInAnimation2(this, "high_stroke_path_properties", animationManager, "add", highStroke); + seriesLabelFadeInAnimation2(this, "labels", animationManager, labelSelection); + return; + } + const fns = prepareRangeAreaPathAnimation( + contextData, + previousContextData, + this.processedData?.reduced?.diff?.[this.id] + ); + if (fns === void 0) { + skip(); + return; + } else if (fns.status === "no-op") { + return; + } + fromToMotion2(this.id, "fill_path_properties", animationManager, [fill], fns.fill.pathProperties); + fromToMotion2(this.id, "low_stroke_path_properties", animationManager, [lowStroke], fns.stroke.pathProperties); + fromToMotion2(this.id, "high_stroke_path_properties", animationManager, [highStroke], fns.stroke.pathProperties); + if (fns.status === "added") { + this.updateAreaPaths(paths, contextData); + } else if (fns.status === "removed") { + this.updateAreaPaths(paths, previousContextData); + } else { + pathMotion2(this.id, "fill_path_update", animationManager, [fill], fns.fill.path); + pathMotion2(this.id, "low_stroke_path_update", animationManager, [lowStroke], fns.stroke.path); + pathMotion2(this.id, "high_stroke_path_update", animationManager, [highStroke], fns.stroke.path); + } + if (fns.hasMotion) { + markerFadeInAnimation2(this, animationManager, void 0, datumSelection); + seriesLabelFadeInAnimation2(this, "labels", animationManager, labelSelection); + } + this.ctx.animationManager.animate({ + id: this.id, + groupId: "reset_after_animation", + phase: "trailing", + from: {}, + to: {}, + onComplete: () => this.updateAreaPaths(paths, contextData) + }); + } + getFormattedMarkerStyle(datum) { + const stylerStyle = this.getStyle(false); + const params = this.makeItemStylerParams(datum.itemId); + return this.getMarkerStyle( + this.properties.item[datum.itemId].marker, + datum, + params, + { isHighlight: true, resolveMarkerSubPath: ["item", datum.itemId, "marker"] }, + void 0, + stylerStyle + ); + } + getMarkerStyle(marker, datum, params, opts, defaultOverrideStyle, inheritedStyle) { + true; + marker.itemStyler = this.properties.marker.itemStyler; + return super.getMarkerStyle(marker, datum, params, opts, defaultOverrideStyle, inheritedStyle); + } + computeFocusBounds(opts) { + const hiBox = computeMarkerFocusBounds2(this, opts); + const loBox = computeMarkerFocusBounds2(this, { ...opts, datumIndex: opts.datumIndex + 1 }); + if (hiBox && loBox) { + return BBox13.merge([hiBox, loBox]); + } + return void 0; + } + isDatumEnabled(nodeData, datumIndex) { + return datumIndex % 2 === 0 && super.isDatumEnabled(nodeData, datumIndex); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RangeAreaSeries.className = "RangeAreaSeries"; +RangeAreaSeries.type = "range-area"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs5, rangeAreaSeriesThemeableOptionsDef: rangeAreaSeriesThemeableOptionsDef2 } = module_support_exports; +var rangeAreaSeriesOptionsDef = { + ...commonSeriesOptionsDefs5, + ...rangeAreaSeriesThemeableOptionsDef2, + type: required(constant("range-area")), + xKey: required(string), + yLowKey: required(string), + yHighKey: required(string), + xName: string, + yName: string, + yLowName: string, + yHighName: string, + legendItemName: string, + segmentation: shapeSegmentation, + invertedStyle: { + enabled: boolean, + ...fillOptionsDef + } +}; +rangeAreaSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented(boolean); +rangeAreaSeriesOptionsDef.focusPriority = undocumented(number); +var RANGE_AREA_ITEM = { + lineDash: { + $path: "/series/$index/lineDash" + }, + lineDashOffset: { + $path: "/series/$index/lineDashOffset" + }, + stroke: { + $path: ["/series/$index/stroke", { $palette: "stroke" }] + }, + strokeOpacity: { + $path: "/series/$index/strokeOpacity" + }, + strokeWidth: { + $path: ["/series/$index/strokeWidth", 1] + }, + marker: { + enabled: { + $path: "/series/$index/marker/enabled" + }, + fill: { + $isUserOption: [ + "/series/$index/marker/fill", + { + $if: [ + { + $or: [ + { $isGradient: { $path: "/series/$index/marker/fill" } }, + { $isImage: { $path: "/series/$index/marker/fill" } }, + { $isPattern: { $path: "/series/$index/marker/fill" } } + ] + }, + { + $merge: [ + { $path: "/series/$index/marker/fill" }, + { + $applySwitch: [ + { $path: "type" }, + void 0, + // default case shouldn't be hit because of $if + ["gradient", module_support_exports.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS] + ] + } + ] + }, + { + $isUserOption: [ + "/series/$index/marker/fill", + { $path: "/series/$index/marker/fill" }, + { $palette: "fill" } + ] + } + ] + }, + { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", module_support_exports.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS] + ] + } + ] + }, + fillOpacity: { + $path: "/series/$index/marker/fillOpacity" + }, + lineDash: { + $path: "/series/$index/marker/lineDash" + }, + lineDashOffset: { + $path: "/series/$index/marker/lineDashOffset" + }, + shape: { + $path: "/series/$index/marker/shape" + }, + size: { + $path: ["/series/$index/marker/size", 6] + }, + stroke: { + $path: ["/series/$index/marker/stroke", { $palette: "stroke" }] + }, + strokeOpacity: { + $path: "/series/$index/marker/strokeOpacity" + }, + strokeWidth: { + $path: ["/series/$index/marker/strokeWidth", 2] + } + } +}; +var RANGE_AREA_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", module_support_exports.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: 0.7, + stroke: { $palette: "stroke" }, + strokeWidth: 1, + marker: { + enabled: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", module_support_exports.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS] + ] + }, + shape: "circle", + stroke: { $palette: "stroke" }, + size: 6, + strokeWidth: 2 + }, + nodeClickRange: "nearest", + item: { + low: RANGE_AREA_ITEM, + high: RANGE_AREA_ITEM + }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: false, + placement: "outside", + padding: { $isUserOption: ["./spacing", 0, 10] }, + // compatibility with old `padding` property (now named `spacing`). + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + interpolation: { + type: "linear" + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: module_support_exports.multiSeriesHighlightStyle(), + segmentation: module_support_exports.SEGMENTATION_DEFAULTS, + invertedStyle: { + enabled: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + // @todo(AG-14792) should be { $path: '../fill' } to inherit from series.fill + ["gradient", module_support_exports.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: { $path: "../fillOpacity" } + } + }, + axes: { + [module_support_exports.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { enabled: true } + } + } +}; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE6, CARTESIAN_POSITION: CARTESIAN_POSITION4 } +} = module_support_exports; +var RangeAreaModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "range-area", + moduleFactory: (ctx) => new RangeAreaSeries(ctx), + predictAxis: module_support_exports.predictCartesianTimeAxis, + defaultAxes: [ + { type: CARTESIAN_AXIS_TYPE6.NUMBER, position: CARTESIAN_POSITION4.LEFT }, + { type: CARTESIAN_AXIS_TYPE6.CATEGORY, position: CARTESIAN_POSITION4.BOTTOM } + ], + themeTemplate: RANGE_AREA_SERIES_THEME +}; +var RangeAreaSeriesModule = { + type: "series", + name: "range-area", + chartType: "cartesian", + enterprise: true, + options: rangeAreaSeriesOptionsDef, + create: (ctx) => new RangeAreaSeries(ctx) +}; +var { aggregationDomain: aggregationDomain3, aggregationRangeFittingPoints: aggregationRangeFittingPoints3, compactAggregationIndices: compactAggregationIndices3, createAggregationIndices: createAggregationIndices3 } = module_support_exports; +var AGGREGATION_THRESHOLD32 = 1e3; +function aggregateRangeBarData(scale2, xValues, highValues, lowValues, domain, smallestKeyInterval) { + if (xValues.length < AGGREGATION_THRESHOLD32) + return; + const [d0, d1] = aggregationDomain3(scale2, domain); + let maxRange = aggregationRangeFittingPoints3(xValues, d0, d1, { smallestKeyInterval }); + let { indexData, valueData } = createAggregationIndices3(xValues, highValues, lowValues, d0, d1, maxRange); + const filters = [{ maxRange, indexData }]; + while (maxRange > 64) { + ({ indexData, valueData, maxRange } = compactAggregationIndices3(indexData, valueData, maxRange)); + filters.push({ maxRange, indexData }); + } + filters.reverse(); + return filters; +} +var { AbstractBarSeriesProperties: AbstractBarSeriesProperties3, makeSeriesTooltip: makeSeriesTooltip6, Property: Property54, DropShadow: DropShadow22, Label: Label32 } = module_support_exports; +var RangeBarSeriesLabel = class extends Label32 { + constructor() { + super(...arguments); + this.placement = "inside"; + this.spacing = 0; + } +}; +__decorateClass2([ + Property54 +], RangeBarSeriesLabel.prototype, "placement", 2); +__decorateClass2([ + Property54 +], RangeBarSeriesLabel.prototype, "spacing", 2); +var RangeBarProperties = class extends AbstractBarSeriesProperties3 { + constructor() { + super(...arguments); + this.fill = "#99CCFF"; + this.fillOpacity = 1; + this.stroke = "#99CCFF"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.shadow = new DropShadow22().set({ enabled: false }); + this.label = new RangeBarSeriesLabel(); + this.tooltip = makeSeriesTooltip6(); + } +}; +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "xKey", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "yLowKey", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "yHighKey", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "xName", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "yName", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "yLowName", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "yHighName", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "fill", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "stroke", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "cornerRadius", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "styler", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "shadow", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "label", 2); +__decorateClass2([ + Property54 +], RangeBarProperties.prototype, "tooltip", 2); +var { + SeriesNodePickMode: SeriesNodePickMode4, + valueProperty: valueProperty7, + keyProperty: keyProperty5, + ChartAxisDirection: ChartAxisDirection17, + checkCrisp: checkCrisp2, + updateLabelNode: updateLabelNode3, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL3, + LARGEST_KEY_INTERVAL: LARGEST_KEY_INTERVAL2, + diff: diff4, + prepareBarAnimationFunctions: prepareBarAnimationFunctions2, + midpointStartingBarPosition: midpointStartingBarPosition2, + resetBarSelectionsFn: resetBarSelectionsFn2, + fixNumericExtent: fixNumericExtent5, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation22, + resetLabelFn: resetLabelFn22, + animationValidation: animationValidation4, + computeBarFocusBounds: computeBarFocusBounds4, + visibleRangeIndices: visibleRangeIndices22, + createDatumId: createDatumId4, + ContinuousScale: ContinuousScale5, + Rect: Rect22, + PointerEvents: PointerEvents3, + motion: motion22, + applyShapeStyle: applyShapeStyle5, + findMinMax: findMinMax3, + areScalingEqual: areScalingEqual22, + processedDataIsAnimatable: processedDataIsAnimatable3, + AGGREGATION_SPAN: AGGREGATION_SPAN22, + AGGREGATION_INDEX_X_MAX: AGGREGATION_INDEX_X_MAX22, + AGGREGATION_INDEX_X_MIN: AGGREGATION_INDEX_X_MIN22, + AGGREGATION_INDEX_Y_MAX: AGGREGATION_INDEX_Y_MAX3, + AGGREGATION_INDEX_Y_MIN: AGGREGATION_INDEX_Y_MIN3, + mergeDefaults: mergeDefaults8, + simpleMemorize2: simpleMemorize23, + getItemStyles: getItemStyles22, + calculateSegments: calculateSegments3, + toHighlightString: toHighlightString3, + HighlightState: HighlightState32 +} = module_support_exports; +var memoizedAggregateRangeBarData = simpleMemorize23(aggregateRangeBarData); +var RangeBarSeriesNodeEvent = class extends module_support_exports.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.xKey; + this.yLowKey = series.properties.yLowKey; + this.yHighKey = series.properties.yHighKey; + } +}; +var RangeBarSeries = class extends module_support_exports.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode4.AXIS_ALIGNED, SeriesNodePickMode4.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["xKey"], + y: ["yLowKey", "yHighKey"] + }, + propertyNames: { + x: ["xName"], + y: ["yLowName", "yHighName", "yName"] + }, + categoryKey: "xValue", + datumSelectionGarbageCollection: false, + animationResetFns: { + datum: resetBarSelectionsFn2, + label: resetLabelFn22 + } + }); + this.properties = new RangeBarProperties(); + this.dataAggregationFilters = void 0; + this.NodeEvent = RangeBarSeriesNodeEvent; + } + async processData(dataController) { + const { xKey, yLowKey, yHighKey } = this.properties; + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + if (this.processedData) { + extraProps.push(diff4(this.id, this.processedData)); + } + extraProps.push(animationValidation4()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const { dataModel, processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty5(xKey, xScaleType, { id: "xValue" }), + valueProperty7(yLowKey, yScaleType, { id: `yLowValue`, invalidValue: null, ...visibleProps }), + valueProperty7(yHighKey, yScaleType, { id: `yHighValue`, invalidValue: null, ...visibleProps }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL3, LARGEST_KEY_INTERVAL2] : [], + ...extraProps + ], + groupByKeys: false + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.dataAggregationFilters = this.aggregateData(dataModel, processedData); + this.animationState.transition("updateData"); + } + aggregateData(dataModel, processedData) { + if (processedData.type !== "ungrouped") + return; + if (processedDataIsAnimatable3(processedData)) + return; + const xAxis = this.axes[ChartAxisDirection17.X]; + if (xAxis == null) + return; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const { index } = dataModel.resolveProcessedDataDefById(this, `xValue`); + const domain = processedData.domain.keys[index]; + return memoizedAggregateRangeBarData( + xAxis.scale.type, + xValues, + yHighValues, + yLowValues, + domain, + processedData.reduced?.smallestKeyInterval + ); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys] + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + return keys; + } + return this.padBandExtent(keys); + } else { + const yExtent = this.domainForClippedRange(direction, ["yHighValue", "yLowValue"], "xValue"); + const fixedYExtent = findMinMax3(yExtent); + return fixNumericExtent5(fixedYExtent); + } + } + getSeriesRange(_direction, visibleRange) { + return this.domainForVisibleRange(ChartAxisDirection17.Y, ["yHighValue", "yLowValue"], "xValue", visibleRange); + } + createNodeData() { + const { data, dataModel, groupScale, processedData, visible } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(data && xAxis && yAxis && dataModel && processedData?.dataSources && this.chart?.seriesRect)) + return; + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection17.X; + const { xKey, yLowKey, yHighKey, strokeWidth } = this.properties; + const itemId = `${yLowKey}-${yHighKey}`; + const segments = calculateSegments3( + this.properties.segmentation, + xAxis, + yAxis, + this.chart.seriesRect, + this.ctx.scene + ); + const context = { + itemId, + nodeData: [], + labelData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStyles22(this.getItemStyle.bind(this)), + segments + }; + if (!visible) + return context; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yLowValues = dataModel.resolveColumnById(this, `yLowValue`, processedData); + const yHighValues = dataModel.resolveColumnById(this, `yHighValue`, processedData); + const { barWidth: effectiveBarWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale5.is(xScale) ? effectiveBarWidth * -0.5 : 0; + const groupOffset = groupScale.convert(String(groupIndex)); + const defaultCrisp = checkCrisp2( + xAxis?.scale, + xAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + const xPosition = (datumIndex) => Math.round(xScale.convert(xValues[datumIndex])) + groupOffset + barOffset; + const handleDatum = (datumIndex, groupedDataIndex, x, width2, yLow, yHigh, crisp) => { + const datum = rawData[datumIndex]; + const xDatum = xValues[datumIndex]; + if (xDatum == null) + return; + const rawLowValue = yLowValues[datumIndex]; + const rawHighValue = yHighValues[datumIndex]; + if (!Number.isFinite(rawLowValue?.valueOf()) || !Number.isFinite(rawHighValue?.valueOf())) + return; + const [yLowValue, yHighValue] = rawLowValue < rawHighValue ? [rawLowValue, rawHighValue] : [rawHighValue, rawLowValue]; + const y = Math.round(yScale.convert(yHigh)); + const bottomY = Math.round(yScale.convert(yLow)); + const height2 = Math.max(strokeWidth, Math.abs(bottomY - y)); + const rect2 = { + x: barAlongX ? Math.min(y, bottomY) : x, + y: barAlongX ? x : Math.min(y, bottomY), + width: barAlongX ? height2 : width2, + height: barAlongX ? width2 : height2 + }; + const nodeMidPoint = { + x: rect2.x + rect2.width / 2, + y: rect2.y + rect2.height / 2 + }; + const labelData = this.createLabelData({ + datumIndex, + rect: rect2, + barAlongX, + yLowValue, + yHighValue, + datum, + series: this + }); + const nodeDatum = { + index: groupedDataIndex, + series: this, + itemId, + datum, + datumIndex, + xValue: xDatum, + yLowValue: rawLowValue, + yHighValue: rawHighValue, + yLowKey, + yHighKey, + xKey, + x: rect2.x, + y: rect2.y, + width: rect2.width, + height: rect2.height, + midPoint: nodeMidPoint, + crisp, + labels: labelData + }; + context.nodeData.push(nodeDatum); + context.labelData.push(...labelData); + }; + const { dataAggregationFilters } = this; + const [r0, r1] = xScale.range; + const range22 = Math.abs(r1 - r0); + const dataAggregationFilter = dataAggregationFilters?.find((f) => f.maxRange > range22); + if (dataAggregationFilter != null) { + const { maxRange, indexData } = dataAggregationFilter; + const [start2, end3] = visibleRangeIndices22(1, maxRange, xAxis.range, (index) => { + const aggIndex = index * AGGREGATION_SPAN22; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN22]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX22]; + if (xMinIndex === -1) + return; + const midDatumIndex = Math.trunc((xMinIndex + xMaxIndex) / 2); + return [xPosition(midDatumIndex), xPosition(xMaxIndex) + effectiveBarWidth]; + }); + for (let i = start2; i < end3; i += 1) { + const aggIndex = i * AGGREGATION_SPAN22; + const xMinIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MIN22]; + const xMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_X_MAX22]; + const yMinIndex = indexData[aggIndex + AGGREGATION_INDEX_Y_MIN3]; + const yMaxIndex = indexData[aggIndex + AGGREGATION_INDEX_Y_MAX3]; + if (xMinIndex === -1) + continue; + const midDatumIndex = Math.trunc((xMinIndex + xMaxIndex) / 2); + const xValue2 = xValues[midDatumIndex]; + if (xValue2 == null) + continue; + const x = xPosition(midDatumIndex); + const width2 = Math.abs(xPosition(xMinIndex) - xPosition(xMaxIndex)) + effectiveBarWidth; + const yLow = yLowValues[yMinIndex]; + const yHigh = yHighValues[yMaxIndex]; + handleDatum(midDatumIndex, 0, x, width2, yLow, yHigh, false); + } + } else if (processedData.type === "ungrouped") { + const invalidData = processedData.invalidData?.get(this.id); + let [start2, end3] = this.visibleRangeIndices("xValue", xAxis.range); + if (processedData.input.count < 1e3) { + start2 = 0; + end3 = processedData.input.count; + } + for (let datumIndex = start2; datumIndex < end3; datumIndex += 1) { + if (invalidData?.[datumIndex] === true) + continue; + const x = xPosition(datumIndex); + const width2 = effectiveBarWidth; + const yLow = yLowValues[datumIndex]; + const yHigh = yHighValues[datumIndex]; + handleDatum(datumIndex, 0, x, width2, yLow, yHigh, defaultCrisp); + } + } else { + for (const { datumIndex, groupIndex: groupDataIndex } of dataModel.forEachGroupDatum(this, processedData)) { + const x = xPosition(datumIndex); + const width2 = effectiveBarWidth; + const yLow = yLowValues[datumIndex]; + const yHigh = yHighValues[datumIndex]; + handleDatum(datumIndex, groupDataIndex, x, width2, yLow, yHigh, defaultCrisp); + } + } + return context; + } + createLabelData({ + datumIndex, + rect: rect2, + barAlongX, + yLowValue, + yHighValue, + datum, + series + }) { + const { xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName, label } = this.properties; + const labelParams = { datum, xKey, yLowKey, yHighKey, xName, yLowName, yHighName, yName, legendItemName }; + const { placement } = label; + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + const paddingDirection = placement === "outside" ? 1 : -1; + const labelPadding = spacing * paddingDirection; + const yDomain = this.getSeriesDomain(ChartAxisDirection17.Y); + const yLowLabel = { + datumIndex, + x: rect2.x + (barAlongX ? -labelPadding : rect2.width / 2), + y: rect2.y + (barAlongX ? rect2.height / 2 : rect2.height + labelPadding), + textAlign: barAlongX ? "left" : "center", + textBaseline: barAlongX ? "middle" : "bottom", + text: this.getLabelText( + yLowValue, + datum, + yLowKey, + "y", + yDomain, + label, + { itemId: "low", value: yLowValue, ...labelParams } + ), + itemId: "low", + datum, + series + }; + const yHighLabel = { + datumIndex, + x: rect2.x + (barAlongX ? rect2.width + labelPadding : rect2.width / 2), + y: rect2.y + (barAlongX ? rect2.height / 2 : -labelPadding), + textAlign: barAlongX ? "right" : "center", + textBaseline: barAlongX ? "middle" : "top", + text: this.getLabelText( + yHighValue, + datum, + yHighKey, + "y", + yDomain, + label, + { itemId: "high", value: yHighValue, ...labelParams } + ), + itemId: "high", + datum, + series + }; + if (placement === "outside") { + yLowLabel.textAlign = barAlongX ? "right" : "center"; + yLowLabel.textBaseline = barAlongX ? "middle" : "top"; + yHighLabel.textAlign = barAlongX ? "left" : "center"; + yHighLabel.textBaseline = barAlongX ? "middle" : "bottom"; + } + return [yLowLabel, yHighLabel]; + } + nodeFactory() { + return new Rect22(); + } + getStyle(ignoreStylerCallback, highlighted, highlightState) { + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke22, + strokeOpacity, + strokeWidth, + styler + } = this.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + stylerResult = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? cornerRadius, + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + opacity: 1, + stroke: stylerResult.stroke ?? stroke22, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth + }; + } + makeStylerParams(highlighted, highlightStateEnum) { + const { id: seriesId } = this; + const { + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + stroke: stroke22, + strokeOpacity, + strokeWidth, + xKey, + yLowKey, + yHighKey + } = this.properties; + const highlightState = toHighlightString3(highlightStateEnum ?? HighlightState32.None); + return { + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + seriesId, + stroke: stroke22, + strokeOpacity, + strokeWidth, + xKey, + yLowKey, + yHighKey + }; + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data, void 0, (datum) => this.getDatumId(datum)); + } + getItemStyle(datumIndex, isHighlight, highlightState) { + const { properties, dataModel, processedData } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + let style2 = mergeDefaults8(highlightStyle, this.getStyle(datumIndex === void 0, isHighlight, highlightState)); + if (itemStyler && dataModel != null && processedData != null && datumIndex != null) { + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const overrides = this.cachedDatumCallback( + createDatumId4(this.getDatumId({ xValue: xValue2 }), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datumIndex, isHighlight, style2); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style2 = mergeDefaults8(overrides, style2); + } + } + return style2; + } + makeItemStylerParams(datumIndex, isHighlight, style2) { + const { id: seriesId, properties, processedData } = this; + const { xKey, yHighKey, yLowKey } = properties; + const datum = processedData.dataSources.get(seriesId)?.data[datumIndex]; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum, + xKey, + yHighKey, + yLowKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style2, + fill + }; + } + updateDatumStyles(opts) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + opts.datumSelection.each((node, datum) => { + if (!opts.datumSelection.isGarbage(node)) { + const highlightState = this.getHighlightState(highlightedDatum, opts.isHighlight, datum.datumIndex); + datum.style = this.getItemStyle(datum.datumIndex, opts.isHighlight, highlightState); + } + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection17.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect2, datum) => { + const style2 = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle5(rect2, style2, fillBBox); + rect2.cornerRadius = style2.cornerRadius ?? 0; + rect2.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect2.crisp = datum.crisp; + }); + } + updateLabelSelection(opts) { + const labelData = this.properties.label.enabled ? opts.labelData : []; + return opts.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = PointerEvents3.None; + }); + } + updateLabelNodes(opts) { + const params = { + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xKey, + yName: this.properties.yName, + yLowKey: this.properties.yLowKey, + yLowName: this.properties.yLowName ?? this.properties.yLowKey, + yHighKey: this.properties.yHighKey, + yHighName: this.properties.yHighName ?? this.properties.yHighKey, + legendItemName: this.properties.legendItemName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum?.datumIndex).opacity ?? 1; + updateLabelNode3(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yName, yLowKey, yHighKey, yLowName, yHighName, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yHighValue = dataModel.resolveColumnById(this, `yHighValue`, processedData)[datumIndex]; + const yLowValue = dataModel.resolveColumnById(this, `yLowValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const format = this.getItemStyle(datumIndex, false); + const value = `${this.getAxisValueText(yAxis, "tooltip", yLowValue, datum, yLowKey, legendItemName)} - ${this.getAxisValueText(yAxis, "tooltip", yHighValue, datum, yHighKey, legendItemName)}`; + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(), + data: [{ label: yName, fallbackLabel: `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`, value }] + }, + { + seriesId, + datum, + title: yName, + xKey, + xName, + yName, + yLowKey, + yHighKey, + yLowName, + yHighName, + legendItemName, + ...format + } + ); + } + legendItemSymbol() { + const { fill, stroke: stroke22, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.getStyle( + false, + false, + HighlightState32.None + ); + return { + marker: { + fill, + stroke: stroke22, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { yName, yLowName, yHighName, yLowKey, yHighKey, legendItemName, showInLegend } = this.properties; + const legendItemText = legendItemName ?? yName ?? `${yLowName ?? yLowKey} - ${yHighName ?? yHighKey}`; + const itemId = `${yLowKey}-${yHighKey}`; + return [ + { + legendType: "category", + id: seriesId, + itemId, + seriesId, + enabled: visible, + label: { text: `${legendItemText}` }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + animateEmptyUpdateReady({ datumSelection, labelSelection }) { + const fns = prepareBarAnimationFunctions2(midpointStartingBarPosition2(this.isVertical(), "normal"), "unknown"); + motion22.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation22(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const { datumSelection: datumSelections, labelSelection, contextData, previousContextData } = data; + const dataDiff = module_support_exports.calculateDataDiff( + this.id, + datumSelections, + this.getDatumId.bind(this), + contextData, + previousContextData, + this.processedData, + this.processedDataUpdated + ); + this.ctx.animationManager.stopByAnimationGroupId(this.id); + const mode = previousContextData == null ? "fade" : "normal"; + const fns = prepareBarAnimationFunctions2(midpointStartingBarPosition2(this.isVertical(), mode), "added"); + motion22.fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [datumSelections], + fns, + (_, datum) => this.getDatumId(datum), + dataDiff + ); + if (dataDiff?.changed || !areScalingEqual22(contextData.groupScale, previousContextData?.groupScale)) { + seriesLabelFadeInAnimation22(this, "labels", this.ctx.animationManager, labelSelection); + } + } + getDatumId(datum) { + return `${datum.xValue}`; + } + isLabelEnabled() { + return this.properties.label.enabled; + } + onDataChange() { + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds4(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RangeBarSeries.className = "RangeBarSeries"; +RangeBarSeries.type = "range-bar"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs6, rangeBarSeriesThemeableOptionsDef: rangeBarSeriesThemeableOptionsDef2 } = module_support_exports; +var rangeBarSeriesOptionsDef = { + ...commonSeriesOptionsDefs6, + ...rangeBarSeriesThemeableOptionsDef2, + type: required(constant("range-bar")), + xKey: required(string), + yLowKey: required(string), + yHighKey: required(string), + xName: string, + yName: string, + yLowName: string, + yHighName: string, + legendItemName: string, + segmentation: shapeSegmentation +}; +rangeBarSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented(boolean); +rangeBarSeriesOptionsDef.focusPriority = undocumented(number); +var RANGE_BAR_SERIES_THEME = { + series: { + direction: "vertical", + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", module_support_exports.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + placement: "inside", + padding: { $isUserOption: ["./spacing", 0, 6] } + // compatibility with old `padding` property (now named `spacing`). + }, + highlight: module_support_exports.multiSeriesHighlightStyle(), + segmentation: module_support_exports.SEGMENTATION_DEFAULTS + }, + axes: { + [module_support_exports.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]: { + crosshair: { enabled: true } + } + } +}; +var RangeBarModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "range-bar", + moduleFactory: (ctx) => new RangeBarSeries(ctx), + predictAxis: module_support_exports.predictCartesianTimeAxis, + defaultAxes: module_support_exports.DIRECTION_SWAP_AXES, + themeTemplate: RANGE_BAR_SERIES_THEME, + groupable: true +}; +var RangeBarSeriesModule = { + type: "series", + name: "range-bar", + chartType: "cartesian", + enterprise: true, + options: rangeBarSeriesOptionsDef, + create: (ctx) => new RangeBarSeries(ctx) +}; +var { AbstractBarSeriesProperties: AbstractBarSeriesProperties4, BaseProperties: BaseProperties19, PropertiesArray: PropertiesArray4, makeSeriesTooltip: makeSeriesTooltip7, Property: Property55, DropShadow: DropShadow3, Label: Label4 } = module_support_exports; +var WaterfallSeriesTotal = class extends BaseProperties19 { +}; +__decorateClass2([ + Property55 +], WaterfallSeriesTotal.prototype, "totalType", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesTotal.prototype, "index", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesTotal.prototype, "axisLabel", 2); +var WaterfallSeriesItemTooltip = class extends BaseProperties19 { +}; +__decorateClass2([ + Property55 +], WaterfallSeriesItemTooltip.prototype, "renderer", 2); +var WaterfallSeriesLabel = class extends Label4 { + constructor() { + super(...arguments); + this.placement = "outside-end"; + this.spacing = 0; + } +}; +__decorateClass2([ + Property55 +], WaterfallSeriesLabel.prototype, "placement", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesLabel.prototype, "spacing", 2); +var WaterfallSeriesItem = class extends BaseProperties19 { + constructor() { + super(...arguments); + this.fill = "#c16068"; + this.stroke = "#c16068"; + this.fillOpacity = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.strokeWidth = 1; + this.cornerRadius = 0; + this.shadow = new DropShadow3().set({ enabled: false }); + this.label = new WaterfallSeriesLabel(); + this.tooltip = new WaterfallSeriesItemTooltip(); + } +}; +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "name", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "fill", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "stroke", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "fillOpacity", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "lineDash", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "strokeWidth", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "cornerRadius", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "itemStyler", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "shadow", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "label", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItem.prototype, "tooltip", 2); +var WaterfallSeriesConnectorLine = class extends BaseProperties19 { + constructor() { + super(...arguments); + this.enabled = true; + this.stroke = "black"; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.strokeWidth = 2; + } +}; +__decorateClass2([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "enabled", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "stroke", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "lineDash", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesConnectorLine.prototype, "strokeWidth", 2); +var WaterfallSeriesItems = class extends BaseProperties19 { + constructor() { + super(...arguments); + this.positive = new WaterfallSeriesItem(); + this.negative = new WaterfallSeriesItem(); + this.total = new WaterfallSeriesItem(); + } +}; +__decorateClass2([ + Property55 +], WaterfallSeriesItems.prototype, "positive", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItems.prototype, "negative", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesItems.prototype, "total", 2); +var WaterfallSeriesProperties = class extends AbstractBarSeriesProperties4 { + constructor() { + super(...arguments); + this.item = new WaterfallSeriesItems(); + this.totals = new PropertiesArray4(WaterfallSeriesTotal); + this.line = new WaterfallSeriesConnectorLine(); + this.tooltip = makeSeriesTooltip7(); + } + getStyle(itemId) { + const { fillOpacity, strokeWidth, strokeOpacity, fill, stroke: stroke22, lineDash, lineDashOffset, cornerRadius } = this.item[itemId === "subtotal" ? "total" : itemId]; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property55 +], WaterfallSeriesProperties.prototype, "xKey", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesProperties.prototype, "yKey", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesProperties.prototype, "xName", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesProperties.prototype, "yName", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesProperties.prototype, "item", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesProperties.prototype, "totals", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesProperties.prototype, "line", 2); +__decorateClass2([ + Property55 +], WaterfallSeriesProperties.prototype, "tooltip", 2); +var { + adjustLabelPlacement: adjustLabelPlacement2, + SeriesNodePickMode: SeriesNodePickMode5, + fixNumericExtent: fixNumericExtent6, + valueProperty: valueProperty8, + keyProperty: keyProperty6, + accumulativeValueProperty: accumulativeValueProperty2, + trailingAccumulatedValueProperty: trailingAccumulatedValueProperty2, + ChartAxisDirection: ChartAxisDirection18, + createDatumId: createDatumId5, + checkCrisp: checkCrisp22, + updateLabelNode: updateLabelNode4, + prepareBarAnimationFunctions: prepareBarAnimationFunctions22, + collapsedStartingBarPosition: collapsedStartingBarPosition2, + resetBarSelectionsFn: resetBarSelectionsFn22, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation3, + resetLabelFn: resetLabelFn3, + animationValidation: animationValidation5, + DEFAULT_CARTESIAN_DIRECTION_KEYS: DEFAULT_CARTESIAN_DIRECTION_KEYS22, + DEFAULT_CARTESIAN_DIRECTION_NAMES: DEFAULT_CARTESIAN_DIRECTION_NAMES22, + computeBarFocusBounds: computeBarFocusBounds5, + isContinuous: isContinuous2, + Rect: Rect3, + motion: motion3, + applyShapeStyle: applyShapeStyle6, + mergeDefaults: mergeDefaults9, + getItemStylesPerItemId: getItemStylesPerItemId22, + DataSet: DataSet2 +} = module_support_exports; +var WaterfallSeries = class extends module_support_exports.AbstractBarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + propertyKeys: DEFAULT_CARTESIAN_DIRECTION_KEYS22, + propertyNames: DEFAULT_CARTESIAN_DIRECTION_NAMES22, + categoryKey: void 0, + pickModes: [SeriesNodePickMode5.NEAREST_NODE, SeriesNodePickMode5.EXACT_SHAPE_MATCH], + pathsPerSeries: ["connector"], + pathsZIndexSubOrderOffset: [-1, -1], + animationResetFns: { + datum: resetBarSelectionsFn22, + label: resetLabelFn3 + } + }); + this.properties = new WaterfallSeriesProperties(); + this.seriesItemTypes = /* @__PURE__ */ new Set(["positive", "negative", "total"]); + } + async processData(dataController) { + const { xKey, yKey, totals } = this.properties; + const { data } = this; + if (!this.visible) + return; + const positiveNumber3 = (v) => isContinuous2(v) && Number(v) >= 0; + const negativeNumber = (v) => isContinuous2(v) && Number(v) >= 0; + const totalTypeValue = (v) => v === "total" || v === "subtotal"; + const propertyDefinition = { missingValue: void 0, invalidValue: void 0 }; + const dataWithTotals = []; + const totalsMap = totals.reduce((result, total) => { + const totalsAtIndex = result.get(total.index); + if (totalsAtIndex) { + totalsAtIndex.push(total); + } else { + result.set(total.index, [total]); + } + return result; + }, /* @__PURE__ */ new Map()); + for (const [i, datum] of data?.data.entries() ?? []) { + dataWithTotals.push(datum); + const totalsAtIndex = totalsMap.get(i); + if (totalsAtIndex) { + for (const total of totalsAtIndex) { + dataWithTotals.push({ ...total.toJson(), [xKey]: total.axisLabel }); + } + } + } + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + extraProps.push(animationValidation5()); + } + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const { processedData } = await this.requestDataModel( + dataController, + DataSet2.wrap(dataWithTotals), + { + props: [ + keyProperty6(xKey, xScaleType, { id: `xValue` }), + accumulativeValueProperty2(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrent` + }), + accumulativeValueProperty2(yKey, yScaleType, { + ...propertyDefinition, + missingValue: 0, + id: `yCurrentTotal` + }), + accumulativeValueProperty2(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrentPositive`, + validation: positiveNumber3 + }), + accumulativeValueProperty2(yKey, yScaleType, { + ...propertyDefinition, + id: `yCurrentNegative`, + validation: negativeNumber + }), + trailingAccumulatedValueProperty2(yKey, yScaleType, { + ...propertyDefinition, + id: `yPrevious` + }), + valueProperty8(yKey, yScaleType, { id: `yRaw` }), + // Raw value pass-through. + valueProperty8("totalType", "category", { + id: `totalTypeValue`, + missingValue: void 0, + validation: totalTypeValue + }), + ...isContinuousX ? [module_support_exports.SMALLEST_KEY_INTERVAL, module_support_exports.LARGEST_KEY_INTERVAL] : [], + ...extraProps + ] + } + ); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.updateSeriesItemTypes(); + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys], + values + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + return keys; + } + const isDirectionY = direction === ChartAxisDirection18.Y; + const isReversed = this.getCategoryAxis().isReversed(); + return this.padBandExtent(keys, isReversed !== isDirectionY); + } else { + const yCurrIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrent"); + const yExtent = values[yCurrIndex]; + const fixedYExtent = [Math.min(0, yExtent[0]), Math.max(0, yExtent[1])]; + return fixNumericExtent6(fixedYExtent); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { data, dataModel, processedData } = this; + const categoryAxis = this.getCategoryAxis(); + const valueAxis = this.getValueAxis(); + if (!data || !categoryAxis || !valueAxis || !dataModel || !processedData) { + return; + } + const { line } = this.properties; + const xScale = categoryAxis.scale; + const yScale = valueAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection18.X; + const barWidth = this.getBandwidth(categoryAxis) ?? 10; + const categoryAxisReversed = categoryAxis.isReversed(); + const valueAxisReversed = valueAxis.isReversed(); + if (processedData.type !== "ungrouped") + return; + const context = { + itemId: this.properties.yKey, + nodeData: [], + labelData: [], + pointData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible, + styles: getItemStylesPerItemId22(this.getItemStyle.bind(this), "total", "subtotal", "positive", "negative") + }; + if (!this.visible) + return context; + const pointData = []; + const xValues = dataModel.resolveKeysById(this, `xValue`, processedData); + const yRawValues = dataModel.resolveColumnById(this, `yRaw`, processedData); + const totalTypeValues = dataModel.resolveColumnById( + this, + `totalTypeValue`, + processedData + ); + const yCurrValues = dataModel.resolveColumnById(this, "yCurrent", processedData); + const yPrevValues = dataModel.resolveColumnById(this, "yPrevious", processedData); + const yCurrTotalValues = dataModel.resolveColumnById(this, "yCurrentTotal", processedData); + const yDomain = this.getSeriesDomain(ChartAxisDirection18.Y); + const crisp = checkCrisp22( + categoryAxis?.scale, + categoryAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + function getValues(isTotal, isSubtotal, datumIndex) { + if (isTotal || isSubtotal) { + return { + cumulativeValue: yCurrTotalValues[datumIndex], + trailingValue: isSubtotal ? trailingSubtotal : 0 + }; + } + return { + cumulativeValue: yCurrValues[datumIndex], + trailingValue: yPrevValues[datumIndex] + }; + } + function getValue(isTotal, isSubtotal, rawValue, cumulativeValue, trailingValue) { + if (isTotal) { + return cumulativeValue; + } + if (isSubtotal) { + return (cumulativeValue ?? 0) - (trailingValue ?? 0); + } + return rawValue; + } + let trailingSubtotal = 0; + const { xKey, yKey, xName, yName } = this.properties; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const datumType = totalTypeValues[datumIndex]; + const isSubtotal = this.isSubtotal(datumType); + const isTotal = this.isTotal(datumType); + const isTotalOrSubtotal = isTotal || isSubtotal; + const xDatum = xValues[datumIndex]; + if (xDatum == null) + continue; + const x = Math.round(xScale.convert(xDatum)); + const rawValue = yRawValues[datumIndex]; + const { cumulativeValue, trailingValue } = getValues(isTotal, isSubtotal, datumIndex); + if (isTotalOrSubtotal) { + trailingSubtotal = cumulativeValue ?? 0; + } + const currY = Math.round(yScale.convert(cumulativeValue)); + const trailY = Math.round(yScale.convert(trailingValue)); + const value = getValue(isTotal, isSubtotal, rawValue, cumulativeValue, trailingValue); + const isPositive = (value ?? 0) >= 0; + const seriesItemType = this.getSeriesItemType(isPositive, datumType); + const { strokeWidth, label } = this.getItemConfig(seriesItemType); + const y = isPositive ? currY : trailY; + const bottomY = isPositive ? trailY : currY; + const barHeight = Math.max(strokeWidth, Math.abs(bottomY - y)); + const rect2 = { + x: barAlongX ? Math.min(y, bottomY) : x, + y: barAlongX ? x : Math.min(y, bottomY), + width: barAlongX ? barHeight : barWidth, + height: barAlongX ? barWidth : barHeight + }; + const nodeMidPoint = { + x: rect2.x + rect2.width / 2, + y: rect2.y + rect2.height / 2 + }; + const pointY = isTotalOrSubtotal ? currY : trailY; + const pixelAlignmentOffset = Math.floor(line.strokeWidth) % 2 / 2; + const startY = categoryAxisReversed ? currY : pointY; + const stopY = categoryAxisReversed ? pointY : currY; + let startCoordinates; + let stopCoordinates; + if (barAlongX) { + startCoordinates = { + x: startY + pixelAlignmentOffset, + y: rect2.y + }; + stopCoordinates = { + x: stopY + pixelAlignmentOffset, + y: rect2.y + rect2.height + }; + } else { + startCoordinates = { + x: rect2.x, + y: startY + pixelAlignmentOffset + }; + stopCoordinates = { + x: rect2.x + rect2.width, + y: stopY + pixelAlignmentOffset + }; + } + const pathPoint = { + // lineTo + x: categoryAxisReversed ? stopCoordinates.x : startCoordinates.x, + y: categoryAxisReversed ? stopCoordinates.y : startCoordinates.y, + // moveTo + x2: categoryAxisReversed ? startCoordinates.x : stopCoordinates.x, + y2: categoryAxisReversed ? startCoordinates.y : stopCoordinates.y, + size: 0 + }; + pointData.push(pathPoint); + const itemId = seriesItemType === "subtotal" ? "total" : seriesItemType; + const labelText = this.getLabelText( + value, + datum, + yKey, + "y", + yDomain, + label, + { + itemId, + value, + datum, + xKey, + yKey, + xName, + yName + } + ); + const spacing = label.spacing + (typeof label.padding === "number" ? label.padding : 0); + const nodeDatum = { + index: datumIndex, + series: this, + itemId: seriesItemType, + datum, + datumIndex, + cumulativeValue: cumulativeValue ?? 0, + xValue: xDatum, + yValue: value, + yKey, + xKey, + x: rect2.x, + y: rect2.y, + width: rect2.width, + height: rect2.height, + midPoint: nodeMidPoint, + crisp, + label: { + text: labelText, + ...adjustLabelPlacement2({ + isUpward: (value ?? -1) >= 0 !== valueAxisReversed, + isVertical: !barAlongX, + placement: label.placement, + spacing, + rect: rect2 + }) + } + }; + context.nodeData.push(nodeDatum); + context.labelData.push(nodeDatum); + } + const connectorLinesEnabled = this.properties.line.enabled; + if (yCurrValues != null && connectorLinesEnabled) { + context.pointData = pointData; + } + return context; + } + updateSeriesItemTypes() { + const { dataModel, seriesItemTypes, processedData } = this; + if (!dataModel || !processedData) { + return; + } + seriesItemTypes.clear(); + const yPositiveIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrentPositive"); + const yNegativeIndex = dataModel.resolveProcessedDataIndexById(this, "yCurrentNegative"); + const totalTypeIndex = dataModel.resolveProcessedDataIndexById(this, `totalTypeValue`); + const positiveDomain = processedData.domain.values[yPositiveIndex] ?? []; + const negativeDomain = processedData.domain.values[yNegativeIndex] ?? []; + if (positiveDomain.length > 0) { + seriesItemTypes.add("positive"); + } + if (negativeDomain.length > 0) { + seriesItemTypes.add("negative"); + } + const itemTypes = processedData?.domain.values[totalTypeIndex]; + if (!itemTypes) { + return; + } + for (const type of itemTypes) { + if (type === "total" || type === "subtotal") { + seriesItemTypes.add("total"); + } + } + } + isSubtotal(datumType) { + return datumType === "subtotal"; + } + isTotal(datumType) { + return datumType === "total"; + } + nodeFactory() { + return new Rect3(); + } + getSeriesItemType(isPositive, datumType) { + return datumType ?? (isPositive ? "positive" : "negative"); + } + getItemConfig(seriesItemType) { + switch (seriesItemType) { + case "positive": { + return this.properties.item.positive; + } + case "negative": { + return this.properties.item.negative; + } + case "subtotal": + case "total": { + return this.properties.item.total; + } + } + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data); + } + getItemStyle(nodeDatum, isHighlight, highlightState, itemId = "total") { + const { properties } = this; + const { datumIndex = 0, datum } = nodeDatum ?? {}; + const propertyItemId = itemId === "subtotal" ? "total" : itemId; + const item = properties.item[propertyItemId]; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex, highlightState); + const baseStyle = mergeDefaults9(highlightStyle, properties.getStyle(itemId)); + const { itemStyler } = item; + let style2 = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId5(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(itemId, datumIndex, datum, isHighlight, style2); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`, "item", propertyItemId], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style2 = mergeDefaults9(overrides, style2); + } + } + return style2; + } + makeItemStylerParams(itemId, datumIndex, datum, isHighlight, style2) { + const { id: seriesId, properties } = this; + const { xKey, yKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + itemId, + datum, + xKey, + yKey, + highlighted: isHighlight, + highlightState: highlightStateString, + ...style2, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, datum) => { + datum.style = this.getItemStyle(datum, isHighlight, void 0, datum.itemId); + }); + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection18.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect2, datum) => { + const style2 = datum.style ?? contextNodeData.styles[datum.itemId][this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + applyShapeStyle6(rect2, style2, fillBBox); + rect2.cornerRadius = style2.cornerRadius ?? 0; + rect2.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect2.crisp = datum.crisp; + }); + } + updateLabelSelection(opts) { + const { labelData, labelSelection } = opts; + if (labelData.length === 0) { + return labelSelection.update([]); + } + const data = labelData.filter((labelDatum) => { + const { label } = this.getItemConfig(labelDatum.itemId); + return label.enabled; + }); + return labelSelection.update(data); + } + updateLabelNodes(opts) { + const params = { + itemId: "positive", + xKey: this.properties.xKey, + xName: this.properties.xName ?? this.properties.xName, + yKey: this.properties.yKey, + yName: this.properties.yName ?? this.properties.yName + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + params.itemId = datum.itemId; + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex)?.opacity ?? 1; + const label = this.getItemConfig(datum.itemId).label; + updateLabelNode4(this, textNode, params, label, datum.label, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { xKey, xName, yKey, yName, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, `xValue`, processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yRaw`, processedData)[datumIndex]; + const yCurrTotalValues = dataModel.resolveColumnById(this, "yCurrentTotal", processedData); + const totalTypeValues = dataModel.resolveColumnById( + this, + `totalTypeValue`, + processedData + ); + if (xValue2 == null) + return; + const datumType = totalTypeValues[datumIndex]; + const isPositive = (yValue ?? 0) >= 0; + const seriesItemType = this.getSeriesItemType(isPositive, datumType); + let total; + if (this.isTotal(datumType)) { + total = yCurrTotalValues[datumIndex]; + } else if (this.isSubtotal(datumType)) { + total = yCurrTotalValues[datumIndex]; + for (let previousIndex = datumIndex - 1; previousIndex >= 0; previousIndex -= 1) { + if (this.isSubtotal(totalTypeValues[previousIndex])) { + total = total - yCurrTotalValues[previousIndex]; + break; + } + } + } else { + total = yValue; + } + const nodeDatum = this.contextNodeData?.nodeData?.[datumIndex]; + const format = this.getItemStyle(nodeDatum, false, void 0, nodeDatum?.itemId); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, xKey, legendItemName), + symbol: this.legendItemSymbol(seriesItemType), + data: [ + { + label: yName, + fallbackLabel: yKey, + value: this.getAxisValueText(yAxis, "tooltip", total, datum, yKey, legendItemName) + } + ] + }, + { seriesId, datum, title: yName, itemId: seriesItemType, xKey, xName, yKey, yName, ...format } + ); + } + legendItemSymbol(item) { + const { fill, stroke: stroke22, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.getItemConfig(item); + return { + marker: { + fill, + stroke: stroke22, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id, seriesItemTypes } = this; + const legendData = []; + const capitalise = (text2) => text2.charAt(0).toUpperCase() + text2.substring(1); + const { showInLegend } = this.properties; + for (const item of seriesItemTypes) { + const { name } = this.getItemConfig(item); + legendData.push({ + legendType: "category", + id, + itemId: item, + seriesId: id, + enabled: true, + label: { text: name ?? capitalise(item) }, + symbol: this.legendItemSymbol(item), + hideInLegend: !showInLegend, + isFixed: true + }); + } + return legendData; + } + toggleSeriesItem() { + } + animateEmptyUpdateReady(opts) { + const { datumSelection, labelSelection, contextData } = opts; + const fns = prepareBarAnimationFunctions22( + collapsedStartingBarPosition2(this.isVertical(), this.axes, "normal"), + "unknown" + ); + motion3.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation3(this, "labels", this.ctx.animationManager, labelSelection); + const { pointData } = contextData; + if (!pointData) + return; + if (this.isVertical()) { + this.animateConnectorLinesVertical(opts); + } else { + this.animateConnectorLinesHorizontal(opts); + } + } + animateConnectorLinesHorizontal(opts) { + const { pointData = [] } = opts.contextData; + const [lineNode] = opts.paths; + const { path: linePath } = lineNode; + this.updateLineNode(lineNode); + const valueAxis = this.getValueAxis(); + const valueAxisReversed = valueAxis?.isReversed(); + const compare = valueAxisReversed ? (v, v2) => v < v2 : (v, v2) => v > v2; + const startX = valueAxis?.scale.convert(0); + const endX = pointData.reduce( + (end3, point) => { + if (compare(point.x, end3)) { + end3 = point.x; + } + return end3; + }, + valueAxisReversed ? Infinity : 0 + ); + const scale2 = (value, start1, end1, start2, end22) => { + return (value - start1) / (end1 - start1) * (end22 - start2) + start2; + }; + this.ctx.animationManager.animate({ + id: `${this.id}_connectors`, + groupId: this.id, + phase: "initial", + from: startX, + to: endX, + ease: module_support_exports.Motion.easeOut, + collapsable: false, + onUpdate(pointX) { + linePath.clear(true); + for (const [index, point] of pointData.entries()) { + const x = scale2(pointX, startX, endX, startX, point.x); + const x2 = scale2(pointX, startX, endX, startX, point.x2); + if (index !== 0) { + linePath.lineTo(x, point.y); + } + linePath.moveTo(x2, point.y2); + } + lineNode.checkPathDirty(); + }, + onStop: () => this.resetConnectorLinesPath(opts) + }); + } + animateConnectorLinesVertical(opts) { + const { pointData = [] } = opts.contextData; + const [lineNode] = opts.paths; + const { path: linePath } = lineNode; + this.updateLineNode(lineNode); + const valueAxis = this.getValueAxis(); + const valueAxisReversed = valueAxis?.isReversed(); + const compare = valueAxisReversed ? (v, v2) => v > v2 : (v, v2) => v < v2; + const startY = valueAxis?.scale.convert(0); + const endY = pointData.reduce( + (end3, point) => { + if (compare(point.y, end3)) { + end3 = point.y; + } + return end3; + }, + valueAxisReversed ? 0 : Infinity + ); + const scale2 = (value, start1, end1, start2, end22) => { + return (value - start1) / (end1 - start1) * (end22 - start2) + start2; + }; + this.ctx.animationManager.animate({ + id: `${this.id}_connectors`, + groupId: this.id, + phase: "initial", + from: startY, + to: endY, + ease: module_support_exports.Motion.easeOut, + collapsable: false, + onUpdate(pointY) { + linePath.clear(true); + for (const [index, point] of pointData.entries()) { + const y = scale2(pointY, startY, endY, startY, point.y); + const y2 = scale2(pointY, startY, endY, startY, point.y2); + if (index !== 0) { + linePath.lineTo(point.x, y); + } + linePath.moveTo(point.x2, y2); + } + lineNode.checkPathDirty(); + }, + onStop: () => this.resetConnectorLinesPath(opts) + }); + } + animateReadyResize(data) { + super.animateReadyResize(data); + this.resetConnectorLinesPath(data); + } + updatePaths(opts) { + this.resetConnectorLinesPath({ contextData: opts.contextData, paths: opts.paths }); + } + resetConnectorLinesPath({ + contextData, + paths + }) { + if (paths.length === 0) { + return; + } + const [lineNode] = paths; + this.updateLineNode(lineNode); + const { path: linePath } = lineNode; + linePath.clear(true); + const { pointData } = contextData; + if (!pointData) { + return; + } + for (const [index, point] of pointData.entries()) { + if (index !== 0) { + linePath.lineTo(point.x, point.y); + } + linePath.moveTo(point.x2, point.y2); + } + lineNode.checkPathDirty(); + } + updateLineNode(lineNode) { + const { stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this.properties.line; + lineNode.setProperties({ + fill: void 0, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + lineJoin: "round", + pointerEvents: module_support_exports.PointerEvents.None + }); + } + isLabelEnabled() { + const { positive, negative, total } = this.properties.item; + return positive.label.enabled || negative.label.enabled || total.label.enabled; + } + onDataChange() { + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds5(this, this.contextNodeData?.nodeData[datumIndex]); + } + hasItemStylers() { + const { positive, negative, total } = this.properties.item; + return positive.itemStyler != null || positive.label.itemStyler != null || negative.itemStyler != null || negative.label.itemStyler != null || total.itemStyler != null || total.label.itemStyler != null; + } +}; +WaterfallSeries.className = "WaterfallSeries"; +WaterfallSeries.type = "waterfall"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs7, waterfallSeriesThemeableOptionsDef: waterfallSeriesThemeableOptionsDef2 } = module_support_exports; +var waterfallSeriesOptionsDef = { + ...waterfallSeriesThemeableOptionsDef2, + ...commonSeriesOptionsDefs7, + type: required(constant("waterfall")), + xKey: required(string), + yKey: required(string), + xName: string, + yName: string, + totals: arrayOfDefs( + { + totalType: required(union("total", "subtotal")), + index: required(positiveNumber), + axisLabel: required(string) + }, + "a total definition options array" + ) +}; +var { FILL_GRADIENT_LINEAR_KEYED_DEFAULTS: FILL_GRADIENT_LINEAR_KEYED_DEFAULTS22, FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS3, FILL_PATTERN_KEYED_DEFAULTS: FILL_PATTERN_KEYED_DEFAULTS22 } = module_support_exports; +function itemTheme2(key, index) { + return { + fill: { + $applySwitch: [ + { $path: "type" }, + { + $if: [ + { $eq: [{ $palette: "type" }, "user-indexed"] }, + { $path: [`/${index}`, { $palette: "fill" }, { $palette: "fills" }] }, + { $palette: `${key}.fill` } + ] + }, + ["gradient", FILL_GRADIENT_LINEAR_KEYED_DEFAULTS22(key)], + ["image", FILL_IMAGE_DEFAULTS3], + ["pattern", FILL_PATTERN_KEYED_DEFAULTS22(key)] + ] + }, + stroke: { $palette: `${key}.stroke` }, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: false, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + formatter: void 0, + placement: "outside-end", + padding: { $isUserOption: ["./spacing", 0, 6] } + // compatibility with old `padding` property (now named `spacing`). + } + }; +} +var WATERFALL_SERIES_THEME = { + series: { + item: { + positive: itemTheme2("altUp", 0), + negative: itemTheme2("altDown", 1), + total: itemTheme2("neutral", 2) + }, + line: { + stroke: { $palette: "neutral.stroke" }, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0, + strokeWidth: 2 + }, + highlight: module_support_exports.singleSeriesHighlightStyle() + }, + legend: { + enabled: true, + toggleSeries: false + } +}; +var WaterfallModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "waterfall", + solo: true, + moduleFactory: (ctx) => new WaterfallSeries(ctx), + defaultAxes: module_support_exports.DIRECTION_SWAP_AXES, + themeTemplate: WATERFALL_SERIES_THEME +}; +var WaterfallSeriesModule = { + type: "series", + name: "waterfall", + chartType: "cartesian", + enterprise: true, + options: waterfallSeriesOptionsDef, + create: (ctx) => new WaterfallSeries(ctx) +}; +var { + NewAreaSeriesModule: NewAreaSeriesModule2, + NewBarSeriesModule: NewBarSeriesModule2, + NewBubbleSeriesModule: NewBubbleSeriesModule2, + NewHistogramSeriesModule: NewHistogramSeriesModule2, + NewLineSeriesModule: NewLineSeriesModule2, + NewScatterSeriesModule: NewScatterSeriesModule2, + numberFormatValidator: numberFormatValidator2, + textOrSegments: textOrSegments2, + without: without22 +} = module_support_exports; +var navigatorHandleOptionsDef2 = { + width: positiveNumber, + height: positiveNumber, + grip: boolean, + fill: color, + stroke: color, + strokeWidth: positiveNumber, + cornerRadius: positiveNumber +}; +var commonIgnoredMiniChartProperties = [ + "cursor", + "highlightStyle", + "listeners", + "nodeClickRange", + "showInLegend", + "showInMiniChart", + "tooltip", + "visible", + "xName", + "yName" +]; +var barIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "label", + "legendItemName", + "direction" +]; +var boxPlotIngnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction", + "legendItemName", + "minName", + "q1Name", + "medianName", + "q3Name", + "maxName" +]; +var bubbleIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "title", + "label", + "labelKey", + "labelName", + "sizeName" +]; +var heatmapIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "title", + "label", + "colorName", + "textAlign", + "verticalAlign", + "itemPadding", + "colorRange" +]; +var histogramIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "label" +]; +var lineIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "title", + "label" +]; +var rangeAreaIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "label", + "yLowName", + "yHighName" +]; +var rangeBarIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction", + "label", + "yLowName", + "yHighName" +]; +var scatterIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "errorBar", + "title", + "label", + "labelKey", + "labelName" +]; +var waterfallIgnoredMiniChartProperties = [ + ...commonIgnoredMiniChartProperties, + "direction" +]; +var navigatorOptionsDef2 = { + enabled: boolean, + height: positiveNumber, + spacing: positiveNumber, + cornerRadius: number, + mask: { + fill: color, + fillOpacity: ratio, + stroke: color, + strokeWidth: positiveNumber + }, + minHandle: navigatorHandleOptionsDef2, + maxHandle: navigatorHandleOptionsDef2, + miniChart: { + enabled: boolean, + padding: { + top: positiveNumber, + bottom: positiveNumber + }, + label: { + enabled: boolean, + avoidCollisions: boolean, + spacing: positiveNumber, + format: numberFormatValidator2, + formatter: callbackOf(textOrSegments2), + interval: { + minSpacing: positiveNumber, + maxSpacing: positiveNumber, + values: array, + step: number + }, + ...fontOptionsDef + }, + series: arrayOfDefs( + typeUnion( + { + area: without22(NewAreaSeriesModule2.options, [...commonIgnoredMiniChartProperties, "type"]), + bar: without22(NewBarSeriesModule2.options, [...barIgnoredMiniChartProperties, "type"]), + "box-plot": without22(BoxPlotSeriesModule.options, [...boxPlotIngnoredMiniChartProperties, "type"]), + bubble: without22(NewBubbleSeriesModule2.options, [...bubbleIgnoredMiniChartProperties, "type"]), + candlestick: without22(CandlestickSeriesModule.options, [ + ...commonIgnoredMiniChartProperties, + "type" + ]), + heatmap: without22(HeatmapSeriesModule.options, [...heatmapIgnoredMiniChartProperties, "type"]), + histogram: without22(NewHistogramSeriesModule2.options, [ + ...histogramIgnoredMiniChartProperties, + "type" + ]), + line: without22(NewLineSeriesModule2.options, [...lineIgnoredMiniChartProperties, "type"]), + ohlc: without22(OhlcSeriesModule.options, [...commonIgnoredMiniChartProperties, "type"]), + "range-area": without22(RangeAreaSeriesModule.options, [ + ...rangeAreaIgnoredMiniChartProperties, + "type" + ]), + "range-bar": without22(RangeBarSeriesModule.options, [...rangeBarIgnoredMiniChartProperties, "type"]), + scatter: without22(NewScatterSeriesModule2.options, [...scatterIgnoredMiniChartProperties, "type"]), + waterfall: without22(WaterfallSeriesModule.options, [...waterfallIgnoredMiniChartProperties, "type"]) + }, + "miniChart series options" + ) + ) + } +}; +var validMiniChartSeriesTypes = [ + "area", + "bar", + "bubble", + "candlestick", + "heatmap", + "histogram", + "line", + "ohlc", + "range-area", + "range-bar", + "scatter", + "waterfall" +]; +var priceVolumePresetIgnoredMiniChartProperties = [ + "itemStyler", + "direction", + "fill", + "fillGradientDefaults", + "fillPatternDefaults", + "fillImageDefaults", + "fillOpacity", + "shadow", + "focusPriority", + "highlight", + "lineDash", + "lineDashOffset", + "strokeWidth" +]; +function miniChartSeriesTheme(seriesPath, typePath) { + return { + $merge: [ + { + $switch: [ + typePath, + {}, + [ + ["area", "line", "range-area"], + { + marker: { + enabled: { + $isUserOption: [ + "/series/$index/marker/enabled", + { $path: ["/series/$index/marker/enabled", false] }, + false + ] + } + } + } + ] + ] + }, + { + $omit: [ + { + $switch: [ + typePath, + commonIgnoredMiniChartProperties, + ["bar", barIgnoredMiniChartProperties], + ["box-plot", boxPlotIngnoredMiniChartProperties], + ["bubble", bubbleIgnoredMiniChartProperties], + ["heatmap", heatmapIgnoredMiniChartProperties], + ["histogram", histogramIgnoredMiniChartProperties], + [ + "line", + [...lineIgnoredMiniChartProperties, ...priceVolumePresetIgnoredMiniChartProperties] + ], + ["range-area", rangeAreaIgnoredMiniChartProperties], + ["range-bar", rangeBarIgnoredMiniChartProperties], + ["scatter", scatterIgnoredMiniChartProperties], + ["waterfall", waterfallIgnoredMiniChartProperties] + ] + }, + seriesPath + ] + } + ] + }; +} +var NAVIGATOR_THEME = { + enabled: false, + height: { $if: [{ $path: "./miniChart/enabled" }, 40, 18] }, + cornerRadius: 4, + mask: { + fill: { $ref: "foregroundColor" }, + fillOpacity: 0.1, + stroke: { $ref: "borderColor" }, + strokeWidth: 1 + }, + minHandle: { + fill: { $ref: "chartBackgroundColor" }, + stroke: { $ref: "borderColor" }, + strokeWidth: 1, + width: 12, + height: 24, + cornerRadius: 4 + }, + maxHandle: { + fill: { $ref: "chartBackgroundColor" }, + stroke: { $ref: "borderColor" }, + strokeWidth: 1, + width: 12, + height: 24, + cornerRadius: 4 + }, + miniChart: { + enabled: false, + label: { + color: { $ref: "textColor" }, + fontSize: { $rem: module_support_exports.FONT_SIZE_RATIO.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + spacing: 5 + }, + padding: { + top: 0, + bottom: 0 + }, + series: { + $apply: [ + miniChartSeriesTheme( + { $path: "/series/$index" }, + { + $path: [ + "/navigator/miniChart/series/$index/type", + { $path: ["type", { $path: "/series/$index/type" }] } + ] + } + ), + { + // TODO: this should be a $switch but switches can not resolve the case value yet + $if: [ + { + $or: validMiniChartSeriesTypes.map((type) => ({ + $eq: [{ $path: "/series/0/type" }, type] + })) + }, + { + $map: [ + miniChartSeriesTheme({ $value: "$1" }, { $path: "/series/$index/type" }), + { $path: "/series" } + ] + }, + void 0 + ] + } + ] + } + } +}; +var NavigatorModule = { + type: "root", + optionsKey: "navigator", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new Navigator(ctx), + removable: false, + // Toggling this module causes zoom state flakiness. + themeTemplate: { + navigator: NAVIGATOR_THEME + } +}; +var { ToolbarButtonProperties: ToolbarButtonProperties3, Property: Property56 } = module_support_exports; +var RangesButtonProperties = class extends ToolbarButtonProperties3 { +}; +__decorateClass2([ + Property56 +], RangesButtonProperties.prototype, "value", 2); +var { ChartAxisDirection: ChartAxisDirection19, LayoutElement: LayoutElement3, PropertiesArray: PropertiesArray5, Toolbar: Toolbar2, Property: Property57 } = module_support_exports; +var Ranges = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.buttons = new PropertiesArray5(RangesButtonProperties); + this.verticalSpacing = 10; + this.container = ctx.domManager.addChild("canvas-overlay", "range-buttons"); + this.container.role = "presentation"; + this.toolbar = new Toolbar2(this.ctx, "ariaLabelRangesToolbar", "horizontal"); + this.toolbar.addClass("ag-charts-range-buttons"); + this.container.append(this.toolbar.getElement()); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPress.bind(this)), + ctx.layoutManager.registerElement(LayoutElement3.ToolbarBottom, this.onLayoutStart.bind(this)), + ctx.eventsHub.on("zoom:change", this.onZoomChanged.bind(this)), + this.teardown.bind(this) + ); + } + teardown() { + this.toolbar.getElement().remove(); + this.toolbar.destroy(); + } + onLayoutStart(event) { + const { buttons: buttons2, ctx, enabled, toolbar: toolbar2, verticalSpacing } = this; + const { layoutBox } = event; + if (!enabled || !ctx.zoomManager.isZoomEnabled()) { + toolbar2.setHidden(true); + return; + } + toolbar2.setHidden(false); + toolbar2.updateButtons(buttons2); + const height2 = toolbar2.getBounds().height; + toolbar2.setBounds({ + x: layoutBox.x, + y: layoutBox.y + layoutBox.height - height2, + width: layoutBox.width, + height: height2 + }); + layoutBox.shrink({ bottom: height2 + verticalSpacing }); + } + onZoomChanged() { + this.toolbar.clearActiveButton(); + } + onButtonPress({ button: { index } }) { + const { zoomManager } = this.ctx; + const button = this.buttons.at(index); + if (!button) + return; + const { value } = button; + if (value == null) { + zoomManager.resetZoom("zoom-buttons"); + } else if (typeof value === "number") { + zoomManager.extendToEnd("zoom-buttons", ChartAxisDirection19.X, value); + } else if (Array.isArray(value)) { + zoomManager.updateWith("zoom-buttons", ChartAxisDirection19.X, () => value); + } else if (typeof value === "function") { + zoomManager.updateWith("zoom-buttons", ChartAxisDirection19.X, value); + } + this.toolbar.toggleActiveButtonByIndex(index); + } +}; +__decorateClass2([ + Property57 +], Ranges.prototype, "enabled", 2); +__decorateClass2([ + Property57 +], Ranges.prototype, "buttons", 2); +var DAY = 1e3 * 60 * 60 * 24; +var MONTH = DAY * 30; +var YEAR = DAY * 365; +var RangesModule = { + type: "root", + optionsKey: "ranges", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new Ranges(ctx), + themeTemplate: { + ranges: { + enabled: false, + buttons: { + $shallowSimple: [ + { + label: "toolbarRange1Month", + ariaLabel: "toolbarRange1MonthAria", + value: MONTH + }, + { + label: "toolbarRange3Months", + ariaLabel: "toolbarRange3MonthsAria", + value: 3 * MONTH + }, + { + label: "toolbarRange6Months", + ariaLabel: "toolbarRange6MonthsAria", + value: 6 * MONTH + }, + { + label: "toolbarRangeYearToDate", + ariaLabel: "toolbarRangeYearToDateAria", + value: (_start, end3) => [ + (/* @__PURE__ */ new Date(`${new Date(end3).getFullYear()}-01-01`)).getTime(), + void 0 + ] + }, + { + label: "toolbarRange1Year", + ariaLabel: "toolbarRange1YearAria", + value: YEAR + }, + { + label: "toolbarRangeAll", + ariaLabel: "toolbarRangeAllAria", + value: void 0 + // Reset zoom + } + ] + } + } + } +}; +var _SharedToolbar = class _SharedToolbar2 extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.activeSections = /* @__PURE__ */ new Set(); + this.sectionButtons = { + annotations: [], + chartToolbar: [] + }; + this.container = this.ctx.domManager.addChild("canvas-overlay", "shared-toolbar"); + this.container.role = "presentation"; + } + getSharedToolbar(section) { + if (!this.sharedToolbar) { + this.createSharedToolbar(); + } + if (section === "chartToolbar" && this.sharedToolbar) { + this.sharedToolbar.setAriaLabelId("ariaLabelFinancialCharts"); + } + return this.toolbarWithSection(section); + } + createSharedToolbar() { + this.sharedToolbar = new module_support_exports.Toolbar(this.ctx, "ariaLabelAnnotationsToolbar", "vertical"); + this.sharedToolbar.addClass("ag-charts-shared-toolbar"); + this.container.append(this.sharedToolbar.getElement()); + this.cleanup.register(() => { + if (!this.sharedToolbar) + return; + this.sharedToolbar.getElement().remove(); + this.sharedToolbar.destroy(); + this.sharedToolbar = void 0; + }); + } + toolbarWithSection(section) { + const sharedToolbar = this.sharedToolbar; + const withSection = { + layout: (layoutBox, padding2) => { + if (this.firstLayoutSection != null && this.firstLayoutSection !== section && this.activeSections.has(this.firstLayoutSection)) { + return; + } + this.firstLayoutSection = section; + const width2 = sharedToolbar.getBounds().width; + sharedToolbar.setBounds({ + x: layoutBox.x, + y: layoutBox.y, + width: width2 + }); + layoutBox.shrink({ left: width2 + sharedToolbar.horizontalSpacing + (padding2 ?? 0) }); + }, + addToolbarListener: (eventType, handler) => { + return sharedToolbar.addToolbarListener(eventType, (sharedEvent) => { + const sectionIndex = this.getSectionIndex(section, sharedEvent.button.index); + if (sectionIndex < 0) + return; + const event = { + ...sharedEvent, + button: this.sectionButtons[section][sectionIndex] + }; + handler(event); + }); + }, + updateButtons: (buttons2) => { + this.sectionButtons[section] = buttons2; + const sharedButtons = _SharedToolbar2.SECTION_ORDER.flatMap((order) => this.sectionButtons[order]); + sharedToolbar.updateButtons(sharedButtons); + }, + updateButtonByIndex: (index, button) => { + sharedToolbar.updateButtonByIndex(this.getIndex(section, index), button); + }, + toggleActiveButtonByIndex: (index) => { + sharedToolbar.toggleActiveButtonByIndex(this.getIndex(section, index)); + }, + toggleButtonEnabledByIndex: (index, enabled) => { + sharedToolbar.toggleButtonEnabledByIndex(this.getIndex(section, index), enabled); + }, + setHidden: (hidden) => { + if (hidden) { + this.activeSections.delete(section); + } else { + this.activeSections.add(section); + } + let sum2 = 0; + for (const order of _SharedToolbar2.SECTION_ORDER) { + if (order !== section) { + sum2 += this.sectionButtons[order].length; + continue; + } + for (const index of this.sectionButtons[section].keys()) { + sharedToolbar.setButtonHiddenByIndex(sum2 + index, hidden); + } + } + }, + destroy: () => { + withSection.setHidden(true); + if (this.activeSections.size === 0) { + this.destroy(); + } + }, + clearActiveButton: sharedToolbar.clearActiveButton.bind(sharedToolbar), + addListener: sharedToolbar.addListener.bind(sharedToolbar), + removeListener: sharedToolbar.removeListener.bind(sharedToolbar) + }; + withSection.setHidden(false); + return withSection; + } + getIndex(section, index) { + let sum2 = 0; + for (const order of _SharedToolbar2.SECTION_ORDER) { + if (order === section) + return sum2 + index; + sum2 += this.sectionButtons[order].length; + } + return -1; + } + getSectionIndex(section, index) { + let sum2 = 0; + for (const order of _SharedToolbar2.SECTION_ORDER) { + if (order === section) { + if (index >= sum2 + this.sectionButtons[section].length) + return -1; + return index - sum2; + } + sum2 += this.sectionButtons[order].length; + } + return -1; + } +}; +_SharedToolbar.SECTION_ORDER = ["chartToolbar", "annotations"]; +var SharedToolbar = _SharedToolbar; +var SharedToolbarModule = { + type: "context", + contextKey: "sharedToolbar", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new SharedToolbar(ctx) +}; +var { ZIndexMap: ZIndexMap8, LayoutElement: LayoutElement4, Property: Property58, BaseProperties: BaseProperties20, valueProperty: valueProperty9, Group: Group7, Label: Label5, Rect: Rect4, Text: Text2 } = module_support_exports; +var chartConfigurations = { + ohlc: 2 | 4 | 8 | 16 | 32, + candlestick: 2 | 4 | 8 | 16 | 32, + "hollow-candlestick": 2 | 4 | 8 | 16 | 32, + line: 64 | 32, + "step-line": 64 | 32, + hlc: 128 | 8 | 16 | 32, + "high-low": 512 | 256 | 32 + /* Volume */ +}; +var itemIdMap = { + up: "positive", + down: "negative" +}; +var neutralColorMap = { + hlc: "altNeutral" +}; +var StatusBarBackground = class extends BaseProperties20 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + } +}; +__decorateClass2([ + Property58 +], StatusBarBackground.prototype, "fill", 2); +__decorateClass2([ + Property58 +], StatusBarBackground.prototype, "fillOpacity", 2); +var StatusBar = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.openKey = void 0; + this.highKey = void 0; + this.lowKey = void 0; + this.closeKey = void 0; + this.volumeKey = void 0; + this.title = new Label5(); + this.positive = new Label5(); + this.negative = new Label5(); + this.neutral = new Label5(); + this.altNeutral = new Label5(); + this.background = new StatusBarBackground(); + this.layoutStyle = "block"; + this.id = "status-bar"; + this.data = void 0; + this.layer = new Group7({ + name: "StatusBar", + zIndex: ZIndexMap8.STATUS_BAR + }); + this.labelGroup = this.layer.appendChild(new module_support_exports.TranslatableGroup()); + this.backgroundNode = this.labelGroup.appendChild(new Rect4()); + this.labels = [ + { + label: "O", + configuration: 2, + title: this.labelGroup.appendChild(new Text2()), + value: this.labelGroup.appendChild(new Text2()), + id: "openValue", + key: "openKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "H", + configuration: 16, + title: this.labelGroup.appendChild(new Text2()), + value: this.labelGroup.appendChild(new Text2()), + id: "highValue", + key: "highKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "H", + configuration: 256, + title: this.labelGroup.appendChild(new Text2()), + value: this.labelGroup.appendChild(new Text2()), + style: "neutral", + id: "highValue", + key: "highKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "L", + configuration: 8, + title: this.labelGroup.appendChild(new Text2()), + value: this.labelGroup.appendChild(new Text2()), + id: "lowValue", + key: "lowKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "L", + configuration: 512, + title: this.labelGroup.appendChild(new Text2()), + value: this.labelGroup.appendChild(new Text2()), + style: "neutral", + id: "lowValue", + key: "lowKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "C", + configuration: 4, + title: this.labelGroup.appendChild(new Text2()), + value: this.labelGroup.appendChild(new Text2()), + id: "closeValue", + key: "closeKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "C", + configuration: 128, + title: this.labelGroup.appendChild(new Text2()), + value: this.labelGroup.appendChild(new Text2()), + id: "closeValue", + key: "closeKey", + style: "neutral", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "", + configuration: 64, + title: this.labelGroup.appendChild(new Text2()), + value: this.labelGroup.appendChild(new Text2()), + style: "neutral", + id: "closeValue", + key: "closeKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + notation: "compact", + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }, + { + label: "Vol", + configuration: 32, + title: this.labelGroup.appendChild(new Text2()), + value: this.labelGroup.appendChild(new Text2()), + id: "volumeValue", + key: "volumeKey", + domain: void 0, + formatter: new Intl.NumberFormat("en-US", { + notation: "compact", + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + } + ]; + this.highlightManager = ctx.highlightManager; + this.labelGroup.visible = false; + this.cleanup.register( + ctx.scene.attachNode(this.layer), + ctx.layoutManager.registerElement(LayoutElement4.Overlay, (e) => this.startPerformLayout(e)), + ctx.eventsHub.on("layout:complete", (e) => this.onLayoutComplete(e)), + ctx.eventsHub.on("highlight:change", () => this.updateHighlight()) + ); + } + async processData(dataController) { + if (!this.enabled || this.data == null) + return; + const props = []; + for (const label of this.labels) { + const { id, key } = label; + const datumKey = this[key]; + if (datumKey == null) { + label.domain = void 0; + } else { + props.push(valueProperty9(datumKey, "number", { id })); + } + } + if (props.length === 0) + return; + const dataSet = module_support_exports.DataSet.wrap(this.data) ?? module_support_exports.DataSet.empty(); + const { processedData, dataModel } = await dataController.request(this.id, dataSet, { + props + }); + for (const label of this.labels) { + const { id, key } = label; + const datumKey = this[key]; + if (datumKey != null) { + label.domain = dataModel.getDomain(this, id, "value", processedData); + } + } + } + startPerformLayout(opts) { + this.labelGroup.translationX = 0; + this.labelGroup.translationY = 0; + if (!this.enabled) + return; + const { layoutBox } = opts; + const innerSpacing = 4; + const outerSpacing = 12; + const spacingAbove = 0; + const spacingBelow = 8; + this.labelGroup.translationY = layoutBox.y + spacingAbove; + const maxFontSize = Math.max(this.title.fontSize, this.positive.fontSize, this.negative.fontSize); + const lineHeight = calcLineHeight(maxFontSize); + const labelConfigurations = chartConfigurations[this.getChartType()] ?? 0; + let left = 0; + let offsetTop; + let textVAlign = "alphabetic"; + if (this.layoutStyle === "block") { + layoutBox.shrink(spacingAbove + lineHeight + spacingBelow, "top"); + offsetTop = maxFontSize + (lineHeight - maxFontSize) / 2; + } else { + const { title } = this.ctx.chartService; + textVAlign = "top"; + offsetTop = spacingAbove + title.padding; + if (title.enabled) { + const titleBox = title.node.getBBox(); + left = titleBox.x + titleBox.width + outerSpacing; + } else { + left = title.padding; + } + } + for (const { label, configuration, title, value, domain, formatter: formatter2 } of this.labels) { + if (domain == null || (labelConfigurations & configuration) === 0) { + title.visible = false; + value.visible = false; + continue; + } + const positiveTextMeasurer = cachedTextMeasurer(this.positive); + const negativeTextMeasurer = cachedTextMeasurer(this.negative); + const maxValueWidth = Math.max( + positiveTextMeasurer.textWidth(formatter2.format(domain[0])), + positiveTextMeasurer.textWidth(formatter2.format(domain[1])), + negativeTextMeasurer.textWidth(formatter2.format(domain[0])), + negativeTextMeasurer.textWidth(formatter2.format(domain[1])) + ); + title.visible = true; + value.visible = true; + const titleMetrics = cachedTextMeasurer(this.title).measureLines(label); + title.setFont(this.title); + title.fill = this.title.color; + title.text = label; + title.textBaseline = textVAlign; + title.y = offsetTop; + title.x = left; + left += titleMetrics.width + innerSpacing; + value.textBaseline = textVAlign; + value.y = offsetTop; + value.x = left; + left += maxValueWidth + outerSpacing; + } + this.backgroundNode.x = 0; + this.backgroundNode.y = 0; + this.backgroundNode.width = left - outerSpacing; + this.backgroundNode.height = lineHeight + spacingAbove + spacingBelow; + this.backgroundNode.fill = this.background.fill; + this.backgroundNode.fillOpacity = this.background.fillOpacity; + } + onLayoutComplete(opts) { + this.labelGroup.translationX = opts.series.rect.x; + this.updateHighlight(); + } + updateHighlight() { + if (!this.enabled) + return; + const activeHighlight = this.highlightManager.getActiveHighlight(); + const datum = activeHighlight?.datum ?? this.data?.at(-1); + if (datum == null) { + this.labelGroup.visible = false; + return; + } + this.labelGroup.visible = true; + const itemId = activeHighlight?.itemId; + let baseStyle = itemId == null ? void 0 : itemIdMap[itemId]; + if (baseStyle == null && this.openKey != null && this.closeKey != null) { + if (datum[this.openKey] < datum[this.closeKey]) { + baseStyle = "positive"; + } else { + baseStyle = "negative"; + } + } + for (const { domain, value, key, formatter: formatter2, style: style2 } of this.labels) { + if (domain == null) + continue; + let labelStyle = style2 ?? baseStyle ?? "neutral"; + if (labelStyle === "neutral") { + labelStyle = neutralColorMap[this.getChartType()] ?? labelStyle; + } + const datumKey = this[key]; + const datumValue = datumKey == null ? void 0 : datum?.[datumKey]; + value.setFont(this[labelStyle]); + value.fill = this[labelStyle].color; + value.text = typeof datumValue === "number" ? formatter2.format(datumValue) : ""; + } + } + getChartType() { + let chartType = this.ctx.chartService.publicApi?.getOptions()?.chartType; + if (chartType == null || chartConfigurations[chartType] == null) { + chartType = "candlestick"; + } + return chartType; + } +}; +__decorateClass2([ + Property58 +], StatusBar.prototype, "enabled", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "openKey", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "highKey", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "lowKey", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "closeKey", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "volumeKey", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "title", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "positive", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "negative", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "neutral", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "altNeutral", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "background", 2); +__decorateClass2([ + Property58 +], StatusBar.prototype, "layoutStyle", 2); +var StatusBarModule = { + type: "root", + identifier: "status-bar", + optionsKey: "statusBar", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new StatusBar(ctx), + themeTemplate: { + statusBar: { + enabled: false, + layoutStyle: module_support_exports.ThemeSymbols.DEFAULT_CAPTION_LAYOUT_STYLE, + title: { + color: { $ref: "textColor" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + positive: { + color: { $palette: "up.stroke" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + negative: { + color: { $palette: "down.stroke" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + neutral: { + color: { $palette: "neutral.stroke" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + }, + background: { + fill: { $ref: "chartBackgroundColor" }, + fillOpacity: 0.5 + }, + altNeutral: { + color: "gray", + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" } + } + } + } +}; +var UNIT_MIN = 0; +var UNIT_MAX = 1; +var UNIT_SIZE = UNIT_MAX - UNIT_MIN; +var DEFAULT_ANCHOR_POINT_X = "end"; +var DEFAULT_ANCHOR_POINT_Y = "middle"; +var ZOOM_VALID_CHECK_DEBOUNCE = 300; +var constrain = (value, min = UNIT_MIN, max = UNIT_MAX) => clamp(min, value, max); +function unitZoomState() { + return { x: { min: UNIT_MIN, max: UNIT_MAX }, y: { min: UNIT_MIN, max: UNIT_MAX } }; +} +function dx(zoom) { + return zoom.x.max - zoom.x.min; +} +function dy(zoom) { + return zoom.y.max - zoom.y.min; +} +function isZoomRangeEqual(left, right) { + return isNumberEqual(left.min, right.min) && isNumberEqual(left.max, right.max); +} +function isZoomEqual(left, right) { + return isZoomRangeEqual(left.x, right.x) && isZoomRangeEqual(left.y, right.y); +} +function isMaxZoom(zoom) { + return isZoomEqual(zoom, unitZoomState()); +} +function definedZoomState(zoom) { + return { + x: { min: zoom?.x?.min ?? UNIT_MIN, max: zoom?.x?.max ?? UNIT_MAX }, + y: { min: zoom?.y?.min ?? UNIT_MIN, max: zoom?.y?.max ?? UNIT_MAX } + }; +} +function pointToRatio(bbox, x, y) { + if (!bbox) + return { x: 0, y: 0 }; + const constrainedX = constrain(x - bbox.x, 0, bbox.x + bbox.width); + const constrainedY = constrain(y - bbox.y, 0, bbox.y + bbox.height); + const rx = 1 / bbox.width * constrainedX; + const ry = 1 - 1 / bbox.height * constrainedY; + return { x: constrain(rx), y: constrain(ry) }; +} +function translateZoom(zoom, x, y) { + return { + x: { min: zoom.x.min + x, max: zoom.x.max + x }, + y: { min: zoom.y.min + y, max: zoom.y.max + y } + }; +} +function scaleZoom(zoom, sx, sy) { + return { + x: { min: zoom.x.min, max: zoom.x.min + dx(zoom) * sx }, + y: { min: zoom.y.min, max: zoom.y.min + dy(zoom) * sy } + }; +} +function scaleZoomCenter(zoom, sx, sy) { + const dx_ = dx(zoom); + const dy_ = dy(zoom); + const cx = zoom.x.min + dx_ / 2; + const cy = zoom.y.min + dy_ / 2; + return { + x: { min: cx - dx_ * sx / 2, max: cx + dx_ * sx / 2 }, + y: { min: cy - dy_ * sy / 2, max: cy + dy_ * sy / 2 } + }; +} +function scaleZoomAxisWithAnchor(newState, oldState, anchor, origin3) { + const { min, max } = oldState; + const center2 = min + (max - min) / 2; + const diff8 = newState.max - newState.min; + switch (anchor) { + case "start": + return { min, max: oldState.min + diff8 }; + case "end": + return { min: oldState.max - diff8, max }; + case "middle": + return { min: center2 - diff8 / 2, max: center2 + diff8 / 2 }; + case "pointer": + return scaleZoomAxisWithPoint(newState, oldState, origin3 ?? center2); + default: + return { min, max }; + } +} +function scaleZoomAxisWithPoint(newState, oldState, origin3) { + const newDelta = newState.max - newState.min; + const oldDelta = oldState.max - oldState.min; + const scaledOrigin = origin3 * (1 - (oldDelta - newDelta)); + const translation = origin3 - scaledOrigin; + const min = newState.min + translation; + const max = newState.max + translation; + return { min, max }; +} +function multiplyZoom(zoom, nx, ny) { + return { + x: { min: zoom.x.min * nx, max: zoom.x.max * nx }, + y: { min: zoom.y.min * ny, max: zoom.y.max * ny } + }; +} +function constrainZoom(zoom) { + return { + x: constrainAxis(zoom.x), + y: constrainAxis(zoom.y) + }; +} +function constrainAxis(axis) { + const size = axis.max - axis.min; + let min = axis.max > UNIT_MAX ? UNIT_MAX - size : axis.min; + let max = axis.min < UNIT_MIN ? size : axis.max; + min = Math.max(UNIT_MIN, min); + max = Math.min(UNIT_MAX, max); + return { min, max }; +} +var { + BaseProperties: BaseProperties21, + CartesianAxis: CartesianAxis2, + ChartAxisDirection: ChartAxisDirection20, + ContinuousScale: ContinuousScale6, + TimeScale: TimeScale2, + UnitTimeScale: UnitTimeScale2, + ChartUpdateType: ChartUpdateType22, + ObserveChanges: ObserveChanges4, + TooltipManager: TooltipManager2, + Property: Property59, + findMinMax: findMinMax4, + isObjectWithStringProperty: isObjectWithStringProperty2 +} = module_support_exports; +var debug5 = module_support_exports.Debug.create("sync"); +function getDirectionKeys(series, primary, secondary) { + const primaryKeys = series.getKeys(primary); + const secondaryKeys = series.getKeys(secondary); + if (series.shouldFlipXY?.()) { + return [secondaryKeys, primaryKeys]; + } + return [primaryKeys, secondaryKeys]; +} +function syncedDirections(axes = "x") { + switch (axes) { + case "x": + return [ChartAxisDirection20.X]; + case "y": + return [ChartAxisDirection20.Y]; + case "xy": + return [ChartAxisDirection20.X, ChartAxisDirection20.Y]; + } +} +function domainChanged(scale2, a, b) { + if (TimeScale2.is(scale2) || UnitTimeScale2.is(scale2)) { + return !arraysEqual( + a.map((x) => x?.valueOf()), + b.map((x) => x?.valueOf()) + ); + } else { + return !arraysEqual(a, b); + } +} +var ChartSync = class extends BaseProperties21 { + constructor(moduleContext) { + super(); + this.moduleContext = moduleContext; + this.enabled = false; + this.axes = "x"; + this.nodeInteraction = true; + this.zoom = true; + this.domainMode = "key"; + this.domainSync = new AsyncAwaitQueue(); + } + updateSiblings(groupId) { + const { syncManager } = this.moduleContext; + for (const chart of syncManager.getGroupSiblings(groupId ?? this.groupId)) { + debug5("ChartSync.updateSiblings()", chart.id, chart); + this.updateChart(chart); + } + } + updateChart(chart, updateType = ChartUpdateType22.PROCESS_DOMAIN) { + debug5("ChartSync.updateChart()", chart.id, ChartUpdateType22[updateType], chart); + if (updateType === ChartUpdateType22.PROCESS_DOMAIN) { + chart.ctx.updateService.update(updateType, { forceNodeDataRefresh: true }); + } else { + chart.ctx.updateService.update(updateType); + } + } + enabledZoomSync() { + const { eventsHub } = this.moduleContext; + this.disableZoomSync?.(); + this.disableZoomSync = eventsHub.on("zoom:change", this.onZoom.bind(this)); + } + onZoom() { + const { syncManager } = this.moduleContext; + for (const chart of syncManager.getGroupSiblings(this.groupId)) { + if (!chart.modulesManager.getModule("sync")?.zoom) + continue; + const zoomModule = chart.modulesManager.getModule("zoom"); + if (!zoomModule) + continue; + const zoom = this.prepareZoomUpdate(); + debug5("ChartsSyncManager.enabledZoomSync()", chart.id, zoom); + zoomModule.updateSyncZoom(zoom); + } + } + enabledNodeInteractionSync() { + this.disableNodeInteractionSync?.(); + this.disableNodeInteractionSync = this.moduleContext.eventsHub.on( + "highlight:change", + this.onHighlightChange.bind(this) + ); + } + onHighlightChange(event) { + const { syncManager } = this.moduleContext; + if (event.callerId.endsWith("-sync")) + return; + debug5("ChartSync.onHighlightChange()", event); + const series = event.currentHighlight?.series; + const [mainDirection] = syncedDirections(this.axes); + const secondaryDirection = mainDirection === ChartAxisDirection20.X ? ChartAxisDirection20.Y : ChartAxisDirection20.X; + const [primaryKeys, secondaryKeys] = series ? getDirectionKeys(series, mainDirection, secondaryDirection) : []; + const datum = readDatum(event.currentHighlight); + let eventValue = primaryKeys?.[0] ? datum?.[primaryKeys[0]] : void 0; + let valueIsDate = false; + if (isDate(eventValue)) { + valueIsDate = true; + eventValue = eventValue.getTime(); + } + if (!event.currentHighlight?.datum) { + for (const chart of syncManager.getGroupSiblings(this.groupId)) { + if (!chart.modulesManager.getModule("sync")?.nodeInteraction) + continue; + chart.ctx.highlightManager.updateHighlight(`${chart.id}-sync`); + chart.ctx.tooltipManager.removeTooltip(`${chart.id}-sync`); + } + return; + } + const useSecondaryDirectionKey = syncManager.getGroupSyncMode(this.groupId) === "multi-series"; + this.findMatchingHighlightNodes( + mainDirection, + secondaryDirection, + useSecondaryDirectionKey ? secondaryKeys : [], + valueIsDate, + eventValue, + event + ); + } + findMatchingHighlightNodes(primaryDirection, secondaryDirection, secondaryKeys, valueIsDate, eventValue, event) { + const { syncManager } = this.moduleContext; + debug5("ChartSync.findMatchingHighlightNodes()", { + mainDirection: primaryDirection, + secondaryKeys + }); + for (const chart of syncManager.getGroupSiblings(this.groupId)) { + if (!chart.modulesManager.getModule("sync")?.nodeInteraction) + continue; + let dispatched = false; + for (const axis of chart.axes) { + if (!CartesianAxis2.is(axis) || axis.direction !== primaryDirection) + continue; + const matchingNodes = chart.series.filter((s) => { + if (!s.visible) + return false; + if (secondaryKeys.length > 0) { + const [, seriesKeys] = getDirectionKeys(s, primaryDirection, secondaryDirection); + return secondaryKeys.every((key) => seriesKeys.includes(key)); + } + return true; + }).map(this.findMatchingNodes(axis, primaryDirection, valueIsDate, eventValue)).filter(isDefined); + if (matchingNodes.length === 1 && matchingNodes[0]?.nodeDatum !== chart.ctx.highlightManager.getActiveHighlight()) { + this.dispatchHighlightUpdate(chart, matchingNodes[0].nodeDatum); + dispatched = true; + break; + } + } + if (!dispatched) { + debug5("ChartSync.findMatchingHighlightNodes() - no matching nodes", chart.id, event); + this.dispatchHighlightUpdate(chart); + } + } + } + findMatchingNodes(axis, mainDirection, valueIsDate, eventValue) { + return (series) => { + const seriesKeys = series.getKeys(axis.direction); + if (axis.keys.length && !axis.keys.some((key) => seriesKeys.includes(key))) + return; + const nodeData = series.contextNodeData?.nodeData ?? []; + if (!nodeData?.length) + return; + const firstNode = nodeData[0]; + const mainDirectionKey = `${mainDirection}Key`; + if (!isObjectWithStringProperty2(firstNode, mainDirectionKey)) + return; + const valueKey = firstNode[mainDirectionKey]; + const nodeDatum = nodeData.find((datum) => { + const nodeValue = datum.datum[valueKey]; + return valueIsDate ? nodeValue.getTime() === eventValue : nodeValue === eventValue; + }); + return nodeDatum ? { series, nodeDatum } : null; + }; + } + dispatchHighlightUpdate(chart, nodeDatum) { + debug5("ChartSync.dispatchHighlightUpdate()", chart.id, nodeDatum); + chart.ctx.highlightManager.updateHighlight(`${chart.id}-sync`, nodeDatum); + const tooltipEnabled = nodeDatum?.series.tooltipEnabled ?? chart.tooltip.enabled; + if (nodeDatum && tooltipEnabled) { + const bbox = chart.seriesAreaBoundingBox; + const canvasX = bbox.x + (nodeDatum.midPoint?.x ?? nodeDatum.point?.x ?? 0); + const canvasY = bbox.y + (nodeDatum.midPoint?.y ?? nodeDatum.point?.y ?? 0); + const tooltipMeta = TooltipManager2.makeTooltipMeta( + { type: "pointermove", canvasX, canvasY }, + nodeDatum.series, + nodeDatum, + void 0 + ); + chart.ctx.tooltipManager.updateTooltip( + `${chart.id}-sync`, + tooltipMeta, + chart.getTooltipContent(nodeDatum.series, nodeDatum.datumIndex, nodeDatum, "tooltip") + ); + } else { + chart.ctx.tooltipManager.removeTooltip(`${chart.id}-sync`); + } + this.updateChart(chart, ChartUpdateType22.SERIES_UPDATE); + } + async getSyncedDomain(axis) { + if (!CartesianAxis2.is(axis) || this.axes !== "xy" && this.axes !== axis.direction) { + return; + } + const { groupState, directionDomains, domainsByKey, positionDomains } = this.updateDomainState(axis); + this.validateAxis(axis, groupState); + await this.waitForDomainsToBeReady(); + if (this.domainMode === "position") { + return this.calculateDerivedDomain(axis, positionDomains); + } + if (this.domainMode === "direction" || axis.keys.length === 0) { + return this.calculateDerivedDomain(axis, directionDomains); + } + return this.calculateKeyDerivedDomain(axis, domainsByKey); + } + updateDomainState(axis) { + var _a, _b, _c, _d, _e; + const { syncManager } = this.moduleContext; + const chartId = syncManager.getChart().id; + const axisId = axis.id; + const groupState = syncManager.getGroupState(this.groupId); + if (!groupState) + throw new Error("AG Charts - no GroupState for groupId: " + this.groupId); + const domainsByDirection = groupState.domains ?? (groupState.domains = {}); + const directionDomains = domainsByDirection[_a = axis.direction] ?? (domainsByDirection[_a] = { derived: [], sources: {}, dirty: true }); + const chartDirectionDomains = (_b = directionDomains.sources)[chartId] ?? (_b[chartId] = {}); + chartDirectionDomains[axisId] = axis.dataDomain.domain; + directionDomains.dirty = true; + const domainsByKey = groupState.domainsByKey ?? (groupState.domainsByKey = {}); + for (const key of axis.keys ?? []) { + const keyDomains = domainsByKey[key] ?? (domainsByKey[key] = { derived: [], sources: {}, dirty: true }); + const chartKeyDomains = (_c = keyDomains.sources)[chartId] ?? (_c[chartId] = {}); + chartKeyDomains[axisId] = axis.dataDomain.domain; + keyDomains.dirty = true; + } + const domainsByPosition = groupState.domainsByPosition ?? (groupState.domainsByPosition = {}); + const positionDomains = domainsByPosition[_d = axis.position] ?? (domainsByPosition[_d] = { derived: [], sources: {}, dirty: true }); + const chartPositionDomains = (_e = positionDomains.sources)[chartId] ?? (_e[chartId] = {}); + chartPositionDomains[axisId] = axis.dataDomain.domain; + positionDomains.dirty = true; + return { groupState, directionDomains, domainsByKey, positionDomains }; + } + validateAxis(axis, groupState) { + const multiSeries = this.moduleContext.syncManager.getGroupSyncMode(this.groupId) === "multi-series"; + if (!syncedDirections(this.axes).includes(axis.direction)) + return; + if (multiSeries) { + this.validateMultiSeries(axis, groupState); + } else { + this.validateSingleSeries(axis, groupState); + } + } + validateMultiSeries(axis, groupState) { + const { min, max, nice, reverse } = axis; + const matchingKeys = new Set(axis.boundSeries.flatMap((s) => s.getKeys(axis.direction))); + for (const member of groupState.members) { + const { axes, modulesManager } = member; + const memberSyncDirections = syncedDirections(modulesManager.getModule("sync")?.axes); + const keyMatchedAxes = axes.filter((a) => memberSyncDirections.includes(a.direction)).filter((a) => a.boundSeries.some((s) => s.getKeys(a.direction).some((k) => matchingKeys.has(k)))); + if (keyMatchedAxes.length === 0) + continue; + const [firstAxis] = keyMatchedAxes; + if (firstAxis.min !== min || firstAxis.max !== max || firstAxis.nice !== nice || firstAxis.reverse !== reverse) { + logger_exports.warnOnce( + "To allow synchronization, ensure that all synchronized axes with matching keys have matching min, max, nice, and reverse properties." + ); + this.enabled = false; + return; + } + } + } + validateSingleSeries(axis, groupState) { + const members = groupState.members; + const [{ axes: syncAxes }] = members; + const { direction, min, max, nice, reverse } = axis; + for (const nextAxis of syncAxes) { + if (direction !== nextAxis.direction) + continue; + if (nice !== nextAxis.nice || reverse !== nextAxis.reverse || min !== nextAxis.min && (isFiniteNumber(min) || isFiniteNumber(nextAxis.min)) || max !== nextAxis.max && (isFiniteNumber(max) || isFiniteNumber(nextAxis.max))) { + logger_exports.warnOnce( + "To allow synchronization, ensure that all charts have matching min, max, nice, and reverse properties on the synchronized axes." + ); + this.enabled = false; + return; + } + } + } + calculateDerivedDomain(axis, directionDomains) { + if (!directionDomains.dirty) + return directionDomains.derived; + const previousDerived = directionDomains.derived; + directionDomains.derived = unique( + Object.values(directionDomains.sources).map((d) => Object.values(d)).flat(2) + ); + if (ContinuousScale6.is(axis.scale)) { + directionDomains.derived = findMinMax4(directionDomains.derived); + } + directionDomains.dirty = false; + if (domainChanged(axis.scale, previousDerived, directionDomains.derived)) { + debug5(axis.id, "updated", axis.keys, { before: previousDerived, after: directionDomains.derived }); + this.updateSiblings(); + } + return directionDomains.derived; + } + calculateKeyDerivedDomain(axis, domainsByKey) { + let previousDerived = []; + let newDerived = []; + let updated = false; + for (const key of axis.keys ?? []) { + const keyDomains = domainsByKey[key]; + const previousDerivedForKey = keyDomains.derived; + previousDerived.push(...previousDerivedForKey); + if (!keyDomains.dirty) { + newDerived.push(...keyDomains.derived); + continue; + } + keyDomains.derived = unique( + Object.values(keyDomains.sources).map((d) => Object.values(d)).flat(2) + ); + if (ContinuousScale6.is(axis.scale)) { + keyDomains.derived = findMinMax4(keyDomains.derived); + } + newDerived.push(...keyDomains.derived); + keyDomains.dirty = false; + updated || (updated = !arraysEqual(previousDerivedForKey, keyDomains.derived)); + } + if (ContinuousScale6.is(axis.scale)) { + previousDerived = findMinMax4(previousDerived); + newDerived = findMinMax4(newDerived); + } + if (updated && domainChanged(axis.scale, previousDerived, newDerived)) { + debug5(axis.id, "updated", axis.keys, { before: previousDerived, after: newDerived }); + this.updateSiblings(); + } + return newDerived; + } + removeAxis(axis) { + if (!CartesianAxis2.is(axis) || this.axes !== "xy" && this.axes !== axis.direction) { + return; + } + const { syncManager } = this.moduleContext; + const syncGroup = syncManager.getGroupState(this.groupId); + const chartId = syncManager.getChart().id; + const axisId = axis.id; + delete syncGroup?.domains?.[axis.direction]?.sources?.[chartId]?.[axisId]; + for (const key of axis.keys ?? []) { + delete syncGroup?.domainsByKey?.[key]?.sources?.[chartId]?.[axisId]; + } + delete syncGroup?.domainsByPosition?.[axis.position]?.sources?.[chartId]?.[axisId]; + } + async waitForDomainsToBeReady() { + const { syncManager } = this.moduleContext; + let count = 0; + while (syncManager.getGroupMembers(this.groupId).some((c) => c.syncStatus === "init")) { + debug5("ChartSync.waitForDomainsToBeReady() - waiting for all domains to be calculated", this.groupId); + await this.domainSync.await(); + count++; + } + if (count > 0) { + debug5("ChartSync.waitForDomainsToBeReady() - waited for", count, "iterations"); + } + this.domainSync.notify(); + } + prepareZoomUpdate() { + const { zoomManager } = this.moduleContext; + const zoom = zoomManager.getZoom(); + if (this.axes === "x") { + delete zoom?.y; + } else if (this.axes === "y") { + delete zoom?.x; + } + return definedZoomState(zoom); + } + onEnabledChange() { + const { syncManager } = this.moduleContext; + if (this.enabled) { + syncManager.subscribe(this.groupId); + } else { + syncManager.unsubscribe(this.groupId); + } + this.updateSiblings(); + this.onNodeInteractionChange(); + this.onZoomChange(); + } + onGroupIdChange(newValue, oldValue) { + if (!this.enabled || newValue === oldValue) + return; + const { syncManager } = this.moduleContext; + syncManager.unsubscribe(oldValue); + syncManager.subscribe(newValue); + this.updateSiblings(oldValue); + this.updateSiblings(newValue); + } + onAxesChange() { + if (!this.enabled) + return; + const { syncManager } = this.moduleContext; + this.updateChart(syncManager.getChart()); + } + onNodeInteractionChange() { + if (this.enabled && this.nodeInteraction) { + this.enabledNodeInteractionSync(); + } else { + this.disableNodeInteractionSync?.(); + } + } + onZoomChange() { + if (this.enabled && this.zoom) { + this.enabledZoomSync(); + } else { + this.disableZoomSync?.(); + } + } + destroy() { + const { syncManager } = this.moduleContext; + syncManager.unsubscribe(this.groupId); + this.updateSiblings(); + this.disableZoomSync?.(); + } +}; +ChartSync.className = "Sync"; +__decorateClass2([ + Property59, + ObserveChanges4((target) => target.onEnabledChange()) +], ChartSync.prototype, "enabled", 2); +__decorateClass2([ + Property59, + ObserveChanges4((target, newValue, oldValue) => target.onGroupIdChange(newValue, oldValue)) +], ChartSync.prototype, "groupId", 2); +__decorateClass2([ + Property59, + ObserveChanges4((target) => target.onAxesChange()) +], ChartSync.prototype, "axes", 2); +__decorateClass2([ + Property59, + ObserveChanges4((target) => target.onNodeInteractionChange()) +], ChartSync.prototype, "nodeInteraction", 2); +__decorateClass2([ + Property59, + ObserveChanges4((target) => target.onZoomChange()) +], ChartSync.prototype, "zoom", 2); +__decorateClass2([ + Property59, + ObserveChanges4((target) => target.onAxesChange()) +], ChartSync.prototype, "domainMode", 2); +var SyncModule = { + type: "root", + optionsKey: "sync", + packageType: "enterprise", + chartTypes: ["cartesian"], + moduleFactory: (ctx) => new ChartSync(ctx), + themeTemplate: { + sync: { enabled: false } + } +}; +var { Property: Property60 } = module_support_exports; +var VALID_COLOR = "#2196f3"; +var INVALID_COLOR = "#8a8a8a"; +var ZoomRect = class extends module_support_exports.Rect { + constructor() { + super(...arguments); + this.fill = VALID_COLOR; + this.fillOpacity = 0.2; + this.zIndex = module_support_exports.ZIndexMap.ZOOM_SELECTION; + } + updateValid() { + this.fill = VALID_COLOR; + } + updateInvalid() { + this.fill = INVALID_COLOR; + } +}; +ZoomRect.className = "ZoomRect"; +__decorateClass2([ + Property60 +], ZoomRect.prototype, "fill", 2); +__decorateClass2([ + Property60 +], ZoomRect.prototype, "fillOpacity", 2); +var ZoomAxisDragger = class { + update(event, direction, anchor, bbox, zoom, axisZoom) { + this.oldZoom ?? (this.oldZoom = definedZoomState( + direction === module_support_exports.ChartAxisDirection.X ? { ...zoom, x: axisZoom } : { ...zoom, y: axisZoom } + )); + this.updateCoords(event.offsetX, event.offsetY); + return this.updateZoom(direction, anchor, bbox); + } + stop() { + this.coords = void 0; + this.oldZoom = void 0; + } + updateCoords(x, y) { + if (this.coords) { + this.coords.x2 = x; + this.coords.y2 = y; + } else { + this.coords = { x1: x, y1: y, x2: x, y2: y }; + } + } + updateZoom(direction, anchor, bbox) { + const { coords, oldZoom } = this; + let newZoom = definedZoomState(oldZoom); + if (!coords || !oldZoom) { + if (direction === module_support_exports.ChartAxisDirection.X) + return newZoom.x; + return newZoom.y; + } + const origin3 = pointToRatio(bbox, coords.x1, coords.y1); + const target = pointToRatio(bbox, coords.x2, coords.y2); + if (direction === module_support_exports.ChartAxisDirection.X) { + const scaleX = (target.x - origin3.x) * dx(oldZoom); + newZoom.x.max += scaleX; + newZoom.x = scaleZoomAxisWithAnchor(newZoom.x, oldZoom.x, anchor, origin3.x); + newZoom = constrainZoom(newZoom); + return newZoom.x; + } + const scaleY = (target.y - origin3.y) * dy(oldZoom); + newZoom.y.max -= scaleY; + newZoom.y = scaleZoomAxisWithAnchor(newZoom.y, oldZoom.y, anchor, origin3.y); + newZoom = constrainZoom(newZoom); + return newZoom.y; + } +}; +var ZoomContextMenu = class { + constructor(eventsHub, contextMenuRegistry, zoomManager, getModuleProperties, canResetZoom, getRect, updateZoom, isZoomValid) { + this.eventsHub = eventsHub; + this.contextMenuRegistry = contextMenuRegistry; + this.zoomManager = zoomManager; + this.getModuleProperties = getModuleProperties; + this.canResetZoom = canResetZoom; + this.getRect = getRect; + this.updateZoom = updateZoom; + this.isZoomValid = isZoomValid; + } + registerActions(enabled) { + const { contextMenuRegistry } = this; + const action = enabled ? "show" : "hide"; + contextMenuRegistry.toggle("zoom-to-cursor", action); + contextMenuRegistry.toggle("pan-to-cursor", action); + contextMenuRegistry.toggle("reset-zoom", action); + if (!enabled) { + return; + } + contextMenuRegistry.builtins.items["zoom-to-cursor"].action = this.onZoomToHere.bind(this); + contextMenuRegistry.builtins.items["pan-to-cursor"].action = this.onPanToHere.bind(this); + contextMenuRegistry.builtins.items["reset-zoom"].action = this.onResetZoom.bind(this); + const shouldEnableZoomToHere = (event) => { + const rect2 = this.getRect(); + if (!rect2) + return true; + const origin3 = pointToRatio(rect2, event.x, event.y); + return this.iterateFindNextZoomAtPoint(origin3) != null; + }; + const shouldEnablePanToHere = () => { + return !isZoomEqual(definedZoomState(this.zoomManager.getZoom()), unitZoomState()); + }; + const removeListener = this.eventsHub.on("context-menu:setup", (event) => { + contextMenuRegistry.builtins.items["zoom-to-cursor"].enabled = shouldEnableZoomToHere(event); + contextMenuRegistry.builtins.items["pan-to-cursor"].enabled = shouldEnablePanToHere(); + contextMenuRegistry.builtins.items["reset-zoom"].enabled = this.canResetZoom(); + }); + return () => { + removeListener(); + contextMenuRegistry.toggle("zoom-to-cursor", "hide"); + contextMenuRegistry.toggle("pan-to-cursor", "hide"); + contextMenuRegistry.toggle("reset-zoom", "hide"); + }; + } + computeOrigin(event) { + const rect2 = this.getRect(); + const { enabled } = this.getModuleProperties(); + if (!enabled || !rect2 || !event?.target || !(event instanceof MouseEvent)) + return; + const relativeRect = { x: 0, y: 0, width: rect2.width, height: rect2.height }; + return pointToRatio(relativeRect, event.offsetX, event.offsetY); + } + onZoomToHere({ event }) { + const origin3 = this.computeOrigin(event); + if (!origin3) + return; + const zoom = this.iterateFindNextZoomAtPoint(origin3); + if (zoom == null) + return; + this.updateZoom(zoom); + } + onPanToHere({ event }) { + const origin3 = this.computeOrigin(event); + if (!origin3) + return; + const zoom = definedZoomState(this.zoomManager.getZoom()); + const scaleX = dx(zoom); + const scaleY = dy(zoom); + const scaledOriginX = origin3.x * scaleX; + const scaledOriginY = origin3.y * scaleY; + const halfSize = UNIT_SIZE / 2; + let newZoom = { + x: { min: origin3.x - halfSize, max: origin3.x + halfSize }, + y: { min: origin3.y - halfSize, max: origin3.y + halfSize } + }; + newZoom = scaleZoomCenter(newZoom, scaleX, scaleY); + newZoom = translateZoom(newZoom, zoom.x.min - origin3.x + scaledOriginX, zoom.y.min - origin3.y + scaledOriginY); + this.updateZoom(constrainZoom(newZoom)); + } + onResetZoom(_actionEvent) { + this.zoomManager.resetZoom("zoom"); + } + iterateFindNextZoomAtPoint(origin3) { + const { scrollingStep } = this.getModuleProperties(); + for (let i = scrollingStep; i <= 1 - scrollingStep; i += scrollingStep) { + const zoom = this.getNextZoomAtPoint(origin3, i); + if (this.isZoomValid(zoom)) { + return zoom; + } + } + } + getNextZoomAtPoint(origin3, step) { + const { isScalingX, isScalingY } = this.getModuleProperties(); + const zoom = definedZoomState(this.zoomManager.getZoom()); + const scaledOriginX = origin3.x * dx(zoom); + const scaledOriginY = origin3.y * dy(zoom); + const halfSize = UNIT_SIZE / 2; + let newZoom = { + x: { min: origin3.x - halfSize, max: origin3.x + halfSize }, + y: { min: origin3.y - halfSize, max: origin3.y + halfSize } + }; + newZoom = scaleZoomCenter( + newZoom, + isScalingX ? dx(zoom) * step : UNIT_SIZE, + isScalingY ? dy(zoom) * step : UNIT_SIZE + ); + newZoom = translateZoom(newZoom, zoom.x.min - origin3.x + scaledOriginX, zoom.y.min - origin3.y + scaledOriginY); + return constrainZoom(newZoom); + } +}; +var { ChartAxisDirection: ChartAxisDirection21 } = module_support_exports; +var ZoomDOMProxy = class { + constructor(axesHandlers) { + this.axesHandlers = axesHandlers; + this.axes = []; + this.overlappingAxisIds = /* @__PURE__ */ new Set(); + } + destroy() { + for (const a of this.axes) { + a.div.destroy(); + } + } + update(enableAxisDragging, enableAxisScrolling, ctx, seriesRect) { + this.seriesRect = seriesRect; + for (const ax of this.axes) { + ax.div.setHidden(!enableAxisDragging && !enableAxisScrolling); + } + if (!enableAxisDragging && !enableAxisScrolling) + return; + const { X, Y } = ChartAxisDirection21; + const axesCtx = [...ctx.axisManager.getAxisContext(X), ...ctx.axisManager.getAxisContext(Y)]; + const { removed, added } = this.diffAxisIds(axesCtx); + if (removed.length > 0) { + this.axes = this.axes.filter((entry) => { + if (removed.includes(entry.axisId)) { + entry.div.destroy(); + this.overlappingAxisIds.delete(entry.axisId); + if (this.hoveredAxisId === entry.axisId) + this.hoveredAxisId = void 0; + if (this.activeAxisId === entry.axisId) + this.activeAxisId = void 0; + return false; + } + return true; + }); + } + for (const newAxisCtx of added) { + const { axisId, direction } = newAxisCtx; + this.axes.push(this.initAxis(ctx, axisId, this.axesHandlers, direction)); + } + for (const axis of this.axes) { + const axisCtx = axesCtx.find((ac) => ac.axisId === axis.axisId); + const bbox = axisCtx.getCanvasBounds(); + axis.div.setHidden(boxEmpty(bbox)); + if (bbox == void 0) { + axis.bounds = void 0; + } else { + axis.div.setBounds(bbox); + axis.bounds = new module_support_exports.BBox(bbox.x, bbox.y, bbox.width, bbox.height); + } + } + this.updateOverlappingAxisPointerEvents(enableAxisDragging, enableAxisScrolling); + } + setAxisCursor(cursor) { + this.cursor = cursor; + for (const axis of this.axes) { + axis.div.setCursor(this.getCursor(axis.direction)); + } + } + toggleAxisDraggingCursor(direction, enabled) { + for (const axis of this.axes) { + if (axis.direction !== direction) + continue; + axis.div.setCursor(enabled ? this.getCursor(direction) : void 0); + } + } + updateOverlappingAxisPointerEvents(enableAxisDragging, enableAxisScrolling) { + this.overlappingAxisIds.clear(); + const shouldEnableInteraction = (enableAxisDragging || enableAxisScrolling) && this.seriesRect; + for (const axis of this.axes) { + if (!shouldEnableInteraction) { + axis.div.setPointerEvents(void 0); + continue; + } + const isOverlapping = Boolean(axis.bounds?.collidesBBox(this.seriesRect)); + if (isOverlapping) { + this.overlappingAxisIds.add(axis.axisId); + axis.div.setPointerEvents("none"); + } else { + axis.div.setPointerEvents(void 0); + } + } + this.cleanupAxisState(); + } + cleanupAxisState() { + if (this.hoveredAxisId && !this.overlappingAxisIds.has(this.hoveredAxisId)) { + this.hoveredAxisId = void 0; + } + if (this.activeAxisId && !this.overlappingAxisIds.has(this.activeAxisId)) { + this.activeAxisId = void 0; + } + } + pickAxisAtPoint(x, y) { + for (const axis of this.axes) { + if (!this.overlappingAxisIds.has(axis.axisId)) + continue; + if (axis.bounds?.containsPoint(x, y)) { + return { axisId: axis.axisId, direction: axis.direction }; + } + } + return void 0; + } + setHoveredAxis(axisId) { + if (this.overlappingAxisIds.has(axisId)) { + this.hoveredAxisId = axisId; + } + } + clearHoveredAxis() { + if (!this.activeAxisId) { + this.hoveredAxisId = void 0; + } + } + beginDelegatedAxisDrag(axisId) { + if (!this.overlappingAxisIds.has(axisId)) + return false; + this.activeAxisId = axisId; + this.hoveredAxisId = void 0; + return true; + } + endDelegatedAxisDrag(axisId) { + if (this.activeAxisId === axisId) { + this.activeAxisId = void 0; + } + this.hoveredAxisId = void 0; + } + hasOverlappingAxes() { + return this.overlappingAxisIds.size > 0; + } + getHoveredAxis() { + if (!this.hoveredAxisId) + return void 0; + const axis = this.axes.find((a) => a.axisId === this.hoveredAxisId); + return axis ? { axisId: axis.axisId, direction: axis.direction } : void 0; + } + getCursor(direction) { + if (this.cursor) + return this.cursor; + return direction === ChartAxisDirection21.X ? "ew-resize" : "ns-resize"; + } + initAxis(ctx, axisId, handlers, direction) { + const where = "afterend"; + const div = ctx.proxyInteractionService.createProxyElement({ type: "region", domManagerId: axisId, where }); + div.setCursor(this.getCursor(direction)); + div.addListener("drag-start", (e) => { + if (e.device === "touch") { + e.sourceEvent.preventDefault(); + } + this.activeAxisId = axisId; + handlers.onAxisDragStart(direction); + }); + div.addListener("drag-move", (event) => handlers.onAxisDragMove(axisId, direction, event)); + div.addListener("drag-end", () => { + this.activeAxisId = void 0; + this.hoveredAxisId = void 0; + handlers.onAxisDragEnd(); + }); + div.addListener("dblclick", () => handlers.onAxisDoubleClick(axisId, direction)); + div.addListener("wheel", (event) => handlers.onAxisWheel(axisId, direction, event)); + return { axisId, div, direction }; + } + diffAxisIds(axesCtx) { + const myIds = this.axes.map((entry) => entry.axisId); + const ctxIds = axesCtx.map((ctx) => ctx.axisId); + const removed = myIds.filter((id) => !ctxIds.includes(id)); + const added = axesCtx.filter((ac) => !myIds.includes(ac.axisId)); + return { removed, added }; + } +}; +var maxZoomCoords = 16; +var decelerationValues = { + off: 1, + short: 0.01, + long: 2e-3 +}; +var ZoomPanner = class { + constructor() { + this.deceleration = 1; + this.zoomCoordsHistoryIndex = 0; + this.coordsHistory = []; + } + get decelerationValue() { + const { deceleration } = this; + return Math.max( + typeof deceleration === "number" ? deceleration : decelerationValues[deceleration] ?? 1, + 1e-4 + ); + } + addListener(_type, fn) { + this.onUpdate = fn; + return () => { + this.onUpdate = void 0; + }; + } + stopInteractions() { + if (this.inertiaHandle != null) { + cancelAnimationFrame(this.inertiaHandle); + this.inertiaHandle = void 0; + } + } + update(event) { + this.updateCoords(event.currentX, event.currentY); + const { x1 = 0, y1 = 0, x2 = 0, y2 = 0 } = this.coords ?? {}; + this.onUpdate?.({ + type: "update", + deltaX: this.isPanningX() ? x1 - x2 : 0, + deltaY: this.isPanningY() ? y1 - y2 : 0 + }); + } + start(direction) { + this.direction = direction; + this.coordsMonitorTimeout = setInterval(this.recordCurrentZoomCoords.bind(this), 16); + } + stop() { + const { coordsHistory } = this; + let deltaX = 0; + let deltaY = 0; + let deltaT = 0; + if (coordsHistory.length > 0) { + const arrayIndex = this.zoomCoordsHistoryIndex % maxZoomCoords; + let index1 = arrayIndex - 1; + if (index1 < 0) + index1 = coordsHistory.length - 1; + let index0 = arrayIndex; + if (index0 >= coordsHistory.length) + index0 = 0; + const coords1 = coordsHistory[index1]; + const coords0 = coordsHistory[index0]; + deltaX = this.isPanningX() ? coords1.x - coords0.x : 0; + deltaY = this.isPanningY() ? coords1.y - coords0.y : 0; + deltaT = coords1.t - coords0.t; + } + this.coords = void 0; + this.direction = void 0; + clearInterval(this.coordsMonitorTimeout); + this.coordsMonitorTimeout = void 0; + this.zoomCoordsHistoryIndex = 0; + this.coordsHistory.length = 0; + if (deltaT > 0 && this.decelerationValue < 1) { + const xVelocity = deltaX / deltaT; + const yVelocity = deltaY / deltaT; + const velocity = Math.hypot(xVelocity, yVelocity); + const angle2 = Math.atan2(yVelocity, xVelocity); + const t0 = performance.now(); + this.inertiaHandle = getWindow().requestAnimationFrame((t) => { + this.animateInertia(t, t, t0, velocity, angle2); + }); + } + } + recordCurrentZoomCoords() { + const { coords, coordsHistory, zoomCoordsHistoryIndex } = this; + if (!coords) + return; + const { x2: x, y2: y } = coords; + const t = Date.now(); + coordsHistory[zoomCoordsHistoryIndex % maxZoomCoords] = { x, y, t }; + this.zoomCoordsHistoryIndex += 1; + } + animateInertia(t, prevT, t0, velocity, angle2) { + const friction = 1 - this.decelerationValue; + const maxS = -velocity / Math.log(friction); + const s0 = velocity * (friction ** (prevT - t0) - 1) / Math.log(friction); + const s1 = velocity * (friction ** (t - t0) - 1) / Math.log(friction); + this.onUpdate?.({ + type: "update", + deltaX: this.isPanningX() ? -Math.cos(angle2) * (s1 - s0) : 0, + deltaY: this.isPanningY() ? -Math.sin(angle2) * (s1 - s0) : 0 + }); + if (s1 >= maxS - 1) + return; + this.inertiaHandle = requestAnimationFrame((nextT) => { + this.animateInertia(nextT, t, t0, velocity, angle2); + }); + } + updateCoords(x, y) { + if (this.coords) { + this.coords = { x1: this.coords.x2, y1: this.coords.y2, x2: x, y2: y }; + } else { + this.coords = { x1: x, y1: y, x2: x, y2: y }; + } + } + isPanningX() { + return this.direction == null || this.direction === module_support_exports.ChartAxisDirection.X; + } + isPanningY() { + return this.direction == null || this.direction === module_support_exports.ChartAxisDirection.Y; + } + translateZooms(bbox, currentZooms, deltaX, deltaY) { + const offset = pointToRatio(bbox, bbox.x + Math.abs(deltaX), bbox.y + bbox.height - Math.abs(deltaY)); + const offsetX = Math.sign(deltaX) * offset.x; + const offsetY = -Math.sign(deltaY) * offset.y; + const newZooms = {}; + for (const [axisId, { direction, zoom: currentZoom }] of entries(currentZooms)) { + if (currentZoom && currentZoom.min === UNIT_MIN && currentZoom.max === UNIT_MAX) { + continue; + } + let zoom = definedZoomState({ [direction]: currentZoom }); + zoom = constrainZoom(translateZoom(zoom, offsetX * dx(zoom), offsetY * dy(zoom))); + newZooms[axisId] = { direction, zoom: zoom[direction] }; + } + return newZooms; + } +}; +var DELTA_SCALE = 200; +var ZoomScrollPanner = class { + update(event, step, bbox, zooms) { + const deltaX = event.deltaX * step * DELTA_SCALE; + return this.translateZooms(bbox, zooms, deltaX); + } + translateZooms(bbox, currentZooms, deltaX) { + const newZooms = {}; + const offset = pointToRatio(bbox, bbox.x + Math.abs(deltaX), 0); + const offsetX = deltaX < 0 ? -offset.x : offset.x; + for (const [axisId, { direction, zoom: currentZoom }] of entries(currentZooms)) { + if (direction !== module_support_exports.ChartAxisDirection.X) + continue; + let zoom = definedZoomState({ x: currentZoom }); + zoom = constrainZoom(translateZoom(zoom, offsetX * dx(zoom), 0)); + newZooms[axisId] = { direction, zoom: zoom.x }; + } + return newZooms; + } +}; +var ZoomScroller = class { + updateAxes(event, props, bbox, zooms) { + const sourceEvent = event.sourceEvent; + const newZooms = {}; + const { anchorPointX, anchorPointY, isScalingX, isScalingY, scrollingStep } = props; + const origin3 = pointToRatio( + bbox, + sourceEvent.offsetX ?? sourceEvent.clientX, + sourceEvent.offsetY ?? sourceEvent.clientY + ); + for (const [axisId, { direction, zoom }] of entries(zooms)) { + if (zoom == null) + continue; + let newZoom = { ...zoom }; + const delta32 = scrollingStep * event.deltaY * (zoom.max - zoom.min); + if (direction === module_support_exports.ChartAxisDirection.X && isScalingX) { + newZoom.max += delta32; + newZoom = scaleZoomAxisWithAnchor(newZoom, zoom, anchorPointX, origin3.x); + } else if (direction === module_support_exports.ChartAxisDirection.Y && isScalingY) { + newZoom.max += delta32; + newZoom = scaleZoomAxisWithAnchor(newZoom, zoom, anchorPointY, origin3.y); + } else { + continue; + } + if (newZoom.max < newZoom.min) + continue; + newZooms[axisId] = { direction, zoom: constrainAxis(newZoom) }; + } + return newZooms; + } + update(event, props, bbox, oldZoom) { + const { anchorPointX, anchorPointY, isScalingX, isScalingY, scrollingStep } = props; + const canvasX = event.offsetX + bbox.x; + const canvasY = event.offsetY + bbox.y; + const origin3 = pointToRatio(bbox, canvasX, canvasY); + const dir = event.deltaY; + let newZoom = definedZoomState(oldZoom); + newZoom.x.max += isScalingX ? scrollingStep * dir * dx(oldZoom) : 0; + newZoom.y.max += isScalingY ? scrollingStep * dir * dy(oldZoom) : 0; + if (newZoom.x.max < newZoom.x.min || newZoom.y.max < newZoom.y.min) + return; + if (isScalingX) { + newZoom.x = scaleZoomAxisWithAnchor(newZoom.x, oldZoom.x, anchorPointX, origin3.x); + } + if (isScalingY) { + newZoom.y = scaleZoomAxisWithAnchor(newZoom.y, oldZoom.y, anchorPointY, origin3.y); + } + newZoom = constrainZoom(newZoom); + return newZoom; + } + updateDelta(delta32, props, oldZoom) { + const { anchorPointX, anchorPointY, isScalingX, isScalingY, scrollingStep } = props; + let newZoom = definedZoomState(oldZoom); + newZoom.x.max += isScalingX ? scrollingStep * -delta32 * dx(oldZoom) : 0; + newZoom.y.max += isScalingY ? scrollingStep * -delta32 * dy(oldZoom) : 0; + if (isScalingX) { + newZoom.x = scaleZoomAxisWithAnchor(newZoom.x, oldZoom.x, anchorPointX); + } + if (isScalingY) { + newZoom.y = scaleZoomAxisWithAnchor(newZoom.y, oldZoom.y, anchorPointY); + } + newZoom = constrainZoom(newZoom); + return newZoom; + } +}; +var ZoomSelector = class { + constructor(rect2, getZoom, isZoomValid) { + this.rect = rect2; + this.getZoom = getZoom; + this.isZoomValid = isZoomValid; + this.rect.visible = false; + } + update(event, props, bbox) { + const canvasX = event.currentX + (bbox?.x ?? 0); + const canvasY = event.currentY + (bbox?.y ?? 0); + this.rect.visible = true; + this.updateCoords(canvasX, canvasY, props, bbox); + this.updateRect(bbox); + } + stop(innerBBox, bbox, currentZoom) { + let zoom = definedZoomState(); + if (!innerBBox || !bbox) + return zoom; + if (this.coords) { + zoom = this.createZoomFromCoords(bbox, currentZoom); + } + const multiplyX = bbox.width / innerBBox.width; + const multiplyY = bbox.height / innerBBox.height; + zoom = constrainZoom(multiplyZoom(zoom, multiplyX, multiplyY)); + this.reset(); + return zoom; + } + reset() { + this.coords = void 0; + this.rect.visible = false; + } + didUpdate() { + return this.rect.visible && this.rect.width > 0 && this.rect.height > 0; + } + updateCoords(x, y, props, bbox) { + if (!this.coords) { + this.coords = { x1: x, y1: y, x2: x, y2: y }; + return; + } + const { coords } = this; + coords.x2 = x; + coords.y2 = y; + if (!bbox) + return; + const { isScalingX, isScalingY, keepAspectRatio } = props; + const normal = this.getNormalisedDimensions(); + if (keepAspectRatio && isScalingX && isScalingY) { + const aspectRatio = bbox.width / bbox.height; + if (coords.y2 < coords.y1) { + coords.y2 = Math.min(coords.y1 - normal.width / aspectRatio, coords.y1); + } else { + coords.y2 = Math.max(coords.y1 + normal.width / aspectRatio, coords.y1); + } + } + if (!isScalingX) { + coords.x1 = bbox.x; + coords.x2 = bbox.x + bbox.width; + } + if (!isScalingY) { + coords.y1 = bbox.y; + coords.y2 = bbox.y + bbox.height; + } + } + updateRect(bbox) { + if (!bbox) + return; + const { rect: rect2 } = this; + const normal = this.getNormalisedDimensions(); + const { width: width2, height: height2 } = normal; + let { x, y } = normal; + x = Math.max(x, bbox.x); + x -= Math.max(0, x + width2 - (bbox.x + bbox.width)); + y = Math.max(y, bbox.y); + y -= Math.max(0, y + height2 - (bbox.y + bbox.height)); + rect2.x = x; + rect2.y = y; + rect2.width = width2; + rect2.height = height2; + const zoom = this.createZoomFromCoords(bbox, this.getZoom()); + if (this.isZoomValid(zoom)) { + rect2.updateValid(); + } else { + rect2.updateInvalid(); + } + } + createZoomFromCoords(bbox, currentZoom) { + const oldZoom = definedZoomState(currentZoom); + const normal = this.getNormalisedDimensions(); + const origin3 = pointToRatio(bbox, normal.x, normal.y + normal.height); + const xFactor = normal.width / bbox.width; + const yFactor = normal.height / bbox.height; + let newZoom = scaleZoom(oldZoom, xFactor, yFactor); + const translateX = origin3.x * dx(oldZoom); + const translateY = origin3.y * dy(oldZoom); + newZoom = translateZoom(newZoom, translateX, translateY); + newZoom = constrainZoom(newZoom); + return newZoom; + } + getNormalisedDimensions() { + const { x1 = 0, y1 = 0, x2 = 0, y2 = 0 } = this.coords ?? {}; + const x = Math.min(x1, x2); + const y = Math.min(y1, y2); + const width2 = x1 <= x2 ? x2 - x1 : x1 - x2; + const height2 = y1 <= y2 ? y2 - y1 : y1 - y2; + return { x, y, width: width2, height: height2 }; + } +}; +var { + ActionOnSet: ActionOnSet8, + BaseProperties: BaseProperties222, + ChartAxisDirection: ChartAxisDirection222, + NativeWidget: NativeWidget22, + PropertiesArray: PropertiesArray6, + Toolbar: Toolbar22, + ToolbarButtonProperties: ToolbarButtonProperties4, + Property: Property61 +} = module_support_exports; +var ZoomButtonProperties = class extends ToolbarButtonProperties4 { +}; +__decorateClass2([ + Property61 +], ZoomButtonProperties.prototype, "value", 2); +__decorateClass2([ + Property61 +], ZoomButtonProperties.prototype, "section", 2); +var ZoomToolbar = class extends BaseProperties222 { + constructor(ctx, getModuleProperties, canResetZoom, updateZoom, updateAxisZoom, resetZoom, isZoomValid) { + super(); + this.ctx = ctx; + this.getModuleProperties = getModuleProperties; + this.canResetZoom = canResetZoom; + this.updateZoom = updateZoom; + this.updateAxisZoom = updateAxisZoom; + this.resetZoom = resetZoom; + this.isZoomValid = isZoomValid; + this.enabled = false; + this.buttons = new PropertiesArray6(ZoomButtonProperties); + this.visible = "hover"; + this.verticalSpacing = 10; + this.detectionRange = 38; + this.cleanup = new CleanupRegistry(); + this.toggleButtonsDebounced = debounce(this.toggleButtons.bind(this), ZOOM_VALID_CHECK_DEBOUNCE, { + leading: true, + trailing: true + }); + this.container = new NativeWidget22(createElement("div")); + this.container.addClass("ag-charts-zoom-buttons"); + ctx.domManager.addChild("canvas-overlay", "zoom-buttons", this.container.getElement()); + this.toolbar = new Toolbar22(ctx, "ariaLabelZoomToolbar", "horizontal"); + this.container.addChild(this.toolbar); + this.toolbar.getElement().style.transform = `translateY(54px)`; + this.toggleVisibility(this.visible === "always"); + this.cleanup.register( + this.toolbar.addToolbarListener("button-pressed", this.onButtonPress.bind(this)), + this.toolbar.addToolbarListener("button-focused", this.onButtonFocus.bind(this)), + ctx.widgets.containerWidget.addListener("mousemove", this.onHover.bind(this)), + ctx.widgets.containerWidget.addListener("mouseleave", this.onLeave.bind(this)), + ctx.eventsHub.on("layout:complete", this.onLayoutComplete.bind(this)), + this.teardown.bind(this) + ); + } + destroy() { + this.cleanup.flush(); + } + toggleVisibleZoomed(maxZoom) { + if (this.visible !== "zoomed") + return; + this.toggleVisibility(!maxZoom); + } + teardown() { + this.ctx.domManager.removeChild("canvas-overlay", "zoom-buttons"); + this.container.destroy(); + } + onLayoutComplete(event) { + const { buttons: buttons2, container } = this; + const { rect: rect2 } = event.series; + for (const b of buttons2) { + if (b.tooltip == null && b.label == null) { + const map = { + "pan-end": "toolbarZoomPanEnd", + "pan-left": "toolbarZoomPanLeft", + "pan-right": "toolbarZoomPanRight", + "pan-start": "toolbarZoomPanStart", + "zoom-in": "toolbarZoomZoomIn", + "zoom-out": "toolbarZoomZoomOut", + reset: "toolbarZoomReset" + }; + b.tooltip = map[b.value]; + } + } + this.toolbar.updateButtons(buttons2); + this.toggleButtonsDebounced(); + const height2 = container.getBounds().height; + container.setBounds({ y: rect2.y + rect2.height - height2 }); + } + onHover(event) { + if (!this.enabled || this.visible !== "hover" || this.toolbar.isHidden()) + return; + const { + container, + detectionRange, + ctx: { scene } + } = this; + const { + currentY, + sourceEvent: { target } + } = event; + const element2 = container.getElement(); + const detectionY = element2.offsetTop - detectionRange; + const visible = currentY > detectionY && currentY < scene.canvas.element.offsetHeight || target === element2; + this.toggleVisibility(visible); + } + onLeave() { + if (this.visible !== "hover") + return; + this.toggleVisibility(false); + } + toggleVisibility(visible, immediate = false) { + const { container, toolbar: toolbar2, verticalSpacing } = this; + toolbar2.toggleClass("ag-charts-zoom-buttons__toolbar--hidden", !visible); + const element2 = toolbar2.getElement(); + element2.style.transitionDuration = immediate ? "0s" : ""; + element2.style.transform = visible ? "translateY(0)" : `translateY(${container.getBounds().height + verticalSpacing}px)`; + } + toggleButtons() { + const zoom = definedZoomState(this.ctx.zoomManager.getZoom()); + if (this.previousZoom && isZoomEqual(this.previousZoom, zoom)) + return; + this.previousZoom = zoom; + for (const [index, button] of this.buttons.entries()) { + let enabled = true; + switch (button?.value) { + case "pan-start": + enabled = zoom.x.min > UNIT_MIN; + break; + case "pan-end": + enabled = zoom.x.max < UNIT_MAX; + break; + case "pan-left": + enabled = zoom.x.min > UNIT_MIN; + break; + case "pan-right": + enabled = zoom.x.max < UNIT_MAX; + break; + case "zoom-out": + enabled = !isZoomEqual(zoom, unitZoomState()); + break; + case "zoom-in": + enabled = this.isZoomValid( + this.getNextZoomStateUnified("zoom-in", zoom, this.getModuleProperties()) + ); + break; + case "reset": + enabled = this.canResetZoom(zoom); + break; + } + this.toolbar.toggleButtonEnabledByIndex(index, enabled); + } + } + onButtonPress({ button }) { + if (!this.enabled || this.toolbar.isHidden()) + return; + const props = this.getModuleProperties(); + if (props.independentAxes && button.value !== "reset") { + const axisZooms = this.ctx.zoomManager.getAxisZooms(); + for (const [axisId, { direction, zoom }] of entries(axisZooms)) { + if (zoom == null) + continue; + this.onButtonPressAxis(button, props, axisId, direction, zoom); + } + } else { + this.onButtonPressUnified(button, props); + } + } + onButtonFocus(_event) { + this.toggleVisibility(true, true); + } + onButtonPressAxis(event, props, axisId, direction, zoom) { + const { isScalingX, isScalingY, scrollingStep } = props; + let newZoom = { ...zoom }; + const delta32 = zoom.max - zoom.min; + switch (event.value) { + case "pan-start": + newZoom.max = delta32; + newZoom.min = 0; + break; + case "pan-end": + newZoom.min = newZoom.max - delta32; + newZoom.max = UNIT_MAX; + break; + case "pan-left": + newZoom.min -= delta32 * scrollingStep; + newZoom.max -= delta32 * scrollingStep; + break; + case "pan-right": + newZoom.min += delta32 * scrollingStep; + newZoom.max += delta32 * scrollingStep; + break; + case "zoom-in": + case "zoom-out": { + const isDirectionX = direction === ChartAxisDirection222.X; + const isScalingDirection = isDirectionX && isScalingX || !isDirectionX && isScalingY; + let scale2 = event.value === "zoom-in" ? 1 - scrollingStep : 1 + scrollingStep; + if (!isScalingDirection) + scale2 = 1; + const placement = isDirectionX ? this.getAnchorPointX(props) : this.getAnchorPointY(props); + newZoom.max = newZoom.min + (newZoom.max - newZoom.min) * scale2; + newZoom = scaleZoomAxisWithAnchor(newZoom, zoom, placement); + break; + } + } + this.updateAxisZoom(axisId, direction, constrainAxis(newZoom)); + } + onButtonPressUnified(event, props) { + const { scrollingStep } = props; + const oldZoom = definedZoomState(this.ctx.zoomManager.getZoom()); + let zoom = definedZoomState(oldZoom); + switch (event.value) { + case "reset": + this.resetZoom(); + return; + case "pan-start": + zoom.x.max = dx(zoom); + zoom.x.min = 0; + break; + case "pan-end": + zoom.x.min = UNIT_MAX - dx(zoom); + zoom.x.max = UNIT_MAX; + break; + case "pan-left": + zoom = translateZoom(zoom, -dx(zoom) * scrollingStep, 0); + break; + case "pan-right": + zoom = translateZoom(zoom, dx(zoom) * scrollingStep, 0); + break; + case "zoom-in": + case "zoom-out": { + zoom = this.getNextZoomStateUnified(event.value, oldZoom, props); + break; + } + } + this.updateZoom(constrainZoom(zoom)); + } + getNextZoomStateUnified(button, oldZoom, props) { + const { isScalingX, isScalingY, scrollingStep } = props; + const scale2 = button === "zoom-in" ? 1 - scrollingStep : 1 + scrollingStep; + const zoom = scaleZoom(oldZoom, isScalingX ? scale2 : 1, isScalingY ? scale2 : 1); + zoom.x = scaleZoomAxisWithAnchor(zoom.x, oldZoom.x, this.getAnchorPointX(props)); + zoom.y = scaleZoomAxisWithAnchor(zoom.y, oldZoom.y, this.getAnchorPointY(props)); + return zoom; + } + getAnchorPointX(props) { + const anchorPointX = this.anchorPointX ?? props.anchorPointX; + return anchorPointX === "pointer" ? DEFAULT_ANCHOR_POINT_X : anchorPointX; + } + getAnchorPointY(props) { + const anchorPointY = this.anchorPointY ?? props.anchorPointY; + return anchorPointY === "pointer" ? DEFAULT_ANCHOR_POINT_Y : anchorPointY; + } +}; +__decorateClass2([ + Property61, + ActionOnSet8({ + changeValue(enabled) { + this.toolbar?.setHidden(!enabled); + } + }) +], ZoomToolbar.prototype, "enabled", 2); +__decorateClass2([ + Property61 +], ZoomToolbar.prototype, "buttons", 2); +__decorateClass2([ + Property61, + ActionOnSet8({ + changeValue(visible, oldValue) { + if (oldValue == null) + return; + const always = visible === "always"; + const zoomed = visible === "zoomed" && this.previousZoom != null && !isMaxZoom(this.previousZoom); + this.toggleVisibility(always || zoomed); + } + }) +], ZoomToolbar.prototype, "visible", 2); +__decorateClass2([ + Property61 +], ZoomToolbar.prototype, "anchorPointX", 2); +__decorateClass2([ + Property61 +], ZoomToolbar.prototype, "anchorPointY", 2); +var N = 1e6; +function clientToNormal({ min, max }, a, Rx, Rw) { + if (Rw === 0) + return 0; + return N * ((a - Rx) / Rw * (max - min) + min); +} +function solveTwoUnknowns(x1, x2, a1, a2, Rx, Rw) { + [x1, x2] = [Math.min(x1, x2), Math.max(x1, x2)]; + [a1, a2] = [Math.min(a1, a2), Math.max(a1, a2)]; + const t1 = N * (a1 - Rx) / Rw; + const t2 = N * (a2 - Rx) / Rw; + const c = (a1 - Rx) / (a2 - Rx); + const min = (x1 - c * x2) / (N - t1 + c * (t2 - N)); + const max = (x2 + (t2 - N) * min) / t2; + return { min, max }; +} +function isRangeOverlapping(centerA, radiusA, centerB, radiusB) { + if (radiusA === 0) + radiusA = 30; + if (radiusB === 0) + radiusB = 30; + const minA = centerA - radiusA; + const maxA = centerA + radiusA; + const minB = centerB - radiusB; + const maxB = centerB + radiusB; + return !(maxA < minB || maxB < minA); +} +var ZoomTwoFingers = class { + constructor() { + this.touchStart = { + origins: [ + { identifier: 0, normalX: Number.NaN, normalY: Number.NaN }, + { identifier: 0, normalX: Number.NaN, normalY: Number.NaN } + ] + }; + this.initialZoom = { x: { min: 0, max: 1 }, y: { min: 0, max: 1 } }; + this.previous = { a1: Number.NaN, a2: Number.NaN, b1: Number.NaN, b2: Number.NaN }; + } + start(event, target, zoom) { + if (event.sourceEvent.targetTouches.length !== 2) + return false; + event.sourceEvent.preventDefault(); + const targetTouches = Array.from(event.sourceEvent.targetTouches); + const { x: Rx, y: Ry, width: Rw, height: Rh } = target.getBoundingClientRect(); + this.initialZoom.x.min = zoom.x?.min ?? 0; + this.initialZoom.x.max = zoom.x?.max ?? 1; + this.initialZoom.y.min = zoom.y?.min ?? 0; + this.initialZoom.y.max = zoom.y?.max ?? 1; + for (const t of this.touchStart.origins) { + t.identifier = 0; + } + this.previous.a1 = Number.NaN; + this.previous.a2 = Number.NaN; + this.previous.b1 = Number.NaN; + this.previous.b2 = Number.NaN; + for (const i of [0, 1]) { + const a = targetTouches[i].clientX; + const b = Ry + Rh - targetTouches[i].clientY; + this.touchStart.origins[i].identifier = targetTouches[i].identifier; + this.touchStart.origins[i].normalX = clientToNormal(this.initialZoom.x, a, Rx, Rw); + this.touchStart.origins[i].normalY = clientToNormal(this.initialZoom.y, b, Ry, Rh); + } + const [tA, tB] = targetTouches; + const [oA, oB] = this.touchStart.origins; + const xOverlap = isRangeOverlapping(tA.clientX, tA.radiusX, tB.clientX, tB.radiusX); + const yOverlap = isRangeOverlapping(tA.clientY, tA.radiusY, tB.clientY, tB.radiusY); + if (yOverlap) + oA.normalY = oB.normalY = (oA.normalY + oB.normalY) / 2; + if (xOverlap) + oA.normalX = oB.normalX = (oA.normalX + oB.normalX) / 2; + return true; + } + update(event, target) { + event.sourceEvent.preventDefault(); + const targetTouches = Array.from(event.sourceEvent.targetTouches); + const { x: Rx, y: Ry, width: Rw, height: Rh } = target.getBoundingClientRect(); + const { origins } = this.touchStart; + const touches = [0, 1].map((i) => targetTouches.find((t) => t.identifier === origins[i].identifier)); + const x1 = origins[0].normalX; + const x2 = origins[1].normalX; + const a1 = touches[0].clientX; + const a2 = touches[1].clientX; + const y1 = origins[0].normalY; + const y2 = origins[1].normalY; + const b1 = Ry + Rh - touches[0].clientY; + const b2 = Ry + Rh - touches[1].clientY; + return this.twitchTolerantZoomPan4(x1, x2, a1, a2, y1, y2, b1, b2, Rx, Ry, Rw, Rh); + } + end(event) { + const identifiers = Array.from(event.sourceEvent.targetTouches).map((t) => t.identifier); + return !identifiers.includes(this.touchStart.origins[0].identifier) || !identifiers.includes(this.touchStart.origins[1].identifier); + } + // Small touch deltas on an axis, which can defined as one fingers moving ±1 pixel and the other not moving, can + // cause the canvas to flicker between two zoompan views. + // + // For example, consider two fingers moving upwards slowly on the Y-axis with the following events (Y=0 is the top + // of the screen): + // + // [0]: { finger1: { clientY: 101 }, finger2: { clientY: 201 } } + // [1]: { finger1: { clientY: 101 }, finger2: { clientY: 200 } } + // [2]: { finger1: { clientY: 100 }, finger2: { clientY: 200 } } + // + // The following transitions cause these changes to the zoompan respectively. + // + // [0] => [1] : yMin decreases, yMax increases + // [1] => [2] : yMin increases, yMax decreases + // + // At highly-zoomed views, this sudden shift in yMin/yMax in the [1] => [2] transition is very noticeable. When many + // of these kind of a transitions occur, the chart flickers between pan states instead of smoothly panning. Note + // however that, if we didn't receive event [1], our transition would like this: + // + // [0] => [2] : yMin increases, yMax increases + // + // ... which is a smooth panning transition. Therefore to prevent flickering, we skip event [1]. + twitchTolerantZoomPan4(x1, x2, a1, a2, y1, y2, b1, b2, Rx, Ry, Rw, Rh) { + const { initialZoom, previous } = this; + const x = twitchTolerantZoomPan2(x1, x2, a1, a2, previous, "a1", "a2", Rx, Rw, initialZoom.x); + const y = twitchTolerantZoomPan2(y1, y2, b1, b2, previous, "b1", "b2", Ry, Rh, initialZoom.y); + return { x, y }; + } +}; +function twitchTolerantZoomPan2(x1, x2, a1, a2, previous, previousKey1, previousKey2, Rx, Rw, initialZoom) { + if (x1 == x2) { + const xn1 = clientToNormal(initialZoom, a1, Rx, Rw); + const xn2 = clientToNormal(initialZoom, a2, Rx, Rw); + const xavg = (xn1 + xn2) / 2; + const dzoom = (x1 - xavg) / N; + return { min: initialZoom.min + dzoom, max: initialZoom.max + dzoom }; + } else { + const a1prev = previous[previousKey1]; + const a2prev = previous[previousKey2]; + const dx2 = Math.abs(a1 - a1prev) + Math.abs(a2 - a2prev); + if (dx2 <= 1) { + a1 = a1prev; + a2 = a2prev; + } else { + previous[previousKey1] = a1; + previous[previousKey2] = a2; + } + return solveTwoUnknowns(x1, x2, a1, a2, Rx, Rw); + } +} +var { ActionOnSet: ActionOnSet9, ChartAxisDirection: ChartAxisDirection23, ChartUpdateType: ChartUpdateType3, Property: Property62, InteractionState: InteractionState5, ProxyProperty: ProxyProperty3 } = module_support_exports; +var round3 = (value) => roundTo(value, 10); +var CURSOR_ID = "zoom-cursor"; +var TOOLTIP_ID = "zoom-tooltip"; +var ZoomAutoScaling = class extends module_support_exports.BaseProperties { + constructor(onChange) { + super(); + this.onChange = onChange; + this.enabled = false; + this.padding = 0; + } +}; +__decorateClass2([ + Property62, + ActionOnSet9({ + changeValue(enabled) { + this.onChange({ enabled, padding: this.padding }); + } + }) +], ZoomAutoScaling.prototype, "enabled", 2); +__decorateClass2([ + Property62, + ActionOnSet9({ + changeValue(padding2) { + this.onChange({ enabled: this.enabled, padding: padding2 }); + } + }) +], ZoomAutoScaling.prototype, "padding", 2); +var Zoom = class extends module_support_exports.BaseModuleInstance { + constructor(ctx) { + super(); + this.ctx = ctx; + this.enabled = false; + this.enableAxisDragging = true; + this.enableAxisScrolling = false; + this.enableDoubleClickToReset = true; + this.enablePanning = true; + this.enableScrolling = true; + this.enableSelecting = false; + this.enableTwoFingerZoom = true; + this.panKey = "alt"; + this.axes = "x"; + this.scrollingStep = UNIT_SIZE / 10; + this.keepAspectRatio = false; + this.minVisibleItems = 2; + this.anchorPointX = DEFAULT_ANCHOR_POINT_X; + this.anchorPointY = DEFAULT_ANCHOR_POINT_Y; + this.autoScaling = new ZoomAutoScaling((newValue) => { + this.ctx.zoomManager.setAutoScaleYAxis(newValue.enabled, newValue.padding); + }); + this.axisDraggingMode = "zoom"; + this.canResetZoom = (zoom) => { + zoom ?? (zoom = this.getZoom()); + return !isZoomEqual(zoom, this.getResetZoom()); + }; + this.buttons = new ZoomToolbar( + this.ctx, + this.getModuleProperties.bind(this), + this.canResetZoom, + this.updateZoom.bind(this), + this.updateAxisZoom.bind(this), + this.resetZoom.bind(this), + this.isZoomValid.bind(this) + ); + this.axisDragger = new ZoomAxisDragger(); + this.panner = new ZoomPanner(); + this.scroller = new ZoomScroller(); + this.scrollPanner = new ZoomScrollPanner(); + this.twoFingers = new ZoomTwoFingers(); + this.deceleration = "short"; + this.dragState = 0; + this.isState = (state) => this.ctx.interactionManager.isState(state); + this.destroyContextMenuActions = void 0; + this.isFirstWheelEvent = true; + this.debouncedWheelReset = debounce(() => { + this.isFirstWheelEvent = true; + this.wasFirstWheelEventZoomCapped = void 0; + }, 100); + this.previousZoomValid = true; + this.previousAxisZoomValid = { + [module_support_exports.ChartAxisDirection.X]: true, + [module_support_exports.ChartAxisDirection.Y]: true + }; + this.toggleAxisDraggingCursorsDebounced = debounce( + this.toggleAxisDraggingCursors.bind(this), + ZOOM_VALID_CHECK_DEBOUNCE, + { + leading: true, + trailing: true + } + ); + const selectionRect = new ZoomRect(); + this.selector = new ZoomSelector(selectionRect, this.getZoom.bind(this), this.isZoomValid.bind(this)); + this.contextMenu = new ZoomContextMenu( + ctx.eventsHub, + ctx.contextMenuRegistry, + ctx.zoomManager, + this.getModuleProperties.bind(this), + this.canResetZoom, + () => this.paddedRect, + this.updateZoom.bind(this), + this.isZoomValid.bind(this) + ); + this.domProxy = new ZoomDOMProxy({ + onAxisDragStart: (direction) => this.onAxisDragStart(direction), + onAxisDragMove: (id, direction, event) => this.onAxisDragMove(id, direction, event), + onAxisDragEnd: () => this.onAxisDragEnd(), + onAxisDoubleClick: (id) => this.onAxisDoubleClick(id), + onAxisWheel: (id, direction, event) => this.onAxisWheel(id, direction, event) + }); + if (ctx.widgets.seriesDragInterpreter) { + this.cleanup.register( + ctx.widgets.seriesDragInterpreter.events.on("dblclick", (event) => this.onSeriesAreaDoubleClick(event)), + ctx.widgets.seriesDragInterpreter.events.on("drag-move", (event) => this.onSeriesAreaDragMove(event)), + ctx.widgets.seriesDragInterpreter.events.on("drag-start", (event) => this.onSeriesAreaDragStart(event)), + ctx.widgets.seriesDragInterpreter.events.on("drag-end", () => this.onSeriesAreaDragEnd()) + ); + } + this.cleanup.register( + ctx.scene.attachNode(selectionRect), + ctx.eventsHub.on("series-area:hover", (event) => this.onSeriesAreaHoverEvent(event)), + ctx.eventsHub.on("series-area:click", (event) => this.onSeriesAreaClickEvent(event)), + ctx.eventsHub.on("series:keynav-zoom", (event) => this.onNavZoom(event)), + ctx.widgets.seriesWidget.addListener("wheel", (event) => this.onWheel(event)), + ctx.widgets.seriesWidget.addListener("touchstart", (event, current) => this.onTouchStart(event, current)), + ctx.widgets.seriesWidget.addListener("touchmove", (event, current) => this.onTouchMove(event, current)), + ctx.widgets.seriesWidget.addListener("touchend", (event) => this.onTouchEnd(event)), + ctx.widgets.seriesWidget.addListener("touchcancel", (event) => this.onTouchEnd(event)), + ctx.updateService.addListener("process-data", (event) => this.onProcessData(event)), + ctx.eventsHub.on("layout:complete", (event) => this.onLayoutComplete(event)), + ctx.eventsHub.on("zoom:change", (event) => this.onZoomChange(event)), + ctx.eventsHub.on("zoom:pan-start", (event) => this.onZoomPanStart(event)), + this.panner.addListener("update", (event) => this.onPanUpdate(event)), + () => this.teardown() + ); + } + teardown() { + this.ctx.zoomManager.setZoomModuleEnabled(false); + this.buttons.destroy(); + this.destroyContextMenuActions?.(); + this.domProxy.destroy(); + } + onEnabledChange(enabled) { + this.ctx.zoomManager.setZoomModuleEnabled(enabled); + if (this.contextMenu) { + this.destroyContextMenuActions?.(); + this.destroyContextMenuActions = this.contextMenu.registerActions(enabled); + } + } + isIgnoredTouch(event) { + if (event?.device !== "touch") { + return false; + } + if (this.ctx.chartService.touch.dragAction !== "drag") { + return true; + } + if (this.enableSelecting) { + return false; + } + if (!this.enablePanning) { + return true; + } + return isMaxZoom(this.getZoom()); + } + onSeriesAreaDoubleClick(event) { + const { enabled, enableDoubleClickToReset } = this; + if (!enabled || !enableDoubleClickToReset) + return; + if (event?.preventZoomDblClick || !this.isState(InteractionState5.ZoomClickable)) + return; + this.resetZoom(); + } + onSeriesAreaHoverEvent(event) { + if (!this.shouldHandleAxisHover(event)) { + this.clearHoveredAxis(); + return; + } + const axis = this.domProxy.pickAxisAtPoint(event.x, event.y); + if (axis) { + this.domProxy.setHoveredAxis(axis.axisId); + this.ctx.domManager.updateCursor(CURSOR_ID, this.domProxy.getCursor(axis.direction)); + } else { + this.clearHoveredAxis(); + } + } + onSeriesAreaClickEvent(event) { + if (!this.shouldHandleAxisClick(event)) + return; + const axis = this.domProxy.pickAxisAtPoint(event.x, event.y); + if (axis && event.sourceEvent?.type === "dblclick") { + this.onAxisDoubleClick(axis.axisId); + } + } + shouldHandleAxisHover(event) { + const { enabled, enableAxisDragging, enableAxisScrolling, dragState } = this; + return enabled && (enableAxisDragging || enableAxisScrolling) && !event.consumed && !this.activeAxis && dragState === 0 && this.domProxy.hasOverlappingAxes(); + } + shouldHandleAxisClick(event) { + const { enabled, enableAxisDragging, enableAxisScrolling, enableDoubleClickToReset } = this; + return enabled && !this.activeAxis && !event.consumed && (enableAxisDragging || enableAxisScrolling || enableDoubleClickToReset); + } + clearHoveredAxis() { + if (this.activeAxis) + return; + this.domProxy.clearHoveredAxis(); + if (this.dragState === 0) { + this.ctx.domManager.updateCursor(CURSOR_ID); + } + } + tryBeginAxisDelegation(event) { + const hoveredAxis = this.domProxy.getHoveredAxis(); + if (!this.enabled || !this.enableAxisDragging || !hoveredAxis) { + return false; + } + if (!this.domProxy.beginDelegatedAxisDrag(hoveredAxis.axisId)) { + return false; + } + this.activeAxis = hoveredAxis; + this.onAxisDragStart(hoveredAxis.direction); + const cursor = this.dragState === 2 ? "grabbing" : this.domProxy.getCursor(hoveredAxis.direction); + this.ctx.domManager.updateCursor(CURSOR_ID, cursor); + if (event.device === "touch") { + event.sourceEvent.preventDefault(); + } + return true; + } + onSeriesAreaDragStart(event) { + const { + enabled, + enablePanning, + enableSelecting, + ctx: { domManager, zoomManager } + } = this; + if (!enabled || !this.isState(InteractionState5.ZoomDraggable) || this.dragState !== 0 || this.isIgnoredTouch(event)) { + return; + } + this.panner.stopInteractions(); + if (this.tryBeginAxisDelegation(event)) { + return; + } + let newDragState = 0; + const panKeyPressed = this.isPanningKeyPressed(event.sourceEvent); + if (enablePanning && (!enableSelecting || panKeyPressed)) { + domManager.updateCursor(CURSOR_ID, "grabbing"); + newDragState = 2; + this.panner.start(); + } else if (enableSelecting && !panKeyPressed) { + newDragState = 3; + } + if ((this.dragState = newDragState) !== 0) { + zoomManager.fireZoomPanStartEvent("zoom"); + } + } + onSeriesAreaDragMove(event) { + const { + dragState, + enabled, + paddedRect, + panner, + selector, + ctx: { interactionManager, tooltipManager, updateService } + } = this; + if (this.activeAxis) { + this.onAxisDragMove(this.activeAxis.axisId, this.activeAxis.direction, event); + return; + } + if (!enabled || !paddedRect || !this.isState(InteractionState5.ZoomDraggable) || this.isIgnoredTouch(event)) { + return; + } + interactionManager.pushState(module_support_exports.InteractionState.ZoomDrag); + if (event.device === "touch") { + event.sourceEvent.preventDefault(); + } + switch (dragState) { + case 2: + panner.update(event); + break; + case 3: + selector.update(event, this.getModuleProperties(), paddedRect); + break; + case 0: + return; + } + tooltipManager.updateTooltip(TOOLTIP_ID); + updateService.update(ChartUpdateType3.PERFORM_LAYOUT, { skipAnimations: true }); + } + onSeriesAreaDragEnd() { + const { + ctx: { interactionManager } + } = this; + if (this.activeAxis) { + this.handleAxisDragEnd(); + return; + } + interactionManager.popState(module_support_exports.InteractionState.ZoomDrag); + if (!this.enabled || this.dragState === 0) + return; + this.handleRegularDragEnd(); + this.resetDragState(); + } + handleAxisDragEnd() { + this.onAxisDragEnd(); + this.domProxy.endDelegatedAxisDrag(this.activeAxis.axisId); + this.activeAxis = void 0; + this.clearHoveredAxis(); + } + handleRegularDragEnd() { + const { panner, selector } = this; + switch (this.dragState) { + case 2: + panner.stop(); + break; + case 3: + if (selector.didUpdate()) { + const newZoom = selector.stop(this.seriesRect, this.paddedRect, this.getZoom()); + this.updateZoom(newZoom); + } + break; + } + } + resetDragState() { + this.dragState = 0; + this.ctx.domManager.updateCursor(CURSOR_ID); + this.ctx.tooltipManager.removeTooltip(TOOLTIP_ID); + } + onAxisDoubleClick(id) { + const { + enabled, + enableDoubleClickToReset, + ctx: { zoomManager } + } = this; + if (!enabled || !enableDoubleClickToReset || !this.isState(InteractionState5.ZoomClickable)) + return; + this.previousAxisZoomValid = { [ChartAxisDirection23.X]: true, [ChartAxisDirection23.Y]: true }; + zoomManager.resetAxisZoom("zoom", id); + } + onAxisDragStart(direction) { + const { + axisDraggingMode, + domProxy, + enabled, + enableAxisDragging, + panner, + ctx: { zoomManager } + } = this; + if (!enabled || !enableAxisDragging) + return; + panner.stopInteractions(); + if (axisDraggingMode === "pan") { + domProxy.setAxisCursor("grabbing"); + this.dragState = 2; + this.panner.start(direction); + zoomManager.fireZoomPanStartEvent("zoom"); + } else { + this.dragState = 1; + } + } + onAxisDragMove(axisId, direction, event) { + const { + anchorPointX, + anchorPointY, + axisDragger, + dragState, + enabled, + enableAxisDragging, + seriesRect, + shouldFlipXY, + ctx: { interactionManager, tooltipManager, updateService, zoomManager } + } = this; + if (!enabled || !enableAxisDragging || !seriesRect) + return; + interactionManager.pushState(module_support_exports.InteractionState.ZoomDrag); + if (event.device === "touch") { + event.sourceEvent.preventDefault(); + } + const zoom = this.getZoom(); + if (dragState === 2) { + this.panner.update({ currentX: event.offsetX, currentY: event.offsetY }); + } else { + let anchor = direction === ChartAxisDirection23.X ? anchorPointX : anchorPointY; + if (shouldFlipXY) + anchor = direction === ChartAxisDirection23.X ? anchorPointY : anchorPointX; + const axisZoom = zoomManager.getAxisZoom(axisId); + const newZoom = axisDragger.update(event, direction, anchor, seriesRect, zoom, axisZoom); + zoomManager.setAxisManuallyAdjusted("zoom", axisId); + this.updateAxisZoom(axisId, direction, newZoom, { + directional: true + }); + } + tooltipManager.updateTooltip(TOOLTIP_ID); + updateService.update(ChartUpdateType3.PERFORM_LAYOUT, { skipAnimations: true }); + } + onAxisDragEnd() { + const { + axisDraggingMode, + axisDragger, + dragState, + domProxy, + enabled, + enableAxisDragging, + ctx: { domManager, interactionManager, tooltipManager } + } = this; + interactionManager.popState(module_support_exports.InteractionState.ZoomDrag); + if (!enabled || !enableAxisDragging || dragState === 0) + return; + this.dragState = 0; + if (axisDraggingMode === "pan") { + domProxy.setAxisCursor("grab"); + this.panner.stop(); + } + axisDragger.stop(); + domManager.updateCursor(CURSOR_ID); + tooltipManager.removeTooltip(TOOLTIP_ID); + } + onNavZoom(event) { + const { enabled, enableScrolling, scroller } = this; + const isDefaultState = this.ctx.interactionManager.isState(module_support_exports.InteractionState.Default); + if (!isDefaultState || !enabled || !enableScrolling) + return; + event.widgetEvent.sourceEvent.preventDefault(); + this.updateZoom(scroller.updateDelta(event.delta, this.getModuleProperties(), this.getZoom())); + } + onWheel(event) { + const { enabled, enablePanning, enableScrolling, paddedRect } = this; + if (!enabled || !enableScrolling || !paddedRect || !this.isState(InteractionState5.ZoomWheelable)) + return; + const { deltaX, deltaY } = event.sourceEvent; + const isHorizontalScrolling = deltaX != null && deltaY != null && Math.abs(deltaX) > Math.abs(deltaY); + if (enablePanning && isHorizontalScrolling) { + this.onWheelPanning(event); + } else { + this.onWheelScrolling(event); + } + } + onWheelPanning(event) { + const { + scrollingStep, + scrollPanner, + seriesRect, + ctx: { zoomManager } + } = this; + if (!seriesRect) + return; + event.sourceEvent.preventDefault(); + const newZooms = scrollPanner.update(event, scrollingStep, seriesRect, zoomManager.getAxisZooms()); + for (const [axisId, { direction, zoom }] of entries(newZooms)) { + this.updateAxisZoom(axisId, direction, zoom); + } + } + onWheelScrolling(event) { + const zoom = this.getZoom(); + const isZoomCapped = event.deltaY > 0 && isMaxZoom(zoom); + this.handleWheelScrolling(event, isZoomCapped); + } + onAxisWheel(axisId, axisDirection, event) { + const { + enableAxisScrolling, + ctx: { zoomManager } + } = this; + if (!enableAxisScrolling) + return; + if (axisDirection !== ChartAxisDirection23.X && axisDirection !== ChartAxisDirection23.Y) { + return; + } + const isScalingX = axisDirection === ChartAxisDirection23.X; + const isScalingY = !isScalingX; + const props = this.getModuleProperties({ isScalingX, isScalingY }); + const zoom = this.getZoom(); + const isZoomCapped = event.deltaY > 0 && zoom[axisDirection].min === UNIT_MIN && zoom[axisDirection].max === UNIT_MAX; + zoomManager.setAxisManuallyAdjusted("zoom", axisId); + this.handleWheelScrolling(event, isZoomCapped, props); + } + handleWheelScrolling(event, isZoomCapped, props = this.getModuleProperties()) { + const { + enableIndependentAxes, + scroller, + seriesRect, + ctx: { zoomManager } + } = this; + if (!seriesRect) + return; + let updated = true; + if (enableIndependentAxes === true) { + const newZooms = scroller.updateAxes(event, props, seriesRect, zoomManager.getAxisZooms()); + for (const [axisId, { direction, zoom: axisZoom }] of entries(newZooms)) { + const constrainedZoom = direction === ChartAxisDirection23.X ? this.constrainZoom({ x: axisZoom, y: { min: UNIT_MAX, max: UNIT_MAX } }).x : axisZoom; + updated && (updated = this.updateAxisZoom( + axisId, + direction, + constrainedZoom + )); + } + } else { + const newZoom = scroller.update(event, props, seriesRect, this.getZoom()); + if (newZoom == null) + return; + updated = this.updateUnifiedZoom(newZoom, { directional: true }); + } + isZoomCapped || (isZoomCapped = event.deltaY < 0 && !updated); + if (this.firstWheelEventDirection != null && this.firstWheelEventDirection !== event.deltaY < 0) { + this.isFirstWheelEvent = true; + } + if (this.isFirstWheelEvent) { + this.wasFirstWheelEventZoomCapped = isZoomCapped; + this.firstWheelEventDirection = event.deltaY < 0; + if (!isZoomCapped) { + event.sourceEvent.preventDefault(); + } + } else if (this.wasFirstWheelEventZoomCapped === false) { + event.sourceEvent.preventDefault(); + } + this.isFirstWheelEvent = false; + this.debouncedWheelReset(); + } + onTouchStart(event, current) { + if (!this.enableTwoFingerZoom || this.dragState !== 0) + return; + if (this.twoFingers.start(event, current, this.getZoom())) { + this.dragState = 4; + } + } + onTouchMove(event, current) { + if (!this.enableTwoFingerZoom || this.dragState !== 4) + return; + const newZoom = this.twoFingers.update(event, current); + this.updateZoom(constrainZoom(newZoom)); + } + onTouchEnd(event) { + if (!this.enableTwoFingerZoom || this.dragState !== 4) + return; + event.sourceEvent.preventDefault(); + if (this.twoFingers.end(event)) { + this.dragState = 0; + } + } + onProcessData(event) { + this.shouldFlipXY = event.series.shouldFlipXY; + } + onLayoutComplete(event) { + this.domProxy.update(this.enableAxisDragging, this.enableAxisScrolling, this.ctx, event.series.rect); + if (!this.enabled) + return; + this.seriesRect = event.series.rect; + this.paddedRect = event.series.paddedRect; + if (this.enableAxisDragging) { + this.toggleAxisDraggingCursorsDebounced(); + } + } + onZoomChange(event) { + if (event.callerId !== "zoom") { + this.panner.stopInteractions(); + } + const zoom = this.getZoom(); + this.buttons.toggleVisibleZoomed(isMaxZoom(zoom)); + } + onZoomPanStart(event) { + if (event.callerId === "zoom") { + this.panner.stopInteractions(); + } + } + onPanUpdate(event) { + const { + panner, + seriesRect, + ctx: { tooltipManager, zoomManager } + } = this; + if (!seriesRect) + return; + const newZooms = panner.translateZooms(seriesRect, zoomManager.getAxisZooms(), event.deltaX, event.deltaY); + for (const [axisId, { direction, zoom }] of entries(newZooms)) { + this.updateAxisZoom(axisId, direction, zoom); + } + tooltipManager.updateTooltip(TOOLTIP_ID); + } + isPanningKeyPressed(event) { + switch (this.panKey) { + case "alt": + return event.altKey; + case "ctrl": + return event.ctrlKey; + case "shift": + return event.shiftKey; + case "meta": + return event.metaKey; + } + } + isScalingX() { + if (this.axes === "xy") + return true; + return this.shouldFlipXY ? this.axes === "y" : this.axes === "x"; + } + isScalingY() { + if (this.axes === "xy") + return true; + return this.shouldFlipXY ? this.axes === "x" : this.axes === "y"; + } + getAnchorPointX() { + return this.shouldFlipXY ? this.anchorPointY : this.anchorPointX; + } + getAnchorPointY() { + return this.shouldFlipXY ? this.anchorPointX : this.anchorPointY; + } + constrainZoom(newZoom) { + const { + minVisibleItems, + ctx: { zoomManager } + } = this; + if (minVisibleItems === 0) + return newZoom; + const constrainedZoom = zoomManager.constrainZoomToItemCount(newZoom, minVisibleItems); + return constrainedZoom ?? newZoom; + } + isZoomValid(newZoom, options) { + const { + minVisibleItems, + ctx: { zoomManager } + } = this; + if (minVisibleItems === 0) { + this.previousZoomValid = true; + return true; + } + const zoom = this.getZoom(); + const zoomedInX = round3(dx(newZoom)) < round3(dx(zoom)); + const zoomedInY = round3(dy(newZoom)) < round3(dy(zoom)); + if (!zoomedInX && !zoomedInY) { + this.previousZoomValid = true; + return true; + } + if (!this.previousZoomValid && options?.directional) { + return false; + } + const valid = zoomManager.isVisibleItemsCountAtLeast(newZoom, minVisibleItems, options?.includeYVisibleRange); + this.previousZoomValid = options?.directional ? valid : true; + return valid; + } + isAxisZoomValid(direction, axisZoom, options) { + const { + minVisibleItems, + ctx: { zoomManager } + } = this; + const zoom = this.getZoom(); + const deltaAxis = axisZoom.max - axisZoom.min; + const deltaOld = zoom[direction].max - zoom[direction].min; + const newZoom = { ...zoom, [direction]: axisZoom }; + if (deltaAxis >= deltaOld) { + this.previousAxisZoomValid[direction] = true; + return true; + } + if (!this.previousAxisZoomValid[direction] && options?.directional) { + return false; + } + const valid = zoomManager.isVisibleItemsCountAtLeast(newZoom, minVisibleItems); + this.previousAxisZoomValid[direction] = options?.directional ? valid : true; + return valid; + } + resetZoom() { + this.previousZoomValid = true; + this.previousAxisZoomValid = { [ChartAxisDirection23.X]: true, [ChartAxisDirection23.Y]: true }; + this.ctx.zoomManager.resetZoom("zoom"); + } + updateSyncZoom(zoom) { + this.updateZoom(zoom); + } + updateZoom(zoom) { + if (this.enableIndependentAxes) { + this.updatePrimaryAxisZooms(zoom); + } else { + this.updateUnifiedZoom(zoom); + } + } + updateUnifiedZoom(zoom, validOptions) { + zoom = this.constrainZoom(zoom); + if (!this.isZoomValid(zoom, validOptions)) { + this.ctx.updateService.update(ChartUpdateType3.SCENE_RENDER, { skipAnimations: true }); + return false; + } + this.ctx.zoomManager.updateZoom("zoom", zoom); + return true; + } + updatePrimaryAxisZooms(zoom) { + this.updatePrimaryAxisZoom(zoom, ChartAxisDirection23.X); + this.updatePrimaryAxisZoom(zoom, ChartAxisDirection23.Y); + } + updatePrimaryAxisZoom(zoom, direction) { + const axisId = this.ctx.zoomManager.getPrimaryAxisId(direction); + if (axisId == null) + return; + this.updateAxisZoom(axisId, direction, zoom[direction]); + } + updateAxisZoom(axisId, direction, axisZoom, validOptions) { + const { + enableIndependentAxes, + ctx: { zoomManager } + } = this; + if (!axisZoom) + return false; + const zoom = this.getZoom(); + if (enableIndependentAxes !== true) { + zoom[direction] = axisZoom; + return this.updateUnifiedZoom(zoom, validOptions); + } + if (!this.isAxisZoomValid(direction, axisZoom, validOptions)) + return false; + zoomManager.updateAxisZoom("zoom", axisId, axisZoom); + return true; + } + updateAxisCursor(opts) { + if (!this.domProxy) + return; + const { + enableAxisDragging = this.enableAxisDragging, + enableAxisScrolling = this.enableAxisScrolling, + axisDraggingMode = this.axisDraggingMode + } = opts; + if (enableAxisDragging) { + this.domProxy.setAxisCursor(axisDraggingMode === "pan" ? "grab" : void 0); + } else if (enableAxisScrolling) { + this.domProxy.setAxisCursor("default"); + } else { + this.domProxy.setAxisCursor(void 0); + } + } + toggleAxisDraggingCursors() { + const { anchorPointX, anchorPointY, domProxy } = this; + const zoom = this.getZoom(); + let showCursorX = dx(zoom) !== UNIT_SIZE; + let showCursorY = dy(zoom) !== UNIT_SIZE; + if (!showCursorX) { + const checkZoomX = scaleZoom(zoom, 0.999, 1); + checkZoomX.x = scaleZoomAxisWithAnchor(checkZoomX.x, zoom.x, anchorPointX); + showCursorX = this.isZoomValid(checkZoomX, { includeYVisibleRange: true }); + } + if (!showCursorY) { + const checkZoomY = scaleZoom(zoom, 1, 0.999); + checkZoomY.y = scaleZoomAxisWithAnchor(checkZoomY.y, zoom.y, anchorPointY); + showCursorY = this.isZoomValid(checkZoomY, { includeYVisibleRange: true }); + } + domProxy.toggleAxisDraggingCursor(ChartAxisDirection23.X, showCursorX); + domProxy.toggleAxisDraggingCursor(ChartAxisDirection23.Y, showCursorY); + } + getZoom() { + return definedZoomState(this.ctx.zoomManager.getZoom()); + } + getResetZoom() { + return definedZoomState(this.ctx.zoomManager.getRestoredZoom()); + } + getModuleProperties(overrides) { + return { + anchorPointX: overrides?.anchorPointX ?? this.getAnchorPointX(), + anchorPointY: overrides?.anchorPointY ?? this.getAnchorPointY(), + enabled: overrides?.enabled ?? this.enabled, + independentAxes: overrides?.independentAxes ?? this.enableIndependentAxes === true, + isScalingX: overrides?.isScalingX ?? this.isScalingX(), + isScalingY: overrides?.isScalingY ?? this.isScalingY(), + keepAspectRatio: overrides?.keepAspectRatio ?? this.keepAspectRatio, + scrollingStep: overrides?.scrollingStep ?? this.scrollingStep + }; + } +}; +__decorateClass2([ + ActionOnSet9({ + newValue(enabled) { + this.onEnabledChange(enabled); + } + }), + Property62 +], Zoom.prototype, "enabled", 2); +__decorateClass2([ + ActionOnSet9({ + changeValue(newValue) { + this.updateAxisCursor({ enableAxisDragging: newValue }); + } + }), + Property62 +], Zoom.prototype, "enableAxisDragging", 2); +__decorateClass2([ + ActionOnSet9({ + changeValue(newValue) { + this.updateAxisCursor({ enableAxisScrolling: newValue }); + } + }), + Property62 +], Zoom.prototype, "enableAxisScrolling", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "enableDoubleClickToReset", 2); +__decorateClass2([ + ActionOnSet9({ + changeValue(newValue) { + this.ctx.zoomManager.setIndependentAxes(Boolean(newValue)); + } + }), + Property62 +], Zoom.prototype, "enableIndependentAxes", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "enablePanning", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "enableScrolling", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "enableSelecting", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "enableTwoFingerZoom", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "panKey", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "axes", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "scrollingStep", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "keepAspectRatio", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "minVisibleItems", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "anchorPointX", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "anchorPointY", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "autoScaling", 2); +__decorateClass2([ + ActionOnSet9({ + changeValue(newValue) { + this.updateAxisCursor({ axisDraggingMode: newValue }); + } + }), + Property62 +], Zoom.prototype, "axisDraggingMode", 2); +__decorateClass2([ + Property62 +], Zoom.prototype, "buttons", 2); +__decorateClass2([ + ProxyProperty3("panner.deceleration"), + Property62 +], Zoom.prototype, "deceleration", 2); +var buttons = { + enabled: true, + visible: "hover", + buttons: [ + { + icon: "zoom-out", + value: "zoom-out", + section: "scale" + }, + { + icon: "zoom-in", + value: "zoom-in", + section: "scale" + }, + { + icon: "pan-left", + value: "pan-left", + section: "pan" + }, + { + icon: "pan-right", + value: "pan-right", + section: "pan" + }, + { + icon: "reset", + value: "reset", + section: "reset" + } + ] +}; +var ZoomModule = { + type: "root", + optionsKey: "zoom", + packageType: "enterprise", + chartTypes: ["cartesian", "topology"], + moduleFactory: (ctx) => new Zoom(ctx), + themeTemplate: { + zoom: { + anchorPointX: "end", + anchorPointY: "middle", + axes: "x", + buttons, + enabled: false, + enableAxisDragging: true, + enableDoubleClickToReset: true, + enablePanning: true, + enableScrolling: true, + enableSelecting: false, + enableTwoFingerZoom: true, + deceleration: "short", + minVisibleItems: 2, + panKey: "alt", + scrollingStep: 0.1, + autoScaling: { + enabled: { $eq: [{ $path: "../axes" }, "x"] }, + padding: 0.05 + } + } + } +}; +function formatWithContext(ctx, formatter2, params) { + return module_support_exports.callWithContext(ctx.chartService, formatter2, params); +} +var { + AxisInterval: AxisInterval22, + AxisLabel: AxisLabel22, + ZIndexMap: ZIndexMap9, + LinearScale: LinearScale3, + BBox: BBox14, + TranslatableGroup: TranslatableGroup4, + Selection: Selection4, + Text: Text22, + createIdsGenerator: createIdsGenerator2, + findMinMax: findMinMax5, + findRangeExtent: findRangeExtent2, + estimateTickCount: estimateTickCount2 +} = module_support_exports; +var _AxisTicks = class _AxisTicks2 { + constructor(ctx, dataProvider) { + this.ctx = ctx; + this.dataProvider = dataProvider; + this.id = createId(this); + this.axisGroup = new TranslatableGroup4({ name: `${this.id}-AxisTicks`, zIndex: ZIndexMap9.AXIS }); + this.labelSelection = Selection4.select(this.axisGroup, Text22); + this.interval = new AxisInterval22(); + this.label = new AxisLabel22(); + this.scale = new LinearScale3(); + this.placement = "bottom"; + this.translationX = 0; + this.translationY = 0; + this.padding = 0; + } + get horizontal() { + return this.placement.startsWith("top") || this.placement.startsWith("bottom"); + } + attachAxis(axisNode) { + axisNode.appendChild(this.axisGroup); + } + calculateLayout() { + const { placement, translationX, translationY, horizontal, label } = this; + function unreachable(_a) { + return void 0; + } + let textBaseline; + let textAlign; + switch (placement) { + case "top": + case "top-right": + case "top-left": + textBaseline = "bottom"; + textAlign = "center"; + label.mirrored = false; + label.parallel = true; + break; + case "bottom": + case "bottom-right": + case "bottom-left": + textBaseline = "top"; + textAlign = "center"; + label.mirrored = false; + label.parallel = true; + break; + case "right": + case "right-top": + case "right-bottom": + case "left": + case "left-top": + case "left-bottom": + textBaseline = "middle"; + textAlign = "left"; + label.mirrored = true; + label.parallel = false; + break; + default: + unreachable(placement); + } + const boxes = []; + const tickGenerationResult = this.generateTicks(); + const { ticks } = tickGenerationResult; + this.labelSelection.update(ticks, void 0, (datum) => datum.tickId); + this.axisGroup.setProperties({ translationX, translationY }); + this.labelSelection.each((node, datum) => { + node.fontFamily = label.fontFamily; + node.fontSize = label.fontSize; + node.fontStyle = label.fontStyle; + node.fontWeight = label.fontWeight; + node.fill = label.color; + node.textBaseline = textBaseline; + node.textAlign = textAlign; + node.text = datum.tickLabel; + node.x = horizontal ? datum.translation : 0; + node.y = horizontal ? 0 : datum.translation; + boxes.push(node.getBBox()); + }); + return boxes.length > 0 ? BBox14.merge(boxes).translate(translationX, translationY) : void 0; + } + tickFormatter(domain, _ticks, _primary, fractionDigits) { + const { ctx } = this; + const { formatManager } = ctx; + const boundSeries = this.dataProvider.data.flatMap((d) => d.series); + return (value, index) => { + const formatParams = { + type: "number", + value, + datum: void 0, + seriesId: void 0, + legendItemName: void 0, + key: void 0, + source: "gradient-legend", + property: "color", + domain, + boundSeries, + fractionDigits + }; + return this.label.formatValue((fn, params) => formatWithContext(ctx, fn, params), formatParams, index) ?? formatManager.format((fn, params) => formatWithContext(ctx, fn, params), formatParams) ?? formatManager.defaultFormat(formatParams); + }; + } + inRange(x, tolerance = 1e-3) { + const [min, max] = findMinMax5(this.scale.range); + return x >= min - tolerance && x <= max + tolerance; + } + generateTicks() { + const { minSpacing, maxSpacing } = this.interval; + const { maxTickCount, minTickCount, tickCount } = estimateTickCount2( + findRangeExtent2(this.scale.range), + 1, + minSpacing, + maxSpacing, + _AxisTicks2.DefaultTickCount, + _AxisTicks2.DefaultMinSpacing + ); + const tickData = this.getTicksData({ + nice: true, + interval: this.interval.step, + tickCount, + minTickCount, + maxTickCount + }); + if (this.placement === "bottom" || this.placement === "top") { + const measurer22 = cachedTextMeasurer(this.label); + const { domain } = this.scale; + const reversed = domain[0] > domain[1]; + const direction = reversed ? -1 : 1; + let lastTickPosition = -Infinity * direction; + tickData.ticks = tickData.ticks.filter((data) => { + if (Math.sign(data.translation - lastTickPosition) !== direction) + return false; + const { width: labelWidth } = isArray(data.tickLabel) ? measureTextSegments(data.tickLabel, this.label) : measurer22.measureLines(data.tickLabel); + lastTickPosition = data.translation + labelWidth * direction; + return true; + }); + } + return tickData; + } + getTicksData(tickParams) { + const ticks = []; + const domain = tickParams.nice ? this.scale.niceDomain(tickParams) : this.scale.domain; + const rawTicks = this.scale.ticks(tickParams, domain)?.ticks ?? []; + const fractionDigits = rawTicks.reduce((max, tick) => Math.max(max, countFractionDigits(tick)), 0); + const idGenerator = createIdsGenerator2(); + const tickFormatter = this.tickFormatter(domain, rawTicks, false, fractionDigits); + for (let index = 0; index < rawTicks.length; index++) { + const tick = rawTicks[index]; + const translation = this.scale.convert(tick); + if (!this.inRange(translation)) + continue; + const tickLabel = tickFormatter(tick, index); + if (tickLabel == null || tickLabel === "") + continue; + const tickId = idGenerator(toPlainText(tickLabel)); + ticks.push({ tick, tickId, tickLabel, translation }); + } + return { rawTicks, fractionDigits, ticks }; + } +}; +_AxisTicks.DefaultTickCount = 5; +_AxisTicks.DefaultMinSpacing = 10; +var AxisTicks = _AxisTicks; +var { + BaseProperties: BaseProperties23, + ZIndexMap: ZIndexMap10, + ProxyProperty: ProxyProperty4, + Property: Property63, + LayoutElement: LayoutElement5, + Group: Group8, + Rect: Rect5, + Marker: Marker22, + TranslatableGroup: TranslatableGroup5, + BBox: BBox15, + expandLegendPosition: expandLegendPosition2 +} = module_support_exports; +var GradientBar = class extends BaseProperties23 { + constructor() { + super(...arguments); + this.thickness = 16; + this.preferredLength = 100; + } +}; +__decorateClass2([ + Property63 +], GradientBar.prototype, "thickness", 2); +__decorateClass2([ + Property63 +], GradientBar.prototype, "preferredLength", 2); +var GradientLegendScale = class extends module_support_exports.BaseProperties { + constructor(axisTicks) { + super(); + this.axisTicks = axisTicks; + } +}; +__decorateClass2([ + ProxyProperty4("axisTicks.label") +], GradientLegendScale.prototype, "label", 2); +__decorateClass2([ + ProxyProperty4("axisTicks.interval") +], GradientLegendScale.prototype, "interval", 2); +__decorateClass2([ + ProxyProperty4("axisTicks.padding") +], GradientLegendScale.prototype, "padding", 2); +var GradientLegend = class extends module_support_exports.BaseProperties { + constructor(ctx) { + super(); + this.ctx = ctx; + this.id = createId(this); + this.legendGroup = new TranslatableGroup5({ name: "legend", zIndex: ZIndexMap10.LEGEND }); + this.containerNode = this.legendGroup.appendChild(new Rect5({ name: "legend-container" })); + this.gradientRect = new Rect5(); + this.arrow = new Marker22({ shape: "triangle" }); + this.ticksGroup = new Group8({ name: "legend-axis-group" }); + this.cleanup = new CleanupRegistry(); + this.enabled = false; + this.position = "bottom"; + this.reverseOrder = false; + this.gradient = new GradientBar(); + this.spacing = 20; + this.border = new module_support_exports.Border(this.containerNode); + this.cornerRadius = 0; + this.fillOpacity = 1; + this.padding = 4; + this.data = []; + this.highlightManager = ctx.highlightManager; + this.axisTicks = new AxisTicks(ctx, this); + this.axisTicks.attachAxis(this.ticksGroup); + this.scale = new GradientLegendScale(this.axisTicks); + this.legendGroup.append([this.gradientRect, this.arrow, this.ticksGroup]); + this.cleanup.register( + ctx.eventsHub.on("highlight:change", () => this.onChartHoverChange()), + ctx.layoutManager.registerElement(LayoutElement5.Legend, (e) => this.onStartLayout(e)), + () => this.legendGroup.remove() + ); + } + isVertical() { + const { placement } = expandLegendPosition2(this.position); + return placement.startsWith("right") || placement.startsWith("left"); + } + destroy() { + this.cleanup.flush(); + } + attachLegend(scene) { + scene.appendChild(this.legendGroup); + } + onStartLayout(ctx) { + const [data] = this.data; + if (!this.enabled || !data?.enabled || data.legendType !== "gradient") { + this.legendGroup.visible = false; + return; + } + const { colorRange } = this.normalizeColorArrays(data); + const gradientRectBBox = this.updateGradientRect(ctx.layoutBox, colorRange); + const axisBBox = this.updateAxis(data, gradientRectBBox) ?? new BBox15(0, 0, 0, 0); + const legendBBox = BBox15.merge([gradientRectBBox, axisBBox]); + const { strokeWidth, padding: padding2 } = this.getContainerStyles(); + legendBBox.grow(padding2).grow(strokeWidth); + const { left, top } = this.getMeasurements(ctx.layoutBox, legendBBox); + this.updateContainer(legendBBox); + this.updateArrow(); + this.legendGroup.visible = true; + this.legendGroup.translationX = left; + this.legendGroup.translationY = top; + } + normalizeColorArrays(data) { + let colorDomain = data.colorDomain.slice(); + const colorRange = data.colorRange.slice(); + if (colorDomain.length === colorRange.length) { + return { colorDomain, colorRange }; + } + if (colorDomain.length > colorRange.length) { + colorRange.splice(colorDomain.length); + } + const [d0, d1] = colorDomain; + const count = colorRange.length; + colorDomain = colorRange.map((_, i) => { + if (i === 0) { + return d0; + } else if (i === count - 1) { + return d1; + } + return d0 + (d1 - d0) * i / (count - 1); + }); + return { colorDomain, colorRange }; + } + updateGradientRect(shrinkRect, colorRange) { + const { gradientRect, gradient: gradient2 } = this; + const { preferredLength, thickness } = gradient2; + const gradientRectBBox = new BBox15(0, 0, 0, 0); + let angle2; + if (this.isVertical()) { + angle2 = 0; + gradientRectBBox.width = thickness; + gradientRectBBox.height = Math.min(shrinkRect.height, preferredLength); + } else { + angle2 = 90; + gradientRectBBox.width = Math.min(shrinkRect.width, preferredLength); + gradientRectBBox.height = thickness; + } + gradientRect.x = gradientRectBBox.x; + gradientRect.y = gradientRectBBox.y; + gradientRect.width = gradientRectBBox.width; + gradientRect.height = gradientRectBBox.height; + gradientRect.fill = { + type: "gradient", + gradient: "linear", + colorSpace: "oklch", + colorStops: colorRange.map((color6, i) => ({ + stop: i / (colorRange.length - 1), + color: color6 + })), + rotation: angle2 + }; + return gradientRectBBox; + } + updateAxis(data, gradientRectBBox) { + const { axisTicks, gradient: gradient2, scale: scale2 } = this; + const { placement } = expandLegendPosition2(this.position); + const vertical = this.isVertical(); + const positiveAxis = this.reverseOrder !== vertical; + axisTicks.placement = placement; + const offset = gradient2.thickness + (scale2.padding ?? 0); + axisTicks.translationX = vertical ? offset : gradientRectBBox.x; + axisTicks.translationY = vertical ? gradientRectBBox.y : offset; + axisTicks.scale.domain = positiveAxis ? data.colorDomain.slice().reverse() : data.colorDomain; + axisTicks.scale.range = vertical ? [gradientRectBBox.x, gradientRectBBox.height] : [gradientRectBBox.y, gradientRectBBox.width]; + return axisTicks.calculateLayout(); + } + updateContainer(bbox) { + const containerStyles = this.getContainerStyles(); + module_support_exports.applyShapeStyle(this.containerNode, containerStyles); + this.containerNode.cornerRadius = containerStyles.cornerRadius; + this.containerNode.x = bbox.x; + this.containerNode.y = bbox.y; + this.containerNode.width = bbox.width; + this.containerNode.height = bbox.height; + } + updateArrow() { + const highlighted = this.highlightManager.getActiveHighlight(); + const { arrow } = this; + if (highlighted?.colorValue == null) { + arrow.visible = false; + return; + } + const { scale: scale2, label } = this.axisTicks; + const size = label.fontSize ?? 0; + const t = scale2.convert(highlighted.colorValue); + let { x, y } = this.gradientRect; + let rotation = Math.PI; + if (this.isVertical()) { + x -= size / 2; + y += t; + rotation /= 2; + } else { + x += t; + y -= size / 2; + } + arrow.visible = true; + arrow.fill = label.color; + arrow.rotation = rotation; + arrow.size = size; + arrow.translationX = x; + arrow.translationY = y; + } + getMeasurements(shrinkRect, legendBBox) { + function unreachable(_a) { + return void 0; + } + let { x: left, y: top } = shrinkRect; + const { width: width2, height: height2 } = legendBBox; + const { placement, floating, xOffset, yOffset } = expandLegendPosition2(this.position); + const containerStyles = this.getContainerStyles(); + left += containerStyles.strokeWidth + containerStyles.padding.left; + top += containerStyles.strokeWidth + containerStyles.padding.top; + switch (placement) { + case "left": + top += shrinkRect.height / 2 - height2 / 2; + break; + case "right": + left += shrinkRect.width - width2; + top += shrinkRect.height / 2 - height2 / 2; + break; + case "top": + left += shrinkRect.width / 2 - width2 / 2; + break; + case "bottom": + left += shrinkRect.width / 2 - width2 / 2; + top += shrinkRect.height - height2; + break; + case "right-top": + case "top-right": + left += shrinkRect.width - width2; + break; + case "right-bottom": + case "bottom-right": + left += shrinkRect.width - width2; + top += shrinkRect.height - height2; + break; + case "left-bottom": + case "bottom-left": + top += shrinkRect.height - height2; + break; + case "left-top": + case "top-left": + break; + default: + unreachable(placement); + } + if (!floating) { + switch (placement) { + case "left": + case "left-top": + case "left-bottom": + shrinkRect.shrink(width2 + this.spacing, "left"); + break; + case "right": + case "right-top": + case "right-bottom": + shrinkRect.shrink(width2 + this.spacing, "right"); + break; + case "top": + case "top-left": + case "top-right": + shrinkRect.shrink(height2 + this.spacing, "top"); + break; + case "bottom": + case "bottom-left": + case "bottom-right": + shrinkRect.shrink(height2 + this.spacing, "bottom"); + break; + default: + unreachable(placement); + } + } + left += xOffset; + top += yOffset; + return { top, left }; + } + getContainerStyles() { + const { stroke: stroke22, strokeOpacity, strokeWidth } = this.border; + const { cornerRadius, fill, fillOpacity, padding: padding2 } = this; + const isPaddingNumber = typeof padding2 === "number"; + return { + cornerRadius, + fill, + fillOpacity, + padding: { + top: isPaddingNumber ? padding2 : padding2.top ?? 0, + right: isPaddingNumber ? padding2 : padding2.right ?? 0, + bottom: isPaddingNumber ? padding2 : padding2.bottom ?? 0, + left: isPaddingNumber ? padding2 : padding2.left ?? 0 + }, + stroke: stroke22, + strokeOpacity, + strokeWidth: this.border.enabled ? strokeWidth : 0 + }; + } + onChartHoverChange() { + if (!this.enabled) + return; + this.updateArrow(); + } +}; +GradientLegend.className = "GradientLegend"; +__decorateClass2([ + Property63 +], GradientLegend.prototype, "enabled", 2); +__decorateClass2([ + Property63 +], GradientLegend.prototype, "position", 2); +__decorateClass2([ + Property63 +], GradientLegend.prototype, "reverseOrder", 2); +__decorateClass2([ + Property63 +], GradientLegend.prototype, "gradient", 2); +__decorateClass2([ + Property63 +], GradientLegend.prototype, "spacing", 2); +__decorateClass2([ + Property63 +], GradientLegend.prototype, "border", 2); +__decorateClass2([ + Property63 +], GradientLegend.prototype, "cornerRadius", 2); +__decorateClass2([ + Property63 +], GradientLegend.prototype, "fill", 2); +__decorateClass2([ + Property63 +], GradientLegend.prototype, "fillOpacity", 2); +__decorateClass2([ + Property63 +], GradientLegend.prototype, "padding", 2); +__decorateClass2([ + Property63 +], GradientLegend.prototype, "scale", 2); +var GradientLegendModule = { + type: "legend", + optionsKey: "gradientLegend", + packageType: "enterprise", + chartTypes: ["cartesian", "polar", "topology", "standalone"], + identifier: "gradient", + moduleFactory: (ctx) => new GradientLegend(ctx), + themeTemplate: { + enabled: false, + position: "bottom", + spacing: 20, + scale: { + padding: 13, + label: { + color: { $ref: "textColor" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + minSpacing: 5 + }, + interval: { + minSpacing: 15 + } + }, + gradient: { + preferredLength: 100, + thickness: 16 + }, + reverseOrder: false, + fill: { + $applySwitch: [ + { $path: "type" }, + { $ref: "chartBackgroundColour" }, + ["gradient", module_support_exports.FILL_GRADIENT_BLANK_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_BLANK_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_BLANK_DEFAULTS] + ] + } + }, + removable: "standalone-only" +}; +function injectWatermark(domManager, text2) { + const element2 = domManager.addChild("canvas-overlay", "watermark"); + const textElement = createElement("span"); + textElement.innerText = text2; + element2.addEventListener("animationend", () => { + domManager.removeChild("canvas-overlay", "watermark"); + domManager.removeStyles("watermark"); + }); + element2.classList.add("ag-watermark"); + element2.appendChild(textElement); +} +var { + ordinalTimeAxisOptionsDefs: ordinalTimeAxisOptionsDefs2, + angleNumberAxisOptionsDefs: angleNumberAxisOptionsDefs2, + angleCategoryAxisOptionsDefs: angleCategoryAxisOptionsDefs2, + radiusNumberAxisOptionsDefs: radiusNumberAxisOptionsDefs2, + radiusCategoryAxisOptionsDefs: radiusCategoryAxisOptionsDefs2 +} = module_support_exports; +var OrdinalTimeAxisModule2 = { + type: "axis", + name: "ordinal-time", + chartType: "cartesian", + enterprise: true, + options: ordinalTimeAxisOptionsDefs2, + create: (ctx) => new OrdinalTimeAxis(ctx) +}; +var AngleNumberAxisModule2 = { + type: "axis", + name: "angle-number", + chartType: "polar", + enterprise: true, + options: angleNumberAxisOptionsDefs2, + create: (ctx) => new AngleNumberAxis(ctx) +}; +var AngleCategoryAxisModule2 = { + type: "axis", + name: "angle-category", + chartType: "polar", + enterprise: true, + options: angleCategoryAxisOptionsDefs2, + create: (ctx) => new AngleCategoryAxis(ctx) +}; +var RadiusNumberAxisModule2 = { + type: "axis", + name: "radius-number", + chartType: "polar", + enterprise: true, + options: radiusNumberAxisOptionsDefs2, + create: (ctx) => new RadiusNumberAxis(ctx) +}; +var RadiusCategoryAxisModule2 = { + type: "axis", + name: "radius-category", + chartType: "polar", + enterprise: true, + options: radiusCategoryAxisOptionsDefs2, + create: (ctx) => new RadiusCategoryAxis(ctx) +}; +var { Chart: Chart2 } = module_support_exports; +var StandaloneChart = class extends Chart2 { + getChartType() { + return "standalone"; + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(seriesRect.x); + group.translationY = Math.floor(seriesRect.y); + } + seriesRoot.visible = this.series[0].visible; + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: true, rect: seriesRect, paddedRect: layoutBox } + }); + } + getAriaLabel() { + const seriesType = this.series[0]?.type; + if (seriesType == null) + return ""; + const caption = this.getCaptionText(); + switch (seriesType) { + case "radial-gauge": + case "linear-gauge": { + const captions = []; + if (caption.length !== 0) { + captions.push(caption); + } + for (const series of this.series) { + captions.push(series.getCaptionText()); + } + return this.ctx.localeManager.t("ariaAnnounceGaugeChart", { caption: captions.join(". ") }); + } + case "treemap": + case "sunburst": + return this.ctx.localeManager.t("ariaAnnounceHierarchyChart", { caption }); + default: { + return this.ctx.localeManager.t("ariaAnnounceStandaloneChart", { caption }); + } + } + } +}; +StandaloneChart.className = "StandaloneChart"; +StandaloneChart.type = "standalone"; +var { isAgStandaloneChartOptions: isAgStandaloneChartOptions2, standaloneChartOptionsDefs: standaloneChartOptionsDefs2 } = module_support_exports; +var StandaloneChartModule2 = { + type: "chart", + name: "standalone", + enterprise: true, + options: standaloneChartOptionsDefs2, + detect: isAgStandaloneChartOptions2, + create(options, resources) { + return new StandaloneChart(options, resources); + } +}; +var { Chart: Chart22, MercatorScale: MercatorScale2, ChartAxisDirection: ChartAxisDirection24, Property: Property64 } = module_support_exports; +function isTopologySeries(series) { + return series.type === "map-shape" || series.type === "map-line" || series.type === "map-marker" || series.type === "map-shape-background" || series.type === "map-line-background"; +} +var TopologyChart = class extends Chart22 { + constructor(options, resources) { + super(options, resources); + this.ctx.zoomManager.updateAxes([ChartAxisDirection24.X, ChartAxisDirection24.Y]); + } + getChartType() { + return "topology"; + } + async updateData() { + await super.updateData(); + const options = this.getOptions(); + if (this.topology !== options.topology) { + this.topology = options.topology; + } + const { topology } = this; + for (const series of this.series) { + if (isTopologySeries(series)) { + series.setChartTopology(topology); + } + } + } + performLayout(ctx) { + const { seriesRoot, annotationRoot } = this; + const { layoutBox } = ctx; + const seriesRect = layoutBox.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding()); + this.seriesRect = seriesRect; + this.animationRect = seriesRect; + const mapSeries = this.series.filter(isTopologySeries); + const combinedBbox = mapSeries.reduce((combined, series) => { + if (!series.visible) + return combined; + const bbox = series.topologyBounds; + if (bbox == null) + return combined; + if (combined == null) + return bbox; + return combined.merge(bbox); + }, void 0); + let scale2; + if (combinedBbox != null) { + const { lon0, lat0, lon1, lat1 } = combinedBbox; + const domain = [ + [lon0, lat0], + [lon1, lat1] + ]; + const bounds = MercatorScale2.bounds(domain); + const { width: width2, height: height2 } = seriesRect; + const viewBoxScale = Math.min(width2 / bounds.width, height2 / bounds.height); + const viewBoxWidth = bounds.width * viewBoxScale; + const viewBoxHeight = bounds.height * viewBoxScale; + const viewBoxOriginX = (width2 - viewBoxWidth) / 2; + const viewBoxOriginY = (height2 - viewBoxHeight) / 2; + const x0 = viewBoxOriginX; + const y0 = viewBoxOriginY; + const x1 = viewBoxOriginX + viewBoxWidth; + const y1 = viewBoxOriginY + viewBoxHeight; + const xZoom = this.ctx.zoomManager.getAxisZoom(ChartAxisDirection24.X); + const yZoom = this.ctx.zoomManager.getAxisZoom(ChartAxisDirection24.Y); + const xSpan = (x1 - x0) / (xZoom.max - xZoom.min); + const xStart = x0 - xSpan * xZoom.min; + const ySpan = (y1 - y0) / (1 - yZoom.min - (1 - yZoom.max)); + const yStart = y0 - ySpan * (1 - yZoom.max); + scale2 = new MercatorScale2(domain, [ + [xStart, yStart], + [xStart + xSpan, yStart + ySpan] + ]); + } + for (const series of mapSeries) { + series.scale = scale2; + } + const seriesVisible = this.series.some((s) => s.visible); + seriesRoot.visible = seriesVisible; + for (const group of [seriesRoot, annotationRoot]) { + group.translationX = Math.floor(seriesRect.x); + group.translationY = Math.floor(seriesRect.y); + group.setClipRect(seriesRect.clone()); + } + this.ctx.layoutManager.emitLayoutComplete(ctx, { + series: { visible: seriesVisible, rect: seriesRect, paddedRect: layoutBox } + }); + } +}; +TopologyChart.className = "TopologyChart"; +TopologyChart.type = "topology"; +__decorateClass2([ + Property64 +], TopologyChart.prototype, "topology", 2); +var { isAgTopologyChartOptions: isAgTopologyChartOptions2, topologyChartOptionsDefs: topologyChartOptionsDefs2 } = module_support_exports; +var TopologyChartModule2 = { + type: "chart", + name: "topology", + enterprise: true, + options: topologyChartOptionsDefs2, + detect: isAgTopologyChartOptions2, + create(options, resources) { + return new TopologyChart(options, resources); + } +}; +var { + annotationCalloutStylesDefs: annotationCalloutStylesDefs2, + annotationNoteStylesDefs: annotationNoteStylesDefs2, + annotationTextStylesDef: annotationTextStylesDef2, + annotationCommentStylesDefs: annotationCommentStylesDefs2, + annotationMeasurerStylesDefs: annotationMeasurerStylesDefs2, + annotationQuickMeasurerStylesDefs: annotationQuickMeasurerStylesDefs2, + annotationShapeStylesDefs: annotationShapeStylesDefs2, + annotationChannelTextDefs: annotationChannelTextDefs2, + annotationCrossLineStyleDefs: annotationCrossLineStyleDefs2, + annotationFibonacciStylesDefs: annotationFibonacciStylesDefs2, + annotationLineStyleDefs: annotationLineStyleDefs2, + annotationLineTextDefs: annotationLineTextDefs2, + annotationDisjointChannelStyleDefs: annotationDisjointChannelStyleDefs2, + annotationParallelChannelStyleDefs: annotationParallelChannelStyleDefs2 +} = module_support_exports; +var serializableDate2 = optionsDefs( + { + __type: required(constant("date")), + value: or(string, number) + }, + "a serializable date object" +); +var xValue = or(string, number, serializableDate2); +var annotationValue = or( + xValue, + optionsDefs({ + value: xValue, + groupPercentage: numberRange(-1, 2) + }) +); +var channelAnnotationTextOptionsDef = { + ...annotationChannelTextDefs2, + label: string +}; +var lineAnnotationTextOptionsDef = { + ...annotationLineTextDefs2, + label: string +}; +var annotationPointOptionsDef = { + x: annotationValue, + y: number +}; +var annotationInitialStateOptionsDef = typeUnion( + { + line: { + ...annotationLineStyleDefs2, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef + }, + "horizontal-line": { + ...annotationCrossLineStyleDefs2, + value: annotationValue, + text: lineAnnotationTextOptionsDef + }, + "vertical-line": { + ...annotationCrossLineStyleDefs2, + value: annotationValue, + text: lineAnnotationTextOptionsDef + }, + "disjoint-channel": { + ...annotationDisjointChannelStyleDefs2, + startHeight: number, + endHeight: number, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: channelAnnotationTextOptionsDef + }, + "parallel-channel": { + ...annotationParallelChannelStyleDefs2, + height: number, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: channelAnnotationTextOptionsDef + }, + "fibonacci-retracement": { + ...annotationFibonacciStylesDefs2, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef, + reverse: boolean + }, + "fibonacci-retracement-trend-based": { + ...annotationFibonacciStylesDefs2, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + endRetracement: annotationPointOptionsDef, + text: lineAnnotationTextOptionsDef, + reverse: boolean + }, + callout: { + ...annotationCalloutStylesDefs2, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef, + text: string + }, + comment: { + ...annotationCommentStylesDefs2, + ...annotationPointOptionsDef, + text: string + }, + note: { + ...annotationNoteStylesDefs2, + ...annotationPointOptionsDef, + text: string + }, + text: { + ...annotationTextStylesDef2, + ...annotationPointOptionsDef, + text: string + }, + arrow: { + ...annotationLineStyleDefs2, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "arrow-up": { + ...annotationShapeStylesDefs2, + ...annotationPointOptionsDef + }, + "arrow-down": { + ...annotationShapeStylesDefs2, + ...annotationPointOptionsDef + }, + "date-range": { + ...annotationMeasurerStylesDefs2, + extendAbove: boolean, + extendBelow: boolean, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "price-range": { + ...annotationMeasurerStylesDefs2, + extendLeft: boolean, + extendRight: boolean, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "date-price-range": { + ...annotationMeasurerStylesDefs2, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + }, + "quick-date-price-range": { + ...annotationMeasurerStylesDefs2, + ...annotationQuickMeasurerStylesDefs2, + text: lineAnnotationTextOptionsDef, + start: annotationPointOptionsDef, + end: annotationPointOptionsDef + } + }, + "an annotation initial state object" +); +var initialStateOptionsDef = { + chartType: union("candlestick", "hollow-candlestick", "ohlc", "line", "step-line", "hlc", "high-low"), + annotations: arrayOfDefs(annotationInitialStateOptionsDef), + legend: arrayOfDefs( + { + visible: boolean, + seriesId: string, + itemId: string, + legendItemName: string + }, + "legend state array" + ), + zoom: { + rangeX: { + start: or(number, serializableDate2), + end: or(number, serializableDate2) + }, + rangeY: { + start: or(number, serializableDate2), + end: or(number, serializableDate2) + }, + ratioX: { + start: and(ratio, lessThan("end")), + end: and(ratio, greaterThan("start")) + }, + ratioY: { + start: and(ratio, lessThan("end")), + end: and(ratio, greaterThan("start")) + }, + autoScaledAxes: arrayOf(constant("y")) + } +}; +var { annotationOptionsDef: annotationOptionsDef2 } = module_support_exports; +var AnnotationsModule2 = { + type: "plugin", + name: "annotations", + chartType: "cartesian", + options: annotationOptionsDef2, + create() { + return null; + } +}; +var NavigatorModule2 = { + type: "plugin", + name: "navigator", + chartType: "cartesian", + options: navigatorOptionsDef2, + create() { + return null; + } +}; +var InitialStateModule = { + type: "plugin", + name: "initialState", + options: initialStateOptionsDef, + create() { + return null; + } +}; +function computeNodeGraph(nodes, links, includeCircularReferences) { + if (!includeCircularReferences) { + links = removeCircularLinks(links); + } + const nodeGraph = /* @__PURE__ */ new Map(); + for (const datum of nodes) { + nodeGraph.set(datum.id, { + datum, + linksBefore: [], + linksAfter: [], + maxPathLengthBefore: -1, + maxPathLengthAfter: -1 + }); + } + let maxPathLength = 0; + for (const [id, node] of nodeGraph.entries()) { + maxPathLength = Math.max( + maxPathLength, + computePathLength(nodeGraph, links, node, id, -1, []) + computePathLength(nodeGraph, links, node, id, 1, []) + 1 + ); + } + return { links, nodeGraph, maxPathLength }; +} +function findCircularLinks(links, link, into, stack) { + const stackIndex = stack.indexOf(link); + if (stackIndex !== -1) { + for (let i = stackIndex; i < stack.length; i += 1) { + into.add(stack[i]); + } + return; + } + stack.push(link); + const { toNode } = link; + for (const next of links) { + if (next.fromNode === toNode) { + findCircularLinks(links, next, into, stack); + } + } + stack.pop(); +} +function removeCircularLinks(links) { + const circularLinks = /* @__PURE__ */ new Set(); + for (const link of links) { + findCircularLinks(links, link, circularLinks, []); + } + if (circularLinks.size !== 0) { + logger_exports.warnOnce("Some links formed circular references. These will be removed from the output."); + } + return circularLinks.size === 0 ? links : links.filter((link) => !circularLinks.has(link)); +} +function computePathLength(nodeGraph, links, node, id, direction, stack) { + if (stack.includes(id)) { + return Infinity; + } + let maxPathLength = direction === -1 ? node.maxPathLengthBefore : node.maxPathLengthAfter; + if (maxPathLength === -1) { + maxPathLength = 0; + const connectedLinks = direction === -1 ? node.linksBefore : node.linksAfter; + for (const link of links) { + const { fromNode, toNode } = link; + const linkId = direction === -1 ? toNode.id : fromNode.id; + const nextNodeId = direction === -1 ? fromNode.id : toNode.id; + const nextNode = id === linkId ? nodeGraph.get(nextNodeId) : void 0; + if (nextNode == null) + continue; + connectedLinks.push({ node: nextNode, link }); + stack?.push(id); + maxPathLength = Math.max( + maxPathLength, + computePathLength(nodeGraph, links, nextNode, nextNodeId, direction, stack) + 1 + ); + stack?.pop(); + } + if (direction === -1) { + node.maxPathLengthBefore = maxPathLength; + } else { + node.maxPathLengthAfter = maxPathLength; + } + } + return maxPathLength; +} +var { Series: Series3, DataController: DataController2, keyProperty: keyProperty7, valueProperty: valueProperty10, Selection: Selection5, Group: Group9, TransformableText: TransformableText2 } = module_support_exports; +var FlowProportionSeriesNodeEvent = class extends module_support_exports.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + const { datumIndex } = datum; + const nodeDatum = series.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + this.size = nodeDatum?.size; + this.label = nodeDatum?.type === 1 ? nodeDatum?.label : void 0; + } +}; +var FlowProportionSeries = class extends Series3 { + constructor() { + super(...arguments); + this.NodeEvent = FlowProportionSeriesNodeEvent; + this.nodeCount = 0; + this.linkCount = 0; + this.linksDataModel = void 0; + this.linksProcessedData = void 0; + this.nodesDataModel = void 0; + this.nodesProcessedData = void 0; + this.processedNodes = /* @__PURE__ */ new Map(); + this.linkGroup = this.contentGroup.appendChild(new Group9({ name: "linkGroup" })); + this.nodeGroup = this.contentGroup.appendChild(new Group9({ name: "nodeGroup" })); + this.focusLinkGroup = this.highlightGroup.appendChild(new Group9({ name: "linkGroup" })); + this.focusNodeGroup = this.highlightGroup.appendChild(new Group9({ name: "nodeGroup" })); + this.highlightLinkGroup = this.highlightGroup.appendChild(new Group9({ name: "linkGroup" })); + this.highlightNodeGroup = this.highlightGroup.appendChild(new Group9({ name: "nodeGroup" })); + this.labelSelection = Selection5.select( + this.labelGroup, + TransformableText2 + ); + this.linkSelection = Selection5.select( + this.linkGroup, + () => this.linkFactory() + ); + this.nodeSelection = Selection5.select( + this.nodeGroup, + () => this.nodeFactory() + ); + this.focusLinkSelection = Selection5.select( + this.focusLinkGroup, + () => this.linkFactory() + ); + this.focusNodeSelection = Selection5.select( + this.focusNodeGroup, + () => this.nodeFactory() + ); + this.highlightLinkSelection = Selection5.select( + this.highlightLinkGroup, + () => this.linkFactory() + ); + this.highlightNodeSelection = Selection5.select( + this.highlightNodeGroup, + () => this.nodeFactory() + ); + } + get nodes() { + return this.properties.nodes; + } + async processData(dataController) { + const { data, nodes } = this; + if (data == null) + return; + const { fromKey, toKey, sizeKey, idKey, labelKey } = this.properties; + const nodesDataController = new DataController2("standalone", dataController.suppressFieldDotNotation); + const nodesDataModelPromise = nodes == null ? null : nodesDataController.request( + this.id, + module_support_exports.DataSet.wrap(nodes) ?? module_support_exports.DataSet.empty(), + { + props: [ + keyProperty7(idKey, void 0, { id: "idValue", includeProperty: false }), + ...labelKey == null ? [] : [valueProperty10(labelKey, void 0, { id: "labelValue", includeProperty: false })] + ], + groupByKeys: true + } + ); + const linksDataModelPromise = dataController.request(this.id, data, { + props: [ + valueProperty10(fromKey, void 0, { id: "fromValue", includeProperty: false }), + valueProperty10(toKey, void 0, { id: "toValue", includeProperty: false }), + ...sizeKey == null ? [] : [ + valueProperty10(sizeKey, void 0, { + id: "sizeValue", + includeProperty: false, + missingValue: 0 + }) + ] + ], + groupByKeys: false + }); + if (nodes != null) { + nodesDataController.execute(); + } + const [nodesDataModel, linksDataModel] = await Promise.all([ + nodesDataModelPromise ?? Promise.resolve(null), + linksDataModelPromise + ]); + this.nodesDataModel = nodesDataModel?.dataModel; + this.nodesProcessedData = nodesDataModel?.processedData; + this.linksDataModel = linksDataModel?.dataModel; + this.linksProcessedData = linksDataModel?.processedData; + const processedNodes = /* @__PURE__ */ new Map(); + if (nodesDataModel == null) { + const fromIdValues = linksDataModel.dataModel.resolveColumnById( + this, + "fromValue", + linksDataModel.processedData + ); + const toIdValues = linksDataModel.dataModel.resolveColumnById( + this, + "toValue", + linksDataModel.processedData + ); + const createImplicitNode = (id) => { + const datumIndex = processedNodes.size; + const label = id; + return { + series: this, + itemId: void 0, + datum: {}, + // Must be a referential object for tooltips + datumIndex: { type: 1, index: datumIndex }, + type: 1, + index: datumIndex, + linksBefore: [], + linksAfter: [], + id, + size: 0, + label, + style: this.getNodeStyle( + { + datumIndex: { type: 1, index: datumIndex }, + datum: {}, + size: 0, + label + }, + datumIndex, + false + ) + }; + }; + const linkData = linksDataModel.processedData.dataSources.get(this.id)?.data; + if (linkData) { + for (const [datumIndex] of linkData.entries()) { + const fromId = fromIdValues[datumIndex]; + const toId = toIdValues[datumIndex]; + if (fromId == null || toId == null) + continue; + if (!processedNodes.has(fromId)) { + processedNodes.set(fromId, createImplicitNode(fromId)); + } + if (!processedNodes.has(toId)) { + processedNodes.set(toId, createImplicitNode(toId)); + } + } + } + } else { + const nodeIdValues = nodesDataModel.dataModel.resolveColumnById( + this, + "idValue", + nodesDataModel.processedData + ); + const labelValues = labelKey == null ? void 0 : nodesDataModel.dataModel.resolveColumnById( + this, + "labelValue", + nodesDataModel.processedData + ); + const nodeData = nodesDataModel.processedData.dataSources.get(this.id)?.data; + if (nodeData) { + for (const [datumIndex, datum] of nodeData.entries()) { + const id = nodeIdValues[datumIndex]; + const label = labelValues?.[datumIndex]; + const nodeDatumIndex = { type: 1, index: datumIndex }; + processedNodes.set(id, { + series: this, + itemId: void 0, + datum, + datumIndex: nodeDatumIndex, + type: 1, + index: datumIndex, + linksBefore: [], + linksAfter: [], + id, + size: 0, + label, + style: this.getNodeStyle( + { datumIndex: nodeDatumIndex, datum, size: 0, label }, + datumIndex, + false + ) + }); + } + } + } + this.processedNodes = processedNodes; + } + getNodeGraph(createNode, createLink, { includeCircularReferences }) { + const { linksDataModel, linksProcessedData } = this; + if (linksDataModel == null || linksProcessedData == null) { + const { links: links2, nodeGraph: nodeGraph2, maxPathLength: maxPathLength2 } = computeNodeGraph( + (/* @__PURE__ */ new Map()).values(), + [], + includeCircularReferences + ); + this.nodeCount = 0; + this.linkCount = 0; + return { nodeGraph: nodeGraph2, links: links2, maxPathLength: maxPathLength2 }; + } + const { sizeKey } = this.properties; + const fromIdValues = linksDataModel.resolveColumnById(this, "fromValue", linksProcessedData); + const toIdValues = linksDataModel.resolveColumnById(this, "toValue", linksProcessedData); + const sizeValues = sizeKey == null ? void 0 : linksDataModel.resolveColumnById(this, "sizeValue", linksProcessedData); + const nodesById = /* @__PURE__ */ new Map(); + for (const datum of this.processedNodes.values()) { + const node = createNode(datum); + nodesById.set(datum.id, node); + } + const baseLinks = []; + const linkData = linksProcessedData.dataSources.get(this.id)?.data; + if (linkData) { + for (const [datumIndex, datum] of linkData.entries()) { + const fromId = fromIdValues[datumIndex]; + const toId = toIdValues[datumIndex]; + const size = sizeValues == null ? 1 : sizeValues[datumIndex]; + const fromNode = nodesById.get(fromId); + const toNode = nodesById.get(toId); + if (size <= 0 || fromNode == null || toNode == null) + continue; + const linkNodeDatumIndex = { type: 0, index: datumIndex }; + const link = createLink({ + series: this, + itemId: void 0, + datum, + datumIndex: linkNodeDatumIndex, + type: 0, + index: datumIndex, + fromNode, + toNode, + size, + style: this.getLinkStyle( + { datum, datumIndex: linkNodeDatumIndex }, + fromNode.datumIndex, + false + ) + }); + baseLinks.push(link); + } + } + const { links, nodeGraph, maxPathLength } = computeNodeGraph( + nodesById.values(), + baseLinks, + includeCircularReferences + ); + for (const node of nodeGraph.values()) { + node.datum.linksBefore = node.linksBefore.map((linkedNode) => linkedNode.link); + node.datum.linksAfter = node.linksAfter.map((linkedNode) => linkedNode.link); + } + this.nodeCount = nodeGraph.size; + this.linkCount = links.length; + return { nodeGraph, links, maxPathLength }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update(opts) { + const { seriesRect } = opts; + const newNodeDataDependencies = { + seriesRectWidth: seriesRect?.width ?? 0, + seriesRectHeight: seriesRect?.height ?? 0 + }; + if (this._nodeDataDependencies == null || this._nodeDataDependencies.seriesRectWidth !== newNodeDataDependencies.seriesRectWidth || this._nodeDataDependencies.seriesRectHeight !== newNodeDataDependencies.seriesRectHeight) { + this._nodeDataDependencies = newNodeDataDependencies; + } + this.updateSelections(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedDatum?.series === this && highlightedDatum.type == null) { + const { itemId } = highlightedDatum; + highlightedDatum = itemId == null ? void 0 : nodeData.find((node) => node.type === 1 && node.id === itemId); + } else if (highlightedDatum?.series !== this) { + highlightedDatum = void 0; + } + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = highlightedDatum == null ? 1 : this.properties.highlight.unhighlightedItem.opacity ?? 1; + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection: this.labelSelection }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + this.linkSelection = this.updateLinkSelection({ + nodeData: nodeData.filter( + (d) => d.type === 0 + /* Link */ + ), + datumSelection: this.linkSelection + }); + this.updateLinkNodes({ datumSelection: this.linkSelection, isHighlight: false }); + this.nodeSelection = this.updateNodeSelection({ + nodeData: nodeData.filter( + (d) => d.type === 1 + /* Node */ + ), + datumSelection: this.nodeSelection + }); + this.updateNodeNodes({ datumSelection: this.nodeSelection, isHighlight: false }); + let focusLinkSelection; + let focusNodeSelection; + let highlightLinkSelection; + let highlightNodeSelection; + if (highlightedDatum?.type === 1) { + focusLinkSelection = nodeData.filter((node) => { + return node.type === 0 && (node.toNode === highlightedDatum || node.fromNode === highlightedDatum); + }); + focusNodeSelection = focusLinkSelection.map((link) => { + return link.fromNode === highlightedDatum ? link.toNode : link.fromNode; + }); + focusNodeSelection.push(highlightedDatum); + highlightLinkSelection = []; + highlightNodeSelection = [highlightedDatum]; + } else if (highlightedDatum?.type === 0) { + focusLinkSelection = [highlightedDatum]; + focusNodeSelection = [highlightedDatum.fromNode, highlightedDatum.toNode]; + highlightLinkSelection = [highlightedDatum]; + highlightNodeSelection = []; + } else { + focusLinkSelection = []; + focusNodeSelection = []; + highlightLinkSelection = []; + highlightNodeSelection = []; + } + this.focusLinkSelection = this.updateLinkSelection({ + nodeData: focusLinkSelection, + datumSelection: this.focusLinkSelection + }); + this.updateLinkNodes({ datumSelection: this.focusLinkSelection, isHighlight: false }); + this.focusNodeSelection = this.updateNodeSelection({ + nodeData: focusNodeSelection, + datumSelection: this.focusNodeSelection + }); + this.updateNodeNodes({ datumSelection: this.focusNodeSelection, isHighlight: false }); + this.highlightLinkSelection = this.updateLinkSelection({ + nodeData: highlightLinkSelection, + datumSelection: this.highlightLinkSelection + }); + this.updateLinkNodes({ datumSelection: this.highlightLinkSelection, isHighlight: true }); + this.highlightNodeSelection = this.updateNodeSelection({ + nodeData: highlightNodeSelection, + datumSelection: this.highlightNodeSelection + }); + this.updateNodeNodes({ datumSelection: this.highlightNodeSelection, isHighlight: true }); + } + resetAnimation(_chartAnimationPhase) { + } + dataCount() { + return Number.NaN; + } + getSeriesDomain(_direction) { + return []; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + legendItemSymbol(_type, nodeIndex, format = {}) { + const { fills, strokes } = this.properties; + const { + fill = fills[nodeIndex % fills.length], + fillOpacity = 1, + stroke: stroke22 = strokes[nodeIndex % strokes.length], + strokeWidth = 0, + strokeOpacity = 1, + lineDash = [0], + lineDashOffset = 0 + } = format; + return { + marker: { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") + return []; + const { showInLegend } = this.properties; + return Array.from( + this.processedNodes.values(), + ({ id, label }, nodeIndex) => ({ + legendType: "category", + id: this.id, + itemId: id, + seriesId: this.id, + enabled: true, + label: { text: label ?? id }, + symbol: this.legendItemSymbol(1, nodeIndex), + hideInLegend: !showInLegend, + isFixed: true + }) + ); + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.linkSelection.each((node, datum) => { + const distanceSquared2 = node.distanceSquared(x, y); + if (distanceSquared2 < minDistanceSquared) { + minDistanceSquared = distanceSquared2; + minDatum = datum; + } + }); + this.nodeSelection.each((node, datum) => { + const distanceSquared2 = node.distanceSquared(x, y); + if (distanceSquared2 < minDistanceSquared) { + minDistanceSquared = distanceSquared2; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + getDatumAriaText(datum, description) { + if (datum.type === 0) { + return this.ctx.localeManager.t("ariaAnnounceFlowProportionLink", { + index: datum.index + 1, + count: this.linkCount, + from: datum.fromNode.id, + to: datum.toNode.id, + size: datum.size, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }); + } else if (datum.type === 1) { + return this.ctx.localeManager.t("ariaAnnounceFlowProportionNode", { + index: datum.index + 1, + count: this.nodeCount, + description + }); + } + } + pickFocus(opts) { + const { datumIndexDelta: childDelta, otherIndexDelta: depthDelta } = opts; + const currentNodeDatum = this.contextNodeData?.nodeData[opts.datumIndex - opts.datumIndexDelta]; + let nextNodeDatum = currentNodeDatum; + if (depthDelta !== 0 || childDelta === 0) + return; + if (currentNodeDatum?.type === 0) { + const allLinks = Array.from(this.linkSelection, (link) => link.datum); + const selfIndex = allLinks.indexOf(currentNodeDatum); + const nextIndex = selfIndex + childDelta; + if (nextIndex >= 0 && nextIndex < allLinks.length) { + nextNodeDatum = allLinks[nextIndex]; + } else if (nextIndex > 0) { + nextNodeDatum = allLinks.at(-1); + } else { + const allNodes = Array.from(this.nodeSelection, (node) => node.datum); + nextNodeDatum = allNodes.at(-1); + } + } else if (currentNodeDatum?.type === 1) { + const allNodes = Array.from(this.nodeSelection, (node) => node.datum); + const selfIndex = allNodes.indexOf(currentNodeDatum); + const nextIndex = selfIndex + childDelta; + if (nextIndex >= 0 && nextIndex < allNodes.length) { + nextNodeDatum = allNodes[nextIndex]; + } else if (nextIndex < 0) { + nextNodeDatum = allNodes[0]; + } else { + const allLinks = Array.from(this.linkSelection, (link) => link.datum); + nextNodeDatum = allLinks[0]; + } + } + if (nextNodeDatum == null) + return; + const nodeDatum = nextNodeDatum.type === 1 ? Array.from(this.nodeSelection).find((n) => n.datum === nextNodeDatum) : Array.from(this.linkSelection).find((n) => n.datum === nextNodeDatum); + if (nodeDatum == null) + return; + const bounds = this.computeFocusBounds(nodeDatum.node); + if (bounds == null) + return; + return { + datum: nodeDatum.datum, + datumIndex: this.contextNodeData?.nodeData.indexOf(nodeDatum.datum) ?? 0, + otherIndex: 0, + bounds, + clipFocusBox: true + }; + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } +}; +var { Path: Path9, SceneChangeDetection: SceneChangeDetection7 } = module_support_exports; +function bezierControlPoints({ + radius, + startAngle, + endAngle, + tension +}) { + const cp0x = radius * Math.cos(startAngle); + const cp0y = radius * Math.sin(startAngle); + const cp3x = radius * Math.cos(endAngle); + const cp3y = radius * Math.sin(endAngle); + const cp1x = cp0x * tension; + const cp1y = cp0y * tension; + const cp2x = cp3x * tension; + const cp2y = cp3y * tension; + return { + x: [cp0x, cp1x, cp2x, cp3x], + y: [cp0y, cp1y, cp2y, cp3y] + }; +} +var ChordLink = class extends Path9 { + constructor() { + super(...arguments); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.startAngle1 = 0; + this.endAngle1 = 0; + this.startAngle2 = 0; + this.endAngle2 = 0; + this.tension = 1; + } + tensionedCurveTo(cp0x, cp0y, cp1x, cp1y, cp2x, cp2y, cp3x, cp3y) { + const { path, tension } = this; + const scale2 = 1 - tension; + path.cubicCurveTo( + (cp1x - cp0x) * scale2 + cp0x, + (cp1y - cp0y) * scale2 + cp0y, + (cp2x - cp3x) * scale2 + cp3x, + (cp2y - cp3y) * scale2 + cp3y, + cp3x, + cp3y + ); + } + updatePath() { + const { path, centerX, centerY, radius } = this; + let { startAngle1, endAngle1, startAngle2, endAngle2 } = this; + if (startAngle1 > startAngle2) { + [startAngle1, startAngle2] = [startAngle2, startAngle1]; + [endAngle1, endAngle2] = [endAngle2, endAngle1]; + } + path.clear(); + const startX = centerX + radius * Math.cos(startAngle1); + const startY = centerY + radius * Math.sin(startAngle1); + path.moveTo(startX, startY); + this.tensionedCurveTo( + startX, + startY, + centerX, + centerY, + centerX, + centerY, + centerX + radius * Math.cos(endAngle2), + centerY + radius * Math.sin(endAngle2) + ); + path.arc(centerX, centerY, radius, endAngle2, startAngle2, true); + this.tensionedCurveTo( + centerX + radius * Math.cos(startAngle2), + centerY + radius * Math.sin(startAngle2), + centerX, + centerY, + centerX, + centerY, + centerX + radius * Math.cos(endAngle1), + centerY + radius * Math.sin(endAngle1) + ); + path.arc(centerX, centerY, radius, endAngle1, startAngle1, true); + path.closePath(); + } +}; +__decorateClass2([ + SceneChangeDetection7() +], ChordLink.prototype, "centerX", 2); +__decorateClass2([ + SceneChangeDetection7() +], ChordLink.prototype, "centerY", 2); +__decorateClass2([ + SceneChangeDetection7() +], ChordLink.prototype, "radius", 2); +__decorateClass2([ + SceneChangeDetection7() +], ChordLink.prototype, "startAngle1", 2); +__decorateClass2([ + SceneChangeDetection7() +], ChordLink.prototype, "endAngle1", 2); +__decorateClass2([ + SceneChangeDetection7() +], ChordLink.prototype, "startAngle2", 2); +__decorateClass2([ + SceneChangeDetection7() +], ChordLink.prototype, "endAngle2", 2); +__decorateClass2([ + SceneChangeDetection7() +], ChordLink.prototype, "tension", 2); +var { + FillGradientDefaults: FillGradientDefaults22, + FillPatternDefaults: FillPatternDefaults22, + FillImageDefaults: FillImageDefaults22, + BaseProperties: BaseProperties24, + makeSeriesTooltip: makeSeriesTooltip8, + SeriesProperties: SeriesProperties2, + Property: Property65, + Label: Label6 +} = module_support_exports; +var ChordSeriesLabelProperties = class extends Label6 { + constructor() { + super(...arguments); + this.spacing = 1; + this.maxWidth = 1; + } +}; +__decorateClass2([ + Property65 +], ChordSeriesLabelProperties.prototype, "spacing", 2); +__decorateClass2([ + Property65 +], ChordSeriesLabelProperties.prototype, "maxWidth", 2); +var ChordSeriesLinkProperties = class extends BaseProperties24 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tension = 0; + } + getStyle(fills, strokes, index) { + const { fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset, tension } = this; + const fill = this.fill ?? fills[index % fills.length]; + const stroke22 = this.stroke ?? strokes[index % fills.length]; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + tension + }; + } +}; +__decorateClass2([ + Property65 +], ChordSeriesLinkProperties.prototype, "fill", 2); +__decorateClass2([ + Property65 +], ChordSeriesLinkProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property65 +], ChordSeriesLinkProperties.prototype, "stroke", 2); +__decorateClass2([ + Property65 +], ChordSeriesLinkProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property65 +], ChordSeriesLinkProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property65 +], ChordSeriesLinkProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property65 +], ChordSeriesLinkProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property65 +], ChordSeriesLinkProperties.prototype, "tension", 2); +__decorateClass2([ + Property65 +], ChordSeriesLinkProperties.prototype, "itemStyler", 2); +var ChordSeriesNodeProperties = class extends BaseProperties24 { + constructor() { + super(...arguments); + this.spacing = 1; + this.width = 1; + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(fills, strokes, index) { + const { fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const fill = this.fill ?? fills[index % fills.length]; + const stroke22 = this.stroke ?? strokes[index % fills.length]; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass2([ + Property65 +], ChordSeriesNodeProperties.prototype, "spacing", 2); +__decorateClass2([ + Property65 +], ChordSeriesNodeProperties.prototype, "width", 2); +__decorateClass2([ + Property65 +], ChordSeriesNodeProperties.prototype, "fill", 2); +__decorateClass2([ + Property65 +], ChordSeriesNodeProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property65 +], ChordSeriesNodeProperties.prototype, "stroke", 2); +__decorateClass2([ + Property65 +], ChordSeriesNodeProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property65 +], ChordSeriesNodeProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property65 +], ChordSeriesNodeProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property65 +], ChordSeriesNodeProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property65 +], ChordSeriesNodeProperties.prototype, "itemStyler", 2); +var ChordSeriesProperties = class extends SeriesProperties2 { + constructor() { + super(); + this.idKey = ""; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.sizeKey = void 0; + this.sizeName = void 0; + this.nodes = void 0; + this.fillGradientDefaults = new FillGradientDefaults22(); + this.fillPatternDefaults = new FillPatternDefaults22(); + this.fillImageDefaults = new FillImageDefaults22(); + this.fills = []; + this.strokes = []; + this.label = new ChordSeriesLabelProperties(); + this.link = new ChordSeriesLinkProperties(); + this.node = new ChordSeriesNodeProperties(); + this.tooltip = makeSeriesTooltip8(); + this.highlightStyle.deprecated = false; + } +}; +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "fromKey", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "toKey", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "idKey", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "idName", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "labelKey", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "labelName", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "sizeKey", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "sizeName", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "nodes", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "fillGradientDefaults", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "fillPatternDefaults", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "fillImageDefaults", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "fills", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "strokes", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "link", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "node", 2); +__decorateClass2([ + Property65 +], ChordSeriesProperties.prototype, "tooltip", 2); +var { + SeriesNodePickMode: SeriesNodePickMode6, + createDatumId: createDatumId6, + angleBetween: angleBetween22, + normalizeAngle360: normalizeAngle3604, + isBetweenAngles: isBetweenAngles2, + Sector: Sector3, + evaluateBezier: evaluateBezier2, + applyShapeStyle: applyShapeStyle7, + getShapeStyle: getShapeStyle2, + getLabelStyles: getLabelStyles2, + BBox: BBox16, + mergeDefaults: mergeDefaults10 +} = module_support_exports; +var nodeMidAngle = (node) => node.startAngle + angleBetween22(node.startAngle, node.endAngle) / 2; +var ChordSeries = class extends FlowProportionSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode6.NEAREST_NODE, SeriesNodePickMode6.EXACT_SHAPE_MATCH] + }); + this.properties = new ChordSeriesProperties(); + } + isLabelEnabled() { + return (this.properties.labelKey != null || this.nodes == null) && this.properties.label.enabled; + } + linkFactory() { + return new ChordLink(); + } + nodeFactory() { + return new Sector3(); + } + createNodeData() { + const { + id: seriesId, + _nodeDataDependencies: { seriesRectWidth, seriesRectHeight } = { seriesRectWidth: 0, seriesRectHeight: 0 }, + properties + } = this; + const { + fromKey, + toKey, + sizeKey, + labelKey, + label: { spacing: labelSpacing, maxWidth: labelMaxWidth, fontSize }, + node: { width: nodeWidth, spacing: nodeSpacing } + } = properties; + const centerX = seriesRectWidth / 2; + const centerY = seriesRectHeight / 2; + let labelData = []; + const { nodeGraph, links } = this.getNodeGraph( + (node) => ({ + ...node, + centerX, + centerY, + innerRadius: Number.NaN, + outerRadius: Number.NaN, + startAngle: Number.NaN, + endAngle: Number.NaN + }), + (link) => ({ + ...link, + centerX, + centerY, + radius: Number.NaN, + startAngle1: Number.NaN, + endAngle1: Number.NaN, + startAngle2: Number.NaN, + endAngle2: Number.NaN + }), + { includeCircularReferences: true } + ); + let totalSize = 0; + for (const [id, { datum: node, linksBefore, linksAfter }] of nodeGraph.entries()) { + const size = linksBefore.reduce((acc, { link }) => acc + link.size, 0) + linksAfter.reduce((acc, { link }) => acc + link.size, 0); + if (size === 0) { + nodeGraph.delete(id); + } else { + const { label } = properties; + node.size = size; + totalSize += node.size; + const labelText = label.enabled ? this.getLabelText( + node.label, + node.datum, + labelKey, + "label", + [], + label, + { datum: node.datum, value: node.label, fromKey, toKey, sizeKey, size: node.size } + ) : void 0; + node.label = toPlainText(labelText); + } + } + let labelInset = 0; + if (this.isLabelEnabled()) { + const measurer22 = cachedTextMeasurer(this.properties.label); + let maxMeasuredLabelWidth = 0; + for (const { datum: node } of nodeGraph.values()) { + const { id, label } = node; + if (label == null) + continue; + const text2 = wrapText(label, { + maxWidth: labelMaxWidth, + font: this.properties.label, + textWrap: "never" + }); + const { width: width2 } = measurer22.measureLines(text2); + maxMeasuredLabelWidth = Math.max(width2, maxMeasuredLabelWidth); + labelData.push({ + id, + text: text2, + centerX, + centerY, + angle: Number.NaN, + radius: Number.NaN, + size: node.size + }); + } + labelInset = maxMeasuredLabelWidth + labelSpacing; + } + const nodeCount = nodeGraph.size; + let radius = Math.min(seriesRectWidth, seriesRectHeight) / 2 - nodeWidth - labelInset; + let spacingSweep = nodeSpacing / radius; + if (labelInset !== 0 && (nodeCount * spacingSweep >= 1.5 * Math.PI || radius <= 0)) { + labelData = []; + radius = Math.min(seriesRectWidth, seriesRectHeight) / 2 - nodeWidth; + spacingSweep = nodeSpacing / radius; + } + if (nodeCount * spacingSweep >= 2 * Math.PI || radius <= 0) { + logger_exports.warnOnce("There was insufficient space to display the Chord Series."); + return; + } + const innerRadius = radius; + const outerRadius = radius + nodeWidth; + const sizeScale = Math.max((2 * Math.PI - nodeCount * spacingSweep) / totalSize, 0); + let nodeAngle = 0; + for (const { datum: node } of nodeGraph.values()) { + node.innerRadius = innerRadius; + node.outerRadius = outerRadius; + node.startAngle = nodeAngle; + node.endAngle = nodeAngle + node.size * sizeScale; + nodeAngle = node.endAngle + spacingSweep; + const midR = (node.innerRadius + node.outerRadius) / 2; + const midAngle = nodeMidAngle(node); + node.midPoint = { + x: node.centerX + midR * Math.cos(midAngle), + y: node.centerY + midR * Math.sin(midAngle) + }; + } + const nodeData = []; + for (const { datum: node, linksBefore, linksAfter } of nodeGraph.values()) { + const midAngle = nodeMidAngle(node); + const combinedLinks = [ + ...linksBefore.map((l) => ({ + link: l.link, + distance: angleBetween22(nodeMidAngle(l.node.datum), midAngle), + after: false + })), + ...linksAfter.map((l) => ({ + link: l.link, + distance: angleBetween22(nodeMidAngle(l.node.datum), midAngle), + after: true + })) + ]; + let linkAngle = node.startAngle; + for (const { link, after } of combinedLinks.toSorted((a, b) => a.distance - b.distance)) { + const linkSweep = link.size * sizeScale; + if (after) { + link.startAngle1 = linkAngle; + link.endAngle1 = linkAngle + linkSweep; + } else { + link.startAngle2 = linkAngle; + link.endAngle2 = linkAngle + linkSweep; + } + linkAngle += link.size * sizeScale; + } + nodeData.push(node); + } + const { tension } = this.properties.link; + for (const link of links) { + link.radius = radius; + const outer = bezierControlPoints({ + radius, + startAngle: link.startAngle1, + endAngle: link.endAngle2, + tension + }); + const inner = bezierControlPoints({ + radius, + startAngle: link.startAngle2, + endAngle: link.endAngle1, + tension + }); + const outerX = evaluateBezier2(...outer.x, 0.5); + const outerY = evaluateBezier2(...outer.y, 0.5); + const innerX = evaluateBezier2(...inner.x, 0.5); + const innerY = evaluateBezier2(...inner.y, 0.5); + link.midPoint = { + x: link.centerX + (outerX + innerX) / 2, + y: link.centerY + (outerY + innerY) / 2 + }; + nodeData.push(link); + } + for (const label of labelData) { + const node = nodeGraph.get(label.id)?.datum; + if (node == null) + continue; + label.radius = outerRadius + labelSpacing; + label.angle = normalizeAngle3604(node.startAngle + angleBetween22(node.startAngle, node.endAngle) / 2); + } + labelData.sort((a, b) => a.angle - b.angle); + let minAngle = Infinity; + let maxAngle = -Infinity; + labelData = labelData.filter((label) => { + const labelHeight = calcLineHeight(fontSize); + const da = Math.atan2(labelHeight / 2, label.radius); + const a0 = label.angle - da; + const a1 = label.angle + da; + if (isBetweenAngles2(minAngle, a0, a1)) + return false; + if (isBetweenAngles2(maxAngle, a0, a1)) + return false; + minAngle = Math.min(a0, minAngle); + maxAngle = Math.max(a1, maxAngle); + return true; + }); + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const params = { + toKey: this.properties.toKey, + fromKey: this.properties.fromKey, + sizeKey: this.properties.sizeKey, + size: Number.NaN + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { size, text: text2, centerX, centerY, radius, angle: angle2 }) => { + params.size = size; + const style2 = getLabelStyles2(this, void 0, params, this.properties.label, false, activeHighlight); + const { fontStyle, fontWeight, fontSize, fontFamily, color: fill } = style2; + label.visible = true; + label.translationX = centerX + radius * Math.cos(angle2); + label.translationY = centerY + radius * Math.sin(angle2); + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textBaseline = "middle"; + if (Math.cos(angle2) >= 0) { + label.textAlign = "left"; + label.rotation = angle2; + } else { + label.textAlign = "right"; + label.rotation = angle2 - Math.PI; + } + label.setBoxing(style2); + }); + } + updateNodeSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId6(datum.type, datum.id)); + } + getNodeStyle(nodeDatum, fromNodeDatumIndex, isHighlight) { + const { properties } = this; + const { fills, strokes, fillGradientDefaults: fillGradientDefaults3, fillPatternDefaults: fillPatternDefaults3, fillImageDefaults: fillImageDefaults3 } = properties; + const { itemStyler } = properties.node; + const highlightStyle = this.getHighlightStyle(isHighlight, nodeDatum.datumIndex); + const baseStyle = mergeDefaults10(highlightStyle, properties.node.getStyle(fills, strokes, fromNodeDatumIndex)); + let style2 = getShapeStyle2(baseStyle, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + if (itemStyler != null && nodeDatum.datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId6(nodeDatum.datumIndex.index, "node", isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style2); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style2 = getShapeStyle2( + mergeDefaults10(overrides, style2), + fillGradientDefaults3, + fillPatternDefaults3, + fillImageDefaults3 + ); + } + } + style2.opacity = 1; + return style2; + } + makeItemStylerParams({ datum, datumIndex, size = 0, label }, isHighlight, style2) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style2, + size, + label, + fill + }; + } + updateNodeNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((sector, datum) => { + const { datumIndex } = datum; + const style2 = this.getNodeStyle(datum, datumIndex.index, isHighlight); + applyShapeStyle7(sector, style2, fillBBox); + sector.centerX = datum.centerX; + sector.centerY = datum.centerY; + sector.innerRadius = datum.innerRadius; + sector.outerRadius = datum.outerRadius; + sector.startAngle = datum.startAngle; + sector.endAngle = datum.endAngle; + sector.inset = sector.strokeWidth / 2; + }); + } + updateLinkSelection(opts) { + return opts.datumSelection.update( + opts.nodeData, + void 0, + (datum) => createDatumId6(datum.type, datum.index, datum.fromNode.id, datum.toNode.id) + ); + } + getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, isHighlight) { + const { id: seriesId, properties } = this; + const { fills, strokes, fillGradientDefaults: fillGradientDefaults3, fillPatternDefaults: fillPatternDefaults3, fillImageDefaults: fillImageDefaults3 } = properties; + const { itemStyler } = properties.link; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults10( + highlightStyle, + properties.link.getStyle(fills, strokes, fromNodeDatumIndex.index) + ); + let style2 = getShapeStyle2(baseStyle, fillGradientDefaults3, fillPatternDefaults3, fillImageDefaults3); + if (itemStyler != null && datumIndex != null) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const overrides = this.cachedDatumCallback( + createDatumId6(datumIndex.index, "link", isHighlight ? "highlight" : "node"), + () => { + const highlightState = this.getHighlightStateString( + activeHighlight, + isHighlight, + fromNodeDatumIndex + ); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style2 + }); + } + ); + if (overrides) { + style2 = getShapeStyle2( + mergeDefaults10(overrides, style2), + fillGradientDefaults3, + fillPatternDefaults3, + fillImageDefaults3 + ); + } + } + style2.opacity = 1; + return style2; + } + updateLinkNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((link, datum) => { + const fromNodeDatumIndex = datum.fromNode.datumIndex; + const style2 = this.getLinkStyle(datum, fromNodeDatumIndex, isHighlight); + link.centerX = datum.centerX; + link.centerY = datum.centerY; + link.radius = datum.radius; + link.startAngle1 = datum.startAngle1; + link.endAngle1 = datum.endAngle1; + link.startAngle2 = datum.startAngle2; + link.endAngle2 = datum.endAngle2; + link.tension = style2.tension; + applyShapeStyle7(link, style2, fillBBox); + }); + } + getShapeFillBBox() { + const width2 = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const height2 = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const size = Math.min(width2, height2); + const x = (width2 - size) / 2; + const y = (height2 - size) / 2; + const bbox = new BBox16(x, y, width2, height2); + return { series: bbox, axis: bbox }; + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + linksProcessedData, + nodesProcessedData, + properties, + ctx: { formatManager } + } = this; + const { fromKey, toKey, sizeKey, sizeName, tooltip } = properties; + const seriesDatum = this.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + if (seriesDatum == null) + return; + const nodeIndex = seriesDatum.type === 0 ? seriesDatum.fromNode.index : seriesDatum.index; + const title = seriesDatum.type === 0 ? `${seriesDatum.fromNode.label} - ${seriesDatum.toNode.label}` : seriesDatum.label; + const datum = datumIndex.type === 0 ? linksProcessedData?.dataSources.get(this.id)?.data[datumIndex.index] : nodesProcessedData?.dataSources.get(this.id)?.data[datumIndex.index]; + const size = seriesDatum.size; + let format; + if (seriesDatum.type === 0) { + const fromNodeDatumIndex = seriesDatum.fromNode.datumIndex; + format = this.getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, false); + } else { + const label = seriesDatum.label; + format = this.getNodeStyle({ datumIndex, datum, size, label }, datumIndex.index, false); + } + const data = []; + if (sizeKey != null) { + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: size, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + domain: [], + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(size) }); + } + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(seriesDatum.type, nodeIndex, format), + data + }, + { + seriesId, + datum, + title, + fromKey, + toKey, + sizeKey, + sizeName, + size, + ...format + } + ); + } + computeFocusBounds(node) { + return node; + } + hasItemStylers() { + return this.properties.node.itemStyler != null || this.properties.link.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +ChordSeries.className = "ChordSeries"; +ChordSeries.type = "chord"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs8, chordSeriesThemeableOptionsDef: chordSeriesThemeableOptionsDef2 } = module_support_exports; +var chordSeriesOptionsDef = { + ...chordSeriesThemeableOptionsDef2, + ...commonSeriesOptionsDefs8, + type: required(constant("chord")), + fromKey: required(string), + toKey: required(string), + sizeKey: string, + sizeName: string +}; +chordSeriesOptionsDef.fillGradientDefaults = undocumented(fillGradientDefaults); +chordSeriesOptionsDef.fillPatternDefaults = undocumented(fillPatternDefaults); +chordSeriesOptionsDef.fillImageDefaults = undocumented(fillImageDefaults); +var ChordModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + solo: true, + identifier: "chord", + moduleFactory: (ctx) => new ChordSeries(ctx), + themeTemplate: { + series: { + fills: { $palette: "fills" }, + strokes: { $palette: "strokes" }, + // @ts-expect-error undocumented option + fillGradientDefaults: module_support_exports.FILL_GRADIENT_LINEAR_DEFAULTS, + fillPatternDefaults: module_support_exports.FILL_PATTERN_DEFAULTS, + fillImageDefaults: module_support_exports.FILL_IMAGE_DEFAULTS, + highlightStyle: { + series: { + dimOpacity: 0.2 + } + }, + highlight: module_support_exports.singleSeriesHighlightStyle(), + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 5, + maxWidth: 100 + }, + node: { + spacing: 8, + width: 10, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + link: { + fillOpacity: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + tension: 0.4 + } + }, + legend: { + enabled: false, + toggleSeries: false + } + } +}; +var ChordSeriesModule = { + type: "series", + name: "chord", + chartType: "standalone", + enterprise: true, + options: chordSeriesOptionsDef, + create: (ctx) => new ChordSeries(ctx) +}; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE7, CARTESIAN_POSITION: CARTESIAN_POSITION5 }, + ThemeSymbols: { DEFAULT_SHADOW_COLOUR: DEFAULT_SHADOW_COLOUR2 } +} = module_support_exports; +var isHorizontal = { $eq: [{ $path: ["/series/0/direction", void 0] }, "horizontal"] }; +var labelOptions = { + autoRotate: { $path: "/series/0/stageLabel/autoRotate" }, + autoRotateAngle: { $path: "/series/0/stageLabel/autoRotateAngle" }, + avoidCollisions: { $path: ["/series/0/stageLabel/avoidCollisions", true] }, + border: { $path: ["/series/0/stageLabel/border"] }, + color: { $path: ["/series/0/stageLabel/color", { $ref: "textColor" }] }, + cornerRadius: { $path: ["/series/0/stageLabel/cornerRadius"] }, + enabled: { + $if: [ + { $eq: [{ $path: "/series/0/stageLabel/enabled" }, void 0] }, + true, + { $path: "/series/0/stageLabel/enabled" } + ] + }, + fill: { $path: ["/series/0/stageLabel/fill"] }, + fillOpacity: { $path: ["/series/0/stageLabel/fillOpacity"] }, + fontSize: { $path: ["/series/0/stageLabel/fontSize", { $ref: "fontSize" }] }, + fontStyle: { $path: ["/series/0/stageLabel/fontStyle", { $ref: "fontStyle" }] }, + fontWeight: { $path: ["/series/0/stageLabel/fontWeight", { $ref: "fontWeight" }] }, + format: { $path: "/series/0/stageLabel/format" }, + formatter: { $path: "/series/0/stageLabel/formatter" }, + itemStyler: { $path: "/series/0/stageLabel/itemStyler" }, + minSpacing: { $path: "/series/0/stageLabel/minSpacing" }, + padding: { $path: ["/series/0/stageLabel/padding"] }, + rotation: { $path: ["/series/0/stageLabel/rotation", 0] } +}; +var FUNNEL_SERIES_AXES = [ + { + type: { + $if: [isHorizontal, CARTESIAN_AXIS_TYPE7.NUMBER, CARTESIAN_AXIS_TYPE7.CATEGORY] + }, + position: { + $if: [ + isHorizontal, + CARTESIAN_POSITION5.LEFT, + { + $if: [ + { $eq: [{ $path: ["/series/0/stageLabel/placement", void 0] }, "after"] }, + CARTESIAN_POSITION5.RIGHT, + CARTESIAN_POSITION5.LEFT + ] + } + ] + }, + label: { + $if: [isHorizontal, void 0, labelOptions] + } + }, + { + type: { + $if: [isHorizontal, CARTESIAN_AXIS_TYPE7.CATEGORY, CARTESIAN_AXIS_TYPE7.NUMBER] + }, + position: { + $if: [ + isHorizontal, + { + $if: [ + { $eq: [{ $path: ["/series/0/stageLabel/placement", void 0] }, "before"] }, + CARTESIAN_POSITION5.TOP, + CARTESIAN_POSITION5.BOTTOM + ] + }, + CARTESIAN_POSITION5.BOTTOM + ] + }, + label: { + $if: [isHorizontal, labelOptions, void 0] + } + } +]; +var FUNNEL_SERIES_THEME = { + series: { + direction: "vertical", + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + spacingRatio: 0.25, + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + [{ $path: ["/0", void 0, { $palette: "fills" }] }], + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", module_support_exports.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_SINGLE_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + [{ $path: ["/0", void 0, { $palette: "strokes" }] }] + ] + }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + dropOff: { + enabled: true, + fillOpacity: 0.2, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR2, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + highlight: module_support_exports.singleSeriesHighlightStyle() + }, + axes: { + [CARTESIAN_AXIS_TYPE7.NUMBER]: { + nice: false, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false + }, + label: { + enabled: false + } + }, + [CARTESIAN_AXIS_TYPE7.CATEGORY]: { + line: { + enabled: false + } + } + } +}; +var { lineDistanceSquared: lineDistanceSquared2, BBox: BBox17, Path: Path10, SceneChangeDetection: SceneChangeDetection8 } = module_support_exports; +var delta3 = 1e-6; +function pointsEq2([ax, ay], [bx, by]) { + return Math.abs(ax - bx) <= delta3 && Math.abs(ay - by) <= delta3; +} +var FunnelConnector = class extends Path10 { + constructor() { + super(...arguments); + this.x0 = 0; + this.y0 = 0; + this.x1 = 0; + this.y1 = 0; + this.x2 = 0; + this.y2 = 0; + this.x3 = 0; + this.y3 = 0; + } + get midPoint() { + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + return { + x: (x0 + x1 + x2 + x3) / 4, + y: (y0 + y1 + y2 + y3) / 4 + }; + } + distanceSquared(x, y) { + if (this.containsPoint(x, y)) + return 0; + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + return Math.min( + lineDistanceSquared2(x, y, x0, y0, x1, y1, Infinity), + lineDistanceSquared2(x, y, x1, y1, x2, y2, Infinity), + lineDistanceSquared2(x, y, x2, y2, x3, y3, Infinity), + lineDistanceSquared2(x, y, x3, y3, x0, y0, Infinity) + ); + } + computeBBox() { + const { x0, y0, x1, y1, x2, y2, x3, y3 } = this; + const x = Math.min(x0, x1, x2, x3); + const width2 = Math.max(x0, x1, x2, x3) - x; + const y = Math.min(y0, y1, y2, y3); + const height2 = Math.max(y0, y1, y2, y3) - y; + return new BBox17(x, y, width2, height2); + } + updatePath() { + const { path, x0, y0, x1, y1, x2, y2, x3, y3 } = this; + const points = [ + [x0, y0], + [x1, y1], + [x2, y2], + [x3, y3] + ]; + path.clear(); + let start2; + let current; + for (const p of points) { + if (start2 != null && pointsEq2(start2, p) || current != null && pointsEq2(current, p)) { + continue; + } + const [x, y] = p; + if (start2 == null) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + start2 ?? (start2 = p); + current = p; + } + path.closePath(); + } +}; +__decorateClass2([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x0", 2); +__decorateClass2([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y0", 2); +__decorateClass2([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x1", 2); +__decorateClass2([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y1", 2); +__decorateClass2([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x2", 2); +__decorateClass2([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y2", 2); +__decorateClass2([ + SceneChangeDetection8() +], FunnelConnector.prototype, "x3", 2); +__decorateClass2([ + SceneChangeDetection8() +], FunnelConnector.prototype, "y3", 2); +var { NODE_UPDATE_STATE_TO_PHASE_MAPPING: NODE_UPDATE_STATE_TO_PHASE_MAPPING2 } = module_support_exports; +function connectorStartingPosition(datum, _prevDatum, isVertical, _mode) { + const { x0, y0, x1, y1, x2, y2, x3, y3, opacity } = datum; + if (isVertical) { + return { + x0: (x0 + x3) / 2, + y0: (y0 + y3) / 2, + x1: (x1 + x2) / 2, + y1: (y1 + y2) / 2, + x2: (x1 + x2) / 2, + y2: (y1 + y2) / 2, + x3: (x0 + x3) / 2, + y3: (y0 + y3) / 2, + opacity + }; + } else { + return { + x0: (x0 + x1) / 2, + y0: (y0 + y1) / 2, + x1: (x0 + x1) / 2, + y1: (y0 + y1) / 2, + x2: (x2 + x3) / 2, + y2: (y2 + y3) / 2, + x3: (x2 + x3) / 2, + y3: (y2 + y3) / 2, + opacity + }; + } +} +function prepareConnectorAnimationFunctions(isVertical, mode) { + const isRemoved = (datum) => datum == null; + const fromFn = (connector, datum, status) => { + if (status === "updated" && isRemoved(datum)) { + status = "removed"; + } else if (status === "updated" && isRemoved(connector.previousDatum)) { + status = "added"; + } + let source; + if (status === "added" && connector.previousDatum == null && mode === "fade") { + source = { ...resetConnectorSelectionsFn(connector, datum), opacity: 0 }; + } else if (status === "unknown" || status === "added") { + source = connectorStartingPosition(datum, connector.previousDatum, isVertical, mode); + } else { + source = { + x0: connector.x0, + y0: connector.y0, + x1: connector.x1, + y1: connector.y1, + x2: connector.x2, + y2: connector.y2, + x3: connector.x3, + y3: connector.y3, + opacity: connector.opacity + }; + } + const phase = NODE_UPDATE_STATE_TO_PHASE_MAPPING2[status]; + return { ...source, phase }; + }; + const toFn = (connector, datum, status) => { + let source; + if (status === "removed" && connector.datum == null && mode === "fade") { + source = { ...resetConnectorSelectionsFn(connector, datum), opacity: 0 }; + } else if (status === "removed" || isRemoved(datum)) { + source = connectorStartingPosition(datum, connector.previousDatum, isVertical, mode); + } else { + source = resetConnectorSelectionsFn(connector, datum); + } + return source; + }; + return { fromFn, toFn }; +} +function resetConnectorSelectionsFn(_node, datum) { + const { x0, y0, x1, y1, x2, y2, x3, y3, opacity } = datum; + return { x0, y0, x1, y1, x2, y2, x3, y3, opacity }; +} +var { + SeriesNodePickMode: SeriesNodePickMode7, + SeriesZIndexMap: SeriesZIndexMap2, + valueProperty: valueProperty11, + keyProperty: keyProperty8, + ChartAxisDirection: ChartAxisDirection25, + updateLabelNode: updateLabelNode5, + SMALLEST_KEY_INTERVAL: SMALLEST_KEY_INTERVAL4, + LARGEST_KEY_INTERVAL: LARGEST_KEY_INTERVAL22, + diff: diff5, + fixNumericExtent: fixNumericExtent7, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation4, + resetMotion: resetMotion22, + resetLabelFn: resetLabelFn4, + animationValidation: animationValidation6, + computeBarFocusBounds: computeBarFocusBounds6, + ContinuousScale: ContinuousScale7, + Group: Group10, + Selection: Selection6, + PointerEvents: PointerEvents4, + motion: motion4, + checkCrisp: checkCrisp3, + createDatumId: createDatumId7, + applyShapeStyle: applyShapeStyle8 +} = module_support_exports; +var FunnelSeriesNodeEvent = class extends module_support_exports.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.xKey = series.properties.stageKey; + this.yKey = series.properties.valueKey; + } +}; +var BaseFunnelSeries = class extends module_support_exports.AbstractBarSeries { + constructor({ + moduleCtx, + animationResetFns + }) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode7.AXIS_ALIGNED, SeriesNodePickMode7.EXACT_SHAPE_MATCH], + propertyKeys: { + x: ["stageKey"], + y: ["valueKey"] + }, + propertyNames: { + x: [], + y: [] + }, + categoryKey: "xValue", + datumSelectionGarbageCollection: false, + animationResetFns: { + datum: animationResetFns.datum, + label: resetLabelFn4 + } + }); + this.NodeEvent = FunnelSeriesNodeEvent; + this.connectorNodeGroup = this.contentGroup.appendChild( + new Group10({ + name: `${this.id}-series-connectorNodes`, + zIndex: SeriesZIndexMap2.BACKGROUND + }) + ); + this.connectorSelection = Selection6.select( + this.connectorNodeGroup, + () => this.connectionFactory() + ); + this.connectorNodeGroup.pointerEvents = PointerEvents4.None; + } + get pickModeAxis() { + return "main-category"; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.connectorNodeGroup.zIndex = [SeriesZIndexMap2.BACKGROUND, zIndex]; + return true; + } + isVertical() { + return !super.isVertical(); + } + connectionFactory() { + return new FunnelConnector(); + } + async processData(dataController) { + const { stageKey, valueKey } = this.properties; + const { visible, id: seriesId } = this; + const validation = (_value, _datum, index) => visible && this.ctx.legendManager.getItemEnabled({ seriesId, itemId: index }); + const xScale = this.getCategoryAxis()?.scale; + const yScale = this.getValueAxis()?.scale; + const { isContinuousX, xScaleType, yScaleType } = this.getScaleInformation({ xScale, yScale }); + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + if (this.processedData) { + extraProps.push(diff5(this.id, this.processedData)); + } + extraProps.push(animationValidation6()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const { processedData } = await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty8(stageKey, xScaleType, { id: "xValue" }), + valueProperty11(valueKey, yScaleType, { id: `yValue`, ...visibleProps, validation, invalidValue: 0 }), + ...isContinuousX ? [SMALLEST_KEY_INTERVAL4, LARGEST_KEY_INTERVAL22] : [], + ...extraProps + ], + groupByKeys: false + }); + this.smallestDataInterval = processedData.reduced?.smallestKeyInterval; + this.largestDataInterval = processedData.reduced?.largestKeyInterval; + this.animationState.transition("updateData"); + } + getSeriesDomain(direction) { + const { + processedData, + dataModel, + id: seriesId, + ctx: { legendManager } + } = this; + if (!processedData || !dataModel) + return []; + const { + keys: [keys] + } = processedData.domain; + if (direction === this.getCategoryDirection()) { + const keyDef = dataModel.resolveProcessedDataDefById(this, `xValue`); + if (keyDef?.def.type === "key" && keyDef?.def.valueType === "category") { + if (!this.hasData) + return []; + return keys.filter((_key, index) => legendManager.getItemEnabled({ seriesId, itemId: index })); + } + return this.padBandExtent(keys); + } else { + const yExtent = this.domainForClippedRange(direction, ["yValue"], "xValue"); + const maxExtent = Math.max(...yExtent); + const fixedYExtent = [-maxExtent, maxExtent]; + return fixNumericExtent7(fixedYExtent); + } + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + createNodeData() { + const { + hasData, + data, + dataModel, + groupScale, + processedData, + id: seriesId, + ctx: { legendManager } + } = this; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!(hasData && data && xAxis && yAxis && dataModel && processedData?.type === "ungrouped")) { + return; + } + const xScale = xAxis.scale; + const yScale = yAxis.scale; + const barAlongX = this.getBarDirection() === ChartAxisDirection25.X; + const { stageKey, valueKey } = this.properties; + const itemId = `${valueKey}`; + const context = { + itemId, + nodeData: [], + labelData: [], + connectorData: [], + scales: this.calculateScaling(), + groupScale: this.getScaling(this.groupScale), + visible: this.visible + }; + const isVisible = this.visible; + if (!isVisible) + return context; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const { barWidth, groupIndex } = this.updateGroupScale(xAxis); + const barOffset = ContinuousScale7.is(xScale) ? barWidth * -0.5 : 0; + const crisp = checkCrisp3( + xAxis?.scale, + xAxis?.visibleRange, + this.smallestDataInterval, + this.largestDataInterval + ); + let previousConnection; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const visible = isVisible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + const xDatum = xValues[datumIndex]; + if (xDatum == null) + continue; + const x = Math.round(xScale.convert(xDatum)) + groupScale.convert(String(groupIndex)) + barOffset; + const yDatum = yValues[datumIndex]; + const yNegative = Math.round(yScale.convert(-yDatum)); + const yPositive = Math.round(yScale.convert(yDatum)); + const style2 = this.getItemStyle({ datum, datumIndex }, false); + const barHeight = Math.max(style2.strokeWidth ?? 0, Math.abs(yPositive - yNegative)); + const rect2 = { + x: barAlongX ? Math.min(yPositive, yNegative) : x, + y: barAlongX ? x : Math.min(yPositive, yNegative), + width: barAlongX ? barHeight : barWidth, + height: barAlongX ? barWidth : barHeight + }; + const nodeMidPoint = { + x: rect2.x + rect2.width / 2, + y: rect2.y + rect2.height / 2 + }; + const labelData = this.createLabelData({ + datumIndex, + rect: rect2, + barAlongX, + yDatum, + datum, + visible + }); + const nodeDatum = { + index: datumIndex, + series: this, + itemId, + datum, + datumIndex, + xValue: xDatum, + yValue: yDatum, + xKey: stageKey, + yKey: valueKey, + x: rect2.x, + y: rect2.y, + width: rect2.width, + height: rect2.height, + midPoint: nodeMidPoint, + crisp, + label: labelData, + visible + }; + context.nodeData.push(nodeDatum); + if (labelData != null) { + context.labelData.push(labelData); + } + if (previousConnection != null) { + const prevRect = previousConnection.rect; + const startNodeDatum = previousConnection.nodeDatum; + const startDatumIndex = previousConnection.datumIndex; + if (barAlongX) { + context.connectorData.push({ + datum: startNodeDatum, + datumIndex: startDatumIndex, + x0: prevRect.x, + y0: prevRect.y + prevRect.height, + x1: prevRect.x + prevRect.width, + y1: prevRect.y + prevRect.height, + x2: rect2.x + rect2.width, + y2: rect2.y, + x3: rect2.x, + y3: rect2.y, + opacity: 1 + }); + } else { + context.connectorData.push({ + datum: startNodeDatum, + datumIndex: startDatumIndex, + x0: prevRect.x + prevRect.width, + y0: prevRect.y, + x1: rect2.x, + y1: rect2.y, + x2: rect2.x, + y2: rect2.y + rect2.height, + x3: prevRect.x + prevRect.width, + y3: prevRect.y + prevRect.height, + opacity: 1 + }); + } + } + if (visible) { + previousConnection = { + itemId, + rect: rect2, + nodeDatum, + datumIndex + }; + } + } + return context; + } + updateNodes(seriesHighlighted, nodeRefresh) { + super.updateNodes(seriesHighlighted, nodeRefresh); + const { connectorSelection } = this; + const connectorData = this.contextNodeData?.connectorData ?? []; + this.connectorSelection = this.updateConnectorSelection({ connectorSelection, connectorData }); + this.updateConnectorNodes({ connectorSelection }); + } + updateDatumSelection(opts) { + const { nodeData, datumSelection } = opts; + const data = nodeData ?? []; + return datumSelection.update(data, void 0, (datum) => this.getDatumId(datum)); + } + updateConnectorSelection(opts) { + const { connectorData, connectorSelection } = opts; + return connectorSelection.update( + this.connectorEnabled() ? connectorData : [], + void 0, + (connector) => this.getDatumId(connector.datum) + ); + } + updateConnectorNodes(opts) { + const fillBBox = this.getShapeFillBBox(); + opts.connectorSelection.each((connector, datum) => { + const { fill, fillOpacity, stroke: stroke22, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.connectorStyle(datum.datumIndex); + connector.setProperties(resetConnectorSelectionsFn(connector, datum)); + applyShapeStyle8( + connector, + { + fill, + stroke: stroke22, + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }, + fillBBox + ); + }); + } + updateLabelSelection(opts) { + const labelData = this.properties.label.enabled ? opts.labelData : []; + return opts.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = PointerEvents4.None; + }); + } + updateLabelNodes(opts) { + const params = { + stageKey: this.properties.stageKey, + valueKey: this.properties.valueKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((textNode, datum) => { + textNode.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + updateLabelNode5(this, textNode, params, this.properties.label, datum, false, activeHighlight); + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { stageKey, valueKey, tooltip, legendItemName } = properties; + const xAxis = this.getCategoryAxis(); + const yAxis = this.getValueAxis(); + if (!dataModel || !processedData || !xAxis || !yAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveKeysById(this, "xValue", processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(datumIndex), + data: [ + { + label: this.getAxisValueText(xAxis, "tooltip", xValue2, datum, stageKey, legendItemName), + value: this.getAxisValueText(yAxis, "tooltip", yValue, datum, valueKey, legendItemName) + } + ] + }, + { seriesId, datum, title: stageKey, stageKey, valueKey, ...this.tooltipStyle(datum, datumIndex) } + ); + } + resetAllAnimation(data) { + super.resetAllAnimation(data); + resetMotion22([this.connectorSelection], resetConnectorSelectionsFn); + } + animateEmptyUpdateReady({ labelSelection }) { + const { connectorSelection } = this; + const isVertical = this.isVertical(); + const mode = "normal"; + const connectorFns = prepareConnectorAnimationFunctions(isVertical, mode); + motion4.fromToMotion(this.id, "connectors", this.ctx.animationManager, [connectorSelection], connectorFns); + seriesLabelFadeInAnimation4(this, "labels", this.ctx.animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + const { labelSelection: labelSelections } = data; + this.ctx.animationManager.stopByAnimationGroupId(this.id); + seriesLabelFadeInAnimation4(this, "labels", this.ctx.animationManager, labelSelections); + } + getDatumId(datum) { + return createDatumId7(datum.xValue); + } + isLabelEnabled() { + return this.properties.label.enabled; + } + computeFocusBounds({ datumIndex }) { + return computeBarFocusBounds6(this, this.contextNodeData?.nodeData[datumIndex]); + } + legendItemSymbol(datumIndex) { + const { strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset, fill, stroke: stroke22 } = this.properties.getStyle(datumIndex); + return { + marker: { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + id: seriesId, + processedData, + dataModel, + ctx: { legendManager }, + visible + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { showInLegend } = this.properties; + const xValues = dataModel.resolveKeysById(this, "xValue", processedData); + return (processedData.dataSources.get(this.id)?.data ?? []).map((datum, datumIndex) => { + const stageValue = xValues[datumIndex]; + if (stageValue == null) + return; + return { + legendType: "category", + id: seriesId, + datum, + itemId: datumIndex, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { text: String(stageValue) }, + symbol: this.legendItemSymbol(datumIndex), + skipAnimations: true, + hideInLegend: !showInLegend + }; + }).filter((datum) => datum != null); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +var { Label: Label7, AbstractBarSeriesProperties: AbstractBarSeriesProperties5, makeSeriesTooltip: makeSeriesTooltip9, AxisLabel: AxisLabel3, Property: Property66 } = module_support_exports; +var ConeFunnelSeriesLabel = class extends Label7 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass2([ + Property66 +], ConeFunnelSeriesLabel.prototype, "placement", 2); +__decorateClass2([ + Property66 +], ConeFunnelSeriesLabel.prototype, "spacing", 2); +var ConeFunnelSeriesStageLabel = class extends AxisLabel3 { +}; +__decorateClass2([ + Property66 +], ConeFunnelSeriesStageLabel.prototype, "placement", 2); +var ConeFunnelProperties = class extends AbstractBarSeriesProperties5 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new ConeFunnelSeriesLabel(); + this.stageLabel = new ConeFunnelSeriesStageLabel(); + this.tooltip = makeSeriesTooltip9(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index], + fillOpacity, + stroke: strokes[index], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "stageKey", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "valueKey", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "fills", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "strokes", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "label", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "stageLabel", 2); +__decorateClass2([ + Property66 +], ConeFunnelProperties.prototype, "tooltip", 2); +function resetLineSelectionsFn(_node, { x, y, width: width2, height: height2, opacity }) { + return { x1: x, y1: y, x2: x + width2, y2: y + height2, opacity: opacity ?? 1 }; +} +var { Line: Line5, ChartAxisDirection: ChartAxisDirection26 } = module_support_exports; +var ConeFunnelSeries = class extends BaseFunnelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + animationResetFns: { + datum: resetLineSelectionsFn + } + }); + this.properties = new ConeFunnelProperties(); + } + get hasData() { + const { + id: seriesId, + ctx: { legendManager } + } = this; + const visibleItems = this.data?.data.reduce( + (accum, _, datumIndex) => accum + (legendManager.getItemEnabled({ seriesId, itemId: datumIndex }) ? 1 : 0), + 0 + ); + return visibleItems != null && visibleItems > 1; + } + getBandScalePadding() { + return { inner: 1, outer: 0 }; + } + connectorEnabled() { + return true; + } + getItemStyle({ datumIndex }, _isHighlight) { + return this.properties.getStyle(datumIndex); + } + connectorStyle(index) { + return this.properties.getStyle(index); + } + nodeFactory() { + return new Line5(); + } + createLabelData({ + datumIndex, + rect: rect2, + barAlongX, + yDatum, + datum, + visible + }) { + const { stageKey, valueKey, label } = this.properties; + const { spacing, placement } = label; + if (!label.enabled) + return; + let x; + let y; + let textAlign; + let textBaseline; + if (barAlongX) { + x = rect2.x + rect2.width / 2; + textAlign = "center"; + switch (placement) { + case "before": + y = rect2.y - spacing; + textBaseline = "bottom"; + break; + case "after": + y = rect2.y + rect2.height + spacing; + textBaseline = "top"; + break; + default: + y = rect2.y + rect2.height / 2; + textBaseline = "middle"; + } + } else { + y = rect2.y + rect2.height / 2; + textBaseline = "middle"; + switch (placement) { + case "before": + x = rect2.x - spacing; + textAlign = "right"; + break; + case "after": + x = rect2.x + rect2.width + spacing; + textAlign = "left"; + break; + default: + x = rect2.x + rect2.width / 2; + textAlign = "center"; + } + } + const yDomain = this.getSeriesDomain(ChartAxisDirection26.Y); + const text2 = this.getLabelText( + yDatum, + datum, + valueKey, + "y", + yDomain, + label, + { itemId: valueKey, value: yDatum, datum, stageKey, valueKey } + ); + return { + x, + y, + textAlign, + textBaseline, + text: text2, + itemId: valueKey, + datum, + datumIndex, + series: this, + visible + }; + } + updateDatumNodes(opts) { + const highlightStyle = this.getHighlightStyle(opts.isHighlight); + opts.datumSelection.each((line, datum) => { + line.setProperties(resetLineSelectionsFn(line, datum)); + line.stroke = highlightStyle?.stroke; + line.strokeWidth = highlightStyle?.strokeWidth ?? 0; + line.strokeOpacity = highlightStyle?.strokeOpacity ?? 1; + line.lineDash = highlightStyle?.lineDash; + line.lineDashOffset = highlightStyle?.lineDashOffset ?? 0; + line.opacity = highlightStyle?.opacity ?? 1; + }); + } + tooltipStyle(_datum, datumIndex) { + const { fill, stroke: stroke22, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties.getStyle(datumIndex); + return { + fill, + fillOpacity, + stroke: stroke22, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +ConeFunnelSeries.className = "ConeFunnelSeries"; +ConeFunnelSeries.type = "cone-funnel"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs9, coneFunnelSeriesThemeableOptionsDef: coneFunnelSeriesThemeableOptionsDef2, without: without3 } = module_support_exports; +var coneFunnelSeriesOptionsDef = { + ...without3(commonSeriesOptionsDefs9, ["showInLegend"]), + ...coneFunnelSeriesThemeableOptionsDef2, + type: required(constant("cone-funnel")), + stageKey: required(string), + valueKey: required(string) +}; +var { + ThemeConstants: { CARTESIAN_AXIS_TYPE: CARTESIAN_AXIS_TYPE8 } +} = module_support_exports; +var CONE_FUNNEL_SERIES_THEME = { + series: { + direction: "vertical", + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "secondSequentialColors" }, + module_support_exports.SAFE_RANGE2_OPERATION + ] + }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", module_support_exports.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_SINGLE_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $palette: "secondSequentialColors" }, + module_support_exports.SAFE_RANGE2_OPERATION + ] + } + ] + }, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + placement: "before", + spacing: 4 + }, + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + }, + highlight: module_support_exports.singleSeriesHighlightStyle(false) + }, + seriesArea: { + padding: { + top: 20, + bottom: 20 + } + }, + axes: { + [CARTESIAN_AXIS_TYPE8.NUMBER]: { + nice: false, + gridLine: { + enabled: false + }, + crosshair: { + enabled: false + }, + label: { + enabled: false + } + }, + [CARTESIAN_AXIS_TYPE8.CATEGORY]: { + line: { + enabled: false + } + } + } +}; +var ConeFunnelModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "cone-funnel", + moduleFactory: (ctx) => new ConeFunnelSeries(ctx), + solo: true, + defaultAxes: FUNNEL_SERIES_AXES, + themeTemplate: CONE_FUNNEL_SERIES_THEME +}; +var ConeFunnelSeriesModule = { + type: "series", + name: "cone-funnel", + chartType: "cartesian", + enterprise: true, + options: coneFunnelSeriesOptionsDef, + create: (ctx) => new ConeFunnelSeries(ctx) +}; +var { Label: Label8, DropShadow: DropShadow4, AbstractBarSeriesProperties: AbstractBarSeriesProperties6, BaseProperties: BaseProperties25, makeSeriesTooltip: makeSeriesTooltip10, AxisLabel: AxisLabel4, Property: Property67 } = module_support_exports; +var FunnelSeriesLabel = class extends Label8 { +}; +var FunnelSeriesStageLabel = class extends AxisLabel4 { +}; +__decorateClass2([ + Property67 +], FunnelSeriesStageLabel.prototype, "placement", 2); +var FunnelDropOff = class extends BaseProperties25 { + constructor() { + super(...arguments); + this.enabled = true; + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle() { + const { fill, stroke: stroke22, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property67 +], FunnelDropOff.prototype, "enabled", 2); +__decorateClass2([ + Property67 +], FunnelDropOff.prototype, "fill", 2); +__decorateClass2([ + Property67 +], FunnelDropOff.prototype, "fillOpacity", 2); +__decorateClass2([ + Property67 +], FunnelDropOff.prototype, "stroke", 2); +__decorateClass2([ + Property67 +], FunnelDropOff.prototype, "strokeWidth", 2); +__decorateClass2([ + Property67 +], FunnelDropOff.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property67 +], FunnelDropOff.prototype, "lineDash", 2); +__decorateClass2([ + Property67 +], FunnelDropOff.prototype, "lineDashOffset", 2); +var FunnelProperties = class extends AbstractBarSeriesProperties6 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.spacingRatio = 0; + this.dropOff = new FunnelDropOff(); + this.shadow = new DropShadow4().set({ enabled: false }); + this.label = new FunnelSeriesLabel(); + this.stageLabel = new FunnelSeriesStageLabel(); + this.tooltip = makeSeriesTooltip10(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index], + fillOpacity, + stroke: strokes[index], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "stageKey", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "valueKey", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "fills", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "strokes", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "spacingRatio", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "dropOff", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "shadow", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "label", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "stageLabel", 2); +__decorateClass2([ + Property67 +], FunnelProperties.prototype, "tooltip", 2); +var { + ChartAxisDirection: ChartAxisDirection27, + resetBarSelectionsFn: resetBarSelectionsFn3, + prepareBarAnimationFunctions: prepareBarAnimationFunctions3, + midpointStartingBarPosition: midpointStartingBarPosition22, + createDatumId: createDatumId8, + Rect: Rect6, + motion: motion5, + applyShapeStyle: applyShapeStyle9, + mergeDefaults: mergeDefaults11 +} = module_support_exports; +var FunnelSeries = class extends BaseFunnelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + animationResetFns: { + datum: resetBarSelectionsFn3 + } + }); + this.properties = new FunnelProperties(); + } + getBandScalePadding() { + return { inner: this.properties.spacingRatio, outer: 0 }; + } + connectorEnabled() { + return this.properties.dropOff.enabled; + } + connectorStyle(index) { + return mergeDefaults11(this.properties.dropOff.getStyle(), this.properties.getStyle(index)); + } + nodeFactory() { + return new Rect6(); + } + createLabelData({ + datumIndex, + rect: rect2, + yDatum, + datum, + visible + }) { + const { valueKey, stageKey, label } = this.properties; + if (!label.enabled) + return; + const yDomain = this.getSeriesDomain(ChartAxisDirection27.Y); + const text2 = this.getLabelText( + yDatum, + datum, + valueKey, + "y", + yDomain, + label, + { itemId: valueKey, value: yDatum, datum, stageKey, valueKey } + ); + return { + x: rect2.x + rect2.width / 2, + y: rect2.y + rect2.height / 2, + textAlign: "center", + textBaseline: "middle", + text: text2, + itemId: stageKey, + datum, + datumIndex, + series: this, + visible + }; + } + getItemStyle({ datum, datumIndex }, isHighlight) { + const { id: seriesId, properties } = this; + const { stageKey, valueKey, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults11(highlightStyle, properties.getStyle(datumIndex)); + let style2 = baseStyle; + if (itemStyler != null) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const overrides = this.cachedDatumCallback( + createDatumId8(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const highlightStateString = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState: highlightStateString, + stageKey, + valueKey, + ...style2 + }); + } + ); + if (overrides) { + style2 = mergeDefaults11(overrides, style2); + } + } + return style2; + } + updateDatumNodes({ + datumSelection, + isHighlight + }) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const { shadow } = this.properties; + const categoryAlongX = this.getCategoryDirection() === ChartAxisDirection27.X; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect2, datum) => { + const style2 = this.getItemStyle(datum, isHighlight); + applyShapeStyle9(rect2, style2, fillBBox); + rect2.visible = categoryAlongX ? datum.width > 0 : datum.height > 0; + rect2.crisp = datum.crisp; + rect2.fillShadow = shadow; + }); + } + tooltipStyle(datum, datumIndex) { + return this.getItemStyle({ datum, datumIndex }, false); + } + animateEmptyUpdateReady(params) { + super.animateEmptyUpdateReady(params); + const { datumSelection } = params; + const isVertical = this.isVertical(); + const mode = "normal"; + const barFns = prepareBarAnimationFunctions3(midpointStartingBarPosition22(isVertical, mode), "unknown"); + motion5.fromToMotion(this.id, "datums", this.ctx.animationManager, [datumSelection], barFns); + } + animateWaitingUpdateReady(data) { + super.animateWaitingUpdateReady(data); + const { datumSelection: datumSelections } = data; + const { processedData } = this; + const dataDiff = processedData?.reduced?.diff?.[this.id]; + const fns = prepareBarAnimationFunctions3(midpointStartingBarPosition22(this.isVertical(), "fade"), "added"); + motion5.fromToMotion( + this.id, + "datums", + this.ctx.animationManager, + [datumSelections], + fns, + (_, datum) => datum.xValue, + dataDiff + ); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +FunnelSeries.className = "FunnelSeries"; +FunnelSeries.type = "funnel"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs10, funnelSeriesThemeableOptionsDef: funnelSeriesThemeableOptionsDef2, without: without4 } = module_support_exports; +var funnelSeriesOptionsDef = { + ...funnelSeriesThemeableOptionsDef2, + ...without4(commonSeriesOptionsDefs10, ["showInLegend"]), + type: required(constant("funnel")), + stageKey: required(string), + valueKey: required(string) +}; +var FunnelModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["cartesian"], + identifier: "funnel", + moduleFactory: (ctx) => new FunnelSeries(ctx), + solo: true, + defaultAxes: FUNNEL_SERIES_AXES, + themeTemplate: FUNNEL_SERIES_THEME +}; +var FunnelSeriesModule = { + type: "series", + name: "funnel", + chartType: "cartesian", + enterprise: true, + options: funnelSeriesOptionsDef, + create: (ctx) => new FunnelSeries(ctx) +}; +var DatumUnion = class { + *[Symbol.iterator]() { + const { node, datum } = this; + if (node && datum) + yield { node, datum }; + } + nodes() { + return this.node ? [this.node] : []; + } + update(datumSelection, group, ctor, nodeUpdater) { + const nodes = datumSelection.nodes(); + if (nodes.length === 0) { + this.node?.remove(); + this.node = void 0; + } else { + if (this.node === void 0) { + this.node = new ctor(); + this.node.fillOpacity = 0; + this.node.strokeOpacity = 0; + group.appendChild(this.node); + } + const first2 = nodes[0]; + const last = nodes.toReversed().find((n) => n.datum.datum.value > n.datum.datum.segmentStart) ?? nodes.at(-1); + this.node.datum = this.datum = first2.datum; + nodeUpdater(this.node, first2, last); + } + } +}; +var fadeInFns = { + fromFn: () => ({ opacity: 0, phase: "initial" }), + toFn: () => ({ opacity: 1 }) +}; +function formatLabel(value, scale2) { + if (value == null) + return ""; + const { min, max } = scale2; + const minLog10 = min === 0 ? 0 : Math.ceil(Math.log10(Math.abs(min))); + const maxLog10 = max === 0 ? 0 : Math.ceil(Math.log10(Math.abs(max))); + const dp = Math.max(2 - Math.max(minLog10, maxLog10), 0); + return value.toFixed(dp); +} +function getLabelText(seriesId, ctx, datum, valueOverride) { + if (datum.text != null) + return datum.text; + const value = valueOverride ?? datum.value; + let labelFormat; + if (datum?.formatter != null) { + labelFormat = formatWithContext(ctx, datum.formatter, { seriesId, datum: void 0, value }); + } + return labelFormat == null || isArray(labelFormat) ? labelFormat : String(labelFormat); +} +function lineMarker({ path, x, y, size }) { + path.moveTo(x, y - size / 2); + path.lineTo(x, y + size / 2); +} +function pickGaugeNearestDatum(self, point) { + const it = iterate(self.datumUnion.nodes(), self.targetSelection.nodes()); + return self.pickNodeNearestDistantObject(point, it); +} +function pickGaugeFocus(self, opts) { + const others = [ + { data: self.contextNodeData?.nodeData, selection: self.datumUnion }, + { data: self.contextNodeData?.targetData, selection: self.targetSelection } + ].filter((v) => v.data && v.data.length > 0); + const otherIndex = clamp(0, opts.otherIndex + opts.otherIndexDelta, others.length - 1); + if (others.length === 0) + return; + const { data, selection } = others[otherIndex]; + if (data == null || data.length === 0) + return; + const datumIndex = clamp(0, opts.datumIndex, data.length - 1); + const datum = data[datumIndex]; + for (const node of selection) { + if (node.datum === datum) { + const bounds = node.node; + return { bounds, clipFocusBox: true, datum, datumIndex, otherIndex }; + } + } +} +var { BaseProperties: BaseProperties26, Property: Property68 } = module_support_exports; +var GaugeSegmentationIntervalProperties = class extends BaseProperties26 { + getSegments(scale2, maxTicks) { + const { values, step, count } = this; + const d0 = Math.min(...scale2.domain); + const d1 = Math.max(...scale2.domain); + let ticks; + if (values != null) { + const segments = values.filter((v) => v > d0 && v < d1).sort((a, b) => a - b); + ticks = [d0, ...segments, d1]; + } else if (step != null) { + const segments = []; + for (let i = d0; i < d1; i += step) { + segments.push(i); + } + segments.push(d1); + ticks = segments; + } else if (count == null) { + const segments = scale2.ticks({ + nice: true, + interval: void 0, + tickCount: void 0, + minTickCount: 0, + maxTickCount: Infinity + })?.ticks?.filter((v) => v > d0 && v < d1); + ticks = segments == null ? void 0 : [d0, ...segments, d1]; + } else { + const segments = count + 1; + ticks = Array.from({ length: segments + 1 }, (_, i) => i / segments * (d1 - d0) + d0); + } + if (ticks != null && ticks.length > maxTicks) { + logger_exports.warnOnce( + `the configured segmentation results in more than 1 item per pixel, ignoring. Supply a segmentation configuration that results in larger segments or omit this configuration` + ); + ticks = void 0; + } + ticks ?? (ticks = [d0, d1]); + return ticks; + } +}; +__decorateClass2([ + Property68 +], GaugeSegmentationIntervalProperties.prototype, "values", 2); +__decorateClass2([ + Property68 +], GaugeSegmentationIntervalProperties.prototype, "step", 2); +__decorateClass2([ + Property68 +], GaugeSegmentationIntervalProperties.prototype, "count", 2); +var GaugeSegmentationProperties = class extends BaseProperties26 { + constructor() { + super(...arguments); + this.enabled = false; + this.interval = new GaugeSegmentationIntervalProperties(); + this.spacing = 0; + } +}; +__decorateClass2([ + Property68 +], GaugeSegmentationProperties.prototype, "enabled", 2); +__decorateClass2([ + Property68 +], GaugeSegmentationProperties.prototype, "interval", 2); +__decorateClass2([ + Property68 +], GaugeSegmentationProperties.prototype, "spacing", 2); +var { + BaseProperties: BaseProperties27, + makeSeriesTooltip: makeSeriesTooltip11, + SeriesProperties: SeriesProperties22, + PropertiesArray: PropertiesArray7, + Property: Property69, + Label: Label9, + AxisLabel: AxisLabel5, + getColorStops: getColorStops2 +} = module_support_exports; +var LinearGaugeDefaultTargetLabelProperties = class extends Label9 { +}; +__decorateClass2([ + Property69 +], LinearGaugeDefaultTargetLabelProperties.prototype, "spacing", 2); +var LinearGaugeTargetProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.value = 0; + this.label = new LinearGaugeDefaultTargetLabelProperties(); + } + getStyle(defaultTarget) { + const { + fill = defaultTarget.fill ?? "black", + fillOpacity = defaultTarget.fillOpacity ?? 1, + stroke: stroke22 = defaultTarget.stroke ?? "black", + strokeWidth = defaultTarget.strokeWidth ?? 0, + strokeOpacity = defaultTarget.strokeOpacity ?? 1, + lineDash = defaultTarget.lineDash ?? [0], + lineDashOffset = defaultTarget.lineDashOffset ?? 0 + } = this; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "text", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "value", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "shape", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "placement", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "spacing", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "size", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "rotation", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "fill", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "stroke", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property69 +], LinearGaugeTargetProperties.prototype, "label", 2); +var LinearGaugeBarProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.enabled = true; + this.thicknessRatio = 1; + this.fills = new PropertiesArray7(module_support_exports.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(defaultColorRange, horizontal, scale2) { + const { fill, fills, fillMode, fillOpacity, stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + const barFill = fill ?? createLinearGradient(fills, fillMode, defaultColorRange, scale2, horizontal); + return { + fill: barFill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "enabled", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "thickness", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "thicknessRatio", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "fills", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "fillMode", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "fill", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "stroke", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property69 +], LinearGaugeBarProperties.prototype, "lineDashOffset", 2); +var LinearGaugeScaleIntervalProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.values = void 0; + this.step = void 0; + this.minSpacing = 0; + this.maxSpacing = 1e3; + } +}; +__decorateClass2([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "values", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "step", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "minSpacing", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleIntervalProperties.prototype, "maxSpacing", 2); +var LinearGaugeScaleLabelProperties = class extends AxisLabel5 { + constructor() { + super(...arguments); + this.placement = void 0; + } +}; +__decorateClass2([ + Property69 +], LinearGaugeScaleLabelProperties.prototype, "placement", 2); +var LinearGaugeScaleProperties = class extends BaseProperties27 { + constructor() { + super(...arguments); + this.min = 0; + this.max = 1; + this.fills = new PropertiesArray7(module_support_exports.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.defaultFill = "black"; + this.interval = new LinearGaugeScaleIntervalProperties(); + this.label = new LinearGaugeScaleLabelProperties(); + } + getStyle(barEnabled, defaultColorRange, horizontal, scale2) { + const { + fill, + fills, + defaultFill, + fillMode, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const scaleFill = fill ?? (barEnabled && fills.length === 0 ? defaultFill : void 0) ?? createLinearGradient(fills, fillMode, defaultColorRange, scale2, horizontal); + return { + fill: scaleFill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "min", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "max", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "fills", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "fillMode", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "fill", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "stroke", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "defaultFill", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "interval", 2); +__decorateClass2([ + Property69 +], LinearGaugeScaleProperties.prototype, "label", 2); +var LinearGaugeLabelProperties = class extends AutoSizedLabel { + constructor() { + super(...arguments); + this.placement = "inside-center"; + this.avoidCollisions = true; + } +}; +__decorateClass2([ + Property69 +], LinearGaugeLabelProperties.prototype, "text", 2); +__decorateClass2([ + Property69 +], LinearGaugeLabelProperties.prototype, "placement", 2); +__decorateClass2([ + Property69 +], LinearGaugeLabelProperties.prototype, "avoidCollisions", 2); +var LinearGaugeSeriesProperties = class extends SeriesProperties22 { + constructor() { + super(...arguments); + this.value = 0; + this.segmentation = new GaugeSegmentationProperties(); + this.defaultColorRange = []; + this.targets = new PropertiesArray7(LinearGaugeTargetProperties); + this.defaultTarget = new LinearGaugeTargetProperties(); + this.defaultScale = new LinearGaugeScaleProperties(); + this.direction = "vertical"; + this.thickness = 1; + this.cornerRadius = 0; + this.cornerMode = "container"; + this.margin = 0; + this.scale = new LinearGaugeScaleProperties(); + this.bar = new LinearGaugeBarProperties(); + this.label = new LinearGaugeLabelProperties(); + this.tooltip = makeSeriesTooltip11(); + } +}; +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "value", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "segmentation", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "targets", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "defaultTarget", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "defaultScale", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "direction", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "thickness", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "cornerMode", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "margin", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "scale", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "bar", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property69 +], LinearGaugeSeriesProperties.prototype, "tooltip", 2); +function createLinearGradient(fills, fillMode, defaultColorRange, scale2, horizontal) { + const colorStops = getColorStops2(fills, defaultColorRange, scale2.domain, fillMode); + return { + type: "gradient", + gradient: "linear", + colorSpace: "oklch", + colorStops, + rotation: horizontal ? 90 : 0, + bounds: "series" + }; +} +var { BBox: BBox18 } = module_support_exports; +function datumRect(datum) { + const { x0, y0, x1, y1, horizontalInset, verticalInset } = datum; + const x = Math.min(x0, x1) + horizontalInset; + const y = Math.min(y0, y1) + verticalInset; + const width2 = Math.max(Math.abs(x1 - x0) - 2 * horizontalInset, 0); + const height2 = Math.max(Math.abs(y1 - y0) - 2 * verticalInset, 0); + return { x, y, width: width2, height: height2 }; +} +function clipBBoxVisibility(datum, clipBBox) { + if (clipBBox == null) + return true; + const rect2 = datumRect(datum); + const delta32 = 1e-6; + const x0 = rect2.x + delta32; + const y0 = rect2.y + delta32; + const x1 = rect2.x + rect2.width - delta32; + const y1 = rect2.y + rect2.height - delta32; + const clipX0 = clipBBox.x; + const clipX1 = clipBBox.x + clipBBox.width; + const clipY0 = clipBBox.y; + const clipY1 = clipBBox.y + clipBBox.height; + return Math.max(x0, clipX0) <= Math.min(x1, clipX1) && Math.max(y0, clipY0) <= Math.min(y1, clipY1); +} +function hasClipBBox(datum) { + const { clipX0, clipX1, clipY0, clipY1 } = datum; + return clipX0 != null && clipX1 != null || clipY0 != null && clipY1 != null; +} +function computeClipBBox(datum) { + if (!hasClipBBox(datum)) + return; + const { x0, y0, x1, y1 } = datum; + const { x, y, width: width2, height: height2 } = datumRect(datum); + let { clipX0, clipX1, clipY0, clipY1 } = datum; + if (clipX0 == null || clipX1 == null) { + clipX0 = x0; + clipX1 = x1; + } + if (clipY0 == null || clipY1 == null) { + clipY0 = y0; + clipY1 = y1; + } + const clipX = Math.min(clipX0, clipX1); + const clipY = Math.min(clipY0, clipY1); + const clipWidth = Math.abs(clipX1 - clipX0); + const clipHeight = Math.abs(clipY1 - clipY0); + clipX0 = Math.max(x, clipX); + clipY0 = Math.max(y, clipY); + clipX1 = Math.min(x + width2, clipX + clipWidth); + clipY1 = Math.min(y + height2, clipY + clipHeight); + return new BBox18( + Math.min(clipX0, clipX1), + Math.min(clipY0, clipY1), + Math.abs(clipX1 - clipX0), + Math.abs(clipY1 - clipY0) + ); +} +function prepareLinearGaugeSeriesAnimationFunctions(initialLoad, horizontal) { + const phase = initialLoad ? "initial" : "update"; + const node = { + fromFn(sect, datum) { + const previousDatum = sect.previousDatum; + let { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1 } = previousDatum ?? datum; + const { horizontalInset, verticalInset } = datum; + const previousHadClipBBox = previousDatum != null && hasClipBBox(previousDatum); + const nextHasClipBBox = hasClipBBox(datum); + if (previousHadClipBBox && nextHasClipBBox) { + } else if (!previousHadClipBBox && nextHasClipBBox) { + ({ x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1 } = datum); + if (initialLoad) { + if (horizontal) { + clipX1 = datum.clipX0; + } else { + clipY1 = datum.clipY0; + } + } + } else if (previousHadClipBBox && !nextHasClipBBox) { + ({ x0, y0, x1, y1 } = datum); + clipX0 = void 0; + clipY0 = void 0; + clipX1 = void 0; + clipY1 = void 0; + } else if (initialLoad) { + if (horizontal) { + x1 = x0; + } else { + y1 = y0; + } + } + return { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset, phase }; + }, + toFn(_sect, datum) { + const { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset } = datum; + return { x0, y0, x1, y1, clipX0, clipY0, clipX1, clipY1, horizontalInset, verticalInset }; + }, + applyFn(rect2, params) { + rect2.setProperties(resetLinearGaugeSeriesResetRectFunction(rect2, params)); + } + }; + return { node }; +} +function resetLinearGaugeSeriesResetRectFunction(_node, datum) { + const { x, y, width: width2, height: height2 } = datumRect(datum); + const clipBBox = computeClipBBox(datum); + const visible = clipBBoxVisibility(datum, clipBBox); + return { x, y, width: width2, height: height2, clipBBox, visible }; +} +var horizontalTextAligns = { + [ + "Before" + /* Before */ + ]: "right", + [ + "Center" + /* Center */ + ]: "center", + [ + "After" + /* After */ + ]: "left" +}; +var verticalTextBaselines = { + [ + "Before" + /* Before */ + ]: "top", + [ + "Center" + /* Center */ + ]: "middle", + [ + "After" + /* After */ + ]: "bottom" +}; +var horizontalAlignFactors = { + [ + "Before" + /* Before */ + ]: -1, + [ + "Center" + /* Center */ + ]: -0.5, + [ + "After" + /* After */ + ]: 0 +}; +var verticalAlignFactors2 = { + [ + "Before" + /* Before */ + ]: 0, + [ + "Center" + /* Center */ + ]: -0.5, + [ + "After" + /* After */ + ]: -1 +}; +function formatLinearGaugeLabels(series, ctx, selection, opts, bboxes, datumOverrides) { + const { seriesRect, gaugeRect, barRect } = bboxes; + const { padding: padding2, horizontal } = opts; + selection.each((label, labelDatum) => { + const labelText = getLabelText(series.id, ctx, labelDatum, datumOverrides?.label); + let boundingWidth; + let boundingHeight; + if (labelDatum.placement === "outside-start") { + if (horizontal) { + boundingWidth = gaugeRect.x; + boundingHeight = seriesRect.height; + } else { + boundingWidth = seriesRect.width; + boundingHeight = seriesRect.height - (gaugeRect.y + gaugeRect.height); + } + } else if (labelDatum.placement === "outside-end") { + if (horizontal) { + boundingWidth = seriesRect.width - (gaugeRect.x + gaugeRect.width); + boundingHeight = seriesRect.height; + } else { + boundingWidth = seriesRect.width; + boundingHeight = gaugeRect.y; + } + } else if (labelDatum.avoidCollisions) { + boundingWidth = gaugeRect.width; + boundingHeight = gaugeRect.height; + } + let layout; + if (labelText == null) { + return; + } else if (boundingWidth != null && boundingHeight != null) { + const sizeFittingHeight = () => ({ + width: boundingWidth, + height: boundingHeight, + meta: null + }); + const labelMeta = formatSingleLabel(toPlainText(labelText), labelDatum, { padding: padding2 }, sizeFittingHeight); + layout = labelMeta?.[0]; + } else { + const measurer22 = cachedTextMeasurer(labelDatum); + const { width: width2, height: height2 } = isArray(labelText) ? measureTextSegments(labelText, labelDatum) : measurer22.measureLines(labelText); + layout = { + text: labelText, + fontSize: labelDatum.fontSize, + lineHeight: labelDatum.lineHeight ?? measurer22.lineHeight(), + width: width2, + height: height2 + }; + } + if (layout == null) { + label.visible = false; + return; + } + const scale0 = horizontal ? gaugeRect.x : gaugeRect.y + gaugeRect.height; + const scale1 = horizontal ? gaugeRect.x + gaugeRect.width : gaugeRect.y; + const bar0 = horizontal ? barRect.x : barRect.y + barRect.height; + const bar1 = horizontal ? barRect.x + barRect.width : barRect.y; + const offset = labelDatum.spacing * (horizontal ? 1 : -1); + let bounds0; + let bounds1; + let s; + let align2; + switch (labelDatum.placement) { + case "outside-start": + bounds0 = -Infinity; + bounds1 = Infinity; + s = scale0 - offset; + align2 = "Before"; + break; + case "outside-end": + bounds0 = -Infinity; + bounds1 = Infinity; + s = scale1 + offset; + align2 = "After"; + break; + case "inside-start": + bounds0 = scale0; + bounds1 = bar1; + s = scale0 + offset; + align2 = "After"; + break; + case "inside-end": + bounds0 = bar1; + bounds1 = scale1; + s = scale1 - offset; + align2 = "Before"; + break; + case "inside-center": + bounds0 = scale0; + bounds1 = scale1; + s = (scale0 + scale1) / 2; + align2 = "Center"; + break; + case "bar-inside": + bounds0 = bar0; + bounds1 = bar1; + s = (bar0 + bar1) / 2; + align2 = "Center"; + break; + case "bar-inside-end": + bounds0 = bar0; + bounds1 = bar1; + s = bar1 - offset; + align2 = "Before"; + break; + case "bar-outside-end": + bounds0 = bar1; + bounds1 = scale1; + s = bar1 + offset; + align2 = "After"; + break; + case "bar-end": + bounds0 = -Infinity; + bounds1 = Infinity; + s = bar1; + align2 = "Center"; + break; + } + const x = horizontal ? s : gaugeRect.x + gaugeRect.width / 2; + const y = horizontal ? gaugeRect.y + gaugeRect.height / 2 : s; + let s0; + let s1; + if (horizontal) { + s0 = x + horizontalAlignFactors[align2] * layout.width; + s1 = s0 + layout.width; + } else { + s0 = y + verticalAlignFactors2[align2] * layout.height; + s1 = s0 + layout.height; + } + const inside = Math.min(s0, s1) >= Math.min(bounds0, bounds1) && Math.max(s0, s1) <= Math.max(bounds0, bounds1); + if (labelDatum.avoidCollisions && !inside) { + label.visible = false; + return; + } + label.visible = true; + label.text = layout.text; + label.fontSize = layout.fontSize; + label.lineHeight = layout.lineHeight; + label.textAlign = horizontal ? horizontalTextAligns[align2] : "center"; + label.textBaseline = horizontal ? "middle" : verticalTextBaselines[align2]; + label.x = x; + label.y = y; + }); +} +var { + fromToMotion: fromToMotion22, + resetMotion: resetMotion3, + SeriesNodePickMode: SeriesNodePickMode8, + StateMachine: StateMachine12, + createDatumId: createDatumId9, + toRadians: toRadians4, + BBox: BBox19, + Group: Group11, + PointerEvents: PointerEvents5, + Selection: Selection7, + Rect: Rect7, + Text: Text3, + TransformableText: TransformableText22, + Marker: Marker3, + LinearScale: LinearScale4, + generateTicks: generateTicks22, + NiceMode: NiceMode2, + easing, + findRangeExtent: findRangeExtent22, + tickFormat: tickFormat2, + mergeDefaults: mergeDefaults12, + applyShapeStyle: applyShapeStyle10 +} = module_support_exports; +var horizontalTargetPlacementRotation = { + before: 180, + middle: 0, + after: 0 +}; +var verticalTargetPlacementRotation = { + before: 90, + middle: 0, + after: -90 +}; +var LinearGaugeSeries = class extends module_support_exports.Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode8.EXACT_SHAPE_MATCH, SeriesNodePickMode8.NEAREST_NODE] + }); + this.properties = new LinearGaugeSeriesProperties(); + this.seriesRect = BBox19.NaN; + this.gaugeRect = BBox19.NaN; + this.scale = new LinearScale4(); + this.originX = 0; + this.originY = 0; + this.scaleGroup = this.contentGroup.appendChild(new Group11({ name: "scaleGroup" })); + this.itemGroup = this.contentGroup.appendChild(new Group11({ name: "itemGroup" })); + this.itemTargetGroup = this.contentGroup.appendChild(new Group11({ name: "itemTargetGroup" })); + this.itemTargetLabelGroup = this.contentGroup.appendChild(new Group11({ name: "itemTargetLabelGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group11({ name: "itemLabelGroup" })); + this.highlightTargetGroup = this.highlightGroup.appendChild( + new Group11({ name: "itemTargetLabelGroup" }) + ); + this.tickGroup = this.contentGroup.appendChild(new Group11({ name: "tickGroup" })); + this.scaleSelection = Selection7.select( + this.scaleGroup, + () => this.nodeFactory() + ); + this.datumSelection = Selection7.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.targetSelection = Selection7.select( + this.itemTargetGroup, + () => this.markerFactory() + ); + this.targetLabelSelection = Selection7.select(this.itemTargetLabelGroup, Text3); + this.labelSelection = Selection7.select( + this.itemLabelGroup, + Text3 + ); + this.highlightTargetSelection = Selection7.select(this.highlightTargetGroup, () => this.markerFactory()); + this.tickSelection = Selection7.select(this.tickGroup, TransformableText22); + this.datumUnion = new DatumUnion(); + this.animationState = new StateMachine12("empty", { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.animateReadyResize(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateWaitingUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty" + }, + reset: "empty", + skip: "ready" + } + }); + this.scaleGroup.pointerEvents = PointerEvents5.None; + this.tickGroup.pointerEvents = PointerEvents5.None; + } + get range() { + return this.horizontal ? [0, this.gaugeRect.width] : [0, this.gaugeRect.height]; + } + get horizontal() { + return this.properties.direction === "horizontal"; + } + get hasData() { + return true; + } + nodeFactory() { + const rect2 = new Rect7(); + rect2.crisp = true; + return rect2; + } + markerFactory() { + return new Marker3(); + } + processData() { + this.nodeDataRefresh = true; + this.animationState.transition("updateData"); + } + formatLabel(value) { + return formatLabel(value, this.properties.scale); + } + getShapeFillBBox() { + const { properties, originX, originY, horizontal, scale: scale2 } = this; + const { thickness } = properties; + const length2 = findRangeExtent22(scale2.range); + const bbox = new BBox19(originX, originY, horizontal ? length2 : thickness, horizontal ? thickness : length2); + return { + axis: bbox, + series: bbox + }; + } + getTargets() { + const { properties } = this; + const defaultTarget = properties.defaultTarget; + return Array.from(properties.targets).map((target) => { + const { + text: text2 = defaultTarget.text, + value = defaultTarget.value ?? 0, + shape = defaultTarget.shape ?? "triangle", + rotation = defaultTarget.rotation ?? 0, + placement = defaultTarget.placement ?? "middle", + spacing = defaultTarget.spacing ?? 0, + size = defaultTarget.size ?? 0 + } = target; + const { + enabled: labelEnabled = defaultTarget.label.enabled, + color: labelColor = defaultTarget.label.color ?? "black", + fontStyle: labelFontStyle = defaultTarget.label.fontStyle ?? "normal", + fontWeight: labelFontWeight = defaultTarget.label.fontWeight ?? "normal", + fontSize: labelFontSize = defaultTarget.label.fontSize, + fontFamily: labelFontFamily = defaultTarget.label.fontFamily, + spacing: labelSpacing = defaultTarget.label.spacing ?? 0 + } = target.label; + return { + text: text2, + value, + shape, + placement, + spacing, + size, + rotation, + label: { + enabled: labelEnabled, + color: labelColor, + fontStyle: labelFontStyle, + fontWeight: labelFontWeight, + fontSize: labelFontSize, + fontFamily: labelFontFamily, + spacing: labelSpacing + }, + style: target.getStyle(defaultTarget) + }; + }); + } + getTargetPoint(target) { + const { properties, originX, originY, horizontal, scale: scale2, gaugeRect } = this; + const { thickness } = properties; + const { value, placement, spacing, size } = target; + const mainOffset = scale2.convert(value); + let crossOffset; + switch (placement) { + case "before": + crossOffset = -(spacing + size / 2); + break; + case "after": + crossOffset = thickness + spacing + size / 2; + break; + default: + crossOffset = thickness / 2; + break; + } + return { + x: originX + gaugeRect.x + (horizontal ? mainOffset : crossOffset), + y: originY + gaugeRect.y + (horizontal ? crossOffset : mainOffset) + }; + } + getTargetLabel(target) { + const { size, placement, label } = target; + const { spacing, color: fill, fontStyle, fontWeight, fontSize, fontFamily } = label; + const lineHeight = void 0; + const offset = size / 2 + spacing; + let textAlign; + let textBaseline; + let offsetX = 0; + let offsetY = 0; + if (this.horizontal) { + textAlign = "center"; + if (placement === "after") { + textBaseline = "top"; + offsetY = offset; + } else { + textBaseline = "bottom"; + offsetY = -offset; + } + } else { + textBaseline = "middle"; + if (placement === "before") { + textAlign = "right"; + offsetX = -offset; + } else { + textAlign = "left"; + offsetX = offset; + } + } + return { + offsetX, + offsetY, + fill, + textAlign, + textBaseline, + fontStyle, + fontWeight, + fontSize, + fontFamily, + lineHeight + }; + } + labelDatum(label, value) { + const { + placement, + avoidCollisions, + spacing, + text: text2, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + wrapping, + overflowStrategy, + formatter: formatter2 = (params) => this.formatLabel(params.value) + } = label; + return { + placement, + avoidCollisions, + spacing, + text: text2, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + wrapping, + overflowStrategy, + formatter: formatter2 + }; + } + verticalLabelInset() { + const { label } = this.properties; + const measurer22 = cachedTextMeasurer(label); + const lines = label.text?.split("\n"); + const labelSize = (label.lineHeight ?? measurer22.lineHeight()) * (lines?.length ?? 1); + return label.spacing + labelSize; + } + horizontalLabelInset() { + const { scale: scale2, properties } = this; + const { scale: scaleProps, label } = properties; + const lines = label.text?.split("\n"); + const measurer22 = cachedTextMeasurer(label); + const ticks = scaleProps.interval.values ?? scale2.ticks({ + nice: false, + interval: scaleProps.interval.step, + minTickCount: 0, + maxTickCount: 6, + tickCount: 5 + })?.ticks ?? []; + const linesOrTicks = lines ?? ticks?.map((tick) => getLabelText(this.id, this.ctx, this.labelDatum(label, tick)) ?? ""); + const labelSize = linesOrTicks.reduce((accum, text2) => { + const { width: width2 } = isArray(text2) ? measureTextSegments(text2, label) : measurer22.measureLines(text2); + return Math.max(accum, width2); + }, 0); + return label.spacing + labelSize; + } + tickFormatter(domain, ticks) { + const { format, formatter: formatter2 } = this.properties.scale.label; + let tickFormatter; + if (format != null) { + tickFormatter = tickFormat2(ticks, typeof format === "string" ? format : void 0); + } + return (value, index) => { + let r = void 0; + if (formatter2) { + r ?? (r = formatWithContext(this.ctx, formatter2, { value, index, domain, boundSeries: void 0 })); + } + r ?? (r = tickFormatter?.(value)); + return r ?? this.formatLabel(value); + }; + } + createNodeData() { + const { id: seriesId, properties, horizontal, scale: scale2, seriesRect } = this; + const { + value, + segmentation, + thickness, + cornerRadius, + cornerMode, + bar, + scale: scaleProps, + label, + defaultColorRange + } = properties; + scale2.domain = [scaleProps.min, scaleProps.max]; + scale2.range = horizontal ? [0, seriesRect.width] : [seriesRect.height, 0]; + let axisRotation; + let sideFlag; + if (horizontal) { + sideFlag = 1; + axisRotation = Math.PI / 2; + } else if (scaleProps.label.placement === "before") { + sideFlag = 1; + axisRotation = 0; + } else { + sideFlag = -1; + axisRotation = 0; + } + let x0; + let x1; + let y0; + let y1; + if (horizontal) { + x0 = 0; + x1 = seriesRect.width; + y0 = (seriesRect.height - thickness) / 2; + y1 = y0 + thickness; + if (label.placement === "outside-start") { + x0 += this.horizontalLabelInset(); + } else if (label.placement === "outside-end") { + x1 -= this.horizontalLabelInset(); + } + } else { + x0 = (seriesRect.width - thickness) / 2; + x1 = x0 + thickness; + y1 = 0; + y0 = seriesRect.height; + if (label.placement === "outside-start") { + y0 -= this.verticalLabelInset(); + } else if (label.placement === "outside-end") { + y1 += this.verticalLabelInset(); + } + } + this.gaugeRect = new BBox19(Math.min(x0, x1), Math.min(y0, y1), Math.abs(x1 - x0), Math.abs(y1 - y0)); + const originX = 0; + const originY = 0; + scale2.domain = [scaleProps.min, scaleProps.max]; + scale2.range = horizontal ? [x0, x1] : [y0, y1]; + const { + tickData: { ticks: tickData } + } = generateTicks22({ + scale: scale2, + label: this.properties.scale.label, + interval: this.properties.scale.interval, + tickFormatter: (domain, ticks) => this.tickFormatter(domain, ticks), + domain: scale2.domain, + range: this.range, + reverse: false, + primaryTickCount: void 0, + defaultTickMinSpacing: 0, + visibleRange: [0, 1], + niceMode: NiceMode2.Off, + labelOffset: 0, + axisRotation, + sideFlag + }); + const isReversed = false; + const targets = this.getTargets(); + const nodeData = []; + const targetData = []; + const labelData = []; + const scaleData = []; + const [m0, m1] = scale2.range; + const mainAxisSize = Math.abs(m1 - m0); + const containerX = horizontal ? scale2.convert(value) : x1; + const containerY = horizontal ? y1 : scale2.convert(value); + const inset = segmentation.enabled ? segmentation.spacing / 2 : 0; + const horizontalInset = horizontal ? inset : 0; + const verticalInset = horizontal ? 0 : inset; + const barThickness = Math.min(bar.thickness ?? Math.round(bar.thicknessRatio * thickness), thickness); + const barInset = -(thickness - barThickness) / 2; + const barXInset = horizontal ? 0 : barInset; + const barYInset = horizontal ? barInset : 0; + const cornersOnAllItems = cornerMode === "item"; + const maxTicks = Math.ceil(mainAxisSize); + let segments = segmentation.enabled ? segmentation.interval.getSegments(scale2, maxTicks) : void 0; + const barStyle = bar.getStyle(defaultColorRange, horizontal, scale2); + const scaleStyle = scaleProps.getStyle(bar.enabled, defaultColorRange, horizontal, scale2); + if (segments == null && cornersOnAllItems) { + const segmentStart = Math.min(...scale2.domain); + const segmentEnd = Math.max(...scale2.domain); + const datum = { value, segmentStart, segmentEnd }; + if (bar.enabled) { + const barAppliedCornerRadius = Math.min(cornerRadius, barThickness / 2, mainAxisSize / 2); + const barCornerInset = barAppliedCornerRadius * (isReversed ? -1 : 1); + const barCornerXInset = horizontal ? barCornerInset : 0; + const barCornerYInset = horizontal ? 0 : barCornerInset; + nodeData.push({ + series: this, + itemId: `value`, + datum, + datumIndex: { + type: 0 + /* Node */ + }, + type: 0, + x0: originX + x0 - barCornerXInset - barXInset, + y0: originY + y0 - barCornerYInset - barYInset, + x1: originX + containerX + barCornerXInset + barXInset, + y1: originY + containerY + barCornerYInset + barYInset, + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius: cornerRadius, + topRightCornerRadius: cornerRadius, + bottomRightCornerRadius: cornerRadius, + bottomLeftCornerRadius: cornerRadius, + horizontalInset, + verticalInset, + style: barStyle + }); + } + const scaleAppliedCornerRadius = Math.min(cornerRadius, thickness / 2, mainAxisSize / 2); + const scaleCornerInset = scaleAppliedCornerRadius * (isReversed ? -1 : 1); + const scaleCornerXInset = horizontal ? scaleCornerInset : 0; + const scaleCornerYInset = horizontal ? 0 : scaleCornerInset; + scaleData.push({ + series: this, + itemId: `scale`, + datum, + datumIndex: { + type: 0 + /* Node */ + }, + type: 0, + x0: originX + x0 - scaleCornerXInset, + y0: originY + y0 - scaleCornerYInset, + x1: originX + x1 + scaleCornerXInset, + y1: originY + y1 + scaleCornerYInset, + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius: cornerRadius, + topRightCornerRadius: cornerRadius, + bottomRightCornerRadius: cornerRadius, + bottomLeftCornerRadius: cornerRadius, + horizontalInset, + verticalInset, + style: scaleStyle + }); + } else { + segments ?? (segments = scale2.domain); + const clipX0 = originX + x0 - barXInset; + const clipY0 = originY + y0 - barYInset; + const clipX1 = originX + containerX + barXInset; + const clipY1 = originY + containerY + barYInset; + for (let i = 0; i < segments.length - 1; i += 1) { + const segmentStart = segments[i + 0]; + const segmentEnd = segments[i + 1]; + const datum = { value, segmentStart, segmentEnd }; + const isStart = i === 0; + const isEnd = i === segments.length - 2; + const itemStart = scale2.convert(segmentStart); + const itemEnd = scale2.convert(segmentEnd); + const startCornerRadius = cornersOnAllItems || isStart ? cornerRadius : 0; + const endCornerRadius = cornersOnAllItems || isEnd ? cornerRadius : 0; + const topLeftCornerRadius = horizontal ? startCornerRadius : endCornerRadius; + const topRightCornerRadius = endCornerRadius; + const bottomRightCornerRadius = horizontal ? endCornerRadius : startCornerRadius; + const bottomLeftCornerRadius = startCornerRadius; + if (bar.enabled) { + nodeData.push({ + series: this, + itemId: `value-${i}`, + datum, + datumIndex: { + type: 0 + /* Node */ + }, + type: 0, + x0: originX + (horizontal ? itemStart : x0), + y0: originY + (horizontal ? y0 : itemStart), + x1: originX + (horizontal ? itemEnd : x1), + y1: originY + (horizontal ? y1 : itemEnd), + clipX0, + clipY0, + clipX1, + clipY1, + topLeftCornerRadius, + topRightCornerRadius, + bottomRightCornerRadius, + bottomLeftCornerRadius, + horizontalInset, + verticalInset, + style: barStyle + }); + } + scaleData.push({ + series: this, + itemId: `scale-${i}`, + datum, + datumIndex: { + type: 0 + /* Node */ + }, + type: 0, + x0: originX + (horizontal ? itemStart : x0), + y0: originY + (horizontal ? y0 : itemStart), + x1: originX + (horizontal ? itemEnd : x1), + y1: originY + (horizontal ? y1 : itemEnd), + clipX0: void 0, + clipY0: void 0, + clipX1: void 0, + clipY1: void 0, + topLeftCornerRadius, + topRightCornerRadius, + bottomRightCornerRadius, + bottomLeftCornerRadius, + horizontalInset, + verticalInset, + style: scaleStyle + }); + } + } + if (label.enabled) { + labelData.push(this.labelDatum(label, value)); + } + const targetPlacementRotation2 = horizontal ? horizontalTargetPlacementRotation : verticalTargetPlacementRotation; + for (let i = 0; i < targets.length; i += 1) { + const target = targets[i]; + const { value: targetValue, text: text2, shape, size, style: style2 } = target; + const targetPoint = this.getTargetPoint(target); + const targetRotation = toRadians4(target.rotation + targetPlacementRotation2[target.placement]); + targetData.push({ + series: this, + itemId: `target-${i}`, + midPoint: targetPoint, + datum: { value: targetValue }, + datumIndex: { type: 1, index: i }, + type: 1, + value: targetValue, + text: text2, + x: targetPoint.x, + y: targetPoint.y, + shape, + size, + rotation: targetRotation, + label: this.getTargetLabel(target), + style: style2 + }); + } + return { + itemId: seriesId, + nodeData, + tickData, + targetData, + labelData, + scaleData + }; + } + updateSelections(resize) { + if (this.nodeDataRefresh || resize) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + highlightDatum(node) { + if (node != null && node.series === this && node.type === 1) { + return node; + } + } + update({ seriesRect }) { + const { + datumSelection, + labelSelection, + targetSelection, + targetLabelSelection, + scaleSelection, + highlightTargetSelection, + tickSelection + } = this; + this.seriesRect = seriesRect ?? BBox19.NaN; + const resize = this.checkResize(seriesRect); + this.updateSelections(resize); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const targetData = this.contextNodeData?.targetData ?? []; + const scaleData = this.contextNodeData?.scaleData ?? []; + const tickData = this.contextNodeData?.tickData ?? []; + const highlightTargetDatum = this.highlightDatum(this.ctx.highlightManager.getActiveHighlight()); + this.scaleSelection = this.updateScaleSelection({ scaleData, scaleSelection }); + this.updateScaleNodes({ scaleSelection }); + this.targetSelection = this.updateTargetSelection({ targetData, targetSelection }); + this.updateTargetNodes({ targetSelection, isHighlight: false }); + this.targetLabelSelection = this.updateTargetLabelSelection({ targetData, targetLabelSelection }); + this.updateTargetLabelNodes({ targetLabelSelection }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightTargetSelection = this.updateTargetSelection({ + targetData: highlightTargetDatum == null ? [] : [highlightTargetDatum], + targetSelection: highlightTargetSelection + }); + this.updateTargetNodes({ targetSelection: highlightTargetSelection, isHighlight: true }); + this.tickSelection = this.updateTickSelection({ tickData, tickSelection }); + this.updateTickNodes({ tickSelection }); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => { + return createDatumId9(opts.nodeData.length, datum.itemId); + }); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + const { ctx } = this; + const animationDisabled = ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect2, datum) => { + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle10(rect2, datum.style, fillBBox); + rect2.topLeftCornerRadius = topLeftCornerRadius; + rect2.topRightCornerRadius = topRightCornerRadius; + rect2.bottomRightCornerRadius = bottomRightCornerRadius; + rect2.bottomLeftCornerRadius = bottomLeftCornerRadius; + rect2.pointerEvents = this.properties.bar.enabled ? module_support_exports.PointerEvents.All : module_support_exports.PointerEvents.None; + if (animationDisabled || rect2.previousDatum == null) { + rect2.setProperties(resetLinearGaugeSeriesResetRectFunction(rect2, datum)); + } + }); + const { horizontal } = this; + this.datumUnion.update(datumSelection, this.itemGroup, module_support_exports.Rect, (node, first2, last) => { + const left = Math.min(first2.x, last.x); + const right = Math.max(first2.x + first2.width, last.x + last.width); + const top = Math.min(first2.y, last.y); + const bottom = Math.max(first2.y + first2.height, last.y + last.height); + const width2 = right - left; + const height2 = bottom - top; + node.pointerEvents = module_support_exports.PointerEvents.None; + node.x = left; + node.y = top; + node.width = width2; + node.height = height2; + node.topLeftCornerRadius = horizontal ? first2.topLeftCornerRadius : last.topLeftCornerRadius; + node.topRightCornerRadius = last.topRightCornerRadius; + node.bottomRightCornerRadius = horizontal ? last.bottomRightCornerRadius : first2.bottomRightCornerRadius; + node.bottomLeftCornerRadius = first2.bottomLeftCornerRadius; + const firstClipBBox = first2.clipBBox; + const lastClipBBox = last.clipBBox ?? firstClipBBox; + if (firstClipBBox && lastClipBBox) { + node.clipBBox = BBox19.merge([firstClipBBox, lastClipBBox]).intersection( + horizontal ? new BBox19(left, -Infinity, width2, Infinity) : new BBox19(-Infinity, top, Infinity, height2) + ); + } else { + node.clipBBox = void 0; + } + }); + } + updateScaleSelection(opts) { + return opts.scaleSelection.update(opts.scaleData, void 0, (datum) => { + return createDatumId9(opts.scaleData.length, datum.itemId); + }); + } + updateScaleNodes(opts) { + const { scaleSelection } = opts; + const fillBBox = this.getShapeFillBBox(); + scaleSelection.each((rect2, datum) => { + const { topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius } = datum; + applyShapeStyle10(rect2, datum.style, fillBBox); + rect2.setProperties(resetLinearGaugeSeriesResetRectFunction(rect2, datum)); + rect2.topLeftCornerRadius = topLeftCornerRadius; + rect2.topRightCornerRadius = topRightCornerRadius; + rect2.bottomRightCornerRadius = bottomRightCornerRadius; + rect2.bottomLeftCornerRadius = bottomLeftCornerRadius; + rect2.setProperties(resetLinearGaugeSeriesResetRectFunction(rect2, datum)); + }); + } + updateTargetSelection(opts) { + return opts.targetSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetNodes(opts) { + const { targetSelection, isHighlight } = opts; + targetSelection.each((target, datum) => { + const { x, y, shape, size, rotation } = datum; + const style2 = this.getTargetStyle(isHighlight, datum); + applyShapeStyle10(target, style2); + target.size = size; + target.shape = shape === "line" ? lineMarker : shape; + target.translationX = x; + target.translationY = y; + target.rotation = rotation; + }); + } + getTargetStyle(isHighlight, { datumIndex, style: style2 }) { + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + return mergeDefaults12(highlightStyle, { + ...style2, + opacity: 1 + }); + } + updateTargetLabelSelection(opts) { + return opts.targetLabelSelection.update(opts.targetData); + } + updateTargetLabelNodes(opts) { + const { targetLabelSelection } = opts; + targetLabelSelection.each((label, target) => { + const { x, y, text: text2 } = target; + const { offsetX, offsetY, fill, fontStyle, fontWeight, fontSize, fontFamily, textAlign, textBaseline } = target.label; + label.visible = true; + label.x = x + offsetX; + label.y = y + offsetY; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + }); + } + updateTickSelection(opts) { + return opts.tickSelection.update(opts.tickData, void 0, (datum) => datum.tickId); + } + updateTickNodes(opts) { + const { gaugeRect, properties } = this; + const defaultScale = properties.defaultScale; + const { + enabled, + color: color6, + fontFamily = defaultScale.label.fontFamily, + fontSize = defaultScale.label.fontSize, + fontStyle, + fontWeight = defaultScale.label.fontWeight, + spacing + } = properties.scale.label; + let { placement } = properties.scale.label; + const rotation = toRadians4(properties.scale.label.rotation ?? 0); + let textAlign; + let textBaseline; + let textX; + let textY; + if (this.horizontal) { + placement ?? (placement = "after"); + textAlign = "center"; + textBaseline = placement === "before" ? "bottom" : "top"; + textY = this.originY + gaugeRect.y + (placement === "before" ? -spacing : gaugeRect.height + spacing); + } else { + placement ?? (placement = "before"); + textAlign = placement === "before" ? "end" : "start"; + textBaseline = "middle"; + textX = this.originX + gaugeRect.x + (placement === "before" ? -spacing : gaugeRect.width + spacing); + } + opts.tickSelection.each((label, datum) => { + if (!enabled) { + label.visible = false; + return; + } + const x = textX ?? datum.translation; + const y = textY ?? datum.translation; + label.visible = true; + label.text = datum.tickLabel; + label.fill = color6; + label.fontFamily = fontFamily; + label.fontSize = fontSize; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.textBaseline = textBaseline; + label.textAlign = textAlign; + label.x = x; + label.y = y; + label.rotationCenterX = x; + label.rotationCenterY = y; + label.rotation = rotation; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(opts.labelData, void 0, (_datum) => "primary"); + } + updateLabelNodes(opts) { + const { labelSelection } = opts; + const animationDisabled = this.ctx.animationManager.isSkipped(); + labelSelection.each((label, datum) => { + label.fill = datum.fill; + label.fontStyle = datum.fontStyle; + label.fontWeight = datum.fontWeight; + label.fontFamily = datum.fontFamily; + }); + if (animationDisabled || this.labelsHaveExplicitText()) { + this.formatLabelText(); + } + } + labelsHaveExplicitText() { + for (const { datum } of this.labelSelection) { + if (datum.text == null) { + return false; + } + } + return true; + } + formatLabelText(datum) { + const { labelSelection, horizontal, scale: scale2, seriesRect, gaugeRect } = this; + const { x, y, width: width2, height: height2 } = gaugeRect; + const value = datum?.label ?? this.properties.value; + let barRect; + if (horizontal) { + const xValue2 = scale2.convert(value); + barRect = new BBox19(x, y, xValue2 - x, height2); + } else { + const yValue = scale2.convert(value); + barRect = new BBox19(x, yValue, width2, height2 - yValue); + } + const bboxes = { seriesRect, gaugeRect, barRect }; + const { margin: padding2 } = this.properties; + formatLinearGaugeLabels(this, this.ctx, labelSelection, { padding: padding2, horizontal }, bboxes, datum); + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + resetMotion3([this.datumSelection], resetLinearGaugeSeriesResetRectFunction); + this.formatLabelText(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + animateLabelText(params = {}) { + const { animationManager } = this.ctx; + let labelFrom = 0; + let labelTo = 0; + this.labelSelection.each((label, datum) => { + label.opacity = 1; + labelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + labelTo = datum.value; + }); + if (this.labelsHaveExplicitText()) { + } else if (labelFrom === labelTo) { + this.formatLabelText({ label: labelTo }); + } else { + const animationId = `${this.id}_labels`; + animationManager.animate({ + id: animationId, + groupId: "label", + from: { label: labelFrom }, + to: { label: labelTo }, + phase: params.phase ?? "update", + ease: easing.easeOut, + onUpdate: (datum) => this.formatLabelText(datum), + onStop: () => this.formatLabelText({ label: labelTo }) + }); + } + } + animateEmptyUpdateReady() { + const { animationManager } = this.ctx; + const { node } = prepareLinearGaugeSeriesAnimationFunctions(true, this.horizontal); + fromToMotion22(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion22(this.id, "label", animationManager, [this.labelSelection], fadeInFns, () => "primary"); + this.animateLabelText({ from: 0, phase: "initial" }); + } + animateWaitingUpdateReady() { + const { animationManager } = this.ctx; + const { node } = prepareLinearGaugeSeriesAnimationFunctions(false, this.horizontal); + fromToMotion22(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + this.animateLabelText(); + } + animateReadyResize() { + this.resetAllAnimation(); + } + getSeriesDomain() { + return [0, 1]; + } + dataCount() { + return Number.NaN; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData() { + return []; + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties } = this; + const { tooltip } = properties; + if (datumIndex == null) + return; + let value; + let text2; + let fallbackLabel; + if (datumIndex.type === 0) { + value = properties.value; + text2 = properties.label.text; + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeValue"); + } else { + ({ value, text: text2 } = properties.targets[datumIndex.index]); + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeTarget"); + } + if (value == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + data: [{ label: text2, fallbackLabel, value: this.formatLabel(value) }] + }, + { seriesId, title: void 0, datum: void 0, value } + ); + } + pickNodeClosestDatum(point) { + return pickGaugeNearestDatum(this, point); + } + pickFocus(opts) { + return pickGaugeFocus(this, opts); + } + getCaptionText() { + return this.formatLabel(this.properties.value); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +LinearGaugeSeries.className = "LinearGaugeSeries"; +LinearGaugeSeries.type = "linear-gauge"; +var LinearGaugeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "linear-gauge", + moduleFactory: (ctx) => new LinearGaugeSeries(ctx), + themeTemplate: { + minWidth: 200, + minHeight: 200, + tooltip: { + enabled: false + }, + series: { + thickness: 50, + defaultColorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $interpolate: [{ $palette: "secondDivergingColors" }, 5] }, + module_support_exports.SAFE_RANGE2_OPERATION + ] + }, + scale: { + // @ts-expect-error undocumented option + defaultFill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + stroke: { $path: ["/2", module_support_exports.SAFE_STROKE_FILL_OPERATION, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + spacing: 11 + } + }, + bar: { + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + segmentation: { + enabled: false, + interval: {}, + spacing: 1 + }, + defaultTarget: { + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + size: 10, + shape: "triangle", + placement: "after", + spacing: 5, + label: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 5 + } + }, + defaultScale: { + label: { + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + } + }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: false, + placement: "inside-start", + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: 2 }, + minimumFontSize: module_support_exports.FONT_SIZE.SMALL, + spacing: 18, + color: { $ref: "chartBackgroundColor" } + }, + margin: 4, + tooltip: { + range: { $path: ["/tooltip/range", 10] } + } + } + } +}; +var LinearGaugeSeriesModule = { + type: "series", + name: "linear-gauge", + chartType: "standalone", + enterprise: true, + options: module_support_exports.linearGaugeSeriesOptionsDef, + create: (ctx) => new LinearGaugeSeries(ctx) +}; +var MAP_THEME_DEFAULTS = { + zoom: { + axes: "xy", + anchorPointX: "pointer", + anchorPointY: "pointer", + buttons: { + // @ts-expect-error undocumented options + anchorPointX: "middle", + anchorPointY: "middle" + } + }, + legend: { + enabled: false + }, + gradientLegend: { + enabled: false, + ...module_support_exports.LEGEND_CONTAINER_THEME + } +}; +function applyMapPalette(object2) { + const clone2 = module_support_exports.deepClone(object2); + module_support_exports.jsonWalk(clone2, (value) => { + if (typeof value === "object" && "$palette" in value) { + value["$mapPalette"] = value["$palette"]; + delete value["$palette"]; + } + }); + return clone2; +} +var delta22 = 1e-9; +function lineSegmentDistanceToPointSquared(a, b, x, y) { + const [ax, ay] = a; + const [bx, by] = b; + const abx = bx - ax; + const aby = by - ay; + const l = abx * abx + aby * aby; + let x0; + let y0; + if (Math.abs(l) < delta22) { + x0 = ax; + y0 = ay; + } else { + let t = ((x - ax) * abx + (y - ay) * aby) / l; + t = Math.max(0, Math.min(1, t)); + x0 = ax + t * (bx - ax); + y0 = ay + t * (by - ay); + } + const dx2 = x - x0; + const dy2 = y - y0; + return dx2 * dx2 + dy2 * dy2; +} +function lineStringDistance(lineString, x, y) { + let minDistanceSquared = Infinity; + let p0 = lineString.at(-1); + for (const p1 of lineString) { + minDistanceSquared = Math.min(minDistanceSquared, lineSegmentDistanceToPointSquared(p0, p1, x, y)); + p0 = p1; + } + return Math.sqrt(minDistanceSquared); +} +function lineStringLength(lineSegment) { + let [x0, y0] = lineSegment[0]; + let totalDistance = 0; + for (let i = 1; i < lineSegment.length; i += 1) { + const [x1, y1] = lineSegment[i]; + const distance2 = Math.hypot(x1 - x0, y1 - y0); + totalDistance += distance2; + x0 = x1; + y0 = y1; + } + return totalDistance; +} +function lineStringCenter(lineSegment) { + if (lineSegment.length === 0) + return; + const targetDistance = lineStringLength(lineSegment) / 2; + let [x0, y0] = lineSegment[0]; + let totalDistance = 0; + for (let i = 1; i < lineSegment.length; i += 1) { + const [x1, y1] = lineSegment[i]; + const segmentDistance = Math.hypot(x1 - x0, y1 - y0); + const nextDistance = totalDistance + segmentDistance; + if (nextDistance > targetDistance) { + const ratio3 = (targetDistance - totalDistance) / segmentDistance; + const point = [x0 + (x1 - x0) * ratio3, y0 + (y1 - y0) * ratio3]; + const angle2 = Math.atan2(y1 - y0, x1 - x0); + return { point, angle: angle2 }; + } + totalDistance = nextDistance; + x0 = x1; + y0 = y1; + } +} +var { LonLatBBox: LonLatBBox2 } = module_support_exports; +function polygonBbox(polygon, into) { + for (const coordinates of polygon) { + const [lon, lat] = coordinates; + into = LonLatBBox2.extend(into, lon, lat, lon, lat); + } + return into; +} +function polygonCentroid(polygon) { + if (polygon.length === 0) + return; + let x = 0; + let y = 0; + let k = 0; + let [x0, y0] = polygon.at(-1); + for (const [x1, y1] of polygon) { + const c = x0 * y1 - x1 * y0; + k += c; + x += (x0 + x1) * c; + y += (y0 + y1) * c; + x0 = x1; + y0 = y1; + } + k *= 3; + return [x / k, y / k]; +} +function polygonDistance(polygons, x, y) { + let inside = false; + let minDistanceSquared = Infinity; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + let [x0, y0] = p0; + for (const p1 of polygon) { + const [x1, y1] = p1; + if (y1 > y !== y0 > y && x < (x0 - x1) * (y - y1) / (y0 - y1) + x1) { + inside = !inside; + } + minDistanceSquared = Math.min(minDistanceSquared, lineSegmentDistanceToPointSquared(p0, p1, x, y)); + p0 = p1; + x0 = x1; + y0 = y1; + } + } + return (inside ? -1 : 1) * Math.sqrt(minDistanceSquared); +} +var { Path: Path11, ExtendedPath2D: ExtendedPath2D5, BBox: BBox20, SceneChangeDetection: SceneChangeDetection9, SceneObjectChangeDetection: SceneObjectChangeDetection2, objectsEqual: objectsEqual2 } = module_support_exports; +var GeoGeometry = class extends Path11 { + constructor() { + super(...arguments); + this.projectedGeometry = void 0; + this.renderMode = 3; + this.strokePath = new ExtendedPath2D5(); + } + computeBBox() { + if (this.dirtyPath || this.isDirtyPath()) { + this.updatePath(); + this.dirtyPath = false; + } + return this.bbox?.clone(); + } + updatePath() { + const { projectedGeometry } = this; + this.strokePath.clear(); + this.path.clear(); + this.bbox = projectedGeometry == null ? void 0 : this.drawGeometry(projectedGeometry, void 0); + } + drawPath(ctx) { + super.drawPath(ctx); + this.renderStroke(ctx, this.strokePath.getPath2D()); + } + containsPoint(x, y) { + const { projectedGeometry } = this; + if (projectedGeometry == null) + return false; + if (!this.getBBox().containsPoint(x, y)) + return false; + return this.geometryDistance(projectedGeometry, x, y) <= 0; + } + distanceSquared(x, y) { + const { projectedGeometry } = this; + if (projectedGeometry == null) + return Infinity; + const distance2 = this.geometryDistance(projectedGeometry, x, y); + return distance2 > 0 ? distance2 * distance2 : 0; + } + geometryDistance(geometry, x, y) { + const { renderMode, strokeWidth } = this; + const drawPolygons = (renderMode & 1) !== 0; + const drawLines = (renderMode & 2) !== 0; + const minStrokeDistance = Math.max(strokeWidth / 2, 1) + 1; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.reduce( + (minDistance, g) => Math.min(minDistance, this.geometryDistance(g, x, y)), + Infinity + ); + case "MultiPolygon": + return drawPolygons ? geometry.coordinates.reduce( + (minDistance, polygon) => Math.min(minDistance, Math.max(polygonDistance(polygon, x, y), 0)), + Infinity + ) : Infinity; + case "Polygon": + return drawPolygons ? Math.max(polygonDistance(geometry.coordinates, x, y), 0) : Infinity; + case "MultiLineString": + return drawLines ? geometry.coordinates.reduce((minDistance, lineString) => { + return Math.min( + minDistance, + Math.max(lineStringDistance(lineString, x, y) - minStrokeDistance, 0) + ); + }, Infinity) : Infinity; + case "LineString": + return drawLines ? Math.max(lineStringDistance(geometry.coordinates, x, y) - minStrokeDistance, 0) : Infinity; + case "MultiPoint": + case "Point": + default: + return Infinity; + } + } + drawGeometry(geometry, bbox) { + const { renderMode, path, strokePath } = this; + const drawPolygons = (renderMode & 1) !== 0; + const drawLines = (renderMode & 2) !== 0; + switch (geometry.type) { + case "GeometryCollection": + for (const g of geometry.geometries) { + bbox = this.drawGeometry(g, bbox); + } + break; + case "MultiPolygon": + if (drawPolygons) { + for (const coordinates of geometry.coordinates) { + bbox = this.drawPolygon(path, coordinates, bbox); + } + } + break; + case "Polygon": + if (drawPolygons) { + bbox = this.drawPolygon(path, geometry.coordinates, bbox); + } + break; + case "LineString": + if (drawLines) { + bbox = this.drawLineString(strokePath, geometry.coordinates, bbox, false); + } + break; + case "MultiLineString": + if (drawLines) { + for (const coordinates of geometry.coordinates) { + bbox = this.drawLineString(strokePath, coordinates, bbox, false); + } + } + break; + case "Point": + case "MultiPoint": + break; + } + return bbox; + } + drawPolygon(path, polygons, bbox) { + if (polygons.length < 1) + return bbox; + bbox = this.drawLineString(path, polygons[0], bbox, true); + for (let i = 1; i < polygons.length; i += 1) { + const enclave = polygons[i]; + this.drawLineString(path, enclave, void 0, true); + } + return bbox; + } + drawLineString(path, coordinates, bbox, isClosed) { + if (coordinates.length < 2) + return bbox; + const end3 = isClosed ? coordinates.length - 1 : coordinates.length; + for (let i = 0; i < end3; i += 1) { + const [x, y] = coordinates[i]; + if (i === 0) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + if (bbox == null) { + bbox = new BBox20(x, y, 0, 0); + } else { + const { x: x0, y: y0 } = bbox; + const x1 = x0 + bbox.width; + const y1 = y0 + bbox.height; + bbox.x = Math.min(x0, x); + bbox.y = Math.min(y0, y); + bbox.width = Math.max(x1, x) - bbox.x; + bbox.height = Math.max(y1, y) - bbox.y; + } + } + if (isClosed) { + path.closePath(); + } + return bbox; + } +}; +__decorateClass2([ + SceneObjectChangeDetection2({ equals: objectsEqual2 }) +], GeoGeometry.prototype, "projectedGeometry", 2); +__decorateClass2([ + SceneChangeDetection9() +], GeoGeometry.prototype, "renderMode", 2); +var { LonLatBBox: LonLatBBox22 } = module_support_exports; +function geometryBbox(geometry, into) { + if (geometry.bbox != null) { + const [lon0, lat0, lon1, lat1] = geometry.bbox; + into = LonLatBBox22.extend(into, lon0, lat0, lon1, lat1); + return into; + } + switch (geometry.type) { + case "GeometryCollection": + for (const g of geometry.geometries) { + into = geometryBbox(g, into); + } + break; + case "MultiPolygon": + for (const c of geometry.coordinates) { + if (c.length > 0) { + into = polygonBbox(c[0], into); + } + } + break; + case "Polygon": + if (geometry.coordinates.length > 0) { + into = polygonBbox(geometry.coordinates[0], into); + } + break; + case "MultiLineString": + for (const c of geometry.coordinates) { + into = polygonBbox(c, into); + } + break; + case "LineString": + into = polygonBbox(geometry.coordinates, into); + break; + case "MultiPoint": + for (const p of geometry.coordinates) { + const [lon, lat] = p; + into = LonLatBBox22.extend(into, lon, lat, lon, lat); + } + break; + case "Point": { + const [lon, lat] = geometry.coordinates; + into = LonLatBBox22.extend(into, lon, lat, lon, lat); + break; + } + } + return into; +} +function largestPolygon(geometry) { + switch (geometry.type) { + case "GeometryCollection": { + let maxArea; + let maxPolygon; + for (const g of geometry.geometries) { + const polygon = largestPolygon(g); + if (polygon == null) + continue; + const bbox = polygonBbox(polygon[0], void 0); + if (bbox == null) + continue; + const area2 = Math.abs(bbox.lat1 - bbox.lat0) * Math.abs(bbox.lon1 - bbox.lon0); + if (maxArea == null || area2 > maxArea) { + maxArea = area2; + maxPolygon = polygon; + } + } + return maxPolygon; + } + case "MultiPolygon": { + let maxArea; + let maxPolygon; + for (const polygon of geometry.coordinates) { + const bbox = polygonBbox(polygon[0], void 0); + if (bbox == null) + continue; + const area2 = Math.abs(bbox.lat1 - bbox.lat0) * Math.abs(bbox.lon1 - bbox.lon0); + if (maxArea == null || area2 > maxArea) { + maxArea = area2; + maxPolygon = polygon; + } + } + return maxPolygon; + } + case "Polygon": + return geometry.coordinates; + case "MultiLineString": + case "LineString": + case "MultiPoint": + case "Point": + return; + } +} +function largestLineString(geometry) { + switch (geometry.type) { + case "GeometryCollection": { + let maxLength; + let maxLineString; + for (const g of geometry.geometries) { + const lineString = largestLineString(g); + if (lineString == null) + continue; + const length2 = lineStringLength(lineString); + if (length2 == null) + continue; + if (maxLength == null || length2 > maxLength) { + maxLength = length2; + maxLineString = lineString; + } + } + return maxLineString; + } + case "MultiLineString": { + let maxLength = 0; + let maxLineString; + for (const lineString of geometry.coordinates) { + const length2 = lineStringLength(lineString); + if (length2 > maxLength) { + maxLength = length2; + maxLineString = lineString; + } + } + return maxLineString; + } + case "LineString": + return geometry.coordinates; + case "MultiPolygon": + case "Polygon": + case "MultiPoint": + case "Point": + return; + } +} +function containsType(geometry, type) { + if (geometry == null) + return false; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.some((g) => containsType(g, type)); + case "MultiPolygon": + case "Polygon": + return (type & 1) !== 0; + case "MultiLineString": + case "LineString": + return (type & 2) !== 0; + case "MultiPoint": + case "Point": + return (type & 4) !== 0; + } +} +function projectGeometry(geometry, scale2) { + switch (geometry.type) { + case "GeometryCollection": + return { + type: "GeometryCollection", + geometries: geometry.geometries.map((g) => projectGeometry(g, scale2)) + }; + case "Polygon": + return { + type: "Polygon", + coordinates: projectPolygon(geometry.coordinates, scale2) + }; + case "MultiPolygon": + return { + type: "MultiPolygon", + coordinates: projectMultiPolygon(geometry.coordinates, scale2) + }; + case "MultiLineString": + return { + type: "MultiLineString", + coordinates: projectPolygon(geometry.coordinates, scale2) + }; + case "LineString": + return { + type: "LineString", + coordinates: projectLineString(geometry.coordinates, scale2) + }; + case "MultiPoint": + return { + type: "MultiPoint", + coordinates: projectLineString(geometry.coordinates, scale2) + }; + case "Point": + return { + type: "Point", + coordinates: scale2.convert(geometry.coordinates) + }; + } +} +function projectMultiPolygon(multiPolygon, scale2) { + return multiPolygon.map((polygon) => projectPolygon(polygon, scale2)); +} +function projectPolygon(polygon, scale2) { + return polygon.map((lineString) => projectLineString(lineString, scale2)); +} +function projectLineString(lineString, scale2) { + return lineString.map((lonLat) => scale2.convert(lonLat)); +} +function prepareMapMarkerAnimationFunctions() { + const fromFn = (marker, _datum, status) => { + if (status === "removed") { + return { scalingX: 1, scalingY: 1 }; + } else if (marker.previousDatum == null) { + return { scalingX: 0, scalingY: 0 }; + } + return { scalingX: marker.scalingX, scalingY: marker.scalingY }; + }; + const toFn = (_marker, _datum, status) => { + if (status === "removed") { + return { scalingX: 0, scalingY: 0 }; + } + return { scalingX: 1, scalingY: 1 }; + }; + return { fromFn, toFn }; +} +function findFocusedGeoGeometry(series, opts) { + const datum = series.contextNodeData?.nodeData[opts.datumIndex]; + if (datum === void 0) + return void 0; + for (const node of series.datumSelection.nodes()) { + if (node.datum === datum) { + return node; + } + } + return void 0; +} +var TopologySeriesProperties = class extends module_support_exports.SeriesProperties { +}; +var TopologySeries = class extends module_support_exports.DataModelSeries { + addChartEventListeners() { + this.cleanup.register( + this.ctx.eventsHub.on("legend:item-click", (event) => { + this.onLegendItemClick(event); + }), + this.ctx.eventsHub.on("legend:item-double-click", (event) => { + this.onLegendItemDoubleClick(event); + }) + ); + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } +}; +var { Property: Property70, SeriesProperties: SeriesProperties3, makeSeriesTooltip: makeSeriesTooltip12, Label: Label10 } = module_support_exports; +var MapLineSeriesProperties = class extends SeriesProperties3 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = ""; + this.topologyIdKey = "name"; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.maxStrokeWidth = void 0; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new Label10(); + this.tooltip = makeSeriesTooltip12(); + } + getStyle() { + const { stroke: stroke22, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this; + return { + stroke: stroke22, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "topology", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "title", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "legendItemName", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "idKey", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "idName", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "labelKey", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "labelName", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "sizeKey", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "sizeName", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "colorKey", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "colorName", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "sizeDomain", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "colorRange", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "maxStrokeWidth", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "stroke", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property70 +], MapLineSeriesProperties.prototype, "tooltip", 2); +var { + getMissCount: getMissCount22, + getLabelStyles: getLabelStyles22, + createDatumId: createDatumId10, + SeriesNodePickMode: SeriesNodePickMode9, + valueProperty: valueProperty12, + ColorScale: ColorScale22, + LinearScale: LinearScale5, + Selection: Selection8, + Text: Text4, + Transformable: Transformable22, + mergeDefaults: mergeDefaults13 +} = module_support_exports; +var MapLineSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + size: ["colorKey"], + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + size: ["sizeName"], + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode9.EXACT_SHAPE_MATCH, SeriesNodePickMode9.NEAREST_NODE], + usesPlacedLabels: true + }); + this.properties = new MapLineSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale22(); + this.sizeScale = new LinearScale5(); + this.datumSelection = Selection8.select( + this.contentGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection8.select(this.labelGroup, Text4); + this.highlightDatumSelection = Selection8.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this._previousDatumMidPoint = void 0; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + return super.hasData && this.topology != null; + } + renderToOffscreenCanvas() { + return true; + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [1, zIndex]; + this.highlightGroup.zIndex = [2, zIndex]; + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 2; + geoGeometry.lineJoin = "round"; + geoGeometry.lineCap = "round"; + return geoGeometry; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, sizeScale, colorScale } = this; + const { topologyIdKey, idKey, sizeKey, colorKey, labelKey, sizeDomain, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null || !containsType( + feature.geometry, + 2 + /* LineString */ + )) + continue; + featureById.set(property, feature); + } + const sizeScaleType = this.sizeScale.type; + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + valueProperty12(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty12(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }), + ...labelKey == null ? [] : [valueProperty12(labelKey, "category", { id: "labelValue" })], + ...sizeKey == null ? [] : [valueProperty12(sizeKey, sizeScaleType, { id: "sizeValue" })], + ...colorKey == null ? [] : [valueProperty12(colorKey, colorScaleType, { id: "colorValue" })] + ] + }); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + this.topologyBounds = featureValues.reduce((current, feature) => { + const geometry = feature?.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (sizeKey != null) { + const sizeIdx = dataModel.resolveProcessedDataIndexById(this, `sizeValue`); + const processedSize = processedData.domain.values[sizeIdx] ?? []; + sizeScale.domain = sizeDomain ?? processedSize; + } + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + if (topology == null) { + logger_exports.warnOnce(`no topology was provided for [MapLineSeries]; nothing will be rendered.`); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount22(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelDatum(datum, labelValue, projectedGeometry, measurer22) { + if (labelValue == null || projectedGeometry == null) + return; + const lineString = largestLineString(projectedGeometry); + if (lineString == null) + return; + const { idKey, idName, sizeKey, sizeName, colorKey, colorName, labelKey, labelName, label } = this.properties; + if (labelKey == null || !label.enabled) + return; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const labelSize = measurer22.measureLines(String(labelText)); + const labelCenter = lineStringCenter(lineString); + if (labelCenter == null) + return; + const [x, y] = labelCenter.point; + const { width: width2, height: height2 } = labelSize; + return { + point: { x, y, size: 0 }, + label: { width: width2, height: height2, text: labelText }, + anchor: void 0, + placement: void 0 + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, sizeScale, properties, scale: scale2 } = this; + const { idKey, sizeKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null) + return; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const sizeValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const maxStrokeWidth = properties.maxStrokeWidth ?? properties.strokeWidth; + sizeScale.range = [Math.min(properties.strokeWidth, maxStrokeWidth), maxStrokeWidth]; + const measurer22 = cachedTextMeasurer(label); + const projectedGeometries = /* @__PURE__ */ new Map(); + for (const [datumIndex] of processedData.dataSources.get(this.id)?.data.entries() ?? []) { + const id = idValues[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + const projectedGeometry = geometry != null && scale2 != null ? projectGeometry(geometry, scale2) : void 0; + if (id != null && projectedGeometry != null) { + projectedGeometries.set(id, projectedGeometry); + } + } + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const sizeValue = sizeValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const projectedGeometry = projectedGeometries.get(idValue); + if (projectedGeometry == null) { + missingGeometries.push(idValue); + } + const labelDatum = this.getLabelDatum(datum, labelValue, projectedGeometry, measurer22); + if (labelDatum != null) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: idKey, + datum, + datumIndex, + idValue, + labelValue, + colorValue, + sizeValue, + projectedGeometry, + legendItemName, + style: this.getItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + logger_exports.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection, isHighlight: false }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection, isHighlight: true }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId10(datum.idValue)); + } + getItemStyle({ datumIndex = 0, datum, colorValue, sizeValue }, isHighlight) { + const { properties, colorScale, sizeScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const style2 = mergeDefaults13(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + style2.stroke = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? properties.stroke; + } + if (sizeValue != null) { + style2.strokeWidth = sizeScale.convert(sizeValue, { clamp: true }); + } + let overrides; + if (itemStyler != null) { + overrides = this.cachedDatumCallback(createDatumId10(datumIndex, isHighlight ? "highlight" : "node"), () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style2); + return this.callWithContext(itemStyler, params); + }); + } + return overrides ? mergeDefaults13(style2, overrides) : style2; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style2) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style2 + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + datumSelection.each((geoGeometry, nodeDatum) => { + const { projectedGeometry, style: style2 } = nodeDatum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(style2); + }); + } + updatePlacedLabelData(labelData) { + this.labelSelection = this.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = module_support_exports.PointerEvents.None; + }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, width: width2, height: height2, text: text2 }, datumIndex) => { + const style2 = getLabelStyles22(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style2; + label.visible = true; + label.x = x + width2 / 2; + label.y = y + height2 / 2; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style2); + }); + } + resetAnimation() { + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared2 = node.distanceSquared(x, y); + if (distanceSquared2 < minDistanceSquared) { + minDistanceSquared = distanceSquared2; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + datumMidPoint(datum) { + const { _previousDatumMidPoint } = this; + if (_previousDatumMidPoint?.datum === datum) { + return _previousDatumMidPoint.point; + } + const projectedGeometry = datum.projectedGeometry; + const lineString = projectedGeometry == null ? void 0 : largestLineString(projectedGeometry); + const center2 = lineString == null ? void 0 : lineStringCenter(lineString)?.point; + const point = center2 == null ? void 0 : { x: center2[0], y: center2[1] }; + this._previousDatumMidPoint = { datum, point }; + return point; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { strokeWidth, strokeOpacity, lineDash } = properties; + let { stroke: stroke22 } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + stroke22 = this.colorScale.convert(colorValue); + } + return { + marker: { + fill: void 0, + fillOpacity: 0, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 0, + lineDash: [0], + lineDashOffset: 0, + enabled: false + }, + line: { + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idKey, idName, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + idKey, + idName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + legendItemName, + tooltip + } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const sizeValue = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (sizeValue != null && sizeKey != null) { + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: sizeValue, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + domain, + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(sizeValue) }); + } + if (colorValue != null && colorKey != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + const format = this.getItemStyle({ datumIndex, datum, colorValue, sizeValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: idValues[datumIndex], + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { + seriesId, + datum, + title, + idKey, + idName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + ...format + } + ); + } + computeFocusBounds(opts) { + const geometry = findFocusedGeoGeometry(this, opts); + return geometry ? Transformable22.toCanvas(this.contentGroup, geometry.getBBox()) : void 0; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapLineSeries.className = "MapLineSeries"; +MapLineSeries.type = "map-line"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs11, mapLineSeriesThemeableOptionsDef: mapLineSeriesThemeableOptionsDef2, without: without5 } = module_support_exports; +var mapLineSeriesOptionsDef = { + ...without5(commonSeriesOptionsDefs11, ["highlightStyle", "highlight"]), + ...mapLineSeriesThemeableOptionsDef2, + type: required(constant("map-line")), + idKey: required(string), + sizeKey: string, + colorKey: string, + labelKey: string, + idName: string, + sizeName: string, + colorName: string, + labelName: string, + topology: geoJson, + topologyIdKey: string, + legendItemName: string, + title: string +}; +mapLineSeriesOptionsDef.colorRange = undocumented(and(arrayOf(color), arrayLength(1))); +var MapLineModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-line", + moduleFactory: (ctx) => new MapLineSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + stroke: applyMapPalette(module_support_exports.SAFE_STROKE_FILL_OPERATION), + // @ts-expect-error undocumented option + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(module_support_exports.SAFE_RANGE2_OPERATION) + ] + }, + strokeWidth: 1, + maxStrokeWidth: 3, + lineDash: [0], + lineDashOffset: 0, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: applyMapPalette(module_support_exports.multiSeriesHighlightStyle(false)) + }, + tooltip: { + range: "exact" + } + } +}; +var MapLineSeriesModule = { + type: "series", + name: "map-line", + chartType: "topology", + enterprise: true, + options: mapLineSeriesOptionsDef, + create: (ctx) => new MapLineSeries(ctx) +}; +var { Property: Property71, SeriesProperties: SeriesProperties4, makeSeriesTooltip: makeSeriesTooltip13 } = module_support_exports; +var MapLineBackgroundSeriesProperties = class extends SeriesProperties4 { + constructor() { + super(...arguments); + this.topology = void 0; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tooltip = makeSeriesTooltip13(); + } +}; +__decorateClass2([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "topology", 2); +__decorateClass2([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "stroke", 2); +__decorateClass2([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property71 +], MapLineBackgroundSeriesProperties.prototype, "tooltip", 2); +var { createDatumId: createDatumId11, Group: Group12, Selection: Selection9, PointerEvents: PointerEvents6 } = module_support_exports; +var MapLineBackgroundSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [] + }); + this.properties = new MapLineBackgroundSeriesProperties(); + this._chartTopology = void 0; + this.itemGroup = this.contentGroup.appendChild(new Group12({ name: "itemGroup" })); + this.datumSelection = Selection9.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.itemGroup.pointerEvents = PointerEvents6.None; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get focusable() { + return false; + } + setOptionsData() { + } + setChartData() { + } + get hasData() { + return false; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0, zIndex, 0]; + this.highlightGroup.zIndex = [0, zIndex, 1]; + return true; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 2; + geoGeometry.lineJoin = "round"; + geoGeometry.lineCap = "round"; + geoGeometry.pointerEvents = PointerEvents6.None; + return geoGeometry; + } + processData() { + const { topology } = this; + this.topologyBounds = topology?.features.reduce((current, feature) => { + const geometry = feature.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (topology == null) { + logger_exports.warnOnce(`no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.`); + } + } + createNodeData() { + const { id: seriesId, topology, scale: scale2, properties } = this; + if (topology == null) + return; + const { stroke: stroke22, strokeOpacity, lineDash, lineDashOffset, strokeWidth } = properties; + const nodeData = []; + const labelData = []; + for (const [index, feature] of topology.features.entries()) { + const { geometry } = feature; + const projectedGeometry = geometry != null && scale2 != null ? projectGeometry(geometry, scale2) : void 0; + if (projectedGeometry == null) + continue; + nodeData.push({ + series: this, + itemId: index, + datum: feature, + datumIndex: 0, + index, + projectedGeometry, + style: { stroke: stroke22, strokeOpacity, lineDash, lineDashOffset, strokeWidth } + }); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + const { nodeData = [] } = this.contextNodeData ?? {}; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId11(datum.index)); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + datumSelection.each((geoGeometry, datum) => { + const { projectedGeometry } = datum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(datum.style); + }); + } + resetAnimation() { + } + getLegendData() { + return []; + } + getTooltipContent(_seriesDatum) { + return; + } + computeFocusBounds(_opts) { + return void 0; + } + hasItemStylers() { + return false; + } +}; +MapLineBackgroundSeries.className = "MapLineBackgroundSeries"; +MapLineBackgroundSeries.type = "map-line-background"; +var { mapLineBackgroundSeriesThemeableOptionsDef: mapLineBackgroundSeriesThemeableOptionsDef2 } = module_support_exports; +var mapLineBackgroundSeriesOptionsDef = { + ...mapLineBackgroundSeriesThemeableOptionsDef2, + type: required(constant("map-line-background")), + topology: geoJson +}; +var MapLineBackgroundModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-line-background", + moduleFactory: (ctx) => new MapLineBackgroundSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + stroke: { $path: ["/1", { $mapPalette: "stroke" }, { $mapPalette: "secondHierarchyColors" }] }, + strokeWidth: 1, + lineDash: [0], + lineDashOffset: 0 + } + } +}; +var MapLineBackgroundSeriesModule = { + type: "series", + name: "map-line-background", + chartType: "topology", + enterprise: true, + options: mapLineBackgroundSeriesOptionsDef, + create: (ctx) => new MapLineBackgroundSeries(ctx) +}; +var __MINI_CHART_SERIES_OPTIONS2 = void 0; +var __VERIFY_MINI_CHART_SERIES_OPTIONS2 = void 0; +__VERIFY_MINI_CHART_SERIES_OPTIONS2 = __MINI_CHART_SERIES_OPTIONS2; +var __THEME_OVERRIDES2 = void 0; +var __VERIFY_THEME_OVERRIDES2 = void 0; +__VERIFY_THEME_OVERRIDES2 = __THEME_OVERRIDES2; +var __THEMEABLE_OPTIONS2 = void 0; +var __VERIFY_THEMEABLE_OPTIONS2 = void 0; +__VERIFY_THEMEABLE_OPTIONS2 = __THEMEABLE_OPTIONS2; +var __AXIS_LABEL_OPTIONS2 = void 0; +var __VERIFY_AXIS_LABEL_OPTIONS2 = void 0; +__VERIFY_AXIS_LABEL_OPTIONS2 = __AXIS_LABEL_OPTIONS2; +function polygonPointSearch(polygons, precision, valueFn) { + const bbox = polygonBbox(polygons[0], void 0); + if (bbox == null) + return; + const boundingXCenter = (bbox.lon0 + bbox.lon1) / 2; + const boundingYCenter = (bbox.lat0 + bbox.lat1) / 2; + const boundingWidth = Math.abs(bbox.lon1 - bbox.lon0); + const boundingHeight = Math.abs(bbox.lat1 - bbox.lat0); + const centroid = polygonCentroid(polygons[0]); + const [cx, cy] = centroid; + const centroidDistanceToPolygon = -polygonDistance(polygons, cx, cy); + let bestResult; + const cellValue = (distanceToPolygon, distanceToCentroid) => { + const centroidDriftFactor = 0.5; + const centroidDrift = Math.max(distanceToCentroid - centroidDistanceToPolygon, 0); + return distanceToPolygon - centroidDriftFactor * centroidDrift; + }; + const createLabelPlacement = (x2, y2, stride) => { + const { distance: distance22, maxDistance } = valueFn(polygons, x2, y2, stride); + const distanceToCentroid = Math.hypot(cx - x2, cy - y2); + const maxXTowardsCentroid = Math.min(Math.max(cx, x2 - stride / 2), x2 + stride / 2); + const maxYTowardsCentroid = Math.min(Math.max(cy, y2 - stride / 2), y2 + stride / 2); + const minDistanceToCentroid = Math.hypot(cx - maxXTowardsCentroid, cy - maxYTowardsCentroid); + const value = cellValue(distance22, distanceToCentroid); + const maxValue = cellValue(maxDistance, minDistanceToCentroid); + return { distance: distance22, maxDistance, value, maxValue, x: x2, y: y2, stride }; + }; + const appendLabelPlacement = (into, x2, y2, stride) => { + const labelPlacement = createLabelPlacement(x2, y2, stride); + if (labelPlacement.maxDistance >= 0) { + into.push(labelPlacement); + } + }; + const initialStride = Math.min(boundingWidth, boundingHeight) / 2; + let queue = { + value: createLabelPlacement(boundingXCenter, boundingYCenter, initialStride), + next: null + }; + while (queue != null) { + const item = queue.value; + const { distance: distance22, value, maxValue, x: x2, y: y2, stride } = item; + queue = queue.next; + if (distance22 > 0 && (bestResult == null || value > bestResult.value)) { + bestResult = item; + } + if (bestResult != null && maxValue - bestResult.value <= precision) { + continue; + } + const nextStride = stride / 2; + const newLabelPlacements = []; + appendLabelPlacement(newLabelPlacements, x2 - nextStride, y2 - nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 + nextStride, y2 - nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 - nextStride, y2 + nextStride, nextStride); + appendLabelPlacement(newLabelPlacements, x2 + nextStride, y2 + nextStride, nextStride); + newLabelPlacements.sort(labelPlacementCmp); + queue = insertListItemsSorted(queue, newLabelPlacements, labelPlacementCmp); + } + if (bestResult == null) + return; + const { distance: distance2, x, y } = bestResult; + return { x, y, distance: distance2 }; +} +var labelPlacementCmp = (a, b) => b.maxValue - a.maxValue; +function polygonMarkerCenter(polygons, precision) { + const result = polygonPointSearch(polygons, precision, (p, x2, y2, stride) => { + const distance2 = -polygonDistance(p, x2, y2); + const maxDistance = distance2 + stride * Math.SQRT2; + return { distance: distance2, maxDistance }; + }); + if (result == null) + return; + const { x, y } = result; + return [x, y]; +} +function markerPositions(geometry, precision) { + let center2; + switch (geometry.type) { + case "GeometryCollection": + return geometry.geometries.flatMap((g) => markerPositions(g, precision)); + case "MultiPoint": + return geometry.coordinates; + case "Point": + return [geometry.coordinates]; + case "MultiPolygon": { + const polygon = largestPolygon(geometry); + center2 = polygon == null ? void 0 : polygonMarkerCenter(polygon, precision); + break; + } + case "Polygon": { + const polygon = geometry.coordinates; + center2 = polygon == null ? void 0 : polygonMarkerCenter(polygon, precision); + break; + } + case "MultiLineString": { + const lineString = largestLineString(geometry); + center2 = lineString == null ? void 0 : lineStringCenter(lineString)?.point; + break; + } + case "LineString": { + const lineString = geometry.coordinates; + center2 = lineStringCenter(lineString)?.point; + break; + } + } + return center2 == null ? [] : [center2]; +} +var { BBox: BBox21 } = module_support_exports; +function getTopologyShapeFillBBox(scale2) { + if (!scale2) + return; + const { range: range22 } = scale2; + const x = range22[0][0]; + const y = range22[0][1]; + const width2 = range22[1][0] - x; + const height2 = range22[1][1] - y; + const bbox = new BBox21(x, y, width2, height2); + return { + series: bbox, + axis: bbox + }; +} +var { Property: Property72, SeriesProperties: SeriesProperties5, makeSeriesTooltip: makeSeriesTooltip14, Label: Label11 } = module_support_exports; +var MapMarkerSeriesLabel = class extends Label11 { + constructor() { + super(...arguments); + this.placement = "bottom"; + } +}; +__decorateClass2([ + Property72 +], MapMarkerSeriesLabel.prototype, "placement", 2); +var MapMarkerSeriesProperties = class extends SeriesProperties5 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = void 0; + this.topologyIdKey = "name"; + this.idName = void 0; + this.latitudeKey = void 0; + this.latitudeName = void 0; + this.longitudeKey = void 0; + this.longitudeName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.shape = "circle"; + this.size = 6; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.label = new MapMarkerSeriesLabel(); + this.tooltip = makeSeriesTooltip14(); + } + getStyle() { + const { size, shape, fill, fillOpacity, stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + size, + shape, + fill, + fillOpacity, + opacity: 1, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "topology", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "title", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "legendItemName", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "idKey", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "idName", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "latitudeKey", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "latitudeName", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "longitudeKey", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "longitudeName", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "labelKey", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "labelName", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "sizeKey", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "sizeName", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "colorKey", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "colorName", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "colorRange", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "shape", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "size", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "maxSize", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "sizeDomain", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "fill", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "stroke", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property72 +], MapMarkerSeriesProperties.prototype, "tooltip", 2); +var { + fromToMotion: fromToMotion3, + StateMachine: StateMachine13, + getMissCount: getMissCount3, + createDatumId: createDatumId12, + SeriesNodePickMode: SeriesNodePickMode10, + valueProperty: valueProperty13, + computeMarkerFocusBounds: computeMarkerFocusBounds22, + ColorScale: ColorScale3, + LinearScale: LinearScale6, + Group: Group13, + Selection: Selection10, + Text: Text5, + Marker: Marker4, + applyShapeStyle: applyShapeStyle11, + getLabelStyles: getLabelStyles3, + LonLatBBox: LonLatBBox3, + mergeDefaults: mergeDefaults14 +} = module_support_exports; +var MapMarkerSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + size: ["colorKey"], + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + size: ["sizeName"], + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode10.EXACT_SHAPE_MATCH, SeriesNodePickMode10.NEAREST_NODE], + usesPlacedLabels: true + }); + this.properties = new MapMarkerSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale3(); + this.sizeScale = new LinearScale6(); + this.markerGroup = this.contentGroup.appendChild(new Group13({ name: "markerGroup" })); + this.labelSelection = Selection10.select(this.labelGroup, Text5, false); + this.markerSelection = Selection10.select( + this.markerGroup, + Marker4, + false + ); + this.highlightMarkerSelection = Selection10.select(this.highlightGroup, Marker4); + this.animationState = new StateMachine13( + "empty", + { + empty: { + update: { + target: "ready", + action: () => this.animateMarkers() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.resetAllAnimation(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateMarkers() + }, + // chart.ts transitions to updateData on zoom change + resize: { + target: "ready", + action: () => this.resetAllAnimation() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty", + action: () => this.resetAllAnimation() + }, + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + const hasLatLon = this.properties.latitudeKey != null && this.properties.longitudeKey != null; + return super.hasData && (this.topology != null || hasLatLon); + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [3, zIndex]; + this.highlightGroup.zIndex = [4, zIndex]; + return true; + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, sizeScale, colorScale } = this; + const { topologyIdKey, idKey, latitudeKey, longitudeKey, sizeKey, colorKey, labelKey, sizeDomain, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null) + continue; + featureById.set(property, feature); + } + const sizeScaleType = this.sizeScale.type; + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const hasLatLon = latitudeKey != null && longitudeKey != null; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + ...idKey == null ? [] : [ + valueProperty13(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty13(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }) + ], + ...hasLatLon ? [ + valueProperty13(latitudeKey, mercatorScaleType, { id: "latValue" }), + valueProperty13(longitudeKey, mercatorScaleType, { id: "lonValue" }) + ] : [], + ...labelKey ? [valueProperty13(labelKey, "category", { id: "labelValue" })] : [], + ...sizeKey ? [valueProperty13(sizeKey, sizeScaleType, { id: "sizeValue" })] : [], + ...colorKey ? [valueProperty13(colorKey, colorScaleType, { id: "colorValue" })] : [] + ] + }); + const featureValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `featureValue`, processedData); + const latValues = hasLatLon ? dataModel.resolveColumnById(this, `latValue`, processedData) : void 0; + const lonValues = hasLatLon ? dataModel.resolveColumnById(this, `lonValue`, processedData) : void 0; + this.topologyBounds = processedData.dataSources.get(this.id)?.data.reduce((current, _datum, datumIndex) => { + const feature = featureValues?.[datumIndex]; + const geometry = feature?.geometry; + if (geometry != null) { + current = geometryBbox(geometry, current); + } + if (latValues != null && lonValues != null) { + const lon = lonValues[datumIndex]; + const lat = latValues[datumIndex]; + current = LonLatBBox3.extend(current, lon, lat, lon, lat); + } + return current; + }, void 0); + if (sizeKey != null) { + const sizeIdx = dataModel.resolveProcessedDataIndexById(this, `sizeValue`); + const processedSize = processedData.domain.values[sizeIdx] ?? []; + sizeScale.domain = sizeDomain ?? processedSize; + } + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + this.animationState.transition("updateData"); + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount3(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelDatum(datum, labelValue, x, y, size, measurer22) { + if (labelValue == null) + return; + const { + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName, + label, + shape + } = this.properties; + if (labelKey == null || !label.enabled) + return; + const { placement } = label; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + sizeKey, + sizeName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const { width: width2, height: height2 } = measurer22.measureLines(String(labelText)); + const anchor = Marker4.anchor(shape); + return { + point: { x, y, size }, + label: { width: width2, height: height2, text: labelText }, + anchor, + placement + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, sizeScale, properties, scale: scale2 } = this; + const { idKey, latitudeKey, longitudeKey, sizeKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null || scale2 == null) + return; + const hasLatLon = latitudeKey != null && longitudeKey != null; + const idValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = idKey == null ? void 0 : dataModel.resolveColumnById(this, `featureValue`, processedData); + const latValues = hasLatLon ? dataModel.resolveColumnById(this, `latValue`, processedData) : void 0; + const lonValues = hasLatLon ? dataModel.resolveColumnById(this, `lonValue`, processedData) : void 0; + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const sizeValues = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const markerMaxSize = properties.maxSize ?? properties.size; + sizeScale.range = [Math.min(properties.size, markerMaxSize), markerMaxSize]; + const measurer22 = cachedTextMeasurer(label); + let projectedGeometries; + if (idValues != null && featureValues != null) { + projectedGeometries = /* @__PURE__ */ new Map(); + for (const [datumIndex] of processedData.dataSources.get(this.id)?.data.entries() ?? []) { + const id = idValues[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + const projectedGeometry = geometry != null && scale2 != null ? projectGeometry(geometry, scale2) : void 0; + if (id != null && projectedGeometry != null) { + projectedGeometries.set(id, projectedGeometry); + } + } + } + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues?.[datumIndex]; + const lonValue = lonValues?.[datumIndex]; + const latValue = latValues?.[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const sizeValue = sizeValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const size = sizeValue == null ? properties.size : sizeScale.convert(sizeValue, { clamp: true }); + const projectedGeometry = idValue == null ? void 0 : projectedGeometries?.get(idValue); + if (idValue != null && projectGeometry == null) { + missingGeometries.push(idValue); + } + if (lonValue != null && latValue != null) { + const [x, y] = scale2.convert([lonValue, latValue]); + const labelDatum = this.getLabelDatum(datum, labelValue, x, y, size, measurer22); + if (labelDatum) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: latitudeKey, + datum, + datumIndex, + index: -1, + idValue, + lonValue, + latValue, + labelValue, + sizeValue, + colorValue, + point: { x, y, size }, + midPoint: { x, y }, + legendItemName, + style: this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } else if (projectedGeometry != null) { + for (const [index, [x, y]] of markerPositions(projectedGeometry, 1).entries()) { + const labelDatum = this.getLabelDatum(datum, labelValue, x, y, size, measurer22); + if (labelDatum) { + labelData.push(labelDatum); + } + nodeData.push({ + series: this, + itemId: latitudeKey, + datum, + datumIndex, + index, + idValue, + lonValue, + latValue, + labelValue, + sizeValue, + colorValue, + point: { x, y, size }, + midPoint: { x, y }, + legendItemName, + style: this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false) + }); + } + } + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + logger_exports.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + checkScaleChange() { + if (this.previousScale === this.scale) + return false; + this.previousScale = this.scale; + return true; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + const scaleChange = this.checkScaleChange(); + const { markerSelection, highlightMarkerSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + this.markerSelection = this.updateMarkerSelection({ markerData: nodeData, markerSelection }); + this.updateMarkerNodes({ markerSelection, isHighlight: false, highlightedDatum }); + this.highlightMarkerSelection = this.updateMarkerSelection({ + markerData: highlightedDatum == null ? [] : [highlightedDatum], + markerSelection: highlightMarkerSelection + }); + this.updateMarkerNodes({ + markerSelection: highlightMarkerSelection, + isHighlight: true, + highlightedDatum + }); + if (scaleChange || resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updatePlacedLabelData(labelData) { + this.labelSelection = this.labelSelection.update(labelData, (text2) => { + text2.pointerEvents = module_support_exports.PointerEvents.None; + }); + this.updateLabelNodes({ labelSelection: this.labelSelection }); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, width: width2, height: height2, text: text2 }, datumIndex) => { + const style2 = getLabelStyles3(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style2; + label.visible = true; + label.x = x + width2 / 2; + label.y = y + height2 / 2; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style2); + }); + } + updateMarkerSelection(opts) { + const { markerData, markerSelection } = opts; + return markerSelection.update( + markerData, + void 0, + (datum) => createDatumId12(datum.index, datum.idValue, datum.lonValue, datum.latValue) + ); + } + getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, isHighlight) { + const { properties, colorScale, sizeScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults14(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + baseStyle.fill = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? baseStyle.fill; + } + if (sizeValue != null) { + baseStyle.size = sizeScale.convert(sizeValue, { clamp: true }); + } + let style2 = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId12(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style2); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style2 = mergeDefaults14(overrides, baseStyle); + } + } + return style2; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style2) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style2, + fill + }; + } + updateMarkerNodes(opts) { + const { markerSelection, isHighlight, highlightedDatum } = opts; + const fillBBox = getTopologyShapeFillBBox(this.scale); + markerSelection.each((marker, markerDatum) => { + const { datum, point } = markerDatum; + const style2 = this.getMarkerItemStyle(markerDatum, isHighlight); + marker.shape = style2.shape; + marker.size = style2.size; + applyShapeStyle11(marker, style2, fillBBox); + marker.x = point.x; + marker.y = point.y; + marker.scalingCenterX = point.x; + marker.scalingCenterY = point.y; + marker.zIndex = !isHighlight && highlightedDatum != null && datum === highlightedDatum.datum ? 1 : 0; + }); + } + isProcessedDataAnimatable() { + return true; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + this.ctx.animationManager.skipCurrentBatch(); + this.labelSelection.cleanup(); + this.markerSelection.cleanup(); + this.highlightMarkerSelection.cleanup(); + } + animateMarkers() { + const { animationManager } = this.ctx; + const fns = prepareMapMarkerAnimationFunctions(); + fromToMotion3(this.id, "markers", animationManager, [this.markerSelection, this.highlightMarkerSelection], fns); + } + getLabelData() { + if (!this.isLabelEnabled()) + return []; + return this.contextNodeData?.labelData ?? []; + } + pickNodeClosestDatum(p) { + const { x: x0, y: y0 } = p; + let minDistanceSquared = Infinity; + let minDatum; + for (const datum of this.contextNodeData?.nodeData ?? []) { + const { x, y, size } = datum.point; + const dx2 = Math.max(Math.abs(x - x0) - size, 0); + const dy2 = Math.max(Math.abs(y - y0) - size, 0); + const distanceSquared2 = dx2 * dx2 + dy2 * dy2; + if (distanceSquared2 < minDistanceSquared) { + minDistanceSquared = distanceSquared2; + minDatum = datum; + } + } + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { shape, fillOpacity, stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + let { fill } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + fill = this.colorScale.convert(colorValue); + } + return { + marker: { + shape, + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idName, idKey, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey ?? seriesId }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + title, + legendItemName, + tooltip + } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const sizeValue = sizeKey == null ? void 0 : dataModel.resolveColumnById(this, `sizeValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (sizeKey != null && sizeValue != null) { + const domain = dataModel.getDomain(this, `sizeValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: sizeValue, + datum, + seriesId, + legendItemName, + key: sizeKey, + source: "tooltip", + property: "size", + domain, + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(sizeValue) }); + } + if (colorKey != null && colorValue != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + let heading; + if (idKey != null) { + heading = dataModel.resolveColumnById(this, `idValue`, processedData)[datumIndex]; + } else if (latitudeKey != null && longitudeKey != null) { + const latValue = dataModel.resolveColumnById(this, `latValue`, processedData)[datumIndex]; + const lonValue = dataModel.resolveColumnById(this, `lonValue`, processedData)[datumIndex]; + heading = `${Math.abs(latValue).toFixed(4)}\xB0 ${latValue >= 0 ? "N" : "S"}, ${Math.abs(lonValue).toFixed(4)}\xB0 ${lonValue >= 0 ? "W" : "E"}`; + } + const format = this.getMarkerItemStyle({ datumIndex, datum, colorValue, sizeValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading, + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { + seriesId, + datum, + title, + idKey, + idName, + latitudeKey, + latitudeName, + longitudeKey, + longitudeName, + colorKey, + colorName, + sizeKey, + sizeName, + labelKey, + labelName, + ...format + } + ); + } + getFormattedMarkerStyle(markerDatum) { + const format = this.getMarkerItemStyle(markerDatum, false); + return { size: format.size, shape: format.shape }; + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds22(this, opts); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapMarkerSeries.className = "MapMarkerSeries"; +MapMarkerSeries.type = "map-marker"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs12, mapMarkerSeriesThemeableOptionsDef: mapMarkerSeriesThemeableOptionsDef2, without: without6 } = module_support_exports; +var mapMarkerSeriesOptionsDef = { + ...without6(commonSeriesOptionsDefs12, ["highlightStyle", "highlight"]), + ...mapMarkerSeriesThemeableOptionsDef2, + type: required(constant("map-marker")), + idKey: string, + latitudeKey: string, + longitudeKey: string, + sizeKey: string, + colorKey: string, + labelKey: string, + idName: string, + latitudeName: string, + longitudeName: string, + sizeName: string, + colorName: string, + labelName: string, + topology: geoJson, + topologyIdKey: string, + legendItemName: string, + title: string +}; +var MapMarkerModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-marker", + moduleFactory: (ctx) => new MapMarkerSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + shape: "circle", + maxSize: 30, + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $mapPalette: "fill" }, + ["gradient", module_support_exports.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS] + ] + }), + stroke: { $mapPalette: "stroke" }, + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(module_support_exports.SAFE_RANGE2_OPERATION) + ] + }, + fillOpacity: 0.5, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: applyMapPalette(module_support_exports.multiSeriesHighlightStyle()) + }, + tooltip: { + range: "exact" + } + } +}; +var MapMarkerSeriesModule = { + type: "series", + name: "map-marker", + chartType: "topology", + enterprise: true, + options: mapMarkerSeriesOptionsDef, + create: (ctx) => new MapMarkerSeries(ctx), + validate(options, optionsDefs2, path) { + const result = validate(options, optionsDefs2, path); + const { cleared, invalid } = result; + if (cleared?.idKey == null && (cleared?.latitudeKey == null || cleared?.longitudeKey == null)) { + const extendPath2 = (key) => path ? `${path}.${key}` : key; + const message = `Either \`${extendPath2("idKey")}\` or both \`${extendPath2("latitudeKey")}\` and \`${extendPath2("longitudeKey")}\` are required.`; + invalid.push(new ValidationError("required", message, null, path)); + } + return result; + } +}; +function preferredLabelCenter(polygons, { aspectRatio, precision }) { + const result = polygonPointSearch(polygons, precision, (p, cx, cy, stride) => { + const width2 = maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(p, cx, cy, aspectRatio); + const maxWidth2 = width2 + 2 * stride * aspectRatio; + const distance22 = width2 * Math.SQRT2; + const maxDistance = maxWidth2 * Math.SQRT2; + return { distance: distance22, maxDistance }; + }); + if (result == null) + return; + const { x, y, distance: distance2 } = result; + const maxWidth = distance2 / Math.SQRT2; + return { x, y, maxWidth }; +} +function maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(a, b, cx, cy, aspectRatio) { + const [ax, ay] = a; + const [bx, by] = b; + const positiveM = 1 / aspectRatio; + const abx = bx - ax; + const aby = by - ay; + const [topPointX, topPointY] = ay <= by ? a : b; + const [leftPointX, leftPointY] = ax <= bx ? a : b; + const [bottomPointX, bottomPointY] = ay <= by ? b : a; + const [rightPointX, rightPointY] = ax <= bx ? b : a; + let maxWidth = Infinity; + if (abx === 0) { + for (let i = 0; i <= 1; i += 1) { + const m = i === 0 ? positiveM : -positiveM; + const y = m * (ax - cx) + cy; + if (y >= topPointY && y <= bottomPointY) { + const height2 = Math.abs(cy - y) * 2; + const width2 = height2 * aspectRatio; + maxWidth = Math.min(maxWidth, width2); + } + } + } else { + const abm = aby / abx; + for (let i = 0; i <= 1; i += 1) { + const m = i === 0 ? positiveM : -positiveM; + const x = (abm * ax - ay - m * cx + cy) / (abm - m); + if (x >= leftPointX && x <= rightPointX) { + const width2 = Math.abs(cx - x) * 2; + maxWidth = Math.min(maxWidth, width2); + } + } + } + const positiveMRecip = aspectRatio; + const centerToTopMRecip = Math.abs((topPointX - cx) / (topPointY - cy)); + const centerToBottomMRecip = Math.abs((bottomPointX - cx) / (bottomPointY - cy)); + if (bottomPointY < cy && centerToBottomMRecip < positiveMRecip) { + const height2 = Math.abs(cy - bottomPointY) * 2; + const width2 = height2 * aspectRatio; + maxWidth = Math.min(maxWidth, width2); + } else if (topPointY > cy && centerToTopMRecip < positiveMRecip) { + const height2 = Math.abs(cy - topPointY) * 2; + const width2 = height2 * aspectRatio; + maxWidth = Math.min(maxWidth, width2); + } + const centerToLeftM = Math.abs((leftPointY - cy) / (leftPointX - cx)); + const centerToRightM = Math.abs((rightPointY - cy) / (rightPointX - cx)); + if (rightPointX < cx && centerToRightM < positiveM) { + const width2 = Math.abs(cx - rightPointX) * 2; + maxWidth = Math.min(maxWidth, width2); + } else if (leftPointX > cx && centerToLeftM < positiveM) { + const width2 = Math.abs(cx - leftPointX) * 2; + maxWidth = Math.min(maxWidth, width2); + } + return maxWidth; +} +function maxWidthOfRectConstrainedByCenterAndAspectRatioToPolygon(polygons, cx, cy, aspectRatio) { + let inside = false; + let minWidth = Infinity; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + let [x0, y0] = p0; + for (const p1 of polygon) { + const [x1, y1] = p1; + if (y1 > cy !== y0 > cy && cx < (x0 - x1) * (cy - y1) / (y0 - y1) + x1) { + inside = !inside; + } + const width2 = maxWidthOfRectConstrainedByCenterAndAspectRatioToLineSegment(p0, p1, cx, cy, aspectRatio); + minWidth = Math.min(minWidth, width2); + p0 = p1; + x0 = x1; + y0 = y1; + } + } + return (inside ? 1 : -1) * minWidth; +} +function applyX(into, cx, x) { + if (x >= cx) { + into.maxX = Math.min(into.maxX, x - cx); + } + if (x <= cx) { + into.minX = Math.max(into.minX, x - cx); + } +} +function xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(into, a, b, cx, cy, height2) { + const ry0 = cy - height2 / 2; + const ry1 = cy + height2 / 2; + const [ax, ay] = a; + const [bx, by] = b; + const abx = bx - ax; + const aby = by - ay; + const [leftPointX, leftPointY] = ax <= bx ? a : b; + const [rightPointX, rightPointY] = ax <= bx ? b : a; + if (abx !== 0) { + const abm = aby / abx; + for (let i = 0; i <= 1; i += 1) { + const y = i === 0 ? ry0 : ry1; + const x = (y - ay) / abm + ax; + if (x >= leftPointX && x <= rightPointX) { + applyX(into, cx, x); + } + } + } else if (Math.max(ry0, Math.min(ay, by)) <= Math.min(ry1, Math.max(ay, by))) { + applyX(into, cx, ax); + } + if (rightPointX < cx && rightPointY >= ry0 && rightPointY <= ry1) { + applyX(into, cx, rightPointX); + } else if (leftPointX > cx && leftPointY >= ry0 && leftPointY <= ry1) { + applyX(into, cx, leftPointX); + } + return into; +} +function maxWidthInPolygonForRectOfHeight(polygons, cx, cy, height2) { + const result = { + minX: -Infinity, + maxX: Infinity + }; + for (const polygon of polygons) { + let p0 = polygon.at(-1); + for (const p1 of polygon) { + xExtentsOfRectConstrainedByCenterAndHeightToLineSegment(result, p0, p1, cx, cy, height2); + p0 = p1; + } + } + const { minX, maxX } = result; + if (Number.isFinite(minX) && Number.isFinite(maxX)) { + return { x: cx + (minX + maxX) / 2, width: maxX - minX }; + } else { + return { x: cx, width: 0 }; + } +} +var { Property: Property73, SeriesProperties: SeriesProperties6, makeSeriesTooltip: makeSeriesTooltip15 } = module_support_exports; +var MapShapeSeriesProperties = class extends SeriesProperties6 { + constructor() { + super(...arguments); + this.topology = void 0; + this.idKey = ""; + this.idName = void 0; + this.topologyIdKey = "name"; + this.labelKey = void 0; + this.labelName = void 0; + this.colorRange = void 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.padding = 0; + this.label = new AutoSizedSecondaryLabel(); + this.tooltip = makeSeriesTooltip15(); + } + getStyle() { + const { fill, fillOpacity, stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "topology", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "title", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "legendItemName", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "idKey", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "idName", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "topologyIdKey", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "labelKey", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "labelName", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "colorKey", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "colorName", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "colorRange", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "fill", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "stroke", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "padding", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property73 +], MapShapeSeriesProperties.prototype, "tooltip", 2); +var { + getMissCount: getMissCount4, + createDatumId: createDatumId13, + SeriesNodePickMode: SeriesNodePickMode11, + valueProperty: valueProperty14, + ColorScale: ColorScale4, + Group: Group14, + Selection: Selection11, + Text: Text6, + PointerEvents: PointerEvents7, + applyShapeStyle: applyShapeStyle12, + getLabelStyles: getLabelStyles4, + mergeDefaults: mergeDefaults15 +} = module_support_exports; +var fixedScale = module_support_exports.MercatorScale.fixedScale(); +var MapShapeSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + propertyKeys: { + color: ["colorKey"], + label: ["labelKey"] + }, + propertyNames: { + color: ["colorName"], + label: ["labelName"] + }, + pickModes: [SeriesNodePickMode11.EXACT_SHAPE_MATCH, SeriesNodePickMode11.NEAREST_NODE] + }); + this.properties = new MapShapeSeriesProperties(); + this._chartTopology = void 0; + this.colorScale = new ColorScale4(); + this.itemGroup = this.contentGroup.appendChild(new Group14({ name: "itemGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group14({ name: "itemLabelGroup" })); + this.datumSelection = Selection11.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection11.select( + this.itemLabelGroup, + Text6 + ); + this.highlightDatumSelection = Selection11.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this.previousLabelLayouts = void 0; + this._previousDatumMidPoint = void 0; + this.itemLabelGroup.pointerEvents = PointerEvents7.None; + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get hasData() { + return super.hasData && this.topology != null; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [1, zIndex]; + this.highlightGroup.zIndex = [2, zIndex]; + return true; + } + isLabelEnabled() { + return this.properties.labelKey != null && this.properties.label.enabled; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 1; + geoGeometry.lineJoin = "round"; + return geoGeometry; + } + async processData(dataController) { + if (this.data == null) + return; + const { data, topology, colorScale } = this; + const { topologyIdKey, idKey, colorKey, labelKey, colorRange } = this.properties; + const featureById = /* @__PURE__ */ new Map(); + for (const feature of topology?.features.values() ?? []) { + const property = feature.properties?.[topologyIdKey]; + if (property == null || !containsType( + feature.geometry, + 1 + /* Polygon */ + )) + continue; + featureById.set(property, feature); + } + const colorScaleType = this.colorScale.type; + const mercatorScaleType = this.scale?.type; + const { dataModel, processedData } = await this.requestDataModel(dataController, data, { + props: [ + valueProperty14(idKey, mercatorScaleType, { id: "idValue", includeProperty: false }), + valueProperty14(idKey, mercatorScaleType, { + id: "featureValue", + includeProperty: false, + processor: () => (datum) => featureById.get(datum) + }), + ...labelKey ? [valueProperty14(labelKey, "category", { id: "labelValue" })] : [], + ...colorKey ? [valueProperty14(colorKey, colorScaleType, { id: "colorValue" })] : [] + ] + }); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + this.topologyBounds = featureValues.reduce((current, feature) => { + const geometry = feature?.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (colorRange != null && this.isColorScaleValid()) { + const colorKeyIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + colorScale.domain = processedData.domain.values[colorKeyIdx]; + colorScale.range = colorRange; + colorScale.update(); + } + if (topology == null) { + logger_exports.warnOnce(`no topology was provided for [MapShapeSeries]; nothing will be rendered.`); + } + } + isColorScaleValid() { + const { colorKey } = this.properties; + if (!colorKey) { + return false; + } + const { dataModel, processedData } = this; + if (!dataModel || !processedData) { + return false; + } + const colorIdx = dataModel.resolveProcessedDataIndexById(this, "colorValue"); + const dataCount = processedData.input.count; + const missCount = getMissCount4(this, processedData.defs.values[colorIdx].missing); + const colorDataMissing = dataCount === 0 || dataCount === missCount; + return !colorDataMissing; + } + getLabelLayout(datum, labelValue, measurer22, geometry, previousLabelLayout) { + if (labelValue == null || geometry == null) + return; + const { idKey, idName, colorKey, colorName, labelKey, labelName, padding: padding2, label } = this.properties; + if (labelKey == null || !label.enabled) + return; + const labelText = this.getLabelText( + labelValue, + datum, + labelKey, + "label", + [], + label, + { + value: labelValue, + datum, + idKey, + idName, + colorKey, + colorName, + labelKey, + labelName + } + ); + if (labelText == null) + return; + const baseSize = isArray(labelText) ? measureTextSegments(labelText, label) : measurer22.measureLines(String(labelText)); + const aspectRatio = (baseSize.width + 2 * padding2) / (baseSize.height + 2 * padding2); + if (previousLabelLayout?.geometry === geometry && previousLabelLayout?.labelText === labelText && previousLabelLayout?.aspectRatio === aspectRatio) { + return previousLabelLayout; + } + const fixedGeometry = projectGeometry(geometry, fixedScale); + const fixedPolygon = largestPolygon(fixedGeometry); + if (fixedPolygon == null) + return; + const labelPlacement = preferredLabelCenter(fixedPolygon, { + aspectRatio, + precision: 1e-3 + }); + if (labelPlacement == null) + return; + const { x, y, maxWidth } = labelPlacement; + return { geometry, labelText, aspectRatio, x, y, maxWidth, fixedPolygon }; + } + getLabelDatum(labelLayout, scaling) { + const { scale: scale2 } = this; + if (scale2 == null) + return; + const { padding: padding2, label } = this.properties; + const { labelText, aspectRatio, x: untruncatedX, y, maxWidth, fixedPolygon } = labelLayout; + const maxSizeWithoutTruncation = { + width: Math.ceil(maxWidth * scaling), + height: Math.ceil(maxWidth * scaling / aspectRatio), + meta: untruncatedX + }; + const labelFormatting = formatSingleLabel( + toPlainText(labelText), + label, + { padding: padding2 }, + (height2, allowTruncation) => { + if (!allowTruncation) { + return maxSizeWithoutTruncation; + } + const result = maxWidthInPolygonForRectOfHeight(fixedPolygon, untruncatedX, y, height2 / scaling); + return { + width: result.width * scaling, + height: height2, + meta: result.x + }; + } + ); + if (labelFormatting == null) + return; + const [{ text: text2, fontSize, lineHeight, width: width2 }, formattingX] = labelFormatting; + const x = width2 < maxSizeWithoutTruncation.width ? untruncatedX : formattingX; + const position = this.scale.convert(fixedScale.invert([x, y])); + return { + x: position[0], + y: position[1], + text: text2, + fontSize, + lineHeight + }; + } + createNodeData() { + const { id: seriesId, dataModel, processedData, properties, scale: scale2, previousLabelLayouts } = this; + const { idKey, colorKey, labelKey, label, legendItemName } = properties; + if (dataModel == null || processedData == null) + return; + const scaling = scale2 == null ? Number.NaN : (scale2.range[1][0] - scale2.range[0][0]) / scale2.bounds.width; + const idValues = dataModel.resolveColumnById(this, `idValue`, processedData); + const featureValues = dataModel.resolveColumnById( + this, + `featureValue`, + processedData + ); + const labelValues = labelKey == null ? void 0 : dataModel.resolveColumnById(this, `labelValue`, processedData); + const colorValues = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData); + const measurer22 = cachedTextMeasurer(label); + const labelLayouts = /* @__PURE__ */ new Map(); + this.previousLabelLayouts = labelLayouts; + const nodeData = []; + const labelData = []; + const missingGeometries = []; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const idValue = idValues[datumIndex]; + const colorValue = colorValues?.[datumIndex]; + const labelValue = labelValues?.[datumIndex]; + const geometry = featureValues[datumIndex]?.geometry ?? void 0; + if (geometry == null) { + missingGeometries.push(idValue); + } + const labelLayout = this.getLabelLayout( + datum, + labelValue, + measurer22, + geometry, + previousLabelLayouts?.get(idValue) + ); + if (labelLayout != null) { + labelLayouts.set(idValue, labelLayout); + } + const labelDatum = labelLayout != null && scale2 != null ? this.getLabelDatum(labelLayout, scaling) : void 0; + if (labelDatum != null) { + labelData.push(labelDatum); + } + const projectedGeometry = geometry != null && scale2 != null ? projectGeometry(geometry, scale2) : void 0; + nodeData.push({ + series: this, + itemId: idKey, + datum, + datumIndex, + idValue, + colorValue, + labelValue, + projectedGeometry, + legendItemName, + style: this.getItemStyle({ datum, datumIndex, colorValue }, false) + }); + } + const missingGeometriesCap = 10; + if (missingGeometries.length > missingGeometriesCap) { + const excessItems = missingGeometries.length - missingGeometriesCap; + missingGeometries.length = missingGeometriesCap; + missingGeometries.push(`(+${excessItems} more)`); + } + if (missingGeometries.length > 0) { + logger_exports.warnOnce(`some data items do not have matches in the provided topology`, missingGeometries); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection, labelSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + const { legendItemName } = this.properties; + const matchingLegendItemName = legendItemName != null && highlightedDatum?.datum == null && legendItemName === highlightedDatum?.legendItemName; + if (highlightedDatum != null && (highlightedDatum.series !== this && !matchingLegendItemName || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId13(datum.idValue)); + } + getItemStyle({ datumIndex, datum, colorValue }, isHighlight) { + const { properties, colorScale } = this; + const { colorRange, itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults15(highlightStyle, properties.getStyle()); + if (!isHighlight && colorValue != null) { + baseStyle.fill = this.isColorScaleValid() ? colorScale.convert(colorValue) : colorRange?.[0] ?? baseStyle.fill; + } + let style2 = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId13(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style2); + return this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + this.callWithContext(itemStyler, params) + ); + } + ); + if (overrides) { + style2 = mergeDefaults15(overrides, style2); + } + } + return style2; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style2) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style2, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const fillBBox = getTopologyShapeFillBBox(this.scale); + datumSelection.each((geoGeometry, nodeDatum) => { + const { projectedGeometry } = nodeDatum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + applyShapeStyle12(geoGeometry, nodeDatum.style, fillBBox); + }); + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, { x, y, text: text2, fontSize, lineHeight }, datumIndex) => { + const style2 = getLabelStyles4(this, void 0, properties, properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontFamily } = style2; + label.visible = true; + label.x = x; + label.y = y; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.lineHeight = lineHeight; + label.fontFamily = fontFamily; + label.textAlign = "center"; + label.textBaseline = "middle"; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.setBoxing(style2); + }); + } + resetAnimation() { + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared2 = node.distanceSquared(x, y); + if (distanceSquared2 < minDistanceSquared) { + minDistanceSquared = distanceSquared2; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + datumMidPoint(datum) { + const { _previousDatumMidPoint } = this; + if (_previousDatumMidPoint?.datum === datum) { + return _previousDatumMidPoint.point; + } + const projectedGeometry = datum.projectedGeometry; + const polygon = projectedGeometry == null ? void 0 : largestPolygon(projectedGeometry); + const center2 = polygon == null ? void 0 : polygonMarkerCenter(polygon, 2); + const point = center2 == null ? void 0 : { x: center2[0], y: center2[1] }; + this._previousDatumMidPoint = { datum, point }; + return point; + } + legendItemSymbol(datumIndex) { + const { dataModel, processedData, properties } = this; + const { fillOpacity, stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + let { fill } = properties; + if (datumIndex != null && this.isColorScaleValid()) { + const colorValues = dataModel.resolveColumnById(this, "colorValue", processedData); + const colorValue = colorValues[datumIndex]; + fill = this.colorScale.convert(colorValue); + } + return { + marker: { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { processedData, dataModel } = this; + if (processedData == null || dataModel == null) + return []; + const { id: seriesId, visible } = this; + const { title, legendItemName, idKey, idName, colorKey, colorRange, showInLegend } = this.properties; + if (legendType === "gradient" && colorKey != null && colorRange != null) { + const colorDomain = processedData.domain.values[dataModel.resolveProcessedDataIndexById(this, "colorValue")]; + const legendDatum = { + legendType: "gradient", + enabled: visible, + seriesId, + series: this.getFormatterContext("color"), + colorRange, + colorDomain + }; + return [legendDatum]; + } else if (legendType === "category") { + const legendDatum = { + legendType: "category", + id: seriesId, + itemId: seriesId, + seriesId, + enabled: visible, + label: { text: legendItemName ?? title ?? idName ?? idKey }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + }; + return [legendDatum]; + } else { + return []; + } + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + dataModel, + processedData, + properties, + ctx: { formatManager } + } = this; + const { idKey, idName, colorKey, colorName, labelKey, labelName, legendItemName, title, tooltip } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const idValue = dataModel.resolveColumnById(this, `idValue`, processedData)[datumIndex]; + const colorValue = colorKey == null ? void 0 : dataModel.resolveColumnById(this, `colorValue`, processedData)[datumIndex]; + const data = []; + if (this.isLabelEnabled() && labelKey != null && labelKey !== idKey) { + const labelValue = dataModel.resolveColumnById(this, `labelValue`, processedData)[datumIndex]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "category", + value: labelValue, + datum, + seriesId, + legendItemName, + key: labelKey, + source: "tooltip", + property: "label", + domain: [], + boundSeries: this.getFormatterContext("label") + }); + data.push({ label: labelName, fallbackLabel: labelKey, value: content ?? labelValue }); + } + if (colorValue != null) { + const domain = dataModel.getDomain(this, `colorValue`, "value", processedData); + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: colorValue, + datum, + seriesId, + legendItemName, + key: colorKey, + source: "tooltip", + property: "color", + domain, + boundSeries: this.getFormatterContext("color"), + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? String(colorValue) }); + } + const format = this.getItemStyle({ datum, datumIndex, colorValue }, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: idValue, + title: title ?? legendItemName, + symbol: this.legendItemSymbol(datumIndex), + data + }, + { seriesId, datum, title, idKey, idName, colorKey, colorName, labelKey, labelName, ...format } + ); + } + computeFocusBounds(opts) { + return findFocusedGeoGeometry(this, opts); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +MapShapeSeries.className = "MapShapeSeries"; +MapShapeSeries.type = "map-shape"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs13, mapShapeSeriesThemeableOptionsDef: mapShapeSeriesThemeableOptionsDef2, without: without7 } = module_support_exports; +var mapShapeSeriesOptionsDef = { + ...without7(commonSeriesOptionsDefs13, ["highlightStyle", "highlight"]), + ...mapShapeSeriesThemeableOptionsDef2, + type: required(constant("map-shape")), + idKey: required(string), + colorKey: string, + labelKey: string, + idName: string, + colorName: string, + labelName: string, + topology: geoJson, + topologyIdKey: string, + legendItemName: string, + title: string +}; +var MapShapeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-shape", + moduleFactory: (ctx) => new MapShapeSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $mapPalette: "fill" }, + ["gradient", module_support_exports.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS] + ] + }), + stroke: { $ref: "chartBackgroundColor" }, + colorRange: { + $if: [ + { $eq: [{ $mapPalette: "type" }, "inbuilt"] }, + { $mapPalette: "divergingColors" }, + applyMapPalette(module_support_exports.SAFE_RANGE2_OPERATION) + ] + }, + fillOpacity: 1, + strokeWidth: 1, + lineDash: [0], + lineDashOffset: 0, + padding: 2, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + color: { $ref: "chartBackgroundColor" }, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: "bold", + overflowStrategy: "hide" + }, + highlight: applyMapPalette(module_support_exports.multiSeriesHighlightStyle(true)) + }, + tooltip: { + range: "exact" + } + } +}; +var MapShapeSeriesModule = { + type: "series", + name: "map-shape", + chartType: "topology", + enterprise: true, + options: mapShapeSeriesOptionsDef, + create: (ctx) => new MapShapeSeries(ctx) +}; +var { Property: Property74, SeriesProperties: SeriesProperties7, makeSeriesTooltip: makeSeriesTooltip16 } = module_support_exports; +var MapShapeBackgroundSeriesProperties = class extends SeriesProperties7 { + constructor() { + super(...arguments); + this.topology = void 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeOpacity = 1; + this.strokeWidth = 0; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.tooltip = makeSeriesTooltip16(); + } +}; +__decorateClass2([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "topology", 2); +__decorateClass2([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "fill", 2); +__decorateClass2([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "stroke", 2); +__decorateClass2([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property74 +], MapShapeBackgroundSeriesProperties.prototype, "tooltip", 2); +var { createDatumId: createDatumId14, Selection: Selection12, Group: Group15, PointerEvents: PointerEvents8 } = module_support_exports; +var MapShapeBackgroundSeries = class extends TopologySeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [] + }); + this.properties = new MapShapeBackgroundSeriesProperties(); + this._chartTopology = void 0; + this.itemGroup = this.contentGroup.appendChild(new Group15({ name: "itemGroup" })); + this.datumSelection = Selection12.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.itemGroup.pointerEvents = PointerEvents8.None; + } + get topology() { + return this.properties.topology ?? this._chartTopology; + } + get focusable() { + return false; + } + setOptionsData() { + } + setChartData() { + } + getNodeData() { + return; + } + get hasData() { + return false; + } + renderToOffscreenCanvas() { + return true; + } + setChartTopology(topology) { + this._chartTopology = topology; + if (this.topology === topology) { + this.nodeDataRefresh = true; + } + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0, zIndex, 0]; + this.highlightGroup.zIndex = [0, zIndex, 1]; + return true; + } + nodeFactory() { + const geoGeometry = new GeoGeometry(); + geoGeometry.renderMode = 1; + geoGeometry.lineJoin = "round"; + geoGeometry.pointerEvents = PointerEvents8.None; + return geoGeometry; + } + processData() { + const { topology } = this; + this.topologyBounds = topology?.features.reduce((current, feature) => { + const geometry = feature.geometry; + if (geometry == null) + return current; + return geometryBbox(geometry, current); + }, void 0); + if (topology == null) { + logger_exports.warnOnce(`no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.`); + } + } + createNodeData() { + const { id: seriesId, topology, scale: scale2, properties } = this; + if (topology == null) + return; + const { fill, fillOpacity, stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = properties; + const nodeData = []; + const labelData = []; + for (const [index, feature] of topology.features.entries()) { + const { geometry } = feature; + const projectedGeometry = geometry != null && scale2 != null ? projectGeometry(geometry, scale2) : void 0; + if (projectedGeometry == null) + continue; + nodeData.push({ + series: this, + itemId: index, + datum: feature, + datumIndex: 0, + index, + projectedGeometry, + style: { fill, fillOpacity, stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset } + }); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update() { + const { datumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.labelGroup.visible = this.visible; + const { nodeData = [] } = this.contextNodeData ?? {}; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId14(datum.index)); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + datumSelection.each((geoGeometry, datum) => { + const { projectedGeometry } = datum; + if (projectedGeometry == null) { + geoGeometry.visible = false; + geoGeometry.projectedGeometry = void 0; + return; + } + geoGeometry.visible = true; + geoGeometry.projectedGeometry = projectedGeometry; + geoGeometry.setProperties(datum.style); + }); + } + resetAnimation() { + } + getLegendData() { + return []; + } + getTooltipContent(_seriesDatum) { + return; + } + pickFocus() { + return void 0; + } + computeFocusBounds(_opts) { + return void 0; + } + hasItemStylers() { + return false; + } +}; +MapShapeBackgroundSeries.className = "MapShapeBackgroundSeries"; +MapShapeBackgroundSeries.type = "map-shape-background"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs14, mapShapeBackgroundSeriesThemeableOptionsDef: mapShapeBackgroundSeriesThemeableOptionsDef2 } = module_support_exports; +var mapShapeBackgroundSeriesOptionsDef = { + ...mapShapeBackgroundSeriesThemeableOptionsDef2, + ...commonSeriesOptionsDefs14, + type: required(constant("map-shape-background")), + topology: geoJson +}; +var MapShapeBackgroundModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["topology"], + identifier: "map-shape-background", + moduleFactory: (ctx) => new MapShapeBackgroundSeries(ctx), + themeTemplate: { + ...MAP_THEME_DEFAULTS, + series: { + fill: applyMapPalette({ + $applySwitch: [ + { $path: "type" }, + { $path: ["/1", { $mapPalette: "fill" }, { $mapPalette: "hierarchyColors" }] }, + ["gradient", module_support_exports.FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_HIERARCHY_DEFAULTS] + ] + }), + stroke: { $ref: "chartBackgroundColor" }, + strokeWidth: 1 + } + } +}; +var MapShapeBackgroundSeriesModule = { + type: "series", + name: "map-shape-background", + chartType: "topology", + enterprise: true, + options: mapShapeBackgroundSeriesOptionsDef, + create: (ctx) => new MapShapeBackgroundSeries(ctx) +}; +var { createDatumId: createDatumId15, mergeDefaults: mergeDefaults16, toHighlightString: toHighlightString4 } = module_support_exports; +function makeStylerParams(series, highlighted, highlightStateEnum) { + const { id: seriesId } = series; + const { + angleKey, + cornerRadius, + fill, + fillOpacity, + lineDash, + lineDashOffset, + radiusKey, + stackGroup, + stroke: stroke22, + strokeOpacity, + strokeWidth + } = series.properties; + const highlightState = toHighlightString4(highlightStateEnum ?? module_support_exports.HighlightState.None); + return { + angleKey, + cornerRadius, + fill, + fillOpacity, + highlightState, + highlighted, + lineDash, + lineDashOffset, + radiusKey, + seriesId, + stackGroup, + stroke: stroke22, + strokeOpacity, + strokeWidth + }; +} +function getStyle(series, ignoreStylerCallback, highlighted, highlightState) { + const { styler } = series.properties; + let stylerResult = {}; + if (!ignoreStylerCallback && styler) { + const stylerParams = makeStylerParams(series, highlighted, highlightState); + stylerResult = series.ctx.optionsGraphService.resolvePartial( + ["series", `${series.declarationOrder}`], + series.cachedCallWithContext(styler, stylerParams) ?? {}, + { pick: false } + ) ?? {}; + } + return { + cornerRadius: stylerResult.cornerRadius ?? series.properties.cornerRadius, + fill: stylerResult.fill ?? series.properties.fill, + fillOpacity: stylerResult.fillOpacity ?? series.properties.fillOpacity, + lineDash: stylerResult.lineDash ?? series.properties.lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? series.properties.lineDashOffset, + stroke: stylerResult.stroke ?? series.properties.stroke, + strokeOpacity: stylerResult.strokeOpacity ?? series.properties.strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? series.properties.strokeWidth, + opacity: 1 + }; +} +function makeItemStylerParams(series, nodeDatum, isHighlight, style2) { + const { id: seriesId, properties } = series; + const { angleKey, radiusKey } = properties; + const activeHighlight = series.ctx.highlightManager?.getActiveHighlight(); + const highlightStateString = series.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = series.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum: nodeDatum.datum, + highlighted: isHighlight, + highlightState: highlightStateString, + angleKey, + radiusKey, + ...style2, + fill + }; +} +function getItemStyle(series, nodeDatum, isHighlight, highlightState) { + const { properties } = series; + const { itemStyler } = properties; + const highlightStyle = series.getHighlightStyle(isHighlight, nodeDatum?.datumIndex, highlightState); + const baseStyle = mergeDefaults16( + highlightStyle, + getStyle(series, nodeDatum === void 0, isHighlight, highlightState) + ); + let style2 = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = series.cachedDatumCallback( + createDatumId15(series.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = makeItemStylerParams(series, nodeDatum, isHighlight, style2); + return series.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style2 = mergeDefaults16(overrides, style2); + } + } + return style2; +} +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS2, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES2, + ChartAxisDirection: ChartAxisDirection28, + PolarAxis: PolarAxis2, + diff: diff6, + fixNumericExtent: fixNumericExtent8, + groupAccumulativeValueProperty: groupAccumulativeValueProperty22, + keyProperty: keyProperty9, + normaliseGroupTo: normaliseGroupTo2, + resetLabelFn: resetLabelFn5, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation5, + seriesLabelFadeOutAnimation: seriesLabelFadeOutAnimation2, + valueProperty: valueProperty15, + animationValidation: animationValidation7, + createDatumId: createDatumId16, + SeriesNodePickMode: SeriesNodePickMode12, + normalizeAngle360: normalizeAngle3605, + CategoryScale: CategoryScale3, + motion: motion6, + applyShapeStyle: applyShapeStyle13, + isGradientFill: isGradientFill22, + updateLabelNode: updateLabelNode6, + getItemStyles: getItemStyles3 +} = module_support_exports; +var RadialColumnSeriesNodeEvent = class extends module_support_exports.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadialColumnSeriesBase = class extends module_support_exports.PolarSeries { + constructor(moduleCtx, { + animationResetFns + }) { + super({ + moduleCtx, + categoryKey: "angleValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS2, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES2, + canHaveAxes: true, + pickModes: [SeriesNodePickMode12.NEAREST_NODE, SeriesNodePickMode12.EXACT_SHAPE_MATCH], + animationResetFns: { + ...animationResetFns, + label: resetLabelFn5 + } + }); + this.NodeEvent = RadialColumnSeriesNodeEvent; + this.groupScale = new CategoryScale3(); + this.circleCache = { r: 0, cx: 0, cy: 0 }; + } + get hasData() { + return this.getHasData("radiusValue-raw"); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection28.Angle) { + return dataModel.getDomain(this, "angleValue", "key", processedData); + } else { + const yExtent = dataModel.getDomain(this, "radiusValue-end", "value", processedData); + const fixedYExtent = Number.isFinite(yExtent[1] - yExtent[0]) ? [Math.min(yExtent[0], 0), Math.max(yExtent[1], 0)] : []; + return fixNumericExtent8(fixedYExtent); + } + } + async processData(dataController) { + const { angleKey, radiusKey, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const stackGroupId = this.getStackId(); + const stackGroupTrailingId = `${stackGroupId}-trailing`; + const extraProps = []; + if (isDefined(normalizedTo)) { + extraProps.push(normaliseGroupTo2([stackGroupId, stackGroupTrailingId], Math.abs(normalizedTo))); + } + if (animationEnabled && this.processedData) { + extraProps.push(diff6(this.id, this.processedData)); + } + if (animationEnabled) { + extraProps.push(animationValidation7()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const radiusScaleType = this.axes[ChartAxisDirection28.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection28.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty9(angleKey, angleScaleType, { id: "angleValue" }), + valueProperty15(radiusKey, radiusScaleType, { + id: "radiusValue-raw", + invalidValue: null, + ...visibleProps + }), + ...groupAccumulativeValueProperty22( + radiusKey, + "normal", + { + id: `radiusValue-end`, + rangeId: `radiusValue-range`, + invalidValue: null, + groupId: stackGroupId, + separateNegative: true, + ...visibleProps + }, + radiusScaleType + ), + ...groupAccumulativeValueProperty22( + radiusKey, + "trailing", + { + id: `radiusValue-start`, + invalidValue: null, + groupId: stackGroupTrailingId, + separateNegative: true, + ...visibleProps + }, + radiusScaleType + ), + ...extraProps + ], + groupByKeys: true, + groupByData: false + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (r !== cache.r || cx !== cache.cx || cy !== cache.cy) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + isRadiusAxisReversed() { + return this.axes[ChartAxisDirection28.Radius]?.isReversed(); + } + maybeRefreshNodeData() { + const circleChanged = this.didCircleChange(); + if (!circleChanged && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection28.Radius]; + return radiusAxis instanceof PolarAxis2 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + createNodeData() { + const { processedData, dataModel, groupScale } = this; + if (!dataModel || !processedData || processedData.type !== "grouped") + return; + const angleAxis = this.axes[ChartAxisDirection28.Angle]; + const radiusAxis = this.axes[ChartAxisDirection28.Radius]; + const angleScale = angleAxis?.scale; + const radiusScale = radiusAxis?.scale; + if (!angleScale || !radiusScale) { + return; + } + const angleValues = dataModel.resolveKeysById(this, `angleValue`, processedData); + const radiusStartValues = dataModel.resolveColumnById(this, `radiusValue-start`, processedData); + const radiusEndValues = dataModel.resolveColumnById(this, `radiusValue-end`, processedData); + const radiusRawValues = dataModel.resolveColumnById(this, `radiusValue-raw`, processedData); + const radiusRangeIndex = dataModel.resolveProcessedDataIndexById(this, `radiusValue-range`); + let groupPaddingInner = 0; + let groupPaddingOuter = 0; + if (angleAxis instanceof AngleCategoryAxis) { + groupPaddingInner = angleAxis.groupPaddingInner; + groupPaddingOuter = angleAxis.paddingInner; + } + const groupAngleStep = angleScale.bandwidth ?? 0; + const paddedGroupAngleStep = groupAngleStep * (1 - groupPaddingOuter); + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + groupScale.domain = Array.from({ length: visibleGroupCount }).map((_, i) => String(i)); + groupScale.range = [-paddedGroupAngleStep / 2, paddedGroupAngleStep / 2]; + groupScale.paddingInner = visibleGroupCount > 1 ? groupPaddingInner : 0; + const radiusAxisReversed = this.isRadiusAxisReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const axisTotalRadius = axisOuterRadius + axisInnerRadius; + const { angleKey, radiusKey, angleName, radiusName, legendItemName, label } = this.properties; + const radiusDomain = this.getSeriesDomain(ChartAxisDirection28.Radius); + const getLabelNodeDatum = (datum, radiusDatum, x, y) => { + const labelText = this.getLabelText( + radiusDatum, + datum, + radiusKey, + "radius", + radiusDomain, + label, + { value: radiusDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + return { x, y, text: labelText, textAlign: "center", textBaseline: "middle" }; + } + }; + const nodeData = []; + const styles = getItemStyles3( + (nodeDatum, isHighlight, highlightState) => getItemStyle(this, nodeDatum, isHighlight, highlightState) + ); + const context = { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + if (!this.visible) + return context; + const { dataSources } = processedData; + const rawData = dataSources.get(this.id)?.data ?? []; + for (const { datumIndex, group } of dataModel.forEachGroupDatum(this, processedData)) { + const datum = rawData[datumIndex]; + const angleDatum = angleValues[datumIndex]; + if (angleDatum == null) + return; + const radiusDatum = radiusRawValues[datumIndex]; + const isPositive = radiusDatum >= 0 && !Object.is(radiusDatum, -0); + const innerRadiusDatum = radiusStartValues[datumIndex]; + const outerRadiusDatum = radiusEndValues[datumIndex]; + const radiusRange = group.aggregation[radiusRangeIndex][isPositive ? 1 : 0] ?? 0; + const negative = isPositive === radiusAxisReversed; + if (innerRadiusDatum === void 0 || outerRadiusDatum === void 0) + return; + let startAngle; + let endAngle; + if (rawData.length === 1) { + startAngle = -0.5 * Math.PI; + endAngle = 1.5 * Math.PI; + } else { + const groupAngle = angleScale.convert(angleDatum); + startAngle = normalizeAngle3605(groupAngle + groupScale.convert(String(groupIndex))); + endAngle = normalizeAngle3605(startAngle + groupScale.bandwidth); + } + const angle2 = startAngle + groupScale.bandwidth / 2; + const innerRadius = axisTotalRadius - radiusScale.convert(innerRadiusDatum); + const outerRadius = axisTotalRadius - radiusScale.convert(outerRadiusDatum); + const midRadius = (innerRadius + outerRadius) / 2; + const stackInnerRadius = axisTotalRadius - radiusScale.convert(0); + const stackOuterRadius = axisTotalRadius - radiusScale.convert(radiusRange); + const x = Math.cos(angle2) * midRadius; + const y = Math.sin(angle2) * midRadius; + const labelNodeDatum = this.properties.label.enabled ? getLabelNodeDatum(datum, radiusDatum, x, y) : void 0; + const columnWidth = this.getColumnWidth(startAngle, endAngle); + nodeData.push({ + series: this, + datum, + datumIndex, + point: { x, y, size: 0 }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + negative, + innerRadius, + outerRadius, + stackInnerRadius, + stackOuterRadius, + startAngle, + endAngle, + midAngle: angle2, + axisInnerRadius, + axisOuterRadius, + columnWidth, + index: datumIndex + }); + } + return { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + } + getColumnWidth(_startAngle, _endAngle) { + return Number.NaN; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updateSectorSelection(this.itemSelection, false); + this.updateSectorSelection(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateSectorSelection(selection, isHighlight) { + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + let selectionData = []; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + if (isHighlight) { + if (activeHighlight?.datum && activeHighlight.series === this) { + selectionData.push(activeHighlight); + } + } else { + selectionData = this.nodeData; + } + const radiusAxisReversed = this.isRadiusAxisReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const fillBBox = this.getShapeFillBBox(); + const hasItemStylers = this.hasItemStylers(); + selection.update(selectionData, void 0, (datum) => this.getDatumId(datum)).each((node, nodeDatum) => { + const { midPoint } = nodeDatum; + if (hasItemStylers) { + const highlightState = this.getHighlightState(activeHighlight, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = getItemStyle(this, nodeDatum, isHighlight, highlightState); + } + const style2 = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + const fill = style2.fill; + const itemBounds = isGradientFill22(fill) && fill.bounds === "item"; + const fillParams = itemBounds ? { centerX: midPoint?.x ?? 0, centerY: midPoint?.y ?? 0 } : { centerX: 0, centerY: 0, innerRadius: axisInnerRadius, outerRadius: axisOuterRadius }; + this.updateItemPath(node, nodeDatum, isHighlight); + applyShapeStyle13(node, style2, fillBBox, fillParams); + node.cornerRadius = style2.cornerRadius ?? 0; + node.lineJoin = "round"; + }); + } + updateLabels() { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + updateLabelNode6(this, node, this.properties, this.properties.label, datum.label, false, activeHighlight); + node.fillOpacity = this.getHighlightStyle(false, datum.datumIndex).opacity ?? 1; + }); + } + animateEmptyUpdateReady() { + const { labelSelection } = this; + const fns = this.getColumnTransitionFunctions(); + motion6.fromToMotion(this.id, "datums", this.ctx.animationManager, [this.itemSelection], fns); + seriesLabelFadeInAnimation5(this, "labels", this.ctx.animationManager, labelSelection); + } + animateClearingUpdateEmpty() { + const { itemSelection } = this; + const { animationManager } = this.ctx; + const fns = this.getColumnTransitionFunctions(); + motion6.fromToMotion(this.id, "datums", animationManager, [itemSelection], fns); + seriesLabelFadeOutAnimation2(this, "labels", animationManager, this.labelSelection); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip } = properties; + const angleAxis = axes[ChartAxisDirection28.Angle]; + const radiusAxis = axes[ChartAxisDirection28.Radius]; + const nodeDatum = this.nodeData?.[datumIndex]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis || !nodeDatum) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const angleValue = dataModel.resolveKeysById(this, `angleValue`, processedData)[datumIndex]; + const radiusValue = dataModel.resolveColumnById(this, `radiusValue-raw`, processedData)[datumIndex]; + if (angleValue == null) + return; + const format = getItemStyle(this, nodeDatum, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: radiusName, + fallbackLabel: radiusKey, + value: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + angleName, + radiusKey, + radiusName, + legendItemName, + ...format + } + ); + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.itemSelection.nodes()); + } + legendItemSymbol() { + const { fill, stroke: stroke22, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = getStyle( + this, + false, + false, + module_support_exports.HighlightState.None + ); + const markerStyle = { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke22 ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + if (module_support_exports.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: markerStyle + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { radiusKey, radiusName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: radiusKey, + seriesId, + enabled: visible, + label: { + text: legendItemName ?? radiusName ?? radiusKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getDatumId(datum) { + return createDatumId16(datum.angleValue); + } + computeLabelsBBox() { + return null; + } +}; +var { SeriesProperties: SeriesProperties8, makeSeriesTooltip: makeSeriesTooltip17, Property: Property75, Label: Label12 } = module_support_exports; +var RadialColumnSeriesBaseProperties = class extends SeriesProperties8 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.label = new Label12(); + this.tooltip = makeSeriesTooltip17(); + } + getStyle() { + const { fill, fillOpacity, stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "angleKey", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "angleName", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "radiusKey", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "radiusName", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "legendItemName", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "fill", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "stroke", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "cornerRadius", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "styler", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "rotation", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "stackGroup", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "normalizedTo", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "label", 2); +__decorateClass2([ + Property75 +], RadialColumnSeriesBaseProperties.prototype, "tooltip", 2); +var { motion: motion7 } = module_support_exports; +function createAngleMotionCalculator() { + const angles = { + startAngle: /* @__PURE__ */ new Map(), + endAngle: /* @__PURE__ */ new Map() + }; + const angleKeys = ["startAngle", "endAngle"]; + const calculate = (node, datum, status) => { + for (const key of angleKeys) { + const map = angles[key]; + let from22 = (status === "removed" || status === "updated" ? node : datum)[key]; + let to2 = (status === "removed" ? node : datum)[key]; + if (Number.isNaN(to2)) { + to2 = node.previousDatum?.[key] ?? Number.NaN; + } + const diff8 = from22 - to2; + if (Math.abs(diff8) > Math.PI) { + from22 -= Math.sign(diff8) * 2 * Math.PI; + } + map.set(datum, { from: from22, to: to2 }); + } + }; + const getAngles = (datum, fromToKey) => { + return { + startAngle: angles.startAngle.get(datum)[fromToKey], + endAngle: angles.endAngle.get(datum)[fromToKey] + }; + }; + const from3 = (datum) => getAngles(datum, "from"); + const to = (datum) => getAngles(datum, "to"); + return { calculate, from: from3, to }; +} +function fixRadialColumnAnimationStatus(node, datum, status) { + if (status === "updated") { + if (node.previousDatum == null || Number.isNaN(node.previousDatum.startAngle) || Number.isNaN(node.previousDatum.endAngle)) { + return "added"; + } + if (Number.isNaN(datum.startAngle) || Number.isNaN(datum.endAngle)) { + return "removed"; + } + } + if (status === "added" && node.previousDatum != null) { + return "updated"; + } + return status; +} +function prepareRadialColumnAnimationFunctions(axisZeroRadius) { + const angles = createAngleMotionCalculator(); + const fromFn = (node, datum, status) => { + status = fixRadialColumnAnimationStatus(node, datum, status); + angles.calculate(node, datum, status); + const { startAngle, endAngle } = angles.from(datum); + let innerRadius; + let outerRadius; + let columnWidth; + let axisInnerRadius; + let axisOuterRadius; + if (status === "removed" || status === "updated") { + innerRadius = node.innerRadius; + outerRadius = node.outerRadius; + columnWidth = node.columnWidth; + axisInnerRadius = node.axisInnerRadius; + axisOuterRadius = node.axisOuterRadius; + } else { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + columnWidth = datum.columnWidth; + axisInnerRadius = datum.axisInnerRadius; + axisOuterRadius = datum.axisOuterRadius; + } + const phase = motion7.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { + innerRadius, + outerRadius, + columnWidth, + axisInnerRadius, + axisOuterRadius, + startAngle, + endAngle, + phase + }; + }; + const toFn = (node, datum, status) => { + const { startAngle, endAngle } = angles.to(datum); + let innerRadius; + let outerRadius; + let columnWidth; + let axisInnerRadius; + let axisOuterRadius; + if (status === "removed") { + innerRadius = node.innerRadius; + outerRadius = node.innerRadius; + columnWidth = node.columnWidth; + axisInnerRadius = node.axisInnerRadius; + axisOuterRadius = node.axisOuterRadius; + } else { + innerRadius = Number.isNaN(datum.innerRadius) ? axisZeroRadius : datum.innerRadius; + outerRadius = Number.isNaN(datum.outerRadius) ? axisZeroRadius : datum.outerRadius; + columnWidth = Number.isNaN(datum.columnWidth) ? node.columnWidth : datum.columnWidth; + axisInnerRadius = datum.axisInnerRadius; + axisOuterRadius = datum.axisOuterRadius; + } + return { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle }; + }; + return { toFn, fromFn }; +} +function resetRadialColumnSelectionFn(_node, { + innerRadius, + outerRadius, + columnWidth, + axisInnerRadius, + axisOuterRadius, + startAngle, + endAngle +}) { + return { innerRadius, outerRadius, columnWidth, axisInnerRadius, axisOuterRadius, startAngle, endAngle }; +} +var { SectorBox: SectorBox2, motion: motion8 } = module_support_exports; +function getRadii(datum) { + const { negative, innerRadius, outerRadius, stackInnerRadius, stackOuterRadius } = datum; + return { + innerRadius: negative ? stackOuterRadius : stackInnerRadius, + outerRadius: negative ? stackInnerRadius : stackOuterRadius, + clipInnerRadius: negative ? outerRadius : innerRadius, + clipOuterRadius: negative ? innerRadius : outerRadius + }; +} +function prepareNightingaleAnimationFunctions(axisZeroRadius) { + const angles = createAngleMotionCalculator(); + const fromFn = (sect, datum, status) => { + status = fixRadialColumnAnimationStatus(sect, datum, status); + angles.calculate(sect, datum, status); + const { startAngle, endAngle } = angles.from(datum); + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed" || status === "updated") { + innerRadius = sect.innerRadius; + outerRadius = sect.outerRadius; + clipSector = sect.clipSector; + } else { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + } + clipSector ?? (clipSector = new SectorBox2(startAngle, endAngle, innerRadius, outerRadius)); + const phase = motion8.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { innerRadius, outerRadius, startAngle, endAngle, clipSector, phase }; + }; + const toFn = (_sect, datum, status) => { + const { startAngle, endAngle } = angles.to(datum); + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed") { + innerRadius = axisZeroRadius; + outerRadius = axisZeroRadius; + clipSector = new SectorBox2(startAngle, endAngle, innerRadius, outerRadius); + } else { + let clipInnerRadius, clipOuterRadius; + ({ innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum)); + if (Number.isNaN(innerRadius)) + innerRadius = axisZeroRadius; + if (Number.isNaN(outerRadius)) + outerRadius = axisZeroRadius; + if (Number.isNaN(clipInnerRadius)) + clipInnerRadius = axisZeroRadius; + if (Number.isNaN(clipOuterRadius)) + clipOuterRadius = axisZeroRadius; + clipSector = new SectorBox2(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + } + return { innerRadius, outerRadius, startAngle, endAngle, clipSector }; + }; + return { toFn, fromFn }; +} +function resetNightingaleSelectionFn(_sect, datum) { + const { startAngle, endAngle } = datum; + const { innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum); + const clipSector = new SectorBox2(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + return { innerRadius, outerRadius, startAngle, endAngle, clipSector }; +} +var { Sector: Sector4, SectorBox: SectorBox22, PolarZIndexMap: PolarZIndexMap2 } = module_support_exports; +var NightingaleSeries = class extends RadialColumnSeriesBase { + // TODO: Enable once the options contract has been revisited + // @TempValidate + // sectorSpacing = 1; + constructor(moduleCtx) { + super(moduleCtx, { animationResetFns: { item: resetNightingaleSelectionFn } }); + this.properties = new RadialColumnSeriesBaseProperties(); + } + setZIndex(zIndex) { + super.setZIndex(zIndex); + this.contentGroup.zIndex = [0, PolarZIndexMap2.FOREGROUND, zIndex]; + this.highlightGroup.zIndex = [0, PolarZIndexMap2.HIGHLIGHT, zIndex]; + this.labelGroup.zIndex = [0, PolarZIndexMap2.LABEL, zIndex]; + return true; + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `nightingale-stack-${groupIndex}-yValues`; + } + nodeFactory() { + return new Sector4(); + } + updateItemPath(node, datum, highlight5) { + const { negative } = datum; + node.centerX = 0; + node.centerY = 0; + node.startOuterCornerRadius = negative ? 0 : this.properties.cornerRadius; + node.endOuterCornerRadius = negative ? 0 : this.properties.cornerRadius; + node.startInnerCornerRadius = negative ? this.properties.cornerRadius : 0; + node.endInnerCornerRadius = negative ? this.properties.cornerRadius : 0; + if (highlight5) { + const { startAngle, endAngle } = datum; + const { innerRadius, outerRadius, clipInnerRadius, clipOuterRadius } = getRadii(datum); + node.innerRadius = innerRadius; + node.outerRadius = outerRadius; + node.startAngle = startAngle; + node.endAngle = endAngle; + node.clipSector = new SectorBox22(startAngle, endAngle, clipInnerRadius, clipOuterRadius); + } + } + getColumnTransitionFunctions() { + const axisZeroRadius = this.isRadiusAxisReversed() ? this.radius : this.getAxisInnerRadius(); + return prepareNightingaleAnimationFunctions(axisZeroRadius); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +NightingaleSeries.className = "NightingaleSeries"; +NightingaleSeries.type = "nightingale"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs15, nightingaleSeriesThemeableOptionsDef: nightingaleSeriesThemeableOptionsDef2 } = module_support_exports; +var nightingaleSeriesOptionsDef = { + ...commonSeriesOptionsDefs15, + ...nightingaleSeriesThemeableOptionsDef2, + type: required(constant("nightingale")), + angleKey: required(string), + radiusKey: required(string), + angleName: string, + radiusName: string, + legendItemName: string, + grouped: boolean, + stacked: boolean, + stackGroup: string, + normalizedTo: number +}; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE2, POLAR_AXIS_SHAPE: POLAR_AXIS_SHAPE2 }, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS: FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS4, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS22 +} = module_support_exports; +var NIGHTINGALE_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_SERIES_DEFAULTS2], + ["image", FILL_IMAGE_DEFAULTS4], + ["pattern", FILL_PATTERN_DEFAULTS22] + ] + }, + stroke: { + $if: [{ $eq: [{ $palette: "type" }, "inbuilt"] }, { $ref: "chartBackgroundColor" }, { $palette: "stroke" }] + }, + strokeWidth: 1, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: module_support_exports.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE2.ANGLE_CATEGORY]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE2.CIRCLE }, + groupPaddingInner: 0, + paddingInner: 0, + label: { + spacing: 10 + } + }, + [POLAR_AXIS_TYPE2.RADIUS_NUMBER]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE2.CIRCLE } + } + } +}; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE22 } +} = module_support_exports; +var NightingaleModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "nightingale", + moduleFactory: (ctx) => new NightingaleSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE22.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE22.RADIUS_NUMBER }], + themeTemplate: NIGHTINGALE_SERIES_THEME, + stackable: true, + groupable: true, + stackedByDefault: true +}; +var NightingaleSeriesModule = { + type: "series", + name: "nightingale", + chartType: "polar", + enterprise: true, + options: nightingaleSeriesOptionsDef, + create: (ctx) => new NightingaleSeries(ctx) +}; +var { SeriesProperties: SeriesProperties9, makeSeriesTooltip: makeSeriesTooltip18, Property: Property76, Label: Label13, DropShadow: DropShadow5 } = module_support_exports; +var PyramidSeriesLabel = class extends Label13 { +}; +var PyramidSeriesStageLabel = class extends Label13 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass2([ + Property76 +], PyramidSeriesStageLabel.prototype, "spacing", 2); +__decorateClass2([ + Property76 +], PyramidSeriesStageLabel.prototype, "placement", 2); +var PyramidProperties = class extends SeriesProperties9 { + constructor() { + super(...arguments); + this.fills = []; + this.fillOpacity = 1; + this.strokes = []; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.direction = "vertical"; + this.reverse = void 0; + this.spacing = 0; + this.aspectRatio = void 0; + this.shadow = new DropShadow5().set({ enabled: false }); + this.label = new PyramidSeriesLabel(); + this.stageLabel = new PyramidSeriesStageLabel(); + this.tooltip = makeSeriesTooltip18(); + } + getStyle(index = 0) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity, lineDash, lineDashOffset } = this; + return { + fill: fills[index % fills.length], + fillOpacity, + stroke: strokes[index % strokes.length], + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "stageKey", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "valueKey", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "fills", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "strokes", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "direction", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "reverse", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "spacing", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "aspectRatio", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "shadow", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "label", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "stageLabel", 2); +__decorateClass2([ + Property76 +], PyramidProperties.prototype, "tooltip", 2); +function applyPyramidDatum(connector, { x, y, top, right, bottom, left }) { + connector.x0 = x - top / 2; + connector.x1 = x + top / 2; + connector.x2 = x + bottom / 2; + connector.x3 = x - bottom / 2; + connector.y0 = y - left / 2; + connector.y1 = y - right / 2; + connector.y2 = y + right / 2; + connector.y3 = y + left / 2; +} +function preparePyramidAnimationFunctions(direction) { + const fromFn = (_connector, datum) => { + const { x, y } = datum; + let { top, right, bottom, left } = datum; + if (direction === "vertical") { + top = 0; + bottom = 0; + } else { + left = 0; + right = 0; + } + return { x, y, top, right, bottom, left }; + }; + const toFn = (_connector, datum) => { + const { x, y, top, right, bottom, left } = datum; + return { x, y, top, right, bottom, left }; + }; + const applyFn = applyPyramidDatum; + return { fromFn, toFn, applyFn }; +} +var { + StateMachine: StateMachine14, + valueProperty: valueProperty16, + SeriesNodePickMode: SeriesNodePickMode13, + createDatumId: createDatumId17, + BBox: BBox222, + Group: Group16, + Selection: Selection13, + Text: Text7, + PointerEvents: PointerEvents9, + applyShapeStyle: applyShapeStyle14, + mergeDefaults: mergeDefaults17, + fromToMotion: fromToMotion4, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation6, + getLabelStyles: getLabelStyles5 +} = module_support_exports; +var PyramidSeries = class extends module_support_exports.DataModelSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: void 0, + pickModes: [SeriesNodePickMode13.EXACT_SHAPE_MATCH, SeriesNodePickMode13.NEAREST_NODE] + }); + this.properties = new PyramidProperties(); + this.itemGroup = this.contentGroup.appendChild(new Group16({ name: "itemGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group16({ name: "itemLabelGroup" })); + this.stageLabelGroup = this.contentGroup.appendChild(new Group16({ name: "stageLabelGroup" })); + this.datumSelection = Selection13.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.labelSelection = Selection13.select( + this.itemLabelGroup, + Text7 + ); + this.stageLabelSelection = Selection13.select(this.stageLabelGroup, Text7); + this.highlightDatumSelection = Selection13.select( + this.highlightGroup, + () => this.nodeFactory() + ); + this.animationState = new StateMachine14( + "empty", + { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + clear: "empty", + reset: "empty", + skip: "ready" + } + }, + () => this.checkProcessedDataAnimatable() + ); + this.itemLabelGroup.pointerEvents = PointerEvents9.None; + this.stageLabelGroup.pointerEvents = PointerEvents9.None; + } + addChartEventListeners() { + this.cleanup.register(this.ctx.eventsHub.on("legend:item-click", (event) => this.onLegendItemClick(event))); + } + nodeFactory() { + return new FunnelConnector(); + } + getNodeData() { + return this.contextNodeData?.nodeData; + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + async processData(dataController) { + if (this.data == null) + return; + const { + id: seriesId, + visible, + ctx: { legendManager } + } = this; + const { stageKey, valueKey } = this.properties; + const xScaleType = "category"; + const yScaleType = "number"; + const validation = (_value, _datum, index) => visible && legendManager.getItemEnabled({ seriesId, itemId: index }); + const visibleProps = this.visible ? {} : { forceValue: 0 }; + await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty16(stageKey, xScaleType, { id: "xValue" }), + valueProperty16(valueKey, yScaleType, { id: `yValue`, ...visibleProps, validation, invalidValue: 0 }) + ] + }); + } + createNodeData() { + const { + id: seriesId, + dataModel, + processedData, + properties, + visible, + ctx: { legendManager } + } = this; + const { + stageKey, + valueKey, + direction, + reverse = direction === "horizontal", + spacing, + aspectRatio, + label, + stageLabel + } = properties; + if (dataModel == null || processedData == null) + return; + const horizontal = direction === "horizontal"; + const xValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const yValues = dataModel.resolveColumnById(this, `yValue`, processedData); + const xDomain = dataModel.getDomain(this, "xValue", "value", processedData); + const yDomain = dataModel.getDomain(this, "yValue", "value", processedData); + const textMeasurer = cachedTextMeasurer(stageLabel); + let textAlign; + let textBaseline; + if (horizontal) { + textAlign = "center"; + textBaseline = stageLabel.placement === "before" ? "bottom" : "top"; + } else { + textAlign = stageLabel.placement === "after" ? "left" : "right"; + textBaseline = "middle"; + } + const stageLabelData = stageLabel.enabled ? [] : void 0; + let maxLabelWidth = 0; + let maxLabelHeight = 0; + let yTotal = 0; + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + const enabled = visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + yTotal += yValue; + if (stageLabelData == null) + continue; + const text2 = this.getLabelText( + xValue2, + datum, + stageKey, + "x", + xDomain, + this.properties.stageLabel, + { datum, value: yValue, stageKey, valueKey } + ); + const { width: width2, height: height2 } = isArray(text2) ? measureTextSegments(text2, label) : textMeasurer.measureLines(text2); + maxLabelWidth = Math.max(maxLabelWidth, width2); + maxLabelHeight = Math.max(maxLabelHeight, height2); + stageLabelData.push({ + x: Number.NaN, + y: Number.NaN, + text: text2, + textAlign, + textBaseline, + visible: enabled + }); + } + const seriesRectWidth = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const seriesRectHeight = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const totalSpacing = spacing * (processedData.input.count - 1); + let bounds; + if (horizontal) { + const verticalInset = maxLabelHeight + stageLabel.spacing; + bounds = new BBox222( + 0, + stageLabel.placement === "before" ? verticalInset : 0, + seriesRectWidth, + seriesRectHeight - verticalInset + ); + } else { + const horizontalInset = maxLabelWidth + stageLabel.spacing; + bounds = new BBox222( + stageLabel.placement === "after" ? 0 : horizontalInset, + 0, + seriesRectWidth - horizontalInset, + seriesRectHeight + ); + } + if (aspectRatio != null && aspectRatio !== 0) { + const directionalAspectRatio = direction === "horizontal" ? 1 / aspectRatio : aspectRatio; + const constrainedWidth = Math.min(bounds.width, bounds.height * directionalAspectRatio); + const constrainedHeight = constrainedWidth / directionalAspectRatio; + bounds = new BBox222( + bounds.x + (bounds.width - constrainedWidth) / 2, + bounds.y + (bounds.height - constrainedHeight) / 2, + constrainedWidth, + constrainedHeight + ); + } + let labelX; + let labelY; + if (horizontal) { + labelY = stageLabel.placement === "before" ? bounds.y - stageLabel.spacing : bounds.y + bounds.height + stageLabel.spacing; + } else { + labelX = stageLabel.placement === "after" ? bounds.x + bounds.width + stageLabel.spacing : bounds.x - stageLabel.spacing; + } + const availableWidth = bounds.width - (horizontal ? totalSpacing : 0); + const availableHeight = bounds.height - (horizontal ? 0 : totalSpacing); + if (availableWidth < 0 || availableHeight < 0) + return; + const nodeData = []; + const labelData = []; + let yStart = 0; + for (const [datumIndex, datum] of rawData.entries()) { + const xValue2 = xValues[datumIndex]; + const yValue = yValues[datumIndex]; + const enabled = visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }); + const yEnd = yStart + yValue; + const yMidRatio = (yStart + yEnd) / (2 * yTotal); + const yRangeRatio = (yEnd - yStart) / yTotal; + const xOffset = horizontal ? availableWidth * yMidRatio + spacing * datumIndex : availableWidth * 0.5; + const yOffset = horizontal ? availableHeight * 0.5 : availableHeight * yMidRatio + spacing * datumIndex; + const x = bounds.x + xOffset; + const y = bounds.y + yOffset; + if (stageLabelData != null) { + const stageLabelDatum = stageLabelData[datumIndex]; + stageLabelDatum.x = labelX ?? x; + stageLabelDatum.y = labelY ?? y; + } + let top; + let right; + let bottom; + let left; + if (horizontal) { + const barWidth = availableWidth * yRangeRatio; + top = barWidth; + bottom = barWidth; + const y0 = (xOffset + barWidth / 2) * (availableHeight / bounds.width); + const y1 = (xOffset - barWidth / 2) * (availableHeight / bounds.width); + right = reverse ? bounds.height - y0 : y0; + left = reverse ? bounds.height - y1 : y1; + } else { + const barHeight = availableHeight * yRangeRatio; + right = barHeight; + left = barHeight; + const x0 = (yOffset - barHeight / 2) * (availableWidth / bounds.height); + const x1 = (yOffset + barHeight / 2) * (availableWidth / bounds.height); + top = reverse ? bounds.width - x0 : x0; + bottom = reverse ? bounds.width - x1 : x1; + } + const text2 = this.getLabelText( + yValue, + datum, + valueKey, + "y", + yDomain, + label, + { + datum, + value: yValue, + stageKey, + valueKey + } + ); + const labelDatum = { + x, + y, + text: text2, + textAlign: "center", + textBaseline: "middle", + visible: enabled + }; + labelData.push(labelDatum); + nodeData.push({ + series: this, + itemId: valueKey, + datum, + datumIndex, + index: datumIndex, + xValue: xValue2, + yValue, + x, + y, + top, + right, + bottom, + left, + label: labelDatum, + enabled, + midPoint: { + x, + y + }, + style: this.getItemStyle({ datumIndex, datum }, false) + }); + yStart = yEnd; + } + return { + itemId: seriesId, + nodeData, + labelData, + stageLabelData, + bounds + }; + } + updateSelections() { + if (this.nodeDataRefresh) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + update({ seriesRect }) { + this.checkResize(seriesRect); + const { datumSelection, labelSelection, stageLabelSelection, highlightDatumSelection } = this; + this.updateSelections(); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + let highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedDatum != null && (highlightedDatum.series !== this || highlightedDatum.datum == null)) { + highlightedDatum = void 0; + } + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const stageLabelData = this.contextNodeData?.stageLabelData ?? []; + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumStyles({ datumSelection, isHighlight: false }); + this.updateDatumNodes({ datumSelection, isHighlight: false }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection, labelProperties: this.properties.label }); + this.stageLabelSelection = this.updateStageLabelSelection({ stageLabelData, stageLabelSelection }); + this.updateLabelNodes({ + labelSelection: stageLabelSelection, + labelProperties: this.properties.stageLabel + }); + this.highlightDatumSelection = this.updateDatumSelection({ + nodeData: highlightedDatum == null ? [] : [highlightedDatum], + datumSelection: highlightDatumSelection + }); + this.updateDatumStyles({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.updateDatumNodes({ datumSelection: highlightDatumSelection, isHighlight: true }); + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData); + } + getItemStyle({ datumIndex, datum }, isHighlight) { + const { properties } = this; + const { itemStyler } = properties; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults17(highlightStyle, properties.getStyle(datumIndex)); + let style2 = baseStyle; + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId17(datumIndex, isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(datum, datumIndex, isHighlight, style2); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style2 = mergeDefaults17(overrides, style2); + } + } + return style2; + } + makeItemStylerParams(datum, datumIndex, isHighlight, style2) { + const { id: seriesId, properties } = this; + const { stageKey, valueKey } = properties; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum, + stageKey, + valueKey, + highlighted: isHighlight, + highlightState, + ...style2, + fill + }; + } + updateDatumStyles({ + datumSelection, + isHighlight + }) { + datumSelection.each((_, nodeDatum) => { + nodeDatum.style = this.getItemStyle(nodeDatum, isHighlight); + }); + } + updateDatumNodes({ + datumSelection + }) { + const { properties } = this; + const { shadow } = properties; + const bounds = this.contextNodeData?.bounds; + const fillBBox = bounds ? { series: bounds, axis: bounds } : void 0; + datumSelection.each((connector, nodeDatum) => { + applyShapeStyle14(connector, nodeDatum.style, fillBBox); + applyPyramidDatum(connector, nodeDatum); + connector.fillShadow = shadow; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(this.properties.label.enabled ? opts.labelData : []); + } + updateStageLabelSelection(opts) { + return opts.stageLabelSelection.update(opts.stageLabelData); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, nodeDatum, datumIndex) => { + const { visible, x, y, text: text2, textAlign, textBaseline } = nodeDatum; + const style2 = getLabelStyles5( + this, + void 0, + this.properties, + opts.labelProperties, + false, + activeHighlight + ); + const { color: fill, fontSize, fontStyle, fontWeight, fontFamily } = style2; + label.visible = visible; + label.x = x; + label.y = y; + label.text = text2; + label.fill = fill; + label.fillOpacity = this.getHighlightStyle(false, datumIndex).opacity ?? 1; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + label.setBoxing(style2); + }); + } + computeFocusBounds(opts) { + const datum = this.getNodeData()?.[opts.datumIndex]; + if (datum === void 0) + return; + for (const node of this.datumSelection) { + if (node.datum === datum) { + return node.node; + } + } + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, properties } = this; + const { stageKey, valueKey, tooltip } = properties; + if (!dataModel || !processedData) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const xValue2 = dataModel.resolveColumnById(this, "xValue", processedData)[datumIndex]; + const yValue = dataModel.resolveColumnById(this, `yValue`, processedData)[datumIndex]; + if (xValue2 == null) + return; + const label = this.getLabelText( + xValue2, + datum, + stageKey, + "x", + dataModel.getDomain(this, "xValue", "value", processedData), + this.properties.stageLabel, + { datum, value: xValue2, stageKey, valueKey } + ); + const value = this.getLabelText( + yValue, + datum, + valueKey, + "y", + dataModel.getDomain(this, "yValue", "value", processedData), + this.properties.stageLabel, + { datum, value: yValue, stageKey, valueKey } + ); + const format = this.getItemStyle({ datumIndex, datum }, false); + return this.formatTooltipWithContext( + tooltip, + { + symbol: this.legendItemSymbol(datumIndex), + data: [{ label: toPlainText(label), value: toPlainText(value) }] + }, + { + seriesId, + datum, + title: void 0, + stageKey, + valueKey, + ...format + } + ); + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + pickNodeClosestDatum({ x, y }) { + let minDistanceSquared = Infinity; + let minDatum; + this.datumSelection.each((node, datum) => { + const distanceSquared2 = node.distanceSquared(x, y); + if (distanceSquared2 < minDistanceSquared) { + minDistanceSquared = distanceSquared2; + minDatum = datum; + } + }); + return minDatum == null ? void 0 : { datum: minDatum, distance: Math.sqrt(minDistanceSquared) }; + } + legendItemSymbol(datumIndex) { + const { fills, strokes, strokeWidth, fillOpacity, strokeOpacity, lineDash, lineDashOffset } = this.properties; + const fill = fills[datumIndex] ?? "black"; + const stroke22 = strokes[datumIndex] ?? "black"; + return { + marker: { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } + }; + } + getLegendData(legendType) { + const { + processedData, + dataModel, + id: seriesId, + ctx: { legendManager }, + visible + } = this; + if (!dataModel || !processedData || legendType !== "category") { + return []; + } + const { showInLegend } = this.properties; + const legendData = []; + const stageValues = dataModel.resolveColumnById(this, `xValue`, processedData); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + for (const [datumIndex] of rawData.entries()) { + const stageValue = stageValues[datumIndex]; + legendData.push({ + legendType: "category", + id: seriesId, + itemId: datumIndex, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: datumIndex }), + label: { text: stageValue }, + symbol: this.legendItemSymbol(datumIndex), + hideInLegend: !showInLegend + }); + } + return legendData; + } + animateReset() { + this.ctx.animationManager.skipCurrentBatch(); + this.ctx.animationManager.stopByAnimationGroupId(this.id); + } + animateEmptyUpdateReady() { + const { datumSelection, labelSelection, properties } = this; + const fns = preparePyramidAnimationFunctions(properties.direction); + fromToMotion4(this.id, "nodes", this.ctx.animationManager, [datumSelection], fns); + seriesLabelFadeInAnimation6(this, "labels", this.ctx.animationManager, labelSelection); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +PyramidSeries.className = "PyramidSeries"; +PyramidSeries.type = "pyramid"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs16, pyramidSeriesThemeableOptionsDef: pyramidSeriesThemeableOptionsDef2 } = module_support_exports; +var pyramidSeriesOptionsDef = { + ...pyramidSeriesThemeableOptionsDef2, + ...commonSeriesOptionsDefs16, + type: required(constant("pyramid")), + stageKey: required(string), + valueKey: required(string) +}; +var { + ThemeSymbols: { DEFAULT_SHADOW_COLOUR: DEFAULT_SHADOW_COLOUR22 } +} = module_support_exports; +var PYRAMID_SERIES_THEME = { + series: { + direction: "vertical", + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + spacing: 2, + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", module_support_exports.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + stageLabel: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: true, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 12 + }, + shadow: { + enabled: false, + color: DEFAULT_SHADOW_COLOUR22, + xOffset: 3, + yOffset: 3, + blur: 5 + }, + // @ts-expect-error undocumented option + highlight: module_support_exports.singleSeriesHighlightStyle() + } +}; +var PyramidModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "pyramid", + moduleFactory: (ctx) => new PyramidSeries(ctx), + solo: true, + themeTemplate: PYRAMID_SERIES_THEME +}; +var PyramidSeriesModule = { + type: "series", + name: "pyramid", + chartType: "standalone", + enterprise: true, + options: pyramidSeriesOptionsDef, + create: (ctx) => new PyramidSeries(ctx) +}; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE3 } +} = module_support_exports; +var BASE_RADAR_SERIES_THEME = { + series: { + stroke: { $palette: "stroke" }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + marker: { + enabled: true, + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", module_support_exports.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS] + ] + }, + stroke: { $palette: "stroke" }, + fillOpacity: 1, + shape: "circle", + size: 6, + strokeOpacity: 1, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] } + }, + highlight: module_support_exports.multiSeriesHighlightStyle(), + tooltip: { + range: { $path: ["/tooltip/range", "nearest"] } + } + }, + axes: { + [POLAR_AXIS_TYPE3.ANGLE_CATEGORY]: { + label: { + spacing: 10 + } + } + } +}; +var RADAR_LINE_SERIES_THEME = module_support_exports.mergeDefaults( + { + series: { + stroke: module_support_exports.SAFE_STROKE_FILL_OPERATION, + strokeWidth: 2 + } + }, + BASE_RADAR_SERIES_THEME +); +var RADAR_AREA_SERIES_THEME = module_support_exports.mergeDefaults( + { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", module_support_exports.FILL_GRADIENT_LINEAR_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS] + ] + }, + fillOpacity: 0.8, + strokeWidth: 2, + marker: { + enabled: false + } + } + }, + BASE_RADAR_SERIES_THEME +); +var { Label: Label14, SeriesMarker: SeriesMarker22, SeriesProperties: SeriesProperties10, makeSeriesTooltip: makeSeriesTooltip19, Property: Property77 } = module_support_exports; +var RadarSeriesProperties = class extends SeriesProperties10 { + constructor() { + super(...arguments); + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.rotation = 0; + this.marker = new SeriesMarker22(); + this.label = new Label14(); + this.tooltip = makeSeriesTooltip19(); + this.connectMissingData = false; + } +}; +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "angleKey", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "radiusKey", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "angleName", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "radiusName", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "legendItemName", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "stroke", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "rotation", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "styler", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "marker", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "tooltip", 2); +__decorateClass2([ + Property77 +], RadarSeriesProperties.prototype, "connectMissingData", 2); +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS22, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES22, + ChartAxisDirection: ChartAxisDirection29, + PolarAxis: PolarAxis22, + SeriesNodePickMode: SeriesNodePickMode14, + valueProperty: valueProperty17, + fixNumericExtent: fixNumericExtent9, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation7, + markerFadeInAnimation: markerFadeInAnimation22, + resetMarkerFn: resetMarkerFn22, + animationValidation: animationValidation8, + computeMarkerFocusBounds: computeMarkerFocusBounds3, + extent: extent22, + BBox: BBox23, + Group: Group17, + Path: Path12, + Selection: Selection14, + Text: Text8, + Marker: Marker5, + updateLabelNode: updateLabelNode7, + getMarkerStyles: getMarkerStyles22, + mergeDefaults: mergeDefaults18 +} = module_support_exports; +var RadarSeriesNodeEvent = class extends module_support_exports.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadarSeries = class extends module_support_exports.PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: "angleValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS22, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES22, + pickModes: [SeriesNodePickMode14.NEAREST_NODE, SeriesNodePickMode14.EXACT_SHAPE_MATCH], + canHaveAxes: true, + animationResetFns: { + item: resetMarkerFn22 + }, + clipFocusBox: false + }); + this.NodeEvent = RadarSeriesNodeEvent; + this.lineGroup = this.contentGroup.appendChild(new Group17({ name: "radar-line" })); + this.lineSelection = Selection14.select( + this.lineGroup, + Path12 + ); + this.resetInvalidToZero = false; + this.circleCache = { r: 0, cx: 0, cy: 0 }; + this.lineGroup.zIndex = 0; + this.itemGroup.zIndex = 1; + } + get hasData() { + return this.getHasData("angleValue"); + } + nodeFactory() { + return new Marker5(); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection29.Angle) { + return dataModel.getDomain(this, `angleValue`, "value", processedData); + } else { + const domain = dataModel.getDomain(this, `radiusValue`, "value", processedData); + const ext = extent22(domain.length === 0 ? domain : [0].concat(domain)); + return fixNumericExtent9(ext); + } + } + async processData(dataController) { + const { angleKey, radiusKey } = this.properties; + const extraProps = []; + if (!this.ctx.animationManager.isSkipped()) { + extraProps.push(animationValidation8()); + } + const radiusScaleType = this.axes[ChartAxisDirection29.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection29.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + valueProperty17(angleKey, angleScaleType, { id: "angleValue" }), + valueProperty17(radiusKey, radiusScaleType, { id: "radiusValue", invalidValue: void 0 }), + ...extraProps + ] + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (!(r === cache.r && cx === cache.cx && cy === cache.cy)) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection29.Radius]; + return radiusAxis instanceof PolarAxis22 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + maybeRefreshNodeData() { + const didCircleChange = this.didCircleChange(); + if (!didCircleChange && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + createNodeData() { + const { processedData, dataModel } = this; + if (!processedData || !dataModel) + return; + const { angleKey, radiusKey, angleName, radiusName, legendItemName, marker, label } = this.properties; + const angleScale = this.axes[ChartAxisDirection29.Angle]?.scale; + const radiusScale = this.axes[ChartAxisDirection29.Radius]?.scale; + if (!angleScale || !radiusScale) { + return; + } + const angleValues = dataModel.resolveColumnById(this, `angleValue`, processedData); + const radiusValues = dataModel.resolveColumnById(this, `radiusValue`, processedData); + const axisInnerRadius = this.getAxisInnerRadius(); + const radiusDomain = this.getSeriesDomain(ChartAxisDirection29.Radius); + const rawData = processedData.dataSources.get(this.id)?.data ?? []; + const nodeData = rawData.map((datum, datumIndex) => { + const angleDatum = angleValues[datumIndex]; + const radiusDatum = radiusValues[datumIndex]; + const angle2 = angleScale.convert(angleDatum); + const radius = this.radius + axisInnerRadius - radiusScale.convert(radiusDatum); + const cos = Math.cos(angle2); + const sin = Math.sin(angle2); + const x = cos * radius; + const y = sin * radius; + let labelNodeDatum; + if (label.enabled) { + const labelText = this.getLabelText( + radiusDatum, + datum, + radiusKey, + "radius", + radiusDomain, + label, + { value: radiusDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + let textAlign = "right"; + if (isNumberEqual(cos, 0)) { + textAlign = "center"; + } else if (cos > 0) { + textAlign = "left"; + } + let textBaseline = "bottom"; + if (isNumberEqual(sin, 0)) { + textBaseline = "middle"; + } else if (sin > 0) { + textBaseline = "top"; + } + labelNodeDatum = { + x: x + cos * marker.size, + y: y + sin * marker.size, + text: labelText, + textAlign, + textBaseline + }; + } + } + return { + series: this, + datum, + datumIndex, + index: datumIndex, + point: { x, y, size: marker.size }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + missing: !isFiniteNumber(angle2) || !isFiniteNumber(radius) + }; + }); + return { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles: getMarkerStyles22(this, this.properties, marker) + }; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const { series } = this.ctx.highlightManager?.getActiveHighlight() ?? {}; + this.highlightGroup.visible = (animationEnabled || this.visible) && series === this; + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updatePathSelections(); + this.updateMarkerSelection(); + this.updateHighlightSelection(); + this.updatePathNodes(); + if (this.hasItemStylers()) { + this.updateDatumStyles(this.itemSelection, false); + this.updateDatumStyles(this.highlightSelection, true); + } + this.updateMarkers(this.itemSelection, false); + this.updateMarkers(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updatePathSelections() { + const pathData = this.visible ? [true] : []; + this.lineSelection.update(pathData); + } + updateMarkerSelection() { + const { marker, styler } = this.properties; + if (marker.isDirty()) { + this.itemSelection.clear(); + this.itemSelection.cleanup(); + this.itemSelection = Selection14.select(this.itemGroup, () => this.nodeFactory(), false); + } + const markersEnabled = styler == null ? marker.enabled : this.getStyle(false).marker.enabled; + const data = this.visible && marker.shape && markersEnabled ? this.nodeData : []; + this.itemSelection.update(data); + } + updateHighlightSelection() { + const { marker, styler } = this.properties; + if (marker.isDirty()) { + this.highlightSelection.clear(); + this.highlightSelection.cleanup(); + this.highlightSelection = Selection14.select(this.highlightGroup, () => this.nodeFactory(), false); + } + const markersEnabled = styler == null ? marker.enabled : this.getStyle(false).marker.enabled; + const highlighted = this.ctx.highlightManager?.getActiveHighlight(); + const data = this.visible && marker.shape && markersEnabled && highlighted?.datum ? [{ ...highlighted }] : []; + this.highlightSelection.update(data); + } + getMarkerFill(highlightedStyle) { + return highlightedStyle?.fill ?? this.getStyle(false).marker.fill; + } + getDatumStylerProperties(datum) { + const { id: seriesId, properties } = this; + const { angleKey, radiusKey } = properties; + return { + seriesId, + datum, + angleKey, + radiusKey + }; + } + updateDatumStyles(selection, isHighlight) { + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + selection.each((_, datum) => { + const highlightState = this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex); + const stylerStyle = this.getStyle(isHighlight, highlightState); + const { stroke: stroke22, strokeWidth, strokeOpacity } = stylerStyle; + datum.style = this.getMarkerStyle( + this.properties.marker, + datum, + this.getDatumStylerProperties(datum.datum), + { isHighlight, highlightState }, + stylerStyle.marker, + { + stroke: stroke22, + strokeWidth, + strokeOpacity + } + ); + }); + } + updateMarkers(selection, isHighlight) { + const fillBBox = this.getShapeFillBBox(); + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + selection.each((node, datum) => { + const style2 = datum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, datum.datumIndex)]; + this.applyMarkerStyle(style2, node, datum.point, fillBBox); + }); + } + updateLabels() { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + if (datum.label) { + const isHighlight = false; + node.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + updateLabelNode7(this, node, properties, properties.label, datum.label, isHighlight, activeHighlight); + } + }); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip, marker } = properties; + const angleAxis = axes[ChartAxisDirection29.Angle]; + const radiusAxis = axes[ChartAxisDirection29.Radius]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const angleValue = dataModel.resolveColumnById(this, `angleValue`, processedData)[datumIndex]; + const radiusValue = dataModel.resolveColumnById(this, `radiusValue`, processedData)[datumIndex]; + if (angleValue == null) + return; + const activeStyle = this.getMarkerStyle(marker, { datum, datumIndex }, this.getDatumStylerProperties(datum), { + isHighlight: false + }); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: radiusName, + fallbackLabel: radiusKey, + value: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + radiusKey, + angleName, + radiusName, + legendItemName, + ...activeStyle + } + ); + } + legendItemSymbol() { + const { stroke: stroke22, strokeWidth, strokeOpacity, lineDash, marker } = this.getStyle(false); + const markerStyle = { + shape: marker.shape, + enabled: marker.enabled || strokeWidth <= 0, + fill: this.getMarkerFill() ?? marker.stroke ?? stroke22 ?? "rgba(0, 0, 0, 0)", + stroke: marker.stroke ?? stroke22 ?? "rgba(0, 0, 0, 0)", + fillOpacity: marker.fillOpacity, + strokeOpacity: marker.strokeOpacity, + strokeWidth: marker.strokeWidth, + lineDash: marker.lineDash, + lineDashOffset: marker.lineDashOffset + }; + return { + marker: markerStyle, + line: { + stroke: stroke22, + strokeOpacity, + strokeWidth, + lineDash + } + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { + id: seriesId, + ctx: { legendManager }, + visible + } = this; + const { radiusKey, radiusName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: radiusKey, + seriesId, + enabled: visible && legendManager.getItemEnabled({ seriesId, itemId: radiusKey }), + label: { + text: legendItemName ?? radiusName ?? radiusKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + pickNodeClosestDatum(hitPoint) { + const { nodeData, centerX: cx, centerY: cy } = this; + const { x, y } = hitPoint; + const radius = this.radius; + const distanceFromCenter = Math.hypot(x - cx, y - cy); + if (distanceFromCenter > radius + this.properties.marker.size) { + return; + } + let minDistance = Infinity; + let closestDatum; + for (const datum of nodeData) { + const { point: { x: datumX = Number.NaN, y: datumY = Number.NaN } = {} } = datum; + if (Number.isNaN(datumX) || Number.isNaN(datumY)) { + continue; + } + const distance2 = Math.hypot(hitPoint.x - datumX - cx, hitPoint.y - datumY - cy); + if (distance2 < minDistance) { + minDistance = distance2; + closestDatum = datum; + } + } + if (closestDatum) { + const distance2 = Math.max(minDistance - (closestDatum.point?.size ?? 0), 0); + return { datum: closestDatum, distance: distance2 }; + } + } + computeLabelsBBox() { + const { label } = this.properties; + this.maybeRefreshNodeData(); + const textBoxes = []; + const tempText = new Text8(); + for (const nodeDatum of this.nodeData) { + if (!label.enabled || !nodeDatum.label) { + continue; + } + tempText.text = nodeDatum.label.text; + tempText.x = nodeDatum.label.x; + tempText.y = nodeDatum.label.y; + tempText.setFont(label); + tempText.setAlign(nodeDatum.label); + const box = tempText.getBBox(); + textBoxes.push(box); + } + if (textBoxes.length === 0) { + return null; + } + return BBox23.merge(textBoxes); + } + getLineNode() { + return this.lineSelection?.at(0); + } + beforePathAnimation() { + this.updatePathNodes(); + } + getPathNodesStyle() { + const highlightDatum = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightState(highlightDatum); + const highlightStyle = this.getHighlightStyle(void 0, void 0, highlightState); + const stylerStyle = this.getStyle(false, highlightState); + return mergeDefaults18(highlightStyle, stylerStyle); + } + getLinePoints() { + const { nodeData, resetInvalidToZero } = this; + const { connectMissingData } = this.properties; + if (nodeData.length === 0) { + return []; + } + const radiusAxis = this.axes[ChartAxisDirection29.Radius]; + const angleAxis = this.axes[ChartAxisDirection29.Angle]; + const reversedAngleAxis = angleAxis?.isReversed(); + const reversedRadiusAxis = radiusAxis?.isReversed(); + const data = reversedRadiusAxis && !reversedAngleAxis ? [...nodeData].reverse() : nodeData; + const points = []; + let prevPointInvalid = false; + let firstValid; + for (const [index, datum] of data.entries()) { + let { x, y } = datum.point; + const isPointInvalid = Number.isNaN(x) || Number.isNaN(y); + if (!isPointInvalid) { + firstValid ?? (firstValid = datum); + } + if (isPointInvalid && !connectMissingData) { + x = 0; + y = 0; + } + const moveTo2 = index === 0 || !resetInvalidToZero && !connectMissingData && (isPointInvalid || prevPointInvalid); + points.push({ x, y, moveTo: moveTo2 }); + prevPointInvalid = isPointInvalid; + } + if (firstValid !== void 0) { + points.push({ x: firstValid.point.x, y: firstValid.point.y, moveTo: false }); + } + return points; + } + animateSinglePath(pathNode, points, ratio3) { + const { path } = pathNode; + path.clear(true); + const axisInnerRadius = this.getAxisInnerRadius(); + const radiusAxis = this.axes[ChartAxisDirection29.Radius]; + const reversedRadiusAxis = radiusAxis?.isReversed(); + const radiusZero = reversedRadiusAxis ? this.radius + axisInnerRadius - radiusAxis?.scale.convert(0) : axisInnerRadius; + for (const point of points) { + const { x: x1, y: y1, arc, radius = 0, startAngle = 0, endAngle = 0, moveTo: moveTo2 } = point; + const angle2 = Math.atan2(y1, x1); + const x0 = radiusZero * Math.cos(angle2); + const y0 = radiusZero * Math.sin(angle2); + const t = ratio3; + const x = x0 * (1 - t) + x1 * t; + const y = y0 * (1 - t) + y1 * t; + if (arc) { + path.arc(x1, y1, radius, startAngle, endAngle); + } else if (moveTo2) { + path.moveTo(x, y); + } else { + path.lineTo(x, y); + } + } + pathNode.checkPathDirty(); + } + animatePaths(ratio3) { + const linePoints = this.getLinePoints(); + const lineNode = this.getLineNode(); + if (!lineNode) + return; + this.animateSinglePath(lineNode, linePoints, ratio3); + } + animateEmptyUpdateReady() { + const { itemSelection, labelSelection } = this; + const { animationManager } = this.ctx; + this.beforePathAnimation(); + animationManager.animate({ + id: `${this.id}_'path`, + groupId: this.id, + from: 0, + to: 1, + phase: "initial", + collapsable: false, + onUpdate: (ratio3) => this.animatePaths(ratio3), + onStop: () => this.animatePaths(1) + }); + markerFadeInAnimation22(this, animationManager, "added", itemSelection); + seriesLabelFadeInAnimation7(this, "labels", animationManager, labelSelection); + } + animateWaitingUpdateReady(data) { + super.animateWaitingUpdateReady(data); + this.resetPaths(); + } + animateReadyResize(data) { + super.animateReadyResize(data); + this.resetPaths(); + } + resetPaths() { + const lineNode = this.getLineNode(); + if (lineNode) { + const { path: linePath } = lineNode; + const linePoints = this.getLinePoints(); + const stylerStyle = this.getStyle(false); + lineNode.fill = void 0; + lineNode.stroke = stylerStyle.stroke; + lineNode.strokeWidth = stylerStyle.strokeWidth; + lineNode.strokeOpacity = stylerStyle.strokeOpacity; + lineNode.lineDash = stylerStyle.lineDash; + lineNode.lineDashOffset = stylerStyle.lineDashOffset; + linePath.clear(true); + for (const { x, y, moveTo: moveTo2 } of linePoints) { + if (moveTo2) { + linePath.moveTo(x, y); + } else { + linePath.lineTo(x, y); + } + } + lineNode.checkPathDirty(); + return stylerStyle; + } + } + getStylerResult(stylerResult, highlighted, highlightState) { + const { styler } = this.properties; + if (styler) { + const stylerParams = this.makeStylerParams(highlighted, highlightState); + const cbResult = this.cachedCallWithContext(styler, stylerParams) ?? {}; + const resolved = this.ctx.optionsGraphService.resolvePartial( + ["series", `${this.declarationOrder}`], + cbResult, + { pick: false } + ); + if (resolved) { + stylerResult = resolved; + } + } + return stylerResult; + } + getFormattedMarkerStyle(datum) { + const { angleKey, radiusKey } = this.properties; + return this.getMarkerStyle(this.properties.marker, datum, { angleKey, radiusKey }, { isHighlight: true }); + } + computeFocusBounds(opts) { + return computeMarkerFocusBounds3(this, opts); + } + hasItemStylers() { + return this.properties.styler != null || this.properties.marker.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +RadarSeries.className = "RadarSeries"; +var { Property: Property78 } = module_support_exports; +var RadarAreaSeriesProperties = class extends RadarSeriesProperties { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + } +}; +__decorateClass2([ + Property78 +], RadarAreaSeriesProperties.prototype, "fill", 2); +__decorateClass2([ + Property78 +], RadarAreaSeriesProperties.prototype, "fillOpacity", 2); +var { + ChartAxisDirection: ChartAxisDirection30, + Group: Group18, + HighlightState: HighlightState4, + Path: Path13, + PointerEvents: PointerEvents10, + Selection: Selection15, + applyShapeStyle: applyShapeStyle15, + toHighlightString: toHighlightString5 +} = module_support_exports; +var RadarAreaSeries = class extends RadarSeries { + constructor(moduleCtx) { + super(moduleCtx); + this.properties = new RadarAreaSeriesProperties(); + this.areaGroup = this.contentGroup.appendChild(new Group18({ name: "radar-area" })); + this.areaSelection = Selection15.select( + this.areaGroup, + Path13 + ); + this.resetInvalidToZero = true; + this.areaGroup.zIndex = -1; + } + updatePathSelections() { + const pathData = this.visible ? [true] : []; + this.areaSelection.update(pathData); + super.updatePathSelections(); + } + getAreaNode() { + return this.areaSelection.at(0); + } + getMarkerFill(highlightedStyle) { + if (highlightedStyle?.fill != null) + return highlightedStyle.fill; + const stylerStyle = this.getStyle(false); + return stylerStyle.marker.fill ?? stylerStyle.fill; + } + updatePathNodes() { + const styles = this.getPathNodesStyle(); + const { fill, fillOpacity, strokeWidth, stroke: stroke22, strokeOpacity, lineDash, lineDashOffset, opacity } = styles; + const lineNode = this.getLineNode(); + if (lineNode) { + lineNode.setProperties({ + fill: void 0, + lineJoin: "round", + lineCap: "round", + pointerEvents: PointerEvents10.None, + opacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + } + const areaNode = this.getAreaNode(); + if (areaNode) { + applyShapeStyle15(areaNode, { fill, fillOpacity, stroke: void 0 }, this.getShapeFillBBox()); + areaNode.setProperties({ + lineJoin: "round", + pointerEvents: PointerEvents10.None, + opacity + }); + } + } + animatePaths(ratio3) { + super.animatePaths(ratio3); + const areaNode = this.getAreaNode(); + if (areaNode) { + this.animateSinglePath(areaNode, this.getAreaPoints(), ratio3); + } + } + getAreaPoints() { + const points = this.getLinePoints(); + const getPolarAxis = (direction) => { + const axis = this.axes[direction]; + return axis instanceof module_support_exports.PolarAxis ? axis : void 0; + }; + const radiusAxis = getPolarAxis(ChartAxisDirection30.Radius); + const angleAxis = getPolarAxis(ChartAxisDirection30.Angle); + const reversedRadiusAxis = radiusAxis?.isReversed(); + if (!reversedRadiusAxis) { + return points; + } + const zeroLinePoints = angleAxis?.getAxisLinePoints()?.points ?? []; + return points.concat(...zeroLinePoints); + } + resetPaths() { + const superStyle = super.resetPaths(); + const areaNode = this.getAreaNode(); + if (areaNode) { + const { path: areaPath } = areaNode; + const areaPoints = this.getAreaPoints(); + const stylerStyle = superStyle ?? this.getStyle(false); + const fillBBox = this.getShapeFillBBox(); + applyShapeStyle15( + areaNode, + { + fill: stylerStyle.fill, + stroke: void 0, + fillOpacity: stylerStyle.fillOpacity, + lineDash: stylerStyle.lineDash, + lineDashOffset: stylerStyle.lineDashOffset + }, + fillBBox + ); + areaNode.lineJoin = areaNode.lineCap = "round"; + areaPath.clear(true); + for (const { x, y, moveTo: moveTo2, arc, radius = 0, startAngle = 0, endAngle = 0 } of areaPoints) { + if (arc) { + areaPath.arc(x, y, radius, startAngle, endAngle); + } else if (moveTo2) { + areaPath.moveTo(x, y); + } else { + areaPath.lineTo(x, y); + } + } + areaPath.closePath(); + areaNode.checkPathDirty(); + return stylerStyle; + } + } + makeStylerParams(highlighted, highlightStateEnum) { + const { properties } = this; + const highlightState = toHighlightString5(highlightStateEnum ?? HighlightState4.None); + return { + marker: { + fill: properties.marker.fill, + fillOpacity: properties.marker.fillOpacity, + size: properties.marker.size, + shape: properties.marker.shape, + stroke: properties.marker.stroke, + strokeOpacity: properties.marker.strokeOpacity, + strokeWidth: properties.marker.strokeWidth, + lineDash: properties.marker.lineDash, + lineDashOffset: properties.marker.lineDashOffset + }, + highlightState, + highlighted, + fill: properties.fill, + fillOpacity: properties.fillOpacity, + lineDash: properties.lineDash, + lineDashOffset: properties.lineDashOffset, + seriesId: this.id, + stroke: properties.stroke, + strokeOpacity: properties.strokeOpacity, + strokeWidth: properties.strokeWidth, + angleKey: properties.angleKey, + radiusKey: properties.radiusKey + }; + } + getStyle(highlighted, highlightState) { + const { marker, fill, fillOpacity, lineDash, lineDashOffset, stroke: stroke22, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill: markerFill = "transparent", fillOpacity: markerFillOpacity } = marker; + const stylerResult = this.getStylerResult({}, highlighted, highlightState); + stylerResult.marker ?? (stylerResult.marker = {}); + return { + fill: stylerResult.fill ?? fill, + fillOpacity: stylerResult.fillOpacity ?? fillOpacity, + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke22, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? markerFill, + fillOpacity: stylerResult.marker.fillOpacity ?? markerFillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke22, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } +}; +RadarAreaSeries.className = "RadarAreaSeries"; +RadarAreaSeries.type = "radar-area"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs17, radarAreaSeriesThemeableOptionsDef: radarAreaSeriesThemeableOptionsDef2 } = module_support_exports; +var radarAreaSeriesOptionsDef = { + ...commonSeriesOptionsDefs17, + ...radarAreaSeriesThemeableOptionsDef2, + type: required(constant("radar-area")), + angleKey: required(string), + radiusKey: required(string), + angleName: string, + radiusName: string, + legendItemName: string +}; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE4 } +} = module_support_exports; +var RadarAreaModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radar-area", + moduleFactory: (ctx) => new RadarAreaSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE4.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE4.RADIUS_NUMBER }], + themeTemplate: RADAR_AREA_SERIES_THEME +}; +var RadarAreaSeriesModule = { + type: "series", + name: "radar-area", + chartType: "polar", + enterprise: true, + options: radarAreaSeriesOptionsDef, + create: (ctx) => new RadarAreaSeries(ctx) +}; +var { HighlightState: HighlightState5, PointerEvents: PointerEvents11, toHighlightString: toHighlightString6 } = module_support_exports; +var RadarLineSeries = class extends RadarSeries { + constructor() { + super(...arguments); + this.properties = new RadarSeriesProperties(); + } + updatePathSelections() { + this.lineSelection.update(this.visible ? [true] : []); + } + updatePathNodes() { + const lineNode = this.getLineNode(); + if (!lineNode) + return; + const style2 = this.getPathNodesStyle(); + const { strokeWidth, stroke: stroke22, strokeOpacity, lineDash, lineDashOffset, opacity } = style2; + lineNode.setProperties({ + fill: void 0, + lineJoin: "round", + lineCap: "round", + pointerEvents: PointerEvents11.None, + opacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }); + } + makeStylerParams(highlighted, highlightStateEnum) { + const { properties } = this; + const highlightState = toHighlightString6(highlightStateEnum ?? HighlightState5.None); + return { + marker: { + fill: properties.marker.fill, + fillOpacity: properties.marker.fillOpacity, + size: properties.marker.size, + shape: properties.marker.shape, + stroke: properties.marker.stroke, + strokeOpacity: properties.marker.strokeOpacity, + strokeWidth: properties.marker.strokeWidth, + lineDash: properties.marker.lineDash, + lineDashOffset: properties.marker.lineDashOffset + }, + highlightState, + highlighted, + lineDash: properties.lineDash, + lineDashOffset: properties.lineDashOffset, + seriesId: this.id, + stroke: properties.stroke, + strokeOpacity: properties.strokeOpacity, + strokeWidth: properties.strokeWidth, + angleKey: properties.angleKey, + radiusKey: properties.radiusKey + }; + } + getStyle(highlighted, highlightState) { + const { marker, lineDash, lineDashOffset, stroke: stroke22, strokeOpacity, strokeWidth } = this.properties; + const { size, shape, fill = "transparent", fillOpacity } = marker; + const stylerResult = this.getStylerResult({}, highlighted, highlightState); + stylerResult.marker ?? (stylerResult.marker = {}); + return { + lineDash: stylerResult.lineDash ?? lineDash, + lineDashOffset: stylerResult.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.stroke ?? stroke22, + strokeOpacity: stylerResult.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.strokeWidth ?? strokeWidth, + marker: { + enabled: stylerResult.marker.enabled ?? marker.enabled, + fill: stylerResult.marker.fill ?? fill, + fillOpacity: stylerResult.marker.fillOpacity ?? fillOpacity, + shape: stylerResult.marker.shape ?? shape, + size: stylerResult.marker.size ?? size, + lineDash: stylerResult.marker.lineDash ?? marker.lineDash ?? lineDash, + lineDashOffset: stylerResult.marker.lineDashOffset ?? marker.lineDashOffset ?? lineDashOffset, + stroke: stylerResult.marker.stroke ?? marker.stroke ?? stroke22, + strokeOpacity: stylerResult.marker.strokeOpacity ?? marker.strokeOpacity ?? strokeOpacity, + strokeWidth: stylerResult.marker.strokeWidth ?? marker.strokeWidth ?? strokeWidth + } + }; + } +}; +RadarLineSeries.className = "RadarLineSeries"; +RadarLineSeries.type = "radar-line"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs18, radarLineSeriesThemeableOptionsDef: radarLineSeriesThemeableOptionsDef2 } = module_support_exports; +var radarLineSeriesOptionsDef = { + ...commonSeriesOptionsDefs18, + ...radarLineSeriesThemeableOptionsDef2, + type: required(constant("radar-line")), + angleKey: required(string), + radiusKey: required(string), + angleName: string, + radiusName: string, + legendItemName: string +}; +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE5 } = module_support_exports.ThemeConstants; +var RadarLineModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radar-line", + moduleFactory: (ctx) => new RadarLineSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE5.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE5.RADIUS_NUMBER }], + themeTemplate: RADAR_LINE_SERIES_THEME +}; +var RadarLineSeriesModule = { + type: "series", + name: "radar-line", + chartType: "polar", + enterprise: true, + options: radarLineSeriesOptionsDef, + create: (ctx) => new RadarLineSeries(ctx) +}; +var { SeriesProperties: SeriesProperties11, makeSeriesTooltip: makeSeriesTooltip20, Property: Property79, Label: Label15 } = module_support_exports; +var RadialBarSeriesProperties = class extends SeriesProperties11 { + constructor() { + super(...arguments); + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.cornerRadius = 0; + this.rotation = 0; + this.label = new Label15(); + this.tooltip = makeSeriesTooltip20(); + } + getStyle() { + const { fill, fillOpacity, stroke: stroke22, strokeWidth, strokeOpacity, lineDash, lineDashOffset, cornerRadius } = this; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + cornerRadius, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "angleKey", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "radiusKey", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "angleName", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "radiusName", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "legendItemName", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "fill", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "stroke", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "styler", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "rotation", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "stackGroup", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "normalizedTo", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property79 +], RadialBarSeriesProperties.prototype, "tooltip", 2); +var { SectorBox: SectorBox3, motion: motion9 } = module_support_exports; +function fixRadialBarAnimationStatus(node, datum, status) { + if (status === "updated") { + if (node.previousDatum == null || Number.isNaN(node.previousDatum.innerRadius) || Number.isNaN(node.previousDatum.outerRadius)) { + return "added"; + } + if (Number.isNaN(datum.innerRadius) || Number.isNaN(datum.outerRadius)) { + return "removed"; + } + } + if (status === "added" && node.previousDatum != null) { + return "updated"; + } + return status; +} +function prepareRadialBarSeriesAnimationFunctions(axisZeroAngle) { + const fromFn = (sect, datum, status) => { + status = fixRadialBarAnimationStatus(sect, datum, status); + let startAngle; + let endAngle; + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed" || status === "updated") { + startAngle = sect.startAngle; + endAngle = sect.endAngle; + innerRadius = sect.innerRadius; + outerRadius = sect.outerRadius; + clipSector = sect.clipSector; + } else { + startAngle = axisZeroAngle; + endAngle = axisZeroAngle; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + } + clipSector ?? (clipSector = new SectorBox3(startAngle, endAngle, innerRadius, outerRadius)); + const phase = motion9.NODE_UPDATE_STATE_TO_PHASE_MAPPING[status]; + return { startAngle, endAngle, innerRadius, outerRadius, clipSector, phase }; + }; + const toFn = (sect, datum, status) => { + let startAngle; + let endAngle; + let innerRadius; + let outerRadius; + let clipSector; + if (status === "removed") { + startAngle = axisZeroAngle; + endAngle = axisZeroAngle; + innerRadius = datum.innerRadius; + outerRadius = datum.outerRadius; + clipSector = new SectorBox3(startAngle, endAngle, innerRadius, outerRadius); + } else { + startAngle = datum.startAngle; + endAngle = datum.endAngle; + innerRadius = Number.isNaN(datum.innerRadius) ? sect.innerRadius : datum.innerRadius; + outerRadius = Number.isNaN(datum.outerRadius) ? sect.outerRadius : datum.outerRadius; + clipSector = datum.clipSector; + } + return { startAngle, endAngle, innerRadius, outerRadius, clipSector }; + }; + return { toFn, fromFn }; +} +function resetRadialBarSelectionsFn(_node, datum) { + return { + centerX: 0, + centerY: 0, + innerRadius: datum.innerRadius, + outerRadius: datum.outerRadius, + startAngle: datum.startAngle, + endAngle: datum.endAngle, + clipSector: datum.clipSector + }; +} +var { + DEFAULT_POLAR_DIRECTION_KEYS: DEFAULT_POLAR_DIRECTION_KEYS3, + DEFAULT_POLAR_DIRECTION_NAMES: DEFAULT_POLAR_DIRECTION_NAMES3, + ChartAxisDirection: ChartAxisDirection31, + PolarAxis: PolarAxis3, + diff: diff7, + groupAccumulativeValueProperty: groupAccumulativeValueProperty3, + keyProperty: keyProperty10, + normaliseGroupTo: normaliseGroupTo22, + valueProperty: valueProperty18, + fixNumericExtent: fixNumericExtent10, + resetLabelFn: resetLabelFn6, + seriesLabelFadeInAnimation: seriesLabelFadeInAnimation8, + seriesLabelFadeOutAnimation: seriesLabelFadeOutAnimation22, + animationValidation: animationValidation9, + angleBetween: angleBetween3, + createDatumId: createDatumId18, + CategoryScale: CategoryScale4, + Sector: Sector5, + SectorBox: SectorBox4, + motion: motion10, + isGradientFill: isGradientFill3, + applyShapeStyle: applyShapeStyle16, + updateLabelNode: updateLabelNode8, + getItemStyles: getItemStyles4 +} = module_support_exports; +var RadialBarSeriesNodeEvent = class extends module_support_exports.SeriesNodeEvent { + constructor(type, nativeEvent, datum, series) { + super(type, nativeEvent, datum, series); + this.angleKey = series.properties.angleKey; + this.radiusKey = series.properties.radiusKey; + } +}; +var RadialBarSeries = class extends module_support_exports.PolarSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + categoryKey: "radiusValue", + propertyKeys: DEFAULT_POLAR_DIRECTION_KEYS3, + propertyNames: DEFAULT_POLAR_DIRECTION_NAMES3, + canHaveAxes: true, + animationResetFns: { + item: resetRadialBarSelectionsFn, + label: resetLabelFn6 + } + }); + this.properties = new RadialBarSeriesProperties(); + this.NodeEvent = RadialBarSeriesNodeEvent; + this.groupScale = new CategoryScale4(); + this.circleCache = { r: 0, cx: 0, cy: 0 }; + } + get hasData() { + return this.getHasData("angleValue-raw"); + } + nodeFactory() { + return new Sector5(); + } + getSeriesDomain(direction) { + const { dataModel, processedData } = this; + if (!processedData || !dataModel) + return []; + if (direction === ChartAxisDirection31.Angle) { + const xExtent = dataModel.getDomain(this, "angleValue-end", "value", processedData); + const fixedXExtent = [Math.min(xExtent[0], 0), Math.max(xExtent[1], 0)]; + return fixNumericExtent10(fixedXExtent); + } else { + return dataModel.getDomain(this, "radiusValue", "key", processedData); + } + } + async processData(dataController) { + const { angleKey, radiusKey, normalizedTo } = this.properties; + const animationEnabled = !this.ctx.animationManager.isSkipped(); + const stackGroupId = this.getStackId(); + const stackGroupTrailingId = `${stackGroupId}-trailing`; + const extraProps = []; + if (isDefined(normalizedTo)) { + extraProps.push(normaliseGroupTo22([stackGroupId, stackGroupTrailingId], Math.abs(normalizedTo))); + } + if (animationEnabled) { + if (this.processedData) { + extraProps.push(diff7(this.id, this.processedData)); + } + extraProps.push(animationValidation9()); + } + const visibleProps = this.visible ? {} : { forceValue: 0 }; + const radiusScaleType = this.axes[ChartAxisDirection31.Radius]?.scale.type; + const angleScaleType = this.axes[ChartAxisDirection31.Angle]?.scale.type; + await this.requestDataModel(dataController, this.data, { + props: [ + keyProperty10(radiusKey, radiusScaleType, { id: "radiusValue" }), + valueProperty18(angleKey, angleScaleType, { + id: "angleValue-raw", + invalidValue: null, + ...visibleProps + }), + ...groupAccumulativeValueProperty3( + angleKey, + "normal", + { + id: `angleValue-end`, + rangeId: `angleValue-range`, + invalidValue: null, + groupId: stackGroupId, + separateNegative: true, + ...visibleProps + }, + angleScaleType + ), + ...groupAccumulativeValueProperty3( + angleKey, + "trailing", + { + id: `angleValue-start`, + invalidValue: null, + groupId: stackGroupTrailingId, + separateNegative: true, + ...visibleProps + }, + angleScaleType + ), + ...extraProps + ], + groupByKeys: true, + groupByData: false + }); + this.animationState.transition("updateData"); + } + didCircleChange() { + const r = this.radius; + const cx = this.centerX; + const cy = this.centerY; + const cache = this.circleCache; + if (!(r === cache.r && cx === cache.cx && cy === cache.cy)) { + this.circleCache = { r, cx, cy }; + return true; + } + return false; + } + maybeRefreshNodeData() { + const circleChanged = this.didCircleChange(); + if (!circleChanged && !this.nodeDataRefresh) + return; + this.contextNodeData = this.createNodeData(); + this.nodeData = this.contextNodeData?.nodeData ?? []; + this.nodeDataRefresh = false; + } + getAxisInnerRadius() { + const radiusAxis = this.axes[ChartAxisDirection31.Radius]; + return radiusAxis instanceof PolarAxis3 ? this.radius * radiusAxis.innerRadiusRatio : 0; + } + createNodeData() { + const { processedData, dataModel } = this; + if (!dataModel || !processedData || processedData.type !== "grouped") + return; + const angleAxis = this.axes[ChartAxisDirection31.Angle]; + const radiusAxis = this.axes[ChartAxisDirection31.Radius]; + const angleScale = angleAxis?.scale; + const radiusScale = radiusAxis?.scale; + if (!angleScale || !radiusScale) { + return; + } + const radiusValues = dataModel.resolveKeysById(this, "radiusValue", processedData); + const angleStartValues = dataModel.resolveColumnById(this, `angleValue-start`, processedData); + const angleEndValues = dataModel.resolveColumnById(this, `angleValue-end`, processedData); + const angleRawValues = dataModel.resolveColumnById(this, `angleValue-raw`, processedData); + const angleRangeIndex = dataModel.resolveProcessedDataIndexById(this, `angleValue-range`); + let groupPaddingInner = 0; + if (radiusAxis instanceof RadiusCategoryAxis) { + groupPaddingInner = radiusAxis.groupPaddingInner; + } + const { groupScale } = this; + const { index: groupIndex, visibleGroupCount } = this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this); + groupScale.domain = Array.from({ length: visibleGroupCount }).map((_, i) => String(i)); + groupScale.range = [0, Math.abs(radiusScale.bandwidth ?? 0)]; + groupScale.paddingInner = visibleGroupCount > 1 ? groupPaddingInner : 0; + const barWidth = groupScale.bandwidth >= 1 ? groupScale.bandwidth : groupScale.rawBandwidth; + const angleAxisReversed = angleAxis.isReversed(); + const radiusAxisReversed = radiusAxis.isReversed(); + const axisInnerRadius = radiusAxisReversed ? this.radius : this.getAxisInnerRadius(); + const axisOuterRadius = radiusAxisReversed ? this.getAxisInnerRadius() : this.radius; + const axisTotalRadius = axisOuterRadius + axisInnerRadius; + const angleDomain = this.getSeriesDomain(ChartAxisDirection31.Angle); + const { angleKey, radiusKey, angleName, radiusName, legendItemName, label } = this.properties; + const getLabelNodeDatum = (datum, angleDatum, x, y) => { + const labelText = this.getLabelText( + angleDatum, + datum, + angleKey, + "angle", + angleDomain, + label, + { value: angleDatum, datum, angleKey, radiusKey, angleName, radiusName, legendItemName } + ); + if (labelText) { + return { x, y, text: labelText, textAlign: "center", textBaseline: "middle" }; + } + }; + const nodeData = []; + const styles = getItemStyles4( + (nodeDatum, isHighlight, highlightState) => getItemStyle(this, nodeDatum, isHighlight, highlightState) + ); + const context = { + itemId: radiusKey, + nodeData, + labelData: nodeData, + styles + }; + if (!this.visible) + return context; + const { dataSources } = processedData; + const rawData = dataSources.get(this.id)?.data ?? []; + for (const { datumIndex, group } of dataModel.forEachGroupDatum(this, processedData)) { + const datum = rawData[datumIndex]; + const radiusDatum = radiusValues[datumIndex]; + if (radiusDatum == null) + return; + const angleDatum = angleRawValues[datumIndex]; + const angleStartDatum = angleStartValues[datumIndex]; + const angleEndDatum = angleEndValues[datumIndex]; + const isPositive = angleDatum >= 0 && !Object.is(angleDatum, -0); + const angleRange = group.aggregation[angleRangeIndex][isPositive ? 1 : 0]; + const reversed = isPositive === angleAxisReversed; + let startAngle = angleScale.convert(angleStartDatum, { clamp: true }); + let endAngle = angleScale.convert(angleEndDatum, { clamp: true }); + let rangeStartAngle = angleScale.convert(0, { clamp: true }); + let rangeEndAngle = angleScale.convert(angleRange, { clamp: true }); + if (reversed) { + [rangeStartAngle, rangeEndAngle] = [rangeEndAngle, rangeStartAngle]; + [startAngle, endAngle] = [endAngle, startAngle]; + } + const dataRadius = axisTotalRadius - radiusScale.convert(radiusDatum); + const innerRadius = dataRadius + groupScale.convert(String(groupIndex)); + const outerRadius = innerRadius + barWidth; + const midRadius = (innerRadius + outerRadius) / 2; + const midAngle = startAngle + angleBetween3(startAngle, endAngle) / 2; + const x = Math.cos(midAngle) * midRadius; + const y = Math.sin(midAngle) * midRadius; + const labelNodeDatum = this.properties.label.enabled ? getLabelNodeDatum(datum, angleDatum, x, y) : void 0; + const clipSector = new SectorBox4(startAngle, endAngle, innerRadius, outerRadius); + nodeData.push({ + series: this, + datum, + datumIndex, + point: { x, y, size: 0 }, + midPoint: { x, y }, + label: labelNodeDatum, + angleValue: angleDatum, + radiusValue: radiusDatum, + innerRadius, + outerRadius, + startAngle: rangeStartAngle, + endAngle: rangeEndAngle, + clipSector, + reversed, + index: datumIndex + }); + } + return context; + } + update({ seriesRect }) { + const resize = this.checkResize(seriesRect); + this.maybeRefreshNodeData(); + this.contentGroup.translationX = this.centerX; + this.contentGroup.translationY = this.centerY; + this.highlightGroup.translationX = this.centerX; + this.highlightGroup.translationY = this.centerY; + if (this.labelGroup) { + this.labelGroup.translationX = this.centerX; + this.labelGroup.translationY = this.centerY; + } + this.updateSectorSelection(this.itemSelection, false); + this.updateSectorSelection(this.highlightSelection, true); + this.updateLabels(); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateSectorSelection(selection, isHighlight) { + let selectionData = []; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + if (isHighlight) { + if (activeHighlight?.datum && activeHighlight.series === this) { + selectionData.push(activeHighlight); + } + } else { + selectionData = this.nodeData; + } + const { contextNodeData } = this; + if (!contextNodeData) { + return; + } + const highlightedDatum = this.ctx.highlightManager.getActiveHighlight(); + const fillBBox = this.getShapeFillBBox(); + const hasItemStylers = this.hasItemStylers(); + selection.update(selectionData, void 0, (datum) => this.getDatumId(datum)).each((node, nodeDatum) => { + const datum = readDatum(nodeDatum); + if (datum == null) + return; + if (hasItemStylers) { + const highlightState = this.getHighlightState(activeHighlight, isHighlight, nodeDatum.datumIndex); + nodeDatum.style = getItemStyle(this, nodeDatum, isHighlight, highlightState); + } + const style2 = nodeDatum.style ?? contextNodeData.styles[this.getHighlightState(highlightedDatum, isHighlight, nodeDatum.datumIndex)]; + const cornerRadius = style2.cornerRadius; + const fill = style2.fill; + const fillParams = module_support_exports.isGradientFill(fill) && fill.bounds !== "item" ? { centerX: 0, centerY: 0 } : void 0; + applyShapeStyle16(node, style2, fillBBox, fillParams); + node.lineJoin = "round"; + node.inset = node.stroke == null ? 0 : node.strokeWidth / 2; + node.startInnerCornerRadius = datum.reversed ? cornerRadius : 0; + node.startOuterCornerRadius = datum.reversed ? cornerRadius : 0; + node.endInnerCornerRadius = datum.reversed ? 0 : cornerRadius; + node.endOuterCornerRadius = datum.reversed ? 0 : cornerRadius; + if (isHighlight) { + node.startAngle = nodeDatum.startAngle; + node.endAngle = nodeDatum.endAngle; + node.clipSector = nodeDatum.clipSector; + node.innerRadius = nodeDatum.innerRadius; + node.outerRadius = nodeDatum.outerRadius; + } + }); + } + updateLabels() { + const { properties } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + this.labelSelection.update(this.nodeData).each((node, datum) => { + const isHighlight = false; + updateLabelNode8(this, node, properties, properties.label, datum.label, isHighlight, activeHighlight); + node.fillOpacity = this.getHighlightStyle(isHighlight, datum.datumIndex).opacity ?? 1; + }); + } + getBarTransitionFunctions() { + const angleScale = this.axes[ChartAxisDirection31.Angle]?.scale; + let axisZeroAngle = 0; + if (!angleScale) { + return prepareRadialBarSeriesAnimationFunctions(axisZeroAngle); + } + const d0 = Math.min(angleScale.domain[0], angleScale.domain[1]); + const d1 = Math.max(angleScale.domain[0], angleScale.domain[1]); + if (d0 <= 0 && d1 >= 0) { + axisZeroAngle = angleScale.convert(0); + } + return prepareRadialBarSeriesAnimationFunctions(axisZeroAngle); + } + animateEmptyUpdateReady() { + const { labelSelection } = this; + const fns = this.getBarTransitionFunctions(); + motion10.fromToMotion(this.id, "datums", this.ctx.animationManager, [this.itemSelection], fns); + seriesLabelFadeInAnimation8(this, "labels", this.ctx.animationManager, labelSelection); + } + animateClearingUpdateEmpty() { + const { itemSelection } = this; + const { animationManager } = this.ctx; + const fns = this.getBarTransitionFunctions(); + motion10.fromToMotion(this.id, "datums", animationManager, [itemSelection], fns); + seriesLabelFadeOutAnimation22(this, "labels", animationManager, this.labelSelection); + } + getTooltipContent(datumIndex) { + const { id: seriesId, dataModel, processedData, axes, properties } = this; + const { angleKey, angleName, radiusKey, radiusName, legendItemName, tooltip } = properties; + const angleAxis = axes[ChartAxisDirection31.Angle]; + const radiusAxis = axes[ChartAxisDirection31.Radius]; + const nodeDatum = this.nodeData?.[datumIndex]; + if (!dataModel || !processedData || !angleAxis || !radiusAxis || !nodeDatum) + return; + const datum = processedData.dataSources.get(this.id)?.data[datumIndex]; + const radiusValue = dataModel.resolveKeysById(this, `radiusValue`, processedData)[datumIndex]; + const angleValue = dataModel.resolveColumnById(this, `angleValue-raw`, processedData)[datumIndex]; + if (radiusValue == null) + return; + const format = getItemStyle(this, nodeDatum, false); + return this.formatTooltipWithContext( + tooltip, + { + heading: this.getAxisValueText(radiusAxis, "tooltip", radiusValue, datum, radiusKey, void 0), + symbol: this.legendItemSymbol(), + data: [ + { + label: angleName, + fallbackLabel: angleKey, + value: this.getAxisValueText(angleAxis, "tooltip", angleValue, datum, angleKey, void 0) + } + ] + }, + { + seriesId, + datum, + title: angleName, + angleKey, + angleName, + radiusKey, + radiusName, + legendItemName, + ...format + } + ); + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.itemSelection.nodes()); + } + legendItemSymbol() { + const { fill, stroke: stroke22, fillOpacity, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = getStyle( + this, + false, + false, + module_support_exports.HighlightState.None + ); + const markerStyle = { + fill: fill ?? "rgba(0, 0, 0, 0)", + stroke: stroke22 ?? "rgba(0, 0, 0, 0)", + fillOpacity, + strokeOpacity, + strokeWidth, + lineDash, + lineDashOffset + }; + if (isGradientFill3(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return { + marker: markerStyle + }; + } + getLegendData(legendType) { + if (legendType !== "category") { + return []; + } + const { id: seriesId, visible } = this; + const { angleKey, angleName, legendItemName, showInLegend } = this.properties; + return [ + { + legendType: "category", + id: seriesId, + itemId: angleKey, + seriesId, + enabled: visible, + label: { + text: legendItemName ?? angleName ?? angleKey + }, + symbol: this.legendItemSymbol(), + legendItemName, + hideInLegend: !showInLegend + } + ]; + } + getDatumId(datum) { + return createDatumId18(datum.radiusValue); + } + computeLabelsBBox() { + return null; + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `radialBar-stack-${groupIndex}-xValues`; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +RadialBarSeries.className = "RadialBarSeries"; +RadialBarSeries.type = "radial-bar"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs19, radialBarSeriesThemeableOptionsDef: radialBarSeriesThemeableOptionsDef2 } = module_support_exports; +var radialBarSeriesOptionsDef = { + ...commonSeriesOptionsDefs19, + ...radialBarSeriesThemeableOptionsDef2, + type: required(constant("radial-bar")), + angleKey: required(string), + radiusKey: required(string), + angleName: string, + radiusName: string, + legendItemName: string, + grouped: boolean, + stacked: boolean, + stackGroup: string, + normalizedTo: number +}; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE6 }, + FILL_GRADIENT_CONIC_SERIES_DEFAULTS: FILL_GRADIENT_CONIC_SERIES_DEFAULTS2, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS5, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS3 +} = module_support_exports; +var RADIAL_BAR_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_CONIC_SERIES_DEFAULTS2], + ["image", FILL_IMAGE_DEFAULTS5], + ["pattern", FILL_PATTERN_DEFAULTS3] + ] + }, + stroke: { $palette: "stroke" }, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" } + }, + highlight: module_support_exports.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE6.RADIUS_CATEGORY]: { + innerRadiusRatio: 0.2, + groupPaddingInner: 0.2, + paddingInner: 0.2, + paddingOuter: 0.1 + } + } +}; +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE7 } = module_support_exports.ThemeConstants; +var RadialBarModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radial-bar", + moduleFactory: (ctx) => new RadialBarSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE7.ANGLE_NUMBER }, { type: POLAR_AXIS_TYPE7.RADIUS_CATEGORY }], + themeTemplate: RADIAL_BAR_SERIES_THEME, + stackable: true, + groupable: true +}; +var RadialBarSeriesModule = { + type: "series", + name: "radial-bar", + chartType: "polar", + enterprise: true, + options: radialBarSeriesOptionsDef, + create: (ctx) => new RadialBarSeries(ctx) +}; +var { Property: Property80 } = module_support_exports; +var RadialColumnSeriesProperties = class extends RadialColumnSeriesBaseProperties { +}; +__decorateClass2([ + Property80 +], RadialColumnSeriesProperties.prototype, "columnWidthRatio", 2); +__decorateClass2([ + Property80 +], RadialColumnSeriesProperties.prototype, "maxColumnWidthRatio", 2); +var { ChartAxisDirection: ChartAxisDirection32, PolarAxis: PolarAxis4, RadialColumnShape: RadialColumnShape2, getRadialColumnWidth: getRadialColumnWidth2 } = module_support_exports; +var RadialColumnSeries = class extends RadialColumnSeriesBase { + constructor(moduleCtx) { + super(moduleCtx, { + animationResetFns: { + item: resetRadialColumnSelectionFn + } + }); + this.properties = new RadialColumnSeriesProperties(); + } + getStackId() { + const groupIndex = this.seriesGrouping?.groupIndex ?? this.id; + return `radarColumn-stack-${groupIndex}-yValues`; + } + nodeFactory() { + return new RadialColumnShape2(); + } + getColumnTransitionFunctions() { + const axisZeroRadius = this.isRadiusAxisReversed() ? this.radius : this.getAxisInnerRadius(); + return prepareRadialColumnAnimationFunctions(axisZeroRadius); + } + isRadiusAxisCircle() { + const radiusAxis = this.axes[ChartAxisDirection32.Radius]; + return radiusAxis instanceof PolarAxis4 ? radiusAxis.shape === "circle" : false; + } + updateItemPath(node, datum, highlight5) { + node.isBeveled = this.isRadiusAxisCircle(); + node.isRadiusAxisReversed = this.isRadiusAxisReversed(); + if (highlight5) { + node.innerRadius = datum.innerRadius; + node.outerRadius = datum.outerRadius; + node.startAngle = datum.startAngle; + node.endAngle = datum.endAngle; + node.columnWidth = datum.columnWidth; + node.axisInnerRadius = datum.axisInnerRadius; + node.axisOuterRadius = datum.axisOuterRadius; + } + } + getColumnWidth(startAngle, endAngle) { + const { columnWidthRatio = 0.5, maxColumnWidthRatio = 0.5 } = this.properties; + return getRadialColumnWidth2(startAngle, endAngle, this.radius, columnWidthRatio, maxColumnWidthRatio); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.styler != null || this.properties.label.itemStyler != null; + } +}; +RadialColumnSeries.className = "RadialColumnSeries"; +RadialColumnSeries.type = "radial-column"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs20, radialColumnSeriesThemeableOptionsDef: radialColumnSeriesThemeableOptionsDef2 } = module_support_exports; +var radialColumnSeriesOptionsDef = { + ...commonSeriesOptionsDefs20, + ...radialColumnSeriesThemeableOptionsDef2, + type: required(constant("radial-column")), + angleKey: required(string), + radiusKey: required(string), + angleName: string, + radiusName: string, + legendItemName: string, + grouped: boolean, + stacked: boolean, + stackGroup: string, + normalizedTo: number +}; +var { + ThemeConstants: { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE8, POLAR_AXIS_SHAPE: POLAR_AXIS_SHAPE22 }, + FILL_GRADIENT_RADIAL_SERIES_DEFAULTS: FILL_GRADIENT_RADIAL_SERIES_DEFAULTS22, + FILL_IMAGE_DEFAULTS: FILL_IMAGE_DEFAULTS6, + FILL_PATTERN_DEFAULTS: FILL_PATTERN_DEFAULTS4 +} = module_support_exports; +var RADIAL_COLUMN_SERIES_THEME = { + series: { + fill: { + $applySwitch: [ + { $path: "type" }, + { $palette: "fill" }, + ["gradient", FILL_GRADIENT_RADIAL_SERIES_DEFAULTS22], + ["image", FILL_IMAGE_DEFAULTS6], + ["pattern", FILL_PATTERN_DEFAULTS4] + ] + }, + stroke: { $palette: "stroke" }, + columnWidthRatio: 0.5, + maxColumnWidthRatio: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 1, 0] }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: false, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" } + }, + highlight: module_support_exports.multiSeriesHighlightStyle() + }, + axes: { + [POLAR_AXIS_TYPE8.ANGLE_CATEGORY]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE22.CIRCLE }, + groupPaddingInner: 0, + paddingInner: 0, + label: { + spacing: 10 + } + }, + [POLAR_AXIS_TYPE8.RADIUS_NUMBER]: { + shape: { $findFirstSiblingNotOperation: POLAR_AXIS_SHAPE22.CIRCLE }, + innerRadiusRatio: 0.5 + } + } +}; +var { POLAR_AXIS_TYPE: POLAR_AXIS_TYPE9 } = module_support_exports.ThemeConstants; +var RadialColumnModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["polar"], + identifier: "radial-column", + moduleFactory: (ctx) => new RadialColumnSeries(ctx), + defaultAxes: [{ type: POLAR_AXIS_TYPE9.ANGLE_CATEGORY }, { type: POLAR_AXIS_TYPE9.RADIUS_NUMBER }], + themeTemplate: RADIAL_COLUMN_SERIES_THEME, + stackable: true, + groupable: true +}; +var RadialColumnSeriesModule = { + type: "series", + name: "radial-column", + chartType: "polar", + enterprise: true, + options: radialColumnSeriesOptionsDef, + create: (ctx) => new RadialColumnSeries(ctx) +}; +var { SvgPath: SvgPath2, Rotatable: Rotatable2, Translatable: Translatable2, Scalable: Scalable22 } = module_support_exports; +var RadialGaugeNeedle = class extends Rotatable2(Scalable22(Translatable2(SvgPath2))) { + constructor() { + super(...arguments); + this.scalingCenterX = 0.5; + this.scalingCenterY = 0.5; + this.rotationCenterX = 0.5; + this.rotationCenterY = 0.5; + } +}; +RadialGaugeNeedle.defaultPathData = "M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z"; +var { getColorStops: getColorStops22, normalizeAngle360: normalizeAngle3606, normalizeAngle360Inclusive: normalizeAngle360Inclusive22, toDegrees: toDegrees2 } = module_support_exports; +var { BaseProperties: BaseProperties28, makeSeriesTooltip: makeSeriesTooltip21, SeriesProperties: SeriesProperties12, PropertiesArray: PropertiesArray8, AxisLabel: AxisLabel6, Property: Property81, Label: Label16 } = module_support_exports; +var RadialGaugeDefaultTargetLabelProperties = class extends Label16 { +}; +__decorateClass2([ + Property81 +], RadialGaugeDefaultTargetLabelProperties.prototype, "spacing", 2); +var RadialGaugeTargetProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.label = new RadialGaugeDefaultTargetLabelProperties(); + } + getStyle() { + const { + fill = "black", + fillOpacity = 1, + stroke: stroke22 = "black", + strokeWidth = 0, + strokeOpacity = 1, + lineDash = [0], + lineDashOffset = 0 + } = this; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "text", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "value", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "shape", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "placement", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "spacing", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "size", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "rotation", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "fill", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "stroke", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property81 +], RadialGaugeTargetProperties.prototype, "label", 2); +var RadialGaugeBarProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.enabled = true; + this.fills = new PropertiesArray8(module_support_exports.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } + getStyle(defaultColorRange, scale2) { + const { + enabled, + fill, + fills, + fillMode, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const barFill = enabled ? fill ?? createConicGradient(fills, fillMode, defaultColorRange, scale2) : "none"; + return { + fill: barFill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass2([ + Property81 +], RadialGaugeBarProperties.prototype, "enabled", 2); +__decorateClass2([ + Property81 +], RadialGaugeBarProperties.prototype, "fills", 2); +__decorateClass2([ + Property81 +], RadialGaugeBarProperties.prototype, "fillMode", 2); +__decorateClass2([ + Property81 +], RadialGaugeBarProperties.prototype, "fill", 2); +__decorateClass2([ + Property81 +], RadialGaugeBarProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property81 +], RadialGaugeBarProperties.prototype, "stroke", 2); +__decorateClass2([ + Property81 +], RadialGaugeBarProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property81 +], RadialGaugeBarProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property81 +], RadialGaugeBarProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property81 +], RadialGaugeBarProperties.prototype, "lineDashOffset", 2); +var RadialGaugeScaleIntervalProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.values = void 0; + this.step = void 0; + this.minSpacing = 0; + this.maxSpacing = 1e3; + } +}; +__decorateClass2([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "values", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "step", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "minSpacing", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleIntervalProperties.prototype, "maxSpacing", 2); +var RadialGaugeScaleLabelProperties = class extends AxisLabel6 { +}; +var RadialGaugeScaleProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.min = 0; + this.max = 1; + this.fills = new PropertiesArray8(module_support_exports.StopProperties); + this.fillMode = "continuous"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + this.defaultFill = "black"; + this.interval = new RadialGaugeScaleIntervalProperties(); + this.label = new RadialGaugeScaleLabelProperties(); + } + getStyle(barEnabled, defaultColorRange, scale2) { + const { + fill, + fills, + defaultFill, + fillMode, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + } = this; + const scaleFill = fill ?? (barEnabled && fills.length === 0 ? defaultFill : void 0) ?? createConicGradient(fills, fillMode, defaultColorRange, scale2); + return { + fill: scaleFill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "min", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "max", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "fills", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "fillMode", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "fill", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "stroke", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "defaultFill", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "interval", 2); +__decorateClass2([ + Property81 +], RadialGaugeScaleProperties.prototype, "label", 2); +var RadialGaugeNeedleProperties = class extends BaseProperties28 { + constructor() { + super(...arguments); + this.enabled = true; + this.spacing = 0; + this.fill = "black"; + this.fillOpacity = 1; + this.stroke = "black"; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass2([ + Property81 +], RadialGaugeNeedleProperties.prototype, "enabled", 2); +__decorateClass2([ + Property81 +], RadialGaugeNeedleProperties.prototype, "radiusRatio", 2); +__decorateClass2([ + Property81 +], RadialGaugeNeedleProperties.prototype, "spacing", 2); +__decorateClass2([ + Property81 +], RadialGaugeNeedleProperties.prototype, "fill", 2); +__decorateClass2([ + Property81 +], RadialGaugeNeedleProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property81 +], RadialGaugeNeedleProperties.prototype, "stroke", 2); +__decorateClass2([ + Property81 +], RadialGaugeNeedleProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property81 +], RadialGaugeNeedleProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property81 +], RadialGaugeNeedleProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property81 +], RadialGaugeNeedleProperties.prototype, "lineDashOffset", 2); +var RadialGaugeLabelProperties = class extends AutoSizedLabel { +}; +__decorateClass2([ + Property81 +], RadialGaugeLabelProperties.prototype, "text", 2); +var RadialGaugeSecondaryLabelProperties = class extends AutoSizedSecondaryLabel { +}; +__decorateClass2([ + Property81 +], RadialGaugeSecondaryLabelProperties.prototype, "text", 2); +var RadialGaugeSeriesProperties = class extends SeriesProperties12 { + constructor() { + super(...arguments); + this.startAngle = 0; + this.endAngle = 0; + this.segmentation = new GaugeSegmentationProperties(); + this.defaultColorRange = []; + this.targets = new PropertiesArray8(RadialGaugeTargetProperties); + this.defaultTarget = new RadialGaugeTargetProperties(); + this.outerRadiusRatio = 1; + this.innerRadiusRatio = 1; + this.cornerRadius = 0; + this.cornerMode = "container"; + this.spacing = 0; + this.scale = new RadialGaugeScaleProperties(); + this.bar = new RadialGaugeBarProperties(); + this.needle = new RadialGaugeNeedleProperties(); + this.label = new RadialGaugeLabelProperties(); + this.secondaryLabel = new RadialGaugeSecondaryLabelProperties(); + this.tooltip = makeSeriesTooltip21(); + } +}; +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "value", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "startAngle", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "endAngle", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "segmentation", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "targets", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "defaultTarget", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "outerRadiusRatio", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "innerRadiusRatio", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "outerRadius", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "innerRadius", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "cornerMode", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "spacing", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "scale", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "bar", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "needle", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "secondaryLabel", 2); +__decorateClass2([ + Property81 +], RadialGaugeSeriesProperties.prototype, "tooltip", 2); +function createConicGradient(fills, fillMode, defaultColorRange, scale2) { + const { domain, range: range22 } = scale2; + const [startAngle, endAngle] = range22; + const conicAngle = normalizeAngle3606((startAngle + endAngle) / 2 + Math.PI); + const sweepAngle = normalizeAngle360Inclusive22(endAngle - startAngle); + const colorStops = getColorStops22(fills, defaultColorRange, domain, fillMode).map( + ({ color: color6, stop }) => { + stop = Math.min(Math.max(stop, 0), 1); + const angle2 = startAngle + sweepAngle * stop; + stop = (angle2 - conicAngle) / (2 * Math.PI); + stop = (stop % 1 + 1) % 1; + return { stop, color: color6 }; + } + ); + return { + type: "gradient", + gradient: "conic", + colorSpace: "oklch", + colorStops, + bounds: "series", + rotation: toDegrees2(conicAngle) + 90 + }; +} +var { SectorBox: SectorBox5 } = module_support_exports; +function computeClipSector(datum) { + const { startAngle, endAngle, clipStartAngle, clipEndAngle, innerRadius, outerRadius } = datum; + if (clipStartAngle == null || clipEndAngle == null) + return; + return new SectorBox5( + Math.max(clipStartAngle, startAngle), + Math.min(clipEndAngle, endAngle), + innerRadius, + outerRadius + ); +} +function clipSectorVisibility(startAngle, endAngle, clipSector) { + return Math.max(startAngle, clipSector.startAngle) <= Math.min(endAngle, clipSector.endAngle); +} +function hasClipSector(datum) { + return datum.clipStartAngle != null && datum.clipEndAngle != null; +} +function datumClipSector(datum, zero) { + const { clipStartAngle, clipEndAngle, innerRadius, outerRadius } = datum; + return new SectorBox5(clipStartAngle, zero ? clipStartAngle : clipEndAngle, innerRadius, outerRadius); +} +function prepareRadialGaugeSeriesAnimationFunctions(initialLoad, initialStartAngle) { + const phase = initialLoad ? "initial" : "update"; + const node = { + fromFn(sect, datum) { + const previousDatum = sect.previousDatum; + let { startAngle, endAngle } = previousDatum ?? datum; + const previousClipSector = previousDatum != null && hasClipSector(previousDatum) ? datumClipSector(previousDatum, initialLoad) : void 0; + const nextClipSector = hasClipSector(datum) ? datumClipSector(datum, initialLoad) : void 0; + let clipSector; + if (previousClipSector != null && nextClipSector != null) { + clipSector = previousClipSector; + } else if (previousClipSector == null && nextClipSector != null) { + clipSector = nextClipSector; + startAngle = datum.startAngle; + endAngle = datum.endAngle; + } else if (previousClipSector != null && nextClipSector == null) { + clipSector = void 0; + startAngle = datum.startAngle; + endAngle = datum.endAngle; + } else if (initialLoad) { + endAngle = startAngle; + } + return { startAngle, endAngle, clipSector, phase }; + }, + toFn(_sect, datum) { + const { startAngle, endAngle } = datum; + let clipSector; + if (hasClipSector(datum)) { + clipSector = datumClipSector(datum, false); + } + return { startAngle, endAngle, clipSector }; + }, + applyFn(sect, params) { + const { startAngle, endAngle } = params; + let { clipSector } = params; + if (clipSector != null) { + clipSector = new SectorBox5( + Math.max(startAngle, clipSector.startAngle), + Math.min(endAngle, clipSector.endAngle), + clipSector.innerRadius, + clipSector.outerRadius + ); + } + const visible = clipSector == null || clipSectorVisibility(startAngle, endAngle, clipSector); + sect.startAngle = startAngle; + sect.endAngle = endAngle; + sect.clipSector = clipSector; + sect.visible = visible; + } + }; + const needle = { + fromFn(needleNode) { + let { angle: rotation } = needleNode.previousDatum ?? needleNode.datum; + if (initialLoad) { + rotation = initialStartAngle; + } + return { rotation, phase }; + }, + toFn(_needleNode, datum) { + const { angle: rotation } = datum; + return { rotation }; + } + }; + return { node, needle }; +} +function resetRadialGaugeSeriesResetSectorFunction(_node, datum) { + const { startAngle, endAngle } = datum; + const clipSector = computeClipSector(datum); + const visible = clipSector == null || clipSectorVisibility(startAngle, endAngle, clipSector); + return { startAngle, endAngle, clipSector, visible }; +} +function resetRadialGaugeSeriesResetNeedleFunction(_node, datum) { + const { angle: angle2 } = datum; + return { rotation: angle2 }; +} +var verticalAlignFactors3 = { + top: 0, + middle: 0.5, + bottom: 1 +}; +function formatRadialGaugeLabels(series, ctx, selection, opts, innerRadius, datumOverrides) { + const { padding: padding2, textAlign, verticalAlign } = opts; + let labelDatum; + let secondaryLabelDatum; + selection.each((_node, datum) => { + if (datum.label === "primary") { + labelDatum = datum; + } else if (datum.label === "secondary") { + secondaryLabelDatum = datum; + } + }); + if (labelDatum == null) + return; + const labelText = getLabelText(series.id, ctx, labelDatum, datumOverrides?.label); + if (labelText == null) + return; + const secondaryLabelText = secondaryLabelDatum == null ? void 0 : getLabelText(series.id, ctx, secondaryLabelDatum, datumOverrides?.secondaryLabel); + const params = { padding: padding2 }; + const horizontalFactor = textAlign === "center" ? 2 : 1; + const verticalFactor = verticalAlign === "middle" ? 2 : 1; + const sizeFittingHeight = (height22) => ({ + width: Math.sqrt(Math.max(innerRadius ** 2 - (height22 / verticalFactor) ** 2, 0)) * horizontalFactor, + height: Math.min(height22, verticalFactor * innerRadius), + meta: null + }); + let labelLayout; + let secondaryLabelLayout; + let height2; + if (secondaryLabelDatum != null && secondaryLabelText != null) { + const layout = formatStackedLabels( + toPlainText(labelText), + labelDatum, + toPlainText(secondaryLabelText), + secondaryLabelDatum, + params, + sizeFittingHeight + ); + labelLayout = layout?.label; + secondaryLabelLayout = layout?.secondaryLabel; + height2 = layout?.height ?? 0; + } else { + const layout = formatSingleLabel(toPlainText(labelText), labelDatum, params, sizeFittingHeight); + labelLayout = layout?.[0]; + secondaryLabelLayout = void 0; + height2 = layout?.[0].height ?? 0; + } + const rectYOffset = height2 * verticalAlignFactors3[verticalAlign]; + selection.each((label, datum) => { + let layout; + if (datum.label === "primary") { + layout = labelLayout; + } else if (datum.label === "secondary") { + layout = secondaryLabelLayout; + } + if (layout == null) { + label.visible = false; + return; + } + label.visible = true; + label.text = layout.text; + label.fontSize = layout.fontSize; + label.lineHeight = layout.lineHeight; + label.textAlign = textAlign; + label.textBaseline = "middle"; + const rectOriginInLabelRect = datum.label === "primary" ? layout.height / 2 : height2 - layout.height / 2; + label.y = datum.centerY + rectOriginInLabelRect - rectYOffset; + label.x = datum.centerX; + }); +} +var { + fromToMotion: fromToMotion5, + resetMotion: resetMotion4, + SeriesNodePickMode: SeriesNodePickMode15, + StateMachine: StateMachine15, + createDatumId: createDatumId19, + normalizeAngle360: normalizeAngle3607, + normalizeAngle360Inclusive: normalizeAngle360Inclusive3, + isBetweenAngles: isBetweenAngles22, + sectorBox: sectorBox2, + toRadians: toRadians5, + BBox: BBox24, + Group: Group19, + PointerEvents: PointerEvents12, + Selection: Selection16, + Sector: Sector6, + SectorBox: SectorBox6, + Text: Text9, + Marker: Marker6, + tickFormat: tickFormat22, + applyShapeStyle: applyShapeStyle17, + mergeDefaults: mergeDefaults19 +} = module_support_exports; +var targetPlacementRotation = { + inside: 90, + middle: 0, + outside: -90 +}; +var outsideLabelPlacements = [ + { textAlign: "left", textBaseline: "top" }, + { textAlign: "right", textBaseline: "top" }, + { textAlign: "right", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "bottom" } +]; +var insideLabelPlacements = [ + { textAlign: "right", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "bottom" }, + { textAlign: "left", textBaseline: "top" }, + { textAlign: "right", textBaseline: "top" } +]; +var RadialGaugeSeries = class extends module_support_exports.Series { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode15.EXACT_SHAPE_MATCH, SeriesNodePickMode15.NEAREST_NODE] + }); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.properties = new RadialGaugeSeriesProperties(); + this.scale = new LinearAngleScale(); + this.scaleGroup = this.contentGroup.appendChild(new Group19({ name: "scaleGroup" })); + this.itemGroup = this.contentGroup.appendChild(new Group19({ name: "itemGroup" })); + this.itemNeedleGroup = this.contentGroup.appendChild(new Group19({ name: "itemNeedleGroup" })); + this.itemTargetGroup = this.contentGroup.appendChild(new Group19({ name: "itemTargetGroup" })); + this.itemTargetLabelGroup = this.contentGroup.appendChild(new Group19({ name: "itemTargetLabelGroup" })); + this.itemLabelGroup = this.contentGroup.appendChild(new Group19({ name: "itemLabelGroup" })); + this.highlightTargetGroup = this.highlightGroup.appendChild( + new Group19({ name: "itemTargetLabelGroup" }) + ); + this.tickGroup = this.contentGroup.appendChild(new Group19({ name: "tickGroup" })); + this.scaleSelection = Selection16.select( + this.scaleGroup, + () => this.nodeFactory() + ); + this.datumSelection = Selection16.select( + this.itemGroup, + () => this.nodeFactory() + ); + this.needleSelection = Selection16.select( + this.itemNeedleGroup, + RadialGaugeNeedle + ); + this.targetSelection = Selection16.select( + this.itemTargetGroup, + () => this.markerFactory() + ); + this.targetLabelSelection = Selection16.select(this.itemTargetLabelGroup, Text9); + this.labelSelection = Selection16.select( + this.itemLabelGroup, + Text9 + ); + this.highlightTargetSelection = Selection16.select(this.highlightTargetGroup, () => this.markerFactory()); + this.tickSelection = Selection16.select(this.tickGroup, module_support_exports.TransformableText); + this.datumUnion = new DatumUnion(); + this.animationState = new StateMachine15("empty", { + empty: { + update: { + target: "ready", + action: () => this.animateEmptyUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + ready: { + updateData: "waiting", + clear: "clearing", + resize: () => this.animateReadyResize(), + reset: "empty", + skip: "ready" + }, + waiting: { + update: { + target: "ready", + action: () => this.animateWaitingUpdateReady() + }, + reset: "empty", + skip: "ready" + }, + clearing: { + update: { + target: "empty" + }, + reset: "empty", + skip: "ready" + } + }); + this.scaleGroup.pointerEvents = PointerEvents12.None; + this.tickGroup.pointerEvents = PointerEvents12.None; + this.itemNeedleGroup.pointerEvents = PointerEvents12.None; + this.itemLabelGroup.pointerEvents = PointerEvents12.None; + } + get hasData() { + return this.properties.value != null; + } + nodeFactory() { + return new Sector6(); + } + markerFactory() { + const marker = new Marker6(); + marker.size = 1; + return marker; + } + processData() { + this.nodeDataRefresh = true; + this.animationState.transition("updateData"); + } + formatLabel(value) { + const { min, max } = this.properties.scale; + return formatLabel(value, { min, max }); + } + layoutScale() { + const { scale: scale2, properties } = this; + const { seriesRectWidth, seriesRectHeight } = this.nodeDataDependencies; + const { scale: scaleProps, outerRadius } = this.properties; + const { min, max, label, interval } = scaleProps; + const startAngle = toRadians5(properties.startAngle - 90); + const endAngle = toRadians5(properties.endAngle - 90); + const sweepAngle = normalizeAngle360Inclusive3(endAngle - startAngle); + const largerThanHalf = sweepAngle > Math.PI; + const containsTop = largerThanHalf || isBetweenAngles22(1.5 * Math.PI, startAngle, endAngle); + const containsRight = largerThanHalf || isBetweenAngles22(0 * Math.PI, startAngle, endAngle); + const containsBottom = largerThanHalf || isBetweenAngles22(0.5 * Math.PI, startAngle, endAngle); + const containsLeft = largerThanHalf || isBetweenAngles22(1 * Math.PI, startAngle, endAngle); + let textAlign; + if (containsLeft && !containsRight) { + textAlign = "right"; + } else if (!containsLeft && containsRight) { + textAlign = "left"; + } else { + textAlign = "center"; + } + let verticalAlign; + if (containsTop && !containsBottom) { + verticalAlign = "bottom"; + } else if (!containsTop && containsBottom) { + verticalAlign = "top"; + } else { + verticalAlign = "middle"; + } + const unitBox = sectorBox2({ + startAngle, + endAngle, + innerRadius: 0, + outerRadius: 0.5 + }); + const centerXOffset = -(unitBox.x + unitBox.width / 2) * 2; + const centerYOffset = -(unitBox.y + unitBox.height / 2) * 2; + const unitBoxSize = Math.min(seriesRectWidth / unitBox.width, seriesRectHeight / unitBox.height); + scale2.domain = [min, max]; + scale2.range = [startAngle, endAngle]; + scale2.arcLength = unitBoxSize / 2; + const { maxSpacing, minSpacing } = interval; + const { arcLength } = scale2; + const minTickCount = maxSpacing ? Math.floor(arcLength / maxSpacing) : 1; + const maxTickCount = minSpacing ? Math.floor(arcLength / minSpacing) : Infinity; + const preferredTickCount = Math.floor(4 / Math.PI * Math.abs(scale2.range[0] - scale2.range[1])); + const tickCount = Math.max(minTickCount, Math.min(maxTickCount, preferredTickCount)); + const ticks = interval.values ?? scale2.ticks({ + nice: false, + interval: interval.step, + minTickCount, + maxTickCount, + tickCount + })?.ticks ?? []; + const tickFormatter = tickFormat22(ticks, typeof label.format === "string" ? label.format : void 0); + const measurer22 = cachedTextMeasurer(label); + const tickData = ticks.map((value, index) => { + let text2; + if (label.formatter) { + text2 = formatWithContext(this.ctx, label.formatter, { + value, + index, + domain: scale2.domain, + boundSeries: void 0 + }); + } + text2 ?? (text2 = tickFormatter?.(value)); + if (text2 == null) + return; + const { width: width2, height: height2 } = isArray(text2) ? measureTextSegments(text2, label) : measurer22.measureLines(text2); + return { index, value, text: text2, width: width2, height: height2 }; + }).filter((value) => value != null); + const maxWidth = tickData.reduce((m, t) => Math.max(m, t.width), 0); + const maxHeight = tickData.reduce((m, t) => Math.max(m, t.height), 0); + const labelInset = label.enabled ? Math.max(maxWidth, maxHeight) + label.spacing : 0; + const radiusBounds = Math.max( + 0.5 * unitBoxSize - labelInset, + // seriesRect may have negative size + 0 + ); + const radius = outerRadius ?? radiusBounds; + this.centerX = seriesRectWidth / 2 + centerXOffset * radius; + this.centerY = seriesRectHeight / 2 + centerYOffset * radius; + this.radius = radius; + this.textAlign = textAlign; + this.verticalAlign = verticalAlign; + return tickData; + } + getShapeFillBBox() { + const { centerX, centerY, radius } = this; + const bbox = new BBox24(centerX - radius, centerY - radius, 2 * radius, 2 * radius); + return { + series: bbox, + axis: bbox + }; + } + getTargets() { + const { properties } = this; + const defaultTarget = properties.defaultTarget; + return Array.from(properties.targets).map((target) => { + const { + text: text2 = defaultTarget.text, + value = defaultTarget.value ?? 0, + shape = defaultTarget.shape ?? "triangle", + rotation = defaultTarget.rotation ?? 0, + placement = defaultTarget.placement ?? "middle", + spacing = defaultTarget.spacing ?? 0, + size = defaultTarget.size ?? 0 + } = target; + const { + enabled: labelEnabled = defaultTarget.label.enabled, + color: labelColor = defaultTarget.label.color ?? "black", + fontStyle: labelFontStyle = defaultTarget.label.fontStyle ?? "normal", + fontWeight: labelFontWeight = defaultTarget.label.fontWeight ?? "normal", + fontSize: labelFontSize = defaultTarget.label.fontSize, + fontFamily: labelFontFamily = defaultTarget.label.fontFamily, + spacing: labelSpacing = defaultTarget.label.spacing ?? 0 + } = target.label; + return { + text: text2, + value, + shape, + placement, + spacing, + size, + rotation, + label: { + enabled: labelEnabled, + color: labelColor, + fontStyle: labelFontStyle, + fontWeight: labelFontWeight, + fontSize: labelFontSize, + fontFamily: labelFontFamily, + spacing: labelSpacing + }, + style: target.getStyle() + }; + }); + } + getTargetRadius(target) { + const { radius, properties } = this; + const { innerRadiusRatio, outerRadiusRatio } = properties; + const { placement, spacing, size } = target; + const outerRadius = radius * outerRadiusRatio; + const innerRadius = radius * innerRadiusRatio; + switch (placement) { + case "inside": + return Math.max(innerRadius - spacing - size / 2, 0); + case "outside": + return outerRadius + spacing + size / 2; + default: + return (innerRadius + outerRadius) / 2; + } + } + getTargetLabel(target) { + const { scale: scale2 } = this; + const { value, size, placement, label } = target; + const { spacing, color: fill, fontStyle, fontWeight, fontSize, fontFamily } = label; + const lineHeight = void 0; + const angle2 = scale2.convert(value); + const quadrant = Math.trunc(normalizeAngle3607(angle2) / (Math.PI / 2)); + const offset = size / 2 + spacing; + let textAlign; + let textBaseline; + let offsetX; + let offsetY; + switch (placement) { + case "outside": + ({ textAlign, textBaseline } = outsideLabelPlacements[quadrant]); + offsetX = offset * Math.cos(angle2); + offsetY = offset * Math.sin(angle2); + break; + case "inside": + ({ textAlign, textBaseline } = insideLabelPlacements[quadrant]); + offsetX = -offset * Math.cos(angle2); + offsetY = -offset * Math.sin(angle2); + break; + default: + textAlign = "center"; + textBaseline = "bottom"; + offsetX = 0; + offsetY = -offset; + break; + } + return { + offsetX, + offsetY, + fill, + textAlign, + textBaseline, + fontStyle, + fontWeight, + fontSize, + fontFamily, + lineHeight + }; + } + createNodeData() { + const tickData = this.layoutScale(); + const { id: seriesId, scale: scale2, properties, radius, centerX, centerY } = this; + const { + value, + innerRadiusRatio, + outerRadiusRatio, + segmentation, + cornerRadius, + cornerMode, + needle, + bar, + scale: scaleProps, + label, + secondaryLabel + } = properties; + const { + outerRadius = radius * outerRadiusRatio, + innerRadius = radius * innerRadiusRatio, + defaultColorRange + } = properties; + const targets = this.getTargets(); + const nodeData = []; + const targetData = []; + const needleData = []; + const labelData = []; + const scaleData = []; + const cornersOnAllItems = cornerMode === "item"; + const containerStartAngle = scale2.convert(scale2.domain[0]); + const containerEndAngle = scale2.convert(value); + const maxTicks = Math.ceil(normalizeAngle360Inclusive3(containerEndAngle - containerStartAngle) * radius); + let segments = segmentation.enabled ? segmentation.interval.getSegments(scale2, maxTicks) : void 0; + const barStyle = bar.getStyle(defaultColorRange, scale2); + const scaleStyle = scaleProps.getStyle(bar.enabled, defaultColorRange, scale2); + if (segments == null && cornersOnAllItems) { + const segmentStart = Math.min(...scale2.domain); + const segmentEnd = Math.max(...scale2.domain); + const datum = { value, segmentStart, segmentEnd }; + const appliedCornerRadius = Math.min(cornerRadius, (outerRadius - innerRadius) / 2); + const angleInset = appliedCornerRadius / ((innerRadius + outerRadius) / 2); + nodeData.push({ + series: this, + itemId: `value`, + datum, + datumIndex: { + type: 0 + /* Node */ + }, + type: 0, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: containerStartAngle - angleInset, + endAngle: containerEndAngle + angleInset, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornerRadius, + endCornerRadius: cornerRadius, + style: barStyle + }); + scaleData.push({ + series: this, + itemId: `scale`, + datum, + datumIndex: { + type: 0 + /* Node */ + }, + type: 0, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: scale2.range[0] - angleInset, + endAngle: scale2.range[1] + angleInset, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornerRadius, + endCornerRadius: cornerRadius, + style: scaleStyle + }); + } else { + segments ?? (segments = scale2.domain); + for (let i = 0; i < segments.length - 1; i++) { + const segmentStart = segments[i]; + const segmentEnd = segments[i + 1]; + const datum = { value, segmentStart, segmentEnd }; + const isStart = i === 0; + const isEnd = i === segments.length - 2; + const itemStartAngle = scale2.convert(segmentStart); + const itemEndAngle = scale2.convert(segmentEnd); + nodeData.push({ + series: this, + itemId: `value-${i}`, + datum, + datumIndex: { + type: 0 + /* Node */ + }, + type: 0, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: itemStartAngle, + endAngle: itemEndAngle, + clipStartAngle: containerStartAngle, + clipEndAngle: containerEndAngle, + startCornerRadius: cornersOnAllItems || isStart ? cornerRadius : 0, + endCornerRadius: cornersOnAllItems || isEnd ? cornerRadius : 0, + style: barStyle + }); + scaleData.push({ + series: this, + itemId: `scale-${i}`, + datum, + datumIndex: { + type: 0 + /* Node */ + }, + type: 0, + centerX, + centerY, + outerRadius, + innerRadius, + startAngle: itemStartAngle, + endAngle: itemEndAngle, + clipStartAngle: void 0, + clipEndAngle: void 0, + startCornerRadius: cornersOnAllItems || isStart ? cornerRadius : 0, + endCornerRadius: cornersOnAllItems || isEnd ? cornerRadius : 0, + style: scaleStyle + }); + } + } + if (!needle.enabled && label.enabled) { + const { + text: text2, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter: formatter2 = (params) => this.formatLabel(params.value) + } = label; + labelData.push({ + label: "primary", + centerX, + centerY, + text: text2, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter: formatter2 + }); + } + if (!needle.enabled && secondaryLabel.enabled) { + const { + text: text2, + color: fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter: formatter2 + } = secondaryLabel; + labelData.push({ + label: "secondary", + centerX, + centerY, + text: text2, + value, + fill, + fontSize, + minimumFontSize, + fontStyle, + fontWeight, + fontFamily, + lineHeight, + formatter: formatter2 + }); + } + if (needle.enabled) { + let needleRadius = needle.radiusRatio == null ? innerRadius : radius * needle.radiusRatio; + needleRadius = Math.max(needleRadius - needle.spacing, 0); + const needleAngle = scale2.convert(value); + needleData.push({ + centerX, + centerY, + radius: needleRadius, + angle: needleAngle, + series: this + }); + } + for (let i = 0; i < targets.length; i += 1) { + const target = targets[i]; + const { value: targetValue, text: text2, size, shape, style: style2 } = target; + if (targetValue < Math.min(...scale2.domain) || targetValue > Math.max(...scale2.domain)) { + continue; + } + const targetRadius = this.getTargetRadius(target); + const targetAngle = scale2.convert(targetValue); + const targetRotation = toRadians5(target.rotation + targetPlacementRotation[target.placement]); + targetData.push({ + series: this, + itemId: `target-${i}`, + midPoint: { + x: targetRadius * Math.cos(targetAngle) + centerX, + y: targetRadius * Math.sin(targetAngle) + centerY + }, + datum: { value: targetValue }, + datumIndex: { type: 1, index: i }, + type: 1, + value: targetValue, + text: text2, + centerX, + centerY, + shape, + radius: targetRadius, + angle: targetAngle, + rotation: targetRotation, + size, + label: this.getTargetLabel(target), + style: style2 + }); + } + return { + itemId: seriesId, + nodeData, + needleData, + targetData, + labelData, + scaleData, + tickData + }; + } + updateSelections(resize) { + if (this.nodeDataRefresh || resize) { + this.contextNodeData = this.createNodeData(); + this.nodeDataRefresh = false; + } + } + highlightDatum(node) { + if (node != null && node.series === this && node.type === 1) { + return node; + } + } + update({ seriesRect }) { + const { + datumSelection, + labelSelection, + needleSelection, + targetSelection, + targetLabelSelection, + scaleSelection, + highlightTargetSelection, + tickSelection + } = this; + const resize = this.checkResize(seriesRect); + this.updateSelections(resize); + this.contentGroup.visible = this.visible; + this.contentGroup.opacity = this.getOpacity(); + const nodeData = this.contextNodeData?.nodeData ?? []; + const labelData = this.contextNodeData?.labelData ?? []; + const needleData = this.contextNodeData?.needleData ?? []; + const targetData = this.contextNodeData?.targetData ?? []; + const scaleData = this.contextNodeData?.scaleData ?? []; + const tickData = this.contextNodeData?.tickData ?? []; + const highlightTargetDatum = this.highlightDatum(this.ctx.highlightManager.getActiveHighlight()); + this.scaleSelection = this.updateScaleSelection({ scaleData, scaleSelection }); + this.updateScaleNodes({ scaleSelection }); + this.needleSelection = this.updateNeedleSelection({ needleData, needleSelection }); + this.updateNeedleNodes({ needleSelection }); + this.targetSelection = this.updateTargetSelection({ targetData, targetSelection }); + this.updateTargetStyles({ targetSelection, isHighlight: false }); + this.updateTargetNodes({ targetSelection }); + this.targetLabelSelection = this.updateTargetLabelSelection({ targetData, targetLabelSelection }); + this.updateTargetLabelNodes({ targetLabelSelection }); + this.datumSelection = this.updateDatumSelection({ nodeData, datumSelection }); + this.updateDatumNodes({ datumSelection }); + this.labelSelection = this.updateLabelSelection({ labelData, labelSelection }); + this.updateLabelNodes({ labelSelection }); + this.highlightTargetSelection = this.updateTargetSelection({ + targetData: highlightTargetDatum == null ? [] : [highlightTargetDatum], + targetSelection: highlightTargetSelection + }); + this.updateTargetStyles({ targetSelection: highlightTargetSelection, isHighlight: true }); + this.updateTargetNodes({ targetSelection: highlightTargetSelection }); + this.tickSelection = this.updateTickSelection({ tickData, tickSelection }); + this.updateTickNodes({ tickSelection }); + if (resize) { + this.animationState.transition("resize"); + } + this.animationState.transition("update"); + } + updateDatumSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => { + return createDatumId19(opts.nodeData.length, datum.itemId); + }); + } + updateDatumNodes(opts) { + const { datumSelection } = opts; + const { ctx, properties } = this; + const { segmentation } = properties; + const sectorSpacing = segmentation.spacing ?? 0; + const animationDisabled = ctx.animationManager.isSkipped(); + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((sector, datum) => { + const { centerX, centerY, innerRadius, outerRadius, startCornerRadius, endCornerRadius } = datum; + sector.centerX = centerX; + sector.centerY = centerY; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + sector.pointerEvents = this.properties.bar.enabled ? module_support_exports.PointerEvents.All : module_support_exports.PointerEvents.None; + applyShapeStyle17(sector, datum.style, fillBBox); + sector.startOuterCornerRadius = startCornerRadius; + sector.startInnerCornerRadius = startCornerRadius; + sector.endOuterCornerRadius = endCornerRadius; + sector.endInnerCornerRadius = endCornerRadius; + sector.radialEdgeInset = (sectorSpacing + sector.strokeWidth) / 2; + sector.concentricEdgeInset = sector.strokeWidth / 2; + if (animationDisabled || sector.previousDatum == null) { + sector.setProperties(resetRadialGaugeSeriesResetSectorFunction(sector, datum)); + } + }); + this.datumUnion.update(datumSelection, this.itemGroup, module_support_exports.Sector, (node, first2, last) => { + node.clipSector ?? (node.clipSector = new SectorBox6(Number.NaN, Number.NaN, Number.NaN, Number.NaN)); + node.centerX = first2.centerX; + node.centerY = first2.centerY; + node.outerRadius = node.clipSector.outerRadius = first2.outerRadius; + node.innerRadius = node.clipSector.innerRadius = first2.innerRadius; + node.startAngle = node.clipSector.startAngle = first2.startAngle; + node.startInnerCornerRadius = first2.startInnerCornerRadius; + node.startOuterCornerRadius = first2.startOuterCornerRadius; + node.endAngle = last.endAngle; + node.clipSector.endAngle = last.clipSector?.endAngle ?? last.endAngle; + node.endInnerCornerRadius = last.endInnerCornerRadius; + node.endOuterCornerRadius = last.endOuterCornerRadius; + node.pointerEvents = module_support_exports.PointerEvents.None; + }); + } + updateScaleSelection(opts) { + return opts.scaleSelection.update(opts.scaleData, void 0, (datum) => { + return createDatumId19(opts.scaleData.length, datum.itemId); + }); + } + updateScaleNodes(opts) { + const { scaleSelection } = opts; + const { segmentation } = this.properties; + const sectorSpacing = segmentation.spacing ?? 0; + const fillBBox = this.getShapeFillBBox(); + scaleSelection.each((sector, datum) => { + const { centerX, centerY, innerRadius, outerRadius, startCornerRadius, endCornerRadius } = datum; + sector.centerX = centerX; + sector.centerY = centerY; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + applyShapeStyle17(sector, datum.style, fillBBox); + sector.startOuterCornerRadius = startCornerRadius; + sector.startInnerCornerRadius = startCornerRadius; + sector.endOuterCornerRadius = endCornerRadius; + sector.endInnerCornerRadius = endCornerRadius; + sector.radialEdgeInset = (sectorSpacing + sector.strokeWidth) / 2; + sector.concentricEdgeInset = sector.strokeWidth / 2; + sector.setProperties(resetRadialGaugeSeriesResetSectorFunction(sector, datum)); + }); + } + updateNeedleSelection(opts) { + return opts.needleSelection.update(opts.needleData, void 0, () => createDatumId19(0)); + } + updateNeedleNodes(opts) { + const { needleSelection } = opts; + const { fill, fillOpacity, stroke: stroke22, strokeOpacity, strokeWidth, lineDash, lineDashOffset } = this.properties.needle; + const animationDisabled = this.ctx.animationManager.isSkipped(); + needleSelection.each((needle, datum) => { + const { centerX, centerY, radius } = datum; + const scale2 = radius * 2; + needle.d = RadialGaugeNeedle.defaultPathData; + applyShapeStyle17(needle, { + fill, + fillOpacity, + stroke: stroke22, + strokeOpacity, + strokeWidth: strokeWidth / scale2, + lineDash: lineDash.map((d) => d / scale2), + lineDashOffset: lineDashOffset / scale2 + }); + needle.translationX = centerX; + needle.translationY = centerY; + needle.scalingX = scale2; + needle.scalingY = scale2; + if (animationDisabled) { + needle.setProperties(resetRadialGaugeSeriesResetNeedleFunction(needle, datum)); + } + }); + } + updateTargetSelection(opts) { + return opts.targetSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetStyles({ + targetSelection, + isHighlight + }) { + targetSelection.each((_, datum) => { + datum.style = this.getTargetStyle(isHighlight, datum); + }); + } + updateTargetNodes({ + targetSelection + }) { + targetSelection.each((target, datum) => { + const { centerX, centerY, angle: angle2, radius, shape, size, rotation } = datum; + applyShapeStyle17(target, datum.style); + target.size = size; + target.shape = shape === "line" ? lineMarker : shape; + target.translationX = centerX + radius * Math.cos(angle2); + target.translationY = centerY + radius * Math.sin(angle2); + target.rotation = angle2 + rotation; + }); + } + getTargetStyle(isHighlight, { datumIndex, style: style2 }) { + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + return mergeDefaults19(highlightStyle, { + ...style2, + opacity: 1 + }); + } + updateTargetLabelSelection(opts) { + return opts.targetLabelSelection.update(opts.targetData, void 0, (target) => target.itemId); + } + updateTargetLabelNodes(opts) { + const { targetLabelSelection } = opts; + targetLabelSelection.each((label, target) => { + const { centerX, centerY, radius, angle: angle2, text: text2 } = target; + const { offsetX, offsetY, fill, fontStyle, fontWeight, fontSize, fontFamily, textAlign, textBaseline } = target.label; + if (text2 == null) { + label.visible = false; + return; + } + label.visible = true; + label.x = centerX + radius * Math.cos(angle2) + offsetX; + label.y = centerY + radius * Math.sin(angle2) + offsetY; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = textBaseline; + }); + } + updateLabelSelection(opts) { + return opts.labelSelection.update(opts.labelData, void 0, (datum) => datum.label); + } + updateLabelNodes(opts) { + const { labelSelection } = opts; + const animationDisabled = this.ctx.animationManager.isSkipped(); + labelSelection.each((label, datum) => { + label.fill = datum.fill; + label.fontStyle = datum.fontStyle; + label.fontWeight = datum.fontWeight; + label.fontFamily = datum.fontFamily; + }); + if (animationDisabled || this.labelsHaveExplicitText()) { + this.formatLabelText(); + } + } + updateTickSelection(opts) { + return opts.tickSelection.update(opts.tickData, void 0, (datum) => datum.index); + } + updateTickNodes(opts) { + const { scale: scale2, radius, centerX, centerY, properties } = this; + const { enabled, color: color6, fontFamily, fontSize, fontStyle, fontWeight, spacing } = properties.scale.label; + const rotation = toRadians5(properties.scale.label.rotation ?? 0); + opts.tickSelection.each((label, datum) => { + if (!enabled) { + label.visible = false; + return; + } + label.visible = true; + label.text = datum.text; + label.fill = color6; + label.fontFamily = fontFamily; + label.fontSize = fontSize; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.textAlign = "center"; + label.textBaseline = "middle"; + const angle2 = scale2.convert(datum.value); + const { width: width2, height: height2 } = datum; + const originX = Math.abs(radius * Math.cos(angle2)); + const originY = Math.abs(radius * Math.sin(angle2)); + const x0 = Math.min(Math.max(Math.abs(radius / Math.tan(angle2)), originX - width2 / 2), originX + width2 / 2); + const y0 = Math.min( + Math.max(Math.abs(radius * Math.tan(angle2)), originY - height2 / 2), + originY + height2 / 2 + ); + const outerR = Math.hypot(x0, y0); + const x = centerX + (outerR + spacing) * Math.cos(angle2); + const y = centerY + (outerR + spacing) * Math.sin(angle2); + label.x = x; + label.y = y; + label.rotationCenterX = x; + label.rotationCenterY = y; + label.rotation = rotation; + }); + } + labelsHaveExplicitText() { + for (const { datum } of this.labelSelection) { + if (datum.text == null) { + return false; + } + } + return true; + } + formatLabelText(datum) { + const { labelSelection, radius, textAlign, verticalAlign } = this; + const { spacing: padding2, innerRadiusRatio } = this.properties; + formatRadialGaugeLabels( + this, + this.ctx, + labelSelection, + { padding: padding2, textAlign, verticalAlign }, + radius * innerRadiusRatio, + datum + ); + } + resetAllAnimation() { + this.ctx.animationManager.stopByAnimationGroupId(this.id); + resetMotion4([this.datumSelection], resetRadialGaugeSeriesResetSectorFunction); + resetMotion4([this.needleSelection], resetRadialGaugeSeriesResetNeedleFunction); + this.formatLabelText(); + } + resetAnimation(phase) { + if (phase === "initial") { + this.animationState.transition("reset"); + } else if (phase === "ready") { + this.animationState.transition("skip"); + } + } + animateLabelText(params = {}) { + const { animationManager } = this.ctx; + let labelFrom; + let labelTo; + let secondaryLabelFrom; + let secondaryLabelTo; + this.labelSelection.each((label, datum) => { + label.opacity = 1; + if (datum.label === "primary") { + labelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + labelTo = datum.value; + } else if (datum.label === "secondary") { + secondaryLabelFrom = label.previousDatum?.value ?? params.from ?? datum.value; + secondaryLabelTo = datum.value; + } + }); + if (this.labelsHaveExplicitText()) { + } else if (labelTo == null || secondaryLabelTo == null) { + this.formatLabelText(); + } else if (labelFrom === labelTo && secondaryLabelFrom === secondaryLabelTo) { + this.formatLabelText({ label: labelTo, secondaryLabel: secondaryLabelTo }); + } else { + const animationId = `${this.id}_labels`; + animationManager.animate({ + id: animationId, + groupId: "label", + from: { label: labelFrom, secondaryLabel: secondaryLabelFrom }, + to: { label: labelTo, secondaryLabel: secondaryLabelTo }, + phase: params.phase ?? "update", + onUpdate: (datum) => this.formatLabelText(datum), + onStop: () => this.formatLabelText({ label: labelTo, secondaryLabel: secondaryLabelTo }) + }); + } + } + animateEmptyUpdateReady() { + const { animationManager } = this.ctx; + const { node, needle } = prepareRadialGaugeSeriesAnimationFunctions(true, this.scale.range[0]); + fromToMotion5(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion5(this.id, "needle", animationManager, [this.needleSelection], needle, () => "needle"); + fromToMotion5( + this.id, + "label", + animationManager, + [this.labelSelection], + fadeInFns, + (_label, datum) => datum.label + ); + this.animateLabelText({ + from: this.properties.scale.min, + phase: "initial" + }); + } + animateWaitingUpdateReady() { + const { animationManager } = this.ctx; + const { node, needle } = prepareRadialGaugeSeriesAnimationFunctions(false, this.scale.range[0]); + fromToMotion5(this.id, "node", animationManager, [this.datumSelection], node, (_sector, datum) => datum.itemId); + fromToMotion5(this.id, "needle", animationManager, [this.needleSelection], needle, () => "needle"); + this.animateLabelText(); + } + animateReadyResize() { + this.resetAllAnimation(); + } + dataCount() { + return Number.NaN; + } + getSeriesDomain() { + return [Number.NaN, Number.NaN]; + } + getSeriesRange(_direction, _visibleRange) { + return [Number.NaN, Number.NaN]; + } + getLegendData() { + return []; + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties } = this; + const { tooltip } = properties; + let value; + let text2; + let fallbackLabel; + if (datumIndex.type === 0) { + value = properties.value; + text2 = properties.label.text; + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeValue"); + } else { + ({ value, text: text2 } = properties.targets[datumIndex.index]); + fallbackLabel = this.ctx.localeManager.t("ariaLabelGaugeTarget"); + } + if (value == null) + return; + return this.formatTooltipWithContext( + tooltip, + { + data: [{ label: text2, fallbackLabel, value: this.formatLabel(value) }] + }, + { seriesId, title: void 0, datum: void 0, value } + ); + } + pickNodeClosestDatum(point) { + return pickGaugeNearestDatum(this, point); + } + pickFocus(opts) { + return pickGaugeFocus(this, opts); + } + getCaptionText() { + const { value } = this.properties; + const description = []; + description.push(this.formatLabel(value)); + this.labelSelection.each((_label, datum) => { + const text2 = getLabelText(this.id, this.ctx, datum); + if (text2 != null) { + description.push(toPlainText(text2)); + } + }); + return description.join(". "); + } + getCategoryValue(_datumIndex) { + return; + } + datumIndexForCategoryValue(_categoryValue) { + return; + } + hasItemStylers() { + return this.properties.label.itemStyler != null; + } +}; +RadialGaugeSeries.className = "RadialGaugeSeries"; +RadialGaugeSeries.type = "radial-gauge"; +var { FONT_SIZE_RATIO: FONT_SIZE_RATIO22 } = module_support_exports; +var RadialGaugeModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "radial-gauge", + moduleFactory: (ctx) => new RadialGaugeSeries(ctx), + themeTemplate: { + minWidth: 200, + minHeight: 200, + tooltip: { + enabled: false + }, + series: { + outerRadiusRatio: 1, + innerRadiusRatio: 0.8, + startAngle: 270, + endAngle: 270 + 180, + defaultColorRange: { + $if: [ + { $eq: [{ $palette: "type" }, "inbuilt"] }, + { $interpolate: [{ $palette: "secondDivergingColors" }, 5] }, + module_support_exports.SAFE_RANGE2_OPERATION + ] + }, + scale: { + // @ts-expect-error undocumented option + defaultFill: { $path: ["/1", { $palette: "fill" }, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + stroke: { $path: ["/2", module_support_exports.SAFE_STROKE_FILL_OPERATION, { $palette: "hierarchyColors" }] }, + // TODO: mix backgroundColor and foregroundColor? + strokeWidth: { $isUserOption: ["./stroke", 2, 0] }, + label: { + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 12 + } + }, + bar: { + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + segmentation: { + enabled: false, + interval: {}, + spacing: 2 + }, + defaultTarget: { + fill: { $ref: "foregroundColor" }, + stroke: { $ref: "foregroundColor" }, + size: 10, + shape: "triangle", + placement: "outside", + spacing: 5, + label: { + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" }, + spacing: 5 + } + }, + needle: { + enabled: false, + fill: { $ref: "foregroundColor" }, + spacing: 10 + }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: 56, + minimumFontSize: 18 / 56, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "textColor" } + }, + secondaryLabel: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: true, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: FONT_SIZE_RATIO22.LARGE }, + minimumFontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + color: { $ref: "subtleTextColor" } + }, + tooltip: { + range: { $path: ["/tooltip/range", 10] } + } + } + } +}; +var RadialGaugeSeriesModule = { + type: "series", + name: "radial-gauge", + chartType: "standalone", + enterprise: true, + options: module_support_exports.radialGaugeSeriesOptionsDef, + create: (ctx) => new RadialGaugeSeries(ctx) +}; +var { BBox: BBox25, Path: Path14, Vec2: Vec220, SceneChangeDetection: SceneChangeDetection10 } = module_support_exports; +var SankeyLink = class extends Path14 { + constructor() { + super(...arguments); + this.x1 = 0; + this.x2 = 0; + this.y1 = 0; + this.y2 = 0; + this.height = 0; + this.inset = 0; + this.elbows = []; + } + computeBBox() { + const x = Math.min(this.x1, this.x2); + const width2 = Math.max(this.x1, this.x2) - x; + const y = Math.min(this.y1, this.y2); + const height2 = Math.max(this.y1, this.y2) - y + this.height; + return new BBox25(x, y, width2, height2); + } + updatePath() { + const { path, inset } = this; + path.clear(); + const height2 = this.height - 2 * this.inset; + const offset = height2 / 2; + let x1 = this.x1 + inset; + let y1 = this.y1 + inset; + path.moveTo(x1, y1); + for (const elbow of this.elbows) { + this.updatePathSection(x1, y1, elbow.x, elbow.y, height2, -offset); + x1 = elbow.x; + y1 = elbow.y; + } + const x2 = this.x2 - inset; + const y2 = this.y2 + inset; + this.updatePathSection(x1, y1, x2, y2, height2, -offset); + path.lineTo(x2, y2 + height2); + x1 = x2; + y1 = y2; + for (const elbow of this.elbows.toReversed()) { + this.updatePathSection(x1, y1, elbow.x, elbow.y, height2, offset); + x1 = elbow.x; + y1 = elbow.y; + } + this.updatePathSection(x1, y1, this.x1 + inset, this.y1 + inset, height2, offset); + path.closePath(); + } + updatePathSection(x1, y1, x2, y2, height2, yOffset) { + const { path } = this; + const start2 = Vec220.from(x1, y1 + yOffset + height2 / 2); + const end3 = Vec220.from(x2, y2 + yOffset + height2 / 2); + if (Math.abs(end3.y - start2.y) < 2) { + path.lineTo(end3.x, end3.y); + return; + } + let angle2 = Vec220.angle(Vec220.sub(end3, start2)); + if (angle2 < 0) + angle2 = 2 * Math.PI + angle2; + const right = 0; + const down = Math.PI / 2; + const left = Math.PI; + const up = Math.PI * 1.5; + const innerArc = getArcValues(start2, end3, 0); + const outerArc = getArcValues(start2, end3, height2); + if (innerArc.radius < height2) { + path.cubicCurveTo((start2.x + end3.x) / 2, start2.y, (start2.x + end3.x) / 2, end3.y, end3.x, end3.y); + return; + } + if (angle2 >= up) { + path.arc(start2.x, y1 - innerArc.radius, innerArc.radius, down, down + outerArc.angle, true); + path.arc(end3.x, y2 + outerArc.radius, outerArc.radius, up + outerArc.angle, up); + path.lineTo(end3.x, end3.y); + } else if (angle2 > right && angle2 <= down) { + path.arc(start2.x, y1 + outerArc.radius, outerArc.radius, up, up + outerArc.angle); + path.arc(end3.x, y2 - innerArc.radius, innerArc.radius, down + innerArc.angle, down, true); + path.lineTo(end3.x, end3.y); + } else if (angle2 > down && angle2 <= left) { + path.arc(start2.x, y1 + outerArc.radius, outerArc.radius - height2, up, up + outerArc.angle, true); + path.arc(end3.x, y2 - innerArc.radius, innerArc.radius + height2, down + innerArc.angle, down); + path.lineTo(end3.x, end3.y); + } else { + path.arc(start2.x, y1 - innerArc.radius, innerArc.radius + height2, down, down + innerArc.angle); + path.arc(end3.x, y2 + outerArc.radius, outerArc.radius - height2, up + outerArc.angle, up, true); + path.lineTo(end3.x, end3.y); + } + } +}; +__decorateClass2([ + SceneChangeDetection10() +], SankeyLink.prototype, "x1", 2); +__decorateClass2([ + SceneChangeDetection10() +], SankeyLink.prototype, "x2", 2); +__decorateClass2([ + SceneChangeDetection10() +], SankeyLink.prototype, "y1", 2); +__decorateClass2([ + SceneChangeDetection10() +], SankeyLink.prototype, "y2", 2); +__decorateClass2([ + SceneChangeDetection10() +], SankeyLink.prototype, "height", 2); +__decorateClass2([ + SceneChangeDetection10() +], SankeyLink.prototype, "inset", 2); +function getArcValues(start2, end3, minRadius) { + const lineAngle = Vec220.angle(Vec220.sub(end3, start2)); + const chordLength = Vec220.distance(start2, end3); + const bisect = Vec220.add(start2, Vec220.rotate(Vec220.from(chordLength / 2, 0), lineAngle)); + const gradient2 = -1 / Vec220.gradient(start2, end3); + const intercept2 = Vec220.intercept(bisect, gradient2); + const offset = lerpClamp(0.1, 0.5, Math.PI / 2 - Math.abs(Vec220.gradient(start2, end3))); + const center2 = Vec220.intersectAtX(gradient2, intercept2, start2.x); + const radius = Math.max(minRadius, Vec220.distance(start2, center2) * offset); + const angle2 = Vec220.angle(Vec220.sub(center2, start2), Vec220.sub(center2, bisect)) / -(1.1 - offset); + return { angle: angle2, radius }; +} +function lerpClamp(a, b, ratio3) { + return clamp(a, (b - a) * ratio3 + a, b); +} +var { + BaseProperties: BaseProperties29, + FillGradientDefaults: FillGradientDefaults3, + FillPatternDefaults: FillPatternDefaults3, + FillImageDefaults: FillImageDefaults3, + makeSeriesTooltip: makeSeriesTooltip222, + SeriesProperties: SeriesProperties13, + Property: Property82, + Label: Label17 +} = module_support_exports; +var SankeySeriesLabelProperties = class extends Label17 { + constructor() { + super(...arguments); + this.spacing = 1; + this.placement = void 0; + this.edgePlacement = void 0; + } +}; +__decorateClass2([ + Property82 +], SankeySeriesLabelProperties.prototype, "spacing", 2); +__decorateClass2([ + Property82 +], SankeySeriesLabelProperties.prototype, "placement", 2); +__decorateClass2([ + Property82 +], SankeySeriesLabelProperties.prototype, "edgePlacement", 2); +var SankeySeriesLinkProperties = class extends BaseProperties29 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass2([ + Property82 +], SankeySeriesLinkProperties.prototype, "fill", 2); +__decorateClass2([ + Property82 +], SankeySeriesLinkProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property82 +], SankeySeriesLinkProperties.prototype, "stroke", 2); +__decorateClass2([ + Property82 +], SankeySeriesLinkProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property82 +], SankeySeriesLinkProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property82 +], SankeySeriesLinkProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property82 +], SankeySeriesLinkProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property82 +], SankeySeriesLinkProperties.prototype, "itemStyler", 2); +var SankeySeriesNodeProperties = class extends BaseProperties29 { + constructor() { + super(...arguments); + this.spacing = 1; + this.minSpacing = 0; + this.width = 1; + this.alignment = "justify"; + this.verticalAlignment = "center"; + this.sort = "auto"; + this.fill = void 0; + this.fillOpacity = 1; + this.stroke = void 0; + this.strokeOpacity = 1; + this.strokeWidth = 1; + this.lineDash = [0]; + this.lineDashOffset = 0; + } +}; +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "spacing", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "minSpacing", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "width", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "alignment", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "verticalAlignment", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "sort", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "fill", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "stroke", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "lineDash", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "lineDashOffset", 2); +__decorateClass2([ + Property82 +], SankeySeriesNodeProperties.prototype, "itemStyler", 2); +var SankeySeriesProperties = class extends SeriesProperties13 { + constructor() { + super(); + this.nodes = void 0; + this.idKey = ""; + this.idName = void 0; + this.labelKey = void 0; + this.labelName = void 0; + this.sizeKey = void 0; + this.sizeName = void 0; + this.fillGradientDefaults = new FillGradientDefaults3(); + this.fillPatternDefaults = new FillPatternDefaults3(); + this.fillImageDefaults = new FillImageDefaults3(); + this.defaultColorRange = []; + this.defaultPatternFills = []; + this.fills = []; + this.strokes = []; + this.label = new SankeySeriesLabelProperties(); + this.link = new SankeySeriesLinkProperties(); + this.node = new SankeySeriesNodeProperties(); + this.tooltip = makeSeriesTooltip222(); + this.highlightStyle.deprecated = false; + } + getStyle(isLink, fills, strokes, index) { + const { + fillOpacity, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset, + fill = fills[index % fills.length], + stroke: stroke22 = strokes[index % fills.length] + } = isLink ? this.link : this.node; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + lineDash, + lineDashOffset + }; + } +}; +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "nodes", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "fromKey", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "toKey", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "idKey", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "idName", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "labelKey", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "labelName", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "sizeKey", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "sizeName", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "fillGradientDefaults", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "fillPatternDefaults", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "fillImageDefaults", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "defaultColorRange", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "defaultPatternFills", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "fills", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "strokes", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "link", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "node", 2); +__decorateClass2([ + Property82 +], SankeySeriesProperties.prototype, "tooltip", 2); +var { + Transformable: Transformable3, + applyShapeStyle: applyShapeStyle18, + SeriesNodePickMode: SeriesNodePickMode16, + createDatumId: createDatumId20, + getShapeStyle: getShapeStyle22, + getLabelStyles: getLabelStyles6, + Rect: Rect8, + BBox: BBox26, + mergeDefaults: mergeDefaults20 +} = module_support_exports; +var SankeySeries = class extends FlowProportionSeries { + constructor(moduleCtx) { + super({ + moduleCtx, + pickModes: [SeriesNodePickMode16.NEAREST_NODE, SeriesNodePickMode16.EXACT_SHAPE_MATCH] + }); + this.properties = new SankeySeriesProperties(); + } + isLabelEnabled() { + return (this.properties.labelKey != null || this.nodes == null) && this.properties.label.enabled; + } + linkFactory() { + return new SankeyLink(); + } + nodeFactory() { + return new Rect8(); + } + createNodeData() { + const { + id: seriesId, + _nodeDataDependencies: { seriesRectWidth, seriesRectHeight } = { seriesRectWidth: 0, seriesRectHeight: 0 } + } = this; + const { + fromKey, + toKey, + sizeKey, + labelKey, + label: { spacing: labelSpacing, placement: labelPlacement, edgePlacement: edgeLabelPlacement }, + node: { width: nodeWidth, alignment } + } = this.properties; + const createNode = (node) => ({ + ...node, + x: Number.NaN, + y: Number.NaN, + width: nodeWidth, + height: Number.NaN + }); + const createLink = (link) => ({ + ...link, + x1: Number.NaN, + x2: Number.NaN, + y1: Number.NaN, + y2: Number.NaN, + height: Number.NaN, + elbows: [] + }); + const { + nodeGraph: baseNodeGraph, + links, + maxPathLength + } = this.getNodeGraph(createNode, createLink, { includeCircularReferences: false }); + const nodeGraph = baseNodeGraph; + if (nodeGraph.size === 0) + return; + const columns = []; + for (let index = 0; index < maxPathLength; index += 1) { + columns.push({ index, size: 0, nodes: [], x: 0 }); + } + for (const graphNode of nodeGraph.values()) { + const { datum: node, linksBefore, linksAfter, maxPathLengthBefore, maxPathLengthAfter } = graphNode; + const size = Math.max( + linksBefore.reduce((acc, { link }) => acc + link.size, 0), + linksAfter.reduce((acc, { link }) => acc + link.size, 0) + ); + if (linksBefore.length === 0 && linksAfter.length === 0 || size === 0) { + graphNode.columnIndex = -1; + continue; + } + let column; + switch (alignment) { + case "left": + column = columns[maxPathLengthBefore]; + break; + case "right": + column = columns[maxPathLength - 1 - maxPathLengthAfter]; + break; + case "center": { + if (linksBefore.length !== 0) { + column = columns[maxPathLengthBefore]; + } else if (linksAfter.length === 0) { + column = columns[0]; + } else { + const columnIndex = linksAfter.reduce( + (acc, link) => Math.min(acc, link.node.maxPathLengthBefore), + maxPathLength + ) - 1; + column = columns[columnIndex]; + } + break; + } + case "justify": { + column = linksAfter.length === 0 ? columns[maxPathLength - 1] : columns[maxPathLengthBefore]; + break; + } + } + node.size = size; + const { label } = this.properties; + const labelText = label.enabled ? this.getLabelText( + node.label, + node.datum, + labelKey, + "label", + [], + this.properties.label, + { datum: node.datum, value: node.label, fromKey, toKey, sizeKey, size } + ) : void 0; + node.label = toPlainText(labelText); + column.nodes.push(graphNode); + column.size += size; + graphNode.columnIndex = column.index; + } + const measurer22 = cachedTextMeasurer(this.properties.label); + let columnLabelInsetBefore = 0; + let columnLabelInsetAfter = 0; + if (this.isLabelEnabled()) { + if (labelPlacement == null && edgeLabelPlacement == null) { + columnLabelInsetBefore = (seriesRectWidth - nodeWidth) * (1 - maxPathLength / (maxPathLength + 1)); + columnLabelInsetAfter = columnLabelInsetBefore; + } else if (edgeLabelPlacement === "outside" || edgeLabelPlacement == null) { + const reduceLabelWidthFn = (acc, n) => { + const node = n; + if (node.datum.label == null || node.datum.label === "") + return acc; + let maxWidth = (seriesRectWidth - nodeWidth) / (maxPathLength - 1) - labelSpacing; + if (labelPlacement === "center" && edgeLabelPlacement == null) + maxWidth /= 2; + const text2 = wrapText(node.datum.label, { + maxWidth, + maxHeight: node.datum.height, + font: this.properties.label, + textWrap: "never" + }); + let { width: width2 } = measurer22.measureLines(text2); + if (labelPlacement === "center" && edgeLabelPlacement == null) + width2 /= 2; + return Math.max(acc, width2); + }; + if (labelPlacement !== "right" || edgeLabelPlacement === "outside") { + columnLabelInsetBefore = nodeWidth + columns[0].nodes.reduce(reduceLabelWidthFn, 0); + } + if (labelPlacement !== "left" || edgeLabelPlacement === "outside") { + columnLabelInsetAfter = nodeWidth + columns.at(-1).nodes.reduce(reduceLabelWidthFn, 0); + } + } + } + const columnWidth = (seriesRectWidth - nodeWidth - columnLabelInsetBefore - columnLabelInsetAfter) / (maxPathLength - 1); + for (let index = 0; index < columns.length; index++) { + const column = columns[index]; + column.x = columnLabelInsetBefore + index * columnWidth; + for (const graphNode of column.nodes) { + graphNode.datum.x = column.x; + } + } + for (const graphNode of nodeGraph.values()) { + graphNode.weight = 0; + let closestColumnDiff = Infinity; + for (const link of graphNode.linksAfter) { + const node = link.node; + closestColumnDiff = Math.min(closestColumnDiff, node.columnIndex - graphNode.columnIndex); + } + if (closestColumnDiff === Infinity) { + for (const link of graphNode.linksBefore) { + const node = link.node; + closestColumnDiff = Math.min(closestColumnDiff, graphNode.columnIndex - node.columnIndex); + } + } + graphNode.closestColumnDiff = closestColumnDiff; + for (const link of graphNode.linksAfter) { + const node = link.node; + if (node.columnIndex <= graphNode.columnIndex) + continue; + for (let i = node.columnIndex - 1; i > graphNode.columnIndex; i--) { + const size = link.link.size; + const ghostNode = { + ghost: true, + datum: { ...graphNode.datum, size, y: 0, height: 0 }, + weight: 0, + linksBefore: [{ node: { columnIndex: i - 1, datum: { size } } }], + linksAfter: [{ node: { columnIndex: i + 1, datum: { size } } }], + link: link.link, + columnIndex: graphNode.columnIndex, + size: graphNode.datum.size, + closestColumnDiff, + fromNode: { y: node.datum.y }, + toNode: { y: 0 } + }; + columns[i].size += size; + columns[i].nodes.push(ghostNode); + } + } + } + const sortedColumns = columns.toSorted((a, b) => { + const aMax = a.nodes.reduce((acc, n) => Math.max(acc, n.datum.size), 0); + const bMax = b.nodes.reduce((acc, n) => Math.max(acc, n.datum.size), 0); + return bMax - aMax; + }); + const columnWeights = {}; + for (let i = 0; i < sortedColumns.length; i++) { + columnWeights[sortedColumns[i].index] = Math.pow(10, sortedColumns.length - i - 1); + } + for (const column of columns) { + for (const node of column.nodes) { + node.weight = node.datum.size / column.size * columnWeights[column.index]; + if ("ghost" in node && node.ghost) { + node.weight = node.size / column.size * columnWeights[column.index]; + continue; + } + node.weight += node.linksBefore.reduce((acc, before) => { + if (before.node.columnIndex !== column.index - 1) + return acc; + const weight = before.node.datum.size / columns[before.node.columnIndex].size * columnWeights[before.node.columnIndex]; + return Math.max(acc, weight); + }, 0); + node.weight += node.linksAfter.reduce((acc, after) => { + if (after.node.columnIndex !== column.index + 1) + return acc; + const weight = after.node.datum.size / columns[after.node.columnIndex].size * columnWeights[after.node.columnIndex]; + return Math.max(acc, weight); + }, 0); + } + column.nodes.sort((a, b) => this.sortNodes(a, b)); + } + const minSize = 1; + const getSizeScale = (spacing) => { + return columns.reduce((acc, { size, nodes }) => { + const spacingAccomodation = seriesRectHeight - nodes.length * minSize; + const spacingOccupation = (nodes.length - 1) * spacing / spacingAccomodation; + const columnSizeScale = (1 - spacingOccupation) / size; + return Math.min(acc, columnSizeScale); + }, Infinity); + }; + let nodeSpacing = this.properties.node.spacing; + let sizeScale = getSizeScale(nodeSpacing); + while (sizeScale < 0 && nodeSpacing > this.properties.node.minSpacing) { + nodeSpacing -= 1; + sizeScale = getSizeScale(nodeSpacing); + } + if (sizeScale < 0) { + logger_exports.warnOnce( + "There was insufficient space to display the Sankey Series. Reduce [node.spacing], [node.minSpacing], or provide a larger container." + ); + return; + } + for (const column of columns) { + let columnNodesHeight = 0; + for (const node of column.nodes) { + const height2 = seriesRectHeight * node.datum.size * sizeScale; + node.datum.height = Math.max(minSize, height2); + columnNodesHeight += height2; + } + const spacingOccupation = nodeSpacing * (column.nodes.length - 1); + let y = 0; + if (this.properties.node.verticalAlignment === "bottom") { + y = seriesRectHeight - columnNodesHeight - spacingOccupation; + } else if (this.properties.node.verticalAlignment === "center") { + y = (seriesRectHeight - columnNodesHeight - spacingOccupation) / 2; + } + for (const node of column.nodes) { + node.datum.y = y; + y += seriesRectHeight * node.datum.size * sizeScale + nodeSpacing; + if ("ghost" in node && node.ghost) { + node.link.elbows.push({ x: column.x, y: node.datum.y }); + } + } + } + for (const { datum, linksBefore, linksAfter } of nodeGraph.values()) { + let y2 = datum.y; + linksBefore.sort( + (a, b) => this.sortNodes(a.node, b.node) + ); + for (const { link } of linksBefore) { + link.y2 = y2; + y2 += link.size * seriesRectHeight * sizeScale; + } + let y1 = datum.y; + linksAfter.sort( + (a, b) => this.sortNodes(a.node, b.node, { + invertColumnSort: true + }) + ); + for (const { link } of linksAfter) { + link.y1 = y1; + y1 += link.size * seriesRectHeight * sizeScale; + } + } + const nodeData = []; + const labelData = []; + const { fontSize } = this.properties.label; + for (const [index, column] of columns.entries()) { + const leading = index === 0; + const trailing = index === columns.length - 1; + let bottom = -Infinity; + column.nodes.sort((a, b) => a.datum.y - b.datum.y); + for (const n of column.nodes) { + if ("ghost" in n && n.ghost) + continue; + const { datum: node } = n; + node.midPoint = { + x: node.x + node.width / 2, + y: node.y + node.height / 2 + }; + nodeData.push(node); + if (node.label == null) + continue; + const y = node.y + node.height / 2; + let text2; + if (!leading && !trailing) { + const lineHeight = calcLineHeight(fontSize); + const y12 = y - lineHeight; + const y2 = y + lineHeight; + let maxX = seriesRectWidth; + for (const { datum } of nodeGraph.values()) { + const intersectsLabel = datum.x > node.x && Math.max(datum.y, y12) <= Math.min(datum.y + datum.height, y2); + if (intersectsLabel) { + maxX = Math.min(maxX, datum.x - labelSpacing); + } + } + const maxWidth = maxX - node.x - 2 * labelSpacing; + text2 = wrapText(node.label, { + maxWidth, + maxHeight: node.height, + font: this.properties.label, + textWrap: "never", + overflow: "hide" + }); + } + if (text2 == null || text2 === "") { + const labelInset = edgeLabelPlacement == null && (leading || trailing) ? labelSpacing : labelSpacing * 2; + text2 = wrapText(node.label, { + maxWidth: columnWidth - labelInset, + maxHeight: node.height, + font: this.properties.label, + textWrap: "never" + }); + } + if (text2 === "") + continue; + const { height: height2 } = measurer22.measureLines(text2); + const y0 = y - height2 / 2; + const y1 = y + height2 / 2; + let x = node.x + node.width + labelSpacing; + let textAlign = "left"; + let placement = labelPlacement; + if (leading && edgeLabelPlacement == null && labelPlacement == null) { + placement = "left"; + } + if (edgeLabelPlacement === "outside") { + if (leading) + placement = "left"; + if (trailing) + placement = "right"; + } else if (edgeLabelPlacement === "inside") { + if (leading) + placement = "right"; + if (trailing) + placement = "left"; + } + if (placement === "left") { + x = node.x - labelSpacing; + textAlign = "right"; + } else if (placement === "center") { + x = node.x + node.width / 2; + textAlign = "center"; + } + if (y0 >= bottom) { + labelData.push({ x, y, textAlign, text: text2, size: node.size }); + bottom = y1; + } + } + } + for (const link of links) { + const { fromNode, toNode, size } = link; + link.height = Math.max(minSize, seriesRectHeight * size * sizeScale); + link.x1 = fromNode.x + nodeWidth; + link.x2 = toNode.x; + link.midPoint = { + x: (link.x1 + link.x2) / 2, + y: (link.y1 + link.y2) / 2 + link.height / 2 + }; + nodeData.push(link); + } + return { + itemId: seriesId, + nodeData, + labelData + }; + } + sortNodes(a, b, opts) { + const { properties } = this; + if (properties.node.sort === "ascending") { + return (a.datum.label ?? "").localeCompare(b.datum.label ?? ""); + } else if (properties.node.sort === "descending") { + return (b.datum.label ?? "").localeCompare(a.datum.label ?? ""); + } else if (properties.node.sort === "data") { + return 0; + } + if (a.columnIndex < b.columnIndex) + return opts?.invertColumnSort ? 1 : -1; + if (a.columnIndex > b.columnIndex) + return opts?.invertColumnSort ? -1 : 1; + if (a.weight === b.weight) { + return a.datum.size - b.datum.size; + } + if (a.closestColumnDiff < b.closestColumnDiff) + return 1; + if (a.closestColumnDiff > b.closestColumnDiff) + return -1; + return a.weight - b.weight; + } + updateLabelSelection(opts) { + const labels = this.isLabelEnabled() ? opts.labelData : []; + return opts.labelSelection.update(labels); + } + updateLabelNodes(opts) { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + opts.labelSelection.each((label, datum) => { + const { x, y, textAlign, text: text2 } = datum; + const params = datum; + const style2 = getLabelStyles6(this, void 0, params, this.properties.label, false, activeHighlight); + const { color: fill, fontStyle, fontWeight, fontSize, fontFamily } = style2; + label.visible = true; + label.x = x; + label.y = y; + label.text = text2; + label.fill = fill; + label.fontStyle = fontStyle; + label.fontWeight = fontWeight; + label.fontSize = fontSize; + label.fontFamily = fontFamily; + label.textAlign = textAlign; + label.textBaseline = "middle"; + label.setBoxing(style2); + }); + } + updateNodeSelection(opts) { + return opts.datumSelection.update(opts.nodeData, void 0, (datum) => createDatumId20(datum.type, datum.id)); + } + getNodeStyle(nodeDatum, fromNodeDatumIndex, isHighlight) { + const { properties } = this; + const { + fills, + strokes, + defaultColorRange, + defaultPatternFills, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3 + } = properties; + const { itemStyler } = properties.node; + const defaultColorStops = defaultColorRange[fromNodeDatumIndex % defaultColorRange.length].map((color6) => ({ + color: color6 + })); + const defaultPatternFill = defaultPatternFills[fromNodeDatumIndex % defaultPatternFills.length]; + const highlightStyle = this.getHighlightStyle(isHighlight, nodeDatum.datumIndex); + const baseStyle = mergeDefaults20(highlightStyle, properties.getStyle(false, fills, strokes, fromNodeDatumIndex)); + const hasNodeFill = properties.node.fill != null; + let style2 = getShapeStyle22( + baseStyle, + hasNodeFill ? fillGradientDefaults3 : { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + hasNodeFill ? fillPatternDefaults3 : { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + if (itemStyler != null && nodeDatum.datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId20(nodeDatum.datumIndex.index, "node", isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style2); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style2 = mergeDefaults20( + overrides, + style2, + { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + } + } + style2.opacity = 1; + return style2; + } + makeItemStylerParams({ datum, datumIndex, size = 0, label }, isHighlight, style2) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style2, + size, + label, + fill + }; + } + updateNodeNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((rect2, datum) => { + const { datumIndex } = datum; + const style2 = this.getNodeStyle(datum, datumIndex.index, isHighlight); + rect2.x = datum.x; + rect2.y = datum.y; + rect2.width = Math.max(datum.width, 0); + rect2.height = Math.max(datum.height, 0); + applyShapeStyle18(rect2, style2, fillBBox); + }); + } + getShapeFillBBox() { + const width2 = this._nodeDataDependencies?.seriesRectWidth ?? 0; + const height2 = this._nodeDataDependencies?.seriesRectHeight ?? 0; + const bbox = new BBox26(0, 0, width2, height2); + return { series: bbox, axis: bbox }; + } + updateLinkSelection(opts) { + return opts.datumSelection.update( + opts.nodeData, + void 0, + (datum) => createDatumId20(datum.type, datum.index, datum.fromNode.id, datum.toNode.id) + ); + } + getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, isHighlight) { + const { id: seriesId, properties } = this; + const { + fills, + strokes, + defaultColorRange, + defaultPatternFills, + fillGradientDefaults: fillGradientDefaults3, + fillPatternDefaults: fillPatternDefaults3, + fillImageDefaults: fillImageDefaults3 + } = properties; + const { itemStyler } = properties.link; + const defaultColorStops = defaultColorRange[fromNodeDatumIndex.index % defaultColorRange.length].map( + (color6) => ({ + color: color6 + }) + ); + const defaultPatternFill = defaultPatternFills[fromNodeDatumIndex.index % defaultPatternFills.length]; + const highlightStyle = this.getHighlightStyle(isHighlight, datumIndex); + const baseStyle = mergeDefaults20( + highlightStyle, + properties.getStyle(true, fills, strokes, fromNodeDatumIndex.index) + ); + const hasLinkFill = properties.link.fill != null; + let style2 = getShapeStyle22( + baseStyle, + hasLinkFill ? fillGradientDefaults3 : { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + hasLinkFill ? fillPatternDefaults3 : { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + if (itemStyler != null && datumIndex != null) { + const overrides = this.cachedDatumCallback( + createDatumId20(datumIndex.index, "link", isHighlight ? "highlight" : "node"), + () => { + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, datumIndex); + return this.callWithContext(itemStyler, { + seriesId, + datum, + highlighted: isHighlight, + highlightState, + ...style2 + }); + } + ); + if (overrides) { + style2 = mergeDefaults20( + overrides, + style2, + { ...fillGradientDefaults3.toJson(), colorStops: defaultColorStops }, + { ...fillPatternDefaults3.toJson(), fill: defaultPatternFill, stroke: defaultPatternFill }, + fillImageDefaults3 + ); + } + } + style2.opacity = 1; + return style2; + } + updateLinkNodes(opts) { + const { datumSelection, isHighlight } = opts; + const fillBBox = this.getShapeFillBBox(); + datumSelection.each((link, datum) => { + const fromNodeDatumIndex = datum.fromNode.datumIndex; + const style2 = this.getLinkStyle(datum, fromNodeDatumIndex, isHighlight); + link.x1 = datum.x1; + link.y1 = datum.y1; + link.x2 = datum.x2; + link.y2 = datum.y2; + link.height = datum.height; + link.elbows = datum.elbows; + applyShapeStyle18(link, style2, fillBBox); + link.inset = link.strokeWidth / 2; + }); + } + getTooltipContent(datumIndex) { + const { + id: seriesId, + linksProcessedData, + nodesProcessedData, + properties, + ctx: { formatManager } + } = this; + const { fromKey, toKey, sizeKey, sizeName, tooltip } = properties; + const seriesDatum = this.contextNodeData?.nodeData.find( + (d) => d.datumIndex.type === datumIndex.type && d.datumIndex.index === datumIndex.index + ); + if (seriesDatum == null) + return; + const nodeIndex = seriesDatum.type === 0 ? seriesDatum.fromNode.index : seriesDatum.index; + const title = seriesDatum.type === 0 ? `${seriesDatum.fromNode.label} - ${seriesDatum.toNode.label}` : seriesDatum.label; + const datum = datumIndex.type === 0 ? linksProcessedData?.dataSources.get(this.id)?.data[datumIndex.index] : nodesProcessedData?.dataSources.get(this.id)?.data[datumIndex.index]; + const size = seriesDatum.size; + let format; + if (seriesDatum.type === 0) { + const fromNodeDatumIndex = seriesDatum.fromNode.datumIndex; + format = this.getLinkStyle({ datumIndex, datum }, fromNodeDatumIndex, false); + } else { + format = this.getNodeStyle({ datumIndex, datum }, datumIndex.index, false); + } + const data = []; + if (sizeKey != null) { + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: size, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + domain: [], + boundSeries: this.getFormatterContext("size"), + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? String(size) }); + } + return this.formatTooltipWithContext( + tooltip, + { + title, + symbol: this.legendItemSymbol(seriesDatum.type, nodeIndex, format), + data + }, + { + seriesId, + datum, + title, + fromKey, + toKey, + sizeKey, + sizeName, + size, + ...format + } + ); + } + computeFocusBounds(node) { + if (node instanceof Rect8) { + const { x, y, width: width2, height: height2 } = node; + const bbox = new BBox26(x, y, width2, height2); + return Transformable3.toCanvas(this.contentGroup, bbox); + } + return node; + } + hasItemStylers() { + return this.properties.node.itemStyler != null || this.properties.link.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +SankeySeries.className = "SankeySeries"; +SankeySeries.type = "sankey"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs21, sankeySeriesThemeableOptionsDef: sankeySeriesThemeableOptionsDef2 } = module_support_exports; +var sankeySeriesOptionsDef = { + ...sankeySeriesThemeableOptionsDef2, + ...commonSeriesOptionsDefs21, + type: required(constant("sankey")), + fromKey: required(string), + toKey: required(string), + sizeKey: string, + sizeName: string +}; +sankeySeriesOptionsDef.fillGradientDefaults = undocumented(fillGradientDefaults); +sankeySeriesOptionsDef.fillPatternDefaults = undocumented(fillPatternDefaults); +sankeySeriesOptionsDef.fillImageDefaults = undocumented(fillImageDefaults); +sankeySeriesOptionsDef.defaultColorRange = undocumented(arrayOf(arrayOf(color))); +sankeySeriesOptionsDef.defaultPatternFills = undocumented(arrayOf(color)); +var SankeyModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + solo: true, + identifier: "sankey", + moduleFactory: (ctx) => new SankeySeries(ctx), + themeTemplate: { + seriesArea: { + padding: { + top: 10, + bottom: 10 + } + }, + series: { + fills: { $palette: "fills" }, + strokes: { $palette: "strokes" }, + // @ts-expect-error undocumented option + fillGradientDefaults: module_support_exports.FILL_GRADIENT_LINEAR_DEFAULTS, + fillPatternDefaults: module_support_exports.FILL_PATTERN_DEFAULTS, + fillImageDefaults: module_support_exports.FILL_IMAGE_DEFAULTS, + defaultColorRange: { $palette: "gradients" }, + defaultPatternFills: module_support_exports.SAFE_FILLS_OPERATION, + highlightStyle: { + series: { + dimOpacity: 0.2 + } + }, + highlight: { + ...module_support_exports.singleSeriesHighlightStyle() + }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $ref: "fontSize" }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "textColor" }, + spacing: 10 + }, + node: { + spacing: { $if: [{ $greaterThan: [{ $path: "./minSpacing" }, 20] }, { $path: "./minSpacing" }, 20] }, + minSpacing: 0, + width: 10, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + }, + link: { + fillOpacity: 0.5, + strokeWidth: { $isUserOption: ["./stroke", 2, 0] } + } + }, + legend: { + enabled: false, + toggleSeries: false + } + } +}; +var SankeySeriesModule = { + type: "series", + name: "sankey", + chartType: "standalone", + enterprise: true, + options: sankeySeriesOptionsDef, + create: (ctx) => new SankeySeries(ctx) +}; +var { HierarchySeriesProperties: HierarchySeriesProperties2, HighlightStyle: HighlightStyle2, makeSeriesTooltip: makeSeriesTooltip23, Property: Property83 } = module_support_exports; +var SunburstSeriesTileHighlightStyle = class extends HighlightStyle2 { + constructor() { + super(false); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedLabel(); + } +}; +__decorateClass2([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "fill", 2); +__decorateClass2([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass2([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "stroke", 2); +__decorateClass2([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass2([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "label", 2); +__decorateClass2([ + Property83 +], SunburstSeriesTileHighlightStyle.prototype, "secondaryLabel", 2); +var SunburstSeriesProperties = class extends HierarchySeriesProperties2 { + constructor() { + super(...arguments); + this.fillOpacity = 1; + this.strokeWidth = 0; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.highlightStyle = new SunburstSeriesTileHighlightStyle(); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + this.tooltip = makeSeriesTooltip23(); + } + getStyle(index) { + const { fills, strokes, fillOpacity, strokeWidth, strokeOpacity } = this; + return { + fill: fills[index % fills.length], + fillOpacity, + stroke: strokes[index % strokes.length], + strokeWidth, + strokeOpacity, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "sizeName", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "labelKey", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "secondaryLabelKey", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "fillOpacity", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "strokeWidth", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "cornerRadius", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "sectorSpacing", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "padding", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "highlightStyle", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "label", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "secondaryLabel", 2); +__decorateClass2([ + Property83 +], SunburstSeriesProperties.prototype, "tooltip", 2); +var { + fromToMotion: fromToMotion6, + normalizeAngle360: normalizeAngle3608, + createDatumId: createDatumId21, + PointerEvents: PointerEvents13, + Sector: Sector7, + Group: Group20, + ScalableGroup: ScalableGroup2, + Selection: Selection17, + TransformableText: TransformableText3, + BBox: BBox27, + applyShapeStyle: applyShapeStyle19, + mergeDefaults: mergeDefaults21, + formatValue: formatValue22, + getLabelStyles: getLabelStyles7 +} = module_support_exports; +var SunburstNode = class extends module_support_exports.HierarchyNode { + constructor() { + super(...arguments); + this.label = void 0; + this.secondaryLabel = void 0; + this.contentHeight = 0; + this.bbox = void 0; + this.startAngle = 0; + this.endAngle = 0; + } +}; +function setAngleData(node, startAngle = 0, angleScale = 2 * Math.PI / node.sumSize) { + for (const child of node.children) { + const endAngle = startAngle + child.sumSize * angleScale; + child.startAngle = startAngle; + child.endAngle = endAngle; + setAngleData(child, startAngle, angleScale); + startAngle = endAngle; + } +} +var SunburstSeries = class extends module_support_exports.HierarchySeries { + constructor(moduleCtx) { + super(moduleCtx); + this.NodeClass = SunburstNode; + this.properties = new SunburstSeriesProperties(); + this.scalingGroup = this.contentGroup.appendChild(new ScalableGroup2()); + this.sectorGroup = this.scalingGroup.appendChild(new Group20()); + this.sectorLabelGroup = this.scalingGroup.appendChild(new Group20()); + this.highlightSectorGroup = this.scalingGroup.appendChild(new Group20()); + this.datumSelection = Selection17.select(this.sectorGroup, Sector7); + this.labelSelection = Selection17.select( + this.sectorLabelGroup, + Group20 + ); + this.highlightSelection = Selection17.select( + this.highlightSectorGroup, + Sector7 + ); + this.sectorLabelGroup.pointerEvents = PointerEvents13.None; + } + processData() { + super.processData(); + setAngleData(this.rootNode); + } + updateSelections() { + const highlightedNode = this.ctx.highlightManager?.getActiveHighlight(); + this.highlightSelection.update( + highlightedNode == null ? [] : [highlightedNode], + void 0, + (node) => this.getDatumId(node) + ); + if (!this.nodeDataRefresh) + return; + this.nodeDataRefresh = false; + const { chart } = this; + if (chart == null) + return; + const seriesRect = chart.seriesRect; + if (seriesRect == null) + return; + const descendants = Array.from(this.rootNode); + const updateLabelGroup = (group) => { + group.append([ + new TransformableText3({ + tag: 0 + /* Primary */ + }), + new TransformableText3({ + tag: 1 + /* Secondary */ + }) + ]); + }; + this.datumSelection.update(descendants, void 0, (node) => this.getDatumId(node)); + this.labelSelection.update(descendants, updateLabelGroup, (node) => this.getDatumId(node)); + } + getItemStyle(nodeDatum, isHighlight) { + const { properties, colorScale } = this; + const { itemStyler } = properties; + const rootIndex = nodeDatum.datumIndex?.[0] ?? 0; + const highlightStyle = isHighlight ? properties.highlightStyle : void 0; + const baseStyle = mergeDefaults21(highlightStyle, properties.getStyle(rootIndex)); + if (!isHighlight && nodeDatum.colorValue != null) { + baseStyle.fill = colorScale.convert(nodeDatum.colorValue); + } + let style2 = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId21(this.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style2); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style2 = mergeDefaults21(overrides, style2); + } + } + return style2; + } + makeItemStylerParams(nodeDatum, isHighlight, style2) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum: nodeDatum.datum, + depth: nodeDatum.depth ?? 0, + highlighted: isHighlight, + highlightState, + ...style2, + fill + }; + } + updateNodes() { + const { chart, data, maxDepth } = this; + if (chart == null || data == null) { + return; + } + const { width: width2, height: height2 } = chart.seriesRect; + const { + sectorSpacing = 0, + padding: padding2 = 0, + cornerRadius, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName + } = this.properties; + this.contentGroup.translationX = width2 / 2; + this.contentGroup.translationY = height2 / 2; + const baseInset = sectorSpacing * 0.5; + const radius = Math.min(width2, height2) / 2; + const radiusScale = radius / (maxDepth + 1); + const angleOffset = -Math.PI / 2; + const seriesFillBBox = { + series: new BBox27(-radius, -radius, 2 * radius, 2 * radius), + axis: new BBox27(-radius, -radius, 2 * radius, 2 * radius) + }; + this.rootNode?.walk((node) => { + const { startAngle, endAngle } = node; + if (node.depth != null) { + const midAngle = (startAngle + endAngle) / 2 + angleOffset; + const midRadius = (node.depth + 0.5) * radiusScale; + node.midPoint.x = Math.cos(midAngle) * midRadius; + node.midPoint.y = Math.sin(midAngle) * midRadius; + } + }); + this.rootNode?.walk((node) => { + const { datum, depth, startAngle, endAngle, parent, sumSize } = node; + node.label = void 0; + node.secondaryLabel = void 0; + node.contentHeight = 0; + let labelValue; + if (datum != null && depth != null && labelKey != null) { + const value = datum[labelKey]; + labelValue = this.getLabelText( + value, + datum, + labelKey, + "label", + [], + this.properties.label, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (labelValue === "") { + labelValue = void 0; + } + let secondaryLabelValue; + if (datum != null && depth != null && secondaryLabelKey != null) { + const value = datum[secondaryLabelKey]; + secondaryLabelValue = this.getLabelText( + value, + datum, + secondaryLabelKey, + "secondaryLabel", + [], + this.properties.secondaryLabel, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (secondaryLabelValue === "") { + secondaryLabelValue = void 0; + } + if (depth == null) + return; + const innerRadius = depth * radiusScale + baseInset; + const outerRadius = (depth + 1) * radiusScale - baseInset; + const innerAngleOffset = innerRadius > baseInset ? baseInset / innerRadius : baseInset; + const outerAngleOffset = outerRadius > baseInset ? baseInset / outerRadius : baseInset; + const innerStartAngle = startAngle + innerAngleOffset; + const innerEndAngle = endAngle + innerAngleOffset; + const deltaInnerAngle = innerEndAngle - innerStartAngle; + const outerStartAngle = startAngle + outerAngleOffset; + const outerEndAngle = endAngle + outerAngleOffset; + const deltaOuterAngle = outerEndAngle - outerStartAngle; + const sizeFittingHeight = (labelHeight2) => { + const isCenterCircle = depth === 0 && parent?.sumSize === sumSize; + if (isCenterCircle) { + const labelWidth2 = 2 * Math.sqrt(outerRadius ** 2 - (labelHeight2 * 0.5) ** 2); + return { + width: labelWidth2, + height: labelHeight2, + meta: 0 + /* CenterCircle */ + }; + } + const parallelHeight = labelHeight2; + const availableWidthUntilItHitsTheOuterRadius = 2 * Math.sqrt(outerRadius ** 2 - (innerRadius + parallelHeight) ** 2); + const availableWidthUntilItHitsTheStraightEdges = deltaInnerAngle < Math.PI ? 2 * innerRadius * Math.tan(deltaInnerAngle * 0.5) : Infinity; + const parallelWidth = Math.min( + availableWidthUntilItHitsTheOuterRadius, + availableWidthUntilItHitsTheStraightEdges + ); + const maxPerpendicularAngle = Math.PI / 4; + let perpendicularHeight; + let perpendicularWidth; + if (depth === 0) { + perpendicularHeight = labelHeight2; + perpendicularWidth = Math.sqrt(outerRadius ** 2 - (perpendicularHeight / 2) ** 2) - labelHeight2 / (2 * Math.tan(deltaOuterAngle * 0.5)); + } else if (normalizeAngle3608(deltaInnerAngle) < maxPerpendicularAngle) { + perpendicularHeight = 2 * innerRadius * Math.tan(deltaInnerAngle * 0.5); + perpendicularWidth = Math.sqrt(outerRadius ** 2 - (perpendicularHeight / 2) ** 2) - innerRadius; + } else { + perpendicularWidth = 0; + perpendicularHeight = 0; + } + return parallelWidth >= perpendicularWidth ? { + width: parallelWidth, + height: parallelHeight, + meta: 1 + /* Parallel */ + } : { + width: perpendicularWidth, + height: perpendicularHeight, + meta: 2 + /* Perpendicular */ + }; + }; + const formatting = formatLabels( + toPlainText(labelValue), + this.properties.label, + toPlainText(secondaryLabelValue), + this.properties.secondaryLabel, + { padding: padding2 }, + sizeFittingHeight + ); + if (formatting == null) + return; + const { width: labelWidth, height: labelHeight, meta: labelPlacement, label, secondaryLabel } = formatting; + const theta = angleOffset + (startAngle + endAngle) / 2; + const top = Math.sin(theta) >= 0; + const right = Math.cos(theta) >= 0; + const circleQuarter = (top ? 3 : 12) & (right ? 6 : 9); + let labelRadius; + switch (labelPlacement) { + case 0: + labelRadius = 0; + break; + case 1: { + const opticalCentering = 0.58; + const idealRadius = outerRadius - (radiusScale - labelHeight) * opticalCentering; + const maximumRadius = Math.sqrt((outerRadius - padding2) ** 2 - (labelWidth / 2) ** 2); + labelRadius = Math.min(idealRadius, maximumRadius); + break; + } + case 2: + if (depth === 0) { + const minimumRadius = labelHeight / (2 * Math.tan(deltaInnerAngle * 0.5)) + labelWidth * 0.5; + const maximumRadius = Math.sqrt(outerRadius ** 2 - (labelHeight * 0.5) ** 2) - labelWidth * 0.5; + labelRadius = (minimumRadius + maximumRadius) * 0.5; + } else { + labelRadius = (innerRadius + outerRadius) * 0.5; + } + break; + } + if (label != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.label; + node.label = { + ...label, + fontStyle, + fontFamily, + fontWeight, + color: color6, + labelPlacement, + circleQuarter, + radius: labelRadius, + theta + }; + } + if (secondaryLabel != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.secondaryLabel; + node.secondaryLabel = { + ...secondaryLabel, + fontStyle, + fontFamily, + fontWeight, + color: color6, + labelPlacement, + circleQuarter, + radius: labelRadius, + theta + }; + } + node.contentHeight = formatting.height; + }); + const updateSector = (nodeDatum, sector, highlighted) => { + const { depth, startAngle, endAngle } = nodeDatum; + if (depth == null) { + sector.visible = false; + return; + } + sector.visible = true; + const style2 = this.getItemStyle(nodeDatum, highlighted); + const fill = style2.fill; + const strokeWidth = style2.strokeWidth; + const fillBBox = module_support_exports.isGradientFill(fill) && fill.bounds !== "item" ? seriesFillBBox : void 0; + applyShapeStyle19(sector, style2, fillBBox); + sector.centerX = 0; + sector.centerY = 0; + sector.innerRadius = depth * radiusScale; + sector.outerRadius = (depth + 1) * radiusScale; + sector.startAngle = startAngle + angleOffset; + sector.endAngle = endAngle + angleOffset; + sector.inset = baseInset + strokeWidth * 0.5; + sector.cornerRadius = cornerRadius; + }; + this.datumSelection.each((sector, datum) => { + updateSector(datum, sector, false); + }); + this.highlightSelection.each((rect2, datum) => { + updateSector(datum, rect2, true); + }); + const updateText = (node, text2, tag, highlighted) => { + const { depth, contentHeight } = node; + const primary = tag === 0; + const label = primary ? node.label : node.secondaryLabel; + if (depth == null || label == null) { + text2.visible = false; + return; + } + const { labelPlacement, circleQuarter, radius: textRadius, theta } = label; + let highlightedColor; + if (highlighted) { + const highlightedLabelStyle = primary ? this.properties.highlightStyle.label : this.properties.highlightStyle.secondaryLabel; + highlightedColor = highlightedLabelStyle.color; + } + const params = { + childrenKey: this.properties.childrenKey, + colorKey: this.properties.colorKey, + colorName: this.properties.colorName ?? this.properties.colorKey, + depth: node.depth ?? Number.NaN, + labelKey: this.properties.labelKey, + secondaryLabelKey: this.properties.secondaryLabelKey, + sizeKey: this.properties.sizeKey, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }; + const baseLabelStyle = primary ? this.properties.label : this.properties.secondaryLabel; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const style2 = getLabelStyles7(this, node, params, baseLabelStyle, highlighted, activeHighlight); + text2.text = label.text; + text2.fontSize = label.fontSize; + text2.lineHeight = label.lineHeight; + text2.fontStyle = label.fontStyle; + text2.fontFamily = label.fontFamily; + text2.fontWeight = label.fontWeight; + text2.fill = highlightedColor ?? label.color; + text2.fillOpacity = this.getHighlightStyle(highlighted, node.datumIndex)?.opacity ?? 1; + text2.setBoxing(style2); + switch (labelPlacement) { + case 0: + text2.textAlign = "center"; + text2.textBaseline = "top"; + text2.translationX = 0; + text2.translationY = (primary ? 0 : contentHeight - label.height) - contentHeight * 0.5; + text2.rotation = 0; + break; + case 1: { + const topHalf = (circleQuarter & 3) !== 0; + const translationRadius = primary === !topHalf ? textRadius : textRadius - (contentHeight - label.height); + text2.textAlign = "center"; + text2.textBaseline = topHalf ? "bottom" : "top"; + text2.translationX = Math.cos(theta) * translationRadius; + text2.translationY = Math.sin(theta) * translationRadius; + text2.rotation = topHalf ? theta - Math.PI * 0.5 : theta + Math.PI * 0.5; + break; + } + case 2: { + const rightHalf = (circleQuarter & 6) !== 0; + const translation = primary === !rightHalf ? (contentHeight - label.height) * 0.5 : (label.height - contentHeight) * 0.5; + text2.textAlign = "center"; + text2.textBaseline = "middle"; + text2.translationX = Math.cos(theta) * textRadius + Math.cos(theta + Math.PI / 2) * translation; + text2.translationY = Math.sin(theta) * textRadius + Math.sin(theta + Math.PI / 2) * translation; + text2.rotation = rightHalf ? theta : theta + Math.PI; + break; + } + } + text2.visible = true; + }; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + for (const text2 of this.labelSelection.selectByClass(TransformableText3)) { + const datum = text2.closestDatum(); + updateText(datum, text2, text2.tag, datum === highlightedDatum); + } + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties, ctx } = this; + const { labelKey, secondaryLabelKey, childrenKey, sizeKey, sizeName, colorKey, colorName, tooltip } = properties; + const { formatManager } = ctx; + const nodeDatum = datumIndex.reduce((n, i) => n?.children[i], this.rootNode); + if (nodeDatum == null) + return; + const { datum, depth } = nodeDatum; + if (datum == null || depth == null) + return; + const data = []; + const datumSize = sizeKey == null ? void 0 : datum[sizeKey]; + if (datumSize != null) { + const sizeDomain = [0, this.rootNode?.sumSize ?? 0]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumSize, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain: sizeDomain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue22(datumSize) }); + } + const datumColor = colorKey == null ? void 0 : datum[colorKey]; + if (datumColor != null) { + const { colorDomain } = this; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumColor, + datum, + seriesId, + legendItemName: void 0, + key: colorKey, + source: "tooltip", + property: "color", + boundSeries: this.getFormatterContext("color"), + domain: colorDomain, + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue22(datumColor) }); + } + const format = this.getItemStyle( + { ...nodeDatum, colorValue: datumColor ?? nodeDatum.colorValue }, + false + ); + const color6 = format.fill; + const markerStyle = { + shape: "square", + fill: color6, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + }; + if (module_support_exports.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + return this.formatTooltipWithContext( + tooltip, + { + title: labelKey == null ? void 0 : datum[labelKey], + symbol: { + marker: markerStyle + }, + data + }, + { + seriesId, + datum, + title: void 0, + depth, + labelKey, + secondaryLabelKey, + childrenKey, + sizeKey, + sizeName, + colorKey, + colorName, + ...format + } + ); + } + createNodeData() { + return void 0; + } + pickNodeClosestDatum(point) { + return this.pickNodeNearestDistantObject(point, this.datumSelection.nodes()); + } + animateEmptyUpdateReady() { + fromToMotion6(this.id, "nodes", this.ctx.animationManager, [this.scalingGroup], { + toFn() { + return { scalingX: 1, scalingY: 1 }; + }, + fromFn() { + return { scalingX: 0, scalingY: 0 }; + } + }); + } + computeFocusBounds(node) { + return node; + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.label.itemStyler != null; + } +}; +SunburstSeries.className = "SunburstSeries"; +SunburstSeries.type = "sunburst"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs222, sunburstSeriesThemeableOptionsDef: sunburstSeriesThemeableOptionsDef2, without: without8 } = module_support_exports; +var sunburstSeriesOptionsDef = { + ...sunburstSeriesThemeableOptionsDef2, + ...without8(commonSeriesOptionsDefs222, ["highlightStyle", "highlight", "showInLegend"]), + type: required(constant("sunburst")), + labelKey: string, + secondaryLabelKey: string, + childrenKey: string, + sizeKey: string, + colorKey: string, + sizeName: string, + colorName: string +}; +var { BASE_FONT_SIZE: BASE_FONT_SIZE2, FONT_SIZE_RATIO: FONT_SIZE_RATIO3 } = module_support_exports; +var SunburstModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "sunburst", + moduleFactory: (ctx) => new SunburstSeries(ctx), + solo: true, + themeTemplate: { + series: { + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", module_support_exports.FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + colorRange: { $palette: "divergingColors" }, + strokeWidth: { $isUserOption: ["./strokes/0", 2, 0] }, + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $rem: FONT_SIZE_RATIO3.LARGE }, + minimumFontSize: { $rem: 9 / BASE_FONT_SIZE2 }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + overflowStrategy: "ellipsis", + wrapping: "never", + spacing: 2 + }, + secondaryLabel: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + fontFamily: { $ref: "fontFamily" }, + fontSize: { $rem: FONT_SIZE_RATIO3.SMALLEST }, + minimumFontSize: { $rem: 7 / BASE_FONT_SIZE2 }, + fontWeight: { $ref: "fontWeight" }, + color: { $ref: "chartBackgroundColor" }, + overflowStrategy: "ellipsis", + wrapping: "never" + }, + sectorSpacing: 2, + padding: 3, + highlightStyle: { + label: { + color: { $ref: "chartBackgroundColor" } + }, + secondaryLabel: { + color: { $ref: "chartBackgroundColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + } + }, + gradientLegend: { + enabled: true, + ...module_support_exports.LEGEND_CONTAINER_THEME + } + } +}; +var SunburstSeriesModule = { + type: "series", + name: "sunburst", + chartType: "standalone", + enterprise: true, + options: sunburstSeriesOptionsDef, + create: (ctx) => new SunburstSeries(ctx) +}; +var { BaseProperties: BaseProperties30, HierarchySeriesProperties: HierarchySeriesProperties22, HighlightStyle: HighlightStyle22, makeSeriesTooltip: makeSeriesTooltip24, Property: Property84, Label: Label18 } = module_support_exports; +var TreemapGroupLabel = class extends Label18 { + constructor() { + super(...arguments); + this.spacing = 0; + } +}; +__decorateClass2([ + Property84 +], TreemapGroupLabel.prototype, "spacing", 2); +var TreemapSeriesGroup = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.textAlign = "center"; + this.gap = 0; + this.padding = 0; + this.interactive = true; + this.label = new TreemapGroupLabel(); + } +}; +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "fill", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "fillOpacity", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "stroke", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "strokeWidth", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "cornerRadius", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "textAlign", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "gap", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "padding", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "interactive", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroup.prototype, "label", 2); +var TreemapSeriesTile = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.fill = void 0; + this.fillOpacity = 1; + this.strokeWidth = 1; + this.strokeOpacity = 1; + this.cornerRadius = 0; + this.textAlign = "center"; + this.verticalAlign = "middle"; + this.gap = 0; + this.padding = 0; + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + } +}; +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "fill", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "fillOpacity", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "stroke", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "strokeWidth", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "cornerRadius", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "textAlign", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "verticalAlign", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "gap", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "padding", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "label", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTile.prototype, "secondaryLabel", 2); +var TreemapSeriesGroupHighlightStyle = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.label = new AutoSizedLabel(); + } +}; +__decorateClass2([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "fill", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "stroke", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property84 +], TreemapSeriesGroupHighlightStyle.prototype, "label", 2); +var TreemapSeriesTileHighlightStyle = class extends BaseProperties30 { + constructor() { + super(...arguments); + this.label = new AutoSizedLabel(); + this.secondaryLabel = new AutoSizedSecondaryLabel(); + } +}; +__decorateClass2([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "fill", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "fillOpacity", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "stroke", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "strokeWidth", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "strokeOpacity", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "label", 2); +__decorateClass2([ + Property84 +], TreemapSeriesTileHighlightStyle.prototype, "secondaryLabel", 2); +var TreemapSeriesHighlightStyle = class extends HighlightStyle22 { + constructor() { + super(false); + this.group = new TreemapSeriesGroupHighlightStyle(); + this.tile = new TreemapSeriesTileHighlightStyle(); + } + getStyle(isLeaf) { + return isLeaf ? this.tile : this.group; + } +}; +__decorateClass2([ + Property84 +], TreemapSeriesHighlightStyle.prototype, "group", 2); +__decorateClass2([ + Property84 +], TreemapSeriesHighlightStyle.prototype, "tile", 2); +var TreemapSeriesProperties = class extends HierarchySeriesProperties22 { + constructor() { + super(...arguments); + this.highlightStyle = new TreemapSeriesHighlightStyle(); + this.tooltip = makeSeriesTooltip24(); + this.group = new TreemapSeriesGroup(); + this.tile = new TreemapSeriesTile(); + this.undocumentedGroupFills = []; + this.undocumentedGroupStrokes = []; + } + getStyle(isLeaf, fills, strokes, index) { + const { + fillOpacity, + strokeWidth, + strokeOpacity, + fill = isLeaf ? fills[index % fills.length] : fills[Math.min(index, fills.length)], + stroke: stroke22 = isLeaf ? strokes[index % fills.length] : strokes[Math.min(index, strokes.length)] + } = isLeaf ? this.tile : this.group; + return { + fill, + fillOpacity, + stroke: stroke22, + strokeWidth, + strokeOpacity, + opacity: 1 + }; + } +}; +__decorateClass2([ + Property84 +], TreemapSeriesProperties.prototype, "sizeName", 2); +__decorateClass2([ + Property84 +], TreemapSeriesProperties.prototype, "labelKey", 2); +__decorateClass2([ + Property84 +], TreemapSeriesProperties.prototype, "secondaryLabelKey", 2); +__decorateClass2([ + Property84 +], TreemapSeriesProperties.prototype, "itemStyler", 2); +__decorateClass2([ + Property84 +], TreemapSeriesProperties.prototype, "highlightStyle", 2); +__decorateClass2([ + Property84 +], TreemapSeriesProperties.prototype, "tooltip", 2); +__decorateClass2([ + Property84 +], TreemapSeriesProperties.prototype, "group", 2); +__decorateClass2([ + Property84 +], TreemapSeriesProperties.prototype, "tile", 2); +__decorateClass2([ + Property84 +], TreemapSeriesProperties.prototype, "undocumentedGroupFills", 2); +__decorateClass2([ + Property84 +], TreemapSeriesProperties.prototype, "undocumentedGroupStrokes", 2); +var { + createDatumId: createDatumId222, + Rect: Rect9, + Group: Group21, + BBox: BBox28, + Selection: Selection18, + Text: Text10, + Transformable: Transformable4, + applyShapeStyle: applyShapeStyle20, + getLabelStyles: getLabelStyles8, + mergeDefaults: mergeDefaults222, + formatValue: formatValue3 +} = module_support_exports; +var TreemapNode = class extends module_support_exports.HierarchyNode { + constructor() { + super(...arguments); + this.labelValue = void 0; + this.secondaryLabelValue = void 0; + this.label = void 0; + this.secondaryLabel = void 0; + this.bbox = void 0; + this.padding = void 0; + } +}; +function nodeSize(node) { + return node.children.length > 0 ? node.sumSize - node.sizeValue : node.sizeValue; +} +var textAlignFactors2 = { + left: 0, + center: 0.5, + right: 1 +}; +var verticalAlignFactors4 = { + top: 0, + middle: 0.5, + bottom: 1 +}; +var DistantGroup = class extends module_support_exports.Group { + distanceSquared(x, y) { + return this.getBBox().distanceSquared(x, y); + } +}; +var TreemapSeries = class extends module_support_exports.HierarchySeries { + constructor() { + super(...arguments); + this.NodeClass = TreemapNode; + this.properties = new TreemapSeriesProperties(); + this.rectGroup = this.contentGroup.appendChild(new Group21()); + this.datumSelection = Selection18.select(this.rectGroup, Rect9); + this.labelSelection = Selection18.select(this.labelGroup, Group21); + this.highlightSelection = Selection18.select( + this.rectGroup, + Rect9 + ); + } + groupTitleHeight(node, bbox) { + const { labelValue } = node; + const { label: font22 } = this.properties.group; + const heightRatioThreshold = 3; + if (labelValue == null) { + return; + } else if (font22.fontSize > bbox.width / heightRatioThreshold || font22.fontSize > bbox.height / heightRatioThreshold) { + return; + } else { + const { height: fontHeight } = cachedTextMeasurer(font22).measureLines(labelValue); + return Math.max(fontHeight, font22.fontSize); + } + } + getNodePadding(node, bbox) { + if (node.parent == null) { + return { + top: 0, + right: 0, + bottom: 0, + left: 0 + }; + } else if (node.children.length === 0) { + const { padding: padding22 } = this.properties.tile; + return { + top: padding22, + right: padding22, + bottom: padding22, + left: padding22 + }; + } + const { + label: { spacing }, + padding: padding2 + } = this.properties.group; + const fontHeight = this.groupTitleHeight(node, bbox); + const titleHeight = fontHeight == null ? 0 : fontHeight + spacing; + return { + top: padding2 + titleHeight, + right: padding2, + bottom: padding2, + left: padding2 + }; + } + sortChildren({ children }) { + const sortedChildrenIndices = Array.from(children, (_, i) => i).filter((i) => nodeSize(children[i]) > 0).sort((aIndex, bIndex) => nodeSize(children[bIndex]) - nodeSize(children[aIndex])); + const childAt = (i) => { + const sortedIndex = sortedChildrenIndices[i]; + return children[sortedIndex]; + }; + return { sortedChildrenIndices, childAt }; + } + /** + * Squarified Treemap algorithm + * https://www.win.tue.nl/~vanwijk/stm.pdf + */ + squarify(node, bbox) { + const { datum, children } = node; + if (bbox.width <= 0 || bbox.height <= 0) { + node.bbox = void 0; + node.padding = void 0; + node.midPoint.x = Number.NaN; + node.midPoint.y = Number.NaN; + return; + } + const padding2 = datum == null ? { top: 0, right: 0, bottom: 0, left: 0 } : this.getNodePadding(node, bbox); + if (node.parent == null) { + node.bbox = void 0; + node.padding = void 0; + node.midPoint.x = Number.NaN; + node.midPoint.y = Number.NaN; + } else { + node.bbox = bbox; + node.padding = padding2; + node.midPoint.x = bbox.x + bbox.width / 2; + node.midPoint.y = bbox.y; + } + const { sortedChildrenIndices, childAt } = this.sortChildren(node); + const allLeafNodes = sortedChildrenIndices.every((sortedIndex) => children[sortedIndex].children.length === 0); + const targetTileAspectRatio = 1; + const width2 = bbox.width - padding2.left - padding2.right; + const height2 = bbox.height - padding2.top - padding2.bottom; + if (width2 <= 0 || height2 <= 0) + return; + const numChildren = sortedChildrenIndices.length; + let stackSum = 0; + let startIndex = 0; + let minRatioDiff = Infinity; + let partitionSum = sortedChildrenIndices.reduce((sum2, sortedIndex) => sum2 + nodeSize(children[sortedIndex]), 0); + const innerBox = new BBox28(bbox.x + padding2.left, bbox.y + padding2.top, width2, height2); + const partition = innerBox.clone(); + let i = 0; + while (i < numChildren) { + const value = nodeSize(childAt(i)); + const firstValue = nodeSize(childAt(startIndex)); + const isVertical2 = partition.width < partition.height; + stackSum += value; + const partThickness = isVertical2 ? partition.height : partition.width; + const partLength = isVertical2 ? partition.width : partition.height; + const firstTileLength = partLength * firstValue / stackSum; + let stackThickness = partThickness * stackSum / partitionSum; + const ratio3 = Math.max(firstTileLength, stackThickness) / Math.min(firstTileLength, stackThickness); + const diff8 = Math.abs(targetTileAspectRatio - ratio3); + if (diff8 < minRatioDiff) { + minRatioDiff = diff8; + i++; + continue; + } + stackSum -= value; + stackThickness = partThickness * stackSum / partitionSum; + let start22 = isVertical2 ? partition.x : partition.y; + for (let j = startIndex; j < i; j++) { + const child = childAt(j); + const childSize = nodeSize(child); + const x = isVertical2 ? start22 : partition.x; + const y = isVertical2 ? partition.y : start22; + const length2 = partLength * childSize / stackSum; + const stackWidth = isVertical2 ? length2 : stackThickness; + const stackHeight = isVertical2 ? stackThickness : length2; + const childBbox = new BBox28(x, y, stackWidth, stackHeight); + this.applyGap(innerBox, childBbox, allLeafNodes); + this.squarify(child, childBbox); + partitionSum -= childSize; + start22 += length2; + } + if (isVertical2) { + partition.y += stackThickness; + partition.height -= stackThickness; + } else { + partition.x += stackThickness; + partition.width -= stackThickness; + } + startIndex = i; + stackSum = 0; + minRatioDiff = Infinity; + } + const isVertical = partition.width < partition.height; + let start2 = isVertical ? partition.x : partition.y; + for (let childIdx = startIndex; childIdx < numChildren; childIdx++) { + const child = childAt(childIdx); + const x = isVertical ? start2 : partition.x; + const y = isVertical ? partition.y : start2; + const part = nodeSize(child) / partitionSum; + const childWidth = partition.width * (isVertical ? part : 1); + const childHeight = partition.height * (isVertical ? 1 : part); + const childBox = new BBox28(x, y, childWidth, childHeight); + this.applyGap(innerBox, childBox, allLeafNodes); + this.squarify(child, childBox); + start2 += isVertical ? childWidth : childHeight; + } + } + applyGap(innerBox, childBox, allLeafNodes) { + const gap = allLeafNodes ? this.properties.tile.gap * 0.5 : this.properties.group.gap * 0.5; + const getBounds = (box) => ({ + left: box.x, + top: box.y, + right: box.x + box.width, + bottom: box.y + box.height + }); + const innerBounds = getBounds(innerBox); + const childBounds = getBounds(childBox); + const sides = ["top", "right", "bottom", "left"]; + for (const side of sides) { + if (!isNumberEqual(innerBounds[side], childBounds[side])) { + childBox.shrink(gap, side); + } + } + } + createNodeData() { + return void 0; + } + getItemStyle(nodeDatum, isLeaf, isHighlight) { + const { properties, colorScale } = this; + const { itemStyler } = properties; + const rootIndex = nodeDatum.datumIndex?.[0] ?? 0; + const fills = isLeaf ? properties.fills : properties.undocumentedGroupFills; + const strokes = isLeaf ? properties.strokes : properties.undocumentedGroupStrokes; + const index = isLeaf ? rootIndex : nodeDatum.depth ?? -1; + const highlightStyle = isHighlight ? properties.highlightStyle.getStyle(isLeaf) : void 0; + const baseStyle = mergeDefaults222(highlightStyle, properties.getStyle(isLeaf, fills, strokes, index)); + if (!isHighlight && isLeaf && nodeDatum.colorValue != null) { + baseStyle.fill = colorScale.convert(nodeDatum.colorValue); + } + let style2 = baseStyle; + if (itemStyler != null && nodeDatum != null) { + const overrides = this.cachedDatumCallback( + createDatumId222(this.getDatumId(nodeDatum), isHighlight ? "highlight" : "node"), + () => { + const params = this.makeItemStylerParams(nodeDatum, isHighlight, style2); + return this.callWithContext(itemStyler, params); + } + ); + if (overrides) { + style2 = mergeDefaults222(overrides, style2); + } + } + return style2; + } + makeItemStylerParams(nodeDatum, isHighlight, style2) { + const { id: seriesId } = this; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const highlightState = this.getHighlightStateString(activeHighlight, isHighlight, nodeDatum.datumIndex); + const fill = this.filterItemStylerFillParams(style2.fill) ?? style2.fill; + return { + seriesId, + datum: nodeDatum.datum, + depth: nodeDatum.depth ?? -1, + highlighted: isHighlight, + highlightState, + ...style2, + fill + }; + } + updateSelections() { + let highlightedNode = this.ctx.highlightManager?.getActiveHighlight(); + if (highlightedNode != null && !this.properties.group.interactive && highlightedNode.children.length !== 0) { + highlightedNode = void 0; + } + this.highlightSelection.update( + highlightedNode == null ? [] : [highlightedNode], + void 0, + (node) => this.getDatumId(node) + ); + if (!this.nodeDataRefresh) { + return; + } + this.nodeDataRefresh = false; + const { seriesRect } = this.chart ?? {}; + if (!seriesRect) + return; + const descendants = Array.from(this.rootNode); + const updateLabelGroup = (group) => { + group.append([new Text10({ + tag: 0 + /* Primary */ + }), new Text10({ + tag: 1 + /* Secondary */ + })]); + }; + this.datumSelection.update(descendants, void 0, (node) => this.getDatumId(node)); + this.labelSelection.update(descendants, updateLabelGroup, (node) => this.getDatumId(node)); + } + updateNodes() { + const { rootNode, data } = this; + const { + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + highlightStyle, + tile, + group + } = this.properties; + const { seriesRect } = this.chart ?? {}; + if (!seriesRect || !data) + return; + this.rootNode?.walk((node) => { + const { datum, depth, children } = node; + const isLeaf = children.length === 0; + const labelStyle = isLeaf ? tile.label : group.label; + let labelValue; + if (labelStyle.enabled && datum != null && depth != null && labelKey != null) { + const value = datum[labelKey]; + labelValue = this.getLabelText( + value, + datum, + labelKey, + "label", + [], + labelStyle, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (labelValue === "") { + labelValue = void 0; + } + let secondaryLabelValue; + if (tile.secondaryLabel.enabled && isLeaf && datum != null && depth != null && secondaryLabelKey != null) { + const value = datum[secondaryLabelKey]; + secondaryLabelValue = this.getLabelText( + value, + datum, + secondaryLabelKey, + "secondaryLabel", + [], + tile.secondaryLabel, + { + depth, + datum, + childrenKey, + colorKey, + colorName, + labelKey, + secondaryLabelKey, + sizeKey, + sizeName, + value + } + ); + } + if (secondaryLabelValue === "") { + secondaryLabelValue = void 0; + } + node.labelValue = toPlainText(labelValue); + node.secondaryLabelValue = toPlainText(secondaryLabelValue); + }); + const { width: width2, height: height2 } = seriesRect; + this.squarify(rootNode, new BBox28(0, 0, width2, height2)); + this.rootNode?.walk((node) => { + const { bbox, children, labelValue, secondaryLabelValue } = node; + node.label = void 0; + node.secondaryLabel = void 0; + if (bbox == null) + return; + if (children.length === 0) { + const layout = { + width: bbox.width, + height: bbox.height, + meta: null + }; + const formatting = formatLabels( + labelValue, + this.properties.tile.label, + secondaryLabelValue, + this.properties.tile.secondaryLabel, + { padding: tile.padding }, + () => layout + ); + if (formatting == null) { + return; + } + const { height: labelHeight, label, secondaryLabel } = formatting; + const { textAlign, verticalAlign, padding: padding2 } = tile; + const textAlignFactor = textAlignFactors2[textAlign] ?? 0.5; + const labelX = bbox.x + padding2 + (bbox.width - 2 * padding2) * textAlignFactor; + const verticalAlignFactor = verticalAlignFactors4[verticalAlign] ?? 0.5; + const labelYStart = bbox.y + padding2 + labelHeight * 0.5 + (bbox.height - 2 * padding2 - labelHeight) * verticalAlignFactor; + if (label != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.tile.label; + node.label = { + text: label.text, + fontSize: label.fontSize, + lineHeight: label.lineHeight, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: labelX, + y: labelYStart - (labelHeight - label.height) * 0.5 + }; + } + if (secondaryLabel != null) { + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.tile.secondaryLabel; + node.secondaryLabel = { + text: secondaryLabel.text, + fontSize: secondaryLabel.fontSize, + lineHeight: secondaryLabel.fontSize, + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: labelX, + y: labelYStart + (labelHeight - secondaryLabel.height) * 0.5 + }; + } + } else if (labelValue == null) { + return; + } else { + const { padding: padding2, textAlign } = group; + const groupTitleHeight = this.groupTitleHeight(node, bbox); + if (groupTitleHeight == null) + return; + const innerWidth = bbox.width - 2 * padding2; + const text2 = wrapText(labelValue, { + maxWidth: bbox.width - 2 * padding2, + font: group.label, + textWrap: "never" + }); + const textAlignFactor = textAlignFactors2[textAlign] ?? 0.5; + const { + fontStyle = "normal", + fontFamily, + fontWeight = "normal", + color: color6 = "black" + } = this.properties.group.label; + node.label = { + text: text2, + fontSize: group.label.fontSize, + lineHeight: calcLineHeight(group.label.fontSize), + fontStyle, + fontFamily, + fontWeight, + color: color6, + textAlign, + verticalAlign: "middle", + x: bbox.x + padding2 + innerWidth * textAlignFactor, + y: bbox.y + padding2 + groupTitleHeight * 0.5 + }; + } + }); + const fillBBox = { + series: new BBox28(0, 0, width2, height2), + axis: new BBox28(0, 0, width2, height2) + }; + const updateRectFn = (node, rect2, isHighlight) => { + const { bbox } = node; + if (bbox == null) { + rect2.visible = false; + return; + } + const { depth = -1 } = node; + const isLeaf = node.children.length === 0; + const style2 = this.getItemStyle(node, isLeaf, isHighlight); + rect2.crisp = true; + applyShapeStyle20(rect2, style2, fillBBox); + rect2.cornerRadius = isLeaf ? tile.cornerRadius : group.cornerRadius; + rect2.zIndex = [0, depth, isHighlight ? 1 : 0]; + const onlyLeaves = node.parent?.children.every((n) => n.children.length === 0); + const parentBbox = node.parent == null ? void 0 : node.parent.bbox; + const parentPadding = node.parent == null ? void 0 : node.parent.padding; + if (onlyLeaves === true && parentBbox != null && parentPadding != null) { + rect2.clipBBox = bbox; + rect2.x = parentBbox.x + parentPadding.left; + rect2.y = parentBbox.y + parentPadding.top; + rect2.width = parentBbox.width - (parentPadding.left + parentPadding.right); + rect2.height = parentBbox.height - (parentPadding.top + parentPadding.bottom); + } else { + rect2.clipBBox = void 0; + rect2.x = bbox.x; + rect2.y = bbox.y; + rect2.width = bbox.width; + rect2.height = bbox.height; + } + rect2.visible = true; + }; + this.datumSelection.each((rect2, datum) => updateRectFn(datum, rect2, false)); + this.highlightSelection.each((rect2, datum) => { + updateRectFn(datum, rect2, true); + }); + const updateLabelFn = (node, text2, tag, highlighted) => { + const isLeaf = node.children.length === 0; + const label = tag === 0 ? node.label : node.secondaryLabel; + if (label == null) { + text2.visible = false; + return; + } + const labelProps = tag === 0 ? tile.label : tile.secondaryLabel; + let highlightedColor; + if (highlighted) { + const { tile: hTitle, group: hGroup } = highlightStyle; + highlightedColor = hTitle.secondaryLabel.color; + if (!isLeaf) { + highlightedColor = hGroup.label.color; + } else if (tag === 0) { + highlightedColor = hTitle.label.color; + } + } + const params = { + childrenKey: this.properties.childrenKey, + colorKey: this.properties.colorKey, + colorName: this.properties.colorName ?? this.properties.colorKey, + depth: node.depth ?? Number.NaN, + labelKey: this.properties.labelKey, + secondaryLabelKey: this.properties.secondaryLabelKey, + sizeKey: this.properties.sizeKey, + sizeName: this.properties.sizeName ?? this.properties.sizeKey + }; + const activeHighlight = this.ctx.highlightManager?.getActiveHighlight(); + const style2 = getLabelStyles8(this, node, params, labelProps, highlighted, activeHighlight); + text2.text = label.text; + text2.fontSize = label.fontSize; + text2.lineHeight = label.lineHeight; + text2.fontStyle = label.fontStyle; + text2.fontFamily = label.fontFamily; + text2.fontWeight = label.fontWeight; + text2.fill = highlightedColor ?? label.color; + text2.fillOpacity = this.getHighlightStyle(highlighted, node.datumIndex)?.opacity ?? 1; + text2.textAlign = label.textAlign; + text2.textBaseline = label.verticalAlign; + text2.x = label.x; + text2.y = label.y; + text2.setBoxing(style2); + text2.visible = true; + text2.zIndex = 1; + }; + const highlightedDatum = this.ctx.highlightManager?.getActiveHighlight(); + for (const text2 of this.labelSelection.selectByClass(Text10)) { + const datum = text2.closestDatum(); + updateLabelFn(datum, text2, text2.tag, datum === highlightedDatum); + } + } + pickNodesExactShape(point) { + const nodes = super.pickNodesExactShape(point); + nodes.sort((a, b) => b.datumIndex.length - a.datumIndex.length); + return nodes; + } + pickNodeClosestDatum(point) { + const exactMatch = this.pickNodesExactShape(point); + if (exactMatch.length !== 0) { + return { datum: exactMatch[0], distance: 0 }; + } + return this.pickNodeNearestDistantObject(point, this.datumSelection.nodes()); + } + getTooltipContent(datumIndex) { + const { id: seriesId, properties, ctx } = this; + const { formatManager } = ctx; + const { labelKey, secondaryLabelKey, childrenKey, sizeKey, sizeName, colorKey, colorName, tooltip } = properties; + const nodeDatum = datumIndex.reduce((n, i) => n?.children[i], this.rootNode); + if (nodeDatum == null) + return; + const { datum, depth, children } = nodeDatum; + if (datum == null || depth == null) + return; + const isLeaf = children.length === 0; + const data = []; + const datumSize = sizeKey == null ? void 0 : datum[sizeKey]; + if (datumSize != null) { + const sizeDomain = [0, this.rootNode?.sumSize ?? 0]; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumSize, + datum, + seriesId, + legendItemName: void 0, + key: sizeKey, + source: "tooltip", + property: "size", + boundSeries: this.getFormatterContext("size"), + domain: sizeDomain, + fractionDigits: void 0 + }); + data.push({ label: sizeName, fallbackLabel: sizeKey, value: content ?? formatValue3(datumSize) }); + } + const datumColor = colorKey == null ? void 0 : datum[colorKey]; + if (datumColor != null) { + const { colorDomain } = this; + const content = formatManager.format(this.callWithContext.bind(this), { + type: "number", + value: datumColor, + datum, + seriesId, + legendItemName: void 0, + key: colorKey, + source: "tooltip", + property: "color", + boundSeries: this.getFormatterContext("color"), + domain: colorDomain, + fractionDigits: void 0 + }); + data.push({ label: colorName, fallbackLabel: colorKey, value: content ?? formatValue3(datumColor) }); + } + const format = this.getItemStyle( + { ...nodeDatum, colorValue: datumColor ?? nodeDatum.colorValue }, + isLeaf, + false + ); + const color6 = format.fill; + const markerStyle = { + shape: "square", + fill: color6, + fillOpacity: 1, + stroke: void 0, + strokeWidth: 0, + strokeOpacity: 1, + lineDash: [0], + lineDashOffset: 0 + }; + if (module_support_exports.isGradientFill(markerStyle.fill)) { + markerStyle.fill = { ...markerStyle.fill, gradient: "linear", rotation: 0, reverse: false }; + } + const symbol = isLeaf ? { marker: markerStyle } : void 0; + return this.formatTooltipWithContext( + tooltip, + { + title: labelKey == null ? void 0 : datum[labelKey], + symbol, + data + }, + { + seriesId, + datum, + title: void 0, + depth, + labelKey, + secondaryLabelKey, + childrenKey, + sizeKey, + sizeName, + colorKey, + colorName, + ...format + } + ); + } + computeFocusBounds(node) { + return Transformable4.toCanvas(this.contentGroup, node.getBBox()); + } + hasItemStylers() { + return this.properties.itemStyler != null || this.properties.tile.label.itemStyler != null || this.properties.group.label.itemStyler != null; + } +}; +TreemapSeries.className = "TreemapSeries"; +TreemapSeries.type = "treemap"; +var { commonSeriesOptionsDefs: commonSeriesOptionsDefs23, treemapSeriesThemeableOptionsDef: treemapSeriesThemeableOptionsDef2, without: without9 } = module_support_exports; +var treemapSeriesOptionsDef = { + ...treemapSeriesThemeableOptionsDef2, + ...without9(commonSeriesOptionsDefs23, ["highlightStyle", "highlight", "showInLegend"]), + type: required(constant("treemap")), + labelKey: string, + secondaryLabelKey: string, + childrenKey: string, + sizeKey: string, + colorKey: string, + sizeName: string, + colorName: string +}; +treemapSeriesOptionsDef.undocumentedGroupFills = undocumented(arrayOf(color)); +treemapSeriesOptionsDef.undocumentedGroupStrokes = undocumented(arrayOf(color)); +var { FONT_SIZE_RATIO: FONT_SIZE_RATIO4 } = module_support_exports; +var TreemapModule = { + type: "series", + optionsKey: "series[]", + packageType: "enterprise", + chartTypes: ["standalone"], + identifier: "treemap", + moduleFactory: (ctx) => new TreemapSeries(ctx), + solo: true, + themeTemplate: { + series: { + fills: { + $applyCycle: [ + { $size: { $path: ["./data", { $path: "/data" }] } }, + { $palette: "fills" }, + { + $applySwitch: [ + { $path: ["/type", void 0, { $value: "$1" }] }, + { $value: "$1" }, + ["gradient", module_support_exports.FILL_GRADIENT_LINEAR_DEFAULTS], + ["pattern", module_support_exports.FILL_PATTERN_DEFAULTS], + ["image", module_support_exports.FILL_IMAGE_DEFAULTS] + ] + } + ] + }, + strokes: { + $applyCycle: [{ $size: { $path: ["./data", { $path: "/data" }] } }, { $palette: "strokes" }] + }, + colorRange: { $palette: "divergingColors" }, + // @ts-expect-error undocumented option + undocumentedGroupFills: { $palette: "hierarchyColors" }, + undocumentedGroupStrokes: { $palette: "secondHierarchyColors" }, + group: { + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "textColor" }, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $ref: "fontSize" }, + fontFamily: { $ref: "fontFamily" }, + spacing: 4 + }, + fill: void 0, + // Override default fill + stroke: void 0, + // Override default stroke + strokeWidth: 1, + padding: 4, + gap: 2, + textAlign: "left" + }, + tile: { + label: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "chartBackgroundColor" }, + fontStyle: void 0, + fontWeight: { $ref: "fontWeight" }, + fontSize: { $rem: 1.5 }, + minimumFontSize: { $rem: FONT_SIZE_RATIO4.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + wrapping: "on-space", + overflowStrategy: "ellipsis", + spacing: 2 + }, + secondaryLabel: { + ...module_support_exports.LABEL_BOXING_DEFAULTS, + enabled: true, + color: { $ref: "chartBackgroundColor" }, + fontStyle: void 0, + fontWeight: void 0, + fontSize: { $ref: "fontSize" }, + minimumFontSize: { $rem: FONT_SIZE_RATIO4.SMALLER }, + fontFamily: { $ref: "fontFamily" }, + wrapping: "never", + overflowStrategy: "ellipsis" + }, + fill: void 0, + // Override default fill + stroke: void 0, + // Override default stroke + strokeWidth: { $isUserOption: ["../strokes/0", 2, { $isUserOption: ["./stroke", 2, 0] }] }, + padding: 3, + gap: 1 + }, + // Override defaults + highlightStyle: { + group: { + label: { + color: { $ref: "textColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + }, + tile: { + label: { + color: { $ref: "chartBackgroundColor" } + }, + secondaryLabel: { + color: { $ref: "chartBackgroundColor" } + }, + fill: "rgba(255,255,255, 0.33)", + stroke: `rgba(0, 0, 0, 0.4)`, + strokeWidth: 2 + } + } + }, + gradientLegend: { + enabled: true, + ...module_support_exports.LEGEND_CONTAINER_THEME + } + } +}; +var TreemapSeriesModule = { + type: "series", + name: "treemap", + chartType: "standalone", + enterprise: true, + options: treemapSeriesOptionsDef, + create: (ctx) => new TreemapSeries(ctx) +}; +var ModuleRegistry2 = module_support_exports.ModuleRegistry; +var AllCartesianEnterpriseModules = [ + OrdinalTimeAxisModule2, + BoxPlotSeriesModule, + CandlestickSeriesModule, + ConeFunnelSeriesModule, + FunnelSeriesModule, + HeatmapSeriesModule, + OhlcSeriesModule, + RangeAreaSeriesModule, + RangeBarSeriesModule, + WaterfallSeriesModule +]; +var AllPolarEnterpriseModules = [ + AngleNumberAxisModule2, + AngleCategoryAxisModule2, + RadiusNumberAxisModule2, + RadiusCategoryAxisModule2, + NightingaleSeriesModule, + RadarAreaSeriesModule, + RadarLineSeriesModule, + RadialBarSeriesModule, + RadialColumnSeriesModule +]; +var AllStandaloneEnterpriseModules = [ + StandaloneChartModule2, + PyramidSeriesModule, + LinearGaugeSeriesModule, + RadialGaugeSeriesModule, + SunburstSeriesModule, + TreemapSeriesModule, + ChordSeriesModule, + SankeySeriesModule +]; +var AllTopologyEnterpriseModules = [ + TopologyChartModule2, + MapLineSeriesModule, + MapLineBackgroundSeriesModule, + MapMarkerSeriesModule, + MapShapeSeriesModule, + MapShapeBackgroundSeriesModule +]; +var AllEnterpriseModules = [ + ...AllCartesianEnterpriseModules, + ...AllPolarEnterpriseModules, + ...AllStandaloneEnterpriseModules, + ...AllTopologyEnterpriseModules, + // Plugins, WIP + AnnotationsModule2, + NavigatorModule2, + InitialStateModule +]; +var styles_default2 = `.ag-watermark{position:absolute;bottom:20px;right:25px;font-weight:700;font-family:Impact,sans-serif;font-size:19px;opacity:.7;animation:1s ease-out 3s ag-watermark-fadeout;color:#9b9b9b;pointer-events:none;&:before{content:"";display:block;height:40px;width:170px;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU4IiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgMjU4IDQwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjUuNzc5IDI4LjY1N0gxMy4zNTlMMTEuMTczIDM0LjAxMkg1LjY3Mjk3TDE3LjE4MiA3LjA1OTk5SDIxLjk1M0wzMy40NjIgMzQuMDEySDI3Ljk2MkwyNS43NzYgMjguNjU3SDI1Ljc3OVpNMjQuMDY4IDI0LjM5N0wxOS41ODggMTMuNDM0TDE1LjEwNyAyNC4zOTdIMjQuMDY4Wk02Mi4wOTIgMTguODIzSDQ5LjgxN1YyMy4wODZINTYuNzc1QzU2LjU1NSAyNS4yMjIgNTUuNzU1IDI2LjkyNyA1NC4zNzIgMjguMjAyQzUyLjk4OSAyOS40NzYgNTEuMTY2IDMwLjExNSA0OC45MDkgMzAuMTE1QzQ3LjYyMiAzMC4xMTUgNDYuNDUgMjkuODg1IDQ1LjM5MyAyOS40MjNDNDQuMzU4MyAyOC45NzgxIDQzLjQzMjYgMjguMzEzOCA0Mi42OCAyNy40NzZDNDEuOTI3IDI2LjYzOSA0MS4zNDQgMjUuNjMxIDQwLjkzMSAyNC40NTNDNDAuNTE5IDIzLjI3NSA0MC4zMTEgMjEuOTcgNDAuMzExIDIwLjUzN0M0MC4zMTEgMTkuMTA1IDQwLjUxNiAxNy44IDQwLjkzMSAxNi42MjFDNDEuMzQ0IDE1LjQ0MyA0MS45MjcgMTQuNDM2IDQyLjY4IDEzLjU5OEM0My40Mzc2IDEyLjc1NzcgNDQuMzY5NiAxMi4wOTMyIDQ1LjQxMSAxMS42NTFDNDYuNDc4IDExLjE4OSA0Ny42NTYgMTAuOTYgNDguOTQ2IDEwLjk2QzUxLjYxMiAxMC45NiA1My42MzcgMTEuNjAyIDU1LjAyIDEyLjg4NUw1OC4zIDkuNjA0OTlDNTUuODE3IDcuNjY5OTkgNTIuNjc2IDYuNjk5OTkgNDguODcyIDYuNjk5OTlDNDYuNzYgNi42OTk5OSA0NC44NTMgNy4wMzQ5OSA0My4xNTQgNy43MDA5OUM0MS40NTUgOC4zNjc5OSAzOS45OTggOS4zMDM5OSAzOC43ODMgMTAuNTA0QzM3LjU2NyAxMS43MDcgMzYuNjM0IDEzLjE1OCAzNS45NzcgMTQuODU3QzM1LjMxOSAxNi41NTYgMzQuOTk0IDE4LjQ1MSAzNC45OTQgMjAuNTRDMzQuOTk0IDIyLjYzIDM1LjMyOSAyNC40OTQgMzUuOTk1IDI2LjIwNUMzNi42NjIgMjcuOTE2IDM3LjYwNSAyOS4zNzQgMzguODE3IDMwLjU3N0M0MC4wMzIgMzEuNzggNDEuNDg2IDMyLjcxMyA0My4xODggMzMuMzgzQzQ0Ljg4OCAzNC4wNDkgNDYuNzgyIDM0LjM4NCA0OC44NzIgMzQuMzg0QzUwLjk2MSAzNC4zODQgNTIuNzUgMzQuMDQ5IDU0LjM5IDMzLjM4M0M1Ni4wMzEgMzIuNzE2IDU3LjQyNiAzMS43OCA1OC41NzkgMzAuNTc3QzU5LjczMyAyOS4zNzQgNjAuNjE5IDI3LjkxNiA2MS4yMzkgMjYuMjA1QzYxLjg2IDI0LjQ5NCA2Mi4xNyAyMi42MDUgNjIuMTcgMjAuNTRDNjIuMTY5NiAxOS45Njg4IDYyLjE0NDUgMTkuMzk4IDYyLjA5NSAxOC44MjlMNjIuMDkyIDE4LjgyM1pNMTUxLjgxIDE2Ljk4MUMxNTMuNDEgMTQuNjA5IDE1Ny40MTkgMTQuMzU4IDE1OS4wMjIgMTQuMzU4VjE4LjkxQzE1Ni45NTcgMTguOTEgMTU0Ljk4NSAxOC45OTYgMTUzLjc1NyAxOS44OTJDMTUyLjUyOSAyMC43OTIgMTUxLjkxOSAyMS45ODIgMTUxLjkxOSAyMy40NjRWMzMuOTlIMTQ2Ljk2NFYxNC4zNThIMTUxLjczNkwxNTEuODEgMTYuOTgxWk0xNDMuMDExIDE0LjM2MVYzNC4wMzFIMTM4LjI0TDEzOC4xMzEgMzEuMDQ1QzEzNy40NjYgMzIuMDc2IDEzNi41NTEgMzIuOTIxOSAxMzUuNDcxIDMzLjUwNEMxMzQuMzc2IDM0LjA5OSAxMzMuMDY4IDM0LjM5NiAxMzEuNTM2IDM0LjM5NkMxMzAuMiAzNC4zOTYgMTI4Ljk2MyAzNC4xNTIgMTI3LjgyMiAzMy42NjhDMTI2LjcgMzMuMTk2NCAxMjUuNjg5IDMyLjQ5NSAxMjQuODU1IDMxLjYwOUMxMjQuMDE4IDMwLjcyMiAxMjMuMzU0IDI5LjY2MiAxMjIuODcxIDI4LjQyMkMxMjIuMzg0IDI3LjE4NSAxMjIuMTQyIDI1LjgxMSAxMjIuMTQyIDI0LjMwNEMxMjIuMTQyIDIyLjc5OCAxMjIuMzg0IDIxLjM3OCAxMjIuODcxIDIwLjExNkMxMjMuMzU3IDE4Ljg1NCAxMjQuMDE4IDE3Ljc3MiAxMjQuODU1IDE2Ljg3M0MxMjUuNjg4IDE1Ljk3NjQgMTI2LjY5OCAxNS4yNjM2IDEyNy44MjIgMTQuNzhDMTI4Ljk2MyAxNC4yODEgMTMwLjIwMyAxNC4wMzMgMTMxLjUzNiAxNC4wMzNDMTMzLjA0MyAxNC4wMzMgMTM0LjMzIDE0LjMxOCAxMzUuMzk3IDE0Ljg4OEMxMzYuNDYyIDE1LjQ1ODkgMTM3LjM3NSAxNi4yNzggMTM4LjA1NyAxNy4yNzZWMTQuMzYxSDE0My4wMTFaTTEzMi42MzEgMzAuMTMzQzEzNC4yNTYgMzAuMTMzIDEzNS41NjcgMjkuNTk0IDEzNi41NjUgMjguNTEyQzEzNy41NjEgMjcuNDMgMTM4LjA2IDI1Ljk5MSAxMzguMDYgMjQuMTk2QzEzOC4wNiAyMi40MDEgMTM3LjU2MSAyMC45OSAxMzYuNTY1IDE5Ljg5OUMxMzUuNTcgMTguODA3IDEzNC4yNTkgMTguMjU4IDEzMi42MzEgMTguMjU4QzEzMS4wMDMgMTguMjU4IDEyOS43MjkgMTguODA0IDEyOC43MzQgMTkuODk5QzEyNy43MzggMjAuOTkzIDEyNy4yMzkgMjIuNDM4IDEyNy4yMzkgMjQuMjMzQzEyNy4yMzkgMjYuMDI4IDEyNy43MzUgMjcuNDMzIDEyOC43MzQgMjguNTE1QzEyOS43MjkgMjkuNTk0IDEzMS4wMjggMzAuMTM2IDEzMi42MzEgMzAuMTM2VjMwLjEzM1pNOTMuNjk4IDI3Ljg3NkM5My41Nzk1IDI4LjAwMjUgOTMuNDU2NCAyOC4xMjQ2IDkzLjMyOSAyOC4yNDJDOTEuOTQ3IDI5LjUxNiA5MC4xMjMgMzAuMTU1IDg3Ljg2NiAzMC4xNTVDODYuNTggMzAuMTU1IDg1LjQwOCAyOS45MjYgODQuMzUgMjkuNDY0QzgzLjMxNTUgMjkuMDE4OSA4Mi4zODk4IDI4LjM1NDYgODEuNjM3IDI3LjUxN0M4MC44ODQgMjYuNjc5IDgwLjMwMSAyNS42NzIgNzkuODg5IDI0LjQ5NEM3OS40NzYgMjMuMzE1IDc5LjI2OSAyMi4wMSA3OS4yNjkgMjAuNTc4Qzc5LjI2OSAxOS4xNDUgNzkuNDczIDE3Ljg0IDc5Ljg4OSAxNi42NjJDODAuMzAxIDE1LjQ4NCA4MC44ODQgMTQuNDc2IDgxLjYzNyAxMy42MzlDODIuMzk0OSAxMi43OTg3IDgzLjMyNzMgMTIuMTM0MiA4NC4zNjkgMTEuNjkyQzg1LjQzNiAxMS4yMyA4Ni42MTQgMTEgODcuOTAzIDExQzkwLjU3IDExIDkyLjU5NSAxMS42NDIgOTMuOTc3IDEyLjkyNkw5Ny4yNTggOS42NDQ5OUM5NC43NzQgNy43MTA5OSA5MS42MzMgNi43Mzk5OSA4Ny44MjkgNi43Mzk5OUM4NS43MTggNi43Mzk5OSA4My44MTEgNy4wNzQ5OSA4Mi4xMTIgNy43NDE5OUM4MC40MTMgOC40MDc5OSA3OC45NTYgOS4zNDQ5OSA3Ny43NCAxMC41NDVDNzYuNTI1IDExLjc0NyA3NS41OTIgMTMuMTk5IDc0LjkzNCAxNC44OThDNzQuMjc3IDE2LjU5NyA3My45NTEgMTguNDkxIDczLjk1MSAyMC41ODFDNzMuOTUxIDIyLjY3IDc0LjI4NiAyNC41MzQgNzQuOTUzIDI2LjI0NUM3NS42MTkgMjcuOTU3IDc2LjU2MiAyOS40MTQgNzcuNzc0IDMwLjYxN0M3OC45OSAzMS44MiA4MC40NDQgMzIuNzUzIDgyLjE0NiAzMy40MjNDODMuODQ1IDM0LjA5IDg1LjczOSAzNC40MjQgODcuODI5IDM0LjQyNEM4OS45MTkgMzQuNDI0IDkxLjcwOCAzNC4wOSA5My4zNDggMzMuNDIzQzk0LjcxOCAzMi44NjUgOTUuOTE4IDMyLjEyMSA5Ni45NDggMzEuMTkxQzk3LjE0OSAzMS4wMDggOTcuMzQ4IDMwLjgxNSA5Ny41MzcgMzAuNjJMOTMuNzAxIDI3Ljg4NUw5My42OTggMjcuODc2Wk0xMTAuODAyIDE0LjAxNUMxMDkuMTk5IDE0LjAxNSAxMDYuODM2IDE0LjQ3MSAxMDUuNjExIDE2LjE1OEwxMDUuNTM3IDYuMDE1OTlIMTAwLjc2NVYzMy45MzlIMTA1LjcyVjIyLjY0MUMxMDUuNzcxIDIxLjQ2MDcgMTA2LjI4OCAyMC4zNDg4IDEwNy4xNTcgMTkuNTQ4OUMxMDguMDI3IDE4Ljc0OTEgMTA5LjE3OCAxOC4zMjY2IDExMC4zNTggMTguMzc0QzExMy4zOTcgMTguMzc0IDExNC4yNjggMjEuMTU5IDExNC4yNjggMjIuNjQxVjMzLjkzOUgxMTkuMjIzVjIxLjA1OUMxMTkuMjIzIDIxLjA1OSAxMTkuMTQyIDE0LjAxNSAxMTAuODAyIDE0LjAxNVpNMTczLjc2MyAxNC4zNThIMTY5Ljk5OVY4LjcxNDk5SDE2NS4wNDhWMTQuMzU4SDE2MS4yODRWMTguOTE2SDE2NS4wNDhWMzQuMDAzSDE2OS45OTlWMTguOTE2SDE3My43NjNWMTQuMzU4Wk0xOTAuNzg3IDI1LjI2MkMxOTAuMTI5IDI0LjUwMTQgMTg5LjMwNyAyMy44OTk0IDE4OC4zODQgMjMuNTAxQzE4Ny40ODggMjMuMTE3IDE4Ni4zMzEgMjIuNzMyIDE4NC45NDggMjIuMzY0QzE4NC4xNjUgMjIuMTQzOSAxODMuMzkgMjEuODk3OCAxODIuNjIzIDIxLjYyNkMxODIuMTYzIDIxLjQ2MjEgMTgxLjc0MSAyMS4yMDY2IDE4MS4zODMgMjAuODc1QzE4MS4yMzUgMjAuNzQyMSAxODEuMTE4IDIwLjU3ODkgMTgxLjAzOSAyMC4zOTY0QzE4MC45NjEgMjAuMjE0IDE4MC45MjIgMjAuMDE2NiAxODAuOTI3IDE5LjgxOEMxODAuOTI3IDE5LjI3MiAxODEuMTU2IDE4Ljg0NCAxODEuNjI1IDE4LjUxQzE4Mi4xMjEgMTguMTU2IDE4Mi44NjIgMTcuOTc2IDE4My44MjYgMTcuOTc2QzE4NC43OSAxNy45NzYgMTg1LjU4NyAxOC4yMDkgMTg2LjE0OCAxOC42NjhDMTg2LjcwNiAxOS4xMjQgMTg3LjAwNyAxOS43MjUgMTg3LjA3MiAyMC41TDE4Ny4wOTQgMjAuNzgySDE5MS42MzNMMTkxLjYxNyAyMC40NkMxOTEuNTIxIDE4LjQ4NSAxOTAuNzcxIDE2LjkgMTg5LjM4NSAxNS43NUMxODguMDEyIDE0LjYxMiAxODYuMTg1IDE0LjAzMyAxODMuOTYyIDE0LjAzM0MxODIuNDc3IDE0LjAzMyAxODEuMTQxIDE0LjI4NyAxNzkuOTk0IDE0Ljc4NkMxNzguODMxIDE1LjI5MSAxNzcuOTI2IDE1Ljk5NSAxNzcuMjk2IDE2Ljg4MkMxNzYuNjczIDE3Ljc0NTUgMTc2LjMzOCAxOC43ODQgMTc2LjM0MSAxOS44NDlDMTc2LjM0MSAyMS4xNjcgMTc2LjY5OCAyMi4yNDkgMTc3LjM5OSAyMy4wNjRDMTc4LjA2IDIzLjg0MzIgMTc4Ljg5OCAyNC40NTM0IDE3OS44NDIgMjQuODQ0QzE4MC43NDQgMjUuMjE2IDE4MS45MjggMjUuNjA3IDE4My4zNjEgMjZDMTg0LjgwNiAyNi40MSAxODUuODcyIDI2Ljc4NSAxODYuNTMgMjcuMTIzQzE4Ny4xIDI3LjQxNCAxODcuMzc5IDI3Ljg0NSAxODcuMzc5IDI4LjQ0NEMxODcuMzc5IDI5LjA0MiAxODcuMTIyIDI5LjQ2NyAxODYuNTk1IDI5LjgzOUMxODYuMDQzIDMwLjIyNiAxODUuMjM3IDMwLjQyNSAxODQuMjAxIDMwLjQyNUMxODMuMTY2IDMwLjQyNSAxODIuMzk0IDMwLjE3NCAxODEuNzQ5IDI5LjY3NEMxODEuMTEzIDI5LjE4MSAxODAuNzcyIDI4LjU4OSAxODAuNzEgMjcuODY0TDE4MC42ODUgMjcuNTgySDE3Ni4wMTNMMTc2LjAyNSAyNy45MDFDMTc2LjA2NyAyOS4wOTU1IDE3Ni40NzIgMzAuMjQ4NyAxNzcuMTg4IDMxLjIwNkMxNzcuOTA3IDMyLjE4IDE3OC44OTMgMzIuOTU4IDE4MC4xMTggMzMuNTE5QzE4MS4zMzYgMzQuMDc3IDE4Mi43MzIgMzQuMzYyIDE4NC4yNjYgMzQuMzYyQzE4NS44MDEgMzQuMzYyIDE4Ny4xMDkgMzQuMTA4IDE4OC4yMzggMzMuNjA5QzE4OS4zNzYgMzMuMTA0IDE5MC4yNzIgMzIuMzk0IDE5MC45MDEgMzEuNDk0QzE5MS41MzQgMzAuNTkyIDE5MS44NTMgMjkuNTU0IDE5MS44NTMgMjguNDAzQzE5MS44MjggMjcuMTEgMTkxLjQ2NiAyNi4wNTMgMTkwLjc3NyAyNS4yNjJIMTkwLjc4N1oiIGZpbGw9IiM5QjlCOUIiLz4KPHBhdGggZD0iTTI0MS45ODIgMjUuNjU4MlYxNy43MTE3SDIyOC40NDFMMjIwLjQ5NCAyNS42NTgySDI0MS45ODJaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNTcuMjM5IDUuOTUwODFIMjQwLjI2NUwyMzIuMjU1IDEzLjg5NzNIMjU3LjIzOVY1Ljk1MDgxWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjEyLjYxMSAzMy42MDQ4TDIxNi42OCAyOS41MzYxSDIzMC40MTJWMzcuNDgyN0gyMTIuNjExVjMzLjYwNDhaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yMTUuNTk5IDIxLjc4MDNIMjI0LjM3MkwyMzIuMzgyIDEzLjgzMzdIMjE1LjU5OVYyMS43ODAzWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjA2IDMzLjYwNDdIMjEyLjYxMUwyMjAuNDk0IDI1LjY1ODJIMjA2VjMzLjYwNDdaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNDAuMjY1IDUuOTUwODFMMjM2LjE5NyAxMC4wMTk0SDIxMC4yNTlWMi4wNzI4OEgyNDAuMjY1VjUuOTUwODFaIiBmaWxsPSIjOUI5QjlCIi8+Cjwvc3ZnPgo=);background-repeat:no-repeat;background-size:170px 40px}>span{padding-left:.7rem}}@keyframes ag-watermark-fadeout{0%{opacity:.5}to{opacity:0}}.ag-charts-dialog{display:flex;flex-direction:column;font-size:var(--ag-charts-chrome-font-size-large)}.ag-charts-dialog__tabs{display:flex;flex-direction:column}.ag-charts-dialog__header{border-bottom:1px solid var(--ag-charts-border-color);display:flex}.ag-charts-dialog__tab-list{display:flex;gap:calc(var(--ag-charts-spacing) * 2)}.ag-charts-dialog__drag-handle{align-items:center;color:inherit;cursor:grab;display:flex;padding:1px 6px;text-align:center}.ag-charts-dialog__drag-handle--dragging{cursor:grabbing}.ag-charts-dialog__tab-button{background:none;border:0;border-bottom:2px solid transparent;border-radius:0;color:var(--ag-charts-panel-subtle-text-color);margin-bottom:-1px;padding:var(--input-padding) calc(var(--input-padding) / 2)}.ag-charts-dialog__tab-button:hover{background:none}.ag-charts-dialog__tab-button--active{border-color:var(--ag-charts-accent-color);color:inherit}.ag-charts-dialog__drag-handle+.ag-charts-dialog__tab-button{margin-left:calc(var(--ag-charts-spacing) * -2)}.ag-charts-button.ag-charts-dialog__close-button{background:none;border:0;margin-left:auto;padding:1px 6px}.ag-charts-dialog__close-button:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-dialog__tab-panel{display:none;flex-direction:column;gap:calc(var(--ag-charts-spacing) * 4);margin:0 calc(var(--ag-charts-spacing) * 4);padding:calc(var(--ag-charts-spacing) * 4) 0}.ag-charts-dialog__tab-panel--active{display:flex}.ag-charts-dialog__input-group-line{display:flex;gap:16px 18px;flex-wrap:wrap}.ag-charts-dialog__input-group{align-items:center;display:flex;font-size:var(--ag-charts-chrome-font-size)}.ag-charts-dialog__input-group-label{color:var(--ag-charts-panel-subtle-text-color);margin-right:5px}.ag-charts-dialog__input-group-label[for]{cursor:pointer}.ag-charts-dialog__button{border-radius:0;margin-right:-1px}.ag-charts-dialog__button.ag-charts-dialog__button--active{background:var(--ag-charts-button-focus-background-color);border-color:var(--ag-charts-input-focus-border-color);color:var(--ag-charts-input-focus-text-color);z-index:var(--input-layer-active)}.ag-charts-dialog__button:first-child,.ag-charts-dialog__input-group-label+.ag-charts-dialog__button{border-bottom-left-radius:var(--ag-charts-input-border-radius);border-top-left-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__button:last-child{border-bottom-right-radius:var(--ag-charts-input-border-radius);border-top-right-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__color-picker-button{--color: #000;background:var(--color);border:none;color:transparent;height:26px;width:26px}.ag-charts-dialog__color-picker-button:hover{background:var(--color)}.ag-charts-dialog__color-picker-button--multi-color,.ag-charts-dialog__color-picker-button--multi-color:hover{background:linear-gradient(135deg,red 0%,#ff0 calc(100% * 1 / 6),#0f0 calc(100% * 2 / 6),#0ff 50%,#00f calc(100% * 4 / 6),#f0f calc(100% * 5 / 6),red 100%)}.ag-charts-color-picker{width:190px;padding:8px;cursor:default;--h: 0;--s: 0;--v: 0;--a: 0;--color: #000;--color-a: #000;--thumb-size: 18px;--inner-width: 172px;--track-height: 12px;--palette-height: 136px;--checker: url('data:image/svg+xml;utf8,');--multi-color: linear-gradient( 135deg, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-color-picker__content{display:flex;flex-direction:column}.ag-charts-color-picker__palette{position:relative;width:100%;height:var(--palette-height);margin-bottom:8px;background:linear-gradient(to bottom,#0000,#000),linear-gradient(to right,#fff,#fff0) hsl(var(--h),100%,50%);border-radius:calc(var(--ag-charts-border-radius) * 1.5);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__palette:after{content:"";position:absolute;display:block;top:calc(var(--thumb-size) * -.5 + (1 - var(--v)) * 100%);left:calc(var(--thumb-size) * -.5 + var(--s) * 100%);background:var(--color);width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__palette:focus-visible:after{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),0 0 0 2px #fff8,var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-row{display:flex;gap:8px;align-items:center;margin-bottom:4px;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input,.ag-charts-color-picker__alpha-input{-webkit-appearance:none;display:block;position:relative;padding:0;margin:0 calc(var(--inset) * -1);border:0;height:var(--thumb-size);width:auto;background:transparent;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input::-moz-range-thumb,.ag-charts-color-picker__alpha-input::-moz-range-thumb{appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__hue-input::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{-webkit-appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038;transform:translateZ(0)}.ag-charts-color-picker__hue-input::-moz-range-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__hue-input::-webkit-slider-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__alpha-input::-moz-range-thumb{background:transparent}.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{background:transparent}.ag-charts-color-picker__alpha-input--opaque::-moz-range-thumb{background:var(--color)}.ag-charts-color-picker__alpha-input--opaque::-webkit-slider-thumb{background:var(--color)}.ag-charts-color-picker__hue-input:focus-visible::-moz-range-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-moz-range-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input:focus-visible::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-webkit-slider-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input::-moz-range-track,.ag-charts-color-picker__alpha-input::-moz-range-track{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__hue-input:before,.ag-charts-color-picker__alpha-input:before{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button{width:36px;margin-left:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);border:0;background:var(--multi-color);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button--hidden{display:none}.ag-charts-color-picker__multi-color-button--active{box-shadow:inset 0 0 0 1px #0003;outline-offset:1px;outline:2px solid #2196f3}.ag-charts-color-picker__hue-input{flex:1 0 0}.ag-charts-color-picker__hue-input::-moz-range-track{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__hue-input:before{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__alpha-input{margin-bottom:7px}.ag-charts-color-picker__alpha-input::-moz-range-track{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__alpha-input:before{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__color-field{display:flex;border:var(--ag-charts-border);background:var(--ag-charts-background-color);border-radius:var(--ag-charts-border-radius);overflow:hidden}.ag-charts-color-picker__color-field:has(:focus-visible){border-color:var(--ag-charts-accent-color);box-shadow:var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-label{width:16px;height:16px;margin:7px 0 7px 7px;color:transparent;background:linear-gradient(to right,var(--color-a),var(--color-a)),var(--checker) top left / 4px 4px;border-radius:calc(var(--ag-charts-border-radius) / 2);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__color-label--multi-color{background:var(--multi-color)}.ag-charts-color-picker__color-input{flex:1;min-width:0;padding:7px 7px 7px 8px;border:0;margin:0;color:inherit;background:transparent;font-variant:tabular-nums}.ag-charts-color-picker__color-input:focus-visible{border:none;outline:none}.ag-charts-annotations__line-stroke-width-menu,.ag-charts-annotations__line-style-type-menu,.ag-charts-annotations__text-size-menu{border-top-left-radius:0;border-top-right-radius:0;.ag-charts-menu__row:first-child{border-radius:0}}.ag-charts-annotations__text-size-menu{--item-padding: 4px 8px;min-width:34px;text-align:center}.ag-charts-annotations__line-stroke-width-menu{--item-padding: 6px;column-gap:6px}.ag-charts-annotations__line-style-type-menu{--item-padding: 6px;column-gap:0}.ag-charts-annotations__stroke-width-button:before{background:var(--ag-charts-foreground-color);content:"";margin-right:var(--toolbar-button-padding);height:min(var(--stroke-width),20px);width:12px}.ag-charts-annotations__stroke-width-button[aria-disabled=true]:before{filter:grayscale(1);opacity:.5}.ag-charts-annotations__color-picker-button{--emblem: var(--color)}.ag-charts-annotations__color-picker-button--multi-color{--emblem: linear-gradient( to right, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-annotations__color-picker-button:after{content:"";display:block;position:absolute;bottom:3px;left:5px;right:5px;height:4px;border-radius:99px;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ag-charts-foreground-color) 10%,transparent);background:var(--emblem)}.ag-charts-annotations__color-picker-button[aria-disabled=true]:after{filter:grayscale(1);opacity:.5}.ag-charts-annotations__toolbar-menu{min-width:200px}.ag-charts-annotations__axis-button--hidden{display:none}.ag-charts-annotations__axis-button{background-color:var(--ag-charts-crosshair-label-background-color);border-radius:calc(var(--ag-charts-border-radius) / 2);border:none;box-sizing:border-box;color:var(--ag-charts-crosshair-label-text-color);cursor:pointer;font-family:var(--ag-charts-button-font-family);font-size:var(--ag-charts-button-font-size);font-weight:var(--ag-charts-button-font-weight);left:0;line-height:16px;overflow:hidden;padding:0;position:absolute;top:0;user-select:none;white-space:nowrap;z-index:var(--ag-charts-layer-annotations)}.ag-charts-annotations__axis-button:hover{opacity:.8;color:var(--ag-charts-background-color)}.ag-charts-dialog--annotation-settings{min-height:233px;width:289px}.ag-charts-dialog--annotation-settings .ag-charts-textarea{height:calc(10px * 2 + var(--textarea-line-height) * 1em * 3 + 2px);overflow-y:auto;resize:vertical}.ag-charts-context-menu{font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);z-index:var(--ag-charts-layer-ui-overlay)}.ag-charts-context-menu__cover{position:fixed;left:0;top:0}.ag-charts-context-menu__menu{background:var(--ag-charts-menu-background-color);border-radius:var(--ag-charts-border-radius);border:var(--ag-charts-menu-border);box-shadow:var(--ag-charts-popup-shadow);color:var(--ag-charts-menu-text-color);display:flex;flex-direction:column;padding:.5em 0;transition:transform .1s ease;white-space:nowrap}.ag-charts-context-menu__menu:focus{outline:none}.ag-charts-context-menu__item{align-items:center;background:none;border:none;box-sizing:border-box;color:inherit;cursor:pointer;display:flex;font:inherit;justify-content:space-between;text-align:left;width:100%;-webkit-appearance:none;-moz-appearance:none}.ag-charts-context-menu__icon>img{width:var(--ag-charts-icon-size);height:var(--ag-charts-icon-size)}.ag-charts-context-menu__icon,.ag-charts-context-menu__cell{display:flex;align-items:center;flex-shrink:0}.ag-charts-context-menu__cell{flex-grow:1}.ag-charts-context-menu__cellpadding{padding:.5em 1em}.ag-charts-context-menu__icon{padding-right:0}.ag-charts-context-menu__item[data-focus-override=true],.ag-charts-context-menu__item:focus,.ag-charts-context-menu__item:active{background:var(--ag-charts-focus-color)}.ag-charts-context-menu__item[data-focus-override=false]{background:inherit}.ag-charts-context-menu__item[data-focus-visible-override=true]:focus,.ag-charts-context-menu__item:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-context-menu__item[data-focus-visible-override=false]{outline:inherit;box-shadow:inherit;z-index:inherit}.ag-charts-context-menu__item[aria-disabled=true]{border:none;color:color-mix(in srgb,var(--ag-charts-input-text-color) 50%,transparent)}.ag-charts-context-menu__item[aria-disabled=true]:focus{background:inherit;cursor:inherit}.ag-charts-context-menu__divider{padding:5px 0}.ag-charts-context-menu__divider:after{content:"";display:block;border-top:1px solid var(--ag-charts-border-color)}.ag-charts-crosshair-label{position:absolute;left:0;top:0;user-select:none;pointer-events:none;font-family:var(--ag-charts-font-family);font-size:var(--ag-charts-font-size);font-weight:var(--ag-charts-font-weight);overflow:hidden;white-space:nowrap;z-index:var(--ag-charts-layer-crosshair);box-sizing:border-box}.ag-charts-crosshair-label-content{padding:0 8px;border-radius:calc(var(--ag-charts-border-radius) / 2);line-height:calc(var(--ag-charts-font-size) + 8px);background-color:var(--ag-charts-crosshair-label-background-color);color:var(--ag-charts-crosshair-label-text-color)}.ag-charts-crosshair-label--hidden{visibility:hidden!important}.ag-charts-text-input{position:absolute}.ag-charts-text-input__textarea{--placeholder-text-color: var(--ag-charts-input-placeholder-text-color);display:block;height:100%;width:100%;border:0;background:none;line-height:1.38;outline:none;transform:translateY(.09em)}.ag-charts-text-input__textarea[placeholder]:empty:before{content:attr(placeholder);color:var(--placeholder-text-color);font-weight:400}.ag-charts-text-input__textarea[placeholder]:not(:empty):before{content:""}.ag-charts-chart-toolbar__menu{min-width:200px}.ag-charts-range-buttons .ag-charts-toolbar__button{padding:var(--toolbar-button-padding) calc(var(--toolbar-button-padding) * 1.5)}.ag-charts-zoom-buttons{align-items:center;display:flex;height:44px;justify-content:center;overflow:hidden;padding-bottom:10px;pointer-events:none;width:100%;.ag-charts-toolbar{--toolbar-size: 24px;--toolbar-button-padding: 1px;display:flex;font-size:var(--ag-charts-chrome-font-size);height:var(--toolbar-size);justify-content:center;opacity:1;pointer-events:auto;transition:opacity .2s ease-in-out,transform .4s ease-in-out;.ag-charts-toolbar__button--first{border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__button--last{border-bottom-right-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__label{padding-left:var(--ag-charts-spacing);padding-right:var(--ag-charts-spacing)}.ag-charts-toolbar__icon+.ag-charts-toolbar__label{padding-left:0}.ag-charts-toolbar__button--gap{margin-left:var(--toolbar-gap)}&.ag-charts-zoom-buttons__toolbar--hidden{opacity:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out}}}.ag-charts-shared-toolbar{gap:var(--toolbar-gap);.ag-charts-toolbar__button{border-radius:var(--ag-charts-border-radius);margin:0}} +`; +module_support_exports.ModuleRegistry.registerMany(AllEnterpriseModules, VERSION); +function setupEnterpriseModules() { + module_support_exports.moduleRegistry.register( + AngleCategoryAxisModule, + AngleNumberAxisModule, + AnimationModule, + AnnotationsModule, + BackgroundModule2, + ForegroundModule, + BoxPlotModule, + CandlestickModule, + ChordModule, + ConeFunnelModule, + FunnelModule, + OhlcModule, + ChartToolbarModule, + ContextMenuModule, + CrosshairModule, + BandHighlightModule, + DataSourceModule, + ErrorBarsModule, + LinearGaugeModule, + MapLineModule, + MapLineBackgroundModule, + MapMarkerModule, + MapShapeModule, + MapShapeBackgroundModule, + NavigatorModule, + StatusBarModule, + GradientLegendModule, + HeatmapModule, + NightingaleModule, + OrdinalTimeAxisModule, + RadarAreaModule, + RadarLineModule, + RadialBarModule, + RadialColumnModule, + RadiusCategoryAxisModule, + RadialGaugeModule, + RadiusNumberAxisModule, + RangeBarModule, + RangeAreaModule, + RangesModule, + PyramidModule, + SankeyModule, + SharedToolbarModule, + SunburstModule, + SyncModule, + TreemapModule, + WaterfallModule, + ZoomModule + ); + module_support_exports.enterpriseModule.isEnterprise = true; + module_support_exports.enterpriseModule.styles = styles_default2; + module_support_exports.enterpriseModule.licenseManager = (options) => new LicenseManager( + options.container?.ownerDocument ?? (typeof document === "undefined" ? void 0 : document) + ); + module_support_exports.enterpriseModule.injectWatermark = injectWatermark; +} +setupEnterpriseModules(); +var LicenseManager2 = { + setLicenseKey(key) { + LicenseManager.setLicenseKey(key); + } +}; +function setupEnterpriseModules2() { + setupEnterpriseModules(); + registerInbuiltModules(); +} +var AgChartsEnterpriseModule = { + VERSION, + _Scene: integrated_charts_scene_exports, + _Theme: integrated_charts_theme_exports, + _Util: integrated_charts_util_exports, + create: AgCharts.create.bind(AgCharts), + createSparkline: AgCharts.__createSparkline.bind(AgCharts), + setup: setupEnterpriseModules2, + setGridContext: LicenseManager.setGridContext.bind(LicenseManager), + setLicenseKey: LicenseManager.setLicenseKey.bind(LicenseManager), + isEnterprise: true +}; +if (typeof module.exports == "object" && typeof exports == "object") { + var __cp = (to, from, except, desc) => { + if ((from && typeof from === "object") || typeof from === "function") { + for (let key of Object.getOwnPropertyNames(from)) { + if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except) + Object.defineProperty(to, key, { + get: () => from[key], + enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable, + }); + } + } + return to; + }; + module.exports = __cp(module.exports, exports); +} +return module.exports; +})) diff --git a/yuthon_report/static/src/lib/ag-chart/dist/umd/ag-charts-enterprise.min.js b/yuthon_report/static/src/lib/ag-chart/dist/umd/ag-charts-enterprise.min.js new file mode 100644 index 000000000..31a0da747 --- /dev/null +++ b/yuthon_report/static/src/lib/ag-chart/dist/umd/ag-charts-enterprise.min.js @@ -0,0 +1,26 @@ +(function(lp,va){typeof exports=="object"&&typeof module=="object"?module.exports=va():typeof define=="function"&&define.amd?define("agCharts",[],va):typeof exports=="object"?exports.agCharts=va():lp.agCharts=va()})(this,()=>{var lp={},va={exports:lp};if(typeof Khe>"u")var Khe=function(t){throw new Error("Unknown module: "+t)};var oy=Object.defineProperty,OC=Object.getOwnPropertyDescriptor,WV=Object.getOwnPropertyNames,$V=Object.prototype.hasOwnProperty,Tn=(e,t)=>{for(var i in t)oy(e,i,{get:t[i],enumerable:!0})},UV=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of WV(t))!$V.call(e,n)&&n!==i&&oy(e,n,{get:()=>t[n],enumerable:!(s=OC(t,n))||s.enumerable});return e},KV=e=>UV(oy({},"__esModule",{value:!0}),e),M=(e,t,i,s)=>{for(var n=s>1?void 0:s?OC(t,i):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(n=(s?a(t,i,n):a(n))||n);return s&&n&&oy(t,i,n),n},EC={};Tn(EC,{AG_CHARTS_LOCALE_EN_US:()=>zT,AgCharts:()=>So,AgChartsCommunityModule:()=>vZ,AgChartsEnterpriseModule:()=>$he,AgErrorBarSupportedSeriesTypes:()=>em,AgTooltipAnchorToType:()=>BT,AgTooltipPlacementType:()=>_T,LicenseManager:()=>Whe,VERSION:()=>fr,_ModuleSupport:()=>k,_Scene:()=>$x,_Theme:()=>Ux,_Util:()=>Kx,_Widget:()=>lf,setupCommunityModules:()=>Gx,setupEnterpriseModules:()=>bV,time:()=>P5}),va.exports=KV(EC);var K={};Tn(K,{error:()=>PC,errorOnce:()=>XV,log:()=>YV,logGroup:()=>QV,reset:()=>qV,table:()=>ZV,warn:()=>IS,warnOnce:()=>cp});var kS=new Set;function YV(...e){console.log(...e)}function IS(e,...t){console.warn(`AG Charts - ${e}`,...t)}function PC(e,...t){typeof e=="object"?console.error("AG Charts error",e,...t):console.error(`AG Charts - ${e}`,...t)}function ZV(...e){console.table(...e)}function RC(e,t,i){let s;e instanceof Error?s=e.message:typeof e=="string"?s=e:typeof e=="object"?s=JSON.stringify(e):s=String(e);const n=`${t}: ${s}`;kS.has(n)||(i(e),kS.add(n))}function cp(e,...t){RC(e,"Logger.warn",i=>IS(i,...t))}function XV(e,...t){RC(e,"Logger.error",i=>PC(i,...t))}function qV(){kS.clear()}function QV(e,t){console.groupCollapsed(e);try{return t()}finally{console.groupEnd()}}var en={};Tn(en,{detectChartDefinition:()=>sG,getAxisModule:()=>nG,getPresetModule:()=>oG,getSeriesModule:()=>aG,hasModule:()=>tG,listModulesByType:()=>iG,register:()=>zC,registerMany:()=>JV,reset:()=>eG});var Sa=new Map;function zC(e,t){const{def:i,version:s}=Sa.get(e.name)??{};if(!i){Sa.set(e.name,{def:e,version:t});return}if(!i.enterprise&&e.enterprise&&t===s){Sa.set(e.name,{def:e,version:t});return}if(s===t){IS([`AG Charts - Module '${e.name}' already registered,', + 'ignoring (version: ${s}).`,"Check your code for duplicate loading of charts NPM modules."].join(" "));return}throw new Error([`AG Charts - Module '${e.name}' already registered with different version:`,`${s} vs ${t}`,"","Check your package.json for conflicting dependencies - depending on your package manager","one of these commands may help:","- npm ls ag-charts-community","- yarn why ag-charts-community"].join(` +`))}function JV(e,t){for(const i of e)zC(i,t)}function eG(){Sa.clear()}function tG(e){return Sa.has(e)}function*iG(e){for(const t of Sa.values())hp(e,t.def)&&(yield t.def)}function sG(e){for(const t of Sa.values())if(hp("chart",t.def)&&t.def.detect(e))return t.def;throw new Error("AG Charts - Unknown chart type; Check options are correctly structured and series types are specified")}function nG(e){const t=Sa.get(e);if(hp("axis",t?.def))return t?.def}function oG(e){const t=Sa.get(e);if(hp("preset",t?.def))return t?.def}function aG(e){const t=Sa.get(e);if(hp("series",t?.def))return t?.def}function hp(e,t){return t?.type===e}var Go=class{constructor(){this.events=new Map}on(e,t){return this.events.has(e)||this.events.set(e,new Set),this.events.get(e)?.add(t),()=>this.off(e,t)}off(e,t){const i=this.events.get(e);i&&(i.delete(t),i.size===0&&this.events.delete(e))}emit(e,t){const i=this.events.get(e);if(i)for(const s of i)s(t)}clear(e){e?this.events.delete(e):this.events.clear()}},AS=class{constructor(e){if(this.maxCacheSize=e,this.store=new Map,e<=0)throw new Error("LRUCache size must be greater than 0")}get(e){if(!this.store.has(e))return;const t=this.store.get(e);return this.store.delete(e),this.store.set(e,t),t}has(e){return this.store.has(e)}set(e,t){return this.store.set(e,t),this.store.size>this.maxCacheSize&&this.store.delete(this.store.keys().next().value),t}clear(){this.store.clear()}};function ve(e,t,i){return Math.min(i,Math.max(e,t))}function rG(e,t,i=1e-10){return e>=t[0]-i&&e<=t[1]+i}function Qe(e,t,i=1e-10){return e===t||Math.abs(e-t)=1e21){let n;[t,n]=t.split("e"),n!=null&&(i=Number(n))}const s=t.split(".")[1]?.length??0;return Math.max(s-i,0)}var rr={};typeof globalThis.window<"u"&&(rr.window=globalThis.window),typeof document<"u"?rr.document=document:typeof globalThis.global<"u"&&(rr.document=globalThis.document);function Ma(e){return e?rr.document?.[e]:rr.document}function qe(e){return e?rr.window?.[e]:rr.window}function hG(e){rr.document=e}function dG(e){rr.window=e}function De(e,t,i){const s=Ma().createElement(e);if(typeof t=="object"&&(i=t,t=void 0),t)for(const n of t.split(" "))s.classList.add(n);return i&&Object.assign(s.style,i),s}function Xt(e){return Ma().createElementNS("http://www.w3.org/2000/svg",e)}function uG(e,t){const i=Ma("body"),s=De("a",{display:"none"});s.href=e,s.download=t,i.appendChild(s),s.click(),setTimeout(()=>s.remove())}function ht(e,t,i,s){return e.addEventListener(t,i,s),()=>e.removeEventListener(t,i,s)}var up;function pG(e){if(up==null){const i=qe("Option");up=new i().style}up.color=e;const t=up.color||null;return up.color="",t}function qt(e){return e!=null}function Ne(e){return Array.isArray(e)}function gG(e){return typeof e=="boolean"}function jo(e){return e instanceof Date}function id(e){return jo(e)&&!Number.isNaN(Number(e))}function fG(e){return e instanceof RegExp}function lr(e){return typeof e=="function"}function Ee(e){return typeof e=="object"&&e!==null&&!Ne(e)}function ay(e){return Ne(e)||ft(e)}function ft(e){return typeof e=="object"&&e!==null&&e.constructor?.name==="Object"}function ry(e){if(typeof e!="object"||e===null)return!1;for(const t in e)return!1;return!0}function Qt(e){return typeof e=="string"}function Jt(e){return typeof e=="number"}function Ye(e){return Number.isFinite(e)}function yG(e){return typeof globalThis.window<"u"&&e instanceof HTMLElement}function ly(e){return typeof e=="symbol"}function mG(e){return Qt(e)&&(e==="none"||pG(e)!=null)}function xG(e,t){return e in t}var FC=/^(?:(.)?([<>=^]))?([+\-( ])?([$€£¥₣₹#])?(0)?(\d+)?(,)?(?:\.(\d+))?(~)?([%a-z])?$/i,BC=/^((?:[^#]|#[^{])*)#{([^}]+)}(.*)$/;function bG(e){if(!Qt(e))return!1;const t=BC.exec(e);return FC.test(t?t[2]:e)}function TS(e){let t,i;const s=BC.exec(e);s&&([,t,e,i]=s);const n=FC.exec(e);if(!n){K.warnOnce(`The number formatter is invalid: ${e}`);return}const[,o,a,r,l,c,h,d,u,p,g]=n;return{fill:o,align:a,sign:r,symbol:l,zero:c,width:Number.parseInt(h),comma:d,precision:Number.parseInt(u),trim:!!p,type:g,prefix:t,suffix:i}}function _C(e){const t=typeof e=="string"?TS(e):e;if(t==null)return;const{fill:i,align:s,sign:n="-",symbol:o,zero:a,width:r,comma:l,type:c,prefix:h="",suffix:d="",precision:u}=t;let{trim:p}=t;const g=u==null||Number.isNaN(u);let f;if(!c)f=eo.g,p=!0;else if(c in eo&&c in sd)f=g?sd[c]:eo[c];else if(c in eo)f=eo[c];else if(c in sd)f=sd[c];else throw new Error(`The number formatter type is invalid: ${c}`);const x=c?6:12;let m;return g||(m=u),(v,b)=>{let S=f(v,m??b??x);return p&&(S=MG(S)),l&&(S=DG(S,l)),S=IG(v,S,n),o&&o!=="#"&&(S=`${o}${S}`),o==="#"&&c==="x"&&(S=`0x${S}`),c==="s"&&(S=`${S}${kG(v)}`),(c==="%"||c==="p")&&(S=`${S}%`),r!=null&&!Number.isNaN(r)&&(S=AG(S,r,i??a,s)),S=`${h}${S}${d}`,S}}var sd={b:e=>cy(e).toString(2),c:e=>String.fromCodePoint(e),d:e=>Math.round(Math.abs(e)).toFixed(0),o:e=>cy(e).toString(8),x:e=>cy(e).toString(16),X:e=>sd.x(e).toUpperCase(),n:e=>sd.d(e),"%":e=>`${cy(e*100).toFixed(0)}`},eo={e:(e,t)=>Math.abs(e).toExponential(t),E:(e,t)=>eo.e(e,t).toUpperCase(),f:(e,t)=>Math.abs(e).toFixed(t),F:(e,t)=>eo.f(e,t).toUpperCase(),g:(e,t)=>{if(e===0)return"0";const i=Math.abs(e),s=Math.floor(Math.log10(i));return s>=-4&&seo.g(e,t).toUpperCase(),n:(e,t)=>eo.g(e,t),p:(e,t)=>eo.r(e*100,t),r:(e,t)=>{if(e===0)return"0";const i=Math.abs(e),n=Math.floor(Math.log10(i))-(t-1);if(n<=0)return i.toFixed(-n);const o=10**n;return(Math.round(i/o)*o).toFixed()},s:(e,t)=>{const i=jC(e);return eo.r(e/10**i,t)},"%":(e,t)=>eo.f(e*100,t)},VC=-24,GC=24,vG={[VC]:"y",[-21]:"z",[-18]:"a",[-15]:"f",[-12]:"p",[-9]:"n",[-6]:"\xB5",[-3]:"m",0:"",3:"k",6:"M",9:"G",12:"T",15:"P",18:"E",21:"Z",[GC]:"Y"},SG="\u2212";function cy(e){return Math.floor(Math.abs(e))}function MG(e){if(!e.endsWith("0")||!e.includes("."))return e;let t=e.length-1;for(;t>0;)if(e[t]=="0")t-=1;else if(e[t]=="."){t-=1;break}else break;return e.substring(0,t+1)}function DG(e,t){let i=e.indexOf(".");i<0&&(i=e.length);const s=e.substring(0,i).split(""),n=e.substring(i);for(let o=s.length-3;o>0;o-=3)s.splice(o,0,t);return`${s.join("")}${n}`}function kG(e){return vG[jC(e)]}function jC(e){return ve(VC,e?Math.floor(Math.log10(Math.abs(e))/3)*3:0,GC)}function IG(e,t,i=""){if(i==="(")return e>=0?t:`(${t})`;const s=i==="+"?"+":"";return`${e>=0?s:SG}${t}`}function AG(e,t,i=" ",s=">"){let n=e;if(s===">"||!s)n=n.padStart(t,i);else if(s==="<")n=n.padEnd(t,i);else if(s==="^"){const o=Math.max(0,t-n.length),a=Math.ceil(o/2),r=Math.floor(o/2);n=n.padStart(a+n.length,i),n=n.padEnd(r+n.length,i)}return n}var hy={periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]};function wS(e,t=new Date(e.getFullYear(),0,1)){const i=e.getTimezoneOffset()-t.getTimezoneOffset(),s=e.getTime()-t.getTime()+i*6e4,n=36e5*24;return Math.floor(s/n)}function HC(e,t){const s=new Date(e.getFullYear(),0,1).getDay(),n=(t-s+7)%7,o=new Date(e.getFullYear(),0,n+1);return o<=e?Math.floor(wS(e,o)/7)+1:0}var CG=0,WC=1,$C=4;function UC(e,t=e.getFullYear()){const s=new Date(t,0,1).getDay(),n=($C-s+7)%7,o=new Date(t,0,n-($C-WC)+1);return o<=e?Math.floor(wS(e,o)/7)+1:UC(e,t-1)}function LG(e){const t=e.getTimezoneOffset(),i=Math.abs(t);return`${t>0?"-":"+"}${ls(Math.floor(i/60),2,"0")}${ls(Math.floor(i%60),2,"0")}`}var TG={a:e=>hy.shortDays[e.getDay()],A:e=>hy.days[e.getDay()],b:e=>hy.shortMonths[e.getMonth()],B:e=>hy.months[e.getMonth()],c:"%x, %X",d:(e,t)=>ls(e.getDate(),2,t??"0"),e:"%_d",f:(e,t)=>ls(e.getMilliseconds()*1e3,6,t??"0"),H:(e,t)=>ls(e.getHours(),2,t??"0"),I:(e,t)=>{const i=e.getHours()%12;return i===0?"12":ls(i,2,t??"0")},j:(e,t)=>ls(wS(e)+1,3,t??"0"),m:(e,t)=>ls(e.getMonth()+1,2,t??"0"),M:(e,t)=>ls(e.getMinutes(),2,t??"0"),L:(e,t)=>ls(e.getMilliseconds(),3,t??"0"),p:e=>e.getHours()<12?"AM":"PM",Q:e=>String(e.getTime()),s:e=>String(Math.floor(e.getTime()/1e3)),S:(e,t)=>ls(e.getSeconds(),2,t??"0"),u:e=>{let t=e.getDay();return t<1&&(t+=7),String(t%7)},U:(e,t)=>ls(HC(e,CG),2,t??"0"),V:(e,t)=>ls(UC(e),2,t??"0"),w:(e,t)=>ls(e.getDay(),2,t??"0"),W:(e,t)=>ls(HC(e,WC),2,t??"0"),x:"%-m/%-d/%Y",X:"%-I:%M:%S %p",y:(e,t)=>ls(e.getFullYear()%100,2,t??"0"),Y:(e,t)=>ls(e.getFullYear(),4,t??"0"),Z:e=>LG(e),"%":()=>"%"},wG={_:" ",0:"0","-":""};function ls(e,t,i){const s=String(Math.floor(e));return s.length>=t?s:`${i.repeat(t-s.length)}${s}`}function pp(e){const t=[];for(;e.length>0;){let i=e.indexOf("%");if(i!==0){const r=i>0?e.substring(0,i):e;t.push(r)}if(i<0)break;const s=e[i+1],n=wG[s];n!=null&&i++;const o=e[i+1],a=TG[o];if(typeof a=="function")t.push([a,n]);else if(typeof a=="string"){const r=pp(a);t.push([r,n])}else t.push(`${n??""}${o}`);e=e.substring(i+2)}return i=>{const s=typeof i=="number"?new Date(i):i;return t.map(n=>typeof n=="string"?n:n[0](s,n[1])).join("")}}function NS(e,t=0,i){const{leading:s=!1,trailing:n=!0,maxWait:o=1/0}=i??{};let a,r;if(or=null,t),e(...c);return}let h=t;if(o!==1/0&&r){const d=Date.now()-r;t>o-d&&(h=o-d)}clearTimeout(a),r??(r=Date.now()),a=setTimeout(()=>{r=null,n&&e(...c)},h)}return Object.assign(l,{cancel(){clearTimeout(a),r=null}})}function KC(e,t,i){const{leading:s=!0,trailing:n=!0}=i??{};let o,a,r=!1;function l(){n&&a?(o=setTimeout(l,t),e(...a)):r=!1,a=null}function c(...h){r?a=h:(r=!0,o=setTimeout(l,t),s?e(...h):a=h)}return Object.assign(c,{cancel(){clearTimeout(o),r=!1,a=null}})}function YC(e,t,i=""){try{return e(...t)}catch(s){const n=i?` \`${i}\``:"";cp(`Uncaught exception in user callback${n}`,s)}}function gp(e,t="and",i=String,s=1/0){if(e.length===0)return"";if(e.length===1)return i(e[0]);e=e.map(i);const n=e.pop();if(e.length>=s){const o=e.length-(s-1);return`${e.slice(0,s-1).join(", ")}, and ${o} more ${t} ${n}`}return`${e.join(", ")} ${t} ${n}`}function OS(e,t=1/0){if(typeof e=="number"){if(Number.isNaN(e))return"NaN";if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity"}const i=JSON.stringify(e)??typeof e;return i.length>t?`${i.slice(0,t)}... (+${i.length-t} characters)`:i}function NG(e){let t=1;for(let i=0;ic),r=new Array(n+1);for(let l=1;l<=o;l++){r[0]=l;for(let c=1;c<=n;c++){const h=s[l-1]===i[c-1]?0:1;r[c]=Math.min(a[c]+1,r[c-1]+1,a[c-1]+h)}[a,r]=[r,a]}return a[n]}function EG(e){return e.replaceAll(PG,(t,i)=>(i>0?"-":"")+t.toLowerCase())}var PG=/[A-Z]+(?![a-z])|[A-Z]/g;function $e(e,t=""){return e==null?t:Ne(e)?e.map(i=>i.text).join(""):Qt(e)?e:String(e)}var wn=Symbol("description"),ZC=Symbol("required"),dy=Symbol("marked"),uy=Symbol("undocumented"),py=Symbol("union"),RG=[["placement","position"],["padding","spacing","gap"],["color","fill","stroke"],["whisker","wick"],["nodeClick","seriesNodeClick"],["nodeDoubleClick","seriesNodeDoubleClick"],["src","url"]].reduce((e,t)=>{for(const i of t)e.set(i.toLowerCase(),new Set(t.filter(s=>s!==i)));return e},new Map);function fp(e,t){return Ye(t)?`${e}[${t}]`:e?`${e}.${t}`:t}var ol=class{constructor(e,t,i,s,n){this.type=e,this.description=t,this.value=i,this.path=s,this.key=n}setUnionType(e,t){if(this.path.startsWith(t)){const i=this.path.slice(t.length);this.altPath=`${t}[type=${e}]${i}`}}getPrefix(){const{altPath:e=this.path,key:t}=this;return!e&&!t?"Value":`Option \`${t?fp(e,t):e}\``}toString(){const{description:e="unknown",type:t,value:i}=this;return t==="required"&&i==null?`${this.getPrefix()} is required and has not been provided; expecting ${e}, ignoring.`:`${this.getPrefix()} cannot be set to \`${OS(i,50)}\`; expecting ${e}, ignoring.`}},ES=class extends ol{constructor(e,t,i,s){super("unknown",void 0,t,i,s),this.suggestions=e,this.key=s}getPrefix(){return`Unknown option \`${fp(this.altPath??this.path,this.key)}\``}getPostfix(){const e=gp(zG(this.key,this.suggestions),"or",t=>`\`${t}\``);return e?`; Did you mean ${e}? Ignoring.`:", ignoring."}toString(){return`${this.getPrefix()}${this.getPostfix()}`}};function cs(e,t,i=""){if(!Ee(e))return{cleared:null,invalid:[new ol("required","an object",e,i)]};const s={},n=[],o=new Set(Object.keys(e)),a=[];if(py in t){const r=Object.keys(t),l=t[py];if(e.type!=null&&r.includes(e.type)||e.type==null&&l!=null){const{type:c=l,...h}=e,d=cs(h,t[c],i);Object.assign(s,{type:c},d.cleared);for(const u of d.invalid)u.setUnionType(c,i);n.push(...d.invalid)}else{const c=gp(r,"or",h=>`'${h}'`);n.push(new ol("required",`a keyword such as ${c}`,e.type,i,"type"))}return{cleared:s,invalid:n}}for(const r of Object.keys(t)){const l=t[r],c=l[ZC],h=e[r];if(o.delete(r),h===void 0&&(l[uy]||a.push(r),!c))continue;const d=fp(i,r);if(lr(l)){const p=l(h,{options:e,path:d});if(typeof p=="object"){if(n.push(...p.invalid),p.valid){s[r]=p.cleared;continue}else if(od(p.invalid,d))continue}else if(p){s[r]=h;continue}n.push(new ol(c?"required":"invalid",l[wn],h,i,r))}else{const u=cs(h,l,d);u.cleared!=null&&(s[r]=u.cleared),n.push(...u.invalid)}}for(const r of o){const l=e[r];l!==void 0&&n.push(new ES(a,l,i,r))}return{cleared:s,invalid:n}}function zG(e,t,i=2){const s=[],n=e.toLowerCase(),o=RG.get(n);for(const a of t){const r=a.toLowerCase();(o?.has(a)||r.includes(n)||OG(n,r)<=i)&&s.push(a)}return s}function Ze(e,t){if(lr(e)){let s=function(n,o){return e(n,o)};var i=s;return s[wn]=t,s}else return{...e,[wn]:t}}function U(e){return Object.assign(lr(e)?(t,i)=>e(t,i):At(e),{[ZC]:!0,[wn]:e[wn]})}function me(e){return Object.assign(lr(e)?(t,i)=>e(t,i):At(e),{[uy]:!0,[wn]:e[wn]})}var At=(e,t="an object",i=!1)=>Ze((s,n)=>{const o=cs(s,e,n.path),a=!od(o.invalid,n.path);return{valid:a,cleared:a||!i?o.cleared:null,invalid:o.invalid}},t),Sc=(e,t,i)=>({...e,[wn]:t,[py]:i}),tt=(...e)=>Ze((t,i)=>{const s=[];for(const n of e){const o=n(t,i);if(typeof o=="object"){if(s.push(...o.invalid),!o.valid)return{valid:!1,cleared:t,invalid:s};t=o.cleared}else if(!o)return!1}return{valid:!0,cleared:t,invalid:s}},e.filter(t=>!t[uy]).map(t=>t[wn]).filter(Boolean).join(" and ")),Ie=(...e)=>Ze((t,i)=>{for(const s of e){const n=s(t,i);if(typeof n=="object"?n.valid:n)return n}return!1},e.filter(t=>!t[uy]).map(t=>t[wn]).filter(Boolean).join(" or ")),nd=e=>Ye(e)||id(e),FG=e=>jo(e)||(Ye(e)||Qt(e))&&id(new Date(e)),Ho=Ze(Ne,"an array"),G=Ze(gG,"a boolean"),Pt=Ze(lr,"a function"),ae=Ze(mG,"a color string"),Da=Ze(FG,"a date"),ke=Ze(qt,"a defined value"),Z=Ze(Ye,"a number"),gy=Ze(Ee,"an object"),E=Ze(Qt,"a string"),XC=Ze(e=>typeof HTMLElement>"u"||e instanceof HTMLElement,"an html element"),al=(e,t=1/0)=>{let i;return t===1/0?i=`an array of at least ${e} items`:e===t?i=`an array of exactly ${e} items`:e===0?i=`an array of no more than ${t} items`:i=`an array of at least ${e} and no more than ${t} items`,Ze(s=>Ne(s)&&s.length>=e&&s.length<=t,i)},qC=(e,t=1/0)=>{let i;return t===1/0?i=`a string of at least ${e} characters`:e===t?i=`an string of exactly ${e} characters`:e===0?i=`an string of no more than ${t} characters`:i=`an string of at least ${e} and no more than ${t} characters`,Ze(s=>Qt(s)&&s.length>=e&&s.length<=t,i)},QC=(e,t=!0)=>Ze(i=>Ye(i)&&(i>e||t&&i===e),`a number greater than ${t?"or equal to ":""}${e}`),JC=(e,t)=>Ze(i=>Ye(i)&&i>=e&&i<=t,`a number between ${e} and ${t} inclusive`),H=QC(0),yp=QC(0,!1),ge=JC(0,1),to=e=>Ze((t,{options:i})=>!nd(t)||!nd(i[e])||tZe((t,{options:i})=>!nd(t)||!nd(i[e])||t<=i[e],`the value to be less than or equal to \`${e}\``),io=e=>Ze((t,{options:i})=>!nd(t)||!nd(i[e])||t>i[e],`the value to be greater than \`${e}\``);function J(...e){Ee(e[0])&&(e=Object.values(e[0]));const t=gp(e,"or",i=>`'${i}'`);return Ze(i=>e.includes(i),`a keyword such as ${t}`)}var Ce=e=>Ze(t=>e===t,`the value ${JSON.stringify(e)}`),Me=(e,t,i=!0)=>Ze((s,n)=>{if(!Ne(s))return!1;let o=i;const a=[],r=[],l=c=>o=i?o&&c:o||c;if(s.length===0)return{valid:!0,cleared:a,invalid:r};for(let c=0;cZe((i,s)=>{if(!Ne(i))return!1;const n=[],o=[];for(let a=0;aZe((i,s)=>lr(i)?dy in i?!0:{valid:!0,cleared:Object.assign((...o)=>{const a=YC(i,o);if(a==null)return;const r=e(a,{options:a,path:""});if(typeof r=="object"){for(const l of r.invalid)eL(s,t??e[wn])(l);if(r.valid)return r.cleared}else{if(r)return a;cp(`Callback \`${s.path}\` returned an invalid value \`${OS(a,50)}\`; expecting ${t??e[wn]}, ignoring.`)}},{[dy]:!0}),invalid:[]}:!1,"a function"),it=(e,t="an object")=>Ze((i,s)=>lr(i)?dy in i?!0:{valid:!0,cleared:Object.assign((...o)=>{const a=YC(i,o,s.path);if(a==null)return;const r=cs(a,e);for(const l of r.invalid)eL(s,t)(l);return r.cleared},{[dy]:!0}),invalid:[]}:!1,"a function");function od(e,t){return e.some(i=>i.type==="required"&&i.path===t)}function eL(e,t){return i=>{if(i instanceof ES)return cp(`Callback \`${e.path}\` returned an unknown property \`${fp(i.path,i.key)}\`${i.getPostfix()}`);const s=OS(i.value,50);cp(i.key?`Callback \`${e.path}\` returned an invalid property \`${fp(i.path,i.key)}\`: \`${s}\`; expecting ${i.description}, ignoring.`:`Callback \`${e.path}\` returned an invalid value \`${s}\`; expecting ${t??i.description}, ignoring.`)}}var fy=e=>{if(!Ee(e))return!1;const t=Object.keys(e);return t.length===1&&t[0].startsWith("$")},_G=At({color:ae,stop:ge},""),tL=Ze(e=>{let t=-1/0;for(const i of e)if(i?.stop!=null){if(i.stop{const n=t(s);return i[n]??(i[n]=[]),i[n].push(s),i},{})}function no(e,t){if(e==null||t==null||e.length!==t.length)return!1;for(let i=0;i{const o=i.get(s)??1/0,a=i.get(n)??1/0;return o-a})}function KG(e,t){let i=0;for(;i=0&&t(e[i]);)i-=1;const s=e.length-1-i;s!==0&&e.splice(e.length-s,s)}function ZG(e,t,i){const s=[e],n=Math.round((t-e)/(i-1));if(n>0)for(let o=e+n;o=i-1);o+=n);return s.push(t),s}var HS=class{constructor(){this.queue=[]}await(e=50){return new Promise(t=>{const i=()=>{clearTimeout(n),t(!0)},n=setTimeout(()=>{const o=this.queue.indexOf(i);o<0||(this.queue.splice(o,1),t(!1))},e);this.queue.push(i)})}notify(){for(const e of this.queue.splice(0))e()}};function oL(e=0){return new Promise(t=>{setTimeout(t,e)})}function*Dc(...e){for(const t of e)t!=null&&(t[Symbol.iterator]?yield*t:yield t)}function XG(e){return e!=null&&typeof e=="object"&&Symbol.iterator in e?e:[e]}function Aa(e){for(const t of e)return t;throw new Error("AG Charts - no first() value found")}function*Tt(e){const t=[void 0,void 0];for(const i of Object.keys(e))t[0]=i,t[1]=e[i],yield t}function ll(e){return e==="true"}function qG(e){return Number(e)}function Nn(e){return e}var QG={role:Nn,"aria-checked":ll,"aria-controls":Nn,"aria-describedby":Nn,"aria-disabled":ll,"aria-expanded":ll,"aria-haspopup":Nn,"aria-hidden":ll,"aria-label":Nn,"aria-labelledby":Nn,"aria-live":Nn,"aria-orientation":Nn,"aria-selected":ll,"data-focus-override":ll,"data-focus-visible-override":ll,"data-preventdefault":ll,class:Nn,for:Nn,id:Nn,tabindex:qG,title:Nn,placeholder:Nn};function Ge(e,t,i){i==null||i===""||i===""?e?.removeAttribute(t):e?.setAttribute(t,i.toString())}function Ca(e,t){if(t!=null)for(const[i,s]of Tt(t))i!=="class"&&Ge(e,i,s)}function ad(e,t,i){if(!(e instanceof HTMLElement))return;const s=e.getAttribute(t);return s===null?i:QG[t]?.(s)??void 0}function La(e,t,i){e!=null&&(i==null?e.style.removeProperty(t):e.style.setProperty(t,i.toString()))}function JG(e,t){for(const[i,s]of Tt(t))La(e,i,s)}function aL(e,t,i,s,n){return te.x&&ie.y}function WS(e,t,i,s=0,n=0){return t>=e.x&&t+s<=e.x+e.width&&i>=e.y&&i+n<=e.y+e.height}function ej(e){return e==null||e.height===0||e.width===0||Number.isNaN(e.height)||Number.isNaN(e.width)}function $S(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kc(e,t,i){if(e>t)return;let s;for(;t>=e;){const n=Math.floor((t+e)/2);i(n)?(s=n,e=n+1):t=n-1}return s}function mp(e,t,i){if(e>t)return;let s;for(;t>=e;){const n=Math.floor((t+e)/2);i(n)?(s=n,t=n-1):e=n+1}return s}function rL(e,t,i){if(e>t)return;let s;for(;t>=e;){const n=Math.floor((t+e)/2),o=i(n);o==null?t=n-1:(s=o,e=n+1)}return s}function tj(e=0,t=0){return new OffscreenCanvas(e,t).getContext("2d")}var ij=class{constructor(e){this.getter=e}get(){let e=this.result?.deref();return e||(e=this.getter(),this.result=new WeakRef(e),e)}clear(){this.result=void 0}},St=class{constructor(){this.callbacks=new Set}flush(){for(const e of this.callbacks)e();this.callbacks.clear()}merge(e){for(const t of e.callbacks)this.callbacks.add(t)}register(...e){for(const t of e)t&&this.callbacks.add(t)}};function sj(e,t){const i=Math.max(e.length,t.length),s=new Set,n=new Set;for(let o=0;o0||n.size>0,added:s,removed:n}}function lL(e){return Array.isArray(e)&&e.length>=2&&e.every(Ye)}function by(e){return Array.isArray(e)&&e.length>=2&&e.every(lL)}function nj(e){const t=e[0],i=e.at(-1);return i===void 0?!1:Qe(t[0],i[0],.001)&&Qe(t[1],i[1],.001)}function cL(e){return Array.isArray(e)&&e.every(by)&&e.every(nj)}function hL(e){if(e===null)return!0;if(!Ee(e)||e.type==null)return!1;const{type:t,coordinates:i}=e;switch(t){case"GeometryCollection":return Array.isArray(e.geometries)&&e.geometries.every(hL);case"MultiPolygon":return Array.isArray(i)&&i.every(cL);case"Polygon":return cL(i);case"MultiLineString":return Array.isArray(i)&&i.every(by);case"LineString":return by(i);case"MultiPoint":return by(i);case"Point":return lL(i);default:return!1}}function oj(e){return Ee(e)&&e.type==="Feature"&&hL(e.geometry)}function aj(e){return Ee(e)&&e.type==="FeatureCollection"&&Array.isArray(e.features)&&e.features.every(oj)}var rd=Ze(aj,"a GeoJSON object"),rj=class{constructor(e,t,i){this._vertexCount=0,this._edgeCount=0,this.pendingProcessingEdgesFrom=[],this.pendingProcessingEdgesTo=[],this.cachedNeighboursEdge=e,this.processedEdge=t,this.singleValueEdges=i}clear(){this._vertexCount=0,this._edgeCount=0,this.pendingProcessingEdgesFrom=[],this.pendingProcessingEdgesTo=[],this.singleValueEdges?.clear()}getVertexCount(){return this._vertexCount}getEdgeCount(){return this._edgeCount}addVertex(e){const t=new lj(e);return this._vertexCount++,t}addEdge(e,t,i){i===this.cachedNeighboursEdge?e.updateCachedNeighbours().set(t.value,t):i===this.processedEdge&&(this.pendingProcessingEdgesFrom.push(e),this.pendingProcessingEdgesTo.push(t));const{edges:s}=e,n=s.get(i);n?n.includes(t)||(this.singleValueEdges?.has(i)?s.set(i,[t]):(n.push(t),this._edgeCount++)):(s.set(i,[t]),this._edgeCount++)}removeVertex(e){this._vertexCount--;const t=e.edges;if(t){for(const[,i]of t)this._vertexCount-=i.length;e.clear()}}removeEdge(e,t,i){const s=e.edges.get(i);if(!s)return;const n=s.indexOf(t);n!==-1&&(s.splice(n,1),s.length===0&&e.edges.delete(i),this._edgeCount--,i===this.cachedNeighboursEdge&&e.readCachedNeighbours()?.delete(t.value))}removeEdges(e,t){e.edges.delete(t)}getVertexValue(e){return e.value}*neighbours(e){for(const[,t]of e.edges)for(const i of t)yield i}*neighboursAndEdges(e){for(const[t,i]of e.edges)for(const s of i)yield[s,t]}neighboursWithEdgeValue(e,t){return e.edges.get(t)}findNeighbour(e,t){return e.edges.get(t)?.[0]}findNeighbourValue(e,t){const i=this.findNeighbour(e,t);if(i)return this.getVertexValue(i)}findNeighbourWithValue(e,t,i){const s=i==null?this.neighbours(e):this.neighboursWithEdgeValue(e,i);if(s){for(const n of s)if(this.getVertexValue(n)===t)return n}}findVertexAlongEdge(e,t,i){if(i===this.cachedNeighboursEdge){let n;for(const o of t)if(n=(n??e).readCachedNeighbours()?.get(o),!n)return;return n}if(t.length===0)return;let s=e;for(const n of t){const o=s?this.neighboursWithEdgeValue(s,i):void 0;if(!o)return;s=o.find(a=>a.value===n)}return s}adjacent(e,t){for(const[,i]of e.edges)if(i.includes(t))return!0;return!1}},lj=class{constructor(e){this.value=e,this.edges=new Map}readCachedNeighbours(){return this._cachedNeighbours}updateCachedNeighbours(){return this._cachedNeighbours??(this._cachedNeighbours=new Map),this._cachedNeighbours}clear(){this.edges.clear(),this._cachedNeighbours?.clear()}},dL=new Map,Zhe=Symbol("ElementID"),cj=1;function hs(e){const t=e.constructor,i=Object.hasOwn(t,"className")?t.className:t.name;if(!i)throw new Error(`The ${t} is missing the 'className' property.`);const s=(dL.get(i)??0)+1;return dL.set(i,s),`${i}-${s}`}function Ic(){return`ag-charts-${cj++}`}function vy(){return crypto.randomUUID?.()??hj()}function hj(){const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let i=0;i0)s={value:o,next:s},n=s;else{for(n=n;n.next!=null&&i(n.next.value,o)<=0;)n=n.next;n.next={value:o,next:n.next}}return s}var Sy="\u2026",ld=/\r?\n/g,My="\u200B";function pL({fontSize:e,fontStyle:t,fontWeight:i,fontFamily:s}){let n="";return t&&t!=="normal"&&(n+=`${t} `),i&&i!=="normal"&&i!==400&&(n+=`${i} `),n+=`${e}px`,n+=` ${s}`,n}function $o(e,t=1.15){return Math.round(e*t)}var dj=/[\s.,;:-]{1,5}$/;function gL(e){return e.replace(dj,"")+Sy}function uj(e){return My+e+My}function pj(e){return e.replaceAll(My,"")}function xp(e){return e.endsWith(Sy)}function fL(e){return e?.text.endsWith(Sy)??!1}var yL=class{constructor(e,t){this.ctx=e,this.measureTextCached=t,this.baselineMap=new Map,this.charMap=new Map,this.lineHeightCache=null}baselineDistance(e){if(e==="alphabetic")return 0;if(this.baselineMap.has(e))return this.baselineMap.get(e);this.ctx.textBaseline=e;const{alphabeticBaseline:t}=this.ctx.measureText("");return this.baselineMap.set(e,t),this.ctx.textBaseline="alphabetic",t}lineHeight(){return this.lineHeightCache??(this.lineHeightCache=this.measureText("").height),this.lineHeightCache}measureText(e){const t=this.measureTextCached?.(e)??this.ctx.measureText(e),{width:i,fontBoundingBoxAscent:s=t.emHeightAscent,fontBoundingBoxDescent:n=t.emHeightDescent}=t,o=s+n;return{width:i,height:o,ascent:s,descent:n}}measureLines(e){const t=typeof e=="string"?e.split(ld):e;let i=0,s=0;const n=t.map(o=>{const a=this.measureText(o);return i1?this.ctx.measureText(e).width:this.charMap.get(e)??this.charWidth(e)}charWidth(e){const{width:t}=this.ctx.measureText(e);return this.charMap.set(e,t),t}},US=new AS(50);function Je(e){typeof e=="object"&&(e=pL(e));let t=US.get(e);if(t)return t;const i=new AS(1e4),s=tj();return s.font=e,t=new yL(s,n=>{let o=i.get(n);return o||(o=s.measureText(n),i.set(n,o),o)}),US.set(e,t),t}Je.clear=()=>US.clear();function On(e,t){let i={segments:[],width:0,height:0,ascent:0,descent:0};const s=[i];for(const a of e){const{text:r,fontSize:l=t.fontSize,fontStyle:c=t.fontStyle,fontWeight:h=t.fontWeight,fontFamily:d=t.fontFamily,...u}=a,p={fontSize:l,fontStyle:c,fontWeight:h,fontFamily:d},g=Je(p),f=r.split(ld);for(let x=0;x0&&(i={segments:[],width:0,height:0,ascent:0,descent:0},s.push(i)),m&&(i.width+=v.width,i.ascent=Math.max(i.ascent,v.ascent),i.descent=Math.max(i.descent,v.descent),i.height=Math.max(i.height,i.ascent+i.descent),i.segments.push({...p,...u,text:m,textMetrics:v}))}}let n=0,o=0;for(const a of s)n=Math.max(n,a.width),o+=a.height;return{width:n,height:o,lineMetrics:s}}function mL(e,t){return t.overflow==="hide"&&e.some(xp)}function Dy(e,t){return Ne(e)?xL(e,t):ky(e,t).join(` +`)}function cl(e,t){return ky(e,t).join(` +`)}function ky(e,t){return Iy(e,t)}function cd(e,t,i,s){const n=t.textWidth(Sy);let o=0,a=0;for(;ai)break;o+=r}if(e.length===a&&(!s||o+n<=i))return s?gL(e):e;for(e=e.slice(0,a).trimEnd();e.length&&t.textWidth(e)+n>i;)e=e.slice(0,-1).trimEnd();return gL(e)}function Iy(e,t,i=0){const s=e.split(ld),n=Je(t.font),o=[];if(t.textWrap==="never"){for(const c of s){const h=cd(c.trimEnd(),n,Math.max(0,t.maxWidth-i));if(!h)break;o.push(h),i=0}return mL(o,t)?[]:o}const a=t.textWrap==="hyphenate",r=t.textWrap==null||t.textWrap==="on-space";for(const c of s){let h=c.trimEnd();if(h===""){o.push(h);continue}let d=0,u=0,p=0;for(o.length||(u=i);dt.maxWidth){if(d===0){h="";break}let f=n.textWidth(h.slice(0,d+1));if(o.length||(f+=i),f<=t.maxWidth){u=f,d++;continue}if(p){const v=gj(h,p+1),b=n.textWidth(v);if(b<=t.maxWidth){o.push(h.slice(0,p).trimEnd()),h=h.slice(p).trimStart(),d=0,u=0,p=0;continue}else r&&b>t.maxWidth&&o.push(h.slice(0,p).trimEnd(),cd(h.slice(p).trimStart(),n,t.maxWidth,!0))}else if(r){const v=cd(h,n,t.maxWidth,!0);v&&o.push(v)}if(r){h="";break}const x=a?"-":"";let m=h.slice(0,d).trim();for(;m.length&&n.textWidth(m+x)>t.maxWidth;)m=m.slice(0,-1).trimEnd();if(m&&m!==My)o.push(m+x);else{h="";break}h=h.slice(m.length).trimStart(),d=-1,u=0,p=0}d++}h&&o.push(h)}yj(o,n,t);const l=fj(o,n,t);return mL(l,t)?[]:l}function gj(e,t){const i=e.indexOf(" ",t);return i===-1?e.slice(t):e.slice(t,i)}function fj(e,t,i){if(!Ye(i.maxHeight))return e;const{height:s,lineMetrics:n}=t.measureLines(e);if(s<=i.maxHeight)return e;for(let o=0,a=0;oi.maxHeight){if(i.overflow==="hide"||o===0)return[];const r=e.slice(0,o),l=r.pop();return r.concat(xp(l)?l:cd(l,t,i.maxWidth,!0))}return e}function yj(e,t,i){if(i.avoidOrphans===!1||e.length<2)return;const{length:s}=e,n=e[s-1],o=e[s-2];if(o.lengthi){s.length&&a();break}if(n+r<=t.maxWidth){n+=r,o+=l,s.push(...c);continue}for(const h of c){if(n+h.textMetrics.width<=t.maxWidth){n+=h.textMetrics.width,s.push(h);continue}const d=Je(h),u=uj(h.text),p={...t,font:h,maxHeight:i-o};let g=Iy(u,{...p,overflow:"hide"},n);if(g.length===0)if(t.textWrap==="never")g=Iy(u,p,n);else{g=Iy(u,p);const m=s.at(-1);m&&(m.text+=` +`,n=0)}if(g.length===0){a();break}const f=g.findIndex(xp);f!==-1&&(g=g.slice(0,f+1));const x=g.at(-1);for(const m of g){const v=pj(m),b=d.measureText(v),S={...h,text:v,textMetrics:b};m===x?n+=b.width:(S.text+=` +`,n=0),o+=b.height,s.push(S)}if(f!==-1)break}}return s}var Ay=class{constructor(){this.cleanup=new St}destroy(){this.cleanup.flush()}},mj=class{constructor(){this.modules=[],this.dependencies=new Map,this.modulesByOptionKey=new Map}register(...e){for(const t of e){this.registerDependencies(t);const i=this.modules.find(s=>t.type===s.type&&("optionsKey"in t&&"optionsKey"in s?t.optionsKey===s.optionsKey:!0)&&t.identifier===s.identifier);if(i){if(t.packageType==="enterprise"&&i.packageType==="community"){const s=this.modules.indexOf(i);this.modules.splice(s,1,t),"optionsKey"in t&&this.modulesByOptionKey.set(t.optionsKey,t)}}else this.modules.push(t),"optionsKey"in t&&this.modulesByOptionKey.set(t.optionsKey,t)}}hasEnterpriseModules(){return this.modules.some(e=>e.packageType==="enterprise")}*byType(...e){const t=new Set,i=this.modules.filter(o=>e.includes(o.type)),s=o=>{const a=this.dependencies.get(o);return a?.flatMap(s).concat(a)??[]},n=[];for(const o of i){const a="optionsKey"in o?o.optionsKey:o.contextKey;if(!t.has(a)){for(const r of s(a)){if(t.has(r))continue;const l=this.modulesByOptionKey.get(r);if(!l){n.push(r);continue}e.includes(l.type)&&(yield l,t.add(r))}yield o,t.add(a)}}if(n.length>0)throw new Error(`Could not resolve module dependencies: ${n}`)}registerDependencies(e){if(e.dependencies==null||e.dependencies.length===0)return;const t="optionsKey"in e?e.optionsKey:e.contextKey;this.dependencies.set(t,e.dependencies)}},Ta=new mj,Cy=Symbol("interpolate"),Ly=e=>e[Cy]!=null;function Ty(e,t,i,s=1/0){const n={nearest:void 0,distanceSquared:s};for(const o of i){const a=o.distanceSquared(e,t);if(a===0)return{nearest:o,distanceSquared:0};an&&(n=Rs(a.x,a.width)),Rs(a.y,a.height)>o&&(o=Rs(a.y,a.height));return new rp(i,s,n-i,o-s)}static nearestBox(t,i,s){return Ty(t,i,s)}toDOMRect(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.y,left:this.x,right:Rs(this.x,this.width),bottom:Rs(this.y,this.height),toJSON(){return{}}}}clone(){const{x:t,y:i,width:s,height:n}=this;return new rp(t,i,s,n)}equals(t){return $S(this,t)}containsPoint(t,i){return WS(this,t,i)}intersection(t){const i=Math.max(this.x,t.x),s=Math.max(this.y,t.y),n=Math.min(Rs(this.x,this.width),Rs(t.x,t.width)),o=Math.min(Rs(this.y,this.height),Rs(t.y,t.height));if(!(i>n||s>o))return new rp(i,s,n-i,o-s)}collidesBBox(t){return this.xt.x&&this.yt.y}computeCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}isFinite(){return Number.isFinite(this.x)&&Number.isFinite(this.y)&&Number.isFinite(this.width)&&Number.isFinite(this.height)}distanceSquared(t,i){if(this.containsPoint(t,i))return 0;const s=t-ve(this.x,t,Rs(this.x,this.width)),n=i-ve(this.y,i,Rs(this.y,this.height));return s*s+n*n}shrink(t,i){if(typeof t=="number")this.applyMargin(t,i);else for(const s of Object.keys(t)){const n=t[s];typeof n=="number"&&this.applyMargin(n,s)}return this.width<0&&(this.width=0),this.height<0&&(this.height=0),this}grow(t,i){if(typeof t=="number")this.applyMargin(-t,i);else for(const s of Object.keys(t)){const n=t[s];typeof n=="number"&&this.applyMargin(-n,s)}return this}applyMargin(t,i){switch(i){case"top":this.y+=t;case"bottom":this.height-=t;break;case"left":this.x+=t;case"right":this.width-=t;break;case"vertical":this.y+=t,this.height-=t*2;break;case"horizontal":this.x+=t,this.width-=t*2;break;case void 0:this.x+=t,this.y+=t,this.width-=t*2,this.height-=t*2;break}}translate(t,i){return this.x+=t,this.y+=i,this}[Cy](t,i){return new rp(this.x*(1-i)+t.x*i,this.y*(1-i)+t.y*i,this.width*(1-i)+t.width*i,this.height*(1-i)+t.height*i)}};bp.zero=Object.freeze(new bp(0,0,0,0)),bp.NaN=Object.freeze(new bp(Number.NaN,Number.NaN,Number.NaN,Number.NaN));var de=bp;function Rs(e,t){return e===-1/0&&t===1/0?1/0:e+t}var bj=2e3,bL=Date.now(),vj=()=>{const e=Date.now()-bL;if(e>bj){const t=(Math.floor(e/100)/10).toFixed(1);K.log(`**** ${t}s since last log message ****`)}bL=Date.now()},Pe={create(...e){return Object.assign((...i)=>{Pe.check(...e)&&(typeof i[0]=="function"&&(i=xy(i[0]())),vj(),K.log(...i))},{check:()=>Pe.check(...e),group:(i,s)=>Pe.check(...e)?K.logGroup(i,s):s()})},check(...e){return e.length===0&&e.push(!0),xy(qe("agChartsDebug")).some(i=>e.includes(i))},inDevelopmentMode(e){if(Pe.check("dev"))return e()}};function vL({context:e,pixelRatio:t,width:i,height:s}){e.save();try{e.resetTransform(),e.clearRect(0,0,Math.ceil(i*t),Math.ceil(s*t))}finally{e.restore()}}function SL(e){if(Pe.check("canvas")){const t=e.save.bind(e),i=e.restore.bind(e);let s=0;Object.assign(e,{save(){t(),s++},restore(){if(s===0)throw new Error("AG Charts - Unable to restore() past depth 0");i(),s--},verifyDepthZero(){if(s!==0)throw new Error(`AG Charts - Save/restore depth is non-zero: ${s}`)}})}}function ML(e,t,i){return[Math.floor(e*i),Math.floor(t*i)]}var KS=class{constructor(e){const{width:t,height:i,pixelRatio:s,willReadFrequently:n=!1}=e;this.width=t,this.height=i,this.pixelRatio=s;const[o,a]=ML(t,i,s);this.canvas=new OffscreenCanvas(o,a),this.context=this.canvas.getContext("2d",{willReadFrequently:n}),this.context.setTransform(s,0,0,s,0,0),SL(this.context)}drawImage(e,t=0,i=0){return e.drawImage(this.canvas,t,i)}transferToImageBitmap(){return this.canvas.transferToImageBitmap()}resize(e,t,i){if(!(e>0&&t>0))return;const{canvas:s,context:n}=this;if(e!==this.width||t!==this.height||i!==this.pixelRatio){const[o,a]=ML(e,t,i);s.width=o,s.height=a}n.setTransform(i,0,0,i,0,0),this.width=e,this.height=t,this.pixelRatio=i}clear(){vL(this)}destroy(){this.canvas.width=0,this.canvas.height=0,this.context.clearRect(0,0,0,0),this.canvas=null,this.context=null,Object.freeze(this)}},YS=Symbol("BREAK"),vp="__decorator_config",wy="__decorator_accessors";function C(e,t){ZS(e,t).optional=!0}function ZS(e,t){if(Object.getOwnPropertyDescriptor(e,vp)==null&&Object.defineProperty(e,vp,{value:{}}),Object.getOwnPropertyDescriptor(e,wy)==null){const h=Object.getPrototypeOf(e)?.[wy]?.slice()??[];Object.defineProperty(e,wy,{value:h})}const i=e[vp],s=t.toString();if(i[s]!=null)return i[s];i[s]={setters:[],getters:[],observers:[]};const n=Object.getOwnPropertyDescriptor(e,t);let o=n?.get,a=n?.set;if(o==null||a==null){const c=e[wy];let h=c.indexOf(t);h===-1&&(h=c.push(t)-1),o??(o=function(){let d=this.__accessors;return d==null&&(d=c.slice().fill(void 0),Object.defineProperty(this,"__accessors",{value:d})),d[h]}),a??(a=function(d){let u=this.__accessors;u==null&&(u=c.slice().fill(void 0),Object.defineProperty(this,"__accessors",{value:u})),u[h]=d})}return Object.defineProperty(e,t,{set:function(c){const{setters:h,observers:d}=i[s];let u;h.some(p=>p.length>2)&&(u=o.call(this));for(const p of h)if(c=p(this,t,c,u),c===YS)return;a.call(this,c);for(const p of d)p(this,c,u)},get:function(){let c=o.call(this);for(const h of i[s].getters)if(c=h(this,t,c),c===YS)return;return c},enumerable:!0,configurable:!1}),i[s]}function Ac(e,t,i){return(s,n)=>{const o=ZS(s,n);o.setters.push(e),t&&o.getters.unshift(t),i&&Object.assign(o,i)}}function DL(e){return(t,i)=>{ZS(t,i).observers.push(e)}}function Ny(e){return e!==void 0&&vp in e}function hl(e){const t=new Set;for(;Ny(e);)t.add(e?.[vp]),e=Object.getPrototypeOf(e);return Array.from(t).flatMap(i=>Object.keys(i))}function kL(e){return hl(e).reduce((t,i)=>(t[String(i)]=e[i]??null,t),{})}function Ci(e,t){return Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:e.every((i,s)=>Ci(i,t[s])):ft(e)?ft(t)?XS(e,t,Ci):!1:e===t}function XS(e,t,i){if(Object.is(e,t))return!0;for(const s of Object.keys(t))if(!(s in e))return!1;for(const s of Object.keys(e))if(!(s in t)||!i(e[s],t[s]))return!1;return!0}function st(...e){const t={};for(const i of e){if(!Ee(i))continue;const s=Ny(i)?hl(i):Object.keys(i);for(const n of s)ft(t[n])&&ft(i[n])?t[n]=st(t[n],i[n]):t[n]??(t[n]=i[n])}return t}function Sp(...e){const t={};for(const i of e){if(!Ee(i))continue;const s=Ny(i)?hl(i):Object.keys(i);for(const n of s)ft(t[n])&&ft(i[n])?t[n]=Sp(t[n],i[n]):n in t||(t[n]??(t[n]=i[n]))}return t}function IL(e,...t){return t&&Ne(e)?e.map(i=>st(i,...t)):e}function AL(e,t){const i={};for(const[s,n]of Tt(e))i[s]=t(n,s,e);return i}function re(e,t){const i={...e};for(const s of t)delete i[s];return i}function Oy(e,t){if(e==null)return;const i={};for(const s of t)Object.hasOwn(e,s)&&(i[s]=e[s]);return i}function qS(e,t){return(Ne(t)?t:t.split(".")).reduce((s,n)=>s[n],e)}var QS=new Set(["__proto__","constructor","prototype"]);function JS(e,t,i){const s=Ne(t)?t.slice():t.split("."),n=s.pop();if(s.some(a=>QS.has(a)))return;const o=s.reduce((a,r)=>a[r],e);return o[n]=i,o[n]}function e0(e,t,i){if(i===void 0)return t;for(const s of e){const n=i[s];n!==void 0&&(t[s]=n)}return t}function cr(e){if(e==null||typeof e!="object"||!ft(e))return e;Object.freeze(e);for(const t of Object.getOwnPropertyNames(e)){const i=e[t];i!==null&&(typeof i=="object"||typeof i=="function")&&!Object.isFrozen(i)&&cr(i)}return e}function CL(e,t){return ft(e)&&t in e}function Sj(e,t){return CL(e,t)&&typeof e[t]=="string"}var hd=(e,t)=>e===t;function ne(e){return function(t,i){const s=`__${i}`;t[i]||Mj(t,i,s,e)}}function Ey(e){return ne(e)}function En(e){return ne(e)}function t0(e){const t=e??{};return t.equals=no,ne(e)}function Mj(e,t,i,s){const{changeCb:n,convertor:o,checkDirtyOnAssignment:a=!1}=s??{},r={changeCb:n,checkDirtyOnAssignment:a,convertor:o},l=Ij(i,kj(Dj(Aj(i,r),r),r),r);Object.defineProperty(e,t,{set:l,get:function(){return this[i]},enumerable:!0,configurable:!0})}function Dj(e,t){const{convertor:i}=t;return i?function(s){e.call(this,i(s))}:e}var LL=Symbol("no-change");function kj(e,t){const{changeCb:i}=t;return i?function(s){const n=e.call(this,s);return n!==LL&&i.call(this,this),n}:e}function Ij(e,t,i){const{checkDirtyOnAssignment:s}=i;return s?function(n){const o=t.call(this,n);return n?._dirty===!0&&this.markDirty(e),o}:t}function Aj(e,t){const{equals:i=hd}=t;return function(s){const n=this[e];return i(s,n)?LL:(this[e]=s,this.onChangeDetection(e),s)}}var i0=(e,t)=>Math.sign(e-t);function TL(e,t){if(typeof e=="number"&&typeof t=="number")return i0(e,t);const i=typeof e=="number"?[e]:e,s=typeof t=="number"?[t]:t,n=Math.min(i.length,s.length);for(let o=0;o(e[e.All=0]="All",e[e.None=1]="None",e))(wL||{}),Cj=5,Mp=class MC{constructor(t){this.serialNumber=MC._nextSerialNumber++,this.childNodeCounts={groups:0,nonGroups:0,thisComplexity:0,complexity:0},this.id=hs(this),this.name=void 0,this.transitionOut=void 0,this.pointerEvents=0,this._datum=void 0,this._previousDatum=void 0,this.scene=void 0,this._debugDirtyProperties=void 0,this.parentNode=void 0,this.cachedBBox=void 0,this.isContainerNode=!1,this.visible=!0,this.zIndex=0,this.batchLevel=0,this.batchDirty=!1,this.name=t?.name,this.tag=t?.tag??Number.NaN,this.zIndex=t?.zIndex??0,this.scene=t?.scene,(t?.debugDirty??MC._debugEnabled)&&(this._debugDirtyProperties=new Map([["__first__",[]]]))}static toSVG(t,i,s){const n=t?.toSVG();if(n==null||!n.elements.length&&!n.defs?.length)return;const o=Xt("svg");if(o.setAttribute("width",String(i)),o.setAttribute("height",String(s)),o.setAttribute("viewBox",`0 0 ${i} ${s}`),o.setAttribute("overflow","visible"),n.defs?.length){const a=Xt("defs");a.append(...n.defs),o.append(a)}return o.append(...n.elements),o.outerHTML}static*extractBBoxes(t,i){for(const s of t)if(!i||s.visible&&!s.transitionOut){const n=s.getBBox();n&&(yield n)}}get datum(){return this._datum}set datum(t){this._datum!==t&&(this._previousDatum=this._datum,this._datum=t)}get previousDatum(){return this._previousDatum}get layerManager(){return this.scene?.layersManager}get imageLoader(){return this.scene?.imageLoader}closestDatum(){for(const{datum:t}of this.traverseUp(!0))if(t!=null)return t}preRender(t,i=1){if(this.childNodeCounts.groups=0,this.childNodeCounts.nonGroups=1,this.childNodeCounts.complexity=i,this.childNodeCounts.thisComplexity=i,this.batchLevel>0||this.batchDirty)throw new Error("AG Charts - illegal rendering state; batched update in progress");return this.childNodeCounts}isolatedRender(t){t.ctx.save();try{this.render(t)}catch(i){const s=i.errorCount??1;if(s>=Cj)throw i.errorCount=s,i;K.warnOnce("Error during rendering",i,i.stack)}finally{t.ctx.restore()}}render(t){const{stats:i}=t;if(this.debugDirtyProperties(),t.debugNodeSearch){const s=this.name??this.id;t.debugNodeSearch.some(n=>typeof n=="string"?n===s:n.test(s))&&(t.debugNodes[this.name??this.id]=this)}i&&(i.nodesRendered++,i.opsPerformed+=this.childNodeCounts.thisComplexity)}setScene(t){this.scene=t}*traverseUp(t){t&&(yield this);let i=this.parentNode;for(;i;)yield i,i=i.parentNode}isRoot(){return!this.parentNode}removeChild(t){throw new Error(`AG Charts - internal error, unknown child node ${t.name??t.id} in $${this.name??this.id}`)}remove(){this.parentNode?.removeChild(this)}destroy(){this.parentNode&&this.remove()}batchedUpdate(t){this.batchLevel++,t(),this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1)}setProperties(t){return this.batchLevel++,Object.assign(this,t),this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1),this}containsPoint(t,i){return!1}pickNode(t,i){if(this.containsPoint(t,i))return this}pickNodes(t,i,s=[]){return this.containsPoint(t,i)&&s.push(this),s}getBBox(){return this.cachedBBox??(this.cachedBBox=Object.freeze(this.computeBBox())),this.cachedBBox}computeBBox(){}onChangeDetection(t){this.markDirty(t)}markDirtyChildrenOrder(){this.cachedBBox=void 0}markDirty(t){if(this.batchLevel>0){this.batchDirty=!0;return}t!=null&&this._debugDirtyProperties&&this.markDebugProperties(t),this.cachedBBox=void 0,this.parentNode?.markDirty()}markDebugProperties(t){const i=this._debugDirtyProperties?.get(t)??[],s=new Error("Stack trace for property change tracking").stack?.split(` +`).filter(n=>n!=="Error"&&!n.includes(".markDebugProperties")&&!n.includes(".markDirty")&&!n.includes("Object.assign ")&&!n.includes(`${this.constructor.name}.`))??"unknown";i.push(s[0].replace(" at ","").trim()),this._debugDirtyProperties?.set(t,i)}debugDirtyProperties(){if(this._debugDirtyProperties!=null){if(!this._debugDirtyProperties.has("__first__")){for(const[t,i]of this._debugDirtyProperties.entries())if(i.length>1){console.groupCollapsed(`Property changed multiple times before render: ${this.constructor.name}.${t} (${i.length}x)`);for(const s of i)console.log(s);console.groupEnd()}}this._debugDirtyProperties.clear()}}onZIndexChange(){this.parentNode?.markDirtyChildrenOrder()}toSVG(){}};Mp._nextSerialNumber=0,Mp._debugEnabled=!1,M([ne()],Mp.prototype,"visible",2),M([En({equals:Ci,changeCb:e=>e.onZIndexChange()})],Mp.prototype,"zIndex",2);var hr=Mp,oo=Math.PI*2,Dp=Math.PI/2;function Gi(e){return e%=oo,e+=oo,e%=oo,e}function Lj(e){return e%=oo,e+=oo,e!==oo&&(e%=oo),e}function Py(e){return e%=oo,e<-Math.PI?e+=oo:e>=Math.PI&&(e-=oo),e}function Cc(e,t,i){const s=Gi(e),n=Gi(t),o=Gi(i);return no?n<=s||s<=o:t!==i}function ds(e){return e/180*Math.PI}function Tj(e){return e/Math.PI*180}function Ry(e,t){return e=Gi(e),t=Gi(t),t-e+(e>t?oo:0)}function NL(e){const t=Gi(e);return t<=Dp?t/Dp:t<=Math.PI?(Math.PI-t)/Dp:t<=1.5*Math.PI?(t-Math.PI)/Dp:(oo-t)/Dp}function s0(e,t,i){const s=NL(i);return e*s+t*Math.abs(1-s)}function dr(e){return e?Gi(ds(e)):0}var Lc=(e,t,i)=>e*(1-i)+t*i,n0=e=>{const t=e<0?-1:1,i=Math.abs(e);return i<=.04045?e/12.92:t*((i+.055)/1.055)**2.4},o0=e=>{const t=e<0?-1:1,i=Math.abs(e);return i>.0031308?t*(1.055*i**(1/2.4)-.055):12.92*e},OL=class ot{constructor(t,i,s,n=1){this.r=ve(0,t||0,1),this.g=ve(0,i||0,1),this.b=ve(0,s||0,1),this.a=ve(0,n||0,1)}static validColorString(t){return t.includes("#")?!!ot.parseHex(t):t.includes("rgb")?!!ot.stringToRgba(t):ot.nameToHex.has(t.toLowerCase())}static fromString(t){if(t.includes("#"))return ot.fromHexString(t);const i=ot.nameToHex.get(t.toLowerCase());if(i)return ot.fromHexString(i);if(t.includes("rgb"))return ot.fromRgbaString(t);throw new Error(`Invalid color string: '${t}'`)}static parseHex(t){t=t.replaceAll(" ","").slice(1);let i;switch(t.length){case 6:case 8:i=[];for(let s=0;sNumber.parseInt(s,16)).map(s=>s+s*16);break}if(i?.length>=3&&i.every(s=>s>=0))return i.length===3&&i.push(255),i}static fromHexString(t){const i=ot.parseHex(t);if(i){const[s,n,o,a]=i;return new ot(s/255,n/255,o/255,a/255)}throw new Error(`Malformed hexadecimal color string: '${t}'`)}static stringToRgba(t){let i=-1,s=-1;for(let r=0;r=0?p:p+360;return[g,f,x]}static OKLCHtoRGB(t,i,s){const n=t,o=i*Math.cos(s*Math.PI/180),a=i*Math.sin(s*Math.PI/180),r=(n+.3963377774*o+.2158037573*a)**3,l=(n-.1055613458*o-.0638541728*a)**3,c=(n-.0894841775*o-1.291485548*a)**3,h=4.0767416621*r-3.3077115913*l+.2309699292*c,d=-1.2684380046*r+2.6097574011*l-.3413193965*c,u=-.0041960863*r-.7034186147*l+1.707614701*c,p=o0(h),g=o0(d),f=o0(u);return[p,g,f]}static RGBtoHSL(t,i,s){const n=Math.min(t,i,s),o=Math.max(t,i,s),a=(o+n)/2;let r,l;if(o===n)r=0,l=0;else{const c=o-n;l=a>.5?c/(2-o-n):c/(o+n),o===t?r=(i-s)/c+(i1&&(h-=1),h<1/6?o+(n-o)*6*h:h<1/2?n:h<2/3?o+(n-o)*(2/3-h)*6:o}const r=a(t/360+1/3),l=a(t/360),c=a(t/360-1/3);return[r,l,c]}static RGBtoHSB(t,i,s){const n=Math.min(t,i,s),o=Math.max(t,i,s),a=o===0?0:(o-n)/o;let r=0;if(n!==o){const l=o-n,c=(o-t)/l,h=(o-i)/l,d=(o-s)/l;t===o?r=d-h:i===o?r=2+c-d:r=4+h-c,r/=6,r<0&&(r=r+1)}return[r*360,a,o]}static HSBtoRGB(t,i,s){t=(t%360+360)%360/360;let n=0,o=0,a=0;if(i===0)n=o=a=s;else{const r=(t-Math.floor(t))*6,l=r-Math.floor(r),c=s*(1-i),h=s*(1-i*l),d=s*(1-i*(1-l));switch(Math.trunc(r)){case 0:n=s,o=d,a=c;break;case 1:n=h,o=s,a=c;break;case 2:n=c,o=s,a=d;break;case 3:n=c,o=h,a=s;break;case 4:n=d,o=c,a=s;break;case 5:n=s,o=c,a=h;break}}return[n,o,a]}static mix(t,i,s){return new ot(Lc(t.r,i.r,s),Lc(t.g,i.g,s),Lc(t.b,i.b,s),Lc(t.a,i.a,s))}static lighten(t,i){const s=ot.RGBtoOKLCH(t.r,t.g,t.b);return ot.fromOKLCH(ve(0,s[0]+i,1),s[1],s[2])}static darken(t,i){const s=ot.RGBtoOKLCH(t.r,t.g,t.b);return ot.fromOKLCH(ve(0,s[0]-i,1),s[1],s[2])}static interpolate(t,i){const s=1/(t.length-1),n=t.map(o=>ot.RGBtoOKLCH(o.r,o.g,o.b));return Array.from({length:i},(o,a)=>{const r=a/(i-1),l=t.length<=2?0:Math.min(Math.floor(r*(t.length-1)),t.length-2),c=(r-l*s)/s,h=n[l],d=n[l+1];return ot.fromOKLCH(Lc(h[0],d[0],c),Lc(h[1],d[1],c),Lc(h[2],d[2],c))})}};OL.nameToHex=new Map([["aliceblue","#F0F8FF"],["antiquewhite","#FAEBD7"],["aqua","#00FFFF"],["aquamarine","#7FFFD4"],["azure","#F0FFFF"],["beige","#F5F5DC"],["bisque","#FFE4C4"],["black","#000000"],["blanchedalmond","#FFEBCD"],["blue","#0000FF"],["blueviolet","#8A2BE2"],["brown","#A52A2A"],["burlywood","#DEB887"],["cadetblue","#5F9EA0"],["chartreuse","#7FFF00"],["chocolate","#D2691E"],["coral","#FF7F50"],["cornflowerblue","#6495ED"],["cornsilk","#FFF8DC"],["crimson","#DC143C"],["cyan","#00FFFF"],["darkblue","#00008B"],["darkcyan","#008B8B"],["darkgoldenrod","#B8860B"],["darkgray","#A9A9A9"],["darkgreen","#006400"],["darkgrey","#A9A9A9"],["darkkhaki","#BDB76B"],["darkmagenta","#8B008B"],["darkolivegreen","#556B2F"],["darkorange","#FF8C00"],["darkorchid","#9932CC"],["darkred","#8B0000"],["darksalmon","#E9967A"],["darkseagreen","#8FBC8F"],["darkslateblue","#483D8B"],["darkslategray","#2F4F4F"],["darkslategrey","#2F4F4F"],["darkturquoise","#00CED1"],["darkviolet","#9400D3"],["deeppink","#FF1493"],["deepskyblue","#00BFFF"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1E90FF"],["firebrick","#B22222"],["floralwhite","#FFFAF0"],["forestgreen","#228B22"],["fuchsia","#FF00FF"],["gainsboro","#DCDCDC"],["ghostwhite","#F8F8FF"],["gold","#FFD700"],["goldenrod","#DAA520"],["gray","#808080"],["green","#008000"],["greenyellow","#ADFF2F"],["grey","#808080"],["honeydew","#F0FFF0"],["hotpink","#FF69B4"],["indianred","#CD5C5C"],["indigo","#4B0082"],["ivory","#FFFFF0"],["khaki","#F0E68C"],["lavender","#E6E6FA"],["lavenderblush","#FFF0F5"],["lawngreen","#7CFC00"],["lemonchiffon","#FFFACD"],["lightblue","#ADD8E6"],["lightcoral","#F08080"],["lightcyan","#E0FFFF"],["lightgoldenrodyellow","#FAFAD2"],["lightgray","#D3D3D3"],["lightgreen","#90EE90"],["lightgrey","#D3D3D3"],["lightpink","#FFB6C1"],["lightsalmon","#FFA07A"],["lightseagreen","#20B2AA"],["lightskyblue","#87CEFA"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#B0C4DE"],["lightyellow","#FFFFE0"],["lime","#00FF00"],["limegreen","#32CD32"],["linen","#FAF0E6"],["magenta","#FF00FF"],["maroon","#800000"],["mediumaquamarine","#66CDAA"],["mediumblue","#0000CD"],["mediumorchid","#BA55D3"],["mediumpurple","#9370DB"],["mediumseagreen","#3CB371"],["mediumslateblue","#7B68EE"],["mediumspringgreen","#00FA9A"],["mediumturquoise","#48D1CC"],["mediumvioletred","#C71585"],["midnightblue","#191970"],["mintcream","#F5FFFA"],["mistyrose","#FFE4E1"],["moccasin","#FFE4B5"],["navajowhite","#FFDEAD"],["navy","#000080"],["oldlace","#FDF5E6"],["olive","#808000"],["olivedrab","#6B8E23"],["orange","#FFA500"],["orangered","#FF4500"],["orchid","#DA70D6"],["palegoldenrod","#EEE8AA"],["palegreen","#98FB98"],["paleturquoise","#AFEEEE"],["palevioletred","#DB7093"],["papayawhip","#FFEFD5"],["peachpuff","#FFDAB9"],["peru","#CD853F"],["pink","#FFC0CB"],["plum","#DDA0DD"],["powderblue","#B0E0E6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#FF0000"],["rosybrown","#BC8F8F"],["royalblue","#4169E1"],["saddlebrown","#8B4513"],["salmon","#FA8072"],["sandybrown","#F4A460"],["seagreen","#2E8B57"],["seashell","#FFF5EE"],["sienna","#A0522D"],["silver","#C0C0C0"],["skyblue","#87CEEB"],["slateblue","#6A5ACD"],["slategray","#708090"],["slategrey","#708090"],["snow","#FFFAFA"],["springgreen","#00FF7F"],["steelblue","#4682B4"],["tan","#D2B48C"],["teal","#008080"],["thistle","#D8BFD8"],["tomato","#FF6347"],["transparent","#00000000"],["turquoise","#40E0D0"],["violet","#EE82EE"],["wheat","#F5DEB3"],["white","#FFFFFF"],["whitesmoke","#F5F5F5"],["yellow","#FFFF00"],["yellowgreen","#9ACD32"]]);var mt=OL,EL=(e=>(e[e.Leading=0]="Leading",e[e.Trailing=1]="Trailing",e[e.Interpolate=2]="Interpolate",e))(EL||{}),zy=class{ticks(e,t,i){}niceDomain(e,t=this.domain){return t}get bandwidth(){}get step(){}get inset(){}},kp=(e,t)=>{const i=Symbol(String(t));e[i]=void 0,Object.defineProperty(e,t,{get(){return this[i]},set(s){this[i]!==s&&(this[i]=s,this.invalid=!0)},enumerable:!0,configurable:!1})},PL=e=>{const t=mt.fromString(e),[i,s,n]=mt.RGBtoOKLCH(t.r,t.g,t.b);return{l:i,c:s,h:n,a:t.a}},a0=1e-6,RL=e=>e.c1-a0,wj=(e,t,i)=>{i=ve(0,i,1);let s;if(RL(e))s=t.h;else if(RL(t))s=e.h;else{const r=e.h;let l=t.h;const c=t.h-e.h;c>180?l-=360:c<-180&&(l+=360),s=r*(1-i)+l*i}const n=e.c*(1-i)+t.c*i,o=e.l*(1-i)+t.l*i,a=e.a*(1-i)+t.a*i;return mt.fromOKLCH(o,n,s,a)},dd=class extends zy{constructor(){super(...arguments),this.type="color",this.defaultTickCount=0,this.invalid=!0,this.domain=[0,1],this.range=["red","blue"],this.parsedRange=this.range.map(PL)}update(){const{domain:e,range:t}=this;e.length<2&&(K.warnOnce("`colorDomain` should have at least 2 values."),e.length===0?e.push(0,1):e.length===1&&e.push(e[0]+1));for(let i=1;in){K.warnOnce("`colorDomain` values should be supplied in ascending order."),e.sort((o,a)=>o-a);break}}if(t.length0?t[0]:"black");this.parsedRange=this.range.map(PL)}normalizeDomains(...e){return{domain:e.flat(),animatable:!0}}toDomain(){}convert(e){this.refresh();const{domain:t,range:i,parsedRange:s}=this,n=t[0],o=t.at(-1),a=i[0],r=i.at(-1);if(e<=n)return a;if(e>=o)return r;let l,c;if(t.length===2){const u=(e-n)/(o-n),p=1/(i.length-1);l=i.length<=2?0:Math.min(Math.floor(u*(i.length-1)),i.length-2),c=(u-l*p)/p}else{for(l=0;l{const i=this[t];return e[String(t)]=Tc(i)?i.toJson():i,e},{})}},ud=class vV extends Array{constructor(t,...i){super(i.length);const n=(o=>!!o?.prototype?.constructor?.name)(t)?o=>new t().set(o):t;Object.defineProperty(this,"itemFactory",{value:n,enumerable:!1,configurable:!1}),this.set(i)}set(t){if(Ne(t)){this.length=t.length;for(let i=0;it?.toJson?.()??t)}};function Tc(e){return e instanceof Le||e instanceof ud}var r0=class extends Le{constructor(){super(...arguments),this.color="black"}};M([C],r0.prototype,"stop",2),M([C],r0.prototype,"color",2);function Oj(e){let t;for(const i of e)if(i?.stop!=null){if(t!=null&&i.stop{const{stop:s}=t,n=e.at(i+1)?.color;return n==null?[t]:[t,{stop:s,color:n}]})}function Ej(e,t){const i=t==="discrete"?1:0,s=e.map((n,o,{length:a})=>({stop:(o+i)/(a-1+i),color:n}));return t==="discrete"?BL(s):s}function _L(e,t,i,s="continuous"){const n=e.map(g=>typeof g=="string"?{color:g}:g);if(n.length===0)return Ej(t,s);if(!Oj(n))return K.warnOnce("[fills] must have the stops defined in ascending order"),[];const o=Math.min(...i),a=Math.max(...i),r=s==="discrete",l=new Float64Array(n.length);let c=0,h=-1;for(let g=0;g=h){h=n.length-1;for(let m=g+1;mg.color!=null)?.color,u;const p=n.map((g,f)=>{let x=g?.color;const m=l[f];return x!=null?d=x:d==null?(u==null&&(u=new dd,u.domain=[0,1],u.range=t),x=u.convert(m)):x=d,{stop:m,color:x}});return s==="discrete"?BL(p):p}var Pj=class{constructor(e,t){this.imageLoader=e,this._cache=void 0,this.url=t.url,this.backgroundFill=t.backgroundFill??"black",this.backgroundFillOpacity=t.backgroundFillOpacity??1,this.repeat=t.repeat??"no-repeat",this.width=t.width,this.height=t.height,this.fit=t.fit??"stretch",this.rotation=t.rotation??0}createCanvasImage(e,t,i,s){if(!t)return null;const[n,o]=this.getSize(t.width,t.height,i,s);return n<1||o<1?(K.warnOnce("Image fill is too small to render, ignoring."),null):e.createPattern(t,this.repeat)}getSize(e,t,i,s){const{fit:n}=this;let o=e,a=t,r=1;const l=i/s,c=e/t;return n==="stretch"||e===0||t===0?(o=i,a=s):n==="contain"?r=c>l?i/e:s/t:n==="cover"&&(r=c>l?s/t:i/e),[Math.max(1,o*r),Math.max(1,a*r)]}setImageTransform(e,t){if(typeof e=="string")return;const{url:i,rotation:s,width:n,height:o}=this,a=this.imageLoader?.loadImage(i);if(!a)return;const r=dr(s),l=Math.cos(r),c=Math.sin(r),[h,d]=this.getSize(a.width,a.height,n??t.width,o??t.height),u=h/a.width,p=d/a.height,g=t.x+t.width/2,f=t.y+t.height/2,x=l*h-c*d,m=c*h+l*d,v=x/2,b=m/2;e?.setTransform(new DOMMatrix([l*u,c*p,-c*u,l*p,g-v,f-b]))}createPattern(e,t,i,s){const n=this.width??t,o=this.height??i,a=this._cache;if(a!=null&&a.ctx===e&&a.width===n&&a.height===o)return a.pattern;const r=this.imageLoader?.loadImage(this.url,s),l=this.createCanvasImage(e,r,n,o);if(l!=null)return this._cache={ctx:e,pattern:l,width:n,height:o},l}toSvg(e,t){const{url:i,rotation:s,backgroundFill:n,backgroundFillOpacity:o}=this,{x:a,y:r,width:l,height:c}=e,h=Xt("pattern");h.setAttribute("viewBox",`0 0 ${l} ${c}`),h.setAttribute("x",String(a)),h.setAttribute("y",String(r)),h.setAttribute("width",String(l)),h.setAttribute("height",String(c)),h.setAttribute("patternUnits","userSpaceOnUse");const d=Xt("rect");d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("width",String(l)),d.setAttribute("height",String(c)),d.setAttribute("fill",n),d.setAttribute("fill-opacity",String(o)),h.appendChild(d);const u=Xt("image");return u.setAttribute("href",i),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",String(l)),u.setAttribute("height",String(c)),u.setAttribute("preserveAspectRatio","none"),u.setAttribute("transform",`scale(${1/t}) rotate(${s}, ${l/2}, ${c/2})`),h.appendChild(u),h}};function VL(e,t,i,s){const n=e-i,o=t-s;return n*n+o*o}function By(e,t,i,s,n,o,a){if(i===n&&s===o)return Math.min(a,VL(e,t,i,s));const r=n-i,l=o-s,c=Math.max(0,Math.min(1,((e-i)*r+(t-s)*l)/(r*r+l*l))),h=i+c*r,d=s+c*l;return Math.min(a,VL(e,t,h,d))}var Rj=/^[\t\n\f\r ]*([achlmqstvz])[\t\n\f\r ]*/i,Mt=/^[+-]?((\d*\.\d+)|(\d+\.)|(\d+))(e[+-]?\d+)?/i,zj=/[\t\n\f\r ]*,?[\t\n\f\r ]*/,GL=/^[01]/,Fj={z:[],h:[Mt],v:[Mt],m:[Mt,Mt],l:[Mt,Mt],t:[Mt,Mt],s:[Mt,Mt,Mt,Mt],q:[Mt,Mt,Mt,Mt],c:[Mt,Mt,Mt,Mt,Mt,Mt],a:[Mt,Mt,Mt,GL,GL,Mt,Mt]};function Bj(e){if(!e)return;const t=[];let i=0,s;for(;i=0&&i<=1?[i]:[]}function Gj(e,t,i,s=1e-6){if(Math.abs(e)=0&&a<=1&&o.push(a)}else if(n>0){const a=Math.sqrt(n),r=(-t-a)/(2*e),l=(-t+a)/(2*e);r>=0&&r<=1&&o.push(r),l>=0&&l<=1&&o.push(l)}return o}function jj(e,t,i,s,n=1e-6){if(Math.abs(e)=0){const p=Math.sqrt(h),g=Math.sign(c+p)*Math.pow(Math.abs(c+p),d),f=Math.sign(c-p)*Math.pow(Math.abs(c-p),d),x=Math.abs(Math.sqrt(3)*(g-f)/2),m=-d*o+(g+f);if(m>=0&&m<=1&&u.push(m),Math.abs(x)=0&&v<=1&&u.push(v)}}else{const p=Math.acos(c/Math.sqrt(-l*l*l)),g=d*o,f=2*Math.sqrt(-l),x=f*Math.cos(d*p)-g,m=f*Math.cos(d*(p+2*Math.PI))-g,v=f*Math.cos(d*(p+4*Math.PI))-g;x>=0&&x<=1&&u.push(x),m>=0&&m<=1&&u.push(m),v>=0&&v<=1&&u.push(v)}return u}function Ip(e,t,i,s,n,o,a,r){const l=(i-e)*(r-o)-(s-t)*(a-n);if(l===0)return 0;const c=((a-n)*(t-o)-(e-n)*(r-o))/l,h=((i-e)*(t-o)-(s-t)*(e-n))/l;return c>=0&&c<=1&&h>=0&&h<=1?1:0}function Hj(e,t,i,s,n,o,a,r,l,c,h,d){let u=0;const p=c-d,g=h-l,f=l*(d-c)-c*(h-l),x=jL(e,i,n,a),m=jL(t,s,o,r),v=p*x[0]+g*m[0],b=p*x[1]+g*m[1],S=p*x[2]+g*m[2],D=p*x[3]+g*m[3]+f,L=jj(v,b,S,D);for(const I of L){const A=I*I,T=I*A,w=x[0]*T+x[1]*A+x[2]*I+x[3],N=m[0]*T+m[1]*A+m[2]*I+m[3];let O;l===h?O=(N-c)/(d-c):O=(w-l)/(h-l),O>=0&&O<=1&&u++}return u}function jL(e,t,i,s){return[-e+3*t-3*i+s,3*e-6*t+3*i,-3*e+3*t,e]}function pd(e,t,i,s,n){return(1-n)**3*e+3*(1-n)**2*n*t+3*(1-n)*n**2*i+n**3*s}function _y(e,t,i,s,n){if(n<=Math.min(e,s))return e=Math.max(e,s))return e0&&l<1)return[l]}return[]}const r=o*o-4*n*a;if(r>=0){const l=Math.sqrt(r),c=(-o+l)/(2*n),h=(-o-l)/(2*n);return[c,h].filter(d=>d>0&&d<1)}return[]}function WL(e,t,i,s,n,o,a,r){const l=HL(e,i,n,a),c=HL(t,s,o,r);return[...l,...c]}function l0(e,t,i){const s=pd(e[0].x,e[1].x,e[2].x,e[3].x,.5),n=pd(e[0].y,e[1].y,e[2].y,e[3].y,.5),o=Math.hypot(s-t,n-i),a=Math.min(Math.hypot(e[0].x-t,e[0].y-i),Math.hypot(e[1].x-t,e[1].y-i),Math.hypot(e[2].x-t,e[2].y-i),Math.hypot(e[3].x-t,e[3].y-i));return{points:e,distance:o,minDistance:a}}function $L(e,t,i,s,n,o,a,r,l,c,h=1){let u={value:l0([{x:e,y:t},{x:i,y:s},{x:n,y:o},{x:a,y:r}],l,c),next:null},p;for(;u!=null;){const{points:g,distance:f,minDistance:x}=u.value;if(u=u.next,(p==null||ft.minDistance-e.minDistance,gd=class{constructor(){this.path2d=new Path2D,this.previousCommands=[],this.previousParams=[],this.previousClosedPath=!1,this.commands=[],this.params=[],this.cx=Number.NaN,this.cy=Number.NaN,this.sx=Number.NaN,this.sy=Number.NaN,this.openedPath=!1,this.closedPath=!1}isEmpty(){return this.commands.length===0}isDirty(){return this.closedPath!==this.previousClosedPath||this.previousCommands.length!==this.commands.length||this.previousParams.length!==this.params.length||this.previousCommands.toString()!==this.commands.toString()||this.previousParams.toString()!==this.params.toString()}getPath2D(){return this.path2d}moveTo(e,t){this.openedPath=!0,this.sx=e,this.sy=t,this.cx=e,this.cy=t,this.path2d.moveTo(e,t),this.commands.push(0),this.params.push(e,t)}lineTo(e,t){this.openedPath?(this.cx=e,this.cy=t,this.path2d.lineTo(e,t),this.commands.push(1),this.params.push(e,t)):this.moveTo(e,t)}cubicCurveTo(e,t,i,s,n,o){this.openedPath||this.moveTo(e,t),this.path2d.bezierCurveTo(e,t,i,s,n,o),this.commands.push(2),this.params.push(e,t,i,s,n,o)}closePath(){this.openedPath&&(this.cx=this.sx,this.cy=this.sy,this.sx=Number.NaN,this.sy=Number.NaN,this.path2d.closePath(),this.commands.push(3),this.openedPath=!1,this.closedPath=!0)}rect(e,t,i,s){this.moveTo(e,t),this.lineTo(e+i,t),this.lineTo(e+i,t+s),this.lineTo(e,t+s),this.closePath()}roundRect(e,t,i,s,n){n=Math.min(n,i/2,s/2),this.moveTo(e,t+n),this.arc(e+n,t+n,n,Math.PI,1.5*Math.PI),this.lineTo(e+n,t),this.lineTo(e+i-n,t),this.arc(e+i-n,t+n,n,1.5*Math.PI,2*Math.PI),this.lineTo(e+i,t+n),this.lineTo(e+i,t+s-n),this.arc(e+i-n,t+s-n,n,0,Math.PI/2),this.lineTo(e+i-n,t+s),this.lineTo(e+n,t+s),this.arc(e+ +n,t+s-n,n,Math.PI/2,Math.PI),this.lineTo(e,t+s-n),this.closePath()}ellipse(e,t,i,s,n,o,a,r=!1){const l=i,c=s/i,h=Math.cos(n),d=Math.sin(n),u=-c*d,p=c*h,g=l*Math.cos(o),f=l*Math.sin(o),x=e+h*g+u*f,m=t+d*g+p*f,v=(x-this.cx)**2+(m-this.cy)**2;this.openedPath?v>1e-6&&this.lineTo(x,m):this.moveTo(x,m);let b=r?-Gi(o-a):Gi(a-o);Math.abs(Math.abs(a-o)-2*Math.PI)<1e-6&&b<2*Math.PI&&(b+=2*Math.PI*(r?-1:1));const S=Math.max(Math.ceil(Math.abs(b)/(Math.PI/2)),1),D=b/S,L=4/3*Math.tan(D/4);for(let I=0;I=1?(m=Math.sqrt(m),i*=m,s*=m):(m=Math.sqrt(1/m-1),o===a&&(m=-m),S=m*i*x,D=-m*s*f,v+=u*S-d*D,b+=d*S+u*D);const L=Math.atan2((g-D)/s,(p-S)/i),I=Math.atan2((-g-D)/s,(-p-S)/i)-L,A=L+I,T=!!(1-a);this.ellipse(v,b,i,s,n,L,A,T)}clear(e){e&&(this.previousCommands=this.commands,this.previousParams=this.params,this.previousClosedPath=this.closedPath),this.path2d=new Path2D,this.openedPath=!1,this.closedPath=!1,this.commands=[],this.params=[]}isPointInPath(e,t){const i=this.commands,s=this.params,n=i.length,o=-1e4,a=-1e4;let r=Number.NaN,l=Number.NaN,c=0,h=0,d=0;for(let u=0,p=0;u({x:t,y:i})){const t=[],{commands:i,params:s}=this,n=(a,r)=>{t.push(a);for(let l=0;l{i=Math.min(p,i),s=Math.min(u,s),n=Math.max(u,n),o=Math.max(p,o),a=u,r=p};let d=0;for(const u of e)switch(u){case 0:h(t[d++],t[d++]),l=a,c=r;break;case 1:h(t[d++],t[d++]);break;case 2:{const p=a,g=r,f=t[d++],x=t[d++],m=t[d++],v=t[d++],b=t[d++],S=t[d++],D=WL(p,g,f,x,m,v,b,S);for(const L of D){const I=pd(p,f,m,b,L),A=pd(g,x,v,S,L);h(I,A)}h(b,S);break}case 3:h(l,c),l=Number.NaN,c=Number.NaN;break}return new de(s,i,n-s,o-i)}};function ji(e,t,i){const s=Math.round(t*e)/e;return i==null?s:i===0?0:i<1?Math.ceil(i*e)/e:Math.round((i+t)*e)/e-s}function KL(e,t){return Math.floor(t*e)/e}function c0(e,t,i){const{width:s,height:n,padding:o,strokeWidth:a}=t,r=s/2,l=n/2,c=Math.max(1,s-o-a/2),h=Math.max(1,n-o-a/2);let d=!1;for(const[u,p]of i){const g=r+(u-.5)*c,f=l+(p-.5)*h;d?e.lineTo(g,f):e.moveTo(g,f),d=!0}e.closePath()}var YL={circles(e,{width:t,strokeWidth:i,padding:s}){const n=t/2,o=Math.max(1,n-s-i/2);e.arc(n,n,o,0,Math.PI*2)},squares(e,{width:t,height:i,pixelRatio:s,padding:n,strokeWidth:o}){const a=n+o/2;e.moveTo(ji(s,a),ji(s,a)),e.lineTo(ji(s,t-a),ji(s,a)),e.lineTo(ji(s,t-a),ji(s,i-a)),e.lineTo(ji(s,a),ji(s,i-a)),e.closePath()},triangles(e,t){c0(e,t,[[.5,0],[1,1],[0,1]])},diamonds(e,t){c0(e,t,[[.5,0],[1,.5],[.5,1],[0,.5]])},stars(e,{width:t,height:i,padding:s}){const o=Math.max(1,(t-s)/2),a=o/2,r=Math.PI/2;for(let l=0;l<5*2;l++){const c=l%2===0?o:a,h=l*Math.PI/5-r,d=t/2+Math.cos(h)*c,u=i/2+Math.sin(h)*c;e.lineTo(d,u)}e.closePath()},hearts(e,{width:t,height:i,padding:s}){const n=Math.max(1,t/4-s/2),o=t/2,a=i/2+n/2;e.arc(o-n,a-n,n,ds(130),ds(330)),e.arc(o+n,a-n,n,ds(220),ds(50)),e.lineTo(o,a+n),e.closePath()},crosses(e,t){c0(e,t,[[.25,0],[.5,.25],[.75,0],[1,.25],[.75,.5],[1,.75],[.75,1],[.5,.75],[.25,1],[0,.75],[.25,.5],[0,.25]])},"vertical-lines"(e,{width:t,height:i,pixelRatio:s,strokeWidth:n}){const o=ji(s,t/2)-n%2/2;e.moveTo(o,0),e.lineTo(o,i)},"horizontal-lines"(e,{width:t,height:i,pixelRatio:s,strokeWidth:n}){const o=ji(s,i/2)-n%2/2;e.moveTo(0,o),e.lineTo(t,o)},"forward-slanted-lines"(e,{width:t,height:i,strokeWidth:s}){const n=Math.atan2(i,t),o=s*Math.cos(n),a=s*Math.sin(n);e.moveTo(-o,a),e.lineTo(o,-a),e.moveTo(-o,i+a),e.lineTo(t+o,-a),e.moveTo(t-o,i+a),e.lineTo(t+o,i-a)},"backward-slanted-lines"(e,{width:t,height:i,strokeWidth:s}){const n=Math.atan2(i,t),o=s*Math.cos(n),a=s*Math.sin(n);e.moveTo(t-o,-a),e.lineTo(t+o,a),e.moveTo(-o,-a),e.lineTo(t+o,i+a),e.moveTo(-o,i-a),e.lineTo(o,i+a)}},Wj=class{constructor(e){this._cache=void 0,this.width=Math.max(e?.width??10,1),this.height=Math.max(e?.height??10,1),this.fill=e.fill??"none",this.fillOpacity=e.fillOpacity??1,this.backgroundFill=e.backgroundFill??"none",this.backgroundFillOpacity=e.backgroundFillOpacity??1,this.stroke=e.stroke??"black",this.strokeOpacity=e.strokeOpacity??1,this.strokeWidth=e.strokeWidth??1,this.padding=e.padding??1,this.pattern=e.pattern??"forward-slanted-lines",this.rotation=e.rotation??0,this.scale=e.scale??1,this.path=e.path}getPath(e){const{pattern:t,width:i,height:s,padding:n,strokeWidth:o,path:a}=this,r=new gd;let l=YL[t]!=null;return a&&l&&(l=!r.appendSvg(a)),l&&YL[t](r,{width:i,height:s,pixelRatio:e,strokeWidth:o,padding:n}),r}renderStroke(e,t){const{stroke:i,strokeWidth:s,strokeOpacity:n}=this;s&&(t.strokeStyle=i,t.lineWidth=s,t.globalAlpha=n,t.stroke(e))}renderFill(e,t){const{fill:i,fillOpacity:s}=this;i!=="none"&&(t.fillStyle=i,t.globalAlpha=s,t.fill(e))}createCanvasPattern(e,t){const{width:i,height:s,scale:n,backgroundFill:o,backgroundFillOpacity:a}=this;if(i*n<1||s*n<1)return K.warnOnce("Pattern fill is too small to render, ignoring."),null;const r=new KS({width:i,height:s,pixelRatio:t*n}),l=r.context;o!=="none"&&(l.fillStyle=o,l.globalAlpha=a,l.fillRect(0,0,i,s));const c=this.getPath(t).getPath2D();this.renderFill(c,l),this.renderStroke(c,l);const h=e.createPattern(r.canvas,"repeat");return this.setPatternTransform(h,t),r.destroy(),h}setPatternTransform(e,t,i=0,s=0){if(e==null)return;const n=dr(this.rotation),o=1/t,a=Math.cos(n)*o,r=Math.sin(n)*o;e.setTransform(new DOMMatrix([a,r,-r,a,i,s]))}createPattern(e,t){if(this._cache!=null&&this._cache.ctx===e&&this._cache.pixelRatio===t)return this._cache.pattern;const i=this.createCanvasPattern(e,t);if(i!=null)return this._cache={ctx:e,pattern:i,pixelRatio:t},i}toSvg(){const{width:e,height:t,fill:i,fillOpacity:s,backgroundFill:n,backgroundFillOpacity:o,stroke:a,strokeWidth:r,strokeOpacity:l,rotation:c,scale:h}=this,d=Xt("pattern");d.setAttribute("viewBox",`0 0 ${e} ${t}`),d.setAttribute("width",String(e)),d.setAttribute("height",String(t)),d.setAttribute("patternUnits","userSpaceOnUse");const u=Xt("rect");u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",String(e)),u.setAttribute("height",String(t)),u.setAttribute("fill",n),u.setAttribute("fill-opacity",String(o)),d.appendChild(u);const p=Xt("path");return p.setAttribute("fill",i),p.setAttribute("fill-opacity",String(s)),p.setAttribute("stroke-opacity",String(l)),p.setAttribute("stroke",a),p.setAttribute("stroke-width",String(r)),p.setAttribute("transform",`rotate(${c}) scale(${h})`),p.setAttribute("d",this.getPath(1).toSVG()),d.appendChild(p),d}};function ao(e){return Ee(e)&&e.type=="gradient"}function $j(e){return Ne(e)&&e.every(t=>typeof t=="string")}function ur(e){return e!==null&&Ee(e)&&e.type=="pattern"}function wc(e){return e!==null&&Ee(e)&&e.type=="image"}function Uj(e){return ao(e)||ur(e)}function ZL(e,t){const{fontStyle:i,fontWeight:s,fontSize:n,fontFamily:o}=t;i&&e.setAttribute("font-style",i),s&&e.setAttribute("font-weight",String(s)),n!=null&&e.setAttribute("font-size",String(n)),o&&e.setAttribute("font-family",o)}function Kj(e,t){const{stroke:i,strokeWidth:s,strokeOpacity:n}=t;i&&e.setAttribute("stroke",i),s!=null&&e.setAttribute("stroke-width",String(s)),n!=null&&e.setAttribute("stroke-opacity",String(n))}function Yj(e,t){const{lineDash:i,lineDashOffset:s}=t;if(i?.some(n=>n!==0)){const n=i.length%2===1?[...i,...i]:i;e.setAttribute("stroke-dasharray",n.join(" ")),s!=null&&e.setAttribute("stroke-dashoffset",String(s))}}var ti=class extends hr{constructor(){super(...arguments),this.drawingMode="overlay",this.fillOpacity=1,this.strokeOpacity=1,this.fill="black",this.strokeWidth=0,this.lineDashOffset=0,this.opacity=1}getGradient(e){if(ao(e))return this.createGradient(e)}createGradient(e){const{colorSpace:t="rgb",gradient:i="linear",colorStops:s,rotation:n=0,reverse:o=!1}=e;if(s==null)return;let a=_L(s,["black"],[0,1]);switch(o&&(a=a.map(r=>({color:r.color,stop:1-r.stop})).reverse()),i){case"linear":return new FL(t,a,n);case"radial":return new Nj(t,a);case"conic":return new zL(t,a,n)}}getPattern(e){if(ur(e))return this.createPattern(e)}createPattern(e){return new Wj(e)}getImage(e){if(wc(e))return this.createImage(e)}createImage(e){return new Pj(this.imageLoader,e)}onFillChange(){typeof this.fill=="object"&&Ci(this._cachedFill??{},this.fill)||(this.fillGradient=this.getGradient(this.fill),this.fillPattern=this.getPattern(this.fill),this.fillImage=this.getImage(this.fill),this._cachedFill=this.fill)}onStrokeChange(){this.strokeGradient=this.getGradient(this.stroke)}align(e,t){return ji(this.layerManager?.canvas?.pixelRatio??1,e,t)}markDirty(e){super.markDirty(e),this.cachedDefaultGradientFillBBox=void 0}fillStroke(e,t){this.drawingMode==="cutout"&&(e.globalCompositeOperation="destination-out",this.executeFill(e,t),this.executeStroke(e,t),e.globalCompositeOperation="source-over"),this.renderFill(e,t),this.renderStroke(e,t)}renderFill(e,t){const{fill:i,fillOpacity:s,fillImage:n}=this;if(i!=null&&i!=="none"&&s>0){const{globalAlpha:o}=e;n&&(e.globalAlpha=n.backgroundFillOpacity,e.fillStyle=n.backgroundFill,this.executeFill(e,t),e.globalAlpha=o),this.applyFillAndAlpha(e),this.applyShadow(e),this.executeFill(e,t),e.globalAlpha=o,e.shadowColor="rgba(0, 0, 0, 0)"}}executeFill(e,t){t?e.fill(t):e.fill()}applyFillAndAlpha(e){const{fill:t,fillGradient:i,fillPattern:s,fillImage:n,fillOpacity:o=1,opacity:a=1}=this;if(e.globalAlpha*=a*o,i){const{fillBBox:r=this.getDefaultGradientFillBBox()??this.getBBox(),fillParams:l}=this;e.fillStyle=i.createGradient(e,r,l)??"black"}else if(s){const{x:r,y:l}=this.getBBox(),c=this.layerManager?.canvas?.pixelRatio??1,h=s.createPattern(e,c);s.setPatternTransform(h,c,r,l),h?e.fillStyle=h:(e.fillStyle=s.fill,e.globalAlpha*=s.fillOpacity)}else if(n){const r=this.getBBox(),l=n.createPattern(e,r.width,r.height,this);n.setImageTransform(l,r),e.fillStyle=l??"transparent"}else e.fillStyle=typeof t=="string"?t:"black"}applyStrokeAndAlpha(e){const{stroke:t,strokeOpacity:i=1,strokeGradient:s,opacity:n=1}=this;e.strokeStyle=s?.createGradient(e,this.getBBox())??(typeof t=="string"?t:void 0)??"black",e.globalAlpha*=n*i}applyShadow(e){const t=this.layerManager?.canvas.pixelRatio??1,i=this.fillShadow;i?.enabled&&(e.shadowColor=i.color,e.shadowOffsetX=i.xOffset*t,e.shadowOffsetY=i.yOffset*t,e.shadowBlur=i.blur*t)}renderStroke(e,t){const{stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,lineCap:r,lineJoin:l,miterLimit:c}=this;if(i!=null&&i!=="none"&&s>0&&n>0){const{globalAlpha:h}=e;this.applyStrokeAndAlpha(e),e.lineWidth=s,o&&e.setLineDash(o),a&&(e.lineDashOffset=a),r&&(e.lineCap=r),l&&(e.lineJoin=l),c!=null&&(e.miterLimit=c),this.executeStroke(e,t),e.globalAlpha=h}}executeStroke(e,t){t?e.stroke(t):e.stroke()}getDefaultGradientFillBBox(){return this.cachedDefaultGradientFillBBox??(this.cachedDefaultGradientFillBBox=Object.freeze(this.computeDefaultGradientFillBBox())),this.cachedDefaultGradientFillBBox}computeDefaultGradientFillBBox(){}containsPoint(e,t){return this.isPointInPath(e,t)}applySvgFillAttributes(e,t){const{fill:i,fillOpacity:s}=this;if(typeof i=="string")e.setAttribute("fill",i);else if(ao(i)&&this.fillGradient){t??(t=[]);const n=this.fillGradient.toSvg(this.fillBBox??this.getBBox()),o=vy();n.setAttribute("id",o),t.push(n),e.setAttribute("fill",`url(#${o})`)}else if(ur(i)&&this.fillPattern){t??(t=[]);const n=this.fillPattern.toSvg(),o=vy();n.setAttribute("id",o),t.push(n),e.setAttribute("fill",`url(#${o})`)}else if(wc(i)&&this.fillImage){t??(t=[]);const n=this.layerManager?.canvas?.pixelRatio??1,o=this.fillImage.toSvg(this.getBBox(),n),a=vy();o.setAttribute("id",a),t.push(o),e.setAttribute("fill",`url(#${a})`)}else e.setAttribute("fill","none");return e.setAttribute("fill-opacity",String(s)),t}applySvgStrokeAttributes(e){const{stroke:t,strokeOpacity:i,strokeWidth:s,lineDash:n,lineDashOffset:o}=this;Kj(e,{stroke:Qt(t)?t:void 0,strokeOpacity:i,strokeWidth:s}),Yj(e,{lineDash:n,lineDashOffset:o})}};M([ne()],ti.prototype,"drawingMode",2),M([ne()],ti.prototype,"fillOpacity",2),M([ne()],ti.prototype,"strokeOpacity",2),M([En({equals:Ci,changeCb:e=>e.onFillChange()})],ti.prototype,"fill",2),M([En({equals:Ci,changeCb:e=>e.onStrokeChange()})],ti.prototype,"stroke",2),M([ne()],ti.prototype,"strokeWidth",2),M([t0()],ti.prototype,"lineDash",2),M([ne()],ti.prototype,"lineDashOffset",2),M([ne()],ti.prototype,"lineCap",2),M([ne()],ti.prototype,"lineJoin",2),M([ne()],ti.prototype,"miterLimit",2),M([ne({convertor:e=>ve(0,e??1,1)})],ti.prototype,"opacity",2),M([En({equals:hd,checkDirtyOnAssignment:!0})],ti.prototype,"fillShadow",2),M([En({equals:$S,changeCb:e=>e.onFillChange()})],ti.prototype,"fillBBox",2),M([En({equals:Ci,changeCb:e=>e.onFillChange()})],ti.prototype,"fillParams",2);var XL=[1,0,0,1,0,0],Nc=class vS{get e(){return[...this.elements]}constructor(t=XL){this.elements=[...t]}setElements(t){const i=this.elements;return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],this}get identity(){const t=this.elements;return Qe(t[0],1)&&Qe(t[1],0)&&Qe(t[2],0)&&Qe(t[3],1)&&Qe(t[4],0)&&Qe(t[5],0)}AxB(t,i,s){const n=t[0]*i[0]+t[2]*i[1],o=t[1]*i[0]+t[3]*i[1],a=t[0]*i[2]+t[2]*i[3],r=t[1]*i[2]+t[3]*i[3],l=t[0]*i[4]+t[2]*i[5]+t[4],c=t[1]*i[4]+t[3]*i[5]+t[5];s=s??t,s[0]=n,s[1]=o,s[2]=a,s[3]=r,s[4]=l,s[5]=c}multiplySelf(t){return this.AxB(this.elements,t.elements),this}multiply(t){const i=[Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN];return t instanceof vS?this.AxB(this.elements,t.elements,i):this.AxB(this.elements,[t.a,t.b,t.c,t.d,t.e,t.f],i),new vS(i)}preMultiplySelf(t){return this.AxB(t.elements,this.elements,this.elements),this}inverse(){const t=this.elements;let i=t[0],s=t[1],n=t[2],o=t[3];const a=t[4],r=t[5],l=1/(i*o-s*n);return i*=l,s*=l,n*=l,o*=l,new vS([o,-s,-n,i,n*r-o*a,s*a-i*r])}invertSelf(){const t=this.elements;let i=t[0],s=t[1],n=t[2],o=t[3];const a=t[4],r=t[5],l=1/(i*o-s*n);return i*=l,s*=l,n*=l,o*=l,t[0]=o,t[1]=-s,t[2]=-n,t[3]=i,t[4]=n*r-o*a,t[5]=s*a-i*r,this}transformPoint(t,i){const s=this.elements;return{x:t*s[0]+i*s[2]+s[4],y:t*s[1]+i*s[3]+s[5]}}transformBBox(t,i){const s=this.elements,n=s[0],o=s[1],a=s[2],r=s[3],l=t.width*.5,c=t.height*.5,h=t.x+l,d=t.y+c,u=Math.abs(l*n)+Math.abs(c*a),p=Math.abs(l*o)+Math.abs(c*r);return i??(i=new de(0,0,0,0)),i.x=h*n+d*a+s[4]-u,i.y=h*o+d*r+s[5]-p,i.width=u+u,i.height=p+p,i}toContext(t){if(this.identity)return;const i=this.elements;t.transform(i[0],i[1],i[2],i[3],i[4],i[5])}static updateTransformMatrix(t,i,s,n,o,a,r){const l=i,c=s;let h,d;l===1&&c===1?(h=0,d=0):(h=r?.scalingCenterX??0,d=r?.scalingCenterY??0);const u=n,p=Math.cos(u),g=Math.sin(u);let f,x;u===0?(f=0,x=0):(f=r?.rotationCenterX??0,x=r?.rotationCenterY??0);const m=o,v=a,b=h*(1-l)-f,S=d*(1-c)-x;return t.setElements([p*l,g*l,-g*c,p*c,p*b-g*S+f+m,g*b+p*S+x+v]),t}};function dl(e){return QL(e.constructor)}var qL=Symbol("isMatrixTransform");function QL(e){return e[qL]===!0}function h0(e){var t,i;const s=e;if(QL(e))return e;const n=Symbol("matrix_combined_transform");class o extends s{constructor(){super(...arguments),this[i]=new Nc,this._dirtyTransform=!0}onChangeDetection(r){super.onChangeDetection(r),this._dirtyTransform=!0,!(this.batchLevel>0)&&this.markDirty("transform")}updateMatrix(r){}computeTransformMatrix(){this._dirtyTransform&&(this[n].setElements(XL),this.updateMatrix(this[n]),this._dirtyTransform=!1)}toParent(r){return this.computeTransformMatrix(),this[n].identity?r.clone():this[n].transformBBox(r)}toParentPoint(r,l){return this.computeTransformMatrix(),this[n].identity?{x:r,y:l}:this[n].transformPoint(r,l)}fromParent(r){return this.computeTransformMatrix(),this[n].identity?r.clone():this[n].inverse().transformBBox(r)}fromParentPoint(r,l){return this.computeTransformMatrix(),this[n].identity?{x:r,y:l}:this[n].inverse().transformPoint(r,l)}computeBBox(){const r=super.computeBBox();return r&&this.toParent(r)}computeBBoxWithoutTransforms(){return super.computeBBox()}pickNode(r,l){return{x:r,y:l}=this.fromParentPoint(r,l),super.pickNode(r,l)}pickNodes(r,l,c){return{x:r,y:l}=this.fromParentPoint(r,l),super.pickNodes(r,l,c)}render(r){this.computeTransformMatrix();const{ctx:l}=r,c=this[n];let h=!1;try{c.identity||(l.save(),h=!0,c.toContext(l)),super.render(r)}finally{h&&l.restore()}}toSVG(){this.computeTransformMatrix();const r=super.toSVG(),l=this[n];if(l.identity||r==null)return r;const c=Xt("g");c.append(...r.elements);const[h,d,u,p,g,f]=l.e;return c.setAttribute("transform",`matrix(${h} ${d} ${u} ${p} ${g} ${f})`),{elements:[c],defs:r.defs}}}return t=qL,i=n,o[t]=!0,o}function fd(e){var t;const i=e,s=Symbol("matrix_rotation");class n extends h0(i){constructor(){super(...arguments),this[t]=new Nc,this.rotationCenterX=0,this.rotationCenterY=0,this.rotation=0}updateMatrix(a){super.updateMatrix(a);const{rotation:r,rotationCenterX:l,rotationCenterY:c}=this;r!==0&&(Nc.updateTransformMatrix(this[s],1,1,r,0,0,{rotationCenterX:l,rotationCenterY:c}),a.multiplySelf(this[s]))}}return t=s,M([ne()],n.prototype,"rotationCenterX",2),M([ne()],n.prototype,"rotationCenterY",2),M([ne()],n.prototype,"rotation",2),n}function Zj(e){return"scalingX"in e&&"scalingY"in e&&"scalingCenterX"in e&&"scalingCenterY"in e}function Vy(e){var t;const i=e,s=Symbol("matrix_scale");class n extends h0(i){constructor(){super(...arguments),this[t]=new Nc,this.scalingX=1,this.scalingY=1,this.scalingCenterX=0,this.scalingCenterY=0}updateMatrix(a){super.updateMatrix(a);const{scalingX:r,scalingY:l,scalingCenterX:c,scalingCenterY:h}=this;r===1&&l===1||(Nc.updateTransformMatrix(this[s],r,l,0,0,0,{scalingCenterX:c,scalingCenterY:h}),a.multiplySelf(this[s]))}}return t=s,M([ne()],n.prototype,"scalingX",2),M([ne()],n.prototype,"scalingY",2),M([ne()],n.prototype,"scalingCenterX",2),M([ne()],n.prototype,"scalingCenterY",2),n}function yd(e){var t;const i=e,s=Symbol("matrix_translation");class n extends h0(i){constructor(){super(...arguments),this[t]=new Nc,this.translationX=0,this.translationY=0}updateMatrix(a){super.updateMatrix(a);const{translationX:r,translationY:l}=this;r===0&&l===0||(Nc.updateTransformMatrix(this[s],1,1,0,r,l),a.multiplySelf(this[s]))}}return t=s,M([ne()],n.prototype,"translationX",2),M([ne()],n.prototype,"translationY",2),n}var zt=class{static fromCanvas(e,t){const i=[];for(const s of e.traverseUp())dl(s)&&i.unshift(s);for(const s of i)t=s.fromParent(t);return dl(e)&&(t=e.fromParent(t)),t}static toCanvas(e,t){t==null?t=e.getBBox():dl(e)&&(t=e.toParent(t));for(const i of e.traverseUp())dl(i)&&(t=i.toParent(t));return t}static fromCanvasPoint(e,t,i){const s=[];for(const n of e.traverseUp())dl(n)&&s.unshift(n);for(const n of s)({x:t,y:i}=n.fromParentPoint(t,i));return dl(e)&&({x:t,y:i}=e.fromParentPoint(t,i)),{x:t,y:i}}static toCanvasPoint(e,t,i){dl(e)&&({x:t,y:i}=e.toParentPoint(t,i));for(const s of e.traverseUp())dl(s)&&({x:t,y:i}=s.toParentPoint(t,i));return{x:t,y:i}}},Cp,d0=class Jf extends hr{constructor(t){super(t),this.childNodes=new Set,this.dirty=!1,this.dirtyZIndex=!1,this.clipRect=void 0,this.opacity=1,this.layer=void 0,this.image=void 0,this._lastWidth=Number.NaN,this._lastHeight=Number.NaN,this._lastDevicePixelRatio=Number.NaN,this.isContainerNode=!0,this.renderToOffscreenCanvas=t?.renderToOffscreenCanvas===!0,this.optimizeForInfrequentRedraws=t?.optimizeForInfrequentRedraws===!0}static is(t){return t instanceof Jf}static computeChildrenBBox(t,i=!0){return de.merge(hr.extractBBoxes(t,i))}static compareChildren(t,i){return TL(t.zIndex,i.zIndex)||t.serialNumber-i.serialNumber}containsPoint(t,i){return!0}computeBBox(){return Jf.computeChildrenBBox(this.children())}computeSafeClippingBBox(t){const i=this.computeBBox();if(i?.isFinite()!==!0)return;let s=0;const n=4;for(const u of this.descendants())u instanceof ti&&(s=Math.max(s,u.strokeWidth));const o=Math.max(1,s/2*n),{x:a,y:r}=zt.toCanvasPoint(this,0,0),l=KL(t,a+i.x-o)-a,c=KL(t,r+i.y-o)-r,h=Math.ceil(i.x+i.width-l+o),d=Math.ceil(i.y+i.height-c+o);return new de(l,c,h,d)}prepareSharedCanvas(t,i,s){return Cp==null||Cp.pixelRatio!==s?Cp=new KS({width:t,height:i,pixelRatio:s}):Cp.resize(t,i,s),Cp}setScene(t){super.setScene(t),this.layer&&(this.scene?.layersManager.removeLayer(this.layer),this.layer=void 0);for(const i of this.children())i.setScene(t)}markDirty(t){this.dirty=!0,super.markDirty(t)}markDirtyChildrenOrder(){super.markDirtyChildrenOrder(),this.dirtyZIndex=!0,this.markDirty()}append(t){for(const i of XG(t))i.remove(),this.childNodes.add(i),i.parentNode=this,i.setScene(this.scene);this.markDirtyChildrenOrder(),this.markDirty()}appendChild(t){return this.append(t),t}removeChild(t){if(!this.childNodes?.delete(t))throw new Error(`AG Charts - internal error, unknown child node ${t.name??t.id} in $${this.name??this.id}`);t.parentNode=void 0,t.setScene(),this.markDirtyChildrenOrder(),this.markDirty()}clear(){for(const t of this.children())delete t.parentNode,t.setScene();this.childNodes?.clear(),this.markDirty()}pickNode(t,i){if(!(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))){if(this.childNodes!=null&&this.childNodes.size!==0){const s=[...this.children()];for(let n=s.length-1;n>=0;n--){const a=s[n].pickNode(t,i);if(a!=null)return a}}else if(!this.isContainerNode)return this}}pickNodes(t,i,s=[]){if(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))return s;this.isContainerNode||s.push(this);for(const n of this.children())n.pickNodes(t,i,s);return s}isDirty(t){const{width:i,height:s,devicePixelRatio:n}=t,{dirty:o,layer:a}=this,r=a!=null&&(this._lastWidth!==i||this._lastHeight!==s),l=this._lastDevicePixelRatio!==n;return this._lastWidth=i,this._lastHeight=s,this._lastDevicePixelRatio=n,o||r||l}preRender(t){let i;if(this.dirty){i=super.preRender(t,0);for(const s of this.children()){const n=s.preRender(t);i.groups+=n.groups,i.nonGroups+=n.nonGroups,i.complexity+=n.complexity}i.groups+=1,i.nonGroups-=1}else i=this.childNodeCounts;return this.renderToOffscreenCanvas&&!this.optimizeForInfrequentRedraws&&i.nonGroups>0&&this.getVisibility()?this.layer??(this.layer=this.layerManager?.addLayer({name:this.name})):this.layer!=null&&(this.layerManager?.removeLayer(this.layer),this.layer=void 0),i}render(t){const{layer:i,renderToOffscreenCanvas:s}=this,n={...t},o=this.isDirty(t);if(this.dirty=!1,!s){this.renderInContext(n),super.render(n);return}const{ctx:a,stats:r,devicePixelRatio:l}=t;let{image:c}=this;if(o){c?.bitmap.close(),c=void 0;const d=i?void 0:this.computeSafeClippingBBox(l),u=(p,...g)=>{const f=p.context;n.ctx=f,p.clear(),f.save();try{f.setTransform(...g),f.globalAlpha=1,this.renderInContext(n)}finally{f.restore(),f.verifyDepthZero?.()}};if(i)u(i,a.getTransform());else if(d){const{x:p,y:g,width:f,height:x}=d,m=this.prepareSharedCanvas(f,x,l);u(m,l,0,0,l,-p*l,-g*l),c={bitmap:m.transferToImageBitmap(),x:p,y:g,width:f,height:x}}this.image=c,r&&r.layersRendered++}else r&&r.layersSkipped++;const{globalAlpha:h}=a;if(a.globalAlpha=h*this.opacity,i){a.save();try{a.resetTransform(),i.drawImage(a)}finally{a.restore()}}else if(c){const{bitmap:d,x:u,y:p,width:g,height:f}=c;a.drawImage(d,0,0,g*l,f*l,u,p,g,f)}a.globalAlpha=h,super.render(n)}applyClip(t,i){const{x:s,y:n,width:o,height:a}=i;t.beginPath(),t.rect(s,n,o,a),t.clip()}renderInContext(t){const{ctx:i,stats:s}=t;this.dirtyZIndex&&(this.sortChildren(Jf.compareChildren),this.dirtyZIndex=!1),i.save();try{i.globalAlpha*=this.opacity,this.clipRect!=null&&(this.applyClip(i,this.clipRect),t.clipBBox=zt.toCanvas(this,this.clipRect));for(const n of this.children()){if(!n.visible){s&&(s.nodesSkipped+=n.childNodeCounts.nonGroups+n.childNodeCounts.groups,s.opsSkipped+=n.childNodeCounts.complexity);continue}n.isolatedRender(t)}}finally{i.restore()}}sortChildren(t){if(!this.childNodes)return;const i=[...this.childNodes].sort(t);this.childNodes.clear();for(const s of i)this.childNodes.add(s)}*children(){yield*this.childNodes}*excludeChildren(t){for(const i of this.children())(t.instance&&!(i instanceof t.instance)||t.name&&i.name!==t.name)&&(yield i)}*descendants(){for(const t of this.children())yield t,t instanceof Jf&&(yield*t.descendants())}setClipRect(t){this.clipRect=t?zt.fromCanvas(this,t):void 0}setClipRectCanvasSpace(t){this.clipRect=t}getVisibility(){for(const t of this.traverseUp(!0))if(!t.visible)return!1;return!0}toSVG(){if(!this.visible)return;const t=[],i=[];for(const s of this.children()){const n=s.toSVG();n!=null&&(i.push(...n.elements),n.defs!=null&&t.push(...n.defs))}return{elements:i,defs:t}}};d0.className="Group",M([ne({convertor:e=>ve(0,e,1)})],d0.prototype,"opacity",2);var Be=d0,Xj=class extends Vy(Be){},qj=class extends fd(Be){},us=class extends yd(Be){},md=class extends fd(yd(Be)){};function Qj(e,t){return"context"in e}function JL(e,t){return e!=null&&Qj(e,t)&&t!=null&&typeof t=="object"&&t.context===void 0?(t.context=e.context,!0):!1}function Uo(e,t,i){if(Array.isArray(e)){for(const s of e)if(JL(s,i))break}else JL(e,i);return t(i)}var eT=class{constructor(){this.cache=new WeakMap}call(e,t,i){let s,n=this.cache.get(t);try{s=JSON.stringify(i)}catch{return this.invoke(e,t,n,void 0,i)}return n==null&&(n=new Map,this.cache.set(t,n)),n.has(s)?n.get(s):this.invoke(e,t,n,s,i)}invoke(e,t,i,s,n){try{const o=Uo(e,t,n);return i&&s!=null&&i.set(s,o),o}catch(o){K.warnOnce("User callback errored, ignoring",o);return}}invalidateCache(){this.cache=new WeakMap}};function Gy(e,t){if(!e)return;const{x:i,y:s,width:n,height:o}=e4(t);Hy(e.style,"width",n),Hy(e.style,"height",o),Hy(e.style,"left",i),Hy(e.style,"top",s)}function tT(e){const t=Number.parseFloat(e.style.width)||e.offsetWidth,i=Number.parseFloat(e.style.height)||e.offsetHeight,s=Number.parseFloat(e.style.left)||e.offsetLeft,n=Number.parseFloat(e.style.top)||e.offsetTop;return{x:s,y:n,width:t,height:i}}function Jj(e){if(e.focus({preventScroll:!0}),e.lastChild?.textContent==null)return;const t=Ma().createRange();t.setStart(e.lastChild,e.lastChild.textContent.length),t.setEnd(e.lastChild,e.lastChild.textContent.length);const i=qe().getSelection();i?.removeAllRanges(),i?.addRange(t)}function iT(){const e=qe("navigator");if("scheduling"in e){const t=e.scheduling;if("isInputPending"in t)return t.isInputPending({includeContinuous:!0})}return!1}function jy(e){return`ag-charts-icon ag-charts-icon-${e}`}function e4(e){let{x:t,y:i,width:s,height:n}=e;return(s==null||s>0)&&(n==null||n>0)?e:(t!=null&&s!=null&&s<0&&(s=-s,t=t-s),i!=null&&n!=null&&n<0&&(n=-n,i=i-n),{x:t,y:i,width:s,height:n})}function Hy(e,t,i){i==null?e.removeProperty(t):e.setProperty(t,`${i}px`)}var u0="class-instance";function wa(e,t,i){if(Ne(t)){if(!Ne(e)||e.length!==t.length||t.some((s,n)=>wa(e[n],s,i)!=null))return t}else if(ft(t)){if(!ft(e))return t;const s={},n=new Set([...Object.keys(e),...Object.keys(t)]);for(const o of n)if(e[o]!==t[o])if(i?.has(o))s[o]=t[o];else if(typeof e[o]==typeof t[o]){const a=wa(e[o],t[o],i);a!==null&&(s[o]=a)}else s[o]=t[o];return Object.keys(s).length?s:null}else if(e!==t)return t;return null}function sT(e,t){for(const i of Object.keys(e))if(e[i]!==t?.[i])return!1;return!0}function Ft(e,t){return Ne(e)?t4(e,t):ft(e)?i4(e,t):e instanceof Map?new Map(Ft(Array.from(e))):p0(e)}function t4(e,t){const i=[],s=t?.seen;for(const n of e){if(typeof n=="object"&&s?.includes(n)){K.warn("cycle detected in array",n);continue}s?.push(n),i.push(Ft(n,t)),s?.pop()}return i}function i4(e,t){const i={};for(const s of Object.keys(e))t?.assign?.has(s)?i[s]=e[s]:t?.shallow?.has(s)?i[s]=p0(e[s]):i[s]=Ft(e[s],t);return i}function p0(e){return Ne(e)?e.slice(0):ft(e)?{...e}:jo(e)?new Date(e):fG(e)?new RegExp(e.source,e.flags):e}function ul(e,t,i,s,n,o){if(Ne(e)){o=t(e,s,n,o);let a=0;for(const r of e)o=ul(r,t,i,s?.[a],n,o),a++}else if(ft(e)){o=t(e,s,n,o);for(const a of Object.keys(e)){if(i?.has(a))continue;const r=e[a];o=ul(r,t,i,s?.[a],n,o)}}return o}function Lp(e,t,i={}){const{path:s,matcherPath:n=s?.replace(/(\[[0-9+]+])/i,"[]"),skip:o=[]}=i;if(e==null)throw new Error(`AG Charts - target is uninitialised: ${s??""}`);if(t==null)return e;if(Tc(e))return e.set(t);const a=e,r=g0(e);for(const l of Object.keys(t)){if(QS.has(l))continue;const c=`${n?n+".":""}${l}`;if(o.includes(c))continue;const h=t[l],d=`${s?s+".":""}${l}`,u=a.constructor,p=a[l];try{const g=g0(p),f=g0(h);if(r===u0&&!(l in e||l==="context")){if(h===void 0)continue;K.warn(`unable to set [${d}] in ${u?.name} - property is unknown`);continue}if(g!=null&&f!=null&&f!==g&&(g!==u0||f!=="object")){K.warn(`unable to set [${d}] in ${u?.name} - can't apply type of [${f}], allowed types are: [${g}]`);continue}if(Tc(p))h===void 0?p.clear():p.set(h);else if(f==="object"&&l!=="context"){if(!(l in a)){K.warn(`unable to set [${d}] in ${u?.name} - property is unknown`);continue}p==null?a[l]=h:Lp(p,h,{...i,path:d,matcherPath:c})}else a[l]=h}catch(g){K.warn(`unable to set [${d}] in [${u?.name}]; nested error is: ${g.message}`)}}return e}function g0(e){return e==null?null:yG(e)||jo(e)?"primitive":Ne(e)?"array":Ee(e)?ft(e)?"object":u0:lr(e)?"function":"primitive"}var s4=class{constructor(){this.available=!0,this.acquireQueue=[]}acquire(e){return new Promise(t=>{this.acquireQueue.push([e,t]),this.available&&this.dispatchNext().catch(i=>K.errorOnce(i))})}async acquireImmediately(e){return this.available?(await this.acquire(e),!0):!1}async waitForClearAcquireQueue(){return this.acquire(()=>Promise.resolve(void 0))}async dispatchNext(){this.available=!1;let[e,t]=this.acquireQueue.shift()??[];for(;e;){try{await e(),t?.()}catch(i){K.error("mutex callback error",i),t?.()}[e,t]=this.acquireQueue.shift()??[]}this.available=!0}},nT=class{constructor(){this.eventListeners=new Map}addEventListener(e,t){if(typeof t!="function")throw new TypeError("AG Charts - listener must be a Function");const i=this.eventListeners.get(e);i?i.add(t):this.eventListeners.set(e,new Set([t]))}removeEventListener(e,t){const i=this.eventListeners.get(e);i!=null&&(i.delete(t),i.size===0&&this.eventListeners.delete(e))}hasEventListener(e){return this.eventListeners.has(e)}clearEventListeners(){this.eventListeners.clear()}fireEvent(e){const t=this.eventListeners.get(e.type);if(t)for(const i of t)i(e)}},Oc=class extends Le{constructor(e=0,t=e,i=e,s=t){super(),this.top=e,this.right=t,this.bottom=i,this.left=s}};M([C],Oc.prototype,"top",2),M([C],Oc.prototype,"right",2),M([C],Oc.prototype,"bottom",2),M([C],Oc.prototype,"left",2);function zs(e,t){const i=Ne(e)?e:e.split(".");if(i.length===1){const[s]=i;return Ac((n,o,a)=>n[s]=a,n=>n[s],t)}return Ac((s,n,o)=>JS(s,i,o),s=>qS(s,i),t)}function n4(e){return Ac((t,i,s)=>t[e]=s)}function ii(e,t){return Ac((i,s,n)=>i[e][t??s]=n)}function ps(e){const{newValue:t,oldValue:i,changeValue:s}=e;return Ac((n,o,a,r)=>(a!==r&&(r!==void 0&&i?.call(n,r),a!==void 0&&t?.call(n,a),s?.call(n,a,r)),a))}function pl(e){return DL(e)}function o4(e){return oT((t,i)=>qe().requestAnimationFrame(t),e)}function a4(e){return oT((t,i=0)=>{i===0?queueMicrotask(t):setTimeout(t,i)},e)}function oT(e,t){let i=0,s=!1,n,o;const a=()=>s,r=()=>{s=!1,o?.(),o=void 0,n=void 0,i>0&&e(l)},l=()=>{const c=i;i=0,s=!0;const h=t({count:c});if(!h){r();return}h.then(r,r)};return{schedule(c){i===0&&!a()&&e(l,c),i++},async await(){if(a())for(n??(n=new Promise(c=>{o=c}));a();)await n}}}var f0=["blur","change","contextmenu","focus","keydown","keyup","click","dblclick","mouseenter","mousemove","mouseleave","wheel","touchstart","touchmove","touchend","touchcancel"];function xd(e,t,i){const{offsetX:s,offsetY:n,clientX:o,clientY:a}=t,{currentX:r,currentY:l}=pr.calcCurrentXY(i,t);return{type:e,device:"mouse",offsetX:s,offsetY:n,clientX:o,clientY:a,currentX:r,currentY:l,sourceEvent:t}}function Wy(e,t,i){return{type:e,sourceEvent:t}}var r4={blur:e=>({type:"blur",sourceEvent:e}),change:e=>({type:"change",sourceEvent:e}),contextmenu:(e,t)=>xd("contextmenu",e,t),focus:e=>({type:"focus",sourceEvent:e}),keydown:e=>({type:"keydown",sourceEvent:e}),keyup:e=>({type:"keyup",sourceEvent:e}),click:(e,t)=>xd("click",e,t),dblclick:(e,t)=>xd("dblclick",e,t),mouseenter:(e,t)=>xd("mouseenter",e,t),mousemove:(e,t)=>xd("mousemove",e,t),mouseleave:(e,t)=>xd("mouseleave",e,t),wheel:e=>{const{offsetX:t,offsetY:i,clientX:s,clientY:n}=e,o=e.deltaMode===0?.01:1,a=e.deltaX*o,r=e.deltaY*o;return{type:"wheel",offsetX:t,offsetY:i,clientX:s,clientY:n,deltaX:a,deltaY:r,sourceEvent:e}},touchstart:(e,t)=>Wy("touchstart",e,t),touchmove:(e,t)=>Wy("touchmove",e,t),touchend:(e,t)=>Wy("touchend",e,t),touchcancel:(e,t)=>Wy("touchcancel",e,t)},pr=class{static alloc(e,t,i){return r4[e](t,i)}static isHTMLEvent(e){return f0.includes(e)}static calcCurrentXY(e,t){const i=e.getBoundingClientRect();return{currentX:t.clientX-i.x,currentY:t.clientY-i.y}}},l4=class{constructor(){this.widgetListeners={},this.sourceListeners={}}initSourceHandler(e,t){this.sourceListeners??(this.sourceListeners={}),this.sourceListeners[e]=t}lazyGetWidgetListeners(e,t){var i;if(!(e in(this.sourceListeners??{}))){const s=o=>{const a=pr.alloc(e,o,t.getElement());this.dispatch(e,t,a)},n={};e.startsWith("touch")&&(n.passive=!1),this.initSourceHandler(e,s),t.getElement().addEventListener(e,s,n)}return this.widgetListeners??(this.widgetListeners={}),(i=this.widgetListeners)[e]??(i[e]=[]),this.widgetListeners[e]}add(e,t,i){this.lazyGetWidgetListeners(e,t).push(i)}remove(e,t,i){const s=this.lazyGetWidgetListeners(e,t),n=s.indexOf(i);n>-1&&s.splice(n,1)}destroy(e){if(this.widgetListeners=void 0,this.sourceListeners){for(const[t,i]of Tt(this.sourceListeners))e.getElement().removeEventListener(t,i);this.sourceListeners=void 0}}dispatch(e,t,i){for(const s of this.widgetListeners?.[e]??[])s(i,t)}},c4=class{constructor(e,t,i,s){this.glob=e,this.self=t,this.window=qe(),this.cleanup=new St,this.mousegeneral=l=>{l.stopPropagation(),l.stopImmediatePropagation()},this.mousemove=l=>{l.stopPropagation(),l.stopImmediatePropagation(),this.glob.globalMouseDragCallbacks?.mousemove(l)},this.mouseup=l=>{l.button===0&&(l.stopPropagation(),l.stopImmediatePropagation(),this.glob.globalMouseDragCallbacks?.mouseup(l),this.destroy())};const{window:n,mousegeneral:o,mousemove:a,mouseup:r}=this;this.cleanup.register(ht(n,"mousedown",o,{capture:!0}),ht(n,"mouseenter",o,{capture:!0}),ht(n,"mouseleave",o,{capture:!0}),ht(n,"mouseout",o,{capture:!0}),ht(n,"mouseover",o,{capture:!0}),ht(n,"mousemove",a,{capture:!0}),ht(n,"mouseup",r,{capture:!0})),t.mouseDragger=this,e.globalMouseDragCallbacks=i,e.globalMouseDragCallbacks.mousedown(s),s.stopPropagation(),s.stopImmediatePropagation()}destroy(){this.cleanup.flush(),this.glob.globalMouseDragCallbacks=void 0,this.self.mouseDragger=void 0}};function h4(e,t,i,s){if(e.globalMouseDragCallbacks==null)return new c4(e,t,i,s)}var d4=500,u4=100;function p4(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return i*i+s*s}var y0=!1,g4=class{constructor(e,t,i,s,n){this.glob=e,this.self=t,this.initialTouch=s,this.target=n,this.cleanup=new St,this.longTapInterrupted=!1,this.longtap=()=>{const{target:r,initialTouch:l}=this;if(!this.longTapInterrupted){const c=new St;r.dispatchEvent(new TouchEvent("touchcancel",{touches:[l],bubbles:!0})),y0=!0;const h=f=>f.preventDefault(),d=f=>{y0=!1,f.preventDefault(),c.flush()};c.register(ht(r,"touchmove",h,{passive:!1}),ht(r,"touchend",d,{passive:!1}),ht(r,"touchcancel",d,{passive:!1}));const{clientX:u,clientY:p}=l,g=new PointerEvent("contextmenu",{bubbles:!0,cancelable:!0,view:qe(),clientX:u,clientY:p,pointerType:"touch"});r.dispatchEvent(g)}},this.touchmove=r=>{const{glob:l,self:c,initialTouch:h}=this,d=this.findInitialFinger(r.targetTouches);d!=null&&(this.longTapInterrupted=this.longTapInterrupted||p4(h,d)>u4,c.dragTouchEnabled&&l.globalTouchDragCallbacks?.touchmove(r,d))},this.touchend=r=>{this.longTapInterrupted=!0;const l=this.findInitialFinger(r.changedTouches,r.touches);l!=null&&this.glob.globalTouchDragCallbacks?.touchend(r,l),this.destroy()},this.longtapTimer=setTimeout(this.longtap,d4);const{touchmove:o,touchend:a}=this;this.cleanup.register(ht(n,"touchmove",o,{passive:!1}),ht(n,"touchstart",a,{passive:!1}),ht(n,"touchend",a,{passive:!1}),ht(n,"touchcancel",a,{passive:!1})),t.touchDragger=this,e.globalTouchDragCallbacks=i}destroy(){clearTimeout(this.longtapTimer),this.cleanup.flush(),this.glob.globalTouchDragCallbacks=void 0,this.self.touchDragger=void 0}findInitialFinger(...e){const t=e.flatMap(i=>Array.from(i));return Array.from(t).find(i=>i.identifier===this.initialTouch.identifier)}};function f4(e,t,i,s,n){if(!(e.globalTouchDragCallbacks!=null||y0))return new g4(e,t,i,s,n)}function m0(e,t,i,s){const{currentX:n,currentY:o}=pr.calcCurrentXY(e.getElement(),s),a=s.pageX-i.pageX,r=s.pageY-i.pageY;return{type:t,device:"mouse",offsetX:i.offsetX+a,offsetY:i.offsetY+r,clientX:s.clientX,clientY:s.clientY,currentX:n,currentY:o,originDeltaX:a,originDeltaY:r,sourceEvent:s}}function y4(e,{pageX:t,pageY:i}){const{x:s,y:n}=e.getElement().getBoundingClientRect();return{offsetX:t-s,offsetY:i-n}}function x0(e,t,i,s,n){const{currentX:o,currentY:a}=pr.calcCurrentXY(e.getElement(),n),r=n.pageX-i.pageX,l=n.pageY-i.pageY;return{type:t,device:"touch",offsetX:i.offsetX+r,offsetY:i.offsetY+l,clientX:n.clientX,clientY:n.clientY,currentX:o,currentY:a,originDeltaX:r,originDeltaY:l,sourceEvent:s}}var aT={},rT=class{constructor(e){this.dispatchCallback=e,this.dragTouchEnabled=!0}destroy(){this.dragTriggerRemover?.(),this.dragTriggerRemover=void 0,this.listeners?.clear(),this.mouseDragger?.destroy(),this.touchDragger?.destroy()}getListenerSet(e){this.listeners??(this.listeners=new Map);let t=this.listeners.get(e);return t===void 0&&(t=new Set,this.listeners.set(e,t)),t}add(e,t,i){switch(this.getListenerSet(e).add(i),e){case"drag-start":case"drag-move":case"drag-end":{this.registerDragTrigger(t);break}}}remove(e,t,i){this.getListenerSet(e).delete(i)}registerDragTrigger(e){if(this.dragTriggerRemover==null){const t=e.getElement(),i=new St;i.register(ht(t,"mousedown",s=>this.triggerMouseDrag(e,s)),ht(t,"touchstart",s=>this.triggerTouchDrag(e,s),{passive:!1})),this.dragTriggerRemover=()=>i.flush()}}triggerMouseDrag(e,t){t.button===0&&this.startMouseDrag(e,t)}startMouseDrag(e,t){const i={pageX:Number.NaN,pageY:Number.NaN,offsetX:Number.NaN,offsetY:Number.NaN};e0(["pageX","pageY","offsetX","offsetY"],i,t);const s={mousedown:n=>{const o=m0(e,"drag-start",i,n);this.dispatch("drag-start",e,o)},mousemove:n=>{const o=m0(e,"drag-move",i,n);this.dispatch("drag-move",e,o)},mouseup:n=>{const o=m0(e,"drag-end",i,n);this.dispatch("drag-end",e,o),this.endDrag(e,o)}};this.mouseDragger=h4(aT,this,s,t)}endDrag(e,{sourceEvent:t,clientX:i,clientY:s}){const n=e.getElement(),o=n.getBoundingClientRect();WS(o,i,s)||(n.dispatchEvent(new MouseEvent("mouseleave",t)),t.target?.dispatchEvent(new MouseEvent("mouseenter",t)))}triggerTouchDrag(e,t){const i=t.targetTouches[0];t.targetTouches.length===1&&i!=null&&this.startOneFingerTouch(e,t,i)}startOneFingerTouch(e,t,i){const s={pageX:Number.NaN,pageY:Number.NaN,...y4(e,i)};e0(["pageX","pageY"],s,i);const n={touchmove:(r,l)=>{const c=x0(e,"drag-move",s,r,l);this.dispatch("drag-move",e,c)},touchend:(r,l)=>{const c=x0(e,"drag-end",s,r,l);this.dispatch("drag-end",e,c)}},o=e.getElement();this.touchDragger=f4(aT,this,n,i,o);const a=x0(e,"drag-start",s,t,i);this.dispatch("drag-start",e,a)}dispatch(e,t,i){for(const s of this.getListenerSet(e))s(i,t);this.dispatchCallback(e,i)}},m4=class{constructor(e){this.elem=e}setBounds(e){Gy(this.elemContainer??this.elem,e)}getBounds(){return tT(this.elemContainer??this.elem)}static setElementContainer(e,t){const i=e.getBounds();Gy(t,i),JG(e.elem,{width:"100%",height:"100%"}),e.elem.remove(),e.elemContainer=t,e.elemContainer.replaceChildren(e.elem)}},Na=class extends m4{constructor(){super(...arguments),this.index=Number.NaN,this.children=[]}set id(e){Ge(this.elem,"id",e)}get id(){return ad(this.elem,"id")}getElement(){return this.elem}getBoundingClientRect(){return this.elem.getBoundingClientRect()}get clientWidth(){return this.elem.clientWidth}get clientHeight(){return this.elem.clientHeight}destroy(){this.destroyListener?.(),this.destroyListener=void 0,this.remove();for(const e of this.children)e.parent=void 0,e.destroy();this.children.length=0,this.destructor(),this.remove(),this.internalListener?.destroy(),this.htmlListener?.destroy(this)}remove(){this.elem.remove(),this.elemContainer?.remove()}setHidden(e){La(this.elem,"display",e?"none":void 0)}isHidden(){return qe()?.getComputedStyle?.(this.elem).display==="none"}setCursor(e){La(this.elem,"cursor",e)}setTextContent(e){this.elem.textContent=e??null}setAriaDescribedBy(e){Ge(this.elem,"aria-describedby",e)}setAriaHidden(e){Ge(this.elem,"aria-hidden",e)}setAriaLabel(e){Ge(this.elem,"aria-label",e)}setAriaExpanded(e){Ge(this.elem,"aria-expanded",e)}setAriaControls(e){Ge(this.elem,"aria-controls",e)}setAriaHasPopup(e){Ge(this.elem,"aria-haspopup",e)}setInnerHTML(e){this.elem.innerHTML=e}setPointerEvents(e){La(this.elem,"pointer-events",e)}setCSSVariable(e,t){this.elem.style.setProperty(e,t)}isDisabled(){return ad(this.elem,"aria-disabled",!1)}hasPopup(){const e=ad(this.elem,"aria-haspopup");return e!==void 0&&e!=="false"}parseFloat(e){return e===""?0:Number.parseFloat(e)}cssLeft(){return this.parseFloat(this.elem.style.left)}cssTop(){return this.parseFloat(this.elem.style.top)}cssWidth(){return this.parseFloat(this.elem.style.width)}cssHeight(){return this.parseFloat(this.elem.style.height)}focus(e){this.elem.focus(e)}setFocusOverride(e){Ge(this.elem,"data-focus-override",e)}setPreventsDefault(e){Ge(this.elem,"data-preventdefault",e)}setTabIndex(e){Ge(this.elem,"tabindex",e)}addChild(e){this.addChildToDOM(e,this.getBefore(e)),this.children.push(e),e.index=this.children.length-1,e.parent=this,this.onChildAdded(e)}removeChild(e){const t=this.children.indexOf(e);this.children.splice(t,1),this.removeChildFromDOM(e),this.onChildRemoved(e)}moveChild(e,t){e.domIndex!==t&&(e.domIndex=t,this.removeChildFromDOM(e),this.addChildToDOM(e,this.getBefore(e)))}addClass(...e){this.elem.classList.add(...e)}removeClass(...e){this.elem.classList.remove(...e)}toggleClass(e,t){this.elem.classList.toggle(e,t)}appendOrInsert(e,t){t?t.getElement().insertAdjacentElement("beforebegin",e):this.elem.appendChild(e)}addChildToDOM(e,t){this.appendOrInsert(e.getElement(),t)}removeChildFromDOM(e){e.getElement().remove()}onChildAdded(e){}onChildRemoved(e){}getBefore({domIndex:e}){if(e!==void 0)return this.children.filter(t=>t.domIndex!==void 0&&t.domIndex>e).reduce((t,i)=>!t||i.domIndexthis.removeListener(e,t)}removeListener(e,t){pr.isHTMLEvent(e)?this.htmlListener?.remove(e,this,t):this.htmlListener!=null&&this.internalListener?.remove(e,this,t)}setDragTouchEnabled(e){this.internalListener??(this.internalListener=new rT(this.onDispatch.bind(this))),this.internalListener.dragTouchEnabled=e}onDispatch(e,t){if(!t.sourceEvent?.bubbles)return;let{parent:i}=this;for(;i!=null;){const{internalListener:s}=i;if(s!=null){const n={...t,...pr.calcCurrentXY(i.getElement(),t)};s.dispatch(e,i,n)}i=i.parent}}static addWindowEvent(e,t){const i=s=>{s.persisted||t()};return ht(qe(),"pagehide",i)}},x4=class{constructor(){this.stats=new Map,this.lastLogTime=Date.now(),this.LOG_INTERVAL_MS=1e4,this.startPeriodicLogging()}startPeriodicLogging(){Pe.check("scene:stats","scene:stats:verbose")&&(this.stopPeriodicLogging(),this.intervalId=setInterval(()=>{this.logAccumulatedStats()},this.LOG_INTERVAL_MS))}stopPeriodicLogging(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0)}recordTiming(e,t){const i=this.stats.get(e);i?(i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.sum+=t,i.count+=1):this.stats.set(e,{min:t,max:t,sum:t,count:1})}recordTimings(e){for(const[t,i]of Object.entries(e))t!=="start"&&typeof i=="number"&&this.recordTiming(t,i)}logAccumulatedStats(){if(this.stats.size===0)return;const e=(Date.now()-this.lastLogTime)/1e3,t=Array.from(this.stats.keys()).sort((o,a)=>o==="\u23F1\uFE0F"?-1:a==="\u23F1\uFE0F"?1:o.localeCompare(a)),i=[];for(const o of t){const a=this.stats.get(o),r=a.sum/a.count;i.push(`${o}[${a.min.toFixed(1)}/${r.toFixed(1)}/${a.max.toFixed(1)}]ms`)}const n=this.stats.get("\u23F1\uFE0F")?.count??0;K.log(`\u{1F4CA} Stats (${e.toFixed(0)}s, ${n} renders): ${i.join(" ")}`),this.stats.clear(),this.lastLogTime=Date.now()}destroy(){this.stopPeriodicLogging(),this.stats.clear()}},bd,Ec=0;function b4(){return bd??(bd=new x4),bd}function v4(){Ec++;let e=!1;return()=>{e||Ec===0||(e=!0,Ec--,Ec===0&&dT())}}function S4(e){for(const t of["B","KB","MB","GB"]){if(e<1536)return`${e.toFixed(1)}${t}`;e/=1024}return`${e.toFixed(1)}TB}`}function M4(){if(!("memory"in performance))return;const{totalJSHeapSize:e,usedJSHeapSize:t,jsHeapSizeLimit:i}=performance.memory,s=[];for(const n of[t,e,i])typeof n=="number"&&s.push(S4(n));return`Heap ${s.join(" / ")}`}function lT(e,t,i,s,n={},o=de.zero){if(!Pe.check("scene:stats","scene:stats:verbose"))return;const{layersRendered:a=0,layersSkipped:r=0,nodesRendered:l=0,nodesSkipped:c=0,opsPerformed:h=0,opsSkipped:d=0}=s??{},u=performance.now(),{start:p,...g}=t,f=u-p,x=b4();x.recordTimings(g),x.recordTiming("\u23F1\uFE0F",f);const m=Object.entries(g).map(([N,O])=>hT(N,O)).filter(N=>N!=null).join(" + "),v=Object.entries(n).map(([N,O])=>`${N}: ${JSON.stringify(O)}`).join(" ; "),b=Pe.check("scene:stats:verbose"),S=b?M4():null,D=[`${hT("\u23F1\uFE0F",p,u)} (${m})`,`${v}`,`Layers: ${b?b0(a,r):e.size}`,b?`Nodes: ${b0(l,c)}`:null,b?`Ops: ${b0(h,d)}`:null,S].filter(Qt),L=new yL(i),I=new Map(D.map(N=>[N,L.measureText(N)])),A=Math.max(...Array.from(I.values(),N=>N.width)),T=L4(I.values(),N=>N.height),w=2+o.x;i.save();try{i.fillStyle="white",i.fillRect(w,0,A,T),i.fillStyle="black";let N=0;for(const[O,P]of I.entries())N+=P.height,i.fillText(O,w,N)}catch(N){K.warnOnce("Error during debug stats rendering",N)}finally{i.restore()}}function D4(e){const t=xy(qe("agChartsSceneDebug")),i=[];for(const s of t)s==="layout"?i.push("seriesRoot","legend","root",/.*Axis-\d+-axis.*/):i.push(s);e.debugNodeSearch=i}function k4(e,t){e.save();try{for(const[i,s]of Object.entries(t)){const n=zt.toCanvas(s);if(!n){K.log(`Scene.render() - no bbox for debugged node [${i}].`);continue}e.globalAlpha=.8,e.strokeStyle="red",e.lineWidth=1,e.strokeRect(n.x,n.y,n.width,n.height),e.fillStyle="red",e.strokeStyle="white",e.font="16px sans-serif",e.textBaseline="top",e.textAlign="left",e.lineWidth=2,e.strokeText(i,n.x,n.y,n.width),e.fillText(i,n.x,n.y,n.width)}}catch(i){K.warnOnce("Error during debug rendering",i)}finally{e.restore()}}var I4=new Set,A4=new Set(["gradient","zIndex","clipRect","cachedBBox","childNodeCounts","path","__zIndex","name","__scalingCenterX","__scalingCenterY","__rotationCenterX","__rotationCenterY","_previousDatum","__fill","__lineDash","borderPath","borderClipPath","_clipPath"]);function C4(e){const{...t}=e;for(const i of Object.keys(t))A4.has(i)||typeof t[i]!="number"&&typeof t[i]!="string"&&typeof t[i]!="boolean"&&(I4.add(i),delete t[i]);return t}function $y(e,t){if(!Pe.check(!0,"scene"))return{};let i=0;return{node:t==="json"?C4(e):e,name:e.name??e.id,dirty:e instanceof Be?e.dirty:void 0,...Array.from(e instanceof Be?e.children():[],s=>$y(s,t)).reduce((s,n)=>{let{name:o}=n;const{node:{visible:a,opacity:r,zIndex:l,translationX:c,translationY:h,rotation:d,scalingX:u,scalingY:p},node:g}=n;(!a||r<=0)&&(o=`(${o})`),Be.is(g)&&g.renderToOffscreenCanvas&&(o=`*${o}*`);const f=Array.isArray(l)?`(${l.join(", ")})`:l,x=[`${(i++).toString().padStart(3,"0")}|`,`${o??""}`,`z: ${f}`,c&&`x: ${c}`,h&&`y: ${h}`,d&&`r: ${d}`,u!=null&&u!==1&&`sx: ${u}`,p!=null&&p!==1&&`sy: ${p}`].filter(b=>!!b).join(" ");let m=x,v=1;for(;s[m]!=null&&v<100;)m=`${x} (${v++})`;return s[m]=n,s},{})}}function cT(e){const t=e instanceof Be?e.dirty:void 0;if(!t)return{dirtyTree:{},paths:[]};const i=Array.from(e instanceof Be?e.children():[],o=>cT(o)).filter(o=>o.paths.length>0),s=Be.is(e)?e.name??e.id:e.id,n=i.length?i.flatMap(o=>o.paths).map(o=>`${s}.${o}`):[s];return{dirtyTree:{name:s,node:e,dirty:t,...i.map(o=>o.dirtyTree).filter(o=>o.dirty!=null).reduce((o,a)=>(o[a.name??""]=a,o),{})},paths:n}}function b0(e,t){const i=e+t;return`${e} / ${i} (${Math.round(100*e/i)}%)`}function hT(e,t,i){const s=i==null?t:i-t;return`${e}: ${Math.round(s*100)/100}ms`}function L4(e,t){let i=0;for(const s of e)i+=t(s);return i}function dT(e=!1){if(!bd){e&&(Ec=0);return}!e&&Ec>0||(bd.destroy(),bd=void 0,e&&(Ec=0))}var Tp=(e,{x0:t,y0:i,x1:s,y1:n,cx:o,cy:a},r,l)=>{if(l&&e.moveTo(t,i),t!==s||i!==n){const c=Math.atan2(i-a,t-o),h=Math.atan2(n-a,s-o);e.arc(o,a,r,c,h)}else e.lineTo(t,i)},Hi=class extends ti{constructor(){super(...arguments),this.path=new gd,this._clipX=Number.NaN,this._clipY=Number.NaN,this.clip=!1,this._dirtyPath=!0,this.lastPixelRatio=Number.NaN}set clipX(e){this._clipX=e,this.dirtyPath=!0}set clipY(e){this._clipY=e,this.dirtyPath=!0}set dirtyPath(e){this._dirtyPath!==e&&(this._dirtyPath=e,e&&this.markDirty("path"))}get dirtyPath(){return this._dirtyPath}checkPathDirty(){this._dirtyPath||(this.dirtyPath=this.path.isDirty()||(this.fillShadow?.isDirty()??!1)||(this._clipPath?.isDirty()??!1))}resetPathDirty(){this.path.clear(!0),this._dirtyPath=!1}isPathDirty(){return this.path.isDirty()}onChangeDetection(e){this._dirtyPath||(this._dirtyPath=!0,super.onChangeDetection(e))}computeBBox(){return this.updatePathIfDirty(),this.path.computeBBox()}isPointInPath(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)}distanceSquared(e,t){return this.distanceSquaredTransformedPoint(e,t)}svgPathData(e){return this.updatePathIfDirty(),this.path.toSVG(e)}distanceSquaredTransformedPoint(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)?0:this.path.distanceSquared(e,t)}isDirtyPath(){return!1}updatePath(){}updatePathIfDirty(){(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1)}preRender(e){return e.devicePixelRatio!==this.lastPixelRatio&&(this.dirtyPath=!0),this.lastPixelRatio=e.devicePixelRatio,this.updatePathIfDirty(),super.preRender(e,this.path.commands.length)}render(e){const{ctx:t}=e;if(this.clip&&!Number.isNaN(this._clipX)&&!Number.isNaN(this._clipY)){t.save();try{const i=this.strokeWidth/2;this._clipPath??(this._clipPath=new gd),this._clipPath.clear(),this._clipPath.rect(-i,-i,this._clipX+i,this._clipY+i+i),t.clip(this._clipPath?.getPath2D()),this._clipX>0&&this._clipY>0&&this.drawPath(t)}finally{t.restore()}}else this._clipPath=void 0,this.drawPath(t);this.fillShadow?.markClean(),super.render(e)}drawPath(e){this.fillStroke(e,this.path.getPath2D())}toSVG(){if(!this.visible)return;const e=Xt("path");e.setAttribute("d",this.svgPathData());const t=this.applySvgFillAttributes(e,[]);return this.applySvgStrokeAttributes(e),{elements:[e],defs:t}}};Hi.className="Path",M([ne()],Hi.prototype,"clip",2),M([ne()],Hi.prototype,"clipX",1),M([ne()],Hi.prototype,"clipY",1);var Uy=(e,t,i,s,n)=>{let o=!1,a=!1,r=s-Math.sqrt(Math.max(n**2-i**2,0)),l=0,c=0,h=i-Math.sqrt(Math.max(n**2-s**2,0));return r>e?(o=!0,r=e,l=i-Math.sqrt(Math.max(n**2-(s-e)**2))):Qe(r,0)&&(r=0),h>t?(a=!0,c=s-Math.sqrt(Math.max(n**2-(i-t)**2)),h=t):Qe(h,0)&&(h=0),{leading0:r,leading1:l,trailing0:c,trailing1:h,leadingClipped:o,trailingClipped:a}},Ky=(e,t,i,s,n,o,a)=>{let{topLeft:r,topRight:l,bottomRight:c,bottomLeft:h}=o;const d=Math.max(r+h,l+c),u=Math.max(r+l,h+c);if(d<=0&&u<=0){if(a==null)e.rect(t,i,s,n);else{const I=Math.max(t,a.x),A=Math.min(t+s,a.x+a.width),T=Math.max(i,a.y),w=Math.min(i+n,a.y+a.height);e.rect(I,T,A-I,w-T)}return}else if(a==null&&r===l&&r===c&&r===h){e.roundRect(t,i,s,n,r);return}if(s<0&&(t+=s,s=Math.abs(s)),n<0&&(i+=n,n=Math.abs(n)),s<=0||n<=0)return;if(a==null)a=new de(t,i,s,n);else{const I=Math.max(t,a.x),A=Math.min(t+s,a.x+a.width),T=Math.max(i,a.y),w=Math.min(i+n,a.y+a.height);a=new de(I,T,A-I,w-T)}const p=Math.max(d/n,u/s,1);p>1&&(r/=p,l/=p,c/=p,h/=p);let g=!0,f=!0,x=!0,m=!0,v,b,S,D;if(g){const I=Uy(a.height,a.width,Math.max(t+r-a.x,0),Math.max(i+r-a.y,0),r);I.leadingClipped&&(m=!1),I.trailingClipped&&(f=!1);const A=Math.max(a.x+I.leading1,a.x),T=Math.max(a.y+I.leading0,a.y),w=Math.max(a.x+I.trailing1,a.x),N=Math.max(a.y+I.trailing0,a.y),O=t+r,P=i+r;v={x0:A,y0:T,x1:w,y1:N,cx:O,cy:P}}if(f){const I=Uy(a.width,a.height,Math.max(i+l-a.y,0),Math.max(a.x+a.width-(t+s-l),0),l);I.leadingClipped&&(g=!1),I.trailingClipped&&(x=!1);const A=Math.min(a.x+a.width-I.leading0,a.x+a.width),T=Math.max(a.y+I.leading1,a.y),w=Math.min(a.x+a.width-I.trailing0,a.x+a.width),N=Math.max(a.y+I.trailing1,a.y),O=t+s-l,P=i+l;b={x0:A,y0:T,x1:w,y1:N,cx:O,cy:P}}if(x){const I=Uy(a.height,a.width,Math.max(a.x+a.width-(t+s-c),0),Math.max(a.y+a.height-(i+n-c),0),c);I.leadingClipped&&(f=!1),I.trailingClipped&&(m=!1);const A=Math.min(a.x+a.width-I.leading1,a.x+a.width),T=Math.min(a.y+a.height-I.leading0,a.y+a.height),w=Math.min(a.x+a.width-I.trailing1,a.x+a.width),N=Math.min(a.y+a.height-I.trailing0,a.y+a.height),O=t+s-c,P=i+n-c;S={x0:A,y0:T,x1:w,y1:N,cx:O,cy:P}}if(m){const I=Uy(a.width,a.height,Math.max(a.y+a.height-(i+n-h),0),Math.max(t+h-a.x,0),h);I.leadingClipped&&(x=!1),I.trailingClipped&&(g=!1);const A=Math.max(a.x+I.leading0,a.x),T=Math.min(a.y+a.height-I.leading1,a.y+a.height),w=Math.max(a.x+I.trailing0,a.x),N=Math.min(a.y+a.height-I.trailing1,a.y+a.height),O=t+h,P=i+n-h;D={x0:A,y0:T,x1:w,y1:N,cx:O,cy:P}}let L=!1;g&&v!=null&&(Tp(e,v,r,!L),L||(L=!0)),f&&b!=null&&(Tp(e,b,l,!L),L||(L=!0)),x&&S!=null&&(Tp(e,S,c,!L),L||(L=!0)),m&&D!=null&&Tp(e,D,h,!L),e.closePath()},Li=class extends Hi{constructor(){super(...arguments),this.borderPath=new gd,this.x=0,this.y=0,this.width=10,this.height=10,this.topLeftCornerRadius=0,this.topRightCornerRadius=0,this.bottomRightCornerRadius=0,this.bottomLeftCornerRadius=0,this.clipBBox=void 0,this.crisp=!1,this.lastUpdatePathStrokeWidth=this.strokeWidth,this.effectiveStrokeWidth=this.strokeWidth,this.hittester=super.isPointInPath.bind(this),this.distanceCalculator=super.distanceSquaredTransformedPoint.bind(this),this.microPixelEffectOpacity=1}set cornerRadius(e){this.topLeftCornerRadius=e,this.topRightCornerRadius=e,this.bottomRightCornerRadius=e,this.bottomLeftCornerRadius=e}isDirtyPath(){return this.lastUpdatePathStrokeWidth!==this.strokeWidth||!!(this.path.isDirty()||this.borderPath.isDirty())}updatePath(){const{path:e,borderPath:t,crisp:i,topLeftCornerRadius:s,topRightCornerRadius:n,bottomRightCornerRadius:o,bottomLeftCornerRadius:a}=this;let{x:r,y:l,width:c,height:h,strokeWidth:d,clipBBox:u}=this;const g=1/(this.layerManager?.canvas.pixelRatio??1);let f=1;if(e.clear(!0),t.clear(!0),c===0||h===0){this.effectiveStrokeWidth=0,this.lastUpdatePathStrokeWidth=0,this.microPixelEffectOpacity=0;return}if(i&&(c<=g&&(f*=c/g),h<=g&&(f*=h/g),c=this.align(r,c),h=this.align(l,h),r=this.align(r),l=this.align(l),u=u==null?void 0:new de(this.align(u.x),this.align(u.y),this.align(u.x,u.width),this.align(u.y,u.height))),d)if(c0?s-d:0,topRight:n>0?n-d:0,bottomRight:o>0?o-d:0,bottomLeft:a>0?a-d:0};this.borderClipPath=void 0,c>0&&h>0&&(m==null||m?.width>0&&m?.height>0)&&(Ky(e,r,l,c,h,v,m),Ky(t,r,l,c,h,v,m))}else this.borderClipPath=this.borderClipPath??new gd,this.borderClipPath.clear(!0),this.borderClipPath.rect(r,l,c,h),t.rect(r,l,c,h);else{const x={topLeft:s,topRight:n,bottomRight:o,bottomLeft:a};this.borderClipPath=void 0,Ky(e,r,l,c,h,x,u)}if([s,n,o,a].every(x=>x===0)){const x=this.getBBox();this.hittester=x.containsPoint.bind(x),this.distanceSquared=(m,v)=>this.getBBox().distanceSquared(m,v)}else this.hittester=super.isPointInPath,this.distanceCalculator=super.distanceSquaredTransformedPoint;this.effectiveStrokeWidth=d,this.lastUpdatePathStrokeWidth=d,this.microPixelEffectOpacity=f}computeBBox(){const{x:e,y:t,width:i,height:s,clipBBox:n}=this;return n?.clone()??new de(e,t,i,s)}isPointInPath(e,t){return this.hittester(e,t)}get midPoint(){return{x:this.x+this.width/2,y:this.y+this.height/2}}distanceSquared(e,t){return this.distanceCalculator(e,t)}applyFillAndAlpha(e){super.applyFillAndAlpha(e),e.globalAlpha*=this.microPixelEffectOpacity}applyStrokeAndAlpha(e){super.applyStrokeAndAlpha(e),e.globalAlpha*=this.microPixelEffectOpacity}renderStroke(e){const{stroke:t,effectiveStrokeWidth:i}=this;if(t&&i){const{globalAlpha:s}=e,{lineDash:n,lineDashOffset:o,lineCap:a,lineJoin:r,borderPath:l,borderClipPath:c}=this;c&&e.clip(c.getPath2D()),this.applyStrokeAndAlpha(e),e.lineWidth=i,n&&e.setLineDash(n),o&&(e.lineDashOffset=o),a&&(e.lineCap=a),r&&(e.lineJoin=r),e.stroke(l.getPath2D()),e.globalAlpha=s}}};Li.className="Rect",M([ne()],Li.prototype,"x",2),M([ne()],Li.prototype,"y",2),M([ne()],Li.prototype,"width",2),M([ne()],Li.prototype,"height",2),M([ne()],Li.prototype,"topLeftCornerRadius",2),M([ne()],Li.prototype,"topRightCornerRadius",2),M([ne()],Li.prototype,"bottomRightCornerRadius",2),M([ne()],Li.prototype,"bottomLeftCornerRadius",2),M([En({equals:$S})],Li.prototype,"clipBBox",2),M([ne()],Li.prototype,"crisp",2);var gn=class _o extends ti{constructor(t){super(t),this.x=0,this.y=0,this.lines=[],this.text=void 0,this.fontCache=void 0,this.fontSize=_o.defaultFontSize,this.fontFamily="sans-serif",this.textAlign="start",this.textBaseline="alphabetic",this.boxPadding=0,this.trimText=t?.trimText??!0}onTextChange(){if(this.richText?.clear(),this.textMap?.clear(),Ne(this.text))this.lines=[],this.richText??(this.richText=new Be),this.richText.setScene(this.scene),this.richText.append(this.text.flatMap(t=>Qt(t.text)?t.text.split(ld):String(t.text)).filter(Boolean).map(()=>new _o({trimText:!1})));else{const t=this.text?.split(` +`)??[];this.lines=this.trimText?t.map(i=>i.trim()):t}}get font(){return this.fontCache??(this.fontCache=pL(this)),this.fontCache}static measureBBox(t,i,s,n){if(Ne(t)){const{font:o,lineHeight:a,textAlign:r,textBaseline:l}=n,{width:c,height:h,lineMetrics:d}=On(t,o),u=a?a*d.length:h,p=_o.calcTopOffset(u,d[0],l),g=_o.calcLeftOffset(c,r);return new de(i-g,s-p,c,u)}else return _o.computeBBox(t?.split(ld),i,s,n)}static computeBBox(t,i,s,n){const{font:o,lineHeight:a,textAlign:r,textBaseline:l}=n,{width:c,height:h,lineMetrics:d}=Je(o).measureLines(t),u=a?a*d.length:h,p=_o.calcTopOffset(u,d[0],l),g=_o.calcLeftOffset(c,r);return new de(i-g,s-p,c,u)}static calcTopOffset(t,i,s){switch(s){case"alphabetic":return i?.ascent??0;case"middle":return t/2;case"bottom":return t;default:return 0}}static calcLeftOffset(t,i){let s=0;switch(i){case"center":s=.5;break;case"right":case"end":s=1}return t*s}computeBBox(){if(this.generateTextMap(),this.textMap?.size){const r=de.merge(this.textMap.values());return r.x=this.x-_o.calcLeftOffset(r.width,this.textAlign),r.y=this.y,r}const{x:t,y:i,lines:s,textBaseline:n,textAlign:o}=this,a=_o.computeBBox(s,t,i,{font:this,textBaseline:n,textAlign:o});return this.boxing!=null&&a.grow(this.boxPadding),a}getTextMeasureBBox(){return this.computeBBox()}getPlainText(){return $e(this.text)}isPointInPath(t,i){return this.getBBox()?.containsPoint(t,i)??!1}setScene(t){this.richText?.setScene(t),super.setScene(t)}generateTextMap(){if(!Ne(this.text)||this.textMap?.size)return;this.textMap??(this.textMap=new Map);let t=0;const i=this.richText.children();for(const{width:s,height:n,ascent:o,segments:a}of On(this.text,this).lineMetrics){let r=0;for(const{color:l,textMetrics:c,...h}of a){const d=i.next().value;d.x=this.x-s/2+r,d.y=o+t,d.setProperties({...h,fill:l??this.fill});const u=d.getBBox();this.textMap.set(d,u),r+=c.width}t+=n}}render(t){const{ctx:i,stats:s}=t;if(!this.text||!this.layerManager)return s&&(s.nodesSkipped+=1),super.render(t);if(Ne(this.text)&&this.richText){this.generateTextMap();const n=this.richText.getBBox(),{width:o,height:a,lineMetrics:r}=On(this.text,this);let l=0;switch(this.textAlign){case"left":case"start":l=o/2;break;case"right":case"end":l=o/-2}let c=this.y;switch(this.textBaseline){case"alphabetic":c-=r[0]?.ascent??0;break;case"middle":c-=r.length===1?r[0].ascent+r[0].segments.reduce((h,d)=>Math.min(h,Je(d).baselineDistance("middle")),0):a/2;break;case"bottom":c-=a;break}this.renderBoxing(t,n.clone().translate(l,c)),i.save(),i.translate(l,c),this.richText.opacity=this.opacity,this.richText.render(t),i.restore()}else this.renderText(t);if(_o.debug.check()&&!this.textMap?.size){const n=this.getBBox();i.strokeStyle="red",i.lineWidth=1,i.strokeRect(n.x,n.y,n.width,n.height)}super.render(t)}markDirty(t){return this.textMap?.clear(),super.markDirty(t)}renderText(t){const{fill:i,stroke:s,strokeWidth:n,font:o,textAlign:a}=this;if(!i&&!(s&&n)||!this.layerManager)return super.render(t);const{ctx:r}=t;r.font!==o&&(r.font=o),r.textAlign=a,this.renderBoxing(t),this.fillStroke(r)}renderBoxing(t,i){if(!this.boxing)return;const s=i??_o.computeBBox(this.lines,this.x,this.y,this);if(s.width===0||s.height===0)return;const{x:n,y:o,width:a,height:r}=s.grow(this.boxPadding);this.boxing.opacity=this.opacity,this.boxing.x=n,this.boxing.y=o,this.boxing.width=a,this.boxing.height=r,this.boxing.preRender(t),this.boxing.render(t)}executeFill(t){this.renderLines((i,s,n)=>t.fillText(i,s,n))}executeStroke(t){this.renderLines((i,s,n)=>t.strokeText(i,s,n))}renderLines(t){const{x:i,y:s,lines:n}=this;if(!Number.isFinite(i)||!Number.isFinite(s))return;const o=Je(this),{lineMetrics:a}=o.measureLines(n),{textBaseline:r,lineHeight:l=o.lineHeight()}=this;let c=0;r==="top"?c=a[0].ascent:(r==="middle"||r==="bottom")&&(c=l*(1-n.length),r==="middle"?(c/=2,c-=o.baselineDistance(r)):c-=a[0].descent);for(const h of a)t(h.text,i,s+c),c+=l}setFont(t){this.fontFamily=t.fontFamily,this.fontSize=t.fontSize,this.fontStyle=t.fontStyle,this.fontWeight=t.fontWeight}setAlign(t){this.textAlign=t.textAlign,this.textBaseline=t.textBaseline}setBoxing(t){const i=t.border?.enabled?t.border?.stroke:void 0;t.fill!=null||i!=null?(this.boxing??(this.boxing=new Li({scene:this.scene})),this.boxing.fill=t.fill,this.boxing.fillOpacity=t.fillOpacity??1,this.boxing.cornerRadius=t.cornerRadius??0,this.boxing.stroke=i,this.boxing.strokeWidth=t.border?.strokeWidth??0,this.boxing.strokeOpacity=t.border?.strokeOpacity??1,this.boxPadding=t.padding??0):this.boxing&&(this.boxing.destroy(),this.boxing=void 0)}getBoxingProperties(){const{fill:t,fillOpacity:i,cornerRadius:s,stroke:n,strokeWidth:o,strokeOpacity:a}=this.boxing??{};return{border:{enabled:n!=null,stroke:n,strokeWidth:o,strokeOpacity:a},cornerRadius:s,fill:t,fillOpacity:i,padding:this.boxPadding}}toSVG(){if(!this.visible||!this.text)return;const t=Xt("text");if(Qt(this.text))this.applySvgFillAttributes(t),ZL(t,this),t.setAttribute("text-anchor",{center:"middle",left:"start",right:"end",start:"start",end:"end"}[this.textAlign??"start"]),t.setAttribute("alignment-baseline",this.textBaseline),t.setAttribute("x",String(this.x)),t.setAttribute("y",String(this.y)),t.textContent=this.text;else for(const i of this.text){const s=Xt("tspan");ZL(s,{fontSize:i.fontSize??this.fontSize,fontFamily:i.fontFamily??this.fontFamily,fontWeight:i.fontWeight??this.fontWeight,fontStyle:i.fontStyle??this.fontStyle}),this.applySvgFillAttributes(s),s.textContent=i.text,t.append(s)}return{elements:[t]}}};gn.className="Text",gn.debug=Pe.create(!0,"scene:text"),gn.defaultFontSize=10,M([ne()],gn.prototype,"x",2),M([ne()],gn.prototype,"y",2),M([Ey({changeCb:e=>e.onTextChange()})],gn.prototype,"text",2),M([ne({changeCb:e=>{e.fontCache=void 0}})],gn.prototype,"fontStyle",2),M([ne({changeCb:e=>{e.fontCache=void 0}})],gn.prototype,"fontWeight",2),M([ne({changeCb:e=>{e.fontCache=void 0}})],gn.prototype,"fontSize",2),M([ne({changeCb:e=>{e.fontCache=void 0}})],gn.prototype,"fontFamily",2),M([ne()],gn.prototype,"textAlign",2),M([ne()],gn.prototype,"textBaseline",2),M([ne()],gn.prototype,"lineHeight",2);var Pn=gn,uT=class extends fd(Pn){},vd=class extends fd(yd(Pn)){},pT={};Tn(pT,{BASE_FONT_SIZE:()=>gr,CARTESIAN_AXIS_TYPE:()=>fT,CARTESIAN_POSITION:()=>gT,FONT_SIZE:()=>v0,FONT_SIZE_RATIO:()=>Ko,POLAR_AXIS_SHAPE:()=>mT,POLAR_AXIS_TYPE:()=>yT});var v0=(e=>(e[e.SMALLEST=8]="SMALLEST",e[e.SMALLER=10]="SMALLER",e[e.SMALL=12]="SMALL",e[e.MEDIUM=13]="MEDIUM",e[e.LARGE=14]="LARGE",e[e.LARGEST=17]="LARGEST",e))(v0||{}),gr=12,Ko={SMALLEST:8/gr,SMALLER:10/gr,SMALL:12/gr,MEDIUM:13/gr,LARGE:14/gr,LARGEST:17/gr},gT=(e=>(e.TOP="top",e.TOP_RIGHT="top-right",e.TOP_LEFT="top-left",e.RIGHT="right",e.RIGHT_TOP="right-top",e.RIGHT_BOTTOM="right-bottom",e.BOTTOM="bottom",e.BOTTOM_RIGHT="bottom-right",e.BOTTOM_LEFT="bottom-left",e.LEFT="left",e.LEFT_TOP="left-top",e.LEFT_BOTTOM="left-bottom",e))(gT||{}),fT=(e=>(e.CATEGORY="category",e.GROUPED_CATEGORY="grouped-category",e.ORDINAL_TIME="ordinal-time",e.UNIT_TIME="unit-time",e.TIME="time",e.NUMBER="number",e.LOG="log",e))(fT||{}),yT=(e=>(e.ANGLE_CATEGORY="angle-category",e.ANGLE_NUMBER="angle-number",e.RADIUS_CATEGORY="radius-category",e.RADIUS_NUMBER="radius-number",e))(yT||{}),mT=(e=>(e.CIRCLE="circle",e.POLYGON="polygon",e))(mT||{}),wt=class extends Le{constructor(){super(...arguments),this.id=hs(this),this.node=new uT({zIndex:1}).setProperties({textAlign:"center",pointerEvents:1}),this.enabled=!1,this.textAlign="center",this.fontSize=10,this.fontFamily="sans-serif",this.wrapping="always",this.padding=0,this.layoutStyle="block",this.truncated=!1}registerInteraction(e,t){return e.eventsHub.on("layout:complete",()=>this.updateA11yText(e,t))}computeTextWrap(e,t){const{text:i,padding:s,wrapping:n}=this,o=Math.min(this.maxWidth??1/0,e)-s*2,a=this.maxHeight??t-s*2,r={maxWidth:o,maxHeight:a,font:this,textWrap:n};if(!Number.isFinite(o)&&!Number.isFinite(a)){this.node.text=i;return}let l;Ne(i)?(l=xL(i,r),this.truncated=l.some(fL)):(l=cl(i??"",r),this.truncated=xp(l)),this.node.text=l}updateA11yText(e,t){const{proxyInteractionService:i}=e;if(this.enabled&&this.text){const s=zt.toCanvas(this.node);if(s){const{id:n}=this;this.proxyText??(this.proxyText=i.createProxyElement({type:"text",domManagerId:n,where:t})),this.proxyText.textContent=$e(this.text),this.proxyText.setBounds(s),this.proxyText.addListener("mousemove",o=>this.handleMouseMove(e,o)),this.proxyText.addListener("mouseleave",o=>this.handleMouseLeave(e,o))}}else this.proxyText?.destroy(),this.proxyText=void 0}handleMouseMove(e,t){if(t!=null&&this.enabled&&this.truncated){const{x:i,y:s}=zt.toCanvas(this.node),n=t.sourceEvent.offsetX+i,o=t.sourceEvent.offsetY+s;e.tooltipManager.updateTooltip(this.id,{canvasX:n,canvasY:o,showArrow:!1},[{type:"structured",title:$e(this.text)}])}}handleMouseLeave(e,t){e.tooltipManager.removeTooltip(this.id)}};wt.SMALL_PADDING=10,M([C,ii("node","visible")],wt.prototype,"enabled",2),M([C,ii("node")],wt.prototype,"text",2),M([C,ii("node")],wt.prototype,"textAlign",2),M([C,ii("node")],wt.prototype,"fontStyle",2),M([C,ii("node")],wt.prototype,"fontWeight",2),M([C,ii("node")],wt.prototype,"fontSize",2),M([C,ii("node")],wt.prototype,"fontFamily",2),M([C,ii("node","fill")],wt.prototype,"color",2),M([C],wt.prototype,"spacing",2),M([C],wt.prototype,"maxWidth",2),M([C],wt.prototype,"maxHeight",2),M([C],wt.prototype,"wrapping",2),M([C],wt.prototype,"padding",2),M([C],wt.prototype,"layoutStyle",2);var Yy=(e=>(e.X="x",e.Y="y",e.Angle="angle",e.Radius="radius",e))(Yy||{});function T4(e){switch(e){case"x":case"y":case"angle":case"radius":return!0;default:return!1}}var Zy=class{constructor(){this.title=new wt,this.subtitle=new wt,this.footnote=new wt}positionCaptions(e){const{title:t,subtitle:i,footnote:s}=this,n=e.layoutBox.height/10;t.enabled&&(this.positionCaption("top",t,e.layoutBox,n),this.shrinkLayoutByCaption("top",t,e.layoutBox)),i.enabled&&(this.positionCaption("top",i,e.layoutBox,n),this.shrinkLayoutByCaption("top",i,e.layoutBox)),s.enabled&&(this.positionCaption("bottom",s,e.layoutBox,n),this.shrinkLayoutByCaption("bottom",s,e.layoutBox))}positionAbsoluteCaptions(e){const{title:t,subtitle:i,footnote:s}=this,{rect:n}=e.series;for(const o of[t,i,s])if(o.layoutStyle==="overlay"){if(o.textAlign==="left")o.node.x=n.x+o.padding;else if(o.textAlign==="right"){const a=o.node.getBBox();o.node.x=n.x+n.width-a.width-o.padding}}}computeX(e,t){return e==="left"?t.x:e==="right"?t.x+t.width:t.x+t.width/2}positionCaption(e,t,i,s){if(!t.text)return;const{lineMetrics:n}=Ne(t.text)?On(t.text,t):Je(t).measureLines(t.text),o=Math.max(n[0].height,s);t.node.x=this.computeX(t.textAlign,i)+t.padding,t.node.y=i.y+(e==="top"?0:i.height)+t.padding,t.node.textBaseline=e,t.computeTextWrap(i.width,o)}shrinkLayoutByCaption(e,t,i){if(t.layoutStyle==="block"){const s=t.node.getBBox().clone(),{spacing:n=0}=t;e==="bottom"&&Ne(t.text)&&(s.y-=s.height),i.shrink(Math.ceil(e==="top"?s.y-i.y+s.height+n:i.y+i.height-s.y+n),e)}}};M([C],Zy.prototype,"title",2),M([C],Zy.prototype,"subtitle",2),M([C],Zy.prototype,"footnote",2);var w4=["candlestick","hollow-candlestick","ohlc","line","step-line","hlc","high-low"],N4=class{constructor(e){this.chartService=e,this.mementoOriginatorKey="chartType"}createMemento(){let e=this.chartService.publicApi?.getOptions()?.chartType;return e??(e="candlestick"),e}guardMemento(e){return e==null||w4.includes(e)}restoreMemento(e,t,i){if(i==null)return;const s={chartType:i};this.chartService.publicApi?.updateDelta(s).catch(n=>K.error("error restoring state",n))}},fr="12.3.1",xT=Symbol("previous-memento-not-found"),O4=class{constructor(e){this.history=[],this.historyIndex=-1,this.originators=new Map,this.clearState=new Map,this.maxHistoryLength=100,this.debug=Pe.create(!0,"history"),this.cleanup=new St,this.cleanup.register(e.on("series:undo",this.undo.bind(this)),e.on("series:redo",this.redo.bind(this)))}destroy(){this.cleanup.flush()}addMementoOriginator(e){this.originators.set(e.mementoOriginatorKey,e),this.clearState.set(e.mementoOriginatorKey,e.createMemento()),this.debugEvent("History add originator:",e.mementoOriginatorKey)}clear(){this.debug("History clear:",Object.keys(this.originators)),this.history=[],this.historyIndex=-1;for(const[e,t]of this.originators.entries())this.clearState.set(e,t.createMemento())}record(e,...t){this.historyIndexthis.maxHistoryLength&&(this.history=this.history.slice(-this.maxHistoryLength));const i=new Map;for(const s of t){if(!this.originators.has(s.mementoOriginatorKey))throw new Error(`Originator [${s.mementoOriginatorKey}] has not been added to the HistoryManager.`);i.set(s.mementoOriginatorKey,s.createMemento())}this.history.push({label:e,mementos:i}),this.historyIndex=this.history.length-1,this.debugEvent(`History record: [${e}]`)}undo(){const e=this.history[this.historyIndex];if(e){for(const t of e.mementos.keys()){const i=this.findPreviousMemento(t);if(i===xT)throw new Error(`Could not find previous memento for [${t}].`);this.restoreMemento(t,i)}this.historyIndex-=1,this.debugEvent(`History undo: [${e.label}]`)}}redo(){const e=this.history[this.historyIndex+1];if(e){for(const[t,i]of e.mementos.entries())this.restoreMemento(t,i);this.historyIndex+=1,this.debugEvent(`History redo: [${e.label}]`)}}findPreviousMemento(e){for(let t=this.historyIndex-1;t>=0;t--)if(this.history[t].mementos.has(e))return this.history[t].mementos.get(e);return this.clearState.has(e)?this.clearState.get(e):xT}restoreMemento(e,t){this.originators.get(e)?.restoreMemento(fr,fr,t)}debugEvent(...e){this.debug(...e,this.history.map((t,i)=>i===this.historyIndex?`** ${t.label} **`:t.label))}},bT=class DC{constructor(t){this.version=t.split("-")[0]}save(...t){const i={version:this.version};for(const s of Object.values(t))i[s.mementoOriginatorKey]=this.encode(s,s.createMemento());return i}restore(t,...i){if(typeof t!="object"){K.warnOnce(`Could not restore data of type [${typeof t}], expecting an object, ignoring.`);return}if(t==null){K.warnOnce("Could not restore data of type [null], expecting an object, ignoring.");return}if(!("version"in t)||typeof t.version!="string"){K.warnOnce("Could not restore data, missing [version] string in object, ignoring.");return}for(const s of i){const n=this.decode(s,t[s.mementoOriginatorKey]),o=[];if(!s.guardMemento(n,o)){const a=o.length>0?` + +${o.join(` + +`)} + +`:"";K.warnOnce(`Could not restore [${s.mementoOriginatorKey}] data, value was invalid, ignoring.${a}`,n);return}s.restoreMemento(this.version,t.version,n)}}encode(t,i){try{return JSON.parse(JSON.stringify(i,DC.encodeTypes))}catch(s){throw new Error(`Failed to encode [${t.mementoOriginatorKey}] value [${s}].`,{cause:s})}}decode(t,i){if(i==null)return i;try{return JSON.parse(JSON.stringify(i),DC.decodeTypes)}catch(s){throw new Error(`Failed to decode [${t.mementoOriginatorKey}] value [${s}].`,{cause:s})}}static encodeTypes(t,i){return jo(this[t])?{__type:"date",value:this[t].toISOString()}:i}static decodeTypes(t,i){return Ee(this[t])&&"__type"in this[t]&&this[t].__type==="date"?new Date(this[t].value):i}},E4=class{constructor(){this.caretaker=new bT(fr),this.state=new Map}setState(e,t){Ci(this.state.get(e.mementoOriginatorKey),t)||this.setStateAndRestore(e,t)}setStateAndRestore(e,t){this.state.set(e.mementoOriginatorKey,t),this.restoreState(e)}restoreState(e){const{caretaker:t,state:i}=this;if(!i.has(e.mementoOriginatorKey))return;const s=i.get(e.mementoOriginatorKey);t.restore({version:t.version,[e.mementoOriginatorKey]:s},e)}},P4=`.ag-charts-wrapper,.ag-charts-wrapper:after,.ag-charts-wrapper:before,.ag-charts-wrapper *,.ag-charts-wrapper *:after,.ag-charts-wrapper *:before{box-sizing:border-box}.ag-charts-wrapper{--align-items: center;--justify-content: center;position:relative;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.ag-charts-wrapper--safe-horizontal{--justify-content: flex-start}.ag-charts-wrapper--safe-vertical{--align-items: flex-start}.ag-charts-tab-guard{width:0%;height:0%;position:absolute;pointer-events:none}.ag-charts-canvas-center{width:100%;height:100%;position:absolute;touch-action:auto;pointer-events:auto;display:flex;align-items:var(--align-items);justify-content:var(--justify-content)}.ag-charts-canvas-container,.ag-charts-canvas{position:relative;user-select:none;-webkit-user-select:none}.ag-charts-canvas-container>*,.ag-charts-canvas>*{pointer-events:none}.ag-charts-canvas canvas{display:block}.ag-charts-series-area{outline:none;pointer-events:auto;position:absolute}.ag-charts-swapchain{top:0;left:0;outline:none;opacity:0;pointer-events:none;position:absolute;width:100%;height:100%}.ag-charts-swapchain:focus-visible{opacity:1}.ag-charts-canvas-proxy,.ag-charts-canvas-overlay{inset:0;pointer-events:none;position:absolute;user-select:none;-webkit-user-select:none}.ag-charts-canvas-overlay>*{position:absolute;pointer-events:auto}.ag-charts-theme-default,.ag-charts-theme-default-dark{--ag-charts-accent-color: #2196f3;--ag-charts-background-color: #fff;--ag-charts-border-color: #dddddd;--ag-charts-border-radius: 4px;--ag-charts-chart-background-color: #fff;--ag-charts-chart-padding: 20px;--ag-charts-focus-shadow: 0 0 0 3px #2196f3;--ag-charts-foreground-color: #181d1f;--ag-charts-font-family: Verdana, sans-serif;--ag-charts-font-size: 12px;--ag-charts-font-weight: 400;--ag-charts-popup-shadow: 0 0 16px rgba(0, 0, 0, .15);--ag-charts-subtle-text-color: #8c8c8c;--ag-charts-text-color: #181d1f;--ag-charts-chrome-background-color: #fafafa;--ag-charts-chrome-font-family: Verdana, sans-serif;--ag-charts-chrome-font-size: 12px;--ag-charts-chrome-font-weight: 400;--ag-charts-chrome-subtle-text-color: #8c8c8c;--ag-charts-chrome-text-color: #181d1f;--ag-charts-button-background-color: #fff;--ag-charts-button-border: 1px solid #dddddd;--ag-charts-button-font-weight: normal;--ag-charts-button-text-color: inherit;--ag-charts-input-background-color: #fff;--ag-charts-input-border: 1px solid #dddddd;--ag-charts-input-text-color: #181d1f;--ag-charts-menu-background-color: #fafafa;--ag-charts-menu-border: 1px solid #dddddd;--ag-charts-menu-text-color: #181d1f;--ag-charts-panel-background-color: #fafafa;--ag-charts-panel-text-color: #181d1f;--ag-charts-tooltip-background-color: #fafafa;--ag-charts-tooltip-border: 1px solid #dddddd;--ag-charts-tooltip-text-color: #181d1f;--ag-charts-tooltip-subtle-text-color: #8c8c8c;--ag-charts-crosshair-label-background-color: #fafafa;--ag-charts-crosshair-label-text-color: #181d1f;--ag-charts-spacing: 4px;--ag-charts-icon-size: 16px;--ag-charts-focus-color: color-mix(in srgb, var(--ag-charts-background-color), var(--ag-charts-accent-color) 12%);--ag-charts-input-border-radius: var(--ag-charts-border-radius);--ag-charts-input-focus-border-color: var(--ag-charts-accent-color);--ag-charts-input-focus-text-color: var(--ag-charts-accent-color);--ag-charts-input-disabled-background-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-foreground-color) 6% );--ag-charts-input-disabled-border-color: var(--ag-charts-border-color);--ag-charts-input-disabled-text-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-input-text-color) 50% );--ag-charts-input-placeholder-text-color: color-mix( in srgb, var(--ag-charts-input-background-color), var(--ag-charts-input-text-color) 60% );--ag-charts-button-border-radius: var(--ag-charts-border-radius);--ag-charts-button-focus-background-color: color-mix( in srgb, var(--ag-charts-button-background-color), var(--ag-charts-accent-color) 12% );--ag-charts-button-focus-border-color: var(--ag-charts-accent-color);--ag-charts-button-focus-text-color: var(--ag-charts-accent-color);--ag-charts-button-disabled-background-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-foreground-color) 6% );--ag-charts-button-disabled-border-color: var(--ag-charts-border-color);--ag-charts-button-disabled-text-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-chrome-text-color) 50% );--ag-charts-checkbox-background-color: color-mix( in srgb, var(--ag-charts-background-color), var(--ag-charts-foreground-color) 35% );--ag-charts-checkbox-checked-background-color: var(--ag-charts-accent-color);--ag-charts-tooltip-border-radius: var(--ag-charts-border-radius);--ag-charts-menu-border-radius: var(--ag-charts-border-radius);--ag-charts-chrome-font-size-small: var(--ag-charts-chrome-font-size);--ag-charts-chrome-font-size-medium: calc(var(--ag-charts-chrome-font-size) * (13 / 12));--ag-charts-chrome-font-size-large: calc(var(--ag-charts-chrome-font-size) * (14 / 12));--ag-charts-border: 1px solid var(--ag-charts-border-color);--ag-charts-focus-border: 1px solid var(--ag-charts-accent-color);--ag-charts-focus-border-shadow: 0 0 0 3px color-mix(in srgb, transparent, var(--ag-charts-accent-color) 20%);--ag-charts-layer-menu: 6;--ag-charts-layer-ui-overlay: 5;--ag-charts-layer-tooltip: 4;--ag-charts-layer-toolbar: 3;--ag-charts-layer-crosshair: 2;--ag-charts-layer-annotations: 1}.ag-charts-theme-default-dark{--ag-charts-focus-color: color-mix(in srgb, var(--ag-charts-background-color), var(--ag-charts-accent-color) 22%)}.ag-chart-canvas-wrapper .ag-charts-theme-default{--ag-charts-border-radius: var(--ag-border-radius, 4px);--ag-charts-border: var(--ag-borders-critical, solid 1px) var(--ag-charts-border-color);--ag-charts-focus-shadow: var(--ag-focus-shadow, 0 0 0 3px var(--ag-charts-accent-color));--ag-charts-focus-border-shadow: var( --ag-focus-shadow, 0 0 0 3px color-mix(in srgb, transparent, var(--ag-charts-accent-color) 20%) )}.ag-charts-icon{display:block;width:20px;height:20px;speak:none;speak:never;mask:var(--icon) center / contain no-repeat;background-color:currentColor;transition:background-color .25s ease-in-out}.ag-charts-icon-align-center{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNNyAxMGg2djFIN3pNNCA3aDEydjFINHptMSA2aDEwdjFINXoiLz48L3N2Zz4=)}.ag-charts-icon-align-left{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNNCAxMGg2djFINHptMC0zaDEydjFINHptMCA2aDEwdjFINHoiLz48L3N2Zz4=)}.ag-charts-icon-align-right{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTAgMTBoNnYxaC02ek00IDdoMTJ2MUg0em0yIDZoMTB2MUg2eiIvPjwvc3ZnPg==)}.ag-charts-icon-arrow-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1LjI5MyA0LjVIMTIuNXYtMUgxN3Y0aC0xVjUuMjA3bC05LjY0NiA5LjY0Ny0uNzA4LS43MDh6IiBmaWxsPSIjMDAwIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03IDE2YTIuNSAyLjUgMCAxIDEtNSAwIDIuNSAyLjUgMCAwIDEgNSAwbS0yLjUgMS41YTEuNSAxLjUgMCAxIDAgMC0zIDEuNSAxLjUgMCAwIDAgMCAzIiBmaWxsPSIjMDAwIi8+PC9zdmc+)}.ag-charts-icon-arrow-down-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02IDhMMS41IDhMMTAgMThMMTguNSA4TDE0IDhMMTQgM0w2IDNMNiA4Wk03IDRMNyA5SDMuNjYyNDRMMTAgMTYuNDU2TDE2LjMzNzYgOUwxMyA5TDEzIDRMNyA0WiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-arrow-up-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNCAxMkgxOC41TDEwIDJMMS41IDEySDZMNi4wMDAwMiAxN0gxNFYxMlpNMTMgMTZWMTFIMTYuMzM3NkwxMCAzLjU0NDA1TDMuNjYyNDQgMTFIN0w3LjAwMDAyIDE2SDEzWiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-callout-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMyA0LjVBMS41IDEuNSAwIDAgMSA0LjUgM2gxMUExLjUgMS41IDAgMCAxIDE3IDQuNXY4YTEuNSAxLjUgMCAwIDEtMS41IDEuNWgtNC41MTRhMjYgMjYgMCAwIDAtMi4wMTcgMS41NGwtLjMxNC4yNmMtLjU1LjQ1Ny0xLjExNS45MjYtMS43NiAxLjQtLjY2OS40OTEtMS41NjItLjAxMi0xLjU2Mi0uOFYxNEg0LjVBMS41IDEuNSAwIDAgMSAzIDEyLjV6TTQuNSA0YS41LjUgMCAwIDAtLjUuNXY4YS41LjUgMCAwIDAgLjUuNWgxLjgzM3YzLjM3MmEzNiAzNiAwIDAgMCAxLjY3OC0xLjMzOGwuMzItLjI2NWEyNiAyNiAwIDAgMSAyLjIyNS0xLjY4NWwuMTI2LS4wODRIMTUuNWEuNS41IDAgMCAwIC41LS41di04YS41LjUgMCAwIDAtLjUtLjV6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-candlestick-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNyAxdjNoMnYxMkg3djNINnYtM0g0VjRoMlYxek01IDVoM3YxMEg1ek0xMSAxNFY2aDJWMy4yNWgxVjZoMnY4aC0ydjIuNzVoLTFWMTR6bTEtN2gzdjZoLTN6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-close{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNSA1IDEwIDEwTTUgMTUgMTUgNSIgc3Ryb2tlPSIjMDAwIi8+PC9zdmc+)}.ag-charts-icon-comment-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNy41MTMgMy45OTVhNi41IDYuNSAwIDAgMSA2LjA5OCAxMS40MWMtLjU4OC4zOTMtMS4yMTcuNTM2LTEuODI5LjU4NWExMyAxMyAwIDAgMS0xLjI3LjAxN0EyNyAyNyAwIDAgMCAxMCAxNkg0LjVhLjUuNSAwIDAgMS0uNS0uNVYxMHEwLS4yNDctLjAwNy0uNTEzYy0uMDA4LS40MTYtLjAxNi0uODU3LjAxNy0xLjI2OS4wNS0uNjEyLjE5Mi0xLjI0LjU4NS0xLjgzYTYuNSA2LjUgMCAwIDEgMi45MTgtMi4zOTNtMy41Ni42MWE1LjUgNS41IDAgMCAwLTUuNjQ2IDIuMzRjLS4yNjYuMzk3LS4zNzkuODQyLS40MiAxLjM1NC0uMDMuMzYtLjAyMi43MTgtLjAxNSAxLjEwOFE1IDkuNjg5IDUgMTB2NWg1cS4zMTEuMDAxLjU5My4wMDhjLjM5LjAwNy43NDcuMDE1IDEuMTA4LS4wMTUuNTEyLS4wNDEuOTU3LS4xNTQgMS4zNTUtLjQyYTUuNSA1LjUgMCAwIDAtMS45ODMtOS45NjciIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-crosshair-add-line{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTEwIDUuNWEuNS41IDAgMCAxIC41LjV2My41aDMuODc1YS41LjUgMCAwIDEgMCAxSDEwLjV2NC4yNWEuNS41IDAgMSAxLTEgMFYxMC41SDUuNjI1YS41LjUgMCAxIDEgMC0xSDkuNVY2YS41LjUgMCAwIDEgLjUtLjUiLz48L3N2Zz4=)}.ag-charts-icon-date-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMiAyaDF2MTZIMnptMTUgMGgxdjE2aC0xeiIgZmlsbD0iIzE4MUQxRiIvPjxwYXRoIGQ9Ik0xMy4xNTcgMTFINXYtMWg3Ljc5M0wxMSA4LjIwN2wuNzA3LS43MDcgMy4xODIgMy4xODItMy4xODIgMy4xODItLjcwNy0uNzA3eiIgZmlsbD0iIzAwMCIvPjwvc3ZnPg==)}.ag-charts-icon-date-price-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMyAySDJ2MTZoMXptMy41MDcgNC44OUw4LjUgNC44OTVWMTBINXYxaDMuNXY3aDF2LTdoNS4wODhsLTEuOTU3IDEuOTU3LjcwNy43MDcgMy4xODItMy4xODJMMTMuMzM4IDcuM2wtLjcwNy43MDdMMTQuNjI0IDEwSDkuNVY0LjkzMmwxLjk1NyAxLjk1Ny43MDctLjcwN0w4Ljk4MiAzIDUuOCA2LjE4MnoiIGZpbGw9IiMxODFEMUYiLz48L3N2Zz4=)}.ag-charts-icon-delete{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZD0iTTguNDk2IDguOTk2QS41LjUgMCAwIDEgOSA5LjQ5MnY0YS41LjUgMCAxIDEtMSAuMDA4di00YS41LjUgMCAwIDEgLjQ5Ni0uNTA0TTEyIDkuNWEuNS41IDAgMCAwLTEgMHY0YS41LjUgMCAwIDAgMSAweiIvPjxwYXRoIGZpbGw9IiMxMzE3MjIiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTYgNVYzLjVBMi41IDIuNSAwIDAgMSA4LjUgMWgzQTIuNSAyLjUgMCAwIDEgMTQgMy41VjVoMi44MzNhLjUuNSAwIDAgMSAwIDFIMTV2MTAuMjVjMCAuNDE1LS4wNjYuODYzLS4zIDEuMjIxLS4yNTcuMzk0LS42NzIuNjEyLTEuMi42MTJoLTdjLS41MjggMC0uOTQzLS4yMTgtMS4yLS42MTItLjIzNC0uMzU4LS4zLS44MDYtLjMtMS4yMjFWNkgzLjMzM2EuNS41IDAgMCAxIDAtMXptMS0xLjVBMS41IDEuNSAwIDAgMSA4LjUgMmgzQTEuNSAxLjUgMCAwIDEgMTMgMy41VjVIN3pNNiAxNi4yNVY2aDh2MTAuMjVjMCAuMzM1LS4wNTkuNTU0LS4xMzguNjc1LS4wNTUuMDg1LS4xNC4xNTgtLjM2Mi4xNThoLTdjLS4yMjIgMC0uMzA3LS4wNzMtLjM2Mi0uMTU4LS4wOC0uMTIxLS4xMzgtLjM0LS4xMzgtLjY3NSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-disjoint-channel,.ag-charts-icon-disjoint-channel-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTkuMDI4IDE3LjQ2YTIuMjUgMi4yNSAwIDAgMC00LjA5Mi0xLjg1bC05LjUxMS0yLjM3OGEyLjI1IDIuMjUgMCAxIDAtLjIyNS45NzRsOS40NzUgMi4zNjlhMi4yNTEgMi4yNTEgMCAwIDAgNC4zNTMuODg2bS0xLjY2Mi0xLjk2NWExLjI1IDEuMjUgMCAxIDEtLjg4NSAyLjMzOCAxLjI1IDEuMjUgMCAwIDEgLjg4NS0yLjMzOE00LjM0MyAxMy42NjlhMS4yNSAxLjI1IDAgMSAwLTIuMzM4LS44ODUgMS4yNSAxLjI1IDAgMCAwIDIuMzM4Ljg4NU0zLjk3IDguNzY5YTIuMjUgMi4yNSAwIDAgMCAxLjQ1NS0yLjExbDkuNTExLTIuMzc4YTIuMjUgMi4yNSAwIDEgMC0uMjYtLjk2NUw1LjIgNS42ODVhMi4yNSAyLjI1IDAgMSAwLTEuMjMgMy4wODRtLjM3My0yLjU0N2ExLjI1IDEuMjUgMCAxIDEtMi4zMzguODg1IDEuMjUgMS4yNSAwIDAgMSAyLjMzOC0uODg1bTEzLjc1LTMuNDM4YTEuMjUgMS4yNSAwIDEgMS0yLjMzOC44ODUgMS4yNSAxLjI1IDAgMCAxIDIuMzM4LS44ODUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-drag-handle{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSI1Ljc1IiBjeT0iNy43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjcuNzUiIHI9Ii43NSIgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuNSIvPjxjaXJjbGUgY3g9IjEzLjc1IiBjeT0iNy43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iMTMuNzUiIGN5PSIxMS43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjExLjc1IiByPSIuNzUiIGZpbGw9IiMwMDAiIGZpbGwtb3BhY2l0eT0iLjUiLz48Y2lyY2xlIGN4PSI1Ljc1IiBjeT0iMTEuNzUiIHI9Ii43NSIgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuNSIvPjwvc3ZnPg==)}.ag-charts-icon-fibonacci-retracement-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA1aDEydjFIMnoiLz48Y2lyY2xlIGN4PSIxNS43NSIgY3k9IjUuNSIgcj0iMS43NSIgc3Ryb2tlPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC4yNSIgY3k9IjE0LjUiIHI9IjEuNzUiIHN0cm9rZT0iIzAwMCIvPjxwYXRoIGZpbGw9IiMwMDAiIGQ9Ik0xOCAxNUg2di0xaDEyem0wLTQuNUgydi0xaDE2eiIvPjwvc3ZnPg==)}.ag-charts-icon-fibonacci-retracement-trend-based-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJtNC45OTYgMTIuNjc0IDMuMjkxLTUuNzQzLjg2OC40OTctMy4yOTEgNS43NDN6Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjUuNSIgcj0iMS43NSIgc3Ryb2tlPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC4zNTEiIGN5PSIxNC41IiByPSIxLjc1IiBzdHJva2U9IiMwMDAiLz48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTggNmgtN1Y1aDd6bTAgNC41aC03di0xaDd6bTAgNC41SDZ2LTFoMTJ6Ii8+PC9zdmc+)}.ag-charts-icon-fill-color{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtOC4wNzEgNC4wNi0uOTI0LS45MjQuNzA3LS43MDcgNy4yODggNy4yODgtNC45NSA0Ljk1YTMuNSAzLjUgMCAwIDEtNC45NSAwbC0xLjQxNC0xLjQxNGEzLjUgMy41IDAgMCAxIDAtNC45NXptLjcwNy43MDhMNC41MzYgOS4wMWEyLjUgMi41IDAgMCAwIDAgMy41MzZMNS45NSAxMy45NmEyLjUgMi41IDAgMCAwIDMuNTM1IDBsNC4yNDMtNC4yNDN6bTYuOSA3LjIwMi0uMzQ1LjM2My0uMzQ0LS4zNjNhLjUuNSAwIDAgMSAuNjg4IDBtLS4zNDUgMS4wOGE4IDggMCAwIDAtLjI4LjMyMyA0LjMgNC4zIDAgMCAwLS40MDkuNTgyYy0uMTEzLjIwMS0uMTQ0LjMyNi0uMTQ0LjM3OGEuODMzLjgzMyAwIDAgMCAxLjY2NyAwYzAtLjA1Mi0uMDMxLS4xNzctLjE0NC0uMzc4YTQuMyA0LjMgMCAwIDAtLjQxLS41ODIgOCA4IDAgMCAwLS4yOC0uMzIybS0uMzQ0LTEuMDguMzQ0LjM2My4zNDQtLjM2My4wMDIuMDAyLjAwNC4wMDQuMDEzLjAxMmE2IDYgMCAwIDEgLjIwNi4yMDhjLjEzMS4xMzYuMzA4LjMyNy40ODUuNTQ1LjE3Ni4yMTUuMzYzLjQ2Ny41MDcuNzI0LjEzNy4yNDMuMjczLjU1My4yNzMuODY4YTEuODMzIDEuODMzIDAgMSAxLTMuNjY3IDBjMC0uMzE1LjEzNi0uNjI1LjI3My0uODY4LjE0NC0uMjU3LjMzLS41MDkuNTA3LS43MjRhOSA5IDAgMCAxIC42NDUtLjcwOGwuMDQ2LS4wNDUuMDEzLS4wMTIuMDA0LS4wMDR6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-hollow-candlestick-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1vcGFjaXR5PSIuMTUiIGQ9Ik01IDVoM3YxMEg1eiIvPjxwYXRoIGZpbGw9IiMxMzE3MjIiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTcgMXYzaDJ2MTJIN3YzSDZ2LTNINFY0aDJWMXpNNSA1aDN2MTBINXptNyAyaDN2NmgtM3ptLTEgN1Y2aDJWMy4yNWgxVjZoMnY4aC0ydjIuNzVoLTFWMTR6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-horizontal-line,.ag-charts-icon-horizontal-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNLjUgOS41aDcuMzA2YTIuMjUgMi4yNSAwIDAgMSA0LjM4OCAwSDE5LjV2MWgtNy4zMDZhMi4yNSAyLjI1IDAgMCAxLTQuMzg4IDBILjV6bTkuNSAxLjc1YTEuMjUgMS4yNSAwIDEgMCAwLTIuNSAxLjI1IDEuMjUgMCAwIDAgMCAyLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-line-color{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTQuMjQyIDIuNzIyYy0uNjEyIDAtMS4yLjI0My0xLjYzMi42NzVsLTEuMzQzIDEuMzQ0YS41LjUgMCAwIDAtLjExMi4xMTJMNC4wNSAxMS45NTljLS4yMDcuMjA3LS4zNi40Ni0uNDQ2Ljc0di4wMDFsLS42OSAyLjc2N3YuMDAyYS44Mi44MiAwIDAgMCAxLjAyMiAxLjAyMWguMDAybDIuNjM0LS44MjJjLjI4LS4wODUuNTM0LS4yMzcuNzQtLjQ0M2w3LjEwNy03LjEwOGEuNS41IDAgMCAwIC4xMTItLjExMmwxLjM0My0xLjM0M2EyLjMwOCAyLjMwOCAwIDAgMC0xLjYzMi0zLjk0TTE0LjEyMiA3bDEuMDQ0LTEuMDQ1YTEuMzA4IDEuMzA4IDAgMSAwLTEuODQ5LTEuODVMMTIuMjcxIDUuMTV6bS0yLjU1OC0xLjE0Mi02LjgwNyA2LjgwOWEuOC44IDAgMCAwLS4xOTYuMzI1bC0uNzUgMi40NjggMi40Ny0uNzQ5YS44LjggMCAwIDAgLjMyNS0uMTk0bDYuODA4LTYuODF6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-line-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTcuMzYyIDQuODczLTQuNTk0IDYuNjU0LTQuODUtMy4zMTctNC4yNTEgNi45NzctLjg1NC0uNTJMNy42MTIgNi43OWw0Ljg5OSAzLjM1IDQuMDI4LTUuODM2eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-line-style-dashed{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA5aDR2MUgyem0xMiAwaDR2MWgtNHpNOCA5aDR2MUg4eiIvPjwvc3ZnPg==)}.ag-charts-icon-line-style-dotted{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSIyLjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC41IiBjeT0iOS41IiByPSIuNSIgZmlsbD0iIzAwMCIvPjxjaXJjbGUgY3g9IjYuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48Y2lyY2xlIGN4PSI4LjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iMTAuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48Y2lyY2xlIGN4PSIxMi41IiBjeT0iOS41IiByPSIuNSIgZmlsbD0iIzAwMCIvPjxjaXJjbGUgY3g9IjE0LjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iMTYuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48L3N2Zz4=)}.ag-charts-icon-line-style-solid{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA5aDE2djFIMnoiLz48L3N2Zz4=)}.ag-charts-icon-line-with-markers-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTguMTk4IDQuODg4LTMuNTU2IDQuOTE4YTIuMjUgMi4yNSAwIDEgMS0zLjg2Ni43NWwtMS40MzItLjlhMi4yNCAyLjI0IDAgMCAxLTIuMDA5LjQzNWwtMy44MjggNi40MjgtLjg2LS41MTJMNi40NSA5LjYyM2EyLjI1IDIuMjUgMCAxIDEgMy41MS0uNzYxbDEuMzI5LjgzNWEyLjI0IDIuMjQgMCAwIDEgMi41NTctLjQ5N2wzLjU0Mi00Ljg5OHptLTQuOTYgNS4xNTNhMS4yNSAxLjI1IDAgMSAwLS42NCAyLjQxOSAxLjI1IDEuMjUgMCAwIDAgLjY0LTIuNDE5TTkuMSA4LjMyMXEuMDY2LS4xOTIuMDY3LS40MDRhMS4yNSAxLjI1IDAgMSAwLS4wNjcuNDA0IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-lock,.ag-charts-icon-locked{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuMjA3IDMuNzY0YTIuODk0IDIuODk0IDAgMCAwLTIuODk1IDIuODk0VjloNS43ODlWNi42NThhMi44OTQgMi44OTQgMCAwIDAtMi44OTUtMi44OTRNMTQuMSA5VjYuNjU4YTMuODk0IDMuODk0IDAgMSAwLTcuNzg5IDB2Mi4zNDlBMi41IDIuNSAwIDAgMCA0IDExLjV2M0EyLjUgMi41IDAgMCAwIDYuNSAxN2g4YTIuNSAyLjUgMCAwIDAgMi41LTIuNXYtM0EyLjUgMi41IDAgMCAwIDE0LjUgOXpNNi41IDEwQTEuNSAxLjUgMCAwIDAgNSAxMS41djNBMS41IDEuNSAwIDAgMCA2LjUgMTZoOGExLjUgMS41IDAgMCAwIDEuNS0xLjV2LTNhMS41IDEuNSAwIDAgMC0xLjUtMS41eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-measurer-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibTQuNDYxIDEyLjcxIDEuNTMyLTEuNTMxIDEuNDE0IDEuNDE0LjcwNy0uNzA3TDYuNyAxMC40NzJsMS41MzItMS41MzMgMiAyIC43MDctLjcwNy0yLTIgNi4wMS02LjAxIDIuODMgMi44MjhMNS4wNSAxNy43NzggMi4yMjIgMTQuOTVsMS41MzItMS41MzIgMS40MTQgMS40MTQuNzA3LS43MDd6TS44MDggMTQuOTVsLjcwNy0uNzA3TDE0LjI0MyAxLjUxNWwuNzA3LS43MDcuNzA3LjcwNyAyLjgyOCAyLjgyOC43MDcuNzA3LS43MDcuNzA3TDUuNzU3IDE4LjQ4NWwtLjcwNy43MDctLjcwNy0uNzA3LTIuODI4LTIuODI4em0xMS4wNzgtNi44MzVMMTAuNDcgNi43bC43MDctLjcwNyAxLjQxNSAxLjQxNHptLjgyNC0zLjY1NCAxIDEgLjcwOC0uNzA3LTEtMXoiIGZpbGw9IiMxODFEMUYiLz48L3N2Zz4=)}.ag-charts-icon-note-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMyA0LjVBMS41IDEuNSAwIDAgMSA0LjUgM2gxMUExLjUgMS41IDAgMCAxIDE3IDQuNXY4YTEuNSAxLjUgMCAwIDEtMS41IDEuNWgtMy4yMWwtMS40NjkgMi41N2ExIDEgMCAwIDEtMS42ODIuMDg1TDcuMjQzIDE0SDQuNUExLjUgMS41IDAgMCAxIDMgMTIuNXpNNC41IDRhLjUuNSAwIDAgMC0uNS41djhhLjUuNSAwIDAgMCAuNS41aDMuMjU3bDIuMTk2IDMuMDc0TDExLjcxIDEzaDMuNzlhLjUuNSAwIDAgMCAuNS0uNXYtOGEuNS41IDAgMCAwLS41LS41eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi41IDYuNUEuNS41IDAgMCAxIDcgNmg2YS41LjUgMCAwIDEgMCAxSDdhLjUuNSAwIDAgMS0uNS0uNU02LjUgOS41QS41LjUgMCAwIDEgNyA5aDZhLjUuNSAwIDAgMSAwIDFIN2EuNS41IDAgMCAxLS41LS41IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-ohlc-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZD0iTTEzIDExaC0zdi0xaDNWM2gxdjJoNHYxaC00djExaC0xek02IDE3di0yaDN2LTFINlY0SDV2MUgydjFoM3YxMXoiLz48L3N2Zz4=)}.ag-charts-icon-pan-end{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0ibTYuNjQ2IDEzLjgxMy0uMzUzLjM1NC43MDcuNzA3LjM1NC0uMzU0ek0xMS4xNjYgMTBsLjM1NC4zNTQuMzU0LS4zNTQtLjM1NC0uMzU0ek03LjM1NSA1LjQ4IDcgNS4xMjZsLS43MDcuNzA3LjM1My4zNTR6bTAgOS4wNCA0LjE2Ni00LjE2Ni0uNzA3LS43MDgtNC4xNjcgNC4xNjd6bTQuMTY2LTQuODc0TDcuMzU0IDUuNDhsLS43MDguNzA3IDQuMTY3IDQuMTY3ek0xMy4wODMgNXYxMGgxVjV6Ii8+PC9zdmc+)}.ag-charts-icon-pan-left{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTIuNzkgNS44MzMgOC42MjUgMTBsNC4xNjYgNC4xNjctLjcwNy43MDdMNy4yMSAxMGw0Ljg3My00Ljg3NHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-pan-right{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNy4yMSAxNC4xNjcgMTEuMzc2IDEwIDcuMjEgNS44MzNsLjcwNy0uNzA3TDEyLjc5IDEwbC00Ljg3MyA0Ljg3NHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-pan-start{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTYgNXYxMGgxVjV6TTkuNjI0IDEwbDQuMTY2LTQuMTY3LS43MDctLjcwN0w4LjIxIDEwbDQuODc0IDQuODc0LjcwNy0uNzA3eiIvPjwvc3ZnPg==)}.ag-charts-icon-parallel-channel,.ag-charts-icon-parallel-channel-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTcuNzIgNS4zMzFBMi4yNSAyLjI1IDAgMSAwIDE0LjcwNSAzLjZsLTkuNDkgNC41NjJhMi4yNSAyLjI1IDAgMSAwIC4yMDkgMS4wMWw5LjY2Mi00LjY0NmEyLjI1IDIuMjUgMCAwIDAgMi42MzQuODA1bS4zNzMtMi41NDdhMS4yNSAxLjI1IDAgMSAxLTIuMzM4Ljg4NSAxLjI1IDEuMjUgMCAwIDEgMi4zMzgtLjg4NU00LjM0MyA4LjY3YTEuMjUgMS4yNSAwIDEgMS0yLjMzOC44ODUgMS4yNSAxLjI1IDAgMCAxIDIuMzM4LS44ODVNNS4zMDcgMTYuNzI4YTIuMjUgMi4yNSAwIDEgMS0uNTI1LS44NThsOS45MjMtNC43N2EyLjI1IDIuMjUgMCAxIDEgLjM4MS45MjZ6bS0uOTY0LjI3NGExLjI1IDEuMjUgMCAxIDEtMi4zMzguODg1IDEuMjUgMS4yNSAwIDAgMSAyLjMzOC0uODg1bTEzLjAyMy01LjEwNmExLjI1IDEuMjUgMCAxIDAtLjg4NS0yLjMzOSAxLjI1IDEuMjUgMCAwIDAgLjg4NSAyLjMzOSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-position-bottom{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii4yNSIgZD0iTTMgMTBoMTR2MUgzem0zLTNoOHYxSDZ6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTYgMTNoOHYxSDZ6Ii8+PC9zdmc+)}.ag-charts-icon-position-center{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMyAxMGgxNHYxSDN6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuMjUiIGQ9Ik02IDdoOHYxSDZ6bTAgNmg4djFINnoiLz48L3N2Zz4=)}.ag-charts-icon-position-top{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii4yNSIgZD0iTTMgMTBoMTR2MUgzeiIvPjxwYXRoIGZpbGw9IiMwMDAiIGQ9Ik02IDdoOHYxSDZ6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuMjUiIGQ9Ik02IDEzaDh2MUg2eiIvPjwvc3ZnPg==)}.ag-charts-icon-price-label-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNC41IDNBMS41IDEuNSAwIDAgMCAzIDQuNVYxM2ExLjUgMS41IDAgMCAwIDEuNSAxLjVoLjgzM3YuMDU3Yy4yNDItLjI5OS41OTctLjUwMyAxLS41NDhWMTMuNUg0LjVBLjUuNSAwIDAgMSA0IDEzVjQuNWEuNS41IDAgMCAxIC41LS41aDExYS41LjUgMCAwIDEgLjUuNXY4YS41LjUgMCAwIDEtLjUuNWgtNC44MThsLS4xMjYuMDg0YTI2IDI2IDAgMCAwLTIuMjI1IDEuNjg1bC0uMzIuMjY1LS4wNjguMDU2YTEuNSAxLjUgMCAwIDEtMi42MDkgMS4zNTRjLjAzMy43NjMuOTA1IDEuMjM4IDEuNTYuNzU2LjY0Ni0uNDc0IDEuMjEtLjk0MyAxLjc2MS0xLjRsLjMxMy0uMjZBMjYgMjYgMCAwIDEgMTAuOTg2IDE0SDE1LjVhMS41IDEuNSAwIDAgMCAxLjUtMS41di04QTEuNSAxLjUgMCAwIDAgMTUuNSAzeiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC43MTYgMTQuODE1YTIuMjUgMi4yNSAwIDEgMS00LjIxIDEuNTkzIDIuMjUgMi4yNSAwIDAgMSA0LjIxLTEuNTkzbS0xLjY2MiAxLjk2NmExLjI1IDEuMjUgMCAxIDAtLjg4NS0yLjMzOSAxLjI1IDEuMjUgMCAwIDAgLjg4NSAyLjMzOSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-price-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNOS4wNDYgMTVWNS44NzdoLjk0MlYxNXoiIGZpbGw9IiMxODFEMUYiLz48cGF0aCBkPSJNOS4wNDYgMTVWNS44NzdoLjk0MlYxNXoiIGZpbGw9IiMxODFEMUYiLz48cGF0aCBkPSJNOS41IDYuMjI4IDcuMTY3IDguMzc2IDYuNSA3Ljc2MiA5LjUgNWwzIDIuNzYyLS42NjcuNjE0eiIgZmlsbD0iIzAwMCIvPjxwYXRoIGQ9Ik0yIDE4di0xaDE2djF6TTIgM1YyaDE2djF6IiBmaWxsPSIjMTgxRDFGIi8+PC9zdmc+)}.ag-charts-icon-reset{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTIuMDQgNC40NDVhNS44MSA1LjgxIDAgMCAwLTcuMjU3IDIuNDUzLjUuNSAwIDAgMS0uODY1LS41MDJBNi44MSA2LjgxIDAgMSAxIDMgOS44MTNhLjUuNSAwIDAgMSAxIDAgNS44MSA1LjgxIDAgMSAwIDguMDQtNS4zNjgiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiMwMDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTQuMjg5IDMuMDAyYS41LjUgMCAwIDEgLjUuNXYyLjY1NWgyLjY1NWEuNS41IDAgMCAxIDAgMUg0LjI5YS41LjUgMCAwIDEtLjUtLjVWMy41MDJhLjUuNSAwIDAgMSAuNS0uNSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-settings{--icon: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkIj48cGF0aCBkPSJNMTAgMTNhMyAzIDAgMSAwIDAtNiAzIDMgMCAwIDAgMCA2bTAtMWEyIDIgMCAxIDEtLjAwMS0zLjk5OUEyIDIgMCAwIDEgMTAgMTIiLz48cGF0aCBkPSJNMi4zMSAxNC4zNDVjLS44MTctMS40OTEuMDI3LTIuNDk5LjQ3NC0yLjg2NS41MzEtLjQzNC45NjktLjM2NS45NzItMS40OC0uMDAzLTEuMTE1LS40NDEtMS4wNDYtLjk3Mi0xLjQ4MS0uNDU0LS4zNzEtMS4zMTctMS40MDUtLjQzNC0yLjkzNmwuMDA1LS4wMDljLjg4NC0xLjUyIDIuMjA3LTEuMjkgMi43NTUtMS4wODMuNjQxLjI0My44MDEuNjU2IDEuNzY4LjEwMS45NjQtLjU2LjY4Ni0uOTA0Ljc5Ni0xLjU4Mi4wOTQtLjU3OC41NTktMS44NDMgMi4zMjYtMS44NDNoLjAxYzEuNzU5LjAwNSAyLjIyMiAxLjI2NiAyLjMxNiAxLjg0My4xMS42NzgtLjE2OCAxLjAyMi43OTYgMS41ODIuOTY3LjU1NSAxLjEyNy4xNDIgMS43NjgtLjEwMS41NDktLjIwOCAxLjg3Ni0uNDM4IDIuNzYgMS4wOTJzLjAyIDIuNTY1LS40MzQgMi45MzZjLS41MzEuNDM1LS45NjkuMzY2LS45NzIgMS40ODEuMDAzIDEuMTE1LjQ0MSAxLjA0Ni45NzIgMS40OC40NTQuMzcyIDEuMzE3IDEuNDA2LjQzNCAyLjkzN2wtLjAwNS4wMDljLS44ODQgMS41Mi0yLjIwNyAxLjI5LTIuNzU1IDEuMDgzLS42NDEtLjI0My0uODAxLS42NTYtMS43NjgtLjEwMS0uOTY0LjU2LS42ODYuOTA0LS43OTYgMS41ODEtLjA5NC41NzktLjU1OSAxLjg0NC0yLjMyNiAxLjg0NGgtLjAxYy0xLjc1OS0uMDA1LTIuMjIyLTEuMjY2LTIuMzE2LTEuODQ0LS4xMS0uNjc3LjE2OC0xLjAyMS0uNzk2LTEuNTgxLS45NjctLjU1NS0xLjEyNy0uMTQyLTEuNzY4LjEwMS0uNTQ5LjIwOC0xLjg3Ni40MzgtMi43Ni0xLjA5MmwtLjAyLS4wMzZ6TTkuOTg0IDIuMTYySDEwYzEuMzU1IDAgMS4zNDIgMS4wMzkgMS4zNTMgMS40MjUuMDA4LjMxMi4wNCAxLjE2IDEuMjU5IDEuODcybC4wMTUuMDA4YzEuMjI1LjcgMS45NzYuMzA0IDIuMjUxLjE1NS4zMzctLjE4MyAxLjIyNi0uNzExIDEuOTAyLjQ0NWwuMDA4LjAxNGMuNjc4IDEuMTczLS4yMjkgMS42ODItLjU1OCAxLjg4NC0uMjY2LjE2My0uOTg0LjYxNS0uOTkxIDIuMDI3di4wMTZjLjAwNyAxLjQxMi43MjUgMS44NjQuOTkxIDIuMDI3LjMyOC4yMDEgMS4yMjkuNzA3LjU2NiAxLjg3bC0uMDA4LjAxNGMtLjY3NyAxLjE3NC0xLjU3MS42NDMtMS45MS40NTktLjI3NS0uMTQ5LTEuMDI2LS41NDUtMi4yNTEuMTU0bC0uMDE1LjAwOWMtMS4yMTkuNzEyLTEuMjUxIDEuNTYtMS4yNTkgMS44NzItLjAxMS4zODYuMDAyIDEuNDI1LTEuMzUzIDEuNDI1cy0xLjM0Mi0xLjAzOS0xLjM1My0xLjQyNWMtLjAwOC0uMzEyLS4wNC0xLjE2LTEuMjU5LTEuODcybC0uMDE1LS4wMDljLTEuMjI1LS42OTktMS45NzYtLjMwMy0yLjI1MS0uMTU0LS4zMzYuMTgzLTEuMjE5LjcwNi0xLjg5NC0uNDMybC0uMDE2LS4wMjdjLS42NzgtMS4xNzQuMjI5LTEuNjgyLjU1OC0xLjg4NC4yNjYtLjE2My45ODQtLjYxNS45OTEtMi4wMjd2LS4wMTZjLS4wMDctMS40MTItLjcyNS0xLjg2NC0uOTkxLTIuMDI3LS4zMjgtLjIwMS0xLjIyOS0uNzA3LS41NjYtMS44N2wuMDA4LS4wMTRjLjY3Ny0xLjE3NCAxLjU3MS0uNjQzIDEuOTEtLjQ1OS4yNzUuMTQ5IDEuMDI2LjU0NSAyLjI1MS0uMTU1bC4wMTUtLjAwOGMxLjIxOS0uNzEyIDEuMjUxLTEuNTYgMS4yNTktMS44NzIuMDEtLjM4NC0uMDAyLTEuNDE3IDEuMzM3LTEuNDI1Ii8+PC9zdmc+)}.ag-charts-icon-step-line-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzE4MUQxRiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNiA0aDV2OGgzVjhoNXYxaC00djRoLTVWNUg3djEwSDJ2LTFoNHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-text-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00IDRIMTZWN0gxNVY1SDEwLjVWMTVIMTRWMTZINlYxNUg5LjVWNUg1VjdINFY0WiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-trend-line,.ag-charts-icon-trend-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS4zMTQgMTAuOTM4YTIuMjUgMi4yNSAwIDEgMSAuMDEtMWg5LjM1MmEyLjI1IDIuMjUgMCAxIDEgLjAxIDF6bS0yLjE4OS43MjlhMS4yNSAxLjI1IDAgMSAwIDAtMi41IDEuMjUgMS4yNSAwIDAgMCAwIDIuNW0xMy43NSAwYTEuMjUgMS4yNSAwIDEgMCAwLTIuNSAxLjI1IDEuMjUgMCAwIDAgMCAyLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-unlock,.ag-charts-icon-unlocked{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuNjUxIDMuNWEyLjg5NCAyLjg5NCAwIDAgMC0yLjg5NCAyLjg5NFY5SDE0LjVhMi41IDIuNSAwIDAgMSAyLjUgMi41djNhMi41IDIuNSAwIDAgMS0yLjUgMi41aC04QTIuNSAyLjUgMCAwIDEgNCAxNC41di0zQTIuNSAyLjUgMCAwIDEgNi41IDloLjI1N1Y2LjM5NGEzLjg5NCAzLjg5NCAwIDEgMSA3Ljc4OSAwIC41LjUgMCAwIDEtMSAwQTIuODk0IDIuODk0IDAgMCAwIDEwLjY1IDMuNU02LjUgMTBBMS41IDEuNSAwIDAgMCA1IDExLjV2M0ExLjUgMS41IDAgMCAwIDYuNSAxNmg4YTEuNSAxLjUgMCAwIDAgMS41LTEuNXYtM2ExLjUgMS41IDAgMCAwLTEuNS0xLjV6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-vertical-line,.ag-charts-icon-vertical-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuNSA3LjgwNmEyLjI1IDIuMjUgMCAwIDEgMCA0LjM4OFYxOS41aC0xdi03LjMwNmEyLjI1IDIuMjUgMCAwIDEgMC00LjM4OFYuNWgxem0tLjUuOTQ0YTEuMjUgMS4yNSAwIDEgMSAwIDIuNSAxLjI1IDEuMjUgMCAwIDEgMC0yLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-zoom-in{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTEwIDUuNWEuNS41IDAgMCAxIC41LjV2My41aDMuODc1YS41LjUgMCAwIDEgMCAxSDEwLjV2NC4yNWEuNS41IDAgMSAxLTEgMFYxMC41SDUuNjI1YS41LjUgMCAxIDEgMC0xSDkuNVY2YS41LjUgMCAwIDEgLjUtLjUiLz48L3N2Zz4=)}.ag-charts-icon-zoom-out{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS41IDEwYS41LjUgMCAwIDEgLjUtLjVoOGEuNS41IDAgMCAxIDAgMUg2YS41LjUgMCAwIDEtLjUtLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-high-low-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNyA0aDJ2MTJINFY0aDNNNSA1aDN2MTBINXpNMTEgMTRWNmg1djhoLTVtMS03aDN2NmgtM3oiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-hlc-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTguMTYzIDEuODM3LTUuMzM0IDExLjYyMUw2Ljk1NyA4LjEybC00LjE5OSA5LjYyMi0uOTE2LS40IDQuNzU2LTEwLjlMMTIuNDkgMTEuOCAxNy4yNTQgMS40MnoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiMwMDAiIGZpbGwtb3BhY2l0eT0iLjQiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTUuODI1IDIuNzA0LjU1IDEzLjc4NWwuOTAyLjQzIDQuNzI0LTkuOTE5IDYuMDM0IDUuMDI5IDMuMjU1LTguMTQtLjkyOC0uMzctMi43NDUgNi44NnptNy44NTIgMTQuNjM2IDUuNzgtMTMuMTM5LS45MTUtLjQwMi01LjIxOSAxMS44Ni02LjAwNS01LjUwNC0zLjI3OCA3LjY0OC45Mi4zOTQgMi43MjItNi4zNTJ6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-chevron-right{--icon: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03LjQ3IDUuNDdhLjc1Ljc1IDAgMCAxIDEuMDYgMGw0IDRhLjc1Ljc1IDAgMCAxIDAgMS4wNmwtNCA0YS43NS43NSAwIDAgMS0xLjA2LTEuMDZMMTAuOTQgMTAgNy40NyA2LjUzYS43NS43NSAwIDAgMSAwLTEuMDYiIGZpbGw9IiMwMDAiLz48L3N2Zz4=)}.ag-charts-icon-zoom-in-alt{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXpvb20taW4iPjxjaXJjbGUgY3g9IjExIiBjeT0iMTEiIHI9IjgiLz48bGluZSB4MT0iMjEiIHgyPSIxNi42NSIgeTE9IjIxIiB5Mj0iMTYuNjUiLz48bGluZSB4MT0iMTEiIHgyPSIxMSIgeTE9IjgiIHkyPSIxNCIvPjxsaW5lIHgxPSI4IiB4Mj0iMTQiIHkxPSIxMSIgeTI9IjExIi8+PC9zdmc+)}.ag-charts-icon-zoom-out-alt{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXpvb20tb3V0Ij48Y2lyY2xlIGN4PSIxMSIgY3k9IjExIiByPSI4Ii8+PGxpbmUgeDE9IjIxIiB4Mj0iMTYuNjUiIHkxPSIyMSIgeTI9IjE2LjY1Ii8+PGxpbmUgeDE9IjgiIHgyPSIxNCIgeTE9IjExIiB5Mj0iMTEiLz48L3N2Zz4=)}.ag-charts-input{--input-layer-active: 1;--input-layer-focus: 2;--input-padding: calc(var(--ag-charts-spacing) * 2);--input-padding-large: calc(var(--ag-charts-spacing) * 2.5);color:var(--ag-charts-input-text-color);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-large);transition-duration:.25s;transition-property:none;transition-timing-function:ease-out}.ag-charts-input:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:var(--input-layer-focus)}.ag-charts-button{background:var(--ag-charts-button-background-color);border:var(--ag-charts-button-border);border-radius:var(--ag-charts-button-border-radius);color:var(--ag-charts-button-text-color);cursor:pointer;padding:var(--input-padding);transition-property:background,border-color}.ag-charts-button:hover{background:var(--ag-charts-focus-color)}.ag-charts-button:has(.ag-charts-icon){padding:2px}.ag-charts-checkbox{--checkbox-transition-duration: .1s;appearance:none;background:var(--ag-charts-checkbox-background-color);border-radius:calc(var(--ag-charts-border-radius) * 9);cursor:pointer;height:18px;margin:0;transition-duration:var(--checkbox-transition-duration);transition-property:margin;width:29px}.ag-charts-checkbox:before{display:block;background:var(--ag-charts-input-background-color);border-radius:calc(var(--ag-charts-border-radius) * 7);content:" ";height:14px;margin:2px;transition-duration:var(--checkbox-transition-duration);transition-property:margin;transition-timing-function:var(--ag-charts-input-transition-easing);width:14px}.ag-charts-checkbox:checked{background:var(--ag-charts-checkbox-checked-background-color)}.ag-charts-checkbox:checked:before{margin-left:13px}.ag-charts-select{background:var(--ag-charts-input-background-color);border:var(--ag-charts-input-border);border-radius:var(--ag-charts-input-border-radius);padding:3px 2px 4px;font-size:inherit}.ag-charts-textarea{--textarea-line-height: 1.38;background:var(--ag-charts-input-background-color);border:var(--ag-charts-input-border);border-radius:var(--ag-charts-input-border-radius);line-height:var(--textarea-line-height);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-large);padding:var(--input-padding-large) var(--input-padding)}.ag-charts-textarea::placeholder{color:var(--ag-charts-input-placeholder-text-color)}.ag-charts-proxy-container{pointer-events:none;position:absolute}.ag-charts-proxy-legend-toolbar{pointer-events:auto}.ag-charts-proxy-legend-toolbar>div[role=listitem]{pointer-events:none}.ag-charts-proxy-elem{-webkit-appearance:none;appearance:none;background:none;border:none;color:#0000;overflow:hidden;pointer-events:auto;position:absolute}.ag-charts-proxy-elem::-moz-range-thumb,.ag-charts-proxy-elem::-moz-range-track{opacity:0}.ag-charts-proxy-elem::-webkit-slider-runnable-track,.ag-charts-proxy-elem::-webkit-slider-thumb{opacity:0}.ag-charts-proxy-elem:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow)}.ag-charts-focus-indicator{position:absolute;display:block;pointer-events:none;user-select:none;-webkit-user-select:none;width:100%;height:100%}.ag-charts-focus-indicator>div{position:absolute;outline:solid 1px var(--ag-charts-chrome-background-color);box-shadow:var(--ag-charts-focus-shadow)}.ag-charts-focus-indicator>svg{width:100%;height:100%;fill:none;overflow:visible}.ag-charts-focus-svg-outer-path{stroke:var(--ag-charts-chrome-background-color);stroke-width:4px}.ag-charts-focus-svg-inner-path{stroke:var(--ag-charts-accent-color);stroke-width:2px}.ag-charts-overlay{color:#181d1f;pointer-events:none}.ag-charts-overlay.ag-charts-dark-overlay{color:#fff}.ag-charts-overlay--loading{color:#8c8c8c}.ag-charts-overlay__loading-background{background:#fff;pointer-events:none}.ag-charts-overlay.ag-charts-dark-overlay .ag-charts-overlay__loading-background{background:#192232}.ag-charts-tooltip{--tooltip-arrow-size: 8px;--tooltip-row-spacing: 8px;--tooltip-column-spacing: 16px;position:fixed;inset:unset;margin:0;padding:0;overflow:visible;top:var(--top, 0px);left:var(--left, 0px);width:max-content;max-width:100%;font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);color:var(--ag-charts-tooltip-text-color);background:var(--ag-charts-tooltip-background-color);border:var(--ag-charts-tooltip-border);border-radius:var(--ag-charts-tooltip-border-radius);box-shadow:var(--ag-charts-popup-shadow)}.ag-charts-tooltip--compact .ag-charts-tooltip-content{--tooltip-row-spacing: 2px;--tooltip-column-spacing: 8px;padding:3px 6px}.ag-charts-tooltip--arrow-top:before,.ag-charts-tooltip--arrow-right:before,.ag-charts-tooltip--arrow-bottom:before,.ag-charts-tooltip--arrow-left:before{content:"";position:absolute;display:block;width:var(--tooltip-arrow-size);height:var(--tooltip-arrow-size);border:inherit;border-bottom-color:transparent;border-right-color:transparent;background:inherit;clip-path:polygon(0 0,100% 0,100% 1px,1px 100%,0 100%)}.ag-charts-tooltip--arrow-top:before{bottom:100%;left:50%;transform:translate(-50%) translateY(calc(var(--tooltip-arrow-size) * .5)) rotate(45deg)}.ag-charts-tooltip--arrow-bottom:before{top:100%;left:50%;transform:translate(-50%) translateY(calc(var(--tooltip-arrow-size) * -.5)) rotate(225deg)}.ag-charts-tooltip--arrow-left:before{right:100%;top:50%;transform:translateY(-50%) translate(calc(var(--tooltip-arrow-size) * .5)) rotate(315deg)}.ag-charts-tooltip--arrow-right:before{left:100%;top:50%;transform:translateY(-50%) translate(calc(var(--tooltip-arrow-size) * -.5)) rotate(135deg)}.ag-charts-tooltip--no-interaction{pointer-events:none;user-select:none;-webkit-user-select:none}.ag-charts-tooltip--wrap-always{overflow-wrap:break-word;word-break:break-word;hyphens:none}.ag-charts-tooltip--wrap-hyphenate{overflow-wrap:break-word;word-break:break-word;hyphens:auto}.ag-charts-tooltip--wrap-on-space{overflow-wrap:normal;word-break:normal}.ag-charts-tooltip--wrap-never{white-space:nowrap}.ag-charts-tooltip-heading,.ag-charts-tooltip-title,.ag-charts-tooltip-label,.ag-charts-tooltip-value{overflow:hidden;text-overflow:ellipsis}.ag-charts-tooltip-content{display:grid;grid:auto-flow minmax(1em,auto) / 1fr;padding:8px 12px;gap:var(--tooltip-row-spacing)}.ag-charts-tooltip-content:has(.ag-charts-tooltip-symbol){grid:auto-flow minmax(1em,auto) / auto 1fr}.ag-charts-tooltip-heading{grid-column:1 / -1}.ag-charts-tooltip-symbol{grid-column:1 / 2;place-self:center}.ag-charts-tooltip-symbol svg{display:block}.ag-charts-tooltip-title{grid-column:-2 / -1}.ag-charts-tooltip-row{grid-column:1 / -1;display:flex;gap:var(--tooltip-column-spacing);align-items:baseline;justify-content:space-between;overflow:hidden}.ag-charts-tooltip-row--inline{grid-column:-2 / -1}.ag-charts-tooltip-label{flex:1;min-width:0}.ag-charts-tooltip-value{min-width:0}.ag-charts-tooltip-footer{grid-column:1 / -1;color:var(--ag-charts-tooltip-subtle-text-color);text-align:center}.ag-charts-popover{position:absolute;border:var(--ag-charts-border);border-radius:var(--ag-charts-border-radius);background:var(--ag-charts-panel-background-color);color:var(--ag-charts-chrome-text-color);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);box-shadow:var(--ag-charts-popup-shadow);z-index:var(--ag-charts-layer-ui-overlay)}.ag-charts-menu{--item-padding: 6px 12px;--icon-color: var(--ag-charts-menu-text-color);display:grid;grid:auto-flow auto / 1fr;column-gap:12px;font-size:var(--ag-charts-chrome-font-size)}.ag-charts-menu:has(.ag-charts-menu__icon,.ag-charts-menu__row--stroke-width-visible){grid:auto-flow auto / auto 1fr}.ag-charts-menu__row--stroke-width-visible:before{content:"";height:var(--strokeWidth);width:12px;background:var(--icon-color)}.ag-charts-menu__row--stroke-width-visible[aria-disabled=true]:before{filter:grayscale(1);opacity:.5}.ag-charts-menu__row{display:grid;grid-column:1 / -1;grid-template-columns:subgrid;align-items:center;padding:var(--item-padding)}.ag-charts-menu__row:not(.ag-charts-menu__row--active){cursor:pointer}.ag-charts-menu__row:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.ag-charts-menu__row:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.ag-charts-menu__row:focus{background:var(--ag-charts-focus-color)}.ag-charts-menu__row:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:var(--ag-charts-layer-menu)}.ag-charts-menu__row--active{--icon-color: var(--ag-charts-accent-color);background:var(--ag-charts-focus-color);color:var(--ag-charts-accent-color)}.ag-charts-menu__label{grid-column:-1 / span 1}.ag-charts-toolbar{--toolbar-gap: calc(var(--ag-charts-spacing) * 2);--toolbar-size: 34px;--toolbar-button-padding: 6px;align-items:center;display:flex;flex-wrap:nowrap;position:absolute}.ag-charts-toolbar__button{align-items:center;background:var(--ag-charts-chrome-background-color);border:var(--ag-charts-button-border);color:var(--ag-charts-button-text-color);cursor:pointer;display:flex;font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-medium);font-weight:var(--ag-charts-chrome-font-weight);justify-content:center;min-height:var(--toolbar-size);min-width:var(--toolbar-size);padding:var(--toolbar-button-padding);position:relative;transition:background-color .25s ease-in-out,border-color .25s ease-in-out,color .25s ease-in-out;white-space:nowrap}.ag-charts-toolbar__button:hover{background:var(--ag-charts-focus-color);z-index:1}.ag-charts-toolbar__button:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-toolbar__button--active{background:var(--ag-charts-focus-color);border-color:var(--ag-charts-accent-color);color:var(--ag-charts-accent-color);z-index:2}.ag-charts-toolbar__button[aria-disabled=true]{background:var(--ag-charts-button-disabled-background-color);color:var(--ag-charts-button-disabled-text-color);cursor:default}.ag-charts-toolbar--horizontal{flex-direction:row;.ag-charts-toolbar__button{margin:0 0 0 -1px}.ag-charts-toolbar__button--first{border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius);margin:0}.ag-charts-toolbar__button--last{border-bottom-right-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius)}}.ag-charts-toolbar--vertical{flex-direction:column;.ag-charts-toolbar__button{margin:-1px 0 0;max-width:100%}.ag-charts-toolbar__button--first{border-top-left-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius);margin:0}.ag-charts-toolbar__button--last{border-bottom-left-radius:var(--ag-charts-border-radius);border-bottom-right-radius:var(--ag-charts-border-radius)}}.ag-charts-toolbar__icon+.ag-charts-toolbar__label{margin-left:var(--toolbar-gap)}.ag-charts-toolbar__icon,.ag-charts-toolbar__label{pointer-events:none}.ag-charts-floating-toolbar{border:none;display:flex;.ag-charts-toolbar{align-items:unset;position:unset}}.ag-charts-floating-toolbar__drag-handle{align-items:center;background:var(--ag-charts-chrome-background-color);border:var(--ag-charts-border);border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius);cursor:grab;display:flex;justify-content:center;min-width:24px;padding-left:0;padding-right:0}.ag-charts-floating-toolbar__drag-handle--dragging{cursor:grabbing} +`,S0=class{constructor(){this.cleanup=new St,this.destroyed=!1}destroy(){this.cleanup.flush(),this.destroyed=!0}},R4=class SS{constructor(t,i,s){this.element=t,this.topTabGuard=i,this.bottomTabGuard=s,this.cleanup=new St,this.guardTabIndex=0,this.hasFocus=!1,this.initTabGuard(this.topTabGuard,!1),this.initTabGuard(this.bottomTabGuard,!0),this.element.addEventListener("focus",()=>this.onFocus(),{capture:!0}),this.element.addEventListener("blur",n=>this.onBlur(n),{capture:!0})}set tabIndex(t){this.guardTabIndex=t,this.guardTabIndex===0?this.setGuardIndices(void 0):this.hasFocus||this.setGuardIndices(this.guardTabIndex)}destroy(){this.cleanup.flush()}initTabGuard(t,i){this.cleanup.register(ht(t,"focus",()=>this.onTab(t,i)))}setGuardIndices(t){const i=t;Ge(this.topTabGuard,"tabindex",i),Ge(this.bottomTabGuard,"tabindex",i)}onFocus(){this.hasFocus=!0,this.guardTabIndex!==0&&this.setGuardIndices(0)}onBlur({relatedTarget:t}){const{topTabGuard:i,bottomTabGuard:s}=this;this.hasFocus=!1,this.guardTabIndex!==0&&t!==i&&t!==s&&this.setGuardIndices(this.guardTabIndex)}onTab(t,i){if(this.guardTabIndex!==0){let s;t.tabIndex===0?(s=this.findExitTarget(!i),this.setGuardIndices(this.guardTabIndex)):s=this.findEnterTarget(i),s?.focus()}}static queryFocusable(t,i){const s=qe();return Array.from(t.querySelectorAll(i)).filter(n=>{if(n instanceof HTMLElement){const o=s.getComputedStyle(n);return o.display!=="none"&&o.visibility!=="none"}return!1})}findEnterTarget(t){const i=SS.queryFocusable(this.element,'[tabindex="0"]'),s=t?i.length-1:0;return i[s]}findExitTarget(t){const i=SS.queryFocusable(Ma(),"[tabindex]").filter(o=>o.tabIndex>0).sort((o,a)=>o.tabIndex-a.tabIndex),{before:s,after:n}=SS.findBeforeAndAfter(i,this.guardTabIndex);return t?s:n}static findBeforeAndAfter(t,i){let s=0,n=t.length-1,o,a;for(;s<=n;){const r=Math.floor((s+n)/2),l=t[r].tabIndex;if(l===i){o=t[r-1]||void 0,a=t[r+1]||void 0;break}else l{Xy(s,...i)&&t(s)})}function vT(e,t){const i=ht(qe(),"mousedown",s=>{[0,2].includes(s.button)&&!MT(e,s)&&(t(),i())});return i}function ST(e,t){const i=ht(qe(),"touchstart",s=>{Array.from(s.targetTouches).some(o=>!MT(e,o))&&(t(),i())});return i}function MT(e,t){return t.target instanceof Element&&t.target.shadowRoot!=null?!0:t.target instanceof Node&&e.contains(t.target)}function DT(e,t,i){const s=n=>{for(const o of t)Ge(o,"data-focus-visible-override",n)};return s(i),ht(e,"keydown",()=>s(!0),{once:!0})}function wp(e){return!(e.shiftKey||e.altKey||e.ctrlKey||e.metaKey)}function Xy(e,...t){return wp(e)&&t.includes(e.key)}function kT(e,t,i){return ht(e,"keydown",s=>{Xy(s,i)&&t.focus()})}var Np={horizontal:{nextKey:"ArrowRight",prevKey:"ArrowLeft"},vertical:{nextKey:"ArrowDown",prevKey:"ArrowUp"}};function z4(e){const{orientation:t,buttons:i,wrapAround:s=!1,onEscape:n,onFocus:o,onBlur:a}=e,{nextKey:r,prevKey:l}=Np[t],c=p=>{if(p.target&&"tabIndex"in p.target){for(const g of i)g.tabIndex=-1;p.target.tabIndex=0}},[h,d]=s?[i.length,i.length]:[0,1/0],u=new St;for(let p=0;p{Xy(m,r,l)&&m.preventDefault()})),f.tabIndex=p===0?0:-1}return u}function F4(e,t){return i=>{if(e.ariaDisabled==="true")return i.preventDefault();t(i)}}function D0(e){return"button"in e?e.button===0:wp(e)&&(e.code==="Space"||e.key==="Enter")}function k0(e){if(e?.target instanceof HTMLElement&&"tabindex"in e.target.attributes)return e.target}function IT(e){return ht(e,"keydown",t=>{if(t.defaultPrevented)return;ad(t.target,"data-preventdefault",!0)&&Xy(t,"ArrowRight","ArrowLeft","ArrowDown","ArrowUp")&&t.preventDefault()})}var B4=class{constructor(e){this.callback=e,this.devicePixelRatio=qe("devicePixelRatio")??1,this.devicePixelRatioMediaQuery=void 0,this.devicePixelRatioListener=t=>{t.matches||(this.devicePixelRatio=qe("devicePixelRatio")??1,this.unregisterDevicePixelRatioListener(),this.registerDevicePixelRatioListener(),this.callback(this.pixelRatio))}}get pixelRatio(){return this.devicePixelRatio}observe(){this.registerDevicePixelRatioListener()}disconnect(){this.unregisterDevicePixelRatioListener()}unregisterDevicePixelRatioListener(){this.devicePixelRatioMediaQuery?.removeEventListener("change",this.devicePixelRatioListener),this.devicePixelRatioMediaQuery=void 0}registerDevicePixelRatioListener(){const e=qe("matchMedia")?.(`(resolution: ${this.pixelRatio}dppx)`);e?.addEventListener("change",this.devicePixelRatioListener),this.devicePixelRatioMediaQuery=e}},AT=class{constructor(){this.elements=new Map,this.documentReady=!1,this.queuedObserveRequests=[],this.onLoad=()=>{this.documentReady=!0;for(const[t,i]of this.queuedObserveRequests)this.observe(t,i);this.queuedObserveRequests=[],this.observeWindow()},typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(t=>{for(const{target:i,contentRect:{width:s,height:n}}of t){const o=this.elements.get(i);this.checkSize(o,i,s,n)}}));let e;this.pixelRatioObserver=new B4(()=>{clearTimeout(e),e=setTimeout(()=>this.checkPixelRatio(),0)}),this.documentReady=Ma("readyState")==="complete",this.documentReady?this.observeWindow():qe()?.addEventListener("load",this.onLoad)}destroy(){qe()?.removeEventListener("load",this.onLoad),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.pixelRatioObserver?.disconnect(),this.pixelRatioObserver=void 0}observeWindow(){this.pixelRatioObserver?.observe()}checkPixelRatio(){const e=this.pixelRatioObserver?.pixelRatio??1;for(const[t,i]of this.elements)if(i.size!=null&&i.size.pixelRatio!==e){const{width:s,height:n}=i.size;i.size={width:s,height:n,pixelRatio:e},i.cb(i.size,t)}}checkSize(e,t,i,s){if(e&&(i!==e.size?.width||s!==e.size?.height)){const n=this.pixelRatioObserver?.pixelRatio??1;e.size={width:i,height:s,pixelRatio:n},e.cb(e.size,t)}}observe(e,t){if(!this.documentReady){this.queuedObserveRequests.push([e,t]);return}this.elements.has(e)?this.removeFromQueue(e):this.resizeObserver?.observe(e);const i={cb:t};this.elements.set(e,i)}unobserve(e){this.resizeObserver?.unobserve(e),this.elements.delete(e),this.removeFromQueue(e),this.elements.size||this.destroy()}removeFromQueue(e){this.queuedObserveRequests=this.queuedObserveRequests.filter(([t])=>t!==e)}},Sd=class extends Map{constructor(e,t){super(),this.defaultValue=e,this.defaultState=t}set(e,t){return this.delete(e),t!==void 0&&super.set(e,t),delete this.cachedState,delete this.cachedValue,this}delete(e){return delete this.cachedState,delete this.cachedValue,super.delete(e)}stateId(){return this.cachedState??(this.cachedState=Array.from(this.keys()).pop()??this.defaultState),this.cachedState}stateValue(){return this.cachedValue??(this.cachedValue=Array.from(this.values()).pop()??this.defaultValue),this.cachedValue}},_4='
',V4=["styles","canvas","canvas-center","canvas-container","canvas-overlay","canvas-proxy","series-area","tooltip-container"],G4=new Set(["styles","canvas-container","canvas","tooltip-container"]),CT={safeHorizontal:"ag-charts-wrapper--safe-horizontal",safeVertical:"ag-charts-wrapper--safe-vertical"},j4=new Map([["styles",{childElementType:"style"}],["canvas",{childElementType:"canvas"}],["canvas-proxy",{childElementType:"div"}],["canvas-overlay",{childElementType:"div"}],["canvas-center",{childElementType:"div"}],["series-area",{childElementType:"div"}],["tooltip-container",{childElementType:"div"}]]);function H4(e,t){if(typeof IntersectionObserver>"u")return;const i=new IntersectionObserver(s=>{for(const n of s)n.target===e&&t(n.intersectionRatio)},{root:e});return i.observe(e),i}var LT={x:0,y:0,width:0,height:0,top:0,bottom:0,left:0,right:0,toJSON(){return LT}};function TT(e,t){const i=De("div");return i.className="ag-charts-tab-guard",e.insertAdjacentElement(t,i),i}var I0=class ed extends S0{constructor(t,i,s,n,o="normal"){super(),this.eventsHub=t,this.chart=i,this.styleContainer=n,this.mode=o,this.anchorName=`--${hs(this)}`,this.styles=new Map,this.pendingContainer=void 0,this.container=void 0,this.documentRoot=void 0,this.initiallyConnected=void 0,this.containerSize=void 0,this.sizeMonitor=new AT,this.cursorState=new Sd("default"),this.minWidth=0,this.minHeight=0,this.element=this.initDOM(),this.rootElements=this.initRootElements(),this.rootElements.canvas.element.style.setProperty("anchor-name",this.anchorName);let a=!1;if(this.observer=H4(this.element,r=>{r===0&&!a&&this.eventsHub.emit("dom:hidden",null),a=r===0}),this.setSizeOptions(),this.updateContainerSize(),this.addStyles("ag-charts-community",P4),this.setContainer(s),this.cleanup.register(IT(this.element)),this.mode==="normal"){const r=this.rootElements["canvas-center"].element;if(r==null)throw new Error("Error initializing tab guards");const l=TT(r,"beforebegin"),c=TT(r,"afterend");this.tabGuards=new R4(r,l,c)}}initDOM(){if(this.mode==="normal"){const s=De("div");return s.innerHTML=_4,s.firstChild}const t=De("div");t.role="presentation",t.dataset.agCharts="",t.classList.add("ag-charts-wrapper");const i=De("div");return t.appendChild(i),i.role="presentation",i.classList.add("ag-charts-series-area"),t}initRootElements(){const{mode:t,element:i}=this,s={};for(const n of V4){const o=`ag-charts-${n}`;let a;if(t==="normal"?a=i.classList.contains(o)?i:i.getElementsByClassName(o)[0]:G4.has(n)?a=i:a=i.getElementsByClassName(o)[0]??De("div"),a==null)throw new Error(`AG Charts - unable to find DOM element ${o}`);s[n]={element:a,children:new Map,listeners:[]}}return s}destroy(){super.destroy(),this.observer?.unobserve(this.element),this.container&&this.sizeMonitor.unobserve(this.container),this.pendingContainer=void 0;for(const t of Object.values(this.rootElements)){for(const i of t.children.values())i.remove();t.element.remove()}this.element.remove()}postRenderUpdate(){this.mode!=="minimal"&&(this.pendingContainer==null||this.pendingContainer===this.container||(ed.batchedUpdateContainer.length===0&&qe().setTimeout(this.applyBatchedUpdateContainer.bind(this),0),ed.batchedUpdateContainer.push(this)))}applyBatchedUpdateContainer(){for(const t of ed.batchedUpdateContainer)t.destroyed||t.updateContainer();ed.batchedUpdateContainer.splice(0)}setSizeOptions(t=300,i=300,s,n){const{style:o}=this.element;o.width=`${s??t}px`,o.height=`${n??i}px`,this.minWidth=s??t,this.minHeight=n??i,this.updateContainerClassName()}updateContainerSize(){const{style:t}=this.rootElements["canvas-center"].element;t.visibility=this.containerSize==null?"hidden":"",this.containerSize?(t.width=`${this.containerSize.width??0}px`,t.height=`${this.containerSize.height??0}px`):(t.width="",t.height=""),this.updateContainerClassName()}setTabGuardIndex(t){this.tabGuards&&(this.tabGuards.tabIndex=t)}setContainer(t){t!==this.container&&(this.pendingContainer=t,(this.mode==="minimal"||this.container==null)&&this.updateContainer())}updateContainer(){const{pendingContainer:t}=this;if(!(t==null||t===this.container)){if(this.container&&(this.element.remove(),this.sizeMonitor.unobserve(this.container)),this.documentRoot!=null)for(const i of this.rootElements.styles.children.keys())this.removeChild("styles",i);this.container=t,this.pendingContainer=void 0,this.documentRoot=this.getShadowDocumentRoot(t),this.initiallyConnected=t.isConnected;for(const[i,s]of this.styles)this.addStyles(i,s);t.appendChild(this.element),this.sizeMonitor.observe(t,i=>{this.containerSize=i,this.updateContainerSize(),this.eventsHub.emit("dom:resize",null)}),this.eventsHub.emit("dom:container-change",null)}}setThemeClass(t){const i="ag-charts-theme-";for(const s of Array.from(this.element.classList))s.startsWith(i)&&s!==t&&this.element.classList.remove(s);this.element.classList.add(t)}setThemeParameters(t){for(const[i,s]of Tt(t)){let n=`${s}`;i.endsWith("Size")||i.endsWith("Radius")?n=`${s}px`:i.endsWith("Border")&&typeof s=="boolean"&&(n=s?"var(--ag-charts-border)":"none"),this.element.style.setProperty(`--ag-charts-${EG(i)}`,n)}}updateCanvasLabel(t){Ge(this.rootElements["canvas-proxy"].element,"aria-label",t)}getEventElement(t,i){return["focus","blur","keydown","keyup"].includes(i)?this.rootElements["series-area"].element:t}addEventListener(t,i,s){const n=this.getEventElement(this.element,t);return ht(n,t,i,s)}removeEventListener(t,i,s){this.getEventElement(this.element,t).removeEventListener(t,i,s)}getBoundingClientRect(){return this.rootElements.canvas.element.getBoundingClientRect()}getOverlayClientRect(){const t=qe(),i=new de(0,0,t.innerWidth,t.innerHeight),s=this.getRawOverlayClientRect();return i.intersection(s)?.toDOMRect()??LT}getRawOverlayClientRect(){let t=this.element;const i=this.element.getRootNode()?.fullscreenElement;for(;t!=null;){let o;if(i!=null&&t===i)o=!0;else{const r=t.computedStyleMap?.()?.get("overflow-y")?.toString();o=r==="auto"||r==="scroll"}if(o)return de.fromObject(t.getBoundingClientRect());t=t.parentElement}if(this.documentRoot!=null)return de.fromObject(this.documentRoot.getBoundingClientRect());const{innerWidth:s,innerHeight:n}=qe();return new de(0,0,s,n)}getShadowDocumentRoot(t=this.container){const i=t?.ownerDocument?.body??Ma("body");for(;t!=null;){if(t===i)return;if(t.parentNode instanceof DocumentFragment)return t;t=t.parentNode}}getParent(t){return this.rootElements[t].element}getChildBoundingClientRect(t){const{children:i}=this.rootElements[t],s=[];for(const n of i.values())s.push(de.fromObject(n.getBoundingClientRect()));return de.merge(s)}isManagedChildDOMElement(t,i,s){const{children:n}=this.rootElements[i],o=n?.get(s);return o!=null&&t.contains(o)}contains(t,i){return i==null?this.element.contains(t):this.rootElements[i].element.contains(t)}addStyles(t,i){const s="data-ag-charts";if(this.styles.set(t,i),this.container==null)return;const n=r=>r.getAttribute(s)===t,o=r=>{const l=new Set(["TITLE","META"]);let c=!0,h;for(const u of r.children){if(c&&l.has(u.tagName)){h=u;continue}if(c=!1,n(u))return;u.hasAttribute(s)&&(h=u)}const d=De("style");return this.chart.styleNonce!=null&&(d.nonce=this.chart.styleNonce),h==null?r.prepend(d):r.insertBefore(d,h.nextSibling),d};let a;this.styleContainer?a=o(this.styleContainer):this.initiallyConnected===!1?a=this.addChild("styles",t):this.documentRoot==null&&!ed.headStyles.has(t)?(a=o(Ma("head")),ed.headStyles.add(t)):this.documentRoot!=null&&(a=this.addChild("styles",t)),!(a==null||n(a))&&(a.setAttribute(s,t),a.innerHTML=i)}removeStyles(t){this.removeChild("styles",t)}updateCursor(t,i){this.cursorState.set(t,i),this.element.style.cursor=this.cursorState.stateValue()}getCursor(){return this.element.style.cursor}addChild(t,i,s,n){const{element:o,children:a,listeners:r}=this.rootElements[t];if(!a)throw new Error("AG Charts - unable to create DOM elements after destroy()");if(a.has(i))return a.get(i);const{childElementType:l="div"}=j4.get(t)??{};if(s&&s.tagName.toLowerCase()!==l.toLowerCase())throw new Error("AG Charts - mismatching DOM element type");const c=s??De(l);for(const[h,d,u]of r)c.addEventListener(h,d,u);if(a.set(i,c),l==="style"&&this.chart.styleNonce!=null&&(c.nonce=this.chart.styleNonce),n){const h=o.querySelector(n.query);if(h==null)throw new Error(`AG Charts - addChild query failed ${n.query}`);h.insertAdjacentElement(n.where,c)}else o?.appendChild(c);return c}removeChild(t,i){const{children:s}=this.rootElements[t];s&&(s.get(i)?.remove(),s.delete(i))}incrementDataCounter(t){const{dataset:i}=this.element;i[t]??(i[t]="0"),i[t]=String(Number(i[t])+1)}setDataBoolean(t,i){this.element.dataset[t]=String(i)}setDataNumber(t,i){this.element.dataset[t]=String(i)}updateContainerClassName(){const{element:t,containerSize:i,minWidth:s,minHeight:n}=this;t.classList.toggle(CT.safeHorizontal,s>=(i?.width??1/0)),t.classList.toggle(CT.safeVertical,n>=(i?.height??1/0))}};I0.batchedUpdateContainer=[],I0.headStyles=new Set;var wT=I0,W4=class extends Na{constructor(){super(De("div")),this.textElement=Xt("text"),this.textElement.role="presentation",this.svgElement=Xt("svg"),this.svgElement.appendChild(this.textElement),this.svgElement.style.width="100%",this.svgElement.style.opacity="0",this.svgElement.role="presentation",this.elem.appendChild(this.svgElement),this.elem.role="presentation"}set textContent(e){this.textElement.textContent=e;const i=this.textElement.getBBox?.();i&&this.svgElement.setAttribute("viewBox",`${i.x} ${i.y} ${i.width} ${i.height}`)}get textContent(){return this.textElement.textContent}destructor(){}},$4=class{constructor(e,t){this.getDispatcher=t,this.onExpanded=()=>{this.controller.setAriaExpanded(!0);const i=this.getDispatcher();if(i&&this.controls){const s={type:"expand-controlled-widget",controlled:this.controls};i.dispatch("expand-controlled-widget",this.controller,s)}},this.onCollapsed=i=>{this.controller.setAriaExpanded(!1),i.mode==="0"&&this.controller.focus()},e.setAriaExpanded(!1),this.controller=e}destroy(){this.controls?.collapse({mode:"2"}),this.setControlled(void 0)}setControlled(e){this.controls&&(this.controls.removeListener("expand-widget",this.onExpanded),this.controls.removeListener("collapse-widget",this.onCollapsed)),this.controls=e,this.controls&&(this.controller.setAriaControls(this.controls.id),this.controls.addListener("expand-widget",this.onExpanded),this.controls.addListener("collapse-widget",this.onCollapsed))}getControlled(){return this.controls}expandControlled(e){this.controller.isDisabled()||this.controls?.expand({controller:this.controller,sourceEvent:void 0,overrideFocusVisible:e?.overrideFocusVisible})}},A0=class extends Na{constructor(e,t){super(e),Ge(this.elem,"role",t),this.setEnabled(!0),this.addListener("keydown",({sourceEvent:i})=>{D0(i)&&(i.preventDefault(),this.htmlListener?.dispatch("click",this,{type:"click",device:"keyboard",sourceEvent:i}))})}lazyControllerImpl(){return this.controllerImpl??(this.controllerImpl=new $4(this,()=>this.internalListener)),this.controllerImpl}destructor(){this.controllerImpl?.destroy()}setEnabled(e){Ge(this.elem,"aria-disabled",!e)}setControlled(e){return this.lazyControllerImpl().setControlled(e)}getControlled(){return this.lazyControllerImpl().getControlled()}expandControlled(e){return this.lazyControllerImpl().expandControlled(e)}addListener(e,t){return super.addListener(e,(i,s)=>{(e==="click"||e==="dblclick")&&this.isDisabled()||t(i,s)})}},Op=class extends A0{constructor(){super(De("button"))}},U4=class extends Na{constructor(){super(De("div")),Ge(this.elem,"role","group")}destructor(){}},C0=class extends Na{constructor(e,t){super(De("div")),this.focusedChildIndex=0,this.onChildFocus=(i,s)=>{const n=this.children[this.focusedChildIndex];this.focusedChildIndex=s.index,n?.setTabIndex(-1),s.setTabIndex(0)},this.onChildKeyDown=(i,s)=>{const n=this.orientation,[o,a]=n==="both"?[Np.horizontal,Np.vertical]:[Np[n],void 0];let r=-1;if(wp(i.sourceEvent)){const l=i.sourceEvent.key;l===o.nextKey||l===a?.nextKey?r=s.index+1:(l===o.prevKey||l===a?.prevKey)&&(r=s.index-1)}this.children[r]?.focus()},Ge(this.elem,"role",t),this.orientation=e}get orientation(){return ad(this.elem,"aria-orientation")??"both"}set orientation(e){Ge(this.elem,"aria-orientation",e==="both"?void 0:e)}focus(){this.children[this.focusedChildIndex]?.focus()}clear(){this.focusedChildIndex=0;for(const e of this.children)this.removeChildListeners(e),e.parent=void 0;this.elem.textContent="",this.children.length=0}addChildListeners(e){e.addListener("focus",this.onChildFocus),e.addListener("keydown",this.onChildKeyDown)}removeChildListeners(e){e.removeListener("focus",this.onChildFocus),e.removeListener("keydown",this.onChildKeyDown)}onChildAdded(e){this.addChildListeners(e),e.setTabIndex(this.children.length===1?0:-1)}onChildRemoved(e){this.removeChildListeners(e);const{focusedChildIndex:t,children:i}=this,s=t===e.index;for(let n=0;nthis.getElement().step=t.attributeValue,s=()=>this.getElement().step=this._step.attributeValue;this._keyboardStep={step:t,onKeyDown:i,onKeyUp:s,onBlur:s},this.addListener("keydown",this._keyboardStep.onKeyDown),this.addListener("keyup",this._keyboardStep.onKeyUp),this.addListener("blur",this._keyboardStep.onBlur)}}get orientation(){return ad(this.elem,"aria-orientation")??"both"}set orientation(t){Ge(this.elem,"aria-orientation",t==="both"?void 0:t),ey.registerDefaultPreventers(this,t)}destructor(){}clampValueRatio(t,i){const s=this.getValueRatio(),n=ve(t,s,i);return n!==s&&this.setValueRatio(n),n}setValueRatio(t,i){const{divider:s}=this.step,n=Math.round(t*1e4)/s,{ariaValueText:o=NT(n/s)}=i??{},a=this.getElement();a.value=`${n}`,a.ariaValueText=o}getValueRatio(){return this.getElement().valueAsNumber/this.step.divider}static registerDefaultPreventers(t,i){i==="both"?t.removeListener("keydown",ey.onKeyDown):t.addListener("keydown",ey.onKeyDown)}static onKeyDown(t,i){let s=[];const{orientation:n}=i;n==="horizontal"?s=["ArrowUp","ArrowDown"]:n==="vertical"&&(s=["ArrowLeft","ArrowRight"]),s.includes(t.sourceEvent.code)&&t.sourceEvent.preventDefault()}};L0.STEP_ONE={attributeValue:"1",divider:1},L0.STEP_HUNDRETH={attributeValue:"0.01",divider:100};var T0=L0,Z4=class extends Op{constructor(){super(),Ge(this.elem,"role","switch"),this.setChecked(!1)}setChecked(e){Ge(this.elem,"aria-checked",e)}},qy=class extends C0{constructor(e="horizontal"){super(e,"toolbar")}destructor(){}};function kd(e,t){return t.params?.type===e}function X4(e){if(e==="button")return new Op;if(e==="slider")return new T0;if(e==="toolbar")return new qy;if(e==="group")return new U4;if(e==="list")return new K4;if(e==="region")return new Md(De("div"));if(e==="text")return new W4;if(e==="listswitch")return new Z4;throw new Error("AG Charts - error allocating meta")}function PT(e){const t={params:e,result:void 0};return t.result=X4(t.params.type),t}var RT=class{constructor(e,t,i){this.eventsHub=e,this.localeManager=t,this.domManager=i,this.cleanup=new St}destroy(){this.cleanup.flush()}addLocalisation(e){e(),this.cleanup.register(this.eventsHub.on("locale:change",e))}createProxyContainer(e){const t=PT(e),{params:i,result:s}=t,n=s.getElement();return this.domManager.addChild("canvas-proxy",i.domManagerId,n),n.classList.add(...i.classList,"ag-charts-proxy-container"),n.role=i.type,kd("toolbar",t)&&(t.result.orientation=t.params.orientation),this.addLocalisation(()=>{n.ariaLabel=this.localeManager.t(i.ariaLabel.id,i.ariaLabel.params)}),s}createProxyElement(e){const t=PT(e);if(kd("button",t)){const{params:i,result:s}=t,n=s.getElement();if(this.initInteract(i,s),typeof i.textContent=="string")n.textContent=i.textContent;else{const{textContent:o}=i;this.addLocalisation(()=>{n.textContent=this.localeManager.t(o.id,o.params)})}this.setParent(t.params,t.result)}if(kd("slider",t)){const{params:i,result:s}=t,n=s.getElement();this.initInteract(i,s),n.type="range",n.role="presentation",n.style.margin="0px",this.addLocalisation(()=>{n.ariaLabel=this.localeManager.t(i.ariaLabel.id,i.ariaLabel.params)}),this.setParent(t.params,t.result)}if(kd("text",t)){const{params:i,result:s}=t;this.initElement(i,s),this.setParent(t.params,t.result)}if(kd("listswitch",t)){const{params:i,result:s}=t;this.initInteract(i,s),s.setTextContent(i.textContent),s.setChecked(i.ariaChecked),s.setAriaDescribedBy(i.ariaDescribedBy),this.setParent(t.params,t.result)}if(kd("region",t)){const{params:i,result:s}=t,n=s.getElement();this.initInteract(i,s),n.role="region",this.setParent(t.params,t.result)}return t.result}initElement(e,t){const i=t.getElement();return La(i,"cursor",e.cursor),i.classList.toggle("ag-charts-proxy-elem",!0),i}initInteract(e,t){const{tabIndex:i,domIndex:s}=e,n=this.initElement(e,t);i!==void 0&&(n.tabIndex=i),s!==void 0&&(t.domIndex=s)}setParent(e,t){if("parent"in e)e.parent?.addChild(t);else{const i={where:e.where,query:".ag-charts-series-area"};this.domManager.addChild("canvas-proxy",e.domManagerId,t.getElement(),i),t.destroyListener=()=>{this.domManager.removeChild("canvas-proxy",e.domManagerId)}}}},zT={ariaInitSeriesArea:"interactive chart",ariaAnnounceHoverDatum:"${datum}",ariaAnnounceChart:"chart, ${seriesCount}[number] series",ariaAnnounceStandaloneChart:"chart, ${caption}",ariaAnnounceHierarchyChart:"hierarchy chart, ${caption}",ariaAnnounceGaugeChart:"gauge chart, ${caption}",ariaAnnounceHierarchyDatum:"level ${level}[number], ${count}[number] children, ${description}",ariaAnnounceFlowProportionLink:"link ${index} of ${count}, from ${from} to ${to}, ${sizeName} ${size}",ariaAnnounceFlowProportionNode:"node ${index} of ${count}, ${description}",ariaDescriptionLegendItem:"Press Space or Enter to toggle visibility",ariaLabelAddHorizontalLine:"Add Horizontal Line",ariaLabelAnnotationsToolbar:"Annotations",ariaLabelAnnotationOptionsToolbar:"Annotation Options",ariaLabelAnnotationSettingsDialog:"Annotation Settings",ariaLabelColor:"Color",ariaLabelColorPicker:"Color picker",ariaLabelColorPickerAlpha:"Transparency",ariaLabelColorPickerHue:"Hue",ariaLabelColorPickerMultiColor:"Multi Color",ariaLabelColorPickerPalette:"Palette",ariaLabelFinancialCharts:"Financial Charts",ariaLabelGaugeTarget:"Target",ariaLabelGaugeValue:"Value",ariaLabelLegend:"Legend",ariaLabelLegendPagination:"Legend Pagination",ariaLabelLegendPagePrevious:"Previous Legend Page",ariaLabelLegendPageNext:"Next Legend Page",ariaLabelLegendItem:"${label}, Legend item ${index}[number] of ${count}[number]",ariaLabelLegendItemUnknown:"Unknown legend item",ariaLabelNavigator:"Navigator",ariaLabelNavigatorRange:"Range",ariaLabelNavigatorMinimum:"Minimum",ariaLabelNavigatorMaximum:"Maximum",ariaLabelRangesToolbar:"Ranges",ariaLabelSettingsTabBar:"Settings",ariaLabelZoomToolbar:"Zoom",ariaRoleDescription2DSlider:"2D slider",ariaValueColorPalette:"s ${s}[percent0to2dp], v ${v}[percent0to2dp]",ariaValueColorPaletteFirstV:"v ${v}[percent0to2dp], s ${s}[percent0to2dp]",ariaValuePanRange:"${min}[percent0to2dp] to ${max}[percent0to2dp]",iconAltTextLineStyleSolid:"Solid",iconAltTextLineStyleDashed:"Long-dashed",iconAltTextLineStyleDotted:"Short-dashed",iconAltTextPositionTop:"Top",iconAltTextPositionCenter:"Center",iconAltTextPositionBottom:"Bottom",iconAltTextAlignLeft:"Left",iconAltTextAlignCenter:"Center",iconAltTextAlignRight:"Right",iconAltTextClose:"Close",overlayLoadingData:"Loading data...",overlayNoData:"No data to display",overlayNoVisibleSeries:"No visible series",overlayUnsupportedBrowser:"Incompatible browser version. Please upgrade your browser.",seriesHistogramTooltipFrequency:"Frequency",seriesHistogramTooltipSum:"${yName} (sum)",seriesHistogramTooltipCount:"${yName} (count)",seriesHistogramTooltipMean:"${yName} (mean)",toolbarSeriesTypeDropdown:"Chart Type",toolbarSeriesTypeOHLC:"OHLC",toolbarSeriesTypeHLC:"HLC",toolbarSeriesTypeHighLow:"High Low",toolbarSeriesTypeCandles:"Candles",toolbarSeriesTypeHollowCandles:"Hollow Candles",toolbarSeriesTypeLine:"Line",toolbarSeriesTypeLineWithMarkers:"Line with Markers",toolbarSeriesTypeStepLine:"Step Line",toolbarAnnotationsTrendLine:"Trend Line",toolbarAnnotationsFibonacciRetracement:"Fib Retracement",toolbarAnnotationsFibonacciRetracementTrendBased:"Fib Trend Based",toolbarAnnotationsHorizontalLine:"Horizontal Line",toolbarAnnotationsVerticalLine:"Vertical Line",toolbarAnnotationsParallelChannel:"Parallel Channel",toolbarAnnotationsDisjointChannel:"Disjoint Channel",toolbarAnnotationsClearAll:"Clear All",toolbarAnnotationsFillColor:"Fill Color",toolbarAnnotationsLineColor:"Line Color",toolbarAnnotationsLineStyle:"Line Style",toolbarAnnotationsLineStrokeWidth:"Line Stroke Width",toolbarAnnotationsSettings:"Settings",toolbarAnnotationsTextColor:"Text Color",toolbarAnnotationsTextSize:"Text Size",toolbarAnnotationsLock:"Lock",toolbarAnnotationsUnlock:"Unlock",toolbarAnnotationsDelete:"Delete",toolbarAnnotationsDragHandle:"Drag Toolbar",toolbarAnnotationsLineAnnotations:"Trend Lines",toolbarAnnotationsFibonacciAnnotations:"Fibonacci",toolbarAnnotationsTextAnnotations:"Text Annotations",toolbarAnnotationsShapeAnnotations:"Arrows",toolbarAnnotationsMeasurerAnnotations:"Measurers",toolbarAnnotationsCallout:"Callout",toolbarAnnotationsComment:"Comment",toolbarAnnotationsNote:"Note",toolbarAnnotationsText:"Text",toolbarAnnotationsArrow:"Arrow",toolbarAnnotationsArrowUp:"Arrow Up",toolbarAnnotationsArrowDown:"Arrow Down",toolbarAnnotationsDateRange:"Date Range",toolbarAnnotationsPriceRange:"Price Range",toolbarAnnotationsDatePriceRange:"Date and Price",toolbarAnnotationsQuickDatePriceRange:"Measure",toolbarRange1Month:"1M",toolbarRange1MonthAria:"1 month",toolbarRange3Months:"3M",toolbarRange3MonthsAria:"3 months",toolbarRange6Months:"6M",toolbarRange6MonthsAria:"6 months",toolbarRangeYearToDate:"YTD",toolbarRangeYearToDateAria:"Year to date",toolbarRange1Year:"1Y",toolbarRange1YearAria:"1 year",toolbarRangeAll:"All",toolbarRangeAllAria:"All",toolbarZoomZoomOut:"Zoom out",toolbarZoomZoomIn:"Zoom in",toolbarZoomPanLeft:"Pan left",toolbarZoomPanRight:"Pan right",toolbarZoomPanStart:"Pan to the start",toolbarZoomPanEnd:"Pan to the end",toolbarZoomReset:"Reset the zoom",contextMenuDownload:"Download",contextMenuToggleSeriesVisibility:"Toggle Visibility",contextMenuToggleOtherSeries:"Toggle Other Series",contextMenuZoomToCursor:"Zoom to here",contextMenuPanToCursor:"Pan to here",contextMenuResetZoom:"Reset zoom",dialogHeaderChannel:"Channel",dialogHeaderLine:"Line",dialogHeaderFibonacciRange:"Fib Retracement",dialogHeaderDateRange:"Date Range",dialogHeaderPriceRange:"Price Range",dialogHeaderDatePriceRange:"Date and Price",dialogHeaderText:"Text",dialogInputAlign:"Align",dialogInputColorPicker:"Color",dialogInputColorPickerAltText:"Text Color",dialogInputFillColorPicker:"Fill",dialogInputFillColorPickerAltText:"Fill Color",dialogInputExtendChannelStart:"Extend channel start",dialogInputExtendChannelEnd:"Extend channel end",dialogInputExtendLineStart:"Extend line start",dialogInputExtendLineEnd:"Extend line end",dialogInputExtendAbove:"Extend above",dialogInputExtendBelow:"Extend below",dialogInputExtendLeft:"Extend left",dialogInputExtendRight:"Extend right",dialogInputReverse:"Reverse",dialogInputShowFill:"Show Fill",dialogInputFontSize:"Size",dialogInputFontSizeAltText:"Font Size",dialogInputLineStyle:"Dash",dialogInputPosition:"Position",dialogInputStrokeWidth:"Weight",dialogInputStrokeWidthAltText:"Line Weight",dialogInputFibonacciBands:"Bands",dialogInputFibonacciBandsAltText:"Fibonacci Bands",inputTextareaPlaceholder:"Add Text",measurerDateRangeBars:"${value}[number] bars",measurerPriceRangeValue:"${value}[number]",measurerPriceRangePercent:"${value}[percent]",measurerVolume:"Vol ${value}",tooltipPaginationStatus:"${index}[number] of ${count}[number]"},q4=/\$\{(\w+)}(?:\[(\w+)])?/gi,w0={number:new Intl.NumberFormat("en-US"),percent:new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}),percent0to2dp:new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:0,maximumFractionDigits:2}),date:new Intl.DateTimeFormat("en-US",{dateStyle:"full"}),time:new Intl.DateTimeFormat("en-US",{timeStyle:"full"}),datetime:new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeStyle:"full"})},Q4=({defaultValue:e,variables:t})=>e?.replaceAll(q4,(i,s,n)=>{const o=t[s],a=n==null?null:w0[n];return n!=null&&a==null&&K.warnOnce(`Format style [${n}] is not supported`),a!=null?a.format(o):typeof o=="number"?w0.number.format(o):o instanceof Date?w0.datetime.format(o):String(o)}),J4=class{constructor(e){this.eventsHub=e,this.localeText=void 0,this.getLocaleText=void 0}setLocaleText(e){this.localeText!==e&&(this.localeText=e,this.eventsHub.emit("locale:change",null))}setLocaleTextFormatter(e){this.getLocaleText=e,this.getLocaleText!==e&&(this.getLocaleText=e,this.eventsHub.emit("locale:change",null))}t(e,t={}){const{localeText:i=zT,getLocaleText:s}=this,n=i[e];return s?.({key:e,defaultValue:n,variables:t})??Q4({key:e,defaultValue:n,variables:t})??e}},N0=class{constructor(e){this.enabled=!0,this.width=600,this.height=300;const{width:t,height:i,canvasElement:s,willReadFrequently:n=!1}=e;this.pixelRatio=e.pixelRatio??qe("devicePixelRatio")??1,this.element=s??De("canvas"),this.element.style.display="block",this.element.style.width=(t??this.width)+"px",this.element.style.height=(i??this.height)+"px",this.element.width=Math.round((t??this.width)*this.pixelRatio),this.element.height=Math.round((i??this.height)*this.pixelRatio),this.context=this.element.getContext("2d",{willReadFrequently:n}),this.onEnabledChange(),this.resize(t??0,i??0,this.pixelRatio),SL(this.context)}drawImage(e,t=0,i=0){return e.drawImage(this.context.canvas,t,i)}toDataURL(e){return this.element.toDataURL(e)}resize(e,t,i){if(!(e>0&&t>0))return;const{element:s,context:n}=this;s.width=Math.round(e*i),s.height=Math.round(t*i),n.setTransform(i,0,0,i,0,0),s.style.width=e+"px",s.style.height=t+"px",this.width=e,this.height=t,this.pixelRatio=i}clear(){vL(this)}destroy(){this.element.remove(),this.element.width=0,this.element.height=0,this.context.clearRect(0,0,0,0),Object.freeze(this)}reset(){this.context.reset(),this.context.verifyDepthZero?.()}onEnabledChange(){this.element&&(this.element.style.display=this.enabled?"":"none")}};M([pl(e=>e.onEnabledChange())],N0.prototype,"enabled",2);var eH=class extends Go{constructor(){super(...arguments),this.cache=new Map,this.imageLoadingCount=0}loadImage(e,t){const i=this.cache.get(e);if(i?.image)return i.image;if(i!=null&&t){i.nodes.add(t);return}if(!t)return;const s={image:void 0,nodes:new Set([t])},n=new Image;return this.imageLoadingCount++,n.onload=()=>{s.image=n;for(const o of s.nodes)o.markDirty();s.nodes.clear(),this.imageLoadingCount--,this.emit("image-loaded",{uri:e})},n.onerror=()=>{this.imageLoadingCount--,s.nodes.clear(),this.emit("image-error",{uri:e})},n.src=e,this.cache.set(e,s),s.image}waitingToLoad(){return this.imageLoadingCount>0}destroy(){for(const e of this.cache.values())e.nodes.clear();this.cache.clear()}},tH=class{constructor(e){this.canvas=e,this.debug=Pe.create(!0,"scene"),this.layersMap=new Map,this.nextLayerId=0}get size(){return this.layersMap.size}resize(e,t,i){this.canvas.resize(e,t,i);for(const{canvas:s}of this.layersMap.values())s.resize(e,t,i)}addLayer(e){const{width:t,height:i,pixelRatio:s}=this.canvas,{name:n}=e,o=new KS({width:t,height:i,pixelRatio:s});return this.layersMap.set(o,{id:this.nextLayerId++,name:n,canvas:o}),this.debug("Scene.addLayer() - layers",this.layersMap),o}removeLayer(e){this.layersMap.has(e)&&(this.layersMap.delete(e),e.destroy(),this.debug("Scene.removeLayer() - layers",this.layersMap))}clear(){for(const e of this.layersMap.values())e.canvas.destroy();this.layersMap.clear()}},Qy=class extends Go{constructor(e){super(),this.debug=Pe.create(!0,"scene"),this.id=hs(this),this.imageLoader=new eH,this.root=null,this.pendingSize=null,this.isDirty=!1,this.cleanup=new St,this.updateDebugFlags(),this.canvas=new N0(e),this.layersManager=new tH(this.canvas),this.cleanup.register(this.imageLoader.on("image-loaded",()=>{this.emit("scene-changed",{})}),this.imageLoader.on("image-error",({uri:t})=>{K.warnOnce(`Unable to load image ${t}`)}))}waitingForUpdate(){return this.imageLoader?.waitingToLoad()??!1}get width(){return this.pendingSize?.[0]??this.canvas.width}get height(){return this.pendingSize?.[1]??this.canvas.height}get pixelRatio(){return this.pendingSize?.[2]??this.canvas.pixelRatio}setContainer(e){const{element:t}=this.canvas;return t.remove(),e.appendChild(t),this}setRoot(e){return this.root===e?this:(this.isDirty=!0,this.root?.setScene(),this.root=e,e&&(e.visible=!0,e.setScene(this)),this)}updateDebugFlags(){Pe.inDevelopmentMode(()=>hr._debugEnabled=!0)}clearCanvas(){this.canvas.clear()}attachNode(e){return this.appendChild(e),()=>e.remove()}appendChild(e){return this.root?.appendChild(e),this}removeChild(e){return e.remove(),this}download(e,t){uG(this.canvas.toDataURL(t),e?.trim()??"image")}getDataURL(e){return this.canvas.toDataURL(e)}resize(e,t,i){return e=Math.round(e),t=Math.round(t),i??(i=this.pixelRatio),e>0&&t>0&&(e!==this.width||t!==this.height||i!==this.pixelRatio)?(this.pendingSize=[e,t,i],this.isDirty=!0,!0):!1}render(e){const{debugSplitTimes:t={start:performance.now()},extraDebugStats:i,seriesRect:s}=e??{},{canvas:n,canvas:{context:o}={},root:a,pendingSize:r,width:l,height:c,pixelRatio:h}=this;if(!o)return;const d=Pe.check("scene:stats","scene:stats:verbose");d&&this.ensureDebugStatsRegistration();const u=performance.now();let p=!1;if(r&&(p=!0,this.layersManager.resize(...r),this.pendingSize=null),a&&!a.visible){this.isDirty=!1;return}let g;if(a instanceof Be&&(g=a.dirty),a!=null&&g===!1&&!this.isDirty){this.debug.check()&&this.debug("Scene.render() - no-op",{tree:$y(a,"console")}),d&&lT(this.layersManager,t,o,void 0,i,s);return}const f={ctx:o,width:l,height:c,devicePixelRatio:h,debugNodes:{}};Pe.check("scene:stats:verbose")&&(f.stats={layersRendered:0,layersSkipped:0,nodesRendered:0,nodesSkipped:0,opsPerformed:0,opsSkipped:0}),D4(f);let x=!1;if((g!==!1||p)&&(x=!0,n.clear()),a&&Pe.check("scene:dirtyTree")){const{dirtyTree:m,paths:v}=cT(a);Pe.create("scene:dirtyTree")("Scene.render() - dirtyTree",{dirtyTree:m,paths:v})}if(a&&x){if(a.visible&&a.preRender(f),this.debug.check()){const m=$y(a,"console");this.debug("Scene.render() - before",{canvasCleared:x,tree:m})}if(a.visible)try{o.save(),a.render(f),o.restore()}catch(m){throw this.canvas.reset(),m}}t["\u270D\uFE0F"]=performance.now()-u,o.verifyDepthZero?.(),this.isDirty=!1,d&&lT(this.layersManager,t,o,f.stats,i,s),k4(o,f.debugNodes),a&&this.debug.check()&&this.debug("Scene.render() - after",{tree:$y(a,"console"),canvasCleared:x})}ensureDebugStatsRegistration(){if(this.releaseDebugStats)return;const e=v4(),t=()=>{e(),this.releaseDebugStats=void 0};this.releaseDebugStats=t,this.cleanup.register(t)}toSVG(){const{root:e,width:t,height:i}=this;if(e!=null)return hr.toSVG(e,t,i)}strip(){const{context:e,pixelRatio:t}=this.canvas;e.setTransform(t,0,0,t,0,0),this.layersManager.clear(),this.setRoot(null),this.isDirty=!1,this.clear()}destroy(){this.strip(),this.canvas.destroy(),this.imageLoader.destroy(),this.cleanup.flush(),dT(),Object.assign(this,{canvas:void 0})}};Qy.className="Scene";var iH=class{constructor(e,t,i){this.eventsHub=e,this.annotationRoot=t,this.fireChartEvent=i,this.mementoOriginatorKey="annotations",this.annotations=[]}createMemento(){return this.annotations}guardMemento(e){return e==null||Ne(e)}restoreMemento(e,t,i){this.annotations=this.cleanData(i??[]).map(s=>{const n=this.getAnnotationTypeStyles(s.type);return st(s,n)}),this.eventsHub.emit("annotations:restore",{annotations:this.annotations})}updateData(e){this.annotations=this.cleanData(e??[])}fireChangedEvent(){this.fireChartEvent({type:"annotations",annotations:Ft([...this.annotations])})}attachNode(e){return this.annotationRoot.append(e),()=>(e.remove(),this)}setAnnotationStyles(e){this.styles=e}getAnnotationTypeStyles(e){return this.styles?.[e]}cleanData(e){for(const t of e)"textAlign"in t&&delete t.textAlign;return e}},FT=(e=>(e[e.CHART_BACKGROUND=0]="CHART_BACKGROUND",e[e.AXIS_BAND_HIGHLIGHT=1]="AXIS_BAND_HIGHLIGHT",e[e.AXIS_GRID=2]="AXIS_GRID",e[e.AXIS=3]="AXIS",e[e.SERIES_AREA_CONTAINER=4]="SERIES_AREA_CONTAINER",e[e.ZOOM_SELECTION=5]="ZOOM_SELECTION",e[e.SERIES_CROSSLINE_RANGE=6]="SERIES_CROSSLINE_RANGE",e[e.SERIES_LAYER=7]="SERIES_LAYER",e[e.AXIS_FOREGROUND=8]="AXIS_FOREGROUND",e[e.SERIES_CROSSHAIR=9]="SERIES_CROSSHAIR",e[e.SERIES_CROSSLINE_LINE=10]="SERIES_CROSSLINE_LINE",e[e.SERIES_ANNOTATION=11]="SERIES_ANNOTATION",e[e.CHART_ANNOTATION=12]="CHART_ANNOTATION",e[e.CHART_ANNOTATION_FOCUSED=13]="CHART_ANNOTATION_FOCUSED",e[e.STATUS_BAR=14]="STATUS_BAR",e[e.SERIES_LABEL=15]="SERIES_LABEL",e[e.LEGEND=16]="LEGEND",e[e.NAVIGATOR=17]="NAVIGATOR",e[e.FOREGROUND=18]="FOREGROUND",e))(FT||{}),sH=class{constructor(e,t){this.eventsHub=e,this.sceneRoot=t,this.axes=new Map,this.axisGridGroup=new Be({name:"Axes-Grids",zIndex:2}),this.axisGroup=new Be({name:"Axes",zIndex:3}),this.axisLabelGroup=new Be({name:"Axes-Labels",zIndex:15}),this.axisCrosslineRangeGroup=new Be({name:"Axes-Crosslines-Range",zIndex:6}),this.axisCrosslineLineGroup=new Be({name:"Axes-Crosslines-Line",zIndex:10}),this.axisCrosslineLabelGroup=new Be({name:"Axes-Crosslines-Label",zIndex:15}),this.sceneRoot.appendChild(this.axisGroup),this.sceneRoot.appendChild(this.axisGridGroup),this.sceneRoot.appendChild(this.axisLabelGroup),this.sceneRoot.appendChild(this.axisCrosslineRangeGroup),this.sceneRoot.appendChild(this.axisCrosslineLineGroup),this.sceneRoot.appendChild(this.axisCrosslineLabelGroup)}updateAxes(e,t){const i={axisNode:this.axisGroup,gridNode:this.axisGridGroup,labelNode:this.axisLabelGroup,crossLineRangeNode:this.axisCrosslineRangeGroup,crossLineLineNode:this.axisCrosslineLineGroup,crossLineLabelNode:this.axisCrosslineLabelGroup};for(const s of e)t.includes(s)||(s.detachAxis(i),s.destroy());for(const s of t)e?.includes(s)||s.attachAxis(i);this.axes.clear();for(const s of t){const n=s.createAxisContext();this.axes.has(n.direction)?this.axes.get(n.direction)?.push(n):this.axes.set(n.direction,[n])}this.eventsHub.emit("axis:change",null)}getAxisContext(e){return this.axes.get(e)??[]}destroy(){this.axes.clear(),this.axisGroup.remove(),this.axisGridGroup.remove()}},Ep=(e=>(e[e.FULL=0]="FULL",e[e.UPDATE_DATA=1]="UPDATE_DATA",e[e.PROCESS_DATA=2]="PROCESS_DATA",e[e.PROCESS_DOMAIN=3]="PROCESS_DOMAIN",e[e.PERFORM_LAYOUT=4]="PERFORM_LAYOUT",e[e.SERIES_UPDATE=5]="SERIES_UPDATE",e[e.PRE_SCENE_RENDER=6]="PRE_SCENE_RENDER",e[e.SCENE_RENDER=7]="SCENE_RENDER",e[e.NONE=8]="NONE",e))(Ep||{}),Jy=class{constructor(e,t,i){this.eventsHub=e,this.caller=t,this.animationManager=i,this.dispatchOnlyLatest=!0,this.dispatchThrottle=0,this.requestThrottle=300,this.isLoadingInitialData=!1,this.isLoadingData=!1,this.freshRequests=[],this.requestCounter=0,this.pendingData=void 0,this.debug=Pe.create(!0,"data-model","data-source"),this.throttledFetch=this.createThrottledFetch(this.requestThrottle),this.throttledDispatch=this.createThrottledDispatch(this.dispatchThrottle)}updateCallback(e){typeof e=="function"&&(this.debug("DataService - updated data source callback"),this.dataSourceCallback=e,this.isLoadingInitialData=!0,this.animationManager.skip(),this.eventsHub.emit("data:source-change",null))}clearCallback(){this.dataSourceCallback=void 0}load(e){const{pendingData:t}=this;if(t!=null&&t.params.windowStart?.valueOf()===e.windowStart?.valueOf()&&t.params.windowEnd?.valueOf()===e.windowEnd?.valueOf()){const i=this.requestCounter++;this.isLoadingInitialData=!1,this.dispatch(i,t.data);return}this.isLoadingData=!0,this.throttledFetch(e)}isLazy(){return this.dataSourceCallback!=null}isLoading(){return this.isLazy()&&(this.isLoadingInitialData||this.isLoadingData)}async getData(){const{latestRequest:e}=this;if(!e)return;const{params:t,fetchRequest:i}=e,s=await i;return{params:t,data:s}}restoreData(e){this.pendingData=e}createThrottledFetch(e){return KC(t=>this.fetch(t).catch(i=>K.error("callback failed",i)),e,{leading:!1,trailing:!0})}createThrottledDispatch(e){return KC((t,i)=>this.dispatch(t,i),e,{leading:!0,trailing:!0})}dispatch(e,t){this.debug(`DataService - dispatching 'data-load' | ${e}`),this.eventsHub.emit("data:load",{data:t})}async fetch(e){"context"in this.caller&&(e.context=this.caller.context);const t=Promise.resolve().then(async()=>{if(!this.dataSourceCallback)throw new Error("DataService - [dataSource.getData] callback not initialised");const i=performance.now(),s=this.requestCounter++;this.debug(`DataService - requesting | ${s}`);let n;try{n=await this.dataSourceCallback(e),this.debug(`DataService - response | ${performance.now()-i}ms | ${s}`)}catch(a){this.debug(`DataService - request failed | ${s}`),K.errorOnce(`DataService - request failed | [${a}]`)}this.isLoadingInitialData=!1;const o=this.freshRequests.indexOf(t);return o===-1||this.dispatchOnlyLatest&&o!==this.freshRequests.length-1?(this.debug(`DataService - discarding stale request | ${s}`),n):(this.freshRequests=this.freshRequests.slice(o+1),this.freshRequests.length===0&&(this.isLoadingData=!1),Array.isArray(n)?this.throttledDispatch(s,n):this.eventsHub.emit("data:error",null),n)});this.latestRequest={params:e,fetchRequest:t},this.freshRequests.push(t),await t}};M([ps({newValue(e){this.throttledDispatch=this.createThrottledDispatch(e)}})],Jy.prototype,"dispatchThrottle",2),M([ps({newValue(e){this.throttledFetch=this.createThrottledFetch(e)}})],Jy.prototype,"requestThrottle",2);var nH=class{constructor(e,t){this.domManager=e,this.updateService=t,this.observers=[]}updateFonts(e){if(!(!e||e.size===0)){this.loadFonts(e);for(const t of e)this.observeFontStatus(t)}}destroy(){for(const e of this.observers)e.disconnect();this.observers=[]}loadFonts(e){const t=Array.from(e).map(o=>encodeURIComponent(o)),i=":wght@100;200;300;400;500;600;700;800;900",s=`${i}&family=`,n=`@import url('https://fonts.googleapis.com/css2?family=${t.join(s)}${i}&display=swap'); +`;this.domManager.addStyles(`google-font-${t.join("-")}`,n)}observeFontStatus(e){const t=globalThis.document.createElement("div");t.style.setProperty("position","absolute"),t.style.setProperty("top","0"),t.style.setProperty("margin","0"),t.style.setProperty("padding","0"),t.style.setProperty("overflow","hidden"),t.style.setProperty("visibility","hidden"),t.style.setProperty("width","auto"),t.style.setProperty("max-width","none"),t.style.setProperty("font-synthesis","none"),t.style.setProperty("font-family",e),t.style.setProperty("font-size","16px"),t.style.setProperty("white-space","nowrap"),t.textContent="UVWxyz",this.domManager.addChild("canvas-container",`font-check-${encodeURIComponent(e)}`,t);const i=new ResizeObserver(s=>{const n=s?.at(0)?.contentBoxSize.at(0)?.inlineSize;n!=null&&n>0&&(Je.clear(),this.updateService.update(4))});i.observe(t),this.observers.push(i)}},em=["bar","line","scatter"],oH=void 0,aH=void 0;aH=oH;var rH=void 0,lH=void 0;lH=rH;var BT=(e=>(e.POINTER="pointer",e.NODE="node",e.CHART="chart",e))(BT||{}),_T=(e=>(e.TOP="top",e.RIGHT="right",e.BOTTOM="bottom",e.LEFT="left",e.TOP_RIGHT="top-right",e.BOTTOM_RIGHT="bottom-right",e.BOTTOM_LEFT="bottom-left",e.TOP_LEFT="top-left",e.CENTER="center",e))(_T||{}),cH=void 0,hH=void 0;hH=cH;var dH=void 0,uH=void 0;uH=dH;var VT=class{constructor(){this.registeredListeners=new Map}addListener(e,t){const i={symbol:Symbol(e),handler:t};return this.registeredListeners.has(e)?this.registeredListeners.get(e).push(i):this.registeredListeners.set(e,[i]),()=>this.removeListener(i.symbol)}removeListener(e){for(const[t,i]of this.registeredListeners.entries()){const s=i.findIndex(n=>n.symbol===e);if(s>=0){i.splice(s,1),i.length===0&&this.registeredListeners.delete(t);break}}}dispatch(e,...t){for(const i of this.getListenersByType(e))try{i.handler(...t)}catch(s){K.errorOnce(s)}}getListenersByType(e){return this.registeredListeners.get(e)??[]}destroy(){this.registeredListeners.clear()}},Pp=new WeakMap;function tm(e,t){const i=JSON.stringify(e,null,0);return Pp.has(t)||Pp.set(t,new Map),Pp.get(t)?.has(i)||Pp.get(t)?.set(i,t(e)),Pp.get(t)?.get(i)}var O0=class{constructor(){this.weak=new WeakMap,this.strong=new Map,this.set=!1,this.value=void 0}};function Rp(e,t){let i=new O0;const s=(...n)=>{let o=i;for(const a of n){const r=typeof a=="object"||typeof a=="symbol"?o.weak:o.strong;let l=r.get(a);l==null&&(l=new O0,r.set(a,l)),o=l}if(o.set)return t?.("hit",e,n),o.value;{const a=e(...n);return o.set=!0,o.value=a,t?.("miss",e,n),a}};return s.reset=()=>{i=new O0},s}function gs(e,t){const i=new Map,s=(...a)=>a.map(r=>typeof r=="object"||typeof r=="symbol"?r:(i.has(r)||i.set(r,{v:r}),i.get(r))),n={},o=new WeakMap;return(...a)=>{const r=a.length===0?[n]:s(...a);let l=o;for(const d of r.slice(0,-1))l.has(d)||l.set(d,new WeakMap),l=l.get(d);const c=r.at(-1);let h=l.get(c);return h?t?.("hit",e,a):(h=e(...a),l.set(c,h),t?.("miss",e,a)),h}}var Oa={millisecond:"%H:%M:%S.%L",second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%e",month:"%b",year:"%Y"},pH={millisecond:"%Y %b %e %H:%M:%S.%L",second:"%Y %b %e %H:%M:%S",minute:"%Y %b %e %H:%M",hour:"%Y %b %e %H:%M",day:"%Y %b %e",month:"%Y %b",year:"%Y"},Fs={year:0,month:1,day:2,hour:3,minute:4,second:5,millisecond:6},gH=/%[-_0]?L/,fH=/%[-_0]?S/,yH=/%[-_0]?M/,mH=/%[-_0]?[HI]/,xH=/^%[-_0]?[de]$/,bH=/^%[-_0]?[Bbm]$/,vH=/^%[-_0]?[Yy]$/;function SH(e,t,i){if(typeof e=="string")return e;e??(e=Oa);const{millisecond:s=Oa.millisecond,second:n=Oa.second,minute:o=Oa.minute,hour:a=Oa.hour,day:r=Oa.day,month:l=Oa.month,year:c=Oa.year}=e,h=Fs[t],d=pH[t],u=i?Fs[i]:-1;if(u=Fs.year&&!vH.test(c)||u=Fs.month&&!bH.test(l)||u=Fs.day&&!xH.test(r))return d;let p;switch(t){case"year":return c;case"month":return u=Fs.hour&&!mH.test(p)||h>=Fs.minute&&!yH.test(p)||h>=Fs.second&&!fH.test(p)||h>=Fs.millisecond&&!gH.test(p))return d;let g;return u{const a=MS.mergeSpecifiers(t,i)??Oa;return MS.getFormatter("date",a,s,n,{truncateDate:o})}),this.formatter=void 0}static mergeSpecifiers(...t){let i;for(const s of t)ft(s)&&ft(i)?i={...i,...s}:i=s;return i}static getFormatter(t,i,s,n="long",{truncateDate:o}={}){if(ft(i)){if(t!=="date"){K.warn("Date formatter configuration is not supported for non-date types.");return}s??(s="millisecond");const a=n==="component"?i?.[s]??Oa[s]:SH(i,s,o);return pp(a)}switch(t){case"number":{const a=TS(i);return a==null?void 0:_C(a)}case"date":return pp(i);case"category":return a=>i.replace("%s",String(a))}}setFormatter(t){this.formatter!==t&&(this.formatter=t,this.formats.clear(),this.dateFormatter.reset(),this.dispatch("format-changed"))}format(t,i,{specifier:s,truncateDate:n}={}){if(i.value==null)return;const{formatter:o}=this;if(o==null)return;if(typeof o=="function"){const c=t(o,i);return c==null?void 0:String(c)}const a=o[i.property];if(a==null)return;if(typeof a=="function"){const c=t(a,i);return c==null||Ne(c)?c:String(c)}else if(i.type==="date"){const{unit:c,style:h}=i;return this.dateFormatter(a,s,c,h,n)?.(i.value)}const r=s??a;if(typeof r!="string")return;let l=this.formats.get(r);return l==null&&(l=MS.getFormatter(i.type,r),this.formats.set(r,l)),l?.(i.value,i.type==="number"?i.fractionDigits:void 0)}defaultFormat(t,{specifier:i,truncateDate:s}={}){const{formatter:n}=this,o=typeof n=="function"?void 0:n?.[t.property];switch(t.type){case"date":{const{unit:a,style:r}=t,l=o!=null&&typeof o!="function"?o:void 0;return this.dateFormatter(l,i,a,r,s)?.(t.value)??String(t.value)}case"number":return Dd(t.value,t.fractionDigits);case"category":return Array.isArray(t.value)?t.value.join(" - "):typeof t.value=="string"?t.value:typeof t.value=="number"?Dd(t.value):String(t.value)}}};function MH(e,t){return i=>Number(e)*(1-i)+Number(t)*i}function GT(e,t){if(typeof e=="string")try{e=mt.fromString(e)}catch{e=mt.fromArray([0,0,0])}if(typeof t=="string")try{t=mt.fromString(t)}catch{t=mt.fromArray([0,0,0])}return i=>mt.mix(e,t,i).toRgbaString()}var E0={};Tn(E0,{easeIn:()=>DH,easeInOut:()=>kH,easeInOutQuad:()=>CH,easeInQuad:()=>IH,easeOut:()=>zp,easeOutQuad:()=>AH,inverseEaseOut:()=>HT,linear:()=>jT});var jT=e=>e,DH=e=>1-Math.cos(e*Math.PI/2),zp=e=>Math.sin(e*Math.PI/2),kH=e=>-(Math.cos(e*Math.PI)-1)/2,IH=e=>e*e,AH=e=>1-(1-e)**2,CH=e=>e<.5?2*e*e:1-(-2*e+2)**2/2,HT=e=>2*Math.asin(e)/Math.PI,im=.2,Ad=["initial","remove","update","add","trailing","end","none"],Fp={initial:{animationDuration:1,animationDelay:0},add:{animationDuration:.25,animationDelay:.75},remove:{animationDuration:.25,animationDelay:0},update:{animationDuration:.5,animationDelay:.25},trailing:{animationDuration:im,animationDelay:1,skipIfNoEarlierAnimations:!0},end:{animationDelay:1+im,animationDuration:0,skipIfNoEarlierAnimations:!0},none:{animationDuration:0,animationDelay:0}},WT=(e=>(e.Loop="loop",e.Reverse="reverse",e))(WT||{});function LH(e){return e.every(t=>t instanceof hr)}function sm(e){return LH(e)?{nodes:e,selections:[]}:{nodes:[],selections:e}}function P0(e,t){return e===t?!0:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((i,s)=>P0(i,t[s])):Ly(e)&&Ly(t)?e.equals(t):ft(e)&&ft(t)?XS(e,t,P0):!1}var $T=class{constructor(e){this.isComplete=!1,this.elapsed=0,this.iteration=0,this.isPlaying=!1,this.isReverse=!1,this.id=e.id,this.groupId=e.groupId,this.autoplay=e.autoplay??!0,this.ease=e.ease??jT,this.phase=e.phase;const t=e.duration??Fp[this.phase].animationDuration;this.duration=t*e.defaultDuration,this.delay=(e.delay??0)*e.defaultDuration,this.onComplete=e.onComplete,this.onPlay=e.onPlay,this.onStop=e.onStop,this.onUpdate=e.onUpdate,this.interpolate=this.createInterpolator(e.from,e.to),this.from=e.from,e.skip===!0&&(this.onUpdate?.(e.to,!1,this),this.onStop?.(this),this.onComplete?.(this),this.isComplete=!0),e.collapsable!==!1&&(this.duration=this.checkCollapse(e,this.duration))}checkCollapse(e,t){return P0(e.from,e.to)?0:t}play(e=!1){this.isPlaying||this.isComplete||(this.isPlaying=!0,this.onPlay?.(this),this.autoplay&&(this.autoplay=!1,e&&this.onUpdate?.(this.from,!0,this)))}stop(){this.isPlaying=!1,this.isComplete||(this.isComplete=!0,this.onStop?.(this))}update(e){if(this.isComplete)return e;!this.isPlaying&&this.autoplay&&this.play(!0);const t=this.elapsed;if(this.elapsed+=e,this.delay>this.elapsed)return 0;const i=this.interpolate(this.isReverse?1-this.delta:this.delta);this.onUpdate?.(i,!1,this);const s=this.delay+this.duration;return this.elapsed>=s?(this.stop(),this.isComplete=!0,this.onComplete?.(this),e-(s-t)):0}get delta(){return this.ease(ve(0,(this.elapsed-this.delay)/this.duration,1))}createInterpolator(e,t){if(typeof t!="object"||Ly(t))return this.interpolateValue(e,t);if(Array.isArray(t)){const s=[];for(let n=0;n{const o=[];for(const a of s)o.push(a(n));return o}}const i=[];for(const s of Object.keys(t)){const n=this.createInterpolator(e[s],t[s]);n!=null&&i.push([s,n])}return s=>{const n={};for(const[o,a]of i)n[o]=a(s);return n}}interpolateValue(e,t){if(!(e==null||t==null)){if(Ly(e))return i=>e[Cy](t,i);try{switch(typeof e){case"number":return MH(e,t);case"string":return GT(e,t);case"boolean":if(e===t)return()=>e;break;case"object":return()=>e;default:throw new Error(`Unable to interpolate values: ${e}, ${t}`)}}catch{}throw new Error(`Unable to interpolate values: ${e}, ${t}`)}}},UT=class{constructor(e){this.maxAnimationTime=e,this.debug=Pe.create(!0,"animation"),this.controllers=new Map,this.stoppedCbs=new Set,this.currentPhase=0,this.phases=new Map(Ad.map(t=>[t,[]])),this.skipAnimations=!1,this.animationTimeConsumed=0,this.isReady=!1}get size(){return this.controllers.size}get consumedTimeMs(){return this.animationTimeConsumed}isActive(){return this.controllers.size>0}getActiveControllers(){return this.phases.get(Ad[this.currentPhase])??[]}checkOverlappingId(e){e!=null&&this.controllers.has(e)&&(this.controllers.get(e).stop(),this.debug(`Skipping animation batch due to update of existing animation: ${e}`),this.skip())}addAnimation(e){if(e.isComplete)return;if(Ad.indexOf(e.phase)=0&&t?.splice(i,1)}progress(e){if(!this.isReady)return;let t=e===0?.01:e;const i=()=>{const c=Ad[this.currentPhase];return{phaseControllers:[...this.getActiveControllers()],phase:c,phaseMeta:Fp[c]}};let{phase:s,phaseControllers:n,phaseMeta:o}=i();const a=()=>Ad[this.currentPhase]==null,r=()=>{for({phase:s,phaseControllers:n,phaseMeta:o}=i();!a()&&n.length===0;)this.currentPhase++,{phase:s,phaseControllers:n,phaseMeta:o}=i(),this.debug(`AnimationBatch - phase changing to ${s}`,{unusedTime:t},n)},l=this.controllers.size;this.debug(`AnimationBatch - ${e}ms; phase ${s} with ${n?.length} of ${l}`);do{const c=t,h=o.skipIfNoEarlierAnimations&&this.animationTimeConsumed===0;let d=0;for(const u of n)h?u.stop():t=Math.min(u.update(c),t),u.isComplete&&(d++,this.removeAnimation(u));this.animationTimeConsumed+=c-t,this.debug(`AnimationBatch - updated ${n.length} controllers; ${d} completed`,n),this.debug(`AnimationBatch - animationTimeConsumed: ${this.animationTimeConsumed}`),r()}while(t>0&&!a());this.animationTimeConsumed>this.maxAnimationTime&&(this.debug("Animation batch exceeded max animation time, skipping",[...this.controllers]),this.stop())}ready(){if(this.isReady)return;this.isReady=!0,this.debug(`AnimationBatch - ready; skipped: ${this.skipAnimations}`,[...this.controllers]);let e=!0;for(const[,t]of this.controllers)if(t.duration>0&&Fp[t.phase].skipIfNoEarlierAnimations!==!0){e=!1;break}if(!e)for(const[,t]of this.controllers)t.autoplay&&t.play(!0)}skip(e=!0){if(this.skipAnimations===!1&&e===!0){for(const t of this.controllers.values())t.stop();this.controllers.clear()}this.skipAnimations=e}play(){for(const e of this.controllers.values())e.play()}stop(){for(const e of this.controllers.values())try{e.stop(),this.removeAnimation(e)}catch(t){K.error("Error during animation stop",t)}this.dispatchStopped()}stopByAnimationId(e){if(e!=null&&this.controllers.has(e)){const t=this.controllers.get(e);t&&(t.stop(),this.removeAnimation(t))}}stopByAnimationGroupId(e){for(const t of this.controllers.values())t.groupId===e&&this.stopByAnimationId(t.id)}dispatchStopped(){for(const e of this.stoppedCbs)e();this.stoppedCbs.clear()}isSkipped(){return this.skipAnimations}getRemainingTime(e){if(!this.isActive())return 0;let t=0;for(const[i,s]of this.phases)s.length!==0&&(e!=null&&e!==i||(t+=Math.max(...s.map(n=>n.isComplete?0:n.delay+n.duration-(n.elapsed??0)))));return t}destroy(){this.stop(),this.controllers.clear()}},KT=(e=>(e[e.Default=32]="Default",e[e.ZoomDrag=16]="ZoomDrag",e[e.Annotations=8]="Annotations",e[e.ContextMenu=4]="ContextMenu",e[e.Animation=2]="Animation",e[e.AnnotationsSelected=1]="AnnotationsSelected",e[e.Clickable=41]="Clickable",e[e.Focusable=34]="Focusable",e[e.Keyable=43]="Keyable",e[e.ContextMenuable=36]="ContextMenuable",e[e.AnnotationsMoveable=9]="AnnotationsMoveable",e[e.AnnotationsDraggable=57]="AnnotationsDraggable",e[e.ZoomDraggable=50]="ZoomDraggable",e[e.ZoomClickable=34]="ZoomClickable",e[e.ZoomWheelable=59]="ZoomWheelable",e[e.All=63]="All",e))(KT||{}),YT=class{constructor(){this.stateQueue=34}pushState(e){this.stateQueue|=e}popState(e){this.stateQueue&=~e}isState(e){return!!(this.stateQueue&-this.stateQueue&e)}};function ZT(e){return e==null?!0:!Number.isNaN(e)&&e>=0&&e<=2}var XT=class{constructor(e,t){this.interactionManager=e,this.chartUpdateMutex=t,this.defaultDuration=1e3,this.maxAnimatableItems=1/0,this.batch=new UT(this.defaultDuration*1.5),this.debug=Pe.create(!0,"animation"),this.events=new Go,this.rafAvailable=typeof requestAnimationFrame<"u",this.isPlaying=!0,this.requestId=null,this.skipAnimations=!0,this.currentAnonymousAnimationId=0,this.cumulativeAnimationTime=0}addListener(e,t){return this.events.on(e,t)}animate(e){const t=this.batch;try{t.checkOverlappingId(e.id)}catch(r){this.failsafeOnError(r);return}let{id:i}=e;i==null&&(i=`__${this.currentAnonymousAnimationId}`,this.currentAnonymousAnimationId+=1);const s=this.isSkipped()||e.phase==="none";s&&this.debug("AnimationManager - skipping animation");const{delay:n,duration:o}=e;if(!ZT(n))throw new Error(`Animation delay of ${n} is unsupported (${i})`);if(!ZT(o))throw new Error(`Animation duration of ${o} is unsupported (${i})`);const a=new $T({...e,id:i,skip:s,autoplay:this.isPlaying?e.autoplay:!1,phase:e.phase,defaultDuration:this.defaultDuration});if(!this.forceTimeJump(a,this.defaultDuration))return this.batch.addAnimation(a),a}play(){if(!this.isPlaying){this.isPlaying=!0,this.debug("AnimationManager.play()");try{this.batch.play()}catch(e){this.failsafeOnError(e)}this.requestAnimation()}}stop(){this.isPlaying=!1,this.cancelAnimation(),this.debug("AnimationManager.stop()"),this.batch.stop()}stopByAnimationId(e){try{this.batch.stopByAnimationId(e)}catch(t){this.failsafeOnError(t)}}stopByAnimationGroupId(e){try{this.batch.stopByAnimationGroupId(e)}catch(t){this.failsafeOnError(t)}}reset(){this.isPlaying?(this.stop(),this.play()):this.stop()}skip(e=!0){this.skipAnimations=e}isSkipped(){return!this.rafAvailable||this.skipAnimations||this.batch.isSkipped()}isActive(){return this.isPlaying&&this.batch.isActive()}getRemainingTime(e){return this.batch.getRemainingTime(e)}getCumulativeAnimationTime(){return this.cumulativeAnimationTime}skipCurrentBatch(){this.debug.check()&&this.debug("AnimationManager - skipCurrentBatch()",{stack:new Error("Stack trace for animation skip tracking").stack}),this.batch.skip()}isSkippingFrames(){return!0}scheduleAnimationFrame(e){this.requestId=qe().requestAnimationFrame(t=>{e(t).catch(i=>K.error(i))})}forceTimeJump(e,t){return!1}requestAnimation(){if(!this.rafAvailable||!this.batch.isActive()||this.requestId!==null)return;let e;const t=async i=>{await this.debug.group("AnimationManager.onAnimationFrame()",async()=>{const s=()=>{const n=i-(e??i);e=i,this.debug("AnimationManager",{controllersCount:this.batch.size,deltaTime:n}),this.interactionManager.pushState(2);try{this.batch.progress(n),this.cumulativeAnimationTime+=n}catch(o){this.failsafeOnError(o)}this.events.emit("animation-frame",{type:"animation-frame",deltaMs:n})};this.isSkippingFrames()?await this.chartUpdateMutex.acquireImmediately(s):await this.chartUpdateMutex.acquire(s),this.batch.isActive()?this.scheduleAnimationFrame(t):(this.batch.stop(),this.events.emit("animation-stop",{type:"animation-stop",deltaMs:this.batch.consumedTimeMs}))})};this.events.emit("animation-start",{type:"animation-start",deltaMs:0}),this.scheduleAnimationFrame(t)}cancelAnimation(){this.requestId!==null&&(cancelAnimationFrame(this.requestId),this.events.emit("animation-stop",{type:"animation-stop",deltaMs:this.batch.consumedTimeMs}),this.requestId=null,this.startBatch())}failsafeOnError(e,t=!0){K.error("Error during animation, skipping animations",e),t&&this.cancelAnimation()}startBatch(e){this.debug(`AnimationManager - startBatch() with skipAnimations=${e}.`),this.reset(),this.batch.destroy(),this.batch=new UT(this.defaultDuration*1.5),e===!0&&this.batch.skip()}endBatch(){this.batch.isActive()?(this.batch.ready(),this.requestAnimation()):(this.interactionManager.popState(2),this.batch.isSkipped()&&this.batch.skip(!1))}onBatchStop(e){this.batch.stoppedCbs.add(e)}destroy(){this.stop(),this.events.clear()}},TH=class{constructor(){this.download={type:"action",showOn:"always",label:"contextMenuDownload",enabled:!0,action:void 0,items:void 0},this["zoom-to-cursor"]={type:"action",showOn:"series-area",label:"contextMenuZoomToCursor",enabled:!0,action:void 0,items:void 0},this["pan-to-cursor"]={type:"action",showOn:"series-area",label:"contextMenuPanToCursor",enabled:!0,action:void 0,items:void 0},this["reset-zoom"]={type:"action",showOn:"series-area",label:"contextMenuResetZoom",enabled:!0,action:void 0,items:void 0},this["toggle-series-visibility"]={type:"action",showOn:"legend-item",label:"contextMenuToggleSeriesVisibility",enabled:!0,action:void 0,items:void 0},this["toggle-other-series"]={type:"action",showOn:"legend-item",label:"contextMenuToggleOtherSeries",enabled:!0,action:void 0,items:void 0},this.separator={type:"separator",showOn:"always",label:"separator",enabled:!0,action:void 0,items:void 0}}},wH=class{constructor(){this.defaults=["download","zoom-to-cursor","pan-to-cursor","reset-zoom","toggle-series-visibility","toggle-other-series"]}},qT=class{constructor(){this.items=new TH,this.lists=new wH}},QT=class{constructor(e){this.eventsHub=e,this.builtins=new qT,this.hiddenActions=new Set,this.toggle("zoom-to-cursor","hide"),this.toggle("pan-to-cursor","hide"),this.toggle("reset-zoom","hide")}static check(e,t){return t.showOn==e}static checkCallback(e,t,i){return e===t}dispatchContext(e,t,i,s){const{widgetEvent:n}=t;if(n.sourceEvent.defaultPrevented)return;const o=s?.x??t.canvasX,a=s?.y??t.canvasY,r={showOn:e,x:o,y:a,context:i,widgetEvent:n};this.eventsHub.emit("context-menu:setup",r),this.eventsHub.emit("context-menu:complete",r)}isVisible(e){return!this.hiddenActions.has(e)}toggle(e,t){switch(t??(t=this.isVisible(e)?"hide":"show"),t){case"show":this.hiddenActions.delete(e);break;case"hide":this.hiddenActions.add(e);break}}},JT=class{constructor(e){this.eventsHub=e,this.highlightStates=new Sd}updateHighlight(e,t){const i=this.getActiveHighlight();this.highlightStates.set(e,t);const s=this.getActiveHighlight();this.isEqual(s,i)||this.eventsHub.emit("highlight:change",{callerId:e,currentHighlight:s,previousHighlight:i})}getActiveHighlight(){return this.highlightStates.stateValue()}isEqual(e,t){return e===t||e!=null&&t!=null&&e?.series===t?.series&&e?.itemId===t?.itemId&&e?.datum===t?.datum}},ew=(e=>(e[e.None=0]="None",e[e.Item=1]="Item",e[e.Series=2]="Series",e[e.OtherSeries=3]="OtherSeries",e[e.OtherItem=4]="OtherItem",e))(ew||{}),nm=[0,1,2,3,4];function Cd(e){const t=i=>i;switch(e){case 1:return"highlighted-item";case 4:return"unhighlighted-item";case 2:return"highlighted-series";case 3:return"unhighlighted-series";case 0:return"none";default:return t(e)}}var yr=class extends Le{};M([C],yr.prototype,"fill",2),M([C],yr.prototype,"fillOpacity",2),M([C],yr.prototype,"stroke",2),M([C],yr.prototype,"strokeWidth",2),M([C],yr.prototype,"strokeOpacity",2),M([C],yr.prototype,"lineDash",2),M([C],yr.prototype,"lineDashOffset",2);var mr=class extends Le{constructor(){super(...arguments),this.enabled=!0,this.range="tooltip",this.bringToFront=!1,this.highlightedItem={},this.unhighlightedItem={},this.highlightedSeries={},this.unhighlightedSeries={}}getItemHighlightStyle(e){switch(e){case 1:return this.highlightedItem;case 4:return this.unhighlightedItem;case 2:return this.highlightedSeries;case 3:return this.unhighlightedSeries}}getSeriesHighlightStyle(e){switch(e){case 1:case 4:case 2:return this.highlightedSeries;case 3:return this.unhighlightedSeries}}getStyle(e){return st(this.getItemHighlightStyle(e),this.getSeriesHighlightStyle(e))}};M([C],mr.prototype,"enabled",2),M([C],mr.prototype,"range",2),M([C],mr.prototype,"bringToFront",2),M([C],mr.prototype,"highlightedItem",2),M([C],mr.prototype,"unhighlightedItem",2),M([C],mr.prototype,"highlightedSeries",2),M([C],mr.prototype,"unhighlightedSeries",2);var om=class extends Le{};M([C],om.prototype,"strokeWidth",2),M([C],om.prototype,"dimOpacity",2),M([C],om.prototype,"enabled",2);var tw=class extends Le{constructor(){super(...arguments),this.color="black"}};M([C],tw.prototype,"color",2);var Yo=class extends Le{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#874349",this.strokeWidth=2,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};M([C],Yo.prototype,"start",2),M([C],Yo.prototype,"stop",2),M([C],Yo.prototype,"fill",2),M([C],Yo.prototype,"fillOpacity",2),M([C],Yo.prototype,"stroke",2),M([C],Yo.prototype,"strokeWidth",2),M([C],Yo.prototype,"strokeOpacity",2),M([C],Yo.prototype,"lineDash",2),M([C],Yo.prototype,"lineDashOffset",2);var Bp=class{constructor(){this.key="x",this.segments=new ud(Yo)}};M([C],Bp.prototype,"enabled",2),M([C],Bp.prototype,"key",2),M([C],Bp.prototype,"segments",2);var gl=class extends Le{constructor(){super(...arguments),this.type="gradient",this.colorStops=[],this.bounds="item",this.gradient="linear",this.rotation=0,this.reverse=!1,this.colorSpace="rgb"}};M([C],gl.prototype,"type",2),M([C],gl.prototype,"colorStops",2),M([C],gl.prototype,"bounds",2),M([C],gl.prototype,"gradient",2),M([C],gl.prototype,"rotation",2),M([C],gl.prototype,"reverse",2),M([C],gl.prototype,"colorSpace",2);var Ti=class extends Le{constructor(){super(...arguments),this.type="pattern",this.colorStops=[],this.bounds="item",this.gradient="linear",this.rotation=0,this.scale=1,this.reverse=!1,this.pattern="forward-slanted-lines",this.width=26,this.height=26,this.padding=6,this.fill="black",this.fillOpacity=1,this.backgroundFill="white",this.backgroundFillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0}};M([C],Ti.prototype,"type",2),M([C],Ti.prototype,"colorStops",2),M([C],Ti.prototype,"bounds",2),M([C],Ti.prototype,"gradient",2),M([C],Ti.prototype,"rotation",2),M([C],Ti.prototype,"scale",2),M([C],Ti.prototype,"reverse",2),M([C],Ti.prototype,"path",2),M([C],Ti.prototype,"pattern",2),M([C],Ti.prototype,"width",2),M([C],Ti.prototype,"height",2),M([C],Ti.prototype,"padding",2),M([C],Ti.prototype,"fill",2),M([C],Ti.prototype,"fillOpacity",2),M([C],Ti.prototype,"backgroundFill",2),M([C],Ti.prototype,"backgroundFillOpacity",2),M([C],Ti.prototype,"stroke",2),M([C],Ti.prototype,"strokeOpacity",2),M([C],Ti.prototype,"strokeWidth",2);var xr=class extends Le{constructor(){super(...arguments),this.type="image",this.url="",this.rotation=0,this.scale=1,this.backgroundFill="black",this.backgroundFillOpacity=1,this.repeat="no-repeat",this.fit="contain"}};M([C],xr.prototype,"type",2),M([C],xr.prototype,"url",2),M([C],xr.prototype,"rotation",2),M([C],xr.prototype,"scale",2),M([C],xr.prototype,"backgroundFill",2),M([C],xr.prototype,"backgroundFillOpacity",2),M([C],xr.prototype,"repeat",2),M([C],xr.prototype,"fit",2);var _p=class extends Le{constructor(e=!0){super(),this.deprecated=e,this.item=new yr,this.series=new om,this.text=new tw}set(e){return this.deprecated&&K.warnOnce("highlightStyle is deprecated, use highlight instead."),super.set(e)}};M([C],_p.prototype,"item",2),M([C],_p.prototype,"series",2),M([C],_p.prototype,"text",2);var ro=class extends Le{constructor(){super(...arguments),this.visible=!0,this.focusPriority=1/0,this.showInLegend=!0,this.cursor="default",this.nodeClickRange="exact",this.highlight=new mr,this.highlightStyle=new _p}handleUnknownProperties(e,t){"context"in t&&(this.context=t.context,e.delete("context"))}};M([C],ro.prototype,"id",2),M([C],ro.prototype,"visible",2),M([C],ro.prototype,"focusPriority",2),M([C],ro.prototype,"showInLegend",2),M([C],ro.prototype,"cursor",2),M([C],ro.prototype,"nodeClickRange",2),M([C],ro.prototype,"highlight",2),M([C],ro.prototype,"highlightStyle",2);function iw(e,t){if(e==null||t.length===0)return[!1,!1];const i=e.valueOf(),s=t[0],n=t.at(-1);if(typeof s=="string")return[i===s,i===n];let o=s.valueOf(),a=n.valueOf();return o>a&&([o,a]=[a,o]),[i===o,i===a]}function am(e,t,i,s,n,o){const[a,r]=iw(t,o),[l,c]=iw(e,n);return{xKey:i,yKey:s,xValue:e,yValue:t,first:l,last:c,min:a,max:r}}function Vp(e,t,[i,s],n){let o=mp(0,t-1,r=>{const l=e===1?r:t-r,c=n(l)?.[1]??Number.NaN;return!Number.isFinite(c)||c>=i})??0,a=kc(0,t-1,r=>{const l=e===1?r:t-r,c=n(l)?.[0]??Number.NaN;return!Number.isFinite(c)||c<=s})??t-1;return e===-1&&([o,a]=[t-a,t-o]),o=Math.max(o,0),a=Math.min(a+1,t),[o,a]}function R0(e,t,i){if(i){const{x:n,y:o,width:a,height:r}=i;return{canvasX:n+a/2,canvasY:o+r/2}}const s=t.yBar?.upperPoint??t.midPoint??e.datumMidPoint?.(t);if(s){const{x:n,y:o}=zt.toCanvasPoint(e.contentGroup,s.x,s.y);return{canvasX:Math.round(n),canvasY:Math.round(o)}}}function sw(e,t,i,s,n){let o=-1,a=0,r=0,l=!1;for(;a=0&&(r+=1),l&&r<0&&(r-=1),ct){l=!0;continue}n(c)&&(a+=1)}return a}function z0(e){const t={};for(const i of nm)t[i]=e(void 0,!1,i);return t}function NH(e,...t){const i={};for(const s of t??["default"])for(const n of nm){const o=i[s]??(i[s]={});o[n]=e(void 0,!1,n,s)}return i}var rm=class{constructor(e,t,i,s){this.domManager=i,this.tooltip=s,this.stateTracker=new Sd,this.suppressState=new Sd(!1),this.appliedState=null,this.cleanup=new St,this.cleanup.register(s.setup(t,i),e.on("dom:hidden",()=>this.tooltip.hide()))}destroy(){this.cleanup.flush()}updateTooltip(e,t,i,s){i??(i=this.stateTracker.get(e)?.content),this.stateTracker.set(e,{meta:t,content:i,pagination:s}),this.applyStates()}removeTooltip(e){this.stateTracker.delete(e),this.applyStates()}suppressTooltip(e){this.suppressState.set(e,!0)}unsuppressTooltip(e){this.suppressState.delete(e)}applyStates(){const e=this.stateTracker.stateId(),t=e?this.stateTracker.get(e):void 0;if(this.suppressState.stateValue()||t?.meta==null||t?.content==null){this.appliedState=null,this.tooltip.hide();return}const i=this.domManager.getBoundingClientRect(),s=this.tooltip.bounds==="extended"?this.domManager.getOverlayClientRect():i;if(Ci(this.appliedState?.content,t?.content)&&Ci(this.appliedState?.pagination,t?.pagination)){const n=this.tooltip.isVisible();this.tooltip.show(s,i,t?.meta,null,void 0,n)}else this.tooltip.show(s,i,t?.meta,t?.content,t?.pagination);this.appliedState=t}static makeTooltipMeta(e,t,i,s){const{canvasX:n,canvasY:o}=e,a=t.properties.tooltip,{placement:r,anchorTo:l,xOffset:c,yOffset:h}=a.position,d=R0(t,i,s);return{canvasX:n,canvasY:o,nodeCanvasX:d?.canvasX??n,nodeCanvasY:d?.canvasY??o,enableInteraction:a.interaction?.enabled??!1,showArrow:a.showArrow,position:{placement:r,anchorTo:l,xOffset:c,yOffset:h}}}},nw=3,OH=505,ow=30;function F0(e,t){const{device:i,offsetX:s,offsetY:n,clientX:o,clientY:a,currentX:r,currentY:l,sourceEvent:c}=t;return{type:e,device:i,offsetX:s,offsetY:n,clientX:o,clientY:a,currentX:r,currentY:l,sourceEvent:c}}function aw(e,t){const i=e*e+t*t,s=nw*nw;return i>=s}function EH(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY,n=i*i+s*s,o=ow*ow;return nt[1]&&(t[1]=i);return t}function Pc(e){const[t,i]=Wi(e);return i-t}function lw(e){return e=Math.trunc(e),e<=0?1:e===1?2:1<<32-Math.clz32(e-1)}function _0(e){return e=Math.trunc(e),e<=0?0:e===1?1:1<<31-Math.clz32(e)}var cw=class kC extends zy{constructor(t=[],i=[]){super(),this.domain=t,this.range=i,this.defaultTickCount=kC.defaultTickCount,this.defaultClamp=!1}static is(t){return t instanceof kC}normalizeDomains(...t){return V0(...t)}calcBandwidth(t=1,i=1){const{domain:s}=this,n=this.getPixelRange();if(s.length===0)return n;let a=Math.abs(s[1].valueOf()-s[0].valueOf())/t+1;if(i!==0){const r=Math.floor(n);a=Math.min(a,r)}return n/Math.max(1,a)}convert(t,i){const{domain:s}=this;if(!s||s.length<2||t==null)return Number.NaN;const{range:n}=this,o=i?.clamp??this.defaultClamp;let a=s[0].valueOf(),r=s[1].valueOf(),l=t.valueOf();if(this.transform&&(a=this.transform(a),r=this.transform(r),l=this.transform(l)),o){const[h,d]=Wi([a,r]);if(ld)return n[1]}if(a===r)return(n[0]+n[1])/2;if(l===a)return n[0];if(l===r)return n[1];const c=n[0];return c+(l-a)/(r-a)*(n[1]-c)}invert(t,i){const{domain:s}=this;if(s.length<2)return;let n=s[0].valueOf(),o=s[1].valueOf();this.transform&&(n=this.transform(n),o=this.transform(o));const{range:a}=this,[r,l]=a;let c;return r===l?c=this.toDomain((n+o)/2):c=this.toDomain(n+(t-r)/(l-r)*(o-n)),this.transformInvert?this.transformInvert(c):c}getPixelRange(){const[t,i]=this.range;return Math.abs(i-t)}};cw.defaultTickCount=5;var ut=cw;function V0(...e){let t,i=1/0,s,n=-1/0;for(const o of e)for(const a of o){const r=a.valueOf();rn&&(n=r,s=a)}return t!=null&&s!=null?{domain:[t,s],animatable:!0}:{domain:[],animatable:!1}}var G0=class SV extends zy{constructor(){super(...arguments),this.invalid=!0,this.range=[0,1],this.round=!1,this._bandwidth=1,this._step=1,this._inset=1,this._rawBandwidth=1,this._paddingInner=0,this._paddingOuter=0}static is(t){return t instanceof SV}get bandwidth(){return this.refresh(),this._bandwidth}get step(){return this.refresh(),this._step}get inset(){return this.refresh(),this._inset}get rawBandwidth(){return this.refresh(),this._rawBandwidth}set padding(t){t=ve(0,t,1),this._paddingInner=t,this._paddingOuter=t}get padding(){return this._paddingInner}set paddingInner(t){this.invalid=!0,this._paddingInner=ve(0,t,1)}get paddingInner(){return this._paddingInner}set paddingOuter(t){this.invalid=!0,this._paddingOuter=ve(0,t,1)}get paddingOuter(){return this._paddingOuter}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&K.warnOnce("Expected update to not invalidate scale"))}convert(t,i){this.refresh();const s=this.findIndex(t,i?.alignment);return s==null||s<0||s>=this.bands.length?Number.NaN:this.ordinalRange(s)}invertNearestIndex(t){this.refresh();const i=this.bands.length;if(i===0)return-1;let s=0,n=i-1,o=1/0,a=0;for(;s<=n;){const r=Math.trunc((n+s)/2),l=this.ordinalRange(r),c=Math.abs(l-t);if(c===0)return r;c0,h=c?Math.floor(l):l;let d=t+(r-h*(a-s))/2,u=h*(1-s);c&&(d=Math.round(d),u=Math.round(u)),this._step=h,this._inset=d,this._bandwidth=u,this._rawBandwidth=l*(1-s)}ordinalRange(t){const{_inset:i,_step:s,range:n}=this,o=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return ve(o,i+s*t,a)}};M([kp],G0.prototype,"range",2),M([kp],G0.prototype,"round",2);var br=G0,Zo=class MV extends br{static is(t){return t instanceof MV}toDomain(t){return new Date(t)}get reversed(){const{domain:t}=this;return t.length>0&&t[0].valueOf()>t.at(-1).valueOf()}convert(t,i){this.refresh(),t instanceof Date||(t=new Date(t));const{domain:s,bands:n,reversed:o}=this;if(s.length<=0)return Number.NaN;const a=this.ordinalRange(0),r=this.ordinalRange(n.length-1);if(n.length===0)return a;if(i?.clamp===!0){const{range:v}=this;if(tn.at(-1))return v[1]}if((i?.alignment??0)!==2){const v=super.convert(t,i);return o?r-(v-a):v}const c=t.valueOf();let h=this.findIndex(t)??0,d;o?(h=Math.min(Math.max(h,1),n.length-1),d=-1):(h=Math.min(Math.max(h,0),n.length-2),d=1);const u=n[h].valueOf(),p=n[h+d].valueOf(),g=this.ordinalRange(h),f=this.ordinalRange(h+d),m=(c-u)/(p-u)*(f-g)+g;return o?r-(m-a):m}invert(t,i=!1){this.refresh();const{domain:s,bands:n}=this;if(s.length<=0)return;const o=s[0].valueOf()>s.at(-1).valueOf();let a;return i?a=this.invertNearestIndex(t-this.bandwidth/2):a=mp(0,n.length-1,l=>this.ordinalRange(l)>=t)??n.length-1,n[o?n.length-1-a:a]}findIndex(t,i=0){const{bands:s}=this,n=t.valueOf();return i===1?mp(0,s.length-1,o=>s[o].valueOf()>=n):kc(0,s.length-1,o=>s[o].valueOf()<=n)}},Gp={bottomCenter:_H,center:BH,clone:HH,collides:WH,end:zH,from:$H,height:GH,round:jH,start:RH,topCenter:FH,origin:UH,width:VH};function RH(e){return{x:e.x1,y:e.y1}}function zH(e){return{x:e.x2,y:e.y2}}function FH(e){return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)}}function BH(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}}function _H(e){return{x:(e.x1+e.x2)/2,y:Math.max(e.y1,e.y2)}}function VH(e){return Math.abs(e.x2-e.x1)}function GH(e){return Math.abs(e.y2-e.y1)}function jH(e){return{x1:Math.round(e.x1),y1:Math.round(e.y1),x2:Math.round(e.x2),y2:Math.round(e.y2)}}function HH(e){return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}function WH(e,t){const i=j0(e),s=j0(t);return i.x1<=s.x2&&i.x2>=s.x1&&i.y1<=s.y2&&i.y2>=s.y1}function j0(e){return{x1:Math.min(e.x1,e.x2),x2:Math.max(e.x1,e.x2),y1:Math.min(e.y1,e.y2),y2:Math.max(e.y1,e.y2)}}function $H(e,t,i,s){if(typeof e=="number")return{x1:e,y1:t,x2:i,y2:s};if("width"in e)return j0({x1:e.x,y1:e.y,x2:e.x+e.width,y2:e.y+e.height});throw new Error(`Values can not be converted into a vector4: [${JSON.stringify(e)}] [${t}] [${i}] [${s}]`)}function UH(){return{x1:0,y1:0,x2:0,y2:0}}function lm(e,t,i,s,n){return t+(s-t)*((n-e)/(i-e))}function hw(e,t,i,s,n){return e+(n-t)*((i-e)/(s-t))}function dw(e,t,i){return[hw(e,i.min,t,i.max,0),hw(e,i.min,t,i.max,1)]}function KH(e,t,i){const[s,n]=dw(e.x1,e.x2,t),[o,a]=dw(e.y1,e.y2,i);return{x1:s,x2:n,y1:o,y2:a}}function uw(e,t,i,s,n,o){if(i<=n&&o<=s)return i;const a=n-i,r=o-s,l=Math.abs(a)Ze((t,{options:i})=>!ut.is(e?.scale)&&!Zo.is(e?.scale)||t==null||i.end==null?!0:t{this.didLayoutAxes=!0;const{pendingMemento:i}=this;i&&this.restoreMemento(i.version,i.mementoVersion,i.memento),this.autoScaleYZoom("zoom-manager")}))}createMemento(){return this.getMementoRanges()}guardMemento(e,t){if(e==null)return!0;if(!Ee(e))return!1;const i=this.getPrimaryAxis("x"),s=this.getPrimaryAxis("y"),n={rangeX:{start:gw(i),end:ke},rangeY:{start:gw(s),end:ke},ratioX:{start:ke,end:ke},ratioY:{start:ke,end:ke},autoScaledAxes:ke},{invalid:o}=cs(e,n);return o.length>0?(t.push(...o.map(String)),!1):!0}restoreMemento(e,t,i){const{independentAxes:s}=this;if(!this.axes||!this.didLayoutAxes){this.pendingMemento={version:e,mementoVersion:t,memento:i};return}this.pendingMemento=void 0;const n=this.getDefinedZoom();if(i?.rangeX?n.x=this.rangeToRatio(i.rangeX,"x")??{min:0,max:1}:i?.ratioX?n.x={min:i.ratioX.start??0,max:i.ratioX.end??1}:n.x={min:0,max:1},!this.navigatorModule||this.zoomModule){let r=i?.autoScaledAxes?.includes("y");if(i?.rangeY)r??(r=!1),n.y=this.rangeToRatio(i.rangeY,"y")??{min:0,max:1};else if(i?.ratioY)r??(r=!1),n.y={min:i.ratioY.start??0,max:i.ratioY.end??1};else{r??(r=!0);const l=r?this.getAutoScaleYZoom(n.x):void 0;n.y=l??{min:0,max:1}}n.autoScaleYAxis=r}if(this.lastRestoredState=n,s!==!0){this.updateZoom("zoom-manager",n);return}const o=this.getPrimaryAxis("x"),a=this.getPrimaryAxis("y");for(const r of[o,a])r&&this.updateAxisZoom("zoom-manager",r.id,n[r.direction])}updateAxes(e){const{axes:t,axisZoomManagers:i}=this,s=new Map(i);i.clear(),t.length=0;for(const n of e)typeof n=="string"?i.set(n,s.get(n)??new yw(n)):(t.push(n),i.set(n.id,s.get(n.id)??new yw(n)));this.state.size>0&&t.length>0&&this.updateZoom(this.state.stateId(),this.state.stateValue())}setIndependentAxes(e=!0){this.independentAxes=e}setAutoScaleYAxis(e,t){this.autoScaleYAxis.enabled=e,this.autoScaleYAxis.padding=t,e&&this.autoScaleYZoom("toggle-auto-scale")}setNavigatorEnabled(e=!0){this.navigatorModule=e}setZoomModuleEnabled(e=!0){this.zoomModule=e}isNavigatorEnabled(){return this.navigatorModule}isZoomEnabled(){return this.zoomModule}updateZoom(e,t){if(t?.x&&(t.x.min<0||t.x.max>1)&&(K.warnOnce(`Attempted to update x-axis zoom to an invalid ratio of [{ min: ${t.x.min}, max: ${t.x.max} }], expecting a ratio of 0 to 1, ignoring.`),t.x=void 0),t?.y&&(t.y.min<0||t.y.max>1)&&(K.warnOnce(`Attempted to update y-axis zoom to an invalid ratio of [{ min: ${t.y.min}, max: ${t.y.max} }], expecting a ratio of 0 to 1, ignoring.`),t.y=void 0),this.axisZoomManagers.size===0){const s=this.state.stateId();(s==="initial"||s===e)&&this.state.set(e,t);return}this.state.set(e,t);const i=t?.autoScaleYAxis;i!=null&&(this.autoScaleYAxis.manuallyAdjusted=!i);for(const s of this.axisZoomManagers.values())s.updateZoom(e,t?.[s.direction]);this.applyChanges(e)}updateAxisZoom(e,t,i){this.axisZoomManagers.get(t)?.updateZoom(e,i),this.applyChanges(e)}resetZoom(e){this.autoScaleYAxis.manuallyAdjusted=!1;const t=this.getRestoredZoom();this.updateZoom(e,{x:{min:t?.x?.min??0,max:t?.x?.max??1},y:{min:t?.y?.min??0,max:t?.y?.max??1},autoScaleYAxis:t?.autoScaleYAxis??!0})}resetAxisZoom(e,t){const s=this.axisZoomManagers.get(t)?.direction;if(s==null)return;const n=this.getRestoredZoom();if(s==="y"){const o=n?.autoScaleYAxis??!0;this.autoScaleYAxis.manuallyAdjusted=!o}for(const o of this.axes)o.direction===s&&this.updateAxisZoom(e,o.id,n?.[s]??{min:0,max:1})}setAxisManuallyAdjusted(e,t){this.axisZoomManagers.get(t)?.direction==="y"&&(this.autoScaleYAxis.manuallyAdjusted=!0)}updatePrimaryAxisZoom(e,t,i){const s=this.getPrimaryAxis(t);s&&this.updateAxisZoom(e,s.id,i)}panToBBox(e,t,i){if(!this.isZoomEnabled()&&!this.isNavigatorEnabled())return!1;const s=this.getZoom();if(s===void 0||!s.x&&!s.y)return!1;if(!(t.width>0&&t.height>0&&Math.abs(i.width)<=Math.abs(t.width)&&Math.abs(i.height)<=Math.abs(t.height)))return K.warnOnce("cannot pan to target BBox - chart too small?"),!1;const o=YH(t,s,i);return this.independentAxes?(this.updatePrimaryAxisZoom(e,"x",o.x),this.updatePrimaryAxisZoom(e,"y",o.y)):this.updateZoom(e,o),!0}fireZoomPanStartEvent(e){this.eventsHub.emit("zoom:pan-start",{callerId:e})}extendToEnd(e,t,i){return this.extendWith(e,t,s=>Number(s)-i)}extendWith(e,t,i){const s=this.getPrimaryAxis(t);if(!s)return;const n=this.getDomainExtents(s);if(!n)return;const[,o]=n,a=i(o),r=this.rangeToRatio({start:a},t);r&&this.updateZoom(e,{[t]:r})}updateWith(e,t,i){const s=this.getPrimaryAxis(t);if(!s)return;const n=this.getDomainExtents(s);if(!n)return;let[o,a]=n;[o,a]=i(o,a);const r=this.rangeToRatio({start:o,end:a},t);r&&this.updateZoom(e,{[t]:r})}getZoom(){let e,t;for(const i of this.axisZoomManagers.values())i.direction==="x"?e??(e=i.getZoom()):i.direction==="y"&&(t??(t=i.getZoom()));if(e||t)return{x:e,y:t}}getAxisZoom(e){return this.axisZoomManagers.get(e)?.getZoom()??{min:0,max:1}}getAxisZooms(){const e={};for(const[t,i]of this.axisZoomManagers.entries())e[t]={direction:i.direction,zoom:i.getZoom()};return e}getRestoredZoom(){return this.lastRestoredState}getPrimaryAxisId(e){return this.getPrimaryAxis(e)?.id}getBoundSeries(){const e=this.getPrimaryAxis("x"),t=this.getPrimaryAxis("y");let i;if(this.independentAxes){const s=new Set(e?.boundSeries??[]),n=new Set(t?.boundSeries??[]);i=new Set;for(const o of s)n.has(o)&&i.add(o)}else i=new Set([...e?.boundSeries??[],...t?.boundSeries??[]]);return i}constrainZoomToItemCount(e,t){const{autoScaleYAxis:i}=this,s=i.enabled&&!i.manuallyAdjusted;let n=[e.x.min,e.x.max],o=s?void 0:[e.y.min,e.y.max];for(const l of this.getBoundSeries()){const c=l.getZoomRangeFittingItems(n,o,t);if(c==null)return;n=c.x,o=c.y}const a={min:n[0],max:n[1]};let r;if(r??(r=this.getAutoScaleYZoom(a)),o&&(r={min:o[0],max:o[1]}),r!=null)return{x:a,y:r}}isVisibleItemsCountAtLeast(e,t,i){const{autoScaleYAxis:s}=this,n=this.getBoundSeries(),o=[e.x.min,e.x.max],a=!i&&s.enabled&&!s.manuallyAdjusted?void 0:[e.y.min,e.y.max];let r=0;for(const l of n){const c=t-(r??0),h=l.getVisibleItems(o,a,c);if(r+=h,r>=t)return!0}return n.size===0}getMementoRanges(){const e=this.getDefinedZoom();let t;return this.autoScaleYAxis.enabled&&(t=this.autoScaleYAxis.manuallyAdjusted?[]:["y"]),{rangeX:this.getRangeDirection(e.x,"x"),rangeY:this.getRangeDirection(e.y,"y"),ratioX:{start:e.x.min,end:e.x.max},ratioY:{start:e.y.min,end:e.y.max},autoScaledAxes:t}}getAutoScaleYZoom(e){if(!this.isZoomEnabled())return;const{independentAxes:t,autoScaleYAxis:i}=this;if(!i.enabled||i.manuallyAdjusted)return;const{padding:s}=i;let n;return t?n=this.primaryAxisZoom("y",e,{padding:s}):n=this.combinedAxisZoom("y",e,{padding:s}),e.min===0&&e.max===1?n==null?void 0:{min:0,max:1}:n}autoScaleYZoom(e,t=!0){const{independentAxes:i}=this,s=this.getZoom();if(s?.x==null)return;const n=this.getAutoScaleYZoom(s.x);if(!(n==null||Ci(s.y,n))){if(i){const o=this.getPrimaryAxis("y");(o==null?void 0:this.axisZoomManagers.get(o.id))?.updateZoom("zoom-manager",n)}else for(const o of this.axisZoomManagers.values())o.direction==="y"&&o.updateZoom("zoom-manager",n);t&&this.applyChanges(e)}}applyChanges(e){if(this.autoScaleYZoom(e,!1),!Array.from(this.axisZoomManagers.values(),s=>s.applyChanges()).includes(!0))return;const i={};for(const[s,n]of this.axisZoomManagers.entries())i[s]=n.getZoom();this.eventsHub.emit("zoom:change",{...this.getZoom(),axes:i,callerId:e}),this.eventsHub.on("layout:complete",this.boundFireOnceChartEvent)}fireOnceChartEvent(){this.fireChartEvent({type:"zoom",...this.getMementoRanges()}),this.eventsHub.off("layout:complete",this.boundFireOnceChartEvent)}getRangeDirection(e,t){const i=this.getPrimaryAxis(t);if(!i||!ut.is(i.scale)&&!Zo.is(i.scale))return;const s=this.getDomainPixelExtents(i);if(!s)return;const[n,o]=s;let a,r;return n<=o?(a=i.scale.invert(0),r=i.scale.invert(n+(o-n)*e.max)):(a=i.scale.invert(n-(n-o)*e.min),r=i.scale.invert(0)),{start:a,end:r}}rangeToRatio(e,t){const i=this.getPrimaryAxis(t);if(!i)return;const s=this.getDomainPixelExtents(i);if(!s)return;const[n,o]=s,{scale:a}=i,{start:r,end:l}=e,[c=0,h=1]=pw(r,l);let d=r==null?n:a.convert(r,{alignment:c}),u=l==null?o:a.convert(l,{alignment:h})+(a.bandwidth??0);if(!Ye(d)||!Ye(u))return;const[p,g]=[Math.min(n,o),Math.max(n,o)];if(dg){K.warnOnce(`Invalid range start [${r}], expecting a value between [${a.invert(n)}] and [${a.invert(o)}], ignoring.`);return}if(ug){K.warnOnce(`Invalid range end [${l}], expecting a value between [${a.invert(n)}] and [${a.invert(o)}], ignoring.`);return}d=Math.min(g,Math.max(p,d)),u=Math.min(g,Math.max(p,u));const f=o-n;if(f===0)return;const x=Math.abs((d-n)/f),m=Math.abs((u-n)/f);if(!(x>=m))return{min:x,max:m}}getPrimaryAxis(e){return this.axes?.find(t=>t.direction===e)}getDomainExtents(e){const{domain:t}=e.scale,i=t.at(0),s=t.at(-1);if(!(i==null||s==null))return[i,s]}getDomainPixelExtents(e){const[t,i]=e.scale.range;if(!(!Ye(t)||!Ye(i)))return[t,i]}getDefinedZoom(){const e=this.getZoom();return{x:{min:e?.x?.min??0,max:e?.x?.max??1},y:{min:e?.y?.min??0,max:e?.y?.max??1}}}zoomBounds(e,t,i,s){const n=e.scale,o=n.range;n.range=[0,1];const a=t.scale,r=a.range;a.range=[0,1];let l=1,c=!1,h=0,d=!1;for(const g of t.boundSeries){if(!g.visible)continue;const{connectsToYAxis:f}=g,x=g.getRange("y",[i.min,i.max]);for(const m of x){const v=a.convert(m);Number.isFinite(v)&&(vh&&(h=v,d=!f||m>0))}}if(Ye(t.min)&&(l=0),Ye(t.max)&&(h=1),n.range=o,a.range=r,l>=h)return;const u=(c?s:0)+(d?s:0),p=Math.min((h-l)*(1+u),1);if(!(p<=0)){if(c&&d){const g=(h+l)/2;l=g-p/2,h=g+p/2}else!c&&d?h=l+p:c&&!d&&(l=h-p);return l<0?(h+=-l,l=0):h>1&&(l-=h-1,h=1),{min:l,max:h}}}primaryAxisZoom(e,t,{padding:i=0}={}){const s=e==="x"?"y":"x",n=this.getPrimaryAxis(s),o=this.getPrimaryAxis(e);if(!(n==null||o==null))return this.zoomBounds(n,o,t,i)}combinedAxisZoom(e,t,{padding:i=0}={}){const s=e==="x"?"y":"x",n=new Map;for(const l of this.axes)if(l.direction===s)for(const c of l.boundSeries)n.set(c,l);let o=1,a=0;for(const l of this.axes)if(l.direction===e)for(const c of l.boundSeries){const h=n.get(c);if(h==null)continue;const d=this.zoomBounds(h,l,t,i);if(d==null)return;o=Math.min(o,d.min),a=Math.max(a,d.max)}const r=1e-6;if(o1-r&&(a=1),!(o>a))return{min:o,max:a}}},yw=class{constructor(e){let t,i;typeof e=="string"?(this.direction=e,t=0,i=1):(this.direction=e.direction,[t=0,i=1]=e.visibleRange),this.state=new Sd({min:t,max:i}),this.currentZoom=this.state.stateValue()}updateZoom(e,t){this.state.set(e,t)}getZoom(){return Ft(this.state.stateValue())}hasChanges(){const e=this.currentZoom,t=this.state.stateValue();return e.min!==t.min||e.max!==t.max}applyChanges(){const e=this.hasChanges();return this.currentZoom=this.state.stateValue(),e}},H0=(e=>(e[e.Caption=0]="Caption",e[e.Legend=1]="Legend",e[e.ToolbarLeft=2]="ToolbarLeft",e[e.ToolbarBottom=3]="ToolbarBottom",e[e.Navigator=4]="Navigator",e[e.Overlay=5]="Overlay",e))(H0||{}),mw=class{constructor(e){this.eventsHub=e,this.elements=new Map}registerElement(e,t){return this.elements.has(e)?this.elements.get(e).add(t):this.elements.set(e,new Set([t])),()=>this.elements.get(e)?.delete(t)}createContext(e,t){const i=new XH(e,t);for(const s of Object.values(H0)){if(typeof s!="number")continue;const n=this.elements.get(s);if(n)for(const o of n)o(i)}return i}emitLayoutComplete(e,t){const{width:i,height:s}=e;this.eventsHub.emit("layout:complete",{axes:t.axes??[],chart:{width:i,height:s},clipSeries:t.clipSeries??!1,series:t.series})}},XH=class{constructor(e,t){this.width=e,this.height=t,this.layoutBox=new de(0,0,e,t)}};function qH({point:e,anchor:t},i,s,n,o){if(e.size===0)return!1;let a=e.x,r=e.y;t!=null&&(a-=(t.x-.5)*e.size,r-=(t.y-.5)*e.size);let l=a;ai+n&&(l=i+n);let c=r;rs+o&&(c=s+o);const h=a-l,d=r-c;return Math.hypot(h,d)<=e.size/2}function QH(e){return e!=null&&typeof e.point=="object"&&typeof e.label=="object"}var JH={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0},"top-left":{x:-1,y:-1},"top-right":{x:1,y:-1},"bottom-left":{x:-1,y:1},"bottom-right":{x:1,y:1}};function eW(e,t,i=5){const s=new Map,n=[],o=new Map(Array.from(e.entries(),([r,l])=>[r,l.toSorted((c,h)=>h.point.size-c.point.size)])),a=[...o.values()].flat();for(const[r,l]of o.entries()){const c=[];if(l[0]?.label){for(let h=0,d=l.length;h0&&u.placement!=null){const A=JH[u.placement];S=(m/2+b+i)*A.x,D=(v/2+b+i)*A.y}let L=p.x-m/2+S,I=p.y-v/2+D;if(f&&(L-=(f.x-.5)*p.size,I-=(f.y-.5)*p.size),WS(t,L,I,m,v)&&!a.some(A=>qH(A,L,I,m,v))&&!n.some(A=>aL(A,L,I,m,v))){const A={index:h,text:x,x:L,y:I,width:m,height:v,datum:u};c.push(A),n.push(A)}}s.set(r,c)}}return s}var tW=class{constructor(){this.labelData=new Map}updateLabels(e,t,i=de.zero){const s={x:-t.left,y:-t.top,width:i.width+t.left+t.right,height:i.height+t.top+t.bottom},n=new Set(e.map(a=>a.id));for(const a of this.labelData.keys())n.has(a)||this.labelData.delete(a);for(const a of e){const r=a.getLabelData();r.every(QH)&&this.labelData.set(a.id,r)}const o=eW(this.labelData,s,5);for(const a of e)a.updatePlacedLabelData?.(o.get(a.id)??[])}},iW=class{constructor(e){this.eventsHub=e,this.mementoOriginatorKey="legend",this.legendDataMap=new Map}createMemento(){return this.getData().filter(({hideInLegend:e,isFixed:t})=>!e&&!t).map(({enabled:e,seriesId:t,itemId:i,legendItemName:s})=>({visible:e,seriesId:t,itemId:i,legendItemName:s}))}guardMemento(e){return e==null||Ne(e)}restoreMemento(e,t,i){if(i)for(const s of i){const{seriesId:n,data:o}=this.getRestoredData(s)??{};!n||!o||this.updateData(n,o)}this.update()}getRestoredData(e){const{seriesId:t,itemId:i,legendItemName:s,visible:n}=e;if(t){const a=(this.legendDataMap.get(t)??[]).map(r=>{const l=r.seriesId===t&&(!i||r.itemId===i);return l&&r.isFixed&&this.warnFixed(r.seriesId,r.itemId),!r.isFixed&&l?{...r,enabled:n}:r});return{seriesId:t,data:a}}if(!(i==null&&s==null))for(const o of this.getData()){if(i!=null&&o.itemId!==i||s!=null&&o.legendItemName!==s)continue;if(o.isFixed){this.warnFixed(o.seriesId,i);return}const a=(this.legendDataMap.get(o.seriesId)??[]).map(r=>r.itemId===i||r.legendItemName===s?{...r,enabled:n}:r);return{seriesId:o.seriesId,data:a}}}warnFixed(e,t){K.warnOnce(`The legend item with seriesId [${e}] and itemId [${t}] is not configurable, this series item cannot be toggled through the legend.`)}update(e){this.eventsHub.emit("legend:change",{legendData:e??this.getData()})}updateData(e,t=[]){this.eventsHub.emit("legend:change-partial",{seriesId:e,legendData:t}),this.legendDataMap.set(e,t)}clearData(){this.legendDataMap.clear()}toggleItem(e,t,i,s){if(s){for(const r of this.getData()){const l=(this.legendDataMap.get(r.seriesId)??[]).map(c=>c.legendItemName===s?{...c,enabled:e}:c);this.updateData(r.seriesId,l)}return}const n=this.getData(t),o=n.length===1,a=n.map(r=>i==null&&o||r.itemId===i?{...r,enabled:e}:r);this.updateData(t,a)}getData(e){return e?this.legendDataMap.get(e)??[]:[...this.legendDataMap].reduce((t,[i,s])=>t.concat(s),[])}getDatum({seriesId:e,itemId:t}={}){return this.getData(e).find(i=>i.itemId===t)}getSeriesEnabled(e){const t=this.getData(e);if(t.length>0)return t.some(i=>i.enabled)}getItemEnabled({seriesId:e,itemId:t}={}){return this.getDatum({seriesId:e,itemId:t})?.enabled??!0}},sW=class{updateCallback(e){this.resolvePartialCallback=e}resolvePartial(e,t,i){return this.resolvePartialCallback?.(e,t,i)}},nW=class{constructor(){this.groups=new Map}registerSeries({internalId:e,seriesGrouping:t,visible:i,type:s}){if(!t)return;let n=this.groups.get(s);n==null&&(n=new Map,this.groups.set(s,n)),n.set(e,{grouping:t,visible:i})}updateSeries({internalId:e,seriesGrouping:t,visible:i,type:s}){if(!t)return;const n=this.groups.get(s)?.get(e);n&&(n.grouping=t,n.visible=i)}deregisterSeries({internalId:e,type:t}){const i=this.groups.get(t);i!=null&&(i.delete(e),i.size===0&&this.groups.delete(t))}getVisiblePeerGroupIndex({type:e,seriesGrouping:t,visible:i}){if(!t)return{visibleGroupCount:i?1:0,visibleSameStackCount:i?1:0,index:0};const s=new Set,n=new Set,o=this.groups.get(e);for(const r of o?.values()??[])r.visible&&(s.add(r.grouping.groupIndex),r.grouping.groupIndex===t.groupIndex&&n.add(r.grouping.stackIndex));const a=Array.from(s);return a.sort((r,l)=>r-l),{visibleGroupCount:a.length,visibleSameStackCount:n.size,index:a.indexOf(t.groupIndex)}}},xw=class{constructor(e){this.updateCallback=e,this.events=new Go}addListener(e,t){return this.events.on(e,t)}destroy(){this.events.clear()}update(e=0,t){this.updateCallback(e,t)}dispatchUpdateComplete(e){this.events.emit("update-complete",{type:"update-complete",apiUpdate:e})}dispatchPreDomUpdate(){this.events.emit("pre-dom-update",{type:"pre-dom-update"})}dispatchPreSceneRender(){this.events.emit("pre-scene-render",{type:"pre-scene-render"})}dispatchProcessData({series:e}){this.events.emit("process-data",{type:"process-data",series:e})}},oW=class{constructor(e,t){this.eventsHub=new Go,this.callbackCache=new eT,this.highlightManager=new JT(this.eventsHub),this.formatManager=new Id,this.layoutManager=new mw(this.eventsHub),this.localeManager=new J4(this.eventsHub),this.seriesStateManager=new nW,this.stateManager=new E4,this.seriesLabelLayoutManager=new tW,this.cleanup=new St,this.contextModules=[];const{scene:i,root:s,syncManager:n,container:o,fireEvent:a,updateCallback:r,updateMutex:l,styleContainer:c,chartType:h,domMode:d,withDragInterpretation:u}=t;this.chartService=e,this.syncManager=n,this.domManager=new wT(this.eventsHub,this.chartService,o,c,d),this.widgets=new PH(this.domManager,{withDragInterpretation:u});const p=this.domManager.addChild("canvas","scene-canvas",i?.canvas.element);this.scene=i??new Qy({canvasElement:p}),this.scene.setRoot(s),this.cleanup.register(this.scene.on("scene-changed",()=>{this.updateService.update(7)})),this.axisManager=new sH(this.eventsHub,s),this.legendManager=new iW(this.eventsHub),this.annotationManager=new iH(this.eventsHub,e.annotationRoot,a),this.chartTypeOriginator=new N4(e),this.interactionManager=new YT,this.contextMenuRegistry=new QT(this.eventsHub),this.optionsGraphService=new sW,this.updateService=new xw(r),this.proxyInteractionService=new RT(this.eventsHub,this.localeManager,this.domManager),this.fontManager=new nH(this.domManager,this.updateService),this.historyManager=new O4(this.eventsHub),this.animationManager=new XT(this.interactionManager,l),this.dataService=new Jy(this.eventsHub,e,this.animationManager),this.tooltipManager=new rm(this.eventsHub,this.localeManager,this.domManager,e.tooltip),this.zoomManager=new fw(this.eventsHub,a);for(const g of Ta.byType("context")){if(!g.chartTypes.includes(h))continue;const f=g.moduleFactory(this);this.contextModules.push(f),this[g.contextKey]=f}}destroy(){this.animationManager.destroy(),this.axisManager.destroy(),this.callbackCache.invalidateCache(),this.domManager.destroy(),this.fontManager.destroy(),this.proxyInteractionService.destroy(),this.tooltipManager.destroy(),this.zoomManager.destroy(),this.widgets.destroy();for(const e of this.contextModules)e.destroy();this.cleanup.flush()}},W0=class extends Le{constructor(){super(...arguments),this.range="tooltip",this.drawingMode="overlay"}};M([C],W0.prototype,"range",2),M([C],W0.prototype,"drawingMode",2);function aW(e,t){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}function rW(e,t){if(e==null||t==null)return e===t;if(e.size!==t.size)return!1;for(const[i,s]of e){const n=t.get(i);if(n==null||!aW(s,n))return!1}return!0}function lW(e,t){if(e.length!==t.length)return!1;for(let i=0;i0}function uW(e){return e.removedIndices.size===0&&e.totalAppendCount===0&&e.totalPrependCount>0}function pW(e){return e.removedIndices.size===0}var bw=class{constructor(e,t){this.indexMap=e,this.prependValues=t.prependValues,this.appendValues=t.appendValues}getRemovedIndices(){return Array.from(this.indexMap.removedIndices).sort((e,t)=>e-t)}forEachPreservedIndex(e){const{originalLength:t,removedIndices:i,totalPrependCount:s}=this.indexMap;let n=0;const o=Array.from(i).sort((r,l)=>r-l);let a=0;for(let r=0;r0?Array.from({length:a.insertCount},(c,h)=>t(a.index+h)):[],l=e.splice(a.index,a.deleteCount,...r);i&&l.length>0&&i(l,a)}e.length!==n&&(e.length=n)}}},$0=class DV{constructor(){this.domain=new Set}static is(t){return t instanceof DV}extend(t){this.domain.add(t)}getDomain(){return Array.from(this.domain)}},lo=class kV{constructor(){this.domain=[1/0,-1/0]}static is(t){return t instanceof kV}static extendDomain(t,i=[1/0,-1/0]){for(const s of t)typeof s=="number"&&(i[0]>s&&(i[0]=s),i[1]t&&(this.domain[0]=t),this.domain[1]n.startIndex&&i.push(s)}return i}markBandsDirty(e,t){const i=this.findAffectedBands(e,t);for(const s of i)this.bands[s].isDirty=!0;this.fullDomainCache=null}handleInsertion(e,t){this.dataSize+=t,this.fullDomainCache=null;for(let i=0;is.endIndex>s.startIndex);let i=!1;if(this.bands.length>1){this.bands[0].startIndex!==0&&(i=!0);for(let s=1;s1&&this.initializeBands(this.dataSize);return}if(this.config.maxBandSize<1/0&&Math.max(...this.bands.map(i=>i.endIndex-i.startIndex))>this.config.maxBandSize){this.initializeBands(this.dataSize);return}const e=this.getTargetBandCount(this.dataSize);Math.abs(this.bands.length-e)>e*.5&&this.initializeBands(this.dataSize)}getTargetBandCount(e){return Math.max(this.config.targetBandCount,Math.ceil(e/1e3))}extendBandsFromData(e,t){const i=e.length;for(const s of this.bands){if(!s.isDirty)continue;s.subDomain=this.domainFactory();const{startIndex:n,endIndex:o}=s;for(let a=n;ae.isDirty)}extend(e){this.markAllBandsDirty(),this.fullDomainCache=null}getDomain(){if(this.fullDomainCache!==null)return this.fullDomainCache;if(this.bands.length===0)return this.fullDomainCache=[],[];if(this.bands.length===1)return this.fullDomainCache=this.bands[0].subDomain.getDomain(),this.fullDomainCache;if(this.isDiscrete){const e=new Set;for(const t of this.bands){const i=t.subDomain.getDomain();for(const s of i)e.add(s)}this.fullDomainCache=Array.from(e)}else{let e,t;for(const i of this.bands){const s=i.subDomain.getDomain();if(s.length===2){const[n,o]=s;(e===void 0||n!=null&&e!=null&&nt)&&(t=o)}}e!==void 0&&t!==void 0?this.fullDomainCache=[e,t]:this.fullDomainCache=[]}return this.fullDomainCache}getStats(){const e=this.bands.filter(i=>i.isDirty).length,t=this.bands.reduce((i,s)=>i+(s.endIndex-s.startIndex),0);return{bandCount:this.bands.length,dirtyBandCount:e,averageBandSize:this.bands.length>0?t/this.bands.length:0,dataSize:this.dataSize,needsReinitialization:this.needsReinitialization}}},Td=0,wd=1,Ea=2,yW=class{constructor(e){const t=e.reduce((o,a)=>Math.max(o,a.length),0);let s=1<<32-Math.clz32(t);t===s/2&&(s=s>>>1),this.maxLevelSize=s;const n=new Float64Array((s*2-1)*2).fill(Number.NaN);for(const o of e)for(let a=0;au)&&(n[h]=r)}for(let o=Math.trunc(s/2);o>=1;o=Math.trunc(o/2)){const a=Math.trunc(o-1),r=Math.trunc(a+o);for(let l=0;lf?g:f}}this.buffer=n}computeRangeInto(e,t,i,s,n,o,a){const r=n+o-1;if(r=i)return a;if(n>=t&&r1&&(s=Math.trunc(s*2),o=Math.trunc(o/2),this.computeRangeInto(e,t,i,Math.trunc(s+1),n,o,a),this.computeRangeInto(e,t,i,Math.trunc(s+2),n+o,o,a));return a}rangeBetween(e,t){if(e>t)return[Number.NaN,Number.NaN];const{maxLevelSize:i,buffer:s}=this,n=[1/0,-1/0];return this.computeRangeInto(s,e,t,0,0,i,n),n}get range(){const{buffer:e}=this;return[e[Td],e[wd]]}};function mW(e,t){const i=e.length;if(e.length<=1)return 1;let s=0,n=e[0];for(let o=1;oEe(t)?JSON.stringify(t):t).join("-")}function fn(e){const t=e?.map(Number);return t?.every(Number.isFinite)?t:[]}function Sw(e,t){return t?.get(e.id)??0}function Mw(e){return"scopes"in e&&Array.isArray(e.scopes)}function Hp(e,t){const i=[];for(let s=0;s{let i=t;for(const s of e)i=i[s];return i}}var X0=class{constructor(e,t="standalone",i=!1){this.opts=e,this.mode=t,this.suppressFieldDotNotation=i,this.debug=Pe.create(!0,"data-model"),this.scopeCache=new Map,this.keys=[],this.values=[],this.aggregates=[],this.groupProcessors=[],this.propertyProcessors=[],this.reducers=[],this.processors=[],this.markScopeDatumInvalid=function(r,l,c,h){for(const d of r)h.has(d)||h.set(d,Hp(l.length,!1)),h.get(d)[c]=!0};let s=!0;for(const r of e.props){if(r.type==="key"&&!s)throw new Error("AG Charts - internal config error: keys must come before values.");r.type==="value"&&s&&(s=!1)}const n=({matchGroupIds:r=[]})=>{for(const l of r)if(this.values.every(c=>c.groupId!==l))throw new Error(`AG Charts - internal config error: matchGroupIds properties must match defined groups (${l}).`)},o=new Set,a=new Set;for(const r of e.props){const l=r.type==="key"?o:a;if(Mw(r)&&r.scopes)for(const c of r.scopes)l.add(c);switch(r.type){case"key":this.keys.push({...r,index:this.keys.length,missing:new Map});break;case"value":if(r.property==null)throw new Error(`AG Charts - internal config error: no properties specified for value definitions: ${JSON.stringify(r)}`);this.values.push({...r,index:this.values.length,missing:new Map});break;case"aggregate":n(r),this.aggregates.push({...r,index:this.aggregates.length});break;case"group-value-processor":n(r),this.groupProcessors.push({...r,index:this.groupProcessors.length});break;case"property-value-processor":this.propertyProcessors.push({...r,index:this.propertyProcessors.length});break;case"reducer":this.reducers.push({...r,index:this.reducers.length});break;case"processor":this.processors.push({...r,index:this.processors.length});break}}if(this.opts.groupByKeys||this.opts.groupByFn!=null){const r=new Set(a.values());for(const l of o)r.delete(l);if(r.size>0)throw new Error(`AG Charts - scopes missing key for grouping, illegal configuration: ${[...r.values()]}`)}}resolveProcessedDataDefById(e,t){const i=this.scopeCache.get(e.id)?.get(t);if(!i)throw new Error(`AG Charts - didn't find property definition for [${t}, ${e.id}]`);return{index:i.index,def:i}}resolveProcessedDataIndexById(e,t){return this.resolveProcessedDataDefById(e,t).index}resolveKeysById(e,t,i){const s=this.resolveProcessedDataIndexById(e,t),n=i.keys[s];if(n==null)throw new Error(`AG Charts - didn't find keys for [${t}, ${e.id}]`);return n.get(e.id)}hasColumnById(e,t){return this.scopeCache.get(e.id)?.get(t)!=null}resolveColumnById(e,t,i){const s=this.resolveProcessedDataIndexById(e,t),n=i.columns?.[s];if(n==null)throw new Error(`AG Charts - didn't find column for [${t}, ${e.id}]`);return n}resolveColumnNeedsValueOf(e,t,i){const s=this.resolveProcessedDataIndexById(e,t);return i.columnNeedValueOf?.[s]??!0}resolveAbsoluteIndex(e,t){return e+t}*forEachDatum(e,t,i,s){const n=t.columnScopes.findIndex(o=>o.has(e.id));for(const o of i.datumIndices[n]??[]){const a=this.resolveAbsoluteIndex(s,o);yield t.columns[n][a]}}getUniqueDataSets(e){return new Set(e.dataSources.values())}*forEachGroupDatum(e,t){const i=t.columnScopes.findIndex(o=>o.has(e.id)),s={groupIndex:0,columnIndex:i},n=[];for(const o of t.groups){s.group=o;for(const a of o.datumIndices[i]??n)s.datumIndex=this.resolveAbsoluteIndex(s.groupIndex,a),yield s;s.groupIndex++}}getDomain(e,t,i,s){return this.getDomainsByType(i??"value",s)?.[this.resolveProcessedDataIndexById(e,t)]??[]}getDomainBetweenRange(e,t,[i,s],n){const o=t.map(c=>this.resolveProcessedDataIndexById(e,c)),a=o.join(":"),r=n[Y0];let l=r.get(a);if(l==null){const c=o.map(h=>n.columns[h]);l=new yW(c),r.set(a,l)}return l.rangeBetween(i,s)}getSortOrder(e,t,i,s){let n=i.get(t);return n==null&&(n={sortOrder:mW(e,s)},i.set(t,n)),n.sortOrder}getKeySortOrder(e,t,i){const s=this.resolveProcessedDataIndexById(e,t),n=i.keys[s]?.get(e.id);return n?this.getSortOrder(n,s,i[U0],!0):void 0}getColumnSortOrder(e,t,i){const s=this.resolveProcessedDataIndexById(e,t),n=i.columnNeedValueOf?.[s]??!0;return this.getSortOrder(i.columns[s],s,i[K0],n)}getDomainsByType(e,t){switch(e){case"key":return t.domain.keys;case"value":return t.domain.values;case"aggregate":return t.domain.aggValues;case"group-value-processor":return t.domain.groups;default:return null}}processData(e){const{opts:{groupByKeys:t,groupByFn:i},aggregates:s,groupProcessors:n,reducers:o,processors:a,propertyProcessors:r}=this,l=performance.now();if(t&&this.keys.length===0)return;let c=this.extractData(e);t?c=this.groupData(c):i&&(c=this.groupData(c,i(c))),n.length>0&&c.type==="grouped"&&this.postProcessGroups(c),s.length>0&&c.type==="ungrouped"?this.aggregateUngroupedData(c):s.length>0&&c.type==="grouped"&&this.aggregateGroupedData(c),r.length>0&&this.postProcessProperties(c),o.length>0&&this.reduceData(c),a.length>0&&this.postProcessData(c),this.warnDataMissingProperties(e);const h=performance.now();return c.time=h-l,this.collectOptimizationMetadata(c,"full-process"),this.debug.check()&&bW(c),this.processScopeCache(),c}isReprocessingSupported(e){if(e.type==="grouped"){if(!e.groupsUnique||this.getUniqueDataSets(e).size!==1)return!1;const i=Aa(e.scopes);if(e.invalidKeys?.get(i)?.some(n=>n))return!1}return this.aggregates.length>0||this.reducers.length>0||this.processors.length>0||this.propertyProcessors.length>0?!1:this.groupProcessors.every(t=>t.supportsReprocessing??!1)}reprocessData(e,t){if(!this.isReprocessingSupported(e)){this.debug.check()&&this.debug("Falling back to full reprocessing - incremental not supported for current configuration");const l=this.getUniqueDataSets(e);for(const c of l)c.commitPendingTransactions();return this.processData(e.dataSources)}const i=performance.now(),s=this.collectScopeChanges(e,t);if(s.size===0)return e;this.commitPendingTransactions(e);const{processValue:n}=this.initDataDomainProcessor("skip"),o=this.processAllInsertions(e,s,n);this.updateBandsForChanges(e,s);const a=this.transformKeysArrays(e,s,o);this.transformColumnsArrays(e,s,o),this.transformInvalidityArrays(e,s,o),e.type==="grouped"&&(this.transformGroupsArray(e,s,o),this.groupProcessors.length>0&&this.reprocessGroupProcessors(e,s)),this.recomputeDomains(e),e.reduced?.diff!=null&&s.size>0&&this.generateDiffMetadata(e,s,a),this.updateProcessedDataMetadata(e);const r=performance.now();return e.time=r-i,this.collectOptimizationMetadata(e,"reprocess"),e}applyOperationToBandedDomains(e,t){for(const i of e.values())i instanceof Rc&&t(i)}updateBandsForChanges(e,t){const i=e[jp];if(i.size===0)return;const s=new Set;for(const[,n]of t){if(s.has(n))continue;s.add(n);const{indexMap:o}=n,{spliceOps:a}=o;for(const r of a)r.insertCount>0&&this.applyOperationToBandedDomains(i,l=>l.handleInsertion(r.index,r.insertCount)),r.deleteCount>0&&this.applyOperationToBandedDomains(i,l=>l.handleRemoval(r.index,r.deleteCount))}}collectScopeChanges(e,t){const i=new Map;for(const[s,n]of e.dataSources){const o=t?.get(n)??n.getChangeDescription();o&&i.set(s,o)}return i}commitPendingTransactions(e){const t=this.getUniqueDataSets(e);for(const i of t)i.commitPendingTransactions()}processAllInsertions(e,t,i){const s=new Map;for(const[n,o]of t){const a=e.dataSources.get(n);if(!a)continue;const r=this.processInsertionsOnce(n,o,a,i);s.set(n,r)}return s}transformArraysWithCache(e,t,i,s,n,o){for(const[a,r]of e.entries())for(const l of n(r)){const c=t.get(l);if(!c)continue;const h=s(a,l);if(!h)continue;const d=i.get(l);c.applyToArray(h,u=>{const p=d?.get(u);return o(p,r,a)})}}transformKeysArrays(e,t,i){const s=new Map,n=r=>{let l=s.get(r);return l||(l={tuples:[]},s.set(r,l)),l},o=new WeakSet;for(const[r,l]of this.keys.entries())for(const c of l.scopes??[]){const h=t.get(c);if(!h)continue;const d=e.keys[r]?.get(c);if(!d)continue;if(o.has(d)){const f=Array.from(e.keys[r].entries()).find(([x,m])=>m===d)?.[0];f&&f!==c&&s.has(f)&&s.set(c,s.get(f));continue}o.add(d);const u=i.get(c),p=n(c);let g=0;h.applyToArray(d,f=>{const x=u?.get(f);if(x){const m=x.keys.get(r);return m?.valid?m.value:l.invalidValue}return l.invalidValue},f=>{for(const x of f)p.tuples[g]||(p.tuples[g]=new Array(this.keys.length)),p.tuples[g][r]=x,g+=1})}const a=new Map;for(const[r,{tuples:l}]of s){if(l.length===0)continue;const c=new Set;for(const h of l){const d=[];for(const[u,p]of h.entries())this.keys[u].scopes?.includes(r)&&d.push(p);d.length>0&&c.add(Z0(d))}a.set(r,c)}return a}transformColumnsArrays(e,t,i){this.transformArraysWithCache(this.values,t,i,s=>e.columns[s],s=>[Aa(s.scopes)],(s,n,o)=>{if(s){const a=s.values.get(o);return a?.valid?a.value:n.invalidValue}return n.invalidValue})}transformInvalidityMap(e,t,i,s){const n=new Set;for(const[o,a]of t){const r=e.get(o);if(!r||n.has(r))continue;n.add(r);const l=i.get(o);a.applyToArray(r,c=>{const h=l?.get(c);return s(h)})}}transformInvalidityArrays(e,t,i){e.invalidKeys&&this.transformInvalidityMap(e.invalidKeys,t,i,s=>s?.hasInvalidKey??!1),e.invalidData&&this.transformInvalidityMap(e.invalidData,t,i,s=>s?s.hasInvalidKey||s.hasInvalidValue:!1)}transformGroupsArray(e,t,i){const s=Aa(e.scopes),n=t.get(s);if(!n)return;const o=i.get(s);for(const[,a]of o??[])if(a.hasInvalidKey)throw new Error("AG Charts - reprocessing grouped data with invalid keys not supported. This typically indicates a data quality issue that requires full reprocessing.");n.applyToArray(e.groups,a=>this.createDataGroupForInsertion(a,e,s,o))}createDataGroupForInsertion(e,t,i,s){const n=[];for(const d of t.keys){const u=d.get(i);u&&n.push(u[e])}const o=t.groups[0],a=()=>Object.freeze(Hp(t.columnScopes.length,vw)),r=o?.datumIndices??a(),c=s?.get(e)?.hasInvalidValue??!1;let h;return c?(h=new Set(t.scopes),h.delete(i)):h=t.scopes,{keys:n,datumIndices:r,aggregation:[],validScopes:h}}setupDomainForDefinition(e,t,i){if(e.valueType==="category")return new $0;let s=t.get(e);return!s&&i?.enableBanding!==!1&&(s=new Rc(()=>new lo,i,!1),t.set(e,s)),s??new lo}extendDomainFromData(e,t,i){if(e instanceof Rc)e.extendBandsFromData(t,i);else for(let s=0;sp.length));this.initializeBandedDomain(d,u,String(c.property))}for(const[l,c]of this.values.entries()){const h=e.columns[l],d=a.get(c);this.initializeBandedDomain(d,h.length,String(c.property))}const r=new Map;if(i.size>0){n={totalBands:0,dirtyBands:0,totalData:0};for(const l of i.values())if(l instanceof Rc){const c=l.getStats();r.set(l,c),n.totalBands+=c.bandCount,n.dirtyBands+=c.dirtyBandCount,n.totalData=Math.max(n.totalData,c.dataSize)}}for(const[l,c]of this.keys.entries()){const h=e.keys[l],d=o.get(c);for(const u of c.scopes??[]){const p=h.get(u);if(!p)continue;const g=e.invalidKeys?.get(u);this.extendDomainFromData(d,p,g)}}for(const[l,c]of this.values.entries()){const h=e.columns[l],d=a.get(c),u=Aa(c.scopes),p=e.invalidData?.get(u);this.extendDomainFromData(d,h,p)}if(e.domain.keys=this.keys.map(l=>{const c=o.get(l),h=c.getDomain();return lo.is(c)&&h[0]>h[1]?[]:h}),e.domain.values=this.values.map(l=>{const c=a.get(l),h=c.getDomain();return lo.is(c)&&h[0]>h[1]?[]:h}),e.type==="grouped"&&(e.domain.groups=e.groups.map(l=>l.keys)),this.collectDomainBandingMetadata(e,o,a,i,r),this.debug.check()&&t>0){const c=performance.now()-t;if(n&&n.totalBands>0){const h=n.dirtyBands/n.totalBands,d=Math.round(h*n.totalData);this.debug(`recomputeDomains with banding: ${c.toFixed(2)}ms, bands: ${n.dirtyBands}/${n.totalBands} dirty, data scanned: ~${d}/${n.totalData} (${(h*100).toFixed(1)}%)`)}else this.debug(`recomputeDomains: ${c.toFixed(2)}ms (no banding)`)}}generateDiffMetadata(e,t,i){const s=(n,o)=>{const a=[];for(const r of e.keys){const l=r.get(n);if(!l)return;a.push(l[o])}return a.length>0?Z0(a):void 0};for(const[n,o]of t){const a={changed:!0,added:new Set,removed:i.get(n)??new Set,updated:new Set,moved:new Set};for(const c of o.indexMap.spliceOps)if(c.insertCount>0)for(let h=0;h0)for(let c=l;c0)for(let c=0;c{if(c!==h){const d=s(n,h);d&&a.moved.add(d)}});e.reduced.diff[n]=a}}updateProcessedDataMetadata(e){let t=0;for(const s of e.dataSources.values())t=Math.max(t,s.data.length);e.input.count=t;let i=0;for(const[s,n]of e.invalidData??new Map){const o=e.invalidKeys?.get(s);for(let a=0;a=o)continue;const c=i.data[l],h=new Map,d=new Map;let u=!1,p=!1;if(c==null||typeof c!="object")u=!0,p=!0;else{for(const[g,f]of this.keys.entries()){if(!f.scopes?.includes(e))continue;const x=s(f,c,l,e);h.set(g,{value:x.value,valid:x.valid}),x.valid||(u=!0)}for(const[g,f]of this.values.entries()){if(!f.scopes?.includes(e))continue;const x=s(f,c,l,f.scopes);d.set(g,{value:x.value,valid:x.valid}),x.valid||(p=!0)}}n.set(l,{keys:h,values:d,hasInvalidKey:u,hasInvalidValue:p})}return n}warnDataMissingProperties(e){if(e.size!==0)for(const t of Dc(this.keys,this.values))for(const[i,s]of t.missing){if(s<(e.get(i)?.data.length??1/0))continue;const n=i==null?"":` for ${i}`;K.warnOnce(`the key '${t.property}' was not found in any data element${n}.`)}}processScopeCache(){this.scopeCache.clear();for(const e of Dc(this.keys,this.values,this.aggregates))if(e.idsMap)for(const[t,i]of e.idsMap)for(const s of i)if(!this.scopeCache.has(t))this.scopeCache.set(t,new Map([[s,e]]));else{if(this.scopeCache.get(t)?.has(s))throw new Error("duplicate definition ids on the same scope are not allowed.");this.scopeCache.get(t).set(s,e)}}valueGroupIdxLookup({matchGroupIds:e}){const t=[];for(const[i,s]of this.values.entries())(!e||s.groupId&&e.includes(s.groupId))&&t.push(i);return t}valueIdxLookup(e,t){const i=e==null||e.length===0,s=typeof t=="string"?t:t.id,n=a=>{if(a.idsMap){for(const[r,l]of a.idsMap)if(e?.includes(r)&&l.has(s))return!0}return!1},o=this.values.reduce((a,r,l)=>((r.scopes==null||i&&!r.scopes.length||r.scopes.some(h=>e?.includes(h)))&&(r.property===s||r.id===s||n(r))&&a.push(l),a),[]);if(o.length===0)throw new Error(`AG Charts - configuration error, unknown property ${JSON.stringify(t)} in scope(s) ${JSON.stringify(e)}`);return o}extractData(e){const{dataDomain:t,processValue:i,allScopesHaveSameDefs:s}=this.initDataDomainProcessor("extend"),{keys:n,values:o}=this,{invalidData:a,invalidKeys:r,invalidKeyCount:l,allKeyMappings:c}=this.extractKeys(n,e,i),{columns:h,columnScopes:d,columnNeedValueOf:u,partialValidDataCount:p,maxDataLength:g}=this.extractValues(a,o,e,r,i),f=x=>{const m=t.get(x),v=m.getDomain();return lo.is(m)&&v[0]>v[1]?[]:v};return{type:"ungrouped",input:{count:g},scopes:new Set(e.keys()),dataSources:e,aggregation:void 0,keys:[...c.values()],columns:h,columnScopes:d,columnNeedValueOf:u,invalidKeys:r,invalidKeyCount:l,invalidData:a,domain:{keys:n.map(f),values:o.map(f)},defs:{allScopesHaveSameDefs:s,keys:n,values:o},partialValidDataCount:p,time:0,[Y0]:new Map,[U0]:new Map,[K0]:new Map,[jp]:new Map}}extractKeys(e,t,i){const s=new Map,n=new Map,o=new Map,a=new Map;let r,l;const c=(h,d)=>{const u=l.get(h);r.set(d,r.get(u)),s.has(u)&&(s.set(d,s.get(u)),n.set(d,n.get(u)))};for(const h of e){const{invalidValue:d,scopes:u}=h;r=new Map,l=new Map,a.set(h,r);for(const p of u??[]){const g=t.get(p)?.data??[];if(l.has(g)){c(g,p);continue}const f=[];r.set(p,f),l.set(g,p);let x,m,v=0;for(let b=0;bi.get(b))).size>1)throw new Error(`AG Charts - more than one data source for: ${JSON.stringify(h)}`);const p=new Set(h.scopes),g=Aa(h.scopes),f=i.get(g)?.data??[],x=new Array,m=s.get(g);let v=!1;for(let b=0;b0?1-x/g:0;e.optimizations.batchMerging={originalBatchCount:g,mergedBatchCount:x,mergeRatio:b}}const m=f.length===1,v=Object.freeze(Hp(f[0][1].length,vw));for(const[b,S,D,L,I,A]of f){const T=n[Aa(S)];for(let w=0;wR[w]);if(N==null||N.length===0)throw new Error("AG Charts - no keys found for scope(s): "+b.join(", "));const O=t?.(N)??N,P=d==null?void 0:Z0(O);let F=d?.get(P),_,z,B=!1;if(F==null?(_={keys:O,datumIndices:[],aggregation:[],validScopes:l},z=p++,F=[z,_],B=!0,d?.set(P,F),c.push(_.keys),h.push(_)):([z,_]=F,u=!1),I?.[w]===!0){_.validScopes===l&&(_.validScopes=new Set(l.values()));for(const R of L)_.validScopes.delete(R)}if(B&&w===z&&m)_.datumIndices=v;else{!B&&_.datumIndices===v&&(_.datumIndices=v.map(R=>[...R]));for(const R of S)(i=_.datumIndices)[R]??(i[R]=[]),_.datumIndices[R].push(w-z)}}}return{...e,type:"grouped",domain:{...e.domain,groups:c},groups:h,groupsUnique:u,optimizations:e.optimizations,[jp]:e[jp]}}groupBatches(e,t,i,s,n,o){const a=[],r=new Set;for(const l of e){const c=t.map((g,f)=>f).filter(g=>!r.has(g)&&i[g].has(l));if(c.length===0)continue;for(const g of c)r.add(g);const h=new Set;for(const g of c)for(const f of i[g])h.add(f);const d=s.map(g=>g.get(l)).filter(g=>g!=null),u=n?.get(l),p=o?.get(l);a.push([l,c,d,h,u,p])}return this.mergeCompatibleBatches(a)}areBatchesCompatible(e,t){const[,,i,,s,n]=e,[,,o,,a,r]=t;return i.every((l,c)=>l===o[c])&&n===r&&s===a}mergeCompatibleBatches(e){const t=[],i=new Set;for(let s=0;s[1/0,-1/0]);e.domain.aggValues=t;const{columns:i,dataSources:s}=e,n=Aa(s.keys()),o=e.keys.map(r=>r.get(n)),a=s.get(n)?.data??[];e.aggregation=a?.map((r,l)=>{const c=[];for(const[h,d]of this.aggregates.entries()){const u=this.valueGroupIdxLookup(d);let p=d.groupAggregateFunction?.()??[1/0,-1/0];const g=u.map(v=>i[v][l]),f=cm(o,l),x=f==null?void 0:d.aggregateFunction(g,f);x&&(p=d.groupAggregateFunction?.(x,p)??lo.extendDomain(x,p));const m=d.finalFunction?.(p)??p;c[h]=m,lo.extendDomain(m,t[h])}return c})}aggregateGroupedData(e){const t=this.aggregates.map(()=>[1/0,-1/0]);e.domain.aggValues=t;const{columns:i}=e;for(const[s,n]of this.aggregates.entries()){const o=this.valueGroupIdxLookup(n);for(let a=0;ar.datumIndices[u]?.length??0));for(let u=0;u{const x=r.datumIndices[f]?.[u];if(x==null)return;const m=this.resolveAbsoluteIndex(a,x);return i[f][m]}),g=n.aggregateFunction(p,l);g&&(c=n.groupAggregateFunction?.(g,c)??lo.extendDomain(g,c))}const d=n.finalFunction?.(c)??c;r.aggregation[s]=d,lo.extendDomain(d,t[s])}}}postProcessGroups(e){const{groupProcessors:t}=this,{columnScopes:i,columns:s,invalidData:n}=e;for(const o of t){const a=this.valueGroupIdxLookup(o),r=o.adjust()();for(let l=0;l0)for(let d=0;dh.get(a)).filter(h=>h!=null),l=r.map(()=>{}),c=t.get(a)?.data??[];for(let h=0;h{for(const d of Dc(t,i))d.valueType==="category"?n.set(d,new $0):(n.set(d,new lo),a&&(a=(d.scopes?.length??0)===s.size))};r();const l=this.buildAccessors(Dc(t,i)),c={value:void 0,missing:!1,valid:!1};return{dataDomain:n,processValue:(d,u,p,g)=>{let f,x;if(l.has(d.property)){try{x=l.get(d.property)(u)}catch{}f=x!=null}else f=d.property in u,x=f?u[d.property]:d.missingValue;d.forceValue!=null&&(x=f&&CS(x)?-1*d.forceValue:d.forceValue,f=!0),c.missing=!f;const m="missingValue"in d;if(!f&&!m)if(typeof g=="string"){const b=d.missing.get(g)??0;d.missing.set(g,b+1)}else for(const b of g){const S=d.missing.get(b)??0;d.missing.set(b,S+1)}n.has(d)||r();const v=d.type==="key"&&x==null;if(f&&d.validation?.(x,u,p)===!1||v)if(c.valid=!1,"invalidValue"in d)x=d.invalidValue;else return this.mode!=="integrated"&&K.warnOnce(`invalid value of type [${typeof x}] for [${d.scopes} / ${d.id}] ignored:`,`[${x}]`),c.value=void 0,c;else c.valid=!0;if(d.processor){let b=o.get(d);b==null&&(b=d.processor(),o.set(d,b)),x=b(x,p)}return e==="extend"&&n.get(d)?.extend(x),c.value=x,c},initDataDomain:r,scopes:s,allScopesHaveSameDefs:a}}collectOptimizationMetadata(e,t){const i=e.optimizations?.domainBanding;e.optimizations={performance:{processingTime:e.time,pathTaken:t},...i&&{domainBanding:i}};const s=this.isReprocessingSupported(e),n=t==="reprocess";let o;if(!s){const a=[];if(e.type==="grouped"){e.groupsUnique||a.push("groupsUnique=false"),this.getUniqueDataSets(e).size!==1&&a.push("multiple data sources");const l=Aa(e.scopes);e.invalidKeys?.get(l)?.some(h=>h)&&a.push("has invalid keys")}this.aggregates.length>0&&a.push("has aggregates"),this.reducers.length>0&&a.push("has reducers"),this.processors.length>0&&a.push("has processors"),this.propertyProcessors.length>0&&a.push("has property processors"),o=a.length>0?a.join(", "):void 0}if(e.optimizations.reprocessing={applied:n,reason:o},e.type==="grouped"){let a=0;const r=e.groups[0];if(r){const l=r.datumIndices;for(const c of e.groups)c.datumIndices===l&&a++}e.optimizations.sharedDatumIndices={applied:a>0,sharedGroupCount:a,totalGroupCount:e.groups.length}}}collectDomainBandingMetadata(e,t,i,s,n){e.optimizations??(e.optimizations={});const o=[],a=[];for(const r of this.keys){const l=t.get(r),c=s.get(r),h=l instanceof Rc;let d;h||(r.valueType==="category"?d="discrete domain":this.opts.domainBandingConfig?.enableBanding===!1?d="banding disabled":d="not configured");let u;if(h&&c){const p=n.get(c)??c.getStats(),g=p.bandCount>0?p.dirtyBandCount/p.bandCount:0;u={totalBands:p.bandCount,dirtyBands:p.dirtyBandCount,dataSize:p.dataSize,scanRatio:g}}o.push({property:String(r.property),applied:h,reason:d,stats:u})}for(const r of this.values){const l=i.get(r),c=s.get(r),h=l instanceof Rc;let d;h||(r.valueType==="category"?d="discrete domain":this.opts.domainBandingConfig?.enableBanding===!1?d="banding disabled":d="not configured");let u;if(h&&c){const p=n.get(c)??c.getStats(),g=p.bandCount>0?p.dirtyBandCount/p.bandCount:0;u={totalBands:p.bandCount,dirtyBands:p.dirtyBandCount,dataSize:p.dataSize,scanRatio:g}}a.push({property:String(r.property),applied:h,reason:d,stats:u})}e.optimizations.domainBanding={keyDefs:o,valueDefs:a}}buildAccessors(e){const t=new Map;if(this.suppressFieldDotNotation)return t;for(const i of e){if(!(i.property.includes(".")||i.property.includes("[")))continue;const n=Dw(i.property);if(n==null){K.warnOnce("Invalid property path [%s]",i.property);continue}const o=xW(n);t.set(i.property,o)}return t}};function bW(e){const t=(i,s)=>{s.length>0&&(K.log(`DataModel.processData() - ${i}`),K.table(s))};if(K.log("DataModel.processData() - processedData",e),t("Key Domains",e.domain.keys),t("Value Domains",e.domain.values),t("Aggregate Domains",e.domain.aggValues??[]),e.optimizations){K.log("DataModel.processData() - Optimization Summary");const i=e.optimizations;if(i.performance&&K.log(` Performance: ${i.performance.processingTime.toFixed(2)}ms (${i.performance.pathTaken})`),i.reprocessing){const s=i.reprocessing.applied?"\u2713":"\u2717",n=i.reprocessing.reason?` (${i.reprocessing.reason})`:"";K.log(` Reprocessing: ${s}${n}`)}if(i.domainBanding){const s=i.domainBanding.keyDefs.filter(r=>r.applied),n=i.domainBanding.valueDefs.filter(r=>r.applied),o=s.length+n.length,a=i.domainBanding.keyDefs.length+i.domainBanding.valueDefs.length;if(o>0){K.log(` Domain Banding: \u2713 (${o}/${a} definitions)`);for(const r of[...s,...n])if(r.stats){const l=(r.stats.scanRatio*100).toFixed(1);K.log(` ${r.property}: scanned ${r.stats.dirtyBands}/${r.stats.totalBands} bands (${l}%)`)}}else{const r=[...i.domainBanding.keyDefs.filter(c=>!c.applied).map(c=>c.reason),...i.domainBanding.valueDefs.filter(c=>!c.applied).map(c=>c.reason)],l=[...new Set(r)].join(", ");K.log(` Domain Banding: \u2717 (${l})`)}}if(i.sharedDatumIndices){const s=i.sharedDatumIndices.applied?"\u2713":"\u2717",n=`${i.sharedDatumIndices.sharedGroupCount}/${i.sharedDatumIndices.totalGroupCount}`;K.log(` Shared DatumIndices: ${s} (${n} groups)`)}if(i.batchMerging){const s=(i.batchMerging.mergeRatio*100).toFixed(0),n=`${i.batchMerging.originalBatchCount} \u2192 ${i.batchMerging.mergedBatchCount}`;K.log(` Batch Merging: ${n} (${s}% reduction)`)}}}var Nd=class IC{constructor(t){this.data=t,this.pendingTransactions=[]}static empty(){return new IC([])}static wrap(t){return new IC(t)}netSize(){if(!this.hasPendingTransactions())return this.data.length;const t=this.getChangeDescription();return t?t.indexMap.finalLength:this.data.length}addTransaction(t){this.pendingTransactions.push(t),this.cachedChangeDescription=void 0}hasPendingTransactions(){return this.pendingTransactions.length>0}getPendingTransactionCount(){return this.pendingTransactions.length}commitPendingTransactions(){if(!this.hasPendingTransactions())return!1;const t=this.getChangeDescription();if(!t)return!1;const i=[...t.getPrependedValues(),...t.getAppendedValues()];let s=0;return t.applyToArray(this.data,()=>i[s++]),this.pendingTransactions=[],this.cachedChangeDescription=void 0,!0}clearPendingTransactions(){const t=this.pendingTransactions.length;return this.pendingTransactions=[],this.cachedChangeDescription=void 0,t}getPendingTransactions(){return[...this.pendingTransactions]}toJSON(){return this.data}getChangeDescription(){if(!this.hasPendingTransactions())return;if(this.cachedChangeDescription)return this.cachedChangeDescription;const{indexMap:t,prependValues:i,appendValues:s}=this.buildIndexMap(),n=new bw(t,{prependValues:i,appendValues:s});return this.cachedChangeDescription=n,n}removeFromGroups(t,i){for(const s of t){let n=0;for(;n0;)i.has(s[n])?(i.delete(s[n]),s.splice(n,1)):n++;if(i.size===0)break}}buildIndexMap(){const t=this.data.length,i=[],s=[],n=new Set;for(const p of this.pendingTransactions){const{prepend:g,append:f,remove:x}=p;if(Array.isArray(g)&&g.length>0&&i.unshift([...g]),Array.isArray(f)&&f.length>0&&s.push([...f]),Array.isArray(x)&&x.length>0){const m=new Set(x);if(this.removeFromGroups(i,m),m.size>0&&this.removeFromGroups(s,m),m.size>0)for(let v=0;v0;v++){const b=this.data[v];m.has(b)&&(n.add(v),m.delete(b))}}}const o=i.flat(),a=s.flat(),r=o.length,l=a.length,c=t-n.size,h=r+c+l,d=[];if(r>0&&d.push({index:0,deleteCount:0,insertCount:r}),n.size>0){const p=Array.from(n).sort((x,m)=>m-x);let g=p[0],f=1;for(let x=1;x0&&d.push({index:r+c,deleteCount:0,insertCount:l}),{indexMap:{originalLength:t,finalLength:h,spliceOps:d,removedIndices:n,totalPrependCount:r,totalAppendCount:l},prependValues:o,appendValues:a}}};function kw(e){return e.filter(t=>t.type==="key").map(t=>t.property).join(";")}var q0=class Vo{constructor(t,i){this.mode=t,this.suppressFieldDotNotation=i,this.debug=Pe.create(!0,"data-model"),this.requested=[],this.status="setup"}async request(t,i,s){if(this.status!=="setup")throw new Error("AG Charts - data request after data setup phase.");return new Promise((n,o)=>{this.requested.push({id:t,opts:s,dataSet:i,resolve:n,reject:o})})}execute(t){if(this.status!=="setup")throw new Error("AG Charts - data request after data setup phase.");this.status="executed";const i=new Map;for(const a of this.requested)a.dataSet.hasPendingTransactions()&&i.set(a.dataSet,a.dataSet.getChangeDescription()),a.dataSet.commitPendingTransactions();this.debug("DataController.execute() - requested",this.requested);const s=this.validateRequests(this.requested);this.debug("DataController.execute() - validated",s);const n=this.mergeRequested(s);this.debug("DataController.execute() - merged",n),this.debug.check()&&(qe().processedData=[]);const o=[];for(const{dataSet:a,ids:r,opts:l,resolves:c,rejects:h}of n){const d=t?.find(m=>hW(m,a,r,l)),u=(m,v)=>{if(this.debug.check()&&qe("processedData").push(v),v==null){for(const b of h)b(new Error("AG Charts - no processed data generated"));return}o.push({opts:l,dataSet:a,dataLength:a.data.length,ids:r,dataModel:m,processedData:v});for(const b of c)b({dataModel:m,processedData:v})},p=()=>{try{const m=new X0(l,this.mode,this.suppressFieldDotNotation),v=new Map(s.map(S=>[S.id,S.dataSet])),b=m.processData(v);return u(m,b),m}catch(m){for(const v of h)v(m)}};if(d==null){p();continue}const{dataModel:g,processedData:f}=d,x=i.get(a);if(f&&x&&g.isReprocessingSupported(f)){if(this.debug("DataController.execute() - reprocessing data",f,a),g.reprocessData(f,i),Pe.check("data-model:reprocess-diff")){const m=new X0(l,this.mode,this.suppressFieldDotNotation),v=new Map(s.map(I=>[I.id,I.dataSet])),b=m.processData(v),S=JSON.parse(JSON.stringify(f,Vo.jsonReplacer)),D=JSON.parse(JSON.stringify(b,Vo.jsonReplacer));delete S.time,delete S.optimizations,delete D.time,delete D.optimizations;const L=wa(D,S);L?(K.log("\u26A0\uFE0F DATA-MODEL REPROCESS DIFF DETECTED \u26A0\uFE0F"),K.log("Difference between incremental update and full reprocess:"),K.log(""),K.log("BASELINE (full reprocess):"),K.log(JSON.stringify(D,null,2)),K.log(""),K.log("REPROCESSED (incremental update):"),K.log(JSON.stringify(S,null,2)),K.log(""),K.log("DIFF (what changed):"),K.log(JSON.stringify(L,null,2))):K.log("\u2705 Data-model reprocess matches baseline (no diff)")}u(g,f);continue}p()}return o}validateRequests(t){const i=[];for(const[s,n]of t.entries())s>0&&n.dataSet.data.length!==t[0].dataSet.data.length&&n.opts.groupByData===!1&&n.opts.groupByKeys===!1?n.reject(new Error("all series[].data arrays must be of the same length and have matching keys.")):i.push(n);return i}mergeRequested(t){const i=[];for(const s of t){const n=i.find(Vo.groupMatch(s));n?n.push(s):i.push([s])}return i.map(Vo.mergeRequests)}static groupMatch({dataSet:t,opts:i}){const{groupByData:s,groupByKeys:n=!1,groupByFn:o,props:a}=i,r=kw(a);return([l])=>(s===!1||l.dataSet===t)&&(l.opts.groupByKeys??!1)===n&&l.opts.groupByFn===o&&kw(l.opts.props)===r}static mergeRequests(t){const i={ids:[],rejects:[],resolves:[],dataSet:t[0].dataSet,opts:{...t[0].opts,props:[]}},s=new Map,n=new Map;let o=0;for(const a of t){const{id:r,dataSet:l,resolve:c,reject:h,opts:{props:d,...u}}=a;i.ids.push(r),i.rejects.push(h),i.resolves.push(c),i.dataSet??(i.dataSet=l),i.opts??(i.opts={...u,props:[]});for(const p of d){const g={...p,scopes:[r],data:l.data};Vo.createIdsMap(r,g);let f;Vo.crossScopeMergableTypes.has(g.type)?f=-1:n.has(l.data)?f=n.get(l.data):(f=o++,n.set(l.data,f));const x=`${g.type}-${f}-${g.groupId}`,m=s.get(x),v=m?.find(b=>Vo.deepEqual(b,g));if(m==null){i.opts.props.push(g),s.set(x,[g]);continue}else if(v==null){i.opts.props.push(g),m.push(g);continue}g.scopes!=null&&(v.scopes??(v.scopes=[]),v.scopes.push(...g.scopes)),(v.type==="key"||v.type==="value")&&g.idsMap?.size&&(v.idsMap??(v.idsMap=new Map),Vo.mergeIdsMap(g.idsMap,v.idsMap))}}return i}static mergeIdsMap(t,i){for(const[s,n]of t){const o=i.get(s);if(o==null)i.set(s,new Set(n));else for(const a of n)o.add(a)}}static createIdsMap(t,i){i.id!=null&&(i.idsMap??(i.idsMap=new Map),i.idsMap.has(t)?i.idsMap.get(t).add(i.id):i.idsMap.set(t,new Set([i.id])))}static deepEqual(t,i){if(t===i)return!0;if(t&&i&&typeof t=="object"&&typeof i=="object"){if(t.constructor!==i.constructor)return!1;let s,n;if(Array.isArray(t)){if(n=t.length,n!==i.length)return!1;for(s=n-1;s>=0;s--)if(!Vo.deepEqual(t[s],i[s]))return!1;return!0}const o=Object.keys(t);if(n=o.length,n!==Object.keys(i).length)return!1;for(s=n-1;s>=0;s--){const a=o[s];if(!Vo.skipKeys.has(a)&&(!Object.hasOwn(i,a)||!Vo.deepEqual(t[a],i[a])))return!1}return!0}return!1}static jsonReplacer(t,i){return i instanceof Map?{__type:"Map",value:Array.from(i.entries())}:i instanceof Set?{__type:"Set",value:Array.from(i)}:i}};q0.crossScopeMergableTypes=new Set(["key","group-value-processor"]),q0.skipKeys=new Set(["id","idsMap","type","scopes","data"]);var Iw=q0,vW=class{constructor(){this.axesMap=new Map,this.themeTemplates=new Map}register(e,t){this.axesMap.set(e,t.moduleFactory),t.themeTemplate&&this.setThemeTemplate(e,t.themeTemplate)}create(e,t){const i=this.axesMap.get(e);if(i)return i(t);throw new Error(`AG Charts - unknown axis type: ${e}`)}has(e){return this.axesMap.has(e)}keys(){return this.axesMap.keys()}setThemeTemplate(e,t){return this.themeTemplates.set(e,t),this}getThemeTemplate(e){return this.themeTemplates.get(e)}},zc=new vW,Wp=[{type:"root",optionsKey:"animation",chartTypes:["cartesian","polar","topology","standalone"]},{type:"root",optionsKey:"annotations",chartTypes:["cartesian"]},{type:"root",optionsKey:"background",chartTypes:["cartesian","polar","topology","standalone"],optionsInnerKey:"image"},{type:"root",optionsKey:"foreground",chartTypes:["cartesian","polar","topology","standalone"],optionsInnerKey:"image"},{type:"root",optionsKey:"chartToolbar",chartTypes:["cartesian"]},{type:"root",optionsKey:"contextMenu",chartTypes:["cartesian","polar","topology","standalone"]},{type:"root",optionsKey:"statusBar",chartTypes:["cartesian"],identifier:"status-bar"},{type:"root",optionsKey:"dataSource",chartTypes:["cartesian","polar","topology","standalone"]},{type:"root",optionsKey:"sync",chartTypes:["cartesian"]},{type:"root",optionsKey:"zoom",chartTypes:["cartesian","topology"]},{type:"root",optionsKey:"ranges",chartTypes:["cartesian"]},{type:"legend",optionsKey:"gradientLegend",chartTypes:["cartesian","polar","topology","standalone"],identifier:"gradient"},{type:"root",optionsKey:"navigator",chartTypes:["cartesian"]},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"angle-category"},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"angle-number"},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"radius-category"},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"radius-number"},{type:"axis",optionsKey:"axes[]",chartTypes:["cartesian"],identifier:"ordinal-time"},{type:"axis-option",optionsKey:"crosshair",chartTypes:["cartesian"]},{type:"axis-option",optionsKey:"bandHighlight",chartTypes:["cartesian"]},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"box-plot"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"candlestick"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"cone-funnel"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"funnel"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"ohlc"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"heatmap"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"range-area"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"range-bar"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"waterfall"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"nightingale"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radar-area"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radar-line"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radial-bar"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radial-column"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-shape"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-line"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-marker"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-shape-background"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-line-background"},{type:"series",optionsKey:"series[]",chartTypes:["standalone"],identifier:"pyramid"},{type:"series",optionsKey:"series[]",chartTypes:["standalone"],identifier:"linear-gauge"},{type:"series",optionsKey:"series[]",chartTypes:["standalone"],identifier:"radial-gauge"},{type:"series",optionsKey:"series[]",chartTypes:["standalone"],identifier:"sunburst"},{type:"series",optionsKey:"series[]",chartTypes:["standalone"],identifier:"treemap"},{type:"series",optionsKey:"series[]",chartTypes:["standalone"],identifier:"chord"},{type:"series",optionsKey:"series[]",chartTypes:["standalone"],identifier:"sankey"},{type:"series-option",optionsKey:"errorBar",chartTypes:["cartesian"],identifier:"error-bars"},{type:"context",contextKey:"sharedToolbar",chartTypes:["cartesian"]}];function hm(e){return Wp.find(t=>t.type==="series"&&t.identifier===e)?.chartTypes}function SW(e){return hm(e)?.find(i=>i==="cartesian")==="cartesian"}function MW(e){return hm(e)?.find(i=>i==="polar")==="polar"}function DW(e){return hm(e)?.find(i=>i==="topology")==="topology"}function kW(e){return hm(e)?.find(i=>i==="standalone")==="standalone"}function IW(e){return e.packageType==="enterprise"}function AW(e){if(!IW(e))throw new Error("AG Charts - internal configuration error, only enterprise modules need verification.");const t=Wp.find(i=>i.type===e.type&&("optionsKey"in i&&"optionsKey"in e?i.optionsKey===e.optionsKey:!0)&&("contextKey"in i&&"contextKey"in e?i.contextKey===e.contextKey:!0)&&i.identifier===e.identifier&&e.chartTypes.every(s=>i.chartTypes.includes(s)));return t&&(t.useCount??(t.useCount=0),t.useCount++),t!=null}function CW(){return Wp.filter(({useCount:e})=>e==null||e===0)}var LW=class{constructor(){this.legendMap=new Map,this.themeTemplates=new Map}register(e,{optionsKey:t,moduleFactory:i,themeTemplate:s}){this.legendMap.set(e,{optionsKey:t,moduleFactory:i}),this.themeTemplates.set(t,s)}create(e,t){const i=this.legendMap.get(e)?.moduleFactory;if(i)return i(t);throw new Error(`AG Charts - unknown legend type: ${e}`)}getThemeTemplates(){return Object.fromEntries(this.themeTemplates)}getKeys(){return Array.from(this.legendMap.entries()).reduce((e,[t,i])=>(e[t]=i.optionsKey,e),{})}},Q0=new LW,Aw=class extends Map{get(e){return super.get(e)??"unknown"}isCartesian(e){return this.get(e)==="cartesian"}isPolar(e){return this.get(e)==="polar"}isTopology(e){return this.get(e)==="topology"}isStandalone(e){return this.get(e)==="standalone"}get seriesTypes(){return Array.from(this.keys())}get cartesianTypes(){return this.seriesTypes.filter(e=>this.isCartesian(e))}get polarTypes(){return this.seriesTypes.filter(e=>this.isPolar(e))}get topologyTypes(){return this.seriesTypes.filter(e=>this.isTopology(e))}get standaloneTypes(){return this.seriesTypes.filter(e=>this.isStandalone(e))}},TW=class extends Map{set(e,t){return super.set(e,st(t,this.get(e)))}},$i=new Aw,wW=new Aw,J0=new TW,NW=class{constructor(){this.seriesMap=new Map,this.themeTemplates=new Map}register(e,{chartTypes:[t],moduleFactory:i,predictAxis:s,defaultAxes:n,themeTemplate:o,solo:a,stackable:r,groupable:l,stackedByDefault:c,hidden:h}){this.setThemeTemplate(e,o),this.seriesMap.set(e,{moduleFactory:i,predictAxis:s,defaultAxes:n,solo:a,stackable:r,groupable:l,stackedByDefault:c}),$i.set(e,t),h||wW.set(e,t)}create(e,t){const i=this.seriesMap.get(e)?.moduleFactory;if(i)return i(t);throw new Error(`AG Charts - unknown series type: ${e}`)}predictAxes(e,t,i){if(!t)return;const s=t?.data??i;if(!s?.length)return;const n=this.seriesMap.get(e)?.predictAxis;if(!n)return;const o=new Map,a=ZG(0,s.length-1,5);for(const r of a){const l=s[r];for(const c of Object.values(Yy)){const h=n(c,l,t);if(!o.has(c)){o.set(c,h);continue}const d=o.get(c);if(!(!h&&!d)){if(!h||!d)return;for(const u of Object.keys(d))if(d[u]!==h[u])return}}}for(const[r,l]of o)l||o.delete(r);if(o.size!==0){if(o.size===1){const r=this.cloneDefaultAxes(e);if(!r)return;const[l]=o.values();return r.map(c=>c.type==="category"?l:c)}return Array.from(o.values())}}cloneDefaultAxes(e){const t=this.seriesMap.get(e)?.defaultAxes;return t==null?null:Ft(t)}setThemeTemplate(e,t){const i=this.themeTemplates.get(e);this.themeTemplates.set(e,st(t,i))}getThemeTemplate(e){return this.themeTemplates.get(e)}isSolo(e){return this.seriesMap.get(e)?.solo??!1}isGroupable(e){return this.seriesMap.get(e)?.groupable??!1}isStackable(e){return this.seriesMap.get(e)?.stackable??!1}isStackedByDefault(e){return this.seriesMap.get(e)?.stackedByDefault??!1}},co=new NW,eM=class nl{constructor(t){this.chart=t}subscribe(t=nl.DEFAULT_GROUP){let i=this.get(t);return i||(i={members:new Set},nl.chartsGroups.set(t,i)),i.members.add(this.chart),this}unsubscribe(t=nl.DEFAULT_GROUP){const i=this.get(t);return i?.members.delete(this.chart),delete i?.domains?.x?.sources?.[this.chart.id],delete i?.domains?.y?.sources?.[this.chart.id],this}getChart(){return this.chart}getGroupState(t=nl.DEFAULT_GROUP){return this.get(t)}getGroupMembers(t=nl.DEFAULT_GROUP){const i=this.get(t);return i?Array.from(i.members):[]}getGroupSiblings(t=nl.DEFAULT_GROUP){return this.getGroupMembers(t).filter(i=>i!==this.chart)}getGroupSyncMode(t=nl.DEFAULT_GROUP){return this.getGroupMembers(t).some(i=>i.series.length>1)?"multi-series":"single-series"}get(t){return nl.chartsGroups.get(t)}};eM.chartsGroups=new Map,eM.DEFAULT_GROUP=Symbol("sync-group-default");var OW=eM,tM=class extends Le{constructor(){super(...arguments),this.enabled=!1}};M([C],tM.prototype,"enabled",2),M([C],tM.prototype,"tabIndex",2);var Cw={};Tn(Cw,{NODE_UPDATE_STATE_TO_PHASE_MAPPING:()=>Xo,fromToMotion:()=>hi,staticFromToMotion:()=>vr});var Xo={added:"add",updated:"update",removed:"remove",unknown:"initial","no-op":"none"};function hi(e,t,i,s,n,o,a){const{fromFn:r,toFn:l,applyFn:c=(g,f)=>g.setProperties(f)}=n,{nodes:h,selections:d}=sm(s),u=(g,f)=>{let x,m=0,v=0;for(const b of f){const S=g[m]===b,D={last:v>=f.length-1,lastLive:m>=g.length-1,prev:f[v-1],prevFromProps:x,prevLive:g[m-1],next:f[v+1],nextLive:g[m+(S?1:0)]},L=`${e}_${t}_${b.id}`;i.stopByAnimationId(L);let I="unknown";S?o&&a&&(I=EW(b,b.datum,o,a)):I="removed",b.transitionOut=I==="removed";const{phase:A,start:T,finish:w,delay:N,duration:O,...P}=r(b,b.datum,I,D),{phase:F,start:_,finish:z,delay:B,duration:R,...V}=l(b,b.datum,I,D),j=w==null;i.animate({id:L,groupId:e,phase:A??F??"update",duration:O??R,delay:N??B,from:P,to:V,ease:zp,collapsable:j,onPlay:()=>{const $={...T,..._,...P};c(b,$,"start")},onUpdate($){c(b,$,"update")},onStop:()=>{const $={...T,..._,...P,...V,...w,...z};c(b,$,"end")}}),S&&m++,v++,x=P}};let p=0;for(const g of d){const f=g.nodes(),x=f.filter(m=>!g.isGarbage(m));u(x,f),i.animate({id:`${e}_${t}_selection_${p}`,groupId:e,phase:"end",from:0,to:1,ease:zp,onStop(){g.cleanup()}}),p++}u(h,h)}function vr(e,t,i,s,n,o,a){const{nodes:r,selections:l}=sm(s),{start:c,finish:h,phase:d}=a;i.animate({id:`${e}_${t}`,groupId:e,phase:d??"update",from:n,to:o,ease:zp,onPlay:()=>{if(c){for(const u of r)u.setProperties(c);for(const u of l)for(const p of u.nodes())p.setProperties(c)}},onUpdate(u){for(const p of r)p.setProperties(u);for(const p of l)for(const g of p.nodes())g.setProperties(u)},onStop:()=>{for(const u of r)u.setProperties({...o,...h});for(const u of l){for(const p of u.nodes())p.setProperties({...o,...h});u.cleanup()}}})}function EW(e,t,i,s){const n=i(e,t);return s.added.has(n)?"added":s.removed.has(n)?"removed":e.previousDatum==null&&e.datum!=null?"added":e.previousDatum!=null&&e.datum==null?"removed":"updated"}var Lw={};Tn(Lw,{resetMotion:()=>fs});function fs(e,t){const{nodes:i,selections:s}=sm(e);for(const n of s){for(const o of n.nodes()){const a=t(o,o.datum);o.setProperties(a)}n.cleanup()}for(const n of i){const o=t(n,n.datum);n.setProperties(o)}}var Bs=class td{constructor(t,i,s=!0){this.parentNode=t,this.autoCleanup=s,this.garbageBin=new Set,this._nodesMap=new Map,this._nodes=[],this.data=[],this.debug=Pe.create(!0,"scene","scene:selections"),this.nodeFactory=Object.prototype.isPrototypeOf.call(hr,i)?()=>new i:i}static select(t,i,s=!0){return new td(t,i,s)}static selectAll(t,i){const s=[],n=o=>{if(i(o)&&s.push(o),o instanceof Be)for(const a of o.children())n(a)};return n(t),s}static selectByClass(t,...i){return td.selectAll(t,s=>i.some(n=>s instanceof n))}static selectByTag(t,i){return td.selectAll(t,s=>s.tag===i)}createNode(t,i,s){const n=this.nodeFactory(t);return n.datum=t,i?.(n),s==null?this._nodes.push(n):this._nodes.splice(s,0,n),this.parentNode.appendChild(n),n}update(t,i,s){if(this.garbageBin.size>0&&this.debug("Selection - update() called with pending garbage",t),s){const n=new Map,o=new Map;for(let a=0;a=t.length?this.garbageBin.add(this._nodes[o]):o>=this._nodes.length?this.createNode(t[o],i):(this._nodes[o].datum=t[o],this.garbageBin.delete(this._nodes[o]))}return this.data=t.slice(),this.autoCleanup&&this.cleanup(),this}cleanup(){return this.garbageBin.size===0?this:(this._nodes=this._nodes.filter(t=>this.garbageBin.has(t)?(this._nodesMap.delete(t),this.garbageBin.delete(t),t.destroy(),!1):!0),this)}clear(){return this.update([]),this}isGarbage(t){return this.garbageBin.has(t)}each(t){for(const i of this._nodes.entries())t(i[1],i[1].datum,i[0]);return this}*[Symbol.iterator](){for(let t=0;t{})}function nM(e,t){const i=hl(t);if(i.length===0)return;const s=kL(e);for(const n of i)n in s&&(t[n]=s[n])}var Tw=class{transitionRoot(e,t){this.parent?this.parent.transitionRoot(e,t):this.transition(e,t)}},oM=class Cn extends Tw{constructor(t,i,s){super(),this.defaultState=t,this.states=i,this.enterEach=s,this.debug=Pe.create(!0,"animation"),this.state=t,this.debug(`%c${this.constructor.name} | init -> ${t}`,iM)}transition(t,i){if(!this.transitionChild(t,i)||this.state===Cn.child||this.state===Cn.parent)return;const n=this.state,o=this.states[this.state];let a=o[t];const r=`%c${this.constructor.name} | ${this.state} -> ${t} ->`;if(Array.isArray(a))a=a.find(h=>{if(!h.guard)return!0;const d=h.guard(i);return d||this.debug(`${r} (guarded)`,h.target,sM),d});else if(typeof a=="object"&&!(a instanceof Cn)&&a.guard&&!a.guard(i)){this.debug(`${r} (guarded)`,a.target,sM);return}if(!a){this.debug(`${r} ${this.state}`,sM);return}const l=this.getDestinationState(a),c=l===this.state?void 0:o.onExit;this.debug(`${r} ${l}`,iM),this.state=l,typeof a=="function"?a(i):typeof a=="object"&&!(a instanceof Cn)&&a.action?.(i),c?.(),this.enterEach?.(n,l),l!==n&&l!==Cn.child&&l!==Cn.parent&&this.states[l].onEnter?.(n,i)}transitionAsync(t,i){setTimeout(()=>{this.transition(t,i)},0)}is(t){return this.state===Cn.child&&this.childState?this.childState.is(t):this.state===t}resetHierarchy(){this.debug(`%c${this.constructor.name} | ${this.state} -> [resetHierarchy] -> ${this.defaultState}`,"color: green"),this.state=this.defaultState}transitionChild(t,i){return this.state!==Cn.child||!this.childState||(nM(this,this.childState),this.childState.transition(t,i),!this.childState.is(Cn.parent))?!0:(this.debug(`%c${this.constructor.name} | ${this.state} -> ${t} -> ${this.defaultState}`,iM),this.state=this.defaultState,this.states[this.state].onEnter?.(),this.childState.resetHierarchy(),!1)}getDestinationState(t){let i=this.state;return typeof t=="string"?i=t:t instanceof Cn?(this.childState=t,this.childState.parent=this,i=Cn.child):typeof t=="object"&&(t.target instanceof Cn?(this.childState=t.target,this.childState.parent=this,i=Cn.child):t.target!=null&&(i=t.target)),i}};oM.child="__child",oM.parent="__parent";var $p=oM,RW=class extends Tw{constructor(...e){super(),this.stateMachines=e;for(const t of e)t.parent=this}transition(e,t){for(const i of this.stateMachines)nM(this,i),i.transition(e,t)}transitionAsync(e,t){for(const i of this.stateMachines)nM(this,i),i.transitionAsync(e,t)}},Fc=class{constructor(){this.enabled=!0}};M([C],Fc.prototype,"enabled",2),M([C],Fc.prototype,"stroke",2),M([C],Fc.prototype,"strokeWidth",2),M([C],Fc.prototype,"strokeOpacity",2);var Bt=class extends Le{constructor(){super(...arguments),this.enabled=!0,this.border=new Fc,this._cachedFormatter=void 0}formatValue(e,t,i,s){const{formatter:n,format:o}=this;let a;if(n!=null&&(a??(a=e(n,s))),o!=null){let r=this._cachedFormatter;(r==null||r.type!==t||r.format!==o)&&(r={type:t,format:o,formatter:Id.getFormatter(t,o)},this._cachedFormatter=r),a??(a=r.formatter?.(i))}return a==null||Ne(a)?a:String(a)}};M([C],Bt.prototype,"enabled",2),M([C],Bt.prototype,"border",2),M([C],Bt.prototype,"color",2),M([C],Bt.prototype,"cornerRadius",2),M([C],Bt.prototype,"fill",2),M([C],Bt.prototype,"fillOpacity",2),M([C],Bt.prototype,"fontStyle",2),M([C],Bt.prototype,"fontWeight",2),M([C],Bt.prototype,"fontSize",2),M([C],Bt.prototype,"fontFamily",2),M([C],Bt.prototype,"formatter",2),M([C],Bt.prototype,"format",2),M([C],Bt.prototype,"padding",2),M([C],Bt.prototype,"itemStyler",2);function Od(e){const{enabled:t=!1,stroke:i}=e?.border??{},n=e?.fill!=null||t&&i!=null?e?.padding:null;if(n==null)return{bottom:0,left:0,right:0,top:0};if(typeof n=="number")return{bottom:n,left:n,right:n,top:n};{const{bottom:o=0,left:a=0,right:r=0,top:l=0}=n;return{bottom:o,left:a,right:r,top:l}}}var aM=class{constructor(){this.moduleMap=new Map}*modules(){for(const e of this.moduleMap.values())yield e.moduleInstance}addModule(e,t){if(this.moduleMap.has(e.optionsKey))throw new Error(`AG Charts - module already initialised: ${e.optionsKey}`);this.moduleMap.set(e.optionsKey,{module:e,moduleInstance:t(e)})}removeModule(e){const t=Qt(e)?e:e.optionsKey;this.moduleMap.get(t)?.moduleInstance.destroy(),this.moduleMap.delete(t)}getModule(e){return this.moduleMap.get(Qt(e)?e:e.optionsKey)?.moduleInstance}isEnabled(e){return this.moduleMap.has(Qt(e)?e:e.optionsKey)}mapModules(e){return Array.from(this.moduleMap.values(),(t,i)=>e(t.moduleInstance,i))}destroy(){for(const e of this.moduleMap.keys())this.moduleMap.get(e)?.moduleInstance.destroy();this.moduleMap.clear()}},Pa=class extends ti{constructor(e={}){super(e),this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.startLine=!1,this.endLine=!1,this.horizontal=!1,this.strokeWidth=1}computeBBox(){return new de(this.x1,this.y1,this.x2-this.x1,this.y2-this.y1)}isPointInPath(e,t){return!1}render(e){const{ctx:t}=e;let{x1:i,y1:s,x2:n,y2:o}=this;i=this.align(i),s=this.align(s),n=this.align(n),o=this.align(o);const{fill:a,horizontal:r}=this,{globalAlpha:l}=t;a!=null&&(this.applyFillAndAlpha(t),t.beginPath(),t.moveTo(i,s),t.lineTo(n,s),t.lineTo(n,o),t.lineTo(i,o),t.closePath(),t.fill(),t.globalAlpha=l);const{stroke:c,strokeWidth:h,startLine:d,endLine:u}=this;if(!!((d||u)&&c&&h)){const{lineDash:g,lineDashOffset:f,lineCap:x,lineJoin:m}=this;this.applyStrokeAndAlpha(t),t.lineWidth=h,g&&t.setLineDash([...g]),f&&(t.lineDashOffset=f),x&&(t.lineCap=x),m&&(t.lineJoin=m),t.beginPath(),d&&(t.moveTo(i,s),r?t.lineTo(i,o):t.lineTo(n,s)),u&&(t.moveTo(n,o),r?t.lineTo(n,s):t.lineTo(i,o)),t.stroke(),t.globalAlpha=l}this.fillShadow?.markClean(),super.render(e)}};Pa.className="Range",M([ne()],Pa.prototype,"x1",2),M([ne()],Pa.prototype,"y1",2),M([ne()],Pa.prototype,"x2",2),M([ne()],Pa.prototype,"y2",2),M([ne()],Pa.prototype,"startLine",2),M([ne()],Pa.prototype,"endLine",2),M([ne()],Pa.prototype,"horizontal",2);function zW(e){return e!=null&&Object.hasOwn(e,"toString")&&Qt(e.toString())}function FW(e){return e!=null&&Object.hasOwn(e,"valueOf")&&Ye(e.valueOf())}function dm(e){return Ye(e)||id(e)||FW(e)}function BW(e,t){return e!=null&&(!t||dm(e))}function rM(e){return zW(e)&&Object.hasOwn(e,"id")?e.id:e}function ww(e){switch(e.type){case"line":return e.value;case"range":return e.range}}function Nw(e,t){const i=ww(e);if(i==null)return!1;const s=ut.is(t)||Zo.is(t),n=o=>BW(o,s)&&!Number.isNaN(t.convert(o,{clamp:!0}));if(e.type==="range"){const[o,a]=i;return n(o)&&n(a)}else return n(i)}var _W={top:{rangeH:0,rangeV:-1,labelH:0,labelV:1},"inside-top":{rangeH:0,rangeV:-1,labelH:0,labelV:1},"top-left":{rangeH:-1,rangeV:-1,labelH:-1,labelV:1},"inside-top-left":{rangeH:-1,rangeV:-1,labelH:-1,labelV:1},left:{rangeH:-1,rangeV:0,labelH:1,labelV:0},"inside-left":{rangeH:-1,rangeV:0,labelH:-1,labelV:0},"bottom-left":{rangeH:-1,rangeV:1,labelH:-1,labelV:-1},"inside-bottom-left":{rangeH:-1,rangeV:1,labelH:-1,labelV:-1},bottom:{rangeH:0,rangeV:1,labelH:0,labelV:-1},"inside-bottom":{rangeH:0,rangeV:1,labelH:0,labelV:-1},"bottom-right":{rangeH:1,rangeV:1,labelH:1,labelV:-1},"inside-bottom-right":{rangeH:1,rangeV:1,labelH:1,labelV:-1},right:{rangeH:1,rangeV:0,labelH:-1,labelV:0},"inside-right":{rangeH:1,rangeV:0,labelH:1,labelV:0},"top-right":{rangeH:1,rangeV:-1,labelH:1,labelV:1},"inside-top-right":{rangeH:1,rangeV:-1,labelH:1,labelV:1},inside:{rangeH:0,rangeV:0,labelH:0,labelV:0}},VW={top:{rangeH:0,rangeV:-1,labelH:0,labelV:1},"inside-top":{rangeH:0,rangeV:-1,labelH:0,labelV:-1},"top-left":{rangeH:-1,rangeV:-1,labelH:1,labelV:-1},"inside-top-left":{rangeH:-1,rangeV:-1,labelH:1,labelV:-1},left:{rangeH:-1,rangeV:0,labelH:1,labelV:0},"inside-left":{rangeH:-1,rangeV:0,labelH:1,labelV:0},"bottom-left":{rangeH:-1,rangeV:1,labelH:1,labelV:1},"inside-bottom-left":{rangeH:-1,rangeV:1,labelH:1,labelV:1},bottom:{rangeH:0,rangeV:1,labelH:0,labelV:-1},"inside-bottom":{rangeH:0,rangeV:1,labelH:0,labelV:1},"bottom-right":{rangeH:1,rangeV:1,labelH:-1,labelV:1},"inside-bottom-right":{rangeH:1,rangeV:1,labelH:-1,labelV:1},right:{rangeH:1,rangeV:0,labelH:-1,labelV:0},"inside-right":{rangeH:1,rangeV:0,labelH:-1,labelV:0},"top-right":{rangeH:1,rangeV:-1,labelH:-1,labelV:-1},"inside-top-right":{rangeH:-1,rangeV:-1,labelH:-1,labelV:-1},inside:{rangeH:0,rangeV:0,labelH:0,labelV:0}},GW={top:{rangeH:0,rangeV:-1,labelH:0,labelV:1},"inside-top":{rangeH:0,rangeV:-1,labelH:0,labelV:-1},"top-left":{rangeH:-1,rangeV:-1,labelH:-1,labelV:1},"inside-top-left":{rangeH:-1,rangeV:-1,labelH:-1,labelV:-1},left:{rangeH:-1,rangeV:0,labelH:1,labelV:0},"inside-left":{rangeH:-1,rangeV:0,labelH:-1,labelV:0},"bottom-left":{rangeH:-1,rangeV:1,labelH:-1,labelV:-1},"inside-bottom-left":{rangeH:-1,rangeV:1,labelH:-1,labelV:1},bottom:{rangeH:0,rangeV:1,labelH:0,labelV:-1},"inside-bottom":{rangeH:0,rangeV:1,labelH:0,labelV:1},"bottom-right":{rangeH:1,rangeV:1,labelH:1,labelV:-1},"inside-bottom-right":{rangeH:1,rangeV:1,labelH:1,labelV:1},right:{rangeH:1,rangeV:0,labelH:-1,labelV:0},"inside-right":{rangeH:1,rangeV:0,labelH:1,labelV:0},"top-right":{rangeH:1,rangeV:-1,labelH:1,labelV:1},"inside-top-right":{rangeH:1,rangeV:-1,labelH:1,labelV:-1},inside:{rangeH:0,rangeV:0,labelH:0,labelV:0}},jW={top:{rangeH:0,rangeV:-1,labelH:0,labelV:1},"inside-top":{rangeH:0,rangeV:-1,labelH:0,labelV:-1},"top-left":{rangeH:-1,rangeV:-1,labelH:1,labelV:-1},"inside-top-left":{rangeH:-1,rangeV:-1,labelH:-1,labelV:-1},left:{rangeH:-1,rangeV:0,labelH:1,labelV:0},"inside-left":{rangeH:-1,rangeV:0,labelH:-1,labelV:0},"bottom-left":{rangeH:-1,rangeV:1,labelH:1,labelV:1},"inside-bottom-left":{rangeH:-1,rangeV:1,labelH:-1,labelV:1},bottom:{rangeH:0,rangeV:1,labelH:0,labelV:-1},"inside-bottom":{rangeH:0,rangeV:1,labelH:0,labelV:1},"bottom-right":{rangeH:1,rangeV:1,labelH:-1,labelV:1},"inside-bottom-right":{rangeH:1,rangeV:1,labelH:1,labelV:1},right:{rangeH:1,rangeV:0,labelH:-1,labelV:0},"inside-right":{rangeH:1,rangeV:0,labelH:1,labelV:0},"top-right":{rangeH:1,rangeV:-1,labelH:-1,labelV:-1},"inside-top-right":{rangeH:1,rangeV:-1,labelH:1,labelV:-1},inside:{rangeH:0,rangeV:0,labelH:0,labelV:0}},ho=class extends Le{constructor(){super(...arguments),this.fontSize=14,this.fontFamily="Verdana, sans-serif",this.padding=5,this.color="rgba(87, 87, 87, 1)"}};M([C],ho.prototype,"enabled",2),M([C],ho.prototype,"text",2),M([C],ho.prototype,"fontStyle",2),M([C],ho.prototype,"fontWeight",2),M([C],ho.prototype,"fontSize",2),M([C],ho.prototype,"fontFamily",2),M([C],ho.prototype,"padding",2),M([C],ho.prototype,"color",2),M([C],ho.prototype,"position",2),M([C],ho.prototype,"rotation",2),M([C],ho.prototype,"parallel",2);var _s=class extends Le{constructor(){super(),this.id=hs(this),this.defaultColorRange=[],this.fill="#c16068",this.label=new ho,this.scale=void 0,this.clippedRange=[-1/0,1/0],this.gridLength=0,this.position="top",this.rangeGroup=new Be({name:this.id}),this.lineGroup=new Be({name:this.id}),this.labelGroup=new Be({name:this.id}),this.crossLineRange=new Pa,this.crossLineLabel=new vd,this.data=void 0,this.startLine=!1,this.endLine=!1,this._isRange=void 0,this.lineGroup.append(this.crossLineRange),this.labelGroup.append(this.crossLineLabel),this.crossLineRange.pointerEvents=1}get defaultLabelPosition(){return"top"}update(e){const{enabled:t,type:i,data:s,scale:n}=this;if(!n||!t||!e||!Nw(this,n)||s==null){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.rangeGroup.visible=e,this.lineGroup.visible=e,this.labelGroup.visible=e,this.updateNodes();const o=i==="range";o!==this._isRange&&(o?this.rangeGroup.appendChild(this.crossLineRange):this.lineGroup.appendChild(this.crossLineRange)),this._isRange=o}calculateLayout(e){if(this.data=void 0,!e)return;const{type:t,range:i,value:s,scale:n,clippedRange:o,strokeWidth:a=0}=this;if(!n)return;const r=n.bandwidth??0,l=n.step??0,c=n instanceof br?(l-r)/2:0;let[h,d]=Wi(o);h-=r,d+=r;let u,p,g,f;if(t==="line"){const x=r/2;if(u=n.convert(s)+x,p=Number.NaN,g=n.convert(s,{clamp:!0})+x,f=Number.NaN,g>=d||g<=h)return}else if(i){const[x,m]=i,[v,b]=pw(x,m);if(u=n.convert(x,{alignment:v}),p=n.convert(m,{alignment:b}),g=n.convert(x,{clamp:!0,alignment:v}),f=n.convert(m,{clamp:!0,alignment:b}),g>f&&([g,f]=[f,g],[u,p]=[p,u]),g>=d||f<=h)return;Number.isFinite(u)&&(g-=c),Number.isFinite(p)&&(p+=r,f+=r+c)}else return;g=Ld(g,o),f=Ld(f,o),u-c>=g&&(u-=c),p+c<=f&&(p+=c),this.startLine=a>0&&u>=g&&u<=g+c,this.endLine=a>0&&p>=f-r-c&&p<=f,this.data=[g,f],this.label.enabled===!1||this.label.text}updateNodes(){const{position:e,data:[t,i]=[0,0],gridLength:s}=this,n=Number.isFinite(i)?i-t:0;let o;switch(e){case"top":case"bottom":o=new de(t,e==="top"?0:-s,n,s);break;case"left":case"right":o=new de(e==="left"?0:-s,t,s,n)}this.updateRangeNode(o);const{label:a}=this;a.enabled!==!1&&a.text&&(this.updateLabel(),this.positionLabel(o))}updateRangeNode(e){const{type:t,position:i,crossLineRange:s,startLine:n,endLine:o,fill:a,fillOpacity:r,stroke:l,strokeWidth:c,strokeOpacity:h,lineDash:d}=this;s.x1=e.x,s.x2=e.x+e.width,s.y1=e.y,s.y2=e.y+e.height,s.horizontal=i==="top"||i==="bottom",s.startLine=n,s.endLine=o,s.fill=t==="range"?a:void 0,s.fillOpacity=r??1,s.stroke=l,s.strokeWidth=c??1,s.strokeOpacity=h??1,s.lineDash=d}updateLabel(){const{crossLineLabel:e,label:t}=this;t.text&&(e.fontStyle=t.fontStyle,e.fontWeight=t.fontWeight,e.fontSize=t.fontSize,e.fontFamily=t.fontFamily,e.fill=t.color,e.text=t.text)}get anchor(){const e=this.position==="left"||this.position==="right",t=this.type==="range",{position:i=this.defaultLabelPosition}=this.label;return t?(e?GW:jW)[i]:(e?_W:VW)[i]}positionLabel(e){const{crossLineLabel:t,label:i,anchor:s}=this;t.rotation=ds(i.rotation??0),t.textBaseline="middle",t.textAlign="center";const n=t.getBBox();if(!n)return;const{width:o,height:a}=n,r=i.padding+o/2,l=i.padding+a/2,c=e.x+e.width*(s.rangeH+1)/2-r*s.labelH,h=e.y+e.height*(s.rangeV+1)/2-l*s.labelV;t.x=c,t.y=h,t.rotationCenterX=c,t.rotationCenterY=h}computeLabelSize(){const{label:e}=this;if(e.enabled===!1||!e.text)return;const t=new vd;t.fontFamily=e.fontFamily,t.fontSize=e.fontSize,t.fontStyle=e.fontStyle,t.fontWeight=e.fontWeight,t.text=e.text,t.rotation=ds(e.rotation??0),t.textBaseline="middle",t.textAlign="center";const i=t.getBBox();if(!i)return;const{width:s,height:n}=i;return{width:s,height:n}}calculatePadding(e){const{label:t,anchor:i}=this,s=this.computeLabelSize();if(!s)return;const{width:n,height:o}=s,a=t.padding+n,r=t.padding+o,l=this.position==="left"||this.position==="right";l&&(i.rangeH===-1&&i.labelH===1?e.left=Math.max(e.left??0,a):i.rangeH===1&&i.labelH===-1&&(e.right=Math.max(e.right??0,a))),l||(i.rangeV===-1&&i.labelV===1?e.top=Math.max(e.top??0,r):i.rangeV===1&&i.labelV===-1&&(e.bottom=Math.max(e.bottom??0,r)))}};_s.className="CrossLine",M([C],_s.prototype,"enabled",2),M([C],_s.prototype,"type",2),M([C],_s.prototype,"range",2),M([C],_s.prototype,"value",2),M([C],_s.prototype,"defaultColorRange",2),M([C],_s.prototype,"fill",2),M([C],_s.prototype,"fillOpacity",2),M([C],_s.prototype,"stroke",2),M([C],_s.prototype,"strokeWidth",2),M([C],_s.prototype,"strokeOpacity",2),M([C],_s.prototype,"lineDash",2),M([C],_s.prototype,"label",2);var um=class{constructor(){this.enabled=!0,this.width=1,this.style=[{fill:void 0,fillOpacity:1,stroke:void 0,strokeWidth:void 0,lineDash:[]}]}};M([C],um.prototype,"enabled",2),M([C],um.prototype,"width",2),M([C],um.prototype,"style",2);var Bc=class extends Le{};M([C],Bc.prototype,"placement",2),M([C],Bc.prototype,"step",2),M([C],Bc.prototype,"values",2),M([C],Bc.prototype,"minSpacing",2),M([C],Bc.prototype,"maxSpacing",2);var It=class extends Le{constructor(){super(...arguments),this.enabled=!0,this.border=new Fc,this.wrapping="never",this.truncate=!1,this.spacing=5,this.color="#575757",this.avoidCollisions=!0,this.mirrored=!1,this.parallel=!1,this._formatters={"component:year":void 0,"component:month":void 0,"component:day":void 0,"component:none":void 0,"long:year":void 0,"long:month":void 0,"long:day":void 0,"long:none":void 0}}getSideFlag(){return this.mirrored?1:-1}formatValue(e,t,i,s){const{formatter:n,format:o}=this,{type:a,value:r,domain:l,boundSeries:c}=t,h=t.type==="number"?t.fractionDigits:void 0,d=t.type==="date"?t.unit:void 0;let u;if(n!=null){const p=t.type==="date"?t.step:void 0;u=e(n,{value:r,index:i,domain:l,fractionDigits:h,unit:d,step:p,boundSeries:c})}if(o!=null&&u==null){const{specifier:p,dateStyle:g="long",truncateDate:f}=s??{},x=`${g}:${f??"none"}`;let m=this._formatters[x];const v=Id.mergeSpecifiers(p,o);(m==null||m.type!==a||m.unit!==d||!Ci(m.mergedFormat,v))&&(m={type:a,mergedFormat:v,unit:d,formatter:Id.getFormatter(a,v,d,g,{truncateDate:f})},this._formatters[x]=m),u=m.formatter?.(r,h)}return u==null||Ne(u)?u:String(u)}};M([C],It.prototype,"enabled",2),M([C],It.prototype,"border",2),M([C],It.prototype,"cornerRadius",2),M([C],It.prototype,"fill",2),M([C],It.prototype,"fillOpacity",2),M([C],It.prototype,"fontStyle",2),M([C],It.prototype,"fontWeight",2),M([C],It.prototype,"fontSize",2),M([C],It.prototype,"fontFamily",2),M([C],It.prototype,"wrapping",2),M([C],It.prototype,"truncate",2),M([C],It.prototype,"spacing",2),M([C],It.prototype,"minSpacing",2),M([C],It.prototype,"color",2),M([C],It.prototype,"rotation",2),M([C],It.prototype,"avoidCollisions",2),M([C],It.prototype,"mirrored",2),M([C],It.prototype,"padding",2),M([C],It.prototype,"parallel",2),M([C],It.prototype,"itemStyler",2),M([C],It.prototype,"formatter",2),M([C],It.prototype,"format",2);var pm=class{constructor(){this.enabled=!0,this.width=1,this.stroke=void 0}};M([C],pm.prototype,"enabled",2),M([C],pm.prototype,"width",2),M([C],pm.prototype,"stroke",2);var _c=class extends Le{constructor(){super(...arguments),this.enabled=!0,this.width=1,this.size=6}};M([C],_c.prototype,"enabled",2),M([C],_c.prototype,"width",2),M([C],_c.prototype,"size",2),M([C],_c.prototype,"stroke",2);var qo=class extends Le{constructor(){super(...arguments),this.caption=new wt,this.enabled=!1,this.spacing=wt.SMALL_PADDING,this.fontSize=10,this.fontFamily="sans-serif",this.wrapping="always"}};M([C],qo.prototype,"enabled",2),M([C],qo.prototype,"text",2),M([C],qo.prototype,"spacing",2),M([C],qo.prototype,"fontStyle",2),M([C],qo.prototype,"fontWeight",2),M([C],qo.prototype,"fontSize",2),M([C],qo.prototype,"fontFamily",2),M([C],qo.prototype,"color",2),M([C],qo.prototype,"wrapping",2),M([C],qo.prototype,"formatter",2);var Ow=(e=>(e[e.TickAndDomain=0]="TickAndDomain",e[e.TicksOnly=1]="TicksOnly",e[e.Off=2]="Off",e))(Ow||{});function Ew(e){const[t,i]=Wi(e.range),s=Math.floor(t),n=Math.ceil(i);return{min:s,max:n,visible:s!==n}}var lM=Math.PI*2,HW=lM/2;function WW(e,t){return Math.abs(t-e)t?t+lM:t-lM}function Pw(e){const{min:t,max:i}=e,s=l=>li;return{tick:{fromFn(l,c,h){let{x1:d,x2:u,y1:p,y2:g}=l,f=l.opacity;return(h==="added"||s(c.offset))&&({x1:d,x2:u,y1:p,y2:g}=c,f=0),{x1:d,x2:u,y1:p,y2:g,opacity:f,phase:Xo[h]}},toFn(l,c,h){const{x1:d,x2:u,y1:p,y2:g}=c;let f=1;return h==="removed"&&(f=0),{x1:d,x2:u,y1:p,y2:g,opacity:f}},applyFn(l,c){l.setProperties(c),l.visible=!s(l.y)}},line:{fromFn(l,c){const{x1:h,x2:d,y1:u,y2:p}=l.previousDatum??c;return{x1:h,x2:d,y1:u,y2:p,phase:Xo.updated}},toFn(l,c){const{x1:h,x2:d,y1:u,y2:p}=c;return{x1:h,x2:d,y1:u,y2:p}}},label:{fromFn(l,c,h){const d=l.previousDatum??c;let{x:u,y:p,rotationCenterX:g,rotationCenterY:f,rotation:x}=d,m=l.opacity;return h==="removed"||s(d.y)?x=c.rotation:(h==="added"||s(l.datum.y))&&({x:u,y:p,rotationCenterX:g,rotationCenterY:f,rotation:x}=c,m=0),{x:u,y:p,rotationCenterX:g,rotationCenterY:f,rotation:x,opacity:m,phase:Xo[h]}},toFn(l,c,h){const{x:d,y:u,rotationCenterX:p,rotationCenterY:g}=c;let f=0,x=1;return h==="added"?f=c.rotation:h==="removed"?(x=0,f=c.rotation):f=WW(l.previousDatum?.rotation??c.rotation,c.rotation),{x:d,y:u,rotationCenterX:p,rotationCenterY:g,rotation:f,opacity:x,finish:{rotation:c.rotation}}}},group:{fromFn(l,c){const{translationX:h,translationY:d}=l;return{translationX:h,translationY:d,phase:Xo.updated}},toFn(l,c){const{translationX:h,translationY:d}=c;return{translationX:h,translationY:d}}}}}function Rw(){return(e,t)=>({translationX:t.translationX,translationY:t.translationY})}function gm(){return(e,t)=>({x:t.x,y:t.y,rotationCenterX:t.rotationCenterX,rotationCenterY:t.rotationCenterY,rotation:t.rotation})}function cM(){return(e,t)=>{const{x1:i,x2:s,y1:n,y2:o}=t;return{x1:i,x2:s,y1:n,y2:o}}}function zw(){return(e,t)=>{const{x1:i,x2:s,y1:n,y2:o}=t;return{x:i,y:n,width:s-i,height:o-n}}}var Fw=(e=>(e[e.TickLines=0]="TickLines",e[e.AxisLine=1]="AxisLine",e[e.TickLabels=2]="TickLabels",e))(Fw||{});function Bw(e,t){return e.domain===t.domain&&e.rangeExtent===t.rangeExtent&&e.nice===t.nice&&e.gridLength===t.gridLength&&e.visibleRange[0]===t.visibleRange[0]&&e.visibleRange[1]===t.visibleRange[1]&&e.initialPrimaryTickCount?.unzoomed===t.initialPrimaryTickCount?.unzoomed&&e.initialPrimaryTickCount?.zoomed===t.initialPrimaryTickCount?.zoomed}var Sr=class IV{constructor(t,i){this.moduleCtx=t,this.scale=i,this.id=hs(this),this._crossLines=[],this.nice=!0,this.reverse=!1,this.keys=[],this.interval=new Bc,this.dataDomain={domain:[],clipped:!1},this.title=new qo,this.gridLength=0,this.gridPadding=0,this.seriesAreaPadding=0,this.layoutConstraints={stacked:!0,align:"start",width:100,unit:"percent"},this.boundSeries=[],this.includeInvisibleDomains=!1,this.interactionEnabled=!0,this.axisGroup=new Be({name:`${this.id}-axis`}),this.tickLineGroup=this.axisGroup.appendChild(new md({name:`${this.id}-Axis-tick-lines`,zIndex:0})),this.tickLabelGroup=this.axisGroup.appendChild(new md({name:`${this.id}-Axis-tick-labels`,zIndex:2})),this.labelGroup=new Be({name:`${this.id}-Labels`,zIndex:11}),this.gridGroup=new us({name:`${this.id}-Axis-grid`,zIndex:2}),this.gridFillGroup=this.gridGroup.appendChild(new Be({name:`${this.id}-gridFills`})),this.gridLineGroup=this.gridGroup.appendChild(new Be({name:`${this.id}-gridLines`})),this.crossLineRangeGroup=new md({name:`${this.id}-CrossLines-Range`,zIndex:6}),this.crossLineLineGroup=new md({name:`${this.id}-CrossLines-Line`,zIndex:10}),this.crossLineLabelGroup=new md({name:`${this.id}-CrossLines-Label`,zIndex:15}),this.tickLabelGroupSelection=Bs.select(this.tickLabelGroup,vd,!1),this.line=new pm,this.tick=new _c,this.gridLine=new um,this.label=this.createLabel(),this.defaultTickMinSpacing=IV.defaultTickMinSpacing,this.translation={x:0,y:0},this.layout={label:{fractionDigits:0,spacing:this.label.spacing,format:this.label.format}},this.axisContext=void 0,this.cleanup=new St,this.isHovering=!1,this.range=[0,1],this.visibleRange=[0,1],this.animatable=!0,this.tickLayout=void 0,this.formatterBoundSeries=new ij(()=>{const{direction:s,boundSeries:n}=this;return cr(n.flatMap(o=>o.getFormatterContext(s)))}),this.moduleMap=new aM,this.range=this.scale.range.slice();for(const s of this.crossLines)this.initCrossLine(s);this.cleanup.register(this.moduleCtx.widgets.containerWidget.addListener("mousemove",s=>this.onMouseMove(s)),this.moduleCtx.widgets.containerWidget.addListener("mouseleave",()=>this.endHovering()))}set crossLines(t){const{CrossLineConstructor:i}=this.constructor;for(const s of this._crossLines)this.detachCrossLine(s);this._crossLines=t.map(s=>{const n=new i;return n.set(s),n});for(const s of this._crossLines)this.attachCrossLine(s),this.initCrossLine(s)}get crossLines(){return this._crossLines}get type(){return this.constructor.type??""}get primaryLabel(){}get primaryTick(){}isCategoryLike(){return!1}resetAnimation(t){}onMouseMove(t){const s=this.tickLabelGroup.pickNode(t.currentX,t.currentY)?.datum,{textUntruncated:n=void 0}=s??{};n?(this.moduleCtx.tooltipManager.updateTooltip(this.id,{canvasX:t.currentX,canvasY:t.currentY,showArrow:!1},[{type:"structured",title:n}]),this.isHovering=!0):this.endHovering()}endHovering(){this.isHovering&&(this.moduleCtx.tooltipManager.removeTooltip(this.id),this.isHovering=!1)}attachCrossLine(t){this.crossLineRangeGroup.appendChild(t.rangeGroup),this.crossLineLineGroup.appendChild(t.lineGroup),this.crossLineLabelGroup.appendChild(t.labelGroup)}detachCrossLine(t){t.rangeGroup.remove(),t.lineGroup.remove(),t.labelGroup.remove()}destroy(){this.moduleMap.destroy(),this.cleanup.flush()}setScaleRange(t){const{range:i,scale:s}=this,n=(i[1]-i[0])/(t[1]-t[0]),o=n*t[0],a=i[0]-o;s.range=[a,a+n]}updateScale(){const{range:[t,i]}=this;this.setScaleRange(this.visibleRange);for(const s of this.crossLines)s.clippedRange=[t,i]}setCrossLinesVisible(t){this.crossLineRangeGroup.visible=t,this.crossLineLineGroup.visible=t,this.crossLineLabelGroup.visible=t}attachAxis(t){t.gridNode.appendChild(this.gridGroup),t.axisNode.appendChild(this.axisGroup),t.labelNode.appendChild(this.labelGroup),t.crossLineRangeNode.appendChild(this.crossLineRangeGroup),t.crossLineLineNode.appendChild(this.crossLineLineGroup),t.crossLineLabelNode.appendChild(this.crossLineLabelGroup)}detachAxis(){this.gridGroup.remove(),this.axisGroup.remove(),this.labelGroup.remove(),this.crossLineRangeGroup.remove(),this.crossLineLineGroup.remove(),this.crossLineLabelGroup.remove()}attachLabel(t){this.labelGroup.append(t)}inRange(t,i=0){const[s,n]=Wi(this.range);return t>=s-i&&t<=n+i}getRangeOverflow(t){const{range:i,visibleRange:s}=this,n=(i[1]-i[0])/(s[1]-s[0]),[o,a]=Wi([i[0]-n*s[0],i[0]-n*s[0]+n]);return ta?t-a:0}onGridLengthChange(t,i){i^t&&this.onGridVisibilityChange();for(const s of this.crossLines)this.initCrossLine(s)}onGridVisibilityChange(){}createLabel(){return new It}update(){this.formatterBoundSeries.clear(),this.updatePosition(),this.updateSelections(),this.gridLineGroup.visible=this.gridLine.enabled,this.updateLabels(),this.updateCrossLines()}getLabelStyles(t,i,s=this.label){const n={border:s.border,color:s.color,cornerRadius:s.cornerRadius,fill:s.fill,fillOpacity:s.fillOpacity,fontFamily:s.fontFamily,fontSize:s.fontSize,fontStyle:s.fontStyle,fontWeight:s.fontWeight,padding:s.padding,spacing:s.spacing};let o;s.itemStyler&&(o=this.cachedCallWithContext(s.itemStyler,{...t,...n}));const a=st(o,i,n);return{border:a.border,color:a.color,cornerRadius:a.cornerRadius,fill:a.fill,fillOpacity:a.fillOpacity,fontFamily:a.fontFamily,fontSize:a.fontSize,fontStyle:a.fontStyle,fontWeight:a.fontWeight,padding:a.padding,spacing:a.spacing}}getTickSize(t=this.tick){return t.enabled?t.size:0}processData(){this.invalidateLayoutCache();const{includeInvisibleDomains:t,boundSeries:i,direction:s}=this,o=(t?i:i.filter(a=>a.isEnabled())).map(a=>a.getDomain(s));this.setDomains(...o)}setDomains(...t){let i,s;t.length>0?{domain:i,animatable:s}=this.scale.normalizeDomains(...t):(i=[],s=!0),this.dataDomain=this.normaliseDataDomain(i),this.reverse&&this.dataDomain.domain.reverse(),this.animatable=s}calculateDomain(t){const{dataDomain:{domain:i},range:s,nice:n,scale:o,gridLength:a}=this,r=Pc(s),l=[0,1];this.updateScale();const{unzoomedTickLayoutCache:c}=this;let h;if(c==null||!Bw(c,{domain:i,rangeExtent:r,nice:n,gridLength:a,visibleRange:l,initialPrimaryTickCount:t})){const d=o.range;this.setScaleRange([0,1]);const u=n?0:2;h=this.calculateTickLayout(i,u,[0,1],t),o.range=d,this.unzoomedTickLayoutCache={domain:i,rangeExtent:r,nice:n,gridLength:a,visibleRange:l,initialPrimaryTickCount:t,tickLayout:h}}else h=c.tickLayout;return this.updateScale(),o.domain=h.niceDomain,{unzoomedTickLayout:h,domain:o.domain}}calculateLayout(t,i){this.chartLayout=i;const{visibleRange:s,nice:n}=this,o=s[0]===0&&s[1]===1,{unzoomedTickLayout:a,domain:r}=this.calculateDomain(t);let l;if(o)l=a;else{const{range:g,gridLength:f}=this,x=Pc(g),m=n?1:2,{tickLayoutCache:v}=this;v==null||!Bw(v,{domain:r,rangeExtent:x,nice:n,gridLength:f,visibleRange:s,initialPrimaryTickCount:t})?(l=this.calculateTickLayout(r,m,s,t),this.tickLayoutCache={domain:r,rangeExtent:x,nice:n,gridLength:f,visibleRange:s,initialPrimaryTickCount:t,tickLayout:l}):l=v.tickLayout}const{rawTickCount:c=0,fractionDigits:h,bbox:d}=l,u=a.rawTickCount??0,p=c!==0&&u!==0?{zoomed:c,unzoomed:u}:void 0;return this.tickLayout=l.layout,this.layout.label={fractionDigits:h,spacing:this.label.spacing,format:this.label.format},this.layoutCrossLines(),{primaryTickCount:p,bbox:d}}invalidateLayoutCache(){this.unzoomedTickLayoutCache=void 0,this.tickLayoutCache=void 0,this.tickLayout=void 0}updateCrossLines(){const t=this.hasDefinedDomain()||this.hasVisibleSeries();for(const i of this.crossLines)i.update(t)}updatePosition(){const{crossLineRangeGroup:t,crossLineLineGroup:i,crossLineLabelGroup:s,gridGroup:n,translation:o}=this,a=Math.floor(o.x),r=Math.floor(o.y);n.setProperties({translationX:a,translationY:r}),t.setProperties({translationX:a,translationY:r}),i.setProperties({translationX:a,translationY:r}),s.setProperties({translationX:a,translationY:r})}tickFormatter(t,i,s,n,o,a="long"){const{moduleCtx:r,label:l}=this,{formatManager:c}=r,h=s?this.primaryLabel:void 0,d=this.tickFormatParams(t,i,n,o),u=this.formatterBoundSeries.get();let p,g,f;if(d.type==="number")p=d.fractionDigits;else if(d.type==="date"){const{unit:D,step:L,epoch:I}=d;g={unit:D,step:L,epoch:I},f=d.truncateDate}const x=this.uncachedCallWithContext.bind(this),m={datum:void 0,seriesId:void 0,legendItemName:void 0,key:void 0,source:"axis-label",property:this.direction,domain:t,boundSeries:u},v=h??l,b=s?l.format:void 0,S={specifier:Id.mergeSpecifiers(h?.format,l.format),truncateDate:f};return(D,L)=>{const I=this.datumFormatParams(D,m,p,g,a);return I.value=D,v.formatValue(x,I,L,{specifier:b,dateStyle:a,truncateDate:f})??c.format(x,I,S)??c.defaultFormat(I,S)}}formatDatum(t,i,s,n,o,a,r,l,c,h){if(i==null)return"";const{moduleCtx:d,direction:u,dataDomain:p}=this;l??(l=p.domain);const{formatManager:g}=d,f=this.formatterBoundSeries.get();let x;switch(s){case"crosshair":case"annotation-label":x=this.layout.label.fractionDigits+1;break;case"series-label":x=2;break;case"tooltip":x=3;break;case"legend-label":x=void 0;break}const m=this.datumFormatParams(i,{source:s,datum:a,seriesId:n,legendItemName:o,key:r,property:u,domain:l,boundSeries:f},x,void 0,"long"),{type:v,value:b}=m,S=this.createCallWithContext(t),D=c?.formatValue(S,v,b,h??m)??g.format(S,m)??this.label.formatValue(S,m,Number.NaN)??g.defaultFormat(m);return Ne(D)?D:String(D)}getBBox(){return this.axisGroup.getBBox()}initCrossLine(t){t.scale=this.scale,t.gridLength=this.gridLength}hasVisibleSeries(){return this.boundSeries.some(t=>t.isEnabled())}clipTickLines(t,i,s,n){this.tickLineGroup.setClipRect(new de(t,i,s,n))}clipGrid(t,i,s,n){this.gridGroup.setClipRect(new de(t,i,s,n))}getTitleFormatterParams(t){const{direction:i}=this,s=this.formatterBoundSeries.get();return{domain:t,direction:i,boundSeries:s,defaultValue:this.title?.text}}normaliseDataDomain(t){return{domain:[...t],clipped:!1}}getLayoutState(){return{id:this.id,rect:this.getBBox(),gridPadding:this.gridPadding,seriesAreaPadding:this.seriesAreaPadding,tickSize:this.getTickSize(),direction:this.direction,domain:this.dataDomain.domain,scale:this.scale,...this.layout}}getModuleMap(){return this.moduleMap}createModuleContext(){return this.axisContext??(this.axisContext=this.createAxisContext()),{...this.moduleCtx,parent:this.axisContext}}createAxisContext(){const{scale:t}=this;return{axisId:this.id,scale:this.scale,direction:this.direction,continuous:ut.is(t)||Zo.is(t),getCanvasBounds:()=>zt.toCanvas(this.axisGroup),seriesKeyProperties:()=>this.boundSeries.reduce((i,s)=>{const n=s.getKeyProperties(this.direction);for(const o of n)i.add(o);return i},new Set),seriesIds:()=>this.boundSeries.map(i=>i.id),scaleInvert:i=>t.invert(i,!0),scaleInvertNearest:i=>t.invert(i,!0),formatScaleValue:(i,s,n)=>this.formatDatum(void 0,i,s,void 0,void 0,void 0,void 0,void 0,n),attachLabel:i=>this.attachLabel(i),inRange:(i,s)=>this.inRange(i,s),getRangeOverflow:i=>this.getRangeOverflow(i),pickBand:i=>this.pickBand(i)}}pickBand(t){if(!br.is(this.scale))return;const{scale:i,range:s}=this,n=i.invert(this.isVertical()?t.y:t.x,!0),o=i.bandwidth??0,r=((i.step??0)-o)/2,l=i.convert(n),c=l-r,h=l+o+r;return{id:this.id,value:n,band:[Ld(c,s),Ld(h,s)],position:l}}isVertical(){return this.direction==="y"}isReversed(){return this.reverse}cachedCallWithContext(t,i){const{callbackCache:s,chartService:n}=this.moduleCtx;return s.call([this,n],t,i)}uncachedCallWithContext(t,i){const{chartService:s}=this.moduleCtx;return Uo([this,s],t,i)}createCallWithContext(t){const{chartService:i}=this.moduleCtx;return(s,n)=>Uo([t,this,i],s,n)}};Sr.defaultTickMinSpacing=50,Sr.CrossLineConstructor=_s,M([C],Sr.prototype,"nice",2),M([C],Sr.prototype,"reverse",2),M([C],Sr.prototype,"keys",2),M([C],Sr.prototype,"interval",2),M([C],Sr.prototype,"title",2),M([pl((e,t,i)=>e.onGridLengthChange(t,i))],Sr.prototype,"gridLength",2);var hM=Sr,dM=class extends It{constructor(){super(...arguments),this.autoRotateAngle=335}};M([C],dM.prototype,"autoRotate",2),M([C],dM.prototype,"autoRotateAngle",2);var Ed=1e3,fl=Ed*60,Vc=fl*60,Gc=Vc*24,_w=Gc*7,uM=Gc*30,Up=Gc*365,Pd=new Date().getTimezoneOffset()*fl,Kp={millisecond:{milliseconds:1,hierarchy:"day",encode(e){return e.getTime()},decode(e){return new Date(e)}},second:{milliseconds:Ed,hierarchy:"day",encode(e,t){const i=t?0:Pd;return Math.floor((e.getTime()-i)/Ed)},decode(e,t){const i=t?0:Pd;return new Date(i+e*Ed)}},minute:{milliseconds:fl,hierarchy:"day",encode(e,t){const i=t?0:Pd;return Math.floor((e.getTime()-i)/fl)},decode(e,t){const i=t?0:Pd;return new Date(i+e*fl)}},hour:{milliseconds:Vc,hierarchy:"day",encode(e,t){const i=t?0:Pd;return Math.floor((e.getTime()-i)/Vc)},decode(e,t){const i=t?0:Pd;return new Date(i+e*Vc)}},day:{milliseconds:Gc,hierarchy:"month",encode(e,t){const i=t?0:e.getTimezoneOffset()*fl;return Math.floor((e.getTime()-i)/Gc)},decode(e,t){let i;return t?(i=new Date(0),i.setUTCDate(i.getUTCDate()+e),i.setUTCHours(0,0,0,0)):(i=new Date(1970,0,1),i.setDate(i.getDate()+e)),i}},month:{milliseconds:uM,hierarchy:"year",encode(e,t){return t?e.getUTCFullYear()*12+e.getUTCMonth():e.getFullYear()*12+e.getMonth()},decode(e,t){if(t){const i=Math.floor(e/12),s=e-i*12;return new Date(Date.UTC(i,s,1))}else{const i=Math.floor(e/12),s=e-i*12;return new Date(i,s,1)}}},year:{milliseconds:Up,hierarchy:void 0,encode(e,t){return t?e.getUTCFullYear():e.getFullYear()},decode(e,t){let i;return t?(i=new Date,i.setUTCFullYear(e),i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):i=new Date(e,0,1,0,0,0,0),i}}};function Yp(e){return typeof e=="string"?{unit:e,step:1,epoch:void 0,utc:!1}:{unit:e.unit,step:e.step??1,epoch:e.epoch,utc:e.utc??!1}}function Zp(e,t,i,s){if(i==null)return 0;const n=Kp[e];return Math.floor(n.encode(new Date(i),s))%t}function Rd(e,t,i,s,n){const o=Kp[t];return Math.floor((o.encode(new Date(e),s)-n)/i)}function Xp(e,t,i,s,n){return Kp[t].decode(e*i+n,s)}function fm(e,t,i,s,n){const o=new Date(e),a=Rd(o,t,i,s,n);return Xp(a,t,i,s,n)}function ym(e,t,i,s,n){const o=new Date(Number(e)-1),a=Rd(o,t,i,s,n);return Xp(a+1,t,i,s,n)}function uo(e,t){const{unit:i,step:s,epoch:n,utc:o}=Yp(e),a=Zp(i,s,n,o);return fm(t,i,s,o,a)}function Vw(e,t){const{unit:i,step:s,epoch:n,utc:o}=Yp(e),a=Zp(i,s,n,o);return ym(t,i,s,o,a)}function Gw(e,t){const{unit:i,step:s,epoch:n,utc:o}=Yp(e),a=Zp(i,s,n,o);return Xp(Rd(ym(t,i,s,o,a),i,s,o,a)-1,i,s,o,a)}function pM(e,t){const{unit:i,step:s,epoch:n,utc:o}=Yp(e),a=Zp(i,s,n,o);return Xp(Rd(fm(t,i,s,o,a),i,s,o,a)+1,i,s,o,a)}function gM(e,t,i){if(e.valueOf()>t.valueOf()&&([e,t]=[t,e],i!=null&&(i=[1-i[1],1-i[0]])),i!=null){const s=t.valueOf()-e.valueOf(),n=e.valueOf();e=new Date(n+i[0]*s),t=new Date(n+i[1]*s)}return[new Date(e),new Date(t)]}function mm(e,t,i,{extend:s=!1,visibleRange:n=[0,1],limit:o,defaultAlignment:a="start"}={}){const r=Yp(e),{unit:l,step:c,utc:h}=r;let d;r.epoch!=null?d=r.epoch:a==="interval"?d=void 0:t.valueOf()>i.valueOf()?d=i:d=t;const u=Zp(r.unit,r.step,d,r.utc);let[p,g]=gM(t,i,n);p=s?fm(p,l,c,h,u):ym(p,l,c,h,u),g=s?ym(g,l,c,h,u):fm(g,l,c,h,u);const f=Rd(p,l,c,h,u);let x=Rd(g,l,c,h,u);return o!=null&&x-f>o&&(x=f+o),{range:[f,x],unit:l,step:c,utc:h,offset:u}}function fM(e,t,i,s){const{range:[n,o]}=mm(e,t,i,s);return Math.abs(o-n)}function po(e,t,i,s){const{range:[n,o],unit:a,step:r,utc:l,offset:c}=mm(e,t,i,s),h=[];for(let d=n;d<=o;d+=1){const u=Xp(d,a,r,l,c);h.push(u)}return h}function yM(e,t,i,{extend:s,visibleRange:n,limit:o,defaultAlignment:a}={}){const{range:[r]}=mm(e,t,i,{extend:s,visibleRange:n,limit:o,defaultAlignment:a}),{range:[l]}=mm(e,t,i,{extend:s,limit:o,defaultAlignment:a});return r-l}function Mr(e){return typeof e=="string"?e:e.unit}function yl(e){return typeof e=="string"?1:e.step??1}function qp(e){return typeof e=="string"?void 0:e.epoch}function Qp(e){return Kp[Mr(e)].hierarchy}function yn(e){return yl(e)*Kp[Mr(e)].milliseconds}function ys(e){return e instanceof Date?e.getTime():e}function Jp(e){return e1?1:0;return{ticks:n[f]?[n[f]]:[],count:void 0,firstTickIndex:f}}let a=o!=null&&o!==0?Math.trunc(n.length/o):1;if(a=_0(a),a<=1)return Hw(i,!1,s);o=Math.trunc(n.length/a);const r=a*o,l=_0(Math.trunc((n.length-r)/2)),c=ve(0,Math.floor((s?.[0]??0)*n.length),n.length),h=ve(0,Math.ceil((s?.[1]??1)*n.length),n.length),d=Math.floor((c-l)/a)*a+l,u=Math.ceil((h-l)/a)*a+l,p=[];for(let f=d;f=0&&f0?this.findIndex(p[0]):void 0;return g!=null&&(g=Math.floor((g-l)/a)),{ticks:p,count:void 0,firstTickIndex:g}}findIndex(t){const{index:i,indexInitialized:s}=this;if(!s){const{domain:n}=this;for(let o=0;oNumber(e[0])?1:-1;let i=-1/0*t;for(const s of e){const n=s.valueOf();if(Math.sign(n-i)!==t)return;i=n}return t}function MM(e,[t,i],[s,n]){const o=n-s,a=i-t,r=t+a*e[0],l=t+a*e[1];return[(r-s)/o,(l-s)/o]}var _t=(e,t)=>({duration:yn(e)*t,timeInterval:e,step:t}),DM=[_t({unit:"second"},1),_t({unit:"second"},5),_t({unit:"second"},15),_t({unit:"second"},30),_t({unit:"minute"},1),_t({unit:"minute"},5),_t({unit:"minute"},15),_t({unit:"minute"},30),_t({unit:"hour"},1),_t({unit:"hour"},3),_t({unit:"hour"},6),_t({unit:"hour"},12),_t({unit:"day"},1),_t({unit:"day"},2),_t({unit:"day",step:7},1),_t({unit:"day",step:7},2),_t({unit:"day",step:7},3),_t({unit:"month"},1),_t({unit:"month"},2),_t({unit:"month"},3),_t({unit:"month"},4),_t({unit:"month"},6),_t({unit:"year"},1)],$w=[1,2,5,10];function Uw(e,t){return Math.abs(Math.round(e)-e)=i?Math.abs(t-e)/i+1:1}function eg(e,t,i,s,n,o){if(e===t)return{ticks:[e],count:1,firstTickIndex:0};if(i<2)return{ticks:[e,t],count:2,firstTickIndex:0};const a=tg(e,t,i,s,n);if(!Number.isFinite(a))return{ticks:[],count:0,firstTickIndex:void 0};let r=e,l=t;Uw(r/a,1e-12)||(r=Math.ceil(r/a)*a),Uw(l/a,1e-12)||(l=Math.floor(l/a)*a),o!=null&&(o=MM(o,[e,t],[r,l]));const{ticks:c}=vm(r,l,a,o),h=c.at(0);return{ticks:c,count:Kw(r,l,a),firstTickIndex:h==null?void 0:Math.round((h-r)/a)}}var YW=Math.floor(2*_w/uM*10)/10;function Yw({timeInterval:e,step:t}){const i=yn(e)*t,s=Qp(e),n=s?yn(s):void 0;return i<=(n??1/0)*YW}function Zw(e,{weekStart:t}){if(e.unit==="day"&&e.step===7)return t}function bm(e,t,i,s,n,{weekStart:o,primaryOnly:a=!1,targetInterval:r}){if(i<=0)return;const l=r??Math.abs(t-e)/Math.max(i,1),c=DM.findLast(p=>(!a||Yw(p))&&l>p.duration),h=DM.find(p=>(!a||Yw(p))&&l<=p.duration);if(c==null)return{unit:"millisecond",step:Math.max(tg(e,t,i,s,n),1)};if(h==null)return{unit:"year",step:r==null?tg(e/Up,t/Up,i,s,n):1};const{timeInterval:d,step:u}=l-c.duration=s&&d<=n;if(c&&!u)continue;const p=Math.abs(d-i);(l>p||c!==u)&&(c||(c=u),l=p,r=h)}return r*a}function Xw(e){for(let t=e.length-1;t>=0;t-=1)if(e[t]!=="0")return t+1;return 0}function ZW(e,t){const i=TS(t??",f");if(i==null)return;(i.precision==null||Number.isNaN(i.precision))&&(!i.type||"eEFgGnprs".includes(i.type)?i.precision=Math.max(...e.map(n=>{if(!Number.isFinite(n))return 0;const[o,a]=n.toExponential((i.type?6:12)-1).split(/[.e]/g);return(o!=="1"&&o!=="-1"?1:0)+Xw(a)+1})):"f%".includes(i.type)&&(i.precision=Math.max(...e.map(n=>{if(!Number.isFinite(n)||n===0)return 0;const o=Math.floor(Math.log10(Math.abs(n))),a=i.type?6:12,r=n.toExponential(a-1).split(/[.e]/g)[1],l=Xw(r);return Math.max(0,l-o)}))));const s=_C(i);return n=>s(Number(n))}function vm(e,t,i,s){if(!Number.isFinite(i)||i<=0)return{ticks:[],count:0,firstTickIndex:void 0};if(e===t)return{ticks:[e],count:1,firstTickIndex:0};const n=10**dp(i),o=Math.min(e,t),a=Math.max(e,t);let r,l;if(s!=null&&(s[0]!==0||s[1]!==1)){const d=t-e,u=e+d*s[0],p=t-d*(1-s[1]);r=Math.min(u,p),l=Math.max(u,p)}else r=o,l=a;r=Math.floor(r*n)/n,l=Math.ceil(l*n)/n;const c=[];for(let d=0;;d+=1){const u=Math.round((o+i*d)*n)/n;if(u>a)break;u>=r&&u<=l&&c.push(u)}const h=c.at(0);return{ticks:c,count:Kw(o,a,i),firstTickIndex:h==null?void 0:Math.round((h-o)/i)}}function Fd(e,t){return e>=t?(K.warnOnce("the configured interval results in more than 1 item per pixel, ignoring. Supply a larger interval or omit this configuration"),!0):!1}function qw(e,t){const i=Math.abs(t-e),s=10**Math.floor(Math.log10(i));let n=1/0,o=[e,t];for(const a of $w){const r=a*s,l=Math.floor(e/r)*r,c=Math.ceil(t/r)*r,h=1-i/Math.abs(c-l);n>h&&(n=h,o=[l,c])}return o}function Qw(e,t,i,s,n,o){if(e<=0)return{minTickCount:0,maxTickCount:0,tickCount:0};o=Math.max(o,e/(n+1)),i??(i=o),s??(s=e),i>s&&(i===o?i=s:s=i),i=Math.max(i,1);const a=Math.max(1,Math.floor(e/(t*i))),r=Math.min(a,Math.ceil(e/(t*s))),l=ve(r,Math.floor(n/t),a);return{minTickCount:r,maxTickCount:a,tickCount:l}}var Sm=new Date(1970,0,4),Bd=class CV extends ut{constructor(){super([],[0,1]),this.type="time"}static is(t){return t instanceof CV}toDomain(t){return new Date(t)}convert(t,i){return super.convert(t?.valueOf()??Number.NaN,i)}invert(t){return new Date(super.invert(t))}niceDomain(t,i=this.domain){if(i.length<2)return[];let[s,n]=i;const o=4,a=this.getPixelRange();for(let r=0;ra%d.duration===0);if(r){const{timeInterval:d,step:u,duration:p}=r,g={...d,step:u*yl(d)*Math.round(a/p),epoch:Zw(d,{weekStart:Sm})};return po(g,new Date(e),new Date(t),{visibleRange:n,extend:o})}let l=new Date(Math.min(e,t));const c=new Date(Math.max(e,t)),h=[];for(;l<=c;)h.push(l),l=new Date(l),l.setMilliseconds(l.getMilliseconds()+a);return h}function qW(e,t,i,s){const{interval:n}=i,o=Math.min(ys(e),ys(t)),a=Math.max(ys(e),ys(t));let r;if(ft(n)||typeof n=="string")r=n;else{let d;typeof n=="number"&&(d=(a-o)/Math.max(n,1),Fd(d,s)&&(d=void 0)),d??(d=i.tickCount??ut.defaultTickCount),r=bm(o,a,d,i.minTickCount,i.maxTickCount,{weekStart:Sm})}if(r==null)return[e,t];const l=po(r,new Date(o),new Date(a),{extend:!0});if(l==null||l.length<2)return[e,t];const c=l[0],h=l.at(-1);return e<=t?[c,h]:[h,c]}var _d=class LV extends Zo{constructor(){super(...arguments),this.type="ordinal-time",this.defaultTickCount=ut.defaultTickCount,this._domain=[],this.isReversed=!1}static is(t){return t instanceof LV}set domain(t){t!==this._domain&&(this.invalid=!0,this._domain=t,this._bands=void 0,this.isReversed=Jw(t))}get domain(){return this._domain}get bands(){return this._bands??(this._bands=this.isReversed?this.domain.slice().reverse():this.domain),this._bands}normalizeDomains(...t){const i=t.filter(s=>s.length>0);if(i.length===0)return{domain:[],animatable:!1};if(i.length===1){let s=i[0];const n=SM(s);return n===-1?s=s.slice().reverse():n==null&&(s=vM(s.slice())),{domain:s,animatable:!0}}return{domain:vM(i.flat()),animatable:!0}}ticks(t,i,s=[0,1],{extend:n=!1,dropInitial:o=!1}={}){const{interval:a,maxTickCount:r,tickCount:l=r}=t,{bands:c}=this;if(!c.length)return;if(this.refresh(),a==null){const{ticks:v,tickOffset:b,tickEvery:S}=this.getDefaultTicks(i,l,s,n);let D=v.length>0?this.findIndex(v[0]):void 0;return D=D==null?void 0:Math.floor((D-b)/S),{ticks:v,count:void 0,firstTickIndex:D}}let h,d;i&&i.length>=2?(h=i[0].valueOf(),d=i.at(-1).valueOf()):(h=c[0].valueOf(),d=c.at(-1).valueOf());const[u,p]=this.range,g=Math.abs(p-u),f=kM({start:h,stop:d,interval:a,availableRange:g,visibleRange:s,extend:n})??this.getDefaultTicks(i,l,s,n).ticks,x=[];let m=-1;for(const v of f){const b=this.findIndex(v,1)??-1,S=b===m;m=b,!(o&&b===0)&&b!==-1&&!S&&x.push(c[b])}return{ticks:x,count:void 0,firstTickIndex:void 0}}stepTicks(t,i,s=[0,1],n=!0){const o=i?this.bandDomainIndices(i):void 0,a=this.ticksEvery(o,s,t,0,!1),r=a.at(-1),l=n&&t>1?o?.[1]:void 0,c=l!=null&&r!=null?this.findIndex(r):void 0;return c!=null&&l!=null&&l-c0&&e[0]>e.at(-1)}var eN=5e7,ml=class TV extends Zo{constructor(){super(...arguments),this.type="unit-time",this.defaultTickCount=12,this._domain=[],this._bands=void 0}static is(t){return t instanceof TV}static supportsInterval(t,i){return tN(t,i)}set domain(t){t!==this._domain&&(this._domain=t,this._bands=void 0)}get domain(){return this._domain}get interval(){return this._interval}set interval(t){this._interval!==t&&(this._interval=t,this._bands=void 0)}get bands(){return this._bands??(this._bands=this.calculateBands(this._domain,[0,1]).bands),this._bands}normalizeDomains(...t){return V0(...t)}convert(t,i){this.refresh(),t instanceof Date||(t=new Date(t));const{domain:s,interval:n}=this;if(s.length<2)return Number.NaN;if(i?.clamp!==!0&&n!=null){const o=t.valueOf(),[a,r]=Mm(s,n),l=Math.min(a.valueOf(),r.valueOf()),c=Math.max(a.valueOf(),r.valueOf()),h=pM(n,new Date(c)).valueOf();if(o=h)return Number.NaN}return super.convert(t,i)}calculateBands(t,i,s=!1){if(t===this.domain&&i[0]===0&&i[1]===1&&!s&&this._bands!=null)return{bands:this._bands,firstBandIndex:0};if(t.length<2)return{bands:[],firstBandIndex:void 0};const{interval:n}=this;if(n==null)return{bands:[],firstBandIndex:void 0};const o={visibleRange:i,extend:s};if(!tN(t,n,o))return{bands:[],firstBandIndex:void 0};const[a,r]=Mm(t,n);if(fM(n,a,r,o)>eN)return K.warnOnce("the configured unit results in too many bands, ignoring. Supply a larger unit."),{bands:[],firstBandIndex:void 0};const l=po(n,a,r,o),c=yM(n,a,r,o);return{bands:l,firstBandIndex:c}}ticks({interval:t},i=this.domain,s=[0,1],{extend:n=!1}={}){if(i.length<2)return;let o,a,r;if(i===this.domain&&!n?({bands:o}=this.calculateBands(i,[0,1],!1),r=$W(o,!1,s),a=r[0]):{bands:o,firstBandIndex:a}=this.calculateBands(i,s,n),t==null)return{ticks:o,count:void 0,firstTickIndex:a};const l=this.interval?yn(this.interval):1/0,c=Math.min(i[0].valueOf(),i[1].valueOf()),h=Math.max(i[0].valueOf(),i[1].valueOf());let d,u,p;if(ft(t)||typeof t=="string")d=po(t,i[0],i[1],{extend:!0,visibleRange:s}),u=0,p=d.length-1;else{const S=r?r[0]:0,D=r?r[1]:o.length-1;d=o,u=kc(S,D,L=>o[L].valueOf()<=c)??S,p=kc(S,D,L=>o[L].valueOf()<=h)??D}const g=[];let f;for(let S=u;S<=p;S++){const D=d[S].valueOf(),L=kc(0,o.length-1,A=>o[A].valueOf()<=D),I=L!=null&&L!=f?o[L]:void 0;f=L,I!=null&&D-I.getTime()<=l&&g.push(I)}let x,m;if(this.interval){const S=Mm([new Date(c),new Date(h)],this.interval);x=S[0].valueOf(),m=S[1].valueOf()}else x=c,m=h;let v=mp(0,g.length-1,S=>g[S].valueOf()>=x)??0,b=kc(0,g.length-1,S=>g[S].valueOf()<=m)??g.length-1;return n&&(v=Math.max(v-1,0),b=Math.min(b+1,g.length-1)),{ticks:g.slice(v,b+1),count:g.length,firstTickIndex:a}}};function tN(e,t,i){const[s,n]=Mm(e,t);return fM(t,s,n,i)<=eN}function Mm(e,t){const i=uo(t,e[0]),s=uo(t,e[1]);return[i,s]}function QW(e,t,i,s,n){let[o,a]=Wi(t.map(Number));const r=Math.floor(i.unzoomed);if(r<=1){const[m,v]=JW(o,a),b=5*Math.pow(2,-Math.ceil(Math.log2(n[1]-n[0]))),{ticks:S}=eg(m,v,b,void 0,void 0,n),D=[e.toDomain(m),e.toDomain(v)];return s&&D.reverse(),{domain:D,ticks:S}}if(o===a){const m=Math.floor(Math.log10(o)),v=Math.pow(10,m),b=Math.min(v,1),S=r-1;o-=b*Math.floor(S/2),a=o+b*S}let l=o,c=a;l=e$(l,c,r);const h=i$(l,c,r),d=r-1;c=l+d*h;const u=Math.floor(l/h)*h,p=Math.floor(c/h)*h;u<=o&&p>=a&&(l=u,c=p);const g=[e.toDomain(l),e.toDomain(c)];s&&g.reverse();const f=h*((i.unzoomed-1)/(i.zoomed-1)),x=t$(l,f,Math.floor(i.zoomed));return{domain:g,ticks:x}}function JW(e,t){let i=e,s=t,n=0;do{[i,s]=qw(i,s);const{ticks:o}=eg(i,s,5);if(o.length%2===1)return[i,s];i-=1,s+=1}while(n++<10);return[e,t]}function e$(e,t,i){e=Math.floor(e);const s=Math.abs(t-e)/(i-1),n=Math.floor(Math.log10(s)),o=Math.pow(10,n);return Math.floor(e/o)*o}function t$(e,t,i){const s=dp(t),n=Math.pow(10,s),o=[];for(let a=0;a0&&s<=1?i:s>1&&s<=2?2*i:s>2&&s<=5?5*i:s>5&&s<=10?10*i:e}function IM(){const e=new Map;return t=>{const i=e.get(t);return i?(e.set(t,i+1),`${t}_${i}`):(e.set(t,1),t)}}var n$=18,o$=[1,2,3,4,6,8,9,10,12];function AM(e,t=0){const i=[];for(const s of e){const{x:n,y:o,width:a,height:r}=s;if(i.some(l=>aL(l,n,o,a+t,r+t)))return!0;i.push(s)}return!1}function a$(e,t,i,s){if(e==null)return t;if(typeof e!="number"){const r=t[0],l=typeof e=="string"?{unit:e,epoch:r}:{...e,epoch:r};return po(l,t[0],t[1],{visibleRange:i,extend:s})}const n=[],o=t[0].valueOf(),a=t[1].valueOf();for(let r=o;r<=a;r+=e)n.push(new Date(r));return n}function CM(e,t){if(e.length!==t.length)return!1;for(let i=0;i{const b=br.is(c)?c.bandwidth??1/0:1/0,S=(c.bandwidth??0)/2,D=r$(h.enabled,n,t,i,r,l,d),L={font:h,maxWidth:p?g:b,maxHeight:p?b:g,overflow:h.truncate?"ellipsis":"hide",textWrap:h.wrapping};for(let I=0;I(d?c:h)?.(u,p)??String(u)}function nN(e,t,i,s,n,o,a,r){if(!Bd.is(e)&&!Zo.is(e))return;const l=Qp(o);if(l==null)return;a&&(t=[1-t[1],1-t[0]]);const c=Math.min(e.domain[0].valueOf(),e.domain.at(-1).valueOf()),h=Math.max(e.domain[0].valueOf(),e.domain.at(-1).valueOf());let[d,u]=gM(new Date(c),new Date(h),t);d=uo(l,d),d.valueOf()>=c&&(d=Gw(l,d)),u=Vw(l,u),u.valueOf()<=h&&(u=pM(l,u));const p=po(l,d,u),g=yn(o),f=_d.is(e),x={...n,interval:o},m=[];let v,b,S,D=0;if(_d.is(e)){const L=Mr(o);b=r!=null&&yn(r)>=yn(L)?2:3,S=1;const I=i/s,A=e.bandCount(t)/(I*n$);D=o$.findLast(T=>A>=T)??1}else ml.is(e)&&(e.interval==null||yn(e.interval)>=g)?b=1:(b=0,S=2);for(let L=0;LB.valueOf(){switch(b){case 0:case 3:return B.valueOf()+g>A.valueOf();case 1:case 2:return B.valueOf()>=A.valueOf()}}),P.length===0)continue;const F=P[0],_=bM(F,I);(b===0?_===0:_<=g)&&(!f||!T)&&(v??(v=new Set),v.add(m.length)),m.push(...P)}return v?.size===1&&v.has(0)&&(v=void 0),{ticks:m,primaryTicksIndices:v,alignment:S}}function oN(e,t,i,s,n){const o=lN(e.format,s);if(o==null)return{width:0,height:0};const a=pp(o),r=s?Qp(s):void 0,l=lN(t?.format,r),c=l?pp(l):a,h=new Date(i[0]),d=new Date(i.at(-1)),u=r?po(r,new Date(i[0]),new Date(i.at(-1)),{extend:!0}):void 0;let p=0,g=0;if(a!=null){const f=Od(e),x=f.left+f.right,m=f.top+f.bottom;let v,b;u!=null&&u.length>1?(v=u[0],b=u[1]):(v=h,b=d);const S=po(s,v,b,{limit:50});for(const D of S){const L=a(D),{width:I,height:A}=n.measureLines(L);p=Math.max(p,I+x),g=Math.max(g,A+m)}}if(c!=null&&u!=null){const f=Od(t),x=f.left+f.right,m=f.top+f.bottom;for(const v of u){const b=c(v),{width:S,height:D}=n.measureLines(b);p=Math.max(p,S+x),g=Math.max(g,D+m)}}return{width:Math.ceil(p),height:Math.ceil(g)}}function aN(e,t,i,s){return e&&!t?i*s===-1?"top":"bottom":"middle"}function rN(e,t,i,s,n){const o=t>0&&t<=Math.PI,a=i>0&&i<=Math.PI,r=o||a?-1:1;if(e)if(t||i){if(s*r===-1)return"end"}else return"center";else if(s*n===-1)return"end";return"start"}function lN(e,t){if(e!=null){if(typeof e=="string")return e;if(ft(e)&&t!=null)return e[Mr(t)]}}function cN(e,t,i=0){const s=dr(e),n=!s&&i>=0&&i<=Math.PI?-1:1,o=!s&&i-Math.PI/2>=0&&i-Math.PI/2<=Math.PI?-1:1;let a=0;return t?a=n*(Math.PI/2):o===-1&&(a=Math.PI),{configuredRotation:s,defaultRotation:a,parallelFlipFlag:n,regularFlipFlag:o}}var l$=new Date(1970,0,4);function hN(e){const{label:t,domain:i,axisRotation:s,labelOffset:n,sideFlag:o}=e,{defaultRotation:a,configuredRotation:r,parallelFlipFlag:l,regularFlipFlag:c}=cN(t.rotation,t.parallel,s),h=r+a,d=(A,T=0)=>{const w=t.minSpacing??(r===0&&T===0?10:0),N=h+T,O=Od(t);return AM(d$(e,A,N),w)||AM(u$(A.ticks,n,N,O),w)},{maxTickCount:u}=dN(e),p=c$(e),g=t.enabled&&t.avoidCollisions,f=Number.isFinite(u)?u:10,x=g&&t.autoRotate&&t.rotation==null;let m=0,v=0,b=!0,S={tickDomain:[],niceDomain:i,ticks:[],rawTicks:[],rawTickCount:void 0,timeInterval:void 0,fractionDigits:0};for(;b&&m<=f;)({tickData:S,index:m}=h$(e,p,S,m)),v=x&&d(S,0)?dr(t.autoRotateAngle):0,b=g&&d(S,v);const D=rN(t.parallel,r,v,o,c),L=aN(t.parallel,r,o,l),I=r+v;return{tickData:S,textAlign:D,textBaseline:L,rotation:I}}function c$(e){return e.interval?.values?2:e.primaryTickCount!=null?1:0}function dN({scale:e,domain:t,range:i,visibleRange:s,label:n,defaultTickMinSpacing:o,interval:{minSpacing:a,maxSpacing:r}}){const{defaultTickCount:l}=e,c=Pc(i),h=Pc(s);if(zd.is(e)){const d=t.length,u=Math.ceil(c/(h*n.fontSize));return{tickCount:Math.min(u,d),minTickCount:0,maxTickCount:d}}return Qw(c,h,a,r,l,o)}function h$(e,t,i,s){const{step:n,values:o}=e.interval,{maxTickCount:a,minTickCount:r,tickCount:l}=dN(e),c=T=>Math.max(l-T,r),h=n==null&&o==null&&c(s)>r,d=i.rawTicks,u=l-r,p={minTickCount:r,maxTickCount:a,tickCount:c(s)};let g=uN(e,t,p);if(h&&CM(g.rawTicks,d)){let T=s,w=u;for(;T<=w;){s=Math.trunc((T+w)/2),p.tickCount=c(s);const N=uN(e,t,p);CM(N.rawTicks,d)?T=s+1:(g=N,w=s-1)}}const{tickDomain:f,niceDomain:x,rawTicks:m,rawTickCount:v,rawFirstTickIndex:b,generatePrimaryTicks:S,primaryTicksIndices:D,alignment:L,fractionDigits:I,timeInterval:A}=g;return{tickData:{tickDomain:f,niceDomain:x,rawTicks:m,rawTickCount:v,fractionDigits:I,timeInterval:A,ticks:sN(e,{niceDomain:x,rawTicks:m,rawFirstTickIndex:b,generatePrimaryTicks:S,primaryTicksIndices:D,alignment:L,fractionDigits:I,timeInterval:A})},index:s+1}}function uN(e,t,i){const{domain:s,reverse:n,visibleRange:o,scale:a,interval:r,primaryLabel:l,niceMode:c,primaryTickCount:h,minimumTimeGranularity:d}=e,u={nice:c===0,interval:r.step,...i},p={...u};p.nice||(p.nice=c===1);let g;t===1&&h!=null&&ut.is(a)&&(g=QW(a,s,h,n,o));const f=c===0?g?.domain??a.niceDomain(u,s):s;let x=f,m,v,b,S,D,L;const I=l?.enabled===!0&&p.interval==null;LM(a,f,()=>{switch(t){case 2:if(x=r.values,m=r.values,v=m.length,_d.is(a)?L=1:ml.is(a)&&(L=2),ut.is(a)){const[T,w]=Wi(f.map(Number));m=m.filter(N=>Number(N)>=T&&Number(N)<=w).sort((N,O)=>Number(N)-Number(O))}break;case 1:if(g)m=g.ticks,v=g.ticks.length;else{const T=a.ticks(p,f,o);m=T?.ticks,v=T?.count}break;default:{const{tickCount:T,minTickCount:w,maxTickCount:N}=i;if(f.length>0&&p.interval==null&&(ml.is(a)||I&&(Bd.is(a)||_d.is(a)))){const F=f,_=Math.min(F[0].valueOf(),F.at(-1).valueOf()),z=Math.max(F[0].valueOf(),F.at(-1).valueOf());S=bm(_,z,T,w,N,{weekStart:l==null?l$:void 0,primaryOnly:!0})}let O;_d.is(a)?O=d:ml.is(a)&&(O=a.interval),O!=null&&S!=null&&yn(O)>=yn(S)&&(S=O);const P=S?nN(a,o,T,N,p,S,n,d):void 0;if(P)({ticks:m,primaryTicksIndices:D,alignment:L}=P);else{const F=ml.is(a)&&p.interval==null&&S!=null?{...p,interval:S}:p,_=a.ticks(F,f,o);if(m=_?.ticks,v=_?.count,b=_?.firstTickIndex,Bd.is(a)||Zo.is(a)){const z=typeof p.interval=="number"?Jp(p.interval):p.interval;S??(S=z??_?.timeInterval)}}}}}),m??(m=[]);let A=0;for(const T of m){if(typeof T!="number")continue;const w=dp(T);w>A&&(A=w)}return I||(D=void 0),{tickDomain:x,niceDomain:f,rawTicks:m,rawTickCount:v,rawFirstTickIndex:b,generatePrimaryTicks:I,primaryTicksIndices:D,alignment:L,fractionDigits:A,timeInterval:S}}function d$(e,t,i){const{niceDomain:s,ticks:n,timeInterval:o}=t;if(o==null)return[];const a=iN(n),{label:r,labelOffset:l,primaryLabel:c,domain:h}=e,{width:d,height:u}=oN(r,c,s??h,o,Je(r)),p=[];for(const g of[0,a]){const{x:f,y:x}=nL(l,g,i);p.push({x:f,y:x,width:d,height:u})}return p}function u$(e,t,i,s){const n=[],o=s.left+s.right,a=s.top+s.bottom;for(const{tickLabel:r,textMetrics:l,translation:c}of e){if(!r)continue;const{x:h,y:d}=nL(t,c,i),u=l.width+o,p=l.height+a;n.push({x:h,y:d,width:u,height:p})}return n}var ig=class wV extends hM{constructor(t,i){super(t,i),this.maxThicknessRatio=.3,this.crossAxisTranslation={x:0,y:0},this.minimumTimeGranularity=void 0,this.headingLabelGroup=this.axisGroup.appendChild(new us({name:`${this.id}-Axis-heading`})),this.lineNodeGroup=this.axisGroup.appendChild(new us({name:`${this.id}-Axis-line`})),this.lineNode=this.lineNodeGroup.appendChild(new Rn({zIndex:1})),this.tickLineGroupSelection=Bs.select(this.tickLineGroup,Rn,!1),this.gridLineGroupSelection=Bs.select(this.gridLineGroup,Rn,!1),this.gridFillGroupSelection=Bs.select(this.gridFillGroup,Li,!1),this.tempText=new vd({debugDirty:!1}),this.tempCaption=new wt,this.animationManager=t.animationManager,this.animationState=new $p("empty",{empty:{update:{target:"ready",action:()=>this.resetSelectionNodes()},reset:"empty"},ready:{update:n=>this.animateReadyUpdate(n),resize:()=>this.resetSelectionNodes(),reset:"empty"}}),this.headingLabelGroup.appendChild(this.title.caption.node);let s;this.cleanup.register(t.eventsHub.on("layout:complete",n=>{const o=[n.chart.width,n.chart.height];s!=null&&!no(o,s)&&this.animationState.transition("resize"),s=o}),this.title.caption.registerInteraction(this.moduleCtx,"afterend"))}static is(t){return t instanceof wV}get horizontal(){return this.position==="top"||this.position==="bottom"}onGridVisibilityChange(){this.gridLineGroupSelection.clear(),this.gridFillGroupSelection.clear()}resetAnimation(t){t==="initial"&&this.animationState.transition("reset")}get direction(){return this.position==="top"||this.position==="bottom"?"x":"y"}createAxisContext(){return{...super.createAxisContext(),position:this.position}}createLabel(){return new dM}updateDirection(){switch(this.position){case"top":this.label.mirrored=!0,this.label.parallel=!0;break;case"right":this.label.mirrored=!0,this.label.parallel=!1;break;case"bottom":this.label.mirrored=!1,this.label.parallel=!0;break;case"left":this.label.mirrored=!1,this.label.parallel=!1;break}this.axisContext&&(this.axisContext.position=this.position,this.axisContext.direction=this.direction)}calculateLayout(t,i){return this.updateDirection(),super.calculateLayout(t,i)}layoutCrossLines(){const t=this.hasDefinedDomain()||this.hasVisibleSeries();for(const i of this.crossLines)i.calculateLayout?.(t)}calculateTickLayout(t,i,s,n){const o=this.label.getSideFlag(),a=o*(this.getTickSize()+this.label.spacing+this.seriesAreaPadding);if(i===2&&this.label.enabled===!1&&this.tick.enabled===!1&&this.gridLine.enabled===!1){const{bbox:W,spacing:Y}=this.tickBBox(t,[],[]);return{ticks:[],rawTickCount:0,tickDomain:t,niceDomain:t,fractionDigits:0,timeInterval:void 0,bbox:W,layout:{ticks:[],tickLines:[],gridLines:[],gridFills:[],labels:[],spacing:Y}}}const{label:r,primaryLabel:l,scale:c,range:h,interval:d,reverse:u,defaultTickMinSpacing:p,minimumTimeGranularity:g}=this,f=hN({label:r,scale:c,interval:d,primaryLabel:l,domain:t,range:h,reverse:u,niceMode:i,visibleRange:s,defaultTickMinSpacing:p,minimumTimeGranularity:g,sideFlag:o,labelOffset:a,primaryTickCount:n,axisRotation:this.horizontal?-.5*Math.PI:0,isVertical:this.direction==="y",sizeLimit:this.chartLayout?.sizeLimit,inRange:W=>this.inRange(W,.001),tickFormatter:(...W)=>this.tickFormatter(...W)}),{tickData:x}=f;if(this.label.avoidCollisions&&this.horizontal&&x.ticks.length>2&&(ut.is(this.scale)||Zo.is(this.scale))){const W=this.chartLayout?.padding.right??0,Y=x.ticks.at(-1);Y?.tickLabel!=null&&Y.translation+Y.textMetrics.width/2>h[1]+W&&(Y.tickLabel=void 0,s[0]===0&&s[1]===1&&(x.ticks[0].tickLabel=void 0))}const{ticks:v,tickDomain:b,rawTicks:S,rawTickCount:D,fractionDigits:L,timeInterval:I,niceDomain:A}=x,T=v.map(W=>this.getTickLabelProps(W,f)),{position:w,gridPadding:N,gridLength:O}=this,P=w==="bottom"||w==="right"?-1:1,F=P*N,_=P*(O+N),z=this.calculateGridLines(v,F,_),B=this.calculateGridFills(v,F,_),R=this.calculateTickLines(v,P),{bbox:V,spacing:j}=this.tickBBox(b,v,T);return{ticks:S,rawTickCount:D,tickDomain:b,niceDomain:A,fractionDigits:L,timeInterval:I,bbox:V,layout:{ticks:v,gridLines:z,gridFills:B,tickLines:R,labels:T,spacing:j}}}calculateGridLines(t,i,s){return t.map((n,o)=>this.calculateGridLine(n,o,i,s,t))}calculateGridLine({index:t,tickId:i,translation:s},n,o,a,r){const{gridLine:l,horizontal:c}=this,[h,d,u,p]=c?[s,o,s,a]:[o,s,a,s],{style:g}=l,{stroke:f,strokeWidth:x=0,lineDash:m}=g[t%g.length]??{};return{tickId:i,offset:s,x1:h,y1:d,x2:u,y2:p,stroke:f,strokeWidth:x,lineDash:m}}calculateGridFills(t,i,s){const{horizontal:n,range:o,type:a}=this,r=[];if(t.length==0)return r;let l=0;const c=!n&&a==="unit-time";if(c&&t[0].translationo[0]){const d={tickId:`before:${t[0].tickId}`,translation:o[0]};r.push(this.calculateGridFill(d,-1,t[0].index,i,s,t)),l=1}return r.push(...t.map((d,u)=>this.calculateGridFill(d,u,d.index+l,i,s,t))),r}calculateGridFill({tickId:t,translation:i},s,n,o,a,r){const{gridLine:l,horizontal:c,range:h}=this,d=r[s+1],u=i,p=d?d.translation:h[1],[g,f,x,m]=c?[u,Math.max(o,a),p,Math.min(o,a)]:[Math.min(o,a),Math.min(u,p),Math.max(o,a),Math.max(u,p)],{fill:v,fillOpacity:b}=l.style[n%l.style.length]??{};return{tickId:t,x1:g,y1:f,x2:x,y2:m,fill:v,fillOpacity:b}}calculateTickLines(t,i){return t.map(s=>this.calculateTickLine(s,s.index,i,t))}calculateTickLine({isPrimary:t,tickId:i,translation:s},n,o,a){const{horizontal:r,tick:l,primaryTick:c}=this,h=t&&c?c:l,d=-o*this.getTickSize(h),[u,p,g,f]=r?[s,0,s,d]:[0,s,d,s],{stroke:x,width:m}=h;return{tickId:i,offset:s,x1:u,y1:p,x2:g,y2:f,stroke:x,strokeWidth:m,lineDash:void 0}}update(){this.updateDirection();const t=Array.from(this.tickLabelGroupSelection.nodes(),a=>a.datum.tickId);super.update();const{tickLayout:i}=this;if(this.updateTitle(this.scale.domain,i?.spacing??0),this.animatable||this.moduleCtx.animationManager.skipCurrentBatch(),i){const{ticks:a}=i;if(this.animationManager.isSkipped())this.resetSelectionNodes();else{const r=a.map(c=>c.tickId),l=sj(t,r);this.animationState.transition("update",l)}}const{enabled:s,stroke:n,width:o}=this.line;this.lineNode.setProperties({stroke:n,strokeWidth:s?o:0}),this.updateTickLines(),this.updateGridLines(),this.updateGridFills()}getAxisTransform(){return{translationX:Math.floor(this.translation.x+this.crossAxisTranslation.x),translationY:Math.floor(this.translation.y+this.crossAxisTranslation.y)}}updatePosition(){super.updatePosition();const t=this.getAxisTransform();this.tickLineGroup.datum=t,this.tickLabelGroup.datum=t,this.lineNodeGroup.datum=t,this.headingLabelGroup.datum=t}setAxisVisible(t){this.tickLineGroup.visible=t&&(this.tick.enabled||(this.primaryTick?.enabled??!1)),this.tickLabelGroup.visible=t&&(this.label.enabled||(this.primaryTick?.enabled??!1)),this.lineNodeGroup.visible=t,this.headingLabelGroup.visible=t}getAxisLineCoordinates(){const{horizontal:t}=this,[i,s]=Wi(this.range);return t?{x1:i,x2:s,y1:0,y2:0}:{x1:0,x2:0,y1:i,y2:s}}getTickLineBBox(t){const{translation:i}=t,{position:s,primaryTick:n}=this;let o=this.getTickSize();switch(n?.enabled&&(o=Math.max(o,this.getTickSize(n))),s){case"top":return new de(i,-o,i,o);case"bottom":return new de(i,0,i,o);case"left":return new de(-o,i,o,i);case"right":return new de(0,i,o,i)}}lineNodeBBox(){const{position:t,seriesAreaPadding:i}=this,{y1:s,y2:n}=this.getAxisLineCoordinates(),o=n-s;switch(t){case"top":return new de(s,-i,o,i);case"bottom":return new de(s,0,o,i);case"left":return new de(-i,s,i,o);case"right":return new de(0,s,i,o)}}titleBBox(t,i){const{tempCaption:s}=this;return s.node.setProperties(this.titleProps(s,t,i)),s.node.getBBox()}tickBBox(t,i,s){const{tick:n,primaryTick:o,label:a,primaryLabel:r,title:l,position:c,horizontal:h,seriesAreaPadding:d}=this,u=[];if(u.push(this.lineNodeBBox()),n.enabled||o?.enabled)for(const x of i)u.push(this.getTickLineBBox(x));const{tempText:p}=this;if(a.enabled)for(const x of s){if(!x.visible)continue;p.setProperties(x);const m=p.getBBox();m&&u.push(m)}if(r?.enabled&&c==="bottom"&&(u.push(new de(0,$o(a.fontSize)+2,1,this.getTickSize(n)+a.spacing+d)),r.format!=null)){const{format:m}=r,b=(ft(m)?Object.values(m):[m]).reduce((S,D)=>Math.max(S,NG(D)),0);u.push(new de(0,this.getTickSize(o??n)+r.spacing+d,1,b*$o(r.fontSize)+2))}let g=0;if(l.enabled){const x=de.merge(u);g=h?x.height:x.width,u.push(this.titleBBox(t,g))}return{bbox:de.merge(u),spacing:g}}titleProps(t,i,s){const{title:n}=this;if(!n.enabled)return t.enabled=!1,{visible:!1,text:"",textBaseline:"bottom",x:0,y:0,rotationCenterX:0,rotationCenterY:0,rotation:0};t.enabled=!0,t.color=n.color,t.fontFamily=n.fontFamily,t.fontSize=n.fontSize,t.fontStyle=n.fontStyle,t.fontWeight=n.fontWeight,t.wrapping=n.wrapping;const o=(n.spacing??0)+s,{range:a}=this,r=(a[0]+a[1])/2;let l,c,h,d;switch(this.position){case"top":l=r,c=-o,h=0,d="bottom";break;case"bottom":l=r,c=o,h=0,d="top";break;case"left":l=-o,c=r,h=-.5*Math.PI,d="bottom";break;case"right":l=o,c=r,h=.5*Math.PI,d="bottom";break}const{formatter:u=g=>g.defaultValue}=n,p=this.cachedCallWithContext(u,this.getTitleFormatterParams(i));return t.text=p,{visible:!0,text:p,textBaseline:d,x:l,y:c,rotationCenterX:l,rotationCenterY:c,rotation:h}}getTickLabelProps(t,i){const{horizontal:s,primaryLabel:n,primaryTick:o,seriesAreaPadding:a,scale:r}=this,{tickId:l,tickLabel:c="",translation:h,isPrimary:d,textUntruncated:u}=t,p=d&&n?.enabled?n:this.label,g=d&&o?.enabled?o:this.tick,{rotation:f,textBaseline:x,textAlign:m}=i,{range:v}=r,b=this.label.getSideFlag(),S=Od(p)[this.position],D=b*(this.getTickSize(g)+p.spacing+a)-S,L=c!=="",I=s?h:D,A=s?-D:h;return{...this.getLabelStyles({value:t.tick,formattedValue:c},void 0,p),tickId:l,rotation:f,text:c,textAlign:m,textBaseline:x,textUntruncated:u,visible:L,x:I,y:A,rotationCenterX:I,rotationCenterY:A,range:v}}updateSelections(){if(!this.tickLayout)return;const t=this.getAxisLineCoordinates(),{tickLines:i,gridLines:s,gridFills:n,labels:o}=this.tickLayout,a=r=>r.tickId;this.lineNode.datum=t,this.gridLineGroupSelection.update(this.gridLine.enabled?s:[],void 0,a),this.gridFillGroupSelection.update(this.gridLine.enabled?n:[],void 0,a),this.tickLineGroupSelection.update(i,void 0,a),this.tickLabelGroupSelection.update(o,void 0,a)}updateGridLines(){this.gridLineGroupSelection.each((t,i)=>{t.stroke=i.stroke,t.strokeWidth=i.strokeWidth,t.lineDash=i.lineDash})}updateGridFills(){this.gridFillGroupSelection.each((t,i)=>{t.fill=i.fill,t.fillOpacity=i.fillOpacity??1})}updateTickLines(){this.tickLineGroupSelection.each((t,i)=>{t.stroke=i.stroke,t.strokeWidth=i.strokeWidth,t.lineDash=i.lineDash})}updateTitle(t,i){const{caption:s}=this.title,n=this.titleProps(s,t,i);s.node.visible=n.visible,s.node.text=n.text,s.node.textBaseline=n.textBaseline,s.node.datum=n}updateLabels(){this.label.enabled&&this.tickLabelGroupSelection.each((t,i)=>{t.fill=i.color,t.text=i.text,t.textBaseline=i.textBaseline,t.textAlign=i.textAlign??"center",t.pointerEvents=i.textUntruncated==null?1:0,t.setFont(i),t.setBoxing(i)})}animateReadyUpdate(t){const{animationManager:i}=this.moduleCtx,s=Ew(this),n=Pw(s);hi(this.id,"axis-group",i,[this.lineNodeGroup,this.tickLabelGroup,this.tickLineGroup,this.headingLabelGroup],n.group),hi(this.id,"line",i,[this.lineNode],n.line),hi(this.id,"line-paths",i,[this.gridLineGroupSelection,this.tickLineGroupSelection],n.tick,(o,a)=>a.tickId,t),hi(this.id,"tick-labels",i,[this.tickLabelGroupSelection],n.label,(o,a)=>a.tickId,t),hi(this.id,"title",i,[this.title.caption.node],n.label,(o,a)=>a.tickId,t)}resetSelectionNodes(){fs([this.lineNodeGroup,this.tickLabelGroup,this.tickLineGroup,this.headingLabelGroup],Rw()),fs([this.gridLineGroupSelection,this.tickLineGroupSelection],cM()),fs([this.gridFillGroupSelection],zw()),fs([this.tickLabelGroupSelection],gm()),fs([this.title.caption.node],gm()),fs([this.lineNode],cM())}};M([C],ig.prototype,"thickness",2),M([C],ig.prototype,"maxThicknessRatio",2),M([C],ig.prototype,"position",2),M([C],ig.prototype,"crossAt",2);var sg=ig,pN=["top","right","bottom","left"];function p$(e){return typeof e=="string"&&pN.includes(e)}function g$(e){const t=[],i=[],s=[...pN];for(const n of e)n instanceof sg&&(p$(n.position)?i.push(n.position):t.push(n));for(const n of t){let o;do o=s.pop();while(o&&i.includes(o));if(o==null)break;n.position=o}}var f$=["direction","xKey","yKey","sizeKey","angleKey","radiusKey","normalizedTo"];function y$(e,t,i){const s=(c,h,d)=>{const u=[c];for(const p of f$)p in h&&h[p]!=null&&u.push(`${p}=${h[p]}`);return d?.seriesGrouping&&u.push(`seriesGrouping.groupId=${d?.seriesGrouping.groupId}`),u.join(";")},n=new Map;let o=0;for(const c of e){const h=s(c.type,c.properties,i?.[o]);n.has(h)||n.set(h,[]),n.get(h)?.push([c,o++])}const a=new Map;o=0;for(const c of t){const h=s(c.type,c,c);a.has(h)||a.set(h,[]),a.get(h)?.push([c,o++])}if(![...n.keys()].some(c=>a.has(c)))return{status:"no-overlap",oldKeys:n.keys(),newKeys:a.keys()};const l=[];for(const[c,h]of a.entries())for(const[d,u]of h){const p=n.get(c);if(p==null||p.length<1){l.push({opts:d,targetIdx:u,idx:u,status:"add"}),n.delete(c);continue}const[g,f]=p.shift(),x=i?.[f]??{},m=wa(x,d??{}),{groupIndex:v,stackIndex:b}=m?.seriesGrouping??{};v!=null||b!=null?l.push({opts:d,series:g,diff:m,targetIdx:u,idx:f,status:"series-grouping"}):m?l.push({opts:d,series:g,diff:m,targetIdx:u,idx:f,status:"update"}):l.push({opts:d,series:g,targetIdx:u,idx:f,status:"no-op"}),p.length===0&&n.delete(c)}for(const c of n.values())for(const[h,d]of c)l.push({series:h,idx:d,targetIdx:-1,status:"remove"});return{status:"overlap",changes:l}}function Dm(e){const{series:t}=e;return t?.[0]?.type??"line"}function gN(e){const t=Dm(e);return $i.isCartesian(t)||SW(t)}function m$(e){const t=Dm(e);return $i.isPolar(t)||MW(t)}function fN(e){const t=Dm(e);return $i.isTopology(t)||DW(t)}function yN(e){const t=Dm(e);return $i.isStandalone(t)||kW(t)}var x$=class extends aM{applyOptions(e){for(const t of this.moduleMap.values())t.module.optionsKey in e&&Tc(t.moduleInstance)&&t.moduleInstance.set(e[t.module.optionsKey])}*legends(){for(const{module:e,moduleInstance:t}of this.moduleMap.values())e.type==="legend"&&(yield{legendType:e.identifier,legend:t})}},TM="ag-charts-overlay",mN="ag-charts-dark-overlay",jc=class extends Le{constructor(e,t){super(),this.className=e,this.defaultMessageId=t,this.enabled=!0}getText(e){return Ne(this.text)?this.text.map(t=>t.text).join(""):e.t(this.text??this.defaultMessageId)}getElement(e,t,i,s){if(this.content?.remove(),this.focusBox=s,this.renderer){const n={},o=Uo(e,this.renderer,n);if(o instanceof HTMLElement)this.content=o;else{const a=De("div");a.innerHTML=o;const{firstElementChild:r}=a;r instanceof HTMLElement&&a.childElementCount===1?this.content=r:this.content=a}}else{const n=De("div",{display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",height:"100%",margin:"8px",fontFamily:"var(--ag-charts-font-family)",fontSize:"var(--ag-charts-font-size)",fontWeight:"var(--ag-charts-font-weight)"});if(Ne(this.text)){const o=De("div");for(const a of this.text){const r=De("span",{color:a.color,fontSize:`${a.fontSize}px`,fontFamily:a.fontFamily??"inherit",fontWeight:String(a.fontWeight),fontStyle:a.fontStyle});r.innerText=a.text,o.appendChild(r)}n.appendChild(o)}else n.innerText=this.getText(i);this.content=n,t?.animate({from:0,to:1,id:"overlay",phase:"add",groupId:"opacity",onUpdate(o){n.style.opacity=String(o)},onStop(){n.style.opacity="1"}})}return this.content}removeElement(e=()=>this.content?.remove(),t){if(this.content){if(t){const{content:i}=this;t.animate({from:1,to:0,phase:"remove",id:"overlay",groupId:"opacity",onUpdate(s){i.style.opacity=String(s)},onStop(){e?.()}})}else e?.();this.content=void 0,this.focusBox=void 0}}};M([C],jc.prototype,"enabled",2),M([C],jc.prototype,"text",2),M([C],jc.prototype,"renderer",2);var Vd=class extends Le{constructor(){super(...arguments),this.darkTheme=!1,this.loading=new jc("ag-charts-loading-overlay","overlayLoadingData"),this.noData=new jc("ag-charts-no-data-overlay","overlayNoData"),this.noVisibleSeries=new jc("ag-charts-no-visible-series","overlayNoVisibleSeries"),this.unsupportedBrowser=new jc("ag-charts-unsupported-browser","overlayUnsupportedBrowser")}getFocusInfo(e){for(const t of[this.loading,this.noData,this.noVisibleSeries,this.unsupportedBrowser])if(t.focusBox!==void 0)return{text:t.getText(e),rect:t.focusBox}}destroy(){this.loading.removeElement(),this.noData.removeElement(),this.noVisibleSeries.removeElement(),this.unsupportedBrowser.removeElement()}};M([C],Vd.prototype,"darkTheme",2),M([C],Vd.prototype,"loading",2),M([C],Vd.prototype,"noData",2),M([C],Vd.prototype,"noVisibleSeries",2),M([C],Vd.prototype,"unsupportedBrowser",2);function b$(e,t){const{animationDuration:i}=Fp.add,s=i*t,n=De("div",`${TM}--loading`,{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",height:"100%",boxSizing:"border-box",font:"13px Verdana, sans-serif",userSelect:"none",animation:`ag-charts-loading ${s}ms linear 50ms both`}),o=De("span",{width:"45px",height:"40px",backgroundImage:["linear-gradient(#0000 calc(1 * 100% / 6), #ccc 0 calc(3 * 100% / 6), #0000 0), ","linear-gradient(#0000 calc(2 * 100% / 6), #ccc 0 calc(4 * 100% / 6), #0000 0), ","linear-gradient(#0000 calc(3 * 100% / 6), #ccc 0 calc(5 * 100% / 6), #0000 0)"].join(""),backgroundSize:"10px 400%",backgroundRepeat:"no-repeat",animation:"ag-charts-loading-matrix 1s infinite linear"}),a=De("p",{marginTop:"1em"});a.innerText=e;const r=De("div",`${TM}__loading-background`,{position:"absolute",inset:"0",opacity:"0.5",zIndex:"-1"}),l=De("style");return l.innerText=["@keyframes ag-charts-loading { from { opacity: 0 } to { opacity: 1 } }","@keyframes ag-charts-loading-matrix {","0% { background-position: 0% 0%, 50% 0%, 100% 0%; }","100% { background-position: 0% 100%, 50% 100%, 100% 100%; }","}"].join(" "),n.replaceChildren(l,o,a,r),n}var xN=(e=>(e[e.BACKGROUND=0]="BACKGROUND",e[e.ANY_CONTENT=1]="ANY_CONTENT",e))(xN||{}),bN=(e=>(e[e.FOREGROUND=0]="FOREGROUND",e[e.HIGHLIGHT=1]="HIGHLIGHT",e[e.LABEL=2]="LABEL",e))(bN||{});function vN(e,t,i,s){if(ao(e))return{type:"gradient",gradient:e.gradient??t.gradient,colorStops:e.colorStops??t.colorStops,bounds:e.bounds??t.bounds,rotation:e.rotation??t.rotation,reverse:e.reverse??t.reverse,colorSpace:e.colorSpace??t.colorSpace};if(ur(e)){const n=e.pattern??i.pattern;let o=e.strokeWidth;n==="backward-slanted-lines"||n==="forward-slanted-lines"||n==="horizontal-lines"||n==="vertical-lines"?o??(o=i.strokeWidth):o??(o=0);const a=e.width??e.height??i.width,r=e.height??e.width??i.height;return{type:"pattern",pattern:n,width:a,height:r,path:e.path,padding:e.padding??i.padding,fill:e.fill??i.fill,fillOpacity:e.fillOpacity??i.fillOpacity,backgroundFill:e.backgroundFill??i.backgroundFill,backgroundFillOpacity:e.backgroundFillOpacity??i.backgroundFillOpacity,stroke:e.stroke??i.stroke,strokeOpacity:e.strokeOpacity??i.strokeOpacity,strokeWidth:o,rotation:e.rotation??i.rotation,scale:e.scale??i.scale}}return wc(e)?{type:"image",url:e.url,width:e.width,height:e.height,backgroundFill:e.backgroundFill??s.backgroundFill,backgroundFillOpacity:e.backgroundFillOpacity??s.backgroundFillOpacity,rotation:e.rotation??s.rotation,repeat:e.repeat??s.repeat,fit:e.fit??s.fit}:e}function wM(e,t,i,s){return!ao(e?.fill)&&!ur(e?.fill)&&!wc(e?.fill)?e:{...e,fill:vN(e.fill,t,i,s)}}function SN(e,t,i,s){i==null||!ao(t)||t.bounds==null||t.bounds==="item"?e.fillBBox=void 0:e.fillBBox=i[t.bounds],e.fillParams=s}function Dr(e,t,i,s){const n=t?.opacity??1;e.fill=t?.fill,SN(e,e.fill,i,s),e.fillOpacity=(t?.fillOpacity??1)*n,e.stroke=t?.stroke,e.strokeOpacity=(t?.strokeOpacity??1)*n,e.strokeWidth=t?.strokeWidth??0,e.lineDash=t?.lineDash,e.lineDashOffset=t?.lineDashOffset??0}var MN=(e=>(e[e.EXACT_SHAPE_MATCH=0]="EXACT_SHAPE_MATCH",e[e.NEAREST_NODE=1]="NEAREST_NODE",e[e.AXIS_ALIGNED=2]="AXIS_ALIGNED",e))(MN||{}),v$=.25,S$=.125,km=class{constructor(e,t,i,s){this.type=e,this.event=t,this.defaultPrevented=!1,this.datum=i.datum,this.seriesId=s.id}preventDefault(){this.defaultPrevented=!0}},Im=class{constructor(e,t){this.series=e,this.seriesGrouping=t,this.type="groupingChanged"}};function DN(e){switch(e){case"x":return"x";case"y":return"y";case"angle":return"angle";case"radius":return"radius"}}function NM(e){switch(e){case"x":return"x";case"y":return"y";case"angle":return"angle";case"radius":return"radius"}}var Am=class extends nT{constructor(e){super(),this.cleanup=new St,this.usesPlacedLabels=!1,this.hasChangesOnHighlight=!1,this.seriesGrouping=void 0,this.NodeEvent=km,this.internalId=hs(this),this.contentGroup=new us({name:`${this.internalId}-content`,zIndex:1}),this.highlightGroup=new us({name:`${this.internalId}-highlight`,zIndex:1}),this.annotationGroup=new us({name:`${this.internalId}-annotation`}),this.labelGroup=new us({name:`${this.internalId}-series-labels`}),this.axes={},this.directions=["x","y"],this.nodeDataRefresh=!0,this.processedDataUpdated=!0,this.moduleMap=new aM,this.datumCallbackCache=new Map,this.connectsToYAxis=!1,this.declarationOrder=-1,this._broughtToFront=!1,this.events=new Go,this._pickNodeCache=new AS(5),this.fireEventWrapper=r=>super.fireEvent(r);const{moduleCtx:t,pickModes:i,propertyKeys:s={},propertyNames:n={},canHaveAxes:o=!1,usesPlacedLabels:a=!1}=e;this.ctx=t,this.propertyKeys=s,this.propertyNames=n,this.canHaveAxes=o,this.usesPlacedLabels=a,this.pickModes=i,this.cleanup.register(this.ctx?.eventsHub.on("highlight:change",r=>this.onChangeHighlight(r)))}get pickModeAxis(){return"main"}get id(){return this.properties?.id??this.internalId}get type(){return this.constructor.type??""}get focusable(){return!0}get data(){return this._data??this._chartData}set visible(e){this.properties.visible=e,this.ctx.legendManager.toggleItem(e,this.id),this.ctx.legendManager.update(),this.visibleMaybeChanged()}get visible(){return this.ctx.legendManager.getSeriesEnabled(this.id)??this.properties.visible}get hasData(){const e=this.data;return e==null?!1:e.netSize()>0}get tooltipEnabled(){return this.properties.tooltip?.enabled}onDataChange(){this.nodeDataRefresh=!0,this.processedDataUpdated=!0,this._pickNodeCache.clear()}setOptionsData(e){this._data=e,this.onDataChange()}setChartData(e){this._chartData=e,this.data===e&&this.onDataChange()}onSeriesGroupingChange(e,t){const{internalId:i,type:s,visible:n}=this;e&&this.ctx.seriesStateManager.deregisterSeries(this),t&&this.ctx.seriesStateManager.registerSeries({internalId:i,type:s,visible:n,seriesGrouping:t}),this.fireEvent(new Im(this,t))}getBandScalePadding(){return{inner:1,outer:0}}attachSeries(e,t,i){e.appendChild(this.contentGroup),t.appendChild(this.highlightGroup),t.appendChild(this.labelGroup),i?.appendChild(this.annotationGroup)}detachSeries(e,t,i){this.contentGroup.remove(),this.highlightGroup.remove(),this.labelGroup.remove(),this.annotationGroup.remove()}setSeriesIndex(e,t=!1){const i=this.bringToFront();return!t&&e===this.declarationOrder&&i===this._broughtToFront?!1:(this.declarationOrder=e,this._broughtToFront=i,this.setZIndex(i?Number.MAX_VALUE:e),this.fireEvent(new Im(this,this.seriesGrouping)),!0)}setZIndex(e){this.contentGroup.zIndex=[1,e,0],this.highlightGroup.zIndex=[1,e,1],this.labelGroup.zIndex=[1,e,2],this.annotationGroup.zIndex=e}renderToOffscreenCanvas(){return!1}addEventListener(e,t){return super.addEventListener(e,t)}removeEventListener(e,t){return super.removeEventListener(e,t)}hasEventListener(e){return super.hasEventListener(e)}addChartEventListeners(){}updatedDomains(){}destroy(){this.cleanup.flush(),this.resetDatumCallbackCache(),this.ctx.seriesStateManager.deregisterSeries(this)}getPropertyValues(e,t){const i=DN(e),s=i==null?e:NM(this.resolveKeyDirection(i)),n=t?.[s],o=[];if(!n)return o;const a=(...r)=>{for(const l of r)Array.isArray(l)?a(...l):typeof l=="object"?a(...Object.values(l)):o.push(l)};return a(...n.map(r=>this.properties[r])),o}getKeys(e){return this.getPropertyValues(NM(e),this.propertyKeys)}getKeyProperties(e){return this.propertyKeys[this.resolveKeyDirection(e)]??[]}getNames(e){return this.getPropertyValues(NM(e),this.propertyNames)}getFormatterContext(e){const{id:t}=this,i=this.getPropertyValues(e,this.propertyKeys),s=this.getPropertyValues(e,this.propertyNames),n=[];for(let o=0;os.getDomain(e)).flat();return i.length===0?t:t.concat(i)}getRange(e,t){return this.getSeriesRange(e,t)}getZoomRangeFittingItems(e,t,i){}getVisibleItems(e,t,i){return 1/0}markNodeDataDirty(){this.nodeDataRefresh=!0,this._pickNodeCache.clear(),this.visibleMaybeChanged()}visibleMaybeChanged(){this.ctx.seriesStateManager.updateSeries(this)}getOpacity(){if(!this.properties.highlight)return 1;const{opacity:t=1}=this.getHighlightStyle();return t}getHighlightState(e,t,i,s){if(t)return 1;if(e?.series==null)return 0;if(this.isSeriesHighlighted(e,s)){const n=this.isItemHighlighted(e,i);return n==null||n?2:4}return 3}getHighlightStateString(e,t,i,s){return Cd(this.getHighlightState(e,t,i,s))}onChangeHighlight(e){const t=e.previousHighlight,i=e.currentHighlight,s=this.getHighlightState(i),n=this.getHighlightState(t);this.setSeriesIndex(this.declarationOrder);const o=this.hasItemStylers();if(!o&&s===n){this.hasChangesOnHighlight=!1;return}const{highlightedSeries:a,unhighlightedItem:r,unhighlightedSeries:l}=this.properties.highlight;this.hasChangesOnHighlight=o||!ry(a)||!ry(r)||!ry(l)}bringToFront(){return this.properties.highlight.bringToFront&&this.isSeriesHighlighted(this.ctx.highlightManager.getActiveHighlight())}isSeriesHighlighted(e,t){return e?.series===this}isItemHighlighted(e,t){if(!(e?.datumIndex==null||t==null))return e.datumIndex===t}getHighlightStyle(e,t,i,s){const n=this.ctx.highlightManager?.getActiveHighlight();return i??(i=this.getHighlightState(n,e,t,s)),this.properties.highlight.getStyle(i)}filterItemStylerFillParams(e){return ao(e)?re(e,["bounds","colorSpace","gradient","reverse"]):ur(e)?re(e,["padding"]):e}getModuleTooltipParams(){return this.moduleMap.mapModules(e=>e.getTooltipParams()).reduce((e,t)=>Object.assign(e,t),{})}pickNodes(e,t,i=!1){const{pickModes:s,pickModeAxis:n,visible:o,contentGroup:a}=this;if(!o||!a.visible||t==="highlight"&&!this.properties.highlight.enabled||t==="highlight-tooltip"&&!this.properties.highlight.enabled)return;let r=1/0;if(t==="tooltip"||t==="highlight-tooltip"){const{tooltip:u}=this.properties;r=typeof u.range=="number"?u.range:1/0,i||(i=u.range==="exact")}else if(t==="event"||t==="context-menu"){const{nodeClickRange:u}=this.properties;r=typeof u=="number"?u:1/0,i||(i=u==="exact")}const l=s.filter(u=>!i||u===0),{x:c,y:h}=e,d=JSON.stringify({x:c,y:h,maxDistance:r,selectedPickModes:l});if(this._pickNodeCache.has(d))return this._pickNodeCache.get(d);for(const u of l){let p;switch(u){case 0:{const g=this.pickNodesExactShape(e);p=g.length===0?void 0:{datums:g,distance:0};break}case 1:{const g=this.pickNodeClosestDatum(e),f=g?.distance===0?this.pickNodesExactShape(e):void 0;f!=null&&f.length!==0?p={datums:f,distance:0}:g?p={datums:[g.datum],distance:g.distance}:p=void 0;break}case 2:{const g=n==null?void 0:this.pickNodeMainAxisFirst(e,n==="main-category");p=g==null?void 0:{datums:[g.datum],distance:g.distance};break}}if(p&&p.distance<=r)return this._pickNodeCache.set(d,{pickMode:u,datums:p.datums,distance:p.distance})}return this._pickNodeCache.set(d,void 0)}pickNodesExactShape(e){const t=[];for(const i of this.contentGroup.pickNodes(e.x,e.y)){const s=i.closestDatum();s!=null&&s.missing!==!0&&t.push(s)}return t}pickNodeClosestDatum(e){throw new Error("AG Charts - Series.pickNodeClosestDatum() not implemented")}pickNodeNearestDistantObject(e,t){const i=Ty(e.x,e.y,t),s=i.nearest?.closestDatum();if(s!=null&&s.missing!==!0)return{datum:s,distance:Math.sqrt(i.distanceSquared)}}pickNodeMainAxisFirst(e,t){throw new Error("AG Charts - Series.pickNodeMainAxisFirst() not implemented")}getLabelData(){return[]}updatePlacedLabelData(e){}fireEvent(e){Uo([this.properties,this.ctx.chartService],this.fireEventWrapper,e)}fireNodeClickEvent(e,t){const i=new this.NodeEvent("seriesNodeClick",e,t,this);return this.fireEvent(i),!i.defaultPrevented}fireNodeDoubleClickEvent(e,t){const i=new this.NodeEvent("seriesNodeDoubleClick",e,t,this);return this.fireEvent(i),!i.defaultPrevented}createNodeContextMenuActionEvent(e,t){return new this.NodeEvent("nodeContextMenuAction",e,t,this)}onLegendInitialState(e,t){const{visible:i=!0,itemId:s,legendItemName:n}=t??{};this.toggleSeriesItem(i,e,s,n)}onLegendItemClick(e){const{enabled:t,itemId:i,series:s,legendType:n}=e,o="legendItemName"in this.properties?this.properties.legendItemName:void 0,a="legendItemKey"in this.properties?this.properties.legendItemKey:void 0,r=o!=null&&o===e.legendItemName;(s.id===this.id||r||a!=null)&&this.toggleSeriesItem(t,n,i,o,e)}onLegendItemDoubleClick(e){const{enabled:t,itemId:i,series:s,numVisibleItems:n,legendType:o}=e,a="legendItemName"in this.properties?this.properties.legendItemName:void 0,r="legendItemKey"in this.properties?this.properties.legendItemKey:void 0,l=a!=null&&a===e.legendItemName;s.id===this.id||l||r!=null?this.toggleSeriesItem(!0,o,i,a,e):t&&n===1?this.toggleSeriesItem(!0,o,void 0,a):this.toggleSeriesItem(!1,o,void 0,a)}toggleSeriesItem(e,t,i,s,n){const o=this.id;(e||t!=="category")&&(this.visible=e),this.nodeDataRefresh=!0,this._pickNodeCache.clear();const a={type:"seriesVisibilityChange",seriesId:o,itemId:i,legendItemName:n?.legendItemName??s,visible:e};this.fireEvent(a),this.ctx.legendManager.toggleItem(e,o,i,s)}isEnabled(){return this.visible}getModuleMap(){return this.moduleMap}createModuleContext(){return{...this.ctx,series:this}}getAxisValueText(e,t,i,s,n,o){const{id:a,properties:r}=this;return e.formatDatum(r,i,t,a,o,s,n)}getLabelText(e,t,i,s,n,o,a){if(e==null)return"";const{axes:r,canHaveAxes:l,ctx:c,id:h,properties:d}=this,u="series-label",p="legendItemName"in d?d.legendItemName:void 0,g={seriesId:this.id,...a},f=l?DN(s):void 0,x=f==null?void 0:r[this.resolveKeyDirection(f)];if(x!=null)return x.formatDatum(d,e,u,h,p,t,i,n,o,g);const{formatManager:m}=c,v=this.callWithContext.bind(this),b=D=>o.formatValue(v,D.type,D.value,g)??m.format(v,D)??String(e),S=this.getFormatterContext(s);switch(s){case"y":case"color":case"size":return b({type:"number",value:e,datum:t,seriesId:h,legendItemName:p,key:i,source:u,property:s,domain:n,boundSeries:S,fractionDigits:void 0});case"x":case"radius":case"angle":case"label":case"secondaryLabel":case"calloutLabel":case"sectorLabel":case"legendItem":return b({type:"category",value:e,datum:t,seriesId:h,legendItemName:p,key:i,source:u,property:s,domain:n,boundSeries:S})}}getMarkerStyle(e,{datumIndex:t,datum:i,point:s},n,o,a={size:s?.size??e.size??0},r){const{itemStyler:l}=e,{highlightState:c,isHighlight:h=!1,checkForHighlight:d=!0,resolveMarkerSubPath:u=["marker"],resolveStyler:p=!1}=o??{},g=["series",`${this.declarationOrder}`,...u];if(p){const v={permissivePath:!0},b=this.ctx.optionsGraphService.resolvePartial(g,a,v);b&&(a={...b,size:b.size??a.size})}const f=d?this.getHighlightStyle(h,t,c):void 0;let m=st(f,a,e.getStyle(),r);if(l&&n){const v=this.ctx.highlightManager?.getActiveHighlight(),b=this.getHighlightStateString(v,h,t),S=this.filterItemStylerFillParams(m.fill),D=this.cachedCallWithContext(l,{seriesId:this.id,...m,fill:S,...n,highlighted:h,highlightState:b,datum:i}),L=this.ctx.optionsGraphService.resolvePartial(g,D);m=st(L,m)}return m}applyMarkerStyle(e,t,i,s,{applyTranslation:n=!0,selected:o=!0}={}){const{shape:a,size:r=0}=e,l=this.visible&&r>0&&i&&!Number.isNaN(i.x)&&!Number.isNaN(i.y);if(Dr(t,e,s),n?t.setProperties({visible:l,shape:a,size:r,x:i?.x,y:i?.y,scalingCenterX:i?.x,scalingCenterY:i?.y}):t.setProperties({visible:l,shape:a,size:r}),o||(t.fillOpacity*=v$,t.strokeOpacity*=S$),typeof a=="function"&&!t.dirtyPath){t.path.clear(!0),t.updatePath(),t.checkPathDirty();const c=t.getBBox();if(i!=null&&c.isFinite()){const h=c.computeCenter(),[d,u]=["x","y"].map(p=>(e.strokeWidth??0)+Math.abs(h[p]-i[p]));i.focusSize=Math.max(c.width+d,c.height+u)}}}get nodeDataDependencies(){return this._nodeDataDependencies??{seriesRectWidth:Number.NaN,seriesRectHeight:Number.NaN}}checkResize(e){const{width:t,height:i}=e??{width:Number.NaN,height:Number.NaN},s=e?{seriesRectWidth:t,seriesRectHeight:i}:void 0,n=wa(this.nodeDataDependencies,s)!=null;return n&&(this._nodeDataDependencies=s,this.markNodeDataDirty()),n}pickFocus(e){}resetDatumCallbackCache(){this.datumCallbackCache.clear()}cachedDatumCallback(e,t){const{datumCallbackCache:i}=this,s=i.get(e);if(s!=null)return s;try{const n=t();return i.set(e,n),n}catch(n){K.error(String(n))}}cachedCallWithContext(e,t){return this.ctx.callbackCache.call([this.properties,this.ctx.chartService],e,t)}callWithContext(e,t){return Uo([this.properties,this.ctx.chartService],e,t)}formatTooltipWithContext(e,t,i){return e.formatTooltip([this.properties,this.ctx.chartService],t,i)}minTimeInterval(){}};M([ps({changeValue:function(e,t){this.onSeriesGroupingChange(t,e)}})],Am.prototype,"seriesGrouping",2);var M$=class{constructor(e){this.swapChain=e,this.hasBeenActivated=!1,this.div=De("div"),this.svg=Xt("svg"),this.outerPath=Xt("path"),this.innerPath=Xt("path"),this.svg.append(this.outerPath),this.svg.append(this.innerPath),this.outerPath.classList.add("ag-charts-focus-svg-outer-path"),this.innerPath.classList.add("ag-charts-focus-svg-inner-path"),this.element=De("div","ag-charts-focus-indicator"),this.element.ariaHidden="true",this.element.append(this.svg),this.swapChain.addListener("swap",t=>this.onSwap(t))}clear(){}update(e,t,i){if(t!=null)if(e instanceof Hi){const s=(o,a)=>{let{x:r,y:l}=zt.toCanvasPoint(e,o,a);return r-=t.x??0,l-=t.y??0,{x:r,y:l}},n=e.svgPathData(s);this.outerPath.setAttribute("d",n),this.innerPath.setAttribute("d",n),this.show(this.svg)}else{let s;if(i){const n=Math.max(e.x-t.x,0),o=Math.max(e.y-t.y,0),a=Math.min(e.x+e.width-t.x,t.width),r=Math.min(e.y+e.height-t.y,t.height);s=new de(n,o,a-n,r-o)}else s=new de(e.x-t.x,e.y-t.y,e.width,e.height);Gy(this.div,s),this.show(this.div)}}onSwap(e){e!==this.element.parentElement&&(this.element.remove(),e.appendChild(this.element),this.overrideFocusVisible(this.focusVisible))}show(e){this.hasBeenActivated=!0,this.element.innerHTML="",this.element.append(e)}overrideFocusVisible(e){this.focusVisible=e;const t={true:"1",false:"0",undefined:""};this.element.parentElement?.style.setProperty("opacity",t[`${e}`])}isFocusVisible(e=!1){if(!e&&!this.hasBeenActivated)return!1;const t=this.element.parentElement;return t!=null&&qe().getComputedStyle(t).opacity==="1"}},D$=class{constructor(e,t,i,s){this.label1=e,this.label2=t,this.hasFocus=!1,this.skipDispatch=!1,this.listeners={blur:[],focus:[],swap:[]},this.onBlur=n=>(La(n.target,"pointer-events",void 0),!this.skipDispatch&&this.dispatch("blur",n)),this.onFocus=n=>(La(n.target,"pointer-events","auto"),!this.skipDispatch&&this.dispatch("focus",n)),Ge(this.label1,"id",Ic()),Ge(this.label2,"id",Ic()),La(this.label1,"display","none"),La(this.label2,"display","none"),this.label1.textContent=s,this.label2.textContent=s,this.activeAnnouncer=this.createAnnouncer(i),this.inactiveAnnouncer=this.createAnnouncer(i),Ge(this.activeAnnouncer,"tabindex",0),this.label2.insertAdjacentElement("afterend",this.activeAnnouncer),this.label2.insertAdjacentElement("afterend",this.inactiveAnnouncer),this.swap(s)}createAnnouncer(e){const t=De("div");return t.role=e,t.className="ag-charts-swapchain",t.addEventListener("blur",this.onBlur),t.addEventListener("focus",this.onFocus),t}destroy(){for(const e of[this.activeAnnouncer,this.inactiveAnnouncer])e.removeEventListener("blur",this.onBlur),e.removeEventListener("focus",this.onFocus),e.remove()}focus(e){this.focusOptions=e,this.activeAnnouncer.focus(e),this.focusOptions=void 0}update(e){this.skipDispatch=!0,this.swap(e),this.hasFocus&&this.activeAnnouncer.focus(this.focusOptions),this.skipDispatch=!1}addListener(e,t){this.listeners[e].push(t),e==="swap"&&t(this.activeAnnouncer)}dispatch(e,t){e==="focus"?this.hasFocus=!0:e==="blur"&&(this.hasFocus=!1);for(const i of this.listeners[e])i(t)}swap(e){const t=this.activeAnnouncer.tabIndex;this.label2.textContent=e,[this.inactiveAnnouncer,this.activeAnnouncer]=[this.activeAnnouncer,this.inactiveAnnouncer],[this.label1,this.label2]=[this.label2,this.label1],Ca(this.inactiveAnnouncer,{"aria-labelledby":this.label1.id,"aria-hidden":!0,tabindex:void 0}),Ca(this.activeAnnouncer,{"aria-labelledby":this.label1.id,"aria-hidden":!1,tabindex:t}),this.dispatch("swap",this.activeAnnouncer)}},k$={arrowdown:{bindings:[{code:"ArrowDown"}]},arrowleft:{bindings:[{code:"ArrowLeft"}]},arrowright:{bindings:[{code:"ArrowRight"}]},arrowup:{bindings:[{code:"ArrowUp"}]},delete:{bindings:[{key:"Backspace"},{key:"Delete"}],activatesFocusIndicator:!1},redo:{bindings:[{key:"y",ctrlOrMeta:!0},{key:"z",ctrlOrMeta:!0,shift:!0}],activatesFocusIndicator:!1},undo:{bindings:[{key:"z",ctrlOrMeta:!0}],activatesFocusIndicator:!1},submit:{bindings:[{key:"Enter"},{code:"Enter"},{code:"Space"}]},zoomin:{bindings:[{key:"+"},{code:"ZoomIn"},{code:"Add"}],activatesFocusIndicator:!1},zoomout:{bindings:[{key:"-"},{code:"ZoomOut"},{code:"Substract"}],activatesFocusIndicator:!1}};function I$(e,t){for(const i of t)if("code"in i){if(i.code===e.code)return!0}else if(i.key===e.key&&(i.shift===void 0||i.shift===e.shiftKey)&&(i.ctrlOrMeta===void 0||i.ctrlOrMeta===e.ctrlKey||i.ctrlOrMeta===e.metaKey))return!0;return!1}function A$(e){for(const[t,{activatesFocusIndicator:i=!0,bindings:s}]of Tt(k$))if(I$(e,s))return{name:t,activatesFocusIndicator:i}}function C$(e,t,i){const s=R0(e,i.datum,i.movedBounds);if(s!=null)return{x:s.canvasX,y:s.canvasY};const n=i.bounds;if(n!=null){if(n instanceof de){const{x:o,y:a}=n.computeCenter();return{x:t.x+o,y:t.y+a}}return zt.toCanvas(n).computeCenter()}}function L$({bounds:e}){return e instanceof de?e:e!=null?zt.toCanvas(e):de.NaN}function T$(e,t,i){const{x:s,y:n}=C$(e,t,i)??{};if(s!==void 0&&n!==void 0)return{type:"keyboard",canvasX:s,canvasY:n}}function kN(e,t,i,s){let{top:n,right:o,bottom:a,left:r,width:l,height:c}=s;return r!=null?l!=null?o=i.width-r+l:o!=null&&(l=i.width-r-o):o!=null&&l!=null&&(r=i.width-o-l),n!=null?c!=null?a=i.height-n-c:a!=null&&(c=i.height-a-n):a!=null&&c!=null&&(n=i.height-a-c),l==null?c==null?(c=t,l=e):l=Math.ceil(e*c/t):c??(c=Math.ceil(t*l/e)),r==null&&(o==null?r=Math.floor((i.width-l)/2):r=i.width-o-l),n==null&&(a==null?n=Math.floor((i.height-c)/2):n=i.height-c-a),{x:r,y:n,width:l,height:c}}var IN=.1,AN=200,CN=12,w$=.5,N$=class{constructor(){this.events=new Go,this.x1=Number.NaN,this.y1=Number.NaN,this.x=Number.NaN,this.y=Number.NaN,this.vx=0,this.vy=0,this.t0=Number.NaN,this.animationFrameHandle=void 0}reset(){this.x=Number.NaN,this.y=Number.NaN,this.animationFrameHandle!=null&&(cancelAnimationFrame(this.animationFrameHandle),this.animationFrameHandle=void 0)}update(e,t){if(Number.isNaN(this.x)||Number.isNaN(this.y)){this.x=e,this.y=t,this.vx=0,this.vy=0,this.emitUpdate(),this.animationFrameHandle!=null&&(cancelAnimationFrame(this.animationFrameHandle),this.animationFrameHandle=void 0);return}this.x1=e,this.y1=t,this.t0=Date.now(),this.animationFrameHandle??(this.animationFrameHandle=requestAnimationFrame(this.onFrame.bind(this)))}onFrame(){this.animationFrameHandle=void 0;const{x1:e,y1:t,t0:i}=this,s=Date.now(),n=s-i;this.t0=s;const o=.001,a=Math.trunc(Math.ceil(n/(o*1e3)));let{x:r,y:l,vx:c,vy:h}=this;for(let d=0;d"))}function og(e,t){const{path:i,size:s}=e,{x:n,y:o}=e;i.clear();let a=!1;for(const[r,l]of t){const c=n+(r-.5)*s,h=o+(l-.5)*s;a?i.lineTo(c,h):i.moveTo(c,h),a=!0}i.closePath()}var O$={circle({path:e,x:t,y:i,size:s}){const n=s/2;e.arc(t,i,n,0,Math.PI*2),e.closePath()},cross(e){og(e,[[.25,0],[.5,.25],[.75,0],[1,.25],[.75,.5],[1,.75],[.75,1],[.5,.75],[.25,1],[0,.75],[.25,.5],[0,.25]])},diamond(e){og(e,[[.5,0],[1,.5],[.5,1],[0,.5]])},heart({path:e,x:t,y:i,size:s}){const n=s/4;i=i+n/2,e.arc(t-n,i-n,n,ds(130),ds(330)),e.arc(t+n,i-n,n,ds(220),ds(50)),e.lineTo(t,i+n),e.closePath()},pin({path:e,x:t,y:i,size:s}){e.moveTo(t+(.15625-.5)*s,i+(.34375-.5)*s),e.cubicCurveTo(t+(.15625-.5)*s,i+(.151491-.5)*s,t+(.307741-.5)*s,i+(0-.5)*s,t+(.5-.5)*s,i+(0-.5)*s),e.cubicCurveTo(t+(.692259-.5)*s,i+(0-.5)*s,t+(.84375-.5)*s,i+(.151491-.5)*s,t+(.84375-.5)*s,i+(.34375-.5)*s),e.cubicCurveTo(t+(.84375-.5)*s,i+(.493824-.5)*s,t+(.784625-.5)*s,i+(.600181-.5)*s,t+(.716461-.5)*s,i+(.695393-.5)*s),e.cubicCurveTo(t+(.699009-.5)*s,i+(.719769-.5)*s,t+(.681271-.5)*s,i+(.743104-.5)*s,t+(.663785-.5)*s,i+(.766105-.5)*s),e.cubicCurveTo(t+(.611893-.5)*s,i+(.834367-.5)*s,t+(.562228-.5)*s,i+(.899699-.5)*s,t+(.528896-.5)*s,i+(.980648-.5)*s),e.cubicCurveTo(t+(.524075-.5)*s,i+(.992358-.5)*s,t+(.512663-.5)*s,i+(1-.5)*s,t+(.5-.5)*s,i+(1-.5)*s),e.cubicCurveTo(t+(.487337-.5)*s,i+(1-.5)*s,t+(.475925-.5)*s,i+(.992358-.5)*s,t+(.471104-.5)*s,i+(.980648-.5)*s),e.cubicCurveTo(t+(.487337-.5)*s,i+(1-.5)*s,t+(.475925-.5)*s,i+(.992358-.5)*s,t+(.471104-.5)*s,i+(.980648-.5)*s),e.cubicCurveTo(t+(.437772-.5)*s,i+(.899699-.5)*s,t+(.388107-.5)*s,i+(.834367-.5)*s,t+(.336215-.5)*s,i+(.766105-.5)*s),e.cubicCurveTo(t+(.318729-.5)*s,i+(.743104-.5)*s,t+(.300991-.5)*s,i+(.719769-.5)*s,t+(.283539-.5)*s,i+(.695393-.5)*s),e.cubicCurveTo(t+(.215375-.5)*s,i+(.600181-.5)*s,t+(.15625-.5)*s,i+(.493824-.5)*s,t+(.15625-.5)*s,i+(.34375-.5)*s),e.closePath()},plus(e){og(e,[[1/3,0],[2/3,0],[2/3,1/3],[1,1/3],[1,2/3],[2/3,2/3],[2/3,1],[1/3,1],[1/3,2/3],[0,2/3],[0,1/3],[1/3,1/3]])},square({path:e,x:t,y:i,size:s,pixelRatio:n}){const o=s/2;e.moveTo(ji(n,t-o),ji(n,i-o)),e.lineTo(ji(n,t+o),ji(n,i-o)),e.lineTo(ji(n,t+o),ji(n,i+o)),e.lineTo(ji(n,t-o),ji(n,i+o)),e.closePath()},star({path:e,x:t,y:i,size:s}){const o=s/2,a=o/2,r=Math.PI/2;for(let l=0;l<5*2;l++){const c=l%2===0?o:a,h=l*Math.PI/5-r,d=t+Math.cos(h)*c,u=i+Math.sin(h)*c;e.lineTo(d,u)}e.closePath()},triangle(e){og(e,[[.5,0],[1,.87],[0,.87]])}},ag=class extends Hi{constructor(){super(...arguments),this.shape="square",this.x=0,this.y=0,this.size=12}isPointInPath(e,t){return this.distanceSquared(e,t)<=0}get midPoint(){return{x:this.x,y:this.y}}distanceSquared(e,t){const i=wi.anchor(this.shape),s=e-this.x+(i.x-.5)*this.size,n=t-this.y+(i.y-.5)*this.size,o=this.size/2;return Math.max(s*s+n*n-o*o,0)}updatePath(){const{path:e,shape:t,x:i,y:s,size:n}=this,o=this.layerManager?.canvas?.pixelRatio??1,a=wi.anchor(t),r={path:e,x:i-(a.x-.5)*n,y:s-(a.y-.5)*n,size:n,pixelRatio:o};e.clear(),typeof t=="string"?O$[t](r):typeof t=="function"&&t(r)}computeBBox(){const{x:e,y:t,size:i}=this,s=wi.anchor(this.shape);return new de(e-i*s.x,t-i*s.y,i,i)}executeFill(e,t){if(t)return super.executeFill(e,t)}executeStroke(e,t){if(t)return super.executeStroke(e,t)}};M([En({equals:hd})],ag.prototype,"shape",2),M([ne()],ag.prototype,"x",2),M([ne()],ag.prototype,"y",2),M([ne({convertor:Math.abs})],ag.prototype,"size",2);var wi=class extends fd(Vy(yd(ag))){static anchor(e){return e==="pin"?{x:.5,y:1}:typeof e=="function"&&"anchor"in e?e.anchor:{x:.5,y:.5}}constructor(e){super(e),e?.shape!=null&&(this.shape=e.shape)}};function LN(e,t,i=t*(5/3)){const s=new Be,n=Math.min(e.marker.strokeWidth??1,2),o=Math.min(e.line?.strokeWidth??0,2),a=Math.max(e.marker.enabled===!1?0:t,e.line==null?0:i),r=Math.max(e.marker.enabled===!1?0:t,o);if(e.line!=null){const{stroke:l,strokeOpacity:c,lineDash:h}=e.line,d=new Rn;d.x1=0,d.y1=r/2,d.x2=a,d.y2=r/2,d.stroke=l,d.strokeOpacity=c,d.strokeWidth=o,d.lineDash=h,s.append(d)}if(e.marker.enabled!==!1){const{shape:l,fill:c,fillOpacity:h,stroke:d,strokeOpacity:u,lineDash:p,lineDashOffset:g}=e.marker,f=new wi;f.shape=l??"square",f.size=t,f.fill=c,f.fillOpacity=h??1,f.stroke=d,f.strokeOpacity=u??1,f.strokeWidth=n,f.lineDash=p,f.lineDashOffset=g??0;const x=wi.anchor(l),m=a/2+(x.x-.5)*t,v=r/2+(x.y-.5)*t,b=t/(t+n);f.x=m,f.y=v,f.scalingCenterX=m,f.scalingCenterY=v,f.scalingX=b,f.scalingY=b,s.append(f)}return Be.toSVG(s,a,r)}var Qi="ag-charts-tooltip",TN="ag-charts-tooltip--dark";function wN(e){const t=[],i=new Map;for(const s of e)if(s.type==="structured"){const{heading:n}=s,o=n==null?void 0:i.get(n),a={type:"structured",heading:n,items:[s]};o==null?(i.set(n,a),t.push(a)):o.items.push(s)}else t.push(s);return t}function NN(e){const t=wN(e),i=[];for(const s of t)if(s.type!=="raw"){s.heading!=null&&i.push($e(s.heading));for(const n of s.items)if(n.title!=null&&i.push($e(n.title)),n.data)for(const o of n.data)i.push(o.label??o.fallbackLabel,o.value)}return i.filter(s=>s!=="").join("; ")}function OM(e,t,i){let s="";if(e==null&&!t)return"";e==null?s+=`${ng(t)}`:(s+=`${ng(e)}`,s+=" ",s+=`${ng(t)}`);const n=[`${Qi}-row`];return i&&n.push(`${Qi}-row--inline`),s=`
${s}
`,s}function E$(e){let t="";if(e.data?.length&&e.data.every(n=>n.value==null||n.value===""))return t;const i=e.title==null&&e.data?.length===1,s=e.symbol==null?void 0:LN(e.symbol,12);if(s!=null&&(e.title!=null||e.data?.length)&&(t+=`${s}`),e.title!=null&&(t+=`${ng(e.title)}`,t+=" "),e.data)for(const n of e.data)t+=OM(n.label??n.fallbackLabel,n.value,i),t+=" ";return t}function ON(e,t){if(e==null||t.length===1)return;const i=e?.t("tooltipPaginationStatus",{index:t.index+1,count:t.length});return``}function EN(e,t,i,s){const n=t.items.length===1?t.items[0]:void 0;let o,a,r;switch(i){case"compact":o=!0,a=$e(n?.title);break;case"single":o=n!=null&&(t.heading==null||n.title==null)&&n.data?.length===1&&n.data[0].label==null&&n.data[0].value!=null,r=$e(t.heading??n?.title);break;case"shared":o=!1}let l="";if(o&&n!=null){if(a!=null&&(l+=OM(void 0,a,!1)),n.data)for(const h of n.data)l+=OM(h.label??r,h.value,!1),l+=" "}else{t.heading!=null&&(l+=`${ng($e(t.heading))}`,l+=" ");for(const h of t.items)l+=E$(h)}if(l.length===0)return;const c=i!=="compact"&&s!=null?ON(e,s):void 0;return c+null&&(l+=c),l=`
${l.trimEnd()}
`,l}function P$(e,t){const i=t==null?void 0:ON(e,t);return i==null?"":`
${i}
`}function PN(e,t,i,s){const n=wN(t);if(n.length!==0){if(n.length===1&&n[0].type==="structured")return EN(e,n[0],i,s);{const o=n.map(a=>a.type==="structured"?EN(e,a,i):a.rawHtmlString);return s!=null&&o.push(P$(e,s)??""),o.join("")}}}var R$={left:-1,"top-left":-1,"bottom-left":-1,top:0,center:0,bottom:0,right:1,"top-right":1,"bottom-right":1},z$={"top-left":-1,top:-1,"top-right":-1,left:0,center:0,right:0,"bottom-left":1,bottom:1,"bottom-right":1},F$={left:3,"top-left":void 0,"bottom-left":void 0,top:2,center:void 0,bottom:1,right:0,"top-right":void 0,"bottom-right":void 0},RN={top:2,bottom:2,left:1,right:1,"top-right":3,"top-left":3,"bottom-right":3,"bottom-left":3,center:0},B$={pointer:"top",node:"top",chart:"top-left"},Hc=class extends Le{constructor(){super(...arguments),this.xOffset=0,this.yOffset=0}};M([C],Hc.prototype,"xOffset",2),M([C],Hc.prototype,"yOffset",2),M([C],Hc.prototype,"anchorTo",2),M([C],Hc.prototype,"placement",2);var go=class extends Le{constructor(){super(),this.enabled=!0,this.mode="single",this.delay=0,this.range=void 0,this.wrapping="hyphenate",this.position=new Hc,this.pagination=!1,this.darkTheme=!1,this.bounds="extended",this.cleanup=new St,this.springAnimation=new N$,this.enableInteraction=!1,this.wrapTypes=["always","hyphenate","on-space","never"],this.sizeMonitor=new AT,this._elementSize=void 0,this._showTimeout=void 0,this.arrowPosition=void 0,this._visible=!1,this.positionParams=void 0,this.localeManager=void 0,this.cleanup.register(this.springAnimation.events.on("update",this.updateTooltipPosition.bind(this)))}get interactive(){return this.enableInteraction}setup(e,t){return"togglePopover"in qe().HTMLElement.prototype&&(this.element=t.addChild("tooltip-container",Qi),this.element.setAttribute("popover","manual"),this.element.className=Qi,this.element.style.positionAnchor=t.anchorName,this.sizeMonitor.observe(this.element,i=>{this._elementSize=i,this.updateTooltipPosition()})),this.localeManager=e,()=>{t.removeChild("tooltip-container",Qi),this.cleanup.flush(),this.element&&this.sizeMonitor.unobserve(this.element)}}isVisible(){return this._visible}contains(e){return this.element?.contains(e)??!1}updateTooltipPosition(){const{element:e,_elementSize:t,positionParams:i}=this;if(e==null||t==null||i==null)return;const{canvasRect:s,relativeRect:n,meta:o}=i,{x:a,y:r}=this.springAnimation,l=o.position?.anchorTo??"pointer";let c=o.position?.placement??B$[l];Array.isArray(c)||(c=[c]);const h=o.position?.xOffset??0,d=o.position?.yOffset??0,u=n.x,p=n.y,g=n.width-t.width-1+u,f=n.height-t.height+p;let x=0,m,v,b=!1;do{m=c[x],x+=1;const A=this.getTooltipBounds({elementSize:t,placement:m,anchorTo:l,canvasX:a,canvasY:r,yOffset:d,xOffset:h,canvasRect:s});v=kN(t.width,t.height,n,A),b=!1,RN[m]&1&&(b||(b=v.xg)),RN[m]&2&&(b||(b=v.yf))}while(x{(r.relatedTarget==null||r.relatedTarget instanceof Node&&!this.contains(r.relatedTarget))&&this.popInteractiveLeaveCallback()}},o.addEventListener("focusout",this.interactiveLeave.listener),o.addEventListener("mouseout",this.interactiveLeave.listener)),a}popInteractiveLeaveCallback(){const{interactiveLeave:e,element:t}=this;this.interactiveLeave=void 0,e&&(t&&(t.removeEventListener("focusout",e.listener),t.removeEventListener("mouseout",e.listener)),e.callback())}toggle(e,t=!1){const{delay:i}=this;e&&i>0&&!t?this._showTimeout??(this._showTimeout=setTimeout(()=>{this._showTimeout=void 0,this.toggleCallback(!0)},i)):(clearTimeout(this._showTimeout),this._showTimeout=void 0,this.toggleCallback(e))}toggleCallback(e){this.element?.isConnected&&this._visible!==e&&(this._visible=e,this.element.togglePopover(e),e?this.updateTooltipPosition():(this.springAnimation.reset(),this.popInteractiveLeaveCallback()))}updateClassModifiers(){if(!this.element?.isConnected)return;const{classList:e}=this.element,t=(i,s)=>e.toggle(`${Qi}--${i}`,s);t("no-interaction",!this.enableInteraction),t("arrow-top",this.arrowPosition===1),t("arrow-right",this.arrowPosition===3),t("arrow-bottom",this.arrowPosition===2),t("arrow-left",this.arrowPosition===0),t("compact",this.mode==="compact"),e.toggle(TN,this.darkTheme);for(const i of this.wrapTypes)e.toggle(`${Qi}--wrap-${i}`,i===this.wrapping)}getTooltipBounds(e){const{elementSize:t,anchorTo:i,placement:s,canvasX:n,canvasY:o,yOffset:a,xOffset:r,canvasRect:l}=e,{width:c,height:h}=t,d={width:c,height:h};if(i==="node"||i==="pointer"){const u=R$[s],p=z$[s];return d.top=o+a+h*(p-1)/2+8*p,d.left=n+r+c*(u-1)/2+8*u,d}switch(s){case"top":return d.top=a,d.left=l.width/2-c/2+r,d;case"right":return d.top=l.height/2-h/2+a,d.left=l.width-c+r,d;case"left":return d.top=l.height/2-h/2+a,d.left=r,d;case"bottom":return d.top=l.height-h+a,d.left=l.width/2-c/2+r,d;case"top-left":return d.top=a,d.left=r,d;case"top-right":return d.top=a,d.left=l.width-c+r,d;case"bottom-right":return d.top=l.height-h+a,d.left=l.width-c+r,d;case"bottom-left":return d.top=l.height-h+a,d.left=r,d}return d}};M([C],go.prototype,"enabled",2),M([C],go.prototype,"mode",2),M([C],go.prototype,"showArrow",2),M([C],go.prototype,"delay",2),M([C],go.prototype,"range",2),M([C],go.prototype,"wrapping",2),M([C],go.prototype,"position",2),M([C],go.prototype,"pagination",2),M([C],go.prototype,"darkTheme",2),M([C],go.prototype,"bounds",2);function EM(e,t){return e.series===t.series&&Ci(e.datumIndex,t.datumIndex)}var _$=class{constructor(){this.candidates=[]}get current(){return this.active}reset(){this.candidates.length=0,this.active=void 0}update(e,t){this.candidates=e;let i=t==null?-1:e.findIndex(s=>EM(s,t));return i===-1&&(i=0),this.active=e[i],{current:this.active,index:i,length:e.length}}next(){const{candidates:e,active:t}=this,i=t==null?-1:e.findIndex(n=>EM(n,t));if(i===-1)return;let s=i+1;return s>=e.length&&(s=0),this.active=e[s],{current:this.active,index:s,length:this.candidates.length}}},V$=class extends S0{constructor(e){super(),this.chart=e,this.id=hs(this),this.series=[],this.announceMode="when-changed",this.highlight={pendingHoverEvent:void 0,appliedHoverEvent:void 0,stashedHoverEvent:void 0},this.tooltip={lastHover:void 0},this.hoverDevice="pointer",this.previousInputDevice="keyboard",this.focus={sortedSeries:[],series:void 0,seriesIndex:0,datumIndex:0,datum:void 0},this.cachedTooltipContent=void 0,this.hoverScheduler=o4(()=>{if(!(!this.tooltip.lastHover&&!this.highlight.pendingHoverEvent)){if(this.chart.getUpdateType()<=5){this.hoverScheduler.schedule();return}this.highlight.pendingHoverEvent&&this.handleHoverHighlight(!1),this.tooltip.lastHover&&this.handleHoverTooltip(this.tooltip.lastHover,!1)}}),this.tooltipCandidates=new _$;const t=e.ctx.localeManager.t("ariaInitSeriesArea"),i=e.ctx.domManager.addChild("series-area","series-area-aria-label1"),s=e.ctx.domManager.addChild("series-area","series-area-aria-label2");this.swapChain=new D$(i,s,"img",t),this.swapChain.addListener("blur",r=>this.onBlur(r)),this.swapChain.addListener("focus",()=>this.onFocus()),e.ctx.domManager.mode==="normal"&&(this.focusIndicator=new M$(this.swapChain),this.focusIndicator.overrideFocusVisible(e.mode==="integrated"?!1:void 0));const{seriesDragInterpreter:n,seriesWidget:o,containerWidget:a}=e.ctx.widgets;o.setTabIndex(-1),this.cleanup.register(()=>e.ctx.domManager.removeChild("series-area","series-area-aria-label1"),()=>e.ctx.domManager.removeChild("series-area","series-area-aria-label2"),o.addListener("focus",()=>this.swapChain.focus({preventScroll:!0})),o.addListener("mousemove",r=>this.onHover(r,o)),o.addListener("wheel",r=>this.onWheel(r)),o.addListener("mouseleave",r=>this.onLeave(r)),o.addListener("keydown",r=>this.onKeyDown(r)),o.addListener("contextmenu",(r,l)=>this.onContextMenu(r,l)),a.addListener("contextmenu",(r,l)=>this.onContextMenu(r,l)),a.addListener("click",(r,l)=>this.onClick(r,l)),a.addListener("dblclick",(r,l)=>this.onClick(r,l)),e.ctx.animationManager.addListener("animation-start",()=>this.clearAll()),e.ctx.eventsHub.on("dom:resize",()=>this.clearAll()),e.ctx.eventsHub.on("highlight:change",r=>this.changeHighlightDatum(r)),e.ctx.eventsHub.on("layout:complete",r=>this.layoutComplete(r)),e.ctx.updateService.addListener("pre-scene-render",()=>this.preSceneRender()),e.ctx.updateService.addListener("update-complete",()=>this.updateComplete()),e.ctx.eventsHub.on("zoom:change",()=>this.clearAll()),e.ctx.eventsHub.on("zoom:pan-start",()=>this.clearAll())),n&&this.cleanup.register(n.events.on("drag-move",r=>this.onDragMove(r,o)),n.events.on("click",r=>this.onClick(r,o)),n.events.on("dblclick",r=>this.onClick(r,o)))}get bbox(){return(this.seriesRect??de.zero).clone()}isState(e){return this.chart.ctx.interactionManager.isState(e)}isIgnoredTouch(e){return!(e.device!=="touch"||e.type==="click"||this.chart.ctx.chartService.touch.dragAction==="hover"||this.chart.ctx.chartService.touch.dragAction==="drag"&&this.isState(9))}dataChanged(){var e;this.cachedTooltipContent=void 0,this.highlight.appliedHoverEvent&&((e=this.highlight).stashedHoverEvent??(e.stashedHoverEvent=this.highlight.appliedHoverEvent),this.clearHighlight()),this.chart.ctx.tooltipManager.removeTooltip(this.id),this.focusIndicator?.clear()}preSceneRender(){this.highlight.stashedHoverEvent!=null&&(this.highlight.pendingHoverEvent=this.highlight.stashedHoverEvent,this.highlight.stashedHoverEvent=void 0,this.handleHoverHighlight(!0)),this.tooltip.lastHover!=null&&this.handleHoverTooltip(this.tooltip.lastHover,!0)}updateComplete(){this.isState(34)&&this.focusIndicator?.isFocusVisible()&&(this.announceMode!=="always"&&(this.announceMode="never"),this.handleFocus(0,0))}update(e,t){this.chart.ctx.updateService.update(e,t)}seriesChanged(e){this.focus.sortedSeries=[...e].sort((t,i)=>{let s=t.properties.focusPriority??1/0,n=i.properties.focusPriority??1/0;return s===n&&([s,n]=[t.declarationOrder,i.declarationOrder]),sn?1:0}),this.series=e}layoutComplete(e){this.seriesRect=e.series.rect,this.hoverRect=e.series.rect,this.chart.ctx.widgets.seriesWidget.setBounds(e.series.rect),this.chart.ctx.domManager.mode==="normal"&&this.chart.ctx.widgets.chartWidget.setBounds(e.chart)}onContextMenu(e,t){const{sourceEvent:i}=e;if(i.currentTarget!=t.getElement())return;if(i.target==this.chart.ctx.widgets.containerWidget.getElement()){if(this.isState(36)){const{currentX:c,currentY:h}=e;this.chart.ctx.contextMenuRegistry.dispatchContext("always",{widgetEvent:e,canvasX:c,canvasY:h},void 0)}return}let s,n;if(this.focusIndicator?.isFocusVisible())s=this.chart.ctx.highlightManager.getActiveHighlight(),s&&this.seriesRect&&s.midPoint&&(n=zt.toCanvasPoint(s.series.contentGroup,s.midPoint.x,s.midPoint.y));else if(this.isState(36)){const c=this.pickNodes({x:e.currentX,y:e.currentY},"context-menu");c&&(this.chart.ctx.highlightManager.updateHighlight(this.id),s=c.matches[0].datum)}const o=s?.series;this.clearAll();const a=e.currentX+t.cssLeft(),r=e.currentY+t.cssTop(),{datumIndex:l}=s??{};o&&s&&l!=null?this.chart.ctx.contextMenuRegistry.dispatchContext("series-node",{widgetEvent:e,canvasX:a,canvasY:r},{pickedSeries:o,pickedNode:{...s,datumIndex:l}},n):this.chart.ctx.contextMenuRegistry.dispatchContext("series-area",{widgetEvent:e,canvasX:a,canvasY:r},void 0,n)}onLeave(e){!this.isState(41)||e.sourceEvent.relatedTarget?.className==="ag-charts-text-input__textarea"||this.maybeEnterInteractiveTooltip(e.sourceEvent)||(this.chart.ctx.domManager.updateCursor(this.id),this.hoverDevice!=="keyboard"&&this.clearAll())}onWheel(e){this.isState(41)&&(this.focusIndicator?.overrideFocusVisible(!1),this.previousInputDevice="pointer")}onDragMove(e,t){this.isState(41)&&(this.focusIndicator?.overrideFocusVisible(!1),this.onHoverLikeEvent(e,t))}onHover(e,t){this.isState(41)&&this.onHoverLikeEvent(e,t)}onHoverLikeEvent(e,t){if(this.isIgnoredTouch(e)||(e.device==="touch"&&this.chart.ctx.chartService.touch.dragAction==="hover"&&e.sourceEvent.preventDefault(),t!==this.chart.ctx.widgets.seriesWidget))return;(e.device==="touch"||G$(e,"drag-move"))&&(this.tooltip.lastHover=e),this.hoverDevice="pointer",this.previousInputDevice="pointer",this.highlight.pendingHoverEvent=e,this.hoverScheduler.schedule();let i;if(this.isState(32)){const{currentX:n,currentY:o}=e;i=this.pickNodes({x:n,y:o},"event");const a=i?.matches,r=a?.[0];r?.series.hasEventListener("seriesNodeClick")||r?.series.hasEventListener("seriesNodeDoubleClick")||a!=null&&a.length>1&&this.chart.tooltip.pagination?this.chart.ctx.domManager.updateCursor(this.id,"pointer"):this.chart.ctx.domManager.updateCursor(this.id)}const s=!!i?.matches.length;this.emitSeriesAreaHoverEvent(e,s)}onClick(e,t){if(e.device==="keyboard"||(t===this.chart.ctx.widgets.seriesWidget&&this.chart.ctx.animationManager.isActive()&&this.chart.ctx.animationManager.skipCurrentBatch(),e.device==="touch"&&t===this.chart.ctx.widgets.seriesWidget&&this.swapChain.focus({preventScroll:!0}),!this.isState(41)))return;if(t===this.chart.ctx.widgets.seriesWidget){if(!t.getElement().contains(e.sourceEvent.target))return}else if(e.sourceEvent.target!=t.getElement())return;this.focusIndicator?.overrideFocusVisible(!1),this.onHoverLikeEvent(e,t);const i=t===this.chart.ctx.widgets.seriesWidget;if(!this.isState(32)){i&&this.emitSeriesAreaClickEvent(e,!1);return}if(i){if(!!this.checkSeriesNodeClick(e)){this.emitSeriesAreaClickEvent(e,!0),this.update(5),e.sourceEvent.preventDefault();return}this.emitSeriesAreaClickEvent(e,!1)}const s={type:e.type==="click"?"click":"doubleClick",event:e.sourceEvent};this.chart.fireEvent(s)}emitSeriesAreaHoverEvent(e,t){const i=this.toCanvasCoordinates(e.currentX,e.currentY);if(i==null)return;const s={x:i.x,y:i.y,consumed:t,sourceEvent:e.sourceEvent};this.chart.ctx.eventsHub.emit("series-area:hover",s)}emitSeriesAreaClickEvent(e,t){if(!("currentX"in e))return;const i=this.toCanvasCoordinates(e.currentX,e.currentY);if(i==null)return;const s={x:i.x,y:i.y,consumed:t,sourceEvent:e.sourceEvent};this.chart.ctx.eventsHub.emit("series-area:click",s)}toCanvasCoordinates(e,t){const i=this.hoverRect?.x??this.seriesRect?.x??0,s=this.hoverRect?.y??this.seriesRect?.y??0;return{x:e+i,y:t+s}}onFocus(){this.isState(34)&&(this.hoverDevice=this.focusIndicator?.isFocusVisible(!0)?"keyboard":"pointer",this.handleFocus(0,0))}onBlur(e){this.isState(34)&&(this.hoverDevice="pointer",this.maybeEnterInteractiveTooltip(e)||this.clearAll(),this.focusIndicator?.overrideFocusVisible(void 0))}onKeyDown(e){if(!this.isState(43))return;const t=A$(e.sourceEvent);switch(t?.activatesFocusIndicator===!1&&this.focusIndicator?.overrideFocusVisible(this.previousInputDevice==="keyboard"),t?.name){case"redo":return this.chart.ctx.eventsHub.emit("series:redo",null);case"undo":return this.chart.ctx.eventsHub.emit("series:undo",null);case"zoomin":return this.chart.ctx.eventsHub.emit("series:keynav-zoom",{delta:1,widgetEvent:e});case"zoomout":return this.chart.ctx.eventsHub.emit("series:keynav-zoom",{delta:-1,widgetEvent:e});case"arrowup":return this.onArrow(-1,0,e);case"arrowdown":return this.onArrow(1,0,e);case"arrowleft":return this.onArrow(0,-1,e);case"arrowright":return this.onArrow(0,1,e);case"submit":return this.onSubmit(e)}}onArrow(e,t,i){this.isState(34)&&(this.hoverDevice="keyboard",this.previousInputDevice="keyboard",this.focusIndicator?.overrideFocusVisible(!0),this.focus.seriesIndex+=e,this.focus.datumIndex+=t,this.handleFocus(e,t),i.sourceEvent.preventDefault(),this.chart.ctx.eventsHub.emit("series:focus-change",null))}onSubmit(e){if(!this.isState(34))return;const{series:t,datum:i}=this.focus,s=e.sourceEvent;t!=null&&i!=null?t.fireNodeClickEvent(s,i):this.chart.fireEvent({type:"click",event:s}),s.preventDefault()}checkSeriesNodeClick(e){var t;const i=this.pickNodes({x:e.currentX,y:e.currentY},"event");if(i==null||i.matches.length===0)return;const s=this.chart.tooltip.pagination?this.tooltipCandidates.update(i.matches,this.tooltipCandidates.current)?.current:void 0,{series:n,datum:o}=s??i.matches[0],a=s==null?i.distance:0;if(e.type==="click"){const l=n.fireNodeClickEvent(e.sourceEvent,o)&&this.chart.tooltip.pagination?this.tooltipCandidates.next():void 0;if(l!=null){e.sourceEvent.preventDefault();const{currentX:c,currentY:h}=e,d=c+(this.hoverRect?.x??0),u=h+(this.hoverRect?.y??0);(t=this.highlight).pendingHoverEvent??(t.pendingHoverEvent=this.highlight.appliedHoverEvent),this.handleHoverHighlight(!1),this.showTooltip(l.current,d,u,{index:l.index,length:l.length})}return!0}return e.type==="dblclick"?(e.preventZoomDblClick=a===0,n.fireNodeDoubleClickEvent(e.sourceEvent,o),!0):!1}handleFocus(e,t){const i=this.chart.overlays.getFocusInfo(this.chart.ctx.localeManager);i==null?this.handleSeriesFocus(e,t)===0?this.announceMode="when-changed":this.announceMode="always":(this.focusIndicator?.update(i.rect,this.seriesRect,!1),this.swapChain.update(i.text),this.announceMode="always")}handleSeriesFocus(e,t){if(this.chart.chartType==="standalone")return this.handleSoloSeriesFocus(e,t);const{focus:i}=this,s=i.sortedSeries.filter(l=>l.visible&&l.focusable);if(s.length===0)return 1;const n=i.datumIndex-t,o=i.seriesIndex-e;i.seriesIndex=ve(0,i.seriesIndex,s.length-1),i.series=s[i.seriesIndex];const a=this.focus.datumIndex,r=this.focus.seriesIndex;return this.updatePickedFocus(a,t,n,r,e,o)}handleSoloSeriesFocus(e,t){this.focus.series=this.focus.sortedSeries[0];const i=this.focus.datumIndex,s=this.focus.seriesIndex,n=this.focus.datumIndex-t,o=this.focus.seriesIndex-e;return this.updatePickedFocus(i,t,n,s,e,o)}updatePickedFocus(e,t,i,s,n,o){const{focus:a,hoverRect:r,seriesRect:l}=this;if(a.series==null||r==null)return 1;const c=a?.series?.pickFocus({datumIndex:e,datumIndexDelta:t,otherIndex:s,otherIndexDelta:n,seriesRect:l});if(!c)return 2;const{datum:h}=c;if(a.datum=h,a.datumIndex=c.datumIndex,c.otherIndex!=null&&(a.seriesIndex=c.otherIndex),this.focusIndicator?.isFocusVisible()){this.chart.ctx.animationManager.reset();const p=L$(c),{x:g,y:f}=p.computeCenter();if(!r.containsPoint(g,f)&&this.chart.ctx.zoomManager.panToBBox(this.id,r,p))return 3;const{x1:x,x2:m,y1:v,y2:b}=Gp.from(p),S=r.containsPoint(x,v),D=r.containsPoint(m,v),L=r.containsPoint(x,b),I=r.containsPoint(m,b);if(!(S||D||L||I)){const A=Gp.from(r);c.movedBounds=p.clone(),xA.x2&&m>A.x2&&(c.movedBounds.x=A.x2-2,c.movedBounds.width=4),vA.y2&&b>A.y2&&(c.movedBounds.y=A.y2-2,c.movedBounds.height=4)}}this.focusIndicator?.update(c.movedBounds??c.bounds,this.seriesRect,c.clipFocusBox);const d=this.getTooltipContent(a.series,h.datumIndex,h,"aria-label"),u=T$(a.series,r,c);if(u!=null&&this.hoverDevice==="keyboard"){this.tooltip.lastHover=void 0,this.highlight.appliedHoverEvent=void 0,this.highlight.pendingHoverEvent=void 0,this.highlight.stashedHoverEvent=void 0;const p=rm.makeTooltipMeta(u,a.series,h,c.movedBounds);this.chart.ctx.highlightManager.updateHighlight(this.id,h),this.isTooltipEnabled(a.series)&&this.chart.ctx.tooltipManager.updateTooltip(this.id,p,d)}return this.maybeAnnouncePickedFocus(t,i,n,o,c,d),0}maybeAnnouncePickedFocus(e,t,i,s,n,o){const{focus:a}=this;let r;this.announceMode==="when-changed"?e===0&&i===0||t!==n.datumIndex||s!==(n.otherIndex??a.seriesIndex)?r="always":r="never":r=this.announceMode,r==="always"&&this.swapChain.update(this.getDatumAriaText(n.datum,o))}getDatumAriaText(e,t){const i=t==null?"":NN(t);return this.chart.ctx.localeManager.t("ariaAnnounceHoverDatum",{datum:e.series.getDatumAriaText?.(e,i)??i})}clearHighlight(){this.highlight.pendingHoverEvent=void 0,this.highlight.appliedHoverEvent=void 0,this.chart.ctx.highlightManager.updateHighlight(this.id)}clearTooltip(){this.chart.ctx.tooltipManager.removeTooltip(this.id),this.tooltip.lastHover=void 0}clearAll(){this.clearHighlight(),this.clearTooltip(),this.focusIndicator?.clear()}handleHoverHighlight(e){this.highlight.appliedHoverEvent=this.highlight.pendingHoverEvent,this.highlight.pendingHoverEvent=void 0;const t=this.highlight.appliedHoverEvent;if(!t||!this.isState(41))return;const{currentX:i,currentY:s}=t,n=t.currentX+(this.hoverRect?.x??0),o=t.currentY+(this.hoverRect?.y??0);if(e?this.chart.ctx.animationManager.isActive():!this.hoverRect?.containsPoint(n,o)){this.clearHighlight();return}const{range:a}=this.chart.highlight,r=a==="tooltip"?"highlight-tooltip":"highlight",l=this.pickNodes({x:i,y:s},r);if(!l||l.matches.length===0){this.chart.ctx.highlightManager.updateHighlight(this.id);return}const{current:c}=this.tooltipCandidates,d=(c==null?void 0:l.matches.find(u=>EM(u,c)))?.datum??l.matches[0].datum;this.chart.ctx.highlightManager.updateHighlight(this.id,d),this.hoverDevice="pointer"}handleHoverTooltip(e,t){const{current:i}=this.tooltipCandidates;if(this.tooltipCandidates.reset(),!this.isState(41))return;const{currentX:s,currentY:n}=e,o=s+(this.hoverRect?.x??0),a=n+(this.hoverRect?.y??0),r=e.sourceEvent.target;if(t?this.chart.ctx.animationManager.isActive():!this.hoverRect?.containsPoint(o,a)){this.hoverDevice=="pointer"&&this.clearTooltip();return}if(r&&this.chart.tooltip.interactive&&this.chart.ctx.domManager.isManagedChildDOMElement(r,"canvas-overlay",Qi))return;const l=this.pickNodes({x:e.currentX,y:e.currentY},"tooltip");if(!l||l.matches.length===0){this.hoverDevice=="pointer"&&this.clearTooltip();return}if(this.hoverDevice="pointer",l.distance===0){const{current:c,index:h,length:d}=this.tooltipCandidates.update(l.matches,this.chart.tooltip.pagination?i:void 0);this.showTooltip(c,o,a,{index:h,length:d})}else this.showTooltip(l.matches[0],o,a)}showTooltip({series:e,datum:t,datumIndex:i},s,n,o){const a=this.getTooltipContent(e,i,t,"tooltip");if(a!=null){const l=rm.makeTooltipMeta({type:"pointermove",canvasX:s,canvasY:n},e,t,void 0);this.chart.ctx.tooltipManager.updateTooltip(this.id,l,a,o)}else this.chart.ctx.tooltipManager.removeTooltip(this.id)}maybeEnterInteractiveTooltip(e){return this.chart.tooltip.maybeEnterInteractiveTooltip(e,()=>{this.tooltip.lastHover=void 0,this.chart.ctx.tooltipManager.removeTooltip(this.id),this.chart.ctx.highlightManager.updateHighlight(this.id)})}changeHighlightDatum(e){const t=e.previousHighlight?.series,i=e.currentHighlight?.series;t?.properties.cursor&&e.previousHighlight?.datum&&this.chart.ctx.domManager.updateCursor(t.id),i?.properties.cursor&&i.properties.cursor!=="default"&&e.currentHighlight?.datum&&this.chart.ctx.domManager.updateCursor(i.id,i.properties.cursor),i==null||t==null?this.update(5,{clearCallbackCache:!0}):this.update(5,{seriesToUpdate:new Set([t,i].filter(Boolean)),clearCallbackCache:!0})}pickNodes(e,t,i){const s=[...this.series].reverse();let n;for(const o of s){if(!o.visible||!o.contentGroup.visible)continue;const a=o.pickNodes(e,t,i);if(a==null||a.datums.length===0)continue;const{datums:r,distance:l}=a;if(a.datums.length!==0){if(l===0){n?.distance!==0&&(n={matches:[],distance:0});for(const c of r){const{datumIndex:h}=c;n.matches.push({series:o,datum:c,datumIndex:h})}}else if(n==null||n.distance>l){const[c]=r,{datumIndex:h}=c;n={matches:[{series:o,datum:c,datumIndex:h}],distance:l}}}}return n}isTooltipEnabled(e){return e.tooltipEnabled??this.chart.tooltip.enabled}getTooltipContent(e,t,i,s){let n;if(s==="aria-label"||this.isTooltipEnabled(e)){const{cachedTooltipContent:o}=this;if(o!=null&&o.series===e&&o.datumIndex===t)n=o.content;else{const a=this.chart.getTooltipContent(e,t,i,s);this.cachedTooltipContent={series:e,datumIndex:t,content:a},n=a}}else this.cachedTooltipContent=void 0;return n}};function G$(e,t){return e.type!==t}var zN=30,j$=class{constructor(e){this.seriesRoot=e,this.groups=new Map,this.series=new Map,this.expectedSeriesCount=1,this.mode="normal"}setSeriesCount(e){this.expectedSeriesCount=e}getGroupIndex(e){const{internalId:t,seriesGrouping:i}=e;return i?.groupIndex??t}getGroupType(e,t){return t?"top":e.type}requestGroup(e){const{internalId:t,contentGroup:i}=e,s=e.bringToFront(),n=this.getGroupType(e,s),o=this.getGroupIndex(e),a=this.series.get(t);if(a!=null)throw new Error(`AG Charts - series already has an allocated layer: ${JSON.stringify(a)}`);this.series.size===0&&(this.mode=this.expectedSeriesCount>=zN?"aggressive-grouping":"normal");let r=this.groups.get(n);r==null&&(r=new Map,this.groups.set(n,r));const l=this.lookupIdx(o);let c=r.get(l);return c==null&&(c={type:n,id:l,seriesIds:[],group:this.seriesRoot.appendChild(new Be({name:`${e.contentGroup.name??n}-managed-layer`,zIndex:e.contentGroup.zIndex,renderToOffscreenCanvas:!1}))},r.set(l,c)),this.series.set(t,{layerState:c,seriesConfig:e,bringToFront:s}),c.seriesIds.push(t),c.group.appendChild(i),c.group}changeGroup(e){const{internalId:t,contentGroup:i}=e,s=e.bringToFront(),n=this.getGroupType(e,s),o=this.series.get(t),a=o?this.getGroupType(o.seriesConfig,o.bringToFront):void 0,r=this.getGroupIndex(e),l=this.lookupIdx(r),c=this.groups.get(n)?.get(l);if(!(a===n&&c?.seriesIds.includes(t)===!0))return this.series.has(t)&&this._releaseGroup({internalId:t,contentGroup:i,type:a}),this.requestGroup(e)}releaseGroup(e){const{internalId:t,contentGroup:i}=e,s=this.getGroupType(e,e.bringToFront());this._releaseGroup({internalId:t,contentGroup:i,type:s})}_releaseGroup(e){const{internalId:t,contentGroup:i,type:s}=e;if(!this.series.has(t))throw new Error(`AG Charts - series doesn't have an allocated layer: ${t}`);const n=this.series.get(t)?.layerState;n&&(n.seriesIds=n.seriesIds.filter(o=>o!==t),i.remove()),n?.seriesIds.length===0?(n.group.remove(),this.groups.get(n.type)?.delete(n.id),this.groups.get(s)?.delete(t)):n!=null&&n.seriesIds.length>0&&(n.group.zIndex=this.getLowestSeriesZIndex(n.seriesIds)),this.series.delete(t)}updateLayerCompositing(){for(const e of this.groups.values())for(const t of e.values()){const{group:i,seriesIds:s}=t;let n;s.length===0?n=!1:s.length>1?n=!0:n=this.series.get(s[0])?.seriesConfig.renderToOffscreenCanvas()===!0,i.renderToOffscreenCanvas=n,i.zIndex=this.getLowestSeriesZIndex(s)}}lookupIdx(e){return this.mode==="normal"?e:typeof e=="string"&&(e=Number(e.split("-").at(-1)),!Number.isFinite(e))?0:Math.floor(ve(0,e/this.expectedSeriesCount,1)*zN)}destroy(){for(const e of this.groups.values())for(const t of e.values())t.group.remove();this.groups.clear(),this.series.clear()}getLowestSeriesZIndex(e){let t;for(const i of e){const n=this.series.get(i)?.seriesConfig.contentGroup.zIndex??1;if(t==null||n==null){t=n;continue}t=TL(t,n)<=0?t:n}return t??1}},FN=class extends Le{constructor(){super(...arguments),this.dragAction="drag"}};M([C],FN.prototype,"dragAction",2);var H$=class{constructor(e,t,i,s,n,o){this.chart=e,this.eventsHub=t,this.dataService=i,this.updateService=s,this.zoomManager=n,this.animationManager=o,this.dirtyZoom=!1,this.dirtyDataSource=!1,this.lastAxisZooms=new Map,this.cleanup=new St,this.cleanup.register(this.eventsHub.on("data:source-change",()=>this.onDataSourceChange()),this.eventsHub.on("data:load",()=>this.onDataLoad()),this.eventsHub.on("data:error",()=>this.onDataError()),this.updateService.addListener("update-complete",a=>this.onUpdateComplete(a)),this.eventsHub.on("zoom:change",()=>this.onZoomChange()))}destroy(){this.cleanup.flush()}onDataLoad(){this.animationManager.skip(),this.updateService.update(1)}onDataError(){this.updateService.update(4)}onDataSourceChange(){this.dirtyDataSource=!0}onUpdateComplete(e){!e.apiUpdate&&!this.dirtyZoom&&!this.dirtyDataSource||this.updateWindow(e)}onZoomChange(){this.dirtyZoom=!0}updateWindow(e){if(!this.dataService.isLazy())return;const t=this.getValidAxis();let i,s=!0;if(t){const n=this.zoomManager.getAxisZoom(t.id);(n.min!==0||n.max!==1)&&(i=this.getAxisWindow(t,n)),s=this.shouldRefresh(e,t,n)}this.dirtyZoom=!1,this.dirtyDataSource=!1,s&&this.dataService.load({windowStart:i?.min,windowEnd:i?.max})}getValidAxis(){return this.chart.axes.find(e=>e.type==="time")}shouldRefresh(e,t,i){if(e.apiUpdate||this.dirtyDataSource)return!0;if(!this.dirtyZoom)return!1;const s=this.lastAxisZooms.get(t.id);return s&&i.min===s.min&&i.max===s.max?!1:(this.lastAxisZooms.set(t.id,i),!0)}getAxisWindow(e,t){const{domain:i}=e.scale;if(!t||i.length===0||Number.isNaN(Number(i[0])))return;const s=Number(i[1])-Number(i[0]),n=new Date(Number(i[0])+s*t.min),o=new Date(Number(i[0])+s*t.max);return{min:n,max:o}}},W$=/^((?!chrome|android).)*safari/i,$$=/Version\/(\d+(\.\d+)?)/,U$=/Chrome/,K$=/Chrome\/(\d+)/,Y$=/Edg/,Z$=/OPR/;function X$(){const{userAgent:e}=qe("navigator");if(W$.test(e)){const t=$$.exec(e);if(t==null)return!1;const i=Number.parseFloat(t[1]),s=Math.floor(i)>16;return s||K.warnOnce(`Unsupported Safari version: ${i}; ${e}`),!s}else if(U$.test(e)&&!Y$.test(e)&&!Z$.test(e)){const t=K$.exec(e);if(t==null)return!1;const i=Number.parseInt(t[1],10),s=i>126;return s||K.warnOnce(`Unsupported Chrome version: ${i}; ${e}`),!s}return!1}var q$=new Set(["map-shape-background","map-line-background"]),Q$=class{constructor(e,t,i,s,n,o,a){this.chartLike=e,this.overlays=t,this.eventsHub=i,this.dataService=s,this.localeManager=n,this.animationManager=o,this.domManager=a,this.cleanup=new St,this.overlayElem=this.domManager.addChild("canvas-overlay","overlay"),this.overlayElem.role="status",this.overlayElem.ariaAtomic="false",this.overlayElem.ariaLive="polite",this.overlayElem.classList.toggle(TM),this.cleanup.register(this.eventsHub.on("layout:complete",r=>this.onLayoutComplete(r)))}destroy(){this.cleanup.flush(),this.domManager.removeChild("canvas-overlay","overlay")}onLayoutComplete({series:{rect:e}}){const t=this.dataService.isLoading(),i=this.chartLike.series.some(c=>c.hasData),s=this.chartLike.series.some(c=>c.visible&&!q$.has(c.type));this.overlays.darkTheme?this.overlayElem.classList.add(mN):this.overlayElem.classList.remove(mN),this.overlayElem.style.left=`${e.x}px`,this.overlayElem.style.top=`${e.y}px`,this.overlayElem.style.width=`${e.width}px`,this.overlayElem.style.height=`${e.height}px`;const n=t,o=!t&&!i,a=i&&!s,r=this.overlays.unsupportedBrowser.enabled&&X$();n?this.showOverlay(this.overlays.loading,e):this.hideOverlay(this.overlays.loading),o?this.showOverlay(this.overlays.noData,e):this.hideOverlay(this.overlays.noData),a?this.showOverlay(this.overlays.noVisibleSeries,e):this.hideOverlay(this.overlays.noVisibleSeries),r?this.showOverlay(this.overlays.unsupportedBrowser,e):this.hideOverlay(this.overlays.unsupportedBrowser);const l=n||o||a||r;Ge(this.overlayElem,"aria-hidden",!l)}showOverlay(e,t){if(!e.enabled)return;const i=e.getElement(this.chartLike,this.animationManager,this.localeManager,t);this.overlayElem.appendChild(i)}hideOverlay(e){e.removeElement(()=>{this.overlayElem.innerText="\xA0"},this.animationManager)}},fo=Pe.create(!0,"opts"),Vt=class NV extends nT{constructor(t,i){var s;super(),this.id=hs(this),this.seriesRoot=new us({name:`${this.id}-series-root`,zIndex:7}),this.annotationRoot=new us({name:`${this.id}-annotation-root`,zIndex:11}),this.titleGroup=new Be({name:"titles",zIndex:15}),this.debug=Pe.create(),this.extraDebugStats={},this.data=Nd.empty(),this._firstAutoSize=!0,this._autoSizeNotify=new HS,this.chartCaptions=new Zy,this.padding=new Oc(20),this.keyboard=new tM,this.touch=new FN,this.mode="standalone",this.styleNonce=void 0,this.formatter=void 0,this.suppressFieldDotNotation=!1,this.loadGoogleFonts=!1,this.destroyed=!1,this.cleanup=new St,this.chartAnimationPhase="initial",this.modulesManager=new x$,this.processors=[],this.queuedUserOptions=[],this.queuedChartOptions=[],this.firstApply=!0,this.syncStatus="init",this.fireEventWrapper=h=>super.fireEvent(h),this.apiUpdate=!1,this._pendingFactoryUpdatesCount=0,this._performUpdateSkipAnimations=!1,this._performUpdateNotify=new HS,this.performUpdateType=8,this.runningUpdateType=8,this.updateShortcutCount=0,this.seriesToUpdate=new Set,this.updateMutex=new s4,this.clearCallbackCacheOnUpdate=!1,this.updateRequestors={},this.performUpdateTrigger=a4(({count:h})=>{this.destroyed||this.updateMutex.acquire(async()=>{try{await this.performUpdate(h)}catch(d){K.error("update error",d,d.stack)}}).catch(d=>K.errorOnce(d))}),this._performUpdateSplits={},this._previousSplit=0,this.axes=[],this.series=[],this._cachedData=void 0,this.onSeriesNodeClick=h=>{this.fireEvent(h)},this.onSeriesNodeDoubleClick=h=>{this.fireEvent(h)},this.onSeriesVisibilityChange=h=>{this.fireEvent(h)},this.seriesGroupingChanged=h=>{if(!(h instanceof Im))return;const{series:d,seriesGrouping:u}=h;if(d.contentGroup.isRoot())return;const p=this.seriesLayerManager.changeGroup({internalId:d.internalId,type:d.type,contentGroup:d.contentGroup,bringToFront:()=>d.bringToFront(),renderToOffscreenCanvas:()=>d.renderToOffscreenCanvas(),seriesGrouping:u});p!=null&&d.attachSeries(p,this.seriesRoot,this.annotationRoot)},this.chartOptions=t;const n=i?.scene,o=i?.container??t.processedOptions.container??void 0,a=i?.styleContainer??t.specialOverrides.styleContainer;n&&(this._firstAutoSize=!1,this._lastAutoSize=[n.width,n.height,n.pixelRatio]);const r=new Be({name:"root"});r.visible=!1,r.append(this.seriesRoot),r.append(this.annotationRoot),r.append(this.titleGroup),this.titleGroup.append(this.title.node),this.titleGroup.append(this.subtitle.node),this.titleGroup.append(this.footnote.node),this.tooltip=new go,this.seriesLayerManager=new j$(this.seriesRoot),this.mode=t.userOptions.mode??this.mode,this.styleNonce=t.processedOptions.styleNonce;const l=this.ctx=new oW(this,{chartType:this.getChartType(),scene:n,root:r,container:o,styleContainer:a,domMode:t.optionMetadata.domMode,withDragInterpretation:t.optionMetadata.withDragInterpretation??!0,syncManager:new OW(this),fireEvent:h=>this.fireEvent(h),updateCallback:(h,d)=>this.update(h,d),updateMutex:this.updateMutex});this.cleanup.register(l.eventsHub.on("dom:resize",()=>this.parentResize(l.domManager.containerSize))),this.overlays=new Vd,(s=this.overlays.loading).renderer??(s.renderer=()=>b$(this.overlays.loading.getText(l.localeManager),l.animationManager.defaultDuration)),this.processors=[new H$(this,l.eventsHub,l.dataService,l.updateService,l.zoomManager,l.animationManager),new Q$(this,this.overlays,l.eventsHub,l.dataService,l.localeManager,l.animationManager,l.domManager)],this.highlight=new W0,this.container=o;const c=this.getModuleContext();l.domManager.setDataBoolean("animating",!1),l.domManager.setDataNumber("animationTimeMs",0),this.seriesAreaManager=new V$(this.initSeriesAreaDependencies()),this.cleanup.register(l.layoutManager.registerElement(0,h=>{h.layoutBox.shrink(this.padding.toJson()),this.chartCaptions.positionCaptions(h)}),l.eventsHub.on("layout:complete",h=>this.chartCaptions.positionAbsoluteCaptions(h)),l.eventsHub.on("data:load",h=>{this.data=new Nd(h.data)}),this.title.registerInteraction(c,"beforebegin"),this.subtitle.registerInteraction(c,"beforebegin"),this.footnote.registerInteraction(c,"afterend"),Na.addWindowEvent("page-left",()=>this.destroy()),l.animationManager.addListener("animation-frame",()=>{this.update(7),l.domManager.setDataNumber("animationTimeMs",l.animationManager.getCumulativeAnimationTime())}),l.animationManager.addListener("animation-start",()=>l.domManager.setDataBoolean("animating",!0)),l.animationManager.addListener("animation-stop",()=>{l.domManager.setDataBoolean("animating",!1),l.domManager.setDataNumber("animationTimeMs",l.animationManager.getCumulativeAnimationTime())}),l.eventsHub.on("zoom:change",()=>{for(const d of this.series)d.animationState?.transition("updateData");const h=this.chartAnimationPhase!=="initial";this.update(4,{forceNodeDataRefresh:!0,skipAnimations:h})})),this.parentResize(l.domManager.containerSize)}static getInstance(t){return NV.chartsInstances.get(t)}get canvasElement(){return this.ctx.scene.canvas.element}download(t,i){this.ctx.scene.download(t,i)}getCanvasDataURL(t){return this.ctx.scene.getDataURL(t)}toSVG(){return this.ctx.scene.toSVG()}get seriesAreaBoundingBox(){return this.seriesAreaManager.bbox}getOptions(){return this.queuedUserOptions.at(-1)??this.chartOptions.userOptions}getChartOptions(){return this.queuedChartOptions.at(-1)??this.chartOptions}overrideFocusVisible(t){this.seriesAreaManager.focusIndicator?.overrideFocusVisible(t)}fireEvent(t){Uo(this,this.fireEventWrapper,t)}initSeriesAreaDependencies(){const{ctx:t,tooltip:i,highlight:s,overlays:n,seriesRoot:o,mode:a}=this,r=this.getChartType();return{fireEvent:this.fireEvent.bind(this),getUpdateType:()=>this.performUpdateType,getTooltipContent:(d,u,p,g)=>this.getTooltipContent(d,u,p,g),chartType:r,ctx:t,tooltip:i,highlight:s,overlays:n,seriesRoot:o,mode:a}}getModuleContext(){return this.ctx}getTooltipContent(t,i,s,n){const a=n==="aria-label"||t.properties.tooltip.enabled!==!1?t.getTooltipContent(i,s):void 0,r=a==null?[]:[a];if(this.tooltip.mode!=="shared"||this.series.length===1)return r;const l=t.getCategoryValue(i);return l==null?r:this.series.flatMap(c=>{if(c===t)return r;if(!c.isEnabled()||c.properties.tooltip.enabled===!1)return[];const h=c.datumIndexForCategoryValue(l),d=h==null?void 0:c.getTooltipContent(h,void 0);return d==null?[]:[d]})}getCaptionText(){return[this.title,this.subtitle,this.footnote].filter(t=>t.enabled&&t.text).map(t=>t.text).join(". ")}getAriaLabel(){return this.ctx.localeManager.t("ariaAnnounceChart",{seriesCount:this.series.length})}resetAnimations(){this.chartAnimationPhase="initial";for(const t of this.series)t.resetAnimation(this.chartAnimationPhase);for(const t of this.axes)t.resetAnimation(this.chartAnimationPhase);this.animationRect=void 0,this.ctx.animationManager.reset()}skipAnimations(){this.ctx.animationManager.skipCurrentBatch(),this._performUpdateSkipAnimations=!0}detachAndClear(){this.container=void 0,this.ctx.scene.clearCanvas()}destroy(t){if(this.destroyed)return;const i=t?.keepTransferableResources;let s;this.performUpdateType=8,this.cleanup.flush();for(const n of this.processors)n.destroy();this.overlays.destroy(),this.modulesManager.destroy(),i?(this.ctx.scene.strip(),s={container:this.container,scene:this.ctx.scene}):(this.ctx.scene.destroy(),this.container=void 0),this.destroySeries(this.series),this.seriesLayerManager.destroy();for(const n of this.axes)n.destroy();return this.axes=[],this.animationRect=void 0,this.ctx.destroy(),this.destroyed=!0,Object.freeze(this),s}requestFactoryUpdate(t){this.destroyed||(this._pendingFactoryUpdatesCount++,this.updateMutex.acquire(async()=>{if(!this.destroyed)try{await t(this)}finally{this.destroyed||this._pendingFactoryUpdatesCount--}}).catch(i=>K.errorOnce(i)))}clearCallbackCache(){this.ctx.callbackCache.invalidateCache();for(const t of this.series)t.resetDatumCallbackCache()}update(t=0,i){if(this.destroyed)return;const{forceNodeDataRefresh:s=!1,skipAnimations:n,seriesToUpdate:o=this.series,newAnimationBatch:a,apiUpdate:r=!1,clearCallbackCache:l=!1}=i??{};if(this.apiUpdate=r,this.ctx.widgets.seriesWidget.setDragTouchEnabled(this.touch.dragAction!=="none"),s)for(const c of this.series)c.markNodeDataDirty();for(const c of o)this.seriesToUpdate.add(c);if(n&&(this.ctx.animationManager.skipCurrentBatch(),this._performUpdateSkipAnimations=!0),a&&this.ctx.animationManager.isActive()&&(this._performUpdateSkipAnimations=!0),(t===0||l)&&(this.clearCallbackCacheOnUpdate=!0),this.debug.check()){let c=new Error("Stack trace for update tracking").stack??"";c=c.replaceAll(/\([^)]*/g,""),this.updateRequestors[c]=t}tthis.chartAnimationPhase="ready")),this.ctx.scene.updateDebugFlags(),this.debug("Chart.performUpdate() - start",Ep[i]),this._previousSplit=performance.now(),n.start??(n.start=this._previousSplit),i){case 0:if(this.checkUpdateShortcut(0))break;this.ctx.updateService.dispatchPreDomUpdate(),this.updateDOM();case 1:if(this.checkUpdateShortcut(1))break;await this.updateData(),this.updateSplits("\u2B07\uFE0F");case 2:if(this.checkUpdateShortcut(2))break;await this.processData(),this.seriesAreaManager.dataChanged(),this.updateSplits("\u{1F4CA}");case 3:if(this.checkUpdateShortcut(3))break;await this.processDomains(),this.updateSplits("\u26F0\uFE0F");case 4:if(await this.checkFirstAutoSize(),this.checkUpdateShortcut(4))break;await this.processLayout(),this.updateSplits("\u2316");case 5:{if(this.checkUpdateShortcut(5))break;this.seriesRoot.renderToOffscreenCanvas=this.highlight.drawingMode==="cutout",await this.updateSeries(a),this.updateAriaLabels(),this.seriesLayerManager.updateLayerCompositing(),this.updateSplits("\u{1F914}")}case 6:if(this.checkUpdateShortcut(6))break;o.updateService.dispatchPreSceneRender(),this.updateSplits("\u2196");case 7:if(this.checkUpdateShortcut(7))break;o.animationManager.endBatch(),s.updateShortcutCount=this.updateShortcutCount,o.scene.render({debugSplitTimes:n,extraDebugStats:s,seriesRect:this.seriesRect}),this.extraDebugStats={};for(const l of Object.keys(n))delete n[l];this.ctx.domManager.incrementDataCounter("sceneRenders"),this.ctx.domManager.postRenderUpdate();case 8:this.updateShortcutCount=0,this.updateRequestors={},this._performUpdateSkipAnimations=!1,o.animationManager.endBatch()}this.destroyed||(o.updateService.dispatchUpdateComplete(this.apiUpdate),this.apiUpdate=!1,this.ctx.domManager.setDataBoolean("updatePending",!1),this.runningUpdateType=8,this.syncStatus="ready"),this._performUpdateNotify.notify();const r=performance.now();this.debug("Chart.performUpdate() - end",{chart:this,durationMs:Math.round((r-n.start)*100)/100,count:t,performUpdateType:Ep[i]})}updateThemeClassName(){const t="ag-charts-theme-",i=[`${t}default`,`${t}default-dark`];let s=i[0],n=!1,{theme:o}=this.chartOptions.processedOptions;for(;typeof o!="string"&&o!=null;)o=o.baseTheme;typeof o=="string"&&(s=o.replace("ag-",t),n=o.includes("-dark")),i.includes(s)||(s=n?i[1]:i[0]),this.ctx.domManager.setThemeClass(s)}updateDOM(){this.updateThemeClassName();const{enabled:t,tabIndex:i}=this.keyboard;this.ctx.domManager.setTabGuardIndex(t?i??0:-1),this.ctx.domManager.setThemeParameters(this.chartOptions.themeParameters)}updateAriaLabels(){this.ctx.domManager.updateCanvasLabel(this.getAriaLabel())}checkUpdateShortcut(t){return this.destroyed?!0:this.updateShortcutCount>3?(K.warn("exceeded the maximum number of simultaneous updates (4), discarding changes and rendering",this.updateRequestors),!1):this.performUpdateType<=t?(this.updateShortcutCount++,!0):!1}async checkFirstAutoSize(){this.width!=null&&this.height!=null||this._lastAutoSize||await this._autoSizeNotify.await(500)||this.debug("Chart.checkFirstAutoSize() - timeout for first size update.")}onAxisChange(t,i){i==null&&t.length===0||this.ctx.axisManager.updateAxes(i??[],t)}onSeriesChange(t,i){const s=i?.filter(n=>!t.includes(n))??[];this.destroySeries(s),this.seriesLayerManager?.setSeriesCount(t.length);for(const n of t){if(i?.includes(n))continue;const o=this.seriesLayerManager.requestGroup(n);n.attachSeries(o,this.seriesRoot,this.annotationRoot),n.chart={},Object.defineProperty(n.chart,"mode",{get:()=>this.mode}),Object.defineProperty(n.chart,"isMiniChart",{get:()=>!1}),Object.defineProperty(n.chart,"seriesRect",{get:()=>this.seriesRect}),n.resetAnimation(this.chartAnimationPhase),this.addSeriesListeners(n),n.addChartEventListeners()}this.seriesAreaManager?.seriesChanged(t)}destroySeries(t){if(t)for(const i of t)i.removeEventListener("seriesNodeClick",this.onSeriesNodeClick),i.removeEventListener("seriesNodeDoubleClick",this.onSeriesNodeDoubleClick),i.removeEventListener("groupingChanged",this.seriesGroupingChanged),i.destroy(),this.seriesLayerManager.releaseGroup(i),i.detachSeries(void 0,this.seriesRoot,this.annotationRoot),i.chart=void 0}addSeriesListeners(t){this.hasEventListener("seriesNodeClick")&&t.addEventListener("seriesNodeClick",this.onSeriesNodeClick),this.hasEventListener("seriesNodeDoubleClick")&&t.addEventListener("seriesNodeDoubleClick",this.onSeriesNodeDoubleClick),this.hasEventListener("seriesVisibilityChange")&&t.addEventListener("seriesVisibilityChange",this.onSeriesVisibilityChange),t.addEventListener("groupingChanged",this.seriesGroupingChanged)}assignSeriesToAxes(){for(const t of this.axes)t.boundSeries=this.series.filter(i=>i.axes[t.direction]===t)}assignAxesToSeries(){const t=jS(this.axes,i=>i.direction);for(const i of this.series)for(const s of i.directions){const n=t[s];if(!n){K.warnOnce(`no available axis for direction [${s}]; check series and axes configuration.`);return}const o=i.getKeys(s),a=n.find(r=>!r.keys.length||o.some(l=>r.keys.includes(l)));if(!a){K.warnOnce(`no matching axis for direction [${s}] and keys [${o}]; check series and axes configuration.`);return}i.axes[s]=a}}parentResize(t){if(t==null||this.width!=null&&this.height!=null)return;let{width:i,height:s}=t;const{pixelRatio:n}=t;if(i=Math.floor(i),s=Math.floor(s),i===0&&s===0)return;const[o=0,a=0,r=1]=this._lastAutoSize??[];o===i&&a===s&&r===n||(this._lastAutoSize=[i,s,n],this.resize("SizeMonitor",{}))}resize(t,i){const{scene:s,animationManager:n}=this.ctx,{inWidth:o,inHeight:a,inMinWidth:r,inMinHeight:l,inOverrideDevicePixelRatio:c}=i;this.ctx.domManager.setSizeOptions(r??this.minWidth,l??this.minHeight,o??this.width,a??this.height);const h=o??this.width??this._lastAutoSize?.[0],d=a??this.height??this._lastAutoSize?.[1],u=c??this.overrideDevicePixelRatio??this._lastAutoSize?.[2];if(this.debug(`Chart.resize() from ${t}`,{width:h,height:d,pixelRatio:u,stack:new Error("Stack trace for resize tracking").stack}),!(h==null||d==null||!Ye(h)||!Ye(d))&&s.resize(h,d,u)){n.reset();let p=!0;(this.width==null||this.height==null)&&this._firstAutoSize&&(p=!1,this._firstAutoSize=!1),this.update(4,{forceNodeDataRefresh:!0,skipAnimations:p}),this._autoSizeNotify.notify()}}async updateData(){for(const i of this.series)i.setChartData(this.data);const t=this.modulesManager.mapModules(i=>i.updateData?.(this.data));await Promise.all(t.filter(i=>i!=null&&typeof i=="object"))}async processData(){this.series.some(n=>n.canHaveAxes)&&(this.assignAxesToSeries(),this.assignSeriesToAxes());const t=new Iw(this.mode,this.suppressFieldDotNotation),i=this.series.map(n=>n.processData(t)),s=this.modulesManager.mapModules(n=>n.processData?.(t));this._cachedData=t.execute(this._cachedData),this.updateSplits("\u{1F3ED}"),await Promise.all([...i,...s.filter(n=>n!=null)]),this.updateLegends()}async processDomains(){for(const t of this.axes)t.processData();for(const t of this.series)t.updatedDomains()}updateLegends(t){for(const{legend:i,legendType:s}of this.modulesManager.legends())s==="category"?this.setCategoryLegendData(t):this.setLegendData(s,i)}setCategoryLegendData(t){const{ctx:{legendManager:i,stateManager:s}}=this;if(t)for(const o of this.series){const a=t.find(r=>r.seriesId===o.id);o.onLegendInitialState("category",a)}const n=this.series.flatMap(o=>{const a=o.getLegendData("category");return i.updateData(o.id,a),a});if(t){s.setStateAndRestore(i,t);return}if(this.mode!=="integrated"){const o={},a=new Map(this.series.map(r=>[r.id,r.type]));for(const{seriesId:r,symbol:{marker:l},label:c}of n.filter(h=>!h.hideInLegend)){if(l.fill==null)continue;const h=a.get(r),d=o[h]??(o[h]=new Map);d.has(c.text)?d.get(c.text)!==l.fill&&K.warnOnce(`legend item '${$e(c.text)}' has multiple fill colors, this may cause unexpected behaviour.`):d.set(c.text,l.fill)}}i.update()}setLegendData(t,i){i.data=this.series.filter(s=>s.properties.showInLegend).flatMap(s=>s.getLegendData(t))}async processLayout(){const t=this.animationRect,{width:i,height:s}=this.ctx.scene,n=this.ctx.layoutManager.createContext(i,s);await this.performLayout(n),t&&!this.animationRect?.equals(t)&&this.ctx.animationManager.skipCurrentBatch(),this.debug("Chart.performUpdate() - seriesRect",this.seriesRect)}async updateSeries(t){const{seriesRect:i}=this;await Promise.all(t.map(s=>s.update({seriesRect:i})).filter(s=>s!=null)),this.ctx.seriesLabelLayoutManager.updateLabels(this.series.filter(s=>s.visible&&s.usesPlacedLabels),this.padding,this.seriesRect)}async waitForUpdate(t,i){const s=qe("agChartsDebugTimeout");s==null?(t??(t=1e4),i??(i=!1)):(t=s,i??(i=!0));const n=performance.now();for(;(this._pendingFactoryUpdatesCount>0||this.performUpdateType!==8||this.runningUpdateType!==8||this.ctx.scene.waitingForUpdate()||this.data.hasPendingTransactions())&&!this.destroyed;){if(this._pendingFactoryUpdatesCount>0&&await this.updateMutex.waitForClearAcquireQueue(),(this.performUpdateType!==8||this.runningUpdateType!==8||this.data.hasPendingTransactions())&&await this._performUpdateNotify.await(),performance.now()-n>t){const o=`Chart.waitForUpdate() timeout of ${t} reached - first chart update taking too long.`;if(i)throw new Error(o);K.warnOnce(o)}iT()&&await oL(),this.ctx.scene.waitingForUpdate()&&await oL(50)}}filterMiniChartSeries(t){return t?.filter(i=>i.showInMiniChart!==!1)}applyOptions(t){const s=this.firstApply?t.processedOptions:t.diffOptions(this.chartOptions);if(s==null||Object.keys(s).length===0){fo("Chart.applyOptions() - no delta, forcing re-layout",s),this.update(4,{apiUpdate:!0,newAnimationBatch:!0});return}const n=this.firstApply?{}:this.chartOptions.processedOptions,o=t.processedOptions;fo("Chart.applyOptions() - applying delta",s);const a=this.applyModules(o),r=["type","data","series","listeners","preset","theme","legend.listeners","navigator.miniChart.series","navigator.miniChart.label","locale.localeText","axes","topology","nodes","initialState","styleContainer","formatter"];s.listeners&&this.registerListeners(this,s.listeners),Lp(this,s,{skip:r});let l=!1,c="no-op";s.series!=null&&(c=this.applySeries(this,s.series,n?.series),l=!0),c==="replaced"&&this.resetAnimations(),this.applyAxes(this,o,n,c,[])&&(l=!0),s.data&&(this.data=new Nd(s.data)),s.legend?.listeners&&this.modulesManager.isEnabled("legend")&&Object.assign(this.legend.listeners,s.legend.listeners),s.locale?.localeText&&(this.modulesManager.getModule("locale").localeText=s.locale?.localeText),this.chartOptions=t;const h=this.modulesManager.getModule("navigator"),d=this.modulesManager.getModule("zoom");!h?.enabled&&!d?.enabled&&this.ctx.zoomManager.updateZoom("chart");const u=h?.miniChart,p=o.navigator?.miniChart?.series??o.series;u?.enabled===!0&&p!=null?this.applyMiniChartOptions(u,p,o,n):u?.enabled===!1&&(u.series=[],u.axes=[]),this.ctx.annotationManager.setAnnotationStyles(t.annotationThemes),l||(l=this.shouldForceNodeDataRefresh(s,c));const f=l||a?0:4;if(this.maybeResetAnimations(c),this.shouldClearLegendData(o,n,c)&&this.ctx.legendManager.clearData(),this.applyInitialState(o),this.ctx.formatManager.setFormatter(o.formatter),fo("Chart.applyOptions() - update type",Ep[f],{seriesStatus:c,forceNodeDataRefresh:l}),t.optionsProcessingTime!==void 0){this._performUpdateSplits["\u2699\uFE0F"]=t.optionsProcessingTime;const x=performance.now()-t.optionsProcessingTime;this._performUpdateSplits.start=x}this.update(f,{apiUpdate:!0,forceNodeDataRefresh:l,newAnimationBatch:!0,clearCallbackCache:!0}),this.firstApply=!1}applyInitialState(t){const{annotationManager:i,chartTypeOriginator:s,historyManager:n,stateManager:o,zoomManager:a}=this.ctx,{initialState:r}=t;if("annotations"in t&&t.annotations?.enabled&&r?.annotations!=null){const l=r.annotations.map(c=>{const h=i.getAnnotationTypeStyles(c.type);return st(c,h)});o.setState(i,l)}r?.chartType!=null&&o.setState(s,r.chartType),(t.navigator?.enabled||t.zoom?.enabled)&&r?.zoom!=null&&o.setState(a,r.zoom),r?.legend!=null&&this.updateLegends(r.legend),r!=null&&n.clear()}maybeResetAnimations(t){if(this.mode==="standalone")switch(t){case"series-grouping-change":case"replaced":this.resetAnimations();break;default:}}shouldForceNodeDataRefresh(t,i){const s=!!t.data||i==="data-change"||i==="replaced",n=Q0.getKeys(),o=Object.values(n).some(r=>t[r]!=null),a=t.title!=null&&t.subtitle!=null||t.formatter!=null;return s||o||a}shouldClearLegendData(t,i,s){const n=s==="replaced"||s==="series-grouping-change"||s==="updated"&&(t.series?.length!==i.series?.length||!t.series?.every((a,r)=>a.type===i.series?.[r].type)),o=i.legend!=null&&t.legend==null;return n||o}applyMiniChartOptions(t,i,s,n){const o=n?.navigator?.miniChart?.series??n?.series,a=this.applySeries(t,this.filterMiniChartSeries(i),this.filterMiniChartSeries(o));this.applyAxes(t,s,n,a,["axes[].tick","axes[].thickness","axes[].title","axes[].crosshair","axes[].gridLine","axes[].label"]);const r=t.series;for(const h of r)h.properties.id=void 0;const l=t.axes,c=l.find(h=>h.direction==="x");for(const h of l)h.nice=!1,h.gridLine.enabled=!1,h.label.enabled=h===c,h.tick.enabled=!1,h.interactionEnabled=!1;if(c!=null){const h=s.navigator?.miniChart,d=h?.label,u=h?.label?.interval;if(c.line.enabled=!1,c.label.set(re(d,["interval","autoRotate","autoRotateAngle","itemStyler","minSpacing","rotation"])),c.type==="grouped-category"){c.label.enabled=!1,c.label.rotation=0;const{depthOptions:p}=c;if(p.length===0)p.set([{label:{enabled:!0}}]);else for(let g=1;gr.moduleFactory(this.getModuleContext())),n.type==="legend"&&this.modulesManager.getModule(n)?.attachLegend(this.ctx.scene),this[n.optionsKey]=this.modulesManager.getModule(n)):(this.modulesManager.removeModule(n),delete this[n.optionsKey]),s=!0)}return s}initSeriesDeclarationOrder(t){for(let i=0;ithis.createSeries(d));return this.initSeriesDeclarationOrder(h),t.series=h,"replaced"}fo("Chart.applySeries() - matchResult",n);const o=[];let a=!1,r=!1,l=!1;const c=n.changes.toSorted((h,d)=>h.targetIdx-d.targetIdx);for(const h of c)switch(r||(r=h.status==="series-grouping"),a||(a=h.diff?.data!=null),l||(l=h.status!=="no-op"),h.status){case"add":{const d=this.createSeries(h.opts);o.push(d),fo("Chart.applySeries() - created new series",d);break}case"remove":fo(`Chart.applySeries() - removing series at previous idx ${h.idx}`,h.series);break;case"no-op":o.push(h.series),fo(`Chart.applySeries() - no change to series at previous idx ${h.idx}`,h.series);break;case"series-grouping":case"update":default:{const{series:d,diff:u,idx:p}=h;fo(`Chart.applySeries() - applying series diff previous idx ${p}`,u,d),this.applySeriesValues(d,u),d.markNodeDataDirty(),o.push(d)}}return this.initSeriesDeclarationOrder(o),fo("Chart.applySeries() - final series instances",o),t.series=o,r?"series-grouping-change":a?"data-change":l?"updated":"no-op"}applyAxes(t,i,s,n,o=[]){if(!("axes"in i)||!i.axes)return!1;o=["axes[].type",...o];const a=i.axes;if(!(n==="replaced")&&t.axes.length===a.length&&t.axes.every((c,h)=>c.type===a[h].type)&&gN(s)){for(const[c,h]of t.axes.entries()){const d=s.axes?.[c]??{},u=wa(d,a[c]);fo(`Chart.applyAxes() - applying axis diff idx ${c}`,u);const p=`axes[${c}]`;Lp(h,u,{path:p,skip:o})}return!0}return fo(`Chart.applyAxes() - creating new axes instances; seriesStatus: ${n}`),t.axes=this.createAxis(a,o),!0}createSeries(t){const i=co.create(t.type,this.getModuleContext());return this.applySeriesOptionModules(i,t),this.applySeriesValues(i,t),i}applySeriesOptionModules(t,i){const s=t.createModuleContext(),n=t.getModuleMap();for(const o of Ta.byType("series-option"))o.optionsKey in i&&o.seriesTypes.includes(t.type)&&n.addModule(o,a=>a.moduleFactory(s))}applySeriesValues(t,i){const s=t.getModuleMap(),{type:n,data:o,listeners:a,seriesGrouping:r,showInMiniChart:l,...c}=i;for(const h of Wp)if(h.type==="series-option"&&h.optionsKey in c){const d=s.getModule(h.optionsKey);if(d){const u=c[h.optionsKey];delete c[h.optionsKey],d.properties.set(u)}}c.visible!=null&&(t.visible=c.visible),t.properties.set(c),"data"in i&&t.setOptionsData(o==null?void 0:Nd.wrap(o)),a&&this.registerListeners(t,a),"seriesGrouping"in i&&(r==null?t.seriesGrouping=void 0:t.seriesGrouping={...t.seriesGrouping,...r})}createAxis(t,i){const s=[],n=this.getModuleContext();for(let o=0;or.moduleFactory(s)),t[o.optionsKey]=n.getModule(o)):(n.removeModule(o),delete t[o.optionsKey]))}}registerListeners(t,i){t.clearEventListeners();for(const[s,n]of Tt(i))t.addEventListener(s,n)}async applyTransaction(t){await this.updateMutex.acquire(()=>{this.data.addTransaction(t),this.update(1,{apiUpdate:!0,skipAnimations:!0})}),await this.waitForUpdate()}};Vt.chartsInstances=new WeakMap,M([ps({newValue(e){this.destroyed||(this.ctx.domManager.setContainer(e),Vt.chartsInstances.set(e,this))},oldValue(e){Vt.chartsInstances.delete(e)}})],Vt.prototype,"container",2),M([ps({newValue(e){this.resize("width option",{inWidth:e})}})],Vt.prototype,"width",2),M([ps({newValue(e){this.resize("height option",{inHeight:e})}})],Vt.prototype,"height",2),M([ps({newValue(e){this.resize("minWidth option",{inMinWidth:e})}})],Vt.prototype,"minWidth",2),M([ps({newValue(e){this.resize("minHeight option",{inMinHeight:e})}})],Vt.prototype,"minHeight",2),M([ps({newValue(e){this.resize("overrideDevicePixelRatio option",{inOverrideDevicePixelRatio:e})}})],Vt.prototype,"overrideDevicePixelRatio",2),M([C],Vt.prototype,"padding",2),M([C],Vt.prototype,"keyboard",2),M([C],Vt.prototype,"touch",2),M([C],Vt.prototype,"mode",2),M([C],Vt.prototype,"styleNonce",2),M([zs("chartCaptions.title")],Vt.prototype,"title",2),M([zs("chartCaptions.subtitle")],Vt.prototype,"subtitle",2),M([zs("chartCaptions.footnote")],Vt.prototype,"footnote",2),M([C],Vt.prototype,"formatter",2),M([C],Vt.prototype,"suppressFieldDotNotation",2),M([C],Vt.prototype,"loadGoogleFonts",2),M([ps({changeValue(e,t){this.onAxisChange(e,t)}})],Vt.prototype,"axes",2),M([ps({changeValue(e,t){this.onSeriesChange(e,t)}})],Vt.prototype,"series",2);var Lm=Vt;function BN(e,t){let i=[];const s=e?.series?.[0]?.type,n=s==="linear-gauge"||s==="radial-gauge",o=s?$i.get(s):"unknown";for(const a of Wp)if(!(o!=="unknown"&&!a.chartTypes.includes(o))){if(a.type==="root"||a.type==="legend"){const r=e[a.optionsKey];if(r==null)continue;a.optionsInnerKey?r[a.optionsInnerKey]&&(i.push(`${a.optionsKey}.${a.optionsInnerKey}`),delete r[a.optionsInnerKey]):(i.push(a.optionsKey),delete e[a.optionsKey])}else if(a.type==="axis"){if(!("axes"in e)||!Ne(e.axes)||!e.axes?.some(r=>r.type===a.identifier))continue;i.push(`axis[type=${a.identifier}]`),e.axes=e.axes.filter(r=>r.type!==a.identifier)}else if(a.type==="axis-option"){if(!("axes"in e)||!Ne(e.axes)||!e.axes?.some(r=>r[a.optionsKey]))continue;i.push(`axis.${a.optionsKey}`);for(const r of e.axes)r[a.optionsKey]&&delete r[a.optionsKey]}else if(a.type==="series"){if(a.community||!Ne(e.series)||!e.series?.some(r=>r.type===a.identifier))continue;i.push(`series[type=${a.identifier}]`),e.series=e.series.filter(r=>r.type!==a.identifier)}else if(a.type==="series-option"){if(!Ne(e.series)||!e.series?.some(r=>r[a.optionsKey]))continue;i.push(`series.${a.optionsKey}`);for(const r of e.series)r[a.optionsKey]&&delete r[a.optionsKey]}}if(i.length&&!t){n&&(i=["AgCharts.createGauge"]);let a="ag-charts-enterprise",r="https://www.ag-grid.com/charts/javascript/installation/";e.mode==="integrated"&&(a="ag-grid-charts-enterprise' or 'ag-grid-enterprise/charts-enterprise",r="https://www.ag-grid.com/javascript-data-grid/integrated-charts-installation/"),K.warnOnce([`unable to use these enterprise features as '${a}' has not been loaded:`,"",...i,"",`See: ${r}`].join(` +`))}}function J$(e){const t="mode"in e&&e.mode==="integrated";for(const i of Ta.byType("root","legend")){const s=e[i.optionsKey],n=s!=null&&s.enabled===!1,o=!("removable"in i)||i.removable===!0||i.removable==="standalone-only"&&!t;n&&o&&delete e[i.optionsKey]}}function _N(e){return e?.up||e?.down||e?.neutral?"user-full":e?.fills||e?.strokes?"user-indexed":"inbuilt"}var di={BLUE:"#5090dc",ORANGE:"#ffa03a",GREEN:"#459d55",CYAN:"#34bfe1",YELLOW:"#e1cc00",VIOLET:"#9669cb",GRAY:"#b5b5b5",MAGENTA:"#bd5aa7",BROWN:"#8a6224",RED:"#ef5452"},kr={BLUE:"#2b5c95",ORANGE:"#cc6f10",GREEN:"#1e652e",CYAN:"#18859e",YELLOW:"#a69400",VIOLET:"#603c88",GRAY:"#575757",MAGENTA:"#7d2f6d",BROWN:"#4f3508",RED:"#a82529"},PM={};Tn(PM,{DEFAULT_ANNOTATION_HANDLE_FILL:()=>hg,DEFAULT_ANNOTATION_STATISTICS_COLOR:()=>pg,DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE:()=>gg,DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL:()=>fg,DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE:()=>yg,DEFAULT_ANNOTATION_STATISTICS_FILL:()=>dg,DEFAULT_ANNOTATION_STATISTICS_STROKE:()=>ug,DEFAULT_CAPTION_ALIGNMENT:()=>bl,DEFAULT_CAPTION_LAYOUT_STYLE:()=>xl,DEFAULT_FIBONACCI_STROKES:()=>lg,DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL:()=>Ni,DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR:()=>Gt,DEFAULT_GRIDLINE_ENABLED:()=>Qo,DEFAULT_POLAR_SERIES_STROKE:()=>Rm,DEFAULT_SEPARATION_LINES_COLOUR:()=>rg,DEFAULT_SHADOW_COLOUR:()=>Wc,DEFAULT_SPARKLINE_CROSSHAIR_STROKE:()=>zm,DEFAULT_TEXTBOX_COLOR:()=>bg,DEFAULT_TEXTBOX_FILL:()=>mg,DEFAULT_TEXTBOX_STROKE:()=>xg,DEFAULT_TEXT_ANNOTATION_COLOR:()=>cg,DEFAULT_TOOLBAR_POSITION:()=>vg,IS_DARK_THEME:()=>Gd,PALETTE_ALT_DOWN_FILL:()=>BM,PALETTE_ALT_DOWN_STROKE:()=>zM,PALETTE_ALT_NEUTRAL_FILL:()=>_M,PALETTE_ALT_NEUTRAL_STROKE:()=>VM,PALETTE_ALT_UP_FILL:()=>FM,PALETTE_ALT_UP_STROKE:()=>RM,PALETTE_DOWN_FILL:()=>Om,PALETTE_DOWN_STROKE:()=>wm,PALETTE_NEUTRAL_FILL:()=>Pm,PALETTE_NEUTRAL_STROKE:()=>Em,PALETTE_UP_FILL:()=>Nm,PALETTE_UP_STROKE:()=>Tm});var Gd=Symbol("is-dark-theme"),rg=Symbol("default-separation-lines-colour"),Wc=Symbol("default-shadow-colour"),xl=Symbol("default-caption-layout-style"),bl=Symbol("default-caption-alignment"),Tm=Symbol("palette-up-stroke"),wm=Symbol("palette-down-stroke"),Nm=Symbol("palette-up-fill"),Om=Symbol("palette-down-fill"),Em=Symbol("palette-neutral-stroke"),Pm=Symbol("palette-neutral-fill"),RM=Symbol("palette-alt-up-stroke"),zM=Symbol("palette-alt-down-stroke"),FM=Symbol("palette-alt-up-fill"),BM=Symbol("palette-alt-down-fill"),_M=Symbol("palette-gray-fill"),VM=Symbol("palette-gray-stroke"),Rm=Symbol("default-polar-series-stroke"),zm=Symbol("default-sparkline-crosshair-stroke"),Gt=Symbol("default-financial-charts-annotation-stroke"),lg=Symbol("default-hierarchy-strokes"),cg=Symbol("default-text-annotation-color"),Ni=Symbol("default-financial-charts-annotation-background-fill"),hg=Symbol("default-annotation-handle-fill"),dg=Symbol("default-annotation-statistics-fill"),ug=Symbol("default-annotation-statistics-stroke"),pg=Symbol("default-annotation-statistics-color"),gg=Symbol("default-annotation-statistics-divider-stroke"),fg=Symbol("default-annotation-statistics-fill"),yg=Symbol("default-annotation-statistics-stroke"),mg=Symbol("default-textbox-fill"),xg=Symbol("default-textbox-stroke"),bg=Symbol("default-textbox-color"),vg=Symbol("default-toolbar-position"),Qo=Symbol("default-gridline-enabled"),VN=[{type:"number",position:{$if:[{$eq:[{$path:["/series/0/direction",void 0]},"horizontal"]},"bottom","left"]}},{type:"category",position:{$if:[{$eq:[{$path:["/series/0/direction",void 0]},"horizontal"]},"left","bottom"]}}],eU={$if:[{$or:[{$isGradient:{$palette:"fill"}},{$isPattern:{$palette:"fill"}},{$isImage:{$value:"$1"}}]},{$palette:"fillFallback"},{$palette:"fill"}]},tU={$if:[{$or:[{$isGradient:{$palette:"fill"}},{$isPattern:{$palette:"fill"}},{$isImage:{$value:"$1"}}]},{$palette:"fillsFallback"},{$palette:"fills"}]},Fm={$if:[{$isGradient:{$palette:"fill"}},{$palette:"fillFallback"},{$if:[{$isPattern:{$palette:"fill"}},{$path:["/stroke",{$palette:"fillFallback"},{$palette:"fill"}]},{$palette:"fill"}]}]},iU={$if:[{$or:[{$isGradient:{$palette:"fill"}},{$isPattern:{$palette:"fill"}},{$isImage:{$value:"$1"}}]},[{$palette:"fillFallback"},{$palette:"fillFallback"}],{$palette:"range2"}]},sU={type:"gradient",gradient:"linear",bounds:"item",colorStops:[{color:"black"}],rotation:0,reverse:!1,colorSpace:"rgb"},vl={type:"gradient",gradient:"linear",bounds:"item",colorStops:{$shallow:{$map:[{color:{$value:"$1"}},{$palette:"gradient"}]}},rotation:0,reverse:!1,colorSpace:"rgb"},nU={...vl,colorStops:{$shallow:[{color:{$mix:[{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},"black",.15]}},{color:{$mix:[{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},"white",.15]}}]}},oU={...vl,colorStops:{$map:[{color:{$value:"$1"}},{$path:["/0",void 0,{$palette:"gradients"}]}]}},aU=e=>({...vl,colorStops:{$shallow:{$if:[{$or:[{$isGradient:{$palette:`${e}.fill`}},{$isPattern:{$palette:`${e}.fill`}},{$isImage:{$palette:`${e}.fill`}}]},{$path:["/colorStops",void 0,{$palette:`${e}.fill`}]},[{color:{$mix:[{$palette:`${e}.fill`},"black",.15]}},{color:{$mix:[{$palette:`${e}.fill`},"white",.15]}}]]}}}),Bm={type:"gradient",gradient:"radial",bounds:"item",colorStops:{$shallow:{$map:[{color:{$value:"$1"}},{$palette:"gradient"}]}},rotation:0,reverse:!1,colorSpace:"rgb"},Sg={...Bm,reverse:!0},rU={...Bm,bounds:"series"},GN={...Bm,bounds:"series",reverse:!0},lU={type:"gradient",gradient:"conic",bounds:"series",colorStops:{$map:[{color:{$value:"$1"}},{$palette:"gradient"}]},rotation:0,reverse:!1,colorSpace:"rgb"},zn={type:"pattern",pattern:"forward-slanted-lines",width:{$isUserOption:["./height",{$path:"./height"},10]},height:{$isUserOption:["./width",{$path:"./width"},10]},padding:2,fill:{$if:[{$or:[{$isGradient:{$palette:"fill"}},{$isImage:{$palette:"fill"}}]},{$palette:"fillFallback"},{$if:[{$isPattern:{$palette:"fill"}},{$path:["/fill",{$palette:"fillFallback"},{$palette:"fill"}]},{$palette:"fill"}]}]},fillOpacity:1,stroke:Fm,strokeOpacity:1,strokeWidth:{$switch:[{$path:"./pattern"},0,[["backward-slanted-lines","forward-slanted-lines","horizontal-lines","vertical-lines"],4]]},backgroundFill:"none",backgroundFillOpacity:1,rotation:0,scale:1},cU={...zn,stroke:{$if:[{$isGradient:{$palette:"fill"}},{$path:["/0",void 0,{$palette:"fillsFallback"}]},{$if:[{$isPattern:{$palette:"fill"}},{$path:["/stroke",{$path:["/0",void 0,{$palette:"fillsFallback"}]},{$path:["/0",void 0,{$palette:"fills"}]}]},{$path:["/0",void 0,{$palette:"fills"}]}]}]},fill:{$if:[{$or:[{$isGradient:{$palette:"fill"}},{$isImage:{$palette:"fill"}}]},{$path:["/0",void 0,{$palette:"fillsFallback"}]},{$if:[{$isPattern:{$palette:"fill"}},{$path:["/fill",{$path:["/0",void 0,{$palette:"fillsFallback"}]},{$path:["/0",void 0,{$palette:"fills"}]}]},{$path:["/0",void 0,{$palette:"fills"}]}]}]}},hU={type:"pattern",pattern:"forward-slanted-lines",width:8,height:8,padding:1,fill:"black",fillOpacity:1,backgroundFill:"white",backgroundFillOpacity:1,stroke:"black",strokeOpacity:1,strokeWidth:1,rotation:0,scale:1},dU={...zn,fill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]}},uU=e=>({...zn,stroke:{$if:[{$isGradient:{$palette:`${e}.fill`}},{$palette:"fillFallback"},{$if:[{$isPattern:{$palette:`${e}.fill`}},{$path:["/stroke",{$palette:"fillFallback"},{$palette:`${e}.fill`}]},{$palette:`${e}.fill`}]}]}}),Ir={type:"image",backgroundFill:{$palette:"fillFallback"},backgroundFillOpacity:1,repeat:"no-repeat",fit:"contain",rotation:0},pU={type:"image",backgroundFill:"black",backgroundFillOpacity:1,rotation:0,repeat:"no-repeat",fit:"contain",width:8,height:8};function Fn(e){return AL(e,t=>{const i=mt.fromString(t);return[mt.darken(i,.15).toString(),t,mt.lighten(i,.15).toString()]})}var GM={stroke:{$path:["../../highlightStyle/item/stroke","rgba(0, 0, 0, 0.4)"]},strokeWidth:{$path:["../../highlightStyle/item/strokeWidth",2]},strokeOpacity:{$path:["../../highlightStyle/item/strokeOpacity",void 0]},opacity:{$path:["../../highlightStyle/item/opacity",{$if:[{$eq:[{$path:["/highlight/drawingMode",void 0]},"cutout"]},.67,1]}]}},jN={...GM,fill:{$path:["../../highlightStyle/item/fill",{$if:[{$eq:[{$path:["/highlight/drawingMode",void 0]},"cutout"]},void 0,"rgba(255,255,255, 0.33)"]}]},fillOpacity:{$path:["../../highlightStyle/item/fillOpacity",void 0]}},Ra={padding:8,cornerRadius:4,fill:{$if:[{$and:[{$eq:[{$path:"./fill/type"},"image"]},{$isUserOption:["./fill/backgroundFill",!1,!0]}]},{backgroundFill:"transparent"},void 0]},border:{enabled:{$isUserOption:["../border",!0,!1]},strokeWidth:1,stroke:{$foregroundOpacity:.08}}};function Sl(e=!0){return{enabled:!0,highlightedItem:e?jN:GM,unhighlightedItem:{strokeWidth:{$path:["../../highlightStyle/series/strokeWidth",void 0]}},highlightedSeries:{strokeWidth:{$path:["../../highlightStyle/series/strokeWidth",void 0]}},unhighlightedSeries:{opacity:{$path:["../../highlightStyle/series/dimOpacity",void 0]}}}}function HN(e=!0){return{enabled:!0,highlightedItem:e?jN:GM,unhighlightedItem:{strokeWidth:{$path:["../../highlightStyle/series/strokeWidth",void 0]},opacity:{$path:["../../highlightStyle/series/dimOpacity",void 0]}}}}var WN={border:{enabled:!1,stroke:{$foregroundBackgroundMix:.25},strokeOpacity:1,strokeWidth:1},cornerRadius:4,fillOpacity:1,padding:{$if:[{$eq:[{$path:"./border/enabled"},!0]},5,{$isUserOption:["./fill",5,0]}]}},_m={enabled:!1,key:"x",segments:{$apply:[{fill:{$applySwitch:[{$path:"type"},{$path:"../../../fill"},["gradient",vl],["image",Ir],["pattern",zn]]},stroke:{$path:"../../../stroke"},fillOpacity:{$path:"../../../fillOpacity"},strokeWidth:{$isUserOption:["./stroke",{$isUserOption:["../../../strokeWidth",{$path:"../../../strokeWidth"},{$if:[{$greaterThan:[{$path:"../../../strokeWidth"},0]},{$path:"../../../strokeWidth"},2]}]},{$path:"../../../strokeWidth"}]},strokeOpacity:{$path:"../../../strokeOpacity"},lineDash:{$path:"../../../lineDash"},lineDashOffset:{$path:"../../../lineDashOffset"}}]}},jM="white",gU={get cartesian(){return{seriesTypes:$i.cartesianTypes,commonOptions:["zoom","navigator"]}},get polar(){return{seriesTypes:$i.polarTypes,commonOptions:[]}},get topology(){return{seriesTypes:$i.topologyTypes,commonOptions:[]}},get standalone(){return{seriesTypes:$i.standaloneTypes,commonOptions:[]}}},fU={"radial-gauge":!0,"linear-gauge":!0};function yU(e){return fU[e]===!0}var Bn=class ty{static getDefaultColors(){return{fills:di,fillsFallback:Object.values(di),strokes:kr,sequentialColors:Fn(di),divergingColors:[di.ORANGE,di.YELLOW,di.GREEN],hierarchyColors:["#fff","#e0e5ea","#c1ccd5","#a3b4c1","#859cad"],secondSequentialColors:mt.interpolate([mt.fromHexString(di.BLUE),mt.fromHexString("#cbdef5")],8).map(t=>t.toString()),secondDivergingColors:[di.GREEN,di.YELLOW,di.RED],secondHierarchyColors:["#fff","#c5cbd1","#a4b1bd","#8498a9","#648096"],up:{fill:di.GREEN,stroke:kr.GREEN},down:{fill:di.RED,stroke:kr.RED},neutral:{fill:di.GRAY,stroke:kr.GRAY},altUp:{fill:di.BLUE,stroke:kr.BLUE},altDown:{fill:di.ORANGE,stroke:kr.ORANGE},altNeutral:{fill:di.GRAY,stroke:kr.GRAY}}}static getDefaultPublicParameters(){return{accentColor:"#2196f3",axisColor:{$foregroundBackgroundMix:.325},backgroundColor:jM,borderColor:{$foregroundOpacity:.15},borderRadius:4,chartBackgroundColor:{$ref:"backgroundColor"},chartPadding:20,focusShadow:"0 0 0 3px var(--ag-charts-accent-color)",foregroundColor:"#181d1f",fontFamily:"Verdana, sans-serif",fontSize:gr,fontWeight:400,gridLineColor:{$foregroundBackgroundMix:.1},popupShadow:"0 0 16px rgba(0, 0, 0, 0.15)",subtleTextColor:{$mix:[{$ref:"textColor"},{$ref:"chartBackgroundColor"},.38]},textColor:{$ref:"foregroundColor"},chromeBackgroundColor:{$foregroundBackgroundMix:.02},chromeFontFamily:{$ref:"fontFamily"},chromeFontSize:{$ref:"fontSize"},chromeFontWeight:{$ref:"fontWeight"},chromeTextColor:{$ref:"foregroundColor"},chromeSubtleTextColor:{$mix:[{$ref:"chromeTextColor"},{$ref:"backgroundColor"},.38]},buttonBackgroundColor:{$ref:"backgroundColor"},buttonBorder:!0,buttonFontWeight:400,buttonTextColor:{$ref:"textColor"},inputBackgroundColor:{$ref:"backgroundColor"},inputBorder:!0,inputTextColor:{$ref:"textColor"},menuBackgroundColor:{$ref:"chromeBackgroundColor"},menuBorder:!0,menuTextColor:{$ref:"chromeTextColor"},panelBackgroundColor:{$ref:"chromeBackgroundColor"},panelSubtleTextColor:{$ref:"chromeSubtleTextColor"},tooltipBackgroundColor:{$ref:"chromeBackgroundColor"},tooltipBorder:!0,tooltipTextColor:{$ref:"chromeTextColor"},tooltipSubtleTextColor:{$ref:"chromeSubtleTextColor"},crosshairLabelBackgroundColor:{$ref:"foregroundColor"},crosshairLabelTextColor:{$ref:"chartBackgroundColor"}}}static getAxisDefaults(t,{title:i,time:s}){return st(t,i&&{title:{enabled:!1,text:"Axis Title",spacing:25,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:Ko.MEDIUM},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}}},s&&{parentLevel:{enabled:!1,label:{enabled:{$path:"../../label/enabled"},border:{enabled:{$or:[{$isUserOption:["../border",!0,!1]},{$path:"../../../label/border/enabled"}]},strokeWidth:{$path:"../../../label/border/strokeWidth"},stroke:{$path:"../../../label/border/stroke"}},fill:{$path:"../../label/fill"},fontSize:{$path:"../../label/fontSize"},fontFamily:{$path:"../../label/fontFamily"},fontWeight:"bold",spacing:{$path:"../../label/spacing"},color:{$path:"../../label/color"},cornerRadius:{$path:"../../label/cornerRadius"},padding:{$path:"../../label/padding"},avoidCollisions:{$path:"../../label/avoidCollisions"}},tick:{enabled:{$path:"../../tick/enabled"},width:{$path:"../../tick/width"},size:{$path:"../../tick/size"},stroke:{$path:"../../tick/stroke"}}}},{label:{enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},spacing:11,color:{$ref:"textColor"},avoidCollisions:!0,cornerRadius:4,border:{enabled:{$isUserOption:["../border",!0,!1]},strokeWidth:1,stroke:{$foregroundOpacity:.08}},padding:{$if:[{$eq:[{$path:"./border/enabled"},!0]},{left:12,right:12,top:8,bottom:8},void 0]}},line:{enabled:!0,width:1,stroke:{$ref:"axisColor"}},tick:{enabled:!1,size:6,width:1,stroke:{$ref:"axisColor"}},gridLine:{enabled:!0,width:1,style:{$apply:[{fillOpacity:1,stroke:{$ref:"gridLineColor"},strokeWidth:{$path:"../../width"},lineDash:[]},[{fillOpacity:1,stroke:{$ref:"gridLineColor"},strokeWidth:{$path:"../../width"},lineDash:[]}]]}},crossLines:{$apply:[{enabled:!0,fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},fillOpacity:.08,strokeWidth:1,label:{fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},padding:5,color:{$ref:"textColor"}}},void 0,{$pathString:["/common/axes/$axisType/crossLines",{axisType:{$path:["/axes/$index/type"]}}]},{$pathString:["/$seriesType/axes/$axisType/crossLines",{seriesType:{$path:["/series/0/type","line"]},axisType:{$path:["/axes/$index/type"]}}]}]}})}getChartDefaults(){return{minHeight:300,minWidth:300,background:{visible:!0,fill:{$ref:"chartBackgroundColor"}},padding:{top:{$ref:"chartPadding"},right:{$ref:"chartPadding"},bottom:{$ref:"chartPadding"},left:{$ref:"chartPadding"}},seriesArea:{border:{enabled:!1,stroke:{$ref:"foregroundColor"},strokeOpacity:1,strokeWidth:1},cornerRadius:4,padding:{$if:[{$eq:[{$path:"./border/enabled"},!0]},5,0]}},keyboard:{enabled:!0},title:{enabled:!1,text:"Title",spacing:{$if:[{$path:"../subtitle/enabled"},10,20]},fontWeight:{$ref:"fontWeight"},fontSize:{$rem:Ko.LARGEST},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},wrapping:"hyphenate",layoutStyle:xl,textAlign:bl},subtitle:{enabled:!1,text:"Subtitle",spacing:20,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:Ko.MEDIUM},fontFamily:{$ref:"fontFamily"},color:{$ref:"subtleTextColor"},wrapping:"hyphenate",layoutStyle:xl,textAlign:bl},footnote:{enabled:!1,text:"Footnote",spacing:20,fontSize:{$rem:Ko.MEDIUM},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"subtleTextColor"},wrapping:"hyphenate",layoutStyle:xl,textAlign:bl},legend:{...WN,enabled:{$and:[{$greaterThan:[{$size:{$path:"/series"}},1]},{$or:[{$isChartType:"cartesian"},{$isChartType:"standalone"},{$and:[{$isChartType:"polar"},{$not:{$isSeriesType:"pie"}},{$not:{$isSeriesType:"donut"}}]}]}]},position:"bottom",orientation:{$if:[{$or:[{$eq:[{$path:"./position"},"left"]},{$eq:[{$path:"./position"},"left-top"]},{$eq:[{$path:"./position"},"left-bottom"]},{$eq:[{$path:"./position"},"right"]},{$eq:[{$path:"./position"},"right-top"]},{$eq:[{$path:"./position"},"right-bottom"]},{$eq:[{$path:"./position/placement"},"left"]},{$eq:[{$path:"./position/placement"},"left-top"]},{$eq:[{$path:"./position/placement"},"left-bottom"]},{$eq:[{$path:"./position/placement"},"right"]},{$eq:[{$path:"./position/placement"},"right-top"]},{$eq:[{$path:"./position/placement"},"right-bottom"]}]},"vertical","horizontal"]},spacing:30,listeners:{},toggleSeries:!0,item:{paddingX:16,paddingY:8,marker:{size:15,padding:8},showSeriesStroke:!0,label:{color:{$ref:"textColor"},fontSize:{$rem:Ko.SMALL},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"}}},reverseOrder:!1,pagination:{marker:{size:12},activeStyle:{fill:{$ref:"foregroundColor"}},inactiveStyle:{fill:{$ref:"subtleTextColor"}},highlightStyle:{fill:{$ref:"foregroundColor"}},label:{color:{$ref:"textColor"}}},fill:{$if:[{$path:["./position/floating",!1]},{$ref:"chartBackgroundColor"},"transparent"]}},tooltip:{enabled:!0,darkTheme:Gd,delay:0,pagination:!1,mode:{$if:[{$or:[{$and:[{$isChartType:"cartesian"},{$not:{$hasSeriesType:"bubble"}},{$not:{$hasSeriesType:"scatter"}},{$greaterThan:[{$size:{$path:"/series"}},1]},{$lessThan:[{$size:{$path:"/series"}},4]}]},{$and:[{$isChartType:"polar"},{$greaterThan:[{$size:{$path:"/series"}},1]},{$lessThan:[{$size:{$path:"/series"}},4]}]}]},"shared","single"]}},overlays:{darkTheme:Gd},listeners:{},series:{tooltip:{range:{$path:["/tooltip/range","exact"]},position:{anchorTo:{$path:["/tooltip/position/anchorTo","pointer"]},placement:{$path:["/tooltip/position/placement",void 0]},xOffset:{$path:["/tooltip/position/xOffset",0]},yOffset:{$path:["/tooltip/position/yOffset",0]}}}}}}constructor(t={}){const{overrides:i,palette:s,params:n}=Ft(t),o=this.createChartConfigPerChartType(this.getDefaults()),a={};i&&this.processOverrides(a,i);const{fills:r,strokes:l,sequentialColors:c,...h}=this.getDefaultColors();this.palette=cr(st(s,{fills:Object.values(r),strokes:Object.values(l),sequentialColors:Object.values(c),...h})),this.paletteType=_N(s),this.params=st(n,this.getPublicParameters()),this.config=cr(Ft(o)),this.overrides=cr(i),this.presets=cr(a)}processOverrides(t,i){for(const s of $i.seriesTypes){const n=s,o=i[n];yU(n)&&(t[n]=o,delete i[n])}}createChartConfigPerChartType(t){for(const[i,{seriesTypes:s}]of Tt(gU)){const n=J0.get(i);for(const o of s)t[o]??(t[o]=n)}return t}getDefaults(){const t=(i,s)=>{const n={},o={axes:{},...Q0.getThemeTemplates(),...this.getChartDefaults(),...J0.get(i)};for(const a of s){n[a]=st(co.getThemeTemplate(a),n[a]??o);const{axes:r}=n[a];for(const l of zc.keys())r[l]=st(r[l],zc.getThemeTemplate(l),ty.axisDefault[l]);(a==="map-shape-background"||a==="map-line-background")&&delete n[a].series.tooltip}return n};return st(t("cartesian",$i.cartesianTypes),t("polar",$i.polarTypes),t("topology",$i.topologyTypes),t("standalone",$i.standaloneTypes))}static applyTemplateTheme(t,i,s){if(Ne(t))for(let n=0;n{let i;if(typeof e=="string")WM.includes(e)?i=!0:(i={valid:!1,invalid:[],cleared:null},i.invalid.push(new ol("invalid",`a legend placement string: ["${WM.join('", "')}"]`,e,t.path)));else{const{cleared:s,invalid:n}=cs(e,IU);i={valid:n.length===0,cleared:s,invalid:n}}return i},"a legend position object or placement string"),Vm=Ie(J("circle","cross","diamond","heart","plus","pin","square","star","triangle"),Pt),UN=J("never","always","hyphenate","on-space"),Gm=J("top","right","bottom","left","top-right","bottom-right","bottom-left","top-left","center"),jm=Ie(H,J("exact","nearest")),Vs=Ie(E,me(Z),me(Da),Rt({text:U(E),...dt},"text segments array")),KN=J("pointer","start","middle","end"),Hm={enabled:G,text:Vs,textAlign:J("left","center","right"),wrapping:J("never","always","hyphenate","on-space"),spacing:H,maxWidth:H,maxHeight:H,...dt};Hm.padding=me(H);var Wm={enabled:G,text:Vs,renderer:Ps(Ie(E,XC))},$M=["defaults","download","zoom-to-cursor","pan-to-cursor","reset-zoom","toggle-series-visibility","toggle-other-series","separator"],YN={type:J("action","separator"),showOn:J("always","series-area","series-node","legend-item"),label:U(E),enabled:G,action:Pt,items:(e,t)=>ZN(e,t)};YN.iconUrl=me(E);var AU=At(YN),CU=Ze((e,t)=>{let i;return typeof e=="string"?$M.includes(e)?i=!0:(i={valid:!1,invalid:[],cleared:null},i.invalid.push(new ol("invalid",`a context menu item string alias: ["${$M.join('", "')}"]`,e,t.path))):i=AU(e,t),i},`a context menu item object or string alias: [${$M.join(", ")}]`),ZN=Me(CU,"a menu items array",!1),Qc={label:E,ariaLabel:E,tooltip:E,icon:J("align-center","align-left","align-right","arrow-drawing","arrow-down-drawing","arrow-up-drawing","callout-annotation","candlestick-series","close","comment-annotation","date-range-drawing","date-price-range-drawing","delete","disjoint-channel-drawing","drag-handle","fill-color","line-style-solid","line-style-dashed","line-style-dotted","high-low-series","hlc-series","hollow-candlestick-series","horizontal-line-drawing","line-color","line-series","line-with-markers-series","locked","measurer-drawing","note-annotation","ohlc-series","pan-end","pan-left","pan-right","pan-start","parallel-channel-drawing","position-bottom","position-center","position-top","price-label-annotation","price-range-drawing","reset","settings","step-line-series","text-annotation","trend-line-drawing","fibonacci-retracement-drawing","fibonacci-retracement-trend-based-drawing","unlocked","vertical-line-drawing","zoom-in","zoom-out")},ea=Ie(E,Ps(Vs)),XN=At({x:ea,y:ea,angle:ea,radius:ea,size:ea,color:ea,label:ea,secondaryLabel:ea,sectorLabel:ea,calloutLabel:ea,legendItem:ea}),ta=Ze(bG,"a valid number format string"),Oe={width:H,height:H,minWidth:H,minHeight:H,suppressFieldDotNotation:G,title:Hm,subtitle:Hm,footnote:Hm,padding:{top:H,right:H,bottom:H,left:H},seriesArea:{border:my,clip:G,cornerRadius:Z,padding:yy},legend:{enabled:G,position:$N,orientation:J("horizontal","vertical"),maxWidth:H,maxHeight:H,spacing:H,border:my,cornerRadius:Z,padding:yy,fill:so,fillOpacity:ge,preventHidingAll:G,reverseOrder:G,toggleSeries:G,item:{marker:{size:H,shape:Vm,padding:H,strokeWidth:H},line:{length:H,strokeWidth:H},label:{maxLength:H,formatter:Pt,...dt},maxWidth:H,paddingX:H,paddingY:H,showSeriesStroke:G},pagination:{marker:{size:H,shape:Vm,padding:H},activeStyle:{...ce,...te},inactiveStyle:{...ce,...te},highlightStyle:{...ce,...te},label:dt},listeners:{legendItemClick:Pt,legendItemDoubleClick:Pt}},gradientLegend:{enabled:G,position:$N,spacing:H,reverseOrder:G,border:my,cornerRadius:Z,padding:yy,fill:so,fillOpacity:ge,gradient:{preferredLength:H,thickness:H},scale:{label:{...dt,minSpacing:H,format:ta,formatter:Pt},padding:H,interval:{step:Z,values:Ho,minSpacing:tt(H,to("maxSpacing")),maxSpacing:tt(H,io("minSpacing"))}}},listeners:{seriesNodeClick:Pt,seriesNodeDoubleClick:Pt,seriesVisibilityChange:Pt,click:Pt,doubleClick:Pt,annotations:Pt,zoom:Pt},loadGoogleFonts:G,highlight:{drawingMode:J("overlay","cutout"),range:J("tooltip","node")},overlays:{loading:Wm,noData:Wm,noVisibleSeries:Wm,unsupportedBrowser:Wm},tooltip:{enabled:G,showArrow:G,pagination:G,delay:H,range:jm,wrapping:UN,mode:J("single","shared","compact"),position:{anchorTo:J("pointer","node","chart"),placement:Ie(Gm,Me(Gm)),xOffset:Z,yOffset:Z}},animation:{enabled:G,duration:H},contextMenu:{enabled:G,items:ZN},context:()=>!0,dataSource:{getData:Pt},keyboard:{enabled:G,tabIndex:Z},touch:{dragAction:J("none","drag","hover")},ranges:{enabled:G,buttons:Rt({...Qc,value:Ie(Z,tt(Me(Ie(Z,Da)),al(2,2)),Pt)},"range button options array")},locale:{localeText:gy,getLocaleText:Ps(E)},background:{visible:G,fill:ae,image:{url:U(E),top:Z,right:Z,bottom:Z,left:Z,width:H,height:H,opacity:ge}},styleNonce:E,sync:{enabled:G,groupId:E,axes:J("x","y","xy"),nodeInteraction:G,zoom:G},zoom:{enabled:G,enableAxisDragging:G,enableAxisScrolling:G,enableDoubleClickToReset:G,enablePanning:G,enableScrolling:G,enableSelecting:G,enableTwoFingerZoom:G,keepAspectRatio:G,anchorPointX:KN,anchorPointY:KN,axisDraggingMode:J("pan","zoom"),axes:J("x","y","xy"),deceleration:Ie(J("off","short","long"),ge),minVisibleItems:H,panKey:J("alt","ctrl","meta","shift"),scrollingStep:ge,autoScaling:{enabled:G,padding:ge},buttons:{enabled:G,buttons:Rt({...Qc,value:J("reset","zoom-in","zoom-out","pan-left","pan-right","pan-start","pan-end"),section:E},"zoom button options array"),visible:J("always","zoomed","hover")}},formatter:Ie(Ps(Vs),XN)};Oe.dataSource.requestThrottle=me(H),Oe.dataSource.updateThrottle=me(H),Oe.dataSource.updateDuringInteraction=me(G),Oe.zoom.enableIndependentAxes=me(G),Oe.statusBar=me(ke),Oe.foreground=me({visible:G,text:E,image:{url:E,top:Z,right:Z,bottom:Z,left:Z,width:H,height:H,opacity:ge},...ce}),Oe.overrideDevicePixelRatio=me(Z),Oe.sync.domainMode=me(J("direction","position","key"));var Ue={cursor:E,context:()=>!0,showInLegend:G,nodeClickRange:jm,listeners:{seriesNodeClick:Pt,seriesNodeDoubleClick:Pt},highlightStyle:{item:{...ce,...te},series:{enabled:G,dimOpacity:ge,strokeWidth:H}},highlight:iL(Ct)},ia={...Ue,id:E,visible:G,context:()=>!0,data:Ho};ia.seriesGrouping=me(ke);var Dl={shape:Vm,size:H,...ce,...te,...pe},sa={enabled:G,itemStyler:it({...ce,...te,...pe,shape:Vm,size:H}),...Dl},yt={enabled:G,formatter:Ps(Vs),format:ta,itemStyler:it({enabled:G,...Wo,...dt}),...Wo,...dt},kl={...yt,lineHeight:H,minimumFontSize:H,wrapping:UN,overflowStrategy:J("ellipsis","hide")},Mg={visible:G,cap:{visible:G,length:H,lengthRatio:ge,...te,...pe},...te,...pe},$m={...Mg,xLowerKey:E,xUpperKey:E,yLowerKey:E,yUpperKey:E,xLowerName:E,xUpperName:E,yLowerName:E,yUpperName:E,itemStyler:it({visible:G,...te,...pe,cap:{visible:G,length:H,lengthRatio:ge,...te,...pe}})},et={enabled:G,showArrow:G,range:jm,renderer:Ps(Ie(E,At({heading:E,title:E,data:Rt({label:U(E),value:U(E)})},"tooltip renderer result object"))),position:{anchorTo:J("node","pointer","chart"),placement:Ie(Gm,Me(Gm)),xOffset:Z,yOffset:Z},interaction:{enabled:G}},za={enabled:G,xOffset:Z,yOffset:Z,blur:H,color:ae},Um=Sc({linear:{},smooth:{tension:ge},step:{position:J("start","middle","end")}},"interpolation line options"),Dg={fills:tt(al(2),Me(At({color:ae,stop:Z},"")),tL),fillMode:J("continuous","discrete")},Km={value:U(Z),text:E,shape:Ie(J("circle","cross","diamond","heart","plus","pin","square","star","triangle","line"),Pt),placement:J("before","after","middle"),spacing:H,size:H,rotation:Z,...ce,...te,...pe},Ym={value:U(Z),text:E,shape:Ie(J("circle","cross","diamond","heart","plus","pin","square","star","triangle","line"),Pt),placement:J("inside","outside","middle"),spacing:H,size:H,rotation:Z,label:{...yt,spacing:H},...ce,...te,...pe},Zm={direction:J("horizontal","vertical"),cornerMode:J("container","item"),cornerRadius:H,thickness:H,segmentation:{enabled:G,spacing:H,interval:{values:Me(Z),step:Z,count:Z}},bar:{enabled:G,thickness:H,thicknessRatio:ge,...Dg,...ce,...te,...pe},label:{...kl,text:E,spacing:H,avoidCollisions:G,placement:J("inside-start","outside-start","inside-end","outside-end","inside-center","bar-inside","bar-inside-end","bar-outside-end","bar-end")},tooltip:et,...re(Ue,["listeners"])},Il={...Zm,...re(ia,["listeners"]),type:U(Ce("linear-gauge")),value:U(Z),scale:{min:tt(Z,to("max")),max:tt(Z,io("min")),label:{enabled:G,formatter:Pt,rotation:Z,spacing:H,minSpacing:H,placement:J("before","after"),avoidCollisions:G,format:ta,...dt},interval:{values:Me(Z),step:Z},...Dg,...ce,...te,...pe},targets:Rt(Km,"target options array")};Il.margin=me(Z),Il.defaultColorRange=me(Me(ae)),Il.defaultTarget=me({...Km,value:Z,label:{...yt,spacing:Z}}),Il.defaultScale=me(Il.scale),Il.scale.defaultFill=me(ae);var Xm={outerRadius:H,innerRadius:H,outerRadiusRatio:ge,innerRadiusRatio:ge,startAngle:Z,endAngle:Z,spacing:H,cornerMode:J("container","item"),cornerRadius:H,scale:{min:tt(Z,to("max")),max:tt(Z,io("min")),label:{enabled:G,formatter:Pt,rotation:Z,spacing:H,minSpacing:H,avoidCollisions:G,format:ta,...dt},interval:{values:Me(Z),step:Z},...Dg,...ce,...te,...pe},segmentation:{enabled:G,spacing:H,interval:{values:Me(Z),step:Z,count:Z}},bar:{enabled:G,...Dg,...ce,...te,...pe},needle:{enabled:G,spacing:H,radiusRatio:ge,...ce,...te,...pe},label:{text:E,spacing:H,...kl},secondaryLabel:{text:E,...kl},tooltip:et,...Ue},kg={...Xm,...ia,type:U(Ce("radial-gauge")),value:U(Z),targets:Rt(Ym,"target options array")};kg.defaultColorRange=me(Me(ae)),kg.defaultTarget=me({...Ym,value:Z,label:{...yt,spacing:Z}}),kg.scale.defaultFill=me(ae);var Ig=J("millisecond","second","minute","hour","day","month","year"),qN={unit:U(Ig),step:yp,epoch:Da,utc:G};qN.every=Pt;var qm=At(qN,"a time interval object"),Jc={enabled:G,text:E,padding:Z,...dt},Fa=Ze({enabled:G,type:U(J("line","range")),range:tt(Ze((e,{options:t})=>t.type==="range","crossLine type to be 'range'"),Me(ke),al(2,2)),value:tt(Ze((e,{options:t})=>t.type==="line","crossLine type to be 'line'"),ke),label:Jc,fill:ae,fillOpacity:ge,...te,...pe},"cross-line options"),Cr={...Fa,label:{...Jc,position:J("top","left","right","bottom","top-left","top-right","bottom-left","bottom-right","inside","inside-left","inside-right","inside-top","inside-bottom","inside-top-left","inside-bottom-left","inside-top-right","inside-bottom-right"),rotation:Z}},Lr={enabled:G,rotation:Z,avoidCollisions:G,minSpacing:H,spacing:H,formatter:Ps(Vs),itemStyler:it({...dt,...Wo,spacing:Z}),...dt,...Wo},Ag={autoRotate:G,autoRotateAngle:Z,wrapping:J("never","always","hyphenate","on-space"),truncate:G,...Lr},UM={format:ta,...Ag},Cg={format:Ie(E,gy),...Ag},QN={enabled:G,width:H,size:H,stroke:ae},Qm={enabled:G,label:Cg,tick:QN},KM={values:Me(ke),minSpacing:H},eh={reverse:G,gridLine:{enabled:G,width:H,style:Rt({fill:ae,fillOpacity:H,stroke:Ie(ae,fy),strokeWidth:H,lineDash:Me(H)},"a grid-line style object array")},interval:KM,label:Lr,line:{enabled:G,width:H,stroke:ae},tick:QN,context:()=>!0};eh.layoutConstraints=me({stacked:U(G),align:U(J("start","end")),unit:U(J("percent","px")),width:U(H)});var Tr={...eh,crossAt:{value:U(Ie(Z,Da,E,Me(E))),sticky:G},keys:Me(E),crossLines:Rt(Cr,"a cross-line options array"),position:J("top","right","bottom","left"),thickness:H,maxThicknessRatio:ge,title:{enabled:G,text:Vs,spacing:H,formatter:Ps(Vs),...dt}};Tr.title._enabledFromTheme=me(G);var Lg={enabled:G,...ce,...te,...pe};function Al(e,t){const i={enabled:G,xOffset:Z,yOffset:Z,formatter:Ps(E),renderer:Ps(Ie(E,At({text:E,color:ae,backgroundColor:ae,opacity:ge},"crosshair label renderer result object")))};let s;return e&&(s={...i,format:t?Ie(E,At({millisecond:E,second:E,hour:E,day:E,month:E,year:E})):E}),{enabled:G,snap:G,label:s??i,...te,...pe}}function Hd(e,t){return{min:tt(e,to("max")),max:tt(e,io("min")),nice:G,interval:{step:t?Ie(yp,Ig,qm):yp,values:Me(e),minSpacing:tt(H,to("maxSpacing")),maxSpacing:tt(H,io("minSpacing"))}}}var YM={step:Ie(yp,Ig,qm),values:Me(Ie(Z,Da)),minSpacing:tt(H,to("maxSpacing")),maxSpacing:tt(H,io("minSpacing")),placement:J("on","between")},Wd=class OV extends sg{constructor(t,i=new zd,s=!0){super(t,i),this.groupPaddingInner=.1,this.includeInvisibleDomains=s,this.nice=!1}static is(t){return t instanceof OV}isCategoryLike(){return!0}hasDefinedDomain(){return!1}normaliseDataDomain(t){return{domain:t,clipped:!1}}updateScale(){super.updateScale();let{paddingInner:t,paddingOuter:i}=this;if(!Ye(t)||!Ye(i)){const s=this.reduceBandScalePadding();t??(t=s.inner),i??(i=s.outer)}this.scale.paddingInner=t??0,this.scale.paddingOuter=i??0}calculateGridLines(t,i,s){const n=super.calculateGridLines(t,i,s);return this.interval.placement==="between"&&t.length>0&&n.push(super.calculateGridLine({index:t.at(-1).index+1,tickId:`after:${t.at(-1).tickId}`,translation:this.range[1]},t.length,i,s,t)),n}calculateGridLine({index:t,tickId:i,translation:s},n,o,a,r){const{gridLine:l,horizontal:c,interval:h,scale:d}=this;if(h.placement!=="between")return super.calculateGridLine({index:t,tickId:i,translation:s},n,o,a,r);const u=so[0]+a.step/2,h=t.at(-1),d=n&&h.translationthis.calculateGridFill(u,p,u.index,i,s,t))),d){const u={tickId:`after:${h.tickId}`,translation:h.translation+a.step};r.push(this.calculateGridFill(u,t.length,h.index+1,i,s,t))}return r}calculateGridFill({tickId:t,translation:i},s,n,o,a,r){const{gridLine:l,horizontal:c,interval:h,scale:d}=this;if(h.placement!=="between")return super.calculateGridFill({tickId:t,translation:i},s,n,o,a,r);const u=i-d.step/2,p=i+d.step/2,[g,f,x,m]=c?[u,Math.max(o,a),p,Math.min(o,a)]:[Math.min(o,a),u,Math.max(o,a),p],{fill:v,fillOpacity:b}=l.style[n%l.style.length]??{};return{tickId:t,x1:g,y1:f,x2:x,y2:m,fill:v,fillOpacity:b}}calculateTickLines(t,i){const s=super.calculateTickLines(t,i);return this.interval.placement==="between"&&t.length>0&&s.push(super.calculateTickLine({isPrimary:!1,tickId:`after:${t.at(-1)?.tickId}`,translation:this.range[1]},t.length,i,t)),s}calculateTickLine({isPrimary:t,tickId:i,translation:s},n,o,a){const{horizontal:r,interval:l,primaryTick:c,scale:h,tick:d}=this;if(l.placement!=="between")return super.calculateTickLine({isPrimary:t,tickId:i,translation:s},n,o,a);const u=t&&c?.enabled?c:d,p=-o*this.getTickSize(u),g=s{const s=i.getBandScalePadding?.();return s&&(t.inner>s.inner&&(t.inner=s.inner),t.outertypeof g!="string")?t=t.map(String):!Array.isArray(t)&&typeof t!="string"&&typeof t!="number"&&!(t instanceof Date)&&(t=String(t)),{type:"category",value:t,datum:a,seriesId:r,legendItemName:l,key:c,source:h,property:d,domain:u,boundSeries:p}}};Wd.className="CategoryAxis",Wd.type="category",M([C],Wd.prototype,"groupPaddingInner",2),M([C],Wd.prototype,"paddingInner",2),M([C],Wd.prototype,"paddingOuter",2);var $d=Wd,JN=class EV extends zd{static is(t){return t instanceof EV}normalizeDomains(...t){const{domain:i}=super.normalizeDomains(...t);return{domain:i,animatable:!1}}findIndex(t){return super.findIndex(t)??this.getMatchIndex(t)}getMatchIndex(t){const i=JSON.stringify(t),s=this._domain.find(n=>JSON.stringify(n)===i);if(s!=null)return super.findIndex(s)}};function Cl(e){if(e.length===0)return null;let t=1/0,i=-1/0;for(const n of e){const o=n instanceof Date?n.getTime():n;typeof o=="number"&&(oi&&(i=o))}const s=[t,i];return s.every(Number.isFinite)?s:null}function ZM(e,t,i){let s=!1;const n=Cl(e);if(n==null)return{extent:t!=null&&i!=null&&t<=i?[t,i]:[],clipped:!1};let[o,a]=n;return t!=null&&(s||(s=t>o),o=t),i!=null&&(s||(s=ia?{extent:[],clipped:!1}:{extent:[o,a],clipped:s}}function Jm(e,t=[0,0]){for(const i of e)typeof i=="number"&&(i<0&&(t[0]+=i),i>0&&(t[1]+=i));return t}function LU(e,t){return{id:e,matchGroupIds:[t],type:"aggregate",aggregateFunction:s=>Jm(s)}}function e2(e,t){const i=t?.visible??!0;return{id:e,type:"aggregate",matchGroupIds:t?.matchGroupId?[t?.matchGroupId]:void 0,aggregateFunction:s=>Jm(s),groupAggregateFunction:(s,n=[0,0])=>(i&&(n[0]+=s?.[0]??0,n[1]+=s?.[1]??0),n)}}function TU(e,t){return{id:e,matchGroupIds:[t],type:"aggregate",aggregateFunction:s=>lo.extendDomain(s)}}function XM(e,t){const i=t?.visible??!0;return{id:e,type:"aggregate",aggregateFunction:()=>[0,1],groupAggregateFunction:(s,n=[0,0])=>(i&&(n[0]+=s?.[0]??0,n[1]+=s?.[1]??0),n)}}function t2(e,t){const i=t?.visible??!0;return{id:e,matchGroupIds:t?.matchGroupId?[t?.matchGroupId]:void 0,type:"aggregate",aggregateFunction:n=>Jm(n),groupAggregateFunction:(n,o=[0,0,-1])=>(i&&(o[0]+=n?.[0]??0,o[2]++,o[1]+=n?.[1]??0),o),finalFunction:(n=[0,0,0])=>{const o=n[0]+n[1];return o>=0?[0,o/n[2]]:[o/n[2],0]}}}function qM(e,t,i){const s={id:e,matchGroupIds:i?[i]:void 0,type:"aggregate",aggregateFunction:(n,o=[])=>{const a=o[1]-o[0];return t.aggregateFunction(n).map(r=>r/a)}};return t.groupAggregateFunction&&(s.groupAggregateFunction=t.groupAggregateFunction),s}function i2(e){return()=>{let t=0;return i=>Ye(i)?(t+=e?Math.max(0,i):i,t):i}}function s2(){return()=>{let e=0;return t=>{if(!Ye(t))return t;const i=e;return e+=t,i}}}var wU=1e3;function Ud(e){return e.input.count<=wU}function n2(e){return e!=null&&dm(e)}function NU(e){return e!=null}function o2(e){switch(e){case"number":case"log":case"time":case"unit-time":case"ordinal-time":case"color":return n2;default:return NU}}function a2(e){switch(e){case"number":case"log":case"time":case"color":return"range";default:return"category"}}function Ll(e,t,i={}){return{property:e,type:"key",valueType:a2(t),validation:o2(t),...i}}function Dt(e,t,i={}){return{property:e,type:"value",valueType:a2(t),validation:o2(t),...i}}function r2(e,t={}){return{property:e,type:"value",valueType:"range",missingValue:1,processor:()=>()=>1,...t}}var OU=function(e){return e};function l2(...e){const t=e.filter(i=>i!=null);return t.length===0?()=>OU:t.length===1?t[0]:()=>{const i=t.map(s=>s());return(s,n)=>i.reduce((o,a)=>a(o,n),s)}}function c2(e,t={}){const{min:i=-1/0,max:s=1/0,processor:n,...o}=t;return{type:"value",property:e,valueType:"range",validation:n2,processor:l2(n,()=>a=>Ye(a)?ve(i,a,s):a),...o}}function QM(e,t,i={}){const{onlyPositive:s,processor:n,...o}=i;return{...Dt(e,t,o),processor:l2(n,i2(s))}}function EU(e,t,i={}){return{...Dt(e,t,i),processor:s2()}}function Tg(e,t,i,s){return[Dt(e,s,i),g2(i.groupId,t,i.separateNegative),...i.rangeId==null?[]:[TU(i.rangeId,i.groupId)]]}var h2={type:"reducer",property:"smallestKeyInterval",initialValue:1/0,reducer:()=>{let e=Number.NaN;return(t,i)=>{const s=typeof i[0]=="number"?i[0]:Number(i[0]),n=Math.abs(s-e);e=s;const o=t??1/0;return!Number.isNaN(n)&&n>0&&n{let e=Number.NaN;return(t,i)=>{const s=typeof i[0]=="number"?i[0]:Number(i[0]),n=Math.abs(s-e);e=s;const o=t??-1/0;return!Number.isNaN(n)&&n>0&&n>o?n:o}}},u2={type:"processor",property:"sortedGroupDomain",calculate:({domain:{groups:e}})=>e?.slice().sort((t,i)=>{for(let s=0;s{if(s===0)return 0;const n=(i??0)*e/s;return n>=0?Math.min(e,n):Math.max(-e,n)};return()=>()=>(i,s,n,o)=>{const a=RU(i,s,n,o);for(const r of s){const l=n.datumIndices[r];if(l!=null)for(const c of l){const h=o+c,d=i[r],u=d[h];if(u==null){d[h]=void 0;continue}d[h]=t(u,a)}}}}function RU(e,t,i,s){const n=[0,0];for(const o of t){const a=e[o],r=i.datumIndices[o];if(r!=null)for(const l of r){const c=s+l,h=a[c];if(h==null)continue;const d=typeof h=="number"?h:Math.max(...h.map(p=>p??0)),u=d<0?0:1;u===0?n[u]=Math.min(n[u],d):n[u]=Math.max(n[u],d)}}return Math.max(Math.abs(n[0]),n[1])}function ex(e,t){return{type:"group-value-processor",matchGroupIds:e,adjust:tm({normaliseTo:t},PU)}}function zU({normaliseTo:e,zeroDomain:t,rangeMin:i,rangeMax:s}){const n=e[1]-e[0],o=(a,r,l)=>{const c=e[0]+(a-r)/l*n;return l===0?t:c>=e[1]?e[1]:c(a,r)=>{let[l,c]=a.domain.values[r];i!=null&&(l=i),s!=null&&(c=s);const h=c-l;a.domain.values[r]=[e[0],e[1]];const d=a.columns[r];for(let u=0;ur)&&(n&=~ix),Number.isFinite(r)&&o===r&&(n&=~wg),o=r}return n}function Ng(e){return{type:"processor",property:"animationValidation",calculate(t){if(!Ud(t))return;const{keys:i,values:s}=t.defs,{input:n,domain:{keys:o,values:a},keys:r,columns:l,invalidKeyCount:c}=t;let h=wg|ix;if(n.count!==0){for(let d=0;h!==0&&d()=>(i,s,n,o)=>{const a=[0,0];for(const r of s){const l=n.datumIndices[r];if(l==null)continue;const c=a[0],h=a[1],d=i[r];let u=!1;for(const p of l){const g=o+p,f=d[g];if(!Ye(f))continue;const x=t&&CS(f),m=x?c:h;if(e==="normal"?d[g]=m+f:d[g]=m,!u){const v=x?0:1;a[v]=m+f,u=!0}}}}}function g2(e,t,i=!1){const s=tm({mode:t,separateNegative:i},FU);return{type:"group-value-processor",matchGroupIds:[e],adjust:s,supportsReprocessing:!0}}function f2(e){return e.id??e.property}function BU(e,t,i){const s=new Map,n=t.defs.values;for(let r=0;rm.get(e)),h=s.keys.map(m=>m.get(e)),d=t.columns,u=s.columns,p=BU(e,t,s);if(p==null)return n;const g=Math.max(t.input.count,s.input.count);for(let m=0;m0||r.size>0||l.size>0,added:new Set(a.keys()),updated:new Set(r.keys()),removed:new Set(l.keys()),moved:new Set(o.keys())};return{...n,[e]:x}}}}function Gs(...e){if(e.length===1){const t=rM(e[0]);if(typeof t=="boolean"||typeof t=="number"||typeof t=="string")return t}return e.map(t=>rM(t)).join("___")}var _U=class{constructor(){this.top=1/0,this.right=-1/0,this.bottom=-1/0,this.left=1/0}update(e,t){e>this.right&&(this.right=e),ethis.bottom&&(this.bottom=t),th.label===a);if(c&&r)s=c,n=c;else{const h=new PV(a,s,i);h.index=l.length,l.push(h),r&&(s=h),n=h}}return n}getLeftSibling(){return this.index>0?this.parent?.children[this.index-1]:void 0}getLeftmostSibling(){return this.index>0?this.parent?.children[0]:void 0}nextLeft(){return this.children[0]}nextRight(){return this.children.at(-1)}getSiblings(){return this.parent?.children.filter((t,i)=>i!==this.index)??[]}};function GU(e){const t=e.reduce((n,o)=>Math.max(n,o.length),0),i=new VU,s=new Map;for(let n=0;n=0;s--){const n=e[s];n.prelim+=t,n.mod+=t,i+=n.change,t+=n.shift+i}}function $U(e,t){const i=e.getLeftSibling();if(i){let s=e,n=e,o=i,a=n.getLeftmostSibling(),r=n.mod,l=s.mod,c=o.mod,h=a.mod;for(;o.nextRight()&&n.nextLeft();){o=o.nextRight(),n=n.nextLeft(),a=a.nextLeft(),s=s.nextRight(),s.ancestor=e;const d=o.prelim+c-(n.prelim+r)+1;d>0&&(jU(HU(o,e,t),e,d),r+=d,l+=d),c+=o.mod,r+=n.mod,h+=a.mod,l+=s.mod}o.nextRight()&&!s.nextRight()?s.mod+=c-l:(n.nextLeft()&&!a.nextLeft()&&(a.mod+=r-h),t=e)}return t}function y2(e){const{children:t}=e;if(t.length){let[i]=t;for(const o of t)y2(o),i=$U(o,i);WU(e);const s=(t[0].prelim+t.at(-1).prelim)/2,n=e.getLeftSibling();n?(e.prelim=n.prelim+1,e.mod=e.prelim-s):e.prelim=s}else{const i=e.getLeftSibling();e.prelim=i?i.prelim+1:0}}function m2(e,t,i){e.position=e.prelim+t,i.insertNode(e);for(const s of e.children)m2(s,t+e.mod,i)}function x2(e){const{children:t}=e;let i=0;for(const s of t)x2(s),s.children.length?i+=s.leafCount:i++;e.leafCount=i,t.length?(e.subtreeLeft=t[0].subtreeLeft,e.subtreeRight=t.at(-1).subtreeRight,e.position=(e.subtreeLeft+e.subtreeRight)/2):(e.subtreeLeft=e.position,e.subtreeRight=e.position)}function UU(e){const t=new KU,{root:i,tickNodes:s}=GU(e);return y2(i),m2(i,-i.prelim,t),x2(i),{layout:t,tickNodes:s}}var KU=class{constructor(){this.dimensions=new _U,this.nodes=[],this.depth=0}insertNode(e){this.depth0){const{left:s,right:n}=this.dimensions;n!==s&&(i=e/(n-s))}return t&&(i*=-1),i}},Og=5,js=class extends Le{constructor(){super(...arguments),this.enabled=!0,this.border=new Fc}};M([C],js.prototype,"enabled",2),M([C],js.prototype,"avoidCollisions",2),M([C],js.prototype,"border",2),M([C],js.prototype,"color",2),M([C],js.prototype,"cornerRadius",2),M([C],js.prototype,"spacing",2),M([C],js.prototype,"rotation",2),M([C],js.prototype,"wrapping",2),M([C],js.prototype,"truncate",2),M([C],js.prototype,"fill",2),M([C],js.prototype,"fontStyle",2),M([C],js.prototype,"fontWeight",2),M([C],js.prototype,"fontSize",2),M([C],js.prototype,"fontFamily",2),M([C],js.prototype,"padding",2);var nx=class extends Le{constructor(){super(...arguments),this.enabled=!0}};M([C],nx.prototype,"enabled",2),M([C],nx.prototype,"width",2),M([C],nx.prototype,"stroke",2);var eD=class extends Le{constructor(){super(...arguments),this.label=new js,this.tick=new nx}};M([C],eD.prototype,"label",2),M([C],eD.prototype,"tick",2);var th=class extends $d{constructor(e){super(e,new JN),this.tickScale=new JN,this.computedLayout=void 0,this.tickTreeLayout=void 0,this.tickNodes=void 0,this.depthOptions=new ud(eD),this.includeInvisibleDomains=!0,this.tickScale.paddingInner=1,this.tickScale.paddingOuter=0}resizeTickTree(){if(!this.tickTreeLayout)return;const{nodes:e}=this.tickTreeLayout,{range:t,step:i,inset:s,bandwidth:n}=this.scale,o=Math.abs(t[1]-t[0])-i,a=this.tickTreeLayout.scaling(o,t[0]>t[1]),r=s+n/2;let l=0;for(const c of e){const h=c.position*a;l>h&&(l=h),c.screen=h+r}for(const c of e)c.screen-=l}getDepthOptionsMap(e){const t=[],{depthOptions:i,label:s}=this,n=this.horizontal?0:-90;for(let o=0;o{e.fill=t.color,e.text=t.text,e.textBaseline=t.textBaseline,e.textAlign=t.textAlign??"center",e.setFont(t),e.setBoxing(t)})}updateAxisLine(){this.computedLayout&&(this.lineNode.visible=this.line.enabled,this.lineNode.stroke=this.line.stroke,this.lineNode.strokeWidth=this.line.width)}computeLayout(){this.updateDirection(),this.updateScale();const{step:e}=this.scale,{title:t,label:i,range:s,depthOptions:n,horizontal:o,line:a}=this;if(this.lineNode.datum=o?{x1:s[0],x2:s[1],y1:0,y2:0}:{x1:0,x2:0,y1:s[0],y2:s[1]},this.lineNode.setProperties({stroke:a.stroke,strokeWidth:a.enabled?a.width:0}),this.resizeTickTree(),!this.tickTreeLayout?.depth)return{bbox:de.zero,spacing:0,depthLabelMaxSize:{},tickLabelLayout:[]};const{depth:r,nodes:l}=this.tickTreeLayout,c=o?-i.getSideFlag():i.getSideFlag(),h=[],d=new Map,u=new vd,p=this.getDepthOptionsMap(r),g=c*p[0].spacing,f=this.tickFormatter(this.scale.domain,this.scale.domain,!1),x=(A,T)=>{const w=r-A.depth;if(!p[w]?.enabled||!rG(A.screen,s))return!1;let N=(A.leafCount||1)*e;if(N{if(A===0)return 0;let T=m[0];for(let w=1;w<=A;w++)T+=p[w].spacing,w!==A&&(T+=m[w]);return T};for(const[A,T]of l.entries()){if(A===0)continue;const w=x(T,A),N=!T.children.length,O=r-T.depth;if(N&&eY){d.delete(A);continue}}const R=u.getPlainText(),V=u.getBoxingProperties();h.push({text:R,visible:!0,tickId:v(R),range:this.scale.range,border:V.border,color:u.fill,cornerRadius:V.cornerRadius,fill:V.fill,fontFamily:u.fontFamily,fontSize:u.fontSize,fontStyle:u.fontStyle,fontWeight:u.fontWeight,padding:V.padding,rotation:u.rotation,rotationCenterX:u.rotationCenterX,rotationCenterY:u.rotationCenterY,textAlign:u.textAlign,textBaseline:u.textBaseline,x:u.x,y:u.y}),d.set(A,zt.toCanvas(u))}let S=m[0];for(let A=0;AOg){const v={nice:!1,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0};x=e.ticks(v,void 0,n).ticks}else x=[];const m=x.map((v,b)=>({index:e.findIndex(v),tickId:Gs(b,...v),translation:Math.round(e.convert(v))}));this.gridLineGroupSelection.update(i.enabled&&s?this.calculateGridLines(m,g,f):[]),this.gridFillGroupSelection.update(i.enabled&&s?this.calculateGridFills(m,g,f):[]),this.tickLineGroupSelection.update(t.enabled?x.map((v,b)=>{const{tickId:S,translation:D}=m[b],L=this.tickNodes?.get(v),I=L==null?l-1:Math.min(YU(L),l-1),A=this.depthOptions[I]?.tick;let T=a[0];for(let R=0;R<=I;R++)T+=c[R].spacing,R!==0&&(T+=a[R]);const w=A?.stroke??t.stroke,N=A?.enabled===!1?0:A?.width??t.width,O=-p*T,[P,F,_,z]=d?[D,D,0,O]:[0,O,D,D];return{tickId:S,offset:D,x1:P,y1:_,x2:F,y2:z,stroke:w,strokeWidth:N,lineDash:void 0}}):[]),this.updatePosition(),this.updateCategoryLabels(),this.updateAxisLine(),this.updateGridLines(),this.updateGridFills(),this.updateTickLines(),this.updateTitle(this.scale.domain,r),this.updateCrossLines(),this.resetSelectionNodes()}calculateLayout(){const{depthLabelMaxSize:e,tickLabelLayout:t,spacing:i,bbox:s}=this.computeLayout();return this.computedLayout={depthLabelMaxSize:e,tickLabelLayout:t,spacing:i},{bbox:s,niceDomain:this.scale.domain}}onGridVisibilityChange(){super.onGridVisibilityChange(),this.tickLabelGroupSelection.clear()}updateScale(){super.updateScale(),this.tickScale.range=this.scale.range,this.scale.paddingOuter=this.scale.paddingInner/2}processData(){const{direction:e}=this,t=this.boundSeries.filter(l=>l.visible).flatMap(l=>l.getDomain(e));this.dataDomain={domain:Cl(t)??this.filterDuplicateArrays(t),clipped:!1},this.isReversed()&&this.dataDomain.domain.reverse();const i=this.dataDomain.domain.map(b2),{layout:s,tickNodes:n}=UU(i);this.tickTreeLayout=s,this.tickNodes=n;const o=[];for(const l of this.tickTreeLayout.nodes)l.leafCount||l.refId==null||o.push(this.dataDomain.domain[l.refId]);const a=UG(this.dataDomain.domain,o);this.scale.domain=a;const r=a.map(b2);r.push([""]),this.tickScale.domain=r}filterDuplicateArrays(e){const t=new Set;return e.filter(i=>{const s=Ne(i)?JSON.stringify(i):i;return t.has(s)?!1:(t.add(s),!0)})}};th.className="GroupedCategoryAxis",th.type="grouped-category",M([C],th.prototype,"depthOptions",2);function YU(e){let t=0,i=e;for(;i?.index===0;)t+=1,i=i.parent;return t}function b2(e){return xy(Ee(e)&&"value"in e?e.value:e)}var ZU={2:(e,t)=>Math.log2(t),[Math.E]:(e,t)=>Math.log(t),10:(e,t)=>Math.log10(t)},XU=(e,t)=>Math.log(t)/Math.log(e);function tD(e,t,i){const s=Math.min(...t),n=ZU[e]??XU;return s>=0?n(e,i):-n(e,-i)}var qU={[Math.E]:(e,t)=>Math.exp(t),10:(e,t)=>t>=0?10**t:1/10**-t},QU=(e,t)=>e**t;function iD(e,t,i){const s=Math.min(...t),n=qU[e]??QU;return s>=0?n(e,i):-n(e,-i)}var sD=class RV extends ut{constructor(t=[1,10],i=[0,1]){super(t,i),this.type="log",this.defaultClamp=!0,this.base=10,this.log=s=>tD(this.base,this.domain,s),this.pow=s=>iD(this.base,this.domain,s)}static is(t){return t instanceof RV}transform(t){const[i,s]=Wi(this.domain);return i>=0!=s>=0?Number.NaN:i>=0?Math.log(t):-Math.log(-t)}transformInvert(t){const[i,s]=Wi(this.domain);return i>=0!=s>=0?Number.NaN:i>=0?Math.exp(t):-Math.exp(-t)}toDomain(t){return t}niceDomain(t,i=this.domain){if(i.length<2)return[];const{base:s}=this,[n,o]=i,a=n>o?Math.ceil:Math.floor,r=n>o?Math.floor:Math.ceil,l=iD(s,i,a(tD(s,i,n))),c=iD(s,i,r(tD(s,i,o)));return[l,c]}ticks({interval:t,tickCount:i=ut.defaultTickCount},s=this.domain,n){if(!s||s.length<2||i<1)return;const o=this.base,[a,r]=s,l=Math.min(a,r),c=Math.max(a,r);let h=this.log(l),d=this.log(c);if(t){const x=L=>L>=l&&L<=c,m=Math.min(Math.abs(t),Math.abs(d-h)),{ticks:v,count:b,firstTickIndex:S}=vm(h,d,m,n),D=v.map(this.pow).filter(x);if(!Fd(D.length,this.getPixelRange()))return{ticks:D,count:b,firstTickIndex:S}}if(!lG(o)||d-h>=i){const x=Math.min(d-h,i),{ticks:m,count:v,firstTickIndex:b}=eg(h,d,x,void 0,void 0,n);return{ticks:m.map(this.pow),count:v,firstTickIndex:b}}const u=[],p=l>0;h=Math.floor(h)-1,d=Math.round(d)+1;const g=Pc(this.range)/i;let f=1/0;for(let x=h;x<=d;x++){const m=this.convert(this.pow(x+1));for(let v=1;v=g&&I>=g;S>=l&&S<=c&&(v===1||A||u.length===0)&&(u.push(S),f=D)}}return Hw(u,p,n)}},ih=class AC extends ut{constructor(){super([0,1],[0,1]),this.type="number"}static is(t){return t instanceof AC}static getTickStep(t,i,s){const{interval:n,tickCount:o=ut.defaultTickCount,minTickCount:a,maxTickCount:r}=s;return n??tg(t,i,o,a,r)}toDomain(t){return t}ticks({interval:t,tickCount:i=ut.defaultTickCount,minTickCount:s,maxTickCount:n},o=this.domain,a){if(!o||o.length<2||i<1||!o.every(Number.isFinite))return{ticks:[],count:0,firstTickIndex:0};const[r,l]=o;if(t){const c=Math.abs(t);if(!Fd((l-r)/c,this.getPixelRange()))return vm(r,l,c,a)}return eg(r,l,i,s,n,a)}niceDomain(t,i=this.domain){if(i.length<2)return[];const{tickCount:s=ut.defaultTickCount}=t;let[n,o]=i;if(s===1)[n,o]=qw(n,o);else if(s>1){const a=n>o?Math.ceil:Math.floor,r=n>o?Math.floor:Math.ceil,l=4;for(let c=0;c0||e[0]<0&&e[1]>0?(K.warn("The log axis domain crosses zero, the chart data cannot be rendered. See log axis documentation for more information."),{domain:[],clipped:n}):s[0]===0||s[1]===0||e[0]===0||e[1]===0?(K.warn("The log axis domain contains a value of 0, the chart data cannot be rendered. See log axis documentation for more information."),{domain:[],clipped:n}):{domain:s,clipped:n}}set base(e){this.scale.base=e}get base(){return this.scale.base}constructor(e){super(e,new sD)}};sh.className="LogAxis",sh.type="log";var Kd=class extends Le{constructor(){super(...arguments),this.enabled=!1,this.label=new It,this.tick=new _c}};M([C],Kd.prototype,"enabled",2),M([C],Kd.prototype,"label",2),M([C],Kd.prototype,"tick",2);var wr=class extends sg{constructor(e){super(e,new Bd),this.parentLevel=new Kd,this.min=void 0,this.max=void 0}get _unit(){}set _unit(e){K.warnOnce("To use 'unit', use an axis with type 'unit-time' instead of 'time'.")}hasDefinedDomain(){const{min:e,max:t}=this;return e!=null&&t!=null&&eMath.min(a.minTimeInterval()??1/0,o),1/0);return Number.isFinite(n)?Jp(n):S2(e,t,i,s)?.unit}function S2(e,t,i,s){let n=1/0,o=-1/0,a,r=0;const l=[];for(const u of e){if(!u.visible)continue;const{domain:p}=nD(u.getDomain(t),void 0,void 0);if(p.length===0)continue;const g=p[0].valueOf(),f=p.at(-1).valueOf();l.push(g,f),n=Math.min(n??1/0,g,f),o=Math.max(o??-1/0,g,f);const x=Math.abs(f-g);if(x===0)continue;const m=u.dataCount();if(r=Math.max(r,m),m<=1)continue;const v=x/(m-1);a=Math.min(a??1/0,v)}if(n=Math.min(n,i?.valueOf()??1/0,s?.valueOf()??1/0),o=Math.max(o,i?.valueOf()??-1/0,s?.valueOf()??-1/0),!Number.isFinite(n)||!Number.isFinite(o))return;a??(a=Math.abs(o-n)),a=Math.min(a,JU(l));const c=Jp(a);let h=a/yn(c);r<=2?h=Math.floor(h):h=Math.round(h),h=Math.max(h,1);const d=h===1?void 0:uo(c,n);return{unit:c,step:h,epoch:d}}function JU(e){e.sort((i,s)=>i-s);let t=1/0;for(let i=1;i0&&(t=Math.min(t,Math.abs(n-s)))}return t}function nD(e,t,i){let s=!1;typeof t=="number"&&(t=new Date(t)),typeof i=="number"&&(i=new Date(i));const n=Cl(e)?.map(r=>new Date(r));if(n==null)return{domain:t!=null&&i!=null&&t.valueOf()<=i.valueOf()?[t,i]:[],clipped:!1};let[o,a]=n;return t instanceof Date&&(s||(s=t>o),o=t),i instanceof Date&&(s||(s=ia?{domain:[],clipped:!1}:{domain:[o,a],clipped:s}}var M2=class extends $d{calculateGridLine({index:e,tickId:t,translation:i},s,n,o,a){const{gridLine:r,horizontal:l,interval:c,range:h}=this;if(c.placement!=="between")return super.calculateGridLine({index:e,tickId:t,translation:i},s,n,o,a);const d=a[s-1],u=d?i-(i-d.translation)/2:h[0],[p,g,f,x]=l?[u,Math.max(n,o),u,Math.min(n,o)]:[Math.min(n,o),u,Math.max(n,o),u],{style:m}=r,{stroke:v,strokeWidth:b=0,lineDash:S}=m[e%m.length]??{};return{tickId:t,offset:u,x1:p,y1:g,x2:f,y2:x,stroke:v,strokeWidth:b,lineDash:S}}calculateGridFills(e,t,i){return this.interval.placement!=="between"?super.calculateGridFills(e,t,i):e.map((s,n)=>this.calculateGridFill(s,n,s.index,t,i,e))}calculateGridFill({tickId:e,translation:t},i,s,n,o,a){const{gridLine:r,horizontal:l,interval:c,range:h}=this;if(c.placement!=="between")return super.calculateGridFill({tickId:e,translation:t},i,s,n,o,a);const d=a[i-1],u=a[i+1],p=d?t-(t-d.translation)/2:h[0],g=u?t+(u.translation-t)/2:h[1],[f,x,m,v]=l?[p,Math.max(n,o),g,Math.min(n,o)]:[Math.min(n,o),p,Math.max(n,o),g],{fill:b,fillOpacity:S}=r.style[s%r.style.length]??{};return{tickId:e,x1:f,y1:x,x2:m,y2:v,fill:b,fillOpacity:S}}calculateTickLine({isPrimary:e,tickId:t,translation:i},s,n,o){const{horizontal:a,interval:r,primaryTick:l,range:c,tick:h}=this;if(r.placement!=="between")return super.calculateTickLine({isPrimary:e,tickId:t,translation:i},s,n,o);const d=e&&l?.enabled?l:h,u=-n*this.getTickSize(d),p=o[s-1],g=p?i-(i-p.translation)/2:c[0],[f,x,m,v]=a?[g,0,g,u]:[0,g,u,g],{stroke:b,width:S}=d;return{tickId:t,offset:g,x1:f,y1:x,x2:m,y2:v,stroke:b,strokeWidth:S,lineDash:void 0}}},Tl=class extends M2{constructor(e){super(e,new ml,!1),this.parentLevel=new Kd,this.min=void 0,this.max=void 0,this.unit=void 0,this.defaultUnit=void 0}get primaryLabel(){return this.parentLevel.enabled?this.parentLevel.label:void 0}get primaryTick(){return this.parentLevel.enabled?this.parentLevel.tick:void 0}hasDefinedDomain(){const{min:e,max:t}=this;return e!=null&&t!=null&&ee!==1,"not equal to 1")),label:UM,crosshair:Al(!0)},Xd={...Tr,...Hd(Ie(Z,Da),!0),type:U(Ce("time")),label:Cg,parentLevel:Qm,crosshair:Al(!0,!0)},qd={...Tr,type:U(Ce("category")),label:Ag,paddingInner:ge,paddingOuter:ge,groupPaddingInner:ge,crosshair:Al(),bandHighlight:Lg,interval:{...KM,placement:J("on","between")}},Qd={...Tr,type:U(Ce("grouped-category")),label:Ag,crosshair:Al(),bandHighlight:Lg,paddingInner:ge,groupPaddingInner:ge,depthOptions:Rt({label:{enabled:G,avoidCollisions:G,wrapping:J("never","always","hyphenate","on-space"),truncate:G,rotation:Z,spacing:Z,...dt,...Wo},tick:{enabled:G,stroke:ae,width:H}},"depth options objects array")},Jd={...Tr,type:U(Ce("unit-time")),unit:Ie(qm,Ig),label:Cg,parentLevel:Qm,paddingInner:ge,paddingOuter:ge,groupPaddingInner:ge,crosshair:Al(!0,!0),bandHighlight:Lg,min:tt(Ie(Z,Da),to("max")),max:tt(Ie(Z,Da),io("min")),interval:YM},eK={type:"axis",name:"number",chartType:"cartesian",options:Yd,create:e=>new _n(e)},tK={type:"axis",name:"log",chartType:"cartesian",options:Zd,create:e=>new sh(e)},iK={type:"axis",name:"time",chartType:"cartesian",options:Xd,create:e=>new wr(e)},sK={type:"axis",name:"category",chartType:"cartesian",options:qd,create:e=>new $d(e)},nK={type:"axis",name:"grouped-category",chartType:"cartesian",options:Qd,create:e=>new th(e)},oK={type:"axis",name:"unit-time",chartType:"cartesian",options:Jd,create:e=>new Tl(e)},eu={...Tr,type:U(Ce("ordinal-time")),paddingInner:ge,paddingOuter:ge,groupPaddingInner:ge,label:Cg,parentLevel:Qm,interval:YM,crosshair:Al(!0,!0),bandHighlight:Lg},D2={...eh,...Hd(Z),type:U(Ce("angle-number")),crossLines:Rt(Fa),startAngle:Z,endAngle:Z,label:{...Lr,orientation:J("fixed","parallel","perpendicular"),format:ta}},oD={...eh,type:U(Ce("angle-category")),shape:J("polygon","circle"),crossLines:Rt(Fa),startAngle:Z,endAngle:Z,paddingInner:ge,groupPaddingInner:ge,label:{...Lr,orientation:J("fixed","parallel","perpendicular")}};oD.innerRadiusRatio=ge;var k2={...eh,...Hd(Z),type:U(Ce("radius-number")),shape:J("polygon","circle"),positionAngle:Z,innerRadiusRatio:ge,crossLines:Rt({...Fa,label:{...Jc,positionAngle:Z}},"cross-line options"),title:{enabled:G,text:Vs,spacing:H,formatter:Ps(Vs),...dt},label:{...Lr,format:ta}},I2={...eh,type:U(Ce("radius-category")),positionAngle:Z,innerRadiusRatio:ge,paddingInner:ge,paddingOuter:ge,groupPaddingInner:ge,label:Lr,crossLines:Rt({...Fa,label:{...Jc,positionAngle:Z}},"cross-line options"),title:{enabled:G,text:Vs,spacing:H,formatter:Ps(Vs),...dt}},A2=ei(Ct,Ct),aK=it({...te,...ce,...pe,marker:Dl}),C2={showInMiniChart:G,connectMissingData:G,interpolation:Um,label:yt,styler:aK,marker:sa,tooltip:et,shadow:za,...Ue,...ce,...te,...pe,highlight:A2,segmentation:rl},L2={...C2,...ia,highlight:A2,type:U(Ce("area")),xKey:U(E),yKey:U(E),xName:E,yName:E,legendItemName:E,stacked:G,stackGroup:E,normalizedTo:Z},T2=ei(ka,ka),w2=it({...ce,...te,...pe,cornerRadius:H}),aD={direction:J("horizontal","vertical"),showInMiniChart:G,cornerRadius:H,styler:w2,itemStyler:w2,crisp:G,label:{...yt,placement:J("inside-center","inside-start","inside-end","outside-start","outside-end"),spacing:H},errorBar:Mg,shadow:za,tooltip:et,...Ue,highlight:T2,...ce,...te,...pe,segmentation:rl};aD.sparklineMode=me(G);var ox={...aD,...ia,highlight:T2,type:U(Ce("bar")),xKey:U(E),yKey:U(E),xName:E,yName:E,direction:J("horizontal","vertical"),grouped:G,stacked:G,stackGroup:E,normalizedTo:Z,legendItemName:E,errorBar:$m};ox.pickOutsideVisibleMinorAxis=me(G),ox.focusPriority=me(Z);var N2={title:E,domain:Me(Z),maxSize:H,showInMiniChart:G,label:{placement:J("top","right","bottom","left"),...yt},tooltip:et,styler:it({...sa,maxSize:H}),maxRenderedItems:Z,...Ue,...re(sa,["enabled"]),highlight:ei(Ct,Ct)},rK={...N2,...ia,type:U(Ce("bubble")),xKey:U(E),yKey:U(E),sizeKey:U(E),labelKey:E,xName:E,yName:E,sizeName:E,labelName:E,legendItemName:E,highlight:ei(Ct,Ct)},O2={showInMiniChart:G,cornerRadius:H,label:yt,tooltip:et,shadow:za,...Ue,...ce,...te,...pe,highlight:ei(Ct,Ct),areaPlot:G,aggregation:J("count","sum","mean"),bins:Me(Me(Z)),binCount:H},lK={...ia,...O2,type:U(Ce("histogram")),xKey:U(E),yKey:E,xName:E,yName:E},E2=ei(Ct,Mc),cK=it({...te,...pe,marker:Dl}),rD={title:E,showInMiniChart:G,connectMissingData:G,interpolation:Um,label:yt,styler:cK,marker:sa,tooltip:et,errorBar:Mg,...Ue,...te,...pe,highlight:E2,segmentation:HG};rD.sparklineMode=me(G);var ax={...rD,...ia,highlight:E2,type:U(Ce("line")),xKey:U(E),yKey:U(E),xName:E,yName:E,stacked:G,stackGroup:E,normalizedTo:Z,legendItemName:E,errorBar:$m};ax.pickOutsideVisibleMinorAxis=me(G),ax.focusPriority=me(Z);var P2={title:E,showInMiniChart:G,label:{placement:J("top","right","bottom","left"),...yt},tooltip:et,errorBar:Mg,styler:it(sa),maxRenderedItems:Z,...Ue,...re(sa,["enabled"]),highlight:ei(Ct,Ct)},hK={...P2,...ia,type:U(Ce("scatter")),xKey:U(E),yKey:U(E),labelKey:E,xName:E,yName:E,labelName:E,legendItemName:E,errorBar:$m,highlight:ei(Ct,Ct)},R2=ei(Ct,Ct),lD={...Ue,radiusMin:H,radiusMax:H,rotation:Z,outerRadiusOffset:Z,outerRadiusRatio:ge,hideZeroValueSectorsInLegend:G,sectorSpacing:H,cornerRadius:H,itemStyler:it({...ce,...te,...pe,cornerRadius:H}),title:{enabled:G,text:E,showInLegend:G,spacing:H,...dt},calloutLabel:{enabled:G,offset:Z,minAngle:H,avoidCollisions:G,formatter:Ps(Vs),format:E,itemStyler:it({enabled:G,...Wo,...dt}),...Wo,...dt},sectorLabel:{enabled:G,positionOffset:Z,positionRatio:ge,formatter:Ps(Vs),format:E,itemStyler:it({enabled:G,...Wo,...dt}),...Wo,...dt},calloutLine:{colors:Me(ae),length:H,strokeWidth:H,itemStyler:it({color:ae,length:H,strokeWidth:H})},fills:Me(so),strokes:Me(ae),tooltip:et,shadow:za,highlight:R2,...pe,...re(ce,["fill"]),...re(te,["stroke"])},nh={...lD,...ia,type:U(Ce("pie")),angleKey:U(E),radiusKey:E,calloutLabelKey:E,sectorLabelKey:E,legendItemKey:E,angleName:E,radiusName:E,calloutLabelName:E,sectorLabelName:E,highlight:R2};nh.defaultColorRange=me(Me(Me(ae))),nh.defaultPatternFills=me(Me(ae)),nh.title._enabledFromTheme=me(G),nh.calloutLabel._enabledFromTheme=me(G),nh.sectorLabel._enabledFromTheme=me(G);var z2={...lD,innerRadiusOffset:Z,innerRadiusRatio:ge,innerCircle:{fill:E,fillOpacity:ge},innerLabels:{spacing:H,...dt,...Wo}},dK={...z2,...nh,type:U(Ce("donut")),innerLabels:Rt({text:U(E),spacing:H,...dt,...Wo},"inner label options array")},tu={lineStyle:J("solid","dashed","dotted"),...pe},oh={...ce,...te,...pe},Eg={visible:G,locked:G,readOnly:G,handle:oh,...dt},rx={position:J("top","center","bottom"),alignment:J("left","center","right"),...dt},F2={position:J("top","inside","bottom"),alignment:J("left","center","right"),...dt},uK={enabled:G,cornerRadius:H,formatter:Pt,...dt,...ce,...te,...pe},pK={visible:G,...tu,...te},B2={divider:te,...ce,...te,...dt},_2={handle:oh,statistics:B2,...tu,...ce,...te},lx={visible:G,locked:G,readOnly:G,extendStart:G,extendEnd:G,handle:oh,text:rx,...tu,...te},cD={visible:G,locked:G,readOnly:G,axisLabel:uK,handle:oh,text:rx,...tu,...te},hD={visible:G,locked:G,readOnly:G,extendStart:G,extendEnd:G,handle:oh,text:F2,background:ce,...tu,...te},V2={...hD},G2={...hD,middle:pK},dD={label:dt,showFill:G,isMultiColor:G,strokes:Me(ae),rangeStroke:ae,bands:J(4,6,10),...lx},j2={...ce,...te,...Eg},H2={...ce,...te,...Eg},W2={...ce,...te,...Eg,background:{...ce,...te}},uD={visible:G,locked:G,readOnly:G,handle:oh,...ce},cx={visible:G,locked:G,readOnly:G,extendStart:G,extendEnd:G,handle:oh,text:rx,background:ce,statistics:B2,...tu,...te},$2={visible:G,up:_2,down:_2},iu={enabled:G,axesButtons:{enabled:G,axes:J("x","y","xy")},toolbar:{enabled:G,padding:H,buttons:Rt({...Qc,value:J("line-menu","fibonacci-menu","text-menu","shape-menu","measurer-menu","line","horizontal-line","vertical-line","parallel-channel","disjoint-channel","fibonacci-retracement","fibonacci-retracement-trend-based","text","comment","callout","note","clear")},"annotation toolbar buttons array")},optionsToolbar:{enabled:G,buttons:Me(Ie(At({...Qc,value:U(J("line-stroke-width","line-style-type","line-color","fill-color","text-color","text-size","delete","settings"))}),At({...Qc,value:U(J("lock")),checkedOverrides:Qc})))}};iu.data=me(Ho),iu.xKey=me(E),iu.volumeKey=me(E),iu.snap=me(G);var pD={...ce,...te,...pe,cornerRadius:H,whisker:{...te,...pe},cap:{lengthRatio:ge}},gD={...pD,opacity:ge},U2=it({...ce,...te,...pe,cornerRadius:H,whisker:{...te,...pe},cap:{lengthRatio:ge}}),K2={direction:J("horizontal","vertical"),showInMiniChart:G,styler:U2,itemStyler:U2,tooltip:et,...Ue,...pD,highlight:ei(gD,gD),segmentation:rl},fD={cornerRadius:H,wick:{...te,...pe},...ce,...te,...pe},Y2={...fD,opacity:ge},Z2={item:{up:fD,down:fD},itemStyler:it({...ce,...te,...pe,cornerRadius:H,wick:{...te,...pe}}),showInMiniChart:G,tooltip:et,...Ue,highlight:ei(Y2,Y2)},X2={fills:Me(so),strokes:Me(ae),label:{spacing:H,maxWidth:H,...yt},link:{tension:ge,itemStyler:it({...ce,...te,...pe,tension:ge}),...ce,...te,...pe},node:{width:H,spacing:H,itemStyler:it({...ce,...te,...pe}),...ce,...te,...pe},tooltip:et,...Ue},q2={direction:J("horizontal","vertical"),fills:Me(so),strokes:Me(ae),label:{spacing:H,placement:J("before","middle","after"),...yt},stageLabel:{placement:J("before","after"),format:ta,...Lr},tooltip:et,...re(Ue,["showInLegend"]),...re(ce,["fill"]),...re(te,["stroke"]),...pe,highlight:iL(Mc)},Q2={direction:J("horizontal","vertical"),fills:Me(so),strokes:Me(ae),itemStyler:it({...ce,...te,...pe}),spacingRatio:ge,crisp:G,dropOff:{enabled:G,...ce,...te,...pe},stageLabel:{placement:J("before","after"),format:ta,...Lr},label:yt,tooltip:et,shadow:za,...re(Ue,["showInLegend"]),...re(ce,["fill"]),...re(te,["stroke"]),...pe},J2={title:E,textAlign:J("left","center","right"),verticalAlign:J("top","middle","bottom"),itemPadding:H,itemStyler:it({...ce,...te}),showInMiniChart:G,label:kl,tooltip:et,...Ue,...te},e1={showInMiniChart:G,itemStyler:it({...te,...pe}),item:{up:{...te,...pe},down:{...te,...pe}},tooltip:et,...Ue,highlight:ei(Mc,Mc)},t1={maxStrokeWidth:H,itemStyler:it({...te,...pe}),sizeDomain:Me(H),label:yt,tooltip:et,...Ue,...te,...pe,highlightStyle:{...Ue.highlightStyle,...te},highlight:ei(Mc,Mc)},i1={...te,...pe},s1={colorRange:Me(ae),maxSize:H,sizeDomain:Me(H),label:{placement:J("top","bottom","left","right"),...yt},tooltip:et,...Ue,...re(sa,["enabled"]),highlightStyle:{...Ue.highlightStyle,...ce,...te},highlight:ei(Ct,Ct)},n1={colorRange:Me(ae),padding:H,itemStyler:it({...ce,...te,...pe}),label:kl,tooltip:et,...Ue,...ce,...te,...pe,highlightStyle:{...Ue.highlightStyle,...ce,...te},highlight:ei(Ct,Ct)},o1={...Ue,...ce,...te,...pe},ah=it({...ce,...te,...pe,cornerRadius:H}),a1={cornerRadius:H,styler:ah,itemStyler:ah,label:yt,tooltip:et,...Ue,...ce,...te,...pe,highlight:ei(ka,ka)},r1={direction:J("horizontal","vertical"),aspectRatio:H,spacing:H,reverse:G,itemStyler:it({...ce,...te,...pe}),fills:Me(so),strokes:Me(ae),label:yt,stageLabel:{spacing:H,placement:J("before","after"),...yt},tooltip:et,shadow:za,...Ue,...re(ce,["fill"]),...re(te,["stroke"]),...pe},l1={connectMissingData:G,marker:sa,styler:it({marker:Dl,...ce,...te,...pe}),label:yt,tooltip:et,...Ue,...ce,...te,...pe,highlight:ei(Ct,Ct)},c1={connectMissingData:G,marker:sa,styler:it({marker:Dl,...te,...pe}),label:yt,tooltip:et,...Ue,...te,...pe,highlight:ei(Ct,Mc)},h1={cornerRadius:H,styler:ah,itemStyler:ah,label:yt,tooltip:et,...Ue,...ce,...te,...pe,highlight:ei(ka,ka)},d1={cornerRadius:H,columnWidthRatio:ge,maxColumnWidthRatio:ge,styler:ah,itemStyler:ah,label:yt,tooltip:et,...Ue,...ce,...te,...pe,highlight:ei(ka,ka)},gK={marker:sa,...te,...pe},u1={marker:{enabled:G,...Dl},...te,...pe},p1={marker:Dl,...te,...pe},g1={showInMiniChart:G,connectMissingData:G,interpolation:Um,label:{...yt,placement:J("inside","outside"),spacing:H},tooltip:et,shadow:za,...Ue,...ce,...gK,item:{low:{...u1},high:{...u1}},styler:it({...ce,item:{low:{...p1},high:{...p1}}}),highlight:ei(Ct,Ct),segmentation:rl,invertedStyle:{enabled:G,...ce}},f1=it({...ce,...te,...pe,cornerRadius:H}),y1={direction:J("horizontal","vertical"),grouped:G,showInMiniChart:G,cornerRadius:H,styler:f1,itemStyler:f1,label:{...yt,placement:J("inside","outside"),spacing:H},tooltip:et,shadow:za,...Ue,...ce,...te,...pe,highlight:ei(ka,ka),segmentation:rl},m1={fills:Me(so),strokes:Me(ae),label:{...yt,spacing:H,placement:J("left","right","center"),edgePlacement:J("inside","outside")},link:{itemStyler:it({...ce,...te,...pe}),...ce,...te,...pe},node:{width:H,spacing:H,minSpacing:tt(H,BG("spacing")),alignment:J("left","center","right","justify"),verticalAlignment:J("top","bottom","center"),sort:J("data","ascending","descending","auto"),itemStyler:it({...ce,...te,...pe}),...ce,...te,...pe},tooltip:et,...Ue},x1={fills:Me(so),strokes:Me(ae),colorRange:Me(ae),sectorSpacing:H,cornerRadius:H,padding:H,itemStyler:it({...ce,...te}),label:{spacing:H,...kl},secondaryLabel:kl,tooltip:et,...re(Ue,["highlight","showInLegend"]),...re(ce,["fill"]),...re(te,["stroke"]),highlightStyle:{label:{color:ae},secondaryLabel:{color:ae},...ce,...te}},b1={fills:Me(so),strokes:Me(ae),colorRange:Me(ae),itemStyler:it({...ce,...te}),group:{gap:H,padding:H,cornerRadius:H,textAlign:J("left","center","right"),interactive:G,label:{...yt,spacing:H},...ce,...te},tile:{gap:H,padding:H,cornerRadius:H,textAlign:J("left","center","right"),verticalAlign:J("top","middle","bottom"),label:{...yt,spacing:H,lineHeight:H,minimumFontSize:H,wrapping:J("never","always","hyphenate","on-space"),overflowStrategy:J("ellipsis","hide")},secondaryLabel:{...yt,lineHeight:H,minimumFontSize:H,wrapping:J("never","always","hyphenate","on-space"),overflowStrategy:J("ellipsis","hide")},...ce,...te},tooltip:et,...re(Ue,["highlight","showInLegend"]),highlightStyle:{group:{label:{color:ae},...ce,...te},tile:{label:{color:ae},secondaryLabel:{color:ae},...ce,...te}}},yD={name:E,cornerRadius:H,itemStyler:it({...ce,...te,...pe,cornerRadius:H}),label:{...yt,placement:J("inside-start","inside-center","inside-end","outside-start","outside-end"),spacing:H},tooltip:et,shadow:za,...ce,...te,...pe},v1={direction:J("horizontal","vertical"),showInMiniChart:G,item:{positive:yD,negative:yD,total:yD},line:{enabled:G,...te,...pe},tooltip:et,...Ue},hx=At({__type:U(Ce("date")),value:Ie(E,Z)},"a serializable date object"),S1={width:H,height:H,grip:G,fill:ae,stroke:ae,strokeWidth:H,cornerRadius:H},nt={enabled:G,height:H,spacing:H,cornerRadius:Z,mask:{fill:ae,fillOpacity:ge,stroke:ae,strokeWidth:H},minHandle:S1,maxHandle:S1,miniChart:{enabled:G,padding:{top:H,bottom:H},label:{enabled:G,avoidCollisions:G,spacing:H,format:ta,formatter:Ps(Vs),interval:{minSpacing:H,maxSpacing:H,values:Ho,step:Z},...dt},series:ke}},Hs={number:{...re(Yd,["type","crossLines"]),top:re(Yd,["type","crossLines","position"]),right:re(Yd,["type","crossLines","position"]),bottom:re(Yd,["type","crossLines","position"]),left:re(Yd,["type","crossLines","position"]),crossLines:re(Cr,["type"])},log:{...re(Zd,["type","crossLines"]),top:re(Zd,["type","crossLines","position"]),right:re(Zd,["type","crossLines","position"]),bottom:re(Zd,["type","crossLines","position"]),left:re(Zd,["type","crossLines","position"]),crossLines:re(Cr,["type"])},category:{...re(qd,["type","crossLines"]),top:re(qd,["type","crossLines","position"]),right:re(qd,["type","crossLines","position"]),bottom:re(qd,["type","crossLines","position"]),left:re(qd,["type","crossLines","position"]),crossLines:re(Cr,["type"])},time:{...re(Xd,["type","crossLines"]),top:re(Xd,["type","crossLines","position"]),right:re(Xd,["type","crossLines","position"]),bottom:re(Xd,["type","crossLines","position"]),left:re(Xd,["type","crossLines","position"]),crossLines:re(Cr,["type"])},"unit-time":{...re(Jd,["type","crossLines"]),top:re(Jd,["type","crossLines","position"]),right:re(Jd,["type","crossLines","position"]),bottom:re(Jd,["type","crossLines","position"]),left:re(Jd,["type","crossLines","position"]),crossLines:re(Cr,["type"])},"grouped-category":{...re(Qd,["type"]),top:re(Qd,["type","position"]),right:re(Qd,["type","position"]),bottom:re(Qd,["type","position"]),left:re(Qd,["type","position"]),crossLines:re(Cr,["type"])},"ordinal-time":{...re(eu,["type","crossLines"]),top:re(eu,["type","crossLines","position"]),right:re(eu,["type","crossLines","position"]),bottom:re(eu,["type","crossLines","position"]),left:re(eu,["type","crossLines","position"]),crossLines:re(Cr,["type"])}},su={"angle-category":{...re(oD,["type","crossLines"]),crossLines:re(Fa,["type"])},"angle-number":{...re(D2,["type","crossLines"]),crossLines:re(Fa,["type"])},"radius-category":{...re(I2,["type","crossLines"]),crossLines:{...re(Fa,["type"]),label:{...Jc,positionAngle:Z}}},"radius-number":{...re(k2,["type","crossLines"]),crossLines:{...re(Fa,["type"]),label:{...Jc,positionAngle:Z}}}},at={visible:me(G)},fK={common:{...Oe,navigator:nt,axes:{...Hs,...su},annotations:{...iu,line:lx,"horizontal-line":cD,"vertical-line":cD,"disjoint-channel":V2,"parallel-channel":G2,"fibonacci-retracement":dD,"fibonacci-retracement-trend-based":dD,callout:j2,comment:H2,note:W2,text:Eg,arrow:lx,"arrow-up":uD,"arrow-down":uD,"date-range":cx,"price-range":cx,"date-price-range":cx,"quick-date-price-range":$2},chartToolbar:{enabled:G},initialState:{legend:Rt({visible:G,seriesId:E,itemId:E,legendItemName:E},"legend state array"),zoom:{rangeX:{start:Ie(Z,hx),end:Ie(Z,hx)},rangeY:{start:Ie(Z,hx),end:Ie(Z,hx)},ratioX:{start:ge,end:ge},ratioY:{start:ge,end:ge},autoScaledAxes:Me(Ce("y"))}}},line:{...Oe,axes:Hs,series:rD,navigator:nt,...at},scatter:{...Oe,axes:Hs,series:P2,navigator:nt,...at,paired:me(G)},bubble:{...Oe,axes:Hs,series:N2,navigator:nt,...at},area:{...Oe,axes:Hs,series:C2,navigator:nt,...at},bar:{...Oe,axes:Hs,series:aD,navigator:nt,...at},"box-plot":{...Oe,axes:Hs,series:K2,navigator:nt,...at},candlestick:{...Oe,axes:Hs,series:Z2,navigator:nt,...at},"cone-funnel":{...Oe,axes:Hs,series:q2,navigator:nt,...at},funnel:{...Oe,axes:Hs,series:Q2,navigator:nt,...at},ohlc:{...Oe,axes:Hs,series:e1,navigator:nt,...at},histogram:{...Oe,axes:re(Hs,["category","grouped-category","unit-time","ordinal-time"]),series:O2,navigator:nt,...at},heatmap:{...Oe,axes:Hs,series:J2,navigator:nt,...at},waterfall:{...Oe,axes:Hs,series:v1,navigator:nt,...at},"range-bar":{...Oe,axes:Hs,series:y1,navigator:nt,...at},"range-area":{...Oe,axes:Hs,series:g1,navigator:nt,...at},donut:{...Oe,series:z2,navigator:nt,...at},pie:{...Oe,series:lD,navigator:nt,...at},"radar-line":{...Oe,axes:su,series:c1,navigator:nt,...at},"radar-area":{...Oe,axes:su,series:l1,navigator:nt,...at},"radial-bar":{...Oe,axes:su,series:h1,navigator:nt,...at},"radial-column":{...Oe,axes:su,series:d1,navigator:nt,...at},nightingale:{...Oe,axes:su,series:a1,navigator:nt,...at},sunburst:{...Oe,series:x1,navigator:nt,...at},treemap:{...Oe,series:b1,navigator:nt,...at},"map-shape":{...Oe,series:n1,navigator:nt,...at},"map-line":{...Oe,series:t1,navigator:nt,...at},"map-marker":{...Oe,series:s1,navigator:nt,...at},"map-shape-background":{...Oe,series:o1,navigator:nt,...at},"map-line-background":{...Oe,series:i1,navigator:nt,...at},sankey:{...Oe,series:m1,navigator:nt,...at},chord:{...Oe,series:X2,navigator:nt,...at},pyramid:{...Oe,series:r1,navigator:nt,...at},"radial-gauge":{...Oe,...Xm,targets:re(Ym,["value"]),tooltip:{...Xm.tooltip,...Oe.tooltip}},"linear-gauge":{...Oe,...Zm,targets:re(Km,["value"]),tooltip:{...Zm.tooltip,...Oe.tooltip}}};function dx(e,t){const i={};for(const s of Reflect.ownKeys(e))i[s]=t(e[s],s,e);return i}var yK=dx(fK,function e(t,i){if(ly(i))return t;if(lr(t))return Ie(t,fy,ly);if(Ee(t))return Ie(At(py in t?dx(t,s=>Ee(s)?dx(s,e):s):dx(t,e)),fy,ly);throw new Error(`Invalid theme override value: ${String(t)}`)}),vs={BLUE:"#0083ff",ORANGE:"#ff6600",GREEN:"#00af00",CYAN:"#00ccff",YELLOW:"#f7c700",VIOLET:"#ac26ff",GRAY:"#a7a7b7",MAGENTA:"#e800c5",BROWN:"#b54300",RED:"#ff0000"},rh={BLUE:"#67b7ff",ORANGE:"#ffc24d",GREEN:"#5cc86f",CYAN:"#54ebff",VIOLET:"#fff653",YELLOW:"#c18aff",GRAY:"#aeaeae",MAGENTA:"#f078d4",BROWN:"#ba8438",RED:"#ff726e"},mK=class extends jd{getDefaultColors(){return{fills:vs,fillsFallback:Object.values(vs),strokes:rh,sequentialColors:Fn(vs),divergingColors:[vs.ORANGE,vs.YELLOW,vs.GREEN],hierarchyColors:[],secondSequentialColors:["#0083ff","#0076e6","#0069cc","#005cb3","#004f99","#004280","#003466","#00274c"],secondDivergingColors:[vs.GREEN,vs.YELLOW,vs.RED],secondHierarchyColors:[],up:{fill:vs.GREEN,stroke:rh.GREEN},down:{fill:vs.RED,stroke:rh.RED},neutral:{fill:vs.GRAY,stroke:rh.GRAY},altUp:{fill:vs.BLUE,stroke:rh.BLUE},altDown:{fill:vs.ORANGE,stroke:rh.ORANGE},altNeutral:{fill:vs.GRAY,stroke:rh.GRAY}}}getTemplateParameters(){const e=super.getTemplateParameters();return e.set(Gt,vs.BLUE),e.set(Ni,vs.BLUE),e}},Ss={BLUE:"#0083ff",ORANGE:"#ff6600",GREEN:"#00af00",CYAN:"#00ccff",YELLOW:"#f7c700",VIOLET:"#ac26ff",GRAY:"#a7a7b7",MAGENTA:"#e800c5",BROWN:"#b54300",RED:"#ff0000"},lh={BLUE:"#0f68c0",ORANGE:"#d47100",GREEN:"#007922",CYAN:"#009ac2",VIOLET:"#bca400",YELLOW:"#753cac",GRAY:"#646464",MAGENTA:"#9b2685",BROWN:"#6c3b00",RED:"#cb0021"},xK=class extends Jo{getDefaultColors(){return{...super.getDefaultColors(),fills:Ss,fillsFallback:Object.values(Ss),strokes:lh,sequentialColors:Fn(Ss),divergingColors:[Ss.ORANGE,Ss.YELLOW,Ss.GREEN],hierarchyColors:[],secondSequentialColors:["#0083ff","#1a8fff","#339cff","#4da8ff","#66b5ff","#80c1ff","#99cdff","#b3daff"],secondDivergingColors:[Ss.GREEN,Ss.YELLOW,Ss.RED],secondHierarchyColors:[],up:{fill:Ss.GREEN,stroke:lh.GREEN},down:{fill:Ss.RED,stroke:lh.RED},neutral:{fill:Ss.GRAY,stroke:lh.GRAY},altUp:{fill:Ss.BLUE,stroke:lh.BLUE},altDown:{fill:Ss.ORANGE,stroke:lh.ORANGE},altNeutral:{fill:Ss.GRAY,stroke:lh.GRAY}}}getTemplateParameters(){const e=super.getTemplateParameters();return e.set(Gt,Ss.BLUE),e.set(Ni,Ss.BLUE),e}},mD=gs(()=>new Jo),bK=Pe.create(!0,"perf"),na=(e,t,i)=>{bK("[CACHE] ChartTheme",e,t.name,i)},xD={"ag-default-dark":gs(()=>new jd),"ag-sheets-dark":gs(()=>new DU,na),"ag-polychroma-dark":gs(()=>new SU,na),"ag-vivid-dark":gs(()=>new mK,na),"ag-material-dark":gs(()=>new bU,na),"ag-financial-dark":gs(()=>new mU,na),"ag-default":mD,"ag-sheets":gs(()=>new kU,na),"ag-polychroma":gs(()=>new MU,na),"ag-vivid":gs(()=>new xK,na),"ag-material":gs(()=>new vU,na),"ag-financial":gs(()=>new xU,na)},ux=gs(vK,na);function vK(e){if(e instanceof Jo)return e;if(!kK(e))return mD();if(e==null||typeof e=="string"){const n=xD[e??"ag-default"];if(n)return n();throw new Error(`Cannot find theme \`${e}\`.`)}const{cleared:t,invalid:i}=cs(SK(e),MK,"theme");for(const n of i)K.warnOnce(String(n));const s=t?.baseTheme?ux(t.baseTheme):mD();return t?new s.constructor(t):s}function SK(e){if(!Ee(e)||!Ee(e.baseTheme))return e;let t=e,i,s;const n=[];for(;typeof t=="object";)i??(i=t.palette),s??(s=t.params),t.overrides&&n.push(t.overrides),t=t.baseTheme;return{baseTheme:t,overrides:st(...n),params:s,palette:i}}var MK={baseTheme:Ie(E,gy),overrides:yK,params:{accentColor:ae,axisColor:ae,backgroundColor:ae,borderColor:ae,borderRadius:Z,chartBackgroundColor:ae,chartPadding:Z,focusShadow:E,foregroundColor:ae,fontFamily:VS,fontSize:Z,fontWeight:Ie(E,Z),gridLineColor:ae,popupShadow:E,subtleTextColor:ae,textColor:ae,chromeBackgroundColor:ae,chromeFontFamily:VS,chromeFontSize:Z,chromeFontWeight:Ie(E,Z),chromeSubtleTextColor:ae,chromeTextColor:ae,buttonBackgroundColor:ae,buttonBorder:G,buttonFontWeight:Z,buttonTextColor:ae,inputBackgroundColor:ae,inputBorder:G,inputTextColor:ae,menuBackgroundColor:ae,menuBorder:G,menuTextColor:ae,panelBackgroundColor:ae,panelSubtleTextColor:ae,tooltipBackgroundColor:ae,tooltipBorder:G,tooltipTextColor:ae,tooltipSubtleTextColor:ae,crosshairLabelBackgroundColor:ae,crosshairLabelTextColor:ae},palette:{fills:Me(so),strokes:Me(ae),up:{fill:Ie(ae,zS),stroke:ae},down:{fill:Ie(ae,zS),stroke:ae},neutral:{fill:Ie(ae,zS),stroke:ae}}},DK=J("ag-default","ag-default-dark","ag-sheets","ag-sheets-dark","ag-polychroma","ag-polychroma-dark","ag-vivid","ag-vivid-dark","ag-material","ag-material-dark","ag-financial","ag-financial-dark");function kK(e){const{invalid:t}=cs({theme:e},{theme:Ie(DK,gy)});for(const i of t)K.warnOnce(String(i));return t.length===0}var wl={isEnterprise:!1},si="path",yo="pathArray",ui="default",mo="override",oa="user",Nl="userPartial",nu="operation",ou="operationValue",bD="dependency",vD="autoEnable",M1="autoEnableValue",D1="prune",k1="childrenSource";function SD(e){return Jt(e)&&e>=0&&e<=1}function Pg(e,t){let i=e;for(const s of t){if(!(typeof s=="string"&&i!=null&&(typeof i=="object"||Array.isArray(i))&&s in i))return!1;i=i[s]}return!0}function Ws(e,t){let i=e;for(const s of t){if(!(typeof s=="string"&&i!=null&&(typeof i=="object"||Array.isArray(i))&&s in i))return;i=i[s]}return i}function au(e,t,i){const s=t.length;if(s===0)return;let n=e;const o=s-1,a=t[o];for(let r=0;r=0;s--){const n=e[s];if(IK.test(n)&&(i++,i>t))return s}return-1}function ru(e,t=0){const i=I1(e,t);return Number(e[i])}function ch(e,t,i){const s=t.split("/");let n=[...e];t.startsWith("/")&&(n=[],s.shift());let o=!1;for(const a of s){if(a==="..")n.pop(),o||n.pop();else if(a===".")n.pop();else if(a==="$index"){const r=ru(e);if(Number.isNaN(r))return Ba;n.push(`${r}`)}else if(a==="$prevIndex"){const r=ru(e);if(Number.isNaN(r)||Number(r)<=0)return Ba;n.push(`${Number(r)-1}`)}else if(a.startsWith("$")){const r=i?.[a.slice(1)];if(r==null)return Ba;n.push(r)}else a.length!==0&&n.push(a);o=a===".."}return n}var Ba=Symbol("unresolvable-path"),Vn=Symbol("resolved-to-branch");function Rg(e,t){if(e==null||typeof e!="object"||Array.isArray(e)||(t??(t=Object.keys(e)),t.length===0))return;const i=t[0];if(T1.has(i))return{operation:i,values:Array.isArray(e[i])?e[i]:[e[i]]}}function AK(e,t,i){const s=Rg(e.getVertexValue(i));switch(s?.operation){case"$path":{const[n]=s.values,o=e.getPathArray(t),a=ch(o,n);return a===Ba?void 0:e.findVertexAtPath(a)}case"$value":return t}}var CK={$cacheMax:LK};function LK(e,t,i){const[s]=i,n=e.getPathArray(t),o=e.getCachedValue(n,"$cacheMax"),a=e.resolveVertexValue(t,s);if(typeof a!="number")return o;if(typeof o!="number")return e.setCachedValue(n,"$cacheMax",a),a;const r=Math.max(o,a);return e.setCachedValue(n,"$cacheMax",r),r}var TK={$hasSeriesType:{dependencies:MD,resolve:wK},$isChartType:{dependencies:MD,resolve:OK},$isSeriesType:{dependencies:MD,resolve:NK}};function MD(e,t,i){const s=e.findVertexAtPath(["series","0","type"]);s&&e.addEdge(t,s,bD)}function wK(e,t,i){const[s]=i,n=e.resolveVertexValue(t,s),o=e.getResolvedPath(["series"]);if(!Array.isArray(o))return!1;for(const a of o)if(a.type===n)return!0;return!1}function NK(e,t,i){const[s]=i,n=e.resolveVertexValue(t,s);return e.getResolvedPath(["series","0","type"])===n}function OK(e,t,i){const[s]=i,n=e.resolveVertexValue(t,s),o=e.getResolvedPath(["series","0","type"]);if(typeof o!="string")return!1;switch(n){case"cartesian":return $i.isCartesian(o);case"polar":return $i.isPolar(o);case"standalone":return $i.isStandalone(o)}return!1}var EK={$foregroundBackgroundMix:PK,$foregroundOpacity:RK,$interpolate:zK,$isGradient:FK,$isImage:BK,$isPattern:_K,$mix:VK};function PK(e,t,i){const[s]=i,n=e.resolveVertexValue(t,s),o=e.getParamValue("foregroundColor"),a=e.getParamValue("backgroundColor");if(typeof o=="string"&&typeof a=="string"&&SD(n))return mt.mix(mt.fromString(o),mt.fromString(a),1-n).toString();Pe.inDevelopmentMode(()=>K.warnOnce(`\`$foregroundBackgroundMix\` json operation failed on [${String(n)}}}] at [${e.getPathArray(t).join(".")}], expecting a number between 0 and 1.`))}function RK(e,t,i){const[s]=i,n=e.resolveVertexValue(t,s),o=e.getParamValue("foregroundColor");if(typeof o=="string"&&SD(n)){const a=mt.fromString(o);return new mt(a.r,a.g,a.b,n).toString()}Pe.inDevelopmentMode(()=>K.warnOnce(`\`$foregroundOpacity\` json operation failed on [${String(n)}}}] at [${e.getPathArray(t).join(".")}], expecting a number between 0 and 1.`))}function zK(e,t,i){const[s,n]=i,o=e.resolveVertexValue(t,s),a=e.resolveVertexValue(t,n);if(!(!Ne(o)||!Jt(a)))return mt.interpolate(o.map(r=>mt.fromString(r)),a).map(r=>r.toString())}function FK(e,t,i){const[s]=i,n=e.resolveVertexValue(t,s);return ao(n)}function BK(e,t,i){const[s]=i,n=e.resolveVertexValue(t,s);return wc(n)}function _K(e,t,i){const[s]=i,n=e.resolveVertexValue(t,s);return ur(n)}function VK(e,t,i){const[s,n,o]=i,a=e.resolveVertexValue(t,s),r=e.resolveVertexValue(t,n),l=e.resolveVertexValue(t,o),c=e.getPathArray(t),h=`\`$mix\` json operation failed on [${String(a)}, ${String(r)}, ${String(l)}] at [${c.join(".")}], expecting`,d=`${h} two colors and a number between 0 and 1.`;if(typeof r!="string"||!SD(l)){Pe.inDevelopmentMode(()=>K.warnOnce(d));return}if(typeof a=="string")try{return mt.mix(mt.fromString(a),mt.fromString(r),l).toString()}catch{Pe.inDevelopmentMode(()=>K.warnOnce(d));return}if(!ao(a)){Pe.inDevelopmentMode(()=>K.warnOnce(d));return}let u=a.colorStops;try{u=u?.map(p=>{let g;return typeof p.color=="string"&&(g=mt.mix(mt.fromString(p.color),mt.fromString(r),l).toString()),{...p,color:g}})}catch{Pe.inDevelopmentMode(()=>K.warnOnce(`${h} a gradient, a color and a number between 0 and 1.`));return}return{...a,colorStops:u}}var GK={$rem:jK};function jK(e,t,i){const[s]=i,n=e.getVertexValue(s),o=e.getParamValue("fontSize");if(typeof o=="number"&&typeof n=="number")return Math.round(n*o);Pe.inDevelopmentMode(()=>K.warnOnce(`\`$rem\` json operation failed on [${String(n)}] at [${e.getPathArray(t).join(".")}], expecting a number.`))}var HK={$and:WK,$eq:$K,$greaterThan:UK,$if:KK,$lessThan:YK,$not:ZK,$or:XK,$switch:qK};function WK(e,t,i){for(const s of i)if(!e.resolveVertexValue(t,s))return!1;return!0}function $K(e,t,i){let s,n=!0;for(const o of i){const a=e.resolveVertexValue(t,o);if(n)s=a,n=!1;else if(a!==s)return!1}return!0}function UK(e,t,i){const[s,n]=i;return e.resolveVertexValue(t,s)>e.resolveVertexValue(t,n)}function KK(e,t,i){const[s,n,o]=i,r=e.resolveVertexValue(t,s)?n:o,l=e.neighboursWithEdgeValue(r,si);if(l)for(const c of l)e.addEdge(t,c,si);return e.resolveVertexValue(t,r)}function YK(e,t,i){const[s,n]=i;return e.resolveVertexValue(t,s)1,n=i.length>2,[o,a,r]=i,l=e.resolveVertexValue(t,o),c=n?e.resolveVertexValue(t,r):null;if(!Qt(l))throw new Error(`\`$path\` json operation failed on [${String(l)}], expecting a string.`);const h=e.getPathArray(t),d=ch(h,l);if(d===Ba)return;const u=c?Ws(c,d):e.getResolvedPath(d);if(u!=null)return u;if(s)return e.resolveVertexValue(t,a)}function n3(e,t,i){const[s,n]=i,o=e.resolveVertexValue(t,s);if(!Qt(o))throw new Error(`\`$path\` json operation failed on [${String(o)}], expecting a string.`);let a;n&&(a=e.graftAndResolveOrphan(t,n));const r=e.getPathArray(t),l=ch(r,o,a);if(l===Ba)throw new Error(`Unresolvable path [${o}] at [${r.join(".")}]`);return l}function o3(e,t,i){const[s]=i,n=e.getVertexValue(s);return e.getParamValue(n)}var a3={$apply:r3,$applyCycle:l3,$applySwitch:c3,$applyTheme:h3,$findFirstSiblingNotOperation:d3,$map:u3,$merge:p3,$omit:g3,$size:f3,$shallow:m3,$shallowSimple:y3,$value:x3};function r3(e,t,i){const[s,n,o,a]=i,r=e.getVertexValue(s);if(!ft(r))return;const l=n?e.getVertexValue(n):void 0,c=e.neighboursWithEdgeValue(t,si),h=c&&c.length>0;if(!h&&l==null)return Vn;const d=o?e.resolveVertexValue(t,o):void 0,u=a?e.resolveVertexValue(t,a):void 0;if(!h&&l!=null)if(Rg(l)){const p=e.resolveVertexValue(t,n);ft(p)&&e.graftObject(t,p,[d,u])}else e.graftObject(t,l,[d,u]);if(!h)return Vn;for(const p of c){const g=e.neighboursWithEdgeValue(p,si);if(!g||g.length===0){const f=e.addVertex({});e.addEdge(p,f,ui)}else e.graftObject(p,r,[d,u])}return Vn}function l3(e,t,i){const[s,n,o]=i,a=e.resolveVertexValue(t,s);if(typeof a!="number")return;const r=e.getPathArray(t),l=e.dangerouslyGetUserOption(r),c=e.hasThemeOverride(r),h=l==null?void 0:oa,d=l??e.resolveVertexValue(t,n);if(!Array.isArray(d))return;const u=o?e.getVertexValue(o):void 0;for(let p=0;p0)return;let l=0;for(const c of a)e.graftValue(t,`${l}`,o,c),l++;return Vn}function p3(e,t,i){for(const s of i){const n=e.resolveVertexValue(t,s);ft(n)&&e.graftObject(t,n)}return Vn}function g3(e,t,i){const[s,n]=i;let o=e.getVertexValue(s);if(!Array.isArray(o)){const r=AK(e,t,n);if(!r)return;o=e.resolveVertexValue(r,s)}const a=e.resolveVertexValue(t,n);if(!(!Array.isArray(o)||!ft(a)))return re(a,o)}function f3(e,t,i){const[s]=i,n=e.resolveVertexValue(t,s);return ay(n)?"length"in n?n.length:Object.keys(n).length:0}function y3(e,t,i){const s=[];for(const n of i)s.push(e.getVertexValue(n));return s}function m3(e,t,i){const s=e.getPathArray(t),n=e.hasUserOption(s);if(!n&&i.length===1)return e.resolveVertexValue(t,i[0]);const o=[];for(const a of i)o.push(e.getVertexValue(a));return n?(e.prune(t,[mo,ui]),Vn):(e.graftObject(t,o),Vn)}function x3(e,t,i){const[s]=i,n=e.getVertexValue(s),o=e.getPathArray(t);if(n==="$index")return ru(o);if(n==="$parentIndex")return ru(o,1);if(n==="$1")return e.resolveValue$1(o)}var b3={$isEven:v3,$mul:S3,$round:M3};function v3(e,t,i){const[s]=i,n=e.resolveVertexValue(t,s);return Number.isNaN(Number(n))?!1:Number(n)%2===0}function S3(e,t,i){let s;for(const n of i){const o=e.resolveVertexValue(t,n);s==null?s=Number(o):s*=Number(o)}return s}function M3(e,t,i){const[s]=i;if(s)return Math.round(Number(e.resolveVertexValue(t,s)))}var zg={...CK,...TK,...EK,...GK,...QK,...HK,...b3,...a3},T1=new Set(Object.keys(zg));function Fg(e){return T1.has(e)}var bt=Pe.create("opts","options-graph"),D3=gs(k3);function k3(e,t){return bt.group("OptionsGraph.constructor()",()=>new w1(e.config,t,e.params,e.palette,e.overrides,e.getTemplateParameters()))}var Ol=class Es extends rj{constructor(t={},i={},s=void 0,n={},o=void 0,a=new Map){super(si,nu,new Set([Nl,oa])),this.config=t,this.userOptions=i,this.palette=n,this.overrides=o,this.internalParams=a,this.edgePriority=[...Es.EDGE_PRIORITY],this.graftEdge=Es.GRAFT_EDGE,this.resolvedParams={},this.resolvedAnnotations={},this.value$1=new Map,this.cachedPathVertices=new Map,this.hasUnsafeClearKeys=!1,this.rollbackVertices=[],this.rollbackEdgesFrom=[],this.rollbackEdgesTo=[],this.rollbackEdgesValue=[],this.isRollingBack=!1,this.EMPTY_PATH_ARRAY_VERTEX=this.addVertex([]),this.root=this.addVertex("root"),this.params=this.addVertex("params"),this.annotations=this.addVertex("annotations"),this.paletteType=Ee(i?.theme)?_N(i.theme?.palette):"inbuilt";const r=i.series?.[0]?.type??"line";i.axes??(i.axes=co.predictAxes(r,i.series?.[0],i.data)??co.cloneDefaultAxes(r)??[]),bt("build user"),this.buildGraphFromObject(this.root,oa,re(i,["theme"])),bt("build defaults"),this.buildGraphFromObject(this.root,ui,re(t[r],Es.COMPLEX_KEYS));const l=o?re(o[r],Es.COMPLEX_KEYS):{};Object.keys(l).length>0&&(bt("build series overrides"),this.buildGraphFromObject(this.root,mo,l));const c=o?re(o.common,Es.COMPLEX_KEYS):{};Object.keys(c).length>0&&(bt("build common overrides"),this.buildGraphFromObject(this.root,mo,$i.isCartesian(r)?c:re(c,["zoom","navigator"]))),s&&(bt("build params"),this.buildGraphFromObject(this.params,ui,s));const h=this.findNeighbourWithValue(this.root,"axes",si),d=this.findNeighbourWithValue(this.root,"series",si);h&&(bt("build axes"),this.buildGraphFromObject(h,ui,{$applyTheme:[["/$seriesType/axes/$axisType/$position","/$seriesType/axes/$axisType"],{seriesType:{$path:["/series/0/type","line"]},axisType:{$path:["./type","category"]},position:{$path:["./position"]}},["top","right","bottom","left"]]})),d&&(bt("build series"),this.buildGraphFromObject(d,ui,{$applyTheme:["/$seriesType/series",{seriesType:{$path:["./type","line"]}}]}));const u=re(t[r]?.annotations??{},Es.ANNOTATIONS_OPTIONS_KEYS);Object.keys(u).length>0&&(bt("build annotations type config"),this.buildGraphFromObject(this.annotations,ui,u));const p=re(o?.common?.annotations??{},Es.ANNOTATIONS_OPTIONS_KEYS);Object.keys(p).length>0&&(bt("build annotations type overrides"),this.buildGraphFromObject(this.annotations,mo,p));const g=Oy(t[r]?.annotations??{},Es.ANNOTATIONS_OPTIONS_KEYS);Object.keys(g).length>0&&(bt("build annotations config"),this.buildGraphFromObject(this.root,ui,{annotations:g}));const f=Oy(o?.common?.annotations??{},Es.ANNOTATIONS_OPTIONS_KEYS);Object.keys(f).length>0&&(bt("build annotations overrides"),this.buildGraphFromObject(this.root,mo,{annotations:f})),this.buildDependencyGraph()}clear(){bt.group("OptionsGraph.clear()",()=>{super.clear(),this.cachedPathVertices.clear(),this.root=void 0,this.params=void 0,this.annotations=void 0,bt("cleared")})}clearSafe(){this.hasUnsafeClearKeys||this.clear()}resolve(){return bt.group("OptionsGraph.resolve()",()=>(this.resolved={},this.resolvedParams={},this.resolvedAnnotations={},bt("resolve params"),this.resolveVertex(this.params,this.resolvedParams),bt("resolve annotations"),this.resolveVertex(this.annotations,this.resolvedAnnotations),bt("resolve root"),this.resolveVertex(this.root),bt("resolved root",this.resolved),bt("vertex count",this.getVertexCount()),bt("edge count",this.getEdgeCount()),this.resolved))}resolveParams(){return this.resolvedParams}resolveAnnotationThemes(){return this.resolvedAnnotations}addVertex(t){const i=super.addVertex(t);return this.isRollingBack&&this.rollbackVertices.push(i),i}addEdge(t,i,s){const n=(this.neighboursWithEdgeValue(t,s)?.indexOf(i)??-1)!==-1;this.isRollingBack&&!n&&(this.rollbackEdgesFrom.push(t),this.rollbackEdgesTo.push(i),this.rollbackEdgesValue.push(s)),super.addEdge(t,i,s)}resolvePartial(t,i,s){if(!i||!this.root)return;const{permissivePath:n,proxyPaths:o}=s??{},a=Object.keys(i);if(bt.check()&&console.groupCollapsed(`OptionsGraph.resolvePartial() - ${t.join(".")} [${a}]`),a.length===0)return{};const r=this.findVertexAtPath(t);if(!r){if(n)return;throw new Error(`Could not find vertex in OptionsGraph at path [${t.join(".")}].`)}const l=this.findNeighbour(r,yo);if(this.userPartialOptions={},au(this.userPartialOptions,t,i),o)for(const p of Object.keys(o)){const g=o[p],f=Ws(i,[p]);f!=null&&(au(i,g,f),au(this.userPartialOptions,[...t,...g],f),delete i[p],delete this.userPartialOptions[p])}this.graftEdge=Nl,this.edgePriority=[Nl,...Es.EDGE_PRIORITY],this.snapshot(),this.buildGraphFromObject(r,Nl,i,l);for(const p of a){const g=o?.[p]?this.findVertexAtPath([...t,...o[p]]):this.findNeighbourWithValue(r,p,si);g&&this.refreshPendingProcessingEdges(g)}this.buildDependencyGraph();const c={};if(this.resolveVertex(r,c),this.rollback(),this.graftEdge=Es.GRAFT_EDGE,this.edgePriority=Es.EDGE_PRIORITY,this.userPartialOptions=void 0,o)for(const p of Object.keys(o)){const g=o[p],f=Ws(c,[...t,...g]);au(c,[...t,p],f)}const h=Ws(c,t),u=s?.pick??!0?Oy(Ws(c,t),a):h;return bt("vertex count",this.getVertexCount()),bt("edge count",this.getEdgeCount()),bt("resolved partial",u),bt.check()&&console.groupEnd(),u}findVertexAtPath(t){const i=t.join(".");if(this.cachedPathVertices.has(i))return this.cachedPathVertices.get(i);const s=this.findVertexAlongEdge(this.root,t,si);if(s)return this.cachedPathVertices.set(i,s),s}hasUserOption(t){if(Pg(this.userOptions,t))return!0;const s=this.findVertexAtPath(t);if(s){if(this.findNeighbour(s,oa)!=null||this.findNeighbour(s,Nl)!=null)return!0;const n=this.findNeighbourValue(s,k1);return n===oa||n===Nl}return!1}dangerouslyGetUserOption(t){if(this.userPartialOptions){const i=Ws(this.userPartialOptions,t);if(i!=null)return i}return Ws(this.userOptions,t)}hasThemeOverride(t){if(this.overrides==null)return!1;if(t[0]==="axes"&&t.length>1){const i=this.getResolvedPath(["axes",t[1],"type"]);if(Pg(this.overrides,["common","axes",i,...t.slice(2)]))return!0;const s=this.getResolvedPath(["series","0","type"]);return Pg(this.overrides,[s,"axes",i,...t.slice(2)])}if(t[0]==="series"&&t.length>1){const i=this.getResolvedPath(["series",t[1],"type"]);return Pg(this.overrides,[i,"series",...t.slice(2)])}return Pg(this.overrides,t)}getParamValue(t){if(this.resolvedParams[t]!=null)return this.resolvedParams[t];const i=this.findVertexAlongEdge(this.params,[t],si);if(!i)return;const s=this.findNeighbour(i,ui);if(!s)return;const n=this.resolveVertexValue(i,s);return this.resolvedParams[t]=n,n}getPathArray(t){return this.findNeighbourValue(t,yo)??[]}getResolvedPath(t){return Ws(this.resolved,t)}getCachedValue(t,i){const s=[...t,i].join(".");return Es.valueCache.get(s)}setCachedValue(t,i,s){const n=[...t,i].join(".");Es.valueCache.set(n,s)}prune(t,i){this.addEdge(t,this.addVertex(i),D1)}resolveVertexValue(t,i){this.resolveVertexDependencies(i);const s=this.findNeighbourValue(i,nu);if(s&&Fg(s)){const o=this.neighboursWithEdgeValue(i,ou),a=zg[s],l=(typeof a=="function"?a:a.resolve)?.(this,t,o??[]);return l===Vn?void 0:l}let n=this.getVertexValue(i);if(Array.isArray(n)){const o={};this.resolveVertexChildren(i,o),n=Ws(o,this.getPathArray(t))}return this.resolveValueOrSymbol(n)}resolveValue$1(t){for(let i=t.length;i>=0;i--){const s=t.slice(0,i).join("."),n=this.value$1.get(s);if(n!=null)return n}}graftConfig(t,i,s){const n=Ws(this.config,i),o=this.findNeighbour(t,yo);if(Ee(n)&&this.buildGraphFromObject(t,ui,n,o,void 0,s),this.overrides){const a=Ws(this.overrides,i);Ee(a)&&this.buildGraphFromObject(t,mo,a,o,void 0,s);const r=Ws(this.overrides,["common",...i.slice(1)]);Ee(r)&&this.buildGraphFromObject(t,mo,r,o,void 0,s)}this.buildDependencyGraph()}graftObject(t,i,s,n=this.graftEdge){const o=this.findNeighbour(t,yo);if(this.buildGraphFromObject(t,n,i,o),this.overrides&&s)for(const a of s){if(a==null)continue;const r=Ws(this.overrides,a);r&&this.buildGraphFromObject(t,mo,r,o)}this.buildDependencyGraph()}graftValue(t,i,s,n,o=this.graftEdge){const a=[...this.getPathArray(t),i];this.value$1.set(a.join("."),n);const r=this.findVertexAtPath(a)??this.addVertex(i);this.buildGraphFromValue(t,r,o,a,s),this.buildDependencyGraph()}graftAndResolveOrphan(t,i){const s={},n=this.addVertex(s),o=this.getPathArray(t);return this.graftAndResolveChildren(i,n,o,[]),this.resolveVertex(n,s),Ws(s,o)}buildGraphFromObject(t,i,s,n,o=Es.SHALLOW_KEYS,a){const r=Object.keys(s),l=Rg(s,r);if(l){const g=this.addVertex(s);this.addEdge(t,g,i),this.buildGraphFromOperation(g,i,l,n);return}if(r.length===0){this.addEdge(t,this.addVertex(Array.isArray(s)?[]:{}),i),this.buildGraphAutoEnable(t,i,s,void 0);return}const c=this.getVertexChildrenByKey(t),h=n?this.getVertexValue(n):[];let d;Array.isArray(s)&&this.addEdge(t,this.addVertex(i),k1);const u=[...h],p=h.length;for(const g of r){if(a?.has(g))continue;const f=c?.get(g)??this.addVertex(g);u[p]=g,o?.has(g)?this.buildShallowGraphFromValue(t,f,i,u,s[g]):this.buildGraphFromValue(t,f,i,u,s[g],o),g==="enabled"&&(d=f)}this.buildGraphAutoEnable(t,i,s,d)}buildGraphAutoEnable(t,i,s,n){if(i===ui&&!n||i===oa&&n||i!==ui&&i!==oa&&i!==Nl&&i!==mo)return;let o=this.findNeighbour(t,vD);o||(o=this.addVertex(vD),this.addEdge(t,o,vD)),n&&this.addEdge(n,o,M1);const{enabled:a,_enabledFromTheme:r}=s;this.addEdge(o,this.addVertex({enabled:a,_enabledFromTheme:r,keys:Object.keys(s).length}),i)}getVertexChildrenByKey(t){const i=this.neighboursWithEdgeValue(t,si);if(!i)return;const s=new Map;for(const n of i)s.set(this.getVertexValue(n),n);return s}buildGraphFromValue(t,i,s,n,o,a){this.addEdge(t,i,si);let r=this.findNeighbour(i,yo);r||(r=this.addVertex([...n]),this.addEdge(i,r,yo));const l=Rg(o);if(l){const c=this.addVertex(o);this.addEdge(i,c,s),this.addEdge(c,r,yo),this.buildGraphFromOperation(c,s,l,r)}else if(ay(o))this.buildGraphFromObject(i,s,o,r,a);else{const c=this.findNeighbour(i,s);if(c&&this.getVertexValue(c)===o)return;const h=this.addVertex(o);this.addEdge(i,h,s)}}buildShallowGraphFromValue(t,i,s,n,o){this.addEdge(t,i,si);let a=this.findNeighbour(i,yo);a||(a=this.addVertex([...n]),this.addEdge(i,a,yo));const r=this.addVertex(o);this.addEdge(i,r,s)}buildGraphFromOperation(t,i,s,n){const o=this.addVertex(s.operation);this.addEdge(t,o,nu);for(const a of s.values)this.buildGraphFromOperationValue(t,a,i,n)}buildGraphFromOperationValue(t,i,s,n=this.EMPTY_PATH_ARRAY_VERTEX){const o=this.addVertex(i);this.addEdge(t,n,yo),this.addEdge(t,o,ou);const a=Rg(i);a?this.buildGraphFromOperation(o,s,a,n):ay(i)&&this.buildGraphFromObject(o,s,i,n)}buildDependencyGraph(){for(let t=0;t0&&r!==a)&&!(Array.isArray(n)&&n.includes(r))){if(this.hasUnsafeClearKeys||(this.hasUnsafeClearKeys=c!=null&&Es.UNSAFE_CLEAR_KEYS.has(s.at(-1))),s.length===0){if(c==null)continue;this.resolved=c}else au(i,s,c);break}}}resolveVertexValueInternal(t,i){this.resolveVertexDependencies(i);const s=this.findNeighbourValue(i,nu);if(s&&Fg(s)){const n=this.neighboursWithEdgeValue(i,ou),o=zg[s],r=(typeof o=="function"?o:o.resolve)?.(this,t,n??[]);return r===Vn?void 0:r}return this.resolveValueOrSymbol(this.getVertexValue(i))}resolveVertexAutoEnable(t,i,s){const n=this.neighboursWithEdgeValue(t,M1)?.[0];if(!n)return;const o=this.findVertexAtPath(s),a=this.findNeighbourValue(n,ui),r=this.findNeighbourValue(n,mo),l=this.findNeighbourValue(n,oa),h=o&&this.findNeighbour(o,oa)!=null?void 0:this.findNeighbourValue(n,Nl);(l!=null&&l.enabled==null||h!=null&&h.enabled==null)&&!a?._enabledFromTheme&&!r?._enabledFromTheme&&au(i,s,!0)}resolveVertexChildren(t,i,s){const n=this.neighboursWithEdgeValue(t,si);if(n){s??(s=this.findNeighbourValue(t,D1));for(const o of n){const a=this.getVertexValue(o);n.length>1&&Fg(a)||a!=="_enabledFromTheme"&&this.resolveVertex(o,i,s)}}}resolveVertexDependencies(t){const i=this.neighboursWithEdgeValue(t,bD);if(i)for(const s of i)this.resolveVertex(s)}graftAndResolveChildren(t,i,s,n){const o=this.neighboursWithEdgeValue(t,si);if(o)for(const a of o){const r=this.getVertexValue(a),l=[...s,r],c=[...n,r],h=this.addVertex(r),d=this.findNeighbourValue(a,ui);this.addEdge(i,h,si);const u=this.addVertex(l);if(this.addEdge(h,u,yo),Ee(d)){this.buildGraphFromObject(h,ui,d,u);const p=this.findNeighbour(h,ui);this.addEdge(p,this.addVertex(l),yo);const g=this.findNeighbourValue(p,nu);if(Fg(g)){const f=this.neighboursWithEdgeValue(p,ou),x=zg[g];(typeof x=="function"?void 0:x.dependencies)?.(this,p,f??[])}}this.graftAndResolveChildren(a,h,l,c)}}resolveValueOrSymbol(t){return typeof t=="symbol"&&this.internalParams?.has(t)?this.internalParams.get(t):t}snapshot(){bt("snapshot"),this.isRollingBack=!0}rollback(){bt(`rollback ${this.rollbackEdgesFrom.length} edges and ${this.rollbackVertices.length} vertices`);for(let t=0;t`'${e}'`,hh=class qi{constructor(t,i,s,n,o,a,r=!1,l){this.themeParameters={},this.optionMetadata=o??{},this.processedOverrides=s??{};let c=null;t instanceof qi?(c=t,this.specialOverrides=c.specialOverrides,a===void 0&&(a=wa(c.userOptions,i,qi.JSON_DIFF_OPTS)),this.userOptions=Ft(Sp(a,c.userOptions),{...qi.OPTIONS_CLONE_OPTS_SLOW,seen:[]})):(this.userOptions=Ft(t??i,{...qi.OPTIONS_CLONE_OPTS_SLOW,seen:[]}),this.specialOverrides=this.specialOverridesDefaults({...n})),r&&this.removeLeftoverSymbols(this.userOptions);const h=t instanceof qi&&a?.data!==void 0&&a?.data?.length!==t.userOptions.data?.length;let d,u,p,g,f,x,m;if(!r&&a!==void 0&&qi.isFastPathDelta(a)&&c!=null&&!h?({activeTheme:d,processedOptions:u,fastDelta:p}=this.fastSetup(a,c),g=c.themeParameters,f=c.annotationThemes):(qi.perfDebug("ChartOptions.slowSetup()"),{activeTheme:d,processedOptions:u,themeParameters:g,annotationThemes:f,googleFonts:x,optionsGraph:m}=this.slowSetup(s,a,r)),this.activeTheme=d,this.processedOptions=u,this.fastDelta=p??void 0,this.themeParameters=g,this.annotationThemes=f,this.googleFonts=x,this.optionsGraph=m,l!==void 0&&typeof l=="number"&&!Number.isNaN(l)){const v=performance.now();this.optionsProcessingTime=v-l}Pe.inDevelopmentMode(()=>cr(this))}static isFastPathDelta(t){for(const i of Object.keys(t??{}))if(!this.FAST_PATH_OPTIONS.has(i))return qi.perfDebug("ChartOptions.isFastPathDelta() - slow path required due to presence of: ",i),!1;return qi.perfDebug("ChartOptions.isFastPathDelta() - fast path possible."),!0}fastSetup(t,i){const{activeTheme:s,processedOptions:n}=i,{presetType:o}=this.optionMetadata;if(o!=null&&t?.data!=null){const r=en.getPresetModule(o);if(r?.processData){const{series:l,data:c}=r.processData(t.data);t=st({series:l,data:c},t)}}this.fastSeriesSetup(t,n);const a=st(t,n);return qi.debug("ChartOptions.fastSetup() - processed options",a),{activeTheme:s,processedOptions:a,fastDelta:t}}fastSeriesSetup(t,i){t?.series&&(t.series?.every((s,n)=>sT(s,i.series?.[n]??{}))?delete t.series:t.series=t.series.map((s,n)=>Sp(s,i.series?.[n]??{})))}slowSetup(t,i,s=!1){let n=Ft(this.userOptions,qi.OPTIONS_CLONE_OPTS_FAST);i&&(n=st(i,n),s&&this.removeLeftoverSymbols(n));const{presetType:o}=this.optionMetadata;if(o!=null){const p=en.getPresetModule(o);if(p){const{validate:g=cs}=p,f=n,x=n.type,m=x==null?void 0:ux(n.theme).presets[x],{cleared:v,invalid:b}=g(f,p.options,"");for(const S of b)K.warn(S);od(b,"")?n={}:(qi.debug(">>> AgCharts.createOrUpdate() - applying preset",v),n=p.create(v,m,()=>this.activeTheme))}}this.soloSeriesIntegrity(n),wl.isEnterprise||BN(n);const a=ux(n.theme);if(o!=null&&a.templateTheme(n,!1),this.validateSeriesOptions(n),this.chartDef=en.detectChartDefinition(n),!this.chartDef.placeholder){const{validate:p=cs}=this.chartDef,{cleared:g,invalid:f}=p(n,this.chartDef.options,"");for(const x of f)K.warn(x);n=g}this.validateAxesOptions(n),this.removeDisabledOptions(n);let r=this.processFonts(a.params);r=this.processFonts(n,r),this.processSeriesOptions(n);const l=D3(a,n),c=l.resolve(),h=l.resolveParams(),d=l.resolveAnnotationThemes();l.clearSafe();const u=st(t,c);return J$(u),wl.isEnterprise||BN(u,!0),this.validateSeriesOptions(u),this.validateAxesOptions(u),this.validatePluginOptions(u),this.processMiniChartSeriesOptions(u),u.loadGoogleFonts||r.clear(),qi.debug(()=>["ChartOptions.slowSetup() - processed options",Ft(u)]),{activeTheme:a,processedOptions:u,themeParameters:h,annotationThemes:d,googleFonts:r,optionsGraph:l}}validatePluginOptions(t){for(const i of en.listModulesByType("plugin")){const s=i.name;if(s in t&&(!i.chartType||i.chartType===this.chartDef?.name)){const{cleared:n,invalid:o}=cs(t[s],i.options,i.name);for(const a of o)K.warn(a);t[s]=n}}}validateSeriesOptions(t){const i=this.chartDef?.name,s=[],n=t.series?.length??0;let o;for(let a=0;a!i||p.chartType===i).map(p=>p.name),"or",N1)),K.warn(l.type==null?`Option \`${r}.type\` is required and has not been provided; expecting ${o}, ignoring.`:`Unknown type \`${l.type}\` at \`${r}.type\`; expecting ${o}, ignoring.`);continue}else if(i&&c.chartType!==i){K.warn(`Series type \`${c.name}\` at \`${r}.type\` is not supported by chart type \`${i}\`, ignoring.`);continue}const{validate:h=cs}=c,{cleared:d,invalid:u}=h(l,c.options,r);for(const p of u)K.warn(p);od(u,r)||s.push(d)}t.series=s}validateAxesOptions(t){if(!("axes"in t)||!t.axes)return;const i=this.chartDef?.name,s=[],n=t.axes.length??0;let o;for(let a=0;ap.chartType===i).map(p=>p.name),"or",N1)),K.warn(`Unknown type \`${l.type}\` at \`${r}.type\`; expecting one of ${o}, ignoring all axes options.`),delete t.axes;break}else if(c.chartType!==i){K.warn(`Axis type \`${c.name}\` at \`${r}.type\` is not supported by chart type \`${i}\`, ignoring.`);break}const{validate:h=cs}=c,{cleared:d,invalid:u}=h(l,c.options,r);for(const p of u)K.warn(p);od(u,r)||s.push(d)}t.axes=s}diffOptions(t){return this===t?{}:t==null?this.processedOptions:this.fastDelta??wa(t.processedOptions,this.processedOptions,qi.JSON_DIFF_OPTS)}optionsType(t){return t.series?.[0]?.type??"line"}processSeriesOptions(t){const i=t.series?.map(s=>{s.type??(s.type="line");const o=!!en.getSeriesModule(s.type)?.options.visible;return st(this.getSeriesGroupingOptions(s),s,o&&{visible:!0})});t.series=this.setSeriesGroupingOptions(i??[])}processMiniChartSeriesOptions(t){const i=t.navigator?.miniChart?.series;i!=null&&(t.navigator.miniChart.series=this.setSeriesGroupingOptions(i))}getSeriesGroupingOptions(t){const i=co.isGroupable(t.type),s=co.isStackable(t.type),n=co.isStackedByDefault(t.type);t.grouped&&!i&&K.warnOnce(`unsupported grouping of series type "${t.type}".`),(t.stacked||t.stackGroup)&&!s&&K.warnOnce(`unsupported stacking of series type "${t.type}".`);let{grouped:o,stacked:a}=t;return a??(a=(n||t.stackGroup!=null)&&!(i&&o)),o??(o=!0),{stacked:s&&a,grouped:i&&o&&!(s&&a)}}setSeriesGroupingOptions(t){const i=this.getSeriesGrouping(t);qi.debug("ChartOptions.setSeriesGroupingOptions() - series grouping: ",i);const s={},n=i.reduce((o,a)=>{var r;return a.groupType==="default"||(o[r=a.seriesType]??(o[r]=0),o[a.seriesType]+=a.groupType==="stack"?1:a.series.length),o},{});return i.flatMap(o=>{var a;switch(s[a=o.seriesType]??(s[a]=0),o.groupType){case"stack":{const r=s[o.seriesType]++;return o.series.map((l,c)=>Object.assign(l,{seriesGrouping:{groupId:o.groupId,groupIndex:r,groupCount:n[o.seriesType],stackIndex:c,stackCount:o.series.length}}))}case"group":return o.series.map(r=>Object.assign(r,{seriesGrouping:{groupId:o.groupId,groupIndex:s[o.seriesType]++,groupCount:n[o.seriesType],stackIndex:0,stackCount:0}}))}return o.series}).map(({stacked:o,grouped:a,...r})=>r)}getSeriesGroupId(t){return[t.type,t.xKey,t.stacked?t.stackGroup??"stacked":"grouped"].filter(Boolean).join("-")}getSeriesGrouping(t){const i=new Map;return t.reduce((s,n)=>{const o=n.type;if(!n.stacked&&!n.grouped)s.push({groupType:"default",seriesType:o,series:[n],groupId:"__default__"});else{const a=this.getSeriesGroupId(n);if(!i.has(a)){const l={groupType:n.stacked?"stack":"group",seriesType:o,series:[],groupId:a};i.set(a,l),s.push(l)}i.get(a).series.push(n)}return s},[])}soloSeriesIntegrity(t){if(!Ne(t.series))return;const i=t.series;if(i&&i.length>1&&i.some(s=>co.isSolo(s.type))){const s=this.optionsType(t);if(co.isSolo(s))K.warn(`series[0] of type '${s}' is incompatible with other series types. Only processing series[0]`),t.series=i.slice(0,1);else{const{solo:n,nonSolo:o}=jS(i,r=>co.isSolo(r.type)?"solo":"nonSolo"),a=GS(n.map(r=>r.type)).join(", ");K.warn(`Unable to mix these series types with the lead series type: ${a}`),t.series=o}}}static processFontOptions(t,i,s,n=new Set){if(typeof t=="object"&&"fontFamily"in t)if(Array.isArray(t.fontFamily)){const o=[];for(const a of t.fontFamily)typeof a=="object"&&"googleFont"in a?(o.push(a.googleFont),n?.add(a.googleFont)):o.push(a);t.fontFamily=o.join(", ")}else typeof t.fontFamily=="object"&&"googleFont"in t.fontFamily&&(t.fontFamily=t.fontFamily.googleFont,n?.add(t.fontFamily));return n}processFonts(t,i=new Set){return ul(t,qi.processFontOptions,new Set(["data","theme"]),void 0,void 0,i)}static removeDisabledOptionJson(t){if("enabled"in t&&t.enabled===!1)for(const i of Object.keys(t))i!=="enabled"&&delete t[i]}removeDisabledOptions(t){ul(t,qi.removeDisabledOptionJson,new Set(["data","theme","contextMenu"]))}static removeLeftoverSymbolsJson(t){if(!(!t||!Ee(t)))for(const i of Object.keys(t)){const s=t[i];ly(s)&&delete t[i]}}removeLeftoverSymbols(t){ul(t,qi.removeLeftoverSymbolsJson,new Set(["data"]))}specialOverridesDefaults(t){if(t.window==null?t.window=qe():dG(t.window),t.document==null?t.document=Ma():hG(t.document),t.window==null)throw new Error("AG Charts - unable to resolve global window");if(t.document==null)throw new Error("AG Charts - unable to resolve global document");return t}};hh.OPTIONS_CLONE_OPTS_SLOW={shallow:new Set(["data","container"]),assign:new Set(["context","theme"])},hh.OPTIONS_CLONE_OPTS_FAST={shallow:new Set(["container"]),assign:new Set(["data","context","theme"])},hh.JSON_DIFF_OPTS=new Set(["data"]),hh.perfDebug=Pe.create(!0,"perf"),hh.FAST_PATH_OPTIONS=new Set(["data","width","height","container"]),hh.debug=Pe.create(!0,"opts");var Bg=hh,O1=Pe.create(!0,"opts"),El="AG Charts - Chart was destroyed, cannot perform request.",_g=class{constructor(t,i,s){this.factoryApi=i,this.licenseManager=s,this.chart=t}async update(t){if(!this.chart)throw new Error(El);return O1.group("AgChartInstance.update()",async()=>{const i=Pe.check("scene:stats","scene:stats:verbose")?performance.now():void 0;this.factoryApi.update(t,this,void 0,i),await this.chart?.waitForUpdate()})}async updateDelta(t){if(!this.chart)throw new Error(El);return O1.group("AgChartInstance.updateDelta()",async()=>{const i=Pe.check("scene:stats","scene:stats:verbose")?performance.now():void 0;this.factoryApi.updateUserDelta(this,t,i),await this.chart?.waitForUpdate()})}getOptions(){if(!this.chart)throw new Error(El);const t=Ft(this.chart.getOptions(),Bg.OPTIONS_CLONE_OPTS_FAST);for(const i of Object.keys(t))i.startsWith("_")&&delete t[i];return t}waitForUpdate(){if(!this.chart)throw new Error(El);return this.chart.waitForUpdate()}async applyTransaction(t){if(!this.chart)throw new Error(El);if(t==null||typeof t!="object")throw new Error("AG Charts - applyTransaction expects a transaction object.");const{append:i,prepend:s,remove:n}=t;if(i!=null&&!Array.isArray(i))throw new Error('AG Charts - transaction "append" must be an array.');if(s!=null&&!Array.isArray(s))throw new Error('AG Charts - transaction "prepend" must be an array.');if(n!=null&&!Array.isArray(n))throw new Error('AG Charts - transaction "remove" must be an array or single value.');return this.chart.applyTransaction(t)}async download(t){if(!this.chart)throw new Error(El);const i=await this.prepareResizedChart(this,this.chart,t);try{i.chart?.download(t?.fileName,t?.fileFormat)}finally{i.destroy()}}async __toSVG(t){if(!this.chart)throw new Error(El);const i=await this.prepareResizedChart(this,this.chart,{width:600,height:300,...t});try{return i?.chart?.toSVG()}finally{i?.destroy()}}async getImageDataURL(t){if(!this.chart)throw new Error(El);const i=await this.prepareResizedChart(this,this.chart,t);try{return i.chart.getCanvasDataURL(t?.fileFormat)}finally{i.destroy()}}getState(){return this.factoryApi.caretaker.save(...this.getEnabledOriginators())}async setState(t){const{chart:i}=this;if(!i)return;const s=this.getEnabledOriginators();if(!s.includes(i.ctx.legendManager)){await this.setStateOriginators(t,s);return}await this.setStateOriginators(t,s.filter(n=>n!==i.ctx.zoomManager)),await this.setStateOriginators(t,[i.ctx.zoomManager])}resetAnimations(){this.chart?.resetAnimations()}skipAnimations(){this.chart?.skipAnimations()}destroy(){this.releaseChart?(this.releaseChart(),this.releaseChart=void 0):this.chart&&(this.chart.publicApi=void 0,this.chart.destroy()),this.chart=void 0}async prepareResizedChart(t,i,s={}){const n=s.width??i.width??i.ctx.scene.canvas.width,o=s.height??i.height??i.ctx.scene.canvas.height,a=t.getState(),r=Ta.hasEnterpriseModules(),l={...i.chartOptions.processedOverrides,container:document.createElement("div"),width:n,height:o};s.width!=null&&s.height!=null&&(l.overrideDevicePixelRatio=1);const c=i.getOptions();r&&(l.animation={enabled:!1},this.licenseManager?.isDisplayWatermark()&&(l.foreground={text:this.licenseManager.getWatermarkMessage(),image:{url:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU4IiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgMjU4IDQwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjUuNzc5IDI4LjY1N0gxMy4zNTlMMTEuMTczIDM0LjAxMkg1LjY3Mjk3TDE3LjE4MiA3LjA1OTk5SDIxLjk1M0wzMy40NjIgMzQuMDEySDI3Ljk2MkwyNS43NzYgMjguNjU3SDI1Ljc3OVpNMjQuMDY4IDI0LjM5N0wxOS41ODggMTMuNDM0TDE1LjEwNyAyNC4zOTdIMjQuMDY4Wk02Mi4wOTIgMTguODIzSDQ5LjgxN1YyMy4wODZINTYuNzc1QzU2LjU1NSAyNS4yMjIgNTUuNzU1IDI2LjkyNyA1NC4zNzIgMjguMjAyQzUyLjk4OSAyOS40NzYgNTEuMTY2IDMwLjExNSA0OC45MDkgMzAuMTE1QzQ3LjYyMiAzMC4xMTUgNDYuNDUgMjkuODg1IDQ1LjM5MyAyOS40MjNDNDQuMzU4MyAyOC45NzgxIDQzLjQzMjYgMjguMzEzOCA0Mi42OCAyNy40NzZDNDEuOTI3IDI2LjYzOSA0MS4zNDQgMjUuNjMxIDQwLjkzMSAyNC40NTNDNDAuNTE5IDIzLjI3NSA0MC4zMTEgMjEuOTcgNDAuMzExIDIwLjUzN0M0MC4zMTEgMTkuMTA1IDQwLjUxNiAxNy44IDQwLjkzMSAxNi42MjFDNDEuMzQ0IDE1LjQ0MyA0MS45MjcgMTQuNDM2IDQyLjY4IDEzLjU5OEM0My40Mzc2IDEyLjc1NzcgNDQuMzY5NiAxMi4wOTMyIDQ1LjQxMSAxMS42NTFDNDYuNDc4IDExLjE4OSA0Ny42NTYgMTAuOTYgNDguOTQ2IDEwLjk2QzUxLjYxMiAxMC45NiA1My42MzcgMTEuNjAyIDU1LjAyIDEyLjg4NUw1OC4zIDkuNjA0OTlDNTUuODE3IDcuNjY5OTkgNTIuNjc2IDYuNjk5OTkgNDguODcyIDYuNjk5OTlDNDYuNzYgNi42OTk5OSA0NC44NTMgNy4wMzQ5OSA0My4xNTQgNy43MDA5OUM0MS40NTUgOC4zNjc5OSAzOS45OTggOS4zMDM5OSAzOC43ODMgMTAuNTA0QzM3LjU2NyAxMS43MDcgMzYuNjM0IDEzLjE1OCAzNS45NzcgMTQuODU3QzM1LjMxOSAxNi41NTYgMzQuOTk0IDE4LjQ1MSAzNC45OTQgMjAuNTRDMzQuOTk0IDIyLjYzIDM1LjMyOSAyNC40OTQgMzUuOTk1IDI2LjIwNUMzNi42NjIgMjcuOTE2IDM3LjYwNSAyOS4zNzQgMzguODE3IDMwLjU3N0M0MC4wMzIgMzEuNzggNDEuNDg2IDMyLjcxMyA0My4xODggMzMuMzgzQzQ0Ljg4OCAzNC4wNDkgNDYuNzgyIDM0LjM4NCA0OC44NzIgMzQuMzg0QzUwLjk2MSAzNC4zODQgNTIuNzUgMzQuMDQ5IDU0LjM5IDMzLjM4M0M1Ni4wMzEgMzIuNzE2IDU3LjQyNiAzMS43OCA1OC41NzkgMzAuNTc3QzU5LjczMyAyOS4zNzQgNjAuNjE5IDI3LjkxNiA2MS4yMzkgMjYuMjA1QzYxLjg2IDI0LjQ5NCA2Mi4xNyAyMi42MDUgNjIuMTcgMjAuNTRDNjIuMTY5NiAxOS45Njg4IDYyLjE0NDUgMTkuMzk4IDYyLjA5NSAxOC44MjlMNjIuMDkyIDE4LjgyM1pNMTUxLjgxIDE2Ljk4MUMxNTMuNDEgMTQuNjA5IDE1Ny40MTkgMTQuMzU4IDE1OS4wMjIgMTQuMzU4VjE4LjkxQzE1Ni45NTcgMTguOTEgMTU0Ljk4NSAxOC45OTYgMTUzLjc1NyAxOS44OTJDMTUyLjUyOSAyMC43OTIgMTUxLjkxOSAyMS45ODIgMTUxLjkxOSAyMy40NjRWMzMuOTlIMTQ2Ljk2NFYxNC4zNThIMTUxLjczNkwxNTEuODEgMTYuOTgxWk0xNDMuMDExIDE0LjM2MVYzNC4wMzFIMTM4LjI0TDEzOC4xMzEgMzEuMDQ1QzEzNy40NjYgMzIuMDc2IDEzNi41NTEgMzIuOTIxOSAxMzUuNDcxIDMzLjUwNEMxMzQuMzc2IDM0LjA5OSAxMzMuMDY4IDM0LjM5NiAxMzEuNTM2IDM0LjM5NkMxMzAuMiAzNC4zOTYgMTI4Ljk2MyAzNC4xNTIgMTI3LjgyMiAzMy42NjhDMTI2LjcgMzMuMTk2NCAxMjUuNjg5IDMyLjQ5NSAxMjQuODU1IDMxLjYwOUMxMjQuMDE4IDMwLjcyMiAxMjMuMzU0IDI5LjY2MiAxMjIuODcxIDI4LjQyMkMxMjIuMzg0IDI3LjE4NSAxMjIuMTQyIDI1LjgxMSAxMjIuMTQyIDI0LjMwNEMxMjIuMTQyIDIyLjc5OCAxMjIuMzg0IDIxLjM3OCAxMjIuODcxIDIwLjExNkMxMjMuMzU3IDE4Ljg1NCAxMjQuMDE4IDE3Ljc3MiAxMjQuODU1IDE2Ljg3M0MxMjUuNjg4IDE1Ljk3NjQgMTI2LjY5OCAxNS4yNjM2IDEyNy44MjIgMTQuNzhDMTI4Ljk2MyAxNC4yODEgMTMwLjIwMyAxNC4wMzMgMTMxLjUzNiAxNC4wMzNDMTMzLjA0MyAxNC4wMzMgMTM0LjMzIDE0LjMxOCAxMzUuMzk3IDE0Ljg4OEMxMzYuNDYyIDE1LjQ1ODkgMTM3LjM3NSAxNi4yNzggMTM4LjA1NyAxNy4yNzZWMTQuMzYxSDE0My4wMTFaTTEzMi42MzEgMzAuMTMzQzEzNC4yNTYgMzAuMTMzIDEzNS41NjcgMjkuNTk0IDEzNi41NjUgMjguNTEyQzEzNy41NjEgMjcuNDMgMTM4LjA2IDI1Ljk5MSAxMzguMDYgMjQuMTk2QzEzOC4wNiAyMi40MDEgMTM3LjU2MSAyMC45OSAxMzYuNTY1IDE5Ljg5OUMxMzUuNTcgMTguODA3IDEzNC4yNTkgMTguMjU4IDEzMi42MzEgMTguMjU4QzEzMS4wMDMgMTguMjU4IDEyOS43MjkgMTguODA0IDEyOC43MzQgMTkuODk5QzEyNy43MzggMjAuOTkzIDEyNy4yMzkgMjIuNDM4IDEyNy4yMzkgMjQuMjMzQzEyNy4yMzkgMjYuMDI4IDEyNy43MzUgMjcuNDMzIDEyOC43MzQgMjguNTE1QzEyOS43MjkgMjkuNTk0IDEzMS4wMjggMzAuMTM2IDEzMi42MzEgMzAuMTM2VjMwLjEzM1pNOTMuNjk4IDI3Ljg3NkM5My41Nzk1IDI4LjAwMjUgOTMuNDU2NCAyOC4xMjQ2IDkzLjMyOSAyOC4yNDJDOTEuOTQ3IDI5LjUxNiA5MC4xMjMgMzAuMTU1IDg3Ljg2NiAzMC4xNTVDODYuNTggMzAuMTU1IDg1LjQwOCAyOS45MjYgODQuMzUgMjkuNDY0QzgzLjMxNTUgMjkuMDE4OSA4Mi4zODk4IDI4LjM1NDYgODEuNjM3IDI3LjUxN0M4MC44ODQgMjYuNjc5IDgwLjMwMSAyNS42NzIgNzkuODg5IDI0LjQ5NEM3OS40NzYgMjMuMzE1IDc5LjI2OSAyMi4wMSA3OS4yNjkgMjAuNTc4Qzc5LjI2OSAxOS4xNDUgNzkuNDczIDE3Ljg0IDc5Ljg4OSAxNi42NjJDODAuMzAxIDE1LjQ4NCA4MC44ODQgMTQuNDc2IDgxLjYzNyAxMy42MzlDODIuMzk0OSAxMi43OTg3IDgzLjMyNzMgMTIuMTM0MiA4NC4zNjkgMTEuNjkyQzg1LjQzNiAxMS4yMyA4Ni42MTQgMTEgODcuOTAzIDExQzkwLjU3IDExIDkyLjU5NSAxMS42NDIgOTMuOTc3IDEyLjkyNkw5Ny4yNTggOS42NDQ5OUM5NC43NzQgNy43MTA5OSA5MS42MzMgNi43Mzk5OSA4Ny44MjkgNi43Mzk5OUM4NS43MTggNi43Mzk5OSA4My44MTEgNy4wNzQ5OSA4Mi4xMTIgNy43NDE5OUM4MC40MTMgOC40MDc5OSA3OC45NTYgOS4zNDQ5OSA3Ny43NCAxMC41NDVDNzYuNTI1IDExLjc0NyA3NS41OTIgMTMuMTk5IDc0LjkzNCAxNC44OThDNzQuMjc3IDE2LjU5NyA3My45NTEgMTguNDkxIDczLjk1MSAyMC41ODFDNzMuOTUxIDIyLjY3IDc0LjI4NiAyNC41MzQgNzQuOTUzIDI2LjI0NUM3NS42MTkgMjcuOTU3IDc2LjU2MiAyOS40MTQgNzcuNzc0IDMwLjYxN0M3OC45OSAzMS44MiA4MC40NDQgMzIuNzUzIDgyLjE0NiAzMy40MjNDODMuODQ1IDM0LjA5IDg1LjczOSAzNC40MjQgODcuODI5IDM0LjQyNEM4OS45MTkgMzQuNDI0IDkxLjcwOCAzNC4wOSA5My4zNDggMzMuNDIzQzk0LjcxOCAzMi44NjUgOTUuOTE4IDMyLjEyMSA5Ni45NDggMzEuMTkxQzk3LjE0OSAzMS4wMDggOTcuMzQ4IDMwLjgxNSA5Ny41MzcgMzAuNjJMOTMuNzAxIDI3Ljg4NUw5My42OTggMjcuODc2Wk0xMTAuODAyIDE0LjAxNUMxMDkuMTk5IDE0LjAxNSAxMDYuODM2IDE0LjQ3MSAxMDUuNjExIDE2LjE1OEwxMDUuNTM3IDYuMDE1OTlIMTAwLjc2NVYzMy45MzlIMTA1LjcyVjIyLjY0MUMxMDUuNzcxIDIxLjQ2MDcgMTA2LjI4OCAyMC4zNDg4IDEwNy4xNTcgMTkuNTQ4OUMxMDguMDI3IDE4Ljc0OTEgMTA5LjE3OCAxOC4zMjY2IDExMC4zNTggMTguMzc0QzExMy4zOTcgMTguMzc0IDExNC4yNjggMjEuMTU5IDExNC4yNjggMjIuNjQxVjMzLjkzOUgxMTkuMjIzVjIxLjA1OUMxMTkuMjIzIDIxLjA1OSAxMTkuMTQyIDE0LjAxNSAxMTAuODAyIDE0LjAxNVpNMTczLjc2MyAxNC4zNThIMTY5Ljk5OVY4LjcxNDk5SDE2NS4wNDhWMTQuMzU4SDE2MS4yODRWMTguOTE2SDE2NS4wNDhWMzQuMDAzSDE2OS45OTlWMTguOTE2SDE3My43NjNWMTQuMzU4Wk0xOTAuNzg3IDI1LjI2MkMxOTAuMTI5IDI0LjUwMTQgMTg5LjMwNyAyMy44OTk0IDE4OC4zODQgMjMuNTAxQzE4Ny40ODggMjMuMTE3IDE4Ni4zMzEgMjIuNzMyIDE4NC45NDggMjIuMzY0QzE4NC4xNjUgMjIuMTQzOSAxODMuMzkgMjEuODk3OCAxODIuNjIzIDIxLjYyNkMxODIuMTYzIDIxLjQ2MjEgMTgxLjc0MSAyMS4yMDY2IDE4MS4zODMgMjAuODc1QzE4MS4yMzUgMjAuNzQyMSAxODEuMTE4IDIwLjU3ODkgMTgxLjAzOSAyMC4zOTY0QzE4MC45NjEgMjAuMjE0IDE4MC45MjIgMjAuMDE2NiAxODAuOTI3IDE5LjgxOEMxODAuOTI3IDE5LjI3MiAxODEuMTU2IDE4Ljg0NCAxODEuNjI1IDE4LjUxQzE4Mi4xMjEgMTguMTU2IDE4Mi44NjIgMTcuOTc2IDE4My44MjYgMTcuOTc2QzE4NC43OSAxNy45NzYgMTg1LjU4NyAxOC4yMDkgMTg2LjE0OCAxOC42NjhDMTg2LjcwNiAxOS4xMjQgMTg3LjAwNyAxOS43MjUgMTg3LjA3MiAyMC41TDE4Ny4wOTQgMjAuNzgySDE5MS42MzNMMTkxLjYxNyAyMC40NkMxOTEuNTIxIDE4LjQ4NSAxOTAuNzcxIDE2LjkgMTg5LjM4NSAxNS43NUMxODguMDEyIDE0LjYxMiAxODYuMTg1IDE0LjAzMyAxODMuOTYyIDE0LjAzM0MxODIuNDc3IDE0LjAzMyAxODEuMTQxIDE0LjI4NyAxNzkuOTk0IDE0Ljc4NkMxNzguODMxIDE1LjI5MSAxNzcuOTI2IDE1Ljk5NSAxNzcuMjk2IDE2Ljg4MkMxNzYuNjczIDE3Ljc0NTUgMTc2LjMzOCAxOC43ODQgMTc2LjM0MSAxOS44NDlDMTc2LjM0MSAyMS4xNjcgMTc2LjY5OCAyMi4yNDkgMTc3LjM5OSAyMy4wNjRDMTc4LjA2IDIzLjg0MzIgMTc4Ljg5OCAyNC40NTM0IDE3OS44NDIgMjQuODQ0QzE4MC43NDQgMjUuMjE2IDE4MS45MjggMjUuNjA3IDE4My4zNjEgMjZDMTg0LjgwNiAyNi40MSAxODUuODcyIDI2Ljc4NSAxODYuNTMgMjcuMTIzQzE4Ny4xIDI3LjQxNCAxODcuMzc5IDI3Ljg0NSAxODcuMzc5IDI4LjQ0NEMxODcuMzc5IDI5LjA0MiAxODcuMTIyIDI5LjQ2NyAxODYuNTk1IDI5LjgzOUMxODYuMDQzIDMwLjIyNiAxODUuMjM3IDMwLjQyNSAxODQuMjAxIDMwLjQyNUMxODMuMTY2IDMwLjQyNSAxODIuMzk0IDMwLjE3NCAxODEuNzQ5IDI5LjY3NEMxODEuMTEzIDI5LjE4MSAxODAuNzcyIDI4LjU4OSAxODAuNzEgMjcuODY0TDE4MC42ODUgMjcuNTgySDE3Ni4wMTNMMTc2LjAyNSAyNy45MDFDMTc2LjA2NyAyOS4wOTU1IDE3Ni40NzIgMzAuMjQ4NyAxNzcuMTg4IDMxLjIwNkMxNzcuOTA3IDMyLjE4IDE3OC44OTMgMzIuOTU4IDE4MC4xMTggMzMuNTE5QzE4MS4zMzYgMzQuMDc3IDE4Mi43MzIgMzQuMzYyIDE4NC4yNjYgMzQuMzYyQzE4NS44MDEgMzQuMzYyIDE4Ny4xMDkgMzQuMTA4IDE4OC4yMzggMzMuNjA5QzE4OS4zNzYgMzMuMTA0IDE5MC4yNzIgMzIuMzk0IDE5MC45MDEgMzEuNDk0QzE5MS41MzQgMzAuNTkyIDE5MS44NTMgMjkuNTU0IDE5MS44NTMgMjguNDAzQzE5MS44MjggMjcuMTEgMTkxLjQ2NiAyNi4wNTMgMTkwLjc3NyAyNS4yNjJIMTkwLjc4N1oiIGZpbGw9IiM5QjlCOUIiLz4KPHBhdGggZD0iTTI0MS45ODIgMjUuNjU4MlYxNy43MTE3SDIyOC40NDFMMjIwLjQ5NCAyNS42NTgySDI0MS45ODJaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNTcuMjM5IDUuOTUwODFIMjQwLjI2NUwyMzIuMjU1IDEzLjg5NzNIMjU3LjIzOVY1Ljk1MDgxWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjEyLjYxMSAzMy42MDQ4TDIxNi42OCAyOS41MzYxSDIzMC40MTJWMzcuNDgyN0gyMTIuNjExVjMzLjYwNDhaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yMTUuNTk5IDIxLjc4MDNIMjI0LjM3MkwyMzIuMzgyIDEzLjgzMzdIMjE1LjU5OVYyMS43ODAzWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjA2IDMzLjYwNDdIMjEyLjYxMUwyMjAuNDk0IDI1LjY1ODJIMjA2VjMzLjYwNDdaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNDAuMjY1IDUuOTUwODFMMjM2LjE5NyAxMC4wMTk0SDIxMC4yNTlWMi4wNzI4OEgyNDAuMjY1VjUuOTUwODFaIiBmaWxsPSIjOUI5QjlCIi8+Cjwvc3ZnPgo=",width:170,height:25,right:25,bottom:50,opacity:.7}}));const h={...i.chartOptions.specialOverrides},d={...i.chartOptions.optionMetadata},u=await this.chart?.ctx.dataService.getData(),p=this.factoryApi.create(c,l,h,d,u);await p.setState(a),p.chart?.ctx.zoomManager.updateZoom("chartProxy",i.ctx.zoomManager.getZoom()),p.chart?.ctx.legendManager.clearData(),p.chart?.ctx.legendManager.update(i.ctx.legendManager.getData());for(const[f,x]of i.series.entries())p.chart.series[f].visible=x.visible;const g=[];for(const f of i.modulesManager.legends())g.push(f.legend.pagination?.currentPage??0);for(const f of p.chart.modulesManager.legends()){const x=g.shift()??0;f.legend.pagination&&f.legend.pagination.setPage(x)}return p.chart?.update(0,{forceNodeDataRefresh:!0}),await p.waitForUpdate(),p}getEnabledOriginators(){if(!this.chart)return[];const{chartOptions:{processedOptions:t,optionMetadata:i},ctx:{annotationManager:s,chartTypeOriginator:n,zoomManager:o,legendManager:a}}=this.chart,r=[];return"annotations"in t&&t.annotations?.enabled&&r.push(s),i.presetType==="price-volume"&&r.push(n),(t.navigator?.enabled||t.zoom?.enabled)&&r.push(o),"legend"in this.chart&&r.push(a),r}async setStateOriginators(t,i){this.factoryApi.caretaker.restore(t,...i),this.chart?.ctx.updateService.update(2,{forceNodeDataRefresh:!0}),await this.chart?.waitForUpdate()}};_g.chartInstances=new WeakMap,M([ps({oldValue(e){e.destroyed||(e.publicApi=void 0),_g.chartInstances.delete(e)},newValue(e){e&&(e.publicApi=this,_g.chartInstances.set(e,this))}})],_g.prototype,"chart",2);var E1=_g,DD=class extends Ay{constructor(e){super(),this.ctx=e,this.localeText=void 0}};M([pl(e=>{e.ctx.localeManager.setLocaleText(e.localeText)}),C],DD.prototype,"localeText",2),M([pl(e=>{e.ctx.localeManager.setLocaleTextFormatter(e.getLocaleText)}),C],DD.prototype,"getLocaleText",2);var I3={type:"root",optionsKey:"locale",packageType:"community",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new DD(e)},lu=class extends Ay{constructor(e){super(),this.ctx=e,this.rectNode=new Li,this.textNode=new Pn,this.fill="white",this.node=this.createNode(),this.node.append([this.rectNode,this.textNode]),this.visible=!0,this.cleanup.register(e.scene.attachNode(this.node),e.eventsHub.on("layout:complete",t=>this.onLayoutComplete(t)))}createNode(){return new Be({name:"background",zIndex:0})}onLayoutComplete(e){const{width:t,height:i}=e.chart;this.rectNode.width=t,this.rectNode.height=i}};M([C,ii("node","visible")],lu.prototype,"visible",2),M([C,ii("rectNode","fill")],lu.prototype,"fill",2),M([C],lu.prototype,"image",2),M([C,ii("textNode")],lu.prototype,"text",2);var P1={type:"root",optionsKey:"background",packageType:"community",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new lu(e)},dh=class extends Le{constructor(e){super(),this.node=e,this.enabled=!1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=1}};M([ps({changeValue(e){e?this.node.strokeWidth=this.strokeWidth:this.node.strokeWidth=0}}),C],dh.prototype,"enabled",2),M([ii("node","stroke"),C],dh.prototype,"stroke",2),M([ii("node","strokeOpacity"),C],dh.prototype,"strokeOpacity",2),M([ps({changeValue(e){this.enabled?this.node.strokeWidth=e:this.node.strokeWidth=0}}),C],dh.prototype,"strokeWidth",2);function A3({orientation:e,bboxes:t,maxHeight:i,maxWidth:s,itemPaddingY:n=0,itemPaddingX:o=0,forceResult:a=!1}){const r=e==="horizontal",l={max:r?s:i,fn:r?u=>u.width:u=>u.height,padding:r?o:n},c={max:r?i:s,fn:r?u=>u.height:u=>u.width,padding:r?n:o};let h=0;const d=[];for(;h=1;){const l=L3(e,t,r,i,s,n);if(l==null&&r<=1)return;if(l==null){r--;continue}if(typeof l=="number"){if(l<=1)return;r=l1?l:r,r--;continue}return{processedBBoxCount:l.length*l[0].length,pageIndices:l}}}function L3(e,t,i,s,n,o){const a=[];let r=0,l=0,c=[];const h=[];for(let d=0;d0&&a.push(c),c=[]);const p=s.fn(e[d])+s.padding;h[u]=Math.max(h[u]??0,p),l=Math.max(l,n.fn(e[d])+n.padding);const g=r+l,f=!o||a.length>0;if(g>n.max&&f){c=[];break}if(h.reduce((m,v)=>m+v,0)>s.max&&!o)return h.length0&&a.push(c),a.length>0?a:void 0}function T3(e,t,i,s,n){let o=0,a=0;return{pages:e.map(l=>{t==="horizontal"&&(l=w3(l));let c=0;const h=l.map(p=>{const g=p.map(m=>(c=Math.max(m,c),i[m]));let f=0,x=0;for(const m of g)f+=m.height+s,x=Math.max(x,m.width+n);return{indices:p,bboxes:g,columnHeight:Math.ceil(f),columnWidth:Math.ceil(x)}});let d=0,u=0;for(const p of h)d+=p.columnWidth,u=Math.max(u,p.columnHeight);return o=Math.max(d,o),a=Math.max(u,a),{columns:h,startIndex:l[0][0],endIndex:c,pageWidth:d,pageHeight:u}}),maxPageWidth:o,maxPageHeight:a}}function w3(e){const t=[];for(const i of e[0])t.push([]);for(const[i,s]of e.entries())for(const[n,o]of s.entries())t[n][i]=o;return t}function N3(e,t){const i=e.length;let s=0;for(let n=0;nt.max)return i/n<2?Math.ceil(i/2):n;return i}var cu=class extends Le{constructor(){super(...arguments),this.color="black",this.fontStyle=void 0,this.fontWeight=void 0,this.fontSize=12,this.fontFamily="Verdana, sans-serif"}};M([C],cu.prototype,"color",2),M([C],cu.prototype,"fontStyle",2),M([C],cu.prototype,"fontWeight",2),M([C],cu.prototype,"fontSize",2),M([C],cu.prototype,"fontFamily",2);var Nr=class extends Le{constructor(){super(...arguments),this.size=15,this.fill=void 0,this.fillOpacity=void 0,this.stroke=void 0,this.strokeWidth=1,this.strokeOpacity=1}};M([C],Nr.prototype,"size",2),M([C],Nr.prototype,"fill",2),M([C],Nr.prototype,"fillOpacity",2),M([C],Nr.prototype,"stroke",2),M([C],Nr.prototype,"strokeWidth",2),M([C],Nr.prototype,"strokeOpacity",2);var px=class extends Le{constructor(e){super(),this.parent=e,this.shape="triangle",this.size=15,this.padding=8}};M([ps({changeValue(){this.parent.marker===this&&this.parent.onMarkerShapeChange()}})],px.prototype,"shape",2),M([C],px.prototype,"size",2),M([C],px.prototype,"padding",2);var uh=class extends Le{constructor(e,t){super(),this.chartUpdateCallback=e,this.pageUpdateCallback=t,this.id=hs(this),this.marker=new px(this),this.activeStyle=new Nr,this.inactiveStyle=new Nr,this.highlightStyle=new Nr,this.label=new cu,this.group=new us({name:"pagination"}),this.labelNode=new Pn,this.totalPages=0,this.currentPage=0,this.translationX=0,this.translationY=0,this.nextButtonDisabled=!1,this.previousButtonDisabled=!1,this._visible=!0,this._enabled=!0,this._orientation="vertical",this.nextButton=new wi,this.previousButton=new wi,this.labelNode.setProperties({textBaseline:"middle",fontSize:12,fontFamily:"Verdana, sans-serif",fill:"black",y:1}),this.group.append([this.nextButton,this.previousButton,this.labelNode]),this.update(),this.updateMarkers()}set visible(e){this._visible=e,this.updateGroupVisibility()}get visible(){return this._visible}set enabled(e){this._enabled=e,this.updateGroupVisibility()}get enabled(){return this._enabled}updateGroupVisibility(){this.group.visible=this.enabled&&this.visible}set orientation(e){switch(this._orientation=e,e){case"horizontal":{this.previousButton.rotation=-Math.PI/2,this.nextButton.rotation=Math.PI/2;break}case"vertical":default:this.previousButton.rotation=0,this.nextButton.rotation=Math.PI}}get orientation(){return this._orientation}update(){this.updateLabel(),this.updatePositions(),this.enableOrDisableButtons()}updatePositions(){this.group.translationX=this.translationX,this.group.translationY=this.translationY,this.updateLabelPosition(),this.updateNextButtonPosition()}updateLabelPosition(){const{size:e,padding:t}=this.marker;this.nextButton.size=e,this.previousButton.size=e,this.labelNode.x=e/2+t}updateNextButtonPosition(){const e=this.labelNode.getBBox();this.nextButton.translationX=e.width+(this.marker.size/2+this.marker.padding)*2}updateLabel(){const{currentPage:e,totalPages:t,labelNode:i,label:{color:s,fontStyle:n,fontWeight:o,fontSize:a,fontFamily:r}}=this;i.text=`${e+1} / ${t}`,i.fill=s,i.fontStyle=n,i.fontWeight=o,i.fontSize=a,i.fontFamily=r}updateMarkers(){const{nextButton:e,previousButton:t,nextButtonDisabled:i,previousButtonDisabled:s,activeStyle:n,inactiveStyle:o,highlightStyle:a,highlightActive:r}=this,l=(c,h)=>h?o:c===r?a:n;this.updateMarker(e,l("next",i)),this.updateMarker(t,l("previous",s))}updateMarker(e,t){const{shape:i,size:s}=this.marker;e.shape=i,e.size=s,e.fill=t.fill,e.fillOpacity=t.fillOpacity??1,e.stroke=t.stroke,e.strokeWidth=t.strokeWidth,e.strokeOpacity=t.strokeOpacity}enableOrDisableButtons(){const{currentPage:e,totalPages:t}=this,i=t===0,s=e===t-1,n=e===0;this.nextButtonDisabled=s||i,this.previousButtonDisabled=n||i}setPage(e){e=ve(0,e,Math.max(0,this.totalPages-1)),this.currentPage!==e&&(this.currentPage=e,this.onPaginationChanged())}getCursor(e){return{previous:this.previousButtonDisabled,next:this.nextButtonDisabled}[e]?void 0:"pointer"}onClick(e,t){e.preventDefault(),t==="next"&&!this.nextButtonDisabled?(this.incrementPage(),this.onPaginationChanged()):t==="previous"&&!this.previousButtonDisabled&&(this.decrementPage(),this.onPaginationChanged())}onMouseHover(e){this.highlightActive=e,this.updateMarkers(),this.chartUpdateCallback(7)}onPaginationChanged(){this.pageUpdateCallback(this.currentPage)}incrementPage(){this.currentPage=Math.min(this.currentPage+1,this.totalPages-1)}decrementPage(){this.currentPage=Math.max(this.currentPage-1,0)}onMarkerShapeChange(){this.updatePositions(),this.updateMarkers(),this.chartUpdateCallback(7)}attachPagination(e){e.append(this.group)}getBBox(){return this.group.getBBox()}computeCSSBounds(){const e=zt.toCanvas(this.previousButton),t=zt.toCanvas(this.nextButton);return{prev:e,next:t}}};uh.className="Pagination",M([C],uh.prototype,"marker",2),M([C],uh.prototype,"activeStyle",2),M([C],uh.prototype,"inactiveStyle",2),M([C],uh.prototype,"highlightStyle",2),M([C],uh.prototype,"label",2);var O3=class{constructor(e,t){this.dirty=!0,this.itemList=e.proxyInteractionService.createProxyContainer({type:"list",domManagerId:`${t}-toolbar`,classList:["ag-charts-proxy-legend-toolbar"],ariaLabel:{id:"ariaLabelLegend"}}),this.paginationGroup=e.proxyInteractionService.createProxyContainer({type:"group",domManagerId:`${t}-pagination`,classList:["ag-charts-proxy-legend-pagination"],ariaLabel:{id:"ariaLabelLegendPagination"}}),this.itemDescription=De("p"),this.itemDescription.style.display="none",this.itemDescription.id=Ic(),this.itemDescription.textContent=this.getItemAriaDescription(e.localeManager),this.itemList.getElement().append(this.itemDescription)}initLegendList(e){if(!this.dirty)return;const{ctx:t,itemSelection:i,datumReader:s,itemListener:n}=e,o=t.localeManager,a=i.length;i.each((r,l,c)=>{r.proxyButton?.destroy(),r.proxyButton=t.proxyInteractionService.createProxyElement({type:"listswitch",textContent:this.getItemAriaText(o,$e(s.getItemLabel(l)),c,a),ariaChecked:!!r.datum.enabled,ariaDescribedBy:this.itemDescription.id,parent:this.itemList});const h=r.proxyButton;h.addListener("click",d=>n.onClick(d.sourceEvent,r.datum,h)),h.addListener("dblclick",d=>n.onDoubleClick(d.sourceEvent,r.datum)),h.addListener("mouseenter",d=>n.onHover(d.sourceEvent,r)),h.addListener("mouseleave",()=>n.onLeave()),h.addListener("contextmenu",d=>n.onContextClick(d,r)),h.addListener("blur",()=>n.onLeave()),h.addListener("focus",d=>n.onHover(d.sourceEvent,r)),h.addListener("drag-start",()=>{})}),this.dirty=!1}update(e){e.visible&&(this.initLegendList(e),this.updateItemProxyButtons(e),this.updatePaginationProxyButtons(e,!0)),this.updateVisibility(e.visible)}updateVisibility(e){this.itemList.setHidden(!e),this.paginationGroup.setHidden(!e)}updateItemProxyButtons({itemSelection:e,group:t,pagination:i,interactive:s}){const n=zt.toCanvas(t);this.itemList.setBounds(n);const o=Math.max(...e.nodes().map(a=>a.getBBox().height));e.each((a,r)=>{if(a.proxyButton){const l=a.pageIndex===i.currentPage,{x:c,y:h,height:d,width:u}=zt.toCanvas(a),p=(o-d)/2,g={x:c-n.x,y:h-p-n.y,height:o,width:u},f=s&&l;a.proxyButton.setCursor("pointer"),a.proxyButton.setEnabled(f),a.proxyButton.setPointerEvents(f?void 0:"none"),a.proxyButton.setBounds(g)}})}updatePaginationProxyButtons(e,t){const{pagination:i}=e;if(this.paginationGroup.setHidden(!i.visible),t&&"ctx"in e){const{oldPages:s,newPages:n}=e,o=(s?.length??n.length)>1,a=n.length>1;o!==a&&(a?this.createPaginationButtons(e):this.destroyPaginationButtons()),this.paginationGroup.setAriaHidden(a?void 0:!0)}if(this.prevButton&&this.nextButton){const{prev:s,next:n}=i.computeCSSBounds(),o=de.merge([s,n]);s.x-=o.x,s.y-=o.y,n.x-=o.x,n.y-=o.y,this.paginationGroup.setBounds(o),this.prevButton.setBounds(s),this.nextButton.setBounds(n),this.prevButton.setEnabled(i.currentPage!==0),this.nextButton.setEnabled(i.currentPage!==i.totalPages-1),this.nextButton.setCursor(i.getCursor("next")),this.prevButton.setCursor(i.getCursor("previous"))}}createPaginationButtons(e){const{ctx:t,pagination:i}=e;this.prevButton||(this.prevButton=t.proxyInteractionService.createProxyElement({type:"button",textContent:{id:"ariaLabelLegendPagePrevious"},tabIndex:0,parent:this.paginationGroup}),this.prevButton.addListener("click",s=>this.onPageButton(e,s,"previous")),this.prevButton.addListener("mouseenter",()=>i.onMouseHover("previous")),this.prevButton.addListener("mouseleave",()=>i.onMouseHover(void 0))),this.nextButton||(this.nextButton=t.proxyInteractionService.createProxyElement({type:"button",textContent:{id:"ariaLabelLegendPageNext"},tabIndex:0,parent:this.paginationGroup}),this.nextButton.addListener("click",s=>this.onPageButton(e,s,"next")),this.nextButton.addListener("mouseenter",()=>i.onMouseHover("next")),this.nextButton.addListener("mouseleave",()=>i.onMouseHover(void 0)))}destroyPaginationButtons(){this.nextButton?.destroy(),this.prevButton?.destroy(),this.nextButton=void 0,this.prevButton=void 0}onPageButton(e,t,i){e.pagination.onClick(t.sourceEvent,i),this.updatePaginationProxyButtons(e,!1)}onDataUpdate(e,t){this.dirty=e.length!==t.length||e.some((i,s,n)=>{const[o,a]=[t[s],e[s]];return o.id!==a.id})}onLocaleChanged(e,t,i){const s=t.length;t.each(({proxyButton:n},o,a)=>{const r=n?.getElement();if(r!=null){const l=$e(i.getItemLabel(o));r.textContent=this.getItemAriaText(e,l,a,s)}}),this.itemDescription.textContent=this.getItemAriaDescription(e)}onPageChange(e){this.updateItemProxyButtons(e),this.updatePaginationProxyButtons(e,!1)}getItemAriaText(e,t,i,s){return i>=0&&t?(i++,e.t("ariaLabelLegendItem",{label:t,index:i,count:s})):e.t("ariaLabelLegendItemUnknown")}getItemAriaDescription(e){return e.t("ariaDescriptionLegendItem")}};function R1(e,{itemId:t,seriesId:i,label:{text:s}},n){const o={defaultPrevented:!1,apiEvent:{type:e,itemId:t,seriesId:i,event:n,text:$e(s),preventDefault:()=>o.defaultPrevented=!0}};return o}var xo=class extends us{constructor(){super({name:"markerLabelGroup"}),this.symbolsGroup=this.appendChild(new Be({name:"legend-markerLabel-symbols",renderToOffscreenCanvas:!0,optimizeForInfrequentRedraws:!0})),this.label=this.appendChild(new Pn),this.enabled=!0,this.pageIndex=Number.NaN,this.spacing=0,this.length=0,this.isCustomMarker=!1,this.marker=this.symbolsGroup.appendChild(new wi({zIndex:1})),this.line=this.symbolsGroup.appendChild(new Rn({zIndex:0})),this.line.visible=!1,this.label.textBaseline="middle",this.label.y=1}destroy(){super.destroy(),this.proxyButton?.destroy()}setEnabled(e){this.enabled=e,this.refreshVisibilities()}getTextMeasureBBox(){return this.layout(),de.merge([this.symbolsGroup.getBBox(),this.label.getTextMeasureBBox()])}refreshVisibilities(){const e=this.enabled?1:.5;this.label.opacity=e,this.opacity=e}layout(){const{marker:e,line:t,length:i,isCustomMarker:s}=this;let n=0,o=0;if(e.visible){const{size:a}=e,r=wi.anchor(e.shape);n=(r.x-.5)*a+i/2,o=(r.y-.5)*a,s?(e.x=0,e.y=0,e.translationX=n,e.translationY=o):(e.x=n,e.y=o,e.translationX=0,e.translationY=0)}t.visible&&(t.x1=0,t.x2=i,t.y1=0,t.y2=0)}preRender(e){const t=super.preRender(e);return this.layout(),t}layoutLabel(){const{length:e,spacing:t}=this;this.label.x=e+t}computeBBox(){return this.layout(),super.computeBBox()}};xo.className="MarkerLabel",M([ii("label")],xo.prototype,"text",2),M([ii("label")],xo.prototype,"fontStyle",2),M([ii("label")],xo.prototype,"fontWeight",2),M([ii("label")],xo.prototype,"fontSize",2),M([ii("label")],xo.prototype,"fontFamily",2),M([ii("label","fill")],xo.prototype,"color",2),M([pl(e=>e.layoutLabel())],xo.prototype,"spacing",2),M([pl(e=>e.layoutLabel())],xo.prototype,"length",2),M([ne()],xo.prototype,"isCustomMarker",2);function gx(e){const{placement:t="bottom",floating:i=!1,xOffset:s=0,yOffset:n=0}=typeof e=="string"?{placement:e,floating:!1}:e;return{placement:t,floating:i,xOffset:s,yOffset:n}}var Pl=class extends Le{constructor(){super(...arguments),this.maxLength=void 0,this.color="black",this.fontStyle=void 0,this.fontWeight=void 0,this.fontSize=12,this.fontFamily="Verdana, sans-serif"}};M([C],Pl.prototype,"maxLength",2),M([C],Pl.prototype,"color",2),M([C],Pl.prototype,"fontStyle",2),M([C],Pl.prototype,"fontWeight",2),M([C],Pl.prototype,"fontSize",2),M([C],Pl.prototype,"fontFamily",2),M([C],Pl.prototype,"formatter",2);var hu=class extends Le{constructor(){super(...arguments),this.shape=void 0,this.size=15,this.padding=8}};M([C],hu.prototype,"shape",2),M([C],hu.prototype,"size",2),M([C],hu.prototype,"padding",2),M([C],hu.prototype,"strokeWidth",2),M([C],hu.prototype,"enabled",2);var kD=class extends Le{};M([C],kD.prototype,"strokeWidth",2),M([C],kD.prototype,"length",2);var Rl=class extends Le{constructor(){super(...arguments),this.paddingX=16,this.paddingY=8,this.showSeriesStroke=!1,this.marker=new hu,this.label=new Pl,this.line=new kD}};M([C],Rl.prototype,"maxWidth",2),M([C],Rl.prototype,"paddingX",2),M([C],Rl.prototype,"paddingY",2),M([C],Rl.prototype,"showSeriesStroke",2),M([C],Rl.prototype,"marker",2),M([C],Rl.prototype,"label",2),M([C],Rl.prototype,"line",2);var ID=class extends Le{};M([C],ID.prototype,"legendItemClick",2),M([C],ID.prototype,"legendItemDoubleClick",2);var z1={type:"gradient",bounds:"item",gradient:"linear",colorStops:[{color:"black"}],rotation:0,reverse:!1,colorSpace:"rgb"},F1={type:"pattern",pattern:"forward-slanted-lines",width:8,height:8,padding:1,fill:"black",fillOpacity:1,backgroundFill:"white",backgroundFillOpacity:1,stroke:"black",strokeOpacity:1,strokeWidth:1,rotation:0,scale:1},B1={type:"image",backgroundFill:"black",backgroundFillOpacity:1,rotation:0,repeat:"no-repeat",fit:"contain",width:8,height:8},pi=class extends Le{constructor(e){super(),this.ctx=e,this.id=hs(this),this.group=new us({name:"legend",zIndex:16}),this.itemSelection=Bs.select(this.group,xo),this.containerNode=this.group.appendChild(new Li({name:"legend-container"})),this.oldSize=[0,0],this.pages=[],this.maxPageSize=[0,0],this.paginationTrackingIndex=0,this.truncatedItems=new Set,this._data=[],this.toggleSeries=!0,this.item=new Rl,this.listeners=new ID,this.enabled=!0,this.position="bottom",this.border=new dh(this.containerNode),this.cornerRadius=0,this.fillOpacity=1,this.padding=4,this.spacing=0,this.cleanup=new St,this.size=[0,0],this._visible=!0,this.pagination=new uh(i=>e.updateService.update(i),i=>this.updatePageNumber(i)),this.pagination.attachPagination(this.group);const{items:t}=e.contextMenuRegistry.builtins;t["toggle-series-visibility"].action=i=>this.contextToggleVisibility(i),t["toggle-other-series"].action=i=>this.contextToggleOtherSeries(i),this.cleanup.register(e.eventsHub.on("legend:change",this.onLegendDataChange.bind(this)),e.eventsHub.on("legend:change-partial",this.onLegendDataChangePartial.bind(this)),e.layoutManager.registerElement(1,i=>this.positionLegend(i)),e.eventsHub.on("locale:change",()=>this.onLocaleChanged()),()=>delete t["toggle-series-visibility"].action,()=>delete t["toggle-other-series"].action,()=>this.group.remove()),this.domProxy=new O3(this.ctx,this.id),this.ctx.historyManager.addMementoOriginator(e.legendManager)}set data(e){Ci(e,this._data)||(this.domProxy.onDataUpdate(this._data,e),this._data=e,this.updateGroupVisibility())}get data(){return this._data}onLegendDataChange({legendData:e=[]}){this.enabled&&(this.data=e.filter(t=>!t.hideInLegend))}onLegendDataChangePartial(e){this.itemSelection.each(({proxyButton:t},{itemId:i})=>{if(t!=null)for(const s of e.legendData)s.itemId===i&&t.setChecked(s.enabled)})}destroy(){this.ctx.domManager.removeChild("canvas-overlay",`${this.id}-toolbar`),this.ctx.domManager.removeChild("canvas-overlay",`${this.id}-pagination`),this.cleanup.flush(),this.itemSelection.clear()}getOrientation(){return this.orientation??"horizontal"}set visible(e){this._visible=e,this.updateGroupVisibility()}get visible(){return this._visible}updateGroupVisibility(){this.group.visible=this.enabled&&this.visible&&this.data.length>0}isInteractive(){const{toggleSeries:e,listeners:{legendItemClick:t,legendItemDoubleClick:i}}=this;return e||i!=null||t!=null}attachLegend(e){e.appendChild(this.group)}getItemLabel(e){const{formatter:t}=this.item.label;if(t){const i=e.datum;return this.cachedCallWithContext(t,{itemId:e.itemId,value:e.label.text,seriesId:e.seriesId,...i&&{datum:i}})}return e.label.text}calcLayout(e,t){const{paddingX:i,paddingY:s,label:n,maxWidth:o,label:{maxLength:a=1/0,fontStyle:r,fontWeight:l,fontSize:c,fontFamily:h}}=this.item,d=[...this.data];this.reverseOrder&&d.reverse(),this.itemSelection.update(d);const u=[],p=Je(n),f=o??e*.8,{markerWidth:x,anyLineEnabled:m}=this.calculateMarkerWidth();if(this.itemSelection.each((w,N)=>{w.fontStyle=r,w.fontWeight=l,w.fontSize=c,w.fontFamily=h;const O=this.updateMarkerLabel(w,N,x,m),P=N.itemId??N.id,F=this.getItemLabel(N),_=$e(F,"").replace(ld," ");w.text=this.truncate(_,a,f,O,p,P),u.push(w.getTextMeasureBBox())}),e=Math.max(1,e),t=Math.max(1,t),!Number.isFinite(e))return{};[e,t]=this.updateContainer(e,t);const v=this.size,b=this.oldSize;v[0]=e,v[1]=t,(v[0]!==b[0]||v[1]!==b[1])&&(b[0]=v[0],b[1]=v[1]);const{pages:S,maxPageHeight:D,maxPageWidth:L}=this.updatePagination(u,e,t),I=this.pages;this.pages=S,this.maxPageSize=[L-i,D-s];const A=this.pagination.currentPage,T=this.pages[A];return this.pages.length<1||!T?(this.visible=!1,{oldPages:I}):(this.visible=!0,this.updatePositions(A),this.update(),{oldPages:I})}isCustomMarker(e,t){return e&&t!==void 0&&typeof t!="string"}calcSymbolsEnabled(e){const{showSeriesStroke:t,marker:i}=this.item,s=!!i.enabled||!t||(e.marker.enabled??!0),n=!!(e.line&&t),o=this.isCustomMarker(s,e.marker.shape);return{markerEnabled:s,lineEnabled:n,isCustomMarker:o}}calcSymbolsLengths(e,t,i){const{marker:s,line:n}=this.item;let o;const{shape:a}=e.marker;if(this.isCustomMarker(t,a)){const c=new wi;c.shape=a,c.updatePath();const h=c.getBBox();o=Math.max(h.width,h.height)}const r=t?s.size:0,l=i?n.length??25:0;return{markerLength:r,lineLength:l,customMarkerSize:o}}calculateMarkerWidth(){let e=0,t=!1;return this.itemSelection.each((i,s)=>{const{symbol:n}=s,{lineEnabled:o,markerEnabled:a}=this.calcSymbolsEnabled(n),{markerLength:r,lineLength:l,customMarkerSize:c=-1/0}=this.calcSymbolsLengths(n,a,o);e=Math.max(e,l,c,r),t||(t=o)}),{markerWidth:e,anyLineEnabled:t}}updateMarkerLabel(e,t,i,s){const{marker:n,paddingX:o}=this.item,{symbol:a}=t;let r=o;const{markerEnabled:l,isCustomMarker:c}=this.calcSymbolsEnabled(a),h=n.padding;(l||s)&&(r+=h+i);const{marker:d,line:u}=e;return d.visible=l,d.visible&&(d.shape=n.shape??a.marker.shape??"square",d.size=n.size,Dr(d,this.getMarkerStyles(Ft(a)))),u.visible=s,u.visible&&Dr(u,this.getLineStyles(a)),e.length=i,e.spacing=h,e.isCustomMarker=c,r}updateContainer(e,t){const i=this.getContainerStyles();return this.containerNode.width=0,this.containerNode.height=0,Dr(this.containerNode,i),this.containerNode.cornerRadius=i.cornerRadius,e-=i.strokeWidth*2+i.padding.left+i.padding.right,t-=i.strokeWidth*2+i.padding.top+i.padding.bottom,[e,t]}truncate(e,t,i,s,n,o){let a=!1;e.length>t&&(e=e.substring(0,t),a=!0);const r=cd(e,n,i-s,a);return xp(r)?this.truncatedItems.add(o):this.truncatedItems.delete(o),r}updatePagination(e,t,i){const s=this.getOrientation(),n=Math.min(this.paginationTrackingIndex,e.length);this.pagination.orientation=s,this.pagination.translationX=0,this.pagination.translationY=0;const{pages:o,maxPageHeight:a,maxPageWidth:r,paginationBBox:l,paginationVertical:c}=this.calculatePagination(e,t,i),h=o.findIndex(b=>b.endIndex>=n);this.pagination.currentPage=ve(0,h,o.length-1);const{paddingX:d,paddingY:u}=this.item,p=8,g=r-d,f=a-u;let x=0,m=-l.y-this.item.marker.size/2;c?m+=f+p:(x+=-l.x+g+p,m+=(f-l.height)/2),this.pagination.translationX=x,this.pagination.translationY=m,this.pagination.update(),this.pagination.updateMarkers();let v=0;return this.itemSelection.each((b,S,D)=>{D>(o[v]?.endIndex??1/0)&&v++,b.pageIndex=v}),{maxPageHeight:a,maxPageWidth:r,pages:o}}calculatePagination(e,t,i){const{paddingX:s,paddingY:n}=this.item,o=["left","left-top","left-bottom","right","right-top","right-bottom"],{placement:a}=gx(this.position),r=this.getOrientation(),l=o.includes(a);let c=this.pagination.getBBox(),h=new de(0,0,0,0),d=[],u=0,p=0,g=0;const f=m=>m.width===c.width&&m.height===c.height,x=this.maxWidth!==void 0&&this.maxHeight!==void 0;do{if(g++>10){K.warn("unable to find stable legend layout.");break}c=h;const m=t-(l?0:c.width),v=i-(l?c.height:0),b=A3({orientation:r,bboxes:e,maxHeight:v,maxWidth:m,itemPaddingY:n,itemPaddingX:s,forceResult:x});d=b?.pages??[],u=b?.maxPageWidth??0,p=b?.maxPageHeight??0;const S=d.length;if(this.pagination.visible=S>1,this.pagination.totalPages=S,this.pagination.update(),this.pagination.updateMarkers(),h=this.pagination.getBBox(),!this.pagination.visible)break}while(!f(h));return{maxPageWidth:u,maxPageHeight:p,pages:d,paginationBBox:h,paginationVertical:l}}updatePositions(e=0){const{item:{paddingY:t},itemSelection:i,pages:s}=this;if(s.length<1||!s[e])return;const{columns:n,startIndex:o,endIndex:a}=s[e];let r=0,l=0;const c=n.length,h=n[0].indices.length,d=this.getOrientation()==="horizontal",u=n[0].bboxes[0].height+t,p=[];i.each((g,f,x)=>{if(xa){g.visible=!1;return}const m=x-o;let v,b;d?(v=m%c,b=Math.floor(m/c)):(v=Math.floor(m/h),b=m%h),g.visible=!0;const S=n[v];S&&(l=Math.floor(u*b),r=Math.floor(p[b]??0),p[b]=(p[b]??0)+S.columnWidth,g.translationX=r,g.translationY=l)})}updatePageNumber(e){const{itemSelection:t,group:i,pagination:s,pages:n}=this,{startIndex:o,endIndex:a}=n[e];o===0?this.paginationTrackingIndex=0:e===n.length-1?this.paginationTrackingIndex=a:this.paginationTrackingIndex=Math.floor((o+a)/2),this.pagination.update(),this.pagination.updateMarkers(),this.updatePositions(e),this.domProxy.onPageChange({itemSelection:t,group:i,pagination:s,interactive:this.isInteractive()}),this.ctx.updateService.update(7)}update(){const{label:{color:e}}=this.item;this.itemSelection.each((t,i)=>{t.setEnabled(i.enabled),t.color=e}),this.updateContextMenu()}updateContextMenu(){const e=this.toggleSeries?"show":"hide";this.ctx.contextMenuRegistry.toggle("toggle-series-visibility",e),this.ctx.contextMenuRegistry.toggle("toggle-other-series",e)}getLineStyles(e){const{stroke:t,strokeOpacity:i=1,strokeWidth:s,lineDash:n}=e.line??{},o=Math.min(2,s??1);return{stroke:t,strokeOpacity:i,strokeWidth:this.item.line.strokeWidth??o,lineDash:n}}getMarkerStyles({marker:e}){const{fill:t,stroke:i,strokeOpacity:s=1,fillOpacity:n=1,strokeWidth:o,lineDash:a,lineDashOffset:r}=e,l=Math.min(2,o??1);return ur(t)&&(t.width=8,t.height=8,t.padding=1,t.strokeWidth=Math.min(2,t.strokeWidth??2)),wc(t)&&(t.fit="contain",t.width=void 0,t.height=void 0,t.repeat="no-repeat"),wM({fill:t,stroke:i,strokeOpacity:s,fillOpacity:n,strokeWidth:this.item.marker.strokeWidth??l,lineDash:a,lineDashOffset:r},z1,F1,B1)}getContainerStyles(){const{stroke:e,strokeOpacity:t,strokeWidth:i}=this.border,{cornerRadius:s,fill:n,fillOpacity:o,padding:a}=this,r=typeof a=="number";return wM({cornerRadius:s,fill:n,fillOpacity:o,padding:{top:r?a:a.top??0,right:r?a:a.right??0,bottom:r?a:a.bottom??0,left:r?a:a.left??0},stroke:e,strokeOpacity:t,strokeWidth:this.border.enabled?i:0},z1,F1,B1)}computePagedBBox(){const e=Be.computeChildrenBBox(this.group.excludeChildren({name:"legend-container"}));if(this.pages.length>1){const[s,n]=this.maxPageSize;e.height=Math.max(n,e.height),e.width=Math.max(s,e.width)}const{strokeWidth:t,padding:i}=this.getContainerStyles();return e.grow(i).grow(t),e}findNode(e){const{datum:t,proxyButton:i}=this.itemSelection.select(s=>s.datum?.itemId===e.itemId)[0]??{};if(t===void 0||i===void 0)throw new Error(`AG Charts - Missing required properties { datum: ${t}, proxyButton: ${JSON.stringify(i)} }`);return{datum:t,proxyButton:i}}contextToggleVisibility(e){const{datum:t,proxyButton:i}=this.findNode(e);this.doClick(e.event,t,i)}contextToggleOtherSeries(e){this.doDoubleClick(e.event,this.findNode(e).datum)}onContextClick(e,t){const{sourceEvent:i}=e,s=t.datum;this.preventHidingAll&&this.contextMenuDatum?.enabled&&this.getVisibleItemCount()<=1?this.ctx.contextMenuRegistry.builtins.items["toggle-series-visibility"].enabled=!1:this.ctx.contextMenuRegistry.builtins.items["toggle-series-visibility"].enabled=!0;const o=this.ctx.chartService.series.length>1&&this.ctx.chartService.series[0]?.getLegendData("category")[0]?.hideToggleOtherSeries!==!0?"show":"hide";this.ctx.contextMenuRegistry.toggle("toggle-other-series",o);const{offsetX:a,offsetY:r}=i,{x:l,y:c}=zt.toCanvasPoint(t,a,r);this.ctx.contextMenuRegistry.dispatchContext("legend-item",{widgetEvent:e,canvasX:l,canvasY:c},{legendItem:s})}onClick(e,t,i){this.doClick(e,t,i)&&e.preventDefault()}getVisibleItemCount(){return this.ctx.chartService.series.flatMap(e=>e.getLegendData("category")).filter(e=>e.enabled).length}doClick(e,t,i){const{listeners:{legendItemClick:s},ctx:{chartService:n,highlightManager:o},preventHidingAll:a,toggleSeries:r}=this;if(!t)return!1;const{legendType:l,seriesId:c,itemId:h,enabled:d,legendItemName:u}=t,p=n.series.find(x=>x.id===c);if(!p)return!1;let g=d;const f=R1("click",t,e);return s&&Uo([p.properties,this.ctx.chartService],s,f.apiEvent),f.defaultPrevented||(r&&(g=!d,a&&!g&&this.getVisibleItemCount()<2&&(g=!0),i.setChecked(g),this.ctx.eventsHub.emit("legend:item-click",{legendType:l,series:p,itemId:h,enabled:g,legendItemName:u})),g?o.updateHighlight(this.id,{series:p,itemId:h,datum:void 0,datumIndex:void 0,legendItemName:u}):o.updateHighlight(this.id),this.ctx.legendManager.update(),this.ctx.updateService.update(2,{forceNodeDataRefresh:!0,skipAnimations:t.skipAnimations??!1})),!0}onDoubleClick(e,t){this.doDoubleClick(e,t)&&e.preventDefault()}doDoubleClick(e,t){const{listeners:{legendItemDoubleClick:i},ctx:{chartService:s},toggleSeries:n}=this;if(!t)return!1;const{legendType:o,id:a,itemId:r,seriesId:l}=t,c=s.series.find(d=>d.id===a);if(!c)return!1;const h=R1("dblclick",t,e);if(i&&Uo([c.properties,this.ctx.chartService],i,h.apiEvent),h.defaultPrevented)return!0;if(n){const d=s.series.flatMap(f=>f.getLegendData("category"));let u=0;const p=new Set;for(const f of d)f.enabled&&(u+=1,f.legendItemName!=null&&p.add(f.legendItemName));p.size>0&&(u=p.size);const g=d.find(f=>f.itemId===r&&f.seriesId===l);this.ctx.eventsHub.emit("legend:item-double-click",{legendType:o,series:c,itemId:r,numVisibleItems:u,enabled:g?.enabled??!1,legendItemName:g?.legendItemName})}return this.ctx.legendManager.update(),this.ctx.updateService.update(2,{forceNodeDataRefresh:!0}),!0}toTooltipMeta(e,t){let i;return e instanceof FocusEvent?i=zt.toCanvas(t).computeCenter():(e.preventDefault(),i=zt.toCanvasPoint(t,e.offsetX,e.offsetY)),{canvasX:i.x,canvasY:i.y,showArrow:!1}}onHover(e,t){if(!this.enabled)throw new Error("AG Charts - onHover handler called on disabled legend");this.pagination.setPage(t.pageIndex);const i=t.datum,s=i?this.ctx.chartService.series.find(n=>n.id===i?.id):void 0;if(i&&this.truncatedItems.has(i.itemId??i.id)){const n=this.toTooltipMeta(e,t);this.ctx.tooltipManager.updateTooltip(this.id,n,[{type:"structured",title:this.getItemLabel(i)}])}else this.ctx.tooltipManager.removeTooltip(this.id);i?.enabled&&s?this.updateHighlight({series:s,itemId:i?.itemId,datum:void 0,datumIndex:void 0,legendItemName:i?.legendItemName}):this.updateHighlight()}onLeave(){this.ctx.tooltipManager.removeTooltip(this.id),this.updateHighlight()}updateHighlight(e){this.ctx.interactionManager.isState(32)?this.ctx.highlightManager.updateHighlight(this.id,e):this.ctx.interactionManager.isState(2)&&(this.pendingHighlightDatum=e,this.ctx.animationManager.onBatchStop(()=>{this.ctx.highlightManager.updateHighlight(this.id,this.pendingHighlightDatum)}))}onLocaleChanged(){this.domProxy.onLocaleChanged(this.ctx.localeManager,this.itemSelection,this)}positionLegend(e){const t=this.positionLegendScene(e);this.positionLegendDOM(t)}positionLegendScene(e){if(!this.enabled||!this.data.length)return;const{placement:t,floating:i,xOffset:s,yOffset:n}=gx(this.position),o=i?new de(0,0,e.width,e.height):e.layoutBox,{x:a,y:r,width:l,height:c}=o,[h,d]=this.calculateLegendDimensions(o),{oldPages:u}=this.calcLayout(h,d),p=this.computePagedBBox();if(this.visible){let f=function(b){};var g=f;const x=this.spacing;let m,v;switch(t){case"top":m=(l-p.width)/2,v=0;break;case"bottom":m=(l-p.width)/2,v=c-p.height;break;case"right":m=l-p.width,v=(c-p.height)/2;break;case"left":m=0,v=(c-p.height)/2;break;case"top-right":case"right-top":m=l-p.width,v=0;break;case"top-left":case"left-top":m=0,v=0;break;case"bottom-right":case"right-bottom":m=l-p.width,v=c-p.height;break;case"bottom-left":case"left-bottom":m=0,v=c-p.height;break;default:f(t)}if(!i){let b,S;switch(t){case"top":case"top-right":case"top-left":b=p.height+x,S="top";break;case"bottom":case"bottom-right":case"bottom-left":b=p.height+x,S="bottom";break;case"left":case"left-top":case"left-bottom":b=p.width+x,S="left";break;case"right":case"right-top":case"right-bottom":b=p.width+x,S="right";break;default:f(t)}o.shrink(b,S)}m+=s,v+=n,this.group.translationX=Math.floor(a+m-p.x),this.group.translationY=Math.floor(r+v-p.y),this.containerNode.x=p.x,this.containerNode.y=p.y,this.containerNode.width=p.width,this.containerNode.height=p.height}return u}positionLegendDOM(e){const{ctx:t,itemSelection:i,pagination:s,pages:n,group:o}=this,a=this.visible&&this.enabled,r=this.isInteractive();this.domProxy.update({visible:a,interactive:r,ctx:t,itemSelection:i,group:o,pagination:s,oldPages:e,newPages:n,datumReader:this,itemListener:this})}calculateLegendDimensions(e){const{width:t,height:i}=e,{placement:s}=gx(this.position),n=t/i,o=.5,a=.2,r=.25;let l,c;function h(d){}switch(s){case"top":case"top-left":case"top-right":case"bottom":case"bottom-left":case"bottom-right":{const d=n<1?Math.min(o,a*(1/n)):a;l=this.maxWidth?Math.min(this.maxWidth,t):t,c=this.maxHeight?Math.min(this.maxHeight,i):Math.round(i*d);break}case"left":case"left-top":case"left-bottom":case"right":case"right-top":case"right-bottom":{const d=n>1?Math.min(o,r*n):r;l=this.maxWidth?Math.min(this.maxWidth,t):Math.round(t*d),c=this.maxHeight?Math.min(this.maxHeight,i):i;break}default:}return[l,c]}cachedCallWithContext(e,t){const{callbackCache:i,chartService:s}=this.ctx;return i.call([this,s],e,t)}};pi.className="Legend",M([C],pi.prototype,"toggleSeries",2),M([C],pi.prototype,"pagination",2),M([C],pi.prototype,"item",2),M([C],pi.prototype,"listeners",2),M([pl((e,t,i)=>{if(e.updateGroupVisibility(),t===i)return;const{ctx:{legendManager:s,stateManager:n}}=e;i===!1&&t===!0&&n.restoreState(s)}),C],pi.prototype,"enabled",2),M([C],pi.prototype,"position",2),M([C],pi.prototype,"maxWidth",2),M([C],pi.prototype,"maxHeight",2),M([C],pi.prototype,"reverseOrder",2),M([C],pi.prototype,"orientation",2),M([C],pi.prototype,"preventHidingAll",2),M([C],pi.prototype,"border",2),M([C],pi.prototype,"cornerRadius",2),M([C],pi.prototype,"fill",2),M([C],pi.prototype,"fillOpacity",2),M([C],pi.prototype,"padding",2),M([C],pi.prototype,"spacing",2),M([C],pi.prototype,"xOffset",2),M([C],pi.prototype,"yOffset",2);var E3={type:"legend",optionsKey:"legend",identifier:"category",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new pi(e),packageType:"community",removable:"standalone-only"},Vg=class extends Le{constructor(e){super(),this.ctx=e,this.rectNode=new Li,this.border=new dh(this.rectNode),this.cornerRadius=0,this.padding=0,this.cleanup=new St,this.node=this.createNode(),this.node.append([this.rectNode]),this.rectNode.fill=void 0,this.cleanup.register(e.scene.attachNode(this.node),e.eventsHub.on("layout:complete",t=>this.onLayoutComplete(t)))}destroy(){this.cleanup.flush()}getPadding(){const{border:e,padding:t}=this,i=e.enabled?e.strokeWidth:0;if(typeof t=="number"){const s=t+i;return{top:s,right:s,bottom:s,left:s}}return{top:(t.top??0)+i,right:(t.right??0)+i,bottom:(t.bottom??0)+i,left:(t.left??0)+i}}createNode(){return new Be({name:"series-area-container",zIndex:4})}onLayoutComplete(e){const{x:t,y:i,width:s,height:n}=e.series.paddedRect;this.rectNode.x=t,this.rectNode.y=i,this.rectNode.width=s,this.rectNode.height=n}};M([C],Vg.prototype,"border",2),M([C],Vg.prototype,"clip",2),M([ii("rectNode","cornerRadius"),C],Vg.prototype,"cornerRadius",2),M([C],Vg.prototype,"padding",2);var P3={type:"root",optionsKey:"seriesArea",packageType:"community",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new Vg(e)};function fx(e,t,i,s,n){const o=(d,u,p,g)=>{i.animate({id:`${e}_${t}_${u.id}_${d}`,groupId:e,from:p?1:0,to:1,ease:zp,collapsable:p,onUpdate(f,x){x&&d!=="removed"||(u.path.clear(!0),g(f,u),u.checkPathDirty())},onStop(){d==="added"&&(u.path.clear(!0),g(1,u),u.checkPathDirty())},phase:Xo[d]})},a=new Hi,r=d=>(a.resetPathDirty(),d(0,a),a.resetPathDirty(),d(1,a),a.checkPathDirty(),a.isPathDirty()),{addPhaseFn:l,updatePhaseFn:c,removePhaseFn:h}=n;for(const d of s)i.isSkipped()||(o("removed",d,!r(h),h),o("updated",d,!r(c),c)),o("added",d,!r(l),l)}function ph(e,t,i,s,n,o){if(e.visible&&s.itemStyler){const a=n||e.isSeriesHighlighted(o),r=e.getHighlightStateString(o,n||t!=null&&o?.series===t.series&&o?.datumIndex===t.datumIndex,t?.datumIndex),l={border:s.border,color:s.color,cornerRadius:s.cornerRadius,datum:t?.datum,enabled:s.enabled,fill:s.fill,fillOpacity:s.fillOpacity,fontFamily:s.fontFamily,fontSize:s.fontSize,fontStyle:s.fontStyle,fontWeight:s.fontWeight,itemId:t?.itemId,seriesId:e.id,padding:s.padding,highlighted:a,highlightState:r},c=e.ctx.optionsGraphService.resolvePartial(["series",`${e.declarationOrder}`,"label"],e.cachedCallWithContext(s.itemStyler,{...i,...l}),{pick:!1})??{};return st(c,l)}return s}function _1(e,t,i,s,n,o,a){if(e.visible&&s.enabled&&n){const r=ph(e,t.datum,i,s,o,a);t.visible=!0,t.x=n.x,t.y=n.y,t.text=n.text,t.fill=r.color,t.setAlign(n),t.setFont(r),t.setBoxing(r)}else t.visible=!1}var R3={"inside-start":{inside:!0,direction:-1,textAlignment:1},"inside-end":{inside:!0,direction:1,textAlignment:-1},"outside-start":{inside:!1,direction:-1,textAlignment:-1},"outside-end":{inside:!1,direction:1,textAlignment:1}};function V1({isUpward:e,isVertical:t,placement:i,spacing:s=0,rect:n}){let o=n.x+n.width/2,a=n.y+n.height/2,r="center",l="middle";if(i!=="inside-center"){const c=(e?1:-1)*(t?-1:1),{direction:h,textAlignment:d}=R3[i],u=(h+1)*.5;if(t){const p=e?n.y+n.height:n.y,g=n.height*c;a=p+g*u+s*d*c,l=d===c?"top":"bottom"}else{const p=e?n.x:n.x+n.width,g=n.width*c;o=p+g*u+s*d*c,r=d===c?"left":"right"}}return{x:o,y:a,textAlign:r,textBaseline:l}}function Wt({id:e},t,i,...s){for(const n of s)n.cleanup();vr(e,t,i,s,{opacity:0},{opacity:1},{phase:"trailing"})}function yx({id:e},t,i,...s){vr(e,t,i,s,{opacity:1},{opacity:0},{phase:"remove"})}function gh(e){return{opacity:1}}var $s=0,tn=1,sn=2,nn=3,aa=4,z3=3,F3=20,AD=100;function CD(e,t,i,s,n,o,a,r){let l=0;for(;ls;)n-=1,l+=1;if(l>=AD||s>=n)return o;const c=Number.isFinite(t)?ra(e[n],t,i,r)-ra(e[s],t,i,r):Gg(n,e.length)-Gg(s,e.length);if(c===0||!Number.isFinite(c))return o;const h=Math.abs(c)/(n-s);let d;if(aF3?d=!1:d=h<=o,o=Math.min(o,h),!d)return o;const u=Math.floor((s+n)/2),p=CD(e,t,i,s,u,o,a+1,r),g=CD(e,t,i,u+1,n,o,a+1,r);return Math.min(p,g,o)}function B3(e,t,i,s){return CD(e,t,i,0,e.length-1,1/(e.length-1),0,s)}function mx(e,t,i,s){if(Number.isFinite(t)){const n=s?.smallestKeyInterval,o=s?.xNeedsValueOf??!0,a=n==null?B3(e,t,i,o):n/(i-t);return lw(Math.trunc(1/a))>>3}else{let n=Math.ceil(Math.log2(e.length))-1;return n=Math.min(Math.max(n,0),24),Math.trunc(2**n)}}function du(e,t){switch(e){case"category":return[Number.NaN,Number.NaN];case"number":case"time":case"ordinal-time":case"unit-time":{let i=1/0,s=-1/0;for(const n of t){const o=Number(n);i=Math.min(i,o),s=Math.max(s,o)}return[i,s]}case"color":case"log":case"mercator":return[0,0]}}function Gg(e,t){return e/t}function ra(e,t,i,s){return s?(e.valueOf()-t)/(i-t):(e-t)/(i-t)}function LD(e,t){return Math.trunc(Math.min(Math.floor(e*t),t-1)*aa)}function jg(e,t,i,s,n,o,{positive:a,xNeedsValueOf:r=!0,yNeedsValueOf:l=!0}={}){const c=new Int32Array(o*aa).fill(-1),h=new Float64Array(o*aa).fill(Number.NaN),d=Number.isFinite(s)&&Number.isFinite(n),u=e.length,p=d?n-s:0,g=1/u;let f=-1,x=-1,m=Number.NaN,v=-1,b=Number.NaN,S=-1,D=Number.NaN,L=-1,I=Number.NaN;const A=O=>{const P=O;c[P+$s]=x,c[P+tn]=v,c[P+sn]=S,c[P+nn]=L,h[P+$s]=m,h[P+tn]=b,h[P+sn]=D,h[P+nn]=I},T=O=>{const P=O;x=c[P+$s],v=c[P+tn],S=c[P+sn],L=c[P+nn],m=h[P+$s],b=h[P+tn],D=h[P+sn],I=h[P+nn]},w=e.length,N=t===i;for(let O=0;O=0!==a)continue;let R;d?r?R=(P.valueOf()-s)/p:R=(P-s)/p:R=O*g;const V=Math.trunc(Math.min(Math.floor(R*o),o-1)*aa);V!==f&&(f!==-1&&A(f),f=V,T(V));const j=!Number.isNaN(B),$=!Number.isNaN(z);x===-1?(x=O,m=R,v=O,b=R,j&&(S=O,D=B),$&&(L=O,I=z)):(Rb&&(v=O,b=R),j&&BI&&(L=O,I=z))}return f!==-1&&A(f),{indexData:c,valueData:h}}function Hg(e,t,i,{inPlace:s=!1}={}){const n=Math.trunc(i/2),o=s?e:new Int32Array(n*aa),a=s?t:new Float64Array(n*aa);for(let r=0;rt[h+tn]?c:h;o[l+tn]=e[p+tn],a[l+tn]=t[p+tn];const g=d||t[c+sn]t[h+nn]?c:h;o[l+nn]=e[f+nn],a[l+nn]=t[f+nn]}return{maxRange:n,indexData:o,valueData:a}}var _3=1e3,V3=10;function G1(e,t,i,s,n,o,a){const r=e[o];if(r==null)return-1;const l=Number.isFinite(t)?ra(r,t,i,a):Gg(o,e.length),c=LD(l,n);return o===s[c+$s]||o===s[c+tn]||o===s[c+sn]||o===s[c+nn]?c:-1}function G3(e,t,i,s,n,o){if(t.length<_3)return;const[a,r]=du(e,s);let l=mx(t,a,r,{xNeedsValueOf:n});const{indexData:c,valueData:h}=jg(t,i,i,a,r,l,{xNeedsValueOf:n,yNeedsValueOf:o});let d=[],u=[],p=-1;for(let f=0;fV3&&l>64;){({maxRange:l}=Hg(c,h,l,{inPlace:!0}));const f=u;d=[],u=[],p=-1;for(const x of f){const m=G1(t,a,r,c,l,x,n);if(m===-1)continue;const v=u.push(x)-1;m!==p&&(d.push(v),p=m)}d.push(u.length-1),g.push({maxRange:l,metaIndices:d,indices:u})}return g.reverse(),g}var TD=class extends Le{constructor(){super(...arguments),this._dirty=!0}markDirty(){this._dirty=!0}markClean(e){this._dirty=!1}isDirty(){return this._dirty}onChangeDetection(e){this.markDirty()}},_a=class extends TD{constructor(){super(...arguments),this.enabled=!0,this.color="rgba(0, 0, 0, 0.5)",this.xOffset=0,this.yOffset=0,this.blur=5}};M([C,ne()],_a.prototype,"enabled",2),M([C,ne()],_a.prototype,"color",2),M([C,ne()],_a.prototype,"xOffset",2),M([C,ne()],_a.prototype,"yOffset",2),M([C,ne()],_a.prototype,"blur",2);var on=class extends TD{constructor(){super(...arguments),this.enabled=!0,this.shape="circle",this.size=0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(){const{size:e,shape:t,fill:i,fillOpacity:s,stroke:n,strokeWidth:o,strokeOpacity:a,lineDash:r,lineDashOffset:l}=this;return{size:e,shape:t,fill:i,fillOpacity:s,stroke:n,strokeWidth:o,strokeOpacity:a,lineDash:r,lineDashOffset:l}}getDiameter(){return this.size+this.strokeWidth}};M([C,ne()],on.prototype,"enabled",2),M([C,En({equals:hd})],on.prototype,"shape",2),M([C,ne()],on.prototype,"size",2),M([C,En({equals:Ci})],on.prototype,"fill",2),M([C,ne()],on.prototype,"fillOpacity",2),M([C,ne()],on.prototype,"stroke",2),M([C,ne()],on.prototype,"strokeWidth",2),M([C,ne()],on.prototype,"strokeOpacity",2),M([C],on.prototype,"lineDash",2),M([C],on.prototype,"lineDashOffset",2),M([C,En({equals:hd})],on.prototype,"itemStyler",2);var j1=class extends Le{constructor(){super(...arguments),this.enabled=!1}};M([C],j1.prototype,"enabled",2);var Or=class extends Le{constructor(){super(...arguments),this.interaction=new j1,this.position=new Hc,this.range=void 0,this.class=void 0}formatTooltip(e,t,i){const s=this.renderer==null?void 0:Uo(e,this.renderer,i);return typeof s=="string"?{type:"raw",rawHtmlString:s}:s!=null?{type:"structured",...t,...s}:{type:"structured",...t}}};M([C],Or.prototype,"enabled",2),M([C],Or.prototype,"showArrow",2),M([C],Or.prototype,"renderer",2),M([C],Or.prototype,"interaction",2),M([C],Or.prototype,"position",2),M([C],Or.prototype,"range",2),M([C],Or.prototype,"class",2);function fh(){return new Or}var wD=class extends Hi{constructor(){super(...arguments),this.segmentPath=new Hi}drawPath(e){if(!this.segments||this.segments.length===0){super.drawPath(e);return}e.save();const t=new Path2D;uu(t,{x0:0,y0:0,x1:e.canvas.width,y1:e.canvas.height},!1);for(const s of this.segments)uu(t,s.clipRect);e.clip(t),super.drawPath(e),e.restore();const{segmentPath:i}=this;i.setProperties({opacity:this.opacity,visible:this.visible,lineCap:this.lineCap,lineJoin:this.lineJoin,pointerEvents:this.pointerEvents});for(const{clipRect:s,fill:n,stroke:o,...a}of this.segments){e.save(),i.path=this.path,i.setProperties(a),i.fill=this.fill==null?"none":n,i.stroke=this.stroke==null?"none":o;const r=new Path2D;uu(r,s),e.clip(r),i.drawPath(e),e.restore()}}};M([Ey()],wD.prototype,"segments",2);function uu(e,{x0:t,y0:i,x1:s,y1:n},o=!0){const a=Math.min(t,s),r=Math.min(i,n),l=Math.max(t,s),c=Math.max(i,n);e.moveTo(a,r),o?(e.lineTo(l,r),e.lineTo(l,c),e.lineTo(a,c)):(e.lineTo(a,c),e.lineTo(l,c),e.lineTo(l,r)),e.closePath()}var H1=class extends us{constructor(){super(...arguments),this.segments=[],this.scalablePath=new(Vy(Hi))}renderInContext(e){if(!this.visible)return;const{ctx:t}=e;if(!this.segments||this.segments?.length===0)return super.renderInContext(e);t.save();const i=new Path2D;uu(i,{x0:0,y0:0,x1:t.canvas.width,y1:t.canvas.height},!1);for(const n of this.segments)uu(i,n.clipRect);t.clip(i);for(const n of this.children())n.visible&&n.render(e);t.restore();const{scalablePath:s}=this;for(const{clipRect:n,...o}of this.segments){t.save();const a=new Path2D;uu(a,n),t.clip(a),s.setProperties(o);for(const r of this.children())!r.visible||!(r instanceof Hi)||(s.path=r.path,s.setProperties({opacity:r.opacity,lineCap:r.lineCap,lineJoin:r.lineJoin,...Zj(r)&&{scalingX:r.scalingX,scalingY:r.scalingY,scalingCenterX:r.scalingCenterX,scalingCenterY:r.scalingCenterY}}),s.render(e));t.restore()}}};M([Ey()],H1.prototype,"segments",2);var W1=class{constructor(e,t,i){this.root=new W3(e,t,i)}clear(e){this.root.clear(e)}addValue(e,t){const i={hitTester:e,value:t,distanceSquared:(s,n)=>e.distanceSquared(s,n)};this.root.addElem(i)}find(e,t){const i={best:{nearest:void 0,distanceSquared:1/0}};return this.root.find(e,t,i),i.best}},j3=class{constructor(e,t,i,s){this.nw=e,this.ne=t,this.sw=i,this.se=s}addElem(e){this.nw.addElem(e),this.ne.addElem(e),this.sw.addElem(e),this.se.addElem(e)}find(e,t,i){this.nw.find(e,t,i),this.ne.find(e,t,i),this.sw.find(e,t,i),this.se.find(e,t,i)}},H3=class{constructor(e,t,i){this.capacity=e,this.maxdepth=t,this.boundary=i??de.NaN,this.elems=[],this.subdivisions=void 0}clear(e){this.elems.length=0,this.boundary=e,this.subdivisions=void 0}addElem(e){this.addCondition(e)&&(this.subdivisions===void 0?this.maxdepth===0||this.elems.lengthi.getPropertyDefinitions(this.getScaleInformation({xScale:e,yScale:t}))).flat()}async requestDataModel(e,t,i){i.props.push(...this.getModulePropertyDefinitions());const{dataModel:s,processedData:n}=await e.request(this.id,t??Nd.empty(),i);return this.dataModel=s,this.processedData=n,this.events.emit("data-processed",{dataModel:s,processedData:n}),{dataModel:s,processedData:n}}isProcessedDataAnimatable(){const{processedData:e,ctx:t}=this;if(!e)return!1;const i=this.getNodeData();if(i!=null&&i.length>t.animationManager.maxAnimatableItems)return!1;const s=e.reduced?.animationValidation;if(!s)return!0;const{orderedKeys:n,uniqueKeys:o}=s;return n&&o}checkProcessedDataAnimatable(){this.isProcessedDataAnimatable()||this.ctx.animationManager.skipCurrentBatch()}pickFocus(e){const t=this.getNodeData();if(t===void 0||t.length===0)return;const i=this.computeFocusDatumIndex(e,t);if(i===void 0)return;const{clipFocusBox:s}=this,n=t[i],o={...e,datumIndex:i},a=this.computeFocusBounds(o);if(a!==void 0)return{bounds:a,clipFocusBox:s,datum:n,datumIndex:i}}pickNodesExactShape(e){const t=super.pickNodesExactShape(e);return t.sort((i,s)=>i.datumIndex-s.datumIndex),t}isDatumEnabled(e,t){const{missing:i=!1,enabled:s=!0,focusable:n=!0}=e[t];return!i&&s&&n}computeFocusDatumIndex(e,t){const i=(a,r)=>{for(;a>=0&&!this.isDatumEnabled(t,a);)a+=r;return a===-1?void 0:a},s=(a,r)=>{for(;a0?n=s(o,e.datumIndexDelta):n=s(o,1)??i(o,-1),n===void 0?e.datumIndexDelta===0?void 0:e.datumIndex-e.datumIndexDelta:n}dataModelPropertyIsKey(e){const{processedData:t}=this;return t?t.defs.keys.some(i=>i.id===e&&i.idsMap?.get(this.id)?.has(e)===!0):!1}keysOrValues(e){const{dataModel:t,processedData:i}=this;return!t||!i?[]:this.dataModelPropertyIsKey(e)?t.resolveKeysById(this,e,i):t.resolveColumnById(this,e,i)}sortOrder(e){const{dataModel:t,processedData:i}=this;if(!(!t||!i))return this.dataModelPropertyIsKey(e)?t.getKeySortOrder(this,e,i):t.getColumnSortOrder(this,e,i)}getCategoryKey(){return this.categoryKey}getCategoryValue(e){const{processedData:t,dataModel:i}=this,s=this.getCategoryKey();return!t||!i||!s||(t.invalidData?.get(this.id)?.[e]??!1)?void 0:this.keysOrValues(s)[e]}datumIndexForCategoryValue(e){const{processedData:t,dataModel:i}=this,s=this.getCategoryKey();if(!t||!i||!s)return;e=e.valueOf();const n=t.invalidData?.get(this.id),o=this.keysOrValues(s);for(let a=0;athis.nodeFactory()),this.annotationSelections=new Set,this.seriesBelowStackContext=void 0,this.debug=Pe.create(),!a||!r)throw new Error(`Unable to initialise series type ${this.type}`);this.opts={pathsPerSeries:e,pathsZIndexSubOrderOffset:t,propertyKeys:a,propertyNames:r,animationResetFns:o,animationAlwaysUpdateSelections:s,datumSelectionGarbageCollection:i,segmentedDataNodes:n},this.paths=e.map(c=>new wD({name:`${this.id}-${c}`})),this.datumSelection=Bs.select(this.dataNodeGroup,()=>this.nodeFactory(),i),this.animationState=new $p("empty",{empty:{update:{target:"ready",action:c=>this.animateEmptyUpdateReady(c)},reset:"empty",skip:"ready",disable:"disabled"},ready:{updateData:"waiting",clear:"clearing",highlight:c=>this.animateReadyHighlight(c),resize:c=>this.animateReadyResize(c),reset:"empty",skip:"ready",disable:"disabled"},waiting:{update:{target:"ready",action:c=>{this.ctx.animationManager.isSkipped()?this.resetAllAnimation(c):this.animateWaitingUpdateReady(c)}},reset:"empty",skip:"ready",disable:"disabled"},disabled:{update:c=>this.resetAllAnimation(c),reset:"empty"},clearing:{update:{target:"empty",action:c=>this.animateClearingUpdateEmpty(c)},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}get contextNodeData(){return this._contextNodeData}getNodeData(){return this.contextNodeData?.nodeData}attachSeries(e,t,i){super.attachSeries(e,t,i),this.attachPaths(this.paths)}detachSeries(e,t,i){super.detachSeries(e,t,i),this.detachPaths(this.paths)}updatedDomains(){this.animationState.transition("updateData")}attachPaths(e){for(const t of e)this.contentGroup.appendChild(t)}detachPaths(e){for(const t of e)t.remove()}renderToOffscreenCanvas(){const e=this.getNodeData();return e!=null&&e.length>xx}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"?this.animationState.transition("skip"):e==="disabled"&&this.animationState.transition("disable")}addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",e=>this.onLegendItemClick(e)),this.ctx.eventsHub.on("legend:item-double-click",e=>this.onLegendItemDoubleClick(e)))}destroy(){super.destroy(),this._contextNodeData=void 0}isSeriesHighlighted(e){const{series:t,legendItemName:i}=e??{},{legendItemName:s}=this.properties;return t===this||s!=null&&s===i}strokewidthChange(){const e=("strokeWidth"in this.properties&&this.properties.strokeWidth)??0,t=this.properties.highlight.highlightedSeries.strokeWidth??e,i=this.properties.highlight.highlightedItem?.strokeWidth??e;return e>i||t>i}update({seriesRect:e}){const{_contextNodeData:t}=this,i=this.checkResize(e),s=this.updateHighlightSelection();this.contentGroup.batchedUpdate(()=>{const o=this.updateSelections(),a=this.contextNodeData?.segments;this.opts.segmentedDataNodes?this.dataNodeGroup.segments=a??this.dataNodeGroup.segments:this.dataNodeGroup.segments=void 0,this.updateNodes(s,i||o)});const n=this.getAnimationData(e,t);n&&(i&&this.animationState.transition("resize",n),this.animationState.transition("update",n),this.processedDataUpdated=!1)}createStackContext(){}updateSelections(){var e;const t=!this.opts.animationAlwaysUpdateSelections&&this.ctx.animationManager.isSkipped();if(!this.visible&&t)return!1;const{nodeDataRefresh:i}=this;if(!i&&!this.isPathOrSelectionDirty())return!1;if(i){this.nodeDataRefresh=!1,this.debug("CartesianSeries.updateSelections() - calling createNodeData() for",this.id),this.markQuadtreeDirty(),this._contextNodeData=this.createNodeData();const s=this.isProcessedDataAnimatable();this._contextNodeData&&((e=this._contextNodeData).animationValid??(e.animationValid=s));const{dataModel:n,processedData:o}=this;n!==void 0&&o!==void 0&&this.events.emit("data-update",{dataModel:n,processedData:o}),this.updateSeriesSelections()}return i}updateSeriesSelections(){const{datumSelection:e,labelSelection:t,paths:i}=this,s=this._contextNodeData;if(!s)return;const{nodeData:n,labelData:o,itemId:a}=s;this.updatePaths({itemId:a,contextData:s,paths:i}),this.datumSelection=this.updateDatumSelection({nodeData:n,datumSelection:e}),this.labelGroup.batchedUpdate(()=>{this.labelSelection=this.updateLabelSelection({labelData:o,labelSelection:t})??t})}getShapeFillBBox(){const{axes:e}=this,t=e.x,i=e.y,[s,n]=Wi(t?.range??[0,1]),[o,a]=Wi(i?.range??[0,1]),r=this.getSeriesDomain("x"),l=[t?.scale.convert(r.at(0)),t?.scale.convert(r.at(-1))],c=this.getSeriesDomain("y"),h=[i?.scale.convert(c.at(0)),i?.scale.convert(c.at(-1))],[d,u]=Wi(l),[p,g]=Wi(h);return{axis:new de(s,o,n-s,a-o),series:new de(d,p,u-d,g-p)}}updateNodes(e,t){const{highlightSelection:i,datumSelection:s}=this,n=!this.ctx.animationManager.isSkipped(),o=this.visible&&this._contextNodeData!=null;this.contentGroup.visible=n||o,this.highlightGroup.visible=(n||o)&&e,this.updateDatumStyles({datumSelection:i,isHighlight:!0});const a=this.ctx.chartService.highlight?.drawingMode??"overlay";this.updateDatumNodes({datumSelection:i,isHighlight:!0,drawingMode:a}),this.animationState.transition("highlight",i);const{dataNodeGroup:r,labelSelection:l,paths:c,labelGroup:h}=this,{itemId:d}=this.contextNodeData??{};if(this.updatePathNodes({itemId:d,paths:c,visible:o,animationEnabled:n}),r.visible=n||o,h.visible=o,!r.visible)return;this.hasItemStylers()&&this.updateDatumStyles({datumSelection:s,isHighlight:!1});const u=this.strokewidthChange()||this.hasChangesOnHighlight;(t||u)&&(this.updateDatumNodes({datumSelection:s,isHighlight:!1,drawingMode:"overlay"}),this.usesPlacedLabels||this.labelGroup.batchedUpdate(()=>{this.updateLabelNodes({labelSelection:l,isHighlight:!1})}))}getHighlightData(e,t){return t?[{...t}]:void 0}updateHighlightSelection(){const{highlightSelection:e,_contextNodeData:t}=this;if(!t)return!1;const i=this.ctx.highlightManager?.getActiveHighlight(),n=this.isSeriesHighlighted(i)&&i?.datum?i:void 0;if(n==null)return!1;const{nodeData:o}=t,a=this.getHighlightData(o,n);return this.highlightSelection=this.updateHighlightSelectionItem({items:a,highlightSelection:e}),!0}markQuadtreeDirty(){this.quadtree=void 0}*datumNodesIter(){for(const{node:e}of this.datumSelection)e.datum.missing!==!0&&(yield e)}getQuadTree(){if(this.quadtree===void 0){const{width:e,height:t}=this.ctx.scene.canvas,i=new de(0,0,e,t);this.quadtree=new W1(100,10,i),this.initQuadTree(this.quadtree)}return this.quadtree}initQuadTree(e){}pickNodeDataExactShape(e){const{x:t,y:i}=e,{dataNodeGroup:s}=this,n=s.pickNodes(t,i).filter(o=>o.datum.missing!==!0);if(n.length!==0)return n.map(a=>a.datum)}pickModulesExactShape(e){for(const t of this.moduleMap.modules()){const{datum:i}=t.pickNodeExact(e)??{};if(i!=null&&i?.missing!==!0)return[i]}}pickNodesExactShape(e){const t=super.pickNodesExactShape(e);return t.length!==0?t:this.pickNodeDataExactShape(e)??this.pickModulesExactShape(e)??[]}pickNodeDataClosestDatum(e){const{x:t,y:i}=e,{axes:s,_contextNodeData:n}=this;if(!n)return;const o=s.x,a=s.y,r={x:t,y:i};let l=1/0,c;for(const h of n.nodeData){const{point:{x:d=Number.NaN,y:u=Number.NaN}={}}=h;if(Number.isNaN(d)||Number.isNaN(u)||!(o?.inRange(d)&&a?.inRange(u)))continue;const g=Math.max((r.x-d)**2+(r.y-u)**2,0);gg.isCategoryLike()).map(g=>g.direction);if(t&&c.length===0)return;const[h="x"]=c,d=[i,s];h!=="x"&&d.reverse();const u=[1/0,1/0];let p;for(const g of o.nodeData){const{x:f=Number.NaN,y:x=Number.NaN}=g.point??g.midPoint??{};if(Number.isNaN(f)||Number.isNaN(x)||g.missing===!0)continue;const m=[r?.inRange(f,1),l?.inRange(x,1)];if(h!=="x"&&m.reverse(),!m[0]||!a&&!m[1])continue;const v=[f,x];h!=="x"&&v.reverse();let b=!0;for(let S=0;Su[S]){b=!1;break}else D{const h=i?.[c]??c;return this.xCoordinateRange(o[h],a,h)});return rthis.keysOrValues(g));let u=1/0,p=-1/0;for(const[g,f]of c.entries()){const[x,m]=this.xCoordinateRange(f,0,g);if(!(ml))for(let v=0;vp?[Number.NaN,Number.NaN]:[u,p]}domainForClippedRange(e,t,i){const{processedData:s,dataModel:n,axes:o}=this,r=$3(o[e==="x"?"y":"x"]);if(!r)return t.flatMap(g=>n.getDomain(this,g,"value",s));const l=this.keysOrValues(i),c=n.getColumnSortOrder(this,i,s);if(c!=null){const g=U3(c,l.length,r,f=>l[f]);return n.getDomainBetweenRange(this,t,g,s)}const h=t.map(g=>this.keysOrValues(g)),d=r[0].valueOf(),u=r[1].valueOf(),p=[];for(const[g,f]of l.entries()){const x=f.valueOf();if(xu)continue;const m=h.map(v=>v[g]);x>=d&&p.push(...m),x<=u&&p.push(...m)}return p}zoomFittingVisibleItems(e,t,i,s,n){const{dataModel:o,processedData:a}=this;if(!o||!a)return;const r=this.axes.x;if(s!=null)return;const l=this.sortOrder(e);if(l==null)return;const c=this.keysOrValues(e);if(n>c.length)return{x:[0,1],y:void 0};const h=r.scale,d=h.range;h.range=[0,1];let[u,p]=this.visibleRangeIndices(e,i,void 0,{sortOrder:l});p-=1;const g=0;this.xCoordinateRange(c[u],g,u)[0]i[1]&&(p-=1);let f;if(Math.abs(p-u)>=n-1)f=i;else{const x=(i[0]+i[1])/2;for(;Math.abs(p-u)0||po.resolveColumnById(this,I,a)),c=this.shouldFlipXY(),h=c?this.axes.y:this.axes.x,d=c?this.axes.x:this.axes.y,u=c?s??[0,1]:i,p=c?i:s??[0,1];if(s==null){const I=this.sortOrder(e);if(I!=null){const A=h.scale,T=A.range;A.range=[0,1];const w=this.keysOrValues(e);let[N,O]=this.visibleRangeIndices(e,u,void 0,{sortOrder:I});O-=1;const P=0;this.xCoordinateRange(w[N],P,N)[0]u[1]&&(O-=1);const F=Math.abs(O-N)+1;return A.range=T,F}}const g=(I,A,T)=>I[0]+(T-A[0])/(A[1]-A[0])*(I[1]-I[0]),f=h.range.toSorted(),x=d.range.toSorted(),m=g(f,h.visibleRange,u[0]),v=g(f,h.visibleRange,u[1]),b=g(x,d.visibleRange,Math.min(...p)),S=g(x,d.visibleRange,Math.max(...p)),D=Math.round((u[0]+(u[1]-u[0])/2)*r.length),L=0;return sw(0,r.length-1,D,n,I=>{const[A,T]=this.xCoordinateRange(r[I],L,I),[w,N]=this.yCoordinateRange(l.map(O=>O[I]),L,I);return!Ye(A)||!Ye(T)||!Ye(w)||!Ye(N)?!1:A>=m&&T<=v&&w>=b&&N<=S})}minTimeInterval(){let e;try{e=this.keysOrValues("xValue")}catch{}if(e==null||e.length>1e3)return;let t=1/0,i=e[0],s;for(let n=1;ne.convert(s),domain:[i[0],i[1]],range:[t[0],t[1]]}}else if(e instanceof ut){const{range:t,domain:i}=e;return{type:"continuous",domain:[i[0],i[1]],range:[t[0],t[1]]}}else if(e instanceof br)return{type:"category",domain:e instanceof ml?e.bands:e.domain,inset:e.inset,step:e.step}}calculateScaling(){const e={};for(const t of Object.values(Yy)){const i=this.axes[t];if(!i)continue;const s=this.getScaling(i.scale);s!=null&&(e[t]=s)}return e}};function $3(e){let t,i;if((e instanceof _n||e instanceof wr)&&({min:t,max:i}=e),!(t==null&&i==null))return t??(t=-1/0),i??(i=1/0),[t,i]}function U3(e,t,i,s){const n=i[0].valueOf(),o=i[1].valueOf();let a=mp(0,t-1,l=>{const c=e===1?l:t-l,h=s(c)?.valueOf();return!Number.isFinite(h)||h>=n}),r=kc(0,t-1,l=>{const c=e===1?l:t-l,h=s(c)?.valueOf();return!Number.isFinite(h)||h<=o});return a==null||r==null?[0,0]:(e===-1&&([a,r]=[t-r,t-a]),a=Math.max(a,0),r=Math.min(r+1,t),[a,r])}var fu=class extends Le{constructor(){super(...arguments),this.type="linear",this.tension=1,this.position="end"}};M([C],fu.prototype,"type",2),M([C],fu.prototype,"tension",2),M([C],fu.prototype,"position",2);var gi=class extends Er{constructor(){super(...arguments),this.xName=void 0,this.fill="#c16068",this.fillOpacity=1,this.stroke="#874349",this.strokeWidth=2,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.interpolation=new fu,this.shadow=new _a,this.marker=new on,this.label=new Bt,this.tooltip=fh(),this.connectMissingData=!1}};M([C],gi.prototype,"xKey",2),M([C],gi.prototype,"xName",2),M([C],gi.prototype,"yKey",2),M([C],gi.prototype,"yName",2),M([C],gi.prototype,"yFilterKey",2),M([C],gi.prototype,"normalizedTo",2),M([C],gi.prototype,"fill",2),M([C],gi.prototype,"fillOpacity",2),M([C],gi.prototype,"stroke",2),M([C],gi.prototype,"strokeWidth",2),M([C],gi.prototype,"strokeOpacity",2),M([C],gi.prototype,"lineDash",2),M([C],gi.prototype,"lineDashOffset",2),M([C],gi.prototype,"interpolation",2),M([C],gi.prototype,"styler",2),M([C],gi.prototype,"shadow",2),M([C],gi.prototype,"marker",2),M([C],gi.prototype,"label",2),M([C],gi.prototype,"tooltip",2),M([C],gi.prototype,"connectMissingData",2);function Gn(e){switch(e.type){case"linear":case"step":case"multi-line":return[{x:e.x0,y:e.y0},{x:e.x1,y:e.y1}];case"cubic":return[{x:e.cp0x,y:e.cp0y},{x:e.cp3x,y:e.cp3y}]}}function K3(e){const t=Gn(e);return t[0].x>t[1].x&&t.reverse(),t}function $1(e,t){const{x:i,y:s}=t;switch(e.type){case"linear":return{type:"linear",moveTo:e.moveTo,x0:i,y0:s,x1:i,y1:s};case"step":return{type:"step",moveTo:e.moveTo,x0:i,y0:s,x1:i,y1:s,stepX:i};case"cubic":return{type:"cubic",moveTo:e.moveTo,cp0x:i,cp0y:s,cp1x:i,cp1y:s,cp2x:i,cp2y:s,cp3x:i,cp3y:s};case"multi-line":return{type:"multi-line",moveTo:e.moveTo,x0:i,y0:s,x1:i,y1:s,midPoints:e.midPoints.map(()=>({x:i,y:s}))}}}function yu(e,t,i){const[s,n]=Gn(e),o=n.x===s.x?0:(i.x-t.x)/(n.x-s.x),a=n.y===s.y?0:(i.y-t.y)/(n.y-s.y);switch(e.type){case"linear":return{type:"linear",moveTo:e.moveTo,x0:t.x,y0:t.y,x1:i.x,y1:i.y};case"cubic":return{type:"cubic",moveTo:e.moveTo,cp0x:t.x,cp0y:t.y,cp1x:i.x-(e.cp2x-s.x)*o,cp1y:i.y-(e.cp2y-s.y)*a,cp2x:i.x-(e.cp1x-s.x)*o,cp2y:i.y-(e.cp1y-s.y)*a,cp3x:i.x,cp3y:i.y};case"step":return{type:"step",moveTo:e.moveTo,x0:t.x,y0:t.y,x1:i.x,y1:i.y,stepX:i.x-(e.stepX-s.x)*o};case"multi-line":return{type:"multi-line",moveTo:e.moveTo,x0:t.x,y0:t.y,x1:i.x,y1:i.y,midPoints:e.midPoints.map(r=>({x:t.x+(r.x-s.x)*o,y:t.y+(r.y-s.y)*a}))}}}function ED(e,t,i){const{moveTo:s}=e,[n,o]=K3(e),{x:a,y:r}=n,{x:l,y:c}=o;if(il)return yu(e,o,o);switch(e.type){case"linear":{const h=r===c?void 0:(c-r)/(l-a),d=h==null?r:h*(t-a)+r,u=h==null?r:h*(i-a)+r;return{type:"linear",moveTo:s,x0:t,y0:d,x1:i,y1:u}}case"step":if(i<=e.stepX){const h=e.y0;return{type:"step",moveTo:s,x0:t,y0:h,x1:i,y1:h,stepX:i}}else if(t>=e.stepX){const h=e.y1;return{type:"step",moveTo:s,x0:t,y0:h,x1:i,y1:h,stepX:t}}else{const{y0:h,y1:d,stepX:u}=e;return{type:"step",moveTo:s,x0:t,y0:h,x1:i,y1:d,stepX:u}}case"cubic":{const h=_y(e.cp0x,e.cp1x,e.cp2x,e.cp3x,t);let[d,u]=Ap(e.cp0x,e.cp0y,e.cp1x,e.cp1y,e.cp2x,e.cp2y,e.cp3x,e.cp3y,h);const p=_y(u[0].x,u[1].x,u[2].x,u[3].x,i);return[u,d]=Ap(u[0].x,u[0].y,u[1].x,u[1].y,u[2].x,u[2].y,u[3].x,u[3].y,p),{type:"cubic",moveTo:s,cp0x:u[0].x,cp0y:u[0].y,cp1x:u[1].x,cp1y:u[1].y,cp2x:u[2].x,cp2y:u[2].y,cp3x:u[3].x,cp3y:u[3].y}}case"multi-line":{const{midPoints:h}=e,d=h.findLastIndex(L=>L.x<=t);let u=h.findIndex(L=>L.x>=i);u===-1&&(u=h.length);const p=d>=0?h[d]:void 0,g=p?.x??a,f=p?.y??r,x=u(e[e.MoveTo=0]="MoveTo",e[e.LineTo=1]="LineTo",e[e.Skip=2]="Skip",e))(U1||{});function K1(e){const t=[];let i=0,s=Number.NaN,n=Number.NaN;for(const{x:o,y:a}of e){if(i>0){const r=i===1;t.push({type:"linear",moveTo:r,x0:s,y0:n,x1:o,y1:a})}i+=1,s=o,n=a}return t}var Y3={start:0,middle:.5,end:1};function Y1(e,t){const i=[];let s=0,n=Number.NaN,o=Number.NaN;const a=typeof t=="number"?t:Y3[t];for(const{x:r,y:l}of e){if(s>0){const c=s===1,h=n+(r-n)*a;i.push({type:"step",moveTo:c,x0:n,y0:o,x1:r,y1:l,stepX:h})}s+=1,n=r,o=l}return i}var bx=.05;function Z1(e,t){const i=Array.isArray(e)?e:Array.from(e);if(i.length<=1)return[];const s=i.map((o,a)=>{const r=a===0?o:i[a-1],l=a===i.length-1?o:i[a+1],c=a===0||a===i.length-1;if(Math.sign(r.y-o.y)===Math.sign(l.y-o.y))return 0;if(!c){const h=Math.abs(r.y-l.y),d=Math.abs(o.y-r.y)/h,u=Math.abs(o.y-l.y)/h;if(d<=bx||1-d<=bx||u<=bx||1-u<=bx)return 0}return(l.y-r.y)/(l.x-r.x)});s[1]===0&&(s[0]*=2),s.at(-2)===0&&(s[s.length-1]*=2);const n=[];for(let o=1;oMath.abs(d)&&(u*=Math.abs(d/p),p=Math.sign(p)*Math.abs(d)),r===0&&Math.abs(f)>Math.abs(d)&&(g*=Math.abs(d/f),f=Math.sign(f)*Math.abs(d)),n.push({type:"cubic",moveTo:o===1,cp0x:a.x,cp0y:a.y,cp1x:a.x+u,cp1y:a.y+p,cp2x:l.x-g,cp2y:l.y-f,cp3x:l.x,cp3y:l.y})}return n}function Ei(e,t,i){return(t-e)*i+e}function X1(e,t){const{x0:i,y0:s,x1:n,y1:o}=e,r=(o-s)/(n-i)*(t-i)+s;return{leftCp1x:i,leftCp1y:s,leftCp2x:t,leftCp2y:r,stepX:t,stepY0:r,stepY1:r,rightCp1x:t,rightCp1y:r,rightCp2x:n,rightCp2y:o}}function Z3(e,t){const{cp0x:i,cp0y:s,cp1x:n,cp1y:o,cp2x:a,cp2y:r,cp3x:l,cp3y:c}=e,h=_y(i,n,a,l,t),[d,u]=Ap(i,s,n,o,a,r,l,c,h),p=d[3].y;return{leftCp1x:d[1].x,leftCp1y:d[1].y,leftCp2x:d[2].x,leftCp2y:d[2].y,stepX:t,stepY0:p,stepY1:p,rightCp1x:u[1].x,rightCp1y:u[1].y,rightCp2x:u[2].x,rightCp2y:u[2].y}}function X3(e){const{x0:t,y0:i,x1:s,y1:n,stepX:o}=e;return{leftCp1x:(t+o)/2,leftCp1y:i,leftCp2x:(t+o)/2,leftCp2y:i,stepX:o,stepY0:i,stepY1:n,rightCp1x:(o+s)/2,rightCp1y:n,rightCp2x:(o+s)/2,rightCp2y:n}}function q1(e,t){return e.type==="linear"?X1(e,t):e.type==="cubic"?Z3(e,t):e.type==="step"?X3(e):X1(e,t)}function Q1(e,t,i,s,n,o,a){switch(t){case 0:a?e.moveTo(n,o):e.moveTo(i,s);break;case 1:a?e.lineTo(n,o):e.lineTo(i,s);break;case 2:break}}function J1(e,t,i,s,n,o){o?e.lineTo(t,i):e.lineTo(s,n)}function eO(e,t,i,s,n,o,a,r,l,c){c?e.cubicCurveTo(o,a,s,n,t,i):e.cubicCurveTo(s,n,o,a,r,l)}function tO(e,t,i,s,n,o,a){a?(e.lineTo(o,n),e.lineTo(o,i),e.lineTo(t,i)):(e.lineTo(o,i),e.lineTo(o,n),e.lineTo(s,n))}function q3(e,t,i,s,n,o,a){if(a){for(let r=o.length-1;r>=0;r--){const{x:l,y:c}=o[r];e.lineTo(l,c)}e.lineTo(t,i)}else{for(const{x:r,y:l}of o)e.lineTo(r,l);e.lineTo(s,n)}}function Wg(e,t,i,s){const[n,o]=Gn(t);switch(Q1(e,i,n.x,n.y,o.x,o.y,s),t.type){case"linear":J1(e,t.x0,t.y0,t.x1,t.y1,s);break;case"cubic":eO(e,t.cp0x,t.cp0y,t.cp1x,t.cp1y,t.cp2x,t.cp2y,t.cp3x,t.cp3y,s);break;case"step":tO(e,t.x0,t.y0,t.x1,t.y1,t.stepX,s);break;case"multi-line":q3(e,t.x0,t.y0,t.x1,t.y1,t.midPoints,s);break}}function iO(e,t,i){const[s,n]=Gn(e),[o,a]=Gn(t),r=Ei(s.x,o.x,i),l=Ei(s.y,o.y,i),c=Ei(n.x,a.x,i),h=Ei(n.y,a.y,i);return[{x:r,y:l},{x:c,y:h}]}function PD(e,t,i,s,n,o){const[{x:a,y:r},{x:l,y:c}]=iO(t,i,s);if(Q1(e,n,a,r,l,c,o),t.type==="cubic"&&i.type==="cubic"){const h=Ei(t.cp1x,i.cp1x,s),d=Ei(t.cp1y,i.cp1y,s),u=Ei(t.cp2x,i.cp2x,s),p=Ei(t.cp2y,i.cp2y,s);eO(e,a,r,h,d,u,p,l,c,o)}else if(t.type==="step"&&i.type==="step"){const h=Ei(t.stepX,i.stepX,s);tO(e,a,r,l,c,h,o)}else if(t.type==="linear"&&i.type==="linear")J1(e,a,r,l,c,o);else{let h;t.type==="step"?h=t.stepX:i.type==="step"?h=i.stepX:h=(a+l)/2;const d=q1(t,h),u=q1(i,h),p=Ei(d.leftCp1x,u.leftCp1x,s),g=Ei(d.leftCp1y,u.leftCp1y,s),f=Ei(d.leftCp2x,u.leftCp2x,s),x=Ei(d.leftCp2y,u.leftCp2y,s),m=Ei(d.stepX,u.stepX,s),v=Ei(d.stepY0,u.stepY0,s),b=Ei(d.stepY1,u.stepY1,s),S=Ei(d.rightCp1x,u.rightCp1x,s),D=Ei(d.rightCp1y,u.rightCp1y,s),L=Ei(d.rightCp2x,u.rightCp2x,s),I=Ei(d.rightCp2y,u.rightCp2y,s);o?(e.cubicCurveTo(L,I,S,D,m,b),e.lineTo(m,v),e.cubicCurveTo(f,x,p,g,a,r)):(e.cubicCurveTo(p,g,f,x,m,v),e.lineTo(m,b),e.cubicCurveTo(S,D,L,I,l,c))}}var Q3=1e3,sO=(e=>(e[e.Zero=0]="Zero",e[e.Split=1]="Split",e))(sO||{});function J3(e,t){return e==null||t==null||typeof e!="object"||typeof t!="object"?!1:"id"in e&&"id"in t?e.id===t.id:e.toString()===t.toString()}function Us(e){return rM(e).valueOf()}function Ji(e,t){if(!t)return Number.NaN;if(e instanceof Date&&(e=e.getTime()),t.type==="continuous"&&typeof e=="number")return(e-t.domain[0])/(t.domain[1]-t.domain[0])*(t.range[1]-t.range[0])+t.range[0];if(t.type==="log"&&typeof e=="number")return t.convert(e);if(t.type!=="category")return Number.NaN;const i=Us(e);let s=t.domain.findIndex(n=>Us(n)===i);return s===-1&&(s=t.domain.findIndex(n=>J3(e,n))),s>=0?t.inset+t.step*s:Number.NaN}function nO({data:e},t){return e.map((i,s)=>({xValue0Index:t.indexOf(Us(i.xValue0)),xValue1Index:t.indexOf(Us(i.xValue1)),datumIndex:s}))}function oO(e){return Object.values(e.scales).every(t=>t.type==="category"?t.domain.length({axisValue:h,value:d}));s.sort((h,d)=>Ji(h.value,e.scales.x)-Ji(d.value,e.scales.x));const n=[];for(const{xValue0:h,xValue1:d}of t.data){const u=Us(h),p=Us(d);i.has(u)||(i.set(u,h),n.push({axisValue:u,value:h})),i.has(p)||(i.set(p,d),n.push({axisValue:p,value:d}))}n.sort((h,d)=>Ji(h.value,t.scales.x)-Ji(d.value,t.scales.x));const o=s;let a=0;for(const h of n){for(let d=o.length-1;d>=a;d-=1){const u=Ji(h.value,t.scales.x),p=Ji(o[d].value,t.scales.x);if(u>p){a=d+1;break}}o.splice(a,0,h),a+=1}if(!tY(o,t))return;const r=o.map(h=>h.axisValue),l=nO(t,r),c=nO(e,r);return{axisValues:r,oldDataAxisIndices:l,newDataAxisIndices:c}}function aO(e,t,i,s,n){if(n.xValue1Index===n.xValue0Index+1)return e;const o=Gn(e);let a,r;if(t.scales.x?.type==="category"){const l=(o[1].x-o[0].x)/(n.xValue1Index-n.xValue0Index);a=o[0].x+(s-n.xValue0Index)*l,r=a+l}else{const l=i[s],c=i[s+1];a=Ji(l,t.scales.x),r=Ji(c,t.scales.x)}return ED(e,a,r)}function rO(e,t){const[i,s]=Gn(e),n=Ji(0,t.scales.y);return yu(e,{x:i.x,y:n},{x:s.x,y:n})}function lO(e){const[t,i]=Gn(e);return $1(e,{x:(t.x+i.x)/2,y:(t.y+i.y)/2})}function cO(e,t,i,s,n,o){let a,r;if(n.xValue0Index>=o.xValue1Index){const d=s.findLast(p=>p.xValue1Index<=o.xValue1Index)?.datumIndex,u=d==null?void 0:i.data[d];a=u?.xValue1,r=u?.yValue1}else if(n.xValue0Index<=o.xValue0Index){const d=s.find(p=>p.xValue0Index>=o.xValue0Index)?.datumIndex,u=d==null?void 0:i.data[d];a=u?.xValue0,r=u?.yValue0}if(a==null||r==null)switch(t){case 0:return rO(e,i);case 1:return lO(e)}const l=Ji(a,i.scales.x),c=Ji(r,i.scales.y),h={x:l,y:c};return yu(e,h,h)}function RD(e,t){if(t==null)return;const i=Us(e.xValue0),s=Us(e.xValue1);return t.find(n=>Us(n.xValue0)===i&&Us(n.xValue1)===s)?.span}function hO(e,t,i,s,n,o,a){const r=e.data[s.datumIndex],l=r.span,c=RD(r,n);if(c==null){const h=cO(l,t,e,i,s,o);a.added.push({from:h,to:l})}else a.removed.push({from:c,to:c}),a.moved.push({from:c,to:l}),a.added.push({from:l,to:l})}function dO(e,t,i,s,n,o,a){const r=e.data[s.datumIndex],l=r.span,c=RD(r,n);if(c==null){const h=cO(l,t,e,i,s,o);a.removed.push({from:l,to:h})}else a.removed.push({from:l,to:l}),a.moved.push({from:l,to:c}),a.added.push({from:c,to:c})}function uO(e,t,i,s,n){const o=s.scales.x,a=t[n.xValue0Index],r=t[n.xValue1Index];let l,c;if(o?.type==="continuous"||o?.type==="log"?(l=i.data.findLast(m=>Us(m.xValue0)<=a),c=i.data.find(m=>Us(m.xValue1)>=r)):(l=i.data.find(m=>Us(m.xValue0)===a),c=i.data.find(m=>Us(m.xValue1)===r)),l==null||c==null)return;const[{x:h},{x:d}]=Gn(e),u=Ji(l.xValue0,i.scales.x),p=Ji(l.yValue0,i.scales.y),g=Ji(c.xValue1,i.scales.x),f=Ji(c.yValue1,i.scales.y);let x=s.data[n.datumIndex].span;return x=yu(x,{x:u,y:p},{x:g,y:f}),x=ED(x,h,d),x}function sY(e,t,i,s,n,o,a,r,l){const c=n+1,h=a.find(b=>b.xValue0Index<=n&&b.xValue1Index>=c),d=o.find(b=>b.xValue0Index<=n&&b.xValue1Index>=c),u=t.zeroData,p=e.zeroData;if(h==null&&d!=null){hO(e,i,o,d,u,r,l);return}else if(h!=null&&d==null){dO(t,i,a,h,p,r,l);return}else if(h==null||d==null)return;let g;h.xValue0Index===d.xValue0Index&&h.xValue1Index===d.xValue1Index?g=0:h.xValue0Index<=d.xValue0Index&&h.xValue1Index>=d.xValue1Index?g=-1:h.xValue0Index>=d.xValue0Index&&h.xValue1Index<=d.xValue1Index?g=1:g=0;const f=t.data[h.datumIndex],x=aO(f.span,t,s,n,h),m=e.data[d.datumIndex],v=aO(m.span,e,s,n,d);if(g===1){const b=uO(x,s,t,e,d);b==null?dO(t,i,a,h,p,r,l):(l.removed.push({from:x,to:b}),l.moved.push({from:b,to:v}),l.added.push({from:v,to:v}))}else if(g===-1){const b=uO(v,s,e,t,h);b==null?hO(e,i,o,d,u,r,l):(l.removed.push({from:x,to:x}),l.moved.push({from:x,to:b}),l.added.push({from:b,to:v}))}else l.removed.push({from:x,to:x}),l.moved.push({from:x,to:v}),l.added.push({from:v,to:v})}function nY(e,t,i,s){const n={removed:[],moved:[],added:[]},{axisValues:o,oldDataAxisIndices:a,newDataAxisIndices:r}=e,l={xValue0Index:Math.max(a.at(0)?.xValue0Index??-1/0,r.at(0)?.xValue0Index??-1/0),xValue1Index:Math.min(a.at(-1)?.xValue1Index??1/0,r.at(-1)?.xValue1Index??1/0)};for(let c=0;ct!=null):e.domain.every(t=>Number.isFinite(t)||t instanceof Date)&&e.range.every(t=>Number.isFinite(t))}function Kg(e,t){let i;const s=e.map(n=>n.point);switch(t.type){case"linear":i=K1(s);break;case"smooth":i=Z1(s,t.tension);break;case"step":i=Y1(s,t.position);break}return i.map((n,o)=>({span:n,xValue0:e[o].xDatum,yValue0:e[o].yDatum,xValue1:e[o+1].xDatum,yValue1:e[o+1].yDatum}))}function Yg(e,t,i=.001){return Math.abs(e.x-t.x)vx(r,l,t.removed),n=(r,l)=>vx(r,l,t.moved),o=(r,l)=>vx(r,l,t.added),a=BD(e,i);return{status:e,path:{addPhaseFn:o,updatePhaseFn:n,removePhaseFn:s},pathProperties:a}}function BD(e,t){const i=t==="none"?"updated":e,s={fromFn(n,o){const a={phase:Xo[i]},r=n.previousDatum??o;return r!=null&&(a.segments=r),e==="removed"?a.finish={visible:!1}:e==="added"&&(a.start={visible:!0}),a},toFn(n,o){const a={phase:Xo[i]},r=o;return r!=null&&(a.segments=r),a}};return t==="fade"?{fromFn(n,o){const a=e==="added"?0:n.opacity,r=e==="removed"?n.previousDatum??o:o;return{...s.fromFn(n,o),opacity:a,segments:r}},toFn(n,o){const a=e==="removed"?0:1,r=e==="removed"?n.previousDatum??o:o;return{...s.toFn(n,o),opacity:a,segments:r}}}:s}function yO(e,t,i){const s=e.scales.x?.type==="category",n=t.scales.x?.type==="category";if(s!==n||!Ug(e.scales.x)||!Ug(t.scales.x)||e.strokeData==null||t.strokeData==null)return;let o="updated";t.visible&&!e.visible?o="removed":!t.visible&&e.visible&&(o="added");const a=$g({scales:e.scales,data:e.strokeData.spans},{scales:t.scales,data:t.strokeData.spans},1);if(a==null)return;const r=FD(o,a,"fade"),l=(i?.changed??!0)||!yh(e.scales.x,t.scales.x)||!yh(e.scales.y,t.scales.y)||o!=="updated";return{status:o,stroke:r,hasMotion:l}}function mO({path:e},{spans:t,phantomSpans:i}){let s=0,n={x:Number.NaN,y:Number.NaN},o={x:Number.NaN,y:Number.NaN};for(let a=0;a=s;p-=1)Wg(e,i[p].span,1,!0);e.closePath(),Wg(e,r,0,!1),s=a}n=h,o=u}for(let a=t.length-1;a>=s;a-=1)Wg(e,i[a].span,1,!0);e.closePath()}function Sx(e,{path:t},i,s){for(let n=0;nSx(l,c,t.removed,i.removed),o=(l,c)=>Sx(l,c,t.moved,i.moved),a=(l,c)=>Sx(l,c,t.added,i.added),r=BD(e,s);return{status:e,path:{addPhaseFn:a,updatePhaseFn:o,removePhaseFn:n},pathProperties:r}}function bO(e,t){const i=e.scales.x?.type==="category",s=t.scales.x?.type==="category";if(i!==s||!Ug(e.scales.x)||!Ug(t.scales.x))return;let n="updated";t.visible&&!e.visible?n="removed":!t.visible&&e.visible&&(n="added");const o=$g({scales:e.scales,data:e.fillData.spans},{scales:t.scales,data:t.fillData.spans},0);if(o==null)return;const a=$g({scales:e.scales,data:e.fillData.phantomSpans},{scales:t.scales,data:t.fillData.phantomSpans},0);if(a==null)return;const r=$g({scales:e.scales,data:e.strokeData.spans,zeroData:e.fillData.phantomSpans},{scales:t.scales,data:t.strokeData.spans,zeroData:t.fillData.phantomSpans},0);if(r==null)return;const l="none",c=xO(n,o,a,l),h=FD(n,r,l);return{status:n,fill:c,stroke:h}}function Zg({id:e},t,i,...s){const n={phase:i?Xo[i]:"trailing"};vr(e,"markers",t,s,{opacity:0},{opacity:1},n);for(const o of s)o.cleanup()}function vO({id:e},t,...i){vr(e,"markers",t,i,{scalingX:0,scalingY:0},{scalingX:1,scalingY:1},{phase:"initial"});for(const s of i)s.cleanup()}function _D({id:e,nodeDataDependencies:t},i,...s){const n=t.seriesRectWidth;hi(e,"markers",i,s,{fromFn:(r,l)=>{const c=l.midPoint?.x??n;let h=ve(0,HT(c/n),1);return Number.isNaN(h)&&(h=0),{scalingX:0,scalingY:0,delay:h,duration:im,phase:"initial"}},toFn:()=>({scalingX:1,scalingY:1})})}function Mx(e){return{opacity:1,scalingX:1,scalingY:1}}function Xg(e,t){return{x:t.point?.x??Number.NaN,y:t.point?.y??Number.NaN,scalingCenterX:t.point?.x??Number.NaN,scalingCenterY:t.point?.y??Number.NaN}}function Dx(e,{datumIndex:t}){const i=e.getNodeData();if(i===void 0)return;const s=i[t],{point:n}=s??{};if(s==null||n==null)return;const o=e.getFormattedMarkerStyle(s),a=wi.anchor(o.shape),r=n.focusSize??o.size,l=4+r,c=l/2,h=(a.x-.5)*r,d=(a.y-.5)*r,u=s.point.x-c-h,p=s.point.y-c-d;return zt.toCanvas(e.contentGroup,new de(u,p,l,l))}function VD(e,t,i,s=i){if(!(s.enabled??i.enabled))return!1;const o=1;return(t.step??Pc(t.range)/Math.max(1,e))>o}function kx(e,t,i,s){return s??(s={stroke:t.stroke,strokeOpacity:t.strokeOpacity,strokeWidth:t.strokeWidth}),nm.reduce((n,o)=>(n[o]=e.getMarkerStyle(i,{},void 0,{highlightState:o},void 0,s),n),{})}function GD({id:e,visible:t,nodeDataDependencies:i},s,...n){const{seriesRectWidth:o,seriesRectHeight:a}=i;vr(e,"path_properties",s,n,{clipX:0},{clipX:o},{phase:"initial",start:{clip:!0,clipY:a,visible:t},finish:{clip:!1,visible:t}})}function Ix({id:e},t,i,s="add",...n){vr(e,t,i,n,{opacity:0},{opacity:1},{phase:s})}function jD(e){return t=>({visible:e.getVisible(),opacity:e.getOpacity(),clipScalingX:1,clip:!1})}function Ax({nodeDataDependencies:e},t){const i=s=>Number.isFinite(s)?s:0;t.clipX=i(e.seriesRectWidth),t.clipY=i(e.seriesRectHeight)}function SO(e){return e.isReversed()!==e.range[1]SO(c?t:i)?c?s.width+u:s.height+p:c?-u:-p,f=()=>SO(c?t:i)?c?-u:-p:c?s.width+u:s.height+p;return(m=>{const v=[];let b=-1;for(let S=0;S_.start!=null)?.start;let N=r.convert(L??T)-d,O=r.convert(I??w)+2*d;const P=L!=null&&Number.isNaN(N),F=I!=null&&Number.isNaN(O);P||F||(Number.isNaN(N)&&(N=g()),Number.isNaN(O)&&(O=f()),I!=null&&(b=S),v.push({start:N,stop:O,...A}))}return v})(e.segments).map(({stop:m,start:v,...b})=>{const S=c?v:-u,D=c?-p:v,L=c?m+h:s.width+u,I=c?s.height+p:m+h;return{clipRect:{x0:S,y0:D,x1:L,y1:I},...b}})}var MO=new Set(["time","timestamp","date","datetime"]);function HD(e,t,i){if(e!=="x"&&e!=="y"||!Ee(t))return;const s=DO(e,i);if(s==null||!(s in t))return;const n=t[s],o=kO(e,i),a=WD(s,n);return a?{type:a,position:o}:typeof n=="number"?{type:"number",position:o}:{type:"category",position:o}}function qg(e,t,i){if(e!=="x"&&e!=="y"||!Ee(t))return;const s=DO(e,i);if(s==null||!(s in t))return;const n=kO(e,i),o=WD(s,t[s]);if(o)return{type:o,position:n}}function WD(e,t){if(jo(t)||MO.has(e)&&Jt(t))return"time"}function DO(e,t){let i;return e==="x"?"xKey"in t&&(i=t.xKey):e==="y"&&"yKey"in t&&(i=t.yKey),i}function kO(e,t){return"direction"in t&&t.direction==="horizontal"?e==="x"?"left":"bottom":e==="x"?"bottom":"left"}var rY=.125,lY=.25,cY=Rp(G3),Lx=class extends zl{constructor(e){super({moduleCtx:e,propertyKeys:pu,propertyNames:gu,categoryKey:"xValue",pathsPerSeries:["fill","stroke"],pathsZIndexSubOrderOffset:[0,1e3],datumSelectionGarbageCollection:!1,segmentedDataNodes:!1,pickModes:[2,0],animationResetFns:{path:jD({getVisible:()=>this.visible,getOpacity:()=>this.getOpacity()}),label:gh,datum:(t,i)=>({...Mx(t),...Xg(t,i)})},clipFocusBox:!1}),this.properties=new gi,this.connectsToYAxis=!0,this.dataAggregationFilters=void 0,this.backgroundGroup=new Be({name:`${this.id}-background`,zIndex:0}),this._isStacked=void 0,this.fillSpans=[],this.phantomSpans=[],this.strokeSpans=[]}get pickModeAxis(){return"main"}get hasData(){return this.getHasData("xValue")}renderToOffscreenCanvas(){return super.renderToOffscreenCanvas()||this.contextNodeData!=null&&(this.contextNodeData.fillData.spans.length>xx||this.contextNodeData.strokeData.spans.length>xx)}attachSeries(e,t,i){super.attachSeries(e,t,i),e.appendChild(this.backgroundGroup)}detachSeries(e,t,i){super.detachSeries(e,t,i),this.backgroundGroup.remove()}attachPaths([e,t]){this.backgroundGroup.appendChild(e),this.contentGroup.appendChild(t),t.zIndex=-1}detachPaths([e,t]){e.remove(),t.remove()}isStacked(){return(this.seriesGrouping?.stackCount??1)>1}isNormalized(){return this.properties.normalizedTo!=null}setSeriesIndex(e){const i=this.isStacked()===this._isStacked;return this._isStacked=i,super.setSeriesIndex(e,i)}setZIndex(e){super.setZIndex(e),this.isStacked()?(this.backgroundGroup.zIndex=[0,e],this.contentGroup.zIndex=[1,e,0]):(this.backgroundGroup.zIndex=[1,e,0,0],this.contentGroup.zIndex=[1,e,0,1])}async processData(e){if(this.data==null)return;const{data:t,visible:i,seriesGrouping:{groupIndex:s=this.id,stackCount:n=1}={}}=this,{xKey:o,yKey:a,yFilterKey:r,connectMissingData:l,normalizedTo:c}=this.properties,h=!this.ctx.animationManager.isSkipped(),d=this.axes.x?.scale,u=this.axes.y?.scale,{xScaleType:p,yScaleType:g}=this.getScaleInformation({xScale:d,yScale:u}),f=n>1||c!=null,x={value:`area-stack-${s}-yValue`,marker:`area-stack-${s}-yValues-marker`},m={invalidValue:null};(qt(c)||l)&&n>1&&(m.invalidValue=0),i||(m.forceValue=0);const v=[Ll(o,p,{id:"xValue"}),Dt(a,g,{id:"yValueRaw",...m}),...r==null?[]:[Dt(r,g,{id:"yFilterRaw"})]];f&&v.push(...Tg(a,"normal",{id:"yValueCumulative",...m,groupId:x.marker},g)),qt(c)&&v.push(Dt(a,g,{id:"yValue",...m,groupId:x.value}),ex(Object.values(x),c)),h&&v.push(Ng());const{dataModel:b,processedData:S}=await this.requestDataModel(e,t,{props:v,groupByKeys:f,groupByData:!f});this.dataAggregationFilters=this.aggregateData(b,S),this.animationState.transition("updateData")}xCoordinateRange(e,t){const{marker:i}=this.properties,s=this.axes.x.scale.convert(e),n=i.enabled?.5*i.size*t:0;return[s-n,s+n]}yCoordinateRange(e,t){const{marker:i}=this.properties,s=this.axes.y.scale.convert(e[0]),n=i.enabled?.5*i.size*t:0;return[s-n,s+n]}yValueKey(){return this.isNormalized()?"yValue":"yValueRaw"}yCumulativeKey(e){return e.type==="grouped"?"yValueCumulative":this.yValueKey()}getSeriesDomain(e){const{dataModel:t,processedData:i,axes:s}=this;if(!t||!i)return[];const n=s.y;if(e==="x"){const a=t.resolveProcessedDataDefById(this,"xValue"),r=t.getDomain(this,"xValue","key",i);return a?.def.type==="key"&&a.def.valueType==="category"?r:fn(Cl(r))}const o=this.domainForClippedRange("y",[this.yCumulativeKey(i)],"xValue");if(n instanceof _n&&!(n instanceof sh)){const a=Number.isFinite(o[1]-o[0])?[Math.min(o[0],0),Math.max(o[1],0)]:[];return fn(a)}else return fn(o)}getSeriesRange(e,t){const[i,s]=this.domainForVisibleRange("y",[this.yCumulativeKey(this.processedData)],"xValue",t);return[Math.min(i,0),Math.max(s,0)]}getZoomRangeFittingItems(e,t,i){return this.zoomFittingVisibleItems("xValue",[this.yCumulativeKey(this.processedData)],e,t,i)}getVisibleItems(e,t,i){return this.countVisibleItems("xValue",[this.yCumulativeKey(this.processedData)],e,t,i)}aggregateData(e,t){if(Ud(t))return;const i=this.axes.x;if(i==null)return;const{scale:s}=i,n=e.resolveKeysById(this,"xValue",t),o=e.resolveColumnById(this,this.yCumulativeKey(t),t),a=e.getDomain(this,"xValue","key",t),r=e.resolveColumnNeedsValueOf(this,"xValue",t),l=e.resolveColumnNeedsValueOf(this,this.yCumulativeKey(t),t);return cY(s.type,n,o,a,r,l)}stackAggregatedData(e){const{indices:t,metaIndices:i}=e,{visible:s,axes:n,dataModel:o,processedData:a,seriesBelowStackContext:r}=this,l=n.x,c=n.y;if(!s)return this.phantomSpans=[],this.fillSpans=[],this.strokeSpans=[],r;if(l==null||c==null||o==null||a==null)return;const{scale:h}=l,{scale:d}=c,u=(h.bandwidth??0)/2,p=o.resolveKeysById(this,"xValue",a),g=o.resolveColumnById(this,this.yCumulativeKey(a),a);let[f,x]=Vp(1,i.length-1,l.range,S=>{const D=i[S],L=i[S+1],I=t[D],A=t[L],T=p[I],w=p[A],{0:N}=this.xCoordinateRange(T,0),{1:O}=this.xCoordinateRange(w,0);return[N,O]});f=Math.max(f-1,0),x=Math.min(x+1,i.length-1);let m=[];if(r?.fillSpans)m=r?.fillSpans;else for(let S=f;Sm[O]===!1),p=p.filter((N,O)=>m[O]===!1));let[v,b]=Vp(1,u.length,a.range,N=>this.xCoordinateRange(u[N],0));v=Math.max(v-2,0),b=Math.min(b+2,u.length);let S;if(n?.fillSpans)S=n?.fillSpans;else{const N=[];for(let O=v;Oa.maxRange>n);return o?this.stackAggregatedData(o):this.stackYValueData()}createNodeData(){const{axes:e,data:t,processedData:i,dataModel:s,dataAggregationFilters:n}=this,o=e.x,a=e.y;if(!o||!a||!t||!s||!i)return;const{xKey:r,xName:l,yFilterKey:c,yKey:h,yName:d,legendItemName:u,marker:p,label:g,fill:f,stroke:x}=this.properties,m=o.scale,v=a.scale,{isContinuousY:b}=this.getScaleInformation({xScale:m,yScale:v}),S=(m.bandwidth??0)/2,D=i.type==="grouped",L=s.resolveKeysById(this,"xValue",i),I=s.resolveColumnById(this,"yValueRaw",i),A=D?s.resolveColumnById(this,"yValueCumulative",i):I,T=c==null?void 0:s.resolveColumnById(this,"yFilterRaw",i),w=this.getSeriesDomain("y"),N=[],O=[],{visibleSameStackCount:P}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);let F=!1;const _=i.dataSources.get(this.id)?.data??[],z=i.invalidData?.get(this.id),[B,R]=m.range,V=Math.abs(R-B),j=n?.find(q=>q.maxRange>V);let $=0,W=0;const Y=j?.indices;[$,W]=this.visibleRangeIndices("xValue",o.range,Y),$=Math.max($-2,0),W=Math.min(W+2,Y?.length??L.length),i.input.count<1e3&&($=0,W=i.input.count);const se=(q,ee,oe)=>{let le;return(qt(this.properties.normalizedTo)?b&&dm(oe):!Number.isNaN(oe))&&(le=ee),{x:m.convert(q)+S,y:v.convert(le),size:p.size}},X=q=>{const ee=L[q];if(ee==null)return;const oe=_[q],le=I[q],he=A[q],ue=Number.isFinite(le)&&z?.[q]!==!0,xe=se(ee,+he,le),be=T==null?void 0:T[q]===le;if(be===!1&&(F=!0),ue&&p&&O.push({series:this,itemId:h,datum:oe,datumIndex:q,midPoint:{x:xe.x,y:xe.y},cumulativeValue:+he,yValue:le,xValue:ee,yKey:h,xKey:r,point:xe,fill:p.fill??f,stroke:p.stroke??x,strokeWidth:p.strokeWidth??this.properties.strokeWidth,selected:be}),g.enabled&&ue){const ye=this.getLabelText(le,oe,h,"y",w,g,{value:le,datum:oe,xKey:r,yKey:h,xName:l,yName:d,legendItemName:u});N.push({series:this,itemId:h,datum:oe,datumIndex:q,x:xe.x,y:xe.y,labelText:ye})}};for(let q=$;q0,crossFiltering:F,styles:kx(this,this.properties,p),segments:Q}}isPathOrSelectionDirty(){return this.properties.marker.isDirty()}updatePathNodes(e){const{paths:[t,i],visible:s,animationEnabled:n}=e,o=this.contextNodeData?.crossFiltering===!0,a=this.contextNodeData?.segments,r=st(this.getHighlightStyle(),this.getStyle(!1)),{strokeWidth:l,stroke:c,strokeOpacity:h,lineDash:d,lineDashOffset:u,fill:p,fillOpacity:g,opacity:f}=r;i.setProperties({segments:a,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:1,stroke:c,strokeWidth:l,strokeOpacity:h*(o?lY:1),lineDash:d,lineDashOffset:u,opacity:f,visible:s||n}),i.datum=a,Dr(t,{fill:p,stroke:void 0,fillOpacity:g*(o?rY:1)},this.getShapeFillBBox()),t.setProperties({segments:a,lineJoin:"round",pointerEvents:1,fillShadow:this.properties.shadow,opacity:f,visible:s||n}),t.datum=a,Ax(this,i),Ax(this,t)}updatePaths(e){this.updateAreaPaths(e.paths,e.contextData)}updateAreaPaths(e,t){for(const i of e)i.visible=t.visible;if(t.visible)this.updateFillPath(e,t),this.updateStrokePath(e,t);else for(const i of e)i.path.clear(),i.markDirty("AreaSeries")}updateFillPath(e,t){const[i]=e;i.path.clear(),mO(i,t.fillData),i.markDirty("AreaSeries")}updateStrokePath(e,t){const{spans:i}=t.strokeData,[,s]=e;s.path.clear(),zD(s,i),s.markDirty("AreaSeries")}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,{contextNodeData:s,processedData:n,axes:o,properties:a}=this,{marker:r,styler:l}=a,c=l?this.getStyle(!1).marker:void 0,h=s?.crossFiltering===!0||VD(n.input.count,o.x.scale,r,c);return r.isDirty()&&(i.clear(),i.cleanup()),i.update(h?t:[])}updateDatumStyles(e){const{datumSelection:t,isHighlight:i}=e,{marker:s}=this.properties,n=this.ctx.highlightManager.getActiveHighlight();t.each((o,a)=>{if(!t.isGarbage(o)){const r=this.getHighlightState(n,e.isHighlight,a.datumIndex),l=this.getStyle(i,r),{stroke:c,strokeWidth:h,strokeOpacity:d}=l,u=this.makeItemStylerParams(this.dataModel,this.processedData,a.datumIndex,l.marker);a.style=this.getMarkerStyle(s,a,u,{isHighlight:i,highlightState:r},l.marker,{stroke:c,strokeWidth:h,strokeOpacity:d})}})}updateDatumNodes(e){const{contextNodeData:t}=this;if(!t)return;const{datumSelection:i,isHighlight:s}=e,n=this.getShapeFillBBox(),o=this.ctx.highlightManager.getActiveHighlight();i.each((a,r)=>{const l=r.style??t.styles[this.getHighlightState(o,s,r.datumIndex)];this.applyMarkerStyle(l,a,r.point,n,{selected:r.selected})}),s||this.properties.marker.markClean()}updateLabelSelection(e){return e.labelSelection.update(this.isLabelEnabled()?e.labelData:[])}updateLabelNodes(e){const{isHighlight:t=!1}=e,i=this.ctx.highlightManager?.getActiveHighlight(),s=this.makeLabelFormatterParams();e.labelSelection.each((n,o)=>{const a=ph(this,o,s,this.properties.label,t,i),{enabled:r,fontStyle:l,fontWeight:c,fontSize:h,fontFamily:d,color:u}=a;r&&o?.labelText?(n.fontStyle=l,n.fontWeight=c,n.fontSize=h,n.fontFamily=d,n.textAlign="center",n.textBaseline="bottom",n.text=o.labelText,n.x=o.x,n.y=o.y-10,n.fill=u,n.visible=!0,n.fillOpacity=this.getHighlightStyle(t,o.datumIndex).opacity??1,n.setBoxing(a)):n.visible=!1})}makeStylerParams(e,t){const{id:i}=this,{marker:s,fill:n,fillOpacity:o,lineDash:a,lineDashOffset:r,stroke:l,strokeOpacity:c,strokeWidth:h,xKey:d,yKey:u}=this.properties,p=Cd(t??0);return{marker:{fill:s.fill,fillOpacity:s.fillOpacity,size:s.size,shape:s.shape,stroke:s.stroke,strokeOpacity:s.strokeOpacity,strokeWidth:s.strokeWidth,lineDash:s.lineDash,lineDashOffset:s.lineDashOffset},highlightState:p,highlighted:e,fill:n,fillOpacity:o,lineDash:a,lineDashOffset:r,seriesId:i,stroke:l,strokeOpacity:c,strokeWidth:h,xKey:d,yKey:u}}makeItemStylerParams(e,t,i,s){const{xKey:n,yKey:o}=this.properties,a=e.resolveKeysById(this,"xValue",t)[i],r=e.resolveColumnById(this,"yValueRaw",t)[i],l=e.getDomain(this,"xValue","key",t),c=e.getDomain(this,this.yCumulativeKey(t),"value",t),h=this.filterItemStylerFillParams(s.fill)??s.fill;return{...am(a,r,n,o,l,c),xValue:a,yValue:r,...s,fill:h}}makeLabelFormatterParams(){const{xKey:e,xName:t,yKey:i,yName:s,legendItemName:n}=this.properties;return{xKey:e,xName:t,yKey:i,yName:s,legendItemName:n}}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:n,properties:o}=this,{xKey:a,xName:r,yKey:l,yName:c,tooltip:h,legendItemName:d}=o,u=n.x,p=n.y;if(!i||!s||!u||!p)return;const g=s.dataSources.get(this.id)?.data?.[e],f=i.resolveKeysById(this,"xValue",s)[e],x=i.resolveColumnById(this,"yValueRaw",s)[e];if(f==null)return;const m=this.getStyle(!1),v=this.makeItemStylerParams(i,s,e,m.marker),b=this.getMarkerStyle(this.properties.marker,{datumIndex:e,datum:g},v,{isHighlight:!1},m.marker);return this.formatTooltipWithContext(h,{heading:this.getAxisValueText(u,"tooltip",f,g,a,d),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(p,"tooltip",x,g,l,d)}]},{seriesId:t,datum:g,title:c,xKey:a,xName:r,yKey:l,yName:c,...b,...this.getModuleTooltipParams()})}legendItemSymbol(){const{fill:e,stroke:t,fillOpacity:i,strokeOpacity:s,strokeWidth:n,lineDash:o,marker:a}=this.getStyle(!1),r=!a.enabled||a.fill==null,l=r?e:a.fill;return{marker:{...this.getMarkerStyle(this.properties.marker,{},void 0,{isHighlight:!1,checkForHighlight:!1},{size:a.size,shape:a.shape,fill:l,fillOpacity:r?i:a.fillOpacity,stroke:a.stroke}),enabled:a.enabled||n<=0},line:{stroke:t,strokeOpacity:s,strokeWidth:n,lineDash:o}}}getLegendData(e){if(e!=="category")return[];const{id:t,ctx:{legendManager:i},visible:s}=this,{yKey:n,yName:o,legendItemName:a,showInLegend:r}=this.properties;return[{legendType:e,id:t,itemId:n,legendItemName:a,seriesId:t,enabled:s&&i.getItemEnabled({seriesId:t,itemId:n}),label:{text:a??o??n},symbol:this.legendItemSymbol(),hideInLegend:!r}]}animateEmptyUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:s,paths:n}=e,{animationManager:o}=this.ctx;this.updateAreaPaths(n,s),GD(this,o,...n),fs([t],Xg),_D(this,o,t),Wt(this,"labels",o,i)}animateReadyResize(e){const{contextData:t,paths:i}=e;this.updateAreaPaths(i,t),super.animateReadyResize(e)}animateWaitingUpdateReady(e){const{animationManager:t}=this.ctx,{datumSelection:i,labelSelection:s,contextData:n,paths:o,previousContextData:a}=e,[r,l]=o;if(n.visible===!1&&a?.visible===!1||r==null&&l==null)return;this.resetDatumAnimation(e),this.resetLabelAnimation(e);const c=()=>{this.resetPathAnimation(e),this.updateAreaPaths(o,n)},h=()=>{t.skipCurrentBatch(),c()};if(n==null||a==null){c(),Zg(this,t,"added",i),Ix(this,"fill_path_properties",t,"add",r),Ix(this,"stroke_path_properties",t,"add",l),Wt(this,"labels",t,s);return}if(n.crossFiltering!==a.crossFiltering){h();return}const d=bO(n,a);if(d===void 0){h();return}else if(d.status==="no-op")return;Zg(this,t,void 0,i),hi(this.id,"fill_path_properties",t,[r],d.fill.pathProperties),fx(this.id,"fill_path_update",t,[r],d.fill.path),hi(this.id,"stroke_path_properties",t,[l],d.stroke.pathProperties),fx(this.id,"stroke_path_update",t,[l],d.stroke.path),Wt(this,"labels",t,s),this.ctx.animationManager.animate({id:this.id,groupId:"reset_after_animation",phase:"trailing",from:{},to:{},onComplete:()=>this.updateAreaPaths(o,n)})}isLabelEnabled(){return this.properties.label.enabled}nodeFactory(){return new wi}getStyle(e,t){const{styler:i,marker:s,fill:n,fillOpacity:o,lineDash:a,lineDashOffset:r,stroke:l,strokeOpacity:c,strokeWidth:h}=this.properties,{size:d,shape:u,fill:p="transparent",fillOpacity:g}=s;let f={};if(i){const x=this.makeStylerParams(e,t),m=this.cachedCallWithContext(i,x)??{};f=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],m,{pick:!1})??{}}return f.marker??(f.marker={}),{fill:f.fill??n,fillOpacity:f.fillOpacity??o,lineDash:f.lineDash??a,lineDashOffset:f.lineDashOffset??r,stroke:f.stroke??l,strokeOpacity:f.strokeOpacity??c,strokeWidth:f.strokeWidth??h,marker:{enabled:f.marker.enabled??s.enabled,fill:f.marker.fill??p,fillOpacity:f.marker.fillOpacity??g,shape:f.marker.shape??u,size:f.marker.size??d,lineDash:f.marker.lineDash??s.lineDash??a,lineDashOffset:f.marker.lineDashOffset??s.lineDashOffset??r,stroke:f.marker.stroke??s.stroke??l,strokeOpacity:f.marker.strokeOpacity??s.strokeOpacity??c,strokeWidth:f.marker.strokeWidth??s.strokeWidth??h}}}getFormattedMarkerStyle(e){const t=this.getStyle(!1),i=this.makeItemStylerParams(this.dataModel,this.processedData,e.datumIndex,t.marker);return this.getMarkerStyle(this.properties.marker,e,i,{isHighlight:!0},void 0,t)}computeFocusBounds(e){return Dx(this,e)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};Lx.className="AreaSeries",Lx.type="area";var hY={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"area",moduleFactory:e=>new Lx(e),stackable:!0,predictAxis:qg,defaultAxes:[{type:"number",position:"left"},{type:"category",position:"bottom"}],themeTemplate:{series:{nodeClickRange:"nearest",fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",vl],["image",Ir],["pattern",zn]]},stroke:{$palette:"stroke"},fillOpacity:.8,strokeOpacity:1,strokeWidth:{$isUserOption:["./stroke",2,0]},lineDash:[0],lineDashOffset:0,shadow:{enabled:!1,color:Wc,xOffset:3,yOffset:3,blur:5},interpolation:{type:"linear"},marker:{enabled:!1,shape:"circle",size:7,strokeWidth:{$isUserOption:["./stroke",1,0]},fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",Sg],["pattern",zn]]},stroke:{$palette:"stroke"}},label:{...Ra,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},tooltip:{range:{$path:["/tooltip/range","nearest"]},position:{anchorTo:{$path:["/tooltip/position/anchorTo","node"]}}},highlight:Sl(),segmentation:_m}}},IO={type:"series",name:"area",chartType:"cartesian",options:L2,create:e=>new Lx(e)},$D=class extends Li{constructor(){super(...arguments),this.direction="x",this.featherRatio=0}get feathered(){return Math.abs(this.featherRatio)>1e-6}isPointInPath(e,t){return this.feathered?this.getBBox().containsPoint(e,t):super.isPointInPath(e,t)}updatePath(){if(!this.feathered){super.updatePath();return}const{path:e,borderPath:t,x:i,y:s,width:n,height:o,direction:a,featherRatio:r}=this;if(e.clear(),t.clear(),a==="x"){const l=Math.abs(r)*n;r>0?(e.moveTo(i,s),e.lineTo(i+n-l,s),e.lineTo(i+n,s+o/2),e.lineTo(i+n-l,s+o),e.lineTo(i,s+o),e.closePath()):(e.moveTo(i+l,s),e.lineTo(i+n,s),e.lineTo(i+n,s+o),e.lineTo(i+l,s+o),e.lineTo(i,s+o/2),e.closePath())}else{const l=Math.abs(r)*o;r>0?(e.moveTo(i,s+l),e.lineTo(i+n/2,s),e.lineTo(i+n,s+l),e.lineTo(i+n,s+o),e.lineTo(i,s+o),e.closePath()):(e.moveTo(i,s),e.lineTo(i+n,s),e.lineTo(i+n,s+o-l),e.lineTo(i+n/2,s+o),e.lineTo(i,s+o-l),e.closePath())}}renderStroke(e){if(!this.feathered){super.renderStroke(e);return}const{stroke:t,strokeWidth:i}=this;if(t&&i){const{globalAlpha:s}=e,{lineDash:n,lineDashOffset:o,lineCap:a,lineJoin:r,path:l}=this;this.applyStrokeAndAlpha(e),e.lineWidth=i,n&&e.setLineDash(n),o&&(e.lineDashOffset=o),a&&(e.lineCap=a),r&&(e.lineJoin=r),e.stroke(l.getPath2D()),e.globalAlpha=s}}};M([ne()],$D.prototype,"direction",2),M([ne()],$D.prototype,"featherRatio",2);function Tx(e,t){for(const i of t){const s=i.datum;s===void 0?K.error("undefined datum"):e.addValue(i,s)}}function wx(e,t){const{x:i,y:s}=t,{nearest:n,distanceSquared:o}=e.getQuadTree().find(i,s);if(n!==void 0)return{datum:n.value,distance:Math.sqrt(o)}}var UD=class extends Er{constructor(){super(...arguments),this.direction="vertical"}};M([C],UD.prototype,"direction",2);var AO=class extends zl{constructor(){super(...arguments),this.groupScale=new zd,this.smallestDataInterval=void 0,this.largestDataInterval=void 0}get hasData(){return this.getHasData("xValue")}padBandExtent(e,t){const i=typeof t=="boolean"?1:.5,s=Ye(this.smallestDataInterval)?this.smallestDataInterval*i:0,n=Cl(e)??[Number.NaN,Number.NaN];return typeof t=="boolean"?n[t?0:1]-=(t?1:-1)*s:(n[0]-=s,n[1]+=s),fn(n)}getBandScalePadding(){return{inner:.3,outer:.15}}shouldFlipXY(){return!this.isVertical()}isVertical(){return this.properties.direction==="vertical"}getBarDirection(){return this.shouldFlipXY()?"x":"y"}getCategoryDirection(){return this.shouldFlipXY()?"y":"x"}getValueAxis(){const e=this.getBarDirection();return this.axes[e]}getCategoryAxis(){const e=this.getCategoryDirection();return this.axes[e]}getBandwidth(e,t){return ut.is(e.scale)?e.scale.calcBandwidth(this.smallestDataInterval,t):e.scale.bandwidth}xCoordinateRange(e){const t=this.axes[this.getCategoryDirection()],i=t.scale,s=this.getBandwidth(t,0)??0,n=ut.is(i)?s*-.5:0,o=i.convert(e)+n;return[o,o+s]}yCoordinateRange(e){const i=this.axes[this.getBarDirection()].scale,s=e.map(n=>i.convert(n));if(s.length===1){const n=i.convert(0);return[Math.min(s[0],n),Math.max(s[0],n)]}return[Math.min(...s),Math.max(...s)]}updateGroupScale(e){const t=[],{groupScale:i}=this,s=this.getBandwidth(e),{index:n,visibleGroupCount:o}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);for(let r=0;r=1?i.bandwidth:i.rawBandwidth,groupIndex:n}}resolveKeyDirection(e){return this.getBarDirection()==="x"?e==="x"?"y":"x":e}initQuadTree(e){Tx(e,this.datumNodesIter())}pickNodeClosestDatum(e){return wx(this,e)}},dY=1e3;function Nx(e,t){return Array.from({length:e},(i,s)=>{const n=s*aa,o=t[n+$s],a=t[n+tn];return Math.trunc((o+a)/2)})}function uY(e,t,i,s,n,o){if(t.length64;)({indexData:c,valueData:h}=Hg(c,h,l)),{indexData:d,valueData:u,maxRange:l}=Hg(d,u,l),p=Nx(l,c),g=Nx(l,d),f.push({maxRange:l,positiveIndices:p,positiveIndexData:c,negativeIndices:g,negativeIndexData:d});return f.reverse(),f}var KD=class extends Bt{constructor(){super(...arguments),this.placement="inside-center",this.spacing=0}};M([C],KD.prototype,"placement",2),M([C],KD.prototype,"spacing",2);var $t=class extends UD{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#874349",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.crisp=void 0,this.shadow=new _a,this.label=new KD,this.tooltip=fh(),this.sparklineMode=!1}};M([C],$t.prototype,"xKey",2),M([C],$t.prototype,"xName",2),M([C],$t.prototype,"yKey",2),M([C],$t.prototype,"yName",2),M([C],$t.prototype,"yFilterKey",2),M([C],$t.prototype,"stackGroup",2),M([C],$t.prototype,"normalizedTo",2),M([C],$t.prototype,"fill",2),M([C],$t.prototype,"fillOpacity",2),M([C],$t.prototype,"stroke",2),M([C],$t.prototype,"strokeWidth",2),M([C],$t.prototype,"strokeOpacity",2),M([C],$t.prototype,"lineDash",2),M([C],$t.prototype,"lineDashOffset",2),M([C],$t.prototype,"cornerRadius",2),M([C],$t.prototype,"crisp",2),M([C],$t.prototype,"styler",2),M([C],$t.prototype,"itemStyler",2),M([C],$t.prototype,"shadow",2),M([C],$t.prototype,"label",2),M([C],$t.prototype,"tooltip",2),M([C],$t.prototype,"sparklineMode",2);function CO(e,t,i,s){if(t!=null){const[n,o]=t;if(n!==0||o!==1)return!1}if(ut.is(e)){const n=e.calcBandwidth(s)-e.calcBandwidth(i);if(n>0&&n<1)return!1}if(br.is(e)){const{bandwidth:n,step:o}=e;if(n>0&&n<1)return!1;const a=o-n;if(a>0&&a<1)return!1}return!0}var YD=e=>CS(e.yValue??0);function Qg(e,t,i){const{startingX:s,startingY:n}=gY(e,t);return{isVertical:e,calculate:(a,r)=>{let l=e?a.x:s,c=e?n:a.y,h=e?a.width:0,d=e?0:a.height;const{opacity:u=1}=a;r&&(Number.isNaN(l)||Number.isNaN(c))&&({x:l,y:c}=r,h=e?r.width:0,d=e?0:r.height,e&&!YD(r)?c+=r.height:!e&&YD(r)&&(l+=r.width));let p;return a.clipBBox==null?p=void 0:YD(a)?p=e?new de(l,c-d,h,d):new de(l-h,c,h,d):p=new de(l,c,h,d),{x:l,y:c,width:h,height:d,clipBBox:p,opacity:u}},mode:i}}function pY(e,t){return{isVertical:e,calculate:i=>({x:e?i.x:i.x+i.width/2,y:e?i.y+i.height/2:i.y,width:e?i.width:0,height:e?0:i.height,clipBBox:i.clipBBox,opacity:i.opacity??1}),mode:t}}function Jg(e,t){const i=a=>a==null||Number.isNaN(a.x)||Number.isNaN(a.y);return{toFn:(a,r,l)=>l==="removed"&&a.datum==null&&e.mode==="fade"?{...ef(a,r),opacity:0}:l==="removed"||i(r)?e.calculate(r,a.previousDatum):{x:r.x,y:r.y,width:r.width,height:r.height,clipBBox:r.clipBBox,opacity:r.opacity??1},fromFn:(a,r,l)=>{l==="updated"&&i(r)?l="removed":l==="updated"&&i(a.previousDatum)&&(l="added");let c;l==="unknown"||l==="added"?(a.previousDatum==null&&e.mode==="fade"?c={...ef(a,r),opacity:0}:c=e.calculate(r,a.previousDatum),l==="unknown"&&(l=t)):c={x:a.x,y:a.y,width:a.width,height:a.height,clipBBox:a.clipBBox,opacity:a.opacity??1};const h=Xo[l];return{...c,phase:h}},applyFn:(a,r,l)=>{a.setProperties(r),a.crisp=l==="end"&&(a.datum?.crisp??!1)}}}function gY(e,t){const i=t[e?"y":"x"];let s=1/0,n=0;return i?(e?n=i.scale.convert(ut.is(i.scale)?0:Math.max(...i.range)):s=i.scale.convert(ut.is(i.scale)?0:Math.min(...i.range)),{startingX:s,startingY:n}):{startingX:s,startingY:n}}function ef(e,{x:t,y:i,width:s,height:n,clipBBox:o,opacity:a=1}){return{x:t,y:i,width:s,height:n,clipBBox:o,opacity:a,crisp:e.datum?.crisp??!1}}function ZD(e,t){if(t===void 0)return;const{x:i,y:s,width:n,height:o}=t;return zt.toCanvas(e.contentGroup,new de(i,s,n,o))}function LO(e,t,i,s,n,o,a){let r=o?.reduced?.diff?.[e];if(r?.changed)return r;if(!a)return{changed:!1,added:new Set,updated:new Set,removed:new Set,moved:new Set};const l=fY(s,n);return r==null&&o?.reduced?.diff!=null?(r={changed:!0,added:new Set,updated:new Set,removed:new Set,moved:new Set},l?r.updated=new Set(Array.from(t,({datum:c})=>i(c))):r.added=new Set(Array.from(t,({datum:c})=>i(c)))):l&&(r={changed:!0,added:new Set,updated:new Set(Array.from(t,({datum:c})=>i(c))),removed:new Set,moved:new Set}),r}function TO(e){return typeof e=="object"&&e!==null&&"groupScale"in e}function fY(e,t){if(!t)return!1;const i=e.scales,s=t.scales;if(!yh(i.x,s.x)||!yh(i.y,s.y))return!0;if(!TO(e)||!TO(t))return!1;const n=e.groupScale,o=t.groupScale;return!yh(n,o)}var yY=Rp(uY),tf=class extends AO{constructor(e){super({moduleCtx:e,propertyKeys:pu,propertyNames:gu,categoryKey:"xValue",pickModes:[2,1,0],pathsPerSeries:[],datumSelectionGarbageCollection:!1,animationAlwaysUpdateSelections:!0,animationResetFns:{datum:ef,label:gh}}),this.properties=new $t,this.connectsToYAxis=!0,this.dataAggregationFilters=void 0}get pickModeAxis(){return this.properties.sparklineMode?"main":void 0}crossFilteringEnabled(){return this.properties.yFilterKey!=null&&(this.seriesGrouping==null||this.seriesGrouping.stackIndex===0)}async processData(e){if(!this.data)return;const{xKey:t,yKey:i,yFilterKey:s,normalizedTo:n}=this.properties,{seriesGrouping:{groupIndex:o=this.id}={},data:a}=this,l=(this.seriesGrouping?.stackCount??0)>1||n!=null,c=l,h=!this.ctx.animationManager.isSkipped(),d=this.getCategoryAxis()?.scale,u=this.getValueAxis()?.scale,{isContinuousX:p,xScaleType:g,yScaleType:f}=this.getScaleInformation({xScale:d,yScale:u}),x=`bar-stack-${o}-yValues`,m=`${x}-trailing`,v=this.visible?{}:{forceValue:0},b=[Ll(t,g,{id:"xValue"}),Dt(i,f,{id:"yValue-raw",invalidValue:null,...v})];this.crossFilteringEnabled()&&b.push(Dt(s,f,{id:"yFilterValue",invalidValue:null,...v})),l&&b.push(...Tg(i,"normal",{id:"yValue-end",rangeId:"yValue-range",invalidValue:null,missingValue:0,groupId:x,separateNegative:!0,...v},f),...Tg(i,"trailing",{id:"yValue-start",invalidValue:null,missingValue:0,groupId:m,separateNegative:!0,...v},f)),p&&b.push(h2,d2),Ye(n)&&b.push(ex([x,m],Math.abs(n))),h&&this.processedData&&b.push(sx(this.id,this.processedData)),(h||!c)&&b.push(Ng());const{dataModel:S,processedData:D}=await this.requestDataModel(e,a,{props:b,groupByKeys:c,groupByData:!c});this.dataAggregationFilters=this.aggregateData(S,D),this.smallestDataInterval=D.reduced?.smallestKeyInterval,this.largestDataInterval=D.reduced?.largestKeyInterval,this.animationState.transition("updateData")}yCumulativeKey(e){return e.hasColumnById(this,"yValue-end")?"yValue-end":"yValue-raw"}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(i==null||t==null)return[];if(e===this.getCategoryDirection()){const r=i.resolveProcessedDataDefById(this,"xValue"),l=i.getDomain(this,"xValue","key",t);return r?.def.type==="key"&&r.def.valueType==="category"?l:this.padBandExtent(l)}const s=this.yCumulativeKey(i);let n=this.domainForClippedRange(e,[s],"xValue");const o=this.crossFilteringEnabled()?i.getDomain(this,"yFilterValue","value",t):void 0;o!=null&&(n=[Math.min(n[0],o[0]),Math.max(n[1],o[1])]);const a=this.getValueAxis();if(a instanceof _n&&!(a instanceof sh)){const r=Number.isFinite(n[1]-n[0])?[Math.min(0,n[0]),Math.max(0,n[1])]:[];return fn(r)}else return fn(n)}getSeriesRange(e,t){if((this.properties.direction==="horizontal"?"x":"y")!==e)return[];const s=this.yCumulativeKey(this.dataModel),[n,o]=this.domainForVisibleRange("y",[s],"xValue",t);return[Math.min(n,0),Math.max(o,0)]}getZoomRangeFittingItems(e,t,i){const s=this.yCumulativeKey(this.dataModel);return this.zoomFittingVisibleItems("xValue",[s],e,t,i)}getVisibleItems(e,t,i){const s=this.yCumulativeKey(this.dataModel);return this.countVisibleItems("xValue",[s],e,t,i)}aggregateData(e,t){if(Ud(t))return;const i=this.axes.x;if(i==null)return;const s=e.resolveKeysById(this,"xValue",t),n=e.hasColumnById(this,"yValue-start"),o=n?e.resolveColumnById(this,"yValue-start",t):void 0,a=n?e.resolveColumnById(this,"yValue-end",t):e.resolveColumnById(this,"yValue-raw",t),{index:r}=e.resolveProcessedDataDefById(this,"xValue"),l=t.domain.keys[r];return yY(i.scale.type,s,o,a,l,t.reduced?.smallestKeyInterval)}createNodeData(){const{dataModel:e,processedData:t,groupScale:i,dataAggregationFilters:s}=this,n=this.getCategoryAxis(),o=this.getValueAxis();if(!e||!t||!n||!o)return;const a=t.dataSources?.get(this.id);if(a==null)return;const r=n.scale,l=o.scale,{xKey:c,yKey:h,xName:d,yName:u,legendItemName:p,label:g}=this.properties,f=this.getSeriesDomain("y"),x=o.isReversed(),{barWidth:m,groupIndex:v}=this.updateGroupScale(n),b=i.convert(String(v)),S=ut.is(r)?m*-.5:0,D=e.hasColumnById(this,"yValue-start"),L=e.resolveKeysById(this,"xValue",t),I=e.resolveColumnById(this,"yValue-raw",t),A=D?e.resolveColumnById(this,"yValue-start",t):void 0,T=D?e.resolveColumnById(this,"yValue-end",t):void 0,w=this.crossFilteringEnabled()?e.resolveColumnById(this,"yFilterValue",t):void 0,N=!this.ctx.animationManager.isSkipped(),O=X=>r.convert(L[X])+b+S,[P,F]=r.range,_=Math.abs(F-P),z=s?.find(X=>X.maxRange>_),B=z==null&&(this.properties.crisp??CO(n?.scale,n?.visibleRange,this.smallestDataInterval,this.largestDataInterval)),R=l.convert(0),V=({datum:X,datumIndex:Q,xValue:ie,yValue:q,cumulativeValue:ee,phantom:oe,currY:le,prevY:he,x:ue,width:xe,isPositive:be,yRange:ye,labelText:Te,opacity:Ae,featherRatio:ze,crossScale:we=1})=>{const Ve=be!==x,Ke=l.convert(le),pt=l.convert(he),Ii=l.convert(ye),gt=this.getBarDirection()==="x",Ai=xe*.5*(1-we),ci={x:gt?Math.min(Ke,pt):ue+Ai,y:gt?ue+Ai:Math.min(Ke,pt),width:gt?Math.abs(pt-Ke):xe*we,height:gt?xe*we:Math.abs(pt-Ke)},ba=new de(ci.x,ci.y,ci.width,ci.height),sl={x:gt?Math.min(R,Ii):ue+Ai,y:gt?ue+Ai:Math.min(R,Ii),width:gt?Math.abs(R-Ii):xe*we,height:gt?xe*we:Math.abs(R-Ii)},Qf=this.shouldFlipXY()?ci.height:ci.width,bS=g.spacing+(typeof g.padding=="number"?g.padding:0);return{series:this,itemId:oe?Gs(h,oe):h,datum:X,datumIndex:Q,cumulativeValue:ee,phantom:oe,xValue:ie,yValue:q,yKey:h,xKey:c,capDefaults:{lengthRatioMultiplier:Qf,lengthMax:Qf},x:sl.x,y:sl.y,width:sl.width,height:sl.height,midPoint:{x:ci.x+ci.width/2,y:ci.y+ci.height/2},opacity:Ae,featherRatio:ze,topLeftCornerRadius:gt!==Ve,topRightCornerRadius:Ve,bottomRightCornerRadius:gt===Ve,bottomLeftCornerRadius:!Ve,clipBBox:ba,crisp:B,label:Te==null?void 0:{text:Te,...V1({isUpward:Ve,isVertical:!gt,placement:g.placement,spacing:bS,rect:ci})},missing:q==null,focusable:!oe}},j=[],$=[],W=[],Y=(X,Q,ie,q,ee,oe,le=0,he=1)=>{const ue=L[X];if(ue==null)return;const xe=a.data[X],be=I[X],ye=w==null?void 0:Number(w[X]),Te=be>=0&&!Object.is(be,-0);if(!Number.isFinite(ee)||ye!=null&&!Number.isFinite(ye))return;const Ae=g.enabled&&be!=null?this.getLabelText(ye??be,xe,h,"y",f,g,{datum:xe,value:ye??be,xKey:c,yKey:h,xName:d,yName:u,legendItemName:p}):void 0,ze=ye!=null&&ye>be,we=V({datum:xe,datumIndex:X,xValue:ue,yValue:ye??be,cumulativeValue:ye??ee,phantom:!1,currY:ye==null?ee:q+ye,prevY:q,x:Q,width:ie,isPositive:Te,yRange:Math.max(q+(ye??-1/0),oe),labelText:Ae,opacity:he,featherRatio:le,crossScale:ze?.6:void 0});if($.push(we),W.push(we),ye!=null){const Ve=V({datum:a.data[X],datumIndex:X,xValue:ue,yValue:ye,cumulativeValue:ye,phantom:!0,currY:ee,prevY:q,x:Q,width:ie,isPositive:Te,yRange:oe,labelText:void 0,opacity:he,featherRatio:le,crossScale:void 0});j.push(Ve)}};if(z!=null){const{positiveIndices:X,positiveIndexData:Q,negativeIndices:ie,negativeIndexData:q}=z,ee=x?-1:1;for(let oe=0;oe<2;oe+=1){const le=oe===0,he=le?X:ie,ue=le?Q:q,xe=le?sn:nn,be=le?nn:sn,[ye,Te]=this.visibleRangeIndices("xValue",n.range,he);for(let Ae=ye;Ae_)continue;const Ai=Math.abs(Ve-we)+1,ci=br.is(r)?Math.min(r.bandwidth*Math.max(Ai-1,1)/(r.step*Ai),1):1;let ba,sl,Qf=0;if(D)ba=Number(A[Ke]),sl=Number(T[pt]);else{const bS=Number(I[pt]),Yhe=Number(I[Ke]);ba=0,sl=bS,Qf=(le?1:-1)*ee*(1-Yhe/bS)}Y(pt,Ii,gt,ba,sl,sl,Qf,ci)}}}else if(t.type==="grouped"){const X=t.invalidData?.get(this.id),Q=m,ie=D?e.resolveProcessedDataIndexById(this,"yValue-range"):-1,q=t.columnScopes.findIndex(he=>he.has(this.id)),{groups:ee}=t,[oe,le]=Vp(1,ee.length,n.range,he=>{const xe=ee[he].keys[0];return this.xCoordinateRange(xe)});for(let he=oe;he=0&&!Object.is(ze,-0),Ve=D?Number(A?.[Te]):0,Ke=D?Number(T?.[Te]):ze;let pt=Ke;D&&(pt=xe[ie][we?1:0]),Y(Te,Ae,Q,Ve,Ke,pt)}}}else{const X=t.invalidData?.get(this.id),Q=m;let[ie,q]=this.visibleRangeIndices("xValue",n.range);t.input.count<1e3&&(ie=0,q=t.input.count);for(let ee=ie;ee0?[...j,...$]:$,labelData:W,scales:this.calculateScaling(),visible:this.visible||N,groupScale:this.getScaling(this.groupScale),styles:z0(this.getItemStyle.bind(this)),segments:se}}nodeFactory(){return new $D}getHighlightData(e,t){const i=e.find(s=>s.datum===t.datum&&!s.phantom);return i==null?void 0:[{...i}]}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>this.getDatumId(t))}makeStylerParams(e,t){const{id:i}=this,{cornerRadius:s,fill:n,fillOpacity:o,lineDash:a,lineDashOffset:r,stackGroup:l,stroke:c,strokeOpacity:h,strokeWidth:d,xKey:u,yKey:p}=this.properties,g=Cd(t??0);return{cornerRadius:s,fill:n,fillOpacity:o,highlightState:g,highlighted:e,lineDash:a,lineDashOffset:r,seriesId:i,stackGroup:l,stroke:c,strokeOpacity:h,strokeWidth:d,xKey:u,yKey:p}}makeItemStylerParams(e,t,i,s,n,o){const{id:a}=this,{xKey:r,yKey:l,stackGroup:c}=this.properties,h=t.dataSources.get(a)?.data?.[i],d=e.resolveColumnById(this,"yValue-raw",t)[i],u=e.getDomain(this,"xValue","key",t),p=e.getDomain(this,this.yCumulativeKey(e),"value",t),g=this.ctx.highlightManager?.getActiveHighlight(),f=this.getHighlightStateString(g,n,i),x=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:a,...am(s,d,r,l,u,p),datum:h,xValue:s,yValue:d,stackGroup:c,highlighted:n,highlightState:f,...o,fill:x}}getStyle(e,t,i){const{cornerRadius:s,fill:n,fillOpacity:o,lineDash:a,lineDashOffset:r,stroke:l,strokeOpacity:c,strokeWidth:h,styler:d}=this.properties;let u={};if(!e&&d){const p=this.makeStylerParams(t,i);u=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(d,p)??{},{pick:!1})??{}}return{cornerRadius:u.cornerRadius??s,fill:u.fill??n,fillOpacity:u.fillOpacity??o,lineDash:u.lineDash??a,lineDashOffset:u.lineDashOffset??r,opacity:1,stroke:u.stroke??l,strokeOpacity:u.strokeOpacity??c,strokeWidth:u.strokeWidth??h}}getItemStyle(e,t,i){const{properties:s,dataModel:n,processedData:o}=this,{itemStyler:a}=s,r=this.getHighlightStyle(t,e,i);let l=st(r,this.getStyle(e===void 0,t,i));if(a&&n!=null&&o!=null&&e!=null){const c=n.resolveKeysById(this,"xValue",o)[e],h=this.cachedDatumCallback(Gs(this.getDatumId({xValue:c,phantom:!1}),t?"highlight":"node"),()=>{const d=this.makeItemStylerParams(n,o,e,c,t,l);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(a,d))});h&&(l=st(h,l))}return l}updateDatumStyles(e){const t=this.ctx.highlightManager.getActiveHighlight();e.datumSelection.each((i,s)=>{if(!e.datumSelection.isGarbage(i)){const n=this.getHighlightState(t,e.isHighlight,s.datumIndex);s.style=this.getItemStyle(s.datumIndex,e.isHighlight,n)}})}updateDatumNodes(e){const{contextNodeData:t}=this;if(!t)return;const i=this.ctx.highlightManager.getActiveHighlight(),{shadow:s}=this.properties,n=this.getCategoryDirection()==="x",o=this.getShapeFillBBox(),a=this.getBarDirection();e.datumSelection.each((r,l)=>{const c=l.style??t.styles[this.getHighlightState(i,e.isHighlight,l.datumIndex)];Dr(r,c,o),r.drawingMode=e.drawingMode;const h=c.cornerRadius??0;r.topLeftCornerRadius=l.topLeftCornerRadius?h:0,r.topRightCornerRadius=l.topRightCornerRadius?h:0,r.bottomRightCornerRadius=l.bottomRightCornerRadius?h:0,r.bottomLeftCornerRadius=l.bottomLeftCornerRadius?h:0,r.visible=n?(l.clipBBox?.width??l.width)>0:(l.clipBBox?.height??l.height)>0,r.direction=a,r.featherRatio=l.featherRatio,r.crisp=l.crisp,r.fillShadow=s})}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t,i=>{i.pointerEvents=1})}updateLabelNodes(e){const{isHighlight:t=!1}=e,i={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yKey:this.properties.yKey,yName:this.properties.yName??this.properties.yKey,legendItemName:this.properties.legendItemName??this.properties.xName??this.properties.xKey},s=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((n,o)=>{n.fillOpacity=this.getHighlightStyle(t,o?.datumIndex).opacity??1,_1(this,n,i,this.properties.label,o.label,t,s)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:n}=this,{xKey:o,xName:a,yKey:r,yName:l,legendItemName:c,stackGroup:h,tooltip:d}=n,u=this.getCategoryAxis(),p=this.getValueAxis();if(!i||!s||!u||!p)return;const g=s.dataSources.get(this.id)?.data?.[e],f=i.resolveKeysById(this,"xValue",s)[e],x=i.resolveColumnById(this,"yValue-raw",s)[e];if(f==null)return;const m=this.getItemStyle(e,!1);return this.formatTooltipWithContext(d,{heading:this.getAxisValueText(u,"tooltip",f,g,o,c),symbol:this.legendItemSymbol(),data:[{label:l,fallbackLabel:r,value:this.getAxisValueText(p,"tooltip",x,g,r,c)}]},{seriesId:t,datum:g,title:l,xKey:o,xName:a,yKey:r,yName:l,legendItemName:c,stackGroup:h,...m,...this.getModuleTooltipParams()})}legendItemSymbol(){const{fill:e,stroke:t,strokeWidth:i,fillOpacity:s,strokeOpacity:n,lineDash:o,lineDashOffset:a}=this.getStyle(!1,!1,0);return{marker:{fill:e??"rgba(0, 0, 0, 0)",stroke:t??"rgba(0, 0, 0, 0)",fillOpacity:s,strokeOpacity:n,strokeWidth:i,lineDash:o,lineDashOffset:a}}}getLegendData(e){const{showInLegend:t}=this.properties;if(e!=="category")return[];const{id:i,ctx:{legendManager:s},visible:n}=this,{yKey:o,yName:a,legendItemName:r}=this.properties;return[{legendType:"category",id:i,itemId:o,seriesId:i,enabled:n&&s.getItemEnabled({seriesId:i,itemId:o}),label:{text:r??a??o},symbol:this.legendItemSymbol(),legendItemName:r,hideInLegend:!t}]}animateEmptyUpdateReady({datumSelection:e,labelSelection:t,annotationSelections:i}){const s=Jg(Qg(this.isVertical(),this.axes,"normal"),"unknown");hi(this.id,"nodes",this.ctx.animationManager,[e],s),Wt(this,"labels",this.ctx.animationManager,t),Wt(this,"annotations",this.ctx.animationManager,...i)}animateWaitingUpdateReady(e){const{datumSelection:t,labelSelection:i,annotationSelections:s,contextData:n,previousContextData:o}=e;this.ctx.animationManager.stopByAnimationGroupId(this.id);const a=LO(this.id,t,this.getDatumId.bind(this),e.contextData,o,this.processedData,this.processedDataUpdated),r=o==null?"fade":"normal",l=Jg(Qg(this.isVertical(),this.axes,r),"added");hi(this.id,"nodes",this.ctx.animationManager,[t],l,(c,h)=>this.getDatumId(h),a),(!a||a?.changed||!yh(n.groupScale,o?.groupScale))&&(Wt(this,"labels",this.ctx.animationManager,i),Wt(this,"annotations",this.ctx.animationManager,...s))}getDatumId(e){return Gs(e.xValue,e.phantom)}isLabelEnabled(){return this.properties.label.enabled}computeFocusBounds({datumIndex:e}){const t=this.contextNodeData?.nodeData[e].clipBBox;return ZD(this,t)}hasItemStylers(){return this.properties.styler!=null||this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};tf.className="BarSeries",tf.type="bar";var wO={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"bar",moduleFactory:e=>new tf(e),stackable:!0,groupable:!0,predictAxis:qg,defaultAxes:VN,themeTemplate:{zoom:{autoScaling:{enabled:{$and:[{$eq:[{$path:"../axes"},"x"]},{$not:{$eq:[{$path:"/series/0/direction"},"horizontal"]}}]}}},series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",vl],["image",Ir],["pattern",zn]]},stroke:{$palette:"stroke"},fillOpacity:1,strokeWidth:{$isUserOption:["./stroke",2,0]},lineDash:[0],lineDashOffset:0,label:{...Ra,padding:{$isUserOption:["./spacing",0,8]},enabled:!1,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$if:[{$or:[{$eq:[{$path:"./placement"},"outside-start"]},{$eq:[{$path:"./placement"},"outside-end"]}]},{$ref:"textColor"},{$ref:"chartBackgroundColor"}]},placement:"inside-center"},shadow:{enabled:!1,color:Wc,xOffset:3,yOffset:3,blur:5},errorBar:{cap:{lengthRatio:.3}},highlight:Sl(),segmentation:_m}}},NO={type:"series",name:"bar",chartType:"cartesian",options:ox,create:e=>new tf(e)},Ox=3,mY=5,OO=.05;function xY(e,t,i){const{xValues:s,yValues:n,xDomain:o,yDomain:a,xNeedsValueOf:r,yNeedsValueOf:l}=e,{x0:c,y0:h,x1:d,y1:u}=i;let p=0,g=1/0;const f=(c+d)/2,x=(h+u)/2;for(const m of t){const v=s[m],b=n[m];if(v==null||b==null)continue;const S=ra(v,o.min,o.max,r),D=ra(b,a.min,a.max,l),L=(S-f)**2+(D-x)**2;L=c&&m<=d&&v>=h&&v<=u&&(p+=1)}return p}function vY(e,t,i){const{xValues:s,yValues:n,xDomain:o,yDomain:a,xNeedsValueOf:r,yNeedsValueOf:l}=e,{x0:c,y0:h,x1:d,y1:u}=i,p=[{x0:1,y0:1,x1:0,y1:0,indices:[]},{x0:1,y0:1,x1:0,y1:0,indices:[]},{x0:1,y0:1,x1:0,y1:0,indices:[]},{x0:1,y0:1,x1:0,y1:0,indices:[]}],g=(c+d)/2,f=(h+u)/2;for(const m of t){const v=s[m],b=n[m];if(v==null||b==null)continue;const S=ra(v,o.min,o.max,r),D=ra(b,a.min,a.max,l),L=(S>g?1:0)+(D>f?2:0),I=p[L];I.indices.push(m),I.x0=Math.min(I.x0,S),I.y0=Math.min(I.y0,D),I.x1=Math.max(I.x1,S),I.y1=Math.max(I.y1,D)}const x=[];for(const m of p){const{indices:v,x0:b,x1:S,y0:D,y1:L}=m;if(v.length===0)continue;const I=XD(e,v,{x0:b,y0:D,x1:S,y1:L});x.push(I)}return x}function XD(e,t,i){const{x0:s,y0:n,x1:o,y1:a}=i;let l=t.lengthg){const v=Array.from({length:Ox},()=>[]);for(let b=0;b=0&&LD),b=XD(x,v,{x0:0,y0:0,x1:1,y1:1});b!=null&&m.push({sizeRatio:0,node:b})}return m.length>0?{xValues:i,yValues:s,xd0:h,xd1:d,yd0:u,yd1:p,filters:m,xNeedsValueOf:l,yNeedsValueOf:c}:void 0}function EO(e,t,i,s,n,o){const{xRange:a,yRange:r,xVisibleRange:[l,c],yVisibleRange:[h,d],minSize:u,maxSize:p}=i,{xValues:g,yValues:f,xd0:x,xd1:m,yd0:v,yd1:b,xNeedsValueOf:S,yNeedsValueOf:D}=t,L=1/Math.min(a/(c-l),r/(d-h)),I={xValues:g,yValues:f,xDomain:{min:x,max:m},yDomain:{min:v,max:b},xNeedsValueOf:S,yNeedsValueOf:D};for(const{sizeRatio:A,node:T}of t.filters){const w=.5*(u+A*(p-u)),N=w*L,O=e*N,P=l-w/a,F=c+w/a,_=h-w/r,z=d+w/r,B=[T];for(;B.length>0;){const R=B.pop();if(!(R.x1F||R.y1<_||R.y0>z))if(e!==1&&R.scale<=O)s!=null&&(s.count+=1),n?.push({datumIndex:R.primaryDatumIndex,count:R.indices.length,area:(R.x1-R.x0)*(R.y1-R.y0),dilation:ve(1,R.scale/N,e)});else if(R.children==null){const{indices:V}=R;if(s!=null){const $=R.x0>=l&&R.x1<=c&&R.y0>=h&&R.y1<=d?V.length:bY(I,V,{x0:l,y0:h,x1:c,y1:d});s.count+=$}o?.push(...V)}else B.push(...R.children)}}}function Ex(e,t,i){const s={count:0};return EO(e,t,i,s,void 0,void 0),s.count}var MY=100,DY=12;function kY(e,t,i){if(Ex(1,e,t)<=i)return 1;let s=1,n=2;for(;Ex(n,e,t)>i&&ni?s=a:n=a}return(s+n)/2}function IY(e,t,i){const s=[],n=[];return EO(e,t,i,void 0,s,n),{groupedAggregation:s,singleDatumIndices:n}}var qD=class extends on{constructor(){super(...arguments),this.maxSize=30}};M([C,ne()],qD.prototype,"maxSize",2),M([C,t0()],qD.prototype,"domain",2);var PO=class extends Bt{constructor(){super(...arguments),this.placement="top"}};M([C],PO.prototype,"placement",2);var xt=class extends Er{constructor(){super(...arguments),this.label=new PO,this.tooltip=fh(),this.maxRenderedItems=1/0,this.marker=new qD}};M([C],xt.prototype,"xKey",2),M([C],xt.prototype,"yKey",2),M([C],xt.prototype,"sizeKey",2),M([C],xt.prototype,"labelKey",2),M([C],xt.prototype,"xFilterKey",2),M([C],xt.prototype,"yFilterKey",2),M([C],xt.prototype,"sizeFilterKey",2),M([C],xt.prototype,"xName",2),M([C],xt.prototype,"yName",2),M([C],xt.prototype,"sizeName",2),M([C],xt.prototype,"labelName",2),M([C],xt.prototype,"title",2),M([zs("marker.shape")],xt.prototype,"shape",2),M([zs("marker.size")],xt.prototype,"size",2),M([zs("marker.maxSize")],xt.prototype,"maxSize",2),M([zs("marker.domain")],xt.prototype,"domain",2),M([zs("marker.fill")],xt.prototype,"fill",2),M([zs("marker.fillOpacity")],xt.prototype,"fillOpacity",2),M([zs("marker.stroke")],xt.prototype,"stroke",2),M([zs("marker.strokeWidth")],xt.prototype,"strokeWidth",2),M([zs("marker.strokeOpacity")],xt.prototype,"strokeOpacity",2),M([zs("marker.lineDash")],xt.prototype,"lineDash",2),M([zs("marker.lineDashOffset")],xt.prototype,"lineDashOffset",2),M([zs("marker.itemStyler")],xt.prototype,"itemStyler",2),M([C],xt.prototype,"styler",2),M([C],xt.prototype,"label",2),M([C],xt.prototype,"tooltip",2),M([C],xt.prototype,"maxRenderedItems",2);var AY=class extends OD{constructor(e,t,i,s){super(e,t,i,s),this.sizeKey=s.properties.sizeKey}},sf=class extends zl{constructor(e){super({moduleCtx:e,propertyKeys:{...pu,label:["labelKey"],size:["sizeKey"]},propertyNames:{...gu,label:["labelName"],size:["sizeName"]},categoryKey:void 0,pickModes:[2,1,0],pathsPerSeries:[],datumSelectionGarbageCollection:!1,animationResetFns:{label:gh,datum:Mx},usesPlacedLabels:!0,clipFocusBox:!1}),this.NodeEvent=AY,this.properties=new xt,this.dataAggregation=void 0,this.sizeScale=new ih}get pickModeAxis(){return"main-category"}get type(){return super.type}get hasData(){return this.getHasData("xValue")}async processData(e){if(this.data==null||!this.visible)return;const t=this.axes.x?.scale,i=this.axes.y?.scale,{xScaleType:s,yScaleType:n}=this.getScaleInformation({xScale:t,yScale:i}),o=this.sizeScale.type,{xKey:a,yKey:r,sizeKey:l,xFilterKey:c,yFilterKey:h,sizeFilterKey:d,labelKey:u,marker:p}=this.properties,{dataModel:g,processedData:f}=await this.requestDataModel(e,this.data,{props:[Dt(a,s,{id:"xValue"}),Dt(r,n,{id:"yValue"}),...c==null?[]:[Dt(c,s,{id:"xFilterValue"})],...h==null?[]:[Dt(h,n,{id:"yFilterValue"})],...d==null?[]:[Dt(d,o,{id:"sizeFilterValue"})],...l?[Dt(l,o,{id:"sizeValue"})]:[],...u?[Dt(u,"category",{id:"labelValue"})]:[]]}),x=l?g.resolveProcessedDataIndexById(this,"sizeValue"):void 0,m=p.domain?[p.domain[0],p.domain[1]]:void 0;this.sizeScale.domain=m??(x==null?void 0:f.domain.values[x])??[],this.dataAggregation=this.aggregateData(g,f),this.animationState.transition("updateData")}xCoordinateRange(e,t,i){const{properties:s,sizeScale:n}=this,{size:o,sizeKey:a}=s,r=this.axes.x.scale.convert(e),l=a==null?void 0:this.dataModel.resolveColumnById(this,"sizeValue",this.processedData),h=.5*(l==null?o:n.convert(l[i]))*t;return[r-h,r+h]}yCoordinateRange(e,t,i){const{properties:s,sizeScale:n}=this,{size:o,sizeKey:a}=s,r=this.axes.y.scale.convert(e[0]),l=a==null?void 0:this.dataModel.resolveColumnById(this,"sizeValue",this.processedData),h=.5*(l==null?o:n.convert(l[i]))*t;return[r-h,r+h]}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];const s={x:"xValue",y:"yValue"},n=s[e],o=t.resolveProcessedDataDefById(this,n),a=t.getDomain(this,n,"value",i);if(o?.def.type==="value"&&o?.def.valueType==="category")return a;const l=s[e==="x"?"y":"x"],c=this.domainForClippedRange(e,[n],l);return fn(Cl(c))}getSeriesRange(e,t){return this.domainForVisibleRange("y",["yValue"],"xValue",t)}getVisibleItems(e,t,i){const{dataAggregation:s,axes:n}=this,o=n.x,a=n.y;if(s==null||o==null||a==null)return this.countVisibleItems("xValue",["yValue"],e,t,i);const r=this.aggregationOptions(o,a,e,t??[0,1]);return Ex(0,s,r)}aggregateData(e,t){if(t.type==="grouped"||t.input.count<=this.properties.maxRenderedItems)return;const i=this.axes.x,s=this.axes.y;if(i==null||s==null)return;const n=i.scale,o=s.scale;if(!ut.is(n)||!ut.is(o))return;const{sizeScale:a,properties:r}=this,{sizeKey:l}=r,c=e.resolveColumnById(this,"xValue",t),h=e.resolveColumnById(this,"yValue",t),d=l?e.resolveColumnById(this,"sizeValue",t):void 0,u=e.getDomain(this,"xValue","value",t),p=e.getDomain(this,"yValue","value",t),g=l?a.domain:[0,0],f=e.resolveColumnNeedsValueOf(this,"xValue",t),x=e.resolveColumnNeedsValueOf(this,"yValue",t);return SY(n.type,o.type,c,h,d,u,p,g,f,x)}aggregationOptions(e,t,i=e.visibleRange,s=t.visibleRange){const{processedData:n,dataModel:o}=this,{sizeKey:a}=this.properties,[r,l]=this.getSizeRange(),c=Math.abs(e.range[1]-e.range[0]),h=Math.abs(t.range[1]-t.range[0]),d=Math.max(r,1),u=a?Math.max(l,1):d,p=e.scale,g=t.scale;return n!=null&&o!=null&&(ut.is(p)&&(i=MM(i,p.domain.map(ys),o.getDomain(this,"xValue","value",n).map(ys))),ut.is(g)&&(s=MM(s,g.domain.map(ys),o.getDomain(this,"yValue","value",n).map(ys)))),{xRange:c,yRange:h,minSize:d,maxSize:u,xVisibleRange:i,yVisibleRange:s}}createNodeData(){const{axes:e,dataModel:t,processedData:i,sizeScale:s,visible:n}=this,{xKey:o,yKey:a,sizeKey:r,xFilterKey:l,yFilterKey:c,sizeFilterKey:h,labelKey:d,xName:u,yName:p,sizeName:g,labelName:f,label:x,legendItemName:m,marker:v,maxRenderedItems:b}=this.properties,{enabled:S,placement:D}=x,L=wi.anchor(v.shape),I=e.x,A=e.y;if(!(t&&i&&I&&A))return;const T=!this.ctx.animationManager.isSkipped(),w=t.resolveColumnById(this,"xValue",i),N=t.resolveColumnById(this,"yValue",i),O=r==null?void 0:t.resolveColumnById(this,"sizeValue",i),P=d==null?void 0:t.resolveColumnById(this,"labelValue",i),F=l==null?void 0:t.resolveColumnById(this,"xFilterValue",i),_=c==null?void 0:t.resolveColumnById(this,"yFilterValue",i),z=h==null?void 0:t.resolveColumnById(this,"sizeFilterValue",i);let B;d?B=[]:r?B=t.getDomain(this,"sizeValue","value",i):B=[];const R=I.scale,V=A.scale,j=(R.bandwidth??0)/2,$=(V.bandwidth??0)/2,W=[];s.range=this.getSizeRange();const Y=Je(x),se=i.dataSources.get(this.id)?.data;if(se==null)return;const X=Od(x),Q=(q,ee,oe,le)=>{const he=se[q],ue=w[q],xe=N[q],be=O?.[q],ye=R.convert(ue)+j,Te=V.convert(xe)+$;let Ae;F!=null&&_!=null&&(Ae=F[q]===ue&&_[q]===xe,z!=null&&Ae&&(Ae=z[q]===be));let ze;if(S){let Ke,pt,Ii;d&&P?(Ke=P[q],pt=d,Ii="label"):r?(Ke=be,pt=r,Ii="size"):(Ke=xe,pt=a,Ii="y");const gt=this.getLabelText(Ke,he,pt,Ii,B,x,{value:Ke,datum:he,xKey:o,yKey:a,sizeKey:r,labelKey:d,xName:u,yName:p,sizeName:g,labelName:f,legendItemName:m});let{width:Ai,height:ci}=Ne(gt)?On(gt,x):Y.measureLines(String(gt));Ai+=X.left+X.right,ci+=X.bottom+X.top,ze={text:gt,width:Ai,height:ci}}else ze={text:"",width:0,height:0};const we=be==null?s.range[0]:s.convert(be),Ve={x:ye,y:Te,size:Math.sqrt(oe)*we};W.push({series:this,itemId:a,yKey:a,xKey:o,datum:he,datumIndex:q,xValue:ue,yValue:xe,sizeValue:be,capDefaults:{lengthRatioMultiplier:v.getDiameter(),lengthMax:1/0},point:Ve,midPoint:{x:ye,y:Te},label:ze,anchor:L,placement:D,count:ee,dilation:oe,area:le,selected:Ae})},{dataAggregation:ie}=this;if(n)if(ie==null)for(let q=0;qGs(o.xValue,o.yValue,o.sizeValue,$e(o.label.text))),i.update(t,void 0,n)}updateDatumStyles(e){const{datumSelection:t,isHighlight:i}=e,{xKey:s,yKey:n,sizeKey:o,labelKey:a,marker:r}=this.properties,l={xKey:s,yKey:n,sizeKey:o,labelKey:a},c=this.ctx.highlightManager.getActiveHighlight();t.each((h,d)=>{if(!t.isGarbage(h)){const u=this.getHighlightState(c,e.isHighlight,d.datumIndex),p=this.getStyle(e.isHighlight,u);d.style=this.getMarkerStyle(r,d,l,{isHighlight:i,highlightState:u,resolveMarkerSubPath:[]},p)}})}updateDatumNodes(e){const{contextNodeData:t}=this;if(!t)return;const{datumSelection:i,isHighlight:s,drawingMode:n}=e;this.sizeScale.range=this.getSizeRange();const o=this.getShapeFillBBox(),a=this.dataAggregation!=null,r=this.ctx.highlightManager.getActiveHighlight();i.each((l,c,h)=>{const{point:{size:d},count:u,area:p,dilation:g}=c;let f=c.style??t.styles[this.getHighlightState(r,s,c.datumIndex)];if(f={...f},f.size=d,g>1){const x=f.fillOpacity??0,m=.269669+683e-6*u+-37.534348*p+.004449*u*p+-0*u**2+44.428603*p**2;f.fillOpacity=ve(x/g,x/.1*m,1)}this.applyMarkerStyle(f,l,c.point,o,{selected:c.selected}),l.drawingMode=n,l.zIndex=a?[-u,h]:0}),s||this.properties.marker.markClean()}updatePlacedLabelData(e){this.labelSelection.update(e.map(t=>({...t.datum,point:{x:t.x,y:t.y,size:t.datum.point.size}})),t=>{t.pointerEvents=1}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(e){const{isHighlight:t=!1}=e,i=this.ctx.highlightManager?.getActiveHighlight(),s=this.makeLabelFormatterParams();e.labelSelection.each((n,o)=>{const a=ph(this,o,s,this.properties.label,t,i);n.text=o.label.text,n.fill=a.color,n.x=o.point?.x??0,n.y=o.point?.y??0,n.fontStyle=a.fontStyle,n.fontWeight=a.fontWeight,n.fontSize=a.fontSize,n.fontFamily=a.fontFamily,n.textBaseline="top",n.fillOpacity=this.getHighlightStyle(t,o.datumIndex).opacity??1,n.setBoxing(a)})}makeStylerParams(e,t){const{id:i,properties:{size:s,maxSize:n,shape:o,fill:a,fillOpacity:r,lineDash:l,lineDashOffset:c,stroke:h,strokeOpacity:d,strokeWidth:u,xKey:p,yKey:g,sizeKey:f,labelKey:x}}=this,m=Cd(t??0);return this.type==="bubble"?{highlightState:m,highlighted:e,size:s,maxSize:n,shape:o,fill:a,fillOpacity:r,lineDash:l,lineDashOffset:c,seriesId:i,sizeKey:f,stroke:h,strokeOpacity:d,strokeWidth:u,xKey:p,yKey:g,labelKey:x}:this.type==="scatter"?{highlightState:m,highlighted:e,size:s,shape:o,fill:a,fillOpacity:r,lineDash:l,lineDashOffset:c,seriesId:i,stroke:h,strokeOpacity:d,strokeWidth:u,xKey:p,yKey:g,labelKey:x}:this.type}makeLabelFormatterParams(){const{xKey:e,xName:t,yKey:i,yName:s,sizeKey:n,sizeName:o,labelKey:a,labelName:r,legendItemName:l}=this.properties;return{xKey:e,xName:t,yKey:i,yName:s,sizeKey:n,sizeName:o,labelKey:a,labelName:r,legendItemName:l}}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:n,properties:o,ctx:a}=this,{formatManager:r}=a,{xKey:l,xName:c,yKey:h,yName:d,sizeKey:u,sizeName:p,labelKey:g,labelName:f,title:x,tooltip:m,marker:v,legendItemName:b}=o,S=n.x,D=n.y;if(!i||!s||!S||!D)return;const L=s.dataSources.get(this.id)?.data?.[e],I=i.resolveColumnById(this,"xValue",s)[e],A=i.resolveColumnById(this,"yValue",s)[e];if(I==null)return;const T=[];if(this.isLabelEnabled()&&g!=null){const N=i.resolveColumnById(this,"labelValue",s)[e],O=r.format(this.callWithContext.bind(this),{type:"category",value:N,datum:L,seriesId:t,legendItemName:b,key:g,source:"tooltip",property:"label",domain:[],boundSeries:this.getFormatterContext("label")});T.push({label:f,fallbackLabel:g,value:O??Dd(N)})}if(T.push({label:c,fallbackLabel:l,value:this.getAxisValueText(S,"tooltip",I,L,l,b)},{label:d,fallbackLabel:h,value:this.getAxisValueText(D,"tooltip",A,L,h,b)}),u!=null){const N=i.resolveColumnById(this,"sizeValue",s)[e],O=i.getDomain(this,"sizeValue","value",s),P=r.format(this.callWithContext.bind(this),{type:"number",value:N,datum:L,seriesId:t,legendItemName:b,key:u,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:O,fractionDigits:void 0});T.push({label:p,fallbackLabel:u,value:P??Dd(N)})}const w=this.getMarkerStyle(v,{datum:L,datumIndex:e},{xKey:l,yKey:h,sizeKey:u,labelKey:g,highlighted:!0},{resolveMarkerSubPath:[]});return this.formatTooltipWithContext(m,{title:x,symbol:this.legendItemSymbol(),data:T},{seriesId:t,datum:L,title:h,xKey:l,xName:c,yKey:h,yName:d,sizeKey:u,sizeName:p,labelKey:g,labelName:f,legendItemName:b,...w,...this.getModuleTooltipParams()})}legendItemSymbol(){const e=this.getStyle(!1);return{marker:this.getMarkerStyle(this.properties.marker,{},void 0,{isHighlight:!1,checkForHighlight:!1,resolveMarkerSubPath:[]},e)}}getLegendData(){const{id:e,ctx:{legendManager:t},visible:i}=this,{yKey:s,yName:n,legendItemName:o,title:a,showInLegend:r}=this.properties;return[{legendType:"category",id:e,itemId:s,seriesId:e,enabled:i&&t.getItemEnabled({seriesId:e,itemId:s}),label:{text:o??a??n??s},symbol:this.legendItemSymbol(),legendItemName:o,hideInLegend:!r}]}animateEmptyUpdateReady({datumSelection:e,labelSelection:t}){vO(this,this.ctx.animationManager,e),Wt(this,"labels",this.ctx.animationManager,t)}isLabelEnabled(){return this.properties.label.enabled}nodeFactory(){return new wi}getStyle(e,t){const{properties:i}=this;let s={};if(i.styler){const n=this.makeStylerParams(e,t),o=this.cachedCallWithContext(i.styler,n)??{};s=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],o,{pick:!1})??{}}return{fill:s.fill??i.fill,fillOpacity:s.fillOpacity??i.fillOpacity,lineDash:s.lineDash??i.lineDash,lineDashOffset:s.lineDashOffset??i.lineDashOffset,shape:s.shape??i.shape,size:s.size??i.size,maxSize:s.maxSize??i.maxSize,stroke:s.stroke??i.stroke,strokeOpacity:s.strokeOpacity??i.strokeOpacity,strokeWidth:s.strokeWidth??i.strokeWidth}}getSizeRange(){const{size:e,maxSize:t}=this.getStyle(!1);return[e,t]}getFormattedMarkerStyle(e){const{xKey:t,yKey:i,sizeKey:s,labelKey:n,marker:o}=this.properties;return this.getMarkerStyle(o,e,{xKey:t,yKey:i,sizeKey:s,labelKey:n},{resolveMarkerSubPath:[]})}computeFocusBounds(e){return Dx(this,e)}hasItemStylers(){const{styler:e,itemStyler:t,marker:i,label:s}=this.properties;return!!(e??t??i.itemStyler??s.itemStyler)}initQuadTree(e){Tx(e,this.datumNodesIter())}pickNodeDataClosestDatum(e){return wx(this,e)}};sf.className="BubbleSeries",sf.type="bubble";var CY={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"bubble",moduleFactory:e=>new sf(e),predictAxis:HD,defaultAxes:[{type:"number",position:"bottom"},{type:"number",position:"left"}],themeTemplate:{series:{shape:"circle",size:7,maxSize:30,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",Sg],["image",Ir],["pattern",zn]]},stroke:{$palette:"stroke"},fillOpacity:.8,maxRenderedItems:1e4,label:{...Ra,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},tooltip:{range:{$path:["/tooltip/range","nearest"]},position:{anchorTo:{$path:["/tooltip/position/anchorTo","node"]}}},highlight:Sl()}}},RO={type:"series",name:"bubble",chartType:"cartesian",options:rK,create:e=>new sf(e)},Pi=class extends Er{constructor(){super(...arguments),this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.areaPlot=!1,this.aggregation="sum",this.shadow=new _a,this.label=new Bt,this.tooltip=fh()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,cornerRadius:r}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,cornerRadius:r,opacity:1}}};M([C],Pi.prototype,"xKey",2),M([C],Pi.prototype,"yKey",2),M([C],Pi.prototype,"xName",2),M([C],Pi.prototype,"yName",2),M([C],Pi.prototype,"fill",2),M([C],Pi.prototype,"fillOpacity",2),M([C],Pi.prototype,"stroke",2),M([C],Pi.prototype,"strokeWidth",2),M([C],Pi.prototype,"strokeOpacity",2),M([C],Pi.prototype,"lineDash",2),M([C],Pi.prototype,"lineDashOffset",2),M([C],Pi.prototype,"cornerRadius",2),M([C],Pi.prototype,"areaPlot",2),M([C],Pi.prototype,"bins",2),M([C],Pi.prototype,"aggregation",2),M([C],Pi.prototype,"binCount",2),M([C],Pi.prototype,"shadow",2),M([C],Pi.prototype,"label",2),M([C],Pi.prototype,"tooltip",2);var zO=10,Px=class extends zl{constructor(e){super({moduleCtx:e,propertyKeys:pu,propertyNames:gu,categoryKey:void 0,pickModes:[1,0],datumSelectionGarbageCollection:!0,animationResetFns:{datum:ef,label:gh}}),this.properties=new Pi,this.calculatedBins=[]}get hasData(){return this.calculatedBins.length>0}deriveBins(e){const t=eg(e[0],e[1],zO).ticks,i=tg(e[0],e[1],zO),[s]=t,n=o=>[o,o+i];return[[s-i,s],...t.map(n)]}calculateNiceBins(e,t){const i=Math.floor(e[0]),s=e[1],n=t||1,{start:o,binSize:a}=this.calculateNiceStart(i,s,n);return this.getBins(o,s,a,n)}getBins(e,t,i,s){const n=[],o=this.calculatePrecision(i);for(let a=0;a0)for(;e<1;)t*=10,e*=10;return t}calculateNiceStart(e,t,i){const s=Math.abs(t-e)/i,n=Math.floor(Math.log10(s)),o=Math.pow(10,n);return{start:Math.floor(e/o)*o,binSize:s}}async processData(e){const{visible:t}=this,{xKey:i,yKey:s,areaPlot:n,aggregation:o}=this.properties,a=this.axes.x?.scale,r=this.axes.y?.scale,{xScaleType:l,yScaleType:c}=this.getScaleInformation({yScale:r,xScale:a}),h=t?{}:{forceValue:0},d=[Ll(i,l),u2];if(s){let v=XM("groupAgg",{visible:t});o==="count"||(o==="sum"?v=e2("groupAgg",{visible:t}):o==="mean"&&(v=t2("groupAgg",{visible:t}))),n&&(v=qM("groupAgg",v)),d.push(Dt(s,c,{invalidValue:void 0,...h}),v)}else{d.push(r2("count"));let v=XM("groupAgg",{visible:t});n&&(v=qM("groupAgg",v)),d.push(v)}let u=[];const p=v=>{const b=fn(v.domain.keys[0]);if(b.length===0)return v.domain.groups=[],()=>[];const S=Jt(this.properties.binCount)?this.calculateNiceBins(b,this.properties.binCount):this.properties.bins??this.deriveBins(b),D=S.length;return u=[...S],L=>{let I=L[0];if(jo(I)&&(I=I.getTime()),!Jt(I))return[];for(let A=0;A=T[0]&&I{const b=m.get(Gs(...v));if(b){const{group:S,groupIndex:D}=b,[[L,I]=[0,0]]=S.aggregation,A=[...g.forEachDatum(this,x,S,D)],T=this.frequency(S),w=L+I;return{domain:v,datum:A,groupIndex:D,frequency:T,total:w}}else return{domain:v,datum:[],groupIndex:-1,frequency:0,total:0}}),this.animationState.transition("updateData")}xCoordinateRange(){return[Number.NaN,Number.NaN]}yCoordinateRange(){return[Number.NaN,Number.NaN]}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!t||!i||!this.calculatedBins.length)return[];const s=i.getDomain(this,"groupAgg","aggregate",t),n=this.calculatedBins[0].domain[0],o=this.calculatedBins[(this.calculatedBins?.length??0)-1].domain[1];return fn(e==="x"?[n,o]:s)}getSeriesRange(e,[t,i]){const{dataModel:s,processedData:n}=this;if(!s||n?.type!=="grouped")return[Number.NaN,Number.NaN];const o=this.axes.x.scale,a=0;let r=-1/0;for(const{keys:l,aggregation:c}of n.groups){const[[h,d]=[0,0]]=c,[u,p]=l,[g,f]=Wi([o.convert(u),o.convert(p)]);if(f>=t&&g<=i){const x=h+d;r=Math.max(r,x)}}return a>r?[Number.NaN,Number.NaN]:[a,r]}frequency(e){return e.datumIndices.reduce((t,i)=>t+i.length,0)}createNodeData(){const{axes:e,processedData:t,dataModel:i}=this,s=e.x,n=e.y;if(!s||!n||!i)return;const{scale:o}=s,{scale:a}=n,{xKey:r,yKey:l,xName:c,yName:h,label:d}=this.properties,u=!this.ctx.animationManager.isSkipped(),p=[],g={itemId:this.properties.yKey??this.id,nodeData:p,labelData:p,scales:this.calculateScaling(),animationValid:!0,visible:this.visible||u,styles:z0(this.getItemStyle.bind(this))};if(t==null||t.type!=="grouped")return g;for(const{domain:f,datum:x,groupIndex:m,frequency:v,total:b}of this.calculatedBins){const[S,D]=f,L=o.convert(S),I=o.convert(D),A=a.convert(0),T=a.convert(b),w=Math.abs(I-L),N=Math.abs(T-A),O=Math.min(L,I),P=Math.min(A,T);let F;d.enabled&&b!==0&&(F={x:O+w/2,y:P+N/2,text:this.getLabelText(b,x,l,"y",[],d,{value:b,datum:x,xKey:r,yKey:l,xName:c,yName:h})});const _={x:O+w/2,y:P+N/2},z=n.isReversed();p.push({series:this,datumIndex:m,datum:x,aggregatedValue:b,frequency:v,domain:f,yKey:l,xKey:r,x:O,y:P,xValue:L,yValue:T,width:w,height:N,midPoint:_,topLeftCornerRadius:!z,topRightCornerRadius:!z,bottomRightCornerRadius:z,bottomLeftCornerRadius:z,label:F,crisp:!0})}return p.sort((f,x)=>f.x-x.x),g}nodeFactory(){return new Li}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e;return i.update(t,void 0,s=>Gs(...s.domain))}getItemStyle(e,t,i){const{properties:s}=this,n=this.getHighlightStyle(t,e,i);return st(n,s.getStyle())}updateDatumStyles(e){const{datumSelection:t,isHighlight:i}=e;t.each((s,n)=>{t.isGarbage(s)||(n.style=this.getItemStyle(n.datumIndex,i))})}updateDatumNodes(e){const{contextNodeData:t}=this;if(!t)return;const i=this.ctx.highlightManager.getActiveHighlight(),{shadow:s}=this.properties,n=this.getShapeFillBBox();e.datumSelection.each((o,a)=>{const r=a.style??t.styles[this.getHighlightState(i,e.isHighlight,a.datumIndex)],{cornerRadius:l=0}=r,{topLeftCornerRadius:c,topRightCornerRadius:h,bottomRightCornerRadius:d,bottomLeftCornerRadius:u}=a;Dr(o,r,n),o.topLeftCornerRadius=c?l:0,o.topRightCornerRadius=h?l:0,o.bottomRightCornerRadius=d?l:0,o.bottomLeftCornerRadius=u?l:0,o.crisp=a.crisp,o.fillShadow=s})}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;return i.update(t,s=>{s.pointerEvents=1,s.textAlign="center",s.textBaseline="middle"})}updateLabelNodes(e){const t=this.isLabelEnabled(),i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,n)=>{const o=ph(this,n,this.properties,this.properties.label,!1,i),{enabled:a,fontStyle:r,fontWeight:l,fontSize:c,fontFamily:h,color:d}=o;a&&t&&n?.label?(s.text=n.label.text,s.x=n.label.x,s.y=n.label.y,s.fontStyle=r,s.fontWeight=l,s.fontFamily=h,s.fontSize=c,s.fill=d,s.visible=!0,s.fillOpacity=this.getHighlightStyle(!1,n.datumIndex).opacity??1,s.setBoxing(o)):s.visible=!1})}initQuadTree(e){const{value:t}=this.contentGroup.children().next();t instanceof Be&&Tx(e,t.children())}pickNodeClosestDatum(e){return wx(this,e)}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:n,properties:o,ctx:{localeManager:a}}=this,{xKey:r,xName:l,yKey:c,yName:h,tooltip:d,legendItemName:u}=o,p=n.x,g=n.y;if(!i||s?.type!=="grouped"||!p||!g)return;const f=s.groups[e],{aggregation:x,keys:m}=f,[[v,b]=[0,0]]=x,S=this.frequency(f),D=m,[L,I]=D,A=v+b,T={data:[...i.forEachDatum(this,s,f,e)],aggregatedValue:A,frequency:S,domain:D},w=[{label:l,fallbackLabel:r,value:`${this.getAxisValueText(p,"tooltip",L,T,r,u)} - ${this.getAxisValueText(p,"tooltip",I,T,r,u)}`},{label:a.t("seriesHistogramTooltipFrequency"),value:this.getAxisValueText(g,"tooltip",S,T,c,u)}];if(c!=null){let N;switch(o.aggregation){case"sum":N=a.t("seriesHistogramTooltipSum",{yName:h??c});break;case"mean":N=a.t("seriesHistogramTooltipMean",{yName:h??c});break;case"count":N=a.t("seriesHistogramTooltipCount",{yName:h??c});break}w.push({label:N,value:this.getAxisValueText(g,"tooltip",A,T,c,u)})}return this.formatTooltipWithContext(d,{symbol:this.legendItemSymbol(),data:w},{seriesId:t,datum:T,title:h,xKey:r,xName:l,yKey:c,yName:h,xRange:[L,I],frequency:S,...this.getItemStyle(e,!1)})}legendItemSymbol(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a}=this.properties;return{marker:{fill:Ft(e)??"rgba(0, 0, 0, 0)",stroke:i??"rgba(0, 0, 0, 0)",fillOpacity:t,strokeOpacity:n,strokeWidth:s,lineDash:o,lineDashOffset:a}}}getLegendData(e){if(e!=="category")return[];const{id:t,ctx:{legendManager:i},visible:s}=this,{xKey:n,yName:o,showInLegend:a}=this.properties;return[{legendType:"category",id:t,itemId:n,seriesId:t,enabled:s&&i.getItemEnabled({seriesId:t,itemId:n}),label:{text:o??n??"Frequency"},symbol:this.legendItemSymbol(),hideInLegend:!a}]}animateEmptyUpdateReady({datumSelection:e,labelSelection:t}){const i=Jg(Qg(!0,this.axes,"normal"),"unknown");hi(this.id,"datums",this.ctx.animationManager,[e],i),Wt(this,"labels",this.ctx.animationManager,t)}animateWaitingUpdateReady(e){const t=Jg(Qg(!0,this.axes,"normal"),"added"),i={changed:!0,added:new Set,updated:new Set,removed:new Set,moved:new Set};hi(this.id,"datums",this.ctx.animationManager,[e.datumSelection],t,(s,n)=>Gs(...n.domain),i),i?.changed&&Wt(this,"labels",this.ctx.animationManager,e.labelSelection)}isLabelEnabled(){return this.properties.label.enabled}computeFocusBounds({datumIndex:e}){return ZD(this,this.contextNodeData?.nodeData[e])}hasItemStylers(){return this.properties.label.itemStyler!=null}};Px.className="HistogramSeries",Px.type="histogram";var LY={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"histogram",moduleFactory:e=>new Px(e),predictAxis:qg,defaultAxes:[{type:"number",position:"bottom"},{type:"number",position:"left"}],themeTemplate:{series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",vl],["image",Ir],["pattern",zn]]},stroke:{$palette:"stroke"},strokeWidth:1,fillOpacity:1,strokeOpacity:1,lineDash:[0],lineDashOffset:0,label:{...Ra,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},shadow:{enabled:!1,color:Wc,xOffset:3,yOffset:3,blur:5},highlight:Sl()}}},FO={type:"series",name:"histogram",chartType:"cartesian",enterprise:!0,options:lK,create:e=>new Px(e)},TY=1e3,wY=10;function BO(e,t,i,s,n,o,a,r){const l=e[o];if(l==null)return!1;const c=Number.isFinite(t)?ra(l,t,i,a):Gg(o,r),h=LD(c,n);return o===s[h+$s]||o===s[h+tn]||o===s[h+sn]||o===s[h+nn]}function NY(e,t,i,s,n,o){const a=t.length;if(awY&&c>64;)({maxRange:c}=Hg(h,d,c,{inPlace:!0})),u=u.filter(g=>BO(t,r,l,h,c,g,n,a)),p.push({maxRange:c,indices:u});return p.reverse(),p}var fi=class extends Er{constructor(){super(...arguments),this.stroke="#874349",this.strokeWidth=2,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.interpolation=new fu,this.marker=new on,this.label=new Bt,this.tooltip=fh(),this.connectMissingData=!1,this.sparklineMode=!1}};M([C],fi.prototype,"xKey",2),M([C],fi.prototype,"yKey",2),M([C],fi.prototype,"xName",2),M([C],fi.prototype,"yName",2),M([C],fi.prototype,"yFilterKey",2),M([C],fi.prototype,"stackGroup",2),M([C],fi.prototype,"normalizedTo",2),M([C],fi.prototype,"title",2),M([C],fi.prototype,"stroke",2),M([C],fi.prototype,"strokeWidth",2),M([C],fi.prototype,"strokeOpacity",2),M([C],fi.prototype,"lineDash",2),M([C],fi.prototype,"lineDashOffset",2),M([C],fi.prototype,"interpolation",2),M([C],fi.prototype,"styler",2),M([C],fi.prototype,"marker",2),M([C],fi.prototype,"label",2),M([C],fi.prototype,"tooltip",2),M([C],fi.prototype,"connectMissingData",2),M([C],fi.prototype,"sparklineMode",2);var OY=.25,EY=Rp(NY),nf=class extends zl{constructor(e){super({moduleCtx:e,propertyKeys:pu,propertyNames:gu,categoryKey:"xValue",pickModes:[2,1,0],datumSelectionGarbageCollection:!1,segmentedDataNodes:!1,animationResetFns:{path:jD({getVisible:()=>this.visible,getOpacity:()=>this.getOpacity()}),label:gh,datum:(t,i)=>({...Mx(t),...Xg(t,i)})},clipFocusBox:!1}),this.properties=new fi,this.dataAggregationFilters=void 0}get pickModeAxis(){return this.properties.sparklineMode?"main":"main-category"}get hasData(){return this.getHasData("xValue")}isNormalized(){return this.properties.normalizedTo!=null}async processData(e){if(this.data==null)return;const{data:t,visible:i,seriesGrouping:{groupIndex:s=this.id,stackCount:n=0}={}}=this,{xKey:o,yKey:a,yFilterKey:r,connectMissingData:l,normalizedTo:c}=this.properties,h=!this.ctx.animationManager.isSkipped(),d=this.axes.x?.scale,u=this.axes.y?.scale,{isContinuousX:p,xScaleType:g,yScaleType:f}=this.getScaleInformation({xScale:d,yScale:u}),x=n>1||c!=null,m={invalidValue:null};l&&x&&(m.invalidValue=0),x&&!i&&(m.forceValue=0);const v={value:`area-stack-${s}-yValue`,marker:`area-stack-${s}-yValues-marker`},b=[];(!p||x)&&b.push(Ll(o,g,{id:"xKey"})),b.push(Dt(o,g,{id:"xValue"}),Dt(a,f,{id:"yValueRaw",...m,invalidValue:void 0})),r!=null&&b.push(Dt(r,f,{id:"yFilterRaw"})),x&&b.push(...Tg(a,"normal",{id:"yValueCumulative",...m,groupId:v.marker},f)),qt(c)&&b.push(Dt(a,f,{id:"yValue",...m,groupId:v.value}),ex(Object.values(v),c)),h&&(b.push(Ng(p?["xValue"]:void 0)),this.processedData&&b.push(sx(this.id,this.processedData)));const{dataModel:S,processedData:D}=await this.requestDataModel(e,t,{props:b,groupByKeys:x,groupByData:!x});this.dataAggregationFilters=this.aggregateData(S,D),this.animationState.transition("updateData")}yValueKey(){return this.isNormalized()?"yValue":"yValueRaw"}yCumulativeKey(e){return e.type==="grouped"?"yValueCumulative":this.yValueKey()}xCoordinateRange(e,t){const{marker:i}=this.properties,s=this.axes.x.scale.convert(e),n=i.enabled?.5*i.size*t:0;return[s-n,s+n]}yCoordinateRange(e,t){const{marker:i}=this.properties,s=this.axes.y.scale.convert(e[0]),n=i.enabled?.5*i.size*t:0;return[s-n,s+n]}getSeriesDomain(e){const{dataModel:t,processedData:i,axes:s}=this;if(!t||!i)return[];const n=s.y;if(e==="x"){const a=t.resolveProcessedDataDefById(this,"xValue"),r=t.getDomain(this,"xValue","value",i);return a?.def.type==="value"&&a.def.valueType==="category"?r:fn(Cl(r))}const o=this.domainForClippedRange("y",[this.yCumulativeKey(i)],"xValue");if(this.isNormalized()&&n instanceof _n&&!(n instanceof sh)){const a=Number.isFinite(o[1]-o[0])?[Math.min(o[0],0),Math.max(o[1],0)]:[];return fn(a)}else return fn(o)}getSeriesRange(e,t){return this.domainForVisibleRange("y",[this.yCumulativeKey(this.processedData)],"xValue",t)}getZoomRangeFittingItems(e,t,i){return this.zoomFittingVisibleItems("xValue",[this.yCumulativeKey(this.processedData)],e,t,i)}getVisibleItems(e,t,i){return this.countVisibleItems("xValue",[this.yCumulativeKey(this.processedData)],e,t,i)}aggregateData(e,t){if(t.type!=="ungrouped"||Ud(t))return;const i=this.axes.x;if(i==null)return;const{scale:s}=i,n=e.resolveColumnById(this,"xValue",t),o=e.resolveColumnById(this,this.yCumulativeKey(t),t),a=e.getDomain(this,"xValue","value",t),r=e.resolveColumnNeedsValueOf(this,"xValue",t),l=e.resolveColumnNeedsValueOf(this,this.yCumulativeKey(t),t);return EY(s.type,n,o,a,r,l)}createNodeData(){const{dataModel:e,processedData:t,axes:i,dataAggregationFilters:s}=this,n=i.x,o=i.y;if(!e||!t||!n||!o)return;const{xKey:a,xName:r,yFilterKey:l,yKey:c,yName:h,marker:d,label:u,connectMissingData:p,interpolation:g,legendItemName:f}=this.properties,x=n.scale,m=o.scale,v=(x.bandwidth??0)/2,b=(m.bandwidth??0)/2,S=d.enabled?d.size:0,D=t.dataSources.get(this.id)?.data??[],L=e.resolveColumnById(this,"xValue",t),I=e.resolveColumnById(this,"yValueRaw",t),A=e.resolveColumnById(this,this.yCumulativeKey(t),t),T=l==null?void 0:e.resolveColumnById(this,"yFilterRaw",t),w=this.getSeriesDomain("y"),N={lengthRatioMultiplier:this.properties.marker.getDiameter(),lengthMax:1/0},O=[],P=[],F=Q=>{const ie=D[Q],q=L[Q],ee=I[Q],oe=A[Q],le=T?.[Q],he=x.convert(q)+v,ue=m.convert(oe)+b;if(!Number.isFinite(he))return;if(ee!=null){const be=u.enabled?this.getLabelText(ee,ie,c,"y",w,u,{value:ee,datum:ie,xKey:a,yKey:c,xName:r,yName:h,legendItemName:f}):void 0;O.push({series:this,datum:ie,datumIndex:Q,yKey:c,xKey:a,point:{x:he,y:ue,size:S},midPoint:{x:he,y:ue},cumulativeValue:oe,yValue:ee,xValue:q,capDefaults:N,labelText:be,selected:le})}const xe=P.at(-1);if(ee!=null){const be={point:{x:he,y:ue},xDatum:q,yDatum:ee};Array.isArray(xe)?xe.push(be):xe==null?P.push([be]):(xe.skip+=1,P.push([be]))}else p||(Array.isArray(xe)||xe==null?P.push({skip:0}):xe.skip+=1)},[_,z]=x.range,B=Math.abs(z-_),V=s?.find(Q=>Q.maxRange>B)?.indices;let[j,$]=this.visibleRangeIndices("xValue",n.range,V);j=Math.max(j-1,0),$=Math.min($+1,V?.length??L.length),t.input.count<1e3&&(j=0,$=t.input.count);for(let Q=j;Q<$;Q+=1)F(V?.[Q]??Q);const W=P.flatMap(Q=>Array.isArray(Q)?Kg(Q,g):[]),Y={itemId:c,spans:W},se=T?.some((Q,ie)=>Q===I[ie])??!1,X=Cx(this.properties.segmentation,n,o,this.chart.seriesRect,this.ctx.scene,!1);return{itemId:c,nodeData:O,labelData:O,strokeData:Y,scales:this.calculateScaling(),visible:this.visible,crossFiltering:se,styles:kx(this,this.properties,d),segments:X}}isPathOrSelectionDirty(){return this.properties.marker.isDirty()}updatePathNodes(e){const{paths:[t],visible:i,animationEnabled:s}=e,n=this.contextNodeData?.crossFiltering===!0,o=st(this.getHighlightStyle(),this.getStyle(!1)),{strokeWidth:a,stroke:r,strokeOpacity:l,lineDash:c,lineDashOffset:h,opacity:d}=o,u=this.contextNodeData?.segments;t.setProperties({segments:u,fill:void 0,lineJoin:"round",pointerEvents:1,opacity:d,stroke:r,strokeWidth:a,strokeOpacity:l*(n?OY:1),lineDash:c,lineDashOffset:h}),t.datum=u,s||(t.visible=i),Ax(this,t)}updateDatumSelection(e){let{nodeData:t}=e;const{datumSelection:i}=e,{contextNodeData:s,processedData:n,axes:o,properties:a}=this,{marker:r}=a;return t=s?.crossFiltering===!0||VD(n.input.count,o.x.scale,r)?t:[],r.isDirty()&&(i.clear(),i.cleanup()),i.update(t,void 0,c=>Gs(c.xValue))}updateDatumStyles(e){const{datumSelection:t,isHighlight:i}=e,{marker:s}=this.properties,n=this.ctx.highlightManager.getActiveHighlight();t.each((o,a)=>{if(!t.isGarbage(o)){const r=this.getHighlightState(n,e.isHighlight,a.datumIndex),l=this.getStyle(i,r),{stroke:c,strokeWidth:h,strokeOpacity:d}=l,u=this.makeItemStylerParams(this.dataModel,this.processedData,a.datumIndex,l.marker);a.style=this.getMarkerStyle(s,a,u,{isHighlight:i,highlightState:r},l.marker,{stroke:c,strokeWidth:h,strokeOpacity:d})}})}updateDatumNodes(e){const{contextNodeData:t}=this;if(!t)return;const{datumSelection:i,isHighlight:s,drawingMode:n}=e,o=this.ctx.animationManager.isSkipped(),a=this.getShapeFillBBox(),r=this.ctx.highlightManager.getActiveHighlight();i.each((l,c)=>{const h=this.getHighlightState(r,s,c.datumIndex),d=c.style??t.styles[h];this.applyMarkerStyle(d,l,c.point,a,{applyTranslation:o,selected:c.selected}),l.drawingMode=n}),s||this.properties.marker.markClean()}updateLabelSelection(e){return e.labelSelection.update(this.isLabelEnabled()?e.labelData:[])}updateLabelNodes(e){const{isHighlight:t=!1}=e,i=this.ctx.highlightManager?.getActiveHighlight(),s=this.makeLabelFormatterParams();e.labelSelection.each((n,o)=>{const a=ph(this,o,s,this.properties.label,t,i),{enabled:r,fontStyle:l,fontWeight:c,fontSize:h,fontFamily:d,color:u}=a;r&&o?.labelText?(n.fontStyle=l,n.fontWeight=c,n.fontSize=h,n.fontFamily=d,n.textAlign="center",n.textBaseline="bottom",n.text=o.labelText,n.x=o.point.x,n.y=o.point.y-10,n.fill=u,n.visible=!0,n.fillOpacity=this.getHighlightStyle(t,o.datumIndex).opacity??1,n.setBoxing(a)):n.visible=!1})}makeStylerParams(e,t){const{id:i}=this,{marker:s,lineDash:n,lineDashOffset:o,stroke:a,strokeOpacity:r,strokeWidth:l,xKey:c,yKey:h}=this.properties,d=Cd(t??0);return{marker:{fill:s.fill,fillOpacity:s.fillOpacity,size:s.size,shape:s.shape,stroke:s.stroke,strokeOpacity:s.strokeOpacity,strokeWidth:s.strokeWidth,lineDash:s.lineDash,lineDashOffset:s.lineDashOffset},highlightState:d,highlighted:e,lineDash:n,lineDashOffset:o,seriesId:i,stroke:a,strokeOpacity:r,strokeWidth:l,xKey:c,yKey:h}}makeItemStylerParams(e,t,i,s){const{xKey:n,yKey:o}=this.properties,a=e.resolveColumnById(this,"xValue",t)[i],r=e.resolveColumnById(this,"yValueRaw",t)[i],l=e.getDomain(this,"xValue","key",t),c=e.getDomain(this,this.yCumulativeKey(t),"value",t),h=this.filterItemStylerFillParams(s.fill)??s.fill;return{...am(a,r,n,o,l,c),xValue:a,yValue:r,...s,fill:h}}makeLabelFormatterParams(){const{xKey:e,xName:t,yKey:i,yName:s,legendItemName:n}=this.properties;return{xKey:e,xName:t,yKey:i,yName:s,legendItemName:n}}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:n,properties:o}=this,{xKey:a,xName:r,yKey:l,yName:c,tooltip:h,legendItemName:d}=o,u=n.x,p=n.y;if(!i||!s||!u||!p)return;const g=s.dataSources.get(this.id)?.data?.[e],f=i.resolveColumnById(this,"xValue",s)[e],x=i.resolveColumnById(this,"yValueRaw",s)[e];if(f==null)return;const m=this.getStyle(!1),v=this.makeItemStylerParams(i,s,e,m.marker),b=this.getMarkerStyle(this.properties.marker,{datumIndex:e,datum:g},v,{isHighlight:!1},m.marker);return this.formatTooltipWithContext(h,{heading:this.getAxisValueText(u,"tooltip",f,g,a,d),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(p,"tooltip",x,g,l,d)}]},{seriesId:t,datum:g,title:c,xKey:a,xName:r,yKey:l,yName:c,...b,...this.getModuleTooltipParams()})}legendItemSymbol(){const{stroke:e,strokeOpacity:t,strokeWidth:i,lineDash:s,marker:n}=this.getStyle(!1);return{marker:{...this.getMarkerStyle(this.properties.marker,{},void 0,{isHighlight:!1,checkForHighlight:!1},{size:n.size,shape:n.shape,fill:n.fill,fillOpacity:n.fillOpacity,stroke:n.stroke,strokeOpacity:n.strokeOpacity,strokeWidth:n.strokeWidth,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset}),enabled:this.properties.marker.enabled},line:{stroke:e,strokeOpacity:t,strokeWidth:i,lineDash:s}}}getLegendData(e){if(e!=="category")return[];const{id:t,ctx:{legendManager:i},visible:s}=this,{yKey:n,yName:o,title:a,legendItemName:r,showInLegend:l}=this.properties;return[{legendType:e,id:t,itemId:n,legendItemName:r,seriesId:t,enabled:s&&i.getItemEnabled({seriesId:t,itemId:n}),label:{text:r??a??o??n},symbol:this.legendItemSymbol(),hideInLegend:!l}]}updatePaths(e){this.updateLinePaths(e.paths,e.contextData)}updateLinePaths(e,t){const i=t.strokeData.spans,[s]=e;s.path.clear(),zD(s,i),s.markDirty("LineSeries")}animateEmptyUpdateReady(e){const{datumSelection:t,labelSelection:i,annotationSelections:s,contextData:n,paths:o}=e,{animationManager:a}=this.ctx;this.updateLinePaths(o,n),GD(this,a,...o),fs([t],Xg),_D(this,a,t),Wt(this,"labels",a,i),Wt(this,"annotations",a,...s)}animateReadyResize(e){const{contextData:t,paths:i}=e;this.updateLinePaths(i,t),super.animateReadyResize(e)}animateWaitingUpdateReady(e){const{animationManager:t}=this.ctx,{datumSelection:i,labelSelection:s,annotationSelections:n,contextData:o,paths:a,previousContextData:r}=e,[l]=a;if(o.visible===!1&&r?.visible===!1)return;this.resetDatumAnimation(e),this.resetLabelAnimation(e);const c=()=>{this.resetPathAnimation(e),this.updateLinePaths(a,o)},h=()=>{t.skipCurrentBatch(),c()};if(o==null||r==null){c(),Zg(this,t,"added",i),Ix(this,"path_properties",t,"add",l),Wt(this,"labels",t,s),Wt(this,"annotations",t,...n);return}if(o.crossFiltering!==r.crossFiltering){h();return}const d=yO(o,r,this.processedData?.reduced?.diff?.[this.id]);if(d===void 0){h();return}else if(d.status==="no-op")return;hi(this.id,"path_properties",t,[l],d.stroke.pathProperties),d.status==="added"?this.updateLinePaths(a,o):d.status==="removed"?this.updateLinePaths(a,r):fx(this.id,"path_update",t,[l],d.stroke.path),d.hasMotion&&(Zg(this,t,void 0,i),Wt(this,"labels",t,s),Wt(this,"annotations",t,...n)),this.ctx.animationManager.animate({id:this.id,groupId:"reset_after_animation",phase:"trailing",from:{},to:{},onComplete:()=>this.updateLinePaths(a,o)})}isLabelEnabled(){return this.properties.label.enabled}getBandScalePadding(){return{inner:1,outer:.1}}nodeFactory(){return new wi}getStyle(e,t){const{styler:i,marker:s,lineDash:n,lineDashOffset:o,stroke:a,strokeOpacity:r,strokeWidth:l}=this.properties,{size:c,shape:h,fill:d="transparent",fillOpacity:u}=s;let p={};if(i){const g=this.makeStylerParams(e,t),f=this.cachedCallWithContext(i,g)??{};p=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],f,{pick:!1})??{}}return p.marker??(p.marker={}),{lineDash:p.lineDash??n,lineDashOffset:p.lineDashOffset??o,stroke:p.stroke??a,strokeOpacity:p.strokeOpacity??r,strokeWidth:p.strokeWidth??l,marker:{fill:p.marker.fill??d,fillOpacity:p.marker.fillOpacity??u,shape:p.marker.shape??h,size:p.marker.size??c,lineDash:p.marker.lineDash??s.lineDash??n,lineDashOffset:p.marker.lineDashOffset??s.lineDashOffset??o,stroke:p.marker.stroke??s.stroke??a,strokeOpacity:p.marker.strokeOpacity??s.strokeOpacity??r,strokeWidth:p.marker.strokeWidth??s.strokeWidth??l}}}getFormattedMarkerStyle(e){const t=this.getStyle(!1),i=this.makeItemStylerParams(this.dataModel,this.processedData,e.datumIndex,t.marker);return this.getMarkerStyle(this.properties.marker,e,i,{isHighlight:!0},void 0,t)}computeFocusBounds(e){return Dx(this,e)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};nf.className="LineSeries",nf.type="line";var _O={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"line",moduleFactory:e=>new nf(e),stackable:!0,predictAxis:qg,defaultAxes:[{type:"number",position:"left"},{type:"category",position:"bottom"}],themeTemplate:{series:{stroke:Fm,strokeWidth:2,strokeOpacity:1,lineDash:[0],lineDashOffset:0,interpolation:{type:"linear"},marker:{shape:"circle",size:7,strokeWidth:{$isUserOption:["./stroke",1,0]},fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",Sg],["image",Ir],["pattern",zn]]},stroke:{$palette:"stroke"}},label:{...Ra,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},errorBar:{cap:{lengthRatio:1}},tooltip:{range:{$path:["/tooltip/range","nearest"]},position:{anchorTo:{$path:["/tooltip/position/anchorTo","node"]}}},highlight:Sl(),segmentation:_m}}},VO={type:"series",name:"line",chartType:"cartesian",options:ax,create:e=>new nf(e)},Rx=class extends sf{};Rx.className="ScatterSeries",Rx.type="scatter";var PY={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"scatter",moduleFactory:e=>new Rx(e),predictAxis:HD,defaultAxes:[{type:"number",position:"bottom"},{type:"number",position:"left"}],themeTemplate:{series:{shape:"circle",size:7,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",Sg],["image",Ir],["pattern",zn]]},stroke:{$palette:"stroke"},fillOpacity:.8,maxRenderedItems:1e4,label:{...Ra,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},errorBar:{cap:{lengthRatio:1}},tooltip:{range:{$path:["/tooltip/range","nearest"]},position:{anchorTo:{$path:["/tooltip/position/anchorTo","node"]}}},highlight:Sl()}}},GO={type:"series",name:"scatter",chartType:"cartesian",options:hK,create:e=>new Rx(e)},jO=class CC{constructor(t,i,s,n){this.startAngle=t,this.endAngle=i,this.innerRadius=s,this.outerRadius=n}clone(){const{startAngle:t,endAngle:i,innerRadius:s,outerRadius:n}=this;return new CC(t,i,s,n)}equals(t){return this.startAngle===t.startAngle&&this.endAngle===t.endAngle&&this.innerRadius===t.innerRadius&&this.outerRadius===t.outerRadius}[Cy](t,i){return new CC(this.startAngle*(1-i)+t.startAngle*i,this.endAngle*(1-i)+t.endAngle*i,this.innerRadius*(1-i)+t.innerRadius*i,this.outerRadius*(1-i)+t.outerRadius*i)}};function HO({startAngle:e,endAngle:t,innerRadius:i,outerRadius:s}){let n=1/0,o=1/0,a=-1/0,r=-1/0;const l=(c,h)=>{n=Math.min(c,n),o=Math.min(h,o),a=Math.max(c,a),r=Math.max(h,r)};return l(i*Math.cos(e),i*Math.sin(e)),l(i*Math.cos(t),i*Math.sin(t)),l(s*Math.cos(e),s*Math.sin(e)),l(s*Math.cos(t),s*Math.sin(t)),Cc(0,e,t)&&l(s,0),Cc(Math.PI*.5,e,t)&&l(0,s),Cc(Math.PI,e,t)&&l(-s,0),Cc(Math.PI*1.5,e,t)&&l(0,-s),new de(n,o,a-n,r-o)}function QD(e,t,i){const s=Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),{innerRadius:n,outerRadius:o}=i;if(i.startAngle===i.endAngle||sMath.max(n,o))return!1;const a=Py(i.startAngle),r=Py(i.endAngle),l=Math.atan2(t,e);return a=a:l<=r&&l>=-Math.PI||l>=a&&l<=Math.PI}function RY(e,t,i,s,n,o,a,r,l,c){if(Number.isNaN(e)||Number.isNaN(t))return 0;o&&([n,s]=[s,n]);const h=(c-r)/(l-a),d=r-h*a,u=Math.pow(h,2)+1,p=2*(h*(d-t)-e),g=Math.pow(e,2)+Math.pow(d-t,2)-Math.pow(i,2),f=Math.pow(p,2)-4*u*g;if(f<0)return 0;const x=(-p+Math.sqrt(f))/2/u,m=(-p-Math.sqrt(f))/2/u;let v=0;for(const b of[x,m]){if(!(b>=Math.min(a,l)&&b<=Math.max(a,l)))continue;const D=h*b+d,L=b-e,I=D-t,A=Math.atan2(I,L);Cc(A,s,n)&&v++}return v}function WO(e,t){const{startAngle:i,endAngle:s,innerRadius:n,outerRadius:o}=t,a={x:o*Math.cos(i),y:o*Math.sin(i)},r={x:o*Math.cos(s),y:o*Math.sin(s)},l=n===0?{x:0,y:0}:{x:n*Math.cos(i),y:n*Math.sin(i)},c=n===0?{x:0,y:0}:{x:n*Math.cos(s),y:n*Math.sin(s)};return Ip(e.start.x,e.start.y,e.end.x,e.end.y,a.x,a.y,l.x,l.y)||Ip(e.start.x,e.start.y,e.end.x,e.end.y,r.x,r.y,c.x,c.y)||RY(0,0,o,i,s,!0,e.start.x,e.start.y,e.end.x,e.end.y)}function zY(e,t){const i={x:e.x,y:e.y},s={x:e.x+e.width,y:e.y},n={x:e.x,y:e.y+e.height},o={x:e.x+e.width,y:e.y+e.height};return WO({start:i,end:s},t)||WO({start:n,end:o},t)}function $O(e,t,i,s){if(i===0&&s===0)return 0;if(Math.asin(Math.abs(1*i)/(e+1*i))+Math.asin(Math.abs(1*s)/(e+1*s))-t<0)return 1;let o=0,a=1;for(let r=0;r<8;r+=1){const l=(o+a)/2;Math.asin(Math.abs(l*i)/(e+l*i))+Math.asin(Math.abs(l*s)/(e+l*s))-t<0?o=l:a=l}return o}var FY=1e-6;function Fl(e,t){return Ry(e,t)=2*Math.PI?2*Math.PI:Gi(t-e);return e=Fl(e,i),t=e+n,{startAngle:e,endAngle:t}}function Fx(e,t,i,s,n,o){const a=Math.sin(o),r=Math.cos(o),l=e**2+t**2-i**2;let c,h,d,u;if(r>.5){const b=a/r,S=1+b**2,D=-2*(e+t*b),L=D**2-4*S*l;if(L<0)return;const I=(-D+Math.sqrt(L))/(2*S),A=(-D-Math.sqrt(L))/(2*S);c=I,h=I*b,d=A,u=A*b}else{const b=r/a,S=1+b**2,D=-2*(t+e*b),L=D**2-4*S*l;if(L<0)return;const I=(-D+Math.sqrt(L))/(2*S),A=(-D-Math.sqrt(L))/(2*S);c=I*b,h=I,d=A*b,u=A}const p=r,g=a,f=c*p+h*g,x=d*p+u*g,m=f>0?Fl(Math.atan2(h-t,c-e),s):Number.NaN,v=x>0?Fl(Math.atan2(u-t,d-e),s):Number.NaN;if(m>=s&&m<=n)return m;if(v>=s&&v<=n)return v}function Bx(e,t,i,s,n,o){const a=Math.hypot(e,t),r=(a**2-i**2+o**2)/(2*a),l=a-r,c=Math.atan2(t,e),h=Math.acos(-l/i),d=Fl(c+h,s),u=Fl(c-h,s);if(d>=s&&d<=n)return d;if(u>=s&&u<=n)return u}var JD=class{constructor(e,t,i,s,n){this.cx=e,this.cy=t,this.r=i,this.a0=s,this.a1=n,this.a0>=this.a1&&(this.a0=Number.NaN,this.a1=Number.NaN)}isValid(){return Number.isFinite(this.a0)&&Number.isFinite(this.a1)}pointAt(e){return{x:this.cx+this.r*Math.cos(e),y:this.cy+this.r*Math.sin(e)}}clipStart(e){e==null||!this.isValid()||e=this.a1)&&(this.a0=Number.NaN,this.a1=Number.NaN))}clipEnd(e){e==null||!this.isValid()||e>this.a1||(this.a1=e,(Number.isNaN(e)||this.a0>=this.a1)&&(this.a0=Number.NaN,this.a1=Number.NaN))}},Ms=class extends Hi{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.innerRadius=10,this.outerRadius=20,this.startAngle=0,this.endAngle=Math.PI*2,this.clipSector=void 0,this.concentricEdgeInset=0,this.radialEdgeInset=0,this.startOuterCornerRadius=0,this.endOuterCornerRadius=0,this.startInnerCornerRadius=0,this.endInnerCornerRadius=0}set inset(e){this.concentricEdgeInset=e,this.radialEdgeInset=e}set cornerRadius(e){this.startOuterCornerRadius=e,this.endOuterCornerRadius=e,this.startInnerCornerRadius=e,this.endInnerCornerRadius=e}computeBBox(){return HO(this).translate(this.centerX,this.centerY)}normalizedRadii(){const{concentricEdgeInset:e}=this;let{innerRadius:t,outerRadius:i}=this;return t=t>0?t+e:0,i=Math.max(i-e,0),{innerRadius:t,outerRadius:i}}normalizedClipSector(){const{clipSector:e}=this;if(e==null)return;const{startAngle:t,endAngle:i}=zx(this.startAngle,this.endAngle),{innerRadius:s,outerRadius:n}=this.normalizedRadii(),o=zx(e.startAngle,e.endAngle,t);return new jO(Math.max(t,o.startAngle),Math.min(i,o.endAngle),Math.max(s,e.innerRadius),Math.min(n,e.outerRadius))}getAngleOffset(e){return e>0?this.radialEdgeInset/e:0}arc(e,t,i,s,n,o,a,r){if(e<=0)return;const{startAngle:l,endAngle:c}=zx(this.startAngle,this.endAngle),{innerRadius:h,outerRadius:d}=this.normalizedRadii(),u=this.normalizedClipSector();if(r&&h<=0)return;const p=r?this.getAngleOffset(h+e):this.getAngleOffset(d-e),g=a?l+p+t:c-p-t,f=r?h+e:d-e,x=f*Math.cos(g),m=f*Math.sin(g);if(u!=null&&(!a&&!(g>=l-1e-6&&g<=u.endAngle-1e-6)||a&&!(g>=u.startAngle+1e-6&&g<=c-1e-6)||r&&fu.outerRadius+1e-6))return;const v=new JD(x,m,e,i,s);if(u!=null){r?(v.clipStart(Fx(x,m,e,i,s,u.endAngle)),v.clipEnd(Fx(x,m,e,i,s,u.startAngle))):(v.clipStart(Fx(x,m,e,i,s,u.startAngle)),v.clipEnd(Fx(x,m,e,i,s,u.endAngle)));let I,A;if(a?(I=Bx(x,m,e,i,s,u.innerRadius),A=Bx(x,m,e,i,s,u.outerRadius)):(I=Bx(x,m,e,i,s,u.outerRadius),A=Bx(x,m,e,i,s,u.innerRadius)),v.clipStart(I),v.clipEnd(A),I!=null){const{x:T,y:w}=v.pointAt(I),N=Fl(Math.atan2(w,T),l);a?o?.clipStart(N):n.clipEnd(N)}if(A!=null){const{x:T,y:w}=v.pointAt(A),N=Fl(Math.atan2(w,T),l);a?n.clipStart(N):o?.clipEnd(N)}}if(u!=null){const{x:I,y:A}=v.pointAt((v.a0+v.a1)/2);if(!QD(I,A,u))return}const{x:b,y:S}=v.pointAt(a===r?v.a0:v.a1),D=Fl(Math.atan2(S,b),l),L=r?o:n;return a?L?.clipStart(D):L?.clipEnd(D),v}updatePath(){const{path:t,centerX:i,centerY:s,concentricEdgeInset:n,radialEdgeInset:o}=this;let{startOuterCornerRadius:a,endOuterCornerRadius:r,startInnerCornerRadius:l,endInnerCornerRadius:c}=this;const{startAngle:h,endAngle:d}=zx(this.startAngle,this.endAngle),{innerRadius:u,outerRadius:p}=this.normalizedRadii(),g=this.normalizedClipSector(),f=d-h,x=f>=2*Math.PI-1e-6;if(t.clear(),u===0&&p===0||u>p)return;if((g?.startAngle??h)===(g?.endAngle??d))return;if(x&&this.clipSector==null&&a===0&&r===0&&l===0&&c===0){t.moveTo(i+p*Math.cos(h),s+p*Math.sin(h)),t.arc(i,s,p,h,d),u>n&&(t.moveTo(i+u*Math.cos(d),s+u*Math.sin(d)),t.arc(i,s,u,d,h,!0)),t.closePath();return}else if(this.clipSector==null&&Math.abs(u-p)<1e-6){t.arc(i,s,p,h,d,!1),t.arc(i,s,p,d,h,!0),t.closePath();return}const m=this.getAngleOffset(u),v=this.getAngleOffset(p);if(f<2*v)return;const S=(g?.innerRadius??u)>n,D=u0?Math.min(L/I,1):1;a*=A,r*=A,l*=A,c*=A;const T=$O(p,f-2*v,-a,-r);if(a*=T,r*=T,!D&&S){const q=$O(u,f-2*m,l,c);l*=q,c*=q}else l=0,c=0;const w=Math.max(a+l,r+c),N=w>0?Math.min(L/w,1):1;a*=N,r*=N,l*=N,c*=N;let O=0,P=0;const F=a/(p-a),_=r/(p-r);if(F>=0&&F<1-1e-6)O=Math.asin(F);else{O=f/2;const q=p/(1/Math.sin(O)+1);a=Math.min(q,a)}if(_>=0&&_<1-1e-6)P=Math.asin(_);else{P=f/2;const q=p/(1/Math.sin(P)+1);r=Math.min(q,r)}const z=Math.asin(l/(u+l)),B=Math.asin(c/(u+c)),R=g?.outerRadius??p,V=this.getAngleOffset(R),j=new JD(0,0,R,h+V,d-V),$=g?.innerRadius??u,W=this.getAngleOffset($),Y=S?new JD(0,0,$,h+W,d-W):void 0;g!=null&&(j.clipStart(g.startAngle),j.clipEnd(g.endAngle),Y?.clipStart(g.startAngle),Y?.clipEnd(g.endAngle));const se=this.arc(a,O,h-Math.PI*.5,h+O,j,Y,!0,!1),X=this.arc(r,P,d-P,d+Math.PI*.5,j,Y,!1,!1),Q=this.arc(c,B,d+Math.PI*.5,d+Math.PI-B,j,Y,!1,!0),ie=this.arc(l,z,h+Math.PI+z,h+Math.PI*1.5,j,Y,!0,!0);if(D){const q=f0&&qe.equals(t)})],Ms.prototype,"clipSector",2),M([ne()],Ms.prototype,"concentricEdgeInset",2),M([ne()],Ms.prototype,"radialEdgeInset",2),M([ne()],Ms.prototype,"startOuterCornerRadius",2),M([ne()],Ms.prototype,"endOuterCornerRadius",2),M([ne()],Ms.prototype,"startInnerCornerRadius",2),M([ne()],Ms.prototype,"endInnerCornerRadius",2);var UO=class extends wt{constructor(){super(...arguments),this.showInLegend=!1}};M([C],UO.prototype,"showInLegend",2);var ek=class extends Bt{constructor(){super(...arguments),this.spacing=2}set(e,t){return super.set(e)}};M([C],ek.prototype,"text",2),M([C],ek.prototype,"spacing",2);var tk=class extends Le{constructor(){super(...arguments),this.fill="transparent",this.fillOpacity=1}};M([C],tk.prototype,"fill",2),M([C],tk.prototype,"fillOpacity",2);var mu=class extends Bt{constructor(){super(...arguments),this.offset=3,this.minAngle=0,this.minSpacing=4,this.maxCollisionOffset=50,this.avoidCollisions=!0}};M([C],mu.prototype,"offset",2),M([C],mu.prototype,"minAngle",2),M([C],mu.prototype,"minSpacing",2),M([C],mu.prototype,"maxCollisionOffset",2),M([C],mu.prototype,"avoidCollisions",2);var ik=class extends Bt{constructor(){super(...arguments),this.positionOffset=0,this.positionRatio=.5}};M([C],ik.prototype,"positionOffset",2),M([C],ik.prototype,"positionRatio",2);var of=class extends Le{constructor(){super(...arguments),this.length=10,this.strokeWidth=1}};M([C],of.prototype,"colors",2),M([C],of.prototype,"length",2),M([C],of.prototype,"strokeWidth",2),M([C],of.prototype,"itemStyler",2);var je=class extends ro{constructor(){super(...arguments),this.defaultColorRange=[],this.defaultPatternFills=[],this.fills=Object.values(di),this.strokes=Object.values(kr),this.fillOpacity=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.outerRadiusOffset=0,this.outerRadiusRatio=1,this.strokeWidth=1,this.sectorSpacing=0,this.hideZeroValueSectorsInLegend=!1,this.innerLabels=new ud(ek),this.title=new UO,this.innerCircle=new tk,this.shadow=new _a,this.calloutLabel=new mu,this.sectorLabel=new ik,this.calloutLine=new of,this.tooltip=fh()}};M([C],je.prototype,"angleKey",2),M([C],je.prototype,"angleName",2),M([C],je.prototype,"angleFilterKey",2),M([C],je.prototype,"radiusKey",2),M([C],je.prototype,"radiusName",2),M([C],je.prototype,"radiusMin",2),M([C],je.prototype,"radiusMax",2),M([C],je.prototype,"calloutLabelKey",2),M([C],je.prototype,"calloutLabelName",2),M([C],je.prototype,"sectorLabelKey",2),M([C],je.prototype,"sectorLabelName",2),M([C],je.prototype,"legendItemKey",2),M([C],je.prototype,"defaultColorRange",2),M([C],je.prototype,"defaultPatternFills",2),M([C],je.prototype,"fills",2),M([C],je.prototype,"strokes",2),M([C],je.prototype,"fillOpacity",2),M([C],je.prototype,"strokeOpacity",2),M([C],je.prototype,"lineDash",2),M([C],je.prototype,"lineDashOffset",2),M([C],je.prototype,"cornerRadius",2),M([C],je.prototype,"itemStyler",2),M([C],je.prototype,"rotation",2),M([C],je.prototype,"outerRadiusOffset",2),M([C],je.prototype,"outerRadiusRatio",2),M([C],je.prototype,"innerRadiusOffset",2),M([C],je.prototype,"innerRadiusRatio",2),M([C],je.prototype,"strokeWidth",2),M([C],je.prototype,"sectorSpacing",2),M([C],je.prototype,"hideZeroValueSectorsInLegend",2),M([C],je.prototype,"innerLabels",2),M([C],je.prototype,"title",2),M([C],je.prototype,"innerCircle",2),M([C],je.prototype,"shadow",2),M([C],je.prototype,"calloutLabel",2),M([C],je.prototype,"sectorLabel",2),M([C],je.prototype,"calloutLine",2),M([C],je.prototype,"tooltip",2);function _x(e,t,i,s){const n=[i.convert(0),i.convert(1)],o=[s.convert(0),s.convert(1)],a=Math.PI/-2+ds(t),r=e?"initial":"update",l=({radius:g})=>({innerRadius:n[0],outerRadius:n[0]+(n[1]-n[0])*g}),c=({radius:g})=>({innerRadius:o[0],outerRadius:o[0]+(o[1]-o[0])*g});return{nodes:{toFn:(g,f,x,{prevLive:m})=>{let{startAngle:v,endAngle:b,innerRadius:S,outerRadius:D}=f;const{stroke:L,fill:I}=f.sectorFormat;if(x==="removed"&&m?(v=m.datum?.endAngle,b=m.datum?.endAngle):x==="removed"&&!m&&(v=a,b=a),x==="removed"){const A=l(f);S=A.innerRadius,D=A.outerRadius}return{startAngle:v,endAngle:b,outerRadius:D,innerRadius:S,stroke:L,fill:I}},fromFn:(g,f,x,{prevFromProps:m})=>{let{startAngle:v,endAngle:b,innerRadius:S,outerRadius:D}=g,{fill:L,stroke:I}=f.sectorFormat;if(x==="updated"&&g.previousDatum==null&&(x="added"),x==="unknown"||x==="added"&&!m?(v=a,b=a,S=f.innerRadius,D=f.outerRadius):x==="added"&&m&&(v=m.endAngle??a,b=m.endAngle??a,S=m.innerRadius??f.innerRadius,D=m.outerRadius??f.outerRadius),x==="added"&&!e){const A=c(f);S=A.innerRadius,D=A.outerRadius}return x==="updated"&&(L=g.fill??L,I=(typeof g.stroke=="string"?g.stroke:void 0)??I),{startAngle:v,endAngle:b,innerRadius:S,outerRadius:D,fill:L,stroke:I,phase:r}}},innerCircle:{fromFn:(g,f)=>({size:g.previousDatum?.radius??g.size??0,phase:r}),toFn:(g,f)=>({size:f.radius??0})}}}function KO(e,t){return{startAngle:t.startAngle,endAngle:t.endAngle,innerRadius:t.innerRadius,outerRadius:t.outerRadius,stroke:t.sectorFormat.stroke}}function YO(e,t){const i=t.y-e.centerY,s=t.x-e.centerX,n=Math.atan2(i,s),o=e.getItemNodes();for(const a of o)if(a.datum.missing!==!0&&Cc(n,a.startAngle,a.endAngle)){const r=Math.hypot(s,i);let l=0;return ra.outerRadius&&(l=r-a.outerRadius),{datum:a.datum,distance:l}}}var ZO=(e=>(e[e.BACKGROUND=0]="BACKGROUND",e[e.FOREGROUND=1]="FOREGROUND",e[e.HIGHLIGHT=2]="HIGHLIGHT",e[e.LABEL=3]="LABEL",e))(ZO||{}),XO={angle:["angleKey"],radius:["radiusKey"]},qO={angle:["angleName"],radius:["radiusName"]},sk=class extends ND{constructor({categoryKey:e,pickModes:t=[1,0],canHaveAxes:i=!1,animationResetFns:s,...n}){super({...n,categoryKey:e,pickModes:t,canHaveAxes:i}),this.directions=["angle","radius"],this.itemGroup=this.contentGroup.appendChild(new Be),this.nodeData=[],this.itemSelection=Bs.select(this.itemGroup,()=>this.nodeFactory(),!1),this.labelSelection=Bs.select(this.labelGroup,()=>this.labelFactory(),!1),this.highlightSelection=Bs.select(this.highlightGroup,()=>this.nodeFactory()),this.centerX=0,this.centerY=0,this.radius=0,this.animationResetFns=s,this.animationState=new $p("empty",{empty:{update:{target:"ready",action:o=>this.animateEmptyUpdateReady(o)},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",highlight:o=>this.animateReadyHighlight(o),highlightMarkers:o=>this.animateReadyHighlightMarkers(o),resize:o=>this.animateReadyResize(o),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:o=>this.animateWaitingUpdateReady(o)},reset:"empty",skip:"ready"},clearing:{update:{target:"empty",action:o=>this.animateClearingUpdateEmpty(o)},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}getItemNodes(){return[...this.itemGroup.children()]}getNodeData(){return this.nodeData}setZIndex(e){super.setZIndex(e),this.contentGroup.zIndex=[e,1],this.highlightGroup.zIndex=[e,2],this.labelGroup.zIndex=[e,3]}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}labelFactory(){const e=new Pn;return e.pointerEvents=1,e}addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",e=>this.onLegendItemClick(e)),this.ctx.eventsHub.on("legend:item-double-click",e=>this.onLegendItemDoubleClick(e)))}getInnerRadius(){return 0}computeLabelsBBox(e,t){return null}getShapeFillBBox(){const e=this.radius;return{series:new de(-e,-e,e*2,e*2),axis:new de(-e,-e,e*2,e*2)}}resetAllAnimation(){const{item:e,label:t}=this.animationResetFns??{};this.ctx.animationManager.stopByAnimationGroupId(this.id),e&&fs([this.itemSelection,this.highlightSelection],e),t&&fs([this.labelSelection],t),this.itemSelection.cleanup(),this.labelSelection.cleanup(),this.highlightSelection.cleanup()}animateEmptyUpdateReady(e){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation()}animateWaitingUpdateReady(e){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation()}animateReadyHighlight(e){const{item:t}=this.animationResetFns??{};t&&fs([this.highlightSelection],t)}animateReadyHighlightMarkers(e){}animateReadyResize(e){this.resetAllAnimation()}animateClearingUpdateEmpty(e){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation()}computeFocusBounds(e){const t=this.getNodeData()?.[e.datumIndex];if(t!==void 0)return this.itemSelection.select(i=>i instanceof Hi&&i.datum===t)[0]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}isSeriesHighlighted(e,t){const{series:i,legendItemName:s,itemId:n}=e??{},o=typeof n=="number"?t?.[n]:void 0;return i===this||o!=null&&o===s}},BY=class extends km{constructor(e,t,i,s){super(e,t,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey,this.calloutLabelKey=s.properties.calloutLabelKey,this.sectorLabelKey=s.properties.sectorLabelKey}},af=class extends sk{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{...XO,sectorLabel:["sectorLabelKey"],calloutLabel:["calloutLabelKey"]},propertyNames:{...qO,sectorLabel:["sectorLabelName"],calloutLabel:["calloutLabelName"]},pickModes:[1,0],animationResetFns:{item:KO,label:gh}}),this.properties=new je,this.phantomNodeData=void 0,this.backgroundGroup=new us({name:`${this.id}-background`,zIndex:0}),this.noVisibleData=!1,this.previousRadiusScale=new ih,this.radiusScale=new ih,this.phantomGroup=this.backgroundGroup.appendChild(new Be({name:"phantom"})),this.phantomSelection=Bs.select(this.phantomGroup,()=>this.nodeFactory(),!1),this.calloutLabelGroup=this.contentGroup.appendChild(new Be({name:"pieCalloutLabels"})),this.calloutLabelSelection=new Bs(this.calloutLabelGroup,Be),this.zerosumRingsGroup=this.backgroundGroup.appendChild(new Be({name:`${this.id}-zerosumRings`})),this.zerosumOuterRing=this.zerosumRingsGroup.appendChild(new wi({shape:"circle"})),this.zerosumInnerRing=this.zerosumRingsGroup.appendChild(new wi({shape:"circle"})),this.innerLabelsGroup=this.contentGroup.appendChild(new Be({name:"innerLabels"})),this.innerCircleGroup=this.backgroundGroup.appendChild(new Be({name:`${this.id}-innerCircle`})),this.innerLabelsSelection=Bs.select(this.innerLabelsGroup,Pn),this.innerCircleSelection=Bs.select(this.innerCircleGroup,()=>new wi({shape:"circle"})),this.surroundingRadius=void 0,this.NodeEvent=BY,this.angleScale=new ih,this.angleScale.domain=[0,1],this.angleScale.range=[-Math.PI,Math.PI].map(t=>t+Math.PI/2),this.phantomGroup.opacity=.2,this.innerLabelsGroup.pointerEvents=1}get calloutNodeData(){return this.phantomNodeData??this.nodeData}get hasData(){return this.getHasData("angleValue")}attachSeries(e,t,i){super.attachSeries(e,t,i),e?.appendChild(this.backgroundGroup)}detachSeries(e,t,i){super.detachSeries(e,t,i),this.backgroundGroup.remove()}setZIndex(e){super.setZIndex(e),this.backgroundGroup.zIndex=[0,e]}nodeFactory(){const e=new Ms;return e.miterLimit=1e9,e}getSeriesDomain(e){return e==="angle"?this.angleScale.domain:this.radiusScale.domain}async processData(e){if(this.data==null)return;const{visible:t,id:i,ctx:{legendManager:s}}=this,{angleKey:n,angleFilterKey:o,radiusKey:a,calloutLabelKey:r,sectorLabelKey:l,legendItemKey:c}=this.properties,h=()=>(x,m)=>t&&s.getItemEnabled({seriesId:i,itemId:m})?x:0,d=!this.ctx.animationManager.isSkipped(),u=[],p=[];c?u.push(Ll(c,"category",{id:"legendItemKey"})):r?u.push(Ll(r,"category",{id:"calloutLabelKey"})):l&&u.push(Ll(l,"category",{id:"sectorLabelKey"}));const g=this.radiusScale.type,f=this.angleScale.type;a&&p.push(c2(a,{id:"radiusValue",min:this.properties.radiusMin??0,max:this.properties.radiusMax,missingValue:this.properties.radiusMax??1,processor:h}),Dt(a,g,{id:"radiusRaw",processor:h}),tx("radiusValue",[0,1],1,this.properties.radiusMin??0,this.properties.radiusMax)),r&&p.push(Dt(r,"category",{id:"calloutLabelValue"})),l&&p.push(Dt(l,"category",{id:"sectorLabelValue"})),c&&p.push(Dt(c,"category",{id:"legendItemValue"})),o&&p.push(QM(o,f,{id:"angleFilterValue",onlyPositive:!0,invalidValue:0,processor:h}),Dt(o,f,{id:"angleFilterRaw"}),tx("angleFilterValue",[0,1],0,0)),d&&this.processedData?.reduced?.animationValidation?.uniqueKeys&&u.length>0&&p.push(sx(this.id,this.processedData)),p.push(Ng()),await this.requestDataModel(e,this.data,{props:[...u,QM(n,f,{id:"angleValue",onlyPositive:!0,invalidValue:0,processor:h}),Dt(n,f,{id:"angleRaw"}),tx("angleValue",[0,1],0,0),...p]});for(const x of this.processedData?.defs?.values??[]){const{id:m,missing:v,property:b}=x,S=Sw(this,v);m!=="angleRaw"&&S>0&&K.warnOnce(`no value was found for the key '${String(b)}' on ${S} data element${S>1?"s":""}`)}this.animationState.transition("updateData")}maybeRefreshNodeData(){if(!this.nodeDataRefresh)return;const{nodeData:e=[],phantomNodeData:t}=this.createNodeData()??{};this.nodeData=e,this.phantomNodeData=t,this.nodeDataRefresh=!1}getProcessedDataValues(e,t){const i=e.resolveColumnById(this,"angleValue",t),s=e.resolveColumnById(this,"angleRaw",t),n=this.properties.angleFilterKey==null?void 0:e.resolveColumnById(this,"angleFilterValue",t),o=this.properties.angleFilterKey==null?void 0:e.resolveColumnById(this,"angleFilterRaw",t),a=this.properties.radiusKey?e.resolveColumnById(this,"radiusValue",t):void 0,r=this.properties.radiusKey?e.resolveColumnById(this,"radiusRaw",t):void 0,l=this.properties.calloutLabelKey?e.resolveColumnById(this,"calloutLabelValue",t):void 0,c=this.properties.sectorLabelKey?e.resolveColumnById(this,"sectorLabelValue",t):void 0,h=this.properties.legendItemKey?e.resolveColumnById(this,"legendItemValue",t):void 0;return{angleValues:i,angleRawValues:s,angleFilterValues:n,angleFilterRawValues:o,radiusValues:a,radiusRawValues:r,calloutLabelValues:l,sectorLabelValues:c,legendItemValues:h}}createNodeData(){const{id:e,processedData:t,dataModel:i,angleScale:s,ctx:{legendManager:n},visible:o}=this,{rotation:a,innerRadiusRatio:r}=this.properties;if(!i||t?.type!=="ungrouped")return;const l=this.getProcessedDataValues(i,t),{angleValues:c,angleRawValues:h,angleFilterValues:d,angleFilterRawValues:u,radiusValues:p,radiusRawValues:g,legendItemValues:f}=l,x=u?.some((I,A)=>I>h[A])??!1;let m=0,v=0;const b=[],S=u==null?void 0:[],D=t.dataSources.get(this.id)?.data??[],L=t.invalidData?.get(this.id);for(const[I,A]of D.entries()){if(L?.[I]===!0)continue;const T=x?d[I]:c[I],w=u!=null&&!x?Math.sqrt(u[I]/h[I]):1,N=s.convert(m)+ds(a);m=T,v+=T;const O=s.convert(m)+ds(a),P=Math.abs(O-N),F=N+P/2,_=h[I],B=(p?.[I]??1)*w,R=g?.[I],V=f?.[I],j=this.getLabels(I,A,F,P,l),$=this.getItemStyle({datum:A,datumIndex:I},!1),W={itemId:I,series:this,datum:A,datumIndex:I,angleValue:_,midAngle:F,midCos:Math.cos(F),midSin:Math.sin(F),startAngle:N,endAngle:O,radius:B,innerRadius:Math.max(this.radiusScale.convert(0),0),outerRadius:Math.max(this.radiusScale.convert(B),0),sectorFormat:$,radiusValue:R,legendItemValue:V,enabled:o&&n.getItemEnabled({seriesId:e,itemId:I}),focusable:!0,...j};b.push(W),S?.push({...W,radius:1,innerRadius:Math.max(this.radiusScale.convert(0),0),outerRadius:Math.max(this.radiusScale.convert(1),0),focusable:!1})}return this.zerosumOuterRing.visible=v===0,this.zerosumInnerRing.visible=v===0&&r!=null&&r!==1&&r>0,{itemId:e,nodeData:b,labelData:b,phantomNodeData:S}}getLabelContent(e,t,i){const{id:s,ctx:n,properties:o}=this,{formatManager:a}=n,{calloutLabel:r,sectorLabel:l,calloutLabelKey:c,sectorLabelKey:h,legendItemKey:d}=o,u=i.calloutLabelValues?.[e],p=i.sectorLabelValues?.[e],g=i.legendItemValues?.[e],f={datum:t,angleKey:this.properties.angleKey,angleName:this.properties.angleName,radiusKey:this.properties.radiusKey,radiusName:this.properties.radiusName,calloutLabelKey:this.properties.calloutLabelKey,calloutLabelName:this.properties.calloutLabelName,sectorLabelKey:this.properties.sectorLabelKey,sectorLabelName:this.properties.sectorLabelName,legendItemKey:this.properties.legendItemKey},x={callout:void 0,sector:void 0,legendItem:void 0};return c&&(x.callout=this.getLabelText(u,t,c,"calloutLabel",[],r,{...f,value:u})),h&&(x.sector=this.getLabelText(p,t,h,"sectorLabel",[],l,{...f,value:p})),d!=null&&g!=null&&(x.legendItem=a.format(this.callWithContext.bind(this),{type:"category",value:g,datum:t,seriesId:s,legendItemName:void 0,key:d,source:"legend-label",property:"legendItem",domain:[],boundSeries:this.getFormatterContext("legendItem")})??g),x}getLabels(e,t,i,s,n){const{properties:o}=this,{calloutLabel:a,sectorLabel:r,legendItemKey:l}=o,c=this.getLabelContent(e,t,n),h={};return a.enabled&&c.callout&&s>=ds(a.minAngle)&&(h.calloutLabel={...this.getTextAlignment(i),text:c.callout,hidden:!1,collisionTextAlign:void 0,collisionOffsetY:0,box:void 0}),r.enabled&&c.sector&&(h.sectorLabel={text:c.sector}),l&&c.legendItem&&(h.legendItem={key:l,text:c.legendItem}),h}getTextAlignment(e){const t=[{textAlign:"center",textBaseline:"bottom"},{textAlign:"left",textBaseline:"middle"},{textAlign:"center",textBaseline:"top"},{textAlign:"right",textBaseline:"middle"}],i=Py(e),s=-.75*Math.PI,n=i-s,o=Math.floor(n/(Math.PI/2)),a=cG(o,t.length);return t[a]}getFillParams(e,t,i){if(!(!ao(e)||e.bounds==="item"))return{centerX:0,centerY:0,innerRadius:t,outerRadius:i}}getItemStyle({datum:e,datumIndex:t},i,s,n){const{fills:o,strokes:a,itemStyler:r}=this.properties,l=a[t],c=o[t],{fill:h,fillOpacity:d,stroke:u,strokeWidth:p,strokeOpacity:g,lineDash:f,lineDashOffset:x,cornerRadius:m,opacity:v}=st(this.getHighlightStyle(i,t,s,n),{fill:c,stroke:l},this.properties);let b;return r&&(b=this.cachedDatumCallback(this.getDatumId(t)+(i?"-highlight":"-hide"),()=>{const S=this.makeItemStylerParams(e,t,i,{fill:h,fillOpacity:d,stroke:u,strokeWidth:p,strokeOpacity:g,lineDash:f,lineDashOffset:x,cornerRadius:m});return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(r,S),{proxyPaths:{fill:["fills",`${t}`],stroke:["strokes",`${t}`]}})})),{fill:b?.fill??h,fillOpacity:b?.fillOpacity??d,stroke:b?.stroke??u,strokeWidth:b?.strokeWidth??p,strokeOpacity:b?.strokeOpacity??g,lineDash:b?.lineDash??f,lineDashOffset:b?.lineDashOffset??x,cornerRadius:b?.cornerRadius??m,opacity:v}}makeItemStylerParams(e,t,i,s){const{angleKey:n,radiusKey:o,calloutLabelKey:a,sectorLabelKey:r,legendItemKey:l}=this.properties,c=this.filterItemStylerFillParams(s.fill)??s.fill;return{datum:e,angleKey:n,radiusKey:o,calloutLabelKey:a,sectorLabelKey:r,legendItemKey:l,...s,fill:c,highlighted:i,highlightState:this.getHighlightStateString(this.ctx.highlightManager?.getActiveHighlight(),i,t),seriesId:this.id}}getCalloutLineStyle(e,t){const{properties:i}=this;let s={};if(i.calloutLine.itemStyler){const n=this.getHighlightStateString(this.ctx.highlightManager?.getActiveHighlight(),t,e.datumIndex),o={angleKey:i.angleKey,angleName:i.angleName??i.angleKey,calloutLabelKey:i.calloutLabelKey,calloutLabelName:i.calloutLabelName??i.calloutLabelKey,datum:e.datum,highlighted:t,highlightState:n,legendItemKey:i.legendItemKey,radiusKey:i.radiusKey,radiusName:i.radiusName??i.radiusKey,sectorLabelKey:i.sectorLabelKey,sectorLabelName:i.sectorLabelName??i.sectorLabelKey,seriesId:this.id};s=this.cachedCallWithContext(i.calloutLine.itemStyler,o)??{}}return{length:s.length??i.calloutLine.length,strokeWidth:s.strokeWidth??i.calloutLine.strokeWidth,color:s.color,colors:i.calloutLine.colors}}getInnerRadius(){const{radius:e}=this,{innerRadiusRatio:t=1,innerRadiusOffset:i=0}=this.properties,s=e*t+i;return s===e||s<0?0:s}getOuterRadius(){const{outerRadiusRatio:e,outerRadiusOffset:t}=this.properties;return Math.max(this.radius*e+t,0)}updateRadiusScale(e){const t=[this.getInnerRadius(),this.getOuterRadius()];this.radiusScale.range=t,e&&(this.previousRadiusScale.range=t);const i=s=>({...s,innerRadius:Math.max(this.radiusScale.convert(0),0),outerRadius:Math.max(this.radiusScale.convert(s.radius),0)});this.nodeData=this.nodeData.map(i),this.phantomNodeData=this.phantomNodeData?.map(i)}getTitleTranslationY(){const e=Math.max(0,this.radiusScale.range[1]);if(e===0)return Number.NaN;const i=2+(this.properties.title?.spacing??0),s=Math.max(0,-e);return-e-i-s}update({seriesRect:e}){const{title:t}=this.properties,i={seriesRectWidth:e?.width,seriesRectHeight:e?.height},s=wa(this.nodeDataDependencies,i)!=null;if(s&&(this._nodeDataDependencies=i),this.maybeRefreshNodeData(),this.updateTitleNodes(),this.updateRadiusScale(s),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.backgroundGroup.translationX=this.centerX,this.backgroundGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),t){const n=this.getTitleTranslationY();t.node.y=Number.isFinite(n)?n:0;const o=t.node.getBBox();t.node.visible=t.enabled&&Number.isFinite(n)&&!this.bboxIntersectsSurroundingSeries(o)}for(const n of[this.zerosumInnerRing,this.zerosumOuterRing])n.fillOpacity=0,n.stroke=this.properties.calloutLabel.color,n.strokeWidth=1,n.strokeOpacity=1;this.updateNodeMidPoint(),this.updateSelections(),this.updateNodes(e)}updateTitleNodes(){const{oldTitle:e}=this,{title:t}=this.properties;e!==t&&(e&&e.node.remove(),t&&(t.node.textBaseline="bottom",this.labelGroup?.appendChild(t.node)),this.oldTitle=t)}updateNodeMidPoint(){const e=t=>{const i=t.innerRadius+(t.outerRadius-t.innerRadius)/2;t.midPoint={x:t.midCos*Math.max(0,i),y:t.midSin*Math.max(0,i)}};for(const t of this.nodeData)e(t);if(this.phantomNodeData)for(const t of this.phantomNodeData)e(t)}updateSelections(){this.updateGroupSelection(),this.updateInnerCircleSelection()}updateGroupSelection(){const{itemSelection:e,highlightSelection:t,phantomSelection:i,calloutLabelSelection:s,labelSelection:n,innerLabelsSelection:o}=this,a=this.nodeData.map(l=>({...l,sectorFormat:{...l.sectorFormat}})),r=(l,c)=>{l.update(c,void 0,h=>this.getDatumId(h.datumIndex)),this.ctx.animationManager.isSkipped()&&l.cleanup()};r(e,this.nodeData),r(t,a),r(i,this.phantomNodeData??[]),s.update(this.calloutNodeData,l=>{const c=new Rn;c.tag=0,c.pointerEvents=1,l.appendChild(c);const h=new Pn;h.tag=1,h.pointerEvents=1,l.appendChild(h)}),n.update(this.nodeData),o.update(this.properties.innerLabels,l=>{l.pointerEvents=1})}updateInnerCircleSelection(){const{innerCircle:e}=this.properties;let t=0;const i=this.getInnerRadius();if(i>0){const n=Math.min(i,this.getOuterRadius()),o=1;t=Math.ceil(n*2+o)}const s=e?[{radius:t}]:[];this.innerCircleSelection.update(s)}updateNodes(e){const t=this.ctx.highlightManager.getActiveHighlight(),{visible:i,dataModel:s,processedData:n}=this;if(this.backgroundGroup.visible=i,this.contentGroup.visible=i,!s||!n)return;const{legendItemValues:o}=this.getProcessedDataValues(s,n),a=this.isSeriesHighlighted(t,o),r=this.ctx.chartService.highlight?.drawingMode??"overlay";this.highlightGroup.visible=i&&a,this.labelGroup.visible=i,this.innerCircleSelection.each((p,{radius:g})=>{p.setProperties({fill:this.properties.innerCircle?.fill,opacity:this.properties.innerCircle?.fillOpacity,size:g})});const l=this.radiusScale.range[0],c=this.radiusScale.range[1],h=this.getShapeFillBBox(),d=this.ctx.animationManager.isSkipped(),u=(p,g,f,x,m)=>{const v=this.getItemStyle(g,x,void 0,o);g.sectorFormat.fill=v.fill,g.sectorFormat.stroke=v.stroke,d&&(p.startAngle=g.startAngle,p.endAngle=g.endAngle,p.innerRadius=g.innerRadius,p.outerRadius=g.outerRadius),(x||d)&&(p.fill=v.fill,p.stroke=v.stroke);const b=this.getFillParams(v.fill,l,c);Dr(p,v,h,b),p.drawingMode=m,p.cornerRadius=v.cornerRadius,p.fillShadow=this.properties.shadow;const S=Math.max((this.properties.sectorSpacing+(v.stroke==null?0:v.strokeWidth))/2,0);p.inset=S,p.lineJoin=this.properties.sectorSpacing>=0||S>0?"miter":"round"};this.itemSelection.each((p,g,f)=>u(p,g,f,!1,"overlay")),this.phantomSelection.each((p,g,f)=>u(p,g,f,!1,"overlay")),this.highlightSelection.each((p,g,f)=>{u(p,g,f,!0,r),p.visible=g.itemId===t?.itemId}),this.updateCalloutLineNodes(),this.updateCalloutLabelNodes(e),this.updateSectorLabelNodes(),this.updateInnerLabelNodes(),this.updateZerosumRings(),this.animationState.transition("update")}updateCalloutLineNodes(){const{strokes:e}=this.properties,{offset:t}=this.properties.calloutLabel;for(const i of this.calloutLabelSelection.selectByTag(0)){const s=i.closestDatum(),{length:n,strokeWidth:o,color:a,colors:r}=this.getCalloutLineStyle(s,!1),l=o,c=$j(r)?r:e,{calloutLabel:h,outerRadius:d,datumIndex:u}=s;if(h?.text&&!h.hidden&&d!==0){i.visible=!0,i.strokeWidth=l,i.stroke=a??c[u%c.length],i.strokeOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1,i.fill=void 0;const p=s.midCos*d,g=s.midSin*d;let f=s.midCos*(d+n),x=s.midSin*(d+n);if((h.collisionTextAlign??h.collisionOffsetY!==0)&&h.box!=null){const v=h.box;let b=f,S=x;fv.x+v.width&&(b=v.x+v.width),xv.y+v.height&&(S=v.y+v.height);const D=b-f,L=S-x,I=Math.sqrt(Math.pow(D,2)+Math.pow(L,2)),A=I-t;A>0&&(f=f+D*A/I,x=x+L*A/I)}i.x1=p,i.y1=g,i.x2=f,i.y2=x}else i.visible=!1}}getLabelOverflow(e,t){const i=-this.centerX,s=i+t.width,n=-this.centerY,o=n+t.height,a=1;let r=e.width;e.x+as&&(r=(s-e.x)/e.width);const l=e.y+ao,c=this.bboxIntersectsSurroundingSeries(e);return{maxWidth:r,hasVerticalOverflow:l,hasSurroundingSeriesOverflow:c}}bboxIntersectsSurroundingSeries(e){const{surroundingRadius:t}=this;if(t==null)return!1;const i=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],s=t**2;return i.some(n=>n.x**2+n.y**2>s)}computeCalloutLabelCollisionOffsets(){const{radiusScale:e}=this,{calloutLabel:t}=this.properties,{offset:i,minSpacing:s}=t,n=e.convert(0),o=x=>!x.calloutLabel||x.outerRadius===0,a=this.calloutNodeData,r=a.filter(x=>!o(x));for(const x of r){const m=x.calloutLabel;m!=null&&(m.hidden=!1,m.collisionTextAlign=void 0,m.collisionOffsetY=0)}if(r.length<=1)return;const l=r.filter(x=>x.midCos<0).sort((x,m)=>x.midSin-m.midSin),c=r.filter(x=>x.midCos>=0).sort((x,m)=>x.midSin-m.midSin),h=r.filter(x=>x.midSin<0&&x.calloutLabel?.textAlign==="center").sort((x,m)=>x.midCos-m.midCos),d=r.filter(x=>x.midSin>=0&&x.calloutLabel?.textAlign==="center").sort((x,m)=>x.midCos-m.midCos),u=x=>{const m=x.calloutLabel;if(m==null)return de.zero.clone();const v=this.getLabelStyle(x,t),b=Od(v),S=this.getCalloutLineStyle(x,!1).length,D=x.outerRadius+S+i,L=x.midCos*D,I=x.midSin*D+m.collisionOffsetY,A=m.collisionTextAlign??m.textAlign,T=m.textBaseline;return Pn.measureBBox(m.text,L,I,{font:this.properties.calloutLabel,textAlign:A,textBaseline:T}).grow(b)},p=(x,m,v)=>{const b=u(x).grow(s/2),S=u(m).grow(s/2);b.xS.x&&(v==="to-top"?b.yS.y)&&(m.calloutLabel.collisionOffsetY=v==="to-top"?b.y-S.y-S.height:b.y+b.height-S.y)},g=x=>{const m=x.slice().sort((b,S)=>Math.abs(b.midSin)-Math.abs(S.midSin))[0],v=x.indexOf(m);for(let b=v-1;b>=0;b--){const S=x[b+1],D=x[b];p(S,D,"to-top")}for(let b=v+1;b{const m=r.some(I=>I.calloutLabel.collisionOffsetY!==0),v=x.map(I=>u(I)),b=v.map(I=>I.clone().grow(s/2));let S=!1;for(let I=0;I{const{startAngle:A,endAngle:T,outerRadius:w}=I;return{startAngle:A,endAngle:T,innerRadius:n,outerRadius:w}}),L=v.some(I=>D.some(A=>zY(I,A)));if(!(!S&&!m&&!L))for(const I of x){if(I.calloutLabel.textAlign!=="center")continue;const A=I.calloutLabel;I.midCos<0?A.collisionTextAlign="right":I.midCos>0?A.collisionTextAlign="left":A.collisionTextAlign="center"}};g(l),g(c),f(h),f(d)}getLabelStyle(e,t){const i=this.ctx.highlightManager?.getActiveHighlight(),s=!1;return ph(this,e,this.properties,t,s,i)}updateCalloutLabelNodes(e){const{radiusScale:t}=this,{calloutLabel:i}=this.properties,s=new Pn;for(const n of this.calloutLabelSelection.selectByTag(1)){const o=n.closestDatum(),a=o.calloutLabel,r=t.convert(o.radius),l=Math.max(0,r);if(!a?.text||l===0||a.hidden){n.visible=!1;continue}const c=this.getLabelStyle(o,i),h=this.getCalloutLineStyle(o,!1).length,d=l+h+i.offset,u=o.midCos*d,p=o.midSin*d+a.collisionOffsetY,g={textAlign:a.collisionTextAlign??a.textAlign,textBaseline:a.textBaseline};s.text=a.text,s.x=u,s.y=p,s.setFont(c),s.setAlign(g),s.setBoxing(c);const f=s.getBBox();let x=a.text,m=!0;if(i.avoidCollisions){const{maxWidth:v,hasVerticalOverflow:b}=this.getLabelOverflow(f,e);if(f.width>v){const S={font:this.properties.calloutLabel,textWrap:"on-space",overflow:"hide",maxWidth:v};x=Dy(a.text,S)}m=!b}n.text=x,n.x=u,n.y=p,n.setFont(c),n.setAlign(g),n.setBoxing(c),n.fill=c.color,n.fillOpacity=this.getHighlightStyle(!1,o.datumIndex).opacity??1,n.visible=m}}computeLabelsBBox(e,t){const{calloutLabel:i}=this.properties,{offset:s,maxCollisionOffset:n,minSpacing:o}=i;if(!i.avoidCollisions)return null;this.maybeRefreshNodeData(),this.updateRadiusScale(!1),this.computeCalloutLabelCollisionOffsets();const a=[],r=new Pn;let l;const{title:c}=this.properties;if(c?.text&&c.enabled){const h=this.getTitleTranslationY();Number.isFinite(h)&&(r.text=c.text,r.x=0,r.y=h,r.setFont(c),r.setAlign({textBaseline:"bottom",textAlign:"center"}),l=r.getBBox(),a.push(l))}for(const h of this.calloutNodeData){const d=h.calloutLabel;if(!d||h.outerRadius===0)continue;const u=this.getLabelStyle(h,i),p=this.getCalloutLineStyle(h,!1).length,g=h.outerRadius+p+s,f=h.midCos*g,x=h.midSin*g+d.collisionOffsetY;r.text=d.text,r.x=f,r.y=x,r.setFont(u),r.setAlign({textAlign:d.collisionTextAlign??d.textAlign,textBaseline:d.textBaseline}),r.setBoxing(u);const m=r.getBBox();if(d.box=m,Math.abs(d.collisionOffsetY)>n){d.hidden=!0;continue}if(l){const v=-this.centerY,b=new de(l.x-o,v,l.width+2*o,l.y+l.height+o-v);if(m.collidesBBox(b)){d.hidden=!0;continue}}if(e.hideWhenNecessary){const{maxWidth:v,hasVerticalOverflow:b,hasSurroundingSeriesOverflow:S}=this.getLabelOverflow(m,t),D=m.width>v;if(b||D||S){d.hidden=!0;continue}}d.hidden=!1,a.push(m)}return a.length===0?null:de.merge(a)}updateSectorLabelNodes(){const{properties:e}=this,{positionOffset:t,positionRatio:i}=this.properties.sectorLabel,s=this.radiusScale.convert(0),n=s<=0&&this.ctx.legendManager.getData(this.id)?.filter(r=>r.enabled).length===1,o={textAlign:"center",textBaseline:"middle"},a=(r,l)=>{const{outerRadius:c,startAngle:h,endAngle:d}=l;let u=!1;if(l.sectorLabel&&c!==0){const p=this.getLabelStyle(l,e.sectorLabel),g=s*(1-i)+c*i+t;r.fill=p.color,r.fillOpacity=this.getHighlightStyle(!1,l.datumIndex).opacity??1,r.text=l.sectorLabel.text,n?(r.x=0,r.y=0):(r.x=l.midCos*g,r.y=l.midSin*g),r.setFont(p),r.setAlign(o),r.setBoxing(p);const f=r.getBBox(),x=[[f.x,f.y],[f.x+f.width,f.y],[f.x+f.width,f.y+f.height],[f.x,f.y+f.height]],m={startAngle:h,endAngle:d,innerRadius:s,outerRadius:c};x.every(([v,b])=>QD(v,b,m))&&(u=!0)}r.visible=u};this.labelSelection.each(a)}updateInnerLabelNodes(){const e=[],t=[];this.innerLabelsSelection.each((h,d)=>{const{fontStyle:u,fontWeight:p,fontSize:g,fontFamily:f,color:x}=d;h.fontStyle=u,h.fontWeight=p,h.fontSize=g,h.fontFamily=f,h.text=d.text,h.x=0,h.y=0,h.fill=x,h.textAlign="center",e.push(h.getBBox()),t.push(d.spacing)});const i=h=>h===0?0:t[h],s=h=>h===t.length-1?0:t[h],n=e.reduce((h,d)=>Math.max(h,d.width),0),o=e.reduce((h,d,u)=>h+d.height+i(u)+s(u),0),a=this.getInnerRadius(),l=Math.sqrt(Math.pow(n/2,2)+Math.pow(o/2,2))<=(a>0?a:this.getOuterRadius()),c=[];for(let h=0,d=-o/2;h{h.visible=l,Array.isArray(h.text)?h.y=c[u]-e[u].height:h.y=c[u]})}updateZerosumRings(){this.zerosumOuterRing.size=this.getOuterRadius()*2,this.zerosumInnerRing.size=this.getInnerRadius()*2}pickNodeClosestDatum(e){return YO(this,e)}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:n,ctx:{formatManager:o}}=this,{legendItemKey:a,calloutLabelKey:r,calloutLabelName:l,sectorLabelKey:c,sectorLabelName:h,angleKey:d,angleName:u,radiusKey:p,radiusName:g,tooltip:f}=n,x=this.properties.title.node.getPlainText();if(!i||!s)return;const m=s.dataSources.get(this.id)?.data?.[e],v=this.getProcessedDataValues(i,s),{angleRawValues:b}=v,S=b[e],D=this.getLabelContent(e,m,v),L=D.legendItem??D.callout??D.sector??u,I=i.getDomain(this,"angleRaw","value",s),A=o.format(this.callWithContext.bind(this),{type:"number",value:S,datum:m,seriesId:t,legendItemName:void 0,key:d,source:"tooltip",property:"angle",domain:I,boundSeries:this.getFormatterContext("angle"),fractionDigits:void 0})??Dd(S,3);return this.formatTooltipWithContext(f,{title:x,symbol:this.legendItemSymbol(e),data:[{label:$e(L),fallbackLabel:d,value:A}]},{seriesId:t,datum:m,title:u,legendItemKey:a,calloutLabelKey:r,calloutLabelName:l,sectorLabelKey:c,sectorLabelName:h,angleKey:d,angleName:u,radiusKey:p,radiusName:g,...this.getItemStyle({datum:m,datumIndex:e},!1)})}legendItemSymbol(e){const t=this.processedData?.dataSources.get(this.id)?.data?.[e],i=this.getItemStyle({datum:t,datumIndex:e},!1),{fillOpacity:s,strokeOpacity:n,strokeWidth:o,lineDash:a,lineDashOffset:r}=this.properties;let{fill:l}=i;const{stroke:c}=i;return ao(l)&&(l={...l,gradient:"linear",rotation:0,reverse:!1}),{marker:{fill:l,stroke:c,fillOpacity:s,strokeOpacity:n,strokeWidth:o,lineDash:a,lineDashOffset:r}}}getLegendData(e){const{visible:t,processedData:i,dataModel:s,id:n,ctx:{legendManager:o}}=this;if(!s||!i||e!=="category")return[];const{angleKey:a,calloutLabelKey:r,sectorLabelKey:l,legendItemKey:c,showInLegend:h}=this.properties;if(!c&&(!r||r===a)&&(!l||l===a))return[];const d=this.getProcessedDataValues(s,i),{angleRawValues:u}=d,p=this.properties.title?.showInLegend&&this.properties.title.text,g=[],f=this.properties.hideZeroValueSectorsInLegend,x=i.dataSources.get(this.id)?.data,m=i.invalidData?.get(this.id);for(let v=0;v$e(I)).join(" - ")},symbol:this.legendItemSymbol(v),legendItemName:c==null?void 0:b[c],hideInLegend:!h})}return g}setLegendState(e){const{id:t,ctx:{legendManager:i,updateService:s}}=this;for(const[n,o]of e.entries())i.toggleItem(o,t,n);i.update(),s.update(5)}animateEmptyUpdateReady(e){const{animationManager:t}=this.ctx,i=_x(!0,this.properties.rotation,this.radiusScale,this.previousRadiusScale);hi(this.id,"nodes",t,[this.itemSelection,this.highlightSelection,this.phantomSelection],i.nodes,(s,n)=>this.getDatumId(n.datumIndex)),hi(this.id,"innerCircle",t,[this.innerCircleSelection],i.innerCircle),Wt(this,"callout",t,this.calloutLabelSelection),Wt(this,"sector",t,this.labelSelection),Wt(this,"inner",t,this.innerLabelsSelection),this.previousRadiusScale.range=this.radiusScale.range}animateWaitingUpdateReady(){const{itemSelection:e,highlightSelection:t,phantomSelection:i,processedData:s,radiusScale:n,previousRadiusScale:o}=this,{animationManager:a}=this.ctx,r=s?.reduced?.diff?.[this.id];this.ctx.animationManager.stopByAnimationGroupId(this.id);const l=(r?.moved.size??0)===0,c=(s?.defs.keys.length??0)>0,h=s?.reduced?.animationValidation?.uniqueKeys??!0;(!l||!c||!h)&&this.ctx.animationManager.skipCurrentBatch();const d=!this.nodeData.some(p=>p.enabled),u=_x(!1,this.properties.rotation,n,o);hi(this.id,"nodes",a,[e,t,i],u.nodes,(p,g)=>this.getDatumId(g.datumIndex),r),hi(this.id,"innerCircle",a,[this.innerCircleSelection],u.innerCircle),Wt(this,"callout",this.ctx.animationManager,this.calloutLabelSelection),Wt(this,"sector",this.ctx.animationManager,this.labelSelection),this.noVisibleData!==d&&(this.noVisibleData=d,Wt(this,"inner",this.ctx.animationManager,this.innerLabelsSelection)),this.previousRadiusScale.range=this.radiusScale.range}animateClearingUpdateEmpty(){const{itemSelection:e,highlightSelection:t,phantomSelection:i,radiusScale:s,previousRadiusScale:n}=this,{animationManager:o}=this.ctx,a=_x(!1,this.properties.rotation,s,n);hi(this.id,"nodes",o,[e,t,i],a.nodes,(r,l)=>this.getDatumId(l.datumIndex)),hi(this.id,"innerCircle",o,[this.innerCircleSelection],a.innerCircle),yx(this,"callout",this.ctx.animationManager,this.calloutLabelSelection),yx(this,"sector",this.ctx.animationManager,this.labelSelection),yx(this,"inner",this.ctx.animationManager,this.innerLabelsSelection),this.previousRadiusScale.range=this.radiusScale.range}getDatumId(e){const{dataModel:t,processedData:i}=this;if(!t||!i)return`${e}`;const{calloutLabelKey:s,sectorLabelKey:n,legendItemKey:o}=this.properties;if(!i.reduced?.animationValidation?.uniqueKeys)return`${e}`;if(o){const a=t.resolveKeysById(this,"legendItemKey",i);return Gs(a[e])}else if(s){const a=t.resolveKeysById(this,"calloutLabelKey",i);return Gs(a[e])}else if(n){const a=t.resolveKeysById(this,"sectorLabelKey",i);return Gs(a[e])}return`${e}`}hasItemStylers(){return!(this.properties.itemStyler==null&&this.properties.calloutLabel.itemStyler==null&&this.properties.sectorLabel.itemStyler==null&&this.properties.innerLabels.every(e=>e.itemStyler==null))}};af.className="DonutSeries",af.type="donut";var nk={series:{title:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:Ko.LARGE},fontFamily:{$ref:"fontFamily"},color:{$ref:"subtleTextColor"},spacing:5},calloutLabel:{...Ra,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},offset:3,minAngle:.001},sectorLabel:{...Ra,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"chartBackgroundColor"},positionOffset:0,positionRatio:.5},calloutLine:{length:10,strokeWidth:2,colors:{$map:[{$if:[{$or:[{$isGradient:{$value:"$1"}},{$isPattern:{$value:"$1"}},{$isImage:{$value:"$1"}}]},{$path:["../../strokes/$index",{$ref:"foregroundColor"}]},{$value:"$1"}]},{$if:[{$eq:[{$path:"../strokeWidth"},0]},{$path:"../fills"},{$path:"../strokes"}]}]}},fills:{$applyCycle:[{$cacheMax:{$size:{$path:["./data",{$path:"/data"}]}}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",GN],["pattern",zn],["image",Ir]]}]},strokes:{$applyCycle:[{$cacheMax:{$size:{$path:["./data",{$path:"/data"}]}}},{$palette:"strokes"}]},fillOpacity:1,strokeOpacity:1,strokeWidth:{$isUserOption:["./strokes/0",2,0]},lineDash:[0],lineDashOffset:0,rotation:0,sectorSpacing:1,shadow:{enabled:!1,color:Wc,xOffset:3,yOffset:3,blur:5},highlight:Sl()},legend:{enabled:!0}},_Y={...nk,series:{...nk.series,innerRadiusRatio:{$if:[{$eq:[{$path:["./innerRadiusOffset",void 0]},void 0]},.7,void 0]},innerLabels:{$apply:{...Ra,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:2}},highlight:HN()}},VY={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["polar"],identifier:"donut",moduleFactory:e=>new af(e),themeTemplate:_Y},GY={type:"series",name:"donut",chartType:"polar",options:dK,create:e=>new af(e)},Vx=class extends af{};Vx.className="PieSeries",Vx.type="pie";var jY={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["polar"],identifier:"pie",moduleFactory:e=>new Vx(e),themeTemplate:nk},HY={type:"series",name:"pie",chartType:"polar",options:nh,create:e=>new Vx(e)};function Gx(){Ta.register(P1,P3,E3,I3,hY,wO,CY,_O,PY,VY,jY,LY);for(const e of[_n,$d,wr,th,sh,Tl])zc.register(e.type,{moduleFactory:t=>new e(t)})}function WY(){for(const e of Ta.modules){if(e.packageType==="enterprise"&&!AW(e)&&K.errorOnce("Unexpected enterprise module registered: "+e.identifier),e.type==="root"&&e.themeTemplate)for(const t of e.chartTypes)J0.set(t,e.themeTemplate);if(e.type==="series"){if(e.chartTypes.length>1)throw new Error(`AG Charts - Module definition error: ${e.identifier}`);co.register(e.identifier,e)}if(e.type==="series-option"&&e.themeTemplate)for(const t of e.seriesTypes)co.setThemeTemplate(t,e.themeTemplate);if(e.type==="axis-option"&&e.themeTemplate)for(const t of e.axisTypes){const i=zc.getThemeTemplate(t),s=st(e.themeTemplate,i);zc.setThemeTemplate(t,s)}e.type==="axis"&&zc.register(e.identifier,e),e.type==="legend"&&Q0.register(e.identifier,e)}if(Ta.hasEnterpriseModules()){const e=CW();e.length>0&&K.errorOnce("Enterprise modules expected but not registered: ",e)}}var bn=Symbol("IGNORED_PROP");function bo(e,t){const i={};for(const s of Object.keys(t)){const n=t[s];n!==bn&&Object.hasOwn(e,s)&&(i[s]=n)}return i}function QO(e){const{enabled:t,mode:i,showArrow:s,range:n,position:o,pagination:a,delay:r,wrapping:l,interaction:c,renderer:h,...d}=e,u=bo(e,{enabled:t,showArrow:s,range:n,position:o,interaction:c,renderer:h,...d});return{chartTooltipOptions:bo(e,{enabled:bn,showArrow:bn,range:bn,position:bn,mode:i,pagination:a,delay:r,wrapping:l,...d}),seriesTooltipOptions:u}}function $Y(e){const{animation:t,background:i,container:s,contextMenu:n,context:o,footnote:a,height:r,listeners:l,locale:c,minHeight:h,minWidth:d,overrideDevicePixelRatio:u,padding:p,subtitle:g,theme:f,title:x,width:m,type:v,cursor:b,nodeClickRange:S,tooltip:D={},value:L,scale:I={},startAngle:A,endAngle:T,highlightStyle:w,highlight:N,segmentation:O,bar:P,needle:F,targets:_,outerRadius:z,innerRadius:B,outerRadiusRatio:R,innerRadiusRatio:V,cornerRadius:j,cornerMode:$,label:W,secondaryLabel:Y,spacing:se,...X}=e,{chartTooltipOptions:Q,seriesTooltipOptions:ie}=QO(D),q=bo(e,{animation:t,background:i,container:s,contextMenu:n,context:o,footnote:a,height:r,listeners:l,locale:c,minHeight:h,minWidth:d,overrideDevicePixelRatio:u,padding:p,subtitle:g,theme:f,title:x,tooltip:Q,width:m}),ee=bo(e,{needle:F==null?bn:{enabled:!0,...F},startAngle:A,endAngle:T,scale:I,type:v,cursor:b,context:o,nodeClickRange:S,tooltip:ie,value:L,highlightStyle:w,highlight:N,segmentation:O,bar:P,targets:_,outerRadius:z,innerRadius:B,outerRadiusRatio:R,innerRadiusRatio:V,cornerRadius:j,cornerMode:$,label:W,secondaryLabel:Y,spacing:se,...X});return{...q,series:[ee]}}function UY(e){const{animation:t,background:i,container:s,contextMenu:n,context:o,footnote:a,height:r,listeners:l,locale:c,minHeight:h,minWidth:d,overrideDevicePixelRatio:u,padding:p,subtitle:g,theme:f,title:x,width:m,type:v,cursor:b,nodeClickRange:S,tooltip:D={},value:L,scale:I={},direction:A="vertical",thickness:T,highlightStyle:w,highlight:N,segmentation:O,bar:P,targets:F,cornerRadius:_,cornerMode:z,label:B,...R}=e,{chartTooltipOptions:V,seriesTooltipOptions:j}=QO(D),$=bo(e,{animation:t,background:i,container:s,contextMenu:n,context:o,footnote:a,height:r,listeners:l,locale:c,minHeight:h,minWidth:d,overrideDevicePixelRatio:u,padding:p,subtitle:g,theme:f,title:x,tooltip:V,width:m}),W=bo(e,{scale:I,type:v,cursor:b,context:o,nodeClickRange:S,tooltip:j,value:L,direction:A,thickness:T,highlightStyle:w,highlight:N,segmentation:O,bar:P,targets:F,cornerRadius:_,cornerMode:z,label:B,...R});return{...$,series:[W]}}function JO(e,t){if(t==null)return e;const{targets:i,...s}=t;return e=st(e,s),e.targets!=null&&i!=null&&(e.targets=IL(e.targets,i)),e}function KY(e,t){switch(e.type){case"radial-gauge":return $Y(JO(e,t));case"linear-gauge":return UY(JO(e,t));default:return{}}}var vo={stroke:Gt},Ds={fill:hg},eE={color:"white",fill:Gt},Pr={color:Gt},mh={color:cg,fontSize:{$rem:Ko.LARGE},fontFamily:{$ref:"fontFamily"}},ok={...mh,fontSize:{$ref:"fontSize"},color:pg,fill:dg,stroke:ug,strokeWidth:1,divider:{stroke:gg,strokeWidth:1,strokeOpacity:.5}},ak={...vo,background:{fill:Ni,fillOpacity:.2},handle:{...Ds},text:{...Pr},statistics:{...ok}},YY={line:{...vo,handle:{...Ds},text:{...Pr}},"horizontal-line":{...vo,handle:{...Ds},axisLabel:{...eE},text:{...Pr}},"vertical-line":{...vo,handle:{...Ds},axisLabel:{...eE},text:{...Pr}},"disjoint-channel":{...vo,background:{fill:Ni,fillOpacity:.2},handle:{...Ds},text:{...Pr}},"parallel-channel":{...vo,background:{fill:Ni,fillOpacity:.2},handle:{...Ds},text:{...Pr}},"fibonacci-retracement":{...vo,strokes:lg,rangeStroke:Gt,handle:{...Ds},text:{...Pr,position:"center"},label:{...mh,color:void 0,fontSize:{$rem:Ko.SMALLER}}},"fibonacci-retracement-trend-based":{...vo,strokes:lg,rangeStroke:Gt,handle:{...Ds},text:{...Pr,position:"center"},label:{...mh,color:void 0,fontSize:{$rem:Ko.SMALLER}}},callout:{...vo,...mh,color:{$ref:"textColor"},handle:{...Ds},fill:Ni,fillOpacity:.2},comment:{...mh,color:"white",fontWeight:700,handle:{...Ds},fill:Gt},note:{...mh,color:bg,fill:Gt,stroke:{$ref:"chartBackgroundColor"},strokeWidth:1,strokeOpacity:1,handle:{...Ds},background:{fill:mg,stroke:xg,strokeWidth:1}},text:{...mh,handle:{...Ds}},arrow:{...vo,handle:{...Ds},text:{...Pr}},"arrow-up":{fill:{$palette:"up.fill"},handle:{...Ds,stroke:Gt}},"arrow-down":{fill:{$palette:"down.fill"},handle:{...Ds,stroke:Gt}},"date-range":{...ak},"price-range":{...ak},"date-price-range":{...ak},"quick-date-price-range":{up:{...vo,fill:Ni,fillOpacity:.2,handle:{...Ds},statistics:{...ok,color:"#fff",fill:Ni,strokeWidth:0,divider:{stroke:"#fff",strokeWidth:1,strokeOpacity:.5}}},down:{...vo,stroke:yg,fill:fg,fillOpacity:.2,handle:{...Ds,stroke:yg},statistics:{...ok,color:"#fff",fill:fg,strokeWidth:0,divider:{stroke:"#fff",strokeWidth:1,strokeOpacity:.5}}}},axesButtons:{enabled:!0}},ZY=["ohlc","line","step-line","hlc","high-low","candlestick","hollow-candlestick"],XY=[{icon:"trend-line-drawing",tooltip:"toolbarAnnotationsLineAnnotations",value:"line-menu"},{icon:"fibonacci-retracement-drawing",tooltip:"toolbarAnnotationsFibonacciAnnotations",value:"fibonacci-menu"},{icon:"text-annotation",tooltip:"toolbarAnnotationsTextAnnotations",value:"text-menu"},{icon:"arrow-drawing",tooltip:"toolbarAnnotationsShapeAnnotations",value:"shape-menu"},{icon:"measurer-drawing",tooltip:"toolbarAnnotationsMeasurerAnnotations",value:"measurer-menu"},{icon:"delete",tooltip:"toolbarAnnotationsClearAll",value:"clear"}];function qY(e,t,i){const{dateKey:s="date",highKey:n="high",openKey:o="open",lowKey:a="low",closeKey:r="close",volumeKey:l="volume",chartType:c="candlestick",navigator:h=!1,volume:d=!0,rangeButtons:u=!0,statusBar:p=!0,toolbar:g=!0,zoom:f=!0,sync:x=!1,theme:m,data:v,formatter:b,...S}=e,D=JY(c,s,n,a,o,r),L=QY(i,o,r,d,l),A={navigator:{enabled:h,...d?{miniChart:{enabled:h,series:[{type:"line",xKey:s,yKey:l,stroke:Fm,marker:{enabled:!1}}]},height:40,minHandle:{height:46},maxHandle:{height:46}}:null}},T={annotations:{enabled:g,optionsToolbar:{enabled:g},snap:!0,toolbar:{enabled:g,buttons:XY,padding:0},data:v,xKey:s,volumeKey:d?l:void 0}},w=p?{statusBar:{enabled:!0,data:v,highKey:n,openKey:o,lowKey:a,closeKey:r,volumeKey:d?l:void 0}}:null,N={zoom:{enabled:f,autoScaling:{enabled:!0},enableIndependentAxes:!0}},O={ranges:{enabled:u}},P=x?{sync:{enabled:x,nodeInteraction:!0,zoom:!0}}:null,F=d?[{type:"number",position:"left",keys:[l],label:{enabled:!1},crosshair:{enabled:!1},gridLine:{enabled:!1},nice:!1,layoutConstraints:{stacked:!1,width:20,unit:"percent",align:"end"}}]:[];return{theme:{baseTheme:typeof m=="string"?m:"ag-financial",...st(typeof m=="object"?m:null,{overrides:{common:{title:{padding:4},padding:{top:6,right:8,bottom:6},chartToolbar:{enabled:g},annotations:{...YY},axes:{number:{interval:{maxSpacing:45},label:{format:".2f"}}}},bar:{series:{fillOpacity:.5}},line:{series:{marker:{enabled:!1},...sE(c,{hlc:{stroke:{$palette:"altNeutral.stroke"},strokeWidth:2},line:{stroke:{$palette:"neutral.stroke"}},"step-line":{stroke:{$palette:"neutral.stroke"},interpolation:{type:"step"}}})}},candlestick:{series:{...sE(c,{"hollow-candlestick":{item:{up:{fill:"transparent"}}}})}},"range-area":{series:{fillOpacity:.3,strokeWidth:2}}}})},animation:{enabled:!1},legend:{enabled:!1},series:[...L,...D],axes:[{type:"number",position:"right",keys:[o,r,n,a],crosshair:{enabled:!0,snap:!1},layoutConstraints:{stacked:!1,width:100,unit:"percent",align:"start"}},...F,{type:"ordinal-time",position:"bottom",line:{enabled:!1},label:{enabled:!0},crosshair:{enabled:!0}}],tooltip:{enabled:!1},data:v,formatter:b,...T,...A,...w,...N,...O,...P,...S}}function QY(e,t,i,s,n){return s?[{type:"bar",xKey:"date",yKey:n,tooltip:{enabled:!1},itemStyler({datum:o}){const{up:a,down:r}=e().palette;return{fill:o[t]i!=null);if(typeof t=="number")return{data:e.map((s,n)=>({x:n,y:s})),series:[{xKey:"x",yKey:"y"}],datumKey:"y"};if(Array.isArray(t))return{data:e.map(s=>({x:s?.[0],y:s?.[1],datum:s})),series:[{xKey:"x",yKey:"y"}],datumKey:"datum"}}else if(e?.length===0)return{data:e,series:[{xKey:"x",yKey:"y"}],datumKey:"y"};return{data:e}}function r5(e){switch(e?.type){case"number":{const{type:t,min:i,max:s,reverse:n}=e;return bo(e,{type:t,reverse:n,min:i,max:s})}case"time":{const{type:t,min:i,max:s,reverse:n}=e;return bo(e,{type:t,reverse:n,min:i,max:s})}case"category":default:{const{paddingInner:t,paddingOuter:i,reverse:s}=e??{};return bo({...e,type:"category"},{type:"category",reverse:s,paddingInner:t,paddingOuter:i})}}}function l5(e,t,i){const s={};return e?.stroke!=null&&(s.style=[{stroke:e?.stroke}],s.enabled??(s.enabled=!0)),e?.strokeWidth!=null&&(s.width=e?.strokeWidth,s.enabled??(s.enabled=!0)),i.type==="bar"&&i.direction!=="horizontal"&&(s.enabled??(s.enabled=!0)),e?.visible!=null&&(s.enabled=e.visible),s.enabled??(s.enabled=t),s}var c5=gs((e,t,i)=>s=>{const n=s.datum[s.xKey],o=s.datum[s.yKey],a=i==null?s.datum:s.datum[i],r=t?.renderer?.({context:e,datum:a,xValue:n,yValue:o});if(typeof r=="string")return r;const l=r?.content??o.toFixed(2);return r?.title?{heading:void 0,title:void 0,data:[{label:r.title,value:l}]}:{heading:void 0,title:l,data:[]}});function h5(e){const{background:t,container:i,height:s,listeners:n,locale:o,minHeight:a,minWidth:r,overrideDevicePixelRatio:l,padding:c,width:h,theme:d,data:u,crosshair:p,axis:g,min:f,max:x,tooltip:m,context:v,styleNonce:b,...S}=e,D=bo(e,{background:t,container:i,height:s,listeners:n,locale:o,minHeight:a,minWidth:r,overrideDevicePixelRatio:l,padding:c,width:h,styleNonce:b,tooltip:bn,context:bn,data:bn,crosshair:bn,axis:bn,min:bn,max:bn,theme:bn}),{data:L,series:[I]=[],datumKey:A}=aE(u),T=S;I!=null&&Object.assign(T,I),T.tooltip={...m,renderer:c5(v,m,A)},D.theme=oE(d,o5),D.data=L,D.series=[T];const w=T.type!=="bar"||T.direction!=="horizontal",[N,O]=w?["bottom","left"]:["left","bottom"],P={...r5(g),position:N,...bo(e,{crosshair:p})},F={type:"number",gridLine:l5(g,!1,e),position:O,...bo(e,{min:f,max:x})};return D.axes=w?[F,P]:[P,F],D}var d5={chartType:J("candlestick","hollow-candlestick","ohlc","line","step-line","hlc","high-low"),dateKey:E,openKey:E,highKey:E,lowKey:E,closeKey:E,volumeKey:E,navigator:G,volume:G,rangeButtons:G,statusBar:G,toolbar:G,zoom:G,sync:G,theme:ke,container:ke,width:ke,height:ke,minWidth:ke,minHeight:ke,listeners:ke,initialState:ke,title:ke,data:Ho,formatter:ke},ck={theme:ke,container:ke,animation:ke,background:ke,contextMenu:ke,context:()=>!0,listeners:ke,locale:ke,width:ke,height:ke,minWidth:ke,minHeight:ke,title:ke,subtitle:ke,footnote:ke,padding:ke,tooltip:{...et,...Oe.tooltip}};ck.overrideDevicePixelRatio=me(H);var hk=["showInLegend","showInMiniChart","grouped","stacked","stackGroup","tooltip","listeners","errorBar","xKey","yKey","type"],dk={visible:G,reverse:G,stroke:ae,strokeWidth:H},Hx={context:()=>!0,tooltip:ke,theme:ke,background:ke,container:ke,width:ke,height:ke,minWidth:ke,minHeight:ke,padding:ke,listeners:ke,locale:ke,data:ke,styleNonce:E,axis:Sc({number:{...dk,min:tt(Z,to("max")),max:tt(Z,io("min"))},category:{...dk,paddingInner:ge,paddingOuter:ge},time:{...dk,min:tt(Ie(Z,Da),to("max")),max:tt(Ie(Z,Da),io("min"))}},"axis options","category"),min:tt(Z,to("max")),max:tt(Z,io("min")),crosshair:{enabled:G,snap:G,...te,...pe},xKey:E,yKey:E};Hx.overrideDevicePixelRatio=me(Z);var u5={type:"preset",name:"price-volume",enterprise:!0,options:d5,create:qY},p5={type:"preset",name:"gauge-preset",enterprise:!0,options:Sc({"linear-gauge":{...re(Il,["type"]),...ck},"radial-gauge":{...re(kg,["type"]),...ck}},"gauge options"),create:KY},g5={type:"preset",name:"sparkline",options:Sc({area:{...Hx,...re(L2,hk)},bar:{...Hx,...re(ox,hk)},line:{...Hx,...re(ax,hk)}},"sparkline options"),create:h5,processData:aE};function rE(e){const t=new Map;for(const i of e){if(!(i instanceof zl))continue;const n=(i.seriesGrouping?.stackCount??0)>0?i.seriesGrouping?.groupIndex:void 0;if(n==null){i.seriesBelowStackContext=void 0,i.createStackContext();continue}const o=`${i.type}-${n}`;let a=t.get(o);a==null&&(a=[],t.set(o,a)),a.push(i)}for(const i of t.values()){i.sort((n,o)=>(n.seriesGrouping?.stackIndex??0)-(o.seriesGrouping?.stackIndex??0));let s;for(const n of i)n.seriesBelowStackContext=s,s=n.createStackContext()}}var f5=["top","right","bottom","left"],rf=class FV extends Lm{constructor(t,i){super(t,i),this.paired=!0,this.axes=[],this.lastUpdateClipRect=void 0,this.lastLayoutWidth=Number.NaN,this.lastLayoutHeight=Number.NaN}onAxisChange(t,i){super.onAxisChange(t,i),this.syncAxisChanges(t,i),this.ctx!=null&&this.ctx.zoomManager.updateAxes(t)}destroySeries(t){super.destroySeries(t),this.lastLayoutWidth=Number.NaN,this.lastLayoutHeight=Number.NaN}getChartType(){return"cartesian"}setRootClipRects(t){const{seriesRoot:i,annotationRoot:s}=this;i.setClipRect(t),s.setClipRect(t)}async processData(){await super.processData(),this.syncStatus==="init"&&(this.syncStatus="domains-calculated"),this.ctx.updateService.dispatchProcessData({series:{shouldFlipXY:this.shouldFlipXY()}})}async processDomains(){await super.processDomains();for(const t of this.axes){const i=await this.getSyncedDomain(t);i!=null&&t.setDomains(i)}}performLayout(t){const{seriesRoot:i,annotationRoot:s}=this,{clipSeries:n,seriesRect:o,visible:a}=this.updateAxes(t.layoutBox);this.seriesRoot.visible=a,this.seriesRect=o,this.animationRect=t.layoutBox;const{x:r,y:l}=o;if(t.width!==this.lastLayoutWidth||t.height!==this.lastLayoutHeight)for(const p of[i,s])p.translationX=Math.floor(r),p.translationY=Math.floor(l);else{const{translationX:p,translationY:g}=i;vr(this.id,"seriesRect",this.ctx.animationManager,[i,s],{translationX:p,translationY:g},{translationX:Math.floor(r),translationY:Math.floor(l)},{phase:"update"})}this.lastLayoutWidth=t.width,this.lastLayoutHeight=t.height;const c=this.modulesManager.getModule("seriesArea"),h=o.clone().grow(c.getPadding()),d=c.clip||n?h:void 0,{lastUpdateClipRect:u}=this;this.lastUpdateClipRect=d,this.ctx.animationManager.isActive()&&u!=null?this.ctx.animationManager.animate({id:this.id,groupId:"clip-rect",phase:"update",from:u,to:h,onUpdate:p=>this.setRootClipRects(p),onComplete:()=>this.setRootClipRects(d)}):this.setRootClipRects(d),this.ctx.layoutManager.emitLayoutComplete(t,{axes:this.axes.map(p=>p.getLayoutState()),series:{visible:a,rect:o,paddedRect:h},clipSeries:n}),rE(this.series)}updateAxes(t){const{clipSeries:i,seriesRect:s,overflows:n}=this.resolveAxesLayout(t);for(const o of this.axes)o.update(),o.setCrossLinesVisible(!n),this.clipAxis(o,s,t);return{clipSeries:i,seriesRect:s,visible:!n}}resolveAxesLayout(t){let i,s,n=0;const o=10,a=this.axes.filter(r=>r.crossAt?.value!=null);do if(s=i??this.getDefaultState(),i=this.updateAxesPass(new Map(s.axisAreaWidths),t.clone(),a),n++>o){K.warn("Max iterations reached. Unable to stabilize axes layout.");break}while(!this.isLayoutStable(i,s));return this.lastAreaWidths=i.axisAreaWidths,i}updateAxesPass(t,i,s){const n=new Map,o={};let a=!1,r=!1;for(const b of f5){const S=this.modulesManager.getModule("seriesArea").getPadding()[b],D=this.axes.findLast(L=>L.position===b);D?D.seriesAreaPadding=S:i.shrink(S,b)}const l=(t.get("left")??0)+(t.get("right")??0),c=(t.get("top")??0)+(t.get("bottom")??0),h=this.buildCrossLinePadding(t),d=h.left+h.right,u=h.top+h.bottom;i.width<=l+d||i.height<=c+u?a=!0:i.shrink(h);const{scene:p}=this.ctx,g=i.clone().shrink(Object.fromEntries(t));for(const b of this.axes){const{position:S="left",direction:D}=b,L=D==="y";let I;this.sizeAxis(b,g,S),b.thickness==null?I=uk(L,p)*(b.maxThicknessRatio??1):I=b.thickness;const{primaryTickCount:A,bbox:T}=b.calculateLayout(b.nice?o[D]:void 0,{sizeLimit:I-b.label.spacing,padding:this.padding});o[D]??(o[D]=A),r||(r=b.dataDomain.clipped||b.visibleRange[0]>0||b.visibleRange[1]<1),b.thickness==null&&(I=Math.min(uk(L,T)??0,I)),n.set(b.id,Math.ceil(I))}let f;s.length>0&&(f=this.calculateAxesCrossPositions(n,g,s));const x=jS(this.axes,b=>b.position??"left"),m=new Map,v=new Map;for(const[b,S]of Tt(x)){let D=uk(b!=="left"&&b!=="right",p)%p.pixelRatio,L=0;for(const I of S??[]){v.set(I.id,D);const A=n.get(I.id)??0;L=Math.max(L,D+A),I.layoutConstraints.stacked&&(D+=A+FV.AxesPadding)}m.set(b,Math.ceil(L))}for(const[b,S]of Tt(x))this.positionAxes({axes:S??[],position:b,axisWidths:n,axisOffsets:v,axisAreaWidths:m,axisBound:i,seriesRect:g});return f!=null&&this.applyAxisCrossing(g,f),{clipSeries:r,seriesRect:g,axisAreaWidths:m,overflows:a}}calculateAxesCrossPositions(t,i,s){const n=new Map,o=this.axes.find(r=>r.direction==="x"),a=this.axes.find(r=>r.direction==="y");for(const r of s){const{crossPosition:l,visible:c}=this.calculateAxisCrossPosition(r,o,a);r.setAxisVisible(c),this.adjustAxisWidth(r,t,l,i,c),l!=null&&n.set(r.id,l)}return n}calculateAxisCrossPosition(t,i,s){const n=t.direction==="x"?s:i;if(!n)return{crossPosition:void 0,visible:!0};const{scale:{domain:o,bandwidth:a},range:r}=n,l=(a??0)/2,c=n.scale.convert(t.crossAt?.value,{clamp:!1})+l;return n.inRange(c)?{crossPosition:c,visible:!0}:t.crossAt?.sticky===!1?{crossPosition:void 0,visible:!1}:{crossPosition:Number.isNaN(c)?r[o[0]]:Ld(c,r),visible:!0}}adjustAxisWidth(t,i,s,n,o){const a=t.getModuleMap().getModule("crosshair")?.enabled===!0,r=this.modulesManager.getModule("annotations")?.enabled===!0,l=this.ctx.annotationManager.createMemento(),c=r||l.some(u=>{switch(u.type){case"vertical-line":return t.direction==="x";case"horizontal-line":return t.direction==="y";default:return!1}});if(a||c)return;const h=i.get(t.id)??0,d=o?this.calculateAxisBleedingWidth(t,h,s,n):0;i.set(t.id,d)}calculateAxisBleedingWidth(t,i,s,n){if(s==null)return i;switch(t.position){case"left":case"top":return Math.max(0,i-s);case"right":return Math.max(0,s+i-n.width);case"bottom":return Math.max(0,s+i-n.height);default:return i}}applyAxisCrossing(t,i){for(const s of this.axes){const n=i.get(s.id);if(n==null){s.crossAxisTranslation.x=0,s.crossAxisTranslation.y=0;continue}const o=s.direction==="x";s.crossAxisTranslation.x=o?0:t.x+n-s.translation.x,s.crossAxisTranslation.y=o?t.y+n-s.translation.y:0}}buildCrossLinePadding(t){var i;const s={top:0,right:0,bottom:0,left:0};for(const n of this.axes){const{position:o,label:a}=n;if(n.crossLines)for(const r of n.crossLines)r instanceof _s&&(r.position=o??"top",(i=r.label).parallel??(i.parallel=a.parallel)),r.calculatePadding?.(s)}for(const[n,o=0]of Tt(s))s[n]=Math.max(o-(t.get(n)??0),0);return s}clampToOutsideSeriesRect(t,i,s,n){const o=s==="x"?t.x:t.y,a=s==="x"?t.width:t.height;return n===1?Math.min(i,o+a):Math.max(i,o)}async getSyncedDomain(t){const i=this.modulesManager.getModule("sync");if(i?.enabled)return await i.getSyncedDomain(t)}syncAxisChanges(t,i){const s=this.modulesManager.getModule("sync");if(!s?.enabled)return;const n=new Set(i??[]);for(const o of t)n.delete(o);for(const o of n)s.removeAxis(o)}sizeAxis(t,i,s){const n=t instanceof _n,o=s==="left"||s==="right",{width:a,height:r}=i,l=o?r:a;let c=0,h=l,{min:d,max:u}=this.ctx.zoomManager.getAxisZoom(t.id);const{width:p,unit:g,align:f}=t.layoutConstraints;g==="px"?h=c+p:h=h*p/100,f==="end"&&(c=l-(h-c),h=l),o&&(n?[c,h]=[h,c]:[d,u]=[1-u,1-d]),t.range=[c,h],t.visibleRange=[d,u],t.gridLength=o?a:r}positionAxes(t){const{axes:i,axisBound:s,axisWidths:n,axisOffsets:o,axisAreaWidths:a,seriesRect:r,position:l}=t,c=a.get(l)??0;let h="x",d="y",u=1;(l==="top"||l==="bottom")&&(h="y",d="x");let p=s[h];(l==="right"||l==="bottom")&&(u=-1,p+=h==="x"?s.width:s.height);for(const g of i){const f=a.get(d==="x"?"left":"top")??0,x=n.get(g.id)??0,m=o.get(g.id)??0;g.gridPadding=c-m-x,g.translation[d]=s[d]+f,g.translation[h]=this.clampToOutsideSeriesRect(r,p+u*(m+x),h,u)}}shouldFlipXY(){return this.series.every(t=>t instanceof zl&&t.shouldFlipXY())}getDefaultState(){const t=new Map;if(this.lastAreaWidths)for(const{position:i="left"}of this.axes){const s=this.lastAreaWidths.get(i);s!=null&&t.set(i,s)}return{axisAreaWidths:t,clipSeries:!1,overflows:!1}}isLayoutStable(t,i){if(i.overflows!==t.overflows||i.clipSeries!==t.clipSeries)return!1;for(const s of t.axisAreaWidths.keys())if(!i.axisAreaWidths.has(s))return!1;for(const[s,n]of i.axisAreaWidths.entries()){const o=t.axisAreaWidths.get(s);if((n!=null||o!=null)&&n!==o)return!1}return!0}clipAxis(t,i,s){const n=Math.ceil(t.gridLine?.width??0),o=Math.ceil(t.line?.width??0);let{width:a,height:r}=i;switch(a+=t.direction==="x"?n:o,r+=t.direction==="y"?n:o,t.clipGrid(i.x,i.y,a,r),t.position){case"left":case"right":t.clipTickLines(s.x,i.y-n,s.width+n,i.height+n*2);break;case"top":case"bottom":t.clipTickLines(i.x-n,s.y,i.width+n*2,s.height+n);break}}};rf.className="CartesianChart",rf.type="cartesian",rf.AxesPadding=15,M([ps({changeValue(e,t){this.onAxisChange(e,t)}})],rf.prototype,"axes",2);var y5=rf;function uk(e,t){return e?t?.width:t?.height}var Wx={mode:me(J("integrated","standalone")),container:XC,context:()=>!0,theme:ke,series:Ho,annotations:ke,navigator:ke,initialState:{chartType:E,annotations:ke,legend:Rt({visible:G,seriesId:E,itemId:E,legendItemName:E},"legend state array"),zoom:ke}},lE={...Oe,...Wx,axes:al(2),data:Ho},cE={...Oe,...Wx,axes:al(2),data:Ho},m5={...Oe,...Wx,data:Ho,topology:rd},x5={...Oe,...Wx,data:Ho},b5=new Set(["number","log","time"]),v5=e=>Ee(e)&&!b5.has(e.type),S5={type:"chart",name:"cartesian",options:lE,detect:gN,create(e,t){return new y5(e,t)},validate(e,t,i){const s=[];e?.series?.[0]?.type==="histogram"&&e?.axes?.some(v5)&&(s.push(new ol("invalid","only continuous axis types when histogram series is used",e.axes,i,"axes")),e=re(e,["axes"]));const n=cs(e,t,i);return n.invalid.push(...s),n}},hE=()=>{throw new Error("Enterprise module placeholder cannot be initialised")},M5={type:"chart",name:"standalone",placeholder:!0,options:{},detect:yN,create:hE},D5={type:"chart",name:"topology",placeholder:!0,options:{},detect:fN,create:hE},xu=class extends hM{constructor(){super(...arguments),this.shape="polygon",this.innerRadiusRatio=0,this.defaultTickMinSpacing=20}update(){super.update(),this.tickLineGroup.visible=this.tick.enabled,this.tickLabelGroup.visible=this.label.enabled}layoutCrossLines(){const e=this.label.getSideFlag(),t=this.hasDefinedDomain()||this.hasVisibleSeries(),{rotation:i,parallelFlipRotation:s,regularFlipRotation:n}=this.calculateRotations();for(const o of this.crossLines)o.sideFlag=-e,o.direction=i===-Math.PI/2?"angle":"radius",o.parallelFlipRotation=s,o.regularFlipRotation=n,o.calculateLayout?.(t,this.reverse)}updatePosition(){super.updatePosition();const e=Math.floor(this.translation.x),t=Math.floor(this.translation.y);this.tickLineGroup.translationX=e,this.tickLineGroup.translationY=t,this.tickLabelGroup.translationX=e,this.tickLabelGroup.translationY=t,this.crossLineRangeGroup.translationX=e,this.crossLineRangeGroup.translationY=t,this.crossLineLineGroup.translationX=e,this.crossLineLineGroup.translationY=t,this.crossLineLabelGroup.translationX=e,this.crossLineLabelGroup.translationY=t,this.tickLabelGroupSelection.each(gm())}computeLabelsBBox(e,t){return null}computeRange(){}getAxisLinePoints(){}};M([C],xu.prototype,"shape",2),M([C],xu.prototype,"innerRadiusRatio",2);var pk=class extends Lm{constructor(e,t){super(e,t),this.padding=new Oc(40),this.ctx.axisManager.axisGroup.zIndex=8}getChartType(){return"polar"}async performLayout(e){const{layoutBox:t}=e,i=t.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=i,this.animationRect=i,this.seriesRoot.translationX=i.x,this.seriesRoot.translationY=i.y,await this.computeCircle(i);for(const s of this.axes)s.update();this.ctx.layoutManager.emitLayoutComplete(e,{series:{visible:!0,rect:i,paddedRect:t}})}updateAxes(e,t,i,s){const n=this.axes.find(l=>l.direction==="angle"),o=this.axes.find(l=>l.direction==="radius");if(!(n instanceof xu)||!(o instanceof xu))return;const a=n.scale,r=o.innerRadiusRatio;n.innerRadiusRatio=r,n.computeRange(),n.gridLength=s,o.gridAngles=a.ticks({nice:n.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0})?.ticks?.map(l=>a.convert(l)),o.gridRange=n.range,o.range=[s,s*r];for(const l of[n,o])l.translation.x=e.x+t,l.translation.y=e.y+i,l.calculateLayout()}async computeCircle(e){const t=this.series.filter(k5),i=this.axes.filter(I5),s=(c,h,d)=>{this.updateAxes(e,c,h,d);for(const p of t)p.centerX=c,p.centerY=h,p.radius=d;const u=t.filter(p=>p.type==="donut"||p.type==="pie");if(u.length>1){const p=u.map(g=>{const f=g.getInnerRadius();return{series:g,innerRadius:f}}).sort((g,f)=>g.innerRadius-f.innerRadius);p.at(-1).series.surroundingRadius=void 0;for(let g=0;g{const h=[];for(const p of Dc(i,t)){const g=await p.computeLabelsBBox({hideWhenNecessary:c},e);g&&h.push(g)}if(h.length===0){s(n,o,a);return}const d=de.merge(h),u=this.refineCircle(d,r,e);s(u.centerX,u.centerY,u.radius),r=u.radius};await l(),await l(),await l(),await l({hideWhenNecessary:!0}),await l({hideWhenNecessary:!0});for(const c of Dc(i,t))await c.computeLabelsBBox({hideWhenNecessary:!0},e);return{radius:r,centerX:n,centerY:o}}refineCircle(e,t,i){const n=-t,o=-t,a=t,r=t;let l=Math.max(0,n-e.x),c=Math.max(0,o-e.y),h=Math.max(0,e.x+e.width-a),d=Math.max(0,e.y+e.height-r);l=h=Math.max(l,h),c=d=Math.max(c,d);const u=i.width-l-h,p=i.height-c-d;let g=Math.min(u,p)/2;const f=.5*i.width/2,x=.5*i.height/2,m=Math.min(f,x);if(gi.height){const L=i.height-2*g;Math.min(c,d)*2>L?(c=L/2,d=L/2):c>d?c=L-d:d=L-c}if(2*g+S>i.width){const L=i.width-2*g;Math.min(l,h)*2>L?(l=L/2,h=L/2):l>h?l=L-h:h=L-l}}const v=l+2*g+h,b=c+2*g+d;return{centerX:(i.width-v)/2+l+g,centerY:(i.height-b)/2+c+g,radius:g}}};pk.className="PolarChart",pk.type="polar";function k5(e){return e instanceof sk}function I5(e){return e instanceof xu}var A5={type:"chart",name:"polar",options:cE,detect:m$,create(e,t){return new pk(e,t)},validate(e,t,i){const s=[],n=e?.series?.[0]?.type;(n==="pie"||n==="donut")&&e?.axes&&(s.push(new ES([],e.axes,i,"axes")),e=re(e,["axes"]));const o=cs(e,t,i);return o.invalid.push(...s),o}},C5=[S5,eK,tK,iK,sK,nK,oK,IO,NO,RO,FO,VO,GO],L5=[A5,GY,HY],T5=[...C5,...L5,M5,D5,u5,p5,g5],w5=1e3,gk=class bc{constructor(t,i,s,n,o,a=w5){this.name=t,this.buildItem=i,this.releaseItem=s,this.destroyItem=n,this.maxPoolSize=o,this.cleanupTimeMs=a,this.freePool=[],this.busyPool=new Set}static getPool(t,i,s,n,o){return this.pools.has(t)||this.pools.set(t,new bc(t,i,s,n,o)),this.pools.get(t)}isFull(){return this.freePool.length+this.busyPool.size>=this.maxPoolSize}hasFree(){return this.freePool.length>0}obtain(t){if(!this.hasFree()&&this.isFull())throw new Error("AG Charts - pool exhausted");let i=this.freePool.pop();return i==null?(i=this.buildItem(t),bc.debug(()=>[`Pool[name=${this.name}]: Created instance (${this.freePool.length} / ${this.busyPool.size+1} / ${this.maxPoolSize})`,i])):bc.debug(()=>[`Pool[name=${this.name}]: Re-used instance (${this.freePool.length} / ${this.busyPool.size+1} / ${this.maxPoolSize})`,i]),this.busyPool.add(i),{item:i,release:()=>this.release(i)}}obtainFree(){const t=this.freePool.pop();if(t==null)throw new Error("AG Charts - pool has no free instances");return bc.debug(()=>[`Pool[name=${this.name}]: Re-used instance (${this.freePool.length} / ${this.busyPool.size+1} / ${this.maxPoolSize})`,t]),this.busyPool.add(t),{item:t,release:()=>this.release(t)}}release(t){if(!this.busyPool.has(t))throw new Error("AG Charts - cannot free item from pool which is not tracked as busy.");bc.debug(()=>[`Pool[name=${this.name}]: Releasing instance (${this.freePool.length} / ${this.busyPool.size} / ${this.maxPoolSize})`,t]),this.releaseItem(t),this.busyPool.delete(t),this.freePool.push(t),bc.debug(()=>[`Pool[name=${this.name}]: Returned instance to free pool (${this.freePool.length} / ${this.busyPool.size} / ${this.maxPoolSize})`,t]);const i=Date.now(),s=i+this.cleanupTimeMs*.5;this.cleanPoolTimer&&(this.cleanPoolDue??1/0)[`Pool[name=${this.name}]: Cleaned pool of ${t.length} items (${this.freePool.length} / ${this.busyPool.size} / ${this.maxPoolSize})`])}destroy(){this.cleanPool();for(const t of this.busyPool.values())this.destroyItem(t);this.busyPool.clear()}};gk.pools=new Map,gk.debug=Pe.create(!0,"pool");var N5=gk;en.registerMany(T5,fr);var Rr=Pe.create(!0,"opts"),So=class{static licenseCheck(e){this.licenseChecked||(this.licenseManager=wl.licenseManager?.(e),this.licenseManager?.validateLicense(),this.licenseChecked=!0)}static getLicenseDetails(e){return wl.licenseManager?.({}).getLicenseDetails(e)}static getInstance(e){return dE.getInstance(e)}static create(e,t){const i=Pe.check("scene:stats","scene:stats:verbose")?performance.now():void 0;return Rr.group("AgCharts.create()",()=>{e=Pe.inDevelopmentMode(()=>cr(Ft(e)))??e,this.licenseCheck(e);const s=dE.createOrUpdate({userOptions:e,licenseManager:this.licenseManager,optionsMetadata:t,apiStartTime:i});return this.licenseManager?.isDisplayWatermark()&&this.licenseManager&&wl.injectWatermark?.(s.chart.ctx.domManager,this.licenseManager.getWatermarkMessage()),s})}static createFinancialChart(e){return Rr.group("AgCharts.createFinancialChart()",()=>this.create(e,{presetType:"price-volume"}))}static createGauge(e){return Rr.group("AgCharts.createGauge()",()=>this.create(e,{presetType:"gauge-preset"}))}static __createSparkline(e){return Rr.group("AgCharts.__createSparkline()",()=>{const{pool:t,...i}=e;return this.create(i,{presetType:"sparkline",pool:t??!0,domMode:"minimal",withDragInterpretation:!1})})}};So.licenseChecked=!1;var Va=class vc{static getInstance(t){const i=Lm.getInstance(t);return i?E1.chartInstances.get(i):void 0}static initialiseModules(){vc.initialised||(Gx(),WY(),vc.initialised=!0)}static createOrUpdate(t){let{proxy:i}=t;const{userOptions:s,licenseManager:n,processedOverrides:o=i?.chart?.chartOptions.processedOverrides??{},specialOverrides:a=i?.chart?.chartOptions.specialOverrides??{},optionsMetadata:r=i?.chart?.chartOptions.optionMetadata??{},deltaOptions:l,data:c,stripSymbols:h=!1,apiStartTime:d}=t,u=wl.styles==null?[]:[["ag-charts-enterprise",wl.styles]];vc.initialiseModules(),Rr(()=>[">>> AgCharts.createOrUpdate() user options",Ft(s)]);const{presetType:p}=r;let g=s;So.optionsMutationFn&&g&&(g=So.optionsMutationFn(Ft(g,Bg.OPTIONS_CLONE_OPTS_FAST),p),Rr(()=>[">>> AgCharts.createOrUpdate() MUTATED user options",Ft(g)]));const f=this.getPool(r);let x=!1,m,v=i?.chart;v==null&&f?.hasFree()&&(m=f.obtainFree(),v=m.item);const{document:b,window:S,styleContainer:D,...L}=g??{},I=v?.getChartOptions(),A=new Bg(I,L,o,{...a,document:b,window:S,styleContainer:D},r,l,h,d);(v==null||en.detectChartDefinition(A.processedOptions)!==en.detectChartDefinition(v.chartOptions.processedOptions))&&(m?.release(),m=this.getPool(A.optionMetadata)?.obtain(A),m?v=m.item:(x=!0,v=vc.createChartInstance(A,v))),A.optionsGraph&&v.ctx.optionsGraphService.updateCallback((T,w,N)=>A.optionsGraph?.resolvePartial(T,w,N));for(const[T,w]of u)v.ctx.domManager.addStyles(T,w);return v.ctx.fontManager.updateFonts(A.googleFonts),c!=null&&v.ctx.dataService.restoreData(c),i==null?(i=new E1(v,vc.callbackApi,n),i.releaseChart=m?.release):(m||x)&&(i.releaseChart?.(),i.chart=v,i.releaseChart=m?.release),Rr.check()&&typeof globalThis.window<"u"&&(globalThis.agChartInstances??(globalThis.agChartInstances={}),globalThis.agChartInstances[v.id]=v),v.queuedUserOptions.push(A.userOptions),v.queuedChartOptions.push(A),v.requestFactoryUpdate(T=>{Rr.group(">>>> Chart.applyOptions()",()=>{T.applyOptions(A);const w=T.queuedUserOptions.indexOf(A.userOptions)+1;T.queuedUserOptions.splice(0,w),T.queuedChartOptions.splice(0,w)})}),i}static markRemovedProperties(t,i,s=!1){if(typeof t!="object")return s;for(const n of Object.keys(t))t[n]===void 0&&(Object.assign(t,{[n]:Symbol("UNSET")}),s||(s=!0));return s}static updateUserDelta(t,i,s){i=Ft(i,Bg.OPTIONS_CLONE_OPTS_FAST);const n=ul(i,vc.markRemovedProperties,new Set(["data"]),void 0,void 0,!1);Rr(()=>[">>> AgCharts.updateUserDelta() user delta",Ft(i)]),vc.createOrUpdate({proxy:t,deltaOptions:i,stripSymbols:n,apiStartTime:s})}static createChartInstance(t,i){const s=i?.destroy({keepTransferableResources:!0});return en.detectChartDefinition(t.processedOptions).create(t,s)}static getPool(t){if(t.pool===!0)return N5.getPool(t.presetType??"default",this.createChartInstance,this.detachAndClear,this.destroy,1/0)}};Va.caretaker=new bT(fr),Va.initialised=!1,Va.callbackApi={caretaker:Va.caretaker,create(e,t,i,s,n){return Va.createOrUpdate({userOptions:e,processedOverrides:t,specialOverrides:i,optionsMetadata:s,data:n})},update(e,t,i,s){return Va.createOrUpdate({userOptions:e,proxy:t,specialOverrides:i,apiStartTime:s})},updateUserDelta(e,t,i){return Va.updateUserDelta(e,t,i)}},Va.detachAndClear=e=>e.detachAndClear(),Va.destroy=e=>e.destroy();var dE=Va,$x={};Tn($x,{Arc:()=>Ga,BBox:()=>de,Caption:()=>wt,CategoryScale:()=>zd,Group:()=>Be,Line:()=>Rn,LinearScale:()=>ih,Marker:()=>wi,Path:()=>Hi,RadialColumnShape:()=>Mo,Rect:()=>Li,Scene:()=>Qy,Sector:()=>Ms,Shape:()=>ti,TranslatableGroup:()=>us,getRadialColumnWidth:()=>uE,toRadians:()=>ds});var Ga=class extends Hi{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.radius=10,this.startAngle=0,this.endAngle=Math.PI*2,this.counterClockwise=!1,this.type=0}get fullPie(){return Qe(Gi(this.startAngle),Gi(this.endAngle))}updatePath(){const e=this.path;e.clear(),e.arc(this.centerX,this.centerY,this.radius,this.startAngle,this.endAngle,this.counterClockwise),this.type===1?e.closePath():this.type===2&&!this.fullPie&&(e.lineTo(this.centerX,this.centerY),e.closePath())}computeBBox(){return new de(this.centerX-this.radius,this.centerY-this.radius,this.radius*2,this.radius*2)}isPointInPath(e,t){const i=this.getBBox();return this.type!==0&&i.containsPoint(e,t)&&this.path.isPointInPath(e,t)}};Ga.className="Arc",M([ne()],Ga.prototype,"centerX",2),M([ne()],Ga.prototype,"centerY",2),M([ne()],Ga.prototype,"radius",2),M([ne()],Ga.prototype,"startAngle",2),M([ne()],Ga.prototype,"endAngle",2),M([ne()],Ga.prototype,"counterClockwise",2),M([ne()],Ga.prototype,"type",2);function fk(e,t,i){const s=Math.hypot(e,t),o=Math.atan2(t,e)+i;return{x:Math.cos(o)*s,y:Math.sin(o)*s}}var Mo=class extends Hi{constructor(){super(...arguments),this.isBeveled=!0,this.columnWidth=0,this.startAngle=0,this.endAngle=0,this.outerRadius=0,this.innerRadius=0,this.axisInnerRadius=0,this.axisOuterRadius=0,this.isRadiusAxisReversed=!1}set cornerRadius(e){}computeBBox(){const{innerRadius:e,outerRadius:t,columnWidth:i}=this,s=this.getRotation(),n=-i/2,o=i/2,a=-t,r=-e;let l=1/0,c=1/0,h=-1/0,d=-1/0;for(let u=0;u<4;u+=1){const{x:p,y:g}=fk(u%2===0?n:o,u<2?a:r,s);l=Math.min(p,l),c=Math.min(g,c),h=Math.max(p,h),d=Math.max(g,d)}return new de(l,c,h-l,d-c)}getRotation(){const{startAngle:e,endAngle:t}=this,i=Ry(e,t);return Gi(e+i/2+Math.PI/2)}updatePath(){const{isBeveled:e}=this;e?this.updateBeveledPath():this.updateRectangularPath(),this.checkPathDirty()}updateRectangularPath(){const{columnWidth:e,innerRadius:t,outerRadius:i,path:s}=this,n=-e/2,o=e/2,a=-i,r=-t,l=this.getRotation(),c=[[n,r],[n,a],[o,a],[o,r]].map(([h,d])=>fk(h,d,l));s.clear(!0),s.moveTo(c[0].x,c[0].y),s.lineTo(c[1].x,c[1].y),s.lineTo(c[2].x,c[2].y),s.lineTo(c[3].x,c[3].y),s.closePath()}updateBeveledPath(){const{columnWidth:e,path:t,outerRadius:i,innerRadius:s,axisInnerRadius:n,axisOuterRadius:o,isRadiusAxisReversed:a}=this,r=Qe(s,n),l=Math.asin(e/2/s),c=this.getRotation(),h=(A,T)=>fk(A,T,c),d=(A,T)=>Math.hypot(A,T),u=(A,T)=>T>A?0:Math.sqrt(A**2-T**2),p=(A,T,w)=>w?AT,g=r&&!Number.isNaN(l)&&l=2*Math.PI){const p=e+o/2;e=p-Math.PI,t=p+Math.PI}const r=i*Math.cos(e),l=i*Math.sin(e),c=i*Math.cos(t),h=i*Math.sin(t),d=Math.floor(Math.hypot(r-c,l-h)),u=2*i*n;return Math.max(1,Math.min(u,d))}var Ux={};Tn(Ux,{ChartTheme:()=>Jo,DEFAULT_ANNOTATION_HANDLE_FILL:()=>hg,DEFAULT_ANNOTATION_STATISTICS_COLOR:()=>pg,DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE:()=>gg,DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL:()=>fg,DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE:()=>yg,DEFAULT_ANNOTATION_STATISTICS_FILL:()=>dg,DEFAULT_ANNOTATION_STATISTICS_STROKE:()=>ug,DEFAULT_CAPTION_ALIGNMENT:()=>bl,DEFAULT_CAPTION_LAYOUT_STYLE:()=>xl,DEFAULT_FIBONACCI_STROKES:()=>lg,DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL:()=>Ni,DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR:()=>Gt,DEFAULT_GRIDLINE_ENABLED:()=>Qo,DEFAULT_POLAR_SERIES_STROKE:()=>Rm,DEFAULT_SEPARATION_LINES_COLOUR:()=>rg,DEFAULT_SHADOW_COLOUR:()=>Wc,DEFAULT_SPARKLINE_CROSSHAIR_STROKE:()=>zm,DEFAULT_TEXTBOX_COLOR:()=>bg,DEFAULT_TEXTBOX_FILL:()=>mg,DEFAULT_TEXTBOX_STROKE:()=>xg,DEFAULT_TEXT_ANNOTATION_COLOR:()=>cg,DEFAULT_TOOLBAR_POSITION:()=>vg,IS_DARK_THEME:()=>Gd,PALETTE_ALT_DOWN_FILL:()=>BM,PALETTE_ALT_DOWN_STROKE:()=>zM,PALETTE_ALT_NEUTRAL_FILL:()=>_M,PALETTE_ALT_NEUTRAL_STROKE:()=>VM,PALETTE_ALT_UP_FILL:()=>FM,PALETTE_ALT_UP_STROKE:()=>RM,PALETTE_DOWN_FILL:()=>Om,PALETTE_DOWN_STROKE:()=>wm,PALETTE_NEUTRAL_FILL:()=>Pm,PALETTE_NEUTRAL_STROKE:()=>Em,PALETTE_UP_FILL:()=>Nm,PALETTE_UP_STROKE:()=>Tm,getChartTheme:()=>ux,resolveOperation:()=>E5,themeNames:()=>O5,themeSymbols:()=>PM,themes:()=>xD});var O5=Object.keys(xD);function E5(e){const t=Jo.getDefaultPublicParameters(),i=Jo.getDefaultColors();return new w1({line:{operation:e}},{series:[{type:"line"}]},t,i).resolve().operation}var Kx={};Tn(Kx,{Color:()=>mt,interpolateColor:()=>GT});function pE(e,t,i,s){return{unit:e,step:t,epoch:i,utc:s,every(n){return pE(this.unit,(this.step??1)*n,this.epoch,this.utc)}}}var gE={};function yi(e,t=1,i,s=!1){K.warnOnce("time import is deprecated, use object notation instead");const n=`${e}:${t}:${i?.getTime()??0}:${s}`;let o=gE[n];return o==null&&(o=pE(e,t,i,s),gE[n]=o),o}var P5={get millisecond(){return yi("millisecond")},get second(){return yi("second")},get minute(){return yi("minute")},get hour(){return yi("hour")},get day(){return yi("day")},get monday(){return yi("day",7,new Date(1970,0,5))},get tuesday(){return yi("day",7,new Date(1970,0,6))},get wednesday(){return yi("day",7,new Date(1970,0,7))},get thursday(){return yi("day",7,new Date(1970,0,1))},get friday(){return yi("day",7,new Date(1970,0,2))},get saturday(){return yi("day",7,new Date(1970,0,3))},get sunday(){return yi("day",7,new Date(1970,0,4))},get month(){return yi("month")},get year(){return yi("year")},get utcMillisecond(){return yi("millisecond",1,void 0,!0)},get utcSecond(){return yi("second",1,void 0,!0)},get utcMinute(){return yi("minute",1,void 0,!0)},get utcHour(){return yi("hour",1,void 0,!0)},get utcDay(){return yi("day",1,void 0,!0)},get utcMonth(){return yi("month",1,void 0,!0)},get utcYear(){return yi("year",1,void 0,!0)}},k={};Tn(k,{AGGREGATION_INDEX_X_MAX:()=>tn,AGGREGATION_INDEX_X_MIN:()=>$s,AGGREGATION_INDEX_Y_MAX:()=>nn,AGGREGATION_INDEX_Y_MIN:()=>sn,AGGREGATION_SPAN:()=>aa,AbstractBarSeries:()=>AO,AbstractBarSeriesProperties:()=>UD,ActionOnSet:()=>ps,AnchoredPopover:()=>SE,Animation:()=>$T,AnimationManager:()=>XT,Arc:()=>Ga,Axis:()=>hM,AxisGroupZIndexMap:()=>Fw,AxisInterval:()=>Bc,AxisLabel:()=>It,AxisTick:()=>_c,BASE_FONT_SIZE:()=>gr,BBox:()=>de,Background:()=>lu,BackgroundModule:()=>P1,BandScale:()=>br,BarSeries:()=>tf,BarSeriesModule:()=>wO,BaseModuleInstance:()=>Ay,BaseProperties:()=>Le,BaseToolbar:()=>Ik,Border:()=>dh,ButtonWidget:()=>Op,CallbackCache:()=>eT,Caption:()=>wt,CartesianAxis:()=>sg,CartesianCrossLine:()=>_s,CartesianSeries:()=>zl,CartesianSeriesNodeEvent:()=>OD,CartesianSeriesProperties:()=>Er,CategoryAxis:()=>$d,CategoryScale:()=>zd,ChangeDetectableProperties:()=>TD,Chart:()=>Lm,ChartAxisDirection:()=>Yy,ChartOptions:()=>Bg,ChartUpdateType:()=>Ep,CollapseMode:()=>sO,Color:()=>mt,ColorScale:()=>dd,ConicGradient:()=>zL,ContextMenuBuiltins:()=>qT,ContextMenuRegistry:()=>QT,ContinuousScale:()=>ut,DEFAULT_CARTESIAN_DIRECTION_KEYS:()=>pu,DEFAULT_CARTESIAN_DIRECTION_NAMES:()=>gu,DEFAULT_POLAR_DIRECTION_KEYS:()=>XO,DEFAULT_POLAR_DIRECTION_NAMES:()=>qO,DEFAULT_TOOLTIP_CLASS:()=>Qi,DEFAULT_TOOLTIP_DARK_CLASS:()=>TN,DIRECTION_SWAP_AXES:()=>VN,DOMManager:()=>wT,DataChangeDescription:()=>bw,DataController:()=>Iw,DataModel:()=>X0,DataModelSeries:()=>ND,DataService:()=>Jy,DataSet:()=>Nd,Debug:()=>Pe,Deprecated:()=>R5,DeprecatedAndRenamedTo:()=>z5,DiscreteTimeAxis:()=>M2,DiscreteTimeScale:()=>Zo,DragInterpreter:()=>rw,DraggablePopover:()=>ME,DropShadow:()=>_a,ExtendedPath2D:()=>gd,FILL_GRADIENT_BLANK_DEFAULTS:()=>sU,FILL_GRADIENT_CONIC_SERIES_DEFAULTS:()=>lU,FILL_GRADIENT_LINEAR_DEFAULTS:()=>vl,FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS:()=>nU,FILL_GRADIENT_LINEAR_KEYED_DEFAULTS:()=>aU,FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS:()=>oU,FILL_GRADIENT_RADIAL_DEFAULTS:()=>Bm,FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS:()=>Sg,FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS:()=>GN,FILL_GRADIENT_RADIAL_SERIES_DEFAULTS:()=>rU,FILL_IMAGE_BLANK_DEFAULTS:()=>pU,FILL_IMAGE_DEFAULTS:()=>Ir,FILL_PATTERN_BLANK_DEFAULTS:()=>hU,FILL_PATTERN_DEFAULTS:()=>zn,FILL_PATTERN_HIERARCHY_DEFAULTS:()=>dU,FILL_PATTERN_KEYED_DEFAULTS:()=>uU,FILL_PATTERN_SINGLE_DEFAULTS:()=>cU,FONT_SIZE:()=>v0,FONT_SIZE_RATIO:()=>Ko,FillGradientDefaults:()=>gl,FillImageDefaults:()=>xr,FillPatternDefaults:()=>Ti,FloatingToolbar:()=>mZ,FormatManager:()=>Id,Gradient:()=>Fy,Group:()=>Be,GroupedCategoryAxis:()=>th,HdpiCanvas:()=>N0,HierarchyNode:()=>J5,HierarchySeries:()=>eZ,HierarchySeriesProperties:()=>Bl,HighlightManager:()=>JT,HighlightProperties:()=>mr,HighlightState:()=>ew,HighlightStyle:()=>_p,Image:()=>vu,InteractionManager:()=>YT,InteractionState:()=>KT,InterpolationProperties:()=>fu,Invalidating:()=>kp,LABEL_BOXING_DEFAULTS:()=>Ra,LARGEST_KEY_INTERVAL:()=>d2,LEGEND_CONTAINER_THEME:()=>WN,Label:()=>Bt,LayoutElement:()=>H0,LayoutManager:()=>mw,LegendMarkerLabel:()=>xo,Line:()=>Rn,LineSeries:()=>nf,LineSeriesModule:()=>_O,LinearGradient:()=>FL,LinearScale:()=>ih,LogScale:()=>sD,LonLatBBox:()=>tZ,MIN_CATEGORY_SPACING:()=>Og,Marker:()=>wi,Menu:()=>uZ,MenuItemRadioWidget:()=>Mk,MenuItemWidget:()=>qx,MenuWidget:()=>Dk,MercatorScale:()=>iZ,ModuleRegistry:()=>en,Motion:()=>E0,NODE_UPDATE_STATE_TO_PHASE_MAPPING:()=>Xo,NativeWidget:()=>Md,NewAreaSeriesModule:()=>IO,NewBarSeriesModule:()=>NO,NewBubbleSeriesModule:()=>RO,NewHistogramSeriesModule:()=>FO,NewLineSeriesModule:()=>VO,NewScatterSeriesModule:()=>GO,NiceMode:()=>Ow,Node:()=>hr,NumberAxis:()=>_n,ObserveChanges:()=>pl,OrdinalTimeScale:()=>_d,PHASE_METADATA:()=>Fp,PHASE_ORDER:()=>Ad,PREV_NEXT_KEYS:()=>Np,Padding:()=>Oc,ParallelStateMachine:()=>RW,Path:()=>Hi,PointerEvents:()=>wL,PolarAxis:()=>xu,PolarSeries:()=>sk,PolarZIndexMap:()=>ZO,Popover:()=>kk,PropertiesArray:()=>ud,Property:()=>C,ProxyInteractionService:()=>RT,ProxyOnWrite:()=>n4,ProxyProperty:()=>zs,ProxyPropertyOnWrite:()=>ii,QUICK_TRANSITION:()=>im,QuadtreeNearest:()=>W1,RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD:()=>xx,RadialColumnShape:()=>Mo,Range:()=>Pa,Rect:()=>Li,RepeatType:()=>WT,Rotatable:()=>fd,RotatableGroup:()=>qj,RotatableText:()=>uT,SAFE_FILLS_OPERATION:()=>tU,SAFE_FILL_OPERATION:()=>eU,SAFE_RANGE2_OPERATION:()=>iU,SAFE_STROKE_FILL_OPERATION:()=>Fm,SEGMENTATION_DEFAULTS:()=>_m,SKIP_JS_BUILTINS:()=>QS,SMALLEST_KEY_INTERVAL:()=>h2,SORT_DOMAIN_GROUPS:()=>u2,Scalable:()=>Vy,ScalableGroup:()=>Xj,ScaleAlignment:()=>EL,Scene:()=>Qy,SceneArrayChangeDetection:()=>t0,SceneChangeDetection:()=>ne,SceneObjectChangeDetection:()=>En,SceneRefChangeDetection:()=>Ey,Sector:()=>Ms,SectorBox:()=>jO,SegmentOptions:()=>Yo,Segmentation:()=>Bp,SegmentedPath:()=>wD,Selection:()=>Bs,Series:()=>Am,SeriesContentZIndexMap:()=>bN,SeriesGroupingChangedEvent:()=>Im,SeriesItemHighlightStyle:()=>yr,SeriesMarker:()=>on,SeriesNodeEvent:()=>km,SeriesNodePickMode:()=>MN,SeriesProperties:()=>ro,SeriesTooltip:()=>Or,SeriesZIndexMap:()=>xN,Shape:()=>ti,SliderWidget:()=>T0,SpanJoin:()=>U1,StateMachine:()=>$p,StateMachineProperty:()=>PW,StopProperties:()=>r0,SvgPath:()=>bE,TIME_AXIS_KEYS:()=>MO,TRIPLE_EQ:()=>hd,Text:()=>Pn,ThemeConstants:()=>pT,ThemeSymbols:()=>PM,TimeAxisParentLevel:()=>Kd,TimeScale:()=>Bd,Toolbar:()=>fZ,ToolbarButtonProperties:()=>cf,ToolbarButtonWidget:()=>DE,ToolbarWidget:()=>qy,Tooltip:()=>go,TooltipManager:()=>rm,TooltipPosition:()=>Hc,Transformable:()=>zt,TransformableGroup:()=>md,TransformableText:()=>vd,Translatable:()=>yd,TranslatableGroup:()=>us,TranslatableSvgPath:()=>hZ,UnitTimeScale:()=>ml,UpdateService:()=>xw,Vec2:()=>bu,Vec4:()=>Gp,WIDGET_HTML_EVENTS:()=>f0,Widget:()=>Na,WidgetEventUtil:()=>pr,ZIndexMap:()=>FT,ZoomManager:()=>fw,accumulateGroup:()=>g2,accumulatedValue:()=>i2,accumulativeValueProperty:()=>QM,addEscapeEventListener:()=>M0,addHitTestersToQuadtree:()=>Tx,addMouseCloseListener:()=>vT,addOverrideFocusVisibleEventListener:()=>DT,addTouchCloseListener:()=>ST,adjustLabelPlacement:()=>V1,aggregationDomain:()=>du,aggregationIndexForXRatio:()=>LD,aggregationRangeFittingPoints:()=>mx,aggregationXRatioForDatumIndex:()=>Gg,aggregationXRatioForXValue:()=>ra,angleBetween:()=>Ry,angleCategoryAxisOptionsDefs:()=>oD,angleNumberAxisOptionsDefs:()=>D2,angularPadding:()=>s0,animationValidation:()=>Ng,annotationCalloutStylesDefs:()=>j2,annotationChannelStyleDefs:()=>hD,annotationChannelTextDefs:()=>F2,annotationCommentStylesDefs:()=>H2,annotationCrossLineStyleDefs:()=>cD,annotationDisjointChannelStyleDefs:()=>V2,annotationFibonacciStylesDefs:()=>dD,annotationLineStyleDefs:()=>lx,annotationLineTextDefs:()=>rx,annotationMeasurerStylesDefs:()=>cx,annotationNoteStylesDefs:()=>W2,annotationOptionsDef:()=>iu,annotationParallelChannelStyleDefs:()=>G2,annotationQuickMeasurerStylesDefs:()=>$2,annotationShapeStylesDefs:()=>uD,annotationTextStylesDef:()=>Eg,applyShapeFillBBox:()=>SN,applyShapeStyle:()=>Dr,areScalingEqual:()=>yh,area:()=>qM,autoSizedLabelOptionsDefs:()=>kl,axisLabelsOverlap:()=>AM,bezier2DDistance:()=>$L,bezier2DExtrema:()=>WL,boxPlotHighlightStyleOptionsDef:()=>gD,boxPlotSeriesThemeableOptionsDef:()=>K2,boxPlotStyleOptionsDef:()=>pD,buildResetPathFn:()=>jD,calculateDataDiff:()=>LO,calculateLabelRotation:()=>cN,calculateLabelTranslation:()=>oZ,calculatePlacement:()=>kN,calculateSegments:()=>Cx,callWithContext:()=>Uo,candlestickSeriesThemeableOptionsDef:()=>Z2,cartesianAxisBandHighlightOptions:()=>Lg,cartesianAxisCrosshairOptions:()=>Al,cartesianAxisLabelOptionsDefs:()=>Ag,cartesianAxisOptionsDefs:()=>Tr,cartesianChartOptionsDefs:()=>lE,cartesianCrossLineOptionsDefs:()=>Cr,cartesianNumericAxisLabel:()=>UM,cartesianTimeAxisLabel:()=>Cg,cartesianTimeAxisParentLevel:()=>Qm,checkCrisp:()=>CO,chordSeriesThemeableOptionsDef:()=>X2,clampArray:()=>Ld,clipSpanX:()=>ED,clippedRoundRect:()=>Ky,collapseSpanToPoint:()=>$1,collapsedStartingBarPosition:()=>Qg,commonAxisIntervalOptionsDefs:()=>KM,commonAxisLabelOptionsDefs:()=>Lr,commonAxisOptionsDefs:()=>eh,commonChartOptionsDefs:()=>Oe,commonCrossLineLabelOptionsDefs:()=>Jc,commonCrossLineOptionsDefs:()=>Fa,commonSeriesOptionsDefs:()=>ia,commonSeriesThemeableOptionsDefs:()=>Ue,compactAggregationIndices:()=>Hg,compareDates:()=>bM,computeBarFocusBounds:()=>ZD,computeMarkerFocusBounds:()=>Dx,coneFunnelSeriesThemeableOptionsDef:()=>q2,continuousAxisOptions:()=>Hd,countExpandingSearch:()=>sw,createAggregationIndices:()=>jg,createButton:()=>aZ,createCheckbox:()=>rZ,createDatumId:()=>Gs,createDeprecationWarning:()=>yk,createIcon:()=>xE,createIdsGenerator:()=>IM,createSelect:()=>lZ,createTextArea:()=>cZ,dateToNumber:()=>ys,dateTruncationForDomain:()=>xM,datesSortOrder:()=>SM,datumKeys:()=>cm,datumStylerProperties:()=>am,deconstructSelectionsOrNodes:()=>sm,deepClone:()=>Ft,deepFreeze:()=>cr,diff:()=>sx,discreteTimeAxisIntervalOptionsDefs:()=>YM,drawCorner:()=>Tp,drawMarkerUnitPolygon:()=>og,durationDay:()=>Gc,durationHour:()=>Vc,durationMinute:()=>fl,durationMonth:()=>uM,durationSecond:()=>Ed,durationWeek:()=>_w,durationYear:()=>Up,easing:()=>E0,enterpriseModule:()=>wl,errorBarOptionsDefs:()=>$m,errorBarThemeableOptionsDefs:()=>Mg,estimateTickCount:()=>Qw,evaluateBezier:()=>pd,expandLegendPosition:()=>gx,extent:()=>Cl,extractDecoratedProperties:()=>kL,fillsOptionsDef:()=>Dg,findMinMax:()=>Wi,findQuadtreeMatch:()=>wx,findRangeExtent:()=>Pc,fixNumericExtent:()=>fn,focusCursorAtEnd:()=>Jj,formatNumber:()=>ET,formatObjectValidator:()=>XN,formatPercent:()=>NT,formatTicks:()=>sN,formatValue:()=>Dd,fromToMotion:()=>hi,funnelSeriesThemeableOptionsDef:()=>Q2,generateTicks:()=>hN,getAngleRatioRadians:()=>NL,getColorStops:()=>_L,getCrossLineValue:()=>ww,getDateTicksForInterval:()=>kM,getDatumRefPoint:()=>R0,getElementBBox:()=>tT,getIconClassNames:()=>jy,getItemStyles:()=>z0,getItemStylesPerItemId:()=>NH,getLabelStyles:()=>ph,getLastFocus:()=>k0,getMarkerStyles:()=>kx,getMissCount:()=>Sw,getPath:()=>qS,getPathComponents:()=>Dw,getRadialColumnWidth:()=>uE,getSequentialColors:()=>Fn,getShapeFill:()=>vN,getShapeStyle:()=>wM,getTextAlign:()=>rN,getTextBaseline:()=>aN,getTimeIntervalTicks:()=>nN,groupAccumulativeValueProperty:()=>Tg,groupAverage:()=>t2,groupCount:()=>XM,groupSum:()=>e2,hasNoModifiers:()=>wp,heatmapSeriesThemeableOptionsDef:()=>J2,highlightStates:()=>nm,initRovingTabIndex:()=>z4,interpolatePoints:()=>Kg,interpolationOptionsDefs:()=>Um,intervalCeil:()=>Vw,intervalEpoch:()=>qp,intervalExtent:()=>gM,intervalFloor:()=>uo,intervalHierarchy:()=>Qp,intervalMilliseconds:()=>yn,intervalNext:()=>pM,intervalPrevious:()=>Gw,intervalRange:()=>po,intervalRangeCount:()=>fM,intervalRangeStartIndex:()=>yM,intervalStep:()=>yl,intervalUnit:()=>Mr,isAgStandaloneChartOptions:()=>yN,isAgTopologyChartOptions:()=>fN,isBetweenAngles:()=>Cc,isButtonClickEvent:()=>D0,isChartAxisDirection:()=>T4,isContinuous:()=>dm,isDecoratedObject:()=>Ny,isDenseInterval:()=>Fd,isGradientFill:()=>ao,isGradientOrPatternFill:()=>Uj,isImageFill:()=>wc,isInputPending:()=>iT,isObjectWithProperty:()=>CL,isObjectWithStringProperty:()=>Sj,isPatternFill:()=>ur,isProperties:()=>Tc,isScaleValid:()=>Ug,jsonApply:()=>Lp,jsonDiff:()=>wa,jsonPropertyCompare:()=>sT,jsonWalk:()=>ul,keyProperty:()=>Ll,legendSymbolSvg:()=>LN,lineDistanceSquared:()=>By,linearGaugeSeriesOptionsDef:()=>Il,linearGaugeSeriesThemeableOptionsDef:()=>Zm,linearGaugeTargetOptionsDef:()=>Km,linearPoints:()=>K1,listDecoratedProperties:()=>hl,lowestGranularityForInterval:()=>Jp,lowestGranularityUnitForTicks:()=>mM,lowestGranularityUnitForValue:()=>xm,makeAccessibleClickListener:()=>F4,makeSeriesTooltip:()=>fh,mapLineBackgroundSeriesThemeableOptionsDef:()=>i1,mapLineSeriesThemeableOptionsDef:()=>t1,mapMarkerSeriesThemeableOptionsDef:()=>s1,mapShapeBackgroundSeriesThemeableOptionsDef:()=>o1,mapShapeSeriesThemeableOptionsDef:()=>n1,mapValues:()=>AL,markerEnabled:()=>VD,markerFadeInAnimation:()=>Zg,markerOptionsDefs:()=>sa,markerScaleInAnimation:()=>vO,markerStyleOptionsDefs:()=>Dl,markerSwipeScaleInAnimation:()=>_D,memo:()=>tm,merge:()=>Sp,mergeArrayDefaults:()=>IL,mergeDefaults:()=>st,midpointStartingBarPosition:()=>pY,minimumTimeAxisDatumGranularity:()=>v2,moduleRegistry:()=>Ta,motion:()=>bZ,multiSeriesHighlightStyle:()=>Sl,nearestSquared:()=>Ty,nearestSquaredInContainer:()=>xj,nextPowerOf2:()=>lw,nightingaleSeriesThemeableOptionsDef:()=>a1,normaliseGroupTo:()=>ex,normalisePropertyTo:()=>tx,normalisedExtentWithMetadata:()=>ZM,normalizeAngle180:()=>Py,normalizeAngle360:()=>Gi,normalizeAngle360FromDegrees:()=>dr,normalizeAngle360Inclusive:()=>Lj,normalizeContinuousDomains:()=>V0,numberFormatValidator:()=>ta,objectsEqual:()=>Ci,objectsEqualWith:()=>XS,ohlcSeriesThemeableOptionsDef:()=>e1,ordinalTimeAxisOptionsDefs:()=>eu,pairUpSpans:()=>$g,partialAssign:()=>e0,pathFadeInAnimation:()=>Ix,pathMotion:()=>fx,pathSwipeInAnimation:()=>GD,pick:()=>Oy,pickByMatchingAngle:()=>YO,plotAreaPathFill:()=>mO,plotInterpolatedAreaSeriesFillSpans:()=>Sx,plotInterpolatedLinePathStroke:()=>vx,plotLinePathStroke:()=>zD,pointsEq:()=>Yg,polarChartOptionsDefs:()=>cE,predictCartesianAxis:()=>HD,predictCartesianTimeAxis:()=>qg,predictTimeAxisType:()=>WD,prepareAreaFillAnimationFns:()=>xO,prepareAreaPathAnimation:()=>bO,prepareAxisAnimationContext:()=>Ew,prepareAxisAnimationFunctions:()=>Pw,prepareBarAnimationFunctions:()=>Jg,prepareLinePathAnimation:()=>yO,prepareLinePathPropertyAnimation:()=>BD,prepareLinePathStrokeAnimationFns:()=>FD,preparePieSeriesAnimationFunctions:()=>_x,previousPowerOf2:()=>_0,processedDataIsAnimatable:()=>Ud,pyramidSeriesThemeableOptionsDef:()=>r1,radarAreaSeriesThemeableOptionsDef:()=>l1,radarLineSeriesThemeableOptionsDef:()=>c1,radialBarSeriesThemeableOptionsDef:()=>h1,radialColumnSeriesThemeableOptionsDef:()=>d1,radialGaugeSeriesOptionsDef:()=>kg,radialGaugeSeriesThemeableOptionsDef:()=>Xm,radialGaugeTargetOptionsDef:()=>Ym,radialSeriesStylerDef:()=>ah,radiusCategoryAxisOptionsDefs:()=>I2,radiusNumberAxisOptionsDefs:()=>k2,range:()=>vm,rangeAreaSeriesThemeableOptionsDef:()=>g1,rangeBarSeriesThemeableOptionsDef:()=>y1,rangeValidator:()=>jm,rangedValueProperty:()=>c2,rescaleSpan:()=>yu,resetAxisFillSelectionFn:()=>zw,resetAxisGroupFn:()=>Rw,resetAxisLabelSelectionFn:()=>gm,resetAxisLineSelectionFn:()=>cM,resetBarSelectionsFn:()=>ef,resetLabelFn:()=>gh,resetMarkerFn:()=>Mx,resetMarkerPositionFn:()=>Xg,resetMotion:()=>fs,resetPieSelectionsFn:()=>KO,rowCountProperty:()=>r2,sankeySeriesThemeableOptionsDef:()=>m1,scale:()=>Ji,sectorBox:()=>HO,seriesLabelFadeInAnimation:()=>Wt,seriesLabelFadeOutAnimation:()=>yx,seriesLabelOptionsDefs:()=>yt,setElementBBox:()=>Gy,setPath:()=>JS,shadowOptionsDefs:()=>za,shallowClone:()=>p0,simpleMemorize:()=>gs,simpleMemorize2:()=>Rp,singleSeriesHighlightStyle:()=>HN,smoothPoints:()=>Z1,solveBezier:()=>_y,sortAndUniqueDates:()=>vM,spanRange:()=>Gn,splitBezier2D:()=>Ap,stackCartesianSeries:()=>rE,standaloneChartOptionsDefs:()=>x5,staticFromToMotion:()=>vr,stepPoints:()=>Y1,stopPageScrolling:()=>IT,sum:()=>LU,sumValues:()=>Jm,sunburstSeriesThemeableOptionsDef:()=>x1,textOrSegments:()=>Vs,tickFormat:()=>ZW,ticksEqual:()=>CM,ticksSpacing:()=>iN,timeInterval:()=>qm,timeIntervalMaxLabelSize:()=>oN,timeIntervalUnit:()=>Ig,toDegrees:()=>Tj,toHighlightString:()=>Cd,toRadians:()=>ds,toolbarButtonOptionsDefs:()=>Qc,tooltipContentAriaLabel:()=>NN,tooltipHtml:()=>PN,tooltipOptionsDefs:()=>et,topologyChartOptionsDefs:()=>m5,trailingAccumulatedValue:()=>s2,trailingAccumulatedValueProperty:()=>EU,treemapSeriesThemeableOptionsDef:()=>b1,updateClipPath:()=>Ax,updateLabelNode:()=>_1,validateCrossLineValue:()=>Nw,valueProperty:()=>Dt,visibleRangeIndices:()=>Vp,waterfallSeriesThemeableOptionsDef:()=>v1,withTemporaryDomain:()=>LM,without:()=>re});function yk(){return(e,t)=>{const i=[`Property [${e}] is deprecated.`,t].filter(Boolean).join(" ");K.warnOnce(i)}}function R5(e,t){const i=yk(),s=t?.default;return Ac((n,o,a)=>(a!==s&&i(o.toString(),e),a))}function z5(e,t){const i=yk();return Ac((s,n,o)=>(o!==s[e]&&(i(n.toString(),`Use [${e}] instead.`),JS(s,e,t?t(o):o)),YS),(s,n)=>(i(n.toString(),`Use [${e}] instead.`),qS(s,e)))}var bu={add:F5,angle:j5,apply:q5,equal:Z5,distance:_5,distanceSquared:V5,from:X5,gradient:W5,intercept:$5,intersectAtX:K5,intersectAtY:U5,length:Yx,lengthSquared:fE,multiply:B5,normalized:G5,origin:yE,required:Q5,rotate:H5,round:Y5,sub:mk};function F5(e,t){return typeof t=="number"?{x:e.x+t,y:e.y+t}:{x:e.x+t.x,y:e.y+t.y}}function mk(e,t){return typeof t=="number"?{x:e.x-t,y:e.y-t}:{x:e.x-t.x,y:e.y-t.y}}function B5(e,t){return typeof t=="number"?{x:e.x*t,y:e.y*t}:{x:e.x*t.x,y:e.y*t.y}}function Yx(e){return Math.hypot(e.x,e.y)}function fE(e){return e.x*e.x+e.y*e.y}function _5(e,t){return Yx(mk(e,t))}function V5(e,t){return fE(mk(e,t))}function G5(e){const t=Yx(e);return{x:e.x/t,y:e.y/t}}function j5(e,t){return t==null?Math.atan2(e.y,e.x):Math.atan2(e.y,e.x)-Math.atan2(t.y,t.x)}function H5(e,t,i=yE()){const s=Yx(e);return{x:i.x+s*Math.cos(t),y:i.y+s*Math.sin(t)}}function W5(e,t,i){const s=t.x-e.x;return(i==null?t.y-e.y:i-t.y-(i-e.y))/s}function $5(e,t,i){return(i==null?e.y:i-e.y)-t*e.x}function U5(e,t,i=0,s){return{x:e===1/0?1/0:(i-t)/e,y:s==null?i:s-i}}function K5(e,t,i=0,s){const n=e===1/0?1/0:e*i+t;return{x:i,y:s==null?n:s-n}}function Y5(e,t=2){return{x:LS(e.x,t),y:LS(e.y,t)}}function Z5(e,t){return e.x===t.x&&e.y===t.y}function X5(e,t){if(typeof e=="number")return{x:e,y:t};if("currentX"in e)return{x:e.currentX,y:e.currentY};if("offsetWidth"in e)return{x:e.offsetWidth,y:e.offsetHeight};if("width"in e)return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y+e.height}];if("x1"in e)return[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2}];throw new Error(`Values can not be converted into a vector: [${JSON.stringify(e)}] [${t}]`)}function q5(e,t){return e.x=t.x,e.y=t.y,e}function Q5(e){return{x:e?.x??0,y:e?.y??0}}function yE(){return{x:0,y:0}}var mE=class DS{constructor(t,i,s,n,o,a,r,l,c,h){this.series=t,this.datumIndex=i,this.datum=s,this.sizeValue=n,this.colorValue=o,this.sumSize=a,this.depth=r,this.parent=l,this.children=c,this.style=h,this.midPoint={x:0,y:0}}get hasChildren(){return this.children.length>0}walk(t,i=DS.Walk.PreOrder){i===DS.Walk.PreOrder&&t(this);for(const s of this.children)s.walk(t,i);i===DS.Walk.PostOrder&&t(this)}*[Symbol.iterator](){yield this;for(const t of this.children)yield*t}};mE.Walk={PreOrder:0,PostOrder:1};var J5=mE,eZ=class extends Am{constructor(e){super({moduleCtx:e,pickModes:[1,0]}),this.colorDomain=[0,0],this.maxDepth=0,this.colorScale=new dd,this.animationState=new $p("empty",{empty:{update:{target:"ready",action:t=>this.animateEmptyUpdateReady(t)},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",highlight:t=>this.animateReadyHighlight(t),resize:t=>this.animateReadyResize(t),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:t=>this.animateWaitingUpdateReady(t)},reset:"empty",skip:"ready"},clearing:{update:{target:"empty",action:t=>this.animateClearingUpdateEmpty(t)},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}processData(){const{NodeClass:e}=this,{childrenKey:t,sizeKey:i,colorKey:s,colorRange:n}=this.properties;let o=0,a=1/0,r=-1/0;const l=(u,p,g)=>{const f=g.depth==null?0:g.depth+1,x=t==null?void 0:u[t],m=x==null||x.length===0;let v=i==null?void 0:u[i];Number.isFinite(v)?v=Math.max(v,0):v=m?1:0;const b=v;o=Math.max(o,f);const S=s==null?void 0:u[s];typeof S=="number"&&(a=Math.min(a,S),r=Math.max(r,S));const D=this.getItemStyle({datumIndex:p,datum:u,depth:f,colorValue:S},m,!1);return c(new e(this,p,u,v,S,b,f,g,[],D),x)},c=(u,p)=>{const{datumIndex:g}=u;if(p)for(const[f,x]of p.entries()){const m=l(x,g.concat(f),u);u.children.push(m),u.sumSize+=m.sumSize}return u},h=c(new e(this,[],void 0,0,void 0,0,void 0,void 0,[],{}),this.data?.data),d=[a,r];this.colorScale.domain=al.children[c],this.rootNode);if(s>0&&o.hasChildren)n=[...n,0];else if(s<0&&n.length>1)n=n.slice(0,-1);else if(s===0&&i!==0){const l=o.parent.children.length-1;n=n.slice(),n[n.length-1]=ve(0,n.at(-1)+i,l)}const a=n.reduce((l,c)=>l.children[c],this.rootNode),r=this.computeFocusBounds(this.datumSelection.at(t+1));if(r!=null)return{datum:a,datumIndex:this.removeMeIndexForIndexPath(n),otherIndex:a.depth,bounds:r,clipFocusBox:!0}}getDatumAriaText(e,t){if(!(e instanceof this.NodeClass)){K.error(`datum is not HierarchyNode: ${JSON.stringify(e)}`);return}return this.ctx.localeManager.t("ariaAnnounceHierarchyDatum",{level:(e.depth??-1)+1,count:e.children.length,description:t})}getCategoryValue(e){}datumIndexForCategoryValue(e){}},Bl=class extends ro{constructor(){super(...arguments),this.childrenKey="children",this.fills=Object.values(di),this.strokes=Object.values(kr)}};M([C],Bl.prototype,"childrenKey",2),M([C],Bl.prototype,"sizeKey",2),M([C],Bl.prototype,"colorKey",2),M([C],Bl.prototype,"colorName",2),M([C],Bl.prototype,"fills",2),M([C],Bl.prototype,"strokes",2),M([C],Bl.prototype,"colorRange",2);var tZ=class BV{constructor(t,i,s,n){this.lon0=t,this.lat0=i,this.lon1=s,this.lat1=n}extend(t,i,s,n){return this.lon0=Math.min(this.lon0,t),this.lat0=Math.min(this.lat0,i),this.lon1=Math.max(this.lon1,s),this.lat1=Math.max(this.lat1,n),this}merge(t){return this.extend(t.lon0,t.lat0,t.lon1,t.lat1)}static extend(t,i,s,n,o){return t?t.extend(i,s,n,o):new BV(i,s,n,o)}},Zx=Math.PI/180,xk=e=>e*Zx,bk=e=>-Math.log(Math.tan(Math.PI*.25+e*Zx*.5)),vk=e=>e/Zx,Sk=e=>(Math.atan(Math.exp(-e))-Math.PI*.25)/(Zx*.5),iZ=class LC extends zy{constructor(t,i){super(),this.domain=t,this.range=i,this.type="mercator",this.defaultTickCount=0,this.bounds=LC.bounds(t)}static bounds(t){const[[i,s],[n,o]]=t,a=xk(i),r=bk(s),l=xk(n),c=bk(o);return new de(Math.min(a,l),Math.min(r,c),Math.abs(l-a),Math.abs(c-r))}static fixedScale(){return new LC([[vk(0),Sk(0)],[vk(1),Sk(1)]],[[0,0],[1,1]])}toDomain(){}normalizeDomains(...t){let i=-1/0,s=1/0,n=-1/0,o=1/0;for(const a of t)for(const[r,l]of a)i=Math.min(r,i),s=Math.max(r,s),n=Math.min(l,n),o=Math.max(l,o);return{domain:[[i,n],[s,o]],animatable:!0}}convert([t,i]){const[[s,n],[o,a]]=this.range,r=(o-s)/this.bounds.width,l=(a-n)/this.bounds.height;return[(xk(t)-this.bounds.x)*r+s,(bk(i)-this.bounds.y)*l+n]}invert([t,i]){const[[s,n],[o,a]]=this.range,r=(o-s)/this.bounds.width,l=(a-n)/this.bounds.height;return[vk((t-s)/r+this.bounds.x),Sk((i-n)/l+this.bounds.y)]}},sZ={top:{xTranslationDirection:0,yTranslationDirection:-1},bottom:{xTranslationDirection:0,yTranslationDirection:1},left:{xTranslationDirection:-1,yTranslationDirection:0},right:{xTranslationDirection:1,yTranslationDirection:0},"top-left":{xTranslationDirection:1,yTranslationDirection:-1},"top-right":{xTranslationDirection:-1,yTranslationDirection:-1},"bottom-left":{xTranslationDirection:1,yTranslationDirection:1},"bottom-right":{xTranslationDirection:-1,yTranslationDirection:1},inside:{xTranslationDirection:0,yTranslationDirection:0},"inside-left":{xTranslationDirection:1,yTranslationDirection:0},"inside-right":{xTranslationDirection:-1,yTranslationDirection:0},"inside-top":{xTranslationDirection:0,yTranslationDirection:1},"inside-bottom":{xTranslationDirection:0,yTranslationDirection:-1},"inside-top-left":{xTranslationDirection:1,yTranslationDirection:1},"inside-bottom-left":{xTranslationDirection:1,yTranslationDirection:-1},"inside-top-right":{xTranslationDirection:-1,yTranslationDirection:1},"inside-bottom-right":{xTranslationDirection:-1,yTranslationDirection:-1}},nZ={top:{xTranslationDirection:1,yTranslationDirection:0},bottom:{xTranslationDirection:-1,yTranslationDirection:0},left:{xTranslationDirection:0,yTranslationDirection:-1},right:{xTranslationDirection:0,yTranslationDirection:1},"top-left":{xTranslationDirection:-1,yTranslationDirection:-1},"top-right":{xTranslationDirection:-1,yTranslationDirection:1},"bottom-left":{xTranslationDirection:1,yTranslationDirection:-1},"bottom-right":{xTranslationDirection:1,yTranslationDirection:1},inside:{xTranslationDirection:0,yTranslationDirection:0},"inside-left":{xTranslationDirection:0,yTranslationDirection:1},"inside-right":{xTranslationDirection:0,yTranslationDirection:-1},"inside-top":{xTranslationDirection:-1,yTranslationDirection:0},"inside-bottom":{xTranslationDirection:1,yTranslationDirection:0},"inside-top-left":{xTranslationDirection:-1,yTranslationDirection:1},"inside-bottom-left":{xTranslationDirection:1,yTranslationDirection:1},"inside-top-right":{xTranslationDirection:-1,yTranslationDirection:-1},"inside-bottom-right":{xTranslationDirection:1,yTranslationDirection:-1}};function oZ({yDirection:e,padding:t=0,position:i="top",bbox:s}){const n=e?sZ:nZ,{xTranslationDirection:o,yTranslationDirection:a}=n[i],r=o*(t+s.width/2),l=a*(t+s.height/2);return{xTranslation:r,yTranslation:l}}function aZ(e,t){const i=De("button",Xx("ag-charts-input ag-charts-button",t));return e.label===void 0?(i.append(xE(e.icon)),i.ariaLabel=e.altText):i.append(e.label),i.addEventListener("click",e.onPress),Ca(i,t),i}function rZ(e,t){const i=De("input",Xx("ag-charts-input ag-charts-checkbox",t));return i.type="checkbox",i.checked=e.checked,i.addEventListener("change",s=>e.onChange(i.checked,s)),i.addEventListener("keydown",s=>{D0(s)&&(s.preventDefault(),i.click())}),Ca(i,t),i}function lZ(e,t){const i=De("select",Xx("ag-charts-input ag-charts-select",t));return i.append(...e.options.map(s=>{const n=De("option");return n.value=s.value,n.textContent=s.label,n})),Ge(i,"data-preventdefault",!1),i.value=e.value,i.addEventListener("change",s=>e.onChange(i.value,s)),Ca(i,t),i}function cZ(e,t){const i=De("textarea",Xx("ag-charts-input ag-charts-textarea",t));return i.value=e.value,i.addEventListener("input",s=>e.onChange(i.value,s)),Ca(i,t),Ge(i,"data-preventdefault",!1),i}function xE(e){const t=De("span",`ag-charts-icon ag-charts-icon-${e}`);return Ge(t,"aria-hidden",!0),t}function Xx(e,t){return t==null?e:`${e} ${t.class}`}var bE=class extends Hi{constructor(e=""){super(),this._d="",this.d=e}get d(){return this._d}set d(e){e!==this._d&&(this._d=e,this.path.clear(),this.path.appendSvg(e),this.checkPathDirty())}},hZ=class extends yd(bE){isPointInPath(e,t){return super.isPointInPath(e-this.translationX,t-this.translationY)}},vu=class extends hr{constructor(e){super(),this.sourceImage=e,this.x=0,this.y=0,this.width=0,this.height=0,this.opacity=1}render(e){const{ctx:t}=e,i=this.sourceImage;i&&(t.globalAlpha=this.opacity,t.drawImage(i,0,0,i.width,i.height,this.x,this.y,this.width,this.height)),super.render(e)}};M([ne()],vu.prototype,"x",2),M([ne()],vu.prototype,"y",2),M([ne()],vu.prototype,"width",2),M([ne()],vu.prototype,"height",2),M([ne()],vu.prototype,"opacity",2);var lf={};Tn(lf,{ButtonWidget:()=>Op,MenuItemRadioWidget:()=>Mk,MenuItemWidget:()=>qx,MenuWidget:()=>Dk,NativeWidget:()=>Md,SliderWidget:()=>T0,ToolbarWidget:()=>qy,WIDGET_HTML_EVENTS:()=>f0,Widget:()=>Na,WidgetEventUtil:()=>pr});var qx=class extends A0{constructor(){super(De("div"),"menuitem")}},Mk=class extends A0{constructor(){super(De("div"),"menuitemradio")}setChecked(e){Ge(this.elem,"aria-checked",e)}},dZ=["Escape","ArrowLeft"],Dk=class _V extends C0{constructor(t="vertical"){super(t,"menu"),this.handleMouseEnter=(i,s)=>{s.hasPopup()||this.expandSubMenu(i,void 0)},this.handleMouseMove=(i,s)=>{s.focus({preventScroll:!0})}}destructor(){this.collapse({mode:"2"})}addSeparator(){const t=Ma().createElement("div");return Ge(t,"role","separator"),this.elem.appendChild(t),t}onChildAdded(t){super.onChildAdded(t),t.addListener("mouseenter",this.handleMouseEnter),t.addListener("mousemove",this.handleMouseMove)}onChildRemoved(t){super.onChildRemoved(t),t.removeListener("mouseenter",this.handleMouseEnter),t.removeListener("mousemove",this.handleMouseMove)}addSubMenu(){const t=new qx,i=new _V(this.orientation);i.id=Ic();const s=()=>{this.collapseExpandedSubMenu(i),t.expandControlled()},n=o=>{wp(o.sourceEvent)&&o.sourceEvent.code==="ArrowRight"&&(this.collapseExpandedSubMenu(i),t.expandControlled())};return t.setControlled(i),t.setAriaHasPopup("menu"),t.addListener("click",s),t.addListener("mouseenter",s),t.addListener("keydown",n),this.addChild(t),{subMenuButton:t,subMenu:i}}expandSubMenu(t,i){const{expansionScope:s}=this;s&&(this.collapseExpandedSubMenu(i),i?.expand(t))}collapseExpandedSubMenu(t){const{expansionScope:i}=this;i&&(i.expandedSubMenu?.collapse({mode:"4"}),i.expandedSubMenu=t)}expand(t){if(this.expansionScope!=null)return;this.expansionScope={lastFocus:k0(t.sourceEvent),expandedSubMenu:void 0,abort:()=>this.collapse({mode:"1"}),close:()=>this.collapse({mode:"0"}),removers:new St};const i=this.expansionScope,s=this.children.map(n=>n.getElement());Ge(i.lastFocus,"aria-expanded",!0),i.removers.register(vT(this.elem,i.abort),ST(this.elem,i.abort),...this.children.map(n=>M0(n.getElement(),i.close,dZ)),t?.overrideFocusVisible&&DT(this.elem,s,t.overrideFocusVisible)),this.internalListener?.dispatch("expand-widget",this,{type:"expand-widget"}),this.children[0]?.focus({preventScroll:!0})}collapse(t){const{mode:i="0"}=t??{};if(this.expansionScope===void 0)return;const{lastFocus:s,removers:n,expandedSubMenu:o}=this.expansionScope;this.expansionScope=void 0,o?.collapse({mode:"3"}),Ge(s,"aria-expanded",!1),i==="0"&&s?.focus({preventScroll:!0}),n.flush(),this.internalListener?.dispatch("collapse-widget",this,{type:"collapse-widget",mode:i})}},vE="canvas-overlay",kk=class extends Ay{constructor(e,t,i){super(),this.ctx=e,this.hideFns=[],this.setOwnedWidget=(()=>{let s;return n=>{s?.destroy(),s=n}})(),this.moduleId=`popover-${t}`,i?.detached?this.element=De("div"):this.element=e.domManager.addChild(vE,this.moduleId),this.element.setAttribute("role","presentation"),this.hideFns.push(()=>this.setOwnedWidget(void 0)),this.cleanup.register(()=>e.domManager.removeChild(vE,this.moduleId))}attachTo(e){this.element.parentElement||e.element.append(this.element)}hide(e){const{lastFocus:t=this.lastFocus}=e??{};if(this.element.children.length!==0){for(const i of this.hideFns)i();t?.focus(),this.lastFocus=void 0}}removeChildren(){this.element.replaceChildren()}initPopoverElement(e,t){if(!this.element.parentElement)throw new Error("Can not show popover that has not been attached to a parent.");return e??(e=De("div","ag-charts-popover")),e.classList.toggle("ag-charts-popover",!0),t.ariaLabel!=null&&e.setAttribute("aria-label",t.ariaLabel),t.class!=null&&e.classList.add(t.class),this.element.replaceChildren(e),e}showWidget(e,t,i){this.setOwnedWidget(t),this.initPopoverElement(t.getElement(),i),t.addListener("collapse-widget",()=>{e.setControlled(void 0),this.setOwnedWidget(void 0)}),e.setControlled(t),e.expandControlled()}showWithChildren(e,t){const i=this.initPopoverElement(void 0,t);if(i.replaceChildren(...e),this.hideFns.push(()=>this.removeChildren()),t.onHide&&this.hideFns.push(t.onHide),t.initialFocus&&t.sourceEvent){const s=k0(t.sourceEvent);s!==void 0&&(this.lastFocus=s,this.initialFocus=t.initialFocus)}return i}getPopoverElement(){return this.element.firstElementChild}updatePosition(e){const t=this.getPopoverElement();t&&(t.style.setProperty("right","unset"),t.style.setProperty("bottom","unset"),e.x!=null&&t.style.setProperty("left",`${Math.floor(e.x)}px`),e.y!=null&&t.style.setProperty("top",`${Math.floor(e.y)}px`),this.initialFocus?.focus(),this.initialFocus=void 0)}},SE=class extends kk{setAnchor(e,t){this.anchor=e,this.fallbackAnchor=t,this.updatePosition(e),this.repositionWithinBounds()}updateAnchor(e){const t=e.anchor??this.anchor,i=e.fallbackAnchor??this.fallbackAnchor;t&&this.setAnchor(t,i)}showWidget(e,t,i){super.showWidget(e,t,i),this.updateAnchor(i)}showWithChildren(e,t){const i=super.showWithChildren(e,t);return this.updateAnchor(t),qe().requestAnimationFrame(()=>{this.repositionWithinBounds()}),i}repositionWithinBounds(){const{anchor:e,ctx:t,fallbackAnchor:i}=this,s=this.getPopoverElement();if(!e||!s)return;const n=t.domManager.getBoundingClientRect(),{offsetWidth:o,offsetHeight:a}=s;let r=ve(0,e.x,n.width-o),l=ve(0,e.y,n.height-a);r!==e.x&&i?.x!=null&&(r=ve(0,i.x-o,n.width-o)),l!==e.y&&i?.y!=null&&(l=ve(0,i.y-a,n.height-a)),this.updatePosition({x:r,y:l})}},uZ=class extends SE{show(e,t){const i=new Dk("vertical");for(const s of t.items)i.addChild(this.createRow(t,s,i));i.addClass("ag-charts-menu"),this.showWidget(e,i,t)}allocRow(e,t){if(e.menuItemRole==null||e.menuItemRole==="menuitem")return new qx;{e.menuItemRole;const i=new Mk;return i.setChecked(e.value===t.value),i}}createRow(e,t,i){const s=t.value===e.value,n=this.allocRow(e,t);if(n.addClass("ag-charts-menu__row"),n.toggleClass("ag-charts-menu__row--active",s),typeof t.value=="string"&&(n.getElement().dataset.popoverId=t.value),t.icon!=null){const a=De("span",`ag-charts-menu__icon ${jy(t.icon)}`);n.getElement().appendChild(a)}const o=t.strokeWidth!=null;if(o&&(n.toggleClass("ag-charts-menu__row--stroke-width-visible",o),n.setCSSVariable("--strokeWidth",o?`${t.strokeWidth}px`:null)),t.label!=null){const a=De("span","ag-charts-menu__label");a.textContent=this.ctx.localeManager.t(t.label),n.getElement().appendChild(a)}return"altText"in t&&n.setAriaLabel(this.ctx.localeManager.t(t.altText)),n.addListener("click",({sourceEvent:a})=>{e.onPress?.(t),a.preventDefault(),a.stopPropagation(),i.collapse()}),n}},ME=class extends kk{constructor(){super(...arguments),this.dragged=!1}setDragHandle(e){e.addListener("drag-start",t=>{e.addClass(this.dragHandleDraggingClass),this.onDragStart(t)}),e.addListener("drag-move",this.onDragMove.bind(this)),e.addListener("drag-end",()=>{e.removeClass(this.dragHandleDraggingClass),this.onDragEnd.bind(this)})}onDragStart(e){const t=this.getPopoverElement();t&&(e.sourceEvent.preventDefault(),this.dragged=!0,this.dragStartState={client:bu.from(e.clientX,e.clientY),position:bu.from(Number(t.style.getPropertyValue("left").replace("px","")),Number(t.style.getPropertyValue("top").replace("px","")))})}onDragMove(e){const{dragStartState:t}=this,i=this.getPopoverElement();if(!t||!i)return;const s=bu.sub(bu.from(e.clientX,e.clientY),t.client),n=bu.add(t.position,s),o=this.ctx.domManager.getBoundingClientRect(),a={};n.x>=0&&n.x+i.offsetWidth<=o.width&&(a.x=n.x),n.y>=0&&n.y+i.offsetHeight<=o.height&&(a.y=n.y),this.updatePosition(a)}onDragEnd(){this.dragStartState=void 0}},cf=class extends Le{};M([C],cf.prototype,"icon",2),M([C],cf.prototype,"label",2),M([C],cf.prototype,"ariaLabel",2),M([C],cf.prototype,"tooltip",2);var pZ={"disjoint-channel":"false","fibonacci-menu":"menu","fibonacci-retracement":"false","fibonacci-retracement-trend-based":"false","fill-color":"dialog","horizontal-line":"false","line-color":"dialog","line-menu":"menu","line-stroke-width":"menu","line-style-type":"menu","measurer-menu":"menu","pan-end":"false","pan-left":"false","pan-right":"false","pan-start":"false","parallel-channel":"false","shape-menu":"menu","text-color":"dialog","text-menu":"menu","text-size":"menu","vertical-line":"false","zoom-in":"false","zoom-out":"false",callout:"false",clear:"false",comment:"false",delete:"false",line:"false",lock:"false",menu:"menu",note:"false",reset:"false",settings:"dialog",text:"false"};function gZ(e){return typeof e!="string"?"false":pZ[e]}var DE=class extends Op{constructor(e){super(),this.localeManager=e}update(e){const{localeManager:t}=this;e.tooltip&&(this.elem.title=t.t(e.tooltip));let i="";if(e.icon!=null&&(i=``),e.label!=null){const n=t.t(e.label);i=`${i}${n}`}const s=gZ(e.value);s=="false"?(this.setAriaHasPopup(void 0),this.setAriaExpanded(void 0)):(this.setAriaHasPopup(s),this.setAriaExpanded(!1)),this.elem.innerHTML=i}setChecked(e){Ge(this.elem,"aria-checked",e)}},kE="ag-charts-toolbar__button--active",Ik=class extends qy{constructor({eventsHub:e,localeManager:t},i,s){super(s),this.ariaLabelId=i,this.horizontalSpacing=10,this.verticalSpacing=10,this.events=new VT,this.hasPrefix=!1,this.buttonWidgets=[],this.updateAriaLabel=()=>this.setAriaLabel(this.localeManager.t(this.ariaLabelId)),this.eventsHub=e,this.localeManager=t,this.addClass("ag-charts-toolbar"),this.toggleClass("ag-charts-toolbar--horizontal",s==="horizontal"),this.toggleClass("ag-charts-toolbar--vertical",s==="vertical"),this.eventsHub.on("locale:change",this.updateAriaLabel),this.updateAriaLabel()}setAriaLabelId(e){this.ariaLabelId=e,this.updateAriaLabel()}addToolbarListener(e,t){return this.events.addListener(e,t)}clearButtons(){this.expanded?.collapse({mode:"2"});for(const e of this.buttonWidgets)e.destroy();this.buttonWidgets.splice(0)}updateButtons(e){const{buttonWidgets:t}=this;for(const[i,s]of e.entries())(this.buttonWidgets.at(i)??this.createButton(i,s)).update(s);for(let i=e.length;ithis.getButtonWidgetBounds(e))}setButtonHiddenByIndex(e,t){this.buttonWidgets.at(e)?.setHidden(t)}getButtonWidgetBounds(e){const t=this.getBounds(),i=e.getBounds();return new de(i.x+t.x,i.y+t.y,i.width,i.height)}refreshButtonClasses(){const{buttonWidgets:e,hasPrefix:t}=this;let i,s,n;for(const[o,a]of e.entries())i=!t&&o===0||n!=a.section,s=o===e.length-1||a.section!=e.at(o+1)?.section,a.toggleClass("ag-charts-toolbar__button--first",i),a.toggleClass("ag-charts-toolbar__button--last",s),a.toggleClass("ag-charts-toolbar__button--gap",o>0&&i),n=a.section}createButton(e,t){const i=this.createButtonWidget();return i.addClass("ag-charts-toolbar__button"),i.addListener("click",s=>{const n={index:e,...t instanceof Le?t.toJson():t},o=this.getButtonWidgetBounds(i),a={event:s,button:n,buttonBounds:o,buttonWidget:i};this.events.dispatch("button-pressed",a)}),i.addListener("focus",()=>{const s={button:{index:e}};this.events.dispatch("button-focused",s)}),i.addListener("expand-controlled-widget",s=>{this.expanded?.collapse({mode:"4"}),this.expanded=s.controlled;const n=this.expanded.addListener("collapse-widget",()=>{this.expanded=void 0,n()})}),t.section&&(i.section=t.section),this.buttonWidgets.push(i),this.addChild(i),i}},fZ=class extends Ik{createButtonWidget(){return new DE(this.localeManager)}},yZ=class extends ME{constructor(e,t,i){super(e,t),this.onPopoverMoved=i,this.dragHandleDraggingClass="ag-charts-floating-toolbar__drag-handle--dragging"}show(e,t={}){this.showWithChildren(e,{...t,class:"ag-charts-floating-toolbar"})}hide(){this.dragged=!1,super.hide()}getBounds(){const e=this.getPopoverElement();return new de(e?.offsetLeft??0,e?.offsetTop??0,e?.offsetWidth??0,e?.offsetHeight??0)}hasBeenDragged(){return this.dragged}setAnchor(e,t,i){const s=this.getPopoverElement();if(!s)return;const n=e.position??"above",{offsetWidth:o,offsetHeight:a}=s;let r=e.y-a-i,l=e.x-o/2;n==="below"?r=e.y+i:n==="right"?(r=e.y-a/2,l=e.x+t):n==="above-left"&&(l=e.x),this.updatePosition({x:l,y:r})}ignorePointerEvents(){const e=this.getPopoverElement();e&&(e.style.pointerEvents="none")}capturePointerEvents(){const e=this.getPopoverElement();e&&(e.style.pointerEvents="unset")}updatePosition(e){const t=this.getBounds(),i=this.ctx.domManager.getBoundingClientRect();e.x=Math.floor(ve(0,e.x,i.width-t.width)),e.y=Math.floor(ve(0,e.y,i.height-t.height)),super.updatePosition(e),this.onPopoverMoved()}},mZ=class extends Ik{constructor(e,t,i){super(e,t,"horizontal"),this.hasPrefix=!0,this.popover=new yZ(e,i,this.onPopoverMoved.bind(this)),this.dragHandle=new xZ(e.localeManager.t("toolbarAnnotationsDragHandle")),this.popover.setDragHandle(this.dragHandle)}destroy(){super.destroy(),this.popover.destroy()}show(e={}){this.popover.show([this.dragHandle.getElement(),this.getElement()],e)}hide(){this.popover.hide()}setAnchor(e){this.popover.setAnchor(e,this.horizontalSpacing,this.verticalSpacing)}hasBeenDragged(){return this.popover.hasBeenDragged()}ignorePointerEvents(){this.popover.ignorePointerEvents()}capturePointerEvents(){this.popover.capturePointerEvents()}onPopoverMoved(){const e=this.popover.getBounds();if(this.popoverBounds?.equals(e))return;this.popoverBounds=e.clone();const t=this.getButtonBounds();this.events.dispatch("toolbar-moved",{popoverBounds:e,buttonBounds:t})}getButtonWidgetBounds(e){const t=this.popover.getBounds(),i=super.getButtonWidgetBounds(e),s=this.dragHandle.getBounds();return new de(i.x+t.x-s.width,i.y+t.y,i.width,i.height)}},xZ=class extends Md{constructor(e){super(De("div","ag-charts-floating-toolbar__drag-handle"));const t=new Md(De("span",`${jy("drag-handle")} ag-charts-toolbar__icon`));t.setAriaHidden(!0),this.addChild(t),this.elem.title=e}},bZ={...Cw,...Lw},vZ={VERSION:fr,_Scene:$x,_Theme:Ux,_Util:Kx,create:So.create.bind(So),createSparkline:So.__createSparkline.bind(So),setup:Gx,isEnterprise:!1},SZ=Object.defineProperty,MZ=Object.getOwnPropertyDescriptor,y=(e,t,i,s)=>{for(var n=s>1?void 0:s?MZ(t,i):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(n=(s?a(t,i,n):a(n))||n);return s&&n&&SZ(t,i,n),n},DZ=class{constructor(){this.ieCompatibility=!1}init(){this.ieCompatibility=this.md5("hello")!="5d41402abc4b2a76b9719d911017c592"}md5cycle(e,t){let i=e[0],s=e[1],n=e[2],o=e[3];i=this.ff(i,s,n,o,t[0],7,-680876936),o=this.ff(o,i,s,n,t[1],12,-389564586),n=this.ff(n,o,i,s,t[2],17,606105819),s=this.ff(s,n,o,i,t[3],22,-1044525330),i=this.ff(i,s,n,o,t[4],7,-176418897),o=this.ff(o,i,s,n,t[5],12,1200080426),n=this.ff(n,o,i,s,t[6],17,-1473231341),s=this.ff(s,n,o,i,t[7],22,-45705983),i=this.ff(i,s,n,o,t[8],7,1770035416),o=this.ff(o,i,s,n,t[9],12,-1958414417),n=this.ff(n,o,i,s,t[10],17,-42063),s=this.ff(s,n,o,i,t[11],22,-1990404162),i=this.ff(i,s,n,o,t[12],7,1804603682),o=this.ff(o,i,s,n,t[13],12,-40341101),n=this.ff(n,o,i,s,t[14],17,-1502002290),s=this.ff(s,n,o,i,t[15],22,1236535329),i=this.gg(i,s,n,o,t[1],5,-165796510),o=this.gg(o,i,s,n,t[6],9,-1069501632),n=this.gg(n,o,i,s,t[11],14,643717713),s=this.gg(s,n,o,i,t[0],20,-373897302),i=this.gg(i,s,n,o,t[5],5,-701558691),o=this.gg(o,i,s,n,t[10],9,38016083),n=this.gg(n,o,i,s,t[15],14,-660478335),s=this.gg(s,n,o,i,t[4],20,-405537848),i=this.gg(i,s,n,o,t[9],5,568446438),o=this.gg(o,i,s,n,t[14],9,-1019803690),n=this.gg(n,o,i,s,t[3],14,-187363961),s=this.gg(s,n,o,i,t[8],20,1163531501),i=this.gg(i,s,n,o,t[13],5,-1444681467),o=this.gg(o,i,s,n,t[2],9,-51403784),n=this.gg(n,o,i,s,t[7],14,1735328473),s=this.gg(s,n,o,i,t[12],20,-1926607734),i=this.hh(i,s,n,o,t[5],4,-378558),o=this.hh(o,i,s,n,t[8],11,-2022574463),n=this.hh(n,o,i,s,t[11],16,1839030562),s=this.hh(s,n,o,i,t[14],23,-35309556),i=this.hh(i,s,n,o,t[1],4,-1530992060),o=this.hh(o,i,s,n,t[4],11,1272893353),n=this.hh(n,o,i,s,t[7],16,-155497632),s=this.hh(s,n,o,i,t[10],23,-1094730640),i=this.hh(i,s,n,o,t[13],4,681279174),o=this.hh(o,i,s,n,t[0],11,-358537222),n=this.hh(n,o,i,s,t[3],16,-722521979),s=this.hh(s,n,o,i,t[6],23,76029189),i=this.hh(i,s,n,o,t[9],4,-640364487),o=this.hh(o,i,s,n,t[12],11,-421815835),n=this.hh(n,o,i,s,t[15],16,530742520),s=this.hh(s,n,o,i,t[2],23,-995338651),i=this.ii(i,s,n,o,t[0],6,-198630844),o=this.ii(o,i,s,n,t[7],10,1126891415),n=this.ii(n,o,i,s,t[14],15,-1416354905),s=this.ii(s,n,o,i,t[5],21,-57434055),i=this.ii(i,s,n,o,t[12],6,1700485571),o=this.ii(o,i,s,n,t[3],10,-1894986606),n=this.ii(n,o,i,s,t[10],15,-1051523),s=this.ii(s,n,o,i,t[1],21,-2054922799),i=this.ii(i,s,n,o,t[8],6,1873313359),o=this.ii(o,i,s,n,t[15],10,-30611744),n=this.ii(n,o,i,s,t[6],15,-1560198380),s=this.ii(s,n,o,i,t[13],21,1309151649),i=this.ii(i,s,n,o,t[4],6,-145523070),o=this.ii(o,i,s,n,t[11],10,-1120210379),n=this.ii(n,o,i,s,t[2],15,718787259),s=this.ii(s,n,o,i,t[9],21,-343485551),e[0]=this.add32(i,e[0]),e[1]=this.add32(s,e[1]),e[2]=this.add32(n,e[2]),e[3]=this.add32(o,e[3])}cmn(e,t,i,s,n,o){return t=this.add32(this.add32(t,e),this.add32(s,o)),this.add32(t<>>32-n,i)}ff(e,t,i,s,n,o,a){return this.cmn(t&i|~t&s,e,t,n,o,a)}gg(e,t,i,s,n,o,a){return this.cmn(t&s|i&~s,e,t,n,o,a)}hh(e,t,i,s,n,o,a){return this.cmn(t^i^s,e,t,n,o,a)}ii(e,t,i,s,n,o,a){return this.cmn(i^(t|~s),e,t,n,o,a)}md51(e){const t=e.length,i=[1732584193,-271733879,-1732584194,271733878];let s;for(s=64;s<=e.length;s+=64)this.md5cycle(i,this.md5blk(e.substring(s-64,s)));e=e.substring(s-64);const n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(s=0;s>2]|=e.charCodeAt(s)<<(s%4<<3);if(n[s>>2]|=128<<(s%4<<3),s>55)for(this.md5cycle(i,n),s=0;s<16;s++)n[s]=0;return n[14]=t*8,this.md5cycle(i,n),i}md5blk(e){const t=[];for(let i=0;i<64;i+=4)t[i>>2]=e.charCodeAt(i)+(e.charCodeAt(i+1)<<8)+(e.charCodeAt(i+2)<<16)+(e.charCodeAt(i+3)<<24);return t}rhex(e){const t="0123456789abcdef".split("");let i="",s=0;for(;s<4;s++)i+=t[e>>s*8+4&15]+t[e>>s*8&15];return i}hex(e){for(let t=0;t>16)+(t>>16)+(i>>16)<<16|i&65535}};function Ak(e){return e==null||e.length===0}var Qx={"01":"GRID","02":"CHARTS","0102":"BOTH"},IE="https://www.ag-grid.com/charts/licensing/",Ck=class Vi{constructor(t){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=t,this.md5=new DZ,this.md5.init()}validateLicense(){const t=this.getLicenseDetails(Vi.licenseKey,Vi.gridContext),i=`AG ${t.currentLicenseType==="BOTH"?"Grid and ":""}Charts Enterprise`;let s="";if(t.suppliedLicenseType==="BOTH"?s="AG Grid and AG Charts Enterprise":t.suppliedLicenseType==="GRID"?s="AG Grid Enterprise":t.suppliedLicenseType!==void 0&&(s="AG Charts Enterprise"),t.missing)(!this.isWebsiteUrl()||this.isForceWatermark())&&this.outputMissingLicenseKey(i);else if(t.expired){const n=Vi.getChartsReleaseDate(),o=Vi.formatDate(n);this.outputExpiredKey(t.expiry,o,s)}else t.valid?t.isTrial&&t.trialExpired&&this.outputExpiredTrialKey(t.expiry,i,s):this.outputInvalidLicenseKey(!!t.incorrectLicenseType,i,s)}static extractExpiry(t){const i=t.substring(t.lastIndexOf("_")+1,t.length);return new Date(Number.parseInt(Vi.decode(i),10))}static extractLicenseComponents(t){let i=t.replaceAll(/[\u200B-\u200D\uFEFF]/g,"");if(i=i.replaceAll(/\r?\n|\r/g,""),t.length<=32)return{md5:null,license:t,version:null,isTrial:null};const s=i.length-32,n=i.substring(s),o=i.substring(0,s),[a,r,l]=Vi.extractBracketedInformation(i);return{md5:n,license:o,version:a,isTrial:r,type:l}}getLicenseDetails(t,i=!1){const s="CHARTS";if(Ak(t))return{licenseKey:t,valid:!1,missing:!0,currentLicenseType:s};const n=Vi.getChartsReleaseDate(),{md5:o,license:a,version:r,isTrial:l,type:c}=Vi.extractLicenseComponents(t);let h=o===this.md5.md5(a)&&!t.includes("For_Trialing_ag-Grid_Only"),d,u,p=null,g=!1,f;function x(){d=pp,r){case"legacy":case"2":{h=!1;break}case"3":Ak(c)?h=!1:(f=c,c!==Qx["02"]&&c!==Qx["0102"]?(h=!1,g=!0):l&&x())}return h?{licenseKey:t,valid:h,expiry:Vi.formatDate(p),expired:u,version:r,isTrial:l,trialExpired:d,invalidLicenseTypeForCombo:i?f!=="BOTH":void 0,incorrectLicenseType:g,currentLicenseType:s,suppliedLicenseType:f}:{licenseKey:t,valid:h,incorrectLicenseType:g,currentLicenseType:s,suppliedLicenseType:f}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isE2ETest()&&!this.isWebsiteUrl()&&!Ak(this.watermarkMessage)}getWatermarkMessage(){return this.watermarkMessage??""}getHostname(){if(!this.document)return"localhost";const t=this.document.defaultView??globalThis;if(!t)return"localhost";const i=t.location,{hostname:s=""}=i;return s}isForceWatermark(){if(!this.document)return!1;const t=this.document?.defaultView??globalThis.window!=null?globalThis:void 0;if(!t)return!1;const{pathname:i}=t.location;return i?i.includes("forceWatermark"):!1}isWebsiteUrl(){const t=this.getHostname();return/^((?:[\w-]+\.)?ag-grid\.com)$/.exec(t)!==null}isLocalhost(){const t=this.getHostname();return/^(?:127\.0\.0\.1|localhost)$/.exec(t)!==null}isE2ETest(){const t=this.getHostname();return/^(?:172\.17\.0\.1|host\.docker\.internal)$/.exec(t)!==null}static formatDate(t){const i=["January","February","March","April","May","June","July","August","September","October","November","December"],s=t.getDate(),n=t.getMonth(),o=t.getFullYear();return s+" "+i[n]+" "+o}static getChartsReleaseDate(){return new Date(Number.parseInt(Vi.decode(Vi.RELEASE_INFORMATION),10))}static decode(t){const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let s="",n,o,a,r,l,c,h,d=0;const u=t.replaceAll(/[^A-Za-z0-9+/=]/g,"");for(;d>4,o=(l&15)<<4|c>>2,a=(c&3)<<6|h,s=s+String.fromCodePoint(n),c!=64&&(s=s+String.fromCodePoint(o)),h!=64&&(s=s+String.fromCodePoint(a));return s=Vi.utf8_decode(s),s}static utf8_decode(t){t=t.replaceAll("rn","n");let i="";for(let s=0;s127&&n<2048?(i+=String.fromCodePoint(n>>6|192),i+=String.fromCodePoint(n&63|128)):(i+=String.fromCodePoint(n>>12|224),i+=String.fromCodePoint(n>>6&63|128),i+=String.fromCodePoint(n&63|128))}return i}static setGridContext(t=!1){Vi.gridContext=t}static setLicenseKey(t){this.licenseKey&&this.licenseKey!==t&&console.warn("License Key being set multiple times with different values. This can result in an incorrect license key being used."),Vi.licenseKey=t}static extractBracketedInformation(t){if(!t.includes("["))return["legacy",!1,void 0];const i=t.match(/\[(.*?)\]/g).map(r=>r.replace("[","").replace("]",""));if(!i||i.length===0)return["legacy",!1,void 0];const s=i.filter(r=>r==="TRIAL").length===1,n=i.find(r=>r.startsWith("v")),o=n?n.replace("v",""):"legacy",a=Qx[i.find(r=>Qx[r])];return[o,s,a]}centerPadAndOutput(t){const i=this.totalMessageLength-t.length;console.error(t.padStart(i/2+t.length,"*").padEnd(this.totalMessageLength,"*"))}padAndOutput(t,i="*",s=""){console.error(t.padEnd(this.totalMessageLength-s.length,i)+s)}outputInvalidLicenseKey(t,i,s){Vi.gridContext||(t?(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Incompatible License Key "),this.padAndOutput(`* Your license key is for ${s} only and does not cover you for ${i}.`," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${IE}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")):(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Invalid License Key "),this.padAndOutput("* Your license key is not valid."," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${IE}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput(""))),this.watermarkMessage="Invalid License"}outputExpiredTrialKey(t,i,s){Vi.gridContext||(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Trial Period Expired. "),this.padAndOutput(`* Your trial only license for ${s} expired on ${t}.`," ","*"),this.padAndOutput("* Please email info@ag-grid.com to purchase a license."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="Trial Period Expired"}outputMissingLicenseKey(t){Vi.gridContext||(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${t} License `),this.centerPadAndOutput(" License Key Not Found "),this.padAndOutput(`* All ${t} features are unlocked for trial.`," ","*"),this.padAndOutput("* If you want to hide the watermark please email info@ag-grid.com for a trial license key."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="For Trial Use Only"}outputExpiredKey(t,i,s){Vi.gridContext||(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${s} License `),this.centerPadAndOutput(" Incompatible Software Version "),this.padAndOutput(`* Your license key works with versions of ${s} released before ${t}.`," ","*"),this.padAndOutput(`* The version you are trying to use was released on ${i}.`," ","*"),this.padAndOutput("* Please contact info@ag-grid.com to renew your license key."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="License Expired"}};Ck.RELEASE_INFORMATION="MTc2MTcyODQ5OTU1NQ==",Ck.gridContext=!1;var Su=Ck;function Lk(e,t,i){const s=(o,a,r,l)=>{let c=e[0];for(let h=o;r>0?h<=a:h>a;h+=r){const d=e[h];if(l(c,d))return!0;c=d}return!1},n=Math.floor(e.length/2);return s(t,n,t,i)?!0:s(e.length-t,n,-t,i)}var{AxisInterval:kZ,Property:IZ}=k,Tk=class extends kZ{};y([IZ],Tk.prototype,"minSpacing",2);var{BaseProperties:AE,ChartAxisDirection:AZ,Property:ni,Group:wk,FONT_SIZE:CZ}=k,la=class extends AE{constructor(){super(...arguments),this.fontSize=CZ.LARGE,this.fontFamily="Verdana, sans-serif",this.padding=5,this.color="rgba(87, 87, 87, 1)"}};y([ni],la.prototype,"enabled",2),y([ni],la.prototype,"text",2),y([ni],la.prototype,"fontStyle",2),y([ni],la.prototype,"fontWeight",2),y([ni],la.prototype,"fontSize",2),y([ni],la.prototype,"fontFamily",2),y([ni],la.prototype,"padding",2),y([ni],la.prototype,"color",2),y([ni],la.prototype,"parallel",2);var an=class extends AE{constructor(){super(...arguments),this.id=hs(this),this.defaultColorRange=[],this.shape="polygon",this.label=new la,this.scale=void 0,this.clippedRange=[-1/0,1/0],this.gridLength=0,this.sideFlag=-1,this.parallelFlipRotation=0,this.regularFlipRotation=0,this.direction=AZ.Angle,this.axisInnerRadius=0,this.axisOuterRadius=0,this.lineGroup=new wk({name:this.id}),this.rangeGroup=new wk({name:this.id}),this.labelGroup=new wk({name:this.id}),this._isRange=void 0}assignCrossLineGroup(e,t){e!==this._isRange&&(e?this.rangeGroup.appendChild(t):this.lineGroup.appendChild(t)),this._isRange=e}setSectorNodeProps(e){e.fill=this.fill,e.fillOpacity=this.fillOpacity??1,e.stroke=this.stroke,e.strokeOpacity=this.strokeOpacity??1,e.strokeWidth=this.strokeWidth??1,e.lineDash=this.lineDash}setLabelNodeProps(e,t,i,s,n){const{label:o}=this;e.x=t,e.y=i,e.text=o.text,e.textAlign="center",e.textBaseline=s,e.rotation=n,e.rotationCenterX=t,e.rotationCenterY=i,e.fill=o.color,e.fontFamily=o.fontFamily,e.fontSize=o.fontSize,e.fontStyle=o.fontStyle,e.visible=!0}};y([ni],an.prototype,"enabled",2),y([ni],an.prototype,"type",2),y([ni],an.prototype,"range",2),y([ni],an.prototype,"value",2),y([ni],an.prototype,"defaultColorRange",2),y([ni],an.prototype,"fill",2),y([ni],an.prototype,"fillOpacity",2),y([ni],an.prototype,"stroke",2),y([ni],an.prototype,"strokeWidth",2),y([ni],an.prototype,"strokeOpacity",2),y([ni],an.prototype,"lineDash",2),y([ni],an.prototype,"shape",2),y([ni],an.prototype,"label",2);var{ChartAxisDirection:LZ,getCrossLineValue:TZ,validateCrossLineValue:wZ,normalizeAngle360:Nk,Group:NZ,Path:CE,Sector:OZ,RotatableText:EZ,ContinuousScale:PZ}=k,Ok=class extends an{constructor(){super(),this.direction=LZ.Angle,this.polygonNode=new CE,this.sectorNode=new OZ,this.lineNode=new CE,this.crossLineRange=new NZ,this.labelNode=new EZ,this.ticks=[],this.crossLineRange.append(this.polygonNode),this.crossLineRange.append(this.sectorNode),this.crossLineRange.append(this.lineNode),this.labelGroup.append(this.labelNode)}visibilityCheck(){if(!PZ.is(this.scale))return!0;const[e,t]=this.scale.domain,i=TZ(this);if(this.type==="range"){const[s,n]=i;return s>=e&&s<=t&&n>=s&&n<=t}else return i>=e&&i<=t}update(e){const{scale:t}=this;if(!t||!wZ(this,t)||!this.visibilityCheck()){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.rangeGroup.visible=e,this.lineGroup.visible=e,this.labelGroup.visible=e,this.updateLineNode(e),this.updatePolygonNode(e),this.updateSectorNode(e),this.updateLabelNode(e)}updateLineNode(e){const{scale:t,type:i,value:s,lineNode:n}=this;if(!e||i!=="line"||!t){n.visible=!1;return}const o=t.convert(s);if(Number.isNaN(o)){n.visible=!1;return}const{axisInnerRadius:a,axisOuterRadius:r}=this;n.visible=!0,n.stroke=this.stroke,n.strokeOpacity=this.strokeOpacity??1,n.strokeWidth=this.strokeWidth??1,n.fill=void 0,n.lineDash=this.lineDash;const l=r*Math.cos(o),c=r*Math.sin(o),h=a*Math.cos(o),d=a*Math.sin(o);n.path.clear(!0),n.path.moveTo(h,d),n.path.lineTo(l,c),this.assignCrossLineGroup(!1,this.crossLineRange)}updatePolygonNode(e){const{polygonNode:t,range:i,scale:s,shape:n,type:o,ticks:a}=this;if(!e||o!=="range"||n!=="polygon"||!s||!i){t.visible=!1;return}const{axisInnerRadius:r,axisOuterRadius:l}=this,c=a.indexOf(i[0]),h=a.indexOf(i[1]),u=(c<=h?a.slice(c,h+1):a.slice(c).concat(a.slice(0,h+1))).map(g=>s.convert(g));t.visible=!0,this.setSectorNodeProps(t);const{path:p}=t;p.clear(!0);for(const[g,f]of u.entries()){const x=l*Math.cos(f),m=l*Math.sin(f);g===0?p.moveTo(x,m):p.lineTo(x,m)}if(r===0)p.lineTo(0,0);else{const g=u.slice().reverse();for(const f of g){const x=r*Math.cos(f),m=r*Math.sin(f);p.lineTo(x,m)}}t.path.closePath(),this.assignCrossLineGroup(!0,this.crossLineRange)}updateSectorNode(e){const{sectorNode:t,range:i,scale:s,shape:n,type:o}=this;if(!e||o!=="range"||n!=="circle"||!s||!i){t.visible=!1;return}const{axisInnerRadius:a,axisOuterRadius:r}=this,l=i.map(d=>s.convert(d)),c=s.step??0,h=s instanceof k.BandScale?c/2:0;t.visible=!0,this.setSectorNodeProps(t),t.centerX=0,t.centerY=0,t.innerRadius=a,t.outerRadius=r,t.startAngle=l[0]-h,t.endAngle=l[1]+h,this.assignCrossLineGroup(!0,this.crossLineRange)}updateLabelNode(e){const{label:t,labelNode:i,range:s,scale:n,type:o,ticks:a}=this;if(!e||t.enabled===!1||!t.text||!n||o==="range"&&!s){i.visible=!1;return}i.visible=!0;const{axisInnerRadius:r,axisOuterRadius:l}=this;let c,h,d,u;if(o==="line"){const p=Nk(n.convert(this.value)),g=1.5*Math.PI,f=Qe(p,g)||p>g||pNk(n.convert(v)));let f=(p+g)/2;p>g&&(f-=Math.PI),f=Nk(f);const x=(Qe(f,0)||f>0)&&fl.value),r=a.reduce((l,c)=>Math.max(typeof c=="number"?dp(c):0,l),0);return{niceDomain:n,tickDomain:n,ticks:a,rawTickCount:void 0,fractionDigits:r,timeInterval:void 0,bbox:this.getBBox()}}update(){super.update(),this.updateRadiusLine(),this.updateGridLines(),this.updateTickLines()}normalizedAngles(){const e=_l(-Math.PI/2+hf(this.startAngle)),t=this.endAngle==null?2*Math.PI:zZ(hf(this.endAngle)-hf(this.startAngle)),i=e+t;return[e,i]}computeRange(){this.range=this.normalizedAngles()}updateSelections(){const e=this.tickData;this.gridLineGroupSelection.update(this.gridLength&&this.gridLine.enabled?e:[]),this.tickLineGroupSelection.update(this.tick.enabled?e:[]),this.tickLabelGroupSelection.update(this.label.enabled?e:[]),this.gridLineGroupSelection.cleanup(),this.tickLineGroupSelection.cleanup(),this.tickLabelGroupSelection.cleanup()}updatePosition(){super.updatePosition();const{translation:e,radiusLineGroup:t}=this,i=Math.floor(e.x),s=Math.floor(e.y);t.translationX=i,t.translationY=s}updateRadiusLine(){const e=this.radiusLine,{path:t}=e;t.clear(!0);const{points:i,closePath:s}=this.getAxisLinePoints();for(const{x:n,y:o,moveTo:a,arc:r,radius:l=0,startAngle:c=0,endAngle:h=0}of i)r?t.arc(n,o,l,c,h):a?t.moveTo(n,o):t.lineTo(n,o);s&&t.closePath(),e.visible=this.line.enabled,e.stroke=this.line.stroke,e.strokeWidth=this.line.width,e.fill=void 0}getAxisLinePoints(){const{scale:e,shape:t,gridLength:i}=this,[s,n]=this.range,o=Qe(n-s,2*Math.PI),a=[];if(t==="circle")o?a.push({x:i,y:0,moveTo:!0},{x:0,y:0,radius:i,startAngle:0,endAngle:2*Math.PI,arc:!0,moveTo:!1}):a.push({x:i*Math.cos(s),y:i*Math.sin(s),moveTo:!0},{x:0,y:0,radius:i,startAngle:_l(s),endAngle:_l(n),arc:!0,moveTo:!1});else if(t==="polygon"){const r=e.ticks({nice:this.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0})?.ticks?.map(l=>e.convert(l));if(r&&r.length>2)for(const[l,c]of r.entries()){const h=i*Math.cos(c),d=i*Math.sin(c),u=l===0;a.push({x:h,y:d,moveTo:u})}}return{points:a,closePath:o}}updateGridLines(){const{scale:e,gridLength:t,gridLine:{style:i,width:s},innerRadiusRatio:n}=this;if(!(i&&t>0))return;const o=t*n,a=i.length;this.gridLineGroupSelection.each((r,l,c)=>{const{value:h}=l,{stroke:d,lineDash:u}=i[c%a],p=e.convert(h);r.x1=o*Math.cos(p),r.y1=o*Math.sin(p),r.x2=t*Math.cos(p),r.y2=t*Math.sin(p),r.stroke=d,r.strokeWidth=s,r.lineDash=u,r.fill=void 0}),this.gridLineGroupSelection.cleanup()}updateLabels(){const{label:e,tickLabelGroupSelection:t}=this;t.each((i,s,n)=>{const o=this.labelData[n];if(!o||o.hidden){i.visible=!1;return}i.text=o.text,i.setFont(e),i.fill=e.color,i.x=o.x,i.y=o.y,i.setAlign(o),i.setBoxing(e),i.visible=!0,o.rotation?(i.rotation=o.rotation,i.rotationCenterX=o.x,i.rotationCenterY=o.y):i.rotation=0})}updateTickLines(){const{scale:e,gridLength:t,tick:i,tickLineGroupSelection:s}=this;s.each((n,o)=>{const{value:a}=o,r=e.convert(a),l=Math.cos(r),c=Math.sin(r);n.x1=t*l,n.y1=t*c,n.x2=(t+i.size)*l,n.y2=(t+i.size)*c,n.stroke=i.stroke,n.strokeWidth=i.width})}createLabelNodeData(e,t,i){const{label:s,gridLength:n,scale:o,tick:a}=this;if(!s.enabled)return[];const r=new BZ,l=i.x-this.translation.x,c=i.x+i.width-this.translation.x,{fractionDigits:h}=this.layout.label,d=this.tickFormatter(this.scale.domain,this.tickData,!1,h),u=e.map((p,g)=>{const{value:f}=p,x=n+s.spacing+a.size,m=o.convert(f),v=Math.cos(m),b=Math.sin(m),S=x*v,D=x*b,{textAlign:L,textBaseline:I}=this.getLabelAlign(m),A=g===e.length-1&&f!==e[0]&&Qe(_l(m),_l(o.convert(e[0]))),T=this.getLabelRotation(m);let w=d(f,g);r.text=w,r.x=S,r.y=D,r.setFont(s),r.textAlign=L,r.textBaseline=I,r.rotation=T,T&&(r.rotationCenterX=S,r.rotationCenterY=D);let N=T?_Z.toCanvas(r):r.getBBox();if(N&&t.hideWhenNecessary&&!T){const O=l-N.x,P=N.x+N.width-c,F=1;if(O>F||P>F){const z={maxWidth:N.width-Math.max(O,P),font:s,textWrap:"never"};w=Dy(w,z),r.text=w,N=r.getBBox()}}return{text:w,x:S,y:D,textAlign:L,textBaseline:I,hidden:w===""||(p.hidden??A),rotation:T,box:N}});return s.avoidCollisions&&this.avoidLabelCollisions(u),u}computeLabelsBBox(e,t){this.labelData=this.createLabelNodeData(this.tickData,e,t);const i=this.labelData.map(({box:s})=>s).filter(s=>s!=null);return!this.label.enabled||i.length===0?null:VZ.merge(i)}getLabelOrientation(){const{label:e}=this;return e instanceof Pk?e.orientation:"fixed"}getLabelRotation(e){let t=hf(this.label.rotation??0);e=_l(e);const i=this.getLabelOrientation();return i==="parallel"?(t+=e,e>=0&&e=Math.PI/2&&e<1.5*Math.PI&&(t+=Math.PI)),t}getLabelAlign(e){const t=Math.cos(e),i=Math.sin(e);let s,n;const o=this.getLabelOrientation(),a=Qe(t,0),r=Qe(i,0),l=Qe(t,1),c=Qe(i,-1),h=t>0&&!a,d=i>0&&!r;return o==="parallel"?(s="center",n=l&&r||d?"top":"bottom"):o==="perpendicular"?(s=c||h?"left":"right",n="middle"):(s="right",a?s="center":h&&(s="left"),n="bottom",r?n="middle":d&&(n="top")),{textAlign:s,textBaseline:n}}updateCrossLines(){const{shape:e,gridLength:t,innerRadiusRatio:i}=this;for(const s of this.crossLines)s instanceof Ok&&(s.ticks=this.tickData.map(n=>n.value),s.shape=e,s.axisOuterRadius=t,s.axisInnerRadius=t*i);super.updateCrossLines()}};df.CrossLineConstructor=Ok,y([Ek],df.prototype,"startAngle",2),y([Ek],df.prototype,"endAngle",2);var{Property:Rk,CategoryScale:GZ}=k,Vl=class extends df{constructor(e){super(e,new GZ),this.groupPaddingInner=0,this.paddingInner=0,this.interval=new Tk}hasDefinedDomain(){return!1}generateAngleTicks(e){const{scale:t,gridLength:i}=this,{values:s,minSpacing:n}=this.interval,o={nice:this.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0},a=s??t.ticks(o,e)?.ticks??[];if(a.length<2||n==null)return a.map(d=>({value:d,visible:!0}));const r=a[0],l=t.convert(r),c=i*Math.cos(l),h=i*Math.sin(l);for(let d=1;dMath.PI)break;const g=i*Math.cos(p),f=i*Math.sin(p);if(Math.hypot(g-c,f-h)>n){const m=new Set([r]);return Lk(a,d,(v,b)=>{m.add(b)}),a.map(v=>{const b=m.has(v);return{value:v,visible:b}})}}return[{value:r,visible:!0}]}avoidLabelCollisions(e){const{minSpacing:t}=this.label;if(e.length<3)return;const i=(l,c)=>{if(l.hidden||c.hidden)return!1;if(t==null)return l.box.collidesBBox(c.box);const h=l.box.clone().grow(t/2),d=c.box.clone().grow(t/2);return h.collidesBBox(d)},s=e[0],n=e.at(-1),o=new Set([s]),a=Qe(s.x,n.x)&&Qe(s.y,n.y),r=Math.floor(e.length/2);for(let l=1;l<=r;l++){const c=a?e.slice(0,-1):e;if(!Lk(c,l,i)){Lk(c,l,(d,u)=>{o.add(u)});break}}for(const l of e)o.has(l)||(l.hidden=!0,l.box=void 0)}tickFormatParams(){return{type:"category"}}datumFormatParams(e,t){const{datum:i,seriesId:s,legendItemName:n,key:o,source:a,property:r,domain:l,boundSeries:c}=t;return{type:"category",value:e,datum:i,seriesId:s,legendItemName:n,key:o,source:a,property:r,domain:l,boundSeries:c}}};Vl.className="AngleCategoryAxis",Vl.type="angle-category",y([Rk],Vl.prototype,"groupPaddingInner",2),y([Rk],Vl.prototype,"paddingInner",2),y([Rk],Vl.prototype,"interval",2);var jZ={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"angle-category",moduleFactory:e=>new Vl(e)},{range:wE,isDenseInterval:HZ,LinearScale:zk}=k,NE=class TC extends zk{constructor(){super(...arguments),this.arcLength=0}static getNiceStepAndTickCount(t,i){const[s,n]=i;let o=zk.getTickStep(s,n,t);const a=Number.isNaN(t.maxTickCount)?1/0:t.maxTickCount,r=Math.abs(n-s)/o;let l=Math.pow(2,Math.ceil(Math.log(r)/Math.log(2)));return l>a&&(l/=2,o*=2),{count:l,step:o}}ticks(t,i=this.domain){const{arcLength:s}=this;if(!i||i.length<2||i.some(c=>!Number.isFinite(c))||s<=0)return{ticks:[],count:0};const{nice:n,interval:o}=t,[a,r]=i;if(o){const c=Math.abs(o),h=this.getPixelRange();if(!HZ((r-a)/c,h))return wE(a,r,c)}let l;if(n&&this.hasNiceRange()){const c=super.niceDomain(t,i);l=TC.getNiceStepAndTickCount(t,c).step}else l=zk.getTickStep(a,r,t);return wE(a,r,l)}hasNiceRange(){const t=this.range.slice().sort((s,n)=>s-n);return[Math.PI,2*Math.PI].some(s=>Qe(s,t[1]-t[0]))}niceDomain(t,i=this.domain){const s=super.niceDomain(t,i);if(!this.hasNiceRange())return s;const n=s[0]>s[1],o=n?s[1]:s[0],{step:a,count:r}=TC.getNiceStepAndTickCount(t,s),l=1/a,c=a>=1?Math.ceil(o/a+r)*a:Math.ceil((o+r*a)*l)/l;return n?[c,o]:[o,c]}getPixelRange(){return this.arcLength}},{Property:Fk,angleBetween:WZ,normalisedExtentWithMetadata:$Z,findMinMax:UZ}=k,xh=class extends df{constructor(e){super(e,new NE),this.shape="circle",this.interval=new Tk}hasDefinedDomain(){const{min:e,max:t}=this;return e!=null&&t!=null&&ed>=c&&d<=h).sort((d,u)=>d-u)}return l.map(c=>({value:c,visible:!0}))}avoidLabelCollisions(e){const{minSpacing:t}=this.label,i=(o,a)=>{if(o.hidden||a.hidden)return!1;if(t==null)return o.box.collidesBBox(a.box);const r=o.box.clone().grow(t/2),l=a.box.clone().grow(t/2);return r.collidesBBox(l)},s=e[0],n=e.at(-1);s!==n&&Qe(s.x,n.x)&&Qe(s.y,n.y)&&(n.hidden=!0);for(let o=1;o0&&(l.hidden=!0,l.box=void 0);return}}for(const[o,a]of e.entries())o>0&&(a.hidden=!0,a.box=void 0)}tickFormatParams(e,t,i){return{type:"number",fractionDigits:i}}datumFormatParams(e,t,i){const{datum:s,seriesId:n,legendItemName:o,key:a,source:r,property:l,domain:c,boundSeries:h}=t;return{type:"number",value:e,datum:s,seriesId:n,legendItemName:o,key:a,source:r,property:l,domain:c,boundSeries:h,fractionDigits:i}}};xh.className="AngleNumberAxis",xh.type="angle-number",y([Fk],xh.prototype,"min",2),y([Fk],xh.prototype,"max",2),y([Fk],xh.prototype,"interval",2);var KZ={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"angle-number",moduleFactory:e=>new xh(e)},{OrdinalTimeScale:YZ,Property:ZZ,TimeAxisParentLevel:XZ,lowestGranularityUnitForTicks:qZ,lowestGranularityUnitForValue:QZ,minimumTimeAxisDatumGranularity:JZ,dateTruncationForDomain:eX,intervalUnit:OE,intervalStep:EE,intervalEpoch:PE,intervalMilliseconds:RE}=k,uf=class extends k.DiscreteTimeAxis{constructor(e){super(e,new YZ),this.parentLevel=new XZ}get primaryLabel(){return this.parentLevel.enabled?this.parentLevel.label:void 0}get primaryTick(){return this.parentLevel.enabled?this.parentLevel.tick:void 0}processData(){super.processData();const{boundSeries:e,direction:t}=this;this.minimumTimeGranularity=JZ(e,t,void 0,void 0)}tickFormatParams(e,t,i,s){s??(s=qZ(t));const n=eX(e),o=OE(s),a=EE(s),r=PE(s);return{type:"date",unit:o,step:a,epoch:r,truncateDate:n}}datumFormatParams(e,t,i,s,n){if(typeof e=="number"&&(e=new Date(e)),s==null){const{minimumTimeGranularity:x}=this,m=QZ(e);x!=null&&RE(x)new uf(e)},{ChartAxisDirection:iX,Property:sX,validateCrossLineValue:nX,normalizeAngle360FromDegrees:oX,Group:aX,Path:rX,Sector:lX,RotatableText:cX}=k,zE=class extends la{constructor(){super(...arguments),this.positionAngle=void 0}};y([sX],zE.prototype,"positionAngle",2);var Bk=class extends an{constructor(){super(),this.direction=iX.Radius,this.label=new zE,this.polygonNode=new rX,this.sectorNode=new lX,this.crossLineRange=new aX,this.labelNode=new cX,this.outerRadius=0,this.innerRadius=0,this.crossLineRange.append(this.polygonNode),this.crossLineRange.append(this.sectorNode),this.labelGroup.append(this.labelNode)}update(e){const{scale:t}=this;if(!t||!nX(this,t)){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.updateRadii();const{innerRadius:i,outerRadius:s}=this;e&&(e=i>=this.axisInnerRadius&&s<=this.axisOuterRadius),this.rangeGroup.visible=e,this.lineGroup.visible=e,this.labelGroup.visible=e,this.updatePolygonNode(e),this.updateSectorNode(e),this.updateLabelNode(e),this.assignCrossLineGroup(this.type==="range",this.crossLineRange)}updateRadii(){const{range:e,scale:t,type:i,axisInnerRadius:s,axisOuterRadius:n}=this;if(!t)return{innerRadius:0,outerRadius:0};const o=l=>n+s-l;let a,r;if(i==="line")a=o(t.convert(this.value)),r=a;else{const l=Math.abs(t?.bandwidth??0),c=e.map(h=>t.convert(h));a=o(Math.max(...c)),r=o(Math.min(...c))+l}this.outerRadius=a,this.innerRadius=r}drawPolygon(e,t,i){for(const[s,n]of t.entries()){const o=e*Math.cos(n),a=e*Math.sin(n);s===0?i.path.moveTo(o,a):i.path.lineTo(o,a)}i.path.closePath()}updatePolygonNode(e){const{gridAngles:t,polygonNode:i,scale:s,shape:n,type:o,innerRadius:a,outerRadius:r}=this;if(!e||n!=="polygon"||!s||!t){i.visible=!1;return}i.visible=!0;const l=this.getPadding();i.path.clear(!0),this.drawPolygon(r-l,t,i);const c=t.slice().reverse(),h=o==="line"?r-l:a+l;this.drawPolygon(h,c,i),this.setSectorNodeProps(i)}updateSectorNode(e){const{axisInnerRadius:t,axisOuterRadius:i,scale:s,sectorNode:n,shape:o,innerRadius:a,outerRadius:r}=this;if(!e||o!=="circle"||!s){n.visible=!1;return}n.visible=!0,n.startAngle=0,n.endAngle=2*Math.PI;const l=this.getPadding(),c=ve(t,a+l,i),h=ve(t,r-l,i);n.innerRadius=Math.min(c,h),n.outerRadius=Math.max(c,h),this.setSectorNodeProps(n)}updateLabelNode(e){const{innerRadius:t,label:i,labelNode:s,scale:n,shape:o,type:a}=this;if(!e||i.enabled===!1||!i.text||!n){s.visible=!1;return}const r=oX((i.positionAngle??0)-90),l=(Qe(r,0)||r>0)&&rthis.tickFormatter(...v),domain:e,range:a,reverse:r,niceMode:t,visibleRange:s,defaultTickMinSpacing:l,labelOffset:o,sideFlag:n,axisRotation:0,sizeLimit:void 0,primaryTickCount:void 0}),{tickData:h}=c,{ticks:d,rawTicks:u,rawTickCount:p,tickDomain:g,fractionDigits:f,niceDomain:x=e}=h,m=d.map(v=>this.getTickLabelProps(v,c));return this.generatedTicks={ticks:d,labels:m},{ticks:u,tickDomain:g,niceDomain:x,rawTickCount:p,fractionDigits:f,timeInterval:void 0}}updateSelections(){const{generatedTicks:e}=this;if(!e)return;const{ticks:t,labels:i}=e;this.gridLineGroupSelection.update(this.gridLength?t:[]),this.tickLabelGroupSelection.update(i),this.gridPathSelection.update(this.gridLine.enabled?this.prepareGridPathTickData(t):[]),this.gridLineGroupSelection.cleanup(),this.tickLabelGroupSelection.cleanup(),this.gridPathSelection.cleanup()}updateLabels(){if(!this.label.enabled)return;const e=k.resetAxisLabelSelectionFn();this.tickLabelGroupSelection.each((t,i)=>{t.fill=i.color,t.text=i.text,t.textBaseline=i.textBaseline,t.textAlign=i.textAlign??"center",t.setFont(i),t.setBoxing(i),t.setProperties(e(t,i))})}updateGridLines(){const{gridLine:{style:e,width:t},shape:i,generatedTicks:s}=this;if(!e||!s)return;const n=e.length,o=(u,p)=>{const{stroke:g,lineDash:f}=e[p%n];u.stroke=g,u.strokeWidth=t,u.lineDash=f,u.fill=void 0},[a,r]=this.gridRange??[0,2*Math.PI],l=Qe(r-a,2*Math.PI),d=i==="circle"?(u,p)=>{const{path:g}=u;g.clear(!0);const f=this.getTickRadius(p);l?(g.moveTo(f,0),g.arc(0,0,f,0,2*Math.PI)):(g.moveTo(f*Math.cos(a),f*Math.sin(a)),g.arc(0,0,f,FE(a),FE(r))),l&&g.closePath()}:(u,p)=>{const{path:g}=u,f=this.gridAngles;if(g.clear(!0),!f||f.length<3)return;const x=this.getTickRadius(p);for(const[m,v]of f.entries()){const b=x*Math.cos(v),S=x*Math.sin(v);m===0?g.moveTo(b,S):g.lineTo(b,S);for(const[D,L]of f.entries()){const I=x*Math.cos(L),A=x*Math.sin(L);D===0?g.moveTo(I,A):g.lineTo(I,A)}g.closePath()}g.closePath()};this.gridPathSelection.each((u,p,g)=>{o(u,g),d(u,p)})}updateTitle(){const e=a=>a.defaultValue,{title:t,range:i}=this,{formatter:s=e}=this.title;t.caption.enabled=t.enabled,t.caption.fontFamily=t.fontFamily,t.caption.fontSize=t.fontSize,t.caption.fontStyle=t.fontStyle,t.caption.fontWeight=t.fontWeight,t.caption.color=t.color,t.caption.wrapping=t.wrapping;let n=!1;const o=t.caption.node;t.enabled&&(n=!0,o.rotation=Math.PI/2,o.x=Math.floor((i[0]+i[1])/2),o.y=-pX.SMALL_PADDING,o.textAlign="center",o.textBaseline="bottom",o.text=this.cachedCallWithContext(s,this.getTitleFormatterParams(this.scale.domain))),o.visible=n}updateCrossLines(){for(const e of this.crossLines)if(e instanceof Bk){const{shape:t,gridAngles:i,range:s,innerRadiusRatio:n}=this,o=s[0];e.shape=t,e.gridAngles=i,e.axisOuterRadius=o,e.axisInnerRadius=o*n}super.updateCrossLines()}createLabel(){return new Vk}getTickLabelProps(e,t){const{label:i}=this,{rotation:s,textBaseline:n,textAlign:o}=t,a=this.scale.range,r=e.tickLabel??"",c=i.getSideFlag()*(this.getTickSize()+i.spacing+this.seriesAreaPadding),h=r!==""&&r!=null,d=s;return{...this.getLabelStyles({value:e.tick,formattedValue:e.tickLabel}),tickId:e.tickId,rotation:d,text:r,textAlign:o,textBaseline:n,visible:h,x:c,y:e.translation,rotationCenterX:c,rotationCenterY:e.translation,range:a}}};Jx.CrossLineConstructor=Bk,y([_k],Jx.prototype,"positionAngle",2);var{ProxyPropertyOnWrite:GE,Property:Gk,CategoryScale:jE}=k,Gl=class extends Jx{constructor(e){super(e,new jE),this.shape="circle",this.groupPaddingInner=0,this.paddingInner=0,this.paddingOuter=0}hasDefinedDomain(){return!1}normaliseDataDomain(e){return{domain:e,clipped:!1}}prepareGridPathTickData(e){return e.slice().reverse()}getTickRadius(e){const{scale:t,innerRadiusRatio:i}=this,s=t.range[0],n=s*i;if(jE.is(t)){const o=t.domain,a=o.length-1-o.indexOf(e.tick);return a===0?n:t.inset+t.step*(a-.5)+t.bandwidth/2}else{const o=(s-n)/t.domain.length;return s-e.translation+n-o/2}}tickFormatParams(){return{type:"category"}}datumFormatParams(e,t){const{datum:i,seriesId:s,legendItemName:n,key:o,source:a,property:r,domain:l,boundSeries:c}=t;return{type:"category",value:e,datum:i,seriesId:s,legendItemName:n,key:o,source:a,property:r,domain:l,boundSeries:c}}};Gl.className="RadiusCategoryAxis",Gl.type="radius-category",y([Gk],Gl.prototype,"groupPaddingInner",2),y([GE("scale","paddingInner"),Gk],Gl.prototype,"paddingInner",2),y([GE("scale","paddingOuter"),Gk],Gl.prototype,"paddingOuter",2);var xX={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radius-category",moduleFactory:e=>new Gl(e)},{Property:HE,normalisedExtentWithMetadata:bX,LinearScale:vX}=k,Mu=class extends Jx{constructor(e){super(e,new vX),this.shape="polygon"}hasDefinedDomain(){const{min:e,max:t}=this;return e!=null&&t!=null&&es!==i).sort((s,n)=>n.tick-s.tick)}getTickRadius(e){const{scale:t}=this,i=t.range[0],s=i*this.innerRadiusRatio;return i-e.translation+s}normaliseDataDomain(e){const{min:t,max:i}=this,{extent:s,clipped:n}=bX(e,t,i);return{domain:s,clipped:n}}tickFormatParams(e,t,i){return{type:"number",fractionDigits:i}}datumFormatParams(e,t,i){const{datum:s,seriesId:n,legendItemName:o,key:a,source:r,property:l,domain:c,boundSeries:h}=t;return{type:"number",value:e,datum:s,seriesId:n,legendItemName:o,key:a,source:r,property:l,domain:c,boundSeries:h,fractionDigits:i}}};Mu.className="RadiusNumberAxis",Mu.type="radius-number",y([HE],Mu.prototype,"min",2),y([HE],Mu.prototype,"max",2);var SX={type:"axis",optionsKey:"axes[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radius-number",moduleFactory:e=>new Mu(e)},{ObserveChanges:jk,Property:Hk}=k,eb=class extends k.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!0,e.animationManager.skip(!1),this.cleanup.register(()=>{e.animationManager.skip(!0)})}};y([jk((e,t)=>{e.ctx.animationManager.skip(!t)}),Hk],eb.prototype,"enabled",2),y([jk((e,t)=>{e.ctx.animationManager.defaultDuration=t}),Hk],eb.prototype,"duration",2),y([jk((e,t)=>{e.ctx.animationManager.maxAnimatableItems=t??1/0}),Hk],eb.prototype,"maxAnimatableItems",2);var MX={type:"root",optionsKey:"animation",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new eb(e),themeTemplate:{animation:{enabled:!0,maxAnimatableItems:1e3}}},DX='
',{focusCursorAtEnd:kX}=k,WE="text-input",$E="canvas-overlay",IX=class extends k.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.layout={getTextInputCoords:()=>({x:0,y:0}),getTextPosition:()=>"center",alignment:"center",textAlign:"center"},this.visible=!1,this.element=e.domManager.addChild($E,WE),this.element.classList.add("ag-charts-text-input"),this.cleanup.register(()=>e.domManager.removeChild($E,WE))}setKeyDownHandler(e){this.cleanup.register(ht(this.element,"keydown",e))}show(e){this.element.innerHTML=DX;const t=this.element.firstElementChild;Ca(t,{role:"textbox","data-preventdefault":!1}),t.isContentEditable||(t.contentEditable="true"),t.setAttribute("placeholder",this.ctx.localeManager.t(e.placeholderText??"inputTextareaPlaceholder")),e.styles?.placeholderColor&&t.style.setProperty("--placeholder-text-color",e.styles?.placeholderColor),t.innerText=e.text??"",t.style.color=e.styles?.color??"inherit",t.style.fontFamily=e.styles?.fontFamily??"inherit",t.style.fontSize=e.styles?.fontSize?`${e.styles.fontSize}px`:"inherit",t.style.fontStyle=e.styles?.fontStyle??"inherit",t.style.fontWeight=typeof e.styles?.fontWeight=="number"?`${e.styles.fontWeight}`:e.styles?.fontWeight??"inherit",kX(t),t.addEventListener("input",()=>{this.updatePosition(),e.onChange?.(this.getValue(),this.getBBox())}),t.addEventListener("click",i=>{i.stopPropagation()}),e.layout&&(this.layout=e.layout,this.updatePosition()),e.onChange?.(this.getValue(),this.getBBox()),this.visible=!0}hide(){this.element.innerHTML="",this.layout={getTextInputCoords:()=>({x:0,y:0}),getTextPosition:()=>"center",alignment:"center",textAlign:"center"},this.visible=!1}isVisible(){return this.visible}updateColor(e){this.element.firstElementChild&&(this.element.firstElementChild.style.color=e)}updateFontSize(e){if(this.element.firstElementChild)return this.element.firstElementChild.style.fontSize=`${e}px`,this.updatePosition(),this.getBBox()}getValue(){if(this.element.firstElementChild)return this.element.firstElementChild.innerText.trim()}updatePosition(){const{element:e}=this,t=e.firstElementChild;if(!t)return;const i=this.ctx.domManager.getBoundingClientRect(),{width:s,getTextInputCoords:n,getTextPosition:o,alignment:a,textAlign:r}=this.layout;e.style.setProperty("width",s?`${s}px`:"unset");const l=t.getBoundingClientRect(),c=n(l.height);let h=c.x;a==="center"?h-=(s??l.width)/2:a==="right"&&(h-=s??l.width);const d=o();let u=c.y;d==="center"?u-=l.height/2:d==="bottom"&&(u-=l.height),e.style.setProperty("top",`${u}px`),e.style.setProperty("left",`${h}px`),e.style.setProperty("max-width",`${i.width-h}px`),e.style.setProperty("text-align",a),t.style.setProperty("text-align",r)}getBBox(){const{left:e,top:t,width:i,height:s}=this.element.getBoundingClientRect();return new k.BBox(e,t,i,s)}},{BaseProperties:AX,Property:UE}=k,Wk=class extends AX{constructor(){super(...arguments),this.enabled=!1,this.axes="y"}};y([UE],Wk.prototype,"enabled",2),y([UE],Wk.prototype,"axes",2);var $k=(e=>(e.Line="line",e.HorizontalLine="horizontal-line",e.VerticalLine="vertical-line",e.DisjointChannel="disjoint-channel",e.ParallelChannel="parallel-channel",e.FibonacciRetracement="fibonacci-retracement",e.FibonacciRetracementTrendBased="fibonacci-retracement-trend-based",e.Callout="callout",e.Comment="comment",e.Note="note",e.Text="text",e.Arrow="arrow",e.ArrowUp="arrow-up",e.ArrowDown="arrow-down",e.DateRange="date-range",e.PriceRange="price-range",e.DatePriceRange="date-price-range",e.QuickDatePriceRange="quick-date-price-range",e))($k||{}),CX=Object.values($k);function LX(e){for(const t of CX)if(t===e)return t}var{BaseProperties:jl,FONT_SIZE:TX,Property:He}=k,pf=class extends jl{};y([He],pf.prototype,"x",2),y([He],pf.prototype,"y",2);var wX=class extends Ks(zr(XE(jl))){},Uk=class extends Ks(zr(ja(Zk(Sh(jl))))){constructor(){super(...arguments),this.cornerRadius=2}};y([He],Uk.prototype,"enabled",2),y([He],Uk.prototype,"cornerRadius",2);var NX=class extends ja(jl){},OX=class extends Ks(zr(ja(jl))){},bh=class extends Sh(jl){constructor(){super(...arguments),this.label="",this.position="top",this.alignment="left"}};y([He],bh.prototype,"label",2),y([He],bh.prototype,"position",2),y([He],bh.prototype,"alignment",2);var EX=class extends Sh(jl){},gf=class extends Sh(jl){constructor(){super(...arguments),this.label=""}};y([He],gf.prototype,"label",2),y([He],gf.prototype,"position",2),y([He],gf.prototype,"alignment",2);function vh(e){class t extends RX(XE(e)){constructor(){super(...arguments),this.id=vy()}}return t}function Kk(e){class t extends e{constructor(){super(...arguments),this.start=new pf,this.end=new pf}}return y([He],t.prototype,"start",2),y([He],t.prototype,"end",2),t}function KE(e){class t extends e{}return y([He],t.prototype,"x",2),y([He],t.prototype,"y",2),t}function YE(e){class t extends e{}return y([He],t.prototype,"value",2),t}function Yk(e){class t extends e{constructor(){super(...arguments),this.background=new NX}}return y([He],t.prototype,"background",2),t}function Hl(e){class t extends e{constructor(){super(...arguments),this.handle=new OX}}return y([He],t.prototype,"handle",2),t}function ZE(e){class t extends e{constructor(){super(...arguments),this.axisLabel=new Uk}}return y([He],t.prototype,"axisLabel",2),t}function Zk(e){class t extends e{constructor(){super(...arguments),this.padding=void 0,this.textAlign="center",this.formatter=void 0}}return y([He],t.prototype,"padding",2),y([He],t.prototype,"textAlign",2),y([He],t.prototype,"formatter",2),t}function PX(e){class t extends e{}return t}function Xk(e){class t extends e{}return y([He],t.prototype,"extendStart",2),y([He],t.prototype,"extendEnd",2),t}function RX(e){class t extends e{isWriteable(){return!this.locked&&!this.readOnly}isHoverable(){return!this.readOnly}}return y([He],t.prototype,"locked",2),y([He],t.prototype,"readOnly",2),t}function qk(e){class t extends e{setLocaleManager(s){this.localeManager??(this.localeManager=s)}}return t}function XE(e){class t extends e{}return y([He],t.prototype,"visible",2),t}function ja(e){class t extends e{}return y([He],t.prototype,"fill",2),y([He],t.prototype,"fillOpacity",2),t}function Ks(e){class t extends e{}return y([He],t.prototype,"stroke",2),y([He],t.prototype,"strokeOpacity",2),y([He],t.prototype,"strokeWidth",2),t}function zr(e){class t extends e{constructor(){super(...arguments),this.lineCap=void 0,this.computedLineDash=void 0}}return y([He],t.prototype,"lineDash",2),y([He],t.prototype,"lineDashOffset",2),y([He],t.prototype,"lineStyle",2),t}function Sh(e){class t extends e{constructor(){super(...arguments),this.fontSize=TX.SMALL,this.fontFamily="Verdana, sans-serif"}}return y([He],t.prototype,"fontStyle",2),y([He],t.prototype,"fontWeight",2),y([He],t.prototype,"fontSize",2),y([He],t.prototype,"fontFamily",2),y([He],t.prototype,"color",2),t}function qE(e){return Jt(e)||Qt(e)||jo(e)?{value:e,groupPercentage:0}:e??{value:void 0,groupPercentage:0}}function Ri(e){return qE(e)?.value}function rn(e,t){if(e.start==null||e.end==null)return;const i=Ut(e.start,t),s=Ut(e.end,t);if(!(i==null||s==null))return{x1:i.x,y1:i.y,x2:s.x,y2:s.y}}function Ut(e,t){const i=Fr(e.x,t.xAxis),s=Fr(e.y,t.yAxis);return{x:i,y:s}}function Fr(e,t){if(e==null)return 0;const{value:i,groupPercentage:s}=qE(e),{scale:n,snapToGroup:o}=t,a=n.bandwidth===0?n.step??0:n.bandwidth??0,r=o?a/2:a*s;return n.convert(i)+r}function ln(e,t){const i=tb(e.x,t.xAxis),s=tb(e.y,t.yAxis);return{x:i,y:s}}function tb(e,t){const{scale:i}=t;if(t.continuous&&i.step==null)return t.scaleInvert(e);const s=t.scaleInvertNearest(e),n=i.bandwidth===0?i.step:i.bandwidth??0,o=i.convert(s),a=o+n,r=o===a?0:(e-o)/(a-o);return{value:s,groupPercentage:r}}var{BaseProperties:zX}=k,Qk=class extends vh(Kk(Hl(zX))){constructor(){super(...arguments),this.snapToAngle=45}getDefaultColor(e){}getDefaultOpacity(e){}},{Property:FX}=k,QE=class extends qk(Zk(Sh(Qk))){constructor(){super(...arguments),this.text="",this.position="top",this.alignment="left",this.placement="inside",this.placeholderText="inputTextareaPlaceholder"}getDefaultColor(e){return this.color}getDefaultOpacity(e){}getPlaceholderColor(){}getPadding(){const{padding:e=0}=this;return{top:e,right:e,bottom:e,left:e}}getText(){const e=this.text.length==0;let t=this.text;return e&&(t=this.placeholderText??"",this.localeManager&&(t=this.localeManager.t(t))),{text:t,isPlaceholder:e}}getTextInputCoords(e,t){return Ut(this.end,e)}getTextPosition(){return this.position}};y([FX],QE.prototype,"text",2);var{Property:BX,Color:JE}=k,_X={top:6,right:12,bottom:9,left:12},ca=class extends ja(Ks(QE)){constructor(){super(...arguments),this.type="callout",this.position="bottom",this.alignment="left"}static is(e){return Ee(e)&&e.type==="callout"}getDefaultColor(e){switch(e){case"fill-color":return this.fill;case"line-color":return this.stroke;case"text-color":default:return this.color}}getDefaultOpacity(e){switch(e){case"fill-color":return this.fillOpacity;case"line-color":return this.strokeOpacity;case"text-color":default:return}}getPlaceholderColor(){const{r:e,g:t,b:i}=JE.fromString(this.color??"#888888");return new JE(e,t,i,.66).toString()}getPadding(){const{padding:e}=this;return e==null?{..._X}:{top:e,right:e,bottom:e,left:e}}getTextInputCoords(e,t){const i=super.getTextInputCoords(e,t),s=this.getPadding(),n=s.left??0,o=s.bottom??0;return{x:i.x+n,y:i.y-o}}};y([BX],ca.prototype,"type",2);var{BaseProperties:VX,Property:GX}=k,ib=class extends vh(KE(Hl(Zk(Sh(VX))))){constructor(){super(...arguments),this.text="",this.position="top",this.alignment="left",this.placement="inside",this.placeholderText="inputTextareaPlaceholder"}getDefaultColor(e){return this.color}getDefaultOpacity(e){}getPlaceholderColor(){}getPadding(){const{padding:e=0}=this;return{top:e,right:e,bottom:e,left:e}}getText(){const e=this.text.length==0;return{text:e?this.placeholderText??"":this.text,isPlaceholder:e}}getTextInputCoords(e,t){return Ut(this,e)}getTextPosition(){return this.position}};y([GX],ib.prototype,"text",2);var{Property:jX,Color:eP}=k,sb={top:8,right:14,bottom:8,left:14},Ha=class extends ja(Ks(ib)){constructor(){super(...arguments),this.type="comment",this.position="bottom",this.alignment="left"}static is(e){return Ee(e)&&e.type==="comment"}getDefaultColor(e){switch(e){case"fill-color":return this.fill;case"line-color":return this.stroke;case"text-color":default:return this.color}}getDefaultOpacity(e){switch(e){case"fill-color":return this.fillOpacity;case"line-color":return this.strokeOpacity;case"text-color":default:return}}getPlaceholderColor(){const{r:e,g:t,b:i}=eP.fromString(this.color??"#888888");return new eP(e,t,i,.66).toString()}getPadding(){const{padding:e,fontSize:t}=this;return e==null?{top:Math.max(t*.4,sb.top),bottom:Math.max(t*.4,sb.bottom),left:Math.max(t*.8,sb.left),right:Math.max(t*.8,sb.right)}:{top:e,right:e,bottom:e,left:e}}getTextInputCoords(e,t){const i=super.getTextInputCoords(e,t),s=this.getPadding();return{x:i.x+s.left,y:i.y-s.bottom}}};y([jX],Ha.prototype,"type",2);var{Vec2:Mh}=k;function ff(e,t){return e?"dashed":t??"solid"}function tP(e,t){switch(t){case"solid":return[];case"dashed":return[e*4,e*2];case"dotted":return[0,e*2]}}function Du(e,t,i,s){const n=ff(e,i);return t??e??tP(s??1,n)}function ku(e,t,i){const s=ff(t,i);return e??s==="dotted"?"round":void 0}function HX(e,t){const[i,s]=Mh.from(e),n=t.height,o=Mh.gradient(s,i,n),a=Mh.intercept(s,o,n),r=[{x:i.x,y:n??0},{x:i.x,y:n==null?t.height:n-t.height}];if(o===1/0)return r;let l=[Mh.intersectAtY(o,a,0,n),Mh.intersectAtY(o,a,t.height,n),Mh.intersectAtX(o,a,0,n),Mh.intersectAtX(o,a,t.width,n)];return l=l.filter(c=>c.x>=t.x&&c.x<=t.width&&c.y>=t.y&&c.y<=t.height).sort((c,h)=>c.x===h.x?0:c.x{},this.text=new bh}getDefaultColor(e){switch(e){case"fill-color":return this.background.fill;case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(e){switch(e){case"fill-color":return this.background.fillOpacity;case"line-color":return this.strokeOpacity}}getLineDash(){return Du(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ku(this.lineCap,this.lineDash,this.lineStyle)}};y([vn],Iu.prototype,"statistics",2),y([vn],Iu.prototype,"text",2);function iI(e){class t extends e{constructor(){super(...arguments),this.hasDateRange=!0}}return t}function sI(e){class t extends e{constructor(){super(...arguments),this.hasPriceRange=!0}}return t}var Do=class extends iI(Iu){constructor(){super(...arguments),this.type="date-range",this.direction="horizontal"}static is(e){return Ee(e)&&e.type==="date-range"}};y([vn],Do.prototype,"type",2),y([vn],Do.prototype,"extendAbove",2),y([vn],Do.prototype,"extendBelow",2);var ko=class extends sI(Iu){constructor(){super(...arguments),this.type="price-range",this.direction="vertical"}static is(e){return Ee(e)&&e.type==="price-range"}};y([vn],ko.prototype,"type",2),y([vn],ko.prototype,"extendLeft",2),y([vn],ko.prototype,"extendRight",2);var Br=class extends iI(sI(Iu)){constructor(){super(...arguments),this.type="date-price-range",this.direction="both"}static is(e){return Ee(e)&&e.type==="date-price-range"}};y([vn],Br.prototype,"type",2);var jn=class extends iI(sI(Iu)){constructor(){super(...arguments),this.type="quick-date-price-range",this.up=new tI,this.down=new tI,this.direction="both"}static is(e){return Ee(e)&&e.type==="quick-date-price-range"}};y([vn],jn.prototype,"type",2),y([vn],jn.prototype,"up",2),y([vn],jn.prototype,"down",2);var{BBox:$X}=k,nb=1.38;function ob(e,t,i){return i?cl(t,{maxWidth:i,font:e,textWrap:"always",avoidOrphans:!1}):t}function UX(e,t){const{lineMetrics:i,width:s}=Je(e).measureLines(t),n=i.length*$o(e.fontSize,nb);return{width:s,height:n}}function nI(e,t,i,s){let n=s?.width??0,o=s?.height??0;if(!s){const a=e.width==null?t:ob(e,t,e.width);({width:n,height:o}=UX(e,a))}return new $X(i.x,i.y,n,o)}function iP(e,t,i,s,{x:n,y:o},a){const{visible:r=!0,fontFamily:l,fontSize:c=14,fontStyle:h,fontWeight:d,textAlign:u}=s,p=$o(c,nb);a??(a=s.position=="center"?"middle":s.position);const g=i?s.getPlaceholderColor():s.color;e.setProperties({x:n,y:o,visible:r,text:t,fill:g,fontFamily:l,fontSize:c,fontStyle:h,fontWeight:d,textAlign:u,lineHeight:p,textBaseline:a})}var{BaseProperties:KX,Property:sP}=k,YX=10,ZX=11,nP=20,XX=22,qX=10,oP=nP+qX,aP=34,QX=class extends ja(Ks(KX)){},Sn=class extends ja(Ks(ib)){constructor(){super(...arguments),this.type="note",this.background=new QX,this.position="bottom",this.alignment="center",this.width=200}static is(e){return Ee(e)&&e.type==="note"}getDefaultColor(e){switch(e){case"line-color":return this.fill;case"text-color":return this.color}}getDefaultOpacity(e){switch(e){case"line-color":return this.fillOpacity;case"text-color":return}}getPadding(){const e=this.padding??YX;return{top:e,right:e,bottom:e,left:e}}getTextInputCoords(e,t){const{width:i,text:s}=this,n=super.getTextInputCoords(e,t),o=this.getPadding().top,a=nI(this,s,n);a.x=ve(i/2,a.x,e.seriesRect.width-i/2);const r=a.y-oP-o*2,l=a.y+ZX+o*2,c=Math.max(a.height,t);return r-c-aP<0?(a.y=l,this.position="top"):(a.y=r+o,this.position="bottom"),{x:a.x,y:a.y}}isHoverable(){return!0}};y([sP],Sn.prototype,"type",2),y([sP],Sn.prototype,"background",2);var{BaseProperties:JX}=k,e6=class extends vh(KE(Hl(JX))){getDefaultColor(e){}getDefaultOpacity(e){}},oI=class VV extends ja(e6){constructor(){super(...arguments),this.size=32}static is(t){return t instanceof VV}getDefaultColor(t){return t==="fill-color"?this.fill:void 0}getDefaultOpacity(t){return t==="fill-color"?this.fillOpacity:void 0}},{BaseProperties:rP,Property:ab}=k,Ys=class extends vh(YE(Hl(ZE(Ks(zr(rP)))))){constructor(){super(...arguments),this.direction="horizontal",this.type="horizontal-line",this.text=new bh}static is(e){return Ee(e)&&e.type==="horizontal-line"}getDefaultColor(){return this.stroke}getDefaultOpacity(){return this.strokeOpacity}getLineDash(){return Du(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ku(this.lineCap,this.lineDash,this.lineStyle)}};y([ab],Ys.prototype,"type",2),y([ab],Ys.prototype,"text",2);var Wa=class extends vh(YE(Hl(ZE(Ks(zr(rP)))))){constructor(){super(...arguments),this.direction="vertical",this.type="vertical-line",this.text=new bh}static is(e){return Ee(e)&&e.type==="vertical-line"}getDefaultColor(){return this.stroke}getDefaultOpacity(){return this.strokeOpacity}getLineDash(){return Du(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ku(this.lineCap,this.lineDash,this.lineStyle)}};y([ab],Wa.prototype,"type",2),y([ab],Wa.prototype,"text",2);var{BaseProperties:t6,Property:rb}=k,Io=class extends vh(Yk(Kk(Hl(Xk(Ks(zr(t6))))))){constructor(){super(...arguments),this.type="disjoint-channel",this.text=new gf,this.snapToAngle=45}static is(e){return Ee(e)&&e.type==="disjoint-channel"}get bottom(){const e={start:{x:this.start.x,y:this.start.y},end:{x:this.end.x,y:this.end.y}};return typeof e.start.y=="number"&&typeof e.end.y=="number"?(e.start.y-=this.startHeight,e.end.y-=this.endHeight):K.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`),e}getDefaultColor(e){switch(e){case"fill-color":return this.background.fill;case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(e){switch(e){case"fill-color":return this.background.fillOpacity;case"line-color":return this.strokeOpacity}}getLineDash(){return Du(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ku(this.lineCap,this.lineDash,this.lineStyle)}};y([rb],Io.prototype,"type",2),y([rb],Io.prototype,"startHeight",2),y([rb],Io.prototype,"endHeight",2),y([rb],Io.prototype,"text",2);var{Property:aI}=k,lb=class extends qk(PX(Xk(Ks(zr(Qk))))){constructor(){super(...arguments),this.text=new bh}getDefaultColor(e){switch(e){case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(){return this.strokeOpacity}getLineDash(){return Du(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ku(this.lineCap,this.lineDash,this.lineStyle)}};y([aI],lb.prototype,"text",2);var _r=class extends lb{constructor(){super(...arguments),this.type="arrow",this.endCap="arrow"}static is(e){return Ee(e)&&e.type==="arrow"}};y([aI],_r.prototype,"type",2);var Vr=class extends lb{constructor(){super(...arguments),this.type="line"}static is(e){return Ee(e)&&e.type==="line"}};y([aI],Vr.prototype,"type",2);var{Property:Dh}=k,Gr=class extends lb{constructor(){super(...arguments),this.label=new EX,this.reverse=!1,this.showFill=!0,this.isMultiColor=!0,this.strokes=[],this.bands=10}getDefaultColor(e){switch(e){case"line-color":return this.rangeStroke??this.stroke;case"text-color":return this.text.color}}};y([Dh],Gr.prototype,"label",2),y([Dh],Gr.prototype,"reverse",2),y([Dh],Gr.prototype,"showFill",2),y([Dh],Gr.prototype,"isMultiColor",2),y([Dh],Gr.prototype,"strokes",2),y([Dh],Gr.prototype,"rangeStroke",2),y([Dh],Gr.prototype,"bands",2);var{Property:lP}=k,$a=class extends Gr{constructor(){super(...arguments),this.type="fibonacci-retracement-trend-based",this.endRetracement=new pf}static is(e){return Ee(e)&&e.type==="fibonacci-retracement-trend-based"}};y([lP],$a.prototype,"type",2),y([lP],$a.prototype,"endRetracement",2);var{Property:i6}=k,jr=class extends Gr{constructor(){super(...arguments),this.type="fibonacci-retracement"}static is(e){return Ee(e)&&e.type==="fibonacci-retracement"}};y([i6],jr.prototype,"type",2);var{BaseProperties:s6,Property:cb}=k,Ao=class extends vh(Yk(Kk(Hl(Xk(Ks(zr(s6))))))){constructor(){super(...arguments),this.type="parallel-channel",this.middle=new wX,this.text=new gf,this.snapToAngle=45}static is(e){return Ee(e)&&e.type==="parallel-channel"}get bottom(){const e={start:{x:this.start.x,y:this.start.y},end:{x:this.end.x,y:this.end.y}};return typeof e.start.y=="number"&&typeof e.end.y=="number"?(e.start.y-=this.height,e.end.y-=this.height):K.warnOnce(`Annotation [${this.type}] can only be used with a numeric y-axis.`),e}getDefaultColor(e){switch(e){case"fill-color":return this.background.fill;case"line-color":return this.stroke;case"text-color":return this.text.color}}getDefaultOpacity(e){switch(e){case"fill-color":return this.background.fillOpacity;case"line-color":return this.strokeOpacity}}getLineDash(){return Du(this.lineDash,this.computedLineDash,this.lineStyle,this.strokeWidth)}getLineCap(){return ku(this.lineCap,this.lineDash,this.lineStyle)}};y([cb],Ao.prototype,"type",2),y([cb],Ao.prototype,"height",2),y([cb],Ao.prototype,"middle",2),y([cb],Ao.prototype,"text",2);var{Property:n6}=k,Hr=class extends ib{constructor(){super(...arguments),this.type="text",this.position="bottom"}static is(e){return Ee(e)&&e.type==="text"}};y([n6],Hr.prototype,"type",2);function Wl(e){return jn.is(e)}function hb(e){return Vr.is(e)||Ys.is(e)||Wa.is(e)||_r.is(e)||cP(e)}function Wr(e){return Io.is(e)||Ao.is(e)}function cP(e){return jr.is(e)||$a.is(e)}function Ua(e){return ca.is(e)||Ha.is(e)||Sn.is(e)||Hr.is(e)}function yf(e){return Do.is(e)||ko.is(e)||Br.is(e)||jn.is(e)}function rI(e){return Ua(e)&&!Sn.is(e)}function $l(e){return hb(e)||Wr(e)||yf(e)&&!jn.is(e)}function o6(e){return hb(e)||Wr(e)||yf(e)||ca.is(e)||Sn.is(e)}function a6(e){return Sn.is(e)}function r6(e){return Wr(e)||yf(e)||ca.is(e)||Ha.is(e)||oI.is(e)}function l6(e){return Ua(e)&&!Sn.is(e)}function Au(e){return(hb(e)||Wr(e)||yf(e))&&!Wl(e)&&Ee(e.text)}function c6(e,t){"fontSize"in e&&(e.fontSize=t),Au(e)&&(e.text.fontSize=t)}function hP(e,t){const i=t?.strokeWidth??e.strokeWidth??1,s=t?.type??e.lineStyle,n=s??ff(e.lineDash,s),o=tP(i,n);e.strokeWidth=i,e.computedLineDash=o,e.lineStyle=n,e.lineCap=n==="dotted"?"round":void 0}function db(e,t,i,s,n,o){switch(t){case"fill-color":{"fill"in e&&(e.fill=s),"fillOpacity"in e&&(e.fillOpacity=n),"background"in e&&(e.background.fill=s,e.background.fillOpacity=n);break}case"line-color":{"axisLabel"in e&&(e.axisLabel.fill=s,e.axisLabel.fillOpacity=n,e.axisLabel.stroke=s,e.axisLabel.strokeOpacity=n),"fill"in e&&"fillOpacity"in e&&a6(e)?(e.fill=s,e.fillOpacity=n):("strokeOpacity"in e&&(e.strokeOpacity=n),"isMultiColor"in e&&"rangeStroke"in e?(e.isMultiColor=o,e.rangeStroke=s):"stroke"in e&&(e.stroke=s));break}case"text-color":{"color"in e&&(e.color=i),Au(e)&&(e.text.color=s);break}}}var{deepClone:Co}=k,h6=class{constructor(){this.mementoOriginatorKey="annotation-defaults",this.colors=new Map(Object.values($k).map(e=>[e,new Map([["line-color",void 0],["fill-color",void 0],["text-color",void 0]])])),this.fontSizes=new Map([["callout",void 0],["comment",void 0],["text",void 0],["arrow",void 0],["line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.lineStyles=new Map([["line",void 0],["horizontal-line",void 0],["vertical-line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["arrow",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.lineTextAlignments=new Map([["line",void 0],["horizontal-line",void 0],["vertical-line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["arrow",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.lineTextPositions=new Map([["line",void 0],["horizontal-line",void 0],["vertical-line",void 0],["disjoint-channel",void 0],["parallel-channel",void 0],["arrow",void 0],["date-range",void 0],["price-range",void 0],["date-price-range",void 0]]),this.fibonacciOptions=new Map([["fibonacci-retracement",{bands:void 0,reverse:void 0,showFill:void 0}],["fibonacci-retracement-trend-based",{bands:void 0,reverse:void 0,showFill:void 0}]])}createMemento(){return{colors:Co(this.colors),fontSizes:Co(this.fontSizes),lineStyles:Co(this.lineStyles),lineTextAlignments:Co(this.lineTextAlignments),lineTextPositions:Co(this.lineTextPositions),fibonacciOptions:Co(this.fibonacciOptions)}}guardMemento(e){return!0}restoreMemento(e,t,i){this.colors=Co(i.colors),this.fontSizes=Co(i.fontSizes),this.lineStyles=Co(i.lineStyles),this.lineTextAlignments=Co(i.lineTextAlignments),this.lineTextPositions=Co(i.lineTextPositions),this.fibonacciOptions=Co(i.fibonacciOptions)}setDefaultColor(e,t,i,s,n,o){this.colors.get(e)?.set(t,[i,s,n,o])}setDefaultFontSize(e,t){this.fontSizes.set(e,t)}setDefaultLineStyleType(e,t){const i=this.lineStyles.get(e);i?i.type=t:this.lineStyles.set(e,{type:t})}setDefaultLineStyleWidth(e,t){const i=this.lineStyles.get(e);i?i.strokeWidth=t:this.lineStyles.set(e,{strokeWidth:t})}setDefaultLineTextAlignment(e,t){this.lineTextAlignments.set(e,t)}setDefaultLineTextPosition(e,t){this.lineTextPositions.set(e,t)}setDefaultFibonacciOptions(e,t,i){if(e!="fibonacci-retracement"&&e!="fibonacci-retracement-trend-based")return;const s=this.fibonacciOptions.get(e);s[t]=i,this.fibonacciOptions.set(e,s)}applyDefaults(e){for(const[t,i]of this.colors)if(e.type===t)for(const[s,[n,o,a,r]=[]]of i)n&&o&&a!=null&&r!=null&&db(e,s,n,o,a,r);for(const[t,i]of this.fontSizes)e.type!==t||i==null||c6(e,i);for(const[t,i]of this.lineStyles)e.type!==t||i==null||hP(e,i);for(const[t,i]of this.lineTextPositions)e.type!==t||i==null||(e.text.position=i);for(const[t,i]of this.lineTextAlignments)e.type!==t||i==null||(e.text.alignment=i);for(const[t,i]of this.fibonacciOptions)if(!(e.type!==t||i==null))for(const s of Object.keys(i)){const n=i[s];n!=null&&e.set({[s]:n})}}},d6='
',{Color:lI}=k,dP=e=>{try{const t=lI.fromString(e),[i,s,n]=t.toHSB();return[i,s,n,t.a]}catch{return}},uP=class extends k.AnchoredPopover{constructor(e,t){super(e,"color-picker",t),this.hasChanged=!1,this.hideFns.push(()=>{this.i18nUpdater=void 0,this.hasChanged&&this.onChangeHide?.()}),this.cleanup.register(this.ctx.eventsHub.on("locale:change",()=>this.i18nUpdater?.()))}show(e){this.hasChanged=!1,this.onChangeHide=e.onChangeHide;const{element:t,initialFocus:i}=this.createColorPicker(e),s=this.showWithChildren([t],{initialFocus:i,...e});s.classList.add("ag-charts-color-picker"),s.setAttribute("role","dialog")}createColorPicker(e){const{localeManager:t}=this.ctx;let i=e.isMultiColor??!1,[s,n,o,a]=dP(e.color??"#f00")??[0,1,.5,1];a=e.opacity??a;const r=De("div","ag-charts-color-picker__content");r.innerHTML=d6,r.ariaLabel=this.ctx.localeManager.t("ariaLabelColorPicker");const l=r.querySelector(".ag-charts-color-picker__palette"),c=r.querySelector(".ag-charts-color-picker__hue-input"),h=r.querySelector(".ag-charts-color-picker__multi-color-button"),d=r.querySelector(".ag-charts-color-picker__alpha-input"),u=r.querySelector(".ag-charts-color-picker__color-input"),p=r.querySelector(".ag-charts-color-picker__color-label"),g=b=>{const S={s:"ariaValueColorPalette",v:"ariaValueColorPaletteFirstV"}[b];l.ariaValueText=t.t(S,{s:n,v:o})};this.i18nUpdater=()=>{l.ariaRoleDescription=t.t("ariaRoleDescription2DSlider"),l.ariaLabel=t.t("ariaLabelColorPickerPalette"),c.ariaLabel=t.t("ariaLabelColorPickerHue"),h.ariaLabel=t.t("ariaLabelColorPickerMultiColor"),d.ariaLabel=t.t("ariaLabelColorPickerAlpha"),u.ariaLabel=t.t("ariaLabelColor"),g("s")},this.i18nUpdater(),h.classList.toggle("ag-charts-color-picker__multi-color-button--hidden",!e.hasMultiColorOption);const f=(b=!0)=>{const D=lI.fromHSB(s,n,o,a).toHexString();if(r.style.setProperty("--h",`${s}`),r.style.setProperty("--s",`${n}`),r.style.setProperty("--v",`${o}`),r.style.setProperty("--a",`${a}`),r.style.setProperty("--color",D.slice(0,7)),r.style.setProperty("--color-a",D),c.value=`${s}`,d.value=`${a}`,d.classList.toggle("ag-charts-color-picker__alpha-input--opaque",a===1),h.classList.toggle("ag-charts-color-picker__multi-color-button--active",i),p.classList.toggle("ag-charts-color-picker__color-label--multi-color",i),document.activeElement!==u&&(h.ariaChecked=i.toString(),u.value=i?t.t("ariaLabelColorPickerMultiColor"):D.toUpperCase()),b||e.color==null){const L=lI.fromHSB(s,n,o,1).toHexString();e.onChange?.(D,L,a,i)}b&&(this.hasChanged=!0)};f(!1);const x=b=>b.preventDefault(),m=b=>b.stopPropagation(),v=b=>{b.preventDefault();const S=b.currentTarget;S.focus();const D=S.getBoundingClientRect(),L=({clientX:A,clientY:T})=>{i=!1,n=Math.min(Math.max((A-D.left)/D.width,0),1),o=1-Math.min(Math.max((T-D.top)/D.height,0),1),f(),g("s")};L(b);const I=ht(qe(),"pointermove",L);qe().addEventListener("pointerup",I,{once:!0})};return r.addEventListener("mousedown",m),r.addEventListener("touchstart",m),r.addEventListener("touchmove",m),r.addEventListener("keydown",b=>{switch(b.stopPropagation(),b.key){case"Enter":case"Escape":this.hide();break;default:return}b.preventDefault()}),l.addEventListener("pointerdown",v),l.addEventListener("touchstart",x,{passive:!1}),l.addEventListener("touchmove",x,{passive:!1}),l.addEventListener("keydown",b=>{if(b.key==="ArrowLeft")n=ve(0,n-.01,1),g("s");else if(b.key==="ArrowRight")n=ve(0,n+.01,1),g("s");else if(b.key==="ArrowUp")o=ve(0,o+.01,1),g("v");else if(b.key==="ArrowDown")o=ve(0,o-.01,1),g("v");else return;b.preventDefault(),f()}),l.addEventListener("focus",()=>{g("s")}),h.addEventListener("click",()=>{i=!i,f()}),c.addEventListener("input",b=>{i=!1,s=b.currentTarget.valueAsNumber??0,f()}),d.addEventListener("input",b=>{i=!1,a=b.currentTarget.valueAsNumber??0,f()}),u.addEventListener("input",b=>{i=!1;const S=dP(b.currentTarget.value);S!=null&&([s,n,o,a]=S,f())}),u.addEventListener("blur",()=>f()),u.addEventListener("keydown",b=>{b.key==="Enter"&&(b.currentTarget.blur(),f())}),{element:r,initialFocus:l}}};function pP(e){return!(e instanceof k.LogScale)&&!(e instanceof k.BandScale)}var u6=[{label:"toolbarAnnotationsTrendLine",icon:"trend-line-drawing",value:"line"},{label:"toolbarAnnotationsHorizontalLine",icon:"horizontal-line-drawing",value:"horizontal-line"},{label:"toolbarAnnotationsVerticalLine",icon:"vertical-line-drawing",value:"vertical-line"},{label:"toolbarAnnotationsParallelChannel",icon:"parallel-channel-drawing",value:"parallel-channel",visible:pP},{label:"toolbarAnnotationsDisjointChannel",icon:"disjoint-channel-drawing",value:"disjoint-channel",visible:pP}],p6=[{label:"toolbarAnnotationsFibonacciRetracement",icon:"fibonacci-retracement-drawing",value:"fibonacci-retracement"},{label:"toolbarAnnotationsFibonacciRetracementTrendBased",icon:"fibonacci-retracement-trend-based-drawing",value:"fibonacci-retracement-trend-based"}],g6=[{label:"Fibonacci - Extended",value:10},{label:"Fibonacci - 6 Band",value:6},{label:"Fibonacci - 4 Band",value:4}],f6=[{label:"toolbarAnnotationsText",icon:"text-annotation",value:"text"},{label:"toolbarAnnotationsComment",icon:"comment-annotation",value:"comment"},{label:"toolbarAnnotationsCallout",icon:"callout-annotation",value:"callout"},{label:"toolbarAnnotationsNote",icon:"note-annotation",value:"note"}],y6=[{label:"toolbarAnnotationsArrow",icon:"arrow-drawing",value:"arrow"},{label:"toolbarAnnotationsArrowUp",icon:"arrow-up-drawing",value:"arrow-up"},{label:"toolbarAnnotationsArrowDown",icon:"arrow-down-drawing",value:"arrow-down"}],m6=[{label:"toolbarAnnotationsQuickDatePriceRange",icon:"measurer-drawing",value:"quick-date-price-range"},{label:"toolbarAnnotationsDateRange",icon:"date-range-drawing",value:"date-range"},{label:"toolbarAnnotationsPriceRange",icon:"price-range-drawing",value:"price-range"},{label:"toolbarAnnotationsDatePriceRange",icon:"date-price-range-drawing",value:"date-price-range"}],gP=[{strokeWidth:1,label:"1",value:1},{strokeWidth:2,label:"2",value:2},{strokeWidth:3,label:"3",value:3},{strokeWidth:4,label:"4",value:4},{strokeWidth:8,label:"8",value:8}],mf=[{icon:"line-style-solid",altText:"iconAltTextLineStyleSolid",value:"solid"},{icon:"line-style-dashed",altText:"iconAltTextLineStyleDashed",value:"dashed"},{icon:"line-style-dotted",altText:"iconAltTextLineStyleDotted",value:"dotted"}],fP=[{label:"10",value:10},{label:"12",value:12},{label:"14",value:14},{label:"16",value:16},{label:"18",value:18},{label:"22",value:22},{label:"28",value:28},{label:"36",value:36},{label:"46",value:46}],{Color:yP,FloatingToolbar:x6,Menu:cI,PropertiesArray:b6,ToolbarButtonProperties:mP,ToolbarButtonWidget:v6,Property:kh}=k,Cu=class extends mP{constructor(){super(...arguments),this.checkedOverrides=new mP}};y([kh],Cu.prototype,"value",2),y([kh],Cu.prototype,"checkedOverrides",2),y([kh],Cu.prototype,"color",2),y([kh],Cu.prototype,"strokeWidth",2),y([kh],Cu.prototype,"isMultiColor",2);var S6=class extends v6{update(e){super.update(e),e.value==="line-stroke-width"&&this.updateLineStrokeWidth(e),(e.value==="fill-color"||e.value==="line-color"||e.value==="text-color")&&this.updateFillColor(e)}updateFillColor(e){const t=this.getElement();t.classList.add("ag-charts-annotations__color-picker-button"),t.classList.toggle("ag-charts-annotations__color-picker-button--multi-color",e.isMultiColor),t.style.setProperty("--color",e.color??null)}updateLineStrokeWidth(e){const t=this.getElement();t.classList.add("ag-charts-annotations__stroke-width-button"),t.style.setProperty("--stroke-width",`${e.strokeWidth}px`)}},M6=class extends x6{createButtonWidget(){return new S6(this.localeManager)}},hI=class extends k.BaseProperties{constructor(e,t){super(),this.ctx=e,this.getActiveDatum=t,this.enabled=!0,this.buttons=new b6(Cu),this.cleanup=new St,this.events=new Go,this.visibleButtons=[],this.toolbar=new M6(this.ctx,"ariaLabelAnnotationOptionsToolbar","annotation-options"),this.colorPicker=new uP(this.ctx),this.textSizeMenu=new cI(this.ctx,"text-size"),this.lineStyleTypeMenu=new cI(this.ctx,"annotations-line-style-type"),this.lineStrokeWidthMenu=new cI(this.ctx,"annotations-line-stroke-width"),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onButtonPress.bind(this)),this.toolbar.addToolbarListener("toolbar-moved",this.onToolbarMoved.bind(this)),e.widgets.seriesWidget.addListener("drag-start",this.onDragStart.bind(this)),e.widgets.seriesWidget.addListener("drag-end",this.onDragEnd.bind(this)),()=>{this.colorPicker.destroy(),this.toolbar.destroy()})}onDragStart(){this.toolbar.ignorePointerEvents()}onDragEnd(){this.toolbar.capturePointerEvents()}destroy(){this.cleanup.flush()}show(){this.enabled&&this.toolbar.show()}hide(){this.toolbar.hide()}updateButtons(e){if(!this.enabled)return;const t={"line-style-type":$l(e),"line-stroke-width":$l(e),"line-color":o6(e),"text-color":l6(e),"fill-color":r6(e),"text-size":rI(e),settings:Au(e),lock:!0,delete:!0};this.visibleButtons=this.buttons.filter(i=>t[i.value]),this.toolbar.clearButtons(),this.toolbar.updateButtons(this.visibleButtons),this.refreshButtons(e)}setAnchorScene(e){this.toolbar.hasBeenDragged()||this.toolbar.setAnchor(e.getAnchor())}hideOverlays(){this.toolbar.clearActiveButton(),this.colorPicker.hide({lastFocus:null}),this.textSizeMenu.hide(),this.lineStyleTypeMenu.hide(),this.lineStrokeWidthMenu.hide(),this.events.emit("hid-overlays",null)}clearActiveButton(){this.toolbar.clearActiveButton()}updateColors(e){this.updateColorPickerColor("line-color",e.getDefaultColor("line-color"),e.getDefaultOpacity("line-color"),"isMultiColor"in e&&e?.isMultiColor),this.updateColorPickerColor("fill-color",e.getDefaultColor("fill-color"),e.getDefaultOpacity("fill-color"),"isMultiColor"in e&&e?.isMultiColor),this.updateColorPickerColor("text-color",e.getDefaultColor("text-color"),e.getDefaultOpacity("text-color"),"isMultiColor"in e&&e?.isMultiColor)}updateColorPickerColor(e,t,i,s){if(t!=null&&i!=null){const{r:n,g:o,b:a}=yP.fromString(t);t=yP.fromArray([n,o,a,i]).toHexString()}this.updateButtonByValue(e,{color:t,isMultiColor:s})}updateFontSize(e){this.updateButtonByValue("text-size",{label:e==null?void 0:String(e)})}updateLineStyleType(e){this.updateButtonByValue("line-style-type",{icon:e.icon})}updateStrokeWidth(e){this.updateButtonByValue("line-stroke-width",{label:e.label,strokeWidth:e.value})}onButtonPress({event:e,button:t,buttonWidget:i}){const s=this.getActiveDatum();if(s)switch(this.hideOverlays(),t.value){case"line-style-type":{const n=$l(s)?ff(s.lineDash,s.lineStyle):void 0;this.lineStyleTypeMenu.show(i,{items:mf,ariaLabel:this.ctx.localeManager.t("toolbarAnnotationsLineStyle"),value:n,onPress:o=>this.onLineStyleTypeMenuPress(o,s),class:"ag-charts-annotations__line-style-type-menu"});break}case"line-stroke-width":{const n=$l(s)?s.strokeWidth:void 0;this.lineStrokeWidthMenu.show(i,{items:gP,ariaLabel:this.ctx.localeManager.t("toolbarAnnotationsLineStrokeWidth"),value:n,onPress:o=>this.onLineStrokeWidthMenuPress(o,s),class:"ag-charts-annotations__line-stroke-width-menu"});break}case"line-color":case"fill-color":case"text-color":{this.toolbar.toggleActiveButtonByIndex(t.index),this.colorPicker.show({color:s?.getDefaultColor(t.value),opacity:s?.getDefaultOpacity(t.value),sourceEvent:e.sourceEvent,hasMultiColorOption:"isMultiColor"in s,isMultiColor:"isMultiColor"in s&&s?.isMultiColor,onChange:s==null?void 0:this.onColorPickerChange.bind(this,t.value,s),onChangeHide:(n=>{this.events.emit("saved-color",{type:s.type,colorPickerType:t.value,color:s.getDefaultColor(n)})}).bind(this,t.value)});break}case"text-size":{const n=Ua(s)?s.fontSize:void 0;this.textSizeMenu.show(i,{items:fP,ariaLabel:this.ctx.localeManager.t("toolbarAnnotationsTextSize"),value:n,onPress:o=>this.onTextSizeMenuPress(o,s),class:"ag-charts-annotations__text-size-menu"});break}case"delete":{this.events.emit("pressed-delete",null);break}case"lock":{s.locked=!s.locked,this.refreshButtons(s),this.events.emit("pressed-lock",{locked:s.locked});break}case"settings":{this.toolbar.toggleActiveButtonByIndex(t.index),this.events.emit("pressed-settings",e);break}}}onToolbarMoved(e){const{buttonBounds:t,popoverBounds:i}=e,s={x:i.x,y:i.y+i.height+4},n={y:i.y-4};this.colorPicker.setAnchor(s,n);for(const[o,a]of t.entries()){const r=this.visibleButtons.at(o);if(!r)continue;const l={x:a.x,y:a.y+a.height-1},c={y:a.y};switch(r.value){case"line-stroke-width":this.lineStrokeWidthMenu.setAnchor(l,c);break;case"line-style-type":this.lineStyleTypeMenu.setAnchor(l,c);break;case"text-size":this.textSizeMenu.setAnchor(l,c);break}}}onColorPickerChange(e,t,i,s,n,o){this.events.emit("updated-color",{type:t.type,colorPickerType:e,colorOpacity:i,color:s,opacity:n,isMultiColor:o}),this.updateColorPickerColor(e,i,n,o)}onTextSizeMenuPress(e,t){if(!rI(t))return;const i=e.value;this.events.emit("updated-font-size",{type:t.type,fontSize:i}),this.textSizeMenu.hide(),this.updateFontSize(i)}onLineStyleTypeMenuPress(e,t){if(!$l(t))return;const i=e.value;this.events.emit("updated-line-style",{type:t.type,lineStyleType:i}),this.lineStyleTypeMenu.hide(),this.updateLineStyleType(e)}onLineStrokeWidthMenuPress(e,t){if(!$l(t))return;const i=e.value;this.events.emit("updated-line-width",{type:t.type,strokeWidth:i}),this.lineStrokeWidthMenu.hide(),this.updateStrokeWidth(e)}refreshButtons(e){const t=e.locked??!1;for(const[i,s]of this.visibleButtons.entries())s&&(s.value==="lock"?(this.toolbar.toggleSwitchCheckedByIndex(i,t),this.updateButtonByIndex(i,t?s.checkedOverrides.toJson():s.toJson())):this.toolbar.toggleButtonEnabledByIndex(i,!t));rI(e)&&this.updateFontSize(e.fontSize),this.updateColors(e),this.updateLineStyles(e)}updateLineStyles(e){if(!$l(e))return;const t=e.strokeWidth??1,i=ff(e.lineDash,e.lineStyle);this.updateStrokeWidth({strokeWidth:t,value:t,label:String(t)}),this.updateLineStyleType(mf.find(s=>s.value===i)??mf[0])}updateButtonByValue(e,t){const i=this.visibleButtons.findIndex(s=>s.value===e);i!==-1&&this.updateButtonByIndex(i,t)}updateButtonByIndex(e,t){const i=this.visibleButtons.at(e);i&&this.toolbar.updateButtonByIndex(e,{...i.toJson(),...t,value:t.value??i.value})}};y([kh],hI.prototype,"enabled",2),y([kh],hI.prototype,"buttons",2);var{StateMachine:xP,StateMachineProperty:dI,Vec2:bP,Debug:D6}=k,mi=class extends xP{constructor(e){const t=({context:i})=>{this.node?.drag(this.datum,this.offset,i,this.snapping),e.update()};super("idle",{idle:{dragStart:{target:"dragging",action:({offset:i,context:s})=>{this.hasMoved=!1,this.dragStart=i,this.offset=i,this.node?.dragStart(this.datum,i,s)}}},dragging:{keyDown:t,keyUp:t,drag:({offset:i,context:s})=>{this.hasMoved=bP.lengthSquared(bP.sub(i,this.dragStart))>0,this.offset=i,this.node?.drag(this.datum,i,s,this.snapping),e.update()},dragEnd:{target:xP.parent,action:()=>{this.node?.stopDragging(),this.hasMoved&&e.recordAction("Move annotation"),e.update()}}}}),this.debug=D6.create(!0,"annotations"),this.hasMoved=!1,this.snapping=!1}};y([dI()],mi.prototype,"snapping",2),y([dI()],mi.prototype,"datum",2),y([dI()],mi.prototype,"node",2);var{Property:k6}=k,Ul=class extends oI{constructor(){super(...arguments),this.type="arrow-down"}static is(e){return Ee(e)&&e.type==="arrow-down"}};y([k6],Ul.prototype,"type",2);var Lu=class extends k.Marker{isPointInPath(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)}},vP=class GV extends k.Group{constructor(){super(...arguments),this.active=!1,this.locked=!1,this.visible=!1,this.zIndex=1}drag(t){const{handle:i,locked:s}=this;return s?{point:{x:i.x,y:i.y},offset:{x:0,y:0}}:{point:t,offset:{x:t.x-i.x,y:t.y-i.y}}}toggleActive(t){this.active=t,t||(this.handle.strokeWidth=GV.INACTIVE_STROKE_WIDTH)}toggleHovered(t){this.glow.visible=!this.locked&&t,this.glow.dirtyPath=!0}toggleDragging(t){this.locked||(this.handle.visible=!t,this.glow.visible=this.glow.visible&&!t,this.handle.dirtyPath=!0,this.glow.dirtyPath=!0)}toggleLocked(t){this.locked=t}getCursor(){}containsPoint(t,i){return this.handle.containsPoint(t,i)}};vP.INACTIVE_STROKE_WIDTH=2;var Kl=vP,uI=class jV extends Kl{constructor(){super(),this.handle=new Lu({shape:"circle"}),this.glow=new Lu({shape:"circle"}),this.append([this.handle]),this.handle.size=jV.HANDLE_SIZE,this.handle.strokeWidth=Kl.INACTIVE_STROKE_WIDTH,this.handle.zIndex=2}update(t){this.handle.setProperties({...t,strokeWidth:Kl.INACTIVE_STROKE_WIDTH})}drag(t){return{point:t,offset:{x:0,y:0}}}};uI.HANDLE_SIZE=7,uI.GLOW_SIZE=9;var Yl=uI,ub=class Ln extends Kl{constructor(){super(),this.handle=new k.Rect,this.glow=new k.Rect,this.gradient="horizontal",this.append([this.glow,this.handle]),this.handle.cornerRadius=Ln.CORNER_RADIUS,this.handle.width=Ln.HANDLE_SIZE,this.handle.height=Ln.HANDLE_SIZE,this.handle.strokeWidth=Kl.INACTIVE_STROKE_WIDTH,this.handle.zIndex=2,this.glow.cornerRadius=Ln.CORNER_RADIUS,this.glow.width=Ln.GLOW_SIZE,this.glow.height=Ln.GLOW_SIZE,this.glow.strokeWidth=0,this.glow.fillOpacity=.2,this.glow.zIndex=1,this.glow.visible=!1}toggleLocked(t){if(super.toggleLocked(t),t){const i=(Ln.HANDLE_SIZE-Yl.HANDLE_SIZE)/2;this.handle.cornerRadius=1,this.handle.fill=this.handle.stroke,this.handle.strokeWidth=0,this.handle.x+=i,this.handle.y+=i,this.handle.width=Yl.HANDLE_SIZE,this.handle.height=Yl.HANDLE_SIZE,this.glow.width=Yl.GLOW_SIZE,this.glow.height=Yl.GLOW_SIZE}else this.handle.cornerRadius=Ln.CORNER_RADIUS,this.handle.width=Ln.HANDLE_SIZE,this.handle.height=Ln.HANDLE_SIZE,this.glow.width=Ln.GLOW_SIZE,this.glow.height=Ln.GLOW_SIZE,this.cachedStyles&&this.handle.setProperties(this.cachedStyles)}update(t){if(this.cachedStyles={...t},this.active||delete t.strokeWidth,this.locked){delete t.fill,delete t.strokeWidth;const i=(Ln.HANDLE_SIZE-Yl.HANDLE_SIZE)/2;t.x-=i,t.y-=i,this.cachedStyles.x-=i,this.cachedStyles.y-=i}this.handle.setProperties(t),this.glow.setProperties({...t,x:(t.x??this.glow.x)-2,y:(t.y??this.glow.y)-2,strokeWidth:0,fill:t.stroke})}drag(t){return this.locked?{point:t,offset:{x:0,y:0}}:this.gradient==="vertical"?{point:{x:t.x,y:this.handle.y},offset:{x:t.x-this.handle.x,y:0}}:{point:{x:this.handle.x,y:t.y},offset:{x:0,y:t.y-this.handle.y}}}getCursor(){if(!this.locked)return this.gradient==="vertical"?"col-resize":"row-resize"}};ub.HANDLE_SIZE=12,ub.GLOW_SIZE=16,ub.CORNER_RADIUS=4;var Tu=ub,pI=class iy extends Kl{constructor(){super(),this.handle=new Lu({shape:"circle"}),this.glow=new Lu({shape:"circle"}),this.append([this.glow,this.handle]),this.handle.size=iy.HANDLE_SIZE,this.handle.strokeWidth=Kl.INACTIVE_STROKE_WIDTH,this.handle.zIndex=2,this.glow.size=iy.GLOW_SIZE,this.glow.strokeWidth=0,this.glow.fillOpacity=.2,this.glow.zIndex=1,this.glow.visible=!1}toggleLocked(t){super.toggleLocked(t),t?(this.handle.fill=this.handle.stroke,this.handle.strokeWidth=0,this.handle.size=Yl.HANDLE_SIZE,this.glow.size=Yl.GLOW_SIZE):(this.handle.size=iy.HANDLE_SIZE,this.glow.size=iy.GLOW_SIZE,this.cachedStyles&&this.handle.setProperties(this.cachedStyles))}update(t){this.cachedStyles={...t},this.active||delete t.strokeWidth,this.locked&&(delete t.fill,delete t.strokeWidth),this.handle.setProperties(t),this.glow.setProperties({...t,strokeWidth:0,fill:t.stroke})}getCursor(){return"pointer"}};pI.HANDLE_SIZE=11,pI.GLOW_SIZE=17;var Kt=pI,{ZIndexMap:I6}=k,es=class extends k.Group{constructor(){super(...arguments),this.name="AnnotationScene",this.zIndex=I6.CHART_ANNOTATION}static isCheck(e,t){return Ee(e)&&Object.hasOwn(e,"type")&&e.type===t}toggleHovered(e,t,i){i!==!0&&this.toggleHandles(e||t)}computeBBoxWithoutHandles(){return k.Transformable.toCanvas(this,k.Group.computeChildrenBBox(this.excludeChildren({instance:Kl})))}updateNode(e,t,i){if(!i&&t){t.remove();return}return i&&t==null&&(t=new e,this.appendChild(t)),t}},{ContinuousScale:A6,Vec2:Lo,toRadians:C6}=k;function xf(e,t,i=!1,s,n=1){if(!i)return ln(e,t);const o=s?Ut(s,t):Lo.origin();return ln(pb(e,o,n),t)}function pb(e,t,i){const s=Lo.sub(e,t),n=C6(i),o=Math.round(Lo.angle(s)/n)*n;return Lo.rotate(s,o,t)}function gb(e,t){const i={};for(const[s,n]of Tt(e))i[s]=Ut(n,t);return i}function $r(e,t,i,s={overflowContinuous:0,translateVectors:void 0,invertYVectors:void 0,snap:void 0}){const{xAxis:n,yAxis:o}=i,a=Object.keys(e),r=[],l=[],c=new Set(s.translateVectors??a),h=new Set(s.invertYVectors??[]),d=new Set([...c,...h]),u=Lo.multiply(t,Lo.from(1,-1));for(const m of a)d.has(m)&&(e[m]=Lo.add(e[m],h.has(m)?u:t),s.snap&&(e[m]=pb(e[m],s.snap.vectors[m],s.snap.angle))),r.push(n.getRangeOverflow(e[m].x)),l.push(o.getRangeOverflow(e[m].y));const p=(m,v)=>Math.abs(m)-Math.abs(v),g=(m,v,b)=>s.overflowContinuous===0||!A6.is(m)?b.toSorted(p).at(-1)??0:a.length===d.size?b.toSorted(p).at(-s.overflowContinuous-1)??0:b.filter(D=>D!==0).length<=s.overflowContinuous?0:b.filter((D,L)=>D!==0&&Math.abs(D)<=Math.abs(v)&&d.has(a[L])).toSorted(p).at(-1)??0,f=Lo.from(g(n.scale,t.x,r),g(o.scale,t.y,l));if(!Lo.equal(f,Lo.origin()))for(const m of a)d.has(m)&&(e[m]=Lo.round(Lo.sub(e[m],f),4));const x={};for(const m of a)x[m]=ln(e[m],i);return x}var{Vec2:L6}=k,SP=class extends es{constructor(){super(...arguments),this.handle=new Kt,this.anchor={x:0,y:0,position:"above"}}update(e,t){const i=Ut(e,t);this.updateHandle(e,i),this.anchor=this.updateAnchor(e,i,t)}dragStart(e,t,i){this.dragState={offset:t,...gb({handle:e},i)}}drag(e,t,i){const{dragState:s}=this;if(!e.isWriteable()||!s)return;const{point:n}=$r({point:s.handle},L6.sub(t,s.offset),i);e.x=n.x,e.y=n.y}translate(e,t,i){if(!e.isWriteable())return;const{point:s}=$r({point:Ut(e,i)},t,i);e.x=s.x,e.y=s.y}toggleHandles(e){this.handle.visible=!!e,this.handle.toggleHovered(this.activeHandle==="handle")}toggleActive(e){this.toggleHandles(e),this.handle.toggleActive(e)}stopDragging(){this.handle.toggleDragging(!1)}copy(e,t,i){const s=Ut(e,i),n=ln({x:s.x-30,y:s.y-30},i);return t.x=n.x,t.y=n.y,t}getAnchor(){return this.anchor}getCursor(){return"pointer"}containsPoint(e,t){const{handle:i}=this;return this.activeHandle=void 0,i.containsPoint(e,t)?(this.activeHandle="handle",!0):!1}getNodeAtCoords(e,t){if(this.handle.containsPoint(e,t))return"handle"}updateHandle(e,t,i){const{x:s,y:n}=this.getHandleCoords(e,t,i),o=this.getHandleStyles(e);this.handle.update({...o,x:s,y:n}),this.handle.toggleLocked(e.locked??!1)}updateAnchor(e,t,i){const s=this.getHandleCoords(e,t);return{x:s.x+i.seriesRect.x,y:s.y+i.seriesRect.y,position:this.anchor.position}}getHandleCoords(e,t,i){return{x:t.x,y:t.y}}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke,strokeOpacity:e.handle.strokeOpacity,strokeWidth:e.handle.strokeWidth}}},MP=class extends SP{constructor(){super(),this.append([this.handle])}update(e,t){super.update(e,t);const i=Ut(e,t);this.updateShape(e,i)}updateShape(e,t){this.updateShapeStyles(e),this.updateShapePath(e,t)}updateShapeStyles(e){const{shape:t}=this;t.fill=e.fill,t.fillOpacity=e.fillOpacity??1}updateShapePath(e,t){const{shape:i}=this;i.x=t.x,i.y=t.y,i.size=e.size}containsPoint(e,t){return super.containsPoint(e,t)||this.shape.containsPoint(e,t)}getNodeAtCoords(e,t){return this.shape.containsPoint(e,t)?"shape":super.getNodeAtCoords(e,t)}},DP=[[.5,0],[1,.5],[.75,.5],[.75,1],[.25,1],[.25,.5],[0,.5]];function kP(e){k.drawMarkerUnitPolygon(e,DP)}kP.anchor={x:.5,y:0};var fb=class extends MP{constructor(){super(),this.type="arrow-up",this.shape=new Lu({shape:kP}),this.append([this.shape])}static is(e){return es.isCheck(e,"arrow-up")}getHandleCoords(e,t){const i=Kt.HANDLE_SIZE/2,s=super.getHandleCoords(e,t);return s.y-=i,s}},T6=DP.map(([e,t])=>[e,1-t]);function IP(e){k.drawMarkerUnitPolygon(e,T6)}IP.anchor={x:.5,y:1};var yb=class extends MP{constructor(){super(),this.type="arrow-down",this.shape=new Lu({shape:IP}),this.append([this.shape])}static is(e){return es.isCheck(e,"arrow-down")}updateAnchor(e,t,i){const s=super.updateAnchor(e,t,i);return s.y-=e.size,s}getHandleCoords(e,t){const i=Kt.HANDLE_SIZE/2,s=super.getHandleCoords(e,t);return s.y+=i,s}},{StateMachine:mb,StateMachineProperty:w6,Debug:N6}=k,gI=class extends mb{constructor(e){const t=({point:s})=>{const n=this.createDatum();n.set({x:s.x,y:s.y}),e.create(n)},i=()=>{this.node?.toggleActive(!0),e.showAnnotationOptions(),e.update()};super("start",{start:{click:{target:"waiting-first-render",action:t},drag:{target:"waiting-first-render",action:t},cancel:mb.parent,reset:mb.parent},"waiting-first-render":{render:{target:mb.parent,action:i}}}),this.debug=N6.create(!0,"annotations")}};y([w6()],gI.prototype,"node",2);var O6=class extends gI{createDatum(){return new Ul}},AP={type:"arrow-down",datum:Ul,scene:yb,isDatum:Ul.is,translate:(e,t,i,s)=>{Ul.is(t)&&yb.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Ul.is(t)&&Ul.is(i)&&yb.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Ul.is(t)&&yb.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new O6({...e,create:t("arrow-down")}),dragState:e=>new mi(e)},{Property:E6}=k,Zl=class extends oI{constructor(){super(...arguments),this.type="arrow-up"}static is(e){return Ee(e)&&e.type==="arrow-up"}};y([E6],Zl.prototype,"type",2);var P6=class extends gI{createDatum(){return new Zl}},CP={type:"arrow-up",datum:Zl,scene:fb,isDatum:Zl.is,translate:(e,t,i,s)=>{Zl.is(t)&&fb.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Zl.is(t)&&Zl.is(i)&&fb.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Zl.is(t)&&fb.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new P6({...e,create:t("arrow-up")}),dragState:e=>new mi(e)},{Vec2:R6,Vec4:LP}=k,TP=class extends es{constructor(){super(...arguments),this.overflowContinuous=0}extendLine({x1:e,y1:t,x2:i,y2:s},n,o){const a={x1:e,y1:t,x2:i,y2:s};if(!n.extendStart&&!n.extendEnd)return a;const[r,l]=HX(a,o.yAxis.bounds),c=a.x2=a.y2,d=a.x2===a.x1;return n.extendEnd&&(d?a.y2=h?l.y:r.y:(a.x2=c?r.x:l.x,a.y2=c?r.y:l.y)),n.extendStart&&(d?a.y1=h?r.y:l.y:(a.x1=c?l.x:r.x,a.y1=c?l.y:r.y)),a}dragStart(e,t,i){this.dragState={offset:t,...gb({start:e.start,end:e.end},i)}}drag(e,t,i,s){e.isWriteable()&&(this.activeHandle?this.dragHandle(e,t,i,s):this.dragAll(e,t,i))}dragAll(e,t,i){const{dragState:s}=this;s&&this.translatePoints(e,s.start,s.end,R6.sub(t,s.offset),i)}translate(e,t,i){e.isWriteable()&&this.translatePoints(e,Ut(e.start,i),Ut(e.end,i),t,i)}copy(e,t,i){const s=rn(e,i);if(!s)return;const n=this.computeBBoxWithoutHandles(),o={x:-n.width/2,y:-n.height/2};return this.translatePoints(t,LP.start(s),LP.end(s),o,i),t}translatePoints(e,t,i,s,n){const o=this.getTranslatePointsVectors(t,i),a=$r(o,s,n,{overflowContinuous:this.overflowContinuous});e.start.x=a.start.x,e.end.x=a.end.x,e.start.y=a.start.y,e.end.y=a.end.y}getTranslatePointsVectors(e,t){return{start:e,end:t}}},{Vec2:z6,Vec4:wP}=k,fI=class extends TP{constructor(){super(...arguments),this.start=new Kt,this.end=new Kt,this.anchor={x:0,y:0,position:"above"}}update(e,t){const i=rn(e,t);i!=null&&(this.updateHandles(e,i),this.updateAnchor(e,i,t))}toggleHandles(e){if(typeof e=="boolean")this.start.visible=e,this.end.visible=e;else for(const[t,i]of Tt(e))this[t].visible=i;this.start.toggleHovered(this.activeHandle==="start"),this.end.toggleHovered(this.activeHandle==="end")}toggleActive(e){this.toggleHandles(e),this.start.toggleActive(e),this.end.toggleActive(e)}dragHandle(e,t,i,s){const{activeHandle:n,dragState:o}=this;if(!n||!o)return;this[n].toggleDragging(!0);const a=n==="start"?"end":"start",r=s?{vectors:{[n]:Ut(e[a],i)},angle:e.snapToAngle}:void 0,{[n]:l}=$r({[n]:o[n]},z6.sub(t,o.offset),i,{overflowContinuous:0,snap:r});e[n].x=l.x,e[n].y=l.y}stopDragging(){this.start.toggleDragging(!1),this.end.toggleDragging(!1)}getAnchor(){return this.anchor}getCursor(){return"pointer"}containsPoint(e,t){const{start:i,end:s}=this;return this.activeHandle=void 0,i.containsPoint(e,t)?(this.activeHandle="start",!0):s.containsPoint(e,t)?(this.activeHandle="end",!0):!1}getNodeAtCoords(e,t){if(this.start.containsPoint(e,t)||this.end.containsPoint(e,t))return"handle"}updateHandles(e,t,i){this.start.update({...this.getHandleStyles(e,"start"),...this.getHandleCoords(e,t,"start")}),this.end.update({...this.getHandleStyles(e,"end"),...this.getHandleCoords(e,t,"end",i)}),this.start.toggleLocked(e.locked??!1),this.end.toggleLocked(e.locked??!1)}updateAnchor(e,t,i,s){this.anchor={x:t.x1+i.seriesRect.x,y:t.y1+i.seriesRect.y,position:this.anchor.position}}getHandleCoords(e,t,i,s){return i==="start"?wP.start(t):wP.end(t)}getHandleStyles(e,t){return{fill:e.handle.fill,stroke:e.handle.stroke,strokeOpacity:e.handle.strokeOpacity,strokeWidth:e.handle.strokeWidth}}},{Vec4:NP}=k,F6=class extends fI{constructor(){super(...arguments),this.label=new k.Text({zIndex:1}),this.anchor={x:0,y:0,position:"above-left"}}setTextInputBBox(e){this.textInputBBox=e,this.markDirty("TextualStartEndScene")}update(e,t){const i=rn(e,t);if(i==null)return;const s=this.getTextBBox(e,i);this.updateLabel(e,s,i),this.updateHandles(e,i,s),this.updateShape(e,s,i),this.updateAnchor(e,i,t,s)}containsPoint(e,t){return super.containsPoint(e,t)||this.label.containsPoint(e,t)}getNodeAtCoords(e,t){return this.label.containsPoint(e,t)?"text":super.getNodeAtCoords(e,t)}getTextBBox(e,t){const{text:i}=e.getText();return nI(e,i,NP.end(t),this.textInputBBox)}updateLabel(e,t,i){const{text:s,isPlaceholder:n}=e.getText();iP(this.label,s,n,e,this.getLabelCoords(e,t,i))}updateShape(e,t,i){}getLabelCoords(e,t,i){return NP.end(i)}getHandleStyles(e,t){return{...super.getHandleStyles(e,t),stroke:e.handle.stroke??e.color}}},{drawCorner:B6,Path:_6}=k,xb=class extends F6{constructor(){super(),this.type="callout",this.shape=new _6,this.append([this.shape,this.label,this.start,this.end])}static is(e){return es.isCheck(e,"callout")}drag(e,t,i,s){e.isWriteable()&&(this.activeHandle==="end"?this.dragHandle(e,t,i,s):this.dragAll(e,t,i))}getLabelCoords(e,t,i){const s=e.getPadding(),{bodyBounds:n={x:0,y:0,width:0,height:0}}=this.getDimensions(e,t,i)??{};return{x:n.x+s.left,y:n.y-s.bottom}}getHandleStyles(e,t){return t==="start"?{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity,strokeWidth:e.handle.strokeWidth}:{fill:void 0,strokeWidth:0}}updateAnchor(e,t,i,s){const{bodyBounds:n}=this.getDimensions(e,s,t)??{},o=n??s;this.anchor={x:o.x+i.seriesRect.x,y:o.y+i.seriesRect.y-o.height,position:this.anchor.position}}updateShape(e,t,i){const{shape:s}=this;s.fill=e.fill,s.fillOpacity=e.fillOpacity??1,s.stroke=e.stroke,s.strokeWidth=e.strokeWidth??1,s.strokeOpacity=e.strokeOpacity??1;const{tailPoint:n,bodyBounds:o}=this.getDimensions(e,t,i)??{};!n||!o||this.updatePath(n,o)}updatePath(e,t){const{x:i,y:s}=e,{x:n,y:o,width:a,height:r}=t,l=o-r,c=n+a,h=this.calculateCalloutPlacement({x:i,y:s},t),d=8,u=[{coordinates:{x0:n,x1:n+d,y0:l+d,y1:l,cx:h==="topLeft"?i:n+d,cy:h==="topLeft"?s:l+d},type:h==="topLeft"?"calloutCorner":"corner"},{coordinates:{x0:n+d,x1:c-d,y0:l,y1:l,cx:i,cy:s},type:h==="top"?"calloutSide":"side"},{coordinates:{x0:c-d,x1:c,y0:l,y1:l+d,cx:h==="topRight"?i:c-d,cy:h==="topRight"?s:l+d},type:h==="topRight"?"calloutCorner":"corner"},{coordinates:{x0:c,x1:c,y0:l+d,y1:o-d,cx:i,cy:s},type:h==="right"?"calloutSide":"side"},{coordinates:{x0:c,x1:c-d,y0:o-d,y1:o,cx:h==="bottomRight"?i:c-d,cy:h==="bottomRight"?s:o-d},type:h==="bottomRight"?"calloutCorner":"corner"},{coordinates:{x0:c-d,x1:n+d,y0:o,y1:o,cx:i,cy:s},type:h==="bottom"?"calloutSide":"side"},{coordinates:{x0:n+d,x1:n,y0:o,y1:o-d,cx:h==="bottomLeft"?i:n+d,cy:h==="bottomLeft"?s:o-d},type:h==="bottomLeft"?"calloutCorner":"corner"},{coordinates:{x0:n,x1:n,y0:o-d,y1:l+d,cx:i,cy:s},type:h==="left"?"calloutSide":"side"}],{path:p}=this.shape;p.clear(),p.moveTo(n,l+d);for(const{coordinates:g,type:f}of u)this.drawPath(p,g,d,f);p.closePath()}drawPath(e,{x0:t,y0:i,x1:s,y1:n,cx:o,cy:a},r,l){switch(l){case"calloutCorner":{e.lineTo(o,a),e.lineTo(s,n);break}case"corner":{B6(e,{x0:t,x1:s,y0:i,y1:n,cx:o,cy:a},r,!1);break}case"calloutSide":{if(t===s){const h=i>n?-1:1,d=Math.min(i,n)+Math.abs(i-n)/2;e.lineTo(t,d-6*h),e.lineTo(o,a),e.lineTo(t,d+6*h),e.lineTo(s,n)}else{const h=t>s?-1:1,d=Math.min(t,s)+Math.abs(s-t)/2;e.lineTo(d-6*h,i),e.lineTo(o,a),e.lineTo(d+6*h,i),e.lineTo(s,n)}break}case"side":default:{e.lineTo(s,n);break}}}calculateCalloutPlacement(e,t){const i=t.x+t.width,s=t.y-t.height;let n,o;return e.x>i?n="right":e.xt.y?o="bottom":e.y{const p=this.createDatum();p.set({start:u,end:u,visible:!0}),e.create(p)},i=()=>{const{node:u}=this;u?.toggleActive(!0),u?.toggleHandles({start:!0})},s=()=>{e.showTextInput(),this.datum&&(this.datum.visible=!1)},n=()=>{e.hideTextInput(),this.datum&&(this.datum.visible=!0),e.deselect()},o=u=>{this.node?.setTextInputBBox(u),e.update()},a=({point:u})=>{const{datum:p,node:g}=this;p?.set({end:u}),g?.toggleActive(!0),g?.toggleHandles({end:!1}),e.update()},r=()=>{e.showAnnotationOptions(),this.node?.toggleHandles({end:!0})},l=({colorPickerType:u,colorOpacity:p,color:g,opacity:f,isMultiColor:x})=>{const{datum:m}=this;m&&(u==="text-color"&&e.updateTextInputColor(g),db(m,u,p,g,f,x),e.update())},c=u=>{const{datum:p,node:g}=this;!p||!g||!Ua(p)||(p.fontSize=u,e.updateTextInputFontSize(u),e.update())},h=()=>{e.delete()},d=({textInputValue:u,bbox:p})=>{const{datum:g}=this;if(p!=null&&u!=null&&u.length>0){if(!Ua(g))return;const f=ob(g,u,p.width);g?.set({text:f}),e.update(),e.recordAction(`Create ${g?.type} annotation`)}else e.delete()};super("start",{start:{click:{target:"waiting-first-render",action:t},dragStart:{target:"waiting-first-render",action:t},cancel:ha.parent,reset:ha.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:a,drag:a,click:{target:"edit",action:r},dragEnd:{target:"edit",action:r},reset:{target:ha.parent,action:h},cancel:{target:ha.parent,action:h}},edit:{onEnter:s,updateTextInputBBox:o,color:l,fontSize:c,textInput:[{guard:yI,target:ha.parent,action:h},{guard:mI,target:ha.parent,action:d}],click:{target:ha.parent,action:d},dragStart:{target:ha.parent,action:d},resize:{target:ha.parent,action:d},onExit:n,cancel:{target:ha.parent,action:h}}}),this.debug=V6.create(!0,"annotations")}};y([OP()],xI.prototype,"datum",2),y([OP()],xI.prototype,"node",2);var G6=class extends xI{createDatum(){return new ca}},EP={type:"callout",datum:ca,scene:xb,isDatum:ca.is,translate:(e,t,i,s)=>{if(ca.is(t)&&xb.is(e))return e.translate(t,i,s)},copy:(e,t,i,s)=>{if(ca.is(t)&&ca.is(i)&&xb.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{ca.is(t)&&xb.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new G6({...e,create:t("callout")}),dragState:e=>new mi(e)},bI=class extends SP{constructor(){super(...arguments),this.label=new k.Text({zIndex:1}),this.anchor={x:0,y:0,position:"above-left"}}setTextInputBBox(e){this.textInputBBox=e,this.markDirty("TextualPointScene")}update(e,t){const i=Ut(e,t),s=this.getTextBBox(e,i,t);this.updateLabel(e,s),this.updateHandle(e,i,s),this.updateShape(e,s),this.anchor=this.updateAnchor(e,s,t)}copy(e,t,i){const s=Ut(e,i),n=this.getTextBBox(e,s,i),o=e.getPadding(),a=o.left+o.right,r=o.top+o.bottom,l=(n.width+a)/2,c=n.height+r,h=ln({x:s.x-l,y:s.y-c},i);return t.x=h.x,t.y=h.y,t}containsPoint(e,t){const{label:i}=this;return super.containsPoint(e,t)||i.visible&&i.containsPoint(e,t)}getNodeAtCoords(e,t){return this.label.visible&&this.label.containsPoint(e,t)?"text":super.getNodeAtCoords(e,t)}getTextBBox(e,t,i){const{text:s}=e.getText();return nI(e,s,{x:t.x,y:t.y},this.textInputBBox)}updateLabel(e,t){const{text:i,isPlaceholder:s}=e.getText();iP(this.label,i,s,e,this.getLabelCoords(e,t),this.getTextBaseline(e))}updateShape(e,t){}updateAnchor(e,t,i){return{x:t.x+i.seriesRect.x,y:t.y+i.seriesRect.y-t.height,position:this.anchor.position}}getLabelCoords(e,t){return t}getTextBaseline(e){return e.position=="center"?"middle":e.position}getHandleCoords(e,t,i){return i}getHandleStyles(e){const t=super.getHandleStyles(e);return t.stroke=e.handle.stroke??e.color,t}},{drawCorner:vI}=k,bb=class extends bI{constructor(){super(),this.type="comment",this.shape=new k.Path,this.append([this.shape,this.label,this.handle])}static is(e){return es.isCheck(e,"comment")}updateShape(e,t){const{shape:i}=this;i.fill=e.fill,i.fillOpacity=e.fillOpacity??1,i.stroke=e.stroke??"transparent",i.strokeWidth=e.strokeWidth??1,i.strokeOpacity=e.strokeOpacity??1,this.updatePath(e,t)}getLabelCoords(e,t){const i=e.getPadding();return{x:t.x+i.left,y:t.y-i.bottom}}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke??e.fill,strokeOpacity:e.handle.strokeOpacity,strokeWidth:e.handle.strokeWidth}}updateAnchor(e,t,i){const s=super.updateAnchor(e,t,i),n=e.getPadding();return s.y-=n.bottom+n.top,s}updatePath(e,t){const i=e.getPadding(),{x:s,y:n}=t;let{width:o,height:a}=t;const{fontSize:r}=e,l=i.left+i.right,c=i.top+i.bottom;o=o+l,a=Math.max(a+c,r+c);const h=n-a,d=s+o,u=($o(r,nb)+c)/2,{path:p}=this.shape;p.clear(),p.moveTo(s,n),p.lineTo(s,h+u),vI(p,{x0:s,x1:s+u,y0:h+u,y1:h,cx:s+u,cy:h+u},u,!1),p.lineTo(d-u,h),vI(p,{x0:d-u,x1:d,y0:h,y1:h+u,cx:d-u,cy:h+u},u,!1),p.lineTo(d,n-u),vI(p,{x0:d,x1:d-u,y0:n-u,y1:n,cx:d-u,cy:n-u},u,!1),p.closePath()}containsPoint(e,t){return super.containsPoint(e,t)||this.shape.containsPoint(e,t)}},{StateMachine:Ur,StateMachineProperty:PP,Debug:j6}=k,bf=class extends Ur{constructor(e){const t=({point:h})=>{const d=this.createDatum();d.set({x:h.x,y:h.y}),e.create(d)},i=()=>{this.node?.toggleActive(!0),e.showAnnotationOptions(),e.update()},s=()=>{e.showTextInput(),this.datum&&(this.datum.visible=!1)},n=()=>{e.hideTextInput(),this.datum&&(this.datum.visible=!0),e.deselect()},o=h=>{this.node?.setTextInputBBox(h),e.update()},a=({colorPickerType:h,colorOpacity:d,color:u,opacity:p,isMultiColor:g})=>{this.datum&&(h==="text-color"&&e.updateTextInputColor(u),db(this.datum,h,d,u,p,g),e.update())},r=h=>{const{datum:d,node:u}=this;!d||!u||!Ua(d)||(d.fontSize=h,e.updateTextInputFontSize(h),e.update())},l=()=>{e.delete()},c=({textInputValue:h,bbox:d})=>{if(d!=null&&h!=null&&h.length>0){const{datum:u}=this;if(!Ua(u))return;const p=ob(u,h,d.width);u?.set({text:p}),e.update(),e.recordAction(`Create ${u?.type} annotation`)}else e.delete()};super("start",{start:{click:{target:"waiting-first-render",action:t},dragStart:{target:"waiting-first-render",action:t},cancel:Ur.parent,reset:Ur.parent},"waiting-first-render":{render:{target:"edit",action:i}},edit:{onEnter:s,updateTextInputBBox:o,color:a,fontSize:r,textInput:[{guard:yI,target:Ur.parent,action:l},{guard:mI,target:Ur.parent,action:c}],click:{target:Ur.parent,action:c},dragStart:{target:Ur.parent,action:c},resize:{target:Ur.parent,action:c},onExit:n,cancel:{target:Ur.parent,action:l}}}),this.debug=j6.create(!0,"annotations")}};y([PP()],bf.prototype,"datum",2),y([PP()],bf.prototype,"node",2);var H6=class extends bf{createDatum(){return new Ha}},RP={type:"comment",datum:Ha,scene:bb,isDatum:Ha.is,translate:(e,t,i,s)=>{Ha.is(t)&&bb.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Ha.is(t)&&Ha.is(i)&&bb.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Ha.is(t)&&bb.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new H6({...e,create:t("comment")}),dragState:e=>new mi(e)},{calculateLabelTranslation:W6}=k,zP=class extends k.Group{constructor(){super({name:"AnnotationAxisLabelGroup"}),this.label=new k.Text({zIndex:1}),this.rect=new k.Rect;const{label:e}=this;e.fontSize=12,e.fontFamily="Verdana, sans-serif",e.fill="black",e.textBaseline="middle",e.textAlign="center",this.append([this.rect,this.label])}update(e){this.updateLabel(e),this.updateRect(e),this.updatePosition(e)}updateLabel({value:e,styles:t,context:i}){const{fontWeight:s,fontSize:n,fontStyle:o,fontFamily:a,textAlign:r,color:l="white",formatter:c}=t,h=c?c({value:e}):i.formatScaleValue(e,"annotation-label");this.label.setProperties({fontWeight:s,fontSize:n,fontStyle:o,fontFamily:a,textAlign:r,fill:l,text:h})}updateRect({styles:e}){const{rect:t}=this,{cornerRadius:i,fill:s,fillOpacity:n,stroke:o,strokeOpacity:a}=e;t.fill=s,t.fillOpacity=n??1,t.stroke=o,t.strokeOpacity=a??1,t.cornerRadius=i??0}updatePosition({x:e,y:t,context:i,styles:{padding:s}}){const{label:n,rect:o}=this,a=n.getBBox()?.clone(),r=s??8,l=s??4,{xTranslation:c,yTranslation:h}=W6({yDirection:!0,padding:i.labelPadding,position:i.position??"left",bbox:a});a.grow(r,"horizontal"),a.grow(l,"vertical");const d=e+c,u=t+h;n.x=d,n.y=u,o.y=u-Math.round(a.height/2),o.x=d-Math.round(a.width/2),o.height=a.height,o.width=a.width}};zP.className="AxisLabel";var{Vec2:Ka}=k,Mn=class extends k.Line{constructor(){super(...arguments),this.growCollisionBox=9,this.clipMask=new Map}setProperties(e){return super.setProperties(e),this.updateCollisionBBox(),this}updateCollisionBBox(){const{growCollisionBox:e,strokeWidth:t,x1:i,y1:s,x2:n,y2:o}=this;let a=t+e;a%2===0&&(a+=1);const r=Ka.from(i,s-Math.floor(a/2)),l=Ka.from(n,o),c=Ka.distance(r,l);this.collisionBBox=new k.BBox(r.x,r.y,c,a)}isPointInPath(e,t){const{collisionBBox:i,x1:s,y1:n,x2:o,y2:a}=this;if(!i)return!1;const r=Ka.from(s,n),l=Ka.from(o,a),c=Ka.sub(Ka.from(e,t),r),h=Ka.sub(l,r),d=Ka.rotate(c,Ka.angle(c,h),r);return i.containsPoint(d.x,d.y)??!1}render(e){const{clipMask:t}=this,{ctx:i}=e;if(t.size===0){super.render(e);return}i.save();try{for(const s of this.clipMask.values()){const{x:n,y:o,radius:a}=s;i.beginPath(),i.rect(0,0,i.canvas.width,i.canvas.height),i.ellipse(n,o,a,a,0,Math.PI*2,0,!0),i.clip()}super.render(e)}finally{i.restore()}}setClipMask(e,t){const i=this.clipMask.get(e);k.jsonDiff(i,t)!=null&&this.markDirty("CollidableLine"),t?this.clipMask.set(e,t):this.clipMask.delete(e)}},Ih=class extends k.TransformableText{constructor(){super(...arguments),this.growCollisionBox={top:4,right:4,bottom:4,left:4}}isPointInPath(e,t){const i=this.fromParentPoint(e,t),s=this.computeBBoxWithoutTransforms();return s?s.grow(this.growCollisionBox).containsPoint(i.x,i.y):!1}},{Vec2:Zs}=k;function wu(e,t,i,s,n,o,a){if(!o||!n||!s){t.setClipMask(e);return}const{alignment:r,position:l}=s,c=BP(i,s.fontSize,a),{point:h,textBaseline:d}=_P(c,l,r);VP(n,o,s,h,c.angle,d);const{x:u,y:p,width:g,height:f}=n.getBBox(),x=Zs.length(Zs.from(g,f)),m={x:u+g/2,y:p+f/2,radius:x/2+Zs.length(c.offset)};return l==="center"?t.setClipMask(e,m):t.setClipMask(e),{clipMask:m,numbers:c}}function FP(e,t,i,s,n,o,a){if(!a||!o)return;const{alignment:r,position:l}=s,[c,h]=t.y1<=i.y1?[t,i]:[i,t];let d=c;l==="bottom"?d=h:l==="inside"&&(d={x1:(c.x1+h.x1)/2,y1:(c.y1+h.y1)/2,x2:(c.x2+h.x2)/2,y2:(c.y2+h.y2)/2});const u=BP(d,s.fontSize,n),{point:p,textBaseline:g}=_P(u,l==="inside"?"center":l,r,e);VP(o,a,s,p,u.angle,g)}function BP(e,t,i){let[s,n]=Zs.from(e);s.x>n.x&&([s,n]=[n,s]);const o=Zs.normalized(Zs.sub(n,s)),a=Zs.angle(o),r=Zs.multiply(o,Kt.HANDLE_SIZE/2+(t??14)/2),l=Zs.multiply(o,(i??2)/2+(t??14)/3);return{left:s,right:n,normal:o,angle:a,inset:r,offset:l}}function _P({left:e,right:t,normal:i,angle:s,inset:n,offset:o},a,r,l){let c;r==="right"?c=Zs.sub(t,n):r==="center"?c=Zs.add(e,Zs.multiply(i,Zs.distance(e,t)/2)):c=Zs.add(e,n);let h="bottom";return a==="bottom"?(c=Zs.rotate(o,s+Math.PI/2,c),h="top"):a==="center"&&!l?h="middle":c=Zs.rotate(o,s-Math.PI/2,c),{point:c,textBaseline:h}}function VP(e,t,i,s,n,o){e.setProperties({text:t,x:s.x,y:s.y,rotation:n,rotationCenterX:s.x,rotationCenterY:s.y,fill:i.color,fontFamily:i.fontFamily,fontSize:i.fontSize,fontStyle:i.fontStyle,fontWeight:i.fontWeight,textAlign:i.alignment,textBaseline:o})}var{ChartAxisDirection:$6,Vec2:Ah,Vec4:SI}=k,Xl=class extends es{constructor(){super(),this.type="cross-line",this.line=new Mn,this.middle=new Tu,this.isHorizontal=!1,this.append([this.line,this.middle])}static is(e){return es.isCheck(e,"cross-line")}update(e,t){const{seriesRect:i}=t;this.seriesRect=i,this.isHorizontal=Ys.is(e);const s=this.isHorizontal?t.yAxis:t.xAxis,n=this.convertCrossLine(e,s);if(n==null){this.visible=!1;return}this.visible=e.visible??!0,this.visible&&(this.updateLine(e,n),this.updateHandle(e,n),this.updateText(e,n),this.updateAxisLabel(e,s,n))}updateLine(e,t){const{line:i}=this,{lineDashOffset:s,stroke:n,strokeWidth:o,strokeOpacity:a}=e,{x1:r,y1:l,x2:c,y2:h}=t;i.setProperties({x1:r,y1:l,x2:c,y2:h,lineCap:e.getLineCap(),lineDash:e.getLineDash(),lineDashOffset:s,stroke:n,strokeWidth:o,strokeOpacity:a,fillOpacity:0})}updateHandle(e,t){const{middle:i}=this,{locked:s,stroke:n,strokeWidth:o,strokeOpacity:a}=e,r={fill:e.handle.fill,stroke:e.handle.stroke??n,strokeOpacity:e.handle.strokeOpacity??a,strokeWidth:e.handle.strokeWidth??o},l=Ah.sub(SI.center(t),Ah.from(i.handle.width/2,i.handle.height/2));i.gradient=this.isHorizontal?"horizontal":"vertical",i.update({...r,...l}),i.toggleLocked(s??!1)}updateText(e,t){this.text=this.updateNode(Ih,this.text,!!e.text.label),wu(this.line.id,this.line,t,e.text,this.text,e.text.label,e.strokeWidth)}createAxisLabel(e){const t=new zP;return e.attachLabel(t),t}updateAxisLabel(e,t,i){this.axisLabel??(this.axisLabel=this.createAxisLabel(t));const{axisLabel:s,seriesRect:n}=this,{direction:o,position:a}=t;if(e.axisLabel.enabled){s.visible=this.visible;const r=a==="left"||a==="top"?SI.start(i):SI.end(i),l=o===$6.X?r.x:r.y;if(!t.inRange(l)){s.visible=!1;return}const c=Ri(e.value);s.update({...Ah.add(r,Ah.required(n)),value:c,styles:e.axisLabel,context:t})}else s.visible=!1}setAxisLabelOpacity(e){this.axisLabel&&(this.axisLabel.opacity=e)}setAxisLabelVisible(e){this.axisLabel&&(this.axisLabel.visible=e)}toggleHandles(e){this.middle.visible=e,this.middle.toggleHovered(this.activeHandle==="middle")}destroy(){super.destroy(),this.axisLabel?.destroy()}toggleActive(e){this.toggleHandles(e),this.middle.toggleActive(e)}dragStart(e,t,i){const s=Ys.is(e)?{x:t.x,y:Fr(e.value,i.yAxis)}:{x:Fr(e.value,i.xAxis),y:t.y};this.dragState={offset:t,middle:s}}drag(e,t,i){const{activeHandle:s,dragState:n}=this;!e.isWriteable()||!n||(s&&this[s].toggleDragging(!0),this.translatePoint(e,n.middle,Ah.sub(t,n.offset),i))}translate(e,t,i){if(!e.isWriteable())return;const s=Ys.is(e)?Ah.from(0,Fr(e.value,i.yAxis)):Ah.from(Fr(e.value,i.xAxis),0);this.translatePoint(e,s,t,i)}translatePoint(e,t,i,s){const n=Ys.is(e);n?i.x=0:i.y=0;const{point:o}=$r({point:t},i,s);e.value=n?o.y:o.x}stopDragging(){this.middle.toggleDragging(!1)}copy(e,t,i){const s=Ys.is(e),n=this.isHorizontal?i.yAxis:i.xAxis,o=this.convertCrossLine(e,n);if(!o)return;const a=s?-30:0,r=s?0:-30,l=ln({x:o.x1+r,y:o.y1+a},i);return t.set({value:s?l.y:l.x}),t}getCursor(){return this.activeHandle==null?"pointer":this[this.activeHandle].getCursor()}containsPoint(e,t){const{middle:i,line:s,text:n}=this;return this.activeHandle=void 0,i.containsPoint(e,t)?(this.activeHandle="middle",!0):s.isPointInPath(e,t)||!!n?.containsPoint(e,t)}getNodeAtCoords(e,t){if(this.text?.containsPoint(e,t))return"text";if(this.line.isPointInPath(e,t))return"line";if(this.middle.containsPoint(e,t))return"handle"}getAnchor(){const e=this.computeBBoxWithoutHandles();return this.isHorizontal?{x:e.x+e.width/2,y:e.y}:{x:e.x+e.width,y:e.y+e.height/2,position:"right"}}convertCrossLine(e,t){if(e.value==null)return;let i=0,s=0,n,o;const{bounds:a}=t,r=Fr(e.value,t);return Ys.is(e)?(n=a.width,s=r,o=r):(i=r,n=r,o=a.height),{x1:i,y1:s,x2:n,y2:o}}},{StateMachine:vb,StateMachineProperty:U6,Debug:K6}=k,MI=class extends vb{constructor(e,t){const i=({point:n})=>{const o=e==="horizontal",a=o?new Ys:new Wa;a.set({value:o?n.y:n.x}),t.create(a),t.recordAction(`Create ${o?"horizontal-line":"vertical-line"} annotation`)},s=()=>{this.node?.toggleActive(!0),t.showAnnotationOptions(),t.update()};super("start",{start:{click:{target:"waiting-first-render",action:i},drag:{target:"waiting-first-render",action:i},reset:vb.parent,cancel:vb.parent},"waiting-first-render":{render:{target:vb.parent,action:s}}}),this.debug=K6.create(!0,"annotations")}};y([U6()],MI.prototype,"node",2);var GP={type:"horizontal-line",datum:Ys,scene:Xl,isDatum:Ys.is,translate:(e,t,i,s)=>{Ys.is(t)&&Xl.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Ys.is(t)&&Ys.is(i)&&Xl.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Ys.is(t)&&Xl.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new MI("horizontal",{...e,create:t("horizontal-line")}),dragState:e=>new mi(e)},jP={type:"vertical-line",datum:Wa,scene:Xl,isDatum:Wa.is,translate:(e,t,i,s)=>{Wa.is(t)&&Xl.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Wa.is(t)&&Wa.is(i)&&Xl.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Wa.is(t)&&Xl.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new MI("vertical",{...e,create:t("vertical-line")}),dragState:e=>new mi(e)},{Vec4:Y6}=k,HP=class{static updateBackground(e,t,i,s){const{background:n}=this,{seriesRect:o}=s;n.path.clear(!0);const a=Y6.from(0,0,o.width,o.height),r=this.getBackgroundPoints(e,t,i,a);for(let c=0;ct.x2,o=t.y1>t.y2,a=o?s.y2:s.y1,r=o?s.y1:s.y2,l=To.from(t);return e.extendEnd&&t.y2===r&&l.push(To.from(n?s.x1:s.x2,o?s.y1:s.y2)),e.extendEnd&&i.y2===a&&l.push(To.from(n?s.x1:s.x2,o?s.y2:s.y1)),l.push(...To.from(i).reverse()),e.extendStart&&i.y1===r&&l.push(To.from(n?s.x2:s.x1,o?s.y1:s.y2)),e.extendStart&&t.y1===a&&l.push(To.from(n?s.x2:s.x1,o?s.y2:s.y1)),l}},{StateMachine:Ql,StateMachineProperty:DI,Debug:Z6}=k,Mb=class extends Ql{constructor(e){const t=({point:l})=>{const c=new Io;c.set({start:l,end:l,startHeight:0,endHeight:0}),e.create(c)},i=()=>{const{node:l}=this;l?.toggleActive(!0),l?.toggleHandles({topLeft:!0,topRight:!1,bottomLeft:!1,bottomRight:!1})},s=({offset:l,context:c})=>{const{datum:h,snapping:d}=this;h&&(h.set({end:xf(l,c,d,h.start,h.snapToAngle)}),e.update())},n=()=>{this.node?.toggleHandles({topRight:!0}),e.update()},o=({point:l})=>{const{datum:c,node:h}=this,d=Ri(c?.end.y),u=Ri(c?.start.y),{y:p}=l;if(c==null||!Jt(u)||!Jt(d)||!Jt(p))return;const g=d-(p??0),f=(u-d)*2+g,x={x:c?.start.x,y:u-f},m={x:c?.end.x,y:l.y};h?.toggleHandles({bottomLeft:!0,bottomRight:!0}),!(!e.validatePoint(x,{overflowContinuous:!0})||!e.validatePoint(m,{overflowContinuous:!0}))&&(c.set({startHeight:f,endHeight:g}),e.update())},a=({point:l})=>{const{datum:c,node:h}=this,d=Ri(c?.end.y),u=Ri(c?.start.y),{y:p}=l;if(c==null||!Jt(u)||!Jt(d)||!Jt(p))return;const g=d-(p??0),f=(u-d)*2+g,x={x:c.start.x,y:u-g},m={x:c.end.x,y:l.y};h?.toggleHandles(!0),!(!e.validatePoint(x,{overflowContinuous:!0})||!e.validatePoint(m,{overflowContinuous:!0}))&&(c.set({startHeight:f,endHeight:g}),e.recordAction("Create disjoint-channel annotation"),e.showAnnotationOptions(),e.update())},r=()=>e.delete();super("start",{start:{click:{target:"waiting-first-render",action:t},drag:{target:"waiting-first-render",action:t},reset:Ql.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:s,drag:s,click:{target:"height",action:n},dragEnd:{target:"height",action:n},reset:{target:Ql.parent,action:r},cancel:{target:Ql.parent,action:r}},height:{hover:o,click:{target:Ql.parent,action:a},drag:{target:Ql.parent,action:a},reset:{target:Ql.parent,action:r},cancel:{target:Ql.parent,action:r}}}),this.debug=Z6.create(!0,"annotations"),this.snapping=!1}};y([DI()],Mb.prototype,"datum",2),y([DI()],Mb.prototype,"node",2),y([DI()],Mb.prototype,"snapping",2);var $P={type:"disjoint-channel",datum:Io,scene:Sb,isDatum:Io.is,translate:(e,t,i,s)=>{Io.is(t)&&Sb.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Io.is(t)&&Io.is(i)&&Sb.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Io.is(t)&&Sb.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new Mb({...e,create:t("disjoint-channel")}),dragState:e=>new mi(e)},kI=[0,23.6,38.2,50,61.8,78.6,100],X6=[161.8,261.8,361.8,423.6],q6=[...kI,...X6],Q6={10:q6,6:kI,4:kI.filter(e=>e!==78.6&&e!==23.6)},J6=10;function e9(e,t){const{x2:i,y1:s,y2:n}=e,o=s-n;return t==null?{x1:i,x2:i,y1:n-o,y2:n}:{x1:t.x1,x2:t.x2,y1:t.y2-o,y2:t.y2}}function UP({x1:e,y1:t,x2:i,y2:s},n,o,a,r=10){const l=t-s,c=o?-1:1;let h=a;const d=[];for(const[u,p]of Q6[r].entries()){const g=a+l*(p/100)*c,f=n.yAxis.scaleInvert(g);d.push({id:u,x1:e,x2:i,y1:h,y2:g,tag:p==100?0:1,label:{x1:Math.min(e,i)-J6,x2:i,y1:g,y2:g,text:`${(p/100).toFixed(3)} (${f.toFixed(2)})`}}),h=g}return d}var{Vec2:t9,Vec4:KP}=k,YP=class extends es{constructor(){super(),this.trendLine=new Mn,this.rangeFillsGroup=new k.Group({name:`${this.id}-range-fills`}),this.rangeFillsGroupSelection=k.Selection.select(this.rangeFillsGroup,k.Range),this.rangeStrokesGroup=new k.Group({name:`${this.id}-range-strokes`}),this.rangeStrokesGroupSelection=k.Selection.select(this.rangeStrokesGroup,Mn),this.labelsGroup=new k.Group({name:`${this.id}-ranges-labels`}),this.labelsGroupSelection=k.Selection.select(this.labelsGroup,Ih),this.anchor={x:0,y:0,position:"above"},this.append([this.trendLine,this.rangeFillsGroup,this.rangeStrokesGroup,this.labelsGroup])}update(e,t){let i=rn(e,t);if(i==null){this.visible=!1;return}if(i=KP.round(i),this.visible=e.visible??!0,!this.visible)return;this.updateLine(e,i,this.trendLine),this.updateHandles(e,i),this.updateAnchor(e,i,t);const{reverse:s}=e,n=this.extendLine(i,e,t),o=s?n.y1:n.y2,a=s?n.y2:n.y1,r=UP(n,t,e.reverse,o,e.bands);this.updateRanges(e,r,t);const l={...n,y1:a,y2:a};this.updateText(e,l)}extendLine({x1:e,y1:t,x2:i,y2:s},n,o){const a={x1:e,y1:t,x2:i,y2:s};if(!n.extendStart&&!n.extendEnd)return a;const{x:r,width:l}=o.xAxis.bounds;return n.extendEnd&&(a[e>i?"x1":"x2"]=r+l),n.extendStart&&(a[e>i?"x2":"x1"]=r),a}updateLine(e,t,i){if(!t||!i)return;const{lineDashOffset:s,strokeWidth:n,strokeOpacity:o,stroke:a}=e;i.setProperties({...t,lineCap:e.getLineCap(),lineDash:[3,4],lineDashOffset:s,strokeWidth:n,strokeOpacity:o,fillOpacity:0,stroke:a})}updateRangeStrokes(e){const{lineDashOffset:t,strokeWidth:i,strokeOpacity:s,strokes:n,rangeStroke:o,isMultiColor:a}=e;this.rangeStrokesGroupSelection.each((r,{x1:l,x2:c,y2:h,tag:d},u)=>{const p=h,g=a?n[u%n.length]:o;r.setProperties({x1:l,x2:c,y1:p,y2:p,stroke:g,strokeOpacity:s,strokeWidth:i,lineCap:e.getLineCap(),lineDash:e.getLineDash(),lineDashOffset:t,tag:d})})}updateRanges(e,t,i){const s=n=>n.id;this.rangeFillsGroupSelection.update(t,void 0,s),this.rangeStrokesGroupSelection.update(t,void 0,s),this.labelsGroupSelection.update(t,void 0,s),this.updateRangeFills(e),this.updateRangeStrokes(e),this.updateRangeLabels(e,i)}updateRangeFills(e){const{lineDashOffset:t,strokeWidth:i,strokeOpacity:s,strokes:n,rangeStroke:o,showFill:a,isMultiColor:r}=e;this.rangeFillsGroupSelection.each((l,{x1:c,x2:h,y1:d,y2:u},p)=>{const g=r?n[p%n.length]:o;if(!a){l.visible=!1;return}l.setProperties({x1:c,x2:h,y1:d,y2:u,startLine:!1,endLine:!1,stroke:g,strokeOpacity:s,fill:g,fillOpacity:(s??1)*.15,strokeWidth:i,lineCap:e.getLineCap(),lineDash:e.getLineDash(),lineDashOffset:t,visible:!0})})}updateRangeLabels(e,{xAxis:t}){const{rangeStrokesGroupSelection:i}=this,{strokes:s,strokeWidth:n,rangeStroke:o,isMultiColor:a,label:{fontFamily:r,fontSize:l,fontStyle:c,fontWeight:h,color:d}}=e,u={fontFamily:r,fontSize:l,fontStyle:c,fontWeight:h},p=this.checkWithinBounds(t,u,this.labelsGroupSelection.at(0));this.labelsGroupSelection.each((g,f,x)=>{const m=d??(a?s[x%s.length]:o),v=i.at(x);if(!v)return;const{text:b,...S}=f.label;if(p)g.setProperties({...u,text:b,x:S.x1,y:S.y1,textBaseline:"middle",textAlign:"end",fill:m}),wu(g.id,v,S);else{const D={...u,label:b,position:"center",alignment:"left",color:m};wu(g.id,v,S,D,g,b,n)}})}checkWithinBounds(e,t,i){if(!i)return!1;const{text:s,...n}=i.datum.label;i.setProperties({...t,text:s,x:n.x1,y:n.y1,textBaseline:"middle",textAlign:"end"});const{x:o}=i.getBBox();return o>=e.bounds.x&&o<=e.bounds.x+e.bounds.width}updateText(e,t){const i=this.rangeStrokesGroupSelection.selectByTag(0)[0];if(!i)return;const{text:s,strokeWidth:n}=e;this.text=this.updateNode(Ih,this.text,!!s.label),wu(i.id,i,t,s,this.text,s.label,n)}updateAnchor(e,t,i,s){const n=KP.topCenter(t);t9.apply(this.anchor,k.Transformable.toCanvasPoint(this.trendLine,n.x,n.y))}containsPoint(e,t){const{trendLine:i,rangeStrokesGroupSelection:s,text:n}=this;let o=!1;return s.each(a=>o||(o=a.isPointInPath(e,t))),o||i.isPointInPath(e,t)||!!n?.containsPoint(e,t)}getNodeAtCoords(e,t){if(this.text?.containsPoint(e,t))return"text";if(this.trendLine.isPointInPath(e,t))return"line"}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity??e.strokeOpacity,strokeWidth:e.handle.strokeWidth??e.strokeWidth}}drag(e,t,i,s){e.isWriteable()&&(this.activeHandle?this.dragHandle(e,t,i,s):this.dragAll(e,t,i))}getAnchor(){return this.anchor}getCursor(){return"pointer"}},{ContinuousScale:ZP}=k;function Db(e,t,i={overflowContinuous:!1},s){if(t.x==null||t.y==null)return s&&K.warnOnce(`${s}requires both an [x] and [y] property, ignoring.`),!1;const{xAxis:n,yAxis:o}=e,a=i.overflowContinuous&&ZP.is(n.scale),r=i.overflowContinuous&&ZP.is(o.scale),l=a||XP(t.x,n),c=r||XP(t.y,o);if(l&&c)return!0;if(s){let h="x & y domains";l&&(h="y domain"),c&&(h="x domain");const d=Ri(t.x),u=Ri(t.y);K.warnOnce(`${s}is outside the ${h}, ignoring. - x: [${d}], y: ${u}]`)}return!1}function XP(e,t){const{domain:i}=t.scale,s=Ri(e);return i&&s!=null&&t.continuous?s>=i[0]&&s<=i.at(-1):!0}var{Vec2:i9,Vec4:Ch}=k,kb=class extends YP{constructor(){super(),this.type="fibonacci-retracement-trend-based",this.endRetracementLine=new Mn,this.start=new Kt,this.end=new Kt,this.endRetracement=new Kt,this.append([this.endRetracementLine,this.start,this.end,this.endRetracement])}static is(e){return es.isCheck(e,"fibonacci-retracement-trend-based")}update(e,t){let{coords1:i,coords2:s}=this.getCoords(e,t);if(i==null||s==null){this.visible=!1;return}if(i=Ch.round(i),s=Ch.round(s),this.visible=e.visible??!0,!this.visible)return;(e.endRetracement.x==null||e.endRetracement.y==null)&&(s=void 0),this.updateLine(e,i,this.trendLine),this.updateLine(e,s,this.endRetracementLine),this.updateHandles(e,i,s),this.updateAnchor(e,s??i,t);const{reverse:n,bands:o}=e,a=e9(i,s),r=this.extendLine(a,e,t),l=r.y2,c=r.y1,h=s?UP(r,t,n,l,o):[];this.updateRanges(e,h,t);const d={...r,y1:c,y2:c};this.updateText(e,d)}containsPoint(e,t){const{start:i,end:s,endRetracement:n,endRetracementLine:o}=this;return this.activeHandle=void 0,i.containsPoint(e,t)?(this.activeHandle="start",!0):s.containsPoint(e,t)?(this.activeHandle="end",!0):n.containsPoint(e,t)?(this.activeHandle="endRetracement",!0):o.isPointInPath(e,t)||super.containsPoint(e,t)}getNodeAtCoords(e,t){return this.start.containsPoint(e,t)||this.end.containsPoint(e,t)||this.endRetracement.containsPoint(e,t)?"handle":this.endRetracementLine.isPointInPath(e,t)?"line":super.getNodeAtCoords(e,t)}dragStart(e,t,i){this.dragState={offset:t,...gb({start:e.start,end:e.end,endRetracement:e.endRetracement},i)}}stopDragging(){this.start.toggleDragging(!1),this.end.toggleDragging(!1),this.endRetracement.toggleDragging(!1)}dragAll(e,t,i){const{dragState:s}=this;s&&this.translatePoints({datum:e,start:s.start,end:s.end,endRetracement:s.endRetracement,translation:i9.sub(t,s.offset),context:i})}dragHandle(e,t,i,s){const{activeHandle:n,dragState:o}=this;if(!n||!o)return;this[n].toggleDragging(!0);const a=s?this.snapToAngle(e,t,i):ln(this[n].drag(t).point,i);!a||!Db(i,a)||(e[n].x=a.x,e[n].y=a.y)}snapToAngle(e,t,i){const{activeHandle:s}=this,n=["start","end","endRetracement"];if(!s)return;const o=(n.indexOf(s)+1)%n.length,a=n[o];this[s].toggleDragging(!0);const r=Ut(e[a],i);return ln(pb(t,r,e.snapToAngle),i)}translatePoints({datum:e,start:t,end:i,endRetracement:s,translation:n,context:o}){const a=$r({start:t,end:i,endRetracement:s},n,o,{overflowContinuous:2});e.start.x=a.start.x,e.end.x=a.end.x,e.endRetracement.x=a.endRetracement.x,e.start.y=a.start.y,e.end.y=a.end.y,e.endRetracement.y=a.endRetracement.y}translate(e,t,i){this.translatePoints({datum:e,start:Ut(e.start,i),end:Ut(e.end,i),endRetracement:Ut(e.endRetracement,i),translation:t,context:i})}copy(e,t,i){const{coords1:s,coords2:n}=this.getCoords(e,i);if(!s||!n)return;const o=this.computeBBoxWithoutHandles();return this.translatePoints({datum:t,start:Ch.start(s),end:Ch.end(s),endRetracement:Ch.end(n),translation:{x:-o.width/2,y:-o.height/2},context:i}),t}getCoords(e,t){return{coords1:rn(e,t),coords2:rn({start:e.end,end:e.endRetracement},t)}}toggleHandles(e){if(typeof e=="boolean")this.start.visible=e,this.end.visible=e,this.endRetracement.visible=e;else for(const[t,i]of Tt(e))this[t].visible=i;this.start.toggleHovered(this.activeHandle==="start"),this.end.toggleHovered(this.activeHandle==="end"),this.endRetracement.toggleHovered(this.activeHandle==="endRetracement")}toggleActive(e){this.toggleHandles(e),this.start.toggleActive(e),this.end.toggleActive(e),this.endRetracement.toggleActive(e)}updateHandles(e,t,i,s){this.start.update({...this.getHandleStyles(e),...this.getHandleCoords(e,t,"start")}),this.end.update({...this.getHandleStyles(e),...this.getHandleCoords(e,t,"end",s)}),i&&this.endRetracement.update({...this.getHandleStyles(e),...this.getHandleCoords(e,i,"endRetracement",s)}),this.start.toggleLocked(e.locked??!1),this.end.toggleLocked(e.locked??!1),this.endRetracement.toggleLocked(e.locked??!1)}getHandleCoords(e,t,i,s){return i==="start"?Ch.start(t):Ch.end(t)}},{StateMachine:Jl,StateMachineProperty:II,Debug:s9}=k,Ib=class extends Jl{constructor(e){const t=({point:c})=>{const h=this.createDatum();h.set({start:c,end:c}),e.create(h)},i=()=>{const{node:c}=this;c?.toggleActive(!0),c?.toggleHandles({start:!0,end:!1,endRetracement:!1})},s=({offset:c,context:h})=>{const{datum:d,snapping:u}=this;d&&(d.set({end:xf(c,h,u,d.start,d.snapToAngle)}),e.update())},n=()=>{const{datum:c}=this;c&&(c.endRetracement.x=c.end.x,c.endRetracement.y=c.end.y,this.node?.toggleHandles({end:!0}),e.update())},o=({offset:c,context:h})=>{const{datum:d,snapping:u}=this;d&&(d.set({endRetracement:xf(c,h,u,d.end,d.snapToAngle)}),e.update())},a=()=>{this.node?.toggleHandles({endRetracement:!0}),e.update()},r=()=>e.delete(),l=()=>{e.showAnnotationOptions(),e.recordAction(`Create ${this.datum?.type} annotation`)};super("start",{start:{click:{target:"waiting-first-render",action:t},drag:{target:"waiting-first-render",action:t},reset:Jl.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:s,click:{target:"endRetracement",action:n},drag:s,dragEnd:{target:"endRetracement",action:n},reset:{target:Jl.parent,action:r},cancel:{target:Jl.parent,action:r},onExit:l},endRetracement:{hover:o,click:{target:Jl.parent,action:a},drag:{target:Jl.parent,action:a},reset:{target:Jl.parent,action:r},cancel:{target:Jl.parent,action:r}}}),this.debug=s9.create(!0,"annotations"),this.snapping=!1}createDatum(){return new $a}};y([II()],Ib.prototype,"datum",2),y([II()],Ib.prototype,"node",2),y([II()],Ib.prototype,"snapping",2);var qP={type:"fibonacci-retracement-trend-based",datum:$a,scene:kb,isDatum:$a.is,translate:(e,t,i,s)=>{$a.is(t)&&kb.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if($a.is(t)&&$a.is(i)&&kb.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{$a.is(t)&&kb.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new Ib({...e,create:t("fibonacci-retracement-trend-based")}),dragState:e=>new mi(e)},{Vec2:n9,Vec4:QP}=k,Ab=class extends YP{constructor(){super(),this.type="fibonacci-retracement",this.start=new Kt,this.end=new Kt,this.append([this.start,this.end])}static is(e){return es.isCheck(e,"fibonacci-retracement")}containsPoint(e,t){const{start:i,end:s}=this;return this.activeHandle=void 0,i.containsPoint(e,t)?(this.activeHandle="start",!0):s.containsPoint(e,t)?(this.activeHandle="end",!0):super.containsPoint(e,t)}getNodeAtCoords(e,t){return this.start.containsPoint(e,t)||this.end.containsPoint(e,t)?"handle":super.getNodeAtCoords(e,t)}dragStart(e,t,i){this.dragState={offset:t,...gb({start:e.start,end:e.end},i)}}stopDragging(){this.start.toggleDragging(!1),this.end.toggleDragging(!1)}dragAll(e,t,i){const{dragState:s}=this;s&&this.translatePoints({datum:e,start:s.start,end:s.end,translation:n9.sub(t,s.offset),context:i})}dragHandle(e,t,i,s){const{activeHandle:n,dragState:o}=this;if(!n||!o)return;this[n].toggleDragging(!0);const a=s?this.snapToAngle(e,t,i):ln(this[n].drag(t).point,i);!a||!Db(i,a)||(e[n].x=a.x,e[n].y=a.y)}snapToAngle(e,t,i){const{activeHandle:s}=this,o=["start","end"].find(r=>r!==s);if(!s||!o)return;this[s].toggleDragging(!0);const a=Ut(e[o],i);return ln(pb(t,a,e.snapToAngle),i)}translatePoints({datum:e,start:t,end:i,translation:s,context:n}){const o=$r({start:t,end:i},s,n,{overflowContinuous:1});e.start.x=o.start.x,e.end.x=o.end.x,e.start.y=o.start.y,e.end.y=o.end.y}translate(e,t,i){this.translatePoints({datum:e,start:Ut(e.start,i),end:Ut(e.end,i),translation:t,context:i})}copy(e,t,i){const s=rn(e,i);if(!s)return;const n=this.computeBBoxWithoutHandles();return this.translatePoints({datum:t,start:{x:s.x1,y:s.y1},end:{x:s.x2,y:s.y2},translation:{x:-n.width/2,y:-n.height/2},context:i}),t}toggleHandles(e){if(typeof e=="boolean")this.start.visible=e,this.end.visible=e;else for(const[t,i]of Tt(e))this[t].visible=i;this.start.toggleHovered(this.activeHandle==="start"),this.end.toggleHovered(this.activeHandle==="end")}toggleActive(e){this.toggleHandles(e),this.start.toggleActive(e),this.end.toggleActive(e)}updateHandles(e,t,i,s){this.start.update({...this.getHandleStyles(e),...this.getHandleCoords(e,t,"start")}),this.end.update({...this.getHandleStyles(e),...this.getHandleCoords(e,t,"end",s)}),this.start.toggleLocked(e.locked??!1),this.end.toggleLocked(e.locked??!1)}getHandleCoords(e,t,i,s){return i==="start"?QP.start(t):QP.end(t)}},{StateMachine:Nu,StateMachineProperty:AI,Debug:o9}=k,Ou=class extends Nu{constructor(e){const t=({point:r})=>{const l=this.createDatum();l.set({start:r,end:r}),e.create(l)},i=()=>{const{node:r}=this;r?.toggleActive(!0),r?.toggleHandles({start:!0,end:!1})},s=({offset:r,context:l})=>{const{datum:c,snapping:h}=this;c&&(c.set({end:xf(r,l,h,c.start,c.snapToAngle)}),e.update())},n=()=>{this.node?.toggleHandles({end:!0}),e.update()},o=()=>e.delete(),a=()=>{e.showAnnotationOptions(),e.recordAction(`Create ${this.datum?.type} annotation`)};super("start",{start:{click:{target:"waiting-first-render",action:t},drag:{target:"waiting-first-render",action:t},reset:Nu.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:s,click:{target:Nu.parent,action:n},drag:s,dragEnd:{target:Nu.parent,action:n},reset:{target:Nu.parent,action:o},cancel:{target:Nu.parent,action:o},onExit:a}}),this.debug=o9.create(!0,"annotations"),this.snapping=!1}};y([AI()],Ou.prototype,"datum",2),y([AI()],Ou.prototype,"node",2),y([AI()],Ou.prototype,"snapping",2);var a9=class extends Ou{createDatum(){return new _r}},r9=class extends Ou{createDatum(){return new Vr}},l9=class extends Ou{createDatum(){return new jr}},JP={type:"fibonacci-retracement",datum:jr,scene:Ab,isDatum:jr.is,translate:(e,t,i,s)=>{jr.is(t)&&Ab.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(jr.is(t)&&jr.is(i)&&Ab.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{jr.is(t)&&Ab.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new l9({...e,create:t("fibonacci-retracement")}),dragState:e=>new mi(e)},{Vec2:vf}=k,c9=class extends k.Group{},Cb=class extends c9{constructor(){super(),this.type="arrow",this.path=new k.Path,this.armLength=6,this.append([this.path])}update(e){const{path:t}=this,{x:i,y:s,angle:n,...o}=e,a=vf.from(i,s),r=3*Math.PI/4,l=this.armLength+(e.strokeWidth??0)*2,c=vf.rotate(vf.from(0,l),n+r,a),h=vf.rotate(vf.from(l,0),n-r,a);t.setProperties(o),t.fillOpacity=0,t.path.clear(),t.path.moveTo(c.x,c.y),t.path.lineTo(a.x,a.y),t.path.lineTo(h.x,h.y)}},{Vec2:da,Vec4:eR}=k,ec=class extends fI{constructor(){super(),this.type="line",this.line=new Mn,this.append([this.line,this.start,this.end])}static is(e){return es.isCheck(e,"line")}update(e,t){let i=rn(e,t);if(i==null){this.visible=!1;return}i=eR.round(i),this.visible=e.visible??!0,this.visible&&(this.updateLine(e,i,t),this.updateHandles(e,i),this.updateText(e,i),this.updateCaps(e,i),this.updateAnchor(e,i,t))}updateLine(e,t,i){const{line:s}=this,{lineDashOffset:n,stroke:o,strokeWidth:a,strokeOpacity:r}=e,l=this.extendLine(t,e,i);s.setProperties({...l,lineCap:e.getLineCap(),lineDash:e.getLineDash(),lineDashOffset:n,stroke:o,strokeWidth:a,strokeOpacity:r,fillOpacity:0})}updateText(e,t){this.text=this.updateNode(Ih,this.text,!!e.text.label),wu(this.line.id,this.line,t,e.text,this.text,e.text.label,e.strokeWidth)}updateCaps(e,t){if(!e.startCap&&this.startCap&&(this.startCap.remove(),this.startCap=void 0),!e.endCap&&this.endCap&&(this.endCap.remove(),this.endCap=void 0),!e.startCap&&!e.endCap)return;const{stroke:i,strokeWidth:s,strokeOpacity:n}=e,[o,a]=da.from(t),r=da.angle(da.sub(a,o));e.startCap&&(this.startCap&&this.startCap.type!==e.startCap&&(this.startCap.remove(),this.startCap=void 0),this.startCap==null&&(this.startCap=new Cb,this.append([this.startCap])),this.startCap.update({x:o.x,y:o.y,angle:r-Math.PI,stroke:i,strokeWidth:s,strokeOpacity:n})),e.endCap&&(this.endCap&&this.endCap.type!==e.endCap&&(this.endCap.remove(),this.endCap=void 0),this.endCap==null&&(this.endCap=new Cb,this.append([this.endCap])),this.endCap.update({x:a.x,y:a.y,angle:r,stroke:i,strokeWidth:s,strokeOpacity:n}))}updateAnchor(e,t,i,s){const n=eR.topCenter(t);da.apply(this.anchor,k.Transformable.toCanvasPoint(this.line,n.x,n.y))}containsPoint(e,t){const{line:i,text:s}=this;return super.containsPoint(e,t)||i.isPointInPath(e,t)||!!s?.containsPoint(e,t)}getNodeAtCoords(e,t){return this.text?.containsPoint(e,t)?"text":this.line.isPointInPath(e,t)?"line":super.getNodeAtCoords(e,t)}getHandleCoords(e,t,i,s){const{startCap:n,endCap:o}=this;let[a,r]=da.from(t);const l=da.angle(da.sub(r,a));return n&&(a=da.rotate(da.from(0,-Kt.HANDLE_SIZE/2),l,a)),o&&(r=da.rotate(da.from(0,Kt.HANDLE_SIZE/2),l,r)),i==="start"?a:r}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity??e.strokeOpacity,strokeWidth:e.handle.strokeWidth??e.strokeWidth}}},tR={type:"line",datum:Vr,scene:ec,isDatum:Vr.is,translate:(e,t,i,s)=>{Vr.is(t)&&ec.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Vr.is(t)&&Vr.is(i)&&ec.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Vr.is(t)&&ec.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new r9({...e,create:t("line")}),dragState:e=>new mi(e)},iR={type:"arrow",datum:_r,scene:ec,isDatum:_r.is,translate:(e,t,i,s)=>{_r.is(t)&&ec.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(_r.is(t)&&_r.is(i)&&ec.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{_r.is(t)&&ec.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new a9({...e,create:t("arrow")}),dragState:e=>new mi(e)};function sR(e,t=0,i=0){let s=t;for(const n of e)if(Array.isArray(n)){for(const o of n)nR(o,s);s+=k.Group.computeChildrenBBox(n).width+i}else nR(n,s),s+=n.getBBox().width+i}function h9(e,t=0,i=0){let s=t;for(const n of e)if(Array.isArray(n)){for(const o of n)oR(o,s);s+=k.Group.computeChildrenBBox(n).height+i}else oR(n,s),s+=n.getBBox().height+i}function nR(e,t){"x1"in e?(e.x2=t+(e.x2-e.x1),e.x1=t):e.x=t}function oR(e,t){"y1"in e?(e.y2=t+(e.y2-e.y1),e.y1=t):e.y=t}function aR(e,t){"x1"in e?(e.x1+=t,e.x2+=t):e.x+=t}function rR(e,t){"y1"in e?(e.y1+=t,e.y2+=t):e.y+=t}var{Vec4:CI}=k,lR=class extends k.Group{constructor(){super(),this.name="MeasurerStatisticsScene",this.background=new k.Rect,this.dateRangeBarsText=new k.Text,this.dateRangeDivider=new k.Line,this.dateRangeValueText=new k.Text,this.priceRangeValueText=new k.Text,this.priceRangeDivider=new k.Line,this.priceRangePercentageText=new k.Text,this.volumeText=new k.Text,this.volumeFormatter=new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:2,maximumFractionDigits:2}),this.append([this.background,this.dateRangeBarsText,this.dateRangeDivider,this.dateRangeValueText,this.priceRangeValueText,this.priceRangeDivider,this.priceRangePercentageText,this.volumeText])}update(e,t,i,s,n,o,a){this.verticalDirection=o;const r=this.updateStatistics(e,t,i,a),l=k.Group.computeChildrenBBox(r.flat()),c=10;l.grow(c),this.updateBackground(e,l,c),this.reposition(r,c,n),this.checkVisibility(e,n,s)}checkVisibility(e,t,i){const s=CI.from(new k.BBox(0,0,t.seriesRect.width,t.seriesRect.height));CI.collides(i,s)?this.visible=e.visible??!0:this.visible=!1}updateStatistics(e,t,i,s){const{dateRangeBarsText:n,dateRangeDivider:o,dateRangeValueText:a,priceRangeValueText:r,priceRangeDivider:l,priceRangePercentageText:c,volumeText:h}=this,d=8,u=6,p=e.statistics.fontSize+3,g=-2,f=this.getTextStyles(e),x={...this.getDividerStyles(e),x1:0,y1:0,x2:0,y2:p},m=[n,o,a],v=[r,l,c],b=[];return t.priceRange&&(r.setProperties({...f,text:this.formatPriceRangeValue(t.priceRange.value,s)}),l.setProperties(x),c.setProperties({...f,text:this.formatPriceRangePercentage(t.priceRange.percentage,s)}),sR(v,i.x,d),b.push(v)),t.dateRange&&(n.setProperties({...f,text:this.formatDateRangeBars(t.dateRange.bars,s)}),o.setProperties(x),a.setProperties({...f,text:this.formatDateRangeValue(t.dateRange.value)}),sR(m,i.x,d),b.push(m)),t.volume==null?h.visible=!1:(h.setProperties({...f,x:i.x,text:this.formatVolume(t.volume,s),visible:!0}),b.push(h)),h9(b,i.y,u),l.y1+=g,l.y2+=g,o.y1+=g,o.y2+=g,b}updateBackground(e,t,i){const s=this.getBackgroundStyles(e);this.background.setProperties({...s,...t,x:t.x-t.width/2+i,y:t.y})}reposition(e,t,i){const{width:s,height:n}=i.seriesRect,o=CI.from(this.background.getBBox());let a=0;o.x1<0&&(a=-o.x1),o.x2>s&&(a=s-o.x2);const r=Math.min(t,n-o.y2);for(const l of e)if(Array.isArray(l)){const c=k.Group.computeChildrenBBox(l).width;for(const h of l)aR(h,a-c/2),rR(h,r)}else aR(l,a-l.getBBox().width/2),rR(l,r);this.background.x+=a,this.background.y+=r}getTextStyles(e){return{fill:e.statistics.color,fontFamily:e.statistics.fontFamily,fontSize:e.statistics.fontSize,fontStyle:e.statistics.fontStyle,fontWeight:e.statistics.fontWeight,textBaseline:"top"}}getDividerStyles(e){return{stroke:e.statistics.divider.stroke,strokeOpacity:e.statistics.divider.strokeOpacity,strokeWidth:e.statistics.divider.strokeWidth}}getBackgroundStyles(e){return{fill:e.statistics.fill,stroke:e.statistics.stroke,strokeOpacity:e.statistics.strokeOpacity,strokeWidth:e.statistics.strokeWidth,cornerRadius:4}}formatDateRangeBars(e,t){return t?.t("measurerDateRangeBars",{value:e})??`${e}`}formatDateRangeValue(e){const t=[],i=e>=0?"":"-";e=Math.abs(e);const s=1e3*60,n=s*60,o=n*24,a=Math.floor(e/s),r=Math.floor(e/n),l=Math.floor(e/o),c=r%(o/n),h=a%(n/s);return l>=1&&t.push(`${l}d`),r>=1&&(e=s.x-h.x&&(l={x:s.x,y:r.clipMask.y,radius:this.text.getBBox().height/2+Ya.length(h)})}this.verticalLine.setClipMask(a,l)}updateCaps(e,t){const{horizontalEndCap:i,verticalEndCap:s}=this,{direction:n}=e,{x1:o,y1:a,x2:r,y2:l}=t,c=Ya.round(Lh.center(t),0),{stroke:h,strokeWidth:d,strokeOpacity:u}=this.getLineStyles(e),p={stroke:h,strokeWidth:d,strokeOpacity:u};if(n!=="vertical"){const g=o<=r?0:Math.PI;let f=r;n==="horizontal"&&(f+=o<=r?-2:2),i.update({...p,x:f,y:c.y,angle:g})}if(n!=="horizontal"){const g=a<=l?Math.PI/2:Math.PI/-2;let f=l;n==="vertical"&&(f+=a<=l?-2:2),s.update({...p,x:c.x,y:f,angle:g})}}updateBoundingLines(e,t){const{verticalStartLine:i,verticalEndLine:s,horizontalStartLine:n,horizontalEndLine:o}=this,{direction:a}=e,{x1:r,y1:l,x2:c,y2:h}=t,d=this.getLineStyles(e);a==="horizontal"&&(i.setProperties({...d,x1:r,y1:l,x2:r,y2:h}),s.setProperties({...d,x1:c,y1:l,x2:c,y2:h})),a==="vertical"&&(n.setProperties({...d,x1:r,y1:l,x2:c,y2:l}),o.setProperties({...d,x1:r,y1:h,x2:c,y2:h}))}updateStatistics(e,t,i){const s=Ya.add(Lh.bottomCenter(t),Ya.from(0,10)),n={volume:this.getVolume(e)};e.hasPriceRange&&(n.priceRange={percentage:this.getPriceRangePercentage(e),value:this.getPriceRangeValue(e)}),e.hasDateRange&&(n.dateRange={bars:this.getDateRangeBars(t,i),value:this.getDateRangeValue(e)}),this.statistics.update(e,n,s,t,i,this.verticalDirection,e.localeManager)}updateAnchor(e,t,i,s){const n=Lh.topCenter(t);Ya.apply(this.anchor,k.Transformable.toCanvasPoint(this.horizontalLine,n.x,n.y))}getBackgroundPoints(e,t,i,s){const[n,o]=Ya.from(t),[a,r]=Ya.from(i);return[n,o,r,a]}getLineStyles(e){const{lineDashOffset:t,stroke:i,strokeWidth:s,strokeOpacity:n}=e;return{lineCap:e.getLineCap(),lineDash:e.getLineDash(),lineDashOffset:t,stroke:i,strokeWidth:s,strokeOpacity:n,fillOpacity:0}}getBackgroundStyles(e){const{background:t}=e;return{fill:t.fill,fillOpacity:t.fillOpacity}}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity??e.strokeOpacity,strokeWidth:e.handle.strokeWidth??e.strokeWidth}}containsPoint(e,t){const{horizontalLine:i,text:s,verticalLine:n,horizontalStartLine:o,horizontalEndLine:a,verticalStartLine:r,verticalEndLine:l}=this;return super.containsPoint(e,t)||i.isPointInPath(e,t)||n.isPointInPath(e,t)||o.visible&&o.isPointInPath(e,t)||a.visible&&a.isPointInPath(e,t)||r.visible&&r.isPointInPath(e,t)||l.visible&&l.isPointInPath(e,t)||!!s?.containsPoint(e,t)}getNodeAtCoords(e,t){return this.text?.containsPoint(e,t)?"text":this.start.containsPoint(e,t)||this.end.containsPoint(e,t)?"handle":"line"}getDateRangeBars(e,t){const{step:i}=t.xAxis.scale,s=e.x1<=e.x2?1:-1;return i?Math.round(Lh.width(e)/i)*s:0}getDateRangeValue(e){const t=Ri(e.start.x),i=Ri(e.end.x);if(!jo(t)||!jo(i))throw new Error("Can not create a date range measurement of non-date x-axis.");return i.getTime()-t.getTime()}getPriceRangePercentage(e){if(e.start.y==null||e.end.y==null)throw new Error("Can not create a price range measurement of a non-numeric y-axis");const t=Ri(e.end.y),i=Ri(e.start.y);if(!Jt(t)||!Jt(i))throw new Error("Can not create a price range measurement of a non-numeric y-axis");return(t-i)/i}getPriceRangeValue(e){if(e.start.y==null||e.end.y==null)throw new Error("Can not create a price range measurement of a non-numeric y-axis");const t=Ri(e.end.y),i=Ri(e.start.y);if(!Jt(t)||!Jt(i))throw new Error("Can not create a price range measurement of a non-numeric y-axis");return t-i}getVolume(e){return e.getVolume(e.start.x,e.end.x)}},Lb=class extends Hn{constructor(){super(...arguments),this.type="quick-measurer"}static is(e){return es.isCheck(e,"quick-measurer")}createStatisticsScene(){return new d9}getDirectionStyles(e){return this.verticalDirection==="down"?e.down:e.up}getLineStyles(e){const t=this.getDirectionStyles(e);return{...super.getLineStyles(e),stroke:t.stroke,strokeWidth:t.strokeWidth,strokeOpacity:t.strokeOpacity}}getBackgroundStyles(e){const t=this.getDirectionStyles(e);return{fill:t.fill,fillOpacity:t.fillOpacity}}getHandleStyles(e){const t=this.getDirectionStyles(e);return{fill:t.handle.fill,stroke:t.handle.stroke??t.stroke,strokeOpacity:t.handle.strokeOpacity??t.strokeOpacity,strokeWidth:t.handle.strokeWidth??t.strokeWidth}}},{StateMachine:Eu,StateMachineProperty:cR,Debug:u9}=k,Pu=class extends Eu{constructor(e){const t=({point:a})=>{const r=this.createDatum();r.set({start:a,end:a}),e.create(r)},i=({point:a})=>{const{datum:r,node:l}=this;r?.set({end:a}),l?.toggleActive(!0),l?.toggleHandles({end:!1}),e.update()},s=()=>{this.node?.toggleHandles({end:!0})},n=()=>e.delete(),o=()=>{e.showAnnotationOptions(),e.recordAction(`Create ${this.node?.type} annotation`)};super("start",{start:{reset:Eu.parent,click:{target:"end",action:t},drag:{target:"end",action:t}},end:{hover:i,drag:i,click:{target:Eu.parent,action:s},dragEnd:{target:Eu.parent,action:s},reset:{target:Eu.parent,action:n},cancel:{target:Eu.parent,action:n},onExit:o}}),this.debug=u9.create(!0,"annotations")}};y([cR()],Pu.prototype,"datum",2),y([cR()],Pu.prototype,"node",2);var p9=class extends Pu{createDatum(){return new Do}},g9=class extends Pu{createDatum(){return new ko}},f9=class extends Pu{createDatum(){return new Br}},y9=class extends Pu{createDatum(){return new jn}},hR={type:"date-range",datum:Do,scene:Hn,isDatum:Do.is,translate:(e,t,i,s)=>{Do.is(t)&&Hn.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Do.is(t)&&Do.is(i)&&Hn.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Do.is(t)&&Hn.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new p9({...e,create:t("date-range")}),dragState:e=>new mi(e)},dR={type:"price-range",datum:ko,scene:Hn,isDatum:ko.is,translate:(e,t,i,s)=>{ko.is(t)&&Hn.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(ko.is(t)&&ko.is(i)&&Hn.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{ko.is(t)&&Hn.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new g9({...e,create:t("date-range")}),dragState:e=>new mi(e)},uR={type:"date-price-range",datum:Br,scene:Hn,isDatum:Br.is,translate:(e,t,i,s)=>{Br.is(t)&&Hn.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Br.is(t)&&Br.is(i)&&Hn.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Br.is(t)&&Hn.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new f9({...e,create:t("date-range")}),dragState:e=>new mi(e)},pR={type:"quick-date-price-range",datum:jn,scene:Lb,isDatum:jn.is,translate:(e,t,i,s)=>{jn.is(t)&&Lb.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(jn.is(t)&&jn.is(i)&&Lb.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{jn.is(t)&&Lb.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new y9({...e,create:t("quick-date-price-range")}),dragState:e=>new mi(e)},{ZIndexMap:gR}=k,Tb=class extends bI{constructor(){super(),this.type="note",this.shape=new k.Rect,this.iconBackground=new k.TranslatableSvgPath("M22 1.83333C22 0.820811 21.1792 0 20.1667 0H1.83333C0.820811 0 0 0.82081 0 1.83333V13.9868C0 14.9994 0.820811 15.8202 1.83333 15.8202L5.88971 15.8202C6.44575 15.8202 6.97175 16.0725 7.31971 16.5062L9.57006 19.3112C10.304 20.2259 11.6962 20.2259 12.4301 19.3112L14.6804 16.5062C15.0284 16.0725 15.5544 15.8202 16.1104 15.8202L20.1667 15.8202C21.1792 15.8202 22 14.9994 22 13.9868V1.83333Z"),this.iconLines=new k.TranslatableSvgPath("M17.1114 5.75C17.1114 6.16421 16.7756 6.5 16.3614 6.5H5.63916C5.22495 6.5 4.88916 6.16421 4.88916 5.75V5.75C4.88916 5.33579 5.22495 5 5.63916 5H16.3614C16.7756 5 17.1114 5.33579 17.1114 5.75V5.75ZM17.1114 9.25C17.1114 9.66421 16.7756 10 16.3614 10H5.63916C5.22495 10 4.88916 9.66421 4.88916 9.25V9.25C4.88916 8.83579 5.22495 8.5 5.63916 8.5H16.3614C16.7756 8.5 17.1114 8.83579 17.1114 9.25V9.25Z"),this.active=!1,this.shape.visible=!1,this.label.visible=!1,this.iconBackground.fillShadow=new k.DropShadow,this.append([this.shape,this.label,this.iconBackground,this.iconLines,this.handle])}static is(e){return es.isCheck(e,"note")}update(e,t){this.updateIcon(e,t),super.update(e,t)}getTextBBox(e,t,i){const s=super.getTextBBox(e,t,i);s.x-=e.width/2,s.x=ve(0,s.x,i.seriesRect.width-e.width);const n=e.getPadding().top,o=s.y-oP-n*2,a=s.y+Kt.HANDLE_SIZE+n*2;return o-s.height-aP<0?(s.y=a,e.position="top"):(s.y=o+n,e.position="bottom"),s}updateLabel(e,t){const i=e.visible===!1?!1:this.label.visible;super.updateLabel(e,t),this.label.visible=i,this.label.text=cl(e.text,{maxWidth:200,font:e,textWrap:"always",avoidOrphans:!1})}updateShape(e,t){const{shape:i}=this;i.fill=e.background.fill,i.fillOpacity=e.background.fillOpacity??1,i.stroke=e.background.stroke,i.strokeOpacity=e.background.strokeOpacity??1,i.strokeWidth=e.background.strokeWidth??1,i.cornerRadius=4;const s=e.getPadding().top,n=e.position==="top";i.x=t.x-s,i.width=e.width+s*2,i.height=t.height+s*2,i.y=t.y+(n?0:-t.height)-s}updateIcon(e,t){const{active:i,iconBackground:s,iconLines:n}=this,{x:o,y:a}=Ut(e,t);s.translationX=o-XX/2,s.translationY=a-nP,n.translationX=s.translationX,n.translationY=s.translationY,s.fill=e.fill,s.fillOpacity=e.fillOpacity??1,s.stroke=e.stroke,s.strokeOpacity=e.strokeOpacity??1,s.strokeWidth=e.strokeWidth??1,n.fill=e.stroke,i?s.fillShadow.color=e.fill??"rgba(0, 0, 0, 0.22)":s.fillShadow.color="rgba(0, 0, 0, 0.22)"}updateAnchor(e,t,i){const s=e.getPadding().top,n=e.position==="top",o=n?1:-1;return{x:t.x+i.seriesRect.x+e.width/2,y:t.y+i.seriesRect.y+o*(t.height+s),position:n?"below":"above"}}getLabelCoords(e,t){const i=e.position==="top",s=e.getPadding().top+$o(e.fontSize,nb)/2;return{x:t.x,y:t.y+(i?s/2:0)}}getTextBaseline(e){return e.position==="top"?"middle":e.position}getHandleCoords(e,t,i){return{x:t.x,y:t.y+Kt.HANDLE_SIZE/2+4}}getHandleStyles(e){return{fill:e.handle.fill,stroke:e.handle.stroke??e.fill,strokeOpacity:e.handle.strokeOpacity,strokeWidth:e.handle.strokeWidth}}toggleHovered(e,t,i){super.toggleHovered(e,t,i);const s=e||t&&!i;this.label.visible=s,this.shape.visible=s,this.zIndex=s?gR.CHART_ANNOTATION_FOCUSED:gR.CHART_ANNOTATION}toggleActive(e){super.toggleActive(e),this.label.visible=e,this.shape.visible=e,this.active=e}containsPoint(e,t){return this.shape.visible&&this.shape.containsPoint(e,t)||this.iconBackground.containsPoint(e,t)?!0:super.containsPoint(e,t)}},m9=class extends bf{createDatum(){return new Sn}},fR={type:"note",datum:Sn,scene:Tb,isDatum:Sn.is,translate:(e,t,i,s)=>{Sn.is(t)&&Tb.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Sn.is(t)&&Sn.is(i)&&Tb.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Sn.is(t)&&Tb.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new m9({...e,create:t("note")}),dragState:e=>new mi(e)},{Vec2:wo,Vec4:Za}=k,wb=class extends WP{constructor(){super(),this.type="parallel-channel",this.handles={topLeft:new Kt,topMiddle:new Tu,topRight:new Kt,bottomLeft:new Kt,bottomMiddle:new Tu,bottomRight:new Kt},this.middleLine=new Mn,this.append([this.background,this.topLine,this.middleLine,this.bottomLine,...Object.values(this.handles)])}static is(e){return es.isCheck(e,"parallel-channel")}dragHandle(e,t,i,s){const{activeHandle:n,handles:o}=this;if(n==null)return;const{offset:a}=o[n].drag(t);o[n].toggleDragging(!0),(n==="topMiddle"||n==="bottomMiddle")&&(a.x=0);let r=[],l=s;switch(n){case"topLeft":case"bottomLeft":r=["topLeft","bottomLeft"];break;case"topMiddle":r=["topLeft","topRight"],a.y-=Tu.HANDLE_SIZE/2,l=!1;break;case"topRight":case"bottomRight":r=["topRight","bottomRight"];break;case"bottomMiddle":r=["bottomLeft","bottomRight"],a.y-=Tu.HANDLE_SIZE/2,l=!1;break}const c=rn(e,i),h=rn(e.bottom,i);if(!c||!h)return;const d={topLeft:Za.start(c),topRight:Za.end(c),bottomLeft:Za.start(h),bottomRight:Za.end(h)},u={vectors:{topLeft:d.topRight,bottomLeft:d.bottomRight,topRight:d.topLeft,bottomRight:d.bottomLeft},angle:e.snapToAngle},p=$r(d,a,i,{overflowContinuous:this.overflowContinuous,translateVectors:r,snap:l?u:void 0});e.start.x=p.topLeft.x,e.start.y=p.topLeft.y,e.end.x=p.topRight.x,e.end.y=p.topRight.y,e.height=p.topLeft.y-p.bottomLeft.y}getTranslatePointsVectors(e,t){const{bottomLeft:i,topLeft:s}=this.handles,n=i.getBBox().y-s.getBBox().y,o=wo.add(e,wo.from(0,n)),a=wo.add(t,wo.from(0,n));return{start:e,end:t,bottomStart:o,bottomEnd:a}}containsPoint(e,t){return super.containsPoint(e,t)||this.middleLine.visible&&this.middleLine.strokeWidth>0&&this.middleLine.containsPoint(e,t)}getNodeAtCoords(e,t){return this.middleLine.visible&&this.middleLine.strokeWidth>0&&this.middleLine.containsPoint(e,t)?"line":super.getNodeAtCoords(e,t)}updateLines(e,t,i,s,n,o){const{topLine:a,middleLine:r,bottomLine:l}=this,{lineDashOffset:c,stroke:h,strokeOpacity:d,strokeWidth:u}=e,p=e.getLineDash(),g={lineCap:e.getLineCap(),lineDash:p,lineDashOffset:c,stroke:h,strokeOpacity:d,strokeWidth:u};a.setProperties({...t,...g}),l.setProperties({...i,...g});const f=this.extendLine({x1:n.x1,y1:o.y1+(n.y1-o.y1)/2,x2:n.x2,y2:o.y2+(n.y2-o.y2)/2},e,s);r.setProperties({...f,lineDash:e.middle.lineDash??p,lineDashOffset:e.middle.lineDashOffset??c,stroke:e.middle.stroke??h,strokeOpacity:e.middle.strokeOpacity??d,strokeWidth:e.middle.strokeWidth??u,visible:e.middle.visible??!0})}updateHandles(e,t,i){const{handles:{topLeft:s,topMiddle:n,topRight:o,bottomLeft:a,bottomMiddle:r,bottomRight:l}}=this,c={fill:e.handle.fill,stroke:e.handle.stroke??e.stroke,strokeOpacity:e.handle.strokeOpacity??e.strokeOpacity,strokeWidth:e.handle.strokeWidth??e.strokeWidth};s.update({...c,...Za.start(t)}),o.update({...c,...Za.end(t)}),a.update({...c,...Za.start(i)}),l.update({...c,...Za.end(i)}),n.update({...c,...wo.sub(Za.center(t),wo.from(n.handle.width/2,n.handle.height/2))}),r.update({...c,...wo.sub(Za.center(i),wo.from(r.handle.width/2,r.handle.height/2))})}updateText(e,t,i){this.text=this.updateNode(Ih,this.text,!!e.text.label),FP(!0,t,i,e.text,e.strokeWidth,this.text,e.text.label)}getBackgroundPoints(e,t,i,s){const n=t.x1>t.x2,o=t.y1>t.y2,a=t.x1!==i.x1&&t.y1!==i.y1,r=t.x2!==i.x2&&t.y2!==i.y2,l=wo.from(t);return e.extendEnd&&r&&l.push(wo.from(n?s.x1:s.x2,o?s.y1:s.y2)),l.push(...wo.from(i).reverse()),e.extendStart&&a&&l.push(wo.from(n?s.x2:s.x1,o?s.y2:s.y1)),l}},{StateMachine:tc,StateMachineProperty:LI,Debug:x9}=k,Nb=class extends tc{constructor(e){const t=({point:l})=>{const c=new Ao;c.set({start:l,end:l,height:0}),e.create(c)},i=()=>{const{node:l}=this;l?.toggleActive(!0),l?.toggleHandles({topLeft:!0,topMiddle:!1,topRight:!1,bottomLeft:!1,bottomMiddle:!1,bottomRight:!1})},s=({offset:l,context:c})=>{const{datum:h,snapping:d}=this;h&&(h.set({end:xf(l,c,d,h.start,h.snapToAngle)}),e.update())},n=()=>{this.node?.toggleHandles({topRight:!0}),e.update()},o=({point:l})=>{const{datum:c,node:h}=this,d=Ri(c?.end.y),u=Ri(c?.start.y),{y:p}=l;if(c==null||!Jt(u)||!Jt(d)||!Jt(p))return;const g=d-(p??0),f=u-g;h?.toggleHandles({bottomLeft:!0,bottomRight:!0}),!(!e.validatePoint({x:c.start.x,y:f},{overflowContinuous:!0})||!e.validatePoint({x:c.end.x,y:l.y},{overflowContinuous:!0}))&&(c.set({height:g}),e.update())},a=({point:l})=>{const{datum:c,node:h}=this,d=Ri(c?.end.y),u=Ri(c?.start.y),{y:p}=l;if(c==null||!Jt(u)||!Jt(d)||!Jt(p))return;const g=d-(p??0),f=u-g;h?.toggleHandles(!0),!(!e.validatePoint({x:c.start.x,y:f},{overflowContinuous:!0})||!e.validatePoint({x:c.end.x,y:l.y},{overflowContinuous:!0}))&&(c.set({height:g}),e.recordAction("Create parallel-channel annotation"),e.showAnnotationOptions(),e.update())},r=()=>e.delete();super("start",{start:{click:{target:"waiting-first-render",action:t},drag:{target:"waiting-first-render",action:t},reset:tc.parent},"waiting-first-render":{render:{target:"end",action:i}},end:{hover:s,drag:s,click:{target:"height",action:n},dragEnd:{target:"height",action:n},reset:{target:tc.parent,action:r},cancel:{target:tc.parent,action:r}},height:{hover:o,click:{target:tc.parent,action:a},drag:{target:tc.parent,action:a},reset:{target:tc.parent,action:r},cancel:{target:tc.parent,action:r}}}),this.debug=x9.create(!0,"annotations"),this.snapping=!1}};y([LI()],Nb.prototype,"datum",2),y([LI()],Nb.prototype,"node",2),y([LI()],Nb.prototype,"snapping",2);var yR={type:"parallel-channel",datum:Ao,scene:wb,isDatum:Ao.is,translate:(e,t,i,s)=>{Ao.is(t)&&wb.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Ao.is(t)&&Ao.is(i)&&wb.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Ao.is(t)&&wb.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new Nb({...e,create:t("parallel-channel")}),dragState:e=>new mi(e)},Ob=class extends bI{constructor(){super(),this.type="text",this.append([this.label,this.handle])}static is(e){return es.isCheck(e,"text")}getHandleCoords(e,t){const i=Kt.HANDLE_SIZE/2;return{x:t.x+i,y:t.y+2+i}}},b9=class extends bf{createDatum(){return new Hr}},mR={type:"text",datum:Hr,scene:Ob,isDatum:Hr.is,translate:(e,t,i,s)=>{Hr.is(t)&&Ob.is(e)&&e.translate(t,i,s)},copy:(e,t,i,s)=>{if(Hr.is(t)&&Hr.is(i)&&Ob.is(e))return e.copy(t,i,s)},update:(e,t,i)=>{Hr.is(t)&&Ob.is(e)&&e.update(t,i)},createState:(e,{createDatum:t})=>new b9({...e,create:t("text")}),dragState:e=>new mi(e)},Wn={[tR.type]:tR,[GP.type]:GP,[jP.type]:jP,[yR.type]:yR,[$P.type]:$P,[JP.type]:JP,[qP.type]:qP,[EP.type]:EP,[RP.type]:RP,[fR.type]:fR,[mR.type]:mR,[iR.type]:iR,[CP.type]:CP,[AP.type]:AP,[hR.type]:hR,[dR.type]:dR,[uR.type]:uR,[pR.type]:pR};function Th(e){for(const{isDatum:t}of Object.values(Wn))if(t(e))return e}var{ActionOnSet:v9,ParallelStateMachine:S9,StateMachine:TI,StateMachineProperty:Xa,Debug:M9}=k,Eb=class extends S9{constructor(e){super(new D9(t=>{this.snapping=t}),new k9(()=>{this.node=this.active==null?void 0:e.node(this.active)}),new ic(e,t=>{this.active=t,this.datum=this.active==null?void 0:e.datum(this.active),this.node=this.active==null?void 0:e.node(this.active)})),this.snapping=!1}getActive(){return this.active}isActive(e){return e===this.active}};y([Xa()],Eb.prototype,"snapping",2),y([Xa()],Eb.prototype,"datum",2),y([Xa()],Eb.prototype,"node",2);var D9=class extends TI{constructor(e){super("idle",{idle:{hover:({shiftKey:t})=>e(t),keyDown:({shiftKey:t})=>e(t),keyUp:({shiftKey:t})=>e(t),click:({shiftKey:t})=>e(t),drag:({shiftKey:t})=>e(t)},dragging:{},translating:{},"text-input":{}})}},k9=class extends TI{constructor(e){super("idle",{idle:{onEnter:e,render:e},dragging:{onEnter:e,render:e},translating:{onEnter:e,render:e},"text-input":{render:e}})}},ic=class extends TI{constructor(e,t){const i=b=>S=>{e.create(b,S),this.active=e.selectLast()},s=()=>{this.active!=null&&e.delete(this.active),this.active=void 0,e.select()},n={createDatum:i},o={...e,delete:s,showTextInput:()=>{this.active!=null&&e.showTextInput(this.active)},deselect:()=>{const b=this.active;this.active=void 0,this.hovered=void 0,e.select(this.active,b)},showAnnotationOptions:()=>{this.active!=null&&e.showAnnotationOptions(this.active)}},a=Object.fromEntries(Object.entries(Wn).map(([b,S])=>[b,S.createState(o,n)])),r=Object.fromEntries(Object.entries(Wn).map(([b,S])=>[b,S.dragState(e,n)])),l=({colorPickerType:b,colorOpacity:S,color:D,opacity:L,isMultiColor:I})=>{this.datum&&(b==="text-color"&&e.updateTextInputColor(D),db(this.datum,b,S,D,L,I),e.update())},c=b=>{const{datum:S,node:D}=this;!S||!D||(Ua(S)?(S.fontSize=b,e.updateTextInputFontSize(b)):Au(S)&&(S.text.fontSize=b),e.update())},h=b=>{const{datum:S,node:D}=this;!S||!D||!$l(S)||(hP(S,b),e.update())},d=b=>{const{node:S}=this;!S||!("setTextInputBBox"in S)||(S.setTextInputBBox(b),e.update())},u=({textInputValue:b,bbox:S})=>{const{datum:D}=this;if(S!=null&&b!=null&&b.length>0){if(!Ua(D))return;const L=ob(D,b,S.width);D.set({text:L}),e.update(),e.recordAction(`Change ${D.type} annotation text`)}else e.delete(this.active),e.recordAction(`Delete ${D?.type} annotation`)},p=()=>{e.updateTextInputBBox(void 0)},g=()=>this.active!=null,f=()=>this.copied!=null,x=()=>{const{active:b,datum:S}=this;return b==null||!S?!1:Au(S)&&S.isWriteable()},m=()=>this.active!=null&&!Wl(this.datum),v=()=>this.hovered!=null;super("idle",{idle:{onEnter:()=>{e.select(this.active,this.active),this.hoverCoords&&(this.hovered=e.hoverAtCoords(this.hoverCoords,this.active,this.hovered))},hover:({offset:b})=>{this.hovered=e.hoverAtCoords(b,this.active,this.hovered),this.hoverCoords=b},translate:{guard:g,target:"translating",action:({translation:b})=>{e.startInteracting(),e.translate(this.active,b),e.update()}},copy:{guard:m,action:()=>{this.copied=e.copy(this.active)}},cut:{guard:m,action:()=>{this.copied=e.copy(this.active),s()}},paste:{guard:f,action:()=>{e.paste(this.copied)}},selectLast:()=>{const b=this.active;this.active=e.selectLast(),e.select(this.active,b)},click:[{guard:()=>{const{active:b,hovered:S,datum:D}=this;return b==null||S!==b||!D?!1:Ua(D)&&D.isWriteable()},target:"text-input"},{action:()=>{const b=this.active;this.active=this.hovered,e.select(this.active,b)}}],dblclick:{guard:x,action:({offset:b})=>{const S=e.getNodeAtCoords(b,this.active)==="text"?"text":"line";e.showAnnotationSettings(this.active,void 0,S)}},dragStart:[{guard:v,target:"dragging",action:()=>{const b=this.active;this.active=this.hovered,e.select(this.active,b),e.startInteracting()}},{action:()=>{const b=this.active;this.active=this.hovered,e.select(this.active,b)}}],color:{guard:g,action:l},fontSize:{guard:g,action:c},lineProps:{guard:g,action:b=>{const S=Th(this.datum);S?.set(b),e.update(),e.recordAction(`Change ${S?.type} ${Object.entries(b).map(([D,L])=>`${D} to ${L}`).join(", ")}`)}},lineStyle:{guard:g,action:h},lineText:{guard:g,action:b=>{const S=Th(this.datum);Au(S)&&(Wr(S)&&b.position==="center"&&(b.position="inside"),S.text.set(b),e.update())}},updateTextInputBBox:{guard:g,action:d},toolbarPressSettings:{guard:x,action:b=>{e.showAnnotationSettings(this.active,b)}},reset:()=>{this.active!=null&&this.node?.toggleActive(!1),this.hovered=void 0,this.active=void 0,e.select(this.active,this.active),e.resetToIdle()},delete:()=>{this.active!=null&&(e.delete(this.active),!Wl(this.datum)&&e.recordAction(`Delete ${this.datum?.type} annotation`))},deleteAll:()=>{e.deleteAll()},...a},dragging:{onEnter:(b,S)=>{if(this.active==null)return;const D=e.getAnnotationType(this.active);D&&(this.transitionRoot(D),this.transitionRoot("dragStart",S))},...r},translating:{onEnter:()=>{},translate:{guard:g,target:"translating",action:({translation:b})=>{e.startInteracting(),e.translate(this.active,b),e.update()}},translateEnd:{guard:g,target:"idle"},onExit:()=>{e.stopInteracting(),e.update(),e.recordAction("Translate annotation")}},"text-input":{onEnter:()=>{if(this.active==null)return;const b=Th(this.datum);!b||!("getTextInputCoords"in b)||(e.startInteracting(),e.showTextInput(this.active),b.visible=!1,e.update())},updateTextInputBBox:{guard:g,action:d},resize:{target:"idle",action:u},click:{target:"idle",action:u},drag:{target:"idle",action:u},textInput:[{guard:yI,target:"idle",action:p},{guard:mI,target:"idle",action:u}],color:{guard:g,action:l},fontSize:{guard:g,action:c},cancel:{target:"idle",action:p},onExit:()=>{e.stopInteracting(),e.hideTextInput();const b=this.active;if(this.active=this.hovered=void 0,e.select(this.active,b),b==null)return;const S=e.datum(b),D=e.node(b);!S||!D||(S.visible=!0)}}}),this.setActive=t,this.debug=M9.create(!0,"annotations"),this.snapping=!1}};y([v9({changeValue(e){this.setActive(e)}}),Xa()],ic.prototype,"active",2),y([Xa()],ic.prototype,"hovered",2),y([Xa()],ic.prototype,"hoverCoords",2),y([Xa()],ic.prototype,"copied",2),y([Xa()],ic.prototype,"snapping",2),y([Xa()],ic.prototype,"datum",2),y([Xa()],ic.prototype,"node",2);var{ActionOnSet:I9,LayoutElement:A9,Menu:C9,PropertiesArray:L9,ToolbarButtonProperties:T9,Property:Pb,ChartAxisDirection:w9}=k,xR=class extends T9{};y([Pb],xR.prototype,"value",2);var Rb=class extends k.BaseProperties{constructor(e){super(),this.ctx=e,this.enabled=!0,this.padding=20,this.buttons=new L9(xR),this.events=new Go,this.annotationMenu=new C9(this.ctx,"annotations"),this.cleanup=new St,this.toolbar=e.sharedToolbar.getSharedToolbar("annotations");const t=this.onKeyDown.bind(this);this.toolbar.addListener("keydown",t),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onToolbarButtonPress.bind(this)),e.layoutManager.registerElement(A9.ToolbarLeft,this.onLayoutStart.bind(this)),()=>{this.toolbar.removeListener("keydown",t),this.toolbar.destroy()})}destroy(){this.cleanup.flush()}toggleClearButtonEnabled(e){const t=this.buttons.findIndex(i=>i.value==="clear");this.toolbar.toggleButtonEnabledByIndex(t,e)}resetButtonIcons(){for(const[e,t]of this.buttons.entries())switch(t.value){case"line-menu":this.updateButtonByIndex(e,{icon:"trend-line-drawing",value:"line-menu"});break;case"fibonacci-menu":this.updateButtonByIndex(e,{icon:"fibonacci-retracement-drawing",value:"fibonacci-menu"});break;case"text-menu":this.updateButtonByIndex(e,{icon:"text-annotation",value:"text-menu"});break;case"shape-menu":this.updateButtonByIndex(e,{icon:"arrow-drawing",value:"shape-menu"});break;case"measurer-menu":this.updateButtonByIndex(e,{icon:"measurer-drawing",value:"measurer-menu"});break}}hideOverlays(){this.annotationMenu.hide()}clearActiveButton(){this.toolbar.clearActiveButton()}onLayoutStart(e){this.enabled&&(this.toolbar.updateButtons(this.buttons),this.toolbar.layout(e.layoutBox,this.padding))}refreshButtonsEnabled(e){for(const[t,i]of this.buttons.entries())i&&this.toolbar.toggleButtonEnabledByIndex(t,e)}onToolbarButtonPress({event:e,button:t,buttonBounds:i,buttonWidget:s}){const n=this.ctx.axisManager.getAxisContext(w9.Y)[0].scale;switch(t.value){case"clear":this.events.emit("pressed-clear",null);break;case"line-menu":this.onToolbarButtonPressShowMenu(e,i,s,t.value,"toolbarAnnotationsLineAnnotations",u6.filter(o=>o.visible?o.visible(n):!0));break;case"fibonacci-menu":this.onToolbarButtonPressShowMenu(e,i,s,t.value,"toolbarAnnotationsFibonacciAnnotations",p6);break;case"text-menu":this.onToolbarButtonPressShowMenu(e,i,s,t.value,"toolbarAnnotationsTextAnnotations",f6);break;case"shape-menu":this.onToolbarButtonPressShowMenu(e,i,s,t.value,"toolbarAnnotationsShapeAnnotations",y6);break;case"measurer-menu":this.onToolbarButtonPressShowMenu(e,i,s,t.value,"toolbarAnnotationsMeasurerAnnotations",m6);break}}onToolbarButtonPressShowMenu(e,t,i,s,n,o){this.events.emit("pressed-show-menu",null);const a=this.buttons.findIndex(r=>r.value===s);this.toolbar.toggleActiveButtonByIndex(a),this.annotationMenu.setAnchor({x:t.x+t.width+6,y:t.y}),this.annotationMenu.show(i,{items:o,ariaLabel:this.ctx.localeManager.t(n),class:"ag-charts-annotations__toolbar-menu",sourceEvent:e.sourceEvent,onPress:this.onButtonPressMenuCreateAnnotation.bind(this,s)})}onButtonPressMenuCreateAnnotation(e,t){const i=this.buttons.findIndex(s=>s.value===e);this.updateButtonByIndex(i,{icon:t.icon}),this.events.emit("pressed-create-annotation",{annotation:t.value}),this.annotationMenu.hide()}onKeyDown({sourceEvent:e}){e.key==="Escape"&&this.events.emit("cancel-create-annotation",null)}updateButtonByIndex(e,t){const i=this.buttons.at(e);i&&(i.set({...i.toJson(),...t,value:t.value??i.value}),this.toolbar.updateButtonByIndex(e,{...i.toJson()}))}};y([Pb,I9({changeValue(e){this.toolbar?.setHidden(!e)}})],Rb.prototype,"enabled",2),y([Pb],Rb.prototype,"padding",2),y([Pb],Rb.prototype,"buttons",2);var{BaseModuleInstance:N9,InteractionState:Sf,Property:O9,ChartAxisDirection:E9,getIconClassNames:P9}=k,Mf="ag-charts-annotations__axis-button",bR=class extends N9{constructor(e,t,i,s){super(),this.ctx=e,this.axisCtx=t,this.onButtonClick=i,this.seriesRect=s,this.enabled=!0,this.snap=!1,this.padding=0,this.button=this.setup(),this.toggleVisibility(!1),this.updateButtonElement(),this.snap=!!t.scale.bandwidth,e.domManager.addEventListener("focusin",({target:n})=>{const o=n instanceof HTMLElement?n:void 0;!(o&&e.domManager.contains(o,"series-area"))&&o!==this.button.getElement()&&this.hide()}),this.cleanup.register(e.widgets.seriesWidget.addListener("drag-move",n=>this.onMouseDrag(n)),e.widgets.seriesWidget.addListener("mousemove",n=>this.onMouseMove(n)),e.widgets.seriesWidget.addListener("mouseleave",()=>this.onMouseLeave()),e.widgets.seriesDragInterpreter?.events.on("click",n=>this.onClick(n)),e.eventsHub.on("series:focus-change",()=>this.onKeyPress()),e.eventsHub.on("zoom:pan-start",()=>this.hide()),e.eventsHub.on("zoom:change",()=>this.hide()),()=>this.destroyElements(),()=>this.button.destroy())}update(e,t){this.seriesRect=e,this.padding=t}setup(){const e=new lf.ButtonWidget;return e.addClass(Mf),e.setTabIndex(-1),e.setAriaLabel(this.ctx.localeManager.t("ariaLabelAddHorizontalLine")),this.ctx.widgets.seriesWidget.getElement().appendChild(e.getElement()),e}destroyElements(){this.ctx.domManager.removeChild("canvas-overlay",Mf)}onMouseMove(e){this.ctx.interactionManager.isState(Sf.Clickable)&&this.show(e)}onMouseDrag(e){this.ctx.interactionManager.isState(Sf.AnnotationsMoveable)&&this.show(e)}onMouseLeave(){this.ctx.interactionManager.isState(Sf.Clickable)&&this.hide()}onClick(e){this.ctx.interactionManager.isState(Sf.Clickable)&&e.device==="touch"&&this.show(e)}show(e){const{sourceEvent:t,currentX:i,currentY:s}=e;if(!(this.enabled&&this.ctx.widgets.seriesWidget.getElement().contains(t.target))){this.hide();return}this.toggleVisibility(!0);const n=this.getButtonCoordinates({x:i,y:s});this.coords={x:n.x+this.button.clientWidth/2,y:n.y+this.button.clientHeight/2},this.updatePosition(n)}hide(){this.toggleVisibility(!1)}onKeyPress(){this.snap&&this.ctx.interactionManager.isState(Sf.Default)||this.hide()}getButtonCoordinates({x:e,y:t}){const{axisCtx:{direction:i,position:s},seriesRect:n,snap:o,axisCtx:a,padding:r}=this,{clientWidth:l,clientHeight:c}=this.button,[h,d]=[0,n.height],[u,p]=[0,n.width];if(o&&(e=Fr(tb(e-n.x,a),a)+n.x,t=Fr(tb(t-n.y,a),a)+n.y),i===E9.X){const f=c-Math.max(0,r-5);e=e-l/2,t=s==="top"?h-c+f:d-f}else{const f=l-Math.max(0,r-9);e=s==="left"?u-l+f:p-f,t=t-c/2}return{x:e,y:t}}toggleVisibility(e){const{button:t}=this;if(t==null)return;const i=this.enabled&&e;this.toggleClass("-hidden",!i)}toggleClass(e,t){this.button.toggleClass(`${Mf}-${e}`,t)}updatePosition({x:e,y:t}){this.button.getElement().style.transform=`translate(${Math.round(e)}px, ${Math.round(t)}px)`}updateButtonElement(){const{button:e}=this;e.addListener("click",()=>this.onButtonClick(this.coords)),e.addListener("touchend",()=>this.onButtonClick(this.coords)),e.addListener("drag-start",()=>{}),e.setInnerHTML(``)}};y([O9],bR.prototype,"enabled",2);var{Color:vR,DraggablePopover:R9,NativeWidget:wI,Vec2:zi,createButton:zb,createCheckbox:z9,createSelect:F9,createTextArea:B9,initRovingTabIndex:SR,getIconClassNames:_9,mapValues:NI}=k,MR=class wC extends R9{constructor(t,i){super(t,i),this.dragHandleDraggingClass="ag-charts-dialog__drag-handle--dragging",this.colorPicker=new uP(this.ctx,{detached:!0}),this.cleanup.register(t.eventsHub.on("layout:complete",this.onLayoutComplete.bind(this)))}showWithChildren(t,i){const s=super.showWithChildren(t,i);return s.classList.add("ag-charts-dialog"),s.setAttribute("role","dialog"),s.addEventListener("mousedown",n=>{n.target.classList?.contains("ag-charts-dialog__color-picker-button")||this.colorPicker.hide()}),s.addEventListener("keydown",this.onKeyDown.bind(this)),qe().requestAnimationFrame(()=>this.reposition()),this.colorPicker.attachTo(this),s}updatePosition(t){super.updatePosition(t);const{anchor:i,fallbackAnchor:s}=this.getColorPickerAnchors()??{};i&&this.colorPicker.setAnchor(i,s)}createTabs(t,i,s){const n=De("div","ag-charts-dialog__tabs"),o=NI(s,()=>Ic()),a=NI(s,()=>Ic());for(const[p,g]of Tt(s))Ca(g.panel,{id:a[p],role:"tabpanel","aria-labelledby":o[p]});const r=p=>{for(const[g,f]of Tt(s))f.panel.classList.toggle("ag-charts-dialog__tab-panel--active",g===p),h[g].classList.toggle("ag-charts-dialog__tab-button--active",g===p),Ge(h[g],"aria-selected",g===p),g===p&&f.onShow?.()},l=new wI(De("div","ag-charts-dialog__header"));l.addListener("drag-start",p=>{const{sourceEvent:g}=p;g.target instanceof Element&&g.target.classList.contains("ag-charts-dialog__header")&&this.onDragStart(p)}),l.addListener("drag-move",p=>this.onDragMove(p)),l.addListener("drag-end",()=>this.onDragEnd());const c=new G9;this.setDragHandle(c);const h=NI(s,(p,g)=>zb({label:this.ctx.localeManager.t(p.label),onPress:()=>r(g)},{id:o[g],class:"ag-charts-dialog__tab-button",role:"tab","aria-controls":a[g]})),d=De("div","ag-charts-dialog__tab-list");Ca(d,{role:"tablist","aria-label":this.ctx.localeManager.t(t)}),d.append(...Object.values(h));const u=this.createHeaderCloseButton();return l.getElement().append(c.getElement(),d,u),n.append(l.getElement(),...Object.values(s).map(p=>p.panel)),r(i),SR({orientation:"horizontal",buttons:Object.values(h)}),{tabs:n,initialFocus:h[i]}}createTabPanel(){return De("div","ag-charts-dialog__tab-panel")}createInputGroupLine(){return De("div","ag-charts-dialog__input-group-line")}createRadioGroup({label:t,options:i,value:s,onChange:n}){const o=this.createInputGroup(t);Ca(o,{role:"radiogroup",tabindex:-1,"aria-label":this.ctx.localeManager.t(t)});const a="ag-charts-dialog__button--active",r=[];for(const l of i){const{icon:c,altText:h}=l,d=this.ctx.localeManager.t(h),u=zb({icon:c,altText:d,onPress:()=>{for(const p of Array.from(o.children))p.classList.remove(a),p.ariaChecked="false";u.classList.add(a),u.ariaChecked="true",n(l.value)}},{"aria-checked":l.value===s,class:"ag-charts-dialog__button",role:"radio",title:d});l.value===s&&u.classList.add(a),o.appendChild(u),r.push(u)}return SR({orientation:"horizontal",buttons:r}),o}createSelect({altText:t,label:i,options:s,value:n,onChange:o}){const a=this.createInputGroup(i),r=this.ctx.localeManager.t(t),l=F9({value:n,options:s,onChange:o},{class:"ag-charts-dialog__select","aria-label":r,title:r});return a.append(l),a}createTextArea({placeholder:t,value:i,onChange:s}){const n=t?this.ctx.localeManager.t(t):void 0;return B9({value:i,onChange:s},{placeholder:n})}createCheckbox({label:t,checked:i,onChange:s}){const n=Ic(),o=this.createInputGroup(t,{for:n}),a=z9({checked:i,onChange:s},{class:"ag-charts-dialog__checkbox",role:"switch",id:n});return o.append(a),o}createColorPicker({color:t,opacity:i,label:s,altText:n,onChange:o,onChangeHide:a,isMultiColor:r,hasMultiColorOption:l}){const c=this.createInputGroup(s),h=this.ctx.localeManager.t(n),d=zb({label:h,onPress:u=>{const{anchor:p,fallbackAnchor:g}=this.getColorPickerAnchors(d)??{};this.colorPicker.show({anchor:p,fallbackAnchor:g,color:t,opacity:i,isMultiColor:r,hasMultiColorOption:l,sourceEvent:u,onChange:(f,x,m,v)=>{d.style.setProperty("--color",f),d.classList.toggle("ag-charts-dialog__color-picker-button--multi-color",v),o(f,x,m,v)},onChangeHide:a})}},{"aria-label":h,tabindex:0,class:"ag-charts-dialog__color-picker-button",title:h});if(r)d.classList.toggle("ag-charts-dialog__color-picker-button--multi-color");else if(t){const u=vR.fromString(t),p=new vR(u.r,u.g,u.b,i);d.style.setProperty("--color",p.toHexString())}return c.append(d),this.hideFns.push(()=>{this.colorPicker.hide()}),c}createHeaderCloseButton(){return zb({icon:"close",altText:this.ctx.localeManager.t("iconAltTextClose"),onPress:()=>this.hide()},{class:"ag-charts-dialog__close-button"})}createInputGroup(t,i){const s=De("div","ag-charts-dialog__input-group"),n=De("label","ag-charts-dialog__input-group-label");return n.innerText=this.ctx.localeManager.t(t),Ge(n,"for",i?.for),s.appendChild(n),s}onLayoutComplete(t){this.seriesRect=t.series.paddedRect,this.reposition()}onKeyDown(t){t.altKey||t.ctrlKey||t.metaKey||t.isComposing||t.key!=="Escape"||this.hide()}reposition(){const{seriesRect:t,ctx:i}=this,s=i.domManager.getBoundingClientRect(),n=this.getPopoverElement();if(!t||!n)return;const o=zi.from(0,t.y),a=zi.from(s.width,t.height),r=zi.from(n),l=zi.from(.5,1);let c;if(t.width>1e3){const h=zi.sub(zi.add(o,zi.multiply(a,l)),zi.multiply(r,l));c=zi.sub(h,zi.from(0,wC.offset))}else{const h=zi.sub(zi.add(o,a),r);c=zi.sub(h,wC.offset)}this.updatePosition(c)}getColorPickerAnchors(t){if(t&&(this.colorPickerAnchorElement=t),!this.colorPickerAnchorElement)return;const i=this.colorPickerAnchorElement.getBoundingClientRect(),s=this.ctx.domManager.getBoundingClientRect(),n=zi.sub(zi.from(i.x,i.y),zi.from(s.left,s.top)),o=zi.add(n,zi.from(0,i.height+5)),a=zi.sub(n,zi.from(0,5));return{anchor:o,fallbackAnchor:a}}};MR.offset=60;var V9=MR,G9=class extends wI{constructor(){super(De("div","ag-charts-dialog__drag-handle"));const e=new wI(De("span",_9("drag-handle")));e.setAriaHidden(!0),this.addChild(e)}},{focusCursorAtEnd:j9}=k,H9=class extends V9{constructor(e){super(e,"settings"),this.events=new Go,this.hideFns.push(()=>this.events.emit("hidden",null))}show(e,t){const i=this.createLinearLineTab(e,t),s=this.createLinearTextTab(e,t);let n="dialogHeaderLine";Wr(e)?n="dialogHeaderChannel":cP(e)?n="dialogHeaderFibonacciRange":e.type==="date-range"?n="dialogHeaderDateRange":e.type==="price-range"?n="dialogHeaderPriceRange":e.type==="date-price-range"&&(n="dialogHeaderDatePriceRange");const{tabs:o,initialFocus:a}=this.createTabs("ariaLabelSettingsTabBar",t.initialSelectedTab,{line:{label:n,panel:i},text:{label:"dialogHeaderText",panel:s.panel,onShow:s.onShow}});t.initialFocus=a,this.showWithChildren([o],t).classList.add("ag-charts-dialog--annotation-settings")}createLinearLineTab(e,t){const i=this.createTabPanel(),s=this.createInputGroupLine(),n=this.createInputGroupLine(),o="isMultiColor"in e,a=this.createColorPickerInput("line-color",e.getDefaultColor("line-color"),e.getDefaultOpacity("line-color"),o?e.isMultiColor:!1,o,t.onChangeLineColor,t.onChangeHideLineColor),r=this.createStrokeWidthSelect(e.strokeWidth??2,t.onChangeLineStyleWidth),l=this.createLineStyleRadioGroup(e.lineStyle??"solid",t.onChangeLineStyleType);if(s.append(a),"background"in e){const c=this.createColorPickerInput("fill-color",e.getDefaultColor("fill-color"),e.getDefaultOpacity("fill-color"),!1,!1,t.onChangeFillColor,t.onChangeHideFillColor);s.append(c),n.append(r)}else"showFill"in e?(s.append(this.createCheckbox({label:"dialogInputShowFill",checked:e.showFill??!0,onChange:c=>t.onChangeLine({showFill:c})})),n.append(r)):s.append(r);return n.append(l),i.append(s,n),"bands"in e&&i.append(this.createFibonacciRatioSelect(e.bands??10,c=>t.onChangeLine({bands:c}))),"extendStart"in e&&"extendEnd"in e&&i.append(this.createCheckbox({label:Wr(e)?"dialogInputExtendChannelStart":"dialogInputExtendLineStart",checked:e.extendStart??!1,onChange:c=>t.onChangeLine({extendStart:c})}),this.createCheckbox({label:Wr(e)?"dialogInputExtendChannelEnd":"dialogInputExtendLineEnd",checked:e.extendEnd??!1,onChange:c=>t.onChangeLine({extendEnd:c})})),"extendAbove"in e&&"extendBelow"in e&&i.append(this.createCheckbox({label:"dialogInputExtendAbove",checked:e.extendAbove??!1,onChange:c=>t.onChangeLine({extendAbove:c})}),this.createCheckbox({label:"dialogInputExtendBelow",checked:e.extendBelow??!1,onChange:c=>t.onChangeLine({extendBelow:c})})),"extendLeft"in e&&"extendRight"in e&&i.append(this.createCheckbox({label:"dialogInputExtendLeft",checked:e.extendLeft??!1,onChange:c=>t.onChangeLine({extendLeft:c})}),this.createCheckbox({label:"dialogInputExtendRight",checked:e.extendRight??!1,onChange:c=>t.onChangeLine({extendRight:c})})),"reverse"in e&&"showFill"in e&&i.append(this.createCheckbox({label:"dialogInputReverse",checked:e.reverse??!1,onChange:c=>t.onChangeLine({reverse:c})})),i}createLinearTextTab(e,t){const i=this.createTabPanel(),s=this.createTextArea({placeholder:"inputTextareaPlaceholder",value:e.text.label,onChange:h=>t.onChangeText({label:h})}),n=this.createFontSizeSelect(e.text.fontSize,t.onChangeTextFontSize),o=this.createColorPickerInput("text-color",e.text.color,1,!1,!1,t.onChangeTextColor,t.onChangeHideTextColor),a=e.text.position==="inside"?"center":e.text.position,r=this.createPositionRadioGroup(a??"top",h=>t.onChangeText({position:h})),l=this.createAlignmentRadioGroup(e.text.alignment??"center",h=>t.onChangeText({alignment:h})),c=this.createInputGroupLine();return c.append(n,o,r,l),i.append(s,c),{panel:i,onShow:()=>j9(s)}}createColorPickerInput(e,t,i,s,n,o,a){const r=e==="fill-color"?"dialogInputFillColorPicker":"dialogInputColorPicker",l=e==="fill-color"?"dialogInputFillColorPickerAltText":"dialogInputColorPickerAltText";return this.createColorPicker({label:r,altText:l,color:t,opacity:i,isMultiColor:s,hasMultiColorOption:n,onChange:o,onChangeHide:a})}createStrokeWidthSelect(e,t){return this.createSelect({label:"dialogInputStrokeWidth",altText:"dialogInputStrokeWidthAltText",options:gP.map(({label:i,value:s})=>({label:i,value:`${s}`})),value:String(e),onChange:i=>t(Number(i))})}createFibonacciRatioSelect(e,t){return this.createSelect({label:"dialogInputFibonacciBands",altText:"dialogInputFibonacciBandsAltText",options:g6.map(({label:i,value:s})=>({label:i,value:`${s}`})),value:String(e),onChange:i=>t(Number(i))})}createLineStyleRadioGroup(e,t){return this.createRadioGroup({label:"dialogInputLineStyle",options:[{icon:"line-style-solid",altText:"iconAltTextLineStyleSolid",value:"solid"},{icon:"line-style-dashed",altText:"iconAltTextLineStyleDashed",value:"dashed"},{icon:"line-style-dotted",altText:"iconAltTextLineStyleDotted",value:"dotted"}],value:e,onChange:t})}createFontSizeSelect(e,t){return this.createSelect({label:"dialogInputFontSize",altText:"dialogInputFontSizeAltText",options:fP.map(({label:i,value:s})=>({label:i,value:String(s)})),value:String(e),onChange:i=>t(Number(i))})}createPositionRadioGroup(e,t){return this.createRadioGroup({label:"dialogInputPosition",options:[{icon:"position-top",altText:"iconAltTextPositionTop",value:"top"},{icon:"position-center",altText:"iconAltTextPositionCenter",value:"center"},{icon:"position-bottom",altText:"iconAltTextPositionBottom",value:"bottom"}],value:e,onChange:t})}createAlignmentRadioGroup(e,t){return this.createRadioGroup({label:"dialogInputAlign",options:[{icon:"align-left",altText:"iconAltTextAlignLeft",value:"left"},{icon:"align-center",altText:"iconAltTextAlignCenter",value:"center"},{icon:"align-right",altText:"iconAltTextAlignRight",value:"right"}],value:e,onChange:t})}};function OI(e){return e.gridPadding+e.seriesAreaPadding+e.tickSize+e.label.spacing}function W9(e,t,i){for(const{update:s}of Object.values(Wn))s(e,t,i)}var{ChartUpdateType:$9,InteractionState:Dn,PropertiesArray:U9,Property:Df,ChartAxisDirection:K9,keyProperty:Y9,valueProperty:Z9,Vec2:wh,Selection:X9,BBox:q9}=k,Ru=class HV extends k.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.enabled=!0,this.toolbar=new Rb(this.ctx),this.optionsToolbar=new hI(this.ctx,()=>{const i=this.state.getActive();if(i!=null)return Th(this.annotationData.at(i))}),this.axesButtons=new Wk,this.snap=!1,this.data=void 0,this.xKey=void 0,this.volumeKey=void 0,this.annotationData=new U9(HV.createAnnotationDatum),this.defaults=new h6,this.container=new k.Group({name:"static-annotations"}),this.annotations=new X9(this.container,this.createAnnotationScene.bind(this)),this.settingsDialog=new H9(this.ctx),this.textInput=new IX(this.ctx),this.postUpdateFns=[],this.state=this.setupStateMachine(),this.setupListeners(),this.setupDOM(),this.ctx.historyManager.addMementoOriginator(t.annotationManager),this.ctx.historyManager.addMementoOriginator(this.defaults),this.textInput.setKeyDownHandler(this.onTextInput.bind(this)),this.cleanup.register(()=>{this.clear(),this.xAxis?.button?.destroy(),this.yAxis?.button?.destroy()})}setupStateMachine(){const{ctx:t}=this;return new Eb({resetToIdle:()=>{t.domManager.updateCursor("annotations"),this.popAnnotationState(Dn.Annotations),this.hideOverlays(),this.optionsToolbar.hide(),this.deleteEphemeralAnnotations(),this.update()},hoverAtCoords:(i,s,n)=>{let o;return this.annotations.each((a,r,l)=>{if(!r.isHoverable())return;const c=a.containsPoint(i.x,i.y);c&&(o??(o=l)),a.toggleHovered(c,s===l,r.readOnly)}),o!=null?t.tooltipManager.suppressTooltip("annotations"):this.isAnnotationState()||t.tooltipManager.unsuppressTooltip("annotations"),(o==null||!this.annotationData.at(o)?.readOnly)&&this.ctx.domManager.updateCursor("annotations",o==null?void 0:this.annotations.at(o)?.getCursor()),o!==n&&this.update(),o},getNodeAtCoords:(i,s)=>{const n=this.annotations.at(s);if(n)return n.getNodeAtCoords(i.x,i.y)},translate:(i,s)=>{const n=this.annotations.at(i),o=Th(this.annotationData.at(i));if(!(!n||!o))return this.translateNode(n,o,s)},copy:i=>{const s=this.annotations.at(i),n=Th(this.annotationData.at(i));if(!(!s||!n))return this.createAnnotationDatumCopy(s,n)},paste:i=>{this.createAnnotation(i.type,i,!1),this.postUpdateFns.push(()=>{this.state.transitionAsync("selectLast"),this.state.transitionAsync("copy")})},select:(i,s)=>{const{annotations:n,optionsToolbar:o,toolbar:a}=this;this.hideOverlays(),a.clearActiveButton(),a.resetButtonIcons();const r=i==null?null:n.at(i),l=s==null?null:n.at(s),c=i==null?null:this.annotationData.at(i);l===r&&r!=null||(l?.toggleActive(!1),o.hide(),r&&!c?.readOnly?(this.pushAnnotationState(Dn.AnnotationsSelected),r.toggleActive(!0),Wl(c)||(o.updateButtons(this.annotationData.at(i)),this.postUpdateFns.push(()=>{o.show(),o.setAnchorScene(r)}))):(this.popAnnotationState(Dn.AnnotationsSelected),this.popAnnotationState(Dn.Annotations)),Wl(c)||this.deleteEphemeralAnnotations(),this.update())},selectLast:()=>(this.pushAnnotationState(Dn.AnnotationsSelected),this.annotationData.length-1),startInteracting:()=>{this.pushAnnotationState(Dn.Annotations)},stopInteracting:()=>{this.popAnnotationState(Dn.Annotations)},create:(i,s)=>{this.createAnnotation(i,s)},delete:i=>{this.annotationData.splice(i,1)},deleteAll:()=>{const i=this.annotationData.filter(s=>{if(s.readOnly===!0)return s});this.annotationData.splice(0,this.annotationData.length);for(const s of i)this.annotationData.push(s)},validatePoint:(i,s)=>{const n=this.getAnnotationContext();return n?Db(n,i,s):!0},getAnnotationType:i=>LX(this.annotationData[i].type),datum:i=>this.annotationData.at(i),node:i=>this.annotations.at(i),recordAction:i=>{this.recordActionAfterNextUpdate(i)},update:()=>{this.postUpdateFns.push(()=>{const i=this.state.getActive(),s=i==null?null:this.annotations.at(i);s!=null&&this.optionsToolbar.setAnchorScene(s)}),this.update()},showTextInput:i=>{const s=Th(this.annotationData.at(i));if(!this.annotations.at(i)||!s||!("getTextInputCoords"in s)||!("getTextPosition"in s))return;const o={color:s.color,fontFamily:s.fontFamily,fontSize:s.fontSize,fontStyle:s.fontStyle,fontWeight:s.fontWeight,placeholderColor:s.getPlaceholderColor()},a=this.getAnnotationContext(),r=c=>wh.add(s.getTextInputCoords(a,c),wh.required(this.seriesRect)),l=()=>s.getTextPosition();this.textInput.show({styles:o,layout:{getTextInputCoords:r,getTextPosition:l,alignment:s.alignment,textAlign:s.textAlign,width:s.width},text:s.text,placeholderText:s.placeholderText,onChange:(c,h)=>{this.state.transition("updateTextInputBBox",h)}}),this.ctx.domManager.updateCursor("annotations")},hideTextInput:()=>{this.textInput.hide()},updateTextInputColor:i=>{this.textInput.updateColor(i)},updateTextInputFontSize:i=>{const s=this.textInput.updateFontSize(i);this.state.transition("updateTextInputBBox",s)},updateTextInputBBox:i=>{this.state.transition("updateTextInputBBox",i)},showAnnotationOptions:i=>{const s=this.annotations.at(i);!s||Wl(this.annotationData.at(i))||(this.optionsToolbar.updateButtons(this.annotationData.at(i)),this.optionsToolbar.show(),this.optionsToolbar.setAnchorScene(s))},showAnnotationSettings:(i,s,n="line")=>{const o=this.annotationData.at(i);if(!hb(o)&&!Wr(o)&&!yf(o)||Wl(o))return;const a=c=>(h,d,u,p)=>{this.setColorAndDefault(o.type,c,h,d,u,p),this.optionsToolbar.updateColorPickerColor(c,d,u,p)},r=c=>()=>{this.recordActionAfterNextUpdate(`Change ${o.type} ${c} to ${o.getDefaultColor(c)}`,["annotations","defaults"]),this.update()},l={initialSelectedTab:n,ariaLabel:this.ctx.localeManager.t("ariaLabelAnnotationSettingsDialog"),sourceEvent:s,onChangeLine:c=>{this.state.transition("lineProps",c),c.bands!=null&&this.defaults.setDefaultFibonacciOptions(o.type,"bands",c.bands),c.reverse!=null&&this.defaults.setDefaultFibonacciOptions(o.type,"reverse",c.reverse),c.showFill!=null&&this.defaults.setDefaultFibonacciOptions(o.type,"showFill",c.showFill)},onChangeText:c=>{this.state.transition("lineText",c),c.alignment&&this.defaults.setDefaultLineTextAlignment(o.type,c.alignment),c.position&&this.defaults.setDefaultLineTextPosition(o.type,c.position),this.recordActionAfterNextUpdate(`Change ${o.type} text ${Object.keys(c).map(h=>`${h} to ${c[h]}`).join(", ")}`)},onChangeFillColor:a("fill-color"),onChangeHideFillColor:r("fill-color"),onChangeLineColor:a("line-color"),onChangeHideLineColor:r("line-color"),onChangeLineStyleType:c=>{this.setLineStyleTypeAndDefault(o.type,c),this.optionsToolbar.updateLineStyleType(mf.find(h=>h.value===c)??mf[0])},onChangeLineStyleWidth:c=>{this.setLineStyleWidthAndDefault(o.type,c),this.optionsToolbar.updateStrokeWidth({strokeWidth:c,value:c,label:String(c)})},onChangeTextColor:a("text-color"),onChangeHideTextColor:r("text-color"),onChangeTextFontSize:c=>{this.setFontSizeAndDefault(o.type,c)}};this.settingsDialog.show(o,l)}})}setupListeners(){const{ctx:t,optionsToolbar:i,settingsDialog:s,toolbar:n}=this,{seriesWidget:o,seriesDragInterpreter:a,chartWidget:r}=t.widgets;a&&this.cleanup.register(a.events.on("click",this.hoverTouchPreHandler.bind(this)),a.events.on("drag-start",this.hoverTouchPreHandler.bind(this)),a.events.on("drag-move",this.dragMoveTouchPreHandler.bind(this)),a.events.on("mousemove",this.onHover.bind(this)),a.events.on("click",this.onClick.bind(this)),a.events.on("dblclick",this.onDoubleClick.bind(this)),a.events.on("drag-start",this.onDragStart.bind(this)),a.events.on("drag-move",this.onDrag.bind(this)),a.events.on("drag-end",this.onDragEnd.bind(this))),this.cleanup.register(o.addListener("keydown",this.onKeyDown.bind(this)),o.addListener("keyup",this.onKeyUp.bind(this)),r.addListener("click",this.onCancel.bind(this)),t.eventsHub.on("annotations:restore",this.onRestoreAnnotations.bind(this)),t.eventsHub.on("layout:complete",this.onLayoutComplete.bind(this)),t.updateService.addListener("pre-scene-render",this.onPreRender.bind(this)),t.eventsHub.on("zoom:change",()=>this.onResize()),t.eventsHub.on("dom:resize",()=>this.onResize()),n.events.on("cancel-create-annotation",()=>{this.cancel(),this.reset(),this.update()}),n.events.on("pressed-create-annotation",({annotation:l})=>{this.cancel(),this.pushAnnotationState(Dn.Annotations),this.state.transition(l),this.update()}),n.events.on("pressed-clear",()=>{this.clear(),this.recordActionAfterNextUpdate("Clear all")}),n.events.on("pressed-show-menu",()=>{this.cancel(),this.reset()}),n.events.on("pressed-unrelated",()=>{this.reset()}),i.events.on("pressed-delete",()=>{this.cancel(),this.delete(),this.reset()}),i.events.on("pressed-settings",({sourceEvent:l})=>{this.state.transition("toolbarPressSettings",l)}),i.events.on("pressed-lock",({locked:l})=>{this.recordActionAfterNextUpdate(l?"Locked":"Unlocked"),this.update()}),i.events.on("hid-overlays",()=>{this.settingsDialog.hide()}),i.events.on("saved-color",({type:l,colorPickerType:c,color:h})=>{this.recordActionAfterNextUpdate(`Change ${l} ${c} to ${h}`,["annotations","defaults"])}),i.events.on("updated-color",({type:l,colorPickerType:c,colorOpacity:h,color:d,opacity:u,isMultiColor:p})=>{this.setColorAndDefault(l,c,h,d,u,p)}),i.events.on("updated-font-size",({type:l,fontSize:c})=>{this.setFontSizeAndDefault(l,c)}),i.events.on("updated-line-style",({type:l,lineStyleType:c})=>{this.setLineStyleTypeAndDefault(l,c)}),i.events.on("updated-line-width",({type:l,strokeWidth:c})=>{this.setLineStyleWidthAndDefault(l,c)}),s.events.on("hidden",()=>{this.optionsToolbar.clearActiveButton()}))}setupDOM(){const{ctx:t,toolbar:i,optionsToolbar:s}=this;this.cleanup.register(t.annotationManager.attachNode(this.container),()=>{t.domManager.removeStyles(Mf),i.destroy(),s.destroy()})}async processData(t){if(!this.enabled||this.data==null||this.xKey==null||this.volumeKey==null)return;const i=[Y9(this.xKey,void 0,{id:"date"}),Z9(this.volumeKey,"number",{id:"volume"})],s=k.DataSet.wrap(this.data)??k.DataSet.empty(),{dataModel:n,processedData:o}=await t.request("annotations",s,{props:i});this.dataModel=n,this.processedData=o}createAnnotationScene(t){if(t.type in Wn)return new Wn[t.type].scene;throw new Error(`AG Charts - Cannot create annotation scene of type [${t.type}], expected one of [${Object.keys(Wn)}], ignoring.`)}static createAnnotationDatum(t){if(t.type in Wn)return new Wn[t.type].datum().set(t);throw new Error(`AG Charts - Cannot create annotation datum of unknown type [${t.type}], expected one of [${Object.keys(Wn)}], ignoring.`)}createAnnotation(t,i,s=!0){if(this.annotationData.push(i),s){const n=this.ctx.annotationManager.getAnnotationTypeStyles(t);n&&i.set(n),this.defaults.applyDefaults(i)}this.injectDatumDependencies(i),this.update()}injectDatumDependencies(t){"setLocaleManager"in t&&t.setLocaleManager(this.ctx.localeManager),"getVolume"in t&&(t.getVolume=this.getDatumRangeVolume.bind(this))}getDatumRangeVolume(t,i){const{dataModel:s,processedData:n}=this;let o=Ri(t),a=Ri(i);if(!id(o)||!id(a)||!s||!n||this.volumeKey==null)return;o>a&&([o,a]=[a,o]);const r=s.resolveKeysById({id:"annotations"},"date",n),l=s.resolveColumnById({id:"annotations"},"volume",n);let c=0;for(let h=0;h=o&&d<=a&&(c+=l[h])}return c}translateNode(t,i,s){const n=this.getAnnotationConfig(i),o=this.getAnnotationContext();o&&n.translate(t,i,s,o)}createAnnotationDatumCopy(t,i){const s=this.getAnnotationConfig(i),n=new s.datum;n.set(i.toJson());const o=this.getAnnotationContext();if(o)return s.copy(t,i,n,o)}getAnnotationConfig(t){if(t.type in Wn)return Wn[t.type];throw new Error(`AG Charts - Cannot get annotation config of unknown type [${t.type}], expected one of [${Object.keys(Wn)}], ignoring.`)}onRestoreAnnotations(t){this.enabled&&(this.clear(),this.annotationData.set(t.annotations),this.postUpdateFns.push(()=>{this.ctx.annotationManager.fireChangedEvent()}),this.update())}onLayoutComplete(t){const i=t.series.paddedRect;this.seriesRect=i,this.container.setClipRect(i);for(const s of t.axes??[])s.direction===k.ChartAxisDirection.X?this.xAxis=this.getAxis(s,i,this.xAxis?.button):this.yAxis=this.getAxis(s,i,this.yAxis?.button);this.showAnnotations()?this.animateAnnotations({from:0,to:1,phase:"trailing"}):this.animateAnnotations({from:1,to:0,phase:"remove"})}showAnnotations(){if(!this.yAxis||!this.xAxis)return!1;const t=this.ctx.chartService.series.some(n=>n.hasData),s=this.yAxis.context.seriesIds().some(n=>this.ctx.chartService.series.find(a=>a.id===n)?.visible);return t&&s}animateAnnotations({from:t,to:i,phase:s}){const{annotations:n}=this;this.ctx.animationManager?.animate({from:t,to:i,id:"chart-annotations",phase:s,groupId:"opacity",onUpdate(o){n.each(a=>{a.opacity=o,"setAxisLabelOpacity"in a&&a.setAxisLabelOpacity(o)})},onStop(){n.each(o=>{o.opacity=i,"setAxisLabelOpacity"in o&&o.setAxisLabelOpacity(i)})}})}onPreRender(){this.updateAnnotations(),this.state.transition("render")}getAxis(t,i,s){const n=this.ctx.axisManager.getAxisContext(t.direction)[0],{position:o="bottom",direction:a}=n,r=t.gridPadding+t.seriesAreaPadding,l=new q9(0,0,i.width,i.height).grow(r,o),c=a===K9.X?"vertical":"horizontal",{axesButtons:h,snap:d}=this;if(this.enabled&&h.enabled&&(h.axes==="xy"||h.axes===a)){s??(s=new bR(this.ctx,{...n,snapToGroup:d},g=>this.onAxisButtonClick(g,c),i));const p=OI(t);s.update(i,p)}else s?.destroy(),s=void 0;return{layout:t,context:n,bounds:l,button:s}}recordActionAfterNextUpdate(t,i=["annotations"]){const{defaults:s,ctx:{annotationManager:n,historyManager:o}}=this,a=i.map(r=>r==="defaults"?s:n);this.postUpdateFns.push(()=>{o.record(t,...a),n.fireChangedEvent()})}setColorAndDefault(t,i,s,n,o,a){this.state.transition("color",{colorPickerType:i,colorOpacity:s,color:n,opacity:o,isMultiColor:a}),this.defaults.setDefaultColor(t,i,s,n,o,a)}setFontSizeAndDefault(t,i){this.state.transition("fontSize",i),this.defaults.setDefaultFontSize(t,i),this.recordActionAfterNextUpdate(`Change ${t} font size to ${i}`,["annotations","defaults"])}setLineStyleTypeAndDefault(t,i){this.state.transition("lineStyle",{type:i}),this.defaults.setDefaultLineStyleType(t,i),this.recordActionAfterNextUpdate(`Change ${t} line style to ${i}`,["annotations","defaults"])}setLineStyleWidthAndDefault(t,i){this.state.transition("lineStyle",{strokeWidth:i}),this.defaults.setDefaultLineStyleWidth(t,i),this.recordActionAfterNextUpdate(`Change ${t} stroke width to ${i}`,["annotations","defaults"])}updateAnnotations(){const{annotationData:t,annotations:i,seriesRect:s,ctx:{annotationManager:n}}=this,o=this.getAnnotationContext();if(!s||!o)return;n.updateData(t.toJson());const a=this.showAnnotations();this.toolbar.refreshButtonsEnabled(a),this.toolbar.toggleClearButtonEnabled(t.length>0&&a),i.update(t??[],void 0,r=>r.id).each((r,l)=>{if(!a){r.visible=!1,"setAxisLabelVisible"in r&&r.setAxisLabelVisible(!1);return}"setAxisLabelVisible"in r&&r.setAxisLabelVisible(!0),this.injectDatumDependencies(l),W9(r,l,o)});for(const r of this.postUpdateFns)r();this.postUpdateFns=[]}getAnnotationContext(){const{seriesRect:t,xAxis:i,yAxis:s,snap:n}=this;if(t&&i&&s)return{seriesRect:t,xAxis:{...i.context,bounds:i.bounds,labelPadding:OI(i.layout),snapToGroup:n},yAxis:{...s.context,bounds:s.bounds,labelPadding:OI(i.layout),snapToGroup:n}}}onHover(t){const{state:i}=this,s=this.getAnnotationContext();if(!s)return;const n=t.sourceEvent.shiftKey,o=wh.from(t),a=ln(o,s);i.transition("hover",{offset:o,point:a,shiftKey:n,context:s})}onClick(t){const{state:i}=this,s=this.getAnnotationContext();if(!s)return;const n=t.sourceEvent.shiftKey,o=ln(wh.from(t),s),a=this.textInput.getValue(),r=this.textInput.getBBox();i.transition("click",{point:o,shiftKey:n,textInputValue:a,bbox:r})}onDoubleClick(t){const{state:i}=this;if(!this.getAnnotationContext())return;const n=wh.from(t);i.transition("dblclick",{offset:n})}onAxisButtonClick(t,i){this.cancel(),this.reset();const s=this.getAnnotationContext();if(!this.annotationData||!s)return;const{state:n}=this;this.pushAnnotationState(Dn.Annotations);const o=i==="horizontal";if(n.transition(o?"horizontal-line":"vertical-line"),this.optionsToolbar.hide(),!t)return;const a=ln(t,s);Db(s,a)&&(n.transition("click",{point:a,shiftKey:!1}),this.update())}onResize(){const t=this.textInput.getValue(),i=this.textInput.getBBox();this.state.transition("resize",{textInputValue:t,bbox:i})}hoverTouchPreHandler(t){t.device==="touch"&&this.onHover(t)}dragMoveTouchPreHandler(t){t.device==="touch"&&this.ctx.interactionManager.isState(Dn.AnnotationsSelected)&&t.sourceEvent.preventDefault()}onDragStart(t){if(!this.ctx.interactionManager.isState(Dn.AnnotationsDraggable))return;const i=this.getAnnotationContext();if(!i)return;const s=wh.from(t),n=ln(s,i),o=this.textInput.getValue(),a=this.textInput.getBBox();this.state.transition("dragStart",{context:i,offset:s,point:n,textInputValue:o,bbox:a})}onDrag(t){if(!this.ctx.interactionManager.isState(Dn.AnnotationsDraggable))return;const i=this.getAnnotationContext();if(!i)return;const s=wh.from(t),n=ln(s,i),o=t.sourceEvent.shiftKey,a=this.textInput.getValue(),r=this.textInput.getBBox();this.state.transition("drag",{context:i,offset:s,point:n,shiftKey:o,textInputValue:a,bbox:r})}onDragEnd(){this.state.transition("dragEnd")}onCancel(t){const{sourceEvent:i}=t??{};i?.currentTarget===i?.target&&(this.cancel(),this.reset())}onDelete(){this.textInput.isVisible()||(this.cancel(),this.delete(),this.reset(),this.update())}onTextInput(t){const{state:i}=this,s=this.getAnnotationContext();if(!s)return;const{key:n,shiftKey:o}=t,a=this.textInput.getValue(),r=this.textInput.getBBox();i.transition("textInput",{key:n,shiftKey:o,textInputValue:a,bbox:r,context:s})}onKeyDown(t){const{state:i}=this,s=this.getAnnotationContext();if(!s)return;const{sourceEvent:n}=t,{shiftKey:o,ctrlKey:a,metaKey:r}=n,l=a||r,c=a||o;i.transition("keyDown",{shiftKey:o,context:s});const h={x:0,y:0},d=Math.max(s?.xAxis.scale.bandwidth??0,c?10:1),u=Math.max(s?.yAxis.scale.bandwidth??0,c?10:1);switch(n.key){case"ArrowDown":h.y=u;break;case"ArrowUp":h.y=-u;break;case"ArrowLeft":h.x=-d;break;case"ArrowRight":h.x=d;break;case"Escape":this.onCancel();return;case"Backspace":case"Delete":this.onDelete();return}if((h.x||h.y)&&(i.transition("translate",{translation:h}),n.stopPropagation(),n.preventDefault()),!!l)switch(n.key){case"c":i.transition("copy");return;case"x":i.transition("cut"),this.recordActionAfterNextUpdate("Cut annotation");return;case"v":i.transition("paste"),this.recordActionAfterNextUpdate("Paste annotation");return}}onKeyUp(t){const{shiftKey:i}=t.sourceEvent,s=this.getAnnotationContext();s&&(this.state.transition("keyUp",{shiftKey:i,context:s}),this.state.transition("translateEnd"))}clear(){this.cancel(),this.deleteAll(),this.reset()}reset(){this.state.transition("reset")}cancel(){this.state.transition("cancel")}delete(){this.state.transition("delete")}deleteAll(){this.state.transition("deleteAll")}deleteEphemeralAnnotations(){let t=!1;for(const[i,s]of this.annotationData.entries())Wl(s)&&(this.annotationData.splice(i,1),t=!0);t&&this.recordActionAfterNextUpdate("Delete ephemeral annotations")}hideOverlays(){this.settingsDialog.hide(),this.toolbar.hideOverlays(),this.optionsToolbar.hideOverlays()}pushAnnotationState(t){this.ctx.interactionManager.pushState(t),this.ctx.tooltipManager.suppressTooltip("annotations")}popAnnotationState(t){this.ctx.interactionManager.popState(t),this.ctx.tooltipManager.unsuppressTooltip("annotations")}isAnnotationState(){return this.ctx.interactionManager.isState(Dn.Annotations)||this.ctx.interactionManager.isState(Dn.AnnotationsSelected)}update(t=$9.PRE_SCENE_RENDER){this.ctx.updateService.update(t)}};y([Df],Ru.prototype,"enabled",2),y([Df],Ru.prototype,"toolbar",2),y([Df],Ru.prototype,"optionsToolbar",2),y([Df],Ru.prototype,"axesButtons",2),y([Df],Ru.prototype,"snap",2);var Q9=Ru,{FONT_SIZE_RATIO:EI,ThemeSymbols:ks}=k,No={stroke:{$ref:"foregroundColor"},strokeOpacity:1,strokeWidth:2},Is={fill:ks.DEFAULT_ANNOTATION_HANDLE_FILL,strokeOpacity:1,strokeWidth:2},Nh={color:{$ref:"chartBackgroundColor"},fontSize:{$rem:EI.LARGE},fontFamily:{$ref:"fontFamily"}},DR={...Nh,enabled:!0,fill:{$ref:"foregroundColor"},fontSize:{$ref:"fontSize"}},Fb={...Nh,textAlign:"left"},Oh={...Nh,position:"top",alignment:"center",color:{$ref:"textColor"}},kR={...Nh,position:"top",alignment:"center",color:{$ref:"textColor"}},PI={...Nh,fontSize:{$ref:"fontSize"},color:ks.DEFAULT_ANNOTATION_STATISTICS_COLOR,fill:ks.DEFAULT_ANNOTATION_STATISTICS_FILL,stroke:ks.DEFAULT_ANNOTATION_STATISTICS_STROKE,strokeWidth:1,divider:{stroke:ks.DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE,strokeWidth:1,strokeOpacity:.5}},RI={...No,background:{fill:{$ref:"foregroundColor"},fillOpacity:.075},handle:{...Is},text:{...Oh},statistics:{...PI}},J9={buttons:{$shallowSimple:[{icon:"text-annotation",tooltip:"toolbarAnnotationsTextAnnotations",value:"text-menu"},{icon:"trend-line-drawing",tooltip:"toolbarAnnotationsLineAnnotations",value:"line-menu"},{icon:"arrow-drawing",tooltip:"toolbarAnnotationsShapeAnnotations",value:"shape-menu"},{icon:"delete",tooltip:"toolbarAnnotationsClearAll",value:"clear"}]},padding:{$ref:"chartPadding"}},e8={buttons:{$shallowSimple:[{icon:"text-annotation",tooltip:"toolbarAnnotationsTextColor",value:"text-color"},{icon:"line-color",tooltip:"toolbarAnnotationsLineColor",value:"line-color"},{icon:"fill-color",tooltip:"toolbarAnnotationsFillColor",value:"fill-color"},{tooltip:"toolbarAnnotationsTextSize",value:"text-size"},{tooltip:"toolbarAnnotationsLineStrokeWidth",value:"line-stroke-width"},{icon:"line-style-solid",tooltip:"toolbarAnnotationsLineStyle",value:"line-style-type"},{icon:"settings",tooltip:"toolbarAnnotationsSettings",value:"settings"},{icon:"unlocked",tooltip:"toolbarAnnotationsLock",ariaLabel:"toolbarAnnotationsLock",checkedOverrides:{icon:"locked",tooltip:"toolbarAnnotationsUnlock"},value:"lock"},{icon:"delete",tooltip:"toolbarAnnotationsDelete",value:"delete"}]}},t8={enabled:!1,line:{...No,handle:{...Is},text:{...Oh}},"horizontal-line":{...No,handle:{...Is},axisLabel:{...DR},text:{...Oh}},"vertical-line":{...No,handle:{...Is},axisLabel:{...DR},text:{...Oh}},"disjoint-channel":{...No,background:{fill:{$ref:"foregroundColor"},fillOpacity:.075},handle:{...Is},text:{...kR}},"parallel-channel":{...No,middle:{lineDash:[6,5],strokeWidth:1},background:{fill:{$ref:"foregroundColor"},fillOpacity:.075},handle:{...Is},text:{...kR}},"fibonacci-retracement":{...No,strokes:ks.DEFAULT_FIBONACCI_STROKES,rangeStroke:{$ref:"foregroundColor"},handle:{...Is},text:{...Oh,position:"center"},label:{...Nh,color:void 0,fontSize:{$rem:EI.SMALLER}}},"fibonacci-retracement-trend-based":{...No,strokes:ks.DEFAULT_FIBONACCI_STROKES,rangeStroke:{$ref:"foregroundColor"},handle:{...Is},text:{...Oh,position:"center"},label:{...Nh,color:void 0,fontSize:{$rem:EI.SMALLER}}},callout:{...No,...Fb,color:{$ref:"textColor"},handle:{...Is},fill:{$ref:"foregroundColor"},fillOpacity:.075},comment:{...Fb,fontWeight:700,handle:{...Is},fill:{$ref:"foregroundColor"}},note:{...Fb,color:ks.DEFAULT_TEXTBOX_COLOR,fill:ks.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR,stroke:{$ref:"chartBackgroundColor"},strokeWidth:1,strokeOpacity:1,handle:{...Is},background:{fill:ks.DEFAULT_TEXTBOX_FILL,stroke:ks.DEFAULT_TEXTBOX_STROKE,strokeWidth:1}},text:{...Fb,color:{$ref:"textColor"},handle:{...Is}},arrow:{...No,handle:{...Is},text:{...Oh}},"arrow-up":{fill:{$palette:"up.fill"},handle:{...Is,stroke:{$ref:"foregroundColor"}}},"arrow-down":{fill:{$palette:"down.fill"},handle:{...Is,stroke:{$ref:"foregroundColor"}}},"date-range":{...RI},"price-range":{...RI},"date-price-range":{...RI},"quick-date-price-range":{up:{...No,fill:ks.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,fillOpacity:.2,handle:{...Is},statistics:{...PI,color:"#fff",fill:ks.DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,strokeWidth:0,divider:{stroke:"#fff",strokeWidth:1,strokeOpacity:.5}}},down:{...No,stroke:ks.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE,fill:ks.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL,fillOpacity:.2,handle:{...Is,stroke:ks.DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE},statistics:{...PI,color:"#fff",fill:ks.DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL,strokeWidth:0,divider:{stroke:"#fff",strokeWidth:1,strokeOpacity:.5}}}},axesButtons:{},toolbar:J9,optionsToolbar:e8},i8={type:"root",optionsKey:"annotations",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new Q9(e),themeTemplate:{annotations:t8}},{BaseProperties:s8,ObserveChanges:n8,ProxyProperty:o8,Property:Eh,calculatePlacement:a8}=k,qa=class extends s8{constructor(){super(),this.opacity=1,this.loadedSynchronously=!0,this.containerWidth=0,this.containerHeight=0,this.onLoad=void 0,this.onImageLoad=()=>{this.loadedSynchronously||(this.node.visible=!1,this.performLayout(this.containerWidth,this.containerHeight),this.onLoad?.())},this.imageElement=De("img"),this.imageElement.onload=this.onImageLoad,this.node=new k.Image(this.imageElement)}get complete(){return this.imageElement.width>0&&this.imageElement.height>0}performLayout(e,t){this.containerWidth=e,this.containerHeight=t;const i={width:e,height:t},s=a8(this.imageElement.width,this.imageElement.height,i,this);return this.node.setProperties(this.complete?{visible:!0,opacity:this.opacity,...s}:{visible:!1}),s}};y([Eh],qa.prototype,"top",2),y([Eh],qa.prototype,"right",2),y([Eh],qa.prototype,"bottom",2),y([Eh],qa.prototype,"left",2),y([Eh],qa.prototype,"width",2),y([Eh],qa.prototype,"height",2),y([Eh],qa.prototype,"opacity",2),y([o8("imageElement.src"),n8(e=>e.loadedSynchronously=e.complete)],qa.prototype,"url",2);var{ActionOnSet:r8,Property:l8}=k,IR=class extends k.Background{constructor(){super(...arguments),this.image=new qa}onLayoutComplete(e){if(super.onLayoutComplete(e),this.image){const{width:t,height:i}=e.chart;this.image.performLayout(t,i)}}onImageLoad(){this.ctx.updateService.update(k.ChartUpdateType.SCENE_RENDER)}};y([l8,r8({newValue(e){this.node.appendChild(e.node),e.onLoad=()=>this.onImageLoad()},oldValue(e){e.node.remove(),e.onLoad=void 0}})],IR.prototype,"image",2);var c8={type:"root",optionsKey:"background",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new IR(e)},{Range:h8,TranslatableGroup:d8,BBox:u8,Property:ua,ZIndexMap:p8,ChartAxisDirection:g8,FillGradientDefaults:f8,FillImageDefaults:y8,FillPatternDefaults:m8,getShapeFill:x8,InteractionState:Bb}=k,Oo=class extends k.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.id=hs(this),this.enabled=!1,this.stroke="rgb(195, 195, 195)",this.lineDash=[6,3],this.lineDashOffset=0,this.strokeWidth=1,this.strokeOpacity=1,this.fill="#c16068",this.fillOpacity=1,this.fillGradientDefaults=new f8,this.fillPatternDefaults=new m8,this.fillImageDefaults=new y8,this.bounds=new u8(0,0,0,0),this.bandHighlightGroup=new d8({name:"bandHighlight",zIndex:p8.AXIS_BAND_HIGHLIGHT}),this.rangeNode=this.bandHighlightGroup.appendChild(new h8),this.activeAxisHighlight=void 0,this.axisCtx=e.parent,this.hideBand(),e.domManager.addEventListener("focusin",({target:o})=>{const a=o instanceof HTMLElement&&e.domManager.contains(o,"series-area");this.bandHighlightGroup.visible&&!a&&(this.hideBand(),this.ctx.updateService.update(k.ChartUpdateType.PERFORM_LAYOUT))});const{widgets:{seriesWidget:t,seriesDragInterpreter:i},animationManager:s,eventsHub:n}=e;this.cleanup.register(e.scene.attachNode(this.bandHighlightGroup),t.addListener("mousemove",o=>this.onHoverLikeEvent(o)),t.addListener("mouseleave",()=>this.clearAllHighlight()),s.addListener("animation-start",()=>this.clearAllHighlight()),n.on("layout:complete",o=>this.layout(o)),n.on("series:focus-change",()=>this.onKeyPress()),n.on("zoom:pan-start",()=>this.clearAllHighlight()),n.on("zoom:change",()=>this.clearAllHighlight()),n.on("dom:resize",()=>this.clearAllHighlight()),n.on("axis:change",()=>this.axisChange())),i&&this.cleanup.register(i.events.on("drag-move",o=>this.onHoverLikeEvent(o)),i.events.on("click",o=>this.onClick(o)))}axisChange(){this.onHighlightChange()}isHover(e){return e.type==="mousemove"||e.type==="click"||e.device==="touch"&&this.ctx.chartService.touch.dragAction==="hover"}onClick(e){e.device==="touch"&&this.onHoverLikeEvent(e)}clearAllHighlight(){this.ctx.interactionManager.isState(Bb.Clickable)&&this.onHighlightChange()}onKeyPress(){this.ctx.interactionManager.isState(Bb.Default)&&this.onHighlightChange()}onHoverLikeEvent(e){const t=this.isHover(e)?Bb.Clickable:Bb.AnnotationsMoveable;this.ctx.interactionManager.isState(t)&&this.handleHoverHighlight(e)}handleHoverHighlight(e){if(!e)return;const{currentX:t,currentY:i}=e;this.onHighlightChange(this.axisCtx.pickBand({x:t,y:i}))}layout({series:{rect:e,visible:t},axes:i}){if(!t||!i||!this.enabled)return;const{position:s="left",axisId:n}=this.axisCtx,o=i.find(l=>l.id===n);if(!o)return;this.axisLayout=o,this.bounds=e.clone().grow(o.gridPadding,s);const{bandHighlightGroup:a,bounds:r}=this;a.translationX=Math.round(r.x),a.translationY=Math.round(r.y),this.updateBand()}updateBand(){const{rangeNode:e,stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:n,fill:o,fillOpacity:a,fillGradientDefaults:r,fillPatternDefaults:l,fillImageDefaults:c,lineDashOffset:h,axisLayout:d}=this;d&&(e.stroke=t,e.strokeWidth=i,e.strokeOpacity=s,e.lineDash=n,e.lineDashOffset=h,e.fill=x8(o,r,l,c),e.fillOpacity=a,e.startLine=!0,e.endLine=!0)}isVertical(){return this.axisCtx.direction===g8.X}onHighlightChange(e){this.enabled&&(this.activeAxisHighlight=e,this.activeAxisHighlight?this.showBand():this.hideBand(),this.ctx.updateService.update(k.ChartUpdateType.SCENE_RENDER))}updateBandPosition(){const{rangeNode:e,bounds:t}=this,{band:i}=this.activeAxisHighlight??{};if(i==null){this.hideBand();return}let s=Math.min(...i),n=Math.max(...i);if(n-s<1){const o=(s+n)/2;s=o-.5,n=o+.5}this.isVertical()?(e.y1=0,e.y2=t.height,e.x1=s,e.x2=n,e.horizontal=!0):(e.y1=s,e.y2=n,e.x1=0,e.x2=t.width,e.horizontal=!1)}showBand(){this.updateBandPosition(),this.bandHighlightGroup.visible=!0}hideBand(){this.bandHighlightGroup.visible=!1}};y([ua],Oo.prototype,"enabled",2),y([ua],Oo.prototype,"stroke",2),y([ua],Oo.prototype,"lineDash",2),y([ua],Oo.prototype,"lineDashOffset",2),y([ua],Oo.prototype,"strokeWidth",2),y([ua],Oo.prototype,"strokeOpacity",2),y([ua],Oo.prototype,"fill",2),y([ua],Oo.prototype,"fillOpacity",2),y([ua],Oo.prototype,"fillGradientDefaults",2),y([ua],Oo.prototype,"fillPatternDefaults",2),y([ua],Oo.prototype,"fillImageDefaults",2);var b8={type:"axis-option",optionsKey:"bandHighlight",packageType:"enterprise",chartTypes:["cartesian"],axisTypes:["category","ordinal-time","unit-time","grouped-category"],moduleFactory:e=>new Oo(e),themeTemplate:{bandHighlight:{enabled:!1,strokeWidth:0,lineDash:[],fill:{$foregroundBackgroundMix:.05}}}},{ActionOnSet:v8,LayoutElement:S8,Menu:M8,Property:D8}=k,zI=[{label:"toolbarSeriesTypeOHLC",icon:"ohlc-series",value:"ohlc"},{label:"toolbarSeriesTypeCandles",icon:"candlestick-series",value:"candlestick"},{label:"toolbarSeriesTypeHollowCandles",icon:"hollow-candlestick-series",value:"hollow-candlestick"},{label:"toolbarSeriesTypeLine",icon:"line-series",value:"line"},{label:"toolbarSeriesTypeStepLine",icon:"step-line-series",value:"step-line"},{label:"toolbarSeriesTypeHLC",icon:"hlc-series",value:"hlc"},{label:"toolbarSeriesTypeHighLow",icon:"high-low-series",value:"high-low"}],AR=class extends k.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!1,this.menu=new M8(this.ctx,"chart-toolbar"),this.toolbar=e.sharedToolbar.getSharedToolbar("chartToolbar"),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onButtonPressed.bind(this)),e.layoutManager.registerElement(S8.ToolbarLeft,this.onLayoutStart.bind(this)),()=>this.toolbar.destroy())}onLayoutStart(e){this.enabled&&(this.updateButton(),this.toolbar.layout(e.layoutBox))}onButtonPressed({event:e,buttonBounds:t,buttonWidget:i}){this.menu.setAnchor({x:t.x+t.width+6,y:t.y}),this.menu.show(i,{items:zI,menuItemRole:"menuitemradio",ariaLabel:this.ctx.localeManager.t("toolbarSeriesTypeDropdown"),class:"ag-charts-chart-toolbar__menu",value:this.getChartType(),sourceEvent:e.sourceEvent,onPress:s=>{this.setChartType(s.value),this.hidePopover()},onHide:()=>{this.toolbar.clearActiveButton()}}),this.toolbar.toggleActiveButtonByIndex(0)}updateButton(){const e=this.getChartType(),t=zI.find(i=>i.value===e)?.icon;t!=null&&this.toolbar.updateButtons([{icon:t,tooltip:"toolbarSeriesTypeDropdown",value:"menu"}])}hidePopover(){this.toolbar.clearActiveButton(),this.menu.hide()}setChartType(e){const t={chartType:e};this.ctx.chartService.publicApi?.updateDelta(t).catch(i=>K.error(i))}getChartType(){const e=this.ctx.chartService.publicApi?.getOptions()?.chartType;return e==null||!zI.some(t=>t.value===e)?"candlestick":e}};y([D8,v8({changeValue(e){this.toolbar?.setHidden(!e)}})],AR.prototype,"enabled",2);var k8={type:"root",optionsKey:"chartToolbar",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new AR(e)};function I8(e,t){return e==="always"?!0:e==="series-area"?t==="series-area"||t==="series-node":e===t}function CR(e,t,i){let s=!0;if(t.type==="separator"){const n=i.at(-1);s=n!==void 0&&n.type!=="separator"}if(s&&(s=I8(t.showOn??"always",e)),s){const n=new C8(t);return i.push(n),n}}function LR(e,t,i,s){t.isVisible(i)&&CR(e,t.builtins.items[i],s)}function A8(e,t,i,s){const{builtins:n}=t;if(xG(i,n.lists))for(const o of n.lists[i])LR(e,t,o,s);else LR(e,t,i,s)}function TR(e,t,i,s){for(const n of i)if(typeof n=="string")A8(e,t,n,s);else{const o=CR(e,n,s);n.items&&o&&n.items.length>0&&TR(e,t,n.items,o.items)}s.at(-1)?.type==="separator"&&s.pop()}var C8=class{constructor(e){this.type="action",this.showOn="always",this.label="",this.iconUrl=void 0,this.enabled=!0,this.items=[],this.action=void 0,e&&this.setOptions(e),this.items=[]}setField(e,t,i){t[e]=i}setOptions(e){let t;for(t in e)e[t]!==void 0&&this.setField(t,this,e[t])}},Kr="ag-charts-context-menu",{Property:FI,ContextMenuRegistry:kf,callWithContext:_b,getIconClassNames:L8}=k,BI="context-menu",Vb=class extends k.BaseModuleInstance{constructor(e){if(super(),this.ctx=e,this.enabled=!0,this.darkTheme=!1,this.items=["defaults"],this.pickedNode=void 0,this.showEvent=void 0,this.x=0,this.y=0,this.collapsingSubMenus=0,this.menuWidget=new lf.MenuWidget,this.interactionManager=e.interactionManager,this.element=e.domManager.addChild("canvas-overlay",BI),this.element.classList.add(Kr),this.element.style.display="none",this.element.addEventListener("contextmenu",t=>t.preventDefault()),this.element.addEventListener("focusout",({relatedTarget:t})=>{this.collapsingSubMenus>0||(t==null||t instanceof Node&&!this.element.contains(t))&&this.hide()}),this.cleanup.register(()=>this.element.remove(),()=>this.menuWidget.destroy(),e.eventsHub.on("dom:hidden",()=>this.hide()),this.menuWidget.addListener("collapse-widget",()=>this.onCollapse())),this.menuWidget.addClass(`${Kr}__menu`),typeof MutationObserver<"u"){const t=new MutationObserver(()=>{this.element.contains(this.menuWidget.getElement())&&this.reposition()});t.observe(this.element,{childList:!0}),this.mutationObserver=t,this.cleanup.register(()=>t.disconnect())}this.ctx.contextMenuRegistry.builtins.items.download.action=()=>{const t=e.chartService.title;let i="image";t?.enabled&&(i=t.node.getPlainText().replace(/\.+/,"")),this.ctx.chartService.publicApi?.download({fileName:i}).catch(s=>{K.error("Unable to download chart",s)})},this.cleanup.register(this.ctx.eventsHub.on("context-menu:complete",t=>this.onContext(t)))}expandItemsOptions(e){const t=[];return TR(e,this.ctx.contextMenuRegistry,this.items,t),t}onContext(e){if(!this.enabled)return;e.widgetEvent.sourceEvent.preventDefault(),this.showEvent=e.widgetEvent.sourceEvent,this.x=e.x,this.y=e.y,this.pickedNode=void 0,this.pickedLegendItem=void 0,kf.check("series-node",e)?this.pickedNode=e.context.pickedNode:kf.check("legend-item",e)&&(this.pickedLegendItem=e.context.legendItem);const t=this.expandItemsOptions(e.showOn);t.length!==0&&this.show(e.widgetEvent,t)}show(e,t){const{sourceEvent:i}=e;this.interactionManager.pushState(k.InteractionState.ContextMenu),this.element.style.display="block";const s=i.pointerType==="touch"?!1:void 0;s!==void 0&&this.ctx.chartService.overrideFocusVisible(s),this.createMenu(t),this.element.appendChild(this.menuWidget.getElement()),this.menuWidget.expand({sourceEvent:i,overrideFocusVisible:s})}hide(){this.menuWidget.collapse()}onCollapse(){this.interactionManager.popState(k.InteractionState.ContextMenu),this.menuWidget.getElement().remove(),this.element.style.display="none"}onSubMenuExpand(e,t){const i=e.getBounds();e.setFocusOverride(!0),e.getElement().insertAdjacentElement("afterend",t.getElement()),t.getElement().style.position="absolute";const s=this.ctx.domManager.getBoundingClientRect(),n=e.getBoundingClientRect(),o=s.right-n.right,a=n.left-s.left,{offsetWidth:r,offsetHeight:l}=t.getElement();let c=i.y;if(s.height>l){const h=s.bottom-n.top;h=r)t.setBounds({x:i.x+i.width,y:c});else{const h=i.x-r,d=a+h;d>=0?t.setBounds({x:h,y:c}):t.setBounds({x:h-d,y:c})}}onSubMenuCollapse(e,t){e.setFocusOverride(void 0),this.collapsingSubMenus++,t.remove(),this.collapsingSubMenus--}createMenu(e){const{menuWidget:t}=this;t.clear(),t.setTabIndex(-1),this.createMenuItems(t,e)}createMenuItems(e,t){for(const i of t)switch(i.type){case"separator":{e.addSeparator().classList.add(`${Kr}__divider`);break}case"action":{if(i.items.length===0){const s=new lf.MenuItemWidget;this.initButtonElement(s,i),e.addChild(s)}else{const{subMenuButton:s,subMenu:n}=e.addSubMenu();n.addClass(`${Kr}__menu`),n.addListener("expand-widget",()=>this.onSubMenuExpand(s,n)),n.addListener("collapse-widget",()=>this.onSubMenuCollapse(s,n)),this.initButtonElement(s,i),this.createMenuItems(n,i.items)}break}default:throw new Error("unhandled case")}}createButtonOnClick(e,t){return kf.checkCallback("legend-item",e,t)?i=>{const s=i.sourceEvent;if(this.pickedLegendItem){const{seriesId:n,itemId:o,label:a}=this.pickedLegendItem,{chartService:r}=this.ctx;if(typeof o!="string"){K.error(`unexpected itemId type: [${typeof o}] (expected [string])`);return}const c=[r.series.find(d=>d.id===n)?.properties,r],h={type:"contextmenu",seriesId:n,itemId:o,text:$e(a.text),event:s};_b(c,t,h),this.hide()}else K.error("legend item not found")}:kf.checkCallback("series-area",e,t)?()=>{const i=this.ctx.chartService,s={type:"seriesContextMenuAction",event:this.showEvent};_b(i,t,s),this.hide()}:kf.checkCallback("series-node",e,t)?()=>{const{showEvent:i}=this,{chartService:s}=this.ctx,n=this.pickedNode,o=[n?.series.properties,s],a=n?.series.createNodeContextMenuActionEvent(i,n);a?_b(o,t,a):K.error("series node not found"),this.hide()}:()=>{const i=this.ctx.chartService,s={type:"contextMenuEvent",event:this.showEvent};_b(i,t,s),this.hide()}}initTableCells(e){const t=De("div"),i=De("div"),s=De("div");return t.classList.toggle(`${Kr}__icon`,!0),i.classList.toggle(`${Kr}__cell`,!0),s.classList.toggle(`${Kr}__cell`,!0),t.ariaHidden="true",i.role="presentation",s.ariaHidden="true",e.append(t,i,s),{cellIcon:t,cellLabel:i,cellArrow:s}}initButtonElement(e,t){e.addClass(`${Kr}__item`),e.setEnabled(t.enabled);const i=this.ctx.localeManager.t(t.label),s=`${Kr}__cellpadding`,{cellIcon:n,cellLabel:o,cellArrow:a}=this.initTableCells(e.getElement());if(o.textContent=i,o.classList.add(s),t.iconUrl!=null){const c=De("img");c.src=t.iconUrl,n.append(c),n.classList.add(s)}if(t.items.length>0){const c=De("span",L8("chevron-right"));a.append(c),a.classList.add(s)}const{showOn:r,action:l}=t;l!=null&&e.addListener("click",this.createButtonOnClick(r,l)),t.items.length===0&&(e.addListener("mouseleave",()=>e.setFocusOverride(!1)),e.addListener("mouseenter",()=>e.setFocusOverride(void 0)))}reposition(){let{x:e,y:t}=this;this.element.style.top="unset",this.element.style.bottom="unset";const i=this.ctx.domManager.getBoundingClientRect(),{offsetWidth:s,offsetHeight:n}=this.element;e=ve(0,e,i.width-s),t=ve(0,t,i.height-n),this.element.style.left=`${e}px`,this.element.style.top=`calc(${t}px - 0.5em)`}destroy(){super.destroy(),this.mutationObserver?.disconnect(),this.ctx.domManager.removeStyles(BI),this.ctx.domManager.removeChild("canvas-overlay",BI)}};y([FI],Vb.prototype,"enabled",2),y([FI],Vb.prototype,"darkTheme",2),y([FI],Vb.prototype,"items",2);var T8={type:"root",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],optionsKey:"contextMenu",moduleFactory:e=>new Vb(e),themeTemplate:{contextMenu:{enabled:!0,darkTheme:k.ThemeSymbols.IS_DARK_THEME}}};function If(e){return typeof e?.datum=="object"?e.datum:null}var{FormatManager:w8,BaseProperties:N8,Property:zu}=k,O8="ag-charts-crosshair-label",sc=class extends N8{constructor(){super(...arguments),this.enabled=!0,this.xOffset=0,this.yOffset=0,this.format=void 0,this.renderer=void 0,this._cachedFormatter=void 0}formatValue(e,t,i,s){const{formatter:n,format:o}=this,{domain:a,boundSeries:r}=s;let l;if(n!=null){const c=s.type==="number"?s.fractionDigits:void 0,h=s.type==="date"?s.unit:void 0,d=s.type==="date"?s.step:void 0;l=e(n,{value:i,domain:a,fractionDigits:c,unit:h,step:d,boundSeries:r})}if(o!=null){let c=this._cachedFormatter;(c==null||c.type!==t||c.format!==o)&&(c={type:t,format:o,formatter:w8.getFormatter(t,o)},this._cachedFormatter=c),l??(l=c.formatter?.(i))}return l==null?void 0:String(l)}};y([zu],sc.prototype,"enabled",2),y([zu],sc.prototype,"xOffset",2),y([zu],sc.prototype,"yOffset",2),y([zu],sc.prototype,"formatter",2),y([zu],sc.prototype,"format",2),y([zu],sc.prototype,"renderer",2);var E8=class extends sc{constructor(e,t,i){super(),this.domManager=e,this.id=hs(this),this.element=e.addChild("canvas-overlay",`crosshair-label-${this.id}`),this.element.classList.add(O8),Ge(this.element,"aria-hidden",!0),this.element.dataset.key=t,this.element.dataset.axisId=i}show(e){const{element:t}=this,i=e.x+this.xOffset,s=e.y+this.yOffset;t.style.top=`${Math.round(s)}px`,t.style.left=`${Math.round(i)}px`,this.toggle(!0)}setLabelHtml({html:e,styles:t}){if(e!==void 0&&(this.element.innerHTML=e),t!==void 0){const i=this.element.children[0]??this.element;Object.assign(i.style,t)}}getBBox(){const{element:e}=this;return new k.BBox(e.clientLeft,e.clientTop,e.clientWidth,e.clientHeight)}toggle(e){this.element.classList.toggle("ag-charts-crosshair-label--hidden",!e)}destroy(){this.domManager.removeChild("canvas-overlay",`crosshair-label-${this.id}`)}toLabelHtml(e,t){if(typeof e=="string")return{html:e,styles:{}};t=t??{};const{text:i=t.text??"",color:s=t.color,backgroundColor:n=t.backgroundColor,opacity:o=t.opacity??1}=e,a={opacity:o,"background-color":n?.toLowerCase(),color:s};return{html:`
+ ${i} +
`,styles:a}}},{Group:P8,TranslatableGroup:R8,Line:z8,BBox:wR,InteractionState:Gb,Property:nc,ZIndexMap:NR,ChartAxisDirection:OR}=k,Yr=class extends k.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.id=hs(this),this.enabled=!1,this.stroke="rgb(195, 195, 195)",this.lineDash=[6,3],this.lineDashOffset=0,this.strokeWidth=1,this.strokeOpacity=1,this.snap=!0,this.label=new sc,this.seriesRect=new wR(0,0,0,0),this.bounds=new wR(0,0,0,0),this.crosshairGroup=new R8({name:"crosshairs",zIndex:NR.SERIES_CROSSHAIR}),this.lineGroup=this.crosshairGroup.appendChild(new P8({name:`${this.id}-crosshair-lines`,zIndex:NR.SERIES_CROSSHAIR})),this.lineGroupSelection=k.Selection.select(this.lineGroup,z8,!1),this.activeHighlight=void 0,this.axisCtx=e.parent,this.labels={},this.hideCrosshairs(),e.domManager.addEventListener("focusin",({target:i})=>{const s=i instanceof HTMLElement&&e.domManager.contains(i,"series-area");this.crosshairGroup.visible&&!s&&(this.hideCrosshairs(),this.ctx.updateService.update(k.ChartUpdateType.PERFORM_LAYOUT))});const{seriesDragInterpreter:t}=e.widgets;this.cleanup.register(e.scene.attachNode(this.crosshairGroup),e.widgets.seriesWidget.addListener("mousemove",i=>this.onMouseHoverLike(i)),e.widgets.seriesWidget.addListener("mouseleave",()=>this.onMouseOut()),e.eventsHub.on("series:focus-change",()=>this.onKeyPress()),e.eventsHub.on("zoom:pan-start",()=>this.onMouseOut()),e.eventsHub.on("zoom:change",()=>this.onMouseOut()),e.eventsHub.on("highlight:change",i=>this.onHighlightChange(i)),e.eventsHub.on("layout:complete",i=>this.layout(i)),()=>{for(const i of Object.values(this.labels))i.destroy()}),t&&this.cleanup.register(t.events.on("drag-move",i=>this.onMouseHoverLike(i)),t.events.on("click",i=>this.onClick(i)))}layout({series:{rect:e,visible:t},axes:i}){if(!t||!i||!this.enabled)return;this.seriesRect=e;const{position:s="left",axisId:n}=this.axisCtx,o=i.find(c=>c.id===n);if(!o)return;this.axisLayout=o,this.bounds=e.clone().grow(o.gridPadding+o.seriesAreaPadding,s);const{crosshairGroup:a,bounds:r}=this;a.translationX=Math.round(r.x),a.translationY=Math.round(r.y);const l=["pointer",...this.axisCtx.seriesKeyProperties()];this.updateSelections(l),this.updateLines(),this.updateLabels(l)}updateSelections(e){this.lineGroupSelection.update(e,void 0,t=>t)}updateLabels(e){const{labels:t,ctx:i}=this;for(const s of e)this.label.enabled&&(t[s]??(t[s]=new E8(i.domManager,s,this.axisCtx.axisId))),t[s]&&this.updateLabel(t[s])}updateLabel(e){const{enabled:t,xOffset:i,yOffset:s,format:n,renderer:o}=this.label;e.enabled=t,e.xOffset=i,e.yOffset=s,e.format=n,e.renderer=o}updateLines(){const{lineGroupSelection:e,bounds:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,axisLayout:r}=this;if(!r)return;const l=this.isVertical();e.each(c=>{c.stroke=i,c.strokeWidth=s,c.strokeOpacity=n,c.lineDash=o,c.lineDashOffset=a,c.y1=0,c.y2=l?t.height:0,c.x1=0,c.x2=l?0:t.width})}isVertical(){return this.axisCtx.direction===OR.X}isHover(e){return e.type==="mousemove"||e.type==="click"||e.device==="touch"&&this.ctx.chartService.touch.dragAction==="hover"}formatValue(e){return $e(this.axisCtx.formatScaleValue(e,"crosshair",this.label))}onClick(e){e.device==="touch"&&this.onMouseHoverLike(e)}onMouseHoverLike(e){if(!this.enabled||this.snap)return;const t=this.isHover(e)?Gb.Clickable:Gb.AnnotationsMoveable;this.ctx.interactionManager.isState(t)&&(this.updatePositions(this.getData(e)),this.crosshairGroup.visible=!0,this.ctx.updateService.update(k.ChartUpdateType.SCENE_RENDER))}onMouseOut(){this.ctx.interactionManager.isState(Gb.Clickable)&&(this.hideCrosshairs(),this.ctx.updateService.update(k.ChartUpdateType.SCENE_RENDER))}onKeyPress(){this.enabled&&!this.snap&&this.ctx.interactionManager.isState(Gb.Default)&&this.hideCrosshairs()}onHighlightChange(e){if(!this.enabled)return;const{crosshairGroup:t,axisCtx:i}=this,{datum:s,series:n}=e.currentHighlight??{},o=s&&(n?.axes.x?.id===i.axisId||n?.axes.y?.id===i.axisId);if(this.activeHighlight=o?e.currentHighlight:void 0,!this.activeHighlight)this.hideCrosshairs();else if(this.snap){const a=this.getActiveHighlightData(this.activeHighlight);this.updatePositions(a),t.visible=!0}}isInRange(e){return this.axisCtx.inRange(e)}updatePositions(e){const{seriesRect:t,lineGroupSelection:i}=this;i.each((s,n)=>{const o=e[n];if(!o){s.visible=!1,this.hideLabel(n);return}s.visible=!0;const{value:a,position:r}=o;let l=0,c=0;this.isVertical()?(l=r,s.x=Math.round(l)):(c=r,s.y=Math.round(c)),this.label.enabled?this.showLabel(l+t.x,c+t.y,a,n):this.hideLabel(n)})}getData(e){const{axisCtx:t}=this,i="pointer",{xKey:s="",yKey:n=""}=this.activeHighlight??{},{currentX:o,currentY:a}=e,r=If(this.activeHighlight),l=this.isVertical(),c=l?o:a;let h=r?.[l?s:n]??"";return t.continuous&&(h=t.scaleInvert(c)),{[i]:{position:c,value:h}}}getActiveHighlightData(e){const{axisCtx:t}=this,{series:i,xKey:s="",aggregatedValue:n,cumulativeValue:o,midPoint:a}=e,r=If(e),l=i.getKeyProperties(t.direction),c=(t.scale.bandwidth??0)/2,h=i.axes[t.direction]?.id===t.axisId,d=l.includes("yKey")&&h,u=l.includes("xKey")&&h,p=n??o;if(d&&p!==void 0){const f=t.scale.convert(p)+c;return this.isInRange(f)?{yKey:{value:p,position:f}}:{}}if(u){const f=(this.isVertical()?a?.x:a?.y)??0,x=t.continuous?t.scaleInvert(f):r?.[s];return this.isInRange(f)?{xKey:{value:x,position:f}}:{}}const g={};for(const f of l){const x=i.properties[f],m=r?.[x],v=t.scale.convert(m)+c;this.isInRange(v)&&(g[f]={value:m,position:v})}return g}getLabelHtml(e,t){const i=this.axisLayout?.label?.fractionDigits??0,s={text:this.formatValue(e)};return this.label.renderer?t.toLabelHtml(this.label.renderer({value:e,fractionDigits:i}),s):t.toLabelHtml(s)}showLabel(e,t,i,s){if(!this.axisLayout)return;const{bounds:n}=this,o=this.labels[s],a=this.getLabelHtml(i,o);o.setLabelHtml(a);const{width:r,height:l}=o.getBBox(),c=this.axisCtx.position;let h=this.axisLayout.label.spacing+this.axisLayout.tickSize;this.axisCtx.direction===OR.X?(h-=4,o.show({x:e-r/2,y:c==="bottom"?n.y+n.height+h:n.y-l-h})):(h-=8,o.show({x:c==="right"?n.x+n.width+h:n.x-r-h,y:t-l/2}))}hideCrosshairs(){this.crosshairGroup.visible=!1;for(const e of Object.keys(this.labels))this.hideLabel(e)}hideLabel(e){this.labels[e]?.toggle(!1)}};y([nc],Yr.prototype,"enabled",2),y([nc],Yr.prototype,"stroke",2),y([nc],Yr.prototype,"lineDash",2),y([nc],Yr.prototype,"lineDashOffset",2),y([nc],Yr.prototype,"strokeWidth",2),y([nc],Yr.prototype,"strokeOpacity",2),y([nc],Yr.prototype,"snap",2),y([nc],Yr.prototype,"label",2);var F8={type:"axis-option",optionsKey:"crosshair",packageType:"enterprise",chartTypes:["cartesian"],axisTypes:["category","time","unit-time","ordinal-time","number","log"],moduleFactory:e=>new Yr(e),themeTemplate:{crosshair:{snap:!0,stroke:{$ref:"subtleTextColor"},strokeWidth:1,strokeOpacity:1,lineDash:[5,6],lineDashOffset:0,label:{enabled:!0}}}},{ActionOnSet:Af,Property:ER}=k,Fu=class extends k.BaseModuleInstance{constructor(e){super(),this.enabled=!1,this.getData=()=>Promise.resolve(),this.dataService=e.dataService}updateCallback(e,t){this.dataService&&(e&&t!=null?this.dataService.updateCallback(t):this.dataService.clearCallback())}};y([Af({newValue(e){this.updateCallback(e,this.getData)}}),ER],Fu.prototype,"enabled",2),y([Af({newValue(e){this.updateCallback(this.enabled,e)}}),ER],Fu.prototype,"getData",2),y([Af({newValue(e){this.dataService.requestThrottle=e}})],Fu.prototype,"requestThrottle",2),y([Af({newValue(e){this.dataService.dispatchThrottle=e}})],Fu.prototype,"updateThrottle",2),y([Af({newValue(e){this.dataService.dispatchOnlyLatest=!e}})],Fu.prototype,"updateDuringInteraction",2);var B8={type:"root",optionsKey:"dataSource",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new Fu(e),themeTemplate:{dataSource:{enabled:!1}}},{nearestSquared:_8,nearestSquaredInContainer:V8,partialAssign:G8,mergeDefaults:PR,BBox:oc}=k,j8=class{constructor(e){this.components=e,this.union=oc.merge(e)}containsPoint(e,t){if(!this.union.containsPoint(e,t))return!1;for(const i of this.components)if(i.containsPoint(e,t))return!0;return!1}},H8=class extends k.Group{constructor(){super(),this.capLength=Number.NaN,this._datum=void 0,this.whiskerPath=new k.Path,this.capsPath=new k.Path,this.bboxes=new j8([]),this.append([this.whiskerPath,this.capsPath])}get datum(){return this._datum}set datum(e){this._datum=e}calculateCapLength(e,t){const{lengthRatio:i=1,length:s}=e,{lengthRatioMultiplier:n,lengthMax:o}=t,a=s??i*n;return Math.min(a,o)}getItemStylerParams(e,t,i,s){const{datum:n}=this;if(n==null||e.itemStyler==null)return;const{xLowerKey:o,xUpperKey:a,yLowerKey:r,yUpperKey:l}=e;return{...t,datum:n.datum,seriesId:n.series.id,xKey:n.xKey,yKey:n.yKey,xLowerKey:o,xUpperKey:a,yLowerKey:r,yUpperKey:l,highlighted:i,highlightState:s}}formatStyles(e,t,i,s,n){let{cap:o,...a}=e;const r=this.getItemStylerParams(t,e,s,n);if(r!=null&&t.itemStyler!=null){const l=i.callWithContext(t.itemStyler,r);a=PR(l,a),o=PR(l?.cap,l,o)}return{whiskerStyle:a,capsStyle:o}}applyStyling(e,t){G8(["visible","stroke","strokeWidth","strokeOpacity","lineDash","lineDashOffset"],e,t)}update(e,t,i,s,n){if(this.datum===void 0)return;const{whiskerStyle:o,capsStyle:a}=this.formatStyles(e,t,i,s,n),{xBar:r,yBar:l,capDefaults:c}=this.datum,h=this.whiskerPath;this.applyStyling(h,o),h.path.clear(!0),l!==void 0&&(h.path.moveTo(l.lowerPoint.x,l.lowerPoint.y),h.path.lineTo(l.upperPoint.x,l.upperPoint.y)),r!==void 0&&(h.path.moveTo(r.lowerPoint.x,r.lowerPoint.y),h.path.lineTo(r.upperPoint.x,r.upperPoint.y)),h.path.closePath(),this.capLength=this.calculateCapLength(a??{},c);const d=this.capLength/2,u=this.capsPath;this.applyStyling(u,a),u.path.clear(!0),l!==void 0&&(u.path.moveTo(l.lowerPoint.x-d,l.lowerPoint.y),u.path.lineTo(l.lowerPoint.x+d,l.lowerPoint.y),u.path.moveTo(l.upperPoint.x-d,l.upperPoint.y),u.path.lineTo(l.upperPoint.x+d,l.upperPoint.y)),r!==void 0&&(u.path.moveTo(r.lowerPoint.x,r.lowerPoint.y-d),u.path.lineTo(r.lowerPoint.x,r.lowerPoint.y+d),u.path.moveTo(r.upperPoint.x,r.upperPoint.y-d),u.path.lineTo(r.upperPoint.x,r.upperPoint.y+d)),u.path.closePath()}updateBBoxes(){const{capLength:e,whiskerPath:t,capsPath:i}=this,{yBar:s,xBar:n}=this.datum??{},o=e/2,a=[];if(s!==void 0){const r=s.lowerPoint.y-s.upperPoint.y;a.push(new oc(s.lowerPoint.x,s.upperPoint.y,t.strokeWidth,r),new oc(s.lowerPoint.x-o,s.lowerPoint.y,e,i.strokeWidth),new oc(s.upperPoint.x-o,s.upperPoint.y,e,i.strokeWidth))}if(n!==void 0){const r=n.upperPoint.x-n.lowerPoint.x;a.push(new oc(n.lowerPoint.x,n.upperPoint.y,r,t.strokeWidth),new oc(n.lowerPoint.x,n.lowerPoint.y-o,i.strokeWidth,e),new oc(n.upperPoint.x,n.upperPoint.y-o,i.strokeWidth,e))}this.bboxes.components=a,this.bboxes.union=oc.merge(a)}containsPoint(e,t){return this.bboxes.containsPoint(e,t)}pickNode(e,t){return this.containsPoint(e,t)?this:void 0}nearestSquared(e,t,i){const{bboxes:s}=this;if(s.union.distanceSquared(e,t)>i)return{nearest:void 0,distanceSquared:1/0};const{distanceSquared:n}=_8(e,t,s.components);return{nearest:this,distanceSquared:n}}},W8=class extends k.Group{nearestSquared(e,t){const{nearest:i,distanceSquared:s}=V8(e,t,{children:this.children()});if(i!==void 0&&!Number.isNaN(s))return{datum:i.datum,distanceSquared:s}}},{BaseProperties:RR,Property:Nt}=k,Zr=class extends RR{};y([Nt],Zr.prototype,"visible",2),y([Nt],Zr.prototype,"stroke",2),y([Nt],Zr.prototype,"strokeWidth",2),y([Nt],Zr.prototype,"strokeOpacity",2),y([Nt],Zr.prototype,"lineDash",2),y([Nt],Zr.prototype,"lineDashOffset",2),y([Nt],Zr.prototype,"length",2),y([Nt],Zr.prototype,"lengthRatio",2);var As=class extends RR{constructor(){super(...arguments),this.visible=!0,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.cap=new Zr}};y([Nt],As.prototype,"yLowerKey",2),y([Nt],As.prototype,"yLowerName",2),y([Nt],As.prototype,"yUpperKey",2),y([Nt],As.prototype,"yUpperName",2),y([Nt],As.prototype,"xLowerKey",2),y([Nt],As.prototype,"xLowerName",2),y([Nt],As.prototype,"xUpperKey",2),y([Nt],As.prototype,"xUpperName",2),y([Nt],As.prototype,"visible",2),y([Nt],As.prototype,"stroke",2),y([Nt],As.prototype,"strokeWidth",2),y([Nt],As.prototype,"strokeOpacity",2),y([Nt],As.prototype,"lineDash",2),y([Nt],As.prototype,"lineDashOffset",2),y([Nt],As.prototype,"itemStyler",2),y([Nt],As.prototype,"cap",2);var{fixNumericExtent:$8,groupAccumulativeValueProperty:U8,mergeDefaults:K8,valueProperty:jb,ChartAxisDirection:Cf}=k;function Y8(e){for(const t of em)if(t===e.series.type)return e.series;throw new Error(`AG Charts - unsupported series type '${e.series.type}', error bars supported series types: ${em.join(", ")}`)}var Z8=class sy extends k.BaseModuleInstance{constructor(t){super(),this.properties=new As;const i=Y8(t),{annotationGroup:s,annotationSelections:n}=i;this.cartesianSeries=i,this.groupNode=new W8({name:`${s.id}-errorBars`}),s.appendChild(this.groupNode),this.selection=k.Selection.select(this.groupNode,()=>this.errorBarFactory()),n.add(this.selection),i.addEventListener("seriesVisibilityChange",o=>this.onToggleSeriesItem(o)),this.cleanup.register(i.events.on("data-processed",o=>this.onDataProcessed(o)),i.events.on("data-update",o=>this.onDataUpdate(o)),t.eventsHub.on("highlight:change",o=>this.onHighlightChange(o)),()=>this.groupNode.remove(),()=>n.delete(this.selection))}hasErrorBars(){const{xLowerKey:t,xUpperKey:i,yLowerKey:s,yUpperKey:n}=this.properties;return qt(t)&&qt(i)||qt(s)&&qt(n)}isStacked(){const t=this.cartesianSeries.seriesGrouping?.stackCount;return t==null?!1:t>0}getUnstackPropertyDefinition(t){const i=[],{xLowerKey:s,xUpperKey:n,yLowerKey:o,yUpperKey:a,xErrorsID:r,yErrorsID:l}=this.getMaybeFlippedKeys(),{xScaleType:c,yScaleType:h}=t;return o!=null&&a!=null&&i.push(jb(o,h,{id:`${l}-lower`}),jb(a,h,{id:`${l}-upper`})),s!=null&&n!=null&&i.push(jb(s,c,{id:`${r}-lower`}),jb(n,c,{id:`${r}-upper`})),i}getStackPropertyDefinition(t){const i=[],{cartesianSeries:s}=this,{xLowerKey:n,xUpperKey:o,yLowerKey:a,yUpperKey:r,xErrorsID:l,yErrorsID:c}=this.getMaybeFlippedKeys(),{xScaleType:h,yScaleType:d}=t,u=s.seriesGrouping?.groupIndex??s.id,p={invalidValue:null,missingValue:0,separateNegative:!0,...s.visible?{}:{forceValue:0}},g=(x,m,v,b)=>U8(x,"normal",{id:`${m}-${v}`,groupId:`errorGroup-${u}-${v}`,...p},b),f=(x,m,v,b)=>{i.push(...g(x,v,"lower",b),...g(m,v,"upper",b))};return a!=null&&r!=null&&f(a,r,c,d),n!=null&&o!=null&&f(n,o,l,h),i}getPropertyDefinitions(t){return this.isStacked()?this.getStackPropertyDefinition(t):this.getUnstackPropertyDefinition(t)}onDataProcessed(t){this.dataModel=t.dataModel,this.processedData=t.processedData}getDomain(t){const{xLowerKey:i,xUpperKey:s,xErrorsID:n,yLowerKey:o,yUpperKey:a,yErrorsID:r}=this.getMaybeFlippedKeys();if(t===Cf.X?qt(i)&&qt(s):qt(o)&&qt(a)){const{dataModel:c,processedData:h,cartesianSeries:d}=this;if(c!=null&&h!=null){const u={x:n,y:r}[t],p=c.getDomain(d,`${u}-lower`,"value",h),g=c.getDomain(d,`${u}-upper`,"value",h),f=[Math.min(...p,...g),Math.max(...p,...g)];return $8(f)}}return[]}onDataUpdate(t){this.dataModel=t.dataModel,this.processedData=t.processedData,qt(t.dataModel)&&qt(t.processedData)&&(this.createNodeData(),this.update())}getNodeData(){return this.hasErrorBars()?this.cartesianSeries.contextNodeData?.nodeData:void 0}createNodeData(){const t=this.getNodeData(),i=this.cartesianSeries.axes[Cf.X]?.scale,s=this.cartesianSeries.axes[Cf.Y]?.scale;if(!(!i||!s||!t))for(let n=0;nthis.updateNode(i,s,n)))}updateNode(t,i,s){t.datum=i,t.update(this.getDefaultStyle(),this.properties,this.cartesianSeries,!1,"none"),t.updateBBoxes()}pickNodeExact(t){const{x:i,y:s}=t,n=this.groupNode.pickNode(i,s);if(n!=null)return{datum:n.datum,distanceSquared:0}}pickNodeNearest(t){return this.groupNode.nearestSquared(t.x,t.y)}pickNodeMainAxisFirst(t,i){let s,n=[1/0,1/0];const o=[t.x,t.y];i===Cf.Y&&o.reverse();for(const a of this.groupNode.children()){const r=a.getBBox(),l=[r.x+r.width/2,r.y+r.height/2];i===Cf.Y&&l.reverse();const c=[];for(let h=0;hnew Z8(e),themeTemplate:X8},{ZIndexMap:Q8,ActionOnSet:J8,Property:_I,ProxyPropertyOnWrite:zR}=k,Hb=class extends k.Background{constructor(){super(...arguments),this.image=new qa,this.fill="transparent",this.fillOpacity=void 0}createNode(){return new k.Group({name:"foreground",zIndex:Q8.FOREGROUND})}onLayoutComplete(e){super.onLayoutComplete(e);const{width:t,height:i}=e.chart;let s={x:0,y:0,width:t,height:i};this.image&&(s=this.image.performLayout(t,i)),this.text&&this.updateTextNode(s)}onImageLoad(){this.ctx.updateService.update(k.ChartUpdateType.SCENE_RENDER)}updateTextNode(e){const{textNode:t}=this;t.fontWeight="bold",t.fontFamily="Impact, sans-serif",t.fontSize=19,t.opacity=.7,t.fill="#9b9b9b",t.textBaseline="top";const i=this.textNode.getBBox(),s=10;t.x=e.x+e.width/2-i.width/2,t.y=e.y+e.height+s}};y([_I,J8({newValue(e){this.node.appendChild(e.node),e.onLoad=()=>this.onImageLoad()},oldValue(e){e.node.remove(),e.onLoad=void 0}})],Hb.prototype,"image",2),y([_I,zR("rectNode","fill")],Hb.prototype,"fill",2),y([_I,zR("rectNode","fillOpacity")],Hb.prototype,"fillOpacity",2);var eq={type:"root",optionsKey:"foreground",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],moduleFactory:e=>new Hb(e)},{TranslatableGroup:tq,SceneChangeDetection:FR}=k,VI=class extends tq{constructor(){super(...arguments),this.inset=0,this.cornerRadius=0}applyClip(e,t){const{cornerRadius:i,inset:s}=this,{x:n,y:o,width:a,height:r}=t,l=new Path2D;l.roundRect(n+s,o+s,a-2*s,r-2*s,i),e.clip(l)}};y([FR()],VI.prototype,"inset",2),y([FR()],VI.prototype,"cornerRadius",2);var{Property:GI,ZIndexMap:Ph,ActionOnSet:BR,CategoryAxis:iq,Padding:sq,Group:Rh,BBox:_R,ProxyProperty:VR,stackCartesianSeries:nq}=k,jI=class{constructor(){this.top=0,this.bottom=0}};y([GI],jI.prototype,"top",2),y([GI],jI.prototype,"bottom",2);var Bu=class extends k.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!1,this.padding=new jI,this.root=new Rh({name:"root"}),this.seriesRoot=this.root.appendChild(new VI({name:"Series-root",zIndex:Ph.SERIES_LAYER,renderToOffscreenCanvas:!0})),this.axisGridGroup=this.root.appendChild(new Rh({name:"Axes-Grids",zIndex:Ph.AXIS_GRID})),this.axisGroup=this.root.appendChild(new Rh({name:"Axes-Grids",zIndex:Ph.AXIS_GRID})),this.axisLabelGroup=this.root.appendChild(new Rh({name:"Axes-Labels",zIndex:Ph.SERIES_LABEL})),this.axisCrosslineRangeGroup=this.root.appendChild(new Rh({name:"Axes-Crosslines-Range",zIndex:Ph.SERIES_CROSSLINE_RANGE})),this.axisCrosslineLineGroup=this.root.appendChild(new Rh({name:"Axes-Crosslines-Line",zIndex:Ph.SERIES_CROSSLINE_LINE})),this.axisCrosslineLabelGroup=this.root.appendChild(new Rh({name:"Axes-Crosslines-Label",zIndex:Ph.SERIES_LABEL})),this.data=[],this._destroyed=!1,this.miniChartAnimationPhase="initial",this.seriesRect=void 0,this.axes=[],this.series=[]}destroy(){if(!this._destroyed){this.destroySeries(this.series);for(const e of this.axes)e.destroy();this.axes=[],this._destroyed=!0}}onSeriesChange(e,t){const i=t?.filter(s=>!e.includes(s))??[];this.destroySeries(i);for(const s of e)t?.includes(s)||(s.attachSeries(this.seriesRoot,this.seriesRoot,void 0),s.chart={},Object.defineProperty(s.chart,"mode",{get:()=>"standalone"}),Object.defineProperty(s.chart,"isMiniChart",{get:()=>!0}),Object.defineProperty(s.chart,"seriesRect",{get:()=>this.seriesRect}),s.resetAnimation(this.miniChartAnimationPhase==="initial"?"initial":"disabled"));this.seriesRect=void 0}destroySeries(e){if(e)for(const t of e)t.destroy(),t.detachSeries(this.seriesRoot,this.seriesRoot,void 0),t.chart=void 0}assignSeriesToAxes(){for(const e of this.axes)e.boundSeries=this.series.filter(t=>t.axes[e.direction]===e)}assignAxesToSeries(){const e={};for(const t of this.axes){const i=t.direction;(e[i]??(e[i]=[])).push(t)}for(const t of this.series)for(const i of t.directions){const s=e[i];if(!s){K.warnOnce(`no available axis for direction [${i}]; check series and axes configuration.`);continue}const n=t.getKeys(i),o=this.findMatchingAxis(s,n);if(!o){K.warnOnce(`no matching axis for direction [${i}] and keys [${n}]; check series and axes configuration.`);continue}t.axes[i]=o}}findMatchingAxis(e,t){for(const i of e){if(!i.keys.length)return i;if(t){for(const s of t)if(i.keys.includes(s))return i}}}updateData(e){for(const t of this.series)t.setChartData(e);this.miniChartAnimationPhase==="initial"&&this.ctx.animationManager.onBatchStop(()=>{this.miniChartAnimationPhase="ready";for(const t of this.series)t.resetAnimation("disabled")})}async processData(e){this.series.some(t=>t.canHaveAxes)&&(this.assignAxesToSeries(),this.assignSeriesToAxes()),await Promise.all(this.series.map(async t=>(t.resetDatumCallbackCache(),t.processData(e))));for(const t of this.axes)t.processData()}computeAxisPadding(){const e=new sq;if(!this.enabled)return e;for(const{position:t,thickness:i,line:s,label:n}of this.axes){if(t==null)continue;let o;i?o=i:o=(s.enabled?s.width:0)+(n.enabled?$o(n.fontSize??0)+n.spacing:0),e[t]=Math.ceil(o)}return e}async layout(e,t){var i;const{padding:s}=this,n=this.seriesRect!=null,o=new _R(0,0,e,t-(s.top+s.bottom)),a=this.seriesRect==null||this.seriesRect.width!==e||this.seriesRect.height!==t;this.seriesRect=o,this.seriesRoot.translationY=s.top,this.seriesRoot.setClipRectCanvasSpace(new _R(0,-s.top,e,t));for(const r of this.axes){const{position:l="left"}=r;switch(l){case"top":case"bottom":r.range=[0,o.width],r.gridLength=o.height;break;case"right":case"left":{const c=r instanceof iq;r.range=c?[0,o.height]:[o.height,0],r.gridLength=o.width;break}}if(r.gridPadding=0,r.translation.x=0,r.translation.y=0,l==="right"?r.translation.x=e:l==="bottom"&&(r.translation.y=t),n||r.resetAnimation("initial"),r.crossLines)for(const c of r.crossLines)c instanceof k.CartesianCrossLine&&(c.position=r.position??"top",(i=c.label).parallel??(i.parallel=r.label?.parallel));r.calculateLayout(),r.update()}a&&nq(this.series),await Promise.all(this.series.map(async r=>r.update({seriesRect:o})))}};y([GI],Bu.prototype,"enabled",2),y([VR(["seriesRoot","inset"])],Bu.prototype,"inset",2),y([VR(["seriesRoot","cornerRadius"])],Bu.prototype,"cornerRadius",2),y([BR({changeValue(e,t=[]){const i={axisNode:this.axisGroup,gridNode:this.axisGridGroup,labelNode:this.axisLabelGroup,crossLineLineNode:this.axisCrosslineLineGroup,crossLineRangeNode:this.axisCrosslineRangeGroup,crossLineLabelNode:this.axisCrosslineLabelGroup};for(const s of t)e.includes(s)||(s.detachAxis(),s.destroy());for(const s of e)t?.includes(s)||s.attachAxis(i)}})],Bu.prototype,"axes",2),y([BR({changeValue(e,t){this.onSeriesChange(e,t)}})],Bu.prototype,"series",2);var{SliderWidget:GR}=k,oq=class{constructor(e,t){this.ctx=e,this.sliderHandlers=t,this._min=0,this._max=1,this.minRange=.001,this.dragStartX=0,this.ctx=e,this.toolbar=e.proxyInteractionService.createProxyContainer({type:"toolbar",domManagerId:"navigator-toolbar",classList:["ag-charts-proxy-navigator-toolbar"],orientation:"vertical",ariaLabel:{id:"ariaLabelNavigator"}}),this.sliders=[e.proxyInteractionService.createProxyElement({type:"slider",domIndex:1,ariaLabel:{id:"ariaLabelNavigatorMinimum"},parent:this.toolbar,cursor:"ew-resize"}),e.proxyInteractionService.createProxyElement({type:"slider",domIndex:-1/0,ariaLabel:{id:"ariaLabelNavigatorRange"},parent:this.toolbar,cursor:"grab"}),e.proxyInteractionService.createProxyElement({type:"slider",domIndex:2,ariaLabel:{id:"ariaLabelNavigatorMaximum"},parent:this.toolbar,cursor:"ew-resize"})];for(const[i,s]of["min","pan","max"].entries()){const n=this.sliders[i];n.step=GR.STEP_HUNDRETH,n.keyboardStep=GR.STEP_ONE,n.orientation="horizontal",n.setPreventsDefault(!1),n.addListener("drag-start",o=>this.onDragStart(i,o,s)),n.addListener("drag-move",o=>this.onDrag(n,o,s)),n.addListener("drag-end",()=>this.updateSliderRatios()),n.addListener("contextmenu",o=>this.onContextMenu(n,o))}this.sliders[0].addListener("change",()=>this.onMinSliderChange()),this.sliders[1].addListener("change",()=>this.onPanSliderChange()),this.sliders[2].addListener("change",()=>this.onMaxSliderChange()),this.updateSliderRatios(),this.updateVisibility(!1)}destroy(){this.toolbar.destroy()}updateVisibility(e){this.toolbar.setHidden(!e)}updateZoom(){const{_min:e,_max:t}=this;if(!(e==null||t==null))return this.ctx.zoomManager.updateZoom("navigator",{x:{min:e,max:t}})}updateBounds(e){this.toolbar.setBounds(e)}updateSliderBounds(e,t){this.sliders[e].setBounds(t)}updateMinMax(e,t){this._min=e,this._max=t,this.updateSliderRatios()}updateSliderRatios(){let{_min:e,_max:t}=this;e=Math.round(e*100)/100,t=Math.round(t*100)/100;const i=this.ctx.localeManager.t("ariaValuePanRange",{min:e,max:t});this.sliders[0].setValueRatio(e),this.sliders[1].setValueRatio(e,{ariaValueText:i}),this.sliders[2].setValueRatio(t)}toCanvasOffsets(e){return{offsetX:this.dragStartX+e.originDeltaX}}moveToFront(e){if(e===1)return;const t=this.sliders[e],i=this.sliders[2-e];this.toolbar.moveChild(i,t.domIndex-1)}onDragStart(e,t,i){const s=this.sliders[e],n=this.toolbar.cssLeft(),o=s.cssLeft();this.dragStartX=n+o+t.offsetX,this.moveToFront(e),t.sourceEvent.preventDefault(),this.sliderHandlers.onDragStart(i,this.toCanvasOffsets(t))}onDrag(e,t,i){t.sourceEvent.preventDefault(),this.sliderHandlers.onDrag(i,this.toCanvasOffsets(t))}onContextMenu(e,t){const{offsetX:i,offsetY:s}=t,{x:n,y:o}=this.toolbar.getBounds(),{x:a,y:r}=e.getBounds(),l=i+n+a,c=s+o+r;this.ctx.contextMenuRegistry.dispatchContext("always",{widgetEvent:t,canvasX:l,canvasY:c},void 0)}onPanSliderChange(){const e=this.sliders[1].getValueRatio(),t=this._max-this._min;this._min=ve(0,e,1-t),this._max=this._min+t,this.updateZoom()}onMinSliderChange(){this._min=this.sliders[0].clampValueRatio(0,this._max-this.minRange),this.updateZoom()}onMaxSliderChange(){this._max=this.sliders[2].clampValueRatio(this._min+this.minRange,1),this.updateZoom()}},{Property:Wb,SceneChangeDetection:$b,BBox:aq,ExtendedPath2D:rq}=k,ac=class extends k.Path{constructor(){super(...arguments),this.zIndex=3,this.centerX=0,this.centerY=0,this.width=8,this.height=16,this.cornerRadius=4,this.grip=!0,this.gripPath=new rq}setCenter(e,t){this.dirtyPath=!0,(this.centerX!==e||this.centerY!==t)&&(this.centerX=e,this.centerY=t,this.markDirty("center"))}static align(e,t,i,s,n,o,a,r,l){const c=e.align(i+n*a)+l,h=c+e.align(i+n*a,n*(r-a))-2*l,d=e.align(s+o/2);e.setCenter(c,d),t.setCenter(h,d)}computeBBox(){const{centerX:e,centerY:t,width:i,height:s}=this,n=e-i/2,o=t-s/2;return new aq(n,o,i,s)}isPointInPath(e,t){return this.getBBox().containsPoint(e,t)}updatePath(){const{centerX:e,centerY:t,path:i,gripPath:s,strokeWidth:n,cornerRadius:o,grip:a}=this,r=n/2,l=this.layerManager?.canvas?.pixelRatio??1;i.clear(),s.clear();const c=Math.floor(this.width/2*l)/l,h=Math.floor(this.height/2*l)/l;i.roundRect(e-c+r,t-h+r,2*(c-r),2*(h-r),o);const d=3;if(a)for(let u=-.5;u<=.5;u+=1)for(let p=-1;p<=1;p+=1)s.arc(e+u*d,t+p*d,1,0,2*Math.PI),s.closePath()}renderFill(e,t){const{stroke:i}=this;super.renderFill(e,t),e.fillStyle=typeof i=="string"?i:"black",e.fill(this.gripPath.getPath2D())}};ac.className="RangeHandle",y([Wb,$b()],ac.prototype,"width",2),y([Wb,$b()],ac.prototype,"height",2),y([Wb,$b()],ac.prototype,"cornerRadius",2),y([Wb,$b()],ac.prototype,"grip",2);var{Path:lq,BBox:HI,ExtendedPath2D:cq,clippedRoundRect:hq,Property:dq,SceneChangeDetection:uq}=k,WI=class extends lq{constructor(){super(...arguments),this.cornerRadius=4,this.zIndex=2,this.x=0,this.y=0,this.width=200,this.height=30,this.min=0,this.max=1,this.visiblePath=new cq}layout(e,t,i,s,n,o){n=Number.isNaN(n)?this.min:n,o=Number.isNaN(o)?this.max:o,(e!==this.x||t!==this.y||i!==this.width||this.height!==s||n!==this.min||o!==this.max)&&(this.x=e,this.y=t,this.width=i,this.height=s,this.min=n,this.max=o,this.dirtyPath=!0,this.markDirty("RangeMask.layout"))}computeBBox(){const{x:e,y:t,width:i,height:s}=this;return new HI(e,t,i,s)}computeVisibleRangeBBox(){const{x:e,y:t,width:i,height:s,min:n,max:o}=this,a=e+i*n,r=e+i*o;return new HI(a,t,r-a,s)}updatePath(){const{path:e,visiblePath:t,x:i,y:s,width:n,height:o,min:a,max:r,strokeWidth:l,cornerRadius:c}=this,h=l/2;e.clear(),t.clear();const d=this.align(i)+h,u=this.align(s)+h,p=this.align(i,n)-2*h,g=this.align(s,o)-2*h,f=this.align(i+n*a)+h,x=f+this.align(i+n*a,n*(r-a))-2*h,m={topLeft:c,topRight:c,bottomRight:c,bottomLeft:c},v=(b,S,D)=>{if(D-S<1)return;const L=new HI(S,u,D-S,g);hq(b,d,u,p,g,m,L)};v(e,d,f),v(e,x,p+d),v(t,f,x)}renderStroke(e,t){super.renderStroke(e,t),super.renderStroke(e,this.visiblePath.getPath2D())}};WI.className="RangeMask",y([dq,uq()],WI.prototype,"cornerRadius",2);var pq=class extends k.Group{constructor(e){super({name:"rangeSelectorGroup",zIndex:k.ZIndexMap.NAVIGATOR}),this.x=0,this.y=0,this.width=200,this.height=30,this.lOffset=0,this.rOffset=0,this.background=this.appendChild(new k.TranslatableGroup({name:"navigator-background",zIndex:1})),this.append(e)}layout(e,t,i,s,n,o){this.x=e,this.y=t,this.width=i,this.height=s,this.lOffset=n,this.rOffset=o,this.background.translationX=e,this.background.translationY=t,this.markDirty("RangeSelector")}updateBackground(e,t){e?.remove(),t!=null&&this.background.appendChild(t),this.markDirty("RangeSelector")}computeBBox(){const{x:e,y:t,width:i,height:s,lOffset:n,rOffset:o}=this;return new k.BBox(e-n,t,i+(n+o),s)}},{BaseModuleInstance:gq,ObserveChanges:$I,Property:Ub}=k,_u=class extends gq{constructor(e){super(),this.ctx=e,this.enabled=!1,this.mask=new WI,this.minHandle=new ac,this.maxHandle=new ac,this.maskVisibleRange={id:"navigator-mask-visible-range",getBBox:()=>this.mask.computeVisibleRangeBBox(),toCanvasBBox:()=>this.mask.computeVisibleRangeBBox(),fromCanvasPoint:(t,i)=>({x:t,y:i})},this.height=30,this.cornerRadius=0,this.spacing=10,this.x=0,this.y=0,this.width=0,this.rangeSelector=new pq([this.mask,this.minHandle,this.maxHandle]),this.cleanup.register(e.scene.attachNode(this.rangeSelector),e.eventsHub.on("locale:change",()=>this.updateZoom()),e.layoutManager.registerElement(k.LayoutElement.Navigator,t=>this.onLayoutStart(t)),e.eventsHub.on("layout:complete",t=>this.onLayoutComplete(t)),e.eventsHub.on("zoom:change",t=>this.onZoomChange(t))),this.domProxy=new oq(e,this),this.updateGroupVisibility(),this.miniChart=new Bu(e)}updateBackground(e,t){this.rangeSelector?.updateBackground(e,t)}updateGroupVisibility(){const{enabled:e}=this;this.rangeSelector==null||e===this.rangeSelector.visible||(this.rangeSelector.visible=e,this.domProxy.updateVisibility(e),e?this.updateZoom():this.ctx.zoomManager.updateZoom("navigator"))}onLayoutStart(e){if(this.enabled){const{layoutBox:t}=e,i=this.height+this.spacing;t.shrink(i,"bottom"),this.y=t.y+t.height+this.spacing}else this.y=0;if(this.enabled&&this.miniChart){const{top:t,bottom:i}=this.miniChart.computeAxisPadding();e.layoutBox.shrink(t+i,"bottom"),this.y-=i,this.miniChart.inset=this.mask.strokeWidth/2,this.miniChart.cornerRadius=this.mask.cornerRadius}}onLayoutComplete(e){const{x:t,width:i}=e.series.rect,{y:s,height:n}=this;if(this.domProxy.updateVisibility(this.enabled),this.enabled){const{_min:o,_max:a}=this.domProxy;this.layoutNodes(t,s,i,n,o,a),this.domProxy.updateBounds({x:t,y:s,width:i,height:n})}this.x=t,this.width=i,this.miniChart?.layout(i,n).catch(o=>K.error(o))}canDrag(){return this.enabled&&this.ctx.interactionManager.isState(k.InteractionState.ZoomDraggable)}onDragStart(e,{offsetX:t}){this.canDrag()&&(e==="pan"&&(this.panStart=(t-this.x)/this.width-this.domProxy._min),this.ctx.zoomManager.fireZoomPanStartEvent("navigator"))}onDrag(e,{offsetX:t}){if(!this.canDrag())return;const{panStart:i,x:s,width:n}=this,{minRange:o}=this.domProxy;let{_min:a,_max:r}=this.domProxy;const l=(t-s)/n;if(e==="min")a=ve(0,l,r-o);else if(e==="max")r=ve(a+o,l,1);else if(e==="pan"&&i!=null){const c=r-a;a=ve(0,l-i,1-c),r=a+c}this.domProxy._min=a,this.domProxy._max=r,this.updateZoom()}onZoomChange(e){const{x:t}=e;if(!t)return;const{x:i,y:s,width:n,height:o}=this,{min:a,max:r}=t;this.domProxy.updateMinMax(a,r),this.layoutNodes(i,s,n,o,a,r)}layoutNodes(e,t,i,s,n,o){const{rangeSelector:a,mask:r,minHandle:l,maxHandle:c}=this;r.layout(e,t,i,s,n,o),a.layout(e,t,i,s,l.width/2,c.width/2),ac.align(l,c,e,t,i,s,n,o,r.strokeWidth/2),n+(o-n)/2<.5?(l.zIndex=3,c.zIndex=4):(l.zIndex=4,c.zIndex=3);for(const[h,d]of[l,this.maskVisibleRange,c].entries()){const u=d.getBBox(),p={x:u.x-e,y:u.y-t,height:u.height,width:u.width};this.domProxy.updateSliderBounds(h,p)}}updateZoom(){this.enabled&&this.domProxy.updateZoom()}updateData(e){return this.miniChart?.updateData(e)}async processData(e){if(this.miniChart)return this.miniChart?.processData(e)}};y([$I((e,t,i)=>{e.updateBackground(i?.root,t?.root)})],_u.prototype,"miniChart",2),y([Ub,$I((e,t)=>{e.ctx.zoomManager.setNavigatorEnabled(!!t),e.updateGroupVisibility()})],_u.prototype,"enabled",2),y([Ub],_u.prototype,"height",2),y([Ub,$I((e,t)=>{e.mask.cornerRadius=t})],_u.prototype,"cornerRadius",2),y([Ub],_u.prototype,"spacing",2);function fq(e){return{from:e?{scalingX:1,scalingY:0}:{scalingX:0,scalingY:1},to:{scalingX:1,scalingY:1}}}function yq(e){return(t,i)=>e?{scalingCenterY:i.scaledValues.medianValue}:{scalingCenterX:i.scaledValues.medianValue}}var{Path:mq,Scalable:xq,ExtendedPath2D:bq,SceneChangeDetection:Cs,SceneArrayChangeDetection:vq,BBox:zh,clippedRoundRect:jR}=k,Ki=class extends xq(mq){constructor(){super(...arguments),this.wickPath=new bq,this.horizontal=!1,this.center=0,this.thickness=0,this.min=0,this.q1=0,this.median=0,this.q3=0,this.max=0,this.cornerRadius=0,this.crisp=!1,this.strokeAlignment=0,this.wickStroke=void 0,this.wickStrokeWidth=void 0,this.wickStrokeOpacity=void 0,this.capLengthRatio=1,this.wickStrokeAlignment=0}computeBBox(){const{horizontal:e,center:t,thickness:i,min:s,max:n}=this;return e?new zh(Math.min(s,n),t-i/2,Math.abs(n-s),i):new zh(t-i/2,Math.min(s,n),i,Math.abs(n-s))}computeDefaultGradientFillBBox(){const{horizontal:e,center:t,thickness:i,q1:s,q3:n}=this;return e?new zh(Math.min(s,n),t-i/2,Math.abs(n-s),i):new zh(t-i/2,Math.min(s,n),i,Math.abs(n-s))}isPointInPath(e,t){return this.getBBox().containsPoint(e,t)}distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}get midPoint(){return this.horizontal?{x:(this.min+this.max)/2,y:this.center}:{x:this.center,y:(this.min+this.max)/2}}alignedCoordinates(){const{thickness:e,crisp:t}=this;let{center:i,min:s,q1:n,median:o,q3:a,max:r}=this,l=i-e/2,c=i+e/2;if(t&&e>1){s=this.align(s),n=this.align(n),o=this.align(o),a=this.align(a),r=s+this.align(s,r-s);const h=this.align(e/2);i=this.align(i),l=i-h,c=i+h}return{center:i,x0:l,x1:c,min:s,max:r,q1:n,median:o,q3:a}}updatePath(){const{path:e,stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:n,lineDashOffset:o,wickStroke:a,wickStrokeWidth:r,wickStrokeOpacity:l,wickLineDash:c,wickLineDashOffset:h,strokeAlignment:d,cornerRadius:u,capLengthRatio:p,horizontal:g}=this,{center:f,x0:x,x1:m,min:v,max:b,q1:S,median:D,q3:L}=this.alignedCoordinates(),I=this.layerManager?.canvas.pixelRatio??1,A=this.wickStrokeAlignment>0?I/this.wickStrokeAlignment/2%1:0;this.path.clear(),this.wickPath.clear();const w=a!=null&&a!==t||r!=null&&r!==i||l!=null&&l!==s||c!=null&&c!==n||h!=null&&h!==o?this.wickPath:e;if(Math.abs(m-x)<=3){Vu(w,g,f,v),Gu(w,g,f,b);return}const N=Math.min(v,b),O=Math.max(v,b),P=Math.min(S,L),F=Math.max(S,L),_=f-Math.abs((m-x)*p)/2,z=f+Math.abs((m-x)*p)/2;Vu(w,g,_,N-A),Gu(w,g,z,N-A),Vu(w,g,f-A,N-A),Gu(w,g,f-A,P+i/2),Vu(w,g,f-A,O+A),Gu(w,g,f-A,F-i/2),Vu(w,g,_,O+A),Gu(w,g,z,O+A);const B=i/2+d,R=i/2-d,V=F-P-2*R;if(V>0){const j=x+B,$=P+R,W=m-x-2*B,Y={topLeft:u,topRight:u,bottomRight:u,bottomLeft:u};HR(e,g,j,$,W,V,Y,new zh(j,$,W,D-$)),HR(e,g,j,$,W,V,Y,new zh(j,D,W,$+V-D))}else{const j=(P+F)/2;Vu(e,g,x,j),Gu(e,g,m,j)}}drawPath(e){super.drawPath(e);const{wickPath:t}=this;if(t.isEmpty())return;const{stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,wickStroke:r=i,wickStrokeWidth:l=s,wickStrokeOpacity:c=n,wickLineDash:h=o,wickLineDashOffset:d=a}=this;l!==0&&(e.globalAlpha*=c,typeof r=="string"&&(e.strokeStyle=r),e.lineWidth=l,h!=null&&e.setLineDash([...h]),e.lineDashOffset=d,e.stroke(t.getPath2D()))}};y([Cs()],Ki.prototype,"horizontal",2),y([Cs()],Ki.prototype,"center",2),y([Cs()],Ki.prototype,"thickness",2),y([Cs()],Ki.prototype,"min",2),y([Cs()],Ki.prototype,"q1",2),y([Cs()],Ki.prototype,"median",2),y([Cs()],Ki.prototype,"q3",2),y([Cs()],Ki.prototype,"max",2),y([Cs()],Ki.prototype,"cornerRadius",2),y([Cs()],Ki.prototype,"crisp",2),y([Cs()],Ki.prototype,"strokeAlignment",2),y([Cs()],Ki.prototype,"wickStroke",2),y([Cs()],Ki.prototype,"wickStrokeWidth",2),y([Cs()],Ki.prototype,"wickStrokeOpacity",2),y([vq()],Ki.prototype,"wickLineDash",2),y([Cs()],Ki.prototype,"wickLineDashOffset",2),y([Cs()],Ki.prototype,"capLengthRatio",2),y([Cs()],Ki.prototype,"wickStrokeAlignment",2);function Vu(e,t,i,s){t?e.moveTo(s,i):e.moveTo(i,s)}function Gu(e,t,i,s){t?e.lineTo(s,i):e.lineTo(i,s)}function HR(e,t,i,s,n,o,a,r){t?jR(e,s,i,o,n,a,r==null?void 0:new zh(r.y,r.x,r.height,r.width)):jR(e,i,s,n,o,a,r)}var{BaseProperties:WR,AbstractBarSeriesProperties:Sq,makeSeriesTooltip:Mq,Property:rt,mergeDefaults:Dq}=k,$R=class extends WR{constructor(){super(...arguments),this.lengthRatio=.5}};y([rt],$R.prototype,"lengthRatio",2);var ju=class extends WR{};y([rt],ju.prototype,"stroke",2),y([rt],ju.prototype,"strokeWidth",2),y([rt],ju.prototype,"strokeOpacity",2),y([rt],ju.prototype,"lineDash",2),y([rt],ju.prototype,"lineDashOffset",2);var kt=class extends Sq{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.cap=new $R,this.whisker=new ju,this.tooltip=Mq()}toJson(){const{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:s,lineDashOffset:n}=this,o=super.toJson();return o.whisker=Dq(o.whisker,{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:s,lineDashOffset:n}),o}};y([rt],kt.prototype,"xKey",2),y([rt],kt.prototype,"minKey",2),y([rt],kt.prototype,"q1Key",2),y([rt],kt.prototype,"medianKey",2),y([rt],kt.prototype,"q3Key",2),y([rt],kt.prototype,"maxKey",2),y([rt],kt.prototype,"xName",2),y([rt],kt.prototype,"yName",2),y([rt],kt.prototype,"minName",2),y([rt],kt.prototype,"q1Name",2),y([rt],kt.prototype,"medianName",2),y([rt],kt.prototype,"q3Name",2),y([rt],kt.prototype,"maxName",2),y([rt],kt.prototype,"fill",2),y([rt],kt.prototype,"fillOpacity",2),y([rt],kt.prototype,"stroke",2),y([rt],kt.prototype,"strokeWidth",2),y([rt],kt.prototype,"strokeOpacity",2),y([rt],kt.prototype,"lineDash",2),y([rt],kt.prototype,"lineDashOffset",2),y([rt],kt.prototype,"cornerRadius",2),y([rt],kt.prototype,"styler",2),y([rt],kt.prototype,"itemStyler",2),y([rt],kt.prototype,"cap",2),y([rt],kt.prototype,"whisker",2),y([rt],kt.prototype,"tooltip",2);var{fixNumericExtent:kq,keyProperty:Iq,mergeDefaults:UI,SeriesNodePickMode:UR,SMALLEST_KEY_INTERVAL:Aq,valueProperty:Lf,diff:Cq,animationValidation:Lq,computeBarFocusBounds:Tq,createDatumId:wq,HighlightState:KI,ContinuousScale:Nq,ChartAxisDirection:Oq,motion:KR,getItemStyles:Eq,applyShapeFillBBox:Pq,calculateSegments:Rq,toHighlightString:zq}=k,Fq=class extends k.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.minKey=s.properties.minKey,this.q1Key=s.properties.q1Key,this.medianKey=s.properties.medianKey,this.q3Key=s.properties.q3Key,this.maxKey=s.properties.maxKey}},Kb=class extends k.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[UR.NEAREST_NODE,UR.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["medianKey","q1Key","q3Key","minKey","maxKey"]},propertyNames:{x:["xName"],y:["medianName","q1Name","q3Name","minName","maxName"]},categoryKey:"xValue",pathsPerSeries:[]}),this.properties=new kt,this.NodeEvent=Fq}async processData(e){if(!this.visible)return;const{xKey:t,minKey:i,q1Key:s,medianKey:n,q3Key:o,maxKey:a}=this.properties,r=!this.ctx.animationManager.isSkipped(),l=this.getCategoryAxis()?.scale,c=this.getValueAxis()?.scale,{isContinuousX:h,xScaleType:d,yScaleType:u}=this.getScaleInformation({xScale:l,yScale:c}),p=[];r&&this.processedData&&p.push(Cq(this.id,this.processedData)),r&&p.push(Lq());const{processedData:g}=await this.requestDataModel(e,this.data,{props:[Iq(t,d,{id:"xValue"}),Lf(i,u,{id:"minValue"}),Lf(s,u,{id:"q1Value"}),Lf(n,u,{id:"medianValue"}),Lf(o,u,{id:"q3Value"}),Lf(a,u,{id:"maxValue"}),...h?[Aq]:[],...p]});this.smallestDataInterval=g.reduced?.smallestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];if(e!==this.getBarDirection()){const{index:n,def:o}=i.resolveProcessedDataDefById(this,"xValue"),a=t.domain.keys[n];return o.type==="key"&&o.valueType==="category"?a:this.padBandExtent(a)}const s=this.domainForClippedRange(e,["minValue","maxValue"],"xValue");return kq(s)}getSeriesRange(e,t){return this.domainForVisibleRange(Oq.Y,["maxValue","minValue"],"xValue",t)}createNodeData(){const{visible:e,dataModel:t,processedData:i}=this,s=this.getCategoryAxis(),n=this.getValueAxis();if(!(t&&i&&s&&n))return;const{xKey:o}=this.properties,a=[],r=t.resolveKeysById(this,"xValue",i),l=t.resolveColumnById(this,"minValue",i),c=t.resolveColumnById(this,"q1Value",i),h=t.resolveColumnById(this,"medianValue",i),d=t.resolveColumnById(this,"q3Value",i),u=t.resolveColumnById(this,"maxValue",i),{barWidth:p,groupIndex:g}=this.updateGroupScale(s),f=Nq.is(s.scale)?p*-.5:0,{groupScale:x}=this,m=this.isVertical(),v=Rq(this.properties.segmentation,s,n,this.chart.seriesRect,this.ctx.scene),b={itemId:o,nodeData:a,labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:Eq(this.getItemStyle.bind(this)),segments:v};if(!e)return b;const S=i.dataSources.get(this.id)?.data??[];for(const[D,L]of S.entries()){const I=r[D];if(I==null)continue;const A=l[D],T=c[D],w=h[D],N=d[D],O=u[D];if([A,T,w,N,O].some(j=>typeof j!="number")||A>T||T>w||w>N||N>O)continue;const P={xValue:s.scale.convert(I),minValue:n.scale.convert(A),q1Value:n.scale.convert(T),medianValue:n.scale.convert(w),q3Value:n.scale.convert(N),maxValue:n.scale.convert(O)},F=p;P.xValue+=x.convert(String(g))+f+F/2;const _=Math.abs(P.q3Value-P.q1Value),z=P.xValue,B=Math.min(P.q3Value,P.q1Value)+_/2,R={x:m?z:B,y:m?B:z};let V;m?V={x:R.x-F/2,y:P.minValue,width:F,height:P.maxValue-P.minValue}:V={x:P.minValue,y:R.y-F/2,width:P.maxValue-P.minValue,height:F},a.push({series:this,itemId:I,datum:L,datumIndex:D,xKey:o,bandwidth:F,scaledValues:P,midPoint:R,focusRect:V})}return b}legendItemSymbol(){const{fill:e,stroke:t,strokeWidth:i,fillOpacity:s,strokeOpacity:n,lineDash:o,lineDashOffset:a}=this.getStyle(!1,!1,KI.None);return{marker:{fill:k.deepClone(e),fillOpacity:s,stroke:t,strokeOpacity:n,strokeWidth:i,lineDash:o,lineDashOffset:a}}}getLegendData(e){const{id:t,ctx:{legendManager:i},visible:s}=this,{xKey:n,yName:o,showInLegend:a,legendItemName:r}=this.properties;return!n||e!=="category"?[]:[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:s&&i.getItemEnabled({seriesId:t,itemId:t}),label:{text:r??o??t},symbol:this.legendItemSymbol(),legendItemName:r,hideInLegend:!a}]}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:n}=this,{xKey:o,xName:a,yName:r,medianKey:l,medianName:c,q1Key:h,q1Name:d,q3Key:u,q3Name:p,minKey:g,minName:f,maxKey:x,maxName:m,legendItemName:v,tooltip:b}=n,S=this.getCategoryAxis(),D=this.getValueAxis();if(!i||!s||!S||!D)return;const L=s.dataSources.get(this.id)?.data[e],I=i.resolveKeysById(this,"xValue",s)[e],A=i.resolveColumnById(this,"minValue",s)[e],T=i.resolveColumnById(this,"q1Value",s)[e],w=i.resolveColumnById(this,"medianValue",s)[e],N=i.resolveColumnById(this,"q3Value",s)[e],O=i.resolveColumnById(this,"maxValue",s)[e];if(I==null)return;const P=this.getItemStyle(e,!1),F=[{label:f,fallbackLabel:g,value:this.getAxisValueText(D,"tooltip",A,L,g,v)},{label:d,fallbackLabel:h,value:this.getAxisValueText(D,"tooltip",T,L,h,v)},{label:c,fallbackLabel:l,value:this.getAxisValueText(D,"tooltip",w,L,l,v)},{label:p,fallbackLabel:u,value:this.getAxisValueText(D,"tooltip",N,L,u,v)},{label:m,fallbackLabel:x,value:this.getAxisValueText(D,"tooltip",O,L,x,v)}];return this.formatTooltipWithContext(b,{heading:this.getAxisValueText(S,"tooltip",I,L,o,v),title:v??r,symbol:this.legendItemSymbol(),data:F},{seriesId:t,datum:L,title:r,xKey:o,xName:a,yName:r,medianKey:l,medianName:c,q1Key:h,q1Name:d,q3Key:u,q3Name:p,minKey:g,minName:f,maxKey:x,maxName:m,...P})}animateEmptyUpdateReady({datumSelection:e}){const t=this.isVertical(),{from:i,to:s}=fq(t);KR.resetMotion([e],yq(t)),KR.staticFromToMotion(this.id,"datums",this.ctx.animationManager,[e],i,s,{phase:"initial"})}isLabelEnabled(){return!1}updateDatumSelection(e){const t=e.nodeData??[];return e.datumSelection.update(t)}makeStylerParams(e,t){const{id:i}=this,{cornerRadius:s,cap:{lengthRatio:n},fill:o,fillOpacity:a,lineDash:r,lineDashOffset:l,stroke:c,strokeOpacity:h,strokeWidth:d,maxKey:u,maxName:p,medianKey:g,medianName:f,minKey:x,minName:m,q1Key:v,q1Name:b,q3Key:S,q3Name:D,whisker:{lineDash:L,lineDashOffset:I,stroke:A,strokeOpacity:T,strokeWidth:w},xKey:N,xName:O,yName:P}=this.properties,F=zq(t??KI.None);return{cap:{lengthRatio:n},cornerRadius:s,fill:o,fillOpacity:a,highlightState:F,highlighted:e,lineDash:r,lineDashOffset:l,maxKey:u,maxName:p??u,medianKey:g,medianName:f??g,minKey:x,minName:m??x,q1Key:v,q1Name:b??v,q3Key:S,q3Name:D??S,seriesId:i,stroke:c,strokeOpacity:h,strokeWidth:d,whisker:{lineDash:L??r,lineDashOffset:I??l,stroke:A??c,strokeOpacity:T??h,strokeWidth:w??d},xKey:N,xName:O??N,yName:P}}getStyle(e,t,i){const{cap:s,cornerRadius:n,fill:o,fillOpacity:a,lineDash:r,lineDashOffset:l,stroke:c,strokeOpacity:h,strokeWidth:d,styler:u,whisker:p}=this.properties;let g={};if(!e&&u){const f=this.makeStylerParams(t,i);g=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(u,f)??{},{pick:!1})??{}}return{cornerRadius:g.cornerRadius??n,fill:g.fill??o,fillOpacity:g.fillOpacity??a,lineDash:g.lineDash??r,lineDashOffset:g.lineDashOffset??l,opacity:1,stroke:g.stroke??c,strokeOpacity:g.strokeOpacity??h,strokeWidth:g.strokeWidth??d,cap:{lengthRatio:g.cap?.lengthRatio??s.lengthRatio},whisker:{lineDash:g.whisker?.lineDash??p.lineDash,lineDashOffset:g.whisker?.lineDashOffset??p.lineDashOffset,stroke:g.whisker?.stroke??p.stroke,strokeOpacity:g.whisker?.strokeOpacity??p.strokeOpacity,strokeWidth:g.whisker?.strokeWidth??p.strokeWidth}}}getItemStyle(e,t,i){const{properties:s}=this,{itemStyler:n}=s,o=this.getHighlightStyle(t,e,i);let a=UI(o,this.getStyle(e===void 0,t,i));if(n!=null&&e!=null){const u=this.cachedDatumCallback(wq(e,t?"highlight":"node"),()=>{const p=this.makeItemStylerParams(e,t,a);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(n,p))});u&&(a=UI(u,a))}const{stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}=a;return a.whisker=UI(a.whisker,{stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}),a}makeItemStylerParams(e,t,i){const{id:s}=this,{xKey:n,minKey:o,q1Key:a,medianKey:r,q3Key:l,maxKey:c}=this.properties,h=this.processedData?.dataSources.get(s)?.data[e],d=this.ctx.highlightManager?.getActiveHighlight(),u=this.getHighlightStateString(d,t,e),p=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:h,xKey:n,minKey:o,q1Key:a,medianKey:r,q3Key:l,maxKey:c,highlighted:t,highlightState:u,...i,fill:p}}updateDatumStyles({datumSelection:e,isHighlight:t}){const i=this.ctx.highlightManager.getActiveHighlight();e.each((s,n)=>{const o=this.getHighlightState(i,t,n.datumIndex);n.style=this.getItemStyle(n.datumIndex,t,o)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:s}=this;if(!i)return;const n=this.isVertical(),o=this.ctx.highlightManager.getActiveHighlight(),a=this.getShapeFillBBox(),r=this.getStyle(!1,!1,KI.None).strokeWidth/2,l=s.whisker.strokeWidth??s.strokeWidth;e.each((c,h)=>{const d=h.style??i.styles[this.getHighlightState(o,t,h.datumIndex)];Pq(c,d.fill,a),c.fill=d.fill,c.fillOpacity=d.fillOpacity,c.stroke=d.stroke,c.strokeWidth=d.strokeWidth,c.strokeOpacity=d.strokeOpacity,c.lineDash=d.lineDash,c.lineDashOffset=d.lineDashOffset,c.wickStroke=d.whisker.stroke,c.wickStrokeWidth=d.whisker.strokeWidth,c.wickStrokeOpacity=d.whisker.strokeOpacity,c.wickLineDash=d.whisker.lineDash,c.wickLineDashOffset=d.whisker.lineDashOffset,c.cornerRadius=d.cornerRadius,c.crisp=!0,c.horizontal=!n,c.center=h.scaledValues.xValue,c.thickness=h.bandwidth,c.min=h.scaledValues.minValue,c.q1=h.scaledValues.q1Value,c.median=h.scaledValues.medianValue,c.q3=h.scaledValues.q3Value,c.max=h.scaledValues.maxValue,c.capLengthRatio=d.cap.lengthRatio,c.strokeAlignment=r,c.wickStrokeAlignment=l})}updateLabelNodes(){}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;return i.update(t)}nodeFactory(){return new Ki}computeFocusBounds({datumIndex:e}){return Tq(this,this.contextNodeData?.nodeData[e].focusRect)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null}};Kb.className="BoxPlotSeries",Kb.type="box-plot";var{boxPlotSeriesThemeableOptionsDef:Bq,commonSeriesOptionsDefs:_q}=k,Vq={..._q,...Bq,type:U(Ce("box-plot")),xKey:U(E),minKey:U(E),q1Key:U(E),medianKey:U(E),q3Key:U(E),maxKey:U(E),xName:E,yName:E,minName:E,q1Name:E,medianName:E,q3Name:E,maxName:E,grouped:G,legendItemName:E,segmentation:rl},{ThemeConstants:{CARTESIAN_AXIS_TYPE:YR},multiSeriesHighlightStyle:Gq,FILL_GRADIENT_LINEAR_DEFAULTS:jq,FILL_IMAGE_DEFAULTS:Hq,FILL_PATTERN_DEFAULTS:Wq,SAFE_FILL_OPERATION:$q,SEGMENTATION_DEFAULTS:Uq}=k,Kq={series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$if:[{$or:[{$isGradient:{$palette:"fill"}},{$isPattern:{$palette:"fill"}},{$isImage:{$palette:"fill"}}]},{$palette:"fill"},{$mix:[$q,{$ref:"chartBackgroundColor"},.7]}]},["gradient",jq],["image",Hq],["pattern",Wq]]},stroke:{$palette:"stroke"},strokeWidth:2,fillOpacity:1,strokeOpacity:1,lineDash:void 0,lineDashOffset:0,highlight:Gq(),segmentation:Uq},axes:{[YR.NUMBER]:{crosshair:{snap:!1}},[YR.CATEGORY]:{groupPaddingInner:.2,crosshair:{enabled:!1,snap:!1}}}},Yq={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"box-plot",moduleFactory:e=>new Kb(e),predictAxis:k.predictCartesianTimeAxis,defaultAxes:k.DIRECTION_SWAP_AXES,themeTemplate:Kq,groupable:!0},ZR={type:"series",name:"box-plot",chartType:"cartesian",enterprise:!0,options:Vq,create:e=>new Kb(e)},{AGGREGATION_SPAN:XR,AGGREGATION_INDEX_X_MAX:Zq,AGGREGATION_INDEX_X_MIN:Xq,AGGREGATION_INDEX_Y_MAX:qq,AGGREGATION_INDEX_Y_MIN:Qq,aggregationDomain:Jq,aggregationRangeFittingPoints:eQ,compactAggregationIndices:tQ,createAggregationIndices:iQ}=k,sQ=1e3,qR=Xq,nQ=qq,oQ=Qq,QR=Zq;function aQ(e,t,i,s,n,o){if(t.length64;)({indexData:c,valueData:h,maxRange:l}=tQ(c,h,l)),d.push({maxRange:l,indexData:c});return d.reverse(),d}var{fixNumericExtent:rQ,keyProperty:lQ,createDatumId:JR,SeriesNodePickMode:ez,ChartAxisDirection:tz,SMALLEST_KEY_INTERVAL:cQ,valueProperty:Yb,diff:hQ,animationValidation:dQ,computeBarFocusBounds:uQ,visibleRangeIndices:iz,BandScale:pQ,processedDataIsAnimatable:gQ,mergeDefaults:sz,simpleMemorize2:fQ,getItemStylesPerItemId:yQ}=k,mQ=fQ(aQ),xQ=class extends k.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.openKey=s.properties.openKey,this.closeKey=s.properties.closeKey,this.highKey=s.properties.highKey,this.lowKey=s.properties.lowKey}},nz=class extends k.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[ez.AXIS_ALIGNED,ez.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["lowKey","highKey","openKey","closeKey"]},propertyNames:{x:["xName"],y:["lowName","highName","openName","closeName"]},categoryKey:"xValue",pathsPerSeries:[]}),this.NodeEvent=xQ,this.dataAggregationFilters=void 0}async processData(e){if(!this.visible)return;const{xKey:t,openKey:i,closeKey:s,highKey:n,lowKey:o}=this.properties,a=!this.ctx.animationManager.isSkipped(),r=this.getCategoryAxis()?.scale,l=this.getValueAxis()?.scale,{isContinuousX:c,xScaleType:h,yScaleType:d}=this.getScaleInformation({xScale:r,yScale:l}),u=[];a&&(this.processedData&&u.push(hQ(this.id,this.processedData)),u.push(dQ())),i&&u.push(Yb(i,d,{id:"openValue",invalidValue:void 0,missingValue:void 0}));const{dataModel:p,processedData:g}=await this.requestDataModel(e,this.data,{props:[lQ(t,h,{id:"xValue"}),Yb(s,d,{id:"closeValue"}),Yb(n,d,{id:"highValue"}),Yb(o,d,{id:"lowValue"}),...c?[cQ]:[],...u]});this.smallestDataInterval=g.reduced?.smallestKeyInterval,this.dataAggregationFilters=this.aggregateData(p,g),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||gQ(t))return;const i=this.axes[tz.X];if(i==null)return;const s=e.resolveKeysById(this,"xValue",t),n=e.resolveColumnById(this,"highValue",t),o=e.resolveColumnById(this,"lowValue",t),{index:a}=e.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[a];return mQ(i.scale.type,s,n,o,r,t.reduced?.smallestKeyInterval)}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];if(e!==this.getBarDirection()){const{index:n,def:o}=i.resolveProcessedDataDefById(this,"xValue"),a=t.domain.keys[n];return o.type==="key"&&o.valueType==="category"?a:this.padBandExtent(a)}const s=this.domainForClippedRange(e,["highValue","lowValue"],"xValue");return rQ(s)}getSeriesRange(e,t){return this.domainForVisibleRange(tz.Y,["highValue","lowValue"],"xValue",t)}getZoomRangeFittingItems(e,t,i){return this.zoomFittingVisibleItems("xValue",["highValue","lowValue"],e,t,i)}getVisibleItems(e,t,i){return this.countVisibleItems("xValue",["highValue","lowValue"],e,t,i)}createNodeData(){const{visible:e,dataModel:t,processedData:i}=this,s=this.getCategoryAxis(),n=this.getValueAxis();if(!(t&&i&&s&&n))return;const o=[],{xKey:a,highKey:r,lowKey:l}=this.properties,c=i.dataSources.get(this.id)?.data??[],h=t.resolveKeysById(this,"xValue",i),d=t.resolveColumnById(this,"openValue",i),u=t.resolveColumnById(this,"closeValue",i),p=t.resolveColumnById(this,"highValue",i),g=t.resolveColumnById(this,"lowValue",i),{groupScale:f}=this,{barWidth:x,groupIndex:m}=this.updateGroupScale(s),v=f.convert(String(m)),b=x>=1?x:f.rawBandwidth,S=pQ.is(s.scale),D={itemId:a,nodeData:o,labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:yQ(this.getItemStyle.bind(this),"up","down")};if(!e)return D;const L=(F,_,z,B,R,V,j,$)=>{const W=c[F],Y=S?j/2:0,se=s.scale.convert(_)+v+Y,X=n.scale.convert(z),Q=n.scale.convert(B),ie=n.scale.convert(R),q=n.scale.convert(V),ee=B>z,oe=ee?"up":"down",le=Math.min(ie,q),he=Math.max(ie,q)-le,ue={x:se,y:le+he/2};o.push({series:this,itemId:oe,datum:W,datumIndex:F,xKey:a,xValue:_,openValue:z,closeValue:B,highValue:R,lowValue:V,midPoint:ue,aggregatedValue:B,isRising:ee,centerX:se,width:j,y:le,height:he,yOpen:X,yClose:Q,crisp:$})},{dataAggregationFilters:I}=this,A=s.scale,[T,w]=A.range,N=Math.abs(w-T),O=F=>A.convert(h[F])+v,P=I?.find(F=>F.maxRange>N);if(P==null){const F=i.invalidData?.get(this.id);let[_,z]=iz(1,c.length,s.range,B=>{const R=S?0:-b/2,V=O(B)+R;return[V,V+b]});i.input.count<1e3&&(_=0,z=i.input.count);for(let B=_;B=V&&$>=j;if(!Y){K.warnOnce(`invalid low value for key [${l}] in data element, low value cannot be higher than datum open or close values`);continue}if(!se){K.warnOnce(`invalid high value for key [${r}] in data element, high value cannot be lower than datum open or close values.`);continue}L(B,R,V,j,$,W,b,!0)}}else{const{maxRange:F,indexData:_}=P,[z,B]=iz(1,F,s.range,R=>{const V=R*XR,j=_[V+qR],$=_[V+QR];if(j===-1)return;const W=S?0:-b/2;return[O(j)+W,O($)+W+b]});for(let R=z;R{const p=this.makeItemStylerParams(s,e,t,h);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`,"item",s],this.callWithContext(r,p))});u&&(h=sz(u,h))}return h}makeItemStylerParams(e,t,i,s){const{id:n,properties:o,processedData:a}=this,{xKey:r,openKey:l,closeKey:c,highKey:h,lowKey:d}=o,u=a.dataSources.get(n)?.data[t],p=this.ctx.highlightManager?.getActiveHighlight(),g=this.getHighlightStateString(p,i,t),f={seriesId:n,datum:u,itemId:e,xKey:r,openKey:l,closeKey:c,highKey:h,lowKey:d,highlighted:i,highlightState:g,...s};return"fill"in f&&"fill"in s&&(f.fill=this.filterItemStylerFillParams(s.fill)??s.fill),f}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:n}=this,{xKey:o,xName:a,yName:r,openKey:l,openName:c,highKey:h,highName:d,lowKey:u,lowName:p,closeKey:g,closeName:f,legendItemName:x,tooltip:m}=n,v=this.getCategoryAxis(),b=this.getValueAxis();if(!i||!s||!v||!b)return;const S=s.dataSources.get(this.id)?.data[e],D=i.resolveKeysById(this,"xValue",s)[e],L=i.resolveColumnById(this,"openValue",s)[e],I=i.resolveColumnById(this,"highValue",s)[e],A=i.resolveColumnById(this,"lowValue",s)[e],T=i.resolveColumnById(this,"closeValue",s)[e];if(D==null)return;const w=T>=L?"up":"down",N=this.properties.item[w],O=this.getItemStyle(e,!1),P={fill:N.fill??N.stroke,fillOpacity:N.fillOpacity??N.strokeOpacity??1,stroke:N.stroke,strokeWidth:N.strokeWidth??1,strokeOpacity:N.strokeOpacity??1,lineDash:N.lineDash??[0],lineDashOffset:N.lineDashOffset??0};return this.formatTooltipWithContext(m,{heading:this.getAxisValueText(v,"tooltip",D,S,o,x),title:x,symbol:{marker:P},data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(b,"tooltip",L,S,l,x)},{label:d,fallbackLabel:h,value:this.getAxisValueText(b,"tooltip",I,S,h,x)},{label:p,fallbackLabel:u,value:this.getAxisValueText(b,"tooltip",A,S,u,x)},{label:f,fallbackLabel:g,value:this.getAxisValueText(b,"tooltip",T,S,g,x)}]},{seriesId:t,datum:S,title:r,itemId:w,xKey:o,xName:a,yName:r,openKey:l,openName:c,highKey:h,highName:d,lowKey:u,lowName:p,closeKey:g,closeName:f,...O})}computeFocusBounds(e){const t=this.getNodeData()?.at(e.datumIndex);if(t==null)return;const{centerX:i,y:s,width:n,height:o}=t,a={x:i-n/2,y:s,width:n,height:o};return uQ(this,a)}},{Path:bQ,SceneChangeDetection:rc,BBox:vQ}=k,Xr=class extends bQ{constructor(){super(...arguments),this.centerX=0,this.y=0,this.width=0,this.height=0,this.yOpen=0,this.yClose=0,this.crisp=!1}computeBBox(){const{centerX:e,y:t,width:i,height:s}=this;return new vQ(e-i/2,t,i,s)}isPointInPath(e,t){return this.getBBox().containsPoint(e,t)}distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}get midPoint(){return{x:this.centerX,y:this.y+this.height/2}}alignedCoordinates(){const{y:e,width:t,height:i,crisp:s}=this;let{centerX:n,yOpen:o,yClose:a}=this,r=n-t/2,l=n+t/2,c=e,h=e+i;if(s&&t>1){if(n=this.align(n),o<=a){const u=this.align(o,a-o);o=this.align(o),a=o+u}else{const u=this.align(a,o-a);a=this.align(a),o=a+u}const d=this.align(t/2);r=n-d,l=n+d,c=this.align(e),h=c+this.align(c,i)}return{centerX:n,x0:r,x1:l,y0:c,y1:h,yOpen:o,yClose:a}}executeStroke(e,t){const{width:i,strokeWidth:s}=this;i0?l/this.strokeAlignment/2%1:0;e.clear(),e.moveTo(t-c,n),e.lineTo(t-c,o),Math.abs(s-i)>1&&(e.moveTo(i,a-c),e.lineTo(t-c,a-c),e.moveTo(t-c,r-c),e.lineTo(s,r-c))}};y([rc()],oz.prototype,"strokeAlignment",2);var{SceneArrayChangeDetection:SQ,SceneChangeDetection:Tf,ExtendedPath2D:MQ,BBox:DQ}=k,Fh=class extends Xr{constructor(){super(...arguments),this.wickPath=new MQ,this.wickStroke=void 0,this.wickStrokeWidth=void 0,this.wickStrokeOpacity=void 0,this.wickStrokeAlignment=0}computeDefaultGradientFillBBox(){const{width:e,centerX:t,yOpen:i,yClose:s}=this,n=Math.min(i,s),a=Math.max(i,s)-n,r=t-e/2,l=t+e/2;return new DQ(r,n,l-r,a)}updatePath(){const{path:e,stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:n,lineDashOffset:o,wickStroke:a,wickStrokeWidth:r,wickStrokeOpacity:l,wickLineDash:c,wickLineDashOffset:h}=this,{centerX:d,x0:u,x1:p,y0:g,y1:f,yOpen:x,yClose:m}=this.alignedCoordinates(),v=this.layerManager?.canvas.pixelRatio??1,b=this.wickStrokeAlignment>0?v/this.wickStrokeAlignment/2%1:0;this.path.clear(),this.wickPath.clear();const D=a!=null&&a!==t||r!=null&&r!==i||l!=null&&l!==s||c!=null&&c!==n||h!=null&&h!==o?this.wickPath:e;if(Math.abs(p-u)<=3){D.moveTo(d-b,g),D.lineTo(d-b,f);return}const L=Math.min(x,m),I=Math.max(x,m),A=i/2;D.moveTo(d-b,g),D.lineTo(d-b,L+A),D.moveTo(d-b,f),D.lineTo(d-b,I-A);const T=I-L-2*A;if(T>0)e.rect(u+A,L+A,p-u-2*A,T);else{const w=(L+I)/2;e.moveTo(u,w),e.lineTo(p,w)}}drawPath(e){super.drawPath(e);const{wickPath:t}=this;if(t.isEmpty())return;const{stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,wickStroke:r=i,wickStrokeWidth:l=s,wickStrokeOpacity:c=n,wickLineDash:h=o,wickLineDashOffset:d=a}=this;l!==0&&(e.globalAlpha*=c,typeof r=="string"&&(e.strokeStyle=r),e.lineWidth=l,h!=null&&e.setLineDash([...h]),e.lineDashOffset=d,e.stroke(t.getPath2D()))}};y([Tf()],Fh.prototype,"wickStroke",2),y([Tf()],Fh.prototype,"wickStrokeWidth",2),y([Tf()],Fh.prototype,"wickStrokeOpacity",2),y([SQ()],Fh.prototype,"wickLineDash",2),y([Tf()],Fh.prototype,"wickLineDashOffset",2),y([Tf()],Fh.prototype,"wickStrokeAlignment",2);var{BaseProperties:az,Property:xi,AbstractBarSeriesProperties:kQ,makeSeriesTooltip:IQ}=k,Bh=class extends az{constructor(){super(...arguments),this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};y([xi],Bh.prototype,"stroke",2),y([xi],Bh.prototype,"strokeWidth",2),y([xi],Bh.prototype,"strokeOpacity",2),y([xi],Bh.prototype,"lineDash",2),y([xi],Bh.prototype,"lineDashOffset",2);var YI=class extends az{constructor(){super(...arguments),this.up=new Bh,this.down=new Bh}};y([xi],YI.prototype,"up",2),y([xi],YI.prototype,"down",2);var $n=class extends kQ{};y([xi],$n.prototype,"xKey",2),y([xi],$n.prototype,"openKey",2),y([xi],$n.prototype,"closeKey",2),y([xi],$n.prototype,"highKey",2),y([xi],$n.prototype,"lowKey",2),y([xi],$n.prototype,"xName",2),y([xi],$n.prototype,"yName",2),y([xi],$n.prototype,"openName",2),y([xi],$n.prototype,"closeName",2),y([xi],$n.prototype,"highName",2),y([xi],$n.prototype,"lowName",2);var Zb=class extends $n{constructor(){super(...arguments),this.tooltip=IQ(),this.item=new YI}getStyle(e){const{strokeWidth:t,strokeOpacity:i,stroke:s,lineDash:n,lineDashOffset:o}=this.item[e];return{stroke:s,strokeWidth:t,strokeOpacity:i,lineDash:n,lineDashOffset:o,opacity:1}}};y([xi],Zb.prototype,"tooltip",2),y([xi],Zb.prototype,"item",2),y([xi],Zb.prototype,"itemStyler",2);var{BaseProperties:ZI,makeSeriesTooltip:AQ,Property:Yi}=k,Hu=class extends ZI{};y([Yi],Hu.prototype,"stroke",2),y([Yi],Hu.prototype,"strokeWidth",2),y([Yi],Hu.prototype,"strokeOpacity",2),y([Yi],Hu.prototype,"lineDash",2),y([Yi],Hu.prototype,"lineDashOffset",2);var pa=class extends ZI{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#333",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.wick=new Hu}};y([Yi],pa.prototype,"fill",2),y([Yi],pa.prototype,"fillOpacity",2),y([Yi],pa.prototype,"stroke",2),y([Yi],pa.prototype,"strokeWidth",2),y([Yi],pa.prototype,"strokeOpacity",2),y([Yi],pa.prototype,"lineDash",2),y([Yi],pa.prototype,"lineDashOffset",2),y([Yi],pa.prototype,"cornerRadius",2),y([Yi],pa.prototype,"wick",2);var XI=class extends ZI{constructor(){super(...arguments),this.up=new pa,this.down=new pa}};y([Yi],XI.prototype,"up",2),y([Yi],XI.prototype,"down",2);var Xb=class extends $n{constructor(){super(),this.item=new XI,this.tooltip=AQ(),this.highlightStyle.deprecated=!1}getStyle(e){const{fill:t,fillOpacity:i,strokeWidth:s,strokeOpacity:n,stroke:o,lineDash:a,lineDashOffset:r,cornerRadius:l,wick:c}=this.item[e];return{fill:t,fillOpacity:i,stroke:o,strokeWidth:s,strokeOpacity:n,lineDash:a,lineDashOffset:r,cornerRadius:l,opacity:1,wick:c}}};y([Yi],Xb.prototype,"item",2),y([Yi],Xb.prototype,"tooltip",2),y([Yi],Xb.prototype,"itemStyler",2);var{isGradientFill:rz,isPatternFill:qI,isImageFill:QI,applyShapeStyle:CQ}=k,qb=class extends nz{constructor(){super(...arguments),this.properties=new Xb}nodeFactory(){const e=new Fh;return e.lineCap="butt",e}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s.datumIndex,t,void 0,s.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:s}=this;if(!i)return;const n=this.ctx.highlightManager.getActiveHighlight(),{up:o,down:a}=s.item;e.each((r,l)=>{const{centerX:c,width:h,y:d,height:u,yOpen:p,yClose:g,crisp:f}=l,x=l.isRising?o:a,m=l.style??i.styles[l.itemId][this.getHighlightState(n,t,l.datumIndex)];r.centerX=c,r.width=h,r.y=d,r.height=u,r.yOpen=p,r.yClose=g,r.crisp=f,CQ(r,m,this.getShapeFillBBox());const v=m?.wick;r.wickStroke=v?.stroke,r.wickStrokeWidth=v?.strokeWidth,r.wickStrokeOpacity=v?.strokeOpacity,r.wickLineDash=v?.lineDash,r.wickLineDashOffset=v?.lineDashOffset,r.wickStrokeAlignment=x.wick.strokeWidth??x.strokeWidth})}legendItemSymbol(){const{up:e,down:t}=this.properties.item,i=rz(e.fill)?e.fill.colorStops.map(a=>typeof a=="string"?a:{color:a.color,stop:a.stop==null?void 0:a.stop*.5}):[{color:qI(e.fill)||QI(e.fill)?e.stroke:e.fill,stop:0},{color:qI(e.fill)||QI(e.fill)?e.stroke:e.fill,stop:.5}],s=rz(t.fill)?t.fill.colorStops.map(a=>typeof a=="string"?a:{color:a.color,stop:a.stop==null?void 0:a.stop*.5}):[{color:qI(t.fill)||QI(t.fill)?t.stroke:t.fill,stop:.5}],n={type:"gradient",gradient:"linear",rotation:90,colorStops:[...i,...s],reverse:!1},o={type:"gradient",gradient:"linear",rotation:90,colorStops:[{color:e.stroke,stop:0},{color:e.stroke,stop:.5},{color:t.stroke,stop:.5}],reverse:!1};return{marker:{fill:n,fillOpacity:e.fillOpacity,stroke:o,strokeWidth:e.strokeWidth??1,strokeOpacity:e.strokeOpacity??1,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset}}}getLegendData(e){const{id:t,data:i,visible:s,ctx:{legendManager:n}}=this,{xKey:o,yName:a,showInLegend:r,legendItemName:l}=this.properties;return!i?.data.length||!o||e!=="category"?[]:[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:s&&n.getItemEnabled({seriesId:t,itemId:t}),label:{text:l??a??t},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!r}]}hasItemStylers(){return this.properties.itemStyler!=null}};qb.className="CandleStickSeries",qb.type="candlestick";var{commonSeriesOptionsDefs:LQ,candlestickSeriesThemeableOptionsDef:TQ}=k,JI={...LQ,...TQ,type:U(Ce("candlestick")),xKey:U(E),openKey:U(E),highKey:U(E),lowKey:U(E),closeKey:U(E),xName:E,yName:E,openName:E,highName:E,lowName:E,closeName:E};JI.pickOutsideVisibleMinorAxis=me(G),JI.focusPriority=me(Z);var{ThemeConstants:{CARTESIAN_AXIS_TYPE:lz},multiSeriesHighlightStyle:wQ,FILL_GRADIENT_LINEAR_KEYED_DEFAULTS:NQ,FILL_IMAGE_DEFAULTS:OQ,FILL_PATTERN_KEYED_DEFAULTS:EQ}=k;function cz(e){return{fill:{$applySwitch:[{$path:"type"},{$if:[{$eq:[{$palette:"type"},"user-indexed"]},e==="up"?"transparent":{$palette:"fill"},{$palette:`${e}.fill`}]},["gradient",NQ(e)],["image",OQ],["pattern",EQ(e)]]},stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:`${e}.stroke`}]}}}var PQ={series:{item:{up:cz("up"),down:cz("down")},highlightStyle:{item:{strokeWidth:3}},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:wQ()},animation:{enabled:!1},axes:{[lz.NUMBER]:{crosshair:{snap:!1}},[lz.ORDINAL_TIME]:{groupPaddingInner:0,crosshair:{enabled:!0}}}},{CARTESIAN_AXIS_TYPE:hz,CARTESIAN_POSITION:dz}=k.ThemeConstants,RQ={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"candlestick",moduleFactory:e=>new qb(e),defaultAxes:[{type:hz.NUMBER,position:dz.LEFT},{type:hz.ORDINAL_TIME,position:dz.BOTTOM}],themeTemplate:PQ,groupable:!1},uz={type:"series",name:"candlestick",chartType:"cartesian",enterprise:!0,options:JI,create:e=>new qb(e)};function zQ(e,t){const{fontSize:i,minimumFontSize:s=i}=e,{fontSize:n,minimumFontSize:o=n}=t,a=i-s,r=n-o;let l=e.fontSize,c=t.fontSize;const h=[{labelFontSize:i,secondaryLabelFontSize:n}];for(;l>s||c>o;){const d=a>0?(l-s)/a:-1,u=r>0?(c-o)/r:-1;d>u?l--:c--,h.push({labelFontSize:l,secondaryLabelFontSize:c})}return h.reverse(),h}function pz(e,t,i,s,{padding:n},o){const{spacing:a=0}=t,r=2*n,l=2*n+a,c=(t.minimumFontSize??t.fontSize)+(s.minimumFontSize??s.fontSize);if(c>o(c+l,!1).height-l)return;const h=zQ(t,s),d={fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight},u={fontFamily:s.fontFamily,fontStyle:s.fontStyle,fontWeight:s.fontWeight};let p,g;return rL(0,h.length-1,f=>{const{labelFontSize:x,secondaryLabelFontSize:m}=h[f],v=f===0,b={...d,fontSize:x},S={...u,fontSize:m},D=Je(b).lineHeight(),L=Je(S).lineHeight(),I=o(D+L+l,v),A=I.width-r,T=I.height-l;if(D+L>T||((p==null||p.fontSize!==x)&&(p=fz(t,e,A,T,b,t.wrapping,v?t.overflowStrategy:"hide")),p==null||p.width>A||p.height>T)||((g==null||g.fontSize!==m)&&(g=fz(s,i,A,T,S,s.wrapping,v?s.overflowStrategy:"hide")),g==null))return;const w=p.height+g.height;if(!(g.width>A||w>T))return{width:Math.max(p.width,g.width),height:w+a,meta:I.meta,label:p,secondaryLabel:g}})}function wf(e,t,{padding:i},s){const n=2*i,o=Math.min(t.minimumFontSize??t.fontSize,t.fontSize),a={fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight};return rL(o,t.fontSize,r=>{const l={...a,fontSize:r},c=Je(l),h=r===o,d=t.lineHeight??c.lineHeight(),u=s(d+n,h),p=u.width-n,g=u.height-n;if(d>g||p<0)return;const f=ky(e,{maxWidth:p,maxHeight:g,font:l,textWrap:t.wrapping,overflow:(h?t.overflowStrategy:null)??"hide"});if(!f.length)return;const{width:x,height:m}=c.measureLines(f),v=f.join(` +`);return[{width:x,height:m,text:v,fontSize:r,lineHeight:d},u.meta]})}function gz(e){return e?.minimumFontSize!=null&&e?.fontSize!=null&&e?.minimumFontSize>e?.fontSize}function eA(e,t,i,s,n,o){const a=t.enabled?e:void 0,r=s.enabled?i:void 0;(gz(t)||gz(s))&&K.warnOnce("minimumFontSize should be set to a value less than or equal to the font size");let l;a!=null&&r!=null&&(l=pz(a,t,r,s,n,o));let c;if(l==null&&a!=null&&(c=wf(a,t,n,o)),c!=null){const[d,u]=c;l={width:d.width,height:d.height,meta:u,label:d,secondaryLabel:void 0}}let h;if(l==null&&a==null&&r!=null&&(h=wf(r,s,n,o)),h!=null){const[d,u]=h;l={width:d.width,height:d.height,meta:u,label:void 0,secondaryLabel:d}}return l}function fz(e,t,i,s,n,o,a){const r=ky(t,{maxWidth:i,maxHeight:s,font:n,textWrap:o,overflow:a});if(!r.length)return;const l=Je(n),c=e.lineHeight??l.lineHeight(),{width:h}=l.measureLines(r);return{width:h,lineHeight:c,text:r.join(` +`),height:r.length*c,fontSize:n.fontSize}}var{Property:Nf}=k,Wu=class extends k.Label{constructor(){super(...arguments),this.wrapping="on-space",this.overflowStrategy="ellipsis"}};y([Nf],Wu.prototype,"wrapping",2),y([Nf],Wu.prototype,"overflowStrategy",2),y([Nf],Wu.prototype,"lineHeight",2),y([Nf],Wu.prototype,"minimumFontSize",2);var Qa=class extends Wu{constructor(){super(...arguments),this.spacing=0}};y([Nf],Qa.prototype,"spacing",2);var Of=class extends Wu{},{CartesianSeriesProperties:FQ,makeSeriesTooltip:BQ,Property:Ls}=k,ts=class extends FQ{constructor(){super(...arguments),this.colorRange=["black","black"],this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.textAlign="center",this.verticalAlign="middle",this.itemPadding=0,this.label=new Qa,this.tooltip=BQ()}};y([Ls],ts.prototype,"title",2),y([Ls],ts.prototype,"xKey",2),y([Ls],ts.prototype,"yKey",2),y([Ls],ts.prototype,"colorKey",2),y([Ls],ts.prototype,"xName",2),y([Ls],ts.prototype,"yName",2),y([Ls],ts.prototype,"colorName",2),y([Ls],ts.prototype,"colorRange",2),y([Ls],ts.prototype,"stroke",2),y([Ls],ts.prototype,"strokeOpacity",2),y([Ls],ts.prototype,"strokeWidth",2),y([Ls],ts.prototype,"textAlign",2),y([Ls],ts.prototype,"verticalAlign",2),y([Ls],ts.prototype,"itemPadding",2),y([Ls],ts.prototype,"itemStyler",2),y([Ls],ts.prototype,"label",2),y([Ls],ts.prototype,"tooltip",2);var{SeriesNodePickMode:yz,computeBarFocusBounds:_Q,getMissCount:VQ,valueProperty:tA,ChartAxisDirection:Eo,DEFAULT_CARTESIAN_DIRECTION_KEYS:GQ,DEFAULT_CARTESIAN_DIRECTION_NAMES:jQ,createDatumId:HQ,ColorScale:WQ,Rect:$Q,PointerEvents:UQ,applyShapeStyle:KQ,mergeDefaults:mz,formatValue:YQ,addHitTestersToQuadtree:ZQ,findQuadtreeMatch:xz,updateLabelNode:XQ}=k,qQ=class extends k.CartesianSeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.colorKey=s.properties.colorKey}},QQ={left:-.5,center:0,right:-.5},JQ={top:-.5,middle:0,bottom:-.5},Qb=class extends k.CartesianSeries{constructor(e){super({moduleCtx:e,propertyKeys:{...GQ,color:["colorKey"]},propertyNames:{...jQ,color:["colorName"]},categoryKey:void 0,pickModes:[yz.NEAREST_NODE,yz.EXACT_SHAPE_MATCH],pathsPerSeries:[]}),this.properties=new ts,this.NodeEvent=qQ,this.colorScale=new WQ}async processData(e){const t=this.axes[Eo.X],i=this.axes[Eo.Y];if(!t||!i||!this.data?.data.length)return;const{xKey:s,yKey:n,colorRange:o,colorKey:a}=this.properties,r=this.axes[Eo.X]?.scale,l=this.axes[Eo.Y]?.scale,{xScaleType:c,yScaleType:h}=this.getScaleInformation({xScale:r,yScale:l}),d=this.colorScale.type,{dataModel:u,processedData:p}=await this.requestDataModel(e,this.data,{props:[tA(s,c,{id:"xValue"}),tA(n,h,{id:"yValue"}),...a?[tA(a,d,{id:"colorValue",invalidValue:void 0})]:[]]});if(this.isColorScaleValid()){const g=u.resolveProcessedDataIndexById(this,"colorValue"),f=p.domain.values[g].filter(m=>m!=null),x=k.extent(f);if(this.colorScale.domain=x??[],x?.length&&x[0]===x[1]){const m=Math.floor(o.length/2);this.colorScale.range=[o[m],o[m]]}else this.colorScale.range=o;this.colorScale.update()}}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),n=i.input.count,o=VQ(this,i.defs.values[s].missing),a=t.resolveProcessedDataIndexById(this,"colorValue"),r=i.domain.values[a].filter(c=>c!=null).length;return!(n===0||n===o||r===0)}xCoordinateRange(e,t){const i=this.axes[Eo.X].scale,s=t*(i.bandwidth??0)/2,n=i.convert(e)+s,o=t*(i.bandwidth??10);return[n,n+o]}yCoordinateRange(e,t){const i=this.axes[Eo.Y].scale,s=t*(i.bandwidth??0)/2,n=i.convert(e[0])+s,o=t*(i.bandwidth??10);return[n,n+o]}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;return!t||!i?[]:e===Eo.X?t.getDomain(this,"xValue","value",i):t.getDomain(this,"yValue","value",i)}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{data:e,visible:t,axes:i,dataModel:s,processedData:n}=this,o=i[Eo.X],a=i[Eo.Y];if(!(e&&s&&n&&t&&o&&a))return;if(o.type!=="category"||a.type!=="category"){K.warnOnce(`Heatmap series expected axes to have "category" type, but received "${o.type}" and "${a.type}" instead.`);return}const{xKey:r,xName:l,yKey:c,yName:h,colorKey:d,colorName:u,textAlign:p,verticalAlign:g,itemPadding:f,label:x}=this.properties,m=s.resolveColumnById(this,"xValue",n),v=s.resolveColumnById(this,"yValue",n),b=d?s.resolveColumnById(this,"colorValue",n):void 0,S=d?s.getDomain(this,"colorValue","value",n):[],D=o.scale,L=a.scale,I=(D.bandwidth??0)/2,A=(L.bandwidth??0)/2,T=[],w=[],N=D.bandwidth??10,O=L.bandwidth??10,P=(N-2*f)*QQ[p],F=(O-2*f)*JQ[g],_=()=>({width:N,height:O,meta:null}),z=n.dataSources.get(this.id)?.data??[];for(const[B,R]of z.entries()){const V=m[B],j=v[B],$=D.convert(V)+I,W=L.convert(j)+A,Y=b?.[B],se=x.enabled&&Y!=null?this.getLabelText(Y,R,d,"color",S,x,{value:Y,datum:R,colorKey:d,colorName:u,xKey:r,yKey:c,xName:l,yName:h}):void 0,X=eA($e(se),this.properties.label,void 0,this.properties.label,{padding:f},_),Q={x:$,y:W,size:0},ie=this.getItemStyle({datumIndex:B,datum:R,colorValue:Y},!1);if(T.push({series:this,itemId:c,datumIndex:B,yKey:c,xKey:r,xValue:V,yValue:j,colorValue:Y,datum:R,point:Q,width:N,height:O,midPoint:{x:$,y:W},missing:b!=null&&Y==null,style:ie}),X?.label!=null){const{text:q,fontSize:ee,lineHeight:oe,height:le}=X.label,{fontStyle:he,fontFamily:ue,fontWeight:xe,color:be}=this.properties.label,ye=Q.x+P*(N-2*f),Te=Q.y+F*(O-2*f)-(X.height-le)*.5;w.push({series:this,itemId:c,datum:R,datumIndex:B,text:q,fontSize:ee,lineHeight:oe,fontStyle:he,fontFamily:ue,fontWeight:xe,color:be,textAlign:p,textBaseline:g,x:ye,y:Te,style:ie})}}return{itemId:this.properties.yKey??this.id,nodeData:T,labelData:w,scales:this.calculateScaling(),visible:this.visible}}nodeFactory(){return new $Q}update(e){return this.ctx.animationManager.skipCurrentBatch(),super.update(e)}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,s=t??[];return i.update(s)}getItemStyle({datumIndex:e,datum:t,colorValue:i},s){const{properties:n}=this,{itemStyler:o,stroke:a,strokeWidth:r,strokeOpacity:l}=n,c=this.getHighlightStyle(s,e),h=mz(c,{fill:this.isColorScaleValid()&&i!=null?this.colorScale.convert(i):"transparent",fillOpacity:1,stroke:a,strokeWidth:r,strokeOpacity:l,opacity:1});let d;return o!=null&&e!=null&&(d=this.cachedDatumCallback(HQ(e,s?"highlight":"node"),()=>{const u=this.makeItemStylerParams(t,e,s,h);return this.callWithContext(o,u)})),d?mz(d,h):h}makeItemStylerParams(e,t,i,s){const{id:n,properties:o}=this,{xKey:a,yKey:r}=o,l=this.ctx.highlightManager?.getActiveHighlight(),c=this.getHighlightStateString(l,i,t),h=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:n,datum:e,xKey:a,yKey:r,highlighted:i,highlightState:c,...s,fill:h}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){const t=this.axes[Eo.X],[i,s]=t?.visibleRange??[],o=!(i!==0||s!==1);e.each((a,r)=>{const{point:l,width:c,height:h,style:d}=r;KQ(a,d),a.crisp=o,a.x=Math.floor(l.x-c/2),a.y=Math.floor(l.y-h/2),a.width=Math.ceil(c),a.height=Math.ceil(h)})}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e,{enabled:s}=this.properties.label,n=s?t:[];return i.update(n)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,s)=>{i.pointerEvents=UQ.None,i.text=s.text,i.fillOpacity=this.getHighlightStyle(!1,s.datumIndex)?.opacity??1,XQ(this,i,this.properties,this.properties.label,s,!1,t)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:n,properties:o,colorScale:a,ctx:r}=this,{formatManager:l}=r,{xKey:c,xName:h,yKey:d,yName:u,colorKey:p,colorName:g,colorRange:f,title:x,legendItemName:m,tooltip:v}=o,b=n[Eo.X],S=n[Eo.Y];if(!i||!s||!b||!S)return;const D=s.dataSources.get(this.id)?.data[e],L=i.resolveColumnById(this,"xValue",s)[e],I=i.resolveColumnById(this,"yValue",s)[e],A=p!=null&&this.isColorScaleValid()?i.resolveColumnById(this,"colorValue",s)[e]:void 0;if(L==null)return;const T=[];let w;if(A==null)w=f[0];else{w=a.convert(A);const P=i.getDomain(this,"colorValue","value",s),F=l.format(this.callWithContext.bind(this),{type:"number",value:A,datum:D,seriesId:t,legendItemName:m,key:p,source:"tooltip",property:"color",domain:P,boundSeries:this.getFormatterContext("color"),fractionDigits:void 0});T.push({label:g,fallbackLabel:p,value:F??YQ(A)})}T.push({label:h,fallbackLabel:c,value:this.getAxisValueText(b,"tooltip",L,D,c,m)},{label:u,fallbackLabel:d,value:this.getAxisValueText(S,"tooltip",I,D,d,m)});const N=this.getItemStyle({datumIndex:e,datum:D,colorValue:A},!1);N.fill!=null&&(w=N.fill);const O=w==null?void 0:{marker:{shape:"square",fill:w,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0}};return this.formatTooltipWithContext(v,{title:x??m,symbol:O,data:T},{seriesId:t,datum:D,title:x,xKey:c,xName:h,yKey:d,yName:u,colorKey:p,colorName:g,...N})}getLegendData(e){return e!=="gradient"||!this.isColorScaleValid()||!this.dataModel?[]:[{legendType:"gradient",enabled:this.visible,seriesId:this.id,series:this.getFormatterContext("color"),colorDomain:this.colorScale.domain,colorRange:this.colorScale.range}]}isLabelEnabled(){return this.properties.label.enabled&&!!this.properties.colorKey}getBandScalePadding(){return{inner:0,outer:0}}computeFocusBounds({datumIndex:e}){const t=this.contextNodeData?.nodeData[e];if(t===void 0)return;const{width:i,height:s,midPoint:n}=t,o={x:n.x-i/2,y:n.y-s/2,width:i,height:s};return _Q(this,o)}initQuadTree(e){ZQ(e,this.datumNodesIter())}pickNodesExactShape(e){const t=xz(this,e);return t!=null&&t.distance<=0?[t.datum]:[]}pickNodeClosestDatum(e){return xz(this,e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};Qb.className="HeatmapSeries",Qb.type="heatmap";var{commonSeriesOptionsDefs:e7,heatmapSeriesThemeableOptionsDef:t7,without:bz}=k,i7={...bz(t7,["showInLegend"]),...bz(e7,["showInLegend"]),type:U(Ce("heatmap")),xKey:U(E),yKey:U(E),colorKey:E,xName:E,yName:E,colorName:E,colorRange:Me(ae)},s7={series:{stroke:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$ref:"chartBackgroundColor"},{$path:["/0",{$palette:"stroke"},{$palette:"strokes"}]}]},strokeWidth:{$isUserOption:["./stroke",2,void 0]},colorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"divergingColors"},k.SAFE_RANGE2_OPERATION]},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!1,color:{$ref:"textColor"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},wrapping:"on-space",overflowStrategy:"ellipsis"},itemPadding:3,highlight:k.singleSeriesHighlightStyle()},gradientLegend:{enabled:!0,...k.LEGEND_CONTAINER_THEME}},{ThemeConstants:{CARTESIAN_AXIS_TYPE:vz,CARTESIAN_POSITION:Sz}}=k,n7={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"heatmap",moduleFactory:e=>new Qb(e),defaultAxes:[{type:vz.CATEGORY,position:Sz.LEFT},{type:vz.CATEGORY,position:Sz.BOTTOM}],themeTemplate:s7},Mz={type:"series",name:"heatmap",chartType:"cartesian",enterprise:!0,options:i7,create:e=>new Qb(e)},{applyShapeStyle:o7}=k,Jb=class extends nz{constructor(){super(...arguments),this.properties=new Zb}nodeFactory(){const e=new oz;return e.lineCap="square",e}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s.datumIndex,t,void 0,s.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i,properties:s}=this;if(!i)return;const n=this.ctx.highlightManager.getActiveHighlight(),{up:o,down:a}=s.item;e.each((r,l)=>{const{centerX:c,width:h,y:d,height:u,yOpen:p,yClose:g,crisp:f}=l,x=l.isRising?o:a;r.centerX=c,r.width=h,r.y=d,r.height=u,r.yOpen=p,r.yClose=g,r.crisp=f;const m=l.style??i.styles[l.itemId][this.getHighlightState(n,t,l.datumIndex)];o7(r,m),r.strokeAlignment=x.strokeWidth})}getLegendData(e){const{id:t,data:i,ctx:{legendManager:s},visible:n}=this,{xKey:o,yName:a,item:{up:r,down:l},showInLegend:c,legendItemName:h}=this.properties;if(!i?.data.length||!o||e!=="category")return[];const d={type:"gradient",gradient:"linear",colorSpace:"rgb",colorStops:[{color:r.stroke,stop:0},{color:r.stroke,stop:.5},{color:l.stroke,stop:.5}],rotation:90};return[{legendType:"category",id:t,itemId:t,seriesId:t,enabled:n&&s.getItemEnabled({seriesId:t,itemId:t}),label:{text:h??a??t},symbol:{marker:{fill:d,fillOpacity:r.strokeOpacity,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0}},legendItemName:h,hideInLegend:!c}]}hasItemStylers(){return this.properties.itemStyler!=null}};Jb.className="ohlc",Jb.type="ohlc";var{commonSeriesOptionsDefs:a7,ohlcSeriesThemeableOptionsDef:r7}=k,iA={...a7,...r7,type:U(Ce("ohlc")),xKey:U(E),openKey:U(E),highKey:U(E),lowKey:U(E),closeKey:U(E),xName:E,yName:E,openName:E,highName:E,lowName:E,closeName:E};iA.pickOutsideVisibleMinorAxis=me(G),iA.focusPriority=me(Z);var{ThemeConstants:{CARTESIAN_AXIS_TYPE:ev,CARTESIAN_POSITION:Dz},multiSeriesHighlightStyle:l7}=k,c7={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"ohlc",moduleFactory:e=>new Jb(e),defaultAxes:[{type:ev.NUMBER,position:Dz.LEFT},{type:ev.ORDINAL_TIME,position:Dz.BOTTOM}],themeTemplate:{animation:{enabled:!1},series:{item:{up:{stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:"up.stroke"}]}},down:{stroke:{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$palette:"stroke"},{$palette:"down.stroke"}]}}},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:l7(!1)},axes:{[ev.NUMBER]:{crosshair:{snap:!1}},[ev.ORDINAL_TIME]:{groupPaddingInner:0,crosshair:{enabled:!0}}}},groupable:!1},kz={type:"series",name:"ohlc",chartType:"cartesian",enterprise:!0,options:iA,create:e=>new Jb(e)},{AGGREGATION_INDEX_Y_MAX:h7,AGGREGATION_INDEX_Y_MIN:d7,aggregationDomain:u7,aggregationIndexForXRatio:Iz,aggregationRangeFittingPoints:p7,aggregationXRatioForXValue:Az,compactAggregationIndices:g7,createAggregationIndices:f7}=k,y7=1e3;function Cz(e,t,i,s,n,o,a){const r=e[o];if(r==null)return!1;const l=Az(r,t,i,a),c=Iz(l,n);return o===s[c+h7]}function Lz(e,t,i,s,n,o,a){const r=e[o];if(r==null)return!1;const l=Az(r,t,i,a),c=Iz(l,n);return o===s[c+d7]}function m7(e,t,i,s,n,o,a){if(t.length64;)({maxRange:c}=g7(h,d,c,{inPlace:!0})),u=u.filter(f=>Cz(t,r,l,h,c,f,o)),p=p.filter(f=>Lz(t,r,l,h,c,f,o)),g.push({maxRange:c,topIndices:u,bottomIndices:p});return g.reverse(),g}function Tz({span:e},t){switch(e.type){case"linear":case"step":case"multi-line":{const i=(t-e.x0)/(e.x1-e.x0);return e.y0+i*(e.y1-e.y0)}case"cubic":{const{cp0x:i,cp0y:s,cp1x:n,cp1y:o,cp2x:a,cp2y:r,cp3x:l,cp3y:c}=e;let h=.5;const d=1e-6;for(let p=0;p<10;p++){const g=1-h,x=g*g*g*i+3*g*g*h*n+3*g*h*h*a+h*h*h*l-t;if(Math.abs(x)=o.x&&t<=a.x)return{span:n,index:s};if(tl;return{intersection:s===c?null:{x:i,y:r},spanIndex:o.index,isInverted:c}}function b7(e,t,i,s,n=!1){if(e.length===0||t.length===0)return[];const o=[];let a=n,r=0;for(let l=i;l<=s;l+=.5){const c=x7(e,t,l,a,r);c.intersection&&o.push(c.intersection.x),r=c.spanIndex,a=c.isInverted}return o}function v7(e,t,i,s,n={}){const o=Math.max(t.x,i.width-(t.x+t.width)),a=Math.max(t.y,i.height-(t.y+t.height)),r=[],l=(h,d)=>({x0:h,y0:-a,x1:d,y1:t.height+a});s&&r.push({clipRect:l(-o,e[0]??t.width+o),...n});const c=s?1:0;for(let h=c;h{$u(l,c,t.removed),$u(l,c,i.removed)},o=(l,c)=>{$u(l,c,t.moved),$u(l,c,i.moved)},a=(l,c)=>{$u(l,c,t.added),$u(l,c,i.added)},r=L7(e,s);return{status:e,path:{addPhaseFn:a,updatePhaseFn:o,removePhaseFn:n},pathProperties:r}}function w7(e,t,i){const s=e.scales.x?.type==="category",n=t.scales.x?.type==="category";if(s!==n||!Nz(e.scales.x)||!Nz(t.scales.x))return;let o="updated";t.visible&&!e.visible?o="removed":!t.visible&&e.visible&&(o="added");const a=sv({scales:e.scales,data:e.fillData.spans},{scales:t.scales,data:t.fillData.spans},iv.Split);if(a==null)return;const r=sv({scales:e.scales,data:e.fillData.phantomSpans},{scales:t.scales,data:t.fillData.phantomSpans},iv.Split);if(r==null)return;const l=sv({scales:e.scales,data:e.highStrokeData.spans},{scales:t.scales,data:t.highStrokeData.spans},iv.Split);if(l==null)return;const c=sv({scales:e.scales,data:e.lowStrokeData.spans},{scales:t.scales,data:t.lowStrokeData.spans},iv.Split);if(c==null)return;const h="fade",d=C7(o,a,r,h),u=T7(o,l,c,h),p=(i?.changed??!0)||!Oz(e.scales.x,t.scales.x)||!Oz(e.scales.y,t.scales.y)||o!=="updated";return{status:o,fill:d,stroke:u,hasMotion:p}}var{valueProperty:Ez,keyProperty:N7,ChartAxisDirection:is,mergeDefaults:O7,updateLabelNode:E7,fixNumericExtent:Pz,buildResetPathFn:P7,resetLabelFn:R7,resetMarkerFn:z7,resetMarkerPositionFn:Rz,pathSwipeInAnimation:F7,resetMotion:B7,markerSwipeScaleInAnimation:_7,seriesLabelFadeInAnimation:aA,animationValidation:V7,diff:G7,updateClipPath:rA,computeMarkerFocusBounds:zz,plotAreaPathFill:j7,plotLinePathStroke:Fz,interpolatePoints:Bz,pathFadeInAnimation:lA,markerFadeInAnimation:_z,fromToMotion:cA,pathMotion:hA,extent:H7,applyShapeFillBBox:W7,PointerEvents:nv,Marker:$7,BBox:U7,findMinMax:K7,applyShapeStyle:Y7,processedDataIsAnimatable:Z7,simpleMemorize2:X7,markerEnabled:q7,getMarkerStyles:Q7,calculateSegments:J7,toHighlightString:eJ,HighlightState:tJ}=k,iJ=X7(m7),sJ=class extends k.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.yLowKey=s.properties.yLowKey,this.yHighKey=s.properties.yHighKey}},nJ=k.CartesianSeries,ov=class extends nJ{constructor(e){super({moduleCtx:e,pathsPerSeries:["fill","lowStroke","highStroke"],pickModes:[k.SeriesNodePickMode.AXIS_ALIGNED],propertyKeys:{[is.X]:["xKey"],[is.Y]:["yLowKey","yHighKey"]},propertyNames:{[is.X]:["xName"],[is.Y]:["yLowName","yHighName","yName"]},categoryKey:"xValue",animationResetFns:{path:P7({getVisible:()=>this.visible,getOpacity:()=>this.getOpacity()}),label:R7,datum:(t,i)=>({...z7(t),...Rz(t,i)})},clipFocusBox:!1}),this.properties=new Ot,this.NodeEvent=sJ,this.dataAggregationFilters=void 0}async processData(e){const{xKey:t,yLowKey:i,yHighKey:s}=this.properties,n=this.axes[is.X]?.scale,o=this.axes[is.Y]?.scale,{xScaleType:a,yScaleType:r}=this.getScaleInformation({xScale:n,yScale:o}),l=[],c=!this.ctx.animationManager.isSkipped();!this.ctx.animationManager.isSkipped()&&this.processedData&&l.push(G7(this.id,this.processedData)),c&&l.push(V7());const{dataModel:h,processedData:d}=await this.requestDataModel(e,this.data,{props:[N7(t,a,{id:"xValue"}),Ez(i,r,{id:"yLowValue"}),Ez(s,r,{id:"yHighValue"}),...l]});this.dataAggregationFilters=this.aggregateData(h,d),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||Z7(t))return;const i=this.axes[is.X];if(i==null)return;const s=e.resolveKeysById(this,"xValue",t),n=e.resolveColumnById(this,"yHighValue",t),o=e.resolveColumnById(this,"yLowValue",t),{index:a}=e.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[a],l=e.resolveColumnNeedsValueOf(this,"xValue",t),c=e.resolveColumnNeedsValueOf(this,"yHighValue",t);return iJ(i.scale.type,s,n,o,r,l,c)}xCoordinateRange(e){const t=this.axes[is.X].scale.convert(e);return[t,t]}yCoordinateRange(e){const t=this.axes[is.Y].scale.convert(e[0]);return[t,t]}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!(t&&i))return[];const{domain:{keys:[s]}}=t;if(e===is.X){const n=i.resolveProcessedDataDefById(this,"xValue");return n?.def.type==="key"&&n.def.valueType==="category"?s:Pz(H7(s))}else{const n=this.domainForClippedRange(is.Y,["yHighValue","yLowValue"],"xValue"),o=K7(n);return Pz(o)}}getSeriesRange(e,t){return this.domainForVisibleRange(is.Y,["yHighValue","yLowValue"],"xValue",t)}createNodeData(){const{data:e,dataModel:t,processedData:i,axes:s}=this,n=s[is.X],o=s[is.Y];if(!(e&&n&&o&&t&&i&&this.chart?.seriesRect))return;const a=n.scale,r=o.scale,{xKey:l,yLowKey:c,yHighKey:h,connectMissingData:d,interpolation:u,fill:p,fillOpacity:g,item:f}=this.properties,x=i.dataSources.get(this.id)?.data??[],m=(a.bandwidth??0)/2,v=t.resolveKeysById(this,"xValue",i),b=t.resolveColumnById(this,"yHighValue",i),S=t.resolveColumnById(this,"yLowValue",i),D=X=>a.convert(v[X])+m,L=[],I=[],A=[],T=(X,Q,ie)=>{const q=x[X],ee=v[X];if(ee==null)return;const oe=A.at(-1);if(Number.isFinite(Q)&&Number.isFinite(ie)){const le=(Te,Ae,ze)=>{const{size:we}=f[Te].marker;I.push({index:X,series:this,itemId:Te,datum:q,datumIndex:X,midPoint:{x:ue,y:ze},yHighValue:Q,yLowValue:ie,xValue:ee,xKey:l,yLowKey:c,yHighKey:h,point:{x:ue,y:ze,size:we},enabled:!0});const Ve=this.createLabelData({datumIndex:X,point:{x:ue,y:ze},value:Ae,yLowValue:ie,yHighValue:Q,itemId:Te,inverted:he,datum:q,series:this});L.push(Ve)},he=ie>Q,ue=D(X),xe=r.convert(Q),be=r.convert(ie);le("high",Q,xe),le("low",ie,be);const ye={high:{point:{x:ue,y:xe},xDatum:ee,yDatum:Q},low:{point:{x:ue,y:be},xDatum:ee,yDatum:ie}};Array.isArray(oe)?oe.push(ye):oe==null?A.push([ye]):(oe.skip+=1,A.push([ye]))}else d||(Array.isArray(oe)||oe==null?A.push({skip:0}):oe.skip+=1)},{dataAggregationFilters:w}=this,[N,O]=a.range,P=Math.abs(O-N),F=w?.find(X=>X.maxRange>P),_=F?.topIndices,z=F?.bottomIndices;let[B,R]=this.visibleRangeIndices("xValue",n.range,_);B=Math.max(B-1,0),R=Math.min(R+1,_?.length??v.length),i.input.count<1e3&&(B=0,R=i.input.count);for(let X=B;X{if(!Array.isArray(X))return[];const Q=X.map(ie=>ie.high);return Bz(Q,u)}),j=A.flatMap(X=>{if(!Array.isArray(X))return[];const Q=X.map(ie=>ie.low);return Bz(Q,u)}),$=J7(this.properties.segmentation,n,o,this.chart.seriesRect,this.ctx.scene,!1);let W;if(this.properties.invertedStyle.enabled){const X=b[0]{const Q=f[X],{stroke:ie,strokeWidth:q,strokeOpacity:ee}=Q,oe={fill:p,fillOpacity:g,stroke:ie,strokeWidth:q,strokeOpacity:ee};return Q7(this,Q,Q.marker,oe)};return{itemId:`${c}-${h}`,labelData:L,nodeData:I,fillData:{itemId:"high",spans:V,phantomSpans:j},highStrokeData:{itemId:"high",spans:V},lowStrokeData:{itemId:"low",spans:j},scales:this.calculateScaling(),visible:this.visible,styles:{low:Y("low"),high:Y("high")},segments:$,intersectionSegments:W}}createLabelData({datumIndex:e,point:t,value:i,itemId:s,inverted:n,datum:o,series:a}){const{xKey:r,yLowKey:l,yHighKey:c,xName:h,yName:d,yLowName:u,yHighName:p,legendItemName:g,label:f}=this.properties,{placement:x}=f,m=f.spacing+(typeof f.padding=="number"?f.padding:0);let v=s;n&&(v=s==="low"?"high":"low");const b=x==="outside"&&v==="high"||x==="inside"&&v==="low"?-1:1,S=this.getSeriesDomain(is.Y);return{x:t.x,y:t.y+m*b,series:a,itemId:s,datum:o,datumIndex:e,text:this.getLabelText(i,o,s==="high"?c:l,"y",S,f,{value:i,datum:o,itemId:s,xKey:r,yLowKey:l,yHighKey:c,xName:h,yLowName:u,yHighName:p,yName:d,legendItemName:g}),textAlign:"center",textBaseline:b===-1?"bottom":"top"}}isPathOrSelectionDirty(){const{low:e,high:t}=this.properties.item;return e.marker.isDirty()||t.marker.isDirty()}strokewidthChange(){const e=t=>{const i=this.properties.item[t].strokeWidth??0,s=this.properties.highlight.highlightedSeries.item?.[t]?.strokeWidth??i,n=this.properties.highlight.highlightedItem.item?.[t]?.strokeWidth??i;return i>n||s>n};return e("low")||e("high")}updatePathNodes(e){const{visible:t}=e,[i,s,n]=e.paths,o=this.contextNodeData?.segments,a=this.ctx.highlightManager?.getActiveHighlight(),r=this.getHighlightState(a,!1),l=this.getHighlightStyle(),{item:c,fill:h,fillOpacity:d,opacity:u}=O7(l,this.getStyle(!1,r));s.setProperties({datum:o,segments:o,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:nv.None,stroke:c.low.stroke,strokeWidth:c.low.strokeWidth,strokeOpacity:c.low.strokeOpacity,lineDash:c.low.lineDash,lineDashOffset:c.low.lineDashOffset,opacity:u,visible:t}),n.setProperties({segments:o,fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:nv.None,stroke:c.high.stroke,strokeWidth:c.high.strokeWidth,strokeOpacity:c.high.strokeOpacity,lineDash:c.high.lineDash,lineDashOffset:c.high.lineDashOffset,opacity:u,visible:t});const p=this.getShapeFillBBox();W7(i,h,p),Y7(i,{stroke:void 0,fill:h,fillOpacity:d,opacity:u},p);const g=this.contextNodeData?.intersectionSegments??o;i.setProperties({segments:g,pointerEvents:nv.None,lineJoin:"round",fillShadow:this.properties.shadow,opacity:u,visible:t}),i.datum=g,rA(this,i),rA(this,s),rA(this,n)}updatePaths(e){this.updateAreaPaths(e.paths,e.contextData)}updateAreaPaths(e,t){for(const i of e)i.visible=t.visible;if(t.visible)this.updateFillPath(e,t),this.updateStrokePath(e,t);else for(const i of e)i.path.clear(),i.markDirty("RangeArea")}updateFillPath(e,t){const[i]=e;i.path.clear(),j7(i,t.fillData),i.markDirty("RangeArea")}updateStrokePath(e,t){const[,i,s]=e;i.path.clear(),s.path.clear(),Fz(i,t.lowStrokeData.spans),Fz(s,t.highStrokeData.spans),i.markDirty("RangeArea"),s.markDirty("RangeArea")}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,{processedData:s,axes:n,properties:o}=this,a=o.styler?this.getStylerMarkerOptions().item:o.item,{low:r,high:l}=a,c=q7(s.input.count,n[is.X].scale,{enabled:r.marker.enabled||l.marker.enabled});(o.item.low.marker.isDirty()||o.item.high.marker.isDirty())&&(i.clear(),i.cleanup());let h;if(c)if(r.marker.enabled&&l.marker.enabled)h=t;else{h=[];for(const d of t)a[d.itemId].marker.enabled&&h.push(d)}else h=[];return i.update(h)}updateDatumStyles({datumSelection:e,isHighlight:t}){const i=this.ctx.highlightManager.getActiveHighlight();e.each((s,n)=>{const o=this.getHighlightState(i,t,n.datumIndex),a=this.getStyle(t,o),{fill:r,fillOpacity:l,item:c}=a,{stroke:h,strokeWidth:d,strokeOpacity:u}=c[n.itemId],{marker:p}=this.properties.item[n.itemId],g=this.makeItemStylerParams(n.itemId);n.style=this.getMarkerStyle(p,n,g,{isHighlight:t,highlightState:o,resolveMarkerSubPath:["item",n.itemId,"marker"]},a.item[n.itemId].marker,{fill:r,fillOpacity:l,stroke:h,strokeWidth:d,strokeOpacity:u})})}updateDatumNodes(e){const{contextNodeData:t}=this;if(!t)return;const{datumSelection:i,isHighlight:s}=e,n=this.getShapeFillBBox(),o=this.ctx.highlightManager.getActiveHighlight();i.each((a,r)=>{const{itemId:l}=r,c=r.style??t.styles[l][this.getHighlightState(o,s,r.datumIndex)];this.applyMarkerStyle(c,a,r.point,n)}),s||(this.properties.item.low.marker.markClean(),this.properties.item.high.marker.markClean())}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;return i.update(t,s=>{s.pointerEvents=nv.None})}updateLabelNodes(e){const t={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yName:this.properties.yName,yLowKey:this.properties.yLowKey,yLowName:this.properties.yLowName??this.properties.yLowKey,yHighKey:this.properties.yHighKey,yHighName:this.properties.yHighName??this.properties.yHighKey,legendItemName:this.properties.legendItemName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,n)=>{s.fillOpacity=this.getHighlightStyle(!1,n.datumIndex).opacity??1,E7(this,s,t,this.properties.label,n,!1,i)})}getHighlightData(e,t){const i=e.filter(s=>s.datum===t.datum);return i.length>0?i:void 0}getStyle(e,t){return this.getStylerCouple(e,t)[0]}getStylerMarkerOptions(){return this.getStylerCouple(!1)[1]}getStylerCouple(e,t){const{fill:i,fillOpacity:s,item:n,styler:o}=this.properties;let a={};if(o){const h=this.makeStylerParams(e,t);a=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.cachedCallWithContext(o,h)??{},{pick:!1})??{}}const r={item:{low:{marker:{enabled:!1}},high:{marker:{enabled:!1}}}},l=h=>{const d=a.item?.[h],{lineDash:u,lineDashOffset:p,marker:g,stroke:f,strokeOpacity:x,strokeWidth:m}=n[h];return r.item[h].marker.enabled=d?.marker?.enabled??g.enabled,{marker:{fill:d?.marker?.fill??g.fill??i,fillOpacity:d?.marker?.fillOpacity??g.fillOpacity,shape:d?.marker?.shape??g.shape,size:d?.marker?.size??g.size,lineDash:d?.marker?.lineDash??g.lineDash,lineDashOffset:d?.marker?.lineDashOffset??g.lineDashOffset,stroke:d?.marker?.stroke??g.stroke??f,strokeOpacity:d?.marker?.strokeOpacity??g.strokeOpacity,strokeWidth:d?.marker?.strokeWidth??g.strokeWidth},lineDash:d?.lineDash??u,lineDashOffset:d?.lineDashOffset??p,stroke:d?.stroke??f,strokeOpacity:d?.strokeOpacity??x,strokeWidth:d?.strokeWidth??m}};return[{fill:a.fill??i,fillOpacity:a.fillOpacity??s,opacity:1,topLevel:{lineDash:this.properties.lineDash,lineDashOffset:this.properties.lineDashOffset,marker:this.properties.marker,stroke:this.properties.stroke,strokeOpacity:this.properties.strokeOpacity,strokeWidth:this.properties.strokeWidth},item:{low:l("low"),high:l("high")}},r]}makeStylerParams(e,t){const{id:i}=this,{fill:s,fillOpacity:n,item:o,xKey:a,yHighKey:r,yLowKey:l}=this.properties,c=eJ(t??tJ.None),h=d=>{const{lineDash:u,lineDashOffset:p,marker:g,stroke:f,strokeOpacity:x,strokeWidth:m}=o[d];return{marker:{fill:g.fill??s,fillOpacity:g.fillOpacity,size:g.size,shape:g.shape,stroke:g.stroke??f,strokeOpacity:g.strokeOpacity,strokeWidth:g.strokeWidth,lineDash:g.lineDash,lineDashOffset:g.lineDashOffset},lineDash:u,lineDashOffset:p,stroke:f,strokeOpacity:x,strokeWidth:m}};return{item:{low:h("low"),high:h("high")},fill:s,fillOpacity:n,highlightState:c,highlighted:e,seriesId:i,xKey:a,yLowKey:l,yHighKey:r}}makeItemStylerParams(e){const{xKey:t,yLowKey:i,yHighKey:s}=this.properties;return{xKey:t,yLowKey:i,yHighKey:s,itemId:e}}getTooltipContent(e,t){const i=t?.itemId??"high",{id:s,dataModel:n,processedData:o,axes:a,properties:r}=this,{xName:l,yName:c,yLowKey:h,yLowName:d,xKey:u,yHighKey:p,yHighName:g,tooltip:f,legendItemName:x}=r,m=a[is.X],v=a[is.Y];if(!n||!o||!m||!v)return;const b=o.dataSources.get(this.id)?.data[e],S=n.resolveKeysById(this,"xValue",o)[e],D=n.resolveColumnById(this,"yHighValue",o)[e],L=n.resolveColumnById(this,"yLowValue",o)[e];if(S==null)return;const I=this.getStyle(!1),A=this.makeItemStylerParams(i),T=this.getMarkerStyle(this.properties.item[i].marker,{datumIndex:e,datum:b},A,{isHighlight:!1,resolveMarkerSubPath:["item",i,"marker"]},I.item[i].marker),w=`${this.getAxisValueText(v,"tooltip",L,b,h,x)} - ${this.getAxisValueText(v,"tooltip",D,b,p,x)}`;return this.formatTooltipWithContext(f,{heading:this.getAxisValueText(m,"tooltip",S,b,u,x),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:`${d??h} - ${g??p}`,value:w}]},{seriesId:s,datum:b,title:c,itemId:i,xName:l,yName:c,yLowKey:h,yLowName:d,xKey:u,yHighKey:p,yHighName:g,legendItemName:x,...T})}legendItemSymbol(){const{fill:e,topLevel:t}=this.getStyle(!1),{stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,marker:a}=t;return{marker:{shape:a.shape,fill:a.fill??e,stroke:a.stroke??i,fillOpacity:a.fillOpacity,strokeOpacity:a.strokeOpacity,strokeWidth:a.strokeWidth,lineDash:a.lineDash,lineDashOffset:a.lineDashOffset},line:{stroke:i,strokeOpacity:n,strokeWidth:s,lineDash:o}}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{yLowKey:s,yHighKey:n,yName:o,yLowName:a,yHighName:r,legendItemName:l,showInLegend:c}=this.properties,h=l??o??`${a??s} - ${r??n}`,d=`${s}-${n}`;return[{legendType:"category",id:t,itemId:d,seriesId:t,enabled:i,label:{text:`${h}`},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!c}]}isLabelEnabled(){return this.properties.label.enabled}onDataChange(){}nodeFactory(){return new $7}animateEmptyUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:s,paths:n}=e,{animationManager:o}=this.ctx;this.updateAreaPaths(n,s),F7(this,o,...n),B7([t],Rz),_7(this,o,t),aA(this,"labels",o,i)}animateReadyResize(e){const{contextData:t,paths:i}=e;this.updateAreaPaths(i,t),super.animateReadyResize(e)}animateWaitingUpdateReady(e){const{animationManager:t}=this.ctx,{datumSelection:i,labelSelection:s,contextData:n,paths:o,previousContextData:a}=e,[r,l,c]=o;if(r==null&&l==null&&c==null)return;this.resetDatumAnimation(e),this.resetLabelAnimation(e);const h=()=>{this.resetPathAnimation(e),this.updateAreaPaths(o,n)},d=()=>{t.skipCurrentBatch(),h()};if(n==null||a==null){h(),_z(this,t,"added",i),lA(this,"fill_path_properties",t,"add",r),lA(this,"low_stroke_path_properties",t,"add",l),lA(this,"high_stroke_path_properties",t,"add",c),aA(this,"labels",t,s);return}const u=w7(n,a,this.processedData?.reduced?.diff?.[this.id]);if(u===void 0){d();return}else if(u.status==="no-op")return;cA(this.id,"fill_path_properties",t,[r],u.fill.pathProperties),cA(this.id,"low_stroke_path_properties",t,[l],u.stroke.pathProperties),cA(this.id,"high_stroke_path_properties",t,[c],u.stroke.pathProperties),u.status==="added"?this.updateAreaPaths(o,n):u.status==="removed"?this.updateAreaPaths(o,a):(hA(this.id,"fill_path_update",t,[r],u.fill.path),hA(this.id,"low_stroke_path_update",t,[l],u.stroke.path),hA(this.id,"high_stroke_path_update",t,[c],u.stroke.path)),u.hasMotion&&(_z(this,t,void 0,i),aA(this,"labels",t,s)),this.ctx.animationManager.animate({id:this.id,groupId:"reset_after_animation",phase:"trailing",from:{},to:{},onComplete:()=>this.updateAreaPaths(o,n)})}getFormattedMarkerStyle(e){const t=this.getStyle(!1),i=this.makeItemStylerParams(e.itemId);return this.getMarkerStyle(this.properties.item[e.itemId].marker,e,i,{isHighlight:!0,resolveMarkerSubPath:["item",e.itemId,"marker"]},void 0,t)}getMarkerStyle(e,t,i,s,n,o){return e.itemStyler=this.properties.marker.itemStyler,super.getMarkerStyle(e,t,i,s,n,o)}computeFocusBounds(e){const t=zz(this,e),i=zz(this,{...e,datumIndex:e.datumIndex+1});if(t&&i)return U7.merge([t,i])}isDatumEnabled(e,t){return t%2===0&&super.isDatumEnabled(e,t)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};ov.className="RangeAreaSeries",ov.type="range-area";var{commonSeriesOptionsDefs:oJ,rangeAreaSeriesThemeableOptionsDef:aJ}=k,dA={...oJ,...aJ,type:U(Ce("range-area")),xKey:U(E),yLowKey:U(E),yHighKey:U(E),xName:E,yName:E,yLowName:E,yHighName:E,legendItemName:E,segmentation:rl,invertedStyle:{enabled:G,...ce}};dA.pickOutsideVisibleMinorAxis=me(G),dA.focusPriority=me(Z);var Vz={lineDash:{$path:"/series/$index/lineDash"},lineDashOffset:{$path:"/series/$index/lineDashOffset"},stroke:{$path:["/series/$index/stroke",{$palette:"stroke"}]},strokeOpacity:{$path:"/series/$index/strokeOpacity"},strokeWidth:{$path:["/series/$index/strokeWidth",1]},marker:{enabled:{$path:"/series/$index/marker/enabled"},fill:{$isUserOption:["/series/$index/marker/fill",{$if:[{$or:[{$isGradient:{$path:"/series/$index/marker/fill"}},{$isImage:{$path:"/series/$index/marker/fill"}},{$isPattern:{$path:"/series/$index/marker/fill"}}]},{$merge:[{$path:"/series/$index/marker/fill"},{$applySwitch:[{$path:"type"},void 0,["gradient",k.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS]]}]},{$isUserOption:["/series/$index/marker/fill",{$path:"/series/$index/marker/fill"},{$palette:"fill"}]}]},{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",k.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS]]}]},fillOpacity:{$path:"/series/$index/marker/fillOpacity"},lineDash:{$path:"/series/$index/marker/lineDash"},lineDashOffset:{$path:"/series/$index/marker/lineDashOffset"},shape:{$path:"/series/$index/marker/shape"},size:{$path:["/series/$index/marker/size",6]},stroke:{$path:["/series/$index/marker/stroke",{$palette:"stroke"}]},strokeOpacity:{$path:"/series/$index/marker/strokeOpacity"},strokeWidth:{$path:["/series/$index/marker/strokeWidth",2]}}},rJ={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",k.FILL_GRADIENT_LINEAR_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS]]},fillOpacity:.7,stroke:{$palette:"stroke"},strokeWidth:1,marker:{enabled:!1,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",k.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS]]},shape:"circle",stroke:{$palette:"stroke"},size:6,strokeWidth:2},nodeClickRange:"nearest",item:{low:Vz,high:Vz},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!1,placement:"outside",padding:{$isUserOption:["./spacing",0,10]},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},interpolation:{type:"linear"},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:k.multiSeriesHighlightStyle(),segmentation:k.SEGMENTATION_DEFAULTS,invertedStyle:{enabled:!1,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",k.FILL_GRADIENT_LINEAR_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS]]},fillOpacity:{$path:"../fillOpacity"}}},axes:{[k.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{enabled:!0}}}},{ThemeConstants:{CARTESIAN_AXIS_TYPE:Gz,CARTESIAN_POSITION:jz}}=k,lJ={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"range-area",moduleFactory:e=>new ov(e),predictAxis:k.predictCartesianTimeAxis,defaultAxes:[{type:Gz.NUMBER,position:jz.LEFT},{type:Gz.CATEGORY,position:jz.BOTTOM}],themeTemplate:rJ},Hz={type:"series",name:"range-area",chartType:"cartesian",enterprise:!0,options:dA,create:e=>new ov(e)},{aggregationDomain:cJ,aggregationRangeFittingPoints:hJ,compactAggregationIndices:dJ,createAggregationIndices:uJ}=k,pJ=1e3;function gJ(e,t,i,s,n,o){if(t.length64;)({indexData:c,valueData:h,maxRange:l}=dJ(c,h,l)),d.push({maxRange:l,indexData:c});return d.reverse(),d}var{AbstractBarSeriesProperties:fJ,makeSeriesTooltip:yJ,Property:oi,DropShadow:mJ,Label:xJ}=k,uA=class extends xJ{constructor(){super(...arguments),this.placement="inside",this.spacing=0}};y([oi],uA.prototype,"placement",2),y([oi],uA.prototype,"spacing",2);var bi=class extends fJ{constructor(){super(...arguments),this.fill="#99CCFF",this.fillOpacity=1,this.stroke="#99CCFF",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.shadow=new mJ().set({enabled:!1}),this.label=new uA,this.tooltip=yJ()}};y([oi],bi.prototype,"xKey",2),y([oi],bi.prototype,"yLowKey",2),y([oi],bi.prototype,"yHighKey",2),y([oi],bi.prototype,"xName",2),y([oi],bi.prototype,"yName",2),y([oi],bi.prototype,"yLowName",2),y([oi],bi.prototype,"yHighName",2),y([oi],bi.prototype,"fill",2),y([oi],bi.prototype,"fillOpacity",2),y([oi],bi.prototype,"stroke",2),y([oi],bi.prototype,"strokeWidth",2),y([oi],bi.prototype,"strokeOpacity",2),y([oi],bi.prototype,"lineDash",2),y([oi],bi.prototype,"lineDashOffset",2),y([oi],bi.prototype,"cornerRadius",2),y([oi],bi.prototype,"styler",2),y([oi],bi.prototype,"itemStyler",2),y([oi],bi.prototype,"shadow",2),y([oi],bi.prototype,"label",2),y([oi],bi.prototype,"tooltip",2);var{SeriesNodePickMode:Wz,valueProperty:$z,keyProperty:bJ,ChartAxisDirection:Ef,checkCrisp:vJ,updateLabelNode:SJ,SMALLEST_KEY_INTERVAL:MJ,LARGEST_KEY_INTERVAL:DJ,diff:kJ,prepareBarAnimationFunctions:Uz,midpointStartingBarPosition:Kz,resetBarSelectionsFn:IJ,fixNumericExtent:AJ,seriesLabelFadeInAnimation:Yz,resetLabelFn:CJ,animationValidation:LJ,computeBarFocusBounds:TJ,visibleRangeIndices:wJ,createDatumId:NJ,ContinuousScale:OJ,Rect:EJ,PointerEvents:PJ,motion:Zz,applyShapeStyle:RJ,findMinMax:zJ,areScalingEqual:FJ,processedDataIsAnimatable:BJ,AGGREGATION_SPAN:Xz,AGGREGATION_INDEX_X_MAX:qz,AGGREGATION_INDEX_X_MIN:Qz,AGGREGATION_INDEX_Y_MAX:_J,AGGREGATION_INDEX_Y_MIN:VJ,mergeDefaults:Jz,simpleMemorize2:GJ,getItemStyles:jJ,calculateSegments:HJ,toHighlightString:WJ,HighlightState:eF}=k,$J=GJ(gJ),UJ=class extends k.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.xKey,this.yLowKey=s.properties.yLowKey,this.yHighKey=s.properties.yHighKey}},av=class extends k.AbstractBarSeries{constructor(e){super({moduleCtx:e,pickModes:[Wz.AXIS_ALIGNED,Wz.EXACT_SHAPE_MATCH],propertyKeys:{x:["xKey"],y:["yLowKey","yHighKey"]},propertyNames:{x:["xName"],y:["yLowName","yHighName","yName"]},categoryKey:"xValue",datumSelectionGarbageCollection:!1,animationResetFns:{datum:IJ,label:CJ}}),this.properties=new bi,this.dataAggregationFilters=void 0,this.NodeEvent=UJ}async processData(e){const{xKey:t,yLowKey:i,yHighKey:s}=this.properties,n=this.getCategoryAxis()?.scale,o=this.getValueAxis()?.scale,{isContinuousX:a,xScaleType:r,yScaleType:l}=this.getScaleInformation({xScale:n,yScale:o}),c=[];this.ctx.animationManager.isSkipped()||(this.processedData&&c.push(kJ(this.id,this.processedData)),c.push(LJ()));const h=this.visible?{}:{forceValue:0},{dataModel:d,processedData:u}=await this.requestDataModel(e,this.data,{props:[bJ(t,r,{id:"xValue"}),$z(i,l,{id:"yLowValue",invalidValue:null,...h}),$z(s,l,{id:"yHighValue",invalidValue:null,...h}),...a?[MJ,DJ]:[],...c],groupByKeys:!1});this.smallestDataInterval=u.reduced?.smallestKeyInterval,this.largestDataInterval=u.reduced?.largestKeyInterval,this.dataAggregationFilters=this.aggregateData(d,u),this.animationState.transition("updateData")}aggregateData(e,t){if(t.type!=="ungrouped"||BJ(t))return;const i=this.axes[Ef.X];if(i==null)return;const s=e.resolveKeysById(this,"xValue",t),n=e.resolveColumnById(this,"yHighValue",t),o=e.resolveColumnById(this,"yLowValue",t),{index:a}=e.resolveProcessedDataDefById(this,"xValue"),r=t.domain.keys[a];return $J(i.scale.type,s,n,o,r,t.reduced?.smallestKeyInterval)}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!t||!i)return[];const{keys:[s]}=t.domain;if(e===this.getCategoryDirection()){const n=i.resolveProcessedDataDefById(this,"xValue");return n?.def.type==="key"&&n?.def.valueType==="category"?s:this.padBandExtent(s)}else{const n=this.domainForClippedRange(e,["yHighValue","yLowValue"],"xValue"),o=zJ(n);return AJ(o)}}getSeriesRange(e,t){return this.domainForVisibleRange(Ef.Y,["yHighValue","yLowValue"],"xValue",t)}createNodeData(){const{data:e,dataModel:t,groupScale:i,processedData:s,visible:n}=this,o=this.getCategoryAxis(),a=this.getValueAxis();if(!(e&&o&&a&&t&&s?.dataSources&&this.chart?.seriesRect))return;const r=o.scale,l=a.scale,c=this.getBarDirection()===Ef.X,{xKey:h,yLowKey:d,yHighKey:u,strokeWidth:p}=this.properties,g=`${d}-${u}`,f=HJ(this.properties.segmentation,o,a,this.chart.seriesRect,this.ctx.scene),x={itemId:g,nodeData:[],labelData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:jJ(this.getItemStyle.bind(this)),segments:f};if(!n)return x;const m=s.dataSources.get(this.id)?.data??[],v=t.resolveKeysById(this,"xValue",s),b=t.resolveColumnById(this,"yLowValue",s),S=t.resolveColumnById(this,"yHighValue",s),{barWidth:D,groupIndex:L}=this.updateGroupScale(o),I=OJ.is(r)?D*-.5:0,A=i.convert(String(L)),T=vJ(o?.scale,o?.visibleRange,this.smallestDataInterval,this.largestDataInterval),w=B=>Math.round(r.convert(v[B]))+A+I,N=(B,R,V,j,$,W,Y)=>{const se=m[B],X=v[B];if(X==null)return;const Q=b[B],ie=S[B];if(!Number.isFinite(Q?.valueOf())||!Number.isFinite(ie?.valueOf()))return;const[q,ee]=QB.maxRange>_);if(z!=null){const{maxRange:B,indexData:R}=z,[V,j]=wJ(1,B,o.range,$=>{const W=$*Xz,Y=R[W+Qz],se=R[W+qz];if(Y===-1)return;const X=Math.trunc((Y+se)/2);return[w(X),w(se)+D]});for(let $=V;$this.getDatumId(n))}getItemStyle(e,t,i){const{properties:s,dataModel:n,processedData:o}=this,{itemStyler:a}=s,r=this.getHighlightStyle(t,e,i);let l=Jz(r,this.getStyle(e===void 0,t,i));if(a&&n!=null&&o!=null&&e!=null){const c=n.resolveKeysById(this,"xValue",o)[e],h=this.cachedDatumCallback(NJ(this.getDatumId({xValue:c}),t?"highlight":"node"),()=>{const d=this.makeItemStylerParams(e,t,l);return this.callWithContext(a,d)});h&&(l=Jz(h,l))}return l}makeItemStylerParams(e,t,i){const{id:s,properties:n,processedData:o}=this,{xKey:a,yHighKey:r,yLowKey:l}=n,c=o.dataSources.get(s)?.data[e],h=this.ctx.highlightManager?.getActiveHighlight(),d=this.getHighlightStateString(h,t,e),u=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:c,xKey:a,yHighKey:r,yLowKey:l,highlighted:t,highlightState:d,...i,fill:u}}updateDatumStyles(e){const t=this.ctx.highlightManager.getActiveHighlight();e.datumSelection.each((i,s)=>{if(!e.datumSelection.isGarbage(i)){const n=this.getHighlightState(t,e.isHighlight,s.datumIndex);s.style=this.getItemStyle(s.datumIndex,e.isHighlight,n)}})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight(),n=this.getCategoryDirection()===Ef.X,o=this.getShapeFillBBox();e.each((a,r)=>{const l=r.style??i.styles[this.getHighlightState(s,t,r.datumIndex)];RJ(a,l,o),a.cornerRadius=l.cornerRadius??0,a.visible=n?r.width>0:r.height>0,a.crisp=r.crisp})}updateLabelSelection(e){const t=this.properties.label.enabled?e.labelData:[];return e.labelSelection.update(t,i=>{i.pointerEvents=PJ.None})}updateLabelNodes(e){const t={xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xKey,yName:this.properties.yName,yLowKey:this.properties.yLowKey,yLowName:this.properties.yLowName??this.properties.yLowKey,yHighKey:this.properties.yHighKey,yHighName:this.properties.yHighName??this.properties.yHighKey,legendItemName:this.properties.legendItemName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,n)=>{s.fillOpacity=this.getHighlightStyle(!1,n?.datumIndex).opacity??1,SJ(this,s,t,this.properties.label,n,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:n}=this,{xKey:o,xName:a,yName:r,yLowKey:l,yHighKey:c,yLowName:h,yHighName:d,tooltip:u,legendItemName:p}=n,g=this.getCategoryAxis(),f=this.getValueAxis();if(!i||!s||!g||!f)return;const x=s.dataSources.get(this.id)?.data[e],m=i.resolveKeysById(this,"xValue",s)[e],v=i.resolveColumnById(this,"yHighValue",s)[e],b=i.resolveColumnById(this,"yLowValue",s)[e];if(m==null)return;const S=this.getItemStyle(e,!1),D=`${this.getAxisValueText(f,"tooltip",b,x,l,p)} - ${this.getAxisValueText(f,"tooltip",v,x,c,p)}`;return this.formatTooltipWithContext(u,{heading:this.getAxisValueText(g,"tooltip",m,x,o,p),symbol:this.legendItemSymbol(),data:[{label:r,fallbackLabel:`${h??l} - ${d??c}`,value:D}]},{seriesId:t,datum:x,title:r,xKey:o,xName:a,yName:r,yLowKey:l,yHighKey:c,yLowName:h,yHighName:d,legendItemName:p,...S})}legendItemSymbol(){const{fill:e,stroke:t,strokeWidth:i,fillOpacity:s,strokeOpacity:n,lineDash:o,lineDashOffset:a}=this.getStyle(!1,!1,eF.None);return{marker:{fill:e,stroke:t,fillOpacity:s,strokeOpacity:n,strokeWidth:i,lineDash:o,lineDashOffset:a}}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{yName:s,yLowName:n,yHighName:o,yLowKey:a,yHighKey:r,legendItemName:l,showInLegend:c}=this.properties,h=l??s??`${n??a} - ${o??r}`,d=`${a}-${r}`;return[{legendType:"category",id:t,itemId:d,seriesId:t,enabled:i,label:{text:`${h}`},symbol:this.legendItemSymbol(),legendItemName:l,hideInLegend:!c}]}animateEmptyUpdateReady({datumSelection:e,labelSelection:t}){const i=Uz(Kz(this.isVertical(),"normal"),"unknown");Zz.fromToMotion(this.id,"datums",this.ctx.animationManager,[e],i),Yz(this,"labels",this.ctx.animationManager,t)}animateWaitingUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:s,previousContextData:n}=e,o=k.calculateDataDiff(this.id,t,this.getDatumId.bind(this),s,n,this.processedData,this.processedDataUpdated);this.ctx.animationManager.stopByAnimationGroupId(this.id);const a=n==null?"fade":"normal",r=Uz(Kz(this.isVertical(),a),"added");Zz.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],r,(l,c)=>this.getDatumId(c),o),(o?.changed||!FJ(s.groupScale,n?.groupScale))&&Yz(this,"labels",this.ctx.animationManager,i)}getDatumId(e){return`${e.xValue}`}isLabelEnabled(){return this.properties.label.enabled}onDataChange(){}computeFocusBounds({datumIndex:e}){return TJ(this,this.contextNodeData?.nodeData[e])}hasItemStylers(){return this.properties.styler!=null||this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};av.className="RangeBarSeries",av.type="range-bar";var{commonSeriesOptionsDefs:KJ,rangeBarSeriesThemeableOptionsDef:YJ}=k,pA={...KJ,...YJ,type:U(Ce("range-bar")),xKey:U(E),yLowKey:U(E),yHighKey:U(E),xName:E,yName:E,yLowName:E,yHighName:E,legendItemName:E,segmentation:rl};pA.pickOutsideVisibleMinorAxis=me(G),pA.focusPriority=me(Z);var ZJ={series:{direction:"vertical",fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",k.FILL_GRADIENT_LINEAR_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},placement:"inside",padding:{$isUserOption:["./spacing",0,6]}},highlight:k.multiSeriesHighlightStyle(),segmentation:k.SEGMENTATION_DEFAULTS},axes:{[k.ThemeConstants.CARTESIAN_AXIS_TYPE.NUMBER]:{crosshair:{enabled:!0}}}},XJ={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"range-bar",moduleFactory:e=>new av(e),predictAxis:k.predictCartesianTimeAxis,defaultAxes:k.DIRECTION_SWAP_AXES,themeTemplate:ZJ,groupable:!0},tF={type:"series",name:"range-bar",chartType:"cartesian",enterprise:!0,options:pA,create:e=>new av(e)},{AbstractBarSeriesProperties:qJ,BaseProperties:Pf,PropertiesArray:QJ,makeSeriesTooltip:JJ,Property:Xe,DropShadow:eee,Label:tee}=k,rv=class extends Pf{};y([Xe],rv.prototype,"totalType",2),y([Xe],rv.prototype,"index",2),y([Xe],rv.prototype,"axisLabel",2);var iF=class extends Pf{};y([Xe],iF.prototype,"renderer",2);var gA=class extends tee{constructor(){super(...arguments),this.placement="outside-end",this.spacing=0}};y([Xe],gA.prototype,"placement",2),y([Xe],gA.prototype,"spacing",2);var Xs=class extends Pf{constructor(){super(...arguments),this.fill="#c16068",this.stroke="#c16068",this.fillOpacity=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.strokeWidth=1,this.cornerRadius=0,this.shadow=new eee().set({enabled:!1}),this.label=new gA,this.tooltip=new iF}};y([Xe],Xs.prototype,"name",2),y([Xe],Xs.prototype,"fill",2),y([Xe],Xs.prototype,"stroke",2),y([Xe],Xs.prototype,"fillOpacity",2),y([Xe],Xs.prototype,"strokeOpacity",2),y([Xe],Xs.prototype,"lineDash",2),y([Xe],Xs.prototype,"lineDashOffset",2),y([Xe],Xs.prototype,"strokeWidth",2),y([Xe],Xs.prototype,"cornerRadius",2),y([Xe],Xs.prototype,"itemStyler",2),y([Xe],Xs.prototype,"shadow",2),y([Xe],Xs.prototype,"label",2),y([Xe],Xs.prototype,"tooltip",2);var _h=class extends Pf{constructor(){super(...arguments),this.enabled=!0,this.stroke="black",this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.strokeWidth=2}};y([Xe],_h.prototype,"enabled",2),y([Xe],_h.prototype,"stroke",2),y([Xe],_h.prototype,"strokeOpacity",2),y([Xe],_h.prototype,"lineDash",2),y([Xe],_h.prototype,"lineDashOffset",2),y([Xe],_h.prototype,"strokeWidth",2);var lv=class extends Pf{constructor(){super(...arguments),this.positive=new Xs,this.negative=new Xs,this.total=new Xs}};y([Xe],lv.prototype,"positive",2),y([Xe],lv.prototype,"negative",2),y([Xe],lv.prototype,"total",2);var qr=class extends qJ{constructor(){super(...arguments),this.item=new lv,this.totals=new QJ(rv),this.line=new _h,this.tooltip=JJ()}getStyle(e){const{fillOpacity:t,strokeWidth:i,strokeOpacity:s,fill:n,stroke:o,lineDash:a,lineDashOffset:r,cornerRadius:l}=this.item[e==="subtotal"?"total":e];return{fill:n,fillOpacity:t,stroke:o,strokeWidth:i,strokeOpacity:s,lineDash:a,lineDashOffset:r,cornerRadius:l,opacity:1}}};y([Xe],qr.prototype,"xKey",2),y([Xe],qr.prototype,"yKey",2),y([Xe],qr.prototype,"xName",2),y([Xe],qr.prototype,"yName",2),y([Xe],qr.prototype,"item",2),y([Xe],qr.prototype,"totals",2),y([Xe],qr.prototype,"line",2),y([Xe],qr.prototype,"tooltip",2);var{adjustLabelPlacement:iee,SeriesNodePickMode:sF,fixNumericExtent:see,valueProperty:nF,keyProperty:nee,accumulativeValueProperty:cv,trailingAccumulatedValueProperty:oee,ChartAxisDirection:hv,createDatumId:aee,checkCrisp:ree,updateLabelNode:lee,prepareBarAnimationFunctions:cee,collapsedStartingBarPosition:hee,resetBarSelectionsFn:dee,seriesLabelFadeInAnimation:uee,resetLabelFn:pee,animationValidation:gee,DEFAULT_CARTESIAN_DIRECTION_KEYS:fee,DEFAULT_CARTESIAN_DIRECTION_NAMES:yee,computeBarFocusBounds:mee,isContinuous:oF,Rect:xee,motion:bee,applyShapeStyle:vee,mergeDefaults:aF,getItemStylesPerItemId:See,DataSet:Mee}=k,dv=class extends k.AbstractBarSeries{constructor(e){super({moduleCtx:e,propertyKeys:fee,propertyNames:yee,categoryKey:void 0,pickModes:[sF.NEAREST_NODE,sF.EXACT_SHAPE_MATCH],pathsPerSeries:["connector"],pathsZIndexSubOrderOffset:[-1,-1],animationResetFns:{datum:dee,label:pee}}),this.properties=new qr,this.seriesItemTypes=new Set(["positive","negative","total"])}async processData(e){const{xKey:t,yKey:i,totals:s}=this.properties,{data:n}=this;if(!this.visible)return;const o=v=>oF(v)&&Number(v)>=0,a=v=>oF(v)&&Number(v)>=0,r=v=>v==="total"||v==="subtotal",l={missingValue:void 0,invalidValue:void 0},c=[],h=s.reduce((v,b)=>{const S=v.get(b.index);return S?S.push(b):v.set(b.index,[b]),v},new Map);for(const[v,b]of n?.data.entries()??[]){c.push(b);const S=h.get(v);if(S)for(const D of S)c.push({...D.toJson(),[t]:D.axisLabel})}const d=[];this.ctx.animationManager.isSkipped()||d.push(gee());const u=this.getCategoryAxis()?.scale,p=this.getValueAxis()?.scale,{isContinuousX:g,xScaleType:f,yScaleType:x}=this.getScaleInformation({xScale:u,yScale:p}),{processedData:m}=await this.requestDataModel(e,Mee.wrap(c),{props:[nee(t,f,{id:"xValue"}),cv(i,x,{...l,id:"yCurrent"}),cv(i,x,{...l,missingValue:0,id:"yCurrentTotal"}),cv(i,x,{...l,id:"yCurrentPositive",validation:o}),cv(i,x,{...l,id:"yCurrentNegative",validation:a}),oee(i,x,{...l,id:"yPrevious"}),nF(i,x,{id:"yRaw"}),nF("totalType","category",{id:"totalTypeValue",missingValue:void 0,validation:r}),...g?[k.SMALLEST_KEY_INTERVAL,k.LARGEST_KEY_INTERVAL]:[],...d]});this.smallestDataInterval=m.reduced?.smallestKeyInterval,this.largestDataInterval=m.reduced?.largestKeyInterval,this.updateSeriesItemTypes(),this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i}=this;if(!t||!i)return[];const{keys:[s],values:n}=t.domain;if(e===this.getCategoryDirection()){const o=i.resolveProcessedDataDefById(this,"xValue");if(o?.def.type==="key"&&o?.def.valueType==="category")return s;const a=e===hv.Y,r=this.getCategoryAxis().isReversed();return this.padBandExtent(s,r!==a)}else{const o=i.resolveProcessedDataIndexById(this,"yCurrent"),a=n[o],r=[Math.min(0,a[0]),Math.max(0,a[1])];return see(r)}}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{data:e,dataModel:t,processedData:i}=this,s=this.getCategoryAxis(),n=this.getValueAxis();if(!e||!s||!n||!t||!i)return;const{line:o}=this.properties,a=s.scale,r=n.scale,l=this.getBarDirection()===hv.X,c=this.getBandwidth(s)??10,h=s.isReversed(),d=n.isReversed();if(i.type!=="ungrouped")return;const u={itemId:this.properties.yKey,nodeData:[],labelData:[],pointData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible,styles:See(this.getItemStyle.bind(this),"total","subtotal","positive","negative")};if(!this.visible)return u;const p=[],g=t.resolveKeysById(this,"xValue",i),f=t.resolveColumnById(this,"yRaw",i),x=t.resolveColumnById(this,"totalTypeValue",i),m=t.resolveColumnById(this,"yCurrent",i),v=t.resolveColumnById(this,"yPrevious",i),b=t.resolveColumnById(this,"yCurrentTotal",i),S=this.getSeriesDomain(hv.Y),D=ree(s?.scale,s?.visibleRange,this.smallestDataInterval,this.largestDataInterval);function L(_,z,B){return _||z?{cumulativeValue:b[B],trailingValue:z?A:0}:{cumulativeValue:m[B],trailingValue:v[B]}}function I(_,z,B,R,V){return _?R:z?(R??0)-(V??0):B}let A=0;const{xKey:T,yKey:w,xName:N,yName:O}=this.properties,P=i.dataSources.get(this.id)?.data??[];for(const[_,z]of P.entries()){const B=x[_],R=this.isSubtotal(B),V=this.isTotal(B),j=V||R,$=g[_];if($==null)continue;const W=Math.round(a.convert($)),Y=f[_],{cumulativeValue:se,trailingValue:X}=L(V,R,_);j&&(A=se??0);const Q=Math.round(r.convert(se)),ie=Math.round(r.convert(X)),q=I(V,R,Y,se,X),ee=(q??0)>=0,oe=this.getSeriesItemType(ee,B),{strokeWidth:le,label:he}=this.getItemConfig(oe),ue=ee?Q:ie,xe=ee?ie:Q,be=Math.max(le,Math.abs(xe-ue)),ye={x:l?Math.min(ue,xe):W,y:l?W:Math.min(ue,xe),width:l?be:c,height:l?c:be},Te={x:ye.x+ye.width/2,y:ye.y+ye.height/2},Ae=j?Q:ie,ze=Math.floor(o.strokeWidth)%2/2,we=h?Q:Ae,Ve=h?Ae:Q;let Ke,pt;l?(Ke={x:we+ze,y:ye.y},pt={x:Ve+ze,y:ye.y+ye.height}):(Ke={x:ye.x,y:we+ze},pt={x:ye.x+ye.width,y:Ve+ze});const Ii={x:h?pt.x:Ke.x,y:h?pt.y:Ke.y,x2:h?Ke.x:pt.x,y2:h?Ke.y:pt.y,size:0};p.push(Ii);const gt=oe==="subtotal"?"total":oe,Ai=this.getLabelText(q,z,w,"y",S,he,{itemId:gt,value:q,datum:z,xKey:T,yKey:w,xName:N,yName:O}),ci=he.spacing+(typeof he.padding=="number"?he.padding:0),ba={index:_,series:this,itemId:oe,datum:z,datumIndex:_,cumulativeValue:se??0,xValue:$,yValue:q,yKey:w,xKey:T,x:ye.x,y:ye.y,width:ye.width,height:ye.height,midPoint:Te,crisp:D,label:{text:Ai,...iee({isUpward:(q??-1)>=0!==d,isVertical:!l,placement:he.placement,spacing:ci,rect:ye})}};u.nodeData.push(ba),u.labelData.push(ba)}const F=this.properties.line.enabled;return m!=null&&F&&(u.pointData=p),u}updateSeriesItemTypes(){const{dataModel:e,seriesItemTypes:t,processedData:i}=this;if(!e||!i)return;t.clear();const s=e.resolveProcessedDataIndexById(this,"yCurrentPositive"),n=e.resolveProcessedDataIndexById(this,"yCurrentNegative"),o=e.resolveProcessedDataIndexById(this,"totalTypeValue"),a=i.domain.values[s]??[],r=i.domain.values[n]??[];a.length>0&&t.add("positive"),r.length>0&&t.add("negative");const l=i?.domain.values[o];if(l)for(const c of l)(c==="total"||c==="subtotal")&&t.add("total")}isSubtotal(e){return e==="subtotal"}isTotal(e){return e==="total"}nodeFactory(){return new xee}getSeriesItemType(e,t){return t??(e?"positive":"negative")}getItemConfig(e){switch(e){case"positive":return this.properties.item.positive;case"negative":return this.properties.item.negative;case"subtotal":case"total":return this.properties.item.total}}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,s=t??[];return i.update(s)}getItemStyle(e,t,i,s="total"){const{properties:n}=this,{datumIndex:o=0,datum:a}=e??{},r=s==="subtotal"?"total":s,l=n.item[r],c=this.getHighlightStyle(t,o,i),h=aF(c,n.getStyle(s)),{itemStyler:d}=l;let u=h;if(d!=null&&e!=null){const p=this.cachedDatumCallback(aee(o,t?"highlight":"node"),()=>{const g=this.makeItemStylerParams(s,o,a,t,u);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`,"item",r],this.callWithContext(d,g))});p&&(u=aF(p,u))}return u}makeItemStylerParams(e,t,i,s,n){const{id:o,properties:a}=this,{xKey:r,yKey:l}=a,c=this.ctx.highlightManager?.getActiveHighlight(),h=this.getHighlightStateString(c,s,t),d=this.filterItemStylerFillParams(n.fill)??n.fill;return{seriesId:o,itemId:e,datum:i,xKey:r,yKey:l,highlighted:s,highlightState:h,...n,fill:d}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t,void 0,s.itemId)})}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight(),n=this.getCategoryDirection()===hv.X,o=this.getShapeFillBBox();e.each((a,r)=>{const l=r.style??i.styles[r.itemId][this.getHighlightState(s,t,r.datumIndex)];vee(a,l,o),a.cornerRadius=l.cornerRadius??0,a.visible=n?r.width>0:r.height>0,a.crisp=r.crisp})}updateLabelSelection(e){const{labelData:t,labelSelection:i}=e;if(t.length===0)return i.update([]);const s=t.filter(n=>{const{label:o}=this.getItemConfig(n.itemId);return o.enabled});return i.update(s)}updateLabelNodes(e){const t={itemId:"positive",xKey:this.properties.xKey,xName:this.properties.xName??this.properties.xName,yKey:this.properties.yKey,yName:this.properties.yName??this.properties.yName},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,n)=>{t.itemId=n.itemId,s.fillOpacity=this.getHighlightStyle(!1,n.datumIndex)?.opacity??1;const o=this.getItemConfig(n.itemId).label;lee(this,s,t,o,n.label,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:n}=this,{xKey:o,xName:a,yKey:r,yName:l,tooltip:c,legendItemName:h}=n,d=this.getCategoryAxis(),u=this.getValueAxis();if(!i||!s||!d||!u)return;const p=s.dataSources.get(this.id)?.data[e],g=i.resolveKeysById(this,"xValue",s)[e],f=i.resolveColumnById(this,"yRaw",s)[e],x=i.resolveColumnById(this,"yCurrentTotal",s),m=i.resolveColumnById(this,"totalTypeValue",s);if(g==null)return;const v=m[e],b=(f??0)>=0,S=this.getSeriesItemType(b,v);let D;if(this.isTotal(v))D=x[e];else if(this.isSubtotal(v)){D=x[e];for(let A=e-1;A>=0;A-=1)if(this.isSubtotal(m[A])){D=D-x[A];break}}else D=f;const L=this.contextNodeData?.nodeData?.[e],I=this.getItemStyle(L,!1,void 0,L?.itemId);return this.formatTooltipWithContext(c,{heading:this.getAxisValueText(d,"tooltip",g,p,o,h),symbol:this.legendItemSymbol(S),data:[{label:l,fallbackLabel:r,value:this.getAxisValueText(u,"tooltip",D,p,r,h)}]},{seriesId:t,datum:p,title:l,itemId:S,xKey:o,xName:a,yKey:r,yName:l,...I})}legendItemSymbol(e){const{fill:t,stroke:i,fillOpacity:s,strokeOpacity:n,strokeWidth:o,lineDash:a,lineDashOffset:r}=this.getItemConfig(e);return{marker:{fill:t,stroke:i,fillOpacity:s,strokeOpacity:n,strokeWidth:o,lineDash:a,lineDashOffset:r}}}getLegendData(e){if(e!=="category")return[];const{id:t,seriesItemTypes:i}=this,s=[],n=a=>a.charAt(0).toUpperCase()+a.substring(1),{showInLegend:o}=this.properties;for(const a of i){const{name:r}=this.getItemConfig(a);s.push({legendType:"category",id:t,itemId:a,seriesId:t,enabled:!0,label:{text:r??n(a)},symbol:this.legendItemSymbol(a),hideInLegend:!o,isFixed:!0})}return s}toggleSeriesItem(){}animateEmptyUpdateReady(e){const{datumSelection:t,labelSelection:i,contextData:s}=e,n=cee(hee(this.isVertical(),this.axes,"normal"),"unknown");bee.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],n),uee(this,"labels",this.ctx.animationManager,i);const{pointData:o}=s;o&&(this.isVertical()?this.animateConnectorLinesVertical(e):this.animateConnectorLinesHorizontal(e))}animateConnectorLinesHorizontal(e){const{pointData:t=[]}=e.contextData,[i]=e.paths,{path:s}=i;this.updateLineNode(i);const n=this.getValueAxis(),o=n?.isReversed(),a=o?(h,d)=>hh>d,r=n?.scale.convert(0),l=t.reduce((h,d)=>(a(d.x,h)&&(h=d.x),h),o?1/0:0),c=(h,d,u,p,g)=>(h-d)/(u-d)*(g-p)+p;this.ctx.animationManager.animate({id:`${this.id}_connectors`,groupId:this.id,phase:"initial",from:r,to:l,ease:k.Motion.easeOut,collapsable:!1,onUpdate(h){s.clear(!0);for(const[d,u]of t.entries()){const p=c(h,r,l,r,u.x),g=c(h,r,l,r,u.x2);d!==0&&s.lineTo(p,u.y),s.moveTo(g,u.y2)}i.checkPathDirty()},onStop:()=>this.resetConnectorLinesPath(e)})}animateConnectorLinesVertical(e){const{pointData:t=[]}=e.contextData,[i]=e.paths,{path:s}=i;this.updateLineNode(i);const n=this.getValueAxis(),o=n?.isReversed(),a=o?(h,d)=>h>d:(h,d)=>h(a(d.y,h)&&(h=d.y),h),o?0:1/0),c=(h,d,u,p,g)=>(h-d)/(u-d)*(g-p)+p;this.ctx.animationManager.animate({id:`${this.id}_connectors`,groupId:this.id,phase:"initial",from:r,to:l,ease:k.Motion.easeOut,collapsable:!1,onUpdate(h){s.clear(!0);for(const[d,u]of t.entries()){const p=c(h,r,l,r,u.y),g=c(h,r,l,r,u.y2);d!==0&&s.lineTo(u.x,p),s.moveTo(u.x2,g)}i.checkPathDirty()},onStop:()=>this.resetConnectorLinesPath(e)})}animateReadyResize(e){super.animateReadyResize(e),this.resetConnectorLinesPath(e)}updatePaths(e){this.resetConnectorLinesPath({contextData:e.contextData,paths:e.paths})}resetConnectorLinesPath({contextData:e,paths:t}){if(t.length===0)return;const[i]=t;this.updateLineNode(i);const{path:s}=i;s.clear(!0);const{pointData:n}=e;if(n){for(const[o,a]of n.entries())o!==0&&s.lineTo(a.x,a.y),s.moveTo(a.x2,a.y2);i.checkPathDirty()}}updateLineNode(e){const{stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:n,lineDashOffset:o}=this.properties.line;e.setProperties({fill:void 0,stroke:t,strokeWidth:i,strokeOpacity:s,lineDash:n,lineDashOffset:o,lineJoin:"round",pointerEvents:k.PointerEvents.None})}isLabelEnabled(){const{positive:e,negative:t,total:i}=this.properties.item;return e.label.enabled||t.label.enabled||i.label.enabled}onDataChange(){}computeFocusBounds({datumIndex:e}){return mee(this,this.contextNodeData?.nodeData[e])}hasItemStylers(){const{positive:e,negative:t,total:i}=this.properties.item;return e.itemStyler!=null||e.label.itemStyler!=null||t.itemStyler!=null||t.label.itemStyler!=null||i.itemStyler!=null||i.label.itemStyler!=null}};dv.className="WaterfallSeries",dv.type="waterfall";var{commonSeriesOptionsDefs:Dee,waterfallSeriesThemeableOptionsDef:kee}=k,Iee={...kee,...Dee,type:U(Ce("waterfall")),xKey:U(E),yKey:U(E),xName:E,yName:E,totals:Rt({totalType:U(J("total","subtotal")),index:U(H),axisLabel:U(E)},"a total definition options array")},{FILL_GRADIENT_LINEAR_KEYED_DEFAULTS:Aee,FILL_IMAGE_DEFAULTS:Cee,FILL_PATTERN_KEYED_DEFAULTS:Lee}=k;function fA(e,t){return{fill:{$applySwitch:[{$path:"type"},{$if:[{$eq:[{$palette:"type"},"user-indexed"]},{$path:[`/${t}`,{$palette:"fill"},{$palette:"fills"}]},{$palette:`${e}.fill`}]},["gradient",Aee(e)],["image",Cee],["pattern",Lee(e)]]},stroke:{$palette:`${e}.stroke`},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!1,fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},formatter:void 0,placement:"outside-end",padding:{$isUserOption:["./spacing",0,6]}}}}var Tee={series:{item:{positive:fA("altUp",0),negative:fA("altDown",1),total:fA("neutral",2)},line:{stroke:{$palette:"neutral.stroke"},strokeOpacity:1,lineDash:[0],lineDashOffset:0,strokeWidth:2},highlight:k.singleSeriesHighlightStyle()},legend:{enabled:!0,toggleSeries:!1}},wee={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"waterfall",solo:!0,moduleFactory:e=>new dv(e),defaultAxes:k.DIRECTION_SWAP_AXES,themeTemplate:Tee},rF={type:"series",name:"waterfall",chartType:"cartesian",enterprise:!0,options:Iee,create:e=>new dv(e)},{NewAreaSeriesModule:Nee,NewBarSeriesModule:Oee,NewBubbleSeriesModule:Eee,NewHistogramSeriesModule:Pee,NewLineSeriesModule:Ree,NewScatterSeriesModule:zee,numberFormatValidator:Fee,textOrSegments:Bee,without:Un}=k,lF={width:H,height:H,grip:G,fill:ae,stroke:ae,strokeWidth:H,cornerRadius:H},kn=["cursor","highlightStyle","listeners","nodeClickRange","showInLegend","showInMiniChart","tooltip","visible","xName","yName"],cF=[...kn,"errorBar","label","legendItemName","direction"],hF=[...kn,"direction","legendItemName","minName","q1Name","medianName","q3Name","maxName"],dF=[...kn,"title","label","labelKey","labelName","sizeName"],uF=[...kn,"title","label","colorName","textAlign","verticalAlign","itemPadding","colorRange"],pF=[...kn,"label"],gF=[...kn,"errorBar","title","label"],fF=[...kn,"label","yLowName","yHighName"],yF=[...kn,"direction","label","yLowName","yHighName"],mF=[...kn,"errorBar","title","label","labelKey","labelName"],xF=[...kn,"direction"],_ee={enabled:G,height:H,spacing:H,cornerRadius:Z,mask:{fill:ae,fillOpacity:ge,stroke:ae,strokeWidth:H},minHandle:lF,maxHandle:lF,miniChart:{enabled:G,padding:{top:H,bottom:H},label:{enabled:G,avoidCollisions:G,spacing:H,format:Fee,formatter:Ps(Bee),interval:{minSpacing:H,maxSpacing:H,values:Ho,step:Z},...dt},series:Rt(Sc({area:Un(Nee.options,[...kn,"type"]),bar:Un(Oee.options,[...cF,"type"]),"box-plot":Un(ZR.options,[...hF,"type"]),bubble:Un(Eee.options,[...dF,"type"]),candlestick:Un(uz.options,[...kn,"type"]),heatmap:Un(Mz.options,[...uF,"type"]),histogram:Un(Pee.options,[...pF,"type"]),line:Un(Ree.options,[...gF,"type"]),ohlc:Un(kz.options,[...kn,"type"]),"range-area":Un(Hz.options,[...fF,"type"]),"range-bar":Un(tF.options,[...yF,"type"]),scatter:Un(zee.options,[...mF,"type"]),waterfall:Un(rF.options,[...xF,"type"])},"miniChart series options"))}},Vee=["area","bar","bubble","candlestick","heatmap","histogram","line","ohlc","range-area","range-bar","scatter","waterfall"],Gee=["itemStyler","direction","fill","fillGradientDefaults","fillPatternDefaults","fillImageDefaults","fillOpacity","shadow","focusPriority","highlight","lineDash","lineDashOffset","strokeWidth"];function bF(e,t){return{$merge:[{$switch:[t,{},[["area","line","range-area"],{marker:{enabled:{$isUserOption:["/series/$index/marker/enabled",{$path:["/series/$index/marker/enabled",!1]},!1]}}}]]},{$omit:[{$switch:[t,kn,["bar",cF],["box-plot",hF],["bubble",dF],["heatmap",uF],["histogram",pF],["line",[...gF,...Gee]],["range-area",fF],["range-bar",yF],["scatter",mF],["waterfall",xF]]},e]}]}}var jee={enabled:!1,height:{$if:[{$path:"./miniChart/enabled"},40,18]},cornerRadius:4,mask:{fill:{$ref:"foregroundColor"},fillOpacity:.1,stroke:{$ref:"borderColor"},strokeWidth:1},minHandle:{fill:{$ref:"chartBackgroundColor"},stroke:{$ref:"borderColor"},strokeWidth:1,width:12,height:24,cornerRadius:4},maxHandle:{fill:{$ref:"chartBackgroundColor"},stroke:{$ref:"borderColor"},strokeWidth:1,width:12,height:24,cornerRadius:4},miniChart:{enabled:!1,label:{color:{$ref:"textColor"},fontSize:{$rem:k.FONT_SIZE_RATIO.SMALLER},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},spacing:5},padding:{top:0,bottom:0},series:{$apply:[bF({$path:"/series/$index"},{$path:["/navigator/miniChart/series/$index/type",{$path:["type",{$path:"/series/$index/type"}]}]}),{$if:[{$or:Vee.map(e=>({$eq:[{$path:"/series/0/type"},e]}))},{$map:[bF({$value:"$1"},{$path:"/series/$index/type"}),{$path:"/series"}]},void 0]}]}}},Hee={type:"root",optionsKey:"navigator",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new _u(e),removable:!1,themeTemplate:{navigator:jee}},{ToolbarButtonProperties:Wee,Property:$ee}=k,vF=class extends Wee{};y([$ee],vF.prototype,"value",2);var{ChartAxisDirection:yA,LayoutElement:Uee,PropertiesArray:Kee,Toolbar:Yee,Property:SF}=k,mA=class extends k.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!1,this.buttons=new Kee(vF),this.verticalSpacing=10,this.container=e.domManager.addChild("canvas-overlay","range-buttons"),this.container.role="presentation",this.toolbar=new Yee(this.ctx,"ariaLabelRangesToolbar","horizontal"),this.toolbar.addClass("ag-charts-range-buttons"),this.container.append(this.toolbar.getElement()),this.cleanup.register(this.toolbar.addToolbarListener("button-pressed",this.onButtonPress.bind(this)),e.layoutManager.registerElement(Uee.ToolbarBottom,this.onLayoutStart.bind(this)),e.eventsHub.on("zoom:change",this.onZoomChanged.bind(this)),this.teardown.bind(this))}teardown(){this.toolbar.getElement().remove(),this.toolbar.destroy()}onLayoutStart(e){const{buttons:t,ctx:i,enabled:s,toolbar:n,verticalSpacing:o}=this,{layoutBox:a}=e;if(!s||!i.zoomManager.isZoomEnabled()){n.setHidden(!0);return}n.setHidden(!1),n.updateButtons(t);const r=n.getBounds().height;n.setBounds({x:a.x,y:a.y+a.height-r,width:a.width,height:r}),a.shrink({bottom:r+o})}onZoomChanged(){this.toolbar.clearActiveButton()}onButtonPress({button:{index:e}}){const{zoomManager:t}=this.ctx,i=this.buttons.at(e);if(!i)return;const{value:s}=i;s==null?t.resetZoom("zoom-buttons"):typeof s=="number"?t.extendToEnd("zoom-buttons",yA.X,s):Array.isArray(s)?t.updateWith("zoom-buttons",yA.X,()=>s):typeof s=="function"&&t.updateWith("zoom-buttons",yA.X,s),this.toolbar.toggleActiveButtonByIndex(e)}};y([SF],mA.prototype,"enabled",2),y([SF],mA.prototype,"buttons",2);var MF=1e3*60*60*24,xA=MF*30,Zee=MF*365,Xee={type:"root",optionsKey:"ranges",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new mA(e),themeTemplate:{ranges:{enabled:!1,buttons:{$shallowSimple:[{label:"toolbarRange1Month",ariaLabel:"toolbarRange1MonthAria",value:xA},{label:"toolbarRange3Months",ariaLabel:"toolbarRange3MonthsAria",value:3*xA},{label:"toolbarRange6Months",ariaLabel:"toolbarRange6MonthsAria",value:6*xA},{label:"toolbarRangeYearToDate",ariaLabel:"toolbarRangeYearToDateAria",value:(e,t)=>[new Date(`${new Date(t).getFullYear()}-01-01`).getTime(),void 0]},{label:"toolbarRange1Year",ariaLabel:"toolbarRange1YearAria",value:Zee},{label:"toolbarRangeAll",ariaLabel:"toolbarRangeAllAria",value:void 0}]}}}},DF=class ny extends k.BaseModuleInstance{constructor(t){super(),this.ctx=t,this.activeSections=new Set,this.sectionButtons={annotations:[],chartToolbar:[]},this.container=this.ctx.domManager.addChild("canvas-overlay","shared-toolbar"),this.container.role="presentation"}getSharedToolbar(t){return this.sharedToolbar||this.createSharedToolbar(),t==="chartToolbar"&&this.sharedToolbar&&this.sharedToolbar.setAriaLabelId("ariaLabelFinancialCharts"),this.toolbarWithSection(t)}createSharedToolbar(){this.sharedToolbar=new k.Toolbar(this.ctx,"ariaLabelAnnotationsToolbar","vertical"),this.sharedToolbar.addClass("ag-charts-shared-toolbar"),this.container.append(this.sharedToolbar.getElement()),this.cleanup.register(()=>{this.sharedToolbar&&(this.sharedToolbar.getElement().remove(),this.sharedToolbar.destroy(),this.sharedToolbar=void 0)})}toolbarWithSection(t){const i=this.sharedToolbar,s={layout:(n,o)=>{if(this.firstLayoutSection!=null&&this.firstLayoutSection!==t&&this.activeSections.has(this.firstLayoutSection))return;this.firstLayoutSection=t;const a=i.getBounds().width;i.setBounds({x:n.x,y:n.y,width:a}),n.shrink({left:a+i.horizontalSpacing+(o??0)})},addToolbarListener:(n,o)=>i.addToolbarListener(n,a=>{const r=this.getSectionIndex(t,a.button.index);if(r<0)return;const l={...a,button:this.sectionButtons[t][r]};o(l)}),updateButtons:n=>{this.sectionButtons[t]=n;const o=ny.SECTION_ORDER.flatMap(a=>this.sectionButtons[a]);i.updateButtons(o)},updateButtonByIndex:(n,o)=>{i.updateButtonByIndex(this.getIndex(t,n),o)},toggleActiveButtonByIndex:n=>{i.toggleActiveButtonByIndex(this.getIndex(t,n))},toggleButtonEnabledByIndex:(n,o)=>{i.toggleButtonEnabledByIndex(this.getIndex(t,n),o)},setHidden:n=>{n?this.activeSections.delete(t):this.activeSections.add(t);let o=0;for(const a of ny.SECTION_ORDER){if(a!==t){o+=this.sectionButtons[a].length;continue}for(const r of this.sectionButtons[t].keys())i.setButtonHiddenByIndex(o+r,n)}},destroy:()=>{s.setHidden(!0),this.activeSections.size===0&&this.destroy()},clearActiveButton:i.clearActiveButton.bind(i),addListener:i.addListener.bind(i),removeListener:i.removeListener.bind(i)};return s.setHidden(!1),s}getIndex(t,i){let s=0;for(const n of ny.SECTION_ORDER){if(n===t)return s+i;s+=this.sectionButtons[n].length}return-1}getSectionIndex(t,i){let s=0;for(const n of ny.SECTION_ORDER){if(n===t)return i>=s+this.sectionButtons[t].length?-1:i-s;s+=this.sectionButtons[n].length}return-1}};DF.SECTION_ORDER=["chartToolbar","annotations"];var qee=DF,Qee={type:"context",contextKey:"sharedToolbar",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new qee(e)},{ZIndexMap:Jee,LayoutElement:ete,Property:cn,BaseProperties:tte,valueProperty:ite,Group:ste,Label:Rf,Rect:nte,Text:ss}=k,kF={ohlc:62,candlestick:62,"hollow-candlestick":62,line:96,"step-line":96,hlc:184,"high-low":800},ote={up:"positive",down:"negative"},ate={hlc:"altNeutral"},bA=class extends tte{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1}};y([cn],bA.prototype,"fill",2),y([cn],bA.prototype,"fillOpacity",2);var In=class extends k.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!1,this.openKey=void 0,this.highKey=void 0,this.lowKey=void 0,this.closeKey=void 0,this.volumeKey=void 0,this.title=new Rf,this.positive=new Rf,this.negative=new Rf,this.neutral=new Rf,this.altNeutral=new Rf,this.background=new bA,this.layoutStyle="block",this.id="status-bar",this.data=void 0,this.layer=new ste({name:"StatusBar",zIndex:Jee.STATUS_BAR}),this.labelGroup=this.layer.appendChild(new k.TranslatableGroup),this.backgroundNode=this.labelGroup.appendChild(new nte),this.labels=[{label:"O",configuration:2,title:this.labelGroup.appendChild(new ss),value:this.labelGroup.appendChild(new ss),id:"openValue",key:"openKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"H",configuration:16,title:this.labelGroup.appendChild(new ss),value:this.labelGroup.appendChild(new ss),id:"highValue",key:"highKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"H",configuration:256,title:this.labelGroup.appendChild(new ss),value:this.labelGroup.appendChild(new ss),style:"neutral",id:"highValue",key:"highKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"L",configuration:8,title:this.labelGroup.appendChild(new ss),value:this.labelGroup.appendChild(new ss),id:"lowValue",key:"lowKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"L",configuration:512,title:this.labelGroup.appendChild(new ss),value:this.labelGroup.appendChild(new ss),style:"neutral",id:"lowValue",key:"lowKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"C",configuration:4,title:this.labelGroup.appendChild(new ss),value:this.labelGroup.appendChild(new ss),id:"closeValue",key:"closeKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"C",configuration:128,title:this.labelGroup.appendChild(new ss),value:this.labelGroup.appendChild(new ss),id:"closeValue",key:"closeKey",style:"neutral",domain:void 0,formatter:new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},{label:"",configuration:64,title:this.labelGroup.appendChild(new ss),value:this.labelGroup.appendChild(new ss),style:"neutral",id:"closeValue",key:"closeKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:2,maximumFractionDigits:2})},{label:"Vol",configuration:32,title:this.labelGroup.appendChild(new ss),value:this.labelGroup.appendChild(new ss),id:"volumeValue",key:"volumeKey",domain:void 0,formatter:new Intl.NumberFormat("en-US",{notation:"compact",minimumFractionDigits:2,maximumFractionDigits:2})}],this.highlightManager=e.highlightManager,this.labelGroup.visible=!1,this.cleanup.register(e.scene.attachNode(this.layer),e.layoutManager.registerElement(ete.Overlay,t=>this.startPerformLayout(t)),e.eventsHub.on("layout:complete",t=>this.onLayoutComplete(t)),e.eventsHub.on("highlight:change",()=>this.updateHighlight()))}async processData(e){if(!this.enabled||this.data==null)return;const t=[];for(const o of this.labels){const{id:a,key:r}=o,l=this[r];l==null?o.domain=void 0:t.push(ite(l,"number",{id:a}))}if(t.length===0)return;const i=k.DataSet.wrap(this.data)??k.DataSet.empty(),{processedData:s,dataModel:n}=await e.request(this.id,i,{props:t});for(const o of this.labels){const{id:a,key:r}=o;this[r]!=null&&(o.domain=n.getDomain(this,a,"value",s))}}startPerformLayout(e){if(this.labelGroup.translationX=0,this.labelGroup.translationY=0,!this.enabled)return;const{layoutBox:t}=e,i=4,s=12,n=0,o=8;this.labelGroup.translationY=t.y+n;const a=Math.max(this.title.fontSize,this.positive.fontSize,this.negative.fontSize),r=$o(a),l=kF[this.getChartType()]??0;let c=0,h,d="alphabetic";if(this.layoutStyle==="block")t.shrink(n+r+o,"top"),h=a+(r-a)/2;else{const{title:u}=this.ctx.chartService;if(d="top",h=n+u.padding,u.enabled){const p=u.node.getBBox();c=p.x+p.width+s}else c=u.padding}for(const{label:u,configuration:p,title:g,value:f,domain:x,formatter:m}of this.labels){if(x==null||!(l&p)){g.visible=!1,f.visible=!1;continue}const v=Je(this.positive),b=Je(this.negative),S=Math.max(v.textWidth(m.format(x[0])),v.textWidth(m.format(x[1])),b.textWidth(m.format(x[0])),b.textWidth(m.format(x[1])));g.visible=!0,f.visible=!0;const D=Je(this.title).measureLines(u);g.setFont(this.title),g.fill=this.title.color,g.text=u,g.textBaseline=d,g.y=h,g.x=c,c+=D.width+i,f.textBaseline=d,f.y=h,f.x=c,c+=S+s}this.backgroundNode.x=0,this.backgroundNode.y=0,this.backgroundNode.width=c-s,this.backgroundNode.height=r+n+o,this.backgroundNode.fill=this.background.fill,this.backgroundNode.fillOpacity=this.background.fillOpacity}onLayoutComplete(e){this.labelGroup.translationX=e.series.rect.x,this.updateHighlight()}updateHighlight(){if(!this.enabled)return;const e=this.highlightManager.getActiveHighlight(),t=e?.datum??this.data?.at(-1);if(t==null){this.labelGroup.visible=!1;return}this.labelGroup.visible=!0;const i=e?.itemId;let s=i==null?void 0:ote[i];s==null&&this.openKey!=null&&this.closeKey!=null&&(t[this.openKey]new In(e),themeTemplate:{statusBar:{enabled:!1,layoutStyle:k.ThemeSymbols.DEFAULT_CAPTION_LAYOUT_STYLE,title:{color:{$ref:"textColor"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},positive:{color:{$palette:"up.stroke"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},negative:{color:{$palette:"down.stroke"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},neutral:{color:{$palette:"neutral.stroke"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}},background:{fill:{$ref:"chartBackgroundColor"},fillOpacity:.5},altNeutral:{color:"gray",fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"}}}}},Ro=0,ns=1,Vh=ns-Ro,IF="end",AF="middle",CF=300,uv=(e,t=Ro,i=ns)=>ve(t,e,i);function vA(){return{x:{min:Ro,max:ns},y:{min:Ro,max:ns}}}function os(e){return e.x.max-e.x.min}function Kn(e){return e.y.max-e.y.min}function LF(e,t){return Qe(e.min,t.min)&&Qe(e.max,t.max)}function zf(e,t){return LF(e.x,t.x)&&LF(e.y,t.y)}function pv(e){return zf(e,vA())}function Ts(e){return{x:{min:e?.x?.min??Ro,max:e?.x?.max??ns},y:{min:e?.y?.min??Ro,max:e?.y?.max??ns}}}function Qr(e,t,i){if(!e)return{x:0,y:0};const s=uv(t-e.x,0,e.x+e.width),n=uv(i-e.y,0,e.y+e.height),o=1/e.width*s,a=1-1/e.height*n;return{x:uv(o),y:uv(a)}}function Gh(e,t,i){return{x:{min:e.x.min+t,max:e.x.max+t},y:{min:e.y.min+i,max:e.y.max+i}}}function gv(e,t,i){return{x:{min:e.x.min,max:e.x.min+os(e)*t},y:{min:e.y.min,max:e.y.min+Kn(e)*i}}}function TF(e,t,i){const s=os(e),n=Kn(e),o=e.x.min+s/2,a=e.y.min+n/2;return{x:{min:o-s*t/2,max:o+s*t/2},y:{min:a-n*i/2,max:a+n*i/2}}}function Yn(e,t,i,s){const{min:n,max:o}=t,a=n+(o-n)/2,r=e.max-e.min;switch(i){case"start":return{min:n,max:t.min+r};case"end":return{min:t.max-r,max:o};case"middle":return{min:a-r/2,max:a+r/2};case"pointer":return lte(e,t,s??a);default:return{min:n,max:o}}}function lte(e,t,i){const s=e.max-e.min,n=t.max-t.min,o=i*(1-(n-s)),a=i-o,r=e.min+a,l=e.max+a;return{min:r,max:l}}function cte(e,t,i){return{x:{min:e.x.min*t,max:e.x.max*t},y:{min:e.y.min*i,max:e.y.max*i}}}function zo(e){return{x:fv(e.x),y:fv(e.y)}}function fv(e){const t=e.max-e.min;let i=e.max>ns?ns-t:e.min,s=e.mins?.valueOf()),i.map(s=>s?.valueOf())):!no(t,i)}var cc=class extends hte{constructor(e){super(),this.moduleContext=e,this.enabled=!1,this.axes="x",this.nodeInteraction=!0,this.zoom=!0,this.domainMode="key",this.domainSync=new HS}updateSiblings(e){const{syncManager:t}=this.moduleContext;for(const i of t.getGroupSiblings(e??this.groupId))ga("ChartSync.updateSiblings()",i.id,i),this.updateChart(i)}updateChart(e,t=yv.PROCESS_DOMAIN){ga("ChartSync.updateChart()",e.id,yv[t],e),t===yv.PROCESS_DOMAIN?e.ctx.updateService.update(t,{forceNodeDataRefresh:!0}):e.ctx.updateService.update(t)}enabledZoomSync(){const{eventsHub:e}=this.moduleContext;this.disableZoomSync?.(),this.disableZoomSync=e.on("zoom:change",this.onZoom.bind(this))}onZoom(){const{syncManager:e}=this.moduleContext;for(const t of e.getGroupSiblings(this.groupId)){if(!t.modulesManager.getModule("sync")?.zoom)continue;const i=t.modulesManager.getModule("zoom");if(!i)continue;const s=this.prepareZoomUpdate();ga("ChartsSyncManager.enabledZoomSync()",t.id,s),i.updateSyncZoom(s)}}enabledNodeInteractionSync(){this.disableNodeInteractionSync?.(),this.disableNodeInteractionSync=this.moduleContext.eventsHub.on("highlight:change",this.onHighlightChange.bind(this))}onHighlightChange(e){const{syncManager:t}=this.moduleContext;if(e.callerId.endsWith("-sync"))return;ga("ChartSync.onHighlightChange()",e);const i=e.currentHighlight?.series,[s]=DA(this.axes),n=s===jh.X?jh.Y:jh.X,[o,a]=i?wF(i,s,n):[],r=If(e.currentHighlight);let l=o?.[0]?r?.[o[0]]:void 0,c=!1;if(jo(l)&&(c=!0,l=l.getTime()),!e.currentHighlight?.datum){for(const d of t.getGroupSiblings(this.groupId))d.modulesManager.getModule("sync")?.nodeInteraction&&(d.ctx.highlightManager.updateHighlight(`${d.id}-sync`),d.ctx.tooltipManager.removeTooltip(`${d.id}-sync`));return}const h=t.getGroupSyncMode(this.groupId)==="multi-series";this.findMatchingHighlightNodes(s,n,h?a:[],c,l,e)}findMatchingHighlightNodes(e,t,i,s,n,o){const{syncManager:a}=this.moduleContext;ga("ChartSync.findMatchingHighlightNodes()",{mainDirection:e,secondaryKeys:i});for(const r of a.getGroupSiblings(this.groupId)){if(!r.modulesManager.getModule("sync")?.nodeInteraction)continue;let l=!1;for(const c of r.axes){if(!SA.is(c)||c.direction!==e)continue;const h=r.series.filter(d=>{if(!d.visible)return!1;if(i.length>0){const[,u]=wF(d,e,t);return i.every(p=>u.includes(p))}return!0}).map(this.findMatchingNodes(c,e,s,n)).filter(qt);if(h.length===1&&h[0]?.nodeDatum!==r.ctx.highlightManager.getActiveHighlight()){this.dispatchHighlightUpdate(r,h[0].nodeDatum),l=!0;break}}l||(ga("ChartSync.findMatchingHighlightNodes() - no matching nodes",r.id,o),this.dispatchHighlightUpdate(r))}}findMatchingNodes(e,t,i,s){return n=>{const o=n.getKeys(e.direction);if(e.keys.length&&!e.keys.some(d=>o.includes(d)))return;const a=n.contextNodeData?.nodeData??[];if(!a?.length)return;const r=a[0],l=`${t}Key`;if(!gte(r,l))return;const c=r[l],h=a.find(d=>{const u=d.datum[c];return i?u.getTime()===s:u===s});return h?{series:n,nodeDatum:h}:null}}dispatchHighlightUpdate(e,t){ga("ChartSync.dispatchHighlightUpdate()",e.id,t),e.ctx.highlightManager.updateHighlight(`${e.id}-sync`,t);const i=t?.series.tooltipEnabled??e.tooltip.enabled;if(t&&i){const s=e.seriesAreaBoundingBox,n=s.x+(t.midPoint?.x??t.point?.x??0),o=s.y+(t.midPoint?.y??t.point?.y??0),a=pte.makeTooltipMeta({type:"pointermove",canvasX:n,canvasY:o},t.series,t,void 0);e.ctx.tooltipManager.updateTooltip(`${e.id}-sync`,a,e.getTooltipContent(t.series,t.datumIndex,t,"tooltip"))}else e.ctx.tooltipManager.removeTooltip(`${e.id}-sync`);this.updateChart(e,yv.SERIES_UPDATE)}async getSyncedDomain(e){if(!SA.is(e)||this.axes!=="xy"&&this.axes!==e.direction)return;const{groupState:t,directionDomains:i,domainsByKey:s,positionDomains:n}=this.updateDomainState(e);return this.validateAxis(e,t),await this.waitForDomainsToBeReady(),this.domainMode==="position"?this.calculateDerivedDomain(e,n):this.domainMode==="direction"||e.keys.length===0?this.calculateDerivedDomain(e,i):this.calculateKeyDerivedDomain(e,s)}updateDomainState(e){var t,i,s,n,o;const{syncManager:a}=this.moduleContext,r=a.getChart().id,l=e.id,c=a.getGroupState(this.groupId);if(!c)throw new Error("AG Charts - no GroupState for groupId: "+this.groupId);const h=c.domains??(c.domains={}),d=h[t=e.direction]??(h[t]={derived:[],sources:{},dirty:!0}),u=(i=d.sources)[r]??(i[r]={});u[l]=e.dataDomain.domain,d.dirty=!0;const p=c.domainsByKey??(c.domainsByKey={});for(const m of e.keys??[]){const v=p[m]??(p[m]={derived:[],sources:{},dirty:!0}),b=(s=v.sources)[r]??(s[r]={});b[l]=e.dataDomain.domain,v.dirty=!0}const g=c.domainsByPosition??(c.domainsByPosition={}),f=g[n=e.position]??(g[n]={derived:[],sources:{},dirty:!0}),x=(o=f.sources)[r]??(o[r]={});return x[l]=e.dataDomain.domain,f.dirty=!0,{groupState:c,directionDomains:d,domainsByKey:p,positionDomains:f}}validateAxis(e,t){const i=this.moduleContext.syncManager.getGroupSyncMode(this.groupId)==="multi-series";DA(this.axes).includes(e.direction)&&(i?this.validateMultiSeries(e,t):this.validateSingleSeries(e,t))}validateMultiSeries(e,t){const{min:i,max:s,nice:n,reverse:o}=e,a=new Set(e.boundSeries.flatMap(r=>r.getKeys(e.direction)));for(const r of t.members){const{axes:l,modulesManager:c}=r,h=DA(c.getModule("sync")?.axes),d=l.filter(p=>h.includes(p.direction)).filter(p=>p.boundSeries.some(g=>g.getKeys(p.direction).some(f=>a.has(f))));if(d.length===0)continue;const[u]=d;if(u.min!==i||u.max!==s||u.nice!==n||u.reverse!==o){K.warnOnce("To allow synchronization, ensure that all synchronized axes with matching keys have matching min, max, nice, and reverse properties."),this.enabled=!1;return}}}validateSingleSeries(e,t){const i=t.members,[{axes:s}]=i,{direction:n,min:o,max:a,nice:r,reverse:l}=e;for(const c of s)if(n===c.direction&&(r!==c.nice||l!==c.reverse||o!==c.min&&(Ye(o)||Ye(c.min))||a!==c.max&&(Ye(a)||Ye(c.max)))){K.warnOnce("To allow synchronization, ensure that all charts have matching min, max, nice, and reverse properties on the synchronized axes."),this.enabled=!1;return}}calculateDerivedDomain(e,t){if(!t.dirty)return t.derived;const i=t.derived;return t.derived=GS(Object.values(t.sources).map(s=>Object.values(s)).flat(2)),MA.is(e.scale)&&(t.derived=mv(t.derived)),t.dirty=!1,NF(e.scale,i,t.derived)&&(ga(e.id,"updated",e.keys,{before:i,after:t.derived}),this.updateSiblings()),t.derived}calculateKeyDerivedDomain(e,t){let i=[],s=[],n=!1;for(const o of e.keys??[]){const a=t[o],r=a.derived;if(i.push(...r),!a.dirty){s.push(...a.derived);continue}a.derived=GS(Object.values(a.sources).map(l=>Object.values(l)).flat(2)),MA.is(e.scale)&&(a.derived=mv(a.derived)),s.push(...a.derived),a.dirty=!1,n||(n=!no(r,a.derived))}return MA.is(e.scale)&&(i=mv(i),s=mv(s)),n&&NF(e.scale,i,s)&&(ga(e.id,"updated",e.keys,{before:i,after:s}),this.updateSiblings()),s}removeAxis(e){if(!SA.is(e)||this.axes!=="xy"&&this.axes!==e.direction)return;const{syncManager:t}=this.moduleContext,i=t.getGroupState(this.groupId),s=t.getChart().id,n=e.id;delete i?.domains?.[e.direction]?.sources?.[s]?.[n];for(const o of e.keys??[])delete i?.domainsByKey?.[o]?.sources?.[s]?.[n];delete i?.domainsByPosition?.[e.position]?.sources?.[s]?.[n]}async waitForDomainsToBeReady(){const{syncManager:e}=this.moduleContext;let t=0;for(;e.getGroupMembers(this.groupId).some(i=>i.syncStatus==="init");)ga("ChartSync.waitForDomainsToBeReady() - waiting for all domains to be calculated",this.groupId),await this.domainSync.await(),t++;t>0&&ga("ChartSync.waitForDomainsToBeReady() - waited for",t,"iterations"),this.domainSync.notify()}prepareZoomUpdate(){const{zoomManager:e}=this.moduleContext,t=e.getZoom();return this.axes==="x"?delete t?.y:this.axes==="y"&&delete t?.x,Ts(t)}onEnabledChange(){const{syncManager:e}=this.moduleContext;this.enabled?e.subscribe(this.groupId):e.unsubscribe(this.groupId),this.updateSiblings(),this.onNodeInteractionChange(),this.onZoomChange()}onGroupIdChange(e,t){if(!this.enabled||e===t)return;const{syncManager:i}=this.moduleContext;i.unsubscribe(t),i.subscribe(e),this.updateSiblings(t),this.updateSiblings(e)}onAxesChange(){if(!this.enabled)return;const{syncManager:e}=this.moduleContext;this.updateChart(e.getChart())}onNodeInteractionChange(){this.enabled&&this.nodeInteraction?this.enabledNodeInteractionSync():this.disableNodeInteractionSync?.()}onZoomChange(){this.enabled&&this.zoom?this.enabledZoomSync():this.disableZoomSync?.()}destroy(){const{syncManager:e}=this.moduleContext;e.unsubscribe(this.groupId),this.updateSiblings(),this.disableZoomSync?.()}};cc.className="Sync",y([Ku,Uu(e=>e.onEnabledChange())],cc.prototype,"enabled",2),y([Ku,Uu((e,t,i)=>e.onGroupIdChange(t,i))],cc.prototype,"groupId",2),y([Ku,Uu(e=>e.onAxesChange())],cc.prototype,"axes",2),y([Ku,Uu(e=>e.onNodeInteractionChange())],cc.prototype,"nodeInteraction",2),y([Ku,Uu(e=>e.onZoomChange())],cc.prototype,"zoom",2),y([Ku,Uu(e=>e.onAxesChange())],cc.prototype,"domainMode",2);var fte={type:"root",optionsKey:"sync",packageType:"enterprise",chartTypes:["cartesian"],moduleFactory:e=>new cc(e),themeTemplate:{sync:{enabled:!1}}},{Property:OF}=k,EF="#2196f3",yte="#8a8a8a",xv=class extends k.Rect{constructor(){super(...arguments),this.fill=EF,this.fillOpacity=.2,this.zIndex=k.ZIndexMap.ZOOM_SELECTION}updateValid(){this.fill=EF}updateInvalid(){this.fill=yte}};xv.className="ZoomRect",y([OF],xv.prototype,"fill",2),y([OF],xv.prototype,"fillOpacity",2);var mte=class{update(e,t,i,s,n,o){return this.oldZoom??(this.oldZoom=Ts(t===k.ChartAxisDirection.X?{...n,x:o}:{...n,y:o})),this.updateCoords(e.offsetX,e.offsetY),this.updateZoom(t,i,s)}stop(){this.coords=void 0,this.oldZoom=void 0}updateCoords(e,t){this.coords?(this.coords.x2=e,this.coords.y2=t):this.coords={x1:e,y1:t,x2:e,y2:t}}updateZoom(e,t,i){const{coords:s,oldZoom:n}=this;let o=Ts(n);if(!s||!n)return e===k.ChartAxisDirection.X?o.x:o.y;const a=Qr(i,s.x1,s.y1),r=Qr(i,s.x2,s.y2);if(e===k.ChartAxisDirection.X){const c=(r.x-a.x)*os(n);return o.x.max+=c,o.x=Yn(o.x,n.x,t,a.x),o=zo(o),o.x}const l=(r.y-a.y)*Kn(n);return o.y.max-=l,o.y=Yn(o.y,n.y,t,a.y),o=zo(o),o.y}},xte=class{constructor(e,t,i,s,n,o,a,r){this.eventsHub=e,this.contextMenuRegistry=t,this.zoomManager=i,this.getModuleProperties=s,this.canResetZoom=n,this.getRect=o,this.updateZoom=a,this.isZoomValid=r}registerActions(e){const{contextMenuRegistry:t}=this,i=e?"show":"hide";if(t.toggle("zoom-to-cursor",i),t.toggle("pan-to-cursor",i),t.toggle("reset-zoom",i),!e)return;t.builtins.items["zoom-to-cursor"].action=this.onZoomToHere.bind(this),t.builtins.items["pan-to-cursor"].action=this.onPanToHere.bind(this),t.builtins.items["reset-zoom"].action=this.onResetZoom.bind(this);const s=a=>{const r=this.getRect();if(!r)return!0;const l=Qr(r,a.x,a.y);return this.iterateFindNextZoomAtPoint(l)!=null},n=()=>!zf(Ts(this.zoomManager.getZoom()),vA()),o=this.eventsHub.on("context-menu:setup",a=>{t.builtins.items["zoom-to-cursor"].enabled=s(a),t.builtins.items["pan-to-cursor"].enabled=n(),t.builtins.items["reset-zoom"].enabled=this.canResetZoom()});return()=>{o(),t.toggle("zoom-to-cursor","hide"),t.toggle("pan-to-cursor","hide"),t.toggle("reset-zoom","hide")}}computeOrigin(e){const t=this.getRect(),{enabled:i}=this.getModuleProperties();if(!i||!t||!e?.target||!(e instanceof MouseEvent))return;const s={x:0,y:0,width:t.width,height:t.height};return Qr(s,e.offsetX,e.offsetY)}onZoomToHere({event:e}){const t=this.computeOrigin(e);if(!t)return;const i=this.iterateFindNextZoomAtPoint(t);i!=null&&this.updateZoom(i)}onPanToHere({event:e}){const t=this.computeOrigin(e);if(!t)return;const i=Ts(this.zoomManager.getZoom()),s=os(i),n=Kn(i),o=t.x*s,a=t.y*n,r=Vh/2;let l={x:{min:t.x-r,max:t.x+r},y:{min:t.y-r,max:t.y+r}};l=TF(l,s,n),l=Gh(l,i.x.min-t.x+o,i.y.min-t.y+a),this.updateZoom(zo(l))}onResetZoom(e){this.zoomManager.resetZoom("zoom")}iterateFindNextZoomAtPoint(e){const{scrollingStep:t}=this.getModuleProperties();for(let i=t;i<=1-t;i+=t){const s=this.getNextZoomAtPoint(e,i);if(this.isZoomValid(s))return s}}getNextZoomAtPoint(e,t){const{isScalingX:i,isScalingY:s}=this.getModuleProperties(),n=Ts(this.zoomManager.getZoom()),o=e.x*os(n),a=e.y*Kn(n),r=Vh/2;let l={x:{min:e.x-r,max:e.x+r},y:{min:e.y-r,max:e.y+r}};return l=TF(l,i?os(n)*t:Vh,s?Kn(n)*t:Vh),l=Gh(l,n.x.min-e.x+o,n.y.min-e.y+a),zo(l)}},{ChartAxisDirection:PF}=k,bte=class{constructor(e){this.axesHandlers=e,this.axes=[],this.overlappingAxisIds=new Set}destroy(){for(const e of this.axes)e.div.destroy()}update(e,t,i,s){this.seriesRect=s;for(const c of this.axes)c.div.setHidden(!e&&!t);if(!e&&!t)return;const{X:n,Y:o}=PF,a=[...i.axisManager.getAxisContext(n),...i.axisManager.getAxisContext(o)],{removed:r,added:l}=this.diffAxisIds(a);r.length>0&&(this.axes=this.axes.filter(c=>r.includes(c.axisId)?(c.div.destroy(),this.overlappingAxisIds.delete(c.axisId),this.hoveredAxisId===c.axisId&&(this.hoveredAxisId=void 0),this.activeAxisId===c.axisId&&(this.activeAxisId=void 0),!1):!0));for(const c of l){const{axisId:h,direction:d}=c;this.axes.push(this.initAxis(i,h,this.axesHandlers,d))}for(const c of this.axes){const d=a.find(u=>u.axisId===c.axisId).getCanvasBounds();c.div.setHidden(ej(d)),d==null?c.bounds=void 0:(c.div.setBounds(d),c.bounds=new k.BBox(d.x,d.y,d.width,d.height))}this.updateOverlappingAxisPointerEvents(e,t)}setAxisCursor(e){this.cursor=e;for(const t of this.axes)t.div.setCursor(this.getCursor(t.direction))}toggleAxisDraggingCursor(e,t){for(const i of this.axes)i.direction===e&&i.div.setCursor(t?this.getCursor(e):void 0)}updateOverlappingAxisPointerEvents(e,t){this.overlappingAxisIds.clear();const i=(e||t)&&this.seriesRect;for(const s of this.axes){if(!i){s.div.setPointerEvents(void 0);continue}!!s.bounds?.collidesBBox(this.seriesRect)?(this.overlappingAxisIds.add(s.axisId),s.div.setPointerEvents("none")):s.div.setPointerEvents(void 0)}this.cleanupAxisState()}cleanupAxisState(){this.hoveredAxisId&&!this.overlappingAxisIds.has(this.hoveredAxisId)&&(this.hoveredAxisId=void 0),this.activeAxisId&&!this.overlappingAxisIds.has(this.activeAxisId)&&(this.activeAxisId=void 0)}pickAxisAtPoint(e,t){for(const i of this.axes)if(this.overlappingAxisIds.has(i.axisId)&&i.bounds?.containsPoint(e,t))return{axisId:i.axisId,direction:i.direction}}setHoveredAxis(e){this.overlappingAxisIds.has(e)&&(this.hoveredAxisId=e)}clearHoveredAxis(){this.activeAxisId||(this.hoveredAxisId=void 0)}beginDelegatedAxisDrag(e){return this.overlappingAxisIds.has(e)?(this.activeAxisId=e,this.hoveredAxisId=void 0,!0):!1}endDelegatedAxisDrag(e){this.activeAxisId===e&&(this.activeAxisId=void 0),this.hoveredAxisId=void 0}hasOverlappingAxes(){return this.overlappingAxisIds.size>0}getHoveredAxis(){if(!this.hoveredAxisId)return;const e=this.axes.find(t=>t.axisId===this.hoveredAxisId);return e?{axisId:e.axisId,direction:e.direction}:void 0}getCursor(e){return this.cursor?this.cursor:e===PF.X?"ew-resize":"ns-resize"}initAxis(e,t,i,s){const n="afterend",o=e.proxyInteractionService.createProxyElement({type:"region",domManagerId:t,where:n});return o.setCursor(this.getCursor(s)),o.addListener("drag-start",a=>{a.device==="touch"&&a.sourceEvent.preventDefault(),this.activeAxisId=t,i.onAxisDragStart(s)}),o.addListener("drag-move",a=>i.onAxisDragMove(t,s,a)),o.addListener("drag-end",()=>{this.activeAxisId=void 0,this.hoveredAxisId=void 0,i.onAxisDragEnd()}),o.addListener("dblclick",()=>i.onAxisDoubleClick(t,s)),o.addListener("wheel",a=>i.onAxisWheel(t,s,a)),{axisId:t,div:o,direction:s}}diffAxisIds(e){const t=this.axes.map(o=>o.axisId),i=e.map(o=>o.axisId),s=t.filter(o=>!i.includes(o)),n=e.filter(o=>!t.includes(o.axisId));return{removed:s,added:n}}},RF=16,vte={off:1,short:.01,long:.002},Ste=class{constructor(){this.deceleration=1,this.zoomCoordsHistoryIndex=0,this.coordsHistory=[]}get decelerationValue(){const{deceleration:e}=this;return Math.max(typeof e=="number"?e:vte[e]??1,1e-4)}addListener(e,t){return this.onUpdate=t,()=>{this.onUpdate=void 0}}stopInteractions(){this.inertiaHandle!=null&&(cancelAnimationFrame(this.inertiaHandle),this.inertiaHandle=void 0)}update(e){this.updateCoords(e.currentX,e.currentY);const{x1:t=0,y1:i=0,x2:s=0,y2:n=0}=this.coords??{};this.onUpdate?.({type:"update",deltaX:this.isPanningX()?t-s:0,deltaY:this.isPanningY()?i-n:0})}start(e){this.direction=e,this.coordsMonitorTimeout=setInterval(this.recordCurrentZoomCoords.bind(this),16)}stop(){const{coordsHistory:e}=this;let t=0,i=0,s=0;if(e.length>0){const n=this.zoomCoordsHistoryIndex%RF;let o=n-1;o<0&&(o=e.length-1);let a=n;a>=e.length&&(a=0);const r=e[o],l=e[a];t=this.isPanningX()?r.x-l.x:0,i=this.isPanningY()?r.y-l.y:0,s=r.t-l.t}if(this.coords=void 0,this.direction=void 0,clearInterval(this.coordsMonitorTimeout),this.coordsMonitorTimeout=void 0,this.zoomCoordsHistoryIndex=0,this.coordsHistory.length=0,s>0&&this.decelerationValue<1){const n=t/s,o=i/s,a=Math.hypot(n,o),r=Math.atan2(o,n),l=performance.now();this.inertiaHandle=qe().requestAnimationFrame(c=>{this.animateInertia(c,c,l,a,r)})}}recordCurrentZoomCoords(){const{coords:e,coordsHistory:t,zoomCoordsHistoryIndex:i}=this;if(!e)return;const{x2:s,y2:n}=e,o=Date.now();t[i%RF]={x:s,y:n,t:o},this.zoomCoordsHistoryIndex+=1}animateInertia(e,t,i,s,n){const o=1-this.decelerationValue,a=-s/Math.log(o),r=s*(o**(t-i)-1)/Math.log(o),l=s*(o**(e-i)-1)/Math.log(o);this.onUpdate?.({type:"update",deltaX:this.isPanningX()?-Math.cos(n)*(l-r):0,deltaY:this.isPanningY()?-Math.sin(n)*(l-r):0}),!(l>=a-1)&&(this.inertiaHandle=requestAnimationFrame(c=>{this.animateInertia(c,e,i,s,n)}))}updateCoords(e,t){this.coords?this.coords={x1:this.coords.x2,y1:this.coords.y2,x2:e,y2:t}:this.coords={x1:e,y1:t,x2:e,y2:t}}isPanningX(){return this.direction==null||this.direction===k.ChartAxisDirection.X}isPanningY(){return this.direction==null||this.direction===k.ChartAxisDirection.Y}translateZooms(e,t,i,s){const n=Qr(e,e.x+Math.abs(i),e.y+e.height-Math.abs(s)),o=Math.sign(i)*n.x,a=-Math.sign(s)*n.y,r={};for(const[l,{direction:c,zoom:h}]of Tt(t)){if(h&&h.min===Ro&&h.max===ns)continue;let d=Ts({[c]:h});d=zo(Gh(d,o*os(d),a*Kn(d))),r[l]={direction:c,zoom:d[c]}}return r}},Mte=200,Dte=class{update(e,t,i,s){const n=e.deltaX*t*Mte;return this.translateZooms(i,s,n)}translateZooms(e,t,i){const s={},n=Qr(e,e.x+Math.abs(i),0),o=i<0?-n.x:n.x;for(const[a,{direction:r,zoom:l}]of Tt(t)){if(r!==k.ChartAxisDirection.X)continue;let c=Ts({x:l});c=zo(Gh(c,o*os(c),0)),s[a]={direction:r,zoom:c.x}}return s}},kte=class{updateAxes(e,t,i,s){const n=e.sourceEvent,o={},{anchorPointX:a,anchorPointY:r,isScalingX:l,isScalingY:c,scrollingStep:h}=t,d=Qr(i,n.offsetX??n.clientX,n.offsetY??n.clientY);for(const[u,{direction:p,zoom:g}]of Tt(s)){if(g==null)continue;let f={...g};const x=h*e.deltaY*(g.max-g.min);if(p===k.ChartAxisDirection.X&&l)f.max+=x,f=Yn(f,g,a,d.x);else if(p===k.ChartAxisDirection.Y&&c)f.max+=x,f=Yn(f,g,r,d.y);else continue;f.max0&&this.rect.height>0}updateCoords(e,t,i,s){if(!this.coords){this.coords={x1:e,y1:t,x2:e,y2:t};return}const{coords:n}=this;if(n.x2=e,n.y2=t,!s)return;const{isScalingX:o,isScalingY:a,keepAspectRatio:r}=i,l=this.getNormalisedDimensions();if(r&&o&&a){const c=s.width/s.height;n.y2r&&nRo;break;case"pan-end":s=e.x.maxRo;break;case"pan-right":s=e.x.maxi.find(v=>v.identifier===r[m].identifier)),c=r[0].normalX,h=r[1].normalX,d=l[0].clientX,u=l[1].clientX,p=r[0].normalY,g=r[1].normalY,f=n+a-l[0].clientY,x=n+a-l[1].clientY;return this.twitchTolerantZoomPan4(c,h,d,u,p,g,f,x,s,n,o,a)}end(e){const t=Array.from(e.sourceEvent.targetTouches).map(i=>i.identifier);return!t.includes(this.touchStart.origins[0].identifier)||!t.includes(this.touchStart.origins[1].identifier)}twitchTolerantZoomPan4(e,t,i,s,n,o,a,r,l,c,h,d){const{initialZoom:u,previous:p}=this,g=BF(e,t,i,s,p,"a1","a2",l,h,u.x),f=BF(n,o,a,r,p,"b1","b2",c,d,u.y);return{x:g,y:f}}};function BF(e,t,i,s,n,o,a,r,l,c){if(e==t){const h=bv(c,i,r,l),d=bv(c,s,r,l),u=(h+d)/2,p=(e-u)/Wh;return{min:c.min+p,max:c.max+p}}else{const h=n[o],d=n[a];return Math.abs(i-h)+Math.abs(s-d)<=1?(i=h,s=d):(n[o]=i,n[a]=s),Ote(e,t,i,s,r,l)}}var{ActionOnSet:$h,ChartAxisDirection:An,ChartUpdateType:IA,Property:ai,InteractionState:Ff,ProxyProperty:Pte}=k,vv=e=>LS(e,10),Zu="zoom-cursor",Bf="zoom-tooltip",AA=class extends k.BaseProperties{constructor(e){super(),this.onChange=e,this.enabled=!1,this.padding=0}};y([ai,$h({changeValue(e){this.onChange({enabled:e,padding:this.padding})}})],AA.prototype,"enabled",2),y([ai,$h({changeValue(e){this.onChange({enabled:this.enabled,padding:e})}})],AA.prototype,"padding",2);var vi=class extends k.BaseModuleInstance{constructor(e){super(),this.ctx=e,this.enabled=!1,this.enableAxisDragging=!0,this.enableAxisScrolling=!1,this.enableDoubleClickToReset=!0,this.enablePanning=!0,this.enableScrolling=!0,this.enableSelecting=!1,this.enableTwoFingerZoom=!0,this.panKey="alt",this.axes="x",this.scrollingStep=Vh/10,this.keepAspectRatio=!1,this.minVisibleItems=2,this.anchorPointX=IF,this.anchorPointY=AF,this.autoScaling=new AA(i=>{this.ctx.zoomManager.setAutoScaleYAxis(i.enabled,i.padding)}),this.axisDraggingMode="zoom",this.canResetZoom=i=>(i??(i=this.getZoom()),!zf(i,this.getResetZoom())),this.buttons=new Yu(this.ctx,this.getModuleProperties.bind(this),this.canResetZoom,this.updateZoom.bind(this),this.updateAxisZoom.bind(this),this.resetZoom.bind(this),this.isZoomValid.bind(this)),this.axisDragger=new mte,this.panner=new Ste,this.scroller=new kte,this.scrollPanner=new Dte,this.twoFingers=new Ete,this.deceleration="short",this.dragState=0,this.isState=i=>this.ctx.interactionManager.isState(i),this.destroyContextMenuActions=void 0,this.isFirstWheelEvent=!0,this.debouncedWheelReset=NS(()=>{this.isFirstWheelEvent=!0,this.wasFirstWheelEventZoomCapped=void 0},100),this.previousZoomValid=!0,this.previousAxisZoomValid={[k.ChartAxisDirection.X]:!0,[k.ChartAxisDirection.Y]:!0},this.toggleAxisDraggingCursorsDebounced=NS(this.toggleAxisDraggingCursors.bind(this),CF,{leading:!0,trailing:!0});const t=new xv;this.selector=new Ite(t,this.getZoom.bind(this),this.isZoomValid.bind(this)),this.contextMenu=new xte(e.eventsHub,e.contextMenuRegistry,e.zoomManager,this.getModuleProperties.bind(this),this.canResetZoom,()=>this.paddedRect,this.updateZoom.bind(this),this.isZoomValid.bind(this)),this.domProxy=new bte({onAxisDragStart:i=>this.onAxisDragStart(i),onAxisDragMove:(i,s,n)=>this.onAxisDragMove(i,s,n),onAxisDragEnd:()=>this.onAxisDragEnd(),onAxisDoubleClick:i=>this.onAxisDoubleClick(i),onAxisWheel:(i,s,n)=>this.onAxisWheel(i,s,n)}),e.widgets.seriesDragInterpreter&&this.cleanup.register(e.widgets.seriesDragInterpreter.events.on("dblclick",i=>this.onSeriesAreaDoubleClick(i)),e.widgets.seriesDragInterpreter.events.on("drag-move",i=>this.onSeriesAreaDragMove(i)),e.widgets.seriesDragInterpreter.events.on("drag-start",i=>this.onSeriesAreaDragStart(i)),e.widgets.seriesDragInterpreter.events.on("drag-end",()=>this.onSeriesAreaDragEnd())),this.cleanup.register(e.scene.attachNode(t),e.eventsHub.on("series-area:hover",i=>this.onSeriesAreaHoverEvent(i)),e.eventsHub.on("series-area:click",i=>this.onSeriesAreaClickEvent(i)),e.eventsHub.on("series:keynav-zoom",i=>this.onNavZoom(i)),e.widgets.seriesWidget.addListener("wheel",i=>this.onWheel(i)),e.widgets.seriesWidget.addListener("touchstart",(i,s)=>this.onTouchStart(i,s)),e.widgets.seriesWidget.addListener("touchmove",(i,s)=>this.onTouchMove(i,s)),e.widgets.seriesWidget.addListener("touchend",i=>this.onTouchEnd(i)),e.widgets.seriesWidget.addListener("touchcancel",i=>this.onTouchEnd(i)),e.updateService.addListener("process-data",i=>this.onProcessData(i)),e.eventsHub.on("layout:complete",i=>this.onLayoutComplete(i)),e.eventsHub.on("zoom:change",i=>this.onZoomChange(i)),e.eventsHub.on("zoom:pan-start",i=>this.onZoomPanStart(i)),this.panner.addListener("update",i=>this.onPanUpdate(i)),()=>this.teardown())}teardown(){this.ctx.zoomManager.setZoomModuleEnabled(!1),this.buttons.destroy(),this.destroyContextMenuActions?.(),this.domProxy.destroy()}onEnabledChange(e){this.ctx.zoomManager.setZoomModuleEnabled(e),this.contextMenu&&(this.destroyContextMenuActions?.(),this.destroyContextMenuActions=this.contextMenu.registerActions(e))}isIgnoredTouch(e){return e?.device!=="touch"?!1:this.ctx.chartService.touch.dragAction!=="drag"?!0:this.enableSelecting?!1:this.enablePanning?pv(this.getZoom()):!0}onSeriesAreaDoubleClick(e){const{enabled:t,enableDoubleClickToReset:i}=this;!t||!i||e?.preventZoomDblClick||!this.isState(Ff.ZoomClickable)||this.resetZoom()}onSeriesAreaHoverEvent(e){if(!this.shouldHandleAxisHover(e)){this.clearHoveredAxis();return}const t=this.domProxy.pickAxisAtPoint(e.x,e.y);t?(this.domProxy.setHoveredAxis(t.axisId),this.ctx.domManager.updateCursor(Zu,this.domProxy.getCursor(t.direction))):this.clearHoveredAxis()}onSeriesAreaClickEvent(e){if(!this.shouldHandleAxisClick(e))return;const t=this.domProxy.pickAxisAtPoint(e.x,e.y);t&&e.sourceEvent?.type==="dblclick"&&this.onAxisDoubleClick(t.axisId)}shouldHandleAxisHover(e){const{enabled:t,enableAxisDragging:i,enableAxisScrolling:s,dragState:n}=this;return t&&(i||s)&&!e.consumed&&!this.activeAxis&&n===0&&this.domProxy.hasOverlappingAxes()}shouldHandleAxisClick(e){const{enabled:t,enableAxisDragging:i,enableAxisScrolling:s,enableDoubleClickToReset:n}=this;return t&&!this.activeAxis&&!e.consumed&&(i||s||n)}clearHoveredAxis(){this.activeAxis||(this.domProxy.clearHoveredAxis(),this.dragState===0&&this.ctx.domManager.updateCursor(Zu))}tryBeginAxisDelegation(e){const t=this.domProxy.getHoveredAxis();if(!this.enabled||!this.enableAxisDragging||!t||!this.domProxy.beginDelegatedAxisDrag(t.axisId))return!1;this.activeAxis=t,this.onAxisDragStart(t.direction);const i=this.dragState===2?"grabbing":this.domProxy.getCursor(t.direction);return this.ctx.domManager.updateCursor(Zu,i),e.device==="touch"&&e.sourceEvent.preventDefault(),!0}onSeriesAreaDragStart(e){const{enabled:t,enablePanning:i,enableSelecting:s,ctx:{domManager:n,zoomManager:o}}=this;if(!t||!this.isState(Ff.ZoomDraggable)||this.dragState!==0||this.isIgnoredTouch(e)||(this.panner.stopInteractions(),this.tryBeginAxisDelegation(e)))return;let a=0;const r=this.isPanningKeyPressed(e.sourceEvent);i&&(!s||r)?(n.updateCursor(Zu,"grabbing"),a=2,this.panner.start()):s&&!r&&(a=3),(this.dragState=a)!==0&&o.fireZoomPanStartEvent("zoom")}onSeriesAreaDragMove(e){const{dragState:t,enabled:i,paddedRect:s,panner:n,selector:o,ctx:{interactionManager:a,tooltipManager:r,updateService:l}}=this;if(this.activeAxis){this.onAxisDragMove(this.activeAxis.axisId,this.activeAxis.direction,e);return}if(!(!i||!s||!this.isState(Ff.ZoomDraggable)||this.isIgnoredTouch(e))){switch(a.pushState(k.InteractionState.ZoomDrag),e.device==="touch"&&e.sourceEvent.preventDefault(),t){case 2:n.update(e);break;case 3:o.update(e,this.getModuleProperties(),s);break;case 0:return}r.updateTooltip(Bf),l.update(IA.PERFORM_LAYOUT,{skipAnimations:!0})}}onSeriesAreaDragEnd(){const{ctx:{interactionManager:e}}=this;if(this.activeAxis){this.handleAxisDragEnd();return}e.popState(k.InteractionState.ZoomDrag),!(!this.enabled||this.dragState===0)&&(this.handleRegularDragEnd(),this.resetDragState())}handleAxisDragEnd(){this.onAxisDragEnd(),this.domProxy.endDelegatedAxisDrag(this.activeAxis.axisId),this.activeAxis=void 0,this.clearHoveredAxis()}handleRegularDragEnd(){const{panner:e,selector:t}=this;switch(this.dragState){case 2:e.stop();break;case 3:if(t.didUpdate()){const i=t.stop(this.seriesRect,this.paddedRect,this.getZoom());this.updateZoom(i)}break}}resetDragState(){this.dragState=0,this.ctx.domManager.updateCursor(Zu),this.ctx.tooltipManager.removeTooltip(Bf)}onAxisDoubleClick(e){const{enabled:t,enableDoubleClickToReset:i,ctx:{zoomManager:s}}=this;!t||!i||!this.isState(Ff.ZoomClickable)||(this.previousAxisZoomValid={[An.X]:!0,[An.Y]:!0},s.resetAxisZoom("zoom",e))}onAxisDragStart(e){const{axisDraggingMode:t,domProxy:i,enabled:s,enableAxisDragging:n,panner:o,ctx:{zoomManager:a}}=this;!s||!n||(o.stopInteractions(),t==="pan"?(i.setAxisCursor("grabbing"),this.dragState=2,this.panner.start(e),a.fireZoomPanStartEvent("zoom")):this.dragState=1)}onAxisDragMove(e,t,i){const{anchorPointX:s,anchorPointY:n,axisDragger:o,dragState:a,enabled:r,enableAxisDragging:l,seriesRect:c,shouldFlipXY:h,ctx:{interactionManager:d,tooltipManager:u,updateService:p,zoomManager:g}}=this;if(!r||!l||!c)return;d.pushState(k.InteractionState.ZoomDrag),i.device==="touch"&&i.sourceEvent.preventDefault();const f=this.getZoom();if(a===2)this.panner.update({currentX:i.offsetX,currentY:i.offsetY});else{let x=t===An.X?s:n;h&&(x=t===An.X?n:s);const m=g.getAxisZoom(e),v=o.update(i,t,x,c,f,m);g.setAxisManuallyAdjusted("zoom",e),this.updateAxisZoom(e,t,v,{directional:!0})}u.updateTooltip(Bf),p.update(IA.PERFORM_LAYOUT,{skipAnimations:!0})}onAxisDragEnd(){const{axisDraggingMode:e,axisDragger:t,dragState:i,domProxy:s,enabled:n,enableAxisDragging:o,ctx:{domManager:a,interactionManager:r,tooltipManager:l}}=this;r.popState(k.InteractionState.ZoomDrag),!(!n||!o||i===0)&&(this.dragState=0,e==="pan"&&(s.setAxisCursor("grab"),this.panner.stop()),t.stop(),a.updateCursor(Zu),l.removeTooltip(Bf))}onNavZoom(e){const{enabled:t,enableScrolling:i,scroller:s}=this;!this.ctx.interactionManager.isState(k.InteractionState.Default)||!t||!i||(e.widgetEvent.sourceEvent.preventDefault(),this.updateZoom(s.updateDelta(e.delta,this.getModuleProperties(),this.getZoom())))}onWheel(e){const{enabled:t,enablePanning:i,enableScrolling:s,paddedRect:n}=this;if(!t||!s||!n||!this.isState(Ff.ZoomWheelable))return;const{deltaX:o,deltaY:a}=e.sourceEvent,r=o!=null&&a!=null&&Math.abs(o)>Math.abs(a);i&&r?this.onWheelPanning(e):this.onWheelScrolling(e)}onWheelPanning(e){const{scrollingStep:t,scrollPanner:i,seriesRect:s,ctx:{zoomManager:n}}=this;if(!s)return;e.sourceEvent.preventDefault();const o=i.update(e,t,s,n.getAxisZooms());for(const[a,{direction:r,zoom:l}]of Tt(o))this.updateAxisZoom(a,r,l)}onWheelScrolling(e){const t=this.getZoom(),i=e.deltaY>0&&pv(t);this.handleWheelScrolling(e,i)}onAxisWheel(e,t,i){const{enableAxisScrolling:s,ctx:{zoomManager:n}}=this;if(!s||t!==An.X&&t!==An.Y)return;const o=t===An.X,a=!o,r=this.getModuleProperties({isScalingX:o,isScalingY:a}),l=this.getZoom(),c=i.deltaY>0&&l[t].min===Ro&&l[t].max===ns;n.setAxisManuallyAdjusted("zoom",e),this.handleWheelScrolling(i,c,r)}handleWheelScrolling(e,t,i=this.getModuleProperties()){const{enableIndependentAxes:s,scroller:n,seriesRect:o,ctx:{zoomManager:a}}=this;if(!o)return;let r=!0;if(s===!0){const l=n.updateAxes(e,i,o,a.getAxisZooms());for(const[c,{direction:h,zoom:d}]of Tt(l)){const u=h===An.X?this.constrainZoom({x:d,y:{min:ns,max:ns}}).x:d;r&&(r=this.updateAxisZoom(c,h,u))}}else{const l=n.update(e,i,o,this.getZoom());if(l==null)return;r=this.updateUnifiedZoom(l,{directional:!0})}t||(t=e.deltaY<0&&!r),this.firstWheelEventDirection!=null&&this.firstWheelEventDirection!==e.deltaY<0&&(this.isFirstWheelEvent=!0),this.isFirstWheelEvent?(this.wasFirstWheelEventZoomCapped=t,this.firstWheelEventDirection=e.deltaY<0,t||e.sourceEvent.preventDefault()):this.wasFirstWheelEventZoomCapped===!1&&e.sourceEvent.preventDefault(),this.isFirstWheelEvent=!1,this.debouncedWheelReset()}onTouchStart(e,t){!this.enableTwoFingerZoom||this.dragState!==0||this.twoFingers.start(e,t,this.getZoom())&&(this.dragState=4)}onTouchMove(e,t){if(!this.enableTwoFingerZoom||this.dragState!==4)return;const i=this.twoFingers.update(e,t);this.updateZoom(zo(i))}onTouchEnd(e){!this.enableTwoFingerZoom||this.dragState!==4||(e.sourceEvent.preventDefault(),this.twoFingers.end(e)&&(this.dragState=0))}onProcessData(e){this.shouldFlipXY=e.series.shouldFlipXY}onLayoutComplete(e){this.domProxy.update(this.enableAxisDragging,this.enableAxisScrolling,this.ctx,e.series.rect),this.enabled&&(this.seriesRect=e.series.rect,this.paddedRect=e.series.paddedRect,this.enableAxisDragging&&this.toggleAxisDraggingCursorsDebounced())}onZoomChange(e){e.callerId!=="zoom"&&this.panner.stopInteractions();const t=this.getZoom();this.buttons.toggleVisibleZoomed(pv(t))}onZoomPanStart(e){e.callerId==="zoom"&&this.panner.stopInteractions()}onPanUpdate(e){const{panner:t,seriesRect:i,ctx:{tooltipManager:s,zoomManager:n}}=this;if(!i)return;const o=t.translateZooms(i,n.getAxisZooms(),e.deltaX,e.deltaY);for(const[a,{direction:r,zoom:l}]of Tt(o))this.updateAxisZoom(a,r,l);s.updateTooltip(Bf)}isPanningKeyPressed(e){switch(this.panKey){case"alt":return e.altKey;case"ctrl":return e.ctrlKey;case"shift":return e.shiftKey;case"meta":return e.metaKey}}isScalingX(){return this.axes==="xy"?!0:this.shouldFlipXY?this.axes==="y":this.axes==="x"}isScalingY(){return this.axes==="xy"?!0:this.shouldFlipXY?this.axes==="x":this.axes==="y"}getAnchorPointX(){return this.shouldFlipXY?this.anchorPointY:this.anchorPointX}getAnchorPointY(){return this.shouldFlipXY?this.anchorPointX:this.anchorPointY}constrainZoom(e){const{minVisibleItems:t,ctx:{zoomManager:i}}=this;return t===0?e:i.constrainZoomToItemCount(e,t)??e}isZoomValid(e,t){const{minVisibleItems:i,ctx:{zoomManager:s}}=this;if(i===0)return this.previousZoomValid=!0,!0;const n=this.getZoom(),o=vv(os(e))=r)return this.previousAxisZoomValid[e]=!0,!0;if(!this.previousAxisZoomValid[e]&&i?.directional)return!1;const c=n.isVisibleItemsCountAtLeast(l,s);return this.previousAxisZoomValid[e]=i?.directional?c:!0,c}resetZoom(){this.previousZoomValid=!0,this.previousAxisZoomValid={[An.X]:!0,[An.Y]:!0},this.ctx.zoomManager.resetZoom("zoom")}updateSyncZoom(e){this.updateZoom(e)}updateZoom(e){this.enableIndependentAxes?this.updatePrimaryAxisZooms(e):this.updateUnifiedZoom(e)}updateUnifiedZoom(e,t){return e=this.constrainZoom(e),this.isZoomValid(e,t)?(this.ctx.zoomManager.updateZoom("zoom",e),!0):(this.ctx.updateService.update(IA.SCENE_RENDER,{skipAnimations:!0}),!1)}updatePrimaryAxisZooms(e){this.updatePrimaryAxisZoom(e,An.X),this.updatePrimaryAxisZoom(e,An.Y)}updatePrimaryAxisZoom(e,t){const i=this.ctx.zoomManager.getPrimaryAxisId(t);i!=null&&this.updateAxisZoom(i,t,e[t])}updateAxisZoom(e,t,i,s){const{enableIndependentAxes:n,ctx:{zoomManager:o}}=this;if(!i)return!1;const a=this.getZoom();return n!==!0?(a[t]=i,this.updateUnifiedZoom(a,s)):this.isAxisZoomValid(t,i,s)?(o.updateAxisZoom("zoom",e,i),!0):!1}updateAxisCursor(e){if(!this.domProxy)return;const{enableAxisDragging:t=this.enableAxisDragging,enableAxisScrolling:i=this.enableAxisScrolling,axisDraggingMode:s=this.axisDraggingMode}=e;t?this.domProxy.setAxisCursor(s==="pan"?"grab":void 0):i?this.domProxy.setAxisCursor("default"):this.domProxy.setAxisCursor(void 0)}toggleAxisDraggingCursors(){const{anchorPointX:e,anchorPointY:t,domProxy:i}=this,s=this.getZoom();let n=os(s)!==Vh,o=Kn(s)!==Vh;if(!n){const a=gv(s,.999,1);a.x=Yn(a.x,s.x,e),n=this.isZoomValid(a,{includeYVisibleRange:!0})}if(!o){const a=gv(s,1,.999);a.y=Yn(a.y,s.y,t),o=this.isZoomValid(a,{includeYVisibleRange:!0})}i.toggleAxisDraggingCursor(An.X,n),i.toggleAxisDraggingCursor(An.Y,o)}getZoom(){return Ts(this.ctx.zoomManager.getZoom())}getResetZoom(){return Ts(this.ctx.zoomManager.getRestoredZoom())}getModuleProperties(e){return{anchorPointX:e?.anchorPointX??this.getAnchorPointX(),anchorPointY:e?.anchorPointY??this.getAnchorPointY(),enabled:e?.enabled??this.enabled,independentAxes:e?.independentAxes??this.enableIndependentAxes===!0,isScalingX:e?.isScalingX??this.isScalingX(),isScalingY:e?.isScalingY??this.isScalingY(),keepAspectRatio:e?.keepAspectRatio??this.keepAspectRatio,scrollingStep:e?.scrollingStep??this.scrollingStep}}};y([$h({newValue(e){this.onEnabledChange(e)}}),ai],vi.prototype,"enabled",2),y([$h({changeValue(e){this.updateAxisCursor({enableAxisDragging:e})}}),ai],vi.prototype,"enableAxisDragging",2),y([$h({changeValue(e){this.updateAxisCursor({enableAxisScrolling:e})}}),ai],vi.prototype,"enableAxisScrolling",2),y([ai],vi.prototype,"enableDoubleClickToReset",2),y([$h({changeValue(e){this.ctx.zoomManager.setIndependentAxes(!!e)}}),ai],vi.prototype,"enableIndependentAxes",2),y([ai],vi.prototype,"enablePanning",2),y([ai],vi.prototype,"enableScrolling",2),y([ai],vi.prototype,"enableSelecting",2),y([ai],vi.prototype,"enableTwoFingerZoom",2),y([ai],vi.prototype,"panKey",2),y([ai],vi.prototype,"axes",2),y([ai],vi.prototype,"scrollingStep",2),y([ai],vi.prototype,"keepAspectRatio",2),y([ai],vi.prototype,"minVisibleItems",2),y([ai],vi.prototype,"anchorPointX",2),y([ai],vi.prototype,"anchorPointY",2),y([ai],vi.prototype,"autoScaling",2),y([$h({changeValue(e){this.updateAxisCursor({axisDraggingMode:e})}}),ai],vi.prototype,"axisDraggingMode",2),y([ai],vi.prototype,"buttons",2),y([Pte("panner.deceleration"),ai],vi.prototype,"deceleration",2);var Rte={enabled:!0,visible:"hover",buttons:[{icon:"zoom-out",value:"zoom-out",section:"scale"},{icon:"zoom-in",value:"zoom-in",section:"scale"},{icon:"pan-left",value:"pan-left",section:"pan"},{icon:"pan-right",value:"pan-right",section:"pan"},{icon:"reset",value:"reset",section:"reset"}]},zte={type:"root",optionsKey:"zoom",packageType:"enterprise",chartTypes:["cartesian","topology"],moduleFactory:e=>new vi(e),themeTemplate:{zoom:{anchorPointX:"end",anchorPointY:"middle",axes:"x",buttons:Rte,enabled:!1,enableAxisDragging:!0,enableDoubleClickToReset:!0,enablePanning:!0,enableScrolling:!0,enableSelecting:!1,enableTwoFingerZoom:!0,deceleration:"short",minVisibleItems:2,panKey:"alt",scrollingStep:.1,autoScaling:{enabled:{$eq:[{$path:"../axes"},"x"]},padding:.05}}}};function _f(e,t,i){return k.callWithContext(e.chartService,t,i)}var{AxisInterval:Fte,AxisLabel:Bte,ZIndexMap:_te,LinearScale:Vte,BBox:Gte,TranslatableGroup:jte,Selection:Hte,Text:Wte,createIdsGenerator:$te,findMinMax:Ute,findRangeExtent:Kte,estimateTickCount:Yte}=k,CA=class NC{constructor(t,i){this.ctx=t,this.dataProvider=i,this.id=hs(this),this.axisGroup=new jte({name:`${this.id}-AxisTicks`,zIndex:_te.AXIS}),this.labelSelection=Hte.select(this.axisGroup,Wte),this.interval=new Fte,this.label=new Bte,this.scale=new Vte,this.placement="bottom",this.translationX=0,this.translationY=0,this.padding=0}get horizontal(){return this.placement.startsWith("top")||this.placement.startsWith("bottom")}attachAxis(t){t.appendChild(this.axisGroup)}calculateLayout(){const{placement:t,translationX:i,translationY:s,horizontal:n,label:o}=this;function a(u){}let r,l;switch(t){case"top":case"top-right":case"top-left":r="bottom",l="center",o.mirrored=!1,o.parallel=!0;break;case"bottom":case"bottom-right":case"bottom-left":r="top",l="center",o.mirrored=!1,o.parallel=!0;break;case"right":case"right-top":case"right-bottom":case"left":case"left-top":case"left-bottom":r="middle",l="left",o.mirrored=!0,o.parallel=!1;break;default:}const c=[],h=this.generateTicks(),{ticks:d}=h;return this.labelSelection.update(d,void 0,u=>u.tickId),this.axisGroup.setProperties({translationX:i,translationY:s}),this.labelSelection.each((u,p)=>{u.fontFamily=o.fontFamily,u.fontSize=o.fontSize,u.fontStyle=o.fontStyle,u.fontWeight=o.fontWeight,u.fill=o.color,u.textBaseline=r,u.textAlign=l,u.text=p.tickLabel,u.x=n?p.translation:0,u.y=n?0:p.translation,c.push(u.getBBox())}),c.length>0?Gte.merge(c).translate(i,s):void 0}tickFormatter(t,i,s,n){const{ctx:o}=this,{formatManager:a}=o,r=this.dataProvider.data.flatMap(l=>l.series);return(l,c)=>{const h={type:"number",value:l,datum:void 0,seriesId:void 0,legendItemName:void 0,key:void 0,source:"gradient-legend",property:"color",domain:t,boundSeries:r,fractionDigits:n};return this.label.formatValue((d,u)=>_f(o,d,u),h,c)??a.format((d,u)=>_f(o,d,u),h)??a.defaultFormat(h)}}inRange(t,i=.001){const[s,n]=Ute(this.scale.range);return t>=s-i&&t<=n+i}generateTicks(){const{minSpacing:t,maxSpacing:i}=this.interval,{maxTickCount:s,minTickCount:n,tickCount:o}=Yte(Kte(this.scale.range),1,t,i,NC.DefaultTickCount,NC.DefaultMinSpacing),a=this.getTicksData({nice:!0,interval:this.interval.step,tickCount:o,minTickCount:n,maxTickCount:s});if(this.placement==="bottom"||this.placement==="top"){const r=Je(this.label),{domain:l}=this.scale,h=l[0]>l[1]?-1:1;let d=-1/0*h;a.ticks=a.ticks.filter(u=>{if(Math.sign(u.translation-d)!==h)return!1;const{width:p}=Ne(u.tickLabel)?On(u.tickLabel,this.label):r.measureLines(u.tickLabel);return d=u.translation+p*h,!0})}return a}getTicksData(t){const i=[],s=t.nice?this.scale.niceDomain(t):this.scale.domain,n=this.scale.ticks(t,s)?.ticks??[],o=n.reduce((l,c)=>Math.max(l,dp(c)),0),a=$te(),r=this.tickFormatter(s,n,!1,o);for(let l=0;lthis.onChartHoverChange()),e.layoutManager.registerElement(Qte.Legend,t=>this.onStartLayout(t)),()=>this.legendGroup.remove())}isVertical(){const{placement:e}=wA(this.position);return e.startsWith("right")||e.startsWith("left")}destroy(){this.cleanup.flush()}attachLegend(e){e.appendChild(this.legendGroup)}onStartLayout(e){const[t]=this.data;if(!this.enabled||!t?.enabled||t.legendType!=="gradient"){this.legendGroup.visible=!1;return}const{colorRange:i}=this.normalizeColorArrays(t),s=this.updateGradientRect(e.layoutBox,i),n=this.updateAxis(t,s)??new TA(0,0,0,0),o=TA.merge([s,n]),{strokeWidth:a,padding:r}=this.getContainerStyles();o.grow(r).grow(a);const{left:l,top:c}=this.getMeasurements(e.layoutBox,o);this.updateContainer(o),this.updateArrow(),this.legendGroup.visible=!0,this.legendGroup.translationX=l,this.legendGroup.translationY=c}normalizeColorArrays(e){let t=e.colorDomain.slice();const i=e.colorRange.slice();if(t.length===i.length)return{colorDomain:t,colorRange:i};t.length>i.length&&i.splice(t.length);const[s,n]=t,o=i.length;return t=i.map((a,r)=>r===0?s:r===o-1?n:s+(n-s)*r/(o-1)),{colorDomain:t,colorRange:i}}updateGradientRect(e,t){const{gradientRect:i,gradient:s}=this,{preferredLength:n,thickness:o}=s,a=new TA(0,0,0,0);let r;return this.isVertical()?(r=0,a.width=o,a.height=Math.min(e.height,n)):(r=90,a.width=Math.min(e.width,n),a.height=o),i.x=a.x,i.y=a.y,i.width=a.width,i.height=a.height,i.fill={type:"gradient",gradient:"linear",colorSpace:"oklch",colorStops:t.map((l,c)=>({stop:c/(t.length-1),color:l})),rotation:r},a}updateAxis(e,t){const{axisTicks:i,gradient:s,scale:n}=this,{placement:o}=wA(this.position),a=this.isVertical(),r=this.reverseOrder!==a;i.placement=o;const l=s.thickness+(n.padding??0);return i.translationX=a?l:t.x,i.translationY=a?t.y:l,i.scale.domain=r?e.colorDomain.slice().reverse():e.colorDomain,i.scale.range=a?[t.x,t.height]:[t.y,t.width],i.calculateLayout()}updateContainer(e){const t=this.getContainerStyles();k.applyShapeStyle(this.containerNode,t),this.containerNode.cornerRadius=t.cornerRadius,this.containerNode.x=e.x,this.containerNode.y=e.y,this.containerNode.width=e.width,this.containerNode.height=e.height}updateArrow(){const e=this.highlightManager.getActiveHighlight(),{arrow:t}=this;if(e?.colorValue==null){t.visible=!1;return}const{scale:i,label:s}=this.axisTicks,n=s.fontSize??0,o=i.convert(e.colorValue);let{x:a,y:r}=this.gradientRect,l=Math.PI;this.isVertical()?(a-=n/2,r+=o,l/=2):(a+=o,r-=n/2),t.visible=!0,t.fill=s.color,t.rotation=l,t.size=n,t.translationX=a,t.translationY=r}getMeasurements(e,t){function i(u){}let{x:s,y:n}=e;const{width:o,height:a}=t,{placement:r,floating:l,xOffset:c,yOffset:h}=wA(this.position),d=this.getContainerStyles();switch(s+=d.strokeWidth+d.padding.left,n+=d.strokeWidth+d.padding.top,r){case"left":n+=e.height/2-a/2;break;case"right":s+=e.width-o,n+=e.height/2-a/2;break;case"top":s+=e.width/2-o/2;break;case"bottom":s+=e.width/2-o/2,n+=e.height-a;break;case"right-top":case"top-right":s+=e.width-o;break;case"right-bottom":case"bottom-right":s+=e.width-o,n+=e.height-a;break;case"left-bottom":case"bottom-left":n+=e.height-a;break;case"left-top":case"top-left":break;default:}if(!l)switch(r){case"left":case"left-top":case"left-bottom":e.shrink(o+this.spacing,"left");break;case"right":case"right-top":case"right-bottom":e.shrink(o+this.spacing,"right");break;case"top":case"top-left":case"top-right":e.shrink(a+this.spacing,"top");break;case"bottom":case"bottom-left":case"bottom-right":e.shrink(a+this.spacing,"bottom");break;default:}return s+=c,n+=h,{top:n,left:s}}getContainerStyles(){const{stroke:e,strokeOpacity:t,strokeWidth:i}=this.border,{cornerRadius:s,fill:n,fillOpacity:o,padding:a}=this,r=typeof a=="number";return{cornerRadius:s,fill:n,fillOpacity:o,padding:{top:r?a:a.top??0,right:r?a:a.right??0,bottom:r?a:a.bottom??0,left:r?a:a.left??0},stroke:e,strokeOpacity:t,strokeWidth:this.border.enabled?i:0}}onChartHoverChange(){this.enabled&&this.updateArrow()}};Xn.className="GradientLegend",y([Zn],Xn.prototype,"enabled",2),y([Zn],Xn.prototype,"position",2),y([Zn],Xn.prototype,"reverseOrder",2),y([Zn],Xn.prototype,"gradient",2),y([Zn],Xn.prototype,"spacing",2),y([Zn],Xn.prototype,"border",2),y([Zn],Xn.prototype,"cornerRadius",2),y([Zn],Xn.prototype,"fill",2),y([Zn],Xn.prototype,"fillOpacity",2),y([Zn],Xn.prototype,"padding",2),y([Zn],Xn.prototype,"scale",2);var iie={type:"legend",optionsKey:"gradientLegend",packageType:"enterprise",chartTypes:["cartesian","polar","topology","standalone"],identifier:"gradient",moduleFactory:e=>new Xn(e),themeTemplate:{enabled:!1,position:"bottom",spacing:20,scale:{padding:13,label:{color:{$ref:"textColor"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},minSpacing:5},interval:{minSpacing:15}},gradient:{preferredLength:100,thickness:16},reverseOrder:!1,fill:{$applySwitch:[{$path:"type"},{$ref:"chartBackgroundColour"},["gradient",k.FILL_GRADIENT_BLANK_DEFAULTS],["pattern",k.FILL_PATTERN_BLANK_DEFAULTS],["image",k.FILL_IMAGE_BLANK_DEFAULTS]]}},removable:"standalone-only"};function sie(e,t){const i=e.addChild("canvas-overlay","watermark"),s=De("span");s.innerText=t,i.addEventListener("animationend",()=>{e.removeChild("canvas-overlay","watermark"),e.removeStyles("watermark")}),i.classList.add("ag-watermark"),i.appendChild(s)}var{ordinalTimeAxisOptionsDefs:nie,angleNumberAxisOptionsDefs:oie,angleCategoryAxisOptionsDefs:aie,radiusNumberAxisOptionsDefs:rie,radiusCategoryAxisOptionsDefs:lie}=k,cie={type:"axis",name:"ordinal-time",chartType:"cartesian",enterprise:!0,options:nie,create:e=>new uf(e)},hie={type:"axis",name:"angle-number",chartType:"polar",enterprise:!0,options:oie,create:e=>new xh(e)},die={type:"axis",name:"angle-category",chartType:"polar",enterprise:!0,options:aie,create:e=>new Vl(e)},uie={type:"axis",name:"radius-number",chartType:"polar",enterprise:!0,options:rie,create:e=>new Mu(e)},pie={type:"axis",name:"radius-category",chartType:"polar",enterprise:!0,options:lie,create:e=>new Gl(e)},{Chart:gie}=k,OA=class extends gie{getChartType(){return"standalone"}performLayout(e){const{seriesRoot:t,annotationRoot:i}=this,{layoutBox:s}=e,n=s.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=n,this.animationRect=n;for(const o of[t,i])o.translationX=Math.floor(n.x),o.translationY=Math.floor(n.y);t.visible=this.series[0].visible,this.ctx.layoutManager.emitLayoutComplete(e,{series:{visible:!0,rect:n,paddedRect:s}})}getAriaLabel(){const e=this.series[0]?.type;if(e==null)return"";const t=this.getCaptionText();switch(e){case"radial-gauge":case"linear-gauge":{const i=[];t.length!==0&&i.push(t);for(const s of this.series)i.push(s.getCaptionText());return this.ctx.localeManager.t("ariaAnnounceGaugeChart",{caption:i.join(". ")})}case"treemap":case"sunburst":return this.ctx.localeManager.t("ariaAnnounceHierarchyChart",{caption:t});default:return this.ctx.localeManager.t("ariaAnnounceStandaloneChart",{caption:t})}}};OA.className="StandaloneChart",OA.type="standalone";var{isAgStandaloneChartOptions:fie,standaloneChartOptionsDefs:yie}=k,mie={type:"chart",name:"standalone",enterprise:!0,options:yie,detect:fie,create(e,t){return new OA(e,t)}},{Chart:xie,MercatorScale:VF,ChartAxisDirection:Mv,Property:bie}=k;function GF(e){return e.type==="map-shape"||e.type==="map-line"||e.type==="map-marker"||e.type==="map-shape-background"||e.type==="map-line-background"}var Dv=class extends xie{constructor(e,t){super(e,t),this.ctx.zoomManager.updateAxes([Mv.X,Mv.Y])}getChartType(){return"topology"}async updateData(){await super.updateData();const e=this.getOptions();this.topology!==e.topology&&(this.topology=e.topology);const{topology:t}=this;for(const i of this.series)GF(i)&&i.setChartTopology(t)}performLayout(e){const{seriesRoot:t,annotationRoot:i}=this,{layoutBox:s}=e,n=s.clone().shrink(this.modulesManager.getModule("seriesArea").getPadding());this.seriesRect=n,this.animationRect=n;const o=this.series.filter(GF),a=o.reduce((c,h)=>{if(!h.visible)return c;const d=h.topologyBounds;return d==null?c:c==null?d:c.merge(d)},void 0);let r;if(a!=null){const{lon0:c,lat0:h,lon1:d,lat1:u}=a,p=[[c,h],[d,u]],g=VF.bounds(p),{width:f,height:x}=n,m=Math.min(f/g.width,x/g.height),v=g.width*m,b=g.height*m,S=(f-v)/2,D=(x-b)/2,L=S,I=D,A=S+v,T=D+b,w=this.ctx.zoomManager.getAxisZoom(Mv.X),N=this.ctx.zoomManager.getAxisZoom(Mv.Y),O=(A-L)/(w.max-w.min),P=L-O*w.min,F=(T-I)/(1-N.min-(1-N.max)),_=I-F*(1-N.max);r=new VF(p,[[P,_],[P+O,_+F]])}for(const c of o)c.scale=r;const l=this.series.some(c=>c.visible);t.visible=l;for(const c of[t,i])c.translationX=Math.floor(n.x),c.translationY=Math.floor(n.y),c.setClipRect(n.clone());this.ctx.layoutManager.emitLayoutComplete(e,{series:{visible:l,rect:n,paddedRect:s}})}};Dv.className="TopologyChart",Dv.type="topology",y([bie],Dv.prototype,"topology",2);var{isAgTopologyChartOptions:vie,topologyChartOptionsDefs:Sie}=k,Mie={type:"chart",name:"topology",enterprise:!0,options:Sie,detect:vie,create(e,t){return new Dv(e,t)}},{annotationCalloutStylesDefs:Die,annotationNoteStylesDefs:kie,annotationTextStylesDef:Iie,annotationCommentStylesDefs:Aie,annotationMeasurerStylesDefs:kv,annotationQuickMeasurerStylesDefs:Cie,annotationShapeStylesDefs:jF,annotationChannelTextDefs:Lie,annotationCrossLineStyleDefs:HF,annotationFibonacciStylesDefs:WF,annotationLineStyleDefs:$F,annotationLineTextDefs:Tie,annotationDisjointChannelStyleDefs:wie,annotationParallelChannelStyleDefs:Nie}=k,Vf=At({__type:U(Ce("date")),value:Ie(E,Z)},"a serializable date object"),UF=Ie(E,Z,Vf),EA=Ie(UF,At({value:UF,groupPercentage:JC(-1,2)})),KF={...Lie,label:E},Ja={...Tie,label:E},vt={x:EA,y:Z},Oie=Sc({line:{...$F,start:vt,end:vt,text:Ja},"horizontal-line":{...HF,value:EA,text:Ja},"vertical-line":{...HF,value:EA,text:Ja},"disjoint-channel":{...wie,startHeight:Z,endHeight:Z,start:vt,end:vt,text:KF},"parallel-channel":{...Nie,height:Z,start:vt,end:vt,text:KF},"fibonacci-retracement":{...WF,start:vt,end:vt,text:Ja,reverse:G},"fibonacci-retracement-trend-based":{...WF,start:vt,end:vt,endRetracement:vt,text:Ja,reverse:G},callout:{...Die,start:vt,end:vt,text:E},comment:{...Aie,...vt,text:E},note:{...kie,...vt,text:E},text:{...Iie,...vt,text:E},arrow:{...$F,text:Ja,start:vt,end:vt},"arrow-up":{...jF,...vt},"arrow-down":{...jF,...vt},"date-range":{...kv,extendAbove:G,extendBelow:G,text:Ja,start:vt,end:vt},"price-range":{...kv,extendLeft:G,extendRight:G,text:Ja,start:vt,end:vt},"date-price-range":{...kv,text:Ja,start:vt,end:vt},"quick-date-price-range":{...kv,...Cie,text:Ja,start:vt,end:vt}},"an annotation initial state object"),Eie={chartType:J("candlestick","hollow-candlestick","ohlc","line","step-line","hlc","high-low"),annotations:Rt(Oie),legend:Rt({visible:G,seriesId:E,itemId:E,legendItemName:E},"legend state array"),zoom:{rangeX:{start:Ie(Z,Vf),end:Ie(Z,Vf)},rangeY:{start:Ie(Z,Vf),end:Ie(Z,Vf)},ratioX:{start:tt(ge,to("end")),end:tt(ge,io("start"))},ratioY:{start:tt(ge,to("end")),end:tt(ge,io("start"))},autoScaledAxes:Me(Ce("y"))}},{annotationOptionsDef:Pie}=k,Rie={type:"plugin",name:"annotations",chartType:"cartesian",options:Pie,create(){return null}},zie={type:"plugin",name:"navigator",chartType:"cartesian",options:_ee,create(){return null}},Fie={type:"plugin",name:"initialState",options:Eie,create(){return null}};function YF(e,t,i){i||(t=Bie(t));const s=new Map;for(const o of e)s.set(o.id,{datum:o,linksBefore:[],linksAfter:[],maxPathLengthBefore:-1,maxPathLengthAfter:-1});let n=0;for(const[o,a]of s.entries())n=Math.max(n,PA(s,t,a,o,-1,[])+PA(s,t,a,o,1,[])+1);return{links:t,nodeGraph:s,maxPathLength:n}}function ZF(e,t,i,s){const n=s.indexOf(t);if(n!==-1){for(let a=n;a!t.has(i))}function PA(e,t,i,s,n,o){if(o.includes(s))return 1/0;let a=n===-1?i.maxPathLengthBefore:i.maxPathLengthAfter;if(a===-1){a=0;const r=n===-1?i.linksBefore:i.linksAfter;for(const l of t){const{fromNode:c,toNode:h}=l,d=n===-1?h.id:c.id,u=n===-1?c.id:h.id,p=s===d?e.get(u):void 0;p!=null&&(r.push({node:p,link:l}),o?.push(s),a=Math.max(a,PA(e,t,p,u,n,o)+1),o?.pop())}n===-1?i.maxPathLengthBefore=a:i.maxPathLengthAfter=a}return a}var{Series:_ie,DataController:Vie,keyProperty:Gie,valueProperty:Iv,Selection:Uh,Group:Xu,TransformableText:jie}=k,Hie=class extends k.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s);const{datumIndex:n}=i,o=s.contextNodeData?.nodeData.find(a=>a.datumIndex.type===n.type&&a.datumIndex.index===n.index);this.size=o?.size,this.label=o?.type===1?o?.label:void 0}},XF=class extends _ie{constructor(){super(...arguments),this.NodeEvent=Hie,this.nodeCount=0,this.linkCount=0,this.linksDataModel=void 0,this.linksProcessedData=void 0,this.nodesDataModel=void 0,this.nodesProcessedData=void 0,this.processedNodes=new Map,this.linkGroup=this.contentGroup.appendChild(new Xu({name:"linkGroup"})),this.nodeGroup=this.contentGroup.appendChild(new Xu({name:"nodeGroup"})),this.focusLinkGroup=this.highlightGroup.appendChild(new Xu({name:"linkGroup"})),this.focusNodeGroup=this.highlightGroup.appendChild(new Xu({name:"nodeGroup"})),this.highlightLinkGroup=this.highlightGroup.appendChild(new Xu({name:"linkGroup"})),this.highlightNodeGroup=this.highlightGroup.appendChild(new Xu({name:"nodeGroup"})),this.labelSelection=Uh.select(this.labelGroup,jie),this.linkSelection=Uh.select(this.linkGroup,()=>this.linkFactory()),this.nodeSelection=Uh.select(this.nodeGroup,()=>this.nodeFactory()),this.focusLinkSelection=Uh.select(this.focusLinkGroup,()=>this.linkFactory()),this.focusNodeSelection=Uh.select(this.focusNodeGroup,()=>this.nodeFactory()),this.highlightLinkSelection=Uh.select(this.highlightLinkGroup,()=>this.linkFactory()),this.highlightNodeSelection=Uh.select(this.highlightNodeGroup,()=>this.nodeFactory())}get nodes(){return this.properties.nodes}async processData(e){const{data:t,nodes:i}=this;if(t==null)return;const{fromKey:s,toKey:n,sizeKey:o,idKey:a,labelKey:r}=this.properties,l=new Vie("standalone",e.suppressFieldDotNotation),c=i==null?null:l.request(this.id,k.DataSet.wrap(i)??k.DataSet.empty(),{props:[Gie(a,void 0,{id:"idValue",includeProperty:!1}),...r==null?[]:[Iv(r,void 0,{id:"labelValue",includeProperty:!1})]],groupByKeys:!0}),h=e.request(this.id,t,{props:[Iv(s,void 0,{id:"fromValue",includeProperty:!1}),Iv(n,void 0,{id:"toValue",includeProperty:!1}),...o==null?[]:[Iv(o,void 0,{id:"sizeValue",includeProperty:!1,missingValue:0})]],groupByKeys:!1});i!=null&&l.execute();const[d,u]=await Promise.all([c??Promise.resolve(null),h]);this.nodesDataModel=d?.dataModel,this.nodesProcessedData=d?.processedData,this.linksDataModel=u?.dataModel,this.linksProcessedData=u?.processedData;const p=new Map;if(d==null){const g=u.dataModel.resolveColumnById(this,"fromValue",u.processedData),f=u.dataModel.resolveColumnById(this,"toValue",u.processedData),x=v=>{const b=p.size,S=v;return{series:this,itemId:void 0,datum:{},datumIndex:{type:1,index:b},type:1,index:b,linksBefore:[],linksAfter:[],id:v,size:0,label:S,style:this.getNodeStyle({datumIndex:{type:1,index:b},datum:{},size:0,label:S},b,!1)}},m=u.processedData.dataSources.get(this.id)?.data;if(m)for(const[v]of m.entries()){const b=g[v],S=f[v];b==null||S==null||(p.has(b)||p.set(b,x(b)),p.has(S)||p.set(S,x(S)))}}else{const g=d.dataModel.resolveColumnById(this,"idValue",d.processedData),f=r==null?void 0:d.dataModel.resolveColumnById(this,"labelValue",d.processedData),x=d.processedData.dataSources.get(this.id)?.data;if(x)for(const[m,v]of x.entries()){const b=g[m],S=f?.[m],D={type:1,index:m};p.set(b,{series:this,itemId:void 0,datum:v,datumIndex:D,type:1,index:m,linksBefore:[],linksAfter:[],id:b,size:0,label:S,style:this.getNodeStyle({datumIndex:D,datum:v,size:0,label:S},m,!1)})}}this.processedNodes=p}getNodeGraph(e,t,{includeCircularReferences:i}){const{linksDataModel:s,linksProcessedData:n}=this;if(s==null||n==null){const{links:f,nodeGraph:x,maxPathLength:m}=YF(new Map().values(),[],i);return this.nodeCount=0,this.linkCount=0,{nodeGraph:x,links:f,maxPathLength:m}}const{sizeKey:o}=this.properties,a=s.resolveColumnById(this,"fromValue",n),r=s.resolveColumnById(this,"toValue",n),l=o==null?void 0:s.resolveColumnById(this,"sizeValue",n),c=new Map;for(const f of this.processedNodes.values()){const x=e(f);c.set(f.id,x)}const h=[],d=n.dataSources.get(this.id)?.data;if(d)for(const[f,x]of d.entries()){const m=a[f],v=r[f],b=l==null?1:l[f],S=c.get(m),D=c.get(v);if(b<=0||S==null||D==null)continue;const L={type:0,index:f},I=t({series:this,itemId:void 0,datum:x,datumIndex:L,type:0,index:f,fromNode:S,toNode:D,size:b,style:this.getLinkStyle({datum:x,datumIndex:L},S.datumIndex,!1)});h.push(I)}const{links:u,nodeGraph:p,maxPathLength:g}=YF(c.values(),h,i);for(const f of p.values())f.datum.linksBefore=f.linksBefore.map(x=>x.link),f.datum.linksAfter=f.linksAfter.map(x=>x.link);return this.nodeCount=p.size,this.linkCount=u.length,{nodeGraph:p,links:u,maxPathLength:g}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(e){const{seriesRect:t}=e,i={seriesRectWidth:t?.width??0,seriesRectHeight:t?.height??0};(this._nodeDataDependencies==null||this._nodeDataDependencies.seriesRectWidth!==i.seriesRectWidth||this._nodeDataDependencies.seriesRectHeight!==i.seriesRectHeight)&&(this._nodeDataDependencies=i),this.updateSelections();const s=this.contextNodeData?.nodeData??[],n=this.contextNodeData?.labelData??[];let o=this.ctx.highlightManager?.getActiveHighlight();if(o?.series===this&&o.type==null){const{itemId:h}=o;o=h==null?void 0:s.find(d=>d.type===1&&d.id===h)}else o?.series!==this&&(o=void 0);this.contentGroup.visible=this.visible,this.contentGroup.opacity=o==null?1:this.properties.highlight.unhighlightedItem.opacity??1,this.labelSelection=this.updateLabelSelection({labelData:n,labelSelection:this.labelSelection}),this.updateLabelNodes({labelSelection:this.labelSelection}),this.linkSelection=this.updateLinkSelection({nodeData:s.filter(h=>h.type===0),datumSelection:this.linkSelection}),this.updateLinkNodes({datumSelection:this.linkSelection,isHighlight:!1}),this.nodeSelection=this.updateNodeSelection({nodeData:s.filter(h=>h.type===1),datumSelection:this.nodeSelection}),this.updateNodeNodes({datumSelection:this.nodeSelection,isHighlight:!1});let a,r,l,c;o?.type===1?(a=s.filter(h=>h.type===0&&(h.toNode===o||h.fromNode===o)),r=a.map(h=>h.fromNode===o?h.toNode:h.fromNode),r.push(o),l=[],c=[o]):o?.type===0?(a=[o],r=[o.fromNode,o.toNode],l=[o],c=[]):(a=[],r=[],l=[],c=[]),this.focusLinkSelection=this.updateLinkSelection({nodeData:a,datumSelection:this.focusLinkSelection}),this.updateLinkNodes({datumSelection:this.focusLinkSelection,isHighlight:!1}),this.focusNodeSelection=this.updateNodeSelection({nodeData:r,datumSelection:this.focusNodeSelection}),this.updateNodeNodes({datumSelection:this.focusNodeSelection,isHighlight:!1}),this.highlightLinkSelection=this.updateLinkSelection({nodeData:l,datumSelection:this.highlightLinkSelection}),this.updateLinkNodes({datumSelection:this.highlightLinkSelection,isHighlight:!0}),this.highlightNodeSelection=this.updateNodeSelection({nodeData:c,datumSelection:this.highlightNodeSelection}),this.updateNodeNodes({datumSelection:this.highlightNodeSelection,isHighlight:!0})}resetAnimation(e){}dataCount(){return Number.NaN}getSeriesDomain(e){return[]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}legendItemSymbol(e,t,i={}){const{fills:s,strokes:n}=this.properties,{fill:o=s[t%s.length],fillOpacity:a=1,stroke:r=n[t%n.length],strokeWidth:l=0,strokeOpacity:c=1,lineDash:h=[0],lineDashOffset:d=0}=i;return{marker:{fill:o,fillOpacity:a,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}}}getLegendData(e){if(e!=="category")return[];const{showInLegend:t}=this.properties;return Array.from(this.processedNodes.values(),({id:i,label:s},n)=>({legendType:"category",id:this.id,itemId:i,seriesId:this.id,enabled:!0,label:{text:s??i},symbol:this.legendItemSymbol(1,n),hideInLegend:!t,isFixed:!0}))}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.linkSelection.each((n,o)=>{const a=n.distanceSquared(e,t);a{const a=n.distanceSquared(e,t);ah.datum),c=r.indexOf(s)+t;c>=0&&c0?n=r.at(-1):n=Array.from(this.nodeSelection,d=>d.datum).at(-1)}else if(s?.type===1){const r=Array.from(this.nodeSelection,h=>h.datum),c=r.indexOf(s)+t;c>=0&&cd.datum)[0]}if(n==null)return;const o=n.type===1?Array.from(this.nodeSelection).find(r=>r.datum===n):Array.from(this.linkSelection).find(r=>r.datum===n);if(o==null)return;const a=this.computeFocusBounds(o.node);if(a!=null)return{datum:o.datum,datumIndex:this.contextNodeData?.nodeData.indexOf(o.datum)??0,otherIndex:0,bounds:a,clipFocusBox:!0}}getCategoryValue(e){}datumIndexForCategoryValue(e){}},{Path:Wie,SceneChangeDetection:hc}=k;function qF({radius:e,startAngle:t,endAngle:i,tension:s}){const n=e*Math.cos(t),o=e*Math.sin(t),a=e*Math.cos(i),r=e*Math.sin(i),l=n*s,c=o*s,h=a*s,d=r*s;return{x:[n,l,h,a],y:[o,c,d,r]}}var Jr=class extends Wie{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.radius=0,this.startAngle1=0,this.endAngle1=0,this.startAngle2=0,this.endAngle2=0,this.tension=1}tensionedCurveTo(e,t,i,s,n,o,a,r){const{path:l,tension:c}=this,h=1-c;l.cubicCurveTo((i-e)*h+e,(s-t)*h+t,(n-a)*h+a,(o-r)*h+r,a,r)}updatePath(){const{path:e,centerX:t,centerY:i,radius:s}=this;let{startAngle1:n,endAngle1:o,startAngle2:a,endAngle2:r}=this;n>a&&([n,a]=[a,n],[o,r]=[r,o]),e.clear();const l=t+s*Math.cos(n),c=i+s*Math.sin(n);e.moveTo(l,c),this.tensionedCurveTo(l,c,t,i,t,i,t+s*Math.cos(r),i+s*Math.sin(r)),e.arc(t,i,s,r,a,!0),this.tensionedCurveTo(t+s*Math.cos(a),i+s*Math.sin(a),t,i,t,i,t+s*Math.cos(o),i+s*Math.sin(o)),e.arc(t,i,s,o,n,!0),e.closePath()}};y([hc()],Jr.prototype,"centerX",2),y([hc()],Jr.prototype,"centerY",2),y([hc()],Jr.prototype,"radius",2),y([hc()],Jr.prototype,"startAngle1",2),y([hc()],Jr.prototype,"endAngle1",2),y([hc()],Jr.prototype,"startAngle2",2),y([hc()],Jr.prototype,"endAngle2",2),y([hc()],Jr.prototype,"tension",2);var{FillGradientDefaults:$ie,FillPatternDefaults:Uie,FillImageDefaults:Kie,BaseProperties:QF,makeSeriesTooltip:Yie,SeriesProperties:Zie,Property:We,Label:Xie}=k,RA=class extends Xie{constructor(){super(...arguments),this.spacing=1,this.maxWidth=1}};y([We],RA.prototype,"spacing",2),y([We],RA.prototype,"maxWidth",2);var er=class extends QF{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0,this.tension=0}getStyle(e,t,i){const{fillOpacity:s,strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r,tension:l}=this,c=this.fill??e[i%e.length],h=this.stroke??t[i%e.length];return{fill:c,fillOpacity:s,stroke:h,strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r,tension:l}}};y([We],er.prototype,"fill",2),y([We],er.prototype,"fillOpacity",2),y([We],er.prototype,"stroke",2),y([We],er.prototype,"strokeOpacity",2),y([We],er.prototype,"strokeWidth",2),y([We],er.prototype,"lineDash",2),y([We],er.prototype,"lineDashOffset",2),y([We],er.prototype,"tension",2),y([We],er.prototype,"itemStyler",2);var fa=class extends QF{constructor(){super(...arguments),this.spacing=1,this.width=1,this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t,i){const{fillOpacity:s,strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r}=this,l=this.fill??e[i%e.length],c=this.stroke??t[i%e.length];return{fill:l,fillOpacity:s,stroke:c,strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r}}};y([We],fa.prototype,"spacing",2),y([We],fa.prototype,"width",2),y([We],fa.prototype,"fill",2),y([We],fa.prototype,"fillOpacity",2),y([We],fa.prototype,"stroke",2),y([We],fa.prototype,"strokeOpacity",2),y([We],fa.prototype,"strokeWidth",2),y([We],fa.prototype,"lineDash",2),y([We],fa.prototype,"lineDashOffset",2),y([We],fa.prototype,"itemStyler",2);var Zi=class extends Zie{constructor(){super(),this.idKey="",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.sizeKey=void 0,this.sizeName=void 0,this.nodes=void 0,this.fillGradientDefaults=new $ie,this.fillPatternDefaults=new Uie,this.fillImageDefaults=new Kie,this.fills=[],this.strokes=[],this.label=new RA,this.link=new er,this.node=new fa,this.tooltip=Yie(),this.highlightStyle.deprecated=!1}};y([We],Zi.prototype,"fromKey",2),y([We],Zi.prototype,"toKey",2),y([We],Zi.prototype,"idKey",2),y([We],Zi.prototype,"idName",2),y([We],Zi.prototype,"labelKey",2),y([We],Zi.prototype,"labelName",2),y([We],Zi.prototype,"sizeKey",2),y([We],Zi.prototype,"sizeName",2),y([We],Zi.prototype,"nodes",2),y([We],Zi.prototype,"fillGradientDefaults",2),y([We],Zi.prototype,"fillPatternDefaults",2),y([We],Zi.prototype,"fillImageDefaults",2),y([We],Zi.prototype,"fills",2),y([We],Zi.prototype,"strokes",2),y([We],Zi.prototype,"label",2),y([We],Zi.prototype,"link",2),y([We],Zi.prototype,"node",2),y([We],Zi.prototype,"tooltip",2);var{SeriesNodePickMode:JF,createDatumId:Av,angleBetween:Cv,normalizeAngle360:qie,isBetweenAngles:eB,Sector:Qie,evaluateBezier:Lv,applyShapeStyle:tB,getShapeStyle:Tv,getLabelStyles:Jie,BBox:ese,mergeDefaults:wv}=k,Nv=e=>e.startAngle+Cv(e.startAngle,e.endAngle)/2,Ov=class extends XF{constructor(e){super({moduleCtx:e,pickModes:[JF.NEAREST_NODE,JF.EXACT_SHAPE_MATCH]}),this.properties=new Zi}isLabelEnabled(){return(this.properties.labelKey!=null||this.nodes==null)&&this.properties.label.enabled}linkFactory(){return new Jr}nodeFactory(){return new Qie}createNodeData(){const{id:e,_nodeDataDependencies:{seriesRectWidth:t,seriesRectHeight:i}={seriesRectWidth:0,seriesRectHeight:0},properties:s}=this,{fromKey:n,toKey:o,sizeKey:a,labelKey:r,label:{spacing:l,maxWidth:c,fontSize:h},node:{width:d,spacing:u}}=s,p=t/2,g=i/2;let f=[];const{nodeGraph:x,links:m}=this.getNodeGraph(_=>({..._,centerX:p,centerY:g,innerRadius:Number.NaN,outerRadius:Number.NaN,startAngle:Number.NaN,endAngle:Number.NaN}),_=>({..._,centerX:p,centerY:g,radius:Number.NaN,startAngle1:Number.NaN,endAngle1:Number.NaN,startAngle2:Number.NaN,endAngle2:Number.NaN}),{includeCircularReferences:!0});let v=0;for(const[_,{datum:z,linksBefore:B,linksAfter:R}]of x.entries()){const V=B.reduce((j,{link:$})=>j+$.size,0)+R.reduce((j,{link:$})=>j+$.size,0);if(V===0)x.delete(_);else{const{label:j}=s;z.size=V,v+=z.size;const $=j.enabled?this.getLabelText(z.label,z.datum,r,"label",[],j,{datum:z.datum,value:z.label,fromKey:n,toKey:o,sizeKey:a,size:z.size}):void 0;z.label=$e($)}}let b=0;if(this.isLabelEnabled()){const _=Je(this.properties.label);let z=0;for(const{datum:B}of x.values()){const{id:R,label:V}=B;if(V==null)continue;const j=cl(V,{maxWidth:c,font:this.properties.label,textWrap:"never"}),{width:$}=_.measureLines(j);z=Math.max($,z),f.push({id:R,text:j,centerX:p,centerY:g,angle:Number.NaN,radius:Number.NaN,size:B.size})}b=z+l}const S=x.size;let D=Math.min(t,i)/2-d-b,L=u/D;if(b!==0&&(S*L>=1.5*Math.PI||D<=0)&&(f=[],D=Math.min(t,i)/2-d,L=u/D),S*L>=2*Math.PI||D<=0){K.warnOnce("There was insufficient space to display the Chord Series.");return}const I=D,A=D+d,T=Math.max((2*Math.PI-S*L)/v,0);let w=0;for(const{datum:_}of x.values()){_.innerRadius=I,_.outerRadius=A,_.startAngle=w,_.endAngle=w+_.size*T,w=_.endAngle+L;const z=(_.innerRadius+_.outerRadius)/2,B=Nv(_);_.midPoint={x:_.centerX+z*Math.cos(B),y:_.centerY+z*Math.sin(B)}}const N=[];for(const{datum:_,linksBefore:z,linksAfter:B}of x.values()){const R=Nv(_),V=[...z.map($=>({link:$.link,distance:Cv(Nv($.node.datum),R),after:!1})),...B.map($=>({link:$.link,distance:Cv(Nv($.node.datum),R),after:!0}))];let j=_.startAngle;for(const{link:$,after:W}of V.toSorted((Y,se)=>Y.distance-se.distance)){const Y=$.size*T;W?($.startAngle1=j,$.endAngle1=j+Y):($.startAngle2=j,$.endAngle2=j+Y),j+=$.size*T}N.push(_)}const{tension:O}=this.properties.link;for(const _ of m){_.radius=D;const z=qF({radius:D,startAngle:_.startAngle1,endAngle:_.endAngle2,tension:O}),B=qF({radius:D,startAngle:_.startAngle2,endAngle:_.endAngle1,tension:O}),R=Lv(...z.x,.5),V=Lv(...z.y,.5),j=Lv(...B.x,.5),$=Lv(...B.y,.5);_.midPoint={x:_.centerX+(R+j)/2,y:_.centerY+(V+$)/2},N.push(_)}for(const _ of f){const z=x.get(_.id)?.datum;z!=null&&(_.radius=A+l,_.angle=qie(z.startAngle+Cv(z.startAngle,z.endAngle)/2))}f.sort((_,z)=>_.angle-z.angle);let P=1/0,F=-1/0;return f=f.filter(_=>{const z=$o(h),B=Math.atan2(z/2,_.radius),R=_.angle-B,V=_.angle+B;return eB(P,R,V)||eB(F,R,V)?!1:(P=Math.min(R,P),F=Math.max(V,F),!0)}),{itemId:e,nodeData:N,labelData:f}}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const t={toKey:this.properties.toKey,fromKey:this.properties.fromKey,sizeKey:this.properties.sizeKey,size:Number.NaN},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{size:n,text:o,centerX:a,centerY:r,radius:l,angle:c})=>{t.size=n;const h=Jie(this,void 0,t,this.properties.label,!1,i),{fontStyle:d,fontWeight:u,fontSize:p,fontFamily:g,color:f}=h;s.visible=!0,s.translationX=a+l*Math.cos(c),s.translationY=r+l*Math.sin(c),s.text=o,s.fill=f,s.fontStyle=d,s.fontWeight=u,s.fontSize=p,s.fontFamily=g,s.textBaseline="middle",Math.cos(c)>=0?(s.textAlign="left",s.rotation=c):(s.textAlign="right",s.rotation=c-Math.PI),s.setBoxing(h)})}updateNodeSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>Av(t.type,t.id))}getNodeStyle(e,t,i){const{properties:s}=this,{fills:n,strokes:o,fillGradientDefaults:a,fillPatternDefaults:r,fillImageDefaults:l}=s,{itemStyler:c}=s.node,h=this.getHighlightStyle(i,e.datumIndex),d=wv(h,s.node.getStyle(n,o,t));let u=Tv(d,a,r,l);if(c!=null&&e.datumIndex!=null){const p=this.cachedDatumCallback(Av(e.datumIndex.index,"node",i?"highlight":"node"),()=>{const g=this.makeItemStylerParams(e,i,u);return this.callWithContext(c,g)});p&&(u=Tv(wv(p,u),a,r,l))}return u.opacity=1,u}makeItemStylerParams({datum:e,datumIndex:t,size:i=0,label:s},n,o){const{id:a}=this,r=this.ctx.highlightManager?.getActiveHighlight(),l=this.getHighlightStateString(r,n,t),c=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:a,datum:e,highlighted:n,highlightState:l,...o,size:i,label:s,fill:c}}updateNodeNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((n,o)=>{const{datumIndex:a}=o,r=this.getNodeStyle(o,a.index,i);tB(n,r,s),n.centerX=o.centerX,n.centerY=o.centerY,n.innerRadius=o.innerRadius,n.outerRadius=o.outerRadius,n.startAngle=o.startAngle,n.endAngle=o.endAngle,n.inset=n.strokeWidth/2})}updateLinkSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>Av(t.type,t.index,t.fromNode.id,t.toNode.id))}getLinkStyle({datumIndex:e,datum:t},i,s){const{id:n,properties:o}=this,{fills:a,strokes:r,fillGradientDefaults:l,fillPatternDefaults:c,fillImageDefaults:h}=o,{itemStyler:d}=o.link,u=this.getHighlightStyle(s,e),p=wv(u,o.link.getStyle(a,r,i.index));let g=Tv(p,l,c,h);if(d!=null&&e!=null){const f=this.ctx.highlightManager?.getActiveHighlight(),x=this.cachedDatumCallback(Av(e.index,"link",s?"highlight":"node"),()=>{const m=this.getHighlightStateString(f,s,i);return this.callWithContext(d,{seriesId:n,datum:t,highlighted:s,highlightState:m,...g})});x&&(g=Tv(wv(x,g),l,c,h))}return g.opacity=1,g}updateLinkNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((n,o)=>{const a=o.fromNode.datumIndex,r=this.getLinkStyle(o,a,i);n.centerX=o.centerX,n.centerY=o.centerY,n.radius=o.radius,n.startAngle1=o.startAngle1,n.endAngle1=o.endAngle1,n.startAngle2=o.startAngle2,n.endAngle2=o.endAngle2,n.tension=r.tension,tB(n,r,s)})}getShapeFillBBox(){const e=this._nodeDataDependencies?.seriesRectWidth??0,t=this._nodeDataDependencies?.seriesRectHeight??0,i=Math.min(e,t),s=(e-i)/2,n=(t-i)/2,o=new ese(s,n,e,t);return{series:o,axis:o}}getTooltipContent(e){const{id:t,linksProcessedData:i,nodesProcessedData:s,properties:n,ctx:{formatManager:o}}=this,{fromKey:a,toKey:r,sizeKey:l,sizeName:c,tooltip:h}=n,d=this.contextNodeData?.nodeData.find(v=>v.datumIndex.type===e.type&&v.datumIndex.index===e.index);if(d==null)return;const u=d.type===0?d.fromNode.index:d.index,p=d.type===0?`${d.fromNode.label} - ${d.toNode.label}`:d.label,g=e.type===0?i?.dataSources.get(this.id)?.data[e.index]:s?.dataSources.get(this.id)?.data[e.index],f=d.size;let x;if(d.type===0){const v=d.fromNode.datumIndex;x=this.getLinkStyle({datumIndex:e,datum:g},v,!1)}else{const v=d.label;x=this.getNodeStyle({datumIndex:e,datum:g,size:f,label:v},e.index,!1)}const m=[];if(l!=null){const v=o.format(this.callWithContext.bind(this),{type:"number",value:f,datum:g,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",domain:[],boundSeries:this.getFormatterContext("size"),fractionDigits:void 0});m.push({label:c,fallbackLabel:l,value:v??String(f)})}return this.formatTooltipWithContext(h,{title:p,symbol:this.legendItemSymbol(d.type,u,x),data:m},{seriesId:t,datum:g,title:p,fromKey:a,toKey:r,sizeKey:l,sizeName:c,size:f,...x})}computeFocusBounds(e){return e}hasItemStylers(){return this.properties.node.itemStyler!=null||this.properties.link.itemStyler!=null||this.properties.label.itemStyler!=null}};Ov.className="ChordSeries",Ov.type="chord";var{commonSeriesOptionsDefs:tse,chordSeriesThemeableOptionsDef:ise}=k,Ev={...ise,...tse,type:U(Ce("chord")),fromKey:U(E),toKey:U(E),sizeKey:E,sizeName:E};Ev.fillGradientDefaults=me(FS),Ev.fillPatternDefaults=me(BS),Ev.fillImageDefaults=me(_S);var sse={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],solo:!0,identifier:"chord",moduleFactory:e=>new Ov(e),themeTemplate:{series:{fills:{$palette:"fills"},strokes:{$palette:"strokes"},fillGradientDefaults:k.FILL_GRADIENT_LINEAR_DEFAULTS,fillPatternDefaults:k.FILL_PATTERN_DEFAULTS,fillImageDefaults:k.FILL_IMAGE_DEFAULTS,highlightStyle:{series:{dimOpacity:.2}},highlight:k.singleSeriesHighlightStyle(),label:{...k.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:5,maxWidth:100},node:{spacing:8,width:10,strokeWidth:{$isUserOption:["./stroke",2,0]}},link:{fillOpacity:.5,strokeWidth:{$isUserOption:["./stroke",2,0]},tension:.4}},legend:{enabled:!1,toggleSeries:!1}}},nse={type:"series",name:"chord",chartType:"standalone",enterprise:!0,options:Ev,create:e=>new Ov(e)},{ThemeConstants:{CARTESIAN_AXIS_TYPE:qu,CARTESIAN_POSITION:Qu},ThemeSymbols:{DEFAULT_SHADOW_COLOUR:ose}}=k,Ju={$eq:[{$path:["/series/0/direction",void 0]},"horizontal"]},iB={autoRotate:{$path:"/series/0/stageLabel/autoRotate"},autoRotateAngle:{$path:"/series/0/stageLabel/autoRotateAngle"},avoidCollisions:{$path:["/series/0/stageLabel/avoidCollisions",!0]},border:{$path:["/series/0/stageLabel/border"]},color:{$path:["/series/0/stageLabel/color",{$ref:"textColor"}]},cornerRadius:{$path:["/series/0/stageLabel/cornerRadius"]},enabled:{$if:[{$eq:[{$path:"/series/0/stageLabel/enabled"},void 0]},!0,{$path:"/series/0/stageLabel/enabled"}]},fill:{$path:["/series/0/stageLabel/fill"]},fillOpacity:{$path:["/series/0/stageLabel/fillOpacity"]},fontSize:{$path:["/series/0/stageLabel/fontSize",{$ref:"fontSize"}]},fontStyle:{$path:["/series/0/stageLabel/fontStyle",{$ref:"fontStyle"}]},fontWeight:{$path:["/series/0/stageLabel/fontWeight",{$ref:"fontWeight"}]},format:{$path:"/series/0/stageLabel/format"},formatter:{$path:"/series/0/stageLabel/formatter"},itemStyler:{$path:"/series/0/stageLabel/itemStyler"},minSpacing:{$path:"/series/0/stageLabel/minSpacing"},padding:{$path:["/series/0/stageLabel/padding"]},rotation:{$path:["/series/0/stageLabel/rotation",0]}},sB=[{type:{$if:[Ju,qu.NUMBER,qu.CATEGORY]},position:{$if:[Ju,Qu.LEFT,{$if:[{$eq:[{$path:["/series/0/stageLabel/placement",void 0]},"after"]},Qu.RIGHT,Qu.LEFT]}]},label:{$if:[Ju,void 0,iB]}},{type:{$if:[Ju,qu.CATEGORY,qu.NUMBER]},position:{$if:[Ju,{$if:[{$eq:[{$path:["/series/0/stageLabel/placement",void 0]},"before"]},Qu.TOP,Qu.BOTTOM]},Qu.BOTTOM]},label:{$if:[Ju,iB,void 0]}}],ase={series:{direction:"vertical",strokeWidth:{$isUserOption:["./strokes/0",2,0]},spacingRatio:.25,fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},[{$path:["/0",void 0,{$palette:"fills"}]}],{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",k.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS],["pattern",k.FILL_PATTERN_SINGLE_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},[{$path:["/0",void 0,{$palette:"strokes"}]}]]},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},dropOff:{enabled:!0,fillOpacity:.2,strokeWidth:{$isUserOption:["./stroke",2,0]}},shadow:{enabled:!1,color:ose,xOffset:3,yOffset:3,blur:5},highlight:k.singleSeriesHighlightStyle()},axes:{[qu.NUMBER]:{nice:!1,gridLine:{enabled:!1},crosshair:{enabled:!1},label:{enabled:!1}},[qu.CATEGORY]:{line:{enabled:!1}}}},{lineDistanceSquared:Pv,BBox:rse,Path:lse,SceneChangeDetection:dc}=k,nB=1e-6;function oB([e,t],[i,s]){return Math.abs(e-i)<=nB&&Math.abs(t-s)<=nB}var tr=class extends lse{constructor(){super(...arguments),this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0}get midPoint(){const{x0:e,y0:t,x1:i,y1:s,x2:n,y2:o,x3:a,y3:r}=this;return{x:(e+i+n+a)/4,y:(t+s+o+r)/4}}distanceSquared(e,t){if(this.containsPoint(e,t))return 0;const{x0:i,y0:s,x1:n,y1:o,x2:a,y2:r,x3:l,y3:c}=this;return Math.min(Pv(e,t,i,s,n,o,1/0),Pv(e,t,n,o,a,r,1/0),Pv(e,t,a,r,l,c,1/0),Pv(e,t,l,c,i,s,1/0))}computeBBox(){const{x0:e,y0:t,x1:i,y1:s,x2:n,y2:o,x3:a,y3:r}=this,l=Math.min(e,i,n,a),c=Math.max(e,i,n,a)-l,h=Math.min(t,s,o,r),d=Math.max(t,s,o,r)-h;return new rse(l,h,c,d)}updatePath(){const{path:e,x0:t,y0:i,x1:s,y1:n,x2:o,y2:a,x3:r,y3:l}=this,c=[[t,i],[s,n],[o,a],[r,l]];e.clear();let h,d;for(const u of c){if(h!=null&&oB(h,u)||d!=null&&oB(d,u))continue;const[p,g]=u;h==null?e.moveTo(p,g):e.lineTo(p,g),h??(h=u),d=u}e.closePath()}};y([dc()],tr.prototype,"x0",2),y([dc()],tr.prototype,"y0",2),y([dc()],tr.prototype,"x1",2),y([dc()],tr.prototype,"y1",2),y([dc()],tr.prototype,"x2",2),y([dc()],tr.prototype,"y2",2),y([dc()],tr.prototype,"x3",2),y([dc()],tr.prototype,"y3",2);var{NODE_UPDATE_STATE_TO_PHASE_MAPPING:cse}=k;function aB(e,t,i,s){const{x0:n,y0:o,x1:a,y1:r,x2:l,y2:c,x3:h,y3:d,opacity:u}=e;return i?{x0:(n+h)/2,y0:(o+d)/2,x1:(a+l)/2,y1:(r+c)/2,x2:(a+l)/2,y2:(r+c)/2,x3:(n+h)/2,y3:(o+d)/2,opacity:u}:{x0:(n+a)/2,y0:(o+r)/2,x1:(n+a)/2,y1:(o+r)/2,x2:(l+h)/2,y2:(c+d)/2,x3:(l+h)/2,y3:(c+d)/2,opacity:u}}function hse(e,t){const i=o=>o==null;return{fromFn:(o,a,r)=>{r==="updated"&&i(a)?r="removed":r==="updated"&&i(o.previousDatum)&&(r="added");let l;r==="added"&&o.previousDatum==null&&t==="fade"?l={...Gf(o,a),opacity:0}:r==="unknown"||r==="added"?l=aB(a,o.previousDatum,e,t):l={x0:o.x0,y0:o.y0,x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,x3:o.x3,y3:o.y3,opacity:o.opacity};const c=cse[r];return{...l,phase:c}},toFn:(o,a,r)=>{let l;return r==="removed"&&o.datum==null&&t==="fade"?l={...Gf(o,a),opacity:0}:r==="removed"||i(a)?l=aB(a,o.previousDatum,e,t):l=Gf(o,a),l}}}function Gf(e,t){const{x0:i,y0:s,x1:n,y1:o,x2:a,y2:r,x3:l,y3:c,opacity:h}=t;return{x0:i,y0:s,x1:n,y1:o,x2:a,y2:r,x3:l,y3:c,opacity:h}}var{SeriesNodePickMode:rB,SeriesZIndexMap:lB,valueProperty:dse,keyProperty:use,ChartAxisDirection:pse,updateLabelNode:gse,SMALLEST_KEY_INTERVAL:fse,LARGEST_KEY_INTERVAL:yse,diff:mse,fixNumericExtent:xse,seriesLabelFadeInAnimation:cB,resetMotion:bse,resetLabelFn:vse,animationValidation:Sse,computeBarFocusBounds:Mse,ContinuousScale:Dse,Group:kse,Selection:Ise,PointerEvents:hB,motion:Ase,checkCrisp:Cse,createDatumId:Lse,applyShapeStyle:Tse}=k,wse=class extends k.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.xKey=s.properties.stageKey,this.yKey=s.properties.valueKey}},dB=class extends k.AbstractBarSeries{constructor({moduleCtx:e,animationResetFns:t}){super({moduleCtx:e,pickModes:[rB.AXIS_ALIGNED,rB.EXACT_SHAPE_MATCH],propertyKeys:{x:["stageKey"],y:["valueKey"]},propertyNames:{x:[],y:[]},categoryKey:"xValue",datumSelectionGarbageCollection:!1,animationResetFns:{datum:t.datum,label:vse}}),this.NodeEvent=wse,this.connectorNodeGroup=this.contentGroup.appendChild(new kse({name:`${this.id}-series-connectorNodes`,zIndex:lB.BACKGROUND})),this.connectorSelection=Ise.select(this.connectorNodeGroup,()=>this.connectionFactory()),this.connectorNodeGroup.pointerEvents=hB.None}get pickModeAxis(){return"main-category"}setZIndex(e){return super.setZIndex(e),this.connectorNodeGroup.zIndex=[lB.BACKGROUND,e],!0}isVertical(){return!super.isVertical()}connectionFactory(){return new tr}async processData(e){const{stageKey:t,valueKey:i}=this.properties,{visible:s,id:n}=this,o=(g,f,x)=>s&&this.ctx.legendManager.getItemEnabled({seriesId:n,itemId:x}),a=this.getCategoryAxis()?.scale,r=this.getValueAxis()?.scale,{isContinuousX:l,xScaleType:c,yScaleType:h}=this.getScaleInformation({xScale:a,yScale:r}),d=[];this.ctx.animationManager.isSkipped()||(this.processedData&&d.push(mse(this.id,this.processedData)),d.push(Sse()));const u=this.visible?{}:{forceValue:0},{processedData:p}=await this.requestDataModel(e,this.data,{props:[use(t,c,{id:"xValue"}),dse(i,h,{id:"yValue",...u,validation:o,invalidValue:0}),...l?[fse,yse]:[],...d],groupByKeys:!1});this.smallestDataInterval=p.reduced?.smallestKeyInterval,this.largestDataInterval=p.reduced?.largestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(e){const{processedData:t,dataModel:i,id:s,ctx:{legendManager:n}}=this;if(!t||!i)return[];const{keys:[o]}=t.domain;if(e===this.getCategoryDirection()){const a=i.resolveProcessedDataDefById(this,"xValue");return a?.def.type==="key"&&a?.def.valueType==="category"?this.hasData?o.filter((r,l)=>n.getItemEnabled({seriesId:s,itemId:l})):[]:this.padBandExtent(o)}else{const a=this.domainForClippedRange(e,["yValue"],"xValue"),r=Math.max(...a),l=[-r,r];return xse(l)}}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}createNodeData(){const{hasData:e,data:t,dataModel:i,groupScale:s,processedData:n,id:o,ctx:{legendManager:a}}=this,r=this.getCategoryAxis(),l=this.getValueAxis();if(!(e&&t&&r&&l&&i&&n?.type==="ungrouped"))return;const c=r.scale,h=l.scale,d=this.getBarDirection()===pse.X,{stageKey:u,valueKey:p}=this.properties,g=`${p}`,f={itemId:g,nodeData:[],labelData:[],connectorData:[],scales:this.calculateScaling(),groupScale:this.getScaling(this.groupScale),visible:this.visible},x=this.visible;if(!x)return f;const m=i.resolveKeysById(this,"xValue",n),v=i.resolveColumnById(this,"yValue",n),{barWidth:b,groupIndex:S}=this.updateGroupScale(r),D=Dse.is(c)?b*-.5:0,L=Cse(r?.scale,r?.visibleRange,this.smallestDataInterval,this.largestDataInterval);let I;const A=n.dataSources.get(this.id)?.data??[];for(const[T,w]of A.entries()){const N=x&&a.getItemEnabled({seriesId:o,itemId:T}),O=m[T];if(O==null)continue;const P=Math.round(c.convert(O))+s.convert(String(S))+D,F=v[T],_=Math.round(h.convert(-F)),z=Math.round(h.convert(F)),B=this.getItemStyle({datum:w,datumIndex:T},!1),R=Math.max(B.strokeWidth??0,Math.abs(z-_)),V={x:d?Math.min(z,_):P,y:d?P:Math.min(z,_),width:d?R:b,height:d?b:R},j={x:V.x+V.width/2,y:V.y+V.height/2},$=this.createLabelData({datumIndex:T,rect:V,barAlongX:d,yDatum:F,datum:w,visible:N}),W={index:T,series:this,itemId:g,datum:w,datumIndex:T,xValue:O,yValue:F,xKey:u,yKey:p,x:V.x,y:V.y,width:V.width,height:V.height,midPoint:j,crisp:L,label:$,visible:N};if(f.nodeData.push(W),$!=null&&f.labelData.push($),I!=null){const Y=I.rect,se=I.nodeDatum,X=I.datumIndex;d?f.connectorData.push({datum:se,datumIndex:X,x0:Y.x,y0:Y.y+Y.height,x1:Y.x+Y.width,y1:Y.y+Y.height,x2:V.x+V.width,y2:V.y,x3:V.x,y3:V.y,opacity:1}):f.connectorData.push({datum:se,datumIndex:X,x0:Y.x+Y.width,y0:Y.y,x1:V.x,y1:V.y,x2:V.x,y2:V.y+V.height,x3:Y.x+Y.width,y3:Y.y+Y.height,opacity:1})}N&&(I={itemId:g,rect:V,nodeDatum:W,datumIndex:T})}return f}updateNodes(e,t){super.updateNodes(e,t);const{connectorSelection:i}=this,s=this.contextNodeData?.connectorData??[];this.connectorSelection=this.updateConnectorSelection({connectorSelection:i,connectorData:s}),this.updateConnectorNodes({connectorSelection:i})}updateDatumSelection(e){const{nodeData:t,datumSelection:i}=e,s=t??[];return i.update(s,void 0,n=>this.getDatumId(n))}updateConnectorSelection(e){const{connectorData:t,connectorSelection:i}=e;return i.update(this.connectorEnabled()?t:[],void 0,s=>this.getDatumId(s.datum))}updateConnectorNodes(e){const t=this.getShapeFillBBox();e.connectorSelection.each((i,s)=>{const{fill:n,fillOpacity:o,stroke:a,strokeOpacity:r,strokeWidth:l,lineDash:c,lineDashOffset:h}=this.connectorStyle(s.datumIndex);i.setProperties(Gf(i,s)),Tse(i,{fill:n,stroke:a,fillOpacity:o,strokeOpacity:r,strokeWidth:l,lineDash:c,lineDashOffset:h},t)})}updateLabelSelection(e){const t=this.properties.label.enabled?e.labelData:[];return e.labelSelection.update(t,i=>{i.pointerEvents=hB.None})}updateLabelNodes(e){const t={stageKey:this.properties.stageKey,valueKey:this.properties.valueKey},i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,n)=>{s.fillOpacity=this.getHighlightStyle(!1,n.datumIndex).opacity??1,gse(this,s,t,this.properties.label,n,!1,i)})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:n}=this,{stageKey:o,valueKey:a,tooltip:r,legendItemName:l}=n,c=this.getCategoryAxis(),h=this.getValueAxis();if(!i||!s||!c||!h)return;const d=s.dataSources.get(this.id)?.data[e],u=i.resolveKeysById(this,"xValue",s)[e],p=i.resolveColumnById(this,"yValue",s)[e];if(u!=null)return this.formatTooltipWithContext(r,{symbol:this.legendItemSymbol(e),data:[{label:this.getAxisValueText(c,"tooltip",u,d,o,l),value:this.getAxisValueText(h,"tooltip",p,d,a,l)}]},{seriesId:t,datum:d,title:o,stageKey:o,valueKey:a,...this.tooltipStyle(d,e)})}resetAllAnimation(e){super.resetAllAnimation(e),bse([this.connectorSelection],Gf)}animateEmptyUpdateReady({labelSelection:e}){const{connectorSelection:t}=this,i=this.isVertical(),n=hse(i,"normal");Ase.fromToMotion(this.id,"connectors",this.ctx.animationManager,[t],n),cB(this,"labels",this.ctx.animationManager,e)}animateWaitingUpdateReady(e){const{labelSelection:t}=e;this.ctx.animationManager.stopByAnimationGroupId(this.id),cB(this,"labels",this.ctx.animationManager,t)}getDatumId(e){return Lse(e.xValue)}isLabelEnabled(){return this.properties.label.enabled}computeFocusBounds({datumIndex:e}){return Mse(this,this.contextNodeData?.nodeData[e])}legendItemSymbol(e){const{strokeWidth:t,fillOpacity:i,strokeOpacity:s,lineDash:n,lineDashOffset:o,fill:a,stroke:r}=this.properties.getStyle(e);return{marker:{fill:a,fillOpacity:i,stroke:r,strokeWidth:t,strokeOpacity:s,lineDash:n,lineDashOffset:o}}}getLegendData(e){const{id:t,processedData:i,dataModel:s,ctx:{legendManager:n},visible:o}=this;if(!s||!i||e!=="category")return[];const{showInLegend:a}=this.properties,r=s.resolveKeysById(this,"xValue",i);return(i.dataSources.get(this.id)?.data??[]).map((l,c)=>{const h=r[c];if(h!=null)return{legendType:"category",id:t,datum:l,itemId:c,seriesId:t,enabled:o&&n.getItemEnabled({seriesId:t,itemId:c}),label:{text:String(h)},symbol:this.legendItemSymbol(c),skipAnimations:!0,hideInLegend:!a}}).filter(l=>l!=null)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}},{Label:Nse,AbstractBarSeriesProperties:Ose,makeSeriesTooltip:Ese,AxisLabel:Pse,Property:hn}=k,zA=class extends Nse{constructor(){super(...arguments),this.spacing=0}};y([hn],zA.prototype,"placement",2),y([hn],zA.prototype,"spacing",2);var uB=class extends Pse{};y([hn],uB.prototype,"placement",2);var qn=class extends Ose{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.label=new zA,this.stageLabel=new uB,this.tooltip=Ese()}getStyle(e){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r}=this;return{fill:t[e],fillOpacity:s,stroke:i[e],strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r,opacity:1}}};y([hn],qn.prototype,"stageKey",2),y([hn],qn.prototype,"valueKey",2),y([hn],qn.prototype,"fills",2),y([hn],qn.prototype,"fillOpacity",2),y([hn],qn.prototype,"strokes",2),y([hn],qn.prototype,"strokeWidth",2),y([hn],qn.prototype,"strokeOpacity",2),y([hn],qn.prototype,"lineDash",2),y([hn],qn.prototype,"lineDashOffset",2),y([hn],qn.prototype,"label",2),y([hn],qn.prototype,"stageLabel",2),y([hn],qn.prototype,"tooltip",2);function pB(e,{x:t,y:i,width:s,height:n,opacity:o}){return{x1:t,y1:i,x2:t+s,y2:i+n,opacity:o??1}}var{Line:Rse,ChartAxisDirection:zse}=k,Rv=class extends dB{constructor(e){super({moduleCtx:e,animationResetFns:{datum:pB}}),this.properties=new qn}get hasData(){const{id:e,ctx:{legendManager:t}}=this,i=this.data?.data.reduce((s,n,o)=>s+(t.getItemEnabled({seriesId:e,itemId:o})?1:0),0);return i!=null&&i>1}getBandScalePadding(){return{inner:1,outer:0}}connectorEnabled(){return!0}getItemStyle({datumIndex:e},t){return this.properties.getStyle(e)}connectorStyle(e){return this.properties.getStyle(e)}nodeFactory(){return new Rse}createLabelData({datumIndex:e,rect:t,barAlongX:i,yDatum:s,datum:n,visible:o}){const{stageKey:a,valueKey:r,label:l}=this.properties,{spacing:c,placement:h}=l;if(!l.enabled)return;let d,u,p,g;if(i)switch(d=t.x+t.width/2,p="center",h){case"before":u=t.y-c,g="bottom";break;case"after":u=t.y+t.height+c,g="top";break;default:u=t.y+t.height/2,g="middle"}else switch(u=t.y+t.height/2,g="middle",h){case"before":d=t.x-c,p="right";break;case"after":d=t.x+t.width+c,p="left";break;default:d=t.x+t.width/2,p="center"}const f=this.getSeriesDomain(zse.Y),x=this.getLabelText(s,n,r,"y",f,l,{itemId:r,value:s,datum:n,stageKey:a,valueKey:r});return{x:d,y:u,textAlign:p,textBaseline:g,text:x,itemId:r,datum:n,datumIndex:e,series:this,visible:o}}updateDatumNodes(e){const t=this.getHighlightStyle(e.isHighlight);e.datumSelection.each((i,s)=>{i.setProperties(pB(i,s)),i.stroke=t?.stroke,i.strokeWidth=t?.strokeWidth??0,i.strokeOpacity=t?.strokeOpacity??1,i.lineDash=t?.lineDash,i.lineDashOffset=t?.lineDashOffset??0,i.opacity=t?.opacity??1})}tooltipStyle(e,t){const{fill:i,stroke:s,fillOpacity:n,strokeOpacity:o,strokeWidth:a,lineDash:r,lineDashOffset:l}=this.properties.getStyle(t);return{fill:i,fillOpacity:n,stroke:s,strokeOpacity:o,strokeWidth:a,lineDash:r,lineDashOffset:l}}hasItemStylers(){return this.properties.label.itemStyler!=null}};Rv.className="ConeFunnelSeries",Rv.type="cone-funnel";var{commonSeriesOptionsDefs:Fse,coneFunnelSeriesThemeableOptionsDef:Bse,without:_se}=k,Vse={..._se(Fse,["showInLegend"]),...Bse,type:U(Ce("cone-funnel")),stageKey:U(E),valueKey:U(E)},{ThemeConstants:{CARTESIAN_AXIS_TYPE:gB}}=k,Gse={series:{direction:"vertical",fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"secondSequentialColors"},k.SAFE_RANGE2_OPERATION]},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",k.FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS],["pattern",k.FILL_PATTERN_SINGLE_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$palette:"secondSequentialColors"},k.SAFE_RANGE2_OPERATION]}]},strokeWidth:{$isUserOption:["./strokes/0",2,0]},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},placement:"before",spacing:4},tooltip:{range:{$path:["/tooltip/range","nearest"]}},highlight:k.singleSeriesHighlightStyle(!1)},seriesArea:{padding:{top:20,bottom:20}},axes:{[gB.NUMBER]:{nice:!1,gridLine:{enabled:!1},crosshair:{enabled:!1},label:{enabled:!1}},[gB.CATEGORY]:{line:{enabled:!1}}}},jse={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"cone-funnel",moduleFactory:e=>new Rv(e),solo:!0,defaultAxes:sB,themeTemplate:Gse},Hse={type:"series",name:"cone-funnel",chartType:"cartesian",enterprise:!0,options:Vse,create:e=>new Rv(e)},{Label:Wse,DropShadow:$se,AbstractBarSeriesProperties:Use,BaseProperties:Kse,makeSeriesTooltip:Yse,AxisLabel:Zse,Property:Lt}=k,Xse=class extends Wse{},fB=class extends Zse{};y([Lt],fB.prototype,"placement",2);var el=class extends Kse{constructor(){super(...arguments),this.enabled=!0,this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(){const{fill:e,stroke:t,fillOpacity:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a}=this;return{fill:e,fillOpacity:i,stroke:t,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,opacity:1}}};y([Lt],el.prototype,"enabled",2),y([Lt],el.prototype,"fill",2),y([Lt],el.prototype,"fillOpacity",2),y([Lt],el.prototype,"stroke",2),y([Lt],el.prototype,"strokeWidth",2),y([Lt],el.prototype,"strokeOpacity",2),y([Lt],el.prototype,"lineDash",2),y([Lt],el.prototype,"lineDashOffset",2);var ws=class extends Use{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.spacingRatio=0,this.dropOff=new el,this.shadow=new $se().set({enabled:!1}),this.label=new Xse,this.stageLabel=new fB,this.tooltip=Yse()}getStyle(e){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r}=this;return{fill:t[e],fillOpacity:s,stroke:i[e],strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r,opacity:1}}};y([Lt],ws.prototype,"stageKey",2),y([Lt],ws.prototype,"valueKey",2),y([Lt],ws.prototype,"fills",2),y([Lt],ws.prototype,"fillOpacity",2),y([Lt],ws.prototype,"strokes",2),y([Lt],ws.prototype,"strokeWidth",2),y([Lt],ws.prototype,"strokeOpacity",2),y([Lt],ws.prototype,"lineDash",2),y([Lt],ws.prototype,"lineDashOffset",2),y([Lt],ws.prototype,"spacingRatio",2),y([Lt],ws.prototype,"itemStyler",2),y([Lt],ws.prototype,"dropOff",2),y([Lt],ws.prototype,"shadow",2),y([Lt],ws.prototype,"label",2),y([Lt],ws.prototype,"stageLabel",2),y([Lt],ws.prototype,"tooltip",2);var{ChartAxisDirection:yB,resetBarSelectionsFn:qse,prepareBarAnimationFunctions:mB,midpointStartingBarPosition:xB,createDatumId:Qse,Rect:Jse,motion:bB,applyShapeStyle:ene,mergeDefaults:FA}=k,zv=class extends dB{constructor(e){super({moduleCtx:e,animationResetFns:{datum:qse}}),this.properties=new ws}getBandScalePadding(){return{inner:this.properties.spacingRatio,outer:0}}connectorEnabled(){return this.properties.dropOff.enabled}connectorStyle(e){return FA(this.properties.dropOff.getStyle(),this.properties.getStyle(e))}nodeFactory(){return new Jse}createLabelData({datumIndex:e,rect:t,yDatum:i,datum:s,visible:n}){const{valueKey:o,stageKey:a,label:r}=this.properties;if(!r.enabled)return;const l=this.getSeriesDomain(yB.Y),c=this.getLabelText(i,s,o,"y",l,r,{itemId:o,value:i,datum:s,stageKey:a,valueKey:o});return{x:t.x+t.width/2,y:t.y+t.height/2,textAlign:"center",textBaseline:"middle",text:c,itemId:a,datum:s,datumIndex:e,series:this,visible:n}}getItemStyle({datum:e,datumIndex:t},i){const{id:s,properties:n}=this,{stageKey:o,valueKey:a,itemStyler:r}=n,l=this.getHighlightStyle(i,t);let h=FA(l,n.getStyle(t));if(r!=null){const d=this.ctx.highlightManager?.getActiveHighlight(),u=this.cachedDatumCallback(Qse(t,i?"highlight":"node"),()=>{const p=this.getHighlightStateString(d,i,t);return this.callWithContext(r,{seriesId:s,datum:e,highlighted:i,highlightState:p,stageKey:o,valueKey:a,...h})});u&&(h=FA(u,h))}return h}updateDatumNodes({datumSelection:e,isHighlight:t}){const{contextNodeData:i}=this;if(!i)return;const{shadow:s}=this.properties,n=this.getCategoryDirection()===yB.X,o=this.getShapeFillBBox();e.each((a,r)=>{const l=this.getItemStyle(r,t);ene(a,l,o),a.visible=n?r.width>0:r.height>0,a.crisp=r.crisp,a.fillShadow=s})}tooltipStyle(e,t){return this.getItemStyle({datum:e,datumIndex:t},!1)}animateEmptyUpdateReady(e){super.animateEmptyUpdateReady(e);const{datumSelection:t}=e,i=this.isVertical(),n=mB(xB(i,"normal"),"unknown");bB.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],n)}animateWaitingUpdateReady(e){super.animateWaitingUpdateReady(e);const{datumSelection:t}=e,{processedData:i}=this,s=i?.reduced?.diff?.[this.id],n=mB(xB(this.isVertical(),"fade"),"added");bB.fromToMotion(this.id,"datums",this.ctx.animationManager,[t],n,(o,a)=>a.xValue,s)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};zv.className="FunnelSeries",zv.type="funnel";var{commonSeriesOptionsDefs:tne,funnelSeriesThemeableOptionsDef:ine,without:sne}=k,nne={...ine,...sne(tne,["showInLegend"]),type:U(Ce("funnel")),stageKey:U(E),valueKey:U(E)},one={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["cartesian"],identifier:"funnel",moduleFactory:e=>new zv(e),solo:!0,defaultAxes:sB,themeTemplate:ase},ane={type:"series",name:"funnel",chartType:"cartesian",enterprise:!0,options:nne,create:e=>new zv(e)},vB=class{*[Symbol.iterator](){const{node:e,datum:t}=this;e&&t&&(yield{node:e,datum:t})}nodes(){return this.node?[this.node]:[]}update(e,t,i,s){const n=e.nodes();if(n.length===0)this.node?.remove(),this.node=void 0;else{this.node===void 0&&(this.node=new i,this.node.fillOpacity=0,this.node.strokeOpacity=0,t.appendChild(this.node));const o=n[0],a=n.toReversed().find(r=>r.datum.datum.value>r.datum.datum.segmentStart)??n.at(-1);this.node.datum=this.datum=o.datum,s(this.node,o,a)}}},SB={fromFn:()=>({opacity:0,phase:"initial"}),toFn:()=>({opacity:1})};function MB(e,t){if(e==null)return"";const{min:i,max:s}=t,n=i===0?0:Math.ceil(Math.log10(Math.abs(i))),o=s===0?0:Math.ceil(Math.log10(Math.abs(s))),a=Math.max(2-Math.max(n,o),0);return e.toFixed(a)}function jf(e,t,i,s){if(i.text!=null)return i.text;const n=s??i.value;let o;return i?.formatter!=null&&(o=_f(t,i.formatter,{seriesId:e,datum:void 0,value:n})),o==null||Ne(o)?o:String(o)}function DB({path:e,x:t,y:i,size:s}){e.moveTo(t,i-s/2),e.lineTo(t,i+s/2)}function kB(e,t){const i=Dc(e.datumUnion.nodes(),e.targetSelection.nodes());return e.pickNodeNearestDistantObject(t,i)}function IB(e,t){const i=[{data:e.contextNodeData?.nodeData,selection:e.datumUnion},{data:e.contextNodeData?.targetData,selection:e.targetSelection}].filter(l=>l.data&&l.data.length>0),s=ve(0,t.otherIndex+t.otherIndexDelta,i.length-1);if(i.length===0)return;const{data:n,selection:o}=i[s];if(n==null||n.length===0)return;const a=ve(0,t.datumIndex,n.length-1),r=n[a];for(const l of o)if(l.datum===r)return{bounds:l.node,clipFocusBox:!0,datum:r,datumIndex:a,otherIndex:s}}var{BaseProperties:AB,Property:ep}=k,Fv=class extends AB{getSegments(e,t){const{values:i,step:s,count:n}=this,o=Math.min(...e.domain),a=Math.max(...e.domain);let r;if(i!=null){const l=i.filter(c=>c>o&&cc-h);r=[o,...l,a]}else if(s!=null){const l=[];for(let c=o;cc>o&&ch/l*(a-o)+o)}return r!=null&&r.length>t&&(K.warnOnce("the configured segmentation results in more than 1 item per pixel, ignoring. Supply a segmentation configuration that results in larger segments or omit this configuration"),r=void 0),r??(r=[o,a]),r}};y([ep],Fv.prototype,"values",2),y([ep],Fv.prototype,"step",2),y([ep],Fv.prototype,"count",2);var Hf=class extends AB{constructor(){super(...arguments),this.enabled=!1,this.interval=new Fv,this.spacing=0}};y([ep],Hf.prototype,"enabled",2),y([ep],Hf.prototype,"interval",2),y([ep],Hf.prototype,"spacing",2);var{BaseProperties:Bv,makeSeriesTooltip:rne,SeriesProperties:lne,PropertiesArray:BA,Property:Se,Label:cne,AxisLabel:hne,getColorStops:dne}=k,CB=class extends cne{};y([Se],CB.prototype,"spacing",2);var Ns=class extends Bv{constructor(){super(...arguments),this.value=0,this.label=new CB}getStyle(e){const{fill:t=e.fill??"black",fillOpacity:i=e.fillOpacity??1,stroke:s=e.stroke??"black",strokeWidth:n=e.strokeWidth??0,strokeOpacity:o=e.strokeOpacity??1,lineDash:a=e.lineDash??[0],lineDashOffset:r=e.lineDashOffset??0}=this;return{fill:t,fillOpacity:i,stroke:s,strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r}}};y([Se],Ns.prototype,"text",2),y([Se],Ns.prototype,"value",2),y([Se],Ns.prototype,"shape",2),y([Se],Ns.prototype,"placement",2),y([Se],Ns.prototype,"spacing",2),y([Se],Ns.prototype,"size",2),y([Se],Ns.prototype,"rotation",2),y([Se],Ns.prototype,"fill",2),y([Se],Ns.prototype,"fillOpacity",2),y([Se],Ns.prototype,"stroke",2),y([Se],Ns.prototype,"strokeWidth",2),y([Se],Ns.prototype,"strokeOpacity",2),y([Se],Ns.prototype,"lineDash",2),y([Se],Ns.prototype,"lineDashOffset",2),y([Se],Ns.prototype,"label",2);var Qn=class extends Bv{constructor(){super(...arguments),this.enabled=!0,this.thicknessRatio=1,this.fills=new BA(k.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t,i){const{fill:s,fills:n,fillMode:o,fillOpacity:a,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}=this;return{fill:s??TB(n,o,e,i,t),fillOpacity:a,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}}};y([Se],Qn.prototype,"enabled",2),y([Se],Qn.prototype,"thickness",2),y([Se],Qn.prototype,"thicknessRatio",2),y([Se],Qn.prototype,"fills",2),y([Se],Qn.prototype,"fillMode",2),y([Se],Qn.prototype,"fill",2),y([Se],Qn.prototype,"fillOpacity",2),y([Se],Qn.prototype,"stroke",2),y([Se],Qn.prototype,"strokeWidth",2),y([Se],Qn.prototype,"strokeOpacity",2),y([Se],Qn.prototype,"lineDash",2),y([Se],Qn.prototype,"lineDashOffset",2);var Wf=class extends Bv{constructor(){super(...arguments),this.values=void 0,this.step=void 0,this.minSpacing=0,this.maxSpacing=1e3}};y([Se],Wf.prototype,"values",2),y([Se],Wf.prototype,"step",2),y([Se],Wf.prototype,"minSpacing",2),y([Se],Wf.prototype,"maxSpacing",2);var LB=class extends hne{constructor(){super(...arguments),this.placement=void 0}};y([Se],LB.prototype,"placement",2);var qs=class extends Bv{constructor(){super(...arguments),this.min=0,this.max=1,this.fills=new BA(k.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.defaultFill="black",this.interval=new Wf,this.label=new LB}getStyle(e,t,i,s){const{fill:n,fills:o,defaultFill:a,fillMode:r,fillOpacity:l,stroke:c,strokeWidth:h,strokeOpacity:d,lineDash:u,lineDashOffset:p}=this;return{fill:n??(e&&o.length===0?a:void 0)??TB(o,r,t,s,i),fillOpacity:l,stroke:c,strokeWidth:h,strokeOpacity:d,lineDash:u,lineDashOffset:p}}};y([Se],qs.prototype,"min",2),y([Se],qs.prototype,"max",2),y([Se],qs.prototype,"fills",2),y([Se],qs.prototype,"fillMode",2),y([Se],qs.prototype,"fill",2),y([Se],qs.prototype,"fillOpacity",2),y([Se],qs.prototype,"stroke",2),y([Se],qs.prototype,"strokeWidth",2),y([Se],qs.prototype,"strokeOpacity",2),y([Se],qs.prototype,"lineDash",2),y([Se],qs.prototype,"lineDashOffset",2),y([Se],qs.prototype,"defaultFill",2),y([Se],qs.prototype,"interval",2),y([Se],qs.prototype,"label",2);var _v=class extends Qa{constructor(){super(...arguments),this.placement="inside-center",this.avoidCollisions=!0}};y([Se],_v.prototype,"text",2),y([Se],_v.prototype,"placement",2),y([Se],_v.prototype,"avoidCollisions",2);var Qs=class extends lne{constructor(){super(...arguments),this.value=0,this.segmentation=new Hf,this.defaultColorRange=[],this.targets=new BA(Ns),this.defaultTarget=new Ns,this.defaultScale=new qs,this.direction="vertical",this.thickness=1,this.cornerRadius=0,this.cornerMode="container",this.margin=0,this.scale=new qs,this.bar=new Qn,this.label=new _v,this.tooltip=rne()}};y([Se],Qs.prototype,"value",2),y([Se],Qs.prototype,"segmentation",2),y([Se],Qs.prototype,"defaultColorRange",2),y([Se],Qs.prototype,"targets",2),y([Se],Qs.prototype,"defaultTarget",2),y([Se],Qs.prototype,"defaultScale",2),y([Se],Qs.prototype,"direction",2),y([Se],Qs.prototype,"thickness",2),y([Se],Qs.prototype,"cornerRadius",2),y([Se],Qs.prototype,"cornerMode",2),y([Se],Qs.prototype,"margin",2),y([Se],Qs.prototype,"scale",2),y([Se],Qs.prototype,"bar",2),y([Se],Qs.prototype,"label",2),y([Se],Qs.prototype,"tooltip",2);function TB(e,t,i,s,n){return{type:"gradient",gradient:"linear",colorSpace:"oklch",colorStops:dne(e,i,s.domain,t),rotation:n?90:0,bounds:"series"}}var{BBox:une}=k;function _A(e){const{x0:t,y0:i,x1:s,y1:n,horizontalInset:o,verticalInset:a}=e,r=Math.min(t,s)+o,l=Math.min(i,n)+a,c=Math.max(Math.abs(s-t)-2*o,0),h=Math.max(Math.abs(n-i)-2*a,0);return{x:r,y:l,width:c,height:h}}function pne(e,t){if(t==null)return!0;const i=_A(e),s=1e-6,n=i.x+s,o=i.y+s,a=i.x+i.width-s,r=i.y+i.height-s,l=t.x,c=t.x+t.width,h=t.y,d=t.y+t.height;return Math.max(n,l)<=Math.min(a,c)&&Math.max(o,h)<=Math.min(r,d)}function VA(e){const{clipX0:t,clipX1:i,clipY0:s,clipY1:n}=e;return t!=null&&i!=null||s!=null&&n!=null}function gne(e){if(!VA(e))return;const{x0:t,y0:i,x1:s,y1:n}=e,{x:o,y:a,width:r,height:l}=_A(e);let{clipX0:c,clipX1:h,clipY0:d,clipY1:u}=e;(c==null||h==null)&&(c=t,h=s),(d==null||u==null)&&(d=i,u=n);const p=Math.min(c,h),g=Math.min(d,u),f=Math.abs(h-c),x=Math.abs(u-d);return c=Math.max(o,p),d=Math.max(a,g),h=Math.min(o+r,p+f),u=Math.min(a+l,g+x),new une(Math.min(c,h),Math.min(d,u),Math.abs(h-c),Math.abs(u-d))}function wB(e,t){const i=e?"initial":"update";return{node:{fromFn(n,o){const a=n.previousDatum;let{x0:r,y0:l,x1:c,y1:h,clipX0:d,clipY0:u,clipX1:p,clipY1:g}=a??o;const{horizontalInset:f,verticalInset:x}=o,m=a!=null&&VA(a),v=VA(o);return m&&v||(!m&&v?({x0:r,y0:l,x1:c,y1:h,clipX0:d,clipY0:u,clipX1:p,clipY1:g}=o,e&&(t?p=o.clipX0:g=o.clipY0)):m&&!v?({x0:r,y0:l,x1:c,y1:h}=o,d=void 0,u=void 0,p=void 0,g=void 0):e&&(t?c=r:h=l)),{x0:r,y0:l,x1:c,y1:h,clipX0:d,clipY0:u,clipX1:p,clipY1:g,horizontalInset:f,verticalInset:x,phase:i}},toFn(n,o){const{x0:a,y0:r,x1:l,y1:c,clipX0:h,clipY0:d,clipX1:u,clipY1:p,horizontalInset:g,verticalInset:f}=o;return{x0:a,y0:r,x1:l,y1:c,clipX0:h,clipY0:d,clipX1:u,clipY1:p,horizontalInset:g,verticalInset:f}},applyFn(n,o){n.setProperties($f(n,o))}}}}function $f(e,t){const{x:i,y:s,width:n,height:o}=_A(t),a=gne(t),r=pne(t,a);return{x:i,y:s,width:n,height:o,clipBBox:a,visible:r}}var fne={Before:"right",Center:"center",After:"left"},yne={Before:"top",Center:"middle",After:"bottom"},mne={Before:-1,Center:-.5,After:0},xne={Before:0,Center:-.5,After:-1};function bne(e,t,i,s,n,o){const{seriesRect:a,gaugeRect:r,barRect:l}=n,{padding:c,horizontal:h}=s;i.each((d,u)=>{const p=jf(e.id,t,u,o?.label);let g,f;u.placement==="outside-start"?h?(g=r.x,f=a.height):(g=a.width,f=a.height-(r.y+r.height)):u.placement==="outside-end"?h?(g=a.width-(r.x+r.width),f=a.height):(g=a.width,f=r.y):u.avoidCollisions&&(g=r.width,f=r.height);let x;if(p==null)return;if(g!=null&&f!=null){const _=()=>({width:g,height:f,meta:null});x=wf($e(p),u,{padding:c},_)?.[0]}else{const _=Je(u),{width:z,height:B}=Ne(p)?On(p,u):_.measureLines(p);x={text:p,fontSize:u.fontSize,lineHeight:u.lineHeight??_.lineHeight(),width:z,height:B}}if(x==null){d.visible=!1;return}const m=h?r.x:r.y+r.height,v=h?r.x+r.width:r.y,b=h?l.x:l.y+l.height,S=h?l.x+l.width:l.y,D=u.spacing*(h?1:-1);let L,I,A,T;switch(u.placement){case"outside-start":L=-1/0,I=1/0,A=m-D,T="Before";break;case"outside-end":L=-1/0,I=1/0,A=v+D,T="After";break;case"inside-start":L=m,I=S,A=m+D,T="After";break;case"inside-end":L=S,I=v,A=v-D,T="Before";break;case"inside-center":L=m,I=v,A=(m+v)/2,T="Center";break;case"bar-inside":L=b,I=S,A=(b+S)/2,T="Center";break;case"bar-inside-end":L=b,I=S,A=S-D,T="Before";break;case"bar-outside-end":L=S,I=v,A=S+D,T="After";break;case"bar-end":L=-1/0,I=1/0,A=S,T="Center";break}const w=h?A:r.x+r.width/2,N=h?r.y+r.height/2:A;let O,P;h?(O=w+mne[T]*x.width,P=O+x.width):(O=N+xne[T]*x.height,P=O+x.height);const F=Math.min(O,P)>=Math.min(L,I)&&Math.max(O,P)<=Math.max(L,I);if(u.avoidCollisions&&!F){d.visible=!1;return}d.visible=!0,d.text=x.text,d.fontSize=x.fontSize,d.lineHeight=x.lineHeight,d.textAlign=h?fne[T]:"center",d.textBaseline=h?"middle":yne[T],d.x=w,d.y=N})}var{fromToMotion:GA,resetMotion:vne,SeriesNodePickMode:NB,StateMachine:Sne,createDatumId:OB,toRadians:EB,BBox:ir,Group:Kh,PointerEvents:PB,Selection:Yh,Rect:Mne,Text:RB,TransformableText:Dne,Marker:kne,LinearScale:Ine,generateTicks:Ane,NiceMode:Cne,easing:Lne,findRangeExtent:Tne,tickFormat:wne,mergeDefaults:Nne,applyShapeStyle:jA}=k,One={before:180,middle:0,after:0},Ene={before:90,middle:0,after:-90},Vv=class extends k.Series{constructor(e){super({moduleCtx:e,pickModes:[NB.EXACT_SHAPE_MATCH,NB.NEAREST_NODE]}),this.properties=new Qs,this.seriesRect=ir.NaN,this.gaugeRect=ir.NaN,this.scale=new Ine,this.originX=0,this.originY=0,this.scaleGroup=this.contentGroup.appendChild(new Kh({name:"scaleGroup"})),this.itemGroup=this.contentGroup.appendChild(new Kh({name:"itemGroup"})),this.itemTargetGroup=this.contentGroup.appendChild(new Kh({name:"itemTargetGroup"})),this.itemTargetLabelGroup=this.contentGroup.appendChild(new Kh({name:"itemTargetLabelGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new Kh({name:"itemLabelGroup"})),this.highlightTargetGroup=this.highlightGroup.appendChild(new Kh({name:"itemTargetLabelGroup"})),this.tickGroup=this.contentGroup.appendChild(new Kh({name:"tickGroup"})),this.scaleSelection=Yh.select(this.scaleGroup,()=>this.nodeFactory()),this.datumSelection=Yh.select(this.itemGroup,()=>this.nodeFactory()),this.targetSelection=Yh.select(this.itemTargetGroup,()=>this.markerFactory()),this.targetLabelSelection=Yh.select(this.itemTargetLabelGroup,RB),this.labelSelection=Yh.select(this.itemLabelGroup,RB),this.highlightTargetSelection=Yh.select(this.highlightTargetGroup,()=>this.markerFactory()),this.tickSelection=Yh.select(this.tickGroup,Dne),this.datumUnion=new vB,this.animationState=new Sne("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.animateReadyResize(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateWaitingUpdateReady()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty"},reset:"empty",skip:"ready"}}),this.scaleGroup.pointerEvents=PB.None,this.tickGroup.pointerEvents=PB.None}get range(){return this.horizontal?[0,this.gaugeRect.width]:[0,this.gaugeRect.height]}get horizontal(){return this.properties.direction==="horizontal"}get hasData(){return!0}nodeFactory(){const e=new Mne;return e.crisp=!0,e}markerFactory(){return new kne}processData(){this.nodeDataRefresh=!0,this.animationState.transition("updateData")}formatLabel(e){return MB(e,this.properties.scale)}getShapeFillBBox(){const{properties:e,originX:t,originY:i,horizontal:s,scale:n}=this,{thickness:o}=e,a=Tne(n.range),r=new ir(t,i,s?a:o,s?o:a);return{axis:r,series:r}}getTargets(){const{properties:e}=this,t=e.defaultTarget;return Array.from(e.targets).map(i=>{const{text:s=t.text,value:n=t.value??0,shape:o=t.shape??"triangle",rotation:a=t.rotation??0,placement:r=t.placement??"middle",spacing:l=t.spacing??0,size:c=t.size??0}=i,{enabled:h=t.label.enabled,color:d=t.label.color??"black",fontStyle:u=t.label.fontStyle??"normal",fontWeight:p=t.label.fontWeight??"normal",fontSize:g=t.label.fontSize,fontFamily:f=t.label.fontFamily,spacing:x=t.label.spacing??0}=i.label;return{text:s,value:n,shape:o,placement:r,spacing:l,size:c,rotation:a,label:{enabled:h,color:d,fontStyle:u,fontWeight:p,fontSize:g,fontFamily:f,spacing:x},style:i.getStyle(t)}})}getTargetPoint(e){const{properties:t,originX:i,originY:s,horizontal:n,scale:o,gaugeRect:a}=this,{thickness:r}=t,{value:l,placement:c,spacing:h,size:d}=e,u=o.convert(l);let p;switch(c){case"before":p=-(h+d/2);break;case"after":p=r+h+d/2;break;default:p=r/2;break}return{x:i+a.x+(n?u:p),y:s+a.y+(n?p:u)}}getTargetLabel(e){const{size:t,placement:i,label:s}=e,{spacing:n,color:o,fontStyle:a,fontWeight:r,fontSize:l,fontFamily:c}=s,h=void 0,d=t/2+n;let u,p,g=0,f=0;return this.horizontal?(u="center",i==="after"?(p="top",f=d):(p="bottom",f=-d)):(p="middle",i==="before"?(u="right",g=-d):(u="left",g=d)),{offsetX:g,offsetY:f,fill:o,textAlign:u,textBaseline:p,fontStyle:a,fontWeight:r,fontSize:l,fontFamily:c,lineHeight:h}}labelDatum(e,t){const{placement:i,avoidCollisions:s,spacing:n,text:o,color:a,fontSize:r,minimumFontSize:l,fontStyle:c,fontWeight:h,fontFamily:d,lineHeight:u,wrapping:p,overflowStrategy:g,formatter:f=x=>this.formatLabel(x.value)}=e;return{placement:i,avoidCollisions:s,spacing:n,text:o,value:t,fill:a,fontSize:r,minimumFontSize:l,fontStyle:c,fontWeight:h,fontFamily:d,lineHeight:u,wrapping:p,overflowStrategy:g,formatter:f}}verticalLabelInset(){const{label:e}=this.properties,t=Je(e),i=e.text?.split(` +`),s=(e.lineHeight??t.lineHeight())*(i?.length??1);return e.spacing+s}horizontalLabelInset(){const{scale:e,properties:t}=this,{scale:i,label:s}=t,n=s.text?.split(` +`),o=Je(s),a=i.interval.values??e.ticks({nice:!1,interval:i.interval.step,minTickCount:0,maxTickCount:6,tickCount:5})?.ticks??[],l=(n??a?.map(c=>jf(this.id,this.ctx,this.labelDatum(s,c))??"")).reduce((c,h)=>{const{width:d}=Ne(h)?On(h,s):o.measureLines(h);return Math.max(c,d)},0);return s.spacing+l}tickFormatter(e,t){const{format:i,formatter:s}=this.properties.scale.label;let n;return i!=null&&(n=wne(t,typeof i=="string"?i:void 0)),(o,a)=>{let r;return s&&(r??(r=_f(this.ctx,s,{value:o,index:a,domain:e,boundSeries:void 0}))),r??(r=n?.(o)),r??this.formatLabel(o)}}createNodeData(){const{id:e,properties:t,horizontal:i,scale:s,seriesRect:n}=this,{value:o,segmentation:a,thickness:r,cornerRadius:l,cornerMode:c,bar:h,scale:d,label:u,defaultColorRange:p}=t;s.domain=[d.min,d.max],s.range=i?[0,n.width]:[n.height,0];let g,f;i?(f=1,g=Math.PI/2):d.label.placement==="before"?(f=1,g=0):(f=-1,g=0);let x,m,v,b;i?(x=0,m=n.width,v=(n.height-r)/2,b=v+r,u.placement==="outside-start"?x+=this.horizontalLabelInset():u.placement==="outside-end"&&(m-=this.horizontalLabelInset())):(x=(n.width-r)/2,m=x+r,b=0,v=n.height,u.placement==="outside-start"?v-=this.verticalLabelInset():u.placement==="outside-end"&&(b+=this.verticalLabelInset())),this.gaugeRect=new ir(Math.min(x,m),Math.min(v,b),Math.abs(m-x),Math.abs(b-v));const S=0,D=0;s.domain=[d.min,d.max],s.range=i?[x,m]:[v,b];const{tickData:{ticks:L}}=Ane({scale:s,label:this.properties.scale.label,interval:this.properties.scale.interval,tickFormatter:(le,he)=>this.tickFormatter(le,he),domain:s.domain,range:this.range,reverse:!1,primaryTickCount:void 0,defaultTickMinSpacing:0,visibleRange:[0,1],niceMode:Cne.Off,labelOffset:0,axisRotation:g,sideFlag:f}),I=!1,A=this.getTargets(),T=[],w=[],N=[],O=[],[P,F]=s.range,_=Math.abs(F-P),z=i?s.convert(o):m,B=i?b:s.convert(o),R=a.enabled?a.spacing/2:0,V=i?R:0,j=i?0:R,$=Math.min(h.thickness??Math.round(h.thicknessRatio*r),r),W=-(r-$)/2,Y=i?0:W,se=i?W:0,X=c==="item",Q=Math.ceil(_);let ie=a.enabled?a.interval.getSegments(s,Q):void 0;const q=h.getStyle(p,i,s),ee=d.getStyle(h.enabled,p,i,s);if(ie==null&&X){const le=Math.min(...s.domain),he=Math.max(...s.domain),ue={value:o,segmentStart:le,segmentEnd:he};if(h.enabled){const ze=Math.min(l,$/2,_/2)*(I?-1:1),we=i?ze:0,Ve=i?0:ze;T.push({series:this,itemId:"value",datum:ue,datumIndex:{type:0},type:0,x0:S+x-we-Y,y0:D+v-Ve-se,x1:S+z+we+Y,y1:D+B+Ve+se,clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:l,topRightCornerRadius:l,bottomRightCornerRadius:l,bottomLeftCornerRadius:l,horizontalInset:V,verticalInset:j,style:q})}const be=Math.min(l,r/2,_/2)*(I?-1:1),ye=i?be:0,Te=i?0:be;O.push({series:this,itemId:"scale",datum:ue,datumIndex:{type:0},type:0,x0:S+x-ye,y0:D+v-Te,x1:S+m+ye,y1:D+b+Te,clipX0:void 0,clipY0:void 0,clipX1:void 0,clipY1:void 0,topLeftCornerRadius:l,topRightCornerRadius:l,bottomRightCornerRadius:l,bottomLeftCornerRadius:l,horizontalInset:V,verticalInset:j,style:ee})}else{ie??(ie=s.domain);const le=S+x-Y,he=D+v-se,ue=S+z+Y,xe=D+B+se;for(let be=0;beOB(e.nodeData.length,t.itemId))}updateDatumNodes(e){const{datumSelection:t}=e,{ctx:i}=this,s=i.animationManager.isSkipped(),n=this.getShapeFillBBox();t.each((a,r)=>{const{topLeftCornerRadius:l,topRightCornerRadius:c,bottomRightCornerRadius:h,bottomLeftCornerRadius:d}=r;jA(a,r.style,n),a.topLeftCornerRadius=l,a.topRightCornerRadius=c,a.bottomRightCornerRadius=h,a.bottomLeftCornerRadius=d,a.pointerEvents=this.properties.bar.enabled?k.PointerEvents.All:k.PointerEvents.None,(s||a.previousDatum==null)&&a.setProperties($f(a,r))});const{horizontal:o}=this;this.datumUnion.update(t,this.itemGroup,k.Rect,(a,r,l)=>{const c=Math.min(r.x,l.x),h=Math.max(r.x+r.width,l.x+l.width),d=Math.min(r.y,l.y),u=Math.max(r.y+r.height,l.y+l.height),p=h-c,g=u-d;a.pointerEvents=k.PointerEvents.None,a.x=c,a.y=d,a.width=p,a.height=g,a.topLeftCornerRadius=o?r.topLeftCornerRadius:l.topLeftCornerRadius,a.topRightCornerRadius=l.topRightCornerRadius,a.bottomRightCornerRadius=o?l.bottomRightCornerRadius:r.bottomRightCornerRadius,a.bottomLeftCornerRadius=r.bottomLeftCornerRadius;const f=r.clipBBox,x=l.clipBBox??f;f&&x?a.clipBBox=ir.merge([f,x]).intersection(o?new ir(c,-1/0,p,1/0):new ir(-1/0,d,1/0,g)):a.clipBBox=void 0})}updateScaleSelection(e){return e.scaleSelection.update(e.scaleData,void 0,t=>OB(e.scaleData.length,t.itemId))}updateScaleNodes(e){const{scaleSelection:t}=e,i=this.getShapeFillBBox();t.each((s,n)=>{const{topLeftCornerRadius:o,topRightCornerRadius:a,bottomRightCornerRadius:r,bottomLeftCornerRadius:l}=n;jA(s,n.style,i),s.setProperties($f(s,n)),s.topLeftCornerRadius=o,s.topRightCornerRadius=a,s.bottomRightCornerRadius=r,s.bottomLeftCornerRadius=l,s.setProperties($f(s,n))})}updateTargetSelection(e){return e.targetSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetNodes(e){const{targetSelection:t,isHighlight:i}=e;t.each((s,n)=>{const{x:o,y:a,shape:r,size:l,rotation:c}=n,h=this.getTargetStyle(i,n);jA(s,h),s.size=l,s.shape=r==="line"?DB:r,s.translationX=o,s.translationY=a,s.rotation=c})}getTargetStyle(e,{datumIndex:t,style:i}){const s=this.getHighlightStyle(e,t);return Nne(s,{...i,opacity:1})}updateTargetLabelSelection(e){return e.targetLabelSelection.update(e.targetData)}updateTargetLabelNodes(e){const{targetLabelSelection:t}=e;t.each((i,s)=>{const{x:n,y:o,text:a}=s,{offsetX:r,offsetY:l,fill:c,fontStyle:h,fontWeight:d,fontSize:u,fontFamily:p,textAlign:g,textBaseline:f}=s.label;i.visible=!0,i.x=n+r,i.y=o+l,i.text=a,i.fill=c,i.fontStyle=h,i.fontWeight=d,i.fontSize=u,i.fontFamily=p,i.textAlign=g,i.textBaseline=f})}updateTickSelection(e){return e.tickSelection.update(e.tickData,void 0,t=>t.tickId)}updateTickNodes(e){const{gaugeRect:t,properties:i}=this,s=i.defaultScale,{enabled:n,color:o,fontFamily:a=s.label.fontFamily,fontSize:r=s.label.fontSize,fontStyle:l,fontWeight:c=s.label.fontWeight,spacing:h}=i.scale.label;let{placement:d}=i.scale.label;const u=EB(i.scale.label.rotation??0);let p,g,f,x;this.horizontal?(d??(d="after"),p="center",g=d==="before"?"bottom":"top",x=this.originY+t.y+(d==="before"?-h:t.height+h)):(d??(d="before"),p=d==="before"?"end":"start",g="middle",f=this.originX+t.x+(d==="before"?-h:t.width+h)),e.tickSelection.each((m,v)=>{if(!n){m.visible=!1;return}const b=f??v.translation,S=x??v.translation;m.visible=!0,m.text=v.tickLabel,m.fill=o,m.fontFamily=a,m.fontSize=r,m.fontStyle=l,m.fontWeight=c,m.textBaseline=g,m.textAlign=p,m.x=b,m.y=S,m.rotationCenterX=b,m.rotationCenterY=S,m.rotation=u})}updateLabelSelection(e){return e.labelSelection.update(e.labelData,void 0,t=>"primary")}updateLabelNodes(e){const{labelSelection:t}=e,i=this.ctx.animationManager.isSkipped();t.each((s,n)=>{s.fill=n.fill,s.fontStyle=n.fontStyle,s.fontWeight=n.fontWeight,s.fontFamily=n.fontFamily}),(i||this.labelsHaveExplicitText())&&this.formatLabelText()}labelsHaveExplicitText(){for(const{datum:e}of this.labelSelection)if(e.text==null)return!1;return!0}formatLabelText(e){const{labelSelection:t,horizontal:i,scale:s,seriesRect:n,gaugeRect:o}=this,{x:a,y:r,width:l,height:c}=o,h=e?.label??this.properties.value;let d;if(i){const g=s.convert(h);d=new ir(a,r,g-a,c)}else{const g=s.convert(h);d=new ir(a,g,l,c-g)}const u={seriesRect:n,gaugeRect:o,barRect:d},{margin:p}=this.properties;bne(this,this.ctx,t,{padding:p,horizontal:i},u,e)}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),vne([this.datumSelection],$f),this.formatLabelText()}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}animateLabelText(e={}){const{animationManager:t}=this.ctx;let i=0,s=0;if(this.labelSelection.each((n,o)=>{n.opacity=1,i=n.previousDatum?.value??e.from??o.value,s=o.value}),!this.labelsHaveExplicitText())if(i===s)this.formatLabelText({label:s});else{const n=`${this.id}_labels`;t.animate({id:n,groupId:"label",from:{label:i},to:{label:s},phase:e.phase??"update",ease:Lne.easeOut,onUpdate:o=>this.formatLabelText(o),onStop:()=>this.formatLabelText({label:s})})}}animateEmptyUpdateReady(){const{animationManager:e}=this.ctx,{node:t}=wB(!0,this.horizontal);GA(this.id,"node",e,[this.datumSelection],t,(i,s)=>s.itemId),GA(this.id,"label",e,[this.labelSelection],SB,()=>"primary"),this.animateLabelText({from:0,phase:"initial"})}animateWaitingUpdateReady(){const{animationManager:e}=this.ctx,{node:t}=wB(!1,this.horizontal);GA(this.id,"node",e,[this.datumSelection],t,(i,s)=>s.itemId),this.animateLabelText()}animateReadyResize(){this.resetAllAnimation()}getSeriesDomain(){return[0,1]}dataCount(){return Number.NaN}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}getLegendData(){return[]}getTooltipContent(e){const{id:t,properties:i}=this,{tooltip:s}=i;if(e==null)return;let n,o,a;if(e.type===0?(n=i.value,o=i.label.text,a=this.ctx.localeManager.t("ariaLabelGaugeValue")):({value:n,text:o}=i.targets[e.index],a=this.ctx.localeManager.t("ariaLabelGaugeTarget")),n!=null)return this.formatTooltipWithContext(s,{data:[{label:o,fallbackLabel:a,value:this.formatLabel(n)}]},{seriesId:t,title:void 0,datum:void 0,value:n})}pickNodeClosestDatum(e){return kB(this,e)}pickFocus(e){return IB(this,e)}getCaptionText(){return this.formatLabel(this.properties.value)}getCategoryValue(e){}datumIndexForCategoryValue(e){}hasItemStylers(){return this.properties.label.itemStyler!=null}};Vv.className="LinearGaugeSeries",Vv.type="linear-gauge";var Pne={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"linear-gauge",moduleFactory:e=>new Vv(e),themeTemplate:{minWidth:200,minHeight:200,tooltip:{enabled:!1},series:{thickness:50,defaultColorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$interpolate:[{$palette:"secondDivergingColors"},5]},k.SAFE_RANGE2_OPERATION]},scale:{defaultFill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/2",k.SAFE_STROKE_FILL_OPERATION,{$palette:"hierarchyColors"}]},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{spacing:11}},bar:{strokeWidth:{$isUserOption:["./stroke",2,0]}},segmentation:{enabled:!1,interval:{},spacing:1},defaultTarget:{fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},size:10,shape:"triangle",placement:"after",spacing:5,label:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:5}},defaultScale:{label:{fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}}},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!1,placement:"inside-start",fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},fontSize:{$rem:2},minimumFontSize:k.FONT_SIZE.SMALL,spacing:18,color:{$ref:"chartBackgroundColor"}},margin:4,tooltip:{range:{$path:["/tooltip/range",10]}}}}},Rne={type:"series",name:"linear-gauge",chartType:"standalone",enterprise:!0,options:k.linearGaugeSeriesOptionsDef,create:e=>new Vv(e)},Uf={zoom:{axes:"xy",anchorPointX:"pointer",anchorPointY:"pointer",buttons:{anchorPointX:"middle",anchorPointY:"middle"}},legend:{enabled:!1},gradientLegend:{enabled:!1,...k.LEGEND_CONTAINER_THEME}};function sr(e){const t=k.deepClone(e);return k.jsonWalk(t,i=>{typeof i=="object"&&"$palette"in i&&(i.$mapPalette=i.$palette,delete i.$palette)}),t}var zne=1e-9;function zB(e,t,i,s){const[n,o]=e,[a,r]=t,l=a-n,c=r-o,h=l*l+c*c;let d,u;if(Math.abs(h)t){const h=(t-n)/l,d=[i+(a-i)*h,s+(r-s)*h],u=Math.atan2(r-s,a-i);return{point:d,angle:u}}n=c,i=a,s=r}}var{LonLatBBox:Fne}=k;function Zh(e,t){for(const i of e){const[s,n]=i;t=Fne.extend(t,s,n,s,n)}return t}function Bne(e){if(e.length===0)return;let t=0,i=0,s=0,[n,o]=e.at(-1);for(const[a,r]of e){const l=n*r-a*o;s+=l,t+=(n+a)*l,i+=(o+r)*l,n=a,o=r}return s*=3,[t/s,i/s]}function jv(e,t,i){let s=!1,n=1/0;for(const o of e){let a=o.at(-1),[r,l]=a;for(const c of o){const[h,d]=c;d>i!=l>i&&t<(r-h)*(i-d)/(l-d)+h&&(s=!s),n=Math.min(n,zB(a,c,t,i)),a=c,r=h,l=d}}return(s?-1:1)*Math.sqrt(n)}var{Path:_ne,ExtendedPath2D:Vne,BBox:Gne,SceneChangeDetection:jne,SceneObjectChangeDetection:Hne,objectsEqual:Wne}=k,tp=class extends _ne{constructor(){super(...arguments),this.projectedGeometry=void 0,this.renderMode=3,this.strokePath=new Vne}computeBBox(){return(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1),this.bbox?.clone()}updatePath(){const{projectedGeometry:e}=this;this.strokePath.clear(),this.path.clear(),this.bbox=e==null?void 0:this.drawGeometry(e,void 0)}drawPath(e){super.drawPath(e),this.renderStroke(e,this.strokePath.getPath2D())}containsPoint(e,t){const{projectedGeometry:i}=this;return i==null||!this.getBBox().containsPoint(e,t)?!1:this.geometryDistance(i,e,t)<=0}distanceSquared(e,t){const{projectedGeometry:i}=this;if(i==null)return 1/0;const s=this.geometryDistance(i,e,t);return s>0?s*s:0}geometryDistance(e,t,i){const{renderMode:s,strokeWidth:n}=this,o=(s&1)!==0,a=(s&2)!==0,r=Math.max(n/2,1)+1;switch(e.type){case"GeometryCollection":return e.geometries.reduce((l,c)=>Math.min(l,this.geometryDistance(c,t,i)),1/0);case"MultiPolygon":return o?e.coordinates.reduce((l,c)=>Math.min(l,Math.max(jv(c,t,i),0)),1/0):1/0;case"Polygon":return o?Math.max(jv(e.coordinates,t,i),0):1/0;case"MultiLineString":return a?e.coordinates.reduce((l,c)=>Math.min(l,Math.max(FB(c,t,i)-r,0)),1/0):1/0;case"LineString":return a?Math.max(FB(e.coordinates,t,i)-r,0):1/0;case"MultiPoint":case"Point":default:return 1/0}}drawGeometry(e,t){const{renderMode:i,path:s,strokePath:n}=this,o=(i&1)!==0,a=(i&2)!==0;switch(e.type){case"GeometryCollection":for(const r of e.geometries)t=this.drawGeometry(r,t);break;case"MultiPolygon":if(o)for(const r of e.coordinates)t=this.drawPolygon(s,r,t);break;case"Polygon":o&&(t=this.drawPolygon(s,e.coordinates,t));break;case"LineString":a&&(t=this.drawLineString(n,e.coordinates,t,!1));break;case"MultiLineString":if(a)for(const r of e.coordinates)t=this.drawLineString(n,r,t,!1);break;case"Point":case"MultiPoint":break}return t}drawPolygon(e,t,i){if(t.length<1)return i;i=this.drawLineString(e,t[0],i,!0);for(let s=1;s0&&(t=Zh(i[0],t));break;case"Polygon":e.coordinates.length>0&&(t=Zh(e.coordinates[0],t));break;case"MultiLineString":for(const i of e.coordinates)t=Zh(i,t);break;case"LineString":t=Zh(e.coordinates,t);break;case"MultiPoint":for(const i of e.coordinates){const[s,n]=i;t=WA.extend(t,s,n,s,n)}break;case"Point":{const[i,s]=e.coordinates;t=WA.extend(t,i,s,i,s);break}}return t}function Hv(e){switch(e.type){case"GeometryCollection":{let t,i;for(const s of e.geometries){const n=Hv(s);if(n==null)continue;const o=Zh(n[0],void 0);if(o==null)continue;const a=Math.abs(o.lat1-o.lat0)*Math.abs(o.lon1-o.lon0);(t==null||a>t)&&(t=a,i=n)}return i}case"MultiPolygon":{let t,i;for(const s of e.coordinates){const n=Zh(s[0],void 0);if(n==null)continue;const o=Math.abs(n.lat1-n.lat0)*Math.abs(n.lon1-n.lon0);(t==null||o>t)&&(t=o,i=s)}return i}case"Polygon":return e.coordinates;case"MultiLineString":case"LineString":case"MultiPoint":case"Point":return}}function Wv(e){switch(e.type){case"GeometryCollection":{let t,i;for(const s of e.geometries){const n=Wv(s);if(n==null)continue;const o=HA(n);o!=null&&(t==null||o>t)&&(t=o,i=n)}return i}case"MultiLineString":{let t=0,i;for(const s of e.coordinates){const n=HA(s);n>t&&(t=n,i=s)}return i}case"LineString":return e.coordinates;case"MultiPolygon":case"Polygon":case"MultiPoint":case"Point":return}}function $A(e,t){if(e==null)return!1;switch(e.type){case"GeometryCollection":return e.geometries.some(i=>$A(i,t));case"MultiPolygon":case"Polygon":return(t&1)!==0;case"MultiLineString":case"LineString":return(t&2)!==0;case"MultiPoint":case"Point":return(t&4)!==0}}function uc(e,t){switch(e.type){case"GeometryCollection":return{type:"GeometryCollection",geometries:e.geometries.map(i=>uc(i,t))};case"Polygon":return{type:"Polygon",coordinates:UA(e.coordinates,t)};case"MultiPolygon":return{type:"MultiPolygon",coordinates:$ne(e.coordinates,t)};case"MultiLineString":return{type:"MultiLineString",coordinates:UA(e.coordinates,t)};case"LineString":return{type:"LineString",coordinates:KA(e.coordinates,t)};case"MultiPoint":return{type:"MultiPoint",coordinates:KA(e.coordinates,t)};case"Point":return{type:"Point",coordinates:t.convert(e.coordinates)}}}function $ne(e,t){return e.map(i=>UA(i,t))}function UA(e,t){return e.map(i=>KA(i,t))}function KA(e,t){return e.map(i=>t.convert(i))}function Une(){return{fromFn:(i,s,n)=>n==="removed"?{scalingX:1,scalingY:1}:i.previousDatum==null?{scalingX:0,scalingY:0}:{scalingX:i.scalingX,scalingY:i.scalingY},toFn:(i,s,n)=>n==="removed"?{scalingX:0,scalingY:0}:{scalingX:1,scalingY:1}}}function BB(e,t){const i=e.contextNodeData?.nodeData[t.datumIndex];if(i!==void 0){for(const s of e.datumSelection.nodes())if(s.datum===i)return s}}var Xhe=class extends k.SeriesProperties{},Kf=class extends k.DataModelSeries{addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",e=>{this.onLegendItemClick(e)}),this.ctx.eventsHub.on("legend:item-double-click",e=>{this.onLegendItemDoubleClick(e)}))}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}},{Property:Yt,SeriesProperties:Kne,makeSeriesTooltip:Yne,Label:Zne}=k,Et=class extends Kne{constructor(){super(...arguments),this.topology=void 0,this.idKey="",this.topologyIdKey="name",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.maxStrokeWidth=void 0,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.label=new Zne,this.tooltip=Yne()}getStyle(){const{stroke:e,strokeOpacity:t,strokeWidth:i,lineDash:s,lineDashOffset:n}=this;return{stroke:e,strokeOpacity:t,strokeWidth:i,lineDash:s,lineDashOffset:n}}};y([Yt],Et.prototype,"topology",2),y([Yt],Et.prototype,"title",2),y([Yt],Et.prototype,"legendItemName",2),y([Yt],Et.prototype,"idKey",2),y([Yt],Et.prototype,"topologyIdKey",2),y([Yt],Et.prototype,"idName",2),y([Yt],Et.prototype,"labelKey",2),y([Yt],Et.prototype,"labelName",2),y([Yt],Et.prototype,"sizeKey",2),y([Yt],Et.prototype,"sizeName",2),y([Yt],Et.prototype,"colorKey",2),y([Yt],Et.prototype,"colorName",2),y([Yt],Et.prototype,"sizeDomain",2),y([Yt],Et.prototype,"colorRange",2),y([Yt],Et.prototype,"maxStrokeWidth",2),y([Yt],Et.prototype,"stroke",2),y([Yt],Et.prototype,"strokeOpacity",2),y([Yt],Et.prototype,"strokeWidth",2),y([Yt],Et.prototype,"lineDash",2),y([Yt],Et.prototype,"lineDashOffset",2),y([Yt],Et.prototype,"itemStyler",2),y([Yt],Et.prototype,"label",2),y([Yt],Et.prototype,"tooltip",2);var{getMissCount:Xne,getLabelStyles:qne,createDatumId:_B,SeriesNodePickMode:VB,valueProperty:Yf,ColorScale:Qne,LinearScale:Jne,Selection:YA,Text:eoe,Transformable:toe,mergeDefaults:GB}=k,$v=class extends Kf{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{size:["colorKey"],color:["colorKey"],label:["labelKey"]},propertyNames:{size:["sizeName"],color:["colorName"],label:["labelName"]},pickModes:[VB.EXACT_SHAPE_MATCH,VB.NEAREST_NODE],usesPlacedLabels:!0}),this.properties=new Et,this._chartTopology=void 0,this.colorScale=new Qne,this.sizeScale=new Jne,this.datumSelection=YA.select(this.contentGroup,()=>this.nodeFactory()),this.labelSelection=YA.select(this.labelGroup,eoe),this.highlightDatumSelection=YA.select(this.highlightGroup,()=>this.nodeFactory()),this._previousDatumMidPoint=void 0}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){return super.hasData&&this.topology!=null}renderToOffscreenCanvas(){return!0}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[1,e],this.highlightGroup.zIndex=[2,e],!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}nodeFactory(){const e=new tp;return e.renderMode=2,e.lineJoin="round",e.lineCap="round",e}async processData(e){if(this.data==null)return;const{data:t,topology:i,sizeScale:s,colorScale:n}=this,{topologyIdKey:o,idKey:a,sizeKey:r,colorKey:l,labelKey:c,sizeDomain:h,colorRange:d}=this.properties,u=new Map;for(const b of i?.features.values()??[]){const S=b.properties?.[o];S==null||!$A(b.geometry,2)||u.set(S,b)}const p=this.sizeScale.type,g=this.colorScale.type,f=this.scale?.type,{dataModel:x,processedData:m}=await this.requestDataModel(e,t,{props:[Yf(a,f,{id:"idValue",includeProperty:!1}),Yf(a,f,{id:"featureValue",includeProperty:!1,processor:()=>b=>u.get(b)}),...c==null?[]:[Yf(c,"category",{id:"labelValue"})],...r==null?[]:[Yf(r,p,{id:"sizeValue"})],...l==null?[]:[Yf(l,g,{id:"colorValue"})]]}),v=x.resolveColumnById(this,"featureValue",m);if(this.topologyBounds=v.reduce((b,S)=>{const D=S?.geometry;return D==null?b:ip(D,b)},void 0),r!=null){const b=x.resolveProcessedDataIndexById(this,"sizeValue"),S=m.domain.values[b]??[];s.domain=h??S}if(d!=null&&this.isColorScaleValid()){const b=x.resolveProcessedDataIndexById(this,"colorValue");n.domain=m.domain.values[b],n.range=d,n.update()}i==null&&K.warnOnce("no topology was provided for [MapLineSeries]; nothing will be rendered.")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),n=i.input.count,o=Xne(this,i.defs.values[s].missing);return!(n===0||n===o)}getLabelDatum(e,t,i,s){if(t==null||i==null)return;const n=Wv(i);if(n==null)return;const{idKey:o,idName:a,sizeKey:r,sizeName:l,colorKey:c,colorName:h,labelKey:d,labelName:u,label:p}=this.properties;if(d==null||!p.enabled)return;const g=this.getLabelText(t,e,d,"label",[],p,{value:t,datum:e,idKey:o,idName:a,sizeKey:r,sizeName:l,colorKey:c,colorName:h,labelKey:d,labelName:u});if(g==null)return;const f=s.measureLines(String(g)),x=Gv(n);if(x==null)return;const[m,v]=x.point,{width:b,height:S}=f;return{point:{x:m,y:v,size:0},label:{width:b,height:S,text:g},anchor:void 0,placement:void 0}}createNodeData(){const{id:e,dataModel:t,processedData:i,sizeScale:s,properties:n,scale:o}=this,{idKey:a,sizeKey:r,colorKey:l,labelKey:c,label:h,legendItemName:d}=n;if(t==null||i==null)return;const u=t.resolveColumnById(this,"idValue",i),p=t.resolveColumnById(this,"featureValue",i),g=c==null?void 0:t.resolveColumnById(this,"labelValue",i),f=r==null?void 0:t.resolveColumnById(this,"sizeValue",i),x=l==null?void 0:t.resolveColumnById(this,"colorValue",i),m=n.maxStrokeWidth??n.strokeWidth;s.range=[Math.min(n.strokeWidth,m),m];const v=Je(h),b=new Map;for(const[T]of i.dataSources.get(this.id)?.data.entries()??[]){const w=u[T],N=p[T]?.geometry??void 0,O=N!=null&&o!=null?uc(N,o):void 0;w!=null&&O!=null&&b.set(w,O)}const S=[],D=[],L=[],I=i.dataSources.get(this.id)?.data??[];for(const[T,w]of I.entries()){const N=u[T],O=x?.[T],P=f?.[T],F=g?.[T],_=b.get(N);_==null&&L.push(N);const z=this.getLabelDatum(w,F,_,v);z!=null&&D.push(z),S.push({series:this,itemId:a,datum:w,datumIndex:T,idValue:N,labelValue:F,colorValue:O,sizeValue:P,projectedGeometry:_,legendItemName:d,style:this.getItemStyle({datumIndex:T,datum:w,colorValue:O,sizeValue:P},!1)})}const A=10;if(L.length>A){const T=L.length-A;L.length=A,L.push(`(+${T} more)`)}return L.length>0&&K.warnOnce("some data items do not have matches in the provided topology",L),{itemId:e,nodeData:S,labelData:D}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e,highlightDatumSelection:t}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let i=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:s}=this.properties,n=s!=null&&i?.datum==null&&s===i?.legendItemName;i!=null&&(i.series!==this&&!n||i.datum==null)&&(i=void 0);const o=this.contextNodeData?.nodeData??[];this.datumSelection=this.updateDatumSelection({nodeData:o,datumSelection:e}),this.updateDatumStyles({datumSelection:e,isHighlight:!1}),this.updateDatumNodes({datumSelection:e,isHighlight:!1}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:i==null?[]:[i],datumSelection:t}),this.updateDatumStyles({datumSelection:t,isHighlight:!0}),this.updateDatumNodes({datumSelection:t,isHighlight:!0})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>_B(t.idValue))}getItemStyle({datumIndex:e=0,datum:t,colorValue:i,sizeValue:s},n){const{properties:o,colorScale:a,sizeScale:r}=this,{colorRange:l,itemStyler:c}=o,h=this.getHighlightStyle(n,e),d=GB(h,o.getStyle());!n&&i!=null&&(d.stroke=this.isColorScaleValid()?a.convert(i):l?.[0]??o.stroke),s!=null&&(d.strokeWidth=r.convert(s,{clamp:!0}));let u;return c!=null&&(u=this.cachedDatumCallback(_B(e,n?"highlight":"node"),()=>{const p=this.makeItemStylerParams(t,e,n,d);return this.callWithContext(c,p)})),u?GB(d,u):d}makeItemStylerParams(e,t,i,s){const{id:n}=this,o=this.ctx.highlightManager?.getActiveHighlight(),a=this.getHighlightStateString(o,i,t);return{seriesId:n,datum:e,highlighted:i,highlightState:a,...s}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){e.each((t,i)=>{const{projectedGeometry:s,style:n}=i;if(s==null){t.visible=!1,t.projectedGeometry=void 0;return}t.visible=!0,t.projectedGeometry=s,t.setProperties(n)})}updatePlacedLabelData(e){this.labelSelection=this.labelSelection.update(e,t=>{t.pointerEvents=k.PointerEvents.None}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{x:n,y:o,width:a,height:r,text:l},c)=>{const h=qne(this,void 0,t,t.label,!1,i),{color:d,fontStyle:u,fontWeight:p,fontSize:g,fontFamily:f}=h;s.visible=!0,s.x=n+a/2,s.y=o+r/2,s.text=l,s.fill=d,s.fontStyle=u,s.fontWeight=p,s.fontSize=g,s.fontFamily=f,s.textAlign="center",s.textBaseline="middle",s.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,s.setBoxing(h)})}resetAnimation(){}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.datumSelection.each((n,o)=>{const a=n.distanceSquared(e,t);anew $v(e),themeTemplate:{...Uf,series:{stroke:sr(k.SAFE_STROKE_FILL_OPERATION),colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},sr(k.SAFE_RANGE2_OPERATION)]},strokeWidth:1,maxStrokeWidth:3,lineDash:[0],lineDashOffset:0,label:{...k.LABEL_BOXING_DEFAULTS,enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:sr(k.multiSeriesHighlightStyle(!1))},tooltip:{range:"exact"}}},aoe={type:"series",name:"map-line",chartType:"topology",enterprise:!0,options:jB,create:e=>new $v(e)},{Property:Xh,SeriesProperties:roe,makeSeriesTooltip:loe}=k,pc=class extends roe{constructor(){super(...arguments),this.topology=void 0,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.tooltip=loe()}};y([Xh],pc.prototype,"topology",2),y([Xh],pc.prototype,"stroke",2),y([Xh],pc.prototype,"strokeOpacity",2),y([Xh],pc.prototype,"strokeWidth",2),y([Xh],pc.prototype,"lineDash",2),y([Xh],pc.prototype,"lineDashOffset",2),y([Xh],pc.prototype,"tooltip",2);var{createDatumId:coe,Group:hoe,Selection:doe,PointerEvents:HB}=k,Uv=class extends Kf{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[]}),this.properties=new pc,this._chartTopology=void 0,this.itemGroup=this.contentGroup.appendChild(new hoe({name:"itemGroup"})),this.datumSelection=doe.select(this.itemGroup,()=>this.nodeFactory()),this.itemGroup.pointerEvents=HB.None}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get focusable(){return!1}setOptionsData(){}setChartData(){}get hasData(){return!1}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,e,0],this.highlightGroup.zIndex=[0,e,1],!0}nodeFactory(){const e=new tp;return e.renderMode=2,e.lineJoin="round",e.lineCap="round",e.pointerEvents=HB.None,e}processData(){const{topology:e}=this;this.topologyBounds=e?.features.reduce((t,i)=>{const s=i.geometry;return s==null?t:ip(s,t)},void 0),e==null&&K.warnOnce("no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.")}createNodeData(){const{id:e,topology:t,scale:i,properties:s}=this;if(t==null)return;const{stroke:n,strokeOpacity:o,lineDash:a,lineDashOffset:r,strokeWidth:l}=s,c=[],h=[];for(const[d,u]of t.features.entries()){const{geometry:p}=u,g=p!=null&&i!=null?uc(p,i):void 0;g!=null&&c.push({series:this,itemId:d,datum:u,datumIndex:0,index:d,projectedGeometry:g,style:{stroke:n,strokeOpacity:o,lineDash:a,lineDashOffset:r,strokeWidth:l}})}return{itemId:e,nodeData:c,labelData:h}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;const{nodeData:t=[]}=this.contextNodeData??{};this.datumSelection=this.updateDatumSelection({nodeData:t,datumSelection:e}),this.updateDatumNodes({datumSelection:e})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>coe(t.index))}updateDatumNodes(e){const{datumSelection:t}=e;t.each((i,s)=>{const{projectedGeometry:n}=s;if(n==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=n,i.setProperties(s.style)})}resetAnimation(){}getLegendData(){return[]}getTooltipContent(e){}computeFocusBounds(e){}hasItemStylers(){return!1}};Uv.className="MapLineBackgroundSeries",Uv.type="map-line-background";var{mapLineBackgroundSeriesThemeableOptionsDef:uoe}=k,poe={...uoe,type:U(Ce("map-line-background")),topology:rd},goe={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-line-background",moduleFactory:e=>new Uv(e),themeTemplate:{...Uf,series:{stroke:{$path:["/1",{$mapPalette:"stroke"},{$mapPalette:"secondHierarchyColors"}]},strokeWidth:1,lineDash:[0],lineDashOffset:0}}},foe={type:"series",name:"map-line-background",chartType:"topology",enterprise:!0,options:poe,create:e=>new Uv(e)},yoe=void 0,moe=void 0;moe=yoe;var xoe=void 0,boe=void 0;boe=xoe;var voe=void 0,Soe=void 0;Soe=voe;var Moe=void 0,Doe=void 0;Doe=Moe;function WB(e,t,i){const s=Zh(e[0],void 0);if(s==null)return;const n=(s.lon0+s.lon1)/2,o=(s.lat0+s.lat1)/2,a=Math.abs(s.lon1-s.lon0),r=Math.abs(s.lat1-s.lat0),l=Bne(e[0]),[c,h]=l,d=-jv(e,c,h);let u;const p=(D,L)=>{const A=Math.max(L-d,0);return D-.5*A},g=(D,L,I)=>{const{distance:A,maxDistance:T}=i(e,D,L,I),w=Math.hypot(c-D,h-L),N=Math.min(Math.max(c,D-I/2),D+I/2),O=Math.min(Math.max(h,L-I/2),L+I/2),P=Math.hypot(c-N,h-O),F=p(A,w),_=p(T,P);return{distance:A,maxDistance:T,value:F,maxValue:_,x:D,y:L,stride:I}},f=(D,L,I,A)=>{const T=g(L,I,A);T.maxDistance>=0&&D.push(T)},x=Math.min(a,r)/2;let m={value:g(n,o,x),next:null};for(;m!=null;){const D=m.value,{distance:L,value:I,maxValue:A,x:T,y:w,stride:N}=D;if(m=m.next,L>0&&(u==null||I>u.value)&&(u=D),u!=null&&A-u.value<=t)continue;const O=N/2,P=[];f(P,T-O,w-O,O),f(P,T+O,w-O,O),f(P,T-O,w+O,O),f(P,T+O,w+O,O),P.sort($B),m=uL(m,P,$B)}if(u==null)return;const{distance:v,x:b,y:S}=u;return{x:b,y:S,distance:v}}var $B=(e,t)=>t.maxValue-e.maxValue;function ZA(e,t){const i=WB(e,t,(o,a,r,l)=>{const c=-jv(o,a,r),h=c+l*Math.SQRT2;return{distance:c,maxDistance:h}});if(i==null)return;const{x:s,y:n}=i;return[s,n]}function UB(e,t){let i;switch(e.type){case"GeometryCollection":return e.geometries.flatMap(s=>UB(s,t));case"MultiPoint":return e.coordinates;case"Point":return[e.coordinates];case"MultiPolygon":{const s=Hv(e);i=s==null?void 0:ZA(s,t);break}case"Polygon":{const s=e.coordinates;i=s==null?void 0:ZA(s,t);break}case"MultiLineString":{const s=Wv(e);i=s==null?void 0:Gv(s)?.point;break}case"LineString":{const s=e.coordinates;i=Gv(s)?.point;break}}return i==null?[]:[i]}var{BBox:koe}=k;function KB(e){if(!e)return;const{range:t}=e,i=t[0][0],s=t[0][1],n=t[1][0]-i,o=t[1][1]-s,a=new koe(i,s,n,o);return{series:a,axis:a}}var{Property:lt,SeriesProperties:Ioe,makeSeriesTooltip:Aoe,Label:Coe}=k,YB=class extends Coe{constructor(){super(...arguments),this.placement="bottom"}};y([lt],YB.prototype,"placement",2);var ct=class extends Ioe{constructor(){super(...arguments),this.topology=void 0,this.idKey=void 0,this.topologyIdKey="name",this.idName=void 0,this.latitudeKey=void 0,this.latitudeName=void 0,this.longitudeKey=void 0,this.longitudeName=void 0,this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.shape="circle",this.size=6,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.label=new YB,this.tooltip=Aoe()}getStyle(){const{size:e,shape:t,fill:i,fillOpacity:s,stroke:n,strokeWidth:o,strokeOpacity:a,lineDash:r,lineDashOffset:l}=this;return{size:e,shape:t,fill:i,fillOpacity:s,opacity:1,stroke:n,strokeWidth:o,strokeOpacity:a,lineDash:r,lineDashOffset:l}}};y([lt],ct.prototype,"topology",2),y([lt],ct.prototype,"title",2),y([lt],ct.prototype,"legendItemName",2),y([lt],ct.prototype,"idKey",2),y([lt],ct.prototype,"topologyIdKey",2),y([lt],ct.prototype,"idName",2),y([lt],ct.prototype,"latitudeKey",2),y([lt],ct.prototype,"latitudeName",2),y([lt],ct.prototype,"longitudeKey",2),y([lt],ct.prototype,"longitudeName",2),y([lt],ct.prototype,"labelKey",2),y([lt],ct.prototype,"labelName",2),y([lt],ct.prototype,"sizeKey",2),y([lt],ct.prototype,"sizeName",2),y([lt],ct.prototype,"colorKey",2),y([lt],ct.prototype,"colorName",2),y([lt],ct.prototype,"colorRange",2),y([lt],ct.prototype,"shape",2),y([lt],ct.prototype,"size",2),y([lt],ct.prototype,"maxSize",2),y([lt],ct.prototype,"sizeDomain",2),y([lt],ct.prototype,"fill",2),y([lt],ct.prototype,"fillOpacity",2),y([lt],ct.prototype,"stroke",2),y([lt],ct.prototype,"strokeWidth",2),y([lt],ct.prototype,"strokeOpacity",2),y([lt],ct.prototype,"lineDash",2),y([lt],ct.prototype,"lineDashOffset",2),y([lt],ct.prototype,"itemStyler",2),y([lt],ct.prototype,"label",2),y([lt],ct.prototype,"tooltip",2);var{fromToMotion:Loe,StateMachine:Toe,getMissCount:woe,createDatumId:ZB,SeriesNodePickMode:XB,valueProperty:qh,computeMarkerFocusBounds:Noe,ColorScale:Ooe,LinearScale:Eoe,Group:Poe,Selection:XA,Text:Roe,Marker:qA,applyShapeStyle:zoe,getLabelStyles:Foe,LonLatBBox:Boe,mergeDefaults:qB}=k,Kv=class extends Kf{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{size:["colorKey"],color:["colorKey"],label:["labelKey"]},propertyNames:{size:["sizeName"],color:["colorName"],label:["labelName"]},pickModes:[XB.EXACT_SHAPE_MATCH,XB.NEAREST_NODE],usesPlacedLabels:!0}),this.properties=new ct,this._chartTopology=void 0,this.colorScale=new Ooe,this.sizeScale=new Eoe,this.markerGroup=this.contentGroup.appendChild(new Poe({name:"markerGroup"})),this.labelSelection=XA.select(this.labelGroup,Roe,!1),this.markerSelection=XA.select(this.markerGroup,qA,!1),this.highlightMarkerSelection=XA.select(this.highlightGroup,qA),this.animationState=new Toe("empty",{empty:{update:{target:"ready",action:()=>this.animateMarkers()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.resetAllAnimation(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateMarkers()},resize:{target:"ready",action:()=>this.resetAllAnimation()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty",action:()=>this.resetAllAnimation()},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){const e=this.properties.latitudeKey!=null&&this.properties.longitudeKey!=null;return super.hasData&&(this.topology!=null||e)}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[3,e],this.highlightGroup.zIndex=[4,e],!0}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}async processData(e){if(this.data==null)return;const{data:t,topology:i,sizeScale:s,colorScale:n}=this,{topologyIdKey:o,idKey:a,latitudeKey:r,longitudeKey:l,sizeKey:c,colorKey:h,labelKey:d,sizeDomain:u,colorRange:p}=this.properties,g=new Map;for(const A of i?.features.values()??[]){const T=A.properties?.[o];T!=null&&g.set(T,A)}const f=this.sizeScale.type,x=this.colorScale.type,m=this.scale?.type,v=r!=null&&l!=null,{dataModel:b,processedData:S}=await this.requestDataModel(e,t,{props:[...a==null?[]:[qh(a,m,{id:"idValue",includeProperty:!1}),qh(a,m,{id:"featureValue",includeProperty:!1,processor:()=>A=>g.get(A)})],...v?[qh(r,m,{id:"latValue"}),qh(l,m,{id:"lonValue"})]:[],...d?[qh(d,"category",{id:"labelValue"})]:[],...c?[qh(c,f,{id:"sizeValue"})]:[],...h?[qh(h,x,{id:"colorValue"})]:[]]}),D=a==null?void 0:b.resolveColumnById(this,"featureValue",S),L=v?b.resolveColumnById(this,"latValue",S):void 0,I=v?b.resolveColumnById(this,"lonValue",S):void 0;if(this.topologyBounds=S.dataSources.get(this.id)?.data.reduce((A,T,w)=>{const O=D?.[w]?.geometry;if(O!=null&&(A=ip(O,A)),L!=null&&I!=null){const P=I[w],F=L[w];A=Boe.extend(A,P,F,P,F)}return A},void 0),c!=null){const A=b.resolveProcessedDataIndexById(this,"sizeValue"),T=S.domain.values[A]??[];s.domain=u??T}if(p!=null&&this.isColorScaleValid()){const A=b.resolveProcessedDataIndexById(this,"colorValue");n.domain=S.domain.values[A],n.range=p,n.update()}this.animationState.transition("updateData")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),n=i.input.count,o=woe(this,i.defs.values[s].missing);return!(n===0||n===o)}getLabelDatum(e,t,i,s,n,o){if(t==null)return;const{idKey:a,idName:r,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:d,sizeKey:u,sizeName:p,colorKey:g,colorName:f,labelKey:x,labelName:m,label:v,shape:b}=this.properties;if(x==null||!v.enabled)return;const{placement:S}=v,D=this.getLabelText(t,e,x,"label",[],v,{value:t,datum:e,idKey:a,idName:r,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:d,sizeKey:u,sizeName:p,colorKey:g,colorName:f,labelKey:x,labelName:m});if(D==null)return;const{width:L,height:I}=o.measureLines(String(D)),A=qA.anchor(b);return{point:{x:i,y:s,size:n},label:{width:L,height:I,text:D},anchor:A,placement:S}}createNodeData(){const{id:e,dataModel:t,processedData:i,sizeScale:s,properties:n,scale:o}=this,{idKey:a,latitudeKey:r,longitudeKey:l,sizeKey:c,colorKey:h,labelKey:d,label:u,legendItemName:p}=n;if(t==null||i==null||o==null)return;const g=r!=null&&l!=null,f=a==null?void 0:t.resolveColumnById(this,"idValue",i),x=a==null?void 0:t.resolveColumnById(this,"featureValue",i),m=g?t.resolveColumnById(this,"latValue",i):void 0,v=g?t.resolveColumnById(this,"lonValue",i):void 0,b=d==null?void 0:t.resolveColumnById(this,"labelValue",i),S=c==null?void 0:t.resolveColumnById(this,"sizeValue",i),D=h==null?void 0:t.resolveColumnById(this,"colorValue",i),L=n.maxSize??n.size;s.range=[Math.min(n.size,L),L];const I=Je(u);let A;if(f!=null&&x!=null){A=new Map;for(const[F]of i.dataSources.get(this.id)?.data.entries()??[]){const _=f[F],z=x[F]?.geometry??void 0,B=z!=null&&o!=null?uc(z,o):void 0;_!=null&&B!=null&&A.set(_,B)}}const T=[],w=[],N=[],O=i.dataSources.get(this.id)?.data??[];for(const[F,_]of O.entries()){const z=f?.[F],B=v?.[F],R=m?.[F],V=D?.[F],j=S?.[F],$=b?.[F],W=j==null?n.size:s.convert(j,{clamp:!0}),Y=z==null?void 0:A?.get(z);if(z!=null&&uc==null&&N.push(z),B!=null&&R!=null){const[se,X]=o.convert([B,R]),Q=this.getLabelDatum(_,$,se,X,W,I);Q&&w.push(Q),T.push({series:this,itemId:r,datum:_,datumIndex:F,index:-1,idValue:z,lonValue:B,latValue:R,labelValue:$,sizeValue:j,colorValue:V,point:{x:se,y:X,size:W},midPoint:{x:se,y:X},legendItemName:p,style:this.getMarkerItemStyle({datumIndex:F,datum:_,colorValue:V,sizeValue:j},!1)})}else if(Y!=null)for(const[se,[X,Q]]of UB(Y,1).entries()){const ie=this.getLabelDatum(_,$,X,Q,W,I);ie&&w.push(ie),T.push({series:this,itemId:r,datum:_,datumIndex:F,index:se,idValue:z,lonValue:B,latValue:R,labelValue:$,sizeValue:j,colorValue:V,point:{x:X,y:Q,size:W},midPoint:{x:X,y:Q},legendItemName:p,style:this.getMarkerItemStyle({datumIndex:F,datum:_,colorValue:V,sizeValue:j},!1)})}}const P=10;if(N.length>P){const F=N.length-P;N.length=P,N.push(`(+${F} more)`)}return N.length>0&&K.warnOnce("some data items do not have matches in the provided topology",N),{itemId:e,nodeData:T,labelData:w}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}checkScaleChange(){return this.previousScale===this.scale?!1:(this.previousScale=this.scale,!0)}update({seriesRect:e}){const t=this.checkResize(e),i=this.checkScaleChange(),{markerSelection:s,highlightMarkerSelection:n}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let o=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:a}=this.properties,r=a!=null&&o?.datum==null&&a===o?.legendItemName;o!=null&&(o.series!==this&&!r||o.datum==null)&&(o=void 0);const l=this.contextNodeData?.nodeData??[];this.markerSelection=this.updateMarkerSelection({markerData:l,markerSelection:s}),this.updateMarkerNodes({markerSelection:s,isHighlight:!1,highlightedDatum:o}),this.highlightMarkerSelection=this.updateMarkerSelection({markerData:o==null?[]:[o],markerSelection:n}),this.updateMarkerNodes({markerSelection:n,isHighlight:!0,highlightedDatum:o}),(i||t)&&this.animationState.transition("resize"),this.animationState.transition("update")}updatePlacedLabelData(e){this.labelSelection=this.labelSelection.update(e,t=>{t.pointerEvents=k.PointerEvents.None}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{x:n,y:o,width:a,height:r,text:l},c)=>{const h=Foe(this,void 0,t,t.label,!1,i),{color:d,fontStyle:u,fontWeight:p,fontSize:g,fontFamily:f}=h;s.visible=!0,s.x=n+a/2,s.y=o+r/2,s.text=l,s.fill=d,s.fontStyle=u,s.fontWeight=p,s.fontSize=g,s.fontFamily=f,s.textAlign="center",s.textBaseline="middle",s.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,s.setBoxing(h)})}updateMarkerSelection(e){const{markerData:t,markerSelection:i}=e;return i.update(t,void 0,s=>ZB(s.index,s.idValue,s.lonValue,s.latValue))}getMarkerItemStyle({datumIndex:e,datum:t,colorValue:i,sizeValue:s},n){const{properties:o,colorScale:a,sizeScale:r}=this,{colorRange:l,itemStyler:c}=o,h=this.getHighlightStyle(n,e),d=qB(h,o.getStyle());!n&&i!=null&&(d.fill=this.isColorScaleValid()?a.convert(i):l?.[0]??d.fill),s!=null&&(d.size=r.convert(s,{clamp:!0}));let u=d;if(c!=null&&e!=null){const p=this.cachedDatumCallback(ZB(e,n?"highlight":"node"),()=>{const g=this.makeItemStylerParams(t,e,n,u);return this.callWithContext(c,g)});p&&(u=qB(p,d))}return u}makeItemStylerParams(e,t,i,s){const{id:n}=this,o=this.ctx.highlightManager?.getActiveHighlight(),a=this.getHighlightStateString(o,i,t),r=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:n,datum:e,highlighted:i,highlightState:a,...s,fill:r}}updateMarkerNodes(e){const{markerSelection:t,isHighlight:i,highlightedDatum:s}=e,n=KB(this.scale);t.each((o,a)=>{const{datum:r,point:l}=a,c=this.getMarkerItemStyle(a,i);o.shape=c.shape,o.size=c.size,zoe(o,c,n),o.x=l.x,o.y=l.y,o.scalingCenterX=l.x,o.scalingCenterY=l.y,o.zIndex=!i&&s!=null&&r===s.datum?1:0})}isProcessedDataAnimatable(){return!0}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),this.ctx.animationManager.skipCurrentBatch(),this.labelSelection.cleanup(),this.markerSelection.cleanup(),this.highlightMarkerSelection.cleanup()}animateMarkers(){const{animationManager:e}=this.ctx,t=Une();Loe(this.id,"markers",e,[this.markerSelection,this.highlightMarkerSelection],t)}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}pickNodeClosestDatum(e){const{x:t,y:i}=e;let s=1/0,n;for(const o of this.contextNodeData?.nodeData??[]){const{x:a,y:r,size:l}=o.point,c=Math.max(Math.abs(a-t)-l,0),h=Math.max(Math.abs(r-i)-l,0),d=c*c+h*h;d=0?"N":"S"}, ${Math.abs(O).toFixed(4)}\xB0 ${O>=0?"W":"E"}`}const w=this.getMarkerItemStyle({datumIndex:e,datum:D,colorValue:I,sizeValue:L},!1);return this.formatTooltipWithContext(S,{heading:T,title:v??b,symbol:this.legendItemSymbol(e),data:A},{seriesId:t,datum:D,title:v,idKey:a,idName:r,latitudeKey:l,latitudeName:c,longitudeKey:h,longitudeName:d,colorKey:u,colorName:p,sizeKey:g,sizeName:f,labelKey:x,labelName:m,...w})}getFormattedMarkerStyle(e){const t=this.getMarkerItemStyle(e,!1);return{size:t.size,shape:t.shape}}computeFocusBounds(e){return Noe(this,e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};Kv.className="MapMarkerSeries",Kv.type="map-marker";var{commonSeriesOptionsDefs:_oe,mapMarkerSeriesThemeableOptionsDef:Voe,without:Goe}=k,joe={...Goe(_oe,["highlightStyle","highlight"]),...Voe,type:U(Ce("map-marker")),idKey:E,latitudeKey:E,longitudeKey:E,sizeKey:E,colorKey:E,labelKey:E,idName:E,latitudeName:E,longitudeName:E,sizeName:E,colorName:E,labelName:E,topology:rd,topologyIdKey:E,legendItemName:E,title:E},Hoe={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-marker",moduleFactory:e=>new Kv(e),themeTemplate:{...Uf,series:{shape:"circle",maxSize:30,fill:sr({$applySwitch:[{$path:"type"},{$mapPalette:"fill"},["gradient",k.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS]]}),stroke:{$mapPalette:"stroke"},colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},sr(k.SAFE_RANGE2_OPERATION)]},fillOpacity:.5,label:{...k.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:sr(k.multiSeriesHighlightStyle())},tooltip:{range:"exact"}}},Woe={type:"series",name:"map-marker",chartType:"topology",enterprise:!0,options:joe,create:e=>new Kv(e),validate(e,t,i){const s=cs(e,t,i),{cleared:n,invalid:o}=s;if(n?.idKey==null&&(n?.latitudeKey==null||n?.longitudeKey==null)){const a=l=>i?`${i}.${l}`:l,r=`Either \`${a("idKey")}\` or both \`${a("latitudeKey")}\` and \`${a("longitudeKey")}\` are required.`;o.push(new ol("required",r,null,i))}return s}};function $oe(e,{aspectRatio:t,precision:i}){const s=WB(e,i,(l,c,h,d)=>{const u=Koe(l,c,h,t),p=u+2*d*t,g=u*Math.SQRT2,f=p*Math.SQRT2;return{distance:g,maxDistance:f}});if(s==null)return;const{x:n,y:o,distance:a}=s,r=a/Math.SQRT2;return{x:n,y:o,maxWidth:r}}function Uoe(e,t,i,s,n){const[o,a]=e,[r,l]=t,c=1/n,h=r-o,d=l-a,[u,p]=a<=l?e:t,[g,f]=o<=r?e:t,[x,m]=a<=l?t:e,[v,b]=o<=r?t:e;let S=1/0;if(h===0)for(let w=0;w<=1;w+=1){const O=(w===0?c:-c)*(o-i)+s;if(O>=p&&O<=m){const F=Math.abs(s-O)*2*n;S=Math.min(S,F)}}else{const w=d/h;for(let N=0;N<=1;N+=1){const O=N===0?c:-c,P=(w*o-a-O*i+s)/(w-O);if(P>=g&&P<=v){const F=Math.abs(i-P)*2;S=Math.min(S,F)}}}const D=n,L=Math.abs((u-i)/(p-s)),I=Math.abs((x-i)/(m-s));if(ms&&Li&&Ai!=c>i&&t<(l-d)*(i-u)/(c-u)+d&&(n=!n);const p=Uoe(r,h,t,i,s);o=Math.min(o,p),r=h,l=d,c=u}}return(n?1:-1)*o}function Yv(e,t,i){i>=t&&(e.maxX=Math.min(e.maxX,i-t)),i<=t&&(e.minX=Math.max(e.minX,i-t))}function Yoe(e,t,i,s,n,o){const a=n-o/2,r=n+o/2,[l,c]=t,[h,d]=i,u=h-l,p=d-c,[g,f]=l<=h?t:i,[x,m]=l<=h?i:t;if(u!==0){const v=p/u;for(let b=0;b<=1;b+=1){const D=((b===0?a:r)-c)/v+l;D>=g&&D<=x&&Yv(e,s,D)}}else Math.max(a,Math.min(c,d))<=Math.min(r,Math.max(c,d))&&Yv(e,s,l);return x=a&&m<=r?Yv(e,s,x):g>s&&f>=a&&f<=r&&Yv(e,s,g),e}function Zoe(e,t,i,s){const n={minX:-1/0,maxX:1/0};for(const r of e){let l=r.at(-1);for(const c of r)Yoe(n,l,c,t,i,s),l=c}const{minX:o,maxX:a}=n;return Number.isFinite(o)&&Number.isFinite(a)?{x:t+(o+a)/2,width:a-o}:{x:t,width:0}}var{Property:ri,SeriesProperties:Xoe,makeSeriesTooltip:qoe}=k,Zt=class extends Xoe{constructor(){super(...arguments),this.topology=void 0,this.idKey="",this.idName=void 0,this.topologyIdKey="name",this.labelKey=void 0,this.labelName=void 0,this.colorRange=void 0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.padding=0,this.label=new Of,this.tooltip=qoe()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,opacity:1}}};y([ri],Zt.prototype,"topology",2),y([ri],Zt.prototype,"title",2),y([ri],Zt.prototype,"legendItemName",2),y([ri],Zt.prototype,"idKey",2),y([ri],Zt.prototype,"idName",2),y([ri],Zt.prototype,"topologyIdKey",2),y([ri],Zt.prototype,"labelKey",2),y([ri],Zt.prototype,"labelName",2),y([ri],Zt.prototype,"colorKey",2),y([ri],Zt.prototype,"colorName",2),y([ri],Zt.prototype,"colorRange",2),y([ri],Zt.prototype,"fill",2),y([ri],Zt.prototype,"fillOpacity",2),y([ri],Zt.prototype,"stroke",2),y([ri],Zt.prototype,"strokeOpacity",2),y([ri],Zt.prototype,"strokeWidth",2),y([ri],Zt.prototype,"lineDash",2),y([ri],Zt.prototype,"lineDashOffset",2),y([ri],Zt.prototype,"padding",2),y([ri],Zt.prototype,"itemStyler",2),y([ri],Zt.prototype,"label",2),y([ri],Zt.prototype,"tooltip",2);var{getMissCount:Qoe,createDatumId:QB,SeriesNodePickMode:JB,valueProperty:Zv,ColorScale:Joe,Group:e_,Selection:QA,Text:eae,PointerEvents:tae,applyShapeStyle:iae,getLabelStyles:sae,mergeDefaults:t_}=k,i_=k.MercatorScale.fixedScale(),Xv=class extends Kf{constructor(e){super({moduleCtx:e,categoryKey:void 0,propertyKeys:{color:["colorKey"],label:["labelKey"]},propertyNames:{color:["colorName"],label:["labelName"]},pickModes:[JB.EXACT_SHAPE_MATCH,JB.NEAREST_NODE]}),this.properties=new Zt,this._chartTopology=void 0,this.colorScale=new Joe,this.itemGroup=this.contentGroup.appendChild(new e_({name:"itemGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new e_({name:"itemLabelGroup"})),this.datumSelection=QA.select(this.itemGroup,()=>this.nodeFactory()),this.labelSelection=QA.select(this.itemLabelGroup,eae),this.highlightDatumSelection=QA.select(this.highlightGroup,()=>this.nodeFactory()),this.previousLabelLayouts=void 0,this._previousDatumMidPoint=void 0,this.itemLabelGroup.pointerEvents=tae.None}getNodeData(){return this.contextNodeData?.nodeData}get topology(){return this.properties.topology??this._chartTopology}get hasData(){return super.hasData&&this.topology!=null}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[1,e],this.highlightGroup.zIndex=[2,e],!0}isLabelEnabled(){return this.properties.labelKey!=null&&this.properties.label.enabled}nodeFactory(){const e=new tp;return e.renderMode=1,e.lineJoin="round",e}async processData(e){if(this.data==null)return;const{data:t,topology:i,colorScale:s}=this,{topologyIdKey:n,idKey:o,colorKey:a,labelKey:r,colorRange:l}=this.properties,c=new Map;for(const f of i?.features.values()??[]){const x=f.properties?.[n];x==null||!$A(f.geometry,1)||c.set(x,f)}const h=this.colorScale.type,d=this.scale?.type,{dataModel:u,processedData:p}=await this.requestDataModel(e,t,{props:[Zv(o,d,{id:"idValue",includeProperty:!1}),Zv(o,d,{id:"featureValue",includeProperty:!1,processor:()=>f=>c.get(f)}),...r?[Zv(r,"category",{id:"labelValue"})]:[],...a?[Zv(a,h,{id:"colorValue"})]:[]]}),g=u.resolveColumnById(this,"featureValue",p);if(this.topologyBounds=g.reduce((f,x)=>{const m=x?.geometry;return m==null?f:ip(m,f)},void 0),l!=null&&this.isColorScaleValid()){const f=u.resolveProcessedDataIndexById(this,"colorValue");s.domain=p.domain.values[f],s.range=l,s.update()}i==null&&K.warnOnce("no topology was provided for [MapShapeSeries]; nothing will be rendered.")}isColorScaleValid(){const{colorKey:e}=this.properties;if(!e)return!1;const{dataModel:t,processedData:i}=this;if(!t||!i)return!1;const s=t.resolveProcessedDataIndexById(this,"colorValue"),n=i.input.count,o=Qoe(this,i.defs.values[s].missing);return!(n===0||n===o)}getLabelLayout(e,t,i,s,n){if(t==null||s==null)return;const{idKey:o,idName:a,colorKey:r,colorName:l,labelKey:c,labelName:h,padding:d,label:u}=this.properties;if(c==null||!u.enabled)return;const p=this.getLabelText(t,e,c,"label",[],u,{value:t,datum:e,idKey:o,idName:a,colorKey:r,colorName:l,labelKey:c,labelName:h});if(p==null)return;const g=Ne(p)?On(p,u):i.measureLines(String(p)),f=(g.width+2*d)/(g.height+2*d);if(n?.geometry===s&&n?.labelText===p&&n?.aspectRatio===f)return n;const x=uc(s,i_),m=Hv(x);if(m==null)return;const v=$oe(m,{aspectRatio:f,precision:.001});if(v==null)return;const{x:b,y:S,maxWidth:D}=v;return{geometry:s,labelText:p,aspectRatio:f,x:b,y:S,maxWidth:D,fixedPolygon:m}}getLabelDatum(e,t){const{scale:i}=this;if(i==null)return;const{padding:s,label:n}=this.properties,{labelText:o,aspectRatio:a,x:r,y:l,maxWidth:c,fixedPolygon:h}=e,d={width:Math.ceil(c*t),height:Math.ceil(c*t/a),meta:r},u=wf($e(o),n,{padding:s},(S,D)=>{if(!D)return d;const L=Zoe(h,r,l,S/t);return{width:L.width*t,height:S,meta:L.x}});if(u==null)return;const[{text:p,fontSize:g,lineHeight:f,width:x},m]=u,v=xL){const I=S.length-L;S.length=L,S.push(`(+${I} more)`)}return S.length>0&&K.warnOnce("some data items do not have matches in the provided topology",S),{itemId:e,nodeData:v,labelData:b}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e,labelSelection:t,highlightDatumSelection:i}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;let s=this.ctx.highlightManager?.getActiveHighlight();const{legendItemName:n}=this.properties,o=n!=null&&s?.datum==null&&n===s?.legendItemName;s!=null&&(s.series!==this&&!o||s.datum==null)&&(s=void 0);const a=this.contextNodeData?.nodeData??[],r=this.contextNodeData?.labelData??[];this.datumSelection=this.updateDatumSelection({nodeData:a,datumSelection:e}),this.updateDatumStyles({datumSelection:e,isHighlight:!1}),this.updateDatumNodes({datumSelection:e}),this.labelSelection=this.updateLabelSelection({labelData:r,labelSelection:t}),this.updateLabelNodes({labelSelection:t}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:s==null?[]:[s],datumSelection:i}),this.updateDatumStyles({datumSelection:i,isHighlight:!0}),this.updateDatumNodes({datumSelection:i})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>QB(t.idValue))}getItemStyle({datumIndex:e,datum:t,colorValue:i},s){const{properties:n,colorScale:o}=this,{colorRange:a,itemStyler:r}=n,l=this.getHighlightStyle(s,e),c=t_(l,n.getStyle());!s&&i!=null&&(c.fill=this.isColorScaleValid()?o.convert(i):a?.[0]??c.fill);let h=c;if(r!=null&&e!=null){const d=this.cachedDatumCallback(QB(e,s?"highlight":"node"),()=>{const u=this.makeItemStylerParams(t,e,s,h);return this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],this.callWithContext(r,u))});d&&(h=t_(d,h))}return h}makeItemStylerParams(e,t,i,s){const{id:n}=this,o=this.ctx.highlightManager?.getActiveHighlight(),a=this.getHighlightStateString(o,i,t),r=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:n,datum:e,highlighted:i,highlightState:a,...s,fill:r}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){const t=KB(this.scale);e.each((i,s)=>{const{projectedGeometry:n}=s;if(n==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=n,iae(i,s.style,t)})}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const{properties:t}=this,i=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((s,{x:n,y:o,text:a,fontSize:r,lineHeight:l},c)=>{const h=sae(this,void 0,t,t.label,!1,i),{color:d,fontStyle:u,fontWeight:p,fontFamily:g}=h;s.visible=!0,s.x=n,s.y=o,s.text=a,s.fill=d,s.fontStyle=u,s.fontWeight=p,s.fontSize=r,s.lineHeight=l,s.fontFamily=g,s.textAlign="center",s.textBaseline="middle",s.fillOpacity=this.getHighlightStyle(!1,c).opacity??1,s.setBoxing(h)})}resetAnimation(){}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.datumSelection.each((n,o)=>{const a=n.distanceSquared(e,t);anew Xv(e),themeTemplate:{...Uf,series:{fill:sr({$applySwitch:[{$path:"type"},{$mapPalette:"fill"},["gradient",k.FILL_GRADIENT_LINEAR_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS]]}),stroke:{$ref:"chartBackgroundColor"},colorRange:{$if:[{$eq:[{$mapPalette:"type"},"inbuilt"]},{$mapPalette:"divergingColors"},sr(k.SAFE_RANGE2_OPERATION)]},fillOpacity:1,strokeWidth:1,lineDash:[0],lineDashOffset:0,padding:2,label:{...k.LABEL_BOXING_DEFAULTS,color:{$ref:"chartBackgroundColor"},fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:"bold",overflowStrategy:"hide"},highlight:sr(k.multiSeriesHighlightStyle(!0))},tooltip:{range:"exact"}}},cae={type:"series",name:"map-shape",chartType:"topology",enterprise:!0,options:rae,create:e=>new Xv(e)},{Property:tl,SeriesProperties:hae,makeSeriesTooltip:dae}=k,nr=class extends hae{constructor(){super(...arguments),this.topology=void 0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeOpacity=1,this.strokeWidth=0,this.lineDash=[0],this.lineDashOffset=0,this.tooltip=dae()}};y([tl],nr.prototype,"topology",2),y([tl],nr.prototype,"fill",2),y([tl],nr.prototype,"fillOpacity",2),y([tl],nr.prototype,"stroke",2),y([tl],nr.prototype,"strokeOpacity",2),y([tl],nr.prototype,"strokeWidth",2),y([tl],nr.prototype,"lineDash",2),y([tl],nr.prototype,"lineDashOffset",2),y([tl],nr.prototype,"tooltip",2);var{createDatumId:uae,Selection:pae,Group:gae,PointerEvents:s_}=k,qv=class extends Kf{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[]}),this.properties=new nr,this._chartTopology=void 0,this.itemGroup=this.contentGroup.appendChild(new gae({name:"itemGroup"})),this.datumSelection=pae.select(this.itemGroup,()=>this.nodeFactory()),this.itemGroup.pointerEvents=s_.None}get topology(){return this.properties.topology??this._chartTopology}get focusable(){return!1}setOptionsData(){}setChartData(){}getNodeData(){}get hasData(){return!1}renderToOffscreenCanvas(){return!0}setChartTopology(e){this._chartTopology=e,this.topology===e&&(this.nodeDataRefresh=!0)}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,e,0],this.highlightGroup.zIndex=[0,e,1],!0}nodeFactory(){const e=new tp;return e.renderMode=1,e.lineJoin="round",e.pointerEvents=s_.None,e}processData(){const{topology:e}=this;this.topologyBounds=e?.features.reduce((t,i)=>{const s=i.geometry;return s==null?t:ip(s,t)},void 0),e==null&&K.warnOnce("no topology was provided for [MapShapeBackgroundSeries]; nothing will be rendered.")}createNodeData(){const{id:e,topology:t,scale:i,properties:s}=this;if(t==null)return;const{fill:n,fillOpacity:o,stroke:a,strokeWidth:r,strokeOpacity:l,lineDash:c,lineDashOffset:h}=s,d=[],u=[];for(const[p,g]of t.features.entries()){const{geometry:f}=g,x=f!=null&&i!=null?uc(f,i):void 0;x!=null&&d.push({series:this,itemId:p,datum:g,datumIndex:0,index:p,projectedGeometry:x,style:{fill:n,fillOpacity:o,stroke:a,strokeWidth:r,strokeOpacity:l,lineDash:c,lineDashOffset:h}})}return{itemId:e,nodeData:d,labelData:u}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update(){const{datumSelection:e}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.labelGroup.visible=this.visible;const{nodeData:t=[]}=this.contextNodeData??{};this.datumSelection=this.updateDatumSelection({nodeData:t,datumSelection:e}),this.updateDatumNodes({datumSelection:e})}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>uae(t.index))}updateDatumNodes(e){const{datumSelection:t}=e;t.each((i,s)=>{const{projectedGeometry:n}=s;if(n==null){i.visible=!1,i.projectedGeometry=void 0;return}i.visible=!0,i.projectedGeometry=n,i.setProperties(s.style)})}resetAnimation(){}getLegendData(){return[]}getTooltipContent(e){}pickFocus(){}computeFocusBounds(e){}hasItemStylers(){return!1}};qv.className="MapShapeBackgroundSeries",qv.type="map-shape-background";var{commonSeriesOptionsDefs:fae,mapShapeBackgroundSeriesThemeableOptionsDef:yae}=k,mae={...yae,...fae,type:U(Ce("map-shape-background")),topology:rd},xae={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["topology"],identifier:"map-shape-background",moduleFactory:e=>new qv(e),themeTemplate:{...Uf,series:{fill:sr({$applySwitch:[{$path:"type"},{$path:["/1",{$mapPalette:"fill"},{$mapPalette:"hierarchyColors"}]},["gradient",k.FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS],["pattern",k.FILL_PATTERN_HIERARCHY_DEFAULTS]]}),stroke:{$ref:"chartBackgroundColor"},strokeWidth:1}}},bae={type:"series",name:"map-shape-background",chartType:"topology",enterprise:!0,options:mae,create:e=>new qv(e)},{createDatumId:vae,mergeDefaults:n_,toHighlightString:Sae}=k;function Mae(e,t,i){const{id:s}=e,{angleKey:n,cornerRadius:o,fill:a,fillOpacity:r,lineDash:l,lineDashOffset:c,radiusKey:h,stackGroup:d,stroke:u,strokeOpacity:p,strokeWidth:g}=e.properties,f=Sae(i??k.HighlightState.None);return{angleKey:n,cornerRadius:o,fill:a,fillOpacity:r,highlightState:f,highlighted:t,lineDash:l,lineDashOffset:c,radiusKey:h,seriesId:s,stackGroup:d,stroke:u,strokeOpacity:p,strokeWidth:g}}function JA(e,t,i,s){const{styler:n}=e.properties;let o={};if(!t&&n){const a=Mae(e,i,s);o=e.ctx.optionsGraphService.resolvePartial(["series",`${e.declarationOrder}`],e.cachedCallWithContext(n,a)??{},{pick:!1})??{}}return{cornerRadius:o.cornerRadius??e.properties.cornerRadius,fill:o.fill??e.properties.fill,fillOpacity:o.fillOpacity??e.properties.fillOpacity,lineDash:o.lineDash??e.properties.lineDash,lineDashOffset:o.lineDashOffset??e.properties.lineDashOffset,stroke:o.stroke??e.properties.stroke,strokeOpacity:o.strokeOpacity??e.properties.strokeOpacity,strokeWidth:o.strokeWidth??e.properties.strokeWidth,opacity:1}}function Dae(e,t,i,s){const{id:n,properties:o}=e,{angleKey:a,radiusKey:r}=o,l=e.ctx.highlightManager?.getActiveHighlight(),c=e.getHighlightStateString(l,i,t.datumIndex),h=e.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:n,datum:t.datum,highlighted:i,highlightState:c,angleKey:a,radiusKey:r,...s,fill:h}}function sp(e,t,i,s){const{properties:n}=e,{itemStyler:o}=n,a=e.getHighlightStyle(i,t?.datumIndex,s);let l=n_(a,JA(e,t===void 0,i,s));if(o!=null&&t!=null){const c=e.cachedDatumCallback(vae(e.getDatumId(t),i?"highlight":"node"),()=>{const h=Dae(e,t,i,l);return e.callWithContext(o,h)});c&&(l=n_(c,l))}return l}var{DEFAULT_POLAR_DIRECTION_KEYS:kae,DEFAULT_POLAR_DIRECTION_NAMES:Iae,ChartAxisDirection:or,PolarAxis:Aae,diff:Cae,fixNumericExtent:Lae,groupAccumulativeValueProperty:o_,keyProperty:Tae,normaliseGroupTo:wae,resetLabelFn:Nae,seriesLabelFadeInAnimation:Oae,seriesLabelFadeOutAnimation:Eae,valueProperty:Pae,animationValidation:Rae,createDatumId:zae,SeriesNodePickMode:a_,normalizeAngle360:r_,CategoryScale:Fae,motion:l_,applyShapeStyle:Bae,isGradientFill:_ae,updateLabelNode:Vae,getItemStyles:Gae}=k,jae=class extends k.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey}},c_=class extends k.PolarSeries{constructor(e,{animationResetFns:t}){super({moduleCtx:e,categoryKey:"angleValue",propertyKeys:kae,propertyNames:Iae,canHaveAxes:!0,pickModes:[a_.NEAREST_NODE,a_.EXACT_SHAPE_MATCH],animationResetFns:{...t,label:Nae}}),this.NodeEvent=jae,this.groupScale=new Fae,this.circleCache={r:0,cx:0,cy:0}}get hasData(){return this.getHasData("radiusValue-raw")}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===or.Angle)return t.getDomain(this,"angleValue","key",i);{const s=t.getDomain(this,"radiusValue-end","value",i),n=Number.isFinite(s[1]-s[0])?[Math.min(s[0],0),Math.max(s[1],0)]:[];return Lae(n)}}async processData(e){const{angleKey:t,radiusKey:i,normalizedTo:s}=this.properties,n=!this.ctx.animationManager.isSkipped(),o=this.getStackId(),a=`${o}-trailing`,r=[];qt(s)&&r.push(wae([o,a],Math.abs(s))),n&&this.processedData&&r.push(Cae(this.id,this.processedData)),n&&r.push(Rae());const l=this.visible?{}:{forceValue:0},c=this.axes[or.Radius]?.scale.type,h=this.axes[or.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[Tae(t,h,{id:"angleValue"}),Pae(i,c,{id:"radiusValue-raw",invalidValue:null,...l}),...o_(i,"normal",{id:"radiusValue-end",rangeId:"radiusValue-range",invalidValue:null,groupId:o,separateNegative:!0,...l},c),...o_(i,"trailing",{id:"radiusValue-start",invalidValue:null,groupId:a,separateNegative:!0,...l},c),...r],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,s=this.circleCache;return e!==s.r||t!==s.cx||i!==s.cy?(this.circleCache={r:e,cx:t,cy:i},!0):!1}isRadiusAxisReversed(){return this.axes[or.Radius]?.isReversed()}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}getAxisInnerRadius(){const e=this.axes[or.Radius];return e instanceof Aae?this.radius*e.innerRadiusRatio:0}createNodeData(){const{processedData:e,dataModel:t,groupScale:i}=this;if(!t||!e||e.type!=="grouped")return;const s=this.axes[or.Angle],n=this.axes[or.Radius],o=s?.scale,a=n?.scale;if(!o||!a)return;const r=t.resolveKeysById(this,"angleValue",e),l=t.resolveColumnById(this,"radiusValue-start",e),c=t.resolveColumnById(this,"radiusValue-end",e),h=t.resolveColumnById(this,"radiusValue-raw",e),d=t.resolveProcessedDataIndexById(this,"radiusValue-range");let u=0,p=0;s instanceof Vl&&(u=s.groupPaddingInner,p=s.paddingInner);const f=(o.bandwidth??0)*(1-p),{index:x,visibleGroupCount:m}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);i.domain=Array.from({length:m}).map((V,j)=>String(j)),i.range=[-f/2,f/2],i.paddingInner=m>1?u:0;const v=this.isRadiusAxisReversed(),b=v?this.radius:this.getAxisInnerRadius(),S=v?this.getAxisInnerRadius():this.radius,D=S+b,{angleKey:L,radiusKey:I,angleName:A,radiusName:T,legendItemName:w,label:N}=this.properties,O=this.getSeriesDomain(or.Radius),P=(V,j,$,W)=>{const Y=this.getLabelText(j,V,I,"radius",O,N,{value:j,datum:V,angleKey:L,radiusKey:I,angleName:A,radiusName:T,legendItemName:w});if(Y)return{x:$,y:W,text:Y,textAlign:"center",textBaseline:"middle"}},F=[],_=Gae((V,j,$)=>sp(this,V,j,$)),z={itemId:I,nodeData:F,labelData:F,styles:_};if(!this.visible)return z;const{dataSources:B}=e,R=B.get(this.id)?.data??[];for(const{datumIndex:V,group:j}of t.forEachGroupDatum(this,e)){const $=R[V],W=r[V];if(W==null)return;const Y=h[V],se=Y>=0&&!Object.is(Y,-0),X=l[V],Q=c[V],ie=j.aggregation[d][se?1:0]??0,q=se===v;if(X===void 0||Q===void 0)return;let ee,oe;if(R.length===1)ee=-.5*Math.PI,oe=1.5*Math.PI;else{const Ve=o.convert(W);ee=r_(Ve+i.convert(String(x))),oe=r_(ee+i.bandwidth)}const le=ee+i.bandwidth/2,he=D-a.convert(X),ue=D-a.convert(Q),xe=(he+ue)/2,be=D-a.convert(0),ye=D-a.convert(ie),Te=Math.cos(le)*xe,Ae=Math.sin(le)*xe,ze=this.properties.label.enabled?P($,Y,Te,Ae):void 0,we=this.getColumnWidth(ee,oe);F.push({series:this,datum:$,datumIndex:V,point:{x:Te,y:Ae,size:0},midPoint:{x:Te,y:Ae},label:ze,angleValue:W,radiusValue:Y,negative:q,innerRadius:he,outerRadius:ue,stackInnerRadius:be,stackOuterRadius:ye,startAngle:ee,endAngle:oe,midAngle:le,axisInnerRadius:b,axisOuterRadius:S,columnWidth:we,index:V})}return{itemId:I,nodeData:F,labelData:F,styles:_}}getColumnWidth(e,t){return Number.NaN}update({seriesRect:e}){const t=this.checkResize(e);this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updateSectorSelection(this.itemSelection,!1),this.updateSectorSelection(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updateSectorSelection(e,t){const{contextNodeData:i}=this;if(!i)return;const s=this.ctx.highlightManager.getActiveHighlight();let n=[];const o=this.ctx.highlightManager?.getActiveHighlight();t?o?.datum&&o.series===this&&n.push(o):n=this.nodeData;const a=this.isRadiusAxisReversed(),r=a?this.radius:this.getAxisInnerRadius(),l=a?this.getAxisInnerRadius():this.radius,c=this.getShapeFillBBox(),h=this.hasItemStylers();e.update(n,void 0,d=>this.getDatumId(d)).each((d,u)=>{const{midPoint:p}=u;if(h){const v=this.getHighlightState(o,t,u.datumIndex);u.style=sp(this,u,t,v)}const g=u.style??i.styles[this.getHighlightState(s,t,u.datumIndex)],f=g.fill,m=_ae(f)&&f.bounds==="item"?{centerX:p?.x??0,centerY:p?.y??0}:{centerX:0,centerY:0,innerRadius:r,outerRadius:l};this.updateItemPath(d,u,t),Bae(d,g,c,m),d.cornerRadius=g.cornerRadius??0,d.lineJoin="round"})}updateLabels(){const e=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((t,i)=>{Vae(this,t,this.properties,this.properties.label,i.label,!1,e),t.fillOpacity=this.getHighlightStyle(!1,i.datumIndex).opacity??1})}animateEmptyUpdateReady(){const{labelSelection:e}=this,t=this.getColumnTransitionFunctions();l_.fromToMotion(this.id,"datums",this.ctx.animationManager,[this.itemSelection],t),Oae(this,"labels",this.ctx.animationManager,e)}animateClearingUpdateEmpty(){const{itemSelection:e}=this,{animationManager:t}=this.ctx,i=this.getColumnTransitionFunctions();l_.fromToMotion(this.id,"datums",t,[e],i),Eae(this,"labels",t,this.labelSelection)}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:n,properties:o}=this,{angleKey:a,angleName:r,radiusKey:l,radiusName:c,legendItemName:h,tooltip:d}=o,u=n[or.Angle],p=n[or.Radius],g=this.nodeData?.[e];if(!i||!s||!u||!p||!g)return;const f=s.dataSources.get(this.id)?.data[e],x=i.resolveKeysById(this,"angleValue",s)[e],m=i.resolveColumnById(this,"radiusValue-raw",s)[e];if(x==null)return;const v=sp(this,g,!1);return this.formatTooltipWithContext(d,{heading:this.getAxisValueText(u,"tooltip",x,f,a,void 0),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(p,"tooltip",m,f,l,void 0)}]},{seriesId:t,datum:f,title:r,angleKey:a,angleName:r,radiusKey:l,radiusName:c,legendItemName:h,...v})}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.itemSelection.nodes())}legendItemSymbol(){const{fill:e,stroke:t,fillOpacity:i,strokeOpacity:s,strokeWidth:n,lineDash:o,lineDashOffset:a}=JA(this,!1,!1,k.HighlightState.None),r={fill:e??"rgba(0, 0, 0, 0)",stroke:t??"rgba(0, 0, 0, 0)",fillOpacity:i,strokeOpacity:s,strokeWidth:n,lineDash:o,lineDashOffset:a};return k.isGradientFill(r.fill)&&(r.fill={...r.fill,gradient:"linear",rotation:0,reverse:!1}),{marker:r}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{radiusKey:s,radiusName:n,legendItemName:o,showInLegend:a}=this.properties;return[{legendType:"category",id:t,itemId:s,seriesId:t,enabled:i,label:{text:o??n??s},symbol:this.legendItemSymbol(),legendItemName:o,hideInLegend:!a}]}getDatumId(e){return zae(e.angleValue)}computeLabelsBBox(){return null}},{SeriesProperties:Hae,makeSeriesTooltip:Wae,Property:Fi,Label:$ae}=k,li=class extends Hae{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.label=new $ae,this.tooltip=Wae()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,cornerRadius:r}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,cornerRadius:r,opacity:1}}};y([Fi],li.prototype,"angleKey",2),y([Fi],li.prototype,"angleName",2),y([Fi],li.prototype,"radiusKey",2),y([Fi],li.prototype,"radiusName",2),y([Fi],li.prototype,"legendItemName",2),y([Fi],li.prototype,"fill",2),y([Fi],li.prototype,"fillOpacity",2),y([Fi],li.prototype,"stroke",2),y([Fi],li.prototype,"strokeWidth",2),y([Fi],li.prototype,"strokeOpacity",2),y([Fi],li.prototype,"lineDash",2),y([Fi],li.prototype,"lineDashOffset",2),y([Fi],li.prototype,"cornerRadius",2),y([Fi],li.prototype,"styler",2),y([Fi],li.prototype,"itemStyler",2),y([Fi],li.prototype,"rotation",2),y([Fi],li.prototype,"stackGroup",2),y([Fi],li.prototype,"normalizedTo",2),y([Fi],li.prototype,"label",2),y([Fi],li.prototype,"tooltip",2);var{motion:Uae}=k;function h_(){const e={startAngle:new Map,endAngle:new Map},t=["startAngle","endAngle"],i=(a,r,l)=>{for(const c of t){const h=e[c];let d=(l==="removed"||l==="updated"?a:r)[c],u=(l==="removed"?a:r)[c];Number.isNaN(u)&&(u=a.previousDatum?.[c]??Number.NaN);const p=d-u;Math.abs(p)>Math.PI&&(d-=Math.sign(p)*2*Math.PI),h.set(r,{from:d,to:u})}},s=(a,r)=>({startAngle:e.startAngle.get(a)[r],endAngle:e.endAngle.get(a)[r]});return{calculate:i,from:a=>s(a,"from"),to:a=>s(a,"to")}}function d_(e,t,i){if(i==="updated"){if(e.previousDatum==null||Number.isNaN(e.previousDatum.startAngle)||Number.isNaN(e.previousDatum.endAngle))return"added";if(Number.isNaN(t.startAngle)||Number.isNaN(t.endAngle))return"removed"}return i==="added"&&e.previousDatum!=null?"updated":i}function Kae(e){const t=h_();return{toFn:(n,o,a)=>{const{startAngle:r,endAngle:l}=t.to(o);let c,h,d,u,p;return a==="removed"?(c=n.innerRadius,h=n.innerRadius,d=n.columnWidth,u=n.axisInnerRadius,p=n.axisOuterRadius):(c=Number.isNaN(o.innerRadius)?e:o.innerRadius,h=Number.isNaN(o.outerRadius)?e:o.outerRadius,d=Number.isNaN(o.columnWidth)?n.columnWidth:o.columnWidth,u=o.axisInnerRadius,p=o.axisOuterRadius),{innerRadius:c,outerRadius:h,columnWidth:d,axisInnerRadius:u,axisOuterRadius:p,startAngle:r,endAngle:l}},fromFn:(n,o,a)=>{a=d_(n,o,a),t.calculate(n,o,a);const{startAngle:r,endAngle:l}=t.from(o);let c,h,d,u,p;a==="removed"||a==="updated"?(c=n.innerRadius,h=n.outerRadius,d=n.columnWidth,u=n.axisInnerRadius,p=n.axisOuterRadius):(c=e,h=e,d=o.columnWidth,u=o.axisInnerRadius,p=o.axisOuterRadius);const g=Uae.NODE_UPDATE_STATE_TO_PHASE_MAPPING[a];return{innerRadius:c,outerRadius:h,columnWidth:d,axisInnerRadius:u,axisOuterRadius:p,startAngle:r,endAngle:l,phase:g}}}}function Yae(e,{innerRadius:t,outerRadius:i,columnWidth:s,axisInnerRadius:n,axisOuterRadius:o,startAngle:a,endAngle:r}){return{innerRadius:t,outerRadius:i,columnWidth:s,axisInnerRadius:n,axisOuterRadius:o,startAngle:a,endAngle:r}}var{SectorBox:Qv,motion:Zae}=k;function eC(e){const{negative:t,innerRadius:i,outerRadius:s,stackInnerRadius:n,stackOuterRadius:o}=e;return{innerRadius:t?o:n,outerRadius:t?n:o,clipInnerRadius:t?s:i,clipOuterRadius:t?i:s}}function Xae(e){const t=h_();return{toFn:(n,o,a)=>{const{startAngle:r,endAngle:l}=t.to(o);let c,h,d;if(a==="removed")c=e,h=e,d=new Qv(r,l,c,h);else{let u,p;({innerRadius:c,outerRadius:h,clipInnerRadius:u,clipOuterRadius:p}=eC(o)),Number.isNaN(c)&&(c=e),Number.isNaN(h)&&(h=e),Number.isNaN(u)&&(u=e),Number.isNaN(p)&&(p=e),d=new Qv(r,l,u,p)}return{innerRadius:c,outerRadius:h,startAngle:r,endAngle:l,clipSector:d}},fromFn:(n,o,a)=>{a=d_(n,o,a),t.calculate(n,o,a);const{startAngle:r,endAngle:l}=t.from(o);let c,h,d;a==="removed"||a==="updated"?(c=n.innerRadius,h=n.outerRadius,d=n.clipSector):(c=e,h=e),d??(d=new Qv(r,l,c,h));const u=Zae.NODE_UPDATE_STATE_TO_PHASE_MAPPING[a];return{innerRadius:c,outerRadius:h,startAngle:r,endAngle:l,clipSector:d,phase:u}}}}function qae(e,t){const{startAngle:i,endAngle:s}=t,{innerRadius:n,outerRadius:o,clipInnerRadius:a,clipOuterRadius:r}=eC(t),l=new Qv(i,s,a,r);return{innerRadius:n,outerRadius:o,startAngle:i,endAngle:s,clipSector:l}}var{Sector:Qae,SectorBox:Jae,PolarZIndexMap:tC}=k,Jv=class extends c_{constructor(e){super(e,{animationResetFns:{item:qae}}),this.properties=new li}setZIndex(e){return super.setZIndex(e),this.contentGroup.zIndex=[0,tC.FOREGROUND,e],this.highlightGroup.zIndex=[0,tC.HIGHLIGHT,e],this.labelGroup.zIndex=[0,tC.LABEL,e],!0}getStackId(){return`nightingale-stack-${this.seriesGrouping?.groupIndex??this.id}-yValues`}nodeFactory(){return new Qae}updateItemPath(e,t,i){const{negative:s}=t;if(e.centerX=0,e.centerY=0,e.startOuterCornerRadius=s?0:this.properties.cornerRadius,e.endOuterCornerRadius=s?0:this.properties.cornerRadius,e.startInnerCornerRadius=s?this.properties.cornerRadius:0,e.endInnerCornerRadius=s?this.properties.cornerRadius:0,i){const{startAngle:n,endAngle:o}=t,{innerRadius:a,outerRadius:r,clipInnerRadius:l,clipOuterRadius:c}=eC(t);e.innerRadius=a,e.outerRadius=r,e.startAngle=n,e.endAngle=o,e.clipSector=new Jae(n,o,l,c)}}getColumnTransitionFunctions(){const e=this.isRadiusAxisReversed()?this.radius:this.getAxisInnerRadius();return Xae(e)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};Jv.className="NightingaleSeries",Jv.type="nightingale";var{commonSeriesOptionsDefs:ere,nightingaleSeriesThemeableOptionsDef:tre}=k,ire={...ere,...tre,type:U(Ce("nightingale")),angleKey:U(E),radiusKey:U(E),angleName:E,radiusName:E,legendItemName:E,grouped:G,stacked:G,stackGroup:E,normalizedTo:Z},{ThemeConstants:{POLAR_AXIS_TYPE:u_,POLAR_AXIS_SHAPE:p_},FILL_GRADIENT_RADIAL_SERIES_DEFAULTS:sre,FILL_IMAGE_DEFAULTS:nre,FILL_PATTERN_DEFAULTS:ore}=k,are={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",sre],["image",nre],["pattern",ore]]},stroke:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$ref:"chartBackgroundColor"},{$palette:"stroke"}]},strokeWidth:1,label:{...k.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:k.multiSeriesHighlightStyle()},axes:{[u_.ANGLE_CATEGORY]:{shape:{$findFirstSiblingNotOperation:p_.CIRCLE},groupPaddingInner:0,paddingInner:0,label:{spacing:10}},[u_.RADIUS_NUMBER]:{shape:{$findFirstSiblingNotOperation:p_.CIRCLE}}}},{ThemeConstants:{POLAR_AXIS_TYPE:g_}}=k,rre={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"nightingale",moduleFactory:e=>new Jv(e),defaultAxes:[{type:g_.ANGLE_CATEGORY},{type:g_.RADIUS_NUMBER}],themeTemplate:are,stackable:!0,groupable:!0,stackedByDefault:!0},lre={type:"series",name:"nightingale",chartType:"polar",enterprise:!0,options:ire,create:e=>new Jv(e)},{SeriesProperties:cre,makeSeriesTooltip:hre,Property:Bi,Label:f_,DropShadow:dre}=k,ure=class extends f_{},iC=class extends f_{constructor(){super(...arguments),this.spacing=0}};y([Bi],iC.prototype,"spacing",2),y([Bi],iC.prototype,"placement",2);var Xi=class extends cre{constructor(){super(...arguments),this.fills=[],this.fillOpacity=1,this.strokes=[],this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.direction="vertical",this.reverse=void 0,this.spacing=0,this.aspectRatio=void 0,this.shadow=new dre().set({enabled:!1}),this.label=new ure,this.stageLabel=new iC,this.tooltip=hre()}getStyle(e=0){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r}=this;return{fill:t[e%t.length],fillOpacity:s,stroke:i[e%i.length],strokeWidth:n,strokeOpacity:o,lineDash:a,lineDashOffset:r,opacity:1}}};y([Bi],Xi.prototype,"stageKey",2),y([Bi],Xi.prototype,"valueKey",2),y([Bi],Xi.prototype,"fills",2),y([Bi],Xi.prototype,"fillOpacity",2),y([Bi],Xi.prototype,"strokes",2),y([Bi],Xi.prototype,"strokeWidth",2),y([Bi],Xi.prototype,"strokeOpacity",2),y([Bi],Xi.prototype,"lineDash",2),y([Bi],Xi.prototype,"lineDashOffset",2),y([Bi],Xi.prototype,"direction",2),y([Bi],Xi.prototype,"reverse",2),y([Bi],Xi.prototype,"spacing",2),y([Bi],Xi.prototype,"aspectRatio",2),y([Bi],Xi.prototype,"itemStyler",2),y([Bi],Xi.prototype,"shadow",2),y([Bi],Xi.prototype,"label",2),y([Bi],Xi.prototype,"stageLabel",2),y([Bi],Xi.prototype,"tooltip",2);function y_(e,{x:t,y:i,top:s,right:n,bottom:o,left:a}){e.x0=t-s/2,e.x1=t+s/2,e.x2=t+o/2,e.x3=t-o/2,e.y0=i-a/2,e.y1=i-n/2,e.y2=i+n/2,e.y3=i+a/2}function pre(e){return{fromFn:(n,o)=>{const{x:a,y:r}=o;let{top:l,right:c,bottom:h,left:d}=o;return e==="vertical"?(l=0,h=0):(d=0,c=0),{x:a,y:r,top:l,right:c,bottom:h,left:d}},toFn:(n,o)=>{const{x:a,y:r,top:l,right:c,bottom:h,left:d}=o;return{x:a,y:r,top:l,right:c,bottom:h,left:d}},applyFn:y_}}var{StateMachine:gre,valueProperty:m_,SeriesNodePickMode:x_,createDatumId:fre,BBox:sC,Group:nC,Selection:eS,Text:b_,PointerEvents:v_,applyShapeStyle:yre,mergeDefaults:S_,fromToMotion:mre,seriesLabelFadeInAnimation:xre,getLabelStyles:bre}=k,tS=class extends k.DataModelSeries{constructor(e){super({moduleCtx:e,categoryKey:void 0,pickModes:[x_.EXACT_SHAPE_MATCH,x_.NEAREST_NODE]}),this.properties=new Xi,this.itemGroup=this.contentGroup.appendChild(new nC({name:"itemGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new nC({name:"itemLabelGroup"})),this.stageLabelGroup=this.contentGroup.appendChild(new nC({name:"stageLabelGroup"})),this.datumSelection=eS.select(this.itemGroup,()=>this.nodeFactory()),this.labelSelection=eS.select(this.itemLabelGroup,b_),this.stageLabelSelection=eS.select(this.stageLabelGroup,b_),this.highlightDatumSelection=eS.select(this.highlightGroup,()=>this.nodeFactory()),this.animationState=new gre("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{clear:"empty",reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable()),this.itemLabelGroup.pointerEvents=v_.None,this.stageLabelGroup.pointerEvents=v_.None}addChartEventListeners(){this.cleanup.register(this.ctx.eventsHub.on("legend:item-click",e=>this.onLegendItemClick(e)))}nodeFactory(){return new tr}getNodeData(){return this.contextNodeData?.nodeData}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}async processData(e){if(this.data==null)return;const{id:t,visible:i,ctx:{legendManager:s}}=this,{stageKey:n,valueKey:o}=this.properties,a="category",r="number",l=(h,d,u)=>i&&s.getItemEnabled({seriesId:t,itemId:u}),c=this.visible?{}:{forceValue:0};await this.requestDataModel(e,this.data,{props:[m_(n,a,{id:"xValue"}),m_(o,r,{id:"yValue",...c,validation:l,invalidValue:0})]})}createNodeData(){const{id:e,dataModel:t,processedData:i,properties:s,visible:n,ctx:{legendManager:o}}=this,{stageKey:a,valueKey:r,direction:l,reverse:c=l==="horizontal",spacing:h,aspectRatio:d,label:u,stageLabel:p}=s;if(t==null||i==null)return;const g=l==="horizontal",f=t.resolveColumnById(this,"xValue",i),x=t.resolveColumnById(this,"yValue",i),m=t.getDomain(this,"xValue","value",i),v=t.getDomain(this,"yValue","value",i),b=Je(p);let S,D;g?(S="center",D=p.placement==="before"?"bottom":"top"):(S=p.placement==="after"?"left":"right",D="middle");const L=p.enabled?[]:void 0;let I=0,A=0,T=0;const w=i.dataSources.get(this.id)?.data??[];for(const[W,Y]of w.entries()){const se=f[W],X=x[W],Q=n&&o.getItemEnabled({seriesId:e,itemId:W});if(T+=X,L==null)continue;const ie=this.getLabelText(se,Y,a,"x",m,this.properties.stageLabel,{datum:Y,value:X,stageKey:a,valueKey:r}),{width:q,height:ee}=Ne(ie)?On(ie,u):b.measureLines(ie);I=Math.max(I,q),A=Math.max(A,ee),L.push({x:Number.NaN,y:Number.NaN,text:ie,textAlign:S,textBaseline:D,visible:Q})}const N=this._nodeDataDependencies?.seriesRectWidth??0,O=this._nodeDataDependencies?.seriesRectHeight??0,P=h*(i.input.count-1);let F;if(g){const W=A+p.spacing;F=new sC(0,p.placement==="before"?W:0,N,O-W)}else{const W=I+p.spacing;F=new sC(p.placement==="after"?0:W,0,N-W,O)}if(d!=null&&d!==0){const W=l==="horizontal"?1/d:d,Y=Math.min(F.width,F.height*W),se=Y/W;F=new sC(F.x+(F.width-Y)/2,F.y+(F.height-se)/2,Y,se)}let _,z;g?z=p.placement==="before"?F.y-p.spacing:F.y+F.height+p.spacing:_=p.placement==="after"?F.x+F.width+p.spacing:F.x-p.spacing;const B=F.width-(g?P:0),R=F.height-(g?0:P);if(B<0||R<0)return;const V=[],j=[];let $=0;for(const[W,Y]of w.entries()){const se=f[W],X=x[W],Q=n&&o.getItemEnabled({seriesId:e,itemId:W}),ie=$+X,q=($+ie)/(2*T),ee=(ie-$)/T,oe=g?B*q+h*W:B*.5,le=g?R*.5:R*q+h*W,he=F.x+oe,ue=F.y+le;if(L!=null){const we=L[W];we.x=_??he,we.y=z??ue}let xe,be,ye,Te;if(g){const we=B*ee;xe=we,ye=we;const Ve=(oe+we/2)*(R/F.width),Ke=(oe-we/2)*(R/F.width);be=c?F.height-Ve:Ve,Te=c?F.height-Ke:Ke}else{const we=R*ee;be=we,Te=we;const Ve=(le-we/2)*(B/F.height),Ke=(le+we/2)*(B/F.height);xe=c?F.width-Ve:Ve,ye=c?F.width-Ke:Ke}const Ae=this.getLabelText(X,Y,r,"y",v,u,{datum:Y,value:X,stageKey:a,valueKey:r}),ze={x:he,y:ue,text:Ae,textAlign:"center",textBaseline:"middle",visible:Q};j.push(ze),V.push({series:this,itemId:r,datum:Y,datumIndex:W,index:W,xValue:se,yValue:X,x:he,y:ue,top:xe,right:be,bottom:ye,left:Te,label:ze,enabled:Q,midPoint:{x:he,y:ue},style:this.getItemStyle({datumIndex:W,datum:Y},!1)}),$=ie}return{itemId:e,nodeData:V,labelData:j,stageLabelData:L,bounds:F}}updateSelections(){this.nodeDataRefresh&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}update({seriesRect:e}){this.checkResize(e);const{datumSelection:t,labelSelection:i,stageLabelSelection:s,highlightDatumSelection:n}=this;this.updateSelections(),this.contentGroup.visible=this.visible,this.contentGroup.opacity=this.getOpacity();let o=this.ctx.highlightManager?.getActiveHighlight();o!=null&&(o.series!==this||o.datum==null)&&(o=void 0);const a=this.contextNodeData?.nodeData??[],r=this.contextNodeData?.labelData??[],l=this.contextNodeData?.stageLabelData??[];this.datumSelection=this.updateDatumSelection({nodeData:a,datumSelection:t}),this.updateDatumStyles({datumSelection:t,isHighlight:!1}),this.updateDatumNodes({datumSelection:t,isHighlight:!1}),this.labelSelection=this.updateLabelSelection({labelData:r,labelSelection:i}),this.updateLabelNodes({labelSelection:i,labelProperties:this.properties.label}),this.stageLabelSelection=this.updateStageLabelSelection({stageLabelData:l,stageLabelSelection:s}),this.updateLabelNodes({labelSelection:s,labelProperties:this.properties.stageLabel}),this.highlightDatumSelection=this.updateDatumSelection({nodeData:o==null?[]:[o],datumSelection:n}),this.updateDatumStyles({datumSelection:n,isHighlight:!0}),this.updateDatumNodes({datumSelection:n,isHighlight:!0}),this.animationState.transition("update")}updateDatumSelection(e){return e.datumSelection.update(e.nodeData)}getItemStyle({datumIndex:e,datum:t},i){const{properties:s}=this,{itemStyler:n}=s,o=this.getHighlightStyle(i,e);let r=S_(o,s.getStyle(e));if(n!=null&&e!=null){const l=this.cachedDatumCallback(fre(e,i?"highlight":"node"),()=>{const c=this.makeItemStylerParams(t,e,i,r);return this.callWithContext(n,c)});l&&(r=S_(l,r))}return r}makeItemStylerParams(e,t,i,s){const{id:n,properties:o}=this,{stageKey:a,valueKey:r}=o,l=this.ctx.highlightManager?.getActiveHighlight(),c=this.getHighlightStateString(l,i,t),h=this.filterItemStylerFillParams(s.fill)??s.fill;return{seriesId:n,datum:e,stageKey:a,valueKey:r,highlighted:i,highlightState:c,...s,fill:h}}updateDatumStyles({datumSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getItemStyle(s,t)})}updateDatumNodes({datumSelection:e}){const{properties:t}=this,{shadow:i}=t,s=this.contextNodeData?.bounds,n=s?{series:s,axis:s}:void 0;e.each((o,a)=>{yre(o,a.style,n),y_(o,a),o.fillShadow=i})}updateLabelSelection(e){return e.labelSelection.update(this.properties.label.enabled?e.labelData:[])}updateStageLabelSelection(e){return e.stageLabelSelection.update(e.stageLabelData)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,s,n)=>{const{visible:o,x:a,y:r,text:l,textAlign:c,textBaseline:h}=s,d=bre(this,void 0,this.properties,e.labelProperties,!1,t),{color:u,fontSize:p,fontStyle:g,fontWeight:f,fontFamily:x}=d;i.visible=o,i.x=a,i.y=r,i.text=l,i.fill=u,i.fillOpacity=this.getHighlightStyle(!1,n).opacity??1,i.fontStyle=g,i.fontWeight=f,i.fontSize=p,i.fontFamily=x,i.textAlign=c,i.textBaseline=h,i.setBoxing(d)})}computeFocusBounds(e){const t=this.getNodeData()?.[e.datumIndex];if(t!==void 0){for(const i of this.datumSelection)if(i.datum===t)return i.node}}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,properties:n}=this,{stageKey:o,valueKey:a,tooltip:r}=n;if(!i||!s)return;const l=s.dataSources.get(this.id)?.data[e],c=i.resolveColumnById(this,"xValue",s)[e],h=i.resolveColumnById(this,"yValue",s)[e];if(c==null)return;const d=this.getLabelText(c,l,o,"x",i.getDomain(this,"xValue","value",s),this.properties.stageLabel,{datum:l,value:c,stageKey:o,valueKey:a}),u=this.getLabelText(h,l,a,"y",i.getDomain(this,"yValue","value",s),this.properties.stageLabel,{datum:l,value:h,stageKey:o,valueKey:a}),p=this.getItemStyle({datumIndex:e,datum:l},!1);return this.formatTooltipWithContext(r,{symbol:this.legendItemSymbol(e),data:[{label:$e(d),value:$e(u)}]},{seriesId:t,datum:l,title:void 0,stageKey:o,valueKey:a,...p})}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}pickNodeClosestDatum({x:e,y:t}){let i=1/0,s;return this.datumSelection.each((n,o)=>{const a=n.distanceSquared(e,t);anew tS(e),solo:!0,themeTemplate:kre},Are={type:"series",name:"pyramid",chartType:"standalone",enterprise:!0,options:Mre,create:e=>new tS(e)},{ThemeConstants:{POLAR_AXIS_TYPE:Cre}}=k,M_={series:{stroke:{$palette:"stroke"},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},marker:{enabled:!0,fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",k.FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS]]},stroke:{$palette:"stroke"},fillOpacity:1,shape:"circle",size:6,strokeOpacity:1,strokeWidth:{$isUserOption:["./stroke",1,0]}},highlight:k.multiSeriesHighlightStyle(),tooltip:{range:{$path:["/tooltip/range","nearest"]}}},axes:{[Cre.ANGLE_CATEGORY]:{label:{spacing:10}}}},Lre=k.mergeDefaults({series:{stroke:k.SAFE_STROKE_FILL_OPERATION,strokeWidth:2}},M_),Tre=k.mergeDefaults({series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",k.FILL_GRADIENT_LINEAR_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS]]},fillOpacity:.8,strokeWidth:2,marker:{enabled:!1}}},M_),{Label:wre,SeriesMarker:Nre,SeriesProperties:Ore,makeSeriesTooltip:Ere,Property:Js}=k,as=class extends Ore{constructor(){super(...arguments),this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.rotation=0,this.marker=new Nre,this.label=new wre,this.tooltip=Ere(),this.connectMissingData=!1}};y([Js],as.prototype,"angleKey",2),y([Js],as.prototype,"radiusKey",2),y([Js],as.prototype,"angleName",2),y([Js],as.prototype,"radiusName",2),y([Js],as.prototype,"legendItemName",2),y([Js],as.prototype,"stroke",2),y([Js],as.prototype,"strokeWidth",2),y([Js],as.prototype,"strokeOpacity",2),y([Js],as.prototype,"lineDash",2),y([Js],as.prototype,"lineDashOffset",2),y([Js],as.prototype,"rotation",2),y([Js],as.prototype,"styler",2),y([Js],as.prototype,"marker",2),y([Js],as.prototype,"label",2),y([Js],as.prototype,"tooltip",2),y([Js],as.prototype,"connectMissingData",2);var{DEFAULT_POLAR_DIRECTION_KEYS:Pre,DEFAULT_POLAR_DIRECTION_NAMES:Rre,ChartAxisDirection:Fo,PolarAxis:zre,SeriesNodePickMode:D_,valueProperty:k_,fixNumericExtent:Fre,seriesLabelFadeInAnimation:Bre,markerFadeInAnimation:_re,resetMarkerFn:Vre,animationValidation:Gre,computeMarkerFocusBounds:jre,extent:Hre,BBox:Wre,Group:$re,Path:Ure,Selection:oC,Text:Kre,Marker:Yre,updateLabelNode:Zre,getMarkerStyles:Xre,mergeDefaults:qre}=k,Qre=class extends k.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey}},aC=class extends k.PolarSeries{constructor(e){super({moduleCtx:e,categoryKey:"angleValue",propertyKeys:Pre,propertyNames:Rre,pickModes:[D_.NEAREST_NODE,D_.EXACT_SHAPE_MATCH],canHaveAxes:!0,animationResetFns:{item:Vre},clipFocusBox:!1}),this.NodeEvent=Qre,this.lineGroup=this.contentGroup.appendChild(new $re({name:"radar-line"})),this.lineSelection=oC.select(this.lineGroup,Ure),this.resetInvalidToZero=!1,this.circleCache={r:0,cx:0,cy:0},this.lineGroup.zIndex=0,this.itemGroup.zIndex=1}get hasData(){return this.getHasData("angleValue")}nodeFactory(){return new Yre}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===Fo.Angle)return t.getDomain(this,"angleValue","value",i);{const s=t.getDomain(this,"radiusValue","value",i),n=Hre(s.length===0?s:[0].concat(s));return Fre(n)}}async processData(e){const{angleKey:t,radiusKey:i}=this.properties,s=[];this.ctx.animationManager.isSkipped()||s.push(Gre());const n=this.axes[Fo.Radius]?.scale.type,o=this.axes[Fo.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[k_(t,o,{id:"angleValue"}),k_(i,n,{id:"radiusValue",invalidValue:void 0}),...s]}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,s=this.circleCache;return e===s.r&&t===s.cx&&i===s.cy?!1:(this.circleCache={r:e,cx:t,cy:i},!0)}getAxisInnerRadius(){const e=this.axes[Fo.Radius];return e instanceof zre?this.radius*e.innerRadiusRatio:0}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}createNodeData(){const{processedData:e,dataModel:t}=this;if(!e||!t)return;const{angleKey:i,radiusKey:s,angleName:n,radiusName:o,legendItemName:a,marker:r,label:l}=this.properties,c=this.axes[Fo.Angle]?.scale,h=this.axes[Fo.Radius]?.scale;if(!c||!h)return;const d=t.resolveColumnById(this,"angleValue",e),u=t.resolveColumnById(this,"radiusValue",e),p=this.getAxisInnerRadius(),g=this.getSeriesDomain(Fo.Radius),x=(e.dataSources.get(this.id)?.data??[]).map((m,v)=>{const b=d[v],S=u[v],D=c.convert(b),L=this.radius+p-h.convert(S),I=Math.cos(D),A=Math.sin(D),T=I*L,w=A*L;let N;if(l.enabled){const O=this.getLabelText(S,m,s,"radius",g,l,{value:S,datum:m,angleKey:i,radiusKey:s,angleName:n,radiusName:o,legendItemName:a});if(O){let P="right";Qe(I,0)?P="center":I>0&&(P="left");let F="bottom";Qe(A,0)?F="middle":A>0&&(F="top"),N={x:T+I*r.size,y:w+A*r.size,text:O,textAlign:P,textBaseline:F}}}return{series:this,datum:m,datumIndex:v,index:v,point:{x:T,y:w,size:r.size},midPoint:{x:T,y:w},label:N,angleValue:b,radiusValue:S,missing:!Ye(D)||!Ye(L)}});return{itemId:s,nodeData:x,labelData:x,styles:Xre(this,this.properties,r)}}update({seriesRect:e}){const t=this.checkResize(e),i=!this.ctx.animationManager.isSkipped(),{series:s}=this.ctx.highlightManager?.getActiveHighlight()??{};this.highlightGroup.visible=(i||this.visible)&&s===this,this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updatePathSelections(),this.updateMarkerSelection(),this.updateHighlightSelection(),this.updatePathNodes(),this.hasItemStylers()&&(this.updateDatumStyles(this.itemSelection,!1),this.updateDatumStyles(this.highlightSelection,!0)),this.updateMarkers(this.itemSelection,!1),this.updateMarkers(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updatePathSelections(){const e=this.visible?[!0]:[];this.lineSelection.update(e)}updateMarkerSelection(){const{marker:e,styler:t}=this.properties;e.isDirty()&&(this.itemSelection.clear(),this.itemSelection.cleanup(),this.itemSelection=oC.select(this.itemGroup,()=>this.nodeFactory(),!1));const i=t==null?e.enabled:this.getStyle(!1).marker.enabled,s=this.visible&&e.shape&&i?this.nodeData:[];this.itemSelection.update(s)}updateHighlightSelection(){const{marker:e,styler:t}=this.properties;e.isDirty()&&(this.highlightSelection.clear(),this.highlightSelection.cleanup(),this.highlightSelection=oC.select(this.highlightGroup,()=>this.nodeFactory(),!1));const i=t==null?e.enabled:this.getStyle(!1).marker.enabled,s=this.ctx.highlightManager?.getActiveHighlight(),n=this.visible&&e.shape&&i&&s?.datum?[{...s}]:[];this.highlightSelection.update(n)}getMarkerFill(e){return e?.fill??this.getStyle(!1).marker.fill}getDatumStylerProperties(e){const{id:t,properties:i}=this,{angleKey:s,radiusKey:n}=i;return{seriesId:t,datum:e,angleKey:s,radiusKey:n}}updateDatumStyles(e,t){const i=this.ctx.highlightManager.getActiveHighlight();e.each((s,n)=>{const o=this.getHighlightState(i,t,n.datumIndex),a=this.getStyle(t,o),{stroke:r,strokeWidth:l,strokeOpacity:c}=a;n.style=this.getMarkerStyle(this.properties.marker,n,this.getDatumStylerProperties(n.datum),{isHighlight:t,highlightState:o},a.marker,{stroke:r,strokeWidth:l,strokeOpacity:c})})}updateMarkers(e,t){const i=this.getShapeFillBBox(),{contextNodeData:s}=this;if(!s)return;const n=this.ctx.highlightManager.getActiveHighlight();e.each((o,a)=>{const r=a.style??s.styles[this.getHighlightState(n,t,a.datumIndex)];this.applyMarkerStyle(r,o,a.point,i)})}updateLabels(){const{properties:e}=this,t=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((i,s)=>{s.label&&(i.fillOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1,Zre(this,i,e,e.label,s.label,!1,t))})}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:n,properties:o}=this,{angleKey:a,angleName:r,radiusKey:l,radiusName:c,legendItemName:h,tooltip:d,marker:u}=o,p=n[Fo.Angle],g=n[Fo.Radius];if(!i||!s||!p||!g)return;const f=s.dataSources.get(this.id)?.data[e],x=i.resolveColumnById(this,"angleValue",s)[e],m=i.resolveColumnById(this,"radiusValue",s)[e];if(x==null)return;const v=this.getMarkerStyle(u,{datum:f,datumIndex:e},this.getDatumStylerProperties(f),{isHighlight:!1});return this.formatTooltipWithContext(d,{heading:this.getAxisValueText(p,"tooltip",x,f,a,void 0),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:this.getAxisValueText(g,"tooltip",m,f,l,void 0)}]},{seriesId:t,datum:f,title:r,angleKey:a,radiusKey:l,angleName:r,radiusName:c,legendItemName:h,...v})}legendItemSymbol(){const{stroke:e,strokeWidth:t,strokeOpacity:i,lineDash:s,marker:n}=this.getStyle(!1);return{marker:{shape:n.shape,enabled:n.enabled||t<=0,fill:this.getMarkerFill()??n.stroke??e??"rgba(0, 0, 0, 0)",stroke:n.stroke??e??"rgba(0, 0, 0, 0)",fillOpacity:n.fillOpacity,strokeOpacity:n.strokeOpacity,strokeWidth:n.strokeWidth,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset},line:{stroke:e,strokeOpacity:i,strokeWidth:t,lineDash:s}}}getLegendData(e){if(e!=="category")return[];const{id:t,ctx:{legendManager:i},visible:s}=this,{radiusKey:n,radiusName:o,legendItemName:a,showInLegend:r}=this.properties;return[{legendType:"category",id:t,itemId:n,seriesId:t,enabled:s&&i.getItemEnabled({seriesId:t,itemId:n}),label:{text:a??o??n},symbol:this.legendItemSymbol(),legendItemName:a,hideInLegend:!r}]}pickNodeClosestDatum(e){const{nodeData:t,centerX:i,centerY:s}=this,{x:n,y:o}=e,a=this.radius;if(Math.hypot(n-i,o-s)>a+this.properties.marker.size)return;let l=1/0,c;for(const h of t){const{point:{x:d=Number.NaN,y:u=Number.NaN}={}}=h;if(Number.isNaN(d)||Number.isNaN(u))continue;const p=Math.hypot(e.x-d-i,e.y-u-s);pthis.animatePaths(s),onStop:()=>this.animatePaths(1)}),_re(this,i,"added",e),Bre(this,"labels",i,t)}animateWaitingUpdateReady(e){super.animateWaitingUpdateReady(e),this.resetPaths()}animateReadyResize(e){super.animateReadyResize(e),this.resetPaths()}resetPaths(){const e=this.getLineNode();if(e){const{path:t}=e,i=this.getLinePoints(),s=this.getStyle(!1);e.fill=void 0,e.stroke=s.stroke,e.strokeWidth=s.strokeWidth,e.strokeOpacity=s.strokeOpacity,e.lineDash=s.lineDash,e.lineDashOffset=s.lineDashOffset,t.clear(!0);for(const{x:n,y:o,moveTo:a}of i)a?t.moveTo(n,o):t.lineTo(n,o);return e.checkPathDirty(),s}}getStylerResult(e,t,i){const{styler:s}=this.properties;if(s){const n=this.makeStylerParams(t,i),o=this.cachedCallWithContext(s,n)??{},a=this.ctx.optionsGraphService.resolvePartial(["series",`${this.declarationOrder}`],o,{pick:!1});a&&(e=a)}return e}getFormattedMarkerStyle(e){const{angleKey:t,radiusKey:i}=this.properties;return this.getMarkerStyle(this.properties.marker,e,{angleKey:t,radiusKey:i},{isHighlight:!0})}computeFocusBounds(e){return jre(this,e)}hasItemStylers(){return this.properties.styler!=null||this.properties.marker.itemStyler!=null||this.properties.label.itemStyler!=null}};aC.className="RadarSeries";var{Property:I_}=k,rC=class extends as{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1}};y([I_],rC.prototype,"fill",2),y([I_],rC.prototype,"fillOpacity",2);var{ChartAxisDirection:A_,Group:Jre,HighlightState:ele,Path:tle,PointerEvents:C_,Selection:ile,applyShapeStyle:L_,toHighlightString:sle}=k,iS=class extends aC{constructor(e){super(e),this.properties=new rC,this.areaGroup=this.contentGroup.appendChild(new Jre({name:"radar-area"})),this.areaSelection=ile.select(this.areaGroup,tle),this.resetInvalidToZero=!0,this.areaGroup.zIndex=-1}updatePathSelections(){const e=this.visible?[!0]:[];this.areaSelection.update(e),super.updatePathSelections()}getAreaNode(){return this.areaSelection.at(0)}getMarkerFill(e){if(e?.fill!=null)return e.fill;const t=this.getStyle(!1);return t.marker.fill??t.fill}updatePathNodes(){const e=this.getPathNodesStyle(),{fill:t,fillOpacity:i,strokeWidth:s,stroke:n,strokeOpacity:o,lineDash:a,lineDashOffset:r,opacity:l}=e,c=this.getLineNode();c&&c.setProperties({fill:void 0,lineJoin:"round",lineCap:"round",pointerEvents:C_.None,opacity:l,stroke:n,strokeWidth:s,strokeOpacity:o,lineDash:a,lineDashOffset:r});const h=this.getAreaNode();h&&(L_(h,{fill:t,fillOpacity:i,stroke:void 0},this.getShapeFillBBox()),h.setProperties({lineJoin:"round",pointerEvents:C_.None,opacity:l}))}animatePaths(e){super.animatePaths(e);const t=this.getAreaNode();t&&this.animateSinglePath(t,this.getAreaPoints(),e)}getAreaPoints(){const e=this.getLinePoints(),t=a=>{const r=this.axes[a];return r instanceof k.PolarAxis?r:void 0},i=t(A_.Radius),s=t(A_.Angle);if(!i?.isReversed())return e;const o=s?.getAxisLinePoints()?.points??[];return e.concat(...o)}resetPaths(){const e=super.resetPaths(),t=this.getAreaNode();if(t){const{path:i}=t,s=this.getAreaPoints(),n=e??this.getStyle(!1),o=this.getShapeFillBBox();L_(t,{fill:n.fill,stroke:void 0,fillOpacity:n.fillOpacity,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset},o),t.lineJoin=t.lineCap="round",i.clear(!0);for(const{x:a,y:r,moveTo:l,arc:c,radius:h=0,startAngle:d=0,endAngle:u=0}of s)c?i.arc(a,r,h,d,u):l?i.moveTo(a,r):i.lineTo(a,r);return i.closePath(),t.checkPathDirty(),n}}makeStylerParams(e,t){const{properties:i}=this,s=sle(t??ele.None);return{marker:{fill:i.marker.fill,fillOpacity:i.marker.fillOpacity,size:i.marker.size,shape:i.marker.shape,stroke:i.marker.stroke,strokeOpacity:i.marker.strokeOpacity,strokeWidth:i.marker.strokeWidth,lineDash:i.marker.lineDash,lineDashOffset:i.marker.lineDashOffset},highlightState:s,highlighted:e,fill:i.fill,fillOpacity:i.fillOpacity,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,seriesId:this.id,stroke:i.stroke,strokeOpacity:i.strokeOpacity,strokeWidth:i.strokeWidth,angleKey:i.angleKey,radiusKey:i.radiusKey}}getStyle(e,t){const{marker:i,fill:s,fillOpacity:n,lineDash:o,lineDashOffset:a,stroke:r,strokeOpacity:l,strokeWidth:c}=this.properties,{size:h,shape:d,fill:u="transparent",fillOpacity:p}=i,g=this.getStylerResult({},e,t);return g.marker??(g.marker={}),{fill:g.fill??s,fillOpacity:g.fillOpacity??n,lineDash:g.lineDash??o,lineDashOffset:g.lineDashOffset??a,stroke:g.stroke??r,strokeOpacity:g.strokeOpacity??l,strokeWidth:g.strokeWidth??c,marker:{enabled:g.marker.enabled??i.enabled,fill:g.marker.fill??u,fillOpacity:g.marker.fillOpacity??p,shape:g.marker.shape??d,size:g.marker.size??h,lineDash:g.marker.lineDash??i.lineDash??o,lineDashOffset:g.marker.lineDashOffset??i.lineDashOffset??a,stroke:g.marker.stroke??i.stroke??r,strokeOpacity:g.marker.strokeOpacity??i.strokeOpacity??l,strokeWidth:g.marker.strokeWidth??i.strokeWidth??c}}}};iS.className="RadarAreaSeries",iS.type="radar-area";var{commonSeriesOptionsDefs:nle,radarAreaSeriesThemeableOptionsDef:ole}=k,ale={...nle,...ole,type:U(Ce("radar-area")),angleKey:U(E),radiusKey:U(E),angleName:E,radiusName:E,legendItemName:E},{ThemeConstants:{POLAR_AXIS_TYPE:T_}}=k,rle={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radar-area",moduleFactory:e=>new iS(e),defaultAxes:[{type:T_.ANGLE_CATEGORY},{type:T_.RADIUS_NUMBER}],themeTemplate:Tre},lle={type:"series",name:"radar-area",chartType:"polar",enterprise:!0,options:ale,create:e=>new iS(e)},{HighlightState:cle,PointerEvents:hle,toHighlightString:dle}=k,sS=class extends aC{constructor(){super(...arguments),this.properties=new as}updatePathSelections(){this.lineSelection.update(this.visible?[!0]:[])}updatePathNodes(){const e=this.getLineNode();if(!e)return;const t=this.getPathNodesStyle(),{strokeWidth:i,stroke:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,opacity:r}=t;e.setProperties({fill:void 0,lineJoin:"round",lineCap:"round",pointerEvents:hle.None,opacity:r,stroke:s,strokeWidth:i,strokeOpacity:n,lineDash:o,lineDashOffset:a})}makeStylerParams(e,t){const{properties:i}=this,s=dle(t??cle.None);return{marker:{fill:i.marker.fill,fillOpacity:i.marker.fillOpacity,size:i.marker.size,shape:i.marker.shape,stroke:i.marker.stroke,strokeOpacity:i.marker.strokeOpacity,strokeWidth:i.marker.strokeWidth,lineDash:i.marker.lineDash,lineDashOffset:i.marker.lineDashOffset},highlightState:s,highlighted:e,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,seriesId:this.id,stroke:i.stroke,strokeOpacity:i.strokeOpacity,strokeWidth:i.strokeWidth,angleKey:i.angleKey,radiusKey:i.radiusKey}}getStyle(e,t){const{marker:i,lineDash:s,lineDashOffset:n,stroke:o,strokeOpacity:a,strokeWidth:r}=this.properties,{size:l,shape:c,fill:h="transparent",fillOpacity:d}=i,u=this.getStylerResult({},e,t);return u.marker??(u.marker={}),{lineDash:u.lineDash??s,lineDashOffset:u.lineDashOffset??n,stroke:u.stroke??o,strokeOpacity:u.strokeOpacity??a,strokeWidth:u.strokeWidth??r,marker:{enabled:u.marker.enabled??i.enabled,fill:u.marker.fill??h,fillOpacity:u.marker.fillOpacity??d,shape:u.marker.shape??c,size:u.marker.size??l,lineDash:u.marker.lineDash??i.lineDash??s,lineDashOffset:u.marker.lineDashOffset??i.lineDashOffset??n,stroke:u.marker.stroke??i.stroke??o,strokeOpacity:u.marker.strokeOpacity??i.strokeOpacity??a,strokeWidth:u.marker.strokeWidth??i.strokeWidth??r}}}};sS.className="RadarLineSeries",sS.type="radar-line";var{commonSeriesOptionsDefs:ule,radarLineSeriesThemeableOptionsDef:ple}=k,gle={...ule,...ple,type:U(Ce("radar-line")),angleKey:U(E),radiusKey:U(E),angleName:E,radiusName:E,legendItemName:E},{POLAR_AXIS_TYPE:w_}=k.ThemeConstants,fle={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radar-line",moduleFactory:e=>new sS(e),defaultAxes:[{type:w_.ANGLE_CATEGORY},{type:w_.RADIUS_NUMBER}],themeTemplate:Lre},yle={type:"series",name:"radar-line",chartType:"polar",enterprise:!0,options:gle,create:e=>new sS(e)},{SeriesProperties:mle,makeSeriesTooltip:xle,Property:_i,Label:ble}=k,Si=class extends mle{constructor(){super(...arguments),this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.label=new ble,this.tooltip=xle()}getStyle(){const{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,cornerRadius:r}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a,cornerRadius:r,opacity:1}}};y([_i],Si.prototype,"angleKey",2),y([_i],Si.prototype,"radiusKey",2),y([_i],Si.prototype,"angleName",2),y([_i],Si.prototype,"radiusName",2),y([_i],Si.prototype,"legendItemName",2),y([_i],Si.prototype,"fill",2),y([_i],Si.prototype,"fillOpacity",2),y([_i],Si.prototype,"stroke",2),y([_i],Si.prototype,"strokeWidth",2),y([_i],Si.prototype,"strokeOpacity",2),y([_i],Si.prototype,"lineDash",2),y([_i],Si.prototype,"lineDashOffset",2),y([_i],Si.prototype,"cornerRadius",2),y([_i],Si.prototype,"styler",2),y([_i],Si.prototype,"itemStyler",2),y([_i],Si.prototype,"rotation",2),y([_i],Si.prototype,"stackGroup",2),y([_i],Si.prototype,"normalizedTo",2),y([_i],Si.prototype,"label",2),y([_i],Si.prototype,"tooltip",2);var{SectorBox:N_,motion:vle}=k;function Sle(e,t,i){if(i==="updated"){if(e.previousDatum==null||Number.isNaN(e.previousDatum.innerRadius)||Number.isNaN(e.previousDatum.outerRadius))return"added";if(Number.isNaN(t.innerRadius)||Number.isNaN(t.outerRadius))return"removed"}return i==="added"&&e.previousDatum!=null?"updated":i}function O_(e){return{toFn:(s,n,o)=>{let a,r,l,c,h;return o==="removed"?(a=e,r=e,l=n.innerRadius,c=n.outerRadius,h=new N_(a,r,l,c)):(a=n.startAngle,r=n.endAngle,l=Number.isNaN(n.innerRadius)?s.innerRadius:n.innerRadius,c=Number.isNaN(n.outerRadius)?s.outerRadius:n.outerRadius,h=n.clipSector),{startAngle:a,endAngle:r,innerRadius:l,outerRadius:c,clipSector:h}},fromFn:(s,n,o)=>{o=Sle(s,n,o);let a,r,l,c,h;o==="removed"||o==="updated"?(a=s.startAngle,r=s.endAngle,l=s.innerRadius,c=s.outerRadius,h=s.clipSector):(a=e,r=e,l=n.innerRadius,c=n.outerRadius),h??(h=new N_(a,r,l,c));const d=vle.NODE_UPDATE_STATE_TO_PHASE_MAPPING[o];return{startAngle:a,endAngle:r,innerRadius:l,outerRadius:c,clipSector:h,phase:d}}}}function Mle(e,t){return{centerX:0,centerY:0,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,clipSector:t.clipSector}}var{DEFAULT_POLAR_DIRECTION_KEYS:Dle,DEFAULT_POLAR_DIRECTION_NAMES:kle,ChartAxisDirection:ar,PolarAxis:Ile,diff:Ale,groupAccumulativeValueProperty:E_,keyProperty:Cle,normaliseGroupTo:Lle,valueProperty:Tle,fixNumericExtent:wle,resetLabelFn:Nle,seriesLabelFadeInAnimation:Ole,seriesLabelFadeOutAnimation:Ele,animationValidation:Ple,angleBetween:Rle,createDatumId:zle,CategoryScale:Fle,Sector:Ble,SectorBox:_le,motion:P_,isGradientFill:Vle,applyShapeStyle:Gle,updateLabelNode:jle,getItemStyles:Hle}=k,Wle=class extends k.SeriesNodeEvent{constructor(e,t,i,s){super(e,t,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey}},nS=class extends k.PolarSeries{constructor(e){super({moduleCtx:e,categoryKey:"radiusValue",propertyKeys:Dle,propertyNames:kle,canHaveAxes:!0,animationResetFns:{item:Mle,label:Nle}}),this.properties=new Si,this.NodeEvent=Wle,this.groupScale=new Fle,this.circleCache={r:0,cx:0,cy:0}}get hasData(){return this.getHasData("angleValue-raw")}nodeFactory(){return new Ble}getSeriesDomain(e){const{dataModel:t,processedData:i}=this;if(!i||!t)return[];if(e===ar.Angle){const s=t.getDomain(this,"angleValue-end","value",i),n=[Math.min(s[0],0),Math.max(s[1],0)];return wle(n)}else return t.getDomain(this,"radiusValue","key",i)}async processData(e){const{angleKey:t,radiusKey:i,normalizedTo:s}=this.properties,n=!this.ctx.animationManager.isSkipped(),o=this.getStackId(),a=`${o}-trailing`,r=[];qt(s)&&r.push(Lle([o,a],Math.abs(s))),n&&(this.processedData&&r.push(Ale(this.id,this.processedData)),r.push(Ple()));const l=this.visible?{}:{forceValue:0},c=this.axes[ar.Radius]?.scale.type,h=this.axes[ar.Angle]?.scale.type;await this.requestDataModel(e,this.data,{props:[Cle(i,c,{id:"radiusValue"}),Tle(t,h,{id:"angleValue-raw",invalidValue:null,...l}),...E_(t,"normal",{id:"angleValue-end",rangeId:"angleValue-range",invalidValue:null,groupId:o,separateNegative:!0,...l},h),...E_(t,"trailing",{id:"angleValue-start",invalidValue:null,groupId:a,separateNegative:!0,...l},h),...r],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}didCircleChange(){const e=this.radius,t=this.centerX,i=this.centerY,s=this.circleCache;return e===s.r&&t===s.cx&&i===s.cy?!1:(this.circleCache={r:e,cx:t,cy:i},!0)}maybeRefreshNodeData(){!this.didCircleChange()&&!this.nodeDataRefresh||(this.contextNodeData=this.createNodeData(),this.nodeData=this.contextNodeData?.nodeData??[],this.nodeDataRefresh=!1)}getAxisInnerRadius(){const e=this.axes[ar.Radius];return e instanceof Ile?this.radius*e.innerRadiusRatio:0}createNodeData(){const{processedData:e,dataModel:t}=this;if(!t||!e||e.type!=="grouped")return;const i=this.axes[ar.Angle],s=this.axes[ar.Radius],n=i?.scale,o=s?.scale;if(!n||!o)return;const a=t.resolveKeysById(this,"radiusValue",e),r=t.resolveColumnById(this,"angleValue-start",e),l=t.resolveColumnById(this,"angleValue-end",e),c=t.resolveColumnById(this,"angleValue-raw",e),h=t.resolveProcessedDataIndexById(this,"angleValue-range");let d=0;s instanceof Gl&&(d=s.groupPaddingInner);const{groupScale:u}=this,{index:p,visibleGroupCount:g}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);u.domain=Array.from({length:g}).map((R,V)=>String(V)),u.range=[0,Math.abs(o.bandwidth??0)],u.paddingInner=g>1?d:0;const f=u.bandwidth>=1?u.bandwidth:u.rawBandwidth,x=i.isReversed(),m=s.isReversed(),v=m?this.radius:this.getAxisInnerRadius(),S=(m?this.getAxisInnerRadius():this.radius)+v,D=this.getSeriesDomain(ar.Angle),{angleKey:L,radiusKey:I,angleName:A,radiusName:T,legendItemName:w,label:N}=this.properties,O=(R,V,j,$)=>{const W=this.getLabelText(V,R,L,"angle",D,N,{value:V,datum:R,angleKey:L,radiusKey:I,angleName:A,radiusName:T,legendItemName:w});if(W)return{x:j,y:$,text:W,textAlign:"center",textBaseline:"middle"}},P=[],F=Hle((R,V,j)=>sp(this,R,V,j)),_={itemId:I,nodeData:P,labelData:P,styles:F};if(!this.visible)return _;const{dataSources:z}=e,B=z.get(this.id)?.data??[];for(const{datumIndex:R,group:V}of t.forEachGroupDatum(this,e)){const j=B[R],$=a[R];if($==null)return;const W=c[R],Y=r[R],se=l[R],X=W>=0&&!Object.is(W,-0),Q=V.aggregation[h][X?1:0],ie=X===x;let q=n.convert(Y,{clamp:!0}),ee=n.convert(se,{clamp:!0}),oe=n.convert(0,{clamp:!0}),le=n.convert(Q,{clamp:!0});ie&&([oe,le]=[le,oe],[q,ee]=[ee,q]);const ue=S-o.convert($)+u.convert(String(p)),xe=ue+f,be=(ue+xe)/2,ye=q+Rle(q,ee)/2,Te=Math.cos(ye)*be,Ae=Math.sin(ye)*be,ze=this.properties.label.enabled?O(j,W,Te,Ae):void 0,we=new _le(q,ee,ue,xe);P.push({series:this,datum:j,datumIndex:R,point:{x:Te,y:Ae,size:0},midPoint:{x:Te,y:Ae},label:ze,angleValue:W,radiusValue:$,innerRadius:ue,outerRadius:xe,startAngle:oe,endAngle:le,clipSector:we,reversed:ie,index:R})}return _}update({seriesRect:e}){const t=this.checkResize(e);this.maybeRefreshNodeData(),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),this.updateSectorSelection(this.itemSelection,!1),this.updateSectorSelection(this.highlightSelection,!0),this.updateLabels(),t&&this.animationState.transition("resize"),this.animationState.transition("update")}updateSectorSelection(e,t){let i=[];const s=this.ctx.highlightManager?.getActiveHighlight();t?s?.datum&&s.series===this&&i.push(s):i=this.nodeData;const{contextNodeData:n}=this;if(!n)return;const o=this.ctx.highlightManager.getActiveHighlight(),a=this.getShapeFillBBox(),r=this.hasItemStylers();e.update(i,void 0,l=>this.getDatumId(l)).each((l,c)=>{const h=If(c);if(h==null)return;if(r){const f=this.getHighlightState(s,t,c.datumIndex);c.style=sp(this,c,t,f)}const d=c.style??n.styles[this.getHighlightState(o,t,c.datumIndex)],u=d.cornerRadius,p=d.fill,g=k.isGradientFill(p)&&p.bounds!=="item"?{centerX:0,centerY:0}:void 0;Gle(l,d,a,g),l.lineJoin="round",l.inset=l.stroke==null?0:l.strokeWidth/2,l.startInnerCornerRadius=h.reversed?u:0,l.startOuterCornerRadius=h.reversed?u:0,l.endInnerCornerRadius=h.reversed?0:u,l.endOuterCornerRadius=h.reversed?0:u,t&&(l.startAngle=c.startAngle,l.endAngle=c.endAngle,l.clipSector=c.clipSector,l.innerRadius=c.innerRadius,l.outerRadius=c.outerRadius)})}updateLabels(){const{properties:e}=this,t=this.ctx.highlightManager?.getActiveHighlight();this.labelSelection.update(this.nodeData).each((i,s)=>{jle(this,i,e,e.label,s.label,!1,t),i.fillOpacity=this.getHighlightStyle(!1,s.datumIndex).opacity??1})}getBarTransitionFunctions(){const e=this.axes[ar.Angle]?.scale;let t=0;if(!e)return O_(t);const i=Math.min(e.domain[0],e.domain[1]),s=Math.max(e.domain[0],e.domain[1]);return i<=0&&s>=0&&(t=e.convert(0)),O_(t)}animateEmptyUpdateReady(){const{labelSelection:e}=this,t=this.getBarTransitionFunctions();P_.fromToMotion(this.id,"datums",this.ctx.animationManager,[this.itemSelection],t),Ole(this,"labels",this.ctx.animationManager,e)}animateClearingUpdateEmpty(){const{itemSelection:e}=this,{animationManager:t}=this.ctx,i=this.getBarTransitionFunctions();P_.fromToMotion(this.id,"datums",t,[e],i),Ele(this,"labels",t,this.labelSelection)}getTooltipContent(e){const{id:t,dataModel:i,processedData:s,axes:n,properties:o}=this,{angleKey:a,angleName:r,radiusKey:l,radiusName:c,legendItemName:h,tooltip:d}=o,u=n[ar.Angle],p=n[ar.Radius],g=this.nodeData?.[e];if(!i||!s||!u||!p||!g)return;const f=s.dataSources.get(this.id)?.data[e],x=i.resolveKeysById(this,"radiusValue",s)[e],m=i.resolveColumnById(this,"angleValue-raw",s)[e];if(x==null)return;const v=sp(this,g,!1);return this.formatTooltipWithContext(d,{heading:this.getAxisValueText(p,"tooltip",x,f,l,void 0),symbol:this.legendItemSymbol(),data:[{label:r,fallbackLabel:a,value:this.getAxisValueText(u,"tooltip",m,f,a,void 0)}]},{seriesId:t,datum:f,title:r,angleKey:a,angleName:r,radiusKey:l,radiusName:c,legendItemName:h,...v})}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.itemSelection.nodes())}legendItemSymbol(){const{fill:e,stroke:t,fillOpacity:i,strokeOpacity:s,strokeWidth:n,lineDash:o,lineDashOffset:a}=JA(this,!1,!1,k.HighlightState.None),r={fill:e??"rgba(0, 0, 0, 0)",stroke:t??"rgba(0, 0, 0, 0)",fillOpacity:i,strokeOpacity:s,strokeWidth:n,lineDash:o,lineDashOffset:a};return Vle(r.fill)&&(r.fill={...r.fill,gradient:"linear",rotation:0,reverse:!1}),{marker:r}}getLegendData(e){if(e!=="category")return[];const{id:t,visible:i}=this,{angleKey:s,angleName:n,legendItemName:o,showInLegend:a}=this.properties;return[{legendType:"category",id:t,itemId:s,seriesId:t,enabled:i,label:{text:o??n??s},symbol:this.legendItemSymbol(),legendItemName:o,hideInLegend:!a}]}getDatumId(e){return zle(e.radiusValue)}computeLabelsBBox(){return null}getStackId(){return`radialBar-stack-${this.seriesGrouping?.groupIndex??this.id}-xValues`}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};nS.className="RadialBarSeries",nS.type="radial-bar";var{commonSeriesOptionsDefs:$le,radialBarSeriesThemeableOptionsDef:Ule}=k,Kle={...$le,...Ule,type:U(Ce("radial-bar")),angleKey:U(E),radiusKey:U(E),angleName:E,radiusName:E,legendItemName:E,grouped:G,stacked:G,stackGroup:E,normalizedTo:Z},{ThemeConstants:{POLAR_AXIS_TYPE:Yle},FILL_GRADIENT_CONIC_SERIES_DEFAULTS:Zle,FILL_IMAGE_DEFAULTS:Xle,FILL_PATTERN_DEFAULTS:qle}=k,Qle={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",Zle],["image",Xle],["pattern",qle]]},stroke:{$palette:"stroke"},strokeWidth:{$isUserOption:["./stroke",1,0]},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"}},highlight:k.multiSeriesHighlightStyle()},axes:{[Yle.RADIUS_CATEGORY]:{innerRadiusRatio:.2,groupPaddingInner:.2,paddingInner:.2,paddingOuter:.1}}},{POLAR_AXIS_TYPE:R_}=k.ThemeConstants,Jle={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radial-bar",moduleFactory:e=>new nS(e),defaultAxes:[{type:R_.ANGLE_NUMBER},{type:R_.RADIUS_CATEGORY}],themeTemplate:Qle,stackable:!0,groupable:!0},ece={type:"series",name:"radial-bar",chartType:"polar",enterprise:!0,options:Kle,create:e=>new nS(e)},{Property:z_}=k,lC=class extends li{};y([z_],lC.prototype,"columnWidthRatio",2),y([z_],lC.prototype,"maxColumnWidthRatio",2);var{ChartAxisDirection:tce,PolarAxis:ice,RadialColumnShape:sce,getRadialColumnWidth:nce}=k,oS=class extends c_{constructor(e){super(e,{animationResetFns:{item:Yae}}),this.properties=new lC}getStackId(){return`radarColumn-stack-${this.seriesGrouping?.groupIndex??this.id}-yValues`}nodeFactory(){return new sce}getColumnTransitionFunctions(){const e=this.isRadiusAxisReversed()?this.radius:this.getAxisInnerRadius();return Kae(e)}isRadiusAxisCircle(){const e=this.axes[tce.Radius];return e instanceof ice?e.shape==="circle":!1}updateItemPath(e,t,i){e.isBeveled=this.isRadiusAxisCircle(),e.isRadiusAxisReversed=this.isRadiusAxisReversed(),i&&(e.innerRadius=t.innerRadius,e.outerRadius=t.outerRadius,e.startAngle=t.startAngle,e.endAngle=t.endAngle,e.columnWidth=t.columnWidth,e.axisInnerRadius=t.axisInnerRadius,e.axisOuterRadius=t.axisOuterRadius)}getColumnWidth(e,t){const{columnWidthRatio:i=.5,maxColumnWidthRatio:s=.5}=this.properties;return nce(e,t,this.radius,i,s)}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.styler!=null||this.properties.label.itemStyler!=null}};oS.className="RadialColumnSeries",oS.type="radial-column";var{commonSeriesOptionsDefs:oce,radialColumnSeriesThemeableOptionsDef:ace}=k,rce={...oce,...ace,type:U(Ce("radial-column")),angleKey:U(E),radiusKey:U(E),angleName:E,radiusName:E,legendItemName:E,grouped:G,stacked:G,stackGroup:E,normalizedTo:Z},{ThemeConstants:{POLAR_AXIS_TYPE:F_,POLAR_AXIS_SHAPE:B_},FILL_GRADIENT_RADIAL_SERIES_DEFAULTS:lce,FILL_IMAGE_DEFAULTS:cce,FILL_PATTERN_DEFAULTS:hce}=k,dce={series:{fill:{$applySwitch:[{$path:"type"},{$palette:"fill"},["gradient",lce],["image",cce],["pattern",hce]]},stroke:{$palette:"stroke"},columnWidthRatio:.5,maxColumnWidthRatio:.5,strokeWidth:{$isUserOption:["./stroke",1,0]},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},highlight:k.multiSeriesHighlightStyle()},axes:{[F_.ANGLE_CATEGORY]:{shape:{$findFirstSiblingNotOperation:B_.CIRCLE},groupPaddingInner:0,paddingInner:0,label:{spacing:10}},[F_.RADIUS_NUMBER]:{shape:{$findFirstSiblingNotOperation:B_.CIRCLE},innerRadiusRatio:.5}}},{POLAR_AXIS_TYPE:__}=k.ThemeConstants,uce={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["polar"],identifier:"radial-column",moduleFactory:e=>new oS(e),defaultAxes:[{type:__.ANGLE_CATEGORY},{type:__.RADIUS_NUMBER}],themeTemplate:dce,stackable:!0,groupable:!0},pce={type:"series",name:"radial-column",chartType:"polar",enterprise:!0,options:rce,create:e=>new oS(e)},{SvgPath:gce,Rotatable:fce,Translatable:yce,Scalable:mce}=k,cC=class extends fce(mce(yce(gce))){constructor(){super(...arguments),this.scalingCenterX=.5,this.scalingCenterY=.5,this.rotationCenterX=.5,this.rotationCenterY=.5}};cC.defaultPathData="M0.50245 0.53745C0.481767 0.53745 0.465 0.520683 0.465 0.5C0.465 0.479317 0.481767 0.46255 0.50245 0.46255L1 0.500012L0.50245 0.53745Z";var{getColorStops:xce,normalizeAngle360:bce,normalizeAngle360Inclusive:vce,toDegrees:Sce}=k,{BaseProperties:Zf,makeSeriesTooltip:Mce,SeriesProperties:Dce,PropertiesArray:hC,AxisLabel:kce,Property:fe,Label:Ice}=k,V_=class extends Ice{};y([fe],V_.prototype,"spacing",2);var Os=class extends Zf{constructor(){super(...arguments),this.label=new V_}getStyle(){const{fill:e="black",fillOpacity:t=1,stroke:i="black",strokeWidth:s=0,strokeOpacity:n=1,lineDash:o=[0],lineDashOffset:a=0}=this;return{fill:e,fillOpacity:t,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:o,lineDashOffset:a}}};y([fe],Os.prototype,"text",2),y([fe],Os.prototype,"value",2),y([fe],Os.prototype,"shape",2),y([fe],Os.prototype,"placement",2),y([fe],Os.prototype,"spacing",2),y([fe],Os.prototype,"size",2),y([fe],Os.prototype,"rotation",2),y([fe],Os.prototype,"fill",2),y([fe],Os.prototype,"fillOpacity",2),y([fe],Os.prototype,"stroke",2),y([fe],Os.prototype,"strokeWidth",2),y([fe],Os.prototype,"strokeOpacity",2),y([fe],Os.prototype,"lineDash",2),y([fe],Os.prototype,"lineDashOffset",2),y([fe],Os.prototype,"label",2);var ya=class extends Zf{constructor(){super(...arguments),this.enabled=!0,this.fills=new hC(k.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(e,t){const{enabled:i,fill:s,fills:n,fillMode:o,fillOpacity:a,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}=this;return{fill:i?s??H_(n,o,e,t):"none",fillOpacity:a,stroke:r,strokeWidth:l,strokeOpacity:c,lineDash:h,lineDashOffset:d}}};y([fe],ya.prototype,"enabled",2),y([fe],ya.prototype,"fills",2),y([fe],ya.prototype,"fillMode",2),y([fe],ya.prototype,"fill",2),y([fe],ya.prototype,"fillOpacity",2),y([fe],ya.prototype,"stroke",2),y([fe],ya.prototype,"strokeWidth",2),y([fe],ya.prototype,"strokeOpacity",2),y([fe],ya.prototype,"lineDash",2),y([fe],ya.prototype,"lineDashOffset",2);var Xf=class extends Zf{constructor(){super(...arguments),this.values=void 0,this.step=void 0,this.minSpacing=0,this.maxSpacing=1e3}};y([fe],Xf.prototype,"values",2),y([fe],Xf.prototype,"step",2),y([fe],Xf.prototype,"minSpacing",2),y([fe],Xf.prototype,"maxSpacing",2);var Ace=class extends kce{},dn=class extends Zf{constructor(){super(...arguments),this.min=0,this.max=1,this.fills=new hC(k.StopProperties),this.fillMode="continuous",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.defaultFill="black",this.interval=new Xf,this.label=new Ace}getStyle(e,t,i){const{fill:s,fills:n,defaultFill:o,fillMode:a,fillOpacity:r,stroke:l,strokeWidth:c,strokeOpacity:h,lineDash:d,lineDashOffset:u}=this;return{fill:s??(e&&n.length===0?o:void 0)??H_(n,a,t,i),fillOpacity:r,stroke:l,strokeWidth:c,strokeOpacity:h,lineDash:d,lineDashOffset:u}}};y([fe],dn.prototype,"min",2),y([fe],dn.prototype,"max",2),y([fe],dn.prototype,"fills",2),y([fe],dn.prototype,"fillMode",2),y([fe],dn.prototype,"fill",2),y([fe],dn.prototype,"fillOpacity",2),y([fe],dn.prototype,"stroke",2),y([fe],dn.prototype,"strokeWidth",2),y([fe],dn.prototype,"strokeOpacity",2),y([fe],dn.prototype,"lineDash",2),y([fe],dn.prototype,"lineDashOffset",2),y([fe],dn.prototype,"defaultFill",2),y([fe],dn.prototype,"interval",2),y([fe],dn.prototype,"label",2);var ma=class extends Zf{constructor(){super(...arguments),this.enabled=!0,this.spacing=0,this.fill="black",this.fillOpacity=1,this.stroke="black",this.strokeWidth=0,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}};y([fe],ma.prototype,"enabled",2),y([fe],ma.prototype,"radiusRatio",2),y([fe],ma.prototype,"spacing",2),y([fe],ma.prototype,"fill",2),y([fe],ma.prototype,"fillOpacity",2),y([fe],ma.prototype,"stroke",2),y([fe],ma.prototype,"strokeWidth",2),y([fe],ma.prototype,"strokeOpacity",2),y([fe],ma.prototype,"lineDash",2),y([fe],ma.prototype,"lineDashOffset",2);var G_=class extends Qa{};y([fe],G_.prototype,"text",2);var j_=class extends Of{};y([fe],j_.prototype,"text",2);var Mi=class extends Dce{constructor(){super(...arguments),this.startAngle=0,this.endAngle=0,this.segmentation=new Hf,this.defaultColorRange=[],this.targets=new hC(Os),this.defaultTarget=new Os,this.outerRadiusRatio=1,this.innerRadiusRatio=1,this.cornerRadius=0,this.cornerMode="container",this.spacing=0,this.scale=new dn,this.bar=new ya,this.needle=new ma,this.label=new G_,this.secondaryLabel=new j_,this.tooltip=Mce()}};y([fe],Mi.prototype,"value",2),y([fe],Mi.prototype,"startAngle",2),y([fe],Mi.prototype,"endAngle",2),y([fe],Mi.prototype,"segmentation",2),y([fe],Mi.prototype,"defaultColorRange",2),y([fe],Mi.prototype,"targets",2),y([fe],Mi.prototype,"defaultTarget",2),y([fe],Mi.prototype,"outerRadiusRatio",2),y([fe],Mi.prototype,"innerRadiusRatio",2),y([fe],Mi.prototype,"outerRadius",2),y([fe],Mi.prototype,"innerRadius",2),y([fe],Mi.prototype,"cornerRadius",2),y([fe],Mi.prototype,"cornerMode",2),y([fe],Mi.prototype,"spacing",2),y([fe],Mi.prototype,"scale",2),y([fe],Mi.prototype,"bar",2),y([fe],Mi.prototype,"needle",2),y([fe],Mi.prototype,"label",2),y([fe],Mi.prototype,"secondaryLabel",2),y([fe],Mi.prototype,"tooltip",2);function H_(e,t,i,s){const{domain:n,range:o}=s,[a,r]=o,l=bce((a+r)/2+Math.PI),c=vce(r-a);return{type:"gradient",gradient:"conic",colorSpace:"oklch",colorStops:xce(e,i,n,t).map(({color:d,stop:u})=>(u=Math.min(Math.max(u,0),1),u=(a+c*u-l)/(2*Math.PI),u=(u%1+1)%1,{stop:u,color:d})),bounds:"series",rotation:Sce(l)+90}}var{SectorBox:dC}=k;function Cce(e){const{startAngle:t,endAngle:i,clipStartAngle:s,clipEndAngle:n,innerRadius:o,outerRadius:a}=e;if(!(s==null||n==null))return new dC(Math.max(s,t),Math.min(n,i),o,a)}function W_(e,t,i){return Math.max(e,i.startAngle)<=Math.min(t,i.endAngle)}function uC(e){return e.clipStartAngle!=null&&e.clipEndAngle!=null}function pC(e,t){const{clipStartAngle:i,clipEndAngle:s,innerRadius:n,outerRadius:o}=e;return new dC(i,t?i:s,n,o)}function $_(e,t){const i=e?"initial":"update";return{node:{fromFn(o,a){const r=o.previousDatum;let{startAngle:l,endAngle:c}=r??a;const h=r!=null&&uC(r)?pC(r,e):void 0,d=uC(a)?pC(a,e):void 0;let u;return h!=null&&d!=null?u=h:h==null&&d!=null?(u=d,l=a.startAngle,c=a.endAngle):h!=null&&d==null?(u=void 0,l=a.startAngle,c=a.endAngle):e&&(c=l),{startAngle:l,endAngle:c,clipSector:u,phase:i}},toFn(o,a){const{startAngle:r,endAngle:l}=a;let c;return uC(a)&&(c=pC(a,!1)),{startAngle:r,endAngle:l,clipSector:c}},applyFn(o,a){const{startAngle:r,endAngle:l}=a;let{clipSector:c}=a;c!=null&&(c=new dC(Math.max(r,c.startAngle),Math.min(l,c.endAngle),c.innerRadius,c.outerRadius));const h=c==null||W_(r,l,c);o.startAngle=r,o.endAngle=l,o.clipSector=c,o.visible=h}},needle:{fromFn(o){let{angle:a}=o.previousDatum??o.datum;return e&&(a=t),{rotation:a,phase:i}},toFn(o,a){const{angle:r}=a;return{rotation:r}}}}}function gC(e,t){const{startAngle:i,endAngle:s}=t,n=Cce(t),o=n==null||W_(i,s,n);return{startAngle:i,endAngle:s,clipSector:n,visible:o}}function U_(e,t){const{angle:i}=t;return{rotation:i}}var Lce={top:0,middle:.5,bottom:1};function Tce(e,t,i,s,n,o){const{padding:a,textAlign:r,verticalAlign:l}=s;let c,h;if(i.each((D,L)=>{L.label==="primary"?c=L:L.label==="secondary"&&(h=L)}),c==null)return;const d=jf(e.id,t,c,o?.label);if(d==null)return;const u=h==null?void 0:jf(e.id,t,h,o?.secondaryLabel),p={padding:a},g=r==="center"?2:1,f=l==="middle"?2:1,x=D=>({width:Math.sqrt(Math.max(n**2-(D/f)**2,0))*g,height:Math.min(D,f*n),meta:null});let m,v,b;if(h!=null&&u!=null){const D=pz($e(d),c,$e(u),h,p,x);m=D?.label,v=D?.secondaryLabel,b=D?.height??0}else{const D=wf($e(d),c,p,x);m=D?.[0],v=void 0,b=D?.[0].height??0}const S=b*Lce[l];i.each((D,L)=>{let I;if(L.label==="primary"?I=m:L.label==="secondary"&&(I=v),I==null){D.visible=!1;return}D.visible=!0,D.text=I.text,D.fontSize=I.fontSize,D.lineHeight=I.lineHeight,D.textAlign=r,D.textBaseline="middle";const A=L.label==="primary"?I.height/2:b-I.height/2;D.y=L.centerY+A-S,D.x=L.centerX})}var{fromToMotion:qf,resetMotion:K_,SeriesNodePickMode:Y_,StateMachine:wce,createDatumId:fC,normalizeAngle360:Nce,normalizeAngle360Inclusive:Z_,isBetweenAngles:aS,sectorBox:Oce,toRadians:rS,BBox:Ece,Group:gc,PointerEvents:lS,Selection:fc,Sector:Pce,SectorBox:Rce,Text:X_,Marker:zce,tickFormat:Fce,applyShapeStyle:cS,mergeDefaults:Bce}=k,_ce={inside:90,middle:0,outside:-90},Vce=[{textAlign:"left",textBaseline:"top"},{textAlign:"right",textBaseline:"top"},{textAlign:"right",textBaseline:"bottom"},{textAlign:"left",textBaseline:"bottom"}],Gce=[{textAlign:"right",textBaseline:"bottom"},{textAlign:"left",textBaseline:"bottom"},{textAlign:"left",textBaseline:"top"},{textAlign:"right",textBaseline:"top"}],hS=class extends k.Series{constructor(e){super({moduleCtx:e,pickModes:[Y_.EXACT_SHAPE_MATCH,Y_.NEAREST_NODE]}),this.centerX=0,this.centerY=0,this.radius=0,this.textAlign="center",this.verticalAlign="middle",this.properties=new Mi,this.scale=new NE,this.scaleGroup=this.contentGroup.appendChild(new gc({name:"scaleGroup"})),this.itemGroup=this.contentGroup.appendChild(new gc({name:"itemGroup"})),this.itemNeedleGroup=this.contentGroup.appendChild(new gc({name:"itemNeedleGroup"})),this.itemTargetGroup=this.contentGroup.appendChild(new gc({name:"itemTargetGroup"})),this.itemTargetLabelGroup=this.contentGroup.appendChild(new gc({name:"itemTargetLabelGroup"})),this.itemLabelGroup=this.contentGroup.appendChild(new gc({name:"itemLabelGroup"})),this.highlightTargetGroup=this.highlightGroup.appendChild(new gc({name:"itemTargetLabelGroup"})),this.tickGroup=this.contentGroup.appendChild(new gc({name:"tickGroup"})),this.scaleSelection=fc.select(this.scaleGroup,()=>this.nodeFactory()),this.datumSelection=fc.select(this.itemGroup,()=>this.nodeFactory()),this.needleSelection=fc.select(this.itemNeedleGroup,cC),this.targetSelection=fc.select(this.itemTargetGroup,()=>this.markerFactory()),this.targetLabelSelection=fc.select(this.itemTargetLabelGroup,X_),this.labelSelection=fc.select(this.itemLabelGroup,X_),this.highlightTargetSelection=fc.select(this.highlightTargetGroup,()=>this.markerFactory()),this.tickSelection=fc.select(this.tickGroup,k.TransformableText),this.datumUnion=new vB,this.animationState=new wce("empty",{empty:{update:{target:"ready",action:()=>this.animateEmptyUpdateReady()},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",resize:()=>this.animateReadyResize(),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:()=>this.animateWaitingUpdateReady()},reset:"empty",skip:"ready"},clearing:{update:{target:"empty"},reset:"empty",skip:"ready"}}),this.scaleGroup.pointerEvents=lS.None,this.tickGroup.pointerEvents=lS.None,this.itemNeedleGroup.pointerEvents=lS.None,this.itemLabelGroup.pointerEvents=lS.None}get hasData(){return this.properties.value!=null}nodeFactory(){return new Pce}markerFactory(){const e=new zce;return e.size=1,e}processData(){this.nodeDataRefresh=!0,this.animationState.transition("updateData")}formatLabel(e){const{min:t,max:i}=this.properties.scale;return MB(e,{min:t,max:i})}layoutScale(){const{scale:e,properties:t}=this,{seriesRectWidth:i,seriesRectHeight:s}=this.nodeDataDependencies,{scale:n,outerRadius:o}=this.properties,{min:a,max:r,label:l,interval:c}=n,h=rS(t.startAngle-90),d=rS(t.endAngle-90),p=Z_(d-h)>Math.PI,g=p||aS(1.5*Math.PI,h,d),f=p||aS(0*Math.PI,h,d),x=p||aS(.5*Math.PI,h,d),m=p||aS(1*Math.PI,h,d);let v;m&&!f?v="right":!m&&f?v="left":v="center";let b;g&&!x?b="bottom":!g&&x?b="top":b="middle";const S=Oce({startAngle:h,endAngle:d,innerRadius:0,outerRadius:.5}),D=-(S.x+S.width/2)*2,L=-(S.y+S.height/2)*2,I=Math.min(i/S.width,s/S.height);e.domain=[a,r],e.range=[h,d],e.arcLength=I/2;const{maxSpacing:A,minSpacing:T}=c,{arcLength:w}=e,N=A?Math.floor(w/A):1,O=T?Math.floor(w/T):1/0,P=Math.floor(4/Math.PI*Math.abs(e.range[0]-e.range[1])),F=Math.max(N,Math.min(O,P)),_=c.values??e.ticks({nice:!1,interval:c.step,minTickCount:N,maxTickCount:O,tickCount:F})?.ticks??[],z=Fce(_,typeof l.format=="string"?l.format:void 0),B=Je(l),R=_.map((se,X)=>{let Q;if(l.formatter&&(Q=_f(this.ctx,l.formatter,{value:se,index:X,domain:e.domain,boundSeries:void 0})),Q??(Q=z?.(se)),Q==null)return;const{width:ie,height:q}=Ne(Q)?On(Q,l):B.measureLines(Q);return{index:X,value:se,text:Q,width:ie,height:q}}).filter(se=>se!=null),V=R.reduce((se,X)=>Math.max(se,X.width),0),j=R.reduce((se,X)=>Math.max(se,X.height),0),$=l.enabled?Math.max(V,j)+l.spacing:0,W=Math.max(.5*I-$,0),Y=o??W;return this.centerX=i/2+D*Y,this.centerY=s/2+L*Y,this.radius=Y,this.textAlign=v,this.verticalAlign=b,R}getShapeFillBBox(){const{centerX:e,centerY:t,radius:i}=this,s=new Ece(e-i,t-i,2*i,2*i);return{series:s,axis:s}}getTargets(){const{properties:e}=this,t=e.defaultTarget;return Array.from(e.targets).map(i=>{const{text:s=t.text,value:n=t.value??0,shape:o=t.shape??"triangle",rotation:a=t.rotation??0,placement:r=t.placement??"middle",spacing:l=t.spacing??0,size:c=t.size??0}=i,{enabled:h=t.label.enabled,color:d=t.label.color??"black",fontStyle:u=t.label.fontStyle??"normal",fontWeight:p=t.label.fontWeight??"normal",fontSize:g=t.label.fontSize,fontFamily:f=t.label.fontFamily,spacing:x=t.label.spacing??0}=i.label;return{text:s,value:n,shape:o,placement:r,spacing:l,size:c,rotation:a,label:{enabled:h,color:d,fontStyle:u,fontWeight:p,fontSize:g,fontFamily:f,spacing:x},style:i.getStyle()}})}getTargetRadius(e){const{radius:t,properties:i}=this,{innerRadiusRatio:s,outerRadiusRatio:n}=i,{placement:o,spacing:a,size:r}=e,l=t*n,c=t*s;switch(o){case"inside":return Math.max(c-a-r/2,0);case"outside":return l+a+r/2;default:return(c+l)/2}}getTargetLabel(e){const{scale:t}=this,{value:i,size:s,placement:n,label:o}=e,{spacing:a,color:r,fontStyle:l,fontWeight:c,fontSize:h,fontFamily:d}=o,u=void 0,p=t.convert(i),g=Math.trunc(Nce(p)/(Math.PI/2)),f=s/2+a;let x,m,v,b;switch(n){case"outside":({textAlign:x,textBaseline:m}=Vce[g]),v=f*Math.cos(p),b=f*Math.sin(p);break;case"inside":({textAlign:x,textBaseline:m}=Gce[g]),v=-f*Math.cos(p),b=-f*Math.sin(p);break;default:x="center",m="bottom",v=0,b=-f;break}return{offsetX:v,offsetY:b,fill:r,textAlign:x,textBaseline:m,fontStyle:l,fontWeight:c,fontSize:h,fontFamily:d,lineHeight:u}}createNodeData(){const e=this.layoutScale(),{id:t,scale:i,properties:s,radius:n,centerX:o,centerY:a}=this,{value:r,innerRadiusRatio:l,outerRadiusRatio:c,segmentation:h,cornerRadius:d,cornerMode:u,needle:p,bar:g,scale:f,label:x,secondaryLabel:m}=s,{outerRadius:v=n*c,innerRadius:b=n*l,defaultColorRange:S}=s,D=this.getTargets(),L=[],I=[],A=[],T=[],w=[],N=u==="item",O=i.convert(i.domain[0]),P=i.convert(r),F=Math.ceil(Z_(P-O)*n);let _=h.enabled?h.interval.getSegments(i,F):void 0;const z=g.getStyle(S,i),B=f.getStyle(g.enabled,S,i);if(_==null&&N){const R=Math.min(...i.domain),V=Math.max(...i.domain),j={value:r,segmentStart:R,segmentEnd:V},W=Math.min(d,(v-b)/2)/((b+v)/2);L.push({series:this,itemId:"value",datum:j,datumIndex:{type:0},type:0,centerX:o,centerY:a,outerRadius:v,innerRadius:b,startAngle:O-W,endAngle:P+W,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:d,endCornerRadius:d,style:z}),w.push({series:this,itemId:"scale",datum:j,datumIndex:{type:0},type:0,centerX:o,centerY:a,outerRadius:v,innerRadius:b,startAngle:i.range[0]-W,endAngle:i.range[1]+W,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:d,endCornerRadius:d,style:B})}else{_??(_=i.domain);for(let R=0;R<_.length-1;R++){const V=_[R],j=_[R+1],$={value:r,segmentStart:V,segmentEnd:j},W=R===0,Y=R===_.length-2,se=i.convert(V),X=i.convert(j);L.push({series:this,itemId:`value-${R}`,datum:$,datumIndex:{type:0},type:0,centerX:o,centerY:a,outerRadius:v,innerRadius:b,startAngle:se,endAngle:X,clipStartAngle:O,clipEndAngle:P,startCornerRadius:N||W?d:0,endCornerRadius:N||Y?d:0,style:z}),w.push({series:this,itemId:`scale-${R}`,datum:$,datumIndex:{type:0},type:0,centerX:o,centerY:a,outerRadius:v,innerRadius:b,startAngle:se,endAngle:X,clipStartAngle:void 0,clipEndAngle:void 0,startCornerRadius:N||W?d:0,endCornerRadius:N||Y?d:0,style:B})}}if(!p.enabled&&x.enabled){const{text:R,color:V,fontSize:j,minimumFontSize:$,fontStyle:W,fontWeight:Y,fontFamily:se,lineHeight:X,formatter:Q=ie=>this.formatLabel(ie.value)}=x;T.push({label:"primary",centerX:o,centerY:a,text:R,value:r,fill:V,fontSize:j,minimumFontSize:$,fontStyle:W,fontWeight:Y,fontFamily:se,lineHeight:X,formatter:Q})}if(!p.enabled&&m.enabled){const{text:R,color:V,fontSize:j,minimumFontSize:$,fontStyle:W,fontWeight:Y,fontFamily:se,lineHeight:X,formatter:Q}=m;T.push({label:"secondary",centerX:o,centerY:a,text:R,value:r,fill:V,fontSize:j,minimumFontSize:$,fontStyle:W,fontWeight:Y,fontFamily:se,lineHeight:X,formatter:Q})}if(p.enabled){let R=p.radiusRatio==null?b:n*p.radiusRatio;R=Math.max(R-p.spacing,0);const V=i.convert(r);A.push({centerX:o,centerY:a,radius:R,angle:V,series:this})}for(let R=0;RMath.max(...i.domain))continue;const X=this.getTargetRadius(V),Q=i.convert(j),ie=rS(V.rotation+_ce[V.placement]);I.push({series:this,itemId:`target-${R}`,midPoint:{x:X*Math.cos(Q)+o,y:X*Math.sin(Q)+a},datum:{value:j},datumIndex:{type:1,index:R},type:1,value:j,text:$,centerX:o,centerY:a,shape:Y,radius:X,angle:Q,rotation:ie,size:W,label:this.getTargetLabel(V),style:se})}return{itemId:t,nodeData:L,needleData:A,targetData:I,labelData:T,scaleData:w,tickData:e}}updateSelections(e){(this.nodeDataRefresh||e)&&(this.contextNodeData=this.createNodeData(),this.nodeDataRefresh=!1)}highlightDatum(e){if(e!=null&&e.series===this&&e.type===1)return e}update({seriesRect:e}){const{datumSelection:t,labelSelection:i,needleSelection:s,targetSelection:n,targetLabelSelection:o,scaleSelection:a,highlightTargetSelection:r,tickSelection:l}=this,c=this.checkResize(e);this.updateSelections(c),this.contentGroup.visible=this.visible,this.contentGroup.opacity=this.getOpacity();const h=this.contextNodeData?.nodeData??[],d=this.contextNodeData?.labelData??[],u=this.contextNodeData?.needleData??[],p=this.contextNodeData?.targetData??[],g=this.contextNodeData?.scaleData??[],f=this.contextNodeData?.tickData??[],x=this.highlightDatum(this.ctx.highlightManager.getActiveHighlight());this.scaleSelection=this.updateScaleSelection({scaleData:g,scaleSelection:a}),this.updateScaleNodes({scaleSelection:a}),this.needleSelection=this.updateNeedleSelection({needleData:u,needleSelection:s}),this.updateNeedleNodes({needleSelection:s}),this.targetSelection=this.updateTargetSelection({targetData:p,targetSelection:n}),this.updateTargetStyles({targetSelection:n,isHighlight:!1}),this.updateTargetNodes({targetSelection:n}),this.targetLabelSelection=this.updateTargetLabelSelection({targetData:p,targetLabelSelection:o}),this.updateTargetLabelNodes({targetLabelSelection:o}),this.datumSelection=this.updateDatumSelection({nodeData:h,datumSelection:t}),this.updateDatumNodes({datumSelection:t}),this.labelSelection=this.updateLabelSelection({labelData:d,labelSelection:i}),this.updateLabelNodes({labelSelection:i}),this.highlightTargetSelection=this.updateTargetSelection({targetData:x==null?[]:[x],targetSelection:r}),this.updateTargetStyles({targetSelection:r,isHighlight:!0}),this.updateTargetNodes({targetSelection:r}),this.tickSelection=this.updateTickSelection({tickData:f,tickSelection:l}),this.updateTickNodes({tickSelection:l}),c&&this.animationState.transition("resize"),this.animationState.transition("update")}updateDatumSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>fC(e.nodeData.length,t.itemId))}updateDatumNodes(e){const{datumSelection:t}=e,{ctx:i,properties:s}=this,{segmentation:n}=s,o=n.spacing??0,a=i.animationManager.isSkipped(),r=this.getShapeFillBBox();t.each((l,c)=>{const{centerX:h,centerY:d,innerRadius:u,outerRadius:p,startCornerRadius:g,endCornerRadius:f}=c;l.centerX=h,l.centerY=d,l.innerRadius=u,l.outerRadius=p,l.pointerEvents=this.properties.bar.enabled?k.PointerEvents.All:k.PointerEvents.None,cS(l,c.style,r),l.startOuterCornerRadius=g,l.startInnerCornerRadius=g,l.endOuterCornerRadius=f,l.endInnerCornerRadius=f,l.radialEdgeInset=(o+l.strokeWidth)/2,l.concentricEdgeInset=l.strokeWidth/2,(a||l.previousDatum==null)&&l.setProperties(gC(l,c))}),this.datumUnion.update(t,this.itemGroup,k.Sector,(l,c,h)=>{l.clipSector??(l.clipSector=new Rce(Number.NaN,Number.NaN,Number.NaN,Number.NaN)),l.centerX=c.centerX,l.centerY=c.centerY,l.outerRadius=l.clipSector.outerRadius=c.outerRadius,l.innerRadius=l.clipSector.innerRadius=c.innerRadius,l.startAngle=l.clipSector.startAngle=c.startAngle,l.startInnerCornerRadius=c.startInnerCornerRadius,l.startOuterCornerRadius=c.startOuterCornerRadius,l.endAngle=h.endAngle,l.clipSector.endAngle=h.clipSector?.endAngle??h.endAngle,l.endInnerCornerRadius=h.endInnerCornerRadius,l.endOuterCornerRadius=h.endOuterCornerRadius,l.pointerEvents=k.PointerEvents.None})}updateScaleSelection(e){return e.scaleSelection.update(e.scaleData,void 0,t=>fC(e.scaleData.length,t.itemId))}updateScaleNodes(e){const{scaleSelection:t}=e,{segmentation:i}=this.properties,s=i.spacing??0,n=this.getShapeFillBBox();t.each((o,a)=>{const{centerX:r,centerY:l,innerRadius:c,outerRadius:h,startCornerRadius:d,endCornerRadius:u}=a;o.centerX=r,o.centerY=l,o.innerRadius=c,o.outerRadius=h,cS(o,a.style,n),o.startOuterCornerRadius=d,o.startInnerCornerRadius=d,o.endOuterCornerRadius=u,o.endInnerCornerRadius=u,o.radialEdgeInset=(s+o.strokeWidth)/2,o.concentricEdgeInset=o.strokeWidth/2,o.setProperties(gC(o,a))})}updateNeedleSelection(e){return e.needleSelection.update(e.needleData,void 0,()=>fC(0))}updateNeedleNodes(e){const{needleSelection:t}=e,{fill:i,fillOpacity:s,stroke:n,strokeOpacity:o,strokeWidth:a,lineDash:r,lineDashOffset:l}=this.properties.needle,c=this.ctx.animationManager.isSkipped();t.each((h,d)=>{const{centerX:u,centerY:p,radius:g}=d,f=g*2;h.d=cC.defaultPathData,cS(h,{fill:i,fillOpacity:s,stroke:n,strokeOpacity:o,strokeWidth:a/f,lineDash:r.map(x=>x/f),lineDashOffset:l/f}),h.translationX=u,h.translationY=p,h.scalingX=f,h.scalingY=f,c&&h.setProperties(U_(h,d))})}updateTargetSelection(e){return e.targetSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetStyles({targetSelection:e,isHighlight:t}){e.each((i,s)=>{s.style=this.getTargetStyle(t,s)})}updateTargetNodes({targetSelection:e}){e.each((t,i)=>{const{centerX:s,centerY:n,angle:o,radius:a,shape:r,size:l,rotation:c}=i;cS(t,i.style),t.size=l,t.shape=r==="line"?DB:r,t.translationX=s+a*Math.cos(o),t.translationY=n+a*Math.sin(o),t.rotation=o+c})}getTargetStyle(e,{datumIndex:t,style:i}){const s=this.getHighlightStyle(e,t);return Bce(s,{...i,opacity:1})}updateTargetLabelSelection(e){return e.targetLabelSelection.update(e.targetData,void 0,t=>t.itemId)}updateTargetLabelNodes(e){const{targetLabelSelection:t}=e;t.each((i,s)=>{const{centerX:n,centerY:o,radius:a,angle:r,text:l}=s,{offsetX:c,offsetY:h,fill:d,fontStyle:u,fontWeight:p,fontSize:g,fontFamily:f,textAlign:x,textBaseline:m}=s.label;if(l==null){i.visible=!1;return}i.visible=!0,i.x=n+a*Math.cos(r)+c,i.y=o+a*Math.sin(r)+h,i.text=l,i.fill=d,i.fontStyle=u,i.fontWeight=p,i.fontSize=g,i.fontFamily=f,i.textAlign=x,i.textBaseline=m})}updateLabelSelection(e){return e.labelSelection.update(e.labelData,void 0,t=>t.label)}updateLabelNodes(e){const{labelSelection:t}=e,i=this.ctx.animationManager.isSkipped();t.each((s,n)=>{s.fill=n.fill,s.fontStyle=n.fontStyle,s.fontWeight=n.fontWeight,s.fontFamily=n.fontFamily}),(i||this.labelsHaveExplicitText())&&this.formatLabelText()}updateTickSelection(e){return e.tickSelection.update(e.tickData,void 0,t=>t.index)}updateTickNodes(e){const{scale:t,radius:i,centerX:s,centerY:n,properties:o}=this,{enabled:a,color:r,fontFamily:l,fontSize:c,fontStyle:h,fontWeight:d,spacing:u}=o.scale.label,p=rS(o.scale.label.rotation??0);e.tickSelection.each((g,f)=>{if(!a){g.visible=!1;return}g.visible=!0,g.text=f.text,g.fill=r,g.fontFamily=l,g.fontSize=c,g.fontStyle=h,g.fontWeight=d,g.textAlign="center",g.textBaseline="middle";const x=t.convert(f.value),{width:m,height:v}=f,b=Math.abs(i*Math.cos(x)),S=Math.abs(i*Math.sin(x)),D=Math.min(Math.max(Math.abs(i/Math.tan(x)),b-m/2),b+m/2),L=Math.min(Math.max(Math.abs(i*Math.tan(x)),S-v/2),S+v/2),I=Math.hypot(D,L),A=s+(I+u)*Math.cos(x),T=n+(I+u)*Math.sin(x);g.x=A,g.y=T,g.rotationCenterX=A,g.rotationCenterY=T,g.rotation=p})}labelsHaveExplicitText(){for(const{datum:e}of this.labelSelection)if(e.text==null)return!1;return!0}formatLabelText(e){const{labelSelection:t,radius:i,textAlign:s,verticalAlign:n}=this,{spacing:o,innerRadiusRatio:a}=this.properties;Tce(this,this.ctx,t,{padding:o,textAlign:s,verticalAlign:n},i*a,e)}resetAllAnimation(){this.ctx.animationManager.stopByAnimationGroupId(this.id),K_([this.datumSelection],gC),K_([this.needleSelection],U_),this.formatLabelText()}resetAnimation(e){e==="initial"?this.animationState.transition("reset"):e==="ready"&&this.animationState.transition("skip")}animateLabelText(e={}){const{animationManager:t}=this.ctx;let i,s,n,o;if(this.labelSelection.each((a,r)=>{a.opacity=1,r.label==="primary"?(i=a.previousDatum?.value??e.from??r.value,s=r.value):r.label==="secondary"&&(n=a.previousDatum?.value??e.from??r.value,o=r.value)}),!this.labelsHaveExplicitText())if(s==null||o==null)this.formatLabelText();else if(i===s&&n===o)this.formatLabelText({label:s,secondaryLabel:o});else{const a=`${this.id}_labels`;t.animate({id:a,groupId:"label",from:{label:i,secondaryLabel:n},to:{label:s,secondaryLabel:o},phase:e.phase??"update",onUpdate:r=>this.formatLabelText(r),onStop:()=>this.formatLabelText({label:s,secondaryLabel:o})})}}animateEmptyUpdateReady(){const{animationManager:e}=this.ctx,{node:t,needle:i}=$_(!0,this.scale.range[0]);qf(this.id,"node",e,[this.datumSelection],t,(s,n)=>n.itemId),qf(this.id,"needle",e,[this.needleSelection],i,()=>"needle"),qf(this.id,"label",e,[this.labelSelection],SB,(s,n)=>n.label),this.animateLabelText({from:this.properties.scale.min,phase:"initial"})}animateWaitingUpdateReady(){const{animationManager:e}=this.ctx,{node:t,needle:i}=$_(!1,this.scale.range[0]);qf(this.id,"node",e,[this.datumSelection],t,(s,n)=>n.itemId),qf(this.id,"needle",e,[this.needleSelection],i,()=>"needle"),this.animateLabelText()}animateReadyResize(){this.resetAllAnimation()}dataCount(){return Number.NaN}getSeriesDomain(){return[Number.NaN,Number.NaN]}getSeriesRange(e,t){return[Number.NaN,Number.NaN]}getLegendData(){return[]}getTooltipContent(e){const{id:t,properties:i}=this,{tooltip:s}=i;let n,o,a;if(e.type===0?(n=i.value,o=i.label.text,a=this.ctx.localeManager.t("ariaLabelGaugeValue")):({value:n,text:o}=i.targets[e.index],a=this.ctx.localeManager.t("ariaLabelGaugeTarget")),n!=null)return this.formatTooltipWithContext(s,{data:[{label:o,fallbackLabel:a,value:this.formatLabel(n)}]},{seriesId:t,title:void 0,datum:void 0,value:n})}pickNodeClosestDatum(e){return kB(this,e)}pickFocus(e){return IB(this,e)}getCaptionText(){const{value:e}=this.properties,t=[];return t.push(this.formatLabel(e)),this.labelSelection.each((i,s)=>{const n=jf(this.id,this.ctx,s);n!=null&&t.push($e(n))}),t.join(". ")}getCategoryValue(e){}datumIndexForCategoryValue(e){}hasItemStylers(){return this.properties.label.itemStyler!=null}};hS.className="RadialGaugeSeries",hS.type="radial-gauge";var{FONT_SIZE_RATIO:jce}=k,Hce={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"radial-gauge",moduleFactory:e=>new hS(e),themeTemplate:{minWidth:200,minHeight:200,tooltip:{enabled:!1},series:{outerRadiusRatio:1,innerRadiusRatio:.8,startAngle:270,endAngle:450,defaultColorRange:{$if:[{$eq:[{$palette:"type"},"inbuilt"]},{$interpolate:[{$palette:"secondDivergingColors"},5]},k.SAFE_RANGE2_OPERATION]},scale:{defaultFill:{$path:["/1",{$palette:"fill"},{$palette:"hierarchyColors"}]},stroke:{$path:["/2",k.SAFE_STROKE_FILL_OPERATION,{$palette:"hierarchyColors"}]},strokeWidth:{$isUserOption:["./stroke",2,0]},label:{fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:12}},bar:{strokeWidth:{$isUserOption:["./stroke",2,0]}},segmentation:{enabled:!1,interval:{},spacing:2},defaultTarget:{fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},size:10,shape:"triangle",placement:"outside",spacing:5,label:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},spacing:5}},needle:{enabled:!1,fill:{$ref:"foregroundColor"},spacing:10},label:{...k.LABEL_BOXING_DEFAULTS,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:56,minimumFontSize:18/56,fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}},secondaryLabel:{...k.LABEL_BOXING_DEFAULTS,enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:jce.LARGE},minimumFontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"subtleTextColor"}},tooltip:{range:{$path:["/tooltip/range",10]}}}}},Wce={type:"series",name:"radial-gauge",chartType:"standalone",enterprise:!0,options:k.radialGaugeSeriesOptionsDef,create:e=>new hS(e)},{BBox:$ce,Path:Uce,Vec2:rs,SceneChangeDetection:np}=k,Qh=class extends Uce{constructor(){super(...arguments),this.x1=0,this.x2=0,this.y1=0,this.y2=0,this.height=0,this.inset=0,this.elbows=[]}computeBBox(){const e=Math.min(this.x1,this.x2),t=Math.max(this.x1,this.x2)-e,i=Math.min(this.y1,this.y2),s=Math.max(this.y1,this.y2)-i+this.height;return new $ce(e,i,t,s)}updatePath(){const{path:e,inset:t}=this;e.clear();const i=this.height-2*this.inset,s=i/2;let n=this.x1+t,o=this.y1+t;e.moveTo(n,o);for(const l of this.elbows)this.updatePathSection(n,o,l.x,l.y,i,-s),n=l.x,o=l.y;const a=this.x2-t,r=this.y2+t;this.updatePathSection(n,o,a,r,i,-s),e.lineTo(a,r+i),n=a,o=r;for(const l of this.elbows.toReversed())this.updatePathSection(n,o,l.x,l.y,i,s),n=l.x,o=l.y;this.updatePathSection(n,o,this.x1+t,this.y1+t,i,s),e.closePath()}updatePathSection(e,t,i,s,n,o){const{path:a}=this,r=rs.from(e,t+o+n/2),l=rs.from(i,s+o+n/2);if(Math.abs(l.y-r.y)<2){a.lineTo(l.x,l.y);return}let c=rs.angle(rs.sub(l,r));c<0&&(c=2*Math.PI+c);const h=0,d=Math.PI/2,u=Math.PI,p=Math.PI*1.5,g=q_(r,l,0),f=q_(r,l,n);if(g.radius=p?(a.arc(r.x,t-g.radius,g.radius,d,d+f.angle,!0),a.arc(l.x,s+f.radius,f.radius,p+f.angle,p),a.lineTo(l.x,l.y)):c>h&&c<=d?(a.arc(r.x,t+f.radius,f.radius,p,p+f.angle),a.arc(l.x,s-g.radius,g.radius,d+g.angle,d,!0),a.lineTo(l.x,l.y)):c>d&&c<=u?(a.arc(r.x,t+f.radius,f.radius-n,p,p+f.angle,!0),a.arc(l.x,s-g.radius,g.radius+n,d+g.angle,d),a.lineTo(l.x,l.y)):(a.arc(r.x,t-g.radius,g.radius+n,d,d+g.angle),a.arc(l.x,s+f.radius,f.radius-n,p+f.angle,p,!0),a.lineTo(l.x,l.y))}};y([np()],Qh.prototype,"x1",2),y([np()],Qh.prototype,"x2",2),y([np()],Qh.prototype,"y1",2),y([np()],Qh.prototype,"y2",2),y([np()],Qh.prototype,"height",2),y([np()],Qh.prototype,"inset",2);function q_(e,t,i){const s=rs.angle(rs.sub(t,e)),n=rs.distance(e,t),o=rs.add(e,rs.rotate(rs.from(n/2,0),s)),a=-1/rs.gradient(e,t),r=rs.intercept(o,a),l=Kce(.1,.5,Math.PI/2-Math.abs(rs.gradient(e,t))),c=rs.intersectAtX(a,r,e.x),h=Math.max(i,rs.distance(e,c)*l);return{angle:rs.angle(rs.sub(c,e),rs.sub(c,o))/-(1.1-l),radius:h}}function Kce(e,t,i){return ve(e,(t-e)*i+e,t)}var{BaseProperties:Q_,FillGradientDefaults:Yce,FillPatternDefaults:Zce,FillImageDefaults:Xce,makeSeriesTooltip:qce,SeriesProperties:Qce,Property:_e,Label:Jce}=k,dS=class extends Jce{constructor(){super(...arguments),this.spacing=1,this.placement=void 0,this.edgePlacement=void 0}};y([_e],dS.prototype,"spacing",2),y([_e],dS.prototype,"placement",2),y([_e],dS.prototype,"edgePlacement",2);var il=class extends Q_{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}};y([_e],il.prototype,"fill",2),y([_e],il.prototype,"fillOpacity",2),y([_e],il.prototype,"stroke",2),y([_e],il.prototype,"strokeOpacity",2),y([_e],il.prototype,"strokeWidth",2),y([_e],il.prototype,"lineDash",2),y([_e],il.prototype,"lineDashOffset",2),y([_e],il.prototype,"itemStyler",2);var un=class extends Q_{constructor(){super(...arguments),this.spacing=1,this.minSpacing=0,this.width=1,this.alignment="justify",this.verticalAlignment="center",this.sort="auto",this.fill=void 0,this.fillOpacity=1,this.stroke=void 0,this.strokeOpacity=1,this.strokeWidth=1,this.lineDash=[0],this.lineDashOffset=0}};y([_e],un.prototype,"spacing",2),y([_e],un.prototype,"minSpacing",2),y([_e],un.prototype,"width",2),y([_e],un.prototype,"alignment",2),y([_e],un.prototype,"verticalAlignment",2),y([_e],un.prototype,"sort",2),y([_e],un.prototype,"fill",2),y([_e],un.prototype,"fillOpacity",2),y([_e],un.prototype,"stroke",2),y([_e],un.prototype,"strokeOpacity",2),y([_e],un.prototype,"strokeWidth",2),y([_e],un.prototype,"lineDash",2),y([_e],un.prototype,"lineDashOffset",2),y([_e],un.prototype,"itemStyler",2);var Di=class extends Qce{constructor(){super(),this.nodes=void 0,this.idKey="",this.idName=void 0,this.labelKey=void 0,this.labelName=void 0,this.sizeKey=void 0,this.sizeName=void 0,this.fillGradientDefaults=new Yce,this.fillPatternDefaults=new Zce,this.fillImageDefaults=new Xce,this.defaultColorRange=[],this.defaultPatternFills=[],this.fills=[],this.strokes=[],this.label=new dS,this.link=new il,this.node=new un,this.tooltip=qce(),this.highlightStyle.deprecated=!1}getStyle(e,t,i,s){const{fillOpacity:n,strokeWidth:o,strokeOpacity:a,lineDash:r,lineDashOffset:l,fill:c=t[s%t.length],stroke:h=i[s%t.length]}=e?this.link:this.node;return{fill:c,fillOpacity:n,stroke:h,strokeWidth:o,strokeOpacity:a,lineDash:r,lineDashOffset:l}}};y([_e],Di.prototype,"nodes",2),y([_e],Di.prototype,"fromKey",2),y([_e],Di.prototype,"toKey",2),y([_e],Di.prototype,"idKey",2),y([_e],Di.prototype,"idName",2),y([_e],Di.prototype,"labelKey",2),y([_e],Di.prototype,"labelName",2),y([_e],Di.prototype,"sizeKey",2),y([_e],Di.prototype,"sizeName",2),y([_e],Di.prototype,"fillGradientDefaults",2),y([_e],Di.prototype,"fillPatternDefaults",2),y([_e],Di.prototype,"fillImageDefaults",2),y([_e],Di.prototype,"defaultColorRange",2),y([_e],Di.prototype,"defaultPatternFills",2),y([_e],Di.prototype,"fills",2),y([_e],Di.prototype,"strokes",2),y([_e],Di.prototype,"label",2),y([_e],Di.prototype,"link",2),y([_e],Di.prototype,"node",2),y([_e],Di.prototype,"tooltip",2);var{Transformable:ehe,applyShapeStyle:J_,SeriesNodePickMode:eV,createDatumId:uS,getShapeStyle:tV,getLabelStyles:the,Rect:iV,BBox:sV,mergeDefaults:pS}=k,gS=class extends XF{constructor(e){super({moduleCtx:e,pickModes:[eV.NEAREST_NODE,eV.EXACT_SHAPE_MATCH]}),this.properties=new Di}isLabelEnabled(){return(this.properties.labelKey!=null||this.nodes==null)&&this.properties.label.enabled}linkFactory(){return new Qh}nodeFactory(){return new iV}createNodeData(){const{id:e,_nodeDataDependencies:{seriesRectWidth:t,seriesRectHeight:i}={seriesRectWidth:0,seriesRectHeight:0}}=this,{fromKey:s,toKey:n,sizeKey:o,labelKey:a,label:{spacing:r,placement:l,edgePlacement:c},node:{width:h,alignment:d}}=this.properties,u=z=>({...z,x:Number.NaN,y:Number.NaN,width:h,height:Number.NaN}),p=z=>({...z,x1:Number.NaN,x2:Number.NaN,y1:Number.NaN,y2:Number.NaN,height:Number.NaN,elbows:[]}),{nodeGraph:g,links:f,maxPathLength:x}=this.getNodeGraph(u,p,{includeCircularReferences:!1}),m=g;if(m.size===0)return;const v=[];for(let z=0;zQ+ie.size,0),V.reduce((Q,{link:ie})=>Q+ie.size,0));if(R.length===0&&V.length===0||W===0){z.columnIndex=-1;continue}let Y;switch(d){case"left":Y=v[j];break;case"right":Y=v[x-1-$];break;case"center":{if(R.length!==0)Y=v[j];else if(V.length===0)Y=v[0];else{const Q=V.reduce((ie,q)=>Math.min(ie,q.node.maxPathLengthBefore),x)-1;Y=v[Q]}break}case"justify":{Y=V.length===0?v[x-1]:v[j];break}}B.size=W;const{label:se}=this.properties,X=se.enabled?this.getLabelText(B.label,B.datum,a,"label",[],this.properties.label,{datum:B.datum,value:B.label,fromKey:s,toKey:n,sizeKey:o,size:W}):void 0;B.label=$e(X),Y.nodes.push(z),Y.size+=W,z.columnIndex=Y.index}const b=Je(this.properties.label);let S=0,D=0;if(this.isLabelEnabled()){if(l==null&&c==null)S=(t-h)*(1-x/(x+1)),D=S;else if(c==="outside"||c==null){const z=(B,R)=>{const V=R;if(V.datum.label==null||V.datum.label==="")return B;let j=(t-h)/(x-1)-r;l==="center"&&c==null&&(j/=2);const $=cl(V.datum.label,{maxWidth:j,maxHeight:V.datum.height,font:this.properties.label,textWrap:"never"});let{width:W}=b.measureLines($);return l==="center"&&c==null&&(W/=2),Math.max(B,W)};(l!=="right"||c==="outside")&&(S=h+v[0].nodes.reduce(z,0)),(l!=="left"||c==="outside")&&(D=h+v.at(-1).nodes.reduce(z,0))}}const L=(t-h-S-D)/(x-1);for(let z=0;zz.columnIndex;j--){const $=R.link.size,W={ghost:!0,datum:{...z.datum,size:$,y:0,height:0},weight:0,linksBefore:[{node:{columnIndex:j-1,datum:{size:$}}}],linksAfter:[{node:{columnIndex:j+1,datum:{size:$}}}],link:R.link,columnIndex:z.columnIndex,size:z.datum.size,closestColumnDiff:B,fromNode:{y:V.datum.y},toNode:{y:0}};v[j].size+=$,v[j].nodes.push(W)}}}const I=v.toSorted((z,B)=>{const R=z.nodes.reduce((j,$)=>Math.max(j,$.datum.size),0);return B.nodes.reduce((j,$)=>Math.max(j,$.datum.size),0)-R}),A={};for(let z=0;z{if(V.node.columnIndex!==z.index-1)return R;const j=V.node.datum.size/v[V.node.columnIndex].size*A[V.node.columnIndex];return Math.max(R,j)},0),B.weight+=B.linksAfter.reduce((R,V)=>{if(V.node.columnIndex!==z.index+1)return R;const j=V.node.datum.size/v[V.node.columnIndex].size*A[V.node.columnIndex];return Math.max(R,j)},0)}z.nodes.sort((B,R)=>this.sortNodes(B,R))}const T=1,w=z=>v.reduce((B,{size:R,nodes:V})=>{const j=i-V.length*T,W=(1-(V.length-1)*z/j)/R;return Math.min(B,W)},1/0);let N=this.properties.node.spacing,O=w(N);for(;O<0&&N>this.properties.node.minSpacing;)N-=1,O=w(N);if(O<0){K.warnOnce("There was insufficient space to display the Sankey Series. Reduce [node.spacing], [node.minSpacing], or provide a larger container.");return}for(const z of v){let B=0;for(const j of z.nodes){const $=i*j.datum.size*O;j.datum.height=Math.max(T,$),B+=$}const R=N*(z.nodes.length-1);let V=0;this.properties.node.verticalAlignment==="bottom"?V=i-B-R:this.properties.node.verticalAlignment==="center"&&(V=(i-B-R)/2);for(const j of z.nodes)j.datum.y=V,V+=i*j.datum.size*O+N,"ghost"in j&&j.ghost&&j.link.elbows.push({x:z.x,y:j.datum.y})}for(const{datum:z,linksBefore:B,linksAfter:R}of m.values()){let V=z.y;B.sort(($,W)=>this.sortNodes($.node,W.node));for(const{link:$}of B)$.y2=V,V+=$.size*i*O;let j=z.y;R.sort(($,W)=>this.sortNodes($.node,W.node,{invertColumnSort:!0}));for(const{link:$}of R)$.y1=j,j+=$.size*i*O}const P=[],F=[],{fontSize:_}=this.properties.label;for(const[z,B]of v.entries()){const R=z===0,V=z===v.length-1;let j=-1/0;B.nodes.sort(($,W)=>$.datum.y-W.datum.y);for(const $ of B.nodes){if("ghost"in $&&$.ghost)continue;const{datum:W}=$;if(W.midPoint={x:W.x+W.width/2,y:W.y+W.height/2},P.push(W),W.label==null)continue;const Y=W.y+W.height/2;let se;if(!R&&!V){const le=$o(_),he=Y-le,ue=Y+le;let xe=t;for(const{datum:ye}of m.values())ye.x>W.x&&Math.max(ye.y,he)<=Math.min(ye.y+ye.height,ue)&&(xe=Math.min(xe,ye.x-r));const be=xe-W.x-2*r;se=cl(W.label,{maxWidth:be,maxHeight:W.height,font:this.properties.label,textWrap:"never",overflow:"hide"})}if(se==null||se===""){const le=c==null&&(R||V)?r:r*2;se=cl(W.label,{maxWidth:L-le,maxHeight:W.height,font:this.properties.label,textWrap:"never"})}if(se==="")continue;const{height:X}=b.measureLines(se),Q=Y-X/2,ie=Y+X/2;let q=W.x+W.width+r,ee="left",oe=l;R&&c==null&&l==null&&(oe="left"),c==="outside"?(R&&(oe="left"),V&&(oe="right")):c==="inside"&&(R&&(oe="right"),V&&(oe="left")),oe==="left"?(q=W.x-r,ee="right"):oe==="center"&&(q=W.x+W.width/2,ee="center"),Q>=j&&(F.push({x:q,y:Y,textAlign:ee,text:se,size:W.size}),j=ie)}}for(const z of f){const{fromNode:B,toNode:R,size:V}=z;z.height=Math.max(T,i*V*O),z.x1=B.x+h,z.x2=R.x,z.midPoint={x:(z.x1+z.x2)/2,y:(z.y1+z.y2)/2+z.height/2},P.push(z)}return{itemId:e,nodeData:P,labelData:F}}sortNodes(e,t,i){const{properties:s}=this;return s.node.sort==="ascending"?(e.datum.label??"").localeCompare(t.datum.label??""):s.node.sort==="descending"?(t.datum.label??"").localeCompare(e.datum.label??""):s.node.sort==="data"?0:e.columnIndext.columnIndex?i?.invertColumnSort?-1:1:e.weight===t.weight?e.datum.size-t.datum.size:e.closestColumnDifft.closestColumnDiff?-1:e.weight-t.weight}updateLabelSelection(e){const t=this.isLabelEnabled()?e.labelData:[];return e.labelSelection.update(t)}updateLabelNodes(e){const t=this.ctx.highlightManager?.getActiveHighlight();e.labelSelection.each((i,s)=>{const{x:n,y:o,textAlign:a,text:r}=s,c=the(this,void 0,s,this.properties.label,!1,t),{color:h,fontStyle:d,fontWeight:u,fontSize:p,fontFamily:g}=c;i.visible=!0,i.x=n,i.y=o,i.text=r,i.fill=h,i.fontStyle=d,i.fontWeight=u,i.fontSize=p,i.fontFamily=g,i.textAlign=a,i.textBaseline="middle",i.setBoxing(c)})}updateNodeSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>uS(t.type,t.id))}getNodeStyle(e,t,i){const{properties:s}=this,{fills:n,strokes:o,defaultColorRange:a,defaultPatternFills:r,fillGradientDefaults:l,fillPatternDefaults:c,fillImageDefaults:h}=s,{itemStyler:d}=s.node,u=a[t%a.length].map(v=>({color:v})),p=r[t%r.length],g=this.getHighlightStyle(i,e.datumIndex),f=pS(g,s.getStyle(!1,n,o,t)),x=s.node.fill!=null;let m=tV(f,x?l:{...l.toJson(),colorStops:u},x?c:{...c.toJson(),fill:p,stroke:p},h);if(d!=null&&e.datumIndex!=null){const v=this.cachedDatumCallback(uS(e.datumIndex.index,"node",i?"highlight":"node"),()=>{const b=this.makeItemStylerParams(e,i,m);return this.callWithContext(d,b)});v&&(m=pS(v,m,{...l.toJson(),colorStops:u},{...c.toJson(),fill:p,stroke:p},h))}return m.opacity=1,m}makeItemStylerParams({datum:e,datumIndex:t,size:i=0,label:s},n,o){const{id:a}=this,r=this.ctx.highlightManager?.getActiveHighlight(),l=this.getHighlightStateString(r,n,t),c=this.filterItemStylerFillParams(o.fill)??o.fill;return{seriesId:a,datum:e,highlighted:n,highlightState:l,...o,size:i,label:s,fill:c}}updateNodeNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((n,o)=>{const{datumIndex:a}=o,r=this.getNodeStyle(o,a.index,i);n.x=o.x,n.y=o.y,n.width=Math.max(o.width,0),n.height=Math.max(o.height,0),J_(n,r,s)})}getShapeFillBBox(){const e=this._nodeDataDependencies?.seriesRectWidth??0,t=this._nodeDataDependencies?.seriesRectHeight??0,i=new sV(0,0,e,t);return{series:i,axis:i}}updateLinkSelection(e){return e.datumSelection.update(e.nodeData,void 0,t=>uS(t.type,t.index,t.fromNode.id,t.toNode.id))}getLinkStyle({datumIndex:e,datum:t},i,s){const{id:n,properties:o}=this,{fills:a,strokes:r,defaultColorRange:l,defaultPatternFills:c,fillGradientDefaults:h,fillPatternDefaults:d,fillImageDefaults:u}=o,{itemStyler:p}=o.link,g=l[i.index%l.length].map(S=>({color:S})),f=c[i.index%c.length],x=this.getHighlightStyle(s,e),m=pS(x,o.getStyle(!0,a,r,i.index)),v=o.link.fill!=null;let b=tV(m,v?h:{...h.toJson(),colorStops:g},v?d:{...d.toJson(),fill:f,stroke:f},u);if(p!=null&&e!=null){const S=this.cachedDatumCallback(uS(e.index,"link",s?"highlight":"node"),()=>{const D=this.ctx.highlightManager?.getActiveHighlight(),L=this.getHighlightStateString(D,s,e);return this.callWithContext(p,{seriesId:n,datum:t,highlighted:s,highlightState:L,...b})});S&&(b=pS(S,b,{...h.toJson(),colorStops:g},{...d.toJson(),fill:f,stroke:f},u))}return b.opacity=1,b}updateLinkNodes(e){const{datumSelection:t,isHighlight:i}=e,s=this.getShapeFillBBox();t.each((n,o)=>{const a=o.fromNode.datumIndex,r=this.getLinkStyle(o,a,i);n.x1=o.x1,n.y1=o.y1,n.x2=o.x2,n.y2=o.y2,n.height=o.height,n.elbows=o.elbows,J_(n,r,s),n.inset=n.strokeWidth/2})}getTooltipContent(e){const{id:t,linksProcessedData:i,nodesProcessedData:s,properties:n,ctx:{formatManager:o}}=this,{fromKey:a,toKey:r,sizeKey:l,sizeName:c,tooltip:h}=n,d=this.contextNodeData?.nodeData.find(v=>v.datumIndex.type===e.type&&v.datumIndex.index===e.index);if(d==null)return;const u=d.type===0?d.fromNode.index:d.index,p=d.type===0?`${d.fromNode.label} - ${d.toNode.label}`:d.label,g=e.type===0?i?.dataSources.get(this.id)?.data[e.index]:s?.dataSources.get(this.id)?.data[e.index],f=d.size;let x;if(d.type===0){const v=d.fromNode.datumIndex;x=this.getLinkStyle({datumIndex:e,datum:g},v,!1)}else x=this.getNodeStyle({datumIndex:e,datum:g},e.index,!1);const m=[];if(l!=null){const v=o.format(this.callWithContext.bind(this),{type:"number",value:f,datum:g,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",domain:[],boundSeries:this.getFormatterContext("size"),fractionDigits:void 0});m.push({label:c,fallbackLabel:l,value:v??String(f)})}return this.formatTooltipWithContext(h,{title:p,symbol:this.legendItemSymbol(d.type,u,x),data:m},{seriesId:t,datum:g,title:p,fromKey:a,toKey:r,sizeKey:l,sizeName:c,size:f,...x})}computeFocusBounds(e){if(e instanceof iV){const{x:t,y:i,width:s,height:n}=e,o=new sV(t,i,s,n);return ehe.toCanvas(this.contentGroup,o)}return e}hasItemStylers(){return this.properties.node.itemStyler!=null||this.properties.link.itemStyler!=null||this.properties.label.itemStyler!=null}};gS.className="SankeySeries",gS.type="sankey";var{commonSeriesOptionsDefs:ihe,sankeySeriesThemeableOptionsDef:she}=k,op={...she,...ihe,type:U(Ce("sankey")),fromKey:U(E),toKey:U(E),sizeKey:E,sizeName:E};op.fillGradientDefaults=me(FS),op.fillPatternDefaults=me(BS),op.fillImageDefaults=me(_S),op.defaultColorRange=me(Me(Me(ae))),op.defaultPatternFills=me(Me(ae));var nhe={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],solo:!0,identifier:"sankey",moduleFactory:e=>new gS(e),themeTemplate:{seriesArea:{padding:{top:10,bottom:10}},series:{fills:{$palette:"fills"},strokes:{$palette:"strokes"},fillGradientDefaults:k.FILL_GRADIENT_LINEAR_DEFAULTS,fillPatternDefaults:k.FILL_PATTERN_DEFAULTS,fillImageDefaults:k.FILL_IMAGE_DEFAULTS,defaultColorRange:{$palette:"gradients"},defaultPatternFills:k.SAFE_FILLS_OPERATION,highlightStyle:{series:{dimOpacity:.2}},highlight:{...k.singleSeriesHighlightStyle()},label:{...k.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$ref:"fontSize"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:10},node:{spacing:{$if:[{$greaterThan:[{$path:"./minSpacing"},20]},{$path:"./minSpacing"},20]},minSpacing:0,width:10,strokeWidth:{$isUserOption:["./stroke",2,0]}},link:{fillOpacity:.5,strokeWidth:{$isUserOption:["./stroke",2,0]}}},legend:{enabled:!1,toggleSeries:!1}}},ohe={type:"series",name:"sankey",chartType:"standalone",enterprise:!0,options:op,create:e=>new gS(e)},{HierarchySeriesProperties:ahe,HighlightStyle:rhe,makeSeriesTooltip:lhe,Property:ki}=k,yc=class extends rhe{constructor(){super(!1),this.label=new Qa,this.secondaryLabel=new Qa}};y([ki],yc.prototype,"fill",2),y([ki],yc.prototype,"fillOpacity",2),y([ki],yc.prototype,"stroke",2),y([ki],yc.prototype,"strokeWidth",2),y([ki],yc.prototype,"strokeOpacity",2),y([ki],yc.prototype,"label",2),y([ki],yc.prototype,"secondaryLabel",2);var pn=class extends ahe{constructor(){super(...arguments),this.fillOpacity=1,this.strokeWidth=0,this.strokeOpacity=1,this.cornerRadius=0,this.highlightStyle=new yc,this.label=new Qa,this.secondaryLabel=new Of,this.tooltip=lhe()}getStyle(e){const{fills:t,strokes:i,fillOpacity:s,strokeWidth:n,strokeOpacity:o}=this;return{fill:t[e%t.length],fillOpacity:s,stroke:i[e%i.length],strokeWidth:n,strokeOpacity:o,opacity:1}}};y([ki],pn.prototype,"sizeName",2),y([ki],pn.prototype,"labelKey",2),y([ki],pn.prototype,"secondaryLabelKey",2),y([ki],pn.prototype,"fillOpacity",2),y([ki],pn.prototype,"strokeWidth",2),y([ki],pn.prototype,"strokeOpacity",2),y([ki],pn.prototype,"cornerRadius",2),y([ki],pn.prototype,"sectorSpacing",2),y([ki],pn.prototype,"padding",2),y([ki],pn.prototype,"itemStyler",2),y([ki],pn.prototype,"highlightStyle",2),y([ki],pn.prototype,"label",2),y([ki],pn.prototype,"secondaryLabel",2),y([ki],pn.prototype,"tooltip",2);var{fromToMotion:che,normalizeAngle360:hhe,createDatumId:dhe,PointerEvents:uhe,Sector:nV,Group:fS,ScalableGroup:phe,Selection:yC,TransformableText:mC,BBox:oV,applyShapeStyle:ghe,mergeDefaults:aV,formatValue:rV,getLabelStyles:fhe}=k,yhe=class extends k.HierarchyNode{constructor(){super(...arguments),this.label=void 0,this.secondaryLabel=void 0,this.contentHeight=0,this.bbox=void 0,this.startAngle=0,this.endAngle=0}};function lV(e,t=0,i=2*Math.PI/e.sumSize){for(const s of e.children){const n=t+s.sumSize*i;s.startAngle=t,s.endAngle=n,lV(s,t,i),t=n}}var yS=class extends k.HierarchySeries{constructor(e){super(e),this.NodeClass=yhe,this.properties=new pn,this.scalingGroup=this.contentGroup.appendChild(new phe),this.sectorGroup=this.scalingGroup.appendChild(new fS),this.sectorLabelGroup=this.scalingGroup.appendChild(new fS),this.highlightSectorGroup=this.scalingGroup.appendChild(new fS),this.datumSelection=yC.select(this.sectorGroup,nV),this.labelSelection=yC.select(this.sectorLabelGroup,fS),this.highlightSelection=yC.select(this.highlightSectorGroup,nV),this.sectorLabelGroup.pointerEvents=uhe.None}processData(){super.processData(),lV(this.rootNode)}updateSelections(){const e=this.ctx.highlightManager?.getActiveHighlight();if(this.highlightSelection.update(e==null?[]:[e],void 0,o=>this.getDatumId(o)),!this.nodeDataRefresh)return;this.nodeDataRefresh=!1;const{chart:t}=this;if(t==null||t.seriesRect==null)return;const s=Array.from(this.rootNode),n=o=>{o.append([new mC({tag:0}),new mC({tag:1})])};this.datumSelection.update(s,void 0,o=>this.getDatumId(o)),this.labelSelection.update(s,n,o=>this.getDatumId(o))}getItemStyle(e,t){const{properties:i,colorScale:s}=this,{itemStyler:n}=i,o=e.datumIndex?.[0]??0,a=t?i.highlightStyle:void 0,r=aV(a,i.getStyle(o));!t&&e.colorValue!=null&&(r.fill=s.convert(e.colorValue));let l=r;if(n!=null&&e!=null){const c=this.cachedDatumCallback(dhe(this.getDatumId(e),t?"highlight":"node"),()=>{const h=this.makeItemStylerParams(e,t,l);return this.callWithContext(n,h)});c&&(l=aV(c,l))}return l}makeItemStylerParams(e,t,i){const{id:s}=this,n=this.ctx.highlightManager?.getActiveHighlight(),o=this.getHighlightStateString(n,t,e.datumIndex),a=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:e.datum,depth:e.depth??0,highlighted:t,highlightState:o,...i,fill:a}}updateNodes(){const{chart:e,data:t,maxDepth:i}=this;if(e==null||t==null)return;const{width:s,height:n}=e.seriesRect,{sectorSpacing:o=0,padding:a=0,cornerRadius:r,childrenKey:l,colorKey:c,colorName:h,labelKey:d,secondaryLabelKey:u,sizeKey:p,sizeName:g}=this.properties;this.contentGroup.translationX=s/2,this.contentGroup.translationY=n/2;const f=o*.5,x=Math.min(s,n)/2,m=x/(i+1),v=-Math.PI/2,b={series:new oV(-x,-x,2*x,2*x),axis:new oV(-x,-x,2*x,2*x)};this.rootNode?.walk(I=>{const{startAngle:A,endAngle:T}=I;if(I.depth!=null){const w=(A+T)/2+v,N=(I.depth+.5)*m;I.midPoint.x=Math.cos(w)*N,I.midPoint.y=Math.sin(w)*N}}),this.rootNode?.walk(I=>{const{datum:A,depth:T,startAngle:w,endAngle:N,parent:O,sumSize:P}=I;I.label=void 0,I.secondaryLabel=void 0,I.contentHeight=0;let F;if(A!=null&&T!=null&&d!=null){const Ae=A[d];F=this.getLabelText(Ae,A,d,"label",[],this.properties.label,{depth:T,datum:A,childrenKey:l,colorKey:c,colorName:h,labelKey:d,secondaryLabelKey:u,sizeKey:p,sizeName:g,value:Ae})}F===""&&(F=void 0);let _;if(A!=null&&T!=null&&u!=null){const Ae=A[u];_=this.getLabelText(Ae,A,u,"secondaryLabel",[],this.properties.secondaryLabel,{depth:T,datum:A,childrenKey:l,colorKey:c,colorName:h,labelKey:d,secondaryLabelKey:u,sizeKey:p,sizeName:g,value:Ae})}if(_===""&&(_=void 0),T==null)return;const z=T*m+f,B=(T+1)*m-f,R=z>f?f/z:f,V=B>f?f/B:f,j=w+R,W=N+R-j,Y=w+V,X=N+V-Y,Q=Ae=>{if(T===0&&O?.sumSize===P)return{width:2*Math.sqrt(B**2-(Ae*.5)**2),height:Ae,meta:0};const we=Ae,Ve=2*Math.sqrt(B**2-(z+we)**2),Ke=W=Ai?{width:pt,height:we,meta:1}:{width:Ai,height:gt,meta:2}},ie=eA($e(F),this.properties.label,$e(_),this.properties.secondaryLabel,{padding:a},Q);if(ie==null)return;const{width:q,height:ee,meta:oe,label:le,secondaryLabel:he}=ie,ue=v+(w+N)/2,xe=Math.sin(ue)>=0,be=Math.cos(ue)>=0,ye=(xe?3:12)&(be?6:9);let Te;switch(oe){case 0:Te=0;break;case 1:{const ze=B-(m-ee)*.58,we=Math.sqrt((B-a)**2-(q/2)**2);Te=Math.min(ze,we);break}case 2:if(T===0){const Ae=ee/(2*Math.tan(W*.5))+q*.5,ze=Math.sqrt(B**2-(ee*.5)**2)-q*.5;Te=(Ae+ze)*.5}else Te=(z+B)*.5;break}if(le!=null){const{fontStyle:Ae="normal",fontFamily:ze,fontWeight:we="normal",color:Ve="black"}=this.properties.label;I.label={...le,fontStyle:Ae,fontFamily:ze,fontWeight:we,color:Ve,labelPlacement:oe,circleQuarter:ye,radius:Te,theta:ue}}if(he!=null){const{fontStyle:Ae="normal",fontFamily:ze,fontWeight:we="normal",color:Ve="black"}=this.properties.secondaryLabel;I.secondaryLabel={...he,fontStyle:Ae,fontFamily:ze,fontWeight:we,color:Ve,labelPlacement:oe,circleQuarter:ye,radius:Te,theta:ue}}I.contentHeight=ie.height});const S=(I,A,T)=>{const{depth:w,startAngle:N,endAngle:O}=I;if(w==null){A.visible=!1;return}A.visible=!0;const P=this.getItemStyle(I,T),F=P.fill,_=P.strokeWidth,z=k.isGradientFill(F)&&F.bounds!=="item"?b:void 0;ghe(A,P,z),A.centerX=0,A.centerY=0,A.innerRadius=w*m,A.outerRadius=(w+1)*m,A.startAngle=N+v,A.endAngle=O+v,A.inset=f+_*.5,A.cornerRadius=r};this.datumSelection.each((I,A)=>{S(A,I,!1)}),this.highlightSelection.each((I,A)=>{S(A,I,!0)});const D=(I,A,T,w)=>{const{depth:N,contentHeight:O}=I,P=T===0,F=P?I.label:I.secondaryLabel;if(N==null||F==null){A.visible=!1;return}const{labelPlacement:_,circleQuarter:z,radius:B,theta:R}=F;let V;w&&(V=(P?this.properties.highlightStyle.label:this.properties.highlightStyle.secondaryLabel).color);const j={childrenKey:this.properties.childrenKey,colorKey:this.properties.colorKey,colorName:this.properties.colorName??this.properties.colorKey,depth:I.depth??Number.NaN,labelKey:this.properties.labelKey,secondaryLabelKey:this.properties.secondaryLabelKey,sizeKey:this.properties.sizeKey,sizeName:this.properties.sizeName??this.properties.sizeKey},$=P?this.properties.label:this.properties.secondaryLabel,W=this.ctx.highlightManager?.getActiveHighlight(),Y=fhe(this,I,j,$,w,W);switch(A.text=F.text,A.fontSize=F.fontSize,A.lineHeight=F.lineHeight,A.fontStyle=F.fontStyle,A.fontFamily=F.fontFamily,A.fontWeight=F.fontWeight,A.fill=V??F.color,A.fillOpacity=this.getHighlightStyle(w,I.datumIndex)?.opacity??1,A.setBoxing(Y),_){case 0:A.textAlign="center",A.textBaseline="top",A.translationX=0,A.translationY=(P?0:O-F.height)-O*.5,A.rotation=0;break;case 1:{const se=(z&3)!==0,X=P===!se?B:B-(O-F.height);A.textAlign="center",A.textBaseline=se?"bottom":"top",A.translationX=Math.cos(R)*X,A.translationY=Math.sin(R)*X,A.rotation=se?R-Math.PI*.5:R+Math.PI*.5;break}case 2:{const se=(z&6)!==0,X=P===!se?(O-F.height)*.5:(F.height-O)*.5;A.textAlign="center",A.textBaseline="middle",A.translationX=Math.cos(R)*B+Math.cos(R+Math.PI/2)*X,A.translationY=Math.sin(R)*B+Math.sin(R+Math.PI/2)*X,A.rotation=se?R:R+Math.PI;break}}A.visible=!0},L=this.ctx.highlightManager?.getActiveHighlight();for(const I of this.labelSelection.selectByClass(mC)){const A=I.closestDatum();D(A,I,I.tag,A===L)}}getTooltipContent(e){const{id:t,properties:i,ctx:s}=this,{labelKey:n,secondaryLabelKey:o,childrenKey:a,sizeKey:r,sizeName:l,colorKey:c,colorName:h,tooltip:d}=i,{formatManager:u}=s,p=e.reduce((L,I)=>L?.children[I],this.rootNode);if(p==null)return;const{datum:g,depth:f}=p;if(g==null||f==null)return;const x=[],m=r==null?void 0:g[r];if(m!=null){const L=[0,this.rootNode?.sumSize??0],I=u.format(this.callWithContext.bind(this),{type:"number",value:m,datum:g,seriesId:t,legendItemName:void 0,key:r,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:L,fractionDigits:void 0});x.push({label:l,fallbackLabel:r,value:I??rV(m)})}const v=c==null?void 0:g[c];if(v!=null){const{colorDomain:L}=this,I=u.format(this.callWithContext.bind(this),{type:"number",value:v,datum:g,seriesId:t,legendItemName:void 0,key:c,source:"tooltip",property:"color",boundSeries:this.getFormatterContext("color"),domain:L,fractionDigits:void 0});x.push({label:h,fallbackLabel:c,value:I??rV(v)})}const b=this.getItemStyle({...p,colorValue:v??p.colorValue},!1),D={shape:"square",fill:b.fill,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0};return k.isGradientFill(D.fill)&&(D.fill={...D.fill,gradient:"linear",rotation:0,reverse:!1}),this.formatTooltipWithContext(d,{title:n==null?void 0:g[n],symbol:{marker:D},data:x},{seriesId:t,datum:g,title:void 0,depth:f,labelKey:n,secondaryLabelKey:o,childrenKey:a,sizeKey:r,sizeName:l,colorKey:c,colorName:h,...b})}createNodeData(){}pickNodeClosestDatum(e){return this.pickNodeNearestDistantObject(e,this.datumSelection.nodes())}animateEmptyUpdateReady(){che(this.id,"nodes",this.ctx.animationManager,[this.scalingGroup],{toFn(){return{scalingX:1,scalingY:1}},fromFn(){return{scalingX:0,scalingY:0}}})}computeFocusBounds(e){return e}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.label.itemStyler!=null}};yS.className="SunburstSeries",yS.type="sunburst";var{commonSeriesOptionsDefs:mhe,sunburstSeriesThemeableOptionsDef:xhe,without:bhe}=k,vhe={...xhe,...bhe(mhe,["highlightStyle","highlight","showInLegend"]),type:U(Ce("sunburst")),labelKey:E,secondaryLabelKey:E,childrenKey:E,sizeKey:E,colorKey:E,sizeName:E,colorName:E},{BASE_FONT_SIZE:cV,FONT_SIZE_RATIO:hV}=k,She={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"sunburst",moduleFactory:e=>new yS(e),solo:!0,themeTemplate:{series:{fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",k.FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"strokes"}]},colorRange:{$palette:"divergingColors"},strokeWidth:{$isUserOption:["./strokes/0",2,0]},label:{...k.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$rem:hV.LARGE},minimumFontSize:{$rem:9/cV},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},overflowStrategy:"ellipsis",wrapping:"never",spacing:2},secondaryLabel:{...k.LABEL_BOXING_DEFAULTS,fontFamily:{$ref:"fontFamily"},fontSize:{$rem:hV.SMALLEST},minimumFontSize:{$rem:7/cV},fontWeight:{$ref:"fontWeight"},color:{$ref:"chartBackgroundColor"},overflowStrategy:"ellipsis",wrapping:"never"},sectorSpacing:2,padding:3,highlightStyle:{label:{color:{$ref:"chartBackgroundColor"}},secondaryLabel:{color:{$ref:"chartBackgroundColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2}},gradientLegend:{enabled:!0,...k.LEGEND_CONTAINER_THEME}}},Mhe={type:"series",name:"sunburst",chartType:"standalone",enterprise:!0,options:vhe,create:e=>new yS(e)},{BaseProperties:mS,HierarchySeriesProperties:Dhe,HighlightStyle:khe,makeSeriesTooltip:Ihe,Property:Re,Label:Ahe}=k,dV=class extends Ahe{constructor(){super(...arguments),this.spacing=0}};y([Re],dV.prototype,"spacing",2);var Bo=class extends mS{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.cornerRadius=0,this.textAlign="center",this.gap=0,this.padding=0,this.interactive=!0,this.label=new dV}};y([Re],Bo.prototype,"fill",2),y([Re],Bo.prototype,"fillOpacity",2),y([Re],Bo.prototype,"stroke",2),y([Re],Bo.prototype,"strokeWidth",2),y([Re],Bo.prototype,"strokeOpacity",2),y([Re],Bo.prototype,"cornerRadius",2),y([Re],Bo.prototype,"textAlign",2),y([Re],Bo.prototype,"gap",2),y([Re],Bo.prototype,"padding",2),y([Re],Bo.prototype,"interactive",2),y([Re],Bo.prototype,"label",2);var Jn=class extends mS{constructor(){super(...arguments),this.fill=void 0,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.cornerRadius=0,this.textAlign="center",this.verticalAlign="middle",this.gap=0,this.padding=0,this.label=new Qa,this.secondaryLabel=new Of}};y([Re],Jn.prototype,"fill",2),y([Re],Jn.prototype,"fillOpacity",2),y([Re],Jn.prototype,"stroke",2),y([Re],Jn.prototype,"strokeWidth",2),y([Re],Jn.prototype,"strokeOpacity",2),y([Re],Jn.prototype,"cornerRadius",2),y([Re],Jn.prototype,"textAlign",2),y([Re],Jn.prototype,"verticalAlign",2),y([Re],Jn.prototype,"gap",2),y([Re],Jn.prototype,"padding",2),y([Re],Jn.prototype,"label",2),y([Re],Jn.prototype,"secondaryLabel",2);var Jh=class extends mS{constructor(){super(...arguments),this.label=new Qa}};y([Re],Jh.prototype,"fill",2),y([Re],Jh.prototype,"fillOpacity",2),y([Re],Jh.prototype,"stroke",2),y([Re],Jh.prototype,"strokeWidth",2),y([Re],Jh.prototype,"strokeOpacity",2),y([Re],Jh.prototype,"label",2);var mc=class extends mS{constructor(){super(...arguments),this.label=new Qa,this.secondaryLabel=new Of}};y([Re],mc.prototype,"fill",2),y([Re],mc.prototype,"fillOpacity",2),y([Re],mc.prototype,"stroke",2),y([Re],mc.prototype,"strokeWidth",2),y([Re],mc.prototype,"strokeOpacity",2),y([Re],mc.prototype,"label",2),y([Re],mc.prototype,"secondaryLabel",2);var xC=class extends khe{constructor(){super(!1),this.group=new Jh,this.tile=new mc}getStyle(e){return e?this.tile:this.group}};y([Re],xC.prototype,"group",2),y([Re],xC.prototype,"tile",2);var xa=class extends Dhe{constructor(){super(...arguments),this.highlightStyle=new xC,this.tooltip=Ihe(),this.group=new Bo,this.tile=new Jn,this.undocumentedGroupFills=[],this.undocumentedGroupStrokes=[]}getStyle(e,t,i,s){const{fillOpacity:n,strokeWidth:o,strokeOpacity:a,fill:r=e?t[s%t.length]:t[Math.min(s,t.length)],stroke:l=e?i[s%t.length]:i[Math.min(s,i.length)]}=e?this.tile:this.group;return{fill:r,fillOpacity:n,stroke:l,strokeWidth:o,strokeOpacity:a,opacity:1}}};y([Re],xa.prototype,"sizeName",2),y([Re],xa.prototype,"labelKey",2),y([Re],xa.prototype,"secondaryLabelKey",2),y([Re],xa.prototype,"itemStyler",2),y([Re],xa.prototype,"highlightStyle",2),y([Re],xa.prototype,"tooltip",2),y([Re],xa.prototype,"group",2),y([Re],xa.prototype,"tile",2),y([Re],xa.prototype,"undocumentedGroupFills",2),y([Re],xa.prototype,"undocumentedGroupStrokes",2);var{createDatumId:Che,Rect:uV,Group:pV,BBox:ap,Selection:bC,Text:vC,Transformable:Lhe,applyShapeStyle:The,getLabelStyles:whe,mergeDefaults:gV,formatValue:fV}=k,Nhe=class extends k.HierarchyNode{constructor(){super(...arguments),this.labelValue=void 0,this.secondaryLabelValue=void 0,this.label=void 0,this.secondaryLabel=void 0,this.bbox=void 0,this.padding=void 0}};function xc(e){return e.children.length>0?e.sumSize-e.sizeValue:e.sizeValue}var yV={left:0,center:.5,right:1},Ohe={top:0,middle:.5,bottom:1},qhe=class extends k.Group{distanceSquared(e,t){return this.getBBox().distanceSquared(e,t)}},xS=class extends k.HierarchySeries{constructor(){super(...arguments),this.NodeClass=Nhe,this.properties=new xa,this.rectGroup=this.contentGroup.appendChild(new pV),this.datumSelection=bC.select(this.rectGroup,uV),this.labelSelection=bC.select(this.labelGroup,pV),this.highlightSelection=bC.select(this.rectGroup,uV)}groupTitleHeight(e,t){const{labelValue:i}=e,{label:s}=this.properties.group,n=3;if(i!=null){if(s.fontSize>t.width/n||s.fontSize>t.height/n)return;{const{height:o}=Je(s).measureLines(i);return Math.max(o,s.fontSize)}}}getNodePadding(e,t){if(e.parent==null)return{top:0,right:0,bottom:0,left:0};if(e.children.length===0){const{padding:a}=this.properties.tile;return{top:a,right:a,bottom:a,left:a}}const{label:{spacing:i},padding:s}=this.properties.group,n=this.groupTitleHeight(e,t),o=n==null?0:n+i;return{top:s+o,right:s,bottom:s,left:s}}sortChildren({children:e}){const t=Array.from(e,(s,n)=>n).filter(s=>xc(e[s])>0).sort((s,n)=>xc(e[n])-xc(e[s]));return{sortedChildrenIndices:t,childAt:s=>{const n=t[s];return e[n]}}}squarify(e,t){const{datum:i,children:s}=e;if(t.width<=0||t.height<=0){e.bbox=void 0,e.padding=void 0,e.midPoint.x=Number.NaN,e.midPoint.y=Number.NaN;return}const n=i==null?{top:0,right:0,bottom:0,left:0}:this.getNodePadding(e,t);e.parent==null?(e.bbox=void 0,e.padding=void 0,e.midPoint.x=Number.NaN,e.midPoint.y=Number.NaN):(e.bbox=t,e.padding=n,e.midPoint.x=t.x+t.width/2,e.midPoint.y=t.y);const{sortedChildrenIndices:o,childAt:a}=this.sortChildren(e),r=o.every(D=>s[D].children.length===0),l=1,c=t.width-n.left-n.right,h=t.height-n.top-n.bottom;if(c<=0||h<=0)return;const d=o.length;let u=0,p=0,g=1/0,f=o.reduce((D,L)=>D+xc(s[L]),0);const x=new ap(t.x+n.left,t.y+n.top,c,h),m=x.clone();let v=0;for(;v({left:l.x,top:l.y,right:l.x+l.width,bottom:l.y+l.height}),o=n(e),a=n(t),r=["top","right","bottom","left"];for(const l of r)Qe(o[l],a[l])||t.shrink(s,l)}createNodeData(){}getItemStyle(e,t,i){const{properties:s,colorScale:n}=this,{itemStyler:o}=s,a=e.datumIndex?.[0]??0,r=t?s.fills:s.undocumentedGroupFills,l=t?s.strokes:s.undocumentedGroupStrokes,c=t?a:e.depth??-1,h=i?s.highlightStyle.getStyle(t):void 0,d=gV(h,s.getStyle(t,r,l,c));!i&&t&&e.colorValue!=null&&(d.fill=n.convert(e.colorValue));let u=d;if(o!=null&&e!=null){const p=this.cachedDatumCallback(Che(this.getDatumId(e),i?"highlight":"node"),()=>{const g=this.makeItemStylerParams(e,i,u);return this.callWithContext(o,g)});p&&(u=gV(p,u))}return u}makeItemStylerParams(e,t,i){const{id:s}=this,n=this.ctx.highlightManager?.getActiveHighlight(),o=this.getHighlightStateString(n,t,e.datumIndex),a=this.filterItemStylerFillParams(i.fill)??i.fill;return{seriesId:s,datum:e.datum,depth:e.depth??-1,highlighted:t,highlightState:o,...i,fill:a}}updateSelections(){let e=this.ctx.highlightManager?.getActiveHighlight();if(e!=null&&!this.properties.group.interactive&&e.children.length!==0&&(e=void 0),this.highlightSelection.update(e==null?[]:[e],void 0,n=>this.getDatumId(n)),!this.nodeDataRefresh)return;this.nodeDataRefresh=!1;const{seriesRect:t}=this.chart??{};if(!t)return;const i=Array.from(this.rootNode),s=n=>{n.append([new vC({tag:0}),new vC({tag:1})])};this.datumSelection.update(i,void 0,n=>this.getDatumId(n)),this.labelSelection.update(i,s,n=>this.getDatumId(n))}updateNodes(){const{rootNode:e,data:t}=this,{childrenKey:i,colorKey:s,colorName:n,labelKey:o,secondaryLabelKey:a,sizeKey:r,sizeName:l,highlightStyle:c,tile:h,group:d}=this.properties,{seriesRect:u}=this.chart??{};if(!u||!t)return;this.rootNode?.walk(b=>{const{datum:S,depth:D,children:L}=b,I=L.length===0,A=I?h.label:d.label;let T;if(A.enabled&&S!=null&&D!=null&&o!=null){const N=S[o];T=this.getLabelText(N,S,o,"label",[],A,{depth:D,datum:S,childrenKey:i,colorKey:s,colorName:n,labelKey:o,secondaryLabelKey:a,sizeKey:r,sizeName:l,value:N})}T===""&&(T=void 0);let w;if(h.secondaryLabel.enabled&&I&&S!=null&&D!=null&&a!=null){const N=S[a];w=this.getLabelText(N,S,a,"secondaryLabel",[],h.secondaryLabel,{depth:D,datum:S,childrenKey:i,colorKey:s,colorName:n,labelKey:o,secondaryLabelKey:a,sizeKey:r,sizeName:l,value:N})}w===""&&(w=void 0),b.labelValue=$e(T),b.secondaryLabelValue=$e(w)});const{width:p,height:g}=u;this.squarify(e,new ap(0,0,p,g)),this.rootNode?.walk(b=>{const{bbox:S,children:D,labelValue:L,secondaryLabelValue:I}=b;if(b.label=void 0,b.secondaryLabel=void 0,S!=null)if(D.length===0){const A={width:S.width,height:S.height,meta:null},T=eA(L,this.properties.tile.label,I,this.properties.tile.secondaryLabel,{padding:h.padding},()=>A);if(T==null)return;const{height:w,label:N,secondaryLabel:O}=T,{textAlign:P,verticalAlign:F,padding:_}=h,z=yV[P]??.5,B=S.x+_+(S.width-2*_)*z,R=Ohe[F]??.5,V=S.y+_+w*.5+(S.height-2*_-w)*R;if(N!=null){const{fontStyle:j="normal",fontFamily:$,fontWeight:W="normal",color:Y="black"}=this.properties.tile.label;b.label={text:N.text,fontSize:N.fontSize,lineHeight:N.lineHeight,fontStyle:j,fontFamily:$,fontWeight:W,color:Y,textAlign:P,verticalAlign:"middle",x:B,y:V-(w-N.height)*.5}}if(O!=null){const{fontStyle:j="normal",fontFamily:$,fontWeight:W="normal",color:Y="black"}=this.properties.tile.secondaryLabel;b.secondaryLabel={text:O.text,fontSize:O.fontSize,lineHeight:O.fontSize,fontStyle:j,fontFamily:$,fontWeight:W,color:Y,textAlign:P,verticalAlign:"middle",x:B,y:V+(w-O.height)*.5}}}else{if(L==null)return;{const{padding:A,textAlign:T}=d,w=this.groupTitleHeight(b,S);if(w==null)return;const N=S.width-2*A,O=cl(L,{maxWidth:S.width-2*A,font:d.label,textWrap:"never"}),P=yV[T]??.5,{fontStyle:F="normal",fontFamily:_,fontWeight:z="normal",color:B="black"}=this.properties.group.label;b.label={text:O,fontSize:d.label.fontSize,lineHeight:$o(d.label.fontSize),fontStyle:F,fontFamily:_,fontWeight:z,color:B,textAlign:T,verticalAlign:"middle",x:S.x+A+N*P,y:S.y+A+w*.5}}}});const f={series:new ap(0,0,p,g),axis:new ap(0,0,p,g)},x=(b,S,D)=>{const{bbox:L}=b;if(L==null){S.visible=!1;return}const{depth:I=-1}=b,A=b.children.length===0,T=this.getItemStyle(b,A,D);S.crisp=!0,The(S,T,f),S.cornerRadius=A?h.cornerRadius:d.cornerRadius,S.zIndex=[0,I,D?1:0];const w=b.parent?.children.every(P=>P.children.length===0),N=b.parent==null?void 0:b.parent.bbox,O=b.parent==null?void 0:b.parent.padding;w===!0&&N!=null&&O!=null?(S.clipBBox=L,S.x=N.x+O.left,S.y=N.y+O.top,S.width=N.width-(O.left+O.right),S.height=N.height-(O.top+O.bottom)):(S.clipBBox=void 0,S.x=L.x,S.y=L.y,S.width=L.width,S.height=L.height),S.visible=!0};this.datumSelection.each((b,S)=>x(S,b,!1)),this.highlightSelection.each((b,S)=>{x(S,b,!0)});const m=(b,S,D,L)=>{const I=b.children.length===0,A=D===0?b.label:b.secondaryLabel;if(A==null){S.visible=!1;return}const T=D===0?h.label:h.secondaryLabel;let w;if(L){const{tile:F,group:_}=c;w=F.secondaryLabel.color,I?D===0&&(w=F.label.color):w=_.label.color}const N={childrenKey:this.properties.childrenKey,colorKey:this.properties.colorKey,colorName:this.properties.colorName??this.properties.colorKey,depth:b.depth??Number.NaN,labelKey:this.properties.labelKey,secondaryLabelKey:this.properties.secondaryLabelKey,sizeKey:this.properties.sizeKey,sizeName:this.properties.sizeName??this.properties.sizeKey},O=this.ctx.highlightManager?.getActiveHighlight(),P=whe(this,b,N,T,L,O);S.text=A.text,S.fontSize=A.fontSize,S.lineHeight=A.lineHeight,S.fontStyle=A.fontStyle,S.fontFamily=A.fontFamily,S.fontWeight=A.fontWeight,S.fill=w??A.color,S.fillOpacity=this.getHighlightStyle(L,b.datumIndex)?.opacity??1,S.textAlign=A.textAlign,S.textBaseline=A.verticalAlign,S.x=A.x,S.y=A.y,S.setBoxing(P),S.visible=!0,S.zIndex=1},v=this.ctx.highlightManager?.getActiveHighlight();for(const b of this.labelSelection.selectByClass(vC)){const S=b.closestDatum();m(S,b,b.tag,S===v)}}pickNodesExactShape(e){const t=super.pickNodesExactShape(e);return t.sort((i,s)=>s.datumIndex.length-i.datumIndex.length),t}pickNodeClosestDatum(e){const t=this.pickNodesExactShape(e);return t.length!==0?{datum:t[0],distance:0}:this.pickNodeNearestDistantObject(e,this.datumSelection.nodes())}getTooltipContent(e){const{id:t,properties:i,ctx:s}=this,{formatManager:n}=s,{labelKey:o,secondaryLabelKey:a,childrenKey:r,sizeKey:l,sizeName:c,colorKey:h,colorName:d,tooltip:u}=i,p=e.reduce((T,w)=>T?.children[w],this.rootNode);if(p==null)return;const{datum:g,depth:f,children:x}=p;if(g==null||f==null)return;const m=x.length===0,v=[],b=l==null?void 0:g[l];if(b!=null){const T=[0,this.rootNode?.sumSize??0],w=n.format(this.callWithContext.bind(this),{type:"number",value:b,datum:g,seriesId:t,legendItemName:void 0,key:l,source:"tooltip",property:"size",boundSeries:this.getFormatterContext("size"),domain:T,fractionDigits:void 0});v.push({label:c,fallbackLabel:l,value:w??fV(b)})}const S=h==null?void 0:g[h];if(S!=null){const{colorDomain:T}=this,w=n.format(this.callWithContext.bind(this),{type:"number",value:S,datum:g,seriesId:t,legendItemName:void 0,key:h,source:"tooltip",property:"color",boundSeries:this.getFormatterContext("color"),domain:T,fractionDigits:void 0});v.push({label:d,fallbackLabel:h,value:w??fV(S)})}const D=this.getItemStyle({...p,colorValue:S??p.colorValue},m,!1),I={shape:"square",fill:D.fill,fillOpacity:1,stroke:void 0,strokeWidth:0,strokeOpacity:1,lineDash:[0],lineDashOffset:0};k.isGradientFill(I.fill)&&(I.fill={...I.fill,gradient:"linear",rotation:0,reverse:!1});const A=m?{marker:I}:void 0;return this.formatTooltipWithContext(u,{title:o==null?void 0:g[o],symbol:A,data:v},{seriesId:t,datum:g,title:void 0,depth:f,labelKey:o,secondaryLabelKey:a,childrenKey:r,sizeKey:l,sizeName:c,colorKey:h,colorName:d,...D})}computeFocusBounds(e){return Lhe.toCanvas(this.contentGroup,e.getBBox())}hasItemStylers(){return this.properties.itemStyler!=null||this.properties.tile.label.itemStyler!=null||this.properties.group.label.itemStyler!=null}};xS.className="TreemapSeries",xS.type="treemap";var{commonSeriesOptionsDefs:Ehe,treemapSeriesThemeableOptionsDef:Phe,without:Rhe}=k,SC={...Phe,...Rhe(Ehe,["highlightStyle","highlight","showInLegend"]),type:U(Ce("treemap")),labelKey:E,secondaryLabelKey:E,childrenKey:E,sizeKey:E,colorKey:E,sizeName:E,colorName:E};SC.undocumentedGroupFills=me(Me(ae)),SC.undocumentedGroupStrokes=me(Me(ae));var{FONT_SIZE_RATIO:mV}=k,zhe={type:"series",optionsKey:"series[]",packageType:"enterprise",chartTypes:["standalone"],identifier:"treemap",moduleFactory:e=>new xS(e),solo:!0,themeTemplate:{series:{fills:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"fills"},{$applySwitch:[{$path:["/type",void 0,{$value:"$1"}]},{$value:"$1"},["gradient",k.FILL_GRADIENT_LINEAR_DEFAULTS],["pattern",k.FILL_PATTERN_DEFAULTS],["image",k.FILL_IMAGE_DEFAULTS]]}]},strokes:{$applyCycle:[{$size:{$path:["./data",{$path:"/data"}]}},{$palette:"strokes"}]},colorRange:{$palette:"divergingColors"},undocumentedGroupFills:{$palette:"hierarchyColors"},undocumentedGroupStrokes:{$palette:"secondHierarchyColors"},group:{label:{...k.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"textColor"},fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},spacing:4},fill:void 0,stroke:void 0,strokeWidth:1,padding:4,gap:2,textAlign:"left"},tile:{label:{...k.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"chartBackgroundColor"},fontStyle:void 0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:1.5},minimumFontSize:{$rem:mV.SMALLER},fontFamily:{$ref:"fontFamily"},wrapping:"on-space",overflowStrategy:"ellipsis",spacing:2},secondaryLabel:{...k.LABEL_BOXING_DEFAULTS,enabled:!0,color:{$ref:"chartBackgroundColor"},fontStyle:void 0,fontWeight:void 0,fontSize:{$ref:"fontSize"},minimumFontSize:{$rem:mV.SMALLER},fontFamily:{$ref:"fontFamily"},wrapping:"never",overflowStrategy:"ellipsis"},fill:void 0,stroke:void 0,strokeWidth:{$isUserOption:["../strokes/0",2,{$isUserOption:["./stroke",2,0]}]},padding:3,gap:1},highlightStyle:{group:{label:{color:{$ref:"textColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2},tile:{label:{color:{$ref:"chartBackgroundColor"}},secondaryLabel:{color:{$ref:"chartBackgroundColor"}},fill:"rgba(255,255,255, 0.33)",stroke:"rgba(0, 0, 0, 0.4)",strokeWidth:2}}},gradientLegend:{enabled:!0,...k.LEGEND_CONTAINER_THEME}}},Fhe={type:"series",name:"treemap",chartType:"standalone",enterprise:!0,options:SC,create:e=>new xS(e)},Qhe=k.ModuleRegistry,Bhe=[cie,ZR,uz,Hse,ane,Mz,kz,Hz,tF,rF],_he=[hie,die,uie,pie,lre,lle,yle,ece,pce],Vhe=[mie,Are,Rne,Wce,Mhe,Fhe,nse,ohe],Ghe=[Mie,aoe,foe,Woe,cae,bae],jhe=[...Bhe,..._he,...Vhe,...Ghe,Rie,zie,Fie],Hhe=`.ag-watermark{position:absolute;bottom:20px;right:25px;font-weight:700;font-family:Impact,sans-serif;font-size:19px;opacity:.7;animation:1s ease-out 3s ag-watermark-fadeout;color:#9b9b9b;pointer-events:none;&:before{content:"";display:block;height:40px;width:170px;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU4IiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgMjU4IDQwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjUuNzc5IDI4LjY1N0gxMy4zNTlMMTEuMTczIDM0LjAxMkg1LjY3Mjk3TDE3LjE4MiA3LjA1OTk5SDIxLjk1M0wzMy40NjIgMzQuMDEySDI3Ljk2MkwyNS43NzYgMjguNjU3SDI1Ljc3OVpNMjQuMDY4IDI0LjM5N0wxOS41ODggMTMuNDM0TDE1LjEwNyAyNC4zOTdIMjQuMDY4Wk02Mi4wOTIgMTguODIzSDQ5LjgxN1YyMy4wODZINTYuNzc1QzU2LjU1NSAyNS4yMjIgNTUuNzU1IDI2LjkyNyA1NC4zNzIgMjguMjAyQzUyLjk4OSAyOS40NzYgNTEuMTY2IDMwLjExNSA0OC45MDkgMzAuMTE1QzQ3LjYyMiAzMC4xMTUgNDYuNDUgMjkuODg1IDQ1LjM5MyAyOS40MjNDNDQuMzU4MyAyOC45NzgxIDQzLjQzMjYgMjguMzEzOCA0Mi42OCAyNy40NzZDNDEuOTI3IDI2LjYzOSA0MS4zNDQgMjUuNjMxIDQwLjkzMSAyNC40NTNDNDAuNTE5IDIzLjI3NSA0MC4zMTEgMjEuOTcgNDAuMzExIDIwLjUzN0M0MC4zMTEgMTkuMTA1IDQwLjUxNiAxNy44IDQwLjkzMSAxNi42MjFDNDEuMzQ0IDE1LjQ0MyA0MS45MjcgMTQuNDM2IDQyLjY4IDEzLjU5OEM0My40Mzc2IDEyLjc1NzcgNDQuMzY5NiAxMi4wOTMyIDQ1LjQxMSAxMS42NTFDNDYuNDc4IDExLjE4OSA0Ny42NTYgMTAuOTYgNDguOTQ2IDEwLjk2QzUxLjYxMiAxMC45NiA1My42MzcgMTEuNjAyIDU1LjAyIDEyLjg4NUw1OC4zIDkuNjA0OTlDNTUuODE3IDcuNjY5OTkgNTIuNjc2IDYuNjk5OTkgNDguODcyIDYuNjk5OTlDNDYuNzYgNi42OTk5OSA0NC44NTMgNy4wMzQ5OSA0My4xNTQgNy43MDA5OUM0MS40NTUgOC4zNjc5OSAzOS45OTggOS4zMDM5OSAzOC43ODMgMTAuNTA0QzM3LjU2NyAxMS43MDcgMzYuNjM0IDEzLjE1OCAzNS45NzcgMTQuODU3QzM1LjMxOSAxNi41NTYgMzQuOTk0IDE4LjQ1MSAzNC45OTQgMjAuNTRDMzQuOTk0IDIyLjYzIDM1LjMyOSAyNC40OTQgMzUuOTk1IDI2LjIwNUMzNi42NjIgMjcuOTE2IDM3LjYwNSAyOS4zNzQgMzguODE3IDMwLjU3N0M0MC4wMzIgMzEuNzggNDEuNDg2IDMyLjcxMyA0My4xODggMzMuMzgzQzQ0Ljg4OCAzNC4wNDkgNDYuNzgyIDM0LjM4NCA0OC44NzIgMzQuMzg0QzUwLjk2MSAzNC4zODQgNTIuNzUgMzQuMDQ5IDU0LjM5IDMzLjM4M0M1Ni4wMzEgMzIuNzE2IDU3LjQyNiAzMS43OCA1OC41NzkgMzAuNTc3QzU5LjczMyAyOS4zNzQgNjAuNjE5IDI3LjkxNiA2MS4yMzkgMjYuMjA1QzYxLjg2IDI0LjQ5NCA2Mi4xNyAyMi42MDUgNjIuMTcgMjAuNTRDNjIuMTY5NiAxOS45Njg4IDYyLjE0NDUgMTkuMzk4IDYyLjA5NSAxOC44MjlMNjIuMDkyIDE4LjgyM1pNMTUxLjgxIDE2Ljk4MUMxNTMuNDEgMTQuNjA5IDE1Ny40MTkgMTQuMzU4IDE1OS4wMjIgMTQuMzU4VjE4LjkxQzE1Ni45NTcgMTguOTEgMTU0Ljk4NSAxOC45OTYgMTUzLjc1NyAxOS44OTJDMTUyLjUyOSAyMC43OTIgMTUxLjkxOSAyMS45ODIgMTUxLjkxOSAyMy40NjRWMzMuOTlIMTQ2Ljk2NFYxNC4zNThIMTUxLjczNkwxNTEuODEgMTYuOTgxWk0xNDMuMDExIDE0LjM2MVYzNC4wMzFIMTM4LjI0TDEzOC4xMzEgMzEuMDQ1QzEzNy40NjYgMzIuMDc2IDEzNi41NTEgMzIuOTIxOSAxMzUuNDcxIDMzLjUwNEMxMzQuMzc2IDM0LjA5OSAxMzMuMDY4IDM0LjM5NiAxMzEuNTM2IDM0LjM5NkMxMzAuMiAzNC4zOTYgMTI4Ljk2MyAzNC4xNTIgMTI3LjgyMiAzMy42NjhDMTI2LjcgMzMuMTk2NCAxMjUuNjg5IDMyLjQ5NSAxMjQuODU1IDMxLjYwOUMxMjQuMDE4IDMwLjcyMiAxMjMuMzU0IDI5LjY2MiAxMjIuODcxIDI4LjQyMkMxMjIuMzg0IDI3LjE4NSAxMjIuMTQyIDI1LjgxMSAxMjIuMTQyIDI0LjMwNEMxMjIuMTQyIDIyLjc5OCAxMjIuMzg0IDIxLjM3OCAxMjIuODcxIDIwLjExNkMxMjMuMzU3IDE4Ljg1NCAxMjQuMDE4IDE3Ljc3MiAxMjQuODU1IDE2Ljg3M0MxMjUuNjg4IDE1Ljk3NjQgMTI2LjY5OCAxNS4yNjM2IDEyNy44MjIgMTQuNzhDMTI4Ljk2MyAxNC4yODEgMTMwLjIwMyAxNC4wMzMgMTMxLjUzNiAxNC4wMzNDMTMzLjA0MyAxNC4wMzMgMTM0LjMzIDE0LjMxOCAxMzUuMzk3IDE0Ljg4OEMxMzYuNDYyIDE1LjQ1ODkgMTM3LjM3NSAxNi4yNzggMTM4LjA1NyAxNy4yNzZWMTQuMzYxSDE0My4wMTFaTTEzMi42MzEgMzAuMTMzQzEzNC4yNTYgMzAuMTMzIDEzNS41NjcgMjkuNTk0IDEzNi41NjUgMjguNTEyQzEzNy41NjEgMjcuNDMgMTM4LjA2IDI1Ljk5MSAxMzguMDYgMjQuMTk2QzEzOC4wNiAyMi40MDEgMTM3LjU2MSAyMC45OSAxMzYuNTY1IDE5Ljg5OUMxMzUuNTcgMTguODA3IDEzNC4yNTkgMTguMjU4IDEzMi42MzEgMTguMjU4QzEzMS4wMDMgMTguMjU4IDEyOS43MjkgMTguODA0IDEyOC43MzQgMTkuODk5QzEyNy43MzggMjAuOTkzIDEyNy4yMzkgMjIuNDM4IDEyNy4yMzkgMjQuMjMzQzEyNy4yMzkgMjYuMDI4IDEyNy43MzUgMjcuNDMzIDEyOC43MzQgMjguNTE1QzEyOS43MjkgMjkuNTk0IDEzMS4wMjggMzAuMTM2IDEzMi42MzEgMzAuMTM2VjMwLjEzM1pNOTMuNjk4IDI3Ljg3NkM5My41Nzk1IDI4LjAwMjUgOTMuNDU2NCAyOC4xMjQ2IDkzLjMyOSAyOC4yNDJDOTEuOTQ3IDI5LjUxNiA5MC4xMjMgMzAuMTU1IDg3Ljg2NiAzMC4xNTVDODYuNTggMzAuMTU1IDg1LjQwOCAyOS45MjYgODQuMzUgMjkuNDY0QzgzLjMxNTUgMjkuMDE4OSA4Mi4zODk4IDI4LjM1NDYgODEuNjM3IDI3LjUxN0M4MC44ODQgMjYuNjc5IDgwLjMwMSAyNS42NzIgNzkuODg5IDI0LjQ5NEM3OS40NzYgMjMuMzE1IDc5LjI2OSAyMi4wMSA3OS4yNjkgMjAuNTc4Qzc5LjI2OSAxOS4xNDUgNzkuNDczIDE3Ljg0IDc5Ljg4OSAxNi42NjJDODAuMzAxIDE1LjQ4NCA4MC44ODQgMTQuNDc2IDgxLjYzNyAxMy42MzlDODIuMzk0OSAxMi43OTg3IDgzLjMyNzMgMTIuMTM0MiA4NC4zNjkgMTEuNjkyQzg1LjQzNiAxMS4yMyA4Ni42MTQgMTEgODcuOTAzIDExQzkwLjU3IDExIDkyLjU5NSAxMS42NDIgOTMuOTc3IDEyLjkyNkw5Ny4yNTggOS42NDQ5OUM5NC43NzQgNy43MTA5OSA5MS42MzMgNi43Mzk5OSA4Ny44MjkgNi43Mzk5OUM4NS43MTggNi43Mzk5OSA4My44MTEgNy4wNzQ5OSA4Mi4xMTIgNy43NDE5OUM4MC40MTMgOC40MDc5OSA3OC45NTYgOS4zNDQ5OSA3Ny43NCAxMC41NDVDNzYuNTI1IDExLjc0NyA3NS41OTIgMTMuMTk5IDc0LjkzNCAxNC44OThDNzQuMjc3IDE2LjU5NyA3My45NTEgMTguNDkxIDczLjk1MSAyMC41ODFDNzMuOTUxIDIyLjY3IDc0LjI4NiAyNC41MzQgNzQuOTUzIDI2LjI0NUM3NS42MTkgMjcuOTU3IDc2LjU2MiAyOS40MTQgNzcuNzc0IDMwLjYxN0M3OC45OSAzMS44MiA4MC40NDQgMzIuNzUzIDgyLjE0NiAzMy40MjNDODMuODQ1IDM0LjA5IDg1LjczOSAzNC40MjQgODcuODI5IDM0LjQyNEM4OS45MTkgMzQuNDI0IDkxLjcwOCAzNC4wOSA5My4zNDggMzMuNDIzQzk0LjcxOCAzMi44NjUgOTUuOTE4IDMyLjEyMSA5Ni45NDggMzEuMTkxQzk3LjE0OSAzMS4wMDggOTcuMzQ4IDMwLjgxNSA5Ny41MzcgMzAuNjJMOTMuNzAxIDI3Ljg4NUw5My42OTggMjcuODc2Wk0xMTAuODAyIDE0LjAxNUMxMDkuMTk5IDE0LjAxNSAxMDYuODM2IDE0LjQ3MSAxMDUuNjExIDE2LjE1OEwxMDUuNTM3IDYuMDE1OTlIMTAwLjc2NVYzMy45MzlIMTA1LjcyVjIyLjY0MUMxMDUuNzcxIDIxLjQ2MDcgMTA2LjI4OCAyMC4zNDg4IDEwNy4xNTcgMTkuNTQ4OUMxMDguMDI3IDE4Ljc0OTEgMTA5LjE3OCAxOC4zMjY2IDExMC4zNTggMTguMzc0QzExMy4zOTcgMTguMzc0IDExNC4yNjggMjEuMTU5IDExNC4yNjggMjIuNjQxVjMzLjkzOUgxMTkuMjIzVjIxLjA1OUMxMTkuMjIzIDIxLjA1OSAxMTkuMTQyIDE0LjAxNSAxMTAuODAyIDE0LjAxNVpNMTczLjc2MyAxNC4zNThIMTY5Ljk5OVY4LjcxNDk5SDE2NS4wNDhWMTQuMzU4SDE2MS4yODRWMTguOTE2SDE2NS4wNDhWMzQuMDAzSDE2OS45OTlWMTguOTE2SDE3My43NjNWMTQuMzU4Wk0xOTAuNzg3IDI1LjI2MkMxOTAuMTI5IDI0LjUwMTQgMTg5LjMwNyAyMy44OTk0IDE4OC4zODQgMjMuNTAxQzE4Ny40ODggMjMuMTE3IDE4Ni4zMzEgMjIuNzMyIDE4NC45NDggMjIuMzY0QzE4NC4xNjUgMjIuMTQzOSAxODMuMzkgMjEuODk3OCAxODIuNjIzIDIxLjYyNkMxODIuMTYzIDIxLjQ2MjEgMTgxLjc0MSAyMS4yMDY2IDE4MS4zODMgMjAuODc1QzE4MS4yMzUgMjAuNzQyMSAxODEuMTE4IDIwLjU3ODkgMTgxLjAzOSAyMC4zOTY0QzE4MC45NjEgMjAuMjE0IDE4MC45MjIgMjAuMDE2NiAxODAuOTI3IDE5LjgxOEMxODAuOTI3IDE5LjI3MiAxODEuMTU2IDE4Ljg0NCAxODEuNjI1IDE4LjUxQzE4Mi4xMjEgMTguMTU2IDE4Mi44NjIgMTcuOTc2IDE4My44MjYgMTcuOTc2QzE4NC43OSAxNy45NzYgMTg1LjU4NyAxOC4yMDkgMTg2LjE0OCAxOC42NjhDMTg2LjcwNiAxOS4xMjQgMTg3LjAwNyAxOS43MjUgMTg3LjA3MiAyMC41TDE4Ny4wOTQgMjAuNzgySDE5MS42MzNMMTkxLjYxNyAyMC40NkMxOTEuNTIxIDE4LjQ4NSAxOTAuNzcxIDE2LjkgMTg5LjM4NSAxNS43NUMxODguMDEyIDE0LjYxMiAxODYuMTg1IDE0LjAzMyAxODMuOTYyIDE0LjAzM0MxODIuNDc3IDE0LjAzMyAxODEuMTQxIDE0LjI4NyAxNzkuOTk0IDE0Ljc4NkMxNzguODMxIDE1LjI5MSAxNzcuOTI2IDE1Ljk5NSAxNzcuMjk2IDE2Ljg4MkMxNzYuNjczIDE3Ljc0NTUgMTc2LjMzOCAxOC43ODQgMTc2LjM0MSAxOS44NDlDMTc2LjM0MSAyMS4xNjcgMTc2LjY5OCAyMi4yNDkgMTc3LjM5OSAyMy4wNjRDMTc4LjA2IDIzLjg0MzIgMTc4Ljg5OCAyNC40NTM0IDE3OS44NDIgMjQuODQ0QzE4MC43NDQgMjUuMjE2IDE4MS45MjggMjUuNjA3IDE4My4zNjEgMjZDMTg0LjgwNiAyNi40MSAxODUuODcyIDI2Ljc4NSAxODYuNTMgMjcuMTIzQzE4Ny4xIDI3LjQxNCAxODcuMzc5IDI3Ljg0NSAxODcuMzc5IDI4LjQ0NEMxODcuMzc5IDI5LjA0MiAxODcuMTIyIDI5LjQ2NyAxODYuNTk1IDI5LjgzOUMxODYuMDQzIDMwLjIyNiAxODUuMjM3IDMwLjQyNSAxODQuMjAxIDMwLjQyNUMxODMuMTY2IDMwLjQyNSAxODIuMzk0IDMwLjE3NCAxODEuNzQ5IDI5LjY3NEMxODEuMTEzIDI5LjE4MSAxODAuNzcyIDI4LjU4OSAxODAuNzEgMjcuODY0TDE4MC42ODUgMjcuNTgySDE3Ni4wMTNMMTc2LjAyNSAyNy45MDFDMTc2LjA2NyAyOS4wOTU1IDE3Ni40NzIgMzAuMjQ4NyAxNzcuMTg4IDMxLjIwNkMxNzcuOTA3IDMyLjE4IDE3OC44OTMgMzIuOTU4IDE4MC4xMTggMzMuNTE5QzE4MS4zMzYgMzQuMDc3IDE4Mi43MzIgMzQuMzYyIDE4NC4yNjYgMzQuMzYyQzE4NS44MDEgMzQuMzYyIDE4Ny4xMDkgMzQuMTA4IDE4OC4yMzggMzMuNjA5QzE4OS4zNzYgMzMuMTA0IDE5MC4yNzIgMzIuMzk0IDE5MC45MDEgMzEuNDk0QzE5MS41MzQgMzAuNTkyIDE5MS44NTMgMjkuNTU0IDE5MS44NTMgMjguNDAzQzE5MS44MjggMjcuMTEgMTkxLjQ2NiAyNi4wNTMgMTkwLjc3NyAyNS4yNjJIMTkwLjc4N1oiIGZpbGw9IiM5QjlCOUIiLz4KPHBhdGggZD0iTTI0MS45ODIgMjUuNjU4MlYxNy43MTE3SDIyOC40NDFMMjIwLjQ5NCAyNS42NTgySDI0MS45ODJaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNTcuMjM5IDUuOTUwODFIMjQwLjI2NUwyMzIuMjU1IDEzLjg5NzNIMjU3LjIzOVY1Ljk1MDgxWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjEyLjYxMSAzMy42MDQ4TDIxNi42OCAyOS41MzYxSDIzMC40MTJWMzcuNDgyN0gyMTIuNjExVjMzLjYwNDhaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yMTUuNTk5IDIxLjc4MDNIMjI0LjM3MkwyMzIuMzgyIDEzLjgzMzdIMjE1LjU5OVYyMS43ODAzWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjA2IDMzLjYwNDdIMjEyLjYxMUwyMjAuNDk0IDI1LjY1ODJIMjA2VjMzLjYwNDdaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNDAuMjY1IDUuOTUwODFMMjM2LjE5NyAxMC4wMTk0SDIxMC4yNTlWMi4wNzI4OEgyNDAuMjY1VjUuOTUwODFaIiBmaWxsPSIjOUI5QjlCIi8+Cjwvc3ZnPgo=);background-repeat:no-repeat;background-size:170px 40px}>span{padding-left:.7rem}}@keyframes ag-watermark-fadeout{0%{opacity:.5}to{opacity:0}}.ag-charts-dialog{display:flex;flex-direction:column;font-size:var(--ag-charts-chrome-font-size-large)}.ag-charts-dialog__tabs{display:flex;flex-direction:column}.ag-charts-dialog__header{border-bottom:1px solid var(--ag-charts-border-color);display:flex}.ag-charts-dialog__tab-list{display:flex;gap:calc(var(--ag-charts-spacing) * 2)}.ag-charts-dialog__drag-handle{align-items:center;color:inherit;cursor:grab;display:flex;padding:1px 6px;text-align:center}.ag-charts-dialog__drag-handle--dragging{cursor:grabbing}.ag-charts-dialog__tab-button{background:none;border:0;border-bottom:2px solid transparent;border-radius:0;color:var(--ag-charts-panel-subtle-text-color);margin-bottom:-1px;padding:var(--input-padding) calc(var(--input-padding) / 2)}.ag-charts-dialog__tab-button:hover{background:none}.ag-charts-dialog__tab-button--active{border-color:var(--ag-charts-accent-color);color:inherit}.ag-charts-dialog__drag-handle+.ag-charts-dialog__tab-button{margin-left:calc(var(--ag-charts-spacing) * -2)}.ag-charts-button.ag-charts-dialog__close-button{background:none;border:0;margin-left:auto;padding:1px 6px}.ag-charts-dialog__close-button:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-dialog__tab-panel{display:none;flex-direction:column;gap:calc(var(--ag-charts-spacing) * 4);margin:0 calc(var(--ag-charts-spacing) * 4);padding:calc(var(--ag-charts-spacing) * 4) 0}.ag-charts-dialog__tab-panel--active{display:flex}.ag-charts-dialog__input-group-line{display:flex;gap:16px 18px;flex-wrap:wrap}.ag-charts-dialog__input-group{align-items:center;display:flex;font-size:var(--ag-charts-chrome-font-size)}.ag-charts-dialog__input-group-label{color:var(--ag-charts-panel-subtle-text-color);margin-right:5px}.ag-charts-dialog__input-group-label[for]{cursor:pointer}.ag-charts-dialog__button{border-radius:0;margin-right:-1px}.ag-charts-dialog__button.ag-charts-dialog__button--active{background:var(--ag-charts-button-focus-background-color);border-color:var(--ag-charts-input-focus-border-color);color:var(--ag-charts-input-focus-text-color);z-index:var(--input-layer-active)}.ag-charts-dialog__button:first-child,.ag-charts-dialog__input-group-label+.ag-charts-dialog__button{border-bottom-left-radius:var(--ag-charts-input-border-radius);border-top-left-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__button:last-child{border-bottom-right-radius:var(--ag-charts-input-border-radius);border-top-right-radius:var(--ag-charts-input-border-radius)}.ag-charts-dialog__color-picker-button{--color: #000;background:var(--color);border:none;color:transparent;height:26px;width:26px}.ag-charts-dialog__color-picker-button:hover{background:var(--color)}.ag-charts-dialog__color-picker-button--multi-color,.ag-charts-dialog__color-picker-button--multi-color:hover{background:linear-gradient(135deg,red 0%,#ff0 calc(100% * 1 / 6),#0f0 calc(100% * 2 / 6),#0ff 50%,#00f calc(100% * 4 / 6),#f0f calc(100% * 5 / 6),red 100%)}.ag-charts-color-picker{width:190px;padding:8px;cursor:default;--h: 0;--s: 0;--v: 0;--a: 0;--color: #000;--color-a: #000;--thumb-size: 18px;--inner-width: 172px;--track-height: 12px;--palette-height: 136px;--checker: url('data:image/svg+xml;utf8,');--multi-color: linear-gradient( 135deg, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-color-picker__content{display:flex;flex-direction:column}.ag-charts-color-picker__palette{position:relative;width:100%;height:var(--palette-height);margin-bottom:8px;background:linear-gradient(to bottom,#0000,#000),linear-gradient(to right,#fff,#fff0) hsl(var(--h),100%,50%);border-radius:calc(var(--ag-charts-border-radius) * 1.5);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__palette:after{content:"";position:absolute;display:block;top:calc(var(--thumb-size) * -.5 + (1 - var(--v)) * 100%);left:calc(var(--thumb-size) * -.5 + var(--s) * 100%);background:var(--color);width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__palette:focus-visible:after{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),0 0 0 2px #fff8,var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-row{display:flex;gap:8px;align-items:center;margin-bottom:4px;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input,.ag-charts-color-picker__alpha-input{-webkit-appearance:none;display:block;position:relative;padding:0;margin:0 calc(var(--inset) * -1);border:0;height:var(--thumb-size);width:auto;background:transparent;--inset: calc((var(--thumb-size) - var(--track-height)) / 2)}.ag-charts-color-picker__hue-input::-moz-range-thumb,.ag-charts-color-picker__alpha-input::-moz-range-thumb{appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038}.ag-charts-color-picker__hue-input::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{-webkit-appearance:none;width:var(--thumb-size);height:var(--thumb-size);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:var(--box-shadow);--box-shadow: inset 0 0 0 3px white, inset 0 0 1px 3px #0006, 0 0 5px #00000038;transform:translateZ(0)}.ag-charts-color-picker__hue-input::-moz-range-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__hue-input::-webkit-slider-thumb{background:hsl(var(--h),100%,50%)}.ag-charts-color-picker__alpha-input::-moz-range-thumb{background:transparent}.ag-charts-color-picker__alpha-input::-webkit-slider-thumb{background:transparent}.ag-charts-color-picker__alpha-input--opaque::-moz-range-thumb{background:var(--color)}.ag-charts-color-picker__alpha-input--opaque::-webkit-slider-thumb{background:var(--color)}.ag-charts-color-picker__hue-input:focus-visible::-moz-range-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-moz-range-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input:focus-visible::-webkit-slider-thumb,.ag-charts-color-picker__alpha-input:focus-visible::-webkit-slider-thumb{outline:var(--ag-charts-focus-border);box-shadow:var(--box-shadow),var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__hue-input::-moz-range-track,.ag-charts-color-picker__alpha-input::-moz-range-track{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__hue-input:before,.ag-charts-color-picker__alpha-input:before{position:absolute;content:"";display:block;top:calc(50% - var(--track-height) / 2);left:var(--inset);right:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button{width:36px;margin-left:var(--inset);height:var(--track-height);border-radius:calc(var(--ag-charts-border-radius) * 99);border:0;background:var(--multi-color);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__multi-color-button--hidden{display:none}.ag-charts-color-picker__multi-color-button--active{box-shadow:inset 0 0 0 1px #0003;outline-offset:1px;outline:2px solid #2196f3}.ag-charts-color-picker__hue-input{flex:1 0 0}.ag-charts-color-picker__hue-input::-moz-range-track{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__hue-input:before{background:linear-gradient(to right,red,red calc((100% - var(--track-height)) * 0 / 6 + var(--track-height) / 2),#ff0 calc((100% - var(--track-height)) * 1 / 6 + var(--track-height) / 2),#0f0 calc((100% - var(--track-height)) * 2 / 6 + var(--track-height) / 2),#0ff calc((100% - var(--track-height)) * 3 / 6 + var(--track-height) / 2),#00f calc((100% - var(--track-height)) * 4 / 6 + var(--track-height) / 2),#f0f calc((100% - var(--track-height)) * 5 / 6 + var(--track-height) / 2),red calc((100% - var(--track-height)) * 6 / 6 + var(--track-height) / 2))}.ag-charts-color-picker__alpha-input{margin-bottom:7px}.ag-charts-color-picker__alpha-input::-moz-range-track{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__alpha-input:before{background:linear-gradient(to right,transparent,var(--color)),var(--checker) top left / 4px 4px}.ag-charts-color-picker__color-field{display:flex;border:var(--ag-charts-border);background:var(--ag-charts-background-color);border-radius:var(--ag-charts-border-radius);overflow:hidden}.ag-charts-color-picker__color-field:has(:focus-visible){border-color:var(--ag-charts-accent-color);box-shadow:var(--ag-charts-focus-border-shadow)}.ag-charts-color-picker__color-label{width:16px;height:16px;margin:7px 0 7px 7px;color:transparent;background:linear-gradient(to right,var(--color-a),var(--color-a)),var(--checker) top left / 4px 4px;border-radius:calc(var(--ag-charts-border-radius) / 2);box-shadow:inset 0 0 0 1px #0003}.ag-charts-color-picker__color-label--multi-color{background:var(--multi-color)}.ag-charts-color-picker__color-input{flex:1;min-width:0;padding:7px 7px 7px 8px;border:0;margin:0;color:inherit;background:transparent;font-variant:tabular-nums}.ag-charts-color-picker__color-input:focus-visible{border:none;outline:none}.ag-charts-annotations__line-stroke-width-menu,.ag-charts-annotations__line-style-type-menu,.ag-charts-annotations__text-size-menu{border-top-left-radius:0;border-top-right-radius:0;.ag-charts-menu__row:first-child{border-radius:0}}.ag-charts-annotations__text-size-menu{--item-padding: 4px 8px;min-width:34px;text-align:center}.ag-charts-annotations__line-stroke-width-menu{--item-padding: 6px;column-gap:6px}.ag-charts-annotations__line-style-type-menu{--item-padding: 6px;column-gap:0}.ag-charts-annotations__stroke-width-button:before{background:var(--ag-charts-foreground-color);content:"";margin-right:var(--toolbar-button-padding);height:min(var(--stroke-width),20px);width:12px}.ag-charts-annotations__stroke-width-button[aria-disabled=true]:before{filter:grayscale(1);opacity:.5}.ag-charts-annotations__color-picker-button{--emblem: var(--color)}.ag-charts-annotations__color-picker-button--multi-color{--emblem: linear-gradient( to right, #f00 0% , #ff0 calc(100% * 1 / 6), #0f0 calc(100% * 2 / 6), #0ff 50% , #00f calc(100% * 4 / 6), #f0f calc(100% * 5 / 6), #f00 100% )}.ag-charts-annotations__color-picker-button:after{content:"";display:block;position:absolute;bottom:3px;left:5px;right:5px;height:4px;border-radius:99px;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ag-charts-foreground-color) 10%,transparent);background:var(--emblem)}.ag-charts-annotations__color-picker-button[aria-disabled=true]:after{filter:grayscale(1);opacity:.5}.ag-charts-annotations__toolbar-menu{min-width:200px}.ag-charts-annotations__axis-button--hidden{display:none}.ag-charts-annotations__axis-button{background-color:var(--ag-charts-crosshair-label-background-color);border-radius:calc(var(--ag-charts-border-radius) / 2);border:none;box-sizing:border-box;color:var(--ag-charts-crosshair-label-text-color);cursor:pointer;font-family:var(--ag-charts-button-font-family);font-size:var(--ag-charts-button-font-size);font-weight:var(--ag-charts-button-font-weight);left:0;line-height:16px;overflow:hidden;padding:0;position:absolute;top:0;user-select:none;white-space:nowrap;z-index:var(--ag-charts-layer-annotations)}.ag-charts-annotations__axis-button:hover{opacity:.8;color:var(--ag-charts-background-color)}.ag-charts-dialog--annotation-settings{min-height:233px;width:289px}.ag-charts-dialog--annotation-settings .ag-charts-textarea{height:calc(10px * 2 + var(--textarea-line-height) * 1em * 3 + 2px);overflow-y:auto;resize:vertical}.ag-charts-context-menu{font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);z-index:var(--ag-charts-layer-ui-overlay)}.ag-charts-context-menu__cover{position:fixed;left:0;top:0}.ag-charts-context-menu__menu{background:var(--ag-charts-menu-background-color);border-radius:var(--ag-charts-border-radius);border:var(--ag-charts-menu-border);box-shadow:var(--ag-charts-popup-shadow);color:var(--ag-charts-menu-text-color);display:flex;flex-direction:column;padding:.5em 0;transition:transform .1s ease;white-space:nowrap}.ag-charts-context-menu__menu:focus{outline:none}.ag-charts-context-menu__item{align-items:center;background:none;border:none;box-sizing:border-box;color:inherit;cursor:pointer;display:flex;font:inherit;justify-content:space-between;text-align:left;width:100%;-webkit-appearance:none;-moz-appearance:none}.ag-charts-context-menu__icon>img{width:var(--ag-charts-icon-size);height:var(--ag-charts-icon-size)}.ag-charts-context-menu__icon,.ag-charts-context-menu__cell{display:flex;align-items:center;flex-shrink:0}.ag-charts-context-menu__cell{flex-grow:1}.ag-charts-context-menu__cellpadding{padding:.5em 1em}.ag-charts-context-menu__icon{padding-right:0}.ag-charts-context-menu__item[data-focus-override=true],.ag-charts-context-menu__item:focus,.ag-charts-context-menu__item:active{background:var(--ag-charts-focus-color)}.ag-charts-context-menu__item[data-focus-override=false]{background:inherit}.ag-charts-context-menu__item[data-focus-visible-override=true]:focus,.ag-charts-context-menu__item:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-context-menu__item[data-focus-visible-override=false]{outline:inherit;box-shadow:inherit;z-index:inherit}.ag-charts-context-menu__item[aria-disabled=true]{border:none;color:color-mix(in srgb,var(--ag-charts-input-text-color) 50%,transparent)}.ag-charts-context-menu__item[aria-disabled=true]:focus{background:inherit;cursor:inherit}.ag-charts-context-menu__divider{padding:5px 0}.ag-charts-context-menu__divider:after{content:"";display:block;border-top:1px solid var(--ag-charts-border-color)}.ag-charts-crosshair-label{position:absolute;left:0;top:0;user-select:none;pointer-events:none;font-family:var(--ag-charts-font-family);font-size:var(--ag-charts-font-size);font-weight:var(--ag-charts-font-weight);overflow:hidden;white-space:nowrap;z-index:var(--ag-charts-layer-crosshair);box-sizing:border-box}.ag-charts-crosshair-label-content{padding:0 8px;border-radius:calc(var(--ag-charts-border-radius) / 2);line-height:calc(var(--ag-charts-font-size) + 8px);background-color:var(--ag-charts-crosshair-label-background-color);color:var(--ag-charts-crosshair-label-text-color)}.ag-charts-crosshair-label--hidden{visibility:hidden!important}.ag-charts-text-input{position:absolute}.ag-charts-text-input__textarea{--placeholder-text-color: var(--ag-charts-input-placeholder-text-color);display:block;height:100%;width:100%;border:0;background:none;line-height:1.38;outline:none;transform:translateY(.09em)}.ag-charts-text-input__textarea[placeholder]:empty:before{content:attr(placeholder);color:var(--placeholder-text-color);font-weight:400}.ag-charts-text-input__textarea[placeholder]:not(:empty):before{content:""}.ag-charts-chart-toolbar__menu{min-width:200px}.ag-charts-range-buttons .ag-charts-toolbar__button{padding:var(--toolbar-button-padding) calc(var(--toolbar-button-padding) * 1.5)}.ag-charts-zoom-buttons{align-items:center;display:flex;height:44px;justify-content:center;overflow:hidden;padding-bottom:10px;pointer-events:none;width:100%;.ag-charts-toolbar{--toolbar-size: 24px;--toolbar-button-padding: 1px;display:flex;font-size:var(--ag-charts-chrome-font-size);height:var(--toolbar-size);justify-content:center;opacity:1;pointer-events:auto;transition:opacity .2s ease-in-out,transform .4s ease-in-out;.ag-charts-toolbar__button--first{border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__button--last{border-bottom-right-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius)}.ag-charts-toolbar__label{padding-left:var(--ag-charts-spacing);padding-right:var(--ag-charts-spacing)}.ag-charts-toolbar__icon+.ag-charts-toolbar__label{padding-left:0}.ag-charts-toolbar__button--gap{margin-left:var(--toolbar-gap)}&.ag-charts-zoom-buttons__toolbar--hidden{opacity:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out}}}.ag-charts-shared-toolbar{gap:var(--toolbar-gap);.ag-charts-toolbar__button{border-radius:var(--ag-charts-border-radius);margin:0}} +`;k.ModuleRegistry.registerMany(jhe,fr);function xV(){k.moduleRegistry.register(jZ,KZ,MX,i8,c8,eq,Yq,RQ,sse,jse,one,c7,k8,T8,F8,b8,B8,q8,Pne,ooe,goe,Hoe,lae,xae,Hee,rte,iie,n7,rre,tX,rle,fle,Jle,uce,xX,Hce,SX,XJ,lJ,Xee,Ire,nhe,Qee,She,fte,zhe,wee,zte),k.enterpriseModule.isEnterprise=!0,k.enterpriseModule.styles=Hhe,k.enterpriseModule.licenseManager=e=>new Su(e.container?.ownerDocument??(typeof document>"u"?void 0:document)),k.enterpriseModule.injectWatermark=sie}xV();var Whe={setLicenseKey(e){Su.setLicenseKey(e)}};function bV(){xV(),Gx()}var $he={VERSION:fr,_Scene:$x,_Theme:Ux,_Util:Kx,create:So.create.bind(So),createSparkline:So.__createSparkline.bind(So),setup:bV,setGridContext:Su.setGridContext.bind(Su),setLicenseKey:Su.setLicenseKey.bind(Su),isEnterprise:!0};if(typeof va.exports=="object"&&typeof lp=="object"){var Uhe=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Object.getOwnPropertyNames(t))!Object.prototype.hasOwnProperty.call(e,n)&&n!==i&&Object.defineProperty(e,n,{get:()=>t[n],enumerable:!(s=Object.getOwnPropertyDescriptor(t,n))||s.enumerable});return e};va.exports=Uhe(va.exports,lp)}return va.exports});